diff --git a/Externals/Bochs_disasm/PowerPCDisasm.h b/Externals/Bochs_disasm/PowerPCDisasm.h index b6e71039e1..a7edbee910 100644 --- a/Externals/Bochs_disasm/PowerPCDisasm.h +++ b/Externals/Bochs_disasm/PowerPCDisasm.h @@ -1,28 +1,28 @@ -/* $VER: ppc_disasm V0.1 (23.05.1998) - * - * Disassembler module for the PowerPC microprocessor family - * Copyright (c) 1998-2000 Frank Wille - * - * ppc_disasm.c is freeware and may be freely redistributed as long as - * no modifications are made and nothing is charged for it. - * Non-commercial usage is allowed without any restrictions. - * EVERY PRODUCT OR PROGRAM DERIVED DIRECTLY FROM MY SOURCE MAY NOT BE - * SOLD COMMERCIALLY WITHOUT PERMISSION FROM THE AUTHOR. - * - * - * v0.1 (23.05.1998) phx - * First version, which implements all PowerPC instructions. - * v0.0 (09.05.1998) phx - * File created. - */ - - -// Yeah, this does not really belong in bochs_disasm, but hey, it's a disasm and it needed a common location... - -#ifndef _POWERPC_DISASM -#define _POWERPC_DISASM - -const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr); -const char *GetGRPName(unsigned int index); - -#endif +/* $VER: ppc_disasm V0.1 (23.05.1998) + * + * Disassembler module for the PowerPC microprocessor family + * Copyright (c) 1998-2000 Frank Wille + * + * ppc_disasm.c is freeware and may be freely redistributed as long as + * no modifications are made and nothing is charged for it. + * Non-commercial usage is allowed without any restrictions. + * EVERY PRODUCT OR PROGRAM DERIVED DIRECTLY FROM MY SOURCE MAY NOT BE + * SOLD COMMERCIALLY WITHOUT PERMISSION FROM THE AUTHOR. + * + * + * v0.1 (23.05.1998) phx + * First version, which implements all PowerPC instructions. + * v0.0 (09.05.1998) phx + * File created. + */ + + +// Yeah, this does not really belong in bochs_disasm, but hey, it's a disasm and it needed a common location... + +#ifndef _POWERPC_DISASM +#define _POWERPC_DISASM + +const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr); +const char *GetGRPName(unsigned int index); + +#endif diff --git a/Externals/Bochs_disasm/config.h b/Externals/Bochs_disasm/config.h index 1f6f3743c4..abfc45cc6e 100644 --- a/Externals/Bochs_disasm/config.h +++ b/Externals/Bochs_disasm/config.h @@ -1,41 +1,41 @@ -#ifndef _BOCHS_CONFIG_H -#define _BOCHS_CONFIG_H - -#ifdef _WIN32 -typedef signed __int8 Bit8s; -typedef signed __int16 Bit16s; -typedef signed __int32 Bit32s; -typedef signed __int64 Bit64s; - -typedef unsigned __int8 Bit8u; -typedef unsigned __int16 Bit16u; -typedef unsigned __int32 Bit32u; -typedef unsigned __int64 Bit64u; - -typedef bool bx_bool; -typedef Bit64u bx_address; - -#define BX_CPP_INLINE inline - -#else - -#include - -typedef int8_t Bit8s; -typedef int16_t Bit16s; -typedef int32_t Bit32s; -typedef int64_t Bit64s; - -typedef uint8_t Bit8u; -typedef uint16_t Bit16u; -typedef uint32_t Bit32u; -typedef uint64_t Bit64u; - -typedef bool bx_bool; -typedef Bit64u bx_address; - -#define BX_CPP_INLINE inline - -#endif - -#endif +#ifndef _BOCHS_CONFIG_H +#define _BOCHS_CONFIG_H + +#ifdef _WIN32 +typedef signed __int8 Bit8s; +typedef signed __int16 Bit16s; +typedef signed __int32 Bit32s; +typedef signed __int64 Bit64s; + +typedef unsigned __int8 Bit8u; +typedef unsigned __int16 Bit16u; +typedef unsigned __int32 Bit32u; +typedef unsigned __int64 Bit64u; + +typedef bool bx_bool; +typedef Bit64u bx_address; + +#define BX_CPP_INLINE inline + +#else + +#include + +typedef int8_t Bit8s; +typedef int16_t Bit16s; +typedef int32_t Bit32s; +typedef int64_t Bit64s; + +typedef uint8_t Bit8u; +typedef uint16_t Bit16u; +typedef uint32_t Bit32u; +typedef uint64_t Bit64u; + +typedef bool bx_bool; +typedef Bit64u bx_address; + +#define BX_CPP_INLINE inline + +#endif + +#endif diff --git a/Externals/Bochs_disasm/stdafx.h b/Externals/Bochs_disasm/stdafx.h index 05c32f8620..ecce07d111 100644 --- a/Externals/Bochs_disasm/stdafx.h +++ b/Externals/Bochs_disasm/stdafx.h @@ -1,18 +1,18 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define _CRT_SECURE_NO_DEPRECATE 1 - -#include -#include -#include - - - -// TODO: reference additional headers your program requires here +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define _CRT_SECURE_NO_DEPRECATE 1 + +#include +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/Externals/Cg/cg.h b/Externals/Cg/cg.h index 0f2047338f..63235f90ac 100644 --- a/Externals/Cg/cg.h +++ b/Externals/Cg/cg.h @@ -1,705 +1,705 @@ -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef _cg_h -#define _cg_h - -/*************************************************************************/ -/*** CG Run-Time Library API ***/ -/*************************************************************************/ - -#define CG_VERSION_NUM 2000 - -#ifdef _WIN32 -# ifndef APIENTRY /* From Win32's */ -# define CG_APIENTRY_DEFINED -# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) -# define APIENTRY __stdcall -# else -# define APIENTRY -# endif -# endif -# ifndef WINGDIAPI /* From Win32's and */ -# define CG_WINGDIAPI_DEFINED -# define WINGDIAPI __declspec(dllimport) -# endif -#endif /* _WIN32 */ - -/* Set up for either Win32 import/export/lib. */ -#ifndef CG_API -# ifdef _WIN32 -# ifdef CG_EXPORTS -# define CG_API __declspec(dllexport) -# elif defined (CG_LIB) -# define CG_API -# else -# define CG_API __declspec(dllimport) -# endif -# else -# define CG_API -# endif -#endif - -#ifndef CGENTRY -# ifdef _WIN32 -# define CGENTRY __cdecl -# else -# define CGENTRY -# endif -#endif - -/*************************************************************************/ -/*** Data types and enumerants ***/ -/*************************************************************************/ - -typedef int CGbool; - -#define CG_FALSE ((CGbool)0) -#define CG_TRUE ((CGbool)1) - -typedef struct _CGcontext *CGcontext; -typedef struct _CGprogram *CGprogram; -typedef struct _CGparameter *CGparameter; -typedef struct _CGobj *CGobj; -typedef struct _CGbuffer *CGbuffer; -typedef struct _CGeffect *CGeffect; -typedef struct _CGtechnique *CGtechnique; -typedef struct _CGpass *CGpass; -typedef struct _CGstate *CGstate; -typedef struct _CGstateassignment *CGstateassignment; -typedef struct _CGannotation *CGannotation; -typedef void *CGhandle; - - -//!!! PREPROCESS BEGIN - -typedef enum - { - CG_UNKNOWN_TYPE, - CG_STRUCT, - CG_ARRAY, - CG_TYPELESS_STRUCT, - - CG_TYPE_START_ENUM = 1024, -# define CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, ncols, nrows, pc) \ - enum_name , - -#include - -# undef CG_DATATYPE_MACRO - - - - } CGtype; - -typedef enum - { -# define CG_BINDLOCATION_MACRO(name,enum_name,compiler_name,\ - enum_int,addressable,param_type) \ - enum_name = enum_int, - -#include - - CG_UNDEFINED = 3256, - - } CGresource; - -typedef enum - { - CG_PROFILE_START = 6144, - CG_PROFILE_UNKNOWN, - -# define CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \ - CG_PROFILE_##compiler_id_caps = int_id, - -#include - - CG_PROFILE_MAX = 7100, - } CGprofile; - -typedef enum - { -# define CG_ERROR_MACRO(code, enum_name, message) \ - enum_name = code, -# include - } CGerror; - -typedef enum - { -# define CG_ENUM_MACRO(enum_name, enum_val) \ - enum_name = enum_val, -# include - } CGenum; - -//!!! PREPROCESS END - -typedef enum - { - CG_PARAMETERCLASS_UNKNOWN = 0, - CG_PARAMETERCLASS_SCALAR, - CG_PARAMETERCLASS_VECTOR, - CG_PARAMETERCLASS_MATRIX, - CG_PARAMETERCLASS_STRUCT, - CG_PARAMETERCLASS_ARRAY, - CG_PARAMETERCLASS_SAMPLER, - CG_PARAMETERCLASS_OBJECT - } CGparameterclass; - -typedef enum -{ - CG_UNKNOWN_DOMAIN = 0, - CG_FIRST_DOMAIN = 1, - CG_VERTEX_DOMAIN = 1, - CG_FRAGMENT_DOMAIN, - CG_GEOMETRY_DOMAIN, - CG_NUMBER_OF_DOMAINS -} CGdomain; - -typedef enum -{ - CG_MAP_READ = 0, - CG_MAP_WRITE, - CG_MAP_READ_WRITE, - CG_MAP_WRITE_DISCARD, - CG_MAP_WRITE_NO_OVERWRITE -} CGbufferaccess; - -typedef enum -{ - CG_BUFFER_USAGE_STREAM_DRAW = 0, - CG_BUFFER_USAGE_STREAM_READ, - CG_BUFFER_USAGE_STREAM_COPY, - CG_BUFFER_USAGE_STATIC_DRAW, - CG_BUFFER_USAGE_STATIC_READ, - CG_BUFFER_USAGE_STATIC_COPY, - CG_BUFFER_USAGE_DYNAMIC_DRAW, - CG_BUFFER_USAGE_DYNAMIC_READ, - CG_BUFFER_USAGE_DYNAMIC_COPY -} CGbufferusage; - -#ifdef __cplusplus -extern "C" { -#endif - -typedef CGbool (CGENTRY * CGstatecallback)(CGstateassignment); -typedef void (CGENTRY * CGerrorCallbackFunc)(void); -typedef void (CGENTRY * CGerrorHandlerFunc)(CGcontext ctx, CGerror err, void *data); - -/*************************************************************************/ -/*** Functions ***/ -/*************************************************************************/ - -#ifndef CG_EXPLICIT - -/*** Library policy functions ***/ - -CG_API CGenum CGENTRY cgSetLockingPolicy(CGenum lockingPolicy); -CG_API CGenum CGENTRY cgGetLockingPolicy(void); -CG_API CGenum CGENTRY cgSetSemanticCasePolicy(CGenum casePolicy); -CG_API CGenum CGENTRY cgGetSemanticCasePolicy(void); - -/*** Context functions ***/ - -CG_API CGcontext CGENTRY cgCreateContext(void); -CG_API void CGENTRY cgDestroyContext(CGcontext ctx); -CG_API CGbool CGENTRY cgIsContext(CGcontext ctx); -CG_API const char * CGENTRY cgGetLastListing(CGcontext ctx); -CG_API void CGENTRY cgSetLastListing(CGhandle handle, const char *listing); -CG_API void CGENTRY cgSetAutoCompile(CGcontext ctx, CGenum flag); -CG_API CGenum CGENTRY cgGetAutoCompile(CGcontext ctx); -CG_API void CGENTRY cgSetParameterSettingMode(CGcontext ctx, CGenum parameterSettingMode); -CG_API CGenum CGENTRY cgGetParameterSettingMode(CGcontext ctx); - -/*** Program functions ***/ - -CG_API CGprogram CGENTRY cgCreateProgram(CGcontext ctx, - CGenum program_type, - const char *program, - CGprofile profile, - const char *entry, - const char **args); -CG_API CGprogram CGENTRY cgCreateProgramFromFile(CGcontext ctx, - CGenum program_type, - const char *program_file, - CGprofile profile, - const char *entry, - const char **args); -CG_API CGprogram CGENTRY cgCopyProgram(CGprogram program); -CG_API void CGENTRY cgDestroyProgram(CGprogram program); - -CG_API CGprogram CGENTRY cgGetFirstProgram(CGcontext ctx); -CG_API CGprogram CGENTRY cgGetNextProgram(CGprogram current); -CG_API CGcontext CGENTRY cgGetProgramContext(CGprogram prog); -CG_API CGbool CGENTRY cgIsProgram(CGprogram program); - -CG_API void CGENTRY cgCompileProgram(CGprogram program); -CG_API CGbool CGENTRY cgIsProgramCompiled(CGprogram program); -CG_API const char * CGENTRY cgGetProgramString(CGprogram prog, CGenum pname); -CG_API CGprofile CGENTRY cgGetProgramProfile(CGprogram prog); -CG_API char const * const * CGENTRY cgGetProgramOptions(CGprogram prog); -CG_API void CGENTRY cgSetProgramProfile(CGprogram prog, CGprofile profile); -CG_API CGenum CGENTRY cgGetProgramInput(CGprogram program); -CG_API CGenum CGENTRY cgGetProgramOutput(CGprogram program); -CG_API void CGENTRY cgSetPassProgramParameters(CGprogram); -CG_API void CGENTRY cgUpdateProgramParameters(CGprogram program); - -/*** Parameter functions ***/ - -CG_API CGparameter CGENTRY cgCreateParameter(CGcontext ctx, CGtype type); -CG_API CGparameter CGENTRY cgCreateParameterArray(CGcontext ctx, - CGtype type, - int length); -CG_API CGparameter CGENTRY cgCreateParameterMultiDimArray(CGcontext ctx, - CGtype type, - int dim, - const int *lengths); -CG_API void CGENTRY cgDestroyParameter(CGparameter param); -CG_API void CGENTRY cgConnectParameter(CGparameter from, CGparameter to); -CG_API void CGENTRY cgDisconnectParameter(CGparameter param); -CG_API CGparameter CGENTRY cgGetConnectedParameter(CGparameter param); - -CG_API int CGENTRY cgGetNumConnectedToParameters(CGparameter param); -CG_API CGparameter CGENTRY cgGetConnectedToParameter(CGparameter param, int index); - -CG_API CGparameter CGENTRY cgGetNamedParameter(CGprogram prog, const char *name); -CG_API CGparameter CGENTRY cgGetNamedProgramParameter(CGprogram prog, - CGenum name_space, - const char *name); - -CG_API CGparameter CGENTRY cgGetFirstParameter(CGprogram prog, CGenum name_space); -CG_API CGparameter CGENTRY cgGetNextParameter(CGparameter current); -CG_API CGparameter CGENTRY cgGetFirstLeafParameter(CGprogram prog, CGenum name_space); -CG_API CGparameter CGENTRY cgGetNextLeafParameter(CGparameter current); - -CG_API CGparameter CGENTRY cgGetFirstStructParameter(CGparameter param); -CG_API CGparameter CGENTRY cgGetNamedStructParameter(CGparameter param, - const char *name); - -CG_API CGparameter CGENTRY cgGetFirstDependentParameter(CGparameter param); - -CG_API CGparameter CGENTRY cgGetArrayParameter(CGparameter aparam, int index); -CG_API int CGENTRY cgGetArrayDimension(CGparameter param); -CG_API CGtype CGENTRY cgGetArrayType(CGparameter param); -CG_API int CGENTRY cgGetArraySize(CGparameter param, int dimension); -CG_API int CGENTRY cgGetArrayTotalSize(CGparameter param); -CG_API void CGENTRY cgSetArraySize(CGparameter param, int size); -CG_API void CGENTRY cgSetMultiDimArraySize(CGparameter param, const int *sizes); - -CG_API CGprogram CGENTRY cgGetParameterProgram(CGparameter param); -CG_API CGcontext CGENTRY cgGetParameterContext(CGparameter param); -CG_API CGbool CGENTRY cgIsParameter(CGparameter param); -CG_API const char * CGENTRY cgGetParameterName(CGparameter param); -CG_API CGtype CGENTRY cgGetParameterType(CGparameter param); -CG_API CGtype CGENTRY cgGetParameterBaseType(CGparameter param); -CG_API CGparameterclass CGENTRY cgGetParameterClass(CGparameter param); -CG_API int CGENTRY cgGetParameterRows(CGparameter param); -CG_API int CGENTRY cgGetParameterColumns(CGparameter param); -CG_API CGtype CGENTRY cgGetParameterNamedType(CGparameter param); -CG_API const char * CGENTRY cgGetParameterSemantic(CGparameter param); -CG_API CGresource CGENTRY cgGetParameterResource(CGparameter param); -CG_API CGresource CGENTRY cgGetParameterBaseResource(CGparameter param); -CG_API unsigned long CGENTRY cgGetParameterResourceIndex(CGparameter param); -CG_API CGenum CGENTRY cgGetParameterVariability(CGparameter param); -CG_API CGenum CGENTRY cgGetParameterDirection(CGparameter param); -CG_API CGbool CGENTRY cgIsParameterReferenced(CGparameter param); -CG_API CGbool CGENTRY cgIsParameterUsed(CGparameter param, CGhandle handle); -CG_API const double * CGENTRY cgGetParameterValues(CGparameter param, - CGenum value_type, - int *nvalues); -CG_API void CGENTRY cgSetParameterValuedr(CGparameter param, int n, const double *vals); -CG_API void CGENTRY cgSetParameterValuedc(CGparameter param, int n, const double *vals); -CG_API void CGENTRY cgSetParameterValuefr(CGparameter param, int n, const float *vals); -CG_API void CGENTRY cgSetParameterValuefc(CGparameter param, int n, const float *vals); -CG_API void CGENTRY cgSetParameterValueir(CGparameter param, int n, const int *vals); -CG_API void CGENTRY cgSetParameterValueic(CGparameter param, int n, const int *vals); -CG_API int CGENTRY cgGetParameterValuedr(CGparameter param, int n, double *vals); -CG_API int CGENTRY cgGetParameterValuedc(CGparameter param, int n, double *vals); -CG_API int CGENTRY cgGetParameterValuefr(CGparameter param, int n, float *vals); -CG_API int CGENTRY cgGetParameterValuefc(CGparameter param, int n, float *vals); -CG_API int CGENTRY cgGetParameterValueir(CGparameter param, int n, int *vals); -CG_API int CGENTRY cgGetParameterValueic(CGparameter param, int n, int *vals); -CG_API const char * CGENTRY cgGetStringParameterValue(CGparameter param); -CG_API void CGENTRY cgSetStringParameterValue(CGparameter param, const char *str); - -CG_API int CGENTRY cgGetParameterOrdinalNumber(CGparameter param); -CG_API CGbool CGENTRY cgIsParameterGlobal(CGparameter param); -CG_API int CGENTRY cgGetParameterIndex(CGparameter param); - -CG_API void CGENTRY cgSetParameterVariability(CGparameter param, CGenum vary); -CG_API void CGENTRY cgSetParameterSemantic(CGparameter param, const char *semantic); - -CG_API void CGENTRY cgSetParameter1f(CGparameter param, float x); -CG_API void CGENTRY cgSetParameter2f(CGparameter param, float x, float y); -CG_API void CGENTRY cgSetParameter3f(CGparameter param, float x, float y, float z); -CG_API void CGENTRY cgSetParameter4f(CGparameter param, - float x, - float y, - float z, - float w); -CG_API void CGENTRY cgSetParameter1d(CGparameter param, double x); -CG_API void CGENTRY cgSetParameter2d(CGparameter param, double x, double y); -CG_API void CGENTRY cgSetParameter3d(CGparameter param, - double x, - double y, - double z); -CG_API void CGENTRY cgSetParameter4d(CGparameter param, - double x, - double y, - double z, - double w); -CG_API void CGENTRY cgSetParameter1i(CGparameter param, int x); -CG_API void CGENTRY cgSetParameter2i(CGparameter param, int x, int y); -CG_API void CGENTRY cgSetParameter3i(CGparameter param, int x, int y, int z); -CG_API void CGENTRY cgSetParameter4i(CGparameter param, - int x, - int y, - int z, - int w); - -CG_API void CGENTRY cgSetParameter1iv(CGparameter param, const int *v); -CG_API void CGENTRY cgSetParameter2iv(CGparameter param, const int *v); -CG_API void CGENTRY cgSetParameter3iv(CGparameter param, const int *v); -CG_API void CGENTRY cgSetParameter4iv(CGparameter param, const int *v); -CG_API void CGENTRY cgSetParameter1fv(CGparameter param, const float *v); -CG_API void CGENTRY cgSetParameter2fv(CGparameter param, const float *v); -CG_API void CGENTRY cgSetParameter3fv(CGparameter param, const float *v); -CG_API void CGENTRY cgSetParameter4fv(CGparameter param, const float *v); -CG_API void CGENTRY cgSetParameter1dv(CGparameter param, const double *v); -CG_API void CGENTRY cgSetParameter2dv(CGparameter param, const double *v); -CG_API void CGENTRY cgSetParameter3dv(CGparameter param, const double *v); -CG_API void CGENTRY cgSetParameter4dv(CGparameter param, const double *v); - -CG_API void CGENTRY cgSetMatrixParameterir(CGparameter param, const int *matrix); -CG_API void CGENTRY cgSetMatrixParameterdr(CGparameter param, const double *matrix); -CG_API void CGENTRY cgSetMatrixParameterfr(CGparameter param, const float *matrix); -CG_API void CGENTRY cgSetMatrixParameteric(CGparameter param, const int *matrix); -CG_API void CGENTRY cgSetMatrixParameterdc(CGparameter param, const double *matrix); -CG_API void CGENTRY cgSetMatrixParameterfc(CGparameter param, const float *matrix); - -CG_API void CGENTRY cgGetMatrixParameterir(CGparameter param, int *matrix); -CG_API void CGENTRY cgGetMatrixParameterdr(CGparameter param, double *matrix); -CG_API void CGENTRY cgGetMatrixParameterfr(CGparameter param, float *matrix); -CG_API void CGENTRY cgGetMatrixParameteric(CGparameter param, int *matrix); -CG_API void CGENTRY cgGetMatrixParameterdc(CGparameter param, double *matrix); -CG_API void CGENTRY cgGetMatrixParameterfc(CGparameter param, float *matrix); - -CG_API CGparameter CGENTRY cgGetNamedSubParameter(CGparameter param, const char *name); - -/*** Type Functions ***/ - -CG_API const char * CGENTRY cgGetTypeString(CGtype type); -CG_API CGtype CGENTRY cgGetType(const char *type_string); - -CG_API CGtype CGENTRY cgGetNamedUserType(CGhandle handle, const char *name); - -CG_API int CGENTRY cgGetNumUserTypes(CGhandle handle); -CG_API CGtype CGENTRY cgGetUserType(CGhandle handle, int index); - -CG_API int CGENTRY cgGetNumParentTypes(CGtype type); -CG_API CGtype CGENTRY cgGetParentType(CGtype type, int index); - -CG_API CGbool CGENTRY cgIsParentType(CGtype parent, CGtype child); -CG_API CGbool CGENTRY cgIsInterfaceType(CGtype type); - -/*** Resource Functions ***/ - -CG_API const char * CGENTRY cgGetResourceString(CGresource resource); -CG_API CGresource CGENTRY cgGetResource(const char *resource_string); - -/*** Enum Functions ***/ - -CG_API const char * CGENTRY cgGetEnumString(CGenum en); -CG_API CGenum CGENTRY cgGetEnum(const char *enum_string); - -/*** Profile Functions ***/ - -CG_API const char * CGENTRY cgGetProfileString(CGprofile profile); -CG_API CGprofile CGENTRY cgGetProfile(const char *profile_string); - -/*** Error Functions ***/ - -CG_API CGerror CGENTRY cgGetError(void); -CG_API CGerror CGENTRY cgGetFirstError(void); -CG_API const char * CGENTRY cgGetErrorString(CGerror error); -CG_API const char * CGENTRY cgGetLastErrorString(CGerror *error); -CG_API void CGENTRY cgSetErrorCallback(CGerrorCallbackFunc func); -CG_API CGerrorCallbackFunc CGENTRY cgGetErrorCallback(void); -CG_API void CGENTRY cgSetErrorHandler(CGerrorHandlerFunc func, void *data); -CG_API CGerrorHandlerFunc CGENTRY cgGetErrorHandler(void **data); - -/*** Misc Functions ***/ - -CG_API const char * CGENTRY cgGetString(CGenum sname); - - -/*** CgFX Functions ***/ - -CG_API CGeffect CGENTRY cgCreateEffect(CGcontext, const char *code, const char **args); -CG_API CGeffect CGENTRY cgCreateEffectFromFile(CGcontext, const char *filename, - const char **args); -CG_API CGeffect CGENTRY cgCopyEffect(CGeffect effect); -CG_API void CGENTRY cgDestroyEffect(CGeffect); -CG_API CGcontext CGENTRY cgGetEffectContext(CGeffect); -CG_API CGbool CGENTRY cgIsEffect(CGeffect effect); - -CG_API CGeffect CGENTRY cgGetFirstEffect(CGcontext); -CG_API CGeffect CGENTRY cgGetNextEffect(CGeffect); - -CG_API CGprogram CGENTRY cgCreateProgramFromEffect(CGeffect effect, - CGprofile profile, - const char *entry, - const char **args); - -CG_API CGtechnique CGENTRY cgGetFirstTechnique(CGeffect); -CG_API CGtechnique CGENTRY cgGetNextTechnique(CGtechnique); -CG_API CGtechnique CGENTRY cgGetNamedTechnique(CGeffect, const char *name); -CG_API const char * CGENTRY cgGetTechniqueName(CGtechnique); -CG_API CGbool CGENTRY cgIsTechnique(CGtechnique); -CG_API CGbool CGENTRY cgValidateTechnique(CGtechnique); -CG_API CGbool CGENTRY cgIsTechniqueValidated(CGtechnique); -CG_API CGeffect CGENTRY cgGetTechniqueEffect(CGtechnique); - -CG_API CGpass CGENTRY cgGetFirstPass(CGtechnique); -CG_API CGpass CGENTRY cgGetNamedPass(CGtechnique, const char *name); -CG_API CGpass CGENTRY cgGetNextPass(CGpass); -CG_API CGbool CGENTRY cgIsPass(CGpass); -CG_API const char * CGENTRY cgGetPassName(CGpass); -CG_API CGtechnique CGENTRY cgGetPassTechnique(CGpass); - -CG_API void CGENTRY cgSetPassState(CGpass); -CG_API void CGENTRY cgResetPassState(CGpass); - -CG_API CGstateassignment CGENTRY cgGetFirstStateAssignment(CGpass); -CG_API CGstateassignment CGENTRY cgGetNamedStateAssignment(CGpass, const char *name); -CG_API CGstateassignment CGENTRY cgGetNextStateAssignment(CGstateassignment); -CG_API CGbool CGENTRY cgIsStateAssignment(CGstateassignment); -CG_API CGbool CGENTRY cgCallStateSetCallback(CGstateassignment); -CG_API CGbool CGENTRY cgCallStateValidateCallback(CGstateassignment); -CG_API CGbool CGENTRY cgCallStateResetCallback(CGstateassignment); -CG_API CGpass CGENTRY cgGetStateAssignmentPass(CGstateassignment); -CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentParameter(CGstateassignment); - -CG_API const float * CGENTRY cgGetFloatStateAssignmentValues(CGstateassignment, int *nVals); -CG_API const int * CGENTRY cgGetIntStateAssignmentValues(CGstateassignment, int *nVals); -CG_API const CGbool * CGENTRY cgGetBoolStateAssignmentValues(CGstateassignment, int *nVals); -CG_API const char * CGENTRY cgGetStringStateAssignmentValue(CGstateassignment); -CG_API CGprogram CGENTRY cgGetProgramStateAssignmentValue(CGstateassignment); -CG_API CGparameter CGENTRY cgGetTextureStateAssignmentValue(CGstateassignment); -CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentValue(CGstateassignment); -CG_API int CGENTRY cgGetStateAssignmentIndex(CGstateassignment); - -CG_API int CGENTRY cgGetNumDependentStateAssignmentParameters(CGstateassignment); -CG_API CGparameter CGENTRY cgGetDependentStateAssignmentParameter(CGstateassignment, int index); - -CG_API CGparameter CGENTRY cgGetConnectedStateAssignmentParameter(CGstateassignment); - -CG_API CGstate CGENTRY cgGetStateAssignmentState(CGstateassignment); -CG_API CGstate CGENTRY cgGetSamplerStateAssignmentState(CGstateassignment); - -CG_API CGstate CGENTRY cgCreateState(CGcontext, const char *name, CGtype); -CG_API CGstate CGENTRY cgCreateArrayState(CGcontext, const char *name, CGtype, int nelems); -CG_API void CGENTRY cgSetStateCallbacks(CGstate, CGstatecallback set, CGstatecallback reset, - CGstatecallback validate); -CG_API CGstatecallback CGENTRY cgGetStateSetCallback(CGstate); -CG_API CGstatecallback CGENTRY cgGetStateResetCallback(CGstate); -CG_API CGstatecallback CGENTRY cgGetStateValidateCallback(CGstate); -CG_API CGcontext CGENTRY cgGetStateContext(CGstate); -CG_API CGtype CGENTRY cgGetStateType(CGstate); -CG_API const char * CGENTRY cgGetStateName(CGstate); -CG_API CGstate CGENTRY cgGetNamedState(CGcontext, const char *name); -CG_API CGstate CGENTRY cgGetFirstState(CGcontext); -CG_API CGstate CGENTRY cgGetNextState(CGstate); -CG_API CGbool CGENTRY cgIsState(CGstate); -CG_API void CGENTRY cgAddStateEnumerant(CGstate, const char *name, int value); - -CG_API CGstate CGENTRY cgCreateSamplerState(CGcontext, const char *name, CGtype); -CG_API CGstate CGENTRY cgCreateArraySamplerState(CGcontext, const char *name, CGtype, int nelems); -CG_API CGstate CGENTRY cgGetNamedSamplerState(CGcontext, const char *name); -CG_API CGstate CGENTRY cgGetFirstSamplerState(CGcontext); - -CG_API CGstateassignment CGENTRY cgGetFirstSamplerStateAssignment(CGparameter); -CG_API CGstateassignment CGENTRY cgGetNamedSamplerStateAssignment(CGparameter, const char *); -CG_API void CGENTRY cgSetSamplerState(CGparameter); - -CG_API CGparameter CGENTRY cgGetNamedEffectParameter(CGeffect, const char *); -CG_API CGparameter CGENTRY cgGetFirstLeafEffectParameter(CGeffect); -CG_API CGparameter CGENTRY cgGetFirstEffectParameter(CGeffect); -CG_API CGparameter CGENTRY cgGetEffectParameterBySemantic(CGeffect, const char *); - -CG_API CGannotation CGENTRY cgGetFirstTechniqueAnnotation(CGtechnique); -CG_API CGannotation CGENTRY cgGetFirstPassAnnotation(CGpass); -CG_API CGannotation CGENTRY cgGetFirstParameterAnnotation(CGparameter); -CG_API CGannotation CGENTRY cgGetFirstProgramAnnotation(CGprogram); -CG_API CGannotation CGENTRY cgGetFirstEffectAnnotation(CGeffect); -CG_API CGannotation CGENTRY cgGetNextAnnotation(CGannotation); - -CG_API CGannotation CGENTRY cgGetNamedTechniqueAnnotation(CGtechnique, const char *); -CG_API CGannotation CGENTRY cgGetNamedPassAnnotation(CGpass, const char *); -CG_API CGannotation CGENTRY cgGetNamedParameterAnnotation(CGparameter, const char *); -CG_API CGannotation CGENTRY cgGetNamedProgramAnnotation(CGprogram, const char *); -CG_API CGannotation CGENTRY cgGetNamedEffectAnnotation(CGeffect, const char *); - -CG_API CGbool CGENTRY cgIsAnnotation(CGannotation); - -CG_API const char * CGENTRY cgGetAnnotationName(CGannotation); -CG_API CGtype CGENTRY cgGetAnnotationType(CGannotation); - -CG_API const float * CGENTRY cgGetFloatAnnotationValues(CGannotation, int *nvalues); -CG_API const int * CGENTRY cgGetIntAnnotationValues(CGannotation, int *nvalues); -CG_API const char * CGENTRY cgGetStringAnnotationValue(CGannotation); -CG_API const char * const * CGENTRY cgGetStringAnnotationValues(CGannotation, int *nvalues); -CG_API const CGbool * CGENTRY cgGetBoolAnnotationValues(CGannotation, int *nvalues); -CG_API const int * CGENTRY cgGetBooleanAnnotationValues(CGannotation, int *nvalues); - -CG_API int CGENTRY cgGetNumDependentAnnotationParameters(CGannotation); -CG_API CGparameter CGENTRY cgGetDependentAnnotationParameter(CGannotation, int index); - -CG_API void CGENTRY cgEvaluateProgram(CGprogram, float *, int ncomps, int nx, int ny, int nz); - -/*** Cg 1.5 Additions ***/ - -CG_API CGbool CGENTRY cgSetEffectName(CGeffect, const char *name); -CG_API const char * CGENTRY cgGetEffectName(CGeffect); -CG_API CGeffect CGENTRY cgGetNamedEffect(CGcontext, const char *name); -CG_API CGparameter CGENTRY cgCreateEffectParameter(CGeffect, const char *name, CGtype); - -CG_API CGtechnique CGENTRY cgCreateTechnique(CGeffect, const char *name); - -CG_API CGparameter CGENTRY cgCreateEffectParameterArray(CGeffect, const char *name, CGtype type, int length); -CG_API CGparameter CGENTRY cgCreateEffectParameterMultiDimArray(CGeffect, const char *name, CGtype type, int dim, const int *lengths); - -CG_API CGpass CGENTRY cgCreatePass(CGtechnique, const char *name); - -CG_API CGstateassignment CGENTRY cgCreateStateAssignment(CGpass, CGstate); -CG_API CGstateassignment CGENTRY cgCreateStateAssignmentIndex(CGpass, CGstate, int index); -CG_API CGstateassignment CGENTRY cgCreateSamplerStateAssignment(CGparameter, CGstate); - -CG_API CGbool CGENTRY cgSetFloatStateAssignment(CGstateassignment, float); -CG_API CGbool CGENTRY cgSetIntStateAssignment(CGstateassignment, int); -CG_API CGbool CGENTRY cgSetBoolStateAssignment(CGstateassignment, CGbool); -CG_API CGbool CGENTRY cgSetStringStateAssignment(CGstateassignment, const char *); -CG_API CGbool CGENTRY cgSetProgramStateAssignment(CGstateassignment, CGprogram); -CG_API CGbool CGENTRY cgSetSamplerStateAssignment(CGstateassignment, CGparameter); -CG_API CGbool CGENTRY cgSetTextureStateAssignment(CGstateassignment, CGparameter); - -CG_API CGbool CGENTRY cgSetFloatArrayStateAssignment(CGstateassignment, const float *vals); -CG_API CGbool CGENTRY cgSetIntArrayStateAssignment(CGstateassignment, const int *vals); -CG_API CGbool CGENTRY cgSetBoolArrayStateAssignment(CGstateassignment, const CGbool *vals); - -CG_API CGannotation CGENTRY cgCreateTechniqueAnnotation(CGtechnique, const char *name, CGtype); -CG_API CGannotation CGENTRY cgCreatePassAnnotation(CGpass, const char *name, CGtype); -CG_API CGannotation CGENTRY cgCreateParameterAnnotation(CGparameter, const char *name, CGtype); -CG_API CGannotation CGENTRY cgCreateProgramAnnotation(CGprogram, const char *name, CGtype); -CG_API CGannotation CGENTRY cgCreateEffectAnnotation(CGeffect, const char *name, CGtype); - -CG_API CGbool CGENTRY cgSetIntAnnotation(CGannotation, int value); -CG_API CGbool CGENTRY cgSetFloatAnnotation(CGannotation, float value); -CG_API CGbool CGENTRY cgSetBoolAnnotation(CGannotation, CGbool value); -CG_API CGbool CGENTRY cgSetStringAnnotation(CGannotation, const char *value); - -CG_API const char * CGENTRY cgGetStateEnumerantName(CGstate, int value); -CG_API int CGENTRY cgGetStateEnumerantValue(CGstate, const char *name); - -CG_API CGeffect CGENTRY cgGetParameterEffect(CGparameter param); - -CG_API CGparameterclass CGENTRY cgGetTypeClass(CGtype type); -CG_API CGtype CGENTRY cgGetTypeBase(CGtype type); -CG_API CGbool CGENTRY cgGetTypeSizes(CGtype type, int *nrows, int *ncols); -CG_API void CGENTRY cgGetMatrixSize(CGtype type, int *nrows, int *ncols); - -CG_API int CGENTRY cgGetNumProgramDomains( CGprogram program ); -CG_API CGdomain CGENTRY cgGetProfileDomain( CGprofile profile ); -CG_API CGprogram CGENTRY cgCombinePrograms( int n, const CGprogram *exeList ); -CG_API CGprogram CGENTRY cgCombinePrograms2( const CGprogram exe1, const CGprogram exe2 ); -CG_API CGprogram CGENTRY cgCombinePrograms3( const CGprogram exe1, const CGprogram exe2, const CGprogram exe3 ); -CG_API CGprofile CGENTRY cgGetProgramDomainProfile(CGprogram program, int index); - -/*** CGobj Functions ***/ -CG_API CGobj CGENTRY cgCreateObj( CGcontext context, CGenum program_type, const char *source, CGprofile profile, const char **args ); -CG_API CGobj CGENTRY cgCreateObjFromFile( CGcontext context, CGenum program_type, const char *source_file, CGprofile profile, const char **args ); -CG_API void CGENTRY cgDestroyObj( CGobj obj ); - -CG_API long CGENTRY cgGetParameterResourceSize(CGparameter); -CG_API CGtype CGENTRY cgGetParameterResourceType(CGparameter); -CG_API int CGENTRY cgGetParameterBufferIndex(CGparameter); -CG_API int CGENTRY cgGetParameterBufferOffset(CGparameter); - -CG_API CGbuffer CGENTRY cgCreateBuffer(CGcontext, int size, const void *data, CGbufferusage bufferUsage); -CG_API void CGENTRY cgSetBufferData(CGbuffer, int size, const void *data); -CG_API void CGENTRY cgSetBufferSubData(CGbuffer, int offset, int size, const void *data); -CG_API void CGENTRY cgSetProgramBuffer(CGprogram program, int bufferIndex, CGbuffer buffer); - -CG_API void * CGENTRY cgMapBuffer(CGbuffer buffer, CGbufferaccess access); -CG_API void CGENTRY cgUnmapBuffer(CGbuffer buffer); -CG_API void CGENTRY cgDestroyBuffer(CGbuffer buffer); -CG_API CGbuffer CGENTRY cgGetProgramBuffer(CGprogram, int bufferIndex); -CG_API int CGENTRY cgGetBufferSize(CGbuffer); -CG_API int CGENTRY cgGetProgramBufferMaxSize(CGprofile profile); -CG_API int CGENTRY cgGetProgramBufferMaxIndex(CGprofile profile); - -#endif - -#ifdef __cplusplus -} -#endif - -#ifdef CG_APIENTRY_DEFINED -# undef CG_APIENTRY_DEFINED -# undef APIENTRY -#endif - -#ifdef CG_WINGDIAPI_DEFINED -# undef CG_WINGDIAPI_DEFINED -# undef WINGDIAPI -#endif - -#endif +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _cg_h +#define _cg_h + +/*************************************************************************/ +/*** CG Run-Time Library API ***/ +/*************************************************************************/ + +#define CG_VERSION_NUM 2000 + +#ifdef _WIN32 +# ifndef APIENTRY /* From Win32's */ +# define CG_APIENTRY_DEFINED +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif +# endif +# ifndef WINGDIAPI /* From Win32's and */ +# define CG_WINGDIAPI_DEFINED +# define WINGDIAPI __declspec(dllimport) +# endif +#endif /* _WIN32 */ + +/* Set up for either Win32 import/export/lib. */ +#ifndef CG_API +# ifdef _WIN32 +# ifdef CG_EXPORTS +# define CG_API __declspec(dllexport) +# elif defined (CG_LIB) +# define CG_API +# else +# define CG_API __declspec(dllimport) +# endif +# else +# define CG_API +# endif +#endif + +#ifndef CGENTRY +# ifdef _WIN32 +# define CGENTRY __cdecl +# else +# define CGENTRY +# endif +#endif + +/*************************************************************************/ +/*** Data types and enumerants ***/ +/*************************************************************************/ + +typedef int CGbool; + +#define CG_FALSE ((CGbool)0) +#define CG_TRUE ((CGbool)1) + +typedef struct _CGcontext *CGcontext; +typedef struct _CGprogram *CGprogram; +typedef struct _CGparameter *CGparameter; +typedef struct _CGobj *CGobj; +typedef struct _CGbuffer *CGbuffer; +typedef struct _CGeffect *CGeffect; +typedef struct _CGtechnique *CGtechnique; +typedef struct _CGpass *CGpass; +typedef struct _CGstate *CGstate; +typedef struct _CGstateassignment *CGstateassignment; +typedef struct _CGannotation *CGannotation; +typedef void *CGhandle; + + +//!!! PREPROCESS BEGIN + +typedef enum + { + CG_UNKNOWN_TYPE, + CG_STRUCT, + CG_ARRAY, + CG_TYPELESS_STRUCT, + + CG_TYPE_START_ENUM = 1024, +# define CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, ncols, nrows, pc) \ + enum_name , + +#include + +# undef CG_DATATYPE_MACRO + + + + } CGtype; + +typedef enum + { +# define CG_BINDLOCATION_MACRO(name,enum_name,compiler_name,\ + enum_int,addressable,param_type) \ + enum_name = enum_int, + +#include + + CG_UNDEFINED = 3256, + + } CGresource; + +typedef enum + { + CG_PROFILE_START = 6144, + CG_PROFILE_UNKNOWN, + +# define CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \ + CG_PROFILE_##compiler_id_caps = int_id, + +#include + + CG_PROFILE_MAX = 7100, + } CGprofile; + +typedef enum + { +# define CG_ERROR_MACRO(code, enum_name, message) \ + enum_name = code, +# include + } CGerror; + +typedef enum + { +# define CG_ENUM_MACRO(enum_name, enum_val) \ + enum_name = enum_val, +# include + } CGenum; + +//!!! PREPROCESS END + +typedef enum + { + CG_PARAMETERCLASS_UNKNOWN = 0, + CG_PARAMETERCLASS_SCALAR, + CG_PARAMETERCLASS_VECTOR, + CG_PARAMETERCLASS_MATRIX, + CG_PARAMETERCLASS_STRUCT, + CG_PARAMETERCLASS_ARRAY, + CG_PARAMETERCLASS_SAMPLER, + CG_PARAMETERCLASS_OBJECT + } CGparameterclass; + +typedef enum +{ + CG_UNKNOWN_DOMAIN = 0, + CG_FIRST_DOMAIN = 1, + CG_VERTEX_DOMAIN = 1, + CG_FRAGMENT_DOMAIN, + CG_GEOMETRY_DOMAIN, + CG_NUMBER_OF_DOMAINS +} CGdomain; + +typedef enum +{ + CG_MAP_READ = 0, + CG_MAP_WRITE, + CG_MAP_READ_WRITE, + CG_MAP_WRITE_DISCARD, + CG_MAP_WRITE_NO_OVERWRITE +} CGbufferaccess; + +typedef enum +{ + CG_BUFFER_USAGE_STREAM_DRAW = 0, + CG_BUFFER_USAGE_STREAM_READ, + CG_BUFFER_USAGE_STREAM_COPY, + CG_BUFFER_USAGE_STATIC_DRAW, + CG_BUFFER_USAGE_STATIC_READ, + CG_BUFFER_USAGE_STATIC_COPY, + CG_BUFFER_USAGE_DYNAMIC_DRAW, + CG_BUFFER_USAGE_DYNAMIC_READ, + CG_BUFFER_USAGE_DYNAMIC_COPY +} CGbufferusage; + +#ifdef __cplusplus +extern "C" { +#endif + +typedef CGbool (CGENTRY * CGstatecallback)(CGstateassignment); +typedef void (CGENTRY * CGerrorCallbackFunc)(void); +typedef void (CGENTRY * CGerrorHandlerFunc)(CGcontext ctx, CGerror err, void *data); + +/*************************************************************************/ +/*** Functions ***/ +/*************************************************************************/ + +#ifndef CG_EXPLICIT + +/*** Library policy functions ***/ + +CG_API CGenum CGENTRY cgSetLockingPolicy(CGenum lockingPolicy); +CG_API CGenum CGENTRY cgGetLockingPolicy(void); +CG_API CGenum CGENTRY cgSetSemanticCasePolicy(CGenum casePolicy); +CG_API CGenum CGENTRY cgGetSemanticCasePolicy(void); + +/*** Context functions ***/ + +CG_API CGcontext CGENTRY cgCreateContext(void); +CG_API void CGENTRY cgDestroyContext(CGcontext ctx); +CG_API CGbool CGENTRY cgIsContext(CGcontext ctx); +CG_API const char * CGENTRY cgGetLastListing(CGcontext ctx); +CG_API void CGENTRY cgSetLastListing(CGhandle handle, const char *listing); +CG_API void CGENTRY cgSetAutoCompile(CGcontext ctx, CGenum flag); +CG_API CGenum CGENTRY cgGetAutoCompile(CGcontext ctx); +CG_API void CGENTRY cgSetParameterSettingMode(CGcontext ctx, CGenum parameterSettingMode); +CG_API CGenum CGENTRY cgGetParameterSettingMode(CGcontext ctx); + +/*** Program functions ***/ + +CG_API CGprogram CGENTRY cgCreateProgram(CGcontext ctx, + CGenum program_type, + const char *program, + CGprofile profile, + const char *entry, + const char **args); +CG_API CGprogram CGENTRY cgCreateProgramFromFile(CGcontext ctx, + CGenum program_type, + const char *program_file, + CGprofile profile, + const char *entry, + const char **args); +CG_API CGprogram CGENTRY cgCopyProgram(CGprogram program); +CG_API void CGENTRY cgDestroyProgram(CGprogram program); + +CG_API CGprogram CGENTRY cgGetFirstProgram(CGcontext ctx); +CG_API CGprogram CGENTRY cgGetNextProgram(CGprogram current); +CG_API CGcontext CGENTRY cgGetProgramContext(CGprogram prog); +CG_API CGbool CGENTRY cgIsProgram(CGprogram program); + +CG_API void CGENTRY cgCompileProgram(CGprogram program); +CG_API CGbool CGENTRY cgIsProgramCompiled(CGprogram program); +CG_API const char * CGENTRY cgGetProgramString(CGprogram prog, CGenum pname); +CG_API CGprofile CGENTRY cgGetProgramProfile(CGprogram prog); +CG_API char const * const * CGENTRY cgGetProgramOptions(CGprogram prog); +CG_API void CGENTRY cgSetProgramProfile(CGprogram prog, CGprofile profile); +CG_API CGenum CGENTRY cgGetProgramInput(CGprogram program); +CG_API CGenum CGENTRY cgGetProgramOutput(CGprogram program); +CG_API void CGENTRY cgSetPassProgramParameters(CGprogram); +CG_API void CGENTRY cgUpdateProgramParameters(CGprogram program); + +/*** Parameter functions ***/ + +CG_API CGparameter CGENTRY cgCreateParameter(CGcontext ctx, CGtype type); +CG_API CGparameter CGENTRY cgCreateParameterArray(CGcontext ctx, + CGtype type, + int length); +CG_API CGparameter CGENTRY cgCreateParameterMultiDimArray(CGcontext ctx, + CGtype type, + int dim, + const int *lengths); +CG_API void CGENTRY cgDestroyParameter(CGparameter param); +CG_API void CGENTRY cgConnectParameter(CGparameter from, CGparameter to); +CG_API void CGENTRY cgDisconnectParameter(CGparameter param); +CG_API CGparameter CGENTRY cgGetConnectedParameter(CGparameter param); + +CG_API int CGENTRY cgGetNumConnectedToParameters(CGparameter param); +CG_API CGparameter CGENTRY cgGetConnectedToParameter(CGparameter param, int index); + +CG_API CGparameter CGENTRY cgGetNamedParameter(CGprogram prog, const char *name); +CG_API CGparameter CGENTRY cgGetNamedProgramParameter(CGprogram prog, + CGenum name_space, + const char *name); + +CG_API CGparameter CGENTRY cgGetFirstParameter(CGprogram prog, CGenum name_space); +CG_API CGparameter CGENTRY cgGetNextParameter(CGparameter current); +CG_API CGparameter CGENTRY cgGetFirstLeafParameter(CGprogram prog, CGenum name_space); +CG_API CGparameter CGENTRY cgGetNextLeafParameter(CGparameter current); + +CG_API CGparameter CGENTRY cgGetFirstStructParameter(CGparameter param); +CG_API CGparameter CGENTRY cgGetNamedStructParameter(CGparameter param, + const char *name); + +CG_API CGparameter CGENTRY cgGetFirstDependentParameter(CGparameter param); + +CG_API CGparameter CGENTRY cgGetArrayParameter(CGparameter aparam, int index); +CG_API int CGENTRY cgGetArrayDimension(CGparameter param); +CG_API CGtype CGENTRY cgGetArrayType(CGparameter param); +CG_API int CGENTRY cgGetArraySize(CGparameter param, int dimension); +CG_API int CGENTRY cgGetArrayTotalSize(CGparameter param); +CG_API void CGENTRY cgSetArraySize(CGparameter param, int size); +CG_API void CGENTRY cgSetMultiDimArraySize(CGparameter param, const int *sizes); + +CG_API CGprogram CGENTRY cgGetParameterProgram(CGparameter param); +CG_API CGcontext CGENTRY cgGetParameterContext(CGparameter param); +CG_API CGbool CGENTRY cgIsParameter(CGparameter param); +CG_API const char * CGENTRY cgGetParameterName(CGparameter param); +CG_API CGtype CGENTRY cgGetParameterType(CGparameter param); +CG_API CGtype CGENTRY cgGetParameterBaseType(CGparameter param); +CG_API CGparameterclass CGENTRY cgGetParameterClass(CGparameter param); +CG_API int CGENTRY cgGetParameterRows(CGparameter param); +CG_API int CGENTRY cgGetParameterColumns(CGparameter param); +CG_API CGtype CGENTRY cgGetParameterNamedType(CGparameter param); +CG_API const char * CGENTRY cgGetParameterSemantic(CGparameter param); +CG_API CGresource CGENTRY cgGetParameterResource(CGparameter param); +CG_API CGresource CGENTRY cgGetParameterBaseResource(CGparameter param); +CG_API unsigned long CGENTRY cgGetParameterResourceIndex(CGparameter param); +CG_API CGenum CGENTRY cgGetParameterVariability(CGparameter param); +CG_API CGenum CGENTRY cgGetParameterDirection(CGparameter param); +CG_API CGbool CGENTRY cgIsParameterReferenced(CGparameter param); +CG_API CGbool CGENTRY cgIsParameterUsed(CGparameter param, CGhandle handle); +CG_API const double * CGENTRY cgGetParameterValues(CGparameter param, + CGenum value_type, + int *nvalues); +CG_API void CGENTRY cgSetParameterValuedr(CGparameter param, int n, const double *vals); +CG_API void CGENTRY cgSetParameterValuedc(CGparameter param, int n, const double *vals); +CG_API void CGENTRY cgSetParameterValuefr(CGparameter param, int n, const float *vals); +CG_API void CGENTRY cgSetParameterValuefc(CGparameter param, int n, const float *vals); +CG_API void CGENTRY cgSetParameterValueir(CGparameter param, int n, const int *vals); +CG_API void CGENTRY cgSetParameterValueic(CGparameter param, int n, const int *vals); +CG_API int CGENTRY cgGetParameterValuedr(CGparameter param, int n, double *vals); +CG_API int CGENTRY cgGetParameterValuedc(CGparameter param, int n, double *vals); +CG_API int CGENTRY cgGetParameterValuefr(CGparameter param, int n, float *vals); +CG_API int CGENTRY cgGetParameterValuefc(CGparameter param, int n, float *vals); +CG_API int CGENTRY cgGetParameterValueir(CGparameter param, int n, int *vals); +CG_API int CGENTRY cgGetParameterValueic(CGparameter param, int n, int *vals); +CG_API const char * CGENTRY cgGetStringParameterValue(CGparameter param); +CG_API void CGENTRY cgSetStringParameterValue(CGparameter param, const char *str); + +CG_API int CGENTRY cgGetParameterOrdinalNumber(CGparameter param); +CG_API CGbool CGENTRY cgIsParameterGlobal(CGparameter param); +CG_API int CGENTRY cgGetParameterIndex(CGparameter param); + +CG_API void CGENTRY cgSetParameterVariability(CGparameter param, CGenum vary); +CG_API void CGENTRY cgSetParameterSemantic(CGparameter param, const char *semantic); + +CG_API void CGENTRY cgSetParameter1f(CGparameter param, float x); +CG_API void CGENTRY cgSetParameter2f(CGparameter param, float x, float y); +CG_API void CGENTRY cgSetParameter3f(CGparameter param, float x, float y, float z); +CG_API void CGENTRY cgSetParameter4f(CGparameter param, + float x, + float y, + float z, + float w); +CG_API void CGENTRY cgSetParameter1d(CGparameter param, double x); +CG_API void CGENTRY cgSetParameter2d(CGparameter param, double x, double y); +CG_API void CGENTRY cgSetParameter3d(CGparameter param, + double x, + double y, + double z); +CG_API void CGENTRY cgSetParameter4d(CGparameter param, + double x, + double y, + double z, + double w); +CG_API void CGENTRY cgSetParameter1i(CGparameter param, int x); +CG_API void CGENTRY cgSetParameter2i(CGparameter param, int x, int y); +CG_API void CGENTRY cgSetParameter3i(CGparameter param, int x, int y, int z); +CG_API void CGENTRY cgSetParameter4i(CGparameter param, + int x, + int y, + int z, + int w); + +CG_API void CGENTRY cgSetParameter1iv(CGparameter param, const int *v); +CG_API void CGENTRY cgSetParameter2iv(CGparameter param, const int *v); +CG_API void CGENTRY cgSetParameter3iv(CGparameter param, const int *v); +CG_API void CGENTRY cgSetParameter4iv(CGparameter param, const int *v); +CG_API void CGENTRY cgSetParameter1fv(CGparameter param, const float *v); +CG_API void CGENTRY cgSetParameter2fv(CGparameter param, const float *v); +CG_API void CGENTRY cgSetParameter3fv(CGparameter param, const float *v); +CG_API void CGENTRY cgSetParameter4fv(CGparameter param, const float *v); +CG_API void CGENTRY cgSetParameter1dv(CGparameter param, const double *v); +CG_API void CGENTRY cgSetParameter2dv(CGparameter param, const double *v); +CG_API void CGENTRY cgSetParameter3dv(CGparameter param, const double *v); +CG_API void CGENTRY cgSetParameter4dv(CGparameter param, const double *v); + +CG_API void CGENTRY cgSetMatrixParameterir(CGparameter param, const int *matrix); +CG_API void CGENTRY cgSetMatrixParameterdr(CGparameter param, const double *matrix); +CG_API void CGENTRY cgSetMatrixParameterfr(CGparameter param, const float *matrix); +CG_API void CGENTRY cgSetMatrixParameteric(CGparameter param, const int *matrix); +CG_API void CGENTRY cgSetMatrixParameterdc(CGparameter param, const double *matrix); +CG_API void CGENTRY cgSetMatrixParameterfc(CGparameter param, const float *matrix); + +CG_API void CGENTRY cgGetMatrixParameterir(CGparameter param, int *matrix); +CG_API void CGENTRY cgGetMatrixParameterdr(CGparameter param, double *matrix); +CG_API void CGENTRY cgGetMatrixParameterfr(CGparameter param, float *matrix); +CG_API void CGENTRY cgGetMatrixParameteric(CGparameter param, int *matrix); +CG_API void CGENTRY cgGetMatrixParameterdc(CGparameter param, double *matrix); +CG_API void CGENTRY cgGetMatrixParameterfc(CGparameter param, float *matrix); + +CG_API CGparameter CGENTRY cgGetNamedSubParameter(CGparameter param, const char *name); + +/*** Type Functions ***/ + +CG_API const char * CGENTRY cgGetTypeString(CGtype type); +CG_API CGtype CGENTRY cgGetType(const char *type_string); + +CG_API CGtype CGENTRY cgGetNamedUserType(CGhandle handle, const char *name); + +CG_API int CGENTRY cgGetNumUserTypes(CGhandle handle); +CG_API CGtype CGENTRY cgGetUserType(CGhandle handle, int index); + +CG_API int CGENTRY cgGetNumParentTypes(CGtype type); +CG_API CGtype CGENTRY cgGetParentType(CGtype type, int index); + +CG_API CGbool CGENTRY cgIsParentType(CGtype parent, CGtype child); +CG_API CGbool CGENTRY cgIsInterfaceType(CGtype type); + +/*** Resource Functions ***/ + +CG_API const char * CGENTRY cgGetResourceString(CGresource resource); +CG_API CGresource CGENTRY cgGetResource(const char *resource_string); + +/*** Enum Functions ***/ + +CG_API const char * CGENTRY cgGetEnumString(CGenum en); +CG_API CGenum CGENTRY cgGetEnum(const char *enum_string); + +/*** Profile Functions ***/ + +CG_API const char * CGENTRY cgGetProfileString(CGprofile profile); +CG_API CGprofile CGENTRY cgGetProfile(const char *profile_string); + +/*** Error Functions ***/ + +CG_API CGerror CGENTRY cgGetError(void); +CG_API CGerror CGENTRY cgGetFirstError(void); +CG_API const char * CGENTRY cgGetErrorString(CGerror error); +CG_API const char * CGENTRY cgGetLastErrorString(CGerror *error); +CG_API void CGENTRY cgSetErrorCallback(CGerrorCallbackFunc func); +CG_API CGerrorCallbackFunc CGENTRY cgGetErrorCallback(void); +CG_API void CGENTRY cgSetErrorHandler(CGerrorHandlerFunc func, void *data); +CG_API CGerrorHandlerFunc CGENTRY cgGetErrorHandler(void **data); + +/*** Misc Functions ***/ + +CG_API const char * CGENTRY cgGetString(CGenum sname); + + +/*** CgFX Functions ***/ + +CG_API CGeffect CGENTRY cgCreateEffect(CGcontext, const char *code, const char **args); +CG_API CGeffect CGENTRY cgCreateEffectFromFile(CGcontext, const char *filename, + const char **args); +CG_API CGeffect CGENTRY cgCopyEffect(CGeffect effect); +CG_API void CGENTRY cgDestroyEffect(CGeffect); +CG_API CGcontext CGENTRY cgGetEffectContext(CGeffect); +CG_API CGbool CGENTRY cgIsEffect(CGeffect effect); + +CG_API CGeffect CGENTRY cgGetFirstEffect(CGcontext); +CG_API CGeffect CGENTRY cgGetNextEffect(CGeffect); + +CG_API CGprogram CGENTRY cgCreateProgramFromEffect(CGeffect effect, + CGprofile profile, + const char *entry, + const char **args); + +CG_API CGtechnique CGENTRY cgGetFirstTechnique(CGeffect); +CG_API CGtechnique CGENTRY cgGetNextTechnique(CGtechnique); +CG_API CGtechnique CGENTRY cgGetNamedTechnique(CGeffect, const char *name); +CG_API const char * CGENTRY cgGetTechniqueName(CGtechnique); +CG_API CGbool CGENTRY cgIsTechnique(CGtechnique); +CG_API CGbool CGENTRY cgValidateTechnique(CGtechnique); +CG_API CGbool CGENTRY cgIsTechniqueValidated(CGtechnique); +CG_API CGeffect CGENTRY cgGetTechniqueEffect(CGtechnique); + +CG_API CGpass CGENTRY cgGetFirstPass(CGtechnique); +CG_API CGpass CGENTRY cgGetNamedPass(CGtechnique, const char *name); +CG_API CGpass CGENTRY cgGetNextPass(CGpass); +CG_API CGbool CGENTRY cgIsPass(CGpass); +CG_API const char * CGENTRY cgGetPassName(CGpass); +CG_API CGtechnique CGENTRY cgGetPassTechnique(CGpass); + +CG_API void CGENTRY cgSetPassState(CGpass); +CG_API void CGENTRY cgResetPassState(CGpass); + +CG_API CGstateassignment CGENTRY cgGetFirstStateAssignment(CGpass); +CG_API CGstateassignment CGENTRY cgGetNamedStateAssignment(CGpass, const char *name); +CG_API CGstateassignment CGENTRY cgGetNextStateAssignment(CGstateassignment); +CG_API CGbool CGENTRY cgIsStateAssignment(CGstateassignment); +CG_API CGbool CGENTRY cgCallStateSetCallback(CGstateassignment); +CG_API CGbool CGENTRY cgCallStateValidateCallback(CGstateassignment); +CG_API CGbool CGENTRY cgCallStateResetCallback(CGstateassignment); +CG_API CGpass CGENTRY cgGetStateAssignmentPass(CGstateassignment); +CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentParameter(CGstateassignment); + +CG_API const float * CGENTRY cgGetFloatStateAssignmentValues(CGstateassignment, int *nVals); +CG_API const int * CGENTRY cgGetIntStateAssignmentValues(CGstateassignment, int *nVals); +CG_API const CGbool * CGENTRY cgGetBoolStateAssignmentValues(CGstateassignment, int *nVals); +CG_API const char * CGENTRY cgGetStringStateAssignmentValue(CGstateassignment); +CG_API CGprogram CGENTRY cgGetProgramStateAssignmentValue(CGstateassignment); +CG_API CGparameter CGENTRY cgGetTextureStateAssignmentValue(CGstateassignment); +CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentValue(CGstateassignment); +CG_API int CGENTRY cgGetStateAssignmentIndex(CGstateassignment); + +CG_API int CGENTRY cgGetNumDependentStateAssignmentParameters(CGstateassignment); +CG_API CGparameter CGENTRY cgGetDependentStateAssignmentParameter(CGstateassignment, int index); + +CG_API CGparameter CGENTRY cgGetConnectedStateAssignmentParameter(CGstateassignment); + +CG_API CGstate CGENTRY cgGetStateAssignmentState(CGstateassignment); +CG_API CGstate CGENTRY cgGetSamplerStateAssignmentState(CGstateassignment); + +CG_API CGstate CGENTRY cgCreateState(CGcontext, const char *name, CGtype); +CG_API CGstate CGENTRY cgCreateArrayState(CGcontext, const char *name, CGtype, int nelems); +CG_API void CGENTRY cgSetStateCallbacks(CGstate, CGstatecallback set, CGstatecallback reset, + CGstatecallback validate); +CG_API CGstatecallback CGENTRY cgGetStateSetCallback(CGstate); +CG_API CGstatecallback CGENTRY cgGetStateResetCallback(CGstate); +CG_API CGstatecallback CGENTRY cgGetStateValidateCallback(CGstate); +CG_API CGcontext CGENTRY cgGetStateContext(CGstate); +CG_API CGtype CGENTRY cgGetStateType(CGstate); +CG_API const char * CGENTRY cgGetStateName(CGstate); +CG_API CGstate CGENTRY cgGetNamedState(CGcontext, const char *name); +CG_API CGstate CGENTRY cgGetFirstState(CGcontext); +CG_API CGstate CGENTRY cgGetNextState(CGstate); +CG_API CGbool CGENTRY cgIsState(CGstate); +CG_API void CGENTRY cgAddStateEnumerant(CGstate, const char *name, int value); + +CG_API CGstate CGENTRY cgCreateSamplerState(CGcontext, const char *name, CGtype); +CG_API CGstate CGENTRY cgCreateArraySamplerState(CGcontext, const char *name, CGtype, int nelems); +CG_API CGstate CGENTRY cgGetNamedSamplerState(CGcontext, const char *name); +CG_API CGstate CGENTRY cgGetFirstSamplerState(CGcontext); + +CG_API CGstateassignment CGENTRY cgGetFirstSamplerStateAssignment(CGparameter); +CG_API CGstateassignment CGENTRY cgGetNamedSamplerStateAssignment(CGparameter, const char *); +CG_API void CGENTRY cgSetSamplerState(CGparameter); + +CG_API CGparameter CGENTRY cgGetNamedEffectParameter(CGeffect, const char *); +CG_API CGparameter CGENTRY cgGetFirstLeafEffectParameter(CGeffect); +CG_API CGparameter CGENTRY cgGetFirstEffectParameter(CGeffect); +CG_API CGparameter CGENTRY cgGetEffectParameterBySemantic(CGeffect, const char *); + +CG_API CGannotation CGENTRY cgGetFirstTechniqueAnnotation(CGtechnique); +CG_API CGannotation CGENTRY cgGetFirstPassAnnotation(CGpass); +CG_API CGannotation CGENTRY cgGetFirstParameterAnnotation(CGparameter); +CG_API CGannotation CGENTRY cgGetFirstProgramAnnotation(CGprogram); +CG_API CGannotation CGENTRY cgGetFirstEffectAnnotation(CGeffect); +CG_API CGannotation CGENTRY cgGetNextAnnotation(CGannotation); + +CG_API CGannotation CGENTRY cgGetNamedTechniqueAnnotation(CGtechnique, const char *); +CG_API CGannotation CGENTRY cgGetNamedPassAnnotation(CGpass, const char *); +CG_API CGannotation CGENTRY cgGetNamedParameterAnnotation(CGparameter, const char *); +CG_API CGannotation CGENTRY cgGetNamedProgramAnnotation(CGprogram, const char *); +CG_API CGannotation CGENTRY cgGetNamedEffectAnnotation(CGeffect, const char *); + +CG_API CGbool CGENTRY cgIsAnnotation(CGannotation); + +CG_API const char * CGENTRY cgGetAnnotationName(CGannotation); +CG_API CGtype CGENTRY cgGetAnnotationType(CGannotation); + +CG_API const float * CGENTRY cgGetFloatAnnotationValues(CGannotation, int *nvalues); +CG_API const int * CGENTRY cgGetIntAnnotationValues(CGannotation, int *nvalues); +CG_API const char * CGENTRY cgGetStringAnnotationValue(CGannotation); +CG_API const char * const * CGENTRY cgGetStringAnnotationValues(CGannotation, int *nvalues); +CG_API const CGbool * CGENTRY cgGetBoolAnnotationValues(CGannotation, int *nvalues); +CG_API const int * CGENTRY cgGetBooleanAnnotationValues(CGannotation, int *nvalues); + +CG_API int CGENTRY cgGetNumDependentAnnotationParameters(CGannotation); +CG_API CGparameter CGENTRY cgGetDependentAnnotationParameter(CGannotation, int index); + +CG_API void CGENTRY cgEvaluateProgram(CGprogram, float *, int ncomps, int nx, int ny, int nz); + +/*** Cg 1.5 Additions ***/ + +CG_API CGbool CGENTRY cgSetEffectName(CGeffect, const char *name); +CG_API const char * CGENTRY cgGetEffectName(CGeffect); +CG_API CGeffect CGENTRY cgGetNamedEffect(CGcontext, const char *name); +CG_API CGparameter CGENTRY cgCreateEffectParameter(CGeffect, const char *name, CGtype); + +CG_API CGtechnique CGENTRY cgCreateTechnique(CGeffect, const char *name); + +CG_API CGparameter CGENTRY cgCreateEffectParameterArray(CGeffect, const char *name, CGtype type, int length); +CG_API CGparameter CGENTRY cgCreateEffectParameterMultiDimArray(CGeffect, const char *name, CGtype type, int dim, const int *lengths); + +CG_API CGpass CGENTRY cgCreatePass(CGtechnique, const char *name); + +CG_API CGstateassignment CGENTRY cgCreateStateAssignment(CGpass, CGstate); +CG_API CGstateassignment CGENTRY cgCreateStateAssignmentIndex(CGpass, CGstate, int index); +CG_API CGstateassignment CGENTRY cgCreateSamplerStateAssignment(CGparameter, CGstate); + +CG_API CGbool CGENTRY cgSetFloatStateAssignment(CGstateassignment, float); +CG_API CGbool CGENTRY cgSetIntStateAssignment(CGstateassignment, int); +CG_API CGbool CGENTRY cgSetBoolStateAssignment(CGstateassignment, CGbool); +CG_API CGbool CGENTRY cgSetStringStateAssignment(CGstateassignment, const char *); +CG_API CGbool CGENTRY cgSetProgramStateAssignment(CGstateassignment, CGprogram); +CG_API CGbool CGENTRY cgSetSamplerStateAssignment(CGstateassignment, CGparameter); +CG_API CGbool CGENTRY cgSetTextureStateAssignment(CGstateassignment, CGparameter); + +CG_API CGbool CGENTRY cgSetFloatArrayStateAssignment(CGstateassignment, const float *vals); +CG_API CGbool CGENTRY cgSetIntArrayStateAssignment(CGstateassignment, const int *vals); +CG_API CGbool CGENTRY cgSetBoolArrayStateAssignment(CGstateassignment, const CGbool *vals); + +CG_API CGannotation CGENTRY cgCreateTechniqueAnnotation(CGtechnique, const char *name, CGtype); +CG_API CGannotation CGENTRY cgCreatePassAnnotation(CGpass, const char *name, CGtype); +CG_API CGannotation CGENTRY cgCreateParameterAnnotation(CGparameter, const char *name, CGtype); +CG_API CGannotation CGENTRY cgCreateProgramAnnotation(CGprogram, const char *name, CGtype); +CG_API CGannotation CGENTRY cgCreateEffectAnnotation(CGeffect, const char *name, CGtype); + +CG_API CGbool CGENTRY cgSetIntAnnotation(CGannotation, int value); +CG_API CGbool CGENTRY cgSetFloatAnnotation(CGannotation, float value); +CG_API CGbool CGENTRY cgSetBoolAnnotation(CGannotation, CGbool value); +CG_API CGbool CGENTRY cgSetStringAnnotation(CGannotation, const char *value); + +CG_API const char * CGENTRY cgGetStateEnumerantName(CGstate, int value); +CG_API int CGENTRY cgGetStateEnumerantValue(CGstate, const char *name); + +CG_API CGeffect CGENTRY cgGetParameterEffect(CGparameter param); + +CG_API CGparameterclass CGENTRY cgGetTypeClass(CGtype type); +CG_API CGtype CGENTRY cgGetTypeBase(CGtype type); +CG_API CGbool CGENTRY cgGetTypeSizes(CGtype type, int *nrows, int *ncols); +CG_API void CGENTRY cgGetMatrixSize(CGtype type, int *nrows, int *ncols); + +CG_API int CGENTRY cgGetNumProgramDomains( CGprogram program ); +CG_API CGdomain CGENTRY cgGetProfileDomain( CGprofile profile ); +CG_API CGprogram CGENTRY cgCombinePrograms( int n, const CGprogram *exeList ); +CG_API CGprogram CGENTRY cgCombinePrograms2( const CGprogram exe1, const CGprogram exe2 ); +CG_API CGprogram CGENTRY cgCombinePrograms3( const CGprogram exe1, const CGprogram exe2, const CGprogram exe3 ); +CG_API CGprofile CGENTRY cgGetProgramDomainProfile(CGprogram program, int index); + +/*** CGobj Functions ***/ +CG_API CGobj CGENTRY cgCreateObj( CGcontext context, CGenum program_type, const char *source, CGprofile profile, const char **args ); +CG_API CGobj CGENTRY cgCreateObjFromFile( CGcontext context, CGenum program_type, const char *source_file, CGprofile profile, const char **args ); +CG_API void CGENTRY cgDestroyObj( CGobj obj ); + +CG_API long CGENTRY cgGetParameterResourceSize(CGparameter); +CG_API CGtype CGENTRY cgGetParameterResourceType(CGparameter); +CG_API int CGENTRY cgGetParameterBufferIndex(CGparameter); +CG_API int CGENTRY cgGetParameterBufferOffset(CGparameter); + +CG_API CGbuffer CGENTRY cgCreateBuffer(CGcontext, int size, const void *data, CGbufferusage bufferUsage); +CG_API void CGENTRY cgSetBufferData(CGbuffer, int size, const void *data); +CG_API void CGENTRY cgSetBufferSubData(CGbuffer, int offset, int size, const void *data); +CG_API void CGENTRY cgSetProgramBuffer(CGprogram program, int bufferIndex, CGbuffer buffer); + +CG_API void * CGENTRY cgMapBuffer(CGbuffer buffer, CGbufferaccess access); +CG_API void CGENTRY cgUnmapBuffer(CGbuffer buffer); +CG_API void CGENTRY cgDestroyBuffer(CGbuffer buffer); +CG_API CGbuffer CGENTRY cgGetProgramBuffer(CGprogram, int bufferIndex); +CG_API int CGENTRY cgGetBufferSize(CGbuffer); +CG_API int CGENTRY cgGetProgramBufferMaxSize(CGprofile profile); +CG_API int CGENTRY cgGetProgramBufferMaxIndex(CGprofile profile); + +#endif + +#ifdef __cplusplus +} +#endif + +#ifdef CG_APIENTRY_DEFINED +# undef CG_APIENTRY_DEFINED +# undef APIENTRY +#endif + +#ifdef CG_WINGDIAPI_DEFINED +# undef CG_WINGDIAPI_DEFINED +# undef WINGDIAPI +#endif + +#endif diff --git a/Externals/Cg/cgGL.h b/Externals/Cg/cgGL.h index 4f30195f84..8d7d78b13f 100644 --- a/Externals/Cg/cgGL.h +++ b/Externals/Cg/cgGL.h @@ -1,423 +1,423 @@ -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef _cggl_h -#define _cggl_h - -#include - -#ifdef _WIN32 -# ifndef APIENTRY /* From Win32's */ -# define CGGL_APIENTRY_DEFINED -# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) -# define APIENTRY __stdcall -# else -# define APIENTRY -# endif -# endif -# ifndef WINGDIAPI /* From Win32's and */ -# define CGGL_WINGDIAPI_DEFINED -# define WINGDIAPI __declspec(dllimport) -# endif -#endif /* _WIN32 */ - -/* Set up for either Win32 import/export/lib. */ -#ifndef CGGL_API -# ifdef _WIN32 -# ifdef CGGL_EXPORTS -# define CGGL_API __declspec(dllexport) -# elif defined (CG_LIB) -# define CGGL_API -# else -# define CGGL_API __declspec(dllimport) -# endif -# else -# define CGGL_API -# endif -#endif - -#ifndef CGGLENTRY -# ifdef _WIN32 -# define CGGLENTRY __cdecl -# else -# define CGGLENTRY -# endif -#endif - -#ifdef __APPLE__ -#include -#else -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/*****************************************************************************/ -/*** cgGL Type Definitions ***/ -/*****************************************************************************/ - -typedef enum - { - CG_GL_MATRIX_IDENTITY = 0, - CG_GL_MATRIX_TRANSPOSE = 1, - CG_GL_MATRIX_INVERSE = 2, - CG_GL_MATRIX_INVERSE_TRANSPOSE = 3, - - CG_GL_MODELVIEW_MATRIX, - CG_GL_PROJECTION_MATRIX, - CG_GL_TEXTURE_MATRIX, - CG_GL_MODELVIEW_PROJECTION_MATRIX, - - CG_GL_VERTEX, - CG_GL_FRAGMENT, - CG_GL_GEOMETRY - - } CGGLenum; - - -#ifndef CGGL_EXPLICIT - -/****************************************************************************** - *** Profile Functions - *****************************************************************************/ - -CGGL_API CGbool CGGLENTRY cgGLIsProfileSupported(CGprofile profile); - -CGGL_API void CGGLENTRY cgGLEnableProfile(CGprofile profile); -CGGL_API void CGGLENTRY cgGLDisableProfile(CGprofile profile); - -CGGL_API CGprofile CGGLENTRY cgGLGetLatestProfile(CGGLenum profile_type); -CGGL_API void CGGLENTRY cgGLSetOptimalOptions(CGprofile profile); - -/****************************************************************************** - *** Program Managment Functions - *****************************************************************************/ - -CGGL_API void CGGLENTRY cgGLLoadProgram(CGprogram program); -CGGL_API CGbool CGGLENTRY cgGLIsProgramLoaded(CGprogram program); -CGGL_API void CGGLENTRY cgGLBindProgram(CGprogram program); -CGGL_API void CGGLENTRY cgGLUnbindProgram(CGprofile profile); -CGGL_API GLuint CGGLENTRY cgGLGetProgramID(CGprogram program); - -/****************************************************************************** - *** Parameter Managment Functions - *****************************************************************************/ - -CGGL_API void CGGLENTRY cgGLSetParameter1f(CGparameter param, - float x); - -CGGL_API void CGGLENTRY cgGLSetParameter2f(CGparameter param, - float x, - float y); - -CGGL_API void CGGLENTRY cgGLSetParameter3f(CGparameter param, - float x, - float y, - float z); - -CGGL_API void CGGLENTRY cgGLSetParameter4f(CGparameter param, - float x, - float y, - float z, - float w); - -CGGL_API void CGGLENTRY cgGLSetParameter1fv(CGparameter param, const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameter2fv(CGparameter param, const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameter3fv(CGparameter param, const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameter4fv(CGparameter param, const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameter1d(CGparameter param, - double x); - -CGGL_API void CGGLENTRY cgGLSetParameter2d(CGparameter param, - double x, - double y); - -CGGL_API void CGGLENTRY cgGLSetParameter3d(CGparameter param, - double x, - double y, - double z); - -CGGL_API void CGGLENTRY cgGLSetParameter4d(CGparameter param, - double x, - double y, - double z, - double w); - -CGGL_API void CGGLENTRY cgGLSetParameter1dv(CGparameter param, const double *v); - -CGGL_API void CGGLENTRY cgGLSetParameter2dv(CGparameter param, const double *v); - -CGGL_API void CGGLENTRY cgGLSetParameter3dv(CGparameter param, const double *v); - -CGGL_API void CGGLENTRY cgGLSetParameter4dv(CGparameter param, const double *v); - -CGGL_API void CGGLENTRY cgGLGetParameter1f(CGparameter param, float *v); - -CGGL_API void CGGLENTRY cgGLGetParameter2f(CGparameter param, float *v); - -CGGL_API void CGGLENTRY cgGLGetParameter3f(CGparameter param, float *v); - -CGGL_API void CGGLENTRY cgGLGetParameter4f(CGparameter param, float *v); - -CGGL_API void CGGLENTRY cgGLGetParameter1d(CGparameter param, double *v); - -CGGL_API void CGGLENTRY cgGLGetParameter2d(CGparameter param, double *v); - -CGGL_API void CGGLENTRY cgGLGetParameter3d(CGparameter param, double *v); - -CGGL_API void CGGLENTRY cgGLGetParameter4d(CGparameter param, double *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray1f(CGparameter param, - long offset, - long nelements, - const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray2f(CGparameter param, - long offset, - long nelements, - const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray3f(CGparameter param, - long offset, - long nelements, - const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray4f(CGparameter param, - long offset, - long nelements, - const float *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray1d(CGparameter param, - long offset, - long nelements, - const double *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray2d(CGparameter param, - long offset, - long nelements, - const double *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray3d(CGparameter param, - long offset, - long nelements, - const double *v); - -CGGL_API void CGGLENTRY cgGLSetParameterArray4d(CGparameter param, - long offset, - long nelements, - const double *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray1f(CGparameter param, - long offset, - long nelements, - float *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray2f(CGparameter param, - long offset, - long nelements, - float *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray3f(CGparameter param, - long offset, - long nelements, - float *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray4f(CGparameter param, - long offset, - long nelements, - float *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray1d(CGparameter param, - long offset, - long nelements, - double *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray2d(CGparameter param, - long offset, - long nelements, - double *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray3d(CGparameter param, - long offset, - long nelements, - double *v); - -CGGL_API void CGGLENTRY cgGLGetParameterArray4d(CGparameter param, - long offset, - long nelements, - double *v); - -CGGL_API void CGGLENTRY cgGLSetParameterPointer(CGparameter param, - GLint fsize, - GLenum type, - GLsizei stride, - const GLvoid *pointer); - -CGGL_API void CGGLENTRY cgGLEnableClientState(CGparameter param); -CGGL_API void CGGLENTRY cgGLDisableClientState(CGparameter param); - -/****************************************************************************** - *** Matrix Parameter Managment Functions - *****************************************************************************/ - -CGGL_API void CGGLENTRY cgGLSetMatrixParameterdr(CGparameter param, - const double *matrix); -CGGL_API void CGGLENTRY cgGLSetMatrixParameterfr(CGparameter param, - const float *matrix); -CGGL_API void CGGLENTRY cgGLSetMatrixParameterdc(CGparameter param, - const double *matrix); -CGGL_API void CGGLENTRY cgGLSetMatrixParameterfc(CGparameter param, - const float *matrix); - -CGGL_API void CGGLENTRY cgGLGetMatrixParameterdr(CGparameter param, double *matrix); -CGGL_API void CGGLENTRY cgGLGetMatrixParameterfr(CGparameter param, float *matrix); -CGGL_API void CGGLENTRY cgGLGetMatrixParameterdc(CGparameter param, double *matrix); -CGGL_API void CGGLENTRY cgGLGetMatrixParameterfc(CGparameter param, float *matrix); - -CGGL_API void CGGLENTRY cgGLSetStateMatrixParameter(CGparameter param, - CGGLenum matrix, - CGGLenum transform); - -CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfc(CGparameter param, - long offset, - long nelements, - const float *matrices); - -CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfr(CGparameter param, - long offset, - long nelements, - const float *matrices); - -CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydc(CGparameter param, - long offset, - long nelements, - const double *matrices); - -CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydr(CGparameter param, - long offset, - long nelements, - const double *matrices); - -CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfc(CGparameter param, - long offset, - long nelements, - float *matrices); - -CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfr(CGparameter param, - long offset, - long nelements, - float *matrices); - -CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydc(CGparameter param, - long offset, - long nelements, - double *matrices); - -CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydr(CGparameter param, - long offset, - long nelements, - double *matrices); - -/****************************************************************************** - *** Texture Parameter Managment Functions - *****************************************************************************/ - -CGGL_API void CGGLENTRY cgGLSetTextureParameter(CGparameter param, GLuint texobj); -CGGL_API GLuint CGGLENTRY cgGLGetTextureParameter(CGparameter param); -CGGL_API void CGGLENTRY cgGLEnableTextureParameter(CGparameter param); -CGGL_API void CGGLENTRY cgGLDisableTextureParameter(CGparameter param); -CGGL_API GLenum CGGLENTRY cgGLGetTextureEnum(CGparameter param); - -CGGL_API void CGGLENTRY cgGLSetManageTextureParameters(CGcontext ctx, CGbool flag); -CGGL_API CGbool CGGLENTRY cgGLGetManageTextureParameters(CGcontext ctx); - -CGGL_API void CGGLENTRY cgGLSetupSampler(CGparameter param, GLuint texobj); -CGGL_API void CGGLENTRY cgGLRegisterStates(CGcontext); - -CGGL_API void CGGLENTRY cgGLEnableProgramProfiles( CGprogram program ); -CGGL_API void CGGLENTRY cgGLDisableProgramProfiles( CGprogram program ); - -/****************************************************************************** - *** Misc Functions - *****************************************************************************/ - -CGGL_API void CGGLENTRY cgGLSetDebugMode( CGbool debug ); - -/****************************************************************************** - *** Buffer Functions - *****************************************************************************/ - -CGGL_API CGbuffer CGGLENTRY cgGLCreateBuffer(CGcontext context, int size, const void *data, GLenum bufferUsage); -CGGL_API GLuint CGGLENTRY cgGLGetBufferObject(CGbuffer buffer); - -#endif - -#ifdef __cplusplus -} -#endif - -#ifdef CGGL_APIENTRY_DEFINED -# undef CGGL_APIENTRY_DEFINED -# undef APIENTRY -#endif - -#ifdef CGGL_WINGDIAPI_DEFINED -# undef CGGL_WINGDIAPI_DEFINED -# undef WINGDIAPI -#endif - -#endif +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _cggl_h +#define _cggl_h + +#include + +#ifdef _WIN32 +# ifndef APIENTRY /* From Win32's */ +# define CGGL_APIENTRY_DEFINED +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif +# endif +# ifndef WINGDIAPI /* From Win32's and */ +# define CGGL_WINGDIAPI_DEFINED +# define WINGDIAPI __declspec(dllimport) +# endif +#endif /* _WIN32 */ + +/* Set up for either Win32 import/export/lib. */ +#ifndef CGGL_API +# ifdef _WIN32 +# ifdef CGGL_EXPORTS +# define CGGL_API __declspec(dllexport) +# elif defined (CG_LIB) +# define CGGL_API +# else +# define CGGL_API __declspec(dllimport) +# endif +# else +# define CGGL_API +# endif +#endif + +#ifndef CGGLENTRY +# ifdef _WIN32 +# define CGGLENTRY __cdecl +# else +# define CGGLENTRY +# endif +#endif + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*****************************************************************************/ +/*** cgGL Type Definitions ***/ +/*****************************************************************************/ + +typedef enum + { + CG_GL_MATRIX_IDENTITY = 0, + CG_GL_MATRIX_TRANSPOSE = 1, + CG_GL_MATRIX_INVERSE = 2, + CG_GL_MATRIX_INVERSE_TRANSPOSE = 3, + + CG_GL_MODELVIEW_MATRIX, + CG_GL_PROJECTION_MATRIX, + CG_GL_TEXTURE_MATRIX, + CG_GL_MODELVIEW_PROJECTION_MATRIX, + + CG_GL_VERTEX, + CG_GL_FRAGMENT, + CG_GL_GEOMETRY + + } CGGLenum; + + +#ifndef CGGL_EXPLICIT + +/****************************************************************************** + *** Profile Functions + *****************************************************************************/ + +CGGL_API CGbool CGGLENTRY cgGLIsProfileSupported(CGprofile profile); + +CGGL_API void CGGLENTRY cgGLEnableProfile(CGprofile profile); +CGGL_API void CGGLENTRY cgGLDisableProfile(CGprofile profile); + +CGGL_API CGprofile CGGLENTRY cgGLGetLatestProfile(CGGLenum profile_type); +CGGL_API void CGGLENTRY cgGLSetOptimalOptions(CGprofile profile); + +/****************************************************************************** + *** Program Managment Functions + *****************************************************************************/ + +CGGL_API void CGGLENTRY cgGLLoadProgram(CGprogram program); +CGGL_API CGbool CGGLENTRY cgGLIsProgramLoaded(CGprogram program); +CGGL_API void CGGLENTRY cgGLBindProgram(CGprogram program); +CGGL_API void CGGLENTRY cgGLUnbindProgram(CGprofile profile); +CGGL_API GLuint CGGLENTRY cgGLGetProgramID(CGprogram program); + +/****************************************************************************** + *** Parameter Managment Functions + *****************************************************************************/ + +CGGL_API void CGGLENTRY cgGLSetParameter1f(CGparameter param, + float x); + +CGGL_API void CGGLENTRY cgGLSetParameter2f(CGparameter param, + float x, + float y); + +CGGL_API void CGGLENTRY cgGLSetParameter3f(CGparameter param, + float x, + float y, + float z); + +CGGL_API void CGGLENTRY cgGLSetParameter4f(CGparameter param, + float x, + float y, + float z, + float w); + +CGGL_API void CGGLENTRY cgGLSetParameter1fv(CGparameter param, const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameter2fv(CGparameter param, const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameter3fv(CGparameter param, const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameter4fv(CGparameter param, const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameter1d(CGparameter param, + double x); + +CGGL_API void CGGLENTRY cgGLSetParameter2d(CGparameter param, + double x, + double y); + +CGGL_API void CGGLENTRY cgGLSetParameter3d(CGparameter param, + double x, + double y, + double z); + +CGGL_API void CGGLENTRY cgGLSetParameter4d(CGparameter param, + double x, + double y, + double z, + double w); + +CGGL_API void CGGLENTRY cgGLSetParameter1dv(CGparameter param, const double *v); + +CGGL_API void CGGLENTRY cgGLSetParameter2dv(CGparameter param, const double *v); + +CGGL_API void CGGLENTRY cgGLSetParameter3dv(CGparameter param, const double *v); + +CGGL_API void CGGLENTRY cgGLSetParameter4dv(CGparameter param, const double *v); + +CGGL_API void CGGLENTRY cgGLGetParameter1f(CGparameter param, float *v); + +CGGL_API void CGGLENTRY cgGLGetParameter2f(CGparameter param, float *v); + +CGGL_API void CGGLENTRY cgGLGetParameter3f(CGparameter param, float *v); + +CGGL_API void CGGLENTRY cgGLGetParameter4f(CGparameter param, float *v); + +CGGL_API void CGGLENTRY cgGLGetParameter1d(CGparameter param, double *v); + +CGGL_API void CGGLENTRY cgGLGetParameter2d(CGparameter param, double *v); + +CGGL_API void CGGLENTRY cgGLGetParameter3d(CGparameter param, double *v); + +CGGL_API void CGGLENTRY cgGLGetParameter4d(CGparameter param, double *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray1f(CGparameter param, + long offset, + long nelements, + const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray2f(CGparameter param, + long offset, + long nelements, + const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray3f(CGparameter param, + long offset, + long nelements, + const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray4f(CGparameter param, + long offset, + long nelements, + const float *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray1d(CGparameter param, + long offset, + long nelements, + const double *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray2d(CGparameter param, + long offset, + long nelements, + const double *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray3d(CGparameter param, + long offset, + long nelements, + const double *v); + +CGGL_API void CGGLENTRY cgGLSetParameterArray4d(CGparameter param, + long offset, + long nelements, + const double *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray1f(CGparameter param, + long offset, + long nelements, + float *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray2f(CGparameter param, + long offset, + long nelements, + float *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray3f(CGparameter param, + long offset, + long nelements, + float *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray4f(CGparameter param, + long offset, + long nelements, + float *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray1d(CGparameter param, + long offset, + long nelements, + double *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray2d(CGparameter param, + long offset, + long nelements, + double *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray3d(CGparameter param, + long offset, + long nelements, + double *v); + +CGGL_API void CGGLENTRY cgGLGetParameterArray4d(CGparameter param, + long offset, + long nelements, + double *v); + +CGGL_API void CGGLENTRY cgGLSetParameterPointer(CGparameter param, + GLint fsize, + GLenum type, + GLsizei stride, + const GLvoid *pointer); + +CGGL_API void CGGLENTRY cgGLEnableClientState(CGparameter param); +CGGL_API void CGGLENTRY cgGLDisableClientState(CGparameter param); + +/****************************************************************************** + *** Matrix Parameter Managment Functions + *****************************************************************************/ + +CGGL_API void CGGLENTRY cgGLSetMatrixParameterdr(CGparameter param, + const double *matrix); +CGGL_API void CGGLENTRY cgGLSetMatrixParameterfr(CGparameter param, + const float *matrix); +CGGL_API void CGGLENTRY cgGLSetMatrixParameterdc(CGparameter param, + const double *matrix); +CGGL_API void CGGLENTRY cgGLSetMatrixParameterfc(CGparameter param, + const float *matrix); + +CGGL_API void CGGLENTRY cgGLGetMatrixParameterdr(CGparameter param, double *matrix); +CGGL_API void CGGLENTRY cgGLGetMatrixParameterfr(CGparameter param, float *matrix); +CGGL_API void CGGLENTRY cgGLGetMatrixParameterdc(CGparameter param, double *matrix); +CGGL_API void CGGLENTRY cgGLGetMatrixParameterfc(CGparameter param, float *matrix); + +CGGL_API void CGGLENTRY cgGLSetStateMatrixParameter(CGparameter param, + CGGLenum matrix, + CGGLenum transform); + +CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfc(CGparameter param, + long offset, + long nelements, + const float *matrices); + +CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfr(CGparameter param, + long offset, + long nelements, + const float *matrices); + +CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydc(CGparameter param, + long offset, + long nelements, + const double *matrices); + +CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydr(CGparameter param, + long offset, + long nelements, + const double *matrices); + +CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfc(CGparameter param, + long offset, + long nelements, + float *matrices); + +CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfr(CGparameter param, + long offset, + long nelements, + float *matrices); + +CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydc(CGparameter param, + long offset, + long nelements, + double *matrices); + +CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydr(CGparameter param, + long offset, + long nelements, + double *matrices); + +/****************************************************************************** + *** Texture Parameter Managment Functions + *****************************************************************************/ + +CGGL_API void CGGLENTRY cgGLSetTextureParameter(CGparameter param, GLuint texobj); +CGGL_API GLuint CGGLENTRY cgGLGetTextureParameter(CGparameter param); +CGGL_API void CGGLENTRY cgGLEnableTextureParameter(CGparameter param); +CGGL_API void CGGLENTRY cgGLDisableTextureParameter(CGparameter param); +CGGL_API GLenum CGGLENTRY cgGLGetTextureEnum(CGparameter param); + +CGGL_API void CGGLENTRY cgGLSetManageTextureParameters(CGcontext ctx, CGbool flag); +CGGL_API CGbool CGGLENTRY cgGLGetManageTextureParameters(CGcontext ctx); + +CGGL_API void CGGLENTRY cgGLSetupSampler(CGparameter param, GLuint texobj); +CGGL_API void CGGLENTRY cgGLRegisterStates(CGcontext); + +CGGL_API void CGGLENTRY cgGLEnableProgramProfiles( CGprogram program ); +CGGL_API void CGGLENTRY cgGLDisableProgramProfiles( CGprogram program ); + +/****************************************************************************** + *** Misc Functions + *****************************************************************************/ + +CGGL_API void CGGLENTRY cgGLSetDebugMode( CGbool debug ); + +/****************************************************************************** + *** Buffer Functions + *****************************************************************************/ + +CGGL_API CGbuffer CGGLENTRY cgGLCreateBuffer(CGcontext context, int size, const void *data, GLenum bufferUsage); +CGGL_API GLuint CGGLENTRY cgGLGetBufferObject(CGbuffer buffer); + +#endif + +#ifdef __cplusplus +} +#endif + +#ifdef CGGL_APIENTRY_DEFINED +# undef CGGL_APIENTRY_DEFINED +# undef APIENTRY +#endif + +#ifdef CGGL_WINGDIAPI_DEFINED +# undef CGGL_WINGDIAPI_DEFINED +# undef WINGDIAPI +#endif + +#endif diff --git a/Externals/Cg/cgGL_profiles.h b/Externals/Cg/cgGL_profiles.h index 44948edfb1..3a1aa9d615 100644 --- a/Externals/Cg/cgGL_profiles.h +++ b/Externals/Cg/cgGL_profiles.h @@ -1,70 +1,70 @@ -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -CG_PROFILE_MACRO(Vertex,vp20,VP20,"vp20",6146,1) -CG_PROFILE_MACRO(Fragment20,fp20,FP20,"fp20",6147,0) -CG_PROFILE_MACRO(Vertex30,vp30,VP30,"vp30",6148,1) -CG_PROFILE_MACRO(Fragment,fp30,FP30,"fp30",6149,0) -CG_PROFILE_MACRO(ARBVertex,arbvp1,ARBVP1,"arbvp1",6150,1) -CG_PROFILE_MACRO(Fragment40,fp40,FP40,"fp40",6151,0) -CG_PROFILE_MACRO(ARBFragment,arbfp1,ARBFP1,"arbfp1",7000,0) -CG_PROFILE_MACRO(Vertex40,vp40,VP40,"vp40",7001,1) -CG_PROFILE_MACRO(GLSLVertex,glslv,GLSLV,"glslv",7007,1) -CG_PROFILE_MACRO(GLSLFragment,glslf,GLSLF,"glslf",7008,0) -CG_PROFILE_MACRO(GLSLCombined, glslc, GLSLC, "glslc", 7009, 0) -CG_PROFILE_MACRO(GPUFragment,gpu_fp,GPU_FP,"gp4fp",7010,0) -CG_PROFILE_MACRO(GPUVertex,gpu_vp,GPU_VP,"gp4vp",7011,1) -CG_PROFILE_MACRO(GPUGeometry,gpu_gp,GPU_GP,"gp4gp",7012,0) - -#ifndef CG_IN_PROFILES_INCLUDE -# undef CG_PROFILE_MACRO -#endif +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +CG_PROFILE_MACRO(Vertex,vp20,VP20,"vp20",6146,1) +CG_PROFILE_MACRO(Fragment20,fp20,FP20,"fp20",6147,0) +CG_PROFILE_MACRO(Vertex30,vp30,VP30,"vp30",6148,1) +CG_PROFILE_MACRO(Fragment,fp30,FP30,"fp30",6149,0) +CG_PROFILE_MACRO(ARBVertex,arbvp1,ARBVP1,"arbvp1",6150,1) +CG_PROFILE_MACRO(Fragment40,fp40,FP40,"fp40",6151,0) +CG_PROFILE_MACRO(ARBFragment,arbfp1,ARBFP1,"arbfp1",7000,0) +CG_PROFILE_MACRO(Vertex40,vp40,VP40,"vp40",7001,1) +CG_PROFILE_MACRO(GLSLVertex,glslv,GLSLV,"glslv",7007,1) +CG_PROFILE_MACRO(GLSLFragment,glslf,GLSLF,"glslf",7008,0) +CG_PROFILE_MACRO(GLSLCombined, glslc, GLSLC, "glslc", 7009, 0) +CG_PROFILE_MACRO(GPUFragment,gpu_fp,GPU_FP,"gp4fp",7010,0) +CG_PROFILE_MACRO(GPUVertex,gpu_vp,GPU_VP,"gp4vp",7011,1) +CG_PROFILE_MACRO(GPUGeometry,gpu_gp,GPU_GP,"gp4gp",7012,0) + +#ifndef CG_IN_PROFILES_INCLUDE +# undef CG_PROFILE_MACRO +#endif diff --git a/Externals/Cg/cg_bindlocations.h b/Externals/Cg/cg_bindlocations.h index adcff5548b..96ae8e24b5 100644 --- a/Externals/Cg/cg_bindlocations.h +++ b/Externals/Cg/cg_bindlocations.h @@ -1,382 +1,382 @@ - - -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/* - * The following macro invocations define the supported CG basic hardware - * bind locations. - * - * The macros have the form : - * - * CG_BINDLOCATION_MACRO(name, compiler_name, enum_int) - * - * name : The name of the location. - * enum_name : The C enumerant. - * compiler_name : The name of the location within the compiler syntax. - * int_id : Integer enumerant associated with this bind location. - * (3256 is reservered for CG_UNDEFINED) - * addressable : The bind location must have an integer address - * associated with it. - * ParamType : the cgParamType of this register. - * - */ - - -CG_BINDLOCATION_MACRO(TexUnit0,CG_TEXUNIT0,"texunit 0",2048,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit1,CG_TEXUNIT1,"texunit 1",2049,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit2,CG_TEXUNIT2,"texunit 2",2050,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit3,CG_TEXUNIT3,"texunit 3",2051,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit4,CG_TEXUNIT4,"texunit 4",2052,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit5,CG_TEXUNIT5,"texunit 5",2053,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit6,CG_TEXUNIT6,"texunit 6",2054,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit7,CG_TEXUNIT7,"texunit 7",2055,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit8,CG_TEXUNIT8,"texunit 8",2056,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit9,CG_TEXUNIT9,"texunit 9",2057,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit10,CG_TEXUNIT10,"texunit 10",2058,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit11,CG_TEXUNIT11,"texunit 11",2059,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit12,CG_TEXUNIT12,"texunit 12",2060,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit13,CG_TEXUNIT13,"texunit 13",2061,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit14,CG_TEXUNIT14,"texunit 14",2062,0,CG_TEXOBJ_PARAM) -CG_BINDLOCATION_MACRO(TexUnit15,CG_TEXUNIT15,"texunit 15",2063,0,CG_TEXOBJ_PARAM) - -CG_BINDLOCATION_MACRO(Buffer0, CG_BUFFER0, "buffer[0]", 2064, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer1, CG_BUFFER1, "buffer[1]", 2065, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer2, CG_BUFFER2, "buffer[2]", 2066, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer3, CG_BUFFER3, "buffer[3]", 2067, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer4, CG_BUFFER4, "buffer[4]", 2068, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer5, CG_BUFFER5, "buffer[5]", 2069, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer6, CG_BUFFER6, "buffer[6]", 2070, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer7, CG_BUFFER7, "buffer[7]", 2071, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer8, CG_BUFFER8, "buffer[8]", 2072, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer9, CG_BUFFER9, "buffer[9]", 2073, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer10, CG_BUFFER10, "buffer[10]", 2074, 1, CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Buffer11, CG_BUFFER11, "buffer[11]", 2075, 1, CGI_UNIFORM_PARAM) - -CG_BINDLOCATION_MACRO(Attr0,CG_ATTR0,"ATTR0",2113,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr1,CG_ATTR1,"ATTR1",2114,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr2,CG_ATTR2,"ATTR2",2115,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr3,CG_ATTR3,"ATTR3",2116,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr4,CG_ATTR4,"ATTR4",2117,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr5,CG_ATTR5,"ATTR5",2118,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr6,CG_ATTR6,"ATTR6",2119,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr7,CG_ATTR7,"ATTR7",2120,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr8,CG_ATTR8,"ATTR8",2121,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr9,CG_ATTR9,"ATTR9",2122,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr10,CG_ATTR10,"ATTR10",2123,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr11,CG_ATTR11,"ATTR11",2124,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr12,CG_ATTR12,"ATTR12",2125,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr13,CG_ATTR13,"ATTR13",2126,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr14,CG_ATTR14,"ATTR14",2127,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Attr15,CG_ATTR15,"ATTR15",2128,0,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(VertUniform,CG_C,"c",2178,1,CGI_UNIFORM_PARAM) - -CG_BINDLOCATION_MACRO(Tex0,CG_TEX0,"TEX0",2179,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex1,CG_TEX1,"TEX1",2180,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex2,CG_TEX2,"TEX2",2181,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex3,CG_TEX3,"TEX3",2192,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex4,CG_TEX4,"TEX4",2193,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex5,CG_TEX5,"TEX5",2194,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex6,CG_TEX6,"TEX6",2195,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tex7,CG_TEX7,"TEX7",2196,0,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(HPos,CG_HPOS,"HPOS",2243,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Col0,CG_COL0,"COL0",2245,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Col1,CG_COL1,"COL1",2246,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Col2,CG_COL2,"COL2",2247,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Col3,CG_COL3,"COL3",2248,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSiz,CG_PSIZ,"PSIZ",2309,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Clp0,CG_CLP0,"CLP0",2310,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Clp1,CG_CLP1,"CLP1",2311,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Clp2,CG_CLP2,"CLP2",2312,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Clp3,CG_CLP3,"CLP3",2313,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Clp4,CG_CLP4,"CLP4",2314,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Clp5,CG_CLP5,"CLP5",2315,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(WPos,CG_WPOS,"WPOS",2373,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PointCoord,CG_POINTCOORD,"POINTCOORD",2374,0,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(Position0,CG_POSITION0,"POSITION0",2437,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position1,CG_POSITION1,"POSITION1",2438,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position2,CG_POSITION2,"POSITION2",2439,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position3,CG_POSITION3,"POSITION3",2440,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position4,CG_POSITION4,"POSITION4",2441,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position5,CG_POSITION5,"POSITION5",2442,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position6,CG_POSITION6,"POSITION6",2443,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position7,CG_POSITION7,"POSITION7",2444,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position8,CG_POSITION8,"POSITION8",2445,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position9,CG_POSITION9,"POSITION9",2446,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position10,CG_POSITION10,"POSITION10",2447,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position11,CG_POSITION11,"POSITION11",2448,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position12,CG_POSITION12,"POSITION12",2449,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position13,CG_POSITION13,"POSITION13",2450,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position14,CG_POSITION14,"POSITION14",2451,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Position15,CG_POSITION15,"POSITION15",2452,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Diffuse0,CG_DIFFUSE0,"DIFFUSE0",2501,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent0,CG_TANGENT0,"TANGENT0",2565,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent1,CG_TANGENT1,"TANGENT1",2566,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent2,CG_TANGENT2,"TANGENT2",2567,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent3,CG_TANGENT3,"TANGENT3",2568,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent4,CG_TANGENT4,"TANGENT4",2569,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent5,CG_TANGENT5,"TANGENT5",2570,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent6,CG_TANGENT6,"TANGENT6",2571,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent7,CG_TANGENT7,"TANGENT7",2572,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent8,CG_TANGENT8,"TANGENT8",2573,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent9,CG_TANGENT9,"TANGENT9",2574,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent10,CG_TANGENT10,"TANGENT10",2575,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent11,CG_TANGENT11,"TANGENT11",2576,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent12,CG_TANGENT12,"TANGENT12",2577,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent13,CG_TANGENT13,"TANGENT13",2578,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent14,CG_TANGENT14,"TANGENT14",2579,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Tangent15,CG_TANGENT15,"TANGENT15",2580,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Specular0,CG_SPECULAR0,"SPECULAR0",2629,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices0,CG_BLENDINDICES0,"BLENDINDICES0",2693,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices1,CG_BLENDINDICES1,"BLENDINDICES1",2694,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices2,CG_BLENDINDICES2,"BLENDINDICES2",2695,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices3,CG_BLENDINDICES3,"BLENDINDICES3",2696,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices4,CG_BLENDINDICES4,"BLENDINDICES4",2697,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices5,CG_BLENDINDICES5,"BLENDINDICES5",2698,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices6,CG_BLENDINDICES6,"BLENDINDICES6",2699,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices7,CG_BLENDINDICES7,"BLENDINDICES7",2700,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices8,CG_BLENDINDICES8,"BLENDINDICES8",2701,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices9,CG_BLENDINDICES9,"BLENDINDICES9",2702,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices10,CG_BLENDINDICES10,"BLENDINDICES10",2703,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices11,CG_BLENDINDICES11,"BLENDINDICES11",2704,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices12,CG_BLENDINDICES12,"BLENDINDICES12",2705,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices13,CG_BLENDINDICES13,"BLENDINDICES13",2706,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices14,CG_BLENDINDICES14,"BLENDINDICES14",2707,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendIndices15,CG_BLENDINDICES15,"BLENDINDICES15",2708,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color0,CG_COLOR0,"COLOR0",2757,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color1,CG_COLOR1,"COLOR1",2758,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color2,CG_COLOR2,"COLOR2",2759,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color3,CG_COLOR3,"COLOR3",2760,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color4,CG_COLOR4,"COLOR4",2761,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color5,CG_COLOR5,"COLOR5",2762,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color6,CG_COLOR6,"COLOR6",2763,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color7,CG_COLOR7,"COLOR7",2764,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color8,CG_COLOR8,"COLOR8",2765,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color9,CG_COLOR9,"COLOR9",2766,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color10,CG_COLOR10,"COLOR10",2767,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color11,CG_COLOR11,"COLOR11",2768,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color12,CG_COLOR12,"COLOR12",2769,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color13,CG_COLOR13,"COLOR13",2770,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color14,CG_COLOR14,"COLOR14",2771,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Color15,CG_COLOR15,"COLOR15",2772,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize0,CG_PSIZE0,"PSIZE0",2821,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize1,CG_PSIZE1,"PSIZE1",2822,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize2,CG_PSIZE2,"PSIZE2",2823,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize3,CG_PSIZE3,"PSIZE3",2824,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize4,CG_PSIZE4,"PSIZE4",2825,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize5,CG_PSIZE5,"PSIZE5",2826,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize6,CG_PSIZE6,"PSIZE6",2827,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize7,CG_PSIZE7,"PSIZE7",2828,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize8,CG_PSIZE8,"PSIZE8",2829,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize9,CG_PSIZE9,"PSIZE9",2830,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize10,CG_PSIZE10,"PSIZE10",2831,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize11,CG_PSIZE11,"PSIZE11",2832,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize12,CG_PSIZE12,"PSIZE12",2833,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize13,CG_PSIZE13,"PSIZE13",2834,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize14,CG_PSIZE14,"PSIZE14",2835,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PSize15,CG_PSIZE15,"PSIZE15",2836,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal0,CG_BINORMAL0,"BINORMAL0",2885,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal1,CG_BINORMAL1,"BINORMAL1",2886,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal2,CG_BINORMAL2,"BINORMAL2",2887,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal3,CG_BINORMAL3,"BINORMAL3",2888,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal4,CG_BINORMAL4,"BINORMAL4",2889,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal5,CG_BINORMAL5,"BINORMAL5",2890,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal6,CG_BINORMAL6,"BINORMAL6",2891,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal7,CG_BINORMAL7,"BINORMAL7",2892,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal8,CG_BINORMAL8,"BINORMAL8",2893,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal9,CG_BINORMAL9,"BINORMAL9",2894,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal10,CG_BINORMAL10,"BINORMAL10",2895,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal11,CG_BINORMAL11,"BINORMAL11",2896,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal12,CG_BINORMAL12,"BINORMAL12",2897,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal13,CG_BINORMAL13,"BINORMAL13",2898,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal14,CG_BINORMAL14,"BINORMAL14",2899,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BiNormal15,CG_BINORMAL15,"BINORMAL15",2900,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG0,CG_FOG0,"FOG0",2917,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG1,CG_FOG1,"FOG1",2918,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG2,CG_FOG2,"FOG2",2919,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG3,CG_FOG3,"FOG3",2920,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG4,CG_FOG4,"FOG4",2921,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG5,CG_FOG5,"FOG5",2922,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG6,CG_FOG6,"FOG6",2923,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG7,CG_FOG7,"FOG7",2924,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG8,CG_FOG8,"FOG8",2925,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG9,CG_FOG9,"FOG9",2926,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG10,CG_FOG10,"FOG10",2927,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG11,CG_FOG11,"FOG11",2928,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG12,CG_FOG12,"FOG12",2929,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG13,CG_FOG13,"FOG13",2930,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG14,CG_FOG14,"FOG14",2931,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FOG15,CG_FOG15,"FOG15",2932,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH0,CG_DEPTH0,"DEPTH0",2933,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH1,CG_DEPTH1,"DEPTH1",2934,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH2,CG_DEPTH2,"DEPTH2",2935,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH3,CG_DEPTH3,"DEPTH3",2936,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH4,CG_DEPTH4,"DEPTH4",2937,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH5,CG_DEPTH5,"DEPTH5",2938,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH6,CG_DEPTH6,"DEPTH6",2939,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH7,CG_DEPTH7,"DEPTH7",2940,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH8,CG_DEPTH8,"DEPTH8",2941,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH9,CG_DEPTH9,"DEPTH9",2942,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH10,CG_DEPTH10,"DEPTH10",2943,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH11,CG_DEPTH11,"DEPTH11",2944,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH12,CG_DEPTH12,"DEPTH12",2945,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH13,CG_DEPTH13,"DEPTH13",2946,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH14,CG_DEPTH14,"DEPTH14",2947,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(DEPTH15,CG_DEPTH15,"DEPTH15",2948,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE0,CG_SAMPLE0,"SAMPLE0",2949,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE1,CG_SAMPLE1,"SAMPLE1",2950,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE2,CG_SAMPLE2,"SAMPLE2",2951,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE3,CG_SAMPLE3,"SAMPLE3",2952,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE4,CG_SAMPLE4,"SAMPLE4",2953,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE5,CG_SAMPLE5,"SAMPLE5",2954,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE6,CG_SAMPLE6,"SAMPLE6",2955,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE7,CG_SAMPLE7,"SAMPLE7",2956,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE8,CG_SAMPLE8,"SAMPLE8",2957,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE9,CG_SAMPLE9,"SAMPLE9",2958,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE10,CG_SAMPLE10,"SAMPLE10",2959,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE11,CG_SAMPLE11,"SAMPLE11",2960,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE12,CG_SAMPLE12,"SAMPLE12",2961,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE13,CG_SAMPLE13,"SAMPLE13",2962,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE14,CG_SAMPLE14,"SAMPLE14",2963,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SAMPLE15,CG_SAMPLE15,"SAMPLE15",2964,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight0,CG_BLENDWEIGHT0,"BLENDWEIGHT0",3028,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight1,CG_BLENDWEIGHT1,"BLENDWEIGHT1",3029,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight2,CG_BLENDWEIGHT2,"BLENDWEIGHT2",3030,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight3,CG_BLENDWEIGHT3,"BLENDWEIGHT3",3031,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight4,CG_BLENDWEIGHT4,"BLENDWEIGHT4",3032,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight5,CG_BLENDWEIGHT5,"BLENDWEIGHT5",3033,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight6,CG_BLENDWEIGHT6,"BLENDWEIGHT6",3034,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight7,CG_BLENDWEIGHT7,"BLENDWEIGHT7",3035,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight8,CG_BLENDWEIGHT8,"BLENDWEIGHT8",3036,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight9,CG_BLENDWEIGHT9,"BLENDWEIGHT9",3037,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight10,CG_BLENDWEIGHT10,"BLENDWEIGHT10",3038,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight11,CG_BLENDWEIGHT11,"BLENDWEIGHT11",3039,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight12,CG_BLENDWEIGHT12,"BLENDWEIGHT12",3040,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight13,CG_BLENDWEIGHT13,"BLENDWEIGHT13",3041,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight14,CG_BLENDWEIGHT14,"BLENDWEIGHT14",3042,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(BlendWeight15,CG_BLENDWEIGHT15,"BLENDWEIGHT15",3043,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal0,CG_NORMAL0,"NORMAL0",3092,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal1,CG_NORMAL1,"NORMAL1",3093,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal2,CG_NORMAL2,"NORMAL2",3094,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal3,CG_NORMAL3,"NORMAL3",3095,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal4,CG_NORMAL4,"NORMAL4",3096,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal5,CG_NORMAL5,"NORMAL5",3097,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal6,CG_NORMAL6,"NORMAL6",3098,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal7,CG_NORMAL7,"NORMAL7",3099,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal8,CG_NORMAL8,"NORMAL8",3100,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal9,CG_NORMAL9,"NORMAL9",3101,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal10,CG_NORMAL10,"NORMAL10",3102,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal11,CG_NORMAL11,"NORMAL11",3103,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal12,CG_NORMAL12,"NORMAL12",3104,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal13,CG_NORMAL13,"NORMAL13",3105,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal14,CG_NORMAL14,"NORMAL14",3106,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Normal15,CG_NORMAL15,"NORMAL15",3107,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(FogCoord,CG_FOGCOORD,"FOGCOORD",3156,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord0,CG_TEXCOORD0,"TEXCOORD0",3220,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord1,CG_TEXCOORD1,"TEXCOORD1",3221,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord2,CG_TEXCOORD2,"TEXCOORD2",3222,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord3,CG_TEXCOORD3,"TEXCOORD3",3223,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord4,CG_TEXCOORD4,"TEXCOORD4",3224,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord5,CG_TEXCOORD5,"TEXCOORD5",3225,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord6,CG_TEXCOORD6,"TEXCOORD6",3226,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord7,CG_TEXCOORD7,"TEXCOORD7",3227,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord8,CG_TEXCOORD8,"TEXCOORD8",3228,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord9,CG_TEXCOORD9,"TEXCOORD9",3229,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord10,CG_TEXCOORD10,"TEXCOORD10",3230,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord11,CG_TEXCOORD11,"TEXCOORD11",3231,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord12,CG_TEXCOORD12,"TEXCOORD12",3232,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord13,CG_TEXCOORD13,"TEXCOORD13",3233,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord14,CG_TEXCOORD14,"TEXCOORD14",3234,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(TexCoord15,CG_TEXCOORD15,"TEXCOORD15",3235,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(CombinerConst0,CG_COMBINER_CONST0,"COMBINER_CONST0",3284,0,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(CombinerConst1,CG_COMBINER_CONST1,"COMBINER_CONST1",3285,0,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(CombinerStageConst0,CG_COMBINER_STAGE_CONST0,"COMBINER_STAGE_CONST0",3286,1,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(CombinerStageConst1,CG_COMBINER_STAGE_CONST1,"COMBINER_STAGE_CONST1",3287,1,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(OffsetTextureMatrix,CG_OFFSET_TEXTURE_MATRIX,"OFFSET_TEXTURE_MATRIX",3288,0,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(OffsetTextureScale,CG_OFFSET_TEXTURE_SCALE,"OFFSET_TEXTURE_SCALE",3289,0,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(OffsetTextureBias,CG_OFFSET_TEXTURE_BIAS,"OFFSET_TEXTURE_BIAS",3290,0,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(ConstEye,CG_CONST_EYE,"CONST_EYE",3291,0,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(Coverage, CG_COVERAGE, "COVERAGE", 3292, 0, CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(TessFactor,CG_TESSFACTOR,"TESSFACTOR",3255,0,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(GLSLUniform,CG_GLSL_UNIFORM,"glsl_uniform",3300,1,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(GLSLAttrib,CG_GLSL_ATTRIB,"glsl_attrib",3301,1,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(Env,CG_ENV,"ENV",3302,1,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(HLSLUniform,CG_HLSL_UNIFORM,"hlsl_uniform",3559,1,CGI_UNIFORM_PARAM) -CG_BINDLOCATION_MACRO(HLSLAttrib,CG_HLSL_VARYING,"hlsl_attrib",3560,1,CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(SamplerResource,CG_SAMPLER_RES, "SAMPLER_RES", 3561, 1, CGI_UNIFORM_PARAM) - -CG_BINDLOCATION_MACRO(LastColor0, CG_LASTCOL0, "LASTCOL0", 4400, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor1, CG_LASTCOL1, "LASTCOL1", 4401, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor2, CG_LASTCOL2, "LASTCOL2", 4402, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor3, CG_LASTCOL3, "LASTCOL3", 4403, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor4, CG_LASTCOL4, "LASTCOL4", 4404, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor5, CG_LASTCOL5, "LASTCOL5", 4405, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor6, CG_LASTCOL6, "LASTCOL6", 4406, 0, CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(LastColor7, CG_LASTCOL7, "LASTCOL7", 4407, 0, CG_VARYING_PARAM) - -CG_BINDLOCATION_MACRO(Face,CG_FACE,"FACE",4410,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(PrimitiveId,CG_PRIMITIVEID,"PRIMITIVEID",4411,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(InstanceId,CG_INSTANCEID,"INSTANCEID",4412,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SampleId,CG_SAMPLEID,"SAMPLEID",4413,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(VertexId,CG_VERTEXID,"VERTEXID",4414,0,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(Layer,CG_LAYER,"LAYER",4415,1,CG_VARYING_PARAM) -CG_BINDLOCATION_MACRO(SampleMask,CG_SAMPLEMASK,"SAMPLEMASK",4416,0,CG_VARYING_PARAM) - -#undef CG_BINDLOCATION_MACRO + + +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * The following macro invocations define the supported CG basic hardware + * bind locations. + * + * The macros have the form : + * + * CG_BINDLOCATION_MACRO(name, compiler_name, enum_int) + * + * name : The name of the location. + * enum_name : The C enumerant. + * compiler_name : The name of the location within the compiler syntax. + * int_id : Integer enumerant associated with this bind location. + * (3256 is reservered for CG_UNDEFINED) + * addressable : The bind location must have an integer address + * associated with it. + * ParamType : the cgParamType of this register. + * + */ + + +CG_BINDLOCATION_MACRO(TexUnit0,CG_TEXUNIT0,"texunit 0",2048,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit1,CG_TEXUNIT1,"texunit 1",2049,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit2,CG_TEXUNIT2,"texunit 2",2050,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit3,CG_TEXUNIT3,"texunit 3",2051,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit4,CG_TEXUNIT4,"texunit 4",2052,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit5,CG_TEXUNIT5,"texunit 5",2053,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit6,CG_TEXUNIT6,"texunit 6",2054,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit7,CG_TEXUNIT7,"texunit 7",2055,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit8,CG_TEXUNIT8,"texunit 8",2056,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit9,CG_TEXUNIT9,"texunit 9",2057,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit10,CG_TEXUNIT10,"texunit 10",2058,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit11,CG_TEXUNIT11,"texunit 11",2059,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit12,CG_TEXUNIT12,"texunit 12",2060,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit13,CG_TEXUNIT13,"texunit 13",2061,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit14,CG_TEXUNIT14,"texunit 14",2062,0,CG_TEXOBJ_PARAM) +CG_BINDLOCATION_MACRO(TexUnit15,CG_TEXUNIT15,"texunit 15",2063,0,CG_TEXOBJ_PARAM) + +CG_BINDLOCATION_MACRO(Buffer0, CG_BUFFER0, "buffer[0]", 2064, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer1, CG_BUFFER1, "buffer[1]", 2065, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer2, CG_BUFFER2, "buffer[2]", 2066, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer3, CG_BUFFER3, "buffer[3]", 2067, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer4, CG_BUFFER4, "buffer[4]", 2068, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer5, CG_BUFFER5, "buffer[5]", 2069, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer6, CG_BUFFER6, "buffer[6]", 2070, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer7, CG_BUFFER7, "buffer[7]", 2071, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer8, CG_BUFFER8, "buffer[8]", 2072, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer9, CG_BUFFER9, "buffer[9]", 2073, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer10, CG_BUFFER10, "buffer[10]", 2074, 1, CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Buffer11, CG_BUFFER11, "buffer[11]", 2075, 1, CGI_UNIFORM_PARAM) + +CG_BINDLOCATION_MACRO(Attr0,CG_ATTR0,"ATTR0",2113,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr1,CG_ATTR1,"ATTR1",2114,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr2,CG_ATTR2,"ATTR2",2115,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr3,CG_ATTR3,"ATTR3",2116,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr4,CG_ATTR4,"ATTR4",2117,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr5,CG_ATTR5,"ATTR5",2118,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr6,CG_ATTR6,"ATTR6",2119,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr7,CG_ATTR7,"ATTR7",2120,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr8,CG_ATTR8,"ATTR8",2121,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr9,CG_ATTR9,"ATTR9",2122,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr10,CG_ATTR10,"ATTR10",2123,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr11,CG_ATTR11,"ATTR11",2124,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr12,CG_ATTR12,"ATTR12",2125,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr13,CG_ATTR13,"ATTR13",2126,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr14,CG_ATTR14,"ATTR14",2127,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Attr15,CG_ATTR15,"ATTR15",2128,0,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(VertUniform,CG_C,"c",2178,1,CGI_UNIFORM_PARAM) + +CG_BINDLOCATION_MACRO(Tex0,CG_TEX0,"TEX0",2179,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex1,CG_TEX1,"TEX1",2180,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex2,CG_TEX2,"TEX2",2181,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex3,CG_TEX3,"TEX3",2192,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex4,CG_TEX4,"TEX4",2193,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex5,CG_TEX5,"TEX5",2194,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex6,CG_TEX6,"TEX6",2195,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tex7,CG_TEX7,"TEX7",2196,0,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(HPos,CG_HPOS,"HPOS",2243,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Col0,CG_COL0,"COL0",2245,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Col1,CG_COL1,"COL1",2246,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Col2,CG_COL2,"COL2",2247,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Col3,CG_COL3,"COL3",2248,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSiz,CG_PSIZ,"PSIZ",2309,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Clp0,CG_CLP0,"CLP0",2310,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Clp1,CG_CLP1,"CLP1",2311,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Clp2,CG_CLP2,"CLP2",2312,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Clp3,CG_CLP3,"CLP3",2313,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Clp4,CG_CLP4,"CLP4",2314,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Clp5,CG_CLP5,"CLP5",2315,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(WPos,CG_WPOS,"WPOS",2373,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PointCoord,CG_POINTCOORD,"POINTCOORD",2374,0,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(Position0,CG_POSITION0,"POSITION0",2437,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position1,CG_POSITION1,"POSITION1",2438,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position2,CG_POSITION2,"POSITION2",2439,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position3,CG_POSITION3,"POSITION3",2440,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position4,CG_POSITION4,"POSITION4",2441,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position5,CG_POSITION5,"POSITION5",2442,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position6,CG_POSITION6,"POSITION6",2443,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position7,CG_POSITION7,"POSITION7",2444,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position8,CG_POSITION8,"POSITION8",2445,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position9,CG_POSITION9,"POSITION9",2446,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position10,CG_POSITION10,"POSITION10",2447,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position11,CG_POSITION11,"POSITION11",2448,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position12,CG_POSITION12,"POSITION12",2449,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position13,CG_POSITION13,"POSITION13",2450,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position14,CG_POSITION14,"POSITION14",2451,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Position15,CG_POSITION15,"POSITION15",2452,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Diffuse0,CG_DIFFUSE0,"DIFFUSE0",2501,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent0,CG_TANGENT0,"TANGENT0",2565,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent1,CG_TANGENT1,"TANGENT1",2566,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent2,CG_TANGENT2,"TANGENT2",2567,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent3,CG_TANGENT3,"TANGENT3",2568,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent4,CG_TANGENT4,"TANGENT4",2569,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent5,CG_TANGENT5,"TANGENT5",2570,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent6,CG_TANGENT6,"TANGENT6",2571,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent7,CG_TANGENT7,"TANGENT7",2572,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent8,CG_TANGENT8,"TANGENT8",2573,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent9,CG_TANGENT9,"TANGENT9",2574,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent10,CG_TANGENT10,"TANGENT10",2575,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent11,CG_TANGENT11,"TANGENT11",2576,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent12,CG_TANGENT12,"TANGENT12",2577,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent13,CG_TANGENT13,"TANGENT13",2578,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent14,CG_TANGENT14,"TANGENT14",2579,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Tangent15,CG_TANGENT15,"TANGENT15",2580,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Specular0,CG_SPECULAR0,"SPECULAR0",2629,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices0,CG_BLENDINDICES0,"BLENDINDICES0",2693,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices1,CG_BLENDINDICES1,"BLENDINDICES1",2694,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices2,CG_BLENDINDICES2,"BLENDINDICES2",2695,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices3,CG_BLENDINDICES3,"BLENDINDICES3",2696,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices4,CG_BLENDINDICES4,"BLENDINDICES4",2697,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices5,CG_BLENDINDICES5,"BLENDINDICES5",2698,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices6,CG_BLENDINDICES6,"BLENDINDICES6",2699,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices7,CG_BLENDINDICES7,"BLENDINDICES7",2700,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices8,CG_BLENDINDICES8,"BLENDINDICES8",2701,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices9,CG_BLENDINDICES9,"BLENDINDICES9",2702,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices10,CG_BLENDINDICES10,"BLENDINDICES10",2703,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices11,CG_BLENDINDICES11,"BLENDINDICES11",2704,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices12,CG_BLENDINDICES12,"BLENDINDICES12",2705,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices13,CG_BLENDINDICES13,"BLENDINDICES13",2706,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices14,CG_BLENDINDICES14,"BLENDINDICES14",2707,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendIndices15,CG_BLENDINDICES15,"BLENDINDICES15",2708,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color0,CG_COLOR0,"COLOR0",2757,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color1,CG_COLOR1,"COLOR1",2758,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color2,CG_COLOR2,"COLOR2",2759,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color3,CG_COLOR3,"COLOR3",2760,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color4,CG_COLOR4,"COLOR4",2761,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color5,CG_COLOR5,"COLOR5",2762,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color6,CG_COLOR6,"COLOR6",2763,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color7,CG_COLOR7,"COLOR7",2764,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color8,CG_COLOR8,"COLOR8",2765,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color9,CG_COLOR9,"COLOR9",2766,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color10,CG_COLOR10,"COLOR10",2767,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color11,CG_COLOR11,"COLOR11",2768,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color12,CG_COLOR12,"COLOR12",2769,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color13,CG_COLOR13,"COLOR13",2770,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color14,CG_COLOR14,"COLOR14",2771,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Color15,CG_COLOR15,"COLOR15",2772,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize0,CG_PSIZE0,"PSIZE0",2821,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize1,CG_PSIZE1,"PSIZE1",2822,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize2,CG_PSIZE2,"PSIZE2",2823,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize3,CG_PSIZE3,"PSIZE3",2824,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize4,CG_PSIZE4,"PSIZE4",2825,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize5,CG_PSIZE5,"PSIZE5",2826,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize6,CG_PSIZE6,"PSIZE6",2827,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize7,CG_PSIZE7,"PSIZE7",2828,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize8,CG_PSIZE8,"PSIZE8",2829,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize9,CG_PSIZE9,"PSIZE9",2830,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize10,CG_PSIZE10,"PSIZE10",2831,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize11,CG_PSIZE11,"PSIZE11",2832,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize12,CG_PSIZE12,"PSIZE12",2833,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize13,CG_PSIZE13,"PSIZE13",2834,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize14,CG_PSIZE14,"PSIZE14",2835,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PSize15,CG_PSIZE15,"PSIZE15",2836,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal0,CG_BINORMAL0,"BINORMAL0",2885,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal1,CG_BINORMAL1,"BINORMAL1",2886,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal2,CG_BINORMAL2,"BINORMAL2",2887,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal3,CG_BINORMAL3,"BINORMAL3",2888,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal4,CG_BINORMAL4,"BINORMAL4",2889,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal5,CG_BINORMAL5,"BINORMAL5",2890,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal6,CG_BINORMAL6,"BINORMAL6",2891,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal7,CG_BINORMAL7,"BINORMAL7",2892,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal8,CG_BINORMAL8,"BINORMAL8",2893,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal9,CG_BINORMAL9,"BINORMAL9",2894,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal10,CG_BINORMAL10,"BINORMAL10",2895,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal11,CG_BINORMAL11,"BINORMAL11",2896,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal12,CG_BINORMAL12,"BINORMAL12",2897,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal13,CG_BINORMAL13,"BINORMAL13",2898,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal14,CG_BINORMAL14,"BINORMAL14",2899,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BiNormal15,CG_BINORMAL15,"BINORMAL15",2900,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG0,CG_FOG0,"FOG0",2917,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG1,CG_FOG1,"FOG1",2918,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG2,CG_FOG2,"FOG2",2919,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG3,CG_FOG3,"FOG3",2920,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG4,CG_FOG4,"FOG4",2921,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG5,CG_FOG5,"FOG5",2922,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG6,CG_FOG6,"FOG6",2923,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG7,CG_FOG7,"FOG7",2924,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG8,CG_FOG8,"FOG8",2925,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG9,CG_FOG9,"FOG9",2926,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG10,CG_FOG10,"FOG10",2927,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG11,CG_FOG11,"FOG11",2928,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG12,CG_FOG12,"FOG12",2929,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG13,CG_FOG13,"FOG13",2930,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG14,CG_FOG14,"FOG14",2931,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FOG15,CG_FOG15,"FOG15",2932,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH0,CG_DEPTH0,"DEPTH0",2933,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH1,CG_DEPTH1,"DEPTH1",2934,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH2,CG_DEPTH2,"DEPTH2",2935,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH3,CG_DEPTH3,"DEPTH3",2936,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH4,CG_DEPTH4,"DEPTH4",2937,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH5,CG_DEPTH5,"DEPTH5",2938,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH6,CG_DEPTH6,"DEPTH6",2939,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH7,CG_DEPTH7,"DEPTH7",2940,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH8,CG_DEPTH8,"DEPTH8",2941,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH9,CG_DEPTH9,"DEPTH9",2942,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH10,CG_DEPTH10,"DEPTH10",2943,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH11,CG_DEPTH11,"DEPTH11",2944,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH12,CG_DEPTH12,"DEPTH12",2945,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH13,CG_DEPTH13,"DEPTH13",2946,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH14,CG_DEPTH14,"DEPTH14",2947,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(DEPTH15,CG_DEPTH15,"DEPTH15",2948,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE0,CG_SAMPLE0,"SAMPLE0",2949,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE1,CG_SAMPLE1,"SAMPLE1",2950,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE2,CG_SAMPLE2,"SAMPLE2",2951,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE3,CG_SAMPLE3,"SAMPLE3",2952,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE4,CG_SAMPLE4,"SAMPLE4",2953,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE5,CG_SAMPLE5,"SAMPLE5",2954,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE6,CG_SAMPLE6,"SAMPLE6",2955,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE7,CG_SAMPLE7,"SAMPLE7",2956,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE8,CG_SAMPLE8,"SAMPLE8",2957,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE9,CG_SAMPLE9,"SAMPLE9",2958,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE10,CG_SAMPLE10,"SAMPLE10",2959,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE11,CG_SAMPLE11,"SAMPLE11",2960,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE12,CG_SAMPLE12,"SAMPLE12",2961,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE13,CG_SAMPLE13,"SAMPLE13",2962,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE14,CG_SAMPLE14,"SAMPLE14",2963,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SAMPLE15,CG_SAMPLE15,"SAMPLE15",2964,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight0,CG_BLENDWEIGHT0,"BLENDWEIGHT0",3028,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight1,CG_BLENDWEIGHT1,"BLENDWEIGHT1",3029,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight2,CG_BLENDWEIGHT2,"BLENDWEIGHT2",3030,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight3,CG_BLENDWEIGHT3,"BLENDWEIGHT3",3031,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight4,CG_BLENDWEIGHT4,"BLENDWEIGHT4",3032,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight5,CG_BLENDWEIGHT5,"BLENDWEIGHT5",3033,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight6,CG_BLENDWEIGHT6,"BLENDWEIGHT6",3034,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight7,CG_BLENDWEIGHT7,"BLENDWEIGHT7",3035,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight8,CG_BLENDWEIGHT8,"BLENDWEIGHT8",3036,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight9,CG_BLENDWEIGHT9,"BLENDWEIGHT9",3037,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight10,CG_BLENDWEIGHT10,"BLENDWEIGHT10",3038,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight11,CG_BLENDWEIGHT11,"BLENDWEIGHT11",3039,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight12,CG_BLENDWEIGHT12,"BLENDWEIGHT12",3040,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight13,CG_BLENDWEIGHT13,"BLENDWEIGHT13",3041,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight14,CG_BLENDWEIGHT14,"BLENDWEIGHT14",3042,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(BlendWeight15,CG_BLENDWEIGHT15,"BLENDWEIGHT15",3043,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal0,CG_NORMAL0,"NORMAL0",3092,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal1,CG_NORMAL1,"NORMAL1",3093,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal2,CG_NORMAL2,"NORMAL2",3094,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal3,CG_NORMAL3,"NORMAL3",3095,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal4,CG_NORMAL4,"NORMAL4",3096,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal5,CG_NORMAL5,"NORMAL5",3097,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal6,CG_NORMAL6,"NORMAL6",3098,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal7,CG_NORMAL7,"NORMAL7",3099,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal8,CG_NORMAL8,"NORMAL8",3100,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal9,CG_NORMAL9,"NORMAL9",3101,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal10,CG_NORMAL10,"NORMAL10",3102,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal11,CG_NORMAL11,"NORMAL11",3103,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal12,CG_NORMAL12,"NORMAL12",3104,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal13,CG_NORMAL13,"NORMAL13",3105,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal14,CG_NORMAL14,"NORMAL14",3106,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Normal15,CG_NORMAL15,"NORMAL15",3107,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(FogCoord,CG_FOGCOORD,"FOGCOORD",3156,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord0,CG_TEXCOORD0,"TEXCOORD0",3220,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord1,CG_TEXCOORD1,"TEXCOORD1",3221,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord2,CG_TEXCOORD2,"TEXCOORD2",3222,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord3,CG_TEXCOORD3,"TEXCOORD3",3223,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord4,CG_TEXCOORD4,"TEXCOORD4",3224,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord5,CG_TEXCOORD5,"TEXCOORD5",3225,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord6,CG_TEXCOORD6,"TEXCOORD6",3226,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord7,CG_TEXCOORD7,"TEXCOORD7",3227,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord8,CG_TEXCOORD8,"TEXCOORD8",3228,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord9,CG_TEXCOORD9,"TEXCOORD9",3229,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord10,CG_TEXCOORD10,"TEXCOORD10",3230,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord11,CG_TEXCOORD11,"TEXCOORD11",3231,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord12,CG_TEXCOORD12,"TEXCOORD12",3232,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord13,CG_TEXCOORD13,"TEXCOORD13",3233,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord14,CG_TEXCOORD14,"TEXCOORD14",3234,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(TexCoord15,CG_TEXCOORD15,"TEXCOORD15",3235,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(CombinerConst0,CG_COMBINER_CONST0,"COMBINER_CONST0",3284,0,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(CombinerConst1,CG_COMBINER_CONST1,"COMBINER_CONST1",3285,0,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(CombinerStageConst0,CG_COMBINER_STAGE_CONST0,"COMBINER_STAGE_CONST0",3286,1,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(CombinerStageConst1,CG_COMBINER_STAGE_CONST1,"COMBINER_STAGE_CONST1",3287,1,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(OffsetTextureMatrix,CG_OFFSET_TEXTURE_MATRIX,"OFFSET_TEXTURE_MATRIX",3288,0,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(OffsetTextureScale,CG_OFFSET_TEXTURE_SCALE,"OFFSET_TEXTURE_SCALE",3289,0,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(OffsetTextureBias,CG_OFFSET_TEXTURE_BIAS,"OFFSET_TEXTURE_BIAS",3290,0,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(ConstEye,CG_CONST_EYE,"CONST_EYE",3291,0,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(Coverage, CG_COVERAGE, "COVERAGE", 3292, 0, CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(TessFactor,CG_TESSFACTOR,"TESSFACTOR",3255,0,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(GLSLUniform,CG_GLSL_UNIFORM,"glsl_uniform",3300,1,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(GLSLAttrib,CG_GLSL_ATTRIB,"glsl_attrib",3301,1,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(Env,CG_ENV,"ENV",3302,1,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(HLSLUniform,CG_HLSL_UNIFORM,"hlsl_uniform",3559,1,CGI_UNIFORM_PARAM) +CG_BINDLOCATION_MACRO(HLSLAttrib,CG_HLSL_VARYING,"hlsl_attrib",3560,1,CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(SamplerResource,CG_SAMPLER_RES, "SAMPLER_RES", 3561, 1, CGI_UNIFORM_PARAM) + +CG_BINDLOCATION_MACRO(LastColor0, CG_LASTCOL0, "LASTCOL0", 4400, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor1, CG_LASTCOL1, "LASTCOL1", 4401, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor2, CG_LASTCOL2, "LASTCOL2", 4402, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor3, CG_LASTCOL3, "LASTCOL3", 4403, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor4, CG_LASTCOL4, "LASTCOL4", 4404, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor5, CG_LASTCOL5, "LASTCOL5", 4405, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor6, CG_LASTCOL6, "LASTCOL6", 4406, 0, CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(LastColor7, CG_LASTCOL7, "LASTCOL7", 4407, 0, CG_VARYING_PARAM) + +CG_BINDLOCATION_MACRO(Face,CG_FACE,"FACE",4410,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(PrimitiveId,CG_PRIMITIVEID,"PRIMITIVEID",4411,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(InstanceId,CG_INSTANCEID,"INSTANCEID",4412,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SampleId,CG_SAMPLEID,"SAMPLEID",4413,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(VertexId,CG_VERTEXID,"VERTEXID",4414,0,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(Layer,CG_LAYER,"LAYER",4415,1,CG_VARYING_PARAM) +CG_BINDLOCATION_MACRO(SampleMask,CG_SAMPLEMASK,"SAMPLEMASK",4416,0,CG_VARYING_PARAM) + +#undef CG_BINDLOCATION_MACRO diff --git a/Externals/Cg/cg_datatypes.h b/Externals/Cg/cg_datatypes.h index f61d6fb302..c26eced597 100644 --- a/Externals/Cg/cg_datatypes.h +++ b/Externals/Cg/cg_datatypes.h @@ -1,191 +1,191 @@ -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/* - * The following macro invocations define the supported CG basic data types. - * - * The macros have the form : - * - * CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, nrows, ncols, pc_name) - * - * name : The name of the data type. - * compiler_name : The name of the data type within the compiler syntax. - * enum_name : The C enumerant. - * base_name : The C enumerant of the base type. - * nrows : Number of rows for matrix types. Should be 0 other-wise. - * ncols : Number of columns for scalar, vector, and matrix types. - * pc_name : The C enumerant of the parameter class. - * - */ - - - -CG_DATATYPE_MACRO(Half,half,CG_HALF,CG_HALF,0,1,CG_PARAMETERCLASS_SCALAR) -CG_DATATYPE_MACRO(Half2,half2,CG_HALF2,CG_HALF,0,2,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Half3,half3,CG_HALF3,CG_HALF,0,3,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Half4,half4,CG_HALF4,CG_HALF,0,4,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Half1x1,half1x1,CG_HALF1x1,CG_HALF,1,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half1x2,half1x2,CG_HALF1x2,CG_HALF,1,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half1x3,half1x3,CG_HALF1x3,CG_HALF,1,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half1x4,half1x4,CG_HALF1x4,CG_HALF,1,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half2x1,half2x1,CG_HALF2x1,CG_HALF,2,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half2x2,half2x2,CG_HALF2x2,CG_HALF,2,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half2x3,half2x3,CG_HALF2x3,CG_HALF,2,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half2x4,half2x4,CG_HALF2x4,CG_HALF,2,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half3x1,half3x1,CG_HALF3x1,CG_HALF,3,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half3x2,half3x2,CG_HALF3x2,CG_HALF,3,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half3x3,half3x3,CG_HALF3x3,CG_HALF,3,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half3x4,half3x4,CG_HALF3x4,CG_HALF,3,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half4x1,half4x1,CG_HALF4x1,CG_HALF,4,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half4x2,half4x2,CG_HALF4x2,CG_HALF,4,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half4x3,half4x3,CG_HALF4x3,CG_HALF,4,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half4x4,half4x4,CG_HALF4x4,CG_HALF,4,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float,float,CG_FLOAT,CG_FLOAT,0,1,CG_PARAMETERCLASS_SCALAR) -CG_DATATYPE_MACRO(Float2,float2,CG_FLOAT2,CG_FLOAT,0,2,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Float3,float3,CG_FLOAT3,CG_FLOAT,0,3,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Float4,float4,CG_FLOAT4,CG_FLOAT,0,4,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Float1x1,float1x1,CG_FLOAT1x1,CG_FLOAT,1,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float1x2,float1x2,CG_FLOAT1x2,CG_FLOAT,1,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float1x3,float1x3,CG_FLOAT1x3,CG_FLOAT,1,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float1x4,float1x4,CG_FLOAT1x4,CG_FLOAT,1,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float2x1,float2x1,CG_FLOAT2x1,CG_FLOAT,2,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float2x2,float2x2,CG_FLOAT2x2,CG_FLOAT,2,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float2x3,float2x3,CG_FLOAT2x3,CG_FLOAT,2,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float2x4,float2x4,CG_FLOAT2x4,CG_FLOAT,2,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float3x1,float3x1,CG_FLOAT3x1,CG_FLOAT,3,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float3x2,float3x2,CG_FLOAT3x2,CG_FLOAT,3,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float3x3,float3x3,CG_FLOAT3x3,CG_FLOAT,3,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float3x4,float3x4,CG_FLOAT3x4,CG_FLOAT,3,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float4x1,float4x1,CG_FLOAT4x1,CG_FLOAT,4,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float4x2,float4x2,CG_FLOAT4x2,CG_FLOAT,4,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float4x3,float4x3,CG_FLOAT4x3,CG_FLOAT,4,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Float4x4,float4x4,CG_FLOAT4x4,CG_FLOAT,4,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Sampler1D,sampler1D,CG_SAMPLER1D,CG_SAMPLER1D,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(Sampler2D,sampler2D,CG_SAMPLER2D,CG_SAMPLER2D,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(Sampler3D,sampler3D,CG_SAMPLER3D,CG_SAMPLER3D,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(SamplerRECT,samplerRECT,CG_SAMPLERRECT,CG_SAMPLERRECT,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(SamplerCUBE,samplerCUBE,CG_SAMPLERCUBE,CG_SAMPLERCUBE,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(Fixed,fixed,CG_FIXED,CG_FIXED,0,1,CG_PARAMETERCLASS_SCALAR) -CG_DATATYPE_MACRO(Fixed2,fixed2,CG_FIXED2,CG_FIXED,0,2,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Fixed3,fixed3,CG_FIXED3,CG_FIXED,0,3,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Fixed4,fixed4,CG_FIXED4,CG_FIXED,0,4,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Fixed1x1,fixed1x1,CG_FIXED1x1,CG_FIXED,1,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed1x2,fixed1x2,CG_FIXED1x2,CG_FIXED,1,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed1x3,fixed1x3,CG_FIXED1x3,CG_FIXED,1,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed1x4,fixed1x4,CG_FIXED1x4,CG_FIXED,1,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed2x1,fixed2x1,CG_FIXED2x1,CG_FIXED,2,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed2x2,fixed2x2,CG_FIXED2x2,CG_FIXED,2,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed2x3,fixed2x3,CG_FIXED2x3,CG_FIXED,2,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed2x4,fixed2x4,CG_FIXED2x4,CG_FIXED,2,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed3x1,fixed3x1,CG_FIXED3x1,CG_FIXED,3,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed3x2,fixed3x2,CG_FIXED3x2,CG_FIXED,3,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed3x3,fixed3x3,CG_FIXED3x3,CG_FIXED,3,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed3x4,fixed3x4,CG_FIXED3x4,CG_FIXED,3,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed4x1,fixed4x1,CG_FIXED4x1,CG_FIXED,4,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed4x2,fixed4x2,CG_FIXED4x2,CG_FIXED,4,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed4x3,fixed4x3,CG_FIXED4x3,CG_FIXED,4,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Fixed4x4,fixed4x4,CG_FIXED4x4,CG_FIXED,4,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Half1,half1,CG_HALF1,CG_HALF,0,1,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Float1,float1,CG_FLOAT1,CG_FLOAT,0,1,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Fixed1,fixed1,CG_FIXED1,CG_FIXED,0,1,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Int,int,CG_INT,CG_INT,0,1,CG_PARAMETERCLASS_SCALAR) -CG_DATATYPE_MACRO(Int1,int1,CG_INT1,CG_INT,0,1,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Int2,int2,CG_INT2,CG_INT,0,2,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Int3,int3,CG_INT3,CG_INT,0,3,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Int4,int4,CG_INT4,CG_INT,0,4,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Int1x1,int1x1,CG_INT1x1,CG_INT,1,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int1x2,int1x2,CG_INT1x2,CG_INT,1,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int1x3,int1x3,CG_INT1x3,CG_INT,1,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int1x4,int1x4,CG_INT1x4,CG_INT,1,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int2x1,int2x1,CG_INT2x1,CG_INT,2,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int2x2,int2x2,CG_INT2x2,CG_INT,2,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int2x3,int2x3,CG_INT2x3,CG_INT,2,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int2x4,int2x4,CG_INT2x4,CG_INT,2,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int3x1,int3x1,CG_INT3x1,CG_INT,3,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int3x2,int3x2,CG_INT3x2,CG_INT,3,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int3x3,int3x3,CG_INT3x3,CG_INT,3,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int3x4,int3x4,CG_INT3x4,CG_INT,3,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int4x1,int4x1,CG_INT4x1,CG_INT,4,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int4x2,int4x2,CG_INT4x2,CG_INT,4,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int4x3,int4x3,CG_INT4x3,CG_INT,4,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Int4x4,int4x4,CG_INT4x4,CG_INT,4,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool,bool,CG_BOOL,CG_BOOL,0,1,CG_PARAMETERCLASS_SCALAR) -CG_DATATYPE_MACRO(Bool1,bool1,CG_BOOL1,CG_BOOL,0,1,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Bool2,bool2,CG_BOOL2,CG_BOOL,0,2,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Bool3,bool3,CG_BOOL3,CG_BOOL,0,3,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Bool4,bool4,CG_BOOL4,CG_BOOL,0,4,CG_PARAMETERCLASS_VECTOR) -CG_DATATYPE_MACRO(Bool1x1,bool1x1,CG_BOOL1x1,CG_BOOL,1,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool1x2,bool1x2,CG_BOOL1x2,CG_BOOL,1,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool1x3,bool1x3,CG_BOOL1x3,CG_BOOL,1,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool1x4,bool1x4,CG_BOOL1x4,CG_BOOL,1,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool2x1,bool2x1,CG_BOOL2x1,CG_BOOL,2,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool2x2,bool2x2,CG_BOOL2x2,CG_BOOL,2,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool2x3,bool2x3,CG_BOOL2x3,CG_BOOL,2,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool2x4,bool2x4,CG_BOOL2x4,CG_BOOL,2,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool3x1,bool3x1,CG_BOOL3x1,CG_BOOL,3,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool3x2,bool3x2,CG_BOOL3x2,CG_BOOL,3,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool3x3,bool3x3,CG_BOOL3x3,CG_BOOL,3,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool3x4,bool3x4,CG_BOOL3x4,CG_BOOL,3,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool4x1,bool4x1,CG_BOOL4x1,CG_BOOL,4,1,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool4x2,bool4x2,CG_BOOL4x2,CG_BOOL,4,2,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool4x3,bool4x3,CG_BOOL4x3,CG_BOOL,4,3,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(Bool4x4,bool4x4,CG_BOOL4x4,CG_BOOL,4,4,CG_PARAMETERCLASS_MATRIX) -CG_DATATYPE_MACRO(String,string,CG_STRING,CG_STRING,0,1,CG_PARAMETERCLASS_OBJECT) -CG_DATATYPE_MACRO(Program,program,CG_PROGRAM_TYPE,CG_PROGRAM_TYPE,0,0,CG_PARAMETERCLASS_OBJECT) -CG_DATATYPE_MACRO(Texture,texture,CG_TEXTURE,CG_TEXTURE,0,0,CG_PARAMETERCLASS_OBJECT) -CG_DATATYPE_MACRO(Sampler1DARRAY,sampler1DARRAY,CG_SAMPLER1DARRAY,CG_SAMPLER1DARRAY,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(Sampler2DARRAY,sampler2DARRAY,CG_SAMPLER2DARRAY,CG_SAMPLER2DARRAY,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(SamplerCUBEARRAY,samplerCUBEARRAY,CG_SAMPLERCUBEARRAY,CG_SAMPLERCUBEARRAY,0,0,CG_PARAMETERCLASS_SAMPLER) -CG_DATATYPE_MACRO(VertexShader, vertexshader, CG_VERTEXSHADER_TYPE, CG_VERTEXSHADER_TYPE, 0, 0, CG_PARAMETERCLASS_OBJECT) -CG_DATATYPE_MACRO(PixelShader, pixelshader, CG_PIXELSHADER_TYPE, CG_PIXELSHADER_TYPE, 0, 0, CG_PARAMETERCLASS_OBJECT) -CG_DATATYPE_MACRO(Sampler, sampler, CG_SAMPLER, CG_SAMPLER, 0, 0, CG_PARAMETERCLASS_SAMPLER) -#undef CG_DATATYPE_MACRO +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * The following macro invocations define the supported CG basic data types. + * + * The macros have the form : + * + * CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, nrows, ncols, pc_name) + * + * name : The name of the data type. + * compiler_name : The name of the data type within the compiler syntax. + * enum_name : The C enumerant. + * base_name : The C enumerant of the base type. + * nrows : Number of rows for matrix types. Should be 0 other-wise. + * ncols : Number of columns for scalar, vector, and matrix types. + * pc_name : The C enumerant of the parameter class. + * + */ + + + +CG_DATATYPE_MACRO(Half,half,CG_HALF,CG_HALF,0,1,CG_PARAMETERCLASS_SCALAR) +CG_DATATYPE_MACRO(Half2,half2,CG_HALF2,CG_HALF,0,2,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Half3,half3,CG_HALF3,CG_HALF,0,3,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Half4,half4,CG_HALF4,CG_HALF,0,4,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Half1x1,half1x1,CG_HALF1x1,CG_HALF,1,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half1x2,half1x2,CG_HALF1x2,CG_HALF,1,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half1x3,half1x3,CG_HALF1x3,CG_HALF,1,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half1x4,half1x4,CG_HALF1x4,CG_HALF,1,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half2x1,half2x1,CG_HALF2x1,CG_HALF,2,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half2x2,half2x2,CG_HALF2x2,CG_HALF,2,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half2x3,half2x3,CG_HALF2x3,CG_HALF,2,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half2x4,half2x4,CG_HALF2x4,CG_HALF,2,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half3x1,half3x1,CG_HALF3x1,CG_HALF,3,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half3x2,half3x2,CG_HALF3x2,CG_HALF,3,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half3x3,half3x3,CG_HALF3x3,CG_HALF,3,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half3x4,half3x4,CG_HALF3x4,CG_HALF,3,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half4x1,half4x1,CG_HALF4x1,CG_HALF,4,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half4x2,half4x2,CG_HALF4x2,CG_HALF,4,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half4x3,half4x3,CG_HALF4x3,CG_HALF,4,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half4x4,half4x4,CG_HALF4x4,CG_HALF,4,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float,float,CG_FLOAT,CG_FLOAT,0,1,CG_PARAMETERCLASS_SCALAR) +CG_DATATYPE_MACRO(Float2,float2,CG_FLOAT2,CG_FLOAT,0,2,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Float3,float3,CG_FLOAT3,CG_FLOAT,0,3,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Float4,float4,CG_FLOAT4,CG_FLOAT,0,4,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Float1x1,float1x1,CG_FLOAT1x1,CG_FLOAT,1,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float1x2,float1x2,CG_FLOAT1x2,CG_FLOAT,1,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float1x3,float1x3,CG_FLOAT1x3,CG_FLOAT,1,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float1x4,float1x4,CG_FLOAT1x4,CG_FLOAT,1,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float2x1,float2x1,CG_FLOAT2x1,CG_FLOAT,2,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float2x2,float2x2,CG_FLOAT2x2,CG_FLOAT,2,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float2x3,float2x3,CG_FLOAT2x3,CG_FLOAT,2,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float2x4,float2x4,CG_FLOAT2x4,CG_FLOAT,2,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float3x1,float3x1,CG_FLOAT3x1,CG_FLOAT,3,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float3x2,float3x2,CG_FLOAT3x2,CG_FLOAT,3,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float3x3,float3x3,CG_FLOAT3x3,CG_FLOAT,3,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float3x4,float3x4,CG_FLOAT3x4,CG_FLOAT,3,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float4x1,float4x1,CG_FLOAT4x1,CG_FLOAT,4,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float4x2,float4x2,CG_FLOAT4x2,CG_FLOAT,4,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float4x3,float4x3,CG_FLOAT4x3,CG_FLOAT,4,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Float4x4,float4x4,CG_FLOAT4x4,CG_FLOAT,4,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Sampler1D,sampler1D,CG_SAMPLER1D,CG_SAMPLER1D,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(Sampler2D,sampler2D,CG_SAMPLER2D,CG_SAMPLER2D,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(Sampler3D,sampler3D,CG_SAMPLER3D,CG_SAMPLER3D,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(SamplerRECT,samplerRECT,CG_SAMPLERRECT,CG_SAMPLERRECT,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(SamplerCUBE,samplerCUBE,CG_SAMPLERCUBE,CG_SAMPLERCUBE,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(Fixed,fixed,CG_FIXED,CG_FIXED,0,1,CG_PARAMETERCLASS_SCALAR) +CG_DATATYPE_MACRO(Fixed2,fixed2,CG_FIXED2,CG_FIXED,0,2,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Fixed3,fixed3,CG_FIXED3,CG_FIXED,0,3,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Fixed4,fixed4,CG_FIXED4,CG_FIXED,0,4,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Fixed1x1,fixed1x1,CG_FIXED1x1,CG_FIXED,1,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed1x2,fixed1x2,CG_FIXED1x2,CG_FIXED,1,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed1x3,fixed1x3,CG_FIXED1x3,CG_FIXED,1,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed1x4,fixed1x4,CG_FIXED1x4,CG_FIXED,1,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed2x1,fixed2x1,CG_FIXED2x1,CG_FIXED,2,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed2x2,fixed2x2,CG_FIXED2x2,CG_FIXED,2,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed2x3,fixed2x3,CG_FIXED2x3,CG_FIXED,2,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed2x4,fixed2x4,CG_FIXED2x4,CG_FIXED,2,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed3x1,fixed3x1,CG_FIXED3x1,CG_FIXED,3,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed3x2,fixed3x2,CG_FIXED3x2,CG_FIXED,3,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed3x3,fixed3x3,CG_FIXED3x3,CG_FIXED,3,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed3x4,fixed3x4,CG_FIXED3x4,CG_FIXED,3,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed4x1,fixed4x1,CG_FIXED4x1,CG_FIXED,4,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed4x2,fixed4x2,CG_FIXED4x2,CG_FIXED,4,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed4x3,fixed4x3,CG_FIXED4x3,CG_FIXED,4,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Fixed4x4,fixed4x4,CG_FIXED4x4,CG_FIXED,4,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Half1,half1,CG_HALF1,CG_HALF,0,1,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Float1,float1,CG_FLOAT1,CG_FLOAT,0,1,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Fixed1,fixed1,CG_FIXED1,CG_FIXED,0,1,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Int,int,CG_INT,CG_INT,0,1,CG_PARAMETERCLASS_SCALAR) +CG_DATATYPE_MACRO(Int1,int1,CG_INT1,CG_INT,0,1,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Int2,int2,CG_INT2,CG_INT,0,2,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Int3,int3,CG_INT3,CG_INT,0,3,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Int4,int4,CG_INT4,CG_INT,0,4,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Int1x1,int1x1,CG_INT1x1,CG_INT,1,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int1x2,int1x2,CG_INT1x2,CG_INT,1,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int1x3,int1x3,CG_INT1x3,CG_INT,1,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int1x4,int1x4,CG_INT1x4,CG_INT,1,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int2x1,int2x1,CG_INT2x1,CG_INT,2,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int2x2,int2x2,CG_INT2x2,CG_INT,2,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int2x3,int2x3,CG_INT2x3,CG_INT,2,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int2x4,int2x4,CG_INT2x4,CG_INT,2,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int3x1,int3x1,CG_INT3x1,CG_INT,3,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int3x2,int3x2,CG_INT3x2,CG_INT,3,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int3x3,int3x3,CG_INT3x3,CG_INT,3,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int3x4,int3x4,CG_INT3x4,CG_INT,3,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int4x1,int4x1,CG_INT4x1,CG_INT,4,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int4x2,int4x2,CG_INT4x2,CG_INT,4,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int4x3,int4x3,CG_INT4x3,CG_INT,4,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Int4x4,int4x4,CG_INT4x4,CG_INT,4,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool,bool,CG_BOOL,CG_BOOL,0,1,CG_PARAMETERCLASS_SCALAR) +CG_DATATYPE_MACRO(Bool1,bool1,CG_BOOL1,CG_BOOL,0,1,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Bool2,bool2,CG_BOOL2,CG_BOOL,0,2,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Bool3,bool3,CG_BOOL3,CG_BOOL,0,3,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Bool4,bool4,CG_BOOL4,CG_BOOL,0,4,CG_PARAMETERCLASS_VECTOR) +CG_DATATYPE_MACRO(Bool1x1,bool1x1,CG_BOOL1x1,CG_BOOL,1,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool1x2,bool1x2,CG_BOOL1x2,CG_BOOL,1,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool1x3,bool1x3,CG_BOOL1x3,CG_BOOL,1,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool1x4,bool1x4,CG_BOOL1x4,CG_BOOL,1,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool2x1,bool2x1,CG_BOOL2x1,CG_BOOL,2,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool2x2,bool2x2,CG_BOOL2x2,CG_BOOL,2,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool2x3,bool2x3,CG_BOOL2x3,CG_BOOL,2,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool2x4,bool2x4,CG_BOOL2x4,CG_BOOL,2,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool3x1,bool3x1,CG_BOOL3x1,CG_BOOL,3,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool3x2,bool3x2,CG_BOOL3x2,CG_BOOL,3,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool3x3,bool3x3,CG_BOOL3x3,CG_BOOL,3,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool3x4,bool3x4,CG_BOOL3x4,CG_BOOL,3,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool4x1,bool4x1,CG_BOOL4x1,CG_BOOL,4,1,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool4x2,bool4x2,CG_BOOL4x2,CG_BOOL,4,2,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool4x3,bool4x3,CG_BOOL4x3,CG_BOOL,4,3,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(Bool4x4,bool4x4,CG_BOOL4x4,CG_BOOL,4,4,CG_PARAMETERCLASS_MATRIX) +CG_DATATYPE_MACRO(String,string,CG_STRING,CG_STRING,0,1,CG_PARAMETERCLASS_OBJECT) +CG_DATATYPE_MACRO(Program,program,CG_PROGRAM_TYPE,CG_PROGRAM_TYPE,0,0,CG_PARAMETERCLASS_OBJECT) +CG_DATATYPE_MACRO(Texture,texture,CG_TEXTURE,CG_TEXTURE,0,0,CG_PARAMETERCLASS_OBJECT) +CG_DATATYPE_MACRO(Sampler1DARRAY,sampler1DARRAY,CG_SAMPLER1DARRAY,CG_SAMPLER1DARRAY,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(Sampler2DARRAY,sampler2DARRAY,CG_SAMPLER2DARRAY,CG_SAMPLER2DARRAY,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(SamplerCUBEARRAY,samplerCUBEARRAY,CG_SAMPLERCUBEARRAY,CG_SAMPLERCUBEARRAY,0,0,CG_PARAMETERCLASS_SAMPLER) +CG_DATATYPE_MACRO(VertexShader, vertexshader, CG_VERTEXSHADER_TYPE, CG_VERTEXSHADER_TYPE, 0, 0, CG_PARAMETERCLASS_OBJECT) +CG_DATATYPE_MACRO(PixelShader, pixelshader, CG_PIXELSHADER_TYPE, CG_PIXELSHADER_TYPE, 0, 0, CG_PARAMETERCLASS_OBJECT) +CG_DATATYPE_MACRO(Sampler, sampler, CG_SAMPLER, CG_SAMPLER, 0, 0, CG_PARAMETERCLASS_SAMPLER) +#undef CG_DATATYPE_MACRO diff --git a/Externals/Cg/cg_enums.h b/Externals/Cg/cg_enums.h index 07cfd837a6..9585f9d73d 100644 --- a/Externals/Cg/cg_enums.h +++ b/Externals/Cg/cg_enums.h @@ -1,112 +1,112 @@ - -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/* - * The following macro invocations define the supported CG basic data types. - * - * The macros have the form : - * - * CG_ENUM_MACRO(enum_name, enum_val) - * - * enum_name : The C enumerant name. - * enum_val : The enumerant value. - * - */ - - - -CG_ENUM_MACRO(CG_UNKNOWN, 4096) -CG_ENUM_MACRO(CG_IN, 4097) -CG_ENUM_MACRO(CG_OUT, 4098) -CG_ENUM_MACRO(CG_INOUT, 4099) -CG_ENUM_MACRO(CG_MIXED, 4100) -CG_ENUM_MACRO(CG_VARYING, 4101) -CG_ENUM_MACRO(CG_UNIFORM, 4102) -CG_ENUM_MACRO(CG_CONSTANT, 4103) -CG_ENUM_MACRO(CG_PROGRAM_SOURCE, 4104) -CG_ENUM_MACRO(CG_PROGRAM_ENTRY, 4105) -CG_ENUM_MACRO(CG_COMPILED_PROGRAM, 4106) -CG_ENUM_MACRO(CG_PROGRAM_PROFILE, 4107) -CG_ENUM_MACRO(CG_GLOBAL, 4108) -CG_ENUM_MACRO(CG_PROGRAM, 4109) -CG_ENUM_MACRO(CG_DEFAULT, 4110) -CG_ENUM_MACRO(CG_ERROR, 4111) -CG_ENUM_MACRO(CG_SOURCE, 4112) -CG_ENUM_MACRO(CG_OBJECT, 4113) -CG_ENUM_MACRO(CG_COMPILE_MANUAL, 4114) -CG_ENUM_MACRO(CG_COMPILE_IMMEDIATE, 4115) -CG_ENUM_MACRO(CG_COMPILE_LAZY, 4116) -CG_ENUM_MACRO(CG_CURRENT, 4117) -CG_ENUM_MACRO(CG_LITERAL, 4118) -CG_ENUM_MACRO(CG_VERSION, 4119) -CG_ENUM_MACRO(CG_ROW_MAJOR, 4120) -CG_ENUM_MACRO(CG_COLUMN_MAJOR, 4121) -CG_ENUM_MACRO(CG_FRAGMENT, 4122) -CG_ENUM_MACRO(CG_VERTEX, 4123) -CG_ENUM_MACRO(CG_POINT, 4124) -CG_ENUM_MACRO(CG_LINE, 4125) -CG_ENUM_MACRO(CG_LINE_ADJ, 4126) -CG_ENUM_MACRO(CG_TRIANGLE, 4127) -CG_ENUM_MACRO(CG_TRIANGLE_ADJ, 4128) -CG_ENUM_MACRO(CG_POINT_OUT, 4129) -CG_ENUM_MACRO(CG_LINE_OUT, 4130) -CG_ENUM_MACRO(CG_TRIANGLE_OUT, 4131) -CG_ENUM_MACRO(CG_IMMEDIATE_PARAMETER_SETTING, 4132) -CG_ENUM_MACRO(CG_DEFERRED_PARAMETER_SETTING, 4133) -CG_ENUM_MACRO(CG_NO_LOCKS_POLICY, 4134) -CG_ENUM_MACRO(CG_THREAD_SAFE_POLICY, 4135) -CG_ENUM_MACRO(CG_FORCE_UPPER_CASE_POLICY, 4136) -CG_ENUM_MACRO(CG_UNCHANGED_CASE_POLICY, 4137) -#undef CG_ENUM_MACRO - - + +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * The following macro invocations define the supported CG basic data types. + * + * The macros have the form : + * + * CG_ENUM_MACRO(enum_name, enum_val) + * + * enum_name : The C enumerant name. + * enum_val : The enumerant value. + * + */ + + + +CG_ENUM_MACRO(CG_UNKNOWN, 4096) +CG_ENUM_MACRO(CG_IN, 4097) +CG_ENUM_MACRO(CG_OUT, 4098) +CG_ENUM_MACRO(CG_INOUT, 4099) +CG_ENUM_MACRO(CG_MIXED, 4100) +CG_ENUM_MACRO(CG_VARYING, 4101) +CG_ENUM_MACRO(CG_UNIFORM, 4102) +CG_ENUM_MACRO(CG_CONSTANT, 4103) +CG_ENUM_MACRO(CG_PROGRAM_SOURCE, 4104) +CG_ENUM_MACRO(CG_PROGRAM_ENTRY, 4105) +CG_ENUM_MACRO(CG_COMPILED_PROGRAM, 4106) +CG_ENUM_MACRO(CG_PROGRAM_PROFILE, 4107) +CG_ENUM_MACRO(CG_GLOBAL, 4108) +CG_ENUM_MACRO(CG_PROGRAM, 4109) +CG_ENUM_MACRO(CG_DEFAULT, 4110) +CG_ENUM_MACRO(CG_ERROR, 4111) +CG_ENUM_MACRO(CG_SOURCE, 4112) +CG_ENUM_MACRO(CG_OBJECT, 4113) +CG_ENUM_MACRO(CG_COMPILE_MANUAL, 4114) +CG_ENUM_MACRO(CG_COMPILE_IMMEDIATE, 4115) +CG_ENUM_MACRO(CG_COMPILE_LAZY, 4116) +CG_ENUM_MACRO(CG_CURRENT, 4117) +CG_ENUM_MACRO(CG_LITERAL, 4118) +CG_ENUM_MACRO(CG_VERSION, 4119) +CG_ENUM_MACRO(CG_ROW_MAJOR, 4120) +CG_ENUM_MACRO(CG_COLUMN_MAJOR, 4121) +CG_ENUM_MACRO(CG_FRAGMENT, 4122) +CG_ENUM_MACRO(CG_VERTEX, 4123) +CG_ENUM_MACRO(CG_POINT, 4124) +CG_ENUM_MACRO(CG_LINE, 4125) +CG_ENUM_MACRO(CG_LINE_ADJ, 4126) +CG_ENUM_MACRO(CG_TRIANGLE, 4127) +CG_ENUM_MACRO(CG_TRIANGLE_ADJ, 4128) +CG_ENUM_MACRO(CG_POINT_OUT, 4129) +CG_ENUM_MACRO(CG_LINE_OUT, 4130) +CG_ENUM_MACRO(CG_TRIANGLE_OUT, 4131) +CG_ENUM_MACRO(CG_IMMEDIATE_PARAMETER_SETTING, 4132) +CG_ENUM_MACRO(CG_DEFERRED_PARAMETER_SETTING, 4133) +CG_ENUM_MACRO(CG_NO_LOCKS_POLICY, 4134) +CG_ENUM_MACRO(CG_THREAD_SAFE_POLICY, 4135) +CG_ENUM_MACRO(CG_FORCE_UPPER_CASE_POLICY, 4136) +CG_ENUM_MACRO(CG_UNCHANGED_CASE_POLICY, 4137) +#undef CG_ENUM_MACRO + + diff --git a/Externals/Cg/cg_errors.h b/Externals/Cg/cg_errors.h index 73731e16f6..8f5fe67ef6 100644 --- a/Externals/Cg/cg_errors.h +++ b/Externals/Cg/cg_errors.h @@ -1,320 +1,320 @@ -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * The following macro invocations define error codes returned by various cg - * API functions. - * - * The macros have the form : - * - * CG_ERROR_MACRO(code, enum_name, message) - * - * code : The integer error code associated with the error. - * enum_name : The name of enumerant of the error code in the API. - * message : A description string associated with the error. - * - */ - - -CG_ERROR_MACRO(0, - CG_NO_ERROR, - "No error has occurred.") - -CG_ERROR_MACRO(1, - CG_COMPILER_ERROR, - "The compile returned an error.") - -CG_ERROR_MACRO(2, - CG_INVALID_PARAMETER_ERROR, - "The parameter used is invalid.") - -CG_ERROR_MACRO(3, - CG_INVALID_PROFILE_ERROR, - "The profile is not supported.") - -CG_ERROR_MACRO(4, - CG_PROGRAM_LOAD_ERROR, - "The program could not load.") - -CG_ERROR_MACRO(5, - CG_PROGRAM_BIND_ERROR, - "The program could not bind.") - -CG_ERROR_MACRO(6, - CG_PROGRAM_NOT_LOADED_ERROR, - "The program must be loaded before this operation may be used.") - -CG_ERROR_MACRO(7, - CG_UNSUPPORTED_GL_EXTENSION_ERROR, - "An unsupported GL extension was required to perform this operation.") - -CG_ERROR_MACRO(8, - CG_INVALID_VALUE_TYPE_ERROR, - "An unknown value type was assigned to a parameter.") - -CG_ERROR_MACRO(9, - CG_NOT_MATRIX_PARAM_ERROR, - "The parameter is not of matrix type.") - -CG_ERROR_MACRO(10, - CG_INVALID_ENUMERANT_ERROR, - "The enumerant parameter has an invalid value.") - -CG_ERROR_MACRO(11, - CG_NOT_4x4_MATRIX_ERROR, - "The parameter must be a 4x4 matrix type.") - -CG_ERROR_MACRO(12, - CG_FILE_READ_ERROR, - "The file could not be read.") - -CG_ERROR_MACRO(13, - CG_FILE_WRITE_ERROR, - "The file could not be written.") - -CG_ERROR_MACRO(14, - CG_NVPARSE_ERROR, - "nvparse could not successfully parse the output from the Cg " - "compiler backend.") - -CG_ERROR_MACRO(15, - CG_MEMORY_ALLOC_ERROR, - "Memory allocation failed.") - -CG_ERROR_MACRO(16, - CG_INVALID_CONTEXT_HANDLE_ERROR, - "Invalid context handle.") - -CG_ERROR_MACRO(17, - CG_INVALID_PROGRAM_HANDLE_ERROR, - "Invalid program handle.") - -CG_ERROR_MACRO(18, - CG_INVALID_PARAM_HANDLE_ERROR, - "Invalid parameter handle.") - -CG_ERROR_MACRO(19, - CG_UNKNOWN_PROFILE_ERROR, - "The specified profile is unknown.") - -CG_ERROR_MACRO(20, - CG_VAR_ARG_ERROR, - "The variable arguments were specified incorrectly.") - -CG_ERROR_MACRO(21, - CG_INVALID_DIMENSION_ERROR, - "The dimension value is invalid.") - -CG_ERROR_MACRO(22, - CG_ARRAY_PARAM_ERROR, - "The parameter must be an array.") - -CG_ERROR_MACRO(23, - CG_OUT_OF_ARRAY_BOUNDS_ERROR, - "Index into the array is out of bounds.") - -CG_ERROR_MACRO(24, - CG_CONFLICTING_TYPES_ERROR, - "A type being added to the context conflicts with an " - "existing type.") - -CG_ERROR_MACRO(25, - CG_CONFLICTING_PARAMETER_TYPES_ERROR, - "The parameters being bound have conflicting types.") - -CG_ERROR_MACRO(26, - CG_PARAMETER_IS_NOT_SHARED_ERROR, - "The parameter must be global.") - -CG_ERROR_MACRO(27, - CG_INVALID_PARAMETER_VARIABILITY_ERROR, - "The parameter could not be changed to the given variability.") - -CG_ERROR_MACRO(28, - CG_CANNOT_DESTROY_PARAMETER_ERROR, - "Cannot destroy the parameter. It is bound to other parameters " - "or is not a root parameter.") - - -CG_ERROR_MACRO(29, - CG_NOT_ROOT_PARAMETER_ERROR, - "The parameter is not a root parameter.") - -CG_ERROR_MACRO(30, - CG_PARAMETERS_DO_NOT_MATCH_ERROR, - "The two parameters being bound do not match.") - -CG_ERROR_MACRO(31, - CG_IS_NOT_PROGRAM_PARAMETER_ERROR, - "The parameter is not a program parameter.") - -CG_ERROR_MACRO(32, - CG_INVALID_PARAMETER_TYPE_ERROR, - "The type of the parameter is invalid.") - -CG_ERROR_MACRO(33, - CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR, - "The parameter must be a resizable array.") - -CG_ERROR_MACRO(34, - CG_INVALID_SIZE_ERROR, - "The size value is invalid.") - -CG_ERROR_MACRO(35, - CG_BIND_CREATES_CYCLE_ERROR, - "Cannot bind the given parameters. Binding will form a cycle.") - -CG_ERROR_MACRO(36, - CG_ARRAY_TYPES_DO_NOT_MATCH_ERROR, - "Cannot bind the given parameters. Array types do not match.") - -CG_ERROR_MACRO(37, - CG_ARRAY_DIMENSIONS_DO_NOT_MATCH_ERROR, - "Cannot bind the given parameters. " - "Array dimensions do not match.") - -CG_ERROR_MACRO(38, - CG_ARRAY_HAS_WRONG_DIMENSION_ERROR, - "The array has the wrong dimension.") - -CG_ERROR_MACRO(39, - CG_TYPE_IS_NOT_DEFINED_IN_PROGRAM_ERROR, - "Connecting the parameters failed because The type of the " - "source parameter is not defined within the given program " - "or does not match the type with the same name in the program.") - -CG_ERROR_MACRO(40, - CG_INVALID_EFFECT_HANDLE_ERROR, - "Invalid effect handle.") - -CG_ERROR_MACRO(41, - CG_INVALID_STATE_HANDLE_ERROR, - "Invalid state handle.") - -CG_ERROR_MACRO(42, - CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR, - "Invalid stateassignment handle.") - -CG_ERROR_MACRO(43, - CG_INVALID_PASS_HANDLE_ERROR, - "Invalid pass handle.") - -CG_ERROR_MACRO(44, - CG_INVALID_ANNOTATION_HANDLE_ERROR, - "Invalid annotation handle.") - -CG_ERROR_MACRO(45, - CG_INVALID_TECHNIQUE_HANDLE_ERROR, - "Invalid technique handle.") - -// Do not use this! Use CG_INVALID_PARAM_HANDLE_ERROR instead. -CG_ERROR_MACRO(46, - CG_INVALID_PARAMETER_HANDLE_ERROR, - "Invalid parameter handle.") - -CG_ERROR_MACRO(47, - CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR, - "Operation is not valid for this type of stateassignment.") - -CG_ERROR_MACRO(48, - CG_INVALID_FUNCTION_HANDLE_ERROR, - "Invalid function handle.") - -CG_ERROR_MACRO(49, - CG_INVALID_TECHNIQUE_ERROR, - "Technique did not pass validation.") - -CG_ERROR_MACRO(50, - CG_INVALID_POINTER_ERROR, - "The supplied pointer is NULL.") - -CG_ERROR_MACRO(51, - CG_NOT_ENOUGH_DATA_ERROR, - "Not enough data was provided.") - -CG_ERROR_MACRO(52, - CG_NON_NUMERIC_PARAMETER_ERROR, - "The parameter is not of a numeric type.") - -CG_ERROR_MACRO(53, - CG_ARRAY_SIZE_MISMATCH_ERROR, - "The specified array sizes are not compatible with the given array.") - -CG_ERROR_MACRO(54, - CG_CANNOT_SET_NON_UNIFORM_PARAMETER_ERROR, - "Cannot set the value of a non-uniform parameter.") - -CG_ERROR_MACRO(55, - CG_DUPLICATE_NAME_ERROR, - "This name is already in use.") - -CG_ERROR_MACRO(56, - CG_INVALID_OBJ_HANDLE_ERROR, - "Invalid object handle.") - -CG_ERROR_MACRO(57, - CG_INVALID_BUFFER_HANDLE_ERROR, - "Invalid buffer handle.") - -CG_ERROR_MACRO(58, - CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR, - "Buffer index is out of bounds.") - -CG_ERROR_MACRO(59, - CG_BUFFER_ALREADY_MAPPED_ERROR, - "The buffer is already mapped.") - -CG_ERROR_MACRO(60, - CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR, - "The buffer cannot be updated.") - -#undef CG_ERROR_MACRO - +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * The following macro invocations define error codes returned by various cg + * API functions. + * + * The macros have the form : + * + * CG_ERROR_MACRO(code, enum_name, message) + * + * code : The integer error code associated with the error. + * enum_name : The name of enumerant of the error code in the API. + * message : A description string associated with the error. + * + */ + + +CG_ERROR_MACRO(0, + CG_NO_ERROR, + "No error has occurred.") + +CG_ERROR_MACRO(1, + CG_COMPILER_ERROR, + "The compile returned an error.") + +CG_ERROR_MACRO(2, + CG_INVALID_PARAMETER_ERROR, + "The parameter used is invalid.") + +CG_ERROR_MACRO(3, + CG_INVALID_PROFILE_ERROR, + "The profile is not supported.") + +CG_ERROR_MACRO(4, + CG_PROGRAM_LOAD_ERROR, + "The program could not load.") + +CG_ERROR_MACRO(5, + CG_PROGRAM_BIND_ERROR, + "The program could not bind.") + +CG_ERROR_MACRO(6, + CG_PROGRAM_NOT_LOADED_ERROR, + "The program must be loaded before this operation may be used.") + +CG_ERROR_MACRO(7, + CG_UNSUPPORTED_GL_EXTENSION_ERROR, + "An unsupported GL extension was required to perform this operation.") + +CG_ERROR_MACRO(8, + CG_INVALID_VALUE_TYPE_ERROR, + "An unknown value type was assigned to a parameter.") + +CG_ERROR_MACRO(9, + CG_NOT_MATRIX_PARAM_ERROR, + "The parameter is not of matrix type.") + +CG_ERROR_MACRO(10, + CG_INVALID_ENUMERANT_ERROR, + "The enumerant parameter has an invalid value.") + +CG_ERROR_MACRO(11, + CG_NOT_4x4_MATRIX_ERROR, + "The parameter must be a 4x4 matrix type.") + +CG_ERROR_MACRO(12, + CG_FILE_READ_ERROR, + "The file could not be read.") + +CG_ERROR_MACRO(13, + CG_FILE_WRITE_ERROR, + "The file could not be written.") + +CG_ERROR_MACRO(14, + CG_NVPARSE_ERROR, + "nvparse could not successfully parse the output from the Cg " + "compiler backend.") + +CG_ERROR_MACRO(15, + CG_MEMORY_ALLOC_ERROR, + "Memory allocation failed.") + +CG_ERROR_MACRO(16, + CG_INVALID_CONTEXT_HANDLE_ERROR, + "Invalid context handle.") + +CG_ERROR_MACRO(17, + CG_INVALID_PROGRAM_HANDLE_ERROR, + "Invalid program handle.") + +CG_ERROR_MACRO(18, + CG_INVALID_PARAM_HANDLE_ERROR, + "Invalid parameter handle.") + +CG_ERROR_MACRO(19, + CG_UNKNOWN_PROFILE_ERROR, + "The specified profile is unknown.") + +CG_ERROR_MACRO(20, + CG_VAR_ARG_ERROR, + "The variable arguments were specified incorrectly.") + +CG_ERROR_MACRO(21, + CG_INVALID_DIMENSION_ERROR, + "The dimension value is invalid.") + +CG_ERROR_MACRO(22, + CG_ARRAY_PARAM_ERROR, + "The parameter must be an array.") + +CG_ERROR_MACRO(23, + CG_OUT_OF_ARRAY_BOUNDS_ERROR, + "Index into the array is out of bounds.") + +CG_ERROR_MACRO(24, + CG_CONFLICTING_TYPES_ERROR, + "A type being added to the context conflicts with an " + "existing type.") + +CG_ERROR_MACRO(25, + CG_CONFLICTING_PARAMETER_TYPES_ERROR, + "The parameters being bound have conflicting types.") + +CG_ERROR_MACRO(26, + CG_PARAMETER_IS_NOT_SHARED_ERROR, + "The parameter must be global.") + +CG_ERROR_MACRO(27, + CG_INVALID_PARAMETER_VARIABILITY_ERROR, + "The parameter could not be changed to the given variability.") + +CG_ERROR_MACRO(28, + CG_CANNOT_DESTROY_PARAMETER_ERROR, + "Cannot destroy the parameter. It is bound to other parameters " + "or is not a root parameter.") + + +CG_ERROR_MACRO(29, + CG_NOT_ROOT_PARAMETER_ERROR, + "The parameter is not a root parameter.") + +CG_ERROR_MACRO(30, + CG_PARAMETERS_DO_NOT_MATCH_ERROR, + "The two parameters being bound do not match.") + +CG_ERROR_MACRO(31, + CG_IS_NOT_PROGRAM_PARAMETER_ERROR, + "The parameter is not a program parameter.") + +CG_ERROR_MACRO(32, + CG_INVALID_PARAMETER_TYPE_ERROR, + "The type of the parameter is invalid.") + +CG_ERROR_MACRO(33, + CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR, + "The parameter must be a resizable array.") + +CG_ERROR_MACRO(34, + CG_INVALID_SIZE_ERROR, + "The size value is invalid.") + +CG_ERROR_MACRO(35, + CG_BIND_CREATES_CYCLE_ERROR, + "Cannot bind the given parameters. Binding will form a cycle.") + +CG_ERROR_MACRO(36, + CG_ARRAY_TYPES_DO_NOT_MATCH_ERROR, + "Cannot bind the given parameters. Array types do not match.") + +CG_ERROR_MACRO(37, + CG_ARRAY_DIMENSIONS_DO_NOT_MATCH_ERROR, + "Cannot bind the given parameters. " + "Array dimensions do not match.") + +CG_ERROR_MACRO(38, + CG_ARRAY_HAS_WRONG_DIMENSION_ERROR, + "The array has the wrong dimension.") + +CG_ERROR_MACRO(39, + CG_TYPE_IS_NOT_DEFINED_IN_PROGRAM_ERROR, + "Connecting the parameters failed because The type of the " + "source parameter is not defined within the given program " + "or does not match the type with the same name in the program.") + +CG_ERROR_MACRO(40, + CG_INVALID_EFFECT_HANDLE_ERROR, + "Invalid effect handle.") + +CG_ERROR_MACRO(41, + CG_INVALID_STATE_HANDLE_ERROR, + "Invalid state handle.") + +CG_ERROR_MACRO(42, + CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR, + "Invalid stateassignment handle.") + +CG_ERROR_MACRO(43, + CG_INVALID_PASS_HANDLE_ERROR, + "Invalid pass handle.") + +CG_ERROR_MACRO(44, + CG_INVALID_ANNOTATION_HANDLE_ERROR, + "Invalid annotation handle.") + +CG_ERROR_MACRO(45, + CG_INVALID_TECHNIQUE_HANDLE_ERROR, + "Invalid technique handle.") + +// Do not use this! Use CG_INVALID_PARAM_HANDLE_ERROR instead. +CG_ERROR_MACRO(46, + CG_INVALID_PARAMETER_HANDLE_ERROR, + "Invalid parameter handle.") + +CG_ERROR_MACRO(47, + CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR, + "Operation is not valid for this type of stateassignment.") + +CG_ERROR_MACRO(48, + CG_INVALID_FUNCTION_HANDLE_ERROR, + "Invalid function handle.") + +CG_ERROR_MACRO(49, + CG_INVALID_TECHNIQUE_ERROR, + "Technique did not pass validation.") + +CG_ERROR_MACRO(50, + CG_INVALID_POINTER_ERROR, + "The supplied pointer is NULL.") + +CG_ERROR_MACRO(51, + CG_NOT_ENOUGH_DATA_ERROR, + "Not enough data was provided.") + +CG_ERROR_MACRO(52, + CG_NON_NUMERIC_PARAMETER_ERROR, + "The parameter is not of a numeric type.") + +CG_ERROR_MACRO(53, + CG_ARRAY_SIZE_MISMATCH_ERROR, + "The specified array sizes are not compatible with the given array.") + +CG_ERROR_MACRO(54, + CG_CANNOT_SET_NON_UNIFORM_PARAMETER_ERROR, + "Cannot set the value of a non-uniform parameter.") + +CG_ERROR_MACRO(55, + CG_DUPLICATE_NAME_ERROR, + "This name is already in use.") + +CG_ERROR_MACRO(56, + CG_INVALID_OBJ_HANDLE_ERROR, + "Invalid object handle.") + +CG_ERROR_MACRO(57, + CG_INVALID_BUFFER_HANDLE_ERROR, + "Invalid buffer handle.") + +CG_ERROR_MACRO(58, + CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR, + "Buffer index is out of bounds.") + +CG_ERROR_MACRO(59, + CG_BUFFER_ALREADY_MAPPED_ERROR, + "The buffer is already mapped.") + +CG_ERROR_MACRO(60, + CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR, + "The buffer cannot be updated.") + +#undef CG_ERROR_MACRO + diff --git a/Externals/Cg/cg_profiles.h b/Externals/Cg/cg_profiles.h index 6b995f6e50..bdf41fe260 100644 --- a/Externals/Cg/cg_profiles.h +++ b/Externals/Cg/cg_profiles.h @@ -1,95 +1,95 @@ -/* - * - * Copyright (c) 2002-2007, NVIDIA Corporation. - * - * - * - * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration - * of your agreement to the following terms, and your use, installation, - * modification or redistribution of this NVIDIA software constitutes - * acceptance of these terms. If you do not agree with these terms, please do - * not use, install, modify or redistribute this NVIDIA software. - * - * - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, NVIDIA grants you a personal, non-exclusive license, - * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA - * Software"), to use, reproduce, modify and redistribute the NVIDIA - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the NVIDIA Software, you must retain the - * copyright notice of NVIDIA, this notice and the following text and - * disclaimers in all such redistributions of the NVIDIA Software. Neither the - * name, trademarks, service marks nor logos of NVIDIA Corporation may be used - * to endorse or promote products derived from the NVIDIA Software without - * specific prior written permission from NVIDIA. Except as expressly stated - * in this notice, no other rights or licenses express or implied, are granted - * by NVIDIA herein, including but not limited to any patent rights that may be - * infringed by your derivative works or by other works in which the NVIDIA - * Software may be incorporated. No hardware is licensed hereunder. - * - * - * - * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING - * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION - * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. - * - * - * - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST - * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, - * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, - * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING - * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * The following macro invocations define the supported CG profiles. - * - * The macros have the form : - * - * CG_PROFILE_MACRO(name, compiler_id, compiler_opt) - * - * name : The name of the profile. Used consistently with the API. - * compiler_id : The identifier string for the profile used by the compiler. - * compiler_id_caps : compiler_id in caps. - * compiler_opt : The command-line switch used to force compilation into - * the profile. - * int_id : Integer enumerant associated with this bind location. - * vertex_profile : Non-zero if this is a vertex profile, otherwise it - * is considered to be a fragment profile. - * - * - */ - -#define CG_IN_PROFILES_INCLUDE - -#include - - -CG_PROFILE_MACRO(DX9Vertex11,vs_1_1,VS_1_1,"vs_1_1",6153,1) -CG_PROFILE_MACRO(DX9Vertex20,vs_2_0,VS_2_0,"vs_2_0",6154,1) -CG_PROFILE_MACRO(DX9Vertex2x,vs_2_x,VS_2_X,"vs_2_x",6155,1) -CG_PROFILE_MACRO(DX9Vertex2sw,vs_2_sw,VS_2_SW,"vs_2_sw",6156,1) -CG_PROFILE_MACRO(DX9Vertex30,vs_3_0,VS_3_0,"vs_3_0",6157,1) -CG_PROFILE_MACRO(DX9VertexHLSL,hlslv, HLSLV,"hlslv",6158,1) - -CG_PROFILE_MACRO(DX9Pixel11,ps_1_1,PS_1_1,"ps_1_1",6159,0) -CG_PROFILE_MACRO(DX9Pixel12,ps_1_2,PS_1_2,"ps_1_2",6160,0) -CG_PROFILE_MACRO(DX9Pixel13,ps_1_3,PS_1_3,"ps_1_3",6161,0) -CG_PROFILE_MACRO(DX9Pixel20,ps_2_0,PS_2_0,"ps_2_0",6162,0) -CG_PROFILE_MACRO(DX9Pixel2x,ps_2_x,PS_2_X,"ps_2_x",6163,0) -CG_PROFILE_MACRO(DX9Pixel2sw,ps_2_sw,PS_2_SW,"ps_2_sw",6164,0) -CG_PROFILE_MACRO(DX9Pixel30,ps_3_0,PS_3_0,"ps_3_0",6165,0) -CG_PROFILE_MACRO(DX9PixelHLSL,hlslf,HLSLF,"hlslf",6166,0) - -CG_PROFILE_MACRO(Generic, generic, GENERIC, "generic", 7002,0) - -#undef CG_PROFILE_MACRO -#undef CG_IN_PROFILES_INCLUDE +/* + * + * Copyright (c) 2002-2007, NVIDIA Corporation. + * + * + * + * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration + * of your agreement to the following terms, and your use, installation, + * modification or redistribution of this NVIDIA software constitutes + * acceptance of these terms. If you do not agree with these terms, please do + * not use, install, modify or redistribute this NVIDIA software. + * + * + * + * In consideration of your agreement to abide by the following terms, and + * subject to these terms, NVIDIA grants you a personal, non-exclusive license, + * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA + * Software"), to use, reproduce, modify and redistribute the NVIDIA + * Software, with or without modifications, in source and/or binary forms; + * provided that if you redistribute the NVIDIA Software, you must retain the + * copyright notice of NVIDIA, this notice and the following text and + * disclaimers in all such redistributions of the NVIDIA Software. Neither the + * name, trademarks, service marks nor logos of NVIDIA Corporation may be used + * to endorse or promote products derived from the NVIDIA Software without + * specific prior written permission from NVIDIA. Except as expressly stated + * in this notice, no other rights or licenses express or implied, are granted + * by NVIDIA herein, including but not limited to any patent rights that may be + * infringed by your derivative works or by other works in which the NVIDIA + * Software may be incorporated. No hardware is licensed hereunder. + * + * + * + * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING + * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION + * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. + * + * + * + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST + * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE, + * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, + * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING + * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * The following macro invocations define the supported CG profiles. + * + * The macros have the form : + * + * CG_PROFILE_MACRO(name, compiler_id, compiler_opt) + * + * name : The name of the profile. Used consistently with the API. + * compiler_id : The identifier string for the profile used by the compiler. + * compiler_id_caps : compiler_id in caps. + * compiler_opt : The command-line switch used to force compilation into + * the profile. + * int_id : Integer enumerant associated with this bind location. + * vertex_profile : Non-zero if this is a vertex profile, otherwise it + * is considered to be a fragment profile. + * + * + */ + +#define CG_IN_PROFILES_INCLUDE + +#include + + +CG_PROFILE_MACRO(DX9Vertex11,vs_1_1,VS_1_1,"vs_1_1",6153,1) +CG_PROFILE_MACRO(DX9Vertex20,vs_2_0,VS_2_0,"vs_2_0",6154,1) +CG_PROFILE_MACRO(DX9Vertex2x,vs_2_x,VS_2_X,"vs_2_x",6155,1) +CG_PROFILE_MACRO(DX9Vertex2sw,vs_2_sw,VS_2_SW,"vs_2_sw",6156,1) +CG_PROFILE_MACRO(DX9Vertex30,vs_3_0,VS_3_0,"vs_3_0",6157,1) +CG_PROFILE_MACRO(DX9VertexHLSL,hlslv, HLSLV,"hlslv",6158,1) + +CG_PROFILE_MACRO(DX9Pixel11,ps_1_1,PS_1_1,"ps_1_1",6159,0) +CG_PROFILE_MACRO(DX9Pixel12,ps_1_2,PS_1_2,"ps_1_2",6160,0) +CG_PROFILE_MACRO(DX9Pixel13,ps_1_3,PS_1_3,"ps_1_3",6161,0) +CG_PROFILE_MACRO(DX9Pixel20,ps_2_0,PS_2_0,"ps_2_0",6162,0) +CG_PROFILE_MACRO(DX9Pixel2x,ps_2_x,PS_2_X,"ps_2_x",6163,0) +CG_PROFILE_MACRO(DX9Pixel2sw,ps_2_sw,PS_2_SW,"ps_2_sw",6164,0) +CG_PROFILE_MACRO(DX9Pixel30,ps_3_0,PS_3_0,"ps_3_0",6165,0) +CG_PROFILE_MACRO(DX9PixelHLSL,hlslf,HLSLF,"hlslf",6166,0) + +CG_PROFILE_MACRO(Generic, generic, GENERIC, "generic", 7002,0) + +#undef CG_PROFILE_MACRO +#undef CG_IN_PROFILES_INCLUDE diff --git a/Externals/GLew/fgl.h b/Externals/GLew/fgl.h index 64f981e6ec..d98ba1d299 100644 --- a/Externals/GLew/fgl.h +++ b/Externals/GLew/fgl.h @@ -1,1707 +1,1707 @@ - -C GLUT version of "GL/fgl.h" - -C Modifications from SGI IRIX 5.3 version: -C 1) F prefix removed from OpenGL constants. -C 2) Constants over 32 characters truncated to 32 characters. - -C *********************************************************** - -C AttribMask - integer*4 GL_CURRENT_BIT - parameter ( GL_CURRENT_BIT = 1 ) - integer*4 GL_POINT_BIT - parameter ( GL_POINT_BIT = 2 ) - integer*4 GL_LINE_BIT - parameter ( GL_LINE_BIT = 4 ) - integer*4 GL_POLYGON_BIT - parameter ( GL_POLYGON_BIT = 8 ) - integer*4 GL_POLYGON_STIPPLE_BIT - parameter ( GL_POLYGON_STIPPLE_BIT = 16 ) - integer*4 GL_PIXEL_MODE_BIT - parameter ( GL_PIXEL_MODE_BIT = 32 ) - integer*4 GL_LIGHTING_BIT - parameter ( GL_LIGHTING_BIT = 64 ) - integer*4 GL_FOG_BIT - parameter ( GL_FOG_BIT = 128 ) - integer*4 GL_DEPTH_BUFFER_BIT - parameter ( GL_DEPTH_BUFFER_BIT = 256 ) - integer*4 GL_ACCUM_BUFFER_BIT - parameter ( GL_ACCUM_BUFFER_BIT = 512 ) - integer*4 GL_STENCIL_BUFFER_BIT - parameter ( GL_STENCIL_BUFFER_BIT = 1024 ) - integer*4 GL_VIEWPORT_BIT - parameter ( GL_VIEWPORT_BIT = 2048 ) - integer*4 GL_TRANSFORM_BIT - parameter ( GL_TRANSFORM_BIT = 4096 ) - integer*4 GL_ENABLE_BIT - parameter ( GL_ENABLE_BIT = 8192 ) - integer*4 GL_COLOR_BUFFER_BIT - parameter ( GL_COLOR_BUFFER_BIT = 16384 ) - integer*4 GL_HINT_BIT - parameter ( GL_HINT_BIT = 32768 ) - integer*4 GL_EVAL_BIT - parameter ( GL_EVAL_BIT = 65536 ) - integer*4 GL_LIST_BIT - parameter ( GL_LIST_BIT = 131072 ) - integer*4 GL_TEXTURE_BIT - parameter ( GL_TEXTURE_BIT = 262144 ) - integer*4 GL_SCISSOR_BIT - parameter ( GL_SCISSOR_BIT = 524288 ) - integer*4 GL_ALL_ATTRIB_BITS - parameter ( GL_ALL_ATTRIB_BITS = 1048575 ) -C GL_MULTISAMPLE_BIT_EXT - -C ClearBufferMask -C GL_COLOR_BUFFER_BIT -C GL_ACCUM_BUFFER_BIT -C GL_STENCIL_BUFFER_BIT -C GL_DEPTH_BUFFER_BIT - -C Boolean - integer*4 GL_FALSE - parameter ( GL_FALSE = 0 ) - integer*4 GL_TRUE - parameter ( GL_TRUE = 1 ) - -C BeginMode - integer*4 GL_POINTS - parameter ( GL_POINTS = 0 ) - integer*4 GL_LINES - parameter ( GL_LINES = 1 ) - integer*4 GL_LINE_LOOP - parameter ( GL_LINE_LOOP = 2 ) - integer*4 GL_LINE_STRIP - parameter ( GL_LINE_STRIP = 3 ) - integer*4 GL_TRIANGLES - parameter ( GL_TRIANGLES = 4 ) - integer*4 GL_TRIANGLE_STRIP - parameter ( GL_TRIANGLE_STRIP = 5 ) - integer*4 GL_TRIANGLE_FAN - parameter ( GL_TRIANGLE_FAN = 6 ) - integer*4 GL_QUADS - parameter ( GL_QUADS = 7 ) - integer*4 GL_QUAD_STRIP - parameter ( GL_QUAD_STRIP = 8 ) - integer*4 GL_POLYGON - parameter ( GL_POLYGON = 9 ) - -C AccumOp - integer*4 GL_ACCUM - parameter ( GL_ACCUM = 256 ) - integer*4 GL_LOAD - parameter ( GL_LOAD = 257 ) - integer*4 GL_RETURN - parameter ( GL_RETURN = 258 ) - integer*4 GL_MULT - parameter ( GL_MULT = 259 ) - integer*4 GL_ADD - parameter ( GL_ADD = 260 ) - -C AlphaFunction - integer*4 GL_NEVER - parameter ( GL_NEVER = 512 ) - integer*4 GL_LESS - parameter ( GL_LESS = 513 ) - integer*4 GL_EQUAL - parameter ( GL_EQUAL = 514 ) - integer*4 GL_LEQUAL - parameter ( GL_LEQUAL = 515 ) - integer*4 GL_GREATER - parameter ( GL_GREATER = 516 ) - integer*4 GL_NOTEQUAL - parameter ( GL_NOTEQUAL = 517 ) - integer*4 GL_GEQUAL - parameter ( GL_GEQUAL = 518 ) - integer*4 GL_ALWAYS - parameter ( GL_ALWAYS = 519 ) - -C BlendingFactorDest - integer*4 GL_ZERO - parameter ( GL_ZERO = 0 ) - integer*4 GL_ONE - parameter ( GL_ONE = 1 ) - integer*4 GL_SRC_COLOR - parameter ( GL_SRC_COLOR = 768 ) - integer*4 GL_ONE_MINUS_SRC_COLOR - parameter ( GL_ONE_MINUS_SRC_COLOR = 769 ) - integer*4 GL_SRC_ALPHA - parameter ( GL_SRC_ALPHA = 770 ) - integer*4 GL_ONE_MINUS_SRC_ALPHA - parameter ( GL_ONE_MINUS_SRC_ALPHA = 771 ) - integer*4 GL_DST_ALPHA - parameter ( GL_DST_ALPHA = 772 ) - integer*4 GL_ONE_MINUS_DST_ALPHA - parameter ( GL_ONE_MINUS_DST_ALPHA = 773 ) -C GL_CONSTANT_COLOR_EXT -C GL_ONE_MINUS_CONSTANT_COLOR_EXT -C GL_CONSTANT_ALPHA_EXT -C GL_ONE_MINUS_CONSTANT_ALPHA_EXT - -C BlendingFactorSrc -C GL_ZERO -C GL_ONE - integer*4 GL_DST_COLOR - parameter ( GL_DST_COLOR = 774 ) - integer*4 GL_ONE_MINUS_DST_COLOR - parameter ( GL_ONE_MINUS_DST_COLOR = 775 ) - integer*4 GL_SRC_ALPHA_SATURATE - parameter ( GL_SRC_ALPHA_SATURATE = 776 ) -C GL_SRC_ALPHA -C GL_ONE_MINUS_SRC_ALPHA -C GL_DST_ALPHA -C GL_ONE_MINUS_DST_ALPHA -C GL_CONSTANT_COLOR_EXT -C GL_ONE_MINUS_CONSTANT_COLOR_EXT -C GL_CONSTANT_ALPHA_EXT -C GL_ONE_MINUS_CONSTANT_ALPHA_EXT - -C BlendingMode -C GL_LOGIC_OP -C GL_FUNC_ADD_EXT -C GL_MIN_EXT -C GL_MAX_EXT -C GL_FUNC_SUBTRACT_EXT -C GL_FUNC_REVERSE_SUBTRACT_EXT - -C ColorMaterialFace -C GL_FRONT -C GL_BACK -C GL_FRONT_AND_BACK - -C ColorMaterialParameter -C GL_AMBIENT -C GL_DIFFUSE -C GL_SPECULAR -C GL_EMISSION -C GL_AMBIENT_AND_DIFFUSE - -C ConvolutionBorderMode -C GL_REDUCE_EXT - -C ConvolutionParameter -C GL_CONVOLUTION_BORDER_MODE_EXT -C GL_CONVOLUTION_FILTER_SCALE_EXT -C GL_CONVOLUTION_FILTER_BIAS_EXT - -C ConvolutionTarget -C GL_CONVOLUTION_1D_EXT -C GL_CONVOLUTION_2D_EXT - -C CullFaceMode -C GL_FRONT -C GL_BACK -C GL_FRONT_AND_BACK - -C DepthFunction -C GL_NEVER -C GL_LESS -C GL_EQUAL -C GL_LEQUAL -C GL_GREATER -C GL_NOTEQUAL -C GL_GEQUAL -C GL_ALWAYS - -C DrawBufferMode - integer*4 GL_NONE - parameter ( GL_NONE = 0 ) - integer*4 GL_FRONT_LEFT - parameter ( GL_FRONT_LEFT = 1024 ) - integer*4 GL_FRONT_RIGHT - parameter ( GL_FRONT_RIGHT = 1025 ) - integer*4 GL_BACK_LEFT - parameter ( GL_BACK_LEFT = 1026 ) - integer*4 GL_BACK_RIGHT - parameter ( GL_BACK_RIGHT = 1027 ) - integer*4 GL_FRONT - parameter ( GL_FRONT = 1028 ) - integer*4 GL_BACK - parameter ( GL_BACK = 1029 ) - integer*4 GL_LEFT - parameter ( GL_LEFT = 1030 ) - integer*4 GL_RIGHT - parameter ( GL_RIGHT = 1031 ) - integer*4 GL_FRONT_AND_BACK - parameter ( GL_FRONT_AND_BACK = 1032 ) - integer*4 GL_AUX0 - parameter ( GL_AUX0 = 1033 ) - integer*4 GL_AUX1 - parameter ( GL_AUX1 = 1034 ) - integer*4 GL_AUX2 - parameter ( GL_AUX2 = 1035 ) - integer*4 GL_AUX3 - parameter ( GL_AUX3 = 1036 ) - -C Enable -C GL_FOG -C GL_LIGHTING -C GL_TEXTURE_1D -C GL_TEXTURE_2D -C GL_LINE_STIPPLE -C GL_POLYGON_STIPPLE -C GL_CULL_FACE -C GL_ALPHA_TEST -C GL_BLEND -C GL_LOGIC_OP -C GL_DITHER -C GL_STENCIL_TEST -C GL_DEPTH_TEST -C GL_CLIP_PLANE0 -C GL_CLIP_PLANE1 -C GL_CLIP_PLANE2 -C GL_CLIP_PLANE3 -C GL_CLIP_PLANE4 -C GL_CLIP_PLANE5 -C GL_LIGHT0 -C GL_LIGHT1 -C GL_LIGHT2 -C GL_LIGHT3 -C GL_LIGHT4 -C GL_LIGHT5 -C GL_LIGHT6 -C GL_LIGHT7 -C GL_TEXTURE_GEN_S -C GL_TEXTURE_GEN_T -C GL_TEXTURE_GEN_R -C GL_TEXTURE_GEN_Q -C GL_MAP1_VERTEX_3 -C GL_MAP1_VERTEX_4 -C GL_MAP1_COLOR_4 -C GL_MAP1_INDEX -C GL_MAP1_NORMAL -C GL_MAP1_TEXTURE_COORD_1 -C GL_MAP1_TEXTURE_COORD_2 -C GL_MAP1_TEXTURE_COORD_3 -C GL_MAP1_TEXTURE_COORD_4 -C GL_MAP2_VERTEX_3 -C GL_MAP2_VERTEX_4 -C GL_MAP2_COLOR_4 -C GL_MAP2_INDEX -C GL_MAP2_NORMAL -C GL_MAP2_TEXTURE_COORD_1 -C GL_MAP2_TEXTURE_COORD_2 -C GL_MAP2_TEXTURE_COORD_3 -C GL_MAP2_TEXTURE_COORD_4 -C GL_POINT_SMOOTH -C GL_LINE_SMOOTH -C GL_POLYGON_SMOOTH -C GL_SCISSOR_TEST -C GL_COLOR_MATERIAL -C GL_NORMALIZE -C GL_AUTO_NORMAL -C GL_CONVOLUTION_1D_EXT -C GL_CONVOLUTION_2D_EXT -C GL_SEPARABLE_2D_EXT -C GL_HISTOGRAM_EXT -C GL_MINMAX_EXT -C GL_POLYGON_OFFSET_EXT -C GL_TEXTURE_3D_EXT -C GL_MULTISAMPLE_SGIS -C GL_SAMPLE_ALPHA_TO_MASK_SGIS -C GL_SAMPLE_ALPHA_TO_ONE_SGIS -C GL_SAMPLE_MASK_SGIS - -C ErrorCode - integer*4 GL_NO_ERROR - parameter ( GL_NO_ERROR = 0 ) - integer*4 GL_INVALID_ENUM - parameter ( GL_INVALID_ENUM = 1280 ) - integer*4 GL_INVALID_VALUE - parameter ( GL_INVALID_VALUE = 1281 ) - integer*4 GL_INVALID_OPERATION - parameter ( GL_INVALID_OPERATION = 1282 ) - integer*4 GL_STACK_OVERFLOW - parameter ( GL_STACK_OVERFLOW = 1283 ) - integer*4 GL_STACK_UNDERFLOW - parameter ( GL_STACK_UNDERFLOW = 1284 ) - integer*4 GL_OUT_OF_MEMORY - parameter ( GL_OUT_OF_MEMORY = 1285 ) -C GL_TABLE_TOO_LARGE_EXT -C GL_TEXTURE_TOO_LARGE_EXT - -C FeedBackMode - integer*4 GL_2D - parameter ( GL_2D = 1536 ) - integer*4 GL_3D - parameter ( GL_3D = 1537 ) - integer*4 GL_3D_COLOR - parameter ( GL_3D_COLOR = 1538 ) - integer*4 GL_3D_COLOR_TEXTURE - parameter ( GL_3D_COLOR_TEXTURE = 1539 ) - integer*4 GL_4D_COLOR_TEXTURE - parameter ( GL_4D_COLOR_TEXTURE = 1540 ) - -C FeedBackToken - integer*4 GL_PASS_THROUGH_TOKEN - parameter ( GL_PASS_THROUGH_TOKEN = 1792 ) - integer*4 GL_POINT_TOKEN - parameter ( GL_POINT_TOKEN = 1793 ) - integer*4 GL_LINE_TOKEN - parameter ( GL_LINE_TOKEN = 1794 ) - integer*4 GL_POLYGON_TOKEN - parameter ( GL_POLYGON_TOKEN = 1795 ) - integer*4 GL_BITMAP_TOKEN - parameter ( GL_BITMAP_TOKEN = 1796 ) - integer*4 GL_DRAW_PIXEL_TOKEN - parameter ( GL_DRAW_PIXEL_TOKEN = 1797 ) - integer*4 GL_COPY_PIXEL_TOKEN - parameter ( GL_COPY_PIXEL_TOKEN = 1798 ) - integer*4 GL_LINE_RESET_TOKEN - parameter ( GL_LINE_RESET_TOKEN = 1799 ) - -C FogMode -C GL_LINEAR - integer*4 GL_EXP - parameter ( GL_EXP = 2048 ) - integer*4 GL_EXP2 - parameter ( GL_EXP2 = 2049 ) - -C FogParameter -C GL_FOG_COLOR -C GL_FOG_DENSITY -C GL_FOG_END -C GL_FOG_INDEX -C GL_FOG_MODE -C GL_FOG_START - -C FrontFaceDirection - integer*4 GL_CW - parameter ( GL_CW = 2304 ) - integer*4 GL_CCW - parameter ( GL_CCW = 2305 ) - -C GetConvolutionParameter -C GL_CONVOLUTION_BORDER_MODE_EXT -C GL_CONVOLUTION_FILTER_SCALE_EXT -C GL_CONVOLUTION_FILTER_BIAS_EXT -C GL_CONVOLUTION_FORMAT_EXT -C GL_CONVOLUTION_WIDTH_EXT -C GL_CONVOLUTION_HEIGHT_EXT -C GL_MAX_CONVOLUTION_WIDTH_EXT -C GL_MAX_CONVOLUTION_HEIGHT_EXT - -C GetHistogramParameter -C GL_HISTOGRAM_WIDTH_EXT -C GL_HISTOGRAM_FORMAT_EXT -C GL_HISTOGRAM_RED_SIZE_EXT -C GL_HISTOGRAM_GREEN_SIZE_EXT -C GL_HISTOGRAM_BLUE_SIZE_EXT -C GL_HISTOGRAM_ALPHA_SIZE_EXT -C GL_HISTOGRAM_LUMINANCE_SIZE_EXT -C GL_HISTOGRAM_SINK_EXT - -C GetMapTarget - integer*4 GL_COEFF - parameter ( GL_COEFF = 2560 ) - integer*4 GL_ORDER - parameter ( GL_ORDER = 2561 ) - integer*4 GL_DOMAIN - parameter ( GL_DOMAIN = 2562 ) - -C GetMinmaxParameter -C GL_MINMAX_FORMAT_EXT -C GL_MINMAX_SINK_EXT - -C GetPixelMap - integer*4 GL_PIXEL_MAP_I_TO_I - parameter ( GL_PIXEL_MAP_I_TO_I = 3184 ) - integer*4 GL_PIXEL_MAP_S_TO_S - parameter ( GL_PIXEL_MAP_S_TO_S = 3185 ) - integer*4 GL_PIXEL_MAP_I_TO_R - parameter ( GL_PIXEL_MAP_I_TO_R = 3186 ) - integer*4 GL_PIXEL_MAP_I_TO_G - parameter ( GL_PIXEL_MAP_I_TO_G = 3187 ) - integer*4 GL_PIXEL_MAP_I_TO_B - parameter ( GL_PIXEL_MAP_I_TO_B = 3188 ) - integer*4 GL_PIXEL_MAP_I_TO_A - parameter ( GL_PIXEL_MAP_I_TO_A = 3189 ) - integer*4 GL_PIXEL_MAP_R_TO_R - parameter ( GL_PIXEL_MAP_R_TO_R = 3190 ) - integer*4 GL_PIXEL_MAP_G_TO_G - parameter ( GL_PIXEL_MAP_G_TO_G = 3191 ) - integer*4 GL_PIXEL_MAP_B_TO_B - parameter ( GL_PIXEL_MAP_B_TO_B = 3192 ) - integer*4 GL_PIXEL_MAP_A_TO_A - parameter ( GL_PIXEL_MAP_A_TO_A = 3193 ) - -C GetTarget - integer*4 GL_CURRENT_COLOR - parameter ( GL_CURRENT_COLOR = 2816 ) - integer*4 GL_CURRENT_INDEX - parameter ( GL_CURRENT_INDEX = 2817 ) - integer*4 GL_CURRENT_NORMAL - parameter ( GL_CURRENT_NORMAL = 2818 ) - integer*4 GL_CURRENT_TEXTURE_COORDS - parameter ( GL_CURRENT_TEXTURE_COORDS = 2819 ) - integer*4 GL_CURRENT_RASTER_COLOR - parameter ( GL_CURRENT_RASTER_COLOR = 2820 ) - integer*4 GL_CURRENT_RASTER_INDEX - parameter ( GL_CURRENT_RASTER_INDEX = 2821 ) - integer*4 GL_CURRENT_RASTER_TEXTURE_COORDS - parameter ( GL_CURRENT_RASTER_TEXTURE_COORDS = 2822 ) - integer*4 GL_CURRENT_RASTER_POSITION - parameter ( GL_CURRENT_RASTER_POSITION = 2823 ) - integer*4 GL_CURRENT_RASTER_POSITION_VALID - parameter ( GL_CURRENT_RASTER_POSITION_VALID = 2824 ) - integer*4 GL_CURRENT_RASTER_DISTANCE - parameter ( GL_CURRENT_RASTER_DISTANCE = 2825 ) - integer*4 GL_POINT_SMOOTH - parameter ( GL_POINT_SMOOTH = 2832 ) - integer*4 GL_POINT_SIZE - parameter ( GL_POINT_SIZE = 2833 ) - integer*4 GL_POINT_SIZE_RANGE - parameter ( GL_POINT_SIZE_RANGE = 2834 ) - integer*4 GL_POINT_SIZE_GRANULARITY - parameter ( GL_POINT_SIZE_GRANULARITY = 2835 ) - integer*4 GL_LINE_SMOOTH - parameter ( GL_LINE_SMOOTH = 2848 ) - integer*4 GL_LINE_WIDTH - parameter ( GL_LINE_WIDTH = 2849 ) - integer*4 GL_LINE_WIDTH_RANGE - parameter ( GL_LINE_WIDTH_RANGE = 2850 ) - integer*4 GL_LINE_WIDTH_GRANULARITY - parameter ( GL_LINE_WIDTH_GRANULARITY = 2851 ) - integer*4 GL_LINE_STIPPLE - parameter ( GL_LINE_STIPPLE = 2852 ) - integer*4 GL_LINE_STIPPLE_PATTERN - parameter ( GL_LINE_STIPPLE_PATTERN = 2853 ) - integer*4 GL_LINE_STIPPLE_REPEAT - parameter ( GL_LINE_STIPPLE_REPEAT = 2854 ) - integer*4 GL_LIST_MODE - parameter ( GL_LIST_MODE = 2864 ) - integer*4 GL_MAX_LIST_NESTING - parameter ( GL_MAX_LIST_NESTING = 2865 ) - integer*4 GL_LIST_BASE - parameter ( GL_LIST_BASE = 2866 ) - integer*4 GL_LIST_INDEX - parameter ( GL_LIST_INDEX = 2867 ) - integer*4 GL_POLYGON_MODE - parameter ( GL_POLYGON_MODE = 2880 ) - integer*4 GL_POLYGON_SMOOTH - parameter ( GL_POLYGON_SMOOTH = 2881 ) - integer*4 GL_POLYGON_STIPPLE - parameter ( GL_POLYGON_STIPPLE = 2882 ) - integer*4 GL_EDGE_FLAG - parameter ( GL_EDGE_FLAG = 2883 ) - integer*4 GL_CULL_FACE - parameter ( GL_CULL_FACE = 2884 ) - integer*4 GL_CULL_FACE_MODE - parameter ( GL_CULL_FACE_MODE = 2885 ) - integer*4 GL_FRONT_FACE - parameter ( GL_FRONT_FACE = 2886 ) - integer*4 GL_LIGHTING - parameter ( GL_LIGHTING = 2896 ) - integer*4 GL_LIGHT_MODEL_LOCAL_VIEWER - parameter ( GL_LIGHT_MODEL_LOCAL_VIEWER = 2897 ) - integer*4 GL_LIGHT_MODEL_TWO_SIDE - parameter ( GL_LIGHT_MODEL_TWO_SIDE = 2898 ) - integer*4 GL_LIGHT_MODEL_AMBIENT - parameter ( GL_LIGHT_MODEL_AMBIENT = 2899 ) - integer*4 GL_SHADE_MODEL - parameter ( GL_SHADE_MODEL = 2900 ) - integer*4 GL_COLOR_MATERIAL_FACE - parameter ( GL_COLOR_MATERIAL_FACE = 2901 ) - integer*4 GL_COLOR_MATERIAL_PARAMETER - parameter ( GL_COLOR_MATERIAL_PARAMETER = 2902 ) - integer*4 GL_COLOR_MATERIAL - parameter ( GL_COLOR_MATERIAL = 2903 ) - integer*4 GL_FOG - parameter ( GL_FOG = 2912 ) - integer*4 GL_FOG_INDEX - parameter ( GL_FOG_INDEX = 2913 ) - integer*4 GL_FOG_DENSITY - parameter ( GL_FOG_DENSITY = 2914 ) - integer*4 GL_FOG_START - parameter ( GL_FOG_START = 2915 ) - integer*4 GL_FOG_END - parameter ( GL_FOG_END = 2916 ) - integer*4 GL_FOG_MODE - parameter ( GL_FOG_MODE = 2917 ) - integer*4 GL_FOG_COLOR - parameter ( GL_FOG_COLOR = 2918 ) - integer*4 GL_DEPTH_RANGE - parameter ( GL_DEPTH_RANGE = 2928 ) - integer*4 GL_DEPTH_TEST - parameter ( GL_DEPTH_TEST = 2929 ) - integer*4 GL_DEPTH_WRITEMASK - parameter ( GL_DEPTH_WRITEMASK = 2930 ) - integer*4 GL_DEPTH_CLEAR_VALUE - parameter ( GL_DEPTH_CLEAR_VALUE = 2931 ) - integer*4 GL_DEPTH_FUNC - parameter ( GL_DEPTH_FUNC = 2932 ) - integer*4 GL_ACCUM_CLEAR_VALUE - parameter ( GL_ACCUM_CLEAR_VALUE = 2944 ) - integer*4 GL_STENCIL_TEST - parameter ( GL_STENCIL_TEST = 2960 ) - integer*4 GL_STENCIL_CLEAR_VALUE - parameter ( GL_STENCIL_CLEAR_VALUE = 2961 ) - integer*4 GL_STENCIL_FUNC - parameter ( GL_STENCIL_FUNC = 2962 ) - integer*4 GL_STENCIL_VALUE_MASK - parameter ( GL_STENCIL_VALUE_MASK = 2963 ) - integer*4 GL_STENCIL_FAIL - parameter ( GL_STENCIL_FAIL = 2964 ) - integer*4 GL_STENCIL_PASS_DEPTH_FAIL - parameter ( GL_STENCIL_PASS_DEPTH_FAIL = 2965 ) - integer*4 GL_STENCIL_PASS_DEPTH_PASS - parameter ( GL_STENCIL_PASS_DEPTH_PASS = 2966 ) - integer*4 GL_STENCIL_REF - parameter ( GL_STENCIL_REF = 2967 ) - integer*4 GL_STENCIL_WRITEMASK - parameter ( GL_STENCIL_WRITEMASK = 2968 ) - integer*4 GL_MATRIX_MODE - parameter ( GL_MATRIX_MODE = 2976 ) - integer*4 GL_NORMALIZE - parameter ( GL_NORMALIZE = 2977 ) - integer*4 GL_VIEWPORT - parameter ( GL_VIEWPORT = 2978 ) - integer*4 GL_MODELVIEW_STACK_DEPTH - parameter ( GL_MODELVIEW_STACK_DEPTH = 2979 ) - integer*4 GL_PROJECTION_STACK_DEPTH - parameter ( GL_PROJECTION_STACK_DEPTH = 2980 ) - integer*4 GL_TEXTURE_STACK_DEPTH - parameter ( GL_TEXTURE_STACK_DEPTH = 2981 ) - integer*4 GL_MODELVIEW_MATRIX - parameter ( GL_MODELVIEW_MATRIX = 2982 ) - integer*4 GL_PROJECTION_MATRIX - parameter ( GL_PROJECTION_MATRIX = 2983 ) - integer*4 GL_TEXTURE_MATRIX - parameter ( GL_TEXTURE_MATRIX = 2984 ) - integer*4 GL_ATTRIB_STACK_DEPTH - parameter ( GL_ATTRIB_STACK_DEPTH = 2992 ) - integer*4 GL_ALPHA_TEST - parameter ( GL_ALPHA_TEST = 3008 ) - integer*4 GL_ALPHA_TEST_FUNC - parameter ( GL_ALPHA_TEST_FUNC = 3009 ) - integer*4 GL_ALPHA_TEST_REF - parameter ( GL_ALPHA_TEST_REF = 3010 ) - integer*4 GL_DITHER - parameter ( GL_DITHER = 3024 ) - integer*4 GL_BLEND_DST - parameter ( GL_BLEND_DST = 3040 ) - integer*4 GL_BLEND_SRC - parameter ( GL_BLEND_SRC = 3041 ) - integer*4 GL_BLEND - parameter ( GL_BLEND = 3042 ) - integer*4 GL_LOGIC_OP_MODE - parameter ( GL_LOGIC_OP_MODE = 3056 ) - integer*4 GL_LOGIC_OP - parameter ( GL_LOGIC_OP = 3057 ) - integer*4 GL_AUX_BUFFERS - parameter ( GL_AUX_BUFFERS = 3072 ) - integer*4 GL_DRAW_BUFFER - parameter ( GL_DRAW_BUFFER = 3073 ) - integer*4 GL_READ_BUFFER - parameter ( GL_READ_BUFFER = 3074 ) - integer*4 GL_SCISSOR_BOX - parameter ( GL_SCISSOR_BOX = 3088 ) - integer*4 GL_SCISSOR_TEST - parameter ( GL_SCISSOR_TEST = 3089 ) - integer*4 GL_INDEX_CLEAR_VALUE - parameter ( GL_INDEX_CLEAR_VALUE = 3104 ) - integer*4 GL_INDEX_WRITEMASK - parameter ( GL_INDEX_WRITEMASK = 3105 ) - integer*4 GL_COLOR_CLEAR_VALUE - parameter ( GL_COLOR_CLEAR_VALUE = 3106 ) - integer*4 GL_COLOR_WRITEMASK - parameter ( GL_COLOR_WRITEMASK = 3107 ) - integer*4 GL_INDEX_MODE - parameter ( GL_INDEX_MODE = 3120 ) - integer*4 GL_RGBA_MODE - parameter ( GL_RGBA_MODE = 3121 ) - integer*4 GL_DOUBLEBUFFER - parameter ( GL_DOUBLEBUFFER = 3122 ) - integer*4 GL_STEREO - parameter ( GL_STEREO = 3123 ) - integer*4 GL_RENDER_MODE - parameter ( GL_RENDER_MODE = 3136 ) - integer*4 GL_PERSPECTIVE_CORRECTION_HINT - parameter ( GL_PERSPECTIVE_CORRECTION_HINT = 3152 ) - integer*4 GL_POINT_SMOOTH_HINT - parameter ( GL_POINT_SMOOTH_HINT = 3153 ) - integer*4 GL_LINE_SMOOTH_HINT - parameter ( GL_LINE_SMOOTH_HINT = 3154 ) - integer*4 GL_POLYGON_SMOOTH_HINT - parameter ( GL_POLYGON_SMOOTH_HINT = 3155 ) - integer*4 GL_FOG_HINT - parameter ( GL_FOG_HINT = 3156 ) - integer*4 GL_TEXTURE_GEN_S - parameter ( GL_TEXTURE_GEN_S = 3168 ) - integer*4 GL_TEXTURE_GEN_T - parameter ( GL_TEXTURE_GEN_T = 3169 ) - integer*4 GL_TEXTURE_GEN_R - parameter ( GL_TEXTURE_GEN_R = 3170 ) - integer*4 GL_TEXTURE_GEN_Q - parameter ( GL_TEXTURE_GEN_Q = 3171 ) - integer*4 GL_PIXEL_MAP_I_TO_I_SIZE - parameter ( GL_PIXEL_MAP_I_TO_I_SIZE = 3248 ) - integer*4 GL_PIXEL_MAP_S_TO_S_SIZE - parameter ( GL_PIXEL_MAP_S_TO_S_SIZE = 3249 ) - integer*4 GL_PIXEL_MAP_I_TO_R_SIZE - parameter ( GL_PIXEL_MAP_I_TO_R_SIZE = 3250 ) - integer*4 GL_PIXEL_MAP_I_TO_G_SIZE - parameter ( GL_PIXEL_MAP_I_TO_G_SIZE = 3251 ) - integer*4 GL_PIXEL_MAP_I_TO_B_SIZE - parameter ( GL_PIXEL_MAP_I_TO_B_SIZE = 3252 ) - integer*4 GL_PIXEL_MAP_I_TO_A_SIZE - parameter ( GL_PIXEL_MAP_I_TO_A_SIZE = 3253 ) - integer*4 GL_PIXEL_MAP_R_TO_R_SIZE - parameter ( GL_PIXEL_MAP_R_TO_R_SIZE = 3254 ) - integer*4 GL_PIXEL_MAP_G_TO_G_SIZE - parameter ( GL_PIXEL_MAP_G_TO_G_SIZE = 3255 ) - integer*4 GL_PIXEL_MAP_B_TO_B_SIZE - parameter ( GL_PIXEL_MAP_B_TO_B_SIZE = 3256 ) - integer*4 GL_PIXEL_MAP_A_TO_A_SIZE - parameter ( GL_PIXEL_MAP_A_TO_A_SIZE = 3257 ) - integer*4 GL_UNPACK_SWAP_BYTES - parameter ( GL_UNPACK_SWAP_BYTES = 3312 ) - integer*4 GL_UNPACK_LSB_FIRST - parameter ( GL_UNPACK_LSB_FIRST = 3313 ) - integer*4 GL_UNPACK_ROW_LENGTH - parameter ( GL_UNPACK_ROW_LENGTH = 3314 ) - integer*4 GL_UNPACK_SKIP_ROWS - parameter ( GL_UNPACK_SKIP_ROWS = 3315 ) - integer*4 GL_UNPACK_SKIP_PIXELS - parameter ( GL_UNPACK_SKIP_PIXELS = 3316 ) - integer*4 GL_UNPACK_ALIGNMENT - parameter ( GL_UNPACK_ALIGNMENT = 3317 ) - integer*4 GL_PACK_SWAP_BYTES - parameter ( GL_PACK_SWAP_BYTES = 3328 ) - integer*4 GL_PACK_LSB_FIRST - parameter ( GL_PACK_LSB_FIRST = 3329 ) - integer*4 GL_PACK_ROW_LENGTH - parameter ( GL_PACK_ROW_LENGTH = 3330 ) - integer*4 GL_PACK_SKIP_ROWS - parameter ( GL_PACK_SKIP_ROWS = 3331 ) - integer*4 GL_PACK_SKIP_PIXELS - parameter ( GL_PACK_SKIP_PIXELS = 3332 ) - integer*4 GL_PACK_ALIGNMENT - parameter ( GL_PACK_ALIGNMENT = 3333 ) - integer*4 GL_MAP_COLOR - parameter ( GL_MAP_COLOR = 3344 ) - integer*4 GL_MAP_STENCIL - parameter ( GL_MAP_STENCIL = 3345 ) - integer*4 GL_INDEX_SHIFT - parameter ( GL_INDEX_SHIFT = 3346 ) - integer*4 GL_INDEX_OFFSET - parameter ( GL_INDEX_OFFSET = 3347 ) - integer*4 GL_RED_SCALE - parameter ( GL_RED_SCALE = 3348 ) - integer*4 GL_RED_BIAS - parameter ( GL_RED_BIAS = 3349 ) - integer*4 GL_ZOOM_X - parameter ( GL_ZOOM_X = 3350 ) - integer*4 GL_ZOOM_Y - parameter ( GL_ZOOM_Y = 3351 ) - integer*4 GL_GREEN_SCALE - parameter ( GL_GREEN_SCALE = 3352 ) - integer*4 GL_GREEN_BIAS - parameter ( GL_GREEN_BIAS = 3353 ) - integer*4 GL_BLUE_SCALE - parameter ( GL_BLUE_SCALE = 3354 ) - integer*4 GL_BLUE_BIAS - parameter ( GL_BLUE_BIAS = 3355 ) - integer*4 GL_ALPHA_SCALE - parameter ( GL_ALPHA_SCALE = 3356 ) - integer*4 GL_ALPHA_BIAS - parameter ( GL_ALPHA_BIAS = 3357 ) - integer*4 GL_DEPTH_SCALE - parameter ( GL_DEPTH_SCALE = 3358 ) - integer*4 GL_DEPTH_BIAS - parameter ( GL_DEPTH_BIAS = 3359 ) - integer*4 GL_MAX_EVAL_ORDER - parameter ( GL_MAX_EVAL_ORDER = 3376 ) - integer*4 GL_MAX_LIGHTS - parameter ( GL_MAX_LIGHTS = 3377 ) - integer*4 GL_MAX_CLIP_PLANES - parameter ( GL_MAX_CLIP_PLANES = 3378 ) - integer*4 GL_MAX_TEXTURE_SIZE - parameter ( GL_MAX_TEXTURE_SIZE = 3379 ) - integer*4 GL_MAX_PIXEL_MAP_TABLE - parameter ( GL_MAX_PIXEL_MAP_TABLE = 3380 ) - integer*4 GL_MAX_ATTRIB_STACK_DEPTH - parameter ( GL_MAX_ATTRIB_STACK_DEPTH = 3381 ) - integer*4 GL_MAX_MODELVIEW_STACK_DEPTH - parameter ( GL_MAX_MODELVIEW_STACK_DEPTH = 3382 ) - integer*4 GL_MAX_NAME_STACK_DEPTH - parameter ( GL_MAX_NAME_STACK_DEPTH = 3383 ) - integer*4 GL_MAX_PROJECTION_STACK_DEPTH - parameter ( GL_MAX_PROJECTION_STACK_DEPTH = 3384 ) - integer*4 GL_MAX_TEXTURE_STACK_DEPTH - parameter ( GL_MAX_TEXTURE_STACK_DEPTH = 3385 ) - integer*4 GL_MAX_VIEWPORT_DIMS - parameter ( GL_MAX_VIEWPORT_DIMS = 3386 ) - integer*4 GL_SUBPIXEL_BITS - parameter ( GL_SUBPIXEL_BITS = 3408 ) - integer*4 GL_INDEX_BITS - parameter ( GL_INDEX_BITS = 3409 ) - integer*4 GL_RED_BITS - parameter ( GL_RED_BITS = 3410 ) - integer*4 GL_GREEN_BITS - parameter ( GL_GREEN_BITS = 3411 ) - integer*4 GL_BLUE_BITS - parameter ( GL_BLUE_BITS = 3412 ) - integer*4 GL_ALPHA_BITS - parameter ( GL_ALPHA_BITS = 3413 ) - integer*4 GL_DEPTH_BITS - parameter ( GL_DEPTH_BITS = 3414 ) - integer*4 GL_STENCIL_BITS - parameter ( GL_STENCIL_BITS = 3415 ) - integer*4 GL_ACCUM_RED_BITS - parameter ( GL_ACCUM_RED_BITS = 3416 ) - integer*4 GL_ACCUM_GREEN_BITS - parameter ( GL_ACCUM_GREEN_BITS = 3417 ) - integer*4 GL_ACCUM_BLUE_BITS - parameter ( GL_ACCUM_BLUE_BITS = 3418 ) - integer*4 GL_ACCUM_ALPHA_BITS - parameter ( GL_ACCUM_ALPHA_BITS = 3419 ) - integer*4 GL_NAME_STACK_DEPTH - parameter ( GL_NAME_STACK_DEPTH = 3440 ) - integer*4 GL_AUTO_NORMAL - parameter ( GL_AUTO_NORMAL = 3456 ) - integer*4 GL_MAP1_COLOR_4 - parameter ( GL_MAP1_COLOR_4 = 3472 ) - integer*4 GL_MAP1_INDEX - parameter ( GL_MAP1_INDEX = 3473 ) - integer*4 GL_MAP1_NORMAL - parameter ( GL_MAP1_NORMAL = 3474 ) - integer*4 GL_MAP1_TEXTURE_COORD_1 - parameter ( GL_MAP1_TEXTURE_COORD_1 = 3475 ) - integer*4 GL_MAP1_TEXTURE_COORD_2 - parameter ( GL_MAP1_TEXTURE_COORD_2 = 3476 ) - integer*4 GL_MAP1_TEXTURE_COORD_3 - parameter ( GL_MAP1_TEXTURE_COORD_3 = 3477 ) - integer*4 GL_MAP1_TEXTURE_COORD_4 - parameter ( GL_MAP1_TEXTURE_COORD_4 = 3478 ) - integer*4 GL_MAP1_VERTEX_3 - parameter ( GL_MAP1_VERTEX_3 = 3479 ) - integer*4 GL_MAP1_VERTEX_4 - parameter ( GL_MAP1_VERTEX_4 = 3480 ) - integer*4 GL_MAP2_COLOR_4 - parameter ( GL_MAP2_COLOR_4 = 3504 ) - integer*4 GL_MAP2_INDEX - parameter ( GL_MAP2_INDEX = 3505 ) - integer*4 GL_MAP2_NORMAL - parameter ( GL_MAP2_NORMAL = 3506 ) - integer*4 GL_MAP2_TEXTURE_COORD_1 - parameter ( GL_MAP2_TEXTURE_COORD_1 = 3507 ) - integer*4 GL_MAP2_TEXTURE_COORD_2 - parameter ( GL_MAP2_TEXTURE_COORD_2 = 3508 ) - integer*4 GL_MAP2_TEXTURE_COORD_3 - parameter ( GL_MAP2_TEXTURE_COORD_3 = 3509 ) - integer*4 GL_MAP2_TEXTURE_COORD_4 - parameter ( GL_MAP2_TEXTURE_COORD_4 = 3510 ) - integer*4 GL_MAP2_VERTEX_3 - parameter ( GL_MAP2_VERTEX_3 = 3511 ) - integer*4 GL_MAP2_VERTEX_4 - parameter ( GL_MAP2_VERTEX_4 = 3512 ) - integer*4 GL_MAP1_GRID_DOMAIN - parameter ( GL_MAP1_GRID_DOMAIN = 3536 ) - integer*4 GL_MAP1_GRID_SEGMENTS - parameter ( GL_MAP1_GRID_SEGMENTS = 3537 ) - integer*4 GL_MAP2_GRID_DOMAIN - parameter ( GL_MAP2_GRID_DOMAIN = 3538 ) - integer*4 GL_MAP2_GRID_SEGMENTS - parameter ( GL_MAP2_GRID_SEGMENTS = 3539 ) - integer*4 GL_TEXTURE_1D - parameter ( GL_TEXTURE_1D = 3552 ) - integer*4 GL_TEXTURE_2D - parameter ( GL_TEXTURE_2D = 3553 ) -C GL_BLEND_COLOR_EXT -C GL_BLEND_EQUATION_EXT -C GL_CONVOLUTION_1D_EXT -C GL_CONVOLUTION_2D_EXT -C GL_SEPARABLE_2D_EXT -C GL_POST_CONVOLUTION_RED_SCALE_EXT -C GL_POST_CONVOLUTION_GREEN_SCALE_EXT -C GL_POST_CONVOLUTION_BLUE_SCALE_EXT -C GL_POST_CONVOLUTION_ALPHA_SCALE_EXT -C GL_POST_CONVOLUTION_RED_BIAS_EXT -C GL_POST_CONVOLUTION_GREEN_BIAS_EXT -C GL_POST_CONVOLUTION_BLUE_BIAS_EXT -C GL_POST_CONVOLUTION_ALPHA_BIAS_EXT -C GL_HISTOGRAM_EXT -C GL_MINMAX_EXT -C GL_POLYGON_OFFSET_EXT -C GL_POLYGON_OFFSET_FACTOR_EXT -C GL_POLYGON_OFFSET_BIAS_EXT -C GL_PACK_SKIP_IMAGES_EXT -C GL_PACK_IMAGE_HEIGHT_EXT -C GL_UNPACK_SKIP_IMAGES_EXT -C GL_UNPACK_IMAGE_HEIGHT_EXT -C GL_TEXTURE_3D_EXT -C GL_MAX_3D_TEXTURE_SIZE_EXT -C GL_DETAIL_TEXTURE_2D_BINDING_SGIS -C GL_MULTISAMPLE_SGIS -C GL_SAMPLE_ALPHA_TO_MASK_SGIS -C GL_SAMPLE_ALPHA_TO_ONE_SGIS -C GL_SAMPLE_MASK_SGIS -C GL_SAMPLE_BUFFERS_SGIS -C GL_SAMPLES_SGIS -C GL_SAMPLE_MASK_VALUE_SGIS -C GL_SAMPLE_MASK_INVERT_SGIS -C GL_SAMPLE_PATTERN_SGIS - -C GetTextureParameter -C GL_TEXTURE_MAG_FILTER -C GL_TEXTURE_MIN_FILTER -C GL_TEXTURE_WRAP_S -C GL_TEXTURE_WRAP_T - integer*4 GL_TEXTURE_WIDTH - parameter ( GL_TEXTURE_WIDTH = 4096 ) - integer*4 GL_TEXTURE_HEIGHT - parameter ( GL_TEXTURE_HEIGHT = 4097 ) - integer*4 GL_TEXTURE_COMPONENTS - parameter ( GL_TEXTURE_COMPONENTS = 4099 ) - integer*4 GL_TEXTURE_BORDER_COLOR - parameter ( GL_TEXTURE_BORDER_COLOR = 4100 ) - integer*4 GL_TEXTURE_BORDER - parameter ( GL_TEXTURE_BORDER = 4101 ) -C GL_TEXTURE_RED_SIZE_EXT -C GL_TEXTURE_GREEN_SIZE_EXT -C GL_TEXTURE_BLUE_SIZE_EXT -C GL_TEXTURE_ALPHA_SIZE_EXT -C GL_TEXTURE_LUMINANCE_SIZE_EXT -C GL_TEXTURE_INTENSITY_SIZE_EXT -C GL_TEXTURE_DEPTH_EXT -C GL_TEXTURE_WRAP_R_EXT -C GL_DETAIL_TEXTURE_LEVEL_SGIS -C GL_DETAIL_TEXTURE_MODE_SGIS -C GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS -C GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS - -C HintMode - integer*4 GL_DONT_CARE - parameter ( GL_DONT_CARE = 4352 ) - integer*4 GL_FASTEST - parameter ( GL_FASTEST = 4353 ) - integer*4 GL_NICEST - parameter ( GL_NICEST = 4354 ) - -C HintTarget -C GL_PERSPECTIVE_CORRECTION_HINT -C GL_POINT_SMOOTH_HINT -C GL_LINE_SMOOTH_HINT -C GL_POLYGON_SMOOTH_HINT -C GL_FOG_HINT - -C HistogramTarget -C GL_HISTOGRAM_EXT -C GL_PROXY_HISTOGRAM_EXT - -C LightModelParameter -C GL_LIGHT_MODEL_AMBIENT -C GL_LIGHT_MODEL_LOCAL_VIEWER -C GL_LIGHT_MODEL_TWO_SIDE - -C LightParameter - integer*4 GL_AMBIENT - parameter ( GL_AMBIENT = 4608 ) - integer*4 GL_DIFFUSE - parameter ( GL_DIFFUSE = 4609 ) - integer*4 GL_SPECULAR - parameter ( GL_SPECULAR = 4610 ) - integer*4 GL_POSITION - parameter ( GL_POSITION = 4611 ) - integer*4 GL_SPOT_DIRECTION - parameter ( GL_SPOT_DIRECTION = 4612 ) - integer*4 GL_SPOT_EXPONENT - parameter ( GL_SPOT_EXPONENT = 4613 ) - integer*4 GL_SPOT_CUTOFF - parameter ( GL_SPOT_CUTOFF = 4614 ) - integer*4 GL_CONSTANT_ATTENUATION - parameter ( GL_CONSTANT_ATTENUATION = 4615 ) - integer*4 GL_LINEAR_ATTENUATION - parameter ( GL_LINEAR_ATTENUATION = 4616 ) - integer*4 GL_QUADRATIC_ATTENUATION - parameter ( GL_QUADRATIC_ATTENUATION = 4617 ) - -C ListMode - integer*4 GL_COMPILE - parameter ( GL_COMPILE = 4864 ) - integer*4 GL_COMPILE_AND_EXECUTE - parameter ( GL_COMPILE_AND_EXECUTE = 4865 ) - -C ListNameType - integer*4 GL_BYTE - parameter ( GL_BYTE = 5120 ) - integer*4 GL_UNSIGNED_BYTE - parameter ( GL_UNSIGNED_BYTE = 5121 ) - integer*4 GL_SHORT - parameter ( GL_SHORT = 5122 ) - integer*4 GL_UNSIGNED_SHORT - parameter ( GL_UNSIGNED_SHORT = 5123 ) - integer*4 GL_INT - parameter ( GL_INT = 5124 ) - integer*4 GL_UNSIGNED_INT - parameter ( GL_UNSIGNED_INT = 5125 ) - integer*4 GL_FLOAT - parameter ( GL_FLOAT = 5126 ) - integer*4 GL_2_BYTES - parameter ( GL_2_BYTES = 5127 ) - integer*4 GL_3_BYTES - parameter ( GL_3_BYTES = 5128 ) - integer*4 GL_4_BYTES - parameter ( GL_4_BYTES = 5129 ) - -C LogicOp - integer*4 GL_CLEAR - parameter ( GL_CLEAR = 5376 ) - integer*4 GL_AND - parameter ( GL_AND = 5377 ) - integer*4 GL_AND_REVERSE - parameter ( GL_AND_REVERSE = 5378 ) - integer*4 GL_COPY - parameter ( GL_COPY = 5379 ) - integer*4 GL_AND_INVERTED - parameter ( GL_AND_INVERTED = 5380 ) - integer*4 GL_NOOP - parameter ( GL_NOOP = 5381 ) - integer*4 GL_XOR - parameter ( GL_XOR = 5382 ) - integer*4 GL_OR - parameter ( GL_OR = 5383 ) - integer*4 GL_NOR - parameter ( GL_NOR = 5384 ) - integer*4 GL_EQUIV - parameter ( GL_EQUIV = 5385 ) - integer*4 GL_INVERT - parameter ( GL_INVERT = 5386 ) - integer*4 GL_OR_REVERSE - parameter ( GL_OR_REVERSE = 5387 ) - integer*4 GL_COPY_INVERTED - parameter ( GL_COPY_INVERTED = 5388 ) - integer*4 GL_OR_INVERTED - parameter ( GL_OR_INVERTED = 5389 ) - integer*4 GL_NAND - parameter ( GL_NAND = 5390 ) - integer*4 GL_SET - parameter ( GL_SET = 5391 ) - -C MapTarget -C GL_MAP1_COLOR_4 -C GL_MAP1_INDEX -C GL_MAP1_NORMAL -C GL_MAP1_TEXTURE_COORD_1 -C GL_MAP1_TEXTURE_COORD_2 -C GL_MAP1_TEXTURE_COORD_3 -C GL_MAP1_TEXTURE_COORD_4 -C GL_MAP1_VERTEX_3 -C GL_MAP1_VERTEX_4 -C GL_MAP2_COLOR_4 -C GL_MAP2_INDEX -C GL_MAP2_NORMAL -C GL_MAP2_TEXTURE_COORD_1 -C GL_MAP2_TEXTURE_COORD_2 -C GL_MAP2_TEXTURE_COORD_3 -C GL_MAP2_TEXTURE_COORD_4 -C GL_MAP2_VERTEX_3 -C GL_MAP2_VERTEX_4 - -C MaterialFace -C GL_FRONT -C GL_BACK -C GL_FRONT_AND_BACK - -C MaterialParameter - integer*4 GL_EMISSION - parameter ( GL_EMISSION = 5632 ) - integer*4 GL_SHININESS - parameter ( GL_SHININESS = 5633 ) - integer*4 GL_AMBIENT_AND_DIFFUSE - parameter ( GL_AMBIENT_AND_DIFFUSE = 5634 ) - integer*4 GL_COLOR_INDEXES - parameter ( GL_COLOR_INDEXES = 5635 ) -C GL_AMBIENT -C GL_DIFFUSE -C GL_SPECULAR - -C MatrixMode - integer*4 GL_MODELVIEW - parameter ( GL_MODELVIEW = 5888 ) - integer*4 GL_PROJECTION - parameter ( GL_PROJECTION = 5889 ) - integer*4 GL_TEXTURE - parameter ( GL_TEXTURE = 5890 ) - -C MeshMode1 -C GL_POINT -C GL_LINE - -C MeshMode2 -C GL_POINT -C GL_LINE -C GL_FILL - -C MinmaxTarget -C GL_MINMAX_EXT - -C PixelCopyType - integer*4 GL_COLOR - parameter ( GL_COLOR = 6144 ) - integer*4 GL_DEPTH - parameter ( GL_DEPTH = 6145 ) - integer*4 GL_STENCIL - parameter ( GL_STENCIL = 6146 ) - -C PixelFormat - integer*4 GL_COLOR_INDEX - parameter ( GL_COLOR_INDEX = 6400 ) - integer*4 GL_STENCIL_INDEX - parameter ( GL_STENCIL_INDEX = 6401 ) - integer*4 GL_DEPTH_COMPONENT - parameter ( GL_DEPTH_COMPONENT = 6402 ) - integer*4 GL_RED - parameter ( GL_RED = 6403 ) - integer*4 GL_GREEN - parameter ( GL_GREEN = 6404 ) - integer*4 GL_BLUE - parameter ( GL_BLUE = 6405 ) - integer*4 GL_ALPHA - parameter ( GL_ALPHA = 6406 ) - integer*4 GL_RGB - parameter ( GL_RGB = 6407 ) - integer*4 GL_RGBA - parameter ( GL_RGBA = 6408 ) - integer*4 GL_LUMINANCE - parameter ( GL_LUMINANCE = 6409 ) - integer*4 GL_LUMINANCE_ALPHA - parameter ( GL_LUMINANCE_ALPHA = 6410 ) -C GL_ABGR_EXT - -C PixelInternalFormat -C GL_ALPHA4_EXT -C GL_ALPHA8_EXT -C GL_ALPHA12_EXT -C GL_ALPHA16_EXT -C GL_LUMINANCE4_EXT -C GL_LUMINANCE8_EXT -C GL_LUMINANCE12_EXT -C GL_LUMINANCE16_EXT -C GL_LUMINANCE4_ALPHA4_EXT -C GL_LUMINANCE6_ALPHA2_EXT -C GL_LUMINANCE8_ALPHA8_EXT -C GL_LUMINANCE12_ALPHA4_EXT -C GL_LUMINANCE12_ALPHA12_EXT -C GL_LUMINANCE16_ALPHA16_EXT -C GL_INTENSITY_EXT -C GL_INTENSITY4_EXT -C GL_INTENSITY8_EXT -C GL_INTENSITY12_EXT -C GL_INTENSITY16_EXT -C GL_RGB2_EXT -C GL_RGB4_EXT -C GL_RGB5_EXT -C GL_RGB8_EXT -C GL_RGB10_EXT -C GL_RGB12_EXT -C GL_RGB16_EXT -C GL_RGBA2_EXT -C GL_RGBA4_EXT -C GL_RGB5_A1_EXT -C GL_RGBA8_EXT -C GL_RGB10_A2_EXT -C GL_RGBA12_EXT -C GL_RGBA16_EXT - -C PixelMap -C GL_PIXEL_MAP_I_TO_I -C GL_PIXEL_MAP_S_TO_S -C GL_PIXEL_MAP_I_TO_R -C GL_PIXEL_MAP_I_TO_G -C GL_PIXEL_MAP_I_TO_B -C GL_PIXEL_MAP_I_TO_A -C GL_PIXEL_MAP_R_TO_R -C GL_PIXEL_MAP_G_TO_G -C GL_PIXEL_MAP_B_TO_B -C GL_PIXEL_MAP_A_TO_A - -C PixelStore -C GL_UNPACK_SWAP_BYTES -C GL_UNPACK_LSB_FIRST -C GL_UNPACK_ROW_LENGTH -C GL_UNPACK_SKIP_ROWS -C GL_UNPACK_SKIP_PIXELS -C GL_UNPACK_ALIGNMENT -C GL_PACK_SWAP_BYTES -C GL_PACK_LSB_FIRST -C GL_PACK_ROW_LENGTH -C GL_PACK_SKIP_ROWS -C GL_PACK_SKIP_PIXELS -C GL_PACK_ALIGNMENT -C GL_PACK_SKIP_IMAGES_EXT -C GL_PACK_IMAGE_HEIGHT_EXT -C GL_UNPACK_SKIP_IMAGES_EXT -C GL_UNPACK_IMAGE_HEIGHT_EXT - -C PixelTransfer -C GL_MAP_COLOR -C GL_MAP_STENCIL -C GL_INDEX_SHIFT -C GL_INDEX_OFFSET -C GL_RED_SCALE -C GL_RED_BIAS -C GL_GREEN_SCALE -C GL_GREEN_BIAS -C GL_BLUE_SCALE -C GL_BLUE_BIAS -C GL_ALPHA_SCALE -C GL_ALPHA_BIAS -C GL_DEPTH_SCALE -C GL_DEPTH_BIAS -C GL_POST_CONVOLUTION_RED_SCALE_EXT -C GL_POST_CONVOLUTION_GREEN_SCALE_EXT -C GL_POST_CONVOLUTION_BLUE_SCALE_EXT -C GL_POST_CONVOLUTION_ALPHA_SCALE_EXT -C GL_POST_CONVOLUTION_RED_BIAS_EXT -C GL_POST_CONVOLUTION_GREEN_BIAS_EXT -C GL_POST_CONVOLUTION_BLUE_BIAS_EXT -C GL_POST_CONVOLUTION_ALPHA_BIAS_EXT - -C PixelType - integer*4 GL_BITMAP - parameter ( GL_BITMAP = 6656 ) -C GL_BYTE -C GL_UNSIGNED_BYTE -C GL_SHORT -C GL_UNSIGNED_SHORT -C GL_INT -C GL_UNSIGNED_INT -C GL_FLOAT - -C PolygonMode - integer*4 GL_POINT - parameter ( GL_POINT = 6912 ) - integer*4 GL_LINE - parameter ( GL_LINE = 6913 ) - integer*4 GL_FILL - parameter ( GL_FILL = 6914 ) - -C ReadBufferMode -C GL_FRONT_LEFT -C GL_FRONT_RIGHT -C GL_BACK_LEFT -C GL_BACK_RIGHT -C GL_FRONT -C GL_BACK -C GL_LEFT -C GL_RIGHT -C GL_AUX0 -C GL_AUX1 -C GL_AUX2 -C GL_AUX3 - -C RenderingMode - integer*4 GL_RENDER - parameter ( GL_RENDER = 7168 ) - integer*4 GL_FEEDBACK - parameter ( GL_FEEDBACK = 7169 ) - integer*4 GL_SELECT - parameter ( GL_SELECT = 7170 ) - -C SamplePattern -C GL_1PASS_SGIS -C GL_2PASS_0_SGIS -C GL_2PASS_1_SGIS -C GL_4PASS_0_SGIS -C GL_4PASS_1_SGIS -C GL_4PASS_2_SGIS -C GL_4PASS_3_SGIS - -C SeparableTarget -C GL_SEPARABLE_2D_EXT - -C ShadingModel - integer*4 GL_FLAT - parameter ( GL_FLAT = 7424 ) - integer*4 GL_SMOOTH - parameter ( GL_SMOOTH = 7425 ) - -C StencilFunction -C GL_NEVER -C GL_LESS -C GL_EQUAL -C GL_LEQUAL -C GL_GREATER -C GL_NOTEQUAL -C GL_GEQUAL -C GL_ALWAYS - -C StencilOp -C GL_ZERO - integer*4 GL_KEEP - parameter ( GL_KEEP = 7680 ) - integer*4 GL_REPLACE - parameter ( GL_REPLACE = 7681 ) - integer*4 GL_INCR - parameter ( GL_INCR = 7682 ) - integer*4 GL_DECR - parameter ( GL_DECR = 7683 ) -C GL_INVERT - -C StringName - integer*4 GL_VENDOR - parameter ( GL_VENDOR = 7936 ) - integer*4 GL_RENDERER - parameter ( GL_RENDERER = 7937 ) - integer*4 GL_VERSION - parameter ( GL_VERSION = 7938 ) - integer*4 GL_EXTENSIONS - parameter ( GL_EXTENSIONS = 7939 ) - -C TextureCoordName - integer*4 GL_S - parameter ( GL_S = 8192 ) - integer*4 GL_T - parameter ( GL_T = 8193 ) - integer*4 GL_R - parameter ( GL_R = 8194 ) - integer*4 GL_Q - parameter ( GL_Q = 8195 ) - -C TextureEnvMode - integer*4 GL_MODULATE - parameter ( GL_MODULATE = 8448 ) - integer*4 GL_DECAL - parameter ( GL_DECAL = 8449 ) -C GL_BLEND -C GL_REPLACE_EXT - -C TextureEnvParameter - integer*4 GL_TEXTURE_ENV_MODE - parameter ( GL_TEXTURE_ENV_MODE = 8704 ) - integer*4 GL_TEXTURE_ENV_COLOR - parameter ( GL_TEXTURE_ENV_COLOR = 8705 ) - -C TextureEnvTarget - integer*4 GL_TEXTURE_ENV - parameter ( GL_TEXTURE_ENV = 8960 ) - -C TextureGenMode - integer*4 GL_EYE_LINEAR - parameter ( GL_EYE_LINEAR = 9216 ) - integer*4 GL_OBJECT_LINEAR - parameter ( GL_OBJECT_LINEAR = 9217 ) - integer*4 GL_SPHERE_MAP - parameter ( GL_SPHERE_MAP = 9218 ) - -C TextureGenParameter - integer*4 GL_TEXTURE_GEN_MODE - parameter ( GL_TEXTURE_GEN_MODE = 9472 ) - integer*4 GL_OBJECT_PLANE - parameter ( GL_OBJECT_PLANE = 9473 ) - integer*4 GL_EYE_PLANE - parameter ( GL_EYE_PLANE = 9474 ) - -C TextureMagFilter - integer*4 GL_NEAREST - parameter ( GL_NEAREST = 9728 ) - integer*4 GL_LINEAR - parameter ( GL_LINEAR = 9729 ) -C GL_LINEAR_DETAIL_SGIS -C GL_LINEAR_DETAIL_ALPHA_SGIS -C GL_LINEAR_DETAIL_COLOR_SGIS -C GL_LINEAR_SHARPEN_SGIS -C GL_LINEAR_SHARPEN_ALPHA_SGIS -C GL_LINEAR_SHARPEN_COLOR_SGIS - -C TextureMinFilter -C GL_NEAREST -C GL_LINEAR - integer*4 GL_NEAREST_MIPMAP_NEAREST - parameter ( GL_NEAREST_MIPMAP_NEAREST = 9984 ) - integer*4 GL_LINEAR_MIPMAP_NEAREST - parameter ( GL_LINEAR_MIPMAP_NEAREST = 9985 ) - integer*4 GL_NEAREST_MIPMAP_LINEAR - parameter ( GL_NEAREST_MIPMAP_LINEAR = 9986 ) - integer*4 GL_LINEAR_MIPMAP_LINEAR - parameter ( GL_LINEAR_MIPMAP_LINEAR = 9987 ) - -C TextureParameterName - integer*4 GL_TEXTURE_MAG_FILTER - parameter ( GL_TEXTURE_MAG_FILTER = 10240 ) - integer*4 GL_TEXTURE_MIN_FILTER - parameter ( GL_TEXTURE_MIN_FILTER = 10241 ) - integer*4 GL_TEXTURE_WRAP_S - parameter ( GL_TEXTURE_WRAP_S = 10242 ) - integer*4 GL_TEXTURE_WRAP_T - parameter ( GL_TEXTURE_WRAP_T = 10243 ) -C GL_TEXTURE_BORDER_COLOR -C GL_TEXTURE_WRAP_R_EXT -C GL_DETAIL_TEXTURE_LEVEL_SGIS -C GL_DETAIL_TEXTURE_MODE_SGIS - -C TextureTarget -C GL_TEXTURE_1D -C GL_TEXTURE_2D -C GL_PROXY_TEXTURE_1D_EXT -C GL_PROXY_TEXTURE_2D_EXT -C GL_TEXTURE_3D_EXT -C GL_PROXY_TEXTURE_3D_EXT -C GL_DETAIL_TEXTURE_2D_SGIS - -C TextureWrapMode - integer*4 GL_CLAMP - parameter ( GL_CLAMP = 10496 ) - integer*4 GL_REPEAT - parameter ( GL_REPEAT = 10497 ) - -C ClipPlaneName - integer*4 GL_CLIP_PLANE0 - parameter ( GL_CLIP_PLANE0 = 12288 ) - integer*4 GL_CLIP_PLANE1 - parameter ( GL_CLIP_PLANE1 = 12289 ) - integer*4 GL_CLIP_PLANE2 - parameter ( GL_CLIP_PLANE2 = 12290 ) - integer*4 GL_CLIP_PLANE3 - parameter ( GL_CLIP_PLANE3 = 12291 ) - integer*4 GL_CLIP_PLANE4 - parameter ( GL_CLIP_PLANE4 = 12292 ) - integer*4 GL_CLIP_PLANE5 - parameter ( GL_CLIP_PLANE5 = 12293 ) - -C LightName - integer*4 GL_LIGHT0 - parameter ( GL_LIGHT0 = 16384 ) - integer*4 GL_LIGHT1 - parameter ( GL_LIGHT1 = 16385 ) - integer*4 GL_LIGHT2 - parameter ( GL_LIGHT2 = 16386 ) - integer*4 GL_LIGHT3 - parameter ( GL_LIGHT3 = 16387 ) - integer*4 GL_LIGHT4 - parameter ( GL_LIGHT4 = 16388 ) - integer*4 GL_LIGHT5 - parameter ( GL_LIGHT5 = 16389 ) - integer*4 GL_LIGHT6 - parameter ( GL_LIGHT6 = 16390 ) - integer*4 GL_LIGHT7 - parameter ( GL_LIGHT7 = 16391 ) - -C Extensions - integer*4 GL_EXT_abgr - parameter ( GL_EXT_abgr = 1 ) - integer*4 GL_EXT_blend_color - parameter ( GL_EXT_blend_color = 1 ) - integer*4 GL_EXT_blend_logic_op - parameter ( GL_EXT_blend_logic_op = 1 ) - integer*4 GL_EXT_blend_minmax - parameter ( GL_EXT_blend_minmax = 1 ) - integer*4 GL_EXT_blend_subtract - parameter ( GL_EXT_blend_subtract = 1 ) - integer*4 GL_EXT_convolution - parameter ( GL_EXT_convolution = 1 ) - integer*4 GL_EXT_histogram - parameter ( GL_EXT_histogram = 1 ) - integer*4 GL_EXT_polygon_offset - parameter ( GL_EXT_polygon_offset = 1 ) - integer*4 GL_EXT_subtexture - parameter ( GL_EXT_subtexture = 1 ) - integer*4 GL_EXT_texture - parameter ( GL_EXT_texture = 1 ) - integer*4 GL_EXT_texture3D - parameter ( GL_EXT_texture3D = 1 ) - integer*4 GL_SGIS_detail_texture - parameter ( GL_SGIS_detail_texture = 1 ) - integer*4 GL_SGIS_multisample - parameter ( GL_SGIS_multisample = 1 ) - integer*4 GL_SGIS_sharpen_texture - parameter ( GL_SGIS_sharpen_texture = 1 ) - -C EXT_abgr - integer*4 GL_ABGR_EXT - parameter ( GL_ABGR_EXT = 32768 ) - -C EXT_blend_color - integer*4 GL_CONSTANT_COLOR_EXT - parameter ( GL_CONSTANT_COLOR_EXT = 32769 ) - integer*4 GL_ONE_MINUS_CONSTANT_COLOR_EXT - parameter ( GL_ONE_MINUS_CONSTANT_COLOR_EXT = 32770 ) - integer*4 GL_CONSTANT_ALPHA_EXT - parameter ( GL_CONSTANT_ALPHA_EXT = 32771 ) - integer*4 GL_ONE_MINUS_CONSTANT_ALPHA_EXT - parameter ( GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 32772 ) - integer*4 GL_BLEND_COLOR_EXT - parameter ( GL_BLEND_COLOR_EXT = 32773 ) - -C EXT_blend_minmax - integer*4 GL_FUNC_ADD_EXT - parameter ( GL_FUNC_ADD_EXT = 32774 ) - integer*4 GL_MIN_EXT - parameter ( GL_MIN_EXT = 32775 ) - integer*4 GL_MAX_EXT - parameter ( GL_MAX_EXT = 32776 ) - integer*4 GL_BLEND_EQUATION_EXT - parameter ( GL_BLEND_EQUATION_EXT = 32777 ) - -C EXT_blend_subtract - integer*4 GL_FUNC_SUBTRACT_EXT - parameter ( GL_FUNC_SUBTRACT_EXT = 32778 ) - integer*4 GL_FUNC_REVERSE_SUBTRACT_EXT - parameter ( GL_FUNC_REVERSE_SUBTRACT_EXT = 32779 ) - -C EXT_convolution - integer*4 GL_CONVOLUTION_1D_EXT - parameter ( GL_CONVOLUTION_1D_EXT = 32784 ) - integer*4 GL_CONVOLUTION_2D_EXT - parameter ( GL_CONVOLUTION_2D_EXT = 32785 ) - integer*4 GL_SEPARABLE_2D_EXT - parameter ( GL_SEPARABLE_2D_EXT = 32786 ) - integer*4 GL_CONVOLUTION_BORDER_MODE_EXT - parameter ( GL_CONVOLUTION_BORDER_MODE_EXT = 32787 ) - integer*4 GL_CONVOLUTION_FILTER_SCALE_EXT - parameter ( GL_CONVOLUTION_FILTER_SCALE_EXT = 32788 ) - integer*4 GL_CONVOLUTION_FILTER_BIAS_EXT - parameter ( GL_CONVOLUTION_FILTER_BIAS_EXT = 32789 ) - integer*4 GL_REDUCE_EXT - parameter ( GL_REDUCE_EXT = 32790 ) - integer*4 GL_CONVOLUTION_FORMAT_EXT - parameter ( GL_CONVOLUTION_FORMAT_EXT = 32791 ) - integer*4 GL_CONVOLUTION_WIDTH_EXT - parameter ( GL_CONVOLUTION_WIDTH_EXT = 32792 ) - integer*4 GL_CONVOLUTION_HEIGHT_EXT - parameter ( GL_CONVOLUTION_HEIGHT_EXT = 32793 ) - integer*4 GL_MAX_CONVOLUTION_WIDTH_EXT - parameter ( GL_MAX_CONVOLUTION_WIDTH_EXT = 32794 ) - integer*4 GL_MAX_CONVOLUTION_HEIGHT_EXT - parameter ( GL_MAX_CONVOLUTION_HEIGHT_EXT = 32795 ) - integer*4 GL_POST_CONVOLUTION_RED_SCALE_EX - parameter ( GL_POST_CONVOLUTION_RED_SCALE_EX = 32796 ) - integer*4 GL_POST_CONVOLUTION_GREEN_SCALE_ - parameter ( GL_POST_CONVOLUTION_GREEN_SCALE_ = 32797 ) - integer*4 GL_POST_CONVOLUTION_BLUE_SCALE_E - parameter ( GL_POST_CONVOLUTION_BLUE_SCALE_E = 32798 ) - integer*4 GL_POST_CONVOLUTION_ALPHA_SCALE_ - parameter ( GL_POST_CONVOLUTION_ALPHA_SCALE_ = 32799 ) - integer*4 GL_POST_CONVOLUTION_RED_BIAS_EXT - parameter ( GL_POST_CONVOLUTION_RED_BIAS_EXT = 32800 ) - integer*4 GL_POST_CONVOLUTION_GREEN_BIAS_E - parameter ( GL_POST_CONVOLUTION_GREEN_BIAS_E = 32801 ) - integer*4 GL_POST_CONVOLUTION_BLUE_BIAS_EX - parameter ( GL_POST_CONVOLUTION_BLUE_BIAS_EX = 32802 ) - integer*4 GL_POST_CONVOLUTION_ALPHA_BIAS_E - parameter ( GL_POST_CONVOLUTION_ALPHA_BIAS_E = 32803 ) - -C EXT_histogram - integer*4 GL_HISTOGRAM_EXT - parameter ( GL_HISTOGRAM_EXT = 32804 ) - integer*4 GL_PROXY_HISTOGRAM_EXT - parameter ( GL_PROXY_HISTOGRAM_EXT = 32805 ) - integer*4 GL_HISTOGRAM_WIDTH_EXT - parameter ( GL_HISTOGRAM_WIDTH_EXT = 32806 ) - integer*4 GL_HISTOGRAM_FORMAT_EXT - parameter ( GL_HISTOGRAM_FORMAT_EXT = 32807 ) - integer*4 GL_HISTOGRAM_RED_SIZE_EXT - parameter ( GL_HISTOGRAM_RED_SIZE_EXT = 32808 ) - integer*4 GL_HISTOGRAM_GREEN_SIZE_EXT - parameter ( GL_HISTOGRAM_GREEN_SIZE_EXT = 32809 ) - integer*4 GL_HISTOGRAM_BLUE_SIZE_EXT - parameter ( GL_HISTOGRAM_BLUE_SIZE_EXT = 32810 ) - integer*4 GL_HISTOGRAM_ALPHA_SIZE_EXT - parameter ( GL_HISTOGRAM_ALPHA_SIZE_EXT = 32811 ) - integer*4 GL_HISTOGRAM_LUMINANCE_SIZE_EXT - parameter ( GL_HISTOGRAM_LUMINANCE_SIZE_EXT = 32812 ) - integer*4 GL_HISTOGRAM_SINK_EXT - parameter ( GL_HISTOGRAM_SINK_EXT = 32813 ) - integer*4 GL_MINMAX_EXT - parameter ( GL_MINMAX_EXT = 32814 ) - integer*4 GL_MINMAX_FORMAT_EXT - parameter ( GL_MINMAX_FORMAT_EXT = 32815 ) - integer*4 GL_MINMAX_SINK_EXT - parameter ( GL_MINMAX_SINK_EXT = 32816 ) - integer*4 GL_TABLE_TOO_LARGE_EXT - parameter ( GL_TABLE_TOO_LARGE_EXT = 32817 ) - -C EXT_polygon_offset - integer*4 GL_POLYGON_OFFSET_EXT - parameter ( GL_POLYGON_OFFSET_EXT = 32823 ) - integer*4 GL_POLYGON_OFFSET_FACTOR_EXT - parameter ( GL_POLYGON_OFFSET_FACTOR_EXT = 32824 ) - integer*4 GL_POLYGON_OFFSET_BIAS_EXT - parameter ( GL_POLYGON_OFFSET_BIAS_EXT = 32825 ) - -C EXT_texture - integer*4 GL_ALPHA4_EXT - parameter ( GL_ALPHA4_EXT = 32827 ) - integer*4 GL_ALPHA8_EXT - parameter ( GL_ALPHA8_EXT = 32828 ) - integer*4 GL_ALPHA12_EXT - parameter ( GL_ALPHA12_EXT = 32829 ) - integer*4 GL_ALPHA16_EXT - parameter ( GL_ALPHA16_EXT = 32830 ) - integer*4 GL_LUMINANCE4_EXT - parameter ( GL_LUMINANCE4_EXT = 32831 ) - integer*4 GL_LUMINANCE8_EXT - parameter ( GL_LUMINANCE8_EXT = 32832 ) - integer*4 GL_LUMINANCE12_EXT - parameter ( GL_LUMINANCE12_EXT = 32833 ) - integer*4 GL_LUMINANCE16_EXT - parameter ( GL_LUMINANCE16_EXT = 32834 ) - integer*4 GL_LUMINANCE4_ALPHA4_EXT - parameter ( GL_LUMINANCE4_ALPHA4_EXT = 32835 ) - integer*4 GL_LUMINANCE6_ALPHA2_EXT - parameter ( GL_LUMINANCE6_ALPHA2_EXT = 32836 ) - integer*4 GL_LUMINANCE8_ALPHA8_EXT - parameter ( GL_LUMINANCE8_ALPHA8_EXT = 32837 ) - integer*4 GL_LUMINANCE12_ALPHA4_EXT - parameter ( GL_LUMINANCE12_ALPHA4_EXT = 32838 ) - integer*4 GL_LUMINANCE12_ALPHA12_EXT - parameter ( GL_LUMINANCE12_ALPHA12_EXT = 32839 ) - integer*4 GL_LUMINANCE16_ALPHA16_EXT - parameter ( GL_LUMINANCE16_ALPHA16_EXT = 32840 ) - integer*4 GL_INTENSITY_EXT - parameter ( GL_INTENSITY_EXT = 32841 ) - integer*4 GL_INTENSITY4_EXT - parameter ( GL_INTENSITY4_EXT = 32842 ) - integer*4 GL_INTENSITY8_EXT - parameter ( GL_INTENSITY8_EXT = 32843 ) - integer*4 GL_INTENSITY12_EXT - parameter ( GL_INTENSITY12_EXT = 32844 ) - integer*4 GL_INTENSITY16_EXT - parameter ( GL_INTENSITY16_EXT = 32845 ) - integer*4 GL_RGB2_EXT - parameter ( GL_RGB2_EXT = 32846 ) - integer*4 GL_RGB4_EXT - parameter ( GL_RGB4_EXT = 32847 ) - integer*4 GL_RGB5_EXT - parameter ( GL_RGB5_EXT = 32848 ) - integer*4 GL_RGB8_EXT - parameter ( GL_RGB8_EXT = 32849 ) - integer*4 GL_RGB10_EXT - parameter ( GL_RGB10_EXT = 32850 ) - integer*4 GL_RGB12_EXT - parameter ( GL_RGB12_EXT = 32851 ) - integer*4 GL_RGB16_EXT - parameter ( GL_RGB16_EXT = 32852 ) - integer*4 GL_RGBA2_EXT - parameter ( GL_RGBA2_EXT = 32853 ) - integer*4 GL_RGBA4_EXT - parameter ( GL_RGBA4_EXT = 32854 ) - integer*4 GL_RGB5_A1_EXT - parameter ( GL_RGB5_A1_EXT = 32855 ) - integer*4 GL_RGBA8_EXT - parameter ( GL_RGBA8_EXT = 32856 ) - integer*4 GL_RGB10_A2_EXT - parameter ( GL_RGB10_A2_EXT = 32857 ) - integer*4 GL_RGBA12_EXT - parameter ( GL_RGBA12_EXT = 32858 ) - integer*4 GL_RGBA16_EXT - parameter ( GL_RGBA16_EXT = 32859 ) - integer*4 GL_TEXTURE_RED_SIZE_EXT - parameter ( GL_TEXTURE_RED_SIZE_EXT = 32860 ) - integer*4 GL_TEXTURE_GREEN_SIZE_EXT - parameter ( GL_TEXTURE_GREEN_SIZE_EXT = 32861 ) - integer*4 GL_TEXTURE_BLUE_SIZE_EXT - parameter ( GL_TEXTURE_BLUE_SIZE_EXT = 32862 ) - integer*4 GL_TEXTURE_ALPHA_SIZE_EXT - parameter ( GL_TEXTURE_ALPHA_SIZE_EXT = 32863 ) - integer*4 GL_TEXTURE_LUMINANCE_SIZE_EXT - parameter ( GL_TEXTURE_LUMINANCE_SIZE_EXT = 32864 ) - integer*4 GL_TEXTURE_INTENSITY_SIZE_EXT - parameter ( GL_TEXTURE_INTENSITY_SIZE_EXT = 32865 ) - integer*4 GL_REPLACE_EXT - parameter ( GL_REPLACE_EXT = 32866 ) - integer*4 GL_PROXY_TEXTURE_1D_EXT - parameter ( GL_PROXY_TEXTURE_1D_EXT = 32867 ) - integer*4 GL_PROXY_TEXTURE_2D_EXT - parameter ( GL_PROXY_TEXTURE_2D_EXT = 32868 ) - integer*4 GL_TEXTURE_TOO_LARGE_EXT - parameter ( GL_TEXTURE_TOO_LARGE_EXT = 32869 ) - -C EXT_texture3D - integer*4 GL_PACK_SKIP_IMAGES_EXT - parameter ( GL_PACK_SKIP_IMAGES_EXT = 32875 ) - integer*4 GL_PACK_IMAGE_HEIGHT_EXT - parameter ( GL_PACK_IMAGE_HEIGHT_EXT = 32876 ) - integer*4 GL_UNPACK_SKIP_IMAGES_EXT - parameter ( GL_UNPACK_SKIP_IMAGES_EXT = 32877 ) - integer*4 GL_UNPACK_IMAGE_HEIGHT_EXT - parameter ( GL_UNPACK_IMAGE_HEIGHT_EXT = 32878 ) - integer*4 GL_TEXTURE_3D_EXT - parameter ( GL_TEXTURE_3D_EXT = 32879 ) - integer*4 GL_PROXY_TEXTURE_3D_EXT - parameter ( GL_PROXY_TEXTURE_3D_EXT = 32880 ) - integer*4 GL_TEXTURE_DEPTH_EXT - parameter ( GL_TEXTURE_DEPTH_EXT = 32881 ) - integer*4 GL_TEXTURE_WRAP_R_EXT - parameter ( GL_TEXTURE_WRAP_R_EXT = 32882 ) - integer*4 GL_MAX_3D_TEXTURE_SIZE_EXT - parameter ( GL_MAX_3D_TEXTURE_SIZE_EXT = 32883 ) - -C SGIS_detail_texture - integer*4 GL_DETAIL_TEXTURE_2D_SGIS - parameter ( GL_DETAIL_TEXTURE_2D_SGIS = 32917 ) - integer*4 GL_DETAIL_TEXTURE_2D_BINDING_SGI - parameter ( GL_DETAIL_TEXTURE_2D_BINDING_SGI = 32918 ) - integer*4 GL_LINEAR_DETAIL_SGIS - parameter ( GL_LINEAR_DETAIL_SGIS = 32919 ) - integer*4 GL_LINEAR_DETAIL_ALPHA_SGIS - parameter ( GL_LINEAR_DETAIL_ALPHA_SGIS = 32920 ) - integer*4 GL_LINEAR_DETAIL_COLOR_SGIS - parameter ( GL_LINEAR_DETAIL_COLOR_SGIS = 32921 ) - integer*4 GL_DETAIL_TEXTURE_LEVEL_SGIS - parameter ( GL_DETAIL_TEXTURE_LEVEL_SGIS = 32922 ) - integer*4 GL_DETAIL_TEXTURE_MODE_SGIS - parameter ( GL_DETAIL_TEXTURE_MODE_SGIS = 32923 ) - integer*4 GL_DETAIL_TEXTURE_FUNC_POINTS_S - parameter ( GL_DETAIL_TEXTURE_FUNC_POINTS_S = 32924 ) - -C SGIS_multisample - integer*4 GL_MULTISAMPLE_BIT_EXT - parameter ( GL_MULTISAMPLE_BIT_EXT = 536870912 ) - integer*4 GL_MULTISAMPLE_SGIS - parameter ( GL_MULTISAMPLE_SGIS = 32925 ) - integer*4 GL_SAMPLE_ALPHA_TO_MASK_SGIS - parameter ( GL_SAMPLE_ALPHA_TO_MASK_SGIS = 32926 ) - integer*4 GL_SAMPLE_ALPHA_TO_ONE_SGIS - parameter ( GL_SAMPLE_ALPHA_TO_ONE_SGIS = 32927 ) - integer*4 GL_SAMPLE_MASK_SGIS - parameter ( GL_SAMPLE_MASK_SGIS = 32928 ) - integer*4 GL_1PASS_SGIS - parameter ( GL_1PASS_SGIS = 32929 ) - integer*4 GL_2PASS_0_SGIS - parameter ( GL_2PASS_0_SGIS = 32930 ) - integer*4 GL_2PASS_1_SGIS - parameter ( GL_2PASS_1_SGIS = 32931 ) - integer*4 GL_4PASS_0_SGIS - parameter ( GL_4PASS_0_SGIS = 32932 ) - integer*4 GL_4PASS_1_SGIS - parameter ( GL_4PASS_1_SGIS = 32933 ) - integer*4 GL_4PASS_2_SGIS - parameter ( GL_4PASS_2_SGIS = 32934 ) - integer*4 GL_4PASS_3_SGIS - parameter ( GL_4PASS_3_SGIS = 32935 ) - integer*4 GL_SAMPLE_BUFFERS_SGIS - parameter ( GL_SAMPLE_BUFFERS_SGIS = 32936 ) - integer*4 GL_SAMPLES_SGIS - parameter ( GL_SAMPLES_SGIS = 32937 ) - integer*4 GL_SAMPLE_MASK_VALUE_SGIS - parameter ( GL_SAMPLE_MASK_VALUE_SGIS = 32938 ) - integer*4 GL_SAMPLE_MASK_INVERT_SGIS - parameter ( GL_SAMPLE_MASK_INVERT_SGIS = 32939 ) - integer*4 GL_SAMPLE_PATTERN_SGIS - parameter ( GL_SAMPLE_PATTERN_SGIS = 32940 ) - -C SGIS_sharpen_texture - integer*4 GL_LINEAR_SHARPEN_SGIS - parameter ( GL_LINEAR_SHARPEN_SGIS = 32941 ) - integer*4 GL_LINEAR_SHARPEN_ALPHA_SGIS - parameter ( GL_LINEAR_SHARPEN_ALPHA_SGIS = 32942 ) - integer*4 GL_LINEAR_SHARPEN_COLOR_SGIS - parameter ( GL_LINEAR_SHARPEN_COLOR_SGIS = 32943 ) - integer*4 GL_SHARPEN_TEXTURE_FUNC_POINTS_S - parameter ( GL_SHARPEN_TEXTURE_FUNC_POINTS_S = 32944 ) - -C *********************************************************** - - - character*128 fglGetString - integer fglGetError - integer*4 fglRenderMode - logical*1 fglAreTexturesResidentEXT - logical*1 fglIsEnabled - logical*1 fglIsList - logical*1 fglIsTextureEXT - logical*4 fglGenLists - logical*4 fglGenTexturesEXT + +C GLUT version of "GL/fgl.h" + +C Modifications from SGI IRIX 5.3 version: +C 1) F prefix removed from OpenGL constants. +C 2) Constants over 32 characters truncated to 32 characters. + +C *********************************************************** + +C AttribMask + integer*4 GL_CURRENT_BIT + parameter ( GL_CURRENT_BIT = 1 ) + integer*4 GL_POINT_BIT + parameter ( GL_POINT_BIT = 2 ) + integer*4 GL_LINE_BIT + parameter ( GL_LINE_BIT = 4 ) + integer*4 GL_POLYGON_BIT + parameter ( GL_POLYGON_BIT = 8 ) + integer*4 GL_POLYGON_STIPPLE_BIT + parameter ( GL_POLYGON_STIPPLE_BIT = 16 ) + integer*4 GL_PIXEL_MODE_BIT + parameter ( GL_PIXEL_MODE_BIT = 32 ) + integer*4 GL_LIGHTING_BIT + parameter ( GL_LIGHTING_BIT = 64 ) + integer*4 GL_FOG_BIT + parameter ( GL_FOG_BIT = 128 ) + integer*4 GL_DEPTH_BUFFER_BIT + parameter ( GL_DEPTH_BUFFER_BIT = 256 ) + integer*4 GL_ACCUM_BUFFER_BIT + parameter ( GL_ACCUM_BUFFER_BIT = 512 ) + integer*4 GL_STENCIL_BUFFER_BIT + parameter ( GL_STENCIL_BUFFER_BIT = 1024 ) + integer*4 GL_VIEWPORT_BIT + parameter ( GL_VIEWPORT_BIT = 2048 ) + integer*4 GL_TRANSFORM_BIT + parameter ( GL_TRANSFORM_BIT = 4096 ) + integer*4 GL_ENABLE_BIT + parameter ( GL_ENABLE_BIT = 8192 ) + integer*4 GL_COLOR_BUFFER_BIT + parameter ( GL_COLOR_BUFFER_BIT = 16384 ) + integer*4 GL_HINT_BIT + parameter ( GL_HINT_BIT = 32768 ) + integer*4 GL_EVAL_BIT + parameter ( GL_EVAL_BIT = 65536 ) + integer*4 GL_LIST_BIT + parameter ( GL_LIST_BIT = 131072 ) + integer*4 GL_TEXTURE_BIT + parameter ( GL_TEXTURE_BIT = 262144 ) + integer*4 GL_SCISSOR_BIT + parameter ( GL_SCISSOR_BIT = 524288 ) + integer*4 GL_ALL_ATTRIB_BITS + parameter ( GL_ALL_ATTRIB_BITS = 1048575 ) +C GL_MULTISAMPLE_BIT_EXT + +C ClearBufferMask +C GL_COLOR_BUFFER_BIT +C GL_ACCUM_BUFFER_BIT +C GL_STENCIL_BUFFER_BIT +C GL_DEPTH_BUFFER_BIT + +C Boolean + integer*4 GL_FALSE + parameter ( GL_FALSE = 0 ) + integer*4 GL_TRUE + parameter ( GL_TRUE = 1 ) + +C BeginMode + integer*4 GL_POINTS + parameter ( GL_POINTS = 0 ) + integer*4 GL_LINES + parameter ( GL_LINES = 1 ) + integer*4 GL_LINE_LOOP + parameter ( GL_LINE_LOOP = 2 ) + integer*4 GL_LINE_STRIP + parameter ( GL_LINE_STRIP = 3 ) + integer*4 GL_TRIANGLES + parameter ( GL_TRIANGLES = 4 ) + integer*4 GL_TRIANGLE_STRIP + parameter ( GL_TRIANGLE_STRIP = 5 ) + integer*4 GL_TRIANGLE_FAN + parameter ( GL_TRIANGLE_FAN = 6 ) + integer*4 GL_QUADS + parameter ( GL_QUADS = 7 ) + integer*4 GL_QUAD_STRIP + parameter ( GL_QUAD_STRIP = 8 ) + integer*4 GL_POLYGON + parameter ( GL_POLYGON = 9 ) + +C AccumOp + integer*4 GL_ACCUM + parameter ( GL_ACCUM = 256 ) + integer*4 GL_LOAD + parameter ( GL_LOAD = 257 ) + integer*4 GL_RETURN + parameter ( GL_RETURN = 258 ) + integer*4 GL_MULT + parameter ( GL_MULT = 259 ) + integer*4 GL_ADD + parameter ( GL_ADD = 260 ) + +C AlphaFunction + integer*4 GL_NEVER + parameter ( GL_NEVER = 512 ) + integer*4 GL_LESS + parameter ( GL_LESS = 513 ) + integer*4 GL_EQUAL + parameter ( GL_EQUAL = 514 ) + integer*4 GL_LEQUAL + parameter ( GL_LEQUAL = 515 ) + integer*4 GL_GREATER + parameter ( GL_GREATER = 516 ) + integer*4 GL_NOTEQUAL + parameter ( GL_NOTEQUAL = 517 ) + integer*4 GL_GEQUAL + parameter ( GL_GEQUAL = 518 ) + integer*4 GL_ALWAYS + parameter ( GL_ALWAYS = 519 ) + +C BlendingFactorDest + integer*4 GL_ZERO + parameter ( GL_ZERO = 0 ) + integer*4 GL_ONE + parameter ( GL_ONE = 1 ) + integer*4 GL_SRC_COLOR + parameter ( GL_SRC_COLOR = 768 ) + integer*4 GL_ONE_MINUS_SRC_COLOR + parameter ( GL_ONE_MINUS_SRC_COLOR = 769 ) + integer*4 GL_SRC_ALPHA + parameter ( GL_SRC_ALPHA = 770 ) + integer*4 GL_ONE_MINUS_SRC_ALPHA + parameter ( GL_ONE_MINUS_SRC_ALPHA = 771 ) + integer*4 GL_DST_ALPHA + parameter ( GL_DST_ALPHA = 772 ) + integer*4 GL_ONE_MINUS_DST_ALPHA + parameter ( GL_ONE_MINUS_DST_ALPHA = 773 ) +C GL_CONSTANT_COLOR_EXT +C GL_ONE_MINUS_CONSTANT_COLOR_EXT +C GL_CONSTANT_ALPHA_EXT +C GL_ONE_MINUS_CONSTANT_ALPHA_EXT + +C BlendingFactorSrc +C GL_ZERO +C GL_ONE + integer*4 GL_DST_COLOR + parameter ( GL_DST_COLOR = 774 ) + integer*4 GL_ONE_MINUS_DST_COLOR + parameter ( GL_ONE_MINUS_DST_COLOR = 775 ) + integer*4 GL_SRC_ALPHA_SATURATE + parameter ( GL_SRC_ALPHA_SATURATE = 776 ) +C GL_SRC_ALPHA +C GL_ONE_MINUS_SRC_ALPHA +C GL_DST_ALPHA +C GL_ONE_MINUS_DST_ALPHA +C GL_CONSTANT_COLOR_EXT +C GL_ONE_MINUS_CONSTANT_COLOR_EXT +C GL_CONSTANT_ALPHA_EXT +C GL_ONE_MINUS_CONSTANT_ALPHA_EXT + +C BlendingMode +C GL_LOGIC_OP +C GL_FUNC_ADD_EXT +C GL_MIN_EXT +C GL_MAX_EXT +C GL_FUNC_SUBTRACT_EXT +C GL_FUNC_REVERSE_SUBTRACT_EXT + +C ColorMaterialFace +C GL_FRONT +C GL_BACK +C GL_FRONT_AND_BACK + +C ColorMaterialParameter +C GL_AMBIENT +C GL_DIFFUSE +C GL_SPECULAR +C GL_EMISSION +C GL_AMBIENT_AND_DIFFUSE + +C ConvolutionBorderMode +C GL_REDUCE_EXT + +C ConvolutionParameter +C GL_CONVOLUTION_BORDER_MODE_EXT +C GL_CONVOLUTION_FILTER_SCALE_EXT +C GL_CONVOLUTION_FILTER_BIAS_EXT + +C ConvolutionTarget +C GL_CONVOLUTION_1D_EXT +C GL_CONVOLUTION_2D_EXT + +C CullFaceMode +C GL_FRONT +C GL_BACK +C GL_FRONT_AND_BACK + +C DepthFunction +C GL_NEVER +C GL_LESS +C GL_EQUAL +C GL_LEQUAL +C GL_GREATER +C GL_NOTEQUAL +C GL_GEQUAL +C GL_ALWAYS + +C DrawBufferMode + integer*4 GL_NONE + parameter ( GL_NONE = 0 ) + integer*4 GL_FRONT_LEFT + parameter ( GL_FRONT_LEFT = 1024 ) + integer*4 GL_FRONT_RIGHT + parameter ( GL_FRONT_RIGHT = 1025 ) + integer*4 GL_BACK_LEFT + parameter ( GL_BACK_LEFT = 1026 ) + integer*4 GL_BACK_RIGHT + parameter ( GL_BACK_RIGHT = 1027 ) + integer*4 GL_FRONT + parameter ( GL_FRONT = 1028 ) + integer*4 GL_BACK + parameter ( GL_BACK = 1029 ) + integer*4 GL_LEFT + parameter ( GL_LEFT = 1030 ) + integer*4 GL_RIGHT + parameter ( GL_RIGHT = 1031 ) + integer*4 GL_FRONT_AND_BACK + parameter ( GL_FRONT_AND_BACK = 1032 ) + integer*4 GL_AUX0 + parameter ( GL_AUX0 = 1033 ) + integer*4 GL_AUX1 + parameter ( GL_AUX1 = 1034 ) + integer*4 GL_AUX2 + parameter ( GL_AUX2 = 1035 ) + integer*4 GL_AUX3 + parameter ( GL_AUX3 = 1036 ) + +C Enable +C GL_FOG +C GL_LIGHTING +C GL_TEXTURE_1D +C GL_TEXTURE_2D +C GL_LINE_STIPPLE +C GL_POLYGON_STIPPLE +C GL_CULL_FACE +C GL_ALPHA_TEST +C GL_BLEND +C GL_LOGIC_OP +C GL_DITHER +C GL_STENCIL_TEST +C GL_DEPTH_TEST +C GL_CLIP_PLANE0 +C GL_CLIP_PLANE1 +C GL_CLIP_PLANE2 +C GL_CLIP_PLANE3 +C GL_CLIP_PLANE4 +C GL_CLIP_PLANE5 +C GL_LIGHT0 +C GL_LIGHT1 +C GL_LIGHT2 +C GL_LIGHT3 +C GL_LIGHT4 +C GL_LIGHT5 +C GL_LIGHT6 +C GL_LIGHT7 +C GL_TEXTURE_GEN_S +C GL_TEXTURE_GEN_T +C GL_TEXTURE_GEN_R +C GL_TEXTURE_GEN_Q +C GL_MAP1_VERTEX_3 +C GL_MAP1_VERTEX_4 +C GL_MAP1_COLOR_4 +C GL_MAP1_INDEX +C GL_MAP1_NORMAL +C GL_MAP1_TEXTURE_COORD_1 +C GL_MAP1_TEXTURE_COORD_2 +C GL_MAP1_TEXTURE_COORD_3 +C GL_MAP1_TEXTURE_COORD_4 +C GL_MAP2_VERTEX_3 +C GL_MAP2_VERTEX_4 +C GL_MAP2_COLOR_4 +C GL_MAP2_INDEX +C GL_MAP2_NORMAL +C GL_MAP2_TEXTURE_COORD_1 +C GL_MAP2_TEXTURE_COORD_2 +C GL_MAP2_TEXTURE_COORD_3 +C GL_MAP2_TEXTURE_COORD_4 +C GL_POINT_SMOOTH +C GL_LINE_SMOOTH +C GL_POLYGON_SMOOTH +C GL_SCISSOR_TEST +C GL_COLOR_MATERIAL +C GL_NORMALIZE +C GL_AUTO_NORMAL +C GL_CONVOLUTION_1D_EXT +C GL_CONVOLUTION_2D_EXT +C GL_SEPARABLE_2D_EXT +C GL_HISTOGRAM_EXT +C GL_MINMAX_EXT +C GL_POLYGON_OFFSET_EXT +C GL_TEXTURE_3D_EXT +C GL_MULTISAMPLE_SGIS +C GL_SAMPLE_ALPHA_TO_MASK_SGIS +C GL_SAMPLE_ALPHA_TO_ONE_SGIS +C GL_SAMPLE_MASK_SGIS + +C ErrorCode + integer*4 GL_NO_ERROR + parameter ( GL_NO_ERROR = 0 ) + integer*4 GL_INVALID_ENUM + parameter ( GL_INVALID_ENUM = 1280 ) + integer*4 GL_INVALID_VALUE + parameter ( GL_INVALID_VALUE = 1281 ) + integer*4 GL_INVALID_OPERATION + parameter ( GL_INVALID_OPERATION = 1282 ) + integer*4 GL_STACK_OVERFLOW + parameter ( GL_STACK_OVERFLOW = 1283 ) + integer*4 GL_STACK_UNDERFLOW + parameter ( GL_STACK_UNDERFLOW = 1284 ) + integer*4 GL_OUT_OF_MEMORY + parameter ( GL_OUT_OF_MEMORY = 1285 ) +C GL_TABLE_TOO_LARGE_EXT +C GL_TEXTURE_TOO_LARGE_EXT + +C FeedBackMode + integer*4 GL_2D + parameter ( GL_2D = 1536 ) + integer*4 GL_3D + parameter ( GL_3D = 1537 ) + integer*4 GL_3D_COLOR + parameter ( GL_3D_COLOR = 1538 ) + integer*4 GL_3D_COLOR_TEXTURE + parameter ( GL_3D_COLOR_TEXTURE = 1539 ) + integer*4 GL_4D_COLOR_TEXTURE + parameter ( GL_4D_COLOR_TEXTURE = 1540 ) + +C FeedBackToken + integer*4 GL_PASS_THROUGH_TOKEN + parameter ( GL_PASS_THROUGH_TOKEN = 1792 ) + integer*4 GL_POINT_TOKEN + parameter ( GL_POINT_TOKEN = 1793 ) + integer*4 GL_LINE_TOKEN + parameter ( GL_LINE_TOKEN = 1794 ) + integer*4 GL_POLYGON_TOKEN + parameter ( GL_POLYGON_TOKEN = 1795 ) + integer*4 GL_BITMAP_TOKEN + parameter ( GL_BITMAP_TOKEN = 1796 ) + integer*4 GL_DRAW_PIXEL_TOKEN + parameter ( GL_DRAW_PIXEL_TOKEN = 1797 ) + integer*4 GL_COPY_PIXEL_TOKEN + parameter ( GL_COPY_PIXEL_TOKEN = 1798 ) + integer*4 GL_LINE_RESET_TOKEN + parameter ( GL_LINE_RESET_TOKEN = 1799 ) + +C FogMode +C GL_LINEAR + integer*4 GL_EXP + parameter ( GL_EXP = 2048 ) + integer*4 GL_EXP2 + parameter ( GL_EXP2 = 2049 ) + +C FogParameter +C GL_FOG_COLOR +C GL_FOG_DENSITY +C GL_FOG_END +C GL_FOG_INDEX +C GL_FOG_MODE +C GL_FOG_START + +C FrontFaceDirection + integer*4 GL_CW + parameter ( GL_CW = 2304 ) + integer*4 GL_CCW + parameter ( GL_CCW = 2305 ) + +C GetConvolutionParameter +C GL_CONVOLUTION_BORDER_MODE_EXT +C GL_CONVOLUTION_FILTER_SCALE_EXT +C GL_CONVOLUTION_FILTER_BIAS_EXT +C GL_CONVOLUTION_FORMAT_EXT +C GL_CONVOLUTION_WIDTH_EXT +C GL_CONVOLUTION_HEIGHT_EXT +C GL_MAX_CONVOLUTION_WIDTH_EXT +C GL_MAX_CONVOLUTION_HEIGHT_EXT + +C GetHistogramParameter +C GL_HISTOGRAM_WIDTH_EXT +C GL_HISTOGRAM_FORMAT_EXT +C GL_HISTOGRAM_RED_SIZE_EXT +C GL_HISTOGRAM_GREEN_SIZE_EXT +C GL_HISTOGRAM_BLUE_SIZE_EXT +C GL_HISTOGRAM_ALPHA_SIZE_EXT +C GL_HISTOGRAM_LUMINANCE_SIZE_EXT +C GL_HISTOGRAM_SINK_EXT + +C GetMapTarget + integer*4 GL_COEFF + parameter ( GL_COEFF = 2560 ) + integer*4 GL_ORDER + parameter ( GL_ORDER = 2561 ) + integer*4 GL_DOMAIN + parameter ( GL_DOMAIN = 2562 ) + +C GetMinmaxParameter +C GL_MINMAX_FORMAT_EXT +C GL_MINMAX_SINK_EXT + +C GetPixelMap + integer*4 GL_PIXEL_MAP_I_TO_I + parameter ( GL_PIXEL_MAP_I_TO_I = 3184 ) + integer*4 GL_PIXEL_MAP_S_TO_S + parameter ( GL_PIXEL_MAP_S_TO_S = 3185 ) + integer*4 GL_PIXEL_MAP_I_TO_R + parameter ( GL_PIXEL_MAP_I_TO_R = 3186 ) + integer*4 GL_PIXEL_MAP_I_TO_G + parameter ( GL_PIXEL_MAP_I_TO_G = 3187 ) + integer*4 GL_PIXEL_MAP_I_TO_B + parameter ( GL_PIXEL_MAP_I_TO_B = 3188 ) + integer*4 GL_PIXEL_MAP_I_TO_A + parameter ( GL_PIXEL_MAP_I_TO_A = 3189 ) + integer*4 GL_PIXEL_MAP_R_TO_R + parameter ( GL_PIXEL_MAP_R_TO_R = 3190 ) + integer*4 GL_PIXEL_MAP_G_TO_G + parameter ( GL_PIXEL_MAP_G_TO_G = 3191 ) + integer*4 GL_PIXEL_MAP_B_TO_B + parameter ( GL_PIXEL_MAP_B_TO_B = 3192 ) + integer*4 GL_PIXEL_MAP_A_TO_A + parameter ( GL_PIXEL_MAP_A_TO_A = 3193 ) + +C GetTarget + integer*4 GL_CURRENT_COLOR + parameter ( GL_CURRENT_COLOR = 2816 ) + integer*4 GL_CURRENT_INDEX + parameter ( GL_CURRENT_INDEX = 2817 ) + integer*4 GL_CURRENT_NORMAL + parameter ( GL_CURRENT_NORMAL = 2818 ) + integer*4 GL_CURRENT_TEXTURE_COORDS + parameter ( GL_CURRENT_TEXTURE_COORDS = 2819 ) + integer*4 GL_CURRENT_RASTER_COLOR + parameter ( GL_CURRENT_RASTER_COLOR = 2820 ) + integer*4 GL_CURRENT_RASTER_INDEX + parameter ( GL_CURRENT_RASTER_INDEX = 2821 ) + integer*4 GL_CURRENT_RASTER_TEXTURE_COORDS + parameter ( GL_CURRENT_RASTER_TEXTURE_COORDS = 2822 ) + integer*4 GL_CURRENT_RASTER_POSITION + parameter ( GL_CURRENT_RASTER_POSITION = 2823 ) + integer*4 GL_CURRENT_RASTER_POSITION_VALID + parameter ( GL_CURRENT_RASTER_POSITION_VALID = 2824 ) + integer*4 GL_CURRENT_RASTER_DISTANCE + parameter ( GL_CURRENT_RASTER_DISTANCE = 2825 ) + integer*4 GL_POINT_SMOOTH + parameter ( GL_POINT_SMOOTH = 2832 ) + integer*4 GL_POINT_SIZE + parameter ( GL_POINT_SIZE = 2833 ) + integer*4 GL_POINT_SIZE_RANGE + parameter ( GL_POINT_SIZE_RANGE = 2834 ) + integer*4 GL_POINT_SIZE_GRANULARITY + parameter ( GL_POINT_SIZE_GRANULARITY = 2835 ) + integer*4 GL_LINE_SMOOTH + parameter ( GL_LINE_SMOOTH = 2848 ) + integer*4 GL_LINE_WIDTH + parameter ( GL_LINE_WIDTH = 2849 ) + integer*4 GL_LINE_WIDTH_RANGE + parameter ( GL_LINE_WIDTH_RANGE = 2850 ) + integer*4 GL_LINE_WIDTH_GRANULARITY + parameter ( GL_LINE_WIDTH_GRANULARITY = 2851 ) + integer*4 GL_LINE_STIPPLE + parameter ( GL_LINE_STIPPLE = 2852 ) + integer*4 GL_LINE_STIPPLE_PATTERN + parameter ( GL_LINE_STIPPLE_PATTERN = 2853 ) + integer*4 GL_LINE_STIPPLE_REPEAT + parameter ( GL_LINE_STIPPLE_REPEAT = 2854 ) + integer*4 GL_LIST_MODE + parameter ( GL_LIST_MODE = 2864 ) + integer*4 GL_MAX_LIST_NESTING + parameter ( GL_MAX_LIST_NESTING = 2865 ) + integer*4 GL_LIST_BASE + parameter ( GL_LIST_BASE = 2866 ) + integer*4 GL_LIST_INDEX + parameter ( GL_LIST_INDEX = 2867 ) + integer*4 GL_POLYGON_MODE + parameter ( GL_POLYGON_MODE = 2880 ) + integer*4 GL_POLYGON_SMOOTH + parameter ( GL_POLYGON_SMOOTH = 2881 ) + integer*4 GL_POLYGON_STIPPLE + parameter ( GL_POLYGON_STIPPLE = 2882 ) + integer*4 GL_EDGE_FLAG + parameter ( GL_EDGE_FLAG = 2883 ) + integer*4 GL_CULL_FACE + parameter ( GL_CULL_FACE = 2884 ) + integer*4 GL_CULL_FACE_MODE + parameter ( GL_CULL_FACE_MODE = 2885 ) + integer*4 GL_FRONT_FACE + parameter ( GL_FRONT_FACE = 2886 ) + integer*4 GL_LIGHTING + parameter ( GL_LIGHTING = 2896 ) + integer*4 GL_LIGHT_MODEL_LOCAL_VIEWER + parameter ( GL_LIGHT_MODEL_LOCAL_VIEWER = 2897 ) + integer*4 GL_LIGHT_MODEL_TWO_SIDE + parameter ( GL_LIGHT_MODEL_TWO_SIDE = 2898 ) + integer*4 GL_LIGHT_MODEL_AMBIENT + parameter ( GL_LIGHT_MODEL_AMBIENT = 2899 ) + integer*4 GL_SHADE_MODEL + parameter ( GL_SHADE_MODEL = 2900 ) + integer*4 GL_COLOR_MATERIAL_FACE + parameter ( GL_COLOR_MATERIAL_FACE = 2901 ) + integer*4 GL_COLOR_MATERIAL_PARAMETER + parameter ( GL_COLOR_MATERIAL_PARAMETER = 2902 ) + integer*4 GL_COLOR_MATERIAL + parameter ( GL_COLOR_MATERIAL = 2903 ) + integer*4 GL_FOG + parameter ( GL_FOG = 2912 ) + integer*4 GL_FOG_INDEX + parameter ( GL_FOG_INDEX = 2913 ) + integer*4 GL_FOG_DENSITY + parameter ( GL_FOG_DENSITY = 2914 ) + integer*4 GL_FOG_START + parameter ( GL_FOG_START = 2915 ) + integer*4 GL_FOG_END + parameter ( GL_FOG_END = 2916 ) + integer*4 GL_FOG_MODE + parameter ( GL_FOG_MODE = 2917 ) + integer*4 GL_FOG_COLOR + parameter ( GL_FOG_COLOR = 2918 ) + integer*4 GL_DEPTH_RANGE + parameter ( GL_DEPTH_RANGE = 2928 ) + integer*4 GL_DEPTH_TEST + parameter ( GL_DEPTH_TEST = 2929 ) + integer*4 GL_DEPTH_WRITEMASK + parameter ( GL_DEPTH_WRITEMASK = 2930 ) + integer*4 GL_DEPTH_CLEAR_VALUE + parameter ( GL_DEPTH_CLEAR_VALUE = 2931 ) + integer*4 GL_DEPTH_FUNC + parameter ( GL_DEPTH_FUNC = 2932 ) + integer*4 GL_ACCUM_CLEAR_VALUE + parameter ( GL_ACCUM_CLEAR_VALUE = 2944 ) + integer*4 GL_STENCIL_TEST + parameter ( GL_STENCIL_TEST = 2960 ) + integer*4 GL_STENCIL_CLEAR_VALUE + parameter ( GL_STENCIL_CLEAR_VALUE = 2961 ) + integer*4 GL_STENCIL_FUNC + parameter ( GL_STENCIL_FUNC = 2962 ) + integer*4 GL_STENCIL_VALUE_MASK + parameter ( GL_STENCIL_VALUE_MASK = 2963 ) + integer*4 GL_STENCIL_FAIL + parameter ( GL_STENCIL_FAIL = 2964 ) + integer*4 GL_STENCIL_PASS_DEPTH_FAIL + parameter ( GL_STENCIL_PASS_DEPTH_FAIL = 2965 ) + integer*4 GL_STENCIL_PASS_DEPTH_PASS + parameter ( GL_STENCIL_PASS_DEPTH_PASS = 2966 ) + integer*4 GL_STENCIL_REF + parameter ( GL_STENCIL_REF = 2967 ) + integer*4 GL_STENCIL_WRITEMASK + parameter ( GL_STENCIL_WRITEMASK = 2968 ) + integer*4 GL_MATRIX_MODE + parameter ( GL_MATRIX_MODE = 2976 ) + integer*4 GL_NORMALIZE + parameter ( GL_NORMALIZE = 2977 ) + integer*4 GL_VIEWPORT + parameter ( GL_VIEWPORT = 2978 ) + integer*4 GL_MODELVIEW_STACK_DEPTH + parameter ( GL_MODELVIEW_STACK_DEPTH = 2979 ) + integer*4 GL_PROJECTION_STACK_DEPTH + parameter ( GL_PROJECTION_STACK_DEPTH = 2980 ) + integer*4 GL_TEXTURE_STACK_DEPTH + parameter ( GL_TEXTURE_STACK_DEPTH = 2981 ) + integer*4 GL_MODELVIEW_MATRIX + parameter ( GL_MODELVIEW_MATRIX = 2982 ) + integer*4 GL_PROJECTION_MATRIX + parameter ( GL_PROJECTION_MATRIX = 2983 ) + integer*4 GL_TEXTURE_MATRIX + parameter ( GL_TEXTURE_MATRIX = 2984 ) + integer*4 GL_ATTRIB_STACK_DEPTH + parameter ( GL_ATTRIB_STACK_DEPTH = 2992 ) + integer*4 GL_ALPHA_TEST + parameter ( GL_ALPHA_TEST = 3008 ) + integer*4 GL_ALPHA_TEST_FUNC + parameter ( GL_ALPHA_TEST_FUNC = 3009 ) + integer*4 GL_ALPHA_TEST_REF + parameter ( GL_ALPHA_TEST_REF = 3010 ) + integer*4 GL_DITHER + parameter ( GL_DITHER = 3024 ) + integer*4 GL_BLEND_DST + parameter ( GL_BLEND_DST = 3040 ) + integer*4 GL_BLEND_SRC + parameter ( GL_BLEND_SRC = 3041 ) + integer*4 GL_BLEND + parameter ( GL_BLEND = 3042 ) + integer*4 GL_LOGIC_OP_MODE + parameter ( GL_LOGIC_OP_MODE = 3056 ) + integer*4 GL_LOGIC_OP + parameter ( GL_LOGIC_OP = 3057 ) + integer*4 GL_AUX_BUFFERS + parameter ( GL_AUX_BUFFERS = 3072 ) + integer*4 GL_DRAW_BUFFER + parameter ( GL_DRAW_BUFFER = 3073 ) + integer*4 GL_READ_BUFFER + parameter ( GL_READ_BUFFER = 3074 ) + integer*4 GL_SCISSOR_BOX + parameter ( GL_SCISSOR_BOX = 3088 ) + integer*4 GL_SCISSOR_TEST + parameter ( GL_SCISSOR_TEST = 3089 ) + integer*4 GL_INDEX_CLEAR_VALUE + parameter ( GL_INDEX_CLEAR_VALUE = 3104 ) + integer*4 GL_INDEX_WRITEMASK + parameter ( GL_INDEX_WRITEMASK = 3105 ) + integer*4 GL_COLOR_CLEAR_VALUE + parameter ( GL_COLOR_CLEAR_VALUE = 3106 ) + integer*4 GL_COLOR_WRITEMASK + parameter ( GL_COLOR_WRITEMASK = 3107 ) + integer*4 GL_INDEX_MODE + parameter ( GL_INDEX_MODE = 3120 ) + integer*4 GL_RGBA_MODE + parameter ( GL_RGBA_MODE = 3121 ) + integer*4 GL_DOUBLEBUFFER + parameter ( GL_DOUBLEBUFFER = 3122 ) + integer*4 GL_STEREO + parameter ( GL_STEREO = 3123 ) + integer*4 GL_RENDER_MODE + parameter ( GL_RENDER_MODE = 3136 ) + integer*4 GL_PERSPECTIVE_CORRECTION_HINT + parameter ( GL_PERSPECTIVE_CORRECTION_HINT = 3152 ) + integer*4 GL_POINT_SMOOTH_HINT + parameter ( GL_POINT_SMOOTH_HINT = 3153 ) + integer*4 GL_LINE_SMOOTH_HINT + parameter ( GL_LINE_SMOOTH_HINT = 3154 ) + integer*4 GL_POLYGON_SMOOTH_HINT + parameter ( GL_POLYGON_SMOOTH_HINT = 3155 ) + integer*4 GL_FOG_HINT + parameter ( GL_FOG_HINT = 3156 ) + integer*4 GL_TEXTURE_GEN_S + parameter ( GL_TEXTURE_GEN_S = 3168 ) + integer*4 GL_TEXTURE_GEN_T + parameter ( GL_TEXTURE_GEN_T = 3169 ) + integer*4 GL_TEXTURE_GEN_R + parameter ( GL_TEXTURE_GEN_R = 3170 ) + integer*4 GL_TEXTURE_GEN_Q + parameter ( GL_TEXTURE_GEN_Q = 3171 ) + integer*4 GL_PIXEL_MAP_I_TO_I_SIZE + parameter ( GL_PIXEL_MAP_I_TO_I_SIZE = 3248 ) + integer*4 GL_PIXEL_MAP_S_TO_S_SIZE + parameter ( GL_PIXEL_MAP_S_TO_S_SIZE = 3249 ) + integer*4 GL_PIXEL_MAP_I_TO_R_SIZE + parameter ( GL_PIXEL_MAP_I_TO_R_SIZE = 3250 ) + integer*4 GL_PIXEL_MAP_I_TO_G_SIZE + parameter ( GL_PIXEL_MAP_I_TO_G_SIZE = 3251 ) + integer*4 GL_PIXEL_MAP_I_TO_B_SIZE + parameter ( GL_PIXEL_MAP_I_TO_B_SIZE = 3252 ) + integer*4 GL_PIXEL_MAP_I_TO_A_SIZE + parameter ( GL_PIXEL_MAP_I_TO_A_SIZE = 3253 ) + integer*4 GL_PIXEL_MAP_R_TO_R_SIZE + parameter ( GL_PIXEL_MAP_R_TO_R_SIZE = 3254 ) + integer*4 GL_PIXEL_MAP_G_TO_G_SIZE + parameter ( GL_PIXEL_MAP_G_TO_G_SIZE = 3255 ) + integer*4 GL_PIXEL_MAP_B_TO_B_SIZE + parameter ( GL_PIXEL_MAP_B_TO_B_SIZE = 3256 ) + integer*4 GL_PIXEL_MAP_A_TO_A_SIZE + parameter ( GL_PIXEL_MAP_A_TO_A_SIZE = 3257 ) + integer*4 GL_UNPACK_SWAP_BYTES + parameter ( GL_UNPACK_SWAP_BYTES = 3312 ) + integer*4 GL_UNPACK_LSB_FIRST + parameter ( GL_UNPACK_LSB_FIRST = 3313 ) + integer*4 GL_UNPACK_ROW_LENGTH + parameter ( GL_UNPACK_ROW_LENGTH = 3314 ) + integer*4 GL_UNPACK_SKIP_ROWS + parameter ( GL_UNPACK_SKIP_ROWS = 3315 ) + integer*4 GL_UNPACK_SKIP_PIXELS + parameter ( GL_UNPACK_SKIP_PIXELS = 3316 ) + integer*4 GL_UNPACK_ALIGNMENT + parameter ( GL_UNPACK_ALIGNMENT = 3317 ) + integer*4 GL_PACK_SWAP_BYTES + parameter ( GL_PACK_SWAP_BYTES = 3328 ) + integer*4 GL_PACK_LSB_FIRST + parameter ( GL_PACK_LSB_FIRST = 3329 ) + integer*4 GL_PACK_ROW_LENGTH + parameter ( GL_PACK_ROW_LENGTH = 3330 ) + integer*4 GL_PACK_SKIP_ROWS + parameter ( GL_PACK_SKIP_ROWS = 3331 ) + integer*4 GL_PACK_SKIP_PIXELS + parameter ( GL_PACK_SKIP_PIXELS = 3332 ) + integer*4 GL_PACK_ALIGNMENT + parameter ( GL_PACK_ALIGNMENT = 3333 ) + integer*4 GL_MAP_COLOR + parameter ( GL_MAP_COLOR = 3344 ) + integer*4 GL_MAP_STENCIL + parameter ( GL_MAP_STENCIL = 3345 ) + integer*4 GL_INDEX_SHIFT + parameter ( GL_INDEX_SHIFT = 3346 ) + integer*4 GL_INDEX_OFFSET + parameter ( GL_INDEX_OFFSET = 3347 ) + integer*4 GL_RED_SCALE + parameter ( GL_RED_SCALE = 3348 ) + integer*4 GL_RED_BIAS + parameter ( GL_RED_BIAS = 3349 ) + integer*4 GL_ZOOM_X + parameter ( GL_ZOOM_X = 3350 ) + integer*4 GL_ZOOM_Y + parameter ( GL_ZOOM_Y = 3351 ) + integer*4 GL_GREEN_SCALE + parameter ( GL_GREEN_SCALE = 3352 ) + integer*4 GL_GREEN_BIAS + parameter ( GL_GREEN_BIAS = 3353 ) + integer*4 GL_BLUE_SCALE + parameter ( GL_BLUE_SCALE = 3354 ) + integer*4 GL_BLUE_BIAS + parameter ( GL_BLUE_BIAS = 3355 ) + integer*4 GL_ALPHA_SCALE + parameter ( GL_ALPHA_SCALE = 3356 ) + integer*4 GL_ALPHA_BIAS + parameter ( GL_ALPHA_BIAS = 3357 ) + integer*4 GL_DEPTH_SCALE + parameter ( GL_DEPTH_SCALE = 3358 ) + integer*4 GL_DEPTH_BIAS + parameter ( GL_DEPTH_BIAS = 3359 ) + integer*4 GL_MAX_EVAL_ORDER + parameter ( GL_MAX_EVAL_ORDER = 3376 ) + integer*4 GL_MAX_LIGHTS + parameter ( GL_MAX_LIGHTS = 3377 ) + integer*4 GL_MAX_CLIP_PLANES + parameter ( GL_MAX_CLIP_PLANES = 3378 ) + integer*4 GL_MAX_TEXTURE_SIZE + parameter ( GL_MAX_TEXTURE_SIZE = 3379 ) + integer*4 GL_MAX_PIXEL_MAP_TABLE + parameter ( GL_MAX_PIXEL_MAP_TABLE = 3380 ) + integer*4 GL_MAX_ATTRIB_STACK_DEPTH + parameter ( GL_MAX_ATTRIB_STACK_DEPTH = 3381 ) + integer*4 GL_MAX_MODELVIEW_STACK_DEPTH + parameter ( GL_MAX_MODELVIEW_STACK_DEPTH = 3382 ) + integer*4 GL_MAX_NAME_STACK_DEPTH + parameter ( GL_MAX_NAME_STACK_DEPTH = 3383 ) + integer*4 GL_MAX_PROJECTION_STACK_DEPTH + parameter ( GL_MAX_PROJECTION_STACK_DEPTH = 3384 ) + integer*4 GL_MAX_TEXTURE_STACK_DEPTH + parameter ( GL_MAX_TEXTURE_STACK_DEPTH = 3385 ) + integer*4 GL_MAX_VIEWPORT_DIMS + parameter ( GL_MAX_VIEWPORT_DIMS = 3386 ) + integer*4 GL_SUBPIXEL_BITS + parameter ( GL_SUBPIXEL_BITS = 3408 ) + integer*4 GL_INDEX_BITS + parameter ( GL_INDEX_BITS = 3409 ) + integer*4 GL_RED_BITS + parameter ( GL_RED_BITS = 3410 ) + integer*4 GL_GREEN_BITS + parameter ( GL_GREEN_BITS = 3411 ) + integer*4 GL_BLUE_BITS + parameter ( GL_BLUE_BITS = 3412 ) + integer*4 GL_ALPHA_BITS + parameter ( GL_ALPHA_BITS = 3413 ) + integer*4 GL_DEPTH_BITS + parameter ( GL_DEPTH_BITS = 3414 ) + integer*4 GL_STENCIL_BITS + parameter ( GL_STENCIL_BITS = 3415 ) + integer*4 GL_ACCUM_RED_BITS + parameter ( GL_ACCUM_RED_BITS = 3416 ) + integer*4 GL_ACCUM_GREEN_BITS + parameter ( GL_ACCUM_GREEN_BITS = 3417 ) + integer*4 GL_ACCUM_BLUE_BITS + parameter ( GL_ACCUM_BLUE_BITS = 3418 ) + integer*4 GL_ACCUM_ALPHA_BITS + parameter ( GL_ACCUM_ALPHA_BITS = 3419 ) + integer*4 GL_NAME_STACK_DEPTH + parameter ( GL_NAME_STACK_DEPTH = 3440 ) + integer*4 GL_AUTO_NORMAL + parameter ( GL_AUTO_NORMAL = 3456 ) + integer*4 GL_MAP1_COLOR_4 + parameter ( GL_MAP1_COLOR_4 = 3472 ) + integer*4 GL_MAP1_INDEX + parameter ( GL_MAP1_INDEX = 3473 ) + integer*4 GL_MAP1_NORMAL + parameter ( GL_MAP1_NORMAL = 3474 ) + integer*4 GL_MAP1_TEXTURE_COORD_1 + parameter ( GL_MAP1_TEXTURE_COORD_1 = 3475 ) + integer*4 GL_MAP1_TEXTURE_COORD_2 + parameter ( GL_MAP1_TEXTURE_COORD_2 = 3476 ) + integer*4 GL_MAP1_TEXTURE_COORD_3 + parameter ( GL_MAP1_TEXTURE_COORD_3 = 3477 ) + integer*4 GL_MAP1_TEXTURE_COORD_4 + parameter ( GL_MAP1_TEXTURE_COORD_4 = 3478 ) + integer*4 GL_MAP1_VERTEX_3 + parameter ( GL_MAP1_VERTEX_3 = 3479 ) + integer*4 GL_MAP1_VERTEX_4 + parameter ( GL_MAP1_VERTEX_4 = 3480 ) + integer*4 GL_MAP2_COLOR_4 + parameter ( GL_MAP2_COLOR_4 = 3504 ) + integer*4 GL_MAP2_INDEX + parameter ( GL_MAP2_INDEX = 3505 ) + integer*4 GL_MAP2_NORMAL + parameter ( GL_MAP2_NORMAL = 3506 ) + integer*4 GL_MAP2_TEXTURE_COORD_1 + parameter ( GL_MAP2_TEXTURE_COORD_1 = 3507 ) + integer*4 GL_MAP2_TEXTURE_COORD_2 + parameter ( GL_MAP2_TEXTURE_COORD_2 = 3508 ) + integer*4 GL_MAP2_TEXTURE_COORD_3 + parameter ( GL_MAP2_TEXTURE_COORD_3 = 3509 ) + integer*4 GL_MAP2_TEXTURE_COORD_4 + parameter ( GL_MAP2_TEXTURE_COORD_4 = 3510 ) + integer*4 GL_MAP2_VERTEX_3 + parameter ( GL_MAP2_VERTEX_3 = 3511 ) + integer*4 GL_MAP2_VERTEX_4 + parameter ( GL_MAP2_VERTEX_4 = 3512 ) + integer*4 GL_MAP1_GRID_DOMAIN + parameter ( GL_MAP1_GRID_DOMAIN = 3536 ) + integer*4 GL_MAP1_GRID_SEGMENTS + parameter ( GL_MAP1_GRID_SEGMENTS = 3537 ) + integer*4 GL_MAP2_GRID_DOMAIN + parameter ( GL_MAP2_GRID_DOMAIN = 3538 ) + integer*4 GL_MAP2_GRID_SEGMENTS + parameter ( GL_MAP2_GRID_SEGMENTS = 3539 ) + integer*4 GL_TEXTURE_1D + parameter ( GL_TEXTURE_1D = 3552 ) + integer*4 GL_TEXTURE_2D + parameter ( GL_TEXTURE_2D = 3553 ) +C GL_BLEND_COLOR_EXT +C GL_BLEND_EQUATION_EXT +C GL_CONVOLUTION_1D_EXT +C GL_CONVOLUTION_2D_EXT +C GL_SEPARABLE_2D_EXT +C GL_POST_CONVOLUTION_RED_SCALE_EXT +C GL_POST_CONVOLUTION_GREEN_SCALE_EXT +C GL_POST_CONVOLUTION_BLUE_SCALE_EXT +C GL_POST_CONVOLUTION_ALPHA_SCALE_EXT +C GL_POST_CONVOLUTION_RED_BIAS_EXT +C GL_POST_CONVOLUTION_GREEN_BIAS_EXT +C GL_POST_CONVOLUTION_BLUE_BIAS_EXT +C GL_POST_CONVOLUTION_ALPHA_BIAS_EXT +C GL_HISTOGRAM_EXT +C GL_MINMAX_EXT +C GL_POLYGON_OFFSET_EXT +C GL_POLYGON_OFFSET_FACTOR_EXT +C GL_POLYGON_OFFSET_BIAS_EXT +C GL_PACK_SKIP_IMAGES_EXT +C GL_PACK_IMAGE_HEIGHT_EXT +C GL_UNPACK_SKIP_IMAGES_EXT +C GL_UNPACK_IMAGE_HEIGHT_EXT +C GL_TEXTURE_3D_EXT +C GL_MAX_3D_TEXTURE_SIZE_EXT +C GL_DETAIL_TEXTURE_2D_BINDING_SGIS +C GL_MULTISAMPLE_SGIS +C GL_SAMPLE_ALPHA_TO_MASK_SGIS +C GL_SAMPLE_ALPHA_TO_ONE_SGIS +C GL_SAMPLE_MASK_SGIS +C GL_SAMPLE_BUFFERS_SGIS +C GL_SAMPLES_SGIS +C GL_SAMPLE_MASK_VALUE_SGIS +C GL_SAMPLE_MASK_INVERT_SGIS +C GL_SAMPLE_PATTERN_SGIS + +C GetTextureParameter +C GL_TEXTURE_MAG_FILTER +C GL_TEXTURE_MIN_FILTER +C GL_TEXTURE_WRAP_S +C GL_TEXTURE_WRAP_T + integer*4 GL_TEXTURE_WIDTH + parameter ( GL_TEXTURE_WIDTH = 4096 ) + integer*4 GL_TEXTURE_HEIGHT + parameter ( GL_TEXTURE_HEIGHT = 4097 ) + integer*4 GL_TEXTURE_COMPONENTS + parameter ( GL_TEXTURE_COMPONENTS = 4099 ) + integer*4 GL_TEXTURE_BORDER_COLOR + parameter ( GL_TEXTURE_BORDER_COLOR = 4100 ) + integer*4 GL_TEXTURE_BORDER + parameter ( GL_TEXTURE_BORDER = 4101 ) +C GL_TEXTURE_RED_SIZE_EXT +C GL_TEXTURE_GREEN_SIZE_EXT +C GL_TEXTURE_BLUE_SIZE_EXT +C GL_TEXTURE_ALPHA_SIZE_EXT +C GL_TEXTURE_LUMINANCE_SIZE_EXT +C GL_TEXTURE_INTENSITY_SIZE_EXT +C GL_TEXTURE_DEPTH_EXT +C GL_TEXTURE_WRAP_R_EXT +C GL_DETAIL_TEXTURE_LEVEL_SGIS +C GL_DETAIL_TEXTURE_MODE_SGIS +C GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS +C GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS + +C HintMode + integer*4 GL_DONT_CARE + parameter ( GL_DONT_CARE = 4352 ) + integer*4 GL_FASTEST + parameter ( GL_FASTEST = 4353 ) + integer*4 GL_NICEST + parameter ( GL_NICEST = 4354 ) + +C HintTarget +C GL_PERSPECTIVE_CORRECTION_HINT +C GL_POINT_SMOOTH_HINT +C GL_LINE_SMOOTH_HINT +C GL_POLYGON_SMOOTH_HINT +C GL_FOG_HINT + +C HistogramTarget +C GL_HISTOGRAM_EXT +C GL_PROXY_HISTOGRAM_EXT + +C LightModelParameter +C GL_LIGHT_MODEL_AMBIENT +C GL_LIGHT_MODEL_LOCAL_VIEWER +C GL_LIGHT_MODEL_TWO_SIDE + +C LightParameter + integer*4 GL_AMBIENT + parameter ( GL_AMBIENT = 4608 ) + integer*4 GL_DIFFUSE + parameter ( GL_DIFFUSE = 4609 ) + integer*4 GL_SPECULAR + parameter ( GL_SPECULAR = 4610 ) + integer*4 GL_POSITION + parameter ( GL_POSITION = 4611 ) + integer*4 GL_SPOT_DIRECTION + parameter ( GL_SPOT_DIRECTION = 4612 ) + integer*4 GL_SPOT_EXPONENT + parameter ( GL_SPOT_EXPONENT = 4613 ) + integer*4 GL_SPOT_CUTOFF + parameter ( GL_SPOT_CUTOFF = 4614 ) + integer*4 GL_CONSTANT_ATTENUATION + parameter ( GL_CONSTANT_ATTENUATION = 4615 ) + integer*4 GL_LINEAR_ATTENUATION + parameter ( GL_LINEAR_ATTENUATION = 4616 ) + integer*4 GL_QUADRATIC_ATTENUATION + parameter ( GL_QUADRATIC_ATTENUATION = 4617 ) + +C ListMode + integer*4 GL_COMPILE + parameter ( GL_COMPILE = 4864 ) + integer*4 GL_COMPILE_AND_EXECUTE + parameter ( GL_COMPILE_AND_EXECUTE = 4865 ) + +C ListNameType + integer*4 GL_BYTE + parameter ( GL_BYTE = 5120 ) + integer*4 GL_UNSIGNED_BYTE + parameter ( GL_UNSIGNED_BYTE = 5121 ) + integer*4 GL_SHORT + parameter ( GL_SHORT = 5122 ) + integer*4 GL_UNSIGNED_SHORT + parameter ( GL_UNSIGNED_SHORT = 5123 ) + integer*4 GL_INT + parameter ( GL_INT = 5124 ) + integer*4 GL_UNSIGNED_INT + parameter ( GL_UNSIGNED_INT = 5125 ) + integer*4 GL_FLOAT + parameter ( GL_FLOAT = 5126 ) + integer*4 GL_2_BYTES + parameter ( GL_2_BYTES = 5127 ) + integer*4 GL_3_BYTES + parameter ( GL_3_BYTES = 5128 ) + integer*4 GL_4_BYTES + parameter ( GL_4_BYTES = 5129 ) + +C LogicOp + integer*4 GL_CLEAR + parameter ( GL_CLEAR = 5376 ) + integer*4 GL_AND + parameter ( GL_AND = 5377 ) + integer*4 GL_AND_REVERSE + parameter ( GL_AND_REVERSE = 5378 ) + integer*4 GL_COPY + parameter ( GL_COPY = 5379 ) + integer*4 GL_AND_INVERTED + parameter ( GL_AND_INVERTED = 5380 ) + integer*4 GL_NOOP + parameter ( GL_NOOP = 5381 ) + integer*4 GL_XOR + parameter ( GL_XOR = 5382 ) + integer*4 GL_OR + parameter ( GL_OR = 5383 ) + integer*4 GL_NOR + parameter ( GL_NOR = 5384 ) + integer*4 GL_EQUIV + parameter ( GL_EQUIV = 5385 ) + integer*4 GL_INVERT + parameter ( GL_INVERT = 5386 ) + integer*4 GL_OR_REVERSE + parameter ( GL_OR_REVERSE = 5387 ) + integer*4 GL_COPY_INVERTED + parameter ( GL_COPY_INVERTED = 5388 ) + integer*4 GL_OR_INVERTED + parameter ( GL_OR_INVERTED = 5389 ) + integer*4 GL_NAND + parameter ( GL_NAND = 5390 ) + integer*4 GL_SET + parameter ( GL_SET = 5391 ) + +C MapTarget +C GL_MAP1_COLOR_4 +C GL_MAP1_INDEX +C GL_MAP1_NORMAL +C GL_MAP1_TEXTURE_COORD_1 +C GL_MAP1_TEXTURE_COORD_2 +C GL_MAP1_TEXTURE_COORD_3 +C GL_MAP1_TEXTURE_COORD_4 +C GL_MAP1_VERTEX_3 +C GL_MAP1_VERTEX_4 +C GL_MAP2_COLOR_4 +C GL_MAP2_INDEX +C GL_MAP2_NORMAL +C GL_MAP2_TEXTURE_COORD_1 +C GL_MAP2_TEXTURE_COORD_2 +C GL_MAP2_TEXTURE_COORD_3 +C GL_MAP2_TEXTURE_COORD_4 +C GL_MAP2_VERTEX_3 +C GL_MAP2_VERTEX_4 + +C MaterialFace +C GL_FRONT +C GL_BACK +C GL_FRONT_AND_BACK + +C MaterialParameter + integer*4 GL_EMISSION + parameter ( GL_EMISSION = 5632 ) + integer*4 GL_SHININESS + parameter ( GL_SHININESS = 5633 ) + integer*4 GL_AMBIENT_AND_DIFFUSE + parameter ( GL_AMBIENT_AND_DIFFUSE = 5634 ) + integer*4 GL_COLOR_INDEXES + parameter ( GL_COLOR_INDEXES = 5635 ) +C GL_AMBIENT +C GL_DIFFUSE +C GL_SPECULAR + +C MatrixMode + integer*4 GL_MODELVIEW + parameter ( GL_MODELVIEW = 5888 ) + integer*4 GL_PROJECTION + parameter ( GL_PROJECTION = 5889 ) + integer*4 GL_TEXTURE + parameter ( GL_TEXTURE = 5890 ) + +C MeshMode1 +C GL_POINT +C GL_LINE + +C MeshMode2 +C GL_POINT +C GL_LINE +C GL_FILL + +C MinmaxTarget +C GL_MINMAX_EXT + +C PixelCopyType + integer*4 GL_COLOR + parameter ( GL_COLOR = 6144 ) + integer*4 GL_DEPTH + parameter ( GL_DEPTH = 6145 ) + integer*4 GL_STENCIL + parameter ( GL_STENCIL = 6146 ) + +C PixelFormat + integer*4 GL_COLOR_INDEX + parameter ( GL_COLOR_INDEX = 6400 ) + integer*4 GL_STENCIL_INDEX + parameter ( GL_STENCIL_INDEX = 6401 ) + integer*4 GL_DEPTH_COMPONENT + parameter ( GL_DEPTH_COMPONENT = 6402 ) + integer*4 GL_RED + parameter ( GL_RED = 6403 ) + integer*4 GL_GREEN + parameter ( GL_GREEN = 6404 ) + integer*4 GL_BLUE + parameter ( GL_BLUE = 6405 ) + integer*4 GL_ALPHA + parameter ( GL_ALPHA = 6406 ) + integer*4 GL_RGB + parameter ( GL_RGB = 6407 ) + integer*4 GL_RGBA + parameter ( GL_RGBA = 6408 ) + integer*4 GL_LUMINANCE + parameter ( GL_LUMINANCE = 6409 ) + integer*4 GL_LUMINANCE_ALPHA + parameter ( GL_LUMINANCE_ALPHA = 6410 ) +C GL_ABGR_EXT + +C PixelInternalFormat +C GL_ALPHA4_EXT +C GL_ALPHA8_EXT +C GL_ALPHA12_EXT +C GL_ALPHA16_EXT +C GL_LUMINANCE4_EXT +C GL_LUMINANCE8_EXT +C GL_LUMINANCE12_EXT +C GL_LUMINANCE16_EXT +C GL_LUMINANCE4_ALPHA4_EXT +C GL_LUMINANCE6_ALPHA2_EXT +C GL_LUMINANCE8_ALPHA8_EXT +C GL_LUMINANCE12_ALPHA4_EXT +C GL_LUMINANCE12_ALPHA12_EXT +C GL_LUMINANCE16_ALPHA16_EXT +C GL_INTENSITY_EXT +C GL_INTENSITY4_EXT +C GL_INTENSITY8_EXT +C GL_INTENSITY12_EXT +C GL_INTENSITY16_EXT +C GL_RGB2_EXT +C GL_RGB4_EXT +C GL_RGB5_EXT +C GL_RGB8_EXT +C GL_RGB10_EXT +C GL_RGB12_EXT +C GL_RGB16_EXT +C GL_RGBA2_EXT +C GL_RGBA4_EXT +C GL_RGB5_A1_EXT +C GL_RGBA8_EXT +C GL_RGB10_A2_EXT +C GL_RGBA12_EXT +C GL_RGBA16_EXT + +C PixelMap +C GL_PIXEL_MAP_I_TO_I +C GL_PIXEL_MAP_S_TO_S +C GL_PIXEL_MAP_I_TO_R +C GL_PIXEL_MAP_I_TO_G +C GL_PIXEL_MAP_I_TO_B +C GL_PIXEL_MAP_I_TO_A +C GL_PIXEL_MAP_R_TO_R +C GL_PIXEL_MAP_G_TO_G +C GL_PIXEL_MAP_B_TO_B +C GL_PIXEL_MAP_A_TO_A + +C PixelStore +C GL_UNPACK_SWAP_BYTES +C GL_UNPACK_LSB_FIRST +C GL_UNPACK_ROW_LENGTH +C GL_UNPACK_SKIP_ROWS +C GL_UNPACK_SKIP_PIXELS +C GL_UNPACK_ALIGNMENT +C GL_PACK_SWAP_BYTES +C GL_PACK_LSB_FIRST +C GL_PACK_ROW_LENGTH +C GL_PACK_SKIP_ROWS +C GL_PACK_SKIP_PIXELS +C GL_PACK_ALIGNMENT +C GL_PACK_SKIP_IMAGES_EXT +C GL_PACK_IMAGE_HEIGHT_EXT +C GL_UNPACK_SKIP_IMAGES_EXT +C GL_UNPACK_IMAGE_HEIGHT_EXT + +C PixelTransfer +C GL_MAP_COLOR +C GL_MAP_STENCIL +C GL_INDEX_SHIFT +C GL_INDEX_OFFSET +C GL_RED_SCALE +C GL_RED_BIAS +C GL_GREEN_SCALE +C GL_GREEN_BIAS +C GL_BLUE_SCALE +C GL_BLUE_BIAS +C GL_ALPHA_SCALE +C GL_ALPHA_BIAS +C GL_DEPTH_SCALE +C GL_DEPTH_BIAS +C GL_POST_CONVOLUTION_RED_SCALE_EXT +C GL_POST_CONVOLUTION_GREEN_SCALE_EXT +C GL_POST_CONVOLUTION_BLUE_SCALE_EXT +C GL_POST_CONVOLUTION_ALPHA_SCALE_EXT +C GL_POST_CONVOLUTION_RED_BIAS_EXT +C GL_POST_CONVOLUTION_GREEN_BIAS_EXT +C GL_POST_CONVOLUTION_BLUE_BIAS_EXT +C GL_POST_CONVOLUTION_ALPHA_BIAS_EXT + +C PixelType + integer*4 GL_BITMAP + parameter ( GL_BITMAP = 6656 ) +C GL_BYTE +C GL_UNSIGNED_BYTE +C GL_SHORT +C GL_UNSIGNED_SHORT +C GL_INT +C GL_UNSIGNED_INT +C GL_FLOAT + +C PolygonMode + integer*4 GL_POINT + parameter ( GL_POINT = 6912 ) + integer*4 GL_LINE + parameter ( GL_LINE = 6913 ) + integer*4 GL_FILL + parameter ( GL_FILL = 6914 ) + +C ReadBufferMode +C GL_FRONT_LEFT +C GL_FRONT_RIGHT +C GL_BACK_LEFT +C GL_BACK_RIGHT +C GL_FRONT +C GL_BACK +C GL_LEFT +C GL_RIGHT +C GL_AUX0 +C GL_AUX1 +C GL_AUX2 +C GL_AUX3 + +C RenderingMode + integer*4 GL_RENDER + parameter ( GL_RENDER = 7168 ) + integer*4 GL_FEEDBACK + parameter ( GL_FEEDBACK = 7169 ) + integer*4 GL_SELECT + parameter ( GL_SELECT = 7170 ) + +C SamplePattern +C GL_1PASS_SGIS +C GL_2PASS_0_SGIS +C GL_2PASS_1_SGIS +C GL_4PASS_0_SGIS +C GL_4PASS_1_SGIS +C GL_4PASS_2_SGIS +C GL_4PASS_3_SGIS + +C SeparableTarget +C GL_SEPARABLE_2D_EXT + +C ShadingModel + integer*4 GL_FLAT + parameter ( GL_FLAT = 7424 ) + integer*4 GL_SMOOTH + parameter ( GL_SMOOTH = 7425 ) + +C StencilFunction +C GL_NEVER +C GL_LESS +C GL_EQUAL +C GL_LEQUAL +C GL_GREATER +C GL_NOTEQUAL +C GL_GEQUAL +C GL_ALWAYS + +C StencilOp +C GL_ZERO + integer*4 GL_KEEP + parameter ( GL_KEEP = 7680 ) + integer*4 GL_REPLACE + parameter ( GL_REPLACE = 7681 ) + integer*4 GL_INCR + parameter ( GL_INCR = 7682 ) + integer*4 GL_DECR + parameter ( GL_DECR = 7683 ) +C GL_INVERT + +C StringName + integer*4 GL_VENDOR + parameter ( GL_VENDOR = 7936 ) + integer*4 GL_RENDERER + parameter ( GL_RENDERER = 7937 ) + integer*4 GL_VERSION + parameter ( GL_VERSION = 7938 ) + integer*4 GL_EXTENSIONS + parameter ( GL_EXTENSIONS = 7939 ) + +C TextureCoordName + integer*4 GL_S + parameter ( GL_S = 8192 ) + integer*4 GL_T + parameter ( GL_T = 8193 ) + integer*4 GL_R + parameter ( GL_R = 8194 ) + integer*4 GL_Q + parameter ( GL_Q = 8195 ) + +C TextureEnvMode + integer*4 GL_MODULATE + parameter ( GL_MODULATE = 8448 ) + integer*4 GL_DECAL + parameter ( GL_DECAL = 8449 ) +C GL_BLEND +C GL_REPLACE_EXT + +C TextureEnvParameter + integer*4 GL_TEXTURE_ENV_MODE + parameter ( GL_TEXTURE_ENV_MODE = 8704 ) + integer*4 GL_TEXTURE_ENV_COLOR + parameter ( GL_TEXTURE_ENV_COLOR = 8705 ) + +C TextureEnvTarget + integer*4 GL_TEXTURE_ENV + parameter ( GL_TEXTURE_ENV = 8960 ) + +C TextureGenMode + integer*4 GL_EYE_LINEAR + parameter ( GL_EYE_LINEAR = 9216 ) + integer*4 GL_OBJECT_LINEAR + parameter ( GL_OBJECT_LINEAR = 9217 ) + integer*4 GL_SPHERE_MAP + parameter ( GL_SPHERE_MAP = 9218 ) + +C TextureGenParameter + integer*4 GL_TEXTURE_GEN_MODE + parameter ( GL_TEXTURE_GEN_MODE = 9472 ) + integer*4 GL_OBJECT_PLANE + parameter ( GL_OBJECT_PLANE = 9473 ) + integer*4 GL_EYE_PLANE + parameter ( GL_EYE_PLANE = 9474 ) + +C TextureMagFilter + integer*4 GL_NEAREST + parameter ( GL_NEAREST = 9728 ) + integer*4 GL_LINEAR + parameter ( GL_LINEAR = 9729 ) +C GL_LINEAR_DETAIL_SGIS +C GL_LINEAR_DETAIL_ALPHA_SGIS +C GL_LINEAR_DETAIL_COLOR_SGIS +C GL_LINEAR_SHARPEN_SGIS +C GL_LINEAR_SHARPEN_ALPHA_SGIS +C GL_LINEAR_SHARPEN_COLOR_SGIS + +C TextureMinFilter +C GL_NEAREST +C GL_LINEAR + integer*4 GL_NEAREST_MIPMAP_NEAREST + parameter ( GL_NEAREST_MIPMAP_NEAREST = 9984 ) + integer*4 GL_LINEAR_MIPMAP_NEAREST + parameter ( GL_LINEAR_MIPMAP_NEAREST = 9985 ) + integer*4 GL_NEAREST_MIPMAP_LINEAR + parameter ( GL_NEAREST_MIPMAP_LINEAR = 9986 ) + integer*4 GL_LINEAR_MIPMAP_LINEAR + parameter ( GL_LINEAR_MIPMAP_LINEAR = 9987 ) + +C TextureParameterName + integer*4 GL_TEXTURE_MAG_FILTER + parameter ( GL_TEXTURE_MAG_FILTER = 10240 ) + integer*4 GL_TEXTURE_MIN_FILTER + parameter ( GL_TEXTURE_MIN_FILTER = 10241 ) + integer*4 GL_TEXTURE_WRAP_S + parameter ( GL_TEXTURE_WRAP_S = 10242 ) + integer*4 GL_TEXTURE_WRAP_T + parameter ( GL_TEXTURE_WRAP_T = 10243 ) +C GL_TEXTURE_BORDER_COLOR +C GL_TEXTURE_WRAP_R_EXT +C GL_DETAIL_TEXTURE_LEVEL_SGIS +C GL_DETAIL_TEXTURE_MODE_SGIS + +C TextureTarget +C GL_TEXTURE_1D +C GL_TEXTURE_2D +C GL_PROXY_TEXTURE_1D_EXT +C GL_PROXY_TEXTURE_2D_EXT +C GL_TEXTURE_3D_EXT +C GL_PROXY_TEXTURE_3D_EXT +C GL_DETAIL_TEXTURE_2D_SGIS + +C TextureWrapMode + integer*4 GL_CLAMP + parameter ( GL_CLAMP = 10496 ) + integer*4 GL_REPEAT + parameter ( GL_REPEAT = 10497 ) + +C ClipPlaneName + integer*4 GL_CLIP_PLANE0 + parameter ( GL_CLIP_PLANE0 = 12288 ) + integer*4 GL_CLIP_PLANE1 + parameter ( GL_CLIP_PLANE1 = 12289 ) + integer*4 GL_CLIP_PLANE2 + parameter ( GL_CLIP_PLANE2 = 12290 ) + integer*4 GL_CLIP_PLANE3 + parameter ( GL_CLIP_PLANE3 = 12291 ) + integer*4 GL_CLIP_PLANE4 + parameter ( GL_CLIP_PLANE4 = 12292 ) + integer*4 GL_CLIP_PLANE5 + parameter ( GL_CLIP_PLANE5 = 12293 ) + +C LightName + integer*4 GL_LIGHT0 + parameter ( GL_LIGHT0 = 16384 ) + integer*4 GL_LIGHT1 + parameter ( GL_LIGHT1 = 16385 ) + integer*4 GL_LIGHT2 + parameter ( GL_LIGHT2 = 16386 ) + integer*4 GL_LIGHT3 + parameter ( GL_LIGHT3 = 16387 ) + integer*4 GL_LIGHT4 + parameter ( GL_LIGHT4 = 16388 ) + integer*4 GL_LIGHT5 + parameter ( GL_LIGHT5 = 16389 ) + integer*4 GL_LIGHT6 + parameter ( GL_LIGHT6 = 16390 ) + integer*4 GL_LIGHT7 + parameter ( GL_LIGHT7 = 16391 ) + +C Extensions + integer*4 GL_EXT_abgr + parameter ( GL_EXT_abgr = 1 ) + integer*4 GL_EXT_blend_color + parameter ( GL_EXT_blend_color = 1 ) + integer*4 GL_EXT_blend_logic_op + parameter ( GL_EXT_blend_logic_op = 1 ) + integer*4 GL_EXT_blend_minmax + parameter ( GL_EXT_blend_minmax = 1 ) + integer*4 GL_EXT_blend_subtract + parameter ( GL_EXT_blend_subtract = 1 ) + integer*4 GL_EXT_convolution + parameter ( GL_EXT_convolution = 1 ) + integer*4 GL_EXT_histogram + parameter ( GL_EXT_histogram = 1 ) + integer*4 GL_EXT_polygon_offset + parameter ( GL_EXT_polygon_offset = 1 ) + integer*4 GL_EXT_subtexture + parameter ( GL_EXT_subtexture = 1 ) + integer*4 GL_EXT_texture + parameter ( GL_EXT_texture = 1 ) + integer*4 GL_EXT_texture3D + parameter ( GL_EXT_texture3D = 1 ) + integer*4 GL_SGIS_detail_texture + parameter ( GL_SGIS_detail_texture = 1 ) + integer*4 GL_SGIS_multisample + parameter ( GL_SGIS_multisample = 1 ) + integer*4 GL_SGIS_sharpen_texture + parameter ( GL_SGIS_sharpen_texture = 1 ) + +C EXT_abgr + integer*4 GL_ABGR_EXT + parameter ( GL_ABGR_EXT = 32768 ) + +C EXT_blend_color + integer*4 GL_CONSTANT_COLOR_EXT + parameter ( GL_CONSTANT_COLOR_EXT = 32769 ) + integer*4 GL_ONE_MINUS_CONSTANT_COLOR_EXT + parameter ( GL_ONE_MINUS_CONSTANT_COLOR_EXT = 32770 ) + integer*4 GL_CONSTANT_ALPHA_EXT + parameter ( GL_CONSTANT_ALPHA_EXT = 32771 ) + integer*4 GL_ONE_MINUS_CONSTANT_ALPHA_EXT + parameter ( GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 32772 ) + integer*4 GL_BLEND_COLOR_EXT + parameter ( GL_BLEND_COLOR_EXT = 32773 ) + +C EXT_blend_minmax + integer*4 GL_FUNC_ADD_EXT + parameter ( GL_FUNC_ADD_EXT = 32774 ) + integer*4 GL_MIN_EXT + parameter ( GL_MIN_EXT = 32775 ) + integer*4 GL_MAX_EXT + parameter ( GL_MAX_EXT = 32776 ) + integer*4 GL_BLEND_EQUATION_EXT + parameter ( GL_BLEND_EQUATION_EXT = 32777 ) + +C EXT_blend_subtract + integer*4 GL_FUNC_SUBTRACT_EXT + parameter ( GL_FUNC_SUBTRACT_EXT = 32778 ) + integer*4 GL_FUNC_REVERSE_SUBTRACT_EXT + parameter ( GL_FUNC_REVERSE_SUBTRACT_EXT = 32779 ) + +C EXT_convolution + integer*4 GL_CONVOLUTION_1D_EXT + parameter ( GL_CONVOLUTION_1D_EXT = 32784 ) + integer*4 GL_CONVOLUTION_2D_EXT + parameter ( GL_CONVOLUTION_2D_EXT = 32785 ) + integer*4 GL_SEPARABLE_2D_EXT + parameter ( GL_SEPARABLE_2D_EXT = 32786 ) + integer*4 GL_CONVOLUTION_BORDER_MODE_EXT + parameter ( GL_CONVOLUTION_BORDER_MODE_EXT = 32787 ) + integer*4 GL_CONVOLUTION_FILTER_SCALE_EXT + parameter ( GL_CONVOLUTION_FILTER_SCALE_EXT = 32788 ) + integer*4 GL_CONVOLUTION_FILTER_BIAS_EXT + parameter ( GL_CONVOLUTION_FILTER_BIAS_EXT = 32789 ) + integer*4 GL_REDUCE_EXT + parameter ( GL_REDUCE_EXT = 32790 ) + integer*4 GL_CONVOLUTION_FORMAT_EXT + parameter ( GL_CONVOLUTION_FORMAT_EXT = 32791 ) + integer*4 GL_CONVOLUTION_WIDTH_EXT + parameter ( GL_CONVOLUTION_WIDTH_EXT = 32792 ) + integer*4 GL_CONVOLUTION_HEIGHT_EXT + parameter ( GL_CONVOLUTION_HEIGHT_EXT = 32793 ) + integer*4 GL_MAX_CONVOLUTION_WIDTH_EXT + parameter ( GL_MAX_CONVOLUTION_WIDTH_EXT = 32794 ) + integer*4 GL_MAX_CONVOLUTION_HEIGHT_EXT + parameter ( GL_MAX_CONVOLUTION_HEIGHT_EXT = 32795 ) + integer*4 GL_POST_CONVOLUTION_RED_SCALE_EX + parameter ( GL_POST_CONVOLUTION_RED_SCALE_EX = 32796 ) + integer*4 GL_POST_CONVOLUTION_GREEN_SCALE_ + parameter ( GL_POST_CONVOLUTION_GREEN_SCALE_ = 32797 ) + integer*4 GL_POST_CONVOLUTION_BLUE_SCALE_E + parameter ( GL_POST_CONVOLUTION_BLUE_SCALE_E = 32798 ) + integer*4 GL_POST_CONVOLUTION_ALPHA_SCALE_ + parameter ( GL_POST_CONVOLUTION_ALPHA_SCALE_ = 32799 ) + integer*4 GL_POST_CONVOLUTION_RED_BIAS_EXT + parameter ( GL_POST_CONVOLUTION_RED_BIAS_EXT = 32800 ) + integer*4 GL_POST_CONVOLUTION_GREEN_BIAS_E + parameter ( GL_POST_CONVOLUTION_GREEN_BIAS_E = 32801 ) + integer*4 GL_POST_CONVOLUTION_BLUE_BIAS_EX + parameter ( GL_POST_CONVOLUTION_BLUE_BIAS_EX = 32802 ) + integer*4 GL_POST_CONVOLUTION_ALPHA_BIAS_E + parameter ( GL_POST_CONVOLUTION_ALPHA_BIAS_E = 32803 ) + +C EXT_histogram + integer*4 GL_HISTOGRAM_EXT + parameter ( GL_HISTOGRAM_EXT = 32804 ) + integer*4 GL_PROXY_HISTOGRAM_EXT + parameter ( GL_PROXY_HISTOGRAM_EXT = 32805 ) + integer*4 GL_HISTOGRAM_WIDTH_EXT + parameter ( GL_HISTOGRAM_WIDTH_EXT = 32806 ) + integer*4 GL_HISTOGRAM_FORMAT_EXT + parameter ( GL_HISTOGRAM_FORMAT_EXT = 32807 ) + integer*4 GL_HISTOGRAM_RED_SIZE_EXT + parameter ( GL_HISTOGRAM_RED_SIZE_EXT = 32808 ) + integer*4 GL_HISTOGRAM_GREEN_SIZE_EXT + parameter ( GL_HISTOGRAM_GREEN_SIZE_EXT = 32809 ) + integer*4 GL_HISTOGRAM_BLUE_SIZE_EXT + parameter ( GL_HISTOGRAM_BLUE_SIZE_EXT = 32810 ) + integer*4 GL_HISTOGRAM_ALPHA_SIZE_EXT + parameter ( GL_HISTOGRAM_ALPHA_SIZE_EXT = 32811 ) + integer*4 GL_HISTOGRAM_LUMINANCE_SIZE_EXT + parameter ( GL_HISTOGRAM_LUMINANCE_SIZE_EXT = 32812 ) + integer*4 GL_HISTOGRAM_SINK_EXT + parameter ( GL_HISTOGRAM_SINK_EXT = 32813 ) + integer*4 GL_MINMAX_EXT + parameter ( GL_MINMAX_EXT = 32814 ) + integer*4 GL_MINMAX_FORMAT_EXT + parameter ( GL_MINMAX_FORMAT_EXT = 32815 ) + integer*4 GL_MINMAX_SINK_EXT + parameter ( GL_MINMAX_SINK_EXT = 32816 ) + integer*4 GL_TABLE_TOO_LARGE_EXT + parameter ( GL_TABLE_TOO_LARGE_EXT = 32817 ) + +C EXT_polygon_offset + integer*4 GL_POLYGON_OFFSET_EXT + parameter ( GL_POLYGON_OFFSET_EXT = 32823 ) + integer*4 GL_POLYGON_OFFSET_FACTOR_EXT + parameter ( GL_POLYGON_OFFSET_FACTOR_EXT = 32824 ) + integer*4 GL_POLYGON_OFFSET_BIAS_EXT + parameter ( GL_POLYGON_OFFSET_BIAS_EXT = 32825 ) + +C EXT_texture + integer*4 GL_ALPHA4_EXT + parameter ( GL_ALPHA4_EXT = 32827 ) + integer*4 GL_ALPHA8_EXT + parameter ( GL_ALPHA8_EXT = 32828 ) + integer*4 GL_ALPHA12_EXT + parameter ( GL_ALPHA12_EXT = 32829 ) + integer*4 GL_ALPHA16_EXT + parameter ( GL_ALPHA16_EXT = 32830 ) + integer*4 GL_LUMINANCE4_EXT + parameter ( GL_LUMINANCE4_EXT = 32831 ) + integer*4 GL_LUMINANCE8_EXT + parameter ( GL_LUMINANCE8_EXT = 32832 ) + integer*4 GL_LUMINANCE12_EXT + parameter ( GL_LUMINANCE12_EXT = 32833 ) + integer*4 GL_LUMINANCE16_EXT + parameter ( GL_LUMINANCE16_EXT = 32834 ) + integer*4 GL_LUMINANCE4_ALPHA4_EXT + parameter ( GL_LUMINANCE4_ALPHA4_EXT = 32835 ) + integer*4 GL_LUMINANCE6_ALPHA2_EXT + parameter ( GL_LUMINANCE6_ALPHA2_EXT = 32836 ) + integer*4 GL_LUMINANCE8_ALPHA8_EXT + parameter ( GL_LUMINANCE8_ALPHA8_EXT = 32837 ) + integer*4 GL_LUMINANCE12_ALPHA4_EXT + parameter ( GL_LUMINANCE12_ALPHA4_EXT = 32838 ) + integer*4 GL_LUMINANCE12_ALPHA12_EXT + parameter ( GL_LUMINANCE12_ALPHA12_EXT = 32839 ) + integer*4 GL_LUMINANCE16_ALPHA16_EXT + parameter ( GL_LUMINANCE16_ALPHA16_EXT = 32840 ) + integer*4 GL_INTENSITY_EXT + parameter ( GL_INTENSITY_EXT = 32841 ) + integer*4 GL_INTENSITY4_EXT + parameter ( GL_INTENSITY4_EXT = 32842 ) + integer*4 GL_INTENSITY8_EXT + parameter ( GL_INTENSITY8_EXT = 32843 ) + integer*4 GL_INTENSITY12_EXT + parameter ( GL_INTENSITY12_EXT = 32844 ) + integer*4 GL_INTENSITY16_EXT + parameter ( GL_INTENSITY16_EXT = 32845 ) + integer*4 GL_RGB2_EXT + parameter ( GL_RGB2_EXT = 32846 ) + integer*4 GL_RGB4_EXT + parameter ( GL_RGB4_EXT = 32847 ) + integer*4 GL_RGB5_EXT + parameter ( GL_RGB5_EXT = 32848 ) + integer*4 GL_RGB8_EXT + parameter ( GL_RGB8_EXT = 32849 ) + integer*4 GL_RGB10_EXT + parameter ( GL_RGB10_EXT = 32850 ) + integer*4 GL_RGB12_EXT + parameter ( GL_RGB12_EXT = 32851 ) + integer*4 GL_RGB16_EXT + parameter ( GL_RGB16_EXT = 32852 ) + integer*4 GL_RGBA2_EXT + parameter ( GL_RGBA2_EXT = 32853 ) + integer*4 GL_RGBA4_EXT + parameter ( GL_RGBA4_EXT = 32854 ) + integer*4 GL_RGB5_A1_EXT + parameter ( GL_RGB5_A1_EXT = 32855 ) + integer*4 GL_RGBA8_EXT + parameter ( GL_RGBA8_EXT = 32856 ) + integer*4 GL_RGB10_A2_EXT + parameter ( GL_RGB10_A2_EXT = 32857 ) + integer*4 GL_RGBA12_EXT + parameter ( GL_RGBA12_EXT = 32858 ) + integer*4 GL_RGBA16_EXT + parameter ( GL_RGBA16_EXT = 32859 ) + integer*4 GL_TEXTURE_RED_SIZE_EXT + parameter ( GL_TEXTURE_RED_SIZE_EXT = 32860 ) + integer*4 GL_TEXTURE_GREEN_SIZE_EXT + parameter ( GL_TEXTURE_GREEN_SIZE_EXT = 32861 ) + integer*4 GL_TEXTURE_BLUE_SIZE_EXT + parameter ( GL_TEXTURE_BLUE_SIZE_EXT = 32862 ) + integer*4 GL_TEXTURE_ALPHA_SIZE_EXT + parameter ( GL_TEXTURE_ALPHA_SIZE_EXT = 32863 ) + integer*4 GL_TEXTURE_LUMINANCE_SIZE_EXT + parameter ( GL_TEXTURE_LUMINANCE_SIZE_EXT = 32864 ) + integer*4 GL_TEXTURE_INTENSITY_SIZE_EXT + parameter ( GL_TEXTURE_INTENSITY_SIZE_EXT = 32865 ) + integer*4 GL_REPLACE_EXT + parameter ( GL_REPLACE_EXT = 32866 ) + integer*4 GL_PROXY_TEXTURE_1D_EXT + parameter ( GL_PROXY_TEXTURE_1D_EXT = 32867 ) + integer*4 GL_PROXY_TEXTURE_2D_EXT + parameter ( GL_PROXY_TEXTURE_2D_EXT = 32868 ) + integer*4 GL_TEXTURE_TOO_LARGE_EXT + parameter ( GL_TEXTURE_TOO_LARGE_EXT = 32869 ) + +C EXT_texture3D + integer*4 GL_PACK_SKIP_IMAGES_EXT + parameter ( GL_PACK_SKIP_IMAGES_EXT = 32875 ) + integer*4 GL_PACK_IMAGE_HEIGHT_EXT + parameter ( GL_PACK_IMAGE_HEIGHT_EXT = 32876 ) + integer*4 GL_UNPACK_SKIP_IMAGES_EXT + parameter ( GL_UNPACK_SKIP_IMAGES_EXT = 32877 ) + integer*4 GL_UNPACK_IMAGE_HEIGHT_EXT + parameter ( GL_UNPACK_IMAGE_HEIGHT_EXT = 32878 ) + integer*4 GL_TEXTURE_3D_EXT + parameter ( GL_TEXTURE_3D_EXT = 32879 ) + integer*4 GL_PROXY_TEXTURE_3D_EXT + parameter ( GL_PROXY_TEXTURE_3D_EXT = 32880 ) + integer*4 GL_TEXTURE_DEPTH_EXT + parameter ( GL_TEXTURE_DEPTH_EXT = 32881 ) + integer*4 GL_TEXTURE_WRAP_R_EXT + parameter ( GL_TEXTURE_WRAP_R_EXT = 32882 ) + integer*4 GL_MAX_3D_TEXTURE_SIZE_EXT + parameter ( GL_MAX_3D_TEXTURE_SIZE_EXT = 32883 ) + +C SGIS_detail_texture + integer*4 GL_DETAIL_TEXTURE_2D_SGIS + parameter ( GL_DETAIL_TEXTURE_2D_SGIS = 32917 ) + integer*4 GL_DETAIL_TEXTURE_2D_BINDING_SGI + parameter ( GL_DETAIL_TEXTURE_2D_BINDING_SGI = 32918 ) + integer*4 GL_LINEAR_DETAIL_SGIS + parameter ( GL_LINEAR_DETAIL_SGIS = 32919 ) + integer*4 GL_LINEAR_DETAIL_ALPHA_SGIS + parameter ( GL_LINEAR_DETAIL_ALPHA_SGIS = 32920 ) + integer*4 GL_LINEAR_DETAIL_COLOR_SGIS + parameter ( GL_LINEAR_DETAIL_COLOR_SGIS = 32921 ) + integer*4 GL_DETAIL_TEXTURE_LEVEL_SGIS + parameter ( GL_DETAIL_TEXTURE_LEVEL_SGIS = 32922 ) + integer*4 GL_DETAIL_TEXTURE_MODE_SGIS + parameter ( GL_DETAIL_TEXTURE_MODE_SGIS = 32923 ) + integer*4 GL_DETAIL_TEXTURE_FUNC_POINTS_S + parameter ( GL_DETAIL_TEXTURE_FUNC_POINTS_S = 32924 ) + +C SGIS_multisample + integer*4 GL_MULTISAMPLE_BIT_EXT + parameter ( GL_MULTISAMPLE_BIT_EXT = 536870912 ) + integer*4 GL_MULTISAMPLE_SGIS + parameter ( GL_MULTISAMPLE_SGIS = 32925 ) + integer*4 GL_SAMPLE_ALPHA_TO_MASK_SGIS + parameter ( GL_SAMPLE_ALPHA_TO_MASK_SGIS = 32926 ) + integer*4 GL_SAMPLE_ALPHA_TO_ONE_SGIS + parameter ( GL_SAMPLE_ALPHA_TO_ONE_SGIS = 32927 ) + integer*4 GL_SAMPLE_MASK_SGIS + parameter ( GL_SAMPLE_MASK_SGIS = 32928 ) + integer*4 GL_1PASS_SGIS + parameter ( GL_1PASS_SGIS = 32929 ) + integer*4 GL_2PASS_0_SGIS + parameter ( GL_2PASS_0_SGIS = 32930 ) + integer*4 GL_2PASS_1_SGIS + parameter ( GL_2PASS_1_SGIS = 32931 ) + integer*4 GL_4PASS_0_SGIS + parameter ( GL_4PASS_0_SGIS = 32932 ) + integer*4 GL_4PASS_1_SGIS + parameter ( GL_4PASS_1_SGIS = 32933 ) + integer*4 GL_4PASS_2_SGIS + parameter ( GL_4PASS_2_SGIS = 32934 ) + integer*4 GL_4PASS_3_SGIS + parameter ( GL_4PASS_3_SGIS = 32935 ) + integer*4 GL_SAMPLE_BUFFERS_SGIS + parameter ( GL_SAMPLE_BUFFERS_SGIS = 32936 ) + integer*4 GL_SAMPLES_SGIS + parameter ( GL_SAMPLES_SGIS = 32937 ) + integer*4 GL_SAMPLE_MASK_VALUE_SGIS + parameter ( GL_SAMPLE_MASK_VALUE_SGIS = 32938 ) + integer*4 GL_SAMPLE_MASK_INVERT_SGIS + parameter ( GL_SAMPLE_MASK_INVERT_SGIS = 32939 ) + integer*4 GL_SAMPLE_PATTERN_SGIS + parameter ( GL_SAMPLE_PATTERN_SGIS = 32940 ) + +C SGIS_sharpen_texture + integer*4 GL_LINEAR_SHARPEN_SGIS + parameter ( GL_LINEAR_SHARPEN_SGIS = 32941 ) + integer*4 GL_LINEAR_SHARPEN_ALPHA_SGIS + parameter ( GL_LINEAR_SHARPEN_ALPHA_SGIS = 32942 ) + integer*4 GL_LINEAR_SHARPEN_COLOR_SGIS + parameter ( GL_LINEAR_SHARPEN_COLOR_SGIS = 32943 ) + integer*4 GL_SHARPEN_TEXTURE_FUNC_POINTS_S + parameter ( GL_SHARPEN_TEXTURE_FUNC_POINTS_S = 32944 ) + +C *********************************************************** + + + character*128 fglGetString + integer fglGetError + integer*4 fglRenderMode + logical*1 fglAreTexturesResidentEXT + logical*1 fglIsEnabled + logical*1 fglIsList + logical*1 fglIsTextureEXT + logical*4 fglGenLists + logical*4 fglGenTexturesEXT diff --git a/Externals/GLew/fglu.h b/Externals/GLew/fglu.h index 0b0497675f..75c064c740 100644 --- a/Externals/GLew/fglu.h +++ b/Externals/GLew/fglu.h @@ -1,210 +1,210 @@ - -C GLUT version of "GL/fgl.h" - -C Modifications from SGI IRIX 5.3 version: -C 1) F prefix removed from GLU constants. -C 2) Fix GLU_TRUE and GLU_FALSE. - -C *** Generic constants *** - -C Errors: (return value 0 = no error) - integer*4 GLU_INVALID_ENUM - parameter ( GLU_INVALID_ENUM = 100900 ) - integer*4 GLU_INVALID_VALUE - parameter ( GLU_INVALID_VALUE = 100901 ) - integer*4 GLU_OUT_OF_MEMORY - parameter ( GLU_OUT_OF_MEMORY = 100902 ) - -C For laughs: - integer*4 GLU_TRUE - parameter ( GLU_TRUE = 1 ) - integer*4 GLU_FALSE - parameter ( GLU_FALSE = 0 ) - - -C *** Quadric constants *** - -C Types of normals: - integer*4 GLU_SMOOTH - parameter ( GLU_SMOOTH = 100000 ) - integer*4 GLU_FLAT - parameter ( GLU_FLAT = 100001 ) - integer*4 GLU_NONE - parameter ( GLU_NONE = 100002 ) - -C DrawStyle types: - integer*4 GLU_POINT - parameter ( GLU_POINT = 100010 ) - integer*4 GLU_LINE - parameter ( GLU_LINE = 100011 ) - integer*4 GLU_FILL - parameter ( GLU_FILL = 100012 ) - integer*4 GLU_SILHOUETTE - parameter ( GLU_SILHOUETTE = 100013 ) - -C Orientation types: - integer*4 GLU_OUTSIDE - parameter ( GLU_OUTSIDE = 100020 ) - integer*4 GLU_INSIDE - parameter ( GLU_INSIDE = 100021 ) - -C Callback types: -C GLU_ERROR 100103 - - -C *** Tesselation constants *** - -C Callback types: - integer*4 GLU_BEGIN - parameter ( GLU_BEGIN = 100100 ) - integer*4 GLU_VERTEX - parameter ( GLU_VERTEX = 100101 ) - integer*4 GLU_END - parameter ( GLU_END = 100102 ) - integer*4 GLU_ERROR - parameter ( GLU_ERROR = 100103 ) - integer*4 GLU_EDGE_FLAG - parameter ( GLU_EDGE_FLAG = 100104 ) - -C Contours types: - integer*4 GLU_CW - parameter ( GLU_CW = 100120 ) - integer*4 GLU_CCW - parameter ( GLU_CCW = 100121 ) - integer*4 GLU_INTERIOR - parameter ( GLU_INTERIOR = 100122 ) - integer*4 GLU_EXTERIOR - parameter ( GLU_EXTERIOR = 100123 ) - integer*4 GLU_UNKNOWN - parameter ( GLU_UNKNOWN = 100124 ) - - integer*4 GLU_TESS_ERROR1 - parameter ( GLU_TESS_ERROR1 = 100151 ) - integer*4 GLU_TESS_ERROR2 - parameter ( GLU_TESS_ERROR2 = 100152 ) - integer*4 GLU_TESS_ERROR3 - parameter ( GLU_TESS_ERROR3 = 100153 ) - integer*4 GLU_TESS_ERROR4 - parameter ( GLU_TESS_ERROR4 = 100154 ) - integer*4 GLU_TESS_ERROR5 - parameter ( GLU_TESS_ERROR5 = 100155 ) - integer*4 GLU_TESS_ERROR6 - parameter ( GLU_TESS_ERROR6 = 100156 ) - integer*4 GLU_TESS_ERROR7 - parameter ( GLU_TESS_ERROR7 = 100157 ) - integer*4 GLU_TESS_ERROR8 - parameter ( GLU_TESS_ERROR8 = 100158 ) - - -C *** NURBS constants *** - -C Properties: - integer*4 GLU_AUTO_LOAD_MATRIX - parameter ( GLU_AUTO_LOAD_MATRIX = 100200 ) - integer*4 GLU_CULLING - parameter ( GLU_CULLING = 100201 ) - integer*4 GLU_SAMPLING_TOLERANCE - parameter ( GLU_SAMPLING_TOLERANCE = 100203 ) - integer*4 GLU_DISPLAY_MODE - parameter ( GLU_DISPLAY_MODE = 100204 ) - -C Trimming curve types - integer*4 GLU_MAP1_TRIM_2 - parameter ( GLU_MAP1_TRIM_2 = 100210 ) - integer*4 GLU_MAP1_TRIM_3 - parameter ( GLU_MAP1_TRIM_3 = 100211 ) - -C Display modes: -C GLU_FILL 100012 - integer*4 GLU_OUTLINE_POLYGON - parameter ( GLU_OUTLINE_POLYGON = 100240 ) - integer*4 GLU_OUTLINE_PATCH - parameter ( GLU_OUTLINE_PATCH = 100241 ) - -C Callbacks: -C GLU_ERROR 100103 - -C Errors: - integer*4 GLU_NURBS_ERROR1 - parameter ( GLU_NURBS_ERROR1 = 100251 ) - integer*4 GLU_NURBS_ERROR2 - parameter ( GLU_NURBS_ERROR2 = 100252 ) - integer*4 GLU_NURBS_ERROR3 - parameter ( GLU_NURBS_ERROR3 = 100253 ) - integer*4 GLU_NURBS_ERROR4 - parameter ( GLU_NURBS_ERROR4 = 100254 ) - integer*4 GLU_NURBS_ERROR5 - parameter ( GLU_NURBS_ERROR5 = 100255 ) - integer*4 GLU_NURBS_ERROR6 - parameter ( GLU_NURBS_ERROR6 = 100256 ) - integer*4 GLU_NURBS_ERROR7 - parameter ( GLU_NURBS_ERROR7 = 100257 ) - integer*4 GLU_NURBS_ERROR8 - parameter ( GLU_NURBS_ERROR8 = 100258 ) - integer*4 GLU_NURBS_ERROR9 - parameter ( GLU_NURBS_ERROR9 = 100259 ) - integer*4 GLU_NURBS_ERROR10 - parameter ( GLU_NURBS_ERROR10 = 100260 ) - integer*4 GLU_NURBS_ERROR11 - parameter ( GLU_NURBS_ERROR11 = 100261 ) - integer*4 GLU_NURBS_ERROR12 - parameter ( GLU_NURBS_ERROR12 = 100262 ) - integer*4 GLU_NURBS_ERROR13 - parameter ( GLU_NURBS_ERROR13 = 100263 ) - integer*4 GLU_NURBS_ERROR14 - parameter ( GLU_NURBS_ERROR14 = 100264 ) - integer*4 GLU_NURBS_ERROR15 - parameter ( GLU_NURBS_ERROR15 = 100265 ) - integer*4 GLU_NURBS_ERROR16 - parameter ( GLU_NURBS_ERROR16 = 100266 ) - integer*4 GLU_NURBS_ERROR17 - parameter ( GLU_NURBS_ERROR17 = 100267 ) - integer*4 GLU_NURBS_ERROR18 - parameter ( GLU_NURBS_ERROR18 = 100268 ) - integer*4 GLU_NURBS_ERROR19 - parameter ( GLU_NURBS_ERROR19 = 100269 ) - integer*4 GLU_NURBS_ERROR20 - parameter ( GLU_NURBS_ERROR20 = 100270 ) - integer*4 GLU_NURBS_ERROR21 - parameter ( GLU_NURBS_ERROR21 = 100271 ) - integer*4 GLU_NURBS_ERROR22 - parameter ( GLU_NURBS_ERROR22 = 100272 ) - integer*4 GLU_NURBS_ERROR23 - parameter ( GLU_NURBS_ERROR23 = 100273 ) - integer*4 GLU_NURBS_ERROR24 - parameter ( GLU_NURBS_ERROR24 = 100274 ) - integer*4 GLU_NURBS_ERROR25 - parameter ( GLU_NURBS_ERROR25 = 100275 ) - integer*4 GLU_NURBS_ERROR26 - parameter ( GLU_NURBS_ERROR26 = 100276 ) - integer*4 GLU_NURBS_ERROR27 - parameter ( GLU_NURBS_ERROR27 = 100277 ) - integer*4 GLU_NURBS_ERROR28 - parameter ( GLU_NURBS_ERROR28 = 100278 ) - integer*4 GLU_NURBS_ERROR29 - parameter ( GLU_NURBS_ERROR29 = 100279 ) - integer*4 GLU_NURBS_ERROR30 - parameter ( GLU_NURBS_ERROR30 = 100280 ) - integer*4 GLU_NURBS_ERROR31 - parameter ( GLU_NURBS_ERROR31 = 100281 ) - integer*4 GLU_NURBS_ERROR32 - parameter ( GLU_NURBS_ERROR32 = 100282 ) - integer*4 GLU_NURBS_ERROR33 - parameter ( GLU_NURBS_ERROR33 = 100283 ) - integer*4 GLU_NURBS_ERROR34 - parameter ( GLU_NURBS_ERROR34 = 100284 ) - integer*4 GLU_NURBS_ERROR35 - parameter ( GLU_NURBS_ERROR35 = 100285 ) - integer*4 GLU_NURBS_ERROR36 - parameter ( GLU_NURBS_ERROR36 = 100286 ) - integer*4 GLU_NURBS_ERROR37 - parameter ( GLU_NURBS_ERROR37 = 100287 ) - - - character*128 fgluErrorString - character*128 fgluGetString - integer*4 fgluBuild1DMipmaps - integer*4 fgluBuild2DMipmaps - integer*4 fgluProject - integer*4 fgluScaleImage - integer*4 fgluUnProject + +C GLUT version of "GL/fgl.h" + +C Modifications from SGI IRIX 5.3 version: +C 1) F prefix removed from GLU constants. +C 2) Fix GLU_TRUE and GLU_FALSE. + +C *** Generic constants *** + +C Errors: (return value 0 = no error) + integer*4 GLU_INVALID_ENUM + parameter ( GLU_INVALID_ENUM = 100900 ) + integer*4 GLU_INVALID_VALUE + parameter ( GLU_INVALID_VALUE = 100901 ) + integer*4 GLU_OUT_OF_MEMORY + parameter ( GLU_OUT_OF_MEMORY = 100902 ) + +C For laughs: + integer*4 GLU_TRUE + parameter ( GLU_TRUE = 1 ) + integer*4 GLU_FALSE + parameter ( GLU_FALSE = 0 ) + + +C *** Quadric constants *** + +C Types of normals: + integer*4 GLU_SMOOTH + parameter ( GLU_SMOOTH = 100000 ) + integer*4 GLU_FLAT + parameter ( GLU_FLAT = 100001 ) + integer*4 GLU_NONE + parameter ( GLU_NONE = 100002 ) + +C DrawStyle types: + integer*4 GLU_POINT + parameter ( GLU_POINT = 100010 ) + integer*4 GLU_LINE + parameter ( GLU_LINE = 100011 ) + integer*4 GLU_FILL + parameter ( GLU_FILL = 100012 ) + integer*4 GLU_SILHOUETTE + parameter ( GLU_SILHOUETTE = 100013 ) + +C Orientation types: + integer*4 GLU_OUTSIDE + parameter ( GLU_OUTSIDE = 100020 ) + integer*4 GLU_INSIDE + parameter ( GLU_INSIDE = 100021 ) + +C Callback types: +C GLU_ERROR 100103 + + +C *** Tesselation constants *** + +C Callback types: + integer*4 GLU_BEGIN + parameter ( GLU_BEGIN = 100100 ) + integer*4 GLU_VERTEX + parameter ( GLU_VERTEX = 100101 ) + integer*4 GLU_END + parameter ( GLU_END = 100102 ) + integer*4 GLU_ERROR + parameter ( GLU_ERROR = 100103 ) + integer*4 GLU_EDGE_FLAG + parameter ( GLU_EDGE_FLAG = 100104 ) + +C Contours types: + integer*4 GLU_CW + parameter ( GLU_CW = 100120 ) + integer*4 GLU_CCW + parameter ( GLU_CCW = 100121 ) + integer*4 GLU_INTERIOR + parameter ( GLU_INTERIOR = 100122 ) + integer*4 GLU_EXTERIOR + parameter ( GLU_EXTERIOR = 100123 ) + integer*4 GLU_UNKNOWN + parameter ( GLU_UNKNOWN = 100124 ) + + integer*4 GLU_TESS_ERROR1 + parameter ( GLU_TESS_ERROR1 = 100151 ) + integer*4 GLU_TESS_ERROR2 + parameter ( GLU_TESS_ERROR2 = 100152 ) + integer*4 GLU_TESS_ERROR3 + parameter ( GLU_TESS_ERROR3 = 100153 ) + integer*4 GLU_TESS_ERROR4 + parameter ( GLU_TESS_ERROR4 = 100154 ) + integer*4 GLU_TESS_ERROR5 + parameter ( GLU_TESS_ERROR5 = 100155 ) + integer*4 GLU_TESS_ERROR6 + parameter ( GLU_TESS_ERROR6 = 100156 ) + integer*4 GLU_TESS_ERROR7 + parameter ( GLU_TESS_ERROR7 = 100157 ) + integer*4 GLU_TESS_ERROR8 + parameter ( GLU_TESS_ERROR8 = 100158 ) + + +C *** NURBS constants *** + +C Properties: + integer*4 GLU_AUTO_LOAD_MATRIX + parameter ( GLU_AUTO_LOAD_MATRIX = 100200 ) + integer*4 GLU_CULLING + parameter ( GLU_CULLING = 100201 ) + integer*4 GLU_SAMPLING_TOLERANCE + parameter ( GLU_SAMPLING_TOLERANCE = 100203 ) + integer*4 GLU_DISPLAY_MODE + parameter ( GLU_DISPLAY_MODE = 100204 ) + +C Trimming curve types + integer*4 GLU_MAP1_TRIM_2 + parameter ( GLU_MAP1_TRIM_2 = 100210 ) + integer*4 GLU_MAP1_TRIM_3 + parameter ( GLU_MAP1_TRIM_3 = 100211 ) + +C Display modes: +C GLU_FILL 100012 + integer*4 GLU_OUTLINE_POLYGON + parameter ( GLU_OUTLINE_POLYGON = 100240 ) + integer*4 GLU_OUTLINE_PATCH + parameter ( GLU_OUTLINE_PATCH = 100241 ) + +C Callbacks: +C GLU_ERROR 100103 + +C Errors: + integer*4 GLU_NURBS_ERROR1 + parameter ( GLU_NURBS_ERROR1 = 100251 ) + integer*4 GLU_NURBS_ERROR2 + parameter ( GLU_NURBS_ERROR2 = 100252 ) + integer*4 GLU_NURBS_ERROR3 + parameter ( GLU_NURBS_ERROR3 = 100253 ) + integer*4 GLU_NURBS_ERROR4 + parameter ( GLU_NURBS_ERROR4 = 100254 ) + integer*4 GLU_NURBS_ERROR5 + parameter ( GLU_NURBS_ERROR5 = 100255 ) + integer*4 GLU_NURBS_ERROR6 + parameter ( GLU_NURBS_ERROR6 = 100256 ) + integer*4 GLU_NURBS_ERROR7 + parameter ( GLU_NURBS_ERROR7 = 100257 ) + integer*4 GLU_NURBS_ERROR8 + parameter ( GLU_NURBS_ERROR8 = 100258 ) + integer*4 GLU_NURBS_ERROR9 + parameter ( GLU_NURBS_ERROR9 = 100259 ) + integer*4 GLU_NURBS_ERROR10 + parameter ( GLU_NURBS_ERROR10 = 100260 ) + integer*4 GLU_NURBS_ERROR11 + parameter ( GLU_NURBS_ERROR11 = 100261 ) + integer*4 GLU_NURBS_ERROR12 + parameter ( GLU_NURBS_ERROR12 = 100262 ) + integer*4 GLU_NURBS_ERROR13 + parameter ( GLU_NURBS_ERROR13 = 100263 ) + integer*4 GLU_NURBS_ERROR14 + parameter ( GLU_NURBS_ERROR14 = 100264 ) + integer*4 GLU_NURBS_ERROR15 + parameter ( GLU_NURBS_ERROR15 = 100265 ) + integer*4 GLU_NURBS_ERROR16 + parameter ( GLU_NURBS_ERROR16 = 100266 ) + integer*4 GLU_NURBS_ERROR17 + parameter ( GLU_NURBS_ERROR17 = 100267 ) + integer*4 GLU_NURBS_ERROR18 + parameter ( GLU_NURBS_ERROR18 = 100268 ) + integer*4 GLU_NURBS_ERROR19 + parameter ( GLU_NURBS_ERROR19 = 100269 ) + integer*4 GLU_NURBS_ERROR20 + parameter ( GLU_NURBS_ERROR20 = 100270 ) + integer*4 GLU_NURBS_ERROR21 + parameter ( GLU_NURBS_ERROR21 = 100271 ) + integer*4 GLU_NURBS_ERROR22 + parameter ( GLU_NURBS_ERROR22 = 100272 ) + integer*4 GLU_NURBS_ERROR23 + parameter ( GLU_NURBS_ERROR23 = 100273 ) + integer*4 GLU_NURBS_ERROR24 + parameter ( GLU_NURBS_ERROR24 = 100274 ) + integer*4 GLU_NURBS_ERROR25 + parameter ( GLU_NURBS_ERROR25 = 100275 ) + integer*4 GLU_NURBS_ERROR26 + parameter ( GLU_NURBS_ERROR26 = 100276 ) + integer*4 GLU_NURBS_ERROR27 + parameter ( GLU_NURBS_ERROR27 = 100277 ) + integer*4 GLU_NURBS_ERROR28 + parameter ( GLU_NURBS_ERROR28 = 100278 ) + integer*4 GLU_NURBS_ERROR29 + parameter ( GLU_NURBS_ERROR29 = 100279 ) + integer*4 GLU_NURBS_ERROR30 + parameter ( GLU_NURBS_ERROR30 = 100280 ) + integer*4 GLU_NURBS_ERROR31 + parameter ( GLU_NURBS_ERROR31 = 100281 ) + integer*4 GLU_NURBS_ERROR32 + parameter ( GLU_NURBS_ERROR32 = 100282 ) + integer*4 GLU_NURBS_ERROR33 + parameter ( GLU_NURBS_ERROR33 = 100283 ) + integer*4 GLU_NURBS_ERROR34 + parameter ( GLU_NURBS_ERROR34 = 100284 ) + integer*4 GLU_NURBS_ERROR35 + parameter ( GLU_NURBS_ERROR35 = 100285 ) + integer*4 GLU_NURBS_ERROR36 + parameter ( GLU_NURBS_ERROR36 = 100286 ) + integer*4 GLU_NURBS_ERROR37 + parameter ( GLU_NURBS_ERROR37 = 100287 ) + + + character*128 fgluErrorString + character*128 fgluGetString + integer*4 fgluBuild1DMipmaps + integer*4 fgluBuild2DMipmaps + integer*4 fgluProject + integer*4 fgluScaleImage + integer*4 fgluUnProject diff --git a/Externals/GLew/fglut.h b/Externals/GLew/fglut.h index e0ad8536d9..efe3d14292 100644 --- a/Externals/GLew/fglut.h +++ b/Externals/GLew/fglut.h @@ -1,321 +1,321 @@ - -C Copyright (c) Mark J. Kilgard, 1994. - -C This program is freely distributable without licensing fees -C and is provided without guarantee or warrantee expressed or -C implied. This program is -not- in the public domain. - -C GLUT Fortran header file - -C display mode bit masks - integer*4 GLUT_RGB - parameter ( GLUT_RGB = 0 ) - integer*4 GLUT_RGBA - parameter ( GLUT_RGBA = 0 ) - integer*4 GLUT_INDEX - parameter ( GLUT_INDEX = 1 ) - integer*4 GLUT_SINGLE - parameter ( GLUT_SINGLE = 0 ) - integer*4 GLUT_DOUBLE - parameter ( GLUT_DOUBLE = 2 ) - integer*4 GLUT_ACCUM - parameter ( GLUT_ACCUM = 4 ) - integer*4 GLUT_ALPHA - parameter ( GLUT_ALPHA = 8 ) - integer*4 GLUT_DEPTH - parameter ( GLUT_DEPTH = 16 ) - integer*4 GLUT_STENCIL - parameter ( GLUT_STENCIL = 32 ) - integer*4 GLUT_MULTISAMPLE - parameter ( GLUT_MULTISAMPLE = 128 ) - integer*4 GLUT_STEREO - parameter ( GLUT_STEREO = 256 ) - -C mouse buttons - integer*4 GLUT_LEFT_BUTTON - parameter ( GLUT_LEFT_BUTTON = 0 ) - integer*4 GLUT_MIDDLE_BUTTON - parameter ( GLUT_MIDDLE_BUTTON = 1 ) - integer*4 GLUT_RIGHT_BUTTON - parameter ( GLUT_RIGHT_BUTTON = 2 ) - -C mouse button callback state - integer*4 GLUT_DOWN - parameter ( GLUT_DOWN = 0 ) - integer*4 GLUT_UP - parameter ( GLUT_UP = 1 ) - -C special key callback values - integer*4 GLUT_KEY_F1 - parameter ( GLUT_KEY_F1 = 1 ) - integer*4 GLUT_KEY_F2 - parameter ( GLUT_KEY_F2 = 2 ) - integer*4 GLUT_KEY_F3 - parameter ( GLUT_KEY_F3 = 3 ) - integer*4 GLUT_KEY_F4 - parameter ( GLUT_KEY_F4 = 4 ) - integer*4 GLUT_KEY_F5 - parameter ( GLUT_KEY_F5 = 5 ) - integer*4 GLUT_KEY_F6 - parameter ( GLUT_KEY_F6 = 6 ) - integer*4 GLUT_KEY_F7 - parameter ( GLUT_KEY_F7 = 7 ) - integer*4 GLUT_KEY_F8 - parameter ( GLUT_KEY_F8 = 8 ) - integer*4 GLUT_KEY_F9 - parameter ( GLUT_KEY_F9 = 9 ) - integer*4 GLUT_KEY_F10 - parameter ( GLUT_KEY_F10 = 10 ) - integer*4 GLUT_KEY_F11 - parameter ( GLUT_KEY_F11 = 11 ) - integer*4 GLUT_KEY_F12 - parameter ( GLUT_KEY_F12 = 12 ) - integer*4 GLUT_KEY_LEFT - parameter ( GLUT_KEY_LEFT = 100 ) - integer*4 GLUT_KEY_UP - parameter ( GLUT_KEY_UP = 101 ) - integer*4 GLUT_KEY_RIGHT - parameter ( GLUT_KEY_RIGHT = 102 ) - integer*4 GLUT_KEY_DOWN - parameter ( GLUT_KEY_DOWN = 103 ) - integer*4 GLUT_KEY_PAGE_UP - parameter ( GLUT_KEY_PAGE_UP = 104 ) - integer*4 GLUT_KEY_PAGE_DOWN - parameter ( GLUT_KEY_PAGE_DOWN = 105 ) - integer*4 GLUT_KEY_HOME - parameter ( GLUT_KEY_HOME = 106 ) - integer*4 GLUT_KEY_END - parameter ( GLUT_KEY_END = 107 ) - integer*4 GLUT_KEY_INSERT - parameter ( GLUT_KEY_INSERT = 108 ) - -C entry/exit callback state - integer*4 GLUT_LEFT - parameter ( GLUT_LEFT = 0 ) - integer*4 GLUT_ENTERED - parameter ( GLUT_ENTERED = 1 ) - -C menu usage callback state - integer*4 GLUT_MENU_NOT_IN_USE - parameter ( GLUT_MENU_NOT_IN_USE = 0 ) - integer*4 GLUT_MENU_IN_USE - parameter ( GLUT_MENU_IN_USE = 1 ) - -C visibility callback state - integer*4 GLUT_NOT_VISIBLE - parameter ( GLUT_NOT_VISIBLE = 0 ) - integer*4 GLUT_VISIBLE - parameter ( GLUT_VISIBLE = 1 ) - -C color index component selection values - integer*4 GLUT_RED - parameter ( GLUT_RED = 0 ) - integer*4 GLUT_GREEN - parameter ( GLUT_GREEN = 1 ) - integer*4 GLUT_BLUE - parameter ( GLUT_BLUE = 2 ) - -C XXX Unfortunately, SGI's Fortran compiler links with -C EXTERNAL data even if it is not used. This defeats -C the purpose of GLUT naming fonts via opaque symbols. -C This means GLUT Fortran programmers should explicitly -C declared EXTERNAL GLUT fonts in subroutines where -C the fonts are used. - -C stroke font opaque names -C external GLUT_STROKE_ROMAN -C external GLUT_STROKE_MONO_ROMAN - -C bitmap font opaque names -C external GLUT_BITMAP_9_BY_15 -C external GLUT_BITMAP_8_BY_13 -C external GLUT_BITMAP_TIMES_ROMAN_10 -C external GLUT_BITMAP_TIMES_ROMAN_24 -C external GLUT_BITMAP_HELVETICA_10 -C external GLUT_BITMAP_HELVETICA_12 -C external GLUT_BITMAP_HELVETICA_18 - -C glutGet parameters - integer*4 GLUT_WINDOW_X - parameter ( GLUT_WINDOW_X = 100 ) - integer*4 GLUT_WINDOW_Y - parameter ( GLUT_WINDOW_Y = 101 ) - integer*4 GLUT_WINDOW_WIDTH - parameter ( GLUT_WINDOW_WIDTH = 102 ) - integer*4 GLUT_WINDOW_HEIGHT - parameter ( GLUT_WINDOW_HEIGHT = 103 ) - integer*4 GLUT_WINDOW_BUFFER_SIZE - parameter ( GLUT_WINDOW_BUFFER_SIZE = 104 ) - integer*4 GLUT_WINDOW_STENCIL_SIZE - parameter ( GLUT_WINDOW_STENCIL_SIZE = 105 ) - integer*4 GLUT_WINDOW_DEPTH_SIZE - parameter ( GLUT_WINDOW_DEPTH_SIZE = 106 ) - integer*4 GLUT_WINDOW_RED_SIZE - parameter ( GLUT_WINDOW_RED_SIZE = 107 ) - integer*4 GLUT_WINDOW_GREEN_SIZE - parameter ( GLUT_WINDOW_GREEN_SIZE = 108 ) - integer*4 GLUT_WINDOW_BLUE_SIZE - parameter ( GLUT_WINDOW_BLUE_SIZE = 109 ) - integer*4 GLUT_WINDOW_ALPHA_SIZE - parameter ( GLUT_WINDOW_ALPHA_SIZE = 110 ) - integer*4 GLUT_WINDOW_ACCUM_RED_SIZE - parameter ( GLUT_WINDOW_ACCUM_RED_SIZE = 111 ) - integer*4 GLUT_WINDOW_ACCUM_GREEN_SIZE - parameter ( GLUT_WINDOW_ACCUM_GREEN_SIZE = 112 ) - integer*4 GLUT_WINDOW_ACCUM_BLUE_SIZE - parameter ( GLUT_WINDOW_ACCUM_BLUE_SIZE = 113 ) - integer*4 GLUT_WINDOW_ACCUM_ALPHA_SIZE - parameter ( GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114 ) - integer*4 GLUT_WINDOW_DOUBLEBUFFER - parameter ( GLUT_WINDOW_DOUBLEBUFFER = 115 ) - integer*4 GLUT_WINDOW_RGBA - parameter ( GLUT_WINDOW_RGBA = 116 ) - integer*4 GLUT_WINDOW_PARENT - parameter ( GLUT_WINDOW_PARENT = 117 ) - integer*4 GLUT_WINDOW_NUM_CHILDREN - parameter ( GLUT_WINDOW_NUM_CHILDREN = 118 ) - integer*4 GLUT_WINDOW_COLORMAP_SIZE - parameter ( GLUT_WINDOW_COLORMAP_SIZE = 119 ) - integer*4 GLUT_WINDOW_NUM_SAMPLES - parameter ( GLUT_WINDOW_NUM_SAMPLES = 120 ) - integer*4 GLUT_WINDOW_STEREO - parameter ( GLUT_WINDOW_STEREO = 121 ) - integer*4 GLUT_WINDOW_CURSOR - parameter ( GLUT_WINDOW_CURSOR = 122 ) - integer*4 GLUT_SCREEN_WIDTH - parameter ( GLUT_SCREEN_WIDTH = 200 ) - integer*4 GLUT_SCREEN_HEIGHT - parameter ( GLUT_SCREEN_HEIGHT = 201 ) - integer*4 GLUT_SCREEN_WIDTH_MM - parameter ( GLUT_SCREEN_WIDTH_MM = 202 ) - integer*4 GLUT_SCREEN_HEIGHT_MM - parameter ( GLUT_SCREEN_HEIGHT_MM = 203 ) - integer*4 GLUT_MENU_NUM_ITEMS - parameter ( GLUT_MENU_NUM_ITEMS = 300 ) - integer*4 GLUT_DISPLAY_MODE_POSSIBLE - parameter ( GLUT_DISPLAY_MODE_POSSIBLE = 400 ) - integer*4 GLUT_INIT_WINDOW_X - parameter ( GLUT_INIT_WINDOW_X = 500 ) - integer*4 GLUT_INIT_WINDOW_Y - parameter ( GLUT_INIT_WINDOW_Y = 501 ) - integer*4 GLUT_INIT_WINDOW_WIDTH - parameter ( GLUT_INIT_WINDOW_WIDTH = 502 ) - integer*4 GLUT_INIT_WINDOW_HEIGHT - parameter ( GLUT_INIT_WINDOW_HEIGHT = 503 ) - integer*4 GLUT_INIT_DISPLAY_MODE - parameter ( GLUT_INIT_DISPLAY_MODE = 504 ) - integer*4 GLUT_ELAPSED_TIME - parameter ( GLUT_ELAPSED_TIME = 700 ) - -C glutDeviceGet parameters - integer*4 GLUT_HAS_KEYBOARD - parameter ( GLUT_HAS_KEYBOARD = 600 ) - integer*4 GLUT_HAS_MOUSE - parameter ( GLUT_HAS_MOUSE = 601 ) - integer*4 GLUT_HAS_SPACEBALL - parameter ( GLUT_HAS_SPACEBALL = 602 ) - integer*4 GLUT_HAS_DIAL_AND_BUTTON_BOX - parameter ( GLUT_HAS_DIAL_AND_BUTTON_BOX = 603 ) - integer*4 GLUT_HAS_TABLET - parameter ( GLUT_HAS_TABLET = 604 ) - integer*4 GLUT_NUM_MOUSE_BUTTONS - parameter ( GLUT_NUM_MOUSE_BUTTONS = 605 ) - integer*4 GLUT_NUM_SPACEBALL_BUTTONS - parameter ( GLUT_NUM_SPACEBALL_BUTTONS = 606 ) - integer*4 GLUT_NUM_BUTTON_BOX_BUTTONS - parameter ( GLUT_NUM_BUTTON_BOX_BUTTONS = 607 ) - integer*4 GLUT_NUM_DIALS - parameter ( GLUT_NUM_DIALS = 608 ) - integer*4 GLUT_NUM_TABLET_BUTTONS - parameter ( GLUT_NUM_TABLET_BUTTONS = 609 ) - -C glutLayerGet parameters - integer*4 GLUT_OVERLAY_POSSIBLE - parameter ( GLUT_OVERLAY_POSSIBLE = 800 ) - integer*4 GLUT_LAYER_IN_USE - parameter ( GLUT_LAYER_IN_USE = 801 ) - integer*4 GLUT_HAS_OVERLAY - parameter ( GLUT_HAS_OVERLAY = 802 ) - integer*4 GLUT_TRANSPARENT_INDEX - parameter ( GLUT_TRANSPARENT_INDEX = 803 ) - integer*4 GLUT_NORMAL_DAMAGED - parameter ( GLUT_NORMAL_DAMAGED = 804 ) - integer*4 GLUT_OVERLAY_DAMAGED - parameter ( GLUT_OVERLAY_DAMAGED = 805 ) - -C glutUseLayer parameters - integer*4 GLUT_NORMAL - parameter ( GLUT_NORMAL = 0 ) - integer*4 GLUT_OVERLAY - parameter ( GLUT_OVERLAY = 1 ) - -C glutGetModifiers return mask - integer*4 GLUT_ACTIVE_SHIFT - parameter ( GLUT_ACTIVE_SHIFT = 1 ) - integer*4 GLUT_ACTIVE_CTRL - parameter ( GLUT_ACTIVE_CTRL = 2 ) - integer*4 GLUT_ACTIVE_ALT - parameter ( GLUT_ACTIVE_ALT = 4 ) - -C glutSetCursor parameters - integer*4 GLUT_CURSOR_RIGHT_ARROW - parameter ( GLUT_CURSOR_RIGHT_ARROW = 0 ) - integer*4 GLUT_CURSOR_LEFT_ARROW - parameter ( GLUT_CURSOR_LEFT_ARROW = 1 ) - integer*4 GLUT_CURSOR_INFO - parameter ( GLUT_CURSOR_INFO = 2 ) - integer*4 GLUT_CURSOR_DESTROY - parameter ( GLUT_CURSOR_DESTROY = 3 ) - integer*4 GLUT_CURSOR_HELP - parameter ( GLUT_CURSOR_HELP = 4 ) - integer*4 GLUT_CURSOR_CYCLE - parameter ( GLUT_CURSOR_CYCLE = 5 ) - integer*4 GLUT_CURSOR_SPRAY - parameter ( GLUT_CURSOR_SPRAY = 6 ) - integer*4 GLUT_CURSOR_WAIT - parameter ( GLUT_CURSOR_WAIT = 7 ) - integer*4 GLUT_CURSOR_TEXT - parameter ( GLUT_CURSOR_TEXT = 8 ) - integer*4 GLUT_CURSOR_CROSSHAIR - parameter ( GLUT_CURSOR_CROSSHAIR = 9 ) - integer*4 GLUT_CURSOR_UP_DOWN - parameter ( GLUT_CURSOR_UP_DOWN = 10 ) - integer*4 GLUT_CURSOR_LEFT_RIGHT - parameter ( GLUT_CURSOR_LEFT_RIGHT = 11 ) - integer*4 GLUT_CURSOR_TOP_SIDE - parameter ( GLUT_CURSOR_TOP_SIDE = 12 ) - integer*4 GLUT_CURSOR_BOTTOM_SIDE - parameter ( GLUT_CURSOR_BOTTOM_SIDE = 13 ) - integer*4 GLUT_CURSOR_LEFT_SIDE - parameter ( GLUT_CURSOR_LEFT_SIDE = 14 ) - integer*4 GLUT_CURSOR_RIGHT_SIDE - parameter ( GLUT_CURSOR_RIGHT_SIDE = 15 ) - integer*4 GLUT_CURSOR_TOP_LEFT_CORNER - parameter ( GLUT_CURSOR_TOP_LEFT_CORNER = 16 ) - integer*4 GLUT_CURSOR_TOP_RIGHT_CORNER - parameter ( GLUT_CURSOR_TOP_RIGHT_CORNER = 17 ) - integer*4 GLUT_CURSOR_BOTTOM_RIGHT_CORNER - parameter ( GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18 ) - integer*4 GLUT_CURSOR_BOTTOM_LEFT_CORNER - parameter ( GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19 ) - integer*4 GLUT_CURSOR_INHERIT - parameter ( GLUT_CURSOR_INHERIT = 100 ) - integer*4 GLUT_CURSOR_NONE - parameter ( GLUT_CURSOR_NONE = 101 ) - integer*4 GLUT_CURSOR_FULL_CROSSHAIR - parameter ( GLUT_CURSOR_FULL_CROSSHAIR = 102 ) - -C GLUT functions - integer*4 glutcreatewindow - integer*4 glutcreatesubwindow - integer*4 glutgetwindow - integer*4 glutcreatemenu - integer*4 glutgetmenu - real glutgetcolor - integer*4 glutget - integer*4 glutdeviceget - integer*4 glutextensionsupported - -C GLUT NULL name - external glutnull - + +C Copyright (c) Mark J. Kilgard, 1994. + +C This program is freely distributable without licensing fees +C and is provided without guarantee or warrantee expressed or +C implied. This program is -not- in the public domain. + +C GLUT Fortran header file + +C display mode bit masks + integer*4 GLUT_RGB + parameter ( GLUT_RGB = 0 ) + integer*4 GLUT_RGBA + parameter ( GLUT_RGBA = 0 ) + integer*4 GLUT_INDEX + parameter ( GLUT_INDEX = 1 ) + integer*4 GLUT_SINGLE + parameter ( GLUT_SINGLE = 0 ) + integer*4 GLUT_DOUBLE + parameter ( GLUT_DOUBLE = 2 ) + integer*4 GLUT_ACCUM + parameter ( GLUT_ACCUM = 4 ) + integer*4 GLUT_ALPHA + parameter ( GLUT_ALPHA = 8 ) + integer*4 GLUT_DEPTH + parameter ( GLUT_DEPTH = 16 ) + integer*4 GLUT_STENCIL + parameter ( GLUT_STENCIL = 32 ) + integer*4 GLUT_MULTISAMPLE + parameter ( GLUT_MULTISAMPLE = 128 ) + integer*4 GLUT_STEREO + parameter ( GLUT_STEREO = 256 ) + +C mouse buttons + integer*4 GLUT_LEFT_BUTTON + parameter ( GLUT_LEFT_BUTTON = 0 ) + integer*4 GLUT_MIDDLE_BUTTON + parameter ( GLUT_MIDDLE_BUTTON = 1 ) + integer*4 GLUT_RIGHT_BUTTON + parameter ( GLUT_RIGHT_BUTTON = 2 ) + +C mouse button callback state + integer*4 GLUT_DOWN + parameter ( GLUT_DOWN = 0 ) + integer*4 GLUT_UP + parameter ( GLUT_UP = 1 ) + +C special key callback values + integer*4 GLUT_KEY_F1 + parameter ( GLUT_KEY_F1 = 1 ) + integer*4 GLUT_KEY_F2 + parameter ( GLUT_KEY_F2 = 2 ) + integer*4 GLUT_KEY_F3 + parameter ( GLUT_KEY_F3 = 3 ) + integer*4 GLUT_KEY_F4 + parameter ( GLUT_KEY_F4 = 4 ) + integer*4 GLUT_KEY_F5 + parameter ( GLUT_KEY_F5 = 5 ) + integer*4 GLUT_KEY_F6 + parameter ( GLUT_KEY_F6 = 6 ) + integer*4 GLUT_KEY_F7 + parameter ( GLUT_KEY_F7 = 7 ) + integer*4 GLUT_KEY_F8 + parameter ( GLUT_KEY_F8 = 8 ) + integer*4 GLUT_KEY_F9 + parameter ( GLUT_KEY_F9 = 9 ) + integer*4 GLUT_KEY_F10 + parameter ( GLUT_KEY_F10 = 10 ) + integer*4 GLUT_KEY_F11 + parameter ( GLUT_KEY_F11 = 11 ) + integer*4 GLUT_KEY_F12 + parameter ( GLUT_KEY_F12 = 12 ) + integer*4 GLUT_KEY_LEFT + parameter ( GLUT_KEY_LEFT = 100 ) + integer*4 GLUT_KEY_UP + parameter ( GLUT_KEY_UP = 101 ) + integer*4 GLUT_KEY_RIGHT + parameter ( GLUT_KEY_RIGHT = 102 ) + integer*4 GLUT_KEY_DOWN + parameter ( GLUT_KEY_DOWN = 103 ) + integer*4 GLUT_KEY_PAGE_UP + parameter ( GLUT_KEY_PAGE_UP = 104 ) + integer*4 GLUT_KEY_PAGE_DOWN + parameter ( GLUT_KEY_PAGE_DOWN = 105 ) + integer*4 GLUT_KEY_HOME + parameter ( GLUT_KEY_HOME = 106 ) + integer*4 GLUT_KEY_END + parameter ( GLUT_KEY_END = 107 ) + integer*4 GLUT_KEY_INSERT + parameter ( GLUT_KEY_INSERT = 108 ) + +C entry/exit callback state + integer*4 GLUT_LEFT + parameter ( GLUT_LEFT = 0 ) + integer*4 GLUT_ENTERED + parameter ( GLUT_ENTERED = 1 ) + +C menu usage callback state + integer*4 GLUT_MENU_NOT_IN_USE + parameter ( GLUT_MENU_NOT_IN_USE = 0 ) + integer*4 GLUT_MENU_IN_USE + parameter ( GLUT_MENU_IN_USE = 1 ) + +C visibility callback state + integer*4 GLUT_NOT_VISIBLE + parameter ( GLUT_NOT_VISIBLE = 0 ) + integer*4 GLUT_VISIBLE + parameter ( GLUT_VISIBLE = 1 ) + +C color index component selection values + integer*4 GLUT_RED + parameter ( GLUT_RED = 0 ) + integer*4 GLUT_GREEN + parameter ( GLUT_GREEN = 1 ) + integer*4 GLUT_BLUE + parameter ( GLUT_BLUE = 2 ) + +C XXX Unfortunately, SGI's Fortran compiler links with +C EXTERNAL data even if it is not used. This defeats +C the purpose of GLUT naming fonts via opaque symbols. +C This means GLUT Fortran programmers should explicitly +C declared EXTERNAL GLUT fonts in subroutines where +C the fonts are used. + +C stroke font opaque names +C external GLUT_STROKE_ROMAN +C external GLUT_STROKE_MONO_ROMAN + +C bitmap font opaque names +C external GLUT_BITMAP_9_BY_15 +C external GLUT_BITMAP_8_BY_13 +C external GLUT_BITMAP_TIMES_ROMAN_10 +C external GLUT_BITMAP_TIMES_ROMAN_24 +C external GLUT_BITMAP_HELVETICA_10 +C external GLUT_BITMAP_HELVETICA_12 +C external GLUT_BITMAP_HELVETICA_18 + +C glutGet parameters + integer*4 GLUT_WINDOW_X + parameter ( GLUT_WINDOW_X = 100 ) + integer*4 GLUT_WINDOW_Y + parameter ( GLUT_WINDOW_Y = 101 ) + integer*4 GLUT_WINDOW_WIDTH + parameter ( GLUT_WINDOW_WIDTH = 102 ) + integer*4 GLUT_WINDOW_HEIGHT + parameter ( GLUT_WINDOW_HEIGHT = 103 ) + integer*4 GLUT_WINDOW_BUFFER_SIZE + parameter ( GLUT_WINDOW_BUFFER_SIZE = 104 ) + integer*4 GLUT_WINDOW_STENCIL_SIZE + parameter ( GLUT_WINDOW_STENCIL_SIZE = 105 ) + integer*4 GLUT_WINDOW_DEPTH_SIZE + parameter ( GLUT_WINDOW_DEPTH_SIZE = 106 ) + integer*4 GLUT_WINDOW_RED_SIZE + parameter ( GLUT_WINDOW_RED_SIZE = 107 ) + integer*4 GLUT_WINDOW_GREEN_SIZE + parameter ( GLUT_WINDOW_GREEN_SIZE = 108 ) + integer*4 GLUT_WINDOW_BLUE_SIZE + parameter ( GLUT_WINDOW_BLUE_SIZE = 109 ) + integer*4 GLUT_WINDOW_ALPHA_SIZE + parameter ( GLUT_WINDOW_ALPHA_SIZE = 110 ) + integer*4 GLUT_WINDOW_ACCUM_RED_SIZE + parameter ( GLUT_WINDOW_ACCUM_RED_SIZE = 111 ) + integer*4 GLUT_WINDOW_ACCUM_GREEN_SIZE + parameter ( GLUT_WINDOW_ACCUM_GREEN_SIZE = 112 ) + integer*4 GLUT_WINDOW_ACCUM_BLUE_SIZE + parameter ( GLUT_WINDOW_ACCUM_BLUE_SIZE = 113 ) + integer*4 GLUT_WINDOW_ACCUM_ALPHA_SIZE + parameter ( GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114 ) + integer*4 GLUT_WINDOW_DOUBLEBUFFER + parameter ( GLUT_WINDOW_DOUBLEBUFFER = 115 ) + integer*4 GLUT_WINDOW_RGBA + parameter ( GLUT_WINDOW_RGBA = 116 ) + integer*4 GLUT_WINDOW_PARENT + parameter ( GLUT_WINDOW_PARENT = 117 ) + integer*4 GLUT_WINDOW_NUM_CHILDREN + parameter ( GLUT_WINDOW_NUM_CHILDREN = 118 ) + integer*4 GLUT_WINDOW_COLORMAP_SIZE + parameter ( GLUT_WINDOW_COLORMAP_SIZE = 119 ) + integer*4 GLUT_WINDOW_NUM_SAMPLES + parameter ( GLUT_WINDOW_NUM_SAMPLES = 120 ) + integer*4 GLUT_WINDOW_STEREO + parameter ( GLUT_WINDOW_STEREO = 121 ) + integer*4 GLUT_WINDOW_CURSOR + parameter ( GLUT_WINDOW_CURSOR = 122 ) + integer*4 GLUT_SCREEN_WIDTH + parameter ( GLUT_SCREEN_WIDTH = 200 ) + integer*4 GLUT_SCREEN_HEIGHT + parameter ( GLUT_SCREEN_HEIGHT = 201 ) + integer*4 GLUT_SCREEN_WIDTH_MM + parameter ( GLUT_SCREEN_WIDTH_MM = 202 ) + integer*4 GLUT_SCREEN_HEIGHT_MM + parameter ( GLUT_SCREEN_HEIGHT_MM = 203 ) + integer*4 GLUT_MENU_NUM_ITEMS + parameter ( GLUT_MENU_NUM_ITEMS = 300 ) + integer*4 GLUT_DISPLAY_MODE_POSSIBLE + parameter ( GLUT_DISPLAY_MODE_POSSIBLE = 400 ) + integer*4 GLUT_INIT_WINDOW_X + parameter ( GLUT_INIT_WINDOW_X = 500 ) + integer*4 GLUT_INIT_WINDOW_Y + parameter ( GLUT_INIT_WINDOW_Y = 501 ) + integer*4 GLUT_INIT_WINDOW_WIDTH + parameter ( GLUT_INIT_WINDOW_WIDTH = 502 ) + integer*4 GLUT_INIT_WINDOW_HEIGHT + parameter ( GLUT_INIT_WINDOW_HEIGHT = 503 ) + integer*4 GLUT_INIT_DISPLAY_MODE + parameter ( GLUT_INIT_DISPLAY_MODE = 504 ) + integer*4 GLUT_ELAPSED_TIME + parameter ( GLUT_ELAPSED_TIME = 700 ) + +C glutDeviceGet parameters + integer*4 GLUT_HAS_KEYBOARD + parameter ( GLUT_HAS_KEYBOARD = 600 ) + integer*4 GLUT_HAS_MOUSE + parameter ( GLUT_HAS_MOUSE = 601 ) + integer*4 GLUT_HAS_SPACEBALL + parameter ( GLUT_HAS_SPACEBALL = 602 ) + integer*4 GLUT_HAS_DIAL_AND_BUTTON_BOX + parameter ( GLUT_HAS_DIAL_AND_BUTTON_BOX = 603 ) + integer*4 GLUT_HAS_TABLET + parameter ( GLUT_HAS_TABLET = 604 ) + integer*4 GLUT_NUM_MOUSE_BUTTONS + parameter ( GLUT_NUM_MOUSE_BUTTONS = 605 ) + integer*4 GLUT_NUM_SPACEBALL_BUTTONS + parameter ( GLUT_NUM_SPACEBALL_BUTTONS = 606 ) + integer*4 GLUT_NUM_BUTTON_BOX_BUTTONS + parameter ( GLUT_NUM_BUTTON_BOX_BUTTONS = 607 ) + integer*4 GLUT_NUM_DIALS + parameter ( GLUT_NUM_DIALS = 608 ) + integer*4 GLUT_NUM_TABLET_BUTTONS + parameter ( GLUT_NUM_TABLET_BUTTONS = 609 ) + +C glutLayerGet parameters + integer*4 GLUT_OVERLAY_POSSIBLE + parameter ( GLUT_OVERLAY_POSSIBLE = 800 ) + integer*4 GLUT_LAYER_IN_USE + parameter ( GLUT_LAYER_IN_USE = 801 ) + integer*4 GLUT_HAS_OVERLAY + parameter ( GLUT_HAS_OVERLAY = 802 ) + integer*4 GLUT_TRANSPARENT_INDEX + parameter ( GLUT_TRANSPARENT_INDEX = 803 ) + integer*4 GLUT_NORMAL_DAMAGED + parameter ( GLUT_NORMAL_DAMAGED = 804 ) + integer*4 GLUT_OVERLAY_DAMAGED + parameter ( GLUT_OVERLAY_DAMAGED = 805 ) + +C glutUseLayer parameters + integer*4 GLUT_NORMAL + parameter ( GLUT_NORMAL = 0 ) + integer*4 GLUT_OVERLAY + parameter ( GLUT_OVERLAY = 1 ) + +C glutGetModifiers return mask + integer*4 GLUT_ACTIVE_SHIFT + parameter ( GLUT_ACTIVE_SHIFT = 1 ) + integer*4 GLUT_ACTIVE_CTRL + parameter ( GLUT_ACTIVE_CTRL = 2 ) + integer*4 GLUT_ACTIVE_ALT + parameter ( GLUT_ACTIVE_ALT = 4 ) + +C glutSetCursor parameters + integer*4 GLUT_CURSOR_RIGHT_ARROW + parameter ( GLUT_CURSOR_RIGHT_ARROW = 0 ) + integer*4 GLUT_CURSOR_LEFT_ARROW + parameter ( GLUT_CURSOR_LEFT_ARROW = 1 ) + integer*4 GLUT_CURSOR_INFO + parameter ( GLUT_CURSOR_INFO = 2 ) + integer*4 GLUT_CURSOR_DESTROY + parameter ( GLUT_CURSOR_DESTROY = 3 ) + integer*4 GLUT_CURSOR_HELP + parameter ( GLUT_CURSOR_HELP = 4 ) + integer*4 GLUT_CURSOR_CYCLE + parameter ( GLUT_CURSOR_CYCLE = 5 ) + integer*4 GLUT_CURSOR_SPRAY + parameter ( GLUT_CURSOR_SPRAY = 6 ) + integer*4 GLUT_CURSOR_WAIT + parameter ( GLUT_CURSOR_WAIT = 7 ) + integer*4 GLUT_CURSOR_TEXT + parameter ( GLUT_CURSOR_TEXT = 8 ) + integer*4 GLUT_CURSOR_CROSSHAIR + parameter ( GLUT_CURSOR_CROSSHAIR = 9 ) + integer*4 GLUT_CURSOR_UP_DOWN + parameter ( GLUT_CURSOR_UP_DOWN = 10 ) + integer*4 GLUT_CURSOR_LEFT_RIGHT + parameter ( GLUT_CURSOR_LEFT_RIGHT = 11 ) + integer*4 GLUT_CURSOR_TOP_SIDE + parameter ( GLUT_CURSOR_TOP_SIDE = 12 ) + integer*4 GLUT_CURSOR_BOTTOM_SIDE + parameter ( GLUT_CURSOR_BOTTOM_SIDE = 13 ) + integer*4 GLUT_CURSOR_LEFT_SIDE + parameter ( GLUT_CURSOR_LEFT_SIDE = 14 ) + integer*4 GLUT_CURSOR_RIGHT_SIDE + parameter ( GLUT_CURSOR_RIGHT_SIDE = 15 ) + integer*4 GLUT_CURSOR_TOP_LEFT_CORNER + parameter ( GLUT_CURSOR_TOP_LEFT_CORNER = 16 ) + integer*4 GLUT_CURSOR_TOP_RIGHT_CORNER + parameter ( GLUT_CURSOR_TOP_RIGHT_CORNER = 17 ) + integer*4 GLUT_CURSOR_BOTTOM_RIGHT_CORNER + parameter ( GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18 ) + integer*4 GLUT_CURSOR_BOTTOM_LEFT_CORNER + parameter ( GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19 ) + integer*4 GLUT_CURSOR_INHERIT + parameter ( GLUT_CURSOR_INHERIT = 100 ) + integer*4 GLUT_CURSOR_NONE + parameter ( GLUT_CURSOR_NONE = 101 ) + integer*4 GLUT_CURSOR_FULL_CROSSHAIR + parameter ( GLUT_CURSOR_FULL_CROSSHAIR = 102 ) + +C GLUT functions + integer*4 glutcreatewindow + integer*4 glutcreatesubwindow + integer*4 glutgetwindow + integer*4 glutcreatemenu + integer*4 glutgetmenu + real glutgetcolor + integer*4 glutget + integer*4 glutdeviceget + integer*4 glutextensionsupported + +C GLUT NULL name + external glutnull + diff --git a/Externals/GLew/gl.h b/Externals/GLew/gl.h index 59fe40d3a4..54049bdfaa 100644 --- a/Externals/GLew/gl.h +++ b/Externals/GLew/gl.h @@ -1,1914 +1,1914 @@ -#ifndef __gl_h_ -#define __gl_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -*/ - -#ifndef _WIN32 -#define WINGDIAPI -#define APIENTRY -#endif - -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef signed char GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void GLvoid; - -/*************************************************************/ - -/* Version */ -#define GL_VERSION_1_1 1 -#define GL_VERSION_1_2 1 - -/* Extensions */ -#define GL_ARB_imaging 1 -#define GL_ARB_multitexture 1 - -/* AccumOp */ -#define GL_ACCUM 0x0100 -#define GL_LOAD 0x0101 -#define GL_RETURN 0x0102 -#define GL_MULT 0x0103 -#define GL_ADD 0x0104 - -/* AlphaFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* AttribMask */ -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0x000fffff - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 - -/* BlendEquationMode */ -/* GL_LOGIC_OP */ -/* GL_FUNC_ADD */ -/* GL_MIN */ -/* GL_MAX */ -/* GL_FUNC_SUBTRACT */ -/* GL_FUNC_REVERSE_SUBTRACT */ - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -/* GL_CONSTANT_COLOR */ -/* GL_ONE_MINUS_CONSTANT_COLOR */ -/* GL_CONSTANT_ALPHA */ -/* GL_ONE_MINUS_CONSTANT_ALPHA */ - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ -/* GL_CONSTANT_COLOR */ -/* GL_ONE_MINUS_CONSTANT_COLOR */ -/* GL_CONSTANT_ALPHA */ -/* GL_ONE_MINUS_CONSTANT_ALPHA */ - -/* Boolean */ -#define GL_TRUE 1 -#define GL_FALSE 0 - -/* ClearBufferMask */ -/* GL_COLOR_BUFFER_BIT */ -/* GL_ACCUM_BUFFER_BIT */ -/* GL_STENCIL_BUFFER_BIT */ -/* GL_DEPTH_BUFFER_BIT */ - -/* ClientArrayType */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ - -/* ClipPlaneName */ -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 - -/* ColorMaterialFace */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* ColorMaterialParameter */ -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ -/* GL_EMISSION */ -/* GL_AMBIENT_AND_DIFFUSE */ - -/* ColorPointerType */ -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* ColorTableParameterPName */ -/* GL_COLOR_TABLE_SCALE */ -/* GL_COLOR_TABLE_BIAS */ - -/* ColorTableTarget */ -/* GL_COLOR_TABLE */ -/* GL_POST_CONVOLUTION_COLOR_TABLE */ -/* GL_POST_COLOR_MATRIX_COLOR_TABLE */ -/* GL_PROXY_COLOR_TABLE */ -/* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ -/* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - -/* ConvolutionBorderMode */ -/* GL_REDUCE */ -/* GL_IGNORE_BORDER */ -/* GL_CONSTANT_BORDER */ - -/* ConvolutionParameter */ -/* GL_CONVOLUTION_BORDER_MODE */ -/* GL_CONVOLUTION_FILTER_SCALE */ -/* GL_CONVOLUTION_FILTER_BIAS */ - -/* ConvolutionTarget */ -/* GL_CONVOLUTION_1D */ -/* GL_CONVOLUTION_2D */ - -/* CullFaceMode */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 -#define GL_DOUBLE 0x140A - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* DrawBufferMode */ -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C - -/* Enable */ -/* GL_FOG */ -/* GL_LIGHTING */ -/* GL_TEXTURE_1D */ -/* GL_TEXTURE_2D */ -/* GL_LINE_STIPPLE */ -/* GL_POLYGON_STIPPLE */ -/* GL_CULL_FACE */ -/* GL_ALPHA_TEST */ -/* GL_BLEND */ -/* GL_INDEX_LOGIC_OP */ -/* GL_COLOR_LOGIC_OP */ -/* GL_DITHER */ -/* GL_STENCIL_TEST */ -/* GL_DEPTH_TEST */ -/* GL_CLIP_PLANE0 */ -/* GL_CLIP_PLANE1 */ -/* GL_CLIP_PLANE2 */ -/* GL_CLIP_PLANE3 */ -/* GL_CLIP_PLANE4 */ -/* GL_CLIP_PLANE5 */ -/* GL_LIGHT0 */ -/* GL_LIGHT1 */ -/* GL_LIGHT2 */ -/* GL_LIGHT3 */ -/* GL_LIGHT4 */ -/* GL_LIGHT5 */ -/* GL_LIGHT6 */ -/* GL_LIGHT7 */ -/* GL_TEXTURE_GEN_S */ -/* GL_TEXTURE_GEN_T */ -/* GL_TEXTURE_GEN_R */ -/* GL_TEXTURE_GEN_Q */ -/* GL_MAP1_VERTEX_3 */ -/* GL_MAP1_VERTEX_4 */ -/* GL_MAP1_COLOR_4 */ -/* GL_MAP1_INDEX */ -/* GL_MAP1_NORMAL */ -/* GL_MAP1_TEXTURE_COORD_1 */ -/* GL_MAP1_TEXTURE_COORD_2 */ -/* GL_MAP1_TEXTURE_COORD_3 */ -/* GL_MAP1_TEXTURE_COORD_4 */ -/* GL_MAP2_VERTEX_3 */ -/* GL_MAP2_VERTEX_4 */ -/* GL_MAP2_COLOR_4 */ -/* GL_MAP2_INDEX */ -/* GL_MAP2_NORMAL */ -/* GL_MAP2_TEXTURE_COORD_1 */ -/* GL_MAP2_TEXTURE_COORD_2 */ -/* GL_MAP2_TEXTURE_COORD_3 */ -/* GL_MAP2_TEXTURE_COORD_4 */ -/* GL_POINT_SMOOTH */ -/* GL_LINE_SMOOTH */ -/* GL_POLYGON_SMOOTH */ -/* GL_SCISSOR_TEST */ -/* GL_COLOR_MATERIAL */ -/* GL_NORMALIZE */ -/* GL_AUTO_NORMAL */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ -/* GL_POLYGON_OFFSET_POINT */ -/* GL_POLYGON_OFFSET_LINE */ -/* GL_POLYGON_OFFSET_FILL */ -/* GL_COLOR_TABLE */ -/* GL_POST_CONVOLUTION_COLOR_TABLE */ -/* GL_POST_COLOR_MATRIX_COLOR_TABLE */ -/* GL_CONVOLUTION_1D */ -/* GL_CONVOLUTION_2D */ -/* GL_SEPARABLE_2D */ -/* GL_HISTOGRAM */ -/* GL_MINMAX */ -/* GL_RESCALE_NORMAL */ -/* GL_TEXTURE_3D */ - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_OUT_OF_MEMORY 0x0505 -/* GL_TABLE_TOO_LARGE */ - -/* FeedBackMode */ -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 - -/* FeedBackToken */ -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_LINE_RESET_TOKEN 0x0707 - -/* FogMode */ -/* GL_LINEAR */ -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 - -/* FogParameter */ -/* GL_FOG_COLOR */ -/* GL_FOG_DENSITY */ -/* GL_FOG_END */ -/* GL_FOG_INDEX */ -/* GL_FOG_MODE */ -/* GL_FOG_START */ - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetColorTableParameterPName */ -/* GL_COLOR_TABLE_SCALE */ -/* GL_COLOR_TABLE_BIAS */ -/* GL_COLOR_TABLE_FORMAT */ -/* GL_COLOR_TABLE_WIDTH */ -/* GL_COLOR_TABLE_RED_SIZE */ -/* GL_COLOR_TABLE_GREEN_SIZE */ -/* GL_COLOR_TABLE_BLUE_SIZE */ -/* GL_COLOR_TABLE_ALPHA_SIZE */ -/* GL_COLOR_TABLE_LUMINANCE_SIZE */ -/* GL_COLOR_TABLE_INTENSITY_SIZE */ - -/* GetConvolutionParameterPName */ -/* GL_CONVOLUTION_BORDER_COLOR */ -/* GL_CONVOLUTION_BORDER_MODE */ -/* GL_CONVOLUTION_FILTER_SCALE */ -/* GL_CONVOLUTION_FILTER_BIAS */ -/* GL_CONVOLUTION_FORMAT */ -/* GL_CONVOLUTION_WIDTH */ -/* GL_CONVOLUTION_HEIGHT */ -/* GL_MAX_CONVOLUTION_WIDTH */ -/* GL_MAX_CONVOLUTION_HEIGHT */ - -/* GetHistogramParameterPName */ -/* GL_HISTOGRAM_WIDTH */ -/* GL_HISTOGRAM_FORMAT */ -/* GL_HISTOGRAM_RED_SIZE */ -/* GL_HISTOGRAM_GREEN_SIZE */ -/* GL_HISTOGRAM_BLUE_SIZE */ -/* GL_HISTOGRAM_ALPHA_SIZE */ -/* GL_HISTOGRAM_LUMINANCE_SIZE */ -/* GL_HISTOGRAM_SINK */ - -/* GetMapTarget */ -#define GL_COEFF 0x0A00 -#define GL_ORDER 0x0A01 -#define GL_DOMAIN 0x0A02 - -/* GetMinmaxParameterPName */ -/* GL_MINMAX_FORMAT */ -/* GL_MINMAX_SINK */ - -/* GetPixelMap */ -/* GL_PIXEL_MAP_I_TO_I */ -/* GL_PIXEL_MAP_S_TO_S */ -/* GL_PIXEL_MAP_I_TO_R */ -/* GL_PIXEL_MAP_I_TO_G */ -/* GL_PIXEL_MAP_I_TO_B */ -/* GL_PIXEL_MAP_I_TO_A */ -/* GL_PIXEL_MAP_R_TO_R */ -/* GL_PIXEL_MAP_G_TO_G */ -/* GL_PIXEL_MAP_B_TO_B */ -/* GL_PIXEL_MAP_A_TO_A */ - -/* GetPointerTarget */ -/* GL_VERTEX_ARRAY_POINTER */ -/* GL_NORMAL_ARRAY_POINTER */ -/* GL_COLOR_ARRAY_POINTER */ -/* GL_INDEX_ARRAY_POINTER */ -/* GL_TEXTURE_COORD_ARRAY_POINTER */ -/* GL_EDGE_FLAG_ARRAY_POINTER */ - -/* GetTarget */ -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -/* GL_SMOOTH_POINT_SIZE_RANGE */ -/* GL_SMOOTH_POINT_SIZE_GRANULARITY */ -/* GL_SMOOTH_LINE_WIDTH_RANGE */ -/* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ -/* GL_ALIASED_POINT_SIZE_RANGE */ -/* GL_ALIASED_LINE_WIDTH_RANGE */ -#define GL_LIST_MODE 0x0B30 -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_LIST_BASE 0x0B32 -#define GL_LIST_INDEX 0x0B33 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_SHADE_MODEL 0x0B54 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_FOG 0x0B60 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_NORMALIZE 0x0BA1 -#define GL_VIEWPORT 0x0BA2 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_INDEX_MODE 0x0C30 -#define GL_RGBA_MODE 0x0C31 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_RENDER_MODE 0x0C40 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_FOG_HINT 0x0C54 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_INDEX_BITS 0x0D51 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 -#define GL_SELECTION_BUFFER_POINTER 0x0DF3 -#define GL_SELECTION_BUFFER_SIZE 0x0DF4 -/* GL_TEXTURE_BINDING_1D */ -/* GL_TEXTURE_BINDING_2D */ -/* GL_TEXTURE_BINDING_3D */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ -/* GL_VERTEX_ARRAY_SIZE */ -/* GL_VERTEX_ARRAY_TYPE */ -/* GL_VERTEX_ARRAY_STRIDE */ -/* GL_NORMAL_ARRAY_TYPE */ -/* GL_NORMAL_ARRAY_STRIDE */ -/* GL_COLOR_ARRAY_SIZE */ -/* GL_COLOR_ARRAY_TYPE */ -/* GL_COLOR_ARRAY_STRIDE */ -/* GL_INDEX_ARRAY_TYPE */ -/* GL_INDEX_ARRAY_STRIDE */ -/* GL_TEXTURE_COORD_ARRAY_SIZE */ -/* GL_TEXTURE_COORD_ARRAY_TYPE */ -/* GL_TEXTURE_COORD_ARRAY_STRIDE */ -/* GL_EDGE_FLAG_ARRAY_STRIDE */ -/* GL_POLYGON_OFFSET_FACTOR */ -/* GL_POLYGON_OFFSET_UNITS */ -/* GL_COLOR_TABLE */ -/* GL_POST_CONVOLUTION_COLOR_TABLE */ -/* GL_POST_COLOR_MATRIX_COLOR_TABLE */ -/* GL_CONVOLUTION_1D */ -/* GL_CONVOLUTION_2D */ -/* GL_SEPARABLE_2D */ -/* GL_POST_CONVOLUTION_RED_SCALE */ -/* GL_POST_CONVOLUTION_GREEN_SCALE */ -/* GL_POST_CONVOLUTION_BLUE_SCALE */ -/* GL_POST_CONVOLUTION_ALPHA_SCALE */ -/* GL_POST_CONVOLUTION_RED_BIAS */ -/* GL_POST_CONVOLUTION_GREEN_BIAS */ -/* GL_POST_CONVOLUTION_BLUE_BIAS */ -/* GL_POST_CONVOLUTION_ALPHA_BIAS */ -/* GL_COLOR_MATRIX */ -/* GL_COLOR_MATRIX_STACK_DEPTH */ -/* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ -/* GL_POST_COLOR_MATRIX_RED_SCALE */ -/* GL_POST_COLOR_MATRIX_GREEN_SCALE */ -/* GL_POST_COLOR_MATRIX_BLUE_SCALE */ -/* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ -/* GL_POST_COLOR_MATRIX_RED_BIAS */ -/* GL_POST_COLOR_MATRIX_GREEN_BIAS */ -/* GL_POST_COLOR_MATRIX_BLUE_BIAS */ -/* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ -/* GL_HISTOGRAM */ -/* GL_MINMAX */ -/* GL_MAX_ELEMENTS_VERTICES */ -/* GL_MAX_ELEMENTS_INDICES */ -/* GL_RESCALE_NORMAL */ -/* GL_LIGHT_MODEL_COLOR_CONTROL */ -/* GL_PACK_SKIP_IMAGES */ -/* GL_PACK_IMAGE_HEIGHT */ -/* GL_UNPACK_SKIP_IMAGES */ -/* GL_UNPACK_IMAGE_HEIGHT */ -/* GL_TEXTURE_3D */ -/* GL_MAX_3D_TEXTURE_SIZE */ -/* GL_BLEND_COLOR */ -/* GL_BLEND_EQUATION */ -/* GL_ACTIVE_TEXTURE_ARB */ -/* GL_CLIENT_ACTIVE_TEXTURE_ARB */ -/* GL_MAX_TEXTURE_UNITS_ARB */ - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_BORDER 0x1005 -/* GL_TEXTURE_RED_SIZE */ -/* GL_TEXTURE_GREEN_SIZE */ -/* GL_TEXTURE_BLUE_SIZE */ -/* GL_TEXTURE_ALPHA_SIZE */ -/* GL_TEXTURE_LUMINANCE_SIZE */ -/* GL_TEXTURE_INTENSITY_SIZE */ -/* GL_TEXTURE_PRIORITY */ -/* GL_TEXTURE_RESIDENT */ -/* GL_TEXTURE_DEPTH */ -/* GL_TEXTURE_WRAP_R */ -/* GL_TEXTURE_MIN_LOD */ -/* GL_TEXTURE_MAX_LOD */ -/* GL_TEXTURE_BASE_LEVEL */ -/* GL_TEXTURE_MAX_LEVEL */ - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -/* GL_PERSPECTIVE_CORRECTION_HINT */ -/* GL_POINT_SMOOTH_HINT */ -/* GL_LINE_SMOOTH_HINT */ -/* GL_POLYGON_SMOOTH_HINT */ -/* GL_FOG_HINT */ - -/* HistogramTarget */ -/* GL_HISTOGRAM */ -/* GL_PROXY_HISTOGRAM */ - -/* IndexPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* LightModelColorControl */ -/* GL_SINGLE_COLOR */ -/* GL_SEPARATE_SPECULAR_COLOR */ - -/* LightModelParameter */ -/* GL_LIGHT_MODEL_AMBIENT */ -/* GL_LIGHT_MODEL_LOCAL_VIEWER */ -/* GL_LIGHT_MODEL_TWO_SIDE */ -/* GL_LIGHT_MODEL_COLOR_CONTROL */ - -/* LightName */ -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 - -/* LightParameter */ -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 - -/* InterleavedArrays */ -/* GL_V2F */ -/* GL_V3F */ -/* GL_C4UB_V2F */ -/* GL_C4UB_V3F */ -/* GL_C3F_V3F */ -/* GL_N3F_V3F */ -/* GL_C4F_N3F_V3F */ -/* GL_T2F_V3F */ -/* GL_T4F_V4F */ -/* GL_T2F_C4UB_V3F */ -/* GL_T2F_C3F_V3F */ -/* GL_T2F_N3F_V3F */ -/* GL_T2F_C4F_N3F_V3F */ -/* GL_T4F_C4F_N3F_V4F */ - -/* ListMode */ -#define GL_COMPILE 0x1300 -#define GL_COMPILE_AND_EXECUTE 0x1301 - -/* ListNameType */ -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_2_BYTES */ -/* GL_3_BYTES */ -/* GL_4_BYTES */ - -/* LogicOp */ -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F - -/* MapTarget */ -/* GL_MAP1_COLOR_4 */ -/* GL_MAP1_INDEX */ -/* GL_MAP1_NORMAL */ -/* GL_MAP1_TEXTURE_COORD_1 */ -/* GL_MAP1_TEXTURE_COORD_2 */ -/* GL_MAP1_TEXTURE_COORD_3 */ -/* GL_MAP1_TEXTURE_COORD_4 */ -/* GL_MAP1_VERTEX_3 */ -/* GL_MAP1_VERTEX_4 */ -/* GL_MAP2_COLOR_4 */ -/* GL_MAP2_INDEX */ -/* GL_MAP2_NORMAL */ -/* GL_MAP2_TEXTURE_COORD_1 */ -/* GL_MAP2_TEXTURE_COORD_2 */ -/* GL_MAP2_TEXTURE_COORD_3 */ -/* GL_MAP2_TEXTURE_COORD_4 */ -/* GL_MAP2_VERTEX_3 */ -/* GL_MAP2_VERTEX_4 */ - -/* MaterialFace */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* MaterialParameter */ -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ - -/* MatrixMode */ -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_TEXTURE 0x1702 - -/* MeshMode1 */ -/* GL_POINT */ -/* GL_LINE */ - -/* MeshMode2 */ -/* GL_POINT */ -/* GL_LINE */ -/* GL_FILL */ - -/* MinmaxTarget */ -/* GL_MINMAX */ - -/* NormalPointerType */ -/* GL_BYTE */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* PixelCopyType */ -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 - -/* PixelFormat */ -#define GL_COLOR_INDEX 0x1900 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -/* GL_ABGR */ - -/* PixelInternalFormat */ -/* GL_ALPHA4 */ -/* GL_ALPHA8 */ -/* GL_ALPHA12 */ -/* GL_ALPHA16 */ -/* GL_LUMINANCE4 */ -/* GL_LUMINANCE8 */ -/* GL_LUMINANCE12 */ -/* GL_LUMINANCE16 */ -/* GL_LUMINANCE4_ALPHA4 */ -/* GL_LUMINANCE6_ALPHA2 */ -/* GL_LUMINANCE8_ALPHA8 */ -/* GL_LUMINANCE12_ALPHA4 */ -/* GL_LUMINANCE12_ALPHA12 */ -/* GL_LUMINANCE16_ALPHA16 */ -/* GL_INTENSITY */ -/* GL_INTENSITY4 */ -/* GL_INTENSITY8 */ -/* GL_INTENSITY12 */ -/* GL_INTENSITY16 */ -/* GL_R3_G3_B2 */ -/* GL_RGB4 */ -/* GL_RGB5 */ -/* GL_RGB8 */ -/* GL_RGB10 */ -/* GL_RGB12 */ -/* GL_RGB16 */ -/* GL_RGBA2 */ -/* GL_RGBA4 */ -/* GL_RGB5_A1 */ -/* GL_RGBA8 */ -/* GL_RGB10_A2 */ -/* GL_RGBA12 */ -/* GL_RGBA16 */ - -/* PixelMap */ -/* GL_PIXEL_MAP_I_TO_I */ -/* GL_PIXEL_MAP_S_TO_S */ -/* GL_PIXEL_MAP_I_TO_R */ -/* GL_PIXEL_MAP_I_TO_G */ -/* GL_PIXEL_MAP_I_TO_B */ -/* GL_PIXEL_MAP_I_TO_A */ -/* GL_PIXEL_MAP_R_TO_R */ -/* GL_PIXEL_MAP_G_TO_G */ -/* GL_PIXEL_MAP_B_TO_B */ -/* GL_PIXEL_MAP_A_TO_A */ - -/* PixelStore */ -/* GL_UNPACK_SWAP_BYTES */ -/* GL_UNPACK_LSB_FIRST */ -/* GL_UNPACK_ROW_LENGTH */ -/* GL_UNPACK_SKIP_ROWS */ -/* GL_UNPACK_SKIP_PIXELS */ -/* GL_UNPACK_ALIGNMENT */ -/* GL_PACK_SWAP_BYTES */ -/* GL_PACK_LSB_FIRST */ -/* GL_PACK_ROW_LENGTH */ -/* GL_PACK_SKIP_ROWS */ -/* GL_PACK_SKIP_PIXELS */ -/* GL_PACK_ALIGNMENT */ -/* GL_PACK_SKIP_IMAGES */ -/* GL_PACK_IMAGE_HEIGHT */ -/* GL_UNPACK_SKIP_IMAGES */ -/* GL_UNPACK_IMAGE_HEIGHT */ - -/* PixelTransfer */ -/* GL_MAP_COLOR */ -/* GL_MAP_STENCIL */ -/* GL_INDEX_SHIFT */ -/* GL_INDEX_OFFSET */ -/* GL_RED_SCALE */ -/* GL_RED_BIAS */ -/* GL_GREEN_SCALE */ -/* GL_GREEN_BIAS */ -/* GL_BLUE_SCALE */ -/* GL_BLUE_BIAS */ -/* GL_ALPHA_SCALE */ -/* GL_ALPHA_BIAS */ -/* GL_DEPTH_SCALE */ -/* GL_DEPTH_BIAS */ -/* GL_POST_CONVOLUTION_RED_SCALE */ -/* GL_POST_CONVOLUTION_GREEN_SCALE */ -/* GL_POST_CONVOLUTION_BLUE_SCALE */ -/* GL_POST_CONVOLUTION_ALPHA_SCALE */ -/* GL_POST_CONVOLUTION_RED_BIAS */ -/* GL_POST_CONVOLUTION_GREEN_BIAS */ -/* GL_POST_CONVOLUTION_BLUE_BIAS */ -/* GL_POST_CONVOLUTION_ALPHA_BIAS */ -/* GL_POST_COLOR_MATRIX_RED_SCALE */ -/* GL_POST_COLOR_MATRIX_GREEN_SCALE */ -/* GL_POST_COLOR_MATRIX_BLUE_SCALE */ -/* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ -/* GL_POST_COLOR_MATRIX_RED_BIAS */ -/* GL_POST_COLOR_MATRIX_GREEN_BIAS */ -/* GL_POST_COLOR_MATRIX_BLUE_BIAS */ -/* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - -/* PixelType */ -#define GL_BITMAP 0x1A00 -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_BGR */ -/* GL_BGRA */ -/* GL_UNSIGNED_BYTE_3_3_2 */ -/* GL_UNSIGNED_SHORT_4_4_4_4 */ -/* GL_UNSIGNED_SHORT_5_5_5_1 */ -/* GL_UNSIGNED_INT_8_8_8_8 */ -/* GL_UNSIGNED_INT_10_10_10_2 */ -/* GL_UNSIGNED_SHORT_5_6_5 */ -/* GL_UNSIGNED_BYTE_2_3_3_REV */ -/* GL_UNSIGNED_SHORT_5_6_5_REV */ -/* GL_UNSIGNED_SHORT_4_4_4_4_REV */ -/* GL_UNSIGNED_SHORT_1_5_5_5_REV */ -/* GL_UNSIGNED_INT_8_8_8_8_REV */ -/* GL_UNSIGNED_INT_2_10_10_10_REV */ - -/* PolygonMode */ -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 - -/* ReadBufferMode */ -/* GL_FRONT_LEFT */ -/* GL_FRONT_RIGHT */ -/* GL_BACK_LEFT */ -/* GL_BACK_RIGHT */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_LEFT */ -/* GL_RIGHT */ -/* GL_AUX0 */ -/* GL_AUX1 */ -/* GL_AUX2 */ -/* GL_AUX3 */ - -/* RenderingMode */ -#define GL_RENDER 0x1C00 -#define GL_FEEDBACK 0x1C01 -#define GL_SELECT 0x1C02 - -/* SeparableTarget */ -/* GL_SEPARABLE_2D */ - -/* ShadingModel */ -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 - -/* StencilFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -/* GL_INVERT */ - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureCoordName */ -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 - -/* TexCoordPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* TextureEnvMode */ -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -/* GL_BLEND */ -/* GL_REPLACE */ - -/* TextureEnvParameter */ -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 - -/* TextureEnvTarget */ -#define GL_TEXTURE_ENV 0x2300 - -/* TextureGenMode */ -#define GL_EYE_LINEAR 0x2400 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_SPHERE_MAP 0x2402 - -/* TextureGenParameter */ -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_PLANE 0x2502 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -/* GL_TEXTURE_BORDER_COLOR */ -/* GL_TEXTURE_PRIORITY */ -/* GL_TEXTURE_WRAP_R */ -/* GL_TEXTURE_MIN_LOD */ -/* GL_TEXTURE_MAX_LOD */ -/* GL_TEXTURE_BASE_LEVEL */ -/* GL_TEXTURE_MAX_LEVEL */ - -/* TextureTarget */ -/* GL_TEXTURE_1D */ -/* GL_TEXTURE_2D */ -/* GL_PROXY_TEXTURE_1D */ -/* GL_PROXY_TEXTURE_2D */ -/* GL_TEXTURE_3D */ -/* GL_PROXY_TEXTURE_3D */ - -/* TextureUnit */ -/* GL_TEXTURE0_ARB */ -/* GL_TEXTURE1_ARB */ -/* GL_TEXTURE2_ARB */ -/* GL_TEXTURE3_ARB */ -/* GL_TEXTURE4_ARB */ -/* GL_TEXTURE5_ARB */ -/* GL_TEXTURE6_ARB */ -/* GL_TEXTURE7_ARB */ -/* GL_TEXTURE8_ARB */ -/* GL_TEXTURE9_ARB */ -/* GL_TEXTURE10_ARB */ -/* GL_TEXTURE11_ARB */ -/* GL_TEXTURE12_ARB */ -/* GL_TEXTURE13_ARB */ -/* GL_TEXTURE14_ARB */ -/* GL_TEXTURE15_ARB */ -/* GL_TEXTURE16_ARB */ -/* GL_TEXTURE17_ARB */ -/* GL_TEXTURE18_ARB */ -/* GL_TEXTURE19_ARB */ -/* GL_TEXTURE20_ARB */ -/* GL_TEXTURE21_ARB */ -/* GL_TEXTURE22_ARB */ -/* GL_TEXTURE23_ARB */ -/* GL_TEXTURE24_ARB */ -/* GL_TEXTURE25_ARB */ -/* GL_TEXTURE26_ARB */ -/* GL_TEXTURE27_ARB */ -/* GL_TEXTURE28_ARB */ -/* GL_TEXTURE29_ARB */ -/* GL_TEXTURE30_ARB */ -/* GL_TEXTURE31_ARB */ - -/* TextureWrapMode */ -#define GL_CLAMP 0x2900 -#define GL_REPEAT 0x2901 -/* GL_CLAMP_TO_EDGE */ - -/* VertexPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* ClientAttribMask */ -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff - -/* polygon_offset */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 - -/* texture */ -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 - -/* texture_object */ -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_BINDING_3D 0x806A - -/* vertex_array */ -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D - -/* bgra */ -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 - -/* blend_color */ -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 - -/* blend_minmax */ -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 - -/* blend_subtract */ -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B - -/* color_matrix */ -#define GL_COLOR_MATRIX 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB - -/* color_table */ -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 -#define GL_COLOR_TABLE_SCALE 0x80D6 -#define GL_COLOR_TABLE_BIAS 0x80D7 -#define GL_COLOR_TABLE_FORMAT 0x80D8 -#define GL_COLOR_TABLE_WIDTH 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF - -/* convolution */ -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 - -/* draw_range_elements */ -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 - -/* histogram */ -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C -#define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E -#define GL_MINMAX_FORMAT 0x802F -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 - -/* packed_pixels */ -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 - -/* rescale_normal */ -#define GL_RESCALE_NORMAL 0x803A - -/* separate_specular_color */ -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA - -/* texture3D */ -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 - -/* texture_edge_clamp */ -#define GL_CLAMP_TO_EDGE 0x812F - -/* texture_lod */ -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D - -/* GetTarget1_2 */ -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E - -/* multitexture */ -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 - -/* Extensions */ -#define GL_EXT_abgr 1 -#define GL_EXT_blend_color 1 -#define GL_EXT_blend_minmax 1 -#define GL_EXT_blend_subtract 1 -#define GL_EXT_texture_env_combine 1 -#define GL_EXT_texture_env_add 1 - -/* EXT_abgr */ -#define GL_ABGR_EXT 0x8000 - -/* EXT_blend_color */ -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 - -/* EXT_blend_minmax */ -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_BLEND_EQUATION_EXT 0x8009 - -/* EXT_blend_subtract */ -#define GL_FUNC_SUBTRACT_EXT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B - -/* EXT_texture_env_combine */ -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858A -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859A - -/* For compatibility with OpenGL v1.0 */ -#define GL_LOGIC_OP GL_INDEX_LOGIC_OP -#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT - -/*************************************************************/ - -WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value); -WINGDIAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref); -WINGDIAPI GLboolean APIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); -WINGDIAPI void APIENTRY glArrayElement (GLint i); -WINGDIAPI void APIENTRY glBegin (GLenum mode); -WINGDIAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); -WINGDIAPI void APIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); -WINGDIAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -WINGDIAPI void APIENTRY glCallList (GLuint list); -WINGDIAPI void APIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists); -WINGDIAPI void APIENTRY glClear (GLbitfield mask); -WINGDIAPI void APIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -WINGDIAPI void APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -WINGDIAPI void APIENTRY glClearDepth (GLclampd depth); -WINGDIAPI void APIENTRY glClearIndex (GLfloat c); -WINGDIAPI void APIENTRY glClearStencil (GLint s); -WINGDIAPI void APIENTRY glClipPlane (GLenum plane, const GLdouble *equation); -WINGDIAPI void APIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue); -WINGDIAPI void APIENTRY glColor3bv (const GLbyte *v); -WINGDIAPI void APIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue); -WINGDIAPI void APIENTRY glColor3dv (const GLdouble *v); -WINGDIAPI void APIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue); -WINGDIAPI void APIENTRY glColor3fv (const GLfloat *v); -WINGDIAPI void APIENTRY glColor3i (GLint red, GLint green, GLint blue); -WINGDIAPI void APIENTRY glColor3iv (const GLint *v); -WINGDIAPI void APIENTRY glColor3s (GLshort red, GLshort green, GLshort blue); -WINGDIAPI void APIENTRY glColor3sv (const GLshort *v); -WINGDIAPI void APIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue); -WINGDIAPI void APIENTRY glColor3ubv (const GLubyte *v); -WINGDIAPI void APIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue); -WINGDIAPI void APIENTRY glColor3uiv (const GLuint *v); -WINGDIAPI void APIENTRY glColor3us (GLushort red, GLushort green, GLushort blue); -WINGDIAPI void APIENTRY glColor3usv (const GLushort *v); -WINGDIAPI void APIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); -WINGDIAPI void APIENTRY glColor4bv (const GLbyte *v); -WINGDIAPI void APIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); -WINGDIAPI void APIENTRY glColor4dv (const GLdouble *v); -WINGDIAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -WINGDIAPI void APIENTRY glColor4fv (const GLfloat *v); -WINGDIAPI void APIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha); -WINGDIAPI void APIENTRY glColor4iv (const GLint *v); -WINGDIAPI void APIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); -WINGDIAPI void APIENTRY glColor4sv (const GLshort *v); -WINGDIAPI void APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -WINGDIAPI void APIENTRY glColor4ubv (const GLubyte *v); -WINGDIAPI void APIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); -WINGDIAPI void APIENTRY glColor4uiv (const GLuint *v); -WINGDIAPI void APIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); -WINGDIAPI void APIENTRY glColor4usv (const GLushort *v); -WINGDIAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -WINGDIAPI void APIENTRY glColorMaterial (GLenum face, GLenum mode); -WINGDIAPI void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -WINGDIAPI void APIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); -WINGDIAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -WINGDIAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -WINGDIAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -WINGDIAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -WINGDIAPI void APIENTRY glCullFace (GLenum mode); -WINGDIAPI void APIENTRY glDeleteLists (GLuint list, GLsizei range); -WINGDIAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -WINGDIAPI void APIENTRY glDepthFunc (GLenum func); -WINGDIAPI void APIENTRY glDepthMask (GLboolean flag); -WINGDIAPI void APIENTRY glDepthRange (GLclampd zNear, GLclampd zFar); -WINGDIAPI void APIENTRY glDisable (GLenum cap); -WINGDIAPI void APIENTRY glDisableClientState (GLenum array); -WINGDIAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -WINGDIAPI void APIENTRY glDrawBuffer (GLenum mode); -WINGDIAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -WINGDIAPI void APIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -WINGDIAPI void APIENTRY glEdgeFlag (GLboolean flag); -WINGDIAPI void APIENTRY glEdgeFlagPointer (GLsizei stride, const GLboolean *pointer); -WINGDIAPI void APIENTRY glEdgeFlagv (const GLboolean *flag); -WINGDIAPI void APIENTRY glEnable (GLenum cap); -WINGDIAPI void APIENTRY glEnableClientState (GLenum array); -WINGDIAPI void APIENTRY glEnd (void); -WINGDIAPI void APIENTRY glEndList (void); -WINGDIAPI void APIENTRY glEvalCoord1d (GLdouble u); -WINGDIAPI void APIENTRY glEvalCoord1dv (const GLdouble *u); -WINGDIAPI void APIENTRY glEvalCoord1f (GLfloat u); -WINGDIAPI void APIENTRY glEvalCoord1fv (const GLfloat *u); -WINGDIAPI void APIENTRY glEvalCoord2d (GLdouble u, GLdouble v); -WINGDIAPI void APIENTRY glEvalCoord2dv (const GLdouble *u); -WINGDIAPI void APIENTRY glEvalCoord2f (GLfloat u, GLfloat v); -WINGDIAPI void APIENTRY glEvalCoord2fv (const GLfloat *u); -WINGDIAPI void APIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2); -WINGDIAPI void APIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); -WINGDIAPI void APIENTRY glEvalPoint1 (GLint i); -WINGDIAPI void APIENTRY glEvalPoint2 (GLint i, GLint j); -WINGDIAPI void APIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); -WINGDIAPI void APIENTRY glFinish (void); -WINGDIAPI void APIENTRY glFlush (void); -WINGDIAPI void APIENTRY glFogf (GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glFogfv (GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glFogi (GLenum pname, GLint param); -WINGDIAPI void APIENTRY glFogiv (GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glFrontFace (GLenum mode); -WINGDIAPI void APIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -WINGDIAPI GLuint APIENTRY glGenLists (GLsizei range); -WINGDIAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); -WINGDIAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); -WINGDIAPI void APIENTRY glGetClipPlane (GLenum plane, GLdouble *equation); -WINGDIAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *params); -WINGDIAPI GLenum APIENTRY glGetError (void); -WINGDIAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v); -WINGDIAPI void APIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v); -WINGDIAPI void APIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v); -WINGDIAPI void APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glGetPixelMapfv (GLenum map, GLfloat *values); -WINGDIAPI void APIENTRY glGetPixelMapuiv (GLenum map, GLuint *values); -WINGDIAPI void APIENTRY glGetPixelMapusv (GLenum map, GLushort *values); -WINGDIAPI void APIENTRY glGetPointerv (GLenum pname, GLvoid* *params); -WINGDIAPI void APIENTRY glGetPolygonStipple (GLubyte *mask); -WINGDIAPI const GLubyte * APIENTRY glGetString (GLenum name); -WINGDIAPI void APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); -WINGDIAPI void APIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -WINGDIAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -WINGDIAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -WINGDIAPI void APIENTRY glHint (GLenum target, GLenum mode); -WINGDIAPI void APIENTRY glIndexMask (GLuint mask); -WINGDIAPI void APIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer); -WINGDIAPI void APIENTRY glIndexd (GLdouble c); -WINGDIAPI void APIENTRY glIndexdv (const GLdouble *c); -WINGDIAPI void APIENTRY glIndexf (GLfloat c); -WINGDIAPI void APIENTRY glIndexfv (const GLfloat *c); -WINGDIAPI void APIENTRY glIndexi (GLint c); -WINGDIAPI void APIENTRY glIndexiv (const GLint *c); -WINGDIAPI void APIENTRY glIndexs (GLshort c); -WINGDIAPI void APIENTRY glIndexsv (const GLshort *c); -WINGDIAPI void APIENTRY glIndexub (GLubyte c); -WINGDIAPI void APIENTRY glIndexubv (const GLubyte *c); -WINGDIAPI void APIENTRY glInitNames (void); -WINGDIAPI void APIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer); -WINGDIAPI GLboolean APIENTRY glIsEnabled (GLenum cap); -WINGDIAPI GLboolean APIENTRY glIsList (GLuint list); -WINGDIAPI GLboolean APIENTRY glIsTexture (GLuint texture); -WINGDIAPI void APIENTRY glLightModelf (GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glLightModeli (GLenum pname, GLint param); -WINGDIAPI void APIENTRY glLightModeliv (GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glLighti (GLenum light, GLenum pname, GLint param); -WINGDIAPI void APIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glLineStipple (GLint factor, GLushort pattern); -WINGDIAPI void APIENTRY glLineWidth (GLfloat width); -WINGDIAPI void APIENTRY glListBase (GLuint base); -WINGDIAPI void APIENTRY glLoadIdentity (void); -WINGDIAPI void APIENTRY glLoadMatrixd (const GLdouble *m); -WINGDIAPI void APIENTRY glLoadMatrixf (const GLfloat *m); -WINGDIAPI void APIENTRY glLoadName (GLuint name); -WINGDIAPI void APIENTRY glLogicOp (GLenum opcode); -WINGDIAPI void APIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -WINGDIAPI void APIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -WINGDIAPI void APIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -WINGDIAPI void APIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -WINGDIAPI void APIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); -WINGDIAPI void APIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); -WINGDIAPI void APIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); -WINGDIAPI void APIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); -WINGDIAPI void APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glMateriali (GLenum face, GLenum pname, GLint param); -WINGDIAPI void APIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glMatrixMode (GLenum mode); -WINGDIAPI void APIENTRY glMultMatrixd (const GLdouble *m); -WINGDIAPI void APIENTRY glMultMatrixf (const GLfloat *m); -WINGDIAPI void APIENTRY glNewList (GLuint list, GLenum mode); -WINGDIAPI void APIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); -WINGDIAPI void APIENTRY glNormal3bv (const GLbyte *v); -WINGDIAPI void APIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); -WINGDIAPI void APIENTRY glNormal3dv (const GLdouble *v); -WINGDIAPI void APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); -WINGDIAPI void APIENTRY glNormal3fv (const GLfloat *v); -WINGDIAPI void APIENTRY glNormal3i (GLint nx, GLint ny, GLint nz); -WINGDIAPI void APIENTRY glNormal3iv (const GLint *v); -WINGDIAPI void APIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz); -WINGDIAPI void APIENTRY glNormal3sv (const GLshort *v); -WINGDIAPI void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); -WINGDIAPI void APIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -WINGDIAPI void APIENTRY glPassThrough (GLfloat token); -WINGDIAPI void APIENTRY glPixelMapfv (GLenum map, GLint mapsize, const GLfloat *values); -WINGDIAPI void APIENTRY glPixelMapuiv (GLenum map, GLint mapsize, const GLuint *values); -WINGDIAPI void APIENTRY glPixelMapusv (GLenum map, GLint mapsize, const GLushort *values); -WINGDIAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); -WINGDIAPI void APIENTRY glPixelTransferf (GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glPixelTransferi (GLenum pname, GLint param); -WINGDIAPI void APIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor); -WINGDIAPI void APIENTRY glPointSize (GLfloat size); -WINGDIAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); -WINGDIAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -WINGDIAPI void APIENTRY glPolygonStipple (const GLubyte *mask); -WINGDIAPI void APIENTRY glPopAttrib (void); -WINGDIAPI void APIENTRY glPopClientAttrib (void); -WINGDIAPI void APIENTRY glPopMatrix (void); -WINGDIAPI void APIENTRY glPopName (void); -WINGDIAPI void APIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities); -WINGDIAPI void APIENTRY glPushAttrib (GLbitfield mask); -WINGDIAPI void APIENTRY glPushClientAttrib (GLbitfield mask); -WINGDIAPI void APIENTRY glPushMatrix (void); -WINGDIAPI void APIENTRY glPushName (GLuint name); -WINGDIAPI void APIENTRY glRasterPos2d (GLdouble x, GLdouble y); -WINGDIAPI void APIENTRY glRasterPos2dv (const GLdouble *v); -WINGDIAPI void APIENTRY glRasterPos2f (GLfloat x, GLfloat y); -WINGDIAPI void APIENTRY glRasterPos2fv (const GLfloat *v); -WINGDIAPI void APIENTRY glRasterPos2i (GLint x, GLint y); -WINGDIAPI void APIENTRY glRasterPos2iv (const GLint *v); -WINGDIAPI void APIENTRY glRasterPos2s (GLshort x, GLshort y); -WINGDIAPI void APIENTRY glRasterPos2sv (const GLshort *v); -WINGDIAPI void APIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); -WINGDIAPI void APIENTRY glRasterPos3dv (const GLdouble *v); -WINGDIAPI void APIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); -WINGDIAPI void APIENTRY glRasterPos3fv (const GLfloat *v); -WINGDIAPI void APIENTRY glRasterPos3i (GLint x, GLint y, GLint z); -WINGDIAPI void APIENTRY glRasterPos3iv (const GLint *v); -WINGDIAPI void APIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z); -WINGDIAPI void APIENTRY glRasterPos3sv (const GLshort *v); -WINGDIAPI void APIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -WINGDIAPI void APIENTRY glRasterPos4dv (const GLdouble *v); -WINGDIAPI void APIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -WINGDIAPI void APIENTRY glRasterPos4fv (const GLfloat *v); -WINGDIAPI void APIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w); -WINGDIAPI void APIENTRY glRasterPos4iv (const GLint *v); -WINGDIAPI void APIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); -WINGDIAPI void APIENTRY glRasterPos4sv (const GLshort *v); -WINGDIAPI void APIENTRY glReadBuffer (GLenum mode); -WINGDIAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -WINGDIAPI void APIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); -WINGDIAPI void APIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2); -WINGDIAPI void APIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); -WINGDIAPI void APIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2); -WINGDIAPI void APIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2); -WINGDIAPI void APIENTRY glRectiv (const GLint *v1, const GLint *v2); -WINGDIAPI void APIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); -WINGDIAPI void APIENTRY glRectsv (const GLshort *v1, const GLshort *v2); -WINGDIAPI GLint APIENTRY glRenderMode (GLenum mode); -WINGDIAPI void APIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -WINGDIAPI void APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -WINGDIAPI void APIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z); -WINGDIAPI void APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); -WINGDIAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -WINGDIAPI void APIENTRY glSelectBuffer (GLsizei size, GLuint *buffer); -WINGDIAPI void APIENTRY glShadeModel (GLenum mode); -WINGDIAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -WINGDIAPI void APIENTRY glStencilMask (GLuint mask); -WINGDIAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -WINGDIAPI void APIENTRY glTexCoord1d (GLdouble s); -WINGDIAPI void APIENTRY glTexCoord1dv (const GLdouble *v); -WINGDIAPI void APIENTRY glTexCoord1f (GLfloat s); -WINGDIAPI void APIENTRY glTexCoord1fv (const GLfloat *v); -WINGDIAPI void APIENTRY glTexCoord1i (GLint s); -WINGDIAPI void APIENTRY glTexCoord1iv (const GLint *v); -WINGDIAPI void APIENTRY glTexCoord1s (GLshort s); -WINGDIAPI void APIENTRY glTexCoord1sv (const GLshort *v); -WINGDIAPI void APIENTRY glTexCoord2d (GLdouble s, GLdouble t); -WINGDIAPI void APIENTRY glTexCoord2dv (const GLdouble *v); -WINGDIAPI void APIENTRY glTexCoord2f (GLfloat s, GLfloat t); -WINGDIAPI void APIENTRY glTexCoord2fv (const GLfloat *v); -WINGDIAPI void APIENTRY glTexCoord2i (GLint s, GLint t); -WINGDIAPI void APIENTRY glTexCoord2iv (const GLint *v); -WINGDIAPI void APIENTRY glTexCoord2s (GLshort s, GLshort t); -WINGDIAPI void APIENTRY glTexCoord2sv (const GLshort *v); -WINGDIAPI void APIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); -WINGDIAPI void APIENTRY glTexCoord3dv (const GLdouble *v); -WINGDIAPI void APIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); -WINGDIAPI void APIENTRY glTexCoord3fv (const GLfloat *v); -WINGDIAPI void APIENTRY glTexCoord3i (GLint s, GLint t, GLint r); -WINGDIAPI void APIENTRY glTexCoord3iv (const GLint *v); -WINGDIAPI void APIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r); -WINGDIAPI void APIENTRY glTexCoord3sv (const GLshort *v); -WINGDIAPI void APIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); -WINGDIAPI void APIENTRY glTexCoord4dv (const GLdouble *v); -WINGDIAPI void APIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); -WINGDIAPI void APIENTRY glTexCoord4fv (const GLfloat *v); -WINGDIAPI void APIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q); -WINGDIAPI void APIENTRY glTexCoord4iv (const GLint *v); -WINGDIAPI void APIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); -WINGDIAPI void APIENTRY glTexCoord4sv (const GLshort *v); -WINGDIAPI void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -WINGDIAPI void APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); -WINGDIAPI void APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param); -WINGDIAPI void APIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params); -WINGDIAPI void APIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param); -WINGDIAPI void APIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -WINGDIAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -WINGDIAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -WINGDIAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -WINGDIAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -WINGDIAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -WINGDIAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -WINGDIAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -WINGDIAPI void APIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z); -WINGDIAPI void APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); -WINGDIAPI void APIENTRY glVertex2d (GLdouble x, GLdouble y); -WINGDIAPI void APIENTRY glVertex2dv (const GLdouble *v); -WINGDIAPI void APIENTRY glVertex2f (GLfloat x, GLfloat y); -WINGDIAPI void APIENTRY glVertex2fv (const GLfloat *v); -WINGDIAPI void APIENTRY glVertex2i (GLint x, GLint y); -WINGDIAPI void APIENTRY glVertex2iv (const GLint *v); -WINGDIAPI void APIENTRY glVertex2s (GLshort x, GLshort y); -WINGDIAPI void APIENTRY glVertex2sv (const GLshort *v); -WINGDIAPI void APIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z); -WINGDIAPI void APIENTRY glVertex3dv (const GLdouble *v); -WINGDIAPI void APIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z); -WINGDIAPI void APIENTRY glVertex3fv (const GLfloat *v); -WINGDIAPI void APIENTRY glVertex3i (GLint x, GLint y, GLint z); -WINGDIAPI void APIENTRY glVertex3iv (const GLint *v); -WINGDIAPI void APIENTRY glVertex3s (GLshort x, GLshort y, GLshort z); -WINGDIAPI void APIENTRY glVertex3sv (const GLshort *v); -WINGDIAPI void APIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -WINGDIAPI void APIENTRY glVertex4dv (const GLdouble *v); -WINGDIAPI void APIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -WINGDIAPI void APIENTRY glVertex4fv (const GLfloat *v); -WINGDIAPI void APIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w); -WINGDIAPI void APIENTRY glVertex4iv (const GLint *v); -WINGDIAPI void APIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); -WINGDIAPI void APIENTRY glVertex4sv (const GLshort *v); -WINGDIAPI void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -WINGDIAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -#ifdef __cplusplus -} -#endif - -#endif /* __gl_h_ */ +#ifndef __gl_h_ +#define __gl_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** The contents of this file are subject to the GLX Public License Version 1.0 +** (the "License"). You may not use this file except in compliance with the +** License. You may obtain a copy of the License at Silicon Graphics, Inc., +** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +** or at http://www.sgi.com/software/opensource/glx/license.html. +** +** Software distributed under the License is distributed on an "AS IS" +** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY +** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR +** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific +** language governing rights and limitations under the License. +** +** The Original Software is GLX version 1.2 source code, released February, +** 1999. The developer of the Original Software is Silicon Graphics, Inc. +** Those portions of the Subject Software created by Silicon Graphics, Inc. +** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +*/ + +#ifndef _WIN32 +#define WINGDIAPI +#define APIENTRY +#endif + +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef float GLclampf; +typedef double GLdouble; +typedef double GLclampd; +typedef void GLvoid; + +/*************************************************************/ + +/* Version */ +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 + +/* Extensions */ +#define GL_ARB_imaging 1 +#define GL_ARB_multitexture 1 + +/* AccumOp */ +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 + +/* AlphaFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* AttribMask */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000fffff + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* BlendEquationMode */ +/* GL_LOGIC_OP */ +/* GL_FUNC_ADD */ +/* GL_MIN */ +/* GL_MAX */ +/* GL_FUNC_SUBTRACT */ +/* GL_FUNC_REVERSE_SUBTRACT */ + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +/* GL_CONSTANT_COLOR */ +/* GL_ONE_MINUS_CONSTANT_COLOR */ +/* GL_CONSTANT_ALPHA */ +/* GL_ONE_MINUS_CONSTANT_ALPHA */ + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ +/* GL_CONSTANT_COLOR */ +/* GL_ONE_MINUS_CONSTANT_COLOR */ +/* GL_CONSTANT_ALPHA */ +/* GL_ONE_MINUS_CONSTANT_ALPHA */ + +/* Boolean */ +#define GL_TRUE 1 +#define GL_FALSE 0 + +/* ClearBufferMask */ +/* GL_COLOR_BUFFER_BIT */ +/* GL_ACCUM_BUFFER_BIT */ +/* GL_STENCIL_BUFFER_BIT */ +/* GL_DEPTH_BUFFER_BIT */ + +/* ClientArrayType */ +/* GL_VERTEX_ARRAY */ +/* GL_NORMAL_ARRAY */ +/* GL_COLOR_ARRAY */ +/* GL_INDEX_ARRAY */ +/* GL_TEXTURE_COORD_ARRAY */ +/* GL_EDGE_FLAG_ARRAY */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ +/* GL_EMISSION */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_BYTE */ +/* GL_UNSIGNED_BYTE */ +/* GL_SHORT */ +/* GL_UNSIGNED_SHORT */ +/* GL_INT */ +/* GL_UNSIGNED_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* ColorTableParameterPName */ +/* GL_COLOR_TABLE_SCALE */ +/* GL_COLOR_TABLE_BIAS */ + +/* ColorTableTarget */ +/* GL_COLOR_TABLE */ +/* GL_POST_CONVOLUTION_COLOR_TABLE */ +/* GL_POST_COLOR_MATRIX_COLOR_TABLE */ +/* GL_PROXY_COLOR_TABLE */ +/* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ +/* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + +/* ConvolutionBorderMode */ +/* GL_REDUCE */ +/* GL_IGNORE_BORDER */ +/* GL_CONSTANT_BORDER */ + +/* ConvolutionParameter */ +/* GL_CONVOLUTION_BORDER_MODE */ +/* GL_CONVOLUTION_FILTER_SCALE */ +/* GL_CONVOLUTION_FILTER_BIAS */ + +/* ConvolutionTarget */ +/* GL_CONVOLUTION_1D */ +/* GL_CONVOLUTION_2D */ + +/* CullFaceMode */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_FRONT_AND_BACK */ + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* DrawBufferMode */ +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C + +/* Enable */ +/* GL_FOG */ +/* GL_LIGHTING */ +/* GL_TEXTURE_1D */ +/* GL_TEXTURE_2D */ +/* GL_LINE_STIPPLE */ +/* GL_POLYGON_STIPPLE */ +/* GL_CULL_FACE */ +/* GL_ALPHA_TEST */ +/* GL_BLEND */ +/* GL_INDEX_LOGIC_OP */ +/* GL_COLOR_LOGIC_OP */ +/* GL_DITHER */ +/* GL_STENCIL_TEST */ +/* GL_DEPTH_TEST */ +/* GL_CLIP_PLANE0 */ +/* GL_CLIP_PLANE1 */ +/* GL_CLIP_PLANE2 */ +/* GL_CLIP_PLANE3 */ +/* GL_CLIP_PLANE4 */ +/* GL_CLIP_PLANE5 */ +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +/* GL_TEXTURE_GEN_S */ +/* GL_TEXTURE_GEN_T */ +/* GL_TEXTURE_GEN_R */ +/* GL_TEXTURE_GEN_Q */ +/* GL_MAP1_VERTEX_3 */ +/* GL_MAP1_VERTEX_4 */ +/* GL_MAP1_COLOR_4 */ +/* GL_MAP1_INDEX */ +/* GL_MAP1_NORMAL */ +/* GL_MAP1_TEXTURE_COORD_1 */ +/* GL_MAP1_TEXTURE_COORD_2 */ +/* GL_MAP1_TEXTURE_COORD_3 */ +/* GL_MAP1_TEXTURE_COORD_4 */ +/* GL_MAP2_VERTEX_3 */ +/* GL_MAP2_VERTEX_4 */ +/* GL_MAP2_COLOR_4 */ +/* GL_MAP2_INDEX */ +/* GL_MAP2_NORMAL */ +/* GL_MAP2_TEXTURE_COORD_1 */ +/* GL_MAP2_TEXTURE_COORD_2 */ +/* GL_MAP2_TEXTURE_COORD_3 */ +/* GL_MAP2_TEXTURE_COORD_4 */ +/* GL_POINT_SMOOTH */ +/* GL_LINE_SMOOTH */ +/* GL_POLYGON_SMOOTH */ +/* GL_SCISSOR_TEST */ +/* GL_COLOR_MATERIAL */ +/* GL_NORMALIZE */ +/* GL_AUTO_NORMAL */ +/* GL_VERTEX_ARRAY */ +/* GL_NORMAL_ARRAY */ +/* GL_COLOR_ARRAY */ +/* GL_INDEX_ARRAY */ +/* GL_TEXTURE_COORD_ARRAY */ +/* GL_EDGE_FLAG_ARRAY */ +/* GL_POLYGON_OFFSET_POINT */ +/* GL_POLYGON_OFFSET_LINE */ +/* GL_POLYGON_OFFSET_FILL */ +/* GL_COLOR_TABLE */ +/* GL_POST_CONVOLUTION_COLOR_TABLE */ +/* GL_POST_COLOR_MATRIX_COLOR_TABLE */ +/* GL_CONVOLUTION_1D */ +/* GL_CONVOLUTION_2D */ +/* GL_SEPARABLE_2D */ +/* GL_HISTOGRAM */ +/* GL_MINMAX */ +/* GL_RESCALE_NORMAL */ +/* GL_TEXTURE_3D */ + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 +/* GL_TABLE_TOO_LARGE */ + +/* FeedBackMode */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 + +/* FeedBackToken */ +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_LINE_RESET_TOKEN 0x0707 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* FogParameter */ +/* GL_FOG_COLOR */ +/* GL_FOG_DENSITY */ +/* GL_FOG_END */ +/* GL_FOG_INDEX */ +/* GL_FOG_MODE */ +/* GL_FOG_START */ + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetColorTableParameterPName */ +/* GL_COLOR_TABLE_SCALE */ +/* GL_COLOR_TABLE_BIAS */ +/* GL_COLOR_TABLE_FORMAT */ +/* GL_COLOR_TABLE_WIDTH */ +/* GL_COLOR_TABLE_RED_SIZE */ +/* GL_COLOR_TABLE_GREEN_SIZE */ +/* GL_COLOR_TABLE_BLUE_SIZE */ +/* GL_COLOR_TABLE_ALPHA_SIZE */ +/* GL_COLOR_TABLE_LUMINANCE_SIZE */ +/* GL_COLOR_TABLE_INTENSITY_SIZE */ + +/* GetConvolutionParameterPName */ +/* GL_CONVOLUTION_BORDER_COLOR */ +/* GL_CONVOLUTION_BORDER_MODE */ +/* GL_CONVOLUTION_FILTER_SCALE */ +/* GL_CONVOLUTION_FILTER_BIAS */ +/* GL_CONVOLUTION_FORMAT */ +/* GL_CONVOLUTION_WIDTH */ +/* GL_CONVOLUTION_HEIGHT */ +/* GL_MAX_CONVOLUTION_WIDTH */ +/* GL_MAX_CONVOLUTION_HEIGHT */ + +/* GetHistogramParameterPName */ +/* GL_HISTOGRAM_WIDTH */ +/* GL_HISTOGRAM_FORMAT */ +/* GL_HISTOGRAM_RED_SIZE */ +/* GL_HISTOGRAM_GREEN_SIZE */ +/* GL_HISTOGRAM_BLUE_SIZE */ +/* GL_HISTOGRAM_ALPHA_SIZE */ +/* GL_HISTOGRAM_LUMINANCE_SIZE */ +/* GL_HISTOGRAM_SINK */ + +/* GetMapTarget */ +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 + +/* GetMinmaxParameterPName */ +/* GL_MINMAX_FORMAT */ +/* GL_MINMAX_SINK */ + +/* GetPixelMap */ +/* GL_PIXEL_MAP_I_TO_I */ +/* GL_PIXEL_MAP_S_TO_S */ +/* GL_PIXEL_MAP_I_TO_R */ +/* GL_PIXEL_MAP_I_TO_G */ +/* GL_PIXEL_MAP_I_TO_B */ +/* GL_PIXEL_MAP_I_TO_A */ +/* GL_PIXEL_MAP_R_TO_R */ +/* GL_PIXEL_MAP_G_TO_G */ +/* GL_PIXEL_MAP_B_TO_B */ +/* GL_PIXEL_MAP_A_TO_A */ + +/* GetPointerTarget */ +/* GL_VERTEX_ARRAY_POINTER */ +/* GL_NORMAL_ARRAY_POINTER */ +/* GL_COLOR_ARRAY_POINTER */ +/* GL_INDEX_ARRAY_POINTER */ +/* GL_TEXTURE_COORD_ARRAY_POINTER */ +/* GL_EDGE_FLAG_ARRAY_POINTER */ + +/* GetTarget */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +/* GL_SMOOTH_POINT_SIZE_RANGE */ +/* GL_SMOOTH_POINT_SIZE_GRANULARITY */ +/* GL_SMOOTH_LINE_WIDTH_RANGE */ +/* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ +/* GL_ALIASED_POINT_SIZE_RANGE */ +/* GL_ALIASED_LINE_WIDTH_RANGE */ +#define GL_LIST_MODE 0x0B30 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG 0x0B60 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_INDEX_BITS 0x0D51 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +/* GL_TEXTURE_BINDING_1D */ +/* GL_TEXTURE_BINDING_2D */ +/* GL_TEXTURE_BINDING_3D */ +/* GL_VERTEX_ARRAY */ +/* GL_NORMAL_ARRAY */ +/* GL_COLOR_ARRAY */ +/* GL_INDEX_ARRAY */ +/* GL_TEXTURE_COORD_ARRAY */ +/* GL_EDGE_FLAG_ARRAY */ +/* GL_VERTEX_ARRAY_SIZE */ +/* GL_VERTEX_ARRAY_TYPE */ +/* GL_VERTEX_ARRAY_STRIDE */ +/* GL_NORMAL_ARRAY_TYPE */ +/* GL_NORMAL_ARRAY_STRIDE */ +/* GL_COLOR_ARRAY_SIZE */ +/* GL_COLOR_ARRAY_TYPE */ +/* GL_COLOR_ARRAY_STRIDE */ +/* GL_INDEX_ARRAY_TYPE */ +/* GL_INDEX_ARRAY_STRIDE */ +/* GL_TEXTURE_COORD_ARRAY_SIZE */ +/* GL_TEXTURE_COORD_ARRAY_TYPE */ +/* GL_TEXTURE_COORD_ARRAY_STRIDE */ +/* GL_EDGE_FLAG_ARRAY_STRIDE */ +/* GL_POLYGON_OFFSET_FACTOR */ +/* GL_POLYGON_OFFSET_UNITS */ +/* GL_COLOR_TABLE */ +/* GL_POST_CONVOLUTION_COLOR_TABLE */ +/* GL_POST_COLOR_MATRIX_COLOR_TABLE */ +/* GL_CONVOLUTION_1D */ +/* GL_CONVOLUTION_2D */ +/* GL_SEPARABLE_2D */ +/* GL_POST_CONVOLUTION_RED_SCALE */ +/* GL_POST_CONVOLUTION_GREEN_SCALE */ +/* GL_POST_CONVOLUTION_BLUE_SCALE */ +/* GL_POST_CONVOLUTION_ALPHA_SCALE */ +/* GL_POST_CONVOLUTION_RED_BIAS */ +/* GL_POST_CONVOLUTION_GREEN_BIAS */ +/* GL_POST_CONVOLUTION_BLUE_BIAS */ +/* GL_POST_CONVOLUTION_ALPHA_BIAS */ +/* GL_COLOR_MATRIX */ +/* GL_COLOR_MATRIX_STACK_DEPTH */ +/* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ +/* GL_POST_COLOR_MATRIX_RED_SCALE */ +/* GL_POST_COLOR_MATRIX_GREEN_SCALE */ +/* GL_POST_COLOR_MATRIX_BLUE_SCALE */ +/* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ +/* GL_POST_COLOR_MATRIX_RED_BIAS */ +/* GL_POST_COLOR_MATRIX_GREEN_BIAS */ +/* GL_POST_COLOR_MATRIX_BLUE_BIAS */ +/* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ +/* GL_HISTOGRAM */ +/* GL_MINMAX */ +/* GL_MAX_ELEMENTS_VERTICES */ +/* GL_MAX_ELEMENTS_INDICES */ +/* GL_RESCALE_NORMAL */ +/* GL_LIGHT_MODEL_COLOR_CONTROL */ +/* GL_PACK_SKIP_IMAGES */ +/* GL_PACK_IMAGE_HEIGHT */ +/* GL_UNPACK_SKIP_IMAGES */ +/* GL_UNPACK_IMAGE_HEIGHT */ +/* GL_TEXTURE_3D */ +/* GL_MAX_3D_TEXTURE_SIZE */ +/* GL_BLEND_COLOR */ +/* GL_BLEND_EQUATION */ +/* GL_ACTIVE_TEXTURE_ARB */ +/* GL_CLIENT_ACTIVE_TEXTURE_ARB */ +/* GL_MAX_TEXTURE_UNITS_ARB */ + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_BORDER 0x1005 +/* GL_TEXTURE_RED_SIZE */ +/* GL_TEXTURE_GREEN_SIZE */ +/* GL_TEXTURE_BLUE_SIZE */ +/* GL_TEXTURE_ALPHA_SIZE */ +/* GL_TEXTURE_LUMINANCE_SIZE */ +/* GL_TEXTURE_INTENSITY_SIZE */ +/* GL_TEXTURE_PRIORITY */ +/* GL_TEXTURE_RESIDENT */ +/* GL_TEXTURE_DEPTH */ +/* GL_TEXTURE_WRAP_R */ +/* GL_TEXTURE_MIN_LOD */ +/* GL_TEXTURE_MAX_LOD */ +/* GL_TEXTURE_BASE_LEVEL */ +/* GL_TEXTURE_MAX_LEVEL */ + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +/* GL_PERSPECTIVE_CORRECTION_HINT */ +/* GL_POINT_SMOOTH_HINT */ +/* GL_LINE_SMOOTH_HINT */ +/* GL_POLYGON_SMOOTH_HINT */ +/* GL_FOG_HINT */ + +/* HistogramTarget */ +/* GL_HISTOGRAM */ +/* GL_PROXY_HISTOGRAM */ + +/* IndexPointerType */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* LightModelColorControl */ +/* GL_SINGLE_COLOR */ +/* GL_SEPARATE_SPECULAR_COLOR */ + +/* LightModelParameter */ +/* GL_LIGHT_MODEL_AMBIENT */ +/* GL_LIGHT_MODEL_LOCAL_VIEWER */ +/* GL_LIGHT_MODEL_TWO_SIDE */ +/* GL_LIGHT_MODEL_COLOR_CONTROL */ + +/* LightName */ +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + +/* LightParameter */ +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 + +/* InterleavedArrays */ +/* GL_V2F */ +/* GL_V3F */ +/* GL_C4UB_V2F */ +/* GL_C4UB_V3F */ +/* GL_C3F_V3F */ +/* GL_N3F_V3F */ +/* GL_C4F_N3F_V3F */ +/* GL_T2F_V3F */ +/* GL_T4F_V4F */ +/* GL_T2F_C4UB_V3F */ +/* GL_T2F_C3F_V3F */ +/* GL_T2F_N3F_V3F */ +/* GL_T2F_C4F_N3F_V3F */ +/* GL_T4F_C4F_N3F_V4F */ + +/* ListMode */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 + +/* ListNameType */ +/* GL_BYTE */ +/* GL_UNSIGNED_BYTE */ +/* GL_SHORT */ +/* GL_UNSIGNED_SHORT */ +/* GL_INT */ +/* GL_UNSIGNED_INT */ +/* GL_FLOAT */ +/* GL_2_BYTES */ +/* GL_3_BYTES */ +/* GL_4_BYTES */ + +/* LogicOp */ +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F + +/* MapTarget */ +/* GL_MAP1_COLOR_4 */ +/* GL_MAP1_INDEX */ +/* GL_MAP1_NORMAL */ +/* GL_MAP1_TEXTURE_COORD_1 */ +/* GL_MAP1_TEXTURE_COORD_2 */ +/* GL_MAP1_TEXTURE_COORD_3 */ +/* GL_MAP1_TEXTURE_COORD_4 */ +/* GL_MAP1_VERTEX_3 */ +/* GL_MAP1_VERTEX_4 */ +/* GL_MAP2_COLOR_4 */ +/* GL_MAP2_INDEX */ +/* GL_MAP2_NORMAL */ +/* GL_MAP2_TEXTURE_COORD_1 */ +/* GL_MAP2_TEXTURE_COORD_2 */ +/* GL_MAP2_TEXTURE_COORD_3 */ +/* GL_MAP2_TEXTURE_COORD_4 */ +/* GL_MAP2_VERTEX_3 */ +/* GL_MAP2_VERTEX_4 */ + +/* MaterialFace */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_FRONT_AND_BACK */ + +/* MaterialParameter */ +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ + +/* MatrixMode */ +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* MeshMode1 */ +/* GL_POINT */ +/* GL_LINE */ + +/* MeshMode2 */ +/* GL_POINT */ +/* GL_LINE */ +/* GL_FILL */ + +/* MinmaxTarget */ +/* GL_MINMAX */ + +/* NormalPointerType */ +/* GL_BYTE */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* PixelCopyType */ +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 + +/* PixelFormat */ +#define GL_COLOR_INDEX 0x1900 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +/* GL_ABGR */ + +/* PixelInternalFormat */ +/* GL_ALPHA4 */ +/* GL_ALPHA8 */ +/* GL_ALPHA12 */ +/* GL_ALPHA16 */ +/* GL_LUMINANCE4 */ +/* GL_LUMINANCE8 */ +/* GL_LUMINANCE12 */ +/* GL_LUMINANCE16 */ +/* GL_LUMINANCE4_ALPHA4 */ +/* GL_LUMINANCE6_ALPHA2 */ +/* GL_LUMINANCE8_ALPHA8 */ +/* GL_LUMINANCE12_ALPHA4 */ +/* GL_LUMINANCE12_ALPHA12 */ +/* GL_LUMINANCE16_ALPHA16 */ +/* GL_INTENSITY */ +/* GL_INTENSITY4 */ +/* GL_INTENSITY8 */ +/* GL_INTENSITY12 */ +/* GL_INTENSITY16 */ +/* GL_R3_G3_B2 */ +/* GL_RGB4 */ +/* GL_RGB5 */ +/* GL_RGB8 */ +/* GL_RGB10 */ +/* GL_RGB12 */ +/* GL_RGB16 */ +/* GL_RGBA2 */ +/* GL_RGBA4 */ +/* GL_RGB5_A1 */ +/* GL_RGBA8 */ +/* GL_RGB10_A2 */ +/* GL_RGBA12 */ +/* GL_RGBA16 */ + +/* PixelMap */ +/* GL_PIXEL_MAP_I_TO_I */ +/* GL_PIXEL_MAP_S_TO_S */ +/* GL_PIXEL_MAP_I_TO_R */ +/* GL_PIXEL_MAP_I_TO_G */ +/* GL_PIXEL_MAP_I_TO_B */ +/* GL_PIXEL_MAP_I_TO_A */ +/* GL_PIXEL_MAP_R_TO_R */ +/* GL_PIXEL_MAP_G_TO_G */ +/* GL_PIXEL_MAP_B_TO_B */ +/* GL_PIXEL_MAP_A_TO_A */ + +/* PixelStore */ +/* GL_UNPACK_SWAP_BYTES */ +/* GL_UNPACK_LSB_FIRST */ +/* GL_UNPACK_ROW_LENGTH */ +/* GL_UNPACK_SKIP_ROWS */ +/* GL_UNPACK_SKIP_PIXELS */ +/* GL_UNPACK_ALIGNMENT */ +/* GL_PACK_SWAP_BYTES */ +/* GL_PACK_LSB_FIRST */ +/* GL_PACK_ROW_LENGTH */ +/* GL_PACK_SKIP_ROWS */ +/* GL_PACK_SKIP_PIXELS */ +/* GL_PACK_ALIGNMENT */ +/* GL_PACK_SKIP_IMAGES */ +/* GL_PACK_IMAGE_HEIGHT */ +/* GL_UNPACK_SKIP_IMAGES */ +/* GL_UNPACK_IMAGE_HEIGHT */ + +/* PixelTransfer */ +/* GL_MAP_COLOR */ +/* GL_MAP_STENCIL */ +/* GL_INDEX_SHIFT */ +/* GL_INDEX_OFFSET */ +/* GL_RED_SCALE */ +/* GL_RED_BIAS */ +/* GL_GREEN_SCALE */ +/* GL_GREEN_BIAS */ +/* GL_BLUE_SCALE */ +/* GL_BLUE_BIAS */ +/* GL_ALPHA_SCALE */ +/* GL_ALPHA_BIAS */ +/* GL_DEPTH_SCALE */ +/* GL_DEPTH_BIAS */ +/* GL_POST_CONVOLUTION_RED_SCALE */ +/* GL_POST_CONVOLUTION_GREEN_SCALE */ +/* GL_POST_CONVOLUTION_BLUE_SCALE */ +/* GL_POST_CONVOLUTION_ALPHA_SCALE */ +/* GL_POST_CONVOLUTION_RED_BIAS */ +/* GL_POST_CONVOLUTION_GREEN_BIAS */ +/* GL_POST_CONVOLUTION_BLUE_BIAS */ +/* GL_POST_CONVOLUTION_ALPHA_BIAS */ +/* GL_POST_COLOR_MATRIX_RED_SCALE */ +/* GL_POST_COLOR_MATRIX_GREEN_SCALE */ +/* GL_POST_COLOR_MATRIX_BLUE_SCALE */ +/* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ +/* GL_POST_COLOR_MATRIX_RED_BIAS */ +/* GL_POST_COLOR_MATRIX_GREEN_BIAS */ +/* GL_POST_COLOR_MATRIX_BLUE_BIAS */ +/* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + +/* PixelType */ +#define GL_BITMAP 0x1A00 +/* GL_BYTE */ +/* GL_UNSIGNED_BYTE */ +/* GL_SHORT */ +/* GL_UNSIGNED_SHORT */ +/* GL_INT */ +/* GL_UNSIGNED_INT */ +/* GL_FLOAT */ +/* GL_BGR */ +/* GL_BGRA */ +/* GL_UNSIGNED_BYTE_3_3_2 */ +/* GL_UNSIGNED_SHORT_4_4_4_4 */ +/* GL_UNSIGNED_SHORT_5_5_5_1 */ +/* GL_UNSIGNED_INT_8_8_8_8 */ +/* GL_UNSIGNED_INT_10_10_10_2 */ +/* GL_UNSIGNED_SHORT_5_6_5 */ +/* GL_UNSIGNED_BYTE_2_3_3_REV */ +/* GL_UNSIGNED_SHORT_5_6_5_REV */ +/* GL_UNSIGNED_SHORT_4_4_4_4_REV */ +/* GL_UNSIGNED_SHORT_1_5_5_5_REV */ +/* GL_UNSIGNED_INT_8_8_8_8_REV */ +/* GL_UNSIGNED_INT_2_10_10_10_REV */ + +/* PolygonMode */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 + +/* ReadBufferMode */ +/* GL_FRONT_LEFT */ +/* GL_FRONT_RIGHT */ +/* GL_BACK_LEFT */ +/* GL_BACK_RIGHT */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_LEFT */ +/* GL_RIGHT */ +/* GL_AUX0 */ +/* GL_AUX1 */ +/* GL_AUX2 */ +/* GL_AUX3 */ + +/* RenderingMode */ +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 + +/* SeparableTarget */ +/* GL_SEPARABLE_2D */ + +/* ShadingModel */ +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 + +/* StencilFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +/* GL_INVERT */ + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureCoordName */ +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 + +/* TexCoordPointerType */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* TextureEnvMode */ +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +/* GL_BLEND */ +/* GL_REPLACE */ + +/* TextureEnvParameter */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 + +/* TextureEnvTarget */ +#define GL_TEXTURE_ENV 0x2300 + +/* TextureGenMode */ +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 + +/* TextureGenParameter */ +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +/* GL_TEXTURE_BORDER_COLOR */ +/* GL_TEXTURE_PRIORITY */ +/* GL_TEXTURE_WRAP_R */ +/* GL_TEXTURE_MIN_LOD */ +/* GL_TEXTURE_MAX_LOD */ +/* GL_TEXTURE_BASE_LEVEL */ +/* GL_TEXTURE_MAX_LEVEL */ + +/* TextureTarget */ +/* GL_TEXTURE_1D */ +/* GL_TEXTURE_2D */ +/* GL_PROXY_TEXTURE_1D */ +/* GL_PROXY_TEXTURE_2D */ +/* GL_TEXTURE_3D */ +/* GL_PROXY_TEXTURE_3D */ + +/* TextureUnit */ +/* GL_TEXTURE0_ARB */ +/* GL_TEXTURE1_ARB */ +/* GL_TEXTURE2_ARB */ +/* GL_TEXTURE3_ARB */ +/* GL_TEXTURE4_ARB */ +/* GL_TEXTURE5_ARB */ +/* GL_TEXTURE6_ARB */ +/* GL_TEXTURE7_ARB */ +/* GL_TEXTURE8_ARB */ +/* GL_TEXTURE9_ARB */ +/* GL_TEXTURE10_ARB */ +/* GL_TEXTURE11_ARB */ +/* GL_TEXTURE12_ARB */ +/* GL_TEXTURE13_ARB */ +/* GL_TEXTURE14_ARB */ +/* GL_TEXTURE15_ARB */ +/* GL_TEXTURE16_ARB */ +/* GL_TEXTURE17_ARB */ +/* GL_TEXTURE18_ARB */ +/* GL_TEXTURE19_ARB */ +/* GL_TEXTURE20_ARB */ +/* GL_TEXTURE21_ARB */ +/* GL_TEXTURE22_ARB */ +/* GL_TEXTURE23_ARB */ +/* GL_TEXTURE24_ARB */ +/* GL_TEXTURE25_ARB */ +/* GL_TEXTURE26_ARB */ +/* GL_TEXTURE27_ARB */ +/* GL_TEXTURE28_ARB */ +/* GL_TEXTURE29_ARB */ +/* GL_TEXTURE30_ARB */ +/* GL_TEXTURE31_ARB */ + +/* TextureWrapMode */ +#define GL_CLAMP 0x2900 +#define GL_REPEAT 0x2901 +/* GL_CLAMP_TO_EDGE */ + +/* VertexPointerType */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* ClientAttribMask */ +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff + +/* polygon_offset */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* texture */ +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 + +/* texture_object */ +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_BINDING_3D 0x806A + +/* vertex_array */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* bgra */ +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 + +/* blend_color */ +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 + +/* blend_minmax */ +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 + +/* blend_subtract */ +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* color_matrix */ +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB + +/* color_table */ +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF + +/* convolution */ +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 + +/* draw_range_elements */ +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 + +/* histogram */ +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 + +/* packed_pixels */ +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 + +/* rescale_normal */ +#define GL_RESCALE_NORMAL 0x803A + +/* separate_specular_color */ +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA + +/* texture3D */ +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 + +/* texture_edge_clamp */ +#define GL_CLAMP_TO_EDGE 0x812F + +/* texture_lod */ +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D + +/* GetTarget1_2 */ +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E + +/* multitexture */ +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +/* Extensions */ +#define GL_EXT_abgr 1 +#define GL_EXT_blend_color 1 +#define GL_EXT_blend_minmax 1 +#define GL_EXT_blend_subtract 1 +#define GL_EXT_texture_env_combine 1 +#define GL_EXT_texture_env_add 1 + +/* EXT_abgr */ +#define GL_ABGR_EXT 0x8000 + +/* EXT_blend_color */ +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 + +/* EXT_blend_minmax */ +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 + +/* EXT_blend_subtract */ +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B + +/* EXT_texture_env_combine */ +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A + +/* For compatibility with OpenGL v1.0 */ +#define GL_LOGIC_OP GL_INDEX_LOGIC_OP +#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT + +/*************************************************************/ + +WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value); +WINGDIAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref); +WINGDIAPI GLboolean APIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); +WINGDIAPI void APIENTRY glArrayElement (GLint i); +WINGDIAPI void APIENTRY glBegin (GLenum mode); +WINGDIAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); +WINGDIAPI void APIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +WINGDIAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +WINGDIAPI void APIENTRY glCallList (GLuint list); +WINGDIAPI void APIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists); +WINGDIAPI void APIENTRY glClear (GLbitfield mask); +WINGDIAPI void APIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +WINGDIAPI void APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +WINGDIAPI void APIENTRY glClearDepth (GLclampd depth); +WINGDIAPI void APIENTRY glClearIndex (GLfloat c); +WINGDIAPI void APIENTRY glClearStencil (GLint s); +WINGDIAPI void APIENTRY glClipPlane (GLenum plane, const GLdouble *equation); +WINGDIAPI void APIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue); +WINGDIAPI void APIENTRY glColor3bv (const GLbyte *v); +WINGDIAPI void APIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue); +WINGDIAPI void APIENTRY glColor3dv (const GLdouble *v); +WINGDIAPI void APIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue); +WINGDIAPI void APIENTRY glColor3fv (const GLfloat *v); +WINGDIAPI void APIENTRY glColor3i (GLint red, GLint green, GLint blue); +WINGDIAPI void APIENTRY glColor3iv (const GLint *v); +WINGDIAPI void APIENTRY glColor3s (GLshort red, GLshort green, GLshort blue); +WINGDIAPI void APIENTRY glColor3sv (const GLshort *v); +WINGDIAPI void APIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue); +WINGDIAPI void APIENTRY glColor3ubv (const GLubyte *v); +WINGDIAPI void APIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue); +WINGDIAPI void APIENTRY glColor3uiv (const GLuint *v); +WINGDIAPI void APIENTRY glColor3us (GLushort red, GLushort green, GLushort blue); +WINGDIAPI void APIENTRY glColor3usv (const GLushort *v); +WINGDIAPI void APIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +WINGDIAPI void APIENTRY glColor4bv (const GLbyte *v); +WINGDIAPI void APIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +WINGDIAPI void APIENTRY glColor4dv (const GLdouble *v); +WINGDIAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +WINGDIAPI void APIENTRY glColor4fv (const GLfloat *v); +WINGDIAPI void APIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha); +WINGDIAPI void APIENTRY glColor4iv (const GLint *v); +WINGDIAPI void APIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); +WINGDIAPI void APIENTRY glColor4sv (const GLshort *v); +WINGDIAPI void APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +WINGDIAPI void APIENTRY glColor4ubv (const GLubyte *v); +WINGDIAPI void APIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); +WINGDIAPI void APIENTRY glColor4uiv (const GLuint *v); +WINGDIAPI void APIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); +WINGDIAPI void APIENTRY glColor4usv (const GLushort *v); +WINGDIAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +WINGDIAPI void APIENTRY glColorMaterial (GLenum face, GLenum mode); +WINGDIAPI void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +WINGDIAPI void APIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +WINGDIAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +WINGDIAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +WINGDIAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +WINGDIAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +WINGDIAPI void APIENTRY glCullFace (GLenum mode); +WINGDIAPI void APIENTRY glDeleteLists (GLuint list, GLsizei range); +WINGDIAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +WINGDIAPI void APIENTRY glDepthFunc (GLenum func); +WINGDIAPI void APIENTRY glDepthMask (GLboolean flag); +WINGDIAPI void APIENTRY glDepthRange (GLclampd zNear, GLclampd zFar); +WINGDIAPI void APIENTRY glDisable (GLenum cap); +WINGDIAPI void APIENTRY glDisableClientState (GLenum array); +WINGDIAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +WINGDIAPI void APIENTRY glDrawBuffer (GLenum mode); +WINGDIAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +WINGDIAPI void APIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +WINGDIAPI void APIENTRY glEdgeFlag (GLboolean flag); +WINGDIAPI void APIENTRY glEdgeFlagPointer (GLsizei stride, const GLboolean *pointer); +WINGDIAPI void APIENTRY glEdgeFlagv (const GLboolean *flag); +WINGDIAPI void APIENTRY glEnable (GLenum cap); +WINGDIAPI void APIENTRY glEnableClientState (GLenum array); +WINGDIAPI void APIENTRY glEnd (void); +WINGDIAPI void APIENTRY glEndList (void); +WINGDIAPI void APIENTRY glEvalCoord1d (GLdouble u); +WINGDIAPI void APIENTRY glEvalCoord1dv (const GLdouble *u); +WINGDIAPI void APIENTRY glEvalCoord1f (GLfloat u); +WINGDIAPI void APIENTRY glEvalCoord1fv (const GLfloat *u); +WINGDIAPI void APIENTRY glEvalCoord2d (GLdouble u, GLdouble v); +WINGDIAPI void APIENTRY glEvalCoord2dv (const GLdouble *u); +WINGDIAPI void APIENTRY glEvalCoord2f (GLfloat u, GLfloat v); +WINGDIAPI void APIENTRY glEvalCoord2fv (const GLfloat *u); +WINGDIAPI void APIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2); +WINGDIAPI void APIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +WINGDIAPI void APIENTRY glEvalPoint1 (GLint i); +WINGDIAPI void APIENTRY glEvalPoint2 (GLint i, GLint j); +WINGDIAPI void APIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); +WINGDIAPI void APIENTRY glFinish (void); +WINGDIAPI void APIENTRY glFlush (void); +WINGDIAPI void APIENTRY glFogf (GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glFogfv (GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glFogi (GLenum pname, GLint param); +WINGDIAPI void APIENTRY glFogiv (GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glFrontFace (GLenum mode); +WINGDIAPI void APIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +WINGDIAPI GLuint APIENTRY glGenLists (GLsizei range); +WINGDIAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); +WINGDIAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +WINGDIAPI void APIENTRY glGetClipPlane (GLenum plane, GLdouble *equation); +WINGDIAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *params); +WINGDIAPI GLenum APIENTRY glGetError (void); +WINGDIAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v); +WINGDIAPI void APIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v); +WINGDIAPI void APIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v); +WINGDIAPI void APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glGetPixelMapfv (GLenum map, GLfloat *values); +WINGDIAPI void APIENTRY glGetPixelMapuiv (GLenum map, GLuint *values); +WINGDIAPI void APIENTRY glGetPixelMapusv (GLenum map, GLushort *values); +WINGDIAPI void APIENTRY glGetPointerv (GLenum pname, GLvoid* *params); +WINGDIAPI void APIENTRY glGetPolygonStipple (GLubyte *mask); +WINGDIAPI const GLubyte * APIENTRY glGetString (GLenum name); +WINGDIAPI void APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); +WINGDIAPI void APIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +WINGDIAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +WINGDIAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +WINGDIAPI void APIENTRY glHint (GLenum target, GLenum mode); +WINGDIAPI void APIENTRY glIndexMask (GLuint mask); +WINGDIAPI void APIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +WINGDIAPI void APIENTRY glIndexd (GLdouble c); +WINGDIAPI void APIENTRY glIndexdv (const GLdouble *c); +WINGDIAPI void APIENTRY glIndexf (GLfloat c); +WINGDIAPI void APIENTRY glIndexfv (const GLfloat *c); +WINGDIAPI void APIENTRY glIndexi (GLint c); +WINGDIAPI void APIENTRY glIndexiv (const GLint *c); +WINGDIAPI void APIENTRY glIndexs (GLshort c); +WINGDIAPI void APIENTRY glIndexsv (const GLshort *c); +WINGDIAPI void APIENTRY glIndexub (GLubyte c); +WINGDIAPI void APIENTRY glIndexubv (const GLubyte *c); +WINGDIAPI void APIENTRY glInitNames (void); +WINGDIAPI void APIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer); +WINGDIAPI GLboolean APIENTRY glIsEnabled (GLenum cap); +WINGDIAPI GLboolean APIENTRY glIsList (GLuint list); +WINGDIAPI GLboolean APIENTRY glIsTexture (GLuint texture); +WINGDIAPI void APIENTRY glLightModelf (GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glLightModeli (GLenum pname, GLint param); +WINGDIAPI void APIENTRY glLightModeliv (GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glLighti (GLenum light, GLenum pname, GLint param); +WINGDIAPI void APIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glLineStipple (GLint factor, GLushort pattern); +WINGDIAPI void APIENTRY glLineWidth (GLfloat width); +WINGDIAPI void APIENTRY glListBase (GLuint base); +WINGDIAPI void APIENTRY glLoadIdentity (void); +WINGDIAPI void APIENTRY glLoadMatrixd (const GLdouble *m); +WINGDIAPI void APIENTRY glLoadMatrixf (const GLfloat *m); +WINGDIAPI void APIENTRY glLoadName (GLuint name); +WINGDIAPI void APIENTRY glLogicOp (GLenum opcode); +WINGDIAPI void APIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +WINGDIAPI void APIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +WINGDIAPI void APIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +WINGDIAPI void APIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +WINGDIAPI void APIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); +WINGDIAPI void APIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); +WINGDIAPI void APIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +WINGDIAPI void APIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +WINGDIAPI void APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glMateriali (GLenum face, GLenum pname, GLint param); +WINGDIAPI void APIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glMatrixMode (GLenum mode); +WINGDIAPI void APIENTRY glMultMatrixd (const GLdouble *m); +WINGDIAPI void APIENTRY glMultMatrixf (const GLfloat *m); +WINGDIAPI void APIENTRY glNewList (GLuint list, GLenum mode); +WINGDIAPI void APIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); +WINGDIAPI void APIENTRY glNormal3bv (const GLbyte *v); +WINGDIAPI void APIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); +WINGDIAPI void APIENTRY glNormal3dv (const GLdouble *v); +WINGDIAPI void APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +WINGDIAPI void APIENTRY glNormal3fv (const GLfloat *v); +WINGDIAPI void APIENTRY glNormal3i (GLint nx, GLint ny, GLint nz); +WINGDIAPI void APIENTRY glNormal3iv (const GLint *v); +WINGDIAPI void APIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz); +WINGDIAPI void APIENTRY glNormal3sv (const GLshort *v); +WINGDIAPI void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +WINGDIAPI void APIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +WINGDIAPI void APIENTRY glPassThrough (GLfloat token); +WINGDIAPI void APIENTRY glPixelMapfv (GLenum map, GLint mapsize, const GLfloat *values); +WINGDIAPI void APIENTRY glPixelMapuiv (GLenum map, GLint mapsize, const GLuint *values); +WINGDIAPI void APIENTRY glPixelMapusv (GLenum map, GLint mapsize, const GLushort *values); +WINGDIAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); +WINGDIAPI void APIENTRY glPixelTransferf (GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glPixelTransferi (GLenum pname, GLint param); +WINGDIAPI void APIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor); +WINGDIAPI void APIENTRY glPointSize (GLfloat size); +WINGDIAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); +WINGDIAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +WINGDIAPI void APIENTRY glPolygonStipple (const GLubyte *mask); +WINGDIAPI void APIENTRY glPopAttrib (void); +WINGDIAPI void APIENTRY glPopClientAttrib (void); +WINGDIAPI void APIENTRY glPopMatrix (void); +WINGDIAPI void APIENTRY glPopName (void); +WINGDIAPI void APIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities); +WINGDIAPI void APIENTRY glPushAttrib (GLbitfield mask); +WINGDIAPI void APIENTRY glPushClientAttrib (GLbitfield mask); +WINGDIAPI void APIENTRY glPushMatrix (void); +WINGDIAPI void APIENTRY glPushName (GLuint name); +WINGDIAPI void APIENTRY glRasterPos2d (GLdouble x, GLdouble y); +WINGDIAPI void APIENTRY glRasterPos2dv (const GLdouble *v); +WINGDIAPI void APIENTRY glRasterPos2f (GLfloat x, GLfloat y); +WINGDIAPI void APIENTRY glRasterPos2fv (const GLfloat *v); +WINGDIAPI void APIENTRY glRasterPos2i (GLint x, GLint y); +WINGDIAPI void APIENTRY glRasterPos2iv (const GLint *v); +WINGDIAPI void APIENTRY glRasterPos2s (GLshort x, GLshort y); +WINGDIAPI void APIENTRY glRasterPos2sv (const GLshort *v); +WINGDIAPI void APIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); +WINGDIAPI void APIENTRY glRasterPos3dv (const GLdouble *v); +WINGDIAPI void APIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); +WINGDIAPI void APIENTRY glRasterPos3fv (const GLfloat *v); +WINGDIAPI void APIENTRY glRasterPos3i (GLint x, GLint y, GLint z); +WINGDIAPI void APIENTRY glRasterPos3iv (const GLint *v); +WINGDIAPI void APIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z); +WINGDIAPI void APIENTRY glRasterPos3sv (const GLshort *v); +WINGDIAPI void APIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +WINGDIAPI void APIENTRY glRasterPos4dv (const GLdouble *v); +WINGDIAPI void APIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +WINGDIAPI void APIENTRY glRasterPos4fv (const GLfloat *v); +WINGDIAPI void APIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w); +WINGDIAPI void APIENTRY glRasterPos4iv (const GLint *v); +WINGDIAPI void APIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); +WINGDIAPI void APIENTRY glRasterPos4sv (const GLshort *v); +WINGDIAPI void APIENTRY glReadBuffer (GLenum mode); +WINGDIAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +WINGDIAPI void APIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +WINGDIAPI void APIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2); +WINGDIAPI void APIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +WINGDIAPI void APIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2); +WINGDIAPI void APIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2); +WINGDIAPI void APIENTRY glRectiv (const GLint *v1, const GLint *v2); +WINGDIAPI void APIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); +WINGDIAPI void APIENTRY glRectsv (const GLshort *v1, const GLshort *v2); +WINGDIAPI GLint APIENTRY glRenderMode (GLenum mode); +WINGDIAPI void APIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +WINGDIAPI void APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +WINGDIAPI void APIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z); +WINGDIAPI void APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +WINGDIAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +WINGDIAPI void APIENTRY glSelectBuffer (GLsizei size, GLuint *buffer); +WINGDIAPI void APIENTRY glShadeModel (GLenum mode); +WINGDIAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +WINGDIAPI void APIENTRY glStencilMask (GLuint mask); +WINGDIAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +WINGDIAPI void APIENTRY glTexCoord1d (GLdouble s); +WINGDIAPI void APIENTRY glTexCoord1dv (const GLdouble *v); +WINGDIAPI void APIENTRY glTexCoord1f (GLfloat s); +WINGDIAPI void APIENTRY glTexCoord1fv (const GLfloat *v); +WINGDIAPI void APIENTRY glTexCoord1i (GLint s); +WINGDIAPI void APIENTRY glTexCoord1iv (const GLint *v); +WINGDIAPI void APIENTRY glTexCoord1s (GLshort s); +WINGDIAPI void APIENTRY glTexCoord1sv (const GLshort *v); +WINGDIAPI void APIENTRY glTexCoord2d (GLdouble s, GLdouble t); +WINGDIAPI void APIENTRY glTexCoord2dv (const GLdouble *v); +WINGDIAPI void APIENTRY glTexCoord2f (GLfloat s, GLfloat t); +WINGDIAPI void APIENTRY glTexCoord2fv (const GLfloat *v); +WINGDIAPI void APIENTRY glTexCoord2i (GLint s, GLint t); +WINGDIAPI void APIENTRY glTexCoord2iv (const GLint *v); +WINGDIAPI void APIENTRY glTexCoord2s (GLshort s, GLshort t); +WINGDIAPI void APIENTRY glTexCoord2sv (const GLshort *v); +WINGDIAPI void APIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); +WINGDIAPI void APIENTRY glTexCoord3dv (const GLdouble *v); +WINGDIAPI void APIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); +WINGDIAPI void APIENTRY glTexCoord3fv (const GLfloat *v); +WINGDIAPI void APIENTRY glTexCoord3i (GLint s, GLint t, GLint r); +WINGDIAPI void APIENTRY glTexCoord3iv (const GLint *v); +WINGDIAPI void APIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r); +WINGDIAPI void APIENTRY glTexCoord3sv (const GLshort *v); +WINGDIAPI void APIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); +WINGDIAPI void APIENTRY glTexCoord4dv (const GLdouble *v); +WINGDIAPI void APIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); +WINGDIAPI void APIENTRY glTexCoord4fv (const GLfloat *v); +WINGDIAPI void APIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q); +WINGDIAPI void APIENTRY glTexCoord4iv (const GLint *v); +WINGDIAPI void APIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); +WINGDIAPI void APIENTRY glTexCoord4sv (const GLshort *v); +WINGDIAPI void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +WINGDIAPI void APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); +WINGDIAPI void APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param); +WINGDIAPI void APIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params); +WINGDIAPI void APIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param); +WINGDIAPI void APIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +WINGDIAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +WINGDIAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +WINGDIAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +WINGDIAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +WINGDIAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +WINGDIAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +WINGDIAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +WINGDIAPI void APIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z); +WINGDIAPI void APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); +WINGDIAPI void APIENTRY glVertex2d (GLdouble x, GLdouble y); +WINGDIAPI void APIENTRY glVertex2dv (const GLdouble *v); +WINGDIAPI void APIENTRY glVertex2f (GLfloat x, GLfloat y); +WINGDIAPI void APIENTRY glVertex2fv (const GLfloat *v); +WINGDIAPI void APIENTRY glVertex2i (GLint x, GLint y); +WINGDIAPI void APIENTRY glVertex2iv (const GLint *v); +WINGDIAPI void APIENTRY glVertex2s (GLshort x, GLshort y); +WINGDIAPI void APIENTRY glVertex2sv (const GLshort *v); +WINGDIAPI void APIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z); +WINGDIAPI void APIENTRY glVertex3dv (const GLdouble *v); +WINGDIAPI void APIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z); +WINGDIAPI void APIENTRY glVertex3fv (const GLfloat *v); +WINGDIAPI void APIENTRY glVertex3i (GLint x, GLint y, GLint z); +WINGDIAPI void APIENTRY glVertex3iv (const GLint *v); +WINGDIAPI void APIENTRY glVertex3s (GLshort x, GLshort y, GLshort z); +WINGDIAPI void APIENTRY glVertex3sv (const GLshort *v); +WINGDIAPI void APIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +WINGDIAPI void APIENTRY glVertex4dv (const GLdouble *v); +WINGDIAPI void APIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +WINGDIAPI void APIENTRY glVertex4fv (const GLfloat *v); +WINGDIAPI void APIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w); +WINGDIAPI void APIENTRY glVertex4iv (const GLint *v); +WINGDIAPI void APIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); +WINGDIAPI void APIENTRY glVertex4sv (const GLshort *v); +WINGDIAPI void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +WINGDIAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ diff --git a/Externals/GLew/glext.h b/Externals/GLew/glext.h index 0321028f66..7bb8e6e7cc 100644 --- a/Externals/GLew/glext.h +++ b/Externals/GLew/glext.h @@ -1,6495 +1,6495 @@ -#ifndef __glext_h_ -#define __glext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: This software was created using the -** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has -** not been independently verified as being compliant with the OpenGL(R) -** version 1.2.1 Specification. -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -/*************************************************************/ - -/* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2005/06/20 */ -/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ -#define GL_GLEXT_VERSION 29 - -#ifndef GL_VERSION_1_2 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_RESCALE_NORMAL 0x803A -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#endif - -#ifndef GL_ARB_imaging -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C -#define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E -#define GL_MINMAX_FORMAT 0x802F -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 -#define GL_COLOR_MATRIX 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 -#define GL_COLOR_TABLE_SCALE 0x80D6 -#define GL_COLOR_TABLE_BIAS 0x80D7 -#define GL_COLOR_TABLE_FORMAT 0x80D8 -#define GL_COLOR_TABLE_WIDTH 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 -#endif - -#ifndef GL_VERSION_1_3 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#endif - -#ifndef GL_VERSION_1_4 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#endif - -#ifndef GL_VERSION_1_5 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE -#define GL_FOG_COORD GL_FOG_COORDINATE -#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE -#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE -#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE -#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER -#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING -#define GL_SRC0_RGB GL_SOURCE0_RGB -#define GL_SRC1_RGB GL_SOURCE1_RGB -#define GL_SRC2_RGB GL_SOURCE2_RGB -#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA -#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA -#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA -#endif - -#ifndef GL_VERSION_2_0 -#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_ARB_multitexture -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 -#endif - -#ifndef GL_ARB_multisample -#define GL_MULTISAMPLE_ARB 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F -#define GL_SAMPLE_COVERAGE_ARB 0x80A0 -#define GL_SAMPLE_BUFFERS_ARB 0x80A8 -#define GL_SAMPLES_ARB 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -#endif - -#ifndef GL_ARB_texture_env_add -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_NORMAL_MAP_ARB 0x8511 -#define GL_REFLECTION_MAP_ARB 0x8512 -#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C -#endif - -#ifndef GL_ARB_texture_compression -#define GL_COMPRESSED_ALPHA_ARB 0x84E9 -#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB -#define GL_COMPRESSED_INTENSITY_ARB 0x84EC -#define GL_COMPRESSED_RGB_ARB 0x84ED -#define GL_COMPRESSED_RGBA_ARB 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 -#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_CLAMP_TO_BORDER_ARB 0x812D -#endif - -#ifndef GL_ARB_point_parameters -#define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 -#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 -#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 -#define GL_VERTEX_BLEND_ARB 0x86A7 -#define GL_CURRENT_WEIGHT_ARB 0x86A8 -#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA -#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB -#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC -#define GL_WEIGHT_ARRAY_ARB 0x86AD -#define GL_MODELVIEW0_ARB 0x1700 -#define GL_MODELVIEW1_ARB 0x850A -#define GL_MODELVIEW2_ARB 0x8722 -#define GL_MODELVIEW3_ARB 0x8723 -#define GL_MODELVIEW4_ARB 0x8724 -#define GL_MODELVIEW5_ARB 0x8725 -#define GL_MODELVIEW6_ARB 0x8726 -#define GL_MODELVIEW7_ARB 0x8727 -#define GL_MODELVIEW8_ARB 0x8728 -#define GL_MODELVIEW9_ARB 0x8729 -#define GL_MODELVIEW10_ARB 0x872A -#define GL_MODELVIEW11_ARB 0x872B -#define GL_MODELVIEW12_ARB 0x872C -#define GL_MODELVIEW13_ARB 0x872D -#define GL_MODELVIEW14_ARB 0x872E -#define GL_MODELVIEW15_ARB 0x872F -#define GL_MODELVIEW16_ARB 0x8730 -#define GL_MODELVIEW17_ARB 0x8731 -#define GL_MODELVIEW18_ARB 0x8732 -#define GL_MODELVIEW19_ARB 0x8733 -#define GL_MODELVIEW20_ARB 0x8734 -#define GL_MODELVIEW21_ARB 0x8735 -#define GL_MODELVIEW22_ARB 0x8736 -#define GL_MODELVIEW23_ARB 0x8737 -#define GL_MODELVIEW24_ARB 0x8738 -#define GL_MODELVIEW25_ARB 0x8739 -#define GL_MODELVIEW26_ARB 0x873A -#define GL_MODELVIEW27_ARB 0x873B -#define GL_MODELVIEW28_ARB 0x873C -#define GL_MODELVIEW29_ARB 0x873D -#define GL_MODELVIEW30_ARB 0x873E -#define GL_MODELVIEW31_ARB 0x873F -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_MATRIX_PALETTE_ARB 0x8840 -#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 -#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 -#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 -#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 -#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 -#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_COMBINE_ARB 0x8570 -#define GL_COMBINE_RGB_ARB 0x8571 -#define GL_COMBINE_ALPHA_ARB 0x8572 -#define GL_SOURCE0_RGB_ARB 0x8580 -#define GL_SOURCE1_RGB_ARB 0x8581 -#define GL_SOURCE2_RGB_ARB 0x8582 -#define GL_SOURCE0_ALPHA_ARB 0x8588 -#define GL_SOURCE1_ALPHA_ARB 0x8589 -#define GL_SOURCE2_ALPHA_ARB 0x858A -#define GL_OPERAND0_RGB_ARB 0x8590 -#define GL_OPERAND1_RGB_ARB 0x8591 -#define GL_OPERAND2_RGB_ARB 0x8592 -#define GL_OPERAND0_ALPHA_ARB 0x8598 -#define GL_OPERAND1_ALPHA_ARB 0x8599 -#define GL_OPERAND2_ALPHA_ARB 0x859A -#define GL_RGB_SCALE_ARB 0x8573 -#define GL_ADD_SIGNED_ARB 0x8574 -#define GL_INTERPOLATE_ARB 0x8575 -#define GL_SUBTRACT_ARB 0x84E7 -#define GL_CONSTANT_ARB 0x8576 -#define GL_PRIMARY_COLOR_ARB 0x8577 -#define GL_PREVIOUS_ARB 0x8578 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_DOT3_RGB_ARB 0x86AE -#define GL_DOT3_RGBA_ARB 0x86AF -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_ARB 0x8370 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_DEPTH_COMPONENT16_ARB 0x81A5 -#define GL_DEPTH_COMPONENT24_ARB 0x81A6 -#define GL_DEPTH_COMPONENT32_ARB 0x81A7 -#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A -#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B -#endif - -#ifndef GL_ARB_shadow -#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C -#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D -#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF -#endif - -#ifndef GL_ARB_window_pos -#endif - -#ifndef GL_ARB_vertex_program -#define GL_COLOR_SUM_ARB 0x8458 -#define GL_VERTEX_PROGRAM_ARB 0x8620 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB -#define GL_PROGRAM_ATTRIBS_ARB 0x88AC -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF -#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 -#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 -#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 -#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 -#define GL_MATRIX0_ARB 0x88C0 -#define GL_MATRIX1_ARB 0x88C1 -#define GL_MATRIX2_ARB 0x88C2 -#define GL_MATRIX3_ARB 0x88C3 -#define GL_MATRIX4_ARB 0x88C4 -#define GL_MATRIX5_ARB 0x88C5 -#define GL_MATRIX6_ARB 0x88C6 -#define GL_MATRIX7_ARB 0x88C7 -#define GL_MATRIX8_ARB 0x88C8 -#define GL_MATRIX9_ARB 0x88C9 -#define GL_MATRIX10_ARB 0x88CA -#define GL_MATRIX11_ARB 0x88CB -#define GL_MATRIX12_ARB 0x88CC -#define GL_MATRIX13_ARB 0x88CD -#define GL_MATRIX14_ARB 0x88CE -#define GL_MATRIX15_ARB 0x88CF -#define GL_MATRIX16_ARB 0x88D0 -#define GL_MATRIX17_ARB 0x88D1 -#define GL_MATRIX18_ARB 0x88D2 -#define GL_MATRIX19_ARB 0x88D3 -#define GL_MATRIX20_ARB 0x88D4 -#define GL_MATRIX21_ARB 0x88D5 -#define GL_MATRIX22_ARB 0x88D6 -#define GL_MATRIX23_ARB 0x88D7 -#define GL_MATRIX24_ARB 0x88D8 -#define GL_MATRIX25_ARB 0x88D9 -#define GL_MATRIX26_ARB 0x88DA -#define GL_MATRIX27_ARB 0x88DB -#define GL_MATRIX28_ARB 0x88DC -#define GL_MATRIX29_ARB 0x88DD -#define GL_MATRIX30_ARB 0x88DE -#define GL_MATRIX31_ARB 0x88DF -#endif - -#ifndef GL_ARB_fragment_program -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_BUFFER_SIZE_ARB 0x8764 -#define GL_BUFFER_USAGE_ARB 0x8765 -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F -#define GL_READ_ONLY_ARB 0x88B8 -#define GL_WRITE_ONLY_ARB 0x88B9 -#define GL_READ_WRITE_ARB 0x88BA -#define GL_BUFFER_ACCESS_ARB 0x88BB -#define GL_BUFFER_MAPPED_ARB 0x88BC -#define GL_BUFFER_MAP_POINTER_ARB 0x88BD -#define GL_STREAM_DRAW_ARB 0x88E0 -#define GL_STREAM_READ_ARB 0x88E1 -#define GL_STREAM_COPY_ARB 0x88E2 -#define GL_STATIC_DRAW_ARB 0x88E4 -#define GL_STATIC_READ_ARB 0x88E5 -#define GL_STATIC_COPY_ARB 0x88E6 -#define GL_DYNAMIC_DRAW_ARB 0x88E8 -#define GL_DYNAMIC_READ_ARB 0x88E9 -#define GL_DYNAMIC_COPY_ARB 0x88EA -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_QUERY_COUNTER_BITS_ARB 0x8864 -#define GL_CURRENT_QUERY_ARB 0x8865 -#define GL_QUERY_RESULT_ARB 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 -#define GL_SAMPLES_PASSED_ARB 0x8914 -#endif - -#ifndef GL_ARB_shader_objects -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_SHADER_OBJECT_ARB 0x8B48 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_VERTEX_SHADER_ARB 0x8B31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A -#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_FRAGMENT_SHADER_ARB 0x8B30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#endif - -#ifndef GL_ARB_point_sprite -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 -#define GL_DRAW_BUFFER0_ARB 0x8825 -#define GL_DRAW_BUFFER1_ARB 0x8826 -#define GL_DRAW_BUFFER2_ARB 0x8827 -#define GL_DRAW_BUFFER3_ARB 0x8828 -#define GL_DRAW_BUFFER4_ARB 0x8829 -#define GL_DRAW_BUFFER5_ARB 0x882A -#define GL_DRAW_BUFFER6_ARB 0x882B -#define GL_DRAW_BUFFER7_ARB 0x882C -#define GL_DRAW_BUFFER8_ARB 0x882D -#define GL_DRAW_BUFFER9_ARB 0x882E -#define GL_DRAW_BUFFER10_ARB 0x882F -#define GL_DRAW_BUFFER11_ARB 0x8830 -#define GL_DRAW_BUFFER12_ARB 0x8831 -#define GL_DRAW_BUFFER13_ARB 0x8832 -#define GL_DRAW_BUFFER14_ARB 0x8833 -#define GL_DRAW_BUFFER15_ARB 0x8834 -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_HALF_FLOAT_ARB 0x140B -#endif - -#ifndef GL_ARB_texture_float -#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 -#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 -#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 -#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_ALPHA32F_ARB 0x8816 -#define GL_INTENSITY32F_ARB 0x8817 -#define GL_LUMINANCE32F_ARB 0x8818 -#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 -#define GL_RGBA16F_ARB 0x881A -#define GL_RGB16F_ARB 0x881B -#define GL_ALPHA16F_ARB 0x881C -#define GL_INTENSITY16F_ARB 0x881D -#define GL_LUMINANCE16F_ARB 0x881E -#define GL_LUMINANCE_ALPHA16F_ARB 0x881F -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF -#endif - -#ifndef GL_EXT_abgr -#define GL_ABGR_EXT 0x8000 -#endif - -#ifndef GL_EXT_blend_color -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_POLYGON_OFFSET_EXT 0x8037 -#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 -#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 -#endif - -#ifndef GL_EXT_texture -#define GL_ALPHA4_EXT 0x803B -#define GL_ALPHA8_EXT 0x803C -#define GL_ALPHA12_EXT 0x803D -#define GL_ALPHA16_EXT 0x803E -#define GL_LUMINANCE4_EXT 0x803F -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE12_EXT 0x8041 -#define GL_LUMINANCE16_EXT 0x8042 -#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 -#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 -#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 -#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 -#define GL_INTENSITY_EXT 0x8049 -#define GL_INTENSITY4_EXT 0x804A -#define GL_INTENSITY8_EXT 0x804B -#define GL_INTENSITY12_EXT 0x804C -#define GL_INTENSITY16_EXT 0x804D -#define GL_RGB2_EXT 0x804E -#define GL_RGB4_EXT 0x804F -#define GL_RGB5_EXT 0x8050 -#define GL_RGB8_EXT 0x8051 -#define GL_RGB10_EXT 0x8052 -#define GL_RGB12_EXT 0x8053 -#define GL_RGB16_EXT 0x8054 -#define GL_RGBA2_EXT 0x8055 -#define GL_RGBA4_EXT 0x8056 -#define GL_RGB5_A1_EXT 0x8057 -#define GL_RGBA8_EXT 0x8058 -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGBA12_EXT 0x805A -#define GL_RGBA16_EXT 0x805B -#define GL_TEXTURE_RED_SIZE_EXT 0x805C -#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D -#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E -#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 -#define GL_REPLACE_EXT 0x8062 -#define GL_PROXY_TEXTURE_1D_EXT 0x8063 -#define GL_PROXY_TEXTURE_2D_EXT 0x8064 -#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 -#endif - -#ifndef GL_EXT_texture3D -#define GL_PACK_SKIP_IMAGES_EXT 0x806B -#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C -#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D -#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E -#define GL_TEXTURE_3D_EXT 0x806F -#define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_FILTER4_SGIS 0x8146 -#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 -#endif - -#ifndef GL_EXT_subtexture -#endif - -#ifndef GL_EXT_copy_texture -#endif - -#ifndef GL_EXT_histogram -#define GL_HISTOGRAM_EXT 0x8024 -#define GL_PROXY_HISTOGRAM_EXT 0x8025 -#define GL_HISTOGRAM_WIDTH_EXT 0x8026 -#define GL_HISTOGRAM_FORMAT_EXT 0x8027 -#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C -#define GL_HISTOGRAM_SINK_EXT 0x802D -#define GL_MINMAX_EXT 0x802E -#define GL_MINMAX_FORMAT_EXT 0x802F -#define GL_MINMAX_SINK_EXT 0x8030 -#define GL_TABLE_TOO_LARGE_EXT 0x8031 -#endif - -#ifndef GL_EXT_convolution -#define GL_CONVOLUTION_1D_EXT 0x8010 -#define GL_CONVOLUTION_2D_EXT 0x8011 -#define GL_SEPARABLE_2D_EXT 0x8012 -#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 -#define GL_REDUCE_EXT 0x8016 -#define GL_CONVOLUTION_FORMAT_EXT 0x8017 -#define GL_CONVOLUTION_WIDTH_EXT 0x8018 -#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 -#endif - -#ifndef GL_SGI_color_matrix -#define GL_COLOR_MATRIX_SGI 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB -#endif - -#ifndef GL_SGI_color_table -#define GL_COLOR_TABLE_SGI 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 -#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 -#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 -#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_PIXEL_TEXTURE_SGIS 0x8353 -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 -#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_PIXEL_TEX_GEN_SGIX 0x8139 -#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B -#endif - -#ifndef GL_SGIS_texture4D -#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 -#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 -#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 -#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 -#define GL_TEXTURE_4D_SGIS 0x8134 -#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 -#define GL_TEXTURE_4DSIZE_SGIS 0x8136 -#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 -#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 -#define GL_TEXTURE_4D_BINDING_SGIS 0x814F -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC -#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD -#endif - -#ifndef GL_EXT_cmyka -#define GL_CMYK_EXT 0x800C -#define GL_CMYKA_EXT 0x800D -#define GL_PACK_CMYK_HINT_EXT 0x800E -#define GL_UNPACK_CMYK_HINT_EXT 0x800F -#endif - -#ifndef GL_EXT_texture_object -#define GL_TEXTURE_PRIORITY_EXT 0x8066 -#define GL_TEXTURE_RESIDENT_EXT 0x8067 -#define GL_TEXTURE_1D_BINDING_EXT 0x8068 -#define GL_TEXTURE_2D_BINDING_EXT 0x8069 -#define GL_TEXTURE_3D_BINDING_EXT 0x806A -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 -#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 -#define GL_LINEAR_DETAIL_SGIS 0x8097 -#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 -#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 -#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A -#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B -#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_LINEAR_SHARPEN_SGIS 0x80AD -#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE -#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF -#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_TEXTURE_MIN_LOD_SGIS 0x813A -#define GL_TEXTURE_MAX_LOD_SGIS 0x813B -#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C -#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D -#endif - -#ifndef GL_SGIS_multisample -#define GL_MULTISAMPLE_SGIS 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F -#define GL_SAMPLE_MASK_SGIS 0x80A0 -#define GL_1PASS_SGIS 0x80A1 -#define GL_2PASS_0_SGIS 0x80A2 -#define GL_2PASS_1_SGIS 0x80A3 -#define GL_4PASS_0_SGIS 0x80A4 -#define GL_4PASS_1_SGIS 0x80A5 -#define GL_4PASS_2_SGIS 0x80A6 -#define GL_4PASS_3_SGIS 0x80A7 -#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 -#define GL_SAMPLES_SGIS 0x80A9 -#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA -#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB -#define GL_SAMPLE_PATTERN_SGIS 0x80AC -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_RESCALE_NORMAL_EXT 0x803A -#endif - -#ifndef GL_EXT_vertex_array -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -#endif - -#ifndef GL_EXT_misc_attribute -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_GENERATE_MIPMAP_SGIS 0x8191 -#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 -#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 -#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 -#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 -#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 -#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 -#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 -#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 -#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 -#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D -#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E -#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F -#endif - -#ifndef GL_SGIX_shadow -#define GL_TEXTURE_COMPARE_SGIX 0x819A -#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B -#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C -#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_CLAMP_TO_EDGE_SGIS 0x812F -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_CLAMP_TO_BORDER_SGIS 0x812D -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_BLEND_EQUATION_EXT 0x8009 -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_FUNC_SUBTRACT_EXT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B -#endif - -#ifndef GL_EXT_blend_logic_op -#endif - -#ifndef GL_SGIX_interlace -#define GL_INTERLACE_SGIX 0x8094 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E -#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F -#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 -#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 -#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 -#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 -#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 -#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 -#endif - -#ifndef GL_SGIS_texture_select -#define GL_DUAL_ALPHA4_SGIS 0x8110 -#define GL_DUAL_ALPHA8_SGIS 0x8111 -#define GL_DUAL_ALPHA12_SGIS 0x8112 -#define GL_DUAL_ALPHA16_SGIS 0x8113 -#define GL_DUAL_LUMINANCE4_SGIS 0x8114 -#define GL_DUAL_LUMINANCE8_SGIS 0x8115 -#define GL_DUAL_LUMINANCE12_SGIS 0x8116 -#define GL_DUAL_LUMINANCE16_SGIS 0x8117 -#define GL_DUAL_INTENSITY4_SGIS 0x8118 -#define GL_DUAL_INTENSITY8_SGIS 0x8119 -#define GL_DUAL_INTENSITY12_SGIS 0x811A -#define GL_DUAL_INTENSITY16_SGIS 0x811B -#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C -#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D -#define GL_QUAD_ALPHA4_SGIS 0x811E -#define GL_QUAD_ALPHA8_SGIS 0x811F -#define GL_QUAD_LUMINANCE4_SGIS 0x8120 -#define GL_QUAD_LUMINANCE8_SGIS 0x8121 -#define GL_QUAD_INTENSITY4_SGIS 0x8122 -#define GL_QUAD_INTENSITY8_SGIS 0x8123 -#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 -#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SPRITE_SGIX 0x8148 -#define GL_SPRITE_MODE_SGIX 0x8149 -#define GL_SPRITE_AXIS_SGIX 0x814A -#define GL_SPRITE_TRANSLATION_SGIX 0x814B -#define GL_SPRITE_AXIAL_SGIX 0x814C -#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D -#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E -#endif - -#ifndef GL_EXT_point_parameters -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_POINT_SIZE_MIN_SGIS 0x8126 -#define GL_POINT_SIZE_MAX_SGIS 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 -#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 -#endif - -#ifndef GL_SGIX_instruments -#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 -#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 -#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A -#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B -#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C -#endif - -#ifndef GL_SGIX_framezoom -#define GL_FRAMEZOOM_SGIX 0x818B -#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C -#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#endif - -#ifndef GL_FfdMaskSGIX -#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 -#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 -#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 -#define GL_DEFORMATIONS_MASK_SGIX 0x8196 -#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_REFERENCE_PLANE_SGIX 0x817D -#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E -#endif - -#ifndef GL_SGIX_flush_raster -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 -#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 -#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_FOG_FUNC_SGIS 0x812A -#define GL_FOG_FUNC_POINTS_SGIS 0x812B -#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_FOG_OFFSET_SGIX 0x8198 -#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 -#endif - -#ifndef GL_HP_image_transform -#define GL_IMAGE_SCALE_X_HP 0x8155 -#define GL_IMAGE_SCALE_Y_HP 0x8156 -#define GL_IMAGE_TRANSLATE_X_HP 0x8157 -#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 -#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 -#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A -#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B -#define GL_IMAGE_MAG_FILTER_HP 0x815C -#define GL_IMAGE_MIN_FILTER_HP 0x815D -#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E -#define GL_CUBIC_HP 0x815F -#define GL_AVERAGE_HP 0x8160 -#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 -#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 -#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_IGNORE_BORDER_HP 0x8150 -#define GL_CONSTANT_BORDER_HP 0x8151 -#define GL_REPLICATE_BORDER_HP 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 -#endif - -#ifndef GL_INGR_palette_buffer -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE -#endif - -#ifndef GL_EXT_color_subtable -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_VERTEX_DATA_HINT_PGI 0x1A22A -#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B -#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C -#define GL_MAX_VERTEX_HINT_PGI 0x1A22D -#define GL_COLOR3_BIT_PGI 0x00010000 -#define GL_COLOR4_BIT_PGI 0x00020000 -#define GL_EDGEFLAG_BIT_PGI 0x00040000 -#define GL_INDEX_BIT_PGI 0x00080000 -#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 -#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 -#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 -#define GL_MAT_EMISSION_BIT_PGI 0x00800000 -#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 -#define GL_MAT_SHININESS_BIT_PGI 0x02000000 -#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 -#define GL_NORMAL_BIT_PGI 0x08000000 -#define GL_TEXCOORD1_BIT_PGI 0x10000000 -#define GL_TEXCOORD2_BIT_PGI 0x20000000 -#define GL_TEXCOORD3_BIT_PGI 0x40000000 -#define GL_TEXCOORD4_BIT_PGI 0x80000000 -#define GL_VERTEX23_BIT_PGI 0x00000004 -#define GL_VERTEX4_BIT_PGI 0x00000008 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 -#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD -#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE -#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 -#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 -#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 -#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C -#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D -#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E -#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F -#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 -#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 -#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 -#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 -#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 -#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 -#define GL_CLIP_NEAR_HINT_PGI 0x1A220 -#define GL_CLIP_FAR_HINT_PGI 0x1A221 -#define GL_WIDE_LINE_HINT_PGI 0x1A222 -#define GL_BACK_NORMALS_HINT_PGI 0x1A223 -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 -#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_LIST_PRIORITY_SGIX 0x8182 -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_IR_INSTRUMENT1_SGIX 0x817F -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E -#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F -#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SHADOW_AMBIENT_SGIX 0x80BF -#endif - -#ifndef GL_EXT_index_texture -#endif - -#ifndef GL_EXT_index_material -#define GL_INDEX_MATERIAL_EXT 0x81B8 -#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 -#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA -#endif - -#ifndef GL_EXT_index_func -#define GL_INDEX_TEST_EXT 0x81B5 -#define GL_INDEX_TEST_FUNC_EXT 0x81B6 -#define GL_INDEX_TEST_REF_EXT 0x81B7 -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_IUI_V2F_EXT 0x81AD -#define GL_IUI_V3F_EXT 0x81AE -#define GL_IUI_N3F_V2F_EXT 0x81AF -#define GL_IUI_N3F_V3F_EXT 0x81B0 -#define GL_T2F_IUI_V2F_EXT 0x81B1 -#define GL_T2F_IUI_V3F_EXT 0x81B2 -#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 -#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 -#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_CULL_VERTEX_EXT 0x81AA -#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB -#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_YCRCB_422_SGIX 0x81BB -#define GL_YCRCB_444_SGIX 0x81BC -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 -#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 -#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 -#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 -#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 -#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 -#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 -#define GL_LIGHT_ENV_MODE_SGIX 0x8407 -#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 -#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 -#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A -#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B -#define GL_FRAGMENT_LIGHT0_SGIX 0x840C -#define GL_FRAGMENT_LIGHT1_SGIX 0x840D -#define GL_FRAGMENT_LIGHT2_SGIX 0x840E -#define GL_FRAGMENT_LIGHT3_SGIX 0x840F -#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 -#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 -#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 -#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 -#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 -#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 -#endif - -#ifndef GL_WIN_phong_shading -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB -#endif - -#ifndef GL_WIN_specular_fog -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC -#endif - -#ifndef GL_EXT_light_texture -#define GL_FRAGMENT_MATERIAL_EXT 0x8349 -#define GL_FRAGMENT_NORMAL_EXT 0x834A -#define GL_FRAGMENT_COLOR_EXT 0x834C -#define GL_ATTENUATION_EXT 0x834D -#define GL_SHADOW_ATTENUATION_EXT 0x834E -#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F -#define GL_TEXTURE_LIGHT_EXT 0x8350 -#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 -#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 -/* reuse GL_FRAGMENT_DEPTH_EXT */ -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_ALPHA_MIN_SGIX 0x8320 -#define GL_ALPHA_MAX_SGIX 0x8321 -#endif - -#ifndef GL_SGIX_impact_pixel_texture -#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 -#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 -#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 -#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 -#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 -#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 -#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A -#endif - -#ifndef GL_EXT_bgra -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 -#endif - -#ifndef GL_SGIX_async -#define GL_ASYNC_MARKER_SGIX 0x8329 -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C -#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D -#define GL_ASYNC_READ_PIXELS_SGIX 0x835E -#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F -#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 -#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_ASYNC_HISTOGRAM_SGIX 0x832C -#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D -#endif - -#ifndef GL_INTEL_texture_scissor -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 -#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 -#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 -#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 -#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 -#endif - -#ifndef GL_HP_occlusion_test -#define GL_OCCLUSION_TEST_HP 0x8165 -#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 -#define GL_PIXEL_MAG_FILTER_EXT 0x8331 -#define GL_PIXEL_MIN_FILTER_EXT 0x8332 -#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 -#define GL_CUBIC_EXT 0x8334 -#define GL_AVERAGE_EXT 0x8335 -#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 -#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 -#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 -#define GL_SINGLE_COLOR_EXT 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA -#endif - -#ifndef GL_EXT_secondary_color -#define GL_COLOR_SUM_EXT 0x8458 -#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D -#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_PERTURB_EXT 0x85AE -#define GL_TEXTURE_NORMAL_EXT 0x85AF -#endif - -#ifndef GL_EXT_multi_draw_arrays -#endif - -#ifndef GL_EXT_fog_coord -#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 -#define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 -#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 -#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_SCREEN_COORDINATES_REND 0x8490 -#define GL_INVERTED_SCREEN_W_REND 0x8491 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_TANGENT_ARRAY_EXT 0x8439 -#define GL_BINORMAL_ARRAY_EXT 0x843A -#define GL_CURRENT_TANGENT_EXT 0x843B -#define GL_CURRENT_BINORMAL_EXT 0x843C -#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E -#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F -#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 -#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 -#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 -#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 -#define GL_MAP1_TANGENT_EXT 0x8444 -#define GL_MAP2_TANGENT_EXT 0x8445 -#define GL_MAP1_BINORMAL_EXT 0x8446 -#define GL_MAP2_BINORMAL_EXT 0x8447 -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858A -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859A -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_TRANSFORM_HINT_APPLE 0x85B1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_FOG_SCALE_SGIX 0x81FC -#define GL_FOG_SCALE_VALUE_SGIX 0x81FD -#endif - -#ifndef GL_SUNX_constant_data -#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 -#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 -#endif - -#ifndef GL_SUN_global_alpha -#define GL_GLOBAL_ALPHA_SUN 0x81D9 -#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA -#endif - -#ifndef GL_SUN_triangle_list -#define GL_RESTART_SUN 0x0001 -#define GL_REPLACE_MIDDLE_SUN 0x0002 -#define GL_REPLACE_OLDEST_SUN 0x0003 -#define GL_TRIANGLE_LIST_SUN 0x81D7 -#define GL_REPLACEMENT_CODE_SUN 0x81D8 -#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 -#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 -#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 -#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 -#define GL_R1UI_V3F_SUN 0x85C4 -#define GL_R1UI_C4UB_V3F_SUN 0x85C5 -#define GL_R1UI_C3F_V3F_SUN 0x85C6 -#define GL_R1UI_N3F_V3F_SUN 0x85C7 -#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 -#define GL_R1UI_T2F_V3F_SUN 0x85C9 -#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA -#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB -#endif - -#ifndef GL_SUN_vertex -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_BLEND_DST_RGB_EXT 0x80C8 -#define GL_BLEND_SRC_RGB_EXT 0x80C9 -#define GL_BLEND_DST_ALPHA_EXT 0x80CA -#define GL_BLEND_SRC_ALPHA_EXT 0x80CB -#endif - -#ifndef GL_INGR_color_clamp -#define GL_RED_MIN_CLAMP_INGR 0x8560 -#define GL_GREEN_MIN_CLAMP_INGR 0x8561 -#define GL_BLUE_MIN_CLAMP_INGR 0x8562 -#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 -#define GL_RED_MAX_CLAMP_INGR 0x8564 -#define GL_GREEN_MAX_CLAMP_INGR 0x8565 -#define GL_BLUE_MAX_CLAMP_INGR 0x8566 -#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INTERLACE_READ_INGR 0x8568 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_INCR_WRAP_EXT 0x8507 -#define GL_DECR_WRAP_EXT 0x8508 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_422_EXT 0x80CC -#define GL_422_REV_EXT 0x80CD -#define GL_422_AVERAGE_EXT 0x80CE -#define GL_422_REV_AVERAGE_EXT 0x80CF -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NORMAL_MAP_NV 0x8511 -#define GL_REFLECTION_MAP_NV 0x8512 -#endif - -#ifndef GL_EXT_texture_cube_map -#define GL_NORMAL_MAP_EXT 0x8511 -#define GL_REFLECTION_MAP_EXT 0x8512 -#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_WRAP_BORDER_SUN 0x81D4 -#endif - -#ifndef GL_EXT_texture_env_add -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH -#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 -#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX -#define GL_MODELVIEW1_MATRIX_EXT 0x8506 -#define GL_VERTEX_WEIGHTING_EXT 0x8509 -#define GL_MODELVIEW0_EXT GL_MODELVIEW -#define GL_MODELVIEW1_EXT 0x850A -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F -#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_MAX_SHININESS_NV 0x8504 -#define GL_MAX_SPOT_EXPONENT_NV 0x8505 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_NV 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E -#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F -#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 -#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 -#endif - -#ifndef GL_NV_register_combiners -#define GL_REGISTER_COMBINERS_NV 0x8522 -#define GL_VARIABLE_A_NV 0x8523 -#define GL_VARIABLE_B_NV 0x8524 -#define GL_VARIABLE_C_NV 0x8525 -#define GL_VARIABLE_D_NV 0x8526 -#define GL_VARIABLE_E_NV 0x8527 -#define GL_VARIABLE_F_NV 0x8528 -#define GL_VARIABLE_G_NV 0x8529 -#define GL_CONSTANT_COLOR0_NV 0x852A -#define GL_CONSTANT_COLOR1_NV 0x852B -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D -#define GL_SPARE0_NV 0x852E -#define GL_SPARE1_NV 0x852F -#define GL_DISCARD_NV 0x8530 -#define GL_E_TIMES_F_NV 0x8531 -#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 -#define GL_UNSIGNED_IDENTITY_NV 0x8536 -#define GL_UNSIGNED_INVERT_NV 0x8537 -#define GL_EXPAND_NORMAL_NV 0x8538 -#define GL_EXPAND_NEGATE_NV 0x8539 -#define GL_HALF_BIAS_NORMAL_NV 0x853A -#define GL_HALF_BIAS_NEGATE_NV 0x853B -#define GL_SIGNED_IDENTITY_NV 0x853C -#define GL_SIGNED_NEGATE_NV 0x853D -#define GL_SCALE_BY_TWO_NV 0x853E -#define GL_SCALE_BY_FOUR_NV 0x853F -#define GL_SCALE_BY_ONE_HALF_NV 0x8540 -#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 -#define GL_COMBINER_INPUT_NV 0x8542 -#define GL_COMBINER_MAPPING_NV 0x8543 -#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 -#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 -#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 -#define GL_COMBINER_MUX_SUM_NV 0x8547 -#define GL_COMBINER_SCALE_NV 0x8548 -#define GL_COMBINER_BIAS_NV 0x8549 -#define GL_COMBINER_AB_OUTPUT_NV 0x854A -#define GL_COMBINER_CD_OUTPUT_NV 0x854B -#define GL_COMBINER_SUM_OUTPUT_NV 0x854C -#define GL_MAX_GENERAL_COMBINERS_NV 0x854D -#define GL_NUM_GENERAL_COMBINERS_NV 0x854E -#define GL_COLOR_SUM_CLAMP_NV 0x854F -#define GL_COMBINER0_NV 0x8550 -#define GL_COMBINER1_NV 0x8551 -#define GL_COMBINER2_NV 0x8552 -#define GL_COMBINER3_NV 0x8553 -#define GL_COMBINER4_NV 0x8554 -#define GL_COMBINER5_NV 0x8555 -#define GL_COMBINER6_NV 0x8556 -#define GL_COMBINER7_NV 0x8557 -/* reuse GL_TEXTURE0_ARB */ -/* reuse GL_TEXTURE1_ARB */ -/* reuse GL_ZERO */ -/* reuse GL_NONE */ -/* reuse GL_FOG */ -#endif - -#ifndef GL_NV_fog_distance -#define GL_FOG_DISTANCE_MODE_NV 0x855A -#define GL_EYE_RADIAL_NV 0x855B -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C -/* reuse GL_EYE_PLANE */ -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_EMBOSS_LIGHT_NV 0x855D -#define GL_EMBOSS_CONSTANT_NV 0x855E -#define GL_EMBOSS_MAP_NV 0x855F -#endif - -#ifndef GL_NV_blend_square -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_COMBINE4_NV 0x8503 -#define GL_SOURCE3_RGB_NV 0x8583 -#define GL_SOURCE3_ALPHA_NV 0x858B -#define GL_OPERAND3_RGB_NV 0x8593 -#define GL_OPERAND3_ALPHA_NV 0x859B -#endif - -#ifndef GL_MESA_resize_buffers -#endif - -#ifndef GL_MESA_window_pos -#endif - -#ifndef GL_EXT_texture_compression_s3tc -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_CULL_VERTEX_IBM 103050 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_VERTEX_ARRAY_LIST_IBM 103070 -#define GL_NORMAL_ARRAY_LIST_IBM 103071 -#define GL_COLOR_ARRAY_LIST_IBM 103072 -#define GL_INDEX_ARRAY_LIST_IBM 103073 -#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 -#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 -#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 -#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 -#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 -#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 -#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 -#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 -#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 -#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 -#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 -#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 -#endif - -#ifndef GL_SGIX_subsample -#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 -#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 -#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 -#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 -#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_YCRCB_SGIX 0x8318 -#define GL_YCRCBA_SGIX 0x8319 -#endif - -#ifndef GL_SGI_depth_pass_instrument -#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 -#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 -#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 -#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_MULTISAMPLE_3DFX 0x86B2 -#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 -#define GL_SAMPLES_3DFX 0x86B4 -#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 -#endif - -#ifndef GL_3DFX_tbuffer -#endif - -#ifndef GL_EXT_multisample -#define GL_MULTISAMPLE_EXT 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F -#define GL_SAMPLE_MASK_EXT 0x80A0 -#define GL_1PASS_EXT 0x80A1 -#define GL_2PASS_0_EXT 0x80A2 -#define GL_2PASS_1_EXT 0x80A3 -#define GL_4PASS_0_EXT 0x80A4 -#define GL_4PASS_1_EXT 0x80A5 -#define GL_4PASS_2_EXT 0x80A6 -#define GL_4PASS_3_EXT 0x80A7 -#define GL_SAMPLE_BUFFERS_EXT 0x80A8 -#define GL_SAMPLES_EXT 0x80A9 -#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA -#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB -#define GL_SAMPLE_PATTERN_EXT 0x80AC -#define GL_MULTISAMPLE_BIT_EXT 0x20000000 -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_VERTEX_PRECLIP_SGIX 0x83EE -#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_CONVOLUTION_HINT_SGIX 0x8316 -#endif - -#ifndef GL_SGIX_resample -#define GL_PACK_RESAMPLE_SGIX 0x842C -#define GL_UNPACK_RESAMPLE_SGIX 0x842D -#define GL_RESAMPLE_REPLICATE_SGIX 0x842E -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F -#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 -#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 -#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 -#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 -#define GL_EYE_POINT_SGIS 0x81F4 -#define GL_OBJECT_POINT_SGIS 0x81F5 -#define GL_EYE_LINE_SGIS 0x81F6 -#define GL_OBJECT_LINE_SGIS 0x81F7 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_DOT3_RGB_EXT 0x8740 -#define GL_DOT3_RGBA_EXT 0x8741 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_MIRROR_CLAMP_ATI 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 -#endif - -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -#ifndef GL_IBM_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_IBM 0x8370 -#endif - -#ifndef GL_NV_evaluators -#define GL_EVAL_2D_NV 0x86C0 -#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 -#define GL_MAP_TESSELLATION_NV 0x86C2 -#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 -#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 -#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 -#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 -#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 -#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 -#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 -#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA -#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB -#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC -#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD -#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE -#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF -#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 -#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 -#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 -#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 -#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 -#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 -#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 -#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_DEPTH_STENCIL_NV 0x84F9 -#define GL_UNSIGNED_INT_24_8_NV 0x84FA -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_PER_STAGE_CONSTANTS_NV 0x8535 -#endif - -#ifndef GL_NV_texture_compression_vtc -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_TEXTURE_RECTANGLE_NV 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 -#endif - -#ifndef GL_NV_texture_shader -#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C -#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D -#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E -#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 -#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA -#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB -#define GL_DSDT_MAG_INTENSITY_NV 0x86DC -#define GL_SHADER_CONSISTENT_NV 0x86DD -#define GL_TEXTURE_SHADER_NV 0x86DE -#define GL_SHADER_OPERATION_NV 0x86DF -#define GL_CULL_MODES_NV 0x86E0 -#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 -#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 -#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 -#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV -#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV -#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV -#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 -#define GL_CONST_EYE_NV 0x86E5 -#define GL_PASS_THROUGH_NV 0x86E6 -#define GL_CULL_FRAGMENT_NV 0x86E7 -#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 -#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 -#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA -#define GL_DOT_PRODUCT_NV 0x86EC -#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED -#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE -#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 -#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 -#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 -#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 -#define GL_HILO_NV 0x86F4 -#define GL_DSDT_NV 0x86F5 -#define GL_DSDT_MAG_NV 0x86F6 -#define GL_DSDT_MAG_VIB_NV 0x86F7 -#define GL_HILO16_NV 0x86F8 -#define GL_SIGNED_HILO_NV 0x86F9 -#define GL_SIGNED_HILO16_NV 0x86FA -#define GL_SIGNED_RGBA_NV 0x86FB -#define GL_SIGNED_RGBA8_NV 0x86FC -#define GL_SIGNED_RGB_NV 0x86FE -#define GL_SIGNED_RGB8_NV 0x86FF -#define GL_SIGNED_LUMINANCE_NV 0x8701 -#define GL_SIGNED_LUMINANCE8_NV 0x8702 -#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 -#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 -#define GL_SIGNED_ALPHA_NV 0x8705 -#define GL_SIGNED_ALPHA8_NV 0x8706 -#define GL_SIGNED_INTENSITY_NV 0x8707 -#define GL_SIGNED_INTENSITY8_NV 0x8708 -#define GL_DSDT8_NV 0x8709 -#define GL_DSDT8_MAG8_NV 0x870A -#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B -#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C -#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D -#define GL_HI_SCALE_NV 0x870E -#define GL_LO_SCALE_NV 0x870F -#define GL_DS_SCALE_NV 0x8710 -#define GL_DT_SCALE_NV 0x8711 -#define GL_MAGNITUDE_SCALE_NV 0x8712 -#define GL_VIBRANCE_SCALE_NV 0x8713 -#define GL_HI_BIAS_NV 0x8714 -#define GL_LO_BIAS_NV 0x8715 -#define GL_DS_BIAS_NV 0x8716 -#define GL_DT_BIAS_NV 0x8717 -#define GL_MAGNITUDE_BIAS_NV 0x8718 -#define GL_VIBRANCE_BIAS_NV 0x8719 -#define GL_TEXTURE_BORDER_VALUES_NV 0x871A -#define GL_TEXTURE_HI_SIZE_NV 0x871B -#define GL_TEXTURE_LO_SIZE_NV 0x871C -#define GL_TEXTURE_DS_SIZE_NV 0x871D -#define GL_TEXTURE_DT_SIZE_NV 0x871E -#define GL_TEXTURE_MAG_SIZE_NV 0x871F -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 -#endif - -#ifndef GL_NV_vertex_program -#define GL_VERTEX_PROGRAM_NV 0x8620 -#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 -#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 -#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 -#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 -#define GL_CURRENT_ATTRIB_NV 0x8626 -#define GL_PROGRAM_LENGTH_NV 0x8627 -#define GL_PROGRAM_STRING_NV 0x8628 -#define GL_MODELVIEW_PROJECTION_NV 0x8629 -#define GL_IDENTITY_NV 0x862A -#define GL_INVERSE_NV 0x862B -#define GL_TRANSPOSE_NV 0x862C -#define GL_INVERSE_TRANSPOSE_NV 0x862D -#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E -#define GL_MAX_TRACK_MATRICES_NV 0x862F -#define GL_MATRIX0_NV 0x8630 -#define GL_MATRIX1_NV 0x8631 -#define GL_MATRIX2_NV 0x8632 -#define GL_MATRIX3_NV 0x8633 -#define GL_MATRIX4_NV 0x8634 -#define GL_MATRIX5_NV 0x8635 -#define GL_MATRIX6_NV 0x8636 -#define GL_MATRIX7_NV 0x8637 -#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 -#define GL_CURRENT_MATRIX_NV 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 -#define GL_PROGRAM_PARAMETER_NV 0x8644 -#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 -#define GL_PROGRAM_TARGET_NV 0x8646 -#define GL_PROGRAM_RESIDENT_NV 0x8647 -#define GL_TRACK_MATRIX_NV 0x8648 -#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 -#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A -#define GL_PROGRAM_ERROR_POSITION_NV 0x864B -#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 -#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 -#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 -#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 -#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 -#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 -#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 -#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 -#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 -#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 -#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A -#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B -#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C -#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D -#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E -#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F -#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 -#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 -#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 -#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 -#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 -#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 -#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 -#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 -#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 -#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 -#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A -#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B -#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C -#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D -#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E -#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F -#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 -#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 -#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 -#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 -#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 -#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 -#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 -#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 -#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 -#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 -#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A -#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B -#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C -#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D -#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E -#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 -#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A -#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SCALEBIAS_HINT_SGIX 0x8322 -#endif - -#ifndef GL_OML_interlace -#define GL_INTERLACE_OML 0x8980 -#define GL_INTERLACE_READ_OML 0x8981 -#endif - -#ifndef GL_OML_subsample -#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 -#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 -#endif - -#ifndef GL_OML_resample -#define GL_PACK_RESAMPLE_OML 0x8984 -#define GL_UNPACK_RESAMPLE_OML 0x8985 -#define GL_RESAMPLE_REPLICATE_OML 0x8986 -#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 -#define GL_RESAMPLE_AVERAGE_OML 0x8988 -#define GL_RESAMPLE_DECIMATE_OML 0x8989 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E -#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_BUMP_ROT_MATRIX_ATI 0x8775 -#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 -#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 -#define GL_BUMP_TEX_UNITS_ATI 0x8778 -#define GL_DUDV_ATI 0x8779 -#define GL_DU8DV8_ATI 0x877A -#define GL_BUMP_ENVMAP_ATI 0x877B -#define GL_BUMP_TARGET_ATI 0x877C -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_FRAGMENT_SHADER_ATI 0x8920 -#define GL_REG_0_ATI 0x8921 -#define GL_REG_1_ATI 0x8922 -#define GL_REG_2_ATI 0x8923 -#define GL_REG_3_ATI 0x8924 -#define GL_REG_4_ATI 0x8925 -#define GL_REG_5_ATI 0x8926 -#define GL_REG_6_ATI 0x8927 -#define GL_REG_7_ATI 0x8928 -#define GL_REG_8_ATI 0x8929 -#define GL_REG_9_ATI 0x892A -#define GL_REG_10_ATI 0x892B -#define GL_REG_11_ATI 0x892C -#define GL_REG_12_ATI 0x892D -#define GL_REG_13_ATI 0x892E -#define GL_REG_14_ATI 0x892F -#define GL_REG_15_ATI 0x8930 -#define GL_REG_16_ATI 0x8931 -#define GL_REG_17_ATI 0x8932 -#define GL_REG_18_ATI 0x8933 -#define GL_REG_19_ATI 0x8934 -#define GL_REG_20_ATI 0x8935 -#define GL_REG_21_ATI 0x8936 -#define GL_REG_22_ATI 0x8937 -#define GL_REG_23_ATI 0x8938 -#define GL_REG_24_ATI 0x8939 -#define GL_REG_25_ATI 0x893A -#define GL_REG_26_ATI 0x893B -#define GL_REG_27_ATI 0x893C -#define GL_REG_28_ATI 0x893D -#define GL_REG_29_ATI 0x893E -#define GL_REG_30_ATI 0x893F -#define GL_REG_31_ATI 0x8940 -#define GL_CON_0_ATI 0x8941 -#define GL_CON_1_ATI 0x8942 -#define GL_CON_2_ATI 0x8943 -#define GL_CON_3_ATI 0x8944 -#define GL_CON_4_ATI 0x8945 -#define GL_CON_5_ATI 0x8946 -#define GL_CON_6_ATI 0x8947 -#define GL_CON_7_ATI 0x8948 -#define GL_CON_8_ATI 0x8949 -#define GL_CON_9_ATI 0x894A -#define GL_CON_10_ATI 0x894B -#define GL_CON_11_ATI 0x894C -#define GL_CON_12_ATI 0x894D -#define GL_CON_13_ATI 0x894E -#define GL_CON_14_ATI 0x894F -#define GL_CON_15_ATI 0x8950 -#define GL_CON_16_ATI 0x8951 -#define GL_CON_17_ATI 0x8952 -#define GL_CON_18_ATI 0x8953 -#define GL_CON_19_ATI 0x8954 -#define GL_CON_20_ATI 0x8955 -#define GL_CON_21_ATI 0x8956 -#define GL_CON_22_ATI 0x8957 -#define GL_CON_23_ATI 0x8958 -#define GL_CON_24_ATI 0x8959 -#define GL_CON_25_ATI 0x895A -#define GL_CON_26_ATI 0x895B -#define GL_CON_27_ATI 0x895C -#define GL_CON_28_ATI 0x895D -#define GL_CON_29_ATI 0x895E -#define GL_CON_30_ATI 0x895F -#define GL_CON_31_ATI 0x8960 -#define GL_MOV_ATI 0x8961 -#define GL_ADD_ATI 0x8963 -#define GL_MUL_ATI 0x8964 -#define GL_SUB_ATI 0x8965 -#define GL_DOT3_ATI 0x8966 -#define GL_DOT4_ATI 0x8967 -#define GL_MAD_ATI 0x8968 -#define GL_LERP_ATI 0x8969 -#define GL_CND_ATI 0x896A -#define GL_CND0_ATI 0x896B -#define GL_DOT2_ADD_ATI 0x896C -#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D -#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E -#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F -#define GL_NUM_PASSES_ATI 0x8970 -#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 -#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 -#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 -#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 -#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 -#define GL_SWIZZLE_STR_ATI 0x8976 -#define GL_SWIZZLE_STQ_ATI 0x8977 -#define GL_SWIZZLE_STR_DR_ATI 0x8978 -#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 -#define GL_SWIZZLE_STRQ_ATI 0x897A -#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B -#define GL_RED_BIT_ATI 0x00000001 -#define GL_GREEN_BIT_ATI 0x00000002 -#define GL_BLUE_BIT_ATI 0x00000004 -#define GL_2X_BIT_ATI 0x00000001 -#define GL_4X_BIT_ATI 0x00000002 -#define GL_8X_BIT_ATI 0x00000004 -#define GL_HALF_BIT_ATI 0x00000008 -#define GL_QUARTER_BIT_ATI 0x00000010 -#define GL_EIGHTH_BIT_ATI 0x00000020 -#define GL_SATURATE_BIT_ATI 0x00000040 -#define GL_COMP_BIT_ATI 0x00000002 -#define GL_NEGATE_BIT_ATI 0x00000004 -#define GL_BIAS_BIT_ATI 0x00000008 -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_PN_TRIANGLES_ATI 0x87F0 -#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 -#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 -#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 -#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 -#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 -#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 -#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 -#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_STATIC_ATI 0x8760 -#define GL_DYNAMIC_ATI 0x8761 -#define GL_PRESERVE_ATI 0x8762 -#define GL_DISCARD_ATI 0x8763 -#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 -#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 -#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 -#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_VERTEX_SHADER_EXT 0x8780 -#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 -#define GL_OP_INDEX_EXT 0x8782 -#define GL_OP_NEGATE_EXT 0x8783 -#define GL_OP_DOT3_EXT 0x8784 -#define GL_OP_DOT4_EXT 0x8785 -#define GL_OP_MUL_EXT 0x8786 -#define GL_OP_ADD_EXT 0x8787 -#define GL_OP_MADD_EXT 0x8788 -#define GL_OP_FRAC_EXT 0x8789 -#define GL_OP_MAX_EXT 0x878A -#define GL_OP_MIN_EXT 0x878B -#define GL_OP_SET_GE_EXT 0x878C -#define GL_OP_SET_LT_EXT 0x878D -#define GL_OP_CLAMP_EXT 0x878E -#define GL_OP_FLOOR_EXT 0x878F -#define GL_OP_ROUND_EXT 0x8790 -#define GL_OP_EXP_BASE_2_EXT 0x8791 -#define GL_OP_LOG_BASE_2_EXT 0x8792 -#define GL_OP_POWER_EXT 0x8793 -#define GL_OP_RECIP_EXT 0x8794 -#define GL_OP_RECIP_SQRT_EXT 0x8795 -#define GL_OP_SUB_EXT 0x8796 -#define GL_OP_CROSS_PRODUCT_EXT 0x8797 -#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 -#define GL_OP_MOV_EXT 0x8799 -#define GL_OUTPUT_VERTEX_EXT 0x879A -#define GL_OUTPUT_COLOR0_EXT 0x879B -#define GL_OUTPUT_COLOR1_EXT 0x879C -#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D -#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E -#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F -#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 -#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 -#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 -#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 -#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 -#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 -#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 -#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 -#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 -#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 -#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA -#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB -#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC -#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD -#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE -#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF -#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 -#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 -#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 -#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 -#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 -#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 -#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 -#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 -#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 -#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 -#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA -#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB -#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC -#define GL_OUTPUT_FOG_EXT 0x87BD -#define GL_SCALAR_EXT 0x87BE -#define GL_VECTOR_EXT 0x87BF -#define GL_MATRIX_EXT 0x87C0 -#define GL_VARIANT_EXT 0x87C1 -#define GL_INVARIANT_EXT 0x87C2 -#define GL_LOCAL_CONSTANT_EXT 0x87C3 -#define GL_LOCAL_EXT 0x87C4 -#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 -#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 -#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 -#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 -#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE -#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF -#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 -#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 -#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 -#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 -#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 -#define GL_X_EXT 0x87D5 -#define GL_Y_EXT 0x87D6 -#define GL_Z_EXT 0x87D7 -#define GL_W_EXT 0x87D8 -#define GL_NEGATIVE_X_EXT 0x87D9 -#define GL_NEGATIVE_Y_EXT 0x87DA -#define GL_NEGATIVE_Z_EXT 0x87DB -#define GL_NEGATIVE_W_EXT 0x87DC -#define GL_ZERO_EXT 0x87DD -#define GL_ONE_EXT 0x87DE -#define GL_NEGATIVE_ONE_EXT 0x87DF -#define GL_NORMALIZED_RANGE_EXT 0x87E0 -#define GL_FULL_RANGE_EXT 0x87E1 -#define GL_CURRENT_VERTEX_EXT 0x87E2 -#define GL_MVP_MATRIX_EXT 0x87E3 -#define GL_VARIANT_VALUE_EXT 0x87E4 -#define GL_VARIANT_DATATYPE_EXT 0x87E5 -#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 -#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 -#define GL_VARIANT_ARRAY_EXT 0x87E8 -#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 -#define GL_INVARIANT_VALUE_EXT 0x87EA -#define GL_INVARIANT_DATATYPE_EXT 0x87EB -#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC -#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_MAX_VERTEX_STREAMS_ATI 0x876B -#define GL_VERTEX_STREAM0_ATI 0x876C -#define GL_VERTEX_STREAM1_ATI 0x876D -#define GL_VERTEX_STREAM2_ATI 0x876E -#define GL_VERTEX_STREAM3_ATI 0x876F -#define GL_VERTEX_STREAM4_ATI 0x8770 -#define GL_VERTEX_STREAM5_ATI 0x8771 -#define GL_VERTEX_STREAM6_ATI 0x8772 -#define GL_VERTEX_STREAM7_ATI 0x8773 -#define GL_VERTEX_SOURCE_ATI 0x8774 -#endif - -#ifndef GL_ATI_element_array -#define GL_ELEMENT_ARRAY_ATI 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A -#endif - -#ifndef GL_SUN_mesh_array -#define GL_QUAD_MESH_SUN 0x8614 -#define GL_TRIANGLE_MESH_SUN 0x8615 -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SLICE_ACCUM_SUN 0x85CC -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_DEPTH_CLAMP_NV 0x864F -#endif - -#ifndef GL_NV_occlusion_query -#define GL_PIXEL_COUNTER_BITS_NV 0x8864 -#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 -#define GL_PIXEL_COUNT_NV 0x8866 -#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 -#endif - -#ifndef GL_NV_point_sprite -#define GL_POINT_SPRITE_NV 0x8861 -#define GL_COORD_REPLACE_NV 0x8862 -#define GL_POINT_SPRITE_R_MODE_NV 0x8863 -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 -#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 -#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 -#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 -#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 -#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A -#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B -#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C -#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D -#define GL_HILO8_NV 0x885E -#define GL_SIGNED_HILO8_NV 0x885F -#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 -#endif - -#ifndef GL_NV_vertex_program1_1 -#endif - -#ifndef GL_EXT_shadow_funcs -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 -#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 -#endif - -#ifndef GL_APPLE_element_array -#define GL_ELEMENT_ARRAY_APPLE 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A -#endif - -#ifndef GL_APPLE_fence -#define GL_DRAW_PIXELS_APPLE 0x8A0A -#define GL_FENCE_APPLE 0x8A0B -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E -#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F -#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 -#define GL_STORAGE_CACHED_APPLE 0x85BE -#define GL_STORAGE_SHARED_APPLE 0x85BF -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_YCBCR_422_APPLE 0x85B9 -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -#ifndef GL_S3_s3tc -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 -#define GL_RGBA_S3TC 0x83A2 -#define GL_RGBA4_S3TC 0x83A3 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 -#define GL_DRAW_BUFFER0_ATI 0x8825 -#define GL_DRAW_BUFFER1_ATI 0x8826 -#define GL_DRAW_BUFFER2_ATI 0x8827 -#define GL_DRAW_BUFFER3_ATI 0x8828 -#define GL_DRAW_BUFFER4_ATI 0x8829 -#define GL_DRAW_BUFFER5_ATI 0x882A -#define GL_DRAW_BUFFER6_ATI 0x882B -#define GL_DRAW_BUFFER7_ATI 0x882C -#define GL_DRAW_BUFFER8_ATI 0x882D -#define GL_DRAW_BUFFER9_ATI 0x882E -#define GL_DRAW_BUFFER10_ATI 0x882F -#define GL_DRAW_BUFFER11_ATI 0x8830 -#define GL_DRAW_BUFFER12_ATI 0x8831 -#define GL_DRAW_BUFFER13_ATI 0x8832 -#define GL_DRAW_BUFFER14_ATI 0x8833 -#define GL_DRAW_BUFFER15_ATI 0x8834 -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 -#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_MODULATE_ADD_ATI 0x8744 -#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 -#define GL_MODULATE_SUBTRACT_ATI 0x8746 -#endif - -#ifndef GL_ATI_texture_float -#define GL_RGBA_FLOAT32_ATI 0x8814 -#define GL_RGB_FLOAT32_ATI 0x8815 -#define GL_ALPHA_FLOAT32_ATI 0x8816 -#define GL_INTENSITY_FLOAT32_ATI 0x8817 -#define GL_LUMINANCE_FLOAT32_ATI 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 -#define GL_RGBA_FLOAT16_ATI 0x881A -#define GL_RGB_FLOAT16_ATI 0x881B -#define GL_ALPHA_FLOAT16_ATI 0x881C -#define GL_INTENSITY_FLOAT16_ATI 0x881D -#define GL_LUMINANCE_FLOAT16_ATI 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F -#endif - -#ifndef GL_NV_float_buffer -#define GL_FLOAT_R_NV 0x8880 -#define GL_FLOAT_RG_NV 0x8881 -#define GL_FLOAT_RGB_NV 0x8882 -#define GL_FLOAT_RGBA_NV 0x8883 -#define GL_FLOAT_R16_NV 0x8884 -#define GL_FLOAT_R32_NV 0x8885 -#define GL_FLOAT_RG16_NV 0x8886 -#define GL_FLOAT_RG32_NV 0x8887 -#define GL_FLOAT_RGB16_NV 0x8888 -#define GL_FLOAT_RGB32_NV 0x8889 -#define GL_FLOAT_RGBA16_NV 0x888A -#define GL_FLOAT_RGBA32_NV 0x888B -#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C -#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D -#define GL_FLOAT_RGBA_MODE_NV 0x888E -#endif - -#ifndef GL_NV_fragment_program -#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 -#define GL_FRAGMENT_PROGRAM_NV 0x8870 -#define GL_MAX_TEXTURE_COORDS_NV 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 -#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 -#define GL_PROGRAM_ERROR_STRING_NV 0x8874 -#endif - -#ifndef GL_NV_half_float -#define GL_HALF_FLOAT_NV 0x140B -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 -#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 -#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A -#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B -#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C -#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D -#endif - -#ifndef GL_NV_primitive_restart -#define GL_PRIMITIVE_RESTART_NV 0x8558 -#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F -#endif - -#ifndef GL_NV_vertex_program2 -#endif - -#ifndef GL_ATI_map_object_buffer -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_STENCIL_BACK_FUNC_ATI 0x8800 -#define GL_STENCIL_BACK_FAIL_ATI 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#endif - -#ifndef GL_OES_read_format -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 -#define GL_DEPTH_BOUNDS_EXT 0x8891 -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_MIRROR_CLAMP_EXT 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 -#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION -#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D -#endif - -#ifndef GL_MESA_pack_invert -#define GL_PACK_INVERT_MESA 0x8758 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB -#define GL_YCBCR_MESA 0x8757 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF -#endif - -#ifndef GL_NV_fragment_program_option -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 -#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 -#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 -#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 -#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 -#endif - -#ifndef GL_NV_vertex_program2_option -/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ -/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ -#endif - -#ifndef GL_NV_vertex_program3 -/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -#endif - -#ifndef GL_GREMEDY_string_marker -#endif - - -/*************************************************************/ - -#include -#ifndef GL_VERSION_2_0 -/* GL type for program/shader text */ -typedef char GLchar; /* native character */ -#endif - -#ifndef GL_VERSION_1_5 -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -#endif - -#ifndef GL_ARB_vertex_buffer_object -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -#endif - -#ifndef GL_ARB_shader_objects -/* GL types for handling shader object handles and program/shader text */ -typedef char GLcharARB; /* native character */ -typedef unsigned int GLhandleARB; /* shader object handle */ -#endif - -/* GL types for "half" precision (s10e5) float data in host memory */ -#ifndef GL_ARB_half_float_pixel -typedef unsigned short GLhalfARB; -#endif - -#ifndef GL_NV_half_float -typedef unsigned short GLhalfNV; -#endif - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); -GLAPI void APIENTRY glBlendEquation (GLenum); -GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); -GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); -GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); -GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); -GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); -GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); -GLAPI void APIENTRY glResetHistogram (GLenum); -GLAPI void APIENTRY glResetMinmax (GLenum); -GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum); -GLAPI void APIENTRY glClientActiveTexture (GLenum); -GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); -GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); -GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); -GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); -GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); -GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); -GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); -GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glFogCoordf (GLfloat); -GLAPI void APIENTRY glFogCoordfv (const GLfloat *); -GLAPI void APIENTRY glFogCoordd (GLdouble); -GLAPI void APIENTRY glFogCoorddv (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); -GLAPI void APIENTRY glPointParameteri (GLenum, GLint); -GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); -GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); -GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); -GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); -GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); -GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); -GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); -GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); -GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); -GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); -GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); -GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); -GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); -GLAPI void APIENTRY glWindowPos2i (GLint, GLint); -GLAPI void APIENTRY glWindowPos2iv (const GLint *); -GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2sv (const GLshort *); -GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); -GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); -GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3iv (const GLint *); -GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3sv (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); -#endif - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsQuery (GLuint); -GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); -GLAPI void APIENTRY glEndQuery (GLenum); -GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); -GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); -GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint); -GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); -GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); -GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); -GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); -GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); -GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); -GLAPI void APIENTRY glAttachShader (GLuint, GLuint); -GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); -GLAPI void APIENTRY glCompileShader (GLuint); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum); -GLAPI void APIENTRY glDeleteProgram (GLuint); -GLAPI void APIENTRY glDeleteShader (GLuint); -GLAPI void APIENTRY glDetachShader (GLuint, GLuint); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); -GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); -GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); -GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); -GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgram (GLuint); -GLAPI GLboolean APIENTRY glIsShader (GLuint); -GLAPI void APIENTRY glLinkProgram (GLuint); -GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); -GLAPI void APIENTRY glUseProgram (GLuint); -GLAPI void APIENTRY glUniform1f (GLint, GLfloat); -GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform1i (GLint, GLint); -GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); -GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glValidateProgram (GLuint); -GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTextureARB (GLenum); -GLAPI void APIENTRY glClientActiveTextureARB (GLenum); -GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); -GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); -GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); -GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); -GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_ARB_transpose_matrix 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); -GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); -GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); -GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -#endif - -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); -#endif - -#ifndef GL_ARB_texture_env_add -#define GL_ARB_texture_env_add 1 -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_ARB_texture_cube_map 1 -#endif - -#ifndef GL_ARB_texture_compression -#define GL_ARB_texture_compression 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_ARB_texture_border_clamp 1 -#endif - -#ifndef GL_ARB_point_parameters -#define GL_ARB_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_ARB_vertex_blend 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); -GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); -GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); -GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); -GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); -GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); -GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); -GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); -GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexBlendARB (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); -typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); -typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); -typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); -typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); -typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); -typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_ARB_matrix_palette 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); -GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); -GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); -GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); -GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); -typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_ARB_texture_env_combine 1 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#define GL_ARB_texture_env_crossbar 1 -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_ARB_texture_env_dot3 1 -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_ARB_texture_mirrored_repeat 1 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_ARB_depth_texture 1 -#endif - -#ifndef GL_ARB_shadow -#define GL_ARB_shadow 1 -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_ARB_shadow_ambient 1 -#endif - -#ifndef GL_ARB_window_pos -#define GL_ARB_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); -GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); -GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); -GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); -GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); -GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); -GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); -GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); -GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); -#endif - -#ifndef GL_ARB_vertex_program -#define GL_ARB_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); -GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); -GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); -GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); -GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); -GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); -GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); -GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); -GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); -typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); -#endif - -#ifndef GL_ARB_fragment_program -#define GL_ARB_fragment_program 1 -/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_ARB_vertex_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); -GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); -GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); -GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); -GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); -GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); -GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); -GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_ARB_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); -GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); -GLAPI void APIENTRY glEndQueryARB (GLenum); -GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); -GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); -GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); -GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); -GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); -GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); -GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); -GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); -GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); -GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); -GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); -GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); -GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform1iARB (GLint, GLint); -GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); -GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); -GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); -GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); -GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); -GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); -GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); -GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); -typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); -typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); -typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); -typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); -typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_ARB_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); -GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_ARB_fragment_shader 1 -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_ARB_shading_language_100 1 -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#define GL_ARB_texture_non_power_of_two 1 -#endif - -#ifndef GL_ARB_point_sprite -#define GL_ARB_point_sprite 1 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#define GL_ARB_fragment_program_shadow 1 -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_ARB_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_ARB_texture_rectangle 1 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_ARB_color_buffer_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_ARB_half_float_pixel 1 -#endif - -#ifndef GL_ARB_texture_float -#define GL_ARB_texture_float 1 -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_ARB_pixel_buffer_object 1 -#endif - -#ifndef GL_EXT_abgr -#define GL_EXT_abgr 1 -#endif - -#ifndef GL_EXT_blend_color -#define GL_EXT_blend_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_EXT_polygon_offset 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); -#endif - -#ifndef GL_EXT_texture -#define GL_EXT_texture 1 -#endif - -#ifndef GL_EXT_texture3D -#define GL_EXT_texture3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_SGIS_texture_filter4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); -typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#endif - -#ifndef GL_EXT_subtexture -#define GL_EXT_subtexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_EXT_copy_texture -#define GL_EXT_copy_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); -GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_EXT_histogram -#define GL_EXT_histogram 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); -GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); -GLAPI void APIENTRY glResetHistogramEXT (GLenum); -GLAPI void APIENTRY glResetMinmaxEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); -#endif - -#ifndef GL_EXT_convolution -#define GL_EXT_convolution 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); -GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); -GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -#endif - -#ifndef GL_EXT_color_matrix -#define GL_EXT_color_matrix 1 -#endif - -#ifndef GL_SGI_color_table -#define GL_SGI_color_table 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_SGIX_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_SGIS_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); -GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); -GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); -GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); -GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); -GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIS_texture4D -#define GL_SGIS_texture4D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_SGI_texture_color_table 1 -#endif - -#ifndef GL_EXT_cmyka -#define GL_EXT_cmyka 1 -#endif - -#ifndef GL_EXT_texture_object -#define GL_EXT_texture_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); -GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); -GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_SGIS_detail_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_SGIS_sharpen_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_EXT_packed_pixels 1 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_SGIS_texture_lod 1 -#endif - -#ifndef GL_SGIS_multisample -#define GL_SGIS_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); -GLAPI void APIENTRY glSamplePatternSGIS (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_EXT_rescale_normal 1 -#endif - -#ifndef GL_EXT_vertex_array -#define GL_EXT_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glArrayElementEXT (GLint); -GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); -GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); -GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); -GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); -typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); -typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_misc_attribute -#define GL_EXT_misc_attribute 1 -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_SGIS_generate_mipmap 1 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_SGIX_clipmap 1 -#endif - -#ifndef GL_SGIX_shadow -#define GL_SGIX_shadow 1 -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_SGIS_texture_edge_clamp 1 -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_SGIS_texture_border_clamp 1 -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_EXT_blend_subtract 1 -#endif - -#ifndef GL_EXT_blend_logic_op -#define GL_EXT_blend_logic_op 1 -#endif - -#ifndef GL_SGIX_interlace -#define GL_SGIX_interlace 1 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_SGIX_pixel_tiles 1 -#endif - -#ifndef GL_SGIX_texture_select -#define GL_SGIX_texture_select 1 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SGIX_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); -GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); -GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); -GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_SGIX_texture_multi_buffer 1 -#endif - -#ifndef GL_EXT_point_parameters -#define GL_EXT_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_SGIS_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIX_instruments -#define GL_SGIX_instruments 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); -GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); -GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); -GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); -GLAPI void APIENTRY glStartInstrumentsSGIX (void); -GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); -typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); -typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); -typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_SGIX_texture_scale_bias 1 -#endif - -#ifndef GL_SGIX_framezoom -#define GL_SGIX_framezoom 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameZoomSGIX (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#define GL_SGIX_tag_sample_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTagSampleBufferSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_SGIX_polynomial_ffd 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); -GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); -GLAPI void APIENTRY glDeformSGIX (GLbitfield); -GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_SGIX_reference_plane 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); -#endif - -#ifndef GL_SGIX_flush_raster -#define GL_SGIX_flush_raster 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushRasterSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_SGIX_depth_texture 1 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_SGIS_fog_function 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_SGIX_fog_offset 1 -#endif - -#ifndef GL_HP_image_transform -#define GL_HP_image_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); -GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_HP_convolution_border_modes 1 -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_SGIX_texture_add_env 1 -#endif - -#ifndef GL_EXT_color_subtable -#define GL_EXT_color_subtable 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_PGI_vertex_hints 1 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PGI_misc_hints 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glHintPGI (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_EXT_paletted_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_EXT_clip_volume_hint 1 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_SGIX_list_priority 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); -GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); -GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); -GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_SGIX_ir_instrument1 1 -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_SGIX_calligraphic_fragment 1 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_SGIX_texture_lod_bias 1 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SGIX_shadow_ambient 1 -#endif - -#ifndef GL_EXT_index_texture -#define GL_EXT_index_texture 1 -#endif - -#ifndef GL_EXT_index_material -#define GL_EXT_index_material 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_EXT_index_func -#define GL_EXT_index_func 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_EXT_index_array_formats 1 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_EXT_compiled_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); -GLAPI void APIENTRY glUnlockArraysEXT (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_EXT_cull_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); -GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_SGIX_ycrcb 1 -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_SGIX_fragment_lighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); -GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); -GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); -GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); -GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_IBM_rasterpos_clip 1 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_HP_texture_lighting 1 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_EXT_draw_range_elements 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -#endif - -#ifndef GL_WIN_phong_shading -#define GL_WIN_phong_shading 1 -#endif - -#ifndef GL_WIN_specular_fog -#define GL_WIN_specular_fog 1 -#endif - -#ifndef GL_EXT_light_texture -#define GL_EXT_light_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glApplyTextureEXT (GLenum); -GLAPI void APIENTRY glTextureLightEXT (GLenum); -GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_SGIX_blend_alpha_minmax 1 -#endif - -#ifndef GL_EXT_bgra -#define GL_EXT_bgra 1 -#endif - -#ifndef GL_SGIX_async -#define GL_SGIX_async 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); -GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); -GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); -GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); -GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); -GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); -typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); -typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); -typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); -typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); -typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_SGIX_async_pixel 1 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_SGIX_async_histogram 1 -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_INTEL_parallel_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); -GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); -GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); -GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -#endif - -#ifndef GL_HP_occlusion_test -#define GL_HP_occlusion_test 1 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_EXT_pixel_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); -GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#define GL_EXT_pixel_transform_color_table 1 -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_EXT_shared_texture_palette 1 -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_EXT_separate_specular_color 1 -#endif - -#ifndef GL_EXT_secondary_color -#define GL_EXT_secondary_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); -GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); -GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); -GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); -GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); -GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); -GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); -GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); -GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); -GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_EXT_texture_perturb_normal 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureNormalEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -#ifndef GL_EXT_fog_coord -#define GL_EXT_fog_coord 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogCoordfEXT (GLfloat); -GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); -GLAPI void APIENTRY glFogCoorddEXT (GLdouble); -GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_REND_screen_coordinates 1 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_EXT_coordinate_frame 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); -GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); -GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); -GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glTangent3ivEXT (const GLint *); -GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glTangent3svEXT (const GLshort *); -GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); -GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); -GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); -GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); -GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); -GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); -typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); -typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); -typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); -typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); -typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); -typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); -typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); -typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); -typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); -typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_EXT_texture_env_combine 1 -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_APPLE_specular_vector 1 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_APPLE_transform_hint 1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_SGIX_fog_scale 1 -#endif - -#ifndef GL_SUNX_constant_data -#define GL_SUNX_constant_data 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFinishTextureSUNX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); -#endif - -#ifndef GL_SUN_global_alpha -#define GL_SUN_global_alpha 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); -GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); -GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); -GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); -GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); -GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); -GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); -GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); -#endif - -#ifndef GL_SUN_triangle_list -#define GL_SUN_triangle_list 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); -GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); -GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); -GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); -GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); -GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); -GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); -#endif - -#ifndef GL_SUN_vertex -#define GL_SUN_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_blend_func_separate -#define GL_INGR_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_color_clamp -#define GL_INGR_color_clamp 1 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INGR_interlace_read 1 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_EXT_stencil_wrap 1 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_EXT_422_pixels 1 -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NV_texgen_reflection 1 -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_SUN_convolution_border_modes 1 -#endif - -#ifndef GL_EXT_texture_env_add -#define GL_EXT_texture_env_add 1 -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_EXT_vertex_weighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); -GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_NV_light_max_exponent 1 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_NV_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); -GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); -#endif - -#ifndef GL_NV_register_combiners -#define GL_NV_register_combiners 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); -GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); -GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); -GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); -GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); -GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); -#endif - -#ifndef GL_NV_fog_distance -#define GL_NV_fog_distance 1 -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_NV_texgen_emboss 1 -#endif - -#ifndef GL_NV_blend_square -#define GL_NV_blend_square 1 -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_NV_texture_env_combine4 1 -#endif - -#ifndef GL_MESA_resize_buffers -#define GL_MESA_resize_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glResizeBuffersMESA (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); -#endif - -#ifndef GL_MESA_window_pos -#define GL_MESA_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); -GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); -GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); -GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_IBM_cull_vertex 1 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#define GL_IBM_multimode_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); -GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_IBM_vertex_array_lists 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); -GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -#endif - -#ifndef GL_SGIX_subsample -#define GL_SGIX_subsample 1 -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_SGIX_ycrcba 1 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#define GL_SGIX_ycrcb_subsample 1 -#endif - -#ifndef GL_SGIX_depth_pass_instrument -#define GL_SGIX_depth_pass_instrument 1 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_3DFX_texture_compression_FXT1 1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_3DFX_multisample 1 -#endif - -#ifndef GL_3DFX_tbuffer -#define GL_3DFX_tbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTbufferMask3DFX (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); -#endif - -#ifndef GL_EXT_multisample -#define GL_EXT_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); -GLAPI void APIENTRY glSamplePatternEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_SGIX_vertex_preclip 1 -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_SGIX_convolution_accuracy 1 -#endif - -#ifndef GL_SGIX_resample -#define GL_SGIX_resample 1 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_SGIS_point_line_texgen 1 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_SGIS_texture_color_mask 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif - -#ifndef GL_SGIX_igloo_interface -#define GL_SGIX_igloo_interface 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_EXT_texture_env_dot3 1 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_ATI_texture_mirror_once 1 -#endif - -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); -GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); -GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glFinishFenceNV (GLuint); -GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -#ifndef GL_NV_evaluators -#define GL_NV_evaluators 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); -GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); -GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); -typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_NV_packed_depth_stencil 1 -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_NV_register_combiners2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_NV_texture_compression_vtc -#define GL_NV_texture_compression_vtc 1 -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_NV_texture_rectangle 1 -#endif - -#ifndef GL_NV_texture_shader -#define GL_NV_texture_shader 1 -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_NV_texture_shader2 1 -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_NV_vertex_array_range2 1 -#endif - -#ifndef GL_NV_vertex_program -#define GL_NV_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); -GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); -GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); -GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); -GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); -GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); -GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); -GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); -GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); -typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); -typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); -typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_SGIX_texture_coordinate_clamp 1 -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SGIX_scalebias_hint 1 -#endif - -#ifndef GL_OML_interlace -#define GL_OML_interlace 1 -#endif - -#ifndef GL_OML_subsample -#define GL_OML_subsample 1 -#endif - -#ifndef GL_OML_resample -#define GL_OML_resample 1 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_NV_copy_depth_to_color 1 -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_ATI_envmap_bumpmap 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); -GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); -GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_ATI_fragment_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); -GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); -GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); -GLAPI void APIENTRY glBeginFragmentShaderATI (void); -GLAPI void APIENTRY glEndFragmentShaderATI (void); -GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); -GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); -GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); -typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); -typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_ATI_pn_triangles 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); -GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_ATI_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); -GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); -GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); -GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); -GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); -typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_EXT_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVertexShaderEXT (void); -GLAPI void APIENTRY glEndVertexShaderEXT (void); -GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); -GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); -GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); -GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); -GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); -GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); -GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); -GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); -GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); -GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); -GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); -GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); -GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); -GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); -GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); -GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); -GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); -GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); -GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); -GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); -GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); -GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); -typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); -typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); -typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); -typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); -typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); -typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); -typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); -typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); -typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); -typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); -typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); -typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); -typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); -typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_ATI_vertex_streams 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); -GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); -GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); -GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); -GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); -GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); -GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); -GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); -GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_element_array -#define GL_ATI_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); -GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); -GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); -#endif - -#ifndef GL_SUN_mesh_array -#define GL_SUN_mesh_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SUN_slice_accum 1 -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_NV_multisample_filter_hint 1 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_NV_depth_clamp 1 -#endif - -#ifndef GL_NV_occlusion_query -#define GL_NV_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); -GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); -GLAPI void APIENTRY glEndOcclusionQueryNV (void); -GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_NV_point_sprite -#define GL_NV_point_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); -GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_NV_texture_shader3 1 -#endif - -#ifndef GL_NV_vertex_program1_1 -#define GL_NV_vertex_program1_1 1 -#endif - -#ifndef GL_EXT_shadow_funcs -#define GL_EXT_shadow_funcs 1 -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_EXT_stencil_two_side 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_ATI_text_fragment_shader 1 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_APPLE_client_storage 1 -#endif - -#ifndef GL_APPLE_element_array -#define GL_APPLE_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); -GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); -GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); -GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#endif - -#ifndef GL_APPLE_fence -#define GL_APPLE_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); -GLAPI void APIENTRY glSetFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); -GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); -GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); -typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); -typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_APPLE_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); -GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_APPLE_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); -GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); -GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_APPLE_ycbcr_422 1 -#endif - -#ifndef GL_S3_s3tc -#define GL_S3_s3tc 1 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_ATI_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_ATI_pixel_format_float 1 -/* This is really a WGL extension, but defines some associated GL enums. - * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. - */ -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_ATI_texture_env_combine3 1 -#endif - -#ifndef GL_ATI_texture_float -#define GL_ATI_texture_float 1 -#endif - -#ifndef GL_NV_float_buffer -#define GL_NV_float_buffer 1 -#endif - -#ifndef GL_NV_fragment_program -#define GL_NV_fragment_program 1 -/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); -GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); -GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#endif - -#ifndef GL_NV_half_float -#define GL_NV_half_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); -GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); -GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); -GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); -GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); -typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); -typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_NV_pixel_data_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); -GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); -#endif - -#ifndef GL_NV_primitive_restart -#define GL_NV_primitive_restart 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPrimitiveRestartNV (void); -GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_NV_texture_expand_normal 1 -#endif - -#ifndef GL_NV_vertex_program2 -#define GL_NV_vertex_program2 1 -#endif - -#ifndef GL_ATI_map_object_buffer -#define GL_ATI_map_object_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); -GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_ATI_separate_stencil 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#define GL_ATI_vertex_attrib_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); -#endif - -#ifndef GL_OES_read_format -#define GL_OES_read_format 1 -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_EXT_depth_bounds_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_EXT_texture_mirror_clamp 1 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_EXT_blend_equation_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); -#endif - -#ifndef GL_MESA_pack_invert -#define GL_MESA_pack_invert 1 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_MESA_ycbcr_texture 1 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_EXT_pixel_buffer_object 1 -#endif - -#ifndef GL_NV_fragment_program_option -#define GL_NV_fragment_program_option 1 -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_NV_fragment_program2 1 -#endif - -#ifndef GL_NV_vertex_program2_option -#define GL_NV_vertex_program2_option 1 -#endif - -#ifndef GL_NV_vertex_program3 -#define GL_NV_vertex_program3 1 -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); -GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); -GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); -GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); -GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); -GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); -GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); -GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); -GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); -GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); -#endif - -#ifndef GL_GREMEDY_string_marker -#define GL_GREMEDY_string_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated 2005/06/20 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GL_GLEXT_VERSION 29 + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; /* native character */ +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for handling shader object handles and program/shader text */ +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ +#endif + +/* GL types for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +GLAPI void APIENTRY glBlendEquation (GLenum); +GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogram (GLenum); +GLAPI void APIENTRY glResetMinmax (GLenum); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glClientActiveTexture (GLenum); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQuery (GLuint); +GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); +GLAPI void APIENTRY glEndQuery (GLenum); +GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint); +GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); +GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); +GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); +GLAPI void APIENTRY glAttachShader (GLuint, GLuint); +GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); +GLAPI void APIENTRY glCompileShader (GLuint); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum); +GLAPI void APIENTRY glDeleteProgram (GLuint); +GLAPI void APIENTRY glDeleteShader (GLuint); +GLAPI void APIENTRY glDetachShader (GLuint, GLuint); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); +GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgram (GLuint); +GLAPI GLboolean APIENTRY glIsShader (GLuint); +GLAPI void APIENTRY glLinkProgram (GLuint); +GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); +GLAPI void APIENTRY glUseProgram (GLuint); +GLAPI void APIENTRY glUniform1f (GLint, GLfloat); +GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1i (GLint, GLint); +GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glValidateProgram (GLuint); +GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); +GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); +GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); +GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); +GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); +GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexBlendARB (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); +GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); +GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); +GLAPI void APIENTRY glEndQueryARB (GLenum); +GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); +GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); +GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1iARB (GLint, GLint); +GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogramEXT (GLenum); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint); +GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glDeformSGIX (GLbitfield); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum); +GLAPI void APIENTRY glTextureLightEXT (GLenum); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); +GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); +GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); +GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *); +GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); +GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); +GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); +GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); +GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFinishFenceNV (GLuint); +GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); +GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); +GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); +GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); +GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); +GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); +GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); +GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); +GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/GLew/glprocs.h b/Externals/GLew/glprocs.h index 999fd42af1..c402d95047 100644 --- a/Externals/GLew/glprocs.h +++ b/Externals/GLew/glprocs.h @@ -1,2213 +1,2213 @@ -#ifndef _GLPROCS_H_ -#define _GLPROCS_H_ - -/* -** GLprocs utility for getting function addresses for OpenGL(R) 1.2, -** OpenGL 1.3, OpenGL 1.4, OpenGL 1.5 and OpenGL extension functions. -** -** Version: 1.1 -** -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: This software was created using the -** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has -** not been independently verified as being compliant with the OpenGL(R) -** version 1.2.1 Specification. -** -** Initial version of glprocs.{c,h} contributed by Intel(R) Corporation. -*/ - -#ifdef _WIN32 - #include "glext.h" - #include "wglext.h" -#else - #include -#endif - -#ifndef _WIN32 /* non-Windows environment */ - #ifndef APIENTRY - #define APIENTRY - #endif - #ifdef __GNUC__ - #define _inline __inline__ - #else - #define _inline - #endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Structure of all OpenGL {1.2, 1.3, 1.4, 1.5}, GL extension procs.*/ - -typedef struct { - void (APIENTRY *BlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY *BlendEquation) (GLenum mode); - void (APIENTRY *DrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); - void (APIENTRY *ColorTable) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); - void (APIENTRY *ColorTableParameterfv) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *ColorTableParameteriv) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *CopyColorTable) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - void (APIENTRY *GetColorTable) (GLenum target, GLenum format, GLenum type, GLvoid *table); - void (APIENTRY *GetColorTableParameterfv) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetColorTableParameteriv) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *ColorSubTable) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); - void (APIENTRY *CopyColorSubTable) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); - void (APIENTRY *ConvolutionFilter1D) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); - void (APIENTRY *ConvolutionFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); - void (APIENTRY *ConvolutionParameterf) (GLenum target, GLenum pname, GLfloat params); - void (APIENTRY *ConvolutionParameterfv) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *ConvolutionParameteri) (GLenum target, GLenum pname, GLint params); - void (APIENTRY *ConvolutionParameteriv) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *CopyConvolutionFilter1D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - void (APIENTRY *CopyConvolutionFilter2D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY *GetConvolutionFilter) (GLenum target, GLenum format, GLenum type, GLvoid *image); - void (APIENTRY *GetConvolutionParameterfv) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetConvolutionParameteriv) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetSeparableFilter) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); - void (APIENTRY *SeparableFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); - void (APIENTRY *GetHistogram) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); - void (APIENTRY *GetHistogramParameterfv) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetHistogramParameteriv) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetMinmax) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); - void (APIENTRY *GetMinmaxParameterfv) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetMinmaxParameteriv) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *Histogram) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); - void (APIENTRY *Minmax) (GLenum target, GLenum internalformat, GLboolean sink); - void (APIENTRY *ResetHistogram) (GLenum target); - void (APIENTRY *ResetMinmax) (GLenum target); - void (APIENTRY *TexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *TexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *CopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY *ActiveTexture) (GLenum texture); - void (APIENTRY *ClientActiveTexture) (GLenum texture); - void (APIENTRY *MultiTexCoord1d) (GLenum target, GLdouble s); - void (APIENTRY *MultiTexCoord1dv) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord1f) (GLenum target, GLfloat s); - void (APIENTRY *MultiTexCoord1fv) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord1i) (GLenum target, GLint s); - void (APIENTRY *MultiTexCoord1iv) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord1s) (GLenum target, GLshort s); - void (APIENTRY *MultiTexCoord1sv) (GLenum target, const GLshort *v); - void (APIENTRY *MultiTexCoord2d) (GLenum target, GLdouble s, GLdouble t); - void (APIENTRY *MultiTexCoord2dv) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord2f) (GLenum target, GLfloat s, GLfloat t); - void (APIENTRY *MultiTexCoord2fv) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord2i) (GLenum target, GLint s, GLint t); - void (APIENTRY *MultiTexCoord2iv) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord2s) (GLenum target, GLshort s, GLshort t); - void (APIENTRY *MultiTexCoord2sv) (GLenum target, const GLshort *v); - void (APIENTRY *MultiTexCoord3d) (GLenum target, GLdouble s, GLdouble t, GLdouble r); - void (APIENTRY *MultiTexCoord3dv) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord3f) (GLenum target, GLfloat s, GLfloat t, GLfloat r); - void (APIENTRY *MultiTexCoord3fv) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord3i) (GLenum target, GLint s, GLint t, GLint r); - void (APIENTRY *MultiTexCoord3iv) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord3s) (GLenum target, GLshort s, GLshort t, GLshort r); - void (APIENTRY *MultiTexCoord3sv) (GLenum target, const GLshort *v); - void (APIENTRY *MultiTexCoord4d) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); - void (APIENTRY *MultiTexCoord4dv) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord4f) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); - void (APIENTRY *MultiTexCoord4fv) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord4i) (GLenum target, GLint s, GLint t, GLint r, GLint q); - void (APIENTRY *MultiTexCoord4iv) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord4s) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); - void (APIENTRY *MultiTexCoord4sv) (GLenum target, const GLshort *v); - void (APIENTRY *LoadTransposeMatrixf) (const GLfloat *m); - void (APIENTRY *LoadTransposeMatrixd) (const GLdouble *m); - void (APIENTRY *MultTransposeMatrixf) (const GLfloat *m); - void (APIENTRY *MultTransposeMatrixd) (const GLdouble *m); - void (APIENTRY *SampleCoverage) (GLclampf value, GLboolean invert); - void (APIENTRY *CompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexImage1D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexSubImage1D) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *GetCompressedTexImage) (GLenum target, GLint level, GLvoid *img); - void (APIENTRY *BlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); - void (APIENTRY *FogCoordf) (GLfloat coord); - void (APIENTRY *FogCoordfv) (const GLfloat *coord); - void (APIENTRY *FogCoordd) (GLdouble coord); - void (APIENTRY *FogCoorddv) (const GLdouble *coord); - void (APIENTRY *FogCoordPointer) (GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *MultiDrawArrays) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); - void (APIENTRY *MultiDrawElements) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); - void (APIENTRY *PointParameterf) (GLenum pname, GLfloat param); - void (APIENTRY *PointParameterfv) (GLenum pname, const GLfloat *params); - void (APIENTRY *PointParameteri) (GLenum pname, GLint param); - void (APIENTRY *PointParameteriv) (GLenum pname, const GLint *params); - void (APIENTRY *SecondaryColor3b) (GLbyte red, GLbyte green, GLbyte blue); - void (APIENTRY *SecondaryColor3bv) (const GLbyte *v); - void (APIENTRY *SecondaryColor3d) (GLdouble red, GLdouble green, GLdouble blue); - void (APIENTRY *SecondaryColor3dv) (const GLdouble *v); - void (APIENTRY *SecondaryColor3f) (GLfloat red, GLfloat green, GLfloat blue); - void (APIENTRY *SecondaryColor3fv) (const GLfloat *v); - void (APIENTRY *SecondaryColor3i) (GLint red, GLint green, GLint blue); - void (APIENTRY *SecondaryColor3iv) (const GLint *v); - void (APIENTRY *SecondaryColor3s) (GLshort red, GLshort green, GLshort blue); - void (APIENTRY *SecondaryColor3sv) (const GLshort *v); - void (APIENTRY *SecondaryColor3ub) (GLubyte red, GLubyte green, GLubyte blue); - void (APIENTRY *SecondaryColor3ubv) (const GLubyte *v); - void (APIENTRY *SecondaryColor3ui) (GLuint red, GLuint green, GLuint blue); - void (APIENTRY *SecondaryColor3uiv) (const GLuint *v); - void (APIENTRY *SecondaryColor3us) (GLushort red, GLushort green, GLushort blue); - void (APIENTRY *SecondaryColor3usv) (const GLushort *v); - void (APIENTRY *SecondaryColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *WindowPos2d) (GLdouble x, GLdouble y); - void (APIENTRY *WindowPos2dv) (const GLdouble *v); - void (APIENTRY *WindowPos2f) (GLfloat x, GLfloat y); - void (APIENTRY *WindowPos2fv) (const GLfloat *v); - void (APIENTRY *WindowPos2i) (GLint x, GLint y); - void (APIENTRY *WindowPos2iv) (const GLint *v); - void (APIENTRY *WindowPos2s) (GLshort x, GLshort y); - void (APIENTRY *WindowPos2sv) (const GLshort *v); - void (APIENTRY *WindowPos3d) (GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY *WindowPos3dv) (const GLdouble *v); - void (APIENTRY *WindowPos3f) (GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *WindowPos3fv) (const GLfloat *v); - void (APIENTRY *WindowPos3i) (GLint x, GLint y, GLint z); - void (APIENTRY *WindowPos3iv) (const GLint *v); - void (APIENTRY *WindowPos3s) (GLshort x, GLshort y, GLshort z); - void (APIENTRY *WindowPos3sv) (const GLshort *v); - void (APIENTRY *GenQueries) (GLsizei n, GLuint *ids); - void (APIENTRY *DeleteQueries) (GLsizei n, const GLuint *ids); - GLboolean (APIENTRY *IsQuery) (GLuint id); - void (APIENTRY *BeginQuery) (GLenum target, GLuint id); - void (APIENTRY *EndQuery) (GLenum target); - void (APIENTRY *GetQueryiv) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetQueryObjectiv) (GLuint id, GLenum pname, GLint *params); - void (APIENTRY *GetQueryObjectuiv) (GLuint id, GLenum pname, GLuint *params); - void (APIENTRY *BindBuffer) (GLenum target, GLuint buffer); - void (APIENTRY *DeleteBuffers) (GLsizei n, const GLuint *buffers); - void (APIENTRY *GenBuffers) (GLsizei n, GLuint *buffers); - GLboolean (APIENTRY *IsBuffer) (GLuint buffer); - void (APIENTRY *BufferData) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); - void (APIENTRY *BufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); - void (APIENTRY *GetBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); - GLvoid* (APIENTRY *MapBuffer) (GLenum target, GLenum access); - GLboolean (APIENTRY *UnmapBuffer) (GLenum target); - void (APIENTRY *GetBufferParameteriv) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetBufferPointerv) (GLenum target, GLenum pname, GLvoid* *params); - void (APIENTRY *ActiveTextureARB) (GLenum texture); - void (APIENTRY *ClientActiveTextureARB) (GLenum texture); - void (APIENTRY *MultiTexCoord1dARB) (GLenum target, GLdouble s); - void (APIENTRY *MultiTexCoord1dvARB) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord1fARB) (GLenum target, GLfloat s); - void (APIENTRY *MultiTexCoord1fvARB) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord1iARB) (GLenum target, GLint s); - void (APIENTRY *MultiTexCoord1ivARB) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord1sARB) (GLenum target, GLshort s); - void (APIENTRY *MultiTexCoord1svARB) (GLenum target, const GLshort *v); - void (APIENTRY *MultiTexCoord2dARB) (GLenum target, GLdouble s, GLdouble t); - void (APIENTRY *MultiTexCoord2dvARB) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t); - void (APIENTRY *MultiTexCoord2fvARB) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord2iARB) (GLenum target, GLint s, GLint t); - void (APIENTRY *MultiTexCoord2ivARB) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord2sARB) (GLenum target, GLshort s, GLshort t); - void (APIENTRY *MultiTexCoord2svARB) (GLenum target, const GLshort *v); - void (APIENTRY *MultiTexCoord3dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r); - void (APIENTRY *MultiTexCoord3dvARB) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord3fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r); - void (APIENTRY *MultiTexCoord3fvARB) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord3iARB) (GLenum target, GLint s, GLint t, GLint r); - void (APIENTRY *MultiTexCoord3ivARB) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord3sARB) (GLenum target, GLshort s, GLshort t, GLshort r); - void (APIENTRY *MultiTexCoord3svARB) (GLenum target, const GLshort *v); - void (APIENTRY *MultiTexCoord4dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); - void (APIENTRY *MultiTexCoord4dvARB) (GLenum target, const GLdouble *v); - void (APIENTRY *MultiTexCoord4fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); - void (APIENTRY *MultiTexCoord4fvARB) (GLenum target, const GLfloat *v); - void (APIENTRY *MultiTexCoord4iARB) (GLenum target, GLint s, GLint t, GLint r, GLint q); - void (APIENTRY *MultiTexCoord4ivARB) (GLenum target, const GLint *v); - void (APIENTRY *MultiTexCoord4sARB) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); - void (APIENTRY *MultiTexCoord4svARB) (GLenum target, const GLshort *v); - void (APIENTRY *LoadTransposeMatrixfARB) (const GLfloat *m); - void (APIENTRY *LoadTransposeMatrixdARB) (const GLdouble *m); - void (APIENTRY *MultTransposeMatrixfARB) (const GLfloat *m); - void (APIENTRY *MultTransposeMatrixdARB) (const GLdouble *m); - void (APIENTRY *SampleCoverageARB) (GLclampf value, GLboolean invert); - void (APIENTRY *CompressedTexImage3DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexImage2DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexImage1DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexSubImage3DARB) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexSubImage2DARB) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *CompressedTexSubImage1DARB) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); - void (APIENTRY *GetCompressedTexImageARB) (GLenum target, GLint level, GLvoid *img); - void (APIENTRY *PointParameterfARB) (GLenum pname, GLfloat param); - void (APIENTRY *PointParameterfvARB) (GLenum pname, const GLfloat *params); - void (APIENTRY *WeightbvARB) (GLint size, const GLbyte *weights); - void (APIENTRY *WeightsvARB) (GLint size, const GLshort *weights); - void (APIENTRY *WeightivARB) (GLint size, const GLint *weights); - void (APIENTRY *WeightfvARB) (GLint size, const GLfloat *weights); - void (APIENTRY *WeightdvARB) (GLint size, const GLdouble *weights); - void (APIENTRY *WeightubvARB) (GLint size, const GLubyte *weights); - void (APIENTRY *WeightusvARB) (GLint size, const GLushort *weights); - void (APIENTRY *WeightuivARB) (GLint size, const GLuint *weights); - void (APIENTRY *WeightPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *VertexBlendARB) (GLint count); - void (APIENTRY *CurrentPaletteMatrixARB) (GLint index); - void (APIENTRY *MatrixIndexubvARB) (GLint size, const GLubyte *indices); - void (APIENTRY *MatrixIndexusvARB) (GLint size, const GLushort *indices); - void (APIENTRY *MatrixIndexuivARB) (GLint size, const GLuint *indices); - void (APIENTRY *MatrixIndexPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *WindowPos2dARB) (GLdouble x, GLdouble y); - void (APIENTRY *WindowPos2dvARB) (const GLdouble *v); - void (APIENTRY *WindowPos2fARB) (GLfloat x, GLfloat y); - void (APIENTRY *WindowPos2fvARB) (const GLfloat *v); - void (APIENTRY *WindowPos2iARB) (GLint x, GLint y); - void (APIENTRY *WindowPos2ivARB) (const GLint *v); - void (APIENTRY *WindowPos2sARB) (GLshort x, GLshort y); - void (APIENTRY *WindowPos2svARB) (const GLshort *v); - void (APIENTRY *WindowPos3dARB) (GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY *WindowPos3dvARB) (const GLdouble *v); - void (APIENTRY *WindowPos3fARB) (GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *WindowPos3fvARB) (const GLfloat *v); - void (APIENTRY *WindowPos3iARB) (GLint x, GLint y, GLint z); - void (APIENTRY *WindowPos3ivARB) (const GLint *v); - void (APIENTRY *WindowPos3sARB) (GLshort x, GLshort y, GLshort z); - void (APIENTRY *WindowPos3svARB) (const GLshort *v); - void (APIENTRY *VertexAttrib1dARB) (GLuint index, GLdouble x); - void (APIENTRY *VertexAttrib1dvARB) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib1fARB) (GLuint index, GLfloat x); - void (APIENTRY *VertexAttrib1fvARB) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib1sARB) (GLuint index, GLshort x); - void (APIENTRY *VertexAttrib1svARB) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib2dARB) (GLuint index, GLdouble x, GLdouble y); - void (APIENTRY *VertexAttrib2dvARB) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib2fARB) (GLuint index, GLfloat x, GLfloat y); - void (APIENTRY *VertexAttrib2fvARB) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib2sARB) (GLuint index, GLshort x, GLshort y); - void (APIENTRY *VertexAttrib2svARB) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib3dARB) (GLuint index, GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY *VertexAttrib3dvARB) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib3fARB) (GLuint index, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *VertexAttrib3fvARB) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib3sARB) (GLuint index, GLshort x, GLshort y, GLshort z); - void (APIENTRY *VertexAttrib3svARB) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib4NbvARB) (GLuint index, const GLbyte *v); - void (APIENTRY *VertexAttrib4NivARB) (GLuint index, const GLint *v); - void (APIENTRY *VertexAttrib4NsvARB) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib4NubARB) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); - void (APIENTRY *VertexAttrib4NubvARB) (GLuint index, const GLubyte *v); - void (APIENTRY *VertexAttrib4NuivARB) (GLuint index, const GLuint *v); - void (APIENTRY *VertexAttrib4NusvARB) (GLuint index, const GLushort *v); - void (APIENTRY *VertexAttrib4bvARB) (GLuint index, const GLbyte *v); - void (APIENTRY *VertexAttrib4dARB) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *VertexAttrib4dvARB) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib4fARB) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *VertexAttrib4fvARB) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib4ivARB) (GLuint index, const GLint *v); - void (APIENTRY *VertexAttrib4sARB) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); - void (APIENTRY *VertexAttrib4svARB) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib4ubvARB) (GLuint index, const GLubyte *v); - void (APIENTRY *VertexAttrib4uivARB) (GLuint index, const GLuint *v); - void (APIENTRY *VertexAttrib4usvARB) (GLuint index, const GLushort *v); - void (APIENTRY *VertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *EnableVertexAttribArrayARB) (GLuint index); - void (APIENTRY *DisableVertexAttribArrayARB) (GLuint index); - void (APIENTRY *ProgramStringARB) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); - void (APIENTRY *BindProgramARB) (GLenum target, GLuint program); - void (APIENTRY *DeleteProgramsARB) (GLsizei n, const GLuint *programs); - void (APIENTRY *GenProgramsARB) (GLsizei n, GLuint *programs); - void (APIENTRY *ProgramEnvParameter4dARB) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *ProgramEnvParameter4dvARB) (GLenum target, GLuint index, const GLdouble *params); - void (APIENTRY *ProgramEnvParameter4fARB) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *ProgramEnvParameter4fvARB) (GLenum target, GLuint index, const GLfloat *params); - void (APIENTRY *ProgramLocalParameter4dARB) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *ProgramLocalParameter4dvARB) (GLenum target, GLuint index, const GLdouble *params); - void (APIENTRY *ProgramLocalParameter4fARB) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *ProgramLocalParameter4fvARB) (GLenum target, GLuint index, const GLfloat *params); - void (APIENTRY *GetProgramEnvParameterdvARB) (GLenum target, GLuint index, GLdouble *params); - void (APIENTRY *GetProgramEnvParameterfvARB) (GLenum target, GLuint index, GLfloat *params); - void (APIENTRY *GetProgramLocalParameterdvARB) (GLenum target, GLuint index, GLdouble *params); - void (APIENTRY *GetProgramLocalParameterfvARB) (GLenum target, GLuint index, GLfloat *params); - void (APIENTRY *GetProgramivARB) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetProgramStringARB) (GLenum target, GLenum pname, GLvoid *string); - void (APIENTRY *GetVertexAttribdvARB) (GLuint index, GLenum pname, GLdouble *params); - void (APIENTRY *GetVertexAttribfvARB) (GLuint index, GLenum pname, GLfloat *params); - void (APIENTRY *GetVertexAttribivARB) (GLuint index, GLenum pname, GLint *params); - void (APIENTRY *GetVertexAttribPointervARB) (GLuint index, GLenum pname, GLvoid* *pointer); - GLboolean (APIENTRY *IsProgramARB) (GLuint program); - void (APIENTRY *BindBufferARB) (GLenum target, GLuint buffer); - void (APIENTRY *DeleteBuffersARB) (GLsizei n, const GLuint *buffers); - void (APIENTRY *GenBuffersARB) (GLsizei n, GLuint *buffers); - GLboolean (APIENTRY *IsBufferARB) (GLuint buffer); - void (APIENTRY *BufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); - void (APIENTRY *BufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); - void (APIENTRY *GetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); - GLvoid* (APIENTRY *MapBufferARB) (GLenum target, GLenum access); - GLboolean (APIENTRY *UnmapBufferARB) (GLenum target); - void (APIENTRY *GetBufferParameterivARB) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetBufferPointervARB) (GLenum target, GLenum pname, GLvoid* *params); - void (APIENTRY *GenQueriesARB) (GLsizei n, GLuint *ids); - void (APIENTRY *DeleteQueriesARB) (GLsizei n, const GLuint *ids); - GLboolean (APIENTRY *IsQueryARB) (GLuint id); - void (APIENTRY *BeginQueryARB) (GLenum target, GLuint id); - void (APIENTRY *EndQueryARB) (GLenum target); - void (APIENTRY *GetQueryivARB) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetQueryObjectivARB) (GLuint id, GLenum pname, GLint *params); - void (APIENTRY *GetQueryObjectuivARB) (GLuint id, GLenum pname, GLuint *params); - void (APIENTRY *DeleteObjectARB) (GLhandleARB obj); - GLhandleARB (APIENTRY *GetHandleARB) (GLenum pname); - void (APIENTRY *DetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj); - GLhandleARB (APIENTRY *CreateShaderObjectARB) (GLenum shaderType); - void (APIENTRY *ShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); - void (APIENTRY *CompileShaderARB) (GLhandleARB shaderObj); - GLhandleARB (APIENTRY *CreateProgramObjectARB) (void); - void (APIENTRY *AttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj); - void (APIENTRY *LinkProgramARB) (GLhandleARB programObj); - void (APIENTRY *UseProgramObjectARB) (GLhandleARB programObj); - void (APIENTRY *ValidateProgramARB) (GLhandleARB programObj); - void (APIENTRY *Uniform1fARB) (GLint location, GLfloat v0); - void (APIENTRY *Uniform2fARB) (GLint location, GLfloat v0, GLfloat v1); - void (APIENTRY *Uniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); - void (APIENTRY *Uniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); - void (APIENTRY *Uniform1iARB) (GLint location, GLint v0); - void (APIENTRY *Uniform2iARB) (GLint location, GLint v0, GLint v1); - void (APIENTRY *Uniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2); - void (APIENTRY *Uniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); - void (APIENTRY *Uniform1fvARB) (GLint location, GLsizei count, const GLfloat *value); - void (APIENTRY *Uniform2fvARB) (GLint location, GLsizei count, const GLfloat *value); - void (APIENTRY *Uniform3fvARB) (GLint location, GLsizei count, const GLfloat *value); - void (APIENTRY *Uniform4fvARB) (GLint location, GLsizei count, const GLfloat *value); - void (APIENTRY *Uniform1ivARB) (GLint location, GLsizei count, const GLint *value); - void (APIENTRY *Uniform2ivARB) (GLint location, GLsizei count, const GLint *value); - void (APIENTRY *Uniform3ivARB) (GLint location, GLsizei count, const GLint *value); - void (APIENTRY *Uniform4ivARB) (GLint location, GLsizei count, const GLint *value); - void (APIENTRY *UniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - void (APIENTRY *UniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - void (APIENTRY *UniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - void (APIENTRY *GetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat *params); - void (APIENTRY *GetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint *params); - void (APIENTRY *GetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); - void (APIENTRY *GetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); - GLint (APIENTRY *GetUniformLocationARB) (GLhandleARB programObj, const GLcharARB *name); - void (APIENTRY *GetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); - void (APIENTRY *GetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat *params); - void (APIENTRY *GetUniformivARB) (GLhandleARB programObj, GLint location, GLint *params); - void (APIENTRY *GetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); - void (APIENTRY *BindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB *name); - void (APIENTRY *GetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); - GLint (APIENTRY *GetAttribLocationARB) (GLhandleARB programObj, const GLcharARB *name); - void (APIENTRY *BlendColorEXT) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY *PolygonOffsetEXT) (GLfloat factor, GLfloat bias); - void (APIENTRY *TexImage3DEXT) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *TexSubImage3DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *GetTexFilterFuncSGIS) (GLenum target, GLenum filter, GLfloat *weights); - void (APIENTRY *TexFilterFuncSGIS) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); - void (APIENTRY *TexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *TexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *CopyTexImage1DEXT) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); - void (APIENTRY *CopyTexImage2DEXT) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - void (APIENTRY *CopyTexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); - void (APIENTRY *CopyTexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY *CopyTexSubImage3DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY *GetHistogramEXT) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); - void (APIENTRY *GetHistogramParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetHistogramParameterivEXT) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetMinmaxEXT) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); - void (APIENTRY *GetMinmaxParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetMinmaxParameterivEXT) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *HistogramEXT) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); - void (APIENTRY *MinmaxEXT) (GLenum target, GLenum internalformat, GLboolean sink); - void (APIENTRY *ResetHistogramEXT) (GLenum target); - void (APIENTRY *ResetMinmaxEXT) (GLenum target); - void (APIENTRY *ConvolutionFilter1DEXT) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); - void (APIENTRY *ConvolutionFilter2DEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); - void (APIENTRY *ConvolutionParameterfEXT) (GLenum target, GLenum pname, GLfloat params); - void (APIENTRY *ConvolutionParameterfvEXT) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *ConvolutionParameteriEXT) (GLenum target, GLenum pname, GLint params); - void (APIENTRY *ConvolutionParameterivEXT) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *CopyConvolutionFilter1DEXT) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - void (APIENTRY *CopyConvolutionFilter2DEXT) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY *GetConvolutionFilterEXT) (GLenum target, GLenum format, GLenum type, GLvoid *image); - void (APIENTRY *GetConvolutionParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetConvolutionParameterivEXT) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetSeparableFilterEXT) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); - void (APIENTRY *SeparableFilter2DEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); - void (APIENTRY *ColorTableSGI) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); - void (APIENTRY *ColorTableParameterfvSGI) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *ColorTableParameterivSGI) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *CopyColorTableSGI) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - void (APIENTRY *GetColorTableSGI) (GLenum target, GLenum format, GLenum type, GLvoid *table); - void (APIENTRY *GetColorTableParameterfvSGI) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetColorTableParameterivSGI) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *PixelTexGenSGIX) (GLenum mode); - void (APIENTRY *PixelTexGenParameteriSGIS) (GLenum pname, GLint param); - void (APIENTRY *PixelTexGenParameterivSGIS) (GLenum pname, const GLint *params); - void (APIENTRY *PixelTexGenParameterfSGIS) (GLenum pname, GLfloat param); - void (APIENTRY *PixelTexGenParameterfvSGIS) (GLenum pname, const GLfloat *params); - void (APIENTRY *GetPixelTexGenParameterivSGIS) (GLenum pname, GLint *params); - void (APIENTRY *GetPixelTexGenParameterfvSGIS) (GLenum pname, GLfloat *params); - void (APIENTRY *TexImage4DSGIS) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY *TexSubImage4DSGIS) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); - GLboolean (APIENTRY *AreTexturesResidentEXT) (GLsizei n, const GLuint *textures, GLboolean *residences); - void (APIENTRY *BindTextureEXT) (GLenum target, GLuint texture); - void (APIENTRY *DeleteTexturesEXT) (GLsizei n, const GLuint *textures); - void (APIENTRY *GenTexturesEXT) (GLsizei n, GLuint *textures); - GLboolean (APIENTRY *IsTextureEXT) (GLuint texture); - void (APIENTRY *PrioritizeTexturesEXT) (GLsizei n, const GLuint *textures, const GLclampf *priorities); - void (APIENTRY *DetailTexFuncSGIS) (GLenum target, GLsizei n, const GLfloat *points); - void (APIENTRY *GetDetailTexFuncSGIS) (GLenum target, GLfloat *points); - void (APIENTRY *SharpenTexFuncSGIS) (GLenum target, GLsizei n, const GLfloat *points); - void (APIENTRY *GetSharpenTexFuncSGIS) (GLenum target, GLfloat *points); - void (APIENTRY *SampleMaskSGIS) (GLclampf value, GLboolean invert); - void (APIENTRY *SamplePatternSGIS) (GLenum pattern); - void (APIENTRY *ArrayElementEXT) (GLint i); - void (APIENTRY *ColorPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); - void (APIENTRY *DrawArraysEXT) (GLenum mode, GLint first, GLsizei count); - void (APIENTRY *EdgeFlagPointerEXT) (GLsizei stride, GLsizei count, const GLboolean *pointer); - void (APIENTRY *GetPointervEXT) (GLenum pname, GLvoid* *params); - void (APIENTRY *IndexPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); - void (APIENTRY *NormalPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); - void (APIENTRY *TexCoordPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); - void (APIENTRY *VertexPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); - void (APIENTRY *BlendEquationEXT) (GLenum mode); - void (APIENTRY *SpriteParameterfSGIX) (GLenum pname, GLfloat param); - void (APIENTRY *SpriteParameterfvSGIX) (GLenum pname, const GLfloat *params); - void (APIENTRY *SpriteParameteriSGIX) (GLenum pname, GLint param); - void (APIENTRY *SpriteParameterivSGIX) (GLenum pname, const GLint *params); - void (APIENTRY *PointParameterfEXT) (GLenum pname, GLfloat param); - void (APIENTRY *PointParameterfvEXT) (GLenum pname, const GLfloat *params); - void (APIENTRY *PointParameterfSGIS) (GLenum pname, GLfloat param); - void (APIENTRY *PointParameterfvSGIS) (GLenum pname, const GLfloat *params); - GLint (APIENTRY *GetInstrumentsSGIX) (void); - void (APIENTRY *InstrumentsBufferSGIX) (GLsizei size, GLint *buffer); - GLint (APIENTRY *PollInstrumentsSGIX) (GLint *marker_p); - void (APIENTRY *ReadInstrumentsSGIX) (GLint marker); - void (APIENTRY *StartInstrumentsSGIX) (void); - void (APIENTRY *StopInstrumentsSGIX) (GLint marker); - void (APIENTRY *FrameZoomSGIX) (GLint factor); - void (APIENTRY *TagSampleBufferSGIX) (void); - void (APIENTRY *DeformationMap3dSGIX) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); - void (APIENTRY *DeformationMap3fSGIX) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); - void (APIENTRY *DeformSGIX) (GLbitfield mask); - void (APIENTRY *LoadIdentityDeformationMapSGIX) (GLbitfield mask); - void (APIENTRY *ReferencePlaneSGIX) (const GLdouble *equation); - void (APIENTRY *FlushRasterSGIX) (void); - void (APIENTRY *FogFuncSGIS) (GLsizei n, const GLfloat *points); - void (APIENTRY *GetFogFuncSGIS) (GLfloat *points); - void (APIENTRY *ImageTransformParameteriHP) (GLenum target, GLenum pname, GLint param); - void (APIENTRY *ImageTransformParameterfHP) (GLenum target, GLenum pname, GLfloat param); - void (APIENTRY *ImageTransformParameterivHP) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *ImageTransformParameterfvHP) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *GetImageTransformParameterivHP) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetImageTransformParameterfvHP) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *ColorSubTableEXT) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); - void (APIENTRY *CopyColorSubTableEXT) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); - void (APIENTRY *HintPGI) (GLenum target, GLint mode); - void (APIENTRY *ColorTableEXT) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); - void (APIENTRY *GetColorTableEXT) (GLenum target, GLenum format, GLenum type, GLvoid *data); - void (APIENTRY *GetColorTableParameterivEXT) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetColorTableParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetListParameterfvSGIX) (GLuint list, GLenum pname, GLfloat *params); - void (APIENTRY *GetListParameterivSGIX) (GLuint list, GLenum pname, GLint *params); - void (APIENTRY *ListParameterfSGIX) (GLuint list, GLenum pname, GLfloat param); - void (APIENTRY *ListParameterfvSGIX) (GLuint list, GLenum pname, const GLfloat *params); - void (APIENTRY *ListParameteriSGIX) (GLuint list, GLenum pname, GLint param); - void (APIENTRY *ListParameterivSGIX) (GLuint list, GLenum pname, const GLint *params); - void (APIENTRY *IndexMaterialEXT) (GLenum face, GLenum mode); - void (APIENTRY *IndexFuncEXT) (GLenum func, GLclampf ref); - void (APIENTRY *LockArraysEXT) (GLint first, GLsizei count); - void (APIENTRY *UnlockArraysEXT) (void); - void (APIENTRY *CullParameterdvEXT) (GLenum pname, GLdouble *params); - void (APIENTRY *CullParameterfvEXT) (GLenum pname, GLfloat *params); - void (APIENTRY *FragmentColorMaterialSGIX) (GLenum face, GLenum mode); - void (APIENTRY *FragmentLightfSGIX) (GLenum light, GLenum pname, GLfloat param); - void (APIENTRY *FragmentLightfvSGIX) (GLenum light, GLenum pname, const GLfloat *params); - void (APIENTRY *FragmentLightiSGIX) (GLenum light, GLenum pname, GLint param); - void (APIENTRY *FragmentLightivSGIX) (GLenum light, GLenum pname, const GLint *params); - void (APIENTRY *FragmentLightModelfSGIX) (GLenum pname, GLfloat param); - void (APIENTRY *FragmentLightModelfvSGIX) (GLenum pname, const GLfloat *params); - void (APIENTRY *FragmentLightModeliSGIX) (GLenum pname, GLint param); - void (APIENTRY *FragmentLightModelivSGIX) (GLenum pname, const GLint *params); - void (APIENTRY *FragmentMaterialfSGIX) (GLenum face, GLenum pname, GLfloat param); - void (APIENTRY *FragmentMaterialfvSGIX) (GLenum face, GLenum pname, const GLfloat *params); - void (APIENTRY *FragmentMaterialiSGIX) (GLenum face, GLenum pname, GLint param); - void (APIENTRY *FragmentMaterialivSGIX) (GLenum face, GLenum pname, const GLint *params); - void (APIENTRY *GetFragmentLightfvSGIX) (GLenum light, GLenum pname, GLfloat *params); - void (APIENTRY *GetFragmentLightivSGIX) (GLenum light, GLenum pname, GLint *params); - void (APIENTRY *GetFragmentMaterialfvSGIX) (GLenum face, GLenum pname, GLfloat *params); - void (APIENTRY *GetFragmentMaterialivSGIX) (GLenum face, GLenum pname, GLint *params); - void (APIENTRY *LightEnviSGIX) (GLenum pname, GLint param); - void (APIENTRY *DrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); - void (APIENTRY *ApplyTextureEXT) (GLenum mode); - void (APIENTRY *TextureLightEXT) (GLenum pname); - void (APIENTRY *TextureMaterialEXT) (GLenum face, GLenum mode); - void (APIENTRY *AsyncMarkerSGIX) (GLuint marker); - GLint (APIENTRY *FinishAsyncSGIX) (GLuint *markerp); - GLint (APIENTRY *PollAsyncSGIX) (GLuint *markerp); - GLuint (APIENTRY *GenAsyncMarkersSGIX) (GLsizei range); - void (APIENTRY *DeleteAsyncMarkersSGIX) (GLuint marker, GLsizei range); - GLboolean (APIENTRY *IsAsyncMarkerSGIX) (GLuint marker); - void (APIENTRY *VertexPointervINTEL) (GLint size, GLenum type, const GLvoid* *pointer); - void (APIENTRY *NormalPointervINTEL) (GLenum type, const GLvoid* *pointer); - void (APIENTRY *ColorPointervINTEL) (GLint size, GLenum type, const GLvoid* *pointer); - void (APIENTRY *TexCoordPointervINTEL) (GLint size, GLenum type, const GLvoid* *pointer); - void (APIENTRY *PixelTransformParameteriEXT) (GLenum target, GLenum pname, GLint param); - void (APIENTRY *PixelTransformParameterfEXT) (GLenum target, GLenum pname, GLfloat param); - void (APIENTRY *PixelTransformParameterivEXT) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *PixelTransformParameterfvEXT) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *SecondaryColor3bEXT) (GLbyte red, GLbyte green, GLbyte blue); - void (APIENTRY *SecondaryColor3bvEXT) (const GLbyte *v); - void (APIENTRY *SecondaryColor3dEXT) (GLdouble red, GLdouble green, GLdouble blue); - void (APIENTRY *SecondaryColor3dvEXT) (const GLdouble *v); - void (APIENTRY *SecondaryColor3fEXT) (GLfloat red, GLfloat green, GLfloat blue); - void (APIENTRY *SecondaryColor3fvEXT) (const GLfloat *v); - void (APIENTRY *SecondaryColor3iEXT) (GLint red, GLint green, GLint blue); - void (APIENTRY *SecondaryColor3ivEXT) (const GLint *v); - void (APIENTRY *SecondaryColor3sEXT) (GLshort red, GLshort green, GLshort blue); - void (APIENTRY *SecondaryColor3svEXT) (const GLshort *v); - void (APIENTRY *SecondaryColor3ubEXT) (GLubyte red, GLubyte green, GLubyte blue); - void (APIENTRY *SecondaryColor3ubvEXT) (const GLubyte *v); - void (APIENTRY *SecondaryColor3uiEXT) (GLuint red, GLuint green, GLuint blue); - void (APIENTRY *SecondaryColor3uivEXT) (const GLuint *v); - void (APIENTRY *SecondaryColor3usEXT) (GLushort red, GLushort green, GLushort blue); - void (APIENTRY *SecondaryColor3usvEXT) (const GLushort *v); - void (APIENTRY *SecondaryColorPointerEXT) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *TextureNormalEXT) (GLenum mode); - void (APIENTRY *MultiDrawArraysEXT) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); - void (APIENTRY *MultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); - void (APIENTRY *FogCoordfEXT) (GLfloat coord); - void (APIENTRY *FogCoordfvEXT) (const GLfloat *coord); - void (APIENTRY *FogCoorddEXT) (GLdouble coord); - void (APIENTRY *FogCoorddvEXT) (const GLdouble *coord); - void (APIENTRY *FogCoordPointerEXT) (GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *Tangent3bEXT) (GLbyte tx, GLbyte ty, GLbyte tz); - void (APIENTRY *Tangent3bvEXT) (const GLbyte *v); - void (APIENTRY *Tangent3dEXT) (GLdouble tx, GLdouble ty, GLdouble tz); - void (APIENTRY *Tangent3dvEXT) (const GLdouble *v); - void (APIENTRY *Tangent3fEXT) (GLfloat tx, GLfloat ty, GLfloat tz); - void (APIENTRY *Tangent3fvEXT) (const GLfloat *v); - void (APIENTRY *Tangent3iEXT) (GLint tx, GLint ty, GLint tz); - void (APIENTRY *Tangent3ivEXT) (const GLint *v); - void (APIENTRY *Tangent3sEXT) (GLshort tx, GLshort ty, GLshort tz); - void (APIENTRY *Tangent3svEXT) (const GLshort *v); - void (APIENTRY *Binormal3bEXT) (GLbyte bx, GLbyte by, GLbyte bz); - void (APIENTRY *Binormal3bvEXT) (const GLbyte *v); - void (APIENTRY *Binormal3dEXT) (GLdouble bx, GLdouble by, GLdouble bz); - void (APIENTRY *Binormal3dvEXT) (const GLdouble *v); - void (APIENTRY *Binormal3fEXT) (GLfloat bx, GLfloat by, GLfloat bz); - void (APIENTRY *Binormal3fvEXT) (const GLfloat *v); - void (APIENTRY *Binormal3iEXT) (GLint bx, GLint by, GLint bz); - void (APIENTRY *Binormal3ivEXT) (const GLint *v); - void (APIENTRY *Binormal3sEXT) (GLshort bx, GLshort by, GLshort bz); - void (APIENTRY *Binormal3svEXT) (const GLshort *v); - void (APIENTRY *TangentPointerEXT) (GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *BinormalPointerEXT) (GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *FinishTextureSUNX) (void); - void (APIENTRY *GlobalAlphaFactorbSUN) (GLbyte factor); - void (APIENTRY *GlobalAlphaFactorsSUN) (GLshort factor); - void (APIENTRY *GlobalAlphaFactoriSUN) (GLint factor); - void (APIENTRY *GlobalAlphaFactorfSUN) (GLfloat factor); - void (APIENTRY *GlobalAlphaFactordSUN) (GLdouble factor); - void (APIENTRY *GlobalAlphaFactorubSUN) (GLubyte factor); - void (APIENTRY *GlobalAlphaFactorusSUN) (GLushort factor); - void (APIENTRY *GlobalAlphaFactoruiSUN) (GLuint factor); - void (APIENTRY *ReplacementCodeuiSUN) (GLuint code); - void (APIENTRY *ReplacementCodeusSUN) (GLushort code); - void (APIENTRY *ReplacementCodeubSUN) (GLubyte code); - void (APIENTRY *ReplacementCodeuivSUN) (const GLuint *code); - void (APIENTRY *ReplacementCodeusvSUN) (const GLushort *code); - void (APIENTRY *ReplacementCodeubvSUN) (const GLubyte *code); - void (APIENTRY *ReplacementCodePointerSUN) (GLenum type, GLsizei stride, const GLvoid* *pointer); - void (APIENTRY *Color4ubVertex2fSUN) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); - void (APIENTRY *Color4ubVertex2fvSUN) (const GLubyte *c, const GLfloat *v); - void (APIENTRY *Color4ubVertex3fSUN) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *Color4ubVertex3fvSUN) (const GLubyte *c, const GLfloat *v); - void (APIENTRY *Color3fVertex3fSUN) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *Color3fVertex3fvSUN) (const GLfloat *c, const GLfloat *v); - void (APIENTRY *Normal3fVertex3fSUN) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *Normal3fVertex3fvSUN) (const GLfloat *n, const GLfloat *v); - void (APIENTRY *Color4fNormal3fVertex3fSUN) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *Color4fNormal3fVertex3fvSUN) (const GLfloat *c, const GLfloat *n, const GLfloat *v); - void (APIENTRY *TexCoord2fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *TexCoord2fVertex3fvSUN) (const GLfloat *tc, const GLfloat *v); - void (APIENTRY *TexCoord4fVertex4fSUN) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *TexCoord4fVertex4fvSUN) (const GLfloat *tc, const GLfloat *v); - void (APIENTRY *TexCoord2fColor4ubVertex3fSUN) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *TexCoord2fColor4ubVertex3fvSUN) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); - void (APIENTRY *TexCoord2fColor3fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *TexCoord2fColor3fVertex3fvSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); - void (APIENTRY *TexCoord2fNormal3fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *TexCoord2fNormal3fVertex3fvSUN) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); - void (APIENTRY *TexCoord2fColor4fNormal3fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *TexCoord2fColor4fNormal3fVertex3fvSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); - void (APIENTRY *TexCoord4fColor4fNormal3fVertex4fSUN) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *TexCoord4fColor4fNormal3fVertex4fvSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiVertex3fSUN) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiVertex3fvSUN) (const GLuint *rc, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiColor4ubVertex3fSUN) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiColor4ubVertex3fvSUN) (const GLuint *rc, const GLubyte *c, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiColor3fVertex3fSUN) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiColor3fVertex3fvSUN) (const GLuint *rc, const GLfloat *c, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiNormal3fVertex3fSUN) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *n, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiColor4fNormal3fVertex3fSUN) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiColor4fNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiTexCoord2fVertex3fSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiTexCoord2fVertex3fvSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); - void (APIENTRY *ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); - void (APIENTRY *BlendFuncSeparateEXT) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); - void (APIENTRY *BlendFuncSeparateINGR) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); - void (APIENTRY *VertexWeightfEXT) (GLfloat weight); - void (APIENTRY *VertexWeightfvEXT) (const GLfloat *weight); - void (APIENTRY *VertexWeightPointerEXT) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *FlushVertexArrayRangeNV) (void); - void (APIENTRY *VertexArrayRangeNV) (GLsizei length, const GLvoid *pointer); - void (APIENTRY *CombinerParameterfvNV) (GLenum pname, const GLfloat *params); - void (APIENTRY *CombinerParameterfNV) (GLenum pname, GLfloat param); - void (APIENTRY *CombinerParameterivNV) (GLenum pname, const GLint *params); - void (APIENTRY *CombinerParameteriNV) (GLenum pname, GLint param); - void (APIENTRY *CombinerInputNV) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); - void (APIENTRY *CombinerOutputNV) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); - void (APIENTRY *FinalCombinerInputNV) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); - void (APIENTRY *GetCombinerInputParameterfvNV) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); - void (APIENTRY *GetCombinerInputParameterivNV) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); - void (APIENTRY *GetCombinerOutputParameterfvNV) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); - void (APIENTRY *GetCombinerOutputParameterivNV) (GLenum stage, GLenum portion, GLenum pname, GLint *params); - void (APIENTRY *GetFinalCombinerInputParameterfvNV) (GLenum variable, GLenum pname, GLfloat *params); - void (APIENTRY *GetFinalCombinerInputParameterivNV) (GLenum variable, GLenum pname, GLint *params); - void (APIENTRY *ResizeBuffersMESA) (void); - void (APIENTRY *WindowPos2dMESA) (GLdouble x, GLdouble y); - void (APIENTRY *WindowPos2dvMESA) (const GLdouble *v); - void (APIENTRY *WindowPos2fMESA) (GLfloat x, GLfloat y); - void (APIENTRY *WindowPos2fvMESA) (const GLfloat *v); - void (APIENTRY *WindowPos2iMESA) (GLint x, GLint y); - void (APIENTRY *WindowPos2ivMESA) (const GLint *v); - void (APIENTRY *WindowPos2sMESA) (GLshort x, GLshort y); - void (APIENTRY *WindowPos2svMESA) (const GLshort *v); - void (APIENTRY *WindowPos3dMESA) (GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY *WindowPos3dvMESA) (const GLdouble *v); - void (APIENTRY *WindowPos3fMESA) (GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *WindowPos3fvMESA) (const GLfloat *v); - void (APIENTRY *WindowPos3iMESA) (GLint x, GLint y, GLint z); - void (APIENTRY *WindowPos3ivMESA) (const GLint *v); - void (APIENTRY *WindowPos3sMESA) (GLshort x, GLshort y, GLshort z); - void (APIENTRY *WindowPos3svMESA) (const GLshort *v); - void (APIENTRY *WindowPos4dMESA) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *WindowPos4dvMESA) (const GLdouble *v); - void (APIENTRY *WindowPos4fMESA) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *WindowPos4fvMESA) (const GLfloat *v); - void (APIENTRY *WindowPos4iMESA) (GLint x, GLint y, GLint z, GLint w); - void (APIENTRY *WindowPos4ivMESA) (const GLint *v); - void (APIENTRY *WindowPos4sMESA) (GLshort x, GLshort y, GLshort z, GLshort w); - void (APIENTRY *WindowPos4svMESA) (const GLshort *v); - void (APIENTRY *MultiModeDrawArraysIBM) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); - void (APIENTRY *MultiModeDrawElementsIBM) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); - void (APIENTRY *ColorPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *SecondaryColorPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *EdgeFlagPointerListIBM) (GLint stride, const GLboolean* *pointer, GLint ptrstride); - void (APIENTRY *FogCoordPointerListIBM) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *IndexPointerListIBM) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *NormalPointerListIBM) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *TexCoordPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *VertexPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); - void (APIENTRY *TbufferMask3DFX) (GLuint mask); - void (APIENTRY *SampleMaskEXT) (GLclampf value, GLboolean invert); - void (APIENTRY *SamplePatternEXT) (GLenum pattern); - void (APIENTRY *TextureColorMaskSGIS) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - void (APIENTRY *IglooInterfaceSGIX) (GLenum pname, const GLvoid *params); - void (APIENTRY *DeleteFencesNV) (GLsizei n, const GLuint *fences); - void (APIENTRY *GenFencesNV) (GLsizei n, GLuint *fences); - GLboolean (APIENTRY *IsFenceNV) (GLuint fence); - GLboolean (APIENTRY *TestFenceNV) (GLuint fence); - void (APIENTRY *GetFenceivNV) (GLuint fence, GLenum pname, GLint *params); - void (APIENTRY *FinishFenceNV) (GLuint fence); - void (APIENTRY *SetFenceNV) (GLuint fence, GLenum condition); - void (APIENTRY *MapControlPointsNV) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); - void (APIENTRY *MapParameterivNV) (GLenum target, GLenum pname, const GLint *params); - void (APIENTRY *MapParameterfvNV) (GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY *GetMapControlPointsNV) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); - void (APIENTRY *GetMapParameterivNV) (GLenum target, GLenum pname, GLint *params); - void (APIENTRY *GetMapParameterfvNV) (GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY *GetMapAttribParameterivNV) (GLenum target, GLuint index, GLenum pname, GLint *params); - void (APIENTRY *GetMapAttribParameterfvNV) (GLenum target, GLuint index, GLenum pname, GLfloat *params); - void (APIENTRY *EvalMapsNV) (GLenum target, GLenum mode); - void (APIENTRY *CombinerStageParameterfvNV) (GLenum stage, GLenum pname, const GLfloat *params); - void (APIENTRY *GetCombinerStageParameterfvNV) (GLenum stage, GLenum pname, GLfloat *params); - GLboolean (APIENTRY *AreProgramsResidentNV) (GLsizei n, const GLuint *programs, GLboolean *residences); - void (APIENTRY *BindProgramNV) (GLenum target, GLuint id); - void (APIENTRY *DeleteProgramsNV) (GLsizei n, const GLuint *programs); - void (APIENTRY *ExecuteProgramNV) (GLenum target, GLuint id, const GLfloat *params); - void (APIENTRY *GenProgramsNV) (GLsizei n, GLuint *programs); - void (APIENTRY *GetProgramParameterdvNV) (GLenum target, GLuint index, GLenum pname, GLdouble *params); - void (APIENTRY *GetProgramParameterfvNV) (GLenum target, GLuint index, GLenum pname, GLfloat *params); - void (APIENTRY *GetProgramivNV) (GLuint id, GLenum pname, GLint *params); - void (APIENTRY *GetProgramStringNV) (GLuint id, GLenum pname, GLubyte *program); - void (APIENTRY *GetTrackMatrixivNV) (GLenum target, GLuint address, GLenum pname, GLint *params); - void (APIENTRY *GetVertexAttribdvNV) (GLuint index, GLenum pname, GLdouble *params); - void (APIENTRY *GetVertexAttribfvNV) (GLuint index, GLenum pname, GLfloat *params); - void (APIENTRY *GetVertexAttribivNV) (GLuint index, GLenum pname, GLint *params); - void (APIENTRY *GetVertexAttribPointervNV) (GLuint index, GLenum pname, GLvoid* *pointer); - GLboolean (APIENTRY *IsProgramNV) (GLuint id); - void (APIENTRY *LoadProgramNV) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); - void (APIENTRY *ProgramParameter4dNV) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *ProgramParameter4dvNV) (GLenum target, GLuint index, const GLdouble *v); - void (APIENTRY *ProgramParameter4fNV) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *ProgramParameter4fvNV) (GLenum target, GLuint index, const GLfloat *v); - void (APIENTRY *ProgramParameters4dvNV) (GLenum target, GLuint index, GLuint count, const GLdouble *v); - void (APIENTRY *ProgramParameters4fvNV) (GLenum target, GLuint index, GLuint count, const GLfloat *v); - void (APIENTRY *RequestResidentProgramsNV) (GLsizei n, const GLuint *programs); - void (APIENTRY *TrackMatrixNV) (GLenum target, GLuint address, GLenum matrix, GLenum transform); - void (APIENTRY *VertexAttribPointerNV) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY *VertexAttrib1dNV) (GLuint index, GLdouble x); - void (APIENTRY *VertexAttrib1dvNV) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib1fNV) (GLuint index, GLfloat x); - void (APIENTRY *VertexAttrib1fvNV) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib1sNV) (GLuint index, GLshort x); - void (APIENTRY *VertexAttrib1svNV) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib2dNV) (GLuint index, GLdouble x, GLdouble y); - void (APIENTRY *VertexAttrib2dvNV) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib2fNV) (GLuint index, GLfloat x, GLfloat y); - void (APIENTRY *VertexAttrib2fvNV) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib2sNV) (GLuint index, GLshort x, GLshort y); - void (APIENTRY *VertexAttrib2svNV) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib3dNV) (GLuint index, GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY *VertexAttrib3dvNV) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib3fNV) (GLuint index, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *VertexAttrib3fvNV) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib3sNV) (GLuint index, GLshort x, GLshort y, GLshort z); - void (APIENTRY *VertexAttrib3svNV) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib4dNV) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *VertexAttrib4dvNV) (GLuint index, const GLdouble *v); - void (APIENTRY *VertexAttrib4fNV) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *VertexAttrib4fvNV) (GLuint index, const GLfloat *v); - void (APIENTRY *VertexAttrib4sNV) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); - void (APIENTRY *VertexAttrib4svNV) (GLuint index, const GLshort *v); - void (APIENTRY *VertexAttrib4ubNV) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); - void (APIENTRY *VertexAttrib4ubvNV) (GLuint index, const GLubyte *v); - void (APIENTRY *VertexAttribs1dvNV) (GLuint index, GLsizei count, const GLdouble *v); - void (APIENTRY *VertexAttribs1fvNV) (GLuint index, GLsizei count, const GLfloat *v); - void (APIENTRY *VertexAttribs1svNV) (GLuint index, GLsizei count, const GLshort *v); - void (APIENTRY *VertexAttribs2dvNV) (GLuint index, GLsizei count, const GLdouble *v); - void (APIENTRY *VertexAttribs2fvNV) (GLuint index, GLsizei count, const GLfloat *v); - void (APIENTRY *VertexAttribs2svNV) (GLuint index, GLsizei count, const GLshort *v); - void (APIENTRY *VertexAttribs3dvNV) (GLuint index, GLsizei count, const GLdouble *v); - void (APIENTRY *VertexAttribs3fvNV) (GLuint index, GLsizei count, const GLfloat *v); - void (APIENTRY *VertexAttribs3svNV) (GLuint index, GLsizei count, const GLshort *v); - void (APIENTRY *VertexAttribs4dvNV) (GLuint index, GLsizei count, const GLdouble *v); - void (APIENTRY *VertexAttribs4fvNV) (GLuint index, GLsizei count, const GLfloat *v); - void (APIENTRY *VertexAttribs4svNV) (GLuint index, GLsizei count, const GLshort *v); - void (APIENTRY *VertexAttribs4ubvNV) (GLuint index, GLsizei count, const GLubyte *v); - void (APIENTRY *TexBumpParameterivATI) (GLenum pname, const GLint *param); - void (APIENTRY *TexBumpParameterfvATI) (GLenum pname, const GLfloat *param); - void (APIENTRY *GetTexBumpParameterivATI) (GLenum pname, GLint *param); - void (APIENTRY *GetTexBumpParameterfvATI) (GLenum pname, GLfloat *param); - GLuint (APIENTRY *GenFragmentShadersATI) (GLuint range); - void (APIENTRY *BindFragmentShaderATI) (GLuint id); - void (APIENTRY *DeleteFragmentShaderATI) (GLuint id); - void (APIENTRY *BeginFragmentShaderATI) (void); - void (APIENTRY *EndFragmentShaderATI) (void); - void (APIENTRY *PassTexCoordATI) (GLuint dst, GLuint coord, GLenum swizzle); - void (APIENTRY *SampleMapATI) (GLuint dst, GLuint interp, GLenum swizzle); - void (APIENTRY *ColorFragmentOp1ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); - void (APIENTRY *ColorFragmentOp2ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); - void (APIENTRY *ColorFragmentOp3ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); - void (APIENTRY *AlphaFragmentOp1ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); - void (APIENTRY *AlphaFragmentOp2ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); - void (APIENTRY *AlphaFragmentOp3ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); - void (APIENTRY *SetFragmentShaderConstantATI) (GLuint dst, const GLfloat *value); - void (APIENTRY *PNTrianglesiATI) (GLenum pname, GLint param); - void (APIENTRY *PNTrianglesfATI) (GLenum pname, GLfloat param); - GLuint (APIENTRY *NewObjectBufferATI) (GLsizei size, const GLvoid *pointer, GLenum usage); - GLboolean (APIENTRY *IsObjectBufferATI) (GLuint buffer); - void (APIENTRY *UpdateObjectBufferATI) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); - void (APIENTRY *GetObjectBufferfvATI) (GLuint buffer, GLenum pname, GLfloat *params); - void (APIENTRY *GetObjectBufferivATI) (GLuint buffer, GLenum pname, GLint *params); - void (APIENTRY *FreeObjectBufferATI) (GLuint buffer); - void (APIENTRY *ArrayObjectATI) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); - void (APIENTRY *GetArrayObjectfvATI) (GLenum array, GLenum pname, GLfloat *params); - void (APIENTRY *GetArrayObjectivATI) (GLenum array, GLenum pname, GLint *params); - void (APIENTRY *VariantArrayObjectATI) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); - void (APIENTRY *GetVariantArrayObjectfvATI) (GLuint id, GLenum pname, GLfloat *params); - void (APIENTRY *GetVariantArrayObjectivATI) (GLuint id, GLenum pname, GLint *params); - void (APIENTRY *BeginVertexShaderEXT) (void); - void (APIENTRY *EndVertexShaderEXT) (void); - void (APIENTRY *BindVertexShaderEXT) (GLuint id); - GLuint (APIENTRY *GenVertexShadersEXT) (GLuint range); - void (APIENTRY *DeleteVertexShaderEXT) (GLuint id); - void (APIENTRY *ShaderOp1EXT) (GLenum op, GLuint res, GLuint arg1); - void (APIENTRY *ShaderOp2EXT) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); - void (APIENTRY *ShaderOp3EXT) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); - void (APIENTRY *SwizzleEXT) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); - void (APIENTRY *WriteMaskEXT) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); - void (APIENTRY *InsertComponentEXT) (GLuint res, GLuint src, GLuint num); - void (APIENTRY *ExtractComponentEXT) (GLuint res, GLuint src, GLuint num); - GLuint (APIENTRY *GenSymbolsEXT) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); - void (APIENTRY *SetInvariantEXT) (GLuint id, GLenum type, const GLvoid *addr); - void (APIENTRY *SetLocalConstantEXT) (GLuint id, GLenum type, const GLvoid *addr); - void (APIENTRY *VariantbvEXT) (GLuint id, const GLbyte *addr); - void (APIENTRY *VariantsvEXT) (GLuint id, const GLshort *addr); - void (APIENTRY *VariantivEXT) (GLuint id, const GLint *addr); - void (APIENTRY *VariantfvEXT) (GLuint id, const GLfloat *addr); - void (APIENTRY *VariantdvEXT) (GLuint id, const GLdouble *addr); - void (APIENTRY *VariantubvEXT) (GLuint id, const GLubyte *addr); - void (APIENTRY *VariantusvEXT) (GLuint id, const GLushort *addr); - void (APIENTRY *VariantuivEXT) (GLuint id, const GLuint *addr); - void (APIENTRY *VariantPointerEXT) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); - void (APIENTRY *EnableVariantClientStateEXT) (GLuint id); - void (APIENTRY *DisableVariantClientStateEXT) (GLuint id); - GLuint (APIENTRY *BindLightParameterEXT) (GLenum light, GLenum value); - GLuint (APIENTRY *BindMaterialParameterEXT) (GLenum face, GLenum value); - GLuint (APIENTRY *BindTexGenParameterEXT) (GLenum unit, GLenum coord, GLenum value); - GLuint (APIENTRY *BindTextureUnitParameterEXT) (GLenum unit, GLenum value); - GLuint (APIENTRY *BindParameterEXT) (GLenum value); - GLboolean (APIENTRY *IsVariantEnabledEXT) (GLuint id, GLenum cap); - void (APIENTRY *GetVariantBooleanvEXT) (GLuint id, GLenum value, GLboolean *data); - void (APIENTRY *GetVariantIntegervEXT) (GLuint id, GLenum value, GLint *data); - void (APIENTRY *GetVariantFloatvEXT) (GLuint id, GLenum value, GLfloat *data); - void (APIENTRY *GetVariantPointervEXT) (GLuint id, GLenum value, GLvoid* *data); - void (APIENTRY *GetInvariantBooleanvEXT) (GLuint id, GLenum value, GLboolean *data); - void (APIENTRY *GetInvariantIntegervEXT) (GLuint id, GLenum value, GLint *data); - void (APIENTRY *GetInvariantFloatvEXT) (GLuint id, GLenum value, GLfloat *data); - void (APIENTRY *GetLocalConstantBooleanvEXT) (GLuint id, GLenum value, GLboolean *data); - void (APIENTRY *GetLocalConstantIntegervEXT) (GLuint id, GLenum value, GLint *data); - void (APIENTRY *GetLocalConstantFloatvEXT) (GLuint id, GLenum value, GLfloat *data); - void (APIENTRY *VertexStream1sATI) (GLenum stream, GLshort x); - void (APIENTRY *VertexStream1svATI) (GLenum stream, const GLshort *coords); - void (APIENTRY *VertexStream1iATI) (GLenum stream, GLint x); - void (APIENTRY *VertexStream1ivATI) (GLenum stream, const GLint *coords); - void (APIENTRY *VertexStream1fATI) (GLenum stream, GLfloat x); - void (APIENTRY *VertexStream1fvATI) (GLenum stream, const GLfloat *coords); - void (APIENTRY *VertexStream1dATI) (GLenum stream, GLdouble x); - void (APIENTRY *VertexStream1dvATI) (GLenum stream, const GLdouble *coords); - void (APIENTRY *VertexStream2sATI) (GLenum stream, GLshort x, GLshort y); - void (APIENTRY *VertexStream2svATI) (GLenum stream, const GLshort *coords); - void (APIENTRY *VertexStream2iATI) (GLenum stream, GLint x, GLint y); - void (APIENTRY *VertexStream2ivATI) (GLenum stream, const GLint *coords); - void (APIENTRY *VertexStream2fATI) (GLenum stream, GLfloat x, GLfloat y); - void (APIENTRY *VertexStream2fvATI) (GLenum stream, const GLfloat *coords); - void (APIENTRY *VertexStream2dATI) (GLenum stream, GLdouble x, GLdouble y); - void (APIENTRY *VertexStream2dvATI) (GLenum stream, const GLdouble *coords); - void (APIENTRY *VertexStream3sATI) (GLenum stream, GLshort x, GLshort y, GLshort z); - void (APIENTRY *VertexStream3svATI) (GLenum stream, const GLshort *coords); - void (APIENTRY *VertexStream3iATI) (GLenum stream, GLint x, GLint y, GLint z); - void (APIENTRY *VertexStream3ivATI) (GLenum stream, const GLint *coords); - void (APIENTRY *VertexStream3fATI) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY *VertexStream3fvATI) (GLenum stream, const GLfloat *coords); - void (APIENTRY *VertexStream3dATI) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY *VertexStream3dvATI) (GLenum stream, const GLdouble *coords); - void (APIENTRY *VertexStream4sATI) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); - void (APIENTRY *VertexStream4svATI) (GLenum stream, const GLshort *coords); - void (APIENTRY *VertexStream4iATI) (GLenum stream, GLint x, GLint y, GLint z, GLint w); - void (APIENTRY *VertexStream4ivATI) (GLenum stream, const GLint *coords); - void (APIENTRY *VertexStream4fATI) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *VertexStream4fvATI) (GLenum stream, const GLfloat *coords); - void (APIENTRY *VertexStream4dATI) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *VertexStream4dvATI) (GLenum stream, const GLdouble *coords); - void (APIENTRY *NormalStream3bATI) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); - void (APIENTRY *NormalStream3bvATI) (GLenum stream, const GLbyte *coords); - void (APIENTRY *NormalStream3sATI) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); - void (APIENTRY *NormalStream3svATI) (GLenum stream, const GLshort *coords); - void (APIENTRY *NormalStream3iATI) (GLenum stream, GLint nx, GLint ny, GLint nz); - void (APIENTRY *NormalStream3ivATI) (GLenum stream, const GLint *coords); - void (APIENTRY *NormalStream3fATI) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); - void (APIENTRY *NormalStream3fvATI) (GLenum stream, const GLfloat *coords); - void (APIENTRY *NormalStream3dATI) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); - void (APIENTRY *NormalStream3dvATI) (GLenum stream, const GLdouble *coords); - void (APIENTRY *ClientActiveVertexStreamATI) (GLenum stream); - void (APIENTRY *VertexBlendEnviATI) (GLenum pname, GLint param); - void (APIENTRY *VertexBlendEnvfATI) (GLenum pname, GLfloat param); - void (APIENTRY *ElementPointerATI) (GLenum type, const GLvoid *pointer); - void (APIENTRY *DrawElementArrayATI) (GLenum mode, GLsizei count); - void (APIENTRY *DrawRangeElementArrayATI) (GLenum mode, GLuint start, GLuint end, GLsizei count); - void (APIENTRY *DrawMeshArraysSUN) (GLenum mode, GLint first, GLsizei count, GLsizei width); - void (APIENTRY *GenOcclusionQueriesNV) (GLsizei n, GLuint *ids); - void (APIENTRY *DeleteOcclusionQueriesNV) (GLsizei n, const GLuint *ids); - GLboolean (APIENTRY *IsOcclusionQueryNV) (GLuint id); - void (APIENTRY *BeginOcclusionQueryNV) (GLuint id); - void (APIENTRY *EndOcclusionQueryNV) (void); - void (APIENTRY *GetOcclusionQueryivNV) (GLuint id, GLenum pname, GLint *params); - void (APIENTRY *GetOcclusionQueryuivNV) (GLuint id, GLenum pname, GLuint *params); - void (APIENTRY *PointParameteriNV) (GLenum pname, GLint param); - void (APIENTRY *PointParameterivNV) (GLenum pname, const GLint *params); - void (APIENTRY *ActiveStencilFaceEXT) (GLenum face); - void (APIENTRY *ElementPointerAPPLE) (GLenum type, const GLvoid *pointer); - void (APIENTRY *DrawElementArrayAPPLE) (GLenum mode, GLint first, GLsizei count); - void (APIENTRY *DrawRangeElementArrayAPPLE) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); - void (APIENTRY *MultiDrawElementArrayAPPLE) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); - void (APIENTRY *MultiDrawRangeElementArrayAPPLE) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); - void (APIENTRY *GenFencesAPPLE) (GLsizei n, GLuint *fences); - void (APIENTRY *DeleteFencesAPPLE) (GLsizei n, const GLuint *fences); - void (APIENTRY *SetFenceAPPLE) (GLuint fence); - GLboolean (APIENTRY *IsFenceAPPLE) (GLuint fence); - GLboolean (APIENTRY *TestFenceAPPLE) (GLuint fence); - void (APIENTRY *FinishFenceAPPLE) (GLuint fence); - GLboolean (APIENTRY *TestObjectAPPLE) (GLenum object, GLuint name); - void (APIENTRY *FinishObjectAPPLE) (GLenum object, GLint name); - void (APIENTRY *BindVertexArrayAPPLE) (GLuint array); - void (APIENTRY *DeleteVertexArraysAPPLE) (GLsizei n, const GLuint *arrays); - void (APIENTRY *GenVertexArraysAPPLE) (GLsizei n, const GLuint *arrays); - GLboolean (APIENTRY *IsVertexArrayAPPLE) (GLuint array); - void (APIENTRY *VertexArrayRangeAPPLE) (GLsizei length, GLvoid *pointer); - void (APIENTRY *FlushVertexArrayRangeAPPLE) (GLsizei length, GLvoid *pointer); - void (APIENTRY *VertexArrayParameteriAPPLE) (GLenum pname, GLint param); - void (APIENTRY *DrawBuffersATI) (GLsizei n, const GLenum *bufs); - void (APIENTRY *ProgramNamedParameter4fNV) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY *ProgramNamedParameter4dNV) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY *ProgramNamedParameter4fvNV) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); - void (APIENTRY *ProgramNamedParameter4dvNV) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); - void (APIENTRY *GetProgramNamedParameterfvNV) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); - void (APIENTRY *GetProgramNamedParameterdvNV) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); - void (APIENTRY *Vertex2hNV) (GLhalfNV x, GLhalfNV y); - void (APIENTRY *Vertex2hvNV) (const GLhalfNV *v); - void (APIENTRY *Vertex3hNV) (GLhalfNV x, GLhalfNV y, GLhalfNV z); - void (APIENTRY *Vertex3hvNV) (const GLhalfNV *v); - void (APIENTRY *Vertex4hNV) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); - void (APIENTRY *Vertex4hvNV) (const GLhalfNV *v); - void (APIENTRY *Normal3hNV) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); - void (APIENTRY *Normal3hvNV) (const GLhalfNV *v); - void (APIENTRY *Color3hNV) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); - void (APIENTRY *Color3hvNV) (const GLhalfNV *v); - void (APIENTRY *Color4hNV) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); - void (APIENTRY *Color4hvNV) (const GLhalfNV *v); - void (APIENTRY *TexCoord1hNV) (GLhalfNV s); - void (APIENTRY *TexCoord1hvNV) (const GLhalfNV *v); - void (APIENTRY *TexCoord2hNV) (GLhalfNV s, GLhalfNV t); - void (APIENTRY *TexCoord2hvNV) (const GLhalfNV *v); - void (APIENTRY *TexCoord3hNV) (GLhalfNV s, GLhalfNV t, GLhalfNV r); - void (APIENTRY *TexCoord3hvNV) (const GLhalfNV *v); - void (APIENTRY *TexCoord4hNV) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); - void (APIENTRY *TexCoord4hvNV) (const GLhalfNV *v); - void (APIENTRY *MultiTexCoord1hNV) (GLenum target, GLhalfNV s); - void (APIENTRY *MultiTexCoord1hvNV) (GLenum target, const GLhalfNV *v); - void (APIENTRY *MultiTexCoord2hNV) (GLenum target, GLhalfNV s, GLhalfNV t); - void (APIENTRY *MultiTexCoord2hvNV) (GLenum target, const GLhalfNV *v); - void (APIENTRY *MultiTexCoord3hNV) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); - void (APIENTRY *MultiTexCoord3hvNV) (GLenum target, const GLhalfNV *v); - void (APIENTRY *MultiTexCoord4hNV) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); - void (APIENTRY *MultiTexCoord4hvNV) (GLenum target, const GLhalfNV *v); - void (APIENTRY *FogCoordhNV) (GLhalfNV fog); - void (APIENTRY *FogCoordhvNV) (const GLhalfNV *fog); - void (APIENTRY *SecondaryColor3hNV) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); - void (APIENTRY *SecondaryColor3hvNV) (const GLhalfNV *v); - void (APIENTRY *VertexWeighthNV) (GLhalfNV weight); - void (APIENTRY *VertexWeighthvNV) (const GLhalfNV *weight); - void (APIENTRY *VertexAttrib1hNV) (GLuint index, GLhalfNV x); - void (APIENTRY *VertexAttrib1hvNV) (GLuint index, const GLhalfNV *v); - void (APIENTRY *VertexAttrib2hNV) (GLuint index, GLhalfNV x, GLhalfNV y); - void (APIENTRY *VertexAttrib2hvNV) (GLuint index, const GLhalfNV *v); - void (APIENTRY *VertexAttrib3hNV) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); - void (APIENTRY *VertexAttrib3hvNV) (GLuint index, const GLhalfNV *v); - void (APIENTRY *VertexAttrib4hNV) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); - void (APIENTRY *VertexAttrib4hvNV) (GLuint index, const GLhalfNV *v); - void (APIENTRY *VertexAttribs1hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); - void (APIENTRY *VertexAttribs2hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); - void (APIENTRY *VertexAttribs3hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); - void (APIENTRY *VertexAttribs4hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); - void (APIENTRY *PixelDataRangeNV) (GLenum target, GLsizei length, GLvoid *pointer); - void (APIENTRY *FlushPixelDataRangeNV) (GLenum target); - void (APIENTRY *PrimitiveRestartNV) (void); - void (APIENTRY *PrimitiveRestartIndexNV) (GLuint index); - GLvoid* (APIENTRY *MapObjectBufferATI) (GLuint buffer); - void (APIENTRY *UnmapObjectBufferATI) (GLuint buffer); - void (APIENTRY *StencilOpSeparateATI) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); - void (APIENTRY *StencilFuncSeparateATI) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); - void (APIENTRY *VertexAttribArrayObjectATI) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); - void (APIENTRY *GetVertexAttribArrayObjectfvATI) (GLuint index, GLenum pname, GLfloat *params); - void (APIENTRY *GetVertexAttribArrayObjectivATI) (GLuint index, GLenum pname, GLint *params); - void (APIENTRY *DepthBoundsEXT) (GLclampd zmin, GLclampd zmax); - void (APIENTRY *BlendEquationSeparateEXT) (GLenum modeRGB, GLenum modeAlpha); - void (APIENTRY *AddSwapHintRectWIN) (GLint x, GLint y, GLsizei width, GLsizei height); -#ifdef _WIN32 - HANDLE (WINAPI *CreateBufferRegionARB) (HDC hDC, int iLayerPlane, UINT uType); - VOID (WINAPI *DeleteBufferRegionARB) (HANDLE hRegion); - BOOL (WINAPI *SaveBufferRegionARB) (HANDLE hRegion, int x, int y, int width, int height); - BOOL (WINAPI *RestoreBufferRegionARB) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); - const int (WINAPI *GetExtensionsStringARB) (HDC hdc); - BOOL (WINAPI *GetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); - BOOL (WINAPI *GetPixelFormatAttribfvARB) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); - BOOL (WINAPI *ChoosePixelFormatARB) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); - BOOL (WINAPI *MakeContextCurrentARB) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); - HDC (WINAPI *GetCurrentReadDCARB) (void); - HPBUFFERARB (WINAPI *CreatePbufferARB) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); - HDC (WINAPI *GetPbufferDCARB) (HPBUFFERARB hPbuffer); - int (WINAPI *ReleasePbufferDCARB) (HPBUFFERARB hPbuffer, HDC hDC); - BOOL (WINAPI *DestroyPbufferARB) (HPBUFFERARB hPbuffer); - BOOL (WINAPI *QueryPbufferARB) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); - BOOL (WINAPI *BindTexImageARB) (HPBUFFERARB hPbuffer, int iBuffer); - BOOL (WINAPI *ReleaseTexImageARB) (HPBUFFERARB hPbuffer, int iBuffer); - BOOL (WINAPI *SetPbufferAttribARB) (HPBUFFERARB hPbuffer, const int *piAttribList); - GLboolean (WINAPI *CreateDisplayColorTableEXT) (GLushort id); - GLboolean (WINAPI *LoadDisplayColorTableEXT) (const GLushort *table, GLuint length); - GLboolean (WINAPI *BindDisplayColorTableEXT) (GLushort id); - VOID (WINAPI *DestroyDisplayColorTableEXT) (GLushort id); - const int (WINAPI *GetExtensionsStringEXT) (void); - BOOL (WINAPI *MakeContextCurrentEXT) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); - HDC (WINAPI *GetCurrentReadDCEXT) (void); - HPBUFFEREXT (WINAPI *CreatePbufferEXT) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); - HDC (WINAPI *GetPbufferDCEXT) (HPBUFFEREXT hPbuffer); - int (WINAPI *ReleasePbufferDCEXT) (HPBUFFEREXT hPbuffer, HDC hDC); - BOOL (WINAPI *DestroyPbufferEXT) (HPBUFFEREXT hPbuffer); - BOOL (WINAPI *QueryPbufferEXT) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); - BOOL (WINAPI *GetPixelFormatAttribivEXT) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); - BOOL (WINAPI *GetPixelFormatAttribfvEXT) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); - BOOL (WINAPI *ChoosePixelFormatEXT) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); - BOOL (WINAPI *SwapIntervalEXT) (int interval); - int (WINAPI *GetSwapIntervalEXT) (void); - void* (WINAPI *AllocateMemoryNV) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); - void (WINAPI *FreeMemoryNV) (void); - BOOL (WINAPI *GetSyncValuesOML) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); - BOOL (WINAPI *GetMscRateOML) (HDC hdc, INT32 *numerator, INT32 *denominator); - INT64 (WINAPI *SwapBuffersMscOML) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); - INT64 (WINAPI *SwapLayerBuffersMscOML) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); - BOOL (WINAPI *WaitForMscOML) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); - BOOL (WINAPI *WaitForSbcOML) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); - BOOL (WINAPI *GetDigitalVideoParametersI3D) (HDC hDC, int iAttribute, int *piValue); - BOOL (WINAPI *SetDigitalVideoParametersI3D) (HDC hDC, int iAttribute, const int *piValue); - BOOL (WINAPI *GetGammaTableParametersI3D) (HDC hDC, int iAttribute, int *piValue); - BOOL (WINAPI *SetGammaTableParametersI3D) (HDC hDC, int iAttribute, const int *piValue); - BOOL (WINAPI *GetGammaTableI3D) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); - BOOL (WINAPI *SetGammaTableI3D) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); - BOOL (WINAPI *EnableGenlockI3D) (HDC hDC); - BOOL (WINAPI *DisableGenlockI3D) (HDC hDC); - BOOL (WINAPI *IsEnabledGenlockI3D) (HDC hDC, BOOL *pFlag); - BOOL (WINAPI *GenlockSourceI3D) (HDC hDC, UINT uSource); - BOOL (WINAPI *GetGenlockSourceI3D) (HDC hDC, UINT *uSource); - BOOL (WINAPI *GenlockSourceEdgeI3D) (HDC hDC, UINT uEdge); - BOOL (WINAPI *GetGenlockSourceEdgeI3D) (HDC hDC, UINT *uEdge); - BOOL (WINAPI *GenlockSampleRateI3D) (HDC hDC, UINT uRate); - BOOL (WINAPI *GetGenlockSampleRateI3D) (HDC hDC, UINT *uRate); - BOOL (WINAPI *GenlockSourceDelayI3D) (HDC hDC, UINT uDelay); - BOOL (WINAPI *GetGenlockSourceDelayI3D) (HDC hDC, UINT *uDelay); - BOOL (WINAPI *QueryGenlockMaxSourceDelayI3D) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); - LPVOID (WINAPI *CreateImageBufferI3D) (HDC hDC, DWORD dwSize, UINT uFlags); - BOOL (WINAPI *DestroyImageBufferI3D) (HDC hDC, LPVOID pAddress); - BOOL (WINAPI *AssociateImageBufferEventsI3D) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); - BOOL (WINAPI *ReleaseImageBufferEventsI3D) (HDC hDC, const LPVOID *pAddress, UINT count); - BOOL (WINAPI *EnableFrameLockI3D) (void); - BOOL (WINAPI *DisableFrameLockI3D) (void); - BOOL (WINAPI *IsEnabledFrameLockI3D) (BOOL *pFlag); - BOOL (WINAPI *QueryFrameLockMasterI3D) (BOOL *pFlag); - BOOL (WINAPI *GetFrameUsageI3D) (float *pUsage); - BOOL (WINAPI *BeginFrameTrackingI3D) (void); - BOOL (WINAPI *EndFrameTrackingI3D) (void); - BOOL (WINAPI *QueryFrameTrackingI3D) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); -#endif /* _WIN32 */ -} _GLextensionProcs; - -#define glBlendColor (_GET_TLS_PROCTABLE()->BlendColor) -#define glBlendEquation (_GET_TLS_PROCTABLE()->BlendEquation) -#define glDrawRangeElements (_GET_TLS_PROCTABLE()->DrawRangeElements) -#define glColorTable (_GET_TLS_PROCTABLE()->ColorTable) -#define glColorTableParameterfv (_GET_TLS_PROCTABLE()->ColorTableParameterfv) -#define glColorTableParameteriv (_GET_TLS_PROCTABLE()->ColorTableParameteriv) -#define glCopyColorTable (_GET_TLS_PROCTABLE()->CopyColorTable) -#define glGetColorTable (_GET_TLS_PROCTABLE()->GetColorTable) -#define glGetColorTableParameterfv (_GET_TLS_PROCTABLE()->GetColorTableParameterfv) -#define glGetColorTableParameteriv (_GET_TLS_PROCTABLE()->GetColorTableParameteriv) -#define glColorSubTable (_GET_TLS_PROCTABLE()->ColorSubTable) -#define glCopyColorSubTable (_GET_TLS_PROCTABLE()->CopyColorSubTable) -#define glConvolutionFilter1D (_GET_TLS_PROCTABLE()->ConvolutionFilter1D) -#define glConvolutionFilter2D (_GET_TLS_PROCTABLE()->ConvolutionFilter2D) -#define glConvolutionParameterf (_GET_TLS_PROCTABLE()->ConvolutionParameterf) -#define glConvolutionParameterfv (_GET_TLS_PROCTABLE()->ConvolutionParameterfv) -#define glConvolutionParameteri (_GET_TLS_PROCTABLE()->ConvolutionParameteri) -#define glConvolutionParameteriv (_GET_TLS_PROCTABLE()->ConvolutionParameteriv) -#define glCopyConvolutionFilter1D (_GET_TLS_PROCTABLE()->CopyConvolutionFilter1D) -#define glCopyConvolutionFilter2D (_GET_TLS_PROCTABLE()->CopyConvolutionFilter2D) -#define glGetConvolutionFilter (_GET_TLS_PROCTABLE()->GetConvolutionFilter) -#define glGetConvolutionParameterfv (_GET_TLS_PROCTABLE()->GetConvolutionParameterfv) -#define glGetConvolutionParameteriv (_GET_TLS_PROCTABLE()->GetConvolutionParameteriv) -#define glGetSeparableFilter (_GET_TLS_PROCTABLE()->GetSeparableFilter) -#define glSeparableFilter2D (_GET_TLS_PROCTABLE()->SeparableFilter2D) -#define glGetHistogram (_GET_TLS_PROCTABLE()->GetHistogram) -#define glGetHistogramParameterfv (_GET_TLS_PROCTABLE()->GetHistogramParameterfv) -#define glGetHistogramParameteriv (_GET_TLS_PROCTABLE()->GetHistogramParameteriv) -#define glGetMinmax (_GET_TLS_PROCTABLE()->GetMinmax) -#define glGetMinmaxParameterfv (_GET_TLS_PROCTABLE()->GetMinmaxParameterfv) -#define glGetMinmaxParameteriv (_GET_TLS_PROCTABLE()->GetMinmaxParameteriv) -#define glHistogram (_GET_TLS_PROCTABLE()->Histogram) -#define glMinmax (_GET_TLS_PROCTABLE()->Minmax) -#define glResetHistogram (_GET_TLS_PROCTABLE()->ResetHistogram) -#define glResetMinmax (_GET_TLS_PROCTABLE()->ResetMinmax) -#define glTexImage3D (_GET_TLS_PROCTABLE()->TexImage3D) -#define glTexSubImage3D (_GET_TLS_PROCTABLE()->TexSubImage3D) -#define glCopyTexSubImage3D (_GET_TLS_PROCTABLE()->CopyTexSubImage3D) -#define glActiveTexture (_GET_TLS_PROCTABLE()->ActiveTexture) -#define glClientActiveTexture (_GET_TLS_PROCTABLE()->ClientActiveTexture) -#define glMultiTexCoord1d (_GET_TLS_PROCTABLE()->MultiTexCoord1d) -#define glMultiTexCoord1dv (_GET_TLS_PROCTABLE()->MultiTexCoord1dv) -#define glMultiTexCoord1f (_GET_TLS_PROCTABLE()->MultiTexCoord1f) -#define glMultiTexCoord1fv (_GET_TLS_PROCTABLE()->MultiTexCoord1fv) -#define glMultiTexCoord1i (_GET_TLS_PROCTABLE()->MultiTexCoord1i) -#define glMultiTexCoord1iv (_GET_TLS_PROCTABLE()->MultiTexCoord1iv) -#define glMultiTexCoord1s (_GET_TLS_PROCTABLE()->MultiTexCoord1s) -#define glMultiTexCoord1sv (_GET_TLS_PROCTABLE()->MultiTexCoord1sv) -#define glMultiTexCoord2d (_GET_TLS_PROCTABLE()->MultiTexCoord2d) -#define glMultiTexCoord2dv (_GET_TLS_PROCTABLE()->MultiTexCoord2dv) -#define glMultiTexCoord2f (_GET_TLS_PROCTABLE()->MultiTexCoord2f) -#define glMultiTexCoord2fv (_GET_TLS_PROCTABLE()->MultiTexCoord2fv) -#define glMultiTexCoord2i (_GET_TLS_PROCTABLE()->MultiTexCoord2i) -#define glMultiTexCoord2iv (_GET_TLS_PROCTABLE()->MultiTexCoord2iv) -#define glMultiTexCoord2s (_GET_TLS_PROCTABLE()->MultiTexCoord2s) -#define glMultiTexCoord2sv (_GET_TLS_PROCTABLE()->MultiTexCoord2sv) -#define glMultiTexCoord3d (_GET_TLS_PROCTABLE()->MultiTexCoord3d) -#define glMultiTexCoord3dv (_GET_TLS_PROCTABLE()->MultiTexCoord3dv) -#define glMultiTexCoord3f (_GET_TLS_PROCTABLE()->MultiTexCoord3f) -#define glMultiTexCoord3fv (_GET_TLS_PROCTABLE()->MultiTexCoord3fv) -#define glMultiTexCoord3i (_GET_TLS_PROCTABLE()->MultiTexCoord3i) -#define glMultiTexCoord3iv (_GET_TLS_PROCTABLE()->MultiTexCoord3iv) -#define glMultiTexCoord3s (_GET_TLS_PROCTABLE()->MultiTexCoord3s) -#define glMultiTexCoord3sv (_GET_TLS_PROCTABLE()->MultiTexCoord3sv) -#define glMultiTexCoord4d (_GET_TLS_PROCTABLE()->MultiTexCoord4d) -#define glMultiTexCoord4dv (_GET_TLS_PROCTABLE()->MultiTexCoord4dv) -#define glMultiTexCoord4f (_GET_TLS_PROCTABLE()->MultiTexCoord4f) -#define glMultiTexCoord4fv (_GET_TLS_PROCTABLE()->MultiTexCoord4fv) -#define glMultiTexCoord4i (_GET_TLS_PROCTABLE()->MultiTexCoord4i) -#define glMultiTexCoord4iv (_GET_TLS_PROCTABLE()->MultiTexCoord4iv) -#define glMultiTexCoord4s (_GET_TLS_PROCTABLE()->MultiTexCoord4s) -#define glMultiTexCoord4sv (_GET_TLS_PROCTABLE()->MultiTexCoord4sv) -#define glLoadTransposeMatrixf (_GET_TLS_PROCTABLE()->LoadTransposeMatrixf) -#define glLoadTransposeMatrixd (_GET_TLS_PROCTABLE()->LoadTransposeMatrixd) -#define glMultTransposeMatrixf (_GET_TLS_PROCTABLE()->MultTransposeMatrixf) -#define glMultTransposeMatrixd (_GET_TLS_PROCTABLE()->MultTransposeMatrixd) -#define glSampleCoverage (_GET_TLS_PROCTABLE()->SampleCoverage) -#define glCompressedTexImage3D (_GET_TLS_PROCTABLE()->CompressedTexImage3D) -#define glCompressedTexImage2D (_GET_TLS_PROCTABLE()->CompressedTexImage2D) -#define glCompressedTexImage1D (_GET_TLS_PROCTABLE()->CompressedTexImage1D) -#define glCompressedTexSubImage3D (_GET_TLS_PROCTABLE()->CompressedTexSubImage3D) -#define glCompressedTexSubImage2D (_GET_TLS_PROCTABLE()->CompressedTexSubImage2D) -#define glCompressedTexSubImage1D (_GET_TLS_PROCTABLE()->CompressedTexSubImage1D) -#define glGetCompressedTexImage (_GET_TLS_PROCTABLE()->GetCompressedTexImage) -#define glBlendFuncSeparate (_GET_TLS_PROCTABLE()->BlendFuncSeparate) -#define glFogCoordf (_GET_TLS_PROCTABLE()->FogCoordf) -#define glFogCoordfv (_GET_TLS_PROCTABLE()->FogCoordfv) -#define glFogCoordd (_GET_TLS_PROCTABLE()->FogCoordd) -#define glFogCoorddv (_GET_TLS_PROCTABLE()->FogCoorddv) -#define glFogCoordPointer (_GET_TLS_PROCTABLE()->FogCoordPointer) -#define glMultiDrawArrays (_GET_TLS_PROCTABLE()->MultiDrawArrays) -#define glMultiDrawElements (_GET_TLS_PROCTABLE()->MultiDrawElements) -#define glPointParameterf (_GET_TLS_PROCTABLE()->PointParameterf) -#define glPointParameterfv (_GET_TLS_PROCTABLE()->PointParameterfv) -#define glPointParameteri (_GET_TLS_PROCTABLE()->PointParameteri) -#define glPointParameteriv (_GET_TLS_PROCTABLE()->PointParameteriv) -#define glSecondaryColor3b (_GET_TLS_PROCTABLE()->SecondaryColor3b) -#define glSecondaryColor3bv (_GET_TLS_PROCTABLE()->SecondaryColor3bv) -#define glSecondaryColor3d (_GET_TLS_PROCTABLE()->SecondaryColor3d) -#define glSecondaryColor3dv (_GET_TLS_PROCTABLE()->SecondaryColor3dv) -#define glSecondaryColor3f (_GET_TLS_PROCTABLE()->SecondaryColor3f) -#define glSecondaryColor3fv (_GET_TLS_PROCTABLE()->SecondaryColor3fv) -#define glSecondaryColor3i (_GET_TLS_PROCTABLE()->SecondaryColor3i) -#define glSecondaryColor3iv (_GET_TLS_PROCTABLE()->SecondaryColor3iv) -#define glSecondaryColor3s (_GET_TLS_PROCTABLE()->SecondaryColor3s) -#define glSecondaryColor3sv (_GET_TLS_PROCTABLE()->SecondaryColor3sv) -#define glSecondaryColor3ub (_GET_TLS_PROCTABLE()->SecondaryColor3ub) -#define glSecondaryColor3ubv (_GET_TLS_PROCTABLE()->SecondaryColor3ubv) -#define glSecondaryColor3ui (_GET_TLS_PROCTABLE()->SecondaryColor3ui) -#define glSecondaryColor3uiv (_GET_TLS_PROCTABLE()->SecondaryColor3uiv) -#define glSecondaryColor3us (_GET_TLS_PROCTABLE()->SecondaryColor3us) -#define glSecondaryColor3usv (_GET_TLS_PROCTABLE()->SecondaryColor3usv) -#define glSecondaryColorPointer (_GET_TLS_PROCTABLE()->SecondaryColorPointer) -#define glWindowPos2d (_GET_TLS_PROCTABLE()->WindowPos2d) -#define glWindowPos2dv (_GET_TLS_PROCTABLE()->WindowPos2dv) -#define glWindowPos2f (_GET_TLS_PROCTABLE()->WindowPos2f) -#define glWindowPos2fv (_GET_TLS_PROCTABLE()->WindowPos2fv) -#define glWindowPos2i (_GET_TLS_PROCTABLE()->WindowPos2i) -#define glWindowPos2iv (_GET_TLS_PROCTABLE()->WindowPos2iv) -#define glWindowPos2s (_GET_TLS_PROCTABLE()->WindowPos2s) -#define glWindowPos2sv (_GET_TLS_PROCTABLE()->WindowPos2sv) -#define glWindowPos3d (_GET_TLS_PROCTABLE()->WindowPos3d) -#define glWindowPos3dv (_GET_TLS_PROCTABLE()->WindowPos3dv) -#define glWindowPos3f (_GET_TLS_PROCTABLE()->WindowPos3f) -#define glWindowPos3fv (_GET_TLS_PROCTABLE()->WindowPos3fv) -#define glWindowPos3i (_GET_TLS_PROCTABLE()->WindowPos3i) -#define glWindowPos3iv (_GET_TLS_PROCTABLE()->WindowPos3iv) -#define glWindowPos3s (_GET_TLS_PROCTABLE()->WindowPos3s) -#define glWindowPos3sv (_GET_TLS_PROCTABLE()->WindowPos3sv) -#define glGenQueries (_GET_TLS_PROCTABLE()->GenQueries) -#define glDeleteQueries (_GET_TLS_PROCTABLE()->DeleteQueries) -#define glIsQuery (_GET_TLS_PROCTABLE()->IsQuery) -#define glBeginQuery (_GET_TLS_PROCTABLE()->BeginQuery) -#define glEndQuery (_GET_TLS_PROCTABLE()->EndQuery) -#define glGetQueryiv (_GET_TLS_PROCTABLE()->GetQueryiv) -#define glGetQueryObjectiv (_GET_TLS_PROCTABLE()->GetQueryObjectiv) -#define glGetQueryObjectuiv (_GET_TLS_PROCTABLE()->GetQueryObjectuiv) -#define glBindBuffer (_GET_TLS_PROCTABLE()->BindBuffer) -#define glDeleteBuffers (_GET_TLS_PROCTABLE()->DeleteBuffers) -#define glGenBuffers (_GET_TLS_PROCTABLE()->GenBuffers) -#define glIsBuffer (_GET_TLS_PROCTABLE()->IsBuffer) -#define glBufferData (_GET_TLS_PROCTABLE()->BufferData) -#define glBufferSubData (_GET_TLS_PROCTABLE()->BufferSubData) -#define glGetBufferSubData (_GET_TLS_PROCTABLE()->GetBufferSubData) -#define glMapBuffer (_GET_TLS_PROCTABLE()->MapBuffer) -#define glUnmapBuffer (_GET_TLS_PROCTABLE()->UnmapBuffer) -#define glGetBufferParameteriv (_GET_TLS_PROCTABLE()->GetBufferParameteriv) -#define glGetBufferPointerv (_GET_TLS_PROCTABLE()->GetBufferPointerv) -#define glActiveTextureARB (_GET_TLS_PROCTABLE()->ActiveTextureARB) -#define glClientActiveTextureARB (_GET_TLS_PROCTABLE()->ClientActiveTextureARB) -#define glMultiTexCoord1dARB (_GET_TLS_PROCTABLE()->MultiTexCoord1dARB) -#define glMultiTexCoord1dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord1dvARB) -#define glMultiTexCoord1fARB (_GET_TLS_PROCTABLE()->MultiTexCoord1fARB) -#define glMultiTexCoord1fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord1fvARB) -#define glMultiTexCoord1iARB (_GET_TLS_PROCTABLE()->MultiTexCoord1iARB) -#define glMultiTexCoord1ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord1ivARB) -#define glMultiTexCoord1sARB (_GET_TLS_PROCTABLE()->MultiTexCoord1sARB) -#define glMultiTexCoord1svARB (_GET_TLS_PROCTABLE()->MultiTexCoord1svARB) -#define glMultiTexCoord2dARB (_GET_TLS_PROCTABLE()->MultiTexCoord2dARB) -#define glMultiTexCoord2dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord2dvARB) -#define glMultiTexCoord2fARB (_GET_TLS_PROCTABLE()->MultiTexCoord2fARB) -#define glMultiTexCoord2fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord2fvARB) -#define glMultiTexCoord2iARB (_GET_TLS_PROCTABLE()->MultiTexCoord2iARB) -#define glMultiTexCoord2ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord2ivARB) -#define glMultiTexCoord2sARB (_GET_TLS_PROCTABLE()->MultiTexCoord2sARB) -#define glMultiTexCoord2svARB (_GET_TLS_PROCTABLE()->MultiTexCoord2svARB) -#define glMultiTexCoord3dARB (_GET_TLS_PROCTABLE()->MultiTexCoord3dARB) -#define glMultiTexCoord3dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord3dvARB) -#define glMultiTexCoord3fARB (_GET_TLS_PROCTABLE()->MultiTexCoord3fARB) -#define glMultiTexCoord3fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord3fvARB) -#define glMultiTexCoord3iARB (_GET_TLS_PROCTABLE()->MultiTexCoord3iARB) -#define glMultiTexCoord3ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord3ivARB) -#define glMultiTexCoord3sARB (_GET_TLS_PROCTABLE()->MultiTexCoord3sARB) -#define glMultiTexCoord3svARB (_GET_TLS_PROCTABLE()->MultiTexCoord3svARB) -#define glMultiTexCoord4dARB (_GET_TLS_PROCTABLE()->MultiTexCoord4dARB) -#define glMultiTexCoord4dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord4dvARB) -#define glMultiTexCoord4fARB (_GET_TLS_PROCTABLE()->MultiTexCoord4fARB) -#define glMultiTexCoord4fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord4fvARB) -#define glMultiTexCoord4iARB (_GET_TLS_PROCTABLE()->MultiTexCoord4iARB) -#define glMultiTexCoord4ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord4ivARB) -#define glMultiTexCoord4sARB (_GET_TLS_PROCTABLE()->MultiTexCoord4sARB) -#define glMultiTexCoord4svARB (_GET_TLS_PROCTABLE()->MultiTexCoord4svARB) -#define glLoadTransposeMatrixfARB (_GET_TLS_PROCTABLE()->LoadTransposeMatrixfARB) -#define glLoadTransposeMatrixdARB (_GET_TLS_PROCTABLE()->LoadTransposeMatrixdARB) -#define glMultTransposeMatrixfARB (_GET_TLS_PROCTABLE()->MultTransposeMatrixfARB) -#define glMultTransposeMatrixdARB (_GET_TLS_PROCTABLE()->MultTransposeMatrixdARB) -#define glSampleCoverageARB (_GET_TLS_PROCTABLE()->SampleCoverageARB) -#define glCompressedTexImage3DARB (_GET_TLS_PROCTABLE()->CompressedTexImage3DARB) -#define glCompressedTexImage2DARB (_GET_TLS_PROCTABLE()->CompressedTexImage2DARB) -#define glCompressedTexImage1DARB (_GET_TLS_PROCTABLE()->CompressedTexImage1DARB) -#define glCompressedTexSubImage3DARB (_GET_TLS_PROCTABLE()->CompressedTexSubImage3DARB) -#define glCompressedTexSubImage2DARB (_GET_TLS_PROCTABLE()->CompressedTexSubImage2DARB) -#define glCompressedTexSubImage1DARB (_GET_TLS_PROCTABLE()->CompressedTexSubImage1DARB) -#define glGetCompressedTexImageARB (_GET_TLS_PROCTABLE()->GetCompressedTexImageARB) -#define glPointParameterfARB (_GET_TLS_PROCTABLE()->PointParameterfARB) -#define glPointParameterfvARB (_GET_TLS_PROCTABLE()->PointParameterfvARB) -#define glWeightbvARB (_GET_TLS_PROCTABLE()->WeightbvARB) -#define glWeightsvARB (_GET_TLS_PROCTABLE()->WeightsvARB) -#define glWeightivARB (_GET_TLS_PROCTABLE()->WeightivARB) -#define glWeightfvARB (_GET_TLS_PROCTABLE()->WeightfvARB) -#define glWeightdvARB (_GET_TLS_PROCTABLE()->WeightdvARB) -#define glWeightubvARB (_GET_TLS_PROCTABLE()->WeightubvARB) -#define glWeightusvARB (_GET_TLS_PROCTABLE()->WeightusvARB) -#define glWeightuivARB (_GET_TLS_PROCTABLE()->WeightuivARB) -#define glWeightPointerARB (_GET_TLS_PROCTABLE()->WeightPointerARB) -#define glVertexBlendARB (_GET_TLS_PROCTABLE()->VertexBlendARB) -#define glCurrentPaletteMatrixARB (_GET_TLS_PROCTABLE()->CurrentPaletteMatrixARB) -#define glMatrixIndexubvARB (_GET_TLS_PROCTABLE()->MatrixIndexubvARB) -#define glMatrixIndexusvARB (_GET_TLS_PROCTABLE()->MatrixIndexusvARB) -#define glMatrixIndexuivARB (_GET_TLS_PROCTABLE()->MatrixIndexuivARB) -#define glMatrixIndexPointerARB (_GET_TLS_PROCTABLE()->MatrixIndexPointerARB) -#define glWindowPos2dARB (_GET_TLS_PROCTABLE()->WindowPos2dARB) -#define glWindowPos2dvARB (_GET_TLS_PROCTABLE()->WindowPos2dvARB) -#define glWindowPos2fARB (_GET_TLS_PROCTABLE()->WindowPos2fARB) -#define glWindowPos2fvARB (_GET_TLS_PROCTABLE()->WindowPos2fvARB) -#define glWindowPos2iARB (_GET_TLS_PROCTABLE()->WindowPos2iARB) -#define glWindowPos2ivARB (_GET_TLS_PROCTABLE()->WindowPos2ivARB) -#define glWindowPos2sARB (_GET_TLS_PROCTABLE()->WindowPos2sARB) -#define glWindowPos2svARB (_GET_TLS_PROCTABLE()->WindowPos2svARB) -#define glWindowPos3dARB (_GET_TLS_PROCTABLE()->WindowPos3dARB) -#define glWindowPos3dvARB (_GET_TLS_PROCTABLE()->WindowPos3dvARB) -#define glWindowPos3fARB (_GET_TLS_PROCTABLE()->WindowPos3fARB) -#define glWindowPos3fvARB (_GET_TLS_PROCTABLE()->WindowPos3fvARB) -#define glWindowPos3iARB (_GET_TLS_PROCTABLE()->WindowPos3iARB) -#define glWindowPos3ivARB (_GET_TLS_PROCTABLE()->WindowPos3ivARB) -#define glWindowPos3sARB (_GET_TLS_PROCTABLE()->WindowPos3sARB) -#define glWindowPos3svARB (_GET_TLS_PROCTABLE()->WindowPos3svARB) -#define glVertexAttrib1dARB (_GET_TLS_PROCTABLE()->VertexAttrib1dARB) -#define glVertexAttrib1dvARB (_GET_TLS_PROCTABLE()->VertexAttrib1dvARB) -#define glVertexAttrib1fARB (_GET_TLS_PROCTABLE()->VertexAttrib1fARB) -#define glVertexAttrib1fvARB (_GET_TLS_PROCTABLE()->VertexAttrib1fvARB) -#define glVertexAttrib1sARB (_GET_TLS_PROCTABLE()->VertexAttrib1sARB) -#define glVertexAttrib1svARB (_GET_TLS_PROCTABLE()->VertexAttrib1svARB) -#define glVertexAttrib2dARB (_GET_TLS_PROCTABLE()->VertexAttrib2dARB) -#define glVertexAttrib2dvARB (_GET_TLS_PROCTABLE()->VertexAttrib2dvARB) -#define glVertexAttrib2fARB (_GET_TLS_PROCTABLE()->VertexAttrib2fARB) -#define glVertexAttrib2fvARB (_GET_TLS_PROCTABLE()->VertexAttrib2fvARB) -#define glVertexAttrib2sARB (_GET_TLS_PROCTABLE()->VertexAttrib2sARB) -#define glVertexAttrib2svARB (_GET_TLS_PROCTABLE()->VertexAttrib2svARB) -#define glVertexAttrib3dARB (_GET_TLS_PROCTABLE()->VertexAttrib3dARB) -#define glVertexAttrib3dvARB (_GET_TLS_PROCTABLE()->VertexAttrib3dvARB) -#define glVertexAttrib3fARB (_GET_TLS_PROCTABLE()->VertexAttrib3fARB) -#define glVertexAttrib3fvARB (_GET_TLS_PROCTABLE()->VertexAttrib3fvARB) -#define glVertexAttrib3sARB (_GET_TLS_PROCTABLE()->VertexAttrib3sARB) -#define glVertexAttrib3svARB (_GET_TLS_PROCTABLE()->VertexAttrib3svARB) -#define glVertexAttrib4NbvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NbvARB) -#define glVertexAttrib4NivARB (_GET_TLS_PROCTABLE()->VertexAttrib4NivARB) -#define glVertexAttrib4NsvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NsvARB) -#define glVertexAttrib4NubARB (_GET_TLS_PROCTABLE()->VertexAttrib4NubARB) -#define glVertexAttrib4NubvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NubvARB) -#define glVertexAttrib4NuivARB (_GET_TLS_PROCTABLE()->VertexAttrib4NuivARB) -#define glVertexAttrib4NusvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NusvARB) -#define glVertexAttrib4bvARB (_GET_TLS_PROCTABLE()->VertexAttrib4bvARB) -#define glVertexAttrib4dARB (_GET_TLS_PROCTABLE()->VertexAttrib4dARB) -#define glVertexAttrib4dvARB (_GET_TLS_PROCTABLE()->VertexAttrib4dvARB) -#define glVertexAttrib4fARB (_GET_TLS_PROCTABLE()->VertexAttrib4fARB) -#define glVertexAttrib4fvARB (_GET_TLS_PROCTABLE()->VertexAttrib4fvARB) -#define glVertexAttrib4ivARB (_GET_TLS_PROCTABLE()->VertexAttrib4ivARB) -#define glVertexAttrib4sARB (_GET_TLS_PROCTABLE()->VertexAttrib4sARB) -#define glVertexAttrib4svARB (_GET_TLS_PROCTABLE()->VertexAttrib4svARB) -#define glVertexAttrib4ubvARB (_GET_TLS_PROCTABLE()->VertexAttrib4ubvARB) -#define glVertexAttrib4uivARB (_GET_TLS_PROCTABLE()->VertexAttrib4uivARB) -#define glVertexAttrib4usvARB (_GET_TLS_PROCTABLE()->VertexAttrib4usvARB) -#define glVertexAttribPointerARB (_GET_TLS_PROCTABLE()->VertexAttribPointerARB) -#define glEnableVertexAttribArrayARB (_GET_TLS_PROCTABLE()->EnableVertexAttribArrayARB) -#define glDisableVertexAttribArrayARB (_GET_TLS_PROCTABLE()->DisableVertexAttribArrayARB) -#define glProgramStringARB (_GET_TLS_PROCTABLE()->ProgramStringARB) -#define glBindProgramARB (_GET_TLS_PROCTABLE()->BindProgramARB) -#define glDeleteProgramsARB (_GET_TLS_PROCTABLE()->DeleteProgramsARB) -#define glGenProgramsARB (_GET_TLS_PROCTABLE()->GenProgramsARB) -#define glProgramEnvParameter4dARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4dARB) -#define glProgramEnvParameter4dvARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4dvARB) -#define glProgramEnvParameter4fARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4fARB) -#define glProgramEnvParameter4fvARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4fvARB) -#define glProgramLocalParameter4dARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4dARB) -#define glProgramLocalParameter4dvARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4dvARB) -#define glProgramLocalParameter4fARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4fARB) -#define glProgramLocalParameter4fvARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4fvARB) -#define glGetProgramEnvParameterdvARB (_GET_TLS_PROCTABLE()->GetProgramEnvParameterdvARB) -#define glGetProgramEnvParameterfvARB (_GET_TLS_PROCTABLE()->GetProgramEnvParameterfvARB) -#define glGetProgramLocalParameterdvARB (_GET_TLS_PROCTABLE()->GetProgramLocalParameterdvARB) -#define glGetProgramLocalParameterfvARB (_GET_TLS_PROCTABLE()->GetProgramLocalParameterfvARB) -#define glGetProgramivARB (_GET_TLS_PROCTABLE()->GetProgramivARB) -#define glGetProgramStringARB (_GET_TLS_PROCTABLE()->GetProgramStringARB) -#define glGetVertexAttribdvARB (_GET_TLS_PROCTABLE()->GetVertexAttribdvARB) -#define glGetVertexAttribfvARB (_GET_TLS_PROCTABLE()->GetVertexAttribfvARB) -#define glGetVertexAttribivARB (_GET_TLS_PROCTABLE()->GetVertexAttribivARB) -#define glGetVertexAttribPointervARB (_GET_TLS_PROCTABLE()->GetVertexAttribPointervARB) -#define glIsProgramARB (_GET_TLS_PROCTABLE()->IsProgramARB) -#define glBindBufferARB (_GET_TLS_PROCTABLE()->BindBufferARB) -#define glDeleteBuffersARB (_GET_TLS_PROCTABLE()->DeleteBuffersARB) -#define glGenBuffersARB (_GET_TLS_PROCTABLE()->GenBuffersARB) -#define glIsBufferARB (_GET_TLS_PROCTABLE()->IsBufferARB) -#define glBufferDataARB (_GET_TLS_PROCTABLE()->BufferDataARB) -#define glBufferSubDataARB (_GET_TLS_PROCTABLE()->BufferSubDataARB) -#define glGetBufferSubDataARB (_GET_TLS_PROCTABLE()->GetBufferSubDataARB) -#define glMapBufferARB (_GET_TLS_PROCTABLE()->MapBufferARB) -#define glUnmapBufferARB (_GET_TLS_PROCTABLE()->UnmapBufferARB) -#define glGetBufferParameterivARB (_GET_TLS_PROCTABLE()->GetBufferParameterivARB) -#define glGetBufferPointervARB (_GET_TLS_PROCTABLE()->GetBufferPointervARB) -#define glGenQueriesARB (_GET_TLS_PROCTABLE()->GenQueriesARB) -#define glDeleteQueriesARB (_GET_TLS_PROCTABLE()->DeleteQueriesARB) -#define glIsQueryARB (_GET_TLS_PROCTABLE()->IsQueryARB) -#define glBeginQueryARB (_GET_TLS_PROCTABLE()->BeginQueryARB) -#define glEndQueryARB (_GET_TLS_PROCTABLE()->EndQueryARB) -#define glGetQueryivARB (_GET_TLS_PROCTABLE()->GetQueryivARB) -#define glGetQueryObjectivARB (_GET_TLS_PROCTABLE()->GetQueryObjectivARB) -#define glGetQueryObjectuivARB (_GET_TLS_PROCTABLE()->GetQueryObjectuivARB) -#define glDeleteObjectARB (_GET_TLS_PROCTABLE()->DeleteObjectARB) -#define glGetHandleARB (_GET_TLS_PROCTABLE()->GetHandleARB) -#define glDetachObjectARB (_GET_TLS_PROCTABLE()->DetachObjectARB) -#define glCreateShaderObjectARB (_GET_TLS_PROCTABLE()->CreateShaderObjectARB) -#define glShaderSourceARB (_GET_TLS_PROCTABLE()->ShaderSourceARB) -#define glCompileShaderARB (_GET_TLS_PROCTABLE()->CompileShaderARB) -#define glCreateProgramObjectARB (_GET_TLS_PROCTABLE()->CreateProgramObjectARB) -#define glAttachObjectARB (_GET_TLS_PROCTABLE()->AttachObjectARB) -#define glLinkProgramARB (_GET_TLS_PROCTABLE()->LinkProgramARB) -#define glUseProgramObjectARB (_GET_TLS_PROCTABLE()->UseProgramObjectARB) -#define glValidateProgramARB (_GET_TLS_PROCTABLE()->ValidateProgramARB) -#define glUniform1fARB (_GET_TLS_PROCTABLE()->Uniform1fARB) -#define glUniform2fARB (_GET_TLS_PROCTABLE()->Uniform2fARB) -#define glUniform3fARB (_GET_TLS_PROCTABLE()->Uniform3fARB) -#define glUniform4fARB (_GET_TLS_PROCTABLE()->Uniform4fARB) -#define glUniform1iARB (_GET_TLS_PROCTABLE()->Uniform1iARB) -#define glUniform2iARB (_GET_TLS_PROCTABLE()->Uniform2iARB) -#define glUniform3iARB (_GET_TLS_PROCTABLE()->Uniform3iARB) -#define glUniform4iARB (_GET_TLS_PROCTABLE()->Uniform4iARB) -#define glUniform1fvARB (_GET_TLS_PROCTABLE()->Uniform1fvARB) -#define glUniform2fvARB (_GET_TLS_PROCTABLE()->Uniform2fvARB) -#define glUniform3fvARB (_GET_TLS_PROCTABLE()->Uniform3fvARB) -#define glUniform4fvARB (_GET_TLS_PROCTABLE()->Uniform4fvARB) -#define glUniform1ivARB (_GET_TLS_PROCTABLE()->Uniform1ivARB) -#define glUniform2ivARB (_GET_TLS_PROCTABLE()->Uniform2ivARB) -#define glUniform3ivARB (_GET_TLS_PROCTABLE()->Uniform3ivARB) -#define glUniform4ivARB (_GET_TLS_PROCTABLE()->Uniform4ivARB) -#define glUniformMatrix2fvARB (_GET_TLS_PROCTABLE()->UniformMatrix2fvARB) -#define glUniformMatrix3fvARB (_GET_TLS_PROCTABLE()->UniformMatrix3fvARB) -#define glUniformMatrix4fvARB (_GET_TLS_PROCTABLE()->UniformMatrix4fvARB) -#define glGetObjectParameterfvARB (_GET_TLS_PROCTABLE()->GetObjectParameterfvARB) -#define glGetObjectParameterivARB (_GET_TLS_PROCTABLE()->GetObjectParameterivARB) -#define glGetInfoLogARB (_GET_TLS_PROCTABLE()->GetInfoLogARB) -#define glGetAttachedObjectsARB (_GET_TLS_PROCTABLE()->GetAttachedObjectsARB) -#define glGetUniformLocationARB (_GET_TLS_PROCTABLE()->GetUniformLocationARB) -#define glGetActiveUniformARB (_GET_TLS_PROCTABLE()->GetActiveUniformARB) -#define glGetUniformfvARB (_GET_TLS_PROCTABLE()->GetUniformfvARB) -#define glGetUniformivARB (_GET_TLS_PROCTABLE()->GetUniformivARB) -#define glGetShaderSourceARB (_GET_TLS_PROCTABLE()->GetShaderSourceARB) -#define glBindAttribLocationARB (_GET_TLS_PROCTABLE()->BindAttribLocationARB) -#define glGetActiveAttribARB (_GET_TLS_PROCTABLE()->GetActiveAttribARB) -#define glGetAttribLocationARB (_GET_TLS_PROCTABLE()->GetAttribLocationARB) -#define glBlendColorEXT (_GET_TLS_PROCTABLE()->BlendColorEXT) -#define glPolygonOffsetEXT (_GET_TLS_PROCTABLE()->PolygonOffsetEXT) -#define glTexImage3DEXT (_GET_TLS_PROCTABLE()->TexImage3DEXT) -#define glTexSubImage3DEXT (_GET_TLS_PROCTABLE()->TexSubImage3DEXT) -#define glGetTexFilterFuncSGIS (_GET_TLS_PROCTABLE()->GetTexFilterFuncSGIS) -#define glTexFilterFuncSGIS (_GET_TLS_PROCTABLE()->TexFilterFuncSGIS) -#define glTexSubImage1DEXT (_GET_TLS_PROCTABLE()->TexSubImage1DEXT) -#define glTexSubImage2DEXT (_GET_TLS_PROCTABLE()->TexSubImage2DEXT) -#define glCopyTexImage1DEXT (_GET_TLS_PROCTABLE()->CopyTexImage1DEXT) -#define glCopyTexImage2DEXT (_GET_TLS_PROCTABLE()->CopyTexImage2DEXT) -#define glCopyTexSubImage1DEXT (_GET_TLS_PROCTABLE()->CopyTexSubImage1DEXT) -#define glCopyTexSubImage2DEXT (_GET_TLS_PROCTABLE()->CopyTexSubImage2DEXT) -#define glCopyTexSubImage3DEXT (_GET_TLS_PROCTABLE()->CopyTexSubImage3DEXT) -#define glGetHistogramEXT (_GET_TLS_PROCTABLE()->GetHistogramEXT) -#define glGetHistogramParameterfvEXT (_GET_TLS_PROCTABLE()->GetHistogramParameterfvEXT) -#define glGetHistogramParameterivEXT (_GET_TLS_PROCTABLE()->GetHistogramParameterivEXT) -#define glGetMinmaxEXT (_GET_TLS_PROCTABLE()->GetMinmaxEXT) -#define glGetMinmaxParameterfvEXT (_GET_TLS_PROCTABLE()->GetMinmaxParameterfvEXT) -#define glGetMinmaxParameterivEXT (_GET_TLS_PROCTABLE()->GetMinmaxParameterivEXT) -#define glHistogramEXT (_GET_TLS_PROCTABLE()->HistogramEXT) -#define glMinmaxEXT (_GET_TLS_PROCTABLE()->MinmaxEXT) -#define glResetHistogramEXT (_GET_TLS_PROCTABLE()->ResetHistogramEXT) -#define glResetMinmaxEXT (_GET_TLS_PROCTABLE()->ResetMinmaxEXT) -#define glConvolutionFilter1DEXT (_GET_TLS_PROCTABLE()->ConvolutionFilter1DEXT) -#define glConvolutionFilter2DEXT (_GET_TLS_PROCTABLE()->ConvolutionFilter2DEXT) -#define glConvolutionParameterfEXT (_GET_TLS_PROCTABLE()->ConvolutionParameterfEXT) -#define glConvolutionParameterfvEXT (_GET_TLS_PROCTABLE()->ConvolutionParameterfvEXT) -#define glConvolutionParameteriEXT (_GET_TLS_PROCTABLE()->ConvolutionParameteriEXT) -#define glConvolutionParameterivEXT (_GET_TLS_PROCTABLE()->ConvolutionParameterivEXT) -#define glCopyConvolutionFilter1DEXT (_GET_TLS_PROCTABLE()->CopyConvolutionFilter1DEXT) -#define glCopyConvolutionFilter2DEXT (_GET_TLS_PROCTABLE()->CopyConvolutionFilter2DEXT) -#define glGetConvolutionFilterEXT (_GET_TLS_PROCTABLE()->GetConvolutionFilterEXT) -#define glGetConvolutionParameterfvEXT (_GET_TLS_PROCTABLE()->GetConvolutionParameterfvEXT) -#define glGetConvolutionParameterivEXT (_GET_TLS_PROCTABLE()->GetConvolutionParameterivEXT) -#define glGetSeparableFilterEXT (_GET_TLS_PROCTABLE()->GetSeparableFilterEXT) -#define glSeparableFilter2DEXT (_GET_TLS_PROCTABLE()->SeparableFilter2DEXT) -#define glColorTableSGI (_GET_TLS_PROCTABLE()->ColorTableSGI) -#define glColorTableParameterfvSGI (_GET_TLS_PROCTABLE()->ColorTableParameterfvSGI) -#define glColorTableParameterivSGI (_GET_TLS_PROCTABLE()->ColorTableParameterivSGI) -#define glCopyColorTableSGI (_GET_TLS_PROCTABLE()->CopyColorTableSGI) -#define glGetColorTableSGI (_GET_TLS_PROCTABLE()->GetColorTableSGI) -#define glGetColorTableParameterfvSGI (_GET_TLS_PROCTABLE()->GetColorTableParameterfvSGI) -#define glGetColorTableParameterivSGI (_GET_TLS_PROCTABLE()->GetColorTableParameterivSGI) -#define glPixelTexGenSGIX (_GET_TLS_PROCTABLE()->PixelTexGenSGIX) -#define glPixelTexGenParameteriSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameteriSGIS) -#define glPixelTexGenParameterivSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameterivSGIS) -#define glPixelTexGenParameterfSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameterfSGIS) -#define glPixelTexGenParameterfvSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameterfvSGIS) -#define glGetPixelTexGenParameterivSGIS (_GET_TLS_PROCTABLE()->GetPixelTexGenParameterivSGIS) -#define glGetPixelTexGenParameterfvSGIS (_GET_TLS_PROCTABLE()->GetPixelTexGenParameterfvSGIS) -#define glTexImage4DSGIS (_GET_TLS_PROCTABLE()->TexImage4DSGIS) -#define glTexSubImage4DSGIS (_GET_TLS_PROCTABLE()->TexSubImage4DSGIS) -#define glAreTexturesResidentEXT (_GET_TLS_PROCTABLE()->AreTexturesResidentEXT) -#define glBindTextureEXT (_GET_TLS_PROCTABLE()->BindTextureEXT) -#define glDeleteTexturesEXT (_GET_TLS_PROCTABLE()->DeleteTexturesEXT) -#define glGenTexturesEXT (_GET_TLS_PROCTABLE()->GenTexturesEXT) -#define glIsTextureEXT (_GET_TLS_PROCTABLE()->IsTextureEXT) -#define glPrioritizeTexturesEXT (_GET_TLS_PROCTABLE()->PrioritizeTexturesEXT) -#define glDetailTexFuncSGIS (_GET_TLS_PROCTABLE()->DetailTexFuncSGIS) -#define glGetDetailTexFuncSGIS (_GET_TLS_PROCTABLE()->GetDetailTexFuncSGIS) -#define glSharpenTexFuncSGIS (_GET_TLS_PROCTABLE()->SharpenTexFuncSGIS) -#define glGetSharpenTexFuncSGIS (_GET_TLS_PROCTABLE()->GetSharpenTexFuncSGIS) -#define glSampleMaskSGIS (_GET_TLS_PROCTABLE()->SampleMaskSGIS) -#define glSamplePatternSGIS (_GET_TLS_PROCTABLE()->SamplePatternSGIS) -#define glArrayElementEXT (_GET_TLS_PROCTABLE()->ArrayElementEXT) -#define glColorPointerEXT (_GET_TLS_PROCTABLE()->ColorPointerEXT) -#define glDrawArraysEXT (_GET_TLS_PROCTABLE()->DrawArraysEXT) -#define glEdgeFlagPointerEXT (_GET_TLS_PROCTABLE()->EdgeFlagPointerEXT) -#define glGetPointervEXT (_GET_TLS_PROCTABLE()->GetPointervEXT) -#define glIndexPointerEXT (_GET_TLS_PROCTABLE()->IndexPointerEXT) -#define glNormalPointerEXT (_GET_TLS_PROCTABLE()->NormalPointerEXT) -#define glTexCoordPointerEXT (_GET_TLS_PROCTABLE()->TexCoordPointerEXT) -#define glVertexPointerEXT (_GET_TLS_PROCTABLE()->VertexPointerEXT) -#define glBlendEquationEXT (_GET_TLS_PROCTABLE()->BlendEquationEXT) -#define glSpriteParameterfSGIX (_GET_TLS_PROCTABLE()->SpriteParameterfSGIX) -#define glSpriteParameterfvSGIX (_GET_TLS_PROCTABLE()->SpriteParameterfvSGIX) -#define glSpriteParameteriSGIX (_GET_TLS_PROCTABLE()->SpriteParameteriSGIX) -#define glSpriteParameterivSGIX (_GET_TLS_PROCTABLE()->SpriteParameterivSGIX) -#define glPointParameterfEXT (_GET_TLS_PROCTABLE()->PointParameterfEXT) -#define glPointParameterfvEXT (_GET_TLS_PROCTABLE()->PointParameterfvEXT) -#define glPointParameterfSGIS (_GET_TLS_PROCTABLE()->PointParameterfSGIS) -#define glPointParameterfvSGIS (_GET_TLS_PROCTABLE()->PointParameterfvSGIS) -#define glGetInstrumentsSGIX (_GET_TLS_PROCTABLE()->GetInstrumentsSGIX) -#define glInstrumentsBufferSGIX (_GET_TLS_PROCTABLE()->InstrumentsBufferSGIX) -#define glPollInstrumentsSGIX (_GET_TLS_PROCTABLE()->PollInstrumentsSGIX) -#define glReadInstrumentsSGIX (_GET_TLS_PROCTABLE()->ReadInstrumentsSGIX) -#define glStartInstrumentsSGIX (_GET_TLS_PROCTABLE()->StartInstrumentsSGIX) -#define glStopInstrumentsSGIX (_GET_TLS_PROCTABLE()->StopInstrumentsSGIX) -#define glFrameZoomSGIX (_GET_TLS_PROCTABLE()->FrameZoomSGIX) -#define glTagSampleBufferSGIX (_GET_TLS_PROCTABLE()->TagSampleBufferSGIX) -#define glDeformationMap3dSGIX (_GET_TLS_PROCTABLE()->DeformationMap3dSGIX) -#define glDeformationMap3fSGIX (_GET_TLS_PROCTABLE()->DeformationMap3fSGIX) -#define glDeformSGIX (_GET_TLS_PROCTABLE()->DeformSGIX) -#define glLoadIdentityDeformationMapSGIX (_GET_TLS_PROCTABLE()->LoadIdentityDeformationMapSGIX) -#define glReferencePlaneSGIX (_GET_TLS_PROCTABLE()->ReferencePlaneSGIX) -#define glFlushRasterSGIX (_GET_TLS_PROCTABLE()->FlushRasterSGIX) -#define glFogFuncSGIS (_GET_TLS_PROCTABLE()->FogFuncSGIS) -#define glGetFogFuncSGIS (_GET_TLS_PROCTABLE()->GetFogFuncSGIS) -#define glImageTransformParameteriHP (_GET_TLS_PROCTABLE()->ImageTransformParameteriHP) -#define glImageTransformParameterfHP (_GET_TLS_PROCTABLE()->ImageTransformParameterfHP) -#define glImageTransformParameterivHP (_GET_TLS_PROCTABLE()->ImageTransformParameterivHP) -#define glImageTransformParameterfvHP (_GET_TLS_PROCTABLE()->ImageTransformParameterfvHP) -#define glGetImageTransformParameterivHP (_GET_TLS_PROCTABLE()->GetImageTransformParameterivHP) -#define glGetImageTransformParameterfvHP (_GET_TLS_PROCTABLE()->GetImageTransformParameterfvHP) -#define glColorSubTableEXT (_GET_TLS_PROCTABLE()->ColorSubTableEXT) -#define glCopyColorSubTableEXT (_GET_TLS_PROCTABLE()->CopyColorSubTableEXT) -#define glHintPGI (_GET_TLS_PROCTABLE()->HintPGI) -#define glColorTableEXT (_GET_TLS_PROCTABLE()->ColorTableEXT) -#define glGetColorTableEXT (_GET_TLS_PROCTABLE()->GetColorTableEXT) -#define glGetColorTableParameterivEXT (_GET_TLS_PROCTABLE()->GetColorTableParameterivEXT) -#define glGetColorTableParameterfvEXT (_GET_TLS_PROCTABLE()->GetColorTableParameterfvEXT) -#define glGetListParameterfvSGIX (_GET_TLS_PROCTABLE()->GetListParameterfvSGIX) -#define glGetListParameterivSGIX (_GET_TLS_PROCTABLE()->GetListParameterivSGIX) -#define glListParameterfSGIX (_GET_TLS_PROCTABLE()->ListParameterfSGIX) -#define glListParameterfvSGIX (_GET_TLS_PROCTABLE()->ListParameterfvSGIX) -#define glListParameteriSGIX (_GET_TLS_PROCTABLE()->ListParameteriSGIX) -#define glListParameterivSGIX (_GET_TLS_PROCTABLE()->ListParameterivSGIX) -#define glIndexMaterialEXT (_GET_TLS_PROCTABLE()->IndexMaterialEXT) -#define glIndexFuncEXT (_GET_TLS_PROCTABLE()->IndexFuncEXT) -#define glLockArraysEXT (_GET_TLS_PROCTABLE()->LockArraysEXT) -#define glUnlockArraysEXT (_GET_TLS_PROCTABLE()->UnlockArraysEXT) -#define glCullParameterdvEXT (_GET_TLS_PROCTABLE()->CullParameterdvEXT) -#define glCullParameterfvEXT (_GET_TLS_PROCTABLE()->CullParameterfvEXT) -#define glFragmentColorMaterialSGIX (_GET_TLS_PROCTABLE()->FragmentColorMaterialSGIX) -#define glFragmentLightfSGIX (_GET_TLS_PROCTABLE()->FragmentLightfSGIX) -#define glFragmentLightfvSGIX (_GET_TLS_PROCTABLE()->FragmentLightfvSGIX) -#define glFragmentLightiSGIX (_GET_TLS_PROCTABLE()->FragmentLightiSGIX) -#define glFragmentLightivSGIX (_GET_TLS_PROCTABLE()->FragmentLightivSGIX) -#define glFragmentLightModelfSGIX (_GET_TLS_PROCTABLE()->FragmentLightModelfSGIX) -#define glFragmentLightModelfvSGIX (_GET_TLS_PROCTABLE()->FragmentLightModelfvSGIX) -#define glFragmentLightModeliSGIX (_GET_TLS_PROCTABLE()->FragmentLightModeliSGIX) -#define glFragmentLightModelivSGIX (_GET_TLS_PROCTABLE()->FragmentLightModelivSGIX) -#define glFragmentMaterialfSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialfSGIX) -#define glFragmentMaterialfvSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialfvSGIX) -#define glFragmentMaterialiSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialiSGIX) -#define glFragmentMaterialivSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialivSGIX) -#define glGetFragmentLightfvSGIX (_GET_TLS_PROCTABLE()->GetFragmentLightfvSGIX) -#define glGetFragmentLightivSGIX (_GET_TLS_PROCTABLE()->GetFragmentLightivSGIX) -#define glGetFragmentMaterialfvSGIX (_GET_TLS_PROCTABLE()->GetFragmentMaterialfvSGIX) -#define glGetFragmentMaterialivSGIX (_GET_TLS_PROCTABLE()->GetFragmentMaterialivSGIX) -#define glLightEnviSGIX (_GET_TLS_PROCTABLE()->LightEnviSGIX) -#define glDrawRangeElementsEXT (_GET_TLS_PROCTABLE()->DrawRangeElementsEXT) -#define glApplyTextureEXT (_GET_TLS_PROCTABLE()->ApplyTextureEXT) -#define glTextureLightEXT (_GET_TLS_PROCTABLE()->TextureLightEXT) -#define glTextureMaterialEXT (_GET_TLS_PROCTABLE()->TextureMaterialEXT) -#define glAsyncMarkerSGIX (_GET_TLS_PROCTABLE()->AsyncMarkerSGIX) -#define glFinishAsyncSGIX (_GET_TLS_PROCTABLE()->FinishAsyncSGIX) -#define glPollAsyncSGIX (_GET_TLS_PROCTABLE()->PollAsyncSGIX) -#define glGenAsyncMarkersSGIX (_GET_TLS_PROCTABLE()->GenAsyncMarkersSGIX) -#define glDeleteAsyncMarkersSGIX (_GET_TLS_PROCTABLE()->DeleteAsyncMarkersSGIX) -#define glIsAsyncMarkerSGIX (_GET_TLS_PROCTABLE()->IsAsyncMarkerSGIX) -#define glVertexPointervINTEL (_GET_TLS_PROCTABLE()->VertexPointervINTEL) -#define glNormalPointervINTEL (_GET_TLS_PROCTABLE()->NormalPointervINTEL) -#define glColorPointervINTEL (_GET_TLS_PROCTABLE()->ColorPointervINTEL) -#define glTexCoordPointervINTEL (_GET_TLS_PROCTABLE()->TexCoordPointervINTEL) -#define glPixelTransformParameteriEXT (_GET_TLS_PROCTABLE()->PixelTransformParameteriEXT) -#define glPixelTransformParameterfEXT (_GET_TLS_PROCTABLE()->PixelTransformParameterfEXT) -#define glPixelTransformParameterivEXT (_GET_TLS_PROCTABLE()->PixelTransformParameterivEXT) -#define glPixelTransformParameterfvEXT (_GET_TLS_PROCTABLE()->PixelTransformParameterfvEXT) -#define glSecondaryColor3bEXT (_GET_TLS_PROCTABLE()->SecondaryColor3bEXT) -#define glSecondaryColor3bvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3bvEXT) -#define glSecondaryColor3dEXT (_GET_TLS_PROCTABLE()->SecondaryColor3dEXT) -#define glSecondaryColor3dvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3dvEXT) -#define glSecondaryColor3fEXT (_GET_TLS_PROCTABLE()->SecondaryColor3fEXT) -#define glSecondaryColor3fvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3fvEXT) -#define glSecondaryColor3iEXT (_GET_TLS_PROCTABLE()->SecondaryColor3iEXT) -#define glSecondaryColor3ivEXT (_GET_TLS_PROCTABLE()->SecondaryColor3ivEXT) -#define glSecondaryColor3sEXT (_GET_TLS_PROCTABLE()->SecondaryColor3sEXT) -#define glSecondaryColor3svEXT (_GET_TLS_PROCTABLE()->SecondaryColor3svEXT) -#define glSecondaryColor3ubEXT (_GET_TLS_PROCTABLE()->SecondaryColor3ubEXT) -#define glSecondaryColor3ubvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3ubvEXT) -#define glSecondaryColor3uiEXT (_GET_TLS_PROCTABLE()->SecondaryColor3uiEXT) -#define glSecondaryColor3uivEXT (_GET_TLS_PROCTABLE()->SecondaryColor3uivEXT) -#define glSecondaryColor3usEXT (_GET_TLS_PROCTABLE()->SecondaryColor3usEXT) -#define glSecondaryColor3usvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3usvEXT) -#define glSecondaryColorPointerEXT (_GET_TLS_PROCTABLE()->SecondaryColorPointerEXT) -#define glTextureNormalEXT (_GET_TLS_PROCTABLE()->TextureNormalEXT) -#define glMultiDrawArraysEXT (_GET_TLS_PROCTABLE()->MultiDrawArraysEXT) -#define glMultiDrawElementsEXT (_GET_TLS_PROCTABLE()->MultiDrawElementsEXT) -#define glFogCoordfEXT (_GET_TLS_PROCTABLE()->FogCoordfEXT) -#define glFogCoordfvEXT (_GET_TLS_PROCTABLE()->FogCoordfvEXT) -#define glFogCoorddEXT (_GET_TLS_PROCTABLE()->FogCoorddEXT) -#define glFogCoorddvEXT (_GET_TLS_PROCTABLE()->FogCoorddvEXT) -#define glFogCoordPointerEXT (_GET_TLS_PROCTABLE()->FogCoordPointerEXT) -#define glTangent3bEXT (_GET_TLS_PROCTABLE()->Tangent3bEXT) -#define glTangent3bvEXT (_GET_TLS_PROCTABLE()->Tangent3bvEXT) -#define glTangent3dEXT (_GET_TLS_PROCTABLE()->Tangent3dEXT) -#define glTangent3dvEXT (_GET_TLS_PROCTABLE()->Tangent3dvEXT) -#define glTangent3fEXT (_GET_TLS_PROCTABLE()->Tangent3fEXT) -#define glTangent3fvEXT (_GET_TLS_PROCTABLE()->Tangent3fvEXT) -#define glTangent3iEXT (_GET_TLS_PROCTABLE()->Tangent3iEXT) -#define glTangent3ivEXT (_GET_TLS_PROCTABLE()->Tangent3ivEXT) -#define glTangent3sEXT (_GET_TLS_PROCTABLE()->Tangent3sEXT) -#define glTangent3svEXT (_GET_TLS_PROCTABLE()->Tangent3svEXT) -#define glBinormal3bEXT (_GET_TLS_PROCTABLE()->Binormal3bEXT) -#define glBinormal3bvEXT (_GET_TLS_PROCTABLE()->Binormal3bvEXT) -#define glBinormal3dEXT (_GET_TLS_PROCTABLE()->Binormal3dEXT) -#define glBinormal3dvEXT (_GET_TLS_PROCTABLE()->Binormal3dvEXT) -#define glBinormal3fEXT (_GET_TLS_PROCTABLE()->Binormal3fEXT) -#define glBinormal3fvEXT (_GET_TLS_PROCTABLE()->Binormal3fvEXT) -#define glBinormal3iEXT (_GET_TLS_PROCTABLE()->Binormal3iEXT) -#define glBinormal3ivEXT (_GET_TLS_PROCTABLE()->Binormal3ivEXT) -#define glBinormal3sEXT (_GET_TLS_PROCTABLE()->Binormal3sEXT) -#define glBinormal3svEXT (_GET_TLS_PROCTABLE()->Binormal3svEXT) -#define glTangentPointerEXT (_GET_TLS_PROCTABLE()->TangentPointerEXT) -#define glBinormalPointerEXT (_GET_TLS_PROCTABLE()->BinormalPointerEXT) -#define glFinishTextureSUNX (_GET_TLS_PROCTABLE()->FinishTextureSUNX) -#define glGlobalAlphaFactorbSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorbSUN) -#define glGlobalAlphaFactorsSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorsSUN) -#define glGlobalAlphaFactoriSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactoriSUN) -#define glGlobalAlphaFactorfSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorfSUN) -#define glGlobalAlphaFactordSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactordSUN) -#define glGlobalAlphaFactorubSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorubSUN) -#define glGlobalAlphaFactorusSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorusSUN) -#define glGlobalAlphaFactoruiSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactoruiSUN) -#define glReplacementCodeuiSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiSUN) -#define glReplacementCodeusSUN (_GET_TLS_PROCTABLE()->ReplacementCodeusSUN) -#define glReplacementCodeubSUN (_GET_TLS_PROCTABLE()->ReplacementCodeubSUN) -#define glReplacementCodeuivSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuivSUN) -#define glReplacementCodeusvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeusvSUN) -#define glReplacementCodeubvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeubvSUN) -#define glReplacementCodePointerSUN (_GET_TLS_PROCTABLE()->ReplacementCodePointerSUN) -#define glColor4ubVertex2fSUN (_GET_TLS_PROCTABLE()->Color4ubVertex2fSUN) -#define glColor4ubVertex2fvSUN (_GET_TLS_PROCTABLE()->Color4ubVertex2fvSUN) -#define glColor4ubVertex3fSUN (_GET_TLS_PROCTABLE()->Color4ubVertex3fSUN) -#define glColor4ubVertex3fvSUN (_GET_TLS_PROCTABLE()->Color4ubVertex3fvSUN) -#define glColor3fVertex3fSUN (_GET_TLS_PROCTABLE()->Color3fVertex3fSUN) -#define glColor3fVertex3fvSUN (_GET_TLS_PROCTABLE()->Color3fVertex3fvSUN) -#define glNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->Normal3fVertex3fSUN) -#define glNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->Normal3fVertex3fvSUN) -#define glColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->Color4fNormal3fVertex3fSUN) -#define glColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->Color4fNormal3fVertex3fvSUN) -#define glTexCoord2fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fVertex3fSUN) -#define glTexCoord2fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fVertex3fvSUN) -#define glTexCoord4fVertex4fSUN (_GET_TLS_PROCTABLE()->TexCoord4fVertex4fSUN) -#define glTexCoord4fVertex4fvSUN (_GET_TLS_PROCTABLE()->TexCoord4fVertex4fvSUN) -#define glTexCoord2fColor4ubVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4ubVertex3fSUN) -#define glTexCoord2fColor4ubVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4ubVertex3fvSUN) -#define glTexCoord2fColor3fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor3fVertex3fSUN) -#define glTexCoord2fColor3fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor3fVertex3fvSUN) -#define glTexCoord2fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fNormal3fVertex3fSUN) -#define glTexCoord2fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fNormal3fVertex3fvSUN) -#define glTexCoord2fColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4fNormal3fVertex3fSUN) -#define glTexCoord2fColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4fNormal3fVertex3fvSUN) -#define glTexCoord4fColor4fNormal3fVertex4fSUN (_GET_TLS_PROCTABLE()->TexCoord4fColor4fNormal3fVertex4fSUN) -#define glTexCoord4fColor4fNormal3fVertex4fvSUN (_GET_TLS_PROCTABLE()->TexCoord4fColor4fNormal3fVertex4fvSUN) -#define glReplacementCodeuiVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiVertex3fSUN) -#define glReplacementCodeuiVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiVertex3fvSUN) -#define glReplacementCodeuiColor4ubVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4ubVertex3fSUN) -#define glReplacementCodeuiColor4ubVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4ubVertex3fvSUN) -#define glReplacementCodeuiColor3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor3fVertex3fSUN) -#define glReplacementCodeuiColor3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor3fVertex3fvSUN) -#define glReplacementCodeuiNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiNormal3fVertex3fSUN) -#define glReplacementCodeuiNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiNormal3fVertex3fvSUN) -#define glReplacementCodeuiColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4fNormal3fVertex3fSUN) -#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4fNormal3fVertex3fvSUN) -#define glReplacementCodeuiTexCoord2fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fVertex3fSUN) -#define glReplacementCodeuiTexCoord2fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fVertex3fvSUN) -#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) -#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) -#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) -#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) -#define glBlendFuncSeparateEXT (_GET_TLS_PROCTABLE()->BlendFuncSeparateEXT) -#define glBlendFuncSeparateINGR (_GET_TLS_PROCTABLE()->BlendFuncSeparateINGR) -#define glVertexWeightfEXT (_GET_TLS_PROCTABLE()->VertexWeightfEXT) -#define glVertexWeightfvEXT (_GET_TLS_PROCTABLE()->VertexWeightfvEXT) -#define glVertexWeightPointerEXT (_GET_TLS_PROCTABLE()->VertexWeightPointerEXT) -#define glFlushVertexArrayRangeNV (_GET_TLS_PROCTABLE()->FlushVertexArrayRangeNV) -#define glVertexArrayRangeNV (_GET_TLS_PROCTABLE()->VertexArrayRangeNV) -#define glCombinerParameterfvNV (_GET_TLS_PROCTABLE()->CombinerParameterfvNV) -#define glCombinerParameterfNV (_GET_TLS_PROCTABLE()->CombinerParameterfNV) -#define glCombinerParameterivNV (_GET_TLS_PROCTABLE()->CombinerParameterivNV) -#define glCombinerParameteriNV (_GET_TLS_PROCTABLE()->CombinerParameteriNV) -#define glCombinerInputNV (_GET_TLS_PROCTABLE()->CombinerInputNV) -#define glCombinerOutputNV (_GET_TLS_PROCTABLE()->CombinerOutputNV) -#define glFinalCombinerInputNV (_GET_TLS_PROCTABLE()->FinalCombinerInputNV) -#define glGetCombinerInputParameterfvNV (_GET_TLS_PROCTABLE()->GetCombinerInputParameterfvNV) -#define glGetCombinerInputParameterivNV (_GET_TLS_PROCTABLE()->GetCombinerInputParameterivNV) -#define glGetCombinerOutputParameterfvNV (_GET_TLS_PROCTABLE()->GetCombinerOutputParameterfvNV) -#define glGetCombinerOutputParameterivNV (_GET_TLS_PROCTABLE()->GetCombinerOutputParameterivNV) -#define glGetFinalCombinerInputParameterfvNV (_GET_TLS_PROCTABLE()->GetFinalCombinerInputParameterfvNV) -#define glGetFinalCombinerInputParameterivNV (_GET_TLS_PROCTABLE()->GetFinalCombinerInputParameterivNV) -#define glResizeBuffersMESA (_GET_TLS_PROCTABLE()->ResizeBuffersMESA) -#define glWindowPos2dMESA (_GET_TLS_PROCTABLE()->WindowPos2dMESA) -#define glWindowPos2dvMESA (_GET_TLS_PROCTABLE()->WindowPos2dvMESA) -#define glWindowPos2fMESA (_GET_TLS_PROCTABLE()->WindowPos2fMESA) -#define glWindowPos2fvMESA (_GET_TLS_PROCTABLE()->WindowPos2fvMESA) -#define glWindowPos2iMESA (_GET_TLS_PROCTABLE()->WindowPos2iMESA) -#define glWindowPos2ivMESA (_GET_TLS_PROCTABLE()->WindowPos2ivMESA) -#define glWindowPos2sMESA (_GET_TLS_PROCTABLE()->WindowPos2sMESA) -#define glWindowPos2svMESA (_GET_TLS_PROCTABLE()->WindowPos2svMESA) -#define glWindowPos3dMESA (_GET_TLS_PROCTABLE()->WindowPos3dMESA) -#define glWindowPos3dvMESA (_GET_TLS_PROCTABLE()->WindowPos3dvMESA) -#define glWindowPos3fMESA (_GET_TLS_PROCTABLE()->WindowPos3fMESA) -#define glWindowPos3fvMESA (_GET_TLS_PROCTABLE()->WindowPos3fvMESA) -#define glWindowPos3iMESA (_GET_TLS_PROCTABLE()->WindowPos3iMESA) -#define glWindowPos3ivMESA (_GET_TLS_PROCTABLE()->WindowPos3ivMESA) -#define glWindowPos3sMESA (_GET_TLS_PROCTABLE()->WindowPos3sMESA) -#define glWindowPos3svMESA (_GET_TLS_PROCTABLE()->WindowPos3svMESA) -#define glWindowPos4dMESA (_GET_TLS_PROCTABLE()->WindowPos4dMESA) -#define glWindowPos4dvMESA (_GET_TLS_PROCTABLE()->WindowPos4dvMESA) -#define glWindowPos4fMESA (_GET_TLS_PROCTABLE()->WindowPos4fMESA) -#define glWindowPos4fvMESA (_GET_TLS_PROCTABLE()->WindowPos4fvMESA) -#define glWindowPos4iMESA (_GET_TLS_PROCTABLE()->WindowPos4iMESA) -#define glWindowPos4ivMESA (_GET_TLS_PROCTABLE()->WindowPos4ivMESA) -#define glWindowPos4sMESA (_GET_TLS_PROCTABLE()->WindowPos4sMESA) -#define glWindowPos4svMESA (_GET_TLS_PROCTABLE()->WindowPos4svMESA) -#define glMultiModeDrawArraysIBM (_GET_TLS_PROCTABLE()->MultiModeDrawArraysIBM) -#define glMultiModeDrawElementsIBM (_GET_TLS_PROCTABLE()->MultiModeDrawElementsIBM) -#define glColorPointerListIBM (_GET_TLS_PROCTABLE()->ColorPointerListIBM) -#define glSecondaryColorPointerListIBM (_GET_TLS_PROCTABLE()->SecondaryColorPointerListIBM) -#define glEdgeFlagPointerListIBM (_GET_TLS_PROCTABLE()->EdgeFlagPointerListIBM) -#define glFogCoordPointerListIBM (_GET_TLS_PROCTABLE()->FogCoordPointerListIBM) -#define glIndexPointerListIBM (_GET_TLS_PROCTABLE()->IndexPointerListIBM) -#define glNormalPointerListIBM (_GET_TLS_PROCTABLE()->NormalPointerListIBM) -#define glTexCoordPointerListIBM (_GET_TLS_PROCTABLE()->TexCoordPointerListIBM) -#define glVertexPointerListIBM (_GET_TLS_PROCTABLE()->VertexPointerListIBM) -#define glTbufferMask3DFX (_GET_TLS_PROCTABLE()->TbufferMask3DFX) -#define glSampleMaskEXT (_GET_TLS_PROCTABLE()->SampleMaskEXT) -#define glSamplePatternEXT (_GET_TLS_PROCTABLE()->SamplePatternEXT) -#define glTextureColorMaskSGIS (_GET_TLS_PROCTABLE()->TextureColorMaskSGIS) -#define glIglooInterfaceSGIX (_GET_TLS_PROCTABLE()->IglooInterfaceSGIX) -#define glDeleteFencesNV (_GET_TLS_PROCTABLE()->DeleteFencesNV) -#define glGenFencesNV (_GET_TLS_PROCTABLE()->GenFencesNV) -#define glIsFenceNV (_GET_TLS_PROCTABLE()->IsFenceNV) -#define glTestFenceNV (_GET_TLS_PROCTABLE()->TestFenceNV) -#define glGetFenceivNV (_GET_TLS_PROCTABLE()->GetFenceivNV) -#define glFinishFenceNV (_GET_TLS_PROCTABLE()->FinishFenceNV) -#define glSetFenceNV (_GET_TLS_PROCTABLE()->SetFenceNV) -#define glMapControlPointsNV (_GET_TLS_PROCTABLE()->MapControlPointsNV) -#define glMapParameterivNV (_GET_TLS_PROCTABLE()->MapParameterivNV) -#define glMapParameterfvNV (_GET_TLS_PROCTABLE()->MapParameterfvNV) -#define glGetMapControlPointsNV (_GET_TLS_PROCTABLE()->GetMapControlPointsNV) -#define glGetMapParameterivNV (_GET_TLS_PROCTABLE()->GetMapParameterivNV) -#define glGetMapParameterfvNV (_GET_TLS_PROCTABLE()->GetMapParameterfvNV) -#define glGetMapAttribParameterivNV (_GET_TLS_PROCTABLE()->GetMapAttribParameterivNV) -#define glGetMapAttribParameterfvNV (_GET_TLS_PROCTABLE()->GetMapAttribParameterfvNV) -#define glEvalMapsNV (_GET_TLS_PROCTABLE()->EvalMapsNV) -#define glCombinerStageParameterfvNV (_GET_TLS_PROCTABLE()->CombinerStageParameterfvNV) -#define glGetCombinerStageParameterfvNV (_GET_TLS_PROCTABLE()->GetCombinerStageParameterfvNV) -#define glAreProgramsResidentNV (_GET_TLS_PROCTABLE()->AreProgramsResidentNV) -#define glBindProgramNV (_GET_TLS_PROCTABLE()->BindProgramNV) -#define glDeleteProgramsNV (_GET_TLS_PROCTABLE()->DeleteProgramsNV) -#define glExecuteProgramNV (_GET_TLS_PROCTABLE()->ExecuteProgramNV) -#define glGenProgramsNV (_GET_TLS_PROCTABLE()->GenProgramsNV) -#define glGetProgramParameterdvNV (_GET_TLS_PROCTABLE()->GetProgramParameterdvNV) -#define glGetProgramParameterfvNV (_GET_TLS_PROCTABLE()->GetProgramParameterfvNV) -#define glGetProgramivNV (_GET_TLS_PROCTABLE()->GetProgramivNV) -#define glGetProgramStringNV (_GET_TLS_PROCTABLE()->GetProgramStringNV) -#define glGetTrackMatrixivNV (_GET_TLS_PROCTABLE()->GetTrackMatrixivNV) -#define glGetVertexAttribdvNV (_GET_TLS_PROCTABLE()->GetVertexAttribdvNV) -#define glGetVertexAttribfvNV (_GET_TLS_PROCTABLE()->GetVertexAttribfvNV) -#define glGetVertexAttribivNV (_GET_TLS_PROCTABLE()->GetVertexAttribivNV) -#define glGetVertexAttribPointervNV (_GET_TLS_PROCTABLE()->GetVertexAttribPointervNV) -#define glIsProgramNV (_GET_TLS_PROCTABLE()->IsProgramNV) -#define glLoadProgramNV (_GET_TLS_PROCTABLE()->LoadProgramNV) -#define glProgramParameter4dNV (_GET_TLS_PROCTABLE()->ProgramParameter4dNV) -#define glProgramParameter4dvNV (_GET_TLS_PROCTABLE()->ProgramParameter4dvNV) -#define glProgramParameter4fNV (_GET_TLS_PROCTABLE()->ProgramParameter4fNV) -#define glProgramParameter4fvNV (_GET_TLS_PROCTABLE()->ProgramParameter4fvNV) -#define glProgramParameters4dvNV (_GET_TLS_PROCTABLE()->ProgramParameters4dvNV) -#define glProgramParameters4fvNV (_GET_TLS_PROCTABLE()->ProgramParameters4fvNV) -#define glRequestResidentProgramsNV (_GET_TLS_PROCTABLE()->RequestResidentProgramsNV) -#define glTrackMatrixNV (_GET_TLS_PROCTABLE()->TrackMatrixNV) -#define glVertexAttribPointerNV (_GET_TLS_PROCTABLE()->VertexAttribPointerNV) -#define glVertexAttrib1dNV (_GET_TLS_PROCTABLE()->VertexAttrib1dNV) -#define glVertexAttrib1dvNV (_GET_TLS_PROCTABLE()->VertexAttrib1dvNV) -#define glVertexAttrib1fNV (_GET_TLS_PROCTABLE()->VertexAttrib1fNV) -#define glVertexAttrib1fvNV (_GET_TLS_PROCTABLE()->VertexAttrib1fvNV) -#define glVertexAttrib1sNV (_GET_TLS_PROCTABLE()->VertexAttrib1sNV) -#define glVertexAttrib1svNV (_GET_TLS_PROCTABLE()->VertexAttrib1svNV) -#define glVertexAttrib2dNV (_GET_TLS_PROCTABLE()->VertexAttrib2dNV) -#define glVertexAttrib2dvNV (_GET_TLS_PROCTABLE()->VertexAttrib2dvNV) -#define glVertexAttrib2fNV (_GET_TLS_PROCTABLE()->VertexAttrib2fNV) -#define glVertexAttrib2fvNV (_GET_TLS_PROCTABLE()->VertexAttrib2fvNV) -#define glVertexAttrib2sNV (_GET_TLS_PROCTABLE()->VertexAttrib2sNV) -#define glVertexAttrib2svNV (_GET_TLS_PROCTABLE()->VertexAttrib2svNV) -#define glVertexAttrib3dNV (_GET_TLS_PROCTABLE()->VertexAttrib3dNV) -#define glVertexAttrib3dvNV (_GET_TLS_PROCTABLE()->VertexAttrib3dvNV) -#define glVertexAttrib3fNV (_GET_TLS_PROCTABLE()->VertexAttrib3fNV) -#define glVertexAttrib3fvNV (_GET_TLS_PROCTABLE()->VertexAttrib3fvNV) -#define glVertexAttrib3sNV (_GET_TLS_PROCTABLE()->VertexAttrib3sNV) -#define glVertexAttrib3svNV (_GET_TLS_PROCTABLE()->VertexAttrib3svNV) -#define glVertexAttrib4dNV (_GET_TLS_PROCTABLE()->VertexAttrib4dNV) -#define glVertexAttrib4dvNV (_GET_TLS_PROCTABLE()->VertexAttrib4dvNV) -#define glVertexAttrib4fNV (_GET_TLS_PROCTABLE()->VertexAttrib4fNV) -#define glVertexAttrib4fvNV (_GET_TLS_PROCTABLE()->VertexAttrib4fvNV) -#define glVertexAttrib4sNV (_GET_TLS_PROCTABLE()->VertexAttrib4sNV) -#define glVertexAttrib4svNV (_GET_TLS_PROCTABLE()->VertexAttrib4svNV) -#define glVertexAttrib4ubNV (_GET_TLS_PROCTABLE()->VertexAttrib4ubNV) -#define glVertexAttrib4ubvNV (_GET_TLS_PROCTABLE()->VertexAttrib4ubvNV) -#define glVertexAttribs1dvNV (_GET_TLS_PROCTABLE()->VertexAttribs1dvNV) -#define glVertexAttribs1fvNV (_GET_TLS_PROCTABLE()->VertexAttribs1fvNV) -#define glVertexAttribs1svNV (_GET_TLS_PROCTABLE()->VertexAttribs1svNV) -#define glVertexAttribs2dvNV (_GET_TLS_PROCTABLE()->VertexAttribs2dvNV) -#define glVertexAttribs2fvNV (_GET_TLS_PROCTABLE()->VertexAttribs2fvNV) -#define glVertexAttribs2svNV (_GET_TLS_PROCTABLE()->VertexAttribs2svNV) -#define glVertexAttribs3dvNV (_GET_TLS_PROCTABLE()->VertexAttribs3dvNV) -#define glVertexAttribs3fvNV (_GET_TLS_PROCTABLE()->VertexAttribs3fvNV) -#define glVertexAttribs3svNV (_GET_TLS_PROCTABLE()->VertexAttribs3svNV) -#define glVertexAttribs4dvNV (_GET_TLS_PROCTABLE()->VertexAttribs4dvNV) -#define glVertexAttribs4fvNV (_GET_TLS_PROCTABLE()->VertexAttribs4fvNV) -#define glVertexAttribs4svNV (_GET_TLS_PROCTABLE()->VertexAttribs4svNV) -#define glVertexAttribs4ubvNV (_GET_TLS_PROCTABLE()->VertexAttribs4ubvNV) -#define glTexBumpParameterivATI (_GET_TLS_PROCTABLE()->TexBumpParameterivATI) -#define glTexBumpParameterfvATI (_GET_TLS_PROCTABLE()->TexBumpParameterfvATI) -#define glGetTexBumpParameterivATI (_GET_TLS_PROCTABLE()->GetTexBumpParameterivATI) -#define glGetTexBumpParameterfvATI (_GET_TLS_PROCTABLE()->GetTexBumpParameterfvATI) -#define glGenFragmentShadersATI (_GET_TLS_PROCTABLE()->GenFragmentShadersATI) -#define glBindFragmentShaderATI (_GET_TLS_PROCTABLE()->BindFragmentShaderATI) -#define glDeleteFragmentShaderATI (_GET_TLS_PROCTABLE()->DeleteFragmentShaderATI) -#define glBeginFragmentShaderATI (_GET_TLS_PROCTABLE()->BeginFragmentShaderATI) -#define glEndFragmentShaderATI (_GET_TLS_PROCTABLE()->EndFragmentShaderATI) -#define glPassTexCoordATI (_GET_TLS_PROCTABLE()->PassTexCoordATI) -#define glSampleMapATI (_GET_TLS_PROCTABLE()->SampleMapATI) -#define glColorFragmentOp1ATI (_GET_TLS_PROCTABLE()->ColorFragmentOp1ATI) -#define glColorFragmentOp2ATI (_GET_TLS_PROCTABLE()->ColorFragmentOp2ATI) -#define glColorFragmentOp3ATI (_GET_TLS_PROCTABLE()->ColorFragmentOp3ATI) -#define glAlphaFragmentOp1ATI (_GET_TLS_PROCTABLE()->AlphaFragmentOp1ATI) -#define glAlphaFragmentOp2ATI (_GET_TLS_PROCTABLE()->AlphaFragmentOp2ATI) -#define glAlphaFragmentOp3ATI (_GET_TLS_PROCTABLE()->AlphaFragmentOp3ATI) -#define glSetFragmentShaderConstantATI (_GET_TLS_PROCTABLE()->SetFragmentShaderConstantATI) -#define glPNTrianglesiATI (_GET_TLS_PROCTABLE()->PNTrianglesiATI) -#define glPNTrianglesfATI (_GET_TLS_PROCTABLE()->PNTrianglesfATI) -#define glNewObjectBufferATI (_GET_TLS_PROCTABLE()->NewObjectBufferATI) -#define glIsObjectBufferATI (_GET_TLS_PROCTABLE()->IsObjectBufferATI) -#define glUpdateObjectBufferATI (_GET_TLS_PROCTABLE()->UpdateObjectBufferATI) -#define glGetObjectBufferfvATI (_GET_TLS_PROCTABLE()->GetObjectBufferfvATI) -#define glGetObjectBufferivATI (_GET_TLS_PROCTABLE()->GetObjectBufferivATI) -#define glFreeObjectBufferATI (_GET_TLS_PROCTABLE()->FreeObjectBufferATI) -#define glArrayObjectATI (_GET_TLS_PROCTABLE()->ArrayObjectATI) -#define glGetArrayObjectfvATI (_GET_TLS_PROCTABLE()->GetArrayObjectfvATI) -#define glGetArrayObjectivATI (_GET_TLS_PROCTABLE()->GetArrayObjectivATI) -#define glVariantArrayObjectATI (_GET_TLS_PROCTABLE()->VariantArrayObjectATI) -#define glGetVariantArrayObjectfvATI (_GET_TLS_PROCTABLE()->GetVariantArrayObjectfvATI) -#define glGetVariantArrayObjectivATI (_GET_TLS_PROCTABLE()->GetVariantArrayObjectivATI) -#define glBeginVertexShaderEXT (_GET_TLS_PROCTABLE()->BeginVertexShaderEXT) -#define glEndVertexShaderEXT (_GET_TLS_PROCTABLE()->EndVertexShaderEXT) -#define glBindVertexShaderEXT (_GET_TLS_PROCTABLE()->BindVertexShaderEXT) -#define glGenVertexShadersEXT (_GET_TLS_PROCTABLE()->GenVertexShadersEXT) -#define glDeleteVertexShaderEXT (_GET_TLS_PROCTABLE()->DeleteVertexShaderEXT) -#define glShaderOp1EXT (_GET_TLS_PROCTABLE()->ShaderOp1EXT) -#define glShaderOp2EXT (_GET_TLS_PROCTABLE()->ShaderOp2EXT) -#define glShaderOp3EXT (_GET_TLS_PROCTABLE()->ShaderOp3EXT) -#define glSwizzleEXT (_GET_TLS_PROCTABLE()->SwizzleEXT) -#define glWriteMaskEXT (_GET_TLS_PROCTABLE()->WriteMaskEXT) -#define glInsertComponentEXT (_GET_TLS_PROCTABLE()->InsertComponentEXT) -#define glExtractComponentEXT (_GET_TLS_PROCTABLE()->ExtractComponentEXT) -#define glGenSymbolsEXT (_GET_TLS_PROCTABLE()->GenSymbolsEXT) -#define glSetInvariantEXT (_GET_TLS_PROCTABLE()->SetInvariantEXT) -#define glSetLocalConstantEXT (_GET_TLS_PROCTABLE()->SetLocalConstantEXT) -#define glVariantbvEXT (_GET_TLS_PROCTABLE()->VariantbvEXT) -#define glVariantsvEXT (_GET_TLS_PROCTABLE()->VariantsvEXT) -#define glVariantivEXT (_GET_TLS_PROCTABLE()->VariantivEXT) -#define glVariantfvEXT (_GET_TLS_PROCTABLE()->VariantfvEXT) -#define glVariantdvEXT (_GET_TLS_PROCTABLE()->VariantdvEXT) -#define glVariantubvEXT (_GET_TLS_PROCTABLE()->VariantubvEXT) -#define glVariantusvEXT (_GET_TLS_PROCTABLE()->VariantusvEXT) -#define glVariantuivEXT (_GET_TLS_PROCTABLE()->VariantuivEXT) -#define glVariantPointerEXT (_GET_TLS_PROCTABLE()->VariantPointerEXT) -#define glEnableVariantClientStateEXT (_GET_TLS_PROCTABLE()->EnableVariantClientStateEXT) -#define glDisableVariantClientStateEXT (_GET_TLS_PROCTABLE()->DisableVariantClientStateEXT) -#define glBindLightParameterEXT (_GET_TLS_PROCTABLE()->BindLightParameterEXT) -#define glBindMaterialParameterEXT (_GET_TLS_PROCTABLE()->BindMaterialParameterEXT) -#define glBindTexGenParameterEXT (_GET_TLS_PROCTABLE()->BindTexGenParameterEXT) -#define glBindTextureUnitParameterEXT (_GET_TLS_PROCTABLE()->BindTextureUnitParameterEXT) -#define glBindParameterEXT (_GET_TLS_PROCTABLE()->BindParameterEXT) -#define glIsVariantEnabledEXT (_GET_TLS_PROCTABLE()->IsVariantEnabledEXT) -#define glGetVariantBooleanvEXT (_GET_TLS_PROCTABLE()->GetVariantBooleanvEXT) -#define glGetVariantIntegervEXT (_GET_TLS_PROCTABLE()->GetVariantIntegervEXT) -#define glGetVariantFloatvEXT (_GET_TLS_PROCTABLE()->GetVariantFloatvEXT) -#define glGetVariantPointervEXT (_GET_TLS_PROCTABLE()->GetVariantPointervEXT) -#define glGetInvariantBooleanvEXT (_GET_TLS_PROCTABLE()->GetInvariantBooleanvEXT) -#define glGetInvariantIntegervEXT (_GET_TLS_PROCTABLE()->GetInvariantIntegervEXT) -#define glGetInvariantFloatvEXT (_GET_TLS_PROCTABLE()->GetInvariantFloatvEXT) -#define glGetLocalConstantBooleanvEXT (_GET_TLS_PROCTABLE()->GetLocalConstantBooleanvEXT) -#define glGetLocalConstantIntegervEXT (_GET_TLS_PROCTABLE()->GetLocalConstantIntegervEXT) -#define glGetLocalConstantFloatvEXT (_GET_TLS_PROCTABLE()->GetLocalConstantFloatvEXT) -#define glVertexStream1sATI (_GET_TLS_PROCTABLE()->VertexStream1sATI) -#define glVertexStream1svATI (_GET_TLS_PROCTABLE()->VertexStream1svATI) -#define glVertexStream1iATI (_GET_TLS_PROCTABLE()->VertexStream1iATI) -#define glVertexStream1ivATI (_GET_TLS_PROCTABLE()->VertexStream1ivATI) -#define glVertexStream1fATI (_GET_TLS_PROCTABLE()->VertexStream1fATI) -#define glVertexStream1fvATI (_GET_TLS_PROCTABLE()->VertexStream1fvATI) -#define glVertexStream1dATI (_GET_TLS_PROCTABLE()->VertexStream1dATI) -#define glVertexStream1dvATI (_GET_TLS_PROCTABLE()->VertexStream1dvATI) -#define glVertexStream2sATI (_GET_TLS_PROCTABLE()->VertexStream2sATI) -#define glVertexStream2svATI (_GET_TLS_PROCTABLE()->VertexStream2svATI) -#define glVertexStream2iATI (_GET_TLS_PROCTABLE()->VertexStream2iATI) -#define glVertexStream2ivATI (_GET_TLS_PROCTABLE()->VertexStream2ivATI) -#define glVertexStream2fATI (_GET_TLS_PROCTABLE()->VertexStream2fATI) -#define glVertexStream2fvATI (_GET_TLS_PROCTABLE()->VertexStream2fvATI) -#define glVertexStream2dATI (_GET_TLS_PROCTABLE()->VertexStream2dATI) -#define glVertexStream2dvATI (_GET_TLS_PROCTABLE()->VertexStream2dvATI) -#define glVertexStream3sATI (_GET_TLS_PROCTABLE()->VertexStream3sATI) -#define glVertexStream3svATI (_GET_TLS_PROCTABLE()->VertexStream3svATI) -#define glVertexStream3iATI (_GET_TLS_PROCTABLE()->VertexStream3iATI) -#define glVertexStream3ivATI (_GET_TLS_PROCTABLE()->VertexStream3ivATI) -#define glVertexStream3fATI (_GET_TLS_PROCTABLE()->VertexStream3fATI) -#define glVertexStream3fvATI (_GET_TLS_PROCTABLE()->VertexStream3fvATI) -#define glVertexStream3dATI (_GET_TLS_PROCTABLE()->VertexStream3dATI) -#define glVertexStream3dvATI (_GET_TLS_PROCTABLE()->VertexStream3dvATI) -#define glVertexStream4sATI (_GET_TLS_PROCTABLE()->VertexStream4sATI) -#define glVertexStream4svATI (_GET_TLS_PROCTABLE()->VertexStream4svATI) -#define glVertexStream4iATI (_GET_TLS_PROCTABLE()->VertexStream4iATI) -#define glVertexStream4ivATI (_GET_TLS_PROCTABLE()->VertexStream4ivATI) -#define glVertexStream4fATI (_GET_TLS_PROCTABLE()->VertexStream4fATI) -#define glVertexStream4fvATI (_GET_TLS_PROCTABLE()->VertexStream4fvATI) -#define glVertexStream4dATI (_GET_TLS_PROCTABLE()->VertexStream4dATI) -#define glVertexStream4dvATI (_GET_TLS_PROCTABLE()->VertexStream4dvATI) -#define glNormalStream3bATI (_GET_TLS_PROCTABLE()->NormalStream3bATI) -#define glNormalStream3bvATI (_GET_TLS_PROCTABLE()->NormalStream3bvATI) -#define glNormalStream3sATI (_GET_TLS_PROCTABLE()->NormalStream3sATI) -#define glNormalStream3svATI (_GET_TLS_PROCTABLE()->NormalStream3svATI) -#define glNormalStream3iATI (_GET_TLS_PROCTABLE()->NormalStream3iATI) -#define glNormalStream3ivATI (_GET_TLS_PROCTABLE()->NormalStream3ivATI) -#define glNormalStream3fATI (_GET_TLS_PROCTABLE()->NormalStream3fATI) -#define glNormalStream3fvATI (_GET_TLS_PROCTABLE()->NormalStream3fvATI) -#define glNormalStream3dATI (_GET_TLS_PROCTABLE()->NormalStream3dATI) -#define glNormalStream3dvATI (_GET_TLS_PROCTABLE()->NormalStream3dvATI) -#define glClientActiveVertexStreamATI (_GET_TLS_PROCTABLE()->ClientActiveVertexStreamATI) -#define glVertexBlendEnviATI (_GET_TLS_PROCTABLE()->VertexBlendEnviATI) -#define glVertexBlendEnvfATI (_GET_TLS_PROCTABLE()->VertexBlendEnvfATI) -#define glElementPointerATI (_GET_TLS_PROCTABLE()->ElementPointerATI) -#define glDrawElementArrayATI (_GET_TLS_PROCTABLE()->DrawElementArrayATI) -#define glDrawRangeElementArrayATI (_GET_TLS_PROCTABLE()->DrawRangeElementArrayATI) -#define glDrawMeshArraysSUN (_GET_TLS_PROCTABLE()->DrawMeshArraysSUN) -#define glGenOcclusionQueriesNV (_GET_TLS_PROCTABLE()->GenOcclusionQueriesNV) -#define glDeleteOcclusionQueriesNV (_GET_TLS_PROCTABLE()->DeleteOcclusionQueriesNV) -#define glIsOcclusionQueryNV (_GET_TLS_PROCTABLE()->IsOcclusionQueryNV) -#define glBeginOcclusionQueryNV (_GET_TLS_PROCTABLE()->BeginOcclusionQueryNV) -#define glEndOcclusionQueryNV (_GET_TLS_PROCTABLE()->EndOcclusionQueryNV) -#define glGetOcclusionQueryivNV (_GET_TLS_PROCTABLE()->GetOcclusionQueryivNV) -#define glGetOcclusionQueryuivNV (_GET_TLS_PROCTABLE()->GetOcclusionQueryuivNV) -#define glPointParameteriNV (_GET_TLS_PROCTABLE()->PointParameteriNV) -#define glPointParameterivNV (_GET_TLS_PROCTABLE()->PointParameterivNV) -#define glActiveStencilFaceEXT (_GET_TLS_PROCTABLE()->ActiveStencilFaceEXT) -#define glElementPointerAPPLE (_GET_TLS_PROCTABLE()->ElementPointerAPPLE) -#define glDrawElementArrayAPPLE (_GET_TLS_PROCTABLE()->DrawElementArrayAPPLE) -#define glDrawRangeElementArrayAPPLE (_GET_TLS_PROCTABLE()->DrawRangeElementArrayAPPLE) -#define glMultiDrawElementArrayAPPLE (_GET_TLS_PROCTABLE()->MultiDrawElementArrayAPPLE) -#define glMultiDrawRangeElementArrayAPPLE (_GET_TLS_PROCTABLE()->MultiDrawRangeElementArrayAPPLE) -#define glGenFencesAPPLE (_GET_TLS_PROCTABLE()->GenFencesAPPLE) -#define glDeleteFencesAPPLE (_GET_TLS_PROCTABLE()->DeleteFencesAPPLE) -#define glSetFenceAPPLE (_GET_TLS_PROCTABLE()->SetFenceAPPLE) -#define glIsFenceAPPLE (_GET_TLS_PROCTABLE()->IsFenceAPPLE) -#define glTestFenceAPPLE (_GET_TLS_PROCTABLE()->TestFenceAPPLE) -#define glFinishFenceAPPLE (_GET_TLS_PROCTABLE()->FinishFenceAPPLE) -#define glTestObjectAPPLE (_GET_TLS_PROCTABLE()->TestObjectAPPLE) -#define glFinishObjectAPPLE (_GET_TLS_PROCTABLE()->FinishObjectAPPLE) -#define glBindVertexArrayAPPLE (_GET_TLS_PROCTABLE()->BindVertexArrayAPPLE) -#define glDeleteVertexArraysAPPLE (_GET_TLS_PROCTABLE()->DeleteVertexArraysAPPLE) -#define glGenVertexArraysAPPLE (_GET_TLS_PROCTABLE()->GenVertexArraysAPPLE) -#define glIsVertexArrayAPPLE (_GET_TLS_PROCTABLE()->IsVertexArrayAPPLE) -#define glVertexArrayRangeAPPLE (_GET_TLS_PROCTABLE()->VertexArrayRangeAPPLE) -#define glFlushVertexArrayRangeAPPLE (_GET_TLS_PROCTABLE()->FlushVertexArrayRangeAPPLE) -#define glVertexArrayParameteriAPPLE (_GET_TLS_PROCTABLE()->VertexArrayParameteriAPPLE) -#define glDrawBuffersATI (_GET_TLS_PROCTABLE()->DrawBuffersATI) -#define glProgramNamedParameter4fNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4fNV) -#define glProgramNamedParameter4dNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4dNV) -#define glProgramNamedParameter4fvNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4fvNV) -#define glProgramNamedParameter4dvNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4dvNV) -#define glGetProgramNamedParameterfvNV (_GET_TLS_PROCTABLE()->GetProgramNamedParameterfvNV) -#define glGetProgramNamedParameterdvNV (_GET_TLS_PROCTABLE()->GetProgramNamedParameterdvNV) -#define glVertex2hNV (_GET_TLS_PROCTABLE()->Vertex2hNV) -#define glVertex2hvNV (_GET_TLS_PROCTABLE()->Vertex2hvNV) -#define glVertex3hNV (_GET_TLS_PROCTABLE()->Vertex3hNV) -#define glVertex3hvNV (_GET_TLS_PROCTABLE()->Vertex3hvNV) -#define glVertex4hNV (_GET_TLS_PROCTABLE()->Vertex4hNV) -#define glVertex4hvNV (_GET_TLS_PROCTABLE()->Vertex4hvNV) -#define glNormal3hNV (_GET_TLS_PROCTABLE()->Normal3hNV) -#define glNormal3hvNV (_GET_TLS_PROCTABLE()->Normal3hvNV) -#define glColor3hNV (_GET_TLS_PROCTABLE()->Color3hNV) -#define glColor3hvNV (_GET_TLS_PROCTABLE()->Color3hvNV) -#define glColor4hNV (_GET_TLS_PROCTABLE()->Color4hNV) -#define glColor4hvNV (_GET_TLS_PROCTABLE()->Color4hvNV) -#define glTexCoord1hNV (_GET_TLS_PROCTABLE()->TexCoord1hNV) -#define glTexCoord1hvNV (_GET_TLS_PROCTABLE()->TexCoord1hvNV) -#define glTexCoord2hNV (_GET_TLS_PROCTABLE()->TexCoord2hNV) -#define glTexCoord2hvNV (_GET_TLS_PROCTABLE()->TexCoord2hvNV) -#define glTexCoord3hNV (_GET_TLS_PROCTABLE()->TexCoord3hNV) -#define glTexCoord3hvNV (_GET_TLS_PROCTABLE()->TexCoord3hvNV) -#define glTexCoord4hNV (_GET_TLS_PROCTABLE()->TexCoord4hNV) -#define glTexCoord4hvNV (_GET_TLS_PROCTABLE()->TexCoord4hvNV) -#define glMultiTexCoord1hNV (_GET_TLS_PROCTABLE()->MultiTexCoord1hNV) -#define glMultiTexCoord1hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord1hvNV) -#define glMultiTexCoord2hNV (_GET_TLS_PROCTABLE()->MultiTexCoord2hNV) -#define glMultiTexCoord2hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord2hvNV) -#define glMultiTexCoord3hNV (_GET_TLS_PROCTABLE()->MultiTexCoord3hNV) -#define glMultiTexCoord3hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord3hvNV) -#define glMultiTexCoord4hNV (_GET_TLS_PROCTABLE()->MultiTexCoord4hNV) -#define glMultiTexCoord4hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord4hvNV) -#define glFogCoordhNV (_GET_TLS_PROCTABLE()->FogCoordhNV) -#define glFogCoordhvNV (_GET_TLS_PROCTABLE()->FogCoordhvNV) -#define glSecondaryColor3hNV (_GET_TLS_PROCTABLE()->SecondaryColor3hNV) -#define glSecondaryColor3hvNV (_GET_TLS_PROCTABLE()->SecondaryColor3hvNV) -#define glVertexWeighthNV (_GET_TLS_PROCTABLE()->VertexWeighthNV) -#define glVertexWeighthvNV (_GET_TLS_PROCTABLE()->VertexWeighthvNV) -#define glVertexAttrib1hNV (_GET_TLS_PROCTABLE()->VertexAttrib1hNV) -#define glVertexAttrib1hvNV (_GET_TLS_PROCTABLE()->VertexAttrib1hvNV) -#define glVertexAttrib2hNV (_GET_TLS_PROCTABLE()->VertexAttrib2hNV) -#define glVertexAttrib2hvNV (_GET_TLS_PROCTABLE()->VertexAttrib2hvNV) -#define glVertexAttrib3hNV (_GET_TLS_PROCTABLE()->VertexAttrib3hNV) -#define glVertexAttrib3hvNV (_GET_TLS_PROCTABLE()->VertexAttrib3hvNV) -#define glVertexAttrib4hNV (_GET_TLS_PROCTABLE()->VertexAttrib4hNV) -#define glVertexAttrib4hvNV (_GET_TLS_PROCTABLE()->VertexAttrib4hvNV) -#define glVertexAttribs1hvNV (_GET_TLS_PROCTABLE()->VertexAttribs1hvNV) -#define glVertexAttribs2hvNV (_GET_TLS_PROCTABLE()->VertexAttribs2hvNV) -#define glVertexAttribs3hvNV (_GET_TLS_PROCTABLE()->VertexAttribs3hvNV) -#define glVertexAttribs4hvNV (_GET_TLS_PROCTABLE()->VertexAttribs4hvNV) -#define glPixelDataRangeNV (_GET_TLS_PROCTABLE()->PixelDataRangeNV) -#define glFlushPixelDataRangeNV (_GET_TLS_PROCTABLE()->FlushPixelDataRangeNV) -#define glPrimitiveRestartNV (_GET_TLS_PROCTABLE()->PrimitiveRestartNV) -#define glPrimitiveRestartIndexNV (_GET_TLS_PROCTABLE()->PrimitiveRestartIndexNV) -#define glMapObjectBufferATI (_GET_TLS_PROCTABLE()->MapObjectBufferATI) -#define glUnmapObjectBufferATI (_GET_TLS_PROCTABLE()->UnmapObjectBufferATI) -#define glStencilOpSeparateATI (_GET_TLS_PROCTABLE()->StencilOpSeparateATI) -#define glStencilFuncSeparateATI (_GET_TLS_PROCTABLE()->StencilFuncSeparateATI) -#define glVertexAttribArrayObjectATI (_GET_TLS_PROCTABLE()->VertexAttribArrayObjectATI) -#define glGetVertexAttribArrayObjectfvATI (_GET_TLS_PROCTABLE()->GetVertexAttribArrayObjectfvATI) -#define glGetVertexAttribArrayObjectivATI (_GET_TLS_PROCTABLE()->GetVertexAttribArrayObjectivATI) -#define glDepthBoundsEXT (_GET_TLS_PROCTABLE()->DepthBoundsEXT) -#define glBlendEquationSeparateEXT (_GET_TLS_PROCTABLE()->BlendEquationSeparateEXT) -#define glAddSwapHintRectWIN (_GET_TLS_PROCTABLE()->AddSwapHintRectWIN) -#ifdef _WIN32 -#define wglCreateBufferRegionARB (_GET_TLS_PROCTABLE()->CreateBufferRegionARB) -#define wglDeleteBufferRegionARB (_GET_TLS_PROCTABLE()->DeleteBufferRegionARB) -#define wglSaveBufferRegionARB (_GET_TLS_PROCTABLE()->SaveBufferRegionARB) -#define wglRestoreBufferRegionARB (_GET_TLS_PROCTABLE()->RestoreBufferRegionARB) -#define wglGetExtensionsStringARB (_GET_TLS_PROCTABLE()->GetExtensionsStringARB) -#define wglGetPixelFormatAttribivARB (_GET_TLS_PROCTABLE()->GetPixelFormatAttribivARB) -#define wglGetPixelFormatAttribfvARB (_GET_TLS_PROCTABLE()->GetPixelFormatAttribfvARB) -#define wglChoosePixelFormatARB (_GET_TLS_PROCTABLE()->ChoosePixelFormatARB) -#define wglMakeContextCurrentARB (_GET_TLS_PROCTABLE()->MakeContextCurrentARB) -#define wglGetCurrentReadDCARB (_GET_TLS_PROCTABLE()->GetCurrentReadDCARB) -#define wglCreatePbufferARB (_GET_TLS_PROCTABLE()->CreatePbufferARB) -#define wglGetPbufferDCARB (_GET_TLS_PROCTABLE()->GetPbufferDCARB) -#define wglReleasePbufferDCARB (_GET_TLS_PROCTABLE()->ReleasePbufferDCARB) -#define wglDestroyPbufferARB (_GET_TLS_PROCTABLE()->DestroyPbufferARB) -#define wglQueryPbufferARB (_GET_TLS_PROCTABLE()->QueryPbufferARB) -#define wglBindTexImageARB (_GET_TLS_PROCTABLE()->BindTexImageARB) -#define wglReleaseTexImageARB (_GET_TLS_PROCTABLE()->ReleaseTexImageARB) -#define wglSetPbufferAttribARB (_GET_TLS_PROCTABLE()->SetPbufferAttribARB) -#define wglCreateDisplayColorTableEXT (_GET_TLS_PROCTABLE()->CreateDisplayColorTableEXT) -#define wglLoadDisplayColorTableEXT (_GET_TLS_PROCTABLE()->LoadDisplayColorTableEXT) -#define wglBindDisplayColorTableEXT (_GET_TLS_PROCTABLE()->BindDisplayColorTableEXT) -#define wglDestroyDisplayColorTableEXT (_GET_TLS_PROCTABLE()->DestroyDisplayColorTableEXT) -#define wglGetExtensionsStringEXT (_GET_TLS_PROCTABLE()->GetExtensionsStringEXT) -#define wglMakeContextCurrentEXT (_GET_TLS_PROCTABLE()->MakeContextCurrentEXT) -#define wglGetCurrentReadDCEXT (_GET_TLS_PROCTABLE()->GetCurrentReadDCEXT) -#define wglCreatePbufferEXT (_GET_TLS_PROCTABLE()->CreatePbufferEXT) -#define wglGetPbufferDCEXT (_GET_TLS_PROCTABLE()->GetPbufferDCEXT) -#define wglReleasePbufferDCEXT (_GET_TLS_PROCTABLE()->ReleasePbufferDCEXT) -#define wglDestroyPbufferEXT (_GET_TLS_PROCTABLE()->DestroyPbufferEXT) -#define wglQueryPbufferEXT (_GET_TLS_PROCTABLE()->QueryPbufferEXT) -#define wglGetPixelFormatAttribivEXT (_GET_TLS_PROCTABLE()->GetPixelFormatAttribivEXT) -#define wglGetPixelFormatAttribfvEXT (_GET_TLS_PROCTABLE()->GetPixelFormatAttribfvEXT) -#define wglChoosePixelFormatEXT (_GET_TLS_PROCTABLE()->ChoosePixelFormatEXT) -#define wglSwapIntervalEXT (_GET_TLS_PROCTABLE()->SwapIntervalEXT) -#define wglGetSwapIntervalEXT (_GET_TLS_PROCTABLE()->GetSwapIntervalEXT) -#define wglAllocateMemoryNV (_GET_TLS_PROCTABLE()->AllocateMemoryNV) -#define wglFreeMemoryNV (_GET_TLS_PROCTABLE()->FreeMemoryNV) -#define wglGetSyncValuesOML (_GET_TLS_PROCTABLE()->GetSyncValuesOML) -#define wglGetMscRateOML (_GET_TLS_PROCTABLE()->GetMscRateOML) -#define wglSwapBuffersMscOML (_GET_TLS_PROCTABLE()->SwapBuffersMscOML) -#define wglSwapLayerBuffersMscOML (_GET_TLS_PROCTABLE()->SwapLayerBuffersMscOML) -#define wglWaitForMscOML (_GET_TLS_PROCTABLE()->WaitForMscOML) -#define wglWaitForSbcOML (_GET_TLS_PROCTABLE()->WaitForSbcOML) -#define wglGetDigitalVideoParametersI3D (_GET_TLS_PROCTABLE()->GetDigitalVideoParametersI3D) -#define wglSetDigitalVideoParametersI3D (_GET_TLS_PROCTABLE()->SetDigitalVideoParametersI3D) -#define wglGetGammaTableParametersI3D (_GET_TLS_PROCTABLE()->GetGammaTableParametersI3D) -#define wglSetGammaTableParametersI3D (_GET_TLS_PROCTABLE()->SetGammaTableParametersI3D) -#define wglGetGammaTableI3D (_GET_TLS_PROCTABLE()->GetGammaTableI3D) -#define wglSetGammaTableI3D (_GET_TLS_PROCTABLE()->SetGammaTableI3D) -#define wglEnableGenlockI3D (_GET_TLS_PROCTABLE()->EnableGenlockI3D) -#define wglDisableGenlockI3D (_GET_TLS_PROCTABLE()->DisableGenlockI3D) -#define wglIsEnabledGenlockI3D (_GET_TLS_PROCTABLE()->IsEnabledGenlockI3D) -#define wglGenlockSourceI3D (_GET_TLS_PROCTABLE()->GenlockSourceI3D) -#define wglGetGenlockSourceI3D (_GET_TLS_PROCTABLE()->GetGenlockSourceI3D) -#define wglGenlockSourceEdgeI3D (_GET_TLS_PROCTABLE()->GenlockSourceEdgeI3D) -#define wglGetGenlockSourceEdgeI3D (_GET_TLS_PROCTABLE()->GetGenlockSourceEdgeI3D) -#define wglGenlockSampleRateI3D (_GET_TLS_PROCTABLE()->GenlockSampleRateI3D) -#define wglGetGenlockSampleRateI3D (_GET_TLS_PROCTABLE()->GetGenlockSampleRateI3D) -#define wglGenlockSourceDelayI3D (_GET_TLS_PROCTABLE()->GenlockSourceDelayI3D) -#define wglGetGenlockSourceDelayI3D (_GET_TLS_PROCTABLE()->GetGenlockSourceDelayI3D) -#define wglQueryGenlockMaxSourceDelayI3D (_GET_TLS_PROCTABLE()->QueryGenlockMaxSourceDelayI3D) -#define wglCreateImageBufferI3D (_GET_TLS_PROCTABLE()->CreateImageBufferI3D) -#define wglDestroyImageBufferI3D (_GET_TLS_PROCTABLE()->DestroyImageBufferI3D) -#define wglAssociateImageBufferEventsI3D (_GET_TLS_PROCTABLE()->AssociateImageBufferEventsI3D) -#define wglReleaseImageBufferEventsI3D (_GET_TLS_PROCTABLE()->ReleaseImageBufferEventsI3D) -#define wglEnableFrameLockI3D (_GET_TLS_PROCTABLE()->EnableFrameLockI3D) -#define wglDisableFrameLockI3D (_GET_TLS_PROCTABLE()->DisableFrameLockI3D) -#define wglIsEnabledFrameLockI3D (_GET_TLS_PROCTABLE()->IsEnabledFrameLockI3D) -#define wglQueryFrameLockMasterI3D (_GET_TLS_PROCTABLE()->QueryFrameLockMasterI3D) -#define wglGetFrameUsageI3D (_GET_TLS_PROCTABLE()->GetFrameUsageI3D) -#define wglBeginFrameTrackingI3D (_GET_TLS_PROCTABLE()->BeginFrameTrackingI3D) -#define wglEndFrameTrackingI3D (_GET_TLS_PROCTABLE()->EndFrameTrackingI3D) -#define wglQueryFrameTrackingI3D (_GET_TLS_PROCTABLE()->QueryFrameTrackingI3D) -#endif /* _WIN32 */ - -#ifndef _APP_PROCTABLE - -/* - * Applications can replace the following function with its own function - * for accessing thread local proc/context dependent proc table. - * The following default function works for most applications which - * are using the same device for all their contexts - even if - * the contexts are on different threads. - */ - -static _inline _GLextensionProcs *_GET_TLS_PROCTABLE(void) - -{ - extern _GLextensionProcs _extensionProcs; - - return (&_extensionProcs); -} - -#else - -/* - * Application should replace this compiled function with - * an inlined function for maximum performance. - */ - -extern _GLextensionProcs *_GET_TLS_PROCTABLE(void); - -#endif - -/* - * Provide an initialization function for the application - * to initialize its own proc tables in case the application - * needs to use multiple proc tables. - */ - -static _inline void _InitExtensionProcs(_GLextensionProcs *appProcs) -{ - extern _GLextensionProcs _extensionProcs; - - *appProcs = _extensionProcs; -} - -#ifdef __cplusplus -} -#endif - - -#endif /* _GLPROCS_H_ */ +#ifndef _GLPROCS_H_ +#define _GLPROCS_H_ + +/* +** GLprocs utility for getting function addresses for OpenGL(R) 1.2, +** OpenGL 1.3, OpenGL 1.4, OpenGL 1.5 and OpenGL extension functions. +** +** Version: 1.1 +** +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +** +** Initial version of glprocs.{c,h} contributed by Intel(R) Corporation. +*/ + +#ifdef _WIN32 + #include "glext.h" + #include "wglext.h" +#else + #include +#endif + +#ifndef _WIN32 /* non-Windows environment */ + #ifndef APIENTRY + #define APIENTRY + #endif + #ifdef __GNUC__ + #define _inline __inline__ + #else + #define _inline + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure of all OpenGL {1.2, 1.3, 1.4, 1.5}, GL extension procs.*/ + +typedef struct { + void (APIENTRY *BlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (APIENTRY *BlendEquation) (GLenum mode); + void (APIENTRY *DrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); + void (APIENTRY *ColorTable) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); + void (APIENTRY *ColorTableParameterfv) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *ColorTableParameteriv) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *CopyColorTable) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void (APIENTRY *GetColorTable) (GLenum target, GLenum format, GLenum type, GLvoid *table); + void (APIENTRY *GetColorTableParameterfv) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetColorTableParameteriv) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *ColorSubTable) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); + void (APIENTRY *CopyColorSubTable) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); + void (APIENTRY *ConvolutionFilter1D) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); + void (APIENTRY *ConvolutionFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); + void (APIENTRY *ConvolutionParameterf) (GLenum target, GLenum pname, GLfloat params); + void (APIENTRY *ConvolutionParameterfv) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *ConvolutionParameteri) (GLenum target, GLenum pname, GLint params); + void (APIENTRY *ConvolutionParameteriv) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *CopyConvolutionFilter1D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void (APIENTRY *CopyConvolutionFilter2D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); + void (APIENTRY *GetConvolutionFilter) (GLenum target, GLenum format, GLenum type, GLvoid *image); + void (APIENTRY *GetConvolutionParameterfv) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetConvolutionParameteriv) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetSeparableFilter) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); + void (APIENTRY *SeparableFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); + void (APIENTRY *GetHistogram) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); + void (APIENTRY *GetHistogramParameterfv) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetHistogramParameteriv) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetMinmax) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); + void (APIENTRY *GetMinmaxParameterfv) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetMinmaxParameteriv) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *Histogram) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); + void (APIENTRY *Minmax) (GLenum target, GLenum internalformat, GLboolean sink); + void (APIENTRY *ResetHistogram) (GLenum target); + void (APIENTRY *ResetMinmax) (GLenum target); + void (APIENTRY *TexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *TexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *CopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void (APIENTRY *ActiveTexture) (GLenum texture); + void (APIENTRY *ClientActiveTexture) (GLenum texture); + void (APIENTRY *MultiTexCoord1d) (GLenum target, GLdouble s); + void (APIENTRY *MultiTexCoord1dv) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord1f) (GLenum target, GLfloat s); + void (APIENTRY *MultiTexCoord1fv) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord1i) (GLenum target, GLint s); + void (APIENTRY *MultiTexCoord1iv) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord1s) (GLenum target, GLshort s); + void (APIENTRY *MultiTexCoord1sv) (GLenum target, const GLshort *v); + void (APIENTRY *MultiTexCoord2d) (GLenum target, GLdouble s, GLdouble t); + void (APIENTRY *MultiTexCoord2dv) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord2f) (GLenum target, GLfloat s, GLfloat t); + void (APIENTRY *MultiTexCoord2fv) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord2i) (GLenum target, GLint s, GLint t); + void (APIENTRY *MultiTexCoord2iv) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord2s) (GLenum target, GLshort s, GLshort t); + void (APIENTRY *MultiTexCoord2sv) (GLenum target, const GLshort *v); + void (APIENTRY *MultiTexCoord3d) (GLenum target, GLdouble s, GLdouble t, GLdouble r); + void (APIENTRY *MultiTexCoord3dv) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord3f) (GLenum target, GLfloat s, GLfloat t, GLfloat r); + void (APIENTRY *MultiTexCoord3fv) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord3i) (GLenum target, GLint s, GLint t, GLint r); + void (APIENTRY *MultiTexCoord3iv) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord3s) (GLenum target, GLshort s, GLshort t, GLshort r); + void (APIENTRY *MultiTexCoord3sv) (GLenum target, const GLshort *v); + void (APIENTRY *MultiTexCoord4d) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); + void (APIENTRY *MultiTexCoord4dv) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord4f) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); + void (APIENTRY *MultiTexCoord4fv) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord4i) (GLenum target, GLint s, GLint t, GLint r, GLint q); + void (APIENTRY *MultiTexCoord4iv) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord4s) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); + void (APIENTRY *MultiTexCoord4sv) (GLenum target, const GLshort *v); + void (APIENTRY *LoadTransposeMatrixf) (const GLfloat *m); + void (APIENTRY *LoadTransposeMatrixd) (const GLdouble *m); + void (APIENTRY *MultTransposeMatrixf) (const GLfloat *m); + void (APIENTRY *MultTransposeMatrixd) (const GLdouble *m); + void (APIENTRY *SampleCoverage) (GLclampf value, GLboolean invert); + void (APIENTRY *CompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexImage1D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexSubImage1D) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *GetCompressedTexImage) (GLenum target, GLint level, GLvoid *img); + void (APIENTRY *BlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + void (APIENTRY *FogCoordf) (GLfloat coord); + void (APIENTRY *FogCoordfv) (const GLfloat *coord); + void (APIENTRY *FogCoordd) (GLdouble coord); + void (APIENTRY *FogCoorddv) (const GLdouble *coord); + void (APIENTRY *FogCoordPointer) (GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *MultiDrawArrays) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); + void (APIENTRY *MultiDrawElements) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); + void (APIENTRY *PointParameterf) (GLenum pname, GLfloat param); + void (APIENTRY *PointParameterfv) (GLenum pname, const GLfloat *params); + void (APIENTRY *PointParameteri) (GLenum pname, GLint param); + void (APIENTRY *PointParameteriv) (GLenum pname, const GLint *params); + void (APIENTRY *SecondaryColor3b) (GLbyte red, GLbyte green, GLbyte blue); + void (APIENTRY *SecondaryColor3bv) (const GLbyte *v); + void (APIENTRY *SecondaryColor3d) (GLdouble red, GLdouble green, GLdouble blue); + void (APIENTRY *SecondaryColor3dv) (const GLdouble *v); + void (APIENTRY *SecondaryColor3f) (GLfloat red, GLfloat green, GLfloat blue); + void (APIENTRY *SecondaryColor3fv) (const GLfloat *v); + void (APIENTRY *SecondaryColor3i) (GLint red, GLint green, GLint blue); + void (APIENTRY *SecondaryColor3iv) (const GLint *v); + void (APIENTRY *SecondaryColor3s) (GLshort red, GLshort green, GLshort blue); + void (APIENTRY *SecondaryColor3sv) (const GLshort *v); + void (APIENTRY *SecondaryColor3ub) (GLubyte red, GLubyte green, GLubyte blue); + void (APIENTRY *SecondaryColor3ubv) (const GLubyte *v); + void (APIENTRY *SecondaryColor3ui) (GLuint red, GLuint green, GLuint blue); + void (APIENTRY *SecondaryColor3uiv) (const GLuint *v); + void (APIENTRY *SecondaryColor3us) (GLushort red, GLushort green, GLushort blue); + void (APIENTRY *SecondaryColor3usv) (const GLushort *v); + void (APIENTRY *SecondaryColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *WindowPos2d) (GLdouble x, GLdouble y); + void (APIENTRY *WindowPos2dv) (const GLdouble *v); + void (APIENTRY *WindowPos2f) (GLfloat x, GLfloat y); + void (APIENTRY *WindowPos2fv) (const GLfloat *v); + void (APIENTRY *WindowPos2i) (GLint x, GLint y); + void (APIENTRY *WindowPos2iv) (const GLint *v); + void (APIENTRY *WindowPos2s) (GLshort x, GLshort y); + void (APIENTRY *WindowPos2sv) (const GLshort *v); + void (APIENTRY *WindowPos3d) (GLdouble x, GLdouble y, GLdouble z); + void (APIENTRY *WindowPos3dv) (const GLdouble *v); + void (APIENTRY *WindowPos3f) (GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *WindowPos3fv) (const GLfloat *v); + void (APIENTRY *WindowPos3i) (GLint x, GLint y, GLint z); + void (APIENTRY *WindowPos3iv) (const GLint *v); + void (APIENTRY *WindowPos3s) (GLshort x, GLshort y, GLshort z); + void (APIENTRY *WindowPos3sv) (const GLshort *v); + void (APIENTRY *GenQueries) (GLsizei n, GLuint *ids); + void (APIENTRY *DeleteQueries) (GLsizei n, const GLuint *ids); + GLboolean (APIENTRY *IsQuery) (GLuint id); + void (APIENTRY *BeginQuery) (GLenum target, GLuint id); + void (APIENTRY *EndQuery) (GLenum target); + void (APIENTRY *GetQueryiv) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetQueryObjectiv) (GLuint id, GLenum pname, GLint *params); + void (APIENTRY *GetQueryObjectuiv) (GLuint id, GLenum pname, GLuint *params); + void (APIENTRY *BindBuffer) (GLenum target, GLuint buffer); + void (APIENTRY *DeleteBuffers) (GLsizei n, const GLuint *buffers); + void (APIENTRY *GenBuffers) (GLsizei n, GLuint *buffers); + GLboolean (APIENTRY *IsBuffer) (GLuint buffer); + void (APIENTRY *BufferData) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); + void (APIENTRY *BufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); + void (APIENTRY *GetBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); + GLvoid* (APIENTRY *MapBuffer) (GLenum target, GLenum access); + GLboolean (APIENTRY *UnmapBuffer) (GLenum target); + void (APIENTRY *GetBufferParameteriv) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetBufferPointerv) (GLenum target, GLenum pname, GLvoid* *params); + void (APIENTRY *ActiveTextureARB) (GLenum texture); + void (APIENTRY *ClientActiveTextureARB) (GLenum texture); + void (APIENTRY *MultiTexCoord1dARB) (GLenum target, GLdouble s); + void (APIENTRY *MultiTexCoord1dvARB) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord1fARB) (GLenum target, GLfloat s); + void (APIENTRY *MultiTexCoord1fvARB) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord1iARB) (GLenum target, GLint s); + void (APIENTRY *MultiTexCoord1ivARB) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord1sARB) (GLenum target, GLshort s); + void (APIENTRY *MultiTexCoord1svARB) (GLenum target, const GLshort *v); + void (APIENTRY *MultiTexCoord2dARB) (GLenum target, GLdouble s, GLdouble t); + void (APIENTRY *MultiTexCoord2dvARB) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t); + void (APIENTRY *MultiTexCoord2fvARB) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord2iARB) (GLenum target, GLint s, GLint t); + void (APIENTRY *MultiTexCoord2ivARB) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord2sARB) (GLenum target, GLshort s, GLshort t); + void (APIENTRY *MultiTexCoord2svARB) (GLenum target, const GLshort *v); + void (APIENTRY *MultiTexCoord3dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r); + void (APIENTRY *MultiTexCoord3dvARB) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord3fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r); + void (APIENTRY *MultiTexCoord3fvARB) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord3iARB) (GLenum target, GLint s, GLint t, GLint r); + void (APIENTRY *MultiTexCoord3ivARB) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord3sARB) (GLenum target, GLshort s, GLshort t, GLshort r); + void (APIENTRY *MultiTexCoord3svARB) (GLenum target, const GLshort *v); + void (APIENTRY *MultiTexCoord4dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); + void (APIENTRY *MultiTexCoord4dvARB) (GLenum target, const GLdouble *v); + void (APIENTRY *MultiTexCoord4fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); + void (APIENTRY *MultiTexCoord4fvARB) (GLenum target, const GLfloat *v); + void (APIENTRY *MultiTexCoord4iARB) (GLenum target, GLint s, GLint t, GLint r, GLint q); + void (APIENTRY *MultiTexCoord4ivARB) (GLenum target, const GLint *v); + void (APIENTRY *MultiTexCoord4sARB) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); + void (APIENTRY *MultiTexCoord4svARB) (GLenum target, const GLshort *v); + void (APIENTRY *LoadTransposeMatrixfARB) (const GLfloat *m); + void (APIENTRY *LoadTransposeMatrixdARB) (const GLdouble *m); + void (APIENTRY *MultTransposeMatrixfARB) (const GLfloat *m); + void (APIENTRY *MultTransposeMatrixdARB) (const GLdouble *m); + void (APIENTRY *SampleCoverageARB) (GLclampf value, GLboolean invert); + void (APIENTRY *CompressedTexImage3DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexImage2DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexImage1DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexSubImage3DARB) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexSubImage2DARB) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *CompressedTexSubImage1DARB) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); + void (APIENTRY *GetCompressedTexImageARB) (GLenum target, GLint level, GLvoid *img); + void (APIENTRY *PointParameterfARB) (GLenum pname, GLfloat param); + void (APIENTRY *PointParameterfvARB) (GLenum pname, const GLfloat *params); + void (APIENTRY *WeightbvARB) (GLint size, const GLbyte *weights); + void (APIENTRY *WeightsvARB) (GLint size, const GLshort *weights); + void (APIENTRY *WeightivARB) (GLint size, const GLint *weights); + void (APIENTRY *WeightfvARB) (GLint size, const GLfloat *weights); + void (APIENTRY *WeightdvARB) (GLint size, const GLdouble *weights); + void (APIENTRY *WeightubvARB) (GLint size, const GLubyte *weights); + void (APIENTRY *WeightusvARB) (GLint size, const GLushort *weights); + void (APIENTRY *WeightuivARB) (GLint size, const GLuint *weights); + void (APIENTRY *WeightPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *VertexBlendARB) (GLint count); + void (APIENTRY *CurrentPaletteMatrixARB) (GLint index); + void (APIENTRY *MatrixIndexubvARB) (GLint size, const GLubyte *indices); + void (APIENTRY *MatrixIndexusvARB) (GLint size, const GLushort *indices); + void (APIENTRY *MatrixIndexuivARB) (GLint size, const GLuint *indices); + void (APIENTRY *MatrixIndexPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *WindowPos2dARB) (GLdouble x, GLdouble y); + void (APIENTRY *WindowPos2dvARB) (const GLdouble *v); + void (APIENTRY *WindowPos2fARB) (GLfloat x, GLfloat y); + void (APIENTRY *WindowPos2fvARB) (const GLfloat *v); + void (APIENTRY *WindowPos2iARB) (GLint x, GLint y); + void (APIENTRY *WindowPos2ivARB) (const GLint *v); + void (APIENTRY *WindowPos2sARB) (GLshort x, GLshort y); + void (APIENTRY *WindowPos2svARB) (const GLshort *v); + void (APIENTRY *WindowPos3dARB) (GLdouble x, GLdouble y, GLdouble z); + void (APIENTRY *WindowPos3dvARB) (const GLdouble *v); + void (APIENTRY *WindowPos3fARB) (GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *WindowPos3fvARB) (const GLfloat *v); + void (APIENTRY *WindowPos3iARB) (GLint x, GLint y, GLint z); + void (APIENTRY *WindowPos3ivARB) (const GLint *v); + void (APIENTRY *WindowPos3sARB) (GLshort x, GLshort y, GLshort z); + void (APIENTRY *WindowPos3svARB) (const GLshort *v); + void (APIENTRY *VertexAttrib1dARB) (GLuint index, GLdouble x); + void (APIENTRY *VertexAttrib1dvARB) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib1fARB) (GLuint index, GLfloat x); + void (APIENTRY *VertexAttrib1fvARB) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib1sARB) (GLuint index, GLshort x); + void (APIENTRY *VertexAttrib1svARB) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib2dARB) (GLuint index, GLdouble x, GLdouble y); + void (APIENTRY *VertexAttrib2dvARB) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib2fARB) (GLuint index, GLfloat x, GLfloat y); + void (APIENTRY *VertexAttrib2fvARB) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib2sARB) (GLuint index, GLshort x, GLshort y); + void (APIENTRY *VertexAttrib2svARB) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib3dARB) (GLuint index, GLdouble x, GLdouble y, GLdouble z); + void (APIENTRY *VertexAttrib3dvARB) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib3fARB) (GLuint index, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *VertexAttrib3fvARB) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib3sARB) (GLuint index, GLshort x, GLshort y, GLshort z); + void (APIENTRY *VertexAttrib3svARB) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib4NbvARB) (GLuint index, const GLbyte *v); + void (APIENTRY *VertexAttrib4NivARB) (GLuint index, const GLint *v); + void (APIENTRY *VertexAttrib4NsvARB) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib4NubARB) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); + void (APIENTRY *VertexAttrib4NubvARB) (GLuint index, const GLubyte *v); + void (APIENTRY *VertexAttrib4NuivARB) (GLuint index, const GLuint *v); + void (APIENTRY *VertexAttrib4NusvARB) (GLuint index, const GLushort *v); + void (APIENTRY *VertexAttrib4bvARB) (GLuint index, const GLbyte *v); + void (APIENTRY *VertexAttrib4dARB) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *VertexAttrib4dvARB) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib4fARB) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *VertexAttrib4fvARB) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib4ivARB) (GLuint index, const GLint *v); + void (APIENTRY *VertexAttrib4sARB) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); + void (APIENTRY *VertexAttrib4svARB) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib4ubvARB) (GLuint index, const GLubyte *v); + void (APIENTRY *VertexAttrib4uivARB) (GLuint index, const GLuint *v); + void (APIENTRY *VertexAttrib4usvARB) (GLuint index, const GLushort *v); + void (APIENTRY *VertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *EnableVertexAttribArrayARB) (GLuint index); + void (APIENTRY *DisableVertexAttribArrayARB) (GLuint index); + void (APIENTRY *ProgramStringARB) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); + void (APIENTRY *BindProgramARB) (GLenum target, GLuint program); + void (APIENTRY *DeleteProgramsARB) (GLsizei n, const GLuint *programs); + void (APIENTRY *GenProgramsARB) (GLsizei n, GLuint *programs); + void (APIENTRY *ProgramEnvParameter4dARB) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *ProgramEnvParameter4dvARB) (GLenum target, GLuint index, const GLdouble *params); + void (APIENTRY *ProgramEnvParameter4fARB) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *ProgramEnvParameter4fvARB) (GLenum target, GLuint index, const GLfloat *params); + void (APIENTRY *ProgramLocalParameter4dARB) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *ProgramLocalParameter4dvARB) (GLenum target, GLuint index, const GLdouble *params); + void (APIENTRY *ProgramLocalParameter4fARB) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *ProgramLocalParameter4fvARB) (GLenum target, GLuint index, const GLfloat *params); + void (APIENTRY *GetProgramEnvParameterdvARB) (GLenum target, GLuint index, GLdouble *params); + void (APIENTRY *GetProgramEnvParameterfvARB) (GLenum target, GLuint index, GLfloat *params); + void (APIENTRY *GetProgramLocalParameterdvARB) (GLenum target, GLuint index, GLdouble *params); + void (APIENTRY *GetProgramLocalParameterfvARB) (GLenum target, GLuint index, GLfloat *params); + void (APIENTRY *GetProgramivARB) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetProgramStringARB) (GLenum target, GLenum pname, GLvoid *string); + void (APIENTRY *GetVertexAttribdvARB) (GLuint index, GLenum pname, GLdouble *params); + void (APIENTRY *GetVertexAttribfvARB) (GLuint index, GLenum pname, GLfloat *params); + void (APIENTRY *GetVertexAttribivARB) (GLuint index, GLenum pname, GLint *params); + void (APIENTRY *GetVertexAttribPointervARB) (GLuint index, GLenum pname, GLvoid* *pointer); + GLboolean (APIENTRY *IsProgramARB) (GLuint program); + void (APIENTRY *BindBufferARB) (GLenum target, GLuint buffer); + void (APIENTRY *DeleteBuffersARB) (GLsizei n, const GLuint *buffers); + void (APIENTRY *GenBuffersARB) (GLsizei n, GLuint *buffers); + GLboolean (APIENTRY *IsBufferARB) (GLuint buffer); + void (APIENTRY *BufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); + void (APIENTRY *BufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); + void (APIENTRY *GetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); + GLvoid* (APIENTRY *MapBufferARB) (GLenum target, GLenum access); + GLboolean (APIENTRY *UnmapBufferARB) (GLenum target); + void (APIENTRY *GetBufferParameterivARB) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetBufferPointervARB) (GLenum target, GLenum pname, GLvoid* *params); + void (APIENTRY *GenQueriesARB) (GLsizei n, GLuint *ids); + void (APIENTRY *DeleteQueriesARB) (GLsizei n, const GLuint *ids); + GLboolean (APIENTRY *IsQueryARB) (GLuint id); + void (APIENTRY *BeginQueryARB) (GLenum target, GLuint id); + void (APIENTRY *EndQueryARB) (GLenum target); + void (APIENTRY *GetQueryivARB) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetQueryObjectivARB) (GLuint id, GLenum pname, GLint *params); + void (APIENTRY *GetQueryObjectuivARB) (GLuint id, GLenum pname, GLuint *params); + void (APIENTRY *DeleteObjectARB) (GLhandleARB obj); + GLhandleARB (APIENTRY *GetHandleARB) (GLenum pname); + void (APIENTRY *DetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj); + GLhandleARB (APIENTRY *CreateShaderObjectARB) (GLenum shaderType); + void (APIENTRY *ShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); + void (APIENTRY *CompileShaderARB) (GLhandleARB shaderObj); + GLhandleARB (APIENTRY *CreateProgramObjectARB) (void); + void (APIENTRY *AttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj); + void (APIENTRY *LinkProgramARB) (GLhandleARB programObj); + void (APIENTRY *UseProgramObjectARB) (GLhandleARB programObj); + void (APIENTRY *ValidateProgramARB) (GLhandleARB programObj); + void (APIENTRY *Uniform1fARB) (GLint location, GLfloat v0); + void (APIENTRY *Uniform2fARB) (GLint location, GLfloat v0, GLfloat v1); + void (APIENTRY *Uniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + void (APIENTRY *Uniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + void (APIENTRY *Uniform1iARB) (GLint location, GLint v0); + void (APIENTRY *Uniform2iARB) (GLint location, GLint v0, GLint v1); + void (APIENTRY *Uniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2); + void (APIENTRY *Uniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + void (APIENTRY *Uniform1fvARB) (GLint location, GLsizei count, const GLfloat *value); + void (APIENTRY *Uniform2fvARB) (GLint location, GLsizei count, const GLfloat *value); + void (APIENTRY *Uniform3fvARB) (GLint location, GLsizei count, const GLfloat *value); + void (APIENTRY *Uniform4fvARB) (GLint location, GLsizei count, const GLfloat *value); + void (APIENTRY *Uniform1ivARB) (GLint location, GLsizei count, const GLint *value); + void (APIENTRY *Uniform2ivARB) (GLint location, GLsizei count, const GLint *value); + void (APIENTRY *Uniform3ivARB) (GLint location, GLsizei count, const GLint *value); + void (APIENTRY *Uniform4ivARB) (GLint location, GLsizei count, const GLint *value); + void (APIENTRY *UniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (APIENTRY *UniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (APIENTRY *UniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (APIENTRY *GetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat *params); + void (APIENTRY *GetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint *params); + void (APIENTRY *GetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); + void (APIENTRY *GetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); + GLint (APIENTRY *GetUniformLocationARB) (GLhandleARB programObj, const GLcharARB *name); + void (APIENTRY *GetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); + void (APIENTRY *GetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat *params); + void (APIENTRY *GetUniformivARB) (GLhandleARB programObj, GLint location, GLint *params); + void (APIENTRY *GetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); + void (APIENTRY *BindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB *name); + void (APIENTRY *GetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); + GLint (APIENTRY *GetAttribLocationARB) (GLhandleARB programObj, const GLcharARB *name); + void (APIENTRY *BlendColorEXT) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (APIENTRY *PolygonOffsetEXT) (GLfloat factor, GLfloat bias); + void (APIENTRY *TexImage3DEXT) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *TexSubImage3DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *GetTexFilterFuncSGIS) (GLenum target, GLenum filter, GLfloat *weights); + void (APIENTRY *TexFilterFuncSGIS) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); + void (APIENTRY *TexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *TexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *CopyTexImage1DEXT) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); + void (APIENTRY *CopyTexImage2DEXT) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void (APIENTRY *CopyTexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); + void (APIENTRY *CopyTexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void (APIENTRY *CopyTexSubImage3DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void (APIENTRY *GetHistogramEXT) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); + void (APIENTRY *GetHistogramParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetHistogramParameterivEXT) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetMinmaxEXT) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); + void (APIENTRY *GetMinmaxParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetMinmaxParameterivEXT) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *HistogramEXT) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); + void (APIENTRY *MinmaxEXT) (GLenum target, GLenum internalformat, GLboolean sink); + void (APIENTRY *ResetHistogramEXT) (GLenum target); + void (APIENTRY *ResetMinmaxEXT) (GLenum target); + void (APIENTRY *ConvolutionFilter1DEXT) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); + void (APIENTRY *ConvolutionFilter2DEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); + void (APIENTRY *ConvolutionParameterfEXT) (GLenum target, GLenum pname, GLfloat params); + void (APIENTRY *ConvolutionParameterfvEXT) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *ConvolutionParameteriEXT) (GLenum target, GLenum pname, GLint params); + void (APIENTRY *ConvolutionParameterivEXT) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *CopyConvolutionFilter1DEXT) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void (APIENTRY *CopyConvolutionFilter2DEXT) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); + void (APIENTRY *GetConvolutionFilterEXT) (GLenum target, GLenum format, GLenum type, GLvoid *image); + void (APIENTRY *GetConvolutionParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetConvolutionParameterivEXT) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetSeparableFilterEXT) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); + void (APIENTRY *SeparableFilter2DEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); + void (APIENTRY *ColorTableSGI) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); + void (APIENTRY *ColorTableParameterfvSGI) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *ColorTableParameterivSGI) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *CopyColorTableSGI) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void (APIENTRY *GetColorTableSGI) (GLenum target, GLenum format, GLenum type, GLvoid *table); + void (APIENTRY *GetColorTableParameterfvSGI) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetColorTableParameterivSGI) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *PixelTexGenSGIX) (GLenum mode); + void (APIENTRY *PixelTexGenParameteriSGIS) (GLenum pname, GLint param); + void (APIENTRY *PixelTexGenParameterivSGIS) (GLenum pname, const GLint *params); + void (APIENTRY *PixelTexGenParameterfSGIS) (GLenum pname, GLfloat param); + void (APIENTRY *PixelTexGenParameterfvSGIS) (GLenum pname, const GLfloat *params); + void (APIENTRY *GetPixelTexGenParameterivSGIS) (GLenum pname, GLint *params); + void (APIENTRY *GetPixelTexGenParameterfvSGIS) (GLenum pname, GLfloat *params); + void (APIENTRY *TexImage4DSGIS) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (APIENTRY *TexSubImage4DSGIS) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); + GLboolean (APIENTRY *AreTexturesResidentEXT) (GLsizei n, const GLuint *textures, GLboolean *residences); + void (APIENTRY *BindTextureEXT) (GLenum target, GLuint texture); + void (APIENTRY *DeleteTexturesEXT) (GLsizei n, const GLuint *textures); + void (APIENTRY *GenTexturesEXT) (GLsizei n, GLuint *textures); + GLboolean (APIENTRY *IsTextureEXT) (GLuint texture); + void (APIENTRY *PrioritizeTexturesEXT) (GLsizei n, const GLuint *textures, const GLclampf *priorities); + void (APIENTRY *DetailTexFuncSGIS) (GLenum target, GLsizei n, const GLfloat *points); + void (APIENTRY *GetDetailTexFuncSGIS) (GLenum target, GLfloat *points); + void (APIENTRY *SharpenTexFuncSGIS) (GLenum target, GLsizei n, const GLfloat *points); + void (APIENTRY *GetSharpenTexFuncSGIS) (GLenum target, GLfloat *points); + void (APIENTRY *SampleMaskSGIS) (GLclampf value, GLboolean invert); + void (APIENTRY *SamplePatternSGIS) (GLenum pattern); + void (APIENTRY *ArrayElementEXT) (GLint i); + void (APIENTRY *ColorPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); + void (APIENTRY *DrawArraysEXT) (GLenum mode, GLint first, GLsizei count); + void (APIENTRY *EdgeFlagPointerEXT) (GLsizei stride, GLsizei count, const GLboolean *pointer); + void (APIENTRY *GetPointervEXT) (GLenum pname, GLvoid* *params); + void (APIENTRY *IndexPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); + void (APIENTRY *NormalPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); + void (APIENTRY *TexCoordPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); + void (APIENTRY *VertexPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); + void (APIENTRY *BlendEquationEXT) (GLenum mode); + void (APIENTRY *SpriteParameterfSGIX) (GLenum pname, GLfloat param); + void (APIENTRY *SpriteParameterfvSGIX) (GLenum pname, const GLfloat *params); + void (APIENTRY *SpriteParameteriSGIX) (GLenum pname, GLint param); + void (APIENTRY *SpriteParameterivSGIX) (GLenum pname, const GLint *params); + void (APIENTRY *PointParameterfEXT) (GLenum pname, GLfloat param); + void (APIENTRY *PointParameterfvEXT) (GLenum pname, const GLfloat *params); + void (APIENTRY *PointParameterfSGIS) (GLenum pname, GLfloat param); + void (APIENTRY *PointParameterfvSGIS) (GLenum pname, const GLfloat *params); + GLint (APIENTRY *GetInstrumentsSGIX) (void); + void (APIENTRY *InstrumentsBufferSGIX) (GLsizei size, GLint *buffer); + GLint (APIENTRY *PollInstrumentsSGIX) (GLint *marker_p); + void (APIENTRY *ReadInstrumentsSGIX) (GLint marker); + void (APIENTRY *StartInstrumentsSGIX) (void); + void (APIENTRY *StopInstrumentsSGIX) (GLint marker); + void (APIENTRY *FrameZoomSGIX) (GLint factor); + void (APIENTRY *TagSampleBufferSGIX) (void); + void (APIENTRY *DeformationMap3dSGIX) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); + void (APIENTRY *DeformationMap3fSGIX) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); + void (APIENTRY *DeformSGIX) (GLbitfield mask); + void (APIENTRY *LoadIdentityDeformationMapSGIX) (GLbitfield mask); + void (APIENTRY *ReferencePlaneSGIX) (const GLdouble *equation); + void (APIENTRY *FlushRasterSGIX) (void); + void (APIENTRY *FogFuncSGIS) (GLsizei n, const GLfloat *points); + void (APIENTRY *GetFogFuncSGIS) (GLfloat *points); + void (APIENTRY *ImageTransformParameteriHP) (GLenum target, GLenum pname, GLint param); + void (APIENTRY *ImageTransformParameterfHP) (GLenum target, GLenum pname, GLfloat param); + void (APIENTRY *ImageTransformParameterivHP) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *ImageTransformParameterfvHP) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *GetImageTransformParameterivHP) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetImageTransformParameterfvHP) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *ColorSubTableEXT) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); + void (APIENTRY *CopyColorSubTableEXT) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); + void (APIENTRY *HintPGI) (GLenum target, GLint mode); + void (APIENTRY *ColorTableEXT) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); + void (APIENTRY *GetColorTableEXT) (GLenum target, GLenum format, GLenum type, GLvoid *data); + void (APIENTRY *GetColorTableParameterivEXT) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetColorTableParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetListParameterfvSGIX) (GLuint list, GLenum pname, GLfloat *params); + void (APIENTRY *GetListParameterivSGIX) (GLuint list, GLenum pname, GLint *params); + void (APIENTRY *ListParameterfSGIX) (GLuint list, GLenum pname, GLfloat param); + void (APIENTRY *ListParameterfvSGIX) (GLuint list, GLenum pname, const GLfloat *params); + void (APIENTRY *ListParameteriSGIX) (GLuint list, GLenum pname, GLint param); + void (APIENTRY *ListParameterivSGIX) (GLuint list, GLenum pname, const GLint *params); + void (APIENTRY *IndexMaterialEXT) (GLenum face, GLenum mode); + void (APIENTRY *IndexFuncEXT) (GLenum func, GLclampf ref); + void (APIENTRY *LockArraysEXT) (GLint first, GLsizei count); + void (APIENTRY *UnlockArraysEXT) (void); + void (APIENTRY *CullParameterdvEXT) (GLenum pname, GLdouble *params); + void (APIENTRY *CullParameterfvEXT) (GLenum pname, GLfloat *params); + void (APIENTRY *FragmentColorMaterialSGIX) (GLenum face, GLenum mode); + void (APIENTRY *FragmentLightfSGIX) (GLenum light, GLenum pname, GLfloat param); + void (APIENTRY *FragmentLightfvSGIX) (GLenum light, GLenum pname, const GLfloat *params); + void (APIENTRY *FragmentLightiSGIX) (GLenum light, GLenum pname, GLint param); + void (APIENTRY *FragmentLightivSGIX) (GLenum light, GLenum pname, const GLint *params); + void (APIENTRY *FragmentLightModelfSGIX) (GLenum pname, GLfloat param); + void (APIENTRY *FragmentLightModelfvSGIX) (GLenum pname, const GLfloat *params); + void (APIENTRY *FragmentLightModeliSGIX) (GLenum pname, GLint param); + void (APIENTRY *FragmentLightModelivSGIX) (GLenum pname, const GLint *params); + void (APIENTRY *FragmentMaterialfSGIX) (GLenum face, GLenum pname, GLfloat param); + void (APIENTRY *FragmentMaterialfvSGIX) (GLenum face, GLenum pname, const GLfloat *params); + void (APIENTRY *FragmentMaterialiSGIX) (GLenum face, GLenum pname, GLint param); + void (APIENTRY *FragmentMaterialivSGIX) (GLenum face, GLenum pname, const GLint *params); + void (APIENTRY *GetFragmentLightfvSGIX) (GLenum light, GLenum pname, GLfloat *params); + void (APIENTRY *GetFragmentLightivSGIX) (GLenum light, GLenum pname, GLint *params); + void (APIENTRY *GetFragmentMaterialfvSGIX) (GLenum face, GLenum pname, GLfloat *params); + void (APIENTRY *GetFragmentMaterialivSGIX) (GLenum face, GLenum pname, GLint *params); + void (APIENTRY *LightEnviSGIX) (GLenum pname, GLint param); + void (APIENTRY *DrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); + void (APIENTRY *ApplyTextureEXT) (GLenum mode); + void (APIENTRY *TextureLightEXT) (GLenum pname); + void (APIENTRY *TextureMaterialEXT) (GLenum face, GLenum mode); + void (APIENTRY *AsyncMarkerSGIX) (GLuint marker); + GLint (APIENTRY *FinishAsyncSGIX) (GLuint *markerp); + GLint (APIENTRY *PollAsyncSGIX) (GLuint *markerp); + GLuint (APIENTRY *GenAsyncMarkersSGIX) (GLsizei range); + void (APIENTRY *DeleteAsyncMarkersSGIX) (GLuint marker, GLsizei range); + GLboolean (APIENTRY *IsAsyncMarkerSGIX) (GLuint marker); + void (APIENTRY *VertexPointervINTEL) (GLint size, GLenum type, const GLvoid* *pointer); + void (APIENTRY *NormalPointervINTEL) (GLenum type, const GLvoid* *pointer); + void (APIENTRY *ColorPointervINTEL) (GLint size, GLenum type, const GLvoid* *pointer); + void (APIENTRY *TexCoordPointervINTEL) (GLint size, GLenum type, const GLvoid* *pointer); + void (APIENTRY *PixelTransformParameteriEXT) (GLenum target, GLenum pname, GLint param); + void (APIENTRY *PixelTransformParameterfEXT) (GLenum target, GLenum pname, GLfloat param); + void (APIENTRY *PixelTransformParameterivEXT) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *PixelTransformParameterfvEXT) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *SecondaryColor3bEXT) (GLbyte red, GLbyte green, GLbyte blue); + void (APIENTRY *SecondaryColor3bvEXT) (const GLbyte *v); + void (APIENTRY *SecondaryColor3dEXT) (GLdouble red, GLdouble green, GLdouble blue); + void (APIENTRY *SecondaryColor3dvEXT) (const GLdouble *v); + void (APIENTRY *SecondaryColor3fEXT) (GLfloat red, GLfloat green, GLfloat blue); + void (APIENTRY *SecondaryColor3fvEXT) (const GLfloat *v); + void (APIENTRY *SecondaryColor3iEXT) (GLint red, GLint green, GLint blue); + void (APIENTRY *SecondaryColor3ivEXT) (const GLint *v); + void (APIENTRY *SecondaryColor3sEXT) (GLshort red, GLshort green, GLshort blue); + void (APIENTRY *SecondaryColor3svEXT) (const GLshort *v); + void (APIENTRY *SecondaryColor3ubEXT) (GLubyte red, GLubyte green, GLubyte blue); + void (APIENTRY *SecondaryColor3ubvEXT) (const GLubyte *v); + void (APIENTRY *SecondaryColor3uiEXT) (GLuint red, GLuint green, GLuint blue); + void (APIENTRY *SecondaryColor3uivEXT) (const GLuint *v); + void (APIENTRY *SecondaryColor3usEXT) (GLushort red, GLushort green, GLushort blue); + void (APIENTRY *SecondaryColor3usvEXT) (const GLushort *v); + void (APIENTRY *SecondaryColorPointerEXT) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *TextureNormalEXT) (GLenum mode); + void (APIENTRY *MultiDrawArraysEXT) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); + void (APIENTRY *MultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); + void (APIENTRY *FogCoordfEXT) (GLfloat coord); + void (APIENTRY *FogCoordfvEXT) (const GLfloat *coord); + void (APIENTRY *FogCoorddEXT) (GLdouble coord); + void (APIENTRY *FogCoorddvEXT) (const GLdouble *coord); + void (APIENTRY *FogCoordPointerEXT) (GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *Tangent3bEXT) (GLbyte tx, GLbyte ty, GLbyte tz); + void (APIENTRY *Tangent3bvEXT) (const GLbyte *v); + void (APIENTRY *Tangent3dEXT) (GLdouble tx, GLdouble ty, GLdouble tz); + void (APIENTRY *Tangent3dvEXT) (const GLdouble *v); + void (APIENTRY *Tangent3fEXT) (GLfloat tx, GLfloat ty, GLfloat tz); + void (APIENTRY *Tangent3fvEXT) (const GLfloat *v); + void (APIENTRY *Tangent3iEXT) (GLint tx, GLint ty, GLint tz); + void (APIENTRY *Tangent3ivEXT) (const GLint *v); + void (APIENTRY *Tangent3sEXT) (GLshort tx, GLshort ty, GLshort tz); + void (APIENTRY *Tangent3svEXT) (const GLshort *v); + void (APIENTRY *Binormal3bEXT) (GLbyte bx, GLbyte by, GLbyte bz); + void (APIENTRY *Binormal3bvEXT) (const GLbyte *v); + void (APIENTRY *Binormal3dEXT) (GLdouble bx, GLdouble by, GLdouble bz); + void (APIENTRY *Binormal3dvEXT) (const GLdouble *v); + void (APIENTRY *Binormal3fEXT) (GLfloat bx, GLfloat by, GLfloat bz); + void (APIENTRY *Binormal3fvEXT) (const GLfloat *v); + void (APIENTRY *Binormal3iEXT) (GLint bx, GLint by, GLint bz); + void (APIENTRY *Binormal3ivEXT) (const GLint *v); + void (APIENTRY *Binormal3sEXT) (GLshort bx, GLshort by, GLshort bz); + void (APIENTRY *Binormal3svEXT) (const GLshort *v); + void (APIENTRY *TangentPointerEXT) (GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *BinormalPointerEXT) (GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *FinishTextureSUNX) (void); + void (APIENTRY *GlobalAlphaFactorbSUN) (GLbyte factor); + void (APIENTRY *GlobalAlphaFactorsSUN) (GLshort factor); + void (APIENTRY *GlobalAlphaFactoriSUN) (GLint factor); + void (APIENTRY *GlobalAlphaFactorfSUN) (GLfloat factor); + void (APIENTRY *GlobalAlphaFactordSUN) (GLdouble factor); + void (APIENTRY *GlobalAlphaFactorubSUN) (GLubyte factor); + void (APIENTRY *GlobalAlphaFactorusSUN) (GLushort factor); + void (APIENTRY *GlobalAlphaFactoruiSUN) (GLuint factor); + void (APIENTRY *ReplacementCodeuiSUN) (GLuint code); + void (APIENTRY *ReplacementCodeusSUN) (GLushort code); + void (APIENTRY *ReplacementCodeubSUN) (GLubyte code); + void (APIENTRY *ReplacementCodeuivSUN) (const GLuint *code); + void (APIENTRY *ReplacementCodeusvSUN) (const GLushort *code); + void (APIENTRY *ReplacementCodeubvSUN) (const GLubyte *code); + void (APIENTRY *ReplacementCodePointerSUN) (GLenum type, GLsizei stride, const GLvoid* *pointer); + void (APIENTRY *Color4ubVertex2fSUN) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); + void (APIENTRY *Color4ubVertex2fvSUN) (const GLubyte *c, const GLfloat *v); + void (APIENTRY *Color4ubVertex3fSUN) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *Color4ubVertex3fvSUN) (const GLubyte *c, const GLfloat *v); + void (APIENTRY *Color3fVertex3fSUN) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *Color3fVertex3fvSUN) (const GLfloat *c, const GLfloat *v); + void (APIENTRY *Normal3fVertex3fSUN) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *Normal3fVertex3fvSUN) (const GLfloat *n, const GLfloat *v); + void (APIENTRY *Color4fNormal3fVertex3fSUN) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *Color4fNormal3fVertex3fvSUN) (const GLfloat *c, const GLfloat *n, const GLfloat *v); + void (APIENTRY *TexCoord2fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *TexCoord2fVertex3fvSUN) (const GLfloat *tc, const GLfloat *v); + void (APIENTRY *TexCoord4fVertex4fSUN) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *TexCoord4fVertex4fvSUN) (const GLfloat *tc, const GLfloat *v); + void (APIENTRY *TexCoord2fColor4ubVertex3fSUN) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *TexCoord2fColor4ubVertex3fvSUN) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); + void (APIENTRY *TexCoord2fColor3fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *TexCoord2fColor3fVertex3fvSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); + void (APIENTRY *TexCoord2fNormal3fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *TexCoord2fNormal3fVertex3fvSUN) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); + void (APIENTRY *TexCoord2fColor4fNormal3fVertex3fSUN) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *TexCoord2fColor4fNormal3fVertex3fvSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); + void (APIENTRY *TexCoord4fColor4fNormal3fVertex4fSUN) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *TexCoord4fColor4fNormal3fVertex4fvSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiVertex3fSUN) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiVertex3fvSUN) (const GLuint *rc, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiColor4ubVertex3fSUN) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiColor4ubVertex3fvSUN) (const GLuint *rc, const GLubyte *c, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiColor3fVertex3fSUN) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiColor3fVertex3fvSUN) (const GLuint *rc, const GLfloat *c, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiNormal3fVertex3fSUN) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *n, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiColor4fNormal3fVertex3fSUN) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiColor4fNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiTexCoord2fVertex3fSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiTexCoord2fVertex3fvSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); + void (APIENTRY *ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); + void (APIENTRY *BlendFuncSeparateEXT) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + void (APIENTRY *BlendFuncSeparateINGR) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + void (APIENTRY *VertexWeightfEXT) (GLfloat weight); + void (APIENTRY *VertexWeightfvEXT) (const GLfloat *weight); + void (APIENTRY *VertexWeightPointerEXT) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *FlushVertexArrayRangeNV) (void); + void (APIENTRY *VertexArrayRangeNV) (GLsizei length, const GLvoid *pointer); + void (APIENTRY *CombinerParameterfvNV) (GLenum pname, const GLfloat *params); + void (APIENTRY *CombinerParameterfNV) (GLenum pname, GLfloat param); + void (APIENTRY *CombinerParameterivNV) (GLenum pname, const GLint *params); + void (APIENTRY *CombinerParameteriNV) (GLenum pname, GLint param); + void (APIENTRY *CombinerInputNV) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); + void (APIENTRY *CombinerOutputNV) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); + void (APIENTRY *FinalCombinerInputNV) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); + void (APIENTRY *GetCombinerInputParameterfvNV) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); + void (APIENTRY *GetCombinerInputParameterivNV) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); + void (APIENTRY *GetCombinerOutputParameterfvNV) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); + void (APIENTRY *GetCombinerOutputParameterivNV) (GLenum stage, GLenum portion, GLenum pname, GLint *params); + void (APIENTRY *GetFinalCombinerInputParameterfvNV) (GLenum variable, GLenum pname, GLfloat *params); + void (APIENTRY *GetFinalCombinerInputParameterivNV) (GLenum variable, GLenum pname, GLint *params); + void (APIENTRY *ResizeBuffersMESA) (void); + void (APIENTRY *WindowPos2dMESA) (GLdouble x, GLdouble y); + void (APIENTRY *WindowPos2dvMESA) (const GLdouble *v); + void (APIENTRY *WindowPos2fMESA) (GLfloat x, GLfloat y); + void (APIENTRY *WindowPos2fvMESA) (const GLfloat *v); + void (APIENTRY *WindowPos2iMESA) (GLint x, GLint y); + void (APIENTRY *WindowPos2ivMESA) (const GLint *v); + void (APIENTRY *WindowPos2sMESA) (GLshort x, GLshort y); + void (APIENTRY *WindowPos2svMESA) (const GLshort *v); + void (APIENTRY *WindowPos3dMESA) (GLdouble x, GLdouble y, GLdouble z); + void (APIENTRY *WindowPos3dvMESA) (const GLdouble *v); + void (APIENTRY *WindowPos3fMESA) (GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *WindowPos3fvMESA) (const GLfloat *v); + void (APIENTRY *WindowPos3iMESA) (GLint x, GLint y, GLint z); + void (APIENTRY *WindowPos3ivMESA) (const GLint *v); + void (APIENTRY *WindowPos3sMESA) (GLshort x, GLshort y, GLshort z); + void (APIENTRY *WindowPos3svMESA) (const GLshort *v); + void (APIENTRY *WindowPos4dMESA) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *WindowPos4dvMESA) (const GLdouble *v); + void (APIENTRY *WindowPos4fMESA) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *WindowPos4fvMESA) (const GLfloat *v); + void (APIENTRY *WindowPos4iMESA) (GLint x, GLint y, GLint z, GLint w); + void (APIENTRY *WindowPos4ivMESA) (const GLint *v); + void (APIENTRY *WindowPos4sMESA) (GLshort x, GLshort y, GLshort z, GLshort w); + void (APIENTRY *WindowPos4svMESA) (const GLshort *v); + void (APIENTRY *MultiModeDrawArraysIBM) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); + void (APIENTRY *MultiModeDrawElementsIBM) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); + void (APIENTRY *ColorPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *SecondaryColorPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *EdgeFlagPointerListIBM) (GLint stride, const GLboolean* *pointer, GLint ptrstride); + void (APIENTRY *FogCoordPointerListIBM) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *IndexPointerListIBM) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *NormalPointerListIBM) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *TexCoordPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *VertexPointerListIBM) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); + void (APIENTRY *TbufferMask3DFX) (GLuint mask); + void (APIENTRY *SampleMaskEXT) (GLclampf value, GLboolean invert); + void (APIENTRY *SamplePatternEXT) (GLenum pattern); + void (APIENTRY *TextureColorMaskSGIS) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void (APIENTRY *IglooInterfaceSGIX) (GLenum pname, const GLvoid *params); + void (APIENTRY *DeleteFencesNV) (GLsizei n, const GLuint *fences); + void (APIENTRY *GenFencesNV) (GLsizei n, GLuint *fences); + GLboolean (APIENTRY *IsFenceNV) (GLuint fence); + GLboolean (APIENTRY *TestFenceNV) (GLuint fence); + void (APIENTRY *GetFenceivNV) (GLuint fence, GLenum pname, GLint *params); + void (APIENTRY *FinishFenceNV) (GLuint fence); + void (APIENTRY *SetFenceNV) (GLuint fence, GLenum condition); + void (APIENTRY *MapControlPointsNV) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); + void (APIENTRY *MapParameterivNV) (GLenum target, GLenum pname, const GLint *params); + void (APIENTRY *MapParameterfvNV) (GLenum target, GLenum pname, const GLfloat *params); + void (APIENTRY *GetMapControlPointsNV) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); + void (APIENTRY *GetMapParameterivNV) (GLenum target, GLenum pname, GLint *params); + void (APIENTRY *GetMapParameterfvNV) (GLenum target, GLenum pname, GLfloat *params); + void (APIENTRY *GetMapAttribParameterivNV) (GLenum target, GLuint index, GLenum pname, GLint *params); + void (APIENTRY *GetMapAttribParameterfvNV) (GLenum target, GLuint index, GLenum pname, GLfloat *params); + void (APIENTRY *EvalMapsNV) (GLenum target, GLenum mode); + void (APIENTRY *CombinerStageParameterfvNV) (GLenum stage, GLenum pname, const GLfloat *params); + void (APIENTRY *GetCombinerStageParameterfvNV) (GLenum stage, GLenum pname, GLfloat *params); + GLboolean (APIENTRY *AreProgramsResidentNV) (GLsizei n, const GLuint *programs, GLboolean *residences); + void (APIENTRY *BindProgramNV) (GLenum target, GLuint id); + void (APIENTRY *DeleteProgramsNV) (GLsizei n, const GLuint *programs); + void (APIENTRY *ExecuteProgramNV) (GLenum target, GLuint id, const GLfloat *params); + void (APIENTRY *GenProgramsNV) (GLsizei n, GLuint *programs); + void (APIENTRY *GetProgramParameterdvNV) (GLenum target, GLuint index, GLenum pname, GLdouble *params); + void (APIENTRY *GetProgramParameterfvNV) (GLenum target, GLuint index, GLenum pname, GLfloat *params); + void (APIENTRY *GetProgramivNV) (GLuint id, GLenum pname, GLint *params); + void (APIENTRY *GetProgramStringNV) (GLuint id, GLenum pname, GLubyte *program); + void (APIENTRY *GetTrackMatrixivNV) (GLenum target, GLuint address, GLenum pname, GLint *params); + void (APIENTRY *GetVertexAttribdvNV) (GLuint index, GLenum pname, GLdouble *params); + void (APIENTRY *GetVertexAttribfvNV) (GLuint index, GLenum pname, GLfloat *params); + void (APIENTRY *GetVertexAttribivNV) (GLuint index, GLenum pname, GLint *params); + void (APIENTRY *GetVertexAttribPointervNV) (GLuint index, GLenum pname, GLvoid* *pointer); + GLboolean (APIENTRY *IsProgramNV) (GLuint id); + void (APIENTRY *LoadProgramNV) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); + void (APIENTRY *ProgramParameter4dNV) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *ProgramParameter4dvNV) (GLenum target, GLuint index, const GLdouble *v); + void (APIENTRY *ProgramParameter4fNV) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *ProgramParameter4fvNV) (GLenum target, GLuint index, const GLfloat *v); + void (APIENTRY *ProgramParameters4dvNV) (GLenum target, GLuint index, GLuint count, const GLdouble *v); + void (APIENTRY *ProgramParameters4fvNV) (GLenum target, GLuint index, GLuint count, const GLfloat *v); + void (APIENTRY *RequestResidentProgramsNV) (GLsizei n, const GLuint *programs); + void (APIENTRY *TrackMatrixNV) (GLenum target, GLuint address, GLenum matrix, GLenum transform); + void (APIENTRY *VertexAttribPointerNV) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); + void (APIENTRY *VertexAttrib1dNV) (GLuint index, GLdouble x); + void (APIENTRY *VertexAttrib1dvNV) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib1fNV) (GLuint index, GLfloat x); + void (APIENTRY *VertexAttrib1fvNV) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib1sNV) (GLuint index, GLshort x); + void (APIENTRY *VertexAttrib1svNV) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib2dNV) (GLuint index, GLdouble x, GLdouble y); + void (APIENTRY *VertexAttrib2dvNV) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib2fNV) (GLuint index, GLfloat x, GLfloat y); + void (APIENTRY *VertexAttrib2fvNV) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib2sNV) (GLuint index, GLshort x, GLshort y); + void (APIENTRY *VertexAttrib2svNV) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib3dNV) (GLuint index, GLdouble x, GLdouble y, GLdouble z); + void (APIENTRY *VertexAttrib3dvNV) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib3fNV) (GLuint index, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *VertexAttrib3fvNV) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib3sNV) (GLuint index, GLshort x, GLshort y, GLshort z); + void (APIENTRY *VertexAttrib3svNV) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib4dNV) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *VertexAttrib4dvNV) (GLuint index, const GLdouble *v); + void (APIENTRY *VertexAttrib4fNV) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *VertexAttrib4fvNV) (GLuint index, const GLfloat *v); + void (APIENTRY *VertexAttrib4sNV) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); + void (APIENTRY *VertexAttrib4svNV) (GLuint index, const GLshort *v); + void (APIENTRY *VertexAttrib4ubNV) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); + void (APIENTRY *VertexAttrib4ubvNV) (GLuint index, const GLubyte *v); + void (APIENTRY *VertexAttribs1dvNV) (GLuint index, GLsizei count, const GLdouble *v); + void (APIENTRY *VertexAttribs1fvNV) (GLuint index, GLsizei count, const GLfloat *v); + void (APIENTRY *VertexAttribs1svNV) (GLuint index, GLsizei count, const GLshort *v); + void (APIENTRY *VertexAttribs2dvNV) (GLuint index, GLsizei count, const GLdouble *v); + void (APIENTRY *VertexAttribs2fvNV) (GLuint index, GLsizei count, const GLfloat *v); + void (APIENTRY *VertexAttribs2svNV) (GLuint index, GLsizei count, const GLshort *v); + void (APIENTRY *VertexAttribs3dvNV) (GLuint index, GLsizei count, const GLdouble *v); + void (APIENTRY *VertexAttribs3fvNV) (GLuint index, GLsizei count, const GLfloat *v); + void (APIENTRY *VertexAttribs3svNV) (GLuint index, GLsizei count, const GLshort *v); + void (APIENTRY *VertexAttribs4dvNV) (GLuint index, GLsizei count, const GLdouble *v); + void (APIENTRY *VertexAttribs4fvNV) (GLuint index, GLsizei count, const GLfloat *v); + void (APIENTRY *VertexAttribs4svNV) (GLuint index, GLsizei count, const GLshort *v); + void (APIENTRY *VertexAttribs4ubvNV) (GLuint index, GLsizei count, const GLubyte *v); + void (APIENTRY *TexBumpParameterivATI) (GLenum pname, const GLint *param); + void (APIENTRY *TexBumpParameterfvATI) (GLenum pname, const GLfloat *param); + void (APIENTRY *GetTexBumpParameterivATI) (GLenum pname, GLint *param); + void (APIENTRY *GetTexBumpParameterfvATI) (GLenum pname, GLfloat *param); + GLuint (APIENTRY *GenFragmentShadersATI) (GLuint range); + void (APIENTRY *BindFragmentShaderATI) (GLuint id); + void (APIENTRY *DeleteFragmentShaderATI) (GLuint id); + void (APIENTRY *BeginFragmentShaderATI) (void); + void (APIENTRY *EndFragmentShaderATI) (void); + void (APIENTRY *PassTexCoordATI) (GLuint dst, GLuint coord, GLenum swizzle); + void (APIENTRY *SampleMapATI) (GLuint dst, GLuint interp, GLenum swizzle); + void (APIENTRY *ColorFragmentOp1ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); + void (APIENTRY *ColorFragmentOp2ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); + void (APIENTRY *ColorFragmentOp3ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); + void (APIENTRY *AlphaFragmentOp1ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); + void (APIENTRY *AlphaFragmentOp2ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); + void (APIENTRY *AlphaFragmentOp3ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); + void (APIENTRY *SetFragmentShaderConstantATI) (GLuint dst, const GLfloat *value); + void (APIENTRY *PNTrianglesiATI) (GLenum pname, GLint param); + void (APIENTRY *PNTrianglesfATI) (GLenum pname, GLfloat param); + GLuint (APIENTRY *NewObjectBufferATI) (GLsizei size, const GLvoid *pointer, GLenum usage); + GLboolean (APIENTRY *IsObjectBufferATI) (GLuint buffer); + void (APIENTRY *UpdateObjectBufferATI) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); + void (APIENTRY *GetObjectBufferfvATI) (GLuint buffer, GLenum pname, GLfloat *params); + void (APIENTRY *GetObjectBufferivATI) (GLuint buffer, GLenum pname, GLint *params); + void (APIENTRY *FreeObjectBufferATI) (GLuint buffer); + void (APIENTRY *ArrayObjectATI) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); + void (APIENTRY *GetArrayObjectfvATI) (GLenum array, GLenum pname, GLfloat *params); + void (APIENTRY *GetArrayObjectivATI) (GLenum array, GLenum pname, GLint *params); + void (APIENTRY *VariantArrayObjectATI) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); + void (APIENTRY *GetVariantArrayObjectfvATI) (GLuint id, GLenum pname, GLfloat *params); + void (APIENTRY *GetVariantArrayObjectivATI) (GLuint id, GLenum pname, GLint *params); + void (APIENTRY *BeginVertexShaderEXT) (void); + void (APIENTRY *EndVertexShaderEXT) (void); + void (APIENTRY *BindVertexShaderEXT) (GLuint id); + GLuint (APIENTRY *GenVertexShadersEXT) (GLuint range); + void (APIENTRY *DeleteVertexShaderEXT) (GLuint id); + void (APIENTRY *ShaderOp1EXT) (GLenum op, GLuint res, GLuint arg1); + void (APIENTRY *ShaderOp2EXT) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); + void (APIENTRY *ShaderOp3EXT) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); + void (APIENTRY *SwizzleEXT) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); + void (APIENTRY *WriteMaskEXT) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); + void (APIENTRY *InsertComponentEXT) (GLuint res, GLuint src, GLuint num); + void (APIENTRY *ExtractComponentEXT) (GLuint res, GLuint src, GLuint num); + GLuint (APIENTRY *GenSymbolsEXT) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); + void (APIENTRY *SetInvariantEXT) (GLuint id, GLenum type, const GLvoid *addr); + void (APIENTRY *SetLocalConstantEXT) (GLuint id, GLenum type, const GLvoid *addr); + void (APIENTRY *VariantbvEXT) (GLuint id, const GLbyte *addr); + void (APIENTRY *VariantsvEXT) (GLuint id, const GLshort *addr); + void (APIENTRY *VariantivEXT) (GLuint id, const GLint *addr); + void (APIENTRY *VariantfvEXT) (GLuint id, const GLfloat *addr); + void (APIENTRY *VariantdvEXT) (GLuint id, const GLdouble *addr); + void (APIENTRY *VariantubvEXT) (GLuint id, const GLubyte *addr); + void (APIENTRY *VariantusvEXT) (GLuint id, const GLushort *addr); + void (APIENTRY *VariantuivEXT) (GLuint id, const GLuint *addr); + void (APIENTRY *VariantPointerEXT) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); + void (APIENTRY *EnableVariantClientStateEXT) (GLuint id); + void (APIENTRY *DisableVariantClientStateEXT) (GLuint id); + GLuint (APIENTRY *BindLightParameterEXT) (GLenum light, GLenum value); + GLuint (APIENTRY *BindMaterialParameterEXT) (GLenum face, GLenum value); + GLuint (APIENTRY *BindTexGenParameterEXT) (GLenum unit, GLenum coord, GLenum value); + GLuint (APIENTRY *BindTextureUnitParameterEXT) (GLenum unit, GLenum value); + GLuint (APIENTRY *BindParameterEXT) (GLenum value); + GLboolean (APIENTRY *IsVariantEnabledEXT) (GLuint id, GLenum cap); + void (APIENTRY *GetVariantBooleanvEXT) (GLuint id, GLenum value, GLboolean *data); + void (APIENTRY *GetVariantIntegervEXT) (GLuint id, GLenum value, GLint *data); + void (APIENTRY *GetVariantFloatvEXT) (GLuint id, GLenum value, GLfloat *data); + void (APIENTRY *GetVariantPointervEXT) (GLuint id, GLenum value, GLvoid* *data); + void (APIENTRY *GetInvariantBooleanvEXT) (GLuint id, GLenum value, GLboolean *data); + void (APIENTRY *GetInvariantIntegervEXT) (GLuint id, GLenum value, GLint *data); + void (APIENTRY *GetInvariantFloatvEXT) (GLuint id, GLenum value, GLfloat *data); + void (APIENTRY *GetLocalConstantBooleanvEXT) (GLuint id, GLenum value, GLboolean *data); + void (APIENTRY *GetLocalConstantIntegervEXT) (GLuint id, GLenum value, GLint *data); + void (APIENTRY *GetLocalConstantFloatvEXT) (GLuint id, GLenum value, GLfloat *data); + void (APIENTRY *VertexStream1sATI) (GLenum stream, GLshort x); + void (APIENTRY *VertexStream1svATI) (GLenum stream, const GLshort *coords); + void (APIENTRY *VertexStream1iATI) (GLenum stream, GLint x); + void (APIENTRY *VertexStream1ivATI) (GLenum stream, const GLint *coords); + void (APIENTRY *VertexStream1fATI) (GLenum stream, GLfloat x); + void (APIENTRY *VertexStream1fvATI) (GLenum stream, const GLfloat *coords); + void (APIENTRY *VertexStream1dATI) (GLenum stream, GLdouble x); + void (APIENTRY *VertexStream1dvATI) (GLenum stream, const GLdouble *coords); + void (APIENTRY *VertexStream2sATI) (GLenum stream, GLshort x, GLshort y); + void (APIENTRY *VertexStream2svATI) (GLenum stream, const GLshort *coords); + void (APIENTRY *VertexStream2iATI) (GLenum stream, GLint x, GLint y); + void (APIENTRY *VertexStream2ivATI) (GLenum stream, const GLint *coords); + void (APIENTRY *VertexStream2fATI) (GLenum stream, GLfloat x, GLfloat y); + void (APIENTRY *VertexStream2fvATI) (GLenum stream, const GLfloat *coords); + void (APIENTRY *VertexStream2dATI) (GLenum stream, GLdouble x, GLdouble y); + void (APIENTRY *VertexStream2dvATI) (GLenum stream, const GLdouble *coords); + void (APIENTRY *VertexStream3sATI) (GLenum stream, GLshort x, GLshort y, GLshort z); + void (APIENTRY *VertexStream3svATI) (GLenum stream, const GLshort *coords); + void (APIENTRY *VertexStream3iATI) (GLenum stream, GLint x, GLint y, GLint z); + void (APIENTRY *VertexStream3ivATI) (GLenum stream, const GLint *coords); + void (APIENTRY *VertexStream3fATI) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); + void (APIENTRY *VertexStream3fvATI) (GLenum stream, const GLfloat *coords); + void (APIENTRY *VertexStream3dATI) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); + void (APIENTRY *VertexStream3dvATI) (GLenum stream, const GLdouble *coords); + void (APIENTRY *VertexStream4sATI) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); + void (APIENTRY *VertexStream4svATI) (GLenum stream, const GLshort *coords); + void (APIENTRY *VertexStream4iATI) (GLenum stream, GLint x, GLint y, GLint z, GLint w); + void (APIENTRY *VertexStream4ivATI) (GLenum stream, const GLint *coords); + void (APIENTRY *VertexStream4fATI) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *VertexStream4fvATI) (GLenum stream, const GLfloat *coords); + void (APIENTRY *VertexStream4dATI) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *VertexStream4dvATI) (GLenum stream, const GLdouble *coords); + void (APIENTRY *NormalStream3bATI) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); + void (APIENTRY *NormalStream3bvATI) (GLenum stream, const GLbyte *coords); + void (APIENTRY *NormalStream3sATI) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); + void (APIENTRY *NormalStream3svATI) (GLenum stream, const GLshort *coords); + void (APIENTRY *NormalStream3iATI) (GLenum stream, GLint nx, GLint ny, GLint nz); + void (APIENTRY *NormalStream3ivATI) (GLenum stream, const GLint *coords); + void (APIENTRY *NormalStream3fATI) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); + void (APIENTRY *NormalStream3fvATI) (GLenum stream, const GLfloat *coords); + void (APIENTRY *NormalStream3dATI) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); + void (APIENTRY *NormalStream3dvATI) (GLenum stream, const GLdouble *coords); + void (APIENTRY *ClientActiveVertexStreamATI) (GLenum stream); + void (APIENTRY *VertexBlendEnviATI) (GLenum pname, GLint param); + void (APIENTRY *VertexBlendEnvfATI) (GLenum pname, GLfloat param); + void (APIENTRY *ElementPointerATI) (GLenum type, const GLvoid *pointer); + void (APIENTRY *DrawElementArrayATI) (GLenum mode, GLsizei count); + void (APIENTRY *DrawRangeElementArrayATI) (GLenum mode, GLuint start, GLuint end, GLsizei count); + void (APIENTRY *DrawMeshArraysSUN) (GLenum mode, GLint first, GLsizei count, GLsizei width); + void (APIENTRY *GenOcclusionQueriesNV) (GLsizei n, GLuint *ids); + void (APIENTRY *DeleteOcclusionQueriesNV) (GLsizei n, const GLuint *ids); + GLboolean (APIENTRY *IsOcclusionQueryNV) (GLuint id); + void (APIENTRY *BeginOcclusionQueryNV) (GLuint id); + void (APIENTRY *EndOcclusionQueryNV) (void); + void (APIENTRY *GetOcclusionQueryivNV) (GLuint id, GLenum pname, GLint *params); + void (APIENTRY *GetOcclusionQueryuivNV) (GLuint id, GLenum pname, GLuint *params); + void (APIENTRY *PointParameteriNV) (GLenum pname, GLint param); + void (APIENTRY *PointParameterivNV) (GLenum pname, const GLint *params); + void (APIENTRY *ActiveStencilFaceEXT) (GLenum face); + void (APIENTRY *ElementPointerAPPLE) (GLenum type, const GLvoid *pointer); + void (APIENTRY *DrawElementArrayAPPLE) (GLenum mode, GLint first, GLsizei count); + void (APIENTRY *DrawRangeElementArrayAPPLE) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); + void (APIENTRY *MultiDrawElementArrayAPPLE) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); + void (APIENTRY *MultiDrawRangeElementArrayAPPLE) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); + void (APIENTRY *GenFencesAPPLE) (GLsizei n, GLuint *fences); + void (APIENTRY *DeleteFencesAPPLE) (GLsizei n, const GLuint *fences); + void (APIENTRY *SetFenceAPPLE) (GLuint fence); + GLboolean (APIENTRY *IsFenceAPPLE) (GLuint fence); + GLboolean (APIENTRY *TestFenceAPPLE) (GLuint fence); + void (APIENTRY *FinishFenceAPPLE) (GLuint fence); + GLboolean (APIENTRY *TestObjectAPPLE) (GLenum object, GLuint name); + void (APIENTRY *FinishObjectAPPLE) (GLenum object, GLint name); + void (APIENTRY *BindVertexArrayAPPLE) (GLuint array); + void (APIENTRY *DeleteVertexArraysAPPLE) (GLsizei n, const GLuint *arrays); + void (APIENTRY *GenVertexArraysAPPLE) (GLsizei n, const GLuint *arrays); + GLboolean (APIENTRY *IsVertexArrayAPPLE) (GLuint array); + void (APIENTRY *VertexArrayRangeAPPLE) (GLsizei length, GLvoid *pointer); + void (APIENTRY *FlushVertexArrayRangeAPPLE) (GLsizei length, GLvoid *pointer); + void (APIENTRY *VertexArrayParameteriAPPLE) (GLenum pname, GLint param); + void (APIENTRY *DrawBuffersATI) (GLsizei n, const GLenum *bufs); + void (APIENTRY *ProgramNamedParameter4fNV) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (APIENTRY *ProgramNamedParameter4dNV) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (APIENTRY *ProgramNamedParameter4fvNV) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); + void (APIENTRY *ProgramNamedParameter4dvNV) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); + void (APIENTRY *GetProgramNamedParameterfvNV) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); + void (APIENTRY *GetProgramNamedParameterdvNV) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); + void (APIENTRY *Vertex2hNV) (GLhalfNV x, GLhalfNV y); + void (APIENTRY *Vertex2hvNV) (const GLhalfNV *v); + void (APIENTRY *Vertex3hNV) (GLhalfNV x, GLhalfNV y, GLhalfNV z); + void (APIENTRY *Vertex3hvNV) (const GLhalfNV *v); + void (APIENTRY *Vertex4hNV) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); + void (APIENTRY *Vertex4hvNV) (const GLhalfNV *v); + void (APIENTRY *Normal3hNV) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); + void (APIENTRY *Normal3hvNV) (const GLhalfNV *v); + void (APIENTRY *Color3hNV) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); + void (APIENTRY *Color3hvNV) (const GLhalfNV *v); + void (APIENTRY *Color4hNV) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); + void (APIENTRY *Color4hvNV) (const GLhalfNV *v); + void (APIENTRY *TexCoord1hNV) (GLhalfNV s); + void (APIENTRY *TexCoord1hvNV) (const GLhalfNV *v); + void (APIENTRY *TexCoord2hNV) (GLhalfNV s, GLhalfNV t); + void (APIENTRY *TexCoord2hvNV) (const GLhalfNV *v); + void (APIENTRY *TexCoord3hNV) (GLhalfNV s, GLhalfNV t, GLhalfNV r); + void (APIENTRY *TexCoord3hvNV) (const GLhalfNV *v); + void (APIENTRY *TexCoord4hNV) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); + void (APIENTRY *TexCoord4hvNV) (const GLhalfNV *v); + void (APIENTRY *MultiTexCoord1hNV) (GLenum target, GLhalfNV s); + void (APIENTRY *MultiTexCoord1hvNV) (GLenum target, const GLhalfNV *v); + void (APIENTRY *MultiTexCoord2hNV) (GLenum target, GLhalfNV s, GLhalfNV t); + void (APIENTRY *MultiTexCoord2hvNV) (GLenum target, const GLhalfNV *v); + void (APIENTRY *MultiTexCoord3hNV) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); + void (APIENTRY *MultiTexCoord3hvNV) (GLenum target, const GLhalfNV *v); + void (APIENTRY *MultiTexCoord4hNV) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); + void (APIENTRY *MultiTexCoord4hvNV) (GLenum target, const GLhalfNV *v); + void (APIENTRY *FogCoordhNV) (GLhalfNV fog); + void (APIENTRY *FogCoordhvNV) (const GLhalfNV *fog); + void (APIENTRY *SecondaryColor3hNV) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); + void (APIENTRY *SecondaryColor3hvNV) (const GLhalfNV *v); + void (APIENTRY *VertexWeighthNV) (GLhalfNV weight); + void (APIENTRY *VertexWeighthvNV) (const GLhalfNV *weight); + void (APIENTRY *VertexAttrib1hNV) (GLuint index, GLhalfNV x); + void (APIENTRY *VertexAttrib1hvNV) (GLuint index, const GLhalfNV *v); + void (APIENTRY *VertexAttrib2hNV) (GLuint index, GLhalfNV x, GLhalfNV y); + void (APIENTRY *VertexAttrib2hvNV) (GLuint index, const GLhalfNV *v); + void (APIENTRY *VertexAttrib3hNV) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); + void (APIENTRY *VertexAttrib3hvNV) (GLuint index, const GLhalfNV *v); + void (APIENTRY *VertexAttrib4hNV) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); + void (APIENTRY *VertexAttrib4hvNV) (GLuint index, const GLhalfNV *v); + void (APIENTRY *VertexAttribs1hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); + void (APIENTRY *VertexAttribs2hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); + void (APIENTRY *VertexAttribs3hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); + void (APIENTRY *VertexAttribs4hvNV) (GLuint index, GLsizei n, const GLhalfNV *v); + void (APIENTRY *PixelDataRangeNV) (GLenum target, GLsizei length, GLvoid *pointer); + void (APIENTRY *FlushPixelDataRangeNV) (GLenum target); + void (APIENTRY *PrimitiveRestartNV) (void); + void (APIENTRY *PrimitiveRestartIndexNV) (GLuint index); + GLvoid* (APIENTRY *MapObjectBufferATI) (GLuint buffer); + void (APIENTRY *UnmapObjectBufferATI) (GLuint buffer); + void (APIENTRY *StencilOpSeparateATI) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + void (APIENTRY *StencilFuncSeparateATI) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); + void (APIENTRY *VertexAttribArrayObjectATI) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); + void (APIENTRY *GetVertexAttribArrayObjectfvATI) (GLuint index, GLenum pname, GLfloat *params); + void (APIENTRY *GetVertexAttribArrayObjectivATI) (GLuint index, GLenum pname, GLint *params); + void (APIENTRY *DepthBoundsEXT) (GLclampd zmin, GLclampd zmax); + void (APIENTRY *BlendEquationSeparateEXT) (GLenum modeRGB, GLenum modeAlpha); + void (APIENTRY *AddSwapHintRectWIN) (GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef _WIN32 + HANDLE (WINAPI *CreateBufferRegionARB) (HDC hDC, int iLayerPlane, UINT uType); + VOID (WINAPI *DeleteBufferRegionARB) (HANDLE hRegion); + BOOL (WINAPI *SaveBufferRegionARB) (HANDLE hRegion, int x, int y, int width, int height); + BOOL (WINAPI *RestoreBufferRegionARB) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); + const int (WINAPI *GetExtensionsStringARB) (HDC hdc); + BOOL (WINAPI *GetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); + BOOL (WINAPI *GetPixelFormatAttribfvARB) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); + BOOL (WINAPI *ChoosePixelFormatARB) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); + BOOL (WINAPI *MakeContextCurrentARB) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); + HDC (WINAPI *GetCurrentReadDCARB) (void); + HPBUFFERARB (WINAPI *CreatePbufferARB) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); + HDC (WINAPI *GetPbufferDCARB) (HPBUFFERARB hPbuffer); + int (WINAPI *ReleasePbufferDCARB) (HPBUFFERARB hPbuffer, HDC hDC); + BOOL (WINAPI *DestroyPbufferARB) (HPBUFFERARB hPbuffer); + BOOL (WINAPI *QueryPbufferARB) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); + BOOL (WINAPI *BindTexImageARB) (HPBUFFERARB hPbuffer, int iBuffer); + BOOL (WINAPI *ReleaseTexImageARB) (HPBUFFERARB hPbuffer, int iBuffer); + BOOL (WINAPI *SetPbufferAttribARB) (HPBUFFERARB hPbuffer, const int *piAttribList); + GLboolean (WINAPI *CreateDisplayColorTableEXT) (GLushort id); + GLboolean (WINAPI *LoadDisplayColorTableEXT) (const GLushort *table, GLuint length); + GLboolean (WINAPI *BindDisplayColorTableEXT) (GLushort id); + VOID (WINAPI *DestroyDisplayColorTableEXT) (GLushort id); + const int (WINAPI *GetExtensionsStringEXT) (void); + BOOL (WINAPI *MakeContextCurrentEXT) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); + HDC (WINAPI *GetCurrentReadDCEXT) (void); + HPBUFFEREXT (WINAPI *CreatePbufferEXT) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); + HDC (WINAPI *GetPbufferDCEXT) (HPBUFFEREXT hPbuffer); + int (WINAPI *ReleasePbufferDCEXT) (HPBUFFEREXT hPbuffer, HDC hDC); + BOOL (WINAPI *DestroyPbufferEXT) (HPBUFFEREXT hPbuffer); + BOOL (WINAPI *QueryPbufferEXT) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); + BOOL (WINAPI *GetPixelFormatAttribivEXT) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); + BOOL (WINAPI *GetPixelFormatAttribfvEXT) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); + BOOL (WINAPI *ChoosePixelFormatEXT) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); + BOOL (WINAPI *SwapIntervalEXT) (int interval); + int (WINAPI *GetSwapIntervalEXT) (void); + void* (WINAPI *AllocateMemoryNV) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); + void (WINAPI *FreeMemoryNV) (void); + BOOL (WINAPI *GetSyncValuesOML) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); + BOOL (WINAPI *GetMscRateOML) (HDC hdc, INT32 *numerator, INT32 *denominator); + INT64 (WINAPI *SwapBuffersMscOML) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); + INT64 (WINAPI *SwapLayerBuffersMscOML) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); + BOOL (WINAPI *WaitForMscOML) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); + BOOL (WINAPI *WaitForSbcOML) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); + BOOL (WINAPI *GetDigitalVideoParametersI3D) (HDC hDC, int iAttribute, int *piValue); + BOOL (WINAPI *SetDigitalVideoParametersI3D) (HDC hDC, int iAttribute, const int *piValue); + BOOL (WINAPI *GetGammaTableParametersI3D) (HDC hDC, int iAttribute, int *piValue); + BOOL (WINAPI *SetGammaTableParametersI3D) (HDC hDC, int iAttribute, const int *piValue); + BOOL (WINAPI *GetGammaTableI3D) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); + BOOL (WINAPI *SetGammaTableI3D) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); + BOOL (WINAPI *EnableGenlockI3D) (HDC hDC); + BOOL (WINAPI *DisableGenlockI3D) (HDC hDC); + BOOL (WINAPI *IsEnabledGenlockI3D) (HDC hDC, BOOL *pFlag); + BOOL (WINAPI *GenlockSourceI3D) (HDC hDC, UINT uSource); + BOOL (WINAPI *GetGenlockSourceI3D) (HDC hDC, UINT *uSource); + BOOL (WINAPI *GenlockSourceEdgeI3D) (HDC hDC, UINT uEdge); + BOOL (WINAPI *GetGenlockSourceEdgeI3D) (HDC hDC, UINT *uEdge); + BOOL (WINAPI *GenlockSampleRateI3D) (HDC hDC, UINT uRate); + BOOL (WINAPI *GetGenlockSampleRateI3D) (HDC hDC, UINT *uRate); + BOOL (WINAPI *GenlockSourceDelayI3D) (HDC hDC, UINT uDelay); + BOOL (WINAPI *GetGenlockSourceDelayI3D) (HDC hDC, UINT *uDelay); + BOOL (WINAPI *QueryGenlockMaxSourceDelayI3D) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); + LPVOID (WINAPI *CreateImageBufferI3D) (HDC hDC, DWORD dwSize, UINT uFlags); + BOOL (WINAPI *DestroyImageBufferI3D) (HDC hDC, LPVOID pAddress); + BOOL (WINAPI *AssociateImageBufferEventsI3D) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); + BOOL (WINAPI *ReleaseImageBufferEventsI3D) (HDC hDC, const LPVOID *pAddress, UINT count); + BOOL (WINAPI *EnableFrameLockI3D) (void); + BOOL (WINAPI *DisableFrameLockI3D) (void); + BOOL (WINAPI *IsEnabledFrameLockI3D) (BOOL *pFlag); + BOOL (WINAPI *QueryFrameLockMasterI3D) (BOOL *pFlag); + BOOL (WINAPI *GetFrameUsageI3D) (float *pUsage); + BOOL (WINAPI *BeginFrameTrackingI3D) (void); + BOOL (WINAPI *EndFrameTrackingI3D) (void); + BOOL (WINAPI *QueryFrameTrackingI3D) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif /* _WIN32 */ +} _GLextensionProcs; + +#define glBlendColor (_GET_TLS_PROCTABLE()->BlendColor) +#define glBlendEquation (_GET_TLS_PROCTABLE()->BlendEquation) +#define glDrawRangeElements (_GET_TLS_PROCTABLE()->DrawRangeElements) +#define glColorTable (_GET_TLS_PROCTABLE()->ColorTable) +#define glColorTableParameterfv (_GET_TLS_PROCTABLE()->ColorTableParameterfv) +#define glColorTableParameteriv (_GET_TLS_PROCTABLE()->ColorTableParameteriv) +#define glCopyColorTable (_GET_TLS_PROCTABLE()->CopyColorTable) +#define glGetColorTable (_GET_TLS_PROCTABLE()->GetColorTable) +#define glGetColorTableParameterfv (_GET_TLS_PROCTABLE()->GetColorTableParameterfv) +#define glGetColorTableParameteriv (_GET_TLS_PROCTABLE()->GetColorTableParameteriv) +#define glColorSubTable (_GET_TLS_PROCTABLE()->ColorSubTable) +#define glCopyColorSubTable (_GET_TLS_PROCTABLE()->CopyColorSubTable) +#define glConvolutionFilter1D (_GET_TLS_PROCTABLE()->ConvolutionFilter1D) +#define glConvolutionFilter2D (_GET_TLS_PROCTABLE()->ConvolutionFilter2D) +#define glConvolutionParameterf (_GET_TLS_PROCTABLE()->ConvolutionParameterf) +#define glConvolutionParameterfv (_GET_TLS_PROCTABLE()->ConvolutionParameterfv) +#define glConvolutionParameteri (_GET_TLS_PROCTABLE()->ConvolutionParameteri) +#define glConvolutionParameteriv (_GET_TLS_PROCTABLE()->ConvolutionParameteriv) +#define glCopyConvolutionFilter1D (_GET_TLS_PROCTABLE()->CopyConvolutionFilter1D) +#define glCopyConvolutionFilter2D (_GET_TLS_PROCTABLE()->CopyConvolutionFilter2D) +#define glGetConvolutionFilter (_GET_TLS_PROCTABLE()->GetConvolutionFilter) +#define glGetConvolutionParameterfv (_GET_TLS_PROCTABLE()->GetConvolutionParameterfv) +#define glGetConvolutionParameteriv (_GET_TLS_PROCTABLE()->GetConvolutionParameteriv) +#define glGetSeparableFilter (_GET_TLS_PROCTABLE()->GetSeparableFilter) +#define glSeparableFilter2D (_GET_TLS_PROCTABLE()->SeparableFilter2D) +#define glGetHistogram (_GET_TLS_PROCTABLE()->GetHistogram) +#define glGetHistogramParameterfv (_GET_TLS_PROCTABLE()->GetHistogramParameterfv) +#define glGetHistogramParameteriv (_GET_TLS_PROCTABLE()->GetHistogramParameteriv) +#define glGetMinmax (_GET_TLS_PROCTABLE()->GetMinmax) +#define glGetMinmaxParameterfv (_GET_TLS_PROCTABLE()->GetMinmaxParameterfv) +#define glGetMinmaxParameteriv (_GET_TLS_PROCTABLE()->GetMinmaxParameteriv) +#define glHistogram (_GET_TLS_PROCTABLE()->Histogram) +#define glMinmax (_GET_TLS_PROCTABLE()->Minmax) +#define glResetHistogram (_GET_TLS_PROCTABLE()->ResetHistogram) +#define glResetMinmax (_GET_TLS_PROCTABLE()->ResetMinmax) +#define glTexImage3D (_GET_TLS_PROCTABLE()->TexImage3D) +#define glTexSubImage3D (_GET_TLS_PROCTABLE()->TexSubImage3D) +#define glCopyTexSubImage3D (_GET_TLS_PROCTABLE()->CopyTexSubImage3D) +#define glActiveTexture (_GET_TLS_PROCTABLE()->ActiveTexture) +#define glClientActiveTexture (_GET_TLS_PROCTABLE()->ClientActiveTexture) +#define glMultiTexCoord1d (_GET_TLS_PROCTABLE()->MultiTexCoord1d) +#define glMultiTexCoord1dv (_GET_TLS_PROCTABLE()->MultiTexCoord1dv) +#define glMultiTexCoord1f (_GET_TLS_PROCTABLE()->MultiTexCoord1f) +#define glMultiTexCoord1fv (_GET_TLS_PROCTABLE()->MultiTexCoord1fv) +#define glMultiTexCoord1i (_GET_TLS_PROCTABLE()->MultiTexCoord1i) +#define glMultiTexCoord1iv (_GET_TLS_PROCTABLE()->MultiTexCoord1iv) +#define glMultiTexCoord1s (_GET_TLS_PROCTABLE()->MultiTexCoord1s) +#define glMultiTexCoord1sv (_GET_TLS_PROCTABLE()->MultiTexCoord1sv) +#define glMultiTexCoord2d (_GET_TLS_PROCTABLE()->MultiTexCoord2d) +#define glMultiTexCoord2dv (_GET_TLS_PROCTABLE()->MultiTexCoord2dv) +#define glMultiTexCoord2f (_GET_TLS_PROCTABLE()->MultiTexCoord2f) +#define glMultiTexCoord2fv (_GET_TLS_PROCTABLE()->MultiTexCoord2fv) +#define glMultiTexCoord2i (_GET_TLS_PROCTABLE()->MultiTexCoord2i) +#define glMultiTexCoord2iv (_GET_TLS_PROCTABLE()->MultiTexCoord2iv) +#define glMultiTexCoord2s (_GET_TLS_PROCTABLE()->MultiTexCoord2s) +#define glMultiTexCoord2sv (_GET_TLS_PROCTABLE()->MultiTexCoord2sv) +#define glMultiTexCoord3d (_GET_TLS_PROCTABLE()->MultiTexCoord3d) +#define glMultiTexCoord3dv (_GET_TLS_PROCTABLE()->MultiTexCoord3dv) +#define glMultiTexCoord3f (_GET_TLS_PROCTABLE()->MultiTexCoord3f) +#define glMultiTexCoord3fv (_GET_TLS_PROCTABLE()->MultiTexCoord3fv) +#define glMultiTexCoord3i (_GET_TLS_PROCTABLE()->MultiTexCoord3i) +#define glMultiTexCoord3iv (_GET_TLS_PROCTABLE()->MultiTexCoord3iv) +#define glMultiTexCoord3s (_GET_TLS_PROCTABLE()->MultiTexCoord3s) +#define glMultiTexCoord3sv (_GET_TLS_PROCTABLE()->MultiTexCoord3sv) +#define glMultiTexCoord4d (_GET_TLS_PROCTABLE()->MultiTexCoord4d) +#define glMultiTexCoord4dv (_GET_TLS_PROCTABLE()->MultiTexCoord4dv) +#define glMultiTexCoord4f (_GET_TLS_PROCTABLE()->MultiTexCoord4f) +#define glMultiTexCoord4fv (_GET_TLS_PROCTABLE()->MultiTexCoord4fv) +#define glMultiTexCoord4i (_GET_TLS_PROCTABLE()->MultiTexCoord4i) +#define glMultiTexCoord4iv (_GET_TLS_PROCTABLE()->MultiTexCoord4iv) +#define glMultiTexCoord4s (_GET_TLS_PROCTABLE()->MultiTexCoord4s) +#define glMultiTexCoord4sv (_GET_TLS_PROCTABLE()->MultiTexCoord4sv) +#define glLoadTransposeMatrixf (_GET_TLS_PROCTABLE()->LoadTransposeMatrixf) +#define glLoadTransposeMatrixd (_GET_TLS_PROCTABLE()->LoadTransposeMatrixd) +#define glMultTransposeMatrixf (_GET_TLS_PROCTABLE()->MultTransposeMatrixf) +#define glMultTransposeMatrixd (_GET_TLS_PROCTABLE()->MultTransposeMatrixd) +#define glSampleCoverage (_GET_TLS_PROCTABLE()->SampleCoverage) +#define glCompressedTexImage3D (_GET_TLS_PROCTABLE()->CompressedTexImage3D) +#define glCompressedTexImage2D (_GET_TLS_PROCTABLE()->CompressedTexImage2D) +#define glCompressedTexImage1D (_GET_TLS_PROCTABLE()->CompressedTexImage1D) +#define glCompressedTexSubImage3D (_GET_TLS_PROCTABLE()->CompressedTexSubImage3D) +#define glCompressedTexSubImage2D (_GET_TLS_PROCTABLE()->CompressedTexSubImage2D) +#define glCompressedTexSubImage1D (_GET_TLS_PROCTABLE()->CompressedTexSubImage1D) +#define glGetCompressedTexImage (_GET_TLS_PROCTABLE()->GetCompressedTexImage) +#define glBlendFuncSeparate (_GET_TLS_PROCTABLE()->BlendFuncSeparate) +#define glFogCoordf (_GET_TLS_PROCTABLE()->FogCoordf) +#define glFogCoordfv (_GET_TLS_PROCTABLE()->FogCoordfv) +#define glFogCoordd (_GET_TLS_PROCTABLE()->FogCoordd) +#define glFogCoorddv (_GET_TLS_PROCTABLE()->FogCoorddv) +#define glFogCoordPointer (_GET_TLS_PROCTABLE()->FogCoordPointer) +#define glMultiDrawArrays (_GET_TLS_PROCTABLE()->MultiDrawArrays) +#define glMultiDrawElements (_GET_TLS_PROCTABLE()->MultiDrawElements) +#define glPointParameterf (_GET_TLS_PROCTABLE()->PointParameterf) +#define glPointParameterfv (_GET_TLS_PROCTABLE()->PointParameterfv) +#define glPointParameteri (_GET_TLS_PROCTABLE()->PointParameteri) +#define glPointParameteriv (_GET_TLS_PROCTABLE()->PointParameteriv) +#define glSecondaryColor3b (_GET_TLS_PROCTABLE()->SecondaryColor3b) +#define glSecondaryColor3bv (_GET_TLS_PROCTABLE()->SecondaryColor3bv) +#define glSecondaryColor3d (_GET_TLS_PROCTABLE()->SecondaryColor3d) +#define glSecondaryColor3dv (_GET_TLS_PROCTABLE()->SecondaryColor3dv) +#define glSecondaryColor3f (_GET_TLS_PROCTABLE()->SecondaryColor3f) +#define glSecondaryColor3fv (_GET_TLS_PROCTABLE()->SecondaryColor3fv) +#define glSecondaryColor3i (_GET_TLS_PROCTABLE()->SecondaryColor3i) +#define glSecondaryColor3iv (_GET_TLS_PROCTABLE()->SecondaryColor3iv) +#define glSecondaryColor3s (_GET_TLS_PROCTABLE()->SecondaryColor3s) +#define glSecondaryColor3sv (_GET_TLS_PROCTABLE()->SecondaryColor3sv) +#define glSecondaryColor3ub (_GET_TLS_PROCTABLE()->SecondaryColor3ub) +#define glSecondaryColor3ubv (_GET_TLS_PROCTABLE()->SecondaryColor3ubv) +#define glSecondaryColor3ui (_GET_TLS_PROCTABLE()->SecondaryColor3ui) +#define glSecondaryColor3uiv (_GET_TLS_PROCTABLE()->SecondaryColor3uiv) +#define glSecondaryColor3us (_GET_TLS_PROCTABLE()->SecondaryColor3us) +#define glSecondaryColor3usv (_GET_TLS_PROCTABLE()->SecondaryColor3usv) +#define glSecondaryColorPointer (_GET_TLS_PROCTABLE()->SecondaryColorPointer) +#define glWindowPos2d (_GET_TLS_PROCTABLE()->WindowPos2d) +#define glWindowPos2dv (_GET_TLS_PROCTABLE()->WindowPos2dv) +#define glWindowPos2f (_GET_TLS_PROCTABLE()->WindowPos2f) +#define glWindowPos2fv (_GET_TLS_PROCTABLE()->WindowPos2fv) +#define glWindowPos2i (_GET_TLS_PROCTABLE()->WindowPos2i) +#define glWindowPos2iv (_GET_TLS_PROCTABLE()->WindowPos2iv) +#define glWindowPos2s (_GET_TLS_PROCTABLE()->WindowPos2s) +#define glWindowPos2sv (_GET_TLS_PROCTABLE()->WindowPos2sv) +#define glWindowPos3d (_GET_TLS_PROCTABLE()->WindowPos3d) +#define glWindowPos3dv (_GET_TLS_PROCTABLE()->WindowPos3dv) +#define glWindowPos3f (_GET_TLS_PROCTABLE()->WindowPos3f) +#define glWindowPos3fv (_GET_TLS_PROCTABLE()->WindowPos3fv) +#define glWindowPos3i (_GET_TLS_PROCTABLE()->WindowPos3i) +#define glWindowPos3iv (_GET_TLS_PROCTABLE()->WindowPos3iv) +#define glWindowPos3s (_GET_TLS_PROCTABLE()->WindowPos3s) +#define glWindowPos3sv (_GET_TLS_PROCTABLE()->WindowPos3sv) +#define glGenQueries (_GET_TLS_PROCTABLE()->GenQueries) +#define glDeleteQueries (_GET_TLS_PROCTABLE()->DeleteQueries) +#define glIsQuery (_GET_TLS_PROCTABLE()->IsQuery) +#define glBeginQuery (_GET_TLS_PROCTABLE()->BeginQuery) +#define glEndQuery (_GET_TLS_PROCTABLE()->EndQuery) +#define glGetQueryiv (_GET_TLS_PROCTABLE()->GetQueryiv) +#define glGetQueryObjectiv (_GET_TLS_PROCTABLE()->GetQueryObjectiv) +#define glGetQueryObjectuiv (_GET_TLS_PROCTABLE()->GetQueryObjectuiv) +#define glBindBuffer (_GET_TLS_PROCTABLE()->BindBuffer) +#define glDeleteBuffers (_GET_TLS_PROCTABLE()->DeleteBuffers) +#define glGenBuffers (_GET_TLS_PROCTABLE()->GenBuffers) +#define glIsBuffer (_GET_TLS_PROCTABLE()->IsBuffer) +#define glBufferData (_GET_TLS_PROCTABLE()->BufferData) +#define glBufferSubData (_GET_TLS_PROCTABLE()->BufferSubData) +#define glGetBufferSubData (_GET_TLS_PROCTABLE()->GetBufferSubData) +#define glMapBuffer (_GET_TLS_PROCTABLE()->MapBuffer) +#define glUnmapBuffer (_GET_TLS_PROCTABLE()->UnmapBuffer) +#define glGetBufferParameteriv (_GET_TLS_PROCTABLE()->GetBufferParameteriv) +#define glGetBufferPointerv (_GET_TLS_PROCTABLE()->GetBufferPointerv) +#define glActiveTextureARB (_GET_TLS_PROCTABLE()->ActiveTextureARB) +#define glClientActiveTextureARB (_GET_TLS_PROCTABLE()->ClientActiveTextureARB) +#define glMultiTexCoord1dARB (_GET_TLS_PROCTABLE()->MultiTexCoord1dARB) +#define glMultiTexCoord1dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord1dvARB) +#define glMultiTexCoord1fARB (_GET_TLS_PROCTABLE()->MultiTexCoord1fARB) +#define glMultiTexCoord1fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord1fvARB) +#define glMultiTexCoord1iARB (_GET_TLS_PROCTABLE()->MultiTexCoord1iARB) +#define glMultiTexCoord1ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord1ivARB) +#define glMultiTexCoord1sARB (_GET_TLS_PROCTABLE()->MultiTexCoord1sARB) +#define glMultiTexCoord1svARB (_GET_TLS_PROCTABLE()->MultiTexCoord1svARB) +#define glMultiTexCoord2dARB (_GET_TLS_PROCTABLE()->MultiTexCoord2dARB) +#define glMultiTexCoord2dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord2dvARB) +#define glMultiTexCoord2fARB (_GET_TLS_PROCTABLE()->MultiTexCoord2fARB) +#define glMultiTexCoord2fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord2fvARB) +#define glMultiTexCoord2iARB (_GET_TLS_PROCTABLE()->MultiTexCoord2iARB) +#define glMultiTexCoord2ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord2ivARB) +#define glMultiTexCoord2sARB (_GET_TLS_PROCTABLE()->MultiTexCoord2sARB) +#define glMultiTexCoord2svARB (_GET_TLS_PROCTABLE()->MultiTexCoord2svARB) +#define glMultiTexCoord3dARB (_GET_TLS_PROCTABLE()->MultiTexCoord3dARB) +#define glMultiTexCoord3dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord3dvARB) +#define glMultiTexCoord3fARB (_GET_TLS_PROCTABLE()->MultiTexCoord3fARB) +#define glMultiTexCoord3fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord3fvARB) +#define glMultiTexCoord3iARB (_GET_TLS_PROCTABLE()->MultiTexCoord3iARB) +#define glMultiTexCoord3ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord3ivARB) +#define glMultiTexCoord3sARB (_GET_TLS_PROCTABLE()->MultiTexCoord3sARB) +#define glMultiTexCoord3svARB (_GET_TLS_PROCTABLE()->MultiTexCoord3svARB) +#define glMultiTexCoord4dARB (_GET_TLS_PROCTABLE()->MultiTexCoord4dARB) +#define glMultiTexCoord4dvARB (_GET_TLS_PROCTABLE()->MultiTexCoord4dvARB) +#define glMultiTexCoord4fARB (_GET_TLS_PROCTABLE()->MultiTexCoord4fARB) +#define glMultiTexCoord4fvARB (_GET_TLS_PROCTABLE()->MultiTexCoord4fvARB) +#define glMultiTexCoord4iARB (_GET_TLS_PROCTABLE()->MultiTexCoord4iARB) +#define glMultiTexCoord4ivARB (_GET_TLS_PROCTABLE()->MultiTexCoord4ivARB) +#define glMultiTexCoord4sARB (_GET_TLS_PROCTABLE()->MultiTexCoord4sARB) +#define glMultiTexCoord4svARB (_GET_TLS_PROCTABLE()->MultiTexCoord4svARB) +#define glLoadTransposeMatrixfARB (_GET_TLS_PROCTABLE()->LoadTransposeMatrixfARB) +#define glLoadTransposeMatrixdARB (_GET_TLS_PROCTABLE()->LoadTransposeMatrixdARB) +#define glMultTransposeMatrixfARB (_GET_TLS_PROCTABLE()->MultTransposeMatrixfARB) +#define glMultTransposeMatrixdARB (_GET_TLS_PROCTABLE()->MultTransposeMatrixdARB) +#define glSampleCoverageARB (_GET_TLS_PROCTABLE()->SampleCoverageARB) +#define glCompressedTexImage3DARB (_GET_TLS_PROCTABLE()->CompressedTexImage3DARB) +#define glCompressedTexImage2DARB (_GET_TLS_PROCTABLE()->CompressedTexImage2DARB) +#define glCompressedTexImage1DARB (_GET_TLS_PROCTABLE()->CompressedTexImage1DARB) +#define glCompressedTexSubImage3DARB (_GET_TLS_PROCTABLE()->CompressedTexSubImage3DARB) +#define glCompressedTexSubImage2DARB (_GET_TLS_PROCTABLE()->CompressedTexSubImage2DARB) +#define glCompressedTexSubImage1DARB (_GET_TLS_PROCTABLE()->CompressedTexSubImage1DARB) +#define glGetCompressedTexImageARB (_GET_TLS_PROCTABLE()->GetCompressedTexImageARB) +#define glPointParameterfARB (_GET_TLS_PROCTABLE()->PointParameterfARB) +#define glPointParameterfvARB (_GET_TLS_PROCTABLE()->PointParameterfvARB) +#define glWeightbvARB (_GET_TLS_PROCTABLE()->WeightbvARB) +#define glWeightsvARB (_GET_TLS_PROCTABLE()->WeightsvARB) +#define glWeightivARB (_GET_TLS_PROCTABLE()->WeightivARB) +#define glWeightfvARB (_GET_TLS_PROCTABLE()->WeightfvARB) +#define glWeightdvARB (_GET_TLS_PROCTABLE()->WeightdvARB) +#define glWeightubvARB (_GET_TLS_PROCTABLE()->WeightubvARB) +#define glWeightusvARB (_GET_TLS_PROCTABLE()->WeightusvARB) +#define glWeightuivARB (_GET_TLS_PROCTABLE()->WeightuivARB) +#define glWeightPointerARB (_GET_TLS_PROCTABLE()->WeightPointerARB) +#define glVertexBlendARB (_GET_TLS_PROCTABLE()->VertexBlendARB) +#define glCurrentPaletteMatrixARB (_GET_TLS_PROCTABLE()->CurrentPaletteMatrixARB) +#define glMatrixIndexubvARB (_GET_TLS_PROCTABLE()->MatrixIndexubvARB) +#define glMatrixIndexusvARB (_GET_TLS_PROCTABLE()->MatrixIndexusvARB) +#define glMatrixIndexuivARB (_GET_TLS_PROCTABLE()->MatrixIndexuivARB) +#define glMatrixIndexPointerARB (_GET_TLS_PROCTABLE()->MatrixIndexPointerARB) +#define glWindowPos2dARB (_GET_TLS_PROCTABLE()->WindowPos2dARB) +#define glWindowPos2dvARB (_GET_TLS_PROCTABLE()->WindowPos2dvARB) +#define glWindowPos2fARB (_GET_TLS_PROCTABLE()->WindowPos2fARB) +#define glWindowPos2fvARB (_GET_TLS_PROCTABLE()->WindowPos2fvARB) +#define glWindowPos2iARB (_GET_TLS_PROCTABLE()->WindowPos2iARB) +#define glWindowPos2ivARB (_GET_TLS_PROCTABLE()->WindowPos2ivARB) +#define glWindowPos2sARB (_GET_TLS_PROCTABLE()->WindowPos2sARB) +#define glWindowPos2svARB (_GET_TLS_PROCTABLE()->WindowPos2svARB) +#define glWindowPos3dARB (_GET_TLS_PROCTABLE()->WindowPos3dARB) +#define glWindowPos3dvARB (_GET_TLS_PROCTABLE()->WindowPos3dvARB) +#define glWindowPos3fARB (_GET_TLS_PROCTABLE()->WindowPos3fARB) +#define glWindowPos3fvARB (_GET_TLS_PROCTABLE()->WindowPos3fvARB) +#define glWindowPos3iARB (_GET_TLS_PROCTABLE()->WindowPos3iARB) +#define glWindowPos3ivARB (_GET_TLS_PROCTABLE()->WindowPos3ivARB) +#define glWindowPos3sARB (_GET_TLS_PROCTABLE()->WindowPos3sARB) +#define glWindowPos3svARB (_GET_TLS_PROCTABLE()->WindowPos3svARB) +#define glVertexAttrib1dARB (_GET_TLS_PROCTABLE()->VertexAttrib1dARB) +#define glVertexAttrib1dvARB (_GET_TLS_PROCTABLE()->VertexAttrib1dvARB) +#define glVertexAttrib1fARB (_GET_TLS_PROCTABLE()->VertexAttrib1fARB) +#define glVertexAttrib1fvARB (_GET_TLS_PROCTABLE()->VertexAttrib1fvARB) +#define glVertexAttrib1sARB (_GET_TLS_PROCTABLE()->VertexAttrib1sARB) +#define glVertexAttrib1svARB (_GET_TLS_PROCTABLE()->VertexAttrib1svARB) +#define glVertexAttrib2dARB (_GET_TLS_PROCTABLE()->VertexAttrib2dARB) +#define glVertexAttrib2dvARB (_GET_TLS_PROCTABLE()->VertexAttrib2dvARB) +#define glVertexAttrib2fARB (_GET_TLS_PROCTABLE()->VertexAttrib2fARB) +#define glVertexAttrib2fvARB (_GET_TLS_PROCTABLE()->VertexAttrib2fvARB) +#define glVertexAttrib2sARB (_GET_TLS_PROCTABLE()->VertexAttrib2sARB) +#define glVertexAttrib2svARB (_GET_TLS_PROCTABLE()->VertexAttrib2svARB) +#define glVertexAttrib3dARB (_GET_TLS_PROCTABLE()->VertexAttrib3dARB) +#define glVertexAttrib3dvARB (_GET_TLS_PROCTABLE()->VertexAttrib3dvARB) +#define glVertexAttrib3fARB (_GET_TLS_PROCTABLE()->VertexAttrib3fARB) +#define glVertexAttrib3fvARB (_GET_TLS_PROCTABLE()->VertexAttrib3fvARB) +#define glVertexAttrib3sARB (_GET_TLS_PROCTABLE()->VertexAttrib3sARB) +#define glVertexAttrib3svARB (_GET_TLS_PROCTABLE()->VertexAttrib3svARB) +#define glVertexAttrib4NbvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NbvARB) +#define glVertexAttrib4NivARB (_GET_TLS_PROCTABLE()->VertexAttrib4NivARB) +#define glVertexAttrib4NsvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NsvARB) +#define glVertexAttrib4NubARB (_GET_TLS_PROCTABLE()->VertexAttrib4NubARB) +#define glVertexAttrib4NubvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NubvARB) +#define glVertexAttrib4NuivARB (_GET_TLS_PROCTABLE()->VertexAttrib4NuivARB) +#define glVertexAttrib4NusvARB (_GET_TLS_PROCTABLE()->VertexAttrib4NusvARB) +#define glVertexAttrib4bvARB (_GET_TLS_PROCTABLE()->VertexAttrib4bvARB) +#define glVertexAttrib4dARB (_GET_TLS_PROCTABLE()->VertexAttrib4dARB) +#define glVertexAttrib4dvARB (_GET_TLS_PROCTABLE()->VertexAttrib4dvARB) +#define glVertexAttrib4fARB (_GET_TLS_PROCTABLE()->VertexAttrib4fARB) +#define glVertexAttrib4fvARB (_GET_TLS_PROCTABLE()->VertexAttrib4fvARB) +#define glVertexAttrib4ivARB (_GET_TLS_PROCTABLE()->VertexAttrib4ivARB) +#define glVertexAttrib4sARB (_GET_TLS_PROCTABLE()->VertexAttrib4sARB) +#define glVertexAttrib4svARB (_GET_TLS_PROCTABLE()->VertexAttrib4svARB) +#define glVertexAttrib4ubvARB (_GET_TLS_PROCTABLE()->VertexAttrib4ubvARB) +#define glVertexAttrib4uivARB (_GET_TLS_PROCTABLE()->VertexAttrib4uivARB) +#define glVertexAttrib4usvARB (_GET_TLS_PROCTABLE()->VertexAttrib4usvARB) +#define glVertexAttribPointerARB (_GET_TLS_PROCTABLE()->VertexAttribPointerARB) +#define glEnableVertexAttribArrayARB (_GET_TLS_PROCTABLE()->EnableVertexAttribArrayARB) +#define glDisableVertexAttribArrayARB (_GET_TLS_PROCTABLE()->DisableVertexAttribArrayARB) +#define glProgramStringARB (_GET_TLS_PROCTABLE()->ProgramStringARB) +#define glBindProgramARB (_GET_TLS_PROCTABLE()->BindProgramARB) +#define glDeleteProgramsARB (_GET_TLS_PROCTABLE()->DeleteProgramsARB) +#define glGenProgramsARB (_GET_TLS_PROCTABLE()->GenProgramsARB) +#define glProgramEnvParameter4dARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4dARB) +#define glProgramEnvParameter4dvARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4dvARB) +#define glProgramEnvParameter4fARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4fARB) +#define glProgramEnvParameter4fvARB (_GET_TLS_PROCTABLE()->ProgramEnvParameter4fvARB) +#define glProgramLocalParameter4dARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4dARB) +#define glProgramLocalParameter4dvARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4dvARB) +#define glProgramLocalParameter4fARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4fARB) +#define glProgramLocalParameter4fvARB (_GET_TLS_PROCTABLE()->ProgramLocalParameter4fvARB) +#define glGetProgramEnvParameterdvARB (_GET_TLS_PROCTABLE()->GetProgramEnvParameterdvARB) +#define glGetProgramEnvParameterfvARB (_GET_TLS_PROCTABLE()->GetProgramEnvParameterfvARB) +#define glGetProgramLocalParameterdvARB (_GET_TLS_PROCTABLE()->GetProgramLocalParameterdvARB) +#define glGetProgramLocalParameterfvARB (_GET_TLS_PROCTABLE()->GetProgramLocalParameterfvARB) +#define glGetProgramivARB (_GET_TLS_PROCTABLE()->GetProgramivARB) +#define glGetProgramStringARB (_GET_TLS_PROCTABLE()->GetProgramStringARB) +#define glGetVertexAttribdvARB (_GET_TLS_PROCTABLE()->GetVertexAttribdvARB) +#define glGetVertexAttribfvARB (_GET_TLS_PROCTABLE()->GetVertexAttribfvARB) +#define glGetVertexAttribivARB (_GET_TLS_PROCTABLE()->GetVertexAttribivARB) +#define glGetVertexAttribPointervARB (_GET_TLS_PROCTABLE()->GetVertexAttribPointervARB) +#define glIsProgramARB (_GET_TLS_PROCTABLE()->IsProgramARB) +#define glBindBufferARB (_GET_TLS_PROCTABLE()->BindBufferARB) +#define glDeleteBuffersARB (_GET_TLS_PROCTABLE()->DeleteBuffersARB) +#define glGenBuffersARB (_GET_TLS_PROCTABLE()->GenBuffersARB) +#define glIsBufferARB (_GET_TLS_PROCTABLE()->IsBufferARB) +#define glBufferDataARB (_GET_TLS_PROCTABLE()->BufferDataARB) +#define glBufferSubDataARB (_GET_TLS_PROCTABLE()->BufferSubDataARB) +#define glGetBufferSubDataARB (_GET_TLS_PROCTABLE()->GetBufferSubDataARB) +#define glMapBufferARB (_GET_TLS_PROCTABLE()->MapBufferARB) +#define glUnmapBufferARB (_GET_TLS_PROCTABLE()->UnmapBufferARB) +#define glGetBufferParameterivARB (_GET_TLS_PROCTABLE()->GetBufferParameterivARB) +#define glGetBufferPointervARB (_GET_TLS_PROCTABLE()->GetBufferPointervARB) +#define glGenQueriesARB (_GET_TLS_PROCTABLE()->GenQueriesARB) +#define glDeleteQueriesARB (_GET_TLS_PROCTABLE()->DeleteQueriesARB) +#define glIsQueryARB (_GET_TLS_PROCTABLE()->IsQueryARB) +#define glBeginQueryARB (_GET_TLS_PROCTABLE()->BeginQueryARB) +#define glEndQueryARB (_GET_TLS_PROCTABLE()->EndQueryARB) +#define glGetQueryivARB (_GET_TLS_PROCTABLE()->GetQueryivARB) +#define glGetQueryObjectivARB (_GET_TLS_PROCTABLE()->GetQueryObjectivARB) +#define glGetQueryObjectuivARB (_GET_TLS_PROCTABLE()->GetQueryObjectuivARB) +#define glDeleteObjectARB (_GET_TLS_PROCTABLE()->DeleteObjectARB) +#define glGetHandleARB (_GET_TLS_PROCTABLE()->GetHandleARB) +#define glDetachObjectARB (_GET_TLS_PROCTABLE()->DetachObjectARB) +#define glCreateShaderObjectARB (_GET_TLS_PROCTABLE()->CreateShaderObjectARB) +#define glShaderSourceARB (_GET_TLS_PROCTABLE()->ShaderSourceARB) +#define glCompileShaderARB (_GET_TLS_PROCTABLE()->CompileShaderARB) +#define glCreateProgramObjectARB (_GET_TLS_PROCTABLE()->CreateProgramObjectARB) +#define glAttachObjectARB (_GET_TLS_PROCTABLE()->AttachObjectARB) +#define glLinkProgramARB (_GET_TLS_PROCTABLE()->LinkProgramARB) +#define glUseProgramObjectARB (_GET_TLS_PROCTABLE()->UseProgramObjectARB) +#define glValidateProgramARB (_GET_TLS_PROCTABLE()->ValidateProgramARB) +#define glUniform1fARB (_GET_TLS_PROCTABLE()->Uniform1fARB) +#define glUniform2fARB (_GET_TLS_PROCTABLE()->Uniform2fARB) +#define glUniform3fARB (_GET_TLS_PROCTABLE()->Uniform3fARB) +#define glUniform4fARB (_GET_TLS_PROCTABLE()->Uniform4fARB) +#define glUniform1iARB (_GET_TLS_PROCTABLE()->Uniform1iARB) +#define glUniform2iARB (_GET_TLS_PROCTABLE()->Uniform2iARB) +#define glUniform3iARB (_GET_TLS_PROCTABLE()->Uniform3iARB) +#define glUniform4iARB (_GET_TLS_PROCTABLE()->Uniform4iARB) +#define glUniform1fvARB (_GET_TLS_PROCTABLE()->Uniform1fvARB) +#define glUniform2fvARB (_GET_TLS_PROCTABLE()->Uniform2fvARB) +#define glUniform3fvARB (_GET_TLS_PROCTABLE()->Uniform3fvARB) +#define glUniform4fvARB (_GET_TLS_PROCTABLE()->Uniform4fvARB) +#define glUniform1ivARB (_GET_TLS_PROCTABLE()->Uniform1ivARB) +#define glUniform2ivARB (_GET_TLS_PROCTABLE()->Uniform2ivARB) +#define glUniform3ivARB (_GET_TLS_PROCTABLE()->Uniform3ivARB) +#define glUniform4ivARB (_GET_TLS_PROCTABLE()->Uniform4ivARB) +#define glUniformMatrix2fvARB (_GET_TLS_PROCTABLE()->UniformMatrix2fvARB) +#define glUniformMatrix3fvARB (_GET_TLS_PROCTABLE()->UniformMatrix3fvARB) +#define glUniformMatrix4fvARB (_GET_TLS_PROCTABLE()->UniformMatrix4fvARB) +#define glGetObjectParameterfvARB (_GET_TLS_PROCTABLE()->GetObjectParameterfvARB) +#define glGetObjectParameterivARB (_GET_TLS_PROCTABLE()->GetObjectParameterivARB) +#define glGetInfoLogARB (_GET_TLS_PROCTABLE()->GetInfoLogARB) +#define glGetAttachedObjectsARB (_GET_TLS_PROCTABLE()->GetAttachedObjectsARB) +#define glGetUniformLocationARB (_GET_TLS_PROCTABLE()->GetUniformLocationARB) +#define glGetActiveUniformARB (_GET_TLS_PROCTABLE()->GetActiveUniformARB) +#define glGetUniformfvARB (_GET_TLS_PROCTABLE()->GetUniformfvARB) +#define glGetUniformivARB (_GET_TLS_PROCTABLE()->GetUniformivARB) +#define glGetShaderSourceARB (_GET_TLS_PROCTABLE()->GetShaderSourceARB) +#define glBindAttribLocationARB (_GET_TLS_PROCTABLE()->BindAttribLocationARB) +#define glGetActiveAttribARB (_GET_TLS_PROCTABLE()->GetActiveAttribARB) +#define glGetAttribLocationARB (_GET_TLS_PROCTABLE()->GetAttribLocationARB) +#define glBlendColorEXT (_GET_TLS_PROCTABLE()->BlendColorEXT) +#define glPolygonOffsetEXT (_GET_TLS_PROCTABLE()->PolygonOffsetEXT) +#define glTexImage3DEXT (_GET_TLS_PROCTABLE()->TexImage3DEXT) +#define glTexSubImage3DEXT (_GET_TLS_PROCTABLE()->TexSubImage3DEXT) +#define glGetTexFilterFuncSGIS (_GET_TLS_PROCTABLE()->GetTexFilterFuncSGIS) +#define glTexFilterFuncSGIS (_GET_TLS_PROCTABLE()->TexFilterFuncSGIS) +#define glTexSubImage1DEXT (_GET_TLS_PROCTABLE()->TexSubImage1DEXT) +#define glTexSubImage2DEXT (_GET_TLS_PROCTABLE()->TexSubImage2DEXT) +#define glCopyTexImage1DEXT (_GET_TLS_PROCTABLE()->CopyTexImage1DEXT) +#define glCopyTexImage2DEXT (_GET_TLS_PROCTABLE()->CopyTexImage2DEXT) +#define glCopyTexSubImage1DEXT (_GET_TLS_PROCTABLE()->CopyTexSubImage1DEXT) +#define glCopyTexSubImage2DEXT (_GET_TLS_PROCTABLE()->CopyTexSubImage2DEXT) +#define glCopyTexSubImage3DEXT (_GET_TLS_PROCTABLE()->CopyTexSubImage3DEXT) +#define glGetHistogramEXT (_GET_TLS_PROCTABLE()->GetHistogramEXT) +#define glGetHistogramParameterfvEXT (_GET_TLS_PROCTABLE()->GetHistogramParameterfvEXT) +#define glGetHistogramParameterivEXT (_GET_TLS_PROCTABLE()->GetHistogramParameterivEXT) +#define glGetMinmaxEXT (_GET_TLS_PROCTABLE()->GetMinmaxEXT) +#define glGetMinmaxParameterfvEXT (_GET_TLS_PROCTABLE()->GetMinmaxParameterfvEXT) +#define glGetMinmaxParameterivEXT (_GET_TLS_PROCTABLE()->GetMinmaxParameterivEXT) +#define glHistogramEXT (_GET_TLS_PROCTABLE()->HistogramEXT) +#define glMinmaxEXT (_GET_TLS_PROCTABLE()->MinmaxEXT) +#define glResetHistogramEXT (_GET_TLS_PROCTABLE()->ResetHistogramEXT) +#define glResetMinmaxEXT (_GET_TLS_PROCTABLE()->ResetMinmaxEXT) +#define glConvolutionFilter1DEXT (_GET_TLS_PROCTABLE()->ConvolutionFilter1DEXT) +#define glConvolutionFilter2DEXT (_GET_TLS_PROCTABLE()->ConvolutionFilter2DEXT) +#define glConvolutionParameterfEXT (_GET_TLS_PROCTABLE()->ConvolutionParameterfEXT) +#define glConvolutionParameterfvEXT (_GET_TLS_PROCTABLE()->ConvolutionParameterfvEXT) +#define glConvolutionParameteriEXT (_GET_TLS_PROCTABLE()->ConvolutionParameteriEXT) +#define glConvolutionParameterivEXT (_GET_TLS_PROCTABLE()->ConvolutionParameterivEXT) +#define glCopyConvolutionFilter1DEXT (_GET_TLS_PROCTABLE()->CopyConvolutionFilter1DEXT) +#define glCopyConvolutionFilter2DEXT (_GET_TLS_PROCTABLE()->CopyConvolutionFilter2DEXT) +#define glGetConvolutionFilterEXT (_GET_TLS_PROCTABLE()->GetConvolutionFilterEXT) +#define glGetConvolutionParameterfvEXT (_GET_TLS_PROCTABLE()->GetConvolutionParameterfvEXT) +#define glGetConvolutionParameterivEXT (_GET_TLS_PROCTABLE()->GetConvolutionParameterivEXT) +#define glGetSeparableFilterEXT (_GET_TLS_PROCTABLE()->GetSeparableFilterEXT) +#define glSeparableFilter2DEXT (_GET_TLS_PROCTABLE()->SeparableFilter2DEXT) +#define glColorTableSGI (_GET_TLS_PROCTABLE()->ColorTableSGI) +#define glColorTableParameterfvSGI (_GET_TLS_PROCTABLE()->ColorTableParameterfvSGI) +#define glColorTableParameterivSGI (_GET_TLS_PROCTABLE()->ColorTableParameterivSGI) +#define glCopyColorTableSGI (_GET_TLS_PROCTABLE()->CopyColorTableSGI) +#define glGetColorTableSGI (_GET_TLS_PROCTABLE()->GetColorTableSGI) +#define glGetColorTableParameterfvSGI (_GET_TLS_PROCTABLE()->GetColorTableParameterfvSGI) +#define glGetColorTableParameterivSGI (_GET_TLS_PROCTABLE()->GetColorTableParameterivSGI) +#define glPixelTexGenSGIX (_GET_TLS_PROCTABLE()->PixelTexGenSGIX) +#define glPixelTexGenParameteriSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameteriSGIS) +#define glPixelTexGenParameterivSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameterivSGIS) +#define glPixelTexGenParameterfSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameterfSGIS) +#define glPixelTexGenParameterfvSGIS (_GET_TLS_PROCTABLE()->PixelTexGenParameterfvSGIS) +#define glGetPixelTexGenParameterivSGIS (_GET_TLS_PROCTABLE()->GetPixelTexGenParameterivSGIS) +#define glGetPixelTexGenParameterfvSGIS (_GET_TLS_PROCTABLE()->GetPixelTexGenParameterfvSGIS) +#define glTexImage4DSGIS (_GET_TLS_PROCTABLE()->TexImage4DSGIS) +#define glTexSubImage4DSGIS (_GET_TLS_PROCTABLE()->TexSubImage4DSGIS) +#define glAreTexturesResidentEXT (_GET_TLS_PROCTABLE()->AreTexturesResidentEXT) +#define glBindTextureEXT (_GET_TLS_PROCTABLE()->BindTextureEXT) +#define glDeleteTexturesEXT (_GET_TLS_PROCTABLE()->DeleteTexturesEXT) +#define glGenTexturesEXT (_GET_TLS_PROCTABLE()->GenTexturesEXT) +#define glIsTextureEXT (_GET_TLS_PROCTABLE()->IsTextureEXT) +#define glPrioritizeTexturesEXT (_GET_TLS_PROCTABLE()->PrioritizeTexturesEXT) +#define glDetailTexFuncSGIS (_GET_TLS_PROCTABLE()->DetailTexFuncSGIS) +#define glGetDetailTexFuncSGIS (_GET_TLS_PROCTABLE()->GetDetailTexFuncSGIS) +#define glSharpenTexFuncSGIS (_GET_TLS_PROCTABLE()->SharpenTexFuncSGIS) +#define glGetSharpenTexFuncSGIS (_GET_TLS_PROCTABLE()->GetSharpenTexFuncSGIS) +#define glSampleMaskSGIS (_GET_TLS_PROCTABLE()->SampleMaskSGIS) +#define glSamplePatternSGIS (_GET_TLS_PROCTABLE()->SamplePatternSGIS) +#define glArrayElementEXT (_GET_TLS_PROCTABLE()->ArrayElementEXT) +#define glColorPointerEXT (_GET_TLS_PROCTABLE()->ColorPointerEXT) +#define glDrawArraysEXT (_GET_TLS_PROCTABLE()->DrawArraysEXT) +#define glEdgeFlagPointerEXT (_GET_TLS_PROCTABLE()->EdgeFlagPointerEXT) +#define glGetPointervEXT (_GET_TLS_PROCTABLE()->GetPointervEXT) +#define glIndexPointerEXT (_GET_TLS_PROCTABLE()->IndexPointerEXT) +#define glNormalPointerEXT (_GET_TLS_PROCTABLE()->NormalPointerEXT) +#define glTexCoordPointerEXT (_GET_TLS_PROCTABLE()->TexCoordPointerEXT) +#define glVertexPointerEXT (_GET_TLS_PROCTABLE()->VertexPointerEXT) +#define glBlendEquationEXT (_GET_TLS_PROCTABLE()->BlendEquationEXT) +#define glSpriteParameterfSGIX (_GET_TLS_PROCTABLE()->SpriteParameterfSGIX) +#define glSpriteParameterfvSGIX (_GET_TLS_PROCTABLE()->SpriteParameterfvSGIX) +#define glSpriteParameteriSGIX (_GET_TLS_PROCTABLE()->SpriteParameteriSGIX) +#define glSpriteParameterivSGIX (_GET_TLS_PROCTABLE()->SpriteParameterivSGIX) +#define glPointParameterfEXT (_GET_TLS_PROCTABLE()->PointParameterfEXT) +#define glPointParameterfvEXT (_GET_TLS_PROCTABLE()->PointParameterfvEXT) +#define glPointParameterfSGIS (_GET_TLS_PROCTABLE()->PointParameterfSGIS) +#define glPointParameterfvSGIS (_GET_TLS_PROCTABLE()->PointParameterfvSGIS) +#define glGetInstrumentsSGIX (_GET_TLS_PROCTABLE()->GetInstrumentsSGIX) +#define glInstrumentsBufferSGIX (_GET_TLS_PROCTABLE()->InstrumentsBufferSGIX) +#define glPollInstrumentsSGIX (_GET_TLS_PROCTABLE()->PollInstrumentsSGIX) +#define glReadInstrumentsSGIX (_GET_TLS_PROCTABLE()->ReadInstrumentsSGIX) +#define glStartInstrumentsSGIX (_GET_TLS_PROCTABLE()->StartInstrumentsSGIX) +#define glStopInstrumentsSGIX (_GET_TLS_PROCTABLE()->StopInstrumentsSGIX) +#define glFrameZoomSGIX (_GET_TLS_PROCTABLE()->FrameZoomSGIX) +#define glTagSampleBufferSGIX (_GET_TLS_PROCTABLE()->TagSampleBufferSGIX) +#define glDeformationMap3dSGIX (_GET_TLS_PROCTABLE()->DeformationMap3dSGIX) +#define glDeformationMap3fSGIX (_GET_TLS_PROCTABLE()->DeformationMap3fSGIX) +#define glDeformSGIX (_GET_TLS_PROCTABLE()->DeformSGIX) +#define glLoadIdentityDeformationMapSGIX (_GET_TLS_PROCTABLE()->LoadIdentityDeformationMapSGIX) +#define glReferencePlaneSGIX (_GET_TLS_PROCTABLE()->ReferencePlaneSGIX) +#define glFlushRasterSGIX (_GET_TLS_PROCTABLE()->FlushRasterSGIX) +#define glFogFuncSGIS (_GET_TLS_PROCTABLE()->FogFuncSGIS) +#define glGetFogFuncSGIS (_GET_TLS_PROCTABLE()->GetFogFuncSGIS) +#define glImageTransformParameteriHP (_GET_TLS_PROCTABLE()->ImageTransformParameteriHP) +#define glImageTransformParameterfHP (_GET_TLS_PROCTABLE()->ImageTransformParameterfHP) +#define glImageTransformParameterivHP (_GET_TLS_PROCTABLE()->ImageTransformParameterivHP) +#define glImageTransformParameterfvHP (_GET_TLS_PROCTABLE()->ImageTransformParameterfvHP) +#define glGetImageTransformParameterivHP (_GET_TLS_PROCTABLE()->GetImageTransformParameterivHP) +#define glGetImageTransformParameterfvHP (_GET_TLS_PROCTABLE()->GetImageTransformParameterfvHP) +#define glColorSubTableEXT (_GET_TLS_PROCTABLE()->ColorSubTableEXT) +#define glCopyColorSubTableEXT (_GET_TLS_PROCTABLE()->CopyColorSubTableEXT) +#define glHintPGI (_GET_TLS_PROCTABLE()->HintPGI) +#define glColorTableEXT (_GET_TLS_PROCTABLE()->ColorTableEXT) +#define glGetColorTableEXT (_GET_TLS_PROCTABLE()->GetColorTableEXT) +#define glGetColorTableParameterivEXT (_GET_TLS_PROCTABLE()->GetColorTableParameterivEXT) +#define glGetColorTableParameterfvEXT (_GET_TLS_PROCTABLE()->GetColorTableParameterfvEXT) +#define glGetListParameterfvSGIX (_GET_TLS_PROCTABLE()->GetListParameterfvSGIX) +#define glGetListParameterivSGIX (_GET_TLS_PROCTABLE()->GetListParameterivSGIX) +#define glListParameterfSGIX (_GET_TLS_PROCTABLE()->ListParameterfSGIX) +#define glListParameterfvSGIX (_GET_TLS_PROCTABLE()->ListParameterfvSGIX) +#define glListParameteriSGIX (_GET_TLS_PROCTABLE()->ListParameteriSGIX) +#define glListParameterivSGIX (_GET_TLS_PROCTABLE()->ListParameterivSGIX) +#define glIndexMaterialEXT (_GET_TLS_PROCTABLE()->IndexMaterialEXT) +#define glIndexFuncEXT (_GET_TLS_PROCTABLE()->IndexFuncEXT) +#define glLockArraysEXT (_GET_TLS_PROCTABLE()->LockArraysEXT) +#define glUnlockArraysEXT (_GET_TLS_PROCTABLE()->UnlockArraysEXT) +#define glCullParameterdvEXT (_GET_TLS_PROCTABLE()->CullParameterdvEXT) +#define glCullParameterfvEXT (_GET_TLS_PROCTABLE()->CullParameterfvEXT) +#define glFragmentColorMaterialSGIX (_GET_TLS_PROCTABLE()->FragmentColorMaterialSGIX) +#define glFragmentLightfSGIX (_GET_TLS_PROCTABLE()->FragmentLightfSGIX) +#define glFragmentLightfvSGIX (_GET_TLS_PROCTABLE()->FragmentLightfvSGIX) +#define glFragmentLightiSGIX (_GET_TLS_PROCTABLE()->FragmentLightiSGIX) +#define glFragmentLightivSGIX (_GET_TLS_PROCTABLE()->FragmentLightivSGIX) +#define glFragmentLightModelfSGIX (_GET_TLS_PROCTABLE()->FragmentLightModelfSGIX) +#define glFragmentLightModelfvSGIX (_GET_TLS_PROCTABLE()->FragmentLightModelfvSGIX) +#define glFragmentLightModeliSGIX (_GET_TLS_PROCTABLE()->FragmentLightModeliSGIX) +#define glFragmentLightModelivSGIX (_GET_TLS_PROCTABLE()->FragmentLightModelivSGIX) +#define glFragmentMaterialfSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialfSGIX) +#define glFragmentMaterialfvSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialfvSGIX) +#define glFragmentMaterialiSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialiSGIX) +#define glFragmentMaterialivSGIX (_GET_TLS_PROCTABLE()->FragmentMaterialivSGIX) +#define glGetFragmentLightfvSGIX (_GET_TLS_PROCTABLE()->GetFragmentLightfvSGIX) +#define glGetFragmentLightivSGIX (_GET_TLS_PROCTABLE()->GetFragmentLightivSGIX) +#define glGetFragmentMaterialfvSGIX (_GET_TLS_PROCTABLE()->GetFragmentMaterialfvSGIX) +#define glGetFragmentMaterialivSGIX (_GET_TLS_PROCTABLE()->GetFragmentMaterialivSGIX) +#define glLightEnviSGIX (_GET_TLS_PROCTABLE()->LightEnviSGIX) +#define glDrawRangeElementsEXT (_GET_TLS_PROCTABLE()->DrawRangeElementsEXT) +#define glApplyTextureEXT (_GET_TLS_PROCTABLE()->ApplyTextureEXT) +#define glTextureLightEXT (_GET_TLS_PROCTABLE()->TextureLightEXT) +#define glTextureMaterialEXT (_GET_TLS_PROCTABLE()->TextureMaterialEXT) +#define glAsyncMarkerSGIX (_GET_TLS_PROCTABLE()->AsyncMarkerSGIX) +#define glFinishAsyncSGIX (_GET_TLS_PROCTABLE()->FinishAsyncSGIX) +#define glPollAsyncSGIX (_GET_TLS_PROCTABLE()->PollAsyncSGIX) +#define glGenAsyncMarkersSGIX (_GET_TLS_PROCTABLE()->GenAsyncMarkersSGIX) +#define glDeleteAsyncMarkersSGIX (_GET_TLS_PROCTABLE()->DeleteAsyncMarkersSGIX) +#define glIsAsyncMarkerSGIX (_GET_TLS_PROCTABLE()->IsAsyncMarkerSGIX) +#define glVertexPointervINTEL (_GET_TLS_PROCTABLE()->VertexPointervINTEL) +#define glNormalPointervINTEL (_GET_TLS_PROCTABLE()->NormalPointervINTEL) +#define glColorPointervINTEL (_GET_TLS_PROCTABLE()->ColorPointervINTEL) +#define glTexCoordPointervINTEL (_GET_TLS_PROCTABLE()->TexCoordPointervINTEL) +#define glPixelTransformParameteriEXT (_GET_TLS_PROCTABLE()->PixelTransformParameteriEXT) +#define glPixelTransformParameterfEXT (_GET_TLS_PROCTABLE()->PixelTransformParameterfEXT) +#define glPixelTransformParameterivEXT (_GET_TLS_PROCTABLE()->PixelTransformParameterivEXT) +#define glPixelTransformParameterfvEXT (_GET_TLS_PROCTABLE()->PixelTransformParameterfvEXT) +#define glSecondaryColor3bEXT (_GET_TLS_PROCTABLE()->SecondaryColor3bEXT) +#define glSecondaryColor3bvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3bvEXT) +#define glSecondaryColor3dEXT (_GET_TLS_PROCTABLE()->SecondaryColor3dEXT) +#define glSecondaryColor3dvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3dvEXT) +#define glSecondaryColor3fEXT (_GET_TLS_PROCTABLE()->SecondaryColor3fEXT) +#define glSecondaryColor3fvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3fvEXT) +#define glSecondaryColor3iEXT (_GET_TLS_PROCTABLE()->SecondaryColor3iEXT) +#define glSecondaryColor3ivEXT (_GET_TLS_PROCTABLE()->SecondaryColor3ivEXT) +#define glSecondaryColor3sEXT (_GET_TLS_PROCTABLE()->SecondaryColor3sEXT) +#define glSecondaryColor3svEXT (_GET_TLS_PROCTABLE()->SecondaryColor3svEXT) +#define glSecondaryColor3ubEXT (_GET_TLS_PROCTABLE()->SecondaryColor3ubEXT) +#define glSecondaryColor3ubvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3ubvEXT) +#define glSecondaryColor3uiEXT (_GET_TLS_PROCTABLE()->SecondaryColor3uiEXT) +#define glSecondaryColor3uivEXT (_GET_TLS_PROCTABLE()->SecondaryColor3uivEXT) +#define glSecondaryColor3usEXT (_GET_TLS_PROCTABLE()->SecondaryColor3usEXT) +#define glSecondaryColor3usvEXT (_GET_TLS_PROCTABLE()->SecondaryColor3usvEXT) +#define glSecondaryColorPointerEXT (_GET_TLS_PROCTABLE()->SecondaryColorPointerEXT) +#define glTextureNormalEXT (_GET_TLS_PROCTABLE()->TextureNormalEXT) +#define glMultiDrawArraysEXT (_GET_TLS_PROCTABLE()->MultiDrawArraysEXT) +#define glMultiDrawElementsEXT (_GET_TLS_PROCTABLE()->MultiDrawElementsEXT) +#define glFogCoordfEXT (_GET_TLS_PROCTABLE()->FogCoordfEXT) +#define glFogCoordfvEXT (_GET_TLS_PROCTABLE()->FogCoordfvEXT) +#define glFogCoorddEXT (_GET_TLS_PROCTABLE()->FogCoorddEXT) +#define glFogCoorddvEXT (_GET_TLS_PROCTABLE()->FogCoorddvEXT) +#define glFogCoordPointerEXT (_GET_TLS_PROCTABLE()->FogCoordPointerEXT) +#define glTangent3bEXT (_GET_TLS_PROCTABLE()->Tangent3bEXT) +#define glTangent3bvEXT (_GET_TLS_PROCTABLE()->Tangent3bvEXT) +#define glTangent3dEXT (_GET_TLS_PROCTABLE()->Tangent3dEXT) +#define glTangent3dvEXT (_GET_TLS_PROCTABLE()->Tangent3dvEXT) +#define glTangent3fEXT (_GET_TLS_PROCTABLE()->Tangent3fEXT) +#define glTangent3fvEXT (_GET_TLS_PROCTABLE()->Tangent3fvEXT) +#define glTangent3iEXT (_GET_TLS_PROCTABLE()->Tangent3iEXT) +#define glTangent3ivEXT (_GET_TLS_PROCTABLE()->Tangent3ivEXT) +#define glTangent3sEXT (_GET_TLS_PROCTABLE()->Tangent3sEXT) +#define glTangent3svEXT (_GET_TLS_PROCTABLE()->Tangent3svEXT) +#define glBinormal3bEXT (_GET_TLS_PROCTABLE()->Binormal3bEXT) +#define glBinormal3bvEXT (_GET_TLS_PROCTABLE()->Binormal3bvEXT) +#define glBinormal3dEXT (_GET_TLS_PROCTABLE()->Binormal3dEXT) +#define glBinormal3dvEXT (_GET_TLS_PROCTABLE()->Binormal3dvEXT) +#define glBinormal3fEXT (_GET_TLS_PROCTABLE()->Binormal3fEXT) +#define glBinormal3fvEXT (_GET_TLS_PROCTABLE()->Binormal3fvEXT) +#define glBinormal3iEXT (_GET_TLS_PROCTABLE()->Binormal3iEXT) +#define glBinormal3ivEXT (_GET_TLS_PROCTABLE()->Binormal3ivEXT) +#define glBinormal3sEXT (_GET_TLS_PROCTABLE()->Binormal3sEXT) +#define glBinormal3svEXT (_GET_TLS_PROCTABLE()->Binormal3svEXT) +#define glTangentPointerEXT (_GET_TLS_PROCTABLE()->TangentPointerEXT) +#define glBinormalPointerEXT (_GET_TLS_PROCTABLE()->BinormalPointerEXT) +#define glFinishTextureSUNX (_GET_TLS_PROCTABLE()->FinishTextureSUNX) +#define glGlobalAlphaFactorbSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorbSUN) +#define glGlobalAlphaFactorsSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorsSUN) +#define glGlobalAlphaFactoriSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactoriSUN) +#define glGlobalAlphaFactorfSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorfSUN) +#define glGlobalAlphaFactordSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactordSUN) +#define glGlobalAlphaFactorubSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorubSUN) +#define glGlobalAlphaFactorusSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactorusSUN) +#define glGlobalAlphaFactoruiSUN (_GET_TLS_PROCTABLE()->GlobalAlphaFactoruiSUN) +#define glReplacementCodeuiSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiSUN) +#define glReplacementCodeusSUN (_GET_TLS_PROCTABLE()->ReplacementCodeusSUN) +#define glReplacementCodeubSUN (_GET_TLS_PROCTABLE()->ReplacementCodeubSUN) +#define glReplacementCodeuivSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuivSUN) +#define glReplacementCodeusvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeusvSUN) +#define glReplacementCodeubvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeubvSUN) +#define glReplacementCodePointerSUN (_GET_TLS_PROCTABLE()->ReplacementCodePointerSUN) +#define glColor4ubVertex2fSUN (_GET_TLS_PROCTABLE()->Color4ubVertex2fSUN) +#define glColor4ubVertex2fvSUN (_GET_TLS_PROCTABLE()->Color4ubVertex2fvSUN) +#define glColor4ubVertex3fSUN (_GET_TLS_PROCTABLE()->Color4ubVertex3fSUN) +#define glColor4ubVertex3fvSUN (_GET_TLS_PROCTABLE()->Color4ubVertex3fvSUN) +#define glColor3fVertex3fSUN (_GET_TLS_PROCTABLE()->Color3fVertex3fSUN) +#define glColor3fVertex3fvSUN (_GET_TLS_PROCTABLE()->Color3fVertex3fvSUN) +#define glNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->Normal3fVertex3fSUN) +#define glNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->Normal3fVertex3fvSUN) +#define glColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->Color4fNormal3fVertex3fSUN) +#define glColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->Color4fNormal3fVertex3fvSUN) +#define glTexCoord2fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fVertex3fSUN) +#define glTexCoord2fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fVertex3fvSUN) +#define glTexCoord4fVertex4fSUN (_GET_TLS_PROCTABLE()->TexCoord4fVertex4fSUN) +#define glTexCoord4fVertex4fvSUN (_GET_TLS_PROCTABLE()->TexCoord4fVertex4fvSUN) +#define glTexCoord2fColor4ubVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4ubVertex3fSUN) +#define glTexCoord2fColor4ubVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4ubVertex3fvSUN) +#define glTexCoord2fColor3fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor3fVertex3fSUN) +#define glTexCoord2fColor3fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor3fVertex3fvSUN) +#define glTexCoord2fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fNormal3fVertex3fSUN) +#define glTexCoord2fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fNormal3fVertex3fvSUN) +#define glTexCoord2fColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4fNormal3fVertex3fSUN) +#define glTexCoord2fColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->TexCoord2fColor4fNormal3fVertex3fvSUN) +#define glTexCoord4fColor4fNormal3fVertex4fSUN (_GET_TLS_PROCTABLE()->TexCoord4fColor4fNormal3fVertex4fSUN) +#define glTexCoord4fColor4fNormal3fVertex4fvSUN (_GET_TLS_PROCTABLE()->TexCoord4fColor4fNormal3fVertex4fvSUN) +#define glReplacementCodeuiVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiVertex3fSUN) +#define glReplacementCodeuiVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiVertex3fvSUN) +#define glReplacementCodeuiColor4ubVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4ubVertex3fSUN) +#define glReplacementCodeuiColor4ubVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4ubVertex3fvSUN) +#define glReplacementCodeuiColor3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor3fVertex3fSUN) +#define glReplacementCodeuiColor3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor3fVertex3fvSUN) +#define glReplacementCodeuiNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiNormal3fVertex3fSUN) +#define glReplacementCodeuiNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (_GET_TLS_PROCTABLE()->ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glBlendFuncSeparateEXT (_GET_TLS_PROCTABLE()->BlendFuncSeparateEXT) +#define glBlendFuncSeparateINGR (_GET_TLS_PROCTABLE()->BlendFuncSeparateINGR) +#define glVertexWeightfEXT (_GET_TLS_PROCTABLE()->VertexWeightfEXT) +#define glVertexWeightfvEXT (_GET_TLS_PROCTABLE()->VertexWeightfvEXT) +#define glVertexWeightPointerEXT (_GET_TLS_PROCTABLE()->VertexWeightPointerEXT) +#define glFlushVertexArrayRangeNV (_GET_TLS_PROCTABLE()->FlushVertexArrayRangeNV) +#define glVertexArrayRangeNV (_GET_TLS_PROCTABLE()->VertexArrayRangeNV) +#define glCombinerParameterfvNV (_GET_TLS_PROCTABLE()->CombinerParameterfvNV) +#define glCombinerParameterfNV (_GET_TLS_PROCTABLE()->CombinerParameterfNV) +#define glCombinerParameterivNV (_GET_TLS_PROCTABLE()->CombinerParameterivNV) +#define glCombinerParameteriNV (_GET_TLS_PROCTABLE()->CombinerParameteriNV) +#define glCombinerInputNV (_GET_TLS_PROCTABLE()->CombinerInputNV) +#define glCombinerOutputNV (_GET_TLS_PROCTABLE()->CombinerOutputNV) +#define glFinalCombinerInputNV (_GET_TLS_PROCTABLE()->FinalCombinerInputNV) +#define glGetCombinerInputParameterfvNV (_GET_TLS_PROCTABLE()->GetCombinerInputParameterfvNV) +#define glGetCombinerInputParameterivNV (_GET_TLS_PROCTABLE()->GetCombinerInputParameterivNV) +#define glGetCombinerOutputParameterfvNV (_GET_TLS_PROCTABLE()->GetCombinerOutputParameterfvNV) +#define glGetCombinerOutputParameterivNV (_GET_TLS_PROCTABLE()->GetCombinerOutputParameterivNV) +#define glGetFinalCombinerInputParameterfvNV (_GET_TLS_PROCTABLE()->GetFinalCombinerInputParameterfvNV) +#define glGetFinalCombinerInputParameterivNV (_GET_TLS_PROCTABLE()->GetFinalCombinerInputParameterivNV) +#define glResizeBuffersMESA (_GET_TLS_PROCTABLE()->ResizeBuffersMESA) +#define glWindowPos2dMESA (_GET_TLS_PROCTABLE()->WindowPos2dMESA) +#define glWindowPos2dvMESA (_GET_TLS_PROCTABLE()->WindowPos2dvMESA) +#define glWindowPos2fMESA (_GET_TLS_PROCTABLE()->WindowPos2fMESA) +#define glWindowPos2fvMESA (_GET_TLS_PROCTABLE()->WindowPos2fvMESA) +#define glWindowPos2iMESA (_GET_TLS_PROCTABLE()->WindowPos2iMESA) +#define glWindowPos2ivMESA (_GET_TLS_PROCTABLE()->WindowPos2ivMESA) +#define glWindowPos2sMESA (_GET_TLS_PROCTABLE()->WindowPos2sMESA) +#define glWindowPos2svMESA (_GET_TLS_PROCTABLE()->WindowPos2svMESA) +#define glWindowPos3dMESA (_GET_TLS_PROCTABLE()->WindowPos3dMESA) +#define glWindowPos3dvMESA (_GET_TLS_PROCTABLE()->WindowPos3dvMESA) +#define glWindowPos3fMESA (_GET_TLS_PROCTABLE()->WindowPos3fMESA) +#define glWindowPos3fvMESA (_GET_TLS_PROCTABLE()->WindowPos3fvMESA) +#define glWindowPos3iMESA (_GET_TLS_PROCTABLE()->WindowPos3iMESA) +#define glWindowPos3ivMESA (_GET_TLS_PROCTABLE()->WindowPos3ivMESA) +#define glWindowPos3sMESA (_GET_TLS_PROCTABLE()->WindowPos3sMESA) +#define glWindowPos3svMESA (_GET_TLS_PROCTABLE()->WindowPos3svMESA) +#define glWindowPos4dMESA (_GET_TLS_PROCTABLE()->WindowPos4dMESA) +#define glWindowPos4dvMESA (_GET_TLS_PROCTABLE()->WindowPos4dvMESA) +#define glWindowPos4fMESA (_GET_TLS_PROCTABLE()->WindowPos4fMESA) +#define glWindowPos4fvMESA (_GET_TLS_PROCTABLE()->WindowPos4fvMESA) +#define glWindowPos4iMESA (_GET_TLS_PROCTABLE()->WindowPos4iMESA) +#define glWindowPos4ivMESA (_GET_TLS_PROCTABLE()->WindowPos4ivMESA) +#define glWindowPos4sMESA (_GET_TLS_PROCTABLE()->WindowPos4sMESA) +#define glWindowPos4svMESA (_GET_TLS_PROCTABLE()->WindowPos4svMESA) +#define glMultiModeDrawArraysIBM (_GET_TLS_PROCTABLE()->MultiModeDrawArraysIBM) +#define glMultiModeDrawElementsIBM (_GET_TLS_PROCTABLE()->MultiModeDrawElementsIBM) +#define glColorPointerListIBM (_GET_TLS_PROCTABLE()->ColorPointerListIBM) +#define glSecondaryColorPointerListIBM (_GET_TLS_PROCTABLE()->SecondaryColorPointerListIBM) +#define glEdgeFlagPointerListIBM (_GET_TLS_PROCTABLE()->EdgeFlagPointerListIBM) +#define glFogCoordPointerListIBM (_GET_TLS_PROCTABLE()->FogCoordPointerListIBM) +#define glIndexPointerListIBM (_GET_TLS_PROCTABLE()->IndexPointerListIBM) +#define glNormalPointerListIBM (_GET_TLS_PROCTABLE()->NormalPointerListIBM) +#define glTexCoordPointerListIBM (_GET_TLS_PROCTABLE()->TexCoordPointerListIBM) +#define glVertexPointerListIBM (_GET_TLS_PROCTABLE()->VertexPointerListIBM) +#define glTbufferMask3DFX (_GET_TLS_PROCTABLE()->TbufferMask3DFX) +#define glSampleMaskEXT (_GET_TLS_PROCTABLE()->SampleMaskEXT) +#define glSamplePatternEXT (_GET_TLS_PROCTABLE()->SamplePatternEXT) +#define glTextureColorMaskSGIS (_GET_TLS_PROCTABLE()->TextureColorMaskSGIS) +#define glIglooInterfaceSGIX (_GET_TLS_PROCTABLE()->IglooInterfaceSGIX) +#define glDeleteFencesNV (_GET_TLS_PROCTABLE()->DeleteFencesNV) +#define glGenFencesNV (_GET_TLS_PROCTABLE()->GenFencesNV) +#define glIsFenceNV (_GET_TLS_PROCTABLE()->IsFenceNV) +#define glTestFenceNV (_GET_TLS_PROCTABLE()->TestFenceNV) +#define glGetFenceivNV (_GET_TLS_PROCTABLE()->GetFenceivNV) +#define glFinishFenceNV (_GET_TLS_PROCTABLE()->FinishFenceNV) +#define glSetFenceNV (_GET_TLS_PROCTABLE()->SetFenceNV) +#define glMapControlPointsNV (_GET_TLS_PROCTABLE()->MapControlPointsNV) +#define glMapParameterivNV (_GET_TLS_PROCTABLE()->MapParameterivNV) +#define glMapParameterfvNV (_GET_TLS_PROCTABLE()->MapParameterfvNV) +#define glGetMapControlPointsNV (_GET_TLS_PROCTABLE()->GetMapControlPointsNV) +#define glGetMapParameterivNV (_GET_TLS_PROCTABLE()->GetMapParameterivNV) +#define glGetMapParameterfvNV (_GET_TLS_PROCTABLE()->GetMapParameterfvNV) +#define glGetMapAttribParameterivNV (_GET_TLS_PROCTABLE()->GetMapAttribParameterivNV) +#define glGetMapAttribParameterfvNV (_GET_TLS_PROCTABLE()->GetMapAttribParameterfvNV) +#define glEvalMapsNV (_GET_TLS_PROCTABLE()->EvalMapsNV) +#define glCombinerStageParameterfvNV (_GET_TLS_PROCTABLE()->CombinerStageParameterfvNV) +#define glGetCombinerStageParameterfvNV (_GET_TLS_PROCTABLE()->GetCombinerStageParameterfvNV) +#define glAreProgramsResidentNV (_GET_TLS_PROCTABLE()->AreProgramsResidentNV) +#define glBindProgramNV (_GET_TLS_PROCTABLE()->BindProgramNV) +#define glDeleteProgramsNV (_GET_TLS_PROCTABLE()->DeleteProgramsNV) +#define glExecuteProgramNV (_GET_TLS_PROCTABLE()->ExecuteProgramNV) +#define glGenProgramsNV (_GET_TLS_PROCTABLE()->GenProgramsNV) +#define glGetProgramParameterdvNV (_GET_TLS_PROCTABLE()->GetProgramParameterdvNV) +#define glGetProgramParameterfvNV (_GET_TLS_PROCTABLE()->GetProgramParameterfvNV) +#define glGetProgramivNV (_GET_TLS_PROCTABLE()->GetProgramivNV) +#define glGetProgramStringNV (_GET_TLS_PROCTABLE()->GetProgramStringNV) +#define glGetTrackMatrixivNV (_GET_TLS_PROCTABLE()->GetTrackMatrixivNV) +#define glGetVertexAttribdvNV (_GET_TLS_PROCTABLE()->GetVertexAttribdvNV) +#define glGetVertexAttribfvNV (_GET_TLS_PROCTABLE()->GetVertexAttribfvNV) +#define glGetVertexAttribivNV (_GET_TLS_PROCTABLE()->GetVertexAttribivNV) +#define glGetVertexAttribPointervNV (_GET_TLS_PROCTABLE()->GetVertexAttribPointervNV) +#define glIsProgramNV (_GET_TLS_PROCTABLE()->IsProgramNV) +#define glLoadProgramNV (_GET_TLS_PROCTABLE()->LoadProgramNV) +#define glProgramParameter4dNV (_GET_TLS_PROCTABLE()->ProgramParameter4dNV) +#define glProgramParameter4dvNV (_GET_TLS_PROCTABLE()->ProgramParameter4dvNV) +#define glProgramParameter4fNV (_GET_TLS_PROCTABLE()->ProgramParameter4fNV) +#define glProgramParameter4fvNV (_GET_TLS_PROCTABLE()->ProgramParameter4fvNV) +#define glProgramParameters4dvNV (_GET_TLS_PROCTABLE()->ProgramParameters4dvNV) +#define glProgramParameters4fvNV (_GET_TLS_PROCTABLE()->ProgramParameters4fvNV) +#define glRequestResidentProgramsNV (_GET_TLS_PROCTABLE()->RequestResidentProgramsNV) +#define glTrackMatrixNV (_GET_TLS_PROCTABLE()->TrackMatrixNV) +#define glVertexAttribPointerNV (_GET_TLS_PROCTABLE()->VertexAttribPointerNV) +#define glVertexAttrib1dNV (_GET_TLS_PROCTABLE()->VertexAttrib1dNV) +#define glVertexAttrib1dvNV (_GET_TLS_PROCTABLE()->VertexAttrib1dvNV) +#define glVertexAttrib1fNV (_GET_TLS_PROCTABLE()->VertexAttrib1fNV) +#define glVertexAttrib1fvNV (_GET_TLS_PROCTABLE()->VertexAttrib1fvNV) +#define glVertexAttrib1sNV (_GET_TLS_PROCTABLE()->VertexAttrib1sNV) +#define glVertexAttrib1svNV (_GET_TLS_PROCTABLE()->VertexAttrib1svNV) +#define glVertexAttrib2dNV (_GET_TLS_PROCTABLE()->VertexAttrib2dNV) +#define glVertexAttrib2dvNV (_GET_TLS_PROCTABLE()->VertexAttrib2dvNV) +#define glVertexAttrib2fNV (_GET_TLS_PROCTABLE()->VertexAttrib2fNV) +#define glVertexAttrib2fvNV (_GET_TLS_PROCTABLE()->VertexAttrib2fvNV) +#define glVertexAttrib2sNV (_GET_TLS_PROCTABLE()->VertexAttrib2sNV) +#define glVertexAttrib2svNV (_GET_TLS_PROCTABLE()->VertexAttrib2svNV) +#define glVertexAttrib3dNV (_GET_TLS_PROCTABLE()->VertexAttrib3dNV) +#define glVertexAttrib3dvNV (_GET_TLS_PROCTABLE()->VertexAttrib3dvNV) +#define glVertexAttrib3fNV (_GET_TLS_PROCTABLE()->VertexAttrib3fNV) +#define glVertexAttrib3fvNV (_GET_TLS_PROCTABLE()->VertexAttrib3fvNV) +#define glVertexAttrib3sNV (_GET_TLS_PROCTABLE()->VertexAttrib3sNV) +#define glVertexAttrib3svNV (_GET_TLS_PROCTABLE()->VertexAttrib3svNV) +#define glVertexAttrib4dNV (_GET_TLS_PROCTABLE()->VertexAttrib4dNV) +#define glVertexAttrib4dvNV (_GET_TLS_PROCTABLE()->VertexAttrib4dvNV) +#define glVertexAttrib4fNV (_GET_TLS_PROCTABLE()->VertexAttrib4fNV) +#define glVertexAttrib4fvNV (_GET_TLS_PROCTABLE()->VertexAttrib4fvNV) +#define glVertexAttrib4sNV (_GET_TLS_PROCTABLE()->VertexAttrib4sNV) +#define glVertexAttrib4svNV (_GET_TLS_PROCTABLE()->VertexAttrib4svNV) +#define glVertexAttrib4ubNV (_GET_TLS_PROCTABLE()->VertexAttrib4ubNV) +#define glVertexAttrib4ubvNV (_GET_TLS_PROCTABLE()->VertexAttrib4ubvNV) +#define glVertexAttribs1dvNV (_GET_TLS_PROCTABLE()->VertexAttribs1dvNV) +#define glVertexAttribs1fvNV (_GET_TLS_PROCTABLE()->VertexAttribs1fvNV) +#define glVertexAttribs1svNV (_GET_TLS_PROCTABLE()->VertexAttribs1svNV) +#define glVertexAttribs2dvNV (_GET_TLS_PROCTABLE()->VertexAttribs2dvNV) +#define glVertexAttribs2fvNV (_GET_TLS_PROCTABLE()->VertexAttribs2fvNV) +#define glVertexAttribs2svNV (_GET_TLS_PROCTABLE()->VertexAttribs2svNV) +#define glVertexAttribs3dvNV (_GET_TLS_PROCTABLE()->VertexAttribs3dvNV) +#define glVertexAttribs3fvNV (_GET_TLS_PROCTABLE()->VertexAttribs3fvNV) +#define glVertexAttribs3svNV (_GET_TLS_PROCTABLE()->VertexAttribs3svNV) +#define glVertexAttribs4dvNV (_GET_TLS_PROCTABLE()->VertexAttribs4dvNV) +#define glVertexAttribs4fvNV (_GET_TLS_PROCTABLE()->VertexAttribs4fvNV) +#define glVertexAttribs4svNV (_GET_TLS_PROCTABLE()->VertexAttribs4svNV) +#define glVertexAttribs4ubvNV (_GET_TLS_PROCTABLE()->VertexAttribs4ubvNV) +#define glTexBumpParameterivATI (_GET_TLS_PROCTABLE()->TexBumpParameterivATI) +#define glTexBumpParameterfvATI (_GET_TLS_PROCTABLE()->TexBumpParameterfvATI) +#define glGetTexBumpParameterivATI (_GET_TLS_PROCTABLE()->GetTexBumpParameterivATI) +#define glGetTexBumpParameterfvATI (_GET_TLS_PROCTABLE()->GetTexBumpParameterfvATI) +#define glGenFragmentShadersATI (_GET_TLS_PROCTABLE()->GenFragmentShadersATI) +#define glBindFragmentShaderATI (_GET_TLS_PROCTABLE()->BindFragmentShaderATI) +#define glDeleteFragmentShaderATI (_GET_TLS_PROCTABLE()->DeleteFragmentShaderATI) +#define glBeginFragmentShaderATI (_GET_TLS_PROCTABLE()->BeginFragmentShaderATI) +#define glEndFragmentShaderATI (_GET_TLS_PROCTABLE()->EndFragmentShaderATI) +#define glPassTexCoordATI (_GET_TLS_PROCTABLE()->PassTexCoordATI) +#define glSampleMapATI (_GET_TLS_PROCTABLE()->SampleMapATI) +#define glColorFragmentOp1ATI (_GET_TLS_PROCTABLE()->ColorFragmentOp1ATI) +#define glColorFragmentOp2ATI (_GET_TLS_PROCTABLE()->ColorFragmentOp2ATI) +#define glColorFragmentOp3ATI (_GET_TLS_PROCTABLE()->ColorFragmentOp3ATI) +#define glAlphaFragmentOp1ATI (_GET_TLS_PROCTABLE()->AlphaFragmentOp1ATI) +#define glAlphaFragmentOp2ATI (_GET_TLS_PROCTABLE()->AlphaFragmentOp2ATI) +#define glAlphaFragmentOp3ATI (_GET_TLS_PROCTABLE()->AlphaFragmentOp3ATI) +#define glSetFragmentShaderConstantATI (_GET_TLS_PROCTABLE()->SetFragmentShaderConstantATI) +#define glPNTrianglesiATI (_GET_TLS_PROCTABLE()->PNTrianglesiATI) +#define glPNTrianglesfATI (_GET_TLS_PROCTABLE()->PNTrianglesfATI) +#define glNewObjectBufferATI (_GET_TLS_PROCTABLE()->NewObjectBufferATI) +#define glIsObjectBufferATI (_GET_TLS_PROCTABLE()->IsObjectBufferATI) +#define glUpdateObjectBufferATI (_GET_TLS_PROCTABLE()->UpdateObjectBufferATI) +#define glGetObjectBufferfvATI (_GET_TLS_PROCTABLE()->GetObjectBufferfvATI) +#define glGetObjectBufferivATI (_GET_TLS_PROCTABLE()->GetObjectBufferivATI) +#define glFreeObjectBufferATI (_GET_TLS_PROCTABLE()->FreeObjectBufferATI) +#define glArrayObjectATI (_GET_TLS_PROCTABLE()->ArrayObjectATI) +#define glGetArrayObjectfvATI (_GET_TLS_PROCTABLE()->GetArrayObjectfvATI) +#define glGetArrayObjectivATI (_GET_TLS_PROCTABLE()->GetArrayObjectivATI) +#define glVariantArrayObjectATI (_GET_TLS_PROCTABLE()->VariantArrayObjectATI) +#define glGetVariantArrayObjectfvATI (_GET_TLS_PROCTABLE()->GetVariantArrayObjectfvATI) +#define glGetVariantArrayObjectivATI (_GET_TLS_PROCTABLE()->GetVariantArrayObjectivATI) +#define glBeginVertexShaderEXT (_GET_TLS_PROCTABLE()->BeginVertexShaderEXT) +#define glEndVertexShaderEXT (_GET_TLS_PROCTABLE()->EndVertexShaderEXT) +#define glBindVertexShaderEXT (_GET_TLS_PROCTABLE()->BindVertexShaderEXT) +#define glGenVertexShadersEXT (_GET_TLS_PROCTABLE()->GenVertexShadersEXT) +#define glDeleteVertexShaderEXT (_GET_TLS_PROCTABLE()->DeleteVertexShaderEXT) +#define glShaderOp1EXT (_GET_TLS_PROCTABLE()->ShaderOp1EXT) +#define glShaderOp2EXT (_GET_TLS_PROCTABLE()->ShaderOp2EXT) +#define glShaderOp3EXT (_GET_TLS_PROCTABLE()->ShaderOp3EXT) +#define glSwizzleEXT (_GET_TLS_PROCTABLE()->SwizzleEXT) +#define glWriteMaskEXT (_GET_TLS_PROCTABLE()->WriteMaskEXT) +#define glInsertComponentEXT (_GET_TLS_PROCTABLE()->InsertComponentEXT) +#define glExtractComponentEXT (_GET_TLS_PROCTABLE()->ExtractComponentEXT) +#define glGenSymbolsEXT (_GET_TLS_PROCTABLE()->GenSymbolsEXT) +#define glSetInvariantEXT (_GET_TLS_PROCTABLE()->SetInvariantEXT) +#define glSetLocalConstantEXT (_GET_TLS_PROCTABLE()->SetLocalConstantEXT) +#define glVariantbvEXT (_GET_TLS_PROCTABLE()->VariantbvEXT) +#define glVariantsvEXT (_GET_TLS_PROCTABLE()->VariantsvEXT) +#define glVariantivEXT (_GET_TLS_PROCTABLE()->VariantivEXT) +#define glVariantfvEXT (_GET_TLS_PROCTABLE()->VariantfvEXT) +#define glVariantdvEXT (_GET_TLS_PROCTABLE()->VariantdvEXT) +#define glVariantubvEXT (_GET_TLS_PROCTABLE()->VariantubvEXT) +#define glVariantusvEXT (_GET_TLS_PROCTABLE()->VariantusvEXT) +#define glVariantuivEXT (_GET_TLS_PROCTABLE()->VariantuivEXT) +#define glVariantPointerEXT (_GET_TLS_PROCTABLE()->VariantPointerEXT) +#define glEnableVariantClientStateEXT (_GET_TLS_PROCTABLE()->EnableVariantClientStateEXT) +#define glDisableVariantClientStateEXT (_GET_TLS_PROCTABLE()->DisableVariantClientStateEXT) +#define glBindLightParameterEXT (_GET_TLS_PROCTABLE()->BindLightParameterEXT) +#define glBindMaterialParameterEXT (_GET_TLS_PROCTABLE()->BindMaterialParameterEXT) +#define glBindTexGenParameterEXT (_GET_TLS_PROCTABLE()->BindTexGenParameterEXT) +#define glBindTextureUnitParameterEXT (_GET_TLS_PROCTABLE()->BindTextureUnitParameterEXT) +#define glBindParameterEXT (_GET_TLS_PROCTABLE()->BindParameterEXT) +#define glIsVariantEnabledEXT (_GET_TLS_PROCTABLE()->IsVariantEnabledEXT) +#define glGetVariantBooleanvEXT (_GET_TLS_PROCTABLE()->GetVariantBooleanvEXT) +#define glGetVariantIntegervEXT (_GET_TLS_PROCTABLE()->GetVariantIntegervEXT) +#define glGetVariantFloatvEXT (_GET_TLS_PROCTABLE()->GetVariantFloatvEXT) +#define glGetVariantPointervEXT (_GET_TLS_PROCTABLE()->GetVariantPointervEXT) +#define glGetInvariantBooleanvEXT (_GET_TLS_PROCTABLE()->GetInvariantBooleanvEXT) +#define glGetInvariantIntegervEXT (_GET_TLS_PROCTABLE()->GetInvariantIntegervEXT) +#define glGetInvariantFloatvEXT (_GET_TLS_PROCTABLE()->GetInvariantFloatvEXT) +#define glGetLocalConstantBooleanvEXT (_GET_TLS_PROCTABLE()->GetLocalConstantBooleanvEXT) +#define glGetLocalConstantIntegervEXT (_GET_TLS_PROCTABLE()->GetLocalConstantIntegervEXT) +#define glGetLocalConstantFloatvEXT (_GET_TLS_PROCTABLE()->GetLocalConstantFloatvEXT) +#define glVertexStream1sATI (_GET_TLS_PROCTABLE()->VertexStream1sATI) +#define glVertexStream1svATI (_GET_TLS_PROCTABLE()->VertexStream1svATI) +#define glVertexStream1iATI (_GET_TLS_PROCTABLE()->VertexStream1iATI) +#define glVertexStream1ivATI (_GET_TLS_PROCTABLE()->VertexStream1ivATI) +#define glVertexStream1fATI (_GET_TLS_PROCTABLE()->VertexStream1fATI) +#define glVertexStream1fvATI (_GET_TLS_PROCTABLE()->VertexStream1fvATI) +#define glVertexStream1dATI (_GET_TLS_PROCTABLE()->VertexStream1dATI) +#define glVertexStream1dvATI (_GET_TLS_PROCTABLE()->VertexStream1dvATI) +#define glVertexStream2sATI (_GET_TLS_PROCTABLE()->VertexStream2sATI) +#define glVertexStream2svATI (_GET_TLS_PROCTABLE()->VertexStream2svATI) +#define glVertexStream2iATI (_GET_TLS_PROCTABLE()->VertexStream2iATI) +#define glVertexStream2ivATI (_GET_TLS_PROCTABLE()->VertexStream2ivATI) +#define glVertexStream2fATI (_GET_TLS_PROCTABLE()->VertexStream2fATI) +#define glVertexStream2fvATI (_GET_TLS_PROCTABLE()->VertexStream2fvATI) +#define glVertexStream2dATI (_GET_TLS_PROCTABLE()->VertexStream2dATI) +#define glVertexStream2dvATI (_GET_TLS_PROCTABLE()->VertexStream2dvATI) +#define glVertexStream3sATI (_GET_TLS_PROCTABLE()->VertexStream3sATI) +#define glVertexStream3svATI (_GET_TLS_PROCTABLE()->VertexStream3svATI) +#define glVertexStream3iATI (_GET_TLS_PROCTABLE()->VertexStream3iATI) +#define glVertexStream3ivATI (_GET_TLS_PROCTABLE()->VertexStream3ivATI) +#define glVertexStream3fATI (_GET_TLS_PROCTABLE()->VertexStream3fATI) +#define glVertexStream3fvATI (_GET_TLS_PROCTABLE()->VertexStream3fvATI) +#define glVertexStream3dATI (_GET_TLS_PROCTABLE()->VertexStream3dATI) +#define glVertexStream3dvATI (_GET_TLS_PROCTABLE()->VertexStream3dvATI) +#define glVertexStream4sATI (_GET_TLS_PROCTABLE()->VertexStream4sATI) +#define glVertexStream4svATI (_GET_TLS_PROCTABLE()->VertexStream4svATI) +#define glVertexStream4iATI (_GET_TLS_PROCTABLE()->VertexStream4iATI) +#define glVertexStream4ivATI (_GET_TLS_PROCTABLE()->VertexStream4ivATI) +#define glVertexStream4fATI (_GET_TLS_PROCTABLE()->VertexStream4fATI) +#define glVertexStream4fvATI (_GET_TLS_PROCTABLE()->VertexStream4fvATI) +#define glVertexStream4dATI (_GET_TLS_PROCTABLE()->VertexStream4dATI) +#define glVertexStream4dvATI (_GET_TLS_PROCTABLE()->VertexStream4dvATI) +#define glNormalStream3bATI (_GET_TLS_PROCTABLE()->NormalStream3bATI) +#define glNormalStream3bvATI (_GET_TLS_PROCTABLE()->NormalStream3bvATI) +#define glNormalStream3sATI (_GET_TLS_PROCTABLE()->NormalStream3sATI) +#define glNormalStream3svATI (_GET_TLS_PROCTABLE()->NormalStream3svATI) +#define glNormalStream3iATI (_GET_TLS_PROCTABLE()->NormalStream3iATI) +#define glNormalStream3ivATI (_GET_TLS_PROCTABLE()->NormalStream3ivATI) +#define glNormalStream3fATI (_GET_TLS_PROCTABLE()->NormalStream3fATI) +#define glNormalStream3fvATI (_GET_TLS_PROCTABLE()->NormalStream3fvATI) +#define glNormalStream3dATI (_GET_TLS_PROCTABLE()->NormalStream3dATI) +#define glNormalStream3dvATI (_GET_TLS_PROCTABLE()->NormalStream3dvATI) +#define glClientActiveVertexStreamATI (_GET_TLS_PROCTABLE()->ClientActiveVertexStreamATI) +#define glVertexBlendEnviATI (_GET_TLS_PROCTABLE()->VertexBlendEnviATI) +#define glVertexBlendEnvfATI (_GET_TLS_PROCTABLE()->VertexBlendEnvfATI) +#define glElementPointerATI (_GET_TLS_PROCTABLE()->ElementPointerATI) +#define glDrawElementArrayATI (_GET_TLS_PROCTABLE()->DrawElementArrayATI) +#define glDrawRangeElementArrayATI (_GET_TLS_PROCTABLE()->DrawRangeElementArrayATI) +#define glDrawMeshArraysSUN (_GET_TLS_PROCTABLE()->DrawMeshArraysSUN) +#define glGenOcclusionQueriesNV (_GET_TLS_PROCTABLE()->GenOcclusionQueriesNV) +#define glDeleteOcclusionQueriesNV (_GET_TLS_PROCTABLE()->DeleteOcclusionQueriesNV) +#define glIsOcclusionQueryNV (_GET_TLS_PROCTABLE()->IsOcclusionQueryNV) +#define glBeginOcclusionQueryNV (_GET_TLS_PROCTABLE()->BeginOcclusionQueryNV) +#define glEndOcclusionQueryNV (_GET_TLS_PROCTABLE()->EndOcclusionQueryNV) +#define glGetOcclusionQueryivNV (_GET_TLS_PROCTABLE()->GetOcclusionQueryivNV) +#define glGetOcclusionQueryuivNV (_GET_TLS_PROCTABLE()->GetOcclusionQueryuivNV) +#define glPointParameteriNV (_GET_TLS_PROCTABLE()->PointParameteriNV) +#define glPointParameterivNV (_GET_TLS_PROCTABLE()->PointParameterivNV) +#define glActiveStencilFaceEXT (_GET_TLS_PROCTABLE()->ActiveStencilFaceEXT) +#define glElementPointerAPPLE (_GET_TLS_PROCTABLE()->ElementPointerAPPLE) +#define glDrawElementArrayAPPLE (_GET_TLS_PROCTABLE()->DrawElementArrayAPPLE) +#define glDrawRangeElementArrayAPPLE (_GET_TLS_PROCTABLE()->DrawRangeElementArrayAPPLE) +#define glMultiDrawElementArrayAPPLE (_GET_TLS_PROCTABLE()->MultiDrawElementArrayAPPLE) +#define glMultiDrawRangeElementArrayAPPLE (_GET_TLS_PROCTABLE()->MultiDrawRangeElementArrayAPPLE) +#define glGenFencesAPPLE (_GET_TLS_PROCTABLE()->GenFencesAPPLE) +#define glDeleteFencesAPPLE (_GET_TLS_PROCTABLE()->DeleteFencesAPPLE) +#define glSetFenceAPPLE (_GET_TLS_PROCTABLE()->SetFenceAPPLE) +#define glIsFenceAPPLE (_GET_TLS_PROCTABLE()->IsFenceAPPLE) +#define glTestFenceAPPLE (_GET_TLS_PROCTABLE()->TestFenceAPPLE) +#define glFinishFenceAPPLE (_GET_TLS_PROCTABLE()->FinishFenceAPPLE) +#define glTestObjectAPPLE (_GET_TLS_PROCTABLE()->TestObjectAPPLE) +#define glFinishObjectAPPLE (_GET_TLS_PROCTABLE()->FinishObjectAPPLE) +#define glBindVertexArrayAPPLE (_GET_TLS_PROCTABLE()->BindVertexArrayAPPLE) +#define glDeleteVertexArraysAPPLE (_GET_TLS_PROCTABLE()->DeleteVertexArraysAPPLE) +#define glGenVertexArraysAPPLE (_GET_TLS_PROCTABLE()->GenVertexArraysAPPLE) +#define glIsVertexArrayAPPLE (_GET_TLS_PROCTABLE()->IsVertexArrayAPPLE) +#define glVertexArrayRangeAPPLE (_GET_TLS_PROCTABLE()->VertexArrayRangeAPPLE) +#define glFlushVertexArrayRangeAPPLE (_GET_TLS_PROCTABLE()->FlushVertexArrayRangeAPPLE) +#define glVertexArrayParameteriAPPLE (_GET_TLS_PROCTABLE()->VertexArrayParameteriAPPLE) +#define glDrawBuffersATI (_GET_TLS_PROCTABLE()->DrawBuffersATI) +#define glProgramNamedParameter4fNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4fNV) +#define glProgramNamedParameter4dNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4dNV) +#define glProgramNamedParameter4fvNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4fvNV) +#define glProgramNamedParameter4dvNV (_GET_TLS_PROCTABLE()->ProgramNamedParameter4dvNV) +#define glGetProgramNamedParameterfvNV (_GET_TLS_PROCTABLE()->GetProgramNamedParameterfvNV) +#define glGetProgramNamedParameterdvNV (_GET_TLS_PROCTABLE()->GetProgramNamedParameterdvNV) +#define glVertex2hNV (_GET_TLS_PROCTABLE()->Vertex2hNV) +#define glVertex2hvNV (_GET_TLS_PROCTABLE()->Vertex2hvNV) +#define glVertex3hNV (_GET_TLS_PROCTABLE()->Vertex3hNV) +#define glVertex3hvNV (_GET_TLS_PROCTABLE()->Vertex3hvNV) +#define glVertex4hNV (_GET_TLS_PROCTABLE()->Vertex4hNV) +#define glVertex4hvNV (_GET_TLS_PROCTABLE()->Vertex4hvNV) +#define glNormal3hNV (_GET_TLS_PROCTABLE()->Normal3hNV) +#define glNormal3hvNV (_GET_TLS_PROCTABLE()->Normal3hvNV) +#define glColor3hNV (_GET_TLS_PROCTABLE()->Color3hNV) +#define glColor3hvNV (_GET_TLS_PROCTABLE()->Color3hvNV) +#define glColor4hNV (_GET_TLS_PROCTABLE()->Color4hNV) +#define glColor4hvNV (_GET_TLS_PROCTABLE()->Color4hvNV) +#define glTexCoord1hNV (_GET_TLS_PROCTABLE()->TexCoord1hNV) +#define glTexCoord1hvNV (_GET_TLS_PROCTABLE()->TexCoord1hvNV) +#define glTexCoord2hNV (_GET_TLS_PROCTABLE()->TexCoord2hNV) +#define glTexCoord2hvNV (_GET_TLS_PROCTABLE()->TexCoord2hvNV) +#define glTexCoord3hNV (_GET_TLS_PROCTABLE()->TexCoord3hNV) +#define glTexCoord3hvNV (_GET_TLS_PROCTABLE()->TexCoord3hvNV) +#define glTexCoord4hNV (_GET_TLS_PROCTABLE()->TexCoord4hNV) +#define glTexCoord4hvNV (_GET_TLS_PROCTABLE()->TexCoord4hvNV) +#define glMultiTexCoord1hNV (_GET_TLS_PROCTABLE()->MultiTexCoord1hNV) +#define glMultiTexCoord1hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord1hvNV) +#define glMultiTexCoord2hNV (_GET_TLS_PROCTABLE()->MultiTexCoord2hNV) +#define glMultiTexCoord2hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord2hvNV) +#define glMultiTexCoord3hNV (_GET_TLS_PROCTABLE()->MultiTexCoord3hNV) +#define glMultiTexCoord3hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord3hvNV) +#define glMultiTexCoord4hNV (_GET_TLS_PROCTABLE()->MultiTexCoord4hNV) +#define glMultiTexCoord4hvNV (_GET_TLS_PROCTABLE()->MultiTexCoord4hvNV) +#define glFogCoordhNV (_GET_TLS_PROCTABLE()->FogCoordhNV) +#define glFogCoordhvNV (_GET_TLS_PROCTABLE()->FogCoordhvNV) +#define glSecondaryColor3hNV (_GET_TLS_PROCTABLE()->SecondaryColor3hNV) +#define glSecondaryColor3hvNV (_GET_TLS_PROCTABLE()->SecondaryColor3hvNV) +#define glVertexWeighthNV (_GET_TLS_PROCTABLE()->VertexWeighthNV) +#define glVertexWeighthvNV (_GET_TLS_PROCTABLE()->VertexWeighthvNV) +#define glVertexAttrib1hNV (_GET_TLS_PROCTABLE()->VertexAttrib1hNV) +#define glVertexAttrib1hvNV (_GET_TLS_PROCTABLE()->VertexAttrib1hvNV) +#define glVertexAttrib2hNV (_GET_TLS_PROCTABLE()->VertexAttrib2hNV) +#define glVertexAttrib2hvNV (_GET_TLS_PROCTABLE()->VertexAttrib2hvNV) +#define glVertexAttrib3hNV (_GET_TLS_PROCTABLE()->VertexAttrib3hNV) +#define glVertexAttrib3hvNV (_GET_TLS_PROCTABLE()->VertexAttrib3hvNV) +#define glVertexAttrib4hNV (_GET_TLS_PROCTABLE()->VertexAttrib4hNV) +#define glVertexAttrib4hvNV (_GET_TLS_PROCTABLE()->VertexAttrib4hvNV) +#define glVertexAttribs1hvNV (_GET_TLS_PROCTABLE()->VertexAttribs1hvNV) +#define glVertexAttribs2hvNV (_GET_TLS_PROCTABLE()->VertexAttribs2hvNV) +#define glVertexAttribs3hvNV (_GET_TLS_PROCTABLE()->VertexAttribs3hvNV) +#define glVertexAttribs4hvNV (_GET_TLS_PROCTABLE()->VertexAttribs4hvNV) +#define glPixelDataRangeNV (_GET_TLS_PROCTABLE()->PixelDataRangeNV) +#define glFlushPixelDataRangeNV (_GET_TLS_PROCTABLE()->FlushPixelDataRangeNV) +#define glPrimitiveRestartNV (_GET_TLS_PROCTABLE()->PrimitiveRestartNV) +#define glPrimitiveRestartIndexNV (_GET_TLS_PROCTABLE()->PrimitiveRestartIndexNV) +#define glMapObjectBufferATI (_GET_TLS_PROCTABLE()->MapObjectBufferATI) +#define glUnmapObjectBufferATI (_GET_TLS_PROCTABLE()->UnmapObjectBufferATI) +#define glStencilOpSeparateATI (_GET_TLS_PROCTABLE()->StencilOpSeparateATI) +#define glStencilFuncSeparateATI (_GET_TLS_PROCTABLE()->StencilFuncSeparateATI) +#define glVertexAttribArrayObjectATI (_GET_TLS_PROCTABLE()->VertexAttribArrayObjectATI) +#define glGetVertexAttribArrayObjectfvATI (_GET_TLS_PROCTABLE()->GetVertexAttribArrayObjectfvATI) +#define glGetVertexAttribArrayObjectivATI (_GET_TLS_PROCTABLE()->GetVertexAttribArrayObjectivATI) +#define glDepthBoundsEXT (_GET_TLS_PROCTABLE()->DepthBoundsEXT) +#define glBlendEquationSeparateEXT (_GET_TLS_PROCTABLE()->BlendEquationSeparateEXT) +#define glAddSwapHintRectWIN (_GET_TLS_PROCTABLE()->AddSwapHintRectWIN) +#ifdef _WIN32 +#define wglCreateBufferRegionARB (_GET_TLS_PROCTABLE()->CreateBufferRegionARB) +#define wglDeleteBufferRegionARB (_GET_TLS_PROCTABLE()->DeleteBufferRegionARB) +#define wglSaveBufferRegionARB (_GET_TLS_PROCTABLE()->SaveBufferRegionARB) +#define wglRestoreBufferRegionARB (_GET_TLS_PROCTABLE()->RestoreBufferRegionARB) +#define wglGetExtensionsStringARB (_GET_TLS_PROCTABLE()->GetExtensionsStringARB) +#define wglGetPixelFormatAttribivARB (_GET_TLS_PROCTABLE()->GetPixelFormatAttribivARB) +#define wglGetPixelFormatAttribfvARB (_GET_TLS_PROCTABLE()->GetPixelFormatAttribfvARB) +#define wglChoosePixelFormatARB (_GET_TLS_PROCTABLE()->ChoosePixelFormatARB) +#define wglMakeContextCurrentARB (_GET_TLS_PROCTABLE()->MakeContextCurrentARB) +#define wglGetCurrentReadDCARB (_GET_TLS_PROCTABLE()->GetCurrentReadDCARB) +#define wglCreatePbufferARB (_GET_TLS_PROCTABLE()->CreatePbufferARB) +#define wglGetPbufferDCARB (_GET_TLS_PROCTABLE()->GetPbufferDCARB) +#define wglReleasePbufferDCARB (_GET_TLS_PROCTABLE()->ReleasePbufferDCARB) +#define wglDestroyPbufferARB (_GET_TLS_PROCTABLE()->DestroyPbufferARB) +#define wglQueryPbufferARB (_GET_TLS_PROCTABLE()->QueryPbufferARB) +#define wglBindTexImageARB (_GET_TLS_PROCTABLE()->BindTexImageARB) +#define wglReleaseTexImageARB (_GET_TLS_PROCTABLE()->ReleaseTexImageARB) +#define wglSetPbufferAttribARB (_GET_TLS_PROCTABLE()->SetPbufferAttribARB) +#define wglCreateDisplayColorTableEXT (_GET_TLS_PROCTABLE()->CreateDisplayColorTableEXT) +#define wglLoadDisplayColorTableEXT (_GET_TLS_PROCTABLE()->LoadDisplayColorTableEXT) +#define wglBindDisplayColorTableEXT (_GET_TLS_PROCTABLE()->BindDisplayColorTableEXT) +#define wglDestroyDisplayColorTableEXT (_GET_TLS_PROCTABLE()->DestroyDisplayColorTableEXT) +#define wglGetExtensionsStringEXT (_GET_TLS_PROCTABLE()->GetExtensionsStringEXT) +#define wglMakeContextCurrentEXT (_GET_TLS_PROCTABLE()->MakeContextCurrentEXT) +#define wglGetCurrentReadDCEXT (_GET_TLS_PROCTABLE()->GetCurrentReadDCEXT) +#define wglCreatePbufferEXT (_GET_TLS_PROCTABLE()->CreatePbufferEXT) +#define wglGetPbufferDCEXT (_GET_TLS_PROCTABLE()->GetPbufferDCEXT) +#define wglReleasePbufferDCEXT (_GET_TLS_PROCTABLE()->ReleasePbufferDCEXT) +#define wglDestroyPbufferEXT (_GET_TLS_PROCTABLE()->DestroyPbufferEXT) +#define wglQueryPbufferEXT (_GET_TLS_PROCTABLE()->QueryPbufferEXT) +#define wglGetPixelFormatAttribivEXT (_GET_TLS_PROCTABLE()->GetPixelFormatAttribivEXT) +#define wglGetPixelFormatAttribfvEXT (_GET_TLS_PROCTABLE()->GetPixelFormatAttribfvEXT) +#define wglChoosePixelFormatEXT (_GET_TLS_PROCTABLE()->ChoosePixelFormatEXT) +#define wglSwapIntervalEXT (_GET_TLS_PROCTABLE()->SwapIntervalEXT) +#define wglGetSwapIntervalEXT (_GET_TLS_PROCTABLE()->GetSwapIntervalEXT) +#define wglAllocateMemoryNV (_GET_TLS_PROCTABLE()->AllocateMemoryNV) +#define wglFreeMemoryNV (_GET_TLS_PROCTABLE()->FreeMemoryNV) +#define wglGetSyncValuesOML (_GET_TLS_PROCTABLE()->GetSyncValuesOML) +#define wglGetMscRateOML (_GET_TLS_PROCTABLE()->GetMscRateOML) +#define wglSwapBuffersMscOML (_GET_TLS_PROCTABLE()->SwapBuffersMscOML) +#define wglSwapLayerBuffersMscOML (_GET_TLS_PROCTABLE()->SwapLayerBuffersMscOML) +#define wglWaitForMscOML (_GET_TLS_PROCTABLE()->WaitForMscOML) +#define wglWaitForSbcOML (_GET_TLS_PROCTABLE()->WaitForSbcOML) +#define wglGetDigitalVideoParametersI3D (_GET_TLS_PROCTABLE()->GetDigitalVideoParametersI3D) +#define wglSetDigitalVideoParametersI3D (_GET_TLS_PROCTABLE()->SetDigitalVideoParametersI3D) +#define wglGetGammaTableParametersI3D (_GET_TLS_PROCTABLE()->GetGammaTableParametersI3D) +#define wglSetGammaTableParametersI3D (_GET_TLS_PROCTABLE()->SetGammaTableParametersI3D) +#define wglGetGammaTableI3D (_GET_TLS_PROCTABLE()->GetGammaTableI3D) +#define wglSetGammaTableI3D (_GET_TLS_PROCTABLE()->SetGammaTableI3D) +#define wglEnableGenlockI3D (_GET_TLS_PROCTABLE()->EnableGenlockI3D) +#define wglDisableGenlockI3D (_GET_TLS_PROCTABLE()->DisableGenlockI3D) +#define wglIsEnabledGenlockI3D (_GET_TLS_PROCTABLE()->IsEnabledGenlockI3D) +#define wglGenlockSourceI3D (_GET_TLS_PROCTABLE()->GenlockSourceI3D) +#define wglGetGenlockSourceI3D (_GET_TLS_PROCTABLE()->GetGenlockSourceI3D) +#define wglGenlockSourceEdgeI3D (_GET_TLS_PROCTABLE()->GenlockSourceEdgeI3D) +#define wglGetGenlockSourceEdgeI3D (_GET_TLS_PROCTABLE()->GetGenlockSourceEdgeI3D) +#define wglGenlockSampleRateI3D (_GET_TLS_PROCTABLE()->GenlockSampleRateI3D) +#define wglGetGenlockSampleRateI3D (_GET_TLS_PROCTABLE()->GetGenlockSampleRateI3D) +#define wglGenlockSourceDelayI3D (_GET_TLS_PROCTABLE()->GenlockSourceDelayI3D) +#define wglGetGenlockSourceDelayI3D (_GET_TLS_PROCTABLE()->GetGenlockSourceDelayI3D) +#define wglQueryGenlockMaxSourceDelayI3D (_GET_TLS_PROCTABLE()->QueryGenlockMaxSourceDelayI3D) +#define wglCreateImageBufferI3D (_GET_TLS_PROCTABLE()->CreateImageBufferI3D) +#define wglDestroyImageBufferI3D (_GET_TLS_PROCTABLE()->DestroyImageBufferI3D) +#define wglAssociateImageBufferEventsI3D (_GET_TLS_PROCTABLE()->AssociateImageBufferEventsI3D) +#define wglReleaseImageBufferEventsI3D (_GET_TLS_PROCTABLE()->ReleaseImageBufferEventsI3D) +#define wglEnableFrameLockI3D (_GET_TLS_PROCTABLE()->EnableFrameLockI3D) +#define wglDisableFrameLockI3D (_GET_TLS_PROCTABLE()->DisableFrameLockI3D) +#define wglIsEnabledFrameLockI3D (_GET_TLS_PROCTABLE()->IsEnabledFrameLockI3D) +#define wglQueryFrameLockMasterI3D (_GET_TLS_PROCTABLE()->QueryFrameLockMasterI3D) +#define wglGetFrameUsageI3D (_GET_TLS_PROCTABLE()->GetFrameUsageI3D) +#define wglBeginFrameTrackingI3D (_GET_TLS_PROCTABLE()->BeginFrameTrackingI3D) +#define wglEndFrameTrackingI3D (_GET_TLS_PROCTABLE()->EndFrameTrackingI3D) +#define wglQueryFrameTrackingI3D (_GET_TLS_PROCTABLE()->QueryFrameTrackingI3D) +#endif /* _WIN32 */ + +#ifndef _APP_PROCTABLE + +/* + * Applications can replace the following function with its own function + * for accessing thread local proc/context dependent proc table. + * The following default function works for most applications which + * are using the same device for all their contexts - even if + * the contexts are on different threads. + */ + +static _inline _GLextensionProcs *_GET_TLS_PROCTABLE(void) + +{ + extern _GLextensionProcs _extensionProcs; + + return (&_extensionProcs); +} + +#else + +/* + * Application should replace this compiled function with + * an inlined function for maximum performance. + */ + +extern _GLextensionProcs *_GET_TLS_PROCTABLE(void); + +#endif + +/* + * Provide an initialization function for the application + * to initialize its own proc tables in case the application + * needs to use multiple proc tables. + */ + +static _inline void _InitExtensionProcs(_GLextensionProcs *appProcs) +{ + extern _GLextensionProcs _extensionProcs; + + *appProcs = _extensionProcs; +} + +#ifdef __cplusplus +} +#endif + + +#endif /* _GLPROCS_H_ */ diff --git a/Externals/GLew/glsmap.h b/Externals/GLew/glsmap.h index b97fa9acfd..9f0b5921b1 100644 --- a/Externals/GLew/glsmap.h +++ b/Externals/GLew/glsmap.h @@ -1,137 +1,137 @@ -#ifndef __glsmap_h__ -#define __glsmap_h__ - -/* Copyright (c) Mark J. Kilgard, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#if defined(_WIN32) - -/* Try hard to avoid including to avoid name space pollution, - but Win32's needs APIENTRY and WINGDIAPI defined properly. */ -# if 0 -# define WIN32_LEAN_AND_MEAN -# include -# else - /* XXX This is from Win32's */ -# ifndef APIENTRY -# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) -# define APIENTRY __stdcall -# else -# define APIENTRY -# endif -# endif -# ifndef CALLBACK - /* XXX This is from Win32's */ -# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) -# define CALLBACK __stdcall -# else -# define CALLBACK -# endif -# endif - /* XXX This is from Win32's and */ -# ifndef WINGDIAPI -# define WINGDIAPI __declspec(dllimport) -# endif - /* XXX This is from Win32's */ -# ifndef _WCHAR_T_DEFINED -typedef unsigned short wchar_t; -# define _WCHAR_T_DEFINED -# endif -# endif - -#pragma warning (disable:4244) /* Disable bogus conversion warnings. */ -#pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ - -#endif /* _WIN32 */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - SMAP_CLEAR_SMAP_TEXTURE = 0x1, - SMAP_GENERATE_VIEW_MIPMAPS = 0x2, - SMAP_GENERATE_SMAP_MIPMAPS = 0x4, - SMAP_GENERATE_MIPMAPS = 0x6 /* both of above */ -} SphereMapFlags; - -/* Cube view enumerants. */ -enum { - SMAP_FRONT = 0, - SMAP_TOP = 1, - SMAP_BOTTOM = 2, - SMAP_LEFT = 3, - SMAP_RIGHT = 4, - SMAP_BACK = 5 -}; - -typedef struct _SphereMap SphereMap; - -extern SphereMap *smapCreateSphereMap(SphereMap *shareSmap); -extern void smapDestroySphereMap(SphereMap *smap); - -extern void smapConfigureSphereMapMesh(SphereMap *smap, int steps, int rings, int edgeExtend); - -extern void smapSetSphereMapTexObj(SphereMap *smap, GLuint texobj); -extern void smapSetViewTexObj(SphereMap *smap, GLuint texobj); -extern void smapSetViewTexObjs(SphereMap *smap, GLuint texobjs[6]); -extern void smapGetSphereMapTexObj(SphereMap *smap, GLuint *texobj); -extern void smapGetViewTexObj(SphereMap *smap, GLuint *texobj); -extern void smapGetViewTexObjs(SphereMap *smap, GLuint texobjs[6]); - -extern void smapSetFlags(SphereMap *smap, SphereMapFlags flags); -extern void smapGetFlags(SphereMap *smap, SphereMapFlags *flags); - -extern void smapSetViewOrigin(SphereMap *smap, GLint x, GLint y); -extern void smapSetSphereMapOrigin(SphereMap *smap, GLint x, GLint y); -extern void smapGetViewOrigin(SphereMap *smap, GLint *x, GLint *y); -extern void smapGetSphereMapOrigin(SphereMap *smap, GLint *x, GLint *y); - -extern void smapSetEye(SphereMap *smap, GLfloat eyex, GLfloat eyey, GLfloat eyez); -extern void smapSetEyeVector(SphereMap *smap, GLfloat *eye); -extern void smapSetUp(SphereMap *smap, GLfloat upx, GLfloat upy, GLfloat upz); -extern void smapSetUpVector(SphereMap *smap, GLfloat *up); -extern void smapSetObject(SphereMap *smap, GLfloat objx, GLfloat objy, GLfloat objz); -extern void smapSetObjectVector(SphereMap *smap, GLfloat *obj); -extern void smapGetEye(SphereMap *smap, GLfloat *eyex, GLfloat *eyey, GLfloat *eyez); -extern void smapGetEyeVector(SphereMap *smap, GLfloat *eye); -extern void smapGetUp(SphereMap *smap, GLfloat *upx, GLfloat *upy, GLfloat *upz); -extern void smapGetUpVector(SphereMap *smap, GLfloat *up); -extern void smapGetObject(SphereMap *smap, GLfloat *objx, GLfloat *objy, GLfloat *objz); -extern void smapGetObjectVector(SphereMap *smap, GLfloat *obj); - -extern void smapSetNearFar(SphereMap *smap, GLfloat viewNear, GLfloat viewFar); -extern void smapGetNearFar(SphereMap *smap, GLfloat *viewNear, GLfloat *viewFar); - -extern void smapSetSphereMapTexDim(SphereMap *smap, GLsizei texdim); -extern void smapSetViewTexDim(SphereMap *smap, GLsizei texdim); -extern void smapGetSphereMapTexDim(SphereMap *smap, GLsizei *texdim); -extern void smapGetViewTexDim(SphereMap *smap, GLsizei *texdim); - -extern void smapSetContextData(SphereMap *smap, void *context); -extern void smapGetContextData(SphereMap *smap, void **context); - -extern void smapSetPositionLightsFunc(SphereMap *smap, void (*positionLights)(int view, void *context)); -extern void smapSetDrawViewFunc(SphereMap *smap, void (*drawView)(int view, void *context)); -extern void smapGetPositionLightsFunc(SphereMap *smap, void (**positionLights)(int view, void *context)); -extern void smapGetDrawViewFunc(SphereMap *smap, void (**drawView)(int view, void *context)); - -extern void smapGenViewTex(SphereMap *smap, int view); -extern void smapGenViewTexs(SphereMap *smap); -extern void smapGenSphereMapFromViewTexs(SphereMap *smap); -extern void smapGenSphereMap(SphereMap *smap); -extern void smapGenSphereMapWithOneViewTex(SphereMap *smap); - -extern int smapRvecToSt(float rvec[3], float st[2]); -extern void smapStToRvec(float *st, float *rvec); - -#ifdef __cplusplus -} - -#endif -#endif /* __glsmap_h__ */ +#ifndef __glsmap_h__ +#define __glsmap_h__ + +/* Copyright (c) Mark J. Kilgard, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#if defined(_WIN32) + +/* Try hard to avoid including to avoid name space pollution, + but Win32's needs APIENTRY and WINGDIAPI defined properly. */ +# if 0 +# define WIN32_LEAN_AND_MEAN +# include +# else + /* XXX This is from Win32's */ +# ifndef APIENTRY +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif +# endif +# ifndef CALLBACK + /* XXX This is from Win32's */ +# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) +# define CALLBACK __stdcall +# else +# define CALLBACK +# endif +# endif + /* XXX This is from Win32's and */ +# ifndef WINGDIAPI +# define WINGDIAPI __declspec(dllimport) +# endif + /* XXX This is from Win32's */ +# ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +# define _WCHAR_T_DEFINED +# endif +# endif + +#pragma warning (disable:4244) /* Disable bogus conversion warnings. */ +#pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ + +#endif /* _WIN32 */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SMAP_CLEAR_SMAP_TEXTURE = 0x1, + SMAP_GENERATE_VIEW_MIPMAPS = 0x2, + SMAP_GENERATE_SMAP_MIPMAPS = 0x4, + SMAP_GENERATE_MIPMAPS = 0x6 /* both of above */ +} SphereMapFlags; + +/* Cube view enumerants. */ +enum { + SMAP_FRONT = 0, + SMAP_TOP = 1, + SMAP_BOTTOM = 2, + SMAP_LEFT = 3, + SMAP_RIGHT = 4, + SMAP_BACK = 5 +}; + +typedef struct _SphereMap SphereMap; + +extern SphereMap *smapCreateSphereMap(SphereMap *shareSmap); +extern void smapDestroySphereMap(SphereMap *smap); + +extern void smapConfigureSphereMapMesh(SphereMap *smap, int steps, int rings, int edgeExtend); + +extern void smapSetSphereMapTexObj(SphereMap *smap, GLuint texobj); +extern void smapSetViewTexObj(SphereMap *smap, GLuint texobj); +extern void smapSetViewTexObjs(SphereMap *smap, GLuint texobjs[6]); +extern void smapGetSphereMapTexObj(SphereMap *smap, GLuint *texobj); +extern void smapGetViewTexObj(SphereMap *smap, GLuint *texobj); +extern void smapGetViewTexObjs(SphereMap *smap, GLuint texobjs[6]); + +extern void smapSetFlags(SphereMap *smap, SphereMapFlags flags); +extern void smapGetFlags(SphereMap *smap, SphereMapFlags *flags); + +extern void smapSetViewOrigin(SphereMap *smap, GLint x, GLint y); +extern void smapSetSphereMapOrigin(SphereMap *smap, GLint x, GLint y); +extern void smapGetViewOrigin(SphereMap *smap, GLint *x, GLint *y); +extern void smapGetSphereMapOrigin(SphereMap *smap, GLint *x, GLint *y); + +extern void smapSetEye(SphereMap *smap, GLfloat eyex, GLfloat eyey, GLfloat eyez); +extern void smapSetEyeVector(SphereMap *smap, GLfloat *eye); +extern void smapSetUp(SphereMap *smap, GLfloat upx, GLfloat upy, GLfloat upz); +extern void smapSetUpVector(SphereMap *smap, GLfloat *up); +extern void smapSetObject(SphereMap *smap, GLfloat objx, GLfloat objy, GLfloat objz); +extern void smapSetObjectVector(SphereMap *smap, GLfloat *obj); +extern void smapGetEye(SphereMap *smap, GLfloat *eyex, GLfloat *eyey, GLfloat *eyez); +extern void smapGetEyeVector(SphereMap *smap, GLfloat *eye); +extern void smapGetUp(SphereMap *smap, GLfloat *upx, GLfloat *upy, GLfloat *upz); +extern void smapGetUpVector(SphereMap *smap, GLfloat *up); +extern void smapGetObject(SphereMap *smap, GLfloat *objx, GLfloat *objy, GLfloat *objz); +extern void smapGetObjectVector(SphereMap *smap, GLfloat *obj); + +extern void smapSetNearFar(SphereMap *smap, GLfloat viewNear, GLfloat viewFar); +extern void smapGetNearFar(SphereMap *smap, GLfloat *viewNear, GLfloat *viewFar); + +extern void smapSetSphereMapTexDim(SphereMap *smap, GLsizei texdim); +extern void smapSetViewTexDim(SphereMap *smap, GLsizei texdim); +extern void smapGetSphereMapTexDim(SphereMap *smap, GLsizei *texdim); +extern void smapGetViewTexDim(SphereMap *smap, GLsizei *texdim); + +extern void smapSetContextData(SphereMap *smap, void *context); +extern void smapGetContextData(SphereMap *smap, void **context); + +extern void smapSetPositionLightsFunc(SphereMap *smap, void (*positionLights)(int view, void *context)); +extern void smapSetDrawViewFunc(SphereMap *smap, void (*drawView)(int view, void *context)); +extern void smapGetPositionLightsFunc(SphereMap *smap, void (**positionLights)(int view, void *context)); +extern void smapGetDrawViewFunc(SphereMap *smap, void (**drawView)(int view, void *context)); + +extern void smapGenViewTex(SphereMap *smap, int view); +extern void smapGenViewTexs(SphereMap *smap); +extern void smapGenSphereMapFromViewTexs(SphereMap *smap); +extern void smapGenSphereMap(SphereMap *smap); +extern void smapGenSphereMapWithOneViewTex(SphereMap *smap); + +extern int smapRvecToSt(float rvec[3], float st[2]); +extern void smapStToRvec(float *st, float *rvec); + +#ifdef __cplusplus +} + +#endif +#endif /* __glsmap_h__ */ diff --git a/Externals/GLew/glx.h b/Externals/GLew/glx.h index 59836ac764..f19a529277 100644 --- a/Externals/GLew/glx.h +++ b/Externals/GLew/glx.h @@ -1,243 +1,243 @@ -#ifndef __glx_h__ -#define __glx_h__ - -/* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $Header: /teleimm/telev/inc/GL/glx.h,v 1.1 2006/01/05 03:28:50 zerocool Exp $ -*/ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * GLX resources. - */ -typedef XID GLXContextID; -typedef XID GLXPixmap; -typedef XID GLXDrawable; -typedef XID GLXPbuffer; -typedef XID GLXWindow; -typedef XID GLXFBConfigID; - -/* - * GLXContext is a pointer to opaque data. - */ -typedef struct __GLXcontextRec *GLXContext; - -/* - * GLXFBConfig is a pointer to opaque data. - */ -typedef struct __GLXFBConfigRec *GLXFBConfig; -typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; - - -/**********************************************************************/ - -/* - * GLX 1.0 functions. - */ -extern XVisualInfo* glXChooseVisual(Display *dpy, int screen, - int *attrib_list); - -extern void glXCopyContext(Display *dpy, GLXContext src, - GLXContext dst, unsigned int mask); - -extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, - GLXContext share_list, Bool direct); - -extern GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, - Pixmap pixmap); - -extern void glXDestroyContext(Display *dpy, GLXContext ctx); - -extern void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix); - -extern int glXGetConfig(Display *dpy, XVisualInfo *vis, - int attrib, int *value); - -extern GLXContext glXGetCurrentContext(void); - -extern GLXDrawable glXGetCurrentDrawable(void); - -extern Bool glXIsDirect(Display *dpy, GLXContext ctx); - -extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, - GLXContext ctx); - -extern Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base); - -extern Bool glXQueryVersion(Display *dpy, int *major, int *minor); - -extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable); - -extern void glXUseXFont(Font font, int first, int count, int list_base); - -extern void glXWaitGL(void); - -extern void glXWaitX(void); - - -/* - * GLX 1.1 functions. - */ -extern const char *glXGetClientString(Display *dpy, int name); - -extern const char *glXQueryServerString(Display *dpy, int screen, int name); - -extern const char *glXQueryExtensionsString(Display *dpy, int screen); - - -/* - * GLX 1.2 functions. - */ -extern Display *glXGetCurrentDisplay(void); - - -/* - * GLX 1.3 functions. - */ -extern GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, - const int *attrib_list, int *nelements); - -extern GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, - int render_type, GLXContext share_list, - Bool direct); - -extern GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, - const int *attrib_list); - -extern GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, - Pixmap pixmap, const int *attrib_list); - -extern GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, - Window win, const int *attrib_list); - -extern void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf); - -extern void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap); - -extern void glXDestroyWindow(Display *dpy, GLXWindow win); - -extern GLXDrawable glXGetCurrentReadDrawable(void); - -extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, - int attribute, int *value); - -extern GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements); - -extern void glXGetSelectedEvent(Display *dpy, GLXDrawable draw, - unsigned long *event_mask); - -extern XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config); - -extern Bool glXMakeContextCurrent(Display *display, GLXDrawable draw, - GLXDrawable read, GLXContext ctx); - -extern int glXQueryContext(Display *dpy, GLXContext ctx, - int attribute, int *value); - -extern void glXQueryDrawable(Display *dpy, GLXDrawable draw, - int attribute, unsigned int *value); - -extern void glXSelectEvent(Display *dpy, GLXDrawable draw, - unsigned long event_mask); - - -/**********************************************************************/ - -/* - * ARB_get_proc_address - */ -extern void (*glXGetProcAddressARB(const GLubyte *procName))(void); - -/* - * EXT_import_context - */ -extern void glXFreeContextEXT(Display *dpy, GLXContext ctx); - -extern GLXContextID glXGetContextIDEXT(const GLXContext ctx); - -extern GLXDrawable glXGetCurrentDrawableEXT(void); - -extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); - -extern int glXQueryContextInfoEXT(Display *dpy, GLXContext ctx, - int attribute, int *value); - -/* - * SGI_video_sync - */ -extern int glXGetVideoSyncSGI(unsigned int *count); - -extern int glXWaitVideoSyncSGI(int divisor, int remainder, - unsigned int *count); - -extern int glXGetRefreshRateSGI(unsigned int *rate); - -/* - * SGIX_swap_group -*/ -extern void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, - GLXDrawable member); - -/* - * SGIX_swap_barrier -*/ -extern void glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, - int barrier); - -extern Bool glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max); - -/**********************************************************************/ - -/*** Should these go here, or in another header? */ -/* - * GLX Events - */ -typedef struct { - int event_type; /* GLX_DAMAGED or GLX_SAVED */ - int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came for SendEvent request */ - Display *display; /* display the event was read from */ - GLXDrawable drawable; /* XID of Drawable */ - unsigned int buffer_mask; /* mask indicating which buffers are affected */ - unsigned int aux_buffer; /* which aux buffer was affected */ - int x, y; - int width, height; - int count; /* if nonzero, at least this many more */ -} GLXPbufferClobberEvent; - -typedef union __GLXEvent { - GLXPbufferClobberEvent glxpbufferclobber; - long pad[24]; -} GLXEvent; - -#ifdef __cplusplus -} -#endif - -#endif /* !__glx_h__ */ +#ifndef __glx_h__ +#define __glx_h__ + +/* +** The contents of this file are subject to the GLX Public License Version 1.0 +** (the "License"). You may not use this file except in compliance with the +** License. You may obtain a copy of the License at Silicon Graphics, Inc., +** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +** or at http://www.sgi.com/software/opensource/glx/license.html. +** +** Software distributed under the License is distributed on an "AS IS" +** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY +** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR +** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific +** language governing rights and limitations under the License. +** +** The Original Software is GLX version 1.2 source code, released February, +** 1999. The developer of the Original Software is Silicon Graphics, Inc. +** Those portions of the Subject Software created by Silicon Graphics, Inc. +** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** +** $Header: /teleimm/telev/inc/GL/glx.h,v 1.1 2006/01/05 03:28:50 zerocool Exp $ +*/ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLX resources. + */ +typedef XID GLXContextID; +typedef XID GLXPixmap; +typedef XID GLXDrawable; +typedef XID GLXPbuffer; +typedef XID GLXWindow; +typedef XID GLXFBConfigID; + +/* + * GLXContext is a pointer to opaque data. + */ +typedef struct __GLXcontextRec *GLXContext; + +/* + * GLXFBConfig is a pointer to opaque data. + */ +typedef struct __GLXFBConfigRec *GLXFBConfig; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; + + +/**********************************************************************/ + +/* + * GLX 1.0 functions. + */ +extern XVisualInfo* glXChooseVisual(Display *dpy, int screen, + int *attrib_list); + +extern void glXCopyContext(Display *dpy, GLXContext src, + GLXContext dst, unsigned int mask); + +extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, + GLXContext share_list, Bool direct); + +extern GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, + Pixmap pixmap); + +extern void glXDestroyContext(Display *dpy, GLXContext ctx); + +extern void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix); + +extern int glXGetConfig(Display *dpy, XVisualInfo *vis, + int attrib, int *value); + +extern GLXContext glXGetCurrentContext(void); + +extern GLXDrawable glXGetCurrentDrawable(void); + +extern Bool glXIsDirect(Display *dpy, GLXContext ctx); + +extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, + GLXContext ctx); + +extern Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base); + +extern Bool glXQueryVersion(Display *dpy, int *major, int *minor); + +extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable); + +extern void glXUseXFont(Font font, int first, int count, int list_base); + +extern void glXWaitGL(void); + +extern void glXWaitX(void); + + +/* + * GLX 1.1 functions. + */ +extern const char *glXGetClientString(Display *dpy, int name); + +extern const char *glXQueryServerString(Display *dpy, int screen, int name); + +extern const char *glXQueryExtensionsString(Display *dpy, int screen); + + +/* + * GLX 1.2 functions. + */ +extern Display *glXGetCurrentDisplay(void); + + +/* + * GLX 1.3 functions. + */ +extern GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, + const int *attrib_list, int *nelements); + +extern GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, + int render_type, GLXContext share_list, + Bool direct); + +extern GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, + const int *attrib_list); + +extern GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, + Pixmap pixmap, const int *attrib_list); + +extern GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, + Window win, const int *attrib_list); + +extern void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf); + +extern void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap); + +extern void glXDestroyWindow(Display *dpy, GLXWindow win); + +extern GLXDrawable glXGetCurrentReadDrawable(void); + +extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, + int attribute, int *value); + +extern GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements); + +extern void glXGetSelectedEvent(Display *dpy, GLXDrawable draw, + unsigned long *event_mask); + +extern XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config); + +extern Bool glXMakeContextCurrent(Display *display, GLXDrawable draw, + GLXDrawable read, GLXContext ctx); + +extern int glXQueryContext(Display *dpy, GLXContext ctx, + int attribute, int *value); + +extern void glXQueryDrawable(Display *dpy, GLXDrawable draw, + int attribute, unsigned int *value); + +extern void glXSelectEvent(Display *dpy, GLXDrawable draw, + unsigned long event_mask); + + +/**********************************************************************/ + +/* + * ARB_get_proc_address + */ +extern void (*glXGetProcAddressARB(const GLubyte *procName))(void); + +/* + * EXT_import_context + */ +extern void glXFreeContextEXT(Display *dpy, GLXContext ctx); + +extern GLXContextID glXGetContextIDEXT(const GLXContext ctx); + +extern GLXDrawable glXGetCurrentDrawableEXT(void); + +extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); + +extern int glXQueryContextInfoEXT(Display *dpy, GLXContext ctx, + int attribute, int *value); + +/* + * SGI_video_sync + */ +extern int glXGetVideoSyncSGI(unsigned int *count); + +extern int glXWaitVideoSyncSGI(int divisor, int remainder, + unsigned int *count); + +extern int glXGetRefreshRateSGI(unsigned int *rate); + +/* + * SGIX_swap_group +*/ +extern void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, + GLXDrawable member); + +/* + * SGIX_swap_barrier +*/ +extern void glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, + int barrier); + +extern Bool glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max); + +/**********************************************************************/ + +/*** Should these go here, or in another header? */ +/* + * GLX Events + */ +typedef struct { + int event_type; /* GLX_DAMAGED or GLX_SAVED */ + int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* XID of Drawable */ + unsigned int buffer_mask; /* mask indicating which buffers are affected */ + unsigned int aux_buffer; /* which aux buffer was affected */ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXPbufferClobberEvent; + +typedef union __GLXEvent { + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; +} GLXEvent; + +#ifdef __cplusplus +} +#endif + +#endif /* !__glx_h__ */ diff --git a/Externals/GLew/glxext.h b/Externals/GLew/glxext.h index 3c63175f4a..1e58c95a72 100644 --- a/Externals/GLew/glxext.h +++ b/Externals/GLew/glxext.h @@ -1,615 +1,615 @@ -#ifndef __glxext_h_ -#define __glxext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: This software was created using the -** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has -** not been independently verified as being compliant with the OpenGL(R) -** version 1.2.1 Specification. -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#else -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif - - -/*************************************************************/ - -/* Header file version number, required by OpenGL ABI for Linux */ -#define GLX_GLXEXT_VERSION 2 - -#ifndef GLX_VERSION_1_3 -#define GLX_WINDOW_BIT 0x00000001 -#define GLX_PIXMAP_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 -#define GLX_RGBA_BIT 0x00000001 -#define GLX_COLOR_INDEX_BIT 0x00000002 -#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 -#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 -#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 -#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 -#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 -#define GLX_AUX_BUFFERS_BIT 0x00000010 -#define GLX_DEPTH_BUFFER_BIT 0x00000020 -#define GLX_STENCIL_BUFFER_BIT 0x00000040 -#define GLX_ACCUM_BUFFER_BIT 0x00000080 -#define GLX_CONFIG_CAVEAT 0x20 -#define GLX_X_VISUAL_TYPE 0x22 -#define GLX_TRANSPARENT_TYPE 0x23 -#define GLX_TRANSPARENT_INDEX_VALUE 0x24 -#define GLX_TRANSPARENT_RED_VALUE 0x25 -#define GLX_TRANSPARENT_GREEN_VALUE 0x26 -#define GLX_TRANSPARENT_BLUE_VALUE 0x27 -#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 -#define GLX_DONT_CARE 0xFFFFFFFF -#define GLX_NONE 0x8000 -#define GLX_SLOW_CONFIG 0x8001 -#define GLX_TRUE_COLOR 0x8002 -#define GLX_DIRECT_COLOR 0x8003 -#define GLX_PSEUDO_COLOR 0x8004 -#define GLX_STATIC_COLOR 0x8005 -#define GLX_GRAY_SCALE 0x8006 -#define GLX_STATIC_GRAY 0x8007 -#define GLX_TRANSPARENT_RGB 0x8008 -#define GLX_TRANSPARENT_INDEX 0x8009 -#define GLX_VISUAL_ID 0x800B -#define GLX_SCREEN 0x800C -#define GLX_NON_CONFORMANT_CONFIG 0x800D -#define GLX_DRAWABLE_TYPE 0x8010 -#define GLX_RENDER_TYPE 0x8011 -#define GLX_X_RENDERABLE 0x8012 -#define GLX_FBCONFIG_ID 0x8013 -#define GLX_RGBA_TYPE 0x8014 -#define GLX_COLOR_INDEX_TYPE 0x8015 -#define GLX_MAX_PBUFFER_WIDTH 0x8016 -#define GLX_MAX_PBUFFER_HEIGHT 0x8017 -#define GLX_MAX_PBUFFER_PIXELS 0x8018 -#define GLX_PRESERVED_CONTENTS 0x801B -#define GLX_LARGEST_PBUFFER 0x801C -#define GLX_WIDTH 0x801D -#define GLX_HEIGHT 0x801E -#define GLX_EVENT_MASK 0x801F -#define GLX_DAMAGED 0x8020 -#define GLX_SAVED 0x8021 -#define GLX_WINDOW 0x8022 -#define GLX_PBUFFER 0x8023 -#define GLX_PBUFFER_HEIGHT 0x8040 -#define GLX_PBUFFER_WIDTH 0x8041 -#endif - -#ifndef GLX_EXT_visual_info -#define GLX_X_VISUAL_TYPE_EXT 0x22 -#define GLX_TRANSPARENT_TYPE_EXT 0x23 -#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 -#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 -#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 -#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 -#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 -#define GLX_NONE_EXT 0x8000 -#define GLX_TRUE_COLOR_EXT 0x8002 -#define GLX_DIRECT_COLOR_EXT 0x8003 -#define GLX_PSEUDO_COLOR_EXT 0x8004 -#define GLX_STATIC_COLOR_EXT 0x8005 -#define GLX_GRAY_SCALE_EXT 0x8006 -#define GLX_STATIC_GRAY_EXT 0x8007 -#define GLX_TRANSPARENT_RGB_EXT 0x8008 -#define GLX_TRANSPARENT_INDEX_EXT 0x8009 -#endif - -#ifndef GLX_SGI_swap_control -#endif - -#ifndef GLX_SGI_video_sync -#endif - -#ifndef GLX_SGI_make_current_read -#endif - -#ifndef GLX_SGIX_video_source -#endif - -#ifndef GLX_EXT_visual_rating -#define GLX_VISUAL_CAVEAT_EXT 0x20 -#define GLX_SLOW_VISUAL_EXT 0x8001 -#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D -/* reuse GLX_NONE_EXT */ -#endif - -#ifndef GLX_EXT_import_context -#define GLX_SHARE_CONTEXT_EXT 0x800A -#define GLX_VISUAL_ID_EXT 0x800B -#define GLX_SCREEN_EXT 0x800C -#endif - -#ifndef GLX_SGIX_fbconfig -#ifndef GLX_WINDOW_BIT_SGIX -#define GLX_WINDOW_BIT_SGIX 0x00000001 -#endif -#ifndef GLX_PIXMAP_BIT_SGIX -#define GLX_PIXMAP_BIT_SGIX 0x00000002 -#endif -#ifndef GLX_RGBA_BIT_SGIX -#define GLX_RGBA_BIT_SGIX 0x00000001 -#endif -#ifndef GLX_COLOR_INDEX_BIT_SGIX -#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 -#endif -#ifndef GLX_DRAWABLE_TYPE_SGIX -#define GLX_DRAWABLE_TYPE_SGIX 0x8010 -#endif -#ifndef GLX_RENDER_TYPE_SGIX -#define GLX_RENDER_TYPE_SGIX 0x8011 -#endif -#ifndef GLX_X_RENDERABLE_SGIX -#define GLX_X_RENDERABLE_SGIX 0x8012 -#endif -#ifndef GLX_FBCONFIG_ID_SGIX -#define GLX_FBCONFIG_ID_SGIX 0x8013 -#endif -#ifndef GLX_RGBA_TYPE_SGIX -#define GLX_RGBA_TYPE_SGIX 0x8014 -#endif -#ifndef GLX_COLOR_INDEX_TYPE_SGIX -#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 -#endif -/* reuse GLX_SCREEN_EXT */ -#endif - -#ifndef GLX_SGIX_pbuffer -#ifndef GLX_PBUFFER_BIT_SGIX -#define GLX_PBUFFER_BIT_SGIX 0x00000004 -#endif -#ifndef GLX_BUFFER_CLOBBER_MASK_SGIX -#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 -#endif -#ifndef GLX_FRONT_LEFT_BUFFER_BIT_SGIX -#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 -#endif -#ifndef GLX_FRONT_RIGHT_BUFFER_BIT_SGIX -#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 -#endif -#ifndef GLX_BACK_LEFT_BUFFER_BIT_SGIX -#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 -#endif -#ifndef GLX_BACK_RIGHT_BUFFER_BIT_SGIX -#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 -#endif -#ifndef GLX_AUX_BUFFERS_BIT_SGIX -#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 -#endif -#ifndef GLX_DEPTH_BUFFER_BIT_SGIX -#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 -#endif -#ifndef GLX_STENCIL_BUFFER_BIT_SGIX -#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 -#endif -#ifndef GLX_ACCUM_BUFFER_BIT_SGIX -#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 -#endif -#ifndef GLX_SAMPLE_BUFFERS_BIT_SGIX -#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 -#endif -#ifndef GLX_MAX_PBUFFER_WIDTH_SGIX -#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 -#endif -#ifndef GLX_MAX_PBUFFER_HEIGHT_SGIX -#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 -#endif -#ifndef GLX_MAX_PBUFFER_PIXELS_SGIX -#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 -#endif -#ifndef GLX_OPTIMAL_PBUFFER_WIDTH_SGIX -#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 -#endif -#ifndef GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX -#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A -#endif -#ifndef GLX_PRESERVED_CONTENTS_SGIX -#define GLX_PRESERVED_CONTENTS_SGIX 0x801B -#endif -#ifndef GLX_LARGEST_PBUFFER_SGIX -#define GLX_LARGEST_PBUFFER_SGIX 0x801C -#endif -#ifndef GLX_WIDTH_SGIX -#define GLX_WIDTH_SGIX 0x801D -#endif -#ifndef GLX_HEIGHT_SGIX -#define GLX_HEIGHT_SGIX 0x801E -#endif -#ifndef GLX_EVENT_MASK_SGIX -#define GLX_EVENT_MASK_SGIX 0x801F -#endif -#ifndef GLX_DAMAGED_SGIX -#define GLX_DAMAGED_SGIX 0x8020 -#endif -#ifndef GLX_SAVED_SGIX -#define GLX_SAVED_SGIX 0x8021 -#endif -#ifndef GLX_WINDOW_SGIX -#define GLX_WINDOW_SGIX 0x8022 -#endif -#ifndef GLX_PBUFFER_SGIX -#define GLX_PBUFFER_SGIX 0x8023 -#endif -#endif - -#ifndef GLX_SGI_cushion -#endif - -#ifndef GLX_SGIX_video_resize -#define GLX_SYNC_FRAME_SGIX 0x00000000 -#define GLX_SYNC_SWAP_SGIX 0x00000001 -#endif - -#ifndef GLX_SGIX_dmbuffer -#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 -#endif - -#ifndef GLX_SGIX_swap_group -#endif - -#ifndef GLX_SGIX_swap_barrier -#endif - -#ifndef GLX_SGIS_blended_overlay -#define GLX_BLENDED_RGBA_SGIS 0x8025 -#endif - -#ifndef GLX_SGIS_shared_multisample -#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 -#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 -#endif - -#ifndef GLX_SUN_get_transparent_index -#endif - -#ifndef GLX_3DFX_multisample -#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 -#define GLX_SAMPLES_3DFX 0x8051 -#endif - -#ifndef GLX_MESA_copy_sub_buffer -#endif - -#ifndef GLX_MESA_pixmap_colormap -#endif - -#ifndef GLX_MESA_release_buffers -#endif - -#ifndef GLX_MESA_set_3dfx_mode -#define GLX_3DFX_WINDOW_MODE_MESA 0x1 -#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 -#endif - - -/*************************************************************/ - -#ifndef GLX_ARB_get_proc_address -typedef void (*__GLXextFuncPtr)(); -#endif - -#ifndef GLX_SGIX_video_source -typedef XID GLXVideoSourceSGIX; -#endif - -#ifndef GLX_SGIX_fbconfig -typedef XID GLXFBConfigIDSGIX; -typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; -#endif - -#ifndef GLX_SGIX_pbuffer -typedef XID GLXPbufferSGIX; -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came for SendEvent request */ - Display *display; /* display the event was read from */ - GLXDrawable drawable; /* i.d. of Drawable */ - int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ - int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ - unsigned int mask; /* mask indicating which buffers are affected*/ - int x, y; - int width, height; - int count; /* if nonzero, at least this many more */ -} GLXBufferClobberEventSGIX; -#endif - -#ifndef GLX_VERSION_1_3 -#define GLX_VERSION_1_3 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); -extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); -extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); -extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); -extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); -extern void glXDestroyWindow (Display *, GLXWindow); -extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); -extern void glXDestroyPixmap (Display *, GLXPixmap); -extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); -extern void glXDestroyPbuffer (Display *, GLXPbuffer); -extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); -extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); -extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); -extern GLXDrawable glXGetCurrentReadDrawable (void); -extern Display * glXGetCurrentDisplay (void); -extern int glXQueryContext (Display *, GLXContext, int, int *); -extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); -extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); -typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); -typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); -typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); -typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); -typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); -typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); -typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); -typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); -typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); -typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); -typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); -typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); -typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); -typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); -typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); -typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); -#endif - -#ifndef GLX_ARB_get_proc_address -#define GLX_ARB_get_proc_address 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); -#endif - -#ifndef GLX_SGIS_multisample -#define GLX_SGIS_multisample 1 -#endif - -#ifndef GLX_EXT_visual_info -#define GLX_EXT_visual_info 1 -#endif - -#ifndef GLX_NV_vertex_array_range -#define GLX_NV_vertex_array_range -#ifdef GLX_GLXEXT_PROTOTYPES -extern void *glXAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); -extern void glXFreeMemoryNV (void *); -#endif -typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei, GLfloat, GLfloat, GLfloat); -typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *); -#endif - -#ifndef GLX_SGI_swap_control -#define GLX_SGI_swap_control 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern int glXSwapIntervalSGI (int); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); -#endif - -#ifndef GLX_SGI_video_sync -#define GLX_SGI_video_sync 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern int glXGetVideoSyncSGI (unsigned int *); -extern int glXWaitVideoSyncSGI (int, int, unsigned int *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); -typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); -#endif - -#ifndef GLX_SGI_make_current_read -#define GLX_SGI_make_current_read 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); -extern GLXDrawable glXGetCurrentReadDrawableSGI (void); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); -#endif - -#ifdef _VL_H -#ifndef GLX_SGIX_video_source -#define GLX_SGIX_video_source 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); -extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); -typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); -#endif - -#endif /* _VL_H */ -#ifndef GLX_EXT_visual_rating -#define GLX_EXT_visual_rating 1 -#endif - -#ifndef GLX_EXT_import_context -#define GLX_EXT_import_context 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern Display * glXGetCurrentDisplayEXT (void); -extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); -extern GLXContextID glXGetContextIDEXT (GLXContext); -extern GLXContext glXImportContextEXT (Display *, GLXContextID); -extern void glXFreeContextEXT (Display *, GLXContext); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); -typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); -typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (GLXContext context); -typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); -typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); -#endif - -#ifndef GLX_SGIX_fbconfig -#define GLX_SGIX_fbconfig 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); -extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); -extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); -extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); -extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); -extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); -typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); -typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); -typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); -typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); -typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); -#endif - -#ifndef GLX_SGIX_pbuffer -#define GLX_SGIX_pbuffer 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); -extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); -extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); -extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); -extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); -typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); -typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); -typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); -typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); -#endif - -#ifndef GLX_NV_float_buffer -#define GLX_NV_float_buffer 1 -#endif - -#ifndef GLX_SGI_cushion -#define GLX_SGI_cushion 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern void glXCushionSGI (Display *, Window, float); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); -#endif - -#ifndef GLX_SGIX_video_resize -#define GLX_SGIX_video_resize 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); -extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); -extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); -extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); -extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); -typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); -typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); -typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); -typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); -#endif - -#ifdef _DM_BUFFER_H_ -#ifndef GLX_SGIX_dmbuffer -#define GLX_SGIX_dmbuffer 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); -#endif - -#endif /* _DM_BUFFER_H_ */ -#ifndef GLX_SGIX_swap_group -#define GLX_SGIX_swap_group 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); -#endif - -#ifndef GLX_SGIX_swap_barrier -#define GLX_SGIX_swap_barrier 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); -extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); -typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); -#endif - -#ifndef GLX_SUN_get_transparent_index -#define GLX_SUN_get_transparent_index 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); -#endif - -#ifndef GLX_MESA_copy_sub_buffer -#define GLX_MESA_copy_sub_buffer 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); -#endif - -#ifndef GLX_MESA_pixmap_colormap -#define GLX_MESA_pixmap_colormap 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); -#endif - -#ifndef GLX_MESA_release_buffers -#define GLX_MESA_release_buffers 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); -#endif - -#ifndef GLX_MESA_set_3dfx_mode -#define GLX_MESA_set_3dfx_mode 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern Bool glXSet3DfxModeMESA (int); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif - +#ifndef __glxext_h_ +#define __glxext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#else +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif + + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +#define GLX_GLXEXT_VERSION 2 + +#ifndef GLX_VERSION_1_3 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif + +#ifndef GLX_SGI_swap_control +#endif + +#ifndef GLX_SGI_video_sync +#endif + +#ifndef GLX_SGI_make_current_read +#endif + +#ifndef GLX_SGIX_video_source +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +/* reuse GLX_NONE_EXT */ +#endif + +#ifndef GLX_EXT_import_context +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#endif + +#ifndef GLX_SGIX_fbconfig +#ifndef GLX_WINDOW_BIT_SGIX +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#endif +#ifndef GLX_PIXMAP_BIT_SGIX +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#endif +#ifndef GLX_RGBA_BIT_SGIX +#define GLX_RGBA_BIT_SGIX 0x00000001 +#endif +#ifndef GLX_COLOR_INDEX_BIT_SGIX +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#endif +#ifndef GLX_DRAWABLE_TYPE_SGIX +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#endif +#ifndef GLX_RENDER_TYPE_SGIX +#define GLX_RENDER_TYPE_SGIX 0x8011 +#endif +#ifndef GLX_X_RENDERABLE_SGIX +#define GLX_X_RENDERABLE_SGIX 0x8012 +#endif +#ifndef GLX_FBCONFIG_ID_SGIX +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#endif +#ifndef GLX_RGBA_TYPE_SGIX +#define GLX_RGBA_TYPE_SGIX 0x8014 +#endif +#ifndef GLX_COLOR_INDEX_TYPE_SGIX +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +#endif +/* reuse GLX_SCREEN_EXT */ +#endif + +#ifndef GLX_SGIX_pbuffer +#ifndef GLX_PBUFFER_BIT_SGIX +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#endif +#ifndef GLX_BUFFER_CLOBBER_MASK_SGIX +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#endif +#ifndef GLX_FRONT_LEFT_BUFFER_BIT_SGIX +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#endif +#ifndef GLX_FRONT_RIGHT_BUFFER_BIT_SGIX +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#endif +#ifndef GLX_BACK_LEFT_BUFFER_BIT_SGIX +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#endif +#ifndef GLX_BACK_RIGHT_BUFFER_BIT_SGIX +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#endif +#ifndef GLX_AUX_BUFFERS_BIT_SGIX +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#endif +#ifndef GLX_DEPTH_BUFFER_BIT_SGIX +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#endif +#ifndef GLX_STENCIL_BUFFER_BIT_SGIX +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#endif +#ifndef GLX_ACCUM_BUFFER_BIT_SGIX +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#endif +#ifndef GLX_SAMPLE_BUFFERS_BIT_SGIX +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#endif +#ifndef GLX_MAX_PBUFFER_WIDTH_SGIX +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#endif +#ifndef GLX_MAX_PBUFFER_HEIGHT_SGIX +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#endif +#ifndef GLX_MAX_PBUFFER_PIXELS_SGIX +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#endif +#ifndef GLX_OPTIMAL_PBUFFER_WIDTH_SGIX +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#endif +#ifndef GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#endif +#ifndef GLX_PRESERVED_CONTENTS_SGIX +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#endif +#ifndef GLX_LARGEST_PBUFFER_SGIX +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#endif +#ifndef GLX_WIDTH_SGIX +#define GLX_WIDTH_SGIX 0x801D +#endif +#ifndef GLX_HEIGHT_SGIX +#define GLX_HEIGHT_SGIX 0x801E +#endif +#ifndef GLX_EVENT_MASK_SGIX +#define GLX_EVENT_MASK_SGIX 0x801F +#endif +#ifndef GLX_DAMAGED_SGIX +#define GLX_DAMAGED_SGIX 0x8020 +#endif +#ifndef GLX_SAVED_SGIX +#define GLX_SAVED_SGIX 0x8021 +#endif +#ifndef GLX_WINDOW_SGIX +#define GLX_WINDOW_SGIX 0x8022 +#endif +#ifndef GLX_PBUFFER_SGIX +#define GLX_PBUFFER_SGIX 0x8023 +#endif +#endif + +#ifndef GLX_SGI_cushion +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#endif + +#ifndef GLX_SGIX_swap_group +#endif + +#ifndef GLX_SGIX_swap_barrier +#endif + +#ifndef GLX_SGIS_blended_overlay +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif + +#ifndef GLX_SGIS_shared_multisample +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif + +#ifndef GLX_SUN_get_transparent_index +#endif + +#ifndef GLX_3DFX_multisample +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#endif + +#ifndef GLX_MESA_pixmap_colormap +#endif + +#ifndef GLX_MESA_release_buffers +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#endif + + +/*************************************************************/ + +#ifndef GLX_ARB_get_proc_address +typedef void (*__GLXextFuncPtr)(); +#endif + +#ifndef GLX_SGIX_video_source +typedef XID GLXVideoSourceSGIX; +#endif + +#ifndef GLX_SGIX_fbconfig +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#endif + +#ifndef GLX_SGIX_pbuffer +typedef XID GLXPbufferSGIX; +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; +#endif + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); +extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); +extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); +extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); +extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); +extern void glXDestroyWindow (Display *, GLXWindow); +extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); +extern void glXDestroyPixmap (Display *, GLXPixmap); +extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); +extern void glXDestroyPbuffer (Display *, GLXPbuffer); +extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); +extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); +extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); +extern int glXQueryContext (Display *, GLXContext, int, int *); +extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#endif + +#ifndef GLX_NV_vertex_array_range +#define GLX_NV_vertex_array_range +#ifdef GLX_GLXEXT_PROTOTYPES +extern void *glXAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); +extern void glXFreeMemoryNV (void *); +#endif +typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei, GLfloat, GLfloat, GLfloat); +typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *); +#endif + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXSwapIntervalSGI (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); +#endif + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoSyncSGI (unsigned int *); +extern int glXWaitVideoSyncSGI (int, int, unsigned int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#endif + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#endif + +#ifdef _VL_H +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); +extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif + +#endif /* _VL_H */ +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#endif + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Display * glXGetCurrentDisplayEXT (void); +extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); +extern GLXContextID glXGetContextIDEXT (GLXContext); +extern GLXContext glXImportContextEXT (Display *, GLXContextID); +extern void glXFreeContextEXT (Display *, GLXContext); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); +extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); +extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); +extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); +extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); +extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); +extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); +extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); +extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +#endif + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCushionSGI (Display *, Window, float); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); +extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); +extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#endif + +#ifdef _DM_BUFFER_H_ +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif + +#endif /* _DM_BUFFER_H_ */ +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); +extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#endif + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXSet3DfxModeMESA (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Externals/GLew/glxtokens.h b/Externals/GLew/glxtokens.h index 2858d837dd..31b2f3e353 100644 --- a/Externals/GLew/glxtokens.h +++ b/Externals/GLew/glxtokens.h @@ -1,252 +1,252 @@ -#ifndef __glxtokens_h__ -#define __glxtokens_h__ - -/* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $Header: /teleimm/telev/inc/GL/glxtokens.h,v 1.1 2006/01/05 03:28:50 zerocool Exp $ -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define GLX_VERSION_1_1 1 -#define GLX_VERSION_1_2 1 - -/* - * Names for attributes to glXGetConfig. - */ -#define GLX_USE_GL 1 /* support GLX rendering */ -#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ -#define GLX_LEVEL 3 /* level in plane stacking */ -#define GLX_RGBA 4 /* true if RGBA mode */ -#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ -#define GLX_STEREO 6 /* stereo buffering supported */ -#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ -#define GLX_RED_SIZE 8 /* number of red component bits */ -#define GLX_GREEN_SIZE 9 /* number of green component bits */ -#define GLX_BLUE_SIZE 10 /* number of blue component bits */ -#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ -#define GLX_DEPTH_SIZE 12 /* number of depth bits */ -#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ -#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ -#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ -#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ -#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ - -#define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */ -#define GLX_SAMPLES_ARB 100001 /* number of multisample samples */ - -/* - * FBConfig-specific attributes - */ -#define GLX_X_VISUAL_TYPE 0x22 -#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */ -#define GLX_TRANSPARENT_TYPE 0x23 -#define GLX_TRANSPARENT_INDEX_VALUE 0x24 -#define GLX_TRANSPARENT_RED_VALUE 0x25 -#define GLX_TRANSPARENT_GREEN_VALUE 0x26 -#define GLX_TRANSPARENT_BLUE_VALUE 0x27 -#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 -#define GLX_DRAWABLE_TYPE 0x8010 -#define GLX_RENDER_TYPE 0x8011 -#define GLX_X_RENDERABLE 0x8012 -#define GLX_FBCONFIG_ID 0x8013 -#define GLX_MAX_PBUFFER_WIDTH 0x8016 -#define GLX_MAX_PBUFFER_HEIGHT 0x8017 -#define GLX_MAX_PBUFFER_PIXELS 0x8018 -#define GLX_VISUAL_ID 0x800B - -#define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE -#define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE -#define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE -#define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID -#define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH -#define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT -#define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS -#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 -#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A - -/* - * Error return values from glXGetConfig. Success is indicated by - * a value of 0. - */ -#define GLX_BAD_SCREEN 1 /* screen # is bad */ -#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ -#define GLX_NO_EXTENSION 3 /* no glx extension on server */ -#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ -#define GLX_BAD_CONTEXT 5 -#define GLX_BAD_VALUE 6 -#define GLX_BAD_ENUM 7 - - -/* FBConfig attribute values */ - -/* - * Generic "don't care" value for glX ChooseFBConfig attributes (except - * GLX_LEVEL). - */ -#define GLX_DONT_CARE 0xFFFFFFFF - -/* GLX_RENDER_TYPE bits */ -#define GLX_RGBA_BIT 0x00000001 -#define GLX_COLOR_INDEX_BIT 0x00000002 -#define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT -#define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT - -/* GLX_DRAWABLE_TYPE bits */ -#define GLX_WINDOW_BIT 0x00000001 -#define GLX_PIXMAP_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 -#define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT -#define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT -#define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT - -/* GLX_CONFIG_CAVEAT attribute values */ -#define GLX_NONE 0x8000 -#define GLX_SLOW_CONFIG 0x8001 -#define GLX_NON_CONFORMANT_CONFIG 0x800D - -/* GLX_X_VISUAL_TYPE attribute values */ -#define GLX_TRUE_COLOR 0x8002 -#define GLX_DIRECT_COLOR 0x8003 -#define GLX_PSEUDO_COLOR 0x8004 -#define GLX_STATIC_COLOR 0x8005 -#define GLX_GRAY_SCALE 0x8006 -#define GLX_STATIC_GRAY 0x8007 - -/* GLX_TRANSPARENT_TYPE attribute values */ -/* #define GLX_NONE 0x8000 */ -#define GLX_TRANSPARENT_RGB 0x8008 -#define GLX_TRANSPARENT_INDEX 0x8009 - -/* glXCreateGLXPbuffer attributes */ -#define GLX_PRESERVED_CONTENTS 0x801B -#define GLX_LARGEST_PBUFFER 0x801C -#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ -#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ -#define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS -#define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER - -/* glXQueryGLXPBuffer attributes */ -#define GLX_WIDTH 0x801D -#define GLX_HEIGHT 0x801E -#define GLX_EVENT_MASK 0x801F -#define GLX_WIDTH_SGIX GLX_WIDTH -#define GLX_HEIGHT_SGIX GLX_HEIGHT -#define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK - -/* glXCreateNewContext render_type attribute values */ -#define GLX_RGBA_TYPE 0x8014 -#define GLX_COLOR_INDEX_TYPE 0x8015 -#define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE -#define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE - -/* glXQueryContext attributes */ -/* #define GLX_FBCONFIG_ID 0x8013 */ -/* #define GLX_RENDER_TYPE 0x8011 */ -#define GLX_SCREEN 0x800C - -/* glXSelectEvent event mask bits */ -#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 -#define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK - -/* GLXPbufferClobberEvent event_type values */ -#define GLX_DAMAGED 0x8020 -#define GLX_SAVED 0x8021 -#define GLX_DAMAGED_SGIX GLX_DAMAGED -#define GLX_SAVED_SGIX GLX_SAVED - -/* GLXPbufferClobberEvent draw_type values */ -#define GLX_WINDOW 0x8022 -#define GLX_PBUFFER 0x8023 -#define GLX_WINDOW_SGIX GLX_WINDOW -#define GLX_PBUFFER_SGIX GLX_PBUFFER - -/* GLXPbufferClobberEvent buffer_mask bits */ -#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 -#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 -#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 -#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 -#define GLX_AUX_BUFFERS_BIT 0x00000010 -#define GLX_DEPTH_BUFFER_BIT 0x00000020 -#define GLX_STENCIL_BUFFER_BIT 0x00000040 -#define GLX_ACCUM_BUFFER_BIT 0x00000080 -#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT -#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT -#define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT -#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT -#define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT -#define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT -#define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT -#define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT - -/* - * Extension return values from glXGetConfig. These are also - * accepted as parameter values for glXChooseVisual. - */ - -#define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ -#define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ -#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ -#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ -#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ -#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ -#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ - -/* Property values for visual_type */ -#define GLX_TRUE_COLOR_EXT 0x8002 -#define GLX_DIRECT_COLOR_EXT 0x8003 -#define GLX_PSEUDO_COLOR_EXT 0x8004 -#define GLX_STATIC_COLOR_EXT 0x8005 -#define GLX_GRAY_SCALE_EXT 0x8006 -#define GLX_STATIC_GRAY_EXT 0x8007 - -/* Property values for transparent pixel */ -#define GLX_NONE_EXT 0x8000 -#define GLX_TRANSPARENT_RGB_EXT 0x8008 -#define GLX_TRANSPARENT_INDEX_EXT 0x8009 - -/* Property values for visual_rating */ -#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ -#define GLX_SLOW_VISUAL_EXT 0x8001 -#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D - -/* - * Names for attributes to glXGetClientString. - */ -#define GLX_VENDOR 0x1 -#define GLX_VERSION 0x2 -#define GLX_EXTENSIONS 0x3 - -/* - * Names for attributes to glXQueryContextInfoEXT. - */ -#define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ -#define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ -#define GLX_SCREEN_EXT 0x800C /* screen number */ - -/* NV_float_buffer */ -#define GLX_FLOAT_COMPONENTS_NV 0x20B0 - -#ifdef __cplusplus -} -#endif - -#endif /* !__glxtokens_h__ */ +#ifndef __glxtokens_h__ +#define __glxtokens_h__ + +/* +** The contents of this file are subject to the GLX Public License Version 1.0 +** (the "License"). You may not use this file except in compliance with the +** License. You may obtain a copy of the License at Silicon Graphics, Inc., +** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +** or at http://www.sgi.com/software/opensource/glx/license.html. +** +** Software distributed under the License is distributed on an "AS IS" +** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY +** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR +** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific +** language governing rights and limitations under the License. +** +** The Original Software is GLX version 1.2 source code, released February, +** 1999. The developer of the Original Software is Silicon Graphics, Inc. +** Those portions of the Subject Software created by Silicon Graphics, Inc. +** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** +** $Header: /teleimm/telev/inc/GL/glxtokens.h,v 1.1 2006/01/05 03:28:50 zerocool Exp $ +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#define GLX_VERSION_1_1 1 +#define GLX_VERSION_1_2 1 + +/* + * Names for attributes to glXGetConfig. + */ +#define GLX_USE_GL 1 /* support GLX rendering */ +#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ +#define GLX_LEVEL 3 /* level in plane stacking */ +#define GLX_RGBA 4 /* true if RGBA mode */ +#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ +#define GLX_STEREO 6 /* stereo buffering supported */ +#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ +#define GLX_RED_SIZE 8 /* number of red component bits */ +#define GLX_GREEN_SIZE 9 /* number of green component bits */ +#define GLX_BLUE_SIZE 10 /* number of blue component bits */ +#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ +#define GLX_DEPTH_SIZE 12 /* number of depth bits */ +#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ +#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ +#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ +#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ +#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ + +#define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */ +#define GLX_SAMPLES_ARB 100001 /* number of multisample samples */ + +/* + * FBConfig-specific attributes + */ +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */ +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_VISUAL_ID 0x800B + +#define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE +#define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE +#define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE +#define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID +#define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH +#define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT +#define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A + +/* + * Error return values from glXGetConfig. Success is indicated by + * a value of 0. + */ +#define GLX_BAD_SCREEN 1 /* screen # is bad */ +#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ +#define GLX_NO_EXTENSION 3 /* no glx extension on server */ +#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + + +/* FBConfig attribute values */ + +/* + * Generic "don't care" value for glX ChooseFBConfig attributes (except + * GLX_LEVEL). + */ +#define GLX_DONT_CARE 0xFFFFFFFF + +/* GLX_RENDER_TYPE bits */ +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT +#define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT + +/* GLX_DRAWABLE_TYPE bits */ +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT +#define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT +#define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT + +/* GLX_CONFIG_CAVEAT attribute values */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_NON_CONFORMANT_CONFIG 0x800D + +/* GLX_X_VISUAL_TYPE attribute values */ +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 + +/* GLX_TRANSPARENT_TYPE attribute values */ +/* #define GLX_NONE 0x8000 */ +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 + +/* glXCreateGLXPbuffer attributes */ +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ +#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ +#define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS +#define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER + +/* glXQueryGLXPBuffer attributes */ +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_WIDTH_SGIX GLX_WIDTH +#define GLX_HEIGHT_SGIX GLX_HEIGHT +#define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK + +/* glXCreateNewContext render_type attribute values */ +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE +#define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE + +/* glXQueryContext attributes */ +/* #define GLX_FBCONFIG_ID 0x8013 */ +/* #define GLX_RENDER_TYPE 0x8011 */ +#define GLX_SCREEN 0x800C + +/* glXSelectEvent event mask bits */ +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK + +/* GLXPbufferClobberEvent event_type values */ +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_DAMAGED_SGIX GLX_DAMAGED +#define GLX_SAVED_SGIX GLX_SAVED + +/* GLXPbufferClobberEvent draw_type values */ +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_WINDOW_SGIX GLX_WINDOW +#define GLX_PBUFFER_SGIX GLX_PBUFFER + +/* GLXPbufferClobberEvent buffer_mask bits */ +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT +#define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT +#define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT +#define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT +#define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT + +/* + * Extension return values from glXGetConfig. These are also + * accepted as parameter values for glXChooseVisual. + */ + +#define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ +#define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ + +/* Property values for visual_type */ +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 + +/* Property values for transparent pixel */ +#define GLX_NONE_EXT 0x8000 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 + +/* Property values for visual_rating */ +#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + +/* + * Names for attributes to glXGetClientString. + */ +#define GLX_VENDOR 0x1 +#define GLX_VERSION 0x2 +#define GLX_EXTENSIONS 0x3 + +/* + * Names for attributes to glXQueryContextInfoEXT. + */ +#define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ +#define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ +#define GLX_SCREEN_EXT 0x800C /* screen number */ + +/* NV_float_buffer */ +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 + +#ifdef __cplusplus +} +#endif + +#endif /* !__glxtokens_h__ */ diff --git a/Externals/GLew/tube.h b/Externals/GLew/tube.h index 5ea54142b8..c399b472c1 100644 --- a/Externals/GLew/tube.h +++ b/Externals/GLew/tube.h @@ -1,205 +1,205 @@ -/* - * tube.h - * - * FUNCTION: - * Tubing and Extrusion header file. - * This file provides protypes and defines for the extrusion - * and tubing primitives. - * - * HISTORY: - * Linas Vepstas 1990, 1991 - */ - -#ifndef __TUBE_H__ -#define __TUBE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - GLE API revision history: - - GLE_API_VERSION is updated to reflect GLE API changes (interface - changes, semantic changes, deletions, or additions). - - GLE_API_VERSION=228 GLUT 3.7 release of GLE. -**/ -#ifndef GLE_API_VERSION /* allow this to be overriden */ -#define GLE_API_VERSION 228 -#endif - -#ifdef _WIN32 -#define OPENGL_10 -#endif - -/* some types */ -#define gleDouble double -typedef gleDouble gleAffine[2][3]; - -/* ====================================================== */ - -/* defines for tubing join styles */ -#define TUBE_JN_RAW 0x1 -#define TUBE_JN_ANGLE 0x2 -#define TUBE_JN_CUT 0x3 -#define TUBE_JN_ROUND 0x4 -#define TUBE_JN_MASK 0xf /* mask bits */ -#define TUBE_JN_CAP 0x10 - -/* determine how normal vectors are to be handled */ -#define TUBE_NORM_FACET 0x100 -#define TUBE_NORM_EDGE 0x200 -#define TUBE_NORM_PATH_EDGE 0x400 /* for spiral, lathe, helix primitives */ -#define TUBE_NORM_MASK 0xf00 /* mask bits */ - -/* closed or open countours */ -#define TUBE_CONTOUR_CLOSED 0x1000 - -#define GLE_TEXTURE_ENABLE 0x10000 -#define GLE_TEXTURE_STYLE_MASK 0xff -#define GLE_TEXTURE_VERTEX_FLAT 1 -#define GLE_TEXTURE_NORMAL_FLAT 2 -#define GLE_TEXTURE_VERTEX_CYL 3 -#define GLE_TEXTURE_NORMAL_CYL 4 -#define GLE_TEXTURE_VERTEX_SPH 5 -#define GLE_TEXTURE_NORMAL_SPH 6 -#define GLE_TEXTURE_VERTEX_MODEL_FLAT 7 -#define GLE_TEXTURE_NORMAL_MODEL_FLAT 8 -#define GLE_TEXTURE_VERTEX_MODEL_CYL 9 -#define GLE_TEXTURE_NORMAL_MODEL_CYL 10 -#define GLE_TEXTURE_VERTEX_MODEL_SPH 11 -#define GLE_TEXTURE_NORMAL_MODEL_SPH 12 - -#ifdef GL_32 -/* HACK for GL 3.2 -- needed because no way to tell if lighting is on. */ -#define TUBE_LIGHTING_ON 0x80000000 - -#define gleExtrusion extrusion -#define gleSetJoinStyle setjoinstyle -#define gleGetJoinStyle getjoinstyle -#define glePolyCone polycone -#define glePolyCylinder polycylinder -#define gleSuperExtrusion super_extrusion -#define gleTwistExtrusion twist_extrusion -#define gleSpiral spiral -#define gleLathe lathe -#define gleHelicoid helicoid -#define gleToroid toroid -#define gleScrew screw - -#endif /* GL_32 */ - -extern int gleGetJoinStyle (void); -extern void gleSetJoinStyle (int style); /* bitwise OR of flags */ -extern int gleGetNumSlices(void); -extern void gleSetNumSlices(int slices); - -/* draw polyclinder, specified as a polyline */ -extern void glePolyCylinder (int npoints, /* num points in polyline */ - gleDouble point_array[][3], /* polyline vertces */ - float color_array[][3], /* colors at polyline verts */ - gleDouble radius); /* radius of polycylinder */ - -/* draw polycone, specified as a polyline with radii */ -extern void glePolyCone (int npoints, /* numpoints in poly-line */ - gleDouble point_array[][3], /* polyline vertices */ - float color_array[][3], /* colors at polyline verts */ - gleDouble radius_array[]); /* cone radii at polyline verts */ - -/* extrude arbitrary 2D contour along arbitrary 3D path */ -extern void gleExtrusion (int ncp, /* number of contour points */ - gleDouble contour[][2], /* 2D contour */ - gleDouble cont_normal[][2], /* 2D contour normals */ - gleDouble up[3], /* up vector for contour */ - int npoints, /* numpoints in poly-line */ - gleDouble point_array[][3], /* polyline vertices */ - float color_array[][3]); /* colors at polyline verts */ - -/* extrude 2D contour, specifying local rotations (twists) */ -extern void gleTwistExtrusion (int ncp, /* number of contour points */ - gleDouble contour[][2], /* 2D contour */ - gleDouble cont_normal[][2], /* 2D contour normals */ - gleDouble up[3], /* up vector for contour */ - int npoints, /* numpoints in poly-line */ - gleDouble point_array[][3], /* polyline vertices */ - float color_array[][3], /* color at polyline verts */ - gleDouble twist_array[]); /* countour twists (in degrees) */ - -/* extrude 2D contour, specifying local affine tranformations */ -extern void gleSuperExtrusion (int ncp, /* number of contour points */ - gleDouble contour[][2], /* 2D contour */ - gleDouble cont_normal[][2], /* 2D contour normals */ - gleDouble up[3], /* up vector for contour */ - int npoints, /* numpoints in poly-line */ - gleDouble point_array[][3], /* polyline vertices */ - float color_array[][3], /* color at polyline verts */ - gleDouble xform_array[][2][3]); /* 2D contour xforms */ - -/* spiral moves contour along helical path by parallel transport */ -extern void gleSpiral (int ncp, /* number of contour points */ - gleDouble contour[][2], /* 2D contour */ - gleDouble cont_normal[][2], /* 2D contour normals */ - gleDouble up[3], /* up vector for contour */ - gleDouble startRadius, /* spiral starts in x-y plane */ - gleDouble drdTheta, /* change in radius per revolution */ - gleDouble startZ, /* starting z value */ - gleDouble dzdTheta, /* change in Z per revolution */ - gleDouble startXform[2][3], /* starting contour affine xform */ - gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ - gleDouble startTheta, /* start angle in x-y plane */ - gleDouble sweepTheta); /* degrees to spiral around */ - -/* lathe moves contour along helical path by helically shearing 3D space */ -extern void gleLathe (int ncp, /* number of contour points */ - gleDouble contour[][2], /* 2D contour */ - gleDouble cont_normal[][2], /* 2D contour normals */ - gleDouble up[3], /* up vector for contour */ - gleDouble startRadius, /* spiral starts in x-y plane */ - gleDouble drdTheta, /* change in radius per revolution */ - gleDouble startZ, /* starting z value */ - gleDouble dzdTheta, /* change in Z per revolution */ - gleDouble startXform[2][3], /* starting contour affine xform */ - gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ - gleDouble startTheta, /* start angle in x-y plane */ - gleDouble sweepTheta); /* degrees to spiral around */ - -/* similar to spiral, except contour is a circle */ -extern void gleHelicoid (gleDouble rToroid, /* circle contour (torus) radius */ - gleDouble startRadius, /* spiral starts in x-y plane */ - gleDouble drdTheta, /* change in radius per revolution */ - gleDouble startZ, /* starting z value */ - gleDouble dzdTheta, /* change in Z per revolution */ - gleDouble startXform[2][3], /* starting contour affine xform */ - gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ - gleDouble startTheta, /* start angle in x-y plane */ - gleDouble sweepTheta); /* degrees to spiral around */ - -/* similar to lathe, except contour is a circle */ -extern void gleToroid (gleDouble rToroid, /* circle contour (torus) radius */ - gleDouble startRadius, /* spiral starts in x-y plane */ - gleDouble drdTheta, /* change in radius per revolution */ - gleDouble startZ, /* starting z value */ - gleDouble dzdTheta, /* change in Z per revolution */ - gleDouble startXform[2][3], /* starting contour affine xform */ - gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ - gleDouble startTheta, /* start angle in x-y plane */ - gleDouble sweepTheta); /* degrees to spiral around */ - -/* draws a screw shape */ -extern void gleScrew (int ncp, /* number of contour points */ - gleDouble contour[][2], /* 2D contour */ - gleDouble cont_normal[][2], /* 2D contour normals */ - gleDouble up[3], /* up vector for contour */ - gleDouble startz, /* start of segment */ - gleDouble endz, /* end of segment */ - gleDouble twist); /* number of rotations */ - -extern void gleTextureMode (int mode); - -#ifdef __cplusplus -} - -#endif -#endif /* __TUBE_H__ */ -/* ================== END OF FILE ======================= */ +/* + * tube.h + * + * FUNCTION: + * Tubing and Extrusion header file. + * This file provides protypes and defines for the extrusion + * and tubing primitives. + * + * HISTORY: + * Linas Vepstas 1990, 1991 + */ + +#ifndef __TUBE_H__ +#define __TUBE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + GLE API revision history: + + GLE_API_VERSION is updated to reflect GLE API changes (interface + changes, semantic changes, deletions, or additions). + + GLE_API_VERSION=228 GLUT 3.7 release of GLE. +**/ +#ifndef GLE_API_VERSION /* allow this to be overriden */ +#define GLE_API_VERSION 228 +#endif + +#ifdef _WIN32 +#define OPENGL_10 +#endif + +/* some types */ +#define gleDouble double +typedef gleDouble gleAffine[2][3]; + +/* ====================================================== */ + +/* defines for tubing join styles */ +#define TUBE_JN_RAW 0x1 +#define TUBE_JN_ANGLE 0x2 +#define TUBE_JN_CUT 0x3 +#define TUBE_JN_ROUND 0x4 +#define TUBE_JN_MASK 0xf /* mask bits */ +#define TUBE_JN_CAP 0x10 + +/* determine how normal vectors are to be handled */ +#define TUBE_NORM_FACET 0x100 +#define TUBE_NORM_EDGE 0x200 +#define TUBE_NORM_PATH_EDGE 0x400 /* for spiral, lathe, helix primitives */ +#define TUBE_NORM_MASK 0xf00 /* mask bits */ + +/* closed or open countours */ +#define TUBE_CONTOUR_CLOSED 0x1000 + +#define GLE_TEXTURE_ENABLE 0x10000 +#define GLE_TEXTURE_STYLE_MASK 0xff +#define GLE_TEXTURE_VERTEX_FLAT 1 +#define GLE_TEXTURE_NORMAL_FLAT 2 +#define GLE_TEXTURE_VERTEX_CYL 3 +#define GLE_TEXTURE_NORMAL_CYL 4 +#define GLE_TEXTURE_VERTEX_SPH 5 +#define GLE_TEXTURE_NORMAL_SPH 6 +#define GLE_TEXTURE_VERTEX_MODEL_FLAT 7 +#define GLE_TEXTURE_NORMAL_MODEL_FLAT 8 +#define GLE_TEXTURE_VERTEX_MODEL_CYL 9 +#define GLE_TEXTURE_NORMAL_MODEL_CYL 10 +#define GLE_TEXTURE_VERTEX_MODEL_SPH 11 +#define GLE_TEXTURE_NORMAL_MODEL_SPH 12 + +#ifdef GL_32 +/* HACK for GL 3.2 -- needed because no way to tell if lighting is on. */ +#define TUBE_LIGHTING_ON 0x80000000 + +#define gleExtrusion extrusion +#define gleSetJoinStyle setjoinstyle +#define gleGetJoinStyle getjoinstyle +#define glePolyCone polycone +#define glePolyCylinder polycylinder +#define gleSuperExtrusion super_extrusion +#define gleTwistExtrusion twist_extrusion +#define gleSpiral spiral +#define gleLathe lathe +#define gleHelicoid helicoid +#define gleToroid toroid +#define gleScrew screw + +#endif /* GL_32 */ + +extern int gleGetJoinStyle (void); +extern void gleSetJoinStyle (int style); /* bitwise OR of flags */ +extern int gleGetNumSlices(void); +extern void gleSetNumSlices(int slices); + +/* draw polyclinder, specified as a polyline */ +extern void glePolyCylinder (int npoints, /* num points in polyline */ + gleDouble point_array[][3], /* polyline vertces */ + float color_array[][3], /* colors at polyline verts */ + gleDouble radius); /* radius of polycylinder */ + +/* draw polycone, specified as a polyline with radii */ +extern void glePolyCone (int npoints, /* numpoints in poly-line */ + gleDouble point_array[][3], /* polyline vertices */ + float color_array[][3], /* colors at polyline verts */ + gleDouble radius_array[]); /* cone radii at polyline verts */ + +/* extrude arbitrary 2D contour along arbitrary 3D path */ +extern void gleExtrusion (int ncp, /* number of contour points */ + gleDouble contour[][2], /* 2D contour */ + gleDouble cont_normal[][2], /* 2D contour normals */ + gleDouble up[3], /* up vector for contour */ + int npoints, /* numpoints in poly-line */ + gleDouble point_array[][3], /* polyline vertices */ + float color_array[][3]); /* colors at polyline verts */ + +/* extrude 2D contour, specifying local rotations (twists) */ +extern void gleTwistExtrusion (int ncp, /* number of contour points */ + gleDouble contour[][2], /* 2D contour */ + gleDouble cont_normal[][2], /* 2D contour normals */ + gleDouble up[3], /* up vector for contour */ + int npoints, /* numpoints in poly-line */ + gleDouble point_array[][3], /* polyline vertices */ + float color_array[][3], /* color at polyline verts */ + gleDouble twist_array[]); /* countour twists (in degrees) */ + +/* extrude 2D contour, specifying local affine tranformations */ +extern void gleSuperExtrusion (int ncp, /* number of contour points */ + gleDouble contour[][2], /* 2D contour */ + gleDouble cont_normal[][2], /* 2D contour normals */ + gleDouble up[3], /* up vector for contour */ + int npoints, /* numpoints in poly-line */ + gleDouble point_array[][3], /* polyline vertices */ + float color_array[][3], /* color at polyline verts */ + gleDouble xform_array[][2][3]); /* 2D contour xforms */ + +/* spiral moves contour along helical path by parallel transport */ +extern void gleSpiral (int ncp, /* number of contour points */ + gleDouble contour[][2], /* 2D contour */ + gleDouble cont_normal[][2], /* 2D contour normals */ + gleDouble up[3], /* up vector for contour */ + gleDouble startRadius, /* spiral starts in x-y plane */ + gleDouble drdTheta, /* change in radius per revolution */ + gleDouble startZ, /* starting z value */ + gleDouble dzdTheta, /* change in Z per revolution */ + gleDouble startXform[2][3], /* starting contour affine xform */ + gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ + gleDouble startTheta, /* start angle in x-y plane */ + gleDouble sweepTheta); /* degrees to spiral around */ + +/* lathe moves contour along helical path by helically shearing 3D space */ +extern void gleLathe (int ncp, /* number of contour points */ + gleDouble contour[][2], /* 2D contour */ + gleDouble cont_normal[][2], /* 2D contour normals */ + gleDouble up[3], /* up vector for contour */ + gleDouble startRadius, /* spiral starts in x-y plane */ + gleDouble drdTheta, /* change in radius per revolution */ + gleDouble startZ, /* starting z value */ + gleDouble dzdTheta, /* change in Z per revolution */ + gleDouble startXform[2][3], /* starting contour affine xform */ + gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ + gleDouble startTheta, /* start angle in x-y plane */ + gleDouble sweepTheta); /* degrees to spiral around */ + +/* similar to spiral, except contour is a circle */ +extern void gleHelicoid (gleDouble rToroid, /* circle contour (torus) radius */ + gleDouble startRadius, /* spiral starts in x-y plane */ + gleDouble drdTheta, /* change in radius per revolution */ + gleDouble startZ, /* starting z value */ + gleDouble dzdTheta, /* change in Z per revolution */ + gleDouble startXform[2][3], /* starting contour affine xform */ + gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ + gleDouble startTheta, /* start angle in x-y plane */ + gleDouble sweepTheta); /* degrees to spiral around */ + +/* similar to lathe, except contour is a circle */ +extern void gleToroid (gleDouble rToroid, /* circle contour (torus) radius */ + gleDouble startRadius, /* spiral starts in x-y plane */ + gleDouble drdTheta, /* change in radius per revolution */ + gleDouble startZ, /* starting z value */ + gleDouble dzdTheta, /* change in Z per revolution */ + gleDouble startXform[2][3], /* starting contour affine xform */ + gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */ + gleDouble startTheta, /* start angle in x-y plane */ + gleDouble sweepTheta); /* degrees to spiral around */ + +/* draws a screw shape */ +extern void gleScrew (int ncp, /* number of contour points */ + gleDouble contour[][2], /* 2D contour */ + gleDouble cont_normal[][2], /* 2D contour normals */ + gleDouble up[3], /* up vector for contour */ + gleDouble startz, /* start of segment */ + gleDouble endz, /* end of segment */ + gleDouble twist); /* number of rotations */ + +extern void gleTextureMode (int mode); + +#ifdef __cplusplus +} + +#endif +#endif /* __TUBE_H__ */ +/* ================== END OF FILE ======================= */ diff --git a/Externals/GLew/wglext.h b/Externals/GLew/wglext.h index f424adcf78..22ad1053c2 100644 --- a/Externals/GLew/wglext.h +++ b/Externals/GLew/wglext.h @@ -1,611 +1,611 @@ -#ifndef __wglext_h_ -#define __wglext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: This software was created using the -** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has -** not been independently verified as being compliant with the OpenGL(R) -** version 1.2.1 Specification. -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -/*************************************************************/ - -/* Header file version number */ -/* wglext.h last updated 2002/03/22 */ -/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ -#define WGL_WGLEXT_VERSION 4 - -#ifndef WGL_ARB_buffer_region -#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 -#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 -#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 -#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 -#endif - -#ifndef WGL_ARB_multisample -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 -#endif - -#ifndef WGL_ARB_extensions_string -#endif - -#ifndef WGL_ARB_pixel_format -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C -#endif - -#ifndef WGL_ARB_make_current_read -#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 -#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 -#endif - -#ifndef WGL_ARB_pbuffer -#define WGL_DRAW_TO_PBUFFER_ARB 0x202D -#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E -#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F -#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 -#define WGL_PBUFFER_LARGEST_ARB 0x2033 -#define WGL_PBUFFER_WIDTH_ARB 0x2034 -#define WGL_PBUFFER_HEIGHT_ARB 0x2035 -#define WGL_PBUFFER_LOST_ARB 0x2036 -#endif - -#ifndef WGL_ARB_render_texture -#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 -#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 -#define WGL_TEXTURE_FORMAT_ARB 0x2072 -#define WGL_TEXTURE_TARGET_ARB 0x2073 -#define WGL_MIPMAP_TEXTURE_ARB 0x2074 -#define WGL_TEXTURE_RGB_ARB 0x2075 -#define WGL_TEXTURE_RGBA_ARB 0x2076 -#define WGL_NO_TEXTURE_ARB 0x2077 -#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 -#define WGL_TEXTURE_1D_ARB 0x2079 -#define WGL_TEXTURE_2D_ARB 0x207A -#define WGL_MIPMAP_LEVEL_ARB 0x207B -#define WGL_CUBE_MAP_FACE_ARB 0x207C -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 -#define WGL_FRONT_LEFT_ARB 0x2083 -#define WGL_FRONT_RIGHT_ARB 0x2084 -#define WGL_BACK_LEFT_ARB 0x2085 -#define WGL_BACK_RIGHT_ARB 0x2086 -#define WGL_AUX0_ARB 0x2087 -#define WGL_AUX1_ARB 0x2088 -#define WGL_AUX2_ARB 0x2089 -#define WGL_AUX3_ARB 0x208A -#define WGL_AUX4_ARB 0x208B -#define WGL_AUX5_ARB 0x208C -#define WGL_AUX6_ARB 0x208D -#define WGL_AUX7_ARB 0x208E -#define WGL_AUX8_ARB 0x208F -#define WGL_AUX9_ARB 0x2090 -#endif - -#ifndef WGL_EXT_make_current_read -#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 -#endif - -#ifndef WGL_EXT_pixel_format -#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 -#define WGL_DRAW_TO_WINDOW_EXT 0x2001 -#define WGL_DRAW_TO_BITMAP_EXT 0x2002 -#define WGL_ACCELERATION_EXT 0x2003 -#define WGL_NEED_PALETTE_EXT 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 -#define WGL_SWAP_METHOD_EXT 0x2007 -#define WGL_NUMBER_OVERLAYS_EXT 0x2008 -#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 -#define WGL_TRANSPARENT_EXT 0x200A -#define WGL_TRANSPARENT_VALUE_EXT 0x200B -#define WGL_SHARE_DEPTH_EXT 0x200C -#define WGL_SHARE_STENCIL_EXT 0x200D -#define WGL_SHARE_ACCUM_EXT 0x200E -#define WGL_SUPPORT_GDI_EXT 0x200F -#define WGL_SUPPORT_OPENGL_EXT 0x2010 -#define WGL_DOUBLE_BUFFER_EXT 0x2011 -#define WGL_STEREO_EXT 0x2012 -#define WGL_PIXEL_TYPE_EXT 0x2013 -#define WGL_COLOR_BITS_EXT 0x2014 -#define WGL_RED_BITS_EXT 0x2015 -#define WGL_RED_SHIFT_EXT 0x2016 -#define WGL_GREEN_BITS_EXT 0x2017 -#define WGL_GREEN_SHIFT_EXT 0x2018 -#define WGL_BLUE_BITS_EXT 0x2019 -#define WGL_BLUE_SHIFT_EXT 0x201A -#define WGL_ALPHA_BITS_EXT 0x201B -#define WGL_ALPHA_SHIFT_EXT 0x201C -#define WGL_ACCUM_BITS_EXT 0x201D -#define WGL_ACCUM_RED_BITS_EXT 0x201E -#define WGL_ACCUM_GREEN_BITS_EXT 0x201F -#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 -#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 -#define WGL_DEPTH_BITS_EXT 0x2022 -#define WGL_STENCIL_BITS_EXT 0x2023 -#define WGL_AUX_BUFFERS_EXT 0x2024 -#define WGL_NO_ACCELERATION_EXT 0x2025 -#define WGL_GENERIC_ACCELERATION_EXT 0x2026 -#define WGL_FULL_ACCELERATION_EXT 0x2027 -#define WGL_SWAP_EXCHANGE_EXT 0x2028 -#define WGL_SWAP_COPY_EXT 0x2029 -#define WGL_SWAP_UNDEFINED_EXT 0x202A -#define WGL_TYPE_RGBA_EXT 0x202B -#define WGL_TYPE_COLORINDEX_EXT 0x202C -#endif - -#ifndef WGL_EXT_pbuffer -#define WGL_DRAW_TO_PBUFFER_EXT 0x202D -#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E -#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F -#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 -#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 -#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 -#define WGL_PBUFFER_LARGEST_EXT 0x2033 -#define WGL_PBUFFER_WIDTH_EXT 0x2034 -#define WGL_PBUFFER_HEIGHT_EXT 0x2035 -#endif - -#ifndef WGL_EXT_depth_float -#define WGL_DEPTH_FLOAT_EXT 0x2040 -#endif - -#ifndef WGL_3DFX_multisample -#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 -#define WGL_SAMPLES_3DFX 0x2061 -#endif - -#ifndef WGL_EXT_multisample -#define WGL_SAMPLE_BUFFERS_EXT 0x2041 -#define WGL_SAMPLES_EXT 0x2042 -#endif - -#ifndef WGL_I3D_digital_video_control -#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 -#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 -#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 -#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 -#endif - -#ifndef WGL_I3D_gamma -#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E -#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F -#endif - -#ifndef WGL_I3D_genlock -#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 -#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 -#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 -#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 -#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 -#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 -#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A -#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B -#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C -#endif - -#ifndef WGL_I3D_image_buffer -#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 -#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 -#endif - -#ifndef WGL_I3D_swap_frame_lock -#endif - -#ifndef WGL_NV_render_depth_texture -#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 -#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 -#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 -#define WGL_DEPTH_COMPONENT_NV 0x20A7 -#endif - -#ifndef WGL_NV_render_texture_rectangle -#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 -#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 -#endif - -#ifndef WGL_NV_float_buffer -#define WGL_FLOAT_COMPONENTS_NV 0x20B0 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 -#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 -#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 -#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 -#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 -#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 -#endif - - -/*************************************************************/ - -#ifndef WGL_ARB_pbuffer -DECLARE_HANDLE(HPBUFFERARB); -#endif -#ifndef WGL_EXT_pbuffer -DECLARE_HANDLE(HPBUFFEREXT); -#endif - -#ifndef WGL_ARB_buffer_region -#define WGL_ARB_buffer_region 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT); -extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE); -extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int); -extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); -typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); -typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); -typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); -#endif - -#ifndef WGL_ARB_multisample -#define WGL_ARB_multisample 1 -#endif - -#ifndef WGL_ARB_extensions_string -#define WGL_ARB_extensions_string 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern const char * WINAPI wglGetExtensionsStringARB (HDC); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); -#endif - -#ifndef WGL_ARB_pixel_format -#define WGL_ARB_pixel_format 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *); -extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *); -extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -#endif - -#ifndef WGL_ARB_make_current_read -#define WGL_ARB_make_current_read 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC); -extern HDC WINAPI wglGetCurrentReadDCARB (void); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); -#endif - -#ifndef WGL_ARB_pbuffer -#define WGL_ARB_pbuffer 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *); -extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB); -extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC); -extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB); -extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); -typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); -typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); -typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); -#endif - -#ifndef WGL_ARB_render_texture -#define WGL_ARB_render_texture 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int); -extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int); -extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); -#endif - -#ifndef WGL_EXT_display_color_table -#define WGL_EXT_display_color_table 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort); -extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint); -extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort); -extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); -typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); -typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); -typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); -#endif - -#ifndef WGL_EXT_extensions_string -#define WGL_EXT_extensions_string 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern const char * WINAPI wglGetExtensionsStringEXT (void); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); -#endif - -#ifndef WGL_EXT_make_current_read -#define WGL_EXT_make_current_read 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC); -extern HDC WINAPI wglGetCurrentReadDCEXT (void); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); -#endif - -#ifndef WGL_EXT_pbuffer -#define WGL_EXT_pbuffer 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *); -extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT); -extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC); -extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT); -extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); -typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); -typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); -typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); -#endif - -#ifndef WGL_EXT_pixel_format -#define WGL_EXT_pixel_format 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *); -extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *); -extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -#endif - -#ifndef WGL_EXT_swap_control -#define WGL_EXT_swap_control 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglSwapIntervalEXT (int); -extern int WINAPI wglGetSwapIntervalEXT (void); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); -typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); -#endif - -#ifndef WGL_EXT_depth_float -#define WGL_EXT_depth_float 1 -#endif - -#ifndef WGL_NV_vertex_array_range -#define WGL_NV_vertex_array_range 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); -extern void WINAPI wglFreeMemoryNV (void *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); -typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); -#endif - -#ifndef WGL_3DFX_multisample -#define WGL_3DFX_multisample 1 -#endif - -#ifndef WGL_EXT_multisample -#define WGL_EXT_multisample 1 -#endif - -#ifndef WGL_OML_sync_control -#define WGL_OML_sync_control 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *); -extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *); -extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64); -extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64); -extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *); -extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); -typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); -typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); -typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); -typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); -typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); -#endif - -#ifndef WGL_I3D_digital_video_control -#define WGL_I3D_digital_video_control 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *); -extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); -typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); -#endif - -#ifndef WGL_I3D_gamma -#define WGL_I3D_gamma 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *); -extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *); -extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *); -extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); -typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); -typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); -typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); -#endif - -#ifndef WGL_I3D_genlock -#define WGL_I3D_genlock 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglEnableGenlockI3D (HDC); -extern BOOL WINAPI wglDisableGenlockI3D (HDC); -extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *); -extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT); -extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *); -extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT); -extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *); -extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT); -extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *); -extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT); -extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *); -extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); -typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); -typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); -typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); -typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); -typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); -typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); -typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); -typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); -#endif - -#ifndef WGL_I3D_image_buffer -#define WGL_I3D_image_buffer 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT); -extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID); -extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT); -extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); -typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); -typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); -typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); -#endif - -#ifndef WGL_I3D_swap_frame_lock -#define WGL_I3D_swap_frame_lock 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglEnableFrameLockI3D (void); -extern BOOL WINAPI wglDisableFrameLockI3D (void); -extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *); -extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); -typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); -#endif - -#ifndef WGL_I3D_swap_frame_usage -#define WGL_I3D_swap_frame_usage 1 -#ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglGetFrameUsageI3D (float *); -extern BOOL WINAPI wglBeginFrameTrackingI3D (void); -extern BOOL WINAPI wglEndFrameTrackingI3D (void); -extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *); -#endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); -typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); -typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef __wglext_h_ +#define __wglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number */ +/* wglext.h last updated 2002/03/22 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define WGL_WGLEXT_VERSION 4 + +#ifndef WGL_ARB_buffer_region +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +#endif + +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_extensions_string +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +#endif + +#ifndef WGL_EXT_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +#endif + +#ifndef WGL_I3D_gamma +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +#endif + +#ifndef WGL_I3D_genlock +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +#endif + +#ifndef WGL_I3D_swap_frame_lock +#endif + +#ifndef WGL_NV_render_depth_texture +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif + + +/*************************************************************/ + +#ifndef WGL_ARB_pbuffer +DECLARE_HANDLE(HPBUFFERARB); +#endif +#ifndef WGL_EXT_pbuffer +DECLARE_HANDLE(HPBUFFEREXT); +#endif + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT); +extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE); +extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int); +extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#endif + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringARB (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCARB (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB); +extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC); +extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB); +extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort); +extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint); +extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort); +extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#endif + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#endif + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT); +extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC); +extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT); +extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSwapIntervalEXT (int); +extern int WINAPI wglGetSwapIntervalEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#endif + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); +extern void WINAPI wglFreeMemoryNV (void *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#endif + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *); +extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64); +extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64); +extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#endif + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *); +extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *); +extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableGenlockI3D (HDC); +extern BOOL WINAPI wglDisableGenlockI3D (HDC); +extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *); +extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *); +extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT); +extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID); +extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT); +extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#endif + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableFrameLockI3D (void); +extern BOOL WINAPI wglDisableFrameLockI3D (void); +extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *); +extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#endif + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetFrameUsageI3D (float *); +extern BOOL WINAPI wglBeginFrameTrackingI3D (void); +extern BOOL WINAPI wglEndFrameTrackingI3D (void); +extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/GLew/win32_glx.h b/Externals/GLew/win32_glx.h index fd3c503550..d3630e7a1e 100644 --- a/Externals/GLew/win32_glx.h +++ b/Externals/GLew/win32_glx.h @@ -1,58 +1,58 @@ -#ifndef __win32_glx_h__ -#define __win32_glx_h__ - -/* Copyright (c) Nate Robins, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "win32_x11.h" - -/* Type definitions (conversions). */ -typedef HGLRC GLXContext; - -#define GLX_USE_GL 1 /* support GLX rendering */ -#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ -#define GLX_LEVEL 3 /* level in plane stacking */ -#define GLX_RGBA 4 /* true if RGBA mode */ -#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ -#define GLX_STEREO 6 /* stereo buffering supported */ -#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ -#define GLX_RED_SIZE 8 /* number of red component bits */ -#define GLX_GREEN_SIZE 9 /* number of green component bits */ -#define GLX_BLUE_SIZE 10 /* number of blue component bits */ -#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ -#define GLX_DEPTH_SIZE 12 /* number of depth bits */ -#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ -#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ -#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ -#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ -#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ - -#define GLX_BAD_ATTRIB 2 -#define GLX_BAD_VISUAL 4 - -/* Functions emulated by macros. */ - -#define glXDestroyContext(display, context) \ - wglDeleteContext(context) - -/* Function prototypes. */ - -extern GLXContext glXCreateContext( - Display* display, - XVisualInfo* visinfo, - GLXContext share, - Bool direct); -extern int glXGetConfig( - Display* display, - XVisualInfo* visual, - int attrib, - int* value); -extern XVisualInfo* glXChooseVisual( - Display* display, - int screen, - int* attribList); - -#endif /* __win32_glx_h__ */ +#ifndef __win32_glx_h__ +#define __win32_glx_h__ + +/* Copyright (c) Nate Robins, 1997. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#include "win32_x11.h" + +/* Type definitions (conversions). */ +typedef HGLRC GLXContext; + +#define GLX_USE_GL 1 /* support GLX rendering */ +#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ +#define GLX_LEVEL 3 /* level in plane stacking */ +#define GLX_RGBA 4 /* true if RGBA mode */ +#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ +#define GLX_STEREO 6 /* stereo buffering supported */ +#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ +#define GLX_RED_SIZE 8 /* number of red component bits */ +#define GLX_GREEN_SIZE 9 /* number of green component bits */ +#define GLX_BLUE_SIZE 10 /* number of blue component bits */ +#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ +#define GLX_DEPTH_SIZE 12 /* number of depth bits */ +#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ +#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ +#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ +#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ +#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ + +#define GLX_BAD_ATTRIB 2 +#define GLX_BAD_VISUAL 4 + +/* Functions emulated by macros. */ + +#define glXDestroyContext(display, context) \ + wglDeleteContext(context) + +/* Function prototypes. */ + +extern GLXContext glXCreateContext( + Display* display, + XVisualInfo* visinfo, + GLXContext share, + Bool direct); +extern int glXGetConfig( + Display* display, + XVisualInfo* visual, + int attrib, + int* value); +extern XVisualInfo* glXChooseVisual( + Display* display, + int screen, + int* attribList); + +#endif /* __win32_glx_h__ */ diff --git a/Externals/GLew/win32_x11.h b/Externals/GLew/win32_x11.h index 5aed5b89de..bb49977316 100644 --- a/Externals/GLew/win32_x11.h +++ b/Externals/GLew/win32_x11.h @@ -1,319 +1,319 @@ -#ifndef __win32_x11_h__ -#define __win32_x11_h__ - -/* Copyright (c) Nate Robins, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include -#include - -/* Type definitions (conversions) */ -typedef int Visual; /* Win32 equivalent of X11 type */ -typedef HWND Window; -typedef HPALETTE Colormap; -typedef PIXELFORMATDESCRIPTOR XVisualInfo; -typedef BOOL Bool; -typedef MSG XEvent; -typedef HDC Display; -typedef HCURSOR Cursor; - -typedef int Atom; /* dummies */ -typedef int XDevice; -typedef int Status; - -#define True TRUE /* Win32 equivalents of X11 booleans */ -#define False FALSE - -#define None 0L /* universal null resource or null atom */ - -/* Input Event Masks. Used as event-mask window attribute and as arguments - to Grab requests. Not to be confused with event names. */ - -#define NoEventMask 0L -#define KeyPressMask (1L<<0) -#define KeyReleaseMask (1L<<1) -#define ButtonPressMask (1L<<2) -#define ButtonReleaseMask (1L<<3) -#define EnterWindowMask (1L<<4) -#define LeaveWindowMask (1L<<5) -#define PointerMotionMask (1L<<6) -#define PointerMotionHintMask (1L<<7) -#define Button1MotionMask (1L<<8) -#define Button2MotionMask (1L<<9) -#define Button3MotionMask (1L<<10) -#define Button4MotionMask (1L<<11) -#define Button5MotionMask (1L<<12) -#define ButtonMotionMask (1L<<13) -#define KeymapStateMask (1L<<14) -#define ExposureMask (1L<<15) -#define VisibilityChangeMask (1L<<16) -#define StructureNotifyMask (1L<<17) -#define ResizeRedirectMask (1L<<18) -#define SubstructureNotifyMask (1L<<19) -#define SubstructureRedirectMask (1L<<20) -#define FocusChangeMask (1L<<21) -#define PropertyChangeMask (1L<<22) -#define ColormapChangeMask (1L<<23) -#define OwnerGrabButtonMask (1L<<24) - -/* Key masks. Used as modifiers to GrabButton and GrabKey, results of - QueryPointer, state in various key-, mouse-, and button-related - events. */ - -#define ShiftMask (1<<0) -#define LockMask (1<<1) -#define ControlMask (1<<2) -#define Mod1Mask (1<<3) -#define Mod2Mask (1<<4) -#define Mod3Mask (1<<5) -#define Mod4Mask (1<<6) -#define Mod5Mask (1<<7) - -/* Window classes used by CreateWindow */ -/* Note that CopyFromParent is already defined as 0 above */ - -#define InputOutput 1 -#define InputOnly 2 - -/* Window attributes for CreateWindow and ChangeWindowAttributes */ - -#define CWBackPixmap (1L<<0) -#define CWBackPixel (1L<<1) -#define CWBorderPixmap (1L<<2) -#define CWBorderPixel (1L<<3) -#define CWBitGravity (1L<<4) -#define CWWinGravity (1L<<5) -#define CWBackingStore (1L<<6) -#define CWBackingPlanes (1L<<7) -#define CWBackingPixel (1L<<8) -#define CWOverrideRedirect (1L<<9) -#define CWSaveUnder (1L<<10) -#define CWEventMask (1L<<11) -#define CWDontPropagate (1L<<12) -#define CWColormap (1L<<13) -#define CWCursor (1L<<14) - -/* ConfigureWindow structure */ - -#define CWX (1<<0) -#define CWY (1<<1) -#define CWWidth (1<<2) -#define CWHeight (1<<3) -#define CWBorderWidth (1<<4) -#define CWSibling (1<<5) -#define CWStackMode (1<<6) - - -/* Used in GetWindowAttributes reply */ - -#define IsUnmapped 0 -#define IsUnviewable 1 -#define IsViewable 2 - -/* Window stacking method (in configureWindow) */ - -#define Above 0 -#define Below 1 -#define TopIf 2 -#define BottomIf 3 -#define Opposite 4 - -/* For CreateColormap */ - -#define AllocNone 0 /* create map with no entries */ -#define AllocAll 1 /* allocate entire map writeable */ - - -/* Flags used in StoreNamedColor, StoreColors */ - -#define DoRed (1<<0) -#define DoGreen (1<<1) -#define DoBlue (1<<2) - -/* - * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding - * value (x, y, width, height) was found in the parsed string. - */ -#define NoValue 0x0000 -#define XValue 0x0001 -#define YValue 0x0002 -#define WidthValue 0x0004 -#define HeightValue 0x0008 -#define AllValues 0x000F -#define XNegative 0x0010 -#define YNegative 0x0020 - -/* flags argument in size hints */ -#define USPosition (1L << 0) /* user specified x, y */ -#define USSize (1L << 1) /* user specified width, height */ - -/* definitions for initial window state */ -#define WithdrawnState 0 /* for windows that are not mapped */ -#define NormalState 1 /* most applications want to start this way */ -#define IconicState 3 /* application wants to start as an icon */ -#define GameModeState 4 /* Win32 GLUT only (not in Xlib!). */ - -/* Type definitions */ - -typedef struct { - unsigned int background_pixmap; /* background pixmap */ - unsigned long background_pixel; /* background pixel */ - unsigned long border_pixel; /* border pixel value */ - long event_mask; /* set of events that should be saved */ - long do_not_propagate_mask; /* set of events that should not propagate */ - Bool override_redirect; /* boolean value for override-redirect */ - Colormap colormap; /* color map to be associated with window */ -} XSetWindowAttributes; - -typedef struct { - unsigned long pixel; - unsigned short red, green, blue; - char flags; /* do_red, do_green, do_blue */ -} XColor; - -typedef struct { - unsigned char *value; /* same as Property routines */ - Atom encoding; /* prop type */ - int format; /* prop data format: 8, 16, or 32 */ - unsigned long nitems; /* number of data items in value */ -} XTextProperty; - -typedef struct { - long flags; /* marks which fields in this structure are defined */ - int x, y; /* obsolete for new window mgrs, but clients */ - int width, height; /* should set so old wm's don't mess up */ -} XSizeHints; - -/* Functions emulated by macros. */ - -#define XFreeColormap(display, colormap) \ - DeleteObject(colormap) - -#define XCreateFontCursor(display, shape) \ - LoadCursor(NULL, shape) - -#define XDefineCursor(display, window, cursor) \ - SetCursor(cursor) - -#define XFlush(display) \ - /* Nothing. */ - -#define DisplayWidth(display, screen) \ - GetSystemMetrics(SM_CXSCREEN) - -#define DisplayHeight(display, screen) \ - GetSystemMetrics(SM_CYSCREEN) - -#define XMapWindow(display, window) \ - ShowWindow(window, SW_SHOWNORMAL) - -#define XUnmapWindow(display, window) \ - ShowWindow(window, SW_HIDE) - -#define XIconifyWindow(display, window, screen) \ - ShowWindow(window, SW_MINIMIZE) - -#define XWithdrawWindow(display, window, screen) \ - ShowWindow(window, SW_HIDE) - -#define XLowerWindow(display, window) \ - SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) - -#define XSetWMName(display, window, tp) \ - SetWindowText(window, (tp)->value) - -/* There really isn't a way to set the icon name separate from the - windows name in Win32, so, just set the windows name. */ -#define XSetWMIconName(display, window, tp) \ - XSetWMName(display, window, tp) - -#define XDestroyWindow(display, window) \ - DestroyWindow(window) - -/* Anything that needs to be freed was allocated with malloc in our - fake X windows library for Win32, so free it with plain old - free(). */ -#define XFree(data) \ - free(data) - -/* Nothing to be done for this...the pointer is always 'ungrabbed' - in Win32. */ -#define XUngrabPointer(display, time) \ - /* Nothing. */ - -/* Function prototypes. */ - -extern XVisualInfo* XGetVisualInfo( - Display* display, - long mask, - XVisualInfo* ttemplate, /* Avoid class with C++ keyword. */ - int*nitems); - -extern Colormap XCreateColormap( - Display* display, - Window root, - Visual* visual, - int alloc); - -extern void XAllocColorCells( - Display* display, - Colormap colormap, - Bool contig, - unsigned long plane_masks_return[], - unsigned int nplanes, - unsigned long pixels_return[], - unsigned int npixels); - -extern void XStoreColor( - Display* display, - Colormap colormap, - XColor* color); - -extern void XSetWindowColormap( - Display* display, - Window window, - Colormap colormap); - -extern Bool XTranslateCoordinates( - Display *display, - Window src, Window dst, - int src_x, int src_y, - int* dest_x_return, int* dest_y_return, - Window* child_return); - -extern Status XGetGeometry( - Display* display, - Window window, - Window* root_return, - int* x_return, int* y_return, - unsigned int* width_return, unsigned int* height_return, - unsigned int *border_width_return, - unsigned int* depth_return); - -extern int DisplayWidthMM( - Display* display, - int screen); - -extern int DisplayHeightMM( - Display* display, - int screen); - -extern void XWarpPointer( - Display* display, - Window src, Window dst, - int src_x, int src_y, - int src_width, int src_height, - int dst_x, int dst_y); - -extern int XParseGeometry( - char* string, - int* x, int* y, - unsigned int* width, unsigned int* height); - -extern int XPending( - Display* display); - -#endif /* __win32_x11_h__ */ +#ifndef __win32_x11_h__ +#define __win32_x11_h__ + +/* Copyright (c) Nate Robins, 1997. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#include +#include + +/* Type definitions (conversions) */ +typedef int Visual; /* Win32 equivalent of X11 type */ +typedef HWND Window; +typedef HPALETTE Colormap; +typedef PIXELFORMATDESCRIPTOR XVisualInfo; +typedef BOOL Bool; +typedef MSG XEvent; +typedef HDC Display; +typedef HCURSOR Cursor; + +typedef int Atom; /* dummies */ +typedef int XDevice; +typedef int Status; + +#define True TRUE /* Win32 equivalents of X11 booleans */ +#define False FALSE + +#define None 0L /* universal null resource or null atom */ + +/* Input Event Masks. Used as event-mask window attribute and as arguments + to Grab requests. Not to be confused with event names. */ + +#define NoEventMask 0L +#define KeyPressMask (1L<<0) +#define KeyReleaseMask (1L<<1) +#define ButtonPressMask (1L<<2) +#define ButtonReleaseMask (1L<<3) +#define EnterWindowMask (1L<<4) +#define LeaveWindowMask (1L<<5) +#define PointerMotionMask (1L<<6) +#define PointerMotionHintMask (1L<<7) +#define Button1MotionMask (1L<<8) +#define Button2MotionMask (1L<<9) +#define Button3MotionMask (1L<<10) +#define Button4MotionMask (1L<<11) +#define Button5MotionMask (1L<<12) +#define ButtonMotionMask (1L<<13) +#define KeymapStateMask (1L<<14) +#define ExposureMask (1L<<15) +#define VisibilityChangeMask (1L<<16) +#define StructureNotifyMask (1L<<17) +#define ResizeRedirectMask (1L<<18) +#define SubstructureNotifyMask (1L<<19) +#define SubstructureRedirectMask (1L<<20) +#define FocusChangeMask (1L<<21) +#define PropertyChangeMask (1L<<22) +#define ColormapChangeMask (1L<<23) +#define OwnerGrabButtonMask (1L<<24) + +/* Key masks. Used as modifiers to GrabButton and GrabKey, results of + QueryPointer, state in various key-, mouse-, and button-related + events. */ + +#define ShiftMask (1<<0) +#define LockMask (1<<1) +#define ControlMask (1<<2) +#define Mod1Mask (1<<3) +#define Mod2Mask (1<<4) +#define Mod3Mask (1<<5) +#define Mod4Mask (1<<6) +#define Mod5Mask (1<<7) + +/* Window classes used by CreateWindow */ +/* Note that CopyFromParent is already defined as 0 above */ + +#define InputOutput 1 +#define InputOnly 2 + +/* Window attributes for CreateWindow and ChangeWindowAttributes */ + +#define CWBackPixmap (1L<<0) +#define CWBackPixel (1L<<1) +#define CWBorderPixmap (1L<<2) +#define CWBorderPixel (1L<<3) +#define CWBitGravity (1L<<4) +#define CWWinGravity (1L<<5) +#define CWBackingStore (1L<<6) +#define CWBackingPlanes (1L<<7) +#define CWBackingPixel (1L<<8) +#define CWOverrideRedirect (1L<<9) +#define CWSaveUnder (1L<<10) +#define CWEventMask (1L<<11) +#define CWDontPropagate (1L<<12) +#define CWColormap (1L<<13) +#define CWCursor (1L<<14) + +/* ConfigureWindow structure */ + +#define CWX (1<<0) +#define CWY (1<<1) +#define CWWidth (1<<2) +#define CWHeight (1<<3) +#define CWBorderWidth (1<<4) +#define CWSibling (1<<5) +#define CWStackMode (1<<6) + + +/* Used in GetWindowAttributes reply */ + +#define IsUnmapped 0 +#define IsUnviewable 1 +#define IsViewable 2 + +/* Window stacking method (in configureWindow) */ + +#define Above 0 +#define Below 1 +#define TopIf 2 +#define BottomIf 3 +#define Opposite 4 + +/* For CreateColormap */ + +#define AllocNone 0 /* create map with no entries */ +#define AllocAll 1 /* allocate entire map writeable */ + + +/* Flags used in StoreNamedColor, StoreColors */ + +#define DoRed (1<<0) +#define DoGreen (1<<1) +#define DoBlue (1<<2) + +/* + * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding + * value (x, y, width, height) was found in the parsed string. + */ +#define NoValue 0x0000 +#define XValue 0x0001 +#define YValue 0x0002 +#define WidthValue 0x0004 +#define HeightValue 0x0008 +#define AllValues 0x000F +#define XNegative 0x0010 +#define YNegative 0x0020 + +/* flags argument in size hints */ +#define USPosition (1L << 0) /* user specified x, y */ +#define USSize (1L << 1) /* user specified width, height */ + +/* definitions for initial window state */ +#define WithdrawnState 0 /* for windows that are not mapped */ +#define NormalState 1 /* most applications want to start this way */ +#define IconicState 3 /* application wants to start as an icon */ +#define GameModeState 4 /* Win32 GLUT only (not in Xlib!). */ + +/* Type definitions */ + +typedef struct { + unsigned int background_pixmap; /* background pixmap */ + unsigned long background_pixel; /* background pixel */ + unsigned long border_pixel; /* border pixel value */ + long event_mask; /* set of events that should be saved */ + long do_not_propagate_mask; /* set of events that should not propagate */ + Bool override_redirect; /* boolean value for override-redirect */ + Colormap colormap; /* color map to be associated with window */ +} XSetWindowAttributes; + +typedef struct { + unsigned long pixel; + unsigned short red, green, blue; + char flags; /* do_red, do_green, do_blue */ +} XColor; + +typedef struct { + unsigned char *value; /* same as Property routines */ + Atom encoding; /* prop type */ + int format; /* prop data format: 8, 16, or 32 */ + unsigned long nitems; /* number of data items in value */ +} XTextProperty; + +typedef struct { + long flags; /* marks which fields in this structure are defined */ + int x, y; /* obsolete for new window mgrs, but clients */ + int width, height; /* should set so old wm's don't mess up */ +} XSizeHints; + +/* Functions emulated by macros. */ + +#define XFreeColormap(display, colormap) \ + DeleteObject(colormap) + +#define XCreateFontCursor(display, shape) \ + LoadCursor(NULL, shape) + +#define XDefineCursor(display, window, cursor) \ + SetCursor(cursor) + +#define XFlush(display) \ + /* Nothing. */ + +#define DisplayWidth(display, screen) \ + GetSystemMetrics(SM_CXSCREEN) + +#define DisplayHeight(display, screen) \ + GetSystemMetrics(SM_CYSCREEN) + +#define XMapWindow(display, window) \ + ShowWindow(window, SW_SHOWNORMAL) + +#define XUnmapWindow(display, window) \ + ShowWindow(window, SW_HIDE) + +#define XIconifyWindow(display, window, screen) \ + ShowWindow(window, SW_MINIMIZE) + +#define XWithdrawWindow(display, window, screen) \ + ShowWindow(window, SW_HIDE) + +#define XLowerWindow(display, window) \ + SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) + +#define XSetWMName(display, window, tp) \ + SetWindowText(window, (tp)->value) + +/* There really isn't a way to set the icon name separate from the + windows name in Win32, so, just set the windows name. */ +#define XSetWMIconName(display, window, tp) \ + XSetWMName(display, window, tp) + +#define XDestroyWindow(display, window) \ + DestroyWindow(window) + +/* Anything that needs to be freed was allocated with malloc in our + fake X windows library for Win32, so free it with plain old + free(). */ +#define XFree(data) \ + free(data) + +/* Nothing to be done for this...the pointer is always 'ungrabbed' + in Win32. */ +#define XUngrabPointer(display, time) \ + /* Nothing. */ + +/* Function prototypes. */ + +extern XVisualInfo* XGetVisualInfo( + Display* display, + long mask, + XVisualInfo* ttemplate, /* Avoid class with C++ keyword. */ + int*nitems); + +extern Colormap XCreateColormap( + Display* display, + Window root, + Visual* visual, + int alloc); + +extern void XAllocColorCells( + Display* display, + Colormap colormap, + Bool contig, + unsigned long plane_masks_return[], + unsigned int nplanes, + unsigned long pixels_return[], + unsigned int npixels); + +extern void XStoreColor( + Display* display, + Colormap colormap, + XColor* color); + +extern void XSetWindowColormap( + Display* display, + Window window, + Colormap colormap); + +extern Bool XTranslateCoordinates( + Display *display, + Window src, Window dst, + int src_x, int src_y, + int* dest_x_return, int* dest_y_return, + Window* child_return); + +extern Status XGetGeometry( + Display* display, + Window window, + Window* root_return, + int* x_return, int* y_return, + unsigned int* width_return, unsigned int* height_return, + unsigned int *border_width_return, + unsigned int* depth_return); + +extern int DisplayWidthMM( + Display* display, + int screen); + +extern int DisplayHeightMM( + Display* display, + int screen); + +extern void XWarpPointer( + Display* display, + Window src, Window dst, + int src_x, int src_y, + int src_width, int src_height, + int dst_x, int dst_y); + +extern int XParseGeometry( + char* string, + int* x, int* y, + unsigned int* width, unsigned int* height); + +extern int XPending( + Display* display); + +#endif /* __win32_x11_h__ */ diff --git a/Externals/WTL80/atlapp.h b/Externals/WTL80/atlapp.h index b62e097044..5b74e37760 100644 --- a/Externals/WTL80/atlapp.h +++ b/Externals/WTL80/atlapp.h @@ -1,1688 +1,1688 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLAPP_H__ -#define __ATLAPP_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLBASE_H__ - #error atlapp.h requires atlbase.h to be included first -#endif - -#ifndef _WIN32_WCE - #if (WINVER < 0x0400) - #error WTL requires Windows version 4.0 or higher - #endif - - #if (_WIN32_IE < 0x0300) - #error WTL requires IE version 3.0 or higher - #endif -#endif - -#ifdef _ATL_NO_COMMODULE - #error WTL requires that _ATL_NO_COMMODULE is not defined -#endif // _ATL_NO_COMMODULE - -#if defined(_WIN32_WCE) && defined(_ATL_MIN_CRT) - #pragma message("Warning: WTL for Windows CE doesn't use _ATL_MIN_CRT") -#endif // defined(_WIN32_WCE) && defined(_ATL_MIN_CRT) - -#include -#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) - #include // for _beginthreadex -#endif - -#if (_ATL_VER < 0x0800) && !defined(_DEBUG) - #include -#endif - -#include -#ifndef _WIN32_WCE -#pragma comment(lib, "comctl32.lib") -#endif // !_WIN32_WCE - -#ifndef _WIN32_WCE - #include "atlres.h" -#else // CE specific - #include "atlresce.h" -#endif // _WIN32_WCE - -// We need to disable this warning because of template class arguments -#pragma warning(disable: 4127) - - -/////////////////////////////////////////////////////////////////////////////// -// WTL version number - -#define _WTL_VER 0x0800 - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CMessageFilter -// CIdleHandler -// CMessageLoop -// -// CAppModule -// CServerAppModule -// -// Global functions: -// AtlGetDefaultGuiFont() -// AtlCreateBoldFont() -// AtlInitCommonControls() - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for Windows CE - -#ifdef _WIN32_WCE - -#ifndef SW_SHOWDEFAULT - #define SW_SHOWDEFAULT SW_SHOWNORMAL -#endif // !SW_SHOWDEFAULT - -// These get's OR-ed in a constant and will have no effect. -// Defining them reduces the number of #ifdefs required for CE. -#define LR_DEFAULTSIZE 0 -#define LR_LOADFROMFILE 0 - -#ifndef SM_CXCURSOR - #define SM_CXCURSOR 13 -#endif -#ifndef SM_CYCURSOR - #define SM_CYCURSOR 14 -#endif - -inline BOOL IsMenu(HMENU hMenu) -{ - MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; - ::SetLastError(0); - BOOL bRet = ::GetMenuItemInfo(hMenu, 0, TRUE, &mii); - if(!bRet) - bRet = (::GetLastError() != ERROR_INVALID_MENU_HANDLE) ? TRUE : FALSE; - return bRet; -} - -#if (_WIN32_WCE >= 410) -extern "C" void WINAPI ListView_SetItemSpacing(HWND hwndLV, int iHeight); -#endif // (_WIN32_WCE >= 410) - -inline int MulDiv(IN int nNumber, IN int nNumerator, IN int nDenominator) -{ - __int64 multiple = nNumber * nNumerator; - return static_cast(multiple / nDenominator); -} - -#if (_ATL_VER >= 0x0800) - -#ifndef _WTL_KEEP_WS_OVERLAPPEDWINDOW - #ifdef WS_OVERLAPPEDWINDOW - #undef WS_OVERLAPPEDWINDOW - #define WS_OVERLAPPEDWINDOW 0 - #endif // WS_OVERLAPPEDWINDOW -#endif // !_WTL_KEEP_WS_OVERLAPPEDWINDOW - -#ifndef RDW_FRAME - #define RDW_FRAME 0 -#endif // !RDW_FRAME - -#ifndef WM_WINDOWPOSCHANGING - #define WM_WINDOWPOSCHANGING 0 -#endif // !WM_WINDOWPOSCHANGING - -#define FreeResource(x) -#define UnlockResource(x) - -namespace ATL -{ - inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw() - { return E_NOTIMPL; } - inline HRESULT CComModule::RevokeClassObjects() throw() - { return E_NOTIMPL; } -}; // namespace ATL - -#ifndef lstrlenW - #define lstrlenW (int)ATL::lstrlenW -#endif // lstrlenW - -inline int WINAPI lstrlenA(LPCSTR lpszString) -{ return ATL::lstrlenA(lpszString); } - -#ifdef lstrcpyn - #undef lstrcpyn - #define lstrcpyn ATL::lstrcpynW -#endif // lstrcpyn - -#ifndef SetWindowLongPtrW - inline LONG_PTR tmp_SetWindowLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) - { - return( ::SetWindowLongW( hWnd, nIndex, LONG( dwNewLong ) ) ); - } - #define SetWindowLongPtrW tmp_SetWindowLongPtrW -#endif - -#ifndef GetWindowLongPtrW - inline LONG_PTR tmp_GetWindowLongPtrW( HWND hWnd, int nIndex ) - { - return( ::GetWindowLongW( hWnd, nIndex ) ); - } - #define GetWindowLongPtrW tmp_GetWindowLongPtrW -#endif - -#ifndef LongToPtr - #define LongToPtr(x) ((void*)x) -#endif - -#ifndef PtrToInt - #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) -#endif - -#else // !(_ATL_VER >= 0x0800) - -#ifdef lstrlenW - #undef lstrlenW - #define lstrlenW (int)::wcslen -#endif // lstrlenW - -#define lstrlenA (int)strlen - -#ifndef lstrcpyn - inline LPTSTR lstrcpyn(LPTSTR lpstrDest, LPCTSTR lpstrSrc, int nLength) - { - if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) - return NULL; - int nLen = min(lstrlen(lpstrSrc), nLength - 1); - LPTSTR lpstrRet = (LPTSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(TCHAR)); - lpstrDest[nLen] = 0; - return lpstrRet; - } -#endif // !lstrcpyn - -#ifndef lstrcpynW - inline LPWSTR lstrcpynW(LPWSTR lpstrDest, LPCWSTR lpstrSrc, int nLength) - { - return lstrcpyn(lpstrDest, lpstrSrc, nLength); // WinCE is Unicode only - } -#endif // !lstrcpynW - -#ifndef lstrcpynA - inline LPSTR lstrcpynA(LPSTR lpstrDest, LPCSTR lpstrSrc, int nLength) - { - if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) - return NULL; - int nLen = min(lstrlenA(lpstrSrc), nLength - 1); - LPSTR lpstrRet = (LPSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(char)); - lpstrDest[nLen] = 0; - return lpstrRet; - } -#endif // !lstrcpyn - -#ifdef TrackPopupMenu - #undef TrackPopupMenu -#endif // TrackPopupMenu - -#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \ -static CWndClassInfo& GetWndClassInfo() \ -{ \ - static CWndClassInfo wc = \ - { \ - { style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \ - }; \ - return wc; \ -} - -#ifndef _MAX_FNAME - #define _MAX_FNAME _MAX_PATH -#endif // _MAX_FNAME - -#if (_WIN32_WCE < 400) - #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) -#endif // (_WIN32_WCE < 400) - -#if (_WIN32_WCE < 410) - #define WHEEL_PAGESCROLL (UINT_MAX) - #define WHEEL_DELTA 120 -#endif // (_WIN32_WCE < 410) - -#ifdef DrawIcon - #undef DrawIcon -#endif - -#ifndef VARCMP_LT - #define VARCMP_LT 0 -#endif -#ifndef VARCMP_EQ - #define VARCMP_EQ 1 -#endif -#ifndef VARCMP_GT - #define VARCMP_GT 2 -#endif -#ifndef VARCMP_NULL - #define VARCMP_NULL 3 -#endif - -#ifndef RDW_ALLCHILDREN - #define RDW_ALLCHILDREN 0 -#endif - -#endif // !(_ATL_VER >= 0x0800) - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for using original VC++ 6.0 headers with WTL - -#ifndef _ATL_NO_OLD_HEADERS_WIN64 -#if !defined(_WIN64) && (_ATL_VER < 0x0700) - - #ifndef PSM_INSERTPAGE - #define PSM_INSERTPAGE (WM_USER + 119) - #endif // !PSM_INSERTPAGE - - #ifndef GetClassLongPtr - #define GetClassLongPtrA GetClassLongA - #define GetClassLongPtrW GetClassLongW - #ifdef UNICODE - #define GetClassLongPtr GetClassLongPtrW - #else - #define GetClassLongPtr GetClassLongPtrA - #endif // !UNICODE - #endif // !GetClassLongPtr - - #ifndef GCLP_HICONSM - #define GCLP_HICONSM (-34) - #endif // !GCLP_HICONSM - - #ifndef GetWindowLongPtr - #define GetWindowLongPtrA GetWindowLongA - #define GetWindowLongPtrW GetWindowLongW - #ifdef UNICODE - #define GetWindowLongPtr GetWindowLongPtrW - #else - #define GetWindowLongPtr GetWindowLongPtrA - #endif // !UNICODE - #endif // !GetWindowLongPtr - - #ifndef SetWindowLongPtr - #define SetWindowLongPtrA SetWindowLongA - #define SetWindowLongPtrW SetWindowLongW - #ifdef UNICODE - #define SetWindowLongPtr SetWindowLongPtrW - #else - #define SetWindowLongPtr SetWindowLongPtrA - #endif // !UNICODE - #endif // !SetWindowLongPtr - - #ifndef GWLP_WNDPROC - #define GWLP_WNDPROC (-4) - #endif - #ifndef GWLP_HINSTANCE - #define GWLP_HINSTANCE (-6) - #endif - #ifndef GWLP_HWNDPARENT - #define GWLP_HWNDPARENT (-8) - #endif - #ifndef GWLP_USERDATA - #define GWLP_USERDATA (-21) - #endif - #ifndef GWLP_ID - #define GWLP_ID (-12) - #endif - - #ifndef DWLP_MSGRESULT - #define DWLP_MSGRESULT 0 - #endif - - typedef long LONG_PTR; - typedef unsigned long ULONG_PTR; - typedef ULONG_PTR DWORD_PTR; - - #ifndef HandleToUlong - #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) ) - #endif - #ifndef HandleToLong - #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) - #endif - #ifndef LongToHandle - #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h)) - #endif - #ifndef PtrToUlong - #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) - #endif - #ifndef PtrToLong - #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) ) - #endif - #ifndef PtrToUint - #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) - #endif - #ifndef PtrToInt - #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) - #endif - #ifndef PtrToUshort - #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) - #endif - #ifndef PtrToShort - #define PtrToShort( p ) ((short)(LONG_PTR)(p) ) - #endif - #ifndef IntToPtr - #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i)) - #endif - #ifndef UIntToPtr - #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui)) - #endif - #ifndef LongToPtr - #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l)) - #endif - #ifndef ULongToPtr - #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul)) - #endif - -#endif // !defined(_WIN64) && (_ATL_VER < 0x0700) -#endif // !_ATL_NO_OLD_HEADERS_WIN64 - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for SecureHelper functions - -#ifndef _TRUNCATE - #define _TRUNCATE ((size_t)-1) -#endif - -#ifndef _ERRCODE_DEFINED - #define _ERRCODE_DEFINED - typedef int errno_t; -#endif - -#ifndef _SECURECRT_ERRCODE_VALUES_DEFINED - #define _SECURECRT_ERRCODE_VALUES_DEFINED - #define EINVAL 22 - #define STRUNCATE 80 -#endif - -#ifndef _countof - #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Miscellaneous global support - -// define useful macros from winuser.h -#ifndef IS_INTRESOURCE - #define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0) -#endif // IS_INTRESOURCE - -// protect template members from windowsx.h macros -#ifdef _INC_WINDOWSX - #undef SubclassWindow -#endif // _INC_WINDOWSX - -// define useful macros from windowsx.h -#ifndef GET_X_LPARAM - #define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam)) -#endif -#ifndef GET_Y_LPARAM - #define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam)) -#endif - -// Dummy structs for compiling with /CLR -#if (_MSC_VER >= 1300) && defined(_MANAGED) - __if_not_exists(_IMAGELIST::_IMAGELIST) { struct _IMAGELIST { }; } - __if_not_exists(_TREEITEM::_TREEITEM) { struct _TREEITEM { }; } - __if_not_exists(_PSP::_PSP) { struct _PSP { }; } -#endif - -// Define ATLVERIFY macro for ATL3 -#if (_ATL_VER < 0x0700) - #ifndef ATLVERIFY - #ifdef _DEBUG - #define ATLVERIFY(expr) ATLASSERT(expr) - #else - #define ATLVERIFY(expr) (expr) - #endif // DEBUG - #endif // ATLVERIFY -#endif // (_ATL_VER < 0x0700) - -// Forward declaration for ATL3 fix -#if (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) - namespace ATL { HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); }; -#endif - - -namespace WTL -{ - -#if (_ATL_VER >= 0x0700) - DECLARE_TRACE_CATEGORY(atlTraceUI); - #ifdef _DEBUG - __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI")); - #endif // _DEBUG -#else // !(_ATL_VER >= 0x0700) - enum wtlTraceFlags - { - atlTraceUI = 0x10000000 - }; -#endif // !(_ATL_VER >= 0x0700) - -// Windows version helper -inline bool AtlIsOldWindows() -{ - OSVERSIONINFO ovi = { 0 }; - ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - BOOL bRet = ::GetVersionEx(&ovi); - return (!bRet || !((ovi.dwMajorVersion >= 5) || (ovi.dwMajorVersion == 4 && ovi.dwMinorVersion >= 90))); -} - -// default GUI font helper -inline HFONT AtlGetDefaultGuiFont() -{ -#ifndef _WIN32_WCE - return (HFONT)::GetStockObject(DEFAULT_GUI_FONT); -#else // CE specific - return (HFONT)::GetStockObject(SYSTEM_FONT); -#endif // _WIN32_WCE -} - -// bold font helper (NOTE: Caller owns the font, and should destroy it when done using it) -inline HFONT AtlCreateBoldFont(HFONT hFont = NULL) -{ - if(hFont == NULL) - hFont = AtlGetDefaultGuiFont(); - ATLASSERT(hFont != NULL); - HFONT hFontBold = NULL; - LOGFONT lf = { 0 }; - if(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)) - { - lf.lfWeight = FW_BOLD; - hFontBold = ::CreateFontIndirect(&lf); - ATLASSERT(hFontBold != NULL); - } - else - { - ATLASSERT(FALSE); - } - return hFontBold; -} - -// Common Controls initialization helper -inline BOOL AtlInitCommonControls(DWORD dwFlags) -{ - INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), dwFlags }; - BOOL bRet = ::InitCommonControlsEx(&iccx); - ATLASSERT(bRet); - return bRet; -} - - -/////////////////////////////////////////////////////////////////////////////// -// RunTimeHelper - helper functions for Windows version and structure sizes - -// Not for Windows CE -#if defined(_WIN32_WCE) && !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) - #define _WTL_NO_RUNTIME_STRUCT_SIZE -#endif - -#ifndef _WTL_NO_RUNTIME_STRUCT_SIZE - -#ifndef _SIZEOF_STRUCT - #define _SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) -#endif - -#if (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) - #define REBARBANDINFO_V6_SIZE _SIZEOF_STRUCT(REBARBANDINFO, cxHeader) -#endif // (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) - -#if (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) - #define LVGROUP_V5_SIZE _SIZEOF_STRUCT(LVGROUP, uAlign) -#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) - -#if (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) - #define LVTILEINFO_V5_SIZE _SIZEOF_STRUCT(LVTILEINFO, puColumns) -#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) - #define MCHITTESTINFO_V1_SIZE _SIZEOF_STRUCT(MCHITTESTINFO, st) -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) - -#if !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) - #define NONCLIENTMETRICS_V1_SIZE _SIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont) -#endif // !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) - -#endif // !_WTL_NO_RUNTIME_STRUCT_SIZE - -namespace RunTimeHelper -{ -#ifndef _WIN32_WCE - inline bool IsCommCtrl6() - { - DWORD dwMajor = 0, dwMinor = 0; - HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - return (SUCCEEDED(hRet) && (dwMajor >= 6)); - } - - inline bool IsVista() - { - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - BOOL bRet = ::GetVersionEx(&ovi); - return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6)); - } -#endif // !_WIN32_WCE - - inline int SizeOf_REBARBANDINFO() - { - int nSize = sizeof(REBARBANDINFO); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - if(!(IsVista() && IsCommCtrl6())) - nSize = REBARBANDINFO_V6_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; - } - -#if (_WIN32_WINNT >= 0x501) - inline int SizeOf_LVGROUP() - { - int nSize = sizeof(LVGROUP); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - if(!IsVista()) - nSize = LVGROUP_V5_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; - } - - inline int SizeOf_LVTILEINFO() - { - int nSize = sizeof(LVTILEINFO); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - if(!IsVista()) - nSize = LVTILEINFO_V5_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; - } -#endif // (_WIN32_WINNT >= 0x501) - - inline int SizeOf_MCHITTESTINFO() - { - int nSize = sizeof(MCHITTESTINFO); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - if(!(IsVista() && IsCommCtrl6())) - nSize = MCHITTESTINFO_V1_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - return nSize; - } - -#ifndef _WIN32_WCE - inline int SizeOf_NONCLIENTMETRICS() - { - int nSize = sizeof(NONCLIENTMETRICS); -#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) - if(!IsVista()) - nSize = NONCLIENTMETRICS_V1_SIZE; -#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) - return nSize; - } -#endif // !_WIN32_WCE -}; - - -/////////////////////////////////////////////////////////////////////////////// -// ModuleHelper - helper functions for ATL3 and ATL7 module classes - -namespace ModuleHelper -{ - inline HINSTANCE GetModuleInstance() - { -#if (_ATL_VER >= 0x0700) - return ATL::_AtlBaseModule.GetModuleInstance(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->GetModuleInstance(); -#endif // !(_ATL_VER >= 0x0700) - } - - inline HINSTANCE GetResourceInstance() - { -#if (_ATL_VER >= 0x0700) - return ATL::_AtlBaseModule.GetResourceInstance(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->GetResourceInstance(); -#endif // !(_ATL_VER >= 0x0700) - } - - inline void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject) - { -#if (_ATL_VER >= 0x0700) - ATL::_AtlWinModule.AddCreateWndData(pData, pObject); -#else // !(_ATL_VER >= 0x0700) - ATL::_pModule->AddCreateWndData(pData, pObject); -#endif // !(_ATL_VER >= 0x0700) - } - - inline void* ExtractCreateWndData() - { -#if (_ATL_VER >= 0x0700) - return ATL::_AtlWinModule.ExtractCreateWndData(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->ExtractCreateWndData(); -#endif // !(_ATL_VER >= 0x0700) - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// SecureHelper - helper functions for VS2005 secure CRT - -namespace SecureHelper -{ - inline void strcpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::strcpy_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenA(lpstrSrc)) - ATLVERIFY(lstrcpyA(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::wcscpy_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenW(lpstrSrc)) - ATLVERIFY(lstrcpyW(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) - { -#ifdef _UNICODE - strcpyW_x(lpstrDest, cchDest, lpstrSrc); -#else - strcpyA_x(lpstrDest, cchDest, lpstrSrc); -#endif - } - - inline errno_t strncpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc, size_t cchCount) - { -#if _SECURE_ATL - return ATL::Checked::strncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - errno_t nRet = 0; - if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) - { - nRet = EINVAL; - } - else if(cchCount == _TRUNCATE) - { - cchCount = min(cchDest - 1, size_t(lstrlenA(lpstrSrc))); - nRet = STRUNCATE; - } - else if(cchDest <= cchCount) - { - lpstrDest[0] = 0; - nRet = EINVAL; - } - if(nRet == 0 || nRet == STRUNCATE) - nRet = (lstrcpynA(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; - ATLASSERT(nRet == 0 || nRet == STRUNCATE); - return nRet; -#endif - } - - inline errno_t strncpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc, size_t cchCount) - { -#if _SECURE_ATL - return ATL::Checked::wcsncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - errno_t nRet = 0; - if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) - { - nRet = EINVAL; - } - else if(cchCount == _TRUNCATE) - { - cchCount = min(cchDest - 1, size_t(lstrlenW(lpstrSrc))); - nRet = STRUNCATE; - } - else if(cchDest <= cchCount) - { - lpstrDest[0] = 0; - nRet = EINVAL; - } - if(nRet == 0 || nRet == STRUNCATE) - nRet = (lstrcpynW(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; - ATLASSERT(nRet == 0 || nRet == STRUNCATE); - return nRet; -#endif - } - - inline errno_t strncpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc, size_t cchCount) - { -#ifdef _UNICODE - return strncpyW_x(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - return strncpyA_x(lpstrDest, cchDest, lpstrSrc, cchCount); -#endif - } - - inline void strcatA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::strcat_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenA(lpstrSrc)) - ATLVERIFY(lstrcatA(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcatW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) - { -#if _SECURE_ATL - ATL::Checked::wcscat_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenW(lpstrSrc)) - ATLVERIFY(lstrcatW(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif - } - - inline void strcat_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) - { -#ifdef _UNICODE - strcatW_x(lpstrDest, cchDest, lpstrSrc); -#else - strcatA_x(lpstrDest, cchDest, lpstrSrc); -#endif - } - - inline void memcpy_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) - { -#if _SECURE_ATL - ATL::Checked::memcpy_s(pDest, cbDest, pSrc, cbSrc); -#else - if(cbDest >= cbSrc) - memcpy(pDest, pSrc, cbSrc); - else - ATLASSERT(FALSE); -#endif - } - - inline void memmove_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) - { -#if _SECURE_ATL - ATL::Checked::memmove_s(pDest, cbDest, pSrc, cbSrc); -#else - if(cbDest >= cbSrc) - memmove(pDest, pSrc, cbSrc); - else - ATLASSERT(FALSE); -#endif - } - - inline int vsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) - { -#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) - return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); -#else - cchBuff; // Avoid unused argument warning - return _vstprintf(lpstrBuff, lpstrFormat, args); -#endif - } - - inline int wvsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) - { -#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) - return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); -#else - cchBuff; // Avoid unused argument warning - return ::wvsprintf(lpstrBuff, lpstrFormat, args); -#endif - } - - inline int sprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) - { - va_list args; - va_start(args, lpstrFormat); - int nRes = vsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); - va_end(args); - return nRes; - } - - inline int wsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) - { - va_list args; - va_start(args, lpstrFormat); - int nRes = wvsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); - va_end(args); - return nRes; - } -}; // namespace SecureHelper - - -/////////////////////////////////////////////////////////////////////////////// -// CMessageFilter - Interface for message filter support - -class CMessageFilter -{ -public: - virtual BOOL PreTranslateMessage(MSG* pMsg) = 0; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CIdleHandler - Interface for idle processing - -class CIdleHandler -{ -public: - virtual BOOL OnIdle() = 0; -}; - -#ifndef _ATL_NO_OLD_NAMES - // for compatilibility with old names only - typedef CIdleHandler CUpdateUIObject; - #define DoUpdate OnIdle -#endif // !_ATL_NO_OLD_NAMES - - -/////////////////////////////////////////////////////////////////////////////// -// CMessageLoop - message loop implementation - -class CMessageLoop -{ -public: - ATL::CSimpleArray m_aMsgFilter; - ATL::CSimpleArray m_aIdleHandler; - MSG m_msg; - -// Message filter operations - BOOL AddMessageFilter(CMessageFilter* pMessageFilter) - { - return m_aMsgFilter.Add(pMessageFilter); - } - - BOOL RemoveMessageFilter(CMessageFilter* pMessageFilter) - { - return m_aMsgFilter.Remove(pMessageFilter); - } - -// Idle handler operations - BOOL AddIdleHandler(CIdleHandler* pIdleHandler) - { - return m_aIdleHandler.Add(pIdleHandler); - } - - BOOL RemoveIdleHandler(CIdleHandler* pIdleHandler) - { - return m_aIdleHandler.Remove(pIdleHandler); - } - -#ifndef _ATL_NO_OLD_NAMES - // for compatilibility with old names only - BOOL AddUpdateUI(CIdleHandler* pIdleHandler) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and AddUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); - return AddIdleHandler(pIdleHandler); - } - - BOOL RemoveUpdateUI(CIdleHandler* pIdleHandler) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and RemoveUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); - return RemoveIdleHandler(pIdleHandler); - } -#endif // !_ATL_NO_OLD_NAMES - -// message loop - int Run() - { - BOOL bDoIdle = TRUE; - int nIdleCount = 0; - BOOL bRet; - - for(;;) - { - while(bDoIdle && !::PeekMessage(&m_msg, NULL, 0, 0, PM_NOREMOVE)) - { - if(!OnIdle(nIdleCount++)) - bDoIdle = FALSE; - } - - bRet = ::GetMessage(&m_msg, NULL, 0, 0); - - if(bRet == -1) - { - ATLTRACE2(atlTraceUI, 0, _T("::GetMessage returned -1 (error)\n")); - continue; // error, don't process - } - else if(!bRet) - { - ATLTRACE2(atlTraceUI, 0, _T("CMessageLoop::Run - exiting\n")); - break; // WM_QUIT, exit message loop - } - - if(!PreTranslateMessage(&m_msg)) - { - ::TranslateMessage(&m_msg); - ::DispatchMessage(&m_msg); - } - - if(IsIdleMessage(&m_msg)) - { - bDoIdle = TRUE; - nIdleCount = 0; - } - } - - return (int)m_msg.wParam; - } - - static BOOL IsIdleMessage(MSG* pMsg) - { - // These messages should NOT cause idle processing - switch(pMsg->message) - { - case WM_MOUSEMOVE: -#ifndef _WIN32_WCE - case WM_NCMOUSEMOVE: -#endif // !_WIN32_WCE - case WM_PAINT: - case 0x0118: // WM_SYSTIMER (caret blink) - return FALSE; - } - - return TRUE; - } - -// Overrideables - // Override to change message filtering - virtual BOOL PreTranslateMessage(MSG* pMsg) - { - // loop backwards - for(int i = m_aMsgFilter.GetSize() - 1; i >= 0; i--) - { - CMessageFilter* pMessageFilter = m_aMsgFilter[i]; - if(pMessageFilter != NULL && pMessageFilter->PreTranslateMessage(pMsg)) - return TRUE; - } - return FALSE; // not translated - } - - // override to change idle processing - virtual BOOL OnIdle(int /*nIdleCount*/) - { - for(int i = 0; i < m_aIdleHandler.GetSize(); i++) - { - CIdleHandler* pIdleHandler = m_aIdleHandler[i]; - if(pIdleHandler != NULL) - pIdleHandler->OnIdle(); - } - return FALSE; // don't continue - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CStaticDataInitCriticalSectionLock and CWindowCreateCriticalSectionLock -// internal classes to manage critical sections for both ATL3 and ATL7 - -class CStaticDataInitCriticalSectionLock -{ -public: -#if (_ATL_VER >= 0x0700) - ATL::CComCritSecLock m_cslock; - - CStaticDataInitCriticalSectionLock() : m_cslock(ATL::_pAtlModule->m_csStaticDataInitAndTypeInfo, false) - { } -#endif // (_ATL_VER >= 0x0700) - - HRESULT Lock() - { -#if (_ATL_VER >= 0x0700) - return m_cslock.Lock(); -#else // !(_ATL_VER >= 0x0700) - ::EnterCriticalSection(&ATL::_pModule->m_csStaticDataInit); - return S_OK; -#endif // !(_ATL_VER >= 0x0700) - } - - void Unlock() - { -#if (_ATL_VER >= 0x0700) - m_cslock.Unlock(); -#else // !(_ATL_VER >= 0x0700) - ::LeaveCriticalSection(&ATL::_pModule->m_csStaticDataInit); -#endif // !(_ATL_VER >= 0x0700) - } -}; - - -class CWindowCreateCriticalSectionLock -{ -public: -#if (_ATL_VER >= 0x0700) - ATL::CComCritSecLock m_cslock; - - CWindowCreateCriticalSectionLock() : m_cslock(ATL::_AtlWinModule.m_csWindowCreate, false) - { } -#endif // (_ATL_VER >= 0x0700) - - HRESULT Lock() - { -#if (_ATL_VER >= 0x0700) - return m_cslock.Lock(); -#else // !(_ATL_VER >= 0x0700) - ::EnterCriticalSection(&ATL::_pModule->m_csWindowCreate); - return S_OK; -#endif // !(_ATL_VER >= 0x0700) - } - - void Unlock() - { -#if (_ATL_VER >= 0x0700) - m_cslock.Unlock(); -#else // !(_ATL_VER >= 0x0700) - ::LeaveCriticalSection(&ATL::_pModule->m_csWindowCreate); -#endif // !(_ATL_VER >= 0x0700) - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTempBuffer - helper class for stack allocations for ATL3 - -#ifndef _WTL_STACK_ALLOC_THRESHOLD - #define _WTL_STACK_ALLOC_THRESHOLD 512 -#endif - -#if (_ATL_VER >= 0x0700) - -using ATL::CTempBuffer; - -#else // !(_ATL_VER >= 0x0700) - -#ifndef SIZE_MAX - #ifdef _WIN64 - #define SIZE_MAX _UI64_MAX - #else - #define SIZE_MAX UINT_MAX - #endif -#endif - -#pragma warning(disable: 4284) // warning for operator -> - -template -class CTempBuffer -{ -public: - CTempBuffer() : m_p(NULL) - { - } - - CTempBuffer(size_t nElements) : m_p(NULL) - { - Allocate(nElements); - } - - ~CTempBuffer() - { - if(m_p != reinterpret_cast(m_abFixedBuffer)) - free(m_p); - } - - operator T*() const - { - return m_p; - } - - T* operator ->() const - { - ATLASSERT(m_p != NULL); - return m_p; - } - - T* Allocate(size_t nElements) - { - ATLASSERT(nElements <= (SIZE_MAX / sizeof(T))); - return AllocateBytes(nElements * sizeof(T)); - } - - T* AllocateBytes(size_t nBytes) - { - ATLASSERT(m_p == NULL); - if(nBytes > t_nFixedBytes) - m_p = static_cast(malloc(nBytes)); - else - m_p = reinterpret_cast(m_abFixedBuffer); - - return m_p; - } - -private: - T* m_p; - BYTE m_abFixedBuffer[t_nFixedBytes]; -}; - -#pragma warning(default: 4284) - -#endif // !(_ATL_VER >= 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// CAppModule - module class for an application - -class CAppModule : public ATL::CComModule -{ -public: - DWORD m_dwMainThreadID; - ATL::CSimpleMap* m_pMsgLoopMap; - ATL::CSimpleArray* m_pSettingChangeNotify; - -// Overrides of CComModule::Init and Term - HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) - { - HRESULT hRet = CComModule::Init(pObjMap, hInstance, pLibID); - if(FAILED(hRet)) - return hRet; - - m_dwMainThreadID = ::GetCurrentThreadId(); - typedef ATL::CSimpleMap _mapClass; - m_pMsgLoopMap = NULL; - ATLTRY(m_pMsgLoopMap = new _mapClass); - if(m_pMsgLoopMap == NULL) - return E_OUTOFMEMORY; - m_pSettingChangeNotify = NULL; - - return hRet; - } - - void Term() - { - TermSettingChangeNotify(); - delete m_pMsgLoopMap; - CComModule::Term(); - } - -// Message loop map methods - BOOL AddMessageLoop(CMessageLoop* pMsgLoop) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddMessageLoop.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - ATLASSERT(pMsgLoop != NULL); - ATLASSERT(m_pMsgLoopMap->Lookup(::GetCurrentThreadId()) == NULL); // not in map yet - - BOOL bRet = m_pMsgLoopMap->Add(::GetCurrentThreadId(), pMsgLoop); - - lock.Unlock(); - - return bRet; - } - - BOOL RemoveMessageLoop() - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveMessageLoop.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - BOOL bRet = m_pMsgLoopMap->Remove(::GetCurrentThreadId()); - - lock.Unlock(); - - return bRet; - } - - CMessageLoop* GetMessageLoop(DWORD dwThreadID = ::GetCurrentThreadId()) const - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::GetMessageLoop.\n")); - ATLASSERT(FALSE); - return NULL; - } - - CMessageLoop* pLoop = m_pMsgLoopMap->Lookup(dwThreadID); - - lock.Unlock(); - - return pLoop; - } - -// Setting change notify methods - // Note: Call this from the main thread for MSDI apps - BOOL InitSettingChangeNotify(DLGPROC pfnDlgProc = _SettingChangeDlgProc) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::InitSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - if(m_pSettingChangeNotify == NULL) - { - typedef ATL::CSimpleArray _notifyClass; - ATLTRY(m_pSettingChangeNotify = new _notifyClass); - ATLASSERT(m_pSettingChangeNotify != NULL); - } - - BOOL bRet = (m_pSettingChangeNotify != NULL); - if(bRet && m_pSettingChangeNotify->GetSize() == 0) - { - // init everything - _ATL_EMPTY_DLGTEMPLATE templ; - HWND hNtfWnd = ::CreateDialogIndirect(GetModuleInstance(), &templ, NULL, pfnDlgProc); - ATLASSERT(::IsWindow(hNtfWnd)); - if(::IsWindow(hNtfWnd)) - { -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, (LONG_PTR)this); -#else - ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, PtrToLong(this)); -#endif - bRet = m_pSettingChangeNotify->Add(hNtfWnd); - } - else - { - bRet = FALSE; - } - } - - lock.Unlock(); - - return bRet; - } - - void TermSettingChangeNotify() - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::TermSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return; - } - - if(m_pSettingChangeNotify != NULL && m_pSettingChangeNotify->GetSize() > 0) - ::DestroyWindow((*m_pSettingChangeNotify)[0]); - delete m_pSettingChangeNotify; - m_pSettingChangeNotify = NULL; - - lock.Unlock(); - } - - BOOL AddSettingChangeNotify(HWND hWnd) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - ATLASSERT(::IsWindow(hWnd)); - BOOL bRet = FALSE; - if(InitSettingChangeNotify() != FALSE) - bRet = m_pSettingChangeNotify->Add(hWnd); - - lock.Unlock(); - - return bRet; - } - - BOOL RemoveSettingChangeNotify(HWND hWnd) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveSettingChangeNotify.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - BOOL bRet = FALSE; - if(m_pSettingChangeNotify != NULL) - bRet = m_pSettingChangeNotify->Remove(hWnd); - - lock.Unlock(); - - return bRet; - } - -// Implementation - setting change notify dialog template and dialog procedure - struct _ATL_EMPTY_DLGTEMPLATE : DLGTEMPLATE - { - _ATL_EMPTY_DLGTEMPLATE() - { - memset(this, 0, sizeof(_ATL_EMPTY_DLGTEMPLATE)); - style = WS_POPUP; - } - WORD wMenu, wClass, wTitle; - }; - -#ifdef _WIN64 - static INT_PTR CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#else - static BOOL CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#endif - { - if(uMsg == WM_SETTINGCHANGE) - { -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - CAppModule* pModule = (CAppModule*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); -#else - CAppModule* pModule = (CAppModule*)LongToPtr(::GetWindowLongPtr(hWnd, GWLP_USERDATA)); -#endif - ATLASSERT(pModule != NULL); - ATLASSERT(pModule->m_pSettingChangeNotify != NULL); - const UINT uTimeout = 1500; // ms - for(int i = 1; i < pModule->m_pSettingChangeNotify->GetSize(); i++) - { -#if !defined(_WIN32_WCE) - ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_ABORTIFHUNG, uTimeout, NULL); -#elif(_WIN32_WCE >= 400) // CE specific - ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_NORMAL, uTimeout, NULL); -#else // _WIN32_WCE < 400 specific - uTimeout; - ::SendMessage((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam); -#endif - } - return TRUE; - } - return FALSE; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CServerAppModule - module class for a COM server application - -class CServerAppModule : public CAppModule -{ -public: - HANDLE m_hEventShutdown; - bool m_bActivity; - DWORD m_dwTimeOut; - DWORD m_dwPause; - -// Override of CAppModule::Init - HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) - { - m_dwTimeOut = 5000; - m_dwPause = 1000; - return CAppModule::Init(pObjMap, hInstance, pLibID); - } - - void Term() - { - if(m_hEventShutdown != NULL && ::CloseHandle(m_hEventShutdown)) - m_hEventShutdown = NULL; - CAppModule::Term(); - } - -// COM Server methods - LONG Unlock() - { - LONG lRet = CComModule::Unlock(); - if(lRet == 0) - { - m_bActivity = true; - ::SetEvent(m_hEventShutdown); // tell monitor that we transitioned to zero - } - return lRet; - } - - void MonitorShutdown() - { - for(;;) - { - ::WaitForSingleObject(m_hEventShutdown, INFINITE); - DWORD dwWait = 0; - do - { - m_bActivity = false; - dwWait = ::WaitForSingleObject(m_hEventShutdown, m_dwTimeOut); - } - while(dwWait == WAIT_OBJECT_0); - // timed out - if(!m_bActivity && m_nLockCnt == 0) // if no activity let's really bail - { -#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)) && defined(_ATL_FREE_THREADED) && !defined(_WIN32_WCE) - ::CoSuspendClassObjects(); - if(!m_bActivity && m_nLockCnt == 0) -#endif - break; - } - } - // This handle should be valid now. If it isn't, - // check if _Module.Term was called first (it shouldn't) - if(::CloseHandle(m_hEventShutdown)) - m_hEventShutdown = NULL; - ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0); - } - - bool StartMonitor() - { - m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL); - if(m_hEventShutdown == NULL) - return false; - DWORD dwThreadID = 0; -#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) - HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))MonitorProc, this, 0, (UINT*)&dwThreadID); -#else - HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID); -#endif - bool bRet = (hThread != NULL); - if(bRet) - ::CloseHandle(hThread); - return bRet; - } - - static DWORD WINAPI MonitorProc(void* pv) - { - CServerAppModule* p = (CServerAppModule*)pv; - p->MonitorShutdown(); - return 0; - } - -#if (_ATL_VER < 0x0700) - // search for an occurence of string p2 in string p1 - static LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2) - { - while(p1 != NULL && *p1 != NULL) - { - LPCTSTR p = p2; - while(p != NULL && *p != NULL) - { - if(*p1 == *p) - return ::CharNext(p1); - p = ::CharNext(p); - } - p1 = ::CharNext(p1); - } - return NULL; - } -#endif // (_ATL_VER < 0x0700) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CString forward reference (enables CString use in atluser.h and atlgdi.h) - -#if defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) - #define _WTL_USE_CSTRING -#endif // defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) - -#ifdef _WTL_USE_CSTRING - class CString; // forward declaration (include atlmisc.h for the whole class) -#endif // _WTL_USE_CSTRING - -// CString namespace -#ifndef _CSTRING_NS - #ifdef __ATLSTR_H__ - #define _CSTRING_NS ATL - #else - #define _CSTRING_NS WTL - #endif -#endif // _CSTRING_NS - -// Type classes namespace -#ifndef _WTYPES_NS - #ifdef __ATLTYPES_H__ - #define _WTYPES_NS - #else - #define _WTYPES_NS WTL - #endif -#endif // _WTYPES_NS - -}; // namespace WTL - - -/////////////////////////////////////////////////////////////////////////////// -// General DLL version helpers (excluded from atlbase.h if _ATL_DLL is defined) - -#if (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) - -namespace ATL -{ - -inline HRESULT AtlGetDllVersion(HINSTANCE hInstDLL, DLLVERSIONINFO* pDllVersionInfo) -{ - ATLASSERT(pDllVersionInfo != NULL); - if(pDllVersionInfo == NULL) - return E_INVALIDARG; - - // We must get this function explicitly because some DLLs don't implement it. - DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC)::GetProcAddress(hInstDLL, "DllGetVersion"); - if(pfnDllGetVersion == NULL) - return E_NOTIMPL; - - return (*pfnDllGetVersion)(pDllVersionInfo); -} - -inline HRESULT AtlGetDllVersion(LPCTSTR lpstrDllName, DLLVERSIONINFO* pDllVersionInfo) -{ - HINSTANCE hInstDLL = ::LoadLibrary(lpstrDllName); - if(hInstDLL == NULL) - return E_FAIL; - HRESULT hRet = AtlGetDllVersion(hInstDLL, pDllVersionInfo); - ::FreeLibrary(hInstDLL); - return hRet; -} - -// Common Control Versions: -// Win95/WinNT 4.0 maj=4 min=00 -// IE 3.x maj=4 min=70 -// IE 4.0 maj=4 min=71 -inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) -{ - ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); - if(pdwMajor == NULL || pdwMinor == NULL) - return E_INVALIDARG; - - DLLVERSIONINFO dvi; - ::ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - HRESULT hRet = AtlGetDllVersion(_T("comctl32.dll"), &dvi); - - if(SUCCEEDED(hRet)) - { - *pdwMajor = dvi.dwMajorVersion; - *pdwMinor = dvi.dwMinorVersion; - } - else if(hRet == E_NOTIMPL) - { - // If DllGetVersion is not there, then the DLL is a version - // previous to the one shipped with IE 3.x - *pdwMajor = 4; - *pdwMinor = 0; - hRet = S_OK; - } - - return hRet; -} - -// Shell Versions: -// Win95/WinNT 4.0 maj=4 min=00 -// IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00 -// IE 4.0 with Web Integrated Desktop maj=4 min=71 -// IE 4.01 with Web Integrated Desktop maj=4 min=72 -inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) -{ - ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); - if(pdwMajor == NULL || pdwMinor == NULL) - return E_INVALIDARG; - - DLLVERSIONINFO dvi; - ::ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - HRESULT hRet = AtlGetDllVersion(_T("shell32.dll"), &dvi); - - if(SUCCEEDED(hRet)) - { - *pdwMajor = dvi.dwMajorVersion; - *pdwMinor = dvi.dwMinorVersion; - } - else if(hRet == E_NOTIMPL) - { - // If DllGetVersion is not there, then the DLL is a version - // previous to the one shipped with IE 4.x - *pdwMajor = 4; - *pdwMinor = 0; - hRet = S_OK; - } - - return hRet; -} - -}; // namespace ATL - -#endif // (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) - - -// These are always included -#include "atlwinx.h" -#include "atluser.h" -#include "atlgdi.h" - -#ifndef _WTL_NO_AUTOMATIC_NAMESPACE -using namespace WTL; -#endif // !_WTL_NO_AUTOMATIC_NAMESPACE - -#endif // __ATLAPP_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLAPP_H__ +#define __ATLAPP_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLBASE_H__ + #error atlapp.h requires atlbase.h to be included first +#endif + +#ifndef _WIN32_WCE + #if (WINVER < 0x0400) + #error WTL requires Windows version 4.0 or higher + #endif + + #if (_WIN32_IE < 0x0300) + #error WTL requires IE version 3.0 or higher + #endif +#endif + +#ifdef _ATL_NO_COMMODULE + #error WTL requires that _ATL_NO_COMMODULE is not defined +#endif // _ATL_NO_COMMODULE + +#if defined(_WIN32_WCE) && defined(_ATL_MIN_CRT) + #pragma message("Warning: WTL for Windows CE doesn't use _ATL_MIN_CRT") +#endif // defined(_WIN32_WCE) && defined(_ATL_MIN_CRT) + +#include +#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) + #include // for _beginthreadex +#endif + +#if (_ATL_VER < 0x0800) && !defined(_DEBUG) + #include +#endif + +#include +#ifndef _WIN32_WCE +#pragma comment(lib, "comctl32.lib") +#endif // !_WIN32_WCE + +#ifndef _WIN32_WCE + #include "atlres.h" +#else // CE specific + #include "atlresce.h" +#endif // _WIN32_WCE + +// We need to disable this warning because of template class arguments +#pragma warning(disable: 4127) + + +/////////////////////////////////////////////////////////////////////////////// +// WTL version number + +#define _WTL_VER 0x0800 + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CMessageFilter +// CIdleHandler +// CMessageLoop +// +// CAppModule +// CServerAppModule +// +// Global functions: +// AtlGetDefaultGuiFont() +// AtlCreateBoldFont() +// AtlInitCommonControls() + + +/////////////////////////////////////////////////////////////////////////////// +// Global support for Windows CE + +#ifdef _WIN32_WCE + +#ifndef SW_SHOWDEFAULT + #define SW_SHOWDEFAULT SW_SHOWNORMAL +#endif // !SW_SHOWDEFAULT + +// These get's OR-ed in a constant and will have no effect. +// Defining them reduces the number of #ifdefs required for CE. +#define LR_DEFAULTSIZE 0 +#define LR_LOADFROMFILE 0 + +#ifndef SM_CXCURSOR + #define SM_CXCURSOR 13 +#endif +#ifndef SM_CYCURSOR + #define SM_CYCURSOR 14 +#endif + +inline BOOL IsMenu(HMENU hMenu) +{ + MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; + ::SetLastError(0); + BOOL bRet = ::GetMenuItemInfo(hMenu, 0, TRUE, &mii); + if(!bRet) + bRet = (::GetLastError() != ERROR_INVALID_MENU_HANDLE) ? TRUE : FALSE; + return bRet; +} + +#if (_WIN32_WCE >= 410) +extern "C" void WINAPI ListView_SetItemSpacing(HWND hwndLV, int iHeight); +#endif // (_WIN32_WCE >= 410) + +inline int MulDiv(IN int nNumber, IN int nNumerator, IN int nDenominator) +{ + __int64 multiple = nNumber * nNumerator; + return static_cast(multiple / nDenominator); +} + +#if (_ATL_VER >= 0x0800) + +#ifndef _WTL_KEEP_WS_OVERLAPPEDWINDOW + #ifdef WS_OVERLAPPEDWINDOW + #undef WS_OVERLAPPEDWINDOW + #define WS_OVERLAPPEDWINDOW 0 + #endif // WS_OVERLAPPEDWINDOW +#endif // !_WTL_KEEP_WS_OVERLAPPEDWINDOW + +#ifndef RDW_FRAME + #define RDW_FRAME 0 +#endif // !RDW_FRAME + +#ifndef WM_WINDOWPOSCHANGING + #define WM_WINDOWPOSCHANGING 0 +#endif // !WM_WINDOWPOSCHANGING + +#define FreeResource(x) +#define UnlockResource(x) + +namespace ATL +{ + inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw() + { return E_NOTIMPL; } + inline HRESULT CComModule::RevokeClassObjects() throw() + { return E_NOTIMPL; } +}; // namespace ATL + +#ifndef lstrlenW + #define lstrlenW (int)ATL::lstrlenW +#endif // lstrlenW + +inline int WINAPI lstrlenA(LPCSTR lpszString) +{ return ATL::lstrlenA(lpszString); } + +#ifdef lstrcpyn + #undef lstrcpyn + #define lstrcpyn ATL::lstrcpynW +#endif // lstrcpyn + +#ifndef SetWindowLongPtrW + inline LONG_PTR tmp_SetWindowLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) + { + return( ::SetWindowLongW( hWnd, nIndex, LONG( dwNewLong ) ) ); + } + #define SetWindowLongPtrW tmp_SetWindowLongPtrW +#endif + +#ifndef GetWindowLongPtrW + inline LONG_PTR tmp_GetWindowLongPtrW( HWND hWnd, int nIndex ) + { + return( ::GetWindowLongW( hWnd, nIndex ) ); + } + #define GetWindowLongPtrW tmp_GetWindowLongPtrW +#endif + +#ifndef LongToPtr + #define LongToPtr(x) ((void*)x) +#endif + +#ifndef PtrToInt + #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) +#endif + +#else // !(_ATL_VER >= 0x0800) + +#ifdef lstrlenW + #undef lstrlenW + #define lstrlenW (int)::wcslen +#endif // lstrlenW + +#define lstrlenA (int)strlen + +#ifndef lstrcpyn + inline LPTSTR lstrcpyn(LPTSTR lpstrDest, LPCTSTR lpstrSrc, int nLength) + { + if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) + return NULL; + int nLen = min(lstrlen(lpstrSrc), nLength - 1); + LPTSTR lpstrRet = (LPTSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(TCHAR)); + lpstrDest[nLen] = 0; + return lpstrRet; + } +#endif // !lstrcpyn + +#ifndef lstrcpynW + inline LPWSTR lstrcpynW(LPWSTR lpstrDest, LPCWSTR lpstrSrc, int nLength) + { + return lstrcpyn(lpstrDest, lpstrSrc, nLength); // WinCE is Unicode only + } +#endif // !lstrcpynW + +#ifndef lstrcpynA + inline LPSTR lstrcpynA(LPSTR lpstrDest, LPCSTR lpstrSrc, int nLength) + { + if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) + return NULL; + int nLen = min(lstrlenA(lpstrSrc), nLength - 1); + LPSTR lpstrRet = (LPSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(char)); + lpstrDest[nLen] = 0; + return lpstrRet; + } +#endif // !lstrcpyn + +#ifdef TrackPopupMenu + #undef TrackPopupMenu +#endif // TrackPopupMenu + +#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \ +static CWndClassInfo& GetWndClassInfo() \ +{ \ + static CWndClassInfo wc = \ + { \ + { style, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ + NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \ + }; \ + return wc; \ +} + +#ifndef _MAX_FNAME + #define _MAX_FNAME _MAX_PATH +#endif // _MAX_FNAME + +#if (_WIN32_WCE < 400) + #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) +#endif // (_WIN32_WCE < 400) + +#if (_WIN32_WCE < 410) + #define WHEEL_PAGESCROLL (UINT_MAX) + #define WHEEL_DELTA 120 +#endif // (_WIN32_WCE < 410) + +#ifdef DrawIcon + #undef DrawIcon +#endif + +#ifndef VARCMP_LT + #define VARCMP_LT 0 +#endif +#ifndef VARCMP_EQ + #define VARCMP_EQ 1 +#endif +#ifndef VARCMP_GT + #define VARCMP_GT 2 +#endif +#ifndef VARCMP_NULL + #define VARCMP_NULL 3 +#endif + +#ifndef RDW_ALLCHILDREN + #define RDW_ALLCHILDREN 0 +#endif + +#endif // !(_ATL_VER >= 0x0800) + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// Global support for using original VC++ 6.0 headers with WTL + +#ifndef _ATL_NO_OLD_HEADERS_WIN64 +#if !defined(_WIN64) && (_ATL_VER < 0x0700) + + #ifndef PSM_INSERTPAGE + #define PSM_INSERTPAGE (WM_USER + 119) + #endif // !PSM_INSERTPAGE + + #ifndef GetClassLongPtr + #define GetClassLongPtrA GetClassLongA + #define GetClassLongPtrW GetClassLongW + #ifdef UNICODE + #define GetClassLongPtr GetClassLongPtrW + #else + #define GetClassLongPtr GetClassLongPtrA + #endif // !UNICODE + #endif // !GetClassLongPtr + + #ifndef GCLP_HICONSM + #define GCLP_HICONSM (-34) + #endif // !GCLP_HICONSM + + #ifndef GetWindowLongPtr + #define GetWindowLongPtrA GetWindowLongA + #define GetWindowLongPtrW GetWindowLongW + #ifdef UNICODE + #define GetWindowLongPtr GetWindowLongPtrW + #else + #define GetWindowLongPtr GetWindowLongPtrA + #endif // !UNICODE + #endif // !GetWindowLongPtr + + #ifndef SetWindowLongPtr + #define SetWindowLongPtrA SetWindowLongA + #define SetWindowLongPtrW SetWindowLongW + #ifdef UNICODE + #define SetWindowLongPtr SetWindowLongPtrW + #else + #define SetWindowLongPtr SetWindowLongPtrA + #endif // !UNICODE + #endif // !SetWindowLongPtr + + #ifndef GWLP_WNDPROC + #define GWLP_WNDPROC (-4) + #endif + #ifndef GWLP_HINSTANCE + #define GWLP_HINSTANCE (-6) + #endif + #ifndef GWLP_HWNDPARENT + #define GWLP_HWNDPARENT (-8) + #endif + #ifndef GWLP_USERDATA + #define GWLP_USERDATA (-21) + #endif + #ifndef GWLP_ID + #define GWLP_ID (-12) + #endif + + #ifndef DWLP_MSGRESULT + #define DWLP_MSGRESULT 0 + #endif + + typedef long LONG_PTR; + typedef unsigned long ULONG_PTR; + typedef ULONG_PTR DWORD_PTR; + + #ifndef HandleToUlong + #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) ) + #endif + #ifndef HandleToLong + #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) + #endif + #ifndef LongToHandle + #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h)) + #endif + #ifndef PtrToUlong + #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) + #endif + #ifndef PtrToLong + #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) ) + #endif + #ifndef PtrToUint + #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) + #endif + #ifndef PtrToInt + #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) + #endif + #ifndef PtrToUshort + #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) + #endif + #ifndef PtrToShort + #define PtrToShort( p ) ((short)(LONG_PTR)(p) ) + #endif + #ifndef IntToPtr + #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i)) + #endif + #ifndef UIntToPtr + #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui)) + #endif + #ifndef LongToPtr + #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l)) + #endif + #ifndef ULongToPtr + #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul)) + #endif + +#endif // !defined(_WIN64) && (_ATL_VER < 0x0700) +#endif // !_ATL_NO_OLD_HEADERS_WIN64 + + +/////////////////////////////////////////////////////////////////////////////// +// Global support for SecureHelper functions + +#ifndef _TRUNCATE + #define _TRUNCATE ((size_t)-1) +#endif + +#ifndef _ERRCODE_DEFINED + #define _ERRCODE_DEFINED + typedef int errno_t; +#endif + +#ifndef _SECURECRT_ERRCODE_VALUES_DEFINED + #define _SECURECRT_ERRCODE_VALUES_DEFINED + #define EINVAL 22 + #define STRUNCATE 80 +#endif + +#ifndef _countof + #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Miscellaneous global support + +// define useful macros from winuser.h +#ifndef IS_INTRESOURCE + #define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0) +#endif // IS_INTRESOURCE + +// protect template members from windowsx.h macros +#ifdef _INC_WINDOWSX + #undef SubclassWindow +#endif // _INC_WINDOWSX + +// define useful macros from windowsx.h +#ifndef GET_X_LPARAM + #define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam)) +#endif +#ifndef GET_Y_LPARAM + #define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam)) +#endif + +// Dummy structs for compiling with /CLR +#if (_MSC_VER >= 1300) && defined(_MANAGED) + __if_not_exists(_IMAGELIST::_IMAGELIST) { struct _IMAGELIST { }; } + __if_not_exists(_TREEITEM::_TREEITEM) { struct _TREEITEM { }; } + __if_not_exists(_PSP::_PSP) { struct _PSP { }; } +#endif + +// Define ATLVERIFY macro for ATL3 +#if (_ATL_VER < 0x0700) + #ifndef ATLVERIFY + #ifdef _DEBUG + #define ATLVERIFY(expr) ATLASSERT(expr) + #else + #define ATLVERIFY(expr) (expr) + #endif // DEBUG + #endif // ATLVERIFY +#endif // (_ATL_VER < 0x0700) + +// Forward declaration for ATL3 fix +#if (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) + namespace ATL { HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); }; +#endif + + +namespace WTL +{ + +#if (_ATL_VER >= 0x0700) + DECLARE_TRACE_CATEGORY(atlTraceUI); + #ifdef _DEBUG + __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI")); + #endif // _DEBUG +#else // !(_ATL_VER >= 0x0700) + enum wtlTraceFlags + { + atlTraceUI = 0x10000000 + }; +#endif // !(_ATL_VER >= 0x0700) + +// Windows version helper +inline bool AtlIsOldWindows() +{ + OSVERSIONINFO ovi = { 0 }; + ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + BOOL bRet = ::GetVersionEx(&ovi); + return (!bRet || !((ovi.dwMajorVersion >= 5) || (ovi.dwMajorVersion == 4 && ovi.dwMinorVersion >= 90))); +} + +// default GUI font helper +inline HFONT AtlGetDefaultGuiFont() +{ +#ifndef _WIN32_WCE + return (HFONT)::GetStockObject(DEFAULT_GUI_FONT); +#else // CE specific + return (HFONT)::GetStockObject(SYSTEM_FONT); +#endif // _WIN32_WCE +} + +// bold font helper (NOTE: Caller owns the font, and should destroy it when done using it) +inline HFONT AtlCreateBoldFont(HFONT hFont = NULL) +{ + if(hFont == NULL) + hFont = AtlGetDefaultGuiFont(); + ATLASSERT(hFont != NULL); + HFONT hFontBold = NULL; + LOGFONT lf = { 0 }; + if(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)) + { + lf.lfWeight = FW_BOLD; + hFontBold = ::CreateFontIndirect(&lf); + ATLASSERT(hFontBold != NULL); + } + else + { + ATLASSERT(FALSE); + } + return hFontBold; +} + +// Common Controls initialization helper +inline BOOL AtlInitCommonControls(DWORD dwFlags) +{ + INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), dwFlags }; + BOOL bRet = ::InitCommonControlsEx(&iccx); + ATLASSERT(bRet); + return bRet; +} + + +/////////////////////////////////////////////////////////////////////////////// +// RunTimeHelper - helper functions for Windows version and structure sizes + +// Not for Windows CE +#if defined(_WIN32_WCE) && !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) + #define _WTL_NO_RUNTIME_STRUCT_SIZE +#endif + +#ifndef _WTL_NO_RUNTIME_STRUCT_SIZE + +#ifndef _SIZEOF_STRUCT + #define _SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) +#endif + +#if (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) + #define REBARBANDINFO_V6_SIZE _SIZEOF_STRUCT(REBARBANDINFO, cxHeader) +#endif // (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) + +#if (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) + #define LVGROUP_V5_SIZE _SIZEOF_STRUCT(LVGROUP, uAlign) +#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) + +#if (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) + #define LVTILEINFO_V5_SIZE _SIZEOF_STRUCT(LVTILEINFO, puColumns) +#endif // (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) + +#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) + #define MCHITTESTINFO_V1_SIZE _SIZEOF_STRUCT(MCHITTESTINFO, st) +#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) + +#if !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) + #define NONCLIENTMETRICS_V1_SIZE _SIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont) +#endif // !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) + +#endif // !_WTL_NO_RUNTIME_STRUCT_SIZE + +namespace RunTimeHelper +{ +#ifndef _WIN32_WCE + inline bool IsCommCtrl6() + { + DWORD dwMajor = 0, dwMinor = 0; + HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); + return (SUCCEEDED(hRet) && (dwMajor >= 6)); + } + + inline bool IsVista() + { + OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; + BOOL bRet = ::GetVersionEx(&ovi); + return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6)); + } +#endif // !_WIN32_WCE + + inline int SizeOf_REBARBANDINFO() + { + int nSize = sizeof(REBARBANDINFO); +#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) + if(!(IsVista() && IsCommCtrl6())) + nSize = REBARBANDINFO_V6_SIZE; +#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) + return nSize; + } + +#if (_WIN32_WINNT >= 0x501) + inline int SizeOf_LVGROUP() + { + int nSize = sizeof(LVGROUP); +#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) + if(!IsVista()) + nSize = LVGROUP_V5_SIZE; +#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) + return nSize; + } + + inline int SizeOf_LVTILEINFO() + { + int nSize = sizeof(LVTILEINFO); +#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) + if(!IsVista()) + nSize = LVTILEINFO_V5_SIZE; +#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) + return nSize; + } +#endif // (_WIN32_WINNT >= 0x501) + + inline int SizeOf_MCHITTESTINFO() + { + int nSize = sizeof(MCHITTESTINFO); +#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + if(!(IsVista() && IsCommCtrl6())) + nSize = MCHITTESTINFO_V1_SIZE; +#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + return nSize; + } + +#ifndef _WIN32_WCE + inline int SizeOf_NONCLIENTMETRICS() + { + int nSize = sizeof(NONCLIENTMETRICS); +#if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) + if(!IsVista()) + nSize = NONCLIENTMETRICS_V1_SIZE; +#endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) + return nSize; + } +#endif // !_WIN32_WCE +}; + + +/////////////////////////////////////////////////////////////////////////////// +// ModuleHelper - helper functions for ATL3 and ATL7 module classes + +namespace ModuleHelper +{ + inline HINSTANCE GetModuleInstance() + { +#if (_ATL_VER >= 0x0700) + return ATL::_AtlBaseModule.GetModuleInstance(); +#else // !(_ATL_VER >= 0x0700) + return ATL::_pModule->GetModuleInstance(); +#endif // !(_ATL_VER >= 0x0700) + } + + inline HINSTANCE GetResourceInstance() + { +#if (_ATL_VER >= 0x0700) + return ATL::_AtlBaseModule.GetResourceInstance(); +#else // !(_ATL_VER >= 0x0700) + return ATL::_pModule->GetResourceInstance(); +#endif // !(_ATL_VER >= 0x0700) + } + + inline void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject) + { +#if (_ATL_VER >= 0x0700) + ATL::_AtlWinModule.AddCreateWndData(pData, pObject); +#else // !(_ATL_VER >= 0x0700) + ATL::_pModule->AddCreateWndData(pData, pObject); +#endif // !(_ATL_VER >= 0x0700) + } + + inline void* ExtractCreateWndData() + { +#if (_ATL_VER >= 0x0700) + return ATL::_AtlWinModule.ExtractCreateWndData(); +#else // !(_ATL_VER >= 0x0700) + return ATL::_pModule->ExtractCreateWndData(); +#endif // !(_ATL_VER >= 0x0700) + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// SecureHelper - helper functions for VS2005 secure CRT + +namespace SecureHelper +{ + inline void strcpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) + { +#if _SECURE_ATL + ATL::Checked::strcpy_s(lpstrDest, cchDest, lpstrSrc); +#else + if(cchDest > (size_t)lstrlenA(lpstrSrc)) + ATLVERIFY(lstrcpyA(lpstrDest, lpstrSrc) != NULL); + else + ATLASSERT(FALSE); +#endif + } + + inline void strcpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) + { +#if _SECURE_ATL + ATL::Checked::wcscpy_s(lpstrDest, cchDest, lpstrSrc); +#else + if(cchDest > (size_t)lstrlenW(lpstrSrc)) + ATLVERIFY(lstrcpyW(lpstrDest, lpstrSrc) != NULL); + else + ATLASSERT(FALSE); +#endif + } + + inline void strcpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) + { +#ifdef _UNICODE + strcpyW_x(lpstrDest, cchDest, lpstrSrc); +#else + strcpyA_x(lpstrDest, cchDest, lpstrSrc); +#endif + } + + inline errno_t strncpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc, size_t cchCount) + { +#if _SECURE_ATL + return ATL::Checked::strncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); +#else + errno_t nRet = 0; + if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) + { + nRet = EINVAL; + } + else if(cchCount == _TRUNCATE) + { + cchCount = min(cchDest - 1, size_t(lstrlenA(lpstrSrc))); + nRet = STRUNCATE; + } + else if(cchDest <= cchCount) + { + lpstrDest[0] = 0; + nRet = EINVAL; + } + if(nRet == 0 || nRet == STRUNCATE) + nRet = (lstrcpynA(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; + ATLASSERT(nRet == 0 || nRet == STRUNCATE); + return nRet; +#endif + } + + inline errno_t strncpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc, size_t cchCount) + { +#if _SECURE_ATL + return ATL::Checked::wcsncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); +#else + errno_t nRet = 0; + if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) + { + nRet = EINVAL; + } + else if(cchCount == _TRUNCATE) + { + cchCount = min(cchDest - 1, size_t(lstrlenW(lpstrSrc))); + nRet = STRUNCATE; + } + else if(cchDest <= cchCount) + { + lpstrDest[0] = 0; + nRet = EINVAL; + } + if(nRet == 0 || nRet == STRUNCATE) + nRet = (lstrcpynW(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; + ATLASSERT(nRet == 0 || nRet == STRUNCATE); + return nRet; +#endif + } + + inline errno_t strncpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc, size_t cchCount) + { +#ifdef _UNICODE + return strncpyW_x(lpstrDest, cchDest, lpstrSrc, cchCount); +#else + return strncpyA_x(lpstrDest, cchDest, lpstrSrc, cchCount); +#endif + } + + inline void strcatA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) + { +#if _SECURE_ATL + ATL::Checked::strcat_s(lpstrDest, cchDest, lpstrSrc); +#else + if(cchDest > (size_t)lstrlenA(lpstrSrc)) + ATLVERIFY(lstrcatA(lpstrDest, lpstrSrc) != NULL); + else + ATLASSERT(FALSE); +#endif + } + + inline void strcatW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) + { +#if _SECURE_ATL + ATL::Checked::wcscat_s(lpstrDest, cchDest, lpstrSrc); +#else + if(cchDest > (size_t)lstrlenW(lpstrSrc)) + ATLVERIFY(lstrcatW(lpstrDest, lpstrSrc) != NULL); + else + ATLASSERT(FALSE); +#endif + } + + inline void strcat_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) + { +#ifdef _UNICODE + strcatW_x(lpstrDest, cchDest, lpstrSrc); +#else + strcatA_x(lpstrDest, cchDest, lpstrSrc); +#endif + } + + inline void memcpy_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) + { +#if _SECURE_ATL + ATL::Checked::memcpy_s(pDest, cbDest, pSrc, cbSrc); +#else + if(cbDest >= cbSrc) + memcpy(pDest, pSrc, cbSrc); + else + ATLASSERT(FALSE); +#endif + } + + inline void memmove_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) + { +#if _SECURE_ATL + ATL::Checked::memmove_s(pDest, cbDest, pSrc, cbSrc); +#else + if(cbDest >= cbSrc) + memmove(pDest, pSrc, cbSrc); + else + ATLASSERT(FALSE); +#endif + } + + inline int vsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) + { +#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) + return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); +#else + cchBuff; // Avoid unused argument warning + return _vstprintf(lpstrBuff, lpstrFormat, args); +#endif + } + + inline int wvsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) + { +#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) + return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); +#else + cchBuff; // Avoid unused argument warning + return ::wvsprintf(lpstrBuff, lpstrFormat, args); +#endif + } + + inline int sprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) + { + va_list args; + va_start(args, lpstrFormat); + int nRes = vsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); + va_end(args); + return nRes; + } + + inline int wsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) + { + va_list args; + va_start(args, lpstrFormat); + int nRes = wvsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); + va_end(args); + return nRes; + } +}; // namespace SecureHelper + + +/////////////////////////////////////////////////////////////////////////////// +// CMessageFilter - Interface for message filter support + +class CMessageFilter +{ +public: + virtual BOOL PreTranslateMessage(MSG* pMsg) = 0; +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CIdleHandler - Interface for idle processing + +class CIdleHandler +{ +public: + virtual BOOL OnIdle() = 0; +}; + +#ifndef _ATL_NO_OLD_NAMES + // for compatilibility with old names only + typedef CIdleHandler CUpdateUIObject; + #define DoUpdate OnIdle +#endif // !_ATL_NO_OLD_NAMES + + +/////////////////////////////////////////////////////////////////////////////// +// CMessageLoop - message loop implementation + +class CMessageLoop +{ +public: + ATL::CSimpleArray m_aMsgFilter; + ATL::CSimpleArray m_aIdleHandler; + MSG m_msg; + +// Message filter operations + BOOL AddMessageFilter(CMessageFilter* pMessageFilter) + { + return m_aMsgFilter.Add(pMessageFilter); + } + + BOOL RemoveMessageFilter(CMessageFilter* pMessageFilter) + { + return m_aMsgFilter.Remove(pMessageFilter); + } + +// Idle handler operations + BOOL AddIdleHandler(CIdleHandler* pIdleHandler) + { + return m_aIdleHandler.Add(pIdleHandler); + } + + BOOL RemoveIdleHandler(CIdleHandler* pIdleHandler) + { + return m_aIdleHandler.Remove(pIdleHandler); + } + +#ifndef _ATL_NO_OLD_NAMES + // for compatilibility with old names only + BOOL AddUpdateUI(CIdleHandler* pIdleHandler) + { + ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and AddUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); + return AddIdleHandler(pIdleHandler); + } + + BOOL RemoveUpdateUI(CIdleHandler* pIdleHandler) + { + ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and RemoveUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); + return RemoveIdleHandler(pIdleHandler); + } +#endif // !_ATL_NO_OLD_NAMES + +// message loop + int Run() + { + BOOL bDoIdle = TRUE; + int nIdleCount = 0; + BOOL bRet; + + for(;;) + { + while(bDoIdle && !::PeekMessage(&m_msg, NULL, 0, 0, PM_NOREMOVE)) + { + if(!OnIdle(nIdleCount++)) + bDoIdle = FALSE; + } + + bRet = ::GetMessage(&m_msg, NULL, 0, 0); + + if(bRet == -1) + { + ATLTRACE2(atlTraceUI, 0, _T("::GetMessage returned -1 (error)\n")); + continue; // error, don't process + } + else if(!bRet) + { + ATLTRACE2(atlTraceUI, 0, _T("CMessageLoop::Run - exiting\n")); + break; // WM_QUIT, exit message loop + } + + if(!PreTranslateMessage(&m_msg)) + { + ::TranslateMessage(&m_msg); + ::DispatchMessage(&m_msg); + } + + if(IsIdleMessage(&m_msg)) + { + bDoIdle = TRUE; + nIdleCount = 0; + } + } + + return (int)m_msg.wParam; + } + + static BOOL IsIdleMessage(MSG* pMsg) + { + // These messages should NOT cause idle processing + switch(pMsg->message) + { + case WM_MOUSEMOVE: +#ifndef _WIN32_WCE + case WM_NCMOUSEMOVE: +#endif // !_WIN32_WCE + case WM_PAINT: + case 0x0118: // WM_SYSTIMER (caret blink) + return FALSE; + } + + return TRUE; + } + +// Overrideables + // Override to change message filtering + virtual BOOL PreTranslateMessage(MSG* pMsg) + { + // loop backwards + for(int i = m_aMsgFilter.GetSize() - 1; i >= 0; i--) + { + CMessageFilter* pMessageFilter = m_aMsgFilter[i]; + if(pMessageFilter != NULL && pMessageFilter->PreTranslateMessage(pMsg)) + return TRUE; + } + return FALSE; // not translated + } + + // override to change idle processing + virtual BOOL OnIdle(int /*nIdleCount*/) + { + for(int i = 0; i < m_aIdleHandler.GetSize(); i++) + { + CIdleHandler* pIdleHandler = m_aIdleHandler[i]; + if(pIdleHandler != NULL) + pIdleHandler->OnIdle(); + } + return FALSE; // don't continue + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CStaticDataInitCriticalSectionLock and CWindowCreateCriticalSectionLock +// internal classes to manage critical sections for both ATL3 and ATL7 + +class CStaticDataInitCriticalSectionLock +{ +public: +#if (_ATL_VER >= 0x0700) + ATL::CComCritSecLock m_cslock; + + CStaticDataInitCriticalSectionLock() : m_cslock(ATL::_pAtlModule->m_csStaticDataInitAndTypeInfo, false) + { } +#endif // (_ATL_VER >= 0x0700) + + HRESULT Lock() + { +#if (_ATL_VER >= 0x0700) + return m_cslock.Lock(); +#else // !(_ATL_VER >= 0x0700) + ::EnterCriticalSection(&ATL::_pModule->m_csStaticDataInit); + return S_OK; +#endif // !(_ATL_VER >= 0x0700) + } + + void Unlock() + { +#if (_ATL_VER >= 0x0700) + m_cslock.Unlock(); +#else // !(_ATL_VER >= 0x0700) + ::LeaveCriticalSection(&ATL::_pModule->m_csStaticDataInit); +#endif // !(_ATL_VER >= 0x0700) + } +}; + + +class CWindowCreateCriticalSectionLock +{ +public: +#if (_ATL_VER >= 0x0700) + ATL::CComCritSecLock m_cslock; + + CWindowCreateCriticalSectionLock() : m_cslock(ATL::_AtlWinModule.m_csWindowCreate, false) + { } +#endif // (_ATL_VER >= 0x0700) + + HRESULT Lock() + { +#if (_ATL_VER >= 0x0700) + return m_cslock.Lock(); +#else // !(_ATL_VER >= 0x0700) + ::EnterCriticalSection(&ATL::_pModule->m_csWindowCreate); + return S_OK; +#endif // !(_ATL_VER >= 0x0700) + } + + void Unlock() + { +#if (_ATL_VER >= 0x0700) + m_cslock.Unlock(); +#else // !(_ATL_VER >= 0x0700) + ::LeaveCriticalSection(&ATL::_pModule->m_csWindowCreate); +#endif // !(_ATL_VER >= 0x0700) + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CTempBuffer - helper class for stack allocations for ATL3 + +#ifndef _WTL_STACK_ALLOC_THRESHOLD + #define _WTL_STACK_ALLOC_THRESHOLD 512 +#endif + +#if (_ATL_VER >= 0x0700) + +using ATL::CTempBuffer; + +#else // !(_ATL_VER >= 0x0700) + +#ifndef SIZE_MAX + #ifdef _WIN64 + #define SIZE_MAX _UI64_MAX + #else + #define SIZE_MAX UINT_MAX + #endif +#endif + +#pragma warning(disable: 4284) // warning for operator -> + +template +class CTempBuffer +{ +public: + CTempBuffer() : m_p(NULL) + { + } + + CTempBuffer(size_t nElements) : m_p(NULL) + { + Allocate(nElements); + } + + ~CTempBuffer() + { + if(m_p != reinterpret_cast(m_abFixedBuffer)) + free(m_p); + } + + operator T*() const + { + return m_p; + } + + T* operator ->() const + { + ATLASSERT(m_p != NULL); + return m_p; + } + + T* Allocate(size_t nElements) + { + ATLASSERT(nElements <= (SIZE_MAX / sizeof(T))); + return AllocateBytes(nElements * sizeof(T)); + } + + T* AllocateBytes(size_t nBytes) + { + ATLASSERT(m_p == NULL); + if(nBytes > t_nFixedBytes) + m_p = static_cast(malloc(nBytes)); + else + m_p = reinterpret_cast(m_abFixedBuffer); + + return m_p; + } + +private: + T* m_p; + BYTE m_abFixedBuffer[t_nFixedBytes]; +}; + +#pragma warning(default: 4284) + +#endif // !(_ATL_VER >= 0x0700) + + +/////////////////////////////////////////////////////////////////////////////// +// CAppModule - module class for an application + +class CAppModule : public ATL::CComModule +{ +public: + DWORD m_dwMainThreadID; + ATL::CSimpleMap* m_pMsgLoopMap; + ATL::CSimpleArray* m_pSettingChangeNotify; + +// Overrides of CComModule::Init and Term + HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) + { + HRESULT hRet = CComModule::Init(pObjMap, hInstance, pLibID); + if(FAILED(hRet)) + return hRet; + + m_dwMainThreadID = ::GetCurrentThreadId(); + typedef ATL::CSimpleMap _mapClass; + m_pMsgLoopMap = NULL; + ATLTRY(m_pMsgLoopMap = new _mapClass); + if(m_pMsgLoopMap == NULL) + return E_OUTOFMEMORY; + m_pSettingChangeNotify = NULL; + + return hRet; + } + + void Term() + { + TermSettingChangeNotify(); + delete m_pMsgLoopMap; + CComModule::Term(); + } + +// Message loop map methods + BOOL AddMessageLoop(CMessageLoop* pMsgLoop) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddMessageLoop.\n")); + ATLASSERT(FALSE); + return FALSE; + } + + ATLASSERT(pMsgLoop != NULL); + ATLASSERT(m_pMsgLoopMap->Lookup(::GetCurrentThreadId()) == NULL); // not in map yet + + BOOL bRet = m_pMsgLoopMap->Add(::GetCurrentThreadId(), pMsgLoop); + + lock.Unlock(); + + return bRet; + } + + BOOL RemoveMessageLoop() + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveMessageLoop.\n")); + ATLASSERT(FALSE); + return FALSE; + } + + BOOL bRet = m_pMsgLoopMap->Remove(::GetCurrentThreadId()); + + lock.Unlock(); + + return bRet; + } + + CMessageLoop* GetMessageLoop(DWORD dwThreadID = ::GetCurrentThreadId()) const + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::GetMessageLoop.\n")); + ATLASSERT(FALSE); + return NULL; + } + + CMessageLoop* pLoop = m_pMsgLoopMap->Lookup(dwThreadID); + + lock.Unlock(); + + return pLoop; + } + +// Setting change notify methods + // Note: Call this from the main thread for MSDI apps + BOOL InitSettingChangeNotify(DLGPROC pfnDlgProc = _SettingChangeDlgProc) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::InitSettingChangeNotify.\n")); + ATLASSERT(FALSE); + return FALSE; + } + + if(m_pSettingChangeNotify == NULL) + { + typedef ATL::CSimpleArray _notifyClass; + ATLTRY(m_pSettingChangeNotify = new _notifyClass); + ATLASSERT(m_pSettingChangeNotify != NULL); + } + + BOOL bRet = (m_pSettingChangeNotify != NULL); + if(bRet && m_pSettingChangeNotify->GetSize() == 0) + { + // init everything + _ATL_EMPTY_DLGTEMPLATE templ; + HWND hNtfWnd = ::CreateDialogIndirect(GetModuleInstance(), &templ, NULL, pfnDlgProc); + ATLASSERT(::IsWindow(hNtfWnd)); + if(::IsWindow(hNtfWnd)) + { +// need conditional code because types don't match in winuser.h +#ifdef _WIN64 + ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, (LONG_PTR)this); +#else + ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, PtrToLong(this)); +#endif + bRet = m_pSettingChangeNotify->Add(hNtfWnd); + } + else + { + bRet = FALSE; + } + } + + lock.Unlock(); + + return bRet; + } + + void TermSettingChangeNotify() + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::TermSettingChangeNotify.\n")); + ATLASSERT(FALSE); + return; + } + + if(m_pSettingChangeNotify != NULL && m_pSettingChangeNotify->GetSize() > 0) + ::DestroyWindow((*m_pSettingChangeNotify)[0]); + delete m_pSettingChangeNotify; + m_pSettingChangeNotify = NULL; + + lock.Unlock(); + } + + BOOL AddSettingChangeNotify(HWND hWnd) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddSettingChangeNotify.\n")); + ATLASSERT(FALSE); + return FALSE; + } + + ATLASSERT(::IsWindow(hWnd)); + BOOL bRet = FALSE; + if(InitSettingChangeNotify() != FALSE) + bRet = m_pSettingChangeNotify->Add(hWnd); + + lock.Unlock(); + + return bRet; + } + + BOOL RemoveSettingChangeNotify(HWND hWnd) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveSettingChangeNotify.\n")); + ATLASSERT(FALSE); + return FALSE; + } + + BOOL bRet = FALSE; + if(m_pSettingChangeNotify != NULL) + bRet = m_pSettingChangeNotify->Remove(hWnd); + + lock.Unlock(); + + return bRet; + } + +// Implementation - setting change notify dialog template and dialog procedure + struct _ATL_EMPTY_DLGTEMPLATE : DLGTEMPLATE + { + _ATL_EMPTY_DLGTEMPLATE() + { + memset(this, 0, sizeof(_ATL_EMPTY_DLGTEMPLATE)); + style = WS_POPUP; + } + WORD wMenu, wClass, wTitle; + }; + +#ifdef _WIN64 + static INT_PTR CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +#else + static BOOL CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +#endif + { + if(uMsg == WM_SETTINGCHANGE) + { +// need conditional code because types don't match in winuser.h +#ifdef _WIN64 + CAppModule* pModule = (CAppModule*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); +#else + CAppModule* pModule = (CAppModule*)LongToPtr(::GetWindowLongPtr(hWnd, GWLP_USERDATA)); +#endif + ATLASSERT(pModule != NULL); + ATLASSERT(pModule->m_pSettingChangeNotify != NULL); + const UINT uTimeout = 1500; // ms + for(int i = 1; i < pModule->m_pSettingChangeNotify->GetSize(); i++) + { +#if !defined(_WIN32_WCE) + ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_ABORTIFHUNG, uTimeout, NULL); +#elif(_WIN32_WCE >= 400) // CE specific + ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_NORMAL, uTimeout, NULL); +#else // _WIN32_WCE < 400 specific + uTimeout; + ::SendMessage((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam); +#endif + } + return TRUE; + } + return FALSE; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CServerAppModule - module class for a COM server application + +class CServerAppModule : public CAppModule +{ +public: + HANDLE m_hEventShutdown; + bool m_bActivity; + DWORD m_dwTimeOut; + DWORD m_dwPause; + +// Override of CAppModule::Init + HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) + { + m_dwTimeOut = 5000; + m_dwPause = 1000; + return CAppModule::Init(pObjMap, hInstance, pLibID); + } + + void Term() + { + if(m_hEventShutdown != NULL && ::CloseHandle(m_hEventShutdown)) + m_hEventShutdown = NULL; + CAppModule::Term(); + } + +// COM Server methods + LONG Unlock() + { + LONG lRet = CComModule::Unlock(); + if(lRet == 0) + { + m_bActivity = true; + ::SetEvent(m_hEventShutdown); // tell monitor that we transitioned to zero + } + return lRet; + } + + void MonitorShutdown() + { + for(;;) + { + ::WaitForSingleObject(m_hEventShutdown, INFINITE); + DWORD dwWait = 0; + do + { + m_bActivity = false; + dwWait = ::WaitForSingleObject(m_hEventShutdown, m_dwTimeOut); + } + while(dwWait == WAIT_OBJECT_0); + // timed out + if(!m_bActivity && m_nLockCnt == 0) // if no activity let's really bail + { +#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)) && defined(_ATL_FREE_THREADED) && !defined(_WIN32_WCE) + ::CoSuspendClassObjects(); + if(!m_bActivity && m_nLockCnt == 0) +#endif + break; + } + } + // This handle should be valid now. If it isn't, + // check if _Module.Term was called first (it shouldn't) + if(::CloseHandle(m_hEventShutdown)) + m_hEventShutdown = NULL; + ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0); + } + + bool StartMonitor() + { + m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL); + if(m_hEventShutdown == NULL) + return false; + DWORD dwThreadID = 0; +#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) + HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))MonitorProc, this, 0, (UINT*)&dwThreadID); +#else + HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID); +#endif + bool bRet = (hThread != NULL); + if(bRet) + ::CloseHandle(hThread); + return bRet; + } + + static DWORD WINAPI MonitorProc(void* pv) + { + CServerAppModule* p = (CServerAppModule*)pv; + p->MonitorShutdown(); + return 0; + } + +#if (_ATL_VER < 0x0700) + // search for an occurence of string p2 in string p1 + static LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2) + { + while(p1 != NULL && *p1 != NULL) + { + LPCTSTR p = p2; + while(p != NULL && *p != NULL) + { + if(*p1 == *p) + return ::CharNext(p1); + p = ::CharNext(p); + } + p1 = ::CharNext(p1); + } + return NULL; + } +#endif // (_ATL_VER < 0x0700) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CString forward reference (enables CString use in atluser.h and atlgdi.h) + +#if defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) + #define _WTL_USE_CSTRING +#endif // defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) + +#ifdef _WTL_USE_CSTRING + class CString; // forward declaration (include atlmisc.h for the whole class) +#endif // _WTL_USE_CSTRING + +// CString namespace +#ifndef _CSTRING_NS + #ifdef __ATLSTR_H__ + #define _CSTRING_NS ATL + #else + #define _CSTRING_NS WTL + #endif +#endif // _CSTRING_NS + +// Type classes namespace +#ifndef _WTYPES_NS + #ifdef __ATLTYPES_H__ + #define _WTYPES_NS + #else + #define _WTYPES_NS WTL + #endif +#endif // _WTYPES_NS + +}; // namespace WTL + + +/////////////////////////////////////////////////////////////////////////////// +// General DLL version helpers (excluded from atlbase.h if _ATL_DLL is defined) + +#if (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) + +namespace ATL +{ + +inline HRESULT AtlGetDllVersion(HINSTANCE hInstDLL, DLLVERSIONINFO* pDllVersionInfo) +{ + ATLASSERT(pDllVersionInfo != NULL); + if(pDllVersionInfo == NULL) + return E_INVALIDARG; + + // We must get this function explicitly because some DLLs don't implement it. + DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC)::GetProcAddress(hInstDLL, "DllGetVersion"); + if(pfnDllGetVersion == NULL) + return E_NOTIMPL; + + return (*pfnDllGetVersion)(pDllVersionInfo); +} + +inline HRESULT AtlGetDllVersion(LPCTSTR lpstrDllName, DLLVERSIONINFO* pDllVersionInfo) +{ + HINSTANCE hInstDLL = ::LoadLibrary(lpstrDllName); + if(hInstDLL == NULL) + return E_FAIL; + HRESULT hRet = AtlGetDllVersion(hInstDLL, pDllVersionInfo); + ::FreeLibrary(hInstDLL); + return hRet; +} + +// Common Control Versions: +// Win95/WinNT 4.0 maj=4 min=00 +// IE 3.x maj=4 min=70 +// IE 4.0 maj=4 min=71 +inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) +{ + ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); + if(pdwMajor == NULL || pdwMinor == NULL) + return E_INVALIDARG; + + DLLVERSIONINFO dvi; + ::ZeroMemory(&dvi, sizeof(dvi)); + dvi.cbSize = sizeof(dvi); + HRESULT hRet = AtlGetDllVersion(_T("comctl32.dll"), &dvi); + + if(SUCCEEDED(hRet)) + { + *pdwMajor = dvi.dwMajorVersion; + *pdwMinor = dvi.dwMinorVersion; + } + else if(hRet == E_NOTIMPL) + { + // If DllGetVersion is not there, then the DLL is a version + // previous to the one shipped with IE 3.x + *pdwMajor = 4; + *pdwMinor = 0; + hRet = S_OK; + } + + return hRet; +} + +// Shell Versions: +// Win95/WinNT 4.0 maj=4 min=00 +// IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00 +// IE 4.0 with Web Integrated Desktop maj=4 min=71 +// IE 4.01 with Web Integrated Desktop maj=4 min=72 +inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) +{ + ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); + if(pdwMajor == NULL || pdwMinor == NULL) + return E_INVALIDARG; + + DLLVERSIONINFO dvi; + ::ZeroMemory(&dvi, sizeof(dvi)); + dvi.cbSize = sizeof(dvi); + HRESULT hRet = AtlGetDllVersion(_T("shell32.dll"), &dvi); + + if(SUCCEEDED(hRet)) + { + *pdwMajor = dvi.dwMajorVersion; + *pdwMinor = dvi.dwMinorVersion; + } + else if(hRet == E_NOTIMPL) + { + // If DllGetVersion is not there, then the DLL is a version + // previous to the one shipped with IE 4.x + *pdwMajor = 4; + *pdwMinor = 0; + hRet = S_OK; + } + + return hRet; +} + +}; // namespace ATL + +#endif // (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) + + +// These are always included +#include "atlwinx.h" +#include "atluser.h" +#include "atlgdi.h" + +#ifndef _WTL_NO_AUTOMATIC_NAMESPACE +using namespace WTL; +#endif // !_WTL_NO_AUTOMATIC_NAMESPACE + +#endif // __ATLAPP_H__ diff --git a/Externals/WTL80/atlcrack.h b/Externals/WTL80/atlcrack.h index f92b35ad21..09a358b50d 100644 --- a/Externals/WTL80/atlcrack.h +++ b/Externals/WTL80/atlcrack.h @@ -1,2380 +1,2380 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCRACK_H__ -#define __ATLCRACK_H__ - -#pragma once - - -/////////////////////////////////////////////////////////////////////////////// -// Message map macro for cracked handlers - -// Note about message maps with cracked handlers: -// For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX. -// For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes, -// but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl. - -#define BEGIN_MSG_MAP_EX(theClass) \ -public: \ - BOOL m_bMsgHandled; \ - /* "handled" management for cracked handlers */ \ - BOOL IsMsgHandled() const \ - { \ - return m_bMsgHandled; \ - } \ - void SetMsgHandled(BOOL bHandled) \ - { \ - m_bMsgHandled = bHandled; \ - } \ - BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \ - { \ - BOOL bOldMsgHandled = m_bMsgHandled; \ - BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \ - m_bMsgHandled = bOldMsgHandled; \ - return bRet; \ - } \ - BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \ - { \ - BOOL bHandled = TRUE; \ - hWnd; \ - uMsg; \ - wParam; \ - lParam; \ - lResult; \ - bHandled; \ - switch(dwMsgMapID) \ - { \ - case 0: - - -/////////////////////////////////////////////////////////////////////////////// -// Standard Windows message macros - -// int OnCreate(LPCREATESTRUCT lpCreateStruct) -#define MSG_WM_CREATE(func) \ - if (uMsg == WM_CREATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam) -#define MSG_WM_INITDIALOG(func) \ - if (uMsg == WM_INITDIALOG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct) -#define MSG_WM_COPYDATA(func) \ - if (uMsg == WM_COPYDATA) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDestroy() -#define MSG_WM_DESTROY(func) \ - if (uMsg == WM_DESTROY) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMove(CPoint ptPos) -#define MSG_WM_MOVE(func) \ - if (uMsg == WM_MOVE) \ - { \ - SetMsgHandled(TRUE); \ - func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSize(UINT nType, CSize size) -#define MSG_WM_SIZE(func) \ - if (uMsg == WM_SIZE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther) -#define MSG_WM_ACTIVATE(func) \ - if (uMsg == WM_ACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSetFocus(CWindow wndOld) -#define MSG_WM_SETFOCUS(func) \ - if (uMsg == WM_SETFOCUS) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnKillFocus(CWindow wndFocus) -#define MSG_WM_KILLFOCUS(func) \ - if (uMsg == WM_KILLFOCUS) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnable(BOOL bEnable) -#define MSG_WM_ENABLE(func) \ - if (uMsg == WM_ENABLE) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaint(CDCHandle dc) -#define MSG_WM_PAINT(func) \ - if (uMsg == WM_PAINT) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnClose() -#define MSG_WM_CLOSE(func) \ - if (uMsg == WM_CLOSE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnQueryEndSession(UINT nSource, UINT uLogOff) -#define MSG_WM_QUERYENDSESSION(func) \ - if (uMsg == WM_QUERYENDSESSION) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnQueryOpen() -#define MSG_WM_QUERYOPEN(func) \ - if (uMsg == WM_QUERYOPEN) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnEraseBkgnd(CDCHandle dc) -#define MSG_WM_ERASEBKGND(func) \ - if (uMsg == WM_ERASEBKGND) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysColorChange() -#define MSG_WM_SYSCOLORCHANGE(func) \ - if (uMsg == WM_SYSCOLORCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEndSession(BOOL bEnding, UINT uLogOff) -#define MSG_WM_ENDSESSION(func) \ - if (uMsg == WM_ENDSESSION) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (UINT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnShowWindow(BOOL bShow, UINT nStatus) -#define MSG_WM_SHOWWINDOW(func) \ - if (uMsg == WM_SHOWWINDOW) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (int)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit) -#define MSG_WM_CTLCOLOREDIT(func) \ - if (uMsg == WM_CTLCOLOREDIT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox) -#define MSG_WM_CTLCOLORLISTBOX(func) \ - if (uMsg == WM_CTLCOLORLISTBOX) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button) -#define MSG_WM_CTLCOLORBTN(func) \ - if (uMsg == WM_CTLCOLORBTN) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd) -#define MSG_WM_CTLCOLORDLG(func) \ - if (uMsg == WM_CTLCOLORDLG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) -#define MSG_WM_CTLCOLORSCROLLBAR(func) \ - if (uMsg == WM_CTLCOLORSCROLLBAR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic) -#define MSG_WM_CTLCOLORSTATIC(func) \ - if (uMsg == WM_CTLCOLORSTATIC) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSettingChange(UINT uFlags, LPCTSTR lpszSection) -#define MSG_WM_SETTINGCHANGE(func) \ - if (uMsg == WM_SETTINGCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPCTSTR)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDevModeChange(LPCTSTR lpDeviceName) -#define MSG_WM_DEVMODECHANGE(func) \ - if (uMsg == WM_DEVMODECHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((LPCTSTR)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnActivateApp(BOOL bActive, DWORD dwThreadID) -#define MSG_WM_ACTIVATEAPP(func) \ - if (uMsg == WM_ACTIVATEAPP) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (DWORD)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnFontChange() -#define MSG_WM_FONTCHANGE(func) \ - if (uMsg == WM_FONTCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnTimeChange() -#define MSG_WM_TIMECHANGE(func) \ - if (uMsg == WM_TIMECHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCancelMode() -#define MSG_WM_CANCELMODE(func) \ - if (uMsg == WM_CANCELMODE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message) -#define MSG_WM_SETCURSOR(func) \ - if (uMsg == WM_SETCURSOR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message) -#define MSG_WM_MOUSEACTIVATE(func) \ - if (uMsg == WM_MOUSEACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChildActivate() -#define MSG_WM_CHILDACTIVATE(func) \ - if (uMsg == WM_CHILDACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnGetMinMaxInfo(LPMINMAXINFO lpMMI) -#define MSG_WM_GETMINMAXINFO(func) \ - if (uMsg == WM_GETMINMAXINFO) \ - { \ - SetMsgHandled(TRUE); \ - func((LPMINMAXINFO)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnIconEraseBkgnd(CDCHandle dc) -#define MSG_WM_ICONERASEBKGND(func) \ - if (uMsg == WM_ICONERASEBKGND) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSpoolerStatus(UINT nStatus, UINT nJobs) -#define MSG_WM_SPOOLERSTATUS(func) \ - if (uMsg == WM_SPOOLERSTATUS) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (UINT)LOWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) -#define MSG_WM_DRAWITEM(func) \ - if (uMsg == WM_DRAWITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) -#define MSG_WM_MEASUREITEM(func) \ - if (uMsg == WM_MEASUREITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) -#define MSG_WM_DELETEITEM(func) \ - if (uMsg == WM_DELETEITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -//int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox) -#define MSG_WM_CHARTOITEM(func) \ - if (uMsg == WM_CHARTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) -#define MSG_WM_VKEYTOITEM(func) \ - if (uMsg == WM_VKEYTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HCURSOR OnQueryDragIcon() -#define MSG_WM_QUERYDRAGICON(func) \ - if (uMsg == WM_QUERYDRAGICON) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) -#define MSG_WM_COMPAREITEM(func) \ - if (uMsg == WM_COMPAREITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCompacting(UINT nCpuTime) -#define MSG_WM_COMPACTING(func) \ - if (uMsg == WM_COMPACTING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct) -#define MSG_WM_NCCREATE(func) \ - if (uMsg == WM_NCCREATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcDestroy() -#define MSG_WM_NCDESTROY(func) \ - if (uMsg == WM_NCDESTROY) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam) -#define MSG_WM_NCCALCSIZE(func) \ - if (uMsg == WM_NCCALCSIZE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((BOOL)wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// UINT OnNcHitTest(CPoint point) -#define MSG_WM_NCHITTEST(func) \ - if (uMsg == WM_NCHITTEST) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcPaint(CRgn rgn) -#define MSG_WM_NCPAINT(func) \ - if (uMsg == WM_NCPAINT) \ - { \ - SetMsgHandled(TRUE); \ - func((HRGN)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnNcActivate(BOOL bActive) -#define MSG_WM_NCACTIVATE(func) \ - if (uMsg == WM_NCACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((BOOL)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// UINT OnGetDlgCode(LPMSG lpMsg) -#define MSG_WM_GETDLGCODE(func) \ - if (uMsg == WM_GETDLGCODE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPMSG)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMouseMove(UINT nHitTest, CPoint point) -#define MSG_WM_NCMOUSEMOVE(func) \ - if (uMsg == WM_NCMOUSEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcLButtonDown(UINT nHitTest, CPoint point) -#define MSG_WM_NCLBUTTONDOWN(func) \ - if (uMsg == WM_NCLBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcLButtonUp(UINT nHitTest, CPoint point) -#define MSG_WM_NCLBUTTONUP(func) \ - if (uMsg == WM_NCLBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcLButtonDblClk(UINT nHitTest, CPoint point) -#define MSG_WM_NCLBUTTONDBLCLK(func) \ - if (uMsg == WM_NCLBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcRButtonDown(UINT nHitTest, CPoint point) -#define MSG_WM_NCRBUTTONDOWN(func) \ - if (uMsg == WM_NCRBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcRButtonUp(UINT nHitTest, CPoint point) -#define MSG_WM_NCRBUTTONUP(func) \ - if (uMsg == WM_NCRBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcRButtonDblClk(UINT nHitTest, CPoint point) -#define MSG_WM_NCRBUTTONDBLCLK(func) \ - if (uMsg == WM_NCRBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMButtonDown(UINT nHitTest, CPoint point) -#define MSG_WM_NCMBUTTONDOWN(func) \ - if (uMsg == WM_NCMBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMButtonUp(UINT nHitTest, CPoint point) -#define MSG_WM_NCMBUTTONUP(func) \ - if (uMsg == WM_NCMBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNcMButtonDblClk(UINT nHitTest, CPoint point) -#define MSG_WM_NCMBUTTONDBLCLK(func) \ - if (uMsg == WM_NCMBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_KEYDOWN(func) \ - if (uMsg == WM_KEYDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_KEYUP(func) \ - if (uMsg == WM_KEYUP) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_CHAR(func) \ - if (uMsg == WM_CHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_DEADCHAR(func) \ - if (uMsg == WM_DEADCHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSKEYDOWN(func) \ - if (uMsg == WM_SYSKEYDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSKEYUP(func) \ - if (uMsg == WM_SYSKEYUP) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSCHAR(func) \ - if (uMsg == WM_SYSCHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_SYSDEADCHAR(func) \ - if (uMsg == WM_SYSDEADCHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSysCommand(UINT nID, LPARAM lParam) -#define MSG_WM_SYSCOMMAND(func) \ - if (uMsg == WM_SYSCOMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnTCard(UINT idAction, DWORD dwActionData) -#define MSG_WM_TCARD(func) \ - if (uMsg == WM_TCARD) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (DWORD)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnTimer(UINT_PTR nIDEvent) -#define MSG_WM_TIMER(func) \ - if (uMsg == WM_TIMER) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT_PTR)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_WM_HSCROLL(func) \ - if (uMsg == WM_HSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_WM_VSCROLL(func) \ - if (uMsg == WM_VSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInitMenu(CMenu menu) -#define MSG_WM_INITMENU(func) \ - if (uMsg == WM_INITMENU) \ - { \ - SetMsgHandled(TRUE); \ - func((HMENU)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInitMenuPopup(CMenu menuPopup, UINT nIndex, BOOL bSysMenu) -#define MSG_WM_INITMENUPOPUP(func) \ - if (uMsg == WM_INITMENUPOPUP) \ - { \ - SetMsgHandled(TRUE); \ - func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMenuSelect(UINT nItemID, UINT nFlags, CMenu menu) -#define MSG_WM_MENUSELECT(func) \ - if (uMsg == WM_MENUSELECT) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu menu) -#define MSG_WM_MENUCHAR(func) \ - if (uMsg == WM_MENUCHAR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotify(int idCtrl, LPNMHDR pnmh) -#define MSG_WM_NOTIFY(func) \ - if (uMsg == WM_NOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((int)wParam, (LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnterIdle(UINT nWhy, CWindow wndWho) -#define MSG_WM_ENTERIDLE(func) \ - if (uMsg == WM_ENTERIDLE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMouseMove(UINT nFlags, CPoint point) -#define MSG_WM_MOUSEMOVE(func) \ - if (uMsg == WM_MOUSEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -#define MSG_WM_MOUSEWHEEL(func) \ - if (uMsg == WM_MOUSEWHEEL) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnLButtonDown(UINT nFlags, CPoint point) -#define MSG_WM_LBUTTONDOWN(func) \ - if (uMsg == WM_LBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnLButtonUp(UINT nFlags, CPoint point) -#define MSG_WM_LBUTTONUP(func) \ - if (uMsg == WM_LBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnLButtonDblClk(UINT nFlags, CPoint point) -#define MSG_WM_LBUTTONDBLCLK(func) \ - if (uMsg == WM_LBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRButtonDown(UINT nFlags, CPoint point) -#define MSG_WM_RBUTTONDOWN(func) \ - if (uMsg == WM_RBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRButtonUp(UINT nFlags, CPoint point) -#define MSG_WM_RBUTTONUP(func) \ - if (uMsg == WM_RBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRButtonDblClk(UINT nFlags, CPoint point) -#define MSG_WM_RBUTTONDBLCLK(func) \ - if (uMsg == WM_RBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMButtonDown(UINT nFlags, CPoint point) -#define MSG_WM_MBUTTONDOWN(func) \ - if (uMsg == WM_MBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMButtonUp(UINT nFlags, CPoint point) -#define MSG_WM_MBUTTONUP(func) \ - if (uMsg == WM_MBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMButtonDblClk(UINT nFlags, CPoint point) -#define MSG_WM_MBUTTONDBLCLK(func) \ - if (uMsg == WM_MBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam) -#define MSG_WM_PARENTNOTIFY(func) \ - if (uMsg == WM_PARENTNOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate) -#define MSG_WM_MDIACTIVATE(func) \ - if (uMsg == WM_MDIACTIVATE) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRenderFormat(UINT nFormat) -#define MSG_WM_RENDERFORMAT(func) \ - if (uMsg == WM_RENDERFORMAT) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRenderAllFormats() -#define MSG_WM_RENDERALLFORMATS(func) \ - if (uMsg == WM_RENDERALLFORMATS) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDestroyClipboard() -#define MSG_WM_DESTROYCLIPBOARD(func) \ - if (uMsg == WM_DESTROYCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDrawClipboard() -#define MSG_WM_DRAWCLIPBOARD(func) \ - if (uMsg == WM_DRAWCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct) -#define MSG_WM_PAINTCLIPBOARD(func) \ - if (uMsg == WM_PAINTCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \ - ::GlobalUnlock((HGLOBAL)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) -#define MSG_WM_VSCROLLCLIPBOARD(func) \ - if (uMsg == WM_VSCROLLCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnContextMenu(CWindow wnd, CPoint point) -#define MSG_WM_CONTEXTMENU(func) \ - if (uMsg == WM_CONTEXTMENU) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect) -#define MSG_WM_SIZECLIPBOARD(func) \ - if (uMsg == WM_SIZECLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \ - ::GlobalUnlock((HGLOBAL)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString) -#define MSG_WM_ASKCBFORMATNAME(func) \ - if (uMsg == WM_ASKCBFORMATNAME) \ - { \ - SetMsgHandled(TRUE); \ - func((DWORD)wParam, (LPTSTR)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter) -#define MSG_WM_CHANGECBCHAIN(func) \ - if (uMsg == WM_CHANGECBCHAIN) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) -#define MSG_WM_HSCROLLCLIPBOARD(func) \ - if (uMsg == WM_HSCROLLCLIPBOARD) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnQueryNewPalette() -#define MSG_WM_QUERYNEWPALETTE(func) \ - if (uMsg == WM_QUERYNEWPALETTE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaletteChanged(CWindow wndFocus) -#define MSG_WM_PALETTECHANGED(func) \ - if (uMsg == WM_PALETTECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaletteIsChanging(CWindow wndPalChg) -#define MSG_WM_PALETTEISCHANGING(func) \ - if (uMsg == WM_PALETTEISCHANGING) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDropFiles(HDROP hDropInfo) -#define MSG_WM_DROPFILES(func) \ - if (uMsg == WM_DROPFILES) \ - { \ - SetMsgHandled(TRUE); \ - func((HDROP)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnWindowPosChanging(LPWINDOWPOS lpWndPos) -#define MSG_WM_WINDOWPOSCHANGING(func) \ - if (uMsg == WM_WINDOWPOSCHANGING) \ - { \ - SetMsgHandled(TRUE); \ - func((LPWINDOWPOS)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnWindowPosChanged(LPWINDOWPOS lpWndPos) -#define MSG_WM_WINDOWPOSCHANGED(func) \ - if (uMsg == WM_WINDOWPOSCHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((LPWINDOWPOS)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnExitMenuLoop(BOOL fIsTrackPopupMenu) -#define MSG_WM_EXITMENULOOP(func) \ - if (uMsg == WM_EXITMENULOOP) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnterMenuLoop(BOOL fIsTrackPopupMenu) -#define MSG_WM_ENTERMENULOOP(func) \ - if (uMsg == WM_ENTERMENULOOP) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct) -#define MSG_WM_STYLECHANGED(func) \ - if (uMsg == WM_STYLECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct) -#define MSG_WM_STYLECHANGING(func) \ - if (uMsg == WM_STYLECHANGING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSizing(UINT fwSide, LPRECT pRect) -#define MSG_WM_SIZING(func) \ - if (uMsg == WM_SIZING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPRECT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMoving(UINT fwSide, LPRECT pRect) -#define MSG_WM_MOVING(func) \ - if (uMsg == WM_MOVING) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPRECT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCaptureChanged(CWindow wnd) -#define MSG_WM_CAPTURECHANGED(func) \ - if (uMsg == WM_CAPTURECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func((HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnDeviceChange(UINT nEventType, DWORD dwData) -#define MSG_WM_DEVICECHANGE(func) \ - if (uMsg == WM_DEVICECHANGE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl) -#define MSG_WM_COMMAND(func) \ - if (uMsg == WM_COMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen) -#define MSG_WM_DISPLAYCHANGE(func) \ - if (uMsg == WM_DISPLAYCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnEnterSizeMove() -#define MSG_WM_ENTERSIZEMOVE(func) \ - if (uMsg == WM_ENTERSIZEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnExitSizeMove() -#define MSG_WM_EXITSIZEMOVE(func) \ - if (uMsg == WM_EXITSIZEMOVE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HFONT OnGetFont() -#define MSG_WM_GETFONT(func) \ - if (uMsg == WM_GETFONT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnGetHotKey() -#define MSG_WM_GETHOTKEY(func) \ - if (uMsg == WM_GETHOTKEY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HICON OnGetIcon() -#define MSG_WM_GETICON(func) \ - if (uMsg == WM_GETICON) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnGetText(int cchTextMax, LPTSTR lpszText) -#define MSG_WM_GETTEXT(func) \ - if (uMsg == WM_GETTEXT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnGetTextLength() -#define MSG_WM_GETTEXTLENGTH(func) \ - if (uMsg == WM_GETTEXTLENGTH) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHelp(LPHELPINFO lpHelpInfo) -#define MSG_WM_HELP(func) \ - if (uMsg == WM_HELP) \ - { \ - SetMsgHandled(TRUE); \ - func((LPHELPINFO)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey) -#define MSG_WM_HOTKEY(func) \ - if (uMsg == WM_HOTKEY) \ - { \ - SetMsgHandled(TRUE); \ - func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout) -#define MSG_WM_INPUTLANGCHANGE(func) \ - if (uMsg == WM_INPUTLANGCHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func((DWORD)wParam, (HKL)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout) -#define MSG_WM_INPUTLANGCHANGEREQUEST(func) \ - if (uMsg == WM_INPUTLANGCHANGEREQUEST) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam, (HKL)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus) -#define MSG_WM_NEXTDLGCTL(func) \ - if (uMsg == WM_NEXTDLGCTL) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)LOWORD(lParam), wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu) -#define MSG_WM_NEXTMENU(func) \ - if (uMsg == WM_NEXTMENU) \ - { \ - SetMsgHandled(TRUE); \ - func((int)wParam, (LPMDINEXTMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnNotifyFormat(CWindow wndFrom, int nCommand) -#define MSG_WM_NOTIFYFORMAT(func) \ - if (uMsg == WM_NOTIFYFORMAT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, (int)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData) -#define MSG_WM_POWERBROADCAST(func) \ - if (uMsg == WM_POWERBROADCAST) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPrint(CDCHandle dc, UINT uFlags) -#define MSG_WM_PRINT(func) \ - if (uMsg == WM_PRINT) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam, (UINT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPrintClient(CDCHandle dc, UINT uFlags) -#define MSG_WM_PRINTCLIENT(func) \ - if (uMsg == WM_PRINTCLIENT) \ - { \ - SetMsgHandled(TRUE); \ - func((HDC)wParam, (UINT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError) -#define MSG_WM_RASDIALEVENT(func) \ - if (uMsg == WM_RASDIALEVENT) \ - { \ - SetMsgHandled(TRUE); \ - func((RASCONNSTATE)wParam, (DWORD)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSetFont(CFont font, BOOL bRedraw) -#define MSG_WM_SETFONT(func) \ - if (uMsg == WM_SETFONT) \ - { \ - SetMsgHandled(TRUE); \ - func((HFONT)wParam, (BOOL)LOWORD(lParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnSetHotKey(int nVirtKey, UINT uFlags) -#define MSG_WM_SETHOTKEY(func) \ - if (uMsg == WM_SETHOTKEY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HICON OnSetIcon(UINT uType, HICON hIcon) -#define MSG_WM_SETICON(func) \ - if (uMsg == WM_SETICON) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnSetRedraw(BOOL bRedraw) -#define MSG_WM_SETREDRAW(func) \ - if (uMsg == WM_SETREDRAW) \ - { \ - SetMsgHandled(TRUE); \ - func((BOOL)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnSetText(LPCTSTR lpstrText) -#define MSG_WM_SETTEXT(func) \ - if (uMsg == WM_SETTEXT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPCTSTR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUserChanged() -#define MSG_WM_USERCHANGED(func) \ - if (uMsg == WM_USERCHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// New NT4 & NT5 messages - -#if(_WIN32_WINNT >= 0x0400) - -// void OnMouseHover(WPARAM wParam, CPoint ptPos) -#define MSG_WM_MOUSEHOVER(func) \ - if (uMsg == WM_MOUSEHOVER) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMouseLeave() -#define MSG_WM_MOUSELEAVE(func) \ - if (uMsg == WM_MOUSELEAVE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if(WINVER >= 0x0500) - -// void OnMenuRButtonUp(WPARAM wParam, CMenu menu) -#define MSG_WM_MENURBUTTONUP(func) \ - if (uMsg == WM_MENURBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, (HMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMenuDrag(WPARAM wParam, CMenu menu) -#define MSG_WM_MENUDRAG(func) \ - if (uMsg == WM_MENUDRAG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(wParam, (HMENU)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info) -#define MSG_WM_MENUGETOBJECT(func) \ - if (uMsg == WM_MENUGETOBJECT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((PMENUGETOBJECTINFO)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUnInitMenuPopup(UINT nID, CMenu menu) -#define MSG_WM_UNINITMENUPOPUP(func) \ - if (uMsg == WM_UNINITMENUPOPUP) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(lParam), (HMENU)wParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnMenuCommand(WPARAM nIndex, CMenu menu) -#define MSG_WM_MENUCOMMAND(func) \ - if (uMsg == WM_MENUCOMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, (HMENU)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif /* WINVER >= 0x0500 */ - -#if(_WIN32_WINNT >= 0x0500) - -// BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys) -#define MSG_WM_APPCOMMAND(func) \ - if (uMsg == WM_APPCOMMAND) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos) -#define MSG_WM_NCXBUTTONDOWN(func) \ - if (uMsg == WM_NCXBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos) -#define MSG_WM_NCXBUTTONUP(func) \ - if (uMsg == WM_NCXBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos) -#define MSG_WM_NCXBUTTONDBLCLK(func) \ - if (uMsg == WM_NCXBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos) -#define MSG_WM_XBUTTONDOWN(func) \ - if (uMsg == WM_XBUTTONDOWN) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos) -#define MSG_WM_XBUTTONUP(func) \ - if (uMsg == WM_XBUTTONUP) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos) -#define MSG_WM_XBUTTONDBLCLK(func) \ - if (uMsg == WM_XBUTTONDBLCLK) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnChangeUIState(WORD nAction, WORD nState) -#define MSG_WM_CHANGEUISTATE(func) \ - if (uMsg == WM_CHANGEUISTATE) \ - { \ - SetMsgHandled(TRUE); \ - func(LOWORD(wParam), HIWORD(wParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUpdateUIState(WORD nAction, WORD nState) -#define MSG_WM_UPDATEUISTATE(func) \ - if (uMsg == WM_UPDATEUISTATE) \ - { \ - SetMsgHandled(TRUE); \ - func(LOWORD(wParam), HIWORD(wParam)); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnQueryUIState() -#define MSG_WM_QUERYUISTATE(func) \ - if (uMsg == WM_QUERYUISTATE) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif // (_WIN32_WINNT >= 0x0500) - -#if(_WIN32_WINNT >= 0x0501) - -// void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput) -#define MSG_WM_INPUT(func) \ - if (uMsg == WM_INPUT) \ - { \ - SetMsgHandled(TRUE); \ - func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags) -#define MSG_WM_UNICHAR(func) \ - if (uMsg == WM_UNICHAR) \ - { \ - SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ - if(IsMsgHandled()) \ - { \ - lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \ - return TRUE; \ - } \ - } - -// void OnWTSSessionChange(WPARAM nStatusCode, PWTSSESSION_NOTIFICATION nSessionID) -#define MSG_WM_WTSSESSION_CHANGE(func) \ - if (uMsg == WM_WTSSESSION_CHANGE) \ - { \ - SetMsgHandled(TRUE); \ - func(wParam, (PWTSSESSION_NOTIFICATION)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// OnThemeChanged() -#define MSG_WM_THEMECHANGED(func) \ - if (uMsg == WM_THEMECHANGED) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif /* _WIN32_WINNT >= 0x0501 */ - -/////////////////////////////////////////////////////////////////////////////// -// ATL defined messages - -// BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData) -#define MSG_WM_FORWARDMSG(func) \ - if (uMsg == WM_FORWARDMSG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Dialog specific messages - -// LRESULT OnDMGetDefID() -#define MSG_DM_GETDEFID(func) \ - if (uMsg == DM_GETDEFID) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDMSetDefID(UINT DefID) -#define MSG_DM_SETDEFID(func) \ - if (uMsg == DM_SETDEFID) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnDMReposition() -#define MSG_DM_REPOSITION(func) \ - if (uMsg == DM_REPOSITION) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Reflected messages - -// void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl) -#define MSG_OCM_COMMAND(func) \ - if (uMsg == OCM_COMMAND) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh) -#define MSG_OCM_NOTIFY(func) \ - if (uMsg == OCM_NOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((int)wParam, (LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam) -#define MSG_OCM_PARENTNOTIFY(func) \ - if (uMsg == OCM_PARENTNOTIFY) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) -#define MSG_OCM_DRAWITEM(func) \ - if (uMsg == OCM_DRAWITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) -#define MSG_OCM_MEASUREITEM(func) \ - if (uMsg == OCM_MEASUREITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) -#define MSG_OCM_COMPAREITEM(func) \ - if (uMsg == OCM_COMPAREITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) -#define MSG_OCM_DELETEITEM(func) \ - if (uMsg == OCM_DELETEITEM) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ - lResult = TRUE; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) -#define MSG_OCM_VKEYTOITEM(func) \ - if (uMsg == OCM_VKEYTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -//int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox) -#define MSG_OCM_CHARTOITEM(func) \ - if (uMsg == OCM_CHARTOITEM) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_OCM_HSCROLL(func) \ - if (uMsg == OCM_HSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) -#define MSG_OCM_VSCROLL(func) \ - if (uMsg == OCM_VSCROLL) \ - { \ - SetMsgHandled(TRUE); \ - func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit) -#define MSG_OCM_CTLCOLOREDIT(func) \ - if (uMsg == OCM_CTLCOLOREDIT) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox) -#define MSG_OCM_CTLCOLORLISTBOX(func) \ - if (uMsg == OCM_CTLCOLORLISTBOX) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button) -#define MSG_OCM_CTLCOLORBTN(func) \ - if (uMsg == OCM_CTLCOLORBTN) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd) -#define MSG_OCM_CTLCOLORDLG(func) \ - if (uMsg == OCM_CTLCOLORDLG) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) -#define MSG_OCM_CTLCOLORSCROLLBAR(func) \ - if (uMsg == OCM_CTLCOLORSCROLLBAR) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic) -#define MSG_OCM_CTLCOLORSTATIC(func) \ - if (uMsg == OCM_CTLCOLORSTATIC) \ - { \ - SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Edit specific messages - -// void OnClear() -#define MSG_WM_CLEAR(func) \ - if (uMsg == WM_CLEAR) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCopy() -#define MSG_WM_COPY(func) \ - if (uMsg == WM_COPY) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCut() -#define MSG_WM_CUT(func) \ - if (uMsg == WM_CUT) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnPaste() -#define MSG_WM_PASTE(func) \ - if (uMsg == WM_PASTE) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnUndo() -#define MSG_WM_UNDO(func) \ - if (uMsg == WM_UNDO) \ - { \ - SetMsgHandled(TRUE); \ - func(); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Generic message handlers - -// LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) -#define MESSAGE_HANDLER_EX(msg, func) \ - if(uMsg == msg) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(uMsg, wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) -#define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \ - if(uMsg >= msgFirst && uMsg <= msgLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func(uMsg, wParam, lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// Commands and notifications - -// void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_HANDLER_EX(id, code, func) \ - if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_ID_HANDLER_EX(id, func) \ - if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_CODE_HANDLER_EX(code, func) \ - if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyHandlerEX(LPNMHDR pnmh) -#define NOTIFY_HANDLER_EX(id, cd, func) \ - if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh) -#define NOTIFY_ID_HANDLER_EX(id, func) \ - if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh) -#define NOTIFY_CODE_HANDLER_EX(cd, func) \ - if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh) -#define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh) -#define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \ - if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \ - if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \ - if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \ - if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \ - if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \ - if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) -#define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ - lResult = 0; \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -// LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh) -#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - SetMsgHandled(TRUE); \ - lResult = func((LPNMHDR)lParam); \ - if(IsMsgHandled()) \ - return TRUE; \ - } - -#endif // __ATLCRACK_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLCRACK_H__ +#define __ATLCRACK_H__ + +#pragma once + + +/////////////////////////////////////////////////////////////////////////////// +// Message map macro for cracked handlers + +// Note about message maps with cracked handlers: +// For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX. +// For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes, +// but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl. + +#define BEGIN_MSG_MAP_EX(theClass) \ +public: \ + BOOL m_bMsgHandled; \ + /* "handled" management for cracked handlers */ \ + BOOL IsMsgHandled() const \ + { \ + return m_bMsgHandled; \ + } \ + void SetMsgHandled(BOOL bHandled) \ + { \ + m_bMsgHandled = bHandled; \ + } \ + BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \ + { \ + BOOL bOldMsgHandled = m_bMsgHandled; \ + BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \ + m_bMsgHandled = bOldMsgHandled; \ + return bRet; \ + } \ + BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \ + { \ + BOOL bHandled = TRUE; \ + hWnd; \ + uMsg; \ + wParam; \ + lParam; \ + lResult; \ + bHandled; \ + switch(dwMsgMapID) \ + { \ + case 0: + + +/////////////////////////////////////////////////////////////////////////////// +// Standard Windows message macros + +// int OnCreate(LPCREATESTRUCT lpCreateStruct) +#define MSG_WM_CREATE(func) \ + if (uMsg == WM_CREATE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam) +#define MSG_WM_INITDIALOG(func) \ + if (uMsg == WM_INITDIALOG) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HWND)wParam, lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct) +#define MSG_WM_COPYDATA(func) \ + if (uMsg == WM_COPYDATA) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDestroy() +#define MSG_WM_DESTROY(func) \ + if (uMsg == WM_DESTROY) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMove(CPoint ptPos) +#define MSG_WM_MOVE(func) \ + if (uMsg == WM_MOVE) \ + { \ + SetMsgHandled(TRUE); \ + func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSize(UINT nType, CSize size) +#define MSG_WM_SIZE(func) \ + if (uMsg == WM_SIZE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther) +#define MSG_WM_ACTIVATE(func) \ + if (uMsg == WM_ACTIVATE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSetFocus(CWindow wndOld) +#define MSG_WM_SETFOCUS(func) \ + if (uMsg == WM_SETFOCUS) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnKillFocus(CWindow wndFocus) +#define MSG_WM_KILLFOCUS(func) \ + if (uMsg == WM_KILLFOCUS) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnEnable(BOOL bEnable) +#define MSG_WM_ENABLE(func) \ + if (uMsg == WM_ENABLE) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPaint(CDCHandle dc) +#define MSG_WM_PAINT(func) \ + if (uMsg == WM_PAINT) \ + { \ + SetMsgHandled(TRUE); \ + func((HDC)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnClose() +#define MSG_WM_CLOSE(func) \ + if (uMsg == WM_CLOSE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnQueryEndSession(UINT nSource, UINT uLogOff) +#define MSG_WM_QUERYENDSESSION(func) \ + if (uMsg == WM_QUERYENDSESSION) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnQueryOpen() +#define MSG_WM_QUERYOPEN(func) \ + if (uMsg == WM_QUERYOPEN) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnEraseBkgnd(CDCHandle dc) +#define MSG_WM_ERASEBKGND(func) \ + if (uMsg == WM_ERASEBKGND) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSysColorChange() +#define MSG_WM_SYSCOLORCHANGE(func) \ + if (uMsg == WM_SYSCOLORCHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnEndSession(BOOL bEnding, UINT uLogOff) +#define MSG_WM_ENDSESSION(func) \ + if (uMsg == WM_ENDSESSION) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam, (UINT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnShowWindow(BOOL bShow, UINT nStatus) +#define MSG_WM_SHOWWINDOW(func) \ + if (uMsg == WM_SHOWWINDOW) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam, (int)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit) +#define MSG_WM_CTLCOLOREDIT(func) \ + if (uMsg == WM_CTLCOLOREDIT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox) +#define MSG_WM_CTLCOLORLISTBOX(func) \ + if (uMsg == WM_CTLCOLORLISTBOX) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button) +#define MSG_WM_CTLCOLORBTN(func) \ + if (uMsg == WM_CTLCOLORBTN) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd) +#define MSG_WM_CTLCOLORDLG(func) \ + if (uMsg == WM_CTLCOLORDLG) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) +#define MSG_WM_CTLCOLORSCROLLBAR(func) \ + if (uMsg == WM_CTLCOLORSCROLLBAR) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic) +#define MSG_WM_CTLCOLORSTATIC(func) \ + if (uMsg == WM_CTLCOLORSTATIC) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSettingChange(UINT uFlags, LPCTSTR lpszSection) +#define MSG_WM_SETTINGCHANGE(func) \ + if (uMsg == WM_SETTINGCHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPCTSTR)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDevModeChange(LPCTSTR lpDeviceName) +#define MSG_WM_DEVMODECHANGE(func) \ + if (uMsg == WM_DEVMODECHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func((LPCTSTR)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnActivateApp(BOOL bActive, DWORD dwThreadID) +#define MSG_WM_ACTIVATEAPP(func) \ + if (uMsg == WM_ACTIVATEAPP) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam, (DWORD)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnFontChange() +#define MSG_WM_FONTCHANGE(func) \ + if (uMsg == WM_FONTCHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnTimeChange() +#define MSG_WM_TIMECHANGE(func) \ + if (uMsg == WM_TIMECHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCancelMode() +#define MSG_WM_CANCELMODE(func) \ + if (uMsg == WM_CANCELMODE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message) +#define MSG_WM_SETCURSOR(func) \ + if (uMsg == WM_SETCURSOR) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message) +#define MSG_WM_MOUSEACTIVATE(func) \ + if (uMsg == WM_MOUSEACTIVATE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnChildActivate() +#define MSG_WM_CHILDACTIVATE(func) \ + if (uMsg == WM_CHILDACTIVATE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnGetMinMaxInfo(LPMINMAXINFO lpMMI) +#define MSG_WM_GETMINMAXINFO(func) \ + if (uMsg == WM_GETMINMAXINFO) \ + { \ + SetMsgHandled(TRUE); \ + func((LPMINMAXINFO)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnIconEraseBkgnd(CDCHandle dc) +#define MSG_WM_ICONERASEBKGND(func) \ + if (uMsg == WM_ICONERASEBKGND) \ + { \ + SetMsgHandled(TRUE); \ + func((HDC)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSpoolerStatus(UINT nStatus, UINT nJobs) +#define MSG_WM_SPOOLERSTATUS(func) \ + if (uMsg == WM_SPOOLERSTATUS) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (UINT)LOWORD(lParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) +#define MSG_WM_DRAWITEM(func) \ + if (uMsg == WM_DRAWITEM) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) +#define MSG_WM_MEASUREITEM(func) \ + if (uMsg == WM_MEASUREITEM) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) +#define MSG_WM_DELETEITEM(func) \ + if (uMsg == WM_DELETEITEM) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +//int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox) +#define MSG_WM_CHARTOITEM(func) \ + if (uMsg == WM_CHARTOITEM) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) +#define MSG_WM_VKEYTOITEM(func) \ + if (uMsg == WM_VKEYTOITEM) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HCURSOR OnQueryDragIcon() +#define MSG_WM_QUERYDRAGICON(func) \ + if (uMsg == WM_QUERYDRAGICON) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) +#define MSG_WM_COMPAREITEM(func) \ + if (uMsg == WM_COMPAREITEM) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCompacting(UINT nCpuTime) +#define MSG_WM_COMPACTING(func) \ + if (uMsg == WM_COMPACTING) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct) +#define MSG_WM_NCCREATE(func) \ + if (uMsg == WM_NCCREATE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcDestroy() +#define MSG_WM_NCDESTROY(func) \ + if (uMsg == WM_NCDESTROY) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam) +#define MSG_WM_NCCALCSIZE(func) \ + if (uMsg == WM_NCCALCSIZE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((BOOL)wParam, lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// UINT OnNcHitTest(CPoint point) +#define MSG_WM_NCHITTEST(func) \ + if (uMsg == WM_NCHITTEST) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcPaint(CRgn rgn) +#define MSG_WM_NCPAINT(func) \ + if (uMsg == WM_NCPAINT) \ + { \ + SetMsgHandled(TRUE); \ + func((HRGN)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnNcActivate(BOOL bActive) +#define MSG_WM_NCACTIVATE(func) \ + if (uMsg == WM_NCACTIVATE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((BOOL)wParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// UINT OnGetDlgCode(LPMSG lpMsg) +#define MSG_WM_GETDLGCODE(func) \ + if (uMsg == WM_GETDLGCODE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((LPMSG)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcMouseMove(UINT nHitTest, CPoint point) +#define MSG_WM_NCMOUSEMOVE(func) \ + if (uMsg == WM_NCMOUSEMOVE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcLButtonDown(UINT nHitTest, CPoint point) +#define MSG_WM_NCLBUTTONDOWN(func) \ + if (uMsg == WM_NCLBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcLButtonUp(UINT nHitTest, CPoint point) +#define MSG_WM_NCLBUTTONUP(func) \ + if (uMsg == WM_NCLBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcLButtonDblClk(UINT nHitTest, CPoint point) +#define MSG_WM_NCLBUTTONDBLCLK(func) \ + if (uMsg == WM_NCLBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcRButtonDown(UINT nHitTest, CPoint point) +#define MSG_WM_NCRBUTTONDOWN(func) \ + if (uMsg == WM_NCRBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcRButtonUp(UINT nHitTest, CPoint point) +#define MSG_WM_NCRBUTTONUP(func) \ + if (uMsg == WM_NCRBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcRButtonDblClk(UINT nHitTest, CPoint point) +#define MSG_WM_NCRBUTTONDBLCLK(func) \ + if (uMsg == WM_NCRBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcMButtonDown(UINT nHitTest, CPoint point) +#define MSG_WM_NCMBUTTONDOWN(func) \ + if (uMsg == WM_NCMBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcMButtonUp(UINT nHitTest, CPoint point) +#define MSG_WM_NCMBUTTONUP(func) \ + if (uMsg == WM_NCMBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNcMButtonDblClk(UINT nHitTest, CPoint point) +#define MSG_WM_NCMBUTTONDBLCLK(func) \ + if (uMsg == WM_NCMBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_KEYDOWN(func) \ + if (uMsg == WM_KEYDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_KEYUP(func) \ + if (uMsg == WM_KEYUP) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_CHAR(func) \ + if (uMsg == WM_CHAR) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_DEADCHAR(func) \ + if (uMsg == WM_DEADCHAR) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_SYSKEYDOWN(func) \ + if (uMsg == WM_SYSKEYDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_SYSKEYUP(func) \ + if (uMsg == WM_SYSKEYUP) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_SYSCHAR(func) \ + if (uMsg == WM_SYSCHAR) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_SYSDEADCHAR(func) \ + if (uMsg == WM_SYSDEADCHAR) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSysCommand(UINT nID, LPARAM lParam) +#define MSG_WM_SYSCOMMAND(func) \ + if (uMsg == WM_SYSCOMMAND) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnTCard(UINT idAction, DWORD dwActionData) +#define MSG_WM_TCARD(func) \ + if (uMsg == WM_TCARD) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (DWORD)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnTimer(UINT_PTR nIDEvent) +#define MSG_WM_TIMER(func) \ + if (uMsg == WM_TIMER) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT_PTR)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) +#define MSG_WM_HSCROLL(func) \ + if (uMsg == WM_HSCROLL) \ + { \ + SetMsgHandled(TRUE); \ + func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) +#define MSG_WM_VSCROLL(func) \ + if (uMsg == WM_VSCROLL) \ + { \ + SetMsgHandled(TRUE); \ + func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnInitMenu(CMenu menu) +#define MSG_WM_INITMENU(func) \ + if (uMsg == WM_INITMENU) \ + { \ + SetMsgHandled(TRUE); \ + func((HMENU)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnInitMenuPopup(CMenu menuPopup, UINT nIndex, BOOL bSysMenu) +#define MSG_WM_INITMENUPOPUP(func) \ + if (uMsg == WM_INITMENUPOPUP) \ + { \ + SetMsgHandled(TRUE); \ + func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMenuSelect(UINT nItemID, UINT nFlags, CMenu menu) +#define MSG_WM_MENUSELECT(func) \ + if (uMsg == WM_MENUSELECT) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu menu) +#define MSG_WM_MENUCHAR(func) \ + if (uMsg == WM_MENUCHAR) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNotify(int idCtrl, LPNMHDR pnmh) +#define MSG_WM_NOTIFY(func) \ + if (uMsg == WM_NOTIFY) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((int)wParam, (LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnEnterIdle(UINT nWhy, CWindow wndWho) +#define MSG_WM_ENTERIDLE(func) \ + if (uMsg == WM_ENTERIDLE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMouseMove(UINT nFlags, CPoint point) +#define MSG_WM_MOUSEMOVE(func) \ + if (uMsg == WM_MOUSEMOVE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +#define MSG_WM_MOUSEWHEEL(func) \ + if (uMsg == WM_MOUSEWHEEL) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnLButtonDown(UINT nFlags, CPoint point) +#define MSG_WM_LBUTTONDOWN(func) \ + if (uMsg == WM_LBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnLButtonUp(UINT nFlags, CPoint point) +#define MSG_WM_LBUTTONUP(func) \ + if (uMsg == WM_LBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnLButtonDblClk(UINT nFlags, CPoint point) +#define MSG_WM_LBUTTONDBLCLK(func) \ + if (uMsg == WM_LBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnRButtonDown(UINT nFlags, CPoint point) +#define MSG_WM_RBUTTONDOWN(func) \ + if (uMsg == WM_RBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnRButtonUp(UINT nFlags, CPoint point) +#define MSG_WM_RBUTTONUP(func) \ + if (uMsg == WM_RBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnRButtonDblClk(UINT nFlags, CPoint point) +#define MSG_WM_RBUTTONDBLCLK(func) \ + if (uMsg == WM_RBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMButtonDown(UINT nFlags, CPoint point) +#define MSG_WM_MBUTTONDOWN(func) \ + if (uMsg == WM_MBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMButtonUp(UINT nFlags, CPoint point) +#define MSG_WM_MBUTTONUP(func) \ + if (uMsg == WM_MBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMButtonDblClk(UINT nFlags, CPoint point) +#define MSG_WM_MBUTTONDBLCLK(func) \ + if (uMsg == WM_MBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam) +#define MSG_WM_PARENTNOTIFY(func) \ + if (uMsg == WM_PARENTNOTIFY) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate) +#define MSG_WM_MDIACTIVATE(func) \ + if (uMsg == WM_MDIACTIVATE) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnRenderFormat(UINT nFormat) +#define MSG_WM_RENDERFORMAT(func) \ + if (uMsg == WM_RENDERFORMAT) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnRenderAllFormats() +#define MSG_WM_RENDERALLFORMATS(func) \ + if (uMsg == WM_RENDERALLFORMATS) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDestroyClipboard() +#define MSG_WM_DESTROYCLIPBOARD(func) \ + if (uMsg == WM_DESTROYCLIPBOARD) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDrawClipboard() +#define MSG_WM_DRAWCLIPBOARD(func) \ + if (uMsg == WM_DRAWCLIPBOARD) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct) +#define MSG_WM_PAINTCLIPBOARD(func) \ + if (uMsg == WM_PAINTCLIPBOARD) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \ + ::GlobalUnlock((HGLOBAL)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) +#define MSG_WM_VSCROLLCLIPBOARD(func) \ + if (uMsg == WM_VSCROLLCLIPBOARD) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnContextMenu(CWindow wnd, CPoint point) +#define MSG_WM_CONTEXTMENU(func) \ + if (uMsg == WM_CONTEXTMENU) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect) +#define MSG_WM_SIZECLIPBOARD(func) \ + if (uMsg == WM_SIZECLIPBOARD) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \ + ::GlobalUnlock((HGLOBAL)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString) +#define MSG_WM_ASKCBFORMATNAME(func) \ + if (uMsg == WM_ASKCBFORMATNAME) \ + { \ + SetMsgHandled(TRUE); \ + func((DWORD)wParam, (LPTSTR)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter) +#define MSG_WM_CHANGECBCHAIN(func) \ + if (uMsg == WM_CHANGECBCHAIN) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) +#define MSG_WM_HSCROLLCLIPBOARD(func) \ + if (uMsg == WM_HSCROLLCLIPBOARD) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnQueryNewPalette() +#define MSG_WM_QUERYNEWPALETTE(func) \ + if (uMsg == WM_QUERYNEWPALETTE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPaletteChanged(CWindow wndFocus) +#define MSG_WM_PALETTECHANGED(func) \ + if (uMsg == WM_PALETTECHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPaletteIsChanging(CWindow wndPalChg) +#define MSG_WM_PALETTEISCHANGING(func) \ + if (uMsg == WM_PALETTEISCHANGING) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDropFiles(HDROP hDropInfo) +#define MSG_WM_DROPFILES(func) \ + if (uMsg == WM_DROPFILES) \ + { \ + SetMsgHandled(TRUE); \ + func((HDROP)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnWindowPosChanging(LPWINDOWPOS lpWndPos) +#define MSG_WM_WINDOWPOSCHANGING(func) \ + if (uMsg == WM_WINDOWPOSCHANGING) \ + { \ + SetMsgHandled(TRUE); \ + func((LPWINDOWPOS)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnWindowPosChanged(LPWINDOWPOS lpWndPos) +#define MSG_WM_WINDOWPOSCHANGED(func) \ + if (uMsg == WM_WINDOWPOSCHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func((LPWINDOWPOS)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnExitMenuLoop(BOOL fIsTrackPopupMenu) +#define MSG_WM_EXITMENULOOP(func) \ + if (uMsg == WM_EXITMENULOOP) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnEnterMenuLoop(BOOL fIsTrackPopupMenu) +#define MSG_WM_ENTERMENULOOP(func) \ + if (uMsg == WM_ENTERMENULOOP) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct) +#define MSG_WM_STYLECHANGED(func) \ + if (uMsg == WM_STYLECHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct) +#define MSG_WM_STYLECHANGING(func) \ + if (uMsg == WM_STYLECHANGING) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSizing(UINT fwSide, LPRECT pRect) +#define MSG_WM_SIZING(func) \ + if (uMsg == WM_SIZING) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPRECT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMoving(UINT fwSide, LPRECT pRect) +#define MSG_WM_MOVING(func) \ + if (uMsg == WM_MOVING) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPRECT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCaptureChanged(CWindow wnd) +#define MSG_WM_CAPTURECHANGED(func) \ + if (uMsg == WM_CAPTURECHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func((HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnDeviceChange(UINT nEventType, DWORD dwData) +#define MSG_WM_DEVICECHANGE(func) \ + if (uMsg == WM_DEVICECHANGE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl) +#define MSG_WM_COMMAND(func) \ + if (uMsg == WM_COMMAND) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen) +#define MSG_WM_DISPLAYCHANGE(func) \ + if (uMsg == WM_DISPLAYCHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnEnterSizeMove() +#define MSG_WM_ENTERSIZEMOVE(func) \ + if (uMsg == WM_ENTERSIZEMOVE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnExitSizeMove() +#define MSG_WM_EXITSIZEMOVE(func) \ + if (uMsg == WM_EXITSIZEMOVE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HFONT OnGetFont() +#define MSG_WM_GETFONT(func) \ + if (uMsg == WM_GETFONT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnGetHotKey() +#define MSG_WM_GETHOTKEY(func) \ + if (uMsg == WM_GETHOTKEY) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HICON OnGetIcon() +#define MSG_WM_GETICON(func) \ + if (uMsg == WM_GETICON) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)wParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnGetText(int cchTextMax, LPTSTR lpszText) +#define MSG_WM_GETTEXT(func) \ + if (uMsg == WM_GETTEXT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnGetTextLength() +#define MSG_WM_GETTEXTLENGTH(func) \ + if (uMsg == WM_GETTEXTLENGTH) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnHelp(LPHELPINFO lpHelpInfo) +#define MSG_WM_HELP(func) \ + if (uMsg == WM_HELP) \ + { \ + SetMsgHandled(TRUE); \ + func((LPHELPINFO)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey) +#define MSG_WM_HOTKEY(func) \ + if (uMsg == WM_HOTKEY) \ + { \ + SetMsgHandled(TRUE); \ + func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout) +#define MSG_WM_INPUTLANGCHANGE(func) \ + if (uMsg == WM_INPUTLANGCHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func((DWORD)wParam, (HKL)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout) +#define MSG_WM_INPUTLANGCHANGEREQUEST(func) \ + if (uMsg == WM_INPUTLANGCHANGEREQUEST) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam, (HKL)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus) +#define MSG_WM_NEXTDLGCTL(func) \ + if (uMsg == WM_NEXTDLGCTL) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)LOWORD(lParam), wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu) +#define MSG_WM_NEXTMENU(func) \ + if (uMsg == WM_NEXTMENU) \ + { \ + SetMsgHandled(TRUE); \ + func((int)wParam, (LPMDINEXTMENU)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnNotifyFormat(CWindow wndFrom, int nCommand) +#define MSG_WM_NOTIFYFORMAT(func) \ + if (uMsg == WM_NOTIFYFORMAT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HWND)wParam, (int)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData) +#define MSG_WM_POWERBROADCAST(func) \ + if (uMsg == WM_POWERBROADCAST) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPrint(CDCHandle dc, UINT uFlags) +#define MSG_WM_PRINT(func) \ + if (uMsg == WM_PRINT) \ + { \ + SetMsgHandled(TRUE); \ + func((HDC)wParam, (UINT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPrintClient(CDCHandle dc, UINT uFlags) +#define MSG_WM_PRINTCLIENT(func) \ + if (uMsg == WM_PRINTCLIENT) \ + { \ + SetMsgHandled(TRUE); \ + func((HDC)wParam, (UINT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError) +#define MSG_WM_RASDIALEVENT(func) \ + if (uMsg == WM_RASDIALEVENT) \ + { \ + SetMsgHandled(TRUE); \ + func((RASCONNSTATE)wParam, (DWORD)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSetFont(CFont font, BOOL bRedraw) +#define MSG_WM_SETFONT(func) \ + if (uMsg == WM_SETFONT) \ + { \ + SetMsgHandled(TRUE); \ + func((HFONT)wParam, (BOOL)LOWORD(lParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnSetHotKey(int nVirtKey, UINT uFlags) +#define MSG_WM_SETHOTKEY(func) \ + if (uMsg == WM_SETHOTKEY) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HICON OnSetIcon(UINT uType, HICON hIcon) +#define MSG_WM_SETICON(func) \ + if (uMsg == WM_SETICON) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnSetRedraw(BOOL bRedraw) +#define MSG_WM_SETREDRAW(func) \ + if (uMsg == WM_SETREDRAW) \ + { \ + SetMsgHandled(TRUE); \ + func((BOOL)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnSetText(LPCTSTR lpstrText) +#define MSG_WM_SETTEXT(func) \ + if (uMsg == WM_SETTEXT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((LPCTSTR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnUserChanged() +#define MSG_WM_USERCHANGED(func) \ + if (uMsg == WM_USERCHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// New NT4 & NT5 messages + +#if(_WIN32_WINNT >= 0x0400) + +// void OnMouseHover(WPARAM wParam, CPoint ptPos) +#define MSG_WM_MOUSEHOVER(func) \ + if (uMsg == WM_MOUSEHOVER) \ + { \ + SetMsgHandled(TRUE); \ + func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMouseLeave() +#define MSG_WM_MOUSELEAVE(func) \ + if (uMsg == WM_MOUSELEAVE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif /* _WIN32_WINNT >= 0x0400 */ + +#if(WINVER >= 0x0500) + +// void OnMenuRButtonUp(WPARAM wParam, CMenu menu) +#define MSG_WM_MENURBUTTONUP(func) \ + if (uMsg == WM_MENURBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func(wParam, (HMENU)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnMenuDrag(WPARAM wParam, CMenu menu) +#define MSG_WM_MENUDRAG(func) \ + if (uMsg == WM_MENUDRAG) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func(wParam, (HMENU)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info) +#define MSG_WM_MENUGETOBJECT(func) \ + if (uMsg == WM_MENUGETOBJECT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((PMENUGETOBJECTINFO)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnUnInitMenuPopup(UINT nID, CMenu menu) +#define MSG_WM_UNINITMENUPOPUP(func) \ + if (uMsg == WM_UNINITMENUPOPUP) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(lParam), (HMENU)wParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnMenuCommand(WPARAM nIndex, CMenu menu) +#define MSG_WM_MENUCOMMAND(func) \ + if (uMsg == WM_MENUCOMMAND) \ + { \ + SetMsgHandled(TRUE); \ + func(wParam, (HMENU)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif /* WINVER >= 0x0500 */ + +#if(_WIN32_WINNT >= 0x0500) + +// BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys) +#define MSG_WM_APPCOMMAND(func) \ + if (uMsg == WM_APPCOMMAND) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos) +#define MSG_WM_NCXBUTTONDOWN(func) \ + if (uMsg == WM_NCXBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos) +#define MSG_WM_NCXBUTTONUP(func) \ + if (uMsg == WM_NCXBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos) +#define MSG_WM_NCXBUTTONDBLCLK(func) \ + if (uMsg == WM_NCXBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos) +#define MSG_WM_XBUTTONDOWN(func) \ + if (uMsg == WM_XBUTTONDOWN) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos) +#define MSG_WM_XBUTTONUP(func) \ + if (uMsg == WM_XBUTTONUP) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos) +#define MSG_WM_XBUTTONDBLCLK(func) \ + if (uMsg == WM_XBUTTONDBLCLK) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnChangeUIState(WORD nAction, WORD nState) +#define MSG_WM_CHANGEUISTATE(func) \ + if (uMsg == WM_CHANGEUISTATE) \ + { \ + SetMsgHandled(TRUE); \ + func(LOWORD(wParam), HIWORD(wParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnUpdateUIState(WORD nAction, WORD nState) +#define MSG_WM_UPDATEUISTATE(func) \ + if (uMsg == WM_UPDATEUISTATE) \ + { \ + SetMsgHandled(TRUE); \ + func(LOWORD(wParam), HIWORD(wParam)); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnQueryUIState() +#define MSG_WM_QUERYUISTATE(func) \ + if (uMsg == WM_QUERYUISTATE) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif // (_WIN32_WINNT >= 0x0500) + +#if(_WIN32_WINNT >= 0x0501) + +// void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput) +#define MSG_WM_INPUT(func) \ + if (uMsg == WM_INPUT) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags) +#define MSG_WM_UNICHAR(func) \ + if (uMsg == WM_UNICHAR) \ + { \ + SetMsgHandled(TRUE); \ + func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + if(IsMsgHandled()) \ + { \ + lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \ + return TRUE; \ + } \ + } + +// void OnWTSSessionChange(WPARAM nStatusCode, PWTSSESSION_NOTIFICATION nSessionID) +#define MSG_WM_WTSSESSION_CHANGE(func) \ + if (uMsg == WM_WTSSESSION_CHANGE) \ + { \ + SetMsgHandled(TRUE); \ + func(wParam, (PWTSSESSION_NOTIFICATION)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// OnThemeChanged() +#define MSG_WM_THEMECHANGED(func) \ + if (uMsg == WM_THEMECHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif /* _WIN32_WINNT >= 0x0501 */ + +/////////////////////////////////////////////////////////////////////////////// +// ATL defined messages + +// BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData) +#define MSG_WM_FORWARDMSG(func) \ + if (uMsg == WM_FORWARDMSG) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// Dialog specific messages + +// LRESULT OnDMGetDefID() +#define MSG_DM_GETDEFID(func) \ + if (uMsg == DM_GETDEFID) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func(); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDMSetDefID(UINT DefID) +#define MSG_DM_SETDEFID(func) \ + if (uMsg == DM_SETDEFID) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnDMReposition() +#define MSG_DM_REPOSITION(func) \ + if (uMsg == DM_REPOSITION) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// Reflected messages + +// void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl) +#define MSG_OCM_COMMAND(func) \ + if (uMsg == OCM_COMMAND) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh) +#define MSG_OCM_NOTIFY(func) \ + if (uMsg == OCM_NOTIFY) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((int)wParam, (LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam) +#define MSG_OCM_PARENTNOTIFY(func) \ + if (uMsg == OCM_PARENTNOTIFY) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) +#define MSG_OCM_DRAWITEM(func) \ + if (uMsg == OCM_DRAWITEM) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) +#define MSG_OCM_MEASUREITEM(func) \ + if (uMsg == OCM_MEASUREITEM) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) +#define MSG_OCM_COMPAREITEM(func) \ + if (uMsg == OCM_COMPAREITEM) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) +#define MSG_OCM_DELETEITEM(func) \ + if (uMsg == OCM_DELETEITEM) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) +#define MSG_OCM_VKEYTOITEM(func) \ + if (uMsg == OCM_VKEYTOITEM) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +//int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox) +#define MSG_OCM_CHARTOITEM(func) \ + if (uMsg == OCM_CHARTOITEM) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) +#define MSG_OCM_HSCROLL(func) \ + if (uMsg == OCM_HSCROLL) \ + { \ + SetMsgHandled(TRUE); \ + func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) +#define MSG_OCM_VSCROLL(func) \ + if (uMsg == OCM_VSCROLL) \ + { \ + SetMsgHandled(TRUE); \ + func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit) +#define MSG_OCM_CTLCOLOREDIT(func) \ + if (uMsg == OCM_CTLCOLOREDIT) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox) +#define MSG_OCM_CTLCOLORLISTBOX(func) \ + if (uMsg == OCM_CTLCOLORLISTBOX) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button) +#define MSG_OCM_CTLCOLORBTN(func) \ + if (uMsg == OCM_CTLCOLORBTN) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd) +#define MSG_OCM_CTLCOLORDLG(func) \ + if (uMsg == OCM_CTLCOLORDLG) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) +#define MSG_OCM_CTLCOLORSCROLLBAR(func) \ + if (uMsg == OCM_CTLCOLORSCROLLBAR) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic) +#define MSG_OCM_CTLCOLORSTATIC(func) \ + if (uMsg == OCM_CTLCOLORSTATIC) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// Edit specific messages + +// void OnClear() +#define MSG_WM_CLEAR(func) \ + if (uMsg == WM_CLEAR) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCopy() +#define MSG_WM_COPY(func) \ + if (uMsg == WM_COPY) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCut() +#define MSG_WM_CUT(func) \ + if (uMsg == WM_CUT) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnPaste() +#define MSG_WM_PASTE(func) \ + if (uMsg == WM_PASTE) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnUndo() +#define MSG_WM_UNDO(func) \ + if (uMsg == WM_UNDO) \ + { \ + SetMsgHandled(TRUE); \ + func(); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// Generic message handlers + +// LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) +#define MESSAGE_HANDLER_EX(msg, func) \ + if(uMsg == msg) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func(uMsg, wParam, lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) +#define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \ + if(uMsg >= msgFirst && uMsg <= msgLast) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func(uMsg, wParam, lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// Commands and notifications + +// void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define COMMAND_HANDLER_EX(id, code, func) \ + if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define COMMAND_ID_HANDLER_EX(id, func) \ + if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define COMMAND_CODE_HANDLER_EX(code, func) \ + if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNotifyHandlerEX(LPNMHDR pnmh) +#define NOTIFY_HANDLER_EX(id, cd, func) \ + if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh) +#define NOTIFY_ID_HANDLER_EX(id, func) \ + if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh) +#define NOTIFY_CODE_HANDLER_EX(cd, func) \ + if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ + if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ + if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh) +#define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ + if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh) +#define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ + if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \ + if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \ + if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \ + if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh) +#define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \ + if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh) +#define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \ + if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh) +#define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \ + if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ + if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) +#define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ + if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh) +#define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ + if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh) +#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ + if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + SetMsgHandled(TRUE); \ + lResult = func((LPNMHDR)lParam); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif // __ATLCRACK_H__ diff --git a/Externals/WTL80/atlctrls.h b/Externals/WTL80/atlctrls.h index 338f51d0be..19f520ad3f 100644 --- a/Externals/WTL80/atlctrls.h +++ b/Externals/WTL80/atlctrls.h @@ -1,10039 +1,10039 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCTRLS_H__ -#define __ATLCTRLS_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlctrls.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlctrls.h requires atlwin.h to be included first -#endif - -#if (_WIN32_IE < 0x0300) - #error atlctrls.h requires IE Version 3.0 or higher -#endif - -#ifndef _WIN32_WCE - #include - #include -#elif defined(WIN32_PLATFORM_WFSP) && !defined(_WINUSERM_H_) - #include -#endif // !_WIN32_WCE - -// protect template members from windowsx.h macros -#ifdef _INC_WINDOWSX - #undef GetNextSibling - #undef GetPrevSibling -#endif // _INC_WINDOWSX - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CStaticT - CStatic -// CButtonT - CButton -// CListBoxT - CListBox -// CComboBoxT - CComboBox -// CEditT - CEdit -// CEditCommands -// CScrollBarT - CScrollBar -// -// CImageList -// CListViewCtrlT - CListViewCtrl -// CTreeViewCtrlT - CTreeViewCtrl -// CTreeItemT - CTreeItem -// CTreeViewCtrlExT - CTreeViewCtrlEx -// CHeaderCtrlT - CHeaderCtrl -// CToolBarCtrlT - CToolBarCtrl -// CStatusBarCtrlT - CStatusBarCtrl -// CTabCtrlT - CTabCtrl -// CToolInfo -// CToolTipCtrlT - CToolTipCtrl -// CTrackBarCtrlT - CTrackBarCtrl -// CUpDownCtrlT - CUpDownCtrl -// CProgressBarCtrlT - CProgressBarCtrl -// CHotKeyCtrlT - CHotKeyCtrl -// CAnimateCtrlT - CAnimateCtrl -// CRichEditCtrlT - CRichEditCtrl -// CRichEditCommands -// CDragListBoxT - CDragListBox -// CDragListNotifyImpl -// CReBarCtrlT - CReBarCtrl -// CComboBoxExT - CComboBoxEx -// CDateTimePickerCtrlT - CDateTimePickerCtrl -// CMonthCalendarCtrlT - CMonthCalendarCtrl -// CFlatScrollBarImpl -// CFlatScrollBarT - CFlatScrollBar -// CIPAddressCtrlT - CIPAddressCtrl -// CPagerCtrlT - CPagerCtrl -// CLinkCtrlT - CLinkCtrl -// -// CCustomDraw -// -// CCECommandBarCtrlT - CCECommandBarCtrl -// CCECommandBandsCtrlT - CCECommandBandsCtrl - - -namespace WTL -{ - -// These are wrapper classes for Windows standard and common controls. -// To implement a window based on a control, use following: -// Example: Implementing a window based on a list box -// -// class CMyListBox : CWindowImpl -// { -// public: -// BEGIN_MSG_MAP(CMyListBox) -// // put your message handler entries here -// END_MSG_MAP() -// }; - - - -// --- Standard Windows controls --- - -/////////////////////////////////////////////////////////////////////////////// -// CStatic - client side for a Windows STATIC control - -template -class CStaticT : public TBase -{ -public: -// Constructors - CStaticT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CStaticT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("STATIC"); - } - -#ifndef _WIN32_WCE - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); - } - - HENHMETAFILE GetEnhMetaFile() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HENHMETAFILE)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L); - } - - HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HENHMETAFILE)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); - } -#else // CE specific - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ICON, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - } -#endif // _WIN32_WCE - - CBitmapHandle GetBitmap() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L)); - } - - CBitmapHandle SetBitmap(HBITMAP hBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); - } - - HCURSOR GetCursor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L); - } - - HCURSOR SetCursor(HCURSOR hCursor) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); - } -}; - -typedef CStaticT CStatic; - - -/////////////////////////////////////////////////////////////////////////////// -// CButton - client side for a Windows BUTTON control - -template -class CButtonT : public TBase -{ -public: -// Constructors - CButtonT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CButtonT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("BUTTON"); - } - - UINT GetState() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, BM_GETSTATE, 0, 0L); - } - - void SetState(BOOL bHighlight) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETSTATE, bHighlight, 0L); - } - - int GetCheck() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0L); - } - - void SetCheck(int nCheck) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0L); - } - - UINT GetButtonStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::GetWindowLong(m_hWnd, GWL_STYLE) & 0xFFFF; - } - - void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); - } - -#ifndef _WIN32_WCE - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - } - - CBitmapHandle GetBitmap() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L)); - } - - CBitmapHandle SetBitmap(HBITMAP hBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); - } -#endif // !_WIN32_WCE - -#if (_WIN32_WINNT >= 0x0501) - BOOL GetIdealSize(LPSIZE lpSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize); - } - - BOOL GetImageList(PBUTTON_IMAGELIST pButtonImagelist) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist); - } - - BOOL SetImageList(PBUTTON_IMAGELIST pButtonImagelist) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist); - } - - BOOL GetTextMargin(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect); - } - - BOOL SetTextMargin(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (WINVER >= 0x0600) - void SetDontClick(BOOL bDontClick) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L); - } -#endif // (WINVER >= 0x0600) - -#if (_WIN32_WINNT >= 0x0600) - BOOL SetDropDownState(BOOL bDropDown) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L); - } - - BOOL GetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo); - } - - BOOL SetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo); - } - - int GetNoteLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (int)::SendMessage(m_hWnd, BCM_GETNOTELENGTH, 0, 0L); - } - - BOOL GetNote(LPWSTR lpstrNoteText, int cchNoteText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText); - } - - BOOL SetNote(LPCWSTR lpstrNoteText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText); - } - - LRESULT SetElevationRequiredState(BOOL bSet) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SendMessage(m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - void Click() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_CLICK, 0, 0L); - } -}; - -typedef CButtonT CButton; - - -/////////////////////////////////////////////////////////////////////////////// -// CListBox - client side for a Windows LISTBOX control - -template -class CListBoxT : public TBase -{ -public: -// Constructors - CListBoxT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CListBoxT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("LISTBOX"); - } - - // for entire listbox - int GetCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0L); - } - -#ifndef _WIN32_WCE - int SetCount(int cItems) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LBS_NODATA) != 0) && ((GetStyle() & LBS_HASSTRINGS) == 0)); - return (int)::SendMessage(m_hWnd, LB_SETCOUNT, cItems, 0L); - } -#endif // !_WIN32_WCE - - int GetHorizontalExtent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L); - } - - void SetHorizontalExtent(int cxExtent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L); - } - - int GetTopIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTOPINDEX, 0, 0L); - } - - int SetTopIndex(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETTOPINDEX, nIndex, 0L); - } - - LCID GetLocale() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, LB_GETLOCALE, 0, 0L); - } - - LCID SetLocale(LCID nNewLocale) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L); - } - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - DWORD GetListBoxInfo() const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_WINNT >= 0x0501) - return (DWORD)::SendMessage(m_hWnd, LB_GETLISTBOXINFO, 0, 0L); -#else // !(_WIN32_WINNT >= 0x0501) - return ::GetListBoxInfo(m_hWnd); -#endif // !(_WIN32_WINNT >= 0x0501) - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - - // for single-selection listboxes - int GetCurSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return (int)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0L); - } - - int SetCurSel(int nSelect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return (int)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0L); - } - - // for multiple-selection listboxes - int GetSel(int nIndex) const // also works for single-selection - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETSEL, nIndex, 0L); - } - - int SetSel(int nIndex, BOOL bSelect = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_SETSEL, bSelect, nIndex); - } - - int GetSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0L); - } - - int GetSelItems(int nMaxItems, LPINT rgIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); - } - - int GetAnchorIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETANCHORINDEX, 0, 0L); - } - - void SetAnchorIndex(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - ::SendMessage(m_hWnd, LB_SETANCHORINDEX, nIndex, 0L); - } - - int GetCaretIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETCARETINDEX, 0, 0); - } - - int SetCaretIndex(int nIndex, BOOL bScroll = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); - } - - // for listbox items - DWORD_PTR GetItemData(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD_PTR)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); - } - - int SetItemData(int nIndex, DWORD_PTR dwItemData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); - } - - void* GetItemDataPtr(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (void*)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); - } - - int SetItemDataPtr(int nIndex, void* pData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItemData(nIndex, (DWORD_PTR)pData); - } - - int GetItemRect(int nIndex, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); - } - - int GetText(int nIndex, LPTSTR lpszBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); - } - -#ifndef _ATL_NO_COM -#ifdef _OLEAUTO_H_ - BOOL GetTextBSTR(int nIndex, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - int nLen = GetTextLen(nIndex); - if(nLen == LB_ERR) - return FALSE; - - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLen + 1); - if(lpstrText == NULL) - return FALSE; - - if(GetText(nIndex, lpstrText) == LB_ERR) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpstrText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // _OLEAUTO_H_ -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetText(int nIndex, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int cchLen = GetTextLen(nIndex); - if(cchLen == LB_ERR) - return LB_ERR; - int nRet = LB_ERR; - LPTSTR lpstr = strText.GetBufferSetLength(cchLen); - if(lpstr != NULL) - { - nRet = GetText(nIndex, lpstr); - strText.ReleaseBuffer(); - } - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - int GetTextLen(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0L); - } - - int GetItemHeight(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); - } - - int SetItemHeight(int nIndex, UINT cyItemHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); - } - - // Settable only attributes - void SetColumnWidth(int cxWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); - } - - BOOL SetTabStops(int nTabStops, LPINT rgTabStops) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); - } - - BOOL SetTabStops() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 0, 0L); - } - - BOOL SetTabStops(const int& cxEachStop) // takes an 'int' - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); - } - -// Operations - int InitStorage(int nItems, UINT nBytes) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes); - } - - void ResetContent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_RESETCONTENT, 0, 0L); - } - - UINT ItemFromPoint(POINT pt, BOOL& bOutside) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dw = (DWORD)::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); - bOutside = (BOOL)HIWORD(dw); - return (UINT)LOWORD(dw); - } - - // manipulating listbox items - int AddString(LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); - } - - int DeleteString(UINT nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_DELETESTRING, nIndex, 0L); - } - - int InsertString(int nIndex, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); - } - -#ifndef _WIN32_WCE - int Dir(UINT attr, LPCTSTR lpszWildCard) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); - } - - int AddFile(LPCTSTR lpstrFileName) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName); - } -#endif // !_WIN32_WCE - - // selection helpers - int FindString(int nStartAfter, LPCTSTR lpszItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem); - } - - int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); - } - - int SelectString(int nStartAfter, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem); - } - - int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - ATLASSERT(nFirstItem <= nLastItem); - return bSelect ? (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem); - } - -#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages - DWORD GetInputMode(BOOL bCurrentMode = TRUE) - { - return SendMessage(LB_GETINPUTMODE, 0, (LPARAM)bCurrentMode); - } - - BOOL SetInputMode(DWORD dwMode) - { - return SendMessage(LB_SETINPUTMODE, 0, (LPARAM)dwMode); - } -#endif // WIN32_PLATFORM_WFSP -}; - -typedef CListBoxT CListBox; - - -/////////////////////////////////////////////////////////////////////////////// -// CComboBox - client side for a Windows COMBOBOX control - -#ifndef WIN32_PLATFORM_WFSP // No COMBOBOX on SmartPhones - -template -class CComboBoxT : public TBase -{ -public: -// Constructors - CComboBoxT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CComboBoxT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("COMBOBOX"); - } - - // for entire combo box - int GetCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0L); - } - - int GetCurSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0L); - } - - int SetCurSel(int nSelect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0L); - } - - LCID GetLocale() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, CB_GETLOCALE, 0, 0L); - } - - LCID SetLocale(LCID nNewLocale) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L); - } - - int GetTopIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETTOPINDEX, 0, 0L); - } - - int SetTopIndex(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETTOPINDEX, nIndex, 0L); - } - - UINT GetHorizontalExtent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L); - } - - void SetHorizontalExtent(UINT nExtent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L); - } - - int GetDroppedWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L); - } - - int SetDroppedWidth(UINT nWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L); - } - -#if ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - BOOL GetComboBoxInfo(PCOMBOBOXINFO pComboBoxInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if ((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - return (BOOL)::SendMessage(m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo); -#else // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - return ::GetComboBoxInfo(m_hWnd, pComboBoxInfo); -#endif // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - } -#endif // ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - - // for edit control - DWORD GetEditSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CB_GETEDITSEL, 0, 0L); - } - - BOOL SetEditSel(int nStartChar, int nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); - } - - // for combobox item - DWORD_PTR GetItemData(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD_PTR)::SendMessage(m_hWnd, CB_GETITEMDATA, nIndex, 0L); - } - - int SetItemData(int nIndex, DWORD_PTR dwItemData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); - } - - void* GetItemDataPtr(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (void*)GetItemData(nIndex); - } - - int SetItemDataPtr(int nIndex, void* pData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItemData(nIndex, (DWORD_PTR)pData); - } - - int GetLBText(int nIndex, LPTSTR lpszText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); - } - -#ifndef _ATL_NO_COM - BOOL GetLBTextBSTR(int nIndex, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - int nLen = GetLBTextLen(nIndex); - if(nLen == CB_ERR) - return FALSE; - - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLen + 1); - if(lpstrText == NULL) - return FALSE; - - if(GetLBText(nIndex, lpstrText) == CB_ERR) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpstrText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetLBText(int nIndex, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int cchLen = GetLBTextLen(nIndex); - if(cchLen == CB_ERR) - return CB_ERR; - int nRet = CB_ERR; - LPTSTR lpstr = strText.GetBufferSetLength(cchLen); - if(lpstr != NULL) - { - nRet = GetLBText(nIndex, lpstr); - strText.ReleaseBuffer(); - } - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - int GetLBTextLen(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L); - } - - int GetItemHeight(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); - } - - int SetItemHeight(int nIndex, UINT cyItemHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); - } - - BOOL GetExtendedUI() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETEXTENDEDUI, 0, 0L); - } - - int SetExtendedUI(BOOL bExtended = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); - } - - void GetDroppedControlRect(LPRECT lprect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect); - } - - BOOL GetDroppedState() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); - } - -#if (_WIN32_WINNT >= 0x0501) - int GetMinVisible() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETMINVISIBLE, 0, 0L); - } - - BOOL SetMinVisible(int nMinVisible) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L); - } - - // Vista only - BOOL GetCueBannerText(LPWSTR lpwText, int cchText) const - { -#ifndef CB_GETCUEBANNER - const UINT CB_GETCUEBANNER = (CBM_FIRST + 4); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText); - } - - // Vista only - BOOL SetCueBannerText(LPCWSTR lpcwText) - { -#ifndef CB_SETCUEBANNER - const UINT CB_SETCUEBANNER = (CBM_FIRST + 3); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - int InitStorage(int nItems, UINT nBytes) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes); - } - - void ResetContent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0L); - } - - // for edit control - BOOL LimitText(int nMaxChars) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_LIMITTEXT, nMaxChars, 0L); - } - - // for drop-down combo boxes - void ShowDropDown(BOOL bShowIt = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L); - } - - // manipulating listbox items - int AddString(LPCTSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); - } - - int DeleteString(UINT nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0L); - } - - int InsertString(int nIndex, LPCTSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); - } - -#ifndef _WIN32_WCE - int Dir(UINT attr, LPCTSTR lpszWildCard) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); - } -#endif // !_WIN32_WCE - - // selection helpers - int FindString(int nStartAfter, LPCTSTR lpszString) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString); - } - - int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); - } - - int SelectString(int nStartAfter, LPCTSTR lpszString) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString); - } - - // Clipboard operations - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } -}; - -typedef CComboBoxT CComboBox; - -#endif // !WIN32_PLATFORM_WFSP - -/////////////////////////////////////////////////////////////////////////////// -// CEdit - client side for a Windows EDIT control - -template -class CEditT : public TBase -{ -public: -// Constructors - CEditT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CEditT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("EDIT"); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - int GetLineCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); - } - - void GetRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); - } - - DWORD GetSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); - } - - void GetSel(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - } - -#ifndef _WIN32_WCE - HLOCAL GetHandle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HLOCAL)::SendMessage(m_hWnd, EM_GETHANDLE, 0, 0L); - } - - void SetHandle(HLOCAL hBuffer) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L); - } -#endif // !_WIN32_WCE - - DWORD GetMargins() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L); - } - - void SetMargins(UINT nLeft, UINT nRight) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(nLeft, nRight)); - } - - UINT GetLimitText() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); - } - - void SetLimitText(UINT nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETLIMITTEXT, nMax, 0L); - } - - POINT PosFromChar(UINT nChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_POSFROMCHAR, nChar, 0); - POINT point = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; - return point; - } - - int CharFromPos(POINT pt, int* pLine = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)); - if(pLine != NULL) - *pLine = (int)(short)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - // NOTE: first word in lpszBuffer must contain the size of the buffer! - int GetLine(int nIndex, LPTSTR lpszBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - *(LPWORD)lpszBuffer = (WORD)nMaxLength; - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - TCHAR GetPasswordChar() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (TCHAR)::SendMessage(m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); - } - - void SetPasswordChar(TCHAR ch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPASSWORDCHAR, ch, 0L); - } - -#ifndef _WIN32_WCE - EDITWORDBREAKPROC GetWordBreakProc() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROC)::SendMessage(m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); - } - - void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); - } -#endif // !_WIN32_WCE - - int GetFirstVisibleLine() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); - } - -#ifndef _WIN32_WCE - int GetThumb() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & ES_MULTILINE) != 0); - return (int)::SendMessage(m_hWnd, EM_GETTHUMB, 0, 0L); - } -#endif // !_WIN32_WCE - - BOOL SetReadOnly(BOOL bReadOnly = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); - } - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - UINT GetImeStatus(UINT uStatus) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETIMESTATUS, uStatus, 0L); - } - - UINT SetImeStatus(UINT uStatus, UINT uData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETIMESTATUS, uStatus, uData); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - BOOL GetCueBannerText(LPCWSTR lpstrText, int cchText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText); - } - - // bKeepWithFocus - Vista only - BOOL SetCueBannerText(LPCWSTR lpstrText, BOOL bKeepWithFocus = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText)); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - void EmptyUndoBuffer() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); - } - - BOOL FmtLines(BOOL bAddEOL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_FMTLINES, bAddEOL, 0L); - } - - void LimitText(int nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_LIMITTEXT, nChars, 0L); - } - - int LineFromChar(int nIndex = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEFROMCHAR, nIndex, 0L); - } - - int LineIndex(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); - } - - int LineLength(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); - } - - void LineScroll(int nLines, int nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); - } - - void SetRect(LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); - } - - void SetRectNP(LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); - } - - void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection)); - if(!bNoScroll) - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar); - if(!bNoScroll) - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - void SetSelAll(BOOL bNoScroll = FALSE) - { - SetSel(0, -1, bNoScroll); - } - - void SetSelNone(BOOL bNoScroll = FALSE) - { - SetSel(-1, 0, bNoScroll); - } - - BOOL SetTabStops(int nTabStops, LPINT rgTabStops) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); - } - - BOOL SetTabStops() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); - } - - BOOL SetTabStops(const int& cxEachStop) // takes an 'int' - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); - } - - void ScrollCaret() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - int Scroll(int nScrollAction) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & ES_MULTILINE) != 0); - LRESULT lRet = ::SendMessage(m_hWnd, EM_SCROLL, nScrollAction, 0L); - if(!(BOOL)HIWORD(lRet)) - return -1; // failed - return (int)(short)LOWORD(lRet); - - } - - void InsertText(int nInsertAfterChar, LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) - { - SetSel(nInsertAfterChar, nInsertAfterChar, bNoScroll); - ReplaceSel(lpstrText, bCanUndo); - } - - void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) - { - InsertText(GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo); - } - -#if (_WIN32_WINNT >= 0x0501) - BOOL ShowBalloonTip(PEDITBALLOONTIP pEditBaloonTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip); - } - - BOOL HideBalloonTip() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_HIDEBALLOONTIP, 0, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - DWORD GetHilite() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); - } - - void GetHilite(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); - nStartChar = (int)(short)LOWORD(dwRet); - nEndChar = (int)(short)HIWORD(dwRet); - } - - void SetHilite(int nStartChar, int nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETHILITE, nStartChar, nEndChar); - } -#endif // (_WIN32_WINNT >= 0x0600) - - // Clipboard operations - BOOL Undo() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); - } - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } - -#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages - DWORD GetExtendedStyle() - { - return SendMessage(EM_GETEXTENDEDSTYLE); - } - - DWORD SetExtendedStyle(DWORD dwMask, DWORD dwExStyle) - { - return SendMessage(EM_SETEXTENDEDSTYLE, (WPARAM)dwMask, (LPARAM)dwExStyle); - } - - DWORD GetInputMode(BOOL bCurrentMode = TRUE) - { - return SendMessage(EM_GETINPUTMODE, 0, (LPARAM)bCurrentMode); - } - - BOOL SetInputMode(DWORD dwMode) - { - return SendMessage(EM_SETINPUTMODE, 0, (LPARAM)dwMode); - } - - BOOL SetSymbols(LPCTSTR szSymbols) - { - return SendMessage(EM_SETSYMBOLS, 0, (LPARAM)szSymbols); - } - - BOOL ResetSymbols() - { - return SendMessage(EM_SETSYMBOLS); - } -#endif // WIN32_PLATFORM_WFSP -}; - -typedef CEditT CEdit; - - -/////////////////////////////////////////////////////////////////////////////// -// CEditCommands - message handlers for standard EDIT commands - -// Chain to CEditCommands message map. Your class must also derive from CEdit. -// Example: -// class CMyEdit : public CWindowImpl, -// public CEditCommands -// { -// public: -// BEGIN_MSG_MAP(CMyEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CEditCommands, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CEditCommands -{ -public: - BEGIN_MSG_MAP(CEditCommands< T >) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR, OnEditClear) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, OnEditClearAll) - COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEditCopy) - COMMAND_ID_HANDLER(ID_EDIT_CUT, OnEditCut) - COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEditPaste) - COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, OnEditSelectAll) - COMMAND_ID_HANDLER(ID_EDIT_UNDO, OnEditUndo) - END_MSG_MAP() - - LRESULT OnEditClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Clear(); - return 0; - } - - LRESULT OnEditClearAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->SetSel(0, -1); - pT->Clear(); - return 0; - } - - LRESULT OnEditCopy(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Copy(); - return 0; - } - - LRESULT OnEditCut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Cut(); - return 0; - } - - LRESULT OnEditPaste(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Paste(); - return 0; - } - - LRESULT OnEditSelectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->SetSel(0, -1); - return 0; - } - - LRESULT OnEditUndo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Undo(); - return 0; - } - -// State (update UI) helpers - BOOL CanCut() const - { return HasSelection(); } - - BOOL CanCopy() const - { return HasSelection(); } - - BOOL CanClear() const - { return HasSelection(); } - - BOOL CanSelectAll() const - { return HasText(); } - - BOOL CanFind() const - { return HasText(); } - - BOOL CanRepeat() const - { return HasText(); } - - BOOL CanReplace() const - { return HasText(); } - - BOOL CanClearAll() const - { return HasText(); } - -// Implementation - BOOL HasSelection() const - { - const T* pT = static_cast(this); - int nMin, nMax; - ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nMin, (LPARAM)&nMax); - return (nMin != nMax); - } - - BOOL HasText() const - { - const T* pT = static_cast(this); - return (pT->GetWindowTextLength() > 0); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CScrollBar - client side for a Windows SCROLLBAR control - -template -class CScrollBarT : public TBase -{ -public: -// Constructors - CScrollBarT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CScrollBarT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return _T("SCROLLBAR"); - } - -#ifndef _WIN32_WCE - int GetScrollPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::GetScrollPos(m_hWnd, SB_CTL); - } -#endif // !_WIN32_WCE - - int SetScrollPos(int nPos, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw); - } - -#ifndef _WIN32_WCE - void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos); - } -#endif // !_WIN32_WCE - - void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); - } - - BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::GetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo); - } - - int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo, bRedraw); - } - -#ifndef _WIN32_WCE - int GetScrollLimit() const - { - int nMin = 0, nMax = 0; - ::GetScrollRange(m_hWnd, SB_CTL, &nMin, &nMax); - SCROLLINFO info = { 0 }; - info.cbSize = sizeof(SCROLLINFO); - info.fMask = SIF_PAGE; - if(::GetScrollInfo(m_hWnd, SB_CTL, &info)) - nMax -= ((info.nPage - 1) > 0) ? (info.nPage - 1) : 0; - - return nMax; - } - -#if (WINVER >= 0x0500) - BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_WINNT >= 0x0501) - return (BOOL)::SendMessage(m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); -#else // !(_WIN32_WINNT >= 0x0501) - return ::GetScrollBarInfo(m_hWnd, OBJID_CLIENT, pScrollBarInfo); -#endif // !(_WIN32_WINNT >= 0x0501) - } -#endif // (WINVER >= 0x0500) - -// Operations - void ShowScrollBar(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::ShowScrollBar(m_hWnd, SB_CTL, bShow); - } - - BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags); - } -#endif // !_WIN32_WCE -}; - -typedef CScrollBarT CScrollBar; - - -// --- Windows Common Controls --- - -/////////////////////////////////////////////////////////////////////////////// -// CImageList - -class CImageList -{ -public: - HIMAGELIST m_hImageList; - -// Constructor - CImageList(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList) - { } - -// Operators, etc. - CImageList& operator =(HIMAGELIST hImageList) - { - m_hImageList = hImageList; - return *this; - } - - operator HIMAGELIST() const { return m_hImageList; } - - void Attach(HIMAGELIST hImageList) - { - ATLASSERT(m_hImageList == NULL); - ATLASSERT(hImageList != NULL); - m_hImageList = hImageList; - } - - HIMAGELIST Detach() - { - HIMAGELIST hImageList = m_hImageList; - m_hImageList = NULL; - return hImageList; - } - - bool IsNull() const { return (m_hImageList == NULL); } - -// Attributes - int GetImageCount() const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetImageCount(m_hImageList); - } - - COLORREF GetBkColor() const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetBkColor(m_hImageList); - } - - COLORREF SetBkColor(COLORREF cr) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetBkColor(m_hImageList, cr); - } - - BOOL GetImageInfo(int nImage, IMAGEINFO* pImageInfo) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetImageInfo(m_hImageList, nImage, pImageInfo); - } - - HICON GetIcon(int nIndex, UINT uFlags = ILD_NORMAL) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetIcon(m_hImageList, nIndex, uFlags); - } - - BOOL GetIconSize(int& cx, int& cy) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetIconSize(m_hImageList, &cx, &cy); - } - - BOOL GetIconSize(SIZE& size) const - { - ATLASSERT(m_hImageList != NULL); - return ImageList_GetIconSize(m_hImageList, (int*)&size.cx, (int*)&size.cy); - } - - BOOL SetIconSize(int cx, int cy) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetIconSize(m_hImageList, cx, cy); - } - - BOOL SetIconSize(SIZE size) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetIconSize(m_hImageList, size.cx, size.cy); - } - - BOOL SetImageCount(UINT uNewCount) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetImageCount(m_hImageList, uNewCount); - } - - BOOL SetOverlayImage(int nImage, int nOverlay) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetOverlayImage(m_hImageList, nImage, nOverlay); - } - -// Operations - BOOL Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_Create(cx, cy, nFlags, nInitial, nGrow); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - - BOOL Create(ATL::_U_STRINGorID bitmap, int cx, int nGrow, COLORREF crMask) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, cx, nGrow, crMask); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - - BOOL CreateFromImage(ATL::_U_STRINGorID image, int cx, int nGrow, COLORREF crMask, UINT uType, UINT uFlags = LR_DEFAULTCOLOR | LR_DEFAULTSIZE) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, cx, nGrow, crMask, uType, uFlags); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - - BOOL Merge(HIMAGELIST hImageList1, int nImage1, HIMAGELIST hImageList2, int nImage2, int dx, int dy) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_Merge(hImageList1, nImage1, hImageList2, nImage2, dx, dy); - return (m_hImageList != NULL) ? TRUE : FALSE; - } - -#ifndef _WIN32_WCE -#ifdef __IStream_INTERFACE_DEFINED__ - BOOL CreateFromStream(LPSTREAM lpStream) - { - ATLASSERT(m_hImageList == NULL); - m_hImageList = ImageList_Read(lpStream); - return (m_hImageList != NULL) ? TRUE : FALSE; - } -#endif // __IStream_INTERFACE_DEFINED__ -#endif // !_WIN32_WCE - - BOOL Destroy() - { - if (m_hImageList == NULL) - return FALSE; - BOOL bRet = ImageList_Destroy(m_hImageList); - if(bRet) - m_hImageList = NULL; - return bRet; - } - - int Add(HBITMAP hBitmap, HBITMAP hBitmapMask = NULL) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Add(m_hImageList, hBitmap, hBitmapMask); - } - - int Add(HBITMAP hBitmap, COLORREF crMask) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_AddMasked(m_hImageList, hBitmap, crMask); - } - - BOOL Remove(int nImage) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Remove(m_hImageList, nImage); - } - - BOOL RemoveAll() - { - ATLASSERT(m_hImageList != NULL); - return ImageList_RemoveAll(m_hImageList); - } - - BOOL Replace(int nImage, HBITMAP hBitmap, HBITMAP hBitmapMask) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Replace(m_hImageList, nImage, hBitmap, hBitmapMask); - } - - int AddIcon(HICON hIcon) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_AddIcon(m_hImageList, hIcon); - } - - int ReplaceIcon(int nImage, HICON hIcon) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_ReplaceIcon(m_hImageList, nImage, hIcon); - } - - HICON ExtractIcon(int nImage) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_ExtractIcon(NULL, m_hImageList, nImage); - } - - BOOL Draw(HDC hDC, int nImage, int x, int y, UINT nStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_Draw(m_hImageList, nImage, hDC, x, y, nStyle); - } - - BOOL Draw(HDC hDC, int nImage, POINT pt, UINT nStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_Draw(m_hImageList, nImage, hDC, pt.x, pt.y, nStyle); - } - - BOOL DrawEx(int nImage, HDC hDC, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_DrawEx(m_hImageList, nImage, hDC, x, y, dx, dy, rgbBk, rgbFg, fStyle); - } - - BOOL DrawEx(int nImage, HDC hDC, RECT& rect, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) - { - ATLASSERT(m_hImageList != NULL); - ATLASSERT(hDC != NULL); - return ImageList_DrawEx(m_hImageList, nImage, hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, rgbBk, rgbFg, fStyle); - } - - static BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp) - { - return ImageList_DrawIndirect(pimldp); - } - - BOOL Copy(int nSrc, int nDst, UINT uFlags = ILCF_MOVE) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Copy(m_hImageList, nDst, m_hImageList, nSrc, uFlags); - } - -#ifdef __IStream_INTERFACE_DEFINED__ -#ifndef _WIN32_WCE - static HIMAGELIST Read(LPSTREAM lpStream) - { - return ImageList_Read(lpStream); - } - - BOOL Write(LPSTREAM lpStream) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_Write(m_hImageList, lpStream); - } -#endif // !_WIN32_WCE - -#if (_WIN32_WINNT >= 0x0501) - static HRESULT ReadEx(DWORD dwFlags, LPSTREAM lpStream, REFIID riid, PVOID* ppv) - { - return ImageList_ReadEx(dwFlags, lpStream, riid, ppv); - } - - HRESULT WriteEx(DWORD dwFlags, LPSTREAM lpStream) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_WriteEx(m_hImageList, dwFlags, lpStream); - } -#endif // (_WIN32_WINNT >= 0x0501) -#endif // __IStream_INTERFACE_DEFINED__ - - // Drag operations - BOOL BeginDrag(int nImage, POINT ptHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_BeginDrag(m_hImageList, nImage, ptHotSpot.x, ptHotSpot.y); - } - - BOOL BeginDrag(int nImage, int xHotSpot, int yHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_BeginDrag(m_hImageList, nImage, xHotSpot, yHotSpot); - } - - static void EndDrag() - { - ImageList_EndDrag(); - } - - static BOOL DragMove(POINT pt) - { - return ImageList_DragMove(pt.x, pt.y); - } - - static BOOL DragMove(int x, int y) - { - return ImageList_DragMove(x, y); - } - - BOOL SetDragCursorImage(int nDrag, POINT ptHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetDragCursorImage(m_hImageList, nDrag, ptHotSpot.x, ptHotSpot.y); - } - - BOOL SetDragCursorImage(int nDrag, int xHotSpot, int yHotSpot) - { - ATLASSERT(m_hImageList != NULL); - return ImageList_SetDragCursorImage(m_hImageList, nDrag, xHotSpot, yHotSpot); - } - - static BOOL DragShowNolock(BOOL bShow = TRUE) - { - return ImageList_DragShowNolock(bShow); - } - - static CImageList GetDragImage(LPPOINT lpPoint, LPPOINT lpPointHotSpot) - { - return CImageList(ImageList_GetDragImage(lpPoint, lpPointHotSpot)); - } - - static BOOL DragEnter(HWND hWnd, POINT point) - { - return ImageList_DragEnter(hWnd, point.x, point.y); - } - - static BOOL DragEnter(HWND hWnd, int x, int y) - { - return ImageList_DragEnter(hWnd, x, y); - } - - static BOOL DragLeave(HWND hWnd) - { - return ImageList_DragLeave(hWnd); - } - -#if (_WIN32_IE >= 0x0400) - CImageList Duplicate() const - { - ATLASSERT(m_hImageList != NULL); - return CImageList(ImageList_Duplicate(m_hImageList)); - } - - static CImageList Duplicate(HIMAGELIST hImageList) - { - ATLASSERT(hImageList != NULL); - return CImageList(ImageList_Duplicate(hImageList)); - } -#endif // (_WIN32_IE >= 0x0400) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CToolTipCtrl - -#ifndef _WIN32_WCE - -class CToolInfo : public TOOLINFO -{ -public: - CToolInfo(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) - { - Init(nFlags, hWnd, nIDTool, lpRect, lpstrText, lUserParam); - } - - operator LPTOOLINFO() { return this; } - - operator LPARAM() { return (LPARAM)this; } - - void Init(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) - { - ATLASSERT(::IsWindow(hWnd)); - memset(this, 0, sizeof(TOOLINFO)); - cbSize = sizeof(TOOLINFO); - uFlags = nFlags; - if(nIDTool == 0) - { - hwnd = ::GetParent(hWnd); - uFlags |= TTF_IDISHWND; - uId = (UINT_PTR)hWnd; - } - else - { - hwnd = hWnd; - uId = nIDTool; - } - if(lpRect != NULL) - rect = *lpRect; - hinst = ModuleHelper::GetResourceInstance(); - lpszText = lpstrText; - lParam = lUserParam; - } -}; - -template -class CToolTipCtrlT : public TBase -{ -public: -// Constructors - CToolTipCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CToolTipCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return TOOLTIPS_CLASS; - } - - void GetText(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo); - } - - void GetText(LPTSTR lpstrText, HWND hWnd, UINT nIDTool = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); - ::SendMessage(m_hWnd, TTM_GETTEXT, 0, ti); - } - - BOOL GetToolInfo(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo); - } - - BOOL GetToolInfo(HWND hWnd, UINT nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - ATLASSERT(puFlags != NULL); - ATLASSERT(lpRect != NULL); - CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); - BOOL bRet = (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, ti); - if(bRet != FALSE) - { - *puFlags = ti.uFlags; - *lpRect = ti.rect; - } - return bRet; - } - - void SetToolInfo(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo); - } - - void SetToolRect(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo); - } - - void SetToolRect(HWND hWnd, UINT nIDTool, LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - ATLASSERT(nIDTool != 0); - - CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRect, NULL); - ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, ti); - } - - int GetToolCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETTOOLCOUNT, 0, 0L); - } - - int GetDelayTime(DWORD dwType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETDELAYTIME, dwType, 0L); - } - - void SetDelayTime(DWORD dwType, int nTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0)); - } - - void GetMargin(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect); - } - - void SetMargin(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect); - } - - int GetMaxTipWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L); - } - - int SetMaxTipWidth(int nWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth); - } - - COLORREF GetTipBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L); - } - - void SetTipBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L); - } - - COLORREF GetTipTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L); - } - - void SetTipTextColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L); - } - - BOOL GetCurrentTool(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo); - } - -#if (_WIN32_IE >= 0x0500) - SIZE GetBubbleSize(LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo); - SIZE size = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; - return size; - } - - BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle); - } -#endif // (_WIN32_IE >= 0x0500) - -#if (_WIN32_WINNT >= 0x0501) - void GetTitle(PTTGETTITLE pTTGetTitle) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle); - } - - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - void Activate(BOOL bActivate) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_ACTIVATE, bActivate, 0L); - } - - BOOL AddTool(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo); - } - - BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT nIDTool = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - // the toolrect and toolid must both be zero or both valid - ATLASSERT((lpRectTool != NULL && nIDTool != 0) || (lpRectTool == NULL && nIDTool == 0)); - - CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRectTool, (LPTSTR)text.m_lpstr); - return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, ti); - } - - void DelTool(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo); - } - - void DelTool(HWND hWnd, UINT nIDTool = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - - CToolInfo ti(0, hWnd, nIDTool, NULL, NULL); - ::SendMessage(m_hWnd, TTM_DELTOOL, 0, ti); - } - - BOOL HitTest(LPTTHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo); - } - - BOOL HitTest(HWND hWnd, POINT pt, LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - ATLASSERT(lpToolInfo != NULL); - - TTHITTESTINFO hti = { 0 }; - hti.ti.cbSize = sizeof(TOOLINFO); - hti.hwnd = hWnd; - hti.pt.x = pt.x; - hti.pt.y = pt.y; - if((BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE) - { - *lpToolInfo = hti.ti; - return TRUE; - } - return FALSE; - } - - void RelayEvent(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg); - } - - void UpdateTipText(LPTOOLINFO lpToolInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo); - } - - void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT nIDTool = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hWnd != NULL); - - CToolInfo ti(0, hWnd, nIDTool, NULL, (LPTSTR)text.m_lpstr); - ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, ti); - } - - BOOL EnumTools(UINT nTool, LPTOOLINFO lpToolInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo); - } - - void Pop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_POP, 0, 0L); - } - - void TrackActivate(LPTOOLINFO lpToolInfo, BOOL bActivate) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo); - } - - void TrackPosition(int xPos, int yPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos)); - } - -#if (_WIN32_IE >= 0x0400) - void Update() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_UPDATE, 0, 0L); - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - BOOL AdjustRect(LPRECT lpRect, BOOL bLarger /*= TRUE*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect); - } -#endif // (_WIN32_IE >= 0x0500) - -#if (_WIN32_WINNT >= 0x0501) - void Popup() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_POPUP, 0, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) -}; - -typedef CToolTipCtrlT CToolTipCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CHeaderCtrl - -template -class CHeaderCtrlT : public TBase -{ -public: -// Constructors - CHeaderCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHeaderCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_HEADER; - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETITEMCOUNT, 0, 0L); - } - - BOOL GetItem(int nIndex, LPHDITEM pHeaderItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem); - } - - BOOL SetItem(int nIndex, LPHDITEM pHeaderItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem); - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_GETIMAGELIST, 0, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList)); - } - - BOOL GetOrderArray(int nSize, int* lpnArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray); - } - - BOOL SetOrderArray(int nSize, int* lpnArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray); - } - - BOOL GetItemRect(int nIndex, LPRECT lpItemRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect); - } - - int SetHotDivider(BOOL bPos, DWORD dwInputValue) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int GetBitmapMargin() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L); - } - - int SetBitmapMargin(int nWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L); - } - - int SetFilterChangeTimeout(DWORD dwTimeOut) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0600) - BOOL GetItemDropDownRect(int nIndex, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); - } - - BOOL GetOverflowRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect); - } - - int GetFocusedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L); - } - - BOOL SetFocusedItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - int InsertItem(int nIndex, LPHDITEM phdi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi); - } - - int AddItem(LPHDITEM phdi) - { - return InsertItem(GetItemCount(), phdi); - } - - BOOL DeleteItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_DELETEITEM, nIndex, 0L); - } - - BOOL Layout(HD_LAYOUT* pHeaderLayout) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout); - } - - int HitTest(LPHDHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo); - } - - int OrderToIndex(int nOrder) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L); - } - - CImageList CreateDragImage(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L)); - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int EditFilter(int nColumn, BOOL bDiscardChanges) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0)); - } - - int ClearFilter(int nColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, nColumn, 0L); - } - - int ClearAllFilters() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CHeaderCtrlT CHeaderCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CListViewCtrl - -template -class CListViewCtrlT : public TBase -{ -public: -// Constructors - CListViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CListViewCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_LISTVIEW; - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETBKCOLOR, 0, 0L); - } - - BOOL SetBkColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETBKCOLOR, 0, cr); - } - - CImageList GetImageList(int nImageListType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList, int nImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList)); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETITEMCOUNT, 0, 0L); - } - - BOOL SetItemCount(int nItems) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, 0L); - } - - BOOL GetItem(LPLVITEM pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, - int nImage, UINT nState, UINT nStateMask, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.mask = nMask; - lvi.iItem = nItem; - lvi.iSubItem = nSubItem; - lvi.stateMask = nStateMask; - lvi.state = nState; - lvi.pszText = (LPTSTR) lpszItem; - lvi.iImage = nImage; - lvi.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi); - } - - UINT GetItemState(int nItem, UINT nMask) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETITEMSTATE, nItem, nMask); - } - - BOOL SetItemState(int nItem, UINT nState, UINT nStateMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.state = nState; - lvi.stateMask = nStateMask; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); - } - - BOOL SetItemState(int nItem, LPLVITEM pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem); - } - -#ifndef _ATL_NO_COM - BOOL GetItemText(int nItem, int nSubItem, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - LVITEM lvi = { 0 }; - lvi.iSubItem = nSubItem; - - LPTSTR lpstrText = NULL; - int nRes = 0; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - lpstrText[0] = NULL; - lvi.cchTextMax = nLen; - lvi.pszText = lpstrText; - nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); - if(nRes < nLen - 1) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(nRes != 0) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetItemText(int nItem, int nSubItem, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.iSubItem = nSubItem; - - strText.Empty(); - int nRes = 0; - for(int nLen = 256; ; nLen *= 2) - { - lvi.cchTextMax = nLen; - lvi.pszText = strText.GetBufferSetLength(nLen); - if(lvi.pszText == NULL) - { - nRes = 0; - break; - } - nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); - if(nRes < nLen - 1) - break; - } - strText.ReleaseBuffer(); - return nRes; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - int GetItemText(int nItem, int nSubItem, LPTSTR lpszText, int nLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.iSubItem = nSubItem; - lvi.cchTextMax = nLen; - lvi.pszText = lpszText; - return (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); - } - - BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(nItem, nSubItem, LVIF_TEXT, lpszText, 0, 0, 0, 0); - } - - DWORD_PTR GetItemData(int nItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.iItem = nItem; - lvi.mask = LVIF_PARAM; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi); - return (DWORD_PTR)(bRet ? lvi.lParam : NULL); - } - - BOOL SetItemData(int nItem, DWORD_PTR dwData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData); - } - - UINT GetCallbackMask() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETCALLBACKMASK, 0, 0L); - } - - BOOL SetCallbackMask(UINT nMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L); - } - - BOOL GetItemPosition(int nItem, LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint); - } - - BOOL SetItemPosition(int nItem, POINT pt) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); - } - - BOOL SetItemPosition(int nItem, int x, int y) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); - POINT pt = { x, y }; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); - } - - int GetStringWidth(LPCTSTR lpsz) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); - } - - CEdit GetEditControl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, LVM_GETEDITCONTROL, 0, 0L)); - } - - BOOL GetColumn(int nCol, LVCOLUMN* pColumn) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn); - } - - BOOL SetColumn(int nCol, const LVCOLUMN* pColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn); - } - - int GetColumnWidth(int nCol) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L); - } - - BOOL SetColumnWidth(int nCol, int cx) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); - } - - BOOL GetViewRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect); - } - - COLORREF GetTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTCOLOR, 0, 0L); - } - - BOOL SetTextColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTCOLOR, 0, cr); - } - - COLORREF GetTextBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L); - } - - BOOL SetTextBkColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr); - } - - int GetTopIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETTOPINDEX, 0, 0L); - } - - int GetCountPerPage() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L); - } - - BOOL GetOrigin(LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint); - } - - UINT GetSelectedCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L); - } - - BOOL GetItemRect(int nItem, LPRECT lpRect, UINT nCode) const - { - ATLASSERT(::IsWindow(m_hWnd)); - lpRect->left = nCode; - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); - } - -#ifndef _WIN32_WCE - HCURSOR GetHotCursor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, LVM_GETHOTCURSOR, 0, 0L); - } - - HCURSOR SetHotCursor(HCURSOR hHotCursor) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor); - } - - int GetHotItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETHOTITEM, 0, 0L); - } - - int SetHotItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETHOTITEM, nIndex, 0L); - } -#endif // !_WIN32_WCE - - BOOL GetColumnOrderArray(int nCount, int* lpnArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); - } - - BOOL SetColumnOrderArray(int nCount, int* lpnArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); - } - - CHeaderCtrl GetHeader() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CHeaderCtrl((HWND)::SendMessage(m_hWnd, LVM_GETHEADER, 0, 0L)); - } - - BOOL GetSubItemRect(int nItem, int nSubItem, int nFlag, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_REPORT); - ATLASSERT(lpRect != NULL); - lpRect->top = nSubItem; - lpRect->left = nFlag; - return (BOOL)::SendMessage(m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect); - } - - DWORD SetIconSpacing(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_ICON); - return (DWORD)::SendMessage(m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy)); - } - - int GetISearchString(LPTSTR lpstr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); - } - - void GetItemSpacing(SIZE& sizeSpacing, BOOL bSmallIconView = FALSE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L); - sizeSpacing.cx = GET_X_LPARAM(dwRet); - sizeSpacing.cy = GET_Y_LPARAM(dwRet); - } - -#if (_WIN32_WCE >= 410) - void SetItemSpacing(INT cySpacing) - { - ATLASSERT(::IsWindow(m_hWnd)); - ListView_SetItemSpacing(m_hWnd, cySpacing); - } -#endif // (_WIN32_WCE >= 410) - - // single-selection only - int GetSelectedIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); - return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); - } - - BOOL GetSelectedItem(LPLVITEM pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); - ATLASSERT(pItem != NULL); - pItem->iItem = (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); - if(pItem->iItem == -1) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); - } - - // extended list view styles - DWORD GetExtendedListViewStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L); - } - - // dwExMask = 0 means all styles - DWORD SetExtendedListViewStyle(DWORD dwExStyle, DWORD dwExMask = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle); - } - - // checkboxes only - BOOL GetCheckState(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetExtendedListViewStyle() & LVS_EX_CHECKBOXES) != 0); - UINT uRet = GetItemState(nIndex, LVIS_STATEIMAGEMASK); - return (uRet >> 12) - 1; - } - - BOOL SetCheckState(int nItem, BOOL bCheck) - { - int nCheck = bCheck ? 2 : 1; // one based index - return SetItemState(nItem, INDEXTOSTATEIMAGEMASK(nCheck), LVIS_STATEIMAGEMASK); - } - - // view type - DWORD GetViewType() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (GetStyle() & LVS_TYPEMASK); - } - - DWORD SetViewType(DWORD dwType) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(dwType == LVS_ICON || dwType == LVS_SMALLICON || dwType == LVS_LIST || dwType == LVS_REPORT); - DWORD dwOldType = GetViewType(); - if(dwType != dwOldType) - ModifyStyle(LVS_TYPEMASK, (dwType & LVS_TYPEMASK)); - return dwOldType; - } - -#if (_WIN32_IE >= 0x0400) -#ifndef _WIN32_WCE - BOOL GetBkImage(LPLVBKIMAGE plvbki) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki); - } - - BOOL SetBkImage(LPLVBKIMAGE plvbki) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki); - } -#endif // !_WIN32_WCE - - int GetSelectionMark() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSELECTIONMARK, 0, 0L); - } - - int SetSelectionMark(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex); - } - -#ifndef _WIN32_WCE - BOOL GetWorkAreas(int nWorkAreas, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect); - } - - BOOL SetWorkAreas(int nWorkAreas, LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect); - } - - DWORD GetHoverTime() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); - return (DWORD)::SendMessage(m_hWnd, LVM_GETHOVERTIME, 0, 0L); - } - - DWORD SetHoverTime(DWORD dwHoverTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); - return (DWORD)::SendMessage(m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime); - } - - BOOL GetNumberOfWorkAreas(int* pnWorkAreas) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas); - } -#endif // !_WIN32_WCE - - BOOL SetItemCountEx(int nItems, DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_OWNERDATA) != 0) && (((GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((GetStyle() & LVS_TYPEMASK) == LVS_LIST))); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_GETTOOLTIPS, 0, 0L)); - } - - CToolTipCtrl SetToolTips(HWND hWndTT) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0501) - int GetSelectedColumn() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L); - } - - void SetSelectedColumn(int nColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L); - } - - DWORD GetView() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_GETVIEW, 0, 0L); - } - - int SetView(DWORD dwView) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETVIEW, dwView, 0L); - } - - BOOL IsGroupViewEnabled() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L); - } - - int GetGroupInfo(int nGroupID, PLVGROUP pGroup) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup); - } - - int SetGroupInfo(int nGroupID, PLVGROUP pGroup) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup); - } - - void GetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); - } - - void SetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); - } - - void GetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); - } - - BOOL SetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); - } - - void GetTileInfo(PLVTILEINFO pTileInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo); - } - - BOOL SetTileInfo(PLVTILEINFO pTileInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo); - } - - BOOL GetInsertMark(LPLVINSERTMARK pInsertMark) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark); - } - - BOOL SetInsertMark(LPLVINSERTMARK pInsertMark) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark); - } - - int GetInsertMarkRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect); - } - - COLORREF GetInsertMarkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L); - } - - COLORREF SetInsertMarkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr); - } - - COLORREF GetOutlineColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L); - } - - COLORREF SetOutlineColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_SETOUTLINECOLOR, 0, clr); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - int GetGroupCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETGROUPCOUNT, 0, 0L); - } - - BOOL GetGroupInfoByIndex(int nIndex, PLVGROUP pGroup) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup); - } - - BOOL GetGroupRect(int nGroupID, int nType, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpRect != NULL); - if(lpRect != NULL) - lpRect->top = nType; - return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect); - } - - UINT GetGroupState(int nGroupID, UINT uMask) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask); - } - - int GetFocusedGroup() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L); - } - - BOOL GetEmptyText(LPWSTR lpstrText, int cchText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText); - } - - BOOL GetFooterRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect); - } - - BOOL GetFooterInfo(LPLVFOOTERINFO lpFooterInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo); - } - - BOOL GetFooterItemRect(int nItem, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect); - } - - BOOL GetFooterItem(int nItem, LPLVFOOTERITEM lpFooterItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem); - } - - BOOL GetItemIndexRect(PLVITEMINDEX pItemIndex, int nSubItem, int nType, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pItemIndex != NULL); - ATLASSERT(lpRect != NULL); - if(lpRect != NULL) - { - lpRect->top = nSubItem; - lpRect->left = nType; - } - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect); - } - - BOOL SetItemIndexState(PLVITEMINDEX pItemIndex, UINT uState, UINT dwMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvi = { 0 }; - lvi.state = uState; - lvi.stateMask = dwMask; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi); - } - - BOOL GetNextItemIndex(PLVITEMINDEX pItemIndex, WORD wFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0)); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - int InsertColumn(int nCol, const LVCOLUMN* pColumn) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); - } - - int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, - int nWidth = -1, int nSubItem = -1, int iImage = -1, int iOrder = -1) - { - LVCOLUMN column = { 0 }; - column.mask = LVCF_TEXT|LVCF_FMT; - column.pszText = (LPTSTR)lpszColumnHeading; - column.fmt = nFormat; - if (nWidth != -1) - { - column.mask |= LVCF_WIDTH; - column.cx = nWidth; - } - if (nSubItem != -1) - { - column.mask |= LVCF_SUBITEM; - column.iSubItem = nSubItem; - } - if (iImage != -1) - { - column.mask |= LVCF_IMAGE; - column.iImage = iImage; - } - if (iOrder != -1) - { - column.mask |= LVCF_ORDER; - column.iOrder = iOrder; - } - return InsertColumn(nCol, &column); - } - - BOOL DeleteColumn(int nCol) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETECOLUMN, nCol, 0L); - } - - int InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM item = { 0 }; - item.mask = nMask; - item.iItem = nItem; - item.iSubItem = 0; - item.pszText = (LPTSTR)lpszItem; - item.state = nState; - item.stateMask = nStateMask; - item.iImage = nImage; - item.lParam = lParam; - return InsertItem(&item); - } - - int InsertItem(const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem); - } - - int InsertItem(int nItem, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(LVIF_TEXT, nItem, lpszItem, 0, 0, 0, 0); - } - - int InsertItem(int nItem, LPCTSTR lpszItem, int nImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0); - } - - int GetNextItem(int nItem, int nFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0)); - } - - BOOL DeleteItem(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETEITEM, nItem, 0L); - } - - BOOL DeleteAllItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETEALLITEMS, 0, 0L); - } - - int FindItem(LVFINDINFO* pFindInfo, int nStart) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); - } - - int HitTest(LVHITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo); - } - - int HitTest(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVHITTESTINFO hti = { 0 }; - hti.pt = pt; - int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return nRes; - } - - BOOL EnsureVisible(int nItem, BOOL bPartialOK) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); - } - - BOOL Scroll(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SCROLL, size.cx, size.cy); - } - - BOOL RedrawItems(int nFirst, int nLast) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_REDRAWITEMS, nFirst, nLast); - } - - BOOL Arrange(UINT nCode) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ARRANGE, nCode, 0L); - } - - CEdit EditLabel(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, LVM_EDITLABEL, nItem, 0L)); - } - - BOOL Update(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_UPDATE, nItem, 0L); - } - - BOOL SortItems(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare); - } - - CImageList RemoveImageList(int nImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); - } - - CImageList CreateDragImage(int nItem, LPPOINT lpPoint) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint)); - } - - DWORD ApproximateViewRect(int cx = -1, int cy = -1, int nCount = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy)); - } - - int SubItemHitTest(LPLVHITTESTINFO lpInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo); - } - - int AddColumn(LPCTSTR strItem, int nItem, int nSubItem = -1, - int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM, - int nFmt = LVCFMT_LEFT) - { - const int cxOffset = 15; - ATLASSERT(::IsWindow(m_hWnd)); - LVCOLUMN lvc = { 0 }; - lvc.mask = nMask; - lvc.fmt = nFmt; - lvc.pszText = (LPTSTR)strItem; - lvc.cx = GetStringWidth(lvc.pszText) + cxOffset; - if(nMask & LVCF_SUBITEM) - lvc.iSubItem = (nSubItem != -1) ? nSubItem : nItem; - return InsertColumn(nItem, &lvc); - } - - int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - LVITEM lvItem = { 0 }; - lvItem.mask = LVIF_TEXT; - lvItem.iItem = nItem; - lvItem.iSubItem = nSubItem; - lvItem.pszText = (LPTSTR)strItem; - if(nImageIndex != -1) - { - lvItem.mask |= LVIF_IMAGE; - lvItem.iImage = nImageIndex; - } - if(nSubItem == 0) - return InsertItem(&lvItem); - return SetItem(&lvItem) ? nItem : -1; - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - BOOL SortItemsEx(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - int InsertGroup(int nItem, PLVGROUP pGroup) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup); - } - - int AddGroup(PLVGROUP pGroup) - { - return InsertGroup(-1, pGroup); - } - - int RemoveGroup(int nGroupID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L); - } - - void MoveGroup(int nGroupID, int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_MOVEGROUP, nGroupID, nItem); - } - - void MoveItemToGroup(int nItem, int nGroupID) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID); - } - - int EnableGroupView(BOOL bEnable) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L); - } - - int SortGroups(PFNLVGROUPCOMPARE pCompareFunc, LPVOID lpVoid = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid); - } - - void InsertGroupSorted(PLVINSERTGROUPSORTED pInsertGroupSorted) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L); - } - - void RemoveAllGroups() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L); - } - - BOOL HasGroup(int nGroupID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_HASGROUP, nGroupID, 0L); - } - - BOOL InsertMarkHitTest(LPPOINT lpPoint, LPLVINSERTMARK pInsertMark) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark); - } - - BOOL SetInfoTip(PLVSETINFOTIP pSetInfoTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip); - } - - void CancelEditLabel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_CANCELEDITLABEL, 0, 0L); - } - - UINT MapIndexToID(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L); - } - - int MapIDToIndex(UINT uID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_MAPIDTOINDEX, uID, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - int HitTestEx(LPLVHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); - } - - int HitTestEx(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - LVHITTESTINFO hti = { 0 }; - hti.pt = pt; - int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return nRes; - } - - int SubItemHitTestEx(LPLVHITTESTINFO lpHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); - } -#endif // (_WIN32_WINNT >= 0x0600) - - // single-selection only - BOOL SelectItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); - - BOOL bRet = SetItemState(nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); - if(bRet) - bRet = EnsureVisible(nIndex, FALSE); - return bRet; - } -}; - -typedef CListViewCtrlT CListViewCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTreeViewCtrl - -template -class CTreeViewCtrlT : public TBase -{ -public: -// Constructors - CTreeViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTreeViewCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TREEVIEW; - } - - UINT GetCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETCOUNT, 0, 0L); - } - - UINT GetIndent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETINDENT, 0, 0L); - } - - void SetIndent(UINT nIndent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TVM_SETINDENT, nIndent, 0L); - } - - CImageList GetImageList(int nImageListType = TVSIL_NORMAL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList, int nImageListType = TVSIL_NORMAL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList)); - } - - BOOL GetItem(LPTVITEM pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(LPTVITEM pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = nMask; - item.pszText = (LPTSTR) lpszItem; - item.iImage = nImage; - item.iSelectedImage = nSelectedImage; - item.state = nState; - item.stateMask = nStateMask; - item.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&item); - } - - BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpstrText != NULL); - - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_TEXT; - item.pszText = lpstrText; - item.cchTextMax = nLen; - - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - } - -#ifndef _ATL_NO_COM - BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_TEXT; - - LPTSTR lpstrText = NULL; - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - lpstrText[0] = NULL; - item.pszText = lpstrText; - item.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if(!bRet || (lstrlen(item.pszText) < nLen - 1)) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(bRet) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetItemText(HTREEITEM hItem, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_TEXT; - - strText.Empty(); - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - item.pszText = strText.GetBufferSetLength(nLen); - if(item.pszText == NULL) - { - bRet = FALSE; - break; - } - item.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if(!bRet || (lstrlen(item.pszText) < nLen - 1)) - break; - } - strText.ReleaseBuffer(); - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_TEXT, lpszItem, 0, 0, 0, 0, NULL); - } - - BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE; - BOOL bRes = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if (bRes) - { - nImage = item.iImage; - nSelectedImage = item.iSelectedImage; - } - return bRes; - } - - BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_IMAGE|TVIF_SELECTEDIMAGE, NULL, nImage, nSelectedImage, 0, 0, NULL); - } - - UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - return (((UINT)::SendMessage(m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask); -#else // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_STATE; - item.state = 0; - item.stateMask = nStateMask; - ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return (item.state & nStateMask); -#endif // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) - } - - BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_STATE, NULL, 0, 0, nState, nStateMask, NULL); - } - - DWORD_PTR GetItemData(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_PARAM; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return (DWORD_PTR)(bRet ? item.lParam : NULL); - } - - BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(hItem, TVIF_PARAM, NULL, 0, 0, 0, 0, (LPARAM)dwData); - } - - CEdit GetEditControl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, TVM_GETEDITCONTROL, 0, 0L)); - } - - UINT GetVisibleCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L); - } - - BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const - { - ATLASSERT(::IsWindow(m_hWnd)); - *(HTREEITEM*)lpRect = hItem; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect); - } - - BOOL ItemHasChildren(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_CHILDREN; - ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return item.cChildren; - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_GETTOOLTIPS, 0, 0L)); - } - - CToolTipCtrl SetToolTips(HWND hWndTT) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); - } -#endif // !_WIN32_WCE - - int GetISearchString(LPTSTR lpstr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); - } - - // checkboxes only - BOOL GetCheckState(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & TVS_CHECKBOXES) != 0); - UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK); - return (uRet >> 12) - 1; - } - - BOOL SetCheckState(HTREEITEM hItem, BOOL bCheck) - { - int nCheck = bCheck ? 2 : 1; // one based index - return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(nCheck), TVIS_STATEIMAGEMASK); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETBKCOLOR, 0, 0L); - } - - COLORREF SetBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr); - } - - COLORREF GetInsertMarkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L); - } - - COLORREF SetInsertMarkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr); - } - - int GetItemHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETITEMHEIGHT, 0, 0L); - } - - int SetItemHeight(int cyHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L); - } - - int GetScrollTime() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETSCROLLTIME, 0, 0L); - } - - int SetScrollTime(int nScrollTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L); - } - - COLORREF GetTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETTEXTCOLOR, 0, 0L); - } - - COLORREF SetTextColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - COLORREF GetLineColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETLINECOLOR, 0, 0L); - } - - COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetItem(LPTVITEMEX pItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); - } - - BOOL SetItem(LPTVITEMEX pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - DWORD GetExtendedStyle() const - { -#ifndef TVM_GETEXTENDEDSTYLE - const UINT TVM_GETEXTENDEDSTYLE = (TV_FIRST + 45); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) - { -#ifndef TVM_SETEXTENDEDSTYLE - const UINT TVM_SETEXTENDEDSTYLE = (TV_FIRST + 44); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle); - } - -#if (_WIN32_WINNT >= 0x0600) - BOOL SetAutoScrollInfo(UINT uPixPerSec, UINT uUpdateTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime); - } - - DWORD GetSelectedCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L); - } - - BOOL GetItemPartRect(HTREEITEM hItem, TVITEMPART partID, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVGETITEMPARTRECTINFO gipri = { hItem, lpRect, partID }; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - HTREEITEM InsertItem(LPTVINSERTSTRUCT lpInsertStruct) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); - } - - HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, - int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); - } - - HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); - } - - HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, - HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVINSERTSTRUCT tvis = { 0 }; - tvis.hParent = hParent; - tvis.hInsertAfter = hInsertAfter; - tvis.item.mask = nMask; - tvis.item.pszText = (LPTSTR) lpszItem; - tvis.item.iImage = nImage; - tvis.item.iSelectedImage = nSelectedImage; - tvis.item.state = nState; - tvis.item.stateMask = nStateMask; - tvis.item.lParam = lParam; - return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); - } - - BOOL DeleteItem(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem); - } - - BOOL DeleteAllItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); - } - - BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem); - } - - HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); - } - - HTREEITEM GetChildItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); - } - - HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); - } - - HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); - } - - HTREEITEM GetParentItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); - } - - HTREEITEM GetFirstVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); - } - - HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); - } - - HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); - } - - HTREEITEM GetSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); - } - - HTREEITEM GetDropHilightItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); - } - - HTREEITEM GetRootItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); - } - -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - HTREEITEM GetLastVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); - } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0600) - HTREEITEM GetNextSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); - } -#endif // (_WIN32_IE >= 0x0600) - - BOOL Select(HTREEITEM hItem, UINT nCode) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem); - } - - BOOL SelectItem(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); - } - - BOOL SelectDropTarget(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem); - } - - BOOL SelectSetFirstVisible(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem); - } - - CEdit EditLabel(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem)); - } - - BOOL EndEditLabelNow(BOOL bCancel) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L); - } - - HTREEITEM HitTest(TVHITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); - } - - HTREEITEM HitTest(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVHITTESTINFO hti = { 0 }; - hti.pt = pt; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return hTreeItem; - } - - BOOL SortChildren(HTREEITEM hItem, BOOL bRecurse = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem); - } - - BOOL EnsureVisible(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem); - } - - BOOL SortChildrenCB(LPTVSORTCB pSort, BOOL bRecurse = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort); - } - - CImageList RemoveImageList(int nImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); - } - - CImageList CreateDragImage(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem)); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem); - } - - BOOL RemoveInsertMark() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, 0, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - HTREEITEM MapAccIDToHTREEITEM(UINT uID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); - } - - UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - void ShowInfoTip(HTREEITEM hItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem); - } -#endif // (_WIN32_WINNT >= 0x0600) -}; - -typedef CTreeViewCtrlT CTreeViewCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTreeViewCtrlEx - -// forward declaration -template class CTreeViewCtrlExT; - -// Note: TBase here is for CTreeViewCtrlExT, and not for CTreeItemT itself -template -class CTreeItemT -{ -public: - HTREEITEM m_hTreeItem; - CTreeViewCtrlExT* m_pTreeView; - -// Construction - CTreeItemT(HTREEITEM hTreeItem = NULL, CTreeViewCtrlExT* pTreeView = NULL) : m_hTreeItem(hTreeItem), m_pTreeView(pTreeView) - { } - - CTreeItemT(const CTreeItemT& posSrc) - { - *this = posSrc; - } - - operator HTREEITEM() { return m_hTreeItem; } - - CTreeItemT& operator =(const CTreeItemT& itemSrc) - { - m_hTreeItem = itemSrc.m_hTreeItem; - m_pTreeView = itemSrc.m_pTreeView; - return *this; - } - -// Attributes - CTreeViewCtrlExT* GetTreeView() const { return m_pTreeView; } - - BOOL operator !() const { return m_hTreeItem == NULL; } - - BOOL IsNull() const { return m_hTreeItem == NULL; } - - BOOL GetRect(LPRECT lpRect, BOOL bTextOnly) const; - BOOL GetText(LPTSTR lpstrText, int nLen) const; -#ifndef _ATL_NO_COM - BOOL GetText(BSTR& bstrText) const; -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetText(_CSTRING_NS::CString& strText) const; -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL SetText(LPCTSTR lpszItem); - BOOL GetImage(int& nImage, int& nSelectedImage) const; - BOOL SetImage(int nImage, int nSelectedImage); - UINT GetState(UINT nStateMask) const; - BOOL SetState(UINT nState, UINT nStateMask); - DWORD_PTR GetData() const; - BOOL SetData(DWORD_PTR dwData); - BOOL SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam); - -// Operations - CTreeItemT InsertAfter(LPCTSTR lpstrItem, HTREEITEM hItemAfter, int nImageIndex) - { - return _Insert(lpstrItem, nImageIndex, hItemAfter); - } - - CTreeItemT AddHead(LPCTSTR lpstrItem, int nImageIndex) - { - return _Insert(lpstrItem, nImageIndex, TVI_FIRST); - } - - CTreeItemT AddTail(LPCTSTR lpstrItem, int nImageIndex) - { - return _Insert(lpstrItem, nImageIndex, TVI_LAST); - } - - CTreeItemT GetChild() const; - CTreeItemT GetNext(UINT nCode) const; - CTreeItemT GetNextSibling() const; - CTreeItemT GetPrevSibling() const; - CTreeItemT GetParent() const; - CTreeItemT GetFirstVisible() const; - CTreeItemT GetNextVisible() const; - CTreeItemT GetPrevVisible() const; - CTreeItemT GetSelected() const; - CTreeItemT GetDropHilight() const; - CTreeItemT GetRoot() const; -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - CTreeItemT GetLastVisible() const; -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0600) - CTreeItemT GetNextSelected() const; -#endif // (_WIN32_IE >= 0x0600) - BOOL HasChildren() const; - BOOL Delete(); - BOOL Expand(UINT nCode = TVE_EXPAND); - BOOL Select(UINT nCode); - BOOL Select(); - BOOL SelectDropTarget(); - BOOL SelectSetFirstVisible(); - HWND EditLabel(); - HIMAGELIST CreateDragImage(); - BOOL SortChildren(BOOL bRecurse = FALSE); - BOOL EnsureVisible(); - CTreeItemT _Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter); - int GetImageIndex() const; -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL SetInsertMark(BOOL bAfter); -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) - UINT MapHTREEITEMToAccID() const; -#endif // (_WIN32_WINNT >= 0x0501) -#if (_WIN32_WINNT >= 0x0600) - void ShowInfoTip(); - BOOL GetPartRect(TVITEMPART partID, LPRECT lpRect) const; -#endif // (_WIN32_WINNT >= 0x0600) -}; - -typedef CTreeItemT CTreeItem; - - -template -class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > -{ -public: -// Constructors - CTreeViewCtrlExT(HWND hWnd = NULL) : CTreeViewCtrlT< TBase >(hWnd) - { } - - CTreeViewCtrlExT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations (overides that return CTreeItem) - CTreeItemT InsertItem(LPTVINSERTSTRUCT lpInsertStruct) - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); - return CTreeItemT(hTreeItem, this); - } - - CTreeItemT InsertItem(LPCTSTR lpszItem, int nImage, - int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); - } - - CTreeItemT InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); - } - - CTreeItemT GetNextItem(HTREEITEM hItem, UINT nCode) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetChildItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetNextSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetPrevSiblingItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetParentItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetFirstVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetNextVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetPrevVisibleItem(HTREEITEM hItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetDropHilightItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT GetRootItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - CTreeItemT GetLastVisibleItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0600) - CTreeItemT GetNextSelectedItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } -#endif // (_WIN32_IE >= 0x0600) - - CTreeItemT HitTest(TVHITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - - CTreeItemT InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, - HTREEITEM hParent, HTREEITEM hInsertAfter) - { - ATLASSERT(::IsWindow(m_hWnd)); - TVINSERTSTRUCT tvis = { 0 }; - tvis.hParent = hParent; - tvis.hInsertAfter = hInsertAfter; - tvis.item.mask = nMask; - tvis.item.pszText = (LPTSTR) lpszItem; - tvis.item.iImage = nImage; - tvis.item.iSelectedImage = nSelectedImage; - tvis.item.state = nState; - tvis.item.stateMask = nStateMask; - tvis.item.lParam = lParam; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); - return CTreeItemT(hTreeItem, this); - } - - CTreeItemT HitTest(POINT pt, UINT* pFlags) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TVHITTESTINFO hti = { 0 }; - hti.pt = pt; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); - if (pFlags != NULL) - *pFlags = hti.flags; - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } - -#if (_WIN32_WINNT >= 0x0501) - CTreeItemT MapAccIDToHTREEITEM(UINT uID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); - return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); - } -#endif // (_WIN32_WINNT >= 0x0501) -}; - -typedef CTreeViewCtrlExT CTreeViewCtrlEx; - - -// CTreeItem inline methods -template -inline BOOL CTreeItemT::GetRect(LPRECT lpRect, BOOL bTextOnly) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemRect(m_hTreeItem,lpRect,bTextOnly); -} - -template -inline CTreeItemT CTreeItemT::GetNext(UINT nCode) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextItem(m_hTreeItem,nCode); -} - -template -inline CTreeItemT CTreeItemT::GetChild() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetChildItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetNextSibling() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextSiblingItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetPrevSibling() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetPrevSiblingItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetParent() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetParentItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetFirstVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetFirstVisibleItem(); -} - -template -inline CTreeItemT CTreeItemT::GetNextVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextVisibleItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetPrevVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetPrevVisibleItem(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::GetSelected() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetSelectedItem(); -} - -template -inline CTreeItemT CTreeItemT::GetDropHilight() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetDropHilightItem(); -} - -template -inline CTreeItemT CTreeItemT::GetRoot() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetRootItem(); -} - -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -template -inline CTreeItemT CTreeItemT::GetLastVisible() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetLastVisibleItem(); -} -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0600) -template -inline CTreeItemT CTreeItemT::GetNextSelected() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetNextSelectedItem(); -} -#endif // (_WIN32_IE >= 0x0600) - -template -inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemText(m_hTreeItem, lpstrText, nLen); -} - -#ifndef _ATL_NO_COM -#ifdef _OLEAUTO_H_ -template -inline BOOL CTreeItemT::GetText(BSTR& bstrText) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemText(m_hTreeItem, bstrText); -} -#endif // _OLEAUTO_H_ -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) -template -inline BOOL CTreeItemT::GetText(_CSTRING_NS::CString& strText) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemText(m_hTreeItem, strText); -} -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -template -inline BOOL CTreeItemT::GetImage(int& nImage, int& nSelectedImage) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemImage(m_hTreeItem,nImage,nSelectedImage); -} - -template -inline UINT CTreeItemT::GetState(UINT nStateMask) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemState(m_hTreeItem,nStateMask); -} - -template -inline DWORD_PTR CTreeItemT::GetData() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemData(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, - int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItem(m_hTreeItem, nMask, lpszItem, nImage, nSelectedImage, nState, nStateMask, lParam); -} - -template -inline BOOL CTreeItemT::SetText(LPCTSTR lpszItem) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemText(m_hTreeItem,lpszItem); -} - -template -inline BOOL CTreeItemT::SetImage(int nImage, int nSelectedImage) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemImage(m_hTreeItem,nImage,nSelectedImage); -} - -template -inline BOOL CTreeItemT::SetState(UINT nState, UINT nStateMask) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemState(m_hTreeItem,nState,nStateMask); -} - -template -inline BOOL CTreeItemT::SetData(DWORD_PTR dwData) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetItemData(m_hTreeItem,dwData); -} - -template -inline BOOL CTreeItemT::HasChildren() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->ItemHasChildren(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::Delete() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->DeleteItem(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::Expand(UINT nCode /*= TVE_EXPAND*/) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->Expand(m_hTreeItem,nCode); -} - -template -inline BOOL CTreeItemT::Select(UINT nCode) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->Select(m_hTreeItem,nCode); -} - -template -inline BOOL CTreeItemT::Select() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SelectItem(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SelectDropTarget() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SelectDropTarget(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SelectSetFirstVisible() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SelectSetFirstVisible(m_hTreeItem); -} - -template -inline HWND CTreeItemT::EditLabel() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->EditLabel(m_hTreeItem); -} - -template -inline HIMAGELIST CTreeItemT::CreateDragImage() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->CreateDragImage(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::SortChildren(BOOL bRecurse /*= FALSE*/) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SortChildren(m_hTreeItem, bRecurse); -} - -template -inline BOOL CTreeItemT::EnsureVisible() -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->EnsureVisible(m_hTreeItem); -} - -template -inline CTreeItemT CTreeItemT::_Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter) -{ - ATLASSERT(m_pTreeView != NULL); - TVINSERTSTRUCT ins = { 0 }; - ins.hParent = m_hTreeItem; - ins.hInsertAfter = hItemAfter; - ins.item.mask = TVIF_TEXT; - ins.item.pszText = (LPTSTR)lpstrItem; - if(nImageIndex != -1) - { - ins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; - ins.item.iImage = nImageIndex; - ins.item.iSelectedImage = nImageIndex; - } - return CTreeItemT(m_pTreeView->InsertItem(&ins), m_pTreeView); -} - -template -inline int CTreeItemT::GetImageIndex() const -{ - ATLASSERT(m_pTreeView != NULL); - TVITEM item = { 0 }; - item.mask = TVIF_HANDLE | TVIF_IMAGE; - item.hItem = m_hTreeItem; - m_pTreeView->GetItem(&item); - return item.iImage; -} - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -template -inline BOOL CTreeItemT::SetInsertMark(BOOL bAfter) -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->SetInsertMark(m_hTreeItem, bAfter); -} -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) -template -inline UINT CTreeItemT::MapHTREEITEMToAccID() const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->MapHTREEITEMToAccID(m_hTreeItem); -} -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) -template -inline void CTreeItemT::ShowInfoTip() -{ - ATLASSERT(m_pTreeView != NULL); - m_pTreeView->ShowInfoTip(m_hTreeItem); -} - -template -inline BOOL CTreeItemT::GetPartRect(TVITEMPART partID, LPRECT lpRect) const -{ - ATLASSERT(m_pTreeView != NULL); - return m_pTreeView->GetItemPartRect(m_hTreeItem, partID, lpRect); -} -#endif // (_WIN32_WINNT >= 0x0600) - - -/////////////////////////////////////////////////////////////////////////////// -// CToolBarCtrl - -template -class CToolBarCtrlT : public TBase -{ -public: -// Construction - CToolBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CToolBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return TOOLBARCLASSNAME; - } - - BOOL IsButtonEnabled(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONENABLED, nID, 0L); - } - - BOOL IsButtonChecked(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONCHECKED, nID, 0L); - } - - BOOL IsButtonPressed(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONPRESSED, nID, 0L); - } - - BOOL IsButtonHidden(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return(BOOL) ::SendMessage(m_hWnd, TB_ISBUTTONHIDDEN, nID, 0L); - } - - BOOL IsButtonIndeterminate(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONINDETERMINATE, nID, 0L); - } - - int GetState(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETSTATE, nID, 0L); - } - - BOOL SetState(int nID, UINT nState) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETSTATE, nID, MAKELPARAM(nState, 0)); - } - - BOOL GetButton(int nIndex, LPTBBUTTON lpButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETBUTTON, nIndex, (LPARAM)lpButton); - } - - int GetButtonCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_BUTTONCOUNT, 0, 0L); - } - - BOOL GetItemRect(int nIndex, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETITEMRECT, nIndex, (LPARAM)lpRect); - } - - void SetButtonStructSize(int nSize = sizeof(TBBUTTON)) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_BUTTONSTRUCTSIZE, nSize, 0L); - } - - BOOL SetButtonSize(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy)); - } - - BOOL SetButtonSize(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy)); - } - - BOOL SetBitmapSize(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy)); - } - - BOOL SetBitmapSize(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy)); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TB_GETTOOLTIPS, 0, 0L)); - } - - void SetToolTips(HWND hWndToolTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); - } -#endif // !_WIN32_WCE - - void SetNotifyWnd(HWND hWnd) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETPARENT, (WPARAM)hWnd, 0L); - } - - int GetRows() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETROWS, 0, 0L); - } - - void SetRows(int nRows, BOOL bLarger, LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); - } - - BOOL SetCmdID(int nIndex, UINT nID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETCMDID, nIndex, nID); - } - - DWORD GetBitmapFlags() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETBITMAPFLAGS, 0, 0L); - } - - int GetBitmap(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBITMAP, nID, 0L); - } - - int GetButtonText(int nID, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText); - } - - // nIndex - IE5 or higher only - CImageList GetImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETIMAGELIST, nIndex, 0L)); - } - - // nIndex - IE5 or higher only - CImageList SetImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList)); - } - - // nIndex - IE5 or higher only - CImageList GetDisabledImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETDISABLEDIMAGELIST, nIndex, 0L)); - } - - // nIndex - IE5 or higher only - CImageList SetDisabledImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList)); - } - -#ifndef _WIN32_WCE - // nIndex - IE5 or higher only - CImageList GetHotImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETHOTIMAGELIST, nIndex, 0L)); - } - - // nIndex - IE5 or higher only - CImageList SetHotImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList)); - } -#endif // !_WIN32_WCE - - DWORD GetStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETSTYLE, 0, 0L); - } - - void SetStyle(DWORD dwStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETSTYLE, 0, dwStyle); - } - - DWORD GetButtonSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); - } - - void GetButtonSize(SIZE& size) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); - size.cx = LOWORD(dwRet); - size.cy = HIWORD(dwRet); - } - - BOOL GetRect(int nID, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETRECT, nID, (LPARAM)lpRect); - } - - int GetTextRows() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETTEXTROWS, 0, 0L); - } - - BOOL SetButtonWidth(int cxMin, int cxMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); - } - - BOOL SetIndent(int nIndent) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETINDENT, nIndent, 0L); - } - - BOOL SetMaxTextRows(int nMaxTextRows) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETMAXTEXTROWS, nMaxTextRows, 0L); - } - -#if (_WIN32_IE >= 0x0400) -#ifndef _WIN32_WCE - BOOL GetAnchorHighlight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0L); - } - - BOOL SetAnchorHighlight(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETANCHORHIGHLIGHT, bEnable, 0L); - } -#endif // !_WIN32_WCE - - int GetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi); - } - - BOOL SetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi); - } - - BOOL SetButtonInfo(int nID, DWORD dwMask, BYTE Style, BYTE State, LPCTSTR lpszItem, - int iImage, WORD cx, int iCommand, DWORD_PTR lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = dwMask; - tbbi.idCommand = iCommand; - tbbi.iImage = iImage; - tbbi.fsState = State; - tbbi.fsStyle = Style; - tbbi.cx = cx; - tbbi.pszText = (LPTSTR) lpszItem; - tbbi.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi); - } - -#ifndef _WIN32_WCE - int GetHotItem() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETHOTITEM, 0, 0L); - } - - int SetHotItem(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_SETHOTITEM, nItem, 0L); - } -#endif // !_WIN32_WCE - - BOOL IsButtonHighlighted(int nButtonID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L); - } - - DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags); - } - -#ifndef _WIN32_WCE - BOOL GetColorScheme(LPCOLORSCHEME lpcs) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs); - } - - void SetColorScheme(LPCOLORSCHEME lpcs) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs); - } - - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwStyle); - } - - void GetInsertMark(LPTBINSERTMARK lptbim) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)lptbim); - } - - void SetInsertMark(LPTBINSERTMARK lptbim) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)lptbim); - } - - COLORREF GetInsertMarkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0L); - } - - COLORREF SetInsertMarkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr); - } - - BOOL GetMaxSize(LPSIZE lpSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)lpSize); - } - - void GetPadding(LPSIZE lpSizePadding) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpSizePadding != NULL); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETPADDING, 0, 0L); - lpSizePadding->cx = GET_X_LPARAM(dwRet); - lpSizePadding->cy = GET_Y_LPARAM(dwRet); - } - - void SetPadding(int cx, int cy, LPSIZE lpSizePadding = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_SETPADDING, 0, MAKELPARAM(cx, cy)); - if(lpSizePadding != NULL) - { - lpSizePadding->cx = GET_X_LPARAM(dwRet); - lpSizePadding->cy = GET_Y_LPARAM(dwRet); - } - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int GetString(int nString, LPTSTR lpstrString, int cchMaxLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString); - } - - int GetStringBSTR(int nString, BSTR& bstrString) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrString == NULL); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); - if(nLength != -1) - { - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLength + 1); - if(lpstrText != NULL) - { - nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstrText); - if(nLength != -1) - bstrString = ::SysAllocString(T2OLE(lpstrText)); - } - else - { - nLength = -1; - } - } - - return nLength; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetString(int nString, _CSTRING_NS::CString& str) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); - if(nLength != -1) - { - LPTSTR lpstr = str.GetBufferSetLength(nLength + 1); - if(lpstr != NULL) - nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr); - else - nLength = -1; - str.ReleaseBuffer(); - } - return nLength; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) - void GetMetrics(LPTBMETRICS lptbm) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_GETMETRICS, 0, (LPARAM)lptbm); - } - - void SetMetrics(LPTBMETRICS lptbm) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETMETRICS, 0, (LPARAM)lptbm); - } - - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_WINNT >= 0x0600) - CImageList GetPressedImageList(int nIndex = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETPRESSEDIMAGELIST, nIndex, 0L)); - } - - CImageList SetPressedImageList(HIMAGELIST hImageList, int nIndex = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList)); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - BOOL EnableButton(int nID, BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); - } - - BOOL CheckButton(int nID, BOOL bCheck = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); - } - - BOOL PressButton(int nID, BOOL bPress = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); - } - - BOOL HideButton(int nID, BOOL bHide = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); - } - - BOOL Indeterminate(int nID, BOOL bIndeterminate = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); - } - - int AddBitmap(int nNumButtons, UINT nBitmapID) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBADDBITMAP tbab = { 0 }; - tbab.hInst = ModuleHelper::GetResourceInstance(); - ATLASSERT(tbab.hInst != NULL); - tbab.nID = nBitmapID; - return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); - } - - int AddBitmap(int nNumButtons, HBITMAP hBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBADDBITMAP tbab = { 0 }; - tbab.hInst = NULL; - tbab.nID = (UINT_PTR)hBitmap; - return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); - } - - BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); - } - - BOOL InsertButton(int nIndex, LPTBBUTTON lpButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); - } - - BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, - INT_PTR iString, DWORD_PTR lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBBUTTON tbb = { 0 }; - tbb.fsStyle = Style; - tbb.fsState = State; - tbb.idCommand = iCommand; - tbb.iBitmap = iBitmap; - tbb.iString = iString; - tbb.dwData = lParam; - return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb); - } - - BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, - LPCTSTR lpszItem, DWORD_PTR lParam) - { - return InsertButton(nIndex, iCommand, Style, State, iBitmap, (INT_PTR)lpszItem, lParam); - } - - BOOL AddButton(LPTBBUTTON lpButton) - { - return InsertButton(-1, lpButton); - } - - BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam) - { - return InsertButton(-1, iCommand, Style, State, iBitmap, iString, lParam); - } - - BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, LPCTSTR lpszItem, DWORD_PTR lParam) - { - return InsertButton(-1, iCommand, Style, State, iBitmap, lpszItem, lParam); - } - - BOOL DeleteButton(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_DELETEBUTTON, nIndex, 0L); - } - - UINT CommandToIndex(UINT nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TB_COMMANDTOINDEX, nID, 0L); - } - -#ifndef _WIN32_WCE - void SaveState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBSAVEPARAMS tbs = { 0 }; - tbs.hkr = hKeyRoot; - tbs.pszSubKey = lpszSubKey; - tbs.pszValueName = lpszValueName; - ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs); - } - - void RestoreState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) - { - ATLASSERT(::IsWindow(m_hWnd)); - TBSAVEPARAMS tbs = { 0 }; - tbs.hkr = hKeyRoot; - tbs.pszSubKey = lpszSubKey; - tbs.pszValueName = lpszValueName; - ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs); - } - - void Customize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_CUSTOMIZE, 0, 0L); - } -#endif // !_WIN32_WCE - - int AddString(UINT nStringID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_ADDSTRING, (WPARAM)ModuleHelper::GetResourceInstance(), (LPARAM)nStringID); - } - - int AddStrings(LPCTSTR lpszStrings) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_ADDSTRING, 0, (LPARAM)lpszStrings); - } - - void AutoSize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_AUTOSIZE, 0, 0L); - } - - BOOL ChangeBitmap(int nID, int nBitmap) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0)); - } - - int LoadImages(int nBitmapID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)ModuleHelper::GetResourceInstance()); - } - - int LoadStdImages(int nBitmapID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL); - } - - BOOL ReplaceBitmap(LPTBREPLACEBITMAP ptbrb) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb); - } - -#if (_WIN32_IE >= 0x0400) - int HitTest(LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)lpPoint); - } - -#ifndef _WIN32_WCE - BOOL InsertMarkHitTest(LPPOINT lpPoint, LPTBINSERTMARK lptbim) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim); - } - - BOOL InsertMarkHitTest(int x, int y, LPTBINSERTMARK lptbim) const - { - ATLASSERT(::IsWindow(m_hWnd)); - POINT pt = { x, y }; - return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim); - } - - BOOL MapAccelerator(TCHAR chAccel, int& nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID); - } - - BOOL MarkButton(int nID, BOOL bHighlight = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); - } - - BOOL MoveButton(int nOldPos, int nNewPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); - } - - HRESULT GetObject(REFIID iid, LPVOID* ppvObject) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -}; - -typedef CToolBarCtrlT CToolBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CStatusBarCtrl - -template -class CStatusBarCtrlT : public TBase -{ -public: -// Constructors - CStatusBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CStatusBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Methods - static LPCTSTR GetWndClassName() - { - return STATUSCLASSNAME; - } - - int GetParts(int nParts, int* pParts) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, SB_GETPARTS, nParts, (LPARAM)pParts); - } - - BOOL SetParts(int nParts, int* pWidths) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths); - } - - int GetTextLength(int nPane, int* pType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L); - if (pType != NULL) - *pType = (int)(short)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - int GetText(int nPane, LPTSTR lpszText, int* pType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXT, (WPARAM)nPane, (LPARAM)lpszText); - if(pType != NULL) - *pType = (int)(short)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - -#ifndef _ATL_NO_COM - BOOL GetTextBSTR(int nPane, BSTR& bstrText, int* pType = NULL) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - ATLASSERT(bstrText == NULL); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); - if(nLength == 0) - return FALSE; - - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLength + 1); - if(lpstrText == NULL) - return FALSE; - - if(!GetText(nPane, lpstrText, pType)) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpstrText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetText(int nPane, _CSTRING_NS::CString& strText, int* pType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); - if(nLength == 0) - return 0; - - LPTSTR lpstr = strText.GetBufferSetLength(nLength); - if(lpstr == NULL) - return 0; - return GetText(nPane, lpstr, pType); - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL SetText(int nPane, LPCTSTR lpszText, int nType = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); - } - - BOOL GetRect(int nPane, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_GETRECT, nPane, (LPARAM)lpRect); - } - - BOOL GetBorders(int* pBorders) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)pBorders); - } - - BOOL GetBorders(int& nHorz, int& nVert, int& nSpacing) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int borders[3] = { 0, 0, 0 }; - BOOL bResult = (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); - if(bResult) - { - nHorz = borders[0]; - nVert = borders[1]; - nSpacing = borders[2]; - } - return bResult; - } - - void SetMinHeight(int nMin) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, SB_SETMINHEIGHT, nMin, 0L); - } - - BOOL SetSimple(BOOL bSimple = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SIMPLE, bSimple, 0L); - } - - BOOL IsSimple() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_ISSIMPLE, 0, 0L); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SETUNICODEFORMAT, bUnicode, 0L); - } - - void GetTipText(int nPane, LPTSTR lpstrText, int nSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - ::SendMessage(m_hWnd, SB_GETTIPTEXT, MAKEWPARAM(nPane, nSize), (LPARAM)lpstrText); - } - - void SetTipText(int nPane, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - ::SendMessage(m_hWnd, SB_SETTIPTEXT, nPane, (LPARAM)lpstrText); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) - COLORREF SetBkColor(COLORREF clrBk) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, SB_SETBKCOLOR, 0, (LPARAM)clrBk); - } - - HICON GetIcon(int nPane) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (HICON)::SendMessage(m_hWnd, SB_GETICON, nPane, 0L); - } - - BOOL SetIcon(int nPane, HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_SETICON, nPane, (LPARAM)hIcon); - } -#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) -}; - -typedef CStatusBarCtrlT CStatusBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTabCtrl - -template -class CTabCtrlT : public TBase -{ -public: -// Constructors - CTabCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTabCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TABCONTROL; - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_GETIMAGELIST, 0, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_SETIMAGELIST, 0, (LPARAM)hImageList)); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETITEMCOUNT, 0, 0L); - } - - BOOL GetItem(int nItem, LPTCITEM pTabCtrlItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); - } - - BOOL SetItem(int nItem, LPTCITEM pTabCtrlItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); - } - - int SetItem(int nItem, UINT mask, LPCTSTR lpszItem, DWORD dwState, DWORD dwStateMask, int iImage, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TCITEM tci = { 0 }; - tci.mask = mask; - tci.pszText = (LPTSTR) lpszItem; - tci.dwState = dwState; - tci.dwStateMask = dwStateMask; - tci.iImage = iImage; - tci.lParam = lParam; - return (int)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)&tci); - } - - BOOL GetItemRect(int nItem, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETITEMRECT, nItem, (LPARAM)lpRect); - } - - int GetCurSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETCURSEL, 0, 0L); - } - - int SetCurSel(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_SETCURSEL, nItem, 0L); - } - - SIZE SetItemSize(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwSize = (DWORD)::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(size.cx, size.cy)); - SIZE sizeRet = { GET_X_LPARAM(dwSize), GET_Y_LPARAM(dwSize) }; - return sizeRet; - } - - void SetItemSize(int cx, int cy) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(cx, cy)); - } - - void SetPadding(SIZE size) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETPADDING, 0, MAKELPARAM(size.cx, size.cy)); - } - - int GetRowCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETROWCOUNT, 0, 0L); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetTooltips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TCM_GETTOOLTIPS, 0, 0L)); - } - - void SetTooltips(HWND hWndToolTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); - } -#endif // !_WIN32_WCE - - int GetCurFocus() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETCURFOCUS, 0, 0L); - } - - void SetCurFocus(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETCURFOCUS, nItem, 0L); - } - - BOOL SetItemExtra(int cbExtra) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetItemCount() == 0); // must be empty - return (BOOL)::SendMessage(m_hWnd, TCM_SETITEMEXTRA, cbExtra, 0L); - } - - int SetMinTabWidth(int nWidth = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_SETMINTABWIDTH, 0, nWidth); - } - -#if (_WIN32_IE >= 0x0400) - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TCM_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TCM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); - } - -#ifndef _WIN32_WCE - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -// Operations - int InsertItem(int nItem, LPTCITEM pTabCtrlItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); - } - - int InsertItem(int nItem, UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - TCITEM tci = { 0 }; - tci.mask = mask; - tci.pszText = (LPTSTR) lpszItem; - tci.iImage = iImage; - tci.lParam = lParam; - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); - } - - int InsertItem(int nItem, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - TCITEM tci = { 0 }; - tci.mask = TCIF_TEXT; - tci.pszText = (LPTSTR) lpszItem; - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); - } - - int AddItem(LPTCITEM pTabCtrlItem) - { - return InsertItem(GetItemCount(), pTabCtrlItem); - } - - int AddItem(UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) - { - return InsertItem(GetItemCount(), mask, lpszItem, iImage, lParam); - } - - int AddItem(LPCTSTR lpszItem) - { - return InsertItem(GetItemCount(), lpszItem); - } - - BOOL DeleteItem(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_DELETEITEM, nItem, 0L); - } - - BOOL DeleteAllItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_DELETEALLITEMS, 0, 0L); - } - - void AdjustRect(BOOL bLarger, LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_ADJUSTRECT, bLarger, (LPARAM)lpRect); - } - - void RemoveImage(int nImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_REMOVEIMAGE, nImage, 0L); - } - - int HitTest(TC_HITTESTINFO* pHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)pHitTestInfo); - } - - void DeselectAll(BOOL bExcludeFocus = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_DESELECTALL, bExcludeFocus, 0L); - } - -#if (_WIN32_IE >= 0x0400) - BOOL HighlightItem(int nIndex, BOOL bHighlight = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_HIGHLIGHTITEM, nIndex, MAKELPARAM(bHighlight, 0)); - } -#endif // (_WIN32_IE >= 0x0400) -}; - -typedef CTabCtrlT CTabCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CTrackBarCtrl - -template -class CTrackBarCtrlT : public TBase -{ -public: -// Constructors - CTrackBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTrackBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return TRACKBAR_CLASS; - } - - int GetLineSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETLINESIZE, 0, 0L); - } - - int SetLineSize(int nSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETLINESIZE, 0, nSize); - } - - int GetPageSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETPAGESIZE, 0, 0L); - } - - int SetPageSize(int nSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETPAGESIZE, 0, nSize); - } - - int GetRangeMin() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETRANGEMIN, 0, 0L); - } - - void SetRangeMin(int nMin, BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGEMIN, bRedraw, nMin); - } - - int GetRangeMax() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETRANGEMAX, 0, 0L); - } - - void SetRangeMax(int nMax, BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGEMAX, bRedraw, nMax); - } - - void GetRange(int& nMin, int& nMax) const - { - nMin = GetRangeMin(); - nMax = GetRangeMax(); - } - - void SetRange(int nMin, int nMax, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGE, bRedraw, MAKELPARAM(nMin, nMax)); - } - - int GetSelStart() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETSELSTART, 0, 0L); - } - - void SetSelStart(int nMin) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETSELSTART, 0, (LPARAM)nMin); - } - - int GetSelEnd() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETSELEND, 0, 0L); - } - - void SetSelEnd(int nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETSELEND, 0, (LPARAM)nMax); - } - - void GetSelection(int& nMin, int& nMax) const - { - nMin = GetSelStart(); - nMax = GetSelEnd(); - } - - void SetSelection(int nMin, int nMax) - { - SetSelStart(nMin); - SetSelEnd(nMax); - } - - void GetChannelRect(LPRECT lprc) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc); - } - - void GetThumbRect(LPRECT lprc) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc); - } - - int GetPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETPOS, 0, 0L); - } - - void SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETPOS, TRUE, nPos); - } - - UINT GetNumTics() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TBM_GETNUMTICS, 0, 0L); - } - - DWORD* GetTicArray() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD*)::SendMessage(m_hWnd, TBM_GETPTICS, 0, 0L); - } - - int GetTic(int nTic) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTIC, nTic, 0L); - } - - BOOL SetTic(int nTic) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_SETTIC, 0, nTic); - } - - int GetTicPos(int nTic) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTICPOS, nTic, 0L); - } - - void SetTicFreq(int nFreq) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTICFREQ, nFreq, 0L); - } - - int GetThumbLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTHUMBLENGTH, 0, 0L); - } - - void SetThumbLength(int nLength) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTHUMBLENGTH, nLength, 0L); - } - - void SetSel(int nStart, int nEnd, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & TBS_ENABLESELRANGE) != 0); - ::SendMessage(m_hWnd, TBM_SETSEL, bRedraw, MAKELPARAM(nStart, nEnd)); - } - - ATL::CWindow GetBuddy(BOOL bLeft = TRUE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_GETBUDDY, bLeft, 0L)); - } - - ATL::CWindow SetBuddy(HWND hWndBuddy, BOOL bLeft = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_SETBUDDY, bLeft, (LPARAM)hWndBuddy)); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TBM_GETTOOLTIPS, 0, 0L)); - } - - void SetToolTips(HWND hWndTT) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTOOLTIPS, (WPARAM)hWndTT, 0L); - } - - int SetTipSide(int nSide) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETTIPSIDE, nSide, 0L); - } -#endif // !_WIN32_WCE - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -// Operations - void ClearSel(BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_CLEARSEL, bRedraw, 0L); - } - - void VerifyPos() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETPOS, FALSE, 0L); - } - - void ClearTics(BOOL bRedraw = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_CLEARTICS, bRedraw, 0L); - } -}; - -typedef CTrackBarCtrlT CTrackBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CUpDownCtrl - -template -class CUpDownCtrlT : public TBase -{ -public: -// Constructors - CUpDownCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CUpDownCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return UPDOWN_CLASS; - } - - UINT GetAccel(int nAccel, UDACCEL* pAccel) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)); - } - - BOOL SetAccel(int nAccel, UDACCEL* pAccel) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)LOWORD(::SendMessage(m_hWnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel)); - } - - UINT GetBase() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETBASE, 0, 0L)); - } - - int SetBase(int nBase) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, UDM_SETBASE, nBase, 0L); - } - - ATL::CWindow GetBuddy() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_GETBUDDY, 0, 0L)); - } - - ATL::CWindow SetBuddy(HWND hWndBuddy) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_SETBUDDY, (WPARAM)hWndBuddy, 0L)); - } - - int GetPos(LPBOOL lpbError = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETPOS, 0, 0L); - // Note: Seems that Windows always sets error to TRUE if - // UDS_SETBUDDYINT style is not used - if(lpbError != NULL) - *lpbError = (HIWORD(dwRet) != 0) ? TRUE : FALSE; - return (int)(short)LOWORD(dwRet); - } - - int SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))); - } - - DWORD GetRange() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); - } - - void GetRange(int& nLower, int& nUpper) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); - nLower = (int)(short)HIWORD(dwRet); - nUpper = (int)(short)LOWORD(dwRet); - } - - void SetRange(int nLower, int nUpper) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); - } - -#if (_WIN32_IE >= 0x0400) - void SetRange32(int nLower, int nUpper) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_SETRANGE32, nLower, nUpper); - } - - void GetRange32(int& nLower, int& nUpper) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_GETRANGE32, (WPARAM)&nLower, (LPARAM)&nUpper); - } - -#ifndef _WIN32_WCE - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, UDM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, UDM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int GetPos32(LPBOOL lpbError = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - // Note: Seems that Windows always sets error to TRUE if - // UDS_SETBUDDYINT style is not used - return (int)::SendMessage(m_hWnd, UDM_GETPOS32, 0, (LPARAM)lpbError); - } - - int SetPos32(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, UDM_SETPOS32, 0, (LPARAM)nPos); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CUpDownCtrlT CUpDownCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CProgressBarCtrl - -template -class CProgressBarCtrlT : public TBase -{ -public: -// Constructors - CProgressBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CProgressBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return PROGRESS_CLASS; - } - - DWORD SetRange(int nLower, int nUpper) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); - } - - int SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETPOS, nPos, 0L)); - } - - int OffsetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_DELTAPOS, nPos, 0L)); - } - - int SetStep(int nStep) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETSTEP, nStep, 0L)); - } - - UINT GetPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, PBM_GETPOS, 0, 0L); - } - - void GetRange(PPBRANGE pPBRange) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPBRange != NULL); - ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)pPBRange); - } - - void GetRange(int& nLower, int& nUpper) const - { - ATLASSERT(::IsWindow(m_hWnd)); - PBRANGE range = { 0 }; - ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)&range); - nLower = range.iLow; - nUpper = range.iHigh; - } - - int GetRangeLimit(BOOL bLowLimit) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETRANGE, bLowLimit, (LPARAM)NULL); - } - - DWORD SetRange32(int nMin, int nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE32, nMin, nMax); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - COLORREF SetBarColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_SETBARCOLOR, 0, (LPARAM)clr); - } - - COLORREF SetBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_SETBKCOLOR, 0, (LPARAM)clr); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) - BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime); - } -#endif // (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) - -#if (_WIN32_WINNT >= 0x0600) - int GetStep() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETSTEP, 0, 0L); - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_GETBKCOLOR, 0, 0L); - } - - COLORREF GetBarColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_GETBARCOLOR, 0, 0L); - } - - int GetState() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETSTATE, 0, 0L); - } - - int SetState(int nState) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_SETSTATE, nState, 0L); - } -#endif // (_WIN32_WINNT >= 0x0600) - -// Operations - int StepIt() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_STEPIT, 0, 0L)); - } -}; - -typedef CProgressBarCtrlT CProgressBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CHotKeyCtrl - -#ifndef _WIN32_WCE - -template -class CHotKeyCtrlT : public TBase -{ -public: -// Constructors - CHotKeyCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHotKeyCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return HOTKEY_CLASS; - } - - DWORD GetHotKey() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); - } - - void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dw = (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); - wVirtualKeyCode = LOBYTE(LOWORD(dw)); - wModifiers = HIBYTE(LOWORD(dw)); - } - - void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, HKM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0L); - } - - void SetRules(WORD wInvalidComb, WORD wModifiers) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, HKM_SETRULES, wInvalidComb, MAKELPARAM(wModifiers, 0)); - } -}; - -typedef CHotKeyCtrlT CHotKeyCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CAnimateCtrl - -#ifndef _WIN32_WCE - -template -class CAnimateCtrlT : public TBase -{ -public: -// Constructors - CAnimateCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CAnimateCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return ANIMATE_CLASS; - } - -// Operations - BOOL Open(ATL::_U_STRINGorID FileName) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, (LPARAM)FileName.m_lpstr); - } - - BOOL Play(UINT nFrom, UINT nTo, UINT nRep) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, nRep, MAKELPARAM(nFrom, nTo)); - } - - BOOL Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_STOP, 0, 0L); - } - - BOOL Close() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, 0L); - } - - BOOL Seek(UINT nTo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, 0, MAKELPARAM(nTo, nTo)); - } - - // Vista only - BOOL IsPlaying() const - { -#ifndef ACM_ISPLAYING - const UINT ACM_ISPLAYING = (WM_USER+104); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_ISPLAYING, 0, 0L); - } -}; - -typedef CAnimateCtrlT CAnimateCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditCtrl - -#ifndef _WIN32_WCE - -#ifdef _UNICODE -#if (_RICHEDIT_VER == 0x0100) -#undef RICHEDIT_CLASS -#define RICHEDIT_CLASS L"RICHEDIT" -#endif // (_RICHEDIT_VER == 0x0100) -#endif // _UNICODE - -template -class CRichEditCtrlT : public TBase -{ -public: -// Constructors - CRichEditCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CRichEditCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return RICHEDIT_CLASS; - } - - static LPCTSTR GetLibraryName() - { -#if (_RICHEDIT_VER >= 0x0200) - return _T("RICHED20.DLL"); -#else - return _T("RICHED32.DLL"); -#endif - } - - int GetLineCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); - } - - void GetRect(LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); - } - - DWORD GetOptions() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETOPTIONS, 0, 0L); - } - - DWORD SetOptions(WORD wOperation, DWORD dwOptions) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_SETOPTIONS, wOperation, dwOptions); - } - - // NOTE: first word in lpszBuffer must contain the size of the buffer! - int GetLine(int nIndex, LPTSTR lpszBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - *(LPWORD)lpszBuffer = (WORD)nMaxLength; - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - BOOL CanPaste(UINT nFormat = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, nFormat, 0L); - } - - void GetSel(LONG& nStartChar, LONG& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - nStartChar = cr.cpMin; - nEndChar = cr.cpMax; - } - - void GetSel(CHARRANGE &cr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - } - - int SetSel(LONG nStartChar, LONG nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - CHARRANGE cr = { nStartChar, nEndChar }; - return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); - } - - int SetSel(CHARRANGE &cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); - } - - int SetSelAll() - { - return SetSel(0, -1); - } - - int SetSelNone() - { - return SetSel(-1, 0); - } - - DWORD GetDefaultCharFormat(CHARFORMAT& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); - } - - DWORD GetSelectionCharFormat(CHARFORMAT& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); - } - - DWORD GetEventMask() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETEVENTMASK, 0, 0L); - } - - LONG GetLimitText() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); - } - - DWORD GetParaFormat(PARAFORMAT& pf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); - } - -#if (_RICHEDIT_VER >= 0x0200) - LONG GetSelText(LPTSTR lpstrBuff) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); - } -#else // !(_RICHEDIT_VER >= 0x0200) - // RichEdit 1.0 EM_GETSELTEXT is ANSI only - LONG GetSelText(LPSTR lpstrBuff) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); - } -#endif // !(_RICHEDIT_VER >= 0x0200) - -#ifndef _ATL_NO_COM - BOOL GetSelTextBSTR(BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - -#if (_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return FALSE; - if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) - return FALSE; - - bstrText = ::SysAllocString(T2W(lpstrText)); -#else // !(_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return FALSE; - if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) - return FALSE; - - bstrText = ::SysAllocString(A2W(lpstrText)); -#endif // !(_RICHEDIT_VER >= 0x0200) - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - LONG GetSelText(_CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - - CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); - -#if (_RICHEDIT_VER >= 0x0200) - LONG lLen = 0; - LPTSTR lpstrText = strText.GetBufferSetLength(cr.cpMax - cr.cpMin); - if(lpstrText != NULL) - { - lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); - strText.ReleaseBuffer(); - } -#else // !(_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return 0; - LONG lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); - if(lLen == 0) - return 0; - - USES_CONVERSION; - strText = A2T(lpstrText); -#endif // !(_RICHEDIT_VER >= 0x0200) - - return lLen; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - WORD GetSelectionType() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (WORD)::SendMessage(m_hWnd, EM_SELECTIONTYPE, 0, 0L); - } - - COLORREF SetBackgroundColor(COLORREF cr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 0, cr); - } - - COLORREF SetBackgroundColor() // sets to system background - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 1, 0); - } - - BOOL SetCharFormat(CHARFORMAT& cf, WORD wFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); - } - - BOOL SetDefaultCharFormat(CHARFORMAT& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); - } - - BOOL SetSelectionCharFormat(CHARFORMAT& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - - BOOL SetWordCharFormat(CHARFORMAT& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); - } - - DWORD SetEventMask(DWORD dwEventMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_SETEVENTMASK, 0, dwEventMask); - } - - BOOL SetParaFormat(PARAFORMAT& pf) - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); - } - - BOOL SetTargetDevice(HDC hDC, int cxLineWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTARGETDEVICE, (WPARAM)hDC, cxLineWidth); - } - - int GetTextLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); - } - - BOOL SetReadOnly(BOOL bReadOnly = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); - } - - int GetFirstVisibleLine() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); - } - - EDITWORDBREAKPROCEX GetWordBreakProcEx() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_GETWORDBREAKPROCEX, 0, 0L); - } - - EDITWORDBREAKPROCEX SetWordBreakProcEx(EDITWORDBREAKPROCEX pfnEditWordBreakProcEx) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_SETWORDBREAKPROCEX, 0, (LPARAM)pfnEditWordBreakProcEx); - } - - int GetTextRange(TEXTRANGE* pTextRange) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)pTextRange); - } - -#if (_RICHEDIT_VER >= 0x0200) - int GetTextRange(LONG nStartChar, LONG nEndChar, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TEXTRANGE tr = { 0 }; - tr.chrg.cpMin = nStartChar; - tr.chrg.cpMax = nEndChar; - tr.lpstrText = lpstrText; - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - } -#else // !(_RICHEDIT_VER >= 0x0200) - - int GetTextRange(LONG nStartChar, LONG nEndChar, LPSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TEXTRANGE tr = { 0 }; - tr.chrg.cpMin = nStartChar; - tr.chrg.cpMax = nEndChar; - tr.lpstrText = lpstrText; - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - } -#endif // !(_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0200) - DWORD GetDefaultCharFormat(CHARFORMAT2& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); - } - - BOOL SetCharFormat(CHARFORMAT2& cf, WORD wFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); - } - - BOOL SetDefaultCharFormat(CHARFORMAT2& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); - } - - DWORD GetSelectionCharFormat(CHARFORMAT2& cf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); - } - - BOOL SetSelectionCharFormat(CHARFORMAT2& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - } - - BOOL SetWordCharFormat(CHARFORMAT2& cf) - { - ATLASSERT(::IsWindow(m_hWnd)); - cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); - } - - DWORD GetParaFormat(PARAFORMAT2& pf) const - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); - } - - BOOL SetParaFormat(PARAFORMAT2& pf) - { - ATLASSERT(::IsWindow(m_hWnd)); - pf.cbSize = sizeof(PARAFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); - } - - TEXTMODE GetTextMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (TEXTMODE)::SendMessage(m_hWnd, EM_GETTEXTMODE, 0, 0L); - } - - BOOL SetTextMode(TEXTMODE enumTextMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - return !(BOOL)::SendMessage(m_hWnd, EM_SETTEXTMODE, enumTextMode, 0L); - } - - UNDONAMEID GetUndoName() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETUNDONAME, 0, 0L); - } - - UNDONAMEID GetRedoName() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETREDONAME, 0, 0L); - } - - BOOL CanRedo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); - } - - BOOL GetAutoURLDetect() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETAUTOURLDETECT, 0, 0L); - } - - BOOL SetAutoURLDetect(BOOL bAutoDetect = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return !(BOOL)::SendMessage(m_hWnd, EM_AUTOURLDETECT, bAutoDetect, 0L); - } - - // this method is deprecated, please use SetAutoURLDetect - BOOL EnableAutoURLDetect(BOOL bEnable = TRUE) { return SetAutoURLDetect(bEnable); } - - UINT SetUndoLimit(UINT uUndoLimit) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETUNDOLIMIT, uUndoLimit, 0L); - } - - void SetPalette(HPALETTE hPalette) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPALETTE, (WPARAM)hPalette, 0L); - } - - int GetTextEx(GETTEXTEX* pGetTextEx, LPTSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)pGetTextEx, (LPARAM)lpstrText); - } - - int GetTextEx(LPTSTR lpstrText, int nTextLen, DWORD dwFlags = GT_DEFAULT, UINT uCodePage = CP_ACP, LPCSTR lpDefaultChar = NULL, LPBOOL lpUsedDefChar = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - GETTEXTEX gte = { 0 }; - gte.cb = nTextLen * sizeof(TCHAR); - gte.codepage = uCodePage; - gte.flags = dwFlags; - gte.lpDefaultChar = lpDefaultChar; - gte.lpUsedDefChar = lpUsedDefChar; - return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)>e, (LPARAM)lpstrText); - } - - int GetTextLengthEx(GETTEXTLENGTHEX* pGetTextLengthEx) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)pGetTextLengthEx, 0L); - } - - int GetTextLengthEx(DWORD dwFlags = GTL_DEFAULT, UINT uCodePage = CP_ACP) const - { - ATLASSERT(::IsWindow(m_hWnd)); - GETTEXTLENGTHEX gtle = { 0 }; - gtle.codepage = uCodePage; - gtle.flags = dwFlags; - return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)>le, 0L); - } -#endif // (_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0300) - int SetTextEx(SETTEXTEX* pSetTextEx, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)pSetTextEx, (LPARAM)lpstrText); - } - - int SetTextEx(LPCTSTR lpstrText, DWORD dwFlags = ST_DEFAULT, UINT uCodePage = CP_ACP) - { - ATLASSERT(::IsWindow(m_hWnd)); - SETTEXTEX ste = { 0 }; - ste.flags = dwFlags; - ste.codepage = uCodePage; - return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpstrText); - } - - int GetEditStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETEDITSTYLE, 0, 0L); - } - - int SetEditStyle(int nStyle, int nMask = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - if(nMask == -1) - nMask = nStyle; // set everything specified - return (int)::SendMessage(m_hWnd, EM_SETEDITSTYLE, nStyle, nMask); - } - - BOOL SetFontSize(int nFontSizeDelta) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nFontSizeDelta >= -1637 && nFontSizeDelta <= 1638); - return (BOOL)::SendMessage(m_hWnd, EM_SETFONTSIZE, nFontSizeDelta, 0L); - } - - void GetScrollPos(LPPOINT lpPoint) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpPoint != NULL); - ::SendMessage(m_hWnd, EM_GETSCROLLPOS, 0, (LPARAM)lpPoint); - } - - void SetScrollPos(LPPOINT lpPoint) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpPoint != NULL); - ::SendMessage(m_hWnd, EM_SETSCROLLPOS, 0, (LPARAM)lpPoint); - } - - BOOL GetZoom(int& nNum, int& nDen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); - } - - BOOL SetZoom(int nNum, int nDen) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nNum >= 0 && nNum <= 64); - ATLASSERT(nDen >= 0 && nDen <= 64); - return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, nNum, nDen); - } - - BOOL SetZoomOff() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, 0, 0L); - } -#endif // (_RICHEDIT_VER >= 0x0300) - -// Operations - void LimitText(LONG nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EXLIMITTEXT, 0, nChars); - } - - int LineFromChar(LONG nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex); - } - - POINT PosFromChar(LONG nChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - POINT point = { 0, 0 }; - ::SendMessage(m_hWnd, EM_POSFROMCHAR, (WPARAM)&point, nChar); - return point; - } - - int CharFromPos(POINT pt) const - { - ATLASSERT(::IsWindow(m_hWnd)); - POINTL ptl = { pt.x, pt.y }; - return (int)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, (LPARAM)&ptl); - } - - void EmptyUndoBuffer() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); - } - - int LineIndex(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); - } - - int LineLength(int nLine = -1) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); - } - - BOOL LineScroll(int nLines, int nChars = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); - } - - void SetRect(LPCRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); - } - - BOOL DisplayBand(LPRECT pDisplayRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_DISPLAYBAND, 0, (LPARAM)pDisplayRect); - } - - LONG FindText(DWORD dwFlags, FINDTEXT& ft) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTW, dwFlags, (LPARAM)&ft); -#else - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXT, dwFlags, (LPARAM)&ft); -#endif - } - - LONG FindText(DWORD dwFlags, FINDTEXTEX& ft) const - { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEXW, dwFlags, (LPARAM)&ft); -#else - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEX, dwFlags, (LPARAM)&ft); -#endif - } - - LONG FormatRange(FORMATRANGE& fr, BOOL bDisplay = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)&fr); - } - - LONG FormatRange(FORMATRANGE* pFormatRange, BOOL bDisplay = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)pFormatRange); - } - - void HideSelection(BOOL bHide = TRUE, BOOL bChangeStyle = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_HIDESELECTION, bHide, bChangeStyle); - } - - void PasteSpecial(UINT uClipFormat, DWORD dwAspect = 0, HMETAFILE hMF = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - REPASTESPECIAL reps = { dwAspect, (DWORD_PTR)hMF }; - ::SendMessage(m_hWnd, EM_PASTESPECIAL, uClipFormat, (LPARAM)&reps); - } - - void RequestResize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REQUESTRESIZE, 0, 0L); - } - - LONG StreamIn(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, uFormat, (LPARAM)&es); - } - - LONG StreamOut(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, uFormat, (LPARAM)&es); - } - - DWORD FindWordBreak(int nCode, LONG nStartChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_FINDWORDBREAK, nCode, nStartChar); - } - - // Additional operations - void ScrollCaret() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); - } - - int InsertText(long nInsertAfterChar, LPCTSTR lpstrText, BOOL bCanUndo = FALSE) - { - int nRet = SetSel(nInsertAfterChar, nInsertAfterChar); - ReplaceSel(lpstrText, bCanUndo); - return nRet; - } - - int AppendText(LPCTSTR lpstrText, BOOL bCanUndo = FALSE) - { - return InsertText(GetWindowTextLength(), lpstrText, bCanUndo); - } - - // Clipboard operations - BOOL Undo() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); - } - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } - - // OLE support - IRichEditOle* GetOleInterface() const - { - ATLASSERT(::IsWindow(m_hWnd)); - IRichEditOle *pRichEditOle = NULL; - ::SendMessage(m_hWnd, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle); - return pRichEditOle; - } - - BOOL SetOleCallback(IRichEditOleCallback* pCallback) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETOLECALLBACK, 0, (LPARAM)pCallback); - } - -#if (_RICHEDIT_VER >= 0x0200) - BOOL Redo() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_REDO, 0, 0L); - } - - void StopGroupTyping() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_STOPGROUPTYPING, 0, 0L); - } - - void ShowScrollBar(int nBarType, BOOL bVisible = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SHOWSCROLLBAR, nBarType, bVisible); - } -#endif // (_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0300) - BOOL SetTabStops(int nTabStops, LPINT rgTabStops) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); - } - - BOOL SetTabStops() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); - } - - BOOL SetTabStops(const int& cxEachStop) // takes an 'int' - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); - } -#endif // (_RICHEDIT_VER >= 0x0300) -}; - -typedef CRichEditCtrlT CRichEditCtrl; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditCommands - message handlers for standard EDIT commands - -#ifndef _WIN32_WCE - -// Chain to CRichEditCommands message map. Your class must also derive from CRichEditCtrl. -// Example: -// class CMyRichEdit : public CWindowImpl, -// public CRichEditCommands -// { -// public: -// BEGIN_MSG_MAP(CMyRichEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CRichEditCommands, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CRichEditCommands : public CEditCommands< T > -{ -public: - BEGIN_MSG_MAP(CRichEditCommands< T >) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR, CEditCommands< T >::OnEditClear) - COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, CEditCommands< T >::OnEditClearAll) - COMMAND_ID_HANDLER(ID_EDIT_COPY, CEditCommands< T >::OnEditCopy) - COMMAND_ID_HANDLER(ID_EDIT_CUT, CEditCommands< T >::OnEditCut) - COMMAND_ID_HANDLER(ID_EDIT_PASTE, CEditCommands< T >::OnEditPaste) - COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, CEditCommands< T >::OnEditSelectAll) - COMMAND_ID_HANDLER(ID_EDIT_UNDO, CEditCommands< T >::OnEditUndo) -#if (_RICHEDIT_VER >= 0x0200) - COMMAND_ID_HANDLER(ID_EDIT_REDO, OnEditRedo) -#endif // (_RICHEDIT_VER >= 0x0200) - END_MSG_MAP() - -#if (_RICHEDIT_VER >= 0x0200) - LRESULT OnEditRedo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Redo(); - return 0; - } -#endif // (_RICHEDIT_VER >= 0x0200) - -// State (update UI) helpers - BOOL CanCut() const - { return HasSelection(); } - - BOOL CanCopy() const - { return HasSelection(); } - - BOOL CanClear() const - { return HasSelection(); } - -// Implementation - BOOL HasSelection() const - { - const T* pT = static_cast(this); - return (pT->GetSelectionType() != SEL_EMPTY); - } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CDragListBox - -#ifndef _WIN32_WCE - -template -class CDragListBoxT : public CListBoxT< TBase > -{ -public: -// Constructors - CDragListBoxT(HWND hWnd = NULL) : CListBoxT< TBase >(hWnd) - { } - - CDragListBoxT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - if(hWnd != NULL) - MakeDragList(); - return hWnd; - } - -// Operations - BOOL MakeDragList() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return ::MakeDragList(m_hWnd); - } - - int LBItemFromPt(POINT pt, BOOL bAutoScroll = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::LBItemFromPt(m_hWnd, pt, bAutoScroll); - } - - void DrawInsert(int nItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::DrawInsert(GetParent(), m_hWnd, nItem); - } - - static UINT GetDragListMessage() - { - static UINT uDragListMessage = 0; - if(uDragListMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDragListBox::GetDragListMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uDragListMessage == 0) - uDragListMessage = ::RegisterWindowMessage(DRAGLISTMSGSTRING); - - lock.Unlock(); - } - ATLASSERT(uDragListMessage != 0); - return uDragListMessage; - } -}; - -typedef CDragListBoxT CDragListBox; - -template -class CDragListNotifyImpl -{ -public: - BEGIN_MSG_MAP(CDragListNotifyImpl< T >) - MESSAGE_HANDLER(CDragListBox::GetDragListMessage(), OnDragListNotify) - END_MSG_MAP() - - LRESULT OnDragListNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - uMsg; // avoid level 4 warning - ATLASSERT(uMsg == CDragListBox::GetDragListMessage()); - T* pT = static_cast(this); - LPDRAGLISTINFO lpDragListInfo = (LPDRAGLISTINFO)lParam; - LRESULT lRet = 0; - switch(lpDragListInfo->uNotification) - { - case DL_BEGINDRAG: - lRet = (LPARAM)pT->OnBeginDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - case DL_CANCELDRAG: - pT->OnCancelDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - case DL_DRAGGING: - lRet = (LPARAM)pT->OnDragging((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - case DL_DROPPED: - pT->OnDropped((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown DragListBox notification\n")); - bHandled = FALSE; // don't handle it - break; - } - return lRet; - } - -// Overrideables - BOOL OnBeginDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - return TRUE; // allow dragging - } - - void OnCancelDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - // nothing to do - } - - int OnDragging(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - return 0; // don't change cursor - } - - void OnDropped(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) - { - // nothing to do - } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CReBarCtrl - -template -class CReBarCtrlT : public TBase -{ -public: -// Constructors - CReBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CReBarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return REBARCLASSNAME; - } - - UINT GetBandCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETBANDCOUNT, 0, 0L); - } - - BOOL GetBandInfo(int nBand, LPREBARBANDINFO lprbbi) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi); - } - - BOOL SetBandInfo(int nBand, LPREBARBANDINFO lprbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi); - } - - BOOL GetBarInfo(LPREBARINFO lprbi) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)lprbi); - } - - BOOL SetBarInfo(LPREBARINFO lprbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)lprbi); - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - REBARINFO rbi = { 0 }; - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = RBIM_IMAGELIST; - if( (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)&rbi) == FALSE ) return CImageList(); - return CImageList(rbi.himl); - } - - BOOL SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - REBARINFO rbi = { 0 }; - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = RBIM_IMAGELIST; - rbi.himl = hImageList; - return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)&rbi); - } - - UINT GetRowCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETROWCOUNT, 0, 0L); - } - - UINT GetRowHeight(int nBand) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETROWHEIGHT, nBand, 0L); - } - -#if (_WIN32_IE >= 0x0400) - COLORREF GetTextColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_GETTEXTCOLOR, 0, 0L); - } - - COLORREF SetTextColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_GETBKCOLOR, 0, 0L); - } - - COLORREF SetBkColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); - } - - UINT GetBarHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETBARHEIGHT, 0, 0L); - } - - BOOL GetRect(int nBand, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETRECT, nBand, (LPARAM)lpRect); - } - -#ifndef _WIN32_WCE - CToolTipCtrl GetToolTips() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, RB_GETTOOLTIPS, 0, 0L)); - } - - void SetToolTips(HWND hwndToolTip) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L); - } -#endif // !_WIN32_WCE - - void GetBandBorders(int nBand, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpRect != NULL); - ::SendMessage(m_hWnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect); - } - -#ifndef _WIN32_WCE - BOOL GetColorScheme(LPCOLORSCHEME lpColorScheme) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpColorScheme != NULL); - return (BOOL)::SendMessage(m_hWnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme); - } - - void SetColorScheme(LPCOLORSCHEME lpColorScheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpColorScheme != NULL); - ::SendMessage(m_hWnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme); - } - - HPALETTE GetPalette() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPALETTE)::SendMessage(m_hWnd, RB_GETPALETTE, 0, 0L); - } - - HPALETTE SetPalette(HPALETTE hPalette) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPALETTE)::SendMessage(m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPalette); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0501) - // requires uxtheme.h to be included to use MARGINS struct -#ifndef _UXTHEME_H_ - typedef struct _MARGINS* PMARGINS; -#endif // !_UXTHEME_H_ - void GetBandMargins(PMARGINS pMargins) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins); - } - - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -#if (_WIN32_IE >= 0x0600) - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, RB_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle); - } -#endif // (_WIN32_IE >= 0x0600) - -// Operations - BOOL InsertBand(int nBand, LPREBARBANDINFO lprbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_INSERTBAND, nBand, (LPARAM)lprbbi); - } - - BOOL AddBand(LPREBARBANDINFO lprbbi) - { - return InsertBand(-1, lprbbi); - } - - BOOL DeleteBand(int nBand) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_DELETEBAND, nBand, 0L); - } - - ATL::CWindow SetNotifyWnd(HWND hWnd) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, RB_SETPARENT, (WPARAM)hWnd, 0L)); - } - -#if (_WIN32_IE >= 0x0400) - void BeginDrag(int nBand, DWORD dwPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, dwPos); - } - - void BeginDrag(int nBand, int xPos, int yPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos)); - } - - void EndDrag() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_ENDDRAG, 0, 0L); - } - - void DragMove(DWORD dwPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, dwPos); - } - - void DragMove(int xPos, int yPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos)); - } - -#ifndef _WIN32_WCE - void GetDropTarget(IDropTarget** ppDropTarget) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget); - } -#endif // !_WIN32_WCE - - void MaximizeBand(int nBand, BOOL bIdeal = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_MAXIMIZEBAND, nBand, bIdeal); - } - - void MinimizeBand(int nBand) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_MINIMIZEBAND, nBand, 0L); - } - - BOOL SizeToRect(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SIZETORECT, 0, (LPARAM)lpRect); - } - - int IdToIndex(UINT uBandID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, RB_IDTOINDEX, uBandID, 0L); - } - - int HitTest(LPRBHITTESTINFO lprbht) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, RB_HITTEST, 0, (LPARAM)lprbht); - } - - BOOL ShowBand(int nBand, BOOL bShow) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SHOWBAND, nBand, bShow); - } - -#ifndef _WIN32_WCE - BOOL MoveBand(int nBand, int nNewPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nNewPos >= 0 && nNewPos <= ((int)GetBandCount() - 1)); - return (BOOL)::SendMessage(m_hWnd, RB_MOVEBAND, nBand, nNewPos); - } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - void PushChevron(int nBand, LPARAM lAppValue) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_PUSHCHEVRON, nBand, lAppValue); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Extra operations -#if (_WIN32_IE >= 0x0400) - void LockBands(bool bLock) - { - int nBandCount = GetBandCount(); - for(int i =0; i < nBandCount; i++) - { - REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; - rbbi.fMask = RBBIM_STYLE; - BOOL bRet = GetBandInfo(i, &rbbi); - ATLASSERT(bRet); - - if((rbbi.fStyle & RBBS_GRIPPERALWAYS) == 0) - { - rbbi.fStyle |= RBBS_GRIPPERALWAYS; - bRet = SetBandInfo(i, &rbbi); - ATLASSERT(bRet); - rbbi.fStyle &= ~RBBS_GRIPPERALWAYS; - } - - if(bLock) - rbbi.fStyle |= RBBS_NOGRIPPER; - else - rbbi.fStyle &= ~RBBS_NOGRIPPER; - - bRet = SetBandInfo(i, &rbbi); - ATLASSERT(bRet); - } - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0600) - BOOL SetBandWidth(int nBand, int cxWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBANDWIDTH, nBand, cxWidth); - } -#endif // (_WIN32_WINNT >= 0x0600) -}; - -typedef CReBarCtrlT CReBarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CComboBoxEx - -#ifndef _WIN32_WCE - -template -class CComboBoxExT : public CComboBoxT< TBase > -{ -public: -// Constructors - CComboBoxExT(HWND hWnd = NULL) : CComboBoxT< TBase >(hWnd) - { } - - CComboBoxExT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_COMBOBOXEX; - } - - CImageList GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_GETIMAGELIST, 0, 0L)); - } - - CImageList SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)hImageList)); - } - -#if (_WIN32_IE >= 0x0400) - DWORD GetExtendedStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0L); - } - - DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CBEM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); - } - - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_WINNT >= 0x0501) - void SetWindowTheme(LPCWSTR lpstrTheme) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CBEM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); - } -#endif // (_WIN32_WINNT >= 0x0501) - -// Operations - int InsertItem(const COMBOBOXEXITEM* lpcCBItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem); - } - - int InsertItem(UINT nMask, int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, - int iIndent, int iOverlay, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = nMask; - cbex.iItem = nIndex; - cbex.pszText = (LPTSTR) lpszItem; - cbex.iImage = nImage; - cbex.iSelectedImage = nSelImage; - cbex.iIndent = iIndent; - cbex.iOverlay = iOverlay; - cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); - } - - int InsertItem(int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_INDENT | CBEIF_LPARAM; - cbex.iItem = nIndex; - cbex.pszText = (LPTSTR) lpszItem; - cbex.iImage = nImage; - cbex.iSelectedImage = nSelImage; - cbex.iIndent = iIndent; - cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); - } - - int AddItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) - { - return InsertItem(nMask, -1, lpszItem, nImage, nSelImage, iIndent, iOverlay, lParam); - } - - int AddItem(LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) - { - return InsertItem(-1, lpszItem, nImage, nSelImage, iIndent, lParam); - } - - int DeleteItem(int nIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CBEM_DELETEITEM, nIndex, 0L); - } - - BOOL GetItem(PCOMBOBOXEXITEM pCBItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)pCBItem); - } - - BOOL SetItem(const COMBOBOXEXITEM* lpcCBItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)lpcCBItem); - } - - int SetItem(int nIndex, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, - int iIndent, int iOverlay, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = nMask; - cbex.iItem = nIndex; - cbex.pszText = (LPTSTR) lpszItem; - cbex.iImage = nImage; - cbex.iSelectedImage = nSelImage; - cbex.iIndent = iIndent; - cbex.iOverlay = iOverlay; - cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)&cbex); - } - - BOOL GetItemText(int nIndex, LPTSTR lpszItem, int nLen) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpszItem != NULL); - - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT; - cbex.iItem = nIndex; - cbex.pszText = lpszItem; - cbex.cchTextMax = nLen; - - return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - } - -#ifndef _ATL_NO_COM - BOOL GetItemText(int nIndex, BSTR& bstrText) const - { - USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(bstrText == NULL); - - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT; - cbex.iItem = nIndex; - - LPTSTR lpstrText = NULL; - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - lpstrText[0] = NULL; - cbex.pszText = lpstrText; - cbex.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(bRet) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetItemText(int nIndex, _CSTRING_NS::CString& strText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - - COMBOBOXEXITEM cbex = { 0 }; - cbex.mask = CBEIF_TEXT; - cbex.iItem = nIndex; - - strText.Empty(); - BOOL bRet = FALSE; - for(int nLen = 256; ; nLen *= 2) - { - cbex.pszText = strText.GetBufferSetLength(nLen); - if(cbex.pszText == NULL) - { - bRet = FALSE; - break; - } - cbex.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) - break; - } - strText.ReleaseBuffer(); - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL SetItemText(int nIndex, LPCTSTR lpszItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return SetItem(nIndex, CBEIF_TEXT, lpszItem, 0, 0, 0, 0, 0); - } - - CComboBox GetComboCtrl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CComboBox((HWND)::SendMessage(m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0L)); - } - - CEdit GetEditCtrl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, CBEM_GETEDITCONTROL, 0, 0L)); - } - - BOOL HasEditChanged() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_HASEDITCHANGED, 0, 0L); - } - -// Non-functional - int AddString(LPCTSTR /*lpszItem*/) - { - ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem - return 0; - } - - int InsertString(int /*nIndex*/, LPCTSTR /*lpszString*/) - { - ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem - return 0; - } - - int Dir(UINT /*attr*/, LPCTSTR /*lpszWildCard*/) - { - ATLASSERT(FALSE); // Not available in CComboBoxEx - return 0; - } - - int FindString(int /*nStartAfter*/, LPCTSTR /*lpszString*/) const - { - ATLASSERT(FALSE); // Not available in CComboBoxEx; try FindStringExact - return 0; - } -}; - -typedef CComboBoxExT CComboBoxEx; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMonthCalendarCtrl - -template -class CMonthCalendarCtrlT : public TBase -{ -public: -// Constructors - CMonthCalendarCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CMonthCalendarCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return MONTHCAL_CLASS; - } - - COLORREF GetColor(int nColorType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, MCM_GETCOLOR, nColorType, 0L); - } - - COLORREF SetColor(int nColorType, COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, MCM_SETCOLOR, nColorType, clr); - } - - BOOL GetCurSel(LPSYSTEMTIME lpSysTime) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM)lpSysTime); - } - - BOOL SetCurSel(LPSYSTEMTIME lpSysTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM)lpSysTime); - } - - int GetFirstDayOfWeek(BOOL* pbLocaleVal = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0L); - if(pbLocaleVal != NULL) - *pbLocaleVal = (BOOL)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - int SetFirstDayOfWeek(int nDay, BOOL* pbLocaleVal = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, nDay); - if(pbLocaleVal != NULL) - *pbLocaleVal = (BOOL)HIWORD(dwRet); - return (int)(short)LOWORD(dwRet); - } - - int GetMaxSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMAXSELCOUNT, 0, 0L); - } - - BOOL SetMaxSelCount(int nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0L); - } - - int GetMonthDelta() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMONTHDELTA, 0, 0L); - } - - int SetMonthDelta(int nDelta) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_SETMONTHDELTA, nDelta, 0L); - } - - DWORD GetRange(LPSYSTEMTIME lprgSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM)lprgSysTimeArray); - } - - BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETRANGE, dwFlags, (LPARAM)lprgSysTimeArray); - } - - BOOL GetSelRange(LPSYSTEMTIME lprgSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM)lprgSysTimeArray); - } - - BOOL SetSelRange(LPSYSTEMTIME lprgSysTimeArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)lprgSysTimeArray); - } - - BOOL GetToday(LPSYSTEMTIME lpSysTime) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM)lpSysTime); - } - - void SetToday(LPSYSTEMTIME lpSysTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETTODAY, 0, (LPARAM)lpSysTime); - } - - BOOL GetMinReqRect(LPRECT lpRectInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM)lpRectInfo); - } - - int GetMaxTodayWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMAXTODAYWIDTH, 0, 0L); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetUnicodeFormat() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETUNICODEFORMAT, 0, 0L); - } - - BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETUNICODEFORMAT, bUnicode, 0L); - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - DWORD GetCurrentView() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETCURRENTVIEW, 0, 0L); - } - - BOOL SetCurrentView(DWORD dwView) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETCURRENTVIEW, 0, dwView); - } - - DWORD GetCalendarCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETCALENDARCOUNT, 0, 0L); - } - - BOOL GetCalendarGridInfo(PMCGRIDINFO pGridInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM)pGridInfo); - } - - CALID GetCALID() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (CALID)::SendMessage(m_hWnd, MCM_GETCALID, 0, 0L); - } - - void SetCALID(CALID calid) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETCALID, (LPARAM)calid, 0L); - } - - int GetCalendarBorder() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETCALENDARBORDER, 0, 0L); - } - - void SetCalendarBorder(int cxyBorder, BOOL bSet = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETCALENDARBORDER, (WPARAM)bSet, (LPARAM)cxyBorder); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - -// Operations - int GetMonthRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMONTHRANGE, dwFlags, (LPARAM)lprgSysTimeArray); - } - - BOOL SetDayState(int nMonths, LPMONTHDAYSTATE lpDayStateArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETDAYSTATE, nMonths, (LPARAM)lpDayStateArray); - } - - DWORD HitTest(PMCHITTESTINFO pMCHitTest) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_HITTEST, 0, (LPARAM)pMCHitTest); - } - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - void SizeRectToMin(LPRECT lpRect) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SIZERECTTOMIN, 0, (LPARAM)lpRect); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -}; - -typedef CMonthCalendarCtrlT CMonthCalendarCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CDateTimePickerCtrl - -template -class CDateTimePickerCtrlT : public TBase -{ -public: -// Constructors - CDateTimePickerCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CDateTimePickerCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Operations - static LPCTSTR GetWndClassName() - { - return DATETIMEPICK_CLASS; - } - - BOOL SetFormat(LPCTSTR lpszFormat) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)lpszFormat); - } - - COLORREF GetMonthCalColor(int nColorType) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, DTM_GETMCCOLOR, nColorType, 0L); - } - - COLORREF SetMonthCalColor(int nColorType, COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, DTM_SETMCCOLOR, nColorType, clr); - } - - DWORD GetRange(LPSYSTEMTIME lpSysTimeArray) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM)lpSysTimeArray); - } - - BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lpSysTimeArray) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETRANGE, dwFlags, (LPARAM)lpSysTimeArray); - } - - DWORD GetSystemTime(LPSYSTEMTIME lpSysTime) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)lpSysTime); - } - - BOOL SetSystemTime(DWORD dwFlags, LPSYSTEMTIME lpSysTime) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, dwFlags, (LPARAM)lpSysTime); - } - - CMonthCalendarCtrl GetMonthCal() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CMonthCalendarCtrl((HWND)::SendMessage(m_hWnd, DTM_GETMONTHCAL, 0, 0L)); - } - -#if (_WIN32_IE >= 0x0400) - CFontHandle GetMonthCalFont() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CFontHandle((HFONT)::SendMessage(m_hWnd, DTM_GETMCFONT, 0, 0L)); - } - - void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_SETMCFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); - } -#endif // (_WIN32_IE >= 0x0400) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - DWORD GetMonthCalStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETMCSTYLE, 0, 0L); - } - - DWORD SetMonthCalStyle(DWORD dwStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); - } - - void GetDateTimePickerInfo(LPDATETIMEPICKERINFO lpPickerInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_GETDATETIMEPICKERINFO, 0, (LPARAM)lpPickerInfo); - } - - BOOL GetIdealSize(LPSIZE lpSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)lpSize); - } - - void CloseMonthCal() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_CLOSEMONTHCAL, 0, 0L); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -}; - -typedef CDateTimePickerCtrlT CDateTimePickerCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CFlatScrollBarImpl - support for flat scroll bars - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -template -class CFlatScrollBarImpl -{ -public: -// Initialization - BOOL FlatSB_Initialize() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::InitializeFlatSB(pT->m_hWnd); - } - - HRESULT FlatSB_Uninitialize() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::UninitializeFlatSB(pT->m_hWnd); - } - -// Flat scroll bar properties - BOOL FlatSB_GetScrollProp(UINT uIndex, LPINT lpnValue) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollProp(pT->m_hWnd, uIndex, lpnValue); - } - - BOOL FlatSB_SetScrollProp(UINT uIndex, int nValue, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollProp(pT->m_hWnd, uIndex, nValue, bRedraw); - } - -// Attributes - int FlatSB_GetScrollPos(int nBar) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollPos(pT->m_hWnd, nBar); - } - - int FlatSB_SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollPos(pT->m_hWnd, nBar, nPos, bRedraw); - } - - BOOL FlatSB_GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollRange(pT->m_hWnd, nBar, lpMinPos, lpMaxPos); - } - - BOOL FlatSB_SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollRange(pT->m_hWnd, nBar, nMinPos, nMaxPos, bRedraw); - } - - BOOL FlatSB_GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_GetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo); - } - - int FlatSB_SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_SetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo, bRedraw); - } - -// Operations - BOOL FlatSB_ShowScrollBar(UINT nBar, BOOL bShow = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_ShowScrollBar(pT->m_hWnd, nBar, bShow); - } - - BOOL FlatSB_EnableScrollBar(UINT uSBFlags, UINT uArrowFlags = ESB_ENABLE_BOTH) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::FlatSB_EnableScrollBar(pT->m_hWnd, uSBFlags, uArrowFlags); - } -}; - -template -class CFlatScrollBarT : public TBase, public CFlatScrollBarImpl > -{ -public: - CFlatScrollBarT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CFlatScrollBarT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } -}; - -typedef CFlatScrollBarT CFlatScrollBar; - -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CIPAddressCtrl - -#if (_WIN32_IE >= 0x0400) - -template -class CIPAddressCtrlT : public TBase -{ -public: -// Constructors - CIPAddressCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CIPAddressCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Atteributes - static LPCTSTR GetWndClassName() - { - return WC_IPADDRESS; - } - - BOOL IsBlank() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IPM_ISBLANK, 0, 0L); - } - - int GetAddress(LPDWORD lpdwAddress) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, IPM_GETADDRESS, 0, (LPARAM)lpdwAddress); - } - - void SetAddress(DWORD dwAddress) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETADDRESS, 0, dwAddress); - } - - void ClearAddress() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_CLEARADDRESS, 0, 0L); - } - - void SetRange(int nField, WORD wRange) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETRANGE, nField, wRange); - } - - void SetRange(int nField, BYTE nMin, BYTE nMax) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETRANGE, nField, MAKEIPRANGE(nMin, nMax)); - } - - void SetFocus(int nField) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETFOCUS, nField, 0L); - } -}; - -typedef CIPAddressCtrlT CIPAddressCtrl; - -#endif // (_WIN32_IE >= 0x0400) - - -/////////////////////////////////////////////////////////////////////////////// -// CPagerCtrl - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -template -class CPagerCtrlT : public TBase -{ -public: -// Constructors - CPagerCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CPagerCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_PAGESCROLLER; - } - - int GetButtonSize() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETBUTTONSIZE, 0, 0L); - } - - int SetButtonSize(int nButtonSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETBUTTONSIZE, 0, nButtonSize); - } - - DWORD GetButtonState(int nButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nButton == PGB_TOPORLEFT || nButton == PGB_BOTTOMORRIGHT); - return (DWORD)::SendMessage(m_hWnd, PGM_GETBUTTONSTATE, 0, nButton); - } - - COLORREF GetBkColor() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PGM_GETBKCOLOR, 0, 0L); - } - - COLORREF SetBkColor(COLORREF clrBk) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PGM_SETBKCOLOR, 0, (LPARAM)clrBk); - } - - int GetBorder() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETBORDER, 0, 0L); - } - - int SetBorder(int nBorderSize) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETBORDER, 0, nBorderSize); - } - - int GetPos() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETPOS, 0, 0L); - } - - int SetPos(int nPos) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETPOS, 0, nPos); - } - -// Operations - void SetChild(HWND hWndChild) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_SETCHILD, 0, (LPARAM)hWndChild); - } - - void ForwardMouse(BOOL bForward = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_FORWARDMOUSE, bForward, 0L); - } - - void RecalcSize() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_RECALCSIZE, 0, 0L); - } - - void GetDropTarget(IDropTarget** ppDropTarget) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDropTarget != NULL); - ::SendMessage(m_hWnd, PGM_GETDROPTARGET, 0, (LPARAM)ppDropTarget); - } -}; - -typedef CPagerCtrlT CPagerCtrl; - -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CLinkCtrl - Windows SYSLINK control - -#if (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) - -template -class CLinkCtrlT : public TBase -{ -public: -// Constructors - CLinkCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CLinkCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - } - -// Attributes - static LPCTSTR GetWndClassName() - { -#ifdef _UNICODE - return WC_LINK; -#else // !_UNICODE - return "SysLink"; -#endif // !_UNICODE - } - - int GetIdealHeight(int cxMaxWidth = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); - } - - BOOL GetItem(PLITEM pLItem) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); - } - - BOOL SetItem(PLITEM pLItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); - } - - // Vista only - int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const - { -#ifndef LM_GETIDEALSIZE - const UINT LM_GETIDEALSIZE = LM_GETIDEALHEIGHT; -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); - } - -// Operations - BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); - } -}; - -typedef CLinkCtrlT CLinkCtrl; - -#endif // (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CCustomDraw - MI class for custom-draw support - -template -class CCustomDraw -{ -public: -#if (_ATL_VER < 0x0700) - BOOL m_bHandledCD; - - BOOL IsMsgHandled() const - { - return m_bHandledCD; - } - - void SetMsgHandled(BOOL bHandled) - { - m_bHandledCD = bHandled; - } -#endif // !(_ATL_VER < 0x0700) - -// Message map and handlers - BEGIN_MSG_MAP(CCustomDraw< T >) - NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) - ALT_MSG_MAP(1) - REFLECTED_NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) - END_MSG_MAP() - -// message handler - LRESULT OnCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - LPNMCUSTOMDRAW lpNMCustomDraw = (LPNMCUSTOMDRAW)pnmh; - DWORD dwRet = 0; - switch(lpNMCustomDraw->dwDrawStage) - { - case CDDS_PREPAINT: - dwRet = pT->OnPrePaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_POSTPAINT: - dwRet = pT->OnPostPaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_PREERASE: - dwRet = pT->OnPreErase(idCtrl, lpNMCustomDraw); - break; - case CDDS_POSTERASE: - dwRet = pT->OnPostErase(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPREPAINT: - dwRet = pT->OnItemPrePaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPOSTPAINT: - dwRet = pT->OnItemPostPaint(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPREERASE: - dwRet = pT->OnItemPreErase(idCtrl, lpNMCustomDraw); - break; - case CDDS_ITEMPOSTERASE: - dwRet = pT->OnItemPostErase(idCtrl, lpNMCustomDraw); - break; -#if (_WIN32_IE >= 0x0400) - case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): - dwRet = pT->OnSubItemPrePaint(idCtrl, lpNMCustomDraw); - break; -#endif // (_WIN32_IE >= 0x0400) - default: - pT->SetMsgHandled(FALSE); - break; - } - bHandled = pT->IsMsgHandled(); - return dwRet; - } - -// Overrideables - DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - - DWORD OnItemPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } - -#if (_WIN32_IE >= 0x0400) - DWORD OnSubItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_DODEFAULT; - } -#endif // (_WIN32_IE >= 0x0400) -}; - - -// --- Windows CE common controls --- - -#ifdef _WIN32_WCE - -/////////////////////////////////////////////////////////////////////////////// -// CCECommandBarCtrl - -template -class CCECommandBarCtrlT : public TBase -{ -public: -// Constructors - CCECommandBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } - - CCECommandBarCtrlT< TBase >& operator=(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - BOOL IsVisible() const - { - return IsWindowVisible(); - } - - int GetHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_Height(m_hWnd); - } - - HMENU GetMenu(WORD wButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_GetMenu(m_hWnd, wButton); - } - -// Operations - HWND Create(HWND hWndParent, int nCmdBarID) - { - m_hWnd = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), hWndParent, nCmdBarID); - ATLASSERT(::IsWindow(m_hWnd)); - return m_hWnd; - } - - void Destroy() - { - DestroyWindow(); - } - - BOOL Show(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_Show(m_hWnd, bShow); - } - - BOOL DrawMenuBar(WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_DrawMenuBar(m_hWnd, wButton); - } - - BOOL AddAdornments(DWORD dwFlags = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_AddAdornments(m_hWnd, dwFlags, 0); - } - - int AddBitmap(int nBitmapID, int nNumImages) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_AddBitmap(m_hWnd, ModuleHelper::GetResourceInstance(), nBitmapID, nNumImages, 16, 16); - } - - BOOL AddButtons(UINT uNumButtons, LPTBBUTTON lpButtons) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_AddButtons(m_hWnd, uNumButtons, lpButtons); - } - - BOOL AddToolTips(UINT uNumToolTips, LPTSTR lpToolTips) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_AddToolTips(m_hWnd, uNumToolTips, lpToolTips); - } - - BOOL InsertButton(int nButton, LPTBBUTTON lpButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_InsertButton(m_hWnd, nButton, lpButton); - } - - HWND InsertComboBox(int nWidth, UINT dwStyle, WORD wComboBoxID, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertComboBox(m_hWnd, ModuleHelper::GetModuleInstance(), nWidth, dwStyle, wComboBoxID, wButton); - } - - BOOL InsertMenubar(WORD wMenuID, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertMenubar(m_hWnd, ModuleHelper::GetResourceInstance(), wMenuID, wButton); - } - - BOOL InsertMenubarEx(ATL::_U_STRINGorID menu, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertMenubarEx(m_hWnd, ModuleHelper::GetResourceInstance(), (LPTSTR)menu.m_lpstr, wButton); - } - - BOOL IsCommandBarMessage(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::IsCommandBarMessage(m_hWnd, lpMsg); - } -}; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC MenuBar - typedef CCECommandBarCtrlT CMenuBarCtrl; -#else - typedef CCECommandBarCtrlT CCECommandBarCtrl; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -/////////////////////////////////////////////////////////////////////////////// -// CCECommandBandsCtrl - -template -class CCECommandBandsCtrlT : public TBase -{ -public: -// Constructors - CCECommandBandsCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } - - CCECommandBandsCtrlT< TBase >& operator=(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - BOOL IsVisible() const - { - return IsWindowVisible(); - } - -#if (_WIN32_IE >= 0x0400) - UINT GetHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBands_Height(m_hWnd); - } -#endif // (_WIN32_IE >= 0x0400) - - HWND GetCommandBar(UINT uBand) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_GetCommandBar(m_hWnd, uBand); - } - - BOOL GetRestoreInformation(UINT uBand, LPCOMMANDBANDSRESTOREINFO pcbr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_GetRestoreInformation(m_hWnd, uBand, pcbr); - } - -// Operations - HWND Create(HWND hWndParent, UINT wID, DWORD dwStyles, HIMAGELIST hImageList = NULL) - { - m_hWnd = ::CommandBands_Create(ModuleHelper::GetModuleInstance(), hWndParent, wID, dwStyles, hImageList); - ATLASSERT(::IsWindow(m_hWnd)); - return m_hWnd; - } - - BOOL AddAdornments(DWORD dwFlags = 0, LPREBARBANDINFO prbbi = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_AddAdornments(m_hWnd, ModuleHelper::GetModuleInstance(), dwFlags, prbbi); - } - - BOOL AddBands(UINT uBandCount, LPREBARBANDINFO prbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_AddBands(m_hWnd, ModuleHelper::GetModuleInstance(), uBandCount, prbbi); - } - - BOOL Show(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_Show(m_hWnd, bShow); - } -}; - -typedef CCECommandBandsCtrlT CCECommandBandsCtrl; - -#endif // _WIN32_WCE - -}; // namespace WTL - -#endif // __ATLCTRLS_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLCTRLS_H__ +#define __ATLCTRLS_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlctrls.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atlctrls.h requires atlwin.h to be included first +#endif + +#if (_WIN32_IE < 0x0300) + #error atlctrls.h requires IE Version 3.0 or higher +#endif + +#ifndef _WIN32_WCE + #include + #include +#elif defined(WIN32_PLATFORM_WFSP) && !defined(_WINUSERM_H_) + #include +#endif // !_WIN32_WCE + +// protect template members from windowsx.h macros +#ifdef _INC_WINDOWSX + #undef GetNextSibling + #undef GetPrevSibling +#endif // _INC_WINDOWSX + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CStaticT - CStatic +// CButtonT - CButton +// CListBoxT - CListBox +// CComboBoxT - CComboBox +// CEditT - CEdit +// CEditCommands +// CScrollBarT - CScrollBar +// +// CImageList +// CListViewCtrlT - CListViewCtrl +// CTreeViewCtrlT - CTreeViewCtrl +// CTreeItemT - CTreeItem +// CTreeViewCtrlExT - CTreeViewCtrlEx +// CHeaderCtrlT - CHeaderCtrl +// CToolBarCtrlT - CToolBarCtrl +// CStatusBarCtrlT - CStatusBarCtrl +// CTabCtrlT - CTabCtrl +// CToolInfo +// CToolTipCtrlT - CToolTipCtrl +// CTrackBarCtrlT - CTrackBarCtrl +// CUpDownCtrlT - CUpDownCtrl +// CProgressBarCtrlT - CProgressBarCtrl +// CHotKeyCtrlT - CHotKeyCtrl +// CAnimateCtrlT - CAnimateCtrl +// CRichEditCtrlT - CRichEditCtrl +// CRichEditCommands +// CDragListBoxT - CDragListBox +// CDragListNotifyImpl +// CReBarCtrlT - CReBarCtrl +// CComboBoxExT - CComboBoxEx +// CDateTimePickerCtrlT - CDateTimePickerCtrl +// CMonthCalendarCtrlT - CMonthCalendarCtrl +// CFlatScrollBarImpl +// CFlatScrollBarT - CFlatScrollBar +// CIPAddressCtrlT - CIPAddressCtrl +// CPagerCtrlT - CPagerCtrl +// CLinkCtrlT - CLinkCtrl +// +// CCustomDraw +// +// CCECommandBarCtrlT - CCECommandBarCtrl +// CCECommandBandsCtrlT - CCECommandBandsCtrl + + +namespace WTL +{ + +// These are wrapper classes for Windows standard and common controls. +// To implement a window based on a control, use following: +// Example: Implementing a window based on a list box +// +// class CMyListBox : CWindowImpl +// { +// public: +// BEGIN_MSG_MAP(CMyListBox) +// // put your message handler entries here +// END_MSG_MAP() +// }; + + + +// --- Standard Windows controls --- + +/////////////////////////////////////////////////////////////////////////////// +// CStatic - client side for a Windows STATIC control + +template +class CStaticT : public TBase +{ +public: +// Constructors + CStaticT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CStaticT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return _T("STATIC"); + } + +#ifndef _WIN32_WCE + HICON GetIcon() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0L); + } + + HICON SetIcon(HICON hIcon) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); + } + + HENHMETAFILE GetEnhMetaFile() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HENHMETAFILE)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L); + } + + HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HENHMETAFILE)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); + } +#else // CE specific + HICON GetIcon() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HICON)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ICON, 0L); + } + + HICON SetIcon(HICON hIcon) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HICON)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + } +#endif // _WIN32_WCE + + CBitmapHandle GetBitmap() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L)); + } + + CBitmapHandle SetBitmap(HBITMAP hBitmap) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); + } + + HCURSOR GetCursor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HCURSOR)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L); + } + + HCURSOR SetCursor(HCURSOR hCursor) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HCURSOR)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); + } +}; + +typedef CStaticT CStatic; + + +/////////////////////////////////////////////////////////////////////////////// +// CButton - client side for a Windows BUTTON control + +template +class CButtonT : public TBase +{ +public: +// Constructors + CButtonT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CButtonT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return _T("BUTTON"); + } + + UINT GetState() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, BM_GETSTATE, 0, 0L); + } + + void SetState(BOOL bHighlight) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, BM_SETSTATE, bHighlight, 0L); + } + + int GetCheck() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0L); + } + + void SetCheck(int nCheck) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0L); + } + + UINT GetButtonStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::GetWindowLong(m_hWnd, GWL_STYLE) & 0xFFFF; + } + + void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); + } + +#ifndef _WIN32_WCE + HICON GetIcon() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HICON)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L); + } + + HICON SetIcon(HICON hIcon) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HICON)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + } + + CBitmapHandle GetBitmap() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L)); + } + + CBitmapHandle SetBitmap(HBITMAP hBitmap) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); + } +#endif // !_WIN32_WCE + +#if (_WIN32_WINNT >= 0x0501) + BOOL GetIdealSize(LPSIZE lpSize) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize); + } + + BOOL GetImageList(PBUTTON_IMAGELIST pButtonImagelist) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist); + } + + BOOL SetImageList(PBUTTON_IMAGELIST pButtonImagelist) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist); + } + + BOOL GetTextMargin(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect); + } + + BOOL SetTextMargin(LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (WINVER >= 0x0600) + void SetDontClick(BOOL bDontClick) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L); + } +#endif // (WINVER >= 0x0600) + +#if (_WIN32_WINNT >= 0x0600) + BOOL SetDropDownState(BOOL bDropDown) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); + return (BOOL)::SendMessage(m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L); + } + + BOOL GetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); + return (BOOL)::SendMessage(m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo); + } + + BOOL SetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); + return (BOOL)::SendMessage(m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo); + } + + int GetNoteLength() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); + return (int)::SendMessage(m_hWnd, BCM_GETNOTELENGTH, 0, 0L); + } + + BOOL GetNote(LPWSTR lpstrNoteText, int cchNoteText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); + return (BOOL)::SendMessage(m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText); + } + + BOOL SetNote(LPCWSTR lpstrNoteText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); + return (BOOL)::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText); + } + + LRESULT SetElevationRequiredState(BOOL bSet) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::SendMessage(m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet); + } +#endif // (_WIN32_WINNT >= 0x0600) + +// Operations + void Click() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, BM_CLICK, 0, 0L); + } +}; + +typedef CButtonT CButton; + + +/////////////////////////////////////////////////////////////////////////////// +// CListBox - client side for a Windows LISTBOX control + +template +class CListBoxT : public TBase +{ +public: +// Constructors + CListBoxT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CListBoxT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return _T("LISTBOX"); + } + + // for entire listbox + int GetCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0L); + } + +#ifndef _WIN32_WCE + int SetCount(int cItems) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(((GetStyle() & LBS_NODATA) != 0) && ((GetStyle() & LBS_HASSTRINGS) == 0)); + return (int)::SendMessage(m_hWnd, LB_SETCOUNT, cItems, 0L); + } +#endif // !_WIN32_WCE + + int GetHorizontalExtent() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L); + } + + void SetHorizontalExtent(int cxExtent) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L); + } + + int GetTopIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETTOPINDEX, 0, 0L); + } + + int SetTopIndex(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_SETTOPINDEX, nIndex, 0L); + } + + LCID GetLocale() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LCID)::SendMessage(m_hWnd, LB_GETLOCALE, 0, 0L); + } + + LCID SetLocale(LCID nNewLocale) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LCID)::SendMessage(m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L); + } + +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + DWORD GetListBoxInfo() const + { + ATLASSERT(::IsWindow(m_hWnd)); +#if (_WIN32_WINNT >= 0x0501) + return (DWORD)::SendMessage(m_hWnd, LB_GETLISTBOXINFO, 0, 0L); +#else // !(_WIN32_WINNT >= 0x0501) + return ::GetListBoxInfo(m_hWnd); +#endif // !(_WIN32_WINNT >= 0x0501) + } +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) + + // for single-selection listboxes + int GetCurSel() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); + return (int)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0L); + } + + int SetCurSel(int nSelect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); + return (int)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0L); + } + + // for multiple-selection listboxes + int GetSel(int nIndex) const // also works for single-selection + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETSEL, nIndex, 0L); + } + + int SetSel(int nIndex, BOOL bSelect = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(m_hWnd, LB_SETSEL, bSelect, nIndex); + } + + int GetSelCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0L); + } + + int GetSelItems(int nMaxItems, LPINT rgIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); + } + + int GetAnchorIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(m_hWnd, LB_GETANCHORINDEX, 0, 0L); + } + + void SetAnchorIndex(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + ::SendMessage(m_hWnd, LB_SETANCHORINDEX, nIndex, 0L); + } + + int GetCaretIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETCARETINDEX, 0, 0); + } + + int SetCaretIndex(int nIndex, BOOL bScroll = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); + } + + // for listbox items + DWORD_PTR GetItemData(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD_PTR)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); + } + + int SetItemData(int nIndex, DWORD_PTR dwItemData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); + } + + void* GetItemDataPtr(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (void*)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); + } + + int SetItemDataPtr(int nIndex, void* pData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItemData(nIndex, (DWORD_PTR)pData); + } + + int GetItemRect(int nIndex, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); + } + + int GetText(int nIndex, LPTSTR lpszBuffer) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); + } + +#ifndef _ATL_NO_COM +#ifdef _OLEAUTO_H_ + BOOL GetTextBSTR(int nIndex, BSTR& bstrText) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrText == NULL); + + int nLen = GetTextLen(nIndex); + if(nLen == LB_ERR) + return FALSE; + + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(nLen + 1); + if(lpstrText == NULL) + return FALSE; + + if(GetText(nIndex, lpstrText) == LB_ERR) + return FALSE; + + bstrText = ::SysAllocString(T2OLE(lpstrText)); + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // _OLEAUTO_H_ +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetText(int nIndex, _CSTRING_NS::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int cchLen = GetTextLen(nIndex); + if(cchLen == LB_ERR) + return LB_ERR; + int nRet = LB_ERR; + LPTSTR lpstr = strText.GetBufferSetLength(cchLen); + if(lpstr != NULL) + { + nRet = GetText(nIndex, lpstr); + strText.ReleaseBuffer(); + } + return nRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + int GetTextLen(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0L); + } + + int GetItemHeight(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); + } + + int SetItemHeight(int nIndex, UINT cyItemHeight) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); + } + + // Settable only attributes + void SetColumnWidth(int cxWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); + } + + BOOL SetTabStops(int nTabStops, LPINT rgTabStops) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); + return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); + } + + BOOL SetTabStops() + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); + return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 0, 0L); + } + + BOOL SetTabStops(const int& cxEachStop) // takes an 'int' + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); + return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + } + +// Operations + int InitStorage(int nItems, UINT nBytes) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes); + } + + void ResetContent() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LB_RESETCONTENT, 0, 0L); + } + + UINT ItemFromPoint(POINT pt, BOOL& bOutside) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dw = (DWORD)::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); + bOutside = (BOOL)HIWORD(dw); + return (UINT)LOWORD(dw); + } + + // manipulating listbox items + int AddString(LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); + } + + int DeleteString(UINT nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_DELETESTRING, nIndex, 0L); + } + + int InsertString(int nIndex, LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); + } + +#ifndef _WIN32_WCE + int Dir(UINT attr, LPCTSTR lpszWildCard) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); + } + + int AddFile(LPCTSTR lpstrFileName) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName); + } +#endif // !_WIN32_WCE + + // selection helpers + int FindString(int nStartAfter, LPCTSTR lpszItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem); + } + + int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); + } + + int SelectString(int nStartAfter, LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem); + } + + int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + ATLASSERT(nFirstItem <= nLastItem); + return bSelect ? (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem); + } + +#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages + DWORD GetInputMode(BOOL bCurrentMode = TRUE) + { + return SendMessage(LB_GETINPUTMODE, 0, (LPARAM)bCurrentMode); + } + + BOOL SetInputMode(DWORD dwMode) + { + return SendMessage(LB_SETINPUTMODE, 0, (LPARAM)dwMode); + } +#endif // WIN32_PLATFORM_WFSP +}; + +typedef CListBoxT CListBox; + + +/////////////////////////////////////////////////////////////////////////////// +// CComboBox - client side for a Windows COMBOBOX control + +#ifndef WIN32_PLATFORM_WFSP // No COMBOBOX on SmartPhones + +template +class CComboBoxT : public TBase +{ +public: +// Constructors + CComboBoxT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CComboBoxT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return _T("COMBOBOX"); + } + + // for entire combo box + int GetCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0L); + } + + int GetCurSel() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0L); + } + + int SetCurSel(int nSelect) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0L); + } + + LCID GetLocale() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LCID)::SendMessage(m_hWnd, CB_GETLOCALE, 0, 0L); + } + + LCID SetLocale(LCID nNewLocale) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LCID)::SendMessage(m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L); + } + + int GetTopIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETTOPINDEX, 0, 0L); + } + + int SetTopIndex(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SETTOPINDEX, nIndex, 0L); + } + + UINT GetHorizontalExtent() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L); + } + + void SetHorizontalExtent(UINT nExtent) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L); + } + + int GetDroppedWidth() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L); + } + + int SetDroppedWidth(UINT nWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L); + } + +#if ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) + BOOL GetComboBoxInfo(PCOMBOBOXINFO pComboBoxInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); +#if ((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) + return (BOOL)::SendMessage(m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo); +#else // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) + return ::GetComboBoxInfo(m_hWnd, pComboBoxInfo); +#endif // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) + } +#endif // ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) + + // for edit control + DWORD GetEditSel() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, CB_GETEDITSEL, 0, 0L); + } + + BOOL SetEditSel(int nStartChar, int nEndChar) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); + } + + // for combobox item + DWORD_PTR GetItemData(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD_PTR)::SendMessage(m_hWnd, CB_GETITEMDATA, nIndex, 0L); + } + + int SetItemData(int nIndex, DWORD_PTR dwItemData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); + } + + void* GetItemDataPtr(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (void*)GetItemData(nIndex); + } + + int SetItemDataPtr(int nIndex, void* pData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItemData(nIndex, (DWORD_PTR)pData); + } + + int GetLBText(int nIndex, LPTSTR lpszText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); + } + +#ifndef _ATL_NO_COM + BOOL GetLBTextBSTR(int nIndex, BSTR& bstrText) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrText == NULL); + + int nLen = GetLBTextLen(nIndex); + if(nLen == CB_ERR) + return FALSE; + + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(nLen + 1); + if(lpstrText == NULL) + return FALSE; + + if(GetLBText(nIndex, lpstrText) == CB_ERR) + return FALSE; + + bstrText = ::SysAllocString(T2OLE(lpstrText)); + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetLBText(int nIndex, _CSTRING_NS::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int cchLen = GetLBTextLen(nIndex); + if(cchLen == CB_ERR) + return CB_ERR; + int nRet = CB_ERR; + LPTSTR lpstr = strText.GetBufferSetLength(cchLen); + if(lpstr != NULL) + { + nRet = GetLBText(nIndex, lpstr); + strText.ReleaseBuffer(); + } + return nRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + int GetLBTextLen(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L); + } + + int GetItemHeight(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); + } + + int SetItemHeight(int nIndex, UINT cyItemHeight) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); + } + + BOOL GetExtendedUI() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_GETEXTENDEDUI, 0, 0L); + } + + int SetExtendedUI(BOOL bExtended = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); + } + + void GetDroppedControlRect(LPRECT lprect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect); + } + + BOOL GetDroppedState() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); + } + +#if (_WIN32_WINNT >= 0x0501) + int GetMinVisible() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_GETMINVISIBLE, 0, 0L); + } + + BOOL SetMinVisible(int nMinVisible) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L); + } + + // Vista only + BOOL GetCueBannerText(LPWSTR lpwText, int cchText) const + { +#ifndef CB_GETCUEBANNER + const UINT CB_GETCUEBANNER = (CBM_FIRST + 4); +#endif + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText); + } + + // Vista only + BOOL SetCueBannerText(LPCWSTR lpcwText) + { +#ifndef CB_SETCUEBANNER + const UINT CB_SETCUEBANNER = (CBM_FIRST + 3); +#endif + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText); + } +#endif // (_WIN32_WINNT >= 0x0501) + +// Operations + int InitStorage(int nItems, UINT nBytes) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes); + } + + void ResetContent() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0L); + } + + // for edit control + BOOL LimitText(int nMaxChars) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CB_LIMITTEXT, nMaxChars, 0L); + } + + // for drop-down combo boxes + void ShowDropDown(BOOL bShowIt = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L); + } + + // manipulating listbox items + int AddString(LPCTSTR lpszString) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); + } + + int DeleteString(UINT nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0L); + } + + int InsertString(int nIndex, LPCTSTR lpszString) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); + } + +#ifndef _WIN32_WCE + int Dir(UINT attr, LPCTSTR lpszWildCard) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); + } +#endif // !_WIN32_WCE + + // selection helpers + int FindString(int nStartAfter, LPCTSTR lpszString) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString); + } + + int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); + } + + int SelectString(int nStartAfter, LPCTSTR lpszString) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString); + } + + // Clipboard operations + void Clear() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + } + + void Copy() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + } + + void Cut() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + } + + void Paste() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); + } +}; + +typedef CComboBoxT CComboBox; + +#endif // !WIN32_PLATFORM_WFSP + +/////////////////////////////////////////////////////////////////////////////// +// CEdit - client side for a Windows EDIT control + +template +class CEditT : public TBase +{ +public: +// Constructors + CEditT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CEditT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return _T("EDIT"); + } + + BOOL CanUndo() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); + } + + int GetLineCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); + } + + BOOL GetModify() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); + } + + void SetModify(BOOL bModified = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); + } + + void GetRect(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); + } + + DWORD GetSel() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); + } + + void GetSel(int& nStartChar, int& nEndChar) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); + } + +#ifndef _WIN32_WCE + HLOCAL GetHandle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HLOCAL)::SendMessage(m_hWnd, EM_GETHANDLE, 0, 0L); + } + + void SetHandle(HLOCAL hBuffer) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L); + } +#endif // !_WIN32_WCE + + DWORD GetMargins() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L); + } + + void SetMargins(UINT nLeft, UINT nRight) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(nLeft, nRight)); + } + + UINT GetLimitText() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); + } + + void SetLimitText(UINT nMax) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETLIMITTEXT, nMax, 0L); + } + + POINT PosFromChar(UINT nChar) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_POSFROMCHAR, nChar, 0); + POINT point = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; + return point; + } + + int CharFromPos(POINT pt, int* pLine = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)); + if(pLine != NULL) + *pLine = (int)(short)HIWORD(dwRet); + return (int)(short)LOWORD(dwRet); + } + + // NOTE: first word in lpszBuffer must contain the size of the buffer! + int GetLine(int nIndex, LPTSTR lpszBuffer) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + } + + int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const + { + ATLASSERT(::IsWindow(m_hWnd)); + *(LPWORD)lpszBuffer = (WORD)nMaxLength; + return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + } + + TCHAR GetPasswordChar() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (TCHAR)::SendMessage(m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); + } + + void SetPasswordChar(TCHAR ch) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETPASSWORDCHAR, ch, 0L); + } + +#ifndef _WIN32_WCE + EDITWORDBREAKPROC GetWordBreakProc() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (EDITWORDBREAKPROC)::SendMessage(m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); + } + + void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); + } +#endif // !_WIN32_WCE + + int GetFirstVisibleLine() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); + } + +#ifndef _WIN32_WCE + int GetThumb() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & ES_MULTILINE) != 0); + return (int)::SendMessage(m_hWnd, EM_GETTHUMB, 0, 0L); + } +#endif // !_WIN32_WCE + + BOOL SetReadOnly(BOOL bReadOnly = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); + } + +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + UINT GetImeStatus(UINT uStatus) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETIMESTATUS, uStatus, 0L); + } + + UINT SetImeStatus(UINT uStatus, UINT uData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_SETIMESTATUS, uStatus, uData); + } +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0501) + BOOL GetCueBannerText(LPCWSTR lpstrText, int cchText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText); + } + + // bKeepWithFocus - Vista only + BOOL SetCueBannerText(LPCWSTR lpstrText, BOOL bKeepWithFocus = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText)); + } +#endif // (_WIN32_WINNT >= 0x0501) + +// Operations + void EmptyUndoBuffer() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); + } + + BOOL FmtLines(BOOL bAddEOL) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_FMTLINES, bAddEOL, 0L); + } + + void LimitText(int nChars = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_LIMITTEXT, nChars, 0L); + } + + int LineFromChar(int nIndex = -1) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_LINEFROMCHAR, nIndex, 0L); + } + + int LineIndex(int nLine = -1) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); + } + + int LineLength(int nLine = -1) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); + } + + void LineScroll(int nLines, int nChars = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); + } + + void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); + } + + void SetRect(LPCRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); + } + + void SetRectNP(LPCRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); + } + + void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection)); + if(!bNoScroll) + ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + } + + void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar); + if(!bNoScroll) + ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + } + + void SetSelAll(BOOL bNoScroll = FALSE) + { + SetSel(0, -1, bNoScroll); + } + + void SetSelNone(BOOL bNoScroll = FALSE) + { + SetSel(-1, 0, bNoScroll); + } + + BOOL SetTabStops(int nTabStops, LPINT rgTabStops) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); + } + + BOOL SetTabStops() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); + } + + BOOL SetTabStops(const int& cxEachStop) // takes an 'int' + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + } + + void ScrollCaret() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + } + + int Scroll(int nScrollAction) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & ES_MULTILINE) != 0); + LRESULT lRet = ::SendMessage(m_hWnd, EM_SCROLL, nScrollAction, 0L); + if(!(BOOL)HIWORD(lRet)) + return -1; // failed + return (int)(short)LOWORD(lRet); + + } + + void InsertText(int nInsertAfterChar, LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) + { + SetSel(nInsertAfterChar, nInsertAfterChar, bNoScroll); + ReplaceSel(lpstrText, bCanUndo); + } + + void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) + { + InsertText(GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo); + } + +#if (_WIN32_WINNT >= 0x0501) + BOOL ShowBalloonTip(PEDITBALLOONTIP pEditBaloonTip) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip); + } + + BOOL HideBalloonTip() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_HIDEBALLOONTIP, 0, 0L); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_WINNT >= 0x0600) + DWORD GetHilite() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); + } + + void GetHilite(int& nStartChar, int& nEndChar) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); + nStartChar = (int)(short)LOWORD(dwRet); + nEndChar = (int)(short)HIWORD(dwRet); + } + + void SetHilite(int nStartChar, int nEndChar) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETHILITE, nStartChar, nEndChar); + } +#endif // (_WIN32_WINNT >= 0x0600) + + // Clipboard operations + BOOL Undo() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); + } + + void Clear() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + } + + void Copy() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + } + + void Cut() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + } + + void Paste() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); + } + +#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages + DWORD GetExtendedStyle() + { + return SendMessage(EM_GETEXTENDEDSTYLE); + } + + DWORD SetExtendedStyle(DWORD dwMask, DWORD dwExStyle) + { + return SendMessage(EM_SETEXTENDEDSTYLE, (WPARAM)dwMask, (LPARAM)dwExStyle); + } + + DWORD GetInputMode(BOOL bCurrentMode = TRUE) + { + return SendMessage(EM_GETINPUTMODE, 0, (LPARAM)bCurrentMode); + } + + BOOL SetInputMode(DWORD dwMode) + { + return SendMessage(EM_SETINPUTMODE, 0, (LPARAM)dwMode); + } + + BOOL SetSymbols(LPCTSTR szSymbols) + { + return SendMessage(EM_SETSYMBOLS, 0, (LPARAM)szSymbols); + } + + BOOL ResetSymbols() + { + return SendMessage(EM_SETSYMBOLS); + } +#endif // WIN32_PLATFORM_WFSP +}; + +typedef CEditT CEdit; + + +/////////////////////////////////////////////////////////////////////////////// +// CEditCommands - message handlers for standard EDIT commands + +// Chain to CEditCommands message map. Your class must also derive from CEdit. +// Example: +// class CMyEdit : public CWindowImpl, +// public CEditCommands +// { +// public: +// BEGIN_MSG_MAP(CMyEdit) +// // your handlers... +// CHAIN_MSG_MAP_ALT(CEditCommands, 1) +// END_MSG_MAP() +// // other stuff... +// }; + +template +class CEditCommands +{ +public: + BEGIN_MSG_MAP(CEditCommands< T >) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_EDIT_CLEAR, OnEditClear) + COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, OnEditClearAll) + COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEditCopy) + COMMAND_ID_HANDLER(ID_EDIT_CUT, OnEditCut) + COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEditPaste) + COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, OnEditSelectAll) + COMMAND_ID_HANDLER(ID_EDIT_UNDO, OnEditUndo) + END_MSG_MAP() + + LRESULT OnEditClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Clear(); + return 0; + } + + LRESULT OnEditClearAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->SetSel(0, -1); + pT->Clear(); + return 0; + } + + LRESULT OnEditCopy(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Copy(); + return 0; + } + + LRESULT OnEditCut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Cut(); + return 0; + } + + LRESULT OnEditPaste(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Paste(); + return 0; + } + + LRESULT OnEditSelectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->SetSel(0, -1); + return 0; + } + + LRESULT OnEditUndo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Undo(); + return 0; + } + +// State (update UI) helpers + BOOL CanCut() const + { return HasSelection(); } + + BOOL CanCopy() const + { return HasSelection(); } + + BOOL CanClear() const + { return HasSelection(); } + + BOOL CanSelectAll() const + { return HasText(); } + + BOOL CanFind() const + { return HasText(); } + + BOOL CanRepeat() const + { return HasText(); } + + BOOL CanReplace() const + { return HasText(); } + + BOOL CanClearAll() const + { return HasText(); } + +// Implementation + BOOL HasSelection() const + { + const T* pT = static_cast(this); + int nMin, nMax; + ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nMin, (LPARAM)&nMax); + return (nMin != nMax); + } + + BOOL HasText() const + { + const T* pT = static_cast(this); + return (pT->GetWindowTextLength() > 0); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CScrollBar - client side for a Windows SCROLLBAR control + +template +class CScrollBarT : public TBase +{ +public: +// Constructors + CScrollBarT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CScrollBarT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return _T("SCROLLBAR"); + } + +#ifndef _WIN32_WCE + int GetScrollPos() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::GetScrollPos(m_hWnd, SB_CTL); + } +#endif // !_WIN32_WCE + + int SetScrollPos(int nPos, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw); + } + +#ifndef _WIN32_WCE + void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos); + } +#endif // !_WIN32_WCE + + void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); + } + + BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::GetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo); + } + + int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::SetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo, bRedraw); + } + +#ifndef _WIN32_WCE + int GetScrollLimit() const + { + int nMin = 0, nMax = 0; + ::GetScrollRange(m_hWnd, SB_CTL, &nMin, &nMax); + SCROLLINFO info = { 0 }; + info.cbSize = sizeof(SCROLLINFO); + info.fMask = SIF_PAGE; + if(::GetScrollInfo(m_hWnd, SB_CTL, &info)) + nMax -= ((info.nPage - 1) > 0) ? (info.nPage - 1) : 0; + + return nMax; + } + +#if (WINVER >= 0x0500) + BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); +#if (_WIN32_WINNT >= 0x0501) + return (BOOL)::SendMessage(m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); +#else // !(_WIN32_WINNT >= 0x0501) + return ::GetScrollBarInfo(m_hWnd, OBJID_CLIENT, pScrollBarInfo); +#endif // !(_WIN32_WINNT >= 0x0501) + } +#endif // (WINVER >= 0x0500) + +// Operations + void ShowScrollBar(BOOL bShow = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::ShowScrollBar(m_hWnd, SB_CTL, bShow); + } + + BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags); + } +#endif // !_WIN32_WCE +}; + +typedef CScrollBarT CScrollBar; + + +// --- Windows Common Controls --- + +/////////////////////////////////////////////////////////////////////////////// +// CImageList + +class CImageList +{ +public: + HIMAGELIST m_hImageList; + +// Constructor + CImageList(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList) + { } + +// Operators, etc. + CImageList& operator =(HIMAGELIST hImageList) + { + m_hImageList = hImageList; + return *this; + } + + operator HIMAGELIST() const { return m_hImageList; } + + void Attach(HIMAGELIST hImageList) + { + ATLASSERT(m_hImageList == NULL); + ATLASSERT(hImageList != NULL); + m_hImageList = hImageList; + } + + HIMAGELIST Detach() + { + HIMAGELIST hImageList = m_hImageList; + m_hImageList = NULL; + return hImageList; + } + + bool IsNull() const { return (m_hImageList == NULL); } + +// Attributes + int GetImageCount() const + { + ATLASSERT(m_hImageList != NULL); + return ImageList_GetImageCount(m_hImageList); + } + + COLORREF GetBkColor() const + { + ATLASSERT(m_hImageList != NULL); + return ImageList_GetBkColor(m_hImageList); + } + + COLORREF SetBkColor(COLORREF cr) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetBkColor(m_hImageList, cr); + } + + BOOL GetImageInfo(int nImage, IMAGEINFO* pImageInfo) const + { + ATLASSERT(m_hImageList != NULL); + return ImageList_GetImageInfo(m_hImageList, nImage, pImageInfo); + } + + HICON GetIcon(int nIndex, UINT uFlags = ILD_NORMAL) const + { + ATLASSERT(m_hImageList != NULL); + return ImageList_GetIcon(m_hImageList, nIndex, uFlags); + } + + BOOL GetIconSize(int& cx, int& cy) const + { + ATLASSERT(m_hImageList != NULL); + return ImageList_GetIconSize(m_hImageList, &cx, &cy); + } + + BOOL GetIconSize(SIZE& size) const + { + ATLASSERT(m_hImageList != NULL); + return ImageList_GetIconSize(m_hImageList, (int*)&size.cx, (int*)&size.cy); + } + + BOOL SetIconSize(int cx, int cy) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetIconSize(m_hImageList, cx, cy); + } + + BOOL SetIconSize(SIZE size) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetIconSize(m_hImageList, size.cx, size.cy); + } + + BOOL SetImageCount(UINT uNewCount) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetImageCount(m_hImageList, uNewCount); + } + + BOOL SetOverlayImage(int nImage, int nOverlay) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetOverlayImage(m_hImageList, nImage, nOverlay); + } + +// Operations + BOOL Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow) + { + ATLASSERT(m_hImageList == NULL); + m_hImageList = ImageList_Create(cx, cy, nFlags, nInitial, nGrow); + return (m_hImageList != NULL) ? TRUE : FALSE; + } + + BOOL Create(ATL::_U_STRINGorID bitmap, int cx, int nGrow, COLORREF crMask) + { + ATLASSERT(m_hImageList == NULL); + m_hImageList = ImageList_LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, cx, nGrow, crMask); + return (m_hImageList != NULL) ? TRUE : FALSE; + } + + BOOL CreateFromImage(ATL::_U_STRINGorID image, int cx, int nGrow, COLORREF crMask, UINT uType, UINT uFlags = LR_DEFAULTCOLOR | LR_DEFAULTSIZE) + { + ATLASSERT(m_hImageList == NULL); + m_hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, cx, nGrow, crMask, uType, uFlags); + return (m_hImageList != NULL) ? TRUE : FALSE; + } + + BOOL Merge(HIMAGELIST hImageList1, int nImage1, HIMAGELIST hImageList2, int nImage2, int dx, int dy) + { + ATLASSERT(m_hImageList == NULL); + m_hImageList = ImageList_Merge(hImageList1, nImage1, hImageList2, nImage2, dx, dy); + return (m_hImageList != NULL) ? TRUE : FALSE; + } + +#ifndef _WIN32_WCE +#ifdef __IStream_INTERFACE_DEFINED__ + BOOL CreateFromStream(LPSTREAM lpStream) + { + ATLASSERT(m_hImageList == NULL); + m_hImageList = ImageList_Read(lpStream); + return (m_hImageList != NULL) ? TRUE : FALSE; + } +#endif // __IStream_INTERFACE_DEFINED__ +#endif // !_WIN32_WCE + + BOOL Destroy() + { + if (m_hImageList == NULL) + return FALSE; + BOOL bRet = ImageList_Destroy(m_hImageList); + if(bRet) + m_hImageList = NULL; + return bRet; + } + + int Add(HBITMAP hBitmap, HBITMAP hBitmapMask = NULL) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_Add(m_hImageList, hBitmap, hBitmapMask); + } + + int Add(HBITMAP hBitmap, COLORREF crMask) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_AddMasked(m_hImageList, hBitmap, crMask); + } + + BOOL Remove(int nImage) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_Remove(m_hImageList, nImage); + } + + BOOL RemoveAll() + { + ATLASSERT(m_hImageList != NULL); + return ImageList_RemoveAll(m_hImageList); + } + + BOOL Replace(int nImage, HBITMAP hBitmap, HBITMAP hBitmapMask) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_Replace(m_hImageList, nImage, hBitmap, hBitmapMask); + } + + int AddIcon(HICON hIcon) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_AddIcon(m_hImageList, hIcon); + } + + int ReplaceIcon(int nImage, HICON hIcon) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_ReplaceIcon(m_hImageList, nImage, hIcon); + } + + HICON ExtractIcon(int nImage) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_ExtractIcon(NULL, m_hImageList, nImage); + } + + BOOL Draw(HDC hDC, int nImage, int x, int y, UINT nStyle) + { + ATLASSERT(m_hImageList != NULL); + ATLASSERT(hDC != NULL); + return ImageList_Draw(m_hImageList, nImage, hDC, x, y, nStyle); + } + + BOOL Draw(HDC hDC, int nImage, POINT pt, UINT nStyle) + { + ATLASSERT(m_hImageList != NULL); + ATLASSERT(hDC != NULL); + return ImageList_Draw(m_hImageList, nImage, hDC, pt.x, pt.y, nStyle); + } + + BOOL DrawEx(int nImage, HDC hDC, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) + { + ATLASSERT(m_hImageList != NULL); + ATLASSERT(hDC != NULL); + return ImageList_DrawEx(m_hImageList, nImage, hDC, x, y, dx, dy, rgbBk, rgbFg, fStyle); + } + + BOOL DrawEx(int nImage, HDC hDC, RECT& rect, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) + { + ATLASSERT(m_hImageList != NULL); + ATLASSERT(hDC != NULL); + return ImageList_DrawEx(m_hImageList, nImage, hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, rgbBk, rgbFg, fStyle); + } + + static BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp) + { + return ImageList_DrawIndirect(pimldp); + } + + BOOL Copy(int nSrc, int nDst, UINT uFlags = ILCF_MOVE) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_Copy(m_hImageList, nDst, m_hImageList, nSrc, uFlags); + } + +#ifdef __IStream_INTERFACE_DEFINED__ +#ifndef _WIN32_WCE + static HIMAGELIST Read(LPSTREAM lpStream) + { + return ImageList_Read(lpStream); + } + + BOOL Write(LPSTREAM lpStream) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_Write(m_hImageList, lpStream); + } +#endif // !_WIN32_WCE + +#if (_WIN32_WINNT >= 0x0501) + static HRESULT ReadEx(DWORD dwFlags, LPSTREAM lpStream, REFIID riid, PVOID* ppv) + { + return ImageList_ReadEx(dwFlags, lpStream, riid, ppv); + } + + HRESULT WriteEx(DWORD dwFlags, LPSTREAM lpStream) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_WriteEx(m_hImageList, dwFlags, lpStream); + } +#endif // (_WIN32_WINNT >= 0x0501) +#endif // __IStream_INTERFACE_DEFINED__ + + // Drag operations + BOOL BeginDrag(int nImage, POINT ptHotSpot) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_BeginDrag(m_hImageList, nImage, ptHotSpot.x, ptHotSpot.y); + } + + BOOL BeginDrag(int nImage, int xHotSpot, int yHotSpot) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_BeginDrag(m_hImageList, nImage, xHotSpot, yHotSpot); + } + + static void EndDrag() + { + ImageList_EndDrag(); + } + + static BOOL DragMove(POINT pt) + { + return ImageList_DragMove(pt.x, pt.y); + } + + static BOOL DragMove(int x, int y) + { + return ImageList_DragMove(x, y); + } + + BOOL SetDragCursorImage(int nDrag, POINT ptHotSpot) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetDragCursorImage(m_hImageList, nDrag, ptHotSpot.x, ptHotSpot.y); + } + + BOOL SetDragCursorImage(int nDrag, int xHotSpot, int yHotSpot) + { + ATLASSERT(m_hImageList != NULL); + return ImageList_SetDragCursorImage(m_hImageList, nDrag, xHotSpot, yHotSpot); + } + + static BOOL DragShowNolock(BOOL bShow = TRUE) + { + return ImageList_DragShowNolock(bShow); + } + + static CImageList GetDragImage(LPPOINT lpPoint, LPPOINT lpPointHotSpot) + { + return CImageList(ImageList_GetDragImage(lpPoint, lpPointHotSpot)); + } + + static BOOL DragEnter(HWND hWnd, POINT point) + { + return ImageList_DragEnter(hWnd, point.x, point.y); + } + + static BOOL DragEnter(HWND hWnd, int x, int y) + { + return ImageList_DragEnter(hWnd, x, y); + } + + static BOOL DragLeave(HWND hWnd) + { + return ImageList_DragLeave(hWnd); + } + +#if (_WIN32_IE >= 0x0400) + CImageList Duplicate() const + { + ATLASSERT(m_hImageList != NULL); + return CImageList(ImageList_Duplicate(m_hImageList)); + } + + static CImageList Duplicate(HIMAGELIST hImageList) + { + ATLASSERT(hImageList != NULL); + return CImageList(ImageList_Duplicate(hImageList)); + } +#endif // (_WIN32_IE >= 0x0400) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CToolTipCtrl + +#ifndef _WIN32_WCE + +class CToolInfo : public TOOLINFO +{ +public: + CToolInfo(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) + { + Init(nFlags, hWnd, nIDTool, lpRect, lpstrText, lUserParam); + } + + operator LPTOOLINFO() { return this; } + + operator LPARAM() { return (LPARAM)this; } + + void Init(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) + { + ATLASSERT(::IsWindow(hWnd)); + memset(this, 0, sizeof(TOOLINFO)); + cbSize = sizeof(TOOLINFO); + uFlags = nFlags; + if(nIDTool == 0) + { + hwnd = ::GetParent(hWnd); + uFlags |= TTF_IDISHWND; + uId = (UINT_PTR)hWnd; + } + else + { + hwnd = hWnd; + uId = nIDTool; + } + if(lpRect != NULL) + rect = *lpRect; + hinst = ModuleHelper::GetResourceInstance(); + lpszText = lpstrText; + lParam = lUserParam; + } +}; + +template +class CToolTipCtrlT : public TBase +{ +public: +// Constructors + CToolTipCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CToolTipCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return TOOLTIPS_CLASS; + } + + void GetText(LPTOOLINFO lpToolInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo); + } + + void GetText(LPTSTR lpstrText, HWND hWnd, UINT nIDTool = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); + ::SendMessage(m_hWnd, TTM_GETTEXT, 0, ti); + } + + BOOL GetToolInfo(LPTOOLINFO lpToolInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo); + } + + BOOL GetToolInfo(HWND hWnd, UINT nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + ATLASSERT(puFlags != NULL); + ATLASSERT(lpRect != NULL); + CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); + BOOL bRet = (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, ti); + if(bRet != FALSE) + { + *puFlags = ti.uFlags; + *lpRect = ti.rect; + } + return bRet; + } + + void SetToolInfo(LPTOOLINFO lpToolInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo); + } + + void SetToolRect(LPTOOLINFO lpToolInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo); + } + + void SetToolRect(HWND hWnd, UINT nIDTool, LPCRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + ATLASSERT(nIDTool != 0); + + CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRect, NULL); + ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, ti); + } + + int GetToolCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TTM_GETTOOLCOUNT, 0, 0L); + } + + int GetDelayTime(DWORD dwType) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TTM_GETDELAYTIME, dwType, 0L); + } + + void SetDelayTime(DWORD dwType, int nTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0)); + } + + void GetMargin(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect); + } + + void SetMargin(LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect); + } + + int GetMaxTipWidth() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L); + } + + int SetMaxTipWidth(int nWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth); + } + + COLORREF GetTipBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L); + } + + void SetTipBkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L); + } + + COLORREF GetTipTextColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L); + } + + void SetTipTextColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L); + } + + BOOL GetCurrentTool(LPTOOLINFO lpToolInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo); + } + +#if (_WIN32_IE >= 0x0500) + SIZE GetBubbleSize(LPTOOLINFO lpToolInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo); + SIZE size = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; + return size; + } + + BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle); + } +#endif // (_WIN32_IE >= 0x0500) + +#if (_WIN32_WINNT >= 0x0501) + void GetTitle(PTTGETTITLE pTTGetTitle) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle); + } + + void SetWindowTheme(LPCWSTR lpstrTheme) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + } +#endif // (_WIN32_WINNT >= 0x0501) + +// Operations + void Activate(BOOL bActivate) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_ACTIVATE, bActivate, 0L); + } + + BOOL AddTool(LPTOOLINFO lpToolInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo); + } + + BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT nIDTool = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + // the toolrect and toolid must both be zero or both valid + ATLASSERT((lpRectTool != NULL && nIDTool != 0) || (lpRectTool == NULL && nIDTool == 0)); + + CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRectTool, (LPTSTR)text.m_lpstr); + return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, ti); + } + + void DelTool(LPTOOLINFO lpToolInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo); + } + + void DelTool(HWND hWnd, UINT nIDTool = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + + CToolInfo ti(0, hWnd, nIDTool, NULL, NULL); + ::SendMessage(m_hWnd, TTM_DELTOOL, 0, ti); + } + + BOOL HitTest(LPTTHITTESTINFO lpHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo); + } + + BOOL HitTest(HWND hWnd, POINT pt, LPTOOLINFO lpToolInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + ATLASSERT(lpToolInfo != NULL); + + TTHITTESTINFO hti = { 0 }; + hti.ti.cbSize = sizeof(TOOLINFO); + hti.hwnd = hWnd; + hti.pt.x = pt.x; + hti.pt.y = pt.y; + if((BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE) + { + *lpToolInfo = hti.ti; + return TRUE; + } + return FALSE; + } + + void RelayEvent(LPMSG lpMsg) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg); + } + + void UpdateTipText(LPTOOLINFO lpToolInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo); + } + + void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT nIDTool = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hWnd != NULL); + + CToolInfo ti(0, hWnd, nIDTool, NULL, (LPTSTR)text.m_lpstr); + ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, ti); + } + + BOOL EnumTools(UINT nTool, LPTOOLINFO lpToolInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo); + } + + void Pop() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_POP, 0, 0L); + } + + void TrackActivate(LPTOOLINFO lpToolInfo, BOOL bActivate) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo); + } + + void TrackPosition(int xPos, int yPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos)); + } + +#if (_WIN32_IE >= 0x0400) + void Update() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_UPDATE, 0, 0L); + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) + BOOL AdjustRect(LPRECT lpRect, BOOL bLarger /*= TRUE*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect); + } +#endif // (_WIN32_IE >= 0x0500) + +#if (_WIN32_WINNT >= 0x0501) + void Popup() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TTM_POPUP, 0, 0L); + } +#endif // (_WIN32_WINNT >= 0x0501) +}; + +typedef CToolTipCtrlT CToolTipCtrl; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CHeaderCtrl + +template +class CHeaderCtrlT : public TBase +{ +public: +// Constructors + CHeaderCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CHeaderCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_HEADER; + } + + int GetItemCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_GETITEMCOUNT, 0, 0L); + } + + BOOL GetItem(int nIndex, LPHDITEM pHeaderItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem); + } + + BOOL SetItem(int nIndex, LPHDITEM pHeaderItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem); + } + + CImageList GetImageList() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_GETIMAGELIST, 0, 0L)); + } + + CImageList SetImageList(HIMAGELIST hImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList)); + } + + BOOL GetOrderArray(int nSize, int* lpnArray) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray); + } + + BOOL SetOrderArray(int nSize, int* lpnArray) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray); + } + + BOOL GetItemRect(int nIndex, LPRECT lpItemRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect); + } + + int SetHotDivider(BOOL bPos, DWORD dwInputValue) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + int GetBitmapMargin() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L); + } + + int SetBitmapMargin(int nWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L); + } + + int SetFilterChangeTimeout(DWORD dwTimeOut) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0600) + BOOL GetItemDropDownRect(int nIndex, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); + } + + BOOL GetOverflowRect(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect); + } + + int GetFocusedItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L); + } + + BOOL SetFocusedItem(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex); + } +#endif // (_WIN32_WINNT >= 0x0600) + +// Operations + int InsertItem(int nIndex, LPHDITEM phdi) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi); + } + + int AddItem(LPHDITEM phdi) + { + return InsertItem(GetItemCount(), phdi); + } + + BOOL DeleteItem(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_DELETEITEM, nIndex, 0L); + } + + BOOL Layout(HD_LAYOUT* pHeaderLayout) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout); + } + + int HitTest(LPHDHITTESTINFO lpHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo); + } + + int OrderToIndex(int nOrder) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L); + } + + CImageList CreateDragImage(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L)); + } + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + int EditFilter(int nColumn, BOOL bDiscardChanges) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0)); + } + + int ClearFilter(int nColumn) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, nColumn, 0L); + } + + int ClearAllFilters() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) +}; + +typedef CHeaderCtrlT CHeaderCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CListViewCtrl + +template +class CListViewCtrlT : public TBase +{ +public: +// Constructors + CListViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CListViewCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_LISTVIEW; + } + + COLORREF GetBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_GETBKCOLOR, 0, 0L); + } + + BOOL SetBkColor(COLORREF cr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETBKCOLOR, 0, cr); + } + + CImageList GetImageList(int nImageListType) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L)); + } + + CImageList SetImageList(HIMAGELIST hImageList, int nImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList)); + } + + int GetItemCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETITEMCOUNT, 0, 0L); + } + + BOOL SetItemCount(int nItems) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, 0L); + } + + BOOL GetItem(LPLVITEM pItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); + } + + BOOL SetItem(const LVITEM* pItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); + } + + BOOL SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, + int nImage, UINT nState, UINT nStateMask, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvi = { 0 }; + lvi.mask = nMask; + lvi.iItem = nItem; + lvi.iSubItem = nSubItem; + lvi.stateMask = nStateMask; + lvi.state = nState; + lvi.pszText = (LPTSTR) lpszItem; + lvi.iImage = nImage; + lvi.lParam = lParam; + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi); + } + + UINT GetItemState(int nItem, UINT nMask) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, LVM_GETITEMSTATE, nItem, nMask); + } + + BOOL SetItemState(int nItem, UINT nState, UINT nStateMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvi = { 0 }; + lvi.state = nState; + lvi.stateMask = nStateMask; + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); + } + + BOOL SetItemState(int nItem, LPLVITEM pItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem); + } + +#ifndef _ATL_NO_COM + BOOL GetItemText(int nItem, int nSubItem, BSTR& bstrText) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrText == NULL); + LVITEM lvi = { 0 }; + lvi.iSubItem = nSubItem; + + LPTSTR lpstrText = NULL; + int nRes = 0; + for(int nLen = 256; ; nLen *= 2) + { + ATLTRY(lpstrText = new TCHAR[nLen]); + if(lpstrText == NULL) + break; + lpstrText[0] = NULL; + lvi.cchTextMax = nLen; + lvi.pszText = lpstrText; + nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); + if(nRes < nLen - 1) + break; + delete [] lpstrText; + lpstrText = NULL; + } + + if(lpstrText != NULL) + { + if(nRes != 0) + bstrText = ::SysAllocString(T2OLE(lpstrText)); + delete [] lpstrText; + } + + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetItemText(int nItem, int nSubItem, _CSTRING_NS::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvi = { 0 }; + lvi.iSubItem = nSubItem; + + strText.Empty(); + int nRes = 0; + for(int nLen = 256; ; nLen *= 2) + { + lvi.cchTextMax = nLen; + lvi.pszText = strText.GetBufferSetLength(nLen); + if(lvi.pszText == NULL) + { + nRes = 0; + break; + } + nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); + if(nRes < nLen - 1) + break; + } + strText.ReleaseBuffer(); + return nRes; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + int GetItemText(int nItem, int nSubItem, LPTSTR lpszText, int nLen) const + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvi = { 0 }; + lvi.iSubItem = nSubItem; + lvi.cchTextMax = nLen; + lvi.pszText = lpszText; + return (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); + } + + BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(nItem, nSubItem, LVIF_TEXT, lpszText, 0, 0, 0, 0); + } + + DWORD_PTR GetItemData(int nItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvi = { 0 }; + lvi.iItem = nItem; + lvi.mask = LVIF_PARAM; + BOOL bRet = (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi); + return (DWORD_PTR)(bRet ? lvi.lParam : NULL); + } + + BOOL SetItemData(int nItem, DWORD_PTR dwData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData); + } + + UINT GetCallbackMask() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, LVM_GETCALLBACKMASK, 0, 0L); + } + + BOOL SetCallbackMask(UINT nMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L); + } + + BOOL GetItemPosition(int nItem, LPPOINT lpPoint) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint); + } + + BOOL SetItemPosition(int nItem, POINT pt) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); + } + + BOOL SetItemPosition(int nItem, int x, int y) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); + POINT pt = { x, y }; + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); + } + + int GetStringWidth(LPCTSTR lpsz) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); + } + + CEdit GetEditControl() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CEdit((HWND)::SendMessage(m_hWnd, LVM_GETEDITCONTROL, 0, 0L)); + } + + BOOL GetColumn(int nCol, LVCOLUMN* pColumn) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn); + } + + BOOL SetColumn(int nCol, const LVCOLUMN* pColumn) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn); + } + + int GetColumnWidth(int nCol) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L); + } + + BOOL SetColumnWidth(int nCol, int cx) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); + } + + BOOL GetViewRect(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect); + } + + COLORREF GetTextColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTCOLOR, 0, 0L); + } + + BOOL SetTextColor(COLORREF cr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTCOLOR, 0, cr); + } + + COLORREF GetTextBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L); + } + + BOOL SetTextBkColor(COLORREF cr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr); + } + + int GetTopIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETTOPINDEX, 0, 0L); + } + + int GetCountPerPage() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L); + } + + BOOL GetOrigin(LPPOINT lpPoint) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint); + } + + UINT GetSelectedCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L); + } + + BOOL GetItemRect(int nItem, LPRECT lpRect, UINT nCode) const + { + ATLASSERT(::IsWindow(m_hWnd)); + lpRect->left = nCode; + return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); + } + +#ifndef _WIN32_WCE + HCURSOR GetHotCursor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HCURSOR)::SendMessage(m_hWnd, LVM_GETHOTCURSOR, 0, 0L); + } + + HCURSOR SetHotCursor(HCURSOR hHotCursor) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HCURSOR)::SendMessage(m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor); + } + + int GetHotItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETHOTITEM, 0, 0L); + } + + int SetHotItem(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SETHOTITEM, nIndex, 0L); + } +#endif // !_WIN32_WCE + + BOOL GetColumnOrderArray(int nCount, int* lpnArray) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); + } + + BOOL SetColumnOrderArray(int nCount, int* lpnArray) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); + } + + CHeaderCtrl GetHeader() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CHeaderCtrl((HWND)::SendMessage(m_hWnd, LVM_GETHEADER, 0, 0L)); + } + + BOOL GetSubItemRect(int nItem, int nSubItem, int nFlag, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_REPORT); + ATLASSERT(lpRect != NULL); + lpRect->top = nSubItem; + lpRect->left = nFlag; + return (BOOL)::SendMessage(m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect); + } + + DWORD SetIconSpacing(int cx, int cy) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_ICON); + return (DWORD)::SendMessage(m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy)); + } + + int GetISearchString(LPTSTR lpstr) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); + } + + void GetItemSpacing(SIZE& sizeSpacing, BOOL bSmallIconView = FALSE) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L); + sizeSpacing.cx = GET_X_LPARAM(dwRet); + sizeSpacing.cy = GET_Y_LPARAM(dwRet); + } + +#if (_WIN32_WCE >= 410) + void SetItemSpacing(INT cySpacing) + { + ATLASSERT(::IsWindow(m_hWnd)); + ListView_SetItemSpacing(m_hWnd, cySpacing); + } +#endif // (_WIN32_WCE >= 410) + + // single-selection only + int GetSelectedIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); + return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); + } + + BOOL GetSelectedItem(LPLVITEM pItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); + ATLASSERT(pItem != NULL); + pItem->iItem = (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); + if(pItem->iItem == -1) + return FALSE; + return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); + } + + // extended list view styles + DWORD GetExtendedListViewStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L); + } + + // dwExMask = 0 means all styles + DWORD SetExtendedListViewStyle(DWORD dwExStyle, DWORD dwExMask = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle); + } + + // checkboxes only + BOOL GetCheckState(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExtendedListViewStyle() & LVS_EX_CHECKBOXES) != 0); + UINT uRet = GetItemState(nIndex, LVIS_STATEIMAGEMASK); + return (uRet >> 12) - 1; + } + + BOOL SetCheckState(int nItem, BOOL bCheck) + { + int nCheck = bCheck ? 2 : 1; // one based index + return SetItemState(nItem, INDEXTOSTATEIMAGEMASK(nCheck), LVIS_STATEIMAGEMASK); + } + + // view type + DWORD GetViewType() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (GetStyle() & LVS_TYPEMASK); + } + + DWORD SetViewType(DWORD dwType) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(dwType == LVS_ICON || dwType == LVS_SMALLICON || dwType == LVS_LIST || dwType == LVS_REPORT); + DWORD dwOldType = GetViewType(); + if(dwType != dwOldType) + ModifyStyle(LVS_TYPEMASK, (dwType & LVS_TYPEMASK)); + return dwOldType; + } + +#if (_WIN32_IE >= 0x0400) +#ifndef _WIN32_WCE + BOOL GetBkImage(LPLVBKIMAGE plvbki) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki); + } + + BOOL SetBkImage(LPLVBKIMAGE plvbki) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki); + } +#endif // !_WIN32_WCE + + int GetSelectionMark() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETSELECTIONMARK, 0, 0L); + } + + int SetSelectionMark(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex); + } + +#ifndef _WIN32_WCE + BOOL GetWorkAreas(int nWorkAreas, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect); + } + + BOOL SetWorkAreas(int nWorkAreas, LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect); + } + + DWORD GetHoverTime() const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); + return (DWORD)::SendMessage(m_hWnd, LVM_GETHOVERTIME, 0, 0L); + } + + DWORD SetHoverTime(DWORD dwHoverTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); + return (DWORD)::SendMessage(m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime); + } + + BOOL GetNumberOfWorkAreas(int* pnWorkAreas) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas); + } +#endif // !_WIN32_WCE + + BOOL SetItemCountEx(int nItems, DWORD dwFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(((GetStyle() & LVS_OWNERDATA) != 0) && (((GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((GetStyle() & LVS_TYPEMASK) == LVS_LIST))); + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags); + } + +#ifndef _WIN32_WCE + CToolTipCtrl GetToolTips() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_GETTOOLTIPS, 0, 0L)); + } + + CToolTipCtrl SetToolTips(HWND hWndTT) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); + } + + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_WINNT >= 0x0501) + int GetSelectedColumn() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L); + } + + void SetSelectedColumn(int nColumn) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L); + } + + DWORD GetView() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, LVM_GETVIEW, 0, 0L); + } + + int SetView(DWORD dwView) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SETVIEW, dwView, 0L); + } + + BOOL IsGroupViewEnabled() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L); + } + + int GetGroupInfo(int nGroupID, PLVGROUP pGroup) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup); + } + + int SetGroupInfo(int nGroupID, PLVGROUP pGroup) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup); + } + + void GetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); + } + + void SetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); + } + + void GetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); + } + + BOOL SetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); + } + + void GetTileInfo(PLVTILEINFO pTileInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo); + } + + BOOL SetTileInfo(PLVTILEINFO pTileInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo); + } + + BOOL GetInsertMark(LPLVINSERTMARK pInsertMark) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark); + } + + BOOL SetInsertMark(LPLVINSERTMARK pInsertMark) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark); + } + + int GetInsertMarkRect(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect); + } + + COLORREF GetInsertMarkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L); + } + + COLORREF SetInsertMarkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr); + } + + COLORREF GetOutlineColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L); + } + + COLORREF SetOutlineColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, LVM_SETOUTLINECOLOR, 0, clr); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_WINNT >= 0x0600) + int GetGroupCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETGROUPCOUNT, 0, 0L); + } + + BOOL GetGroupInfoByIndex(int nIndex, PLVGROUP pGroup) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup); + } + + BOOL GetGroupRect(int nGroupID, int nType, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpRect != NULL); + if(lpRect != NULL) + lpRect->top = nType; + return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect); + } + + UINT GetGroupState(int nGroupID, UINT uMask) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask); + } + + int GetFocusedGroup() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L); + } + + BOOL GetEmptyText(LPWSTR lpstrText, int cchText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText); + } + + BOOL GetFooterRect(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect); + } + + BOOL GetFooterInfo(LPLVFOOTERINFO lpFooterInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo); + } + + BOOL GetFooterItemRect(int nItem, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect); + } + + BOOL GetFooterItem(int nItem, LPLVFOOTERITEM lpFooterItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem); + } + + BOOL GetItemIndexRect(PLVITEMINDEX pItemIndex, int nSubItem, int nType, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pItemIndex != NULL); + ATLASSERT(lpRect != NULL); + if(lpRect != NULL) + { + lpRect->top = nSubItem; + lpRect->left = nType; + } + return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect); + } + + BOOL SetItemIndexState(PLVITEMINDEX pItemIndex, UINT uState, UINT dwMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvi = { 0 }; + lvi.state = uState; + lvi.stateMask = dwMask; + return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi); + } + + BOOL GetNextItemIndex(PLVITEMINDEX pItemIndex, WORD wFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0)); + } +#endif // (_WIN32_WINNT >= 0x0600) + +// Operations + int InsertColumn(int nCol, const LVCOLUMN* pColumn) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); + } + + int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, + int nWidth = -1, int nSubItem = -1, int iImage = -1, int iOrder = -1) + { + LVCOLUMN column = { 0 }; + column.mask = LVCF_TEXT|LVCF_FMT; + column.pszText = (LPTSTR)lpszColumnHeading; + column.fmt = nFormat; + if (nWidth != -1) + { + column.mask |= LVCF_WIDTH; + column.cx = nWidth; + } + if (nSubItem != -1) + { + column.mask |= LVCF_SUBITEM; + column.iSubItem = nSubItem; + } + if (iImage != -1) + { + column.mask |= LVCF_IMAGE; + column.iImage = iImage; + } + if (iOrder != -1) + { + column.mask |= LVCF_ORDER; + column.iOrder = iOrder; + } + return InsertColumn(nCol, &column); + } + + BOOL DeleteColumn(int nCol) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_DELETECOLUMN, nCol, 0L); + } + + int InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM item = { 0 }; + item.mask = nMask; + item.iItem = nItem; + item.iSubItem = 0; + item.pszText = (LPTSTR)lpszItem; + item.state = nState; + item.stateMask = nStateMask; + item.iImage = nImage; + item.lParam = lParam; + return InsertItem(&item); + } + + int InsertItem(const LVITEM* pItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem); + } + + int InsertItem(int nItem, LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return InsertItem(LVIF_TEXT, nItem, lpszItem, 0, 0, 0, 0); + } + + int InsertItem(int nItem, LPCTSTR lpszItem, int nImage) + { + ATLASSERT(::IsWindow(m_hWnd)); + return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0); + } + + int GetNextItem(int nItem, int nFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0)); + } + + BOOL DeleteItem(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_DELETEITEM, nItem, 0L); + } + + BOOL DeleteAllItems() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_DELETEALLITEMS, 0, 0L); + } + + int FindItem(LVFINDINFO* pFindInfo, int nStart) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); + } + + int HitTest(LVHITTESTINFO* pHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo); + } + + int HitTest(POINT pt, UINT* pFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + LVHITTESTINFO hti = { 0 }; + hti.pt = pt; + int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti); + if (pFlags != NULL) + *pFlags = hti.flags; + return nRes; + } + + BOOL EnsureVisible(int nItem, BOOL bPartialOK) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); + } + + BOOL Scroll(SIZE size) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SCROLL, size.cx, size.cy); + } + + BOOL RedrawItems(int nFirst, int nLast) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_REDRAWITEMS, nFirst, nLast); + } + + BOOL Arrange(UINT nCode) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_ARRANGE, nCode, 0L); + } + + CEdit EditLabel(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CEdit((HWND)::SendMessage(m_hWnd, LVM_EDITLABEL, nItem, 0L)); + } + + BOOL Update(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_UPDATE, nItem, 0L); + } + + BOOL SortItems(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare); + } + + CImageList RemoveImageList(int nImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); + } + + CImageList CreateDragImage(int nItem, LPPOINT lpPoint) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint)); + } + + DWORD ApproximateViewRect(int cx = -1, int cy = -1, int nCount = -1) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy)); + } + + int SubItemHitTest(LPLVHITTESTINFO lpInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo); + } + + int AddColumn(LPCTSTR strItem, int nItem, int nSubItem = -1, + int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM, + int nFmt = LVCFMT_LEFT) + { + const int cxOffset = 15; + ATLASSERT(::IsWindow(m_hWnd)); + LVCOLUMN lvc = { 0 }; + lvc.mask = nMask; + lvc.fmt = nFmt; + lvc.pszText = (LPTSTR)strItem; + lvc.cx = GetStringWidth(lvc.pszText) + cxOffset; + if(nMask & LVCF_SUBITEM) + lvc.iSubItem = (nSubItem != -1) ? nSubItem : nItem; + return InsertColumn(nItem, &lvc); + } + + int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -1) + { + ATLASSERT(::IsWindow(m_hWnd)); + LVITEM lvItem = { 0 }; + lvItem.mask = LVIF_TEXT; + lvItem.iItem = nItem; + lvItem.iSubItem = nSubItem; + lvItem.pszText = (LPTSTR)strItem; + if(nImageIndex != -1) + { + lvItem.mask |= LVIF_IMAGE; + lvItem.iImage = nImageIndex; + } + if(nSubItem == 0) + return InsertItem(&lvItem); + return SetItem(&lvItem) ? nItem : -1; + } + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + BOOL SortItemsEx(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0501) + int InsertGroup(int nItem, PLVGROUP pGroup) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup); + } + + int AddGroup(PLVGROUP pGroup) + { + return InsertGroup(-1, pGroup); + } + + int RemoveGroup(int nGroupID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L); + } + + void MoveGroup(int nGroupID, int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_MOVEGROUP, nGroupID, nItem); + } + + void MoveItemToGroup(int nItem, int nGroupID) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID); + } + + int EnableGroupView(BOOL bEnable) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L); + } + + int SortGroups(PFNLVGROUPCOMPARE pCompareFunc, LPVOID lpVoid = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid); + } + + void InsertGroupSorted(PLVINSERTGROUPSORTED pInsertGroupSorted) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L); + } + + void RemoveAllGroups() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L); + } + + BOOL HasGroup(int nGroupID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_HASGROUP, nGroupID, 0L); + } + + BOOL InsertMarkHitTest(LPPOINT lpPoint, LPLVINSERTMARK pInsertMark) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark); + } + + BOOL SetInfoTip(PLVSETINFOTIP pSetInfoTip) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip); + } + + void CancelEditLabel() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, LVM_CANCELEDITLABEL, 0, 0L); + } + + UINT MapIndexToID(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L); + } + + int MapIDToIndex(UINT uID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_MAPIDTOINDEX, uID, 0L); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_WINNT >= 0x0600) + int HitTestEx(LPLVHITTESTINFO lpHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); + } + + int HitTestEx(POINT pt, UINT* pFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + LVHITTESTINFO hti = { 0 }; + hti.pt = pt; + int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti); + if (pFlags != NULL) + *pFlags = hti.flags; + return nRes; + } + + int SubItemHitTestEx(LPLVHITTESTINFO lpHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); + } +#endif // (_WIN32_WINNT >= 0x0600) + + // single-selection only + BOOL SelectItem(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); + + BOOL bRet = SetItemState(nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + if(bRet) + bRet = EnsureVisible(nIndex, FALSE); + return bRet; + } +}; + +typedef CListViewCtrlT CListViewCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CTreeViewCtrl + +template +class CTreeViewCtrlT : public TBase +{ +public: +// Constructors + CTreeViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CTreeViewCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_TREEVIEW; + } + + UINT GetCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, TVM_GETCOUNT, 0, 0L); + } + + UINT GetIndent() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, TVM_GETINDENT, 0, 0L); + } + + void SetIndent(UINT nIndent) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TVM_SETINDENT, nIndent, 0L); + } + + CImageList GetImageList(int nImageListType = TVSIL_NORMAL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L)); + } + + CImageList SetImageList(HIMAGELIST hImageList, int nImageListType = TVSIL_NORMAL) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList)); + } + + BOOL GetItem(LPTVITEM pItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); + } + + BOOL SetItem(LPTVITEM pItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); + } + + BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, + int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = nMask; + item.pszText = (LPTSTR) lpszItem; + item.iImage = nImage; + item.iSelectedImage = nSelectedImage; + item.state = nState; + item.stateMask = nStateMask; + item.lParam = lParam; + return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&item); + } + + BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpstrText != NULL); + + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_TEXT; + item.pszText = lpstrText; + item.cchTextMax = nLen; + + return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + } + +#ifndef _ATL_NO_COM + BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrText == NULL); + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_TEXT; + + LPTSTR lpstrText = NULL; + BOOL bRet = FALSE; + for(int nLen = 256; ; nLen *= 2) + { + ATLTRY(lpstrText = new TCHAR[nLen]); + if(lpstrText == NULL) + break; + lpstrText[0] = NULL; + item.pszText = lpstrText; + item.cchTextMax = nLen; + bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + if(!bRet || (lstrlen(item.pszText) < nLen - 1)) + break; + delete [] lpstrText; + lpstrText = NULL; + } + + if(lpstrText != NULL) + { + if(bRet) + bstrText = ::SysAllocString(T2OLE(lpstrText)); + delete [] lpstrText; + } + + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + BOOL GetItemText(HTREEITEM hItem, _CSTRING_NS::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_TEXT; + + strText.Empty(); + BOOL bRet = FALSE; + for(int nLen = 256; ; nLen *= 2) + { + item.pszText = strText.GetBufferSetLength(nLen); + if(item.pszText == NULL) + { + bRet = FALSE; + break; + } + item.cchTextMax = nLen; + bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + if(!bRet || (lstrlen(item.pszText) < nLen - 1)) + break; + } + strText.ReleaseBuffer(); + return bRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(hItem, TVIF_TEXT, lpszItem, 0, 0, 0, 0, NULL); + } + + BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE; + BOOL bRes = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + if (bRes) + { + nImage = item.iImage; + nSelectedImage = item.iSelectedImage; + } + return bRes; + } + + BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(hItem, TVIF_IMAGE|TVIF_SELECTEDIMAGE, NULL, nImage, nSelectedImage, 0, 0, NULL); + } + + UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const + { + ATLASSERT(::IsWindow(m_hWnd)); +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + return (((UINT)::SendMessage(m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask); +#else // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_STATE; + item.state = 0; + item.stateMask = nStateMask; + ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + return (item.state & nStateMask); +#endif // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) + } + + BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(hItem, TVIF_STATE, NULL, 0, 0, nState, nStateMask, NULL); + } + + DWORD_PTR GetItemData(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_PARAM; + BOOL bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + return (DWORD_PTR)(bRet ? item.lParam : NULL); + } + + BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(hItem, TVIF_PARAM, NULL, 0, 0, 0, 0, (LPARAM)dwData); + } + + CEdit GetEditControl() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CEdit((HWND)::SendMessage(m_hWnd, TVM_GETEDITCONTROL, 0, 0L)); + } + + UINT GetVisibleCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L); + } + + BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const + { + ATLASSERT(::IsWindow(m_hWnd)); + *(HTREEITEM*)lpRect = hItem; + return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect); + } + + BOOL ItemHasChildren(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVITEM item = { 0 }; + item.hItem = hItem; + item.mask = TVIF_CHILDREN; + ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + return item.cChildren; + } + +#ifndef _WIN32_WCE + CToolTipCtrl GetToolTips() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_GETTOOLTIPS, 0, 0L)); + } + + CToolTipCtrl SetToolTips(HWND hWndTT) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); + } +#endif // !_WIN32_WCE + + int GetISearchString(LPTSTR lpstr) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); + } + + // checkboxes only + BOOL GetCheckState(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & TVS_CHECKBOXES) != 0); + UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK); + return (uRet >> 12) - 1; + } + + BOOL SetCheckState(HTREEITEM hItem, BOOL bCheck) + { + int nCheck = bCheck ? 2 : 1; // one based index + return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(nCheck), TVIS_STATEIMAGEMASK); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + COLORREF GetBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_GETBKCOLOR, 0, 0L); + } + + COLORREF SetBkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr); + } + + COLORREF GetInsertMarkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L); + } + + COLORREF SetInsertMarkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr); + } + + int GetItemHeight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TVM_GETITEMHEIGHT, 0, 0L); + } + + int SetItemHeight(int cyHeight) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L); + } + + int GetScrollTime() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TVM_GETSCROLLTIME, 0, 0L); + } + + int SetScrollTime(int nScrollTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L); + } + + COLORREF GetTextColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_GETTEXTCOLOR, 0, 0L); + } + + COLORREF SetTextColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr); + } + + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + COLORREF GetLineColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_GETLINECOLOR, 0, 0L); + } + + COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL GetItem(LPTVITEMEX pItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); + } + + BOOL SetItem(LPTVITEMEX pItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + + DWORD GetExtendedStyle() const + { +#ifndef TVM_GETEXTENDEDSTYLE + const UINT TVM_GETEXTENDEDSTYLE = (TV_FIRST + 45); +#endif + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L); + } + + DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) + { +#ifndef TVM_SETEXTENDEDSTYLE + const UINT TVM_SETEXTENDEDSTYLE = (TV_FIRST + 44); +#endif + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle); + } + +#if (_WIN32_WINNT >= 0x0600) + BOOL SetAutoScrollInfo(UINT uPixPerSec, UINT uUpdateTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime); + } + + DWORD GetSelectedCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L); + } + + BOOL GetItemPartRect(HTREEITEM hItem, TVITEMPART partID, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVGETITEMPARTRECTINFO gipri = { hItem, lpRect, partID }; + return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri); + } +#endif // (_WIN32_WINNT >= 0x0600) + +// Operations + HTREEITEM InsertItem(LPTVINSERTSTRUCT lpInsertStruct) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); + } + + HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, + int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); + } + + HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); + } + + HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, + int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, + HTREEITEM hParent, HTREEITEM hInsertAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + TVINSERTSTRUCT tvis = { 0 }; + tvis.hParent = hParent; + tvis.hInsertAfter = hInsertAfter; + tvis.item.mask = nMask; + tvis.item.pszText = (LPTSTR) lpszItem; + tvis.item.iImage = nImage; + tvis.item.iSelectedImage = nSelectedImage; + tvis.item.state = nState; + tvis.item.stateMask = nStateMask; + tvis.item.lParam = lParam; + return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); + } + + BOOL DeleteItem(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem); + } + + BOOL DeleteAllItems() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); + } + + BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem); + } + + HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); + } + + HTREEITEM GetChildItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); + } + + HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); + } + + HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); + } + + HTREEITEM GetParentItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); + } + + HTREEITEM GetFirstVisibleItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); + } + + HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); + } + + HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); + } + + HTREEITEM GetSelectedItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); + } + + HTREEITEM GetDropHilightItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); + } + + HTREEITEM GetRootItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); + } + +#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) + HTREEITEM GetLastVisibleItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); + } +#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0600) + HTREEITEM GetNextSelectedItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); + } +#endif // (_WIN32_IE >= 0x0600) + + BOOL Select(HTREEITEM hItem, UINT nCode) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem); + } + + BOOL SelectItem(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); + } + + BOOL SelectDropTarget(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem); + } + + BOOL SelectSetFirstVisible(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem); + } + + CEdit EditLabel(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CEdit((HWND)::SendMessage(m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem)); + } + + BOOL EndEditLabelNow(BOOL bCancel) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L); + } + + HTREEITEM HitTest(TVHITTESTINFO* pHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); + } + + HTREEITEM HitTest(POINT pt, UINT* pFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVHITTESTINFO hti = { 0 }; + hti.pt = pt; + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); + if (pFlags != NULL) + *pFlags = hti.flags; + return hTreeItem; + } + + BOOL SortChildren(HTREEITEM hItem, BOOL bRecurse = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem); + } + + BOOL EnsureVisible(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem); + } + + BOOL SortChildrenCB(LPTVSORTCB pSort, BOOL bRecurse = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort); + } + + CImageList RemoveImageList(int nImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); + } + + CImageList CreateDragImage(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem)); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem); + } + + BOOL RemoveInsertMark() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, 0, 0L); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0501) + HTREEITEM MapAccIDToHTREEITEM(UINT uID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); + } + + UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_WINNT >= 0x0600) + void ShowInfoTip(HTREEITEM hItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem); + } +#endif // (_WIN32_WINNT >= 0x0600) +}; + +typedef CTreeViewCtrlT CTreeViewCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CTreeViewCtrlEx + +// forward declaration +template class CTreeViewCtrlExT; + +// Note: TBase here is for CTreeViewCtrlExT, and not for CTreeItemT itself +template +class CTreeItemT +{ +public: + HTREEITEM m_hTreeItem; + CTreeViewCtrlExT* m_pTreeView; + +// Construction + CTreeItemT(HTREEITEM hTreeItem = NULL, CTreeViewCtrlExT* pTreeView = NULL) : m_hTreeItem(hTreeItem), m_pTreeView(pTreeView) + { } + + CTreeItemT(const CTreeItemT& posSrc) + { + *this = posSrc; + } + + operator HTREEITEM() { return m_hTreeItem; } + + CTreeItemT& operator =(const CTreeItemT& itemSrc) + { + m_hTreeItem = itemSrc.m_hTreeItem; + m_pTreeView = itemSrc.m_pTreeView; + return *this; + } + +// Attributes + CTreeViewCtrlExT* GetTreeView() const { return m_pTreeView; } + + BOOL operator !() const { return m_hTreeItem == NULL; } + + BOOL IsNull() const { return m_hTreeItem == NULL; } + + BOOL GetRect(LPRECT lpRect, BOOL bTextOnly) const; + BOOL GetText(LPTSTR lpstrText, int nLen) const; +#ifndef _ATL_NO_COM + BOOL GetText(BSTR& bstrText) const; +#endif // !_ATL_NO_COM +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + BOOL GetText(_CSTRING_NS::CString& strText) const; +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + BOOL SetText(LPCTSTR lpszItem); + BOOL GetImage(int& nImage, int& nSelectedImage) const; + BOOL SetImage(int nImage, int nSelectedImage); + UINT GetState(UINT nStateMask) const; + BOOL SetState(UINT nState, UINT nStateMask); + DWORD_PTR GetData() const; + BOOL SetData(DWORD_PTR dwData); + BOOL SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam); + +// Operations + CTreeItemT InsertAfter(LPCTSTR lpstrItem, HTREEITEM hItemAfter, int nImageIndex) + { + return _Insert(lpstrItem, nImageIndex, hItemAfter); + } + + CTreeItemT AddHead(LPCTSTR lpstrItem, int nImageIndex) + { + return _Insert(lpstrItem, nImageIndex, TVI_FIRST); + } + + CTreeItemT AddTail(LPCTSTR lpstrItem, int nImageIndex) + { + return _Insert(lpstrItem, nImageIndex, TVI_LAST); + } + + CTreeItemT GetChild() const; + CTreeItemT GetNext(UINT nCode) const; + CTreeItemT GetNextSibling() const; + CTreeItemT GetPrevSibling() const; + CTreeItemT GetParent() const; + CTreeItemT GetFirstVisible() const; + CTreeItemT GetNextVisible() const; + CTreeItemT GetPrevVisible() const; + CTreeItemT GetSelected() const; + CTreeItemT GetDropHilight() const; + CTreeItemT GetRoot() const; +#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) + CTreeItemT GetLastVisible() const; +#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) +#if (_WIN32_IE >= 0x0600) + CTreeItemT GetNextSelected() const; +#endif // (_WIN32_IE >= 0x0600) + BOOL HasChildren() const; + BOOL Delete(); + BOOL Expand(UINT nCode = TVE_EXPAND); + BOOL Select(UINT nCode); + BOOL Select(); + BOOL SelectDropTarget(); + BOOL SelectSetFirstVisible(); + HWND EditLabel(); + HIMAGELIST CreateDragImage(); + BOOL SortChildren(BOOL bRecurse = FALSE); + BOOL EnsureVisible(); + CTreeItemT _Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter); + int GetImageIndex() const; +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL SetInsertMark(BOOL bAfter); +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) +#if (_WIN32_WINNT >= 0x0501) + UINT MapHTREEITEMToAccID() const; +#endif // (_WIN32_WINNT >= 0x0501) +#if (_WIN32_WINNT >= 0x0600) + void ShowInfoTip(); + BOOL GetPartRect(TVITEMPART partID, LPRECT lpRect) const; +#endif // (_WIN32_WINNT >= 0x0600) +}; + +typedef CTreeItemT CTreeItem; + + +template +class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > +{ +public: +// Constructors + CTreeViewCtrlExT(HWND hWnd = NULL) : CTreeViewCtrlT< TBase >(hWnd) + { } + + CTreeViewCtrlExT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Operations (overides that return CTreeItem) + CTreeItemT InsertItem(LPTVINSERTSTRUCT lpInsertStruct) + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); + return CTreeItemT(hTreeItem, this); + } + + CTreeItemT InsertItem(LPCTSTR lpszItem, int nImage, + int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); + } + + CTreeItemT InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); + } + + CTreeItemT GetNextItem(HTREEITEM hItem, UINT nCode) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetChildItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetNextSiblingItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetPrevSiblingItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetParentItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetFirstVisibleItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetNextVisibleItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetPrevVisibleItem(HTREEITEM hItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetSelectedItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetDropHilightItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT GetRootItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + +#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) + CTreeItemT GetLastVisibleItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } +#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0600) + CTreeItemT GetNextSelectedItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } +#endif // (_WIN32_IE >= 0x0600) + + CTreeItemT HitTest(TVHITTESTINFO* pHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + + CTreeItemT InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, + int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, + HTREEITEM hParent, HTREEITEM hInsertAfter) + { + ATLASSERT(::IsWindow(m_hWnd)); + TVINSERTSTRUCT tvis = { 0 }; + tvis.hParent = hParent; + tvis.hInsertAfter = hInsertAfter; + tvis.item.mask = nMask; + tvis.item.pszText = (LPTSTR) lpszItem; + tvis.item.iImage = nImage; + tvis.item.iSelectedImage = nSelectedImage; + tvis.item.state = nState; + tvis.item.stateMask = nStateMask; + tvis.item.lParam = lParam; + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); + return CTreeItemT(hTreeItem, this); + } + + CTreeItemT HitTest(POINT pt, UINT* pFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TVHITTESTINFO hti = { 0 }; + hti.pt = pt; + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); + if (pFlags != NULL) + *pFlags = hti.flags; + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } + +#if (_WIN32_WINNT >= 0x0501) + CTreeItemT MapAccIDToHTREEITEM(UINT uID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); + return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); + } +#endif // (_WIN32_WINNT >= 0x0501) +}; + +typedef CTreeViewCtrlExT CTreeViewCtrlEx; + + +// CTreeItem inline methods +template +inline BOOL CTreeItemT::GetRect(LPRECT lpRect, BOOL bTextOnly) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemRect(m_hTreeItem,lpRect,bTextOnly); +} + +template +inline CTreeItemT CTreeItemT::GetNext(UINT nCode) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetNextItem(m_hTreeItem,nCode); +} + +template +inline CTreeItemT CTreeItemT::GetChild() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetChildItem(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::GetNextSibling() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetNextSiblingItem(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::GetPrevSibling() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetPrevSiblingItem(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::GetParent() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetParentItem(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::GetFirstVisible() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetFirstVisibleItem(); +} + +template +inline CTreeItemT CTreeItemT::GetNextVisible() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetNextVisibleItem(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::GetPrevVisible() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetPrevVisibleItem(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::GetSelected() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetSelectedItem(); +} + +template +inline CTreeItemT CTreeItemT::GetDropHilight() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetDropHilightItem(); +} + +template +inline CTreeItemT CTreeItemT::GetRoot() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetRootItem(); +} + +#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) +template +inline CTreeItemT CTreeItemT::GetLastVisible() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetLastVisibleItem(); +} +#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0600) +template +inline CTreeItemT CTreeItemT::GetNextSelected() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetNextSelectedItem(); +} +#endif // (_WIN32_IE >= 0x0600) + +template +inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemText(m_hTreeItem, lpstrText, nLen); +} + +#ifndef _ATL_NO_COM +#ifdef _OLEAUTO_H_ +template +inline BOOL CTreeItemT::GetText(BSTR& bstrText) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemText(m_hTreeItem, bstrText); +} +#endif // _OLEAUTO_H_ +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +template +inline BOOL CTreeItemT::GetText(_CSTRING_NS::CString& strText) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemText(m_hTreeItem, strText); +} +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + +template +inline BOOL CTreeItemT::GetImage(int& nImage, int& nSelectedImage) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemImage(m_hTreeItem,nImage,nSelectedImage); +} + +template +inline UINT CTreeItemT::GetState(UINT nStateMask) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemState(m_hTreeItem,nStateMask); +} + +template +inline DWORD_PTR CTreeItemT::GetData() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemData(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, + int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SetItem(m_hTreeItem, nMask, lpszItem, nImage, nSelectedImage, nState, nStateMask, lParam); +} + +template +inline BOOL CTreeItemT::SetText(LPCTSTR lpszItem) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SetItemText(m_hTreeItem,lpszItem); +} + +template +inline BOOL CTreeItemT::SetImage(int nImage, int nSelectedImage) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SetItemImage(m_hTreeItem,nImage,nSelectedImage); +} + +template +inline BOOL CTreeItemT::SetState(UINT nState, UINT nStateMask) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SetItemState(m_hTreeItem,nState,nStateMask); +} + +template +inline BOOL CTreeItemT::SetData(DWORD_PTR dwData) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SetItemData(m_hTreeItem,dwData); +} + +template +inline BOOL CTreeItemT::HasChildren() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->ItemHasChildren(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::Delete() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->DeleteItem(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::Expand(UINT nCode /*= TVE_EXPAND*/) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->Expand(m_hTreeItem,nCode); +} + +template +inline BOOL CTreeItemT::Select(UINT nCode) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->Select(m_hTreeItem,nCode); +} + +template +inline BOOL CTreeItemT::Select() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SelectItem(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::SelectDropTarget() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SelectDropTarget(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::SelectSetFirstVisible() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SelectSetFirstVisible(m_hTreeItem); +} + +template +inline HWND CTreeItemT::EditLabel() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->EditLabel(m_hTreeItem); +} + +template +inline HIMAGELIST CTreeItemT::CreateDragImage() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->CreateDragImage(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::SortChildren(BOOL bRecurse /*= FALSE*/) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SortChildren(m_hTreeItem, bRecurse); +} + +template +inline BOOL CTreeItemT::EnsureVisible() +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->EnsureVisible(m_hTreeItem); +} + +template +inline CTreeItemT CTreeItemT::_Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter) +{ + ATLASSERT(m_pTreeView != NULL); + TVINSERTSTRUCT ins = { 0 }; + ins.hParent = m_hTreeItem; + ins.hInsertAfter = hItemAfter; + ins.item.mask = TVIF_TEXT; + ins.item.pszText = (LPTSTR)lpstrItem; + if(nImageIndex != -1) + { + ins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; + ins.item.iImage = nImageIndex; + ins.item.iSelectedImage = nImageIndex; + } + return CTreeItemT(m_pTreeView->InsertItem(&ins), m_pTreeView); +} + +template +inline int CTreeItemT::GetImageIndex() const +{ + ATLASSERT(m_pTreeView != NULL); + TVITEM item = { 0 }; + item.mask = TVIF_HANDLE | TVIF_IMAGE; + item.hItem = m_hTreeItem; + m_pTreeView->GetItem(&item); + return item.iImage; +} + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) +template +inline BOOL CTreeItemT::SetInsertMark(BOOL bAfter) +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->SetInsertMark(m_hTreeItem, bAfter); +} +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0501) +template +inline UINT CTreeItemT::MapHTREEITEMToAccID() const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->MapHTREEITEMToAccID(m_hTreeItem); +} +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_WINNT >= 0x0600) +template +inline void CTreeItemT::ShowInfoTip() +{ + ATLASSERT(m_pTreeView != NULL); + m_pTreeView->ShowInfoTip(m_hTreeItem); +} + +template +inline BOOL CTreeItemT::GetPartRect(TVITEMPART partID, LPRECT lpRect) const +{ + ATLASSERT(m_pTreeView != NULL); + return m_pTreeView->GetItemPartRect(m_hTreeItem, partID, lpRect); +} +#endif // (_WIN32_WINNT >= 0x0600) + + +/////////////////////////////////////////////////////////////////////////////// +// CToolBarCtrl + +template +class CToolBarCtrlT : public TBase +{ +public: +// Construction + CToolBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CToolBarCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return TOOLBARCLASSNAME; + } + + BOOL IsButtonEnabled(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONENABLED, nID, 0L); + } + + BOOL IsButtonChecked(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONCHECKED, nID, 0L); + } + + BOOL IsButtonPressed(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONPRESSED, nID, 0L); + } + + BOOL IsButtonHidden(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return(BOOL) ::SendMessage(m_hWnd, TB_ISBUTTONHIDDEN, nID, 0L); + } + + BOOL IsButtonIndeterminate(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONINDETERMINATE, nID, 0L); + } + + int GetState(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETSTATE, nID, 0L); + } + + BOOL SetState(int nID, UINT nState) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETSTATE, nID, MAKELPARAM(nState, 0)); + } + + BOOL GetButton(int nIndex, LPTBBUTTON lpButton) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETBUTTON, nIndex, (LPARAM)lpButton); + } + + int GetButtonCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_BUTTONCOUNT, 0, 0L); + } + + BOOL GetItemRect(int nIndex, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETITEMRECT, nIndex, (LPARAM)lpRect); + } + + void SetButtonStructSize(int nSize = sizeof(TBBUTTON)) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_BUTTONSTRUCTSIZE, nSize, 0L); + } + + BOOL SetButtonSize(SIZE size) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy)); + } + + BOOL SetButtonSize(int cx, int cy) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy)); + } + + BOOL SetBitmapSize(SIZE size) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy)); + } + + BOOL SetBitmapSize(int cx, int cy) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy)); + } + +#ifndef _WIN32_WCE + CToolTipCtrl GetToolTips() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TB_GETTOOLTIPS, 0, 0L)); + } + + void SetToolTips(HWND hWndToolTip) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); + } +#endif // !_WIN32_WCE + + void SetNotifyWnd(HWND hWnd) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETPARENT, (WPARAM)hWnd, 0L); + } + + int GetRows() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETROWS, 0, 0L); + } + + void SetRows(int nRows, BOOL bLarger, LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); + } + + BOOL SetCmdID(int nIndex, UINT nID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETCMDID, nIndex, nID); + } + + DWORD GetBitmapFlags() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TB_GETBITMAPFLAGS, 0, 0L); + } + + int GetBitmap(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETBITMAP, nID, 0L); + } + + int GetButtonText(int nID, LPTSTR lpstrText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText); + } + + // nIndex - IE5 or higher only + CImageList GetImageList(int nIndex = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETIMAGELIST, nIndex, 0L)); + } + + // nIndex - IE5 or higher only + CImageList SetImageList(HIMAGELIST hImageList, int nIndex = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList)); + } + + // nIndex - IE5 or higher only + CImageList GetDisabledImageList(int nIndex = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETDISABLEDIMAGELIST, nIndex, 0L)); + } + + // nIndex - IE5 or higher only + CImageList SetDisabledImageList(HIMAGELIST hImageList, int nIndex = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList)); + } + +#ifndef _WIN32_WCE + // nIndex - IE5 or higher only + CImageList GetHotImageList(int nIndex = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETHOTIMAGELIST, nIndex, 0L)); + } + + // nIndex - IE5 or higher only + CImageList SetHotImageList(HIMAGELIST hImageList, int nIndex = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList)); + } +#endif // !_WIN32_WCE + + DWORD GetStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TB_GETSTYLE, 0, 0L); + } + + void SetStyle(DWORD dwStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETSTYLE, 0, dwStyle); + } + + DWORD GetButtonSize() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); + } + + void GetButtonSize(SIZE& size) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); + size.cx = LOWORD(dwRet); + size.cy = HIWORD(dwRet); + } + + BOOL GetRect(int nID, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETRECT, nID, (LPARAM)lpRect); + } + + int GetTextRows() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETTEXTROWS, 0, 0L); + } + + BOOL SetButtonWidth(int cxMin, int cxMax) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); + } + + BOOL SetIndent(int nIndent) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETINDENT, nIndent, 0L); + } + + BOOL SetMaxTextRows(int nMaxTextRows) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETMAXTEXTROWS, nMaxTextRows, 0L); + } + +#if (_WIN32_IE >= 0x0400) +#ifndef _WIN32_WCE + BOOL GetAnchorHighlight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0L); + } + + BOOL SetAnchorHighlight(BOOL bEnable = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETANCHORHIGHLIGHT, bEnable, 0L); + } +#endif // !_WIN32_WCE + + int GetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi); + } + + BOOL SetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi); + } + + BOOL SetButtonInfo(int nID, DWORD dwMask, BYTE Style, BYTE State, LPCTSTR lpszItem, + int iImage, WORD cx, int iCommand, DWORD_PTR lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + TBBUTTONINFO tbbi = { 0 }; + tbbi.cbSize = sizeof(TBBUTTONINFO); + tbbi.dwMask = dwMask; + tbbi.idCommand = iCommand; + tbbi.iImage = iImage; + tbbi.fsState = State; + tbbi.fsStyle = Style; + tbbi.cx = cx; + tbbi.pszText = (LPTSTR) lpszItem; + tbbi.lParam = lParam; + return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi); + } + +#ifndef _WIN32_WCE + int GetHotItem() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETHOTITEM, 0, 0L); + } + + int SetHotItem(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_SETHOTITEM, nItem, 0L); + } +#endif // !_WIN32_WCE + + BOOL IsButtonHighlighted(int nButtonID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L); + } + + DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags); + } + +#ifndef _WIN32_WCE + BOOL GetColorScheme(LPCOLORSCHEME lpcs) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs); + } + + void SetColorScheme(LPCOLORSCHEME lpcs) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs); + } + + DWORD GetExtendedStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); + } + + DWORD SetExtendedStyle(DWORD dwStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwStyle); + } + + void GetInsertMark(LPTBINSERTMARK lptbim) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)lptbim); + } + + void SetInsertMark(LPTBINSERTMARK lptbim) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)lptbim); + } + + COLORREF GetInsertMarkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0L); + } + + COLORREF SetInsertMarkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr); + } + + BOOL GetMaxSize(LPSIZE lpSize) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)lpSize); + } + + void GetPadding(LPSIZE lpSizePadding) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpSizePadding != NULL); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETPADDING, 0, 0L); + lpSizePadding->cx = GET_X_LPARAM(dwRet); + lpSizePadding->cy = GET_Y_LPARAM(dwRet); + } + + void SetPadding(int cx, int cy, LPSIZE lpSizePadding = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_SETPADDING, 0, MAKELPARAM(cx, cy)); + if(lpSizePadding != NULL) + { + lpSizePadding->cx = GET_X_LPARAM(dwRet); + lpSizePadding->cy = GET_Y_LPARAM(dwRet); + } + } + + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + int GetString(int nString, LPTSTR lpstrString, int cchMaxLen) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString); + } + + int GetStringBSTR(int nString, BSTR& bstrString) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrString == NULL); + int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); + if(nLength != -1) + { + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(nLength + 1); + if(lpstrText != NULL) + { + nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstrText); + if(nLength != -1) + bstrString = ::SysAllocString(T2OLE(lpstrText)); + } + else + { + nLength = -1; + } + } + + return nLength; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetString(int nString, _CSTRING_NS::CString& str) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); + if(nLength != -1) + { + LPTSTR lpstr = str.GetBufferSetLength(nLength + 1); + if(lpstr != NULL) + nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr); + else + nLength = -1; + str.ReleaseBuffer(); + } + return nLength; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0501) + void GetMetrics(LPTBMETRICS lptbm) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_GETMETRICS, 0, (LPARAM)lptbm); + } + + void SetMetrics(LPTBMETRICS lptbm) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETMETRICS, 0, (LPARAM)lptbm); + } + + void SetWindowTheme(LPCWSTR lpstrTheme) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_WINNT >= 0x0600) + CImageList GetPressedImageList(int nIndex = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETPRESSEDIMAGELIST, nIndex, 0L)); + } + + CImageList SetPressedImageList(HIMAGELIST hImageList, int nIndex = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList)); + } +#endif // (_WIN32_WINNT >= 0x0600) + +// Operations + BOOL EnableButton(int nID, BOOL bEnable = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); + } + + BOOL CheckButton(int nID, BOOL bCheck = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); + } + + BOOL PressButton(int nID, BOOL bPress = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); + } + + BOOL HideButton(int nID, BOOL bHide = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); + } + + BOOL Indeterminate(int nID, BOOL bIndeterminate = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); + } + + int AddBitmap(int nNumButtons, UINT nBitmapID) + { + ATLASSERT(::IsWindow(m_hWnd)); + TBADDBITMAP tbab = { 0 }; + tbab.hInst = ModuleHelper::GetResourceInstance(); + ATLASSERT(tbab.hInst != NULL); + tbab.nID = nBitmapID; + return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); + } + + int AddBitmap(int nNumButtons, HBITMAP hBitmap) + { + ATLASSERT(::IsWindow(m_hWnd)); + TBADDBITMAP tbab = { 0 }; + tbab.hInst = NULL; + tbab.nID = (UINT_PTR)hBitmap; + return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); + } + + BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); + } + + BOOL InsertButton(int nIndex, LPTBBUTTON lpButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); + } + + BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, + INT_PTR iString, DWORD_PTR lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + TBBUTTON tbb = { 0 }; + tbb.fsStyle = Style; + tbb.fsState = State; + tbb.idCommand = iCommand; + tbb.iBitmap = iBitmap; + tbb.iString = iString; + tbb.dwData = lParam; + return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb); + } + + BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, + LPCTSTR lpszItem, DWORD_PTR lParam) + { + return InsertButton(nIndex, iCommand, Style, State, iBitmap, (INT_PTR)lpszItem, lParam); + } + + BOOL AddButton(LPTBBUTTON lpButton) + { + return InsertButton(-1, lpButton); + } + + BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam) + { + return InsertButton(-1, iCommand, Style, State, iBitmap, iString, lParam); + } + + BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, LPCTSTR lpszItem, DWORD_PTR lParam) + { + return InsertButton(-1, iCommand, Style, State, iBitmap, lpszItem, lParam); + } + + BOOL DeleteButton(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_DELETEBUTTON, nIndex, 0L); + } + + UINT CommandToIndex(UINT nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, TB_COMMANDTOINDEX, nID, 0L); + } + +#ifndef _WIN32_WCE + void SaveState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) + { + ATLASSERT(::IsWindow(m_hWnd)); + TBSAVEPARAMS tbs = { 0 }; + tbs.hkr = hKeyRoot; + tbs.pszSubKey = lpszSubKey; + tbs.pszValueName = lpszValueName; + ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs); + } + + void RestoreState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) + { + ATLASSERT(::IsWindow(m_hWnd)); + TBSAVEPARAMS tbs = { 0 }; + tbs.hkr = hKeyRoot; + tbs.pszSubKey = lpszSubKey; + tbs.pszValueName = lpszValueName; + ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs); + } + + void Customize() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_CUSTOMIZE, 0, 0L); + } +#endif // !_WIN32_WCE + + int AddString(UINT nStringID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_ADDSTRING, (WPARAM)ModuleHelper::GetResourceInstance(), (LPARAM)nStringID); + } + + int AddStrings(LPCTSTR lpszStrings) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_ADDSTRING, 0, (LPARAM)lpszStrings); + } + + void AutoSize() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TB_AUTOSIZE, 0, 0L); + } + + BOOL ChangeBitmap(int nID, int nBitmap) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0)); + } + + int LoadImages(int nBitmapID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)ModuleHelper::GetResourceInstance()); + } + + int LoadStdImages(int nBitmapID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL); + } + + BOOL ReplaceBitmap(LPTBREPLACEBITMAP ptbrb) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb); + } + +#if (_WIN32_IE >= 0x0400) + int HitTest(LPPOINT lpPoint) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)lpPoint); + } + +#ifndef _WIN32_WCE + BOOL InsertMarkHitTest(LPPOINT lpPoint, LPTBINSERTMARK lptbim) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim); + } + + BOOL InsertMarkHitTest(int x, int y, LPTBINSERTMARK lptbim) const + { + ATLASSERT(::IsWindow(m_hWnd)); + POINT pt = { x, y }; + return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim); + } + + BOOL MapAccelerator(TCHAR chAccel, int& nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID); + } + + BOOL MarkButton(int nID, BOOL bHighlight = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); + } + + BOOL MoveButton(int nOldPos, int nNewPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); + } + + HRESULT GetObject(REFIID iid, LPVOID* ppvObject) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HRESULT)::SendMessage(m_hWnd, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) +}; + +typedef CToolBarCtrlT CToolBarCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CStatusBarCtrl + +template +class CStatusBarCtrlT : public TBase +{ +public: +// Constructors + CStatusBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CStatusBarCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Methods + static LPCTSTR GetWndClassName() + { + return STATUSCLASSNAME; + } + + int GetParts(int nParts, int* pParts) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, SB_GETPARTS, nParts, (LPARAM)pParts); + } + + BOOL SetParts(int nParts, int* pWidths) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths); + } + + int GetTextLength(int nPane, int* pType = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L); + if (pType != NULL) + *pType = (int)(short)HIWORD(dwRet); + return (int)(short)LOWORD(dwRet); + } + + int GetText(int nPane, LPTSTR lpszText, int* pType = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXT, (WPARAM)nPane, (LPARAM)lpszText); + if(pType != NULL) + *pType = (int)(short)HIWORD(dwRet); + return (int)(short)LOWORD(dwRet); + } + +#ifndef _ATL_NO_COM + BOOL GetTextBSTR(int nPane, BSTR& bstrText, int* pType = NULL) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + ATLASSERT(bstrText == NULL); + int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); + if(nLength == 0) + return FALSE; + + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(nLength + 1); + if(lpstrText == NULL) + return FALSE; + + if(!GetText(nPane, lpstrText, pType)) + return FALSE; + + bstrText = ::SysAllocString(T2OLE(lpstrText)); + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetText(int nPane, _CSTRING_NS::CString& strText, int* pType = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); + if(nLength == 0) + return 0; + + LPTSTR lpstr = strText.GetBufferSetLength(nLength); + if(lpstr == NULL) + return 0; + return GetText(nPane, lpstr, pType); + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + BOOL SetText(int nPane, LPCTSTR lpszText, int nType = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + return (BOOL)::SendMessage(m_hWnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); + } + + BOOL GetRect(int nPane, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + return (BOOL)::SendMessage(m_hWnd, SB_GETRECT, nPane, (LPARAM)lpRect); + } + + BOOL GetBorders(int* pBorders) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)pBorders); + } + + BOOL GetBorders(int& nHorz, int& nVert, int& nSpacing) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int borders[3] = { 0, 0, 0 }; + BOOL bResult = (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); + if(bResult) + { + nHorz = borders[0]; + nVert = borders[1]; + nSpacing = borders[2]; + } + return bResult; + } + + void SetMinHeight(int nMin) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, SB_SETMINHEIGHT, nMin, 0L); + } + + BOOL SetSimple(BOOL bSimple = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, SB_SIMPLE, bSimple, 0L); + } + + BOOL IsSimple() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, SB_ISSIMPLE, 0, 0L); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, SB_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, SB_SETUNICODEFORMAT, bUnicode, 0L); + } + + void GetTipText(int nPane, LPTSTR lpstrText, int nSize) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + ::SendMessage(m_hWnd, SB_GETTIPTEXT, MAKEWPARAM(nPane, nSize), (LPARAM)lpstrText); + } + + void SetTipText(int nPane, LPCTSTR lpstrText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + ::SendMessage(m_hWnd, SB_SETTIPTEXT, nPane, (LPARAM)lpstrText); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) + COLORREF SetBkColor(COLORREF clrBk) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, SB_SETBKCOLOR, 0, (LPARAM)clrBk); + } + + HICON GetIcon(int nPane) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + return (HICON)::SendMessage(m_hWnd, SB_GETICON, nPane, 0L); + } + + BOOL SetIcon(int nPane, HICON hIcon) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPane < 256); + return (BOOL)::SendMessage(m_hWnd, SB_SETICON, nPane, (LPARAM)hIcon); + } +#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) +}; + +typedef CStatusBarCtrlT CStatusBarCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CTabCtrl + +template +class CTabCtrlT : public TBase +{ +public: +// Constructors + CTabCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CTabCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_TABCONTROL; + } + + CImageList GetImageList() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_GETIMAGELIST, 0, 0L)); + } + + CImageList SetImageList(HIMAGELIST hImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_SETIMAGELIST, 0, (LPARAM)hImageList)); + } + + int GetItemCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_GETITEMCOUNT, 0, 0L); + } + + BOOL GetItem(int nItem, LPTCITEM pTabCtrlItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); + } + + BOOL SetItem(int nItem, LPTCITEM pTabCtrlItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); + } + + int SetItem(int nItem, UINT mask, LPCTSTR lpszItem, DWORD dwState, DWORD dwStateMask, int iImage, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + TCITEM tci = { 0 }; + tci.mask = mask; + tci.pszText = (LPTSTR) lpszItem; + tci.dwState = dwState; + tci.dwStateMask = dwStateMask; + tci.iImage = iImage; + tci.lParam = lParam; + return (int)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)&tci); + } + + BOOL GetItemRect(int nItem, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_GETITEMRECT, nItem, (LPARAM)lpRect); + } + + int GetCurSel() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_GETCURSEL, 0, 0L); + } + + int SetCurSel(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_SETCURSEL, nItem, 0L); + } + + SIZE SetItemSize(SIZE size) + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwSize = (DWORD)::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(size.cx, size.cy)); + SIZE sizeRet = { GET_X_LPARAM(dwSize), GET_Y_LPARAM(dwSize) }; + return sizeRet; + } + + void SetItemSize(int cx, int cy) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(cx, cy)); + } + + void SetPadding(SIZE size) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_SETPADDING, 0, MAKELPARAM(size.cx, size.cy)); + } + + int GetRowCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_GETROWCOUNT, 0, 0L); + } + +#ifndef _WIN32_WCE + CToolTipCtrl GetTooltips() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TCM_GETTOOLTIPS, 0, 0L)); + } + + void SetTooltips(HWND hWndToolTip) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); + } +#endif // !_WIN32_WCE + + int GetCurFocus() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_GETCURFOCUS, 0, 0L); + } + + void SetCurFocus(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_SETCURFOCUS, nItem, 0L); + } + + BOOL SetItemExtra(int cbExtra) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetItemCount() == 0); // must be empty + return (BOOL)::SendMessage(m_hWnd, TCM_SETITEMEXTRA, cbExtra, 0L); + } + + int SetMinTabWidth(int nWidth = -1) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_SETMINTABWIDTH, 0, nWidth); + } + +#if (_WIN32_IE >= 0x0400) + DWORD GetExtendedStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TCM_GETEXTENDEDSTYLE, 0, 0L); + } + + DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, TCM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); + } + +#ifndef _WIN32_WCE + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) + +// Operations + int InsertItem(int nItem, LPTCITEM pTabCtrlItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); + } + + int InsertItem(int nItem, UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + TCITEM tci = { 0 }; + tci.mask = mask; + tci.pszText = (LPTSTR) lpszItem; + tci.iImage = iImage; + tci.lParam = lParam; + return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); + } + + int InsertItem(int nItem, LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + TCITEM tci = { 0 }; + tci.mask = TCIF_TEXT; + tci.pszText = (LPTSTR) lpszItem; + return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); + } + + int AddItem(LPTCITEM pTabCtrlItem) + { + return InsertItem(GetItemCount(), pTabCtrlItem); + } + + int AddItem(UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) + { + return InsertItem(GetItemCount(), mask, lpszItem, iImage, lParam); + } + + int AddItem(LPCTSTR lpszItem) + { + return InsertItem(GetItemCount(), lpszItem); + } + + BOOL DeleteItem(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_DELETEITEM, nItem, 0L); + } + + BOOL DeleteAllItems() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_DELETEALLITEMS, 0, 0L); + } + + void AdjustRect(BOOL bLarger, LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_ADJUSTRECT, bLarger, (LPARAM)lpRect); + } + + void RemoveImage(int nImage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_REMOVEIMAGE, nImage, 0L); + } + + int HitTest(TC_HITTESTINFO* pHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)pHitTestInfo); + } + + void DeselectAll(BOOL bExcludeFocus = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TCM_DESELECTALL, bExcludeFocus, 0L); + } + +#if (_WIN32_IE >= 0x0400) + BOOL HighlightItem(int nIndex, BOOL bHighlight = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TCM_HIGHLIGHTITEM, nIndex, MAKELPARAM(bHighlight, 0)); + } +#endif // (_WIN32_IE >= 0x0400) +}; + +typedef CTabCtrlT CTabCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CTrackBarCtrl + +template +class CTrackBarCtrlT : public TBase +{ +public: +// Constructors + CTrackBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CTrackBarCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return TRACKBAR_CLASS; + } + + int GetLineSize() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETLINESIZE, 0, 0L); + } + + int SetLineSize(int nSize) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_SETLINESIZE, 0, nSize); + } + + int GetPageSize() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETPAGESIZE, 0, 0L); + } + + int SetPageSize(int nSize) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_SETPAGESIZE, 0, nSize); + } + + int GetRangeMin() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETRANGEMIN, 0, 0L); + } + + void SetRangeMin(int nMin, BOOL bRedraw = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETRANGEMIN, bRedraw, nMin); + } + + int GetRangeMax() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETRANGEMAX, 0, 0L); + } + + void SetRangeMax(int nMax, BOOL bRedraw = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETRANGEMAX, bRedraw, nMax); + } + + void GetRange(int& nMin, int& nMax) const + { + nMin = GetRangeMin(); + nMax = GetRangeMax(); + } + + void SetRange(int nMin, int nMax, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETRANGE, bRedraw, MAKELPARAM(nMin, nMax)); + } + + int GetSelStart() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETSELSTART, 0, 0L); + } + + void SetSelStart(int nMin) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETSELSTART, 0, (LPARAM)nMin); + } + + int GetSelEnd() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETSELEND, 0, 0L); + } + + void SetSelEnd(int nMax) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETSELEND, 0, (LPARAM)nMax); + } + + void GetSelection(int& nMin, int& nMax) const + { + nMin = GetSelStart(); + nMax = GetSelEnd(); + } + + void SetSelection(int nMin, int nMax) + { + SetSelStart(nMin); + SetSelEnd(nMax); + } + + void GetChannelRect(LPRECT lprc) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc); + } + + void GetThumbRect(LPRECT lprc) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc); + } + + int GetPos() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETPOS, 0, 0L); + } + + void SetPos(int nPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETPOS, TRUE, nPos); + } + + UINT GetNumTics() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, TBM_GETNUMTICS, 0, 0L); + } + + DWORD* GetTicArray() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD*)::SendMessage(m_hWnd, TBM_GETPTICS, 0, 0L); + } + + int GetTic(int nTic) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETTIC, nTic, 0L); + } + + BOOL SetTic(int nTic) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TBM_SETTIC, 0, nTic); + } + + int GetTicPos(int nTic) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETTICPOS, nTic, 0L); + } + + void SetTicFreq(int nFreq) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETTICFREQ, nFreq, 0L); + } + + int GetThumbLength() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_GETTHUMBLENGTH, 0, 0L); + } + + void SetThumbLength(int nLength) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETTHUMBLENGTH, nLength, 0L); + } + + void SetSel(int nStart, int nEnd, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & TBS_ENABLESELRANGE) != 0); + ::SendMessage(m_hWnd, TBM_SETSEL, bRedraw, MAKELPARAM(nStart, nEnd)); + } + + ATL::CWindow GetBuddy(BOOL bLeft = TRUE) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_GETBUDDY, bLeft, 0L)); + } + + ATL::CWindow SetBuddy(HWND hWndBuddy, BOOL bLeft = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_SETBUDDY, bLeft, (LPARAM)hWndBuddy)); + } + +#ifndef _WIN32_WCE + CToolTipCtrl GetToolTips() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TBM_GETTOOLTIPS, 0, 0L)); + } + + void SetToolTips(HWND hWndTT) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETTOOLTIPS, (WPARAM)hWndTT, 0L); + } + + int SetTipSide(int nSide) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, TBM_SETTIPSIDE, nSide, 0L); + } +#endif // !_WIN32_WCE + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TBM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, TBM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +// Operations + void ClearSel(BOOL bRedraw = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_CLEARSEL, bRedraw, 0L); + } + + void VerifyPos() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_SETPOS, FALSE, 0L); + } + + void ClearTics(BOOL bRedraw = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, TBM_CLEARTICS, bRedraw, 0L); + } +}; + +typedef CTrackBarCtrlT CTrackBarCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CUpDownCtrl + +template +class CUpDownCtrlT : public TBase +{ +public: +// Constructors + CUpDownCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CUpDownCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return UPDOWN_CLASS; + } + + UINT GetAccel(int nAccel, UDACCEL* pAccel) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)); + } + + BOOL SetAccel(int nAccel, UDACCEL* pAccel) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)LOWORD(::SendMessage(m_hWnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel)); + } + + UINT GetBase() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETBASE, 0, 0L)); + } + + int SetBase(int nBase) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, UDM_SETBASE, nBase, 0L); + } + + ATL::CWindow GetBuddy() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_GETBUDDY, 0, 0L)); + } + + ATL::CWindow SetBuddy(HWND hWndBuddy) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_SETBUDDY, (WPARAM)hWndBuddy, 0L)); + } + + int GetPos(LPBOOL lpbError = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETPOS, 0, 0L); + // Note: Seems that Windows always sets error to TRUE if + // UDS_SETBUDDYINT style is not used + if(lpbError != NULL) + *lpbError = (HIWORD(dwRet) != 0) ? TRUE : FALSE; + return (int)(short)LOWORD(dwRet); + } + + int SetPos(int nPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)(short)LOWORD(::SendMessage(m_hWnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))); + } + + DWORD GetRange() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); + } + + void GetRange(int& nLower, int& nUpper) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); + nLower = (int)(short)HIWORD(dwRet); + nUpper = (int)(short)LOWORD(dwRet); + } + + void SetRange(int nLower, int nUpper) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); + } + +#if (_WIN32_IE >= 0x0400) + void SetRange32(int nLower, int nUpper) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, UDM_SETRANGE32, nLower, nUpper); + } + + void GetRange32(int& nLower, int& nUpper) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, UDM_GETRANGE32, (WPARAM)&nLower, (LPARAM)&nUpper); + } + +#ifndef _WIN32_WCE + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, UDM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, UDM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + int GetPos32(LPBOOL lpbError = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + // Note: Seems that Windows always sets error to TRUE if + // UDS_SETBUDDYINT style is not used + return (int)::SendMessage(m_hWnd, UDM_GETPOS32, 0, (LPARAM)lpbError); + } + + int SetPos32(int nPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, UDM_SETPOS32, 0, (LPARAM)nPos); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) +}; + +typedef CUpDownCtrlT CUpDownCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CProgressBarCtrl + +template +class CProgressBarCtrlT : public TBase +{ +public: +// Constructors + CProgressBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CProgressBarCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return PROGRESS_CLASS; + } + + DWORD SetRange(int nLower, int nUpper) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); + } + + int SetPos(int nPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETPOS, nPos, 0L)); + } + + int OffsetPos(int nPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_DELTAPOS, nPos, 0L)); + } + + int SetStep(int nStep) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETSTEP, nStep, 0L)); + } + + UINT GetPos() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, PBM_GETPOS, 0, 0L); + } + + void GetRange(PPBRANGE pPBRange) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pPBRange != NULL); + ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)pPBRange); + } + + void GetRange(int& nLower, int& nUpper) const + { + ATLASSERT(::IsWindow(m_hWnd)); + PBRANGE range = { 0 }; + ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)&range); + nLower = range.iLow; + nUpper = range.iHigh; + } + + int GetRangeLimit(BOOL bLowLimit) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PBM_GETRANGE, bLowLimit, (LPARAM)NULL); + } + + DWORD SetRange32(int nMin, int nMax) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE32, nMin, nMax); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + COLORREF SetBarColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, PBM_SETBARCOLOR, 0, (LPARAM)clr); + } + + COLORREF SetBkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, PBM_SETBKCOLOR, 0, (LPARAM)clr); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) + BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime); + } +#endif // (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) + +#if (_WIN32_WINNT >= 0x0600) + int GetStep() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PBM_GETSTEP, 0, 0L); + } + + COLORREF GetBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, PBM_GETBKCOLOR, 0, 0L); + } + + COLORREF GetBarColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, PBM_GETBARCOLOR, 0, 0L); + } + + int GetState() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PBM_GETSTATE, 0, 0L); + } + + int SetState(int nState) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PBM_SETSTATE, nState, 0L); + } +#endif // (_WIN32_WINNT >= 0x0600) + +// Operations + int StepIt() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_STEPIT, 0, 0L)); + } +}; + +typedef CProgressBarCtrlT CProgressBarCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CHotKeyCtrl + +#ifndef _WIN32_WCE + +template +class CHotKeyCtrlT : public TBase +{ +public: +// Constructors + CHotKeyCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CHotKeyCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return HOTKEY_CLASS; + } + + DWORD GetHotKey() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); + } + + void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dw = (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); + wVirtualKeyCode = LOBYTE(LOWORD(dw)); + wModifiers = HIBYTE(LOWORD(dw)); + } + + void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, HKM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0L); + } + + void SetRules(WORD wInvalidComb, WORD wModifiers) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, HKM_SETRULES, wInvalidComb, MAKELPARAM(wModifiers, 0)); + } +}; + +typedef CHotKeyCtrlT CHotKeyCtrl; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CAnimateCtrl + +#ifndef _WIN32_WCE + +template +class CAnimateCtrlT : public TBase +{ +public: +// Constructors + CAnimateCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CAnimateCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return ANIMATE_CLASS; + } + +// Operations + BOOL Open(ATL::_U_STRINGorID FileName) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, (LPARAM)FileName.m_lpstr); + } + + BOOL Play(UINT nFrom, UINT nTo, UINT nRep) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, nRep, MAKELPARAM(nFrom, nTo)); + } + + BOOL Stop() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, ACM_STOP, 0, 0L); + } + + BOOL Close() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, 0L); + } + + BOOL Seek(UINT nTo) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, 0, MAKELPARAM(nTo, nTo)); + } + + // Vista only + BOOL IsPlaying() const + { +#ifndef ACM_ISPLAYING + const UINT ACM_ISPLAYING = (WM_USER+104); +#endif + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, ACM_ISPLAYING, 0, 0L); + } +}; + +typedef CAnimateCtrlT CAnimateCtrl; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CRichEditCtrl + +#ifndef _WIN32_WCE + +#ifdef _UNICODE +#if (_RICHEDIT_VER == 0x0100) +#undef RICHEDIT_CLASS +#define RICHEDIT_CLASS L"RICHEDIT" +#endif // (_RICHEDIT_VER == 0x0100) +#endif // _UNICODE + +template +class CRichEditCtrlT : public TBase +{ +public: +// Constructors + CRichEditCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CRichEditCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return RICHEDIT_CLASS; + } + + static LPCTSTR GetLibraryName() + { +#if (_RICHEDIT_VER >= 0x0200) + return _T("RICHED20.DLL"); +#else + return _T("RICHED32.DLL"); +#endif + } + + int GetLineCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); + } + + BOOL GetModify() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); + } + + void SetModify(BOOL bModified = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); + } + + void GetRect(LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); + } + + DWORD GetOptions() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_GETOPTIONS, 0, 0L); + } + + DWORD SetOptions(WORD wOperation, DWORD dwOptions) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_SETOPTIONS, wOperation, dwOptions); + } + + // NOTE: first word in lpszBuffer must contain the size of the buffer! + int GetLine(int nIndex, LPTSTR lpszBuffer) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + } + + int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const + { + ATLASSERT(::IsWindow(m_hWnd)); + *(LPWORD)lpszBuffer = (WORD)nMaxLength; + return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + } + + BOOL CanUndo() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); + } + + BOOL CanPaste(UINT nFormat = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, nFormat, 0L); + } + + void GetSel(LONG& nStartChar, LONG& nEndChar) const + { + ATLASSERT(::IsWindow(m_hWnd)); + CHARRANGE cr = { 0, 0 }; + ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + nStartChar = cr.cpMin; + nEndChar = cr.cpMax; + } + + void GetSel(CHARRANGE &cr) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + } + + int SetSel(LONG nStartChar, LONG nEndChar) + { + ATLASSERT(::IsWindow(m_hWnd)); + CHARRANGE cr = { nStartChar, nEndChar }; + return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); + } + + int SetSel(CHARRANGE &cr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); + } + + int SetSelAll() + { + return SetSel(0, -1); + } + + int SetSelNone() + { + return SetSel(-1, 0); + } + + DWORD GetDefaultCharFormat(CHARFORMAT& cf) const + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT); + return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); + } + + DWORD GetSelectionCharFormat(CHARFORMAT& cf) const + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT); + return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); + } + + DWORD GetEventMask() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_GETEVENTMASK, 0, 0L); + } + + LONG GetLimitText() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); + } + + DWORD GetParaFormat(PARAFORMAT& pf) const + { + ATLASSERT(::IsWindow(m_hWnd)); + pf.cbSize = sizeof(PARAFORMAT); + return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); + } + +#if (_RICHEDIT_VER >= 0x0200) + LONG GetSelText(LPTSTR lpstrBuff) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); + } +#else // !(_RICHEDIT_VER >= 0x0200) + // RichEdit 1.0 EM_GETSELTEXT is ANSI only + LONG GetSelText(LPSTR lpstrBuff) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); + } +#endif // !(_RICHEDIT_VER >= 0x0200) + +#ifndef _ATL_NO_COM + BOOL GetSelTextBSTR(BSTR& bstrText) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrText == NULL); + + CHARRANGE cr = { 0, 0 }; + ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + +#if (_RICHEDIT_VER >= 0x0200) + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); + if(lpstrText == NULL) + return FALSE; + if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) + return FALSE; + + bstrText = ::SysAllocString(T2W(lpstrText)); +#else // !(_RICHEDIT_VER >= 0x0200) + CTempBuffer buff; + LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); + if(lpstrText == NULL) + return FALSE; + if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) + return FALSE; + + bstrText = ::SysAllocString(A2W(lpstrText)); +#endif // !(_RICHEDIT_VER >= 0x0200) + + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + LONG GetSelText(_CSTRING_NS::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + + CHARRANGE cr = { 0, 0 }; + ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + +#if (_RICHEDIT_VER >= 0x0200) + LONG lLen = 0; + LPTSTR lpstrText = strText.GetBufferSetLength(cr.cpMax - cr.cpMin); + if(lpstrText != NULL) + { + lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); + strText.ReleaseBuffer(); + } +#else // !(_RICHEDIT_VER >= 0x0200) + CTempBuffer buff; + LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); + if(lpstrText == NULL) + return 0; + LONG lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); + if(lLen == 0) + return 0; + + USES_CONVERSION; + strText = A2T(lpstrText); +#endif // !(_RICHEDIT_VER >= 0x0200) + + return lLen; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + WORD GetSelectionType() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (WORD)::SendMessage(m_hWnd, EM_SELECTIONTYPE, 0, 0L); + } + + COLORREF SetBackgroundColor(COLORREF cr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 0, cr); + } + + COLORREF SetBackgroundColor() // sets to system background + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 1, 0); + } + + BOOL SetCharFormat(CHARFORMAT& cf, WORD wFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); + } + + BOOL SetDefaultCharFormat(CHARFORMAT& cf) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); + } + + BOOL SetSelectionCharFormat(CHARFORMAT& cf) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + + BOOL SetWordCharFormat(CHARFORMAT& cf) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); + } + + DWORD SetEventMask(DWORD dwEventMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_SETEVENTMASK, 0, dwEventMask); + } + + BOOL SetParaFormat(PARAFORMAT& pf) + { + ATLASSERT(::IsWindow(m_hWnd)); + pf.cbSize = sizeof(PARAFORMAT); + return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); + } + + BOOL SetTargetDevice(HDC hDC, int cxLineWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTARGETDEVICE, (WPARAM)hDC, cxLineWidth); + } + + int GetTextLength() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); + } + + BOOL SetReadOnly(BOOL bReadOnly = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); + } + + int GetFirstVisibleLine() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); + } + + EDITWORDBREAKPROCEX GetWordBreakProcEx() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_GETWORDBREAKPROCEX, 0, 0L); + } + + EDITWORDBREAKPROCEX SetWordBreakProcEx(EDITWORDBREAKPROCEX pfnEditWordBreakProcEx) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_SETWORDBREAKPROCEX, 0, (LPARAM)pfnEditWordBreakProcEx); + } + + int GetTextRange(TEXTRANGE* pTextRange) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)pTextRange); + } + +#if (_RICHEDIT_VER >= 0x0200) + int GetTextRange(LONG nStartChar, LONG nEndChar, LPTSTR lpstrText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TEXTRANGE tr = { 0 }; + tr.chrg.cpMin = nStartChar; + tr.chrg.cpMax = nEndChar; + tr.lpstrText = lpstrText; + return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + } +#else // !(_RICHEDIT_VER >= 0x0200) + + int GetTextRange(LONG nStartChar, LONG nEndChar, LPSTR lpstrText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + TEXTRANGE tr = { 0 }; + tr.chrg.cpMin = nStartChar; + tr.chrg.cpMax = nEndChar; + tr.lpstrText = lpstrText; + return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + } +#endif // !(_RICHEDIT_VER >= 0x0200) + +#if (_RICHEDIT_VER >= 0x0200) + DWORD GetDefaultCharFormat(CHARFORMAT2& cf) const + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT2); + return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); + } + + BOOL SetCharFormat(CHARFORMAT2& cf, WORD wFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT2); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); + } + + BOOL SetDefaultCharFormat(CHARFORMAT2& cf) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT2); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); + } + + DWORD GetSelectionCharFormat(CHARFORMAT2& cf) const + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT2); + return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); + } + + BOOL SetSelectionCharFormat(CHARFORMAT2& cf) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT2); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + + BOOL SetWordCharFormat(CHARFORMAT2& cf) + { + ATLASSERT(::IsWindow(m_hWnd)); + cf.cbSize = sizeof(CHARFORMAT2); + return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); + } + + DWORD GetParaFormat(PARAFORMAT2& pf) const + { + ATLASSERT(::IsWindow(m_hWnd)); + pf.cbSize = sizeof(PARAFORMAT2); + return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); + } + + BOOL SetParaFormat(PARAFORMAT2& pf) + { + ATLASSERT(::IsWindow(m_hWnd)); + pf.cbSize = sizeof(PARAFORMAT2); + return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); + } + + TEXTMODE GetTextMode() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (TEXTMODE)::SendMessage(m_hWnd, EM_GETTEXTMODE, 0, 0L); + } + + BOOL SetTextMode(TEXTMODE enumTextMode) + { + ATLASSERT(::IsWindow(m_hWnd)); + return !(BOOL)::SendMessage(m_hWnd, EM_SETTEXTMODE, enumTextMode, 0L); + } + + UNDONAMEID GetUndoName() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETUNDONAME, 0, 0L); + } + + UNDONAMEID GetRedoName() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETREDONAME, 0, 0L); + } + + BOOL CanRedo() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); + } + + BOOL GetAutoURLDetect() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_GETAUTOURLDETECT, 0, 0L); + } + + BOOL SetAutoURLDetect(BOOL bAutoDetect = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return !(BOOL)::SendMessage(m_hWnd, EM_AUTOURLDETECT, bAutoDetect, 0L); + } + + // this method is deprecated, please use SetAutoURLDetect + BOOL EnableAutoURLDetect(BOOL bEnable = TRUE) { return SetAutoURLDetect(bEnable); } + + UINT SetUndoLimit(UINT uUndoLimit) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_SETUNDOLIMIT, uUndoLimit, 0L); + } + + void SetPalette(HPALETTE hPalette) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETPALETTE, (WPARAM)hPalette, 0L); + } + + int GetTextEx(GETTEXTEX* pGetTextEx, LPTSTR lpstrText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)pGetTextEx, (LPARAM)lpstrText); + } + + int GetTextEx(LPTSTR lpstrText, int nTextLen, DWORD dwFlags = GT_DEFAULT, UINT uCodePage = CP_ACP, LPCSTR lpDefaultChar = NULL, LPBOOL lpUsedDefChar = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + GETTEXTEX gte = { 0 }; + gte.cb = nTextLen * sizeof(TCHAR); + gte.codepage = uCodePage; + gte.flags = dwFlags; + gte.lpDefaultChar = lpDefaultChar; + gte.lpUsedDefChar = lpUsedDefChar; + return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)>e, (LPARAM)lpstrText); + } + + int GetTextLengthEx(GETTEXTLENGTHEX* pGetTextLengthEx) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)pGetTextLengthEx, 0L); + } + + int GetTextLengthEx(DWORD dwFlags = GTL_DEFAULT, UINT uCodePage = CP_ACP) const + { + ATLASSERT(::IsWindow(m_hWnd)); + GETTEXTLENGTHEX gtle = { 0 }; + gtle.codepage = uCodePage; + gtle.flags = dwFlags; + return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)>le, 0L); + } +#endif // (_RICHEDIT_VER >= 0x0200) + +#if (_RICHEDIT_VER >= 0x0300) + int SetTextEx(SETTEXTEX* pSetTextEx, LPCTSTR lpstrText) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)pSetTextEx, (LPARAM)lpstrText); + } + + int SetTextEx(LPCTSTR lpstrText, DWORD dwFlags = ST_DEFAULT, UINT uCodePage = CP_ACP) + { + ATLASSERT(::IsWindow(m_hWnd)); + SETTEXTEX ste = { 0 }; + ste.flags = dwFlags; + ste.codepage = uCodePage; + return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpstrText); + } + + int GetEditStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_GETEDITSTYLE, 0, 0L); + } + + int SetEditStyle(int nStyle, int nMask = -1) + { + ATLASSERT(::IsWindow(m_hWnd)); + if(nMask == -1) + nMask = nStyle; // set everything specified + return (int)::SendMessage(m_hWnd, EM_SETEDITSTYLE, nStyle, nMask); + } + + BOOL SetFontSize(int nFontSizeDelta) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nFontSizeDelta >= -1637 && nFontSizeDelta <= 1638); + return (BOOL)::SendMessage(m_hWnd, EM_SETFONTSIZE, nFontSizeDelta, 0L); + } + + void GetScrollPos(LPPOINT lpPoint) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpPoint != NULL); + ::SendMessage(m_hWnd, EM_GETSCROLLPOS, 0, (LPARAM)lpPoint); + } + + void SetScrollPos(LPPOINT lpPoint) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpPoint != NULL); + ::SendMessage(m_hWnd, EM_SETSCROLLPOS, 0, (LPARAM)lpPoint); + } + + BOOL GetZoom(int& nNum, int& nDen) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); + } + + BOOL SetZoom(int nNum, int nDen) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nNum >= 0 && nNum <= 64); + ATLASSERT(nDen >= 0 && nDen <= 64); + return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, nNum, nDen); + } + + BOOL SetZoomOff() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, 0, 0L); + } +#endif // (_RICHEDIT_VER >= 0x0300) + +// Operations + void LimitText(LONG nChars = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_EXLIMITTEXT, 0, nChars); + } + + int LineFromChar(LONG nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex); + } + + POINT PosFromChar(LONG nChar) const + { + ATLASSERT(::IsWindow(m_hWnd)); + POINT point = { 0, 0 }; + ::SendMessage(m_hWnd, EM_POSFROMCHAR, (WPARAM)&point, nChar); + return point; + } + + int CharFromPos(POINT pt) const + { + ATLASSERT(::IsWindow(m_hWnd)); + POINTL ptl = { pt.x, pt.y }; + return (int)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, (LPARAM)&ptl); + } + + void EmptyUndoBuffer() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); + } + + int LineIndex(int nLine = -1) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); + } + + int LineLength(int nLine = -1) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); + } + + BOOL LineScroll(int nLines, int nChars = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); + } + + void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); + } + + void SetRect(LPCRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); + } + + BOOL DisplayBand(LPRECT pDisplayRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_DISPLAYBAND, 0, (LPARAM)pDisplayRect); + } + + LONG FindText(DWORD dwFlags, FINDTEXT& ft) const + { + ATLASSERT(::IsWindow(m_hWnd)); +#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) + return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTW, dwFlags, (LPARAM)&ft); +#else + return (LONG)::SendMessage(m_hWnd, EM_FINDTEXT, dwFlags, (LPARAM)&ft); +#endif + } + + LONG FindText(DWORD dwFlags, FINDTEXTEX& ft) const + { + ATLASSERT(::IsWindow(m_hWnd)); +#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) + return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEXW, dwFlags, (LPARAM)&ft); +#else + return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEX, dwFlags, (LPARAM)&ft); +#endif + } + + LONG FormatRange(FORMATRANGE& fr, BOOL bDisplay = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)&fr); + } + + LONG FormatRange(FORMATRANGE* pFormatRange, BOOL bDisplay = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)pFormatRange); + } + + void HideSelection(BOOL bHide = TRUE, BOOL bChangeStyle = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_HIDESELECTION, bHide, bChangeStyle); + } + + void PasteSpecial(UINT uClipFormat, DWORD dwAspect = 0, HMETAFILE hMF = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + REPASTESPECIAL reps = { dwAspect, (DWORD_PTR)hMF }; + ::SendMessage(m_hWnd, EM_PASTESPECIAL, uClipFormat, (LPARAM)&reps); + } + + void RequestResize() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_REQUESTRESIZE, 0, 0L); + } + + LONG StreamIn(UINT uFormat, EDITSTREAM& es) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, uFormat, (LPARAM)&es); + } + + LONG StreamOut(UINT uFormat, EDITSTREAM& es) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, uFormat, (LPARAM)&es); + } + + DWORD FindWordBreak(int nCode, LONG nStartChar) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_FINDWORDBREAK, nCode, nStartChar); + } + + // Additional operations + void ScrollCaret() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + } + + int InsertText(long nInsertAfterChar, LPCTSTR lpstrText, BOOL bCanUndo = FALSE) + { + int nRet = SetSel(nInsertAfterChar, nInsertAfterChar); + ReplaceSel(lpstrText, bCanUndo); + return nRet; + } + + int AppendText(LPCTSTR lpstrText, BOOL bCanUndo = FALSE) + { + return InsertText(GetWindowTextLength(), lpstrText, bCanUndo); + } + + // Clipboard operations + BOOL Undo() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); + } + + void Clear() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + } + + void Copy() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + } + + void Cut() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + } + + void Paste() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); + } + + // OLE support + IRichEditOle* GetOleInterface() const + { + ATLASSERT(::IsWindow(m_hWnd)); + IRichEditOle *pRichEditOle = NULL; + ::SendMessage(m_hWnd, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle); + return pRichEditOle; + } + + BOOL SetOleCallback(IRichEditOleCallback* pCallback) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETOLECALLBACK, 0, (LPARAM)pCallback); + } + +#if (_RICHEDIT_VER >= 0x0200) + BOOL Redo() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_REDO, 0, 0L); + } + + void StopGroupTyping() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_STOPGROUPTYPING, 0, 0L); + } + + void ShowScrollBar(int nBarType, BOOL bVisible = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SHOWSCROLLBAR, nBarType, bVisible); + } +#endif // (_RICHEDIT_VER >= 0x0200) + +#if (_RICHEDIT_VER >= 0x0300) + BOOL SetTabStops(int nTabStops, LPINT rgTabStops) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); + } + + BOOL SetTabStops() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); + } + + BOOL SetTabStops(const int& cxEachStop) // takes an 'int' + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + } +#endif // (_RICHEDIT_VER >= 0x0300) +}; + +typedef CRichEditCtrlT CRichEditCtrl; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CRichEditCommands - message handlers for standard EDIT commands + +#ifndef _WIN32_WCE + +// Chain to CRichEditCommands message map. Your class must also derive from CRichEditCtrl. +// Example: +// class CMyRichEdit : public CWindowImpl, +// public CRichEditCommands +// { +// public: +// BEGIN_MSG_MAP(CMyRichEdit) +// // your handlers... +// CHAIN_MSG_MAP_ALT(CRichEditCommands, 1) +// END_MSG_MAP() +// // other stuff... +// }; + +template +class CRichEditCommands : public CEditCommands< T > +{ +public: + BEGIN_MSG_MAP(CRichEditCommands< T >) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_EDIT_CLEAR, CEditCommands< T >::OnEditClear) + COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, CEditCommands< T >::OnEditClearAll) + COMMAND_ID_HANDLER(ID_EDIT_COPY, CEditCommands< T >::OnEditCopy) + COMMAND_ID_HANDLER(ID_EDIT_CUT, CEditCommands< T >::OnEditCut) + COMMAND_ID_HANDLER(ID_EDIT_PASTE, CEditCommands< T >::OnEditPaste) + COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, CEditCommands< T >::OnEditSelectAll) + COMMAND_ID_HANDLER(ID_EDIT_UNDO, CEditCommands< T >::OnEditUndo) +#if (_RICHEDIT_VER >= 0x0200) + COMMAND_ID_HANDLER(ID_EDIT_REDO, OnEditRedo) +#endif // (_RICHEDIT_VER >= 0x0200) + END_MSG_MAP() + +#if (_RICHEDIT_VER >= 0x0200) + LRESULT OnEditRedo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Redo(); + return 0; + } +#endif // (_RICHEDIT_VER >= 0x0200) + +// State (update UI) helpers + BOOL CanCut() const + { return HasSelection(); } + + BOOL CanCopy() const + { return HasSelection(); } + + BOOL CanClear() const + { return HasSelection(); } + +// Implementation + BOOL HasSelection() const + { + const T* pT = static_cast(this); + return (pT->GetSelectionType() != SEL_EMPTY); + } +}; + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CDragListBox + +#ifndef _WIN32_WCE + +template +class CDragListBoxT : public CListBoxT< TBase > +{ +public: +// Constructors + CDragListBoxT(HWND hWnd = NULL) : CListBoxT< TBase >(hWnd) + { } + + CDragListBoxT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + if(hWnd != NULL) + MakeDragList(); + return hWnd; + } + +// Operations + BOOL MakeDragList() + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); + return ::MakeDragList(m_hWnd); + } + + int LBItemFromPt(POINT pt, BOOL bAutoScroll = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::LBItemFromPt(m_hWnd, pt, bAutoScroll); + } + + void DrawInsert(int nItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::DrawInsert(GetParent(), m_hWnd, nItem); + } + + static UINT GetDragListMessage() + { + static UINT uDragListMessage = 0; + if(uDragListMessage == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDragListBox::GetDragListMessage.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uDragListMessage == 0) + uDragListMessage = ::RegisterWindowMessage(DRAGLISTMSGSTRING); + + lock.Unlock(); + } + ATLASSERT(uDragListMessage != 0); + return uDragListMessage; + } +}; + +typedef CDragListBoxT CDragListBox; + +template +class CDragListNotifyImpl +{ +public: + BEGIN_MSG_MAP(CDragListNotifyImpl< T >) + MESSAGE_HANDLER(CDragListBox::GetDragListMessage(), OnDragListNotify) + END_MSG_MAP() + + LRESULT OnDragListNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + uMsg; // avoid level 4 warning + ATLASSERT(uMsg == CDragListBox::GetDragListMessage()); + T* pT = static_cast(this); + LPDRAGLISTINFO lpDragListInfo = (LPDRAGLISTINFO)lParam; + LRESULT lRet = 0; + switch(lpDragListInfo->uNotification) + { + case DL_BEGINDRAG: + lRet = (LPARAM)pT->OnBeginDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); + break; + case DL_CANCELDRAG: + pT->OnCancelDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); + break; + case DL_DRAGGING: + lRet = (LPARAM)pT->OnDragging((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); + break; + case DL_DROPPED: + pT->OnDropped((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); + break; + default: + ATLTRACE2(atlTraceUI, 0, _T("Unknown DragListBox notification\n")); + bHandled = FALSE; // don't handle it + break; + } + return lRet; + } + +// Overrideables + BOOL OnBeginDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) + { + return TRUE; // allow dragging + } + + void OnCancelDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) + { + // nothing to do + } + + int OnDragging(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) + { + return 0; // don't change cursor + } + + void OnDropped(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) + { + // nothing to do + } +}; + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CReBarCtrl + +template +class CReBarCtrlT : public TBase +{ +public: +// Constructors + CReBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CReBarCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return REBARCLASSNAME; + } + + UINT GetBandCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, RB_GETBANDCOUNT, 0, 0L); + } + + BOOL GetBandInfo(int nBand, LPREBARBANDINFO lprbbi) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi); + } + + BOOL SetBandInfo(int nBand, LPREBARBANDINFO lprbbi) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi); + } + + BOOL GetBarInfo(LPREBARINFO lprbi) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)lprbi); + } + + BOOL SetBarInfo(LPREBARINFO lprbi) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)lprbi); + } + + CImageList GetImageList() const + { + ATLASSERT(::IsWindow(m_hWnd)); + REBARINFO rbi = { 0 }; + rbi.cbSize = sizeof(REBARINFO); + rbi.fMask = RBIM_IMAGELIST; + if( (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)&rbi) == FALSE ) return CImageList(); + return CImageList(rbi.himl); + } + + BOOL SetImageList(HIMAGELIST hImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + REBARINFO rbi = { 0 }; + rbi.cbSize = sizeof(REBARINFO); + rbi.fMask = RBIM_IMAGELIST; + rbi.himl = hImageList; + return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)&rbi); + } + + UINT GetRowCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, RB_GETROWCOUNT, 0, 0L); + } + + UINT GetRowHeight(int nBand) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, RB_GETROWHEIGHT, nBand, 0L); + } + +#if (_WIN32_IE >= 0x0400) + COLORREF GetTextColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, RB_GETTEXTCOLOR, 0, 0L); + } + + COLORREF SetTextColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); + } + + COLORREF GetBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, RB_GETBKCOLOR, 0, 0L); + } + + COLORREF SetBkColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); + } + + UINT GetBarHeight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, RB_GETBARHEIGHT, 0, 0L); + } + + BOOL GetRect(int nBand, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_GETRECT, nBand, (LPARAM)lpRect); + } + +#ifndef _WIN32_WCE + CToolTipCtrl GetToolTips() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(m_hWnd, RB_GETTOOLTIPS, 0, 0L)); + } + + void SetToolTips(HWND hwndToolTip) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L); + } +#endif // !_WIN32_WCE + + void GetBandBorders(int nBand, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpRect != NULL); + ::SendMessage(m_hWnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect); + } + +#ifndef _WIN32_WCE + BOOL GetColorScheme(LPCOLORSCHEME lpColorScheme) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpColorScheme != NULL); + return (BOOL)::SendMessage(m_hWnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme); + } + + void SetColorScheme(LPCOLORSCHEME lpColorScheme) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpColorScheme != NULL); + ::SendMessage(m_hWnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme); + } + + HPALETTE GetPalette() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HPALETTE)::SendMessage(m_hWnd, RB_GETPALETTE, 0, 0L); + } + + HPALETTE SetPalette(HPALETTE hPalette) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HPALETTE)::SendMessage(m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPalette); + } + + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_WINNT >= 0x0501) + // requires uxtheme.h to be included to use MARGINS struct +#ifndef _UXTHEME_H_ + typedef struct _MARGINS* PMARGINS; +#endif // !_UXTHEME_H_ + void GetBandMargins(PMARGINS pMargins) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins); + } + + void SetWindowTheme(LPCWSTR lpstrTheme) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + } +#endif // (_WIN32_WINNT >= 0x0501) + +#if (_WIN32_IE >= 0x0600) + DWORD GetExtendedStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, RB_GETEXTENDEDSTYLE, 0, 0L); + } + + DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle); + } +#endif // (_WIN32_IE >= 0x0600) + +// Operations + BOOL InsertBand(int nBand, LPREBARBANDINFO lprbbi) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_INSERTBAND, nBand, (LPARAM)lprbbi); + } + + BOOL AddBand(LPREBARBANDINFO lprbbi) + { + return InsertBand(-1, lprbbi); + } + + BOOL DeleteBand(int nBand) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_DELETEBAND, nBand, 0L); + } + + ATL::CWindow SetNotifyWnd(HWND hWnd) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(m_hWnd, RB_SETPARENT, (WPARAM)hWnd, 0L)); + } + +#if (_WIN32_IE >= 0x0400) + void BeginDrag(int nBand, DWORD dwPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, dwPos); + } + + void BeginDrag(int nBand, int xPos, int yPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos)); + } + + void EndDrag() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_ENDDRAG, 0, 0L); + } + + void DragMove(DWORD dwPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, dwPos); + } + + void DragMove(int xPos, int yPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos)); + } + +#ifndef _WIN32_WCE + void GetDropTarget(IDropTarget** ppDropTarget) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget); + } +#endif // !_WIN32_WCE + + void MaximizeBand(int nBand, BOOL bIdeal = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_MAXIMIZEBAND, nBand, bIdeal); + } + + void MinimizeBand(int nBand) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_MINIMIZEBAND, nBand, 0L); + } + + BOOL SizeToRect(LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_SIZETORECT, 0, (LPARAM)lpRect); + } + + int IdToIndex(UINT uBandID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, RB_IDTOINDEX, uBandID, 0L); + } + + int HitTest(LPRBHITTESTINFO lprbht) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, RB_HITTEST, 0, (LPARAM)lprbht); + } + + BOOL ShowBand(int nBand, BOOL bShow) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_SHOWBAND, nBand, bShow); + } + +#ifndef _WIN32_WCE + BOOL MoveBand(int nBand, int nNewPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nNewPos >= 0 && nNewPos <= ((int)GetBandCount() - 1)); + return (BOOL)::SendMessage(m_hWnd, RB_MOVEBAND, nBand, nNewPos); + } +#endif // !_WIN32_WCE +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + void PushChevron(int nBand, LPARAM lAppValue) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, RB_PUSHCHEVRON, nBand, lAppValue); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +// Extra operations +#if (_WIN32_IE >= 0x0400) + void LockBands(bool bLock) + { + int nBandCount = GetBandCount(); + for(int i =0; i < nBandCount; i++) + { + REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; + rbbi.fMask = RBBIM_STYLE; + BOOL bRet = GetBandInfo(i, &rbbi); + ATLASSERT(bRet); + + if((rbbi.fStyle & RBBS_GRIPPERALWAYS) == 0) + { + rbbi.fStyle |= RBBS_GRIPPERALWAYS; + bRet = SetBandInfo(i, &rbbi); + ATLASSERT(bRet); + rbbi.fStyle &= ~RBBS_GRIPPERALWAYS; + } + + if(bLock) + rbbi.fStyle |= RBBS_NOGRIPPER; + else + rbbi.fStyle &= ~RBBS_NOGRIPPER; + + bRet = SetBandInfo(i, &rbbi); + ATLASSERT(bRet); + } + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_WINNT >= 0x0600) + BOOL SetBandWidth(int nBand, int cxWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, RB_SETBANDWIDTH, nBand, cxWidth); + } +#endif // (_WIN32_WINNT >= 0x0600) +}; + +typedef CReBarCtrlT CReBarCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CComboBoxEx + +#ifndef _WIN32_WCE + +template +class CComboBoxExT : public CComboBoxT< TBase > +{ +public: +// Constructors + CComboBoxExT(HWND hWnd = NULL) : CComboBoxT< TBase >(hWnd) + { } + + CComboBoxExT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_COMBOBOXEX; + } + + CImageList GetImageList() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_GETIMAGELIST, 0, 0L)); + } + + CImageList SetImageList(HIMAGELIST hImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)hImageList)); + } + +#if (_WIN32_IE >= 0x0400) + DWORD GetExtendedStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0L); + } + + DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, CBEM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); + } + + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CBEM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CBEM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_WINNT >= 0x0501) + void SetWindowTheme(LPCWSTR lpstrTheme) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, CBEM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + } +#endif // (_WIN32_WINNT >= 0x0501) + +// Operations + int InsertItem(const COMBOBOXEXITEM* lpcCBItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem); + } + + int InsertItem(UINT nMask, int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, + int iIndent, int iOverlay, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + COMBOBOXEXITEM cbex = { 0 }; + cbex.mask = nMask; + cbex.iItem = nIndex; + cbex.pszText = (LPTSTR) lpszItem; + cbex.iImage = nImage; + cbex.iSelectedImage = nSelImage; + cbex.iIndent = iIndent; + cbex.iOverlay = iOverlay; + cbex.lParam = lParam; + return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); + } + + int InsertItem(int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + COMBOBOXEXITEM cbex = { 0 }; + cbex.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_INDENT | CBEIF_LPARAM; + cbex.iItem = nIndex; + cbex.pszText = (LPTSTR) lpszItem; + cbex.iImage = nImage; + cbex.iSelectedImage = nSelImage; + cbex.iIndent = iIndent; + cbex.lParam = lParam; + return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); + } + + int AddItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) + { + return InsertItem(nMask, -1, lpszItem, nImage, nSelImage, iIndent, iOverlay, lParam); + } + + int AddItem(LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) + { + return InsertItem(-1, lpszItem, nImage, nSelImage, iIndent, lParam); + } + + int DeleteItem(int nIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, CBEM_DELETEITEM, nIndex, 0L); + } + + BOOL GetItem(PCOMBOBOXEXITEM pCBItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)pCBItem); + } + + BOOL SetItem(const COMBOBOXEXITEM* lpcCBItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)lpcCBItem); + } + + int SetItem(int nIndex, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, + int iIndent, int iOverlay, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + COMBOBOXEXITEM cbex = { 0 }; + cbex.mask = nMask; + cbex.iItem = nIndex; + cbex.pszText = (LPTSTR) lpszItem; + cbex.iImage = nImage; + cbex.iSelectedImage = nSelImage; + cbex.iIndent = iIndent; + cbex.iOverlay = iOverlay; + cbex.lParam = lParam; + return (int)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)&cbex); + } + + BOOL GetItemText(int nIndex, LPTSTR lpszItem, int nLen) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpszItem != NULL); + + COMBOBOXEXITEM cbex = { 0 }; + cbex.mask = CBEIF_TEXT; + cbex.iItem = nIndex; + cbex.pszText = lpszItem; + cbex.cchTextMax = nLen; + + return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); + } + +#ifndef _ATL_NO_COM + BOOL GetItemText(int nIndex, BSTR& bstrText) const + { + USES_CONVERSION; + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(bstrText == NULL); + + COMBOBOXEXITEM cbex = { 0 }; + cbex.mask = CBEIF_TEXT; + cbex.iItem = nIndex; + + LPTSTR lpstrText = NULL; + BOOL bRet = FALSE; + for(int nLen = 256; ; nLen *= 2) + { + ATLTRY(lpstrText = new TCHAR[nLen]); + if(lpstrText == NULL) + break; + lpstrText[0] = NULL; + cbex.pszText = lpstrText; + cbex.cchTextMax = nLen; + bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); + if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) + break; + delete [] lpstrText; + lpstrText = NULL; + } + + if(lpstrText != NULL) + { + if(bRet) + bstrText = ::SysAllocString(T2OLE(lpstrText)); + delete [] lpstrText; + } + + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + BOOL GetItemText(int nIndex, _CSTRING_NS::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + + COMBOBOXEXITEM cbex = { 0 }; + cbex.mask = CBEIF_TEXT; + cbex.iItem = nIndex; + + strText.Empty(); + BOOL bRet = FALSE; + for(int nLen = 256; ; nLen *= 2) + { + cbex.pszText = strText.GetBufferSetLength(nLen); + if(cbex.pszText == NULL) + { + bRet = FALSE; + break; + } + cbex.cchTextMax = nLen; + bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); + if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) + break; + } + strText.ReleaseBuffer(); + return bRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + BOOL SetItemText(int nIndex, LPCTSTR lpszItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return SetItem(nIndex, CBEIF_TEXT, lpszItem, 0, 0, 0, 0, 0); + } + + CComboBox GetComboCtrl() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CComboBox((HWND)::SendMessage(m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0L)); + } + + CEdit GetEditCtrl() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CEdit((HWND)::SendMessage(m_hWnd, CBEM_GETEDITCONTROL, 0, 0L)); + } + + BOOL HasEditChanged() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, CBEM_HASEDITCHANGED, 0, 0L); + } + +// Non-functional + int AddString(LPCTSTR /*lpszItem*/) + { + ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem + return 0; + } + + int InsertString(int /*nIndex*/, LPCTSTR /*lpszString*/) + { + ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem + return 0; + } + + int Dir(UINT /*attr*/, LPCTSTR /*lpszWildCard*/) + { + ATLASSERT(FALSE); // Not available in CComboBoxEx + return 0; + } + + int FindString(int /*nStartAfter*/, LPCTSTR /*lpszString*/) const + { + ATLASSERT(FALSE); // Not available in CComboBoxEx; try FindStringExact + return 0; + } +}; + +typedef CComboBoxExT CComboBoxEx; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CMonthCalendarCtrl + +template +class CMonthCalendarCtrlT : public TBase +{ +public: +// Constructors + CMonthCalendarCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CMonthCalendarCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return MONTHCAL_CLASS; + } + + COLORREF GetColor(int nColorType) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, MCM_GETCOLOR, nColorType, 0L); + } + + COLORREF SetColor(int nColorType, COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, MCM_SETCOLOR, nColorType, clr); + } + + BOOL GetCurSel(LPSYSTEMTIME lpSysTime) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM)lpSysTime); + } + + BOOL SetCurSel(LPSYSTEMTIME lpSysTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM)lpSysTime); + } + + int GetFirstDayOfWeek(BOOL* pbLocaleVal = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0L); + if(pbLocaleVal != NULL) + *pbLocaleVal = (BOOL)HIWORD(dwRet); + return (int)(short)LOWORD(dwRet); + } + + int SetFirstDayOfWeek(int nDay, BOOL* pbLocaleVal = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, nDay); + if(pbLocaleVal != NULL) + *pbLocaleVal = (BOOL)HIWORD(dwRet); + return (int)(short)LOWORD(dwRet); + } + + int GetMaxSelCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, MCM_GETMAXSELCOUNT, 0, 0L); + } + + BOOL SetMaxSelCount(int nMax) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0L); + } + + int GetMonthDelta() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, MCM_GETMONTHDELTA, 0, 0L); + } + + int SetMonthDelta(int nDelta) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, MCM_SETMONTHDELTA, nDelta, 0L); + } + + DWORD GetRange(LPSYSTEMTIME lprgSysTimeArray) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM)lprgSysTimeArray); + } + + BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETRANGE, dwFlags, (LPARAM)lprgSysTimeArray); + } + + BOOL GetSelRange(LPSYSTEMTIME lprgSysTimeArray) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM)lprgSysTimeArray); + } + + BOOL SetSelRange(LPSYSTEMTIME lprgSysTimeArray) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)lprgSysTimeArray); + } + + BOOL GetToday(LPSYSTEMTIME lpSysTime) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM)lpSysTime); + } + + void SetToday(LPSYSTEMTIME lpSysTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, MCM_SETTODAY, 0, (LPARAM)lpSysTime); + } + + BOOL GetMinReqRect(LPRECT lpRectInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM)lpRectInfo); + } + + int GetMaxTodayWidth() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, MCM_GETMAXTODAYWIDTH, 0, 0L); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL GetUnicodeFormat() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_GETUNICODEFORMAT, 0, 0L); + } + + BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETUNICODEFORMAT, bUnicode, 0L); + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + DWORD GetCurrentView() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, MCM_GETCURRENTVIEW, 0, 0L); + } + + BOOL SetCurrentView(DWORD dwView) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETCURRENTVIEW, 0, dwView); + } + + DWORD GetCalendarCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, MCM_GETCALENDARCOUNT, 0, 0L); + } + + BOOL GetCalendarGridInfo(PMCGRIDINFO pGridInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM)pGridInfo); + } + + CALID GetCALID() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (CALID)::SendMessage(m_hWnd, MCM_GETCALID, 0, 0L); + } + + void SetCALID(CALID calid) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, MCM_SETCALID, (LPARAM)calid, 0L); + } + + int GetCalendarBorder() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, MCM_GETCALENDARBORDER, 0, 0L); + } + + void SetCalendarBorder(int cxyBorder, BOOL bSet = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, MCM_SETCALENDARBORDER, (WPARAM)bSet, (LPARAM)cxyBorder); + } +#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + +// Operations + int GetMonthRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, MCM_GETMONTHRANGE, dwFlags, (LPARAM)lprgSysTimeArray); + } + + BOOL SetDayState(int nMonths, LPMONTHDAYSTATE lpDayStateArray) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, MCM_SETDAYSTATE, nMonths, (LPARAM)lpDayStateArray); + } + + DWORD HitTest(PMCHITTESTINFO pMCHitTest) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, MCM_HITTEST, 0, (LPARAM)pMCHitTest); + } + +#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + void SizeRectToMin(LPRECT lpRect) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, MCM_SIZERECTTOMIN, 0, (LPARAM)lpRect); + } +#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) +}; + +typedef CMonthCalendarCtrlT CMonthCalendarCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CDateTimePickerCtrl + +template +class CDateTimePickerCtrlT : public TBase +{ +public: +// Constructors + CDateTimePickerCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CDateTimePickerCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Operations + static LPCTSTR GetWndClassName() + { + return DATETIMEPICK_CLASS; + } + + BOOL SetFormat(LPCTSTR lpszFormat) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)lpszFormat); + } + + COLORREF GetMonthCalColor(int nColorType) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, DTM_GETMCCOLOR, nColorType, 0L); + } + + COLORREF SetMonthCalColor(int nColorType, COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, DTM_SETMCCOLOR, nColorType, clr); + } + + DWORD GetRange(LPSYSTEMTIME lpSysTimeArray) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM)lpSysTimeArray); + } + + BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lpSysTimeArray) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DTM_SETRANGE, dwFlags, (LPARAM)lpSysTimeArray); + } + + DWORD GetSystemTime(LPSYSTEMTIME lpSysTime) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)lpSysTime); + } + + BOOL SetSystemTime(DWORD dwFlags, LPSYSTEMTIME lpSysTime) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, dwFlags, (LPARAM)lpSysTime); + } + + CMonthCalendarCtrl GetMonthCal() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CMonthCalendarCtrl((HWND)::SendMessage(m_hWnd, DTM_GETMONTHCAL, 0, 0L)); + } + +#if (_WIN32_IE >= 0x0400) + CFontHandle GetMonthCalFont() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CFontHandle((HFONT)::SendMessage(m_hWnd, DTM_GETMCFONT, 0, 0L)); + } + + void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_SETMCFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); + } +#endif // (_WIN32_IE >= 0x0400) + +#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + DWORD GetMonthCalStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, DTM_GETMCSTYLE, 0, 0L); + } + + DWORD SetMonthCalStyle(DWORD dwStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); + } + + void GetDateTimePickerInfo(LPDATETIMEPICKERINFO lpPickerInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_GETDATETIMEPICKERINFO, 0, (LPARAM)lpPickerInfo); + } + + BOOL GetIdealSize(LPSIZE lpSize) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)lpSize); + } + + void CloseMonthCal() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_CLOSEMONTHCAL, 0, 0L); + } +#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) +}; + +typedef CDateTimePickerCtrlT CDateTimePickerCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CFlatScrollBarImpl - support for flat scroll bars + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +template +class CFlatScrollBarImpl +{ +public: +// Initialization + BOOL FlatSB_Initialize() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::InitializeFlatSB(pT->m_hWnd); + } + + HRESULT FlatSB_Uninitialize() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::UninitializeFlatSB(pT->m_hWnd); + } + +// Flat scroll bar properties + BOOL FlatSB_GetScrollProp(UINT uIndex, LPINT lpnValue) const + { + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_GetScrollProp(pT->m_hWnd, uIndex, lpnValue); + } + + BOOL FlatSB_SetScrollProp(UINT uIndex, int nValue, BOOL bRedraw = TRUE) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_SetScrollProp(pT->m_hWnd, uIndex, nValue, bRedraw); + } + +// Attributes + int FlatSB_GetScrollPos(int nBar) const + { + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_GetScrollPos(pT->m_hWnd, nBar); + } + + int FlatSB_SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_SetScrollPos(pT->m_hWnd, nBar, nPos, bRedraw); + } + + BOOL FlatSB_GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const + { + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_GetScrollRange(pT->m_hWnd, nBar, lpMinPos, lpMaxPos); + } + + BOOL FlatSB_SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_SetScrollRange(pT->m_hWnd, nBar, nMinPos, nMaxPos, bRedraw); + } + + BOOL FlatSB_GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) const + { + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_GetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo); + } + + int FlatSB_SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_SetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo, bRedraw); + } + +// Operations + BOOL FlatSB_ShowScrollBar(UINT nBar, BOOL bShow = TRUE) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_ShowScrollBar(pT->m_hWnd, nBar, bShow); + } + + BOOL FlatSB_EnableScrollBar(UINT uSBFlags, UINT uArrowFlags = ESB_ENABLE_BOTH) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::FlatSB_EnableScrollBar(pT->m_hWnd, uSBFlags, uArrowFlags); + } +}; + +template +class CFlatScrollBarT : public TBase, public CFlatScrollBarImpl > +{ +public: + CFlatScrollBarT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CFlatScrollBarT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } +}; + +typedef CFlatScrollBarT CFlatScrollBar; + +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CIPAddressCtrl + +#if (_WIN32_IE >= 0x0400) + +template +class CIPAddressCtrlT : public TBase +{ +public: +// Constructors + CIPAddressCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CIPAddressCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Atteributes + static LPCTSTR GetWndClassName() + { + return WC_IPADDRESS; + } + + BOOL IsBlank() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, IPM_ISBLANK, 0, 0L); + } + + int GetAddress(LPDWORD lpdwAddress) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, IPM_GETADDRESS, 0, (LPARAM)lpdwAddress); + } + + void SetAddress(DWORD dwAddress) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IPM_SETADDRESS, 0, dwAddress); + } + + void ClearAddress() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IPM_CLEARADDRESS, 0, 0L); + } + + void SetRange(int nField, WORD wRange) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IPM_SETRANGE, nField, wRange); + } + + void SetRange(int nField, BYTE nMin, BYTE nMax) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IPM_SETRANGE, nField, MAKEIPRANGE(nMin, nMax)); + } + + void SetFocus(int nField) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IPM_SETFOCUS, nField, 0L); + } +}; + +typedef CIPAddressCtrlT CIPAddressCtrl; + +#endif // (_WIN32_IE >= 0x0400) + + +/////////////////////////////////////////////////////////////////////////////// +// CPagerCtrl + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +template +class CPagerCtrlT : public TBase +{ +public: +// Constructors + CPagerCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CPagerCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_PAGESCROLLER; + } + + int GetButtonSize() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PGM_GETBUTTONSIZE, 0, 0L); + } + + int SetButtonSize(int nButtonSize) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PGM_SETBUTTONSIZE, 0, nButtonSize); + } + + DWORD GetButtonState(int nButton) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nButton == PGB_TOPORLEFT || nButton == PGB_BOTTOMORRIGHT); + return (DWORD)::SendMessage(m_hWnd, PGM_GETBUTTONSTATE, 0, nButton); + } + + COLORREF GetBkColor() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, PGM_GETBKCOLOR, 0, 0L); + } + + COLORREF SetBkColor(COLORREF clrBk) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (COLORREF)::SendMessage(m_hWnd, PGM_SETBKCOLOR, 0, (LPARAM)clrBk); + } + + int GetBorder() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PGM_GETBORDER, 0, 0L); + } + + int SetBorder(int nBorderSize) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PGM_SETBORDER, 0, nBorderSize); + } + + int GetPos() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PGM_GETPOS, 0, 0L); + } + + int SetPos(int nPos) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PGM_SETPOS, 0, nPos); + } + +// Operations + void SetChild(HWND hWndChild) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PGM_SETCHILD, 0, (LPARAM)hWndChild); + } + + void ForwardMouse(BOOL bForward = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PGM_FORWARDMOUSE, bForward, 0L); + } + + void RecalcSize() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PGM_RECALCSIZE, 0, 0L); + } + + void GetDropTarget(IDropTarget** ppDropTarget) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(ppDropTarget != NULL); + ::SendMessage(m_hWnd, PGM_GETDROPTARGET, 0, (LPARAM)ppDropTarget); + } +}; + +typedef CPagerCtrlT CPagerCtrl; + +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CLinkCtrl - Windows SYSLINK control + +#if (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) + +template +class CLinkCtrlT : public TBase +{ +public: +// Constructors + CLinkCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CLinkCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + } + +// Attributes + static LPCTSTR GetWndClassName() + { +#ifdef _UNICODE + return WC_LINK; +#else // !_UNICODE + return "SysLink"; +#endif // !_UNICODE + } + + int GetIdealHeight(int cxMaxWidth = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); + } + + BOOL GetItem(PLITEM pLItem) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); + } + + BOOL SetItem(PLITEM pLItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); + } + + // Vista only + int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const + { +#ifndef LM_GETIDEALSIZE + const UINT LM_GETIDEALSIZE = LM_GETIDEALHEIGHT; +#endif + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); + } + +// Operations + BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); + } +}; + +typedef CLinkCtrlT CLinkCtrl; + +#endif // (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CCustomDraw - MI class for custom-draw support + +template +class CCustomDraw +{ +public: +#if (_ATL_VER < 0x0700) + BOOL m_bHandledCD; + + BOOL IsMsgHandled() const + { + return m_bHandledCD; + } + + void SetMsgHandled(BOOL bHandled) + { + m_bHandledCD = bHandled; + } +#endif // !(_ATL_VER < 0x0700) + +// Message map and handlers + BEGIN_MSG_MAP(CCustomDraw< T >) + NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) + ALT_MSG_MAP(1) + REFLECTED_NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) + END_MSG_MAP() + +// message handler + LRESULT OnCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->SetMsgHandled(TRUE); + LPNMCUSTOMDRAW lpNMCustomDraw = (LPNMCUSTOMDRAW)pnmh; + DWORD dwRet = 0; + switch(lpNMCustomDraw->dwDrawStage) + { + case CDDS_PREPAINT: + dwRet = pT->OnPrePaint(idCtrl, lpNMCustomDraw); + break; + case CDDS_POSTPAINT: + dwRet = pT->OnPostPaint(idCtrl, lpNMCustomDraw); + break; + case CDDS_PREERASE: + dwRet = pT->OnPreErase(idCtrl, lpNMCustomDraw); + break; + case CDDS_POSTERASE: + dwRet = pT->OnPostErase(idCtrl, lpNMCustomDraw); + break; + case CDDS_ITEMPREPAINT: + dwRet = pT->OnItemPrePaint(idCtrl, lpNMCustomDraw); + break; + case CDDS_ITEMPOSTPAINT: + dwRet = pT->OnItemPostPaint(idCtrl, lpNMCustomDraw); + break; + case CDDS_ITEMPREERASE: + dwRet = pT->OnItemPreErase(idCtrl, lpNMCustomDraw); + break; + case CDDS_ITEMPOSTERASE: + dwRet = pT->OnItemPostErase(idCtrl, lpNMCustomDraw); + break; +#if (_WIN32_IE >= 0x0400) + case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): + dwRet = pT->OnSubItemPrePaint(idCtrl, lpNMCustomDraw); + break; +#endif // (_WIN32_IE >= 0x0400) + default: + pT->SetMsgHandled(FALSE); + break; + } + bHandled = pT->IsMsgHandled(); + return dwRet; + } + +// Overrideables + DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnItemPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + + DWORD OnItemPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } + +#if (_WIN32_IE >= 0x0400) + DWORD OnSubItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_DODEFAULT; + } +#endif // (_WIN32_IE >= 0x0400) +}; + + +// --- Windows CE common controls --- + +#ifdef _WIN32_WCE + +/////////////////////////////////////////////////////////////////////////////// +// CCECommandBarCtrl + +template +class CCECommandBarCtrlT : public TBase +{ +public: +// Constructors + CCECommandBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } + + CCECommandBarCtrlT< TBase >& operator=(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Attributes + BOOL IsVisible() const + { + return IsWindowVisible(); + } + + int GetHeight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_Height(m_hWnd); + } + + HMENU GetMenu(WORD wButton) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_GetMenu(m_hWnd, wButton); + } + +// Operations + HWND Create(HWND hWndParent, int nCmdBarID) + { + m_hWnd = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), hWndParent, nCmdBarID); + ATLASSERT(::IsWindow(m_hWnd)); + return m_hWnd; + } + + void Destroy() + { + DestroyWindow(); + } + + BOOL Show(BOOL bShow = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_Show(m_hWnd, bShow); + } + + BOOL DrawMenuBar(WORD wButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_DrawMenuBar(m_hWnd, wButton); + } + + BOOL AddAdornments(DWORD dwFlags = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_AddAdornments(m_hWnd, dwFlags, 0); + } + + int AddBitmap(int nBitmapID, int nNumImages) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_AddBitmap(m_hWnd, ModuleHelper::GetResourceInstance(), nBitmapID, nNumImages, 16, 16); + } + + BOOL AddButtons(UINT uNumButtons, LPTBBUTTON lpButtons) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CommandBar_AddButtons(m_hWnd, uNumButtons, lpButtons); + } + + BOOL AddToolTips(UINT uNumToolTips, LPTSTR lpToolTips) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CommandBar_AddToolTips(m_hWnd, uNumToolTips, lpToolTips); + } + + BOOL InsertButton(int nButton, LPTBBUTTON lpButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return CommandBar_InsertButton(m_hWnd, nButton, lpButton); + } + + HWND InsertComboBox(int nWidth, UINT dwStyle, WORD wComboBoxID, WORD wButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_InsertComboBox(m_hWnd, ModuleHelper::GetModuleInstance(), nWidth, dwStyle, wComboBoxID, wButton); + } + + BOOL InsertMenubar(WORD wMenuID, WORD wButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_InsertMenubar(m_hWnd, ModuleHelper::GetResourceInstance(), wMenuID, wButton); + } + + BOOL InsertMenubarEx(ATL::_U_STRINGorID menu, WORD wButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBar_InsertMenubarEx(m_hWnd, ModuleHelper::GetResourceInstance(), (LPTSTR)menu.m_lpstr, wButton); + } + + BOOL IsCommandBarMessage(LPMSG lpMsg) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::IsCommandBarMessage(m_hWnd, lpMsg); + } +}; + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC MenuBar + typedef CCECommandBarCtrlT CMenuBarCtrl; +#else + typedef CCECommandBarCtrlT CCECommandBarCtrl; +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + +/////////////////////////////////////////////////////////////////////////////// +// CCECommandBandsCtrl + +template +class CCECommandBandsCtrlT : public TBase +{ +public: +// Constructors + CCECommandBandsCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } + + CCECommandBandsCtrlT< TBase >& operator=(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Attributes + BOOL IsVisible() const + { + return IsWindowVisible(); + } + +#if (_WIN32_IE >= 0x0400) + UINT GetHeight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CommandBands_Height(m_hWnd); + } +#endif // (_WIN32_IE >= 0x0400) + + HWND GetCommandBar(UINT uBand) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBands_GetCommandBar(m_hWnd, uBand); + } + + BOOL GetRestoreInformation(UINT uBand, LPCOMMANDBANDSRESTOREINFO pcbr) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBands_GetRestoreInformation(m_hWnd, uBand, pcbr); + } + +// Operations + HWND Create(HWND hWndParent, UINT wID, DWORD dwStyles, HIMAGELIST hImageList = NULL) + { + m_hWnd = ::CommandBands_Create(ModuleHelper::GetModuleInstance(), hWndParent, wID, dwStyles, hImageList); + ATLASSERT(::IsWindow(m_hWnd)); + return m_hWnd; + } + + BOOL AddAdornments(DWORD dwFlags = 0, LPREBARBANDINFO prbbi = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBands_AddAdornments(m_hWnd, ModuleHelper::GetModuleInstance(), dwFlags, prbbi); + } + + BOOL AddBands(UINT uBandCount, LPREBARBANDINFO prbbi) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBands_AddBands(m_hWnd, ModuleHelper::GetModuleInstance(), uBandCount, prbbi); + } + + BOOL Show(BOOL bShow = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::CommandBands_Show(m_hWnd, bShow); + } +}; + +typedef CCECommandBandsCtrlT CCECommandBandsCtrl; + +#endif // _WIN32_WCE + +}; // namespace WTL + +#endif // __ATLCTRLS_H__ diff --git a/Externals/WTL80/atlctrlw.h b/Externals/WTL80/atlctrlw.h index 3bf16ee586..00f4000730 100644 --- a/Externals/WTL80/atlctrlw.h +++ b/Externals/WTL80/atlctrlw.h @@ -1,4161 +1,4161 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCTRLW_H__ -#define __ATLCTRLW_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifdef _WIN32_WCE - #error atlctrlw.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atlctrlw.h requires atlapp.h to be included first -#endif - -#ifndef __ATLCTRLS_H__ - #error atlctrlw.h requires atlctrls.h to be included first -#endif - -#if (_WIN32_IE < 0x0400) - #error atlctrlw.h requires _WIN32_IE >= 0x0400 -#endif - -// Define _WTL_CMDBAR_VISTA_MENUS as 0 to exclude Vista menus support -#if !defined(_WTL_CMDBAR_VISTA_MENUS) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - #define _WTL_CMDBAR_VISTA_MENUS 1 -#endif - -#if _WTL_CMDBAR_VISTA_MENUS - #if !((_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501)) - #error _WTL_CMDBAR_VISTA_MENUS requires (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - #endif -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CCommandBarCtrlImpl -// CCommandBarCtrl -// CMDICommandBarCtrlImpl -// CMDICommandBarCtrl - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// Command Bars - -// Window Styles: -#define CBRWS_TOP CCS_TOP -#define CBRWS_BOTTOM CCS_BOTTOM -#define CBRWS_NORESIZE CCS_NORESIZE -#define CBRWS_NOPARENTALIGN CCS_NOPARENTALIGN -#define CBRWS_NODIVIDER CCS_NODIVIDER - -// Extended styles -#define CBR_EX_TRANSPARENT 0x00000001L -#define CBR_EX_SHAREMENU 0x00000002L -#define CBR_EX_ALTFOCUSMODE 0x00000004L -#define CBR_EX_TRACKALWAYS 0x00000008L -#define CBR_EX_NOVISTAMENUS 0x00000010L - -// standard command bar styles -#define ATL_SIMPLE_CMDBAR_PANE_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CBRWS_NODIVIDER | CBRWS_NORESIZE | CBRWS_NOPARENTALIGN) - -// Messages - support chevrons for frame windows -#define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND -#define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu -#define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu - -typedef struct tagCBRPOPUPMENU -{ - int cbSize; - HMENU hMenu; // popup menu do display - UINT uFlags; // TPM_* flags for ::TrackPopupMenuEx - int x; - int y; - LPTPMPARAMS lptpm; // ptr to TPMPARAMS for ::TrackPopupMenuEx -} CBRPOPUPMENU, *LPCBRPOPUPMENU; - -// helper class -template -class CSimpleStack : public ATL::CSimpleArray< T > -{ -public: - BOOL Push(T t) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-PUSH (%8.8X) size = %i\n"), t, GetSize()); -#endif - return Add(t); - } - - T Pop() - { - int nLast = GetSize() - 1; - if(nLast < 0) - return NULL; // must be able to convert to NULL - T t = m_aT[nLast]; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-POP (%8.8X) size = %i\n"), t, GetSize()); -#endif - if(!RemoveAt(nLast)) - return NULL; - return t; - } - - T GetCurrent() - { - int nLast = GetSize() - 1; - if(nLast < 0) - return NULL; // must be able to convert to NULL - return m_aT[nLast]; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CCommandBarCtrlBase - base class for the Command Bar implementation - -class CCommandBarCtrlBase : public CToolBarCtrl -{ -public: - struct _MsgHookData - { - HHOOK hMsgHook; - DWORD dwUsage; - - _MsgHookData() : hMsgHook(NULL), dwUsage(0) - { } - }; - - typedef ATL::CSimpleMap CMsgHookMap; - static CMsgHookMap* s_pmapMsgHook; - - static HHOOK s_hCreateHook; - static bool s_bW2K; // For animation flag - static CCommandBarCtrlBase* s_pCurrentBar; - static bool s_bStaticInit; - - CSimpleStack m_stackMenuWnd; - CSimpleStack m_stackMenuHandle; - - HWND m_hWndHook; - DWORD m_dwMagic; - - - CCommandBarCtrlBase() : m_hWndHook(NULL), m_dwMagic(1314) - { - // init static variables - if(!s_bStaticInit) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlBase::CCommandBarCtrlBase.\n")); - ATLASSERT(FALSE); - return; - } - - if(!s_bStaticInit) - { - // Just in case... - AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); - // Animation on Win2000 only - s_bW2K = !AtlIsOldWindows(); - // done - s_bStaticInit = true; - } - - lock.Unlock(); - } - } - - bool IsCommandBarBase() const { return m_dwMagic == 1314; } -}; - -__declspec(selectany) CCommandBarCtrlBase::CMsgHookMap* CCommandBarCtrlBase::s_pmapMsgHook = NULL; -__declspec(selectany) HHOOK CCommandBarCtrlBase::s_hCreateHook = NULL; -__declspec(selectany) CCommandBarCtrlBase* CCommandBarCtrlBase::s_pCurrentBar = NULL; -__declspec(selectany) bool CCommandBarCtrlBase::s_bW2K = false; -__declspec(selectany) bool CCommandBarCtrlBase::s_bStaticInit = false; - - -/////////////////////////////////////////////////////////////////////////////// -// CCommandBarCtrl - ATL implementation of Command Bars - -template -class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - -// Declarations - struct _MenuItemData // menu item data - { - DWORD dwMagic; - LPTSTR lpstrText; - UINT fType; - UINT fState; - int iButton; - - _MenuItemData() { dwMagic = 0x1313; } - bool IsCmdBarMenuItem() { return (dwMagic == 0x1313); } - }; - - struct _ToolBarData // toolbar resource data - { - WORD wVersion; - WORD wWidth; - WORD wHeight; - WORD wItemCount; - //WORD aItems[wItemCount] - - WORD* items() - { return (WORD*)(this+1); } - }; - -// Constants - enum _CmdBarDrawConstants - { - s_kcxGap = 1, - s_kcxTextMargin = 2, - s_kcxButtonMargin = 3, - s_kcyButtonMargin = 3 - }; - - enum - { - _nMaxMenuItemTextLength = 100, - _chChevronShortcut = _T('/') - }; - -#ifndef DT_HIDEPREFIX - enum { DT_HIDEPREFIX = 0x00100000 }; -#endif // !DT_HIDEPREFIX - -// Data members - HMENU m_hMenu; - HIMAGELIST m_hImageList; - ATL::CSimpleValArray m_arrCommand; - - DWORD m_dwExtendedStyle; // Command Bar specific extended styles - - ATL::CContainedWindow m_wndParent; - - bool m_bMenuActive:1; - bool m_bAttachedMenu:1; - bool m_bImagesVisible:1; - bool m_bPopupItem:1; - bool m_bContextMenu:1; - bool m_bEscapePressed:1; - bool m_bSkipMsg:1; - bool m_bParentActive:1; - bool m_bFlatMenus:1; - bool m_bUseKeyboardCues:1; - bool m_bShowKeyboardCues:1; - bool m_bAllowKeyboardCues:1; - bool m_bKeyboardInput:1; - bool m_bAlphaImages:1; - bool m_bLayoutRTL:1; - bool m_bSkipPostDown:1; - bool m_bVistaMenus:1; - - int m_nPopBtn; - int m_nNextPopBtn; - - SIZE m_szBitmap; - SIZE m_szButton; - - COLORREF m_clrMask; - CFont m_fontMenu; // used internally, only to measure text - - UINT m_uSysKey; - - HWND m_hWndFocus; // Alternate focus mode - - int m_cxExtraSpacing; - -#if _WTL_CMDBAR_VISTA_MENUS - ATL::CSimpleValArray m_arrVistaBitmap; // Bitmaps for Vista menus -#endif // _WTL_CMDBAR_VISTA_MENUS - -// Constructor/destructor - CCommandBarCtrlImpl() : - m_hMenu(NULL), - m_hImageList(NULL), - m_wndParent(this, 1), - m_bMenuActive(false), - m_bAttachedMenu(false), - m_nPopBtn(-1), - m_nNextPopBtn(-1), - m_bPopupItem(false), - m_bImagesVisible(true), - m_bSkipMsg(false), - m_uSysKey(0), - m_hWndFocus(NULL), - m_bContextMenu(false), - m_bEscapePressed(false), - m_clrMask(RGB(192, 192, 192)), - m_dwExtendedStyle(CBR_EX_TRANSPARENT | CBR_EX_SHAREMENU | CBR_EX_TRACKALWAYS), - m_bParentActive(true), - m_bFlatMenus(false), - m_bUseKeyboardCues(false), - m_bShowKeyboardCues(false), - m_bAllowKeyboardCues(true), - m_bKeyboardInput(false), - m_cxExtraSpacing(0), - m_bAlphaImages(false), - m_bLayoutRTL(false), - m_bSkipPostDown(false), - m_bVistaMenus(false) - { - SetImageSize(16, 15); // default - } - - ~CCommandBarCtrlImpl() - { - if(m_wndParent.IsWindow()) -/*scary!*/ m_wndParent.UnsubclassWindow(); - - if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) - ::DestroyMenu(m_hMenu); - - if(m_hImageList != NULL) - ::ImageList_Destroy(m_hImageList); - } - -// Attributes - DWORD GetCommandBarExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetCommandBarExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - CMenuHandle GetMenu() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_hMenu; - } - - COLORREF GetImageMaskColor() const - { - return m_clrMask; - } - - COLORREF SetImageMaskColor(COLORREF clrMask) - { - COLORREF clrOld = m_clrMask; - m_clrMask = clrMask; - return clrOld; - } - - bool GetImagesVisible() const - { - return m_bImagesVisible; - } - - bool SetImagesVisible(bool bVisible) - { - bool bOld = m_bImagesVisible; - m_bImagesVisible = bVisible; - return bOld; - } - - void GetImageSize(SIZE& size) const - { - size = m_szBitmap; - } - - bool SetImageSize(SIZE& size) - { - return SetImageSize(size.cx, size.cy); - } - - bool SetImageSize(int cx, int cy) - { - if(m_hImageList != NULL) - { - if(::ImageList_GetImageCount(m_hImageList) == 0) // empty - { - ::ImageList_Destroy(m_hImageList); - m_hImageList = NULL; - } - else - { - return false; // can't set, image list exists - } - } - - if(cx == 0 || cy == 0) - return false; - - m_szBitmap.cx = cx; - m_szBitmap.cy = cy; - m_szButton.cx = m_szBitmap.cx + 2 * s_kcxButtonMargin; - m_szButton.cy = m_szBitmap.cy + 2 * s_kcyButtonMargin; - - return true; - } - - bool GetAlphaImages() const - { - return m_bAlphaImages; - } - - bool SetAlphaImages(bool bAlphaImages) - { - if(m_hImageList != NULL) - { - if(::ImageList_GetImageCount(m_hImageList) == 0) // empty - { - ::ImageList_Destroy(m_hImageList); - m_hImageList = NULL; - } - else - { - return false; // can't set, image list exists - } - } - - m_bAlphaImages = bAlphaImages; - return true; - } - - HWND GetCmdBar() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); - } - -// Methods - HWND Create(HWND hWndParent, RECT& rcPos, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - UINT nID = 0, LPVOID lpCreateParam = NULL) - { - // These styles are required for command bars - dwStyle |= TBSTYLE_LIST | TBSTYLE_FLAT; -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) - } - - BOOL AttachToWindow(HWND hWnd) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - BOOL bRet = SubclassWindow(hWnd); - if(bRet) - { - m_bAttachedMenu = true; - T* pT = static_cast(this); - pT->GetSystemSettings(); - } - return bRet; - } - - BOOL LoadMenu(ATL::_U_STRINGorID menu) - { - ATLASSERT(::IsWindow(m_hWnd)); - - if(m_bAttachedMenu) // doesn't work in this mode - return FALSE; - if(menu.m_lpstr == NULL) - return FALSE; - - HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); - if(hMenu == NULL) - return FALSE; - - return AttachMenu(hMenu); - } - - BOOL AttachMenu(HMENU hMenu) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); - if(hMenu != NULL && !::IsMenu(hMenu)) - return FALSE; - -#if _WTL_CMDBAR_VISTA_MENUS - // remove Vista bitmaps if used - if(m_bVistaMenus && (m_hMenu != NULL)) - { - T* pT = static_cast(this); - pT->_RemoveVistaBitmapsFromMenu(); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - // destroy old menu, if needed, and set new one - if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) - ::DestroyMenu(m_hMenu); - - m_hMenu = hMenu; - - if(m_bAttachedMenu) // Nothing else in this mode - return TRUE; - - // Build buttons according to menu - SetRedraw(FALSE); - - // Clear all buttons - int nCount = GetButtonCount(); - for(int i = 0; i < nCount; i++) - ATLVERIFY(DeleteButton(0) != FALSE); - - // Add buttons for each menu item - if(m_hMenu != NULL) - { - int nItems = ::GetMenuItemCount(m_hMenu); - - T* pT = static_cast(this); - pT; // avoid level 4 warning - TCHAR szString[pT->_nMaxMenuItemTextLength]; - for(int i = 0; i < nItems; i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU; - mii.fType = MFT_STRING; - mii.dwTypeData = szString; - mii.cch = pT->_nMaxMenuItemTextLength; - BOOL bRet = ::GetMenuItemInfo(m_hMenu, i, TRUE, &mii); - ATLASSERT(bRet); - // If we have more than the buffer, we assume we have bitmaps bits - if(lstrlen(szString) > pT->_nMaxMenuItemTextLength - 1) - { - mii.fType = MFT_BITMAP; - ::SetMenuItemInfo(m_hMenu, i, TRUE, &mii); - szString[0] = 0; - } - - // NOTE: Command Bar currently supports only drop-down menu items - ATLASSERT(mii.hSubMenu != NULL); - - TBBUTTON btn = { 0 }; - btn.iBitmap = 0; - btn.idCommand = i; - btn.fsState = (BYTE)(((mii.fState & MFS_DISABLED) == 0) ? TBSTATE_ENABLED : 0); - btn.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE | TBSTYLE_DROPDOWN; - btn.dwData = 0; - btn.iString = 0; - - bRet = InsertButton(-1, &btn); - ATLASSERT(bRet); - - TBBUTTONINFO bi = { 0 }; - bi.cbSize = sizeof(TBBUTTONINFO); - bi.dwMask = TBIF_TEXT; - bi.pszText = szString; - - bRet = SetButtonInfo(i, &bi); - ATLASSERT(bRet); - } - } - - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); - - return TRUE; - } - - BOOL LoadImages(ATL::_U_STRINGorID image) - { - return _LoadImagesHelper(image, false); - } - - BOOL LoadMappedImages(UINT nIDImage, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) - { - return _LoadImagesHelper(nIDImage, true, nFlags , lpColorMap, nMapSize); - } - - BOOL _LoadImagesHelper(ATL::_U_STRINGorID image, bool bMapped, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); - - HRSRC hRsrc = ::FindResource(hInstance, image.m_lpstr, (LPTSTR)RT_TOOLBAR); - if(hRsrc == NULL) - return FALSE; - - HGLOBAL hGlobal = ::LoadResource(hInstance, hRsrc); - if(hGlobal == NULL) - return FALSE; - - _ToolBarData* pData = (_ToolBarData*)::LockResource(hGlobal); - if(pData == NULL) - return FALSE; - ATLASSERT(pData->wVersion == 1); - - WORD* pItems = pData->items(); - int nItems = pData->wItemCount; - - // Set internal data - SetImageSize(pData->wWidth, pData->wHeight); - - // Create image list if needed - if(m_hImageList == NULL) - { - // Check if the bitmap is 32-bit (alpha channel) bitmap (valid for Windows XP only) - T* pT = static_cast(this); - m_bAlphaImages = AtlIsAlphaBitmapResource(image); - - if(!pT->CreateInternalImageList(pData->wItemCount)) - return FALSE; - } - -#if _WTL_CMDBAR_VISTA_MENUS - int nOldImageCount = ::ImageList_GetImageCount(m_hImageList); -#endif // _WTL_CMDBAR_VISTA_MENUS - - // Add bitmap to our image list - CBitmap bmp; - if(bMapped) - { - ATLASSERT(HIWORD(PtrToUlong(image.m_lpstr)) == 0); // if mapped, must be a numeric ID - int nIDImage = (int)(short)LOWORD(PtrToUlong(image.m_lpstr)); - bmp.LoadMappedBitmap(nIDImage, (WORD)nFlags, lpColorMap, nMapSize); - } - else - { - if(m_bAlphaImages) - bmp = (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); - else - bmp.LoadBitmap(image.m_lpstr); - } - ATLASSERT(bmp.m_hBitmap != NULL); - if(bmp.m_hBitmap == NULL) - return FALSE; - if(::ImageList_AddMasked(m_hImageList, bmp, m_clrMask) == -1) - return FALSE; - - // Fill the array with command IDs - for(int i = 0; i < nItems; i++) - { - if(pItems[i] != 0) - m_arrCommand.Add(pItems[i]); - } - - int nImageCount = ::ImageList_GetImageCount(m_hImageList); - ATLASSERT(nImageCount == m_arrCommand.GetSize()); - if(nImageCount != m_arrCommand.GetSize()) - return FALSE; - -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - T* pT = static_cast(this); - pT->_AddVistaBitmapsFromImageList(nOldImageCount, nImageCount - nOldImageCount); - ATLASSERT(nImageCount == m_arrVistaBitmap.GetSize()); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - return TRUE; - } - - BOOL AddBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - CBitmap bmp; - bmp.LoadBitmap(bitmap.m_lpstr); - if(bmp.m_hBitmap == NULL) - return FALSE; - return AddBitmap(bmp, nCommandID); - } - - BOOL AddBitmap(HBITMAP hBitmap, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - // Create image list if it doesn't exist - if(m_hImageList == NULL) - { - if(!pT->CreateInternalImageList(1)) - return FALSE; - } - // check bitmap size - CBitmapHandle bmp = hBitmap; - SIZE size = { 0, 0 }; - bmp.GetSize(size); - if(size.cx != m_szBitmap.cx || size.cy != m_szBitmap.cy) - { - ATLASSERT(FALSE); // must match size! - return FALSE; - } - // add bitmap - int nRet = ::ImageList_AddMasked(m_hImageList, hBitmap, m_clrMask); - if(nRet == -1) - return FALSE; - BOOL bRet = m_arrCommand.Add((WORD)nCommandID); - ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); - ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - return bRet; - } - - BOOL AddIcon(ATL::_U_STRINGorID icon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); - if(hIcon == NULL) - return FALSE; - return AddIcon(hIcon, nCommandID); - } - - BOOL AddIcon(HICON hIcon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - // create image list if it doesn't exist - if(m_hImageList == NULL) - { - if(!pT->CreateInternalImageList(1)) - return FALSE; - } - - int nRet = ::ImageList_AddIcon(m_hImageList, hIcon); - if(nRet == -1) - return FALSE; - BOOL bRet = m_arrCommand.Add((WORD)nCommandID); - ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); - ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - return bRet; - } - - BOOL ReplaceBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - CBitmap bmp; - bmp.LoadBitmap(bitmap.m_lpstr); - if(bmp.m_hBitmap == NULL) - return FALSE; - return ReplaceBitmap(bmp, nCommandID); - } - - BOOL ReplaceBitmap(HBITMAP hBitmap, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - BOOL bRet = FALSE; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - if(m_arrCommand[i] == nCommandID) - { - bRet = ::ImageList_Remove(m_hImageList, i); - if(bRet) - { - m_arrCommand.RemoveAt(i); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - m_arrVistaBitmap.RemoveAt(i); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - } - break; - } - } - if(bRet) - bRet = AddBitmap(hBitmap, nCommandID); - return bRet; - } - - BOOL ReplaceIcon(ATL::_U_STRINGorID icon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); - if(hIcon == NULL) - return FALSE; - return ReplaceIcon(hIcon, nCommandID); - } - - BOOL ReplaceIcon(HICON hIcon, UINT nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - BOOL bRet = FALSE; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - if(m_arrCommand[i] == nCommandID) - { - bRet = (::ImageList_ReplaceIcon(m_hImageList, i, hIcon) != -1); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista() && bRet != FALSE) - { - T* pT = static_cast(this); - pT->_ReplaceVistaBitmapFromImageList(i); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - break; - } - } - return bRet; - } - - BOOL RemoveImage(int nCommandID) - { - ATLASSERT(::IsWindow(m_hWnd)); - - BOOL bRet = FALSE; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - if(m_arrCommand[i] == nCommandID) - { - bRet = ::ImageList_Remove(m_hImageList, i); - if(bRet) - { - m_arrCommand.RemoveAt(i); -#if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista()) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - m_arrVistaBitmap.RemoveAt(i); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - } - break; - } - } - return bRet; - } - - BOOL RemoveAllImages() - { - ATLASSERT(::IsWindow(m_hWnd)); - - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Removing all images\n")); - BOOL bRet = ::ImageList_RemoveAll(m_hImageList); - if(bRet) - { - m_arrCommand.RemoveAll(); -#if _WTL_CMDBAR_VISTA_MENUS - for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - } - m_arrVistaBitmap.RemoveAll(); -#endif // _WTL_CMDBAR_VISTA_MENUS - } - return bRet; - } - - BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsMenu(hMenu)); - if(!::IsMenu(hMenu)) - return FALSE; - m_bContextMenu = true; - if(m_bUseKeyboardCues) - m_bShowKeyboardCues = m_bKeyboardInput; - T* pT = static_cast(this); - return pT->DoTrackPopupMenu(hMenu, uFlags, x, y, lpParams); - } - - BOOL SetMDIClient(HWND /*hWndMDIClient*/) - { - // Use CMDICommandBarCtrl for MDI support - ATLASSERT(FALSE); - return FALSE; - } - -// Message map and handlers - BEGIN_MSG_MAP(CCommandBarCtrlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_INITMENU, OnInitMenu) - MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) - MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) - MESSAGE_HANDLER(GetAutoPopupMessage(), OnInternalAutoPopup) - MESSAGE_HANDLER(GetGetBarMessage(), OnInternalGetBar) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_MENUCHAR, OnMenuChar) - - MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) - MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) - MESSAGE_HANDLER(WM_CHAR, OnChar) - MESSAGE_HANDLER(WM_SYSKEYDOWN, OnSysKeyDown) - MESSAGE_HANDLER(WM_SYSKEYUP, OnSysKeyUp) - MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar) -// public API handlers - these stay to support chevrons in atlframe.h - MESSAGE_HANDLER(CBRM_GETMENU, OnAPIGetMenu) - MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnAPITrackPopupMenu) - MESSAGE_HANDLER(CBRM_GETCMDBAR, OnAPIGetCmdBar) - - MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) - MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) - - MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg) - ALT_MSG_MAP(1) // Parent window messages - NOTIFY_CODE_HANDLER(TBN_HOTITEMCHANGE, OnParentHotItemChange) - NOTIFY_CODE_HANDLER(TBN_DROPDOWN, OnParentDropDown) - MESSAGE_HANDLER(WM_INITMENUPOPUP, OnParentInitMenuPopup) - MESSAGE_HANDLER(GetGetBarMessage(), OnParentInternalGetBar) - MESSAGE_HANDLER(WM_SYSCOMMAND, OnParentSysCommand) - MESSAGE_HANDLER(CBRM_GETMENU, OnParentAPIGetMenu) - MESSAGE_HANDLER(WM_MENUCHAR, OnParentMenuChar) - MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnParentAPITrackPopupMenu) - MESSAGE_HANDLER(CBRM_GETCMDBAR, OnParentAPIGetCmdBar) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnParentSettingChange) - - MESSAGE_HANDLER(WM_DRAWITEM, OnParentDrawItem) - MESSAGE_HANDLER(WM_MEASUREITEM, OnParentMeasureItem) - - MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) - NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnParentCustomDraw) - ALT_MSG_MAP(2) // MDI client window messages - // Use CMDICommandBarCtrl for MDI support - ALT_MSG_MAP(3) // Message hook messages - MESSAGE_HANDLER(WM_MOUSEMOVE, OnHookMouseMove) - MESSAGE_HANDLER(WM_SYSKEYDOWN, OnHookSysKeyDown) - MESSAGE_HANDLER(WM_SYSKEYUP, OnHookSysKeyUp) - MESSAGE_HANDLER(WM_SYSCHAR, OnHookSysChar) - MESSAGE_HANDLER(WM_KEYDOWN, OnHookKeyDown) - MESSAGE_HANDLER(WM_NEXTMENU, OnHookNextMenu) - MESSAGE_HANDLER(WM_CHAR, OnHookChar) - END_MSG_MAP() - - LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - LPMSG pMsg = (LPMSG)lParam; - if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) - m_bKeyboardInput = false; - else if(pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) - m_bKeyboardInput = true; - LRESULT lRet = 0; - ProcessWindowMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam, lRet, 3); - return lRet; - } - - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - // Let the toolbar initialize itself - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - // get and use system settings - T* pT = static_cast(this); - pT->GetSystemSettings(); - // Parent init - ATL::CWindow wndParent = GetParent(); - ATL::CWindow wndTopLevelParent = wndParent.GetTopLevelParent(); - m_wndParent.SubclassWindow(wndTopLevelParent); - // Toolbar Init - SetButtonStructSize(); - SetImageList(NULL); - - // Create message hook if needed - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnCreate.\n")); - ATLASSERT(FALSE); - return -1; - } - - if(s_pmapMsgHook == NULL) - { - ATLTRY(s_pmapMsgHook = new CMsgHookMap); - ATLASSERT(s_pmapMsgHook != NULL); - } - - if(s_pmapMsgHook != NULL) - { - DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); - if(pData == NULL) - { - ATLTRY(pData = new _MsgHookData); - ATLASSERT(pData != NULL); - HHOOK hMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, MessageHookProc, ModuleHelper::GetModuleInstance(), dwThreadID); - ATLASSERT(hMsgHook != NULL); - if(pData != NULL && hMsgHook != NULL) - { - pData->hMsgHook = hMsgHook; - pData->dwUsage = 1; - BOOL bRet = s_pmapMsgHook->Add(dwThreadID, pData); - bRet; - ATLASSERT(bRet); - } - } - else - { - (pData->dwUsage)++; - } - } - lock.Unlock(); - - // Get layout -#if (WINVER >= 0x0500) - m_bLayoutRTL = ((GetExStyle() & WS_EX_LAYOUTRTL) != 0); -#endif // (WINVER >= 0x0500) - - return lRet; - } - - LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - -#if _WTL_CMDBAR_VISTA_MENUS - if(m_bVistaMenus && (m_hMenu != NULL)) - { - T* pT = static_cast(this); - pT->_RemoveVistaBitmapsFromMenu(); - } - - for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) - { - if(m_arrVistaBitmap[i] != NULL) - ::DeleteObject(m_arrVistaBitmap[i]); - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - if(m_bAttachedMenu) // nothing to do in this mode - return lRet; - - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnDestroy.\n")); - ATLASSERT(FALSE); - return lRet; - } - - if(s_pmapMsgHook != NULL) - { - DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); - if(pData != NULL) - { - (pData->dwUsage)--; - if(pData->dwUsage == 0) - { - BOOL bRet = ::UnhookWindowsHookEx(pData->hMsgHook); - ATLASSERT(bRet); - bRet = s_pmapMsgHook->Remove(dwThreadID); - ATLASSERT(bRet); - if(bRet) - delete pData; - } - - if(s_pmapMsgHook->GetSize() == 0) - { - delete s_pmapMsgHook; - s_pmapMsgHook = NULL; - } - } - } - - lock.Unlock(); - - return lRet; - } - - LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyDown\n")); -#endif - bHandled = FALSE; - // Simulate Alt+Space for the parent - if(wParam == VK_SPACE) - { - m_wndParent.PostMessage(WM_SYSKEYDOWN, wParam, lParam | (1 << 29)); - bHandled = TRUE; - } -#if (_WIN32_IE >= 0x0500) - else if(wParam == VK_LEFT || wParam == VK_RIGHT) - { - WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; - - if(!m_bMenuActive) - { - T* pT = static_cast(this); - int nBtn = GetHotItem(); - int nNextBtn = (wParam == wpNext) ? pT->GetNextMenuItem(nBtn) : pT->GetPreviousMenuItem(nBtn); - if(nNextBtn == -2) - { - SetHotItem(-1); - if(pT->DisplayChevronMenu()) - bHandled = TRUE; - } - } - } -#endif // (_WIN32_IE >= 0x0500) - return 0; - } - - LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyUp\n")); -#endif - if(wParam != VK_SPACE) - bHandled = FALSE; - return 0; - } - - LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnChar\n")); -#endif - if(wParam != VK_SPACE) - bHandled = FALSE; - else - return 0; - // Security - if(!m_wndParent.IsWindowEnabled() || ::GetFocus() != m_hWnd) - return 0; - - // Handle mnemonic press when we have focus - int nBtn = 0; - if(wParam != VK_RETURN && !MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) - { -#if (_WIN32_IE >= 0x0500) - if((TCHAR)LOWORD(wParam) != _chChevronShortcut) -#endif // (_WIN32_IE >= 0x0500) - ::MessageBeep(0); - } - else - { -#if (_WIN32_IE >= 0x0500) - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcBtn = { 0 }; - GetItemRect(nBtn, &rcBtn); - TBBUTTON tbb = { 0 }; - GetButton(nBtn, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) - { -#endif // (_WIN32_IE >= 0x0500) - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - if(wParam != VK_RETURN) - SetHotItem(nBtn); -#if (_WIN32_IE >= 0x0500) - } - else - { - ::MessageBeep(0); - bHandled = TRUE; - } -#endif // (_WIN32_IE >= 0x0500) - } - return 0; - } - - LRESULT OnSysKeyDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyDown\n")); -#endif - bHandled = FALSE; - return 0; - } - - LRESULT OnSysKeyUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyUp\n")); -#endif - bHandled = FALSE; - return 0; - } - - LRESULT OnSysChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysChar\n")); -#endif - bHandled = FALSE; - return 0; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bAttachedMenu || (m_dwExtendedStyle & CBR_EX_TRANSPARENT)) - { - bHandled = FALSE; - return 0; - } - - CDCHandle dc = (HDC)wParam; - RECT rect = { 0 }; - GetClientRect(&rect); - dc.FillRect(&rect, COLOR_MENU); - - return 1; // don't do the default erase - } - - LRESULT OnInitMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - int nIndex = GetHotItem(); - SendMessage(WM_MENUSELECT, MAKEWPARAM(nIndex, MF_POPUP|MF_HILITE), (LPARAM)m_hMenu); - bHandled = FALSE; - return 1; - } - - LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if((BOOL)HIWORD(lParam)) // System menu, do nothing - { - bHandled = FALSE; - return 1; - } - - if(!(m_bAttachedMenu || m_bMenuActive)) // Not attached or ours, do nothing - { - bHandled = FALSE; - return 1; - } - -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnInitMenuPopup\n")); -#endif - // forward to the parent or subclassed window, so it can handle update UI - LRESULT lRet = 0; - if(m_bAttachedMenu) - lRet = DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); - else - lRet = m_wndParent.DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); - -#if _WTL_CMDBAR_VISTA_MENUS - // If Vista menus are active, just set bitmaps and return - if(m_bVistaMenus) - { - CMenuHandle menu = (HMENU)wParam; - ATLASSERT(menu.m_hMenu != NULL); - - for(int i = 0; i < menu.GetMenuItemCount(); i++) - { - WORD nID = (WORD)menu.GetMenuItemID(i); - int nIndex = m_arrCommand.Find(nID); - - CMenuItemInfo mii; - mii.fMask = MIIM_BITMAP; - mii.hbmpItem = (m_bImagesVisible && (nIndex != -1)) ? m_arrVistaBitmap[nIndex] : NULL; - menu.SetMenuItemInfo(i, TRUE, &mii); - } - - return lRet; - } -#endif // _WTL_CMDBAR_VISTA_MENUS - - // Convert menu items to ownerdraw, add our data - if(m_bImagesVisible) - { - CMenuHandle menuPopup = (HMENU)wParam; - ATLASSERT(menuPopup.m_hMenu != NULL); - - T* pT = static_cast(this); - pT; // avoid level 4 warning - TCHAR szString[pT->_nMaxMenuItemTextLength]; - BOOL bRet = FALSE; - for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) - { - CMenuItemInfo mii; - mii.cch = pT->_nMaxMenuItemTextLength; - mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; - mii.dwTypeData = szString; - bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - if(!(mii.fType & MFT_OWNERDRAW)) // Not already an ownerdraw item - { - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - _MenuItemData* pMI = NULL; - ATLTRY(pMI = new _MenuItemData); - ATLASSERT(pMI != NULL); - if(pMI != NULL) - { - pMI->fType = mii.fType; - pMI->fState = mii.fState; - mii.fType |= MFT_OWNERDRAW; - pMI->iButton = -1; - for(int j = 0; j < m_arrCommand.GetSize(); j++) - { - if(m_arrCommand[j] == mii.wID) - { - pMI->iButton = j; - break; - } - } - int cchLen = lstrlen(szString) + 1; - pMI->lpstrText = NULL; - ATLTRY(pMI->lpstrText = new TCHAR[cchLen]); - ATLASSERT(pMI->lpstrText != NULL); - if(pMI->lpstrText != NULL) - SecureHelper::strcpy_x(pMI->lpstrText, cchLen, szString); - mii.dwItemData = (ULONG_PTR)pMI; - bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - } - } - } - - // Add it to the list - m_stackMenuHandle.Push(menuPopup.m_hMenu); - } - - return lRet; - } - - LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if(!m_bAttachedMenu) // Not attached, do nothing, forward to parent - { - m_bPopupItem = (lParam != NULL) && ((HMENU)lParam != m_hMenu) && (HIWORD(wParam) & MF_POPUP); - if(m_wndParent.IsWindow()) - m_wndParent.SendMessage(uMsg, wParam, lParam); - bHandled = FALSE; - return 1; - } - - // Check if a menu is closing, do a cleanup - if(HIWORD(wParam) == 0xFFFF && lParam == NULL) // Menu closing - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuSelect - CLOSING!!!!\n")); -#endif - ATLASSERT(m_stackMenuWnd.GetSize() == 0); - // Restore the menu items to the previous state for all menus that were converted - if(m_bImagesVisible) - { - HMENU hMenu = NULL; - while((hMenu = m_stackMenuHandle.Pop()) != NULL) - { - CMenuHandle menuPopup = hMenu; - ATLASSERT(menuPopup.m_hMenu != NULL); - // Restore state and delete menu item data - BOOL bRet = FALSE; - for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_DATA | MIIM_TYPE; - bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; - if(pMI != NULL && pMI->IsCmdBarMenuItem()) - { - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - mii.fType = pMI->fType; - mii.dwTypeData = pMI->lpstrText; - mii.cch = lstrlen(pMI->lpstrText); - mii.dwItemData = NULL; - - bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - delete [] pMI->lpstrText; - pMI->dwMagic = 0x6666; - delete pMI; - } - } - } - } - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnInternalAutoPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - int nIndex = (int)wParam; - T* pT = static_cast(this); - pT->DoPopupMenu(nIndex, false); - return 0; - } - - LRESULT OnInternalGetBar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // Let's make sure we're not embedded in another process - if((LPVOID)wParam != NULL) - *((DWORD*)wParam) = GetCurrentProcessId(); - if(IsWindowVisible()) - return (LRESULT)static_cast(this); - else - return NULL; - } - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { -#ifndef SPI_GETKEYBOARDCUES - const UINT SPI_SETKEYBOARDCUES = 0x100B; -#endif // !SPI_GETKEYBOARDCUES -#ifndef SPI_GETFLATMENU - const UINT SPI_SETFLATMENU = 0x1023; -#endif // !SPI_GETFLATMENU - - if(wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETKEYBOARDCUES || wParam == SPI_SETFLATMENU) - { - T* pT = static_cast(this); - pT->GetSystemSettings(); - } - - return 0; - } - - LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - - LPWINDOWPOS lpWP = (LPWINDOWPOS)lParam; - int cyMin = ::GetSystemMetrics(SM_CYMENU); - if(lpWP->cy < cyMin) - lpWP->cy = cyMin; - - return lRet; - } - - LRESULT OnMenuChar(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuChar\n")); -#endif - bHandled = TRUE; - T* pT = static_cast(this); - - LRESULT lRet; - if(m_bMenuActive && LOWORD(wParam) != 0x0D) - lRet = 0; - else - lRet = MAKELRESULT(1, 1); - - if(m_bMenuActive && HIWORD(wParam) == MF_POPUP) - { - // Convert character to lower/uppercase and possibly Unicode, using current keyboard layout - TCHAR ch = (TCHAR)LOWORD(wParam); - CMenuHandle menu = (HMENU)lParam; - int nCount = ::GetMenuItemCount(menu); - int nRetCode = MNC_EXECUTE; - BOOL bRet = FALSE; - TCHAR szString[pT->_nMaxMenuItemTextLength]; - WORD wMnem = 0; - bool bFound = false; - for(int i = 0; i < nCount; i++) - { - CMenuItemInfo mii; - mii.cch = pT->_nMaxMenuItemTextLength; - mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; - mii.dwTypeData = szString; - bRet = menu.GetMenuItemInfo(i, TRUE, &mii); - if(!bRet || (mii.fType & MFT_SEPARATOR)) - continue; - _MenuItemData* pmd = (_MenuItemData*)mii.dwItemData; - if(pmd != NULL && pmd->IsCmdBarMenuItem()) - { - LPTSTR p = pmd->lpstrText; - - if(p != NULL) - { - while(*p && *p != _T('&')) - p = ::CharNext(p); - if(p != NULL && *p) - { - DWORD dwP = MAKELONG(*(++p), 0); - DWORD dwC = MAKELONG(ch, 0); - if(::CharLower((LPTSTR)ULongToPtr(dwP)) == ::CharLower((LPTSTR)ULongToPtr(dwC))) - { - if(!bFound) - { - wMnem = (WORD)i; - bFound = true; - } - else - { - nRetCode = MNC_SELECT; - break; - } - } - } - } - } - } - if(bFound) - { - if(nRetCode == MNC_EXECUTE) - { - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - pT->GiveFocusBack(); - } - bHandled = TRUE; - lRet = MAKELRESULT(wMnem, nRetCode); - } - } - else if(!m_bMenuActive) - { - int nBtn = 0; - if(!MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) - { - bHandled = FALSE; - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - pT->GiveFocusBack(); - -#if (_WIN32_IE >= 0x0500) - // check if we should display chevron menu - if((TCHAR)LOWORD(wParam) == pT->_chChevronShortcut) - { - if(pT->DisplayChevronMenu()) - bHandled = TRUE; - } -#endif // (_WIN32_IE >= 0x0500) - } - else if(m_wndParent.IsWindowEnabled()) - { -#if (_WIN32_IE >= 0x0500) - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcBtn = { 0 }; - GetItemRect(nBtn, &rcBtn); - TBBUTTON tbb = { 0 }; - GetButton(nBtn, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) - { -#endif // (_WIN32_IE >= 0x0500) - if(m_bUseKeyboardCues && !m_bShowKeyboardCues) - { - m_bAllowKeyboardCues = true; - ShowKeyboardCues(true); - } - pT->TakeFocus(); - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - SetHotItem(nBtn); -#if (_WIN32_IE >= 0x0500) - } - else - { - ::MessageBeep(0); - } -#endif // (_WIN32_IE >= 0x0500) - } - } - - return lRet; - } - - LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - LPDRAWITEMSTRUCT lpDrawItemStruct = (LPDRAWITEMSTRUCT)lParam; - _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - if(lpDrawItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) - { - T* pT = static_cast(this); - pT->DrawItem(lpDrawItemStruct); - } - else - { - bHandled = FALSE; - } - return (LRESULT)TRUE; - } - - LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - LPMEASUREITEMSTRUCT lpMeasureItemStruct = (LPMEASUREITEMSTRUCT)lParam; - _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; - if(lpMeasureItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) - { - T* pT = static_cast(this); - pT->MeasureItem(lpMeasureItemStruct); - } - else - { - bHandled = FALSE; - } - return (LRESULT)TRUE; - } - -// API message handlers - LRESULT OnAPIGetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hMenu; - } - - LRESULT OnAPITrackPopupMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - if(lParam == NULL) - return FALSE; - LPCBRPOPUPMENU lpCBRPopupMenu = (LPCBRPOPUPMENU)lParam; - if(lpCBRPopupMenu->cbSize != sizeof(CBRPOPUPMENU)) - return FALSE; - - T* pT = static_cast(this); - return pT->TrackPopupMenu(lpCBRPopupMenu->hMenu, lpCBRPopupMenu->uFlags, lpCBRPopupMenu->x, lpCBRPopupMenu->y, lpCBRPopupMenu->lptpm); - } - - LRESULT OnAPIGetCmdBar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hWnd; - } - -// Parent window message handlers - LRESULT OnParentHotItemChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LPNMTBHOTITEM lpNMHT = (LPNMTBHOTITEM)pnmh; - - // Check if this comes from us - if(pnmh->hwndFrom != m_hWnd) - { - bHandled = FALSE; - return 0; - } - - bool bBlockTracking = false; - if((m_dwExtendedStyle & CBR_EX_TRACKALWAYS) == 0) - { - DWORD dwProcessID; - ::GetWindowThreadProcessId(::GetActiveWindow(), &dwProcessID); - bBlockTracking = (::GetCurrentProcessId() != dwProcessID); - } - - if((!m_wndParent.IsWindowEnabled() || bBlockTracking) && (lpNMHT->dwFlags & HICF_MOUSE)) - { - return 1; - } - else - { -#ifndef HICF_LMOUSE - const DWORD HICF_LMOUSE = 0x00000080; // left mouse button selected -#endif - bHandled = FALSE; - - // Send WM_MENUSELECT to the app if it needs to display a status text - if(!(lpNMHT->dwFlags & HICF_MOUSE) - && !(lpNMHT->dwFlags & HICF_ACCELERATOR) - && !(lpNMHT->dwFlags & HICF_LMOUSE)) - { - if(lpNMHT->dwFlags & HICF_ENTERING) - m_wndParent.SendMessage(WM_MENUSELECT, 0, (LPARAM)m_hMenu); - if(lpNMHT->dwFlags & HICF_LEAVING) - m_wndParent.SendMessage(WM_MENUSELECT, MAKEWPARAM(0, 0xFFFF), NULL); - } - - return 0; - } - } - - LRESULT OnParentDropDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - // Check if this comes from us - if(pnmh->hwndFrom != m_hWnd) - { - bHandled = FALSE; - return 1; - } - - T* pT = static_cast(this); - if(::GetFocus() != m_hWnd) - pT->TakeFocus(); - LPNMTOOLBAR pNMToolBar = (LPNMTOOLBAR)pnmh; - int nIndex = CommandToIndex(pNMToolBar->iItem); - m_bContextMenu = false; - m_bEscapePressed = false; - pT->DoPopupMenu(nIndex, true); - - return TBDDRET_DEFAULT; - } - - LRESULT OnParentInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnInitMenuPopup(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentInternalGetBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnInternalGetBar(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; - if((m_uSysKey == VK_MENU - || (m_uSysKey == VK_F10 && !(::GetKeyState(VK_SHIFT) & 0x80)) - || m_uSysKey == VK_SPACE) - && wParam == SC_KEYMENU) - { - T* pT = static_cast(this); - if(::GetFocus() == m_hWnd) - { - pT->GiveFocusBack(); // exit menu "loop" - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - } - else if(m_uSysKey != VK_SPACE && !m_bSkipMsg) - { - if(m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) - ShowKeyboardCues(true); - - pT->TakeFocus(); // enter menu "loop" - bHandled = TRUE; - } - else if(m_uSysKey != VK_SPACE) - { - bHandled = TRUE; - } - } - m_bSkipMsg = false; - return 0; - } - - LRESULT OnParentAPIGetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnAPIGetMenu(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentMenuChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnMenuChar(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentAPITrackPopupMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnAPITrackPopupMenu(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentAPIGetCmdBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnAPIGetCmdBar(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - OnSettingChange(uMsg, wParam, lParam, bHandled); - bHandled = FALSE; - return 1; - } - - LRESULT OnParentDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnDrawItem(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnMeasureItem(uMsg, wParam, lParam, bHandled); - } - - LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); - if(!m_bParentActive && m_bUseKeyboardCues && m_bShowKeyboardCues) - { - ShowKeyboardCues(false); // this will repaint our window - } - else - { - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnParentCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LRESULT lRet = CDRF_DODEFAULT; - bHandled = FALSE; - if(pnmh->hwndFrom == m_hWnd) - { - LPNMTBCUSTOMDRAW lpTBCustomDraw = (LPNMTBCUSTOMDRAW)pnmh; - if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_PREPAINT) - { - lRet = CDRF_NOTIFYITEMDRAW; - bHandled = TRUE; - } - else if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) - { - if(m_bFlatMenus) - { -#ifndef COLOR_MENUHILIGHT - const int COLOR_MENUHILIGHT = 29; -#endif // !COLOR_MENUHILIGHT - bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); - if(!bDisabled && ((lpTBCustomDraw->nmcd.uItemState & CDIS_HOT) == CDIS_HOT || - (lpTBCustomDraw->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)) - { - ::FillRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_MENUHILIGHT)); - ::FrameRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - lpTBCustomDraw->clrText = ::GetSysColor(m_bParentActive ? COLOR_HIGHLIGHTTEXT : COLOR_GRAYTEXT); - } - else if(bDisabled || !m_bParentActive) - { - lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); - } - CDCHandle dc = lpTBCustomDraw->nmcd.hdc; - dc.SetTextColor(lpTBCustomDraw->clrText); - dc.SetBkMode(lpTBCustomDraw->nStringBkMode); - HFONT hFont = GetFont(); - HFONT hFontOld = NULL; - if(hFont != NULL) - hFontOld = dc.SelectFont(hFont); - const int cchText = 200; - TCHAR szText[cchText] = { 0 }; - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = TBIF_TEXT; - tbbi.pszText = szText; - tbbi.cchText = cchText; - GetButtonInfo((int)lpTBCustomDraw->nmcd.dwItemSpec, &tbbi); - dc.DrawText(szText, -1, &lpTBCustomDraw->nmcd.rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - if(hFont != NULL) - dc.SelectFont(hFontOld); - lRet = CDRF_SKIPDEFAULT; - bHandled = TRUE; - } - else if(!m_bParentActive) - { - lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); - bHandled = TRUE; - } - } - } - return lRet; - } - -// Message hook handlers - LRESULT OnHookMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - static POINT s_point = { -1, -1 }; - DWORD dwPoint = ::GetMessagePos(); - POINT point = { GET_X_LPARAM(dwPoint), GET_Y_LPARAM(dwPoint) }; - - bHandled = FALSE; - if(m_bMenuActive) - { - if(::WindowFromPoint(point) == m_hWnd) - { - ScreenToClient(&point); - int nHit = HitTest(&point); - - if((point.x != s_point.x || point.y != s_point.y) && nHit >= 0 && nHit < ::GetMenuItemCount(m_hMenu) && nHit != m_nPopBtn && m_nPopBtn != -1) - { - TBBUTTON tbb = { 0 }; - GetButton(nHit, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0) - { - m_nNextPopBtn = nHit | 0xFFFF0000; - HWND hWndMenu = m_stackMenuWnd.GetCurrent(); - ATLASSERT(hWndMenu != NULL); - - // this one is needed to close a menu if mouse button was down - ::PostMessage(hWndMenu, WM_LBUTTONUP, 0, MAKELPARAM(point.x, point.y)); - // this one closes a popup menu - ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); - - bHandled = TRUE; - } - } - } - } - else - { - ScreenToClient(&point); - } - - s_point = point; - return 0; - } - - LRESULT OnHookSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYDOWN (0x%2.2X)\n"), wParam); -#endif - - if(wParam == VK_MENU && m_bParentActive && m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) - ShowKeyboardCues(true); - - if(wParam != VK_SPACE && !m_bMenuActive && ::GetFocus() == m_hWnd) - { - m_bAllowKeyboardCues = false; - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - T* pT = static_cast(this); - pT->GiveFocusBack(); - m_bSkipMsg = true; - } - else - { - if(wParam == VK_SPACE && m_bUseKeyboardCues && m_bShowKeyboardCues) - { - m_bAllowKeyboardCues = true; - ShowKeyboardCues(false); - } - m_uSysKey = (UINT)wParam; - } - return 0; - } - - LRESULT OnHookSysKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(!m_bAllowKeyboardCues) - m_bAllowKeyboardCues = true; - bHandled = FALSE; - wParam; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYUP (0x%2.2X)\n"), wParam); -#endif - return 0; - } - - LRESULT OnHookSysChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSCHAR (0x%2.2X)\n"), wParam); -#endif - - if(!m_bMenuActive && m_hWndHook != m_hWnd && wParam != VK_SPACE) - bHandled = TRUE; - return 0; - } - - LRESULT OnHookKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_KEYDOWN (0x%2.2X)\n"), wParam); -#endif - bHandled = FALSE; - T* pT = static_cast(this); - - if(wParam == VK_ESCAPE && m_stackMenuWnd.GetSize() <= 1) - { - if(m_bMenuActive && !m_bContextMenu) - { - int nHot = GetHotItem(); - if(nHot == -1) - nHot = m_nPopBtn; - if(nHot == -1) - nHot = 0; - SetHotItem(nHot); - bHandled = TRUE; - pT->TakeFocus(); - m_bEscapePressed = true; // To keep focus - m_bSkipPostDown = false; - } - else if(::GetFocus() == m_hWnd && m_wndParent.IsWindow()) - { - SetHotItem(-1); - pT->GiveFocusBack(); - bHandled = TRUE; - } - } - else if(wParam == VK_RETURN || wParam == VK_UP || wParam == VK_DOWN) - { - if(!m_bMenuActive && ::GetFocus() == m_hWnd && m_wndParent.IsWindow()) - { - int nHot = GetHotItem(); - if(nHot != -1) - { - if(wParam != VK_RETURN) - { - if(!m_bSkipPostDown) - { -// IE4 only: WM_KEYDOWN doesn't generate TBN_DROPDOWN, we need to simulate a mouse click -#if (_WIN32_IE < 0x0500) - DWORD dwMajor = 0, dwMinor = 0; - ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - if(dwMajor <= 4 || (dwMajor == 5 && dwMinor < 80)) - { - RECT rect; - GetItemRect(nHot, &rect); - PostMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(rect.left, rect.top)); - } -#endif // (_WIN32_IE < 0x0500) - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - m_bSkipPostDown = true; - } - else - { - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - skipping posting another VK_DOWN\n")); - m_bSkipPostDown = false; - } - } - } - else - { - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Can't find hot button\n")); - } - } - if(wParam == VK_RETURN && m_bMenuActive) - { - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); - m_nNextPopBtn = -1; - pT->GiveFocusBack(); - } - } - else if(wParam == VK_LEFT || wParam == VK_RIGHT) - { - WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; - WPARAM wpPrev = m_bLayoutRTL ? VK_RIGHT : VK_LEFT; - - if(m_bMenuActive && !m_bContextMenu && !(wParam == wpNext && m_bPopupItem)) - { - bool bAction = false; - if(wParam == wpPrev && s_pCurrentBar->m_stackMenuWnd.GetSize() == 1) - { - m_nNextPopBtn = pT->GetPreviousMenuItem(m_nPopBtn); - if(m_nNextPopBtn != -1) - bAction = true; - } - else if(wParam == wpNext) - { - m_nNextPopBtn = pT->GetNextMenuItem(m_nPopBtn); - if(m_nNextPopBtn != -1) - bAction = true; - } - HWND hWndMenu = m_stackMenuWnd.GetCurrent(); - ATLASSERT(hWndMenu != NULL); - - // Close the popup menu - if(bAction) - { - ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); - if(wParam == wpNext) - { - int cItem = m_stackMenuWnd.GetSize() - 1; - while(cItem >= 0) - { - hWndMenu = m_stackMenuWnd[cItem]; - if(hWndMenu != NULL) - ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); - cItem--; - } - } -#if (_WIN32_IE >= 0x0500) - if(m_nNextPopBtn == -2) - { - m_nNextPopBtn = -1; - pT->DisplayChevronMenu(); - } -#endif // (_WIN32_IE >= 0x0500) - bHandled = TRUE; - } - } - } - return 0; - } - - LRESULT OnHookNextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_NEXTMENU\n")); -#endif - bHandled = FALSE; - return 1; - } - - LRESULT OnHookChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_CHAR (0x%2.2X)\n"), wParam); -#endif - bHandled = (wParam == VK_ESCAPE); - return 0; - } - -// Implementation - ownerdraw overrideables and helpers - void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - T* pT = static_cast(this); - if(m_bFlatMenus) - pT->DrawItemFlat(lpDrawItemStruct); - else - pT->DrawItem3D(lpDrawItemStruct); - - } - - void DrawItem3D(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - CDCHandle dc = lpDrawItemStruct->hDC; - const RECT& rcItem = lpDrawItemStruct->rcItem; - T* pT = static_cast(this); - - if(pmd->fType & MFT_SEPARATOR) - { - // draw separator - RECT rc = rcItem; - rc.top += (rc.bottom - rc.top) / 2; // vertical center - dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line - } - else // not a separator - { - BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; - BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; - BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; - BOOL bHasImage = FALSE; - - if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) - bSelected = FALSE; - RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect - ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically - - int iButton = pmd->iButton; - if(iButton >= 0) - { - bHasImage = TRUE; - - // calc drawing point - SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; - sz.cx /= 2; - sz.cy /= 2; - POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; - - // fill background depending on state - if(!bChecked || (bSelected && !bDisabled)) - { - if(!bDisabled) - dc.FillRect(&rcButn, (bChecked && !bSelected) ? COLOR_3DLIGHT : COLOR_MENU); - else - dc.FillRect(&rcButn, COLOR_MENU); - } - else - { - COLORREF crTxt = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); - COLORREF crBk = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); - CBrush hbr(CDCHandle::GetHalftoneBrush()); - dc.SetBrushOrg(rcButn.left, rcButn.top); - dc.FillRect(&rcButn, hbr); - dc.SetTextColor(crTxt); - dc.SetBkColor(crBk); - } - - // draw disabled or normal - if(!bDisabled) - { - // draw pushed-in or popped-out edge - if(bSelected || bChecked) - { - RECT rc2 = rcButn; - dc.DrawEdge(&rc2, bChecked ? BDR_SUNKENOUTER : BDR_RAISEDINNER, BF_RECT); - } - // draw the image - ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); - } - else - { - HBRUSH hBrushBackground = bChecked ? NULL : ::GetSysColorBrush(COLOR_MENU); - pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground); - } - } - else - { - // no image - look for custom checked/unchecked bitmaps - CMenuItemInfo info; - info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; - ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); - if(bChecked || info.hbmpUnchecked != NULL) - { - BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); - bHasImage = pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); - } - } - - // draw item text - int cxButn = m_szButton.cx; - COLORREF colorBG = ::GetSysColor(bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); - if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) - { - RECT rcBG = rcItem; - if(bHasImage) - rcBG.left += cxButn + s_kcxGap; - dc.FillRect(&rcBG, bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); - } - - // calc text rectangle and colors - RECT rcText = rcItem; - rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; - rcText.right -= cxButn; - dc.SetBkMode(TRANSPARENT); - COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); - - // font already selected by Windows - if(bDisabled && (!bSelected || colorText == colorBG)) - { - // disabled - draw shadow text shifted down and right 1 pixel (unles selected) - RECT rcDisabled = rcText; - ::OffsetRect(&rcDisabled, 1, 1); - pT->DrawMenuText(dc, rcDisabled, pmd->lpstrText, ::GetSysColor(COLOR_3DHILIGHT)); - } - pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! - } - } - - void DrawItemFlat(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - CDCHandle dc = lpDrawItemStruct->hDC; - const RECT& rcItem = lpDrawItemStruct->rcItem; - T* pT = static_cast(this); - -#ifndef COLOR_MENUHILIGHT - const int COLOR_MENUHILIGHT = 29; -#endif // !COLOR_MENUHILIGHT - - BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; - BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; - BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; - - // paint background - if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) - { - if(bSelected) - { - dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENUHILIGHT)); - dc.FrameRect(&rcItem, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - } - else - { - dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENU)); - } - } - - if(pmd->fType & MFT_SEPARATOR) - { - // draw separator - RECT rc = rcItem; - rc.top += (rc.bottom - rc.top) / 2; // vertical center - dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line - } - else // not a separator - { - if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) - bSelected = FALSE; - RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect - ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically - - // draw background and border for checked items - if(bChecked) - { - RECT rcCheck = rcButn; - ::InflateRect(&rcCheck, -1, -1); - if(bSelected) - dc.FillRect(&rcCheck, ::GetSysColorBrush(COLOR_MENU)); - dc.FrameRect(&rcCheck, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - } - - int iButton = pmd->iButton; - if(iButton >= 0) - { - // calc drawing point - SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; - sz.cx /= 2; - sz.cy /= 2; - POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; - - // draw disabled or normal - if(!bDisabled) - { - ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); - } - else - { - HBRUSH hBrushBackground = ::GetSysColorBrush((bSelected && !(bDisabled && bChecked)) ? COLOR_MENUHILIGHT : COLOR_MENU); - HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW); - pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground, hBrushBackground, hBrushDisabledImage); - } - } - else - { - // no image - look for custom checked/unchecked bitmaps - CMenuItemInfo info; - info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; - ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); - if(bChecked || info.hbmpUnchecked != NULL) - { - BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); - pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); - } - } - - // draw item text - int cxButn = m_szButton.cx; - // calc text rectangle and colors - RECT rcText = rcItem; - rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; - rcText.right -= cxButn; - dc.SetBkMode(TRANSPARENT); - COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); - - pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! - } - } - - void DrawMenuText(CDCHandle& dc, RECT& rc, LPCTSTR lpstrText, COLORREF color) - { - int nTab = -1; - for(int i = 0; i < lstrlen(lpstrText); i++) - { - if(lpstrText[i] == _T('\t')) - { - nTab = i; - break; - } - } - dc.SetTextColor(color); - dc.DrawText(lpstrText, nTab, &rc, DT_SINGLELINE | DT_LEFT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - if(nTab != -1) - dc.DrawText(&lpstrText[nTab + 1], -1, &rc, DT_SINGLELINE | DT_RIGHT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - } - - void DrawBitmapDisabled(CDCHandle& dc, int nImage, POINT point, - HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), - HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), - HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) - { -#if (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - if(m_bAlphaImages) - { - IMAGELISTDRAWPARAMS ildp = { 0 }; - ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); - ildp.himl = m_hImageList; - ildp.i = nImage; - ildp.hdcDst = dc; - ildp.x = point.x; - ildp.y = point.y; - ildp.cx = 0; - ildp.cy = 0; - ildp.xBitmap = 0; - ildp.yBitmap = 0; - ildp.fStyle = ILD_TRANSPARENT; - ildp.fState = ILS_SATURATE; - ildp.Frame = 0; - ::ImageList_DrawIndirect(&ildp); - } - else -#endif // (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - { - // create memory DC - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - // create mono or color bitmap - CBitmap bmp; - bmp.CreateCompatibleBitmap(dc, m_szBitmap.cx, m_szBitmap.cy); - ATLASSERT(bmp.m_hBitmap != NULL); - // draw image into memory DC--fill BG white first - HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); - dcMem.PatBlt(0, 0, m_szBitmap.cx, m_szBitmap.cy, WHITENESS); - // If white is the text color, we can't use the normal painting since - // it would blend with the WHITENESS, but the mask is OK - UINT uDrawStyle = (::GetSysColor(COLOR_BTNTEXT) == RGB(255, 255, 255)) ? ILD_MASK : ILD_NORMAL; - ::ImageList_Draw(m_hImageList, nImage, dcMem, 0, 0, uDrawStyle); - dc.DitherBlt(point.x, point.y, m_szBitmap.cx, m_szBitmap.cy, dcMem, NULL, 0, 0, hBrushBackground, hBrush3DEffect, hBrushDisabledImage); - dcMem.SelectBitmap(hBmpOld); // restore - } - } - - // old name - BOOL Draw3DCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) - { - return DrawCheckmark(dc, rc, bSelected, bDisabled, bRadio, hBmpCheck); - } - - BOOL DrawCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) - { - // get checkmark bitmap, if none, use Windows standard - SIZE size = { 0, 0 }; - CBitmapHandle bmp = hBmpCheck; - if(hBmpCheck != NULL) - { - bmp.GetSize(size); - } - else - { - size.cx = ::GetSystemMetrics(SM_CXMENUCHECK); - size.cy = ::GetSystemMetrics(SM_CYMENUCHECK); - bmp.CreateCompatibleBitmap(dc, size.cx, size.cy); - ATLASSERT(bmp.m_hBitmap != NULL); - } - // center bitmap in caller's rectangle - RECT rcDest = rc; - if((rc.right - rc.left) > size.cx) - { - rcDest.left = rc.left + (rc.right - rc.left - size.cx) / 2; - rcDest.right = rcDest.left + size.cx; - } - if((rc.bottom - rc.top) > size.cy) - { - rcDest.top = rc.top + (rc.bottom - rc.top - size.cy) / 2; - rcDest.bottom = rcDest.top + size.cy; - } - // paint background - if(!m_bFlatMenus) - { - if(bSelected && !bDisabled) - { - dc.FillRect(&rcDest, COLOR_MENU); - } - else - { - COLORREF clrTextOld = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); - COLORREF clrBkOld = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); - CBrush hbr(CDCHandle::GetHalftoneBrush()); - dc.SetBrushOrg(rcDest.left, rcDest.top); - dc.FillRect(&rcDest, hbr); - dc.SetTextColor(clrTextOld); - dc.SetBkColor(clrBkOld); - } - } - - // create source image - CDC dcSource; - dcSource.CreateCompatibleDC(dc); - HBITMAP hBmpOld = dcSource.SelectBitmap(bmp); - // set colors - const COLORREF clrBlack = RGB(0, 0, 0); - const COLORREF clrWhite = RGB(255, 255, 255); - COLORREF clrTextOld = dc.SetTextColor(clrBlack); - COLORREF clrBkOld = dc.SetBkColor(clrWhite); - // create mask - CDC dcMask; - dcMask.CreateCompatibleDC(dc); - CBitmap bmpMask; - bmpMask.CreateBitmap(size.cx, size.cy, 1, 1, NULL); - HBITMAP hBmpOld1 = dcMask.SelectBitmap(bmpMask); - - // draw the checkmark transparently - int cx = rcDest.right - rcDest.left; - int cy = rcDest.bottom - rcDest.top; - if(hBmpCheck != NULL) - { - // build mask based on transparent color - dcSource.SetBkColor(m_clrMask); - dcMask.SetBkColor(clrBlack); - dcMask.SetTextColor(clrWhite); - dcMask.BitBlt(0, 0, size.cx, size.cy, dcSource, 0, 0, SRCCOPY); - // draw bitmap using the mask - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, SRCAND); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); - } - else - { - const DWORD ROP_DSno = 0x00BB0226L; - const DWORD ROP_DSa = 0x008800C6L; - const DWORD ROP_DSo = 0x00EE0086L; - const DWORD ROP_DSna = 0x00220326L; - - // draw mask - RECT rcSource = { 0, 0, min(size.cx, rc.right - rc.left), min(size.cy, rc.bottom - rc.top) }; - dcMask.DrawFrameControl(&rcSource, DFC_MENU, bRadio ? DFCS_MENUBULLET : DFCS_MENUCHECK); - - // draw shadow if disabled - if(!m_bFlatMenus && bDisabled) - { - // offset by one pixel - int x = rcDest.left + 1; - int y = rcDest.top + 1; - // paint source bitmap - const int nColor = COLOR_3DHILIGHT; - dcSource.FillRect(&rcSource, nColor); - // draw checkmark - special case black and white colors - COLORREF clrCheck = ::GetSysColor(nColor); - if(clrCheck == clrWhite) - { - dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSno); - dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSa); - } - else - { - if(clrCheck != clrBlack) - { - ATLASSERT(dcSource.GetTextColor() == clrBlack); - ATLASSERT(dcSource.GetBkColor() == clrWhite); - dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); - } - dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSa); - dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSo); - } - } - - // paint source bitmap - const int nColor = bDisabled ? COLOR_BTNSHADOW : COLOR_MENUTEXT; - dcSource.FillRect(&rcSource, nColor); - // draw checkmark - special case black and white colors - COLORREF clrCheck = ::GetSysColor(nColor); - if(clrCheck == clrWhite) - { - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSno); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSa); - } - else - { - if(clrCheck != clrBlack) - { - ATLASSERT(dcSource.GetTextColor() == clrBlack); - ATLASSERT(dcSource.GetBkColor() == clrWhite); - dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); - } - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSa); - dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSo); - } - } - // restore all - dc.SetTextColor(clrTextOld); - dc.SetBkColor(clrBkOld); - dcSource.SelectBitmap(hBmpOld); - dcMask.SelectBitmap(hBmpOld1); - if(hBmpCheck == NULL) - bmp.DeleteObject(); - // draw pushed-in hilight - if(!m_bFlatMenus && !bDisabled) - { - if(rc.right - rc.left > size.cx) - ::InflateRect(&rcDest, 1,1); // inflate checkmark by one pixel all around - dc.DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT); - } - - return TRUE; - } - - void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) - { - _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; - - if(pmd->fType & MFT_SEPARATOR) // separator - use half system height and zero width - { - lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU) / 2; - lpMeasureItemStruct->itemWidth = 0; - } - else - { - // compute size of text - use DrawText with DT_CALCRECT - CWindowDC dc(NULL); - CFont fontBold; - HFONT hOldFont = NULL; - if(pmd->fState & MFS_DEFAULT) - { - // need bold version of font - LOGFONT lf = { 0 }; - m_fontMenu.GetLogFont(lf); - lf.lfWeight += 200; - fontBold.CreateFontIndirect(&lf); - ATLASSERT(fontBold.m_hFont != NULL); - hOldFont = dc.SelectFont(fontBold); - } - else - { - hOldFont = dc.SelectFont(m_fontMenu); - } - - RECT rcText = { 0, 0, 0, 0 }; - dc.DrawText(pmd->lpstrText, -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); - int cx = rcText.right - rcText.left; - dc.SelectFont(hOldFont); - - LOGFONT lf = { 0 }; - m_fontMenu.GetLogFont(lf); - int cy = lf.lfHeight; - if(cy < 0) - cy = -cy; - const int cyMargin = 8; - cy += cyMargin; - - // height of item is the bigger of these two - lpMeasureItemStruct->itemHeight = max(cy, (int)m_szButton.cy); - - // width is width of text plus a bunch of stuff - cx += 2 * s_kcxTextMargin; // L/R margin for readability - cx += s_kcxGap; // space between button and menu text - cx += 2 * m_szButton.cx; // button width (L=button; R=empty margin) - cx += m_cxExtraSpacing; // extra between item text and accelerator keys - - // Windows adds 1 to returned value - cx -= ::GetSystemMetrics(SM_CXMENUCHECK) - 1; - lpMeasureItemStruct->itemWidth = cx; // done deal - } - } - -// Implementation - Hook procs - static LRESULT CALLBACK CreateHookProc(int nCode, WPARAM wParam, LPARAM lParam) - { - const int cchClassName = 7; - TCHAR szClassName[cchClassName] = { 0 }; - - if(nCode == HCBT_CREATEWND) - { - HWND hWndMenu = (HWND)wParam; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_CREATEWND (HWND = %8.8X)\n"), hWndMenu); -#endif - - ::GetClassName(hWndMenu, szClassName, cchClassName); - if(!lstrcmp(_T("#32768"), szClassName)) - s_pCurrentBar->m_stackMenuWnd.Push(hWndMenu); - } - else if(nCode == HCBT_DESTROYWND) - { - HWND hWndMenu = (HWND)wParam; -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_DESTROYWND (HWND = %8.8X)\n"), hWndMenu); -#endif - - ::GetClassName(hWndMenu, szClassName, cchClassName); - if(!lstrcmp(_T("#32768"), szClassName)) - { - ATLASSERT(hWndMenu == s_pCurrentBar->m_stackMenuWnd.GetCurrent()); - s_pCurrentBar->m_stackMenuWnd.Pop(); - } - } - - return ::CallNextHookEx(s_hCreateHook, nCode, wParam, lParam); - } - - static LRESULT CALLBACK MessageHookProc(int nCode, WPARAM wParam, LPARAM lParam) - { - LPMSG pMsg = (LPMSG)lParam; - - if(nCode == HC_ACTION && wParam == PM_REMOVE && pMsg->message != GetGetBarMessage() && pMsg->message != WM_FORWARDMSG) - { - CCommandBarCtrlBase* pCmdBar = NULL; - HWND hWnd = pMsg->hwnd; - DWORD dwPID = 0; - while(pCmdBar == NULL && hWnd != NULL) - { - pCmdBar = (CCommandBarCtrlBase*)::SendMessage(hWnd, GetGetBarMessage(), (WPARAM)&dwPID, 0L); - hWnd = ::GetParent(hWnd); - } - - if(pCmdBar != NULL && dwPID == GetCurrentProcessId()) - { - pCmdBar->m_hWndHook = pMsg->hwnd; - ATLASSERT(pCmdBar->IsCommandBarBase()); - - if(::IsWindow(pCmdBar->m_hWnd)) - pCmdBar->SendMessage(WM_FORWARDMSG, 0, (LPARAM)pMsg); - else - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook skipping message, can't find command bar!\n")); - } - } - - LRESULT lRet = 0; - ATLASSERT(s_pmapMsgHook != NULL); - if(s_pmapMsgHook != NULL) - { - DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); - if(pData != NULL) - { - lRet = ::CallNextHookEx(pData->hMsgHook, nCode, wParam, lParam); - } - } - return lRet; - } - -// Implementation - void DoPopupMenu(int nIndex, bool bAnimate) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - DoPopupMenu, bAnimate = %s\n"), bAnimate ? "true" : "false"); -#endif - - // Menu animation flags -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; -#endif -#ifndef TPM_NOANIMATION - const UINT TPM_NOANIMATION = 0x4000L; -#endif - T* pT = static_cast(this); - - // get popup menu and it's position - RECT rect = { 0 }; - GetItemRect(nIndex, &rect); - POINT pt = { rect.left, rect.bottom }; - MapWindowPoints(NULL, &pt, 1); - MapWindowPoints(NULL, &rect); - TPMPARAMS TPMParams = { 0 }; - TPMParams.cbSize = sizeof(TPMPARAMS); - TPMParams.rcExclude = rect; - HMENU hMenuPopup = ::GetSubMenu(m_hMenu, nIndex); - ATLASSERT(hMenuPopup != NULL); - - // get button ID - TBBUTTON tbb = { 0 }; - GetButton(nIndex, &tbb); - int nCmdID = tbb.idCommand; - - m_nPopBtn = nIndex; // remember current button's index - - // press button and display popup menu - PressButton(nCmdID, TRUE); - SetHotItem(nCmdID); - pT->DoTrackPopupMenu(hMenuPopup, TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | - (s_bW2K ? (bAnimate ? TPM_VERPOSANIMATION : TPM_NOANIMATION) : 0), pt.x, pt.y, &TPMParams); - PressButton(nCmdID, FALSE); - if(::GetFocus() != m_hWnd) - SetHotItem(-1); - - m_nPopBtn = -1; // restore - - // eat next message if click is on the same button - MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rect, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); - - // check if another popup menu should be displayed - if(m_nNextPopBtn != -1) - { - PostMessage(GetAutoPopupMessage(), m_nNextPopBtn & 0xFFFF); - if(!(m_nNextPopBtn & 0xFFFF0000) && !m_bPopupItem) - PostMessage(WM_KEYDOWN, VK_DOWN, 0); - m_nNextPopBtn = -1; - } - else - { - m_bContextMenu = false; - // If user didn't hit escape, give focus back - if(!m_bEscapePressed) - { - if(m_bUseKeyboardCues && m_bShowKeyboardCues) - m_bAllowKeyboardCues = false; - pT->GiveFocusBack(); - } - else - { - SetHotItem(nCmdID); - SetAnchorHighlight(TRUE); - } - } - } - - BOOL DoTrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) - { - CMenuHandle menuPopup = hMenu; - - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::DoTrackPopupMenu.\n")); - ATLASSERT(FALSE); - return FALSE; - } - - ATLASSERT(s_hCreateHook == NULL); - - s_pCurrentBar = static_cast(this); - - s_hCreateHook = ::SetWindowsHookEx(WH_CBT, CreateHookProc, ModuleHelper::GetModuleInstance(), GetCurrentThreadId()); - ATLASSERT(s_hCreateHook != NULL); - - m_bPopupItem = false; - m_bMenuActive = true; - - BOOL bTrackRet = menuPopup.TrackPopupMenuEx(uFlags, x, y, m_hWnd, lpParams); - m_bMenuActive = false; - - ::UnhookWindowsHookEx(s_hCreateHook); - - s_hCreateHook = NULL; - s_pCurrentBar = NULL; - - lock.Unlock(); - - // cleanup - convert menus back to original state -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - TrackPopupMenu - cleanup\n")); -#endif - - ATLASSERT(m_stackMenuWnd.GetSize() == 0); - - UpdateWindow(); - ATL::CWindow wndTL = GetTopLevelParent(); - wndTL.UpdateWindow(); - - // restore the menu items to the previous state for all menus that were converted - if(m_bImagesVisible) - { - HMENU hMenuSav = NULL; - while((hMenuSav = m_stackMenuHandle.Pop()) != NULL) - { - menuPopup = hMenuSav; - BOOL bRet = FALSE; - // restore state and delete menu item data - for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID; - bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - - _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; - if(pMI != NULL && pMI->IsCmdBarMenuItem()) - { - mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; - mii.fType = pMI->fType; - mii.fState = pMI->fState; - mii.dwTypeData = pMI->lpstrText; - mii.cch = lstrlen(pMI->lpstrText); - mii.dwItemData = NULL; - - bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); - // this one triggers WM_MEASUREITEM - menuPopup.ModifyMenu(i, MF_BYPOSITION | mii.fType | mii.fState, mii.wID, pMI->lpstrText); - ATLASSERT(bRet); - - delete [] pMI->lpstrText; - delete pMI; - } - } - } - } - return bTrackRet; - } - - int GetPreviousMenuItem(int nBtn) const - { - if(nBtn == -1) - return -1; -#if (_WIN32_IE >= 0x0500) - RECT rcClient; - GetClientRect(&rcClient); -#endif // (_WIN32_IE >= 0x0500) - int nNextBtn; - for(nNextBtn = nBtn - 1; nNextBtn != nBtn; nNextBtn--) - { - if(nNextBtn < 0) - nNextBtn = ::GetMenuItemCount(m_hMenu) - 1; - TBBUTTON tbb = { 0 }; - GetButton(nNextBtn, &tbb); -#if (_WIN32_IE >= 0x0500) - RECT rcBtn; - GetItemRect(nNextBtn, &rcBtn); - if(rcBtn.right > rcClient.right) - { - nNextBtn = -2; // chevron - break; - } -#endif // (_WIN32_IE >= 0x0500) - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) - break; - } - return (nNextBtn != nBtn) ? nNextBtn : -1; - } - - int GetNextMenuItem(int nBtn) const - { - if(nBtn == -1) - return -1; -#if (_WIN32_IE >= 0x0500) - RECT rcClient = { 0 }; - GetClientRect(&rcClient); -#endif // (_WIN32_IE >= 0x0500) - int nNextBtn = 0; - int nCount = ::GetMenuItemCount(m_hMenu); - for(nNextBtn = nBtn + 1; nNextBtn != nBtn; nNextBtn++) - { - if(nNextBtn >= nCount) - nNextBtn = 0; - TBBUTTON tbb = { 0 }; - GetButton(nNextBtn, &tbb); -#if (_WIN32_IE >= 0x0500) - RECT rcBtn = { 0 }; - GetItemRect(nNextBtn, &rcBtn); - if(rcBtn.right > rcClient.right) - { - nNextBtn = -2; // chevron - break; - } -#endif // (_WIN32_IE >= 0x0500) - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) - break; - } - return (nNextBtn != nBtn) ? nNextBtn : -1; - } - -#if (_WIN32_IE >= 0x0500) - bool DisplayChevronMenu() - { - // assume we are in a rebar - HWND hWndReBar = GetParent(); - int nCount = (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); - bool bRet = false; - for(int i = 0; i < nCount; i++) - { - REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_STYLE }; - BOOL bRetBandInfo = (BOOL)::SendMessage(hWndReBar, RB_GETBANDINFO, i, (LPARAM)&rbbi); - if(bRetBandInfo && rbbi.hwndChild == m_hWnd) - { - if((rbbi.fStyle & RBBS_USECHEVRON) != 0) - { - ::PostMessage(hWndReBar, RB_PUSHCHEVRON, i, 0L); - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - bRet = true; - } - break; - } - } - return bRet; - } -#endif // (_WIN32_IE >= 0x0500) - - void GetSystemSettings() - { - // refresh our font - NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); - ATLASSERT(bRet); - if(bRet) - { - LOGFONT logfont = { 0 }; - if(m_fontMenu.m_hFont != NULL) - m_fontMenu.GetLogFont(logfont); - if(logfont.lfHeight != info.lfMenuFont.lfHeight || - logfont.lfWidth != info.lfMenuFont.lfWidth || - logfont.lfEscapement != info.lfMenuFont.lfEscapement || - logfont.lfOrientation != info.lfMenuFont.lfOrientation || - logfont.lfWeight != info.lfMenuFont.lfWeight || - logfont.lfItalic != info.lfMenuFont.lfItalic || - logfont.lfUnderline != info.lfMenuFont.lfUnderline || - logfont.lfStrikeOut != info.lfMenuFont.lfStrikeOut || - logfont.lfCharSet != info.lfMenuFont.lfCharSet || - logfont.lfOutPrecision != info.lfMenuFont.lfOutPrecision || - logfont.lfClipPrecision != info.lfMenuFont.lfClipPrecision || - logfont.lfQuality != info.lfMenuFont.lfQuality || - logfont.lfPitchAndFamily != info.lfMenuFont.lfPitchAndFamily || - lstrcmp(logfont.lfFaceName, info.lfMenuFont.lfFaceName) != 0) - { - HFONT hFontMenu = ::CreateFontIndirect(&info.lfMenuFont); - ATLASSERT(hFontMenu != NULL); - if(hFontMenu != NULL) - { - if(m_fontMenu.m_hFont != NULL) - m_fontMenu.DeleteObject(); - m_fontMenu.Attach(hFontMenu); - SetFont(m_fontMenu); - AddStrings(_T("NS\0")); // for proper item height - AutoSize(); - } - } - } - - // check if we need extra spacing for menu item text - CWindowDC dc(m_hWnd); - HFONT hFontOld = dc.SelectFont(m_fontMenu); - RECT rcText = { 0, 0, 0, 0 }; - dc.DrawText(_T("\t"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); - if((rcText.right - rcText.left) < 4) - { - ::SetRectEmpty(&rcText); - dc.DrawText(_T("x"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); - m_cxExtraSpacing = rcText.right - rcText.left; - } - else - { - m_cxExtraSpacing = 0; - } - dc.SelectFont(hFontOld); - - // get Windows version - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - ::GetVersionEx(&ovi); - - // query keyboard cues mode (Windows 2000 or later) - if(ovi.dwMajorVersion >= 5) - { -#ifndef SPI_GETKEYBOARDCUES - const UINT SPI_GETKEYBOARDCUES = 0x100A; -#endif // !SPI_GETKEYBOARDCUES - BOOL bRetVal = TRUE; - bRet = ::SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &bRetVal, 0); - m_bUseKeyboardCues = (bRet && !bRetVal); - m_bAllowKeyboardCues = true; - ShowKeyboardCues(!m_bUseKeyboardCues); - } - - // query flat menu mode (Windows XP or later) - if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) - { -#ifndef SPI_GETFLATMENU - const UINT SPI_GETFLATMENU = 0x1022; -#endif // !SPI_GETFLATMENU - BOOL bRetVal = FALSE; - bRet = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &bRetVal, 0); - m_bFlatMenus = (bRet && bRetVal); - } - -#if _WTL_CMDBAR_VISTA_MENUS - // check if we should use Vista menus - bool bVistaMenus = (RunTimeHelper::IsVista() && RunTimeHelper::IsCommCtrl6() && ((m_dwExtendedStyle & CBR_EX_NOVISTAMENUS) == 0)); - - if(bVistaMenus) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(hThemeDLL != NULL) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsThemeActive)(); - PFN_IsThemeActive pfnIsThemeActive = (PFN_IsThemeActive)::GetProcAddress(hThemeDLL, "IsThemeActive"); - ATLASSERT(pfnIsThemeActive != NULL); - bVistaMenus = bVistaMenus && (pfnIsThemeActive != NULL) && (pfnIsThemeActive() != FALSE); - - typedef BOOL (STDAPICALLTYPE *PFN_IsAppThemed)(); - PFN_IsAppThemed pfnIsAppThemed = (PFN_IsAppThemed)::GetProcAddress(hThemeDLL, "IsAppThemed"); - ATLASSERT(pfnIsAppThemed != NULL); - bVistaMenus = bVistaMenus && (pfnIsAppThemed != NULL) && (pfnIsAppThemed() != FALSE); - - ::FreeLibrary(hThemeDLL); - } - } - - if(!bVistaMenus && m_bVistaMenus && (m_hMenu != NULL) && (m_arrCommand.GetSize() > 0)) - { - T* pT = static_cast(this); - pT->_RemoveVistaBitmapsFromMenu(); - } - - m_bVistaMenus = bVistaMenus; -#endif // _WTL_CMDBAR_VISTA_MENUS - -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("CmdBar - GetSystemSettings:\n m_bFlatMenus = %s\n m_bUseKeyboardCues = %s m_bVistaMenus = %s\n"), - m_bFlatMenus ? "true" : "false", m_bUseKeyboardCues ? "true" : "false", m_bVistaMenus ? "true" : "false"); -#endif - } - -// Implementation - alternate focus mode support - void TakeFocus() - { - if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_hWndFocus == NULL) - m_hWndFocus = ::GetFocus(); - SetFocus(); - } - - void GiveFocusBack() - { - if(m_bParentActive) - { - if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && ::IsWindow(m_hWndFocus)) - ::SetFocus(m_hWndFocus); - else if(!(m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_wndParent.IsWindow()) - m_wndParent.SetFocus(); - } - m_hWndFocus = NULL; - SetAnchorHighlight(FALSE); - if(m_bUseKeyboardCues && m_bShowKeyboardCues) - ShowKeyboardCues(false); - m_bSkipPostDown = false; - } - - void ShowKeyboardCues(bool bShow) - { - m_bShowKeyboardCues = bShow; - SetDrawTextFlags(DT_HIDEPREFIX, m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX); - Invalidate(); - UpdateWindow(); - } - -// Implementation - internal message helpers - static UINT GetAutoPopupMessage() - { - static UINT uAutoPopupMessage = 0; - if(uAutoPopupMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetAutoPopupMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uAutoPopupMessage == 0) - uAutoPopupMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalAutoPopupMsg")); - - lock.Unlock(); - } - ATLASSERT(uAutoPopupMessage != 0); - return uAutoPopupMessage; - } - - static UINT GetGetBarMessage() - { - static UINT uGetBarMessage = 0; - if(uGetBarMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetGetBarMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uGetBarMessage == 0) - uGetBarMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalGetBarMsg")); - - lock.Unlock(); - } - ATLASSERT(uGetBarMessage != 0); - return uGetBarMessage; - } - -// Implementation - bool CreateInternalImageList(int cImages) - { - UINT uFlags = (m_bAlphaImages ? ILC_COLOR32 : ILC_COLOR24) | ILC_MASK; - m_hImageList = ::ImageList_Create(m_szBitmap.cx, m_szBitmap.cy, uFlags, cImages, 1); - ATLASSERT(m_hImageList != NULL); - return (m_hImageList != NULL); - } - -// Implementation - support for Vista menus -#if _WTL_CMDBAR_VISTA_MENUS - void _AddVistaBitmapsFromImageList(int nStartIndex, int nCount) - { - // Create display compatible memory DC - HDC hDC = ::GetDC(NULL); - CDC dcMem; - dcMem.CreateCompatibleDC(hDC); - HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); - - T* pT = static_cast(this); - // Create bitmaps for all menu items - for(int i = 0; i < nCount; i++) - { - HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nStartIndex + i, hDC, dcMem); - dcMem.SelectBitmap(hBitmapSave); - m_arrVistaBitmap.Add(hBitmap); - } - } - - void _AddVistaBitmapFromImageList(int nIndex) - { - // Create display compatible memory DC - HDC hDC = ::GetDC(NULL); - CDC dcMem; - dcMem.CreateCompatibleDC(hDC); - HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); - - // Create bitmap for menu item - T* pT = static_cast(this); - HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, hDC, dcMem); - - // Select saved bitmap back and add bitmap to the array - dcMem.SelectBitmap(hBitmapSave); - m_arrVistaBitmap.Add(hBitmap); - } - - void _ReplaceVistaBitmapFromImageList(int nIndex) - { - // Delete existing bitmap - if(m_arrVistaBitmap[nIndex] != NULL) - ::DeleteObject(m_arrVistaBitmap[nIndex]); - - // Create display compatible memory DC - HDC hDC = ::GetDC(NULL); - CDC dcMem; - dcMem.CreateCompatibleDC(hDC); - HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); - - // Create bitmap for menu item - T* pT = static_cast(this); - HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, hDC, dcMem); - - // Select saved bitmap back and replace bitmap in the array - dcMem.SelectBitmap(hBitmapSave); - m_arrVistaBitmap.SetAtIndex(nIndex, hBitmap); - } - - HBITMAP _CreateVistaBitmapHelper(int nIndex, HDC hDCSource, HDC hDCTarget) - { - // Create 32-bit bitmap - BITMAPINFO bi = { 0 }; - bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bi.bmiHeader.biWidth = m_szBitmap.cx; - bi.bmiHeader.biHeight = m_szBitmap.cy; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 32; - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biSizeImage = 0; - bi.bmiHeader.biXPelsPerMeter = 0; - bi.bmiHeader.biYPelsPerMeter = 0; - bi.bmiHeader.biClrUsed = 0; - bi.bmiHeader.biClrImportant = 0; - HBITMAP hBitmap = ::CreateDIBSection(hDCSource, &bi, DIB_RGB_COLORS, NULL, NULL, 0); - ATLASSERT(hBitmap != NULL); - - // Select bitmap into target DC and draw from image list to it - if(hBitmap != NULL) - { - ::SelectObject(hDCTarget, hBitmap); - - IMAGELISTDRAWPARAMS ildp = { 0 }; - ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); - ildp.himl = m_hImageList; - ildp.i = nIndex; - ildp.hdcDst = hDCTarget; - ildp.x = 0; - ildp.y = 0; - ildp.cx = 0; - ildp.cy = 0; - ildp.xBitmap = 0; - ildp.yBitmap = 0; - ildp.fStyle = ILD_TRANSPARENT; - ildp.fState = ILS_ALPHA; - ildp.Frame = 255; - ::ImageList_DrawIndirect(&ildp); - } - - return hBitmap; - } - - void _RemoveVistaBitmapsFromMenu() - { - CMenuHandle menu = m_hMenu; - for(int i = 0; i < m_arrCommand.GetSize(); i++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_BITMAP; - mii.hbmpItem = NULL; - menu.SetMenuItemInfo(m_arrCommand[i], FALSE, &mii); - } - } -#endif // _WTL_CMDBAR_VISTA_MENUS -}; - - -class CCommandBarCtrl : public CCommandBarCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_CommandBar"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMDICommandBarCtrl - ATL implementation of Command Bars for MDI apps - -template -class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBase, TWinTraits> -{ -public: -// Data members - ATL::CContainedWindow m_wndMDIClient; - bool m_bChildMaximized; - HWND m_hWndChildMaximized; - HICON m_hIconChildMaximized; - int m_nBtnPressed; - int m_nBtnWasPressed; - - int m_cxyOffset; // offset between nonclient elements - int m_cxIconWidth; // small icon width - int m_cyIconHeight; // small icon height - int m_cxBtnWidth; // nonclient button width - int m_cyBtnHeight; // nonclient button height - int m_cxLeft; // left nonclient area width - int m_cxRight; // right nonclient area width - -// Theme declarations and data members -#ifndef _WTL_NO_AUTO_THEME -#ifndef _UXTHEME_H_ - typedef HANDLE HTHEME; -#endif // !_UXTHEME_H_ - typedef HTHEME (STDAPICALLTYPE *PFN_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList); - typedef HRESULT (STDAPICALLTYPE *PFN_CloseThemeData)(HTHEME hTheme); - typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); - typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeParentBackground)(HWND hwnd, HDC hdc, OPTIONAL RECT* prc); - - HMODULE m_hThemeDLL; - HTHEME m_hTheme; - PFN_DrawThemeBackground m_pfnDrawThemeBackground; - PFN_DrawThemeParentBackground m_pfnDrawThemeParentBackground; -#endif // !_WTL_NO_AUTO_THEME - -// Constructor/destructor - CMDICommandBarCtrlImpl() : - m_wndMDIClient(this, 2), m_bChildMaximized(false), - m_hWndChildMaximized(NULL), m_hIconChildMaximized(NULL), - m_nBtnPressed(-1), m_nBtnWasPressed(-1), -#ifndef _WTL_NO_AUTO_THEME - m_hThemeDLL(NULL), m_hTheme(NULL), m_pfnDrawThemeBackground(NULL), m_pfnDrawThemeParentBackground(NULL), -#endif // !_WTL_NO_AUTO_THEME - m_cxyOffset(2), - m_cxIconWidth(16), m_cyIconHeight(16), - m_cxBtnWidth(16), m_cyBtnHeight(14), - m_cxLeft(20), m_cxRight(55) - { } - - ~CMDICommandBarCtrlImpl() - { - if(m_wndMDIClient.IsWindow()) -/*scary!*/ m_wndMDIClient.UnsubclassWindow(); - } - -// Operations - BOOL SetMDIClient(HWND hWndMDIClient) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(hWndMDIClient)); - if(!::IsWindow(hWndMDIClient)) - return FALSE; - -#ifdef _DEBUG - // BLOCK: Test if the passed window is MDICLIENT - { - LPCTSTR lpszMDIClientClass = _T("MDICLIENT"); - const int nNameLen = 9 + 1; // "MDICLIENT" + NULL - TCHAR szClassName[nNameLen] = { 0 }; - ::GetClassName(hWndMDIClient, szClassName, nNameLen); - ATLASSERT(lstrcmpi(szClassName, lpszMDIClientClass) == 0); - } -#endif // _DEBUG - - if(m_wndMDIClient.IsWindow()) -/*scary!*/ m_wndMDIClient.UnsubclassWindow(); - - return m_wndMDIClient.SubclassWindow(hWndMDIClient); - } - -// Message maps - typedef CCommandBarCtrlImpl< T, TBase, TWinTraits > _baseClass; - BEGIN_MSG_MAP(CMDICommandBarCtrlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _WTL_NO_AUTO_THEME - MESSAGE_HANDLER(_GetThemeChangedMsg(), OnThemeChanged) -#endif // !_WTL_NO_AUTO_THEME - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_NCCALCSIZE, OnNcCalcSize) - MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) - MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) - MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - CHAIN_MSG_MAP(_baseClass) - ALT_MSG_MAP(1) // Parent window messages - MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) - CHAIN_MSG_MAP_ALT(_baseClass, 1) - ALT_MSG_MAP(2) // MDI client window messages - MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) - // no chaining needed since this was moved from the base class here - ALT_MSG_MAP(3) // Message hook messages - MESSAGE_RANGE_HANDLER(0, 0xFFFF, OnAllHookMessages) - CHAIN_MSG_MAP_ALT(_baseClass, 3) - END_MSG_MAP() - -// Additional MDI message handlers - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - LRESULT lRet = _baseClass::OnCreate(uMsg, wParam, lParam, bHandled); - if(lRet == (LRESULT)-1) - return lRet; - -#ifndef _WTL_NO_AUTO_THEME - // this will fail if theming is not supported - m_hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(m_hThemeDLL != NULL) - { - m_pfnDrawThemeBackground = (PFN_DrawThemeBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeBackground"); - ATLASSERT(m_pfnDrawThemeBackground != NULL); - if(m_pfnDrawThemeBackground != NULL) - { - T* pT = static_cast(this); - pT->_OpenThemeData(); - } - else - { - ::FreeLibrary(m_hThemeDLL); - m_hThemeDLL = NULL; - } - m_pfnDrawThemeParentBackground = (PFN_DrawThemeParentBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeParentBackground"); - ATLASSERT(m_pfnDrawThemeParentBackground != NULL); - } -#endif // !_WTL_NO_AUTO_THEME - - return lRet; - } - - LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - LRESULT lRet = _baseClass::OnDestroy(uMsg, wParam, lParam, bHandled); - -#ifndef _WTL_NO_AUTO_THEME - if(m_hThemeDLL != NULL) - { - T* pT = static_cast(this); - pT->_CloseThemeData(); - ::FreeLibrary(m_hThemeDLL); - m_hThemeDLL = NULL; - } -#endif // !_WTL_NO_AUTO_THEME - - return lRet; - } - -#ifndef _WTL_NO_AUTO_THEME - LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_hThemeDLL != NULL) - { - T* pT = static_cast(this); - pT->_CloseThemeData(); - pT->_OpenThemeData(); - } - return 0; - } -#endif // !_WTL_NO_AUTO_THEME - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - T* pT = static_cast(this); - pT->_AdjustBtnSize(GET_Y_LPARAM(lParam)); - return lRet; - } - - LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - - if(m_bChildMaximized && (BOOL)wParam) - { - LPNCCALCSIZE_PARAMS lpParams = (LPNCCALCSIZE_PARAMS)lParam; - if(m_bLayoutRTL) - { - lpParams->rgrc[0].left += m_cxRight; - lpParams->rgrc[0].right -= m_cxLeft; - } - else - { - lpParams->rgrc[0].left += m_cxLeft; - lpParams->rgrc[0].right -= m_cxRight; - } - } - - return lRet; - } - - LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - - if(!m_bChildMaximized) - return lRet; - - ATLASSERT(m_hWndChildMaximized != NULL && m_hIconChildMaximized != NULL); - - // get DC and window rectangle - CWindowDC dc(m_hWnd); - RECT rect; - GetWindowRect(&rect); - int cxWidth = rect.right - rect.left; - int cyHeight = rect.bottom - rect.top; - - // paint left side nonclient background and draw icon - ::SetRect(&rect, 0, 0, m_cxLeft, cyHeight); -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - if(m_pfnDrawThemeParentBackground != NULL) - m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); - else - dc.FillRect(&rect, COLOR_WINDOW); - } - else -#endif // !_WTL_NO_AUTO_THEME - { - if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) - dc.FillRect(&rect, COLOR_3DFACE); - else - dc.FillRect(&rect, COLOR_MENU); - } - - RECT rcIcon = { 0 }; - T* pT = static_cast(this); - pT->_CalcIconRect(cxWidth, cyHeight, rcIcon); - dc.DrawIconEx(rcIcon.left, rcIcon.top, m_hIconChildMaximized, m_cxIconWidth, m_cyIconHeight); - - // paint right side nonclient background - ::SetRect(&rect, cxWidth - m_cxRight, 0, cxWidth, cyHeight); -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - if(m_pfnDrawThemeParentBackground != NULL) - { - // this is to account for the left non-client area - POINT ptOrg = { 0, 0 }; - dc.GetViewportOrg(&ptOrg); - dc.SetViewportOrg(ptOrg.x + m_cxLeft, ptOrg.y); - ::OffsetRect(&rect, -m_cxLeft, 0); - - m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); - - // restore - dc.SetViewportOrg(ptOrg); - ::OffsetRect(&rect, m_cxLeft, 0); - } - else - { - dc.FillRect(&rect, COLOR_3DFACE); - } - } - else -#endif // !_WTL_NO_AUTO_THEME - { - if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) - dc.FillRect(&rect, COLOR_3DFACE); - else - dc.FillRect(&rect, COLOR_MENU); - } - - // draw buttons - RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(cxWidth, cyHeight, arrRect); - pT->_DrawMDIButton(dc, arrRect, -1); // draw all buttons - - return lRet; - } - - LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(m_bChildMaximized) - { - RECT rect = { 0 }; - GetWindowRect(&rect); - POINT pt = { GET_X_LPARAM(lParam) - rect.left, GET_Y_LPARAM(lParam) - rect.top }; - if(m_bLayoutRTL) - { - if((pt.x < m_cxRight) || (pt.x > ((rect.right - rect.left) - m_cxLeft))) - lRet = HTBORDER; - } - else - { - if((pt.x < m_cxLeft) || (pt.x > ((rect.right - rect.left) - m_cxRight))) - lRet = HTBORDER; - } - } - return lRet; - } - - LRESULT OnNcLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized) - { - bHandled = FALSE; - return 1; - } - - ATLASSERT(_DebugCheckChild()); - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - RECT rcIcon = { 0 }; - T* pT = static_cast(this); - pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); - RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - - if(::PtInRect(&rcIcon, pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: icon\n")); -#endif -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag -#endif - CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); - UINT uRet = (UINT)menu.TrackPopupMenu(TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | - (s_bW2K ? TPM_VERPOSANIMATION : 0), m_bLayoutRTL ? rect.right : rect.left, rect.bottom, m_hWndChildMaximized); - - // eat next message if click is on the same button - ::OffsetRect(&rcIcon, rect.left, rect.top); - MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rcIcon, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_REMOVE); - - if(uRet != 0) - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uRet, 0L); - } - else if(::PtInRect(&arrRect[0], pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: close button\n")); -#endif - m_nBtnWasPressed = m_nBtnPressed = 0; - } - else if(::PtInRect(&arrRect[1], pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: restore button\n")); -#endif - m_nBtnWasPressed = m_nBtnPressed = 1; - } - else if(::PtInRect(&arrRect[2], pt)) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: minimize button\n")); -#endif - m_nBtnWasPressed = m_nBtnPressed = 2; - } - else - { - bHandled = FALSE; - } - - // draw the button state if it was pressed - if(m_nBtnPressed != -1) - { - SetCapture(); - CWindowDC dc(m_hWnd); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - pT->_DrawMDIButton(dc, arrRect, m_nBtnPressed); - } - - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) - { - bHandled = FALSE; - return 1; - } - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&pt); - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - RECT arrRect[3] = { 0 }; - T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - int nOldBtnPressed = m_nBtnPressed; - m_nBtnPressed = ::PtInRect(&arrRect[m_nBtnWasPressed], pt) ? m_nBtnWasPressed : -1; - if(nOldBtnPressed != m_nBtnPressed) - { - CWindowDC dc(m_hWnd); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - pT->_DrawMDIButton(dc, arrRect, (m_nBtnPressed != -1) ? m_nBtnPressed : nOldBtnPressed); - } - - return 0; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) - { - bHandled = FALSE; - return 1; - } - - ATLASSERT(_DebugCheckChild()); - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&pt); - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - int nBtn = m_nBtnWasPressed; - ReleaseCapture(); - - RECT arrRect[3] = { 0 }; - T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - if(::PtInRect(&arrRect[nBtn], pt)) - { - switch(nBtn) - { - case 0: // close -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: close button\n")); -#endif - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_CLOSE, 0L); - break; - case 1: // restore -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: restore button\n")); -#endif - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_RESTORE, 0L); - break; - case 2: // minimize -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: minimize button\n")); -#endif - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_MINIMIZE, 0L); - break; - default: - break; - } - } - - return 0; - } - - LRESULT OnNcLButtonDblClk(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(!m_bChildMaximized || m_nBtnWasPressed != -1) - { - bHandled = FALSE; - return 1; - } - - ATLASSERT(_DebugCheckChild()); - - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - RECT rect = { 0 }; - GetWindowRect(&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - RECT rcIcon = { 0 }; - T* pT = static_cast(this); - pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); - RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); - - if(::PtInRect(&rcIcon, pt)) - { - CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); - UINT uDefID = menu.GetMenuDefaultItem(); - if(uDefID == (UINT)-1) - uDefID = SC_CLOSE; - ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uDefID, 0L); - } - - return 0; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bChildMaximized) - { - if(m_nBtnPressed != -1) - { - ATLASSERT(m_nBtnPressed == m_nBtnWasPressed); // must be - m_nBtnPressed = -1; - RECT rect = { 0 }; - GetWindowRect(&rect); - RECT arrRect[3] = { 0 }; - T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - CWindowDC dc(m_hWnd); - pT->_DrawMDIButton(dc, arrRect, m_nBtnWasPressed); - } - m_nBtnWasPressed = -1; - } - else - { - bHandled = FALSE; - } - return 0; - } - -// Parent window message handlers - LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); - RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); - bHandled = FALSE; - return 1; - } - -// MDI client window message handlers - LRESULT OnMDISetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - m_wndMDIClient.DefWindowProc(uMsg, NULL, lParam); - HMENU hOldMenu = GetMenu(); - BOOL bRet = AttachMenu((HMENU)wParam); - bRet; // avoid level 4 warning - ATLASSERT(bRet); - -#if (_WIN32_IE >= 0x0400) - T* pT = static_cast(this); - pT->UpdateRebarBandIdealSize(); -#endif // (_WIN32_IE >= 0x0400) - - return (LRESULT)hOldMenu; - } - -// All messages from the message hook - LRESULT OnAllHookMessages(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->_ProcessAllHookMessages(uMsg, wParam, lParam); - - bHandled = FALSE; - return 1; - } - -// Overrideables - // override this to provide different ideal size - void UpdateRebarBandIdealSize() - { - // assuming we are in a rebar, change ideal size to our size - // we hope that if we are not in a rebar, nCount will be 0 - int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); - for(int i = 0; i < nCount; i++) - { - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_IDEALSIZE; - rbi.cxIdeal = m_bChildMaximized ? m_cxLeft + m_cxRight : 0; - int nBtnCount = GetButtonCount(); - if(nBtnCount > 0) - { - RECT rect = { 0 }; - GetItemRect(nBtnCount - 1, &rect); - rbi.cxIdeal += rect.right; - } - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } - } - } - - // all hook messages - check for the maximized MDI child window change - void _ProcessAllHookMessages(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/) - { - if(uMsg == WM_MDIGETACTIVE || uMsg == WM_MDISETMENU) - return; - - BOOL bMaximized = FALSE; - HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - bool bMaxOld = m_bChildMaximized; - m_bChildMaximized = (hWndChild != NULL && bMaximized); - HICON hIconOld = m_hIconChildMaximized; - - if(m_bChildMaximized) - { - if(m_hWndChildMaximized != hWndChild) - { - ATL::CWindow wnd = m_hWndChildMaximized = hWndChild; - m_hIconChildMaximized = wnd.GetIcon(FALSE); - if(m_hIconChildMaximized == NULL) - { - m_hIconChildMaximized = wnd.GetIcon(TRUE); - if(m_hIconChildMaximized == NULL) - { - // no icon set with WM_SETICON, get the class one -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - m_hIconChildMaximized = (HICON)::GetClassLongPtr(wnd, GCLP_HICONSM); -#else - m_hIconChildMaximized = (HICON)LongToHandle(::GetClassLongPtr(wnd, GCLP_HICONSM)); -#endif - } - } - } - } - else - { - m_hWndChildMaximized = NULL; - m_hIconChildMaximized = NULL; - } - - if(bMaxOld != m_bChildMaximized) - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - All messages hook change: m_bChildMaximized = %s\n"), m_bChildMaximized ? "true" : "false"); -#endif - // assuming we are in a rebar, change our size to accomodate new state - // we hope that if we are not in a rebar, nCount will be 0 - int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); - int cxDiff = (m_bChildMaximized ? 1 : -1) * (m_cxLeft + m_cxRight); - for(int i = 0; i < nCount; i++) - { -#if (_WIN32_IE >= 0x0500) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_STYLE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - if((rbi.fStyle & RBBS_USECHEVRON) != 0) - { - rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; - rbi.cxMinChild += cxDiff; - rbi.cxIdeal += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - } - break; - } -#elif (_WIN32_IE >= 0x0400) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; - rbi.cxMinChild += cxDiff; - rbi.cxIdeal += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } -#else // (_WIN32_IE < 0x0400) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_CHILDSIZE; - rbi.cxMinChild += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } -#endif // (_WIN32_IE < 0x0400) - } - } - - if(bMaxOld != m_bChildMaximized || hIconOld != m_hIconChildMaximized) - { - // force size change and redraw everything - RECT rect = { 0 }; - GetWindowRect(&rect); - ::MapWindowPoints(NULL, GetParent(), (LPPOINT)&rect, 2); - SetRedraw(FALSE); - SetWindowPos(NULL, 0, 0, 1, 1, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); - } - } - -// Implementation - void GetSystemSettings() - { -#ifdef _CMDBAR_EXTRA_TRACE - ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - GetSystemSettings\n")); -#endif - _baseClass::GetSystemSettings(); - - NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); - ATLASSERT(bRet); - if(bRet) - { - m_cxIconWidth = ::GetSystemMetrics(SM_CXSMICON); - m_cyIconHeight = ::GetSystemMetrics(SM_CYSMICON); - m_cxLeft = m_cxIconWidth; - -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - m_cxBtnWidth = info.iCaptionWidth - 2 * m_cxyOffset; - m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; - m_cxRight = 3 * m_cxBtnWidth; - } - else -#endif // !_WTL_NO_AUTO_THEME - { - m_cxBtnWidth = info.iCaptionWidth - m_cxyOffset; - m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; - m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; - } - } - - RECT rect = { 0 }; - GetClientRect(&rect); - T* pT = static_cast(this); - pT->_AdjustBtnSize(rect.bottom); - } - - void _AdjustBtnSize(int cyHeight) - { - if(cyHeight > 1 && m_cyBtnHeight > cyHeight) - { -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { - m_cyBtnHeight = cyHeight; - m_cxBtnWidth = cyHeight; - m_cxRight = 3 * m_cxBtnWidth; - } - else -#endif // !_WTL_NO_AUTO_THEME - { - m_cyBtnHeight = cyHeight; - m_cxBtnWidth = cyHeight + m_cxyOffset; - m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; - } - } - } - - void _CalcIconRect(int cxWidth, int cyHeight, RECT& rect, bool bInvertX = false) const - { - int xStart = (m_cxLeft - m_cxIconWidth) / 2; - if(xStart < 0) - xStart = 0; - int yStart = (cyHeight - m_cyIconHeight) / 2; - if(yStart < 0) - yStart = 0; - - if(bInvertX) - ::SetRect(&rect, cxWidth - (xStart + m_cxBtnWidth), yStart, cxWidth - xStart, yStart + m_cyBtnHeight); - else - ::SetRect(&rect, xStart, yStart, xStart + m_cxBtnWidth, yStart + m_cyBtnHeight); - } - - void _CalcBtnRects(int cxWidth, int cyHeight, RECT arrRect[3], bool bInvertX = false) const - { - int yStart = (cyHeight - m_cyBtnHeight) / 2; - if(yStart < 0) - yStart = 0; - - RECT rcBtn = { cxWidth - m_cxBtnWidth, yStart, cxWidth, yStart + m_cyBtnHeight }; - int nDirection = -1; - if(bInvertX) - { - ::SetRect(&rcBtn, 0, yStart, m_cxBtnWidth, yStart + m_cyBtnHeight); - nDirection = 1; - } - - arrRect[0] = rcBtn; -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); - else -#endif // !_WTL_NO_AUTO_THEME - ::OffsetRect(&rcBtn, nDirection * (m_cxBtnWidth + m_cxyOffset), 0); - arrRect[1] = rcBtn; - ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); - arrRect[2] = rcBtn; - } - - void _DrawMDIButton(CWindowDC& dc, LPRECT pRects, int nBtn) - { -#ifndef _WTL_NO_AUTO_THEME - if(m_hTheme != NULL) - { -#ifndef TMSCHEMA_H - const int WP_MDICLOSEBUTTON = 20; - const int CBS_NORMAL = 1; - const int CBS_PUSHED = 3; - const int CBS_DISABLED = 4; - const int WP_MDIRESTOREBUTTON = 22; - const int RBS_NORMAL = 1; - const int RBS_PUSHED = 3; - const int RBS_DISABLED = 4; - const int WP_MDIMINBUTTON = 16; - const int MINBS_NORMAL = 1; - const int MINBS_PUSHED = 3; - const int MINBS_DISABLED = 4; -#endif // TMSCHEMA_H - if(nBtn == -1 || nBtn == 0) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDICLOSEBUTTON, m_bParentActive ? ((m_nBtnPressed == 0) ? CBS_PUSHED : CBS_NORMAL) : CBS_DISABLED, &pRects[0], NULL); - if(nBtn == -1 || nBtn == 1) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIRESTOREBUTTON, m_bParentActive ? ((m_nBtnPressed == 1) ? RBS_PUSHED : RBS_NORMAL) : RBS_DISABLED, &pRects[1], NULL); - if(nBtn == -1 || nBtn == 2) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIMINBUTTON, m_bParentActive ? ((m_nBtnPressed == 2) ? MINBS_PUSHED : MINBS_NORMAL) : MINBS_DISABLED, &pRects[2], NULL); - } - else -#endif // !_WTL_NO_AUTO_THEME - { - if(nBtn == -1 || nBtn == 0) - dc.DrawFrameControl(&pRects[0], DFC_CAPTION, DFCS_CAPTIONCLOSE | ((m_nBtnPressed == 0) ? DFCS_PUSHED : 0)); - if(nBtn == -1 || nBtn == 1) - dc.DrawFrameControl(&pRects[1], DFC_CAPTION, DFCS_CAPTIONRESTORE | ((m_nBtnPressed == 1) ? DFCS_PUSHED : 0)); - if(nBtn == -1 || nBtn == 2) - dc.DrawFrameControl(&pRects[2], DFC_CAPTION, DFCS_CAPTIONMIN | ((m_nBtnPressed == 2) ? DFCS_PUSHED : 0)); - } - } - -#ifndef _WTL_NO_AUTO_THEME - static UINT _GetThemeChangedMsg() - { -#ifndef WM_THEMECHANGED - static const UINT WM_THEMECHANGED = 0x031A; -#endif // !WM_THEMECHANGED - return WM_THEMECHANGED; - } - - void _OpenThemeData() - { - ATLASSERT(m_hThemeDLL != NULL); - - PFN_OpenThemeData pfnOpenThemeData = (PFN_OpenThemeData)::GetProcAddress(m_hThemeDLL, "OpenThemeData"); - ATLASSERT(pfnOpenThemeData != NULL); - if(pfnOpenThemeData != NULL) - m_hTheme = pfnOpenThemeData(m_hWnd, L"Window"); - } - - void _CloseThemeData() - { - ATLASSERT(m_hThemeDLL != NULL); - - if(m_hTheme == NULL) - return; // nothing to do - - PFN_CloseThemeData pfnCloseThemeData = (PFN_CloseThemeData)::GetProcAddress(m_hThemeDLL, "CloseThemeData"); - ATLASSERT(pfnCloseThemeData != NULL); - if(pfnCloseThemeData != NULL) - { - pfnCloseThemeData(m_hTheme); - m_hTheme = NULL; - } - } -#endif // !_WTL_NO_AUTO_THEME - - bool _DebugCheckChild() - { -#ifdef _DEBUG - BOOL bMaximized = FALSE; - HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - return (bMaximized && hWndChild == m_hWndChildMaximized); -#else // !_DEBUG - return true; -#endif // !_DEBUG - } -}; - -class CMDICommandBarCtrl : public CMDICommandBarCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_MDICommandBar"), GetWndClassName()) -}; - -}; // namespace WTL - -#endif // __ATLCTRLW_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLCTRLW_H__ +#define __ATLCTRLW_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifdef _WIN32_WCE + #error atlctrlw.h is not supported on Windows CE +#endif + +#ifndef __ATLAPP_H__ + #error atlctrlw.h requires atlapp.h to be included first +#endif + +#ifndef __ATLCTRLS_H__ + #error atlctrlw.h requires atlctrls.h to be included first +#endif + +#if (_WIN32_IE < 0x0400) + #error atlctrlw.h requires _WIN32_IE >= 0x0400 +#endif + +// Define _WTL_CMDBAR_VISTA_MENUS as 0 to exclude Vista menus support +#if !defined(_WTL_CMDBAR_VISTA_MENUS) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) + #define _WTL_CMDBAR_VISTA_MENUS 1 +#endif + +#if _WTL_CMDBAR_VISTA_MENUS + #if !((_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501)) + #error _WTL_CMDBAR_VISTA_MENUS requires (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) + #endif +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CCommandBarCtrlImpl +// CCommandBarCtrl +// CMDICommandBarCtrlImpl +// CMDICommandBarCtrl + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// Command Bars + +// Window Styles: +#define CBRWS_TOP CCS_TOP +#define CBRWS_BOTTOM CCS_BOTTOM +#define CBRWS_NORESIZE CCS_NORESIZE +#define CBRWS_NOPARENTALIGN CCS_NOPARENTALIGN +#define CBRWS_NODIVIDER CCS_NODIVIDER + +// Extended styles +#define CBR_EX_TRANSPARENT 0x00000001L +#define CBR_EX_SHAREMENU 0x00000002L +#define CBR_EX_ALTFOCUSMODE 0x00000004L +#define CBR_EX_TRACKALWAYS 0x00000008L +#define CBR_EX_NOVISTAMENUS 0x00000010L + +// standard command bar styles +#define ATL_SIMPLE_CMDBAR_PANE_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CBRWS_NODIVIDER | CBRWS_NORESIZE | CBRWS_NOPARENTALIGN) + +// Messages - support chevrons for frame windows +#define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND +#define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu +#define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu + +typedef struct tagCBRPOPUPMENU +{ + int cbSize; + HMENU hMenu; // popup menu do display + UINT uFlags; // TPM_* flags for ::TrackPopupMenuEx + int x; + int y; + LPTPMPARAMS lptpm; // ptr to TPMPARAMS for ::TrackPopupMenuEx +} CBRPOPUPMENU, *LPCBRPOPUPMENU; + +// helper class +template +class CSimpleStack : public ATL::CSimpleArray< T > +{ +public: + BOOL Push(T t) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-PUSH (%8.8X) size = %i\n"), t, GetSize()); +#endif + return Add(t); + } + + T Pop() + { + int nLast = GetSize() - 1; + if(nLast < 0) + return NULL; // must be able to convert to NULL + T t = m_aT[nLast]; +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-POP (%8.8X) size = %i\n"), t, GetSize()); +#endif + if(!RemoveAt(nLast)) + return NULL; + return t; + } + + T GetCurrent() + { + int nLast = GetSize() - 1; + if(nLast < 0) + return NULL; // must be able to convert to NULL + return m_aT[nLast]; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CCommandBarCtrlBase - base class for the Command Bar implementation + +class CCommandBarCtrlBase : public CToolBarCtrl +{ +public: + struct _MsgHookData + { + HHOOK hMsgHook; + DWORD dwUsage; + + _MsgHookData() : hMsgHook(NULL), dwUsage(0) + { } + }; + + typedef ATL::CSimpleMap CMsgHookMap; + static CMsgHookMap* s_pmapMsgHook; + + static HHOOK s_hCreateHook; + static bool s_bW2K; // For animation flag + static CCommandBarCtrlBase* s_pCurrentBar; + static bool s_bStaticInit; + + CSimpleStack m_stackMenuWnd; + CSimpleStack m_stackMenuHandle; + + HWND m_hWndHook; + DWORD m_dwMagic; + + + CCommandBarCtrlBase() : m_hWndHook(NULL), m_dwMagic(1314) + { + // init static variables + if(!s_bStaticInit) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlBase::CCommandBarCtrlBase.\n")); + ATLASSERT(FALSE); + return; + } + + if(!s_bStaticInit) + { + // Just in case... + AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); + // Animation on Win2000 only + s_bW2K = !AtlIsOldWindows(); + // done + s_bStaticInit = true; + } + + lock.Unlock(); + } + } + + bool IsCommandBarBase() const { return m_dwMagic == 1314; } +}; + +__declspec(selectany) CCommandBarCtrlBase::CMsgHookMap* CCommandBarCtrlBase::s_pmapMsgHook = NULL; +__declspec(selectany) HHOOK CCommandBarCtrlBase::s_hCreateHook = NULL; +__declspec(selectany) CCommandBarCtrlBase* CCommandBarCtrlBase::s_pCurrentBar = NULL; +__declspec(selectany) bool CCommandBarCtrlBase::s_bW2K = false; +__declspec(selectany) bool CCommandBarCtrlBase::s_bStaticInit = false; + + +/////////////////////////////////////////////////////////////////////////////// +// CCommandBarCtrl - ATL implementation of Command Bars + +template +class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > +{ +public: + DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) + +// Declarations + struct _MenuItemData // menu item data + { + DWORD dwMagic; + LPTSTR lpstrText; + UINT fType; + UINT fState; + int iButton; + + _MenuItemData() { dwMagic = 0x1313; } + bool IsCmdBarMenuItem() { return (dwMagic == 0x1313); } + }; + + struct _ToolBarData // toolbar resource data + { + WORD wVersion; + WORD wWidth; + WORD wHeight; + WORD wItemCount; + //WORD aItems[wItemCount] + + WORD* items() + { return (WORD*)(this+1); } + }; + +// Constants + enum _CmdBarDrawConstants + { + s_kcxGap = 1, + s_kcxTextMargin = 2, + s_kcxButtonMargin = 3, + s_kcyButtonMargin = 3 + }; + + enum + { + _nMaxMenuItemTextLength = 100, + _chChevronShortcut = _T('/') + }; + +#ifndef DT_HIDEPREFIX + enum { DT_HIDEPREFIX = 0x00100000 }; +#endif // !DT_HIDEPREFIX + +// Data members + HMENU m_hMenu; + HIMAGELIST m_hImageList; + ATL::CSimpleValArray m_arrCommand; + + DWORD m_dwExtendedStyle; // Command Bar specific extended styles + + ATL::CContainedWindow m_wndParent; + + bool m_bMenuActive:1; + bool m_bAttachedMenu:1; + bool m_bImagesVisible:1; + bool m_bPopupItem:1; + bool m_bContextMenu:1; + bool m_bEscapePressed:1; + bool m_bSkipMsg:1; + bool m_bParentActive:1; + bool m_bFlatMenus:1; + bool m_bUseKeyboardCues:1; + bool m_bShowKeyboardCues:1; + bool m_bAllowKeyboardCues:1; + bool m_bKeyboardInput:1; + bool m_bAlphaImages:1; + bool m_bLayoutRTL:1; + bool m_bSkipPostDown:1; + bool m_bVistaMenus:1; + + int m_nPopBtn; + int m_nNextPopBtn; + + SIZE m_szBitmap; + SIZE m_szButton; + + COLORREF m_clrMask; + CFont m_fontMenu; // used internally, only to measure text + + UINT m_uSysKey; + + HWND m_hWndFocus; // Alternate focus mode + + int m_cxExtraSpacing; + +#if _WTL_CMDBAR_VISTA_MENUS + ATL::CSimpleValArray m_arrVistaBitmap; // Bitmaps for Vista menus +#endif // _WTL_CMDBAR_VISTA_MENUS + +// Constructor/destructor + CCommandBarCtrlImpl() : + m_hMenu(NULL), + m_hImageList(NULL), + m_wndParent(this, 1), + m_bMenuActive(false), + m_bAttachedMenu(false), + m_nPopBtn(-1), + m_nNextPopBtn(-1), + m_bPopupItem(false), + m_bImagesVisible(true), + m_bSkipMsg(false), + m_uSysKey(0), + m_hWndFocus(NULL), + m_bContextMenu(false), + m_bEscapePressed(false), + m_clrMask(RGB(192, 192, 192)), + m_dwExtendedStyle(CBR_EX_TRANSPARENT | CBR_EX_SHAREMENU | CBR_EX_TRACKALWAYS), + m_bParentActive(true), + m_bFlatMenus(false), + m_bUseKeyboardCues(false), + m_bShowKeyboardCues(false), + m_bAllowKeyboardCues(true), + m_bKeyboardInput(false), + m_cxExtraSpacing(0), + m_bAlphaImages(false), + m_bLayoutRTL(false), + m_bSkipPostDown(false), + m_bVistaMenus(false) + { + SetImageSize(16, 15); // default + } + + ~CCommandBarCtrlImpl() + { + if(m_wndParent.IsWindow()) +/*scary!*/ m_wndParent.UnsubclassWindow(); + + if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) + ::DestroyMenu(m_hMenu); + + if(m_hImageList != NULL) + ::ImageList_Destroy(m_hImageList); + } + +// Attributes + DWORD GetCommandBarExtendedStyle() const + { + return m_dwExtendedStyle; + } + + DWORD SetCommandBarExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + return dwPrevStyle; + } + + CMenuHandle GetMenu() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return m_hMenu; + } + + COLORREF GetImageMaskColor() const + { + return m_clrMask; + } + + COLORREF SetImageMaskColor(COLORREF clrMask) + { + COLORREF clrOld = m_clrMask; + m_clrMask = clrMask; + return clrOld; + } + + bool GetImagesVisible() const + { + return m_bImagesVisible; + } + + bool SetImagesVisible(bool bVisible) + { + bool bOld = m_bImagesVisible; + m_bImagesVisible = bVisible; + return bOld; + } + + void GetImageSize(SIZE& size) const + { + size = m_szBitmap; + } + + bool SetImageSize(SIZE& size) + { + return SetImageSize(size.cx, size.cy); + } + + bool SetImageSize(int cx, int cy) + { + if(m_hImageList != NULL) + { + if(::ImageList_GetImageCount(m_hImageList) == 0) // empty + { + ::ImageList_Destroy(m_hImageList); + m_hImageList = NULL; + } + else + { + return false; // can't set, image list exists + } + } + + if(cx == 0 || cy == 0) + return false; + + m_szBitmap.cx = cx; + m_szBitmap.cy = cy; + m_szButton.cx = m_szBitmap.cx + 2 * s_kcxButtonMargin; + m_szButton.cy = m_szBitmap.cy + 2 * s_kcyButtonMargin; + + return true; + } + + bool GetAlphaImages() const + { + return m_bAlphaImages; + } + + bool SetAlphaImages(bool bAlphaImages) + { + if(m_hImageList != NULL) + { + if(::ImageList_GetImageCount(m_hImageList) == 0) // empty + { + ::ImageList_Destroy(m_hImageList); + m_hImageList = NULL; + } + else + { + return false; // can't set, image list exists + } + } + + m_bAlphaImages = bAlphaImages; + return true; + } + + HWND GetCmdBar() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); + } + +// Methods + HWND Create(HWND hWndParent, RECT& rcPos, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + UINT nID = 0, LPVOID lpCreateParam = NULL) + { + // These styles are required for command bars + dwStyle |= TBSTYLE_LIST | TBSTYLE_FLAT; +#if (_MSC_VER >= 1300) + return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; + return _baseClass::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); +#endif // !(_MSC_VER >= 1300) + } + + BOOL AttachToWindow(HWND hWnd) + { + ATLASSERT(m_hWnd == NULL); + ATLASSERT(::IsWindow(hWnd)); + BOOL bRet = SubclassWindow(hWnd); + if(bRet) + { + m_bAttachedMenu = true; + T* pT = static_cast(this); + pT->GetSystemSettings(); + } + return bRet; + } + + BOOL LoadMenu(ATL::_U_STRINGorID menu) + { + ATLASSERT(::IsWindow(m_hWnd)); + + if(m_bAttachedMenu) // doesn't work in this mode + return FALSE; + if(menu.m_lpstr == NULL) + return FALSE; + + HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); + if(hMenu == NULL) + return FALSE; + + return AttachMenu(hMenu); + } + + BOOL AttachMenu(HMENU hMenu) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); + if(hMenu != NULL && !::IsMenu(hMenu)) + return FALSE; + +#if _WTL_CMDBAR_VISTA_MENUS + // remove Vista bitmaps if used + if(m_bVistaMenus && (m_hMenu != NULL)) + { + T* pT = static_cast(this); + pT->_RemoveVistaBitmapsFromMenu(); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + + // destroy old menu, if needed, and set new one + if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) + ::DestroyMenu(m_hMenu); + + m_hMenu = hMenu; + + if(m_bAttachedMenu) // Nothing else in this mode + return TRUE; + + // Build buttons according to menu + SetRedraw(FALSE); + + // Clear all buttons + int nCount = GetButtonCount(); + for(int i = 0; i < nCount; i++) + ATLVERIFY(DeleteButton(0) != FALSE); + + // Add buttons for each menu item + if(m_hMenu != NULL) + { + int nItems = ::GetMenuItemCount(m_hMenu); + + T* pT = static_cast(this); + pT; // avoid level 4 warning + TCHAR szString[pT->_nMaxMenuItemTextLength]; + for(int i = 0; i < nItems; i++) + { + CMenuItemInfo mii; + mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU; + mii.fType = MFT_STRING; + mii.dwTypeData = szString; + mii.cch = pT->_nMaxMenuItemTextLength; + BOOL bRet = ::GetMenuItemInfo(m_hMenu, i, TRUE, &mii); + ATLASSERT(bRet); + // If we have more than the buffer, we assume we have bitmaps bits + if(lstrlen(szString) > pT->_nMaxMenuItemTextLength - 1) + { + mii.fType = MFT_BITMAP; + ::SetMenuItemInfo(m_hMenu, i, TRUE, &mii); + szString[0] = 0; + } + + // NOTE: Command Bar currently supports only drop-down menu items + ATLASSERT(mii.hSubMenu != NULL); + + TBBUTTON btn = { 0 }; + btn.iBitmap = 0; + btn.idCommand = i; + btn.fsState = (BYTE)(((mii.fState & MFS_DISABLED) == 0) ? TBSTATE_ENABLED : 0); + btn.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE | TBSTYLE_DROPDOWN; + btn.dwData = 0; + btn.iString = 0; + + bRet = InsertButton(-1, &btn); + ATLASSERT(bRet); + + TBBUTTONINFO bi = { 0 }; + bi.cbSize = sizeof(TBBUTTONINFO); + bi.dwMask = TBIF_TEXT; + bi.pszText = szString; + + bRet = SetButtonInfo(i, &bi); + ATLASSERT(bRet); + } + } + + SetRedraw(TRUE); + Invalidate(); + UpdateWindow(); + + return TRUE; + } + + BOOL LoadImages(ATL::_U_STRINGorID image) + { + return _LoadImagesHelper(image, false); + } + + BOOL LoadMappedImages(UINT nIDImage, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) + { + return _LoadImagesHelper(nIDImage, true, nFlags , lpColorMap, nMapSize); + } + + BOOL _LoadImagesHelper(ATL::_U_STRINGorID image, bool bMapped, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); + + HRSRC hRsrc = ::FindResource(hInstance, image.m_lpstr, (LPTSTR)RT_TOOLBAR); + if(hRsrc == NULL) + return FALSE; + + HGLOBAL hGlobal = ::LoadResource(hInstance, hRsrc); + if(hGlobal == NULL) + return FALSE; + + _ToolBarData* pData = (_ToolBarData*)::LockResource(hGlobal); + if(pData == NULL) + return FALSE; + ATLASSERT(pData->wVersion == 1); + + WORD* pItems = pData->items(); + int nItems = pData->wItemCount; + + // Set internal data + SetImageSize(pData->wWidth, pData->wHeight); + + // Create image list if needed + if(m_hImageList == NULL) + { + // Check if the bitmap is 32-bit (alpha channel) bitmap (valid for Windows XP only) + T* pT = static_cast(this); + m_bAlphaImages = AtlIsAlphaBitmapResource(image); + + if(!pT->CreateInternalImageList(pData->wItemCount)) + return FALSE; + } + +#if _WTL_CMDBAR_VISTA_MENUS + int nOldImageCount = ::ImageList_GetImageCount(m_hImageList); +#endif // _WTL_CMDBAR_VISTA_MENUS + + // Add bitmap to our image list + CBitmap bmp; + if(bMapped) + { + ATLASSERT(HIWORD(PtrToUlong(image.m_lpstr)) == 0); // if mapped, must be a numeric ID + int nIDImage = (int)(short)LOWORD(PtrToUlong(image.m_lpstr)); + bmp.LoadMappedBitmap(nIDImage, (WORD)nFlags, lpColorMap, nMapSize); + } + else + { + if(m_bAlphaImages) + bmp = (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); + else + bmp.LoadBitmap(image.m_lpstr); + } + ATLASSERT(bmp.m_hBitmap != NULL); + if(bmp.m_hBitmap == NULL) + return FALSE; + if(::ImageList_AddMasked(m_hImageList, bmp, m_clrMask) == -1) + return FALSE; + + // Fill the array with command IDs + for(int i = 0; i < nItems; i++) + { + if(pItems[i] != 0) + m_arrCommand.Add(pItems[i]); + } + + int nImageCount = ::ImageList_GetImageCount(m_hImageList); + ATLASSERT(nImageCount == m_arrCommand.GetSize()); + if(nImageCount != m_arrCommand.GetSize()) + return FALSE; + +#if _WTL_CMDBAR_VISTA_MENUS + if(RunTimeHelper::IsVista()) + { + T* pT = static_cast(this); + pT->_AddVistaBitmapsFromImageList(nOldImageCount, nImageCount - nOldImageCount); + ATLASSERT(nImageCount == m_arrVistaBitmap.GetSize()); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + + return TRUE; + } + + BOOL AddBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + CBitmap bmp; + bmp.LoadBitmap(bitmap.m_lpstr); + if(bmp.m_hBitmap == NULL) + return FALSE; + return AddBitmap(bmp, nCommandID); + } + + BOOL AddBitmap(HBITMAP hBitmap, UINT nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + // Create image list if it doesn't exist + if(m_hImageList == NULL) + { + if(!pT->CreateInternalImageList(1)) + return FALSE; + } + // check bitmap size + CBitmapHandle bmp = hBitmap; + SIZE size = { 0, 0 }; + bmp.GetSize(size); + if(size.cx != m_szBitmap.cx || size.cy != m_szBitmap.cy) + { + ATLASSERT(FALSE); // must match size! + return FALSE; + } + // add bitmap + int nRet = ::ImageList_AddMasked(m_hImageList, hBitmap, m_clrMask); + if(nRet == -1) + return FALSE; + BOOL bRet = m_arrCommand.Add((WORD)nCommandID); + ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); +#if _WTL_CMDBAR_VISTA_MENUS + if(RunTimeHelper::IsVista()) + { + pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); + ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + return bRet; + } + + BOOL AddIcon(ATL::_U_STRINGorID icon, UINT nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); + if(hIcon == NULL) + return FALSE; + return AddIcon(hIcon, nCommandID); + } + + BOOL AddIcon(HICON hIcon, UINT nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + // create image list if it doesn't exist + if(m_hImageList == NULL) + { + if(!pT->CreateInternalImageList(1)) + return FALSE; + } + + int nRet = ::ImageList_AddIcon(m_hImageList, hIcon); + if(nRet == -1) + return FALSE; + BOOL bRet = m_arrCommand.Add((WORD)nCommandID); + ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); +#if _WTL_CMDBAR_VISTA_MENUS + if(RunTimeHelper::IsVista()) + { + pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); + ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + return bRet; + } + + BOOL ReplaceBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + CBitmap bmp; + bmp.LoadBitmap(bitmap.m_lpstr); + if(bmp.m_hBitmap == NULL) + return FALSE; + return ReplaceBitmap(bmp, nCommandID); + } + + BOOL ReplaceBitmap(HBITMAP hBitmap, UINT nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + BOOL bRet = FALSE; + for(int i = 0; i < m_arrCommand.GetSize(); i++) + { + if(m_arrCommand[i] == nCommandID) + { + bRet = ::ImageList_Remove(m_hImageList, i); + if(bRet) + { + m_arrCommand.RemoveAt(i); +#if _WTL_CMDBAR_VISTA_MENUS + if(RunTimeHelper::IsVista()) + { + if(m_arrVistaBitmap[i] != NULL) + ::DeleteObject(m_arrVistaBitmap[i]); + m_arrVistaBitmap.RemoveAt(i); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + } + break; + } + } + if(bRet) + bRet = AddBitmap(hBitmap, nCommandID); + return bRet; + } + + BOOL ReplaceIcon(ATL::_U_STRINGorID icon, UINT nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); + if(hIcon == NULL) + return FALSE; + return ReplaceIcon(hIcon, nCommandID); + } + + BOOL ReplaceIcon(HICON hIcon, UINT nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + BOOL bRet = FALSE; + for(int i = 0; i < m_arrCommand.GetSize(); i++) + { + if(m_arrCommand[i] == nCommandID) + { + bRet = (::ImageList_ReplaceIcon(m_hImageList, i, hIcon) != -1); +#if _WTL_CMDBAR_VISTA_MENUS + if(RunTimeHelper::IsVista() && bRet != FALSE) + { + T* pT = static_cast(this); + pT->_ReplaceVistaBitmapFromImageList(i); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + break; + } + } + return bRet; + } + + BOOL RemoveImage(int nCommandID) + { + ATLASSERT(::IsWindow(m_hWnd)); + + BOOL bRet = FALSE; + for(int i = 0; i < m_arrCommand.GetSize(); i++) + { + if(m_arrCommand[i] == nCommandID) + { + bRet = ::ImageList_Remove(m_hImageList, i); + if(bRet) + { + m_arrCommand.RemoveAt(i); +#if _WTL_CMDBAR_VISTA_MENUS + if(RunTimeHelper::IsVista()) + { + if(m_arrVistaBitmap[i] != NULL) + ::DeleteObject(m_arrVistaBitmap[i]); + m_arrVistaBitmap.RemoveAt(i); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + } + break; + } + } + return bRet; + } + + BOOL RemoveAllImages() + { + ATLASSERT(::IsWindow(m_hWnd)); + + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Removing all images\n")); + BOOL bRet = ::ImageList_RemoveAll(m_hImageList); + if(bRet) + { + m_arrCommand.RemoveAll(); +#if _WTL_CMDBAR_VISTA_MENUS + for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) + { + if(m_arrVistaBitmap[i] != NULL) + ::DeleteObject(m_arrVistaBitmap[i]); + } + m_arrVistaBitmap.RemoveAll(); +#endif // _WTL_CMDBAR_VISTA_MENUS + } + return bRet; + } + + BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsMenu(hMenu)); + if(!::IsMenu(hMenu)) + return FALSE; + m_bContextMenu = true; + if(m_bUseKeyboardCues) + m_bShowKeyboardCues = m_bKeyboardInput; + T* pT = static_cast(this); + return pT->DoTrackPopupMenu(hMenu, uFlags, x, y, lpParams); + } + + BOOL SetMDIClient(HWND /*hWndMDIClient*/) + { + // Use CMDICommandBarCtrl for MDI support + ATLASSERT(FALSE); + return FALSE; + } + +// Message map and handlers + BEGIN_MSG_MAP(CCommandBarCtrlImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_INITMENU, OnInitMenu) + MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) + MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) + MESSAGE_HANDLER(GetAutoPopupMessage(), OnInternalAutoPopup) + MESSAGE_HANDLER(GetGetBarMessage(), OnInternalGetBar) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) + MESSAGE_HANDLER(WM_MENUCHAR, OnMenuChar) + + MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) + MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) + MESSAGE_HANDLER(WM_CHAR, OnChar) + MESSAGE_HANDLER(WM_SYSKEYDOWN, OnSysKeyDown) + MESSAGE_HANDLER(WM_SYSKEYUP, OnSysKeyUp) + MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar) +// public API handlers - these stay to support chevrons in atlframe.h + MESSAGE_HANDLER(CBRM_GETMENU, OnAPIGetMenu) + MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnAPITrackPopupMenu) + MESSAGE_HANDLER(CBRM_GETCMDBAR, OnAPIGetCmdBar) + + MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) + MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) + + MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg) + ALT_MSG_MAP(1) // Parent window messages + NOTIFY_CODE_HANDLER(TBN_HOTITEMCHANGE, OnParentHotItemChange) + NOTIFY_CODE_HANDLER(TBN_DROPDOWN, OnParentDropDown) + MESSAGE_HANDLER(WM_INITMENUPOPUP, OnParentInitMenuPopup) + MESSAGE_HANDLER(GetGetBarMessage(), OnParentInternalGetBar) + MESSAGE_HANDLER(WM_SYSCOMMAND, OnParentSysCommand) + MESSAGE_HANDLER(CBRM_GETMENU, OnParentAPIGetMenu) + MESSAGE_HANDLER(WM_MENUCHAR, OnParentMenuChar) + MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnParentAPITrackPopupMenu) + MESSAGE_HANDLER(CBRM_GETCMDBAR, OnParentAPIGetCmdBar) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnParentSettingChange) + + MESSAGE_HANDLER(WM_DRAWITEM, OnParentDrawItem) + MESSAGE_HANDLER(WM_MEASUREITEM, OnParentMeasureItem) + + MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) + NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnParentCustomDraw) + ALT_MSG_MAP(2) // MDI client window messages + // Use CMDICommandBarCtrl for MDI support + ALT_MSG_MAP(3) // Message hook messages + MESSAGE_HANDLER(WM_MOUSEMOVE, OnHookMouseMove) + MESSAGE_HANDLER(WM_SYSKEYDOWN, OnHookSysKeyDown) + MESSAGE_HANDLER(WM_SYSKEYUP, OnHookSysKeyUp) + MESSAGE_HANDLER(WM_SYSCHAR, OnHookSysChar) + MESSAGE_HANDLER(WM_KEYDOWN, OnHookKeyDown) + MESSAGE_HANDLER(WM_NEXTMENU, OnHookNextMenu) + MESSAGE_HANDLER(WM_CHAR, OnHookChar) + END_MSG_MAP() + + LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + LPMSG pMsg = (LPMSG)lParam; + if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) + m_bKeyboardInput = false; + else if(pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) + m_bKeyboardInput = true; + LRESULT lRet = 0; + ProcessWindowMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam, lRet, 3); + return lRet; + } + + LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + // Let the toolbar initialize itself + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + // get and use system settings + T* pT = static_cast(this); + pT->GetSystemSettings(); + // Parent init + ATL::CWindow wndParent = GetParent(); + ATL::CWindow wndTopLevelParent = wndParent.GetTopLevelParent(); + m_wndParent.SubclassWindow(wndTopLevelParent); + // Toolbar Init + SetButtonStructSize(); + SetImageList(NULL); + + // Create message hook if needed + CWindowCreateCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnCreate.\n")); + ATLASSERT(FALSE); + return -1; + } + + if(s_pmapMsgHook == NULL) + { + ATLTRY(s_pmapMsgHook = new CMsgHookMap); + ATLASSERT(s_pmapMsgHook != NULL); + } + + if(s_pmapMsgHook != NULL) + { + DWORD dwThreadID = ::GetCurrentThreadId(); + _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); + if(pData == NULL) + { + ATLTRY(pData = new _MsgHookData); + ATLASSERT(pData != NULL); + HHOOK hMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, MessageHookProc, ModuleHelper::GetModuleInstance(), dwThreadID); + ATLASSERT(hMsgHook != NULL); + if(pData != NULL && hMsgHook != NULL) + { + pData->hMsgHook = hMsgHook; + pData->dwUsage = 1; + BOOL bRet = s_pmapMsgHook->Add(dwThreadID, pData); + bRet; + ATLASSERT(bRet); + } + } + else + { + (pData->dwUsage)++; + } + } + lock.Unlock(); + + // Get layout +#if (WINVER >= 0x0500) + m_bLayoutRTL = ((GetExStyle() & WS_EX_LAYOUTRTL) != 0); +#endif // (WINVER >= 0x0500) + + return lRet; + } + + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + +#if _WTL_CMDBAR_VISTA_MENUS + if(m_bVistaMenus && (m_hMenu != NULL)) + { + T* pT = static_cast(this); + pT->_RemoveVistaBitmapsFromMenu(); + } + + for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) + { + if(m_arrVistaBitmap[i] != NULL) + ::DeleteObject(m_arrVistaBitmap[i]); + } +#endif // _WTL_CMDBAR_VISTA_MENUS + + if(m_bAttachedMenu) // nothing to do in this mode + return lRet; + + CWindowCreateCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnDestroy.\n")); + ATLASSERT(FALSE); + return lRet; + } + + if(s_pmapMsgHook != NULL) + { + DWORD dwThreadID = ::GetCurrentThreadId(); + _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); + if(pData != NULL) + { + (pData->dwUsage)--; + if(pData->dwUsage == 0) + { + BOOL bRet = ::UnhookWindowsHookEx(pData->hMsgHook); + ATLASSERT(bRet); + bRet = s_pmapMsgHook->Remove(dwThreadID); + ATLASSERT(bRet); + if(bRet) + delete pData; + } + + if(s_pmapMsgHook->GetSize() == 0) + { + delete s_pmapMsgHook; + s_pmapMsgHook = NULL; + } + } + } + + lock.Unlock(); + + return lRet; + } + + LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyDown\n")); +#endif + bHandled = FALSE; + // Simulate Alt+Space for the parent + if(wParam == VK_SPACE) + { + m_wndParent.PostMessage(WM_SYSKEYDOWN, wParam, lParam | (1 << 29)); + bHandled = TRUE; + } +#if (_WIN32_IE >= 0x0500) + else if(wParam == VK_LEFT || wParam == VK_RIGHT) + { + WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; + + if(!m_bMenuActive) + { + T* pT = static_cast(this); + int nBtn = GetHotItem(); + int nNextBtn = (wParam == wpNext) ? pT->GetNextMenuItem(nBtn) : pT->GetPreviousMenuItem(nBtn); + if(nNextBtn == -2) + { + SetHotItem(-1); + if(pT->DisplayChevronMenu()) + bHandled = TRUE; + } + } + } +#endif // (_WIN32_IE >= 0x0500) + return 0; + } + + LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyUp\n")); +#endif + if(wParam != VK_SPACE) + bHandled = FALSE; + return 0; + } + + LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnChar\n")); +#endif + if(wParam != VK_SPACE) + bHandled = FALSE; + else + return 0; + // Security + if(!m_wndParent.IsWindowEnabled() || ::GetFocus() != m_hWnd) + return 0; + + // Handle mnemonic press when we have focus + int nBtn = 0; + if(wParam != VK_RETURN && !MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) + { +#if (_WIN32_IE >= 0x0500) + if((TCHAR)LOWORD(wParam) != _chChevronShortcut) +#endif // (_WIN32_IE >= 0x0500) + ::MessageBeep(0); + } + else + { +#if (_WIN32_IE >= 0x0500) + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + RECT rcBtn = { 0 }; + GetItemRect(nBtn, &rcBtn); + TBBUTTON tbb = { 0 }; + GetButton(nBtn, &tbb); + if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) + { +#endif // (_WIN32_IE >= 0x0500) + PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + if(wParam != VK_RETURN) + SetHotItem(nBtn); +#if (_WIN32_IE >= 0x0500) + } + else + { + ::MessageBeep(0); + bHandled = TRUE; + } +#endif // (_WIN32_IE >= 0x0500) + } + return 0; + } + + LRESULT OnSysKeyDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyDown\n")); +#endif + bHandled = FALSE; + return 0; + } + + LRESULT OnSysKeyUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyUp\n")); +#endif + bHandled = FALSE; + return 0; + } + + LRESULT OnSysChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysChar\n")); +#endif + bHandled = FALSE; + return 0; + } + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_bAttachedMenu || (m_dwExtendedStyle & CBR_EX_TRANSPARENT)) + { + bHandled = FALSE; + return 0; + } + + CDCHandle dc = (HDC)wParam; + RECT rect = { 0 }; + GetClientRect(&rect); + dc.FillRect(&rect, COLOR_MENU); + + return 1; // don't do the default erase + } + + LRESULT OnInitMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + int nIndex = GetHotItem(); + SendMessage(WM_MENUSELECT, MAKEWPARAM(nIndex, MF_POPUP|MF_HILITE), (LPARAM)m_hMenu); + bHandled = FALSE; + return 1; + } + + LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if((BOOL)HIWORD(lParam)) // System menu, do nothing + { + bHandled = FALSE; + return 1; + } + + if(!(m_bAttachedMenu || m_bMenuActive)) // Not attached or ours, do nothing + { + bHandled = FALSE; + return 1; + } + +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnInitMenuPopup\n")); +#endif + // forward to the parent or subclassed window, so it can handle update UI + LRESULT lRet = 0; + if(m_bAttachedMenu) + lRet = DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); + else + lRet = m_wndParent.DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); + +#if _WTL_CMDBAR_VISTA_MENUS + // If Vista menus are active, just set bitmaps and return + if(m_bVistaMenus) + { + CMenuHandle menu = (HMENU)wParam; + ATLASSERT(menu.m_hMenu != NULL); + + for(int i = 0; i < menu.GetMenuItemCount(); i++) + { + WORD nID = (WORD)menu.GetMenuItemID(i); + int nIndex = m_arrCommand.Find(nID); + + CMenuItemInfo mii; + mii.fMask = MIIM_BITMAP; + mii.hbmpItem = (m_bImagesVisible && (nIndex != -1)) ? m_arrVistaBitmap[nIndex] : NULL; + menu.SetMenuItemInfo(i, TRUE, &mii); + } + + return lRet; + } +#endif // _WTL_CMDBAR_VISTA_MENUS + + // Convert menu items to ownerdraw, add our data + if(m_bImagesVisible) + { + CMenuHandle menuPopup = (HMENU)wParam; + ATLASSERT(menuPopup.m_hMenu != NULL); + + T* pT = static_cast(this); + pT; // avoid level 4 warning + TCHAR szString[pT->_nMaxMenuItemTextLength]; + BOOL bRet = FALSE; + for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) + { + CMenuItemInfo mii; + mii.cch = pT->_nMaxMenuItemTextLength; + mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; + mii.dwTypeData = szString; + bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); + ATLASSERT(bRet); + + if(!(mii.fType & MFT_OWNERDRAW)) // Not already an ownerdraw item + { + mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; + _MenuItemData* pMI = NULL; + ATLTRY(pMI = new _MenuItemData); + ATLASSERT(pMI != NULL); + if(pMI != NULL) + { + pMI->fType = mii.fType; + pMI->fState = mii.fState; + mii.fType |= MFT_OWNERDRAW; + pMI->iButton = -1; + for(int j = 0; j < m_arrCommand.GetSize(); j++) + { + if(m_arrCommand[j] == mii.wID) + { + pMI->iButton = j; + break; + } + } + int cchLen = lstrlen(szString) + 1; + pMI->lpstrText = NULL; + ATLTRY(pMI->lpstrText = new TCHAR[cchLen]); + ATLASSERT(pMI->lpstrText != NULL); + if(pMI->lpstrText != NULL) + SecureHelper::strcpy_x(pMI->lpstrText, cchLen, szString); + mii.dwItemData = (ULONG_PTR)pMI; + bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); + ATLASSERT(bRet); + } + } + } + + // Add it to the list + m_stackMenuHandle.Push(menuPopup.m_hMenu); + } + + return lRet; + } + + LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if(!m_bAttachedMenu) // Not attached, do nothing, forward to parent + { + m_bPopupItem = (lParam != NULL) && ((HMENU)lParam != m_hMenu) && (HIWORD(wParam) & MF_POPUP); + if(m_wndParent.IsWindow()) + m_wndParent.SendMessage(uMsg, wParam, lParam); + bHandled = FALSE; + return 1; + } + + // Check if a menu is closing, do a cleanup + if(HIWORD(wParam) == 0xFFFF && lParam == NULL) // Menu closing + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuSelect - CLOSING!!!!\n")); +#endif + ATLASSERT(m_stackMenuWnd.GetSize() == 0); + // Restore the menu items to the previous state for all menus that were converted + if(m_bImagesVisible) + { + HMENU hMenu = NULL; + while((hMenu = m_stackMenuHandle.Pop()) != NULL) + { + CMenuHandle menuPopup = hMenu; + ATLASSERT(menuPopup.m_hMenu != NULL); + // Restore state and delete menu item data + BOOL bRet = FALSE; + for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) + { + CMenuItemInfo mii; + mii.fMask = MIIM_DATA | MIIM_TYPE; + bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); + ATLASSERT(bRet); + + _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; + if(pMI != NULL && pMI->IsCmdBarMenuItem()) + { + mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; + mii.fType = pMI->fType; + mii.dwTypeData = pMI->lpstrText; + mii.cch = lstrlen(pMI->lpstrText); + mii.dwItemData = NULL; + + bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); + ATLASSERT(bRet); + + delete [] pMI->lpstrText; + pMI->dwMagic = 0x6666; + delete pMI; + } + } + } + } + } + + bHandled = FALSE; + return 1; + } + + LRESULT OnInternalAutoPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + int nIndex = (int)wParam; + T* pT = static_cast(this); + pT->DoPopupMenu(nIndex, false); + return 0; + } + + LRESULT OnInternalGetBar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + // Let's make sure we're not embedded in another process + if((LPVOID)wParam != NULL) + *((DWORD*)wParam) = GetCurrentProcessId(); + if(IsWindowVisible()) + return (LRESULT)static_cast(this); + else + return NULL; + } + + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { +#ifndef SPI_GETKEYBOARDCUES + const UINT SPI_SETKEYBOARDCUES = 0x100B; +#endif // !SPI_GETKEYBOARDCUES +#ifndef SPI_GETFLATMENU + const UINT SPI_SETFLATMENU = 0x1023; +#endif // !SPI_GETFLATMENU + + if(wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETKEYBOARDCUES || wParam == SPI_SETFLATMENU) + { + T* pT = static_cast(this); + pT->GetSystemSettings(); + } + + return 0; + } + + LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + + LPWINDOWPOS lpWP = (LPWINDOWPOS)lParam; + int cyMin = ::GetSystemMetrics(SM_CYMENU); + if(lpWP->cy < cyMin) + lpWP->cy = cyMin; + + return lRet; + } + + LRESULT OnMenuChar(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuChar\n")); +#endif + bHandled = TRUE; + T* pT = static_cast(this); + + LRESULT lRet; + if(m_bMenuActive && LOWORD(wParam) != 0x0D) + lRet = 0; + else + lRet = MAKELRESULT(1, 1); + + if(m_bMenuActive && HIWORD(wParam) == MF_POPUP) + { + // Convert character to lower/uppercase and possibly Unicode, using current keyboard layout + TCHAR ch = (TCHAR)LOWORD(wParam); + CMenuHandle menu = (HMENU)lParam; + int nCount = ::GetMenuItemCount(menu); + int nRetCode = MNC_EXECUTE; + BOOL bRet = FALSE; + TCHAR szString[pT->_nMaxMenuItemTextLength]; + WORD wMnem = 0; + bool bFound = false; + for(int i = 0; i < nCount; i++) + { + CMenuItemInfo mii; + mii.cch = pT->_nMaxMenuItemTextLength; + mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; + mii.dwTypeData = szString; + bRet = menu.GetMenuItemInfo(i, TRUE, &mii); + if(!bRet || (mii.fType & MFT_SEPARATOR)) + continue; + _MenuItemData* pmd = (_MenuItemData*)mii.dwItemData; + if(pmd != NULL && pmd->IsCmdBarMenuItem()) + { + LPTSTR p = pmd->lpstrText; + + if(p != NULL) + { + while(*p && *p != _T('&')) + p = ::CharNext(p); + if(p != NULL && *p) + { + DWORD dwP = MAKELONG(*(++p), 0); + DWORD dwC = MAKELONG(ch, 0); + if(::CharLower((LPTSTR)ULongToPtr(dwP)) == ::CharLower((LPTSTR)ULongToPtr(dwC))) + { + if(!bFound) + { + wMnem = (WORD)i; + bFound = true; + } + else + { + nRetCode = MNC_SELECT; + break; + } + } + } + } + } + } + if(bFound) + { + if(nRetCode == MNC_EXECUTE) + { + PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + pT->GiveFocusBack(); + } + bHandled = TRUE; + lRet = MAKELRESULT(wMnem, nRetCode); + } + } + else if(!m_bMenuActive) + { + int nBtn = 0; + if(!MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) + { + bHandled = FALSE; + PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + pT->GiveFocusBack(); + +#if (_WIN32_IE >= 0x0500) + // check if we should display chevron menu + if((TCHAR)LOWORD(wParam) == pT->_chChevronShortcut) + { + if(pT->DisplayChevronMenu()) + bHandled = TRUE; + } +#endif // (_WIN32_IE >= 0x0500) + } + else if(m_wndParent.IsWindowEnabled()) + { +#if (_WIN32_IE >= 0x0500) + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + RECT rcBtn = { 0 }; + GetItemRect(nBtn, &rcBtn); + TBBUTTON tbb = { 0 }; + GetButton(nBtn, &tbb); + if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) + { +#endif // (_WIN32_IE >= 0x0500) + if(m_bUseKeyboardCues && !m_bShowKeyboardCues) + { + m_bAllowKeyboardCues = true; + ShowKeyboardCues(true); + } + pT->TakeFocus(); + PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + SetHotItem(nBtn); +#if (_WIN32_IE >= 0x0500) + } + else + { + ::MessageBeep(0); + } +#endif // (_WIN32_IE >= 0x0500) + } + } + + return lRet; + } + + LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + LPDRAWITEMSTRUCT lpDrawItemStruct = (LPDRAWITEMSTRUCT)lParam; + _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; + if(lpDrawItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) + { + T* pT = static_cast(this); + pT->DrawItem(lpDrawItemStruct); + } + else + { + bHandled = FALSE; + } + return (LRESULT)TRUE; + } + + LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + LPMEASUREITEMSTRUCT lpMeasureItemStruct = (LPMEASUREITEMSTRUCT)lParam; + _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; + if(lpMeasureItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) + { + T* pT = static_cast(this); + pT->MeasureItem(lpMeasureItemStruct); + } + else + { + bHandled = FALSE; + } + return (LRESULT)TRUE; + } + +// API message handlers + LRESULT OnAPIGetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return (LRESULT)m_hMenu; + } + + LRESULT OnAPITrackPopupMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + if(lParam == NULL) + return FALSE; + LPCBRPOPUPMENU lpCBRPopupMenu = (LPCBRPOPUPMENU)lParam; + if(lpCBRPopupMenu->cbSize != sizeof(CBRPOPUPMENU)) + return FALSE; + + T* pT = static_cast(this); + return pT->TrackPopupMenu(lpCBRPopupMenu->hMenu, lpCBRPopupMenu->uFlags, lpCBRPopupMenu->x, lpCBRPopupMenu->y, lpCBRPopupMenu->lptpm); + } + + LRESULT OnAPIGetCmdBar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return (LRESULT)m_hWnd; + } + +// Parent window message handlers + LRESULT OnParentHotItemChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + LPNMTBHOTITEM lpNMHT = (LPNMTBHOTITEM)pnmh; + + // Check if this comes from us + if(pnmh->hwndFrom != m_hWnd) + { + bHandled = FALSE; + return 0; + } + + bool bBlockTracking = false; + if((m_dwExtendedStyle & CBR_EX_TRACKALWAYS) == 0) + { + DWORD dwProcessID; + ::GetWindowThreadProcessId(::GetActiveWindow(), &dwProcessID); + bBlockTracking = (::GetCurrentProcessId() != dwProcessID); + } + + if((!m_wndParent.IsWindowEnabled() || bBlockTracking) && (lpNMHT->dwFlags & HICF_MOUSE)) + { + return 1; + } + else + { +#ifndef HICF_LMOUSE + const DWORD HICF_LMOUSE = 0x00000080; // left mouse button selected +#endif + bHandled = FALSE; + + // Send WM_MENUSELECT to the app if it needs to display a status text + if(!(lpNMHT->dwFlags & HICF_MOUSE) + && !(lpNMHT->dwFlags & HICF_ACCELERATOR) + && !(lpNMHT->dwFlags & HICF_LMOUSE)) + { + if(lpNMHT->dwFlags & HICF_ENTERING) + m_wndParent.SendMessage(WM_MENUSELECT, 0, (LPARAM)m_hMenu); + if(lpNMHT->dwFlags & HICF_LEAVING) + m_wndParent.SendMessage(WM_MENUSELECT, MAKEWPARAM(0, 0xFFFF), NULL); + } + + return 0; + } + } + + LRESULT OnParentDropDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + // Check if this comes from us + if(pnmh->hwndFrom != m_hWnd) + { + bHandled = FALSE; + return 1; + } + + T* pT = static_cast(this); + if(::GetFocus() != m_hWnd) + pT->TakeFocus(); + LPNMTOOLBAR pNMToolBar = (LPNMTOOLBAR)pnmh; + int nIndex = CommandToIndex(pNMToolBar->iItem); + m_bContextMenu = false; + m_bEscapePressed = false; + pT->DoPopupMenu(nIndex, true); + + return TBDDRET_DEFAULT; + } + + LRESULT OnParentInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnInitMenuPopup(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentInternalGetBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnInternalGetBar(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + bHandled = FALSE; + if((m_uSysKey == VK_MENU + || (m_uSysKey == VK_F10 && !(::GetKeyState(VK_SHIFT) & 0x80)) + || m_uSysKey == VK_SPACE) + && wParam == SC_KEYMENU) + { + T* pT = static_cast(this); + if(::GetFocus() == m_hWnd) + { + pT->GiveFocusBack(); // exit menu "loop" + PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + } + else if(m_uSysKey != VK_SPACE && !m_bSkipMsg) + { + if(m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) + ShowKeyboardCues(true); + + pT->TakeFocus(); // enter menu "loop" + bHandled = TRUE; + } + else if(m_uSysKey != VK_SPACE) + { + bHandled = TRUE; + } + } + m_bSkipMsg = false; + return 0; + } + + LRESULT OnParentAPIGetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnAPIGetMenu(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentMenuChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnMenuChar(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentAPITrackPopupMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnAPITrackPopupMenu(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentAPIGetCmdBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnAPIGetCmdBar(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + OnSettingChange(uMsg, wParam, lParam, bHandled); + bHandled = FALSE; + return 1; + } + + LRESULT OnParentDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnDrawItem(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return OnMeasureItem(uMsg, wParam, lParam, bHandled); + } + + LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); + if(!m_bParentActive && m_bUseKeyboardCues && m_bShowKeyboardCues) + { + ShowKeyboardCues(false); // this will repaint our window + } + else + { + Invalidate(); + UpdateWindow(); + } + bHandled = FALSE; + return 1; + } + + LRESULT OnParentCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + LRESULT lRet = CDRF_DODEFAULT; + bHandled = FALSE; + if(pnmh->hwndFrom == m_hWnd) + { + LPNMTBCUSTOMDRAW lpTBCustomDraw = (LPNMTBCUSTOMDRAW)pnmh; + if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_PREPAINT) + { + lRet = CDRF_NOTIFYITEMDRAW; + bHandled = TRUE; + } + else if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) + { + if(m_bFlatMenus) + { +#ifndef COLOR_MENUHILIGHT + const int COLOR_MENUHILIGHT = 29; +#endif // !COLOR_MENUHILIGHT + bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); + if(!bDisabled && ((lpTBCustomDraw->nmcd.uItemState & CDIS_HOT) == CDIS_HOT || + (lpTBCustomDraw->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)) + { + ::FillRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_MENUHILIGHT)); + ::FrameRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_HIGHLIGHT)); + lpTBCustomDraw->clrText = ::GetSysColor(m_bParentActive ? COLOR_HIGHLIGHTTEXT : COLOR_GRAYTEXT); + } + else if(bDisabled || !m_bParentActive) + { + lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); + } + CDCHandle dc = lpTBCustomDraw->nmcd.hdc; + dc.SetTextColor(lpTBCustomDraw->clrText); + dc.SetBkMode(lpTBCustomDraw->nStringBkMode); + HFONT hFont = GetFont(); + HFONT hFontOld = NULL; + if(hFont != NULL) + hFontOld = dc.SelectFont(hFont); + const int cchText = 200; + TCHAR szText[cchText] = { 0 }; + TBBUTTONINFO tbbi = { 0 }; + tbbi.cbSize = sizeof(TBBUTTONINFO); + tbbi.dwMask = TBIF_TEXT; + tbbi.pszText = szText; + tbbi.cchText = cchText; + GetButtonInfo((int)lpTBCustomDraw->nmcd.dwItemSpec, &tbbi); + dc.DrawText(szText, -1, &lpTBCustomDraw->nmcd.rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); + if(hFont != NULL) + dc.SelectFont(hFontOld); + lRet = CDRF_SKIPDEFAULT; + bHandled = TRUE; + } + else if(!m_bParentActive) + { + lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); + bHandled = TRUE; + } + } + } + return lRet; + } + +// Message hook handlers + LRESULT OnHookMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + static POINT s_point = { -1, -1 }; + DWORD dwPoint = ::GetMessagePos(); + POINT point = { GET_X_LPARAM(dwPoint), GET_Y_LPARAM(dwPoint) }; + + bHandled = FALSE; + if(m_bMenuActive) + { + if(::WindowFromPoint(point) == m_hWnd) + { + ScreenToClient(&point); + int nHit = HitTest(&point); + + if((point.x != s_point.x || point.y != s_point.y) && nHit >= 0 && nHit < ::GetMenuItemCount(m_hMenu) && nHit != m_nPopBtn && m_nPopBtn != -1) + { + TBBUTTON tbb = { 0 }; + GetButton(nHit, &tbb); + if((tbb.fsState & TBSTATE_ENABLED) != 0) + { + m_nNextPopBtn = nHit | 0xFFFF0000; + HWND hWndMenu = m_stackMenuWnd.GetCurrent(); + ATLASSERT(hWndMenu != NULL); + + // this one is needed to close a menu if mouse button was down + ::PostMessage(hWndMenu, WM_LBUTTONUP, 0, MAKELPARAM(point.x, point.y)); + // this one closes a popup menu + ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); + + bHandled = TRUE; + } + } + } + } + else + { + ScreenToClient(&point); + } + + s_point = point; + return 0; + } + + LRESULT OnHookSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + bHandled = FALSE; +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYDOWN (0x%2.2X)\n"), wParam); +#endif + + if(wParam == VK_MENU && m_bParentActive && m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) + ShowKeyboardCues(true); + + if(wParam != VK_SPACE && !m_bMenuActive && ::GetFocus() == m_hWnd) + { + m_bAllowKeyboardCues = false; + PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + T* pT = static_cast(this); + pT->GiveFocusBack(); + m_bSkipMsg = true; + } + else + { + if(wParam == VK_SPACE && m_bUseKeyboardCues && m_bShowKeyboardCues) + { + m_bAllowKeyboardCues = true; + ShowKeyboardCues(false); + } + m_uSysKey = (UINT)wParam; + } + return 0; + } + + LRESULT OnHookSysKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(!m_bAllowKeyboardCues) + m_bAllowKeyboardCues = true; + bHandled = FALSE; + wParam; +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYUP (0x%2.2X)\n"), wParam); +#endif + return 0; + } + + LRESULT OnHookSysChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + bHandled = FALSE; +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSCHAR (0x%2.2X)\n"), wParam); +#endif + + if(!m_bMenuActive && m_hWndHook != m_hWnd && wParam != VK_SPACE) + bHandled = TRUE; + return 0; + } + + LRESULT OnHookKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_KEYDOWN (0x%2.2X)\n"), wParam); +#endif + bHandled = FALSE; + T* pT = static_cast(this); + + if(wParam == VK_ESCAPE && m_stackMenuWnd.GetSize() <= 1) + { + if(m_bMenuActive && !m_bContextMenu) + { + int nHot = GetHotItem(); + if(nHot == -1) + nHot = m_nPopBtn; + if(nHot == -1) + nHot = 0; + SetHotItem(nHot); + bHandled = TRUE; + pT->TakeFocus(); + m_bEscapePressed = true; // To keep focus + m_bSkipPostDown = false; + } + else if(::GetFocus() == m_hWnd && m_wndParent.IsWindow()) + { + SetHotItem(-1); + pT->GiveFocusBack(); + bHandled = TRUE; + } + } + else if(wParam == VK_RETURN || wParam == VK_UP || wParam == VK_DOWN) + { + if(!m_bMenuActive && ::GetFocus() == m_hWnd && m_wndParent.IsWindow()) + { + int nHot = GetHotItem(); + if(nHot != -1) + { + if(wParam != VK_RETURN) + { + if(!m_bSkipPostDown) + { +// IE4 only: WM_KEYDOWN doesn't generate TBN_DROPDOWN, we need to simulate a mouse click +#if (_WIN32_IE < 0x0500) + DWORD dwMajor = 0, dwMinor = 0; + ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); + if(dwMajor <= 4 || (dwMajor == 5 && dwMinor < 80)) + { + RECT rect; + GetItemRect(nHot, &rect); + PostMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(rect.left, rect.top)); + } +#endif // (_WIN32_IE < 0x0500) + PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + m_bSkipPostDown = true; + } + else + { + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - skipping posting another VK_DOWN\n")); + m_bSkipPostDown = false; + } + } + } + else + { + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Can't find hot button\n")); + } + } + if(wParam == VK_RETURN && m_bMenuActive) + { + PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + m_nNextPopBtn = -1; + pT->GiveFocusBack(); + } + } + else if(wParam == VK_LEFT || wParam == VK_RIGHT) + { + WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; + WPARAM wpPrev = m_bLayoutRTL ? VK_RIGHT : VK_LEFT; + + if(m_bMenuActive && !m_bContextMenu && !(wParam == wpNext && m_bPopupItem)) + { + bool bAction = false; + if(wParam == wpPrev && s_pCurrentBar->m_stackMenuWnd.GetSize() == 1) + { + m_nNextPopBtn = pT->GetPreviousMenuItem(m_nPopBtn); + if(m_nNextPopBtn != -1) + bAction = true; + } + else if(wParam == wpNext) + { + m_nNextPopBtn = pT->GetNextMenuItem(m_nPopBtn); + if(m_nNextPopBtn != -1) + bAction = true; + } + HWND hWndMenu = m_stackMenuWnd.GetCurrent(); + ATLASSERT(hWndMenu != NULL); + + // Close the popup menu + if(bAction) + { + ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); + if(wParam == wpNext) + { + int cItem = m_stackMenuWnd.GetSize() - 1; + while(cItem >= 0) + { + hWndMenu = m_stackMenuWnd[cItem]; + if(hWndMenu != NULL) + ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); + cItem--; + } + } +#if (_WIN32_IE >= 0x0500) + if(m_nNextPopBtn == -2) + { + m_nNextPopBtn = -1; + pT->DisplayChevronMenu(); + } +#endif // (_WIN32_IE >= 0x0500) + bHandled = TRUE; + } + } + } + return 0; + } + + LRESULT OnHookNextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_NEXTMENU\n")); +#endif + bHandled = FALSE; + return 1; + } + + LRESULT OnHookChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_CHAR (0x%2.2X)\n"), wParam); +#endif + bHandled = (wParam == VK_ESCAPE); + return 0; + } + +// Implementation - ownerdraw overrideables and helpers + void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) + { + T* pT = static_cast(this); + if(m_bFlatMenus) + pT->DrawItemFlat(lpDrawItemStruct); + else + pT->DrawItem3D(lpDrawItemStruct); + + } + + void DrawItem3D(LPDRAWITEMSTRUCT lpDrawItemStruct) + { + _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; + CDCHandle dc = lpDrawItemStruct->hDC; + const RECT& rcItem = lpDrawItemStruct->rcItem; + T* pT = static_cast(this); + + if(pmd->fType & MFT_SEPARATOR) + { + // draw separator + RECT rc = rcItem; + rc.top += (rc.bottom - rc.top) / 2; // vertical center + dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line + } + else // not a separator + { + BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; + BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; + BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; + BOOL bHasImage = FALSE; + + if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) + bSelected = FALSE; + RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect + ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically + + int iButton = pmd->iButton; + if(iButton >= 0) + { + bHasImage = TRUE; + + // calc drawing point + SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; + sz.cx /= 2; + sz.cy /= 2; + POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; + + // fill background depending on state + if(!bChecked || (bSelected && !bDisabled)) + { + if(!bDisabled) + dc.FillRect(&rcButn, (bChecked && !bSelected) ? COLOR_3DLIGHT : COLOR_MENU); + else + dc.FillRect(&rcButn, COLOR_MENU); + } + else + { + COLORREF crTxt = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); + COLORREF crBk = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); + CBrush hbr(CDCHandle::GetHalftoneBrush()); + dc.SetBrushOrg(rcButn.left, rcButn.top); + dc.FillRect(&rcButn, hbr); + dc.SetTextColor(crTxt); + dc.SetBkColor(crBk); + } + + // draw disabled or normal + if(!bDisabled) + { + // draw pushed-in or popped-out edge + if(bSelected || bChecked) + { + RECT rc2 = rcButn; + dc.DrawEdge(&rc2, bChecked ? BDR_SUNKENOUTER : BDR_RAISEDINNER, BF_RECT); + } + // draw the image + ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); + } + else + { + HBRUSH hBrushBackground = bChecked ? NULL : ::GetSysColorBrush(COLOR_MENU); + pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground); + } + } + else + { + // no image - look for custom checked/unchecked bitmaps + CMenuItemInfo info; + info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; + ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); + if(bChecked || info.hbmpUnchecked != NULL) + { + BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); + bHasImage = pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); + } + } + + // draw item text + int cxButn = m_szButton.cx; + COLORREF colorBG = ::GetSysColor(bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); + if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) + { + RECT rcBG = rcItem; + if(bHasImage) + rcBG.left += cxButn + s_kcxGap; + dc.FillRect(&rcBG, bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); + } + + // calc text rectangle and colors + RECT rcText = rcItem; + rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; + rcText.right -= cxButn; + dc.SetBkMode(TRANSPARENT); + COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); + + // font already selected by Windows + if(bDisabled && (!bSelected || colorText == colorBG)) + { + // disabled - draw shadow text shifted down and right 1 pixel (unles selected) + RECT rcDisabled = rcText; + ::OffsetRect(&rcDisabled, 1, 1); + pT->DrawMenuText(dc, rcDisabled, pmd->lpstrText, ::GetSysColor(COLOR_3DHILIGHT)); + } + pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! + } + } + + void DrawItemFlat(LPDRAWITEMSTRUCT lpDrawItemStruct) + { + _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; + CDCHandle dc = lpDrawItemStruct->hDC; + const RECT& rcItem = lpDrawItemStruct->rcItem; + T* pT = static_cast(this); + +#ifndef COLOR_MENUHILIGHT + const int COLOR_MENUHILIGHT = 29; +#endif // !COLOR_MENUHILIGHT + + BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; + BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; + BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; + + // paint background + if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) + { + if(bSelected) + { + dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENUHILIGHT)); + dc.FrameRect(&rcItem, ::GetSysColorBrush(COLOR_HIGHLIGHT)); + } + else + { + dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENU)); + } + } + + if(pmd->fType & MFT_SEPARATOR) + { + // draw separator + RECT rc = rcItem; + rc.top += (rc.bottom - rc.top) / 2; // vertical center + dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line + } + else // not a separator + { + if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) + bSelected = FALSE; + RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect + ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically + + // draw background and border for checked items + if(bChecked) + { + RECT rcCheck = rcButn; + ::InflateRect(&rcCheck, -1, -1); + if(bSelected) + dc.FillRect(&rcCheck, ::GetSysColorBrush(COLOR_MENU)); + dc.FrameRect(&rcCheck, ::GetSysColorBrush(COLOR_HIGHLIGHT)); + } + + int iButton = pmd->iButton; + if(iButton >= 0) + { + // calc drawing point + SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; + sz.cx /= 2; + sz.cy /= 2; + POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; + + // draw disabled or normal + if(!bDisabled) + { + ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); + } + else + { + HBRUSH hBrushBackground = ::GetSysColorBrush((bSelected && !(bDisabled && bChecked)) ? COLOR_MENUHILIGHT : COLOR_MENU); + HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW); + pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground, hBrushBackground, hBrushDisabledImage); + } + } + else + { + // no image - look for custom checked/unchecked bitmaps + CMenuItemInfo info; + info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; + ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); + if(bChecked || info.hbmpUnchecked != NULL) + { + BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); + pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); + } + } + + // draw item text + int cxButn = m_szButton.cx; + // calc text rectangle and colors + RECT rcText = rcItem; + rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; + rcText.right -= cxButn; + dc.SetBkMode(TRANSPARENT); + COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); + + pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! + } + } + + void DrawMenuText(CDCHandle& dc, RECT& rc, LPCTSTR lpstrText, COLORREF color) + { + int nTab = -1; + for(int i = 0; i < lstrlen(lpstrText); i++) + { + if(lpstrText[i] == _T('\t')) + { + nTab = i; + break; + } + } + dc.SetTextColor(color); + dc.DrawText(lpstrText, nTab, &rc, DT_SINGLELINE | DT_LEFT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); + if(nTab != -1) + dc.DrawText(&lpstrText[nTab + 1], -1, &rc, DT_SINGLELINE | DT_RIGHT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); + } + + void DrawBitmapDisabled(CDCHandle& dc, int nImage, POINT point, + HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), + HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), + HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) + { +#if (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) + if(m_bAlphaImages) + { + IMAGELISTDRAWPARAMS ildp = { 0 }; + ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); + ildp.himl = m_hImageList; + ildp.i = nImage; + ildp.hdcDst = dc; + ildp.x = point.x; + ildp.y = point.y; + ildp.cx = 0; + ildp.cy = 0; + ildp.xBitmap = 0; + ildp.yBitmap = 0; + ildp.fStyle = ILD_TRANSPARENT; + ildp.fState = ILS_SATURATE; + ildp.Frame = 0; + ::ImageList_DrawIndirect(&ildp); + } + else +#endif // (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) + { + // create memory DC + CDC dcMem; + dcMem.CreateCompatibleDC(dc); + // create mono or color bitmap + CBitmap bmp; + bmp.CreateCompatibleBitmap(dc, m_szBitmap.cx, m_szBitmap.cy); + ATLASSERT(bmp.m_hBitmap != NULL); + // draw image into memory DC--fill BG white first + HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); + dcMem.PatBlt(0, 0, m_szBitmap.cx, m_szBitmap.cy, WHITENESS); + // If white is the text color, we can't use the normal painting since + // it would blend with the WHITENESS, but the mask is OK + UINT uDrawStyle = (::GetSysColor(COLOR_BTNTEXT) == RGB(255, 255, 255)) ? ILD_MASK : ILD_NORMAL; + ::ImageList_Draw(m_hImageList, nImage, dcMem, 0, 0, uDrawStyle); + dc.DitherBlt(point.x, point.y, m_szBitmap.cx, m_szBitmap.cy, dcMem, NULL, 0, 0, hBrushBackground, hBrush3DEffect, hBrushDisabledImage); + dcMem.SelectBitmap(hBmpOld); // restore + } + } + + // old name + BOOL Draw3DCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) + { + return DrawCheckmark(dc, rc, bSelected, bDisabled, bRadio, hBmpCheck); + } + + BOOL DrawCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) + { + // get checkmark bitmap, if none, use Windows standard + SIZE size = { 0, 0 }; + CBitmapHandle bmp = hBmpCheck; + if(hBmpCheck != NULL) + { + bmp.GetSize(size); + } + else + { + size.cx = ::GetSystemMetrics(SM_CXMENUCHECK); + size.cy = ::GetSystemMetrics(SM_CYMENUCHECK); + bmp.CreateCompatibleBitmap(dc, size.cx, size.cy); + ATLASSERT(bmp.m_hBitmap != NULL); + } + // center bitmap in caller's rectangle + RECT rcDest = rc; + if((rc.right - rc.left) > size.cx) + { + rcDest.left = rc.left + (rc.right - rc.left - size.cx) / 2; + rcDest.right = rcDest.left + size.cx; + } + if((rc.bottom - rc.top) > size.cy) + { + rcDest.top = rc.top + (rc.bottom - rc.top - size.cy) / 2; + rcDest.bottom = rcDest.top + size.cy; + } + // paint background + if(!m_bFlatMenus) + { + if(bSelected && !bDisabled) + { + dc.FillRect(&rcDest, COLOR_MENU); + } + else + { + COLORREF clrTextOld = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); + COLORREF clrBkOld = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); + CBrush hbr(CDCHandle::GetHalftoneBrush()); + dc.SetBrushOrg(rcDest.left, rcDest.top); + dc.FillRect(&rcDest, hbr); + dc.SetTextColor(clrTextOld); + dc.SetBkColor(clrBkOld); + } + } + + // create source image + CDC dcSource; + dcSource.CreateCompatibleDC(dc); + HBITMAP hBmpOld = dcSource.SelectBitmap(bmp); + // set colors + const COLORREF clrBlack = RGB(0, 0, 0); + const COLORREF clrWhite = RGB(255, 255, 255); + COLORREF clrTextOld = dc.SetTextColor(clrBlack); + COLORREF clrBkOld = dc.SetBkColor(clrWhite); + // create mask + CDC dcMask; + dcMask.CreateCompatibleDC(dc); + CBitmap bmpMask; + bmpMask.CreateBitmap(size.cx, size.cy, 1, 1, NULL); + HBITMAP hBmpOld1 = dcMask.SelectBitmap(bmpMask); + + // draw the checkmark transparently + int cx = rcDest.right - rcDest.left; + int cy = rcDest.bottom - rcDest.top; + if(hBmpCheck != NULL) + { + // build mask based on transparent color + dcSource.SetBkColor(m_clrMask); + dcMask.SetBkColor(clrBlack); + dcMask.SetTextColor(clrWhite); + dcMask.BitBlt(0, 0, size.cx, size.cy, dcSource, 0, 0, SRCCOPY); + // draw bitmap using the mask + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, SRCAND); + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); + } + else + { + const DWORD ROP_DSno = 0x00BB0226L; + const DWORD ROP_DSa = 0x008800C6L; + const DWORD ROP_DSo = 0x00EE0086L; + const DWORD ROP_DSna = 0x00220326L; + + // draw mask + RECT rcSource = { 0, 0, min(size.cx, rc.right - rc.left), min(size.cy, rc.bottom - rc.top) }; + dcMask.DrawFrameControl(&rcSource, DFC_MENU, bRadio ? DFCS_MENUBULLET : DFCS_MENUCHECK); + + // draw shadow if disabled + if(!m_bFlatMenus && bDisabled) + { + // offset by one pixel + int x = rcDest.left + 1; + int y = rcDest.top + 1; + // paint source bitmap + const int nColor = COLOR_3DHILIGHT; + dcSource.FillRect(&rcSource, nColor); + // draw checkmark - special case black and white colors + COLORREF clrCheck = ::GetSysColor(nColor); + if(clrCheck == clrWhite) + { + dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSno); + dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSa); + } + else + { + if(clrCheck != clrBlack) + { + ATLASSERT(dcSource.GetTextColor() == clrBlack); + ATLASSERT(dcSource.GetBkColor() == clrWhite); + dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); + } + dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSa); + dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSo); + } + } + + // paint source bitmap + const int nColor = bDisabled ? COLOR_BTNSHADOW : COLOR_MENUTEXT; + dcSource.FillRect(&rcSource, nColor); + // draw checkmark - special case black and white colors + COLORREF clrCheck = ::GetSysColor(nColor); + if(clrCheck == clrWhite) + { + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSno); + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSa); + } + else + { + if(clrCheck != clrBlack) + { + ATLASSERT(dcSource.GetTextColor() == clrBlack); + ATLASSERT(dcSource.GetBkColor() == clrWhite); + dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); + } + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSa); + dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSo); + } + } + // restore all + dc.SetTextColor(clrTextOld); + dc.SetBkColor(clrBkOld); + dcSource.SelectBitmap(hBmpOld); + dcMask.SelectBitmap(hBmpOld1); + if(hBmpCheck == NULL) + bmp.DeleteObject(); + // draw pushed-in hilight + if(!m_bFlatMenus && !bDisabled) + { + if(rc.right - rc.left > size.cx) + ::InflateRect(&rcDest, 1,1); // inflate checkmark by one pixel all around + dc.DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT); + } + + return TRUE; + } + + void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) + { + _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; + + if(pmd->fType & MFT_SEPARATOR) // separator - use half system height and zero width + { + lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU) / 2; + lpMeasureItemStruct->itemWidth = 0; + } + else + { + // compute size of text - use DrawText with DT_CALCRECT + CWindowDC dc(NULL); + CFont fontBold; + HFONT hOldFont = NULL; + if(pmd->fState & MFS_DEFAULT) + { + // need bold version of font + LOGFONT lf = { 0 }; + m_fontMenu.GetLogFont(lf); + lf.lfWeight += 200; + fontBold.CreateFontIndirect(&lf); + ATLASSERT(fontBold.m_hFont != NULL); + hOldFont = dc.SelectFont(fontBold); + } + else + { + hOldFont = dc.SelectFont(m_fontMenu); + } + + RECT rcText = { 0, 0, 0, 0 }; + dc.DrawText(pmd->lpstrText, -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); + int cx = rcText.right - rcText.left; + dc.SelectFont(hOldFont); + + LOGFONT lf = { 0 }; + m_fontMenu.GetLogFont(lf); + int cy = lf.lfHeight; + if(cy < 0) + cy = -cy; + const int cyMargin = 8; + cy += cyMargin; + + // height of item is the bigger of these two + lpMeasureItemStruct->itemHeight = max(cy, (int)m_szButton.cy); + + // width is width of text plus a bunch of stuff + cx += 2 * s_kcxTextMargin; // L/R margin for readability + cx += s_kcxGap; // space between button and menu text + cx += 2 * m_szButton.cx; // button width (L=button; R=empty margin) + cx += m_cxExtraSpacing; // extra between item text and accelerator keys + + // Windows adds 1 to returned value + cx -= ::GetSystemMetrics(SM_CXMENUCHECK) - 1; + lpMeasureItemStruct->itemWidth = cx; // done deal + } + } + +// Implementation - Hook procs + static LRESULT CALLBACK CreateHookProc(int nCode, WPARAM wParam, LPARAM lParam) + { + const int cchClassName = 7; + TCHAR szClassName[cchClassName] = { 0 }; + + if(nCode == HCBT_CREATEWND) + { + HWND hWndMenu = (HWND)wParam; +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_CREATEWND (HWND = %8.8X)\n"), hWndMenu); +#endif + + ::GetClassName(hWndMenu, szClassName, cchClassName); + if(!lstrcmp(_T("#32768"), szClassName)) + s_pCurrentBar->m_stackMenuWnd.Push(hWndMenu); + } + else if(nCode == HCBT_DESTROYWND) + { + HWND hWndMenu = (HWND)wParam; +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_DESTROYWND (HWND = %8.8X)\n"), hWndMenu); +#endif + + ::GetClassName(hWndMenu, szClassName, cchClassName); + if(!lstrcmp(_T("#32768"), szClassName)) + { + ATLASSERT(hWndMenu == s_pCurrentBar->m_stackMenuWnd.GetCurrent()); + s_pCurrentBar->m_stackMenuWnd.Pop(); + } + } + + return ::CallNextHookEx(s_hCreateHook, nCode, wParam, lParam); + } + + static LRESULT CALLBACK MessageHookProc(int nCode, WPARAM wParam, LPARAM lParam) + { + LPMSG pMsg = (LPMSG)lParam; + + if(nCode == HC_ACTION && wParam == PM_REMOVE && pMsg->message != GetGetBarMessage() && pMsg->message != WM_FORWARDMSG) + { + CCommandBarCtrlBase* pCmdBar = NULL; + HWND hWnd = pMsg->hwnd; + DWORD dwPID = 0; + while(pCmdBar == NULL && hWnd != NULL) + { + pCmdBar = (CCommandBarCtrlBase*)::SendMessage(hWnd, GetGetBarMessage(), (WPARAM)&dwPID, 0L); + hWnd = ::GetParent(hWnd); + } + + if(pCmdBar != NULL && dwPID == GetCurrentProcessId()) + { + pCmdBar->m_hWndHook = pMsg->hwnd; + ATLASSERT(pCmdBar->IsCommandBarBase()); + + if(::IsWindow(pCmdBar->m_hWnd)) + pCmdBar->SendMessage(WM_FORWARDMSG, 0, (LPARAM)pMsg); + else + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook skipping message, can't find command bar!\n")); + } + } + + LRESULT lRet = 0; + ATLASSERT(s_pmapMsgHook != NULL); + if(s_pmapMsgHook != NULL) + { + DWORD dwThreadID = ::GetCurrentThreadId(); + _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); + if(pData != NULL) + { + lRet = ::CallNextHookEx(pData->hMsgHook, nCode, wParam, lParam); + } + } + return lRet; + } + +// Implementation + void DoPopupMenu(int nIndex, bool bAnimate) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - DoPopupMenu, bAnimate = %s\n"), bAnimate ? "true" : "false"); +#endif + + // Menu animation flags +#ifndef TPM_VERPOSANIMATION + const UINT TPM_VERPOSANIMATION = 0x1000L; +#endif +#ifndef TPM_NOANIMATION + const UINT TPM_NOANIMATION = 0x4000L; +#endif + T* pT = static_cast(this); + + // get popup menu and it's position + RECT rect = { 0 }; + GetItemRect(nIndex, &rect); + POINT pt = { rect.left, rect.bottom }; + MapWindowPoints(NULL, &pt, 1); + MapWindowPoints(NULL, &rect); + TPMPARAMS TPMParams = { 0 }; + TPMParams.cbSize = sizeof(TPMPARAMS); + TPMParams.rcExclude = rect; + HMENU hMenuPopup = ::GetSubMenu(m_hMenu, nIndex); + ATLASSERT(hMenuPopup != NULL); + + // get button ID + TBBUTTON tbb = { 0 }; + GetButton(nIndex, &tbb); + int nCmdID = tbb.idCommand; + + m_nPopBtn = nIndex; // remember current button's index + + // press button and display popup menu + PressButton(nCmdID, TRUE); + SetHotItem(nCmdID); + pT->DoTrackPopupMenu(hMenuPopup, TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | + (s_bW2K ? (bAnimate ? TPM_VERPOSANIMATION : TPM_NOANIMATION) : 0), pt.x, pt.y, &TPMParams); + PressButton(nCmdID, FALSE); + if(::GetFocus() != m_hWnd) + SetHotItem(-1); + + m_nPopBtn = -1; // restore + + // eat next message if click is on the same button + MSG msg = { 0 }; + if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rect, msg.pt)) + ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); + + // check if another popup menu should be displayed + if(m_nNextPopBtn != -1) + { + PostMessage(GetAutoPopupMessage(), m_nNextPopBtn & 0xFFFF); + if(!(m_nNextPopBtn & 0xFFFF0000) && !m_bPopupItem) + PostMessage(WM_KEYDOWN, VK_DOWN, 0); + m_nNextPopBtn = -1; + } + else + { + m_bContextMenu = false; + // If user didn't hit escape, give focus back + if(!m_bEscapePressed) + { + if(m_bUseKeyboardCues && m_bShowKeyboardCues) + m_bAllowKeyboardCues = false; + pT->GiveFocusBack(); + } + else + { + SetHotItem(nCmdID); + SetAnchorHighlight(TRUE); + } + } + } + + BOOL DoTrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) + { + CMenuHandle menuPopup = hMenu; + + CWindowCreateCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::DoTrackPopupMenu.\n")); + ATLASSERT(FALSE); + return FALSE; + } + + ATLASSERT(s_hCreateHook == NULL); + + s_pCurrentBar = static_cast(this); + + s_hCreateHook = ::SetWindowsHookEx(WH_CBT, CreateHookProc, ModuleHelper::GetModuleInstance(), GetCurrentThreadId()); + ATLASSERT(s_hCreateHook != NULL); + + m_bPopupItem = false; + m_bMenuActive = true; + + BOOL bTrackRet = menuPopup.TrackPopupMenuEx(uFlags, x, y, m_hWnd, lpParams); + m_bMenuActive = false; + + ::UnhookWindowsHookEx(s_hCreateHook); + + s_hCreateHook = NULL; + s_pCurrentBar = NULL; + + lock.Unlock(); + + // cleanup - convert menus back to original state +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - TrackPopupMenu - cleanup\n")); +#endif + + ATLASSERT(m_stackMenuWnd.GetSize() == 0); + + UpdateWindow(); + ATL::CWindow wndTL = GetTopLevelParent(); + wndTL.UpdateWindow(); + + // restore the menu items to the previous state for all menus that were converted + if(m_bImagesVisible) + { + HMENU hMenuSav = NULL; + while((hMenuSav = m_stackMenuHandle.Pop()) != NULL) + { + menuPopup = hMenuSav; + BOOL bRet = FALSE; + // restore state and delete menu item data + for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) + { + CMenuItemInfo mii; + mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID; + bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); + ATLASSERT(bRet); + + _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; + if(pMI != NULL && pMI->IsCmdBarMenuItem()) + { + mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; + mii.fType = pMI->fType; + mii.fState = pMI->fState; + mii.dwTypeData = pMI->lpstrText; + mii.cch = lstrlen(pMI->lpstrText); + mii.dwItemData = NULL; + + bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); + // this one triggers WM_MEASUREITEM + menuPopup.ModifyMenu(i, MF_BYPOSITION | mii.fType | mii.fState, mii.wID, pMI->lpstrText); + ATLASSERT(bRet); + + delete [] pMI->lpstrText; + delete pMI; + } + } + } + } + return bTrackRet; + } + + int GetPreviousMenuItem(int nBtn) const + { + if(nBtn == -1) + return -1; +#if (_WIN32_IE >= 0x0500) + RECT rcClient; + GetClientRect(&rcClient); +#endif // (_WIN32_IE >= 0x0500) + int nNextBtn; + for(nNextBtn = nBtn - 1; nNextBtn != nBtn; nNextBtn--) + { + if(nNextBtn < 0) + nNextBtn = ::GetMenuItemCount(m_hMenu) - 1; + TBBUTTON tbb = { 0 }; + GetButton(nNextBtn, &tbb); +#if (_WIN32_IE >= 0x0500) + RECT rcBtn; + GetItemRect(nNextBtn, &rcBtn); + if(rcBtn.right > rcClient.right) + { + nNextBtn = -2; // chevron + break; + } +#endif // (_WIN32_IE >= 0x0500) + if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) + break; + } + return (nNextBtn != nBtn) ? nNextBtn : -1; + } + + int GetNextMenuItem(int nBtn) const + { + if(nBtn == -1) + return -1; +#if (_WIN32_IE >= 0x0500) + RECT rcClient = { 0 }; + GetClientRect(&rcClient); +#endif // (_WIN32_IE >= 0x0500) + int nNextBtn = 0; + int nCount = ::GetMenuItemCount(m_hMenu); + for(nNextBtn = nBtn + 1; nNextBtn != nBtn; nNextBtn++) + { + if(nNextBtn >= nCount) + nNextBtn = 0; + TBBUTTON tbb = { 0 }; + GetButton(nNextBtn, &tbb); +#if (_WIN32_IE >= 0x0500) + RECT rcBtn = { 0 }; + GetItemRect(nNextBtn, &rcBtn); + if(rcBtn.right > rcClient.right) + { + nNextBtn = -2; // chevron + break; + } +#endif // (_WIN32_IE >= 0x0500) + if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) + break; + } + return (nNextBtn != nBtn) ? nNextBtn : -1; + } + +#if (_WIN32_IE >= 0x0500) + bool DisplayChevronMenu() + { + // assume we are in a rebar + HWND hWndReBar = GetParent(); + int nCount = (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); + bool bRet = false; + for(int i = 0; i < nCount; i++) + { + REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_STYLE }; + BOOL bRetBandInfo = (BOOL)::SendMessage(hWndReBar, RB_GETBANDINFO, i, (LPARAM)&rbbi); + if(bRetBandInfo && rbbi.hwndChild == m_hWnd) + { + if((rbbi.fStyle & RBBS_USECHEVRON) != 0) + { + ::PostMessage(hWndReBar, RB_PUSHCHEVRON, i, 0L); + PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + bRet = true; + } + break; + } + } + return bRet; + } +#endif // (_WIN32_IE >= 0x0500) + + void GetSystemSettings() + { + // refresh our font + NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; + BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); + ATLASSERT(bRet); + if(bRet) + { + LOGFONT logfont = { 0 }; + if(m_fontMenu.m_hFont != NULL) + m_fontMenu.GetLogFont(logfont); + if(logfont.lfHeight != info.lfMenuFont.lfHeight || + logfont.lfWidth != info.lfMenuFont.lfWidth || + logfont.lfEscapement != info.lfMenuFont.lfEscapement || + logfont.lfOrientation != info.lfMenuFont.lfOrientation || + logfont.lfWeight != info.lfMenuFont.lfWeight || + logfont.lfItalic != info.lfMenuFont.lfItalic || + logfont.lfUnderline != info.lfMenuFont.lfUnderline || + logfont.lfStrikeOut != info.lfMenuFont.lfStrikeOut || + logfont.lfCharSet != info.lfMenuFont.lfCharSet || + logfont.lfOutPrecision != info.lfMenuFont.lfOutPrecision || + logfont.lfClipPrecision != info.lfMenuFont.lfClipPrecision || + logfont.lfQuality != info.lfMenuFont.lfQuality || + logfont.lfPitchAndFamily != info.lfMenuFont.lfPitchAndFamily || + lstrcmp(logfont.lfFaceName, info.lfMenuFont.lfFaceName) != 0) + { + HFONT hFontMenu = ::CreateFontIndirect(&info.lfMenuFont); + ATLASSERT(hFontMenu != NULL); + if(hFontMenu != NULL) + { + if(m_fontMenu.m_hFont != NULL) + m_fontMenu.DeleteObject(); + m_fontMenu.Attach(hFontMenu); + SetFont(m_fontMenu); + AddStrings(_T("NS\0")); // for proper item height + AutoSize(); + } + } + } + + // check if we need extra spacing for menu item text + CWindowDC dc(m_hWnd); + HFONT hFontOld = dc.SelectFont(m_fontMenu); + RECT rcText = { 0, 0, 0, 0 }; + dc.DrawText(_T("\t"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); + if((rcText.right - rcText.left) < 4) + { + ::SetRectEmpty(&rcText); + dc.DrawText(_T("x"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); + m_cxExtraSpacing = rcText.right - rcText.left; + } + else + { + m_cxExtraSpacing = 0; + } + dc.SelectFont(hFontOld); + + // get Windows version + OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; + ::GetVersionEx(&ovi); + + // query keyboard cues mode (Windows 2000 or later) + if(ovi.dwMajorVersion >= 5) + { +#ifndef SPI_GETKEYBOARDCUES + const UINT SPI_GETKEYBOARDCUES = 0x100A; +#endif // !SPI_GETKEYBOARDCUES + BOOL bRetVal = TRUE; + bRet = ::SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &bRetVal, 0); + m_bUseKeyboardCues = (bRet && !bRetVal); + m_bAllowKeyboardCues = true; + ShowKeyboardCues(!m_bUseKeyboardCues); + } + + // query flat menu mode (Windows XP or later) + if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) + { +#ifndef SPI_GETFLATMENU + const UINT SPI_GETFLATMENU = 0x1022; +#endif // !SPI_GETFLATMENU + BOOL bRetVal = FALSE; + bRet = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &bRetVal, 0); + m_bFlatMenus = (bRet && bRetVal); + } + +#if _WTL_CMDBAR_VISTA_MENUS + // check if we should use Vista menus + bool bVistaMenus = (RunTimeHelper::IsVista() && RunTimeHelper::IsCommCtrl6() && ((m_dwExtendedStyle & CBR_EX_NOVISTAMENUS) == 0)); + + if(bVistaMenus) + { + HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); + if(hThemeDLL != NULL) + { + typedef BOOL (STDAPICALLTYPE *PFN_IsThemeActive)(); + PFN_IsThemeActive pfnIsThemeActive = (PFN_IsThemeActive)::GetProcAddress(hThemeDLL, "IsThemeActive"); + ATLASSERT(pfnIsThemeActive != NULL); + bVistaMenus = bVistaMenus && (pfnIsThemeActive != NULL) && (pfnIsThemeActive() != FALSE); + + typedef BOOL (STDAPICALLTYPE *PFN_IsAppThemed)(); + PFN_IsAppThemed pfnIsAppThemed = (PFN_IsAppThemed)::GetProcAddress(hThemeDLL, "IsAppThemed"); + ATLASSERT(pfnIsAppThemed != NULL); + bVistaMenus = bVistaMenus && (pfnIsAppThemed != NULL) && (pfnIsAppThemed() != FALSE); + + ::FreeLibrary(hThemeDLL); + } + } + + if(!bVistaMenus && m_bVistaMenus && (m_hMenu != NULL) && (m_arrCommand.GetSize() > 0)) + { + T* pT = static_cast(this); + pT->_RemoveVistaBitmapsFromMenu(); + } + + m_bVistaMenus = bVistaMenus; +#endif // _WTL_CMDBAR_VISTA_MENUS + +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("CmdBar - GetSystemSettings:\n m_bFlatMenus = %s\n m_bUseKeyboardCues = %s m_bVistaMenus = %s\n"), + m_bFlatMenus ? "true" : "false", m_bUseKeyboardCues ? "true" : "false", m_bVistaMenus ? "true" : "false"); +#endif + } + +// Implementation - alternate focus mode support + void TakeFocus() + { + if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_hWndFocus == NULL) + m_hWndFocus = ::GetFocus(); + SetFocus(); + } + + void GiveFocusBack() + { + if(m_bParentActive) + { + if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && ::IsWindow(m_hWndFocus)) + ::SetFocus(m_hWndFocus); + else if(!(m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_wndParent.IsWindow()) + m_wndParent.SetFocus(); + } + m_hWndFocus = NULL; + SetAnchorHighlight(FALSE); + if(m_bUseKeyboardCues && m_bShowKeyboardCues) + ShowKeyboardCues(false); + m_bSkipPostDown = false; + } + + void ShowKeyboardCues(bool bShow) + { + m_bShowKeyboardCues = bShow; + SetDrawTextFlags(DT_HIDEPREFIX, m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX); + Invalidate(); + UpdateWindow(); + } + +// Implementation - internal message helpers + static UINT GetAutoPopupMessage() + { + static UINT uAutoPopupMessage = 0; + if(uAutoPopupMessage == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetAutoPopupMessage.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uAutoPopupMessage == 0) + uAutoPopupMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalAutoPopupMsg")); + + lock.Unlock(); + } + ATLASSERT(uAutoPopupMessage != 0); + return uAutoPopupMessage; + } + + static UINT GetGetBarMessage() + { + static UINT uGetBarMessage = 0; + if(uGetBarMessage == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetGetBarMessage.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uGetBarMessage == 0) + uGetBarMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalGetBarMsg")); + + lock.Unlock(); + } + ATLASSERT(uGetBarMessage != 0); + return uGetBarMessage; + } + +// Implementation + bool CreateInternalImageList(int cImages) + { + UINT uFlags = (m_bAlphaImages ? ILC_COLOR32 : ILC_COLOR24) | ILC_MASK; + m_hImageList = ::ImageList_Create(m_szBitmap.cx, m_szBitmap.cy, uFlags, cImages, 1); + ATLASSERT(m_hImageList != NULL); + return (m_hImageList != NULL); + } + +// Implementation - support for Vista menus +#if _WTL_CMDBAR_VISTA_MENUS + void _AddVistaBitmapsFromImageList(int nStartIndex, int nCount) + { + // Create display compatible memory DC + HDC hDC = ::GetDC(NULL); + CDC dcMem; + dcMem.CreateCompatibleDC(hDC); + HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); + + T* pT = static_cast(this); + // Create bitmaps for all menu items + for(int i = 0; i < nCount; i++) + { + HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nStartIndex + i, hDC, dcMem); + dcMem.SelectBitmap(hBitmapSave); + m_arrVistaBitmap.Add(hBitmap); + } + } + + void _AddVistaBitmapFromImageList(int nIndex) + { + // Create display compatible memory DC + HDC hDC = ::GetDC(NULL); + CDC dcMem; + dcMem.CreateCompatibleDC(hDC); + HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); + + // Create bitmap for menu item + T* pT = static_cast(this); + HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, hDC, dcMem); + + // Select saved bitmap back and add bitmap to the array + dcMem.SelectBitmap(hBitmapSave); + m_arrVistaBitmap.Add(hBitmap); + } + + void _ReplaceVistaBitmapFromImageList(int nIndex) + { + // Delete existing bitmap + if(m_arrVistaBitmap[nIndex] != NULL) + ::DeleteObject(m_arrVistaBitmap[nIndex]); + + // Create display compatible memory DC + HDC hDC = ::GetDC(NULL); + CDC dcMem; + dcMem.CreateCompatibleDC(hDC); + HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); + + // Create bitmap for menu item + T* pT = static_cast(this); + HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, hDC, dcMem); + + // Select saved bitmap back and replace bitmap in the array + dcMem.SelectBitmap(hBitmapSave); + m_arrVistaBitmap.SetAtIndex(nIndex, hBitmap); + } + + HBITMAP _CreateVistaBitmapHelper(int nIndex, HDC hDCSource, HDC hDCTarget) + { + // Create 32-bit bitmap + BITMAPINFO bi = { 0 }; + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bi.bmiHeader.biWidth = m_szBitmap.cx; + bi.bmiHeader.biHeight = m_szBitmap.cy; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = 0; + bi.bmiHeader.biXPelsPerMeter = 0; + bi.bmiHeader.biYPelsPerMeter = 0; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + HBITMAP hBitmap = ::CreateDIBSection(hDCSource, &bi, DIB_RGB_COLORS, NULL, NULL, 0); + ATLASSERT(hBitmap != NULL); + + // Select bitmap into target DC and draw from image list to it + if(hBitmap != NULL) + { + ::SelectObject(hDCTarget, hBitmap); + + IMAGELISTDRAWPARAMS ildp = { 0 }; + ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); + ildp.himl = m_hImageList; + ildp.i = nIndex; + ildp.hdcDst = hDCTarget; + ildp.x = 0; + ildp.y = 0; + ildp.cx = 0; + ildp.cy = 0; + ildp.xBitmap = 0; + ildp.yBitmap = 0; + ildp.fStyle = ILD_TRANSPARENT; + ildp.fState = ILS_ALPHA; + ildp.Frame = 255; + ::ImageList_DrawIndirect(&ildp); + } + + return hBitmap; + } + + void _RemoveVistaBitmapsFromMenu() + { + CMenuHandle menu = m_hMenu; + for(int i = 0; i < m_arrCommand.GetSize(); i++) + { + CMenuItemInfo mii; + mii.fMask = MIIM_BITMAP; + mii.hbmpItem = NULL; + menu.SetMenuItemInfo(m_arrCommand[i], FALSE, &mii); + } + } +#endif // _WTL_CMDBAR_VISTA_MENUS +}; + + +class CCommandBarCtrl : public CCommandBarCtrlImpl +{ +public: + DECLARE_WND_SUPERCLASS(_T("WTL_CommandBar"), GetWndClassName()) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CMDICommandBarCtrl - ATL implementation of Command Bars for MDI apps + +template +class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBase, TWinTraits> +{ +public: +// Data members + ATL::CContainedWindow m_wndMDIClient; + bool m_bChildMaximized; + HWND m_hWndChildMaximized; + HICON m_hIconChildMaximized; + int m_nBtnPressed; + int m_nBtnWasPressed; + + int m_cxyOffset; // offset between nonclient elements + int m_cxIconWidth; // small icon width + int m_cyIconHeight; // small icon height + int m_cxBtnWidth; // nonclient button width + int m_cyBtnHeight; // nonclient button height + int m_cxLeft; // left nonclient area width + int m_cxRight; // right nonclient area width + +// Theme declarations and data members +#ifndef _WTL_NO_AUTO_THEME +#ifndef _UXTHEME_H_ + typedef HANDLE HTHEME; +#endif // !_UXTHEME_H_ + typedef HTHEME (STDAPICALLTYPE *PFN_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList); + typedef HRESULT (STDAPICALLTYPE *PFN_CloseThemeData)(HTHEME hTheme); + typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); + typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeParentBackground)(HWND hwnd, HDC hdc, OPTIONAL RECT* prc); + + HMODULE m_hThemeDLL; + HTHEME m_hTheme; + PFN_DrawThemeBackground m_pfnDrawThemeBackground; + PFN_DrawThemeParentBackground m_pfnDrawThemeParentBackground; +#endif // !_WTL_NO_AUTO_THEME + +// Constructor/destructor + CMDICommandBarCtrlImpl() : + m_wndMDIClient(this, 2), m_bChildMaximized(false), + m_hWndChildMaximized(NULL), m_hIconChildMaximized(NULL), + m_nBtnPressed(-1), m_nBtnWasPressed(-1), +#ifndef _WTL_NO_AUTO_THEME + m_hThemeDLL(NULL), m_hTheme(NULL), m_pfnDrawThemeBackground(NULL), m_pfnDrawThemeParentBackground(NULL), +#endif // !_WTL_NO_AUTO_THEME + m_cxyOffset(2), + m_cxIconWidth(16), m_cyIconHeight(16), + m_cxBtnWidth(16), m_cyBtnHeight(14), + m_cxLeft(20), m_cxRight(55) + { } + + ~CMDICommandBarCtrlImpl() + { + if(m_wndMDIClient.IsWindow()) +/*scary!*/ m_wndMDIClient.UnsubclassWindow(); + } + +// Operations + BOOL SetMDIClient(HWND hWndMDIClient) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(hWndMDIClient)); + if(!::IsWindow(hWndMDIClient)) + return FALSE; + +#ifdef _DEBUG + // BLOCK: Test if the passed window is MDICLIENT + { + LPCTSTR lpszMDIClientClass = _T("MDICLIENT"); + const int nNameLen = 9 + 1; // "MDICLIENT" + NULL + TCHAR szClassName[nNameLen] = { 0 }; + ::GetClassName(hWndMDIClient, szClassName, nNameLen); + ATLASSERT(lstrcmpi(szClassName, lpszMDIClientClass) == 0); + } +#endif // _DEBUG + + if(m_wndMDIClient.IsWindow()) +/*scary!*/ m_wndMDIClient.UnsubclassWindow(); + + return m_wndMDIClient.SubclassWindow(hWndMDIClient); + } + +// Message maps + typedef CCommandBarCtrlImpl< T, TBase, TWinTraits > _baseClass; + BEGIN_MSG_MAP(CMDICommandBarCtrlImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) +#ifndef _WTL_NO_AUTO_THEME + MESSAGE_HANDLER(_GetThemeChangedMsg(), OnThemeChanged) +#endif // !_WTL_NO_AUTO_THEME + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_NCCALCSIZE, OnNcCalcSize) + MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) + MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) + MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) + MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk) + MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) + CHAIN_MSG_MAP(_baseClass) + ALT_MSG_MAP(1) // Parent window messages + MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) + CHAIN_MSG_MAP_ALT(_baseClass, 1) + ALT_MSG_MAP(2) // MDI client window messages + MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) + // no chaining needed since this was moved from the base class here + ALT_MSG_MAP(3) // Message hook messages + MESSAGE_RANGE_HANDLER(0, 0xFFFF, OnAllHookMessages) + CHAIN_MSG_MAP_ALT(_baseClass, 3) + END_MSG_MAP() + +// Additional MDI message handlers + LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + LRESULT lRet = _baseClass::OnCreate(uMsg, wParam, lParam, bHandled); + if(lRet == (LRESULT)-1) + return lRet; + +#ifndef _WTL_NO_AUTO_THEME + // this will fail if theming is not supported + m_hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); + if(m_hThemeDLL != NULL) + { + m_pfnDrawThemeBackground = (PFN_DrawThemeBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeBackground"); + ATLASSERT(m_pfnDrawThemeBackground != NULL); + if(m_pfnDrawThemeBackground != NULL) + { + T* pT = static_cast(this); + pT->_OpenThemeData(); + } + else + { + ::FreeLibrary(m_hThemeDLL); + m_hThemeDLL = NULL; + } + m_pfnDrawThemeParentBackground = (PFN_DrawThemeParentBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeParentBackground"); + ATLASSERT(m_pfnDrawThemeParentBackground != NULL); + } +#endif // !_WTL_NO_AUTO_THEME + + return lRet; + } + + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + LRESULT lRet = _baseClass::OnDestroy(uMsg, wParam, lParam, bHandled); + +#ifndef _WTL_NO_AUTO_THEME + if(m_hThemeDLL != NULL) + { + T* pT = static_cast(this); + pT->_CloseThemeData(); + ::FreeLibrary(m_hThemeDLL); + m_hThemeDLL = NULL; + } +#endif // !_WTL_NO_AUTO_THEME + + return lRet; + } + +#ifndef _WTL_NO_AUTO_THEME + LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(m_hThemeDLL != NULL) + { + T* pT = static_cast(this); + pT->_CloseThemeData(); + pT->_OpenThemeData(); + } + return 0; + } +#endif // !_WTL_NO_AUTO_THEME + + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + T* pT = static_cast(this); + pT->_AdjustBtnSize(GET_Y_LPARAM(lParam)); + return lRet; + } + + LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + + if(m_bChildMaximized && (BOOL)wParam) + { + LPNCCALCSIZE_PARAMS lpParams = (LPNCCALCSIZE_PARAMS)lParam; + if(m_bLayoutRTL) + { + lpParams->rgrc[0].left += m_cxRight; + lpParams->rgrc[0].right -= m_cxLeft; + } + else + { + lpParams->rgrc[0].left += m_cxLeft; + lpParams->rgrc[0].right -= m_cxRight; + } + } + + return lRet; + } + + LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + + if(!m_bChildMaximized) + return lRet; + + ATLASSERT(m_hWndChildMaximized != NULL && m_hIconChildMaximized != NULL); + + // get DC and window rectangle + CWindowDC dc(m_hWnd); + RECT rect; + GetWindowRect(&rect); + int cxWidth = rect.right - rect.left; + int cyHeight = rect.bottom - rect.top; + + // paint left side nonclient background and draw icon + ::SetRect(&rect, 0, 0, m_cxLeft, cyHeight); +#ifndef _WTL_NO_AUTO_THEME + if(m_hTheme != NULL) + { + if(m_pfnDrawThemeParentBackground != NULL) + m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); + else + dc.FillRect(&rect, COLOR_WINDOW); + } + else +#endif // !_WTL_NO_AUTO_THEME + { + if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) + dc.FillRect(&rect, COLOR_3DFACE); + else + dc.FillRect(&rect, COLOR_MENU); + } + + RECT rcIcon = { 0 }; + T* pT = static_cast(this); + pT->_CalcIconRect(cxWidth, cyHeight, rcIcon); + dc.DrawIconEx(rcIcon.left, rcIcon.top, m_hIconChildMaximized, m_cxIconWidth, m_cyIconHeight); + + // paint right side nonclient background + ::SetRect(&rect, cxWidth - m_cxRight, 0, cxWidth, cyHeight); +#ifndef _WTL_NO_AUTO_THEME + if(m_hTheme != NULL) + { + if(m_pfnDrawThemeParentBackground != NULL) + { + // this is to account for the left non-client area + POINT ptOrg = { 0, 0 }; + dc.GetViewportOrg(&ptOrg); + dc.SetViewportOrg(ptOrg.x + m_cxLeft, ptOrg.y); + ::OffsetRect(&rect, -m_cxLeft, 0); + + m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); + + // restore + dc.SetViewportOrg(ptOrg); + ::OffsetRect(&rect, m_cxLeft, 0); + } + else + { + dc.FillRect(&rect, COLOR_3DFACE); + } + } + else +#endif // !_WTL_NO_AUTO_THEME + { + if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) + dc.FillRect(&rect, COLOR_3DFACE); + else + dc.FillRect(&rect, COLOR_MENU); + } + + // draw buttons + RECT arrRect[3] = { 0 }; + pT->_CalcBtnRects(cxWidth, cyHeight, arrRect); + pT->_DrawMDIButton(dc, arrRect, -1); // draw all buttons + + return lRet; + } + + LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + if(m_bChildMaximized) + { + RECT rect = { 0 }; + GetWindowRect(&rect); + POINT pt = { GET_X_LPARAM(lParam) - rect.left, GET_Y_LPARAM(lParam) - rect.top }; + if(m_bLayoutRTL) + { + if((pt.x < m_cxRight) || (pt.x > ((rect.right - rect.left) - m_cxLeft))) + lRet = HTBORDER; + } + else + { + if((pt.x < m_cxLeft) || (pt.x > ((rect.right - rect.left) - m_cxRight))) + lRet = HTBORDER; + } + } + return lRet; + } + + LRESULT OnNcLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(!m_bChildMaximized) + { + bHandled = FALSE; + return 1; + } + + ATLASSERT(_DebugCheckChild()); + + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + RECT rect = { 0 }; + GetWindowRect(&rect); + pt.x -= rect.left; + pt.y -= rect.top; + + RECT rcIcon = { 0 }; + T* pT = static_cast(this); + pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); + RECT arrRect[3] = { 0 }; + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + + if(::PtInRect(&rcIcon, pt)) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: icon\n")); +#endif +#ifndef TPM_VERPOSANIMATION + const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag +#endif + CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); + UINT uRet = (UINT)menu.TrackPopupMenu(TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | + (s_bW2K ? TPM_VERPOSANIMATION : 0), m_bLayoutRTL ? rect.right : rect.left, rect.bottom, m_hWndChildMaximized); + + // eat next message if click is on the same button + ::OffsetRect(&rcIcon, rect.left, rect.top); + MSG msg = { 0 }; + if(::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rcIcon, msg.pt)) + ::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_REMOVE); + + if(uRet != 0) + ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uRet, 0L); + } + else if(::PtInRect(&arrRect[0], pt)) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: close button\n")); +#endif + m_nBtnWasPressed = m_nBtnPressed = 0; + } + else if(::PtInRect(&arrRect[1], pt)) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: restore button\n")); +#endif + m_nBtnWasPressed = m_nBtnPressed = 1; + } + else if(::PtInRect(&arrRect[2], pt)) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: minimize button\n")); +#endif + m_nBtnWasPressed = m_nBtnPressed = 2; + } + else + { + bHandled = FALSE; + } + + // draw the button state if it was pressed + if(m_nBtnPressed != -1) + { + SetCapture(); + CWindowDC dc(m_hWnd); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); + pT->_DrawMDIButton(dc, arrRect, m_nBtnPressed); + } + + return 0; + } + + LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) + { + bHandled = FALSE; + return 1; + } + + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + ClientToScreen(&pt); + RECT rect = { 0 }; + GetWindowRect(&rect); + pt.x -= rect.left; + pt.y -= rect.top; + RECT arrRect[3] = { 0 }; + T* pT = static_cast(this); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + int nOldBtnPressed = m_nBtnPressed; + m_nBtnPressed = ::PtInRect(&arrRect[m_nBtnWasPressed], pt) ? m_nBtnWasPressed : -1; + if(nOldBtnPressed != m_nBtnPressed) + { + CWindowDC dc(m_hWnd); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); + pT->_DrawMDIButton(dc, arrRect, (m_nBtnPressed != -1) ? m_nBtnPressed : nOldBtnPressed); + } + + return 0; + } + + LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) + { + bHandled = FALSE; + return 1; + } + + ATLASSERT(_DebugCheckChild()); + + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + ClientToScreen(&pt); + RECT rect = { 0 }; + GetWindowRect(&rect); + pt.x -= rect.left; + pt.y -= rect.top; + + int nBtn = m_nBtnWasPressed; + ReleaseCapture(); + + RECT arrRect[3] = { 0 }; + T* pT = static_cast(this); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + if(::PtInRect(&arrRect[nBtn], pt)) + { + switch(nBtn) + { + case 0: // close +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: close button\n")); +#endif + ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_CLOSE, 0L); + break; + case 1: // restore +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: restore button\n")); +#endif + ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_RESTORE, 0L); + break; + case 2: // minimize +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: minimize button\n")); +#endif + ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_MINIMIZE, 0L); + break; + default: + break; + } + } + + return 0; + } + + LRESULT OnNcLButtonDblClk(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(!m_bChildMaximized || m_nBtnWasPressed != -1) + { + bHandled = FALSE; + return 1; + } + + ATLASSERT(_DebugCheckChild()); + + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + RECT rect = { 0 }; + GetWindowRect(&rect); + pt.x -= rect.left; + pt.y -= rect.top; + + RECT rcIcon = { 0 }; + T* pT = static_cast(this); + pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); + RECT arrRect[3] = { 0 }; + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + + if(::PtInRect(&rcIcon, pt)) + { + CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); + UINT uDefID = menu.GetMenuDefaultItem(); + if(uDefID == (UINT)-1) + uDefID = SC_CLOSE; + ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uDefID, 0L); + } + + return 0; + } + + LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_bChildMaximized) + { + if(m_nBtnPressed != -1) + { + ATLASSERT(m_nBtnPressed == m_nBtnWasPressed); // must be + m_nBtnPressed = -1; + RECT rect = { 0 }; + GetWindowRect(&rect); + RECT arrRect[3] = { 0 }; + T* pT = static_cast(this); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); + CWindowDC dc(m_hWnd); + pT->_DrawMDIButton(dc, arrRect, m_nBtnWasPressed); + } + m_nBtnWasPressed = -1; + } + else + { + bHandled = FALSE; + } + return 0; + } + +// Parent window message handlers + LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); + RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + bHandled = FALSE; + return 1; + } + +// MDI client window message handlers + LRESULT OnMDISetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + m_wndMDIClient.DefWindowProc(uMsg, NULL, lParam); + HMENU hOldMenu = GetMenu(); + BOOL bRet = AttachMenu((HMENU)wParam); + bRet; // avoid level 4 warning + ATLASSERT(bRet); + +#if (_WIN32_IE >= 0x0400) + T* pT = static_cast(this); + pT->UpdateRebarBandIdealSize(); +#endif // (_WIN32_IE >= 0x0400) + + return (LRESULT)hOldMenu; + } + +// All messages from the message hook + LRESULT OnAllHookMessages(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->_ProcessAllHookMessages(uMsg, wParam, lParam); + + bHandled = FALSE; + return 1; + } + +// Overrideables + // override this to provide different ideal size + void UpdateRebarBandIdealSize() + { + // assuming we are in a rebar, change ideal size to our size + // we hope that if we are not in a rebar, nCount will be 0 + int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); + for(int i = 0; i < nCount; i++) + { + REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; + ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); + if(rbi.hwndChild == m_hWnd) + { + rbi.fMask = RBBIM_IDEALSIZE; + rbi.cxIdeal = m_bChildMaximized ? m_cxLeft + m_cxRight : 0; + int nBtnCount = GetButtonCount(); + if(nBtnCount > 0) + { + RECT rect = { 0 }; + GetItemRect(nBtnCount - 1, &rect); + rbi.cxIdeal += rect.right; + } + ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); + break; + } + } + } + + // all hook messages - check for the maximized MDI child window change + void _ProcessAllHookMessages(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/) + { + if(uMsg == WM_MDIGETACTIVE || uMsg == WM_MDISETMENU) + return; + + BOOL bMaximized = FALSE; + HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); + bool bMaxOld = m_bChildMaximized; + m_bChildMaximized = (hWndChild != NULL && bMaximized); + HICON hIconOld = m_hIconChildMaximized; + + if(m_bChildMaximized) + { + if(m_hWndChildMaximized != hWndChild) + { + ATL::CWindow wnd = m_hWndChildMaximized = hWndChild; + m_hIconChildMaximized = wnd.GetIcon(FALSE); + if(m_hIconChildMaximized == NULL) + { + m_hIconChildMaximized = wnd.GetIcon(TRUE); + if(m_hIconChildMaximized == NULL) + { + // no icon set with WM_SETICON, get the class one +// need conditional code because types don't match in winuser.h +#ifdef _WIN64 + m_hIconChildMaximized = (HICON)::GetClassLongPtr(wnd, GCLP_HICONSM); +#else + m_hIconChildMaximized = (HICON)LongToHandle(::GetClassLongPtr(wnd, GCLP_HICONSM)); +#endif + } + } + } + } + else + { + m_hWndChildMaximized = NULL; + m_hIconChildMaximized = NULL; + } + + if(bMaxOld != m_bChildMaximized) + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - All messages hook change: m_bChildMaximized = %s\n"), m_bChildMaximized ? "true" : "false"); +#endif + // assuming we are in a rebar, change our size to accomodate new state + // we hope that if we are not in a rebar, nCount will be 0 + int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); + int cxDiff = (m_bChildMaximized ? 1 : -1) * (m_cxLeft + m_cxRight); + for(int i = 0; i < nCount; i++) + { +#if (_WIN32_IE >= 0x0500) + REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_STYLE }; + ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); + if(rbi.hwndChild == m_hWnd) + { + if((rbi.fStyle & RBBS_USECHEVRON) != 0) + { + rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; + rbi.cxMinChild += cxDiff; + rbi.cxIdeal += cxDiff; + ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); + } + break; + } +#elif (_WIN32_IE >= 0x0400) + REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; + ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); + if(rbi.hwndChild == m_hWnd) + { + rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; + rbi.cxMinChild += cxDiff; + rbi.cxIdeal += cxDiff; + ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); + break; + } +#else // (_WIN32_IE < 0x0400) + REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE }; + ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); + if(rbi.hwndChild == m_hWnd) + { + rbi.fMask = RBBIM_CHILDSIZE; + rbi.cxMinChild += cxDiff; + ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); + break; + } +#endif // (_WIN32_IE < 0x0400) + } + } + + if(bMaxOld != m_bChildMaximized || hIconOld != m_hIconChildMaximized) + { + // force size change and redraw everything + RECT rect = { 0 }; + GetWindowRect(&rect); + ::MapWindowPoints(NULL, GetParent(), (LPPOINT)&rect, 2); + SetRedraw(FALSE); + SetWindowPos(NULL, 0, 0, 1, 1, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); + SetRedraw(TRUE); + RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); + } + } + +// Implementation + void GetSystemSettings() + { +#ifdef _CMDBAR_EXTRA_TRACE + ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - GetSystemSettings\n")); +#endif + _baseClass::GetSystemSettings(); + + NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; + BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); + ATLASSERT(bRet); + if(bRet) + { + m_cxIconWidth = ::GetSystemMetrics(SM_CXSMICON); + m_cyIconHeight = ::GetSystemMetrics(SM_CYSMICON); + m_cxLeft = m_cxIconWidth; + +#ifndef _WTL_NO_AUTO_THEME + if(m_hTheme != NULL) + { + m_cxBtnWidth = info.iCaptionWidth - 2 * m_cxyOffset; + m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; + m_cxRight = 3 * m_cxBtnWidth; + } + else +#endif // !_WTL_NO_AUTO_THEME + { + m_cxBtnWidth = info.iCaptionWidth - m_cxyOffset; + m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; + m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; + } + } + + RECT rect = { 0 }; + GetClientRect(&rect); + T* pT = static_cast(this); + pT->_AdjustBtnSize(rect.bottom); + } + + void _AdjustBtnSize(int cyHeight) + { + if(cyHeight > 1 && m_cyBtnHeight > cyHeight) + { +#ifndef _WTL_NO_AUTO_THEME + if(m_hTheme != NULL) + { + m_cyBtnHeight = cyHeight; + m_cxBtnWidth = cyHeight; + m_cxRight = 3 * m_cxBtnWidth; + } + else +#endif // !_WTL_NO_AUTO_THEME + { + m_cyBtnHeight = cyHeight; + m_cxBtnWidth = cyHeight + m_cxyOffset; + m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; + } + } + } + + void _CalcIconRect(int cxWidth, int cyHeight, RECT& rect, bool bInvertX = false) const + { + int xStart = (m_cxLeft - m_cxIconWidth) / 2; + if(xStart < 0) + xStart = 0; + int yStart = (cyHeight - m_cyIconHeight) / 2; + if(yStart < 0) + yStart = 0; + + if(bInvertX) + ::SetRect(&rect, cxWidth - (xStart + m_cxBtnWidth), yStart, cxWidth - xStart, yStart + m_cyBtnHeight); + else + ::SetRect(&rect, xStart, yStart, xStart + m_cxBtnWidth, yStart + m_cyBtnHeight); + } + + void _CalcBtnRects(int cxWidth, int cyHeight, RECT arrRect[3], bool bInvertX = false) const + { + int yStart = (cyHeight - m_cyBtnHeight) / 2; + if(yStart < 0) + yStart = 0; + + RECT rcBtn = { cxWidth - m_cxBtnWidth, yStart, cxWidth, yStart + m_cyBtnHeight }; + int nDirection = -1; + if(bInvertX) + { + ::SetRect(&rcBtn, 0, yStart, m_cxBtnWidth, yStart + m_cyBtnHeight); + nDirection = 1; + } + + arrRect[0] = rcBtn; +#ifndef _WTL_NO_AUTO_THEME + if(m_hTheme != NULL) + ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); + else +#endif // !_WTL_NO_AUTO_THEME + ::OffsetRect(&rcBtn, nDirection * (m_cxBtnWidth + m_cxyOffset), 0); + arrRect[1] = rcBtn; + ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); + arrRect[2] = rcBtn; + } + + void _DrawMDIButton(CWindowDC& dc, LPRECT pRects, int nBtn) + { +#ifndef _WTL_NO_AUTO_THEME + if(m_hTheme != NULL) + { +#ifndef TMSCHEMA_H + const int WP_MDICLOSEBUTTON = 20; + const int CBS_NORMAL = 1; + const int CBS_PUSHED = 3; + const int CBS_DISABLED = 4; + const int WP_MDIRESTOREBUTTON = 22; + const int RBS_NORMAL = 1; + const int RBS_PUSHED = 3; + const int RBS_DISABLED = 4; + const int WP_MDIMINBUTTON = 16; + const int MINBS_NORMAL = 1; + const int MINBS_PUSHED = 3; + const int MINBS_DISABLED = 4; +#endif // TMSCHEMA_H + if(nBtn == -1 || nBtn == 0) + m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDICLOSEBUTTON, m_bParentActive ? ((m_nBtnPressed == 0) ? CBS_PUSHED : CBS_NORMAL) : CBS_DISABLED, &pRects[0], NULL); + if(nBtn == -1 || nBtn == 1) + m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIRESTOREBUTTON, m_bParentActive ? ((m_nBtnPressed == 1) ? RBS_PUSHED : RBS_NORMAL) : RBS_DISABLED, &pRects[1], NULL); + if(nBtn == -1 || nBtn == 2) + m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIMINBUTTON, m_bParentActive ? ((m_nBtnPressed == 2) ? MINBS_PUSHED : MINBS_NORMAL) : MINBS_DISABLED, &pRects[2], NULL); + } + else +#endif // !_WTL_NO_AUTO_THEME + { + if(nBtn == -1 || nBtn == 0) + dc.DrawFrameControl(&pRects[0], DFC_CAPTION, DFCS_CAPTIONCLOSE | ((m_nBtnPressed == 0) ? DFCS_PUSHED : 0)); + if(nBtn == -1 || nBtn == 1) + dc.DrawFrameControl(&pRects[1], DFC_CAPTION, DFCS_CAPTIONRESTORE | ((m_nBtnPressed == 1) ? DFCS_PUSHED : 0)); + if(nBtn == -1 || nBtn == 2) + dc.DrawFrameControl(&pRects[2], DFC_CAPTION, DFCS_CAPTIONMIN | ((m_nBtnPressed == 2) ? DFCS_PUSHED : 0)); + } + } + +#ifndef _WTL_NO_AUTO_THEME + static UINT _GetThemeChangedMsg() + { +#ifndef WM_THEMECHANGED + static const UINT WM_THEMECHANGED = 0x031A; +#endif // !WM_THEMECHANGED + return WM_THEMECHANGED; + } + + void _OpenThemeData() + { + ATLASSERT(m_hThemeDLL != NULL); + + PFN_OpenThemeData pfnOpenThemeData = (PFN_OpenThemeData)::GetProcAddress(m_hThemeDLL, "OpenThemeData"); + ATLASSERT(pfnOpenThemeData != NULL); + if(pfnOpenThemeData != NULL) + m_hTheme = pfnOpenThemeData(m_hWnd, L"Window"); + } + + void _CloseThemeData() + { + ATLASSERT(m_hThemeDLL != NULL); + + if(m_hTheme == NULL) + return; // nothing to do + + PFN_CloseThemeData pfnCloseThemeData = (PFN_CloseThemeData)::GetProcAddress(m_hThemeDLL, "CloseThemeData"); + ATLASSERT(pfnCloseThemeData != NULL); + if(pfnCloseThemeData != NULL) + { + pfnCloseThemeData(m_hTheme); + m_hTheme = NULL; + } + } +#endif // !_WTL_NO_AUTO_THEME + + bool _DebugCheckChild() + { +#ifdef _DEBUG + BOOL bMaximized = FALSE; + HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); + return (bMaximized && hWndChild == m_hWndChildMaximized); +#else // !_DEBUG + return true; +#endif // !_DEBUG + } +}; + +class CMDICommandBarCtrl : public CMDICommandBarCtrlImpl +{ +public: + DECLARE_WND_SUPERCLASS(_T("WTL_MDICommandBar"), GetWndClassName()) +}; + +}; // namespace WTL + +#endif // __ATLCTRLW_H__ diff --git a/Externals/WTL80/atlctrlx.h b/Externals/WTL80/atlctrlx.h index bd78e3f958..8d62f56fe5 100644 --- a/Externals/WTL80/atlctrlx.h +++ b/Externals/WTL80/atlctrlx.h @@ -1,4827 +1,4827 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLCTRLX_H__ -#define __ATLCTRLX_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlctrlx.h requires atlapp.h to be included first -#endif - -#ifndef __ATLCTRLS_H__ - #error atlctrlx.h requires atlctrls.h to be included first -#endif - -#ifndef WM_UPDATEUISTATE - #define WM_UPDATEUISTATE 0x0128 -#endif // !WM_UPDATEUISTATE - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CBitmapButtonImpl -// CBitmapButton -// CCheckListViewCtrlImpl -// CCheckListViewCtrl -// CHyperLinkImpl -// CHyperLink -// CWaitCursor -// CCustomWaitCursor -// CMultiPaneStatusBarCtrlImpl -// CMultiPaneStatusBarCtrl -// CPaneContainerImpl -// CPaneContainer -// CSortListViewImpl -// CSortListViewCtrlImpl -// CSortListViewCtrl -// CTabViewImpl -// CTabView - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CBitmapButton - bitmap button implementation - -#ifndef _WIN32_WCE - -// bitmap button extended styles -#define BMPBTN_HOVER 0x00000001 -#define BMPBTN_AUTO3D_SINGLE 0x00000002 -#define BMPBTN_AUTO3D_DOUBLE 0x00000004 -#define BMPBTN_AUTOSIZE 0x00000008 -#define BMPBTN_SHAREIMAGELISTS 0x00000010 -#define BMPBTN_AUTOFIRE 0x00000020 - -template -class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinTraits> -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - - enum - { - _nImageNormal = 0, - _nImagePushed, - _nImageFocusOrHover, - _nImageDisabled, - - _nImageCount = 4, - }; - - enum - { - ID_TIMER_FIRST = 1000, - ID_TIMER_REPEAT = 1001 - }; - - // Bitmap button specific extended styles - DWORD m_dwExtendedStyle; - - CImageList m_ImageList; - int m_nImage[_nImageCount]; - - CToolTipCtrl m_tip; - LPTSTR m_lpstrToolTipText; - - // Internal states - unsigned m_fMouseOver:1; - unsigned m_fFocus:1; - unsigned m_fPressed:1; - - -// Constructor/Destructor - CBitmapButtonImpl(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : - m_ImageList(hImageList), m_dwExtendedStyle(dwExtendedStyle), - m_lpstrToolTipText(NULL), - m_fMouseOver(0), m_fFocus(0), m_fPressed(0) - { - m_nImage[_nImageNormal] = -1; - m_nImage[_nImagePushed] = -1; - m_nImage[_nImageFocusOrHover] = -1; - m_nImage[_nImageDisabled] = -1; - } - - ~CBitmapButtonImpl() - { - if((m_dwExtendedStyle & BMPBTN_SHAREIMAGELISTS) == 0) - m_ImageList.Destroy(); - delete [] m_lpstrToolTipText; - } - - // overridden to provide proper initialization - BOOL SubclassWindow(HWND hWnd) - { -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - Init(); - return bRet; - } - -// Attributes - DWORD GetBitmapButtonExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetBitmapButtonExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - HIMAGELIST GetImageList() const - { - return m_ImageList; - } - - HIMAGELIST SetImageList(HIMAGELIST hImageList) - { - HIMAGELIST hImageListPrev = m_ImageList; - m_ImageList = hImageList; - if((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0 && ::IsWindow(m_hWnd)) - SizeToImage(); - return hImageListPrev; - } - - int GetToolTipTextLength() const - { - return (m_lpstrToolTipText == NULL) ? -1 : lstrlen(m_lpstrToolTipText); - } - - bool GetToolTipText(LPTSTR lpstrText, int nLength) const - { - ATLASSERT(lpstrText != NULL); - if(m_lpstrToolTipText == NULL) - return false; - - errno_t nRet = SecureHelper::strncpy_x(lpstrText, nLength, m_lpstrToolTipText, _TRUNCATE); - - return (nRet == 0 || nRet == STRUNCATE); - } - - bool SetToolTipText(LPCTSTR lpstrText) - { - if(m_lpstrToolTipText != NULL) - { - delete [] m_lpstrToolTipText; - m_lpstrToolTipText = NULL; - } - - if(lpstrText == NULL) - { - if(m_tip.IsWindow()) - m_tip.Activate(FALSE); - return true; - } - - int cchLen = lstrlen(lpstrText) + 1; - ATLTRY(m_lpstrToolTipText = new TCHAR[cchLen]); - if(m_lpstrToolTipText == NULL) - return false; - - SecureHelper::strcpy_x(m_lpstrToolTipText, cchLen, lpstrText); - if(m_tip.IsWindow()) - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrToolTipText); - } - - return true; - } - -// Operations - void SetImages(int nNormal, int nPushed = -1, int nFocusOrHover = -1, int nDisabled = -1) - { - if(nNormal != -1) - m_nImage[_nImageNormal] = nNormal; - if(nPushed != -1) - m_nImage[_nImagePushed] = nPushed; - if(nFocusOrHover != -1) - m_nImage[_nImageFocusOrHover] = nFocusOrHover; - if(nDisabled != -1) - m_nImage[_nImageDisabled] = nDisabled; - } - - BOOL SizeToImage() - { - ATLASSERT(::IsWindow(m_hWnd) && m_ImageList.m_hImageList != NULL); - int cx = 0; - int cy = 0; - if(!m_ImageList.GetIconSize(cx, cy)) - return FALSE; - return ResizeClient(cx, cy); - } - -// Overrideables - void DoPaint(CDCHandle dc) - { - ATLASSERT(m_ImageList.m_hImageList != NULL); // image list must be set - ATLASSERT(m_nImage[0] != -1); // main bitmap must be set - - // set bitmap according to the current button state - int nImage = -1; - bool bHover = IsHoverMode(); - if(!IsWindowEnabled()) - nImage = m_nImage[_nImageDisabled]; - else if(m_fPressed == 1) - nImage = m_nImage[_nImagePushed]; - else if((!bHover && m_fFocus == 1) || (bHover && m_fMouseOver == 1)) - nImage = m_nImage[_nImageFocusOrHover]; - if(nImage == -1) // not there, use default one - nImage = m_nImage[_nImageNormal]; - - // draw the button image - int xyPos = 0; - if((m_fPressed == 1) && ((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) && (m_nImage[_nImagePushed] == -1)) - xyPos = 1; - m_ImageList.Draw(dc, nImage, xyPos, xyPos, ILD_NORMAL); - - // draw 3D border if required - if((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) - { - RECT rect; - GetClientRect(&rect); - - if(m_fPressed == 1) - dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_SUNKENOUTER : EDGE_SUNKEN, BF_RECT); - else if(!bHover || m_fMouseOver == 1) - dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_RAISEDINNER : EDGE_RAISED, BF_RECT); - - if(!bHover && m_fFocus == 1) - { - ::InflateRect(&rect, -2 * ::GetSystemMetrics(SM_CXEDGE), -2 * ::GetSystemMetrics(SM_CYEDGE)); - dc.DrawFocusRect(&rect); - } - } - } - -// Message map and handlers - BEGIN_MSG_MAP(CBitmapButtonImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) - MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - MESSAGE_HANDLER(WM_ENABLE, OnEnable) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) - MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) - MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) - MESSAGE_HANDLER(WM_TIMER, OnTimer) - MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - Init(); - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_tip.IsWindow()) - { - m_tip.DestroyWindow(); - m_tip.m_hWnd = NULL; - } - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - MSG msg = { m_hWnd, uMsg, wParam, lParam }; - if(m_tip.IsWindow()) - m_tip.RelayEvent(&msg); - bHandled = FALSE; - return 1; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - pT->DoPaint((HDC)wParam); - } - else - { - CPaintDC dc(m_hWnd); - pT->DoPaint(dc.m_hDC); - } - return 0; - } - - LRESULT OnFocus(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - m_fFocus = (uMsg == WM_SETFOCUS) ? 1 : 0; - Invalidate(); - UpdateWindow(); - bHandled = FALSE; - return 1; - } - - LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = 0; - if(IsHoverMode()) - SetCapture(); - else - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() == m_hWnd) - { - m_fPressed = 1; - Invalidate(); - UpdateWindow(); - } - if((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) - { - int nElapse = 250; - int nDelay = 0; - if(::SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &nDelay, 0)) - nElapse += nDelay * 250; // all milli-seconds - SetTimer(ID_TIMER_FIRST, nElapse); - } - return lRet; - } - - LRESULT OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = 0; - if(!IsHoverMode()) - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() != m_hWnd) - SetCapture(); - if(m_fPressed == 0) - { - m_fPressed = 1; - Invalidate(); - UpdateWindow(); - } - return lRet; - } - - LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = 0; - bool bHover = IsHoverMode(); - if(!bHover) - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() == m_hWnd) - { - if(bHover && m_fPressed == 1) - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - ::ReleaseCapture(); - } - return lRet; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_fPressed == 1) - { - m_fPressed = 0; - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - Invalidate(); - UpdateWindow(); - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(::GetCapture() == m_hWnd) - { - POINT ptCursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&ptCursor); - RECT rect = { 0 }; - GetWindowRect(&rect); - unsigned int uPressed = ::PtInRect(&rect, ptCursor) ? 1 : 0; - if(m_fPressed != uPressed) - { - m_fPressed = uPressed; - Invalidate(); - UpdateWindow(); - } - } - else if(IsHoverMode() && m_fMouseOver == 0) - { - m_fMouseOver = 1; - Invalidate(); - UpdateWindow(); - StartTrackMouseLeave(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_fMouseOver == 1) - { - m_fMouseOver = 0; - Invalidate(); - UpdateWindow(); - } - return 0; - } - - LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam == VK_SPACE && IsHoverMode()) - return 0; // ignore if in hover mode - if(wParam == VK_SPACE && m_fPressed == 0) - { - m_fPressed = 1; - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam == VK_SPACE && IsHoverMode()) - return 0; // ignore if in hover mode - if(wParam == VK_SPACE && m_fPressed == 1) - { - m_fPressed = 0; - Invalidate(); - UpdateWindow(); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - ATLASSERT((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0); - switch(wParam) // timer ID - { - case ID_TIMER_FIRST: - KillTimer(ID_TIMER_FIRST); - if(m_fPressed == 1) - { - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - int nElapse = 250; - int nRepeat = 40; - if(::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &nRepeat, 0)) - nElapse = 10000 / (10 * nRepeat + 25); // milli-seconds, approximated - SetTimer(ID_TIMER_REPEAT, nElapse); - } - break; - case ID_TIMER_REPEAT: - if(m_fPressed == 1) - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - else if(::GetCapture() != m_hWnd) - KillTimer(ID_TIMER_REPEAT); - break; - default: // not our timer - break; - } - return 0; - } - - LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // If the control is subclassed or superclassed, this message can cause - // repainting without WM_PAINT. We don't use this state, so just do nothing. - return 0; - } - -// Implementation - void Init() - { - // We need this style to prevent Windows from painting the button - ModifyStyle(0, BS_OWNERDRAW); - - // create a tool tip - m_tip.Create(m_hWnd); - ATLASSERT(m_tip.IsWindow()); - if(m_tip.IsWindow() && m_lpstrToolTipText != NULL) - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrToolTipText); - } - - if(m_ImageList.m_hImageList != NULL && (m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0) - SizeToImage(); - } - - BOOL StartTrackMouseLeave() - { - TRACKMOUSEEVENT tme = { 0 }; - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_LEAVE; - tme.hwndTrack = m_hWnd; - return _TrackMouseEvent(&tme); - } - - bool IsHoverMode() const - { - return ((m_dwExtendedStyle & BMPBTN_HOVER) != 0); - } -}; - - -class CBitmapButton : public CBitmapButtonImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName()) - - CBitmapButton(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : - CBitmapButtonImpl(dwExtendedStyle, hImageList) - { } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CCheckListCtrlView - list view control with check boxes - -template -class CCheckListViewCtrlImplTraits -{ -public: - static DWORD GetWndStyle(DWORD dwStyle) - { - return (dwStyle == 0) ? t_dwStyle : dwStyle; - } - - static DWORD GetWndExStyle(DWORD dwExStyle) - { - return (dwExStyle == 0) ? t_dwExStyle : dwExStyle; - } - - static DWORD GetExtendedLVStyle() - { - return t_dwExListViewStyle; - } -}; - -typedef CCheckListViewCtrlImplTraits CCheckListViewCtrlTraits; - -template -class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - -// Attributes - static DWORD GetExtendedLVStyle() - { - return TWinTraits::GetExtendedLVStyle(); - } - -// Operations - BOOL SubclassWindow(HWND hWnd) - { -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImplBaseT< TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImplBaseT< TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - { - T* pT = static_cast(this); - pT; - ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); - SetExtendedListViewStyle(pT->GetExtendedLVStyle()); - } - return bRet; - } - - void CheckSelectedItems(int nCurrItem) - { - // first check if this item is selected - LVITEM lvi = { 0 }; - lvi.iItem = nCurrItem; - lvi.iSubItem = 0; - lvi.mask = LVIF_STATE; - lvi.stateMask = LVIS_SELECTED; - GetItem(&lvi); - // if item is not selected, don't do anything - if(!(lvi.state & LVIS_SELECTED)) - return; - // new check state will be reverse of the current state, - BOOL bCheck = !GetCheckState(nCurrItem); - int nItem = -1; - int nOldItem = -1; - while((nItem = GetNextItem(nOldItem, LVNI_SELECTED)) != -1) - { - if(nItem != nCurrItem) - SetCheckState(nItem, bCheck); - nOldItem = nItem; - } - } - -// Implementation - BEGIN_MSG_MAP(CCheckListViewCtrlImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDown) - MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) - END_MSG_MAP() - - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - // first let list view control initialize everything - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - T* pT = static_cast(this); - pT; - ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); - SetExtendedListViewStyle(pT->GetExtendedLVStyle()); - return lRet; - } - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - POINT ptMsg = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - LVHITTESTINFO lvh = { 0 }; - lvh.pt = ptMsg; - if(HitTest(&lvh) != -1 && lvh.flags == LVHT_ONITEMSTATEICON && ::GetKeyState(VK_CONTROL) >= 0) - { - T* pT = static_cast(this); - pT->CheckSelectedItems(lvh.iItem); - } - bHandled = FALSE; - return 1; - } - - LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam == VK_SPACE) - { - int nCurrItem = GetNextItem(-1, LVNI_FOCUSED); - if(nCurrItem != -1 && ::GetKeyState(VK_CONTROL) >= 0) - { - T* pT = static_cast(this); - pT->CheckSelectedItems(nCurrItem); - } - } - bHandled = FALSE; - return 1; - } -}; - -class CCheckListViewCtrl : public CCheckListViewCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_CheckListView"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CHyperLink - hyper link control implementation - -#if (WINVER < 0x0500) && !defined(_WIN32_WCE) -__declspec(selectany) struct -{ - enum { cxWidth = 32, cyHeight = 32 }; - int xHotSpot; - int yHotSpot; - unsigned char arrANDPlane[cxWidth * cyHeight / 8]; - unsigned char arrXORPlane[cxWidth * cyHeight / 8]; -} _AtlHyperLink_CursorData = -{ - 5, 0, - { - 0xF9, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, - 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0x3F, 0xFF, 0xFF, 0xF0, 0x07, 0xFF, 0xFF, 0xF0, 0x01, 0xFF, 0xFF, - 0xF0, 0x00, 0xFF, 0xFF, 0x10, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, - 0x80, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xE0, 0x00, 0x7F, 0xFF, - 0xE0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, - 0xF8, 0x01, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }, - { - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x06, 0xD8, 0x00, 0x00, - 0x06, 0xDA, 0x00, 0x00, 0x06, 0xDB, 0x00, 0x00, 0x67, 0xFB, 0x00, 0x00, 0x77, 0xFF, 0x00, 0x00, - 0x37, 0xFF, 0x00, 0x00, 0x17, 0xFF, 0x00, 0x00, 0x1F, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, - 0x0F, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, - 0x03, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - } -}; -#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) - -#define HLINK_UNDERLINED 0x00000000 -#define HLINK_NOTUNDERLINED 0x00000001 -#define HLINK_UNDERLINEHOVER 0x00000002 -#define HLINK_COMMANDBUTTON 0x00000004 -#define HLINK_NOTIFYBUTTON 0x0000000C -#define HLINK_USETAGS 0x00000010 -#define HLINK_USETAGSBOLD 0x00000030 -#define HLINK_NOTOOLTIP 0x00000040 - -// Notes: -// - HLINK_USETAGS and HLINK_USETAGSBOLD are always left-aligned -// - When HLINK_USETAGSBOLD is used, the underlined styles will be ignored - -template -class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > -{ -public: - LPTSTR m_lpstrLabel; - LPTSTR m_lpstrHyperLink; - - HCURSOR m_hCursor; - HFONT m_hFont; - HFONT m_hFontNormal; - - RECT m_rcLink; -#ifndef _WIN32_WCE - CToolTipCtrl m_tip; -#endif // !_WIN32_WCE - - COLORREF m_clrLink; - COLORREF m_clrVisited; - - DWORD m_dwExtendedStyle; // Hyper Link specific extended styles - - bool m_bPaintLabel:1; - bool m_bVisited:1; - bool m_bHover:1; - bool m_bInternalLinkFont:1; - - -// Constructor/Destructor - CHyperLinkImpl(DWORD dwExtendedStyle = HLINK_UNDERLINED) : - m_lpstrLabel(NULL), m_lpstrHyperLink(NULL), - m_hCursor(NULL), m_hFont(NULL), m_hFontNormal(NULL), - m_clrLink(RGB(0, 0, 255)), m_clrVisited(RGB(128, 0, 128)), - m_dwExtendedStyle(dwExtendedStyle), - m_bPaintLabel(true), m_bVisited(false), - m_bHover(false), m_bInternalLinkFont(false) - { - ::SetRectEmpty(&m_rcLink); - } - - ~CHyperLinkImpl() - { - delete [] m_lpstrLabel; - delete [] m_lpstrHyperLink; - if(m_bInternalLinkFont && m_hFont != NULL) - ::DeleteObject(m_hFont); -#if (WINVER < 0x0500) && !defined(_WIN32_WCE) - // It was created, not loaded, so we have to destroy it - if(m_hCursor != NULL) - ::DestroyCursor(m_hCursor); -#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) - } - -// Attributes - DWORD GetHyperLinkExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetHyperLinkExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - bool GetLabel(LPTSTR lpstrBuffer, int nLength) const - { - if(m_lpstrLabel == NULL) - return false; - ATLASSERT(lpstrBuffer != NULL); - if(nLength <= lstrlen(m_lpstrLabel)) - return false; - - SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrLabel); - - return true; - } - - bool SetLabel(LPCTSTR lpstrLabel) - { - delete [] m_lpstrLabel; - m_lpstrLabel = NULL; - int cchLen = lstrlen(lpstrLabel) + 1; - ATLTRY(m_lpstrLabel = new TCHAR[cchLen]); - if(m_lpstrLabel == NULL) - return false; - - SecureHelper::strcpy_x(m_lpstrLabel, cchLen, lpstrLabel); - T* pT = static_cast(this); - pT->CalcLabelRect(); - - if(m_hWnd != NULL) - SetWindowText(lpstrLabel); // Set this for accessibility - - return true; - } - - bool GetHyperLink(LPTSTR lpstrBuffer, int nLength) const - { - if(m_lpstrHyperLink == NULL) - return false; - ATLASSERT(lpstrBuffer != NULL); - if(nLength <= lstrlen(m_lpstrHyperLink)) - return false; - - SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrHyperLink); - - return true; - } - - bool SetHyperLink(LPCTSTR lpstrLink) - { - delete [] m_lpstrHyperLink; - m_lpstrHyperLink = NULL; - int cchLen = lstrlen(lpstrLink) + 1; - ATLTRY(m_lpstrHyperLink = new TCHAR[cchLen]); - if(m_lpstrHyperLink == NULL) - return false; - - SecureHelper::strcpy_x(m_lpstrHyperLink, cchLen, lpstrLink); - if(m_lpstrLabel == NULL) - { - T* pT = static_cast(this); - pT->CalcLabelRect(); - } -#ifndef _WIN32_WCE - if(m_tip.IsWindow()) - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); - } -#endif // !_WIN32_WCE - return true; - } - - HFONT GetLinkFont() const - { - return m_hFont; - } - - void SetLinkFont(HFONT hFont) - { - if(m_bInternalLinkFont && m_hFont != NULL) - { - ::DeleteObject(m_hFont); - m_bInternalLinkFont = false; - } - m_hFont = hFont; - } - - int GetIdealHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) - return -1; - if(!m_bPaintLabel) - return -1; - - CClientDC dc(m_hWnd); - RECT rect = { 0 }; - GetClientRect(&rect); - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - RECT rcText = rect; - dc.DrawText(_T("NS"), -1, &rcText, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - dc.SelectFont(m_hFont); - RECT rcLink = rect; - dc.DrawText(_T("NS"), -1, &rcLink, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - dc.SelectFont(hFontOld); - return max(rcText.bottom - rcText.top, rcLink.bottom - rcLink.top); - } - - bool GetIdealSize(SIZE& size) const - { - int cx = 0, cy = 0; - bool bRet = GetIdealSize(cx, cy); - if(bRet) - { - size.cx = cx; - size.cy = cy; - } - return bRet; - } - - bool GetIdealSize(int& cx, int& cy) const - { - ATLASSERT(::IsWindow(m_hWnd)); - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) - return false; - if(!m_bPaintLabel) - return false; - - CClientDC dc(m_hWnd); - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcAll = rcClient; - - if(IsUsingTags()) - { - // find tags and label parts - LPTSTR lpstrLeft = NULL; - int cchLeft = 0; - LPTSTR lpstrLink = NULL; - int cchLink = 0; - LPTSTR lpstrRight = NULL; - int cchRight = 0; - - const T* pT = static_cast(this); - pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); - - // get label part rects - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - RECT rcLeft = rcClient; - dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - - dc.SelectFont(m_hFont); - RECT rcLink = { rcLeft.right, rcLeft.top, rcClient.right, rcClient.bottom }; - dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - - dc.SelectFont(m_hFontNormal); - RECT rcRight = { rcLink.right, rcLink.top, rcClient.right, rcClient.bottom }; - dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - - dc.SelectFont(hFontOld); - - int cyMax = max(rcLeft.bottom, max(rcLink.bottom, rcRight.bottom)); - ::SetRect(&rcAll, rcLeft.left, rcLeft.top, rcRight.right, cyMax); - } - else - { - HFONT hOldFont = NULL; - if(m_hFont != NULL) - hOldFont = dc.SelectFont(m_hFont); - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - DWORD dwStyle = GetStyle(); - int nDrawStyle = DT_LEFT; - if (dwStyle & SS_CENTER) - nDrawStyle = DT_CENTER; - else if (dwStyle & SS_RIGHT) - nDrawStyle = DT_RIGHT; - dc.DrawText(lpstrText, -1, &rcAll, nDrawStyle | DT_WORDBREAK | DT_CALCRECT); - if(m_hFont != NULL) - dc.SelectFont(hOldFont); - if (dwStyle & SS_CENTER) - { - int dx = (rcClient.right - rcAll.right) / 2; - ::OffsetRect(&rcAll, dx, 0); - } - else if (dwStyle & SS_RIGHT) - { - int dx = rcClient.right - rcAll.right; - ::OffsetRect(&rcAll, dx, 0); - } - } - - cx = rcAll.right - rcAll.left; - cy = rcAll.bottom - rcAll.top; - - return true; - } - - // for command buttons only - bool GetToolTipText(LPTSTR lpstrBuffer, int nLength) const - { - ATLASSERT(IsCommandButton()); - return GetHyperLink(lpstrBuffer, nLength); - } - - bool SetToolTipText(LPCTSTR lpstrToolTipText) - { - ATLASSERT(IsCommandButton()); - return SetHyperLink(lpstrToolTipText); - } - -// Operations - BOOL SubclassWindow(HWND hWnd) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - { - T* pT = static_cast(this); - pT->Init(); - } - return bRet; - } - - bool Navigate() - { - ATLASSERT(::IsWindow(m_hWnd)); - bool bRet = true; - if(IsNotifyButton()) - { - NMHDR nmhdr = { m_hWnd, GetDlgCtrlID(), NM_CLICK }; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); - } - else if(IsCommandButton()) - { - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - } - else - { - ATLASSERT(m_lpstrHyperLink != NULL); -#ifndef _WIN32_WCE - DWORD_PTR dwRet = (DWORD_PTR)::ShellExecute(0, _T("open"), m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL); - bRet = (dwRet > 32); -#else // CE specific - SHELLEXECUTEINFO shExeInfo = { sizeof(SHELLEXECUTEINFO), 0, 0, L"open", m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL, 0, 0, 0, 0, 0, 0, 0 }; - ::ShellExecuteEx(&shExeInfo); - DWORD_PTR dwRet = (DWORD_PTR)shExeInfo.hInstApp; - bRet = (dwRet == 0) || (dwRet > 32); -#endif // _WIN32_WCE - ATLASSERT(bRet); - if(bRet) - { - m_bVisited = true; - Invalidate(); - } - } - return bRet; - } - -// Message map and handlers - BEGIN_MSG_MAP(CHyperLinkImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) - MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_CHAR, OnChar) - MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode) - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_ENABLE, OnEnable) - MESSAGE_HANDLER(WM_GETFONT, OnGetFont) - MESSAGE_HANDLER(WM_SETFONT, OnSetFont) - MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) - MESSAGE_HANDLER(WM_SIZE, OnSize) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->Init(); - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_tip.IsWindow()) - { - m_tip.DestroyWindow(); - m_tip.m_hWnd = NULL; - } - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - MSG msg = { m_hWnd, uMsg, wParam, lParam }; - if(m_tip.IsWindow() && IsUsingToolTip()) - m_tip.RelayEvent(&msg); - bHandled = FALSE; - return 1; - } -#endif // !_WIN32_WCE - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background painting needed (we do it all during WM_PAINT) - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(!m_bPaintLabel) - { - bHandled = FALSE; - return 1; - } - - T* pT = static_cast(this); - if(wParam != NULL) - { - pT->DoEraseBackground((HDC)wParam); - pT->DoPaint((HDC)wParam); - } - else - { - CPaintDC dc(m_hWnd); - pT->DoEraseBackground(dc.m_hDC); - pT->DoPaint(dc.m_hDC); - } - - return 0; - } - - LRESULT OnFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bPaintLabel) - Invalidate(); - else - bHandled = FALSE; - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) - { - ::SetCursor(m_hCursor); - if(IsUnderlineHover()) - { - if(!m_bHover) - { - m_bHover = true; - InvalidateRect(&m_rcLink); - UpdateWindow(); -#ifndef _WIN32_WCE - StartTrackMouseLeave(); -#endif // !_WIN32_WCE - } - } - } - else - { - if(IsUnderlineHover()) - { - if(m_bHover) - { - m_bHover = false; - InvalidateRect(&m_rcLink); - UpdateWindow(); - } - } - bHandled = FALSE; - } - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(IsUnderlineHover() && m_bHover) - { - m_bHover = false; - InvalidateRect(&m_rcLink); - UpdateWindow(); - } - return 0; - } -#endif // !_WIN32_WCE - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(::PtInRect(&m_rcLink, pt)) - { - SetFocus(); - SetCapture(); - } - return 0; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - if(GetCapture() == m_hWnd) - { - ReleaseCapture(); - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(::PtInRect(&m_rcLink, pt)) - { - T* pT = static_cast(this); - pT->Navigate(); - } - } - return 0; - } - - LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(wParam == VK_RETURN || wParam == VK_SPACE) - { - T* pT = static_cast(this); - pT->Navigate(); - } - return 0; - } - - LRESULT OnGetDlgCode(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return DLGC_WANTCHARS; - } - - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - POINT pt = { 0, 0 }; - GetCursorPos(&pt); - ScreenToClient(&pt); - if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) - { - return TRUE; - } - bHandled = FALSE; - return FALSE; - } - - LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - Invalidate(); - UpdateWindow(); - return 0; - } - - LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)m_hFontNormal; - } - - LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - m_hFontNormal = (HFONT)wParam; - if((BOOL)lParam) - { - Invalidate(); - UpdateWindow(); - } - return 0; - } - - LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // If the control is subclassed or superclassed, this message can cause - // repainting without WM_PAINT. We don't use this state, so just do nothing. - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->CalcLabelRect(); - pT->Invalidate(); - return 0; - } - -// Implementation - void Init() - { - ATLASSERT(::IsWindow(m_hWnd)); - - // Check if we should paint a label - const int cchBuff = 8; - TCHAR szBuffer[cchBuff] = { 0 }; - if(::GetClassName(m_hWnd, szBuffer, cchBuff)) - { - if(lstrcmpi(szBuffer, _T("static")) == 0) - { - ModifyStyle(0, SS_NOTIFY); // we need this - DWORD dwStyle = GetStyle() & 0x000000FF; -#ifndef _WIN32_WCE - if(dwStyle == SS_ICON || dwStyle == SS_BLACKRECT || dwStyle == SS_GRAYRECT || - dwStyle == SS_WHITERECT || dwStyle == SS_BLACKFRAME || dwStyle == SS_GRAYFRAME || - dwStyle == SS_WHITEFRAME || dwStyle == SS_OWNERDRAW || - dwStyle == SS_BITMAP || dwStyle == SS_ENHMETAFILE) -#else // CE specific - if(dwStyle == SS_ICON || dwStyle == SS_BITMAP) -#endif // _WIN32_WCE - m_bPaintLabel = false; - } - } - - // create or load a cursor -#if (WINVER >= 0x0500) || defined(_WIN32_WCE) - m_hCursor = ::LoadCursor(NULL, IDC_HAND); -#else - m_hCursor = ::CreateCursor(ModuleHelper::GetModuleInstance(), _AtlHyperLink_CursorData.xHotSpot, _AtlHyperLink_CursorData.yHotSpot, _AtlHyperLink_CursorData.cxWidth, _AtlHyperLink_CursorData.cyHeight, _AtlHyperLink_CursorData.arrANDPlane, _AtlHyperLink_CursorData.arrXORPlane); -#endif - ATLASSERT(m_hCursor != NULL); - - // set font - if(m_bPaintLabel) - { - ATL::CWindow wnd = GetParent(); - m_hFontNormal = wnd.GetFont(); - if(m_hFontNormal == NULL) - m_hFontNormal = (HFONT)::GetStockObject(SYSTEM_FONT); - if(m_hFontNormal != NULL && m_hFont == NULL) - { - LOGFONT lf = { 0 }; - CFontHandle font = m_hFontNormal; - font.GetLogFont(&lf); - if(IsUsingTagsBold()) - lf.lfWeight = FW_BOLD; - else if(!IsNotUnderlined()) - lf.lfUnderline = TRUE; - m_hFont = ::CreateFontIndirect(&lf); - m_bInternalLinkFont = true; - ATLASSERT(m_hFont != NULL); - } - } - -#ifndef _WIN32_WCE - // create a tool tip - m_tip.Create(m_hWnd); - ATLASSERT(m_tip.IsWindow()); -#endif // !_WIN32_WCE - - // set label (defaults to window text) - if(m_lpstrLabel == NULL) - { - int nLen = GetWindowTextLength(); - if(nLen > 0) - { - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(nLen + 1); - ATLASSERT(lpstrText != NULL); - if((lpstrText != NULL) && (GetWindowText(lpstrText, nLen + 1) > 0)) - SetLabel(lpstrText); - } - } - - T* pT = static_cast(this); - pT->CalcLabelRect(); - - // set hyperlink (defaults to label), or just activate tool tip if already set - if(m_lpstrHyperLink == NULL && !IsCommandButton()) - { - if(m_lpstrLabel != NULL) - SetHyperLink(m_lpstrLabel); - } -#ifndef _WIN32_WCE - else - { - m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); - } -#endif // !_WIN32_WCE - - // set link colors - if(m_bPaintLabel) - { - ATL::CRegKey rk; - LONG lRet = rk.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\Settings")); - if(lRet == 0) - { - const int cchValue = 12; - TCHAR szValue[cchValue] = { 0 }; -#if (_ATL_VER >= 0x0700) - ULONG ulCount = cchValue; - lRet = rk.QueryStringValue(_T("Anchor Color"), szValue, &ulCount); -#else - DWORD dwCount = cchValue * sizeof(TCHAR); - lRet = rk.QueryValue(szValue, _T("Anchor Color"), &dwCount); -#endif - if(lRet == 0) - { - COLORREF clr = pT->_ParseColorString(szValue); - ATLASSERT(clr != CLR_INVALID); - if(clr != CLR_INVALID) - m_clrLink = clr; - } - -#if (_ATL_VER >= 0x0700) - ulCount = cchValue; - lRet = rk.QueryStringValue(_T("Anchor Color Visited"), szValue, &ulCount); -#else - dwCount = cchValue * sizeof(TCHAR); - lRet = rk.QueryValue(szValue, _T("Anchor Color Visited"), &dwCount); -#endif - if(lRet == 0) - { - COLORREF clr = pT->_ParseColorString(szValue); - ATLASSERT(clr != CLR_INVALID); - if(clr != CLR_INVALID) - m_clrVisited = clr; - } - } - } - } - - static COLORREF _ParseColorString(LPTSTR lpstr) - { - int c[3] = { -1, -1, -1 }; - LPTSTR p = NULL; - for(int i = 0; i < 2; i++) - { - for(p = lpstr; *p != _T('\0'); p = ::CharNext(p)) - { - if(*p == _T(',')) - { - *p = _T('\0'); - c[i] = T::_xttoi(lpstr); - lpstr = &p[1]; - break; - } - } - if(c[i] == -1) - return CLR_INVALID; - } - if(*lpstr == _T('\0')) - return CLR_INVALID; - c[2] = T::_xttoi(lpstr); - - return RGB(c[0], c[1], c[2]); - } - - bool CalcLabelRect() - { - if(!::IsWindow(m_hWnd)) - return false; - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) - return false; - - CClientDC dc(m_hWnd); - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - m_rcLink = rcClient; - if(!m_bPaintLabel) - return true; - - if(IsUsingTags()) - { - // find tags and label parts - LPTSTR lpstrLeft = NULL; - int cchLeft = 0; - LPTSTR lpstrLink = NULL; - int cchLink = 0; - LPTSTR lpstrRight = NULL; - int cchRight = 0; - - T* pT = static_cast(this); - pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); - ATLASSERT(lpstrLink != NULL); - ATLASSERT(cchLink > 0); - - // get label part rects - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - - RECT rcLeft = rcClient; - if(lpstrLeft != NULL) - dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - - dc.SelectFont(m_hFont); - RECT rcLink = rcClient; - if(lpstrLeft != NULL) - rcLink.left = rcLeft.right; - dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); - - dc.SelectFont(hFontOld); - - m_rcLink = rcLink; - } - else - { - HFONT hOldFont = NULL; - if(m_hFont != NULL) - hOldFont = dc.SelectFont(m_hFont); - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - DWORD dwStyle = GetStyle(); - int nDrawStyle = DT_LEFT; - if (dwStyle & SS_CENTER) - nDrawStyle = DT_CENTER; - else if (dwStyle & SS_RIGHT) - nDrawStyle = DT_RIGHT; - dc.DrawText(lpstrText, -1, &m_rcLink, nDrawStyle | DT_WORDBREAK | DT_CALCRECT); - if(m_hFont != NULL) - dc.SelectFont(hOldFont); - if (dwStyle & SS_CENTER) - { - int dx = (rcClient.right - m_rcLink.right) / 2; - ::OffsetRect(&m_rcLink, dx, 0); - } - else if (dwStyle & SS_RIGHT) - { - int dx = rcClient.right - m_rcLink.right; - ::OffsetRect(&m_rcLink, dx, 0); - } - } - - return true; - } - - void CalcLabelParts(LPTSTR& lpstrLeft, int& cchLeft, LPTSTR& lpstrLink, int& cchLink, LPTSTR& lpstrRight, int& cchRight) const - { - lpstrLeft = NULL; - cchLeft = 0; - lpstrLink = NULL; - cchLink = 0; - lpstrRight = NULL; - cchRight = 0; - - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - int cchText = lstrlen(lpstrText); - bool bOutsideLink = true; - for(int i = 0; i < cchText; i++) - { - if(lpstrText[i] != _T('<')) - continue; - - if(bOutsideLink) - { - if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 3, _T(""), 3) == CSTR_EQUAL) - { - if(i > 0) - { - lpstrLeft = lpstrText; - cchLeft = i; - } - lpstrLink = &lpstrText[i + 3]; - bOutsideLink = false; - } - } - else - { - if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 4, _T(""), 4) == CSTR_EQUAL) - { - cchLink = i - 3 - cchLeft; - if(lpstrText[i + 4] != 0) - { - lpstrRight = &lpstrText[i + 4]; - cchRight = cchText - (i + 4); - break; - } - } - } - } - - } - - void DoEraseBackground(CDCHandle dc) - { - HBRUSH hBrush = (HBRUSH)::SendMessage(GetParent(), WM_CTLCOLORSTATIC, (WPARAM)dc.m_hDC, (LPARAM)m_hWnd); - if(hBrush != NULL) - { - RECT rect = { 0 }; - GetClientRect(&rect); - dc.FillRect(&rect, hBrush); - } - } - - void DoPaint(CDCHandle dc) - { - if(IsUsingTags()) - { - // find tags and label parts - LPTSTR lpstrLeft = NULL; - int cchLeft = 0; - LPTSTR lpstrLink = NULL; - int cchLink = 0; - LPTSTR lpstrRight = NULL; - int cchRight = 0; - - T* pT = static_cast(this); - pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); - - // get label part rects - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - - dc.SetBkMode(TRANSPARENT); - HFONT hFontOld = dc.SelectFont(m_hFontNormal); - - if(lpstrLeft != NULL) - dc.DrawText(lpstrLeft, cchLeft, &rcClient, DT_LEFT | DT_WORDBREAK); - - COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); - if(m_hFont != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) - dc.SelectFont(m_hFont); - else - dc.SelectFont(m_hFontNormal); - - dc.DrawText(lpstrLink, cchLink, &m_rcLink, DT_LEFT | DT_WORDBREAK); - - dc.SetTextColor(clrOld); - dc.SelectFont(m_hFontNormal); - if(lpstrRight != NULL) - { - RECT rcRight = { m_rcLink.right, m_rcLink.top, rcClient.right, rcClient.bottom }; - dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | DT_WORDBREAK); - } - - if(GetFocus() == m_hWnd) - dc.DrawFocusRect(&m_rcLink); - - dc.SelectFont(hFontOld); - } - else - { - dc.SetBkMode(TRANSPARENT); - COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); - - HFONT hFontOld = NULL; - if(m_hFont != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) - hFontOld = dc.SelectFont(m_hFont); - else - hFontOld = dc.SelectFont(m_hFontNormal); - - LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - - DWORD dwStyle = GetStyle(); - int nDrawStyle = DT_LEFT; - if (dwStyle & SS_CENTER) - nDrawStyle = DT_CENTER; - else if (dwStyle & SS_RIGHT) - nDrawStyle = DT_RIGHT; - - dc.DrawText(lpstrText, -1, &m_rcLink, nDrawStyle | DT_WORDBREAK); - - if(GetFocus() == m_hWnd) - dc.DrawFocusRect(&m_rcLink); - - dc.SetTextColor(clrOld); - dc.SelectFont(hFontOld); - } - } - -#ifndef _WIN32_WCE - BOOL StartTrackMouseLeave() - { - TRACKMOUSEEVENT tme = { 0 }; - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_LEAVE; - tme.hwndTrack = m_hWnd; - return _TrackMouseEvent(&tme); - } -#endif // !_WIN32_WCE - -// Implementation helpers - bool IsUnderlined() const - { - return ((m_dwExtendedStyle & (HLINK_NOTUNDERLINED | HLINK_UNDERLINEHOVER)) == 0); - } - - bool IsNotUnderlined() const - { - return ((m_dwExtendedStyle & HLINK_NOTUNDERLINED) != 0); - } - - bool IsUnderlineHover() const - { - return ((m_dwExtendedStyle & HLINK_UNDERLINEHOVER) != 0); - } - - bool IsCommandButton() const - { - return ((m_dwExtendedStyle & HLINK_COMMANDBUTTON) != 0); - } - - bool IsNotifyButton() const - { - return ((m_dwExtendedStyle & HLINK_NOTIFYBUTTON) == HLINK_NOTIFYBUTTON); - } - - bool IsUsingTags() const - { - return ((m_dwExtendedStyle & HLINK_USETAGS) != 0); - } - - bool IsUsingTagsBold() const - { - return ((m_dwExtendedStyle & HLINK_USETAGSBOLD) == HLINK_USETAGSBOLD); - } - - bool IsUsingToolTip() const - { - return ((m_dwExtendedStyle & HLINK_NOTOOLTIP) == 0); - } - - static int _xttoi(const TCHAR* nptr) - { -#ifndef _ATL_MIN_CRT - return _ttoi(nptr); -#else // _ATL_MIN_CRT - while(*nptr == _T(' ')) // skip spaces - ++nptr; - - int c = (int)(_TUCHAR)*nptr++; - int sign = c; // save sign indication - if (c == _T('-') || c == _T('+')) - c = (int)(_TUCHAR)*nptr++; // skip sign - - int total = 0; - while((TCHAR)c >= _T('0') && (TCHAR)c <= _T('9')) - { - total = 10 * total + ((TCHAR)c - _T('0')); // accumulate digit - c = (int)(_TUCHAR)*nptr++; // get next char - } - - // return result, negated if necessary - return ((TCHAR)sign != _T('-')) ? total : -total; -#endif // _ATL_MIN_CRT - } -}; - - -class CHyperLink : public CHyperLinkImpl -{ -public: - DECLARE_WND_CLASS(_T("WTL_HyperLink")) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWaitCursor - displays a wait cursor - -class CWaitCursor -{ -public: -// Data - HCURSOR m_hWaitCursor; - HCURSOR m_hOldCursor; - bool m_bInUse; - -// Constructor/destructor - CWaitCursor(bool bSet = true, LPCTSTR lpstrCursor = IDC_WAIT, bool bSys = true) : m_hOldCursor(NULL), m_bInUse(false) - { - HINSTANCE hInstance = bSys ? NULL : ModuleHelper::GetResourceInstance(); - m_hWaitCursor = ::LoadCursor(hInstance, lpstrCursor); - ATLASSERT(m_hWaitCursor != NULL); - - if(bSet) - Set(); - } - - ~CWaitCursor() - { - Restore(); - } - -// Methods - bool Set() - { - if(m_bInUse) - return false; - m_hOldCursor = ::SetCursor(m_hWaitCursor); - m_bInUse = true; - return true; - } - - bool Restore() - { - if(!m_bInUse) - return false; - ::SetCursor(m_hOldCursor); - m_bInUse = false; - return true; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CCustomWaitCursor - for custom and animated cursors - -class CCustomWaitCursor : public CWaitCursor -{ -public: -// Constructor/destructor - CCustomWaitCursor(ATL::_U_STRINGorID cursor, bool bSet = true, HINSTANCE hInstance = NULL) : - CWaitCursor(false, IDC_WAIT, true) - { - if(hInstance == NULL) - hInstance = ModuleHelper::GetResourceInstance(); - m_hWaitCursor = (HCURSOR)::LoadImage(hInstance, cursor.m_lpstr, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE); - - if(bSet) - Set(); - } - - ~CCustomWaitCursor() - { - Restore(); -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - ::DestroyCursor(m_hWaitCursor); -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMultiPaneStatusBarCtrl - Status Bar with multiple panes - -template -class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TBase > -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - -// Data - enum { m_cxPaneMargin = 3 }; - - int m_nPanes; - int* m_pPane; - -// Constructor/destructor - CMultiPaneStatusBarCtrlImpl() : m_nPanes(0), m_pPane(NULL) - { } - - ~CMultiPaneStatusBarCtrlImpl() - { - delete [] m_pPane; - } - -// Methods - HWND Create(HWND hWndParent, LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) - { -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase >::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); -#endif // !(_MSC_VER >= 1300) - } - - HWND Create(HWND hWndParent, UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) - { - const int cchMax = 128; // max text length is 127 for status bars (+1 for null) - TCHAR szText[cchMax]; - szText[0] = 0; - ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); - return Create(hWndParent, szText, dwStyle, nID); - } - - BOOL SetPanes(int* pPanes, int nPanes, bool bSetText = true) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPanes > 0); - - m_nPanes = nPanes; - delete [] m_pPane; - m_pPane = NULL; - - ATLTRY(m_pPane = new int[nPanes]); - ATLASSERT(m_pPane != NULL); - if(m_pPane == NULL) - return FALSE; - - CTempBuffer buff; - int* pPanesPos = buff.Allocate(nPanes); - ATLASSERT(pPanesPos != NULL); - if(pPanesPos == NULL) - return FALSE; - - SecureHelper::memcpy_x(m_pPane, nPanes * sizeof(int), pPanes, nPanes * sizeof(int)); - - // get status bar DC and set font - CClientDC dc(m_hWnd); - HFONT hOldFont = dc.SelectFont(GetFont()); - - // get status bar borders - int arrBorders[3] = { 0 }; - GetBorders(arrBorders); - - const int cchBuff = 128; - TCHAR szBuff[cchBuff] = { 0 }; - SIZE size = { 0, 0 }; - int cxLeft = arrBorders[0]; - - // calculate right edge of each part - for(int i = 0; i < nPanes; i++) - { - if(pPanes[i] == ID_DEFAULT_PANE) - { - // make very large, will be resized later - pPanesPos[i] = INT_MAX / 2; - } - else - { - ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); - dc.GetTextExtent(szBuff, lstrlen(szBuff), &size); - T* pT = static_cast(this); - pT; - pPanesPos[i] = cxLeft + size.cx + arrBorders[2] + 2 * pT->m_cxPaneMargin; - } - cxLeft = pPanesPos[i]; - } - - BOOL bRet = SetParts(nPanes, pPanesPos); - - if(bRet && bSetText) - { - for(int i = 0; i < nPanes; i++) - { - if(pPanes[i] != ID_DEFAULT_PANE) - { - ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); - SetPaneText(m_pPane[i], szBuff); - } - } - } - - dc.SelectFont(hOldFont); - return bRet; - } - - bool GetPaneTextLength(int nPaneID, int* pcchLength = NULL, int* pnType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return false; - - int nLength = GetTextLength(nIndex, pnType); - if(pcchLength != NULL) - *pcchLength = nLength; - - return true; - } - - BOOL GetPaneText(int nPaneID, LPTSTR lpstrText, int* pcchLength = NULL, int* pnType = NULL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - int nLength = GetText(nIndex, lpstrText, pnType); - if(pcchLength != NULL) - *pcchLength = nLength; - - return TRUE; - } - - BOOL SetPaneText(int nPaneID, LPCTSTR lpstrText, int nType = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - return SetText(nIndex, lpstrText, nType); - } - - BOOL GetPaneRect(int nPaneID, LPRECT lpRect) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - return GetRect(nIndex, lpRect); - } - - BOOL SetPaneWidth(int nPaneID, int cxWidth) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPaneID != ID_DEFAULT_PANE); // Can't resize this one - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - // get pane positions - CTempBuffer buff; - int* pPanesPos = buff.Allocate(m_nPanes); - if(pPanesPos == NULL) - return FALSE; - GetParts(m_nPanes, pPanesPos); - // calculate offset - int cxPaneWidth = pPanesPos[nIndex] - ((nIndex == 0) ? 0 : pPanesPos[nIndex - 1]); - int cxOff = cxWidth - cxPaneWidth; - // find variable width pane - int nDef = m_nPanes; - for(int i = 0; i < m_nPanes; i++) - { - if(m_pPane[i] == ID_DEFAULT_PANE) - { - nDef = i; - break; - } - } - // resize - if(nIndex < nDef) // before default pane - { - for(int i = nIndex; i < nDef; i++) - pPanesPos[i] += cxOff; - - } - else // after default one - { - for(int i = nDef; i < nIndex; i++) - pPanesPos[i] -= cxOff; - } - // set pane postions - return SetParts(m_nPanes, pPanesPos); - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - BOOL GetPaneTipText(int nPaneID, LPTSTR lpstrText, int nSize) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - GetTipText(nIndex, lpstrText, nSize); - return TRUE; - } - - BOOL SetPaneTipText(int nPaneID, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - SetTipText(nIndex, lpstrText); - return TRUE; - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) - BOOL GetPaneIcon(int nPaneID, HICON& hIcon) const - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - hIcon = GetIcon(nIndex); - return TRUE; - } - - BOOL SetPaneIcon(int nPaneID, HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - int nIndex = GetPaneIndexFromID(nPaneID); - if(nIndex == -1) - return FALSE; - - return SetIcon(nIndex, hIcon); - } -#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) - -// Message map and handlers - BEGIN_MSG_MAP(CMultiPaneStatusBarCtrlImpl< T >) - MESSAGE_HANDLER(WM_SIZE, OnSize) - END_MSG_MAP() - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(wParam != SIZE_MINIMIZED && m_nPanes > 0) - { - T* pT = static_cast(this); - pT->UpdatePanesLayout(); - } - return lRet; - } - -// Implementation - BOOL UpdatePanesLayout() - { - // get pane positions - CTempBuffer buff; - int* pPanesPos = buff.Allocate(m_nPanes); - ATLASSERT(pPanesPos != NULL); - if(pPanesPos == NULL) - return FALSE; - int nRet = GetParts(m_nPanes, pPanesPos); - ATLASSERT(nRet == m_nPanes); - if(nRet != m_nPanes) - return FALSE; - // calculate offset - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - int cxOff = rcClient.right - pPanesPos[m_nPanes - 1]; -#ifndef _WIN32_WCE - // Move panes left if size grip box is present - if((GetStyle() & SBARS_SIZEGRIP) != 0) - cxOff -= ::GetSystemMetrics(SM_CXVSCROLL) + ::GetSystemMetrics(SM_CXEDGE); -#endif // !_WIN32_WCE - // find variable width pane - int i; - for(i = 0; i < m_nPanes; i++) - { - if(m_pPane[i] == ID_DEFAULT_PANE) - break; - } - // resize all panes from the variable one to the right - if((i < m_nPanes) && (pPanesPos[i] + cxOff) > ((i == 0) ? 0 : pPanesPos[i - 1])) - { - for(; i < m_nPanes; i++) - pPanesPos[i] += cxOff; - } - // set pane postions - return SetParts(m_nPanes, pPanesPos); - } - - int GetPaneIndexFromID(int nPaneID) const - { - for(int i = 0; i < m_nPanes; i++) - { - if(m_pPane[i] == nPaneID) - return i; - } - - return -1; // not found - } -}; - -class CMultiPaneStatusBarCtrl : public CMultiPaneStatusBarCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_MultiPaneStatusBar"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPaneContainer - provides header with title and close button for panes - -// pane container extended styles -#define PANECNT_NOCLOSEBUTTON 0x00000001 -#define PANECNT_VERTICAL 0x00000002 -#define PANECNT_FLATBORDER 0x00000004 -#define PANECNT_NOBORDER 0x00000008 - -template -class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CCustomDraw< T > -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, -1) - -// Constants - enum - { - m_cxyBorder = 2, - m_cxyTextOffset = 4, - m_cxyBtnOffset = 1, - - m_cchTitle = 80, - - m_cxImageTB = 13, - m_cyImageTB = 11, - m_cxyBtnAddTB = 7, - - m_cxToolBar = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder + m_cxyBtnOffset, - - m_xBtnImageLeft = 6, - m_yBtnImageTop = 5, - m_xBtnImageRight = 12, - m_yBtnImageBottom = 11, - - m_nCloseBtnID = ID_PANE_CLOSE - }; - -// Data members - CToolBarCtrl m_tb; - ATL::CWindow m_wndClient; - int m_cxyHeader; - TCHAR m_szTitle[m_cchTitle]; - DWORD m_dwExtendedStyle; // Pane container specific extended styles - - -// Constructor - CPaneContainerImpl() : m_cxyHeader(0), m_dwExtendedStyle(0) - { - m_szTitle[0] = 0; - } - -// Attributes - DWORD GetPaneContainerExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetPaneContainerExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - if(m_hWnd != NULL) - { - T* pT = static_cast(this); - bool bUpdate = false; - - if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) != 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0)) // add close button - { - pT->CreateCloseButton(); - bUpdate = true; - } - else if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) == 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) != 0)) // remove close button - { - pT->DestroyCloseButton(); - bUpdate = true; - } - - if((dwPrevStyle & PANECNT_VERTICAL) != (m_dwExtendedStyle & PANECNT_VERTICAL)) // change orientation - { - pT->CalcSize(); - bUpdate = true; - } - - if((dwPrevStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER)) != - (m_dwExtendedStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER))) // change border - { - bUpdate = true; - } - - if(bUpdate) - pT->UpdateLayout(); - } - return dwPrevStyle; - } - - HWND GetClient() const - { - return m_wndClient; - } - - HWND SetClient(HWND hWndClient) - { - HWND hWndOldClient = m_wndClient; - m_wndClient = hWndClient; - if(m_hWnd != NULL) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - return hWndOldClient; - } - - BOOL GetTitle(LPTSTR lpstrTitle, int cchLength) const - { - ATLASSERT(lpstrTitle != NULL); - - errno_t nRet = SecureHelper::strncpy_x(lpstrTitle, cchLength, m_szTitle, _TRUNCATE); - - return (nRet == 0 || nRet == STRUNCATE); - } - - BOOL SetTitle(LPCTSTR lpstrTitle) - { - ATLASSERT(lpstrTitle != NULL); - - errno_t nRet = SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); - bool bRet = (nRet == 0 || nRet == STRUNCATE); - if(bRet && m_hWnd != NULL) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - - return bRet; - } - - int GetTitleLength() const - { - return lstrlen(m_szTitle); - } - -// Methods - HWND Create(HWND hWndParent, LPCTSTR lpstrTitle = NULL, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) - { - if(lpstrTitle != NULL) - SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) - } - - HWND Create(HWND hWndParent, UINT uTitleID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) - { - if(uTitleID != 0U) - ::LoadString(ModuleHelper::GetResourceInstance(), uTitleID, m_szTitle, m_cchTitle); -#if (_MSC_VER >= 1300) - return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) - } - - BOOL EnableCloseButton(BOOL bEnable) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT; // avoid level 4 warning - return (m_tb.m_hWnd != NULL) ? m_tb.EnableButton(pT->m_nCloseBtnID, bEnable) : FALSE; - } - - void UpdateLayout() - { - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - T* pT = static_cast(this); - pT->UpdateLayout(rcClient.right, rcClient.bottom); - } - -// Message map and handlers - BEGIN_MSG_MAP(CPaneContainerImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - FORWARD_NOTIFICATIONS() - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->CalcSize(); - - if((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0) - pT->CreateCloseButton(); - - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - return 0; - } - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetFocus(); - return 0; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - pT->DrawPaneTitle((HDC)wParam); - - if(m_wndClient.m_hWnd == NULL) // no client window - pT->DrawPane((HDC)wParam); - } - else - { - CPaintDC dc(m_hWnd); - pT->DrawPaneTitle(dc.m_hDC); - - if(m_wndClient.m_hWnd == NULL) // no client window - pT->DrawPane(dc.m_hDC); - } - - return 0; - } - - LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_tb.m_hWnd == NULL) - { - bHandled = FALSE; - return 1; - } - - T* pT = static_cast(this); - pT; - LPNMHDR lpnmh = (LPNMHDR)lParam; - LRESULT lRet = 0; - - // pass toolbar custom draw notifications to the base class - if(lpnmh->code == NM_CUSTOMDRAW && lpnmh->hwndFrom == m_tb.m_hWnd) - lRet = CCustomDraw< T >::OnCustomDraw(0, lpnmh, bHandled); -#ifndef _WIN32_WCE - // tooltip notifications come with the tooltip window handle and button ID, - // pass them to the parent if we don't handle them - else if(lpnmh->code == TTN_GETDISPINFO && lpnmh->idFrom == pT->m_nCloseBtnID) - bHandled = pT->GetToolTipText(lpnmh); -#endif // !_WIN32_WCE - // only let notifications not from the toolbar go to the parent - else if(lpnmh->hwndFrom != m_tb.m_hWnd && lpnmh->idFrom != pT->m_nCloseBtnID) - bHandled = FALSE; - - return lRet; - } - - LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - // if command comes from the close button, substitute HWND of the pane container instead - if(m_tb.m_hWnd != NULL && (HWND)lParam == m_tb.m_hWnd) - return ::SendMessage(GetParent(), WM_COMMAND, wParam, (LPARAM)m_hWnd); - - bHandled = FALSE; - return 1; - } - -// Custom draw overrides - DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return CDRF_NOTIFYITEMDRAW; // we need per-item notifications - } - - DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) - { - CDCHandle dc = lpNMCustomDraw->hdc; -#if (_WIN32_IE >= 0x0400) - RECT& rc = lpNMCustomDraw->rc; -#else // !(_WIN32_IE >= 0x0400) - RECT rc; - m_tb.GetItemRect(0, &rc); -#endif // !(_WIN32_IE >= 0x0400) - - dc.FillRect(&rc, COLOR_3DFACE); - - return CDRF_NOTIFYPOSTPAINT; - } - - DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) - { - CDCHandle dc = lpNMCustomDraw->hdc; -#if (_WIN32_IE >= 0x0400) - RECT& rc = lpNMCustomDraw->rc; -#else // !(_WIN32_IE >= 0x0400) - RECT rc = { 0 }; - m_tb.GetItemRect(0, &rc); -#endif // !(_WIN32_IE >= 0x0400) - - RECT rcImage = { m_xBtnImageLeft, m_yBtnImageTop, m_xBtnImageRight + 1, m_yBtnImageBottom + 1 }; - ::OffsetRect(&rcImage, rc.left, rc.top); - T* pT = static_cast(this); - - if((lpNMCustomDraw->uItemState & CDIS_DISABLED) != 0) - { - RECT rcShadow = rcImage; - ::OffsetRect(&rcShadow, 1, 1); - CPen pen1; - pen1.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DHILIGHT)); - pT->DrawButtonImage(dc, rcShadow, pen1); - CPen pen2; - pen2.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DSHADOW)); - pT->DrawButtonImage(dc, rcImage, pen2); - } - else - { - if((lpNMCustomDraw->uItemState & CDIS_SELECTED) != 0) - ::OffsetRect(&rcImage, 1, 1); - CPen pen; - pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNTEXT)); - pT->DrawButtonImage(dc, rcImage, pen); - } - - return CDRF_DODEFAULT; // continue with the default item painting - } - -// Implementation - overrideable methods - void UpdateLayout(int cxWidth, int cyHeight) - { - ATLASSERT(::IsWindow(m_hWnd)); - RECT rect = { 0 }; - - if(IsVertical()) - { - ::SetRect(&rect, 0, 0, m_cxyHeader, cyHeight); - if(m_tb.m_hWnd != NULL) - m_tb.SetWindowPos(NULL, m_cxyBorder, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetWindowPos(NULL, m_cxyHeader, 0, cxWidth - m_cxyHeader, cyHeight, SWP_NOZORDER); - else - rect.right = cxWidth; - } - else - { - ::SetRect(&rect, 0, 0, cxWidth, m_cxyHeader); - if(m_tb.m_hWnd != NULL) - m_tb.SetWindowPos(NULL, rect.right - m_cxToolBar, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetWindowPos(NULL, 0, m_cxyHeader, cxWidth, cyHeight - m_cxyHeader, SWP_NOZORDER); - else - rect.bottom = cyHeight; - } - - InvalidateRect(&rect); - } - - void CreateCloseButton() - { - ATLASSERT(m_tb.m_hWnd == NULL); - // create toolbar for the "x" button - m_tb.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NOMOVEY | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, 0); - ATLASSERT(m_tb.IsWindow()); - - if(m_tb.m_hWnd != NULL) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - - m_tb.SetButtonStructSize(); - - TBBUTTON tbbtn = { 0 }; - tbbtn.idCommand = pT->m_nCloseBtnID; - tbbtn.fsState = TBSTATE_ENABLED; - tbbtn.fsStyle = TBSTYLE_BUTTON; - m_tb.AddButtons(1, &tbbtn); - - m_tb.SetBitmapSize(m_cxImageTB, m_cyImageTB); - m_tb.SetButtonSize(m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB); - - if(IsVertical()) - m_tb.SetWindowPos(NULL, m_cxyBorder + m_cxyBtnOffset, m_cxyBorder + m_cxyBtnOffset, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOACTIVATE); - else - m_tb.SetWindowPos(NULL, 0, 0, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); - } - } - - void DestroyCloseButton() - { - if(m_tb.m_hWnd != NULL) - m_tb.DestroyWindow(); - } - - void CalcSize() - { - T* pT = static_cast(this); - CFontHandle font = pT->GetTitleFont(); - LOGFONT lf = { 0 }; - font.GetLogFont(lf); - if(IsVertical()) - { - m_cxyHeader = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder; - } - else - { - int cyFont = abs(lf.lfHeight) + m_cxyBorder + 2 * m_cxyTextOffset; - int cyBtn = m_cyImageTB + m_cxyBtnAddTB + m_cxyBorder + 2 * m_cxyBtnOffset; - m_cxyHeader = max(cyFont, cyBtn); - } - } - - HFONT GetTitleFont() const - { - return AtlGetDefaultGuiFont(); - } - -#ifndef _WIN32_WCE - BOOL GetToolTipText(LPNMHDR /*lpnmh*/) - { - return FALSE; - } -#endif // !_WIN32_WCE - - void DrawPaneTitle(CDCHandle dc) - { - RECT rect = { 0 }; - GetClientRect(&rect); - - UINT uBorder = BF_LEFT | BF_TOP | BF_ADJUST; - if(IsVertical()) - { - rect.right = rect.left + m_cxyHeader; - uBorder |= BF_BOTTOM; - } - else - { - rect.bottom = rect.top + m_cxyHeader; - uBorder |= BF_RIGHT; - } - - if((m_dwExtendedStyle & PANECNT_NOBORDER) == 0) - { - if((m_dwExtendedStyle & PANECNT_FLATBORDER) != 0) - uBorder |= BF_FLAT; - dc.DrawEdge(&rect, EDGE_ETCHED, uBorder); - } - dc.FillRect(&rect, COLOR_3DFACE); - - if(!IsVertical()) // draw title only for horizontal pane container - { - dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT)); - dc.SetBkMode(TRANSPARENT); - T* pT = static_cast(this); - HFONT hFontOld = dc.SelectFont(pT->GetTitleFont()); - rect.left += m_cxyTextOffset; - rect.right -= m_cxyTextOffset; - if(m_tb.m_hWnd != NULL) - rect.right -= m_cxToolBar;; -#ifndef _WIN32_WCE - dc.DrawText(m_szTitle, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS); -#else // CE specific - dc.DrawText(m_szTitle, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER); -#endif // _WIN32_WCE - dc.SelectFont(hFontOld); - } - } - - // called only if pane is empty - void DrawPane(CDCHandle dc) - { - RECT rect = { 0 }; - GetClientRect(&rect); - if(IsVertical()) - rect.left += m_cxyHeader; - else - rect.top += m_cxyHeader; - if((GetExStyle() & WS_EX_CLIENTEDGE) == 0) - dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - dc.FillRect(&rect, COLOR_APPWORKSPACE); - } - - // drawing helper - draws "x" button image - void DrawButtonImage(CDCHandle dc, RECT& rcImage, HPEN hPen) - { -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - HPEN hPenOld = dc.SelectPen(hPen); - - dc.MoveTo(rcImage.left, rcImage.top); - dc.LineTo(rcImage.right, rcImage.bottom); - dc.MoveTo(rcImage.left + 1, rcImage.top); - dc.LineTo(rcImage.right + 1, rcImage.bottom); - - dc.MoveTo(rcImage.left, rcImage.bottom - 1); - dc.LineTo(rcImage.right, rcImage.top - 1); - dc.MoveTo(rcImage.left + 1, rcImage.bottom - 1); - dc.LineTo(rcImage.right + 1, rcImage.top - 1); - - dc.SelectPen(hPenOld); -#else // (_WIN32_WCE < 400) - rcImage; - hPen; - // no support for the "x" button image -#endif // (_WIN32_WCE < 400) - } - - bool IsVertical() const - { - return ((m_dwExtendedStyle & PANECNT_VERTICAL) != 0); - } -}; - -class CPaneContainer : public CPaneContainerImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_PaneContainer"), 0, -1) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSortListViewCtrl - implements sorting for a listview control - -// sort listview extended styles -#define SORTLV_USESHELLBITMAPS 0x00000001 - -// Notification sent to parent when sort column is changed by user clicking header. -#define SLVN_SORTCHANGED LVN_LAST - -// A LPNMSORTLISTVIEW is sent with the SLVN_SORTCHANGED notification -typedef struct tagNMSORTLISTVIEW -{ - NMHDR hdr; - int iNewSortColumn; - int iOldSortColumn; -} NMSORTLISTVIEW, *LPNMSORTLISTVIEW; - -// Column sort types. Can be set on a per-column basis with the SetColumnSortType method. -enum -{ - LVCOLSORT_NONE, - LVCOLSORT_TEXT, // default - LVCOLSORT_TEXTNOCASE, - LVCOLSORT_LONG, - LVCOLSORT_DOUBLE, - LVCOLSORT_DECIMAL, - LVCOLSORT_DATETIME, - LVCOLSORT_DATE, - LVCOLSORT_TIME, - LVCOLSORT_CUSTOM, - LVCOLSORT_LAST = LVCOLSORT_CUSTOM -}; - - -template -class CSortListViewImpl -{ -public: - enum - { - m_cchCmpTextMax = 32, // overrideable - m_cxSortImage = 16, - m_cySortImage = 15, - m_cxSortArrow = 11, - m_cySortArrow = 6, - m_iSortUp = 0, // index of sort bitmaps - m_iSortDown = 1, - m_nShellSortUpID = 133 - }; - - // passed to LVCompare functions as lParam1 and lParam2 - struct LVCompareParam - { - int iItem; - DWORD_PTR dwItemData; - union - { - long lValue; - double dblValue; - DECIMAL decValue; - LPCTSTR pszValue; - }; - }; - - // passed to LVCompare functions as the lParamSort parameter - struct LVSortInfo - { - T* pT; - int iSortCol; - bool bDescending; - }; - - bool m_bSortDescending; - bool m_bCommCtrl6; - int m_iSortColumn; - CBitmap m_bmSort[2]; - int m_fmtOldSortCol; - HBITMAP m_hbmOldSortCol; - DWORD m_dwSortLVExtendedStyle; - ATL::CSimpleArray m_arrColSortType; - bool m_bUseWaitCursor; - - CSortListViewImpl() : - m_bSortDescending(false), - m_bCommCtrl6(false), - m_iSortColumn(-1), - m_fmtOldSortCol(0), - m_hbmOldSortCol(NULL), - m_dwSortLVExtendedStyle(SORTLV_USESHELLBITMAPS), - m_bUseWaitCursor(true) - { -#ifndef _WIN32_WCE - DWORD dwMajor = 0; - DWORD dwMinor = 0; - HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - m_bCommCtrl6 = SUCCEEDED(hRet) && dwMajor >= 6; -#endif // !_WIN32_WCE - } - -// Attributes - void SetSortColumn(int iCol) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - CHeaderCtrl header = pT->GetHeader(); - ATLASSERT(header.m_hWnd != NULL); - ATLASSERT(iCol >= -1 && iCol < m_arrColSortType.GetSize()); - - int iOldSortCol = m_iSortColumn; - m_iSortColumn = iCol; - if(m_bCommCtrl6) - { -#ifndef HDF_SORTUP - const int HDF_SORTUP = 0x0400; -#endif // HDF_SORTUP -#ifndef HDF_SORTDOWN - const int HDF_SORTDOWN = 0x0200; -#endif // HDF_SORTDOWN - const int nMask = HDF_SORTUP | HDF_SORTDOWN; - HDITEM hditem = { HDI_FORMAT }; - if(iOldSortCol != iCol && iOldSortCol >= 0 && header.GetItem(iOldSortCol, &hditem)) - { - hditem.fmt &= ~nMask; - header.SetItem(iOldSortCol, &hditem); - } - if(iCol >= 0 && header.GetItem(iCol, &hditem)) - { - hditem.fmt &= ~nMask; - hditem.fmt |= m_bSortDescending ? HDF_SORTDOWN : HDF_SORTUP; - header.SetItem(iCol, &hditem); - } - return; - } - - if(m_bmSort[m_iSortUp].IsNull()) - pT->CreateSortBitmaps(); - - // restore previous sort column's bitmap, if any, and format - HDITEM hditem = { HDI_BITMAP | HDI_FORMAT }; - if(iOldSortCol != iCol && iOldSortCol >= 0) - { - hditem.hbm = m_hbmOldSortCol; - hditem.fmt = m_fmtOldSortCol; - header.SetItem(iOldSortCol, &hditem); - } - - // save new sort column's bitmap and format, and add our sort bitmap - if(iCol >= 0 && header.GetItem(iCol, &hditem)) - { - if(iOldSortCol != iCol) - { - m_fmtOldSortCol = hditem.fmt; - m_hbmOldSortCol = hditem.hbm; - } - hditem.fmt &= ~HDF_IMAGE; - hditem.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT; - int i = m_bSortDescending ? m_iSortDown : m_iSortUp; - hditem.hbm = m_bmSort[i]; - header.SetItem(iCol, &hditem); - } - } - - int GetSortColumn() const - { - return m_iSortColumn; - } - - void SetColumnSortType(int iCol, WORD wType) - { - ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); - ATLASSERT(wType >= LVCOLSORT_NONE && wType <= LVCOLSORT_LAST); - m_arrColSortType[iCol] = wType; - } - - WORD GetColumnSortType(int iCol) const - { - ATLASSERT((iCol >= 0) && iCol < m_arrColSortType.GetSize()); - return m_arrColSortType[iCol]; - } - - int GetColumnCount() const - { - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - CHeaderCtrl header = pT->GetHeader(); - return header.m_hWnd != NULL ? header.GetItemCount() : 0; - } - - bool IsSortDescending() const - { - return m_bSortDescending; - } - - DWORD GetSortListViewExtendedStyle() const - { - return m_dwSortLVExtendedStyle; - } - - DWORD SetSortListViewExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwSortLVExtendedStyle; - if(dwMask == 0) - m_dwSortLVExtendedStyle = dwExtendedStyle; - else - m_dwSortLVExtendedStyle = (m_dwSortLVExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - -// Operations - bool DoSortItems(int iCol, bool bDescending = false) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); - - WORD wType = m_arrColSortType[iCol]; - if(wType == LVCOLSORT_NONE) - return false; - - int nCount = pT->GetItemCount(); - if(nCount < 2) - { - m_bSortDescending = bDescending; - SetSortColumn(iCol); - return true; - } - - CWaitCursor waitCursor(false); - if(m_bUseWaitCursor) - waitCursor.Set(); - - LVCompareParam* pParam = NULL; - ATLTRY(pParam = new LVCompareParam[nCount]); - PFNLVCOMPARE pFunc = NULL; - TCHAR pszTemp[pT->m_cchCmpTextMax]; - bool bStrValue = false; - - switch(wType) - { - case LVCOLSORT_TEXT: - pFunc = (PFNLVCOMPARE)pT->LVCompareText; - case LVCOLSORT_TEXTNOCASE: - if(pFunc == NULL) - pFunc = (PFNLVCOMPARE)pT->LVCompareTextNoCase; - case LVCOLSORT_CUSTOM: - { - if(pFunc == NULL) - pFunc = (PFNLVCOMPARE)pT->LVCompareCustom; - - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pParam[i].pszValue = new TCHAR[pT->m_cchCmpTextMax]; - pT->GetItemText(i, iCol, (LPTSTR)pParam[i].pszValue, pT->m_cchCmpTextMax); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - bStrValue = true; - } - break; - case LVCOLSORT_LONG: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareLong; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pParam[i].lValue = pT->StrToLong(pszTemp); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - case LVCOLSORT_DOUBLE: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pParam[i].dblValue = pT->StrToDouble(pszTemp); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - case LVCOLSORT_DECIMAL: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareDecimal; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pT->StrToDecimal(pszTemp, &pParam[i].decValue); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - case LVCOLSORT_DATETIME: - case LVCOLSORT_DATE: - case LVCOLSORT_TIME: - { - pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; - DWORD dwFlags = LOCALE_NOUSEROVERRIDE; - if(wType == LVCOLSORT_DATE) - dwFlags |= VAR_DATEVALUEONLY; - else if(wType == LVCOLSORT_TIME) - dwFlags |= VAR_TIMEVALUEONLY; - for(int i = 0; i < nCount; i++) - { - pParam[i].iItem = i; - pParam[i].dwItemData = pT->GetItemData(i); - pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); - pParam[i].dblValue = pT->DateStrToDouble(pszTemp, dwFlags); - pT->SetItemData(i, (DWORD_PTR)&pParam[i]); - } - } - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown value for sort type in CSortListViewImpl::DoSortItems()\n")); - break; - } // switch(wType) - - ATLASSERT(pFunc != NULL); - LVSortInfo lvsi = { pT, iCol, bDescending }; - bool bRet = ((BOOL)pT->DefWindowProc(LVM_SORTITEMS, (WPARAM)&lvsi, (LPARAM)pFunc) != FALSE); - for(int i = 0; i < nCount; i++) - { - DWORD_PTR dwItemData = pT->GetItemData(i); - LVCompareParam* p = (LVCompareParam*)dwItemData; - ATLASSERT(p != NULL); - if(bStrValue) - delete [] (TCHAR*)p->pszValue; - pT->SetItemData(i, p->dwItemData); - } - delete [] pParam; - - if(bRet) - { - m_bSortDescending = bDescending; - SetSortColumn(iCol); - } - - if(m_bUseWaitCursor) - waitCursor.Restore(); - - return bRet; - } - - void CreateSortBitmaps() - { - if((m_dwSortLVExtendedStyle & SORTLV_USESHELLBITMAPS) != 0) - { - bool bFree = false; - LPCTSTR pszModule = _T("shell32.dll"); - HINSTANCE hShell = ::GetModuleHandle(pszModule); - - if (hShell == NULL) - { - hShell = ::LoadLibrary(pszModule); - bFree = true; - } - - if (hShell != NULL) - { - bool bSuccess = true; - for(int i = m_iSortUp; i <= m_iSortDown; i++) - { - if(!m_bmSort[i].IsNull()) - m_bmSort[i].DeleteObject(); - m_bmSort[i] = (HBITMAP)::LoadImage(hShell, MAKEINTRESOURCE(m_nShellSortUpID + i), -#ifndef _WIN32_WCE - IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); -#else // CE specific - IMAGE_BITMAP, 0, 0, 0); -#endif // _WIN32_WCE - if(m_bmSort[i].IsNull()) - { - bSuccess = false; - break; - } - } - if(bFree) - ::FreeLibrary(hShell); - if(bSuccess) - return; - } - } - - T* pT = static_cast(this); - for(int i = m_iSortUp; i <= m_iSortDown; i++) - { - if(!m_bmSort[i].IsNull()) - m_bmSort[i].DeleteObject(); - - CDC dcMem; - CClientDC dc(::GetDesktopWindow()); - dcMem.CreateCompatibleDC(dc.m_hDC); - m_bmSort[i].CreateCompatibleBitmap(dc.m_hDC, m_cxSortImage, m_cySortImage); - HBITMAP hbmOld = dcMem.SelectBitmap(m_bmSort[i]); - RECT rc = {0,0,m_cxSortImage, m_cySortImage}; - pT->DrawSortBitmap(dcMem.m_hDC, i, &rc); - dcMem.SelectBitmap(hbmOld); - dcMem.DeleteDC(); - } - } - - void NotifyParentSortChanged(int iNewSortCol, int iOldSortCol) - { - T* pT = static_cast(this); - int nID = pT->GetDlgCtrlID(); - NMSORTLISTVIEW nm = { { pT->m_hWnd, nID, SLVN_SORTCHANGED }, iNewSortCol, iOldSortCol }; - ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nID, (LPARAM)&nm); - } - -// Overrideables - int CompareItemsCustom(LVCompareParam* /*pItem1*/, LVCompareParam* /*pItem2*/, int /*iSortCol*/) - { - // pItem1 and pItem2 contain valid iItem, dwItemData, and pszValue members. - // If item1 > item2 return 1, if item1 < item2 return -1, else return 0. - return 0; - } - - void DrawSortBitmap(CDCHandle dc, int iBitmap, LPRECT prc) - { - dc.FillRect(prc, ::GetSysColorBrush(COLOR_BTNFACE)); - HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); - CPen pen; - pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNSHADOW)); - HPEN hpenOld = dc.SelectPen(pen); - POINT ptOrg = { (m_cxSortImage - m_cxSortArrow) / 2, (m_cySortImage - m_cySortArrow) / 2 }; - if(iBitmap == m_iSortUp) - { - POINT pts[3] = - { - { ptOrg.x + m_cxSortArrow / 2, ptOrg.y }, - { ptOrg.x, ptOrg.y + m_cySortArrow - 1 }, - { ptOrg.x + m_cxSortArrow - 1, ptOrg.y + m_cySortArrow - 1 } - }; - dc.Polygon(pts, 3); - } - else - { - POINT pts[3] = - { - { ptOrg.x, ptOrg.y }, - { ptOrg.x + m_cxSortArrow / 2, ptOrg.y + m_cySortArrow - 1 }, - { ptOrg.x + m_cxSortArrow - 1, ptOrg.y } - }; - dc.Polygon(pts, 3); - } - dc.SelectBrush(hbrOld); - dc.SelectPen(hpenOld); - } - - double DateStrToDouble(LPCTSTR lpstr, DWORD dwFlags) - { - ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) - return 0; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - DATE dRet = 0; - if (FAILED(hRet = ::VarDateFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, dwFlags, &dRet))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarDateFromStr failed with result of 0x%8.8X\n"), hRet); - dRet = 0; - } - return dRet; - } - - long StrToLong(LPCTSTR lpstr) - { - ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) - return 0; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - long lRet = 0; - if (FAILED(hRet = ::VarI4FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &lRet))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarI4FromStr failed with result of 0x%8.8X\n"), hRet); - lRet = 0; - } - return lRet; - } - - double StrToDouble(LPCTSTR lpstr) - { - ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) - return 0; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - double dblRet = 0; - if (FAILED(hRet = ::VarR8FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &dblRet))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarR8FromStr failed with result of 0x%8.8X\n"), hRet); - dblRet = 0; - } - return dblRet; - } - - bool StrToDecimal(LPCTSTR lpstr, DECIMAL* pDecimal) - { - ATLASSERT(lpstr != NULL); - ATLASSERT(pDecimal != NULL); - if(lpstr == NULL || pDecimal == NULL) - return false; - - USES_CONVERSION; - HRESULT hRet = E_FAIL; - if (FAILED(hRet = ::VarDecFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, pDecimal))) - { - ATLTRACE2(atlTraceUI, 0, _T("VarDecFromStr failed with result of 0x%8.8X\n"), hRet); - pDecimal->Lo64 = 0; - pDecimal->Hi32 = 0; - pDecimal->signscale = 0; - return false; - } - return true; - } - -// Overrideable PFNLVCOMPARE functions - static int CALLBACK LVCompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = lstrcmp(pParam1->pszValue, pParam2->pszValue); - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareTextNoCase(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = lstrcmpi(pParam1->pszValue, pParam2->pszValue); - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareLong(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = 0; - if(pParam1->lValue > pParam2->lValue) - nRet = 1; - else if(pParam1->lValue < pParam2->lValue) - nRet = -1; - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareDouble(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = 0; - if(pParam1->dblValue > pParam2->dblValue) - nRet = 1; - else if(pParam1->dblValue < pParam2->dblValue) - nRet = -1; - return pInfo->bDescending ? -nRet : nRet; - } - - static int CALLBACK LVCompareCustom(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = pInfo->pT->CompareItemsCustom(pParam1, pParam2, pInfo->iSortCol); - return pInfo->bDescending ? -nRet : nRet; - } - -#ifndef _WIN32_WCE - static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = (int)::VarDecCmp(&pParam1->decValue, &pParam2->decValue); - nRet--; - return pInfo->bDescending ? -nRet : nRet; - } -#else - // Compare mantissas, ignore sign and scale - static int CompareMantissas(const DECIMAL& decLeft, const DECIMAL& decRight) - { - if (decLeft.Hi32 < decRight.Hi32) - { - return -1; - } - if (decLeft.Hi32 > decRight.Hi32) - { - return 1; - } - // Here, decLeft.Hi32 == decRight.Hi32 - if (decLeft.Lo64 < decRight.Lo64) - { - return -1; - } - if (decLeft.Lo64 > decRight.Lo64) - { - return 1; - } - return 0; - } - - // return values: VARCMP_LT, VARCMP_EQ, VARCMP_GT, VARCMP_NULL - static HRESULT VarDecCmp(const DECIMAL* pdecLeft, const DECIMAL* pdecRight) - { - static const ULONG powersOfTen[] = - { - 10ul, - 100ul, - 1000ul, - 10000ul, - 100000ul, - 1000000ul, - 10000000ul, - 100000000ul, - 1000000000ul - }; - static const int largestPower = sizeof(powersOfTen) / sizeof(powersOfTen[0]); - if (!pdecLeft || !pdecRight) - { - return VARCMP_NULL; - } - - // Degenerate case - at least one comparand is of the form - // [+-]0*10^N (denormalized zero) - bool bLeftZero = (!pdecLeft->Lo64 && !pdecLeft->Hi32); - bool bRightZero = (!pdecRight->Lo64 && !pdecRight->Hi32); - if (bLeftZero && bRightZero) - { - return VARCMP_EQ; - } - bool bLeftNeg = ((pdecLeft->sign & DECIMAL_NEG) != 0); - bool bRightNeg = ((pdecRight->sign & DECIMAL_NEG) != 0); - if (bLeftZero) - { - return (bRightNeg ? VARCMP_GT : VARCMP_LT); - } - // This also covers the case where the comparands have different signs - if (bRightZero || bLeftNeg != bRightNeg) - { - return (bLeftNeg ? VARCMP_LT : VARCMP_GT); - } - - // Here both comparands have the same sign and need to be compared - // on mantissa and scale. The result is obvious when - // 1. Scales are equal (then compare mantissas) - // 2. A number with smaller scale is also the one with larger mantissa - // (then this number is obviously larger) - // In the remaining case, we would multiply the number with smaller - // scale by 10 and simultaneously increment its scale (which amounts to - // adding trailing zeros after decimal point), until the numbers fall under - // one of the two cases above - DECIMAL temp; - bool bInvert = bLeftNeg; // the final result needs to be inverted - if (pdecLeft->scale < pdecRight->scale) - { - temp = *pdecLeft; - } - else - { - temp = *pdecRight; - pdecRight = pdecLeft; - bInvert = !bInvert; - } - - // Now temp is the number with smaller (or equal) scale, and - // we can modify it freely without touching original parameters - int comp; - while ((comp = CompareMantissas(temp, *pdecRight)) < 0 && - temp.scale < pdecRight->scale) - { - // Multiply by an appropriate power of 10 - int scaleDiff = pdecRight->scale - temp.scale; - if (scaleDiff > largestPower) - { - // Keep the multiplier representable in 32bit - scaleDiff = largestPower; - } - DWORDLONG power = powersOfTen[scaleDiff - 1]; - // Multiply temp's mantissa by power - DWORDLONG product = temp.Lo32 * power; - ULONG carry = static_cast(product >> 32); - temp.Lo32 = static_cast(product); - product = temp.Mid32 * power + carry; - carry = static_cast(product >> 32); - temp.Mid32 = static_cast(product); - product = temp.Hi32 * power + carry; - if (static_cast(product >> 32)) - { - // Multiplication overflowed - pdecLeft is clearly larger - break; - } - temp.Hi32 = static_cast(product); - temp.scale = (BYTE)(temp.scale + scaleDiff); - } - if (temp.scale < pdecRight->scale) - { - comp = 1; - } - if (bInvert) - { - comp = -comp; - } - return (comp > 0 ? VARCMP_GT : comp < 0 ? VARCMP_LT : VARCMP_EQ); - } - - static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = (int)VarDecCmp(&pParam1->decValue, &pParam2->decValue); - nRet--; - return pInfo->bDescending ? -nRet : nRet; - } -#endif // !_WIN32_WCE - - BEGIN_MSG_MAP(CSortListViewImpl) - MESSAGE_HANDLER(LVM_INSERTCOLUMN, OnInsertColumn) - MESSAGE_HANDLER(LVM_DELETECOLUMN, OnDeleteColumn) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, OnHeaderItemClick) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, OnHeaderItemClick) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - END_MSG_MAP() - - LRESULT OnInsertColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == -1) - return -1; - - WORD wType = 0; - m_arrColSortType.Add(wType); - int nCount = m_arrColSortType.GetSize(); - ATLASSERT(nCount == GetColumnCount()); - - for(int i = nCount - 1; i > lRet; i--) - m_arrColSortType[i] = m_arrColSortType[i - 1]; - m_arrColSortType[(int)lRet] = LVCOLSORT_TEXT; - - if(lRet <= m_iSortColumn) - m_iSortColumn++; - - return lRet; - } - - LRESULT OnDeleteColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == 0) - return 0; - - int iCol = (int)wParam; - if(m_iSortColumn == iCol) - m_iSortColumn = -1; - else if(m_iSortColumn > iCol) - m_iSortColumn--; - m_arrColSortType.RemoveAt(iCol); - - return lRet; - } - - LRESULT OnHeaderItemClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LPNMHEADER p = (LPNMHEADER)pnmh; - if(p->iButton == 0) - { - int iOld = m_iSortColumn; - bool bDescending = (m_iSortColumn == p->iItem) ? !m_bSortDescending : false; - if(DoSortItems(p->iItem, bDescending)) - NotifyParentSortChanged(p->iItem, iOld); - } - bHandled = FALSE; - return 0; - } - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifndef _WIN32_WCE - if(wParam == SPI_SETNONCLIENTMETRICS) - GetSystemSettings(); -#else // CE specific - wParam; // avoid level 4 warning - GetSystemSettings(); -#endif // _WIN32_WCE - bHandled = FALSE; - return 0; - } - - void GetSystemSettings() - { - if(!m_bCommCtrl6 && !m_bmSort[m_iSortUp].IsNull()) - { - T* pT = static_cast(this); - pT->CreateSortBitmaps(); - if(m_iSortColumn != -1) - SetSortColumn(m_iSortColumn); - } - } - -}; - - -typedef ATL::CWinTraits CSortListViewCtrlTraits; - -template -class ATL_NO_VTABLE CSortListViewCtrlImpl: public ATL::CWindowImpl, public CSortListViewImpl -{ -public: - DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) - - bool SortItems(int iCol, bool bDescending = false) - { - return DoSortItems(iCol, bDescending); - } - - BEGIN_MSG_MAP(CSortListViewCtrlImpl) - MESSAGE_HANDLER(LVM_INSERTCOLUMN, CSortListViewImpl::OnInsertColumn) - MESSAGE_HANDLER(LVM_DELETECOLUMN, CSortListViewImpl::OnDeleteColumn) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, CSortListViewImpl::OnHeaderItemClick) - NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, CSortListViewImpl::OnHeaderItemClick) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CSortListViewImpl::OnSettingChange) - END_MSG_MAP() -}; - -class CSortListViewCtrl : public CSortListViewCtrlImpl -{ -public: - DECLARE_WND_SUPERCLASS(_T("WTL_SortListViewCtrl"), GetWndClassName()) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTabView - implements tab view window - -// TabView Notifications -#define TBVN_PAGEACTIVATED (0U-741) -#define TBVN_CONTEXTMENU (0U-742) - -// Notification data for TBVN_CONTEXTMENU -struct TBVCONTEXTMENUINFO -{ - NMHDR hdr; - POINT pt; -}; - -typedef TBVCONTEXTMENUINFO* LPTBVCONTEXTMENUINFO; - - -template -class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) - -// Declarations and enums - struct TABVIEWPAGE - { - HWND hWnd; - LPTSTR lpstrTitle; - LPVOID pData; - }; - - struct TCITEMEXTRA - { - TCITEMHEADER tciheader; - TABVIEWPAGE tvpage; - - operator LPTCITEM() { return (LPTCITEM)this; } - }; - - enum - { - m_nTabID = 1313, - m_cxMoveMark = 6, - m_cyMoveMark = 3, - m_nMenuItemsMax = (ID_WINDOW_TABLAST - ID_WINDOW_TABFIRST + 1) - }; - -// Data members - ATL::CContainedWindowT m_tab; - int m_cyTabHeight; - - int m_nActivePage; - - int m_nInsertItem; - POINT m_ptStartDrag; - - CMenuHandle m_menu; - - int m_cchTabTextLength; - - int m_nMenuItemsCount; - - ATL::CWindow m_wndTitleBar; - LPTSTR m_lpstrTitleBarBase; - int m_cchTitleBarLength; - - CImageList m_ilDrag; - - bool m_bDestroyPageOnRemove:1; - bool m_bDestroyImageList:1; - bool m_bActivePageMenuItem:1; - bool m_bActiveAsDefaultMenuItem:1; - bool m_bEmptyMenuItem:1; - bool m_bWindowsMenuItem:1; - // internal - bool m_bTabCapture:1; - bool m_bTabDrag:1; - -// Constructor/destructor - CTabViewImpl() : - m_nActivePage(-1), - m_cyTabHeight(0), - m_tab(this, 1), - m_nInsertItem(-1), - m_cchTabTextLength(30), - m_nMenuItemsCount(10), - m_lpstrTitleBarBase(NULL), - m_cchTitleBarLength(100), - m_bDestroyPageOnRemove(true), - m_bDestroyImageList(true), - m_bActivePageMenuItem(true), - m_bActiveAsDefaultMenuItem(false), - m_bEmptyMenuItem(false), - m_bWindowsMenuItem(false), - m_bTabCapture(false), - m_bTabDrag(false) - { - m_ptStartDrag.x = 0; - m_ptStartDrag.y = 0; - } - - ~CTabViewImpl() - { - delete [] m_lpstrTitleBarBase; - } - -// Message filter function - to be called from PreTranslateMessage of the main window - BOOL PreTranslateMessage(MSG* pMsg) - { - if(IsWindow() == FALSE) - return FALSE; - - BOOL bRet = FALSE; - - // Check for TabView built-in accelerators (Ctrl+Tab/Ctrl+Shift+Tab - next/previous page) - int nCount = GetPageCount(); - if(nCount > 0) - { - bool bControl = (::GetKeyState(VK_CONTROL) < 0); - if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) && bControl) - { - if(nCount > 1) - { - int nPage = m_nActivePage; - bool bShift = (::GetKeyState(VK_SHIFT) < 0); - if(bShift) - nPage = (nPage > 0) ? (nPage - 1) : (nCount - 1); - else - nPage = ((nPage >= 0) && (nPage < (nCount - 1))) ? (nPage + 1) : 0; - - SetActivePage(nPage); - T* pT = static_cast(this); - pT->OnPageActivated(m_nActivePage); - } - - bRet = TRUE; - } - } - - // If we are doing drag-drop, check for Escape key that cancels it - if(bRet == FALSE) - { - if(m_bTabCapture && pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) - { - ::ReleaseCapture(); - bRet = TRUE; - } - } - - // Pass the message to the active page - if(bRet == FALSE) - { - if(m_nActivePage != -1) - bRet = (BOOL)::SendMessage(GetPageHWND(m_nActivePage), WM_FORWARDMSG, 0, (LPARAM)pMsg); - } - - return bRet; - } - -// Attributes - int GetPageCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_tab.GetItemCount(); - } - - int GetActivePage() const - { - return m_nActivePage; - } - - void SetActivePage(int nPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - SetRedraw(FALSE); - - if(m_nActivePage != -1) - ::ShowWindow(GetPageHWND(m_nActivePage), FALSE); - m_nActivePage = nPage; - m_tab.SetCurSel(m_nActivePage); - ::ShowWindow(GetPageHWND(m_nActivePage), TRUE); - - pT->UpdateLayout(); - - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - - if(::GetFocus() != m_tab.m_hWnd) - ::SetFocus(GetPageHWND(m_nActivePage)); - - pT->UpdateTitleBar(); - pT->UpdateMenu(); - } - - HIMAGELIST GetImageList() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_tab.GetImageList(); - } - - HIMAGELIST SetImageList(HIMAGELIST hImageList) - { - ATLASSERT(::IsWindow(m_hWnd)); - return m_tab.SetImageList(hImageList); - } - - void SetWindowMenu(HMENU hMenu) - { - ATLASSERT(::IsWindow(m_hWnd)); - - m_menu = hMenu; - - T* pT = static_cast(this); - pT->UpdateMenu(); - } - - void SetTitleBarWindow(HWND hWnd) - { - ATLASSERT(::IsWindow(m_hWnd)); - - delete [] m_lpstrTitleBarBase; - m_lpstrTitleBarBase = NULL; - - m_wndTitleBar = hWnd; - if(hWnd == NULL) - return; - - int cchLen = m_wndTitleBar.GetWindowTextLength() + 1; - ATLTRY(m_lpstrTitleBarBase = new TCHAR[cchLen]); - if(m_lpstrTitleBarBase != NULL) - { - m_wndTitleBar.GetWindowText(m_lpstrTitleBarBase, cchLen); - T* pT = static_cast(this); - pT->UpdateTitleBar(); - } - } - -// Page attributes - HWND GetPageHWND(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - m_tab.GetItem(nPage, tcix); - - return tcix.tvpage.hWnd; - } - - LPCTSTR GetPageTitle(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - if(m_tab.GetItem(nPage, tcix) == FALSE) - return NULL; - - return tcix.tvpage.lpstrTitle; - } - - bool SetPageTitle(int nPage, LPCTSTR lpstrTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - int cchBuff = lstrlen(lpstrTitle) + 1; - LPTSTR lpstrBuff = NULL; - ATLTRY(lpstrBuff = new TCHAR[cchBuff]); - if(lpstrBuff == NULL) - return false; - - SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - if(m_tab.GetItem(nPage, tcix) == FALSE) - return false; - - CTempBuffer buff; - LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); - if(lpstrTabText == NULL) - return false; - - delete [] tcix.tvpage.lpstrTitle; - - pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); - - tcix.tciheader.mask = TCIF_TEXT | TCIF_PARAM; - tcix.tciheader.pszText = lpstrTabText; - tcix.tvpage.lpstrTitle = lpstrBuff; - if(m_tab.SetItem(nPage, tcix) == FALSE) - return false; - - pT->UpdateTitleBar(); - pT->UpdateMenu(); - - return true; - } - - LPVOID GetPageData(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - m_tab.GetItem(nPage, tcix); - - return tcix.tvpage.pData; - } - - LPVOID SetPageData(int nPage, LPVOID pData) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_PARAM; - m_tab.GetItem(nPage, tcix); - LPVOID pDataOld = tcix.tvpage.pData; - - tcix.tvpage.pData = pData; - m_tab.SetItem(nPage, tcix); - - return pDataOld; - } - - int GetPageImage(int nPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_IMAGE; - m_tab.GetItem(nPage, tcix); - - return tcix.tciheader.iImage; - } - - int SetPageImage(int nPage, int nImage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_IMAGE; - m_tab.GetItem(nPage, tcix); - int nImageOld = tcix.tciheader.iImage; - - tcix.tciheader.iImage = nImage; - m_tab.SetItem(nPage, tcix); - - return nImageOld; - } - -// Operations - bool AddPage(HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) - { - return InsertPage(GetPageCount(), hWndView, lpstrTitle, nImage, pData); - } - - bool InsertPage(int nPage, HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPage == GetPageCount() || IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - int cchBuff = lstrlen(lpstrTitle) + 1; - LPTSTR lpstrBuff = NULL; - ATLTRY(lpstrBuff = new TCHAR[cchBuff]); - if(lpstrBuff == NULL) - return false; - - SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); - - CTempBuffer buff; - LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); - if(lpstrTabText == NULL) - return false; - - pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); - - SetRedraw(FALSE); - - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; - tcix.tciheader.pszText = lpstrTabText; - tcix.tciheader.iImage = nImage; - tcix.tvpage.hWnd = hWndView; - tcix.tvpage.lpstrTitle = lpstrBuff; - tcix.tvpage.pData = pData; - int nItem = m_tab.InsertItem(nPage, tcix); - if(nItem == -1) - { - delete [] lpstrBuff; - SetRedraw(TRUE); - return false; - } - - SetActivePage(nItem); - pT->OnPageActivated(m_nActivePage); - - if(GetPageCount() == 1) - pT->ShowTabControl(true); - - pT->UpdateLayout(); - - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - - return true; - } - - void RemovePage(int nPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(IsValidPageIndex(nPage)); - - T* pT = static_cast(this); - - SetRedraw(FALSE); - - if(GetPageCount() == 1) - pT->ShowTabControl(false); - - if(m_bDestroyPageOnRemove) - ::DestroyWindow(GetPageHWND(nPage)); - else - ::ShowWindow(GetPageHWND(nPage), FALSE); - LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(nPage); - delete [] lpstrTitle; - - ATLVERIFY(m_tab.DeleteItem(nPage) != FALSE); - - if(m_nActivePage == nPage) - { - m_nActivePage = -1; - - if(nPage > 0) - { - SetActivePage(nPage - 1); - } - else if(GetPageCount() > 0) - { - SetActivePage(nPage); - } - else - { - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); - pT->UpdateTitleBar(); - pT->UpdateMenu(); - } - } - else - { - nPage = (nPage < m_nActivePage) ? (m_nActivePage - 1) : m_nActivePage; - m_nActivePage = -1; - SetActivePage(nPage); - } - - pT->OnPageActivated(m_nActivePage); - } - - void RemoveAllPages() - { - ATLASSERT(::IsWindow(m_hWnd)); - - if(GetPageCount() == 0) - return; - - T* pT = static_cast(this); - - SetRedraw(FALSE); - - pT->ShowTabControl(false); - - for(int i = 0; i < GetPageCount(); i++) - { - if(m_bDestroyPageOnRemove) - ::DestroyWindow(GetPageHWND(i)); - else - ::ShowWindow(GetPageHWND(i), FALSE); - LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(i); - delete [] lpstrTitle; - } - m_tab.DeleteAllItems(); - - m_nActivePage = -1; - pT->OnPageActivated(m_nActivePage); - - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); - - pT->UpdateTitleBar(); - pT->UpdateMenu(); - } - - int PageIndexFromHwnd(HWND hWnd) const - { - int nIndex = -1; - - for(int i = 0; i < GetPageCount(); i++) - { - if(GetPageHWND(i) == hWnd) - { - nIndex = i; - break; - } - } - - return nIndex; - } - - void BuildWindowMenu(HMENU hMenu, int nMenuItemsCount = 10, bool bEmptyMenuItem = true, bool bWindowsMenuItem = true, bool bActivePageMenuItem = true, bool bActiveAsDefaultMenuItem = false) - { - ATLASSERT(::IsWindow(m_hWnd)); - - CMenuHandle menu = hMenu; - T* pT = static_cast(this); - pT; // avoid level 4 warning - int nFirstPos = 0; - - // Find first menu item in our range -#ifndef _WIN32_WCE - for(nFirstPos = 0; nFirstPos < menu.GetMenuItemCount(); nFirstPos++) - { - UINT nID = menu.GetMenuItemID(nFirstPos); - if((nID >= ID_WINDOW_TABFIRST && nID <= ID_WINDOW_TABLAST) || nID == ID_WINDOW_SHOWTABLIST) - break; - } -#else // CE specific - for(nFirstPos = 0; ; nFirstPos++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_ID; - BOOL bRet = menu.GetMenuItemInfo(nFirstPos, TRUE, &mii); - if(bRet == FALSE) - break; - if((mii.wID >= ID_WINDOW_TABFIRST && mii.wID <= ID_WINDOW_TABLAST) || mii.wID == ID_WINDOW_SHOWTABLIST) - break; - } -#endif // _WIN32_WCE - - // Remove all menu items for tab pages - BOOL bRet = TRUE; - while(bRet != FALSE) - bRet = menu.DeleteMenu(nFirstPos, MF_BYPOSITION); - - // Add separator if it's not already there - int nPageCount = GetPageCount(); - if((bWindowsMenuItem || (nPageCount > 0)) && (nFirstPos > 0)) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE; - menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); - if((nFirstPos <= 0) || ((mii.fType & MFT_SEPARATOR) == 0)) - { - menu.AppendMenu(MF_SEPARATOR); - nFirstPos++; - } - } - - // Add menu items for all pages - if(nPageCount > 0) - { - // Append menu items for all pages - const int cchPrefix = 3; // 2 digits + space - nMenuItemsCount = min(min(nPageCount, nMenuItemsCount), (int)m_nMenuItemsMax); - ATLASSERT(nMenuItemsCount < 100); // 2 digits only - if(nMenuItemsCount >= 100) - nMenuItemsCount = 99; - - for(int i = 0; i < nMenuItemsCount; i++) - { - LPCTSTR lpstrTitle = GetPageTitle(i); - int nLen = lstrlen(lpstrTitle); - CTempBuffer buff; - LPTSTR lpstrText = buff.Allocate(cchPrefix + nLen + 1); - ATLASSERT(lpstrText != NULL); - if(lpstrText != NULL) - { - LPCTSTR lpstrFormat = (i < 9) ? _T("&%i %s") : _T("%i %s"); - SecureHelper::wsprintf_x(lpstrText, cchPrefix + nLen + 1, lpstrFormat, i + 1, lpstrTitle); - menu.AppendMenu(MF_STRING, ID_WINDOW_TABFIRST + i, lpstrText); - } - } - - // Mark active page - if(bActivePageMenuItem && (m_nActivePage != -1)) - { -#ifndef _WIN32_WCE - if(bActiveAsDefaultMenuItem) - { - menu.SetMenuDefaultItem((UINT)-1, TRUE); - menu.SetMenuDefaultItem(nFirstPos + m_nActivePage, TRUE); - } - else -#else // CE specific - bActiveAsDefaultMenuItem; // avoid level 4 warning -#endif // _WIN32_WCE - { - menu.CheckMenuRadioItem(nFirstPos, nFirstPos + nMenuItemsCount, nFirstPos + m_nActivePage, MF_BYPOSITION); - } - } - } - else - { - if(bEmptyMenuItem) - { - menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_TABFIRST, pT->GetEmptyListText()); - menu.EnableMenuItem(ID_WINDOW_TABFIRST, MF_GRAYED); - } - - // Remove separator if nothing else is there - if(!bEmptyMenuItem && !bWindowsMenuItem && (nFirstPos > 0)) - { - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE; - menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); - if((mii.fType & MFT_SEPARATOR) != 0) - menu.DeleteMenu(nFirstPos - 1, MF_BYPOSITION); - } - } - - // Add "Windows..." menu item - if(bWindowsMenuItem) - menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_SHOWTABLIST, pT->GetWindowsMenuItemText()); - } - -// Message map and handlers - BEGIN_MSG_MAP(CTabViewImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - NOTIFY_HANDLER(m_nTabID, TCN_SELCHANGE, OnTabChanged) - NOTIFY_ID_HANDLER(m_nTabID, OnTabNotification) -#ifndef _WIN32_WCE - NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, OnTabGetDispInfo) -#endif // !_WIN32_WCE - FORWARD_NOTIFICATIONS() - ALT_MSG_MAP(1) // tab control - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnTabLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnTabLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnTabCaptureChanged) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnTabMouseMove) - MESSAGE_HANDLER(WM_RBUTTONUP, OnTabRButtonUp) - MESSAGE_HANDLER(WM_SYSKEYDOWN, OnTabSysKeyDown) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->CreateTabControl(); - - return 0; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - RemoveAllPages(); - - if(m_bDestroyImageList) - { - CImageList il = m_tab.SetImageList(NULL); - if(il.m_hImageList != NULL) - il.Destroy(); - } - - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - return 0; - } - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_nActivePage != -1) - ::SetFocus(GetPageHWND(m_nActivePage)); - return 0; - } - - LRESULT OnTabChanged(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - SetActivePage(m_tab.GetCurSel()); - T* pT = static_cast(this); - pT->OnPageActivated(m_nActivePage); - - return 0; - } - - LRESULT OnTabNotification(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - // nothing to do - this just blocks all tab control - // notifications from being propagated further - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnTabGetDispInfo(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - LPNMTTDISPINFO pTTDI = (LPNMTTDISPINFO)pnmh; - if(pTTDI->hdr.hwndFrom == m_tab.GetTooltips()) - { - T* pT = static_cast(this); - pT->UpdateTooltipText(pTTDI); - } - else - { - bHandled = FALSE; - } - - return 0; - } -#endif // !_WIN32_WCE - -// Tab control message handlers - LRESULT OnTabLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_tab.GetItemCount() > 1) - { - m_bTabCapture = true; - m_tab.SetCapture(); - - m_ptStartDrag.x = GET_X_LPARAM(lParam); - m_ptStartDrag.y = GET_Y_LPARAM(lParam); - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnTabLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_bTabCapture) - { - if(m_bTabDrag) - { - TCHITTESTINFO hti = { 0 }; - hti.pt.x = GET_X_LPARAM(lParam); - hti.pt.y = GET_Y_LPARAM(lParam); - int nItem = m_tab.HitTest(&hti); - if(nItem != -1) - MovePage(m_nActivePage, nItem); - } - - ::ReleaseCapture(); - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnTabCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bTabCapture) - { - m_bTabCapture = false; - - if(m_bTabDrag) - { - m_bTabDrag = false; - T* pT = static_cast(this); - pT->DrawMoveMark(-1); - -#ifndef _WIN32_WCE - m_ilDrag.DragLeave(GetDesktopWindow()); -#endif // !_WIN32_WCE - m_ilDrag.EndDrag(); - - m_ilDrag.Destroy(); - m_ilDrag.m_hImageList = NULL; - } - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnTabMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - bHandled = FALSE; - - if(m_bTabCapture) - { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - - if(!m_bTabDrag) - { -#ifndef _WIN32_WCE - if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CXDRAG) || - abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CYDRAG)) -#else // CE specific - if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= 4 || - abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= 4) -#endif // _WIN32_WCE - { - T* pT = static_cast(this); - pT->GenerateDragImage(m_nActivePage); - - int cxCursor = ::GetSystemMetrics(SM_CXCURSOR); - int cyCursor = ::GetSystemMetrics(SM_CYCURSOR); - m_ilDrag.BeginDrag(0, -(cxCursor / 2), -(cyCursor / 2)); -#ifndef _WIN32_WCE - POINT ptEnter = m_ptStartDrag; - m_tab.ClientToScreen(&ptEnter); - m_ilDrag.DragEnter(GetDesktopWindow(), ptEnter); -#endif // !_WIN32_WCE - - m_bTabDrag = true; - } - } - - if(m_bTabDrag) - { - TCHITTESTINFO hti = { 0 }; - hti.pt = pt; - int nItem = m_tab.HitTest(&hti); - - T* pT = static_cast(this); - pT->SetMoveCursor(nItem != -1); - - if(m_nInsertItem != nItem) - pT->DrawMoveMark(nItem); - - m_ilDrag.DragShowNolock((nItem != -1) ? TRUE : FALSE); - m_tab.ClientToScreen(&pt); - m_ilDrag.DragMove(pt); - - bHandled = TRUE; - } - } - - return 0; - } - - LRESULT OnTabRButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - TCHITTESTINFO hti = { 0 }; - hti.pt.x = GET_X_LPARAM(lParam); - hti.pt.y = GET_Y_LPARAM(lParam); - int nItem = m_tab.HitTest(&hti); - if(nItem != -1) - { - T* pT = static_cast(this); - pT->OnContextMenu(nItem, hti.pt); - } - - return 0; - } - - LRESULT OnTabSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bool bShift = (::GetKeyState(VK_SHIFT) < 0); - if(wParam == VK_F10 && bShift) - { - if(m_nActivePage != -1) - { - RECT rect = { 0 }; - m_tab.GetItemRect(m_nActivePage, &rect); - POINT pt = { rect.left, rect.bottom }; - T* pT = static_cast(this); - pT->OnContextMenu(m_nActivePage, pt); - } - } - else - { - bHandled = FALSE; - } - - return 0; - } - -// Implementation helpers - bool IsValidPageIndex(int nPage) const - { - return (nPage >= 0 && nPage < GetPageCount()); - } - - bool MovePage(int nMovePage, int nInsertBeforePage) - { - ATLASSERT(IsValidPageIndex(nMovePage)); - ATLASSERT(IsValidPageIndex(nInsertBeforePage)); - - if(!IsValidPageIndex(nMovePage) || !IsValidPageIndex(nInsertBeforePage)) - return false; - - if(nMovePage == nInsertBeforePage) - return true; // nothing to do - - CTempBuffer buff; - LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); - if(lpstrTabText == NULL) - return false; - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; - tcix.tciheader.pszText = lpstrTabText; - tcix.tciheader.cchTextMax = m_cchTabTextLength + 1; - BOOL bRet = m_tab.GetItem(nMovePage, tcix); - ATLASSERT(bRet != FALSE); - if(bRet == FALSE) - return false; - - int nInsertItem = (nInsertBeforePage > nMovePage) ? nInsertBeforePage + 1 : nInsertBeforePage; - int nNewItem = m_tab.InsertItem(nInsertItem, tcix); - ATLASSERT(nNewItem == nInsertItem); - if(nNewItem != nInsertItem) - { - ATLVERIFY(m_tab.DeleteItem(nNewItem)); - return false; - } - - if(nMovePage > nInsertBeforePage) - ATLVERIFY(m_tab.DeleteItem(nMovePage + 1) != FALSE); - else if(nMovePage < nInsertBeforePage) - ATLVERIFY(m_tab.DeleteItem(nMovePage) != FALSE); - - SetActivePage(nInsertBeforePage); - T* pT = static_cast(this); - pT->OnPageActivated(m_nActivePage); - - return true; - } - -// Implementation overrideables - bool CreateTabControl() - { -#ifndef _WIN32_WCE - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_TOOLTIPS, 0, m_nTabID); -#else // CE specific - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, m_nTabID); -#endif // _WIN32_WCE - ATLASSERT(m_tab.m_hWnd != NULL); - if(m_tab.m_hWnd == NULL) - return false; - - m_tab.SetFont(AtlGetDefaultGuiFont()); - - m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); - - T* pT = static_cast(this); - m_cyTabHeight = pT->CalcTabHeight(); - - return true; - } - - int CalcTabHeight() - { - int nCount = m_tab.GetItemCount(); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT; - tcix.tciheader.pszText = _T("NS"); - int nIndex = m_tab.InsertItem(nCount, tcix); - - RECT rect = { 0, 0, 1000, 1000 }; - m_tab.AdjustRect(FALSE, &rect); - - RECT rcWnd = { 0, 0, 1000, rect.top }; - ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); - - int nHeight = rcWnd.bottom - rcWnd.top; - - m_tab.DeleteItem(nIndex); - - return nHeight; - } - - void ShowTabControl(bool bShow) - { - m_tab.ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE); - } - - void UpdateLayout() - { - RECT rect; - GetClientRect(&rect); - - if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) - m_tab.SetWindowPos(NULL, 0, 0, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER); - - if(m_nActivePage != -1) - ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, m_cyTabHeight, rect.right - rect.left, rect.bottom - rect.top - m_cyTabHeight, SWP_NOZORDER); - } - - void UpdateMenu() - { - if(m_menu.m_hMenu != NULL) - BuildWindowMenu(m_menu, m_nMenuItemsCount, m_bEmptyMenuItem, m_bWindowsMenuItem, m_bActivePageMenuItem, m_bActiveAsDefaultMenuItem); - } - - void UpdateTitleBar() - { - if(!m_wndTitleBar.IsWindow() || m_lpstrTitleBarBase == NULL) - return; // nothing to do - - if(m_nActivePage != -1) - { - T* pT = static_cast(this); - LPCTSTR lpstrTitle = pT->GetPageTitle(m_nActivePage); - LPCTSTR lpstrDivider = pT->GetTitleDividerText(); - int cchBuffer = m_cchTitleBarLength + lstrlen(lpstrDivider) + lstrlen(m_lpstrTitleBarBase) + 1; - CTempBuffer buff; - LPTSTR lpstrPageTitle = buff.Allocate(cchBuffer); - ATLASSERT(lpstrPageTitle != NULL); - if(lpstrPageTitle != NULL) - { - pT->ShortenTitle(lpstrTitle, lpstrPageTitle, m_cchTitleBarLength + 1); - SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, lpstrDivider); - SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, m_lpstrTitleBarBase); - } - else - { - lpstrPageTitle = m_lpstrTitleBarBase; - } - - m_wndTitleBar.SetWindowText(lpstrPageTitle); - } - else - { - m_wndTitleBar.SetWindowText(m_lpstrTitleBarBase); - } - } - - void DrawMoveMark(int nItem) - { - T* pT = static_cast(this); - - if(m_nInsertItem != -1) - { - RECT rect = { 0 }; - pT->GetMoveMarkRect(rect); - m_tab.InvalidateRect(&rect); - } - - m_nInsertItem = nItem; - - if(m_nInsertItem != -1) - { - CClientDC dc(m_tab.m_hWnd); - - RECT rect = { 0 }; - pT->GetMoveMarkRect(rect); - - CPen pen; - pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_WINDOWTEXT)); - CBrush brush; - brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOWTEXT)); - - HPEN hPenOld = dc.SelectPen(pen); - HBRUSH hBrushOld = dc.SelectBrush(brush); - - int x = rect.left; - int y = rect.top; - POINT ptsTop[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y + m_cyMoveMark } }; - dc.Polygon(ptsTop, 3); - - y = rect.bottom - 1; - POINT ptsBottom[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y - m_cyMoveMark } }; - dc.Polygon(ptsBottom, 3); - - dc.SelectPen(hPenOld); - dc.SelectBrush(hBrushOld); - } - } - - void GetMoveMarkRect(RECT& rect) const - { - m_tab.GetClientRect(&rect); - - RECT rcItem = { 0 }; - m_tab.GetItemRect(m_nInsertItem, &rcItem); - - if(m_nInsertItem <= m_nActivePage) - { - rect.left = rcItem.left - m_cxMoveMark / 2 - 1; - rect.right = rcItem.left + m_cxMoveMark / 2; - } - else - { - rect.left = rcItem.right - m_cxMoveMark / 2 - 1; - rect.right = rcItem.right + m_cxMoveMark / 2; - } - } - - void SetMoveCursor(bool bCanMove) - { - ::SetCursor(::LoadCursor(NULL, bCanMove ? IDC_ARROW : IDC_NO)); - } - - void GenerateDragImage(int nItem) - { - ATLASSERT(IsValidPageIndex(nItem)); - -#ifndef _WIN32_WCE - RECT rcItem = { 0 }; - m_tab.GetItemRect(nItem, &rcItem); - ::InflateRect(&rcItem, 2, 2); // make bigger to cover selected item -#else // CE specific - nItem; // avoid level 4 warning - RECT rcItem = { 0, 0, 40, 20 }; -#endif // _WIN32_WCE - - ATLASSERT(m_ilDrag.m_hImageList == NULL); - m_ilDrag.Create(rcItem.right - rcItem.left, rcItem.bottom - rcItem.top, ILC_COLORDDB | ILC_MASK, 1, 1); - - CClientDC dc(m_hWnd); - CDC dcMem; - dcMem.CreateCompatibleDC(dc); - ATLASSERT(dcMem.m_hDC != NULL); - dcMem.SetViewportOrg(-rcItem.left, -rcItem.top); - - CBitmap bmp; - bmp.CreateCompatibleBitmap(dc, rcItem.right - rcItem.left, rcItem.bottom - rcItem.top); - ATLASSERT(bmp.m_hBitmap != NULL); - - HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); -#ifndef _WIN32_WCE - m_tab.SendMessage(WM_PRINTCLIENT, (WPARAM)dcMem.m_hDC); -#else // CE specific - dcMem.Rectangle(&rcItem); -#endif // _WIN32_WCE - dcMem.SelectBitmap(hBmpOld); - - ATLVERIFY(m_ilDrag.Add(bmp.m_hBitmap, RGB(255, 0, 255)) != -1); - } - - void ShortenTitle(LPCTSTR lpstrTitle, LPTSTR lpstrShortTitle, int cchShortTitle) - { - if(lstrlen(lpstrTitle) >= cchShortTitle) - { - LPCTSTR lpstrEllipsis = _T("..."); - int cchEllipsis = lstrlen(lpstrEllipsis); - SecureHelper::strncpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle, cchShortTitle - cchEllipsis - 1); - SecureHelper::strcat_x(lpstrShortTitle, cchShortTitle, lpstrEllipsis); - } - else - { - SecureHelper::strcpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle); - } - } - -#ifndef _WIN32_WCE - void UpdateTooltipText(LPNMTTDISPINFO pTTDI) - { - ATLASSERT(pTTDI != NULL); - pTTDI->lpszText = (LPTSTR)GetPageTitle((int)pTTDI->hdr.idFrom); - } -#endif // !_WIN32_WCE - -// Text for menu items and title bar - override to provide different strings - static LPCTSTR GetEmptyListText() - { - return _T("(Empty)"); - } - - static LPCTSTR GetWindowsMenuItemText() - { - return _T("&Windows..."); - } - - static LPCTSTR GetTitleDividerText() - { - return _T(" - "); - } - -// Notifications - override to provide different behavior - void OnPageActivated(int nPage) - { - NMHDR nmhdr = { 0 }; - nmhdr.hwndFrom = m_hWnd; - nmhdr.idFrom = nPage; - nmhdr.code = TBVN_PAGEACTIVATED; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); - } - - void OnContextMenu(int nPage, POINT pt) - { - m_tab.ClientToScreen(&pt); - - TBVCONTEXTMENUINFO cmi = { 0 }; - cmi.hdr.hwndFrom = m_hWnd; - cmi.hdr.idFrom = nPage; - cmi.hdr.code = TBVN_CONTEXTMENU; - cmi.pt = pt; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&cmi); - } -}; - - -class CTabView : public CTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_TabView"), 0, COLOR_APPWORKSPACE) -}; - -}; // namespace WTL - -#endif // __ATLCTRLX_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLCTRLX_H__ +#define __ATLCTRLX_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlctrlx.h requires atlapp.h to be included first +#endif + +#ifndef __ATLCTRLS_H__ + #error atlctrlx.h requires atlctrls.h to be included first +#endif + +#ifndef WM_UPDATEUISTATE + #define WM_UPDATEUISTATE 0x0128 +#endif // !WM_UPDATEUISTATE + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CBitmapButtonImpl +// CBitmapButton +// CCheckListViewCtrlImpl +// CCheckListViewCtrl +// CHyperLinkImpl +// CHyperLink +// CWaitCursor +// CCustomWaitCursor +// CMultiPaneStatusBarCtrlImpl +// CMultiPaneStatusBarCtrl +// CPaneContainerImpl +// CPaneContainer +// CSortListViewImpl +// CSortListViewCtrlImpl +// CSortListViewCtrl +// CTabViewImpl +// CTabView + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CBitmapButton - bitmap button implementation + +#ifndef _WIN32_WCE + +// bitmap button extended styles +#define BMPBTN_HOVER 0x00000001 +#define BMPBTN_AUTO3D_SINGLE 0x00000002 +#define BMPBTN_AUTO3D_DOUBLE 0x00000004 +#define BMPBTN_AUTOSIZE 0x00000008 +#define BMPBTN_SHAREIMAGELISTS 0x00000010 +#define BMPBTN_AUTOFIRE 0x00000020 + +template +class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinTraits> +{ +public: + DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) + + enum + { + _nImageNormal = 0, + _nImagePushed, + _nImageFocusOrHover, + _nImageDisabled, + + _nImageCount = 4, + }; + + enum + { + ID_TIMER_FIRST = 1000, + ID_TIMER_REPEAT = 1001 + }; + + // Bitmap button specific extended styles + DWORD m_dwExtendedStyle; + + CImageList m_ImageList; + int m_nImage[_nImageCount]; + + CToolTipCtrl m_tip; + LPTSTR m_lpstrToolTipText; + + // Internal states + unsigned m_fMouseOver:1; + unsigned m_fFocus:1; + unsigned m_fPressed:1; + + +// Constructor/Destructor + CBitmapButtonImpl(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : + m_ImageList(hImageList), m_dwExtendedStyle(dwExtendedStyle), + m_lpstrToolTipText(NULL), + m_fMouseOver(0), m_fFocus(0), m_fPressed(0) + { + m_nImage[_nImageNormal] = -1; + m_nImage[_nImagePushed] = -1; + m_nImage[_nImageFocusOrHover] = -1; + m_nImage[_nImageDisabled] = -1; + } + + ~CBitmapButtonImpl() + { + if((m_dwExtendedStyle & BMPBTN_SHAREIMAGELISTS) == 0) + m_ImageList.Destroy(); + delete [] m_lpstrToolTipText; + } + + // overridden to provide proper initialization + BOOL SubclassWindow(HWND hWnd) + { +#if (_MSC_VER >= 1300) + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; + BOOL bRet = _baseClass::SubclassWindow(hWnd); +#endif // !(_MSC_VER >= 1300) + if(bRet) + Init(); + return bRet; + } + +// Attributes + DWORD GetBitmapButtonExtendedStyle() const + { + return m_dwExtendedStyle; + } + + DWORD SetBitmapButtonExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + return dwPrevStyle; + } + + HIMAGELIST GetImageList() const + { + return m_ImageList; + } + + HIMAGELIST SetImageList(HIMAGELIST hImageList) + { + HIMAGELIST hImageListPrev = m_ImageList; + m_ImageList = hImageList; + if((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0 && ::IsWindow(m_hWnd)) + SizeToImage(); + return hImageListPrev; + } + + int GetToolTipTextLength() const + { + return (m_lpstrToolTipText == NULL) ? -1 : lstrlen(m_lpstrToolTipText); + } + + bool GetToolTipText(LPTSTR lpstrText, int nLength) const + { + ATLASSERT(lpstrText != NULL); + if(m_lpstrToolTipText == NULL) + return false; + + errno_t nRet = SecureHelper::strncpy_x(lpstrText, nLength, m_lpstrToolTipText, _TRUNCATE); + + return (nRet == 0 || nRet == STRUNCATE); + } + + bool SetToolTipText(LPCTSTR lpstrText) + { + if(m_lpstrToolTipText != NULL) + { + delete [] m_lpstrToolTipText; + m_lpstrToolTipText = NULL; + } + + if(lpstrText == NULL) + { + if(m_tip.IsWindow()) + m_tip.Activate(FALSE); + return true; + } + + int cchLen = lstrlen(lpstrText) + 1; + ATLTRY(m_lpstrToolTipText = new TCHAR[cchLen]); + if(m_lpstrToolTipText == NULL) + return false; + + SecureHelper::strcpy_x(m_lpstrToolTipText, cchLen, lpstrText); + if(m_tip.IsWindow()) + { + m_tip.Activate(TRUE); + m_tip.AddTool(m_hWnd, m_lpstrToolTipText); + } + + return true; + } + +// Operations + void SetImages(int nNormal, int nPushed = -1, int nFocusOrHover = -1, int nDisabled = -1) + { + if(nNormal != -1) + m_nImage[_nImageNormal] = nNormal; + if(nPushed != -1) + m_nImage[_nImagePushed] = nPushed; + if(nFocusOrHover != -1) + m_nImage[_nImageFocusOrHover] = nFocusOrHover; + if(nDisabled != -1) + m_nImage[_nImageDisabled] = nDisabled; + } + + BOOL SizeToImage() + { + ATLASSERT(::IsWindow(m_hWnd) && m_ImageList.m_hImageList != NULL); + int cx = 0; + int cy = 0; + if(!m_ImageList.GetIconSize(cx, cy)) + return FALSE; + return ResizeClient(cx, cy); + } + +// Overrideables + void DoPaint(CDCHandle dc) + { + ATLASSERT(m_ImageList.m_hImageList != NULL); // image list must be set + ATLASSERT(m_nImage[0] != -1); // main bitmap must be set + + // set bitmap according to the current button state + int nImage = -1; + bool bHover = IsHoverMode(); + if(!IsWindowEnabled()) + nImage = m_nImage[_nImageDisabled]; + else if(m_fPressed == 1) + nImage = m_nImage[_nImagePushed]; + else if((!bHover && m_fFocus == 1) || (bHover && m_fMouseOver == 1)) + nImage = m_nImage[_nImageFocusOrHover]; + if(nImage == -1) // not there, use default one + nImage = m_nImage[_nImageNormal]; + + // draw the button image + int xyPos = 0; + if((m_fPressed == 1) && ((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) && (m_nImage[_nImagePushed] == -1)) + xyPos = 1; + m_ImageList.Draw(dc, nImage, xyPos, xyPos, ILD_NORMAL); + + // draw 3D border if required + if((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) + { + RECT rect; + GetClientRect(&rect); + + if(m_fPressed == 1) + dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_SUNKENOUTER : EDGE_SUNKEN, BF_RECT); + else if(!bHover || m_fMouseOver == 1) + dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_RAISEDINNER : EDGE_RAISED, BF_RECT); + + if(!bHover && m_fFocus == 1) + { + ::InflateRect(&rect, -2 * ::GetSystemMetrics(SM_CXEDGE), -2 * ::GetSystemMetrics(SM_CYEDGE)); + dc.DrawFocusRect(&rect); + } + } + } + +// Message map and handlers + BEGIN_MSG_MAP(CBitmapButtonImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) + MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) + MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk) + MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) + MESSAGE_HANDLER(WM_ENABLE, OnEnable) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) + MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) + MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) + MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) + MESSAGE_HANDLER(WM_TIMER, OnTimer) + MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + Init(); + bHandled = FALSE; + return 1; + } + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_tip.IsWindow()) + { + m_tip.DestroyWindow(); + m_tip.m_hWnd = NULL; + } + bHandled = FALSE; + return 1; + } + + LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + MSG msg = { m_hWnd, uMsg, wParam, lParam }; + if(m_tip.IsWindow()) + m_tip.RelayEvent(&msg); + bHandled = FALSE; + return 1; + } + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background needed + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + if(wParam != NULL) + { + pT->DoPaint((HDC)wParam); + } + else + { + CPaintDC dc(m_hWnd); + pT->DoPaint(dc.m_hDC); + } + return 0; + } + + LRESULT OnFocus(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + m_fFocus = (uMsg == WM_SETFOCUS) ? 1 : 0; + Invalidate(); + UpdateWindow(); + bHandled = FALSE; + return 1; + } + + LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = 0; + if(IsHoverMode()) + SetCapture(); + else + lRet = DefWindowProc(uMsg, wParam, lParam); + if(::GetCapture() == m_hWnd) + { + m_fPressed = 1; + Invalidate(); + UpdateWindow(); + } + if((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) + { + int nElapse = 250; + int nDelay = 0; + if(::SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &nDelay, 0)) + nElapse += nDelay * 250; // all milli-seconds + SetTimer(ID_TIMER_FIRST, nElapse); + } + return lRet; + } + + LRESULT OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = 0; + if(!IsHoverMode()) + lRet = DefWindowProc(uMsg, wParam, lParam); + if(::GetCapture() != m_hWnd) + SetCapture(); + if(m_fPressed == 0) + { + m_fPressed = 1; + Invalidate(); + UpdateWindow(); + } + return lRet; + } + + LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = 0; + bool bHover = IsHoverMode(); + if(!bHover) + lRet = DefWindowProc(uMsg, wParam, lParam); + if(::GetCapture() == m_hWnd) + { + if(bHover && m_fPressed == 1) + ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + ::ReleaseCapture(); + } + return lRet; + } + + LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_fPressed == 1) + { + m_fPressed = 0; + Invalidate(); + UpdateWindow(); + } + bHandled = FALSE; + return 1; + } + + LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + Invalidate(); + UpdateWindow(); + bHandled = FALSE; + return 1; + } + + LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(::GetCapture() == m_hWnd) + { + POINT ptCursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + ClientToScreen(&ptCursor); + RECT rect = { 0 }; + GetWindowRect(&rect); + unsigned int uPressed = ::PtInRect(&rect, ptCursor) ? 1 : 0; + if(m_fPressed != uPressed) + { + m_fPressed = uPressed; + Invalidate(); + UpdateWindow(); + } + } + else if(IsHoverMode() && m_fMouseOver == 0) + { + m_fMouseOver = 1; + Invalidate(); + UpdateWindow(); + StartTrackMouseLeave(); + } + bHandled = FALSE; + return 1; + } + + LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(m_fMouseOver == 1) + { + m_fMouseOver = 0; + Invalidate(); + UpdateWindow(); + } + return 0; + } + + LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(wParam == VK_SPACE && IsHoverMode()) + return 0; // ignore if in hover mode + if(wParam == VK_SPACE && m_fPressed == 0) + { + m_fPressed = 1; + Invalidate(); + UpdateWindow(); + } + bHandled = FALSE; + return 1; + } + + LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(wParam == VK_SPACE && IsHoverMode()) + return 0; // ignore if in hover mode + if(wParam == VK_SPACE && m_fPressed == 1) + { + m_fPressed = 0; + Invalidate(); + UpdateWindow(); + } + bHandled = FALSE; + return 1; + } + + LRESULT OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + ATLASSERT((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0); + switch(wParam) // timer ID + { + case ID_TIMER_FIRST: + KillTimer(ID_TIMER_FIRST); + if(m_fPressed == 1) + { + ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + int nElapse = 250; + int nRepeat = 40; + if(::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &nRepeat, 0)) + nElapse = 10000 / (10 * nRepeat + 25); // milli-seconds, approximated + SetTimer(ID_TIMER_REPEAT, nElapse); + } + break; + case ID_TIMER_REPEAT: + if(m_fPressed == 1) + ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + else if(::GetCapture() != m_hWnd) + KillTimer(ID_TIMER_REPEAT); + break; + default: // not our timer + break; + } + return 0; + } + + LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + // If the control is subclassed or superclassed, this message can cause + // repainting without WM_PAINT. We don't use this state, so just do nothing. + return 0; + } + +// Implementation + void Init() + { + // We need this style to prevent Windows from painting the button + ModifyStyle(0, BS_OWNERDRAW); + + // create a tool tip + m_tip.Create(m_hWnd); + ATLASSERT(m_tip.IsWindow()); + if(m_tip.IsWindow() && m_lpstrToolTipText != NULL) + { + m_tip.Activate(TRUE); + m_tip.AddTool(m_hWnd, m_lpstrToolTipText); + } + + if(m_ImageList.m_hImageList != NULL && (m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0) + SizeToImage(); + } + + BOOL StartTrackMouseLeave() + { + TRACKMOUSEEVENT tme = { 0 }; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = m_hWnd; + return _TrackMouseEvent(&tme); + } + + bool IsHoverMode() const + { + return ((m_dwExtendedStyle & BMPBTN_HOVER) != 0); + } +}; + + +class CBitmapButton : public CBitmapButtonImpl +{ +public: + DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName()) + + CBitmapButton(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : + CBitmapButtonImpl(dwExtendedStyle, hImageList) + { } +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CCheckListCtrlView - list view control with check boxes + +template +class CCheckListViewCtrlImplTraits +{ +public: + static DWORD GetWndStyle(DWORD dwStyle) + { + return (dwStyle == 0) ? t_dwStyle : dwStyle; + } + + static DWORD GetWndExStyle(DWORD dwExStyle) + { + return (dwExStyle == 0) ? t_dwExStyle : dwExStyle; + } + + static DWORD GetExtendedLVStyle() + { + return t_dwExListViewStyle; + } +}; + +typedef CCheckListViewCtrlImplTraits CCheckListViewCtrlTraits; + +template +class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl +{ +public: + DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) + +// Attributes + static DWORD GetExtendedLVStyle() + { + return TWinTraits::GetExtendedLVStyle(); + } + +// Operations + BOOL SubclassWindow(HWND hWnd) + { +#if (_MSC_VER >= 1300) + BOOL bRet = ATL::CWindowImplBaseT< TBase, TWinTraits>::SubclassWindow(hWnd); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImplBaseT< TBase, TWinTraits> _baseClass; + BOOL bRet = _baseClass::SubclassWindow(hWnd); +#endif // !(_MSC_VER >= 1300) + if(bRet) + { + T* pT = static_cast(this); + pT; + ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); + SetExtendedListViewStyle(pT->GetExtendedLVStyle()); + } + return bRet; + } + + void CheckSelectedItems(int nCurrItem) + { + // first check if this item is selected + LVITEM lvi = { 0 }; + lvi.iItem = nCurrItem; + lvi.iSubItem = 0; + lvi.mask = LVIF_STATE; + lvi.stateMask = LVIS_SELECTED; + GetItem(&lvi); + // if item is not selected, don't do anything + if(!(lvi.state & LVIS_SELECTED)) + return; + // new check state will be reverse of the current state, + BOOL bCheck = !GetCheckState(nCurrItem); + int nItem = -1; + int nOldItem = -1; + while((nItem = GetNextItem(nOldItem, LVNI_SELECTED)) != -1) + { + if(nItem != nCurrItem) + SetCheckState(nItem, bCheck); + nOldItem = nItem; + } + } + +// Implementation + BEGIN_MSG_MAP(CCheckListViewCtrlImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) + MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDown) + MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) + END_MSG_MAP() + + LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + // first let list view control initialize everything + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + T* pT = static_cast(this); + pT; + ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); + SetExtendedListViewStyle(pT->GetExtendedLVStyle()); + return lRet; + } + + LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + POINT ptMsg = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + LVHITTESTINFO lvh = { 0 }; + lvh.pt = ptMsg; + if(HitTest(&lvh) != -1 && lvh.flags == LVHT_ONITEMSTATEICON && ::GetKeyState(VK_CONTROL) >= 0) + { + T* pT = static_cast(this); + pT->CheckSelectedItems(lvh.iItem); + } + bHandled = FALSE; + return 1; + } + + LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(wParam == VK_SPACE) + { + int nCurrItem = GetNextItem(-1, LVNI_FOCUSED); + if(nCurrItem != -1 && ::GetKeyState(VK_CONTROL) >= 0) + { + T* pT = static_cast(this); + pT->CheckSelectedItems(nCurrItem); + } + } + bHandled = FALSE; + return 1; + } +}; + +class CCheckListViewCtrl : public CCheckListViewCtrlImpl +{ +public: + DECLARE_WND_SUPERCLASS(_T("WTL_CheckListView"), GetWndClassName()) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CHyperLink - hyper link control implementation + +#if (WINVER < 0x0500) && !defined(_WIN32_WCE) +__declspec(selectany) struct +{ + enum { cxWidth = 32, cyHeight = 32 }; + int xHotSpot; + int yHotSpot; + unsigned char arrANDPlane[cxWidth * cyHeight / 8]; + unsigned char arrXORPlane[cxWidth * cyHeight / 8]; +} _AtlHyperLink_CursorData = +{ + 5, 0, + { + 0xF9, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, + 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0x3F, 0xFF, 0xFF, 0xF0, 0x07, 0xFF, 0xFF, 0xF0, 0x01, 0xFF, 0xFF, + 0xF0, 0x00, 0xFF, 0xFF, 0x10, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, + 0x80, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xE0, 0x00, 0x7F, 0xFF, + 0xE0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, + 0xF8, 0x01, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + }, + { + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x06, 0xD8, 0x00, 0x00, + 0x06, 0xDA, 0x00, 0x00, 0x06, 0xDB, 0x00, 0x00, 0x67, 0xFB, 0x00, 0x00, 0x77, 0xFF, 0x00, 0x00, + 0x37, 0xFF, 0x00, 0x00, 0x17, 0xFF, 0x00, 0x00, 0x1F, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, + 0x0F, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, + 0x03, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + } +}; +#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) + +#define HLINK_UNDERLINED 0x00000000 +#define HLINK_NOTUNDERLINED 0x00000001 +#define HLINK_UNDERLINEHOVER 0x00000002 +#define HLINK_COMMANDBUTTON 0x00000004 +#define HLINK_NOTIFYBUTTON 0x0000000C +#define HLINK_USETAGS 0x00000010 +#define HLINK_USETAGSBOLD 0x00000030 +#define HLINK_NOTOOLTIP 0x00000040 + +// Notes: +// - HLINK_USETAGS and HLINK_USETAGSBOLD are always left-aligned +// - When HLINK_USETAGSBOLD is used, the underlined styles will be ignored + +template +class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > +{ +public: + LPTSTR m_lpstrLabel; + LPTSTR m_lpstrHyperLink; + + HCURSOR m_hCursor; + HFONT m_hFont; + HFONT m_hFontNormal; + + RECT m_rcLink; +#ifndef _WIN32_WCE + CToolTipCtrl m_tip; +#endif // !_WIN32_WCE + + COLORREF m_clrLink; + COLORREF m_clrVisited; + + DWORD m_dwExtendedStyle; // Hyper Link specific extended styles + + bool m_bPaintLabel:1; + bool m_bVisited:1; + bool m_bHover:1; + bool m_bInternalLinkFont:1; + + +// Constructor/Destructor + CHyperLinkImpl(DWORD dwExtendedStyle = HLINK_UNDERLINED) : + m_lpstrLabel(NULL), m_lpstrHyperLink(NULL), + m_hCursor(NULL), m_hFont(NULL), m_hFontNormal(NULL), + m_clrLink(RGB(0, 0, 255)), m_clrVisited(RGB(128, 0, 128)), + m_dwExtendedStyle(dwExtendedStyle), + m_bPaintLabel(true), m_bVisited(false), + m_bHover(false), m_bInternalLinkFont(false) + { + ::SetRectEmpty(&m_rcLink); + } + + ~CHyperLinkImpl() + { + delete [] m_lpstrLabel; + delete [] m_lpstrHyperLink; + if(m_bInternalLinkFont && m_hFont != NULL) + ::DeleteObject(m_hFont); +#if (WINVER < 0x0500) && !defined(_WIN32_WCE) + // It was created, not loaded, so we have to destroy it + if(m_hCursor != NULL) + ::DestroyCursor(m_hCursor); +#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) + } + +// Attributes + DWORD GetHyperLinkExtendedStyle() const + { + return m_dwExtendedStyle; + } + + DWORD SetHyperLinkExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + return dwPrevStyle; + } + + bool GetLabel(LPTSTR lpstrBuffer, int nLength) const + { + if(m_lpstrLabel == NULL) + return false; + ATLASSERT(lpstrBuffer != NULL); + if(nLength <= lstrlen(m_lpstrLabel)) + return false; + + SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrLabel); + + return true; + } + + bool SetLabel(LPCTSTR lpstrLabel) + { + delete [] m_lpstrLabel; + m_lpstrLabel = NULL; + int cchLen = lstrlen(lpstrLabel) + 1; + ATLTRY(m_lpstrLabel = new TCHAR[cchLen]); + if(m_lpstrLabel == NULL) + return false; + + SecureHelper::strcpy_x(m_lpstrLabel, cchLen, lpstrLabel); + T* pT = static_cast(this); + pT->CalcLabelRect(); + + if(m_hWnd != NULL) + SetWindowText(lpstrLabel); // Set this for accessibility + + return true; + } + + bool GetHyperLink(LPTSTR lpstrBuffer, int nLength) const + { + if(m_lpstrHyperLink == NULL) + return false; + ATLASSERT(lpstrBuffer != NULL); + if(nLength <= lstrlen(m_lpstrHyperLink)) + return false; + + SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrHyperLink); + + return true; + } + + bool SetHyperLink(LPCTSTR lpstrLink) + { + delete [] m_lpstrHyperLink; + m_lpstrHyperLink = NULL; + int cchLen = lstrlen(lpstrLink) + 1; + ATLTRY(m_lpstrHyperLink = new TCHAR[cchLen]); + if(m_lpstrHyperLink == NULL) + return false; + + SecureHelper::strcpy_x(m_lpstrHyperLink, cchLen, lpstrLink); + if(m_lpstrLabel == NULL) + { + T* pT = static_cast(this); + pT->CalcLabelRect(); + } +#ifndef _WIN32_WCE + if(m_tip.IsWindow()) + { + m_tip.Activate(TRUE); + m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); + } +#endif // !_WIN32_WCE + return true; + } + + HFONT GetLinkFont() const + { + return m_hFont; + } + + void SetLinkFont(HFONT hFont) + { + if(m_bInternalLinkFont && m_hFont != NULL) + { + ::DeleteObject(m_hFont); + m_bInternalLinkFont = false; + } + m_hFont = hFont; + } + + int GetIdealHeight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) + return -1; + if(!m_bPaintLabel) + return -1; + + CClientDC dc(m_hWnd); + RECT rect = { 0 }; + GetClientRect(&rect); + HFONT hFontOld = dc.SelectFont(m_hFontNormal); + RECT rcText = rect; + dc.DrawText(_T("NS"), -1, &rcText, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + dc.SelectFont(m_hFont); + RECT rcLink = rect; + dc.DrawText(_T("NS"), -1, &rcLink, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + dc.SelectFont(hFontOld); + return max(rcText.bottom - rcText.top, rcLink.bottom - rcLink.top); + } + + bool GetIdealSize(SIZE& size) const + { + int cx = 0, cy = 0; + bool bRet = GetIdealSize(cx, cy); + if(bRet) + { + size.cx = cx; + size.cy = cy; + } + return bRet; + } + + bool GetIdealSize(int& cx, int& cy) const + { + ATLASSERT(::IsWindow(m_hWnd)); + if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) + return false; + if(!m_bPaintLabel) + return false; + + CClientDC dc(m_hWnd); + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + RECT rcAll = rcClient; + + if(IsUsingTags()) + { + // find tags and label parts + LPTSTR lpstrLeft = NULL; + int cchLeft = 0; + LPTSTR lpstrLink = NULL; + int cchLink = 0; + LPTSTR lpstrRight = NULL; + int cchRight = 0; + + const T* pT = static_cast(this); + pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); + + // get label part rects + HFONT hFontOld = dc.SelectFont(m_hFontNormal); + RECT rcLeft = rcClient; + dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + + dc.SelectFont(m_hFont); + RECT rcLink = { rcLeft.right, rcLeft.top, rcClient.right, rcClient.bottom }; + dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + + dc.SelectFont(m_hFontNormal); + RECT rcRight = { rcLink.right, rcLink.top, rcClient.right, rcClient.bottom }; + dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + + dc.SelectFont(hFontOld); + + int cyMax = max(rcLeft.bottom, max(rcLink.bottom, rcRight.bottom)); + ::SetRect(&rcAll, rcLeft.left, rcLeft.top, rcRight.right, cyMax); + } + else + { + HFONT hOldFont = NULL; + if(m_hFont != NULL) + hOldFont = dc.SelectFont(m_hFont); + LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; + DWORD dwStyle = GetStyle(); + int nDrawStyle = DT_LEFT; + if (dwStyle & SS_CENTER) + nDrawStyle = DT_CENTER; + else if (dwStyle & SS_RIGHT) + nDrawStyle = DT_RIGHT; + dc.DrawText(lpstrText, -1, &rcAll, nDrawStyle | DT_WORDBREAK | DT_CALCRECT); + if(m_hFont != NULL) + dc.SelectFont(hOldFont); + if (dwStyle & SS_CENTER) + { + int dx = (rcClient.right - rcAll.right) / 2; + ::OffsetRect(&rcAll, dx, 0); + } + else if (dwStyle & SS_RIGHT) + { + int dx = rcClient.right - rcAll.right; + ::OffsetRect(&rcAll, dx, 0); + } + } + + cx = rcAll.right - rcAll.left; + cy = rcAll.bottom - rcAll.top; + + return true; + } + + // for command buttons only + bool GetToolTipText(LPTSTR lpstrBuffer, int nLength) const + { + ATLASSERT(IsCommandButton()); + return GetHyperLink(lpstrBuffer, nLength); + } + + bool SetToolTipText(LPCTSTR lpstrToolTipText) + { + ATLASSERT(IsCommandButton()); + return SetHyperLink(lpstrToolTipText); + } + +// Operations + BOOL SubclassWindow(HWND hWnd) + { + ATLASSERT(m_hWnd == NULL); + ATLASSERT(::IsWindow(hWnd)); +#if (_MSC_VER >= 1300) + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; + BOOL bRet = _baseClass::SubclassWindow(hWnd); +#endif // !(_MSC_VER >= 1300) + if(bRet) + { + T* pT = static_cast(this); + pT->Init(); + } + return bRet; + } + + bool Navigate() + { + ATLASSERT(::IsWindow(m_hWnd)); + bool bRet = true; + if(IsNotifyButton()) + { + NMHDR nmhdr = { m_hWnd, GetDlgCtrlID(), NM_CLICK }; + ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); + } + else if(IsCommandButton()) + { + ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + } + else + { + ATLASSERT(m_lpstrHyperLink != NULL); +#ifndef _WIN32_WCE + DWORD_PTR dwRet = (DWORD_PTR)::ShellExecute(0, _T("open"), m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL); + bRet = (dwRet > 32); +#else // CE specific + SHELLEXECUTEINFO shExeInfo = { sizeof(SHELLEXECUTEINFO), 0, 0, L"open", m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL, 0, 0, 0, 0, 0, 0, 0 }; + ::ShellExecuteEx(&shExeInfo); + DWORD_PTR dwRet = (DWORD_PTR)shExeInfo.hInstApp; + bRet = (dwRet == 0) || (dwRet > 32); +#endif // _WIN32_WCE + ATLASSERT(bRet); + if(bRet) + { + m_bVisited = true; + Invalidate(); + } + } + return bRet; + } + +// Message map and handlers + BEGIN_MSG_MAP(CHyperLinkImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) +#endif // !_WIN32_WCE + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_PAINT, OnPaint) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) +#endif // !_WIN32_WCE + MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) + MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) +#endif // !_WIN32_WCE + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) + MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + MESSAGE_HANDLER(WM_CHAR, OnChar) + MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode) + MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) + MESSAGE_HANDLER(WM_ENABLE, OnEnable) + MESSAGE_HANDLER(WM_GETFONT, OnGetFont) + MESSAGE_HANDLER(WM_SETFONT, OnSetFont) + MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) + MESSAGE_HANDLER(WM_SIZE, OnSize) + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->Init(); + return 0; + } + +#ifndef _WIN32_WCE + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_tip.IsWindow()) + { + m_tip.DestroyWindow(); + m_tip.m_hWnd = NULL; + } + bHandled = FALSE; + return 1; + } + + LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + MSG msg = { m_hWnd, uMsg, wParam, lParam }; + if(m_tip.IsWindow() && IsUsingToolTip()) + m_tip.RelayEvent(&msg); + bHandled = FALSE; + return 1; + } +#endif // !_WIN32_WCE + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background painting needed (we do it all during WM_PAINT) + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(!m_bPaintLabel) + { + bHandled = FALSE; + return 1; + } + + T* pT = static_cast(this); + if(wParam != NULL) + { + pT->DoEraseBackground((HDC)wParam); + pT->DoPaint((HDC)wParam); + } + else + { + CPaintDC dc(m_hWnd); + pT->DoEraseBackground(dc.m_hDC); + pT->DoPaint(dc.m_hDC); + } + + return 0; + } + + LRESULT OnFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_bPaintLabel) + Invalidate(); + else + bHandled = FALSE; + return 0; + } + + LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) + { + ::SetCursor(m_hCursor); + if(IsUnderlineHover()) + { + if(!m_bHover) + { + m_bHover = true; + InvalidateRect(&m_rcLink); + UpdateWindow(); +#ifndef _WIN32_WCE + StartTrackMouseLeave(); +#endif // !_WIN32_WCE + } + } + } + else + { + if(IsUnderlineHover()) + { + if(m_bHover) + { + m_bHover = false; + InvalidateRect(&m_rcLink); + UpdateWindow(); + } + } + bHandled = FALSE; + } + return 0; + } + +#ifndef _WIN32_WCE + LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(IsUnderlineHover() && m_bHover) + { + m_bHover = false; + InvalidateRect(&m_rcLink); + UpdateWindow(); + } + return 0; + } +#endif // !_WIN32_WCE + + LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + if(::PtInRect(&m_rcLink, pt)) + { + SetFocus(); + SetCapture(); + } + return 0; + } + + LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + if(GetCapture() == m_hWnd) + { + ReleaseCapture(); + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + if(::PtInRect(&m_rcLink, pt)) + { + T* pT = static_cast(this); + pT->Navigate(); + } + } + return 0; + } + + LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(wParam == VK_RETURN || wParam == VK_SPACE) + { + T* pT = static_cast(this); + pT->Navigate(); + } + return 0; + } + + LRESULT OnGetDlgCode(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return DLGC_WANTCHARS; + } + + LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + POINT pt = { 0, 0 }; + GetCursorPos(&pt); + ScreenToClient(&pt); + if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) + { + return TRUE; + } + bHandled = FALSE; + return FALSE; + } + + LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + Invalidate(); + UpdateWindow(); + return 0; + } + + LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return (LRESULT)m_hFontNormal; + } + + LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + m_hFontNormal = (HFONT)wParam; + if((BOOL)lParam) + { + Invalidate(); + UpdateWindow(); + } + return 0; + } + + LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + // If the control is subclassed or superclassed, this message can cause + // repainting without WM_PAINT. We don't use this state, so just do nothing. + return 0; + } + + LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->CalcLabelRect(); + pT->Invalidate(); + return 0; + } + +// Implementation + void Init() + { + ATLASSERT(::IsWindow(m_hWnd)); + + // Check if we should paint a label + const int cchBuff = 8; + TCHAR szBuffer[cchBuff] = { 0 }; + if(::GetClassName(m_hWnd, szBuffer, cchBuff)) + { + if(lstrcmpi(szBuffer, _T("static")) == 0) + { + ModifyStyle(0, SS_NOTIFY); // we need this + DWORD dwStyle = GetStyle() & 0x000000FF; +#ifndef _WIN32_WCE + if(dwStyle == SS_ICON || dwStyle == SS_BLACKRECT || dwStyle == SS_GRAYRECT || + dwStyle == SS_WHITERECT || dwStyle == SS_BLACKFRAME || dwStyle == SS_GRAYFRAME || + dwStyle == SS_WHITEFRAME || dwStyle == SS_OWNERDRAW || + dwStyle == SS_BITMAP || dwStyle == SS_ENHMETAFILE) +#else // CE specific + if(dwStyle == SS_ICON || dwStyle == SS_BITMAP) +#endif // _WIN32_WCE + m_bPaintLabel = false; + } + } + + // create or load a cursor +#if (WINVER >= 0x0500) || defined(_WIN32_WCE) + m_hCursor = ::LoadCursor(NULL, IDC_HAND); +#else + m_hCursor = ::CreateCursor(ModuleHelper::GetModuleInstance(), _AtlHyperLink_CursorData.xHotSpot, _AtlHyperLink_CursorData.yHotSpot, _AtlHyperLink_CursorData.cxWidth, _AtlHyperLink_CursorData.cyHeight, _AtlHyperLink_CursorData.arrANDPlane, _AtlHyperLink_CursorData.arrXORPlane); +#endif + ATLASSERT(m_hCursor != NULL); + + // set font + if(m_bPaintLabel) + { + ATL::CWindow wnd = GetParent(); + m_hFontNormal = wnd.GetFont(); + if(m_hFontNormal == NULL) + m_hFontNormal = (HFONT)::GetStockObject(SYSTEM_FONT); + if(m_hFontNormal != NULL && m_hFont == NULL) + { + LOGFONT lf = { 0 }; + CFontHandle font = m_hFontNormal; + font.GetLogFont(&lf); + if(IsUsingTagsBold()) + lf.lfWeight = FW_BOLD; + else if(!IsNotUnderlined()) + lf.lfUnderline = TRUE; + m_hFont = ::CreateFontIndirect(&lf); + m_bInternalLinkFont = true; + ATLASSERT(m_hFont != NULL); + } + } + +#ifndef _WIN32_WCE + // create a tool tip + m_tip.Create(m_hWnd); + ATLASSERT(m_tip.IsWindow()); +#endif // !_WIN32_WCE + + // set label (defaults to window text) + if(m_lpstrLabel == NULL) + { + int nLen = GetWindowTextLength(); + if(nLen > 0) + { + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(nLen + 1); + ATLASSERT(lpstrText != NULL); + if((lpstrText != NULL) && (GetWindowText(lpstrText, nLen + 1) > 0)) + SetLabel(lpstrText); + } + } + + T* pT = static_cast(this); + pT->CalcLabelRect(); + + // set hyperlink (defaults to label), or just activate tool tip if already set + if(m_lpstrHyperLink == NULL && !IsCommandButton()) + { + if(m_lpstrLabel != NULL) + SetHyperLink(m_lpstrLabel); + } +#ifndef _WIN32_WCE + else + { + m_tip.Activate(TRUE); + m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); + } +#endif // !_WIN32_WCE + + // set link colors + if(m_bPaintLabel) + { + ATL::CRegKey rk; + LONG lRet = rk.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\Settings")); + if(lRet == 0) + { + const int cchValue = 12; + TCHAR szValue[cchValue] = { 0 }; +#if (_ATL_VER >= 0x0700) + ULONG ulCount = cchValue; + lRet = rk.QueryStringValue(_T("Anchor Color"), szValue, &ulCount); +#else + DWORD dwCount = cchValue * sizeof(TCHAR); + lRet = rk.QueryValue(szValue, _T("Anchor Color"), &dwCount); +#endif + if(lRet == 0) + { + COLORREF clr = pT->_ParseColorString(szValue); + ATLASSERT(clr != CLR_INVALID); + if(clr != CLR_INVALID) + m_clrLink = clr; + } + +#if (_ATL_VER >= 0x0700) + ulCount = cchValue; + lRet = rk.QueryStringValue(_T("Anchor Color Visited"), szValue, &ulCount); +#else + dwCount = cchValue * sizeof(TCHAR); + lRet = rk.QueryValue(szValue, _T("Anchor Color Visited"), &dwCount); +#endif + if(lRet == 0) + { + COLORREF clr = pT->_ParseColorString(szValue); + ATLASSERT(clr != CLR_INVALID); + if(clr != CLR_INVALID) + m_clrVisited = clr; + } + } + } + } + + static COLORREF _ParseColorString(LPTSTR lpstr) + { + int c[3] = { -1, -1, -1 }; + LPTSTR p = NULL; + for(int i = 0; i < 2; i++) + { + for(p = lpstr; *p != _T('\0'); p = ::CharNext(p)) + { + if(*p == _T(',')) + { + *p = _T('\0'); + c[i] = T::_xttoi(lpstr); + lpstr = &p[1]; + break; + } + } + if(c[i] == -1) + return CLR_INVALID; + } + if(*lpstr == _T('\0')) + return CLR_INVALID; + c[2] = T::_xttoi(lpstr); + + return RGB(c[0], c[1], c[2]); + } + + bool CalcLabelRect() + { + if(!::IsWindow(m_hWnd)) + return false; + if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) + return false; + + CClientDC dc(m_hWnd); + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + m_rcLink = rcClient; + if(!m_bPaintLabel) + return true; + + if(IsUsingTags()) + { + // find tags and label parts + LPTSTR lpstrLeft = NULL; + int cchLeft = 0; + LPTSTR lpstrLink = NULL; + int cchLink = 0; + LPTSTR lpstrRight = NULL; + int cchRight = 0; + + T* pT = static_cast(this); + pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); + ATLASSERT(lpstrLink != NULL); + ATLASSERT(cchLink > 0); + + // get label part rects + HFONT hFontOld = dc.SelectFont(m_hFontNormal); + + RECT rcLeft = rcClient; + if(lpstrLeft != NULL) + dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + + dc.SelectFont(m_hFont); + RECT rcLink = rcClient; + if(lpstrLeft != NULL) + rcLink.left = rcLeft.right; + dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | DT_WORDBREAK | DT_CALCRECT); + + dc.SelectFont(hFontOld); + + m_rcLink = rcLink; + } + else + { + HFONT hOldFont = NULL; + if(m_hFont != NULL) + hOldFont = dc.SelectFont(m_hFont); + LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; + DWORD dwStyle = GetStyle(); + int nDrawStyle = DT_LEFT; + if (dwStyle & SS_CENTER) + nDrawStyle = DT_CENTER; + else if (dwStyle & SS_RIGHT) + nDrawStyle = DT_RIGHT; + dc.DrawText(lpstrText, -1, &m_rcLink, nDrawStyle | DT_WORDBREAK | DT_CALCRECT); + if(m_hFont != NULL) + dc.SelectFont(hOldFont); + if (dwStyle & SS_CENTER) + { + int dx = (rcClient.right - m_rcLink.right) / 2; + ::OffsetRect(&m_rcLink, dx, 0); + } + else if (dwStyle & SS_RIGHT) + { + int dx = rcClient.right - m_rcLink.right; + ::OffsetRect(&m_rcLink, dx, 0); + } + } + + return true; + } + + void CalcLabelParts(LPTSTR& lpstrLeft, int& cchLeft, LPTSTR& lpstrLink, int& cchLink, LPTSTR& lpstrRight, int& cchRight) const + { + lpstrLeft = NULL; + cchLeft = 0; + lpstrLink = NULL; + cchLink = 0; + lpstrRight = NULL; + cchRight = 0; + + LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; + int cchText = lstrlen(lpstrText); + bool bOutsideLink = true; + for(int i = 0; i < cchText; i++) + { + if(lpstrText[i] != _T('<')) + continue; + + if(bOutsideLink) + { + if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 3, _T(""), 3) == CSTR_EQUAL) + { + if(i > 0) + { + lpstrLeft = lpstrText; + cchLeft = i; + } + lpstrLink = &lpstrText[i + 3]; + bOutsideLink = false; + } + } + else + { + if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 4, _T(""), 4) == CSTR_EQUAL) + { + cchLink = i - 3 - cchLeft; + if(lpstrText[i + 4] != 0) + { + lpstrRight = &lpstrText[i + 4]; + cchRight = cchText - (i + 4); + break; + } + } + } + } + + } + + void DoEraseBackground(CDCHandle dc) + { + HBRUSH hBrush = (HBRUSH)::SendMessage(GetParent(), WM_CTLCOLORSTATIC, (WPARAM)dc.m_hDC, (LPARAM)m_hWnd); + if(hBrush != NULL) + { + RECT rect = { 0 }; + GetClientRect(&rect); + dc.FillRect(&rect, hBrush); + } + } + + void DoPaint(CDCHandle dc) + { + if(IsUsingTags()) + { + // find tags and label parts + LPTSTR lpstrLeft = NULL; + int cchLeft = 0; + LPTSTR lpstrLink = NULL; + int cchLink = 0; + LPTSTR lpstrRight = NULL; + int cchRight = 0; + + T* pT = static_cast(this); + pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); + + // get label part rects + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + + dc.SetBkMode(TRANSPARENT); + HFONT hFontOld = dc.SelectFont(m_hFontNormal); + + if(lpstrLeft != NULL) + dc.DrawText(lpstrLeft, cchLeft, &rcClient, DT_LEFT | DT_WORDBREAK); + + COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); + if(m_hFont != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) + dc.SelectFont(m_hFont); + else + dc.SelectFont(m_hFontNormal); + + dc.DrawText(lpstrLink, cchLink, &m_rcLink, DT_LEFT | DT_WORDBREAK); + + dc.SetTextColor(clrOld); + dc.SelectFont(m_hFontNormal); + if(lpstrRight != NULL) + { + RECT rcRight = { m_rcLink.right, m_rcLink.top, rcClient.right, rcClient.bottom }; + dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | DT_WORDBREAK); + } + + if(GetFocus() == m_hWnd) + dc.DrawFocusRect(&m_rcLink); + + dc.SelectFont(hFontOld); + } + else + { + dc.SetBkMode(TRANSPARENT); + COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); + + HFONT hFontOld = NULL; + if(m_hFont != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) + hFontOld = dc.SelectFont(m_hFont); + else + hFontOld = dc.SelectFont(m_hFontNormal); + + LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; + + DWORD dwStyle = GetStyle(); + int nDrawStyle = DT_LEFT; + if (dwStyle & SS_CENTER) + nDrawStyle = DT_CENTER; + else if (dwStyle & SS_RIGHT) + nDrawStyle = DT_RIGHT; + + dc.DrawText(lpstrText, -1, &m_rcLink, nDrawStyle | DT_WORDBREAK); + + if(GetFocus() == m_hWnd) + dc.DrawFocusRect(&m_rcLink); + + dc.SetTextColor(clrOld); + dc.SelectFont(hFontOld); + } + } + +#ifndef _WIN32_WCE + BOOL StartTrackMouseLeave() + { + TRACKMOUSEEVENT tme = { 0 }; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = m_hWnd; + return _TrackMouseEvent(&tme); + } +#endif // !_WIN32_WCE + +// Implementation helpers + bool IsUnderlined() const + { + return ((m_dwExtendedStyle & (HLINK_NOTUNDERLINED | HLINK_UNDERLINEHOVER)) == 0); + } + + bool IsNotUnderlined() const + { + return ((m_dwExtendedStyle & HLINK_NOTUNDERLINED) != 0); + } + + bool IsUnderlineHover() const + { + return ((m_dwExtendedStyle & HLINK_UNDERLINEHOVER) != 0); + } + + bool IsCommandButton() const + { + return ((m_dwExtendedStyle & HLINK_COMMANDBUTTON) != 0); + } + + bool IsNotifyButton() const + { + return ((m_dwExtendedStyle & HLINK_NOTIFYBUTTON) == HLINK_NOTIFYBUTTON); + } + + bool IsUsingTags() const + { + return ((m_dwExtendedStyle & HLINK_USETAGS) != 0); + } + + bool IsUsingTagsBold() const + { + return ((m_dwExtendedStyle & HLINK_USETAGSBOLD) == HLINK_USETAGSBOLD); + } + + bool IsUsingToolTip() const + { + return ((m_dwExtendedStyle & HLINK_NOTOOLTIP) == 0); + } + + static int _xttoi(const TCHAR* nptr) + { +#ifndef _ATL_MIN_CRT + return _ttoi(nptr); +#else // _ATL_MIN_CRT + while(*nptr == _T(' ')) // skip spaces + ++nptr; + + int c = (int)(_TUCHAR)*nptr++; + int sign = c; // save sign indication + if (c == _T('-') || c == _T('+')) + c = (int)(_TUCHAR)*nptr++; // skip sign + + int total = 0; + while((TCHAR)c >= _T('0') && (TCHAR)c <= _T('9')) + { + total = 10 * total + ((TCHAR)c - _T('0')); // accumulate digit + c = (int)(_TUCHAR)*nptr++; // get next char + } + + // return result, negated if necessary + return ((TCHAR)sign != _T('-')) ? total : -total; +#endif // _ATL_MIN_CRT + } +}; + + +class CHyperLink : public CHyperLinkImpl +{ +public: + DECLARE_WND_CLASS(_T("WTL_HyperLink")) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CWaitCursor - displays a wait cursor + +class CWaitCursor +{ +public: +// Data + HCURSOR m_hWaitCursor; + HCURSOR m_hOldCursor; + bool m_bInUse; + +// Constructor/destructor + CWaitCursor(bool bSet = true, LPCTSTR lpstrCursor = IDC_WAIT, bool bSys = true) : m_hOldCursor(NULL), m_bInUse(false) + { + HINSTANCE hInstance = bSys ? NULL : ModuleHelper::GetResourceInstance(); + m_hWaitCursor = ::LoadCursor(hInstance, lpstrCursor); + ATLASSERT(m_hWaitCursor != NULL); + + if(bSet) + Set(); + } + + ~CWaitCursor() + { + Restore(); + } + +// Methods + bool Set() + { + if(m_bInUse) + return false; + m_hOldCursor = ::SetCursor(m_hWaitCursor); + m_bInUse = true; + return true; + } + + bool Restore() + { + if(!m_bInUse) + return false; + ::SetCursor(m_hOldCursor); + m_bInUse = false; + return true; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CCustomWaitCursor - for custom and animated cursors + +class CCustomWaitCursor : public CWaitCursor +{ +public: +// Constructor/destructor + CCustomWaitCursor(ATL::_U_STRINGorID cursor, bool bSet = true, HINSTANCE hInstance = NULL) : + CWaitCursor(false, IDC_WAIT, true) + { + if(hInstance == NULL) + hInstance = ModuleHelper::GetResourceInstance(); + m_hWaitCursor = (HCURSOR)::LoadImage(hInstance, cursor.m_lpstr, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE); + + if(bSet) + Set(); + } + + ~CCustomWaitCursor() + { + Restore(); +#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) + ::DestroyCursor(m_hWaitCursor); +#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CMultiPaneStatusBarCtrl - Status Bar with multiple panes + +template +class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TBase > +{ +public: + DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) + +// Data + enum { m_cxPaneMargin = 3 }; + + int m_nPanes; + int* m_pPane; + +// Constructor/destructor + CMultiPaneStatusBarCtrlImpl() : m_nPanes(0), m_pPane(NULL) + { } + + ~CMultiPaneStatusBarCtrlImpl() + { + delete [] m_pPane; + } + +// Methods + HWND Create(HWND hWndParent, LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) + { +#if (_MSC_VER >= 1300) + return ATL::CWindowImpl< T, TBase >::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImpl< T, TBase > _baseClass; + return _baseClass::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); +#endif // !(_MSC_VER >= 1300) + } + + HWND Create(HWND hWndParent, UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) + { + const int cchMax = 128; // max text length is 127 for status bars (+1 for null) + TCHAR szText[cchMax]; + szText[0] = 0; + ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); + return Create(hWndParent, szText, dwStyle, nID); + } + + BOOL SetPanes(int* pPanes, int nPanes, bool bSetText = true) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPanes > 0); + + m_nPanes = nPanes; + delete [] m_pPane; + m_pPane = NULL; + + ATLTRY(m_pPane = new int[nPanes]); + ATLASSERT(m_pPane != NULL); + if(m_pPane == NULL) + return FALSE; + + CTempBuffer buff; + int* pPanesPos = buff.Allocate(nPanes); + ATLASSERT(pPanesPos != NULL); + if(pPanesPos == NULL) + return FALSE; + + SecureHelper::memcpy_x(m_pPane, nPanes * sizeof(int), pPanes, nPanes * sizeof(int)); + + // get status bar DC and set font + CClientDC dc(m_hWnd); + HFONT hOldFont = dc.SelectFont(GetFont()); + + // get status bar borders + int arrBorders[3] = { 0 }; + GetBorders(arrBorders); + + const int cchBuff = 128; + TCHAR szBuff[cchBuff] = { 0 }; + SIZE size = { 0, 0 }; + int cxLeft = arrBorders[0]; + + // calculate right edge of each part + for(int i = 0; i < nPanes; i++) + { + if(pPanes[i] == ID_DEFAULT_PANE) + { + // make very large, will be resized later + pPanesPos[i] = INT_MAX / 2; + } + else + { + ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); + dc.GetTextExtent(szBuff, lstrlen(szBuff), &size); + T* pT = static_cast(this); + pT; + pPanesPos[i] = cxLeft + size.cx + arrBorders[2] + 2 * pT->m_cxPaneMargin; + } + cxLeft = pPanesPos[i]; + } + + BOOL bRet = SetParts(nPanes, pPanesPos); + + if(bRet && bSetText) + { + for(int i = 0; i < nPanes; i++) + { + if(pPanes[i] != ID_DEFAULT_PANE) + { + ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); + SetPaneText(m_pPane[i], szBuff); + } + } + } + + dc.SelectFont(hOldFont); + return bRet; + } + + bool GetPaneTextLength(int nPaneID, int* pcchLength = NULL, int* pnType = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return false; + + int nLength = GetTextLength(nIndex, pnType); + if(pcchLength != NULL) + *pcchLength = nLength; + + return true; + } + + BOOL GetPaneText(int nPaneID, LPTSTR lpstrText, int* pcchLength = NULL, int* pnType = NULL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + int nLength = GetText(nIndex, lpstrText, pnType); + if(pcchLength != NULL) + *pcchLength = nLength; + + return TRUE; + } + + BOOL SetPaneText(int nPaneID, LPCTSTR lpstrText, int nType = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + return SetText(nIndex, lpstrText, nType); + } + + BOOL GetPaneRect(int nPaneID, LPRECT lpRect) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + return GetRect(nIndex, lpRect); + } + + BOOL SetPaneWidth(int nPaneID, int cxWidth) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPaneID != ID_DEFAULT_PANE); // Can't resize this one + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + // get pane positions + CTempBuffer buff; + int* pPanesPos = buff.Allocate(m_nPanes); + if(pPanesPos == NULL) + return FALSE; + GetParts(m_nPanes, pPanesPos); + // calculate offset + int cxPaneWidth = pPanesPos[nIndex] - ((nIndex == 0) ? 0 : pPanesPos[nIndex - 1]); + int cxOff = cxWidth - cxPaneWidth; + // find variable width pane + int nDef = m_nPanes; + for(int i = 0; i < m_nPanes; i++) + { + if(m_pPane[i] == ID_DEFAULT_PANE) + { + nDef = i; + break; + } + } + // resize + if(nIndex < nDef) // before default pane + { + for(int i = nIndex; i < nDef; i++) + pPanesPos[i] += cxOff; + + } + else // after default one + { + for(int i = nDef; i < nIndex; i++) + pPanesPos[i] -= cxOff; + } + // set pane postions + return SetParts(m_nPanes, pPanesPos); + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + BOOL GetPaneTipText(int nPaneID, LPTSTR lpstrText, int nSize) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + GetTipText(nIndex, lpstrText, nSize); + return TRUE; + } + + BOOL SetPaneTipText(int nPaneID, LPCTSTR lpstrText) + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + SetTipText(nIndex, lpstrText); + return TRUE; + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) + BOOL GetPaneIcon(int nPaneID, HICON& hIcon) const + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + hIcon = GetIcon(nIndex); + return TRUE; + } + + BOOL SetPaneIcon(int nPaneID, HICON hIcon) + { + ATLASSERT(::IsWindow(m_hWnd)); + int nIndex = GetPaneIndexFromID(nPaneID); + if(nIndex == -1) + return FALSE; + + return SetIcon(nIndex, hIcon); + } +#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) + +// Message map and handlers + BEGIN_MSG_MAP(CMultiPaneStatusBarCtrlImpl< T >) + MESSAGE_HANDLER(WM_SIZE, OnSize) + END_MSG_MAP() + + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + if(wParam != SIZE_MINIMIZED && m_nPanes > 0) + { + T* pT = static_cast(this); + pT->UpdatePanesLayout(); + } + return lRet; + } + +// Implementation + BOOL UpdatePanesLayout() + { + // get pane positions + CTempBuffer buff; + int* pPanesPos = buff.Allocate(m_nPanes); + ATLASSERT(pPanesPos != NULL); + if(pPanesPos == NULL) + return FALSE; + int nRet = GetParts(m_nPanes, pPanesPos); + ATLASSERT(nRet == m_nPanes); + if(nRet != m_nPanes) + return FALSE; + // calculate offset + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + int cxOff = rcClient.right - pPanesPos[m_nPanes - 1]; +#ifndef _WIN32_WCE + // Move panes left if size grip box is present + if((GetStyle() & SBARS_SIZEGRIP) != 0) + cxOff -= ::GetSystemMetrics(SM_CXVSCROLL) + ::GetSystemMetrics(SM_CXEDGE); +#endif // !_WIN32_WCE + // find variable width pane + int i; + for(i = 0; i < m_nPanes; i++) + { + if(m_pPane[i] == ID_DEFAULT_PANE) + break; + } + // resize all panes from the variable one to the right + if((i < m_nPanes) && (pPanesPos[i] + cxOff) > ((i == 0) ? 0 : pPanesPos[i - 1])) + { + for(; i < m_nPanes; i++) + pPanesPos[i] += cxOff; + } + // set pane postions + return SetParts(m_nPanes, pPanesPos); + } + + int GetPaneIndexFromID(int nPaneID) const + { + for(int i = 0; i < m_nPanes; i++) + { + if(m_pPane[i] == nPaneID) + return i; + } + + return -1; // not found + } +}; + +class CMultiPaneStatusBarCtrl : public CMultiPaneStatusBarCtrlImpl +{ +public: + DECLARE_WND_SUPERCLASS(_T("WTL_MultiPaneStatusBar"), GetWndClassName()) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPaneContainer - provides header with title and close button for panes + +// pane container extended styles +#define PANECNT_NOCLOSEBUTTON 0x00000001 +#define PANECNT_VERTICAL 0x00000002 +#define PANECNT_FLATBORDER 0x00000004 +#define PANECNT_NOBORDER 0x00000008 + +template +class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CCustomDraw< T > +{ +public: + DECLARE_WND_CLASS_EX(NULL, 0, -1) + +// Constants + enum + { + m_cxyBorder = 2, + m_cxyTextOffset = 4, + m_cxyBtnOffset = 1, + + m_cchTitle = 80, + + m_cxImageTB = 13, + m_cyImageTB = 11, + m_cxyBtnAddTB = 7, + + m_cxToolBar = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder + m_cxyBtnOffset, + + m_xBtnImageLeft = 6, + m_yBtnImageTop = 5, + m_xBtnImageRight = 12, + m_yBtnImageBottom = 11, + + m_nCloseBtnID = ID_PANE_CLOSE + }; + +// Data members + CToolBarCtrl m_tb; + ATL::CWindow m_wndClient; + int m_cxyHeader; + TCHAR m_szTitle[m_cchTitle]; + DWORD m_dwExtendedStyle; // Pane container specific extended styles + + +// Constructor + CPaneContainerImpl() : m_cxyHeader(0), m_dwExtendedStyle(0) + { + m_szTitle[0] = 0; + } + +// Attributes + DWORD GetPaneContainerExtendedStyle() const + { + return m_dwExtendedStyle; + } + + DWORD SetPaneContainerExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + if(m_hWnd != NULL) + { + T* pT = static_cast(this); + bool bUpdate = false; + + if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) != 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0)) // add close button + { + pT->CreateCloseButton(); + bUpdate = true; + } + else if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) == 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) != 0)) // remove close button + { + pT->DestroyCloseButton(); + bUpdate = true; + } + + if((dwPrevStyle & PANECNT_VERTICAL) != (m_dwExtendedStyle & PANECNT_VERTICAL)) // change orientation + { + pT->CalcSize(); + bUpdate = true; + } + + if((dwPrevStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER)) != + (m_dwExtendedStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER))) // change border + { + bUpdate = true; + } + + if(bUpdate) + pT->UpdateLayout(); + } + return dwPrevStyle; + } + + HWND GetClient() const + { + return m_wndClient; + } + + HWND SetClient(HWND hWndClient) + { + HWND hWndOldClient = m_wndClient; + m_wndClient = hWndClient; + if(m_hWnd != NULL) + { + T* pT = static_cast(this); + pT->UpdateLayout(); + } + return hWndOldClient; + } + + BOOL GetTitle(LPTSTR lpstrTitle, int cchLength) const + { + ATLASSERT(lpstrTitle != NULL); + + errno_t nRet = SecureHelper::strncpy_x(lpstrTitle, cchLength, m_szTitle, _TRUNCATE); + + return (nRet == 0 || nRet == STRUNCATE); + } + + BOOL SetTitle(LPCTSTR lpstrTitle) + { + ATLASSERT(lpstrTitle != NULL); + + errno_t nRet = SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); + bool bRet = (nRet == 0 || nRet == STRUNCATE); + if(bRet && m_hWnd != NULL) + { + T* pT = static_cast(this); + pT->UpdateLayout(); + } + + return bRet; + } + + int GetTitleLength() const + { + return lstrlen(m_szTitle); + } + +// Methods + HWND Create(HWND hWndParent, LPCTSTR lpstrTitle = NULL, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) + { + if(lpstrTitle != NULL) + SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); +#if (_MSC_VER >= 1300) + return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; + return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); +#endif // !(_MSC_VER >= 1300) + } + + HWND Create(HWND hWndParent, UINT uTitleID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) + { + if(uTitleID != 0U) + ::LoadString(ModuleHelper::GetResourceInstance(), uTitleID, m_szTitle, m_cchTitle); +#if (_MSC_VER >= 1300) + return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); +#else // !(_MSC_VER >= 1300) + typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; + return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); +#endif // !(_MSC_VER >= 1300) + } + + BOOL EnableCloseButton(BOOL bEnable) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + pT; // avoid level 4 warning + return (m_tb.m_hWnd != NULL) ? m_tb.EnableButton(pT->m_nCloseBtnID, bEnable) : FALSE; + } + + void UpdateLayout() + { + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + T* pT = static_cast(this); + pT->UpdateLayout(rcClient.right, rcClient.bottom); + } + +// Message map and handlers + BEGIN_MSG_MAP(CPaneContainerImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_PAINT, OnPaint) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) +#endif // !_WIN32_WCE + MESSAGE_HANDLER(WM_NOTIFY, OnNotify) + MESSAGE_HANDLER(WM_COMMAND, OnCommand) + FORWARD_NOTIFICATIONS() + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->CalcSize(); + + if((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0) + pT->CreateCloseButton(); + + return 0; + } + + LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + return 0; + } + + LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(m_wndClient.m_hWnd != NULL) + m_wndClient.SetFocus(); + return 0; + } + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background needed + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + if(wParam != NULL) + { + pT->DrawPaneTitle((HDC)wParam); + + if(m_wndClient.m_hWnd == NULL) // no client window + pT->DrawPane((HDC)wParam); + } + else + { + CPaintDC dc(m_hWnd); + pT->DrawPaneTitle(dc.m_hDC); + + if(m_wndClient.m_hWnd == NULL) // no client window + pT->DrawPane(dc.m_hDC); + } + + return 0; + } + + LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(m_tb.m_hWnd == NULL) + { + bHandled = FALSE; + return 1; + } + + T* pT = static_cast(this); + pT; + LPNMHDR lpnmh = (LPNMHDR)lParam; + LRESULT lRet = 0; + + // pass toolbar custom draw notifications to the base class + if(lpnmh->code == NM_CUSTOMDRAW && lpnmh->hwndFrom == m_tb.m_hWnd) + lRet = CCustomDraw< T >::OnCustomDraw(0, lpnmh, bHandled); +#ifndef _WIN32_WCE + // tooltip notifications come with the tooltip window handle and button ID, + // pass them to the parent if we don't handle them + else if(lpnmh->code == TTN_GETDISPINFO && lpnmh->idFrom == pT->m_nCloseBtnID) + bHandled = pT->GetToolTipText(lpnmh); +#endif // !_WIN32_WCE + // only let notifications not from the toolbar go to the parent + else if(lpnmh->hwndFrom != m_tb.m_hWnd && lpnmh->idFrom != pT->m_nCloseBtnID) + bHandled = FALSE; + + return lRet; + } + + LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + // if command comes from the close button, substitute HWND of the pane container instead + if(m_tb.m_hWnd != NULL && (HWND)lParam == m_tb.m_hWnd) + return ::SendMessage(GetParent(), WM_COMMAND, wParam, (LPARAM)m_hWnd); + + bHandled = FALSE; + return 1; + } + +// Custom draw overrides + DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return CDRF_NOTIFYITEMDRAW; // we need per-item notifications + } + + DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) + { + CDCHandle dc = lpNMCustomDraw->hdc; +#if (_WIN32_IE >= 0x0400) + RECT& rc = lpNMCustomDraw->rc; +#else // !(_WIN32_IE >= 0x0400) + RECT rc; + m_tb.GetItemRect(0, &rc); +#endif // !(_WIN32_IE >= 0x0400) + + dc.FillRect(&rc, COLOR_3DFACE); + + return CDRF_NOTIFYPOSTPAINT; + } + + DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) + { + CDCHandle dc = lpNMCustomDraw->hdc; +#if (_WIN32_IE >= 0x0400) + RECT& rc = lpNMCustomDraw->rc; +#else // !(_WIN32_IE >= 0x0400) + RECT rc = { 0 }; + m_tb.GetItemRect(0, &rc); +#endif // !(_WIN32_IE >= 0x0400) + + RECT rcImage = { m_xBtnImageLeft, m_yBtnImageTop, m_xBtnImageRight + 1, m_yBtnImageBottom + 1 }; + ::OffsetRect(&rcImage, rc.left, rc.top); + T* pT = static_cast(this); + + if((lpNMCustomDraw->uItemState & CDIS_DISABLED) != 0) + { + RECT rcShadow = rcImage; + ::OffsetRect(&rcShadow, 1, 1); + CPen pen1; + pen1.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DHILIGHT)); + pT->DrawButtonImage(dc, rcShadow, pen1); + CPen pen2; + pen2.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DSHADOW)); + pT->DrawButtonImage(dc, rcImage, pen2); + } + else + { + if((lpNMCustomDraw->uItemState & CDIS_SELECTED) != 0) + ::OffsetRect(&rcImage, 1, 1); + CPen pen; + pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNTEXT)); + pT->DrawButtonImage(dc, rcImage, pen); + } + + return CDRF_DODEFAULT; // continue with the default item painting + } + +// Implementation - overrideable methods + void UpdateLayout(int cxWidth, int cyHeight) + { + ATLASSERT(::IsWindow(m_hWnd)); + RECT rect = { 0 }; + + if(IsVertical()) + { + ::SetRect(&rect, 0, 0, m_cxyHeader, cyHeight); + if(m_tb.m_hWnd != NULL) + m_tb.SetWindowPos(NULL, m_cxyBorder, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + + if(m_wndClient.m_hWnd != NULL) + m_wndClient.SetWindowPos(NULL, m_cxyHeader, 0, cxWidth - m_cxyHeader, cyHeight, SWP_NOZORDER); + else + rect.right = cxWidth; + } + else + { + ::SetRect(&rect, 0, 0, cxWidth, m_cxyHeader); + if(m_tb.m_hWnd != NULL) + m_tb.SetWindowPos(NULL, rect.right - m_cxToolBar, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + + if(m_wndClient.m_hWnd != NULL) + m_wndClient.SetWindowPos(NULL, 0, m_cxyHeader, cxWidth, cyHeight - m_cxyHeader, SWP_NOZORDER); + else + rect.bottom = cyHeight; + } + + InvalidateRect(&rect); + } + + void CreateCloseButton() + { + ATLASSERT(m_tb.m_hWnd == NULL); + // create toolbar for the "x" button + m_tb.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NOMOVEY | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, 0); + ATLASSERT(m_tb.IsWindow()); + + if(m_tb.m_hWnd != NULL) + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + + m_tb.SetButtonStructSize(); + + TBBUTTON tbbtn = { 0 }; + tbbtn.idCommand = pT->m_nCloseBtnID; + tbbtn.fsState = TBSTATE_ENABLED; + tbbtn.fsStyle = TBSTYLE_BUTTON; + m_tb.AddButtons(1, &tbbtn); + + m_tb.SetBitmapSize(m_cxImageTB, m_cyImageTB); + m_tb.SetButtonSize(m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB); + + if(IsVertical()) + m_tb.SetWindowPos(NULL, m_cxyBorder + m_cxyBtnOffset, m_cxyBorder + m_cxyBtnOffset, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOACTIVATE); + else + m_tb.SetWindowPos(NULL, 0, 0, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + } + } + + void DestroyCloseButton() + { + if(m_tb.m_hWnd != NULL) + m_tb.DestroyWindow(); + } + + void CalcSize() + { + T* pT = static_cast(this); + CFontHandle font = pT->GetTitleFont(); + LOGFONT lf = { 0 }; + font.GetLogFont(lf); + if(IsVertical()) + { + m_cxyHeader = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder; + } + else + { + int cyFont = abs(lf.lfHeight) + m_cxyBorder + 2 * m_cxyTextOffset; + int cyBtn = m_cyImageTB + m_cxyBtnAddTB + m_cxyBorder + 2 * m_cxyBtnOffset; + m_cxyHeader = max(cyFont, cyBtn); + } + } + + HFONT GetTitleFont() const + { + return AtlGetDefaultGuiFont(); + } + +#ifndef _WIN32_WCE + BOOL GetToolTipText(LPNMHDR /*lpnmh*/) + { + return FALSE; + } +#endif // !_WIN32_WCE + + void DrawPaneTitle(CDCHandle dc) + { + RECT rect = { 0 }; + GetClientRect(&rect); + + UINT uBorder = BF_LEFT | BF_TOP | BF_ADJUST; + if(IsVertical()) + { + rect.right = rect.left + m_cxyHeader; + uBorder |= BF_BOTTOM; + } + else + { + rect.bottom = rect.top + m_cxyHeader; + uBorder |= BF_RIGHT; + } + + if((m_dwExtendedStyle & PANECNT_NOBORDER) == 0) + { + if((m_dwExtendedStyle & PANECNT_FLATBORDER) != 0) + uBorder |= BF_FLAT; + dc.DrawEdge(&rect, EDGE_ETCHED, uBorder); + } + dc.FillRect(&rect, COLOR_3DFACE); + + if(!IsVertical()) // draw title only for horizontal pane container + { + dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT)); + dc.SetBkMode(TRANSPARENT); + T* pT = static_cast(this); + HFONT hFontOld = dc.SelectFont(pT->GetTitleFont()); + rect.left += m_cxyTextOffset; + rect.right -= m_cxyTextOffset; + if(m_tb.m_hWnd != NULL) + rect.right -= m_cxToolBar;; +#ifndef _WIN32_WCE + dc.DrawText(m_szTitle, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS); +#else // CE specific + dc.DrawText(m_szTitle, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER); +#endif // _WIN32_WCE + dc.SelectFont(hFontOld); + } + } + + // called only if pane is empty + void DrawPane(CDCHandle dc) + { + RECT rect = { 0 }; + GetClientRect(&rect); + if(IsVertical()) + rect.left += m_cxyHeader; + else + rect.top += m_cxyHeader; + if((GetExStyle() & WS_EX_CLIENTEDGE) == 0) + dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); + dc.FillRect(&rect, COLOR_APPWORKSPACE); + } + + // drawing helper - draws "x" button image + void DrawButtonImage(CDCHandle dc, RECT& rcImage, HPEN hPen) + { +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + HPEN hPenOld = dc.SelectPen(hPen); + + dc.MoveTo(rcImage.left, rcImage.top); + dc.LineTo(rcImage.right, rcImage.bottom); + dc.MoveTo(rcImage.left + 1, rcImage.top); + dc.LineTo(rcImage.right + 1, rcImage.bottom); + + dc.MoveTo(rcImage.left, rcImage.bottom - 1); + dc.LineTo(rcImage.right, rcImage.top - 1); + dc.MoveTo(rcImage.left + 1, rcImage.bottom - 1); + dc.LineTo(rcImage.right + 1, rcImage.top - 1); + + dc.SelectPen(hPenOld); +#else // (_WIN32_WCE < 400) + rcImage; + hPen; + // no support for the "x" button image +#endif // (_WIN32_WCE < 400) + } + + bool IsVertical() const + { + return ((m_dwExtendedStyle & PANECNT_VERTICAL) != 0); + } +}; + +class CPaneContainer : public CPaneContainerImpl +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_PaneContainer"), 0, -1) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CSortListViewCtrl - implements sorting for a listview control + +// sort listview extended styles +#define SORTLV_USESHELLBITMAPS 0x00000001 + +// Notification sent to parent when sort column is changed by user clicking header. +#define SLVN_SORTCHANGED LVN_LAST + +// A LPNMSORTLISTVIEW is sent with the SLVN_SORTCHANGED notification +typedef struct tagNMSORTLISTVIEW +{ + NMHDR hdr; + int iNewSortColumn; + int iOldSortColumn; +} NMSORTLISTVIEW, *LPNMSORTLISTVIEW; + +// Column sort types. Can be set on a per-column basis with the SetColumnSortType method. +enum +{ + LVCOLSORT_NONE, + LVCOLSORT_TEXT, // default + LVCOLSORT_TEXTNOCASE, + LVCOLSORT_LONG, + LVCOLSORT_DOUBLE, + LVCOLSORT_DECIMAL, + LVCOLSORT_DATETIME, + LVCOLSORT_DATE, + LVCOLSORT_TIME, + LVCOLSORT_CUSTOM, + LVCOLSORT_LAST = LVCOLSORT_CUSTOM +}; + + +template +class CSortListViewImpl +{ +public: + enum + { + m_cchCmpTextMax = 32, // overrideable + m_cxSortImage = 16, + m_cySortImage = 15, + m_cxSortArrow = 11, + m_cySortArrow = 6, + m_iSortUp = 0, // index of sort bitmaps + m_iSortDown = 1, + m_nShellSortUpID = 133 + }; + + // passed to LVCompare functions as lParam1 and lParam2 + struct LVCompareParam + { + int iItem; + DWORD_PTR dwItemData; + union + { + long lValue; + double dblValue; + DECIMAL decValue; + LPCTSTR pszValue; + }; + }; + + // passed to LVCompare functions as the lParamSort parameter + struct LVSortInfo + { + T* pT; + int iSortCol; + bool bDescending; + }; + + bool m_bSortDescending; + bool m_bCommCtrl6; + int m_iSortColumn; + CBitmap m_bmSort[2]; + int m_fmtOldSortCol; + HBITMAP m_hbmOldSortCol; + DWORD m_dwSortLVExtendedStyle; + ATL::CSimpleArray m_arrColSortType; + bool m_bUseWaitCursor; + + CSortListViewImpl() : + m_bSortDescending(false), + m_bCommCtrl6(false), + m_iSortColumn(-1), + m_fmtOldSortCol(0), + m_hbmOldSortCol(NULL), + m_dwSortLVExtendedStyle(SORTLV_USESHELLBITMAPS), + m_bUseWaitCursor(true) + { +#ifndef _WIN32_WCE + DWORD dwMajor = 0; + DWORD dwMinor = 0; + HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); + m_bCommCtrl6 = SUCCEEDED(hRet) && dwMajor >= 6; +#endif // !_WIN32_WCE + } + +// Attributes + void SetSortColumn(int iCol) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + CHeaderCtrl header = pT->GetHeader(); + ATLASSERT(header.m_hWnd != NULL); + ATLASSERT(iCol >= -1 && iCol < m_arrColSortType.GetSize()); + + int iOldSortCol = m_iSortColumn; + m_iSortColumn = iCol; + if(m_bCommCtrl6) + { +#ifndef HDF_SORTUP + const int HDF_SORTUP = 0x0400; +#endif // HDF_SORTUP +#ifndef HDF_SORTDOWN + const int HDF_SORTDOWN = 0x0200; +#endif // HDF_SORTDOWN + const int nMask = HDF_SORTUP | HDF_SORTDOWN; + HDITEM hditem = { HDI_FORMAT }; + if(iOldSortCol != iCol && iOldSortCol >= 0 && header.GetItem(iOldSortCol, &hditem)) + { + hditem.fmt &= ~nMask; + header.SetItem(iOldSortCol, &hditem); + } + if(iCol >= 0 && header.GetItem(iCol, &hditem)) + { + hditem.fmt &= ~nMask; + hditem.fmt |= m_bSortDescending ? HDF_SORTDOWN : HDF_SORTUP; + header.SetItem(iCol, &hditem); + } + return; + } + + if(m_bmSort[m_iSortUp].IsNull()) + pT->CreateSortBitmaps(); + + // restore previous sort column's bitmap, if any, and format + HDITEM hditem = { HDI_BITMAP | HDI_FORMAT }; + if(iOldSortCol != iCol && iOldSortCol >= 0) + { + hditem.hbm = m_hbmOldSortCol; + hditem.fmt = m_fmtOldSortCol; + header.SetItem(iOldSortCol, &hditem); + } + + // save new sort column's bitmap and format, and add our sort bitmap + if(iCol >= 0 && header.GetItem(iCol, &hditem)) + { + if(iOldSortCol != iCol) + { + m_fmtOldSortCol = hditem.fmt; + m_hbmOldSortCol = hditem.hbm; + } + hditem.fmt &= ~HDF_IMAGE; + hditem.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT; + int i = m_bSortDescending ? m_iSortDown : m_iSortUp; + hditem.hbm = m_bmSort[i]; + header.SetItem(iCol, &hditem); + } + } + + int GetSortColumn() const + { + return m_iSortColumn; + } + + void SetColumnSortType(int iCol, WORD wType) + { + ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); + ATLASSERT(wType >= LVCOLSORT_NONE && wType <= LVCOLSORT_LAST); + m_arrColSortType[iCol] = wType; + } + + WORD GetColumnSortType(int iCol) const + { + ATLASSERT((iCol >= 0) && iCol < m_arrColSortType.GetSize()); + return m_arrColSortType[iCol]; + } + + int GetColumnCount() const + { + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + CHeaderCtrl header = pT->GetHeader(); + return header.m_hWnd != NULL ? header.GetItemCount() : 0; + } + + bool IsSortDescending() const + { + return m_bSortDescending; + } + + DWORD GetSortListViewExtendedStyle() const + { + return m_dwSortLVExtendedStyle; + } + + DWORD SetSortListViewExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwSortLVExtendedStyle; + if(dwMask == 0) + m_dwSortLVExtendedStyle = dwExtendedStyle; + else + m_dwSortLVExtendedStyle = (m_dwSortLVExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + return dwPrevStyle; + } + +// Operations + bool DoSortItems(int iCol, bool bDescending = false) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); + + WORD wType = m_arrColSortType[iCol]; + if(wType == LVCOLSORT_NONE) + return false; + + int nCount = pT->GetItemCount(); + if(nCount < 2) + { + m_bSortDescending = bDescending; + SetSortColumn(iCol); + return true; + } + + CWaitCursor waitCursor(false); + if(m_bUseWaitCursor) + waitCursor.Set(); + + LVCompareParam* pParam = NULL; + ATLTRY(pParam = new LVCompareParam[nCount]); + PFNLVCOMPARE pFunc = NULL; + TCHAR pszTemp[pT->m_cchCmpTextMax]; + bool bStrValue = false; + + switch(wType) + { + case LVCOLSORT_TEXT: + pFunc = (PFNLVCOMPARE)pT->LVCompareText; + case LVCOLSORT_TEXTNOCASE: + if(pFunc == NULL) + pFunc = (PFNLVCOMPARE)pT->LVCompareTextNoCase; + case LVCOLSORT_CUSTOM: + { + if(pFunc == NULL) + pFunc = (PFNLVCOMPARE)pT->LVCompareCustom; + + for(int i = 0; i < nCount; i++) + { + pParam[i].iItem = i; + pParam[i].dwItemData = pT->GetItemData(i); + pParam[i].pszValue = new TCHAR[pT->m_cchCmpTextMax]; + pT->GetItemText(i, iCol, (LPTSTR)pParam[i].pszValue, pT->m_cchCmpTextMax); + pT->SetItemData(i, (DWORD_PTR)&pParam[i]); + } + bStrValue = true; + } + break; + case LVCOLSORT_LONG: + { + pFunc = (PFNLVCOMPARE)pT->LVCompareLong; + for(int i = 0; i < nCount; i++) + { + pParam[i].iItem = i; + pParam[i].dwItemData = pT->GetItemData(i); + pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); + pParam[i].lValue = pT->StrToLong(pszTemp); + pT->SetItemData(i, (DWORD_PTR)&pParam[i]); + } + } + break; + case LVCOLSORT_DOUBLE: + { + pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; + for(int i = 0; i < nCount; i++) + { + pParam[i].iItem = i; + pParam[i].dwItemData = pT->GetItemData(i); + pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); + pParam[i].dblValue = pT->StrToDouble(pszTemp); + pT->SetItemData(i, (DWORD_PTR)&pParam[i]); + } + } + break; + case LVCOLSORT_DECIMAL: + { + pFunc = (PFNLVCOMPARE)pT->LVCompareDecimal; + for(int i = 0; i < nCount; i++) + { + pParam[i].iItem = i; + pParam[i].dwItemData = pT->GetItemData(i); + pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); + pT->StrToDecimal(pszTemp, &pParam[i].decValue); + pT->SetItemData(i, (DWORD_PTR)&pParam[i]); + } + } + break; + case LVCOLSORT_DATETIME: + case LVCOLSORT_DATE: + case LVCOLSORT_TIME: + { + pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; + DWORD dwFlags = LOCALE_NOUSEROVERRIDE; + if(wType == LVCOLSORT_DATE) + dwFlags |= VAR_DATEVALUEONLY; + else if(wType == LVCOLSORT_TIME) + dwFlags |= VAR_TIMEVALUEONLY; + for(int i = 0; i < nCount; i++) + { + pParam[i].iItem = i; + pParam[i].dwItemData = pT->GetItemData(i); + pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); + pParam[i].dblValue = pT->DateStrToDouble(pszTemp, dwFlags); + pT->SetItemData(i, (DWORD_PTR)&pParam[i]); + } + } + break; + default: + ATLTRACE2(atlTraceUI, 0, _T("Unknown value for sort type in CSortListViewImpl::DoSortItems()\n")); + break; + } // switch(wType) + + ATLASSERT(pFunc != NULL); + LVSortInfo lvsi = { pT, iCol, bDescending }; + bool bRet = ((BOOL)pT->DefWindowProc(LVM_SORTITEMS, (WPARAM)&lvsi, (LPARAM)pFunc) != FALSE); + for(int i = 0; i < nCount; i++) + { + DWORD_PTR dwItemData = pT->GetItemData(i); + LVCompareParam* p = (LVCompareParam*)dwItemData; + ATLASSERT(p != NULL); + if(bStrValue) + delete [] (TCHAR*)p->pszValue; + pT->SetItemData(i, p->dwItemData); + } + delete [] pParam; + + if(bRet) + { + m_bSortDescending = bDescending; + SetSortColumn(iCol); + } + + if(m_bUseWaitCursor) + waitCursor.Restore(); + + return bRet; + } + + void CreateSortBitmaps() + { + if((m_dwSortLVExtendedStyle & SORTLV_USESHELLBITMAPS) != 0) + { + bool bFree = false; + LPCTSTR pszModule = _T("shell32.dll"); + HINSTANCE hShell = ::GetModuleHandle(pszModule); + + if (hShell == NULL) + { + hShell = ::LoadLibrary(pszModule); + bFree = true; + } + + if (hShell != NULL) + { + bool bSuccess = true; + for(int i = m_iSortUp; i <= m_iSortDown; i++) + { + if(!m_bmSort[i].IsNull()) + m_bmSort[i].DeleteObject(); + m_bmSort[i] = (HBITMAP)::LoadImage(hShell, MAKEINTRESOURCE(m_nShellSortUpID + i), +#ifndef _WIN32_WCE + IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); +#else // CE specific + IMAGE_BITMAP, 0, 0, 0); +#endif // _WIN32_WCE + if(m_bmSort[i].IsNull()) + { + bSuccess = false; + break; + } + } + if(bFree) + ::FreeLibrary(hShell); + if(bSuccess) + return; + } + } + + T* pT = static_cast(this); + for(int i = m_iSortUp; i <= m_iSortDown; i++) + { + if(!m_bmSort[i].IsNull()) + m_bmSort[i].DeleteObject(); + + CDC dcMem; + CClientDC dc(::GetDesktopWindow()); + dcMem.CreateCompatibleDC(dc.m_hDC); + m_bmSort[i].CreateCompatibleBitmap(dc.m_hDC, m_cxSortImage, m_cySortImage); + HBITMAP hbmOld = dcMem.SelectBitmap(m_bmSort[i]); + RECT rc = {0,0,m_cxSortImage, m_cySortImage}; + pT->DrawSortBitmap(dcMem.m_hDC, i, &rc); + dcMem.SelectBitmap(hbmOld); + dcMem.DeleteDC(); + } + } + + void NotifyParentSortChanged(int iNewSortCol, int iOldSortCol) + { + T* pT = static_cast(this); + int nID = pT->GetDlgCtrlID(); + NMSORTLISTVIEW nm = { { pT->m_hWnd, nID, SLVN_SORTCHANGED }, iNewSortCol, iOldSortCol }; + ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nID, (LPARAM)&nm); + } + +// Overrideables + int CompareItemsCustom(LVCompareParam* /*pItem1*/, LVCompareParam* /*pItem2*/, int /*iSortCol*/) + { + // pItem1 and pItem2 contain valid iItem, dwItemData, and pszValue members. + // If item1 > item2 return 1, if item1 < item2 return -1, else return 0. + return 0; + } + + void DrawSortBitmap(CDCHandle dc, int iBitmap, LPRECT prc) + { + dc.FillRect(prc, ::GetSysColorBrush(COLOR_BTNFACE)); + HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); + CPen pen; + pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNSHADOW)); + HPEN hpenOld = dc.SelectPen(pen); + POINT ptOrg = { (m_cxSortImage - m_cxSortArrow) / 2, (m_cySortImage - m_cySortArrow) / 2 }; + if(iBitmap == m_iSortUp) + { + POINT pts[3] = + { + { ptOrg.x + m_cxSortArrow / 2, ptOrg.y }, + { ptOrg.x, ptOrg.y + m_cySortArrow - 1 }, + { ptOrg.x + m_cxSortArrow - 1, ptOrg.y + m_cySortArrow - 1 } + }; + dc.Polygon(pts, 3); + } + else + { + POINT pts[3] = + { + { ptOrg.x, ptOrg.y }, + { ptOrg.x + m_cxSortArrow / 2, ptOrg.y + m_cySortArrow - 1 }, + { ptOrg.x + m_cxSortArrow - 1, ptOrg.y } + }; + dc.Polygon(pts, 3); + } + dc.SelectBrush(hbrOld); + dc.SelectPen(hpenOld); + } + + double DateStrToDouble(LPCTSTR lpstr, DWORD dwFlags) + { + ATLASSERT(lpstr != NULL); + if(lpstr == NULL || lpstr[0] == _T('\0')) + return 0; + + USES_CONVERSION; + HRESULT hRet = E_FAIL; + DATE dRet = 0; + if (FAILED(hRet = ::VarDateFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, dwFlags, &dRet))) + { + ATLTRACE2(atlTraceUI, 0, _T("VarDateFromStr failed with result of 0x%8.8X\n"), hRet); + dRet = 0; + } + return dRet; + } + + long StrToLong(LPCTSTR lpstr) + { + ATLASSERT(lpstr != NULL); + if(lpstr == NULL || lpstr[0] == _T('\0')) + return 0; + + USES_CONVERSION; + HRESULT hRet = E_FAIL; + long lRet = 0; + if (FAILED(hRet = ::VarI4FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &lRet))) + { + ATLTRACE2(atlTraceUI, 0, _T("VarI4FromStr failed with result of 0x%8.8X\n"), hRet); + lRet = 0; + } + return lRet; + } + + double StrToDouble(LPCTSTR lpstr) + { + ATLASSERT(lpstr != NULL); + if(lpstr == NULL || lpstr[0] == _T('\0')) + return 0; + + USES_CONVERSION; + HRESULT hRet = E_FAIL; + double dblRet = 0; + if (FAILED(hRet = ::VarR8FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &dblRet))) + { + ATLTRACE2(atlTraceUI, 0, _T("VarR8FromStr failed with result of 0x%8.8X\n"), hRet); + dblRet = 0; + } + return dblRet; + } + + bool StrToDecimal(LPCTSTR lpstr, DECIMAL* pDecimal) + { + ATLASSERT(lpstr != NULL); + ATLASSERT(pDecimal != NULL); + if(lpstr == NULL || pDecimal == NULL) + return false; + + USES_CONVERSION; + HRESULT hRet = E_FAIL; + if (FAILED(hRet = ::VarDecFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, pDecimal))) + { + ATLTRACE2(atlTraceUI, 0, _T("VarDecFromStr failed with result of 0x%8.8X\n"), hRet); + pDecimal->Lo64 = 0; + pDecimal->Hi32 = 0; + pDecimal->signscale = 0; + return false; + } + return true; + } + +// Overrideable PFNLVCOMPARE functions + static int CALLBACK LVCompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = lstrcmp(pParam1->pszValue, pParam2->pszValue); + return pInfo->bDescending ? -nRet : nRet; + } + + static int CALLBACK LVCompareTextNoCase(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = lstrcmpi(pParam1->pszValue, pParam2->pszValue); + return pInfo->bDescending ? -nRet : nRet; + } + + static int CALLBACK LVCompareLong(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = 0; + if(pParam1->lValue > pParam2->lValue) + nRet = 1; + else if(pParam1->lValue < pParam2->lValue) + nRet = -1; + return pInfo->bDescending ? -nRet : nRet; + } + + static int CALLBACK LVCompareDouble(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = 0; + if(pParam1->dblValue > pParam2->dblValue) + nRet = 1; + else if(pParam1->dblValue < pParam2->dblValue) + nRet = -1; + return pInfo->bDescending ? -nRet : nRet; + } + + static int CALLBACK LVCompareCustom(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = pInfo->pT->CompareItemsCustom(pParam1, pParam2, pInfo->iSortCol); + return pInfo->bDescending ? -nRet : nRet; + } + +#ifndef _WIN32_WCE + static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = (int)::VarDecCmp(&pParam1->decValue, &pParam2->decValue); + nRet--; + return pInfo->bDescending ? -nRet : nRet; + } +#else + // Compare mantissas, ignore sign and scale + static int CompareMantissas(const DECIMAL& decLeft, const DECIMAL& decRight) + { + if (decLeft.Hi32 < decRight.Hi32) + { + return -1; + } + if (decLeft.Hi32 > decRight.Hi32) + { + return 1; + } + // Here, decLeft.Hi32 == decRight.Hi32 + if (decLeft.Lo64 < decRight.Lo64) + { + return -1; + } + if (decLeft.Lo64 > decRight.Lo64) + { + return 1; + } + return 0; + } + + // return values: VARCMP_LT, VARCMP_EQ, VARCMP_GT, VARCMP_NULL + static HRESULT VarDecCmp(const DECIMAL* pdecLeft, const DECIMAL* pdecRight) + { + static const ULONG powersOfTen[] = + { + 10ul, + 100ul, + 1000ul, + 10000ul, + 100000ul, + 1000000ul, + 10000000ul, + 100000000ul, + 1000000000ul + }; + static const int largestPower = sizeof(powersOfTen) / sizeof(powersOfTen[0]); + if (!pdecLeft || !pdecRight) + { + return VARCMP_NULL; + } + + // Degenerate case - at least one comparand is of the form + // [+-]0*10^N (denormalized zero) + bool bLeftZero = (!pdecLeft->Lo64 && !pdecLeft->Hi32); + bool bRightZero = (!pdecRight->Lo64 && !pdecRight->Hi32); + if (bLeftZero && bRightZero) + { + return VARCMP_EQ; + } + bool bLeftNeg = ((pdecLeft->sign & DECIMAL_NEG) != 0); + bool bRightNeg = ((pdecRight->sign & DECIMAL_NEG) != 0); + if (bLeftZero) + { + return (bRightNeg ? VARCMP_GT : VARCMP_LT); + } + // This also covers the case where the comparands have different signs + if (bRightZero || bLeftNeg != bRightNeg) + { + return (bLeftNeg ? VARCMP_LT : VARCMP_GT); + } + + // Here both comparands have the same sign and need to be compared + // on mantissa and scale. The result is obvious when + // 1. Scales are equal (then compare mantissas) + // 2. A number with smaller scale is also the one with larger mantissa + // (then this number is obviously larger) + // In the remaining case, we would multiply the number with smaller + // scale by 10 and simultaneously increment its scale (which amounts to + // adding trailing zeros after decimal point), until the numbers fall under + // one of the two cases above + DECIMAL temp; + bool bInvert = bLeftNeg; // the final result needs to be inverted + if (pdecLeft->scale < pdecRight->scale) + { + temp = *pdecLeft; + } + else + { + temp = *pdecRight; + pdecRight = pdecLeft; + bInvert = !bInvert; + } + + // Now temp is the number with smaller (or equal) scale, and + // we can modify it freely without touching original parameters + int comp; + while ((comp = CompareMantissas(temp, *pdecRight)) < 0 && + temp.scale < pdecRight->scale) + { + // Multiply by an appropriate power of 10 + int scaleDiff = pdecRight->scale - temp.scale; + if (scaleDiff > largestPower) + { + // Keep the multiplier representable in 32bit + scaleDiff = largestPower; + } + DWORDLONG power = powersOfTen[scaleDiff - 1]; + // Multiply temp's mantissa by power + DWORDLONG product = temp.Lo32 * power; + ULONG carry = static_cast(product >> 32); + temp.Lo32 = static_cast(product); + product = temp.Mid32 * power + carry; + carry = static_cast(product >> 32); + temp.Mid32 = static_cast(product); + product = temp.Hi32 * power + carry; + if (static_cast(product >> 32)) + { + // Multiplication overflowed - pdecLeft is clearly larger + break; + } + temp.Hi32 = static_cast(product); + temp.scale = (BYTE)(temp.scale + scaleDiff); + } + if (temp.scale < pdecRight->scale) + { + comp = 1; + } + if (bInvert) + { + comp = -comp; + } + return (comp > 0 ? VARCMP_GT : comp < 0 ? VARCMP_LT : VARCMP_EQ); + } + + static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) + { + ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + + LVCompareParam* pParam1 = (LVCompareParam*)lParam1; + LVCompareParam* pParam2 = (LVCompareParam*)lParam2; + LVSortInfo* pInfo = (LVSortInfo*)lParamSort; + + int nRet = (int)VarDecCmp(&pParam1->decValue, &pParam2->decValue); + nRet--; + return pInfo->bDescending ? -nRet : nRet; + } +#endif // !_WIN32_WCE + + BEGIN_MSG_MAP(CSortListViewImpl) + MESSAGE_HANDLER(LVM_INSERTCOLUMN, OnInsertColumn) + MESSAGE_HANDLER(LVM_DELETECOLUMN, OnDeleteColumn) + NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, OnHeaderItemClick) + NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, OnHeaderItemClick) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) + END_MSG_MAP() + + LRESULT OnInsertColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); + if(lRet == -1) + return -1; + + WORD wType = 0; + m_arrColSortType.Add(wType); + int nCount = m_arrColSortType.GetSize(); + ATLASSERT(nCount == GetColumnCount()); + + for(int i = nCount - 1; i > lRet; i--) + m_arrColSortType[i] = m_arrColSortType[i - 1]; + m_arrColSortType[(int)lRet] = LVCOLSORT_TEXT; + + if(lRet <= m_iSortColumn) + m_iSortColumn++; + + return lRet; + } + + LRESULT OnDeleteColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); + if(lRet == 0) + return 0; + + int iCol = (int)wParam; + if(m_iSortColumn == iCol) + m_iSortColumn = -1; + else if(m_iSortColumn > iCol) + m_iSortColumn--; + m_arrColSortType.RemoveAt(iCol); + + return lRet; + } + + LRESULT OnHeaderItemClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + LPNMHEADER p = (LPNMHEADER)pnmh; + if(p->iButton == 0) + { + int iOld = m_iSortColumn; + bool bDescending = (m_iSortColumn == p->iItem) ? !m_bSortDescending : false; + if(DoSortItems(p->iItem, bDescending)) + NotifyParentSortChanged(p->iItem, iOld); + } + bHandled = FALSE; + return 0; + } + + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifndef _WIN32_WCE + if(wParam == SPI_SETNONCLIENTMETRICS) + GetSystemSettings(); +#else // CE specific + wParam; // avoid level 4 warning + GetSystemSettings(); +#endif // _WIN32_WCE + bHandled = FALSE; + return 0; + } + + void GetSystemSettings() + { + if(!m_bCommCtrl6 && !m_bmSort[m_iSortUp].IsNull()) + { + T* pT = static_cast(this); + pT->CreateSortBitmaps(); + if(m_iSortColumn != -1) + SetSortColumn(m_iSortColumn); + } + } + +}; + + +typedef ATL::CWinTraits CSortListViewCtrlTraits; + +template +class ATL_NO_VTABLE CSortListViewCtrlImpl: public ATL::CWindowImpl, public CSortListViewImpl +{ +public: + DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) + + bool SortItems(int iCol, bool bDescending = false) + { + return DoSortItems(iCol, bDescending); + } + + BEGIN_MSG_MAP(CSortListViewCtrlImpl) + MESSAGE_HANDLER(LVM_INSERTCOLUMN, CSortListViewImpl::OnInsertColumn) + MESSAGE_HANDLER(LVM_DELETECOLUMN, CSortListViewImpl::OnDeleteColumn) + NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, CSortListViewImpl::OnHeaderItemClick) + NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, CSortListViewImpl::OnHeaderItemClick) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CSortListViewImpl::OnSettingChange) + END_MSG_MAP() +}; + +class CSortListViewCtrl : public CSortListViewCtrlImpl +{ +public: + DECLARE_WND_SUPERCLASS(_T("WTL_SortListViewCtrl"), GetWndClassName()) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CTabView - implements tab view window + +// TabView Notifications +#define TBVN_PAGEACTIVATED (0U-741) +#define TBVN_CONTEXTMENU (0U-742) + +// Notification data for TBVN_CONTEXTMENU +struct TBVCONTEXTMENUINFO +{ + NMHDR hdr; + POINT pt; +}; + +typedef TBVCONTEXTMENUINFO* LPTBVCONTEXTMENUINFO; + + +template +class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl +{ +public: + DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) + +// Declarations and enums + struct TABVIEWPAGE + { + HWND hWnd; + LPTSTR lpstrTitle; + LPVOID pData; + }; + + struct TCITEMEXTRA + { + TCITEMHEADER tciheader; + TABVIEWPAGE tvpage; + + operator LPTCITEM() { return (LPTCITEM)this; } + }; + + enum + { + m_nTabID = 1313, + m_cxMoveMark = 6, + m_cyMoveMark = 3, + m_nMenuItemsMax = (ID_WINDOW_TABLAST - ID_WINDOW_TABFIRST + 1) + }; + +// Data members + ATL::CContainedWindowT m_tab; + int m_cyTabHeight; + + int m_nActivePage; + + int m_nInsertItem; + POINT m_ptStartDrag; + + CMenuHandle m_menu; + + int m_cchTabTextLength; + + int m_nMenuItemsCount; + + ATL::CWindow m_wndTitleBar; + LPTSTR m_lpstrTitleBarBase; + int m_cchTitleBarLength; + + CImageList m_ilDrag; + + bool m_bDestroyPageOnRemove:1; + bool m_bDestroyImageList:1; + bool m_bActivePageMenuItem:1; + bool m_bActiveAsDefaultMenuItem:1; + bool m_bEmptyMenuItem:1; + bool m_bWindowsMenuItem:1; + // internal + bool m_bTabCapture:1; + bool m_bTabDrag:1; + +// Constructor/destructor + CTabViewImpl() : + m_nActivePage(-1), + m_cyTabHeight(0), + m_tab(this, 1), + m_nInsertItem(-1), + m_cchTabTextLength(30), + m_nMenuItemsCount(10), + m_lpstrTitleBarBase(NULL), + m_cchTitleBarLength(100), + m_bDestroyPageOnRemove(true), + m_bDestroyImageList(true), + m_bActivePageMenuItem(true), + m_bActiveAsDefaultMenuItem(false), + m_bEmptyMenuItem(false), + m_bWindowsMenuItem(false), + m_bTabCapture(false), + m_bTabDrag(false) + { + m_ptStartDrag.x = 0; + m_ptStartDrag.y = 0; + } + + ~CTabViewImpl() + { + delete [] m_lpstrTitleBarBase; + } + +// Message filter function - to be called from PreTranslateMessage of the main window + BOOL PreTranslateMessage(MSG* pMsg) + { + if(IsWindow() == FALSE) + return FALSE; + + BOOL bRet = FALSE; + + // Check for TabView built-in accelerators (Ctrl+Tab/Ctrl+Shift+Tab - next/previous page) + int nCount = GetPageCount(); + if(nCount > 0) + { + bool bControl = (::GetKeyState(VK_CONTROL) < 0); + if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) && bControl) + { + if(nCount > 1) + { + int nPage = m_nActivePage; + bool bShift = (::GetKeyState(VK_SHIFT) < 0); + if(bShift) + nPage = (nPage > 0) ? (nPage - 1) : (nCount - 1); + else + nPage = ((nPage >= 0) && (nPage < (nCount - 1))) ? (nPage + 1) : 0; + + SetActivePage(nPage); + T* pT = static_cast(this); + pT->OnPageActivated(m_nActivePage); + } + + bRet = TRUE; + } + } + + // If we are doing drag-drop, check for Escape key that cancels it + if(bRet == FALSE) + { + if(m_bTabCapture && pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) + { + ::ReleaseCapture(); + bRet = TRUE; + } + } + + // Pass the message to the active page + if(bRet == FALSE) + { + if(m_nActivePage != -1) + bRet = (BOOL)::SendMessage(GetPageHWND(m_nActivePage), WM_FORWARDMSG, 0, (LPARAM)pMsg); + } + + return bRet; + } + +// Attributes + int GetPageCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return m_tab.GetItemCount(); + } + + int GetActivePage() const + { + return m_nActivePage; + } + + void SetActivePage(int nPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + T* pT = static_cast(this); + + SetRedraw(FALSE); + + if(m_nActivePage != -1) + ::ShowWindow(GetPageHWND(m_nActivePage), FALSE); + m_nActivePage = nPage; + m_tab.SetCurSel(m_nActivePage); + ::ShowWindow(GetPageHWND(m_nActivePage), TRUE); + + pT->UpdateLayout(); + + SetRedraw(TRUE); + RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + + if(::GetFocus() != m_tab.m_hWnd) + ::SetFocus(GetPageHWND(m_nActivePage)); + + pT->UpdateTitleBar(); + pT->UpdateMenu(); + } + + HIMAGELIST GetImageList() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return m_tab.GetImageList(); + } + + HIMAGELIST SetImageList(HIMAGELIST hImageList) + { + ATLASSERT(::IsWindow(m_hWnd)); + return m_tab.SetImageList(hImageList); + } + + void SetWindowMenu(HMENU hMenu) + { + ATLASSERT(::IsWindow(m_hWnd)); + + m_menu = hMenu; + + T* pT = static_cast(this); + pT->UpdateMenu(); + } + + void SetTitleBarWindow(HWND hWnd) + { + ATLASSERT(::IsWindow(m_hWnd)); + + delete [] m_lpstrTitleBarBase; + m_lpstrTitleBarBase = NULL; + + m_wndTitleBar = hWnd; + if(hWnd == NULL) + return; + + int cchLen = m_wndTitleBar.GetWindowTextLength() + 1; + ATLTRY(m_lpstrTitleBarBase = new TCHAR[cchLen]); + if(m_lpstrTitleBarBase != NULL) + { + m_wndTitleBar.GetWindowText(m_lpstrTitleBarBase, cchLen); + T* pT = static_cast(this); + pT->UpdateTitleBar(); + } + } + +// Page attributes + HWND GetPageHWND(int nPage) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_PARAM; + m_tab.GetItem(nPage, tcix); + + return tcix.tvpage.hWnd; + } + + LPCTSTR GetPageTitle(int nPage) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_PARAM; + if(m_tab.GetItem(nPage, tcix) == FALSE) + return NULL; + + return tcix.tvpage.lpstrTitle; + } + + bool SetPageTitle(int nPage, LPCTSTR lpstrTitle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + T* pT = static_cast(this); + + int cchBuff = lstrlen(lpstrTitle) + 1; + LPTSTR lpstrBuff = NULL; + ATLTRY(lpstrBuff = new TCHAR[cchBuff]); + if(lpstrBuff == NULL) + return false; + + SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_PARAM; + if(m_tab.GetItem(nPage, tcix) == FALSE) + return false; + + CTempBuffer buff; + LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); + if(lpstrTabText == NULL) + return false; + + delete [] tcix.tvpage.lpstrTitle; + + pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); + + tcix.tciheader.mask = TCIF_TEXT | TCIF_PARAM; + tcix.tciheader.pszText = lpstrTabText; + tcix.tvpage.lpstrTitle = lpstrBuff; + if(m_tab.SetItem(nPage, tcix) == FALSE) + return false; + + pT->UpdateTitleBar(); + pT->UpdateMenu(); + + return true; + } + + LPVOID GetPageData(int nPage) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_PARAM; + m_tab.GetItem(nPage, tcix); + + return tcix.tvpage.pData; + } + + LPVOID SetPageData(int nPage, LPVOID pData) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_PARAM; + m_tab.GetItem(nPage, tcix); + LPVOID pDataOld = tcix.tvpage.pData; + + tcix.tvpage.pData = pData; + m_tab.SetItem(nPage, tcix); + + return pDataOld; + } + + int GetPageImage(int nPage) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_IMAGE; + m_tab.GetItem(nPage, tcix); + + return tcix.tciheader.iImage; + } + + int SetPageImage(int nPage, int nImage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_IMAGE; + m_tab.GetItem(nPage, tcix); + int nImageOld = tcix.tciheader.iImage; + + tcix.tciheader.iImage = nImage; + m_tab.SetItem(nPage, tcix); + + return nImageOld; + } + +// Operations + bool AddPage(HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) + { + return InsertPage(GetPageCount(), hWndView, lpstrTitle, nImage, pData); + } + + bool InsertPage(int nPage, HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(nPage == GetPageCount() || IsValidPageIndex(nPage)); + + T* pT = static_cast(this); + + int cchBuff = lstrlen(lpstrTitle) + 1; + LPTSTR lpstrBuff = NULL; + ATLTRY(lpstrBuff = new TCHAR[cchBuff]); + if(lpstrBuff == NULL) + return false; + + SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); + + CTempBuffer buff; + LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); + if(lpstrTabText == NULL) + return false; + + pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); + + SetRedraw(FALSE); + + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; + tcix.tciheader.pszText = lpstrTabText; + tcix.tciheader.iImage = nImage; + tcix.tvpage.hWnd = hWndView; + tcix.tvpage.lpstrTitle = lpstrBuff; + tcix.tvpage.pData = pData; + int nItem = m_tab.InsertItem(nPage, tcix); + if(nItem == -1) + { + delete [] lpstrBuff; + SetRedraw(TRUE); + return false; + } + + SetActivePage(nItem); + pT->OnPageActivated(m_nActivePage); + + if(GetPageCount() == 1) + pT->ShowTabControl(true); + + pT->UpdateLayout(); + + SetRedraw(TRUE); + RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + + return true; + } + + void RemovePage(int nPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(IsValidPageIndex(nPage)); + + T* pT = static_cast(this); + + SetRedraw(FALSE); + + if(GetPageCount() == 1) + pT->ShowTabControl(false); + + if(m_bDestroyPageOnRemove) + ::DestroyWindow(GetPageHWND(nPage)); + else + ::ShowWindow(GetPageHWND(nPage), FALSE); + LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(nPage); + delete [] lpstrTitle; + + ATLVERIFY(m_tab.DeleteItem(nPage) != FALSE); + + if(m_nActivePage == nPage) + { + m_nActivePage = -1; + + if(nPage > 0) + { + SetActivePage(nPage - 1); + } + else if(GetPageCount() > 0) + { + SetActivePage(nPage); + } + else + { + SetRedraw(TRUE); + Invalidate(); + UpdateWindow(); + pT->UpdateTitleBar(); + pT->UpdateMenu(); + } + } + else + { + nPage = (nPage < m_nActivePage) ? (m_nActivePage - 1) : m_nActivePage; + m_nActivePage = -1; + SetActivePage(nPage); + } + + pT->OnPageActivated(m_nActivePage); + } + + void RemoveAllPages() + { + ATLASSERT(::IsWindow(m_hWnd)); + + if(GetPageCount() == 0) + return; + + T* pT = static_cast(this); + + SetRedraw(FALSE); + + pT->ShowTabControl(false); + + for(int i = 0; i < GetPageCount(); i++) + { + if(m_bDestroyPageOnRemove) + ::DestroyWindow(GetPageHWND(i)); + else + ::ShowWindow(GetPageHWND(i), FALSE); + LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(i); + delete [] lpstrTitle; + } + m_tab.DeleteAllItems(); + + m_nActivePage = -1; + pT->OnPageActivated(m_nActivePage); + + SetRedraw(TRUE); + Invalidate(); + UpdateWindow(); + + pT->UpdateTitleBar(); + pT->UpdateMenu(); + } + + int PageIndexFromHwnd(HWND hWnd) const + { + int nIndex = -1; + + for(int i = 0; i < GetPageCount(); i++) + { + if(GetPageHWND(i) == hWnd) + { + nIndex = i; + break; + } + } + + return nIndex; + } + + void BuildWindowMenu(HMENU hMenu, int nMenuItemsCount = 10, bool bEmptyMenuItem = true, bool bWindowsMenuItem = true, bool bActivePageMenuItem = true, bool bActiveAsDefaultMenuItem = false) + { + ATLASSERT(::IsWindow(m_hWnd)); + + CMenuHandle menu = hMenu; + T* pT = static_cast(this); + pT; // avoid level 4 warning + int nFirstPos = 0; + + // Find first menu item in our range +#ifndef _WIN32_WCE + for(nFirstPos = 0; nFirstPos < menu.GetMenuItemCount(); nFirstPos++) + { + UINT nID = menu.GetMenuItemID(nFirstPos); + if((nID >= ID_WINDOW_TABFIRST && nID <= ID_WINDOW_TABLAST) || nID == ID_WINDOW_SHOWTABLIST) + break; + } +#else // CE specific + for(nFirstPos = 0; ; nFirstPos++) + { + CMenuItemInfo mii; + mii.fMask = MIIM_ID; + BOOL bRet = menu.GetMenuItemInfo(nFirstPos, TRUE, &mii); + if(bRet == FALSE) + break; + if((mii.wID >= ID_WINDOW_TABFIRST && mii.wID <= ID_WINDOW_TABLAST) || mii.wID == ID_WINDOW_SHOWTABLIST) + break; + } +#endif // _WIN32_WCE + + // Remove all menu items for tab pages + BOOL bRet = TRUE; + while(bRet != FALSE) + bRet = menu.DeleteMenu(nFirstPos, MF_BYPOSITION); + + // Add separator if it's not already there + int nPageCount = GetPageCount(); + if((bWindowsMenuItem || (nPageCount > 0)) && (nFirstPos > 0)) + { + CMenuItemInfo mii; + mii.fMask = MIIM_TYPE; + menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); + if((nFirstPos <= 0) || ((mii.fType & MFT_SEPARATOR) == 0)) + { + menu.AppendMenu(MF_SEPARATOR); + nFirstPos++; + } + } + + // Add menu items for all pages + if(nPageCount > 0) + { + // Append menu items for all pages + const int cchPrefix = 3; // 2 digits + space + nMenuItemsCount = min(min(nPageCount, nMenuItemsCount), (int)m_nMenuItemsMax); + ATLASSERT(nMenuItemsCount < 100); // 2 digits only + if(nMenuItemsCount >= 100) + nMenuItemsCount = 99; + + for(int i = 0; i < nMenuItemsCount; i++) + { + LPCTSTR lpstrTitle = GetPageTitle(i); + int nLen = lstrlen(lpstrTitle); + CTempBuffer buff; + LPTSTR lpstrText = buff.Allocate(cchPrefix + nLen + 1); + ATLASSERT(lpstrText != NULL); + if(lpstrText != NULL) + { + LPCTSTR lpstrFormat = (i < 9) ? _T("&%i %s") : _T("%i %s"); + SecureHelper::wsprintf_x(lpstrText, cchPrefix + nLen + 1, lpstrFormat, i + 1, lpstrTitle); + menu.AppendMenu(MF_STRING, ID_WINDOW_TABFIRST + i, lpstrText); + } + } + + // Mark active page + if(bActivePageMenuItem && (m_nActivePage != -1)) + { +#ifndef _WIN32_WCE + if(bActiveAsDefaultMenuItem) + { + menu.SetMenuDefaultItem((UINT)-1, TRUE); + menu.SetMenuDefaultItem(nFirstPos + m_nActivePage, TRUE); + } + else +#else // CE specific + bActiveAsDefaultMenuItem; // avoid level 4 warning +#endif // _WIN32_WCE + { + menu.CheckMenuRadioItem(nFirstPos, nFirstPos + nMenuItemsCount, nFirstPos + m_nActivePage, MF_BYPOSITION); + } + } + } + else + { + if(bEmptyMenuItem) + { + menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_TABFIRST, pT->GetEmptyListText()); + menu.EnableMenuItem(ID_WINDOW_TABFIRST, MF_GRAYED); + } + + // Remove separator if nothing else is there + if(!bEmptyMenuItem && !bWindowsMenuItem && (nFirstPos > 0)) + { + CMenuItemInfo mii; + mii.fMask = MIIM_TYPE; + menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); + if((mii.fType & MFT_SEPARATOR) != 0) + menu.DeleteMenu(nFirstPos - 1, MF_BYPOSITION); + } + } + + // Add "Windows..." menu item + if(bWindowsMenuItem) + menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_SHOWTABLIST, pT->GetWindowsMenuItemText()); + } + +// Message map and handlers + BEGIN_MSG_MAP(CTabViewImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) + NOTIFY_HANDLER(m_nTabID, TCN_SELCHANGE, OnTabChanged) + NOTIFY_ID_HANDLER(m_nTabID, OnTabNotification) +#ifndef _WIN32_WCE + NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, OnTabGetDispInfo) +#endif // !_WIN32_WCE + FORWARD_NOTIFICATIONS() + ALT_MSG_MAP(1) // tab control + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnTabLButtonDown) + MESSAGE_HANDLER(WM_LBUTTONUP, OnTabLButtonUp) + MESSAGE_HANDLER(WM_CAPTURECHANGED, OnTabCaptureChanged) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnTabMouseMove) + MESSAGE_HANDLER(WM_RBUTTONUP, OnTabRButtonUp) + MESSAGE_HANDLER(WM_SYSKEYDOWN, OnTabSysKeyDown) + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->CreateTabControl(); + + return 0; + } + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + RemoveAllPages(); + + if(m_bDestroyImageList) + { + CImageList il = m_tab.SetImageList(NULL); + if(il.m_hImageList != NULL) + il.Destroy(); + } + + return 0; + } + + LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->UpdateLayout(); + return 0; + } + + LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(m_nActivePage != -1) + ::SetFocus(GetPageHWND(m_nActivePage)); + return 0; + } + + LRESULT OnTabChanged(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + { + SetActivePage(m_tab.GetCurSel()); + T* pT = static_cast(this); + pT->OnPageActivated(m_nActivePage); + + return 0; + } + + LRESULT OnTabNotification(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + { + // nothing to do - this just blocks all tab control + // notifications from being propagated further + return 0; + } + +#ifndef _WIN32_WCE + LRESULT OnTabGetDispInfo(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + LPNMTTDISPINFO pTTDI = (LPNMTTDISPINFO)pnmh; + if(pTTDI->hdr.hwndFrom == m_tab.GetTooltips()) + { + T* pT = static_cast(this); + pT->UpdateTooltipText(pTTDI); + } + else + { + bHandled = FALSE; + } + + return 0; + } +#endif // !_WIN32_WCE + +// Tab control message handlers + LRESULT OnTabLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(m_tab.GetItemCount() > 1) + { + m_bTabCapture = true; + m_tab.SetCapture(); + + m_ptStartDrag.x = GET_X_LPARAM(lParam); + m_ptStartDrag.y = GET_Y_LPARAM(lParam); + } + + bHandled = FALSE; + return 0; + } + + LRESULT OnTabLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(m_bTabCapture) + { + if(m_bTabDrag) + { + TCHITTESTINFO hti = { 0 }; + hti.pt.x = GET_X_LPARAM(lParam); + hti.pt.y = GET_Y_LPARAM(lParam); + int nItem = m_tab.HitTest(&hti); + if(nItem != -1) + MovePage(m_nActivePage, nItem); + } + + ::ReleaseCapture(); + } + + bHandled = FALSE; + return 0; + } + + LRESULT OnTabCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_bTabCapture) + { + m_bTabCapture = false; + + if(m_bTabDrag) + { + m_bTabDrag = false; + T* pT = static_cast(this); + pT->DrawMoveMark(-1); + +#ifndef _WIN32_WCE + m_ilDrag.DragLeave(GetDesktopWindow()); +#endif // !_WIN32_WCE + m_ilDrag.EndDrag(); + + m_ilDrag.Destroy(); + m_ilDrag.m_hImageList = NULL; + } + } + + bHandled = FALSE; + return 0; + } + + LRESULT OnTabMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + bHandled = FALSE; + + if(m_bTabCapture) + { + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + + if(!m_bTabDrag) + { +#ifndef _WIN32_WCE + if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CXDRAG) || + abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CYDRAG)) +#else // CE specific + if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= 4 || + abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= 4) +#endif // _WIN32_WCE + { + T* pT = static_cast(this); + pT->GenerateDragImage(m_nActivePage); + + int cxCursor = ::GetSystemMetrics(SM_CXCURSOR); + int cyCursor = ::GetSystemMetrics(SM_CYCURSOR); + m_ilDrag.BeginDrag(0, -(cxCursor / 2), -(cyCursor / 2)); +#ifndef _WIN32_WCE + POINT ptEnter = m_ptStartDrag; + m_tab.ClientToScreen(&ptEnter); + m_ilDrag.DragEnter(GetDesktopWindow(), ptEnter); +#endif // !_WIN32_WCE + + m_bTabDrag = true; + } + } + + if(m_bTabDrag) + { + TCHITTESTINFO hti = { 0 }; + hti.pt = pt; + int nItem = m_tab.HitTest(&hti); + + T* pT = static_cast(this); + pT->SetMoveCursor(nItem != -1); + + if(m_nInsertItem != nItem) + pT->DrawMoveMark(nItem); + + m_ilDrag.DragShowNolock((nItem != -1) ? TRUE : FALSE); + m_tab.ClientToScreen(&pt); + m_ilDrag.DragMove(pt); + + bHandled = TRUE; + } + } + + return 0; + } + + LRESULT OnTabRButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + TCHITTESTINFO hti = { 0 }; + hti.pt.x = GET_X_LPARAM(lParam); + hti.pt.y = GET_Y_LPARAM(lParam); + int nItem = m_tab.HitTest(&hti); + if(nItem != -1) + { + T* pT = static_cast(this); + pT->OnContextMenu(nItem, hti.pt); + } + + return 0; + } + + LRESULT OnTabSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + bool bShift = (::GetKeyState(VK_SHIFT) < 0); + if(wParam == VK_F10 && bShift) + { + if(m_nActivePage != -1) + { + RECT rect = { 0 }; + m_tab.GetItemRect(m_nActivePage, &rect); + POINT pt = { rect.left, rect.bottom }; + T* pT = static_cast(this); + pT->OnContextMenu(m_nActivePage, pt); + } + } + else + { + bHandled = FALSE; + } + + return 0; + } + +// Implementation helpers + bool IsValidPageIndex(int nPage) const + { + return (nPage >= 0 && nPage < GetPageCount()); + } + + bool MovePage(int nMovePage, int nInsertBeforePage) + { + ATLASSERT(IsValidPageIndex(nMovePage)); + ATLASSERT(IsValidPageIndex(nInsertBeforePage)); + + if(!IsValidPageIndex(nMovePage) || !IsValidPageIndex(nInsertBeforePage)) + return false; + + if(nMovePage == nInsertBeforePage) + return true; // nothing to do + + CTempBuffer buff; + LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); + if(lpstrTabText == NULL) + return false; + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; + tcix.tciheader.pszText = lpstrTabText; + tcix.tciheader.cchTextMax = m_cchTabTextLength + 1; + BOOL bRet = m_tab.GetItem(nMovePage, tcix); + ATLASSERT(bRet != FALSE); + if(bRet == FALSE) + return false; + + int nInsertItem = (nInsertBeforePage > nMovePage) ? nInsertBeforePage + 1 : nInsertBeforePage; + int nNewItem = m_tab.InsertItem(nInsertItem, tcix); + ATLASSERT(nNewItem == nInsertItem); + if(nNewItem != nInsertItem) + { + ATLVERIFY(m_tab.DeleteItem(nNewItem)); + return false; + } + + if(nMovePage > nInsertBeforePage) + ATLVERIFY(m_tab.DeleteItem(nMovePage + 1) != FALSE); + else if(nMovePage < nInsertBeforePage) + ATLVERIFY(m_tab.DeleteItem(nMovePage) != FALSE); + + SetActivePage(nInsertBeforePage); + T* pT = static_cast(this); + pT->OnPageActivated(m_nActivePage); + + return true; + } + +// Implementation overrideables + bool CreateTabControl() + { +#ifndef _WIN32_WCE + m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_TOOLTIPS, 0, m_nTabID); +#else // CE specific + m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, m_nTabID); +#endif // _WIN32_WCE + ATLASSERT(m_tab.m_hWnd != NULL); + if(m_tab.m_hWnd == NULL) + return false; + + m_tab.SetFont(AtlGetDefaultGuiFont()); + + m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); + + T* pT = static_cast(this); + m_cyTabHeight = pT->CalcTabHeight(); + + return true; + } + + int CalcTabHeight() + { + int nCount = m_tab.GetItemCount(); + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_TEXT; + tcix.tciheader.pszText = _T("NS"); + int nIndex = m_tab.InsertItem(nCount, tcix); + + RECT rect = { 0, 0, 1000, 1000 }; + m_tab.AdjustRect(FALSE, &rect); + + RECT rcWnd = { 0, 0, 1000, rect.top }; + ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); + + int nHeight = rcWnd.bottom - rcWnd.top; + + m_tab.DeleteItem(nIndex); + + return nHeight; + } + + void ShowTabControl(bool bShow) + { + m_tab.ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE); + } + + void UpdateLayout() + { + RECT rect; + GetClientRect(&rect); + + if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) + m_tab.SetWindowPos(NULL, 0, 0, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER); + + if(m_nActivePage != -1) + ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, m_cyTabHeight, rect.right - rect.left, rect.bottom - rect.top - m_cyTabHeight, SWP_NOZORDER); + } + + void UpdateMenu() + { + if(m_menu.m_hMenu != NULL) + BuildWindowMenu(m_menu, m_nMenuItemsCount, m_bEmptyMenuItem, m_bWindowsMenuItem, m_bActivePageMenuItem, m_bActiveAsDefaultMenuItem); + } + + void UpdateTitleBar() + { + if(!m_wndTitleBar.IsWindow() || m_lpstrTitleBarBase == NULL) + return; // nothing to do + + if(m_nActivePage != -1) + { + T* pT = static_cast(this); + LPCTSTR lpstrTitle = pT->GetPageTitle(m_nActivePage); + LPCTSTR lpstrDivider = pT->GetTitleDividerText(); + int cchBuffer = m_cchTitleBarLength + lstrlen(lpstrDivider) + lstrlen(m_lpstrTitleBarBase) + 1; + CTempBuffer buff; + LPTSTR lpstrPageTitle = buff.Allocate(cchBuffer); + ATLASSERT(lpstrPageTitle != NULL); + if(lpstrPageTitle != NULL) + { + pT->ShortenTitle(lpstrTitle, lpstrPageTitle, m_cchTitleBarLength + 1); + SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, lpstrDivider); + SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, m_lpstrTitleBarBase); + } + else + { + lpstrPageTitle = m_lpstrTitleBarBase; + } + + m_wndTitleBar.SetWindowText(lpstrPageTitle); + } + else + { + m_wndTitleBar.SetWindowText(m_lpstrTitleBarBase); + } + } + + void DrawMoveMark(int nItem) + { + T* pT = static_cast(this); + + if(m_nInsertItem != -1) + { + RECT rect = { 0 }; + pT->GetMoveMarkRect(rect); + m_tab.InvalidateRect(&rect); + } + + m_nInsertItem = nItem; + + if(m_nInsertItem != -1) + { + CClientDC dc(m_tab.m_hWnd); + + RECT rect = { 0 }; + pT->GetMoveMarkRect(rect); + + CPen pen; + pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_WINDOWTEXT)); + CBrush brush; + brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOWTEXT)); + + HPEN hPenOld = dc.SelectPen(pen); + HBRUSH hBrushOld = dc.SelectBrush(brush); + + int x = rect.left; + int y = rect.top; + POINT ptsTop[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y + m_cyMoveMark } }; + dc.Polygon(ptsTop, 3); + + y = rect.bottom - 1; + POINT ptsBottom[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y - m_cyMoveMark } }; + dc.Polygon(ptsBottom, 3); + + dc.SelectPen(hPenOld); + dc.SelectBrush(hBrushOld); + } + } + + void GetMoveMarkRect(RECT& rect) const + { + m_tab.GetClientRect(&rect); + + RECT rcItem = { 0 }; + m_tab.GetItemRect(m_nInsertItem, &rcItem); + + if(m_nInsertItem <= m_nActivePage) + { + rect.left = rcItem.left - m_cxMoveMark / 2 - 1; + rect.right = rcItem.left + m_cxMoveMark / 2; + } + else + { + rect.left = rcItem.right - m_cxMoveMark / 2 - 1; + rect.right = rcItem.right + m_cxMoveMark / 2; + } + } + + void SetMoveCursor(bool bCanMove) + { + ::SetCursor(::LoadCursor(NULL, bCanMove ? IDC_ARROW : IDC_NO)); + } + + void GenerateDragImage(int nItem) + { + ATLASSERT(IsValidPageIndex(nItem)); + +#ifndef _WIN32_WCE + RECT rcItem = { 0 }; + m_tab.GetItemRect(nItem, &rcItem); + ::InflateRect(&rcItem, 2, 2); // make bigger to cover selected item +#else // CE specific + nItem; // avoid level 4 warning + RECT rcItem = { 0, 0, 40, 20 }; +#endif // _WIN32_WCE + + ATLASSERT(m_ilDrag.m_hImageList == NULL); + m_ilDrag.Create(rcItem.right - rcItem.left, rcItem.bottom - rcItem.top, ILC_COLORDDB | ILC_MASK, 1, 1); + + CClientDC dc(m_hWnd); + CDC dcMem; + dcMem.CreateCompatibleDC(dc); + ATLASSERT(dcMem.m_hDC != NULL); + dcMem.SetViewportOrg(-rcItem.left, -rcItem.top); + + CBitmap bmp; + bmp.CreateCompatibleBitmap(dc, rcItem.right - rcItem.left, rcItem.bottom - rcItem.top); + ATLASSERT(bmp.m_hBitmap != NULL); + + HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); +#ifndef _WIN32_WCE + m_tab.SendMessage(WM_PRINTCLIENT, (WPARAM)dcMem.m_hDC); +#else // CE specific + dcMem.Rectangle(&rcItem); +#endif // _WIN32_WCE + dcMem.SelectBitmap(hBmpOld); + + ATLVERIFY(m_ilDrag.Add(bmp.m_hBitmap, RGB(255, 0, 255)) != -1); + } + + void ShortenTitle(LPCTSTR lpstrTitle, LPTSTR lpstrShortTitle, int cchShortTitle) + { + if(lstrlen(lpstrTitle) >= cchShortTitle) + { + LPCTSTR lpstrEllipsis = _T("..."); + int cchEllipsis = lstrlen(lpstrEllipsis); + SecureHelper::strncpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle, cchShortTitle - cchEllipsis - 1); + SecureHelper::strcat_x(lpstrShortTitle, cchShortTitle, lpstrEllipsis); + } + else + { + SecureHelper::strcpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle); + } + } + +#ifndef _WIN32_WCE + void UpdateTooltipText(LPNMTTDISPINFO pTTDI) + { + ATLASSERT(pTTDI != NULL); + pTTDI->lpszText = (LPTSTR)GetPageTitle((int)pTTDI->hdr.idFrom); + } +#endif // !_WIN32_WCE + +// Text for menu items and title bar - override to provide different strings + static LPCTSTR GetEmptyListText() + { + return _T("(Empty)"); + } + + static LPCTSTR GetWindowsMenuItemText() + { + return _T("&Windows..."); + } + + static LPCTSTR GetTitleDividerText() + { + return _T(" - "); + } + +// Notifications - override to provide different behavior + void OnPageActivated(int nPage) + { + NMHDR nmhdr = { 0 }; + nmhdr.hwndFrom = m_hWnd; + nmhdr.idFrom = nPage; + nmhdr.code = TBVN_PAGEACTIVATED; + ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); + } + + void OnContextMenu(int nPage, POINT pt) + { + m_tab.ClientToScreen(&pt); + + TBVCONTEXTMENUINFO cmi = { 0 }; + cmi.hdr.hwndFrom = m_hWnd; + cmi.hdr.idFrom = nPage; + cmi.hdr.code = TBVN_CONTEXTMENU; + cmi.pt = pt; + ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&cmi); + } +}; + + +class CTabView : public CTabViewImpl +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_TabView"), 0, COLOR_APPWORKSPACE) +}; + +}; // namespace WTL + +#endif // __ATLCTRLX_H__ diff --git a/Externals/WTL80/atlddx.h b/Externals/WTL80/atlddx.h index ad4249a81c..e0f991c6b0 100644 --- a/Externals/WTL80/atlddx.h +++ b/Externals/WTL80/atlddx.h @@ -1,624 +1,624 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLDDX_H__ -#define __ATLDDX_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlddx.h requires atlapp.h to be included first -#endif - -#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) - #error Cannot use floating point DDX with _ATL_MIN_CRT defined -#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) - -#ifdef _ATL_USE_DDX_FLOAT - #include -#endif // _ATL_USE_DDX_FLOAT - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CWinDataExchange - - -namespace WTL -{ - -// Constants -#define DDX_LOAD FALSE -#define DDX_SAVE TRUE - -// DDX map macros -#define BEGIN_DDX_MAP(thisClass) \ - BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \ - { \ - bSaveAndValidate; \ - nCtlID; - -#define DDX_TEXT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_TEXT_LEN(nID, var, len) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \ - return FALSE; \ - } - -#define DDX_INT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_INT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \ - return FALSE; \ - } - -#define DDX_UINT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_UINT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \ - return FALSE; \ - } - -#ifdef _ATL_USE_DDX_FLOAT -#define DDX_FLOAT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate)) \ - return FALSE; \ - } - -#define DDX_FLOAT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \ - return FALSE; \ - } -#define DDX_FLOAT_P(nID, var, precision) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \ - return FALSE; \ - } - -#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - { \ - if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \ - return FALSE; \ - } -#endif // _ATL_USE_DDX_FLOAT - -#define DDX_CONTROL(nID, obj) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Control(nID, obj, bSaveAndValidate); - -#define DDX_CONTROL_HANDLE(nID, obj) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Control_Handle(nID, obj, bSaveAndValidate); - -#define DDX_CHECK(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Check(nID, var, bSaveAndValidate); - -#define DDX_RADIO(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ - DDX_Radio(nID, var, bSaveAndValidate); - -#define END_DDX_MAP() \ - return TRUE; \ - } - - -/////////////////////////////////////////////////////////////////////////////// -// CWinDataExchange - provides support for DDX - -template -class CWinDataExchange -{ -public: -// Data exchange method - override in your derived class - BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1) - { - // this one should never be called, override it in - // your derived class by implementing DDX map - ATLASSERT(FALSE); - return FALSE; - } - -// Helpers for validation error reporting - enum _XDataType - { - ddxDataNull = 0, - ddxDataText = 1, - ddxDataInt = 2, - ddxDataFloat = 3, - ddxDataDouble = 4 - }; - - struct _XTextData - { - int nLength; - int nMaxLength; - }; - - struct _XIntData - { - long nVal; - long nMin; - long nMax; - }; - - struct _XFloatData - { - double nVal; - double nMin; - double nMax; - }; - - struct _XData - { - _XDataType nDataType; - union - { - _XTextData textData; - _XIntData intData; - _XFloatData floatData; - }; - }; - -// Text exchange - BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - HWND hWndCtrl = pT->GetDlgItem(nID); - int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR)); - if(nRetLen < ::GetWindowTextLength(hWndCtrl)) - bSuccess = FALSE; - } - else - { - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); - bSuccess = pT->SetDlgItemText(nID, lpstrText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if(lstrlen(lpstrText) > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = lstrlen(lpstrText); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - - BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - bSuccess = pT->GetDlgItemText(nID, bstrText); - } - else - { - USES_CONVERSION; - LPTSTR lpstrText = OLE2T(bstrText); - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); - bSuccess = pT->SetDlgItemText(nID, lpstrText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if((int)::SysStringLen(bstrText) > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = (int)::SysStringLen(bstrText); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - - BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText); - } - else - { - USES_CONVERSION; - LPTSTR lpstrText = OLE2T(bstrText); - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); - bSuccess = pT->SetDlgItemText(nID, lpstrText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if((int)bstrText.Length() > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = (int)bstrText.Length(); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - HWND hWndCtrl = pT->GetDlgItem(nID); - int nLen = ::GetWindowTextLength(hWndCtrl); - int nRetLen = -1; - LPTSTR lpstr = strText.GetBufferSetLength(nLen); - if(lpstr != NULL) - { - nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1); - strText.ReleaseBuffer(); - } - if(nRetLen < nLen) - bSuccess = FALSE; - } - else - { - bSuccess = pT->SetDlgItemText(nID, strText); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nLength > 0); - if(strText.GetLength() > nLength) - { - _XData data = { ddxDataText }; - data.textData.nLength = strText.GetLength(); - data.textData.nMaxLength = nLength; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Numeric exchange - template - BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - - if(bSave) - { - nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned); - } - else - { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) - { - _XData data = { ddxDataInt }; - data.intData.nVal = (long)nVal; - data.intData.nMin = (long)nMin; - data.intData.nMax = (long)nMax; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - -// Float exchange -#ifdef _ATL_USE_DDX_FLOAT - static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d) - { - ATLASSERT(lpszText != NULL); - while (*lpszText == _T(' ') || *lpszText == _T('\t')) - lpszText++; - - TCHAR chFirst = lpszText[0]; - d = _tcstod(lpszText, (LPTSTR*)&lpszText); - if (d == 0.0 && chFirst != _T('0')) - return FALSE; // could not convert - while (*lpszText == _T(' ') || *lpszText == _T('\t')) - lpszText++; - - if (*lpszText != _T('\0')) - return FALSE; // not terminated properly - - return TRUE; - } - - BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - const int cchBuff = 32; - TCHAR szBuff[cchBuff] = { 0 }; - - if(bSave) - { - pT->GetDlgItemText(nID, szBuff, cchBuff); - double d = 0; - if(_AtlSimpleFloatParse(szBuff, d)) - nVal = (float)d; - else - bSuccess = FALSE; - } - else - { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); - bSuccess = pT->SetDlgItemText(nID, szBuff); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) - { - _XData data = { ddxDataFloat }; - data.floatData.nVal = (double)nVal; - data.floatData.nMin = (double)nMin; - data.floatData.nMax = (double)nMax; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } - - BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG) - { - T* pT = static_cast(this); - BOOL bSuccess = TRUE; - const int cchBuff = 32; - TCHAR szBuff[cchBuff] = { 0 }; - - if(bSave) - { - pT->GetDlgItemText(nID, szBuff, cchBuff); - double d = 0; - if(_AtlSimpleFloatParse(szBuff, d)) - nVal = d; - else - bSuccess = FALSE; - } - else - { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); - bSuccess = pT->SetDlgItemText(nID, szBuff); - } - - if(!bSuccess) - { - pT->OnDataExchangeError(nID, bSave); - } - else if(bSave && bValidate) // validation - { - ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) - { - _XData data = { ddxDataFloat }; - data.floatData.nVal = nVal; - data.floatData.nMin = nMin; - data.floatData.nMax = nMax; - pT->OnDataValidateError(nID, bSave, data); - bSuccess = FALSE; - } - } - return bSuccess; - } -#endif // _ATL_USE_DDX_FLOAT - -// Full control subclassing (for CWindowImpl derived controls) - template - void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave) - { - if(!bSave && ctrl.m_hWnd == NULL) - { - T* pT = static_cast(this); - ctrl.SubclassWindow(pT->GetDlgItem(nID)); - } - } - -// Simple control attaching (for HWND wrapper controls) - template - void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave) - { - if(!bSave && ctrl.m_hWnd == NULL) - { - T* pT = static_cast(this); - ctrl = pT->GetDlgItem(nID); - } - } - -// Control state - void DDX_Check(UINT nID, int& nValue, BOOL bSave) - { - T* pT = static_cast(this); - HWND hWndCtrl = pT->GetDlgItem(nID); - if(bSave) - { - nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L); - ATLASSERT(nValue >= 0 && nValue <= 2); - } - else - { - if(nValue < 0 || nValue > 2) - { - ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue); - nValue = 0; // default to off - } - ::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L); - } - } - - // variant that supports bool (checked/not-checked, no intermediate state) - void DDX_Check(UINT nID, bool& bCheck, BOOL bSave) - { - int nValue = bCheck ? 1 : 0; - DDX_Check(nID, nValue, bSave); - - if(bSave) - { - if(nValue == 2) - ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue); - bCheck = (nValue == 1); - } - } - - void DDX_Radio(UINT nID, int& nValue, BOOL bSave) - { - T* pT = static_cast(this); - HWND hWndCtrl = pT->GetDlgItem(nID); - ATLASSERT(hWndCtrl != NULL); - - // must be first in a group of auto radio buttons - ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP); - ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON); - - if(bSave) - nValue = -1; // value if none found - - // walk all children in group - int nButton = 0; - do - { - if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON) - { - // control in group is a radio button - if(bSave) - { - if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0) - { - ATLASSERT(nValue == -1); // only set once - nValue = nButton; - } - } - else - { - // select button - ::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L); - } - nButton++; - } - else - { - ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n")); - } - hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); - } - while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); - } - -// Overrideables - void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/) - { - // Override to display an error message - ::MessageBeep((UINT)-1); - T* pT = static_cast(this); - ::SetFocus(pT->GetDlgItem(nCtrlID)); - } - - void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/) - { - // Override to display an error message - ::MessageBeep((UINT)-1); - T* pT = static_cast(this); - ::SetFocus(pT->GetDlgItem(nCtrlID)); - } -}; - -}; // namespace WTL - -#endif // __ATLDDX_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLDDX_H__ +#define __ATLDDX_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlddx.h requires atlapp.h to be included first +#endif + +#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) + #error Cannot use floating point DDX with _ATL_MIN_CRT defined +#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) + +#ifdef _ATL_USE_DDX_FLOAT + #include +#endif // _ATL_USE_DDX_FLOAT + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CWinDataExchange + + +namespace WTL +{ + +// Constants +#define DDX_LOAD FALSE +#define DDX_SAVE TRUE + +// DDX map macros +#define BEGIN_DDX_MAP(thisClass) \ + BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \ + { \ + bSaveAndValidate; \ + nCtlID; + +#define DDX_TEXT(nID, var) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \ + return FALSE; \ + } + +#define DDX_TEXT_LEN(nID, var, len) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \ + return FALSE; \ + } + +#define DDX_INT(nID, var) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \ + return FALSE; \ + } + +#define DDX_INT_RANGE(nID, var, min, max) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \ + return FALSE; \ + } + +#define DDX_UINT(nID, var) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \ + return FALSE; \ + } + +#define DDX_UINT_RANGE(nID, var, min, max) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \ + return FALSE; \ + } + +#ifdef _ATL_USE_DDX_FLOAT +#define DDX_FLOAT(nID, var) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Float(nID, var, bSaveAndValidate)) \ + return FALSE; \ + } + +#define DDX_FLOAT_RANGE(nID, var, min, max) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \ + return FALSE; \ + } +#define DDX_FLOAT_P(nID, var, precision) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \ + return FALSE; \ + } + +#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + { \ + if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \ + return FALSE; \ + } +#endif // _ATL_USE_DDX_FLOAT + +#define DDX_CONTROL(nID, obj) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + DDX_Control(nID, obj, bSaveAndValidate); + +#define DDX_CONTROL_HANDLE(nID, obj) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + DDX_Control_Handle(nID, obj, bSaveAndValidate); + +#define DDX_CHECK(nID, var) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + DDX_Check(nID, var, bSaveAndValidate); + +#define DDX_RADIO(nID, var) \ + if(nCtlID == (UINT)-1 || nCtlID == nID) \ + DDX_Radio(nID, var, bSaveAndValidate); + +#define END_DDX_MAP() \ + return TRUE; \ + } + + +/////////////////////////////////////////////////////////////////////////////// +// CWinDataExchange - provides support for DDX + +template +class CWinDataExchange +{ +public: +// Data exchange method - override in your derived class + BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1) + { + // this one should never be called, override it in + // your derived class by implementing DDX map + ATLASSERT(FALSE); + return FALSE; + } + +// Helpers for validation error reporting + enum _XDataType + { + ddxDataNull = 0, + ddxDataText = 1, + ddxDataInt = 2, + ddxDataFloat = 3, + ddxDataDouble = 4 + }; + + struct _XTextData + { + int nLength; + int nMaxLength; + }; + + struct _XIntData + { + long nVal; + long nMin; + long nMax; + }; + + struct _XFloatData + { + double nVal; + double nMin; + double nMax; + }; + + struct _XData + { + _XDataType nDataType; + union + { + _XTextData textData; + _XIntData intData; + _XFloatData floatData; + }; + }; + +// Text exchange + BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + + if(bSave) + { + HWND hWndCtrl = pT->GetDlgItem(nID); + int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR)); + if(nRetLen < ::GetWindowTextLength(hWndCtrl)) + bSuccess = FALSE; + } + else + { + ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); + bSuccess = pT->SetDlgItemText(nID, lpstrText); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nLength > 0); + if(lstrlen(lpstrText) > nLength) + { + _XData data = { ddxDataText }; + data.textData.nLength = lstrlen(lpstrText); + data.textData.nMaxLength = nLength; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } + + BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + + if(bSave) + { + bSuccess = pT->GetDlgItemText(nID, bstrText); + } + else + { + USES_CONVERSION; + LPTSTR lpstrText = OLE2T(bstrText); + ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); + bSuccess = pT->SetDlgItemText(nID, lpstrText); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nLength > 0); + if((int)::SysStringLen(bstrText) > nLength) + { + _XData data = { ddxDataText }; + data.textData.nLength = (int)::SysStringLen(bstrText); + data.textData.nMaxLength = nLength; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } + + BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + + if(bSave) + { + bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText); + } + else + { + USES_CONVERSION; + LPTSTR lpstrText = OLE2T(bstrText); + ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); + bSuccess = pT->SetDlgItemText(nID, lpstrText); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nLength > 0); + if((int)bstrText.Length() > nLength) + { + _XData data = { ddxDataText }; + data.textData.nLength = (int)bstrText.Length(); + data.textData.nMaxLength = nLength; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + + if(bSave) + { + HWND hWndCtrl = pT->GetDlgItem(nID); + int nLen = ::GetWindowTextLength(hWndCtrl); + int nRetLen = -1; + LPTSTR lpstr = strText.GetBufferSetLength(nLen); + if(lpstr != NULL) + { + nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1); + strText.ReleaseBuffer(); + } + if(nRetLen < nLen) + bSuccess = FALSE; + } + else + { + bSuccess = pT->SetDlgItemText(nID, strText); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nLength > 0); + if(strText.GetLength() > nLength) + { + _XData data = { ddxDataText }; + data.textData.nLength = strText.GetLength(); + data.textData.nMaxLength = nLength; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + +// Numeric exchange + template + BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + + if(bSave) + { + nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned); + } + else + { + ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); + bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nMin != nMax); + if(nVal < nMin || nVal > nMax) + { + _XData data = { ddxDataInt }; + data.intData.nVal = (long)nVal; + data.intData.nMin = (long)nMin; + data.intData.nMax = (long)nMax; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } + +// Float exchange +#ifdef _ATL_USE_DDX_FLOAT + static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d) + { + ATLASSERT(lpszText != NULL); + while (*lpszText == _T(' ') || *lpszText == _T('\t')) + lpszText++; + + TCHAR chFirst = lpszText[0]; + d = _tcstod(lpszText, (LPTSTR*)&lpszText); + if (d == 0.0 && chFirst != _T('0')) + return FALSE; // could not convert + while (*lpszText == _T(' ') || *lpszText == _T('\t')) + lpszText++; + + if (*lpszText != _T('\0')) + return FALSE; // not terminated properly + + return TRUE; + } + + BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + const int cchBuff = 32; + TCHAR szBuff[cchBuff] = { 0 }; + + if(bSave) + { + pT->GetDlgItemText(nID, szBuff, cchBuff); + double d = 0; + if(_AtlSimpleFloatParse(szBuff, d)) + nVal = (float)d; + else + bSuccess = FALSE; + } + else + { + ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); + SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); + bSuccess = pT->SetDlgItemText(nID, szBuff); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nMin != nMax); + if(nVal < nMin || nVal > nMax) + { + _XData data = { ddxDataFloat }; + data.floatData.nVal = (double)nVal; + data.floatData.nMin = (double)nMin; + data.floatData.nMax = (double)nMax; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } + + BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG) + { + T* pT = static_cast(this); + BOOL bSuccess = TRUE; + const int cchBuff = 32; + TCHAR szBuff[cchBuff] = { 0 }; + + if(bSave) + { + pT->GetDlgItemText(nID, szBuff, cchBuff); + double d = 0; + if(_AtlSimpleFloatParse(szBuff, d)) + nVal = d; + else + bSuccess = FALSE; + } + else + { + ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); + SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); + bSuccess = pT->SetDlgItemText(nID, szBuff); + } + + if(!bSuccess) + { + pT->OnDataExchangeError(nID, bSave); + } + else if(bSave && bValidate) // validation + { + ATLASSERT(nMin != nMax); + if(nVal < nMin || nVal > nMax) + { + _XData data = { ddxDataFloat }; + data.floatData.nVal = nVal; + data.floatData.nMin = nMin; + data.floatData.nMax = nMax; + pT->OnDataValidateError(nID, bSave, data); + bSuccess = FALSE; + } + } + return bSuccess; + } +#endif // _ATL_USE_DDX_FLOAT + +// Full control subclassing (for CWindowImpl derived controls) + template + void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave) + { + if(!bSave && ctrl.m_hWnd == NULL) + { + T* pT = static_cast(this); + ctrl.SubclassWindow(pT->GetDlgItem(nID)); + } + } + +// Simple control attaching (for HWND wrapper controls) + template + void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave) + { + if(!bSave && ctrl.m_hWnd == NULL) + { + T* pT = static_cast(this); + ctrl = pT->GetDlgItem(nID); + } + } + +// Control state + void DDX_Check(UINT nID, int& nValue, BOOL bSave) + { + T* pT = static_cast(this); + HWND hWndCtrl = pT->GetDlgItem(nID); + if(bSave) + { + nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L); + ATLASSERT(nValue >= 0 && nValue <= 2); + } + else + { + if(nValue < 0 || nValue > 2) + { + ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue); + nValue = 0; // default to off + } + ::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L); + } + } + + // variant that supports bool (checked/not-checked, no intermediate state) + void DDX_Check(UINT nID, bool& bCheck, BOOL bSave) + { + int nValue = bCheck ? 1 : 0; + DDX_Check(nID, nValue, bSave); + + if(bSave) + { + if(nValue == 2) + ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue); + bCheck = (nValue == 1); + } + } + + void DDX_Radio(UINT nID, int& nValue, BOOL bSave) + { + T* pT = static_cast(this); + HWND hWndCtrl = pT->GetDlgItem(nID); + ATLASSERT(hWndCtrl != NULL); + + // must be first in a group of auto radio buttons + ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP); + ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON); + + if(bSave) + nValue = -1; // value if none found + + // walk all children in group + int nButton = 0; + do + { + if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON) + { + // control in group is a radio button + if(bSave) + { + if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0) + { + ATLASSERT(nValue == -1); // only set once + nValue = nButton; + } + } + else + { + // select button + ::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L); + } + nButton++; + } + else + { + ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n")); + } + hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); + } + while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); + } + +// Overrideables + void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/) + { + // Override to display an error message + ::MessageBeep((UINT)-1); + T* pT = static_cast(this); + ::SetFocus(pT->GetDlgItem(nCtrlID)); + } + + void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/) + { + // Override to display an error message + ::MessageBeep((UINT)-1); + T* pT = static_cast(this); + ::SetFocus(pT->GetDlgItem(nCtrlID)); + } +}; + +}; // namespace WTL + +#endif // __ATLDDX_H__ diff --git a/Externals/WTL80/atldlgs.h b/Externals/WTL80/atldlgs.h index c0fd568608..1483c088ea 100644 --- a/Externals/WTL80/atldlgs.h +++ b/Externals/WTL80/atldlgs.h @@ -1,6212 +1,6212 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLDLGS_H__ -#define __ATLDLGS_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atldlgs.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atldlgs.h requires atlwin.h to be included first -#endif - -#include -#include - -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - #include -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CFileDialogImpl -// CFileDialog -// CFileDialogEx -// CMultiFileDialogImpl -// CMultiFileDialog -// CShellFileDialogImpl -// CShellFileOpenDialogImpl -// CShellFileOpenDialog -// CShellFileSaveDialogImpl -// CShellFileSaveDialog -// CFolderDialogImpl -// CFolderDialog -// CFontDialogImpl -// CFontDialog -// CRichEditFontDialogImpl -// CRichEditFontDialog -// CColorDialogImpl -// CColorDialog -// CPrintDialogImpl -// CPrintDialog -// CPrintDialogExImpl -// CPrintDialogEx -// CPageSetupDialogImpl -// CPageSetupDialog -// CFindReplaceDialogImpl -// CFindReplaceDialog -// -// CMemDlgTemplate -// CIndirectDialogImpl -// -// CPropertySheetWindow -// CPropertySheetImpl -// CPropertySheet -// CPropertyPageWindow -// CPropertyPageImpl -// CPropertyPage -// CAxPropertyPageImpl -// CAxPropertyPage -// -// CWizard97SheetWindow -// CWizard97SheetImpl -// CWizard97Sheet -// CWizard97PageWindow -// CWizard97PageImpl -// CWizard97ExteriorPageImpl -// CWizard97InteriorPageImpl -// -// CAeroWizardFrameWindow -// CAeroWizardFrameImpl -// CAeroWizardFrame -// CAeroWizardPageWindow -// CAeroWizardPageImpl -// CAeroWizardPage -// CAeroWizardAxPageImpl -// CAeroWizardAxPage -// -// CTaskDialogConfig -// CTaskDialogImpl -// CTaskDialog -// -// Global functions: -// AtlTaskDialog() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CFileDialogImpl - used for File Open or File Save As - -// compatibility with the old (vc6.0) headers -#if (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) - #ifndef CDSIZEOF_STRUCT - #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) - #endif - #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName) - #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName) - #ifdef UNICODE - #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400W - #else - #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A - #endif // !UNICODE -#endif // (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) - -#if !defined(_WIN32_WCE) && !defined(CDN_INCLUDEITEM) - #define CDN_INCLUDEITEM (CDN_FIRST - 0x0007) -#endif - -template -class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase -{ -public: -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - OPENFILENAMEEX m_ofn; -#else - OPENFILENAME m_ofn; -#endif - BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save - TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return - TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return - - CFileDialogImpl(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - { - memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL - m_szFileName[0] = _T('\0'); - m_szFileTitle[0] = _T('\0'); - - m_bOpenFileDialog = bOpenFileDialog; - - m_ofn.lStructSize = sizeof(m_ofn); -#if (_WIN32_WINNT >= 0x0500) - // adjust struct size if running on older version of Windows - if(AtlIsOldWindows()) - { - ATLASSERT(sizeof(m_ofn) > OPENFILENAME_SIZE_VERSION_400); // must be - m_ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - } -#endif // (_WIN32_WINNT >= 0x0500) - m_ofn.lpstrFile = m_szFileName; - m_ofn.nMaxFile = _MAX_PATH; - m_ofn.lpstrDefExt = lpszDefExt; - m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; - m_ofn.nMaxFileTitle = _MAX_FNAME; -#ifndef _WIN32_WCE - m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_ENABLESIZING; -#else // CE specific - m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK; -#endif // !_WIN32_WCE - m_ofn.lpstrFilter = lpszFilter; - m_ofn.hInstance = ModuleHelper::GetResourceInstance(); - m_ofn.lpfnHook = (LPOFNHOOKPROC)T::StartDialogProc; - m_ofn.hwndOwner = hWndParent; - - // setup initial file name - if(lpszFileName != NULL) - SecureHelper::strncpy_x(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_ofn.Flags & OFN_ENABLEHOOK) != 0); - ATLASSERT(m_ofn.lpfnHook != NULL); // can still be a user hook - - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - if(m_ofn.hwndOwner == NULL) // set only if not specified before - m_ofn.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (ATL::CDialogImplBase*)this); - - BOOL bRet; - if(m_bOpenFileDialog) -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - bRet = ::GetOpenFileNameEx(&m_ofn); - else - bRet = ::GetSaveFileName((LPOPENFILENAME)&m_ofn); -#else - bRet = ::GetOpenFileName(&m_ofn); - else - bRet = ::GetSaveFileName(&m_ofn); -#endif - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - -// Attributes - ATL::CWindow GetFileDialogWindow() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow(GetParent()); - } - - int GetFilePath(LPTSTR lpstrFilePath, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETFILEPATH, nLength, (LPARAM)lpstrFilePath); - } - - int GetFolderIDList(LPVOID lpBuff, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERIDLIST, nLength, (LPARAM)lpBuff); - } - - int GetFolderPath(LPTSTR lpstrFolderPath, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERPATH, nLength, (LPARAM)lpstrFolderPath); - } - - int GetSpec(LPTSTR lpstrSpec, int nLength) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - return (int)GetFileDialogWindow().SendMessage(CDM_GETSPEC, nLength, (LPARAM)lpstrSpec); - } - - void SetControlText(int nCtrlID, LPCTSTR lpstrText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - GetFileDialogWindow().SendMessage(CDM_SETCONTROLTEXT, nCtrlID, (LPARAM)lpstrText); - } - - void SetDefExt(LPCTSTR lpstrExt) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - GetFileDialogWindow().SendMessage(CDM_SETDEFEXT, 0, (LPARAM)lpstrExt); - } - - BOOL GetReadOnlyPref() const // return TRUE if readonly checked - { - return ((m_ofn.Flags & OFN_READONLY) != 0) ? TRUE : FALSE; - } - -// Operations - void HideControl(int nCtrlID) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); - - GetFileDialogWindow().SendMessage(CDM_HIDECONTROL, nCtrlID); - } - -// Special override for common dialogs - BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - GetFileDialogWindow().SendMessage(WM_COMMAND, MAKEWPARAM(IDCANCEL, 0)); - return TRUE; - } - -// Message map and handlers - BEGIN_MSG_MAP(CFileDialogImpl) - NOTIFY_CODE_HANDLER(CDN_FILEOK, _OnFileOK) - NOTIFY_CODE_HANDLER(CDN_FOLDERCHANGE, _OnFolderChange) - NOTIFY_CODE_HANDLER(CDN_HELP, _OnHelp) - NOTIFY_CODE_HANDLER(CDN_INITDONE, _OnInitDone) - NOTIFY_CODE_HANDLER(CDN_SELCHANGE, _OnSelChange) - NOTIFY_CODE_HANDLER(CDN_SHAREVIOLATION, _OnShareViolation) - NOTIFY_CODE_HANDLER(CDN_TYPECHANGE, _OnTypeChange) -#ifndef _WIN32_WCE - NOTIFY_CODE_HANDLER(CDN_INCLUDEITEM, _OnIncludeItem) -#endif // !_WIN32_WCE - END_MSG_MAP() - - LRESULT _OnFileOK(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - return !pT->OnFileOK((LPOFNOTIFY)pnmh); - } - - LRESULT _OnFolderChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnFolderChange((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnHelp(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnHelp((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnInitDone(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnInitDone((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnSelChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnSelChange((LPOFNOTIFY)pnmh); - return 0; - } - - LRESULT _OnShareViolation(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - return pT->OnShareViolation((LPOFNOTIFY)pnmh); - } - - LRESULT _OnTypeChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - pT->OnTypeChange((LPOFNOTIFY)pnmh); - return 0; - } - -#ifndef _WIN32_WCE - LRESULT _OnIncludeItem(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - ATLASSERT(::IsWindow(m_hWnd)); - T* pT = static_cast(this); - return pT->OnIncludeItem((LPOFNOTIFYEX)pnmh); - } -#endif // !_WIN32_WCE - -// Overrideables - BOOL OnFileOK(LPOFNOTIFY /*lpon*/) - { - return TRUE; - } - - void OnFolderChange(LPOFNOTIFY /*lpon*/) - { - } - - void OnHelp(LPOFNOTIFY /*lpon*/) - { - } - - void OnInitDone(LPOFNOTIFY /*lpon*/) - { - } - - void OnSelChange(LPOFNOTIFY /*lpon*/) - { - } - - int OnShareViolation(LPOFNOTIFY /*lpon*/) - { - return 0; - } - - void OnTypeChange(LPOFNOTIFY /*lpon*/) - { - } - -#ifndef _WIN32_WCE - BOOL OnIncludeItem(LPOFNOTIFYEX /*lponex*/) - { - return TRUE; // include item - } -#endif // !_WIN32_WCE -}; - -class CFileDialog : public CFileDialogImpl -{ -public: - CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) - { } - - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() -}; - -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) -class CFileDialogEx : public CFileDialogImpl -{ -public: - CFileDialogEx( // Supports only FileOpen - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - OFN_EXFLAG ExFlags = OFN_EXFLAG_THUMBNAILVIEW, - OFN_SORTORDER dwSortOrder = OFN_SORTORDER_AUTO, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) - { - m_ofn.ExFlags = ExFlags; - m_ofn.dwSortOrder = dwSortOrder; - } - - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() -}; -#endif // defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - - -/////////////////////////////////////////////////////////////////////////////// -// Multi File Dialog - Multi-select File Open dialog - -#ifndef _WIN32_WCE - -// The class dynamically resizes the buffer as the file selection changes -// (as described in Knowledge Base article 131462). It also expands selected -// shortcut files to take into account the full path of the target file. -// Note that this doesn't work on Win9x for the old style dialogs, as well as -// on NT for non-Unicode builds. - -#ifndef _WTL_FIXED_OFN_BUFFER_LENGTH - #define _WTL_FIXED_OFN_BUFFER_LENGTH 0x10000 -#endif - -template -class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > -{ -public: - mutable LPCTSTR m_pNextFile; -#ifndef _UNICODE - bool m_bIsNT; -#endif - - CMultiFileDialogImpl( - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent), - m_pNextFile(NULL) - { - m_ofn.Flags |= OFN_ALLOWMULTISELECT; // Force multiple selection mode - -#ifndef _UNICODE - OSVERSIONINFO ovi = { sizeof(ovi) }; - ::GetVersionEx(&ovi); - m_bIsNT = (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT); - if (m_bIsNT) - { - // On NT platforms, GetOpenFileNameA thunks to GetOpenFileNameW and there - // is absolutely nothing we can do except to start off with a large buffer. - ATLVERIFY(ResizeFilenameBuffer(_WTL_FIXED_OFN_BUFFER_LENGTH)); - } -#endif - } - - ~CMultiFileDialogImpl() - { - if (m_ofn.lpstrFile != m_szFileName) // Free the buffer if we allocated it - delete[] m_ofn.lpstrFile; - } - -// Operations - // Get the directory that the files were chosen from. - // The function returns the number of characters copied, not including the terminating zero. - // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. - // If the function fails, the return value is zero. - int GetDirectory(LPTSTR pBuffer, int nBufLen) const - { - if (m_ofn.lpstrFile == NULL) - return 0; - - LPCTSTR pStr = m_ofn.lpstrFile; - int nLength = lstrlen(pStr); - if (pStr[nLength + 1] == 0) - { - // The OFN buffer contains a single item so extract its path. - LPCTSTR pSep = _strrchr(pStr, _T('\\')); - if (pSep != NULL) - nLength = (int)(DWORD_PTR)(pSep - pStr); - } - - int nRet = 0; - if (pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLength + 1; - } - else if (nBufLen > nLength) - { - SecureHelper::strncpy_x(pBuffer, nBufLen, pStr, nLength); - nRet = nLength; - } - - return nRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetDirectory(_CSTRING_NS::CString& strDir) const - { - bool bRet = false; - - int nLength = GetDirectory(NULL, 0); - if (nLength > 0) - { - bRet = (GetDirectory(strDir.GetBuffer(nLength), nLength) > 0); - strDir.ReleaseBuffer(nLength - 1); - } - - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - // Get the first filename as a pointer into the buffer. - LPCTSTR GetFirstFileName() const - { - if (m_ofn.lpstrFile == NULL) - return NULL; - - m_pNextFile = NULL; // Reset internal buffer pointer - - LPCTSTR pStr = m_ofn.lpstrFile; - int nLength = lstrlen(pStr); - if (pStr[nLength + 1] != 0) - { - // Multiple items were selected. The first string is the directory, - // so skip forwards to the second string. - pStr += nLength + 1; - - // Set up m_pNext so it points to the second item (or null). - m_pNextFile = pStr; - GetNextFileName(); - } - else - { - // A single item was selected. Skip forward past the path. - LPCTSTR pSep = _strrchr(pStr, _T('\\')); - if (pSep != NULL) - pStr = pSep + 1; - } - - return pStr; - } - - // Get the next filename as a pointer into the buffer. - LPCTSTR GetNextFileName() const - { - if (m_pNextFile == NULL) - return NULL; - - LPCTSTR pStr = m_pNextFile; - // Set "m_pNextFile" to point to the next file name, or null if we - // have reached the last file in the list. - int nLength = lstrlen(pStr); - m_pNextFile = (pStr[nLength + 1] != 0) ? &pStr[nLength + 1] : NULL; - - return pStr; - } - - // Get the first filename as a full path. - // The function returns the number of characters copied, not including the terminating zero. - // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. - // If the function fails, the return value is zero. - int GetFirstPathName(LPTSTR pBuffer, int nBufLen) const - { - LPCTSTR pStr = GetFirstFileName(); - int nLengthDir = GetDirectory(NULL, 0); - if((pStr == NULL) || (nLengthDir == 0)) - return 0; - - // Figure out the required length. - int nLengthTotal = nLengthDir + lstrlen(pStr); - - int nRet = 0; - if(pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLengthTotal + 1; - } - else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path - { - GetDirectory(pBuffer, nBufLen); - SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); - SecureHelper::strcat_x(pBuffer, nBufLen, pStr); - nRet = nLengthTotal; - } - - return nRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetFirstPathName(_CSTRING_NS::CString& strPath) const - { - bool bRet = false; - - int nLength = GetFirstPathName(NULL, 0); - if (nLength > 0) - { - bRet = (GetFirstPathName(strPath.GetBuffer(nLength), nLength) > 0); - strPath.ReleaseBuffer(nLength - 1); - } - - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - // Get the next filename as a full path. - // The function returns the number of characters copied, not including the terminating zero. - // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. - // If the function fails, the return value is zero. - // The internal position marker is moved forward only if the function succeeds and the buffer was large enough. - int GetNextPathName(LPTSTR pBuffer, int nBufLen) const - { - if (m_pNextFile == NULL) - return 0; - - int nRet = 0; - LPCTSTR pStr = m_pNextFile; - // Does the filename contain a backslash? - if (_strrchr(pStr, _T('\\')) != NULL) - { - // Yes, so we'll assume it's a full path. - int nLength = lstrlen(pStr); - - if (pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLength + 1; - } - else if (nBufLen > nLength) // The buffer is big enough, so go ahead and copy the filename - { - SecureHelper::strcpy_x(pBuffer, nBufLen, GetNextFileName()); - nRet = nBufLen; - } - } - else - { - // The filename is relative, so construct the full path. - int nLengthDir = GetDirectory(NULL, 0); - if (nLengthDir > 0) - { - // Calculate the required space. - int nLengthTotal = nLengthDir + lstrlen(pStr); - - if(pBuffer == NULL) // If the buffer is NULL, return the required length - { - nRet = nLengthTotal + 1; - } - else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path - { - GetDirectory(pBuffer, nBufLen); - SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); - SecureHelper::strcat_x(pBuffer, nBufLen, GetNextFileName()); - nRet = nLengthTotal; - } - } - } - - return nRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetNextPathName(_CSTRING_NS::CString& strPath) const - { - bool bRet = false; - - int nLength = GetNextPathName(NULL, 0); - if (nLength > 0) - { - bRet = (GetNextPathName(strPath.GetBuffer(nLength), nLength) > 0); - strPath.ReleaseBuffer(nLength - 1); - } - - return bRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Implementation - bool ResizeFilenameBuffer(DWORD dwLength) - { - if (dwLength > m_ofn.nMaxFile) - { - // Free the old buffer. - if (m_ofn.lpstrFile != m_szFileName) - { - delete[] m_ofn.lpstrFile; - m_ofn.lpstrFile = NULL; - m_ofn.nMaxFile = 0; - } - - // Allocate the new buffer. - LPTSTR lpstrBuff = NULL; - ATLTRY(lpstrBuff = new TCHAR[dwLength]); - if (lpstrBuff != NULL) - { - m_ofn.lpstrFile = lpstrBuff; - m_ofn.lpstrFile[0] = 0; - m_ofn.nMaxFile = dwLength; - } - } - - return (m_ofn.lpstrFile != NULL); - } - - void OnSelChange(LPOFNOTIFY /*lpon*/) - { -#ifndef _UNICODE - // There is no point resizing the buffer in ANSI builds running on NT. - if (m_bIsNT) - return; -#endif - - // Get the buffer length required to hold the spec. - int nLength = GetSpec(NULL, 0); - if (nLength <= 1) - return; // no files are selected, presumably - - // Add room for the directory, and an extra terminating zero. - nLength += GetFolderPath(NULL, 0) + 1; - - if (!ResizeFilenameBuffer(nLength)) - { - ATLASSERT(FALSE); - return; - } - - // If we are not following links then our work is done. - if ((m_ofn.Flags & OFN_NODEREFERENCELINKS) != 0) - return; - - // Get the file spec, which is the text in the edit control. - if (GetSpec(m_ofn.lpstrFile, m_ofn.nMaxFile) <= 0) - return; - - // Get the ID-list of the current folder. - int nBytes = GetFolderIDList(NULL, 0); - CTempBuffer idlist; - idlist.AllocateBytes(nBytes); - if ((nBytes <= 0) || (GetFolderIDList(idlist, nBytes) <= 0)) - return; - - // First bind to the desktop folder, then to the current folder. - ATL::CComPtr pDesktop, pFolder; - if (FAILED(::SHGetDesktopFolder(&pDesktop))) - return; - if (FAILED(pDesktop->BindToObject(idlist, NULL, IID_IShellFolder, (void**)&pFolder))) - return; - - // Work through the file spec, looking for quoted filenames. If we find a shortcut file, then - // we need to add enough extra buffer space to hold its target path. - DWORD nExtraChars = 0; - bool bInsideQuotes = false; - LPCTSTR pAnchor = m_ofn.lpstrFile; - LPCTSTR pChar = m_ofn.lpstrFile; - for ( ; *pChar; ++pChar) - { - // Look for quotation marks. - if (*pChar == _T('\"')) - { - // We are either entering or leaving a passage of quoted text. - bInsideQuotes = !bInsideQuotes; - - // Is it an opening or closing quote? - if (bInsideQuotes) - { - // We found an opening quote, so set "pAnchor" to the following character. - pAnchor = pChar + 1; - } - else // closing quote - { - // Each quoted entity should be shorter than MAX_PATH. - if (pChar - pAnchor >= MAX_PATH) - return; - - // Get the ID-list and attributes of the file. - USES_CONVERSION; - int nFileNameLength = (int)(DWORD_PTR)(pChar - pAnchor); - TCHAR szFileName[MAX_PATH]; - SecureHelper::strncpy_x(szFileName, MAX_PATH, pAnchor, nFileNameLength); - LPITEMIDLIST pidl = NULL; - DWORD dwAttrib = SFGAO_LINK; - if (SUCCEEDED(pFolder->ParseDisplayName(NULL, NULL, T2W(szFileName), NULL, &pidl, &dwAttrib))) - { - // Is it a shortcut file? - if (dwAttrib & SFGAO_LINK) - { - // Bind to its IShellLink interface. - ATL::CComPtr pLink; - if (SUCCEEDED(pFolder->BindToObject(pidl, NULL, IID_IShellLink, (void**)&pLink))) - { - // Get the shortcut's target path. - TCHAR szPath[MAX_PATH]; - if (SUCCEEDED(pLink->GetPath(szPath, MAX_PATH, NULL, 0))) - { - // If the target path is longer than the shortcut name, then add on the number - // of extra characters that are required. - int nNewLength = lstrlen(szPath); - if (nNewLength > nFileNameLength) - nExtraChars += nNewLength - nFileNameLength; - } - } - } - - // Free the ID-list returned by ParseDisplayName. - ::CoTaskMemFree(pidl); - } - } - } - } - - // If we need more space for shortcut targets, then reallocate. - if (nExtraChars > 0) - ATLVERIFY(ResizeFilenameBuffer(m_ofn.nMaxFile + nExtraChars)); - } - - // Helper for _ATM_MIN_CRT - static const TCHAR* _strrchr(const TCHAR* p, TCHAR ch) - { -#ifndef _ATL_MIN_CRT - return _tcsrchr(p, ch); -#else // _ATL_MIN_CRT - const TCHAR* lpsz = NULL; - while (*p != 0) - { - if (*p == ch) - lpsz = p; - p = ::CharNext(p); - } - return lpsz; -#endif // _ATL_MIN_CRT - } -}; - -class CMultiFileDialog : public CMultiFileDialogImpl -{ -public: - CMultiFileDialog( - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CMultiFileDialogImpl(lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) - { } - - BEGIN_MSG_MAP(CMultiFileDialog) - CHAIN_MSG_MAP(CMultiFileDialogImpl) - END_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// Shell File Dialog - new Shell File Open and Save dialogs in Vista - -// Note: Use GetPtr() to access dialog interface methods. -// Example: -// CShellFileOpenDialog dlg; -// dlg.GetPtr()->SetTitle(L"MyFileOpenDialog"); - -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileDialogImpl - base class for CShellFileOpenDialogImpl and CShellFileSaveDialogImpl - -template -class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents -{ -public: -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - INT_PTR nRet = -1; - - T* pT = static_cast(this); - if(pT->m_spFileDlg == NULL) - { - ATLASSERT(FALSE); - return nRet; - } - - DWORD dwCookie = 0; - pT->_Advise(dwCookie); - - HRESULT hRet = pT->m_spFileDlg->Show(hWndParent); - if(SUCCEEDED(hRet)) - nRet = IDOK; - else if(hRet == HRESULT_FROM_WIN32(ERROR_CANCELLED)) - nRet = IDCANCEL; - else - ATLASSERT(FALSE); // error - - pT->_Unadvise(dwCookie); - - return nRet; - } - - bool IsNull() const - { - const T* pT = static_cast(this); - return (pT->m_spFileDlg == NULL); - } - -// Operations - get file path after dialog returns - HRESULT GetFilePath(LPWSTR lpstrFilePath, int cchLength) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, lpstrFilePath, cchLength); - - return hRet; - } - - HRESULT GetFileTitle(LPWSTR lpstrFileTitle, int cchLength) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, lpstrFileTitle, cchLength); - - return hRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - HRESULT GetFilePath(_CSTRING_NS::CString& strFilePath) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, strFilePath); - - return hRet; - } - - HRESULT GetFileTitle(_CSTRING_NS::CString& strFileTitle) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - ATL::CComPtr spItem; - HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); - - if(SUCCEEDED(hRet)) - hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, strFileTitle); - - return hRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Helpers for IShellItem - static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, LPWSTR lpstr, int cchLength) - { - ATLASSERT(pShellItem != NULL); - - LPWSTR lpstrName = NULL; - HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); - - if(SUCCEEDED(hRet)) - { - if(lstrlenW(lpstrName) < cchLength) - { - SecureHelper::strcpyW_x(lpstr, cchLength, lpstrName); - } - else - { - ATLASSERT(FALSE); - hRet = DISP_E_BUFFERTOOSMALL; - } - - ::CoTaskMemFree(lpstrName); - } - - return hRet; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, _CSTRING_NS::CString& str) - { - ATLASSERT(pShellItem != NULL); - - LPWSTR lpstrName = NULL; - HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); - - if(SUCCEEDED(hRet)) - { - str = lpstrName; - ::CoTaskMemFree(lpstrName); - } - - return hRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -// Implementation - void _Advise(DWORD& dwCookie) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - HRESULT hRet = pT->m_spFileDlg->Advise((IFileDialogEvents*)this, &dwCookie); - ATLVERIFY(SUCCEEDED(hRet)); - } - - void _Unadvise(DWORD dwCookie) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - HRESULT hRet = pT->m_spFileDlg->Unadvise(dwCookie); - ATLVERIFY(SUCCEEDED(hRet)); - } - - void _Init(LPCWSTR lpszFileName, DWORD dwOptions, LPCWSTR lpszDefExt, const COMDLG_FILTERSPEC* arrFilterSpec, UINT uFilterSpecCount) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg != NULL); - - HRESULT hRet = E_FAIL; - - if(lpszFileName != NULL) - { - hRet = pT->m_spFileDlg->SetFileName(lpszFileName); - ATLASSERT(SUCCEEDED(hRet)); - } - - hRet = pT->m_spFileDlg->SetOptions(dwOptions); - ATLASSERT(SUCCEEDED(hRet)); - - if(lpszDefExt != NULL) - { - hRet = pT->m_spFileDlg->SetDefaultExtension(lpszDefExt); - ATLASSERT(SUCCEEDED(hRet)); - } - - if(arrFilterSpec != NULL && uFilterSpecCount != 0U) - { - hRet = pT->m_spFileDlg->SetFileTypes(uFilterSpecCount, arrFilterSpec); - ATLASSERT(SUCCEEDED(hRet)); - } - } - -// Implementation - IUnknown interface - STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) - { - if(ppvObject == NULL) - return E_POINTER; - - T* pT = static_cast(this); - if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IFileDialogEvents)) - { - *ppvObject = (IFileDialogEvents*)pT; - // AddRef() not needed - return S_OK; - } - - return E_NOINTERFACE; - } - - virtual ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - virtual ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - -// Implementation - IFileDialogEvents interface - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFileOk(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnFileOk(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChanging(IFileDialog* pfd, IShellItem* psiFolder) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnFolderChanging(psiFolder); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChange(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnFolderChange(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnSelectionChange(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnSelectionChange(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnShareViolation(IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnShareViolation(psi, pResponse); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnTypeChange(IFileDialog* pfd) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnTypeChange(); - } - - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnOverwrite(IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); - pfd; // avoid level 4 warning - return pT->OnOverwrite(psi, pResponse); - } - -// Overrideables - Event handlers - HRESULT OnFileOk() - { - return E_NOTIMPL; - } - - HRESULT OnFolderChanging(IShellItem* /*psiFolder*/) - { - return E_NOTIMPL; - } - - HRESULT OnFolderChange() - { - return E_NOTIMPL; - } - - HRESULT OnSelectionChange() - { - return E_NOTIMPL; - } - - HRESULT OnShareViolation(IShellItem* /*psi*/, FDE_SHAREVIOLATION_RESPONSE* /*pResponse*/) - { - return E_NOTIMPL; - } - - HRESULT OnTypeChange() - { - return E_NOTIMPL; - } - - HRESULT OnOverwrite(IShellItem* /*psi*/, FDE_OVERWRITE_RESPONSE* /*pResponse*/) - { - return E_NOTIMPL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileOpenDialogImpl - implements new Shell File Open dialog - -template -class ATL_NO_VTABLE CShellFileOpenDialogImpl : public CShellFileDialogImpl< T > -{ -public: - ATL::CComPtr m_spFileDlg; - - CShellFileOpenDialogImpl(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) - { - HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileOpenDialog); - - if(SUCCEEDED(hRet)) - _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); - } - - IFileOpenDialog* GetPtr() - { - return m_spFileDlg; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileOpenDialog - new Shell File Open dialog without events - -class CShellFileOpenDialog : public CShellFileOpenDialogImpl -{ -public: - CShellFileOpenDialog(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) : CShellFileOpenDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) - { } - -// Implementation (remove _Advise/_Unadvise code using template magic) - void _Advise(DWORD& /*dwCookie*/) - { } - - void _Unadvise(DWORD /*dwCookie*/) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileSaveDialogImpl - implements new Shell File Save dialog - -template -class ATL_NO_VTABLE CShellFileSaveDialogImpl : public CShellFileDialogImpl< T > -{ -public: - ATL::CComPtr m_spFileDlg; - - CShellFileSaveDialogImpl(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) - { - HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileSaveDialog); - - if(SUCCEEDED(hRet)) - _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); - } - - IFileSaveDialog* GetPtr() - { - return m_spFileDlg; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CShellFileSaveDialog - new Shell File Save dialog without events - -class CShellFileSaveDialog : public CShellFileSaveDialogImpl -{ -public: - CShellFileSaveDialog(LPCWSTR lpszFileName = NULL, - DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, - LPCWSTR lpszDefExt = NULL, - const COMDLG_FILTERSPEC* arrFilterSpec = NULL, - UINT uFilterSpecCount = 0U) : CShellFileSaveDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) - { } - -// Implementation (remove _Advise/_Unadvise code using template magic) - void _Advise(DWORD& /*dwCookie*/) - { } - - void _Unadvise(DWORD /*dwCookie*/) - { } -}; - -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CFolderDialogImpl - used for browsing for a folder - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CFolderDialogImpl -{ -public: - BROWSEINFO m_bi; - LPCTSTR m_lpstrInitialFolder; - LPCITEMIDLIST m_pidlInitialSelection; - bool m_bExpandInitialSelection; - TCHAR m_szFolderDisplayName[MAX_PATH]; - TCHAR m_szFolderPath[MAX_PATH]; - LPITEMIDLIST m_pidlSelected; - HWND m_hWnd; // used only in the callback function - -// Constructor - CFolderDialogImpl(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) : - m_lpstrInitialFolder(NULL), m_pidlInitialSelection(NULL), m_bExpandInitialSelection(false), m_pidlSelected(NULL), m_hWnd(NULL) - { - memset(&m_bi, 0, sizeof(m_bi)); // initialize structure to 0/NULL - - m_bi.hwndOwner = hWndParent; - m_bi.pidlRoot = NULL; - m_bi.pszDisplayName = m_szFolderDisplayName; - m_bi.lpszTitle = lpstrTitle; - m_bi.ulFlags = uFlags; - m_bi.lpfn = BrowseCallbackProc; - m_bi.lParam = (LPARAM)static_cast(this); - - m_szFolderPath[0] = 0; - m_szFolderDisplayName[0] = 0; - } - - ~CFolderDialogImpl() - { - ::CoTaskMemFree(m_pidlSelected); - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - if(m_bi.hwndOwner == NULL) // set only if not specified before - m_bi.hwndOwner = hWndParent; - - // Clear out any previous results - m_szFolderPath[0] = 0; - m_szFolderDisplayName[0] = 0; - ::CoTaskMemFree(m_pidlSelected); - - INT_PTR nRet = IDCANCEL; - m_pidlSelected = ::SHBrowseForFolder(&m_bi); - - if(m_pidlSelected != NULL) - { - nRet = IDOK; - - // If BIF_RETURNONLYFSDIRS is set, we try to get the filesystem path. - // Otherwise, the caller must handle the ID-list directly. - if((m_bi.ulFlags & BIF_RETURNONLYFSDIRS) != 0) - { - if(::SHGetPathFromIDList(m_pidlSelected, m_szFolderPath) == FALSE) - nRet = IDCANCEL; - } - } - - return nRet; - } - - // Methods to call before DoModal - void SetInitialFolder(LPCTSTR lpstrInitialFolder, bool bExpand = true) - { - // lpstrInitialFolder may be a file if BIF_BROWSEINCLUDEFILES is specified - m_lpstrInitialFolder = lpstrInitialFolder; - m_bExpandInitialSelection = bExpand; - } - - void SetInitialSelection(LPCITEMIDLIST pidl, bool bExpand = true) - { - m_pidlInitialSelection = pidl; - m_bExpandInitialSelection = bExpand; - } - - // Methods to call after DoModal - LPITEMIDLIST GetSelectedItem(bool bDetach = false) - { - LPITEMIDLIST pidl = m_pidlSelected; - if(bDetach) - m_pidlSelected = NULL; - - return pidl; - } - - LPCTSTR GetFolderPath() const - { - return m_szFolderPath; - } - - LPCTSTR GetFolderDisplayName() const - { - return m_szFolderDisplayName; - } - - int GetFolderImageIndex() const - { - return m_bi.iImage; - } - -// Callback function and overrideables - static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData) - { -#ifndef BFFM_VALIDATEFAILED - #ifdef UNICODE - const int BFFM_VALIDATEFAILED = 4; - #else - const int BFFM_VALIDATEFAILED = 3; - #endif -#endif // !BFFM_VALIDATEFAILED -#ifndef BFFM_IUNKNOWN - const int BFFM_IUNKNOWN = 5; -#endif // !BFFM_IUNKNOWN -#ifndef BIF_NEWDIALOGSTYLE - const UINT BIF_NEWDIALOGSTYLE = 0x0040; -#endif // !BIF_NEWDIALOGSTYLE - - int nRet = 0; - T* pT = (T*)lpData; - bool bClear = false; - if(pT->m_hWnd == NULL) - { - pT->m_hWnd = hWnd; - bClear = true; - } - else - { - ATLASSERT(pT->m_hWnd == hWnd); - } - - switch(uMsg) - { - case BFFM_INITIALIZED: - // Set initial selection - // Note that m_pidlInitialSelection, if set, takes precedence over m_lpstrInitialFolder - if(pT->m_pidlInitialSelection != NULL) - pT->SetSelection(pT->m_pidlInitialSelection); - else if(pT->m_lpstrInitialFolder != NULL) - pT->SetSelection(pT->m_lpstrInitialFolder); - - // Expand initial selection if appropriate - if(pT->m_bExpandInitialSelection && ((pT->m_bi.ulFlags & BIF_NEWDIALOGSTYLE) != 0)) - { - if(pT->m_pidlInitialSelection != NULL) - pT->SetExpanded(pT->m_pidlInitialSelection); - else if(pT->m_lpstrInitialFolder != NULL) - pT->SetExpanded(pT->m_lpstrInitialFolder); - } - pT->OnInitialized(); - break; - case BFFM_SELCHANGED: - pT->OnSelChanged((LPITEMIDLIST)lParam); - break; - case BFFM_VALIDATEFAILED: - nRet = pT->OnValidateFailed((LPCTSTR)lParam); - break; - case BFFM_IUNKNOWN: - pT->OnIUnknown((IUnknown*)lParam); - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown message received in CFolderDialogImpl::BrowseCallbackProc\n")); - break; - } - - if(bClear) - pT->m_hWnd = NULL; - return nRet; - } - - void OnInitialized() - { - } - - void OnSelChanged(LPITEMIDLIST /*pItemIDList*/) - { - } - - int OnValidateFailed(LPCTSTR /*lpstrFolderPath*/) - { - return 1; // 1=continue, 0=EndDialog - } - - void OnIUnknown(IUnknown* /*pUnknown*/) - { - } - - // Commands - valid to call only from handlers - void EnableOK(BOOL bEnable) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_ENABLEOK, 0, bEnable); - } - - void SetSelection(LPCITEMIDLIST pItemIDList) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETSELECTION, FALSE, (LPARAM)pItemIDList); - } - - void SetSelection(LPCTSTR lpstrFolderPath) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)lpstrFolderPath); - } - - void SetStatusText(LPCTSTR lpstrText) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)lpstrText); - } - - void SetOKText(LPCTSTR lpstrOKText) - { -#ifndef BFFM_SETOKTEXT - const UINT BFFM_SETOKTEXT = WM_USER + 105; -#endif - ATLASSERT(m_hWnd != NULL); - USES_CONVERSION; - LPCWSTR lpstr = T2CW(lpstrOKText); - ::SendMessage(m_hWnd, BFFM_SETOKTEXT, (WPARAM)lpstr, 0L); - } - - void SetExpanded(LPCITEMIDLIST pItemIDList) - { -#ifndef BFFM_SETEXPANDED - const UINT BFFM_SETEXPANDED = WM_USER + 106; -#endif - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, BFFM_SETEXPANDED, FALSE, (LPARAM)pItemIDList); - } - - void SetExpanded(LPCTSTR lpstrFolderPath) - { -#ifndef BFFM_SETEXPANDED - const UINT BFFM_SETEXPANDED = WM_USER + 106; -#endif - ATLASSERT(m_hWnd != NULL); - USES_CONVERSION; - LPCWSTR lpstr = T2CW(lpstrFolderPath); - ::SendMessage(m_hWnd, BFFM_SETEXPANDED, TRUE, (LPARAM)lpstr); - } -}; - -class CFolderDialog : public CFolderDialogImpl -{ -public: - CFolderDialog(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) - : CFolderDialogImpl(hWndParent, lpstrTitle, uFlags) - { } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CCommonDialogImplBase - base class for common dialog classes - -class ATL_NO_VTABLE CCommonDialogImplBase : public ATL::CWindowImplBase -{ -public: - static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - if(uMsg != WM_INITDIALOG) - return 0; - CCommonDialogImplBase* pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); - ATLASSERT(pT != NULL); - ATLASSERT(pT->m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - // subclass dialog's window - if(!pT->SubclassWindow(hWnd)) - { - ATLTRACE2(atlTraceUI, 0, _T("Subclassing a common dialog failed\n")); - return 0; - } - // check message map for WM_INITDIALOG handler - LRESULT lRes = 0; - if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) - return 0; - return lRes; - } - -// Special override for common dialogs - BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); - return TRUE; - } - -// Implementation - try to override these, to prevent errors - HWND Create(HWND, ATL::_U_RECT, LPCTSTR, DWORD, DWORD, ATL::_U_MENUorID, ATOM, LPVOID) - { - ATLASSERT(FALSE); // should not be called - return NULL; - } - - static LRESULT CALLBACK StartWindowProc(HWND /*hWnd*/, UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) - { - ATLASSERT(FALSE); // should not be called - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CFontDialogImpl - font selection dialog - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase -{ -public: - enum { _cchStyleName = 64 }; - - CHOOSEFONT m_cf; - TCHAR m_szStyleName[_cchStyleName]; // contains style name after return - LOGFONT m_lf; // default LOGFONT to store the info - -// Constructors - CFontDialogImpl(LPLOGFONT lplfInitial = NULL, - DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - { - memset(&m_cf, 0, sizeof(m_cf)); - memset(&m_lf, 0, sizeof(m_lf)); - memset(&m_szStyleName, 0, sizeof(m_szStyleName)); - - m_cf.lStructSize = sizeof(m_cf); - m_cf.hwndOwner = hWndParent; - m_cf.rgbColors = RGB(0, 0, 0); - m_cf.lpszStyle = (LPTSTR)&m_szStyleName; - m_cf.Flags = dwFlags | CF_ENABLEHOOK; - m_cf.lpfnHook = (LPCFHOOKPROC)T::HookProc; - - if(lplfInitial != NULL) - { - m_cf.lpLogFont = lplfInitial; - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - m_lf = *lplfInitial; - } - else - { - m_cf.lpLogFont = &m_lf; - } - - if(hDCPrinter != NULL) - { - m_cf.hDC = hDCPrinter; - m_cf.Flags |= CF_PRINTERFONTS; - } - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_cf.Flags & CF_ENABLEHOOK) != 0); - ATLASSERT(m_cf.lpfnHook != NULL); // can still be a user hook - - if(m_cf.hwndOwner == NULL) // set only if not specified before - m_cf.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::ChooseFont(&m_cf); - - m_hWnd = NULL; - - if(bRet) // copy logical font from user's initialization buffer (if needed) - SecureHelper::memcpy_x(&m_lf, sizeof(m_lf), m_cf.lpLogFont, sizeof(m_lf)); - - return bRet ? IDOK : IDCANCEL; - } - - // works only when the dialog is dislayed or after - void GetCurrentFont(LPLOGFONT lplf) const - { - ATLASSERT(lplf != NULL); - - if(m_hWnd != NULL) - ::SendMessage(m_hWnd, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM)lplf); - else - *lplf = m_lf; - } - - // works only when the dialog is dislayed or before -#ifndef _WIN32_WCE - void SetLogFont(LPLOGFONT lplf) - { - ATLASSERT(lplf != NULL); -#ifndef WM_CHOOSEFONT_SETLOGFONT - const UINT WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101); -#endif - if(m_hWnd != NULL) - { - ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETLOGFONT, 0, (LPARAM)lplf); - } - else - { - m_lf = *lplf; - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - } - } - - void SetFlags(DWORD dwFlags) - { -#ifndef WM_CHOOSEFONT_SETFLAGS - const UINT WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102); -#endif - if(m_hWnd != NULL) - { - CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; - cf.Flags = dwFlags; - ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETFLAGS, 0, (LPARAM)&cf); - } - else - { - m_cf.Flags = dwFlags; - } - } -#endif // !_WIN32_WCE - - // Helpers for parsing information after successful return - LPCTSTR GetFaceName() const // return the face name of the font - { - return (LPCTSTR)m_cf.lpLogFont->lfFaceName; - } - - LPCTSTR GetStyleName() const // return the style name of the font - { - return m_cf.lpszStyle; - } - - int GetSize() const // return the pt size of the font - { - return m_cf.iPointSize; - } - - COLORREF GetColor() const // return the color of the font - { - return m_cf.rgbColors; - } - - int GetWeight() const // return the chosen font weight - { - return (int)m_cf.lpLogFont->lfWeight; - } - - BOOL IsStrikeOut() const // return TRUE if strikeout - { - return (m_cf.lpLogFont->lfStrikeOut) ? TRUE : FALSE; - } - - BOOL IsUnderline() const // return TRUE if underline - { - return (m_cf.lpLogFont->lfUnderline) ? TRUE : FALSE; - } - - BOOL IsBold() const // return TRUE if bold font - { - return (m_cf.lpLogFont->lfWeight == FW_BOLD) ? TRUE : FALSE; - } - - BOOL IsItalic() const // return TRUE if italic font - { - return m_cf.lpLogFont->lfItalic ? TRUE : FALSE; - } -}; - -class CFontDialog : public CFontDialogImpl -{ -public: - CFontDialog(LPLOGFONT lplfInitial = NULL, - DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - : CFontDialogImpl(lplfInitial, dwFlags, hDCPrinter, hWndParent) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditFontDialogImpl - font selection for the Rich Edit ctrl - -#if defined(_RICHEDIT_) && !defined(_WIN32_WCE) - -template -class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > -{ -public: - CRichEditFontDialogImpl(const CHARFORMAT& charformat, - DWORD dwFlags = CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - : CFontDialogImpl< T >(NULL, dwFlags, hDCPrinter, hWndParent) - { - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - m_cf.Flags |= FillInLogFont(charformat); - m_cf.lpLogFont = &m_lf; - - if((charformat.dwMask & CFM_COLOR) != 0) - m_cf.rgbColors = charformat.crTextColor; - } - - void GetCharFormat(CHARFORMAT& cf) const - { - USES_CONVERSION; - cf.dwEffects = 0; - cf.dwMask = 0; - if((m_cf.Flags & CF_NOSTYLESEL) == 0) - { - cf.dwMask |= CFM_BOLD | CFM_ITALIC; - cf.dwEffects |= IsBold() ? CFE_BOLD : 0; - cf.dwEffects |= IsItalic() ? CFE_ITALIC : 0; - } - if((m_cf.Flags & CF_NOSIZESEL) == 0) - { - cf.dwMask |= CFM_SIZE; - // GetSize() returns in tenths of points so mulitply by 2 to get twips - cf.yHeight = GetSize() * 2; - } - - if((m_cf.Flags & CF_NOFACESEL) == 0) - { - cf.dwMask |= CFM_FACE; - cf.bPitchAndFamily = m_cf.lpLogFont->lfPitchAndFamily; -#if (_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(cf.szFaceName, _countof(cf.szFaceName), GetFaceName()); -#else // !(_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpyA_x(cf.szFaceName, _countof(cf.szFaceName), T2A((LPTSTR)(LPCTSTR)GetFaceName())); -#endif // !(_RICHEDIT_VER >= 0x0200) - } - - if((m_cf.Flags & CF_EFFECTS) != 0) - { - cf.dwMask |= CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR; - cf.dwEffects |= IsUnderline() ? CFE_UNDERLINE : 0; - cf.dwEffects |= IsStrikeOut() ? CFE_STRIKEOUT : 0; - cf.crTextColor = GetColor(); - } - if((m_cf.Flags & CF_NOSCRIPTSEL) == 0) - { - cf.bCharSet = m_cf.lpLogFont->lfCharSet; - cf.dwMask |= CFM_CHARSET; - } - cf.yOffset = 0; - } - - DWORD FillInLogFont(const CHARFORMAT& cf) - { - USES_CONVERSION; - DWORD dwFlags = 0; - if((cf.dwMask & CFM_SIZE) != 0) - { - HDC hDC = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL); - LONG yPerInch = ::GetDeviceCaps(hDC, LOGPIXELSY); - m_lf.lfHeight = -(int)((cf.yHeight * yPerInch) / 1440); - } - else - m_lf.lfHeight = 0; - - m_lf.lfWidth = 0; - m_lf.lfEscapement = 0; - m_lf.lfOrientation = 0; - - if((cf.dwMask & (CFM_ITALIC | CFM_BOLD)) == (CFM_ITALIC | CFM_BOLD)) - { - m_lf.lfWeight = ((cf.dwEffects & CFE_BOLD) != 0) ? FW_BOLD : FW_NORMAL; - m_lf.lfItalic = (BYTE)(((cf.dwEffects & CFE_ITALIC) != 0) ? TRUE : FALSE); - } - else - { - dwFlags |= CF_NOSTYLESEL; - m_lf.lfWeight = FW_DONTCARE; - m_lf.lfItalic = FALSE; - } - - if((cf.dwMask & (CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR)) == (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) - { - dwFlags |= CF_EFFECTS; - m_lf.lfUnderline = (BYTE)(((cf.dwEffects & CFE_UNDERLINE) != 0) ? TRUE : FALSE); - m_lf.lfStrikeOut = (BYTE)(((cf.dwEffects & CFE_STRIKEOUT) != 0) ? TRUE : FALSE); - } - else - { - m_lf.lfUnderline = (BYTE)FALSE; - m_lf.lfStrikeOut = (BYTE)FALSE; - } - - if((cf.dwMask & CFM_CHARSET) != 0) - m_lf.lfCharSet = cf.bCharSet; - else - dwFlags |= CF_NOSCRIPTSEL; - m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS; - m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; - m_lf.lfQuality = DEFAULT_QUALITY; - if((cf.dwMask & CFM_FACE) != 0) - { - m_lf.lfPitchAndFamily = cf.bPitchAndFamily; -#if (_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), cf.szFaceName); -#else // !(_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), A2T((LPSTR)cf.szFaceName)); -#endif // !(_RICHEDIT_VER >= 0x0200) - } - else - { - m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; - m_lf.lfFaceName[0] = (TCHAR)0; - } - return dwFlags; - } -}; - -class CRichEditFontDialog : public CRichEditFontDialogImpl -{ -public: - CRichEditFontDialog(const CHARFORMAT& charformat, - DWORD dwFlags = CF_SCREENFONTS, - HDC hDCPrinter = NULL, - HWND hWndParent = NULL) - : CRichEditFontDialogImpl(charformat, dwFlags, hDCPrinter, hWndParent) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // defined(_RICHEDIT_) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CColorDialogImpl - color selection - -#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) - -#ifdef _WIN32_WCE - #pragma comment(lib, "commdlg.lib") - - #ifndef SETRGBSTRING - #define SETRGBSTRING _T("commdlg_SetRGBColor") - #endif - - #ifndef COLOROKSTRING - #define COLOROKSTRING _T("commdlg_ColorOK") - #endif -#endif - -template -class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase -{ -public: - CHOOSECOLOR m_cc; - -// Constructor - CColorDialogImpl(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) - { - memset(&m_cc, 0, sizeof(m_cc)); - - m_cc.lStructSize = sizeof(m_cc); - m_cc.lpCustColors = GetCustomColors(); - m_cc.hwndOwner = hWndParent; - m_cc.Flags = dwFlags | CC_ENABLEHOOK; - m_cc.lpfnHook = (LPCCHOOKPROC)T::HookProc; - - if(clrInit != 0) - { - m_cc.rgbResult = clrInit; - m_cc.Flags |= CC_RGBINIT; - } - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_cc.Flags & CC_ENABLEHOOK) != 0); - ATLASSERT(m_cc.lpfnHook != NULL); // can still be a user hook - - if(m_cc.hwndOwner == NULL) // set only if not specified before - m_cc.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::ChooseColor(&m_cc); - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - - // Set the current color while dialog is displayed - void SetCurrentColor(COLORREF clr) - { - ATLASSERT(::IsWindow(m_hWnd)); - SendMessage(_GetSetRGBMessage(), 0, (LPARAM)clr); - } - - // Get the selected color after DoModal returns, or in OnColorOK - COLORREF GetColor() const - { - return m_cc.rgbResult; - } - -// Special override for the color dialog - static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - if(uMsg != WM_INITDIALOG && uMsg != _GetColorOKMessage()) - return 0; - - LPCHOOSECOLOR lpCC = (LPCHOOSECOLOR)lParam; - CCommonDialogImplBase* pT = NULL; - - if(uMsg == WM_INITDIALOG) - { - pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); - lpCC->lCustData = (LPARAM)pT; - ATLASSERT(pT != NULL); - ATLASSERT(pT->m_hWnd == NULL); - ATLASSERT(::IsWindow(hWnd)); - // subclass dialog's window - if(!pT->SubclassWindow(hWnd)) - { - ATLTRACE2(atlTraceUI, 0, _T("Subclassing a Color common dialog failed\n")); - return 0; - } - } - else if(uMsg == _GetColorOKMessage()) - { - pT = (CCommonDialogImplBase*)lpCC->lCustData; - ATLASSERT(pT != NULL); - ATLASSERT(::IsWindow(pT->m_hWnd)); - } - - // pass to the message map - LRESULT lRes; - if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) - return 0; - return lRes; - } - -// Helpers - static COLORREF* GetCustomColors() - { - static COLORREF rgbCustomColors[16] = - { - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - RGB(255, 255, 255), RGB(255, 255, 255), - }; - - return rgbCustomColors; - } - - static UINT _GetSetRGBMessage() - { - static UINT uSetRGBMessage = 0; - if(uSetRGBMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetSetRGBMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uSetRGBMessage == 0) - uSetRGBMessage = ::RegisterWindowMessage(SETRGBSTRING); - - lock.Unlock(); - } - ATLASSERT(uSetRGBMessage != 0); - return uSetRGBMessage; - } - - static UINT _GetColorOKMessage() - { - static UINT uColorOKMessage = 0; - if(uColorOKMessage == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetColorOKMessage.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uColorOKMessage == 0) - uColorOKMessage = ::RegisterWindowMessage(COLOROKSTRING); - - lock.Unlock(); - } - ATLASSERT(uColorOKMessage != 0); - return uColorOKMessage; - } - -// Message map and handlers - BEGIN_MSG_MAP(CColorDialogImpl) - MESSAGE_HANDLER(_GetColorOKMessage(), _OnColorOK) - END_MSG_MAP() - - LRESULT _OnColorOK(UINT, WPARAM, LPARAM, BOOL&) - { - T* pT = static_cast(this); - return pT->OnColorOK(); - } - -// Overrideable - BOOL OnColorOK() // validate color - { - return FALSE; - } -}; - -class CColorDialog : public CColorDialogImpl -{ -public: - CColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) - : CColorDialogImpl(clrInit, dwFlags, hWndParent) - { } - - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintDialogImpl - used for Print... and PrintSetup... - -#ifndef _WIN32_WCE - -// global helper -static HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) -{ - if(hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDevNames = (LPDEVNAMES)::GlobalLock(hDevNames); - LPDEVMODE lpDevMode = (hDevMode != NULL) ? (LPDEVMODE)::GlobalLock(hDevMode) : NULL; - - if(lpDevNames == NULL) - return NULL; - - HDC hDC = ::CreateDC((LPCTSTR)lpDevNames + lpDevNames->wDriverOffset, - (LPCTSTR)lpDevNames + lpDevNames->wDeviceOffset, - (LPCTSTR)lpDevNames + lpDevNames->wOutputOffset, - lpDevMode); - - ::GlobalUnlock(hDevNames); - if(hDevMode != NULL) - ::GlobalUnlock(hDevMode); - return hDC; -} - -template -class ATL_NO_VTABLE CPrintDialogImpl : public CCommonDialogImplBase -{ -public: - // print dialog parameter block (note this is a reference) - PRINTDLG& m_pd; - -// Constructors - CPrintDialogImpl(BOOL bPrintSetupOnly = FALSE, // TRUE for Print Setup, FALSE for Print Dialog - DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, - HWND hWndParent = NULL) - : m_pd(m_pdActual) - { - memset(&m_pdActual, 0, sizeof(m_pdActual)); - - m_pd.lStructSize = sizeof(m_pdActual); - m_pd.hwndOwner = hWndParent; - m_pd.Flags = (dwFlags | PD_ENABLEPRINTHOOK | PD_ENABLESETUPHOOK); - m_pd.lpfnPrintHook = (LPPRINTHOOKPROC)T::HookProc; - m_pd.lpfnSetupHook = (LPSETUPHOOKPROC)T::HookProc; - - if(bPrintSetupOnly) - m_pd.Flags |= PD_PRINTSETUP; - else - m_pd.Flags |= PD_RETURNDC; - - m_pd.Flags &= ~PD_RETURNIC; // do not support information context - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_pd.Flags & PD_ENABLEPRINTHOOK) != 0); - ATLASSERT((m_pd.Flags & PD_ENABLESETUPHOOK) != 0); - ATLASSERT(m_pd.lpfnPrintHook != NULL); // can still be a user hook - ATLASSERT(m_pd.lpfnSetupHook != NULL); // can still be a user hook - ATLASSERT((m_pd.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this - - if(m_pd.hwndOwner == NULL) // set only if not specified before - m_pd.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::PrintDlg(&m_pd); - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - - // GetDefaults will not display a dialog but will get device defaults - BOOL GetDefaults() - { - m_pd.Flags |= PD_RETURNDEFAULT; - ATLASSERT(m_pd.hDevMode == NULL); // must be NULL - ATLASSERT(m_pd.hDevNames == NULL); // must be NULL - - return ::PrintDlg(&m_pd); - } - - // Helpers for parsing information after successful return num. copies requested - int GetCopies() const - { - if((m_pd.Flags & PD_USEDEVMODECOPIES) != 0) - { - LPDEVMODE lpDevMode = GetDevMode(); - return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; - } - - return m_pd.nCopies; - } - - BOOL PrintCollate() const // TRUE if collate checked - { - return ((m_pd.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; - } - - BOOL PrintSelection() const // TRUE if printing selection - { - return ((m_pd.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; - } - - BOOL PrintAll() const // TRUE if printing all pages - { - return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; - } - - BOOL PrintRange() const // TRUE if printing page range - { - return ((m_pd.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; - } - - BOOL PrintToFile() const // TRUE if printing to a file - { - return ((m_pd.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; - } - - int GetFromPage() const // starting page if valid - { - return PrintRange() ? m_pd.nFromPage : -1; - } - - int GetToPage() const // ending page if valid - { - return PrintRange() ? m_pd.nToPage : -1; - } - - LPDEVMODE GetDevMode() const // return DEVMODE - { - if(m_pd.hDevMode == NULL) - return NULL; - - return (LPDEVMODE)::GlobalLock(m_pd.hDevMode); - } - - LPCTSTR GetDriverName() const // return driver name - { - if(m_pd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDriverOffset; - } - - LPCTSTR GetDeviceName() const // return device name - { - if(m_pd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDeviceOffset; - } - - LPCTSTR GetPortName() const // return output port name - { - if(m_pd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wOutputOffset; - } - - HDC GetPrinterDC() const // return HDC (caller must delete) - { - ATLASSERT((m_pd.Flags & PD_RETURNDC) != 0); - return m_pd.hDC; - } - - // This helper creates a DC based on the DEVNAMES and DEVMODE structures. - // This DC is returned, but also stored in m_pd.hDC as though it had been - // returned by CommDlg. It is assumed that any previously obtained DC - // has been/will be deleted by the user. This may be - // used without ever invoking the print/print setup dialogs. - HDC CreatePrinterDC() - { - m_pd.hDC = _AtlCreateDC(m_pd.hDevNames, m_pd.hDevMode); - return m_pd.hDC; - } - -// Implementation - PRINTDLG m_pdActual; // the Print/Print Setup need to share this - - // The following handle the case of print setup... from the print dialog - CPrintDialogImpl(PRINTDLG& pdInit) : m_pd(pdInit) - { } - - BEGIN_MSG_MAP(CPrintDialogImpl) -#ifdef psh1 - COMMAND_ID_HANDLER(psh1, OnPrintSetup) // print setup button when print is displayed -#else // !psh1 - COMMAND_ID_HANDLER(0x0400, OnPrintSetup) // value from dlgs.h -#endif // !psh1 - END_MSG_MAP() - - LRESULT OnPrintSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/) - { - T dlgSetup(m_pd); - ModuleHelper::AddCreateWndData(&dlgSetup.m_thunk.cd, (CCommonDialogImplBase*)&dlgSetup); - return DefWindowProc(WM_COMMAND, MAKEWPARAM(wID, wNotifyCode), (LPARAM)hWndCtl); - } -}; - -class CPrintDialog : public CPrintDialogImpl -{ -public: - CPrintDialog(BOOL bPrintSetupOnly = FALSE, - DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, - HWND hWndParent = NULL) - : CPrintDialogImpl(bPrintSetupOnly, dwFlags, hWndParent) - { } - - CPrintDialog(PRINTDLG& pdInit) : CPrintDialogImpl(pdInit) - { } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintDialogExImpl - new print dialog for Windows 2000 - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - -}; // namespace WTL - -#include - -extern "C" const __declspec(selectany) IID IID_IPrintDialogCallback = {0x5852a2c3, 0x6530, 0x11d1, {0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; -extern "C" const __declspec(selectany) IID IID_IPrintDialogServices = {0x509aaeda, 0x5639, 0x11d1, {0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; - -namespace WTL -{ - -template -class ATL_NO_VTABLE CPrintDialogExImpl : - public ATL::CWindow, - public ATL::CMessageMap, - public IPrintDialogCallback, - public ATL::IObjectWithSiteImpl< T > -{ -public: - PRINTDLGEX m_pdex; - -// Constructor - CPrintDialogExImpl(DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, - HWND hWndParent = NULL) - { - memset(&m_pdex, 0, sizeof(m_pdex)); - - m_pdex.lStructSize = sizeof(PRINTDLGEX); - m_pdex.hwndOwner = hWndParent; - m_pdex.Flags = dwFlags; - m_pdex.nStartPage = START_PAGE_GENERAL; - // callback object will be set in DoModal - - m_pdex.Flags &= ~PD_RETURNIC; // do not support information context - } - -// Operations - HRESULT DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT(m_hWnd == NULL); - ATLASSERT((m_pdex.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this - - if(m_pdex.hwndOwner == NULL) // set only if not specified before - m_pdex.hwndOwner = hWndParent; - - T* pT = static_cast(this); - m_pdex.lpCallback = (IUnknown*)(IPrintDialogCallback*)pT; - - HRESULT hResult = ::PrintDlgEx(&m_pdex); - - m_hWnd = NULL; - - return hResult; - } - - BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); - return TRUE; - } - - // GetDefaults will not display a dialog but will get device defaults - HRESULT GetDefaults() - { - m_pdex.Flags |= PD_RETURNDEFAULT; - ATLASSERT(m_pdex.hDevMode == NULL); // must be NULL - ATLASSERT(m_pdex.hDevNames == NULL); // must be NULL - - return ::PrintDlgEx(&m_pdex); - } - - // Helpers for parsing information after successful return num. copies requested - int GetCopies() const - { - if((m_pdex.Flags & PD_USEDEVMODECOPIES) != 0) - { - LPDEVMODE lpDevMode = GetDevMode(); - return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; - } - - return m_pdex.nCopies; - } - - BOOL PrintCollate() const // TRUE if collate checked - { - return ((m_pdex.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; - } - - BOOL PrintSelection() const // TRUE if printing selection - { - return ((m_pdex.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; - } - - BOOL PrintAll() const // TRUE if printing all pages - { - return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; - } - - BOOL PrintRange() const // TRUE if printing page range - { - return ((m_pdex.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; - } - - BOOL PrintToFile() const // TRUE if printing to a file - { - return ((m_pdex.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; - } - - LPDEVMODE GetDevMode() const // return DEVMODE - { - if(m_pdex.hDevMode == NULL) - return NULL; - - return (LPDEVMODE)::GlobalLock(m_pdex.hDevMode); - } - - LPCTSTR GetDriverName() const // return driver name - { - if(m_pdex.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDriverOffset; - } - - LPCTSTR GetDeviceName() const // return device name - { - if(m_pdex.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wDeviceOffset; - } - - LPCTSTR GetPortName() const // return output port name - { - if(m_pdex.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); - if(lpDev == NULL) - return NULL; - - return (LPCTSTR)lpDev + lpDev->wOutputOffset; - } - - HDC GetPrinterDC() const // return HDC (caller must delete) - { - ATLASSERT((m_pdex.Flags & PD_RETURNDC) != 0); - return m_pdex.hDC; - } - - // This helper creates a DC based on the DEVNAMES and DEVMODE structures. - // This DC is returned, but also stored in m_pdex.hDC as though it had been - // returned by CommDlg. It is assumed that any previously obtained DC - // has been/will be deleted by the user. This may be - // used without ever invoking the print/print setup dialogs. - HDC CreatePrinterDC() - { - m_pdex.hDC = _AtlCreateDC(m_pdex.hDevNames, m_pdex.hDevMode); - return m_pdex.hDC; - } - -// Implementation - interfaces - -// IUnknown - STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) - { - if(ppvObject == NULL) - return E_POINTER; - - T* pT = static_cast(this); - if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IPrintDialogCallback)) - { - *ppvObject = (IPrintDialogCallback*)pT; - // AddRef() not needed - return S_OK; - } - else if(IsEqualGUID(riid, IID_IObjectWithSite)) - { - *ppvObject = (IObjectWithSite*)pT; - // AddRef() not needed - return S_OK; - } - - return E_NOINTERFACE; - } - - virtual ULONG STDMETHODCALLTYPE AddRef() - { - return 1; - } - - virtual ULONG STDMETHODCALLTYPE Release() - { - return 1; - } - -// IPrintDialogCallback - STDMETHOD(InitDone)() - { - return S_FALSE; - } - - STDMETHOD(SelectionChange)() - { - return S_FALSE; - } - - STDMETHOD(HandleMessage)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* plResult) - { - // set up m_hWnd the first time - if(m_hWnd == NULL) - Attach(hWnd); - - // call message map - HRESULT hRet = ProcessWindowMessage(hWnd, uMsg, wParam, lParam, *plResult, 0) ? S_OK : S_FALSE; - if(hRet == S_OK && uMsg == WM_NOTIFY) // return in DWLP_MSGRESULT - ::SetWindowLongPtr(GetParent(), DWLP_MSGRESULT, (LONG_PTR)*plResult); - - if(uMsg == WM_INITDIALOG && hRet == S_OK && (BOOL)*plResult != FALSE) - hRet = S_FALSE; - - return hRet; - } -}; - -class CPrintDialogEx : public CPrintDialogExImpl -{ -public: - CPrintDialogEx( - DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, - HWND hWndParent = NULL) - : CPrintDialogExImpl(dwFlags, hWndParent) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CPageSetupDialogImpl - Page Setup dialog - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase -{ -public: - PAGESETUPDLG m_psd; - ATL::CWndProcThunk m_thunkPaint; - -// Constructors - CPageSetupDialogImpl(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) - { - memset(&m_psd, 0, sizeof(m_psd)); - - m_psd.lStructSize = sizeof(m_psd); - m_psd.hwndOwner = hWndParent; - m_psd.Flags = (dwFlags | PSD_ENABLEPAGESETUPHOOK | PSD_ENABLEPAGEPAINTHOOK); - m_psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)T::HookProc; - m_thunkPaint.Init((WNDPROC)T::PaintHookProc, this); -#if (_ATL_VER >= 0x0700) - m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)m_thunkPaint.GetWNDPROC(); -#else - m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)&(m_thunkPaint.thunk); -#endif - } - - DECLARE_EMPTY_MSG_MAP() - -// Attributes - LPDEVMODE GetDevMode() const // return DEVMODE - { - if(m_psd.hDevMode == NULL) - return NULL; - - return (LPDEVMODE)::GlobalLock(m_psd.hDevMode); - } - - LPCTSTR GetDriverName() const // return driver name - { - if(m_psd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); - return (LPCTSTR)lpDev + lpDev->wDriverOffset; - } - - LPCTSTR GetDeviceName() const // return device name - { - if(m_psd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); - return (LPCTSTR)lpDev + lpDev->wDeviceOffset; - } - - LPCTSTR GetPortName() const // return output port name - { - if(m_psd.hDevNames == NULL) - return NULL; - - LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); - return (LPCTSTR)lpDev + lpDev->wOutputOffset; - } - - HDC CreatePrinterDC() - { - return _AtlCreateDC(m_psd.hDevNames, m_psd.hDevMode); - } - - SIZE GetPaperSize() const - { - SIZE size; - size.cx = m_psd.ptPaperSize.x; - size.cy = m_psd.ptPaperSize.y; - return size; - } - - void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const - { - if(lpRectMargins != NULL) - *lpRectMargins = m_psd.rtMargin; - if(lpRectMinMargins != NULL) - *lpRectMinMargins = m_psd.rtMinMargin; - } - -// Operations - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT((m_psd.Flags & PSD_ENABLEPAGESETUPHOOK) != 0); - ATLASSERT((m_psd.Flags & PSD_ENABLEPAGEPAINTHOOK) != 0); - ATLASSERT(m_psd.lpfnPageSetupHook != NULL); // can still be a user hook - ATLASSERT(m_psd.lpfnPagePaintHook != NULL); // can still be a user hook - - if(m_psd.hwndOwner == NULL) // set only if not specified before - m_psd.hwndOwner = hWndParent; - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - BOOL bRet = ::PageSetupDlg(&m_psd); - - m_hWnd = NULL; - - return bRet ? IDOK : IDCANCEL; - } - -// Implementation - static UINT_PTR CALLBACK PaintHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - T* pT = (T*)hWnd; - UINT_PTR uRet = 0; - switch(uMsg) - { - case WM_PSD_PAGESETUPDLG: - uRet = pT->PreDrawPage(LOWORD(wParam), HIWORD(wParam), (LPPAGESETUPDLG)lParam); - break; - case WM_PSD_FULLPAGERECT: - case WM_PSD_MINMARGINRECT: - case WM_PSD_MARGINRECT: - case WM_PSD_GREEKTEXTRECT: - case WM_PSD_ENVSTAMPRECT: - case WM_PSD_YAFULLPAGERECT: - uRet = pT->OnDrawPage(uMsg, (HDC)wParam, (LPRECT)lParam); - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("CPageSetupDialogImpl::PaintHookProc - unknown message received\n")); - break; - } - return uRet; - } - -// Overridables - UINT_PTR PreDrawPage(WORD /*wPaper*/, WORD /*wFlags*/, LPPAGESETUPDLG /*pPSD*/) - { - // return 1 to prevent any more drawing - return 0; - } - - UINT_PTR OnDrawPage(UINT /*uMsg*/, HDC /*hDC*/, LPRECT /*lpRect*/) - { - return 0; // do the default - } -}; - -class CPageSetupDialog : public CPageSetupDialogImpl -{ -public: - CPageSetupDialog(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) - : CPageSetupDialogImpl(dwFlags, hWndParent) - { } - - // override PaintHookProc and references to handlers - static UINT_PTR CALLBACK PaintHookProc(HWND, UINT, WPARAM, LPARAM) - { - return 0; - } -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFindReplaceDialogImpl - Find/FindReplace modeless dialogs - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CFindReplaceDialogImpl : public CCommonDialogImplBase -{ -public: - enum { _cchFindReplaceBuffer = 128 }; - - FINDREPLACE m_fr; - TCHAR m_szFindWhat[_cchFindReplaceBuffer]; - TCHAR m_szReplaceWith[_cchFindReplaceBuffer]; - -// Constructors - CFindReplaceDialogImpl() - { - memset(&m_fr, 0, sizeof(m_fr)); - m_szFindWhat[0] = _T('\0'); - m_szReplaceWith[0] = _T('\0'); - - m_fr.lStructSize = sizeof(m_fr); - m_fr.Flags = FR_ENABLEHOOK; - m_fr.lpfnHook = (LPFRHOOKPROC)T::HookProc; - m_fr.lpstrFindWhat = (LPTSTR)m_szFindWhat; - m_fr.wFindWhatLen = _cchFindReplaceBuffer; - m_fr.lpstrReplaceWith = (LPTSTR)m_szReplaceWith; - m_fr.wReplaceWithLen = _cchFindReplaceBuffer; - } - - // Note: You must allocate the object on the heap. - // If you do not, you must override OnFinalMessage() - virtual void OnFinalMessage(HWND /*hWnd*/) - { - delete this; - } - - HWND Create(BOOL bFindDialogOnly, // TRUE for Find, FALSE for FindReplace - LPCTSTR lpszFindWhat, - LPCTSTR lpszReplaceWith = NULL, - DWORD dwFlags = FR_DOWN, - HWND hWndParent = NULL) - { - ATLASSERT((m_fr.Flags & FR_ENABLEHOOK) != 0); - ATLASSERT(m_fr.lpfnHook != NULL); - - m_fr.Flags |= dwFlags; - - if(hWndParent == NULL) - m_fr.hwndOwner = ::GetActiveWindow(); - else - m_fr.hwndOwner = hWndParent; - ATLASSERT(m_fr.hwndOwner != NULL); // must have an owner for modeless dialog - - if(lpszFindWhat != NULL) - SecureHelper::strncpy_x(m_szFindWhat, _countof(m_szFindWhat), lpszFindWhat, _TRUNCATE); - - if(lpszReplaceWith != NULL) - SecureHelper::strncpy_x(m_szReplaceWith, _countof(m_szReplaceWith), lpszReplaceWith, _TRUNCATE); - - ATLASSERT(m_hWnd == NULL); - ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); - - HWND hWnd = NULL; - if(bFindDialogOnly) - hWnd = ::FindText(&m_fr); - else - hWnd = ::ReplaceText(&m_fr); - - ATLASSERT(m_hWnd == hWnd); - return hWnd; - } - - static const UINT GetFindReplaceMsg() - { - static const UINT nMsgFindReplace = ::RegisterWindowMessage(FINDMSGSTRING); - return nMsgFindReplace; - } - // call while handling FINDMSGSTRING registered message - // to retreive the object - static T* PASCAL GetNotifier(LPARAM lParam) - { - ATLASSERT(lParam != NULL); - T* pDlg = (T*)(lParam - offsetof(T, m_fr)); - return pDlg; - } - -// Operations - // Helpers for parsing information after successful return - LPCTSTR GetFindString() const // get find string - { - return (LPCTSTR)m_fr.lpstrFindWhat; - } - - LPCTSTR GetReplaceString() const // get replacement string - { - return (LPCTSTR)m_fr.lpstrReplaceWith; - } - - BOOL SearchDown() const // TRUE if search down, FALSE is up - { - return ((m_fr.Flags & FR_DOWN) != 0) ? TRUE : FALSE; - } - - BOOL FindNext() const // TRUE if command is find next - { - return ((m_fr.Flags & FR_FINDNEXT) != 0) ? TRUE : FALSE; - } - - BOOL MatchCase() const // TRUE if matching case - { - return ((m_fr.Flags & FR_MATCHCASE) != 0) ? TRUE : FALSE; - } - - BOOL MatchWholeWord() const // TRUE if matching whole words only - { - return ((m_fr.Flags & FR_WHOLEWORD) != 0) ? TRUE : FALSE; - } - - BOOL ReplaceCurrent() const // TRUE if replacing current string - { - return ((m_fr. Flags & FR_REPLACE) != 0) ? TRUE : FALSE; - } - - BOOL ReplaceAll() const // TRUE if replacing all occurrences - { - return ((m_fr.Flags & FR_REPLACEALL) != 0) ? TRUE : FALSE; - } - - BOOL IsTerminating() const // TRUE if terminating dialog - { - return ((m_fr.Flags & FR_DIALOGTERM) != 0) ? TRUE : FALSE ; - } -}; - -class CFindReplaceDialog : public CFindReplaceDialogImpl -{ -public: - DECLARE_EMPTY_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -#if (_ATL_VER >= 0x800) -typedef ATL::_DialogSplitHelper::DLGTEMPLATEEX DLGTEMPLATEEX; -typedef ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX DLGITEMTEMPLATEEX; -#else // (_ATL_VER >= 0x800) -typedef ATL::_DialogSizeHelper::_ATL_DLGTEMPLATEEX DLGTEMPLATEEX; -#pragma pack(push, 4) -struct DLGITEMTEMPLATEEX -{ - DWORD helpID; - DWORD exStyle; - DWORD style; - short x; - short y; - short cx; - short cy; - WORD id; -}; -#pragma pack(pop) -#endif // (_ATL_VER >= 0x800) - - -/////////////////////////////////////////////////////////////////////////////// -// CMemDlgTemplate - in-memory dialog template - DLGTEMPLATE or DLGTEMPLATEEX - -class CMemDlgTemplate -{ -public: - enum StdCtrlType - { - CTRL_BUTTON = 0x0080, - CTRL_EDIT = 0x0081, - CTRL_STATIC = 0x0082, - CTRL_LISTBOX = 0x0083, - CTRL_SCROLLBAR = 0x0084, - CTRL_COMBOBOX = 0x0085 - }; - - CMemDlgTemplate() : m_pData(NULL), m_pPtr(NULL), m_cAllocated(0) - { } - - ~CMemDlgTemplate() - { - Reset(); - } - - bool IsValid() const - { - return (m_pData != NULL); - } - - bool IsTemplateEx() const - { - return (IsValid() && ((DLGTEMPLATEEX*)m_pData)->signature == 0xFFFF); - } - - LPDLGTEMPLATE GetTemplatePtr() - { - return reinterpret_cast(m_pData); - } - - DLGTEMPLATEEX* GetTemplateExPtr() - { - return reinterpret_cast(m_pData); - } - - void Reset() - { - if (IsValid()) - ATLVERIFY(::GlobalFree(m_pData) == NULL); - - m_pData = NULL; - m_pPtr = NULL; - m_cAllocated = 0; - } - - void Create(bool bDlgEx, LPCTSTR lpszCaption, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle = 0, DWORD dwExStyle = 0, - LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, - ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) - { - // Should have DS_SETFONT style to set the dialog font name and size - if (lpstrFontName != NULL) - { - dwStyle |= DS_SETFONT; - } - else - { - dwStyle &= ~DS_SETFONT; - } - - if (bDlgEx) - { - DLGTEMPLATEEX dlg = {1, 0xFFFF, dwHelpID, dwExStyle, dwStyle, 0, nX, nY, nWidth, nHeight}; - AddData(&dlg, sizeof(dlg)); - } - else - { - DLGTEMPLATE dlg = {dwStyle, dwExStyle, 0, nX, nY, nWidth, nHeight}; - AddData(&dlg, sizeof(dlg)); - } - -#ifndef _WIN32_WCE - if (Menu.m_lpstr == NULL) - { - WORD menuData = 0; - AddData(&menuData, sizeof(WORD)); - } - else if (IS_INTRESOURCE(Menu.m_lpstr)) - { - WORD menuData[] = {0xFFFF, (WORD)Menu.m_lpstr}; - AddData(menuData, sizeof(menuData)); - } - else - { - AddString(Menu.m_lpstr); - } -#else // _WIN32_WCE - // Windows CE doesn't support the addition of menus to a dialog box - ATLASSERT(Menu.m_lpstr == NULL); - Menu.m_lpstr; // avoid level 4 warning - WORD menuData = 0; - AddData(&menuData, sizeof(WORD)); -#endif // _WIN32_WCE - - if (ClassName.m_lpstr == NULL) - { - WORD classData = 0; - AddData(&classData, sizeof(WORD)); - } - else if (IS_INTRESOURCE(ClassName.m_lpstr)) - { - WORD classData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; - AddData(classData, sizeof(classData)); - } - else - { - AddString(ClassName.m_lpstr); - } - - // Set dialog caption - AddString(lpszCaption); - - if (lpstrFontName != NULL) - { - AddData(&wFontSize, sizeof(wFontSize)); - - if (bDlgEx) - { - AddData(&wWeight, sizeof(wWeight)); - AddData(&bItalic, sizeof(bItalic)); - AddData(&bCharset, sizeof(bCharset)); - } - - AddString(lpstrFontName); - } - } - - void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle, DWORD dwExStyle, - ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) - { - ATLASSERT(IsValid()); - - // DWORD align data - m_pPtr = (LPBYTE)(DWORD_PTR)((DWORD)(DWORD_PTR)(m_pPtr + 3) & (~3)); - - if (IsTemplateEx()) - { - DLGTEMPLATEEX* dlg = (DLGTEMPLATEEX*)m_pData; - dlg->cDlgItems++; - - DLGITEMTEMPLATEEX item = {dwHelpID, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, nX, nY, nWidth, nHeight, wId}; - AddData(&item, sizeof(item)); - } - else - { - LPDLGTEMPLATE dlg = (LPDLGTEMPLATE)m_pData; - dlg->cdit++; - - DLGITEMTEMPLATE item = {ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, nX, nY, nWidth, nHeight, wId}; - AddData(&item, sizeof(item)); - } - - ATLASSERT(ClassName.m_lpstr != NULL); - if (IS_INTRESOURCE(ClassName.m_lpstr)) - { - WORD wData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; - AddData(wData, sizeof(wData)); - } - else - { - AddString(ClassName.m_lpstr); - } - - if (Text.m_lpstr == NULL) - { - WORD classData = 0; - AddData(&classData, sizeof(WORD)); - } - else if (IS_INTRESOURCE(Text.m_lpstr)) - { - WORD wData[] = {0xFFFF, (WORD)Text.m_lpstr}; - AddData(wData, sizeof(wData)); - } - else - { - AddString(Text.m_lpstr); - } - - AddData(&nCreationData, sizeof(nCreationData)); - - if ((nCreationData != 0)) - { - ATLASSERT(pCreationData != NULL); - AddData(pCreationData, nCreationData * sizeof(WORD)); - } - } - - void AddStdControl(StdCtrlType CtrlType, WORD wId, short nX, short nY, short nWidth, short nHeight, - DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) - { - AddControl(CtrlType, wId, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, Text, pCreationData, nCreationData, dwHelpID); - } - -protected: - void AddData(LPCVOID pData, size_t nData) - { - ATLASSERT(pData != NULL); - - const size_t ALLOCATION_INCREMENT = 1024; - - if (m_pData == NULL) - { - m_cAllocated = ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; - m_pPtr = m_pData = static_cast(::GlobalAlloc(GPTR, m_cAllocated)); - ATLASSERT(m_pData != NULL); - } - else if (((m_pPtr - m_pData) + nData) > m_cAllocated) - { - size_t ptrPos = (m_pPtr - m_pData); - m_cAllocated += ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; - m_pData = static_cast(::GlobalReAlloc(m_pData, m_cAllocated, 0)); - ATLASSERT(m_pData != NULL); - m_pPtr = m_pData + ptrPos; - } - - SecureHelper::memcpy_x(m_pPtr, m_cAllocated - (m_pPtr - m_pData), pData, nData); - - m_pPtr += nData; - } - - void AddString(LPCTSTR lpszStr) - { - if (lpszStr == NULL) - { - WCHAR szEmpty = 0; - AddData(&szEmpty, sizeof(szEmpty)); - } - else - { - USES_CONVERSION; - LPCWSTR lpstr = T2CW(lpszStr); - int nSize = lstrlenW(lpstr) + 1; - AddData(lpstr, nSize * sizeof(WCHAR)); - } - } - - LPBYTE m_pData; - LPBYTE m_pPtr; - SIZE_T m_cAllocated; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Dialog and control macros for indirect dialogs - -// for DLGTEMPLATE -#define BEGIN_DIALOG(x, y, width, height) \ - void DoInitTemplate() \ - { \ - bool bExTemplate = false; \ - short nX = x, nY = y, nWidth = width, nHeight = height; \ - LPCTSTR szCaption = NULL; \ - DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ - DWORD dwExStyle = 0; \ - LPCTSTR szFontName = NULL; \ - WORD wFontSize = 0; \ - WORD wWeight = 0; \ - BYTE bItalic = 0; \ - BYTE bCharset = 0; \ - DWORD dwHelpID = 0; \ - ATL::_U_STRINGorID Menu = 0U; \ - ATL::_U_STRINGorID ClassName = 0U; - -// for DLGTEMPLATEEX -#define BEGIN_DIALOG_EX(x, y, width, height, helpID) \ - void DoInitTemplate() \ - { \ - bool bExTemplate = true; \ - short nX = x, nY = y, nWidth = width, nHeight = height; \ - LPCTSTR szCaption = NULL; \ - DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ - DWORD dwExStyle = 0; \ - LPCTSTR szFontName = NULL; \ - WORD wFontSize = 0; \ - WORD wWeight = 0; \ - BYTE bItalic = 0; \ - BYTE bCharset = 0; \ - DWORD dwHelpID = helpID; \ - ATL::_U_STRINGorID Menu = 0U; \ - ATL::_U_STRINGorID ClassName = 0U; - -#define END_DIALOG() \ - m_Template.Create(bExTemplate, szCaption, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, szFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName, Menu); \ - }; - -#define DIALOG_CAPTION(caption) \ - szCaption = caption; -#define DIALOG_STYLE(style) \ - dwStyle = style; -#define DIALOG_EXSTYLE(exStyle) \ - dwExStyle = exStyle; -#define DIALOG_FONT(pointSize, typeFace) \ - wFontSize = pointSize; \ - szFontName = typeFace; -#define DIALOG_FONT_EX(pointsize, typeface, weight, italic, charset) \ - ATLASSERT(bExTemplate); \ - wFontSize = pointsize; \ - szFontName = typeface; \ - wWeight = weight; \ - bItalic = italic; \ - bCharset = charset; -#define DIALOG_MENU(menuName) \ - Menu = menuName; -#define DIALOG_CLASS(className) \ - ClassName = className; - -#define BEGIN_CONTROLS_MAP() \ - void DoInitControls() \ - { - -#define END_CONTROLS_MAP() \ - }; - - -#define CONTROL_LTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_LEFT | WS_GROUP, exStyle, text, NULL, 0); -#define CONTROL_CTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_CENTER | WS_GROUP, exStyle, text, NULL, 0); -#define CONTROL_RTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_RIGHT | WS_GROUP, exStyle, text, NULL, 0); -#define CONTROL_PUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_DEFPUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_DEFPUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#ifndef _WIN32_WCE -#define CONTROL_PUSHBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#endif // !_WIN32_WCE -#define CONTROL_STATE3(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_3STATE | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_AUTO3STATE(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTO3STATE | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_CHECKBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_CHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_AUTOCHECKBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTOCHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_RADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_RADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_AUTORADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTORADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#define CONTROL_COMBOBOX(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_COMBOBOX, (WORD)id, x, y, width, height, style | CBS_DROPDOWN | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_EDITTEXT(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_EDIT, (WORD)id, x, y, width, height, style | ES_LEFT | WS_BORDER | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_GROUPBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_GROUPBOX, exStyle, text, NULL, 0); -#define CONTROL_LISTBOX(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_LISTBOX, (WORD)id, x, y, width, height, style | LBS_NOTIFY | WS_BORDER, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_SCROLLBAR(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_SCROLLBAR, (WORD)id, x, y, width, height, style | SBS_HORZ, exStyle, (LPCTSTR)NULL, NULL, 0); -#define CONTROL_ICON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_ICON, exStyle, text, NULL, 0); -#define CONTROL_CONTROL(text, id, className, style, x, y, width, height, exStyle) \ - m_Template.AddControl(className, (WORD)id, x, y, width, height, style, exStyle, text, NULL, 0); - - -/////////////////////////////////////////////////////////////////////////////// -// CIndirectDialogImpl - dialogs with template in memory - -template > -class ATL_NO_VTABLE CIndirectDialogImpl : public TBase -{ -public: - enum { IDD = 0 }; // no dialog template resource - - TDlgTemplate m_Template; - - void CreateTemplate() - { - T* pT = static_cast(this); - pT->DoInitTemplate(); - pT->DoInitControls(); - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_hWnd == NULL); - - if (!m_Template.IsValid()) - CreateTemplate(); - -#if (_ATL_VER >= 0x0800) - // Allocate the thunk structure here, where we can fail gracefully. - BOOL result = m_thunk.Init(NULL, NULL); - if (result == FALSE) - { - SetLastError(ERROR_OUTOFMEMORY); - return -1; - } -#endif // (_ATL_VER >= 0x0800) - - ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); - -#ifdef _DEBUG - m_bModal = true; -#endif // _DEBUG - - return ::DialogBoxIndirectParam(ModuleHelper::GetResourceInstance(), m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); - } - - HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) - { - T* pT = static_cast(this); - ATLASSERT(pT->m_hWnd == NULL); - - if (!m_Template.IsValid()) - CreateTemplate(); - -#if (_ATL_VER >= 0x0800) - // Allocate the thunk structure here, where we can fail gracefully. - BOOL result = m_thunk.Init(NULL, NULL); - if (result == FALSE) - { - SetLastError(ERROR_OUTOFMEMORY); - return NULL; - } -#endif // (_ATL_VER >= 0x0800) - - ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); - -#ifdef _DEBUG - m_bModal = false; -#endif // _DEBUG - - HWND hWnd = ::CreateDialogIndirectParam(ModuleHelper::GetResourceInstance(), (LPCDLGTEMPLATE)m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); - ATLASSERT(m_hWnd == hWnd); - - return hWnd; - } - - // for CComControl - HWND Create(HWND hWndParent, RECT&, LPARAM dwInitParam = NULL) - { - return Create(hWndParent, dwInitParam); - } - - void DoInitTemplate() - { - ATLASSERT(FALSE); // MUST be defined in derived class - } - - void DoInitControls() - { - ATLASSERT(FALSE); // MUST be defined in derived class - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CPropertySheetWindow - client side for a property sheet - -class CPropertySheetWindow : public ATL::CWindow -{ -public: -// Constructors - CPropertySheetWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) - { } - - CPropertySheetWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - int GetPageCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HWND hWndTabCtrl = GetTabControl(); - ATLASSERT(hWndTabCtrl != NULL); - return (int)::SendMessage(hWndTabCtrl, TCM_GETITEMCOUNT, 0, 0L); - } - - HWND GetActivePage() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0L); - } - - int GetActiveIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - HWND hWndTabCtrl = GetTabControl(); - ATLASSERT(hWndTabCtrl != NULL); - return (int)::SendMessage(hWndTabCtrl, TCM_GETCURSEL, 0, 0L); - } - - BOOL SetActivePage(int nPageIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, nPageIndex, 0L); - } - - BOOL SetActivePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, 0, (LPARAM)hPage); - } - - BOOL SetActivePageByID(int nPageID) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSELID, 0, nPageID); - } - - void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid - ATLASSERT(lpszText != NULL); - ::SendMessage(m_hWnd, PSM_SETTITLE, nStyle, (LPARAM)lpszText); - } - - HWND GetTabControl() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, PSM_GETTABCONTROL, 0, 0L); - } - - void SetFinishText(LPCTSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETFINISHTEXT, 0, (LPARAM)lpszText); - } - - void SetWizardButtons(DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::PostMessage(m_hWnd, PSM_SETWIZBUTTONS, 0, dwFlags); - } - -// Operations - BOOL AddPage(HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); - } - - BOOL AddPage(LPCPROPSHEETPAGE pPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); - } - -#ifndef _WIN32_WCE - BOOL InsertPage(int nNewPageIndex, HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); - } - - BOOL InsertPage(int nNewPageIndex, LPCPROPSHEETPAGE pPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); - } - - BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); - } - - BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, LPCPROPSHEETPAGE pPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); - } -#endif // !_WIN32_WCE - - void RemovePage(int nPageIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_REMOVEPAGE, nPageIndex, 0L); - } - - void RemovePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hPage != NULL); - ::SendMessage(m_hWnd, PSM_REMOVEPAGE, 0, (LPARAM)hPage); - } - - BOOL PressButton(int nButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_PRESSBUTTON, nButton, 0L); - } - - BOOL Apply() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_APPLY, 0, 0L); - } - - void CancelToClose() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_CANCELTOCLOSE, 0, 0L); - } - - void SetModified(HWND hWndPage, BOOL bChanged = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(hWndPage)); - UINT uMsg = bChanged ? PSM_CHANGED : PSM_UNCHANGED; - ::SendMessage(m_hWnd, uMsg, (WPARAM)hWndPage, 0L); - } - - LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SendMessage(m_hWnd, PSM_QUERYSIBLINGS, wParam, lParam); - } - - void RebootSystem() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_REBOOTSYSTEM, 0, 0L); - } - - void RestartWindows() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_RESTARTWINDOWS, 0, 0L); - } - - BOOL IsDialogMessage(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_ISDIALOGMESSAGE, 0, (LPARAM)lpMsg); - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - int HwndToIndex(HWND hWnd) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_HWNDTOINDEX, (WPARAM)hWnd, 0L); - } - - HWND IndexToHwnd(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, PSM_INDEXTOHWND, nIndex, 0L); - } - - int PageToIndex(HPROPSHEETPAGE hPage) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_PAGETOINDEX, 0, (LPARAM)hPage); - } - - HPROPSHEETPAGE IndexToPage(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPROPSHEETPAGE)::SendMessage(m_hWnd, PSM_INDEXTOPAGE, nIndex, 0L); - } - - int IdToIndex(int nID) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_IDTOINDEX, 0, nID); - } - - int IndexToId(int nIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_INDEXTOID, nIndex, 0L); - } - - int GetResult() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PSM_GETRESULT, 0, 0L); - } - - BOOL RecalcPageSizes() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PSM_RECALCPAGESIZES, 0, 0L); - } - - void SetHeaderTitle(int nIndex, LPCTSTR lpstrHeaderTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETHEADERTITLE, nIndex, (LPARAM)lpstrHeaderTitle); - } - - void SetHeaderSubTitle(int nIndex, LPCTSTR lpstrHeaderSubTitle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETHEADERSUBTITLE, nIndex, (LPARAM)lpstrHeaderSubTitle); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Implementation - override to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CPropertySheetImpl - implements a property sheet - -template -class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > -{ -public: - PROPSHEETHEADER m_psh; - ATL::CSimpleArray m_arrPages; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - #ifndef PROPSHEET_LINK_SIZE - #define PROPSHEET_LINK_SIZE 128 - #endif // PROPSHEET_LINK_SIZE - TCHAR m_szLink[PROPSHEET_LINK_SIZE]; - static LPCTSTR m_pszTitle; - static LPCTSTR m_pszLink; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -// Construction/Destruction - CPropertySheetImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) - { - memset(&m_psh, 0, sizeof(PROPSHEETHEADER)); - m_psh.dwSize = sizeof(PROPSHEETHEADER); - m_psh.dwFlags = PSH_USECALLBACK; - m_psh.hInstance = ModuleHelper::GetResourceInstance(); - m_psh.phpage = NULL; // will be set later - m_psh.nPages = 0; // will be set later - m_psh.pszCaption = title.m_lpstr; - m_psh.nStartPage = uStartPage; - m_psh.hwndParent = hWndParent; // if NULL, will be set in DoModal/Create - m_psh.pfnCallback = T::PropSheetCallback; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - m_psh.dwFlags |= PSH_MAXIMIZE; - m_szLink[0] = 0; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - } - - ~CPropertySheetImpl() - { - if(m_arrPages.GetSize() > 0) // sheet never created, destroy all pages - { - for(int i = 0; i < m_arrPages.GetSize(); i++) - ::DestroyPropertySheetPage((HPROPSHEETPAGE)m_arrPages[i]); - } - } - -// Callback function and overrideables - static int CALLBACK PropSheetCallback(HWND hWnd, UINT uMsg, LPARAM lParam) - { - lParam; // avoid level 4 warning - int nRet = 0; - - if(uMsg == PSCB_INITIALIZED) - { - ATLASSERT(hWnd != NULL); - T* pT = (T*)ModuleHelper::ExtractCreateWndData(); - // subclass the sheet window - pT->SubclassWindow(hWnd); - // remove page handles array - pT->_CleanUpPages(); - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - m_pszTitle = pT->m_psh.pszCaption; - if(*pT->m_szLink != 0) - m_pszLink = pT->m_szLink; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - - pT->OnSheetInitialized(); - } -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific uMsg - else - { - switch(uMsg) - { - case PSCB_GETVERSION : - nRet = COMCTL32_VERSION; - break; - case PSCB_GETTITLE : - if(m_pszTitle != NULL) - { - lstrcpy((LPTSTR)lParam, m_pszTitle); - m_pszTitle = NULL; - } - break; - case PSCB_GETLINKTEXT: - if(m_pszLink != NULL) - { - lstrcpy((LPTSTR)lParam, m_pszLink); - m_pszLink = NULL; - } - break; - default: - break; - } - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - - return nRet; - } - - void OnSheetInitialized() - { - } - -// Create method - HWND Create(HWND hWndParent = NULL) - { - ATLASSERT(m_hWnd == NULL); - - m_psh.dwFlags |= PSH_MODELESS; - if(m_psh.hwndParent == NULL) - m_psh.hwndParent = hWndParent; - m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); - m_psh.nPages = m_arrPages.GetSize(); - - T* pT = static_cast(this); - ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); - - HWND hWnd = (HWND)::PropertySheet(&m_psh); - _CleanUpPages(); // ensure clean-up, required if call failed - - ATLASSERT(m_hWnd == hWnd); - - return hWnd; - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) - { - ATLASSERT(m_hWnd == NULL); - - m_psh.dwFlags &= ~PSH_MODELESS; - if(m_psh.hwndParent == NULL) - m_psh.hwndParent = hWndParent; - m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); - m_psh.nPages = m_arrPages.GetSize(); - - T* pT = static_cast(this); - ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); - - INT_PTR nRet = ::PropertySheet(&m_psh); - _CleanUpPages(); // ensure clean-up, required if call failed - - return nRet; - } - - // implementation helper - clean up pages array - void _CleanUpPages() - { - m_psh.nPages = 0; - m_psh.phpage = NULL; - m_arrPages.RemoveAll(); - } - -// Attributes (extended overrides of client class methods) -// These now can be called before the sheet is created -// Note: Calling these after the sheet is created gives unpredictable results - int GetPageCount() const - { - if(m_hWnd == NULL) // not created yet - return m_arrPages.GetSize(); - return TBase::GetPageCount(); - } - - int GetActiveIndex() const - { - if(m_hWnd == NULL) // not created yet - return m_psh.nStartPage; - return TBase::GetActiveIndex(); - } - - HPROPSHEETPAGE GetPage(int nPageIndex) const - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - return (HPROPSHEETPAGE)m_arrPages[nPageIndex]; - } - - int GetPageIndex(HPROPSHEETPAGE hPage) const - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - return m_arrPages.Find((HPROPSHEETPAGE&)hPage); - } - - BOOL SetActivePage(int nPageIndex) - { - if(m_hWnd == NULL) // not created yet - { - ATLASSERT(nPageIndex >= 0 && nPageIndex < m_arrPages.GetSize()); - m_psh.nStartPage = nPageIndex; - return TRUE; - } - return TBase::SetActivePage(nPageIndex); - } - - BOOL SetActivePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(hPage != NULL); - if (m_hWnd == NULL) // not created yet - { - int nPageIndex = GetPageIndex(hPage); - if(nPageIndex == -1) - return FALSE; - - return SetActivePage(nPageIndex); - } - return TBase::SetActivePage(hPage); - - } - - void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) - { - ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid - ATLASSERT(lpszText != NULL); - - if(m_hWnd == NULL) - { - // set internal state - m_psh.pszCaption = lpszText; // must exist until sheet is created - m_psh.dwFlags &= ~PSH_PROPTITLE; - m_psh.dwFlags |= nStyle; - } - else - { - // set external state - TBase::SetTitle(lpszText, nStyle); - } - } - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific Link field - void SetLinkText(LPCTSTR lpszText) - { - ATLASSERT(lpszText != NULL); - ATLASSERT(lstrlen(lpszText) < PROPSHEET_LINK_SIZE); - lstrcpy(m_szLink, lpszText); - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - - void SetWizardMode() - { - m_psh.dwFlags |= PSH_WIZARD; - } - - void EnableHelp() - { - m_psh.dwFlags |= PSH_HASHELP; - } - -// Operations - BOOL AddPage(HPROPSHEETPAGE hPage) - { - ATLASSERT(hPage != NULL); - BOOL bRet = FALSE; - if(m_hWnd != NULL) - bRet = TBase::AddPage(hPage); - else // sheet not created yet, use internal data - bRet = m_arrPages.Add((HPROPSHEETPAGE&)hPage); - return bRet; - } - - BOOL AddPage(LPCPROPSHEETPAGE pPage) - { - ATLASSERT(pPage != NULL); - HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); - if(hPage == NULL) - return FALSE; - BOOL bRet = AddPage(hPage); - if(!bRet) - ::DestroyPropertySheetPage(hPage); - return bRet; - } - - BOOL RemovePage(HPROPSHEETPAGE hPage) - { - ATLASSERT(hPage != NULL); - if (m_hWnd == NULL) // not created yet - { - int nPage = GetPageIndex(hPage); - if(nPage == -1) - return FALSE; - return RemovePage(nPage); - } - TBase::RemovePage(hPage); - return TRUE; - - } - - BOOL RemovePage(int nPageIndex) - { - BOOL bRet = TRUE; - if(m_hWnd != NULL) - TBase::RemovePage(nPageIndex); - else // sheet not created yet, use internal data - bRet = m_arrPages.RemoveAt(nPageIndex); - return bRet; - } - -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - void SetHeader(LPCTSTR szbmHeader) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= (PSH_HEADER | PSH_WIZARD97); - m_psh.pszbmHeader = szbmHeader; - } - - void SetHeader(HBITMAP hbmHeader) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= (PSH_HEADER | PSH_USEHBMHEADER | PSH_WIZARD97); - m_psh.hbmHeader = hbmHeader; - } - - void SetWatermark(LPCTSTR szbmWatermark, HPALETTE hplWatermark = NULL) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= PSH_WATERMARK | PSH_WIZARD97; - m_psh.pszbmWatermark = szbmWatermark; - - if (hplWatermark != NULL) - { - m_psh.dwFlags |= PSH_USEHPLWATERMARK; - m_psh.hplWatermark = hplWatermark; - } - } - - void SetWatermark(HBITMAP hbmWatermark, HPALETTE hplWatermark = NULL) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - - m_psh.dwFlags &= ~PSH_WIZARD; - m_psh.dwFlags |= (PSH_WATERMARK | PSH_USEHBMWATERMARK | PSH_WIZARD97); - m_psh.hbmWatermark = hbmWatermark; - - if (hplWatermark != NULL) - { - m_psh.dwFlags |= PSH_USEHPLWATERMARK; - m_psh.hplWatermark = hplWatermark; - } - } - - void StretchWatermark(bool bStretchWatermark) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - if (bStretchWatermark) - m_psh.dwFlags |= PSH_STRETCHWATERMARK; - else - m_psh.dwFlags &= ~PSH_STRETCHWATERMARK; - } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -// Message map and handlers - BEGIN_MSG_MAP(CPropertySheetImpl) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand) - END_MSG_MAP() - - LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) && - ((m_psh.dwFlags & PSH_MODELESS) != 0) && (GetActivePage() == NULL)) - DestroyWindow(); - return lRet; - } - - LRESULT OnSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(((m_psh.dwFlags & PSH_MODELESS) == PSH_MODELESS) && ((wParam & 0xFFF0) == SC_CLOSE)) - SendMessage(WM_CLOSE); - else - bHandled = FALSE; - return 0; - } -}; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC static pointers -template < class T, class TBase > -LPCWSTR CPropertySheetImpl::m_pszTitle = NULL; -template < class T, class TBase> -LPCWSTR CPropertySheetImpl::m_pszLink = NULL; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -// for non-customized sheets -class CPropertySheet : public CPropertySheetImpl -{ -public: - CPropertySheet(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) - : CPropertySheetImpl(title, uStartPage, hWndParent) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPropertyPageWindow - client side for a property page - -class CPropertyPageWindow : public ATL::CWindow -{ -public: -// Constructors - CPropertyPageWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) - { } - - CPropertyPageWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - CPropertySheetWindow GetPropertySheet() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CPropertySheetWindow(GetParent()); - } - -// Operations - BOOL Apply() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - return GetPropertySheet().Apply(); - } - - void CancelToClose() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().CancelToClose(); - } - - void SetModified(BOOL bChanged = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().SetModified(m_hWnd, bChanged); - } - - LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - return GetPropertySheet().QuerySiblings(wParam, lParam); - } - - void RebootSystem() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().RebootSystem(); - } - - void RestartWindows() - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().RestartWindows(); - } - - void SetWizardButtons(DWORD dwFlags) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetPropertySheet().SetWizardButtons(dwFlags); - } - -// Implementation - overrides to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CPropertyPageImpl - implements a property page - -template -class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > -{ -public: - PROPSHEETPAGE m_psp; - - operator PROPSHEETPAGE*() { return &m_psp; } - -// Construction - CPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) - { - // initialize PROPSHEETPAGE struct - memset(&m_psp, 0, sizeof(PROPSHEETPAGE)); - m_psp.dwSize = sizeof(PROPSHEETPAGE); - m_psp.dwFlags = PSP_USECALLBACK; - m_psp.hInstance = ModuleHelper::GetResourceInstance(); - T* pT = static_cast(this); - m_psp.pszTemplate = MAKEINTRESOURCE(pT->IDD); - m_psp.pfnDlgProc = (DLGPROC)T::StartDialogProc; - m_psp.pfnCallback = T::PropPageCallback; - m_psp.lParam = (LPARAM)pT; - - if(title.m_lpstr != NULL) - SetTitle(title); - } - -// Callback function and overrideables - static UINT CALLBACK PropPageCallback(HWND hWnd, UINT uMsg, LPPROPSHEETPAGE ppsp) - { - hWnd; // avoid level 4 warning - ATLASSERT(hWnd == NULL); - T* pT = (T*)ppsp->lParam; - UINT uRet = 0; - - switch(uMsg) - { - case PSPCB_CREATE: - { - ATL::CDialogImplBaseT< TBase >* pPage = (ATL::CDialogImplBaseT< TBase >*)pT; - ModuleHelper::AddCreateWndData(&pPage->m_thunk.cd, pPage); - uRet = pT->OnPageCreate() ? 1 : 0; - } - break; -#if (_WIN32_IE >= 0x0500) - case PSPCB_ADDREF: - pT->OnPageAddRef(); - break; -#endif // (_WIN32_IE >= 0x0500) - case PSPCB_RELEASE: - pT->OnPageRelease(); - break; - default: - break; - } - - return uRet; - } - - bool OnPageCreate() - { - return true; // true - allow page to be created, false - prevent creation - } - -#if (_WIN32_IE >= 0x0500) - void OnPageAddRef() - { - } -#endif // (_WIN32_IE >= 0x0500) - - void OnPageRelease() - { - } - -// Create method - HPROPSHEETPAGE Create() - { - return ::CreatePropertySheetPage(&m_psp); - } - -// Attributes - void SetTitle(ATL::_U_STRINGorID title) - { - m_psp.pszTitle = title.m_lpstr; - m_psp.dwFlags |= PSP_USETITLE; - } - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - void SetHeaderTitle(LPCTSTR lpstrHeaderTitle) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psp.dwFlags |= PSP_USEHEADERTITLE; - m_psp.pszHeaderTitle = lpstrHeaderTitle; - } - - void SetHeaderSubTitle(LPCTSTR lpstrHeaderSubTitle) - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psp.dwFlags |= PSP_USEHEADERSUBTITLE; - m_psp.pszHeaderSubTitle = lpstrHeaderSubTitle; - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Operations - void EnableHelp() - { - m_psp.dwFlags |= PSP_HASHELP; - } - -// Message map and handlers - BEGIN_MSG_MAP(CPropertyPageImpl) - MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - END_MSG_MAP() - - // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification - // handlers that return direct values without any restrictions - LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { -#ifndef _WIN32_WCE - // This notification is sometimes received on Windows CE after the window is already destroyed - ATLASSERT(::IsWindow(m_hWnd)); -#endif - NMHDR* pNMHDR = (NMHDR*)lParam; - - // don't handle messages not from the page/sheet itself - if(pNMHDR->hwndFrom != m_hWnd && pNMHDR->hwndFrom != ::GetParent(m_hWnd)) - { - bHandled = FALSE; - return 1; - } -#ifdef _WIN32_WCE - ATLASSERT(::IsWindow(m_hWnd)); -#endif - - T* pT = static_cast(this); - LRESULT lResult = 0; - switch(pNMHDR->code) - { -#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - case PSN_SETACTIVE: - lResult = pT->OnSetActive(); - break; - case PSN_KILLACTIVE: - lResult = pT->OnKillActive(); - break; - case PSN_APPLY: - lResult = pT->OnApply(); - break; - case PSN_RESET: - pT->OnReset(); - break; - case PSN_QUERYCANCEL: - lResult = pT->OnQueryCancel(); - break; - case PSN_WIZNEXT: - lResult = pT->OnWizardNext(); - break; - case PSN_WIZBACK: - lResult = pT->OnWizardBack(); - break; - case PSN_WIZFINISH: - lResult = pT->OnWizardFinish(); - break; - case PSN_HELP: - pT->OnHelp(); - break; -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - case PSN_GETOBJECT: - if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) - bHandled = FALSE; - break; -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - case PSN_TRANSLATEACCELERATOR: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam); - } - break; - case PSN_QUERYINITIALFOCUS: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); - } - break; -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - case PSN_SETACTIVE: - lResult = pT->OnSetActive() ? 0 : -1; - break; - case PSN_KILLACTIVE: - lResult = !pT->OnKillActive(); - break; - case PSN_APPLY: - lResult = pT->OnApply() ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE; - break; - case PSN_RESET: - pT->OnReset(); - break; - case PSN_QUERYCANCEL: - lResult = !pT->OnQueryCancel(); - break; - case PSN_WIZNEXT: - lResult = pT->OnWizardNext(); - break; - case PSN_WIZBACK: - lResult = pT->OnWizardBack(); - break; - case PSN_WIZFINISH: - lResult = !pT->OnWizardFinish(); - break; - case PSN_HELP: - pT->OnHelp(); - break; -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - case PSN_GETOBJECT: - if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) - bHandled = FALSE; - break; -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - case PSN_TRANSLATEACCELERATOR: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; - } - break; - case PSN_QUERYINITIALFOCUS: - { - LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; - lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); - } - break; -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - default: - bHandled = FALSE; // not handled - } - - return lResult; - } - -// Overridables - // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification - // handlers that return direct values without any restrictions -#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - int OnSetActive() - { - // 0 = allow activate - // -1 = go back that was active - // page ID = jump to page - return 0; - } - - BOOL OnKillActive() - { - // FALSE = allow deactivate - // TRUE = prevent deactivation - return FALSE; - } - - int OnApply() - { - // PSNRET_NOERROR = apply OK - // PSNRET_INVALID = apply not OK, return to this page - // PSNRET_INVALID_NOCHANGEPAGE = apply not OK, don't change focus - return PSNRET_NOERROR; - } - - void OnReset() - { - } - - BOOL OnQueryCancel() - { - // FALSE = allow cancel - // TRUE = prevent cancel - return FALSE; - } - - int OnWizardBack() - { - // 0 = goto previous page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - int OnWizardNext() - { - // 0 = goto next page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - INT_PTR OnWizardFinish() - { - // FALSE = allow finish - // TRUE = prevent finish - // HWND = prevent finish and set focus to HWND (CommCtrl 5.80 only) - return FALSE; - } - - void OnHelp() - { - } - -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) - { - return FALSE; // not processed - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - int OnTranslateAccelerator(LPMSG /*lpMsg*/) - { - // PSNRET_NOERROR - message not handled - // PSNRET_MESSAGEHANDLED - message handled - return PSNRET_NOERROR; - } - - HWND OnQueryInitialFocus(HWND /*hWndFocus*/) - { - // NULL = set focus to default control - // HWND = set focus to HWND - return NULL; - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - BOOL OnSetActive() - { - return TRUE; - } - - BOOL OnKillActive() - { - return TRUE; - } - - BOOL OnApply() - { - return TRUE; - } - - void OnReset() - { - } - - BOOL OnQueryCancel() - { - return TRUE; // ok to cancel - } - - int OnWizardBack() - { - // 0 = goto previous page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - int OnWizardNext() - { - // 0 = goto next page - // -1 = prevent page change - // >0 = jump to page by dlg ID - return 0; - } - - BOOL OnWizardFinish() - { - return TRUE; - } - - void OnHelp() - { - } - -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) - BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) - { - return FALSE; // not processed - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - BOOL OnTranslateAccelerator(LPMSG /*lpMsg*/) - { - return FALSE; // not translated - } - - HWND OnQueryInitialFocus(HWND /*hWndFocus*/) - { - return NULL; // default - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE - -#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS -}; - -// for non-customized pages -template -class CPropertyPage : public CPropertyPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - -/////////////////////////////////////////////////////////////////////////////// -// CAxPropertyPageImpl - property page that hosts ActiveX controls - -#ifndef _ATL_NO_HOSTING - -// Note: You must #include to use these classes - -template -class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > -{ -public: -// Data members - HGLOBAL m_hInitData; - HGLOBAL m_hDlgRes; - HGLOBAL m_hDlgResSplit; - -// Constructor/destructor - CAxPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : - CPropertyPageImpl< T, TBase >(title), - m_hInitData(NULL), m_hDlgRes(NULL), m_hDlgResSplit(NULL) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - - // initialize ActiveX hosting and modify dialog template - ATL::AtlAxWinInit(); - - HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); - LPCTSTR lpTemplateName = MAKEINTRESOURCE(pT->IDD); - HRSRC hDlg = ::FindResource(hInstance, lpTemplateName, (LPTSTR)RT_DIALOG); - if(hDlg != NULL) - { - HRSRC hDlgInit = ::FindResource(hInstance, lpTemplateName, (LPTSTR)_ATL_RT_DLGINIT); - - BYTE* pInitData = NULL; - if(hDlgInit != NULL) - { - m_hInitData = ::LoadResource(hInstance, hDlgInit); - pInitData = (BYTE*)::LockResource(m_hInitData); - } - - m_hDlgRes = ::LoadResource(hInstance, hDlg); - DLGTEMPLATE* pDlg = (DLGTEMPLATE*)::LockResource(m_hDlgRes); - LPCDLGTEMPLATE lpDialogTemplate = ATL::_DialogSplitHelper::SplitDialogTemplate(pDlg, pInitData); - if(lpDialogTemplate != pDlg) - m_hDlgResSplit = GlobalHandle(lpDialogTemplate); - - // set up property page to use in-memory dialog template - if(lpDialogTemplate != NULL) - { - m_psp.dwFlags |= PSP_DLGINDIRECT; - m_psp.pResource = lpDialogTemplate; - } - else - { - ATLASSERT(FALSE && _T("CAxPropertyPageImpl - ActiveX initializtion failed!")); - } - } - else - { - ATLASSERT(FALSE && _T("CAxPropertyPageImpl - Cannot find dialog template!")); - } - } - - ~CAxPropertyPageImpl() - { - if(m_hInitData != NULL) - { - UnlockResource(m_hInitData); - FreeResource(m_hInitData); - } - if(m_hDlgRes != NULL) - { - UnlockResource(m_hDlgRes); - FreeResource(m_hDlgRes); - } - if(m_hDlgResSplit != NULL) - { - ::GlobalFree(m_hDlgResSplit); - } - } - -// Methods - // call this one to handle keyboard message for ActiveX controls - BOOL PreTranslateMessage(LPMSG pMsg) - { - if ((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) && - (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST)) - return FALSE; - // find a direct child of the dialog from the window that has focus - HWND hWndCtl = ::GetFocus(); - if (IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd) - { - do - { - hWndCtl = ::GetParent(hWndCtl); - } - while (::GetParent(hWndCtl) != m_hWnd); - } - // give controls a chance to translate this message - return (BOOL)::SendMessage(hWndCtl, WM_FORWARDMSG, 0, (LPARAM)pMsg); - } - -// Overridables -#if (_WIN32_IE >= 0x0500) - // new default implementation for ActiveX hosting pages -#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - int OnTranslateAccelerator(LPMSG lpMsg) - { - T* pT = static_cast(this); - return (pT->PreTranslateMessage(lpMsg) != FALSE) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; - } -#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS - BOOL OnTranslateAccelerator(LPMSG lpMsg) - { - T* pT = static_cast(this); - return pT->PreTranslateMessage(lpMsg); - } -#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS -#endif // (_WIN32_IE >= 0x0500) - -// Support for new stuff in ATL7 -#if (_ATL_VER >= 0x0700) - int GetIDD() - { - return( static_cast(this)->IDD ); - } - - virtual DLGPROC GetDialogProc() - { - return DialogProc; - } - - static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - CAxPropertyPageImpl< T, TBase >* pThis = (CAxPropertyPageImpl< T, TBase >*)hWnd; - if (uMsg == WM_INITDIALOG) - { - HRESULT hr; - if (FAILED(hr = pThis->CreateActiveXControls(pThis->GetIDD()))) - { - ATLASSERT(FALSE); - return FALSE; - } - } - return CPropertyPageImpl< T, TBase >::DialogProc(hWnd, uMsg, wParam, lParam); - } - -// ActiveX controls creation - virtual HRESULT CreateActiveXControls(UINT nID) - { - // Load dialog template and InitData - HRSRC hDlgInit = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)_ATL_RT_DLGINIT); - BYTE* pInitData = NULL; - HGLOBAL hData = NULL; - HRESULT hr = S_OK; - if (hDlgInit != NULL) - { - hData = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlgInit); - if (hData != NULL) - pInitData = (BYTE*) ::LockResource(hData); - } - - HRSRC hDlg = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)RT_DIALOG); - if (hDlg != NULL) - { - HGLOBAL hResource = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlg); - DLGTEMPLATE* pDlg = NULL; - if (hResource != NULL) - { - pDlg = (DLGTEMPLATE*) ::LockResource(hResource); - if (pDlg != NULL) - { - // Get first control on the template - BOOL bDialogEx = ATL::_DialogSplitHelper::IsDialogEx(pDlg); - WORD nItems = ATL::_DialogSplitHelper::DlgTemplateItemCount(pDlg); - - // Get first control on the dialog - DLGITEMTEMPLATE* pItem = ATL::_DialogSplitHelper::FindFirstDlgItem(pDlg); - HWND hWndPrev = GetWindow(GW_CHILD); - - // Create all ActiveX cotnrols in the dialog template and place them in the correct tab order (z-order) - for (WORD nItem = 0; nItem < nItems; nItem++) - { - DWORD wID = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : pItem->id; - if (ATL::_DialogSplitHelper::IsActiveXControl(pItem, bDialogEx)) - { - BYTE* pData = NULL; - DWORD dwLen = ATL::_DialogSplitHelper::FindCreateData(wID, pInitData, &pData); - ATL::CComPtr spStream; - if (dwLen != 0) - { - HGLOBAL h = GlobalAlloc(GHND, dwLen); - if (h != NULL) - { - BYTE* pBytes = (BYTE*) GlobalLock(h); - BYTE* pSource = pData; - SecureHelper::memcpy_x(pBytes, dwLen, pSource, dwLen); - GlobalUnlock(h); - CreateStreamOnHGlobal(h, TRUE, &spStream); - } - else - { - hr = E_OUTOFMEMORY; - break; - } - } - - ATL::CComBSTR bstrLicKey; - hr = ATL::_DialogSplitHelper::ParseInitData(spStream, &bstrLicKey.m_str); - if (SUCCEEDED(hr)) - { - ATL::CAxWindow2 wnd; - // Get control caption. - LPWSTR pszClassName = - bDialogEx ? - (LPWSTR)(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem) + 1) : - (LPWSTR)(pItem + 1); - // Get control rect. - RECT rect; - rect.left = - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->x : - pItem->x; - rect.top = - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->y : - pItem->y; - rect.right = rect.left + - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cx : - pItem->cx); - rect.bottom = rect.top + - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cy : - pItem->cy); - - // Convert from dialog units to screen units - MapDialogRect(&rect); - - // Create AxWindow with a NULL caption. - wnd.Create(m_hWnd, - &rect, - NULL, - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->style : - pItem->style) | WS_TABSTOP, - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->exStyle : - 0, - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : - pItem->id, - NULL); - - if (wnd != NULL) - { -#ifndef _WIN32_WCE - // Set the Help ID - if (bDialogEx && ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID != 0) - wnd.SetWindowContextHelpId(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID); -#endif // !_WIN32_WCE - // Try to create the ActiveX control. - hr = wnd.CreateControlLic(pszClassName, spStream, NULL, bstrLicKey); - if (FAILED(hr)) - break; - // Set the correct tab position. - if (nItem == 0) - hWndPrev = HWND_TOP; - wnd.SetWindowPos(hWndPrev, 0,0,0,0,SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); - hWndPrev = wnd; - } - else - { - hr = ATL::AtlHresultFromLastError(); - } - } - } - else - { - if (nItem != 0) - hWndPrev = ::GetWindow(hWndPrev, GW_HWNDNEXT); - } - pItem = ATL::_DialogSplitHelper::FindNextDlgItem(pItem, bDialogEx); - } - } - else - hr = ATL::AtlHresultFromLastError(); - } - else - hr = ATL::AtlHresultFromLastError(); - } - return hr; - } - -// Event handling support - HRESULT AdviseSinkMap(bool bAdvise) - { - if(!bAdvise && m_hWnd == NULL) - { - // window is gone, controls are already unadvised - ATLTRACE2(atlTraceUI, 0, _T("CAxPropertyPageImpl::AdviseSinkMap called after the window was destroyed\n")); - return S_OK; - } - HRESULT hRet = E_NOTIMPL; - __if_exists(T::_GetSinkMapFinder) - { - T* pT = static_cast(this); - hRet = AtlAdviseSinkMap(pT, bAdvise); - } - return hRet; - } - -// Message map and handlers - typedef CPropertyPageImpl< T, TBase> _baseClass; - BEGIN_MSG_MAP(CAxPropertyPageImpl) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - // initialize controls in dialog with DLGINIT resource section - ExecuteDlgInit(static_cast(this)->IDD); - AdviseSinkMap(true); - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - AdviseSinkMap(false); - bHandled = FALSE; - return 1; - } -#endif // (_ATL_VER >= 0x0700) -}; - -// for non-customized pages -template -class CAxPropertyPage : public CAxPropertyPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CAxPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl(title) - { } - -#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) - // not empty so we handle accelerators/create controls - BEGIN_MSG_MAP(CAxPropertyPage) - CHAIN_MSG_MAP(CAxPropertyPageImpl >) - END_MSG_MAP() -#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) - DECLARE_EMPTY_MSG_MAP() -#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) -}; - -#endif // _ATL_NO_HOSTING - - -/////////////////////////////////////////////////////////////////////////////// -// Wizard97 Support - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Sample wizard dialog resources: -// -// IDD_WIZ97_INTERIOR_BLANK DIALOG 0, 0, 317, 143 -// STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -// CAPTION "Wizard97 Property Page - Interior" -// FONT 8, "MS Shell Dlg" -// BEGIN -// END -// -// IDD_WIZ97_EXTERIOR_BLANK DIALOGEX 0, 0, 317, 193 -// STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -// CAPTION "Wizard97 Property Page - Welcome/Complete" -// FONT 8, "MS Shell Dlg", 0, 0, 0x0 -// BEGIN -// LTEXT "Welcome to the X Wizard",IDC_WIZ97_EXTERIOR_TITLE,115,8, -// 195,24 -// LTEXT "Wizard Explanation\r\n(The height of the static text should be in multiples of 8 dlus)", -// IDC_STATIC,115,40,195,16 -// LTEXT "h",IDC_WIZ97_BULLET1,118,64,8,8 -// LTEXT "List Item 1 (the h is turned into a bullet)",IDC_STATIC, -// 127,63,122,8 -// LTEXT "h",IDC_WIZ97_BULLET2,118,79,8,8 -// LTEXT "List Item 2. Keep 7 dlus between paragraphs",IDC_STATIC, -// 127,78,33,8 -// CONTROL "&Do not show this Welcome page again", -// IDC_WIZ97_WELCOME_NOTAGAIN,"Button",BS_AUTOCHECKBOX | -// WS_TABSTOP,115,169,138,10 -// END -// -// GUIDELINES DESIGNINFO -// BEGIN -// IDD_WIZ97_INTERIOR_BLANK, DIALOG -// BEGIN -// LEFTMARGIN, 7 -// RIGHTMARGIN, 310 -// VERTGUIDE, 21 -// VERTGUIDE, 31 -// VERTGUIDE, 286 -// VERTGUIDE, 296 -// TOPMARGIN, 7 -// BOTTOMMARGIN, 136 -// HORZGUIDE, 8 -// END -// -// IDD_WIZ97_EXTERIOR_BLANK, DIALOG -// BEGIN -// RIGHTMARGIN, 310 -// VERTGUIDE, 115 -// VERTGUIDE, 118 -// VERTGUIDE, 127 -// TOPMARGIN, 7 -// BOTTOMMARGIN, 186 -// HORZGUIDE, 8 -// HORZGUIDE, 32 -// HORZGUIDE, 40 -// HORZGUIDE, 169 -// END -// END - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97SheetWindow - client side for a Wizard 97 style wizard sheet - -class CWizard97SheetWindow : public CPropertySheetWindow -{ -public: -// Constructors - CWizard97SheetWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) - { } - - CWizard97SheetWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations - HFONT GetExteriorPageTitleFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HFONT)::SendMessage(m_hWnd, GetMessage_GetExteriorPageTitleFont(), 0, 0L); - } - - HFONT GetBulletFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HFONT)::SendMessage(m_hWnd, GetMessage_GetBulletFont(), 0, 0L); - } - -// Helpers - static UINT GetMessage_GetExteriorPageTitleFont() - { - static UINT uGetExteriorPageTitleFont = 0; - if(uGetExteriorPageTitleFont == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont().\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uGetExteriorPageTitleFont == 0) - uGetExteriorPageTitleFont = ::RegisterWindowMessage(_T("GetExteriorPageTitleFont_531AF056-B8BE-4c4c-B786-AC608DF0DF12")); - - lock.Unlock(); - } - ATLASSERT(uGetExteriorPageTitleFont != 0); - return uGetExteriorPageTitleFont; - } - - static UINT GetMessage_GetBulletFont() - { - static UINT uGetBulletFont = 0; - if(uGetBulletFont == 0) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetBulletFont().\n")); - ATLASSERT(FALSE); - return 0; - } - - if(uGetBulletFont == 0) - uGetBulletFont = ::RegisterWindowMessage(_T("GetBulletFont_AD347D08-8F65-45ef-982E-6352E8218AD5")); - - lock.Unlock(); - } - ATLASSERT(uGetBulletFont != 0); - return uGetBulletFont; - } - -// Implementation - override to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97SheetImpl - implements a Wizard 97 style wizard sheet - -template -class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97SheetImpl< T, TBase > thisClass; - typedef CPropertySheetImpl< T, TBase > baseClass; - -// Member variables - CFont m_fontExteriorPageTitle; // Welcome and Completion page title font - CFont m_fontBullet; // Bullet font (used on static text 'h' to produce a small bullet) - bool m_bReceivedFirstSizeMessage; - -public: - CWizard97SheetImpl(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : - baseClass(title, uStartPage, hWndParent), - m_bReceivedFirstSizeMessage(false) - { - m_psh.dwFlags &= ~(PSH_NOCONTEXTHELP); - m_psh.dwFlags &= ~(PSH_WIZARD | PSH_WIZARD_LITE); - - m_psh.dwFlags |= (PSH_HASHELP | PSH_WIZARDCONTEXTHELP); - m_psh.dwFlags |= PSH_WIZARD97; - - baseClass::SetHeader(headerBitmap.m_lpstr); - baseClass::SetWatermark(watermarkBitmap.m_lpstr); - } - -// Overrides from base class - void OnSheetInitialized() - { - T* pT = static_cast(this); - pT->_InitializeFonts(); - - // We'd like to center the wizard here, but its too early. - // Instead, we'll do CenterWindow upon our first WM_SIZE message - } - -// Initialization - void _InitializeFonts() - { - // Setup the Title and Bullet Font - // (Property pages can send the "get external page title font" and "get bullet font" messages) - // The derived class needs to do the actual SetFont for the dialog items) - - CFontHandle fontThisDialog = this->GetFont(); - CClientDC dcScreen(NULL); - - LOGFONT titleLogFont = {0}; - LOGFONT bulletLogFont = {0}; - fontThisDialog.GetLogFont(&titleLogFont); - fontThisDialog.GetLogFont(&bulletLogFont); - - // The Wizard 97 Spec recommends to do the Title Font - // as Verdana Bold, 12pt. - titleLogFont.lfCharSet = DEFAULT_CHARSET; - titleLogFont.lfWeight = FW_BOLD; - SecureHelper::strcpy_x(titleLogFont.lfFaceName, _countof(titleLogFont.lfFaceName), _T("Verdana Bold")); - INT titleFontPointSize = 12; - titleLogFont.lfHeight = -::MulDiv(titleFontPointSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); - m_fontExteriorPageTitle.CreateFontIndirect(&titleLogFont); - - // The Wizard 97 Spec recommends to do Bullets by having - // static text of "h" in the Marlett font. - bulletLogFont.lfCharSet = DEFAULT_CHARSET; - bulletLogFont.lfWeight = FW_NORMAL; - SecureHelper::strcpy_x(bulletLogFont.lfFaceName, _countof(bulletLogFont.lfFaceName), _T("Marlett")); - INT bulletFontSize = 8; - bulletLogFont.lfHeight = -::MulDiv(bulletFontSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); - m_fontBullet.CreateFontIndirect(&bulletLogFont); - } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont(), OnGetExteriorPageTitleFont) - MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetBulletFont(), OnGetBulletFont) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() - - LRESULT OnGetExteriorPageTitleFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)(HFONT)m_fontExteriorPageTitle; - } - - LRESULT OnGetBulletFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return (LRESULT)(HFONT)m_fontBullet; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(!m_bReceivedFirstSizeMessage) - { - m_bReceivedFirstSizeMessage = true; - this->CenterWindow(); - } - - bHandled = FALSE; - return 0; - } -}; - -// for non-customized sheets -class CWizard97Sheet : public CWizard97SheetImpl -{ -protected: -// Typedefs - typedef CWizard97Sheet thisClass; - typedef CWizard97SheetImpl baseClass; - -public: - CWizard97Sheet(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : - baseClass(title, headerBitmap, watermarkBitmap, uStartPage, hWndParent) - { } - - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97PageWindow - client side for a Wizard 97 style wizard page - -#define WIZARD97_EXTERIOR_CXDLG 317 -#define WIZARD97_EXTERIOR_CYDLG 193 - -#define WIZARD97_INTERIOR_CXDLG 317 -#define WIZARD97_INTERIOR_CYDLG 143 - -class CWizard97PageWindow : public CPropertyPageWindow -{ -public: -// Constructors - CWizard97PageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) - { } - - CWizard97PageWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - CWizard97SheetWindow GetPropertySheet() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CWizard97SheetWindow(GetParent()); - } - -// Operations - HFONT GetExteriorPageTitleFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return GetPropertySheet().GetExteriorPageTitleFont(); - } - - HFONT GetBulletFont(void) - { - ATLASSERT(::IsWindow(m_hWnd)); - return GetPropertySheet().GetBulletFont(); - } - -// Implementation - overrides to prevent usage - HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) - { - ATLASSERT(FALSE); - return NULL; - } - -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97PageImpl - implements a Wizard 97 style wizard page - -template -class ATL_NO_VTABLE CWizard97PageImpl : public CPropertyPageImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97PageImpl< T, TBase > thisClass; - typedef CPropertyPageImpl< T, TBase > baseClass; - -public: - CWizard97PageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) - { } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97ExteriorPageImpl - implements a Wizard 97 style exterior wizard page - -template -class ATL_NO_VTABLE CWizard97ExteriorPageImpl : public CPropertyPageImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97ExteriorPageImpl< T, TBase > thisClass; - typedef CPropertyPageImpl< T, TBase > baseClass; - -public: -// Constructors - CWizard97ExteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) - { - m_psp.dwFlags |= PSP_HASHELP; - m_psp.dwFlags |= PSP_HIDEHEADER; - } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CWizard97InteriorPageImpl - implements a Wizard 97 style interior wizard page - -template -class ATL_NO_VTABLE CWizard97InteriorPageImpl : public CPropertyPageImpl< T, TBase > -{ -protected: -// Typedefs - typedef CWizard97InteriorPageImpl< T, TBase > thisClass; - typedef CPropertyPageImpl< T, TBase > baseClass; - -public: -// Constructors - CWizard97InteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) - { - m_psp.dwFlags |= PSP_HASHELP; - m_psp.dwFlags &= ~PSP_HIDEHEADER; - m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - - // Be sure to have the derived class define this in the constructor. - // We'll default it to something obvious in case its forgotten. - baseClass::SetHeaderTitle(_T("Call SetHeaderTitle in Derived Class")); - baseClass::SetHeaderSubTitle(_T("Call SetHeaderSubTitle in the constructor of the Derived Class.")); - } - -// Message Handling - BEGIN_MSG_MAP(thisClass) - CHAIN_MSG_MAP(baseClass) - END_MSG_MAP() -}; - -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// Aero Wizard support - -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardFrameWindow - client side for an Aero Wizard frame window - -class CAeroWizardFrameWindow : public CPropertySheetWindow -{ -public: -// Constructors - CAeroWizardFrameWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) - { } - - CAeroWizardFrameWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations - new, Aero Wizard only - void SetNextText(LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETNEXTTEXT, 0, (LPARAM)lpszText); - } - - void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::PostMessage(m_hWnd, PSM_SHOWWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); - } - - void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::PostMessage(m_hWnd, PSM_ENABLEWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); - } - - void SetButtonText(DWORD dwButton, LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PSM_SETBUTTONTEXT, (WPARAM)dwButton, (LPARAM)lpszText); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardFrameImpl - implements an Aero Wizard frame - -template -class ATL_NO_VTABLE CAeroWizardFrameImpl : public CPropertySheetImpl -{ -public: -// Constructor - CAeroWizardFrameImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : - CPropertySheetImpl(title, uStartPage, hWndParent) - { - m_psh.dwFlags |= PSH_WIZARD | PSH_AEROWIZARD; - } - -// Operations - void EnableResizing() - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_RESIZABLE; - } - - void UseHeaderBitmap() - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_HEADERBITMAP; - } - - void SetNoMargin() - { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_NOMARGIN; - } - -// Override to prevent use - HWND Create(HWND /*hWndParent*/ = NULL) - { - ATLASSERT(FALSE); // not supported for Aero Wizard - return NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardFrame - for non-customized frames - -class CAeroWizardFrame : public CAeroWizardFrameImpl -{ -public: - CAeroWizardFrame(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) - : CAeroWizardFrameImpl(title, uStartPage, hWndParent) - { } - - BEGIN_MSG_MAP(CAeroWizardFrame) - MESSAGE_HANDLER(WM_COMMAND, CAeroWizardFrameImpl::OnCommand) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardPageWindow - client side for an Aero Wizard page - -class CAeroWizardPageWindow : public CPropertyPageWindow -{ -public: -// Constructors - CAeroWizardPageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) - { } - - CAeroWizardPageWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - CAeroWizardFrameWindow GetAeroWizardFrame() const - { - ATLASSERT(::IsWindow(m_hWnd)); - // This is not really top-level frame window, but it processes all frame messages - return CAeroWizardFrameWindow(GetParent()); - } - -// Operations - new, Aero Wizard only - void SetNextText(LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().SetNextText(lpszText); - } - - void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().ShowWizardButtons(dwButtons, dwStates); - } - - void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().EnableWizardButtons(dwButtons, dwStates); - } - - void SetButtonText(DWORD dwButton, LPCWSTR lpszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetParent() != NULL); - GetAeroWizardFrame().SetButtonText(dwButton, lpszText); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardPageImpl - implements an Aero Wizard page - -template -class ATL_NO_VTABLE CAeroWizardPageImpl : public CPropertyPageImpl -{ -public: - CAeroWizardPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardPage - for non-customized pages - -template -class CAeroWizardPage : public CAeroWizardPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CAeroWizardPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardPageImpl(title) - { } - - DECLARE_EMPTY_MSG_MAP() -}; - - -#ifndef _ATL_NO_HOSTING - -// Note: You must #include to use these classes - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardAxPageImpl - Aero Wizard page that hosts ActiveX controls - -template -class ATL_NO_VTABLE CAeroWizardAxPageImpl : public CAxPropertyPageImpl< T, TBase > -{ -public: - CAeroWizardAxPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl< T, TBase >(title) - { } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAeroWizardAxPage - for non-customized pages - -template -class CAeroWizardAxPage : public CAeroWizardAxPageImpl > -{ -public: - enum { IDD = t_wDlgTemplateID }; - - CAeroWizardAxPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardAxPageImpl(title) - { } - -#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) - // not empty so we handle accelerators/create controls - BEGIN_MSG_MAP(CAeroWizardAxPage) - CHAIN_MSG_MAP(CAeroWizardAxPageImpl >) - END_MSG_MAP() -#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) - DECLARE_EMPTY_MSG_MAP() -#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) -}; - -#endif // _ATL_NO_HOSTING - -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// TaskDialog support - -#if ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) - -/////////////////////////////////////////////////////////////////////////////// -// AtlTaskDialog - support for TaskDialog() function - -inline int AtlTaskDialog(HWND hWndParent, - ATL::_U_STRINGorID WindowTitle, ATL::_U_STRINGorID MainInstructionText, ATL::_U_STRINGorID ContentText, - TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons = 0U, ATL::_U_STRINGorID Icon = (LPCTSTR)NULL) -{ - int nRet = -1; - -#ifdef _WTL_TASKDIALOG_DIRECT - USES_CONVERSION; - HRESULT hRet = ::TaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), T2CW(WindowTitle.m_lpstr), T2CW(MainInstructionText.m_lpstr), T2CW(ContentText.m_lpstr), dwCommonButtons, T2CW(Icon.m_lpstr), &nRet); - ATLVERIFY(SUCCEEDED(hRet)); -#else - // This allows apps to run on older versions of Windows - typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialog)(HWND hwndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle, PCWSTR pszMainInstruction, PCWSTR pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon, int* pnButton); - - HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - if(m_hCommCtrlDLL != NULL) - { - PFN_TaskDialog pfnTaskDialog = (PFN_TaskDialog)::GetProcAddress(m_hCommCtrlDLL, "TaskDialog"); - if(pfnTaskDialog != NULL) - { - USES_CONVERSION; - HRESULT hRet = pfnTaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), T2CW(WindowTitle.m_lpstr), T2CW(MainInstructionText.m_lpstr), T2CW(ContentText.m_lpstr), dwCommonButtons, T2CW(Icon.m_lpstr), &nRet); - ATLVERIFY(SUCCEEDED(hRet)); - } - - ::FreeLibrary(m_hCommCtrlDLL); - } -#endif - - return nRet; -} - - -/////////////////////////////////////////////////////////////////////////////// -// CTaskDialogConfig - TASKDIALOGCONFIG wrapper - -class CTaskDialogConfig : public TASKDIALOGCONFIG -{ -public: -// Constructor - CTaskDialogConfig() - { - Init(); - } - - void Init() - { - memset(this, 0, sizeof(TASKDIALOGCONFIG)); // initialize structure to 0/NULL - this->cbSize = sizeof(TASKDIALOGCONFIG); - this->hInstance = ModuleHelper::GetResourceInstance(); - } - -// Operations - setting values - // common buttons - void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) - { - this->dwCommonButtons = dwCommonButtons; - } - - // window title text - void SetWindowTitle(UINT nID) - { - this->pszWindowTitle = MAKEINTRESOURCEW(nID); - } - - void SetWindowTitle(LPCWSTR lpstrWindowTitle) - { - this->pszWindowTitle = lpstrWindowTitle; - } - - // main icon - void SetMainIcon(HICON hIcon) - { - this->dwFlags |= TDF_USE_HICON_MAIN; - this->hMainIcon = hIcon; - } - - void SetMainIcon(UINT nID) - { - this->dwFlags &= ~TDF_USE_HICON_MAIN; - this->pszMainIcon = MAKEINTRESOURCEW(nID); - } - - void SetMainIcon(LPCWSTR lpstrMainIcon) - { - this->dwFlags &= ~TDF_USE_HICON_MAIN; - this->pszMainIcon = lpstrMainIcon; - } - - // main instruction text - void SetMainInstructionText(UINT nID) - { - this->pszMainInstruction = MAKEINTRESOURCEW(nID); - } - - void SetMainInstructionText(LPCWSTR lpstrMainInstruction) - { - this->pszMainInstruction = lpstrMainInstruction; - } - - // content text - void SetContentText(UINT nID) - { - this->pszContent = MAKEINTRESOURCEW(nID); - } - - void SetContentText(LPCWSTR lpstrContent) - { - this->pszContent = lpstrContent; - } - - // buttons - void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) - { - this->pButtons = pButtons; - this->cButtons = cButtons; - if(nDefaultButton != 0) - this->nDefaultButton = nDefaultButton; - } - - void SetDefaultButton(int nDefaultButton) - { - this->nDefaultButton = nDefaultButton; - } - - // radio buttons - void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) - { - this->pRadioButtons = pRadioButtons; - this->cRadioButtons = cRadioButtons; - if(nDefaultRadioButton != 0) - this->nDefaultRadioButton = nDefaultRadioButton; - } - - void SetDefaultRadioButton(int nDefaultRadioButton) - { - this->nDefaultRadioButton = nDefaultRadioButton; - } - - // verification text - void SetVerificationText(UINT nID) - { - this->pszVerificationText = MAKEINTRESOURCEW(nID); - } - - void SetVerificationText(LPCWSTR lpstrVerificationText) - { - this->pszVerificationText = lpstrVerificationText; - } - - // expanded information text - void SetExpandedInformationText(UINT nID) - { - this->pszExpandedInformation = MAKEINTRESOURCEW(nID); - } - - void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) - { - this->pszExpandedInformation = lpstrExpandedInformation; - } - - // expanded control text - void SetExpandedControlText(UINT nID) - { - this->pszExpandedControlText = MAKEINTRESOURCEW(nID); - } - - void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) - { - this->pszExpandedControlText = lpstrExpandedControlText; - } - - // collapsed control text - void SetCollapsedControlText(UINT nID) - { - this->pszCollapsedControlText = MAKEINTRESOURCEW(nID); - } - - void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) - { - this->pszCollapsedControlText = lpstrCollapsedControlText; - } - - // footer icon - void SetFooterIcon(HICON hIcon) - { - this->dwFlags |= TDF_USE_HICON_FOOTER; - this->hFooterIcon = hIcon; - } - - void SetFooterIcon(UINT nID) - { - this->dwFlags &= ~TDF_USE_HICON_FOOTER; - this->pszFooterIcon = MAKEINTRESOURCEW(nID); - } - - void SetFooterIcon(LPCWSTR lpstrFooterIcon) - { - this->dwFlags &= ~TDF_USE_HICON_FOOTER; - this->pszFooterIcon = lpstrFooterIcon; - } - - // footer text - void SetFooterText(UINT nID) - { - this->pszFooter = MAKEINTRESOURCEW(nID); - } - - void SetFooterText(LPCWSTR lpstrFooterText) - { - this->pszFooter = lpstrFooterText; - } - - // width (in DLUs) - void SetWidth(UINT cxWidth) - { - this->cxWidth = cxWidth; - } - - // modify flags - void ModifyFlags(DWORD dwRemove, DWORD dwAdd) - { - this->dwFlags = (this->dwFlags & ~dwRemove) | dwAdd; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTaskDialogImpl - implements a Task Dialog - -template -class ATL_NO_VTABLE CTaskDialogImpl -{ -public: - CTaskDialogConfig m_tdc; - HWND m_hWnd; // used only in callback functions - -// Constructor - CTaskDialogImpl(HWND hWndParent = NULL) : m_hWnd(NULL) - { - m_tdc.hwndParent = hWndParent; - m_tdc.pfCallback = T::TaskDialogCallback; - m_tdc.lpCallbackData = (LONG_PTR)static_cast(this); - } - -// Operations - HRESULT DoModal(HWND hWndParent = ::GetActiveWindow(), int* pnButton = NULL, int* pnRadioButton = NULL, BOOL* pfVerificationFlagChecked = NULL) - { - if(m_tdc.hwndParent == NULL) - m_tdc.hwndParent = hWndParent; - -#ifdef _WTL_TASKDIALOG_DIRECT - return ::TaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); -#else - - // This allows apps to run on older versions of Windows - typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialogIndirect)(const TASKDIALOGCONFIG* pTaskConfig, int* pnButton, int* pnRadioButton, BOOL* pfVerificationFlagChecked); - - HRESULT hRet = E_UNEXPECTED; - HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - if(m_hCommCtrlDLL != NULL) - { - PFN_TaskDialogIndirect pfnTaskDialogIndirect = (PFN_TaskDialogIndirect)::GetProcAddress(m_hCommCtrlDLL, "TaskDialogIndirect"); - if(pfnTaskDialogIndirect != NULL) - hRet = pfnTaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); - - ::FreeLibrary(m_hCommCtrlDLL); - } - - return hRet; -#endif - } - -// Operations - setting values of TASKDIALOGCONFIG - // common buttons - void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) - { m_tdc.SetCommonButtons(dwCommonButtons); } - // window title text - void SetWindowTitle(UINT nID) - { m_tdc.SetWindowTitle(nID); } - void SetWindowTitle(LPCWSTR lpstrWindowTitle) - { m_tdc.SetWindowTitle(lpstrWindowTitle); } - // main icon - void SetMainIcon(HICON hIcon) - { m_tdc.SetMainIcon(hIcon); } - void SetMainIcon(UINT nID) - { m_tdc.SetMainIcon(nID); } - void SetMainIcon(LPCWSTR lpstrMainIcon) - { m_tdc.SetMainIcon(lpstrMainIcon); } - // main instruction text - void SetMainInstructionText(UINT nID) - { m_tdc.SetMainInstructionText(nID); } - void SetMainInstructionText(LPCWSTR lpstrMainInstruction) - { m_tdc.SetMainInstructionText(lpstrMainInstruction); } - // content text - void SetContentText(UINT nID) - { m_tdc.SetContentText(nID); } - void SetContentText(LPCWSTR lpstrContent) - { m_tdc.SetContentText(lpstrContent); } - // buttons - void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) - { m_tdc.SetButtons(pButtons, cButtons, nDefaultButton); } - void SetDefaultButton(int nDefaultButton) - { m_tdc.SetDefaultButton(nDefaultButton); } - // radio buttons - void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) - { m_tdc.SetRadioButtons(pRadioButtons, cRadioButtons, nDefaultRadioButton); } - void SetDefaultRadioButton(int nDefaultRadioButton) - { m_tdc.SetDefaultRadioButton(nDefaultRadioButton); } - // verification text - void SetVerificationText(UINT nID) - { m_tdc.SetVerificationText(nID); } - void SetVerificationText(LPCWSTR lpstrVerificationText) - { m_tdc.SetVerificationText(lpstrVerificationText); } - // expanded information text - void SetExpandedInformationText(UINT nID) - { m_tdc.SetExpandedInformationText(nID); } - void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) - { m_tdc.SetExpandedInformationText(lpstrExpandedInformation); } - // expanded control text - void SetExpandedControlText(UINT nID) - { m_tdc.SetExpandedControlText(nID); } - void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) - { m_tdc.SetExpandedControlText(lpstrExpandedControlText); } - // collapsed control text - void SetCollapsedControlText(UINT nID) - { m_tdc.SetCollapsedControlText(nID); } - void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) - { m_tdc.SetCollapsedControlText(lpstrCollapsedControlText); } - // footer icon - void SetFooterIcon(HICON hIcon) - { m_tdc.SetFooterIcon(hIcon); } - void SetFooterIcon(UINT nID) - { m_tdc.SetFooterIcon(nID); } - void SetFooterIcon(LPCWSTR lpstrFooterIcon) - { m_tdc.SetFooterIcon(lpstrFooterIcon); } - // footer text - void SetFooterText(UINT nID) - { m_tdc.SetFooterText(nID); } - void SetFooterText(LPCWSTR lpstrFooterText) - { m_tdc.SetFooterText(lpstrFooterText); } - // width (in DLUs) - void SetWidth(UINT cxWidth) - { m_tdc.SetWidth(cxWidth); } - // modify flags - void ModifyFlags(DWORD dwRemove, DWORD dwAdd) - { m_tdc.ModifyFlags(dwRemove, dwAdd); } - -// Implementation - static HRESULT CALLBACK TaskDialogCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) - { - T* pT = (T*)lpRefData; - ATLASSERT(pT->m_hWnd == NULL || pT->m_hWnd == hWnd); - - BOOL bRet = FALSE; - switch(uMsg) - { - case TDN_DIALOG_CONSTRUCTED: - pT->m_hWnd = hWnd; - pT->OnDialogConstructed(); - break; - case TDN_CREATED: - pT->OnCreated(); - break; - case TDN_BUTTON_CLICKED: - bRet = pT->OnButtonClicked((int)wParam); - break; - case TDN_RADIO_BUTTON_CLICKED: - pT->OnRadioButtonClicked((int)wParam); - break; - case TDN_HYPERLINK_CLICKED: - pT->OnHyperlinkClicked((LPCWSTR)lParam); - break; - case TDN_EXPANDO_BUTTON_CLICKED: - pT->OnExpandoButtonClicked((wParam != 0)); - break; - case TDN_VERIFICATION_CLICKED: - pT->OnVerificationClicked((wParam != 0)); - break; - case TDN_HELP: - pT->OnHelp(); - break; - case TDN_TIMER: - bRet = pT->OnTimer((DWORD)wParam); - break; - case TDN_NAVIGATED: - pT->OnNavigated(); - break; - case TDN_DESTROYED: - pT->OnDestroyed(); - pT->m_hWnd = NULL; - break; - default: - ATLTRACE2(atlTraceUI, 0, _T("Unknown notification received in CTaskDialogImpl::TaskDialogCallback\n")); - break; - } - - return (HRESULT)bRet; - } - -// Overrideables - notification handlers - void OnDialogConstructed() - { - } - - void OnCreated() - { - } - - BOOL OnButtonClicked(int /*nButton*/) - { - return FALSE; // don't prevent dialog to close - } - - void OnRadioButtonClicked(int /*nRadioButton*/) - { - } - - void OnHyperlinkClicked(LPCWSTR /*pszHREF*/) - { - } - - void OnExpandoButtonClicked(bool /*bExpanded*/) - { - } - - void OnVerificationClicked(bool /*bChecked*/) - { - } - - void OnHelp() - { - } - - BOOL OnTimer(DWORD /*dwTickCount*/) - { - return FALSE; // don't reset counter - } - - void OnNavigated() - { - } - - void OnDestroyed() - { - } - -// Commands - valid to call only from handlers - void NavigatePage(TASKDIALOGCONFIG& tdc) - { - ATLASSERT(m_hWnd != NULL); - - tdc.cbSize = sizeof(TASKDIALOGCONFIG); - if(tdc.hwndParent == NULL) - tdc.hwndParent = m_tdc.hwndParent; - tdc.pfCallback = m_tdc.pfCallback; - tdc.lpCallbackData = m_tdc.lpCallbackData; - (TASKDIALOGCONFIG)m_tdc = tdc; - - ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&tdc); - } - - // modify TASKDIALOGCONFIG values, then call this to update task dialog - void NavigatePage() - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&m_tdc); - } - - void ClickButton(int nButton) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_CLICK_BUTTON, nButton, 0L); - } - - void SetMarqueeProgressBar(BOOL bMarquee) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_SET_MARQUEE_PROGRESS_BAR, bMarquee, 0L); - } - - BOOL SetProgressBarState(int nNewState) - { - ATLASSERT(m_hWnd != NULL); - return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_STATE, nNewState, 0L); - } - - DWORD SetProgressBarRange(int nMinRange, int nMaxRange) - { - ATLASSERT(m_hWnd != NULL); - return (DWORD)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(nMinRange, nMaxRange)); - } - - int SetProgressBarPos(int nNewPos) - { - ATLASSERT(m_hWnd != NULL); - return (int)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_POS, nNewPos, 0L); - } - - BOOL SetProgressBarMarquee(BOOL bMarquee, UINT uSpeed) - { - ATLASSERT(m_hWnd != NULL); - return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_MARQUEE, bMarquee, uSpeed); - } - - void SetElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_SET_ELEMENT_TEXT, element, (LPARAM)lpstrText); - } - - void ClickRadioButton(int nRadioButton) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_CLICK_RADIO_BUTTON, nRadioButton, 0L); - } - - void EnableButton(int nButton, BOOL bEnable) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_ENABLE_BUTTON, nButton, bEnable); - } - - void EnableRadioButton(int nButton, BOOL bEnable) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_ENABLE_RADIO_BUTTON, nButton, bEnable); - } - - void ClickVerification(BOOL bCheck, BOOL bFocus) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_CLICK_VERIFICATION, bCheck, bFocus); - } - - void UpdateElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_UPDATE_ELEMENT_TEXT, element, (LPARAM)lpstrText); - } - - void SetButtonElevationRequiredState(int nButton, BOOL bElevation) - { - ATLASSERT(m_hWnd != NULL); - ::SendMessage(m_hWnd, TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, nButton, bElevation); - } - - void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, HICON hIcon) - { - ATLASSERT(m_hWnd != NULL); -#ifdef _DEBUG - if(element == TDIE_ICON_MAIN) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) != 0); - else if(element == TDIE_ICON_FOOTER) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) != 0); -#endif // _DEBUG - ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)hIcon); - } - - void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, LPCWSTR lpstrIcon) - { - ATLASSERT(m_hWnd != NULL); -#ifdef _DEBUG - if(element == TDIE_ICON_MAIN) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) == 0); - else if(element == TDIE_ICON_FOOTER) - ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) == 0); -#endif // _DEBUG - ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)lpstrIcon); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CTaskDialog - for non-customized task dialogs - -class CTaskDialog : public CTaskDialogImpl -{ -public: - CTaskDialog(HWND hWndParent = NULL) : CTaskDialogImpl(hWndParent) - { - m_tdc.pfCallback = NULL; - } -}; - -#endif // ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) - -}; // namespace WTL - -#endif // __ATLDLGS_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLDLGS_H__ +#define __ATLDLGS_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atldlgs.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atldlgs.h requires atlwin.h to be included first +#endif + +#include +#include + +#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) + #include +#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CFileDialogImpl +// CFileDialog +// CFileDialogEx +// CMultiFileDialogImpl +// CMultiFileDialog +// CShellFileDialogImpl +// CShellFileOpenDialogImpl +// CShellFileOpenDialog +// CShellFileSaveDialogImpl +// CShellFileSaveDialog +// CFolderDialogImpl +// CFolderDialog +// CFontDialogImpl +// CFontDialog +// CRichEditFontDialogImpl +// CRichEditFontDialog +// CColorDialogImpl +// CColorDialog +// CPrintDialogImpl +// CPrintDialog +// CPrintDialogExImpl +// CPrintDialogEx +// CPageSetupDialogImpl +// CPageSetupDialog +// CFindReplaceDialogImpl +// CFindReplaceDialog +// +// CMemDlgTemplate +// CIndirectDialogImpl +// +// CPropertySheetWindow +// CPropertySheetImpl +// CPropertySheet +// CPropertyPageWindow +// CPropertyPageImpl +// CPropertyPage +// CAxPropertyPageImpl +// CAxPropertyPage +// +// CWizard97SheetWindow +// CWizard97SheetImpl +// CWizard97Sheet +// CWizard97PageWindow +// CWizard97PageImpl +// CWizard97ExteriorPageImpl +// CWizard97InteriorPageImpl +// +// CAeroWizardFrameWindow +// CAeroWizardFrameImpl +// CAeroWizardFrame +// CAeroWizardPageWindow +// CAeroWizardPageImpl +// CAeroWizardPage +// CAeroWizardAxPageImpl +// CAeroWizardAxPage +// +// CTaskDialogConfig +// CTaskDialogImpl +// CTaskDialog +// +// Global functions: +// AtlTaskDialog() + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CFileDialogImpl - used for File Open or File Save As + +// compatibility with the old (vc6.0) headers +#if (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) + #ifndef CDSIZEOF_STRUCT + #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) + #endif + #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName) + #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName) + #ifdef UNICODE + #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400W + #else + #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A + #endif // !UNICODE +#endif // (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) + +#if !defined(_WIN32_WCE) && !defined(CDN_INCLUDEITEM) + #define CDN_INCLUDEITEM (CDN_FIRST - 0x0007) +#endif + +template +class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase +{ +public: +#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) + OPENFILENAMEEX m_ofn; +#else + OPENFILENAME m_ofn; +#endif + BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save + TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return + TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return + + CFileDialogImpl(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs + LPCTSTR lpszDefExt = NULL, + LPCTSTR lpszFileName = NULL, + DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + LPCTSTR lpszFilter = NULL, + HWND hWndParent = NULL) + { + memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL + m_szFileName[0] = _T('\0'); + m_szFileTitle[0] = _T('\0'); + + m_bOpenFileDialog = bOpenFileDialog; + + m_ofn.lStructSize = sizeof(m_ofn); +#if (_WIN32_WINNT >= 0x0500) + // adjust struct size if running on older version of Windows + if(AtlIsOldWindows()) + { + ATLASSERT(sizeof(m_ofn) > OPENFILENAME_SIZE_VERSION_400); // must be + m_ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + } +#endif // (_WIN32_WINNT >= 0x0500) + m_ofn.lpstrFile = m_szFileName; + m_ofn.nMaxFile = _MAX_PATH; + m_ofn.lpstrDefExt = lpszDefExt; + m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; + m_ofn.nMaxFileTitle = _MAX_FNAME; +#ifndef _WIN32_WCE + m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_ENABLESIZING; +#else // CE specific + m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK; +#endif // !_WIN32_WCE + m_ofn.lpstrFilter = lpszFilter; + m_ofn.hInstance = ModuleHelper::GetResourceInstance(); + m_ofn.lpfnHook = (LPOFNHOOKPROC)T::StartDialogProc; + m_ofn.hwndOwner = hWndParent; + + // setup initial file name + if(lpszFileName != NULL) + SecureHelper::strncpy_x(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); + } + + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT((m_ofn.Flags & OFN_ENABLEHOOK) != 0); + ATLASSERT(m_ofn.lpfnHook != NULL); // can still be a user hook + + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + if(m_ofn.hwndOwner == NULL) // set only if not specified before + m_ofn.hwndOwner = hWndParent; + + ATLASSERT(m_hWnd == NULL); + ModuleHelper::AddCreateWndData(&m_thunk.cd, (ATL::CDialogImplBase*)this); + + BOOL bRet; + if(m_bOpenFileDialog) +#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) + bRet = ::GetOpenFileNameEx(&m_ofn); + else + bRet = ::GetSaveFileName((LPOPENFILENAME)&m_ofn); +#else + bRet = ::GetOpenFileName(&m_ofn); + else + bRet = ::GetSaveFileName(&m_ofn); +#endif + + m_hWnd = NULL; + + return bRet ? IDOK : IDCANCEL; + } + +// Attributes + ATL::CWindow GetFileDialogWindow() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ATL::CWindow(GetParent()); + } + + int GetFilePath(LPTSTR lpstrFilePath, int nLength) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + return (int)GetFileDialogWindow().SendMessage(CDM_GETFILEPATH, nLength, (LPARAM)lpstrFilePath); + } + + int GetFolderIDList(LPVOID lpBuff, int nLength) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERIDLIST, nLength, (LPARAM)lpBuff); + } + + int GetFolderPath(LPTSTR lpstrFolderPath, int nLength) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERPATH, nLength, (LPARAM)lpstrFolderPath); + } + + int GetSpec(LPTSTR lpstrSpec, int nLength) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + return (int)GetFileDialogWindow().SendMessage(CDM_GETSPEC, nLength, (LPARAM)lpstrSpec); + } + + void SetControlText(int nCtrlID, LPCTSTR lpstrText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + GetFileDialogWindow().SendMessage(CDM_SETCONTROLTEXT, nCtrlID, (LPARAM)lpstrText); + } + + void SetDefExt(LPCTSTR lpstrExt) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + GetFileDialogWindow().SendMessage(CDM_SETDEFEXT, 0, (LPARAM)lpstrExt); + } + + BOOL GetReadOnlyPref() const // return TRUE if readonly checked + { + return ((m_ofn.Flags & OFN_READONLY) != 0) ? TRUE : FALSE; + } + +// Operations + void HideControl(int nCtrlID) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + GetFileDialogWindow().SendMessage(CDM_HIDECONTROL, nCtrlID); + } + +// Special override for common dialogs + BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + GetFileDialogWindow().SendMessage(WM_COMMAND, MAKEWPARAM(IDCANCEL, 0)); + return TRUE; + } + +// Message map and handlers + BEGIN_MSG_MAP(CFileDialogImpl) + NOTIFY_CODE_HANDLER(CDN_FILEOK, _OnFileOK) + NOTIFY_CODE_HANDLER(CDN_FOLDERCHANGE, _OnFolderChange) + NOTIFY_CODE_HANDLER(CDN_HELP, _OnHelp) + NOTIFY_CODE_HANDLER(CDN_INITDONE, _OnInitDone) + NOTIFY_CODE_HANDLER(CDN_SELCHANGE, _OnSelChange) + NOTIFY_CODE_HANDLER(CDN_SHAREVIOLATION, _OnShareViolation) + NOTIFY_CODE_HANDLER(CDN_TYPECHANGE, _OnTypeChange) +#ifndef _WIN32_WCE + NOTIFY_CODE_HANDLER(CDN_INCLUDEITEM, _OnIncludeItem) +#endif // !_WIN32_WCE + END_MSG_MAP() + + LRESULT _OnFileOK(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + return !pT->OnFileOK((LPOFNOTIFY)pnmh); + } + + LRESULT _OnFolderChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + pT->OnFolderChange((LPOFNOTIFY)pnmh); + return 0; + } + + LRESULT _OnHelp(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + pT->OnHelp((LPOFNOTIFY)pnmh); + return 0; + } + + LRESULT _OnInitDone(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + pT->OnInitDone((LPOFNOTIFY)pnmh); + return 0; + } + + LRESULT _OnSelChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + pT->OnSelChange((LPOFNOTIFY)pnmh); + return 0; + } + + LRESULT _OnShareViolation(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + return pT->OnShareViolation((LPOFNOTIFY)pnmh); + } + + LRESULT _OnTypeChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + pT->OnTypeChange((LPOFNOTIFY)pnmh); + return 0; + } + +#ifndef _WIN32_WCE + LRESULT _OnIncludeItem(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + ATLASSERT(::IsWindow(m_hWnd)); + T* pT = static_cast(this); + return pT->OnIncludeItem((LPOFNOTIFYEX)pnmh); + } +#endif // !_WIN32_WCE + +// Overrideables + BOOL OnFileOK(LPOFNOTIFY /*lpon*/) + { + return TRUE; + } + + void OnFolderChange(LPOFNOTIFY /*lpon*/) + { + } + + void OnHelp(LPOFNOTIFY /*lpon*/) + { + } + + void OnInitDone(LPOFNOTIFY /*lpon*/) + { + } + + void OnSelChange(LPOFNOTIFY /*lpon*/) + { + } + + int OnShareViolation(LPOFNOTIFY /*lpon*/) + { + return 0; + } + + void OnTypeChange(LPOFNOTIFY /*lpon*/) + { + } + +#ifndef _WIN32_WCE + BOOL OnIncludeItem(LPOFNOTIFYEX /*lponex*/) + { + return TRUE; // include item + } +#endif // !_WIN32_WCE +}; + +class CFileDialog : public CFileDialogImpl +{ +public: + CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs + LPCTSTR lpszDefExt = NULL, + LPCTSTR lpszFileName = NULL, + DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + LPCTSTR lpszFilter = NULL, + HWND hWndParent = NULL) + : CFileDialogImpl(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) + { } + + // override base class map and references to handlers + DECLARE_EMPTY_MSG_MAP() +}; + +#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) +class CFileDialogEx : public CFileDialogImpl +{ +public: + CFileDialogEx( // Supports only FileOpen + LPCTSTR lpszDefExt = NULL, + LPCTSTR lpszFileName = NULL, + DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + OFN_EXFLAG ExFlags = OFN_EXFLAG_THUMBNAILVIEW, + OFN_SORTORDER dwSortOrder = OFN_SORTORDER_AUTO, + LPCTSTR lpszFilter = NULL, + HWND hWndParent = NULL) + : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) + { + m_ofn.ExFlags = ExFlags; + m_ofn.dwSortOrder = dwSortOrder; + } + + // override base class map and references to handlers + DECLARE_EMPTY_MSG_MAP() +}; +#endif // defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) + + +/////////////////////////////////////////////////////////////////////////////// +// Multi File Dialog - Multi-select File Open dialog + +#ifndef _WIN32_WCE + +// The class dynamically resizes the buffer as the file selection changes +// (as described in Knowledge Base article 131462). It also expands selected +// shortcut files to take into account the full path of the target file. +// Note that this doesn't work on Win9x for the old style dialogs, as well as +// on NT for non-Unicode builds. + +#ifndef _WTL_FIXED_OFN_BUFFER_LENGTH + #define _WTL_FIXED_OFN_BUFFER_LENGTH 0x10000 +#endif + +template +class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > +{ +public: + mutable LPCTSTR m_pNextFile; +#ifndef _UNICODE + bool m_bIsNT; +#endif + + CMultiFileDialogImpl( + LPCTSTR lpszDefExt = NULL, + LPCTSTR lpszFileName = NULL, + DWORD dwFlags = OFN_HIDEREADONLY, + LPCTSTR lpszFilter = NULL, + HWND hWndParent = NULL) + : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent), + m_pNextFile(NULL) + { + m_ofn.Flags |= OFN_ALLOWMULTISELECT; // Force multiple selection mode + +#ifndef _UNICODE + OSVERSIONINFO ovi = { sizeof(ovi) }; + ::GetVersionEx(&ovi); + m_bIsNT = (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT); + if (m_bIsNT) + { + // On NT platforms, GetOpenFileNameA thunks to GetOpenFileNameW and there + // is absolutely nothing we can do except to start off with a large buffer. + ATLVERIFY(ResizeFilenameBuffer(_WTL_FIXED_OFN_BUFFER_LENGTH)); + } +#endif + } + + ~CMultiFileDialogImpl() + { + if (m_ofn.lpstrFile != m_szFileName) // Free the buffer if we allocated it + delete[] m_ofn.lpstrFile; + } + +// Operations + // Get the directory that the files were chosen from. + // The function returns the number of characters copied, not including the terminating zero. + // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. + // If the function fails, the return value is zero. + int GetDirectory(LPTSTR pBuffer, int nBufLen) const + { + if (m_ofn.lpstrFile == NULL) + return 0; + + LPCTSTR pStr = m_ofn.lpstrFile; + int nLength = lstrlen(pStr); + if (pStr[nLength + 1] == 0) + { + // The OFN buffer contains a single item so extract its path. + LPCTSTR pSep = _strrchr(pStr, _T('\\')); + if (pSep != NULL) + nLength = (int)(DWORD_PTR)(pSep - pStr); + } + + int nRet = 0; + if (pBuffer == NULL) // If the buffer is NULL, return the required length + { + nRet = nLength + 1; + } + else if (nBufLen > nLength) + { + SecureHelper::strncpy_x(pBuffer, nBufLen, pStr, nLength); + nRet = nLength; + } + + return nRet; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + bool GetDirectory(_CSTRING_NS::CString& strDir) const + { + bool bRet = false; + + int nLength = GetDirectory(NULL, 0); + if (nLength > 0) + { + bRet = (GetDirectory(strDir.GetBuffer(nLength), nLength) > 0); + strDir.ReleaseBuffer(nLength - 1); + } + + return bRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + // Get the first filename as a pointer into the buffer. + LPCTSTR GetFirstFileName() const + { + if (m_ofn.lpstrFile == NULL) + return NULL; + + m_pNextFile = NULL; // Reset internal buffer pointer + + LPCTSTR pStr = m_ofn.lpstrFile; + int nLength = lstrlen(pStr); + if (pStr[nLength + 1] != 0) + { + // Multiple items were selected. The first string is the directory, + // so skip forwards to the second string. + pStr += nLength + 1; + + // Set up m_pNext so it points to the second item (or null). + m_pNextFile = pStr; + GetNextFileName(); + } + else + { + // A single item was selected. Skip forward past the path. + LPCTSTR pSep = _strrchr(pStr, _T('\\')); + if (pSep != NULL) + pStr = pSep + 1; + } + + return pStr; + } + + // Get the next filename as a pointer into the buffer. + LPCTSTR GetNextFileName() const + { + if (m_pNextFile == NULL) + return NULL; + + LPCTSTR pStr = m_pNextFile; + // Set "m_pNextFile" to point to the next file name, or null if we + // have reached the last file in the list. + int nLength = lstrlen(pStr); + m_pNextFile = (pStr[nLength + 1] != 0) ? &pStr[nLength + 1] : NULL; + + return pStr; + } + + // Get the first filename as a full path. + // The function returns the number of characters copied, not including the terminating zero. + // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. + // If the function fails, the return value is zero. + int GetFirstPathName(LPTSTR pBuffer, int nBufLen) const + { + LPCTSTR pStr = GetFirstFileName(); + int nLengthDir = GetDirectory(NULL, 0); + if((pStr == NULL) || (nLengthDir == 0)) + return 0; + + // Figure out the required length. + int nLengthTotal = nLengthDir + lstrlen(pStr); + + int nRet = 0; + if(pBuffer == NULL) // If the buffer is NULL, return the required length + { + nRet = nLengthTotal + 1; + } + else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path + { + GetDirectory(pBuffer, nBufLen); + SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); + SecureHelper::strcat_x(pBuffer, nBufLen, pStr); + nRet = nLengthTotal; + } + + return nRet; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + bool GetFirstPathName(_CSTRING_NS::CString& strPath) const + { + bool bRet = false; + + int nLength = GetFirstPathName(NULL, 0); + if (nLength > 0) + { + bRet = (GetFirstPathName(strPath.GetBuffer(nLength), nLength) > 0); + strPath.ReleaseBuffer(nLength - 1); + } + + return bRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + // Get the next filename as a full path. + // The function returns the number of characters copied, not including the terminating zero. + // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. + // If the function fails, the return value is zero. + // The internal position marker is moved forward only if the function succeeds and the buffer was large enough. + int GetNextPathName(LPTSTR pBuffer, int nBufLen) const + { + if (m_pNextFile == NULL) + return 0; + + int nRet = 0; + LPCTSTR pStr = m_pNextFile; + // Does the filename contain a backslash? + if (_strrchr(pStr, _T('\\')) != NULL) + { + // Yes, so we'll assume it's a full path. + int nLength = lstrlen(pStr); + + if (pBuffer == NULL) // If the buffer is NULL, return the required length + { + nRet = nLength + 1; + } + else if (nBufLen > nLength) // The buffer is big enough, so go ahead and copy the filename + { + SecureHelper::strcpy_x(pBuffer, nBufLen, GetNextFileName()); + nRet = nBufLen; + } + } + else + { + // The filename is relative, so construct the full path. + int nLengthDir = GetDirectory(NULL, 0); + if (nLengthDir > 0) + { + // Calculate the required space. + int nLengthTotal = nLengthDir + lstrlen(pStr); + + if(pBuffer == NULL) // If the buffer is NULL, return the required length + { + nRet = nLengthTotal + 1; + } + else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path + { + GetDirectory(pBuffer, nBufLen); + SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); + SecureHelper::strcat_x(pBuffer, nBufLen, GetNextFileName()); + nRet = nLengthTotal; + } + } + } + + return nRet; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + bool GetNextPathName(_CSTRING_NS::CString& strPath) const + { + bool bRet = false; + + int nLength = GetNextPathName(NULL, 0); + if (nLength > 0) + { + bRet = (GetNextPathName(strPath.GetBuffer(nLength), nLength) > 0); + strPath.ReleaseBuffer(nLength - 1); + } + + return bRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + +// Implementation + bool ResizeFilenameBuffer(DWORD dwLength) + { + if (dwLength > m_ofn.nMaxFile) + { + // Free the old buffer. + if (m_ofn.lpstrFile != m_szFileName) + { + delete[] m_ofn.lpstrFile; + m_ofn.lpstrFile = NULL; + m_ofn.nMaxFile = 0; + } + + // Allocate the new buffer. + LPTSTR lpstrBuff = NULL; + ATLTRY(lpstrBuff = new TCHAR[dwLength]); + if (lpstrBuff != NULL) + { + m_ofn.lpstrFile = lpstrBuff; + m_ofn.lpstrFile[0] = 0; + m_ofn.nMaxFile = dwLength; + } + } + + return (m_ofn.lpstrFile != NULL); + } + + void OnSelChange(LPOFNOTIFY /*lpon*/) + { +#ifndef _UNICODE + // There is no point resizing the buffer in ANSI builds running on NT. + if (m_bIsNT) + return; +#endif + + // Get the buffer length required to hold the spec. + int nLength = GetSpec(NULL, 0); + if (nLength <= 1) + return; // no files are selected, presumably + + // Add room for the directory, and an extra terminating zero. + nLength += GetFolderPath(NULL, 0) + 1; + + if (!ResizeFilenameBuffer(nLength)) + { + ATLASSERT(FALSE); + return; + } + + // If we are not following links then our work is done. + if ((m_ofn.Flags & OFN_NODEREFERENCELINKS) != 0) + return; + + // Get the file spec, which is the text in the edit control. + if (GetSpec(m_ofn.lpstrFile, m_ofn.nMaxFile) <= 0) + return; + + // Get the ID-list of the current folder. + int nBytes = GetFolderIDList(NULL, 0); + CTempBuffer idlist; + idlist.AllocateBytes(nBytes); + if ((nBytes <= 0) || (GetFolderIDList(idlist, nBytes) <= 0)) + return; + + // First bind to the desktop folder, then to the current folder. + ATL::CComPtr pDesktop, pFolder; + if (FAILED(::SHGetDesktopFolder(&pDesktop))) + return; + if (FAILED(pDesktop->BindToObject(idlist, NULL, IID_IShellFolder, (void**)&pFolder))) + return; + + // Work through the file spec, looking for quoted filenames. If we find a shortcut file, then + // we need to add enough extra buffer space to hold its target path. + DWORD nExtraChars = 0; + bool bInsideQuotes = false; + LPCTSTR pAnchor = m_ofn.lpstrFile; + LPCTSTR pChar = m_ofn.lpstrFile; + for ( ; *pChar; ++pChar) + { + // Look for quotation marks. + if (*pChar == _T('\"')) + { + // We are either entering or leaving a passage of quoted text. + bInsideQuotes = !bInsideQuotes; + + // Is it an opening or closing quote? + if (bInsideQuotes) + { + // We found an opening quote, so set "pAnchor" to the following character. + pAnchor = pChar + 1; + } + else // closing quote + { + // Each quoted entity should be shorter than MAX_PATH. + if (pChar - pAnchor >= MAX_PATH) + return; + + // Get the ID-list and attributes of the file. + USES_CONVERSION; + int nFileNameLength = (int)(DWORD_PTR)(pChar - pAnchor); + TCHAR szFileName[MAX_PATH]; + SecureHelper::strncpy_x(szFileName, MAX_PATH, pAnchor, nFileNameLength); + LPITEMIDLIST pidl = NULL; + DWORD dwAttrib = SFGAO_LINK; + if (SUCCEEDED(pFolder->ParseDisplayName(NULL, NULL, T2W(szFileName), NULL, &pidl, &dwAttrib))) + { + // Is it a shortcut file? + if (dwAttrib & SFGAO_LINK) + { + // Bind to its IShellLink interface. + ATL::CComPtr pLink; + if (SUCCEEDED(pFolder->BindToObject(pidl, NULL, IID_IShellLink, (void**)&pLink))) + { + // Get the shortcut's target path. + TCHAR szPath[MAX_PATH]; + if (SUCCEEDED(pLink->GetPath(szPath, MAX_PATH, NULL, 0))) + { + // If the target path is longer than the shortcut name, then add on the number + // of extra characters that are required. + int nNewLength = lstrlen(szPath); + if (nNewLength > nFileNameLength) + nExtraChars += nNewLength - nFileNameLength; + } + } + } + + // Free the ID-list returned by ParseDisplayName. + ::CoTaskMemFree(pidl); + } + } + } + } + + // If we need more space for shortcut targets, then reallocate. + if (nExtraChars > 0) + ATLVERIFY(ResizeFilenameBuffer(m_ofn.nMaxFile + nExtraChars)); + } + + // Helper for _ATM_MIN_CRT + static const TCHAR* _strrchr(const TCHAR* p, TCHAR ch) + { +#ifndef _ATL_MIN_CRT + return _tcsrchr(p, ch); +#else // _ATL_MIN_CRT + const TCHAR* lpsz = NULL; + while (*p != 0) + { + if (*p == ch) + lpsz = p; + p = ::CharNext(p); + } + return lpsz; +#endif // _ATL_MIN_CRT + } +}; + +class CMultiFileDialog : public CMultiFileDialogImpl +{ +public: + CMultiFileDialog( + LPCTSTR lpszDefExt = NULL, + LPCTSTR lpszFileName = NULL, + DWORD dwFlags = OFN_HIDEREADONLY, + LPCTSTR lpszFilter = NULL, + HWND hWndParent = NULL) + : CMultiFileDialogImpl(lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) + { } + + BEGIN_MSG_MAP(CMultiFileDialog) + CHAIN_MSG_MAP(CMultiFileDialogImpl) + END_MSG_MAP() +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// Shell File Dialog - new Shell File Open and Save dialogs in Vista + +// Note: Use GetPtr() to access dialog interface methods. +// Example: +// CShellFileOpenDialog dlg; +// dlg.GetPtr()->SetTitle(L"MyFileOpenDialog"); + +#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) + +/////////////////////////////////////////////////////////////////////////////// +// CShellFileDialogImpl - base class for CShellFileOpenDialogImpl and CShellFileSaveDialogImpl + +template +class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents +{ +public: +// Operations + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + INT_PTR nRet = -1; + + T* pT = static_cast(this); + if(pT->m_spFileDlg == NULL) + { + ATLASSERT(FALSE); + return nRet; + } + + DWORD dwCookie = 0; + pT->_Advise(dwCookie); + + HRESULT hRet = pT->m_spFileDlg->Show(hWndParent); + if(SUCCEEDED(hRet)) + nRet = IDOK; + else if(hRet == HRESULT_FROM_WIN32(ERROR_CANCELLED)) + nRet = IDCANCEL; + else + ATLASSERT(FALSE); // error + + pT->_Unadvise(dwCookie); + + return nRet; + } + + bool IsNull() const + { + const T* pT = static_cast(this); + return (pT->m_spFileDlg == NULL); + } + +// Operations - get file path after dialog returns + HRESULT GetFilePath(LPWSTR lpstrFilePath, int cchLength) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + + ATL::CComPtr spItem; + HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); + + if(SUCCEEDED(hRet)) + hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, lpstrFilePath, cchLength); + + return hRet; + } + + HRESULT GetFileTitle(LPWSTR lpstrFileTitle, int cchLength) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + + ATL::CComPtr spItem; + HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); + + if(SUCCEEDED(hRet)) + hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, lpstrFileTitle, cchLength); + + return hRet; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + HRESULT GetFilePath(_CSTRING_NS::CString& strFilePath) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + + ATL::CComPtr spItem; + HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); + + if(SUCCEEDED(hRet)) + hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, strFilePath); + + return hRet; + } + + HRESULT GetFileTitle(_CSTRING_NS::CString& strFileTitle) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + + ATL::CComPtr spItem; + HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); + + if(SUCCEEDED(hRet)) + hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, strFileTitle); + + return hRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + +// Helpers for IShellItem + static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, LPWSTR lpstr, int cchLength) + { + ATLASSERT(pShellItem != NULL); + + LPWSTR lpstrName = NULL; + HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); + + if(SUCCEEDED(hRet)) + { + if(lstrlenW(lpstrName) < cchLength) + { + SecureHelper::strcpyW_x(lpstr, cchLength, lpstrName); + } + else + { + ATLASSERT(FALSE); + hRet = DISP_E_BUFFERTOOSMALL; + } + + ::CoTaskMemFree(lpstrName); + } + + return hRet; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, _CSTRING_NS::CString& str) + { + ATLASSERT(pShellItem != NULL); + + LPWSTR lpstrName = NULL; + HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); + + if(SUCCEEDED(hRet)) + { + str = lpstrName; + ::CoTaskMemFree(lpstrName); + } + + return hRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + +// Implementation + void _Advise(DWORD& dwCookie) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + HRESULT hRet = pT->m_spFileDlg->Advise((IFileDialogEvents*)this, &dwCookie); + ATLVERIFY(SUCCEEDED(hRet)); + } + + void _Unadvise(DWORD dwCookie) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + HRESULT hRet = pT->m_spFileDlg->Unadvise(dwCookie); + ATLVERIFY(SUCCEEDED(hRet)); + } + + void _Init(LPCWSTR lpszFileName, DWORD dwOptions, LPCWSTR lpszDefExt, const COMDLG_FILTERSPEC* arrFilterSpec, UINT uFilterSpecCount) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg != NULL); + + HRESULT hRet = E_FAIL; + + if(lpszFileName != NULL) + { + hRet = pT->m_spFileDlg->SetFileName(lpszFileName); + ATLASSERT(SUCCEEDED(hRet)); + } + + hRet = pT->m_spFileDlg->SetOptions(dwOptions); + ATLASSERT(SUCCEEDED(hRet)); + + if(lpszDefExt != NULL) + { + hRet = pT->m_spFileDlg->SetDefaultExtension(lpszDefExt); + ATLASSERT(SUCCEEDED(hRet)); + } + + if(arrFilterSpec != NULL && uFilterSpecCount != 0U) + { + hRet = pT->m_spFileDlg->SetFileTypes(uFilterSpecCount, arrFilterSpec); + ATLASSERT(SUCCEEDED(hRet)); + } + } + +// Implementation - IUnknown interface + STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) + { + if(ppvObject == NULL) + return E_POINTER; + + T* pT = static_cast(this); + if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IFileDialogEvents)) + { + *ppvObject = (IFileDialogEvents*)pT; + // AddRef() not needed + return S_OK; + } + + return E_NOINTERFACE; + } + + virtual ULONG STDMETHODCALLTYPE AddRef() + { + return 1; + } + + virtual ULONG STDMETHODCALLTYPE Release() + { + return 1; + } + +// Implementation - IFileDialogEvents interface + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFileOk(IFileDialog* pfd) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnFileOk(); + } + + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChanging(IFileDialog* pfd, IShellItem* psiFolder) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnFolderChanging(psiFolder); + } + + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChange(IFileDialog* pfd) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnFolderChange(); + } + + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnSelectionChange(IFileDialog* pfd) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnSelectionChange(); + } + + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnShareViolation(IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnShareViolation(psi, pResponse); + } + + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnTypeChange(IFileDialog* pfd) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnTypeChange(); + } + + virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnOverwrite(IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); + pfd; // avoid level 4 warning + return pT->OnOverwrite(psi, pResponse); + } + +// Overrideables - Event handlers + HRESULT OnFileOk() + { + return E_NOTIMPL; + } + + HRESULT OnFolderChanging(IShellItem* /*psiFolder*/) + { + return E_NOTIMPL; + } + + HRESULT OnFolderChange() + { + return E_NOTIMPL; + } + + HRESULT OnSelectionChange() + { + return E_NOTIMPL; + } + + HRESULT OnShareViolation(IShellItem* /*psi*/, FDE_SHAREVIOLATION_RESPONSE* /*pResponse*/) + { + return E_NOTIMPL; + } + + HRESULT OnTypeChange() + { + return E_NOTIMPL; + } + + HRESULT OnOverwrite(IShellItem* /*psi*/, FDE_OVERWRITE_RESPONSE* /*pResponse*/) + { + return E_NOTIMPL; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CShellFileOpenDialogImpl - implements new Shell File Open dialog + +template +class ATL_NO_VTABLE CShellFileOpenDialogImpl : public CShellFileDialogImpl< T > +{ +public: + ATL::CComPtr m_spFileDlg; + + CShellFileOpenDialogImpl(LPCWSTR lpszFileName = NULL, + DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, + LPCWSTR lpszDefExt = NULL, + const COMDLG_FILTERSPEC* arrFilterSpec = NULL, + UINT uFilterSpecCount = 0U) + { + HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileOpenDialog); + + if(SUCCEEDED(hRet)) + _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); + } + + IFileOpenDialog* GetPtr() + { + return m_spFileDlg; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CShellFileOpenDialog - new Shell File Open dialog without events + +class CShellFileOpenDialog : public CShellFileOpenDialogImpl +{ +public: + CShellFileOpenDialog(LPCWSTR lpszFileName = NULL, + DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, + LPCWSTR lpszDefExt = NULL, + const COMDLG_FILTERSPEC* arrFilterSpec = NULL, + UINT uFilterSpecCount = 0U) : CShellFileOpenDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) + { } + +// Implementation (remove _Advise/_Unadvise code using template magic) + void _Advise(DWORD& /*dwCookie*/) + { } + + void _Unadvise(DWORD /*dwCookie*/) + { } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CShellFileSaveDialogImpl - implements new Shell File Save dialog + +template +class ATL_NO_VTABLE CShellFileSaveDialogImpl : public CShellFileDialogImpl< T > +{ +public: + ATL::CComPtr m_spFileDlg; + + CShellFileSaveDialogImpl(LPCWSTR lpszFileName = NULL, + DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, + LPCWSTR lpszDefExt = NULL, + const COMDLG_FILTERSPEC* arrFilterSpec = NULL, + UINT uFilterSpecCount = 0U) + { + HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileSaveDialog); + + if(SUCCEEDED(hRet)) + _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); + } + + IFileSaveDialog* GetPtr() + { + return m_spFileDlg; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CShellFileSaveDialog - new Shell File Save dialog without events + +class CShellFileSaveDialog : public CShellFileSaveDialogImpl +{ +public: + CShellFileSaveDialog(LPCWSTR lpszFileName = NULL, + DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, + LPCWSTR lpszDefExt = NULL, + const COMDLG_FILTERSPEC* arrFilterSpec = NULL, + UINT uFilterSpecCount = 0U) : CShellFileSaveDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) + { } + +// Implementation (remove _Advise/_Unadvise code using template magic) + void _Advise(DWORD& /*dwCookie*/) + { } + + void _Unadvise(DWORD /*dwCookie*/) + { } +}; + +#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CFolderDialogImpl - used for browsing for a folder + +#ifndef _WIN32_WCE + +template +class ATL_NO_VTABLE CFolderDialogImpl +{ +public: + BROWSEINFO m_bi; + LPCTSTR m_lpstrInitialFolder; + LPCITEMIDLIST m_pidlInitialSelection; + bool m_bExpandInitialSelection; + TCHAR m_szFolderDisplayName[MAX_PATH]; + TCHAR m_szFolderPath[MAX_PATH]; + LPITEMIDLIST m_pidlSelected; + HWND m_hWnd; // used only in the callback function + +// Constructor + CFolderDialogImpl(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) : + m_lpstrInitialFolder(NULL), m_pidlInitialSelection(NULL), m_bExpandInitialSelection(false), m_pidlSelected(NULL), m_hWnd(NULL) + { + memset(&m_bi, 0, sizeof(m_bi)); // initialize structure to 0/NULL + + m_bi.hwndOwner = hWndParent; + m_bi.pidlRoot = NULL; + m_bi.pszDisplayName = m_szFolderDisplayName; + m_bi.lpszTitle = lpstrTitle; + m_bi.ulFlags = uFlags; + m_bi.lpfn = BrowseCallbackProc; + m_bi.lParam = (LPARAM)static_cast(this); + + m_szFolderPath[0] = 0; + m_szFolderDisplayName[0] = 0; + } + + ~CFolderDialogImpl() + { + ::CoTaskMemFree(m_pidlSelected); + } + +// Operations + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + if(m_bi.hwndOwner == NULL) // set only if not specified before + m_bi.hwndOwner = hWndParent; + + // Clear out any previous results + m_szFolderPath[0] = 0; + m_szFolderDisplayName[0] = 0; + ::CoTaskMemFree(m_pidlSelected); + + INT_PTR nRet = IDCANCEL; + m_pidlSelected = ::SHBrowseForFolder(&m_bi); + + if(m_pidlSelected != NULL) + { + nRet = IDOK; + + // If BIF_RETURNONLYFSDIRS is set, we try to get the filesystem path. + // Otherwise, the caller must handle the ID-list directly. + if((m_bi.ulFlags & BIF_RETURNONLYFSDIRS) != 0) + { + if(::SHGetPathFromIDList(m_pidlSelected, m_szFolderPath) == FALSE) + nRet = IDCANCEL; + } + } + + return nRet; + } + + // Methods to call before DoModal + void SetInitialFolder(LPCTSTR lpstrInitialFolder, bool bExpand = true) + { + // lpstrInitialFolder may be a file if BIF_BROWSEINCLUDEFILES is specified + m_lpstrInitialFolder = lpstrInitialFolder; + m_bExpandInitialSelection = bExpand; + } + + void SetInitialSelection(LPCITEMIDLIST pidl, bool bExpand = true) + { + m_pidlInitialSelection = pidl; + m_bExpandInitialSelection = bExpand; + } + + // Methods to call after DoModal + LPITEMIDLIST GetSelectedItem(bool bDetach = false) + { + LPITEMIDLIST pidl = m_pidlSelected; + if(bDetach) + m_pidlSelected = NULL; + + return pidl; + } + + LPCTSTR GetFolderPath() const + { + return m_szFolderPath; + } + + LPCTSTR GetFolderDisplayName() const + { + return m_szFolderDisplayName; + } + + int GetFolderImageIndex() const + { + return m_bi.iImage; + } + +// Callback function and overrideables + static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData) + { +#ifndef BFFM_VALIDATEFAILED + #ifdef UNICODE + const int BFFM_VALIDATEFAILED = 4; + #else + const int BFFM_VALIDATEFAILED = 3; + #endif +#endif // !BFFM_VALIDATEFAILED +#ifndef BFFM_IUNKNOWN + const int BFFM_IUNKNOWN = 5; +#endif // !BFFM_IUNKNOWN +#ifndef BIF_NEWDIALOGSTYLE + const UINT BIF_NEWDIALOGSTYLE = 0x0040; +#endif // !BIF_NEWDIALOGSTYLE + + int nRet = 0; + T* pT = (T*)lpData; + bool bClear = false; + if(pT->m_hWnd == NULL) + { + pT->m_hWnd = hWnd; + bClear = true; + } + else + { + ATLASSERT(pT->m_hWnd == hWnd); + } + + switch(uMsg) + { + case BFFM_INITIALIZED: + // Set initial selection + // Note that m_pidlInitialSelection, if set, takes precedence over m_lpstrInitialFolder + if(pT->m_pidlInitialSelection != NULL) + pT->SetSelection(pT->m_pidlInitialSelection); + else if(pT->m_lpstrInitialFolder != NULL) + pT->SetSelection(pT->m_lpstrInitialFolder); + + // Expand initial selection if appropriate + if(pT->m_bExpandInitialSelection && ((pT->m_bi.ulFlags & BIF_NEWDIALOGSTYLE) != 0)) + { + if(pT->m_pidlInitialSelection != NULL) + pT->SetExpanded(pT->m_pidlInitialSelection); + else if(pT->m_lpstrInitialFolder != NULL) + pT->SetExpanded(pT->m_lpstrInitialFolder); + } + pT->OnInitialized(); + break; + case BFFM_SELCHANGED: + pT->OnSelChanged((LPITEMIDLIST)lParam); + break; + case BFFM_VALIDATEFAILED: + nRet = pT->OnValidateFailed((LPCTSTR)lParam); + break; + case BFFM_IUNKNOWN: + pT->OnIUnknown((IUnknown*)lParam); + break; + default: + ATLTRACE2(atlTraceUI, 0, _T("Unknown message received in CFolderDialogImpl::BrowseCallbackProc\n")); + break; + } + + if(bClear) + pT->m_hWnd = NULL; + return nRet; + } + + void OnInitialized() + { + } + + void OnSelChanged(LPITEMIDLIST /*pItemIDList*/) + { + } + + int OnValidateFailed(LPCTSTR /*lpstrFolderPath*/) + { + return 1; // 1=continue, 0=EndDialog + } + + void OnIUnknown(IUnknown* /*pUnknown*/) + { + } + + // Commands - valid to call only from handlers + void EnableOK(BOOL bEnable) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, BFFM_ENABLEOK, 0, bEnable); + } + + void SetSelection(LPCITEMIDLIST pItemIDList) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, BFFM_SETSELECTION, FALSE, (LPARAM)pItemIDList); + } + + void SetSelection(LPCTSTR lpstrFolderPath) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)lpstrFolderPath); + } + + void SetStatusText(LPCTSTR lpstrText) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)lpstrText); + } + + void SetOKText(LPCTSTR lpstrOKText) + { +#ifndef BFFM_SETOKTEXT + const UINT BFFM_SETOKTEXT = WM_USER + 105; +#endif + ATLASSERT(m_hWnd != NULL); + USES_CONVERSION; + LPCWSTR lpstr = T2CW(lpstrOKText); + ::SendMessage(m_hWnd, BFFM_SETOKTEXT, (WPARAM)lpstr, 0L); + } + + void SetExpanded(LPCITEMIDLIST pItemIDList) + { +#ifndef BFFM_SETEXPANDED + const UINT BFFM_SETEXPANDED = WM_USER + 106; +#endif + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, BFFM_SETEXPANDED, FALSE, (LPARAM)pItemIDList); + } + + void SetExpanded(LPCTSTR lpstrFolderPath) + { +#ifndef BFFM_SETEXPANDED + const UINT BFFM_SETEXPANDED = WM_USER + 106; +#endif + ATLASSERT(m_hWnd != NULL); + USES_CONVERSION; + LPCWSTR lpstr = T2CW(lpstrFolderPath); + ::SendMessage(m_hWnd, BFFM_SETEXPANDED, TRUE, (LPARAM)lpstr); + } +}; + +class CFolderDialog : public CFolderDialogImpl +{ +public: + CFolderDialog(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) + : CFolderDialogImpl(hWndParent, lpstrTitle, uFlags) + { } +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CCommonDialogImplBase - base class for common dialog classes + +class ATL_NO_VTABLE CCommonDialogImplBase : public ATL::CWindowImplBase +{ +public: + static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + if(uMsg != WM_INITDIALOG) + return 0; + CCommonDialogImplBase* pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); + ATLASSERT(pT != NULL); + ATLASSERT(pT->m_hWnd == NULL); + ATLASSERT(::IsWindow(hWnd)); + // subclass dialog's window + if(!pT->SubclassWindow(hWnd)) + { + ATLTRACE2(atlTraceUI, 0, _T("Subclassing a common dialog failed\n")); + return 0; + } + // check message map for WM_INITDIALOG handler + LRESULT lRes = 0; + if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) + return 0; + return lRes; + } + +// Special override for common dialogs + BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); + return TRUE; + } + +// Implementation - try to override these, to prevent errors + HWND Create(HWND, ATL::_U_RECT, LPCTSTR, DWORD, DWORD, ATL::_U_MENUorID, ATOM, LPVOID) + { + ATLASSERT(FALSE); // should not be called + return NULL; + } + + static LRESULT CALLBACK StartWindowProc(HWND /*hWnd*/, UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) + { + ATLASSERT(FALSE); // should not be called + return 0; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CFontDialogImpl - font selection dialog + +#ifndef _WIN32_WCE + +template +class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase +{ +public: + enum { _cchStyleName = 64 }; + + CHOOSEFONT m_cf; + TCHAR m_szStyleName[_cchStyleName]; // contains style name after return + LOGFONT m_lf; // default LOGFONT to store the info + +// Constructors + CFontDialogImpl(LPLOGFONT lplfInitial = NULL, + DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, + HDC hDCPrinter = NULL, + HWND hWndParent = NULL) + { + memset(&m_cf, 0, sizeof(m_cf)); + memset(&m_lf, 0, sizeof(m_lf)); + memset(&m_szStyleName, 0, sizeof(m_szStyleName)); + + m_cf.lStructSize = sizeof(m_cf); + m_cf.hwndOwner = hWndParent; + m_cf.rgbColors = RGB(0, 0, 0); + m_cf.lpszStyle = (LPTSTR)&m_szStyleName; + m_cf.Flags = dwFlags | CF_ENABLEHOOK; + m_cf.lpfnHook = (LPCFHOOKPROC)T::HookProc; + + if(lplfInitial != NULL) + { + m_cf.lpLogFont = lplfInitial; + m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; + m_lf = *lplfInitial; + } + else + { + m_cf.lpLogFont = &m_lf; + } + + if(hDCPrinter != NULL) + { + m_cf.hDC = hDCPrinter; + m_cf.Flags |= CF_PRINTERFONTS; + } + } + +// Operations + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT((m_cf.Flags & CF_ENABLEHOOK) != 0); + ATLASSERT(m_cf.lpfnHook != NULL); // can still be a user hook + + if(m_cf.hwndOwner == NULL) // set only if not specified before + m_cf.hwndOwner = hWndParent; + + ATLASSERT(m_hWnd == NULL); + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); + + BOOL bRet = ::ChooseFont(&m_cf); + + m_hWnd = NULL; + + if(bRet) // copy logical font from user's initialization buffer (if needed) + SecureHelper::memcpy_x(&m_lf, sizeof(m_lf), m_cf.lpLogFont, sizeof(m_lf)); + + return bRet ? IDOK : IDCANCEL; + } + + // works only when the dialog is dislayed or after + void GetCurrentFont(LPLOGFONT lplf) const + { + ATLASSERT(lplf != NULL); + + if(m_hWnd != NULL) + ::SendMessage(m_hWnd, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM)lplf); + else + *lplf = m_lf; + } + + // works only when the dialog is dislayed or before +#ifndef _WIN32_WCE + void SetLogFont(LPLOGFONT lplf) + { + ATLASSERT(lplf != NULL); +#ifndef WM_CHOOSEFONT_SETLOGFONT + const UINT WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101); +#endif + if(m_hWnd != NULL) + { + ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETLOGFONT, 0, (LPARAM)lplf); + } + else + { + m_lf = *lplf; + m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; + } + } + + void SetFlags(DWORD dwFlags) + { +#ifndef WM_CHOOSEFONT_SETFLAGS + const UINT WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102); +#endif + if(m_hWnd != NULL) + { + CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; + cf.Flags = dwFlags; + ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETFLAGS, 0, (LPARAM)&cf); + } + else + { + m_cf.Flags = dwFlags; + } + } +#endif // !_WIN32_WCE + + // Helpers for parsing information after successful return + LPCTSTR GetFaceName() const // return the face name of the font + { + return (LPCTSTR)m_cf.lpLogFont->lfFaceName; + } + + LPCTSTR GetStyleName() const // return the style name of the font + { + return m_cf.lpszStyle; + } + + int GetSize() const // return the pt size of the font + { + return m_cf.iPointSize; + } + + COLORREF GetColor() const // return the color of the font + { + return m_cf.rgbColors; + } + + int GetWeight() const // return the chosen font weight + { + return (int)m_cf.lpLogFont->lfWeight; + } + + BOOL IsStrikeOut() const // return TRUE if strikeout + { + return (m_cf.lpLogFont->lfStrikeOut) ? TRUE : FALSE; + } + + BOOL IsUnderline() const // return TRUE if underline + { + return (m_cf.lpLogFont->lfUnderline) ? TRUE : FALSE; + } + + BOOL IsBold() const // return TRUE if bold font + { + return (m_cf.lpLogFont->lfWeight == FW_BOLD) ? TRUE : FALSE; + } + + BOOL IsItalic() const // return TRUE if italic font + { + return m_cf.lpLogFont->lfItalic ? TRUE : FALSE; + } +}; + +class CFontDialog : public CFontDialogImpl +{ +public: + CFontDialog(LPLOGFONT lplfInitial = NULL, + DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, + HDC hDCPrinter = NULL, + HWND hWndParent = NULL) + : CFontDialogImpl(lplfInitial, dwFlags, hDCPrinter, hWndParent) + { } + + DECLARE_EMPTY_MSG_MAP() +}; + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CRichEditFontDialogImpl - font selection for the Rich Edit ctrl + +#if defined(_RICHEDIT_) && !defined(_WIN32_WCE) + +template +class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > +{ +public: + CRichEditFontDialogImpl(const CHARFORMAT& charformat, + DWORD dwFlags = CF_SCREENFONTS, + HDC hDCPrinter = NULL, + HWND hWndParent = NULL) + : CFontDialogImpl< T >(NULL, dwFlags, hDCPrinter, hWndParent) + { + m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; + m_cf.Flags |= FillInLogFont(charformat); + m_cf.lpLogFont = &m_lf; + + if((charformat.dwMask & CFM_COLOR) != 0) + m_cf.rgbColors = charformat.crTextColor; + } + + void GetCharFormat(CHARFORMAT& cf) const + { + USES_CONVERSION; + cf.dwEffects = 0; + cf.dwMask = 0; + if((m_cf.Flags & CF_NOSTYLESEL) == 0) + { + cf.dwMask |= CFM_BOLD | CFM_ITALIC; + cf.dwEffects |= IsBold() ? CFE_BOLD : 0; + cf.dwEffects |= IsItalic() ? CFE_ITALIC : 0; + } + if((m_cf.Flags & CF_NOSIZESEL) == 0) + { + cf.dwMask |= CFM_SIZE; + // GetSize() returns in tenths of points so mulitply by 2 to get twips + cf.yHeight = GetSize() * 2; + } + + if((m_cf.Flags & CF_NOFACESEL) == 0) + { + cf.dwMask |= CFM_FACE; + cf.bPitchAndFamily = m_cf.lpLogFont->lfPitchAndFamily; +#if (_RICHEDIT_VER >= 0x0200) + SecureHelper::strcpy_x(cf.szFaceName, _countof(cf.szFaceName), GetFaceName()); +#else // !(_RICHEDIT_VER >= 0x0200) + SecureHelper::strcpyA_x(cf.szFaceName, _countof(cf.szFaceName), T2A((LPTSTR)(LPCTSTR)GetFaceName())); +#endif // !(_RICHEDIT_VER >= 0x0200) + } + + if((m_cf.Flags & CF_EFFECTS) != 0) + { + cf.dwMask |= CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR; + cf.dwEffects |= IsUnderline() ? CFE_UNDERLINE : 0; + cf.dwEffects |= IsStrikeOut() ? CFE_STRIKEOUT : 0; + cf.crTextColor = GetColor(); + } + if((m_cf.Flags & CF_NOSCRIPTSEL) == 0) + { + cf.bCharSet = m_cf.lpLogFont->lfCharSet; + cf.dwMask |= CFM_CHARSET; + } + cf.yOffset = 0; + } + + DWORD FillInLogFont(const CHARFORMAT& cf) + { + USES_CONVERSION; + DWORD dwFlags = 0; + if((cf.dwMask & CFM_SIZE) != 0) + { + HDC hDC = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL); + LONG yPerInch = ::GetDeviceCaps(hDC, LOGPIXELSY); + m_lf.lfHeight = -(int)((cf.yHeight * yPerInch) / 1440); + } + else + m_lf.lfHeight = 0; + + m_lf.lfWidth = 0; + m_lf.lfEscapement = 0; + m_lf.lfOrientation = 0; + + if((cf.dwMask & (CFM_ITALIC | CFM_BOLD)) == (CFM_ITALIC | CFM_BOLD)) + { + m_lf.lfWeight = ((cf.dwEffects & CFE_BOLD) != 0) ? FW_BOLD : FW_NORMAL; + m_lf.lfItalic = (BYTE)(((cf.dwEffects & CFE_ITALIC) != 0) ? TRUE : FALSE); + } + else + { + dwFlags |= CF_NOSTYLESEL; + m_lf.lfWeight = FW_DONTCARE; + m_lf.lfItalic = FALSE; + } + + if((cf.dwMask & (CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR)) == (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) + { + dwFlags |= CF_EFFECTS; + m_lf.lfUnderline = (BYTE)(((cf.dwEffects & CFE_UNDERLINE) != 0) ? TRUE : FALSE); + m_lf.lfStrikeOut = (BYTE)(((cf.dwEffects & CFE_STRIKEOUT) != 0) ? TRUE : FALSE); + } + else + { + m_lf.lfUnderline = (BYTE)FALSE; + m_lf.lfStrikeOut = (BYTE)FALSE; + } + + if((cf.dwMask & CFM_CHARSET) != 0) + m_lf.lfCharSet = cf.bCharSet; + else + dwFlags |= CF_NOSCRIPTSEL; + m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS; + m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + m_lf.lfQuality = DEFAULT_QUALITY; + if((cf.dwMask & CFM_FACE) != 0) + { + m_lf.lfPitchAndFamily = cf.bPitchAndFamily; +#if (_RICHEDIT_VER >= 0x0200) + SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), cf.szFaceName); +#else // !(_RICHEDIT_VER >= 0x0200) + SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), A2T((LPSTR)cf.szFaceName)); +#endif // !(_RICHEDIT_VER >= 0x0200) + } + else + { + m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; + m_lf.lfFaceName[0] = (TCHAR)0; + } + return dwFlags; + } +}; + +class CRichEditFontDialog : public CRichEditFontDialogImpl +{ +public: + CRichEditFontDialog(const CHARFORMAT& charformat, + DWORD dwFlags = CF_SCREENFONTS, + HDC hDCPrinter = NULL, + HWND hWndParent = NULL) + : CRichEditFontDialogImpl(charformat, dwFlags, hDCPrinter, hWndParent) + { } + + DECLARE_EMPTY_MSG_MAP() +}; + +#endif // defined(_RICHEDIT_) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CColorDialogImpl - color selection + +#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) + +#ifdef _WIN32_WCE + #pragma comment(lib, "commdlg.lib") + + #ifndef SETRGBSTRING + #define SETRGBSTRING _T("commdlg_SetRGBColor") + #endif + + #ifndef COLOROKSTRING + #define COLOROKSTRING _T("commdlg_ColorOK") + #endif +#endif + +template +class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase +{ +public: + CHOOSECOLOR m_cc; + +// Constructor + CColorDialogImpl(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) + { + memset(&m_cc, 0, sizeof(m_cc)); + + m_cc.lStructSize = sizeof(m_cc); + m_cc.lpCustColors = GetCustomColors(); + m_cc.hwndOwner = hWndParent; + m_cc.Flags = dwFlags | CC_ENABLEHOOK; + m_cc.lpfnHook = (LPCCHOOKPROC)T::HookProc; + + if(clrInit != 0) + { + m_cc.rgbResult = clrInit; + m_cc.Flags |= CC_RGBINIT; + } + } + +// Operations + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT((m_cc.Flags & CC_ENABLEHOOK) != 0); + ATLASSERT(m_cc.lpfnHook != NULL); // can still be a user hook + + if(m_cc.hwndOwner == NULL) // set only if not specified before + m_cc.hwndOwner = hWndParent; + + ATLASSERT(m_hWnd == NULL); + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); + + BOOL bRet = ::ChooseColor(&m_cc); + + m_hWnd = NULL; + + return bRet ? IDOK : IDCANCEL; + } + + // Set the current color while dialog is displayed + void SetCurrentColor(COLORREF clr) + { + ATLASSERT(::IsWindow(m_hWnd)); + SendMessage(_GetSetRGBMessage(), 0, (LPARAM)clr); + } + + // Get the selected color after DoModal returns, or in OnColorOK + COLORREF GetColor() const + { + return m_cc.rgbResult; + } + +// Special override for the color dialog + static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + if(uMsg != WM_INITDIALOG && uMsg != _GetColorOKMessage()) + return 0; + + LPCHOOSECOLOR lpCC = (LPCHOOSECOLOR)lParam; + CCommonDialogImplBase* pT = NULL; + + if(uMsg == WM_INITDIALOG) + { + pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); + lpCC->lCustData = (LPARAM)pT; + ATLASSERT(pT != NULL); + ATLASSERT(pT->m_hWnd == NULL); + ATLASSERT(::IsWindow(hWnd)); + // subclass dialog's window + if(!pT->SubclassWindow(hWnd)) + { + ATLTRACE2(atlTraceUI, 0, _T("Subclassing a Color common dialog failed\n")); + return 0; + } + } + else if(uMsg == _GetColorOKMessage()) + { + pT = (CCommonDialogImplBase*)lpCC->lCustData; + ATLASSERT(pT != NULL); + ATLASSERT(::IsWindow(pT->m_hWnd)); + } + + // pass to the message map + LRESULT lRes; + if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) + return 0; + return lRes; + } + +// Helpers + static COLORREF* GetCustomColors() + { + static COLORREF rgbCustomColors[16] = + { + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + RGB(255, 255, 255), RGB(255, 255, 255), + }; + + return rgbCustomColors; + } + + static UINT _GetSetRGBMessage() + { + static UINT uSetRGBMessage = 0; + if(uSetRGBMessage == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetSetRGBMessage.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uSetRGBMessage == 0) + uSetRGBMessage = ::RegisterWindowMessage(SETRGBSTRING); + + lock.Unlock(); + } + ATLASSERT(uSetRGBMessage != 0); + return uSetRGBMessage; + } + + static UINT _GetColorOKMessage() + { + static UINT uColorOKMessage = 0; + if(uColorOKMessage == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetColorOKMessage.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uColorOKMessage == 0) + uColorOKMessage = ::RegisterWindowMessage(COLOROKSTRING); + + lock.Unlock(); + } + ATLASSERT(uColorOKMessage != 0); + return uColorOKMessage; + } + +// Message map and handlers + BEGIN_MSG_MAP(CColorDialogImpl) + MESSAGE_HANDLER(_GetColorOKMessage(), _OnColorOK) + END_MSG_MAP() + + LRESULT _OnColorOK(UINT, WPARAM, LPARAM, BOOL&) + { + T* pT = static_cast(this); + return pT->OnColorOK(); + } + +// Overrideable + BOOL OnColorOK() // validate color + { + return FALSE; + } +}; + +class CColorDialog : public CColorDialogImpl +{ +public: + CColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) + : CColorDialogImpl(clrInit, dwFlags, hWndParent) + { } + + // override base class map and references to handlers + DECLARE_EMPTY_MSG_MAP() +}; + +#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) + + +/////////////////////////////////////////////////////////////////////////////// +// CPrintDialogImpl - used for Print... and PrintSetup... + +#ifndef _WIN32_WCE + +// global helper +static HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) +{ + if(hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDevNames = (LPDEVNAMES)::GlobalLock(hDevNames); + LPDEVMODE lpDevMode = (hDevMode != NULL) ? (LPDEVMODE)::GlobalLock(hDevMode) : NULL; + + if(lpDevNames == NULL) + return NULL; + + HDC hDC = ::CreateDC((LPCTSTR)lpDevNames + lpDevNames->wDriverOffset, + (LPCTSTR)lpDevNames + lpDevNames->wDeviceOffset, + (LPCTSTR)lpDevNames + lpDevNames->wOutputOffset, + lpDevMode); + + ::GlobalUnlock(hDevNames); + if(hDevMode != NULL) + ::GlobalUnlock(hDevMode); + return hDC; +} + +template +class ATL_NO_VTABLE CPrintDialogImpl : public CCommonDialogImplBase +{ +public: + // print dialog parameter block (note this is a reference) + PRINTDLG& m_pd; + +// Constructors + CPrintDialogImpl(BOOL bPrintSetupOnly = FALSE, // TRUE for Print Setup, FALSE for Print Dialog + DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, + HWND hWndParent = NULL) + : m_pd(m_pdActual) + { + memset(&m_pdActual, 0, sizeof(m_pdActual)); + + m_pd.lStructSize = sizeof(m_pdActual); + m_pd.hwndOwner = hWndParent; + m_pd.Flags = (dwFlags | PD_ENABLEPRINTHOOK | PD_ENABLESETUPHOOK); + m_pd.lpfnPrintHook = (LPPRINTHOOKPROC)T::HookProc; + m_pd.lpfnSetupHook = (LPSETUPHOOKPROC)T::HookProc; + + if(bPrintSetupOnly) + m_pd.Flags |= PD_PRINTSETUP; + else + m_pd.Flags |= PD_RETURNDC; + + m_pd.Flags &= ~PD_RETURNIC; // do not support information context + } + +// Operations + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT((m_pd.Flags & PD_ENABLEPRINTHOOK) != 0); + ATLASSERT((m_pd.Flags & PD_ENABLESETUPHOOK) != 0); + ATLASSERT(m_pd.lpfnPrintHook != NULL); // can still be a user hook + ATLASSERT(m_pd.lpfnSetupHook != NULL); // can still be a user hook + ATLASSERT((m_pd.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this + + if(m_pd.hwndOwner == NULL) // set only if not specified before + m_pd.hwndOwner = hWndParent; + + ATLASSERT(m_hWnd == NULL); + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); + + BOOL bRet = ::PrintDlg(&m_pd); + + m_hWnd = NULL; + + return bRet ? IDOK : IDCANCEL; + } + + // GetDefaults will not display a dialog but will get device defaults + BOOL GetDefaults() + { + m_pd.Flags |= PD_RETURNDEFAULT; + ATLASSERT(m_pd.hDevMode == NULL); // must be NULL + ATLASSERT(m_pd.hDevNames == NULL); // must be NULL + + return ::PrintDlg(&m_pd); + } + + // Helpers for parsing information after successful return num. copies requested + int GetCopies() const + { + if((m_pd.Flags & PD_USEDEVMODECOPIES) != 0) + { + LPDEVMODE lpDevMode = GetDevMode(); + return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; + } + + return m_pd.nCopies; + } + + BOOL PrintCollate() const // TRUE if collate checked + { + return ((m_pd.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; + } + + BOOL PrintSelection() const // TRUE if printing selection + { + return ((m_pd.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; + } + + BOOL PrintAll() const // TRUE if printing all pages + { + return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; + } + + BOOL PrintRange() const // TRUE if printing page range + { + return ((m_pd.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; + } + + BOOL PrintToFile() const // TRUE if printing to a file + { + return ((m_pd.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; + } + + int GetFromPage() const // starting page if valid + { + return PrintRange() ? m_pd.nFromPage : -1; + } + + int GetToPage() const // ending page if valid + { + return PrintRange() ? m_pd.nToPage : -1; + } + + LPDEVMODE GetDevMode() const // return DEVMODE + { + if(m_pd.hDevMode == NULL) + return NULL; + + return (LPDEVMODE)::GlobalLock(m_pd.hDevMode); + } + + LPCTSTR GetDriverName() const // return driver name + { + if(m_pd.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); + if(lpDev == NULL) + return NULL; + + return (LPCTSTR)lpDev + lpDev->wDriverOffset; + } + + LPCTSTR GetDeviceName() const // return device name + { + if(m_pd.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); + if(lpDev == NULL) + return NULL; + + return (LPCTSTR)lpDev + lpDev->wDeviceOffset; + } + + LPCTSTR GetPortName() const // return output port name + { + if(m_pd.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); + if(lpDev == NULL) + return NULL; + + return (LPCTSTR)lpDev + lpDev->wOutputOffset; + } + + HDC GetPrinterDC() const // return HDC (caller must delete) + { + ATLASSERT((m_pd.Flags & PD_RETURNDC) != 0); + return m_pd.hDC; + } + + // This helper creates a DC based on the DEVNAMES and DEVMODE structures. + // This DC is returned, but also stored in m_pd.hDC as though it had been + // returned by CommDlg. It is assumed that any previously obtained DC + // has been/will be deleted by the user. This may be + // used without ever invoking the print/print setup dialogs. + HDC CreatePrinterDC() + { + m_pd.hDC = _AtlCreateDC(m_pd.hDevNames, m_pd.hDevMode); + return m_pd.hDC; + } + +// Implementation + PRINTDLG m_pdActual; // the Print/Print Setup need to share this + + // The following handle the case of print setup... from the print dialog + CPrintDialogImpl(PRINTDLG& pdInit) : m_pd(pdInit) + { } + + BEGIN_MSG_MAP(CPrintDialogImpl) +#ifdef psh1 + COMMAND_ID_HANDLER(psh1, OnPrintSetup) // print setup button when print is displayed +#else // !psh1 + COMMAND_ID_HANDLER(0x0400, OnPrintSetup) // value from dlgs.h +#endif // !psh1 + END_MSG_MAP() + + LRESULT OnPrintSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/) + { + T dlgSetup(m_pd); + ModuleHelper::AddCreateWndData(&dlgSetup.m_thunk.cd, (CCommonDialogImplBase*)&dlgSetup); + return DefWindowProc(WM_COMMAND, MAKEWPARAM(wID, wNotifyCode), (LPARAM)hWndCtl); + } +}; + +class CPrintDialog : public CPrintDialogImpl +{ +public: + CPrintDialog(BOOL bPrintSetupOnly = FALSE, + DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, + HWND hWndParent = NULL) + : CPrintDialogImpl(bPrintSetupOnly, dwFlags, hWndParent) + { } + + CPrintDialog(PRINTDLG& pdInit) : CPrintDialogImpl(pdInit) + { } +}; + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CPrintDialogExImpl - new print dialog for Windows 2000 + +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + +}; // namespace WTL + +#include + +extern "C" const __declspec(selectany) IID IID_IPrintDialogCallback = {0x5852a2c3, 0x6530, 0x11d1, {0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; +extern "C" const __declspec(selectany) IID IID_IPrintDialogServices = {0x509aaeda, 0x5639, 0x11d1, {0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; + +namespace WTL +{ + +template +class ATL_NO_VTABLE CPrintDialogExImpl : + public ATL::CWindow, + public ATL::CMessageMap, + public IPrintDialogCallback, + public ATL::IObjectWithSiteImpl< T > +{ +public: + PRINTDLGEX m_pdex; + +// Constructor + CPrintDialogExImpl(DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, + HWND hWndParent = NULL) + { + memset(&m_pdex, 0, sizeof(m_pdex)); + + m_pdex.lStructSize = sizeof(PRINTDLGEX); + m_pdex.hwndOwner = hWndParent; + m_pdex.Flags = dwFlags; + m_pdex.nStartPage = START_PAGE_GENERAL; + // callback object will be set in DoModal + + m_pdex.Flags &= ~PD_RETURNIC; // do not support information context + } + +// Operations + HRESULT DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT(m_hWnd == NULL); + ATLASSERT((m_pdex.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this + + if(m_pdex.hwndOwner == NULL) // set only if not specified before + m_pdex.hwndOwner = hWndParent; + + T* pT = static_cast(this); + m_pdex.lpCallback = (IUnknown*)(IPrintDialogCallback*)pT; + + HRESULT hResult = ::PrintDlgEx(&m_pdex); + + m_hWnd = NULL; + + return hResult; + } + + BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); + return TRUE; + } + + // GetDefaults will not display a dialog but will get device defaults + HRESULT GetDefaults() + { + m_pdex.Flags |= PD_RETURNDEFAULT; + ATLASSERT(m_pdex.hDevMode == NULL); // must be NULL + ATLASSERT(m_pdex.hDevNames == NULL); // must be NULL + + return ::PrintDlgEx(&m_pdex); + } + + // Helpers for parsing information after successful return num. copies requested + int GetCopies() const + { + if((m_pdex.Flags & PD_USEDEVMODECOPIES) != 0) + { + LPDEVMODE lpDevMode = GetDevMode(); + return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; + } + + return m_pdex.nCopies; + } + + BOOL PrintCollate() const // TRUE if collate checked + { + return ((m_pdex.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; + } + + BOOL PrintSelection() const // TRUE if printing selection + { + return ((m_pdex.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; + } + + BOOL PrintAll() const // TRUE if printing all pages + { + return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; + } + + BOOL PrintRange() const // TRUE if printing page range + { + return ((m_pdex.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; + } + + BOOL PrintToFile() const // TRUE if printing to a file + { + return ((m_pdex.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; + } + + LPDEVMODE GetDevMode() const // return DEVMODE + { + if(m_pdex.hDevMode == NULL) + return NULL; + + return (LPDEVMODE)::GlobalLock(m_pdex.hDevMode); + } + + LPCTSTR GetDriverName() const // return driver name + { + if(m_pdex.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); + if(lpDev == NULL) + return NULL; + + return (LPCTSTR)lpDev + lpDev->wDriverOffset; + } + + LPCTSTR GetDeviceName() const // return device name + { + if(m_pdex.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); + if(lpDev == NULL) + return NULL; + + return (LPCTSTR)lpDev + lpDev->wDeviceOffset; + } + + LPCTSTR GetPortName() const // return output port name + { + if(m_pdex.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); + if(lpDev == NULL) + return NULL; + + return (LPCTSTR)lpDev + lpDev->wOutputOffset; + } + + HDC GetPrinterDC() const // return HDC (caller must delete) + { + ATLASSERT((m_pdex.Flags & PD_RETURNDC) != 0); + return m_pdex.hDC; + } + + // This helper creates a DC based on the DEVNAMES and DEVMODE structures. + // This DC is returned, but also stored in m_pdex.hDC as though it had been + // returned by CommDlg. It is assumed that any previously obtained DC + // has been/will be deleted by the user. This may be + // used without ever invoking the print/print setup dialogs. + HDC CreatePrinterDC() + { + m_pdex.hDC = _AtlCreateDC(m_pdex.hDevNames, m_pdex.hDevMode); + return m_pdex.hDC; + } + +// Implementation - interfaces + +// IUnknown + STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) + { + if(ppvObject == NULL) + return E_POINTER; + + T* pT = static_cast(this); + if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IPrintDialogCallback)) + { + *ppvObject = (IPrintDialogCallback*)pT; + // AddRef() not needed + return S_OK; + } + else if(IsEqualGUID(riid, IID_IObjectWithSite)) + { + *ppvObject = (IObjectWithSite*)pT; + // AddRef() not needed + return S_OK; + } + + return E_NOINTERFACE; + } + + virtual ULONG STDMETHODCALLTYPE AddRef() + { + return 1; + } + + virtual ULONG STDMETHODCALLTYPE Release() + { + return 1; + } + +// IPrintDialogCallback + STDMETHOD(InitDone)() + { + return S_FALSE; + } + + STDMETHOD(SelectionChange)() + { + return S_FALSE; + } + + STDMETHOD(HandleMessage)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* plResult) + { + // set up m_hWnd the first time + if(m_hWnd == NULL) + Attach(hWnd); + + // call message map + HRESULT hRet = ProcessWindowMessage(hWnd, uMsg, wParam, lParam, *plResult, 0) ? S_OK : S_FALSE; + if(hRet == S_OK && uMsg == WM_NOTIFY) // return in DWLP_MSGRESULT + ::SetWindowLongPtr(GetParent(), DWLP_MSGRESULT, (LONG_PTR)*plResult); + + if(uMsg == WM_INITDIALOG && hRet == S_OK && (BOOL)*plResult != FALSE) + hRet = S_FALSE; + + return hRet; + } +}; + +class CPrintDialogEx : public CPrintDialogExImpl +{ +public: + CPrintDialogEx( + DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, + HWND hWndParent = NULL) + : CPrintDialogExImpl(dwFlags, hWndParent) + { } + + DECLARE_EMPTY_MSG_MAP() +}; + +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CPageSetupDialogImpl - Page Setup dialog + +#ifndef _WIN32_WCE + +template +class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase +{ +public: + PAGESETUPDLG m_psd; + ATL::CWndProcThunk m_thunkPaint; + +// Constructors + CPageSetupDialogImpl(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) + { + memset(&m_psd, 0, sizeof(m_psd)); + + m_psd.lStructSize = sizeof(m_psd); + m_psd.hwndOwner = hWndParent; + m_psd.Flags = (dwFlags | PSD_ENABLEPAGESETUPHOOK | PSD_ENABLEPAGEPAINTHOOK); + m_psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)T::HookProc; + m_thunkPaint.Init((WNDPROC)T::PaintHookProc, this); +#if (_ATL_VER >= 0x0700) + m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)m_thunkPaint.GetWNDPROC(); +#else + m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)&(m_thunkPaint.thunk); +#endif + } + + DECLARE_EMPTY_MSG_MAP() + +// Attributes + LPDEVMODE GetDevMode() const // return DEVMODE + { + if(m_psd.hDevMode == NULL) + return NULL; + + return (LPDEVMODE)::GlobalLock(m_psd.hDevMode); + } + + LPCTSTR GetDriverName() const // return driver name + { + if(m_psd.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); + return (LPCTSTR)lpDev + lpDev->wDriverOffset; + } + + LPCTSTR GetDeviceName() const // return device name + { + if(m_psd.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); + return (LPCTSTR)lpDev + lpDev->wDeviceOffset; + } + + LPCTSTR GetPortName() const // return output port name + { + if(m_psd.hDevNames == NULL) + return NULL; + + LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); + return (LPCTSTR)lpDev + lpDev->wOutputOffset; + } + + HDC CreatePrinterDC() + { + return _AtlCreateDC(m_psd.hDevNames, m_psd.hDevMode); + } + + SIZE GetPaperSize() const + { + SIZE size; + size.cx = m_psd.ptPaperSize.x; + size.cy = m_psd.ptPaperSize.y; + return size; + } + + void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const + { + if(lpRectMargins != NULL) + *lpRectMargins = m_psd.rtMargin; + if(lpRectMinMargins != NULL) + *lpRectMinMargins = m_psd.rtMinMargin; + } + +// Operations + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT((m_psd.Flags & PSD_ENABLEPAGESETUPHOOK) != 0); + ATLASSERT((m_psd.Flags & PSD_ENABLEPAGEPAINTHOOK) != 0); + ATLASSERT(m_psd.lpfnPageSetupHook != NULL); // can still be a user hook + ATLASSERT(m_psd.lpfnPagePaintHook != NULL); // can still be a user hook + + if(m_psd.hwndOwner == NULL) // set only if not specified before + m_psd.hwndOwner = hWndParent; + + ATLASSERT(m_hWnd == NULL); + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); + + BOOL bRet = ::PageSetupDlg(&m_psd); + + m_hWnd = NULL; + + return bRet ? IDOK : IDCANCEL; + } + +// Implementation + static UINT_PTR CALLBACK PaintHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + T* pT = (T*)hWnd; + UINT_PTR uRet = 0; + switch(uMsg) + { + case WM_PSD_PAGESETUPDLG: + uRet = pT->PreDrawPage(LOWORD(wParam), HIWORD(wParam), (LPPAGESETUPDLG)lParam); + break; + case WM_PSD_FULLPAGERECT: + case WM_PSD_MINMARGINRECT: + case WM_PSD_MARGINRECT: + case WM_PSD_GREEKTEXTRECT: + case WM_PSD_ENVSTAMPRECT: + case WM_PSD_YAFULLPAGERECT: + uRet = pT->OnDrawPage(uMsg, (HDC)wParam, (LPRECT)lParam); + break; + default: + ATLTRACE2(atlTraceUI, 0, _T("CPageSetupDialogImpl::PaintHookProc - unknown message received\n")); + break; + } + return uRet; + } + +// Overridables + UINT_PTR PreDrawPage(WORD /*wPaper*/, WORD /*wFlags*/, LPPAGESETUPDLG /*pPSD*/) + { + // return 1 to prevent any more drawing + return 0; + } + + UINT_PTR OnDrawPage(UINT /*uMsg*/, HDC /*hDC*/, LPRECT /*lpRect*/) + { + return 0; // do the default + } +}; + +class CPageSetupDialog : public CPageSetupDialogImpl +{ +public: + CPageSetupDialog(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) + : CPageSetupDialogImpl(dwFlags, hWndParent) + { } + + // override PaintHookProc and references to handlers + static UINT_PTR CALLBACK PaintHookProc(HWND, UINT, WPARAM, LPARAM) + { + return 0; + } +}; + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CFindReplaceDialogImpl - Find/FindReplace modeless dialogs + +#ifndef _WIN32_WCE + +template +class ATL_NO_VTABLE CFindReplaceDialogImpl : public CCommonDialogImplBase +{ +public: + enum { _cchFindReplaceBuffer = 128 }; + + FINDREPLACE m_fr; + TCHAR m_szFindWhat[_cchFindReplaceBuffer]; + TCHAR m_szReplaceWith[_cchFindReplaceBuffer]; + +// Constructors + CFindReplaceDialogImpl() + { + memset(&m_fr, 0, sizeof(m_fr)); + m_szFindWhat[0] = _T('\0'); + m_szReplaceWith[0] = _T('\0'); + + m_fr.lStructSize = sizeof(m_fr); + m_fr.Flags = FR_ENABLEHOOK; + m_fr.lpfnHook = (LPFRHOOKPROC)T::HookProc; + m_fr.lpstrFindWhat = (LPTSTR)m_szFindWhat; + m_fr.wFindWhatLen = _cchFindReplaceBuffer; + m_fr.lpstrReplaceWith = (LPTSTR)m_szReplaceWith; + m_fr.wReplaceWithLen = _cchFindReplaceBuffer; + } + + // Note: You must allocate the object on the heap. + // If you do not, you must override OnFinalMessage() + virtual void OnFinalMessage(HWND /*hWnd*/) + { + delete this; + } + + HWND Create(BOOL bFindDialogOnly, // TRUE for Find, FALSE for FindReplace + LPCTSTR lpszFindWhat, + LPCTSTR lpszReplaceWith = NULL, + DWORD dwFlags = FR_DOWN, + HWND hWndParent = NULL) + { + ATLASSERT((m_fr.Flags & FR_ENABLEHOOK) != 0); + ATLASSERT(m_fr.lpfnHook != NULL); + + m_fr.Flags |= dwFlags; + + if(hWndParent == NULL) + m_fr.hwndOwner = ::GetActiveWindow(); + else + m_fr.hwndOwner = hWndParent; + ATLASSERT(m_fr.hwndOwner != NULL); // must have an owner for modeless dialog + + if(lpszFindWhat != NULL) + SecureHelper::strncpy_x(m_szFindWhat, _countof(m_szFindWhat), lpszFindWhat, _TRUNCATE); + + if(lpszReplaceWith != NULL) + SecureHelper::strncpy_x(m_szReplaceWith, _countof(m_szReplaceWith), lpszReplaceWith, _TRUNCATE); + + ATLASSERT(m_hWnd == NULL); + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); + + HWND hWnd = NULL; + if(bFindDialogOnly) + hWnd = ::FindText(&m_fr); + else + hWnd = ::ReplaceText(&m_fr); + + ATLASSERT(m_hWnd == hWnd); + return hWnd; + } + + static const UINT GetFindReplaceMsg() + { + static const UINT nMsgFindReplace = ::RegisterWindowMessage(FINDMSGSTRING); + return nMsgFindReplace; + } + // call while handling FINDMSGSTRING registered message + // to retreive the object + static T* PASCAL GetNotifier(LPARAM lParam) + { + ATLASSERT(lParam != NULL); + T* pDlg = (T*)(lParam - offsetof(T, m_fr)); + return pDlg; + } + +// Operations + // Helpers for parsing information after successful return + LPCTSTR GetFindString() const // get find string + { + return (LPCTSTR)m_fr.lpstrFindWhat; + } + + LPCTSTR GetReplaceString() const // get replacement string + { + return (LPCTSTR)m_fr.lpstrReplaceWith; + } + + BOOL SearchDown() const // TRUE if search down, FALSE is up + { + return ((m_fr.Flags & FR_DOWN) != 0) ? TRUE : FALSE; + } + + BOOL FindNext() const // TRUE if command is find next + { + return ((m_fr.Flags & FR_FINDNEXT) != 0) ? TRUE : FALSE; + } + + BOOL MatchCase() const // TRUE if matching case + { + return ((m_fr.Flags & FR_MATCHCASE) != 0) ? TRUE : FALSE; + } + + BOOL MatchWholeWord() const // TRUE if matching whole words only + { + return ((m_fr.Flags & FR_WHOLEWORD) != 0) ? TRUE : FALSE; + } + + BOOL ReplaceCurrent() const // TRUE if replacing current string + { + return ((m_fr. Flags & FR_REPLACE) != 0) ? TRUE : FALSE; + } + + BOOL ReplaceAll() const // TRUE if replacing all occurrences + { + return ((m_fr.Flags & FR_REPLACEALL) != 0) ? TRUE : FALSE; + } + + BOOL IsTerminating() const // TRUE if terminating dialog + { + return ((m_fr.Flags & FR_DIALOGTERM) != 0) ? TRUE : FALSE ; + } +}; + +class CFindReplaceDialog : public CFindReplaceDialogImpl +{ +public: + DECLARE_EMPTY_MSG_MAP() +}; + +#endif // !_WIN32_WCE + + +#if (_ATL_VER >= 0x800) +typedef ATL::_DialogSplitHelper::DLGTEMPLATEEX DLGTEMPLATEEX; +typedef ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX DLGITEMTEMPLATEEX; +#else // (_ATL_VER >= 0x800) +typedef ATL::_DialogSizeHelper::_ATL_DLGTEMPLATEEX DLGTEMPLATEEX; +#pragma pack(push, 4) +struct DLGITEMTEMPLATEEX +{ + DWORD helpID; + DWORD exStyle; + DWORD style; + short x; + short y; + short cx; + short cy; + WORD id; +}; +#pragma pack(pop) +#endif // (_ATL_VER >= 0x800) + + +/////////////////////////////////////////////////////////////////////////////// +// CMemDlgTemplate - in-memory dialog template - DLGTEMPLATE or DLGTEMPLATEEX + +class CMemDlgTemplate +{ +public: + enum StdCtrlType + { + CTRL_BUTTON = 0x0080, + CTRL_EDIT = 0x0081, + CTRL_STATIC = 0x0082, + CTRL_LISTBOX = 0x0083, + CTRL_SCROLLBAR = 0x0084, + CTRL_COMBOBOX = 0x0085 + }; + + CMemDlgTemplate() : m_pData(NULL), m_pPtr(NULL), m_cAllocated(0) + { } + + ~CMemDlgTemplate() + { + Reset(); + } + + bool IsValid() const + { + return (m_pData != NULL); + } + + bool IsTemplateEx() const + { + return (IsValid() && ((DLGTEMPLATEEX*)m_pData)->signature == 0xFFFF); + } + + LPDLGTEMPLATE GetTemplatePtr() + { + return reinterpret_cast(m_pData); + } + + DLGTEMPLATEEX* GetTemplateExPtr() + { + return reinterpret_cast(m_pData); + } + + void Reset() + { + if (IsValid()) + ATLVERIFY(::GlobalFree(m_pData) == NULL); + + m_pData = NULL; + m_pPtr = NULL; + m_cAllocated = 0; + } + + void Create(bool bDlgEx, LPCTSTR lpszCaption, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle = 0, DWORD dwExStyle = 0, + LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, + ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) + { + // Should have DS_SETFONT style to set the dialog font name and size + if (lpstrFontName != NULL) + { + dwStyle |= DS_SETFONT; + } + else + { + dwStyle &= ~DS_SETFONT; + } + + if (bDlgEx) + { + DLGTEMPLATEEX dlg = {1, 0xFFFF, dwHelpID, dwExStyle, dwStyle, 0, nX, nY, nWidth, nHeight}; + AddData(&dlg, sizeof(dlg)); + } + else + { + DLGTEMPLATE dlg = {dwStyle, dwExStyle, 0, nX, nY, nWidth, nHeight}; + AddData(&dlg, sizeof(dlg)); + } + +#ifndef _WIN32_WCE + if (Menu.m_lpstr == NULL) + { + WORD menuData = 0; + AddData(&menuData, sizeof(WORD)); + } + else if (IS_INTRESOURCE(Menu.m_lpstr)) + { + WORD menuData[] = {0xFFFF, (WORD)Menu.m_lpstr}; + AddData(menuData, sizeof(menuData)); + } + else + { + AddString(Menu.m_lpstr); + } +#else // _WIN32_WCE + // Windows CE doesn't support the addition of menus to a dialog box + ATLASSERT(Menu.m_lpstr == NULL); + Menu.m_lpstr; // avoid level 4 warning + WORD menuData = 0; + AddData(&menuData, sizeof(WORD)); +#endif // _WIN32_WCE + + if (ClassName.m_lpstr == NULL) + { + WORD classData = 0; + AddData(&classData, sizeof(WORD)); + } + else if (IS_INTRESOURCE(ClassName.m_lpstr)) + { + WORD classData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; + AddData(classData, sizeof(classData)); + } + else + { + AddString(ClassName.m_lpstr); + } + + // Set dialog caption + AddString(lpszCaption); + + if (lpstrFontName != NULL) + { + AddData(&wFontSize, sizeof(wFontSize)); + + if (bDlgEx) + { + AddData(&wWeight, sizeof(wWeight)); + AddData(&bItalic, sizeof(bItalic)); + AddData(&bCharset, sizeof(bCharset)); + } + + AddString(lpstrFontName); + } + } + + void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle, DWORD dwExStyle, + ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) + { + ATLASSERT(IsValid()); + + // DWORD align data + m_pPtr = (LPBYTE)(DWORD_PTR)((DWORD)(DWORD_PTR)(m_pPtr + 3) & (~3)); + + if (IsTemplateEx()) + { + DLGTEMPLATEEX* dlg = (DLGTEMPLATEEX*)m_pData; + dlg->cDlgItems++; + + DLGITEMTEMPLATEEX item = {dwHelpID, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, nX, nY, nWidth, nHeight, wId}; + AddData(&item, sizeof(item)); + } + else + { + LPDLGTEMPLATE dlg = (LPDLGTEMPLATE)m_pData; + dlg->cdit++; + + DLGITEMTEMPLATE item = {ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, nX, nY, nWidth, nHeight, wId}; + AddData(&item, sizeof(item)); + } + + ATLASSERT(ClassName.m_lpstr != NULL); + if (IS_INTRESOURCE(ClassName.m_lpstr)) + { + WORD wData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; + AddData(wData, sizeof(wData)); + } + else + { + AddString(ClassName.m_lpstr); + } + + if (Text.m_lpstr == NULL) + { + WORD classData = 0; + AddData(&classData, sizeof(WORD)); + } + else if (IS_INTRESOURCE(Text.m_lpstr)) + { + WORD wData[] = {0xFFFF, (WORD)Text.m_lpstr}; + AddData(wData, sizeof(wData)); + } + else + { + AddString(Text.m_lpstr); + } + + AddData(&nCreationData, sizeof(nCreationData)); + + if ((nCreationData != 0)) + { + ATLASSERT(pCreationData != NULL); + AddData(pCreationData, nCreationData * sizeof(WORD)); + } + } + + void AddStdControl(StdCtrlType CtrlType, WORD wId, short nX, short nY, short nWidth, short nHeight, + DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) + { + AddControl(CtrlType, wId, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, Text, pCreationData, nCreationData, dwHelpID); + } + +protected: + void AddData(LPCVOID pData, size_t nData) + { + ATLASSERT(pData != NULL); + + const size_t ALLOCATION_INCREMENT = 1024; + + if (m_pData == NULL) + { + m_cAllocated = ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; + m_pPtr = m_pData = static_cast(::GlobalAlloc(GPTR, m_cAllocated)); + ATLASSERT(m_pData != NULL); + } + else if (((m_pPtr - m_pData) + nData) > m_cAllocated) + { + size_t ptrPos = (m_pPtr - m_pData); + m_cAllocated += ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; + m_pData = static_cast(::GlobalReAlloc(m_pData, m_cAllocated, 0)); + ATLASSERT(m_pData != NULL); + m_pPtr = m_pData + ptrPos; + } + + SecureHelper::memcpy_x(m_pPtr, m_cAllocated - (m_pPtr - m_pData), pData, nData); + + m_pPtr += nData; + } + + void AddString(LPCTSTR lpszStr) + { + if (lpszStr == NULL) + { + WCHAR szEmpty = 0; + AddData(&szEmpty, sizeof(szEmpty)); + } + else + { + USES_CONVERSION; + LPCWSTR lpstr = T2CW(lpszStr); + int nSize = lstrlenW(lpstr) + 1; + AddData(lpstr, nSize * sizeof(WCHAR)); + } + } + + LPBYTE m_pData; + LPBYTE m_pPtr; + SIZE_T m_cAllocated; +}; + + +/////////////////////////////////////////////////////////////////////////////// +// Dialog and control macros for indirect dialogs + +// for DLGTEMPLATE +#define BEGIN_DIALOG(x, y, width, height) \ + void DoInitTemplate() \ + { \ + bool bExTemplate = false; \ + short nX = x, nY = y, nWidth = width, nHeight = height; \ + LPCTSTR szCaption = NULL; \ + DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ + DWORD dwExStyle = 0; \ + LPCTSTR szFontName = NULL; \ + WORD wFontSize = 0; \ + WORD wWeight = 0; \ + BYTE bItalic = 0; \ + BYTE bCharset = 0; \ + DWORD dwHelpID = 0; \ + ATL::_U_STRINGorID Menu = 0U; \ + ATL::_U_STRINGorID ClassName = 0U; + +// for DLGTEMPLATEEX +#define BEGIN_DIALOG_EX(x, y, width, height, helpID) \ + void DoInitTemplate() \ + { \ + bool bExTemplate = true; \ + short nX = x, nY = y, nWidth = width, nHeight = height; \ + LPCTSTR szCaption = NULL; \ + DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ + DWORD dwExStyle = 0; \ + LPCTSTR szFontName = NULL; \ + WORD wFontSize = 0; \ + WORD wWeight = 0; \ + BYTE bItalic = 0; \ + BYTE bCharset = 0; \ + DWORD dwHelpID = helpID; \ + ATL::_U_STRINGorID Menu = 0U; \ + ATL::_U_STRINGorID ClassName = 0U; + +#define END_DIALOG() \ + m_Template.Create(bExTemplate, szCaption, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, szFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName, Menu); \ + }; + +#define DIALOG_CAPTION(caption) \ + szCaption = caption; +#define DIALOG_STYLE(style) \ + dwStyle = style; +#define DIALOG_EXSTYLE(exStyle) \ + dwExStyle = exStyle; +#define DIALOG_FONT(pointSize, typeFace) \ + wFontSize = pointSize; \ + szFontName = typeFace; +#define DIALOG_FONT_EX(pointsize, typeface, weight, italic, charset) \ + ATLASSERT(bExTemplate); \ + wFontSize = pointsize; \ + szFontName = typeface; \ + wWeight = weight; \ + bItalic = italic; \ + bCharset = charset; +#define DIALOG_MENU(menuName) \ + Menu = menuName; +#define DIALOG_CLASS(className) \ + ClassName = className; + +#define BEGIN_CONTROLS_MAP() \ + void DoInitControls() \ + { + +#define END_CONTROLS_MAP() \ + }; + + +#define CONTROL_LTEXT(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_LEFT | WS_GROUP, exStyle, text, NULL, 0); +#define CONTROL_CTEXT(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_CENTER | WS_GROUP, exStyle, text, NULL, 0); +#define CONTROL_RTEXT(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_RIGHT | WS_GROUP, exStyle, text, NULL, 0); +#define CONTROL_PUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_DEFPUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_DEFPUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); +#ifndef _WIN32_WCE +#define CONTROL_PUSHBOX(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBOX | WS_TABSTOP, exStyle, text, NULL, 0); +#endif // !_WIN32_WCE +#define CONTROL_STATE3(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_3STATE | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_AUTO3STATE(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTO3STATE | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_CHECKBOX(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_CHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_AUTOCHECKBOX(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTOCHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_RADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_RADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_AUTORADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTORADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); +#define CONTROL_COMBOBOX(id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_COMBOBOX, (WORD)id, x, y, width, height, style | CBS_DROPDOWN | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); +#define CONTROL_EDITTEXT(id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_EDIT, (WORD)id, x, y, width, height, style | ES_LEFT | WS_BORDER | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); +#define CONTROL_GROUPBOX(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_GROUPBOX, exStyle, text, NULL, 0); +#define CONTROL_LISTBOX(id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_LISTBOX, (WORD)id, x, y, width, height, style | LBS_NOTIFY | WS_BORDER, exStyle, (LPCTSTR)NULL, NULL, 0); +#define CONTROL_SCROLLBAR(id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_SCROLLBAR, (WORD)id, x, y, width, height, style | SBS_HORZ, exStyle, (LPCTSTR)NULL, NULL, 0); +#define CONTROL_ICON(text, id, x, y, width, height, style, exStyle) \ + m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_ICON, exStyle, text, NULL, 0); +#define CONTROL_CONTROL(text, id, className, style, x, y, width, height, exStyle) \ + m_Template.AddControl(className, (WORD)id, x, y, width, height, style, exStyle, text, NULL, 0); + + +/////////////////////////////////////////////////////////////////////////////// +// CIndirectDialogImpl - dialogs with template in memory + +template > +class ATL_NO_VTABLE CIndirectDialogImpl : public TBase +{ +public: + enum { IDD = 0 }; // no dialog template resource + + TDlgTemplate m_Template; + + void CreateTemplate() + { + T* pT = static_cast(this); + pT->DoInitTemplate(); + pT->DoInitControls(); + } + + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_hWnd == NULL); + + if (!m_Template.IsValid()) + CreateTemplate(); + +#if (_ATL_VER >= 0x0800) + // Allocate the thunk structure here, where we can fail gracefully. + BOOL result = m_thunk.Init(NULL, NULL); + if (result == FALSE) + { + SetLastError(ERROR_OUTOFMEMORY); + return -1; + } +#endif // (_ATL_VER >= 0x0800) + + ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); + +#ifdef _DEBUG + m_bModal = true; +#endif // _DEBUG + + return ::DialogBoxIndirectParam(ModuleHelper::GetResourceInstance(), m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); + } + + HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) + { + T* pT = static_cast(this); + ATLASSERT(pT->m_hWnd == NULL); + + if (!m_Template.IsValid()) + CreateTemplate(); + +#if (_ATL_VER >= 0x0800) + // Allocate the thunk structure here, where we can fail gracefully. + BOOL result = m_thunk.Init(NULL, NULL); + if (result == FALSE) + { + SetLastError(ERROR_OUTOFMEMORY); + return NULL; + } +#endif // (_ATL_VER >= 0x0800) + + ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); + +#ifdef _DEBUG + m_bModal = false; +#endif // _DEBUG + + HWND hWnd = ::CreateDialogIndirectParam(ModuleHelper::GetResourceInstance(), (LPCDLGTEMPLATE)m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); + ATLASSERT(m_hWnd == hWnd); + + return hWnd; + } + + // for CComControl + HWND Create(HWND hWndParent, RECT&, LPARAM dwInitParam = NULL) + { + return Create(hWndParent, dwInitParam); + } + + void DoInitTemplate() + { + ATLASSERT(FALSE); // MUST be defined in derived class + } + + void DoInitControls() + { + ATLASSERT(FALSE); // MUST be defined in derived class + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CPropertySheetWindow - client side for a property sheet + +class CPropertySheetWindow : public ATL::CWindow +{ +public: +// Constructors + CPropertySheetWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) + { } + + CPropertySheetWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Attributes + int GetPageCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HWND hWndTabCtrl = GetTabControl(); + ATLASSERT(hWndTabCtrl != NULL); + return (int)::SendMessage(hWndTabCtrl, TCM_GETITEMCOUNT, 0, 0L); + } + + HWND GetActivePage() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0L); + } + + int GetActiveIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + HWND hWndTabCtrl = GetTabControl(); + ATLASSERT(hWndTabCtrl != NULL); + return (int)::SendMessage(hWndTabCtrl, TCM_GETCURSEL, 0, 0L); + } + + BOOL SetActivePage(int nPageIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, nPageIndex, 0L); + } + + BOOL SetActivePage(HPROPSHEETPAGE hPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hPage != NULL); + return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, 0, (LPARAM)hPage); + } + + BOOL SetActivePageByID(int nPageID) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSELID, 0, nPageID); + } + + void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid + ATLASSERT(lpszText != NULL); + ::SendMessage(m_hWnd, PSM_SETTITLE, nStyle, (LPARAM)lpszText); + } + + HWND GetTabControl() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HWND)::SendMessage(m_hWnd, PSM_GETTABCONTROL, 0, 0L); + } + + void SetFinishText(LPCTSTR lpszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_SETFINISHTEXT, 0, (LPARAM)lpszText); + } + + void SetWizardButtons(DWORD dwFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::PostMessage(m_hWnd, PSM_SETWIZBUTTONS, 0, dwFlags); + } + +// Operations + BOOL AddPage(HPROPSHEETPAGE hPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hPage != NULL); + return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); + } + + BOOL AddPage(LPCPROPSHEETPAGE pPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pPage != NULL); + HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); + if(hPage == NULL) + return FALSE; + return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); + } + +#ifndef _WIN32_WCE + BOOL InsertPage(int nNewPageIndex, HPROPSHEETPAGE hPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hPage != NULL); + return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); + } + + BOOL InsertPage(int nNewPageIndex, LPCPROPSHEETPAGE pPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pPage != NULL); + HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); + if(hPage == NULL) + return FALSE; + return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); + } + + BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, HPROPSHEETPAGE hPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hPage != NULL); + return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); + } + + BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, LPCPROPSHEETPAGE pPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pPage != NULL); + HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); + if(hPage == NULL) + return FALSE; + return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); + } +#endif // !_WIN32_WCE + + void RemovePage(int nPageIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_REMOVEPAGE, nPageIndex, 0L); + } + + void RemovePage(HPROPSHEETPAGE hPage) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(hPage != NULL); + ::SendMessage(m_hWnd, PSM_REMOVEPAGE, 0, (LPARAM)hPage); + } + + BOOL PressButton(int nButton) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PSM_PRESSBUTTON, nButton, 0L); + } + + BOOL Apply() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PSM_APPLY, 0, 0L); + } + + void CancelToClose() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_CANCELTOCLOSE, 0, 0L); + } + + void SetModified(HWND hWndPage, BOOL bChanged = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(hWndPage)); + UINT uMsg = bChanged ? PSM_CHANGED : PSM_UNCHANGED; + ::SendMessage(m_hWnd, uMsg, (WPARAM)hWndPage, 0L); + } + + LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::SendMessage(m_hWnd, PSM_QUERYSIBLINGS, wParam, lParam); + } + + void RebootSystem() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_REBOOTSYSTEM, 0, 0L); + } + + void RestartWindows() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_RESTARTWINDOWS, 0, 0L); + } + + BOOL IsDialogMessage(LPMSG lpMsg) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PSM_ISDIALOGMESSAGE, 0, (LPARAM)lpMsg); + } + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + int HwndToIndex(HWND hWnd) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PSM_HWNDTOINDEX, (WPARAM)hWnd, 0L); + } + + HWND IndexToHwnd(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HWND)::SendMessage(m_hWnd, PSM_INDEXTOHWND, nIndex, 0L); + } + + int PageToIndex(HPROPSHEETPAGE hPage) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PSM_PAGETOINDEX, 0, (LPARAM)hPage); + } + + HPROPSHEETPAGE IndexToPage(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HPROPSHEETPAGE)::SendMessage(m_hWnd, PSM_INDEXTOPAGE, nIndex, 0L); + } + + int IdToIndex(int nID) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PSM_IDTOINDEX, 0, nID); + } + + int IndexToId(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PSM_INDEXTOID, nIndex, 0L); + } + + int GetResult() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, PSM_GETRESULT, 0, 0L); + } + + BOOL RecalcPageSizes() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, PSM_RECALCPAGESIZES, 0, 0L); + } + + void SetHeaderTitle(int nIndex, LPCTSTR lpstrHeaderTitle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_SETHEADERTITLE, nIndex, (LPARAM)lpstrHeaderTitle); + } + + void SetHeaderSubTitle(int nIndex, LPCTSTR lpstrHeaderSubTitle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_SETHEADERSUBTITLE, nIndex, (LPARAM)lpstrHeaderSubTitle); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +// Implementation - override to prevent usage + HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) + { + ATLASSERT(FALSE); + return NULL; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CPropertySheetImpl - implements a property sheet + +template +class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > +{ +public: + PROPSHEETHEADER m_psh; + ATL::CSimpleArray m_arrPages; + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific + #ifndef PROPSHEET_LINK_SIZE + #define PROPSHEET_LINK_SIZE 128 + #endif // PROPSHEET_LINK_SIZE + TCHAR m_szLink[PROPSHEET_LINK_SIZE]; + static LPCTSTR m_pszTitle; + static LPCTSTR m_pszLink; +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + +// Construction/Destruction + CPropertySheetImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) + { + memset(&m_psh, 0, sizeof(PROPSHEETHEADER)); + m_psh.dwSize = sizeof(PROPSHEETHEADER); + m_psh.dwFlags = PSH_USECALLBACK; + m_psh.hInstance = ModuleHelper::GetResourceInstance(); + m_psh.phpage = NULL; // will be set later + m_psh.nPages = 0; // will be set later + m_psh.pszCaption = title.m_lpstr; + m_psh.nStartPage = uStartPage; + m_psh.hwndParent = hWndParent; // if NULL, will be set in DoModal/Create + m_psh.pfnCallback = T::PropSheetCallback; + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific + m_psh.dwFlags |= PSH_MAXIMIZE; + m_szLink[0] = 0; +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + } + + ~CPropertySheetImpl() + { + if(m_arrPages.GetSize() > 0) // sheet never created, destroy all pages + { + for(int i = 0; i < m_arrPages.GetSize(); i++) + ::DestroyPropertySheetPage((HPROPSHEETPAGE)m_arrPages[i]); + } + } + +// Callback function and overrideables + static int CALLBACK PropSheetCallback(HWND hWnd, UINT uMsg, LPARAM lParam) + { + lParam; // avoid level 4 warning + int nRet = 0; + + if(uMsg == PSCB_INITIALIZED) + { + ATLASSERT(hWnd != NULL); + T* pT = (T*)ModuleHelper::ExtractCreateWndData(); + // subclass the sheet window + pT->SubclassWindow(hWnd); + // remove page handles array + pT->_CleanUpPages(); + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific + m_pszTitle = pT->m_psh.pszCaption; + if(*pT->m_szLink != 0) + m_pszLink = pT->m_szLink; +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific + + pT->OnSheetInitialized(); + } +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific uMsg + else + { + switch(uMsg) + { + case PSCB_GETVERSION : + nRet = COMCTL32_VERSION; + break; + case PSCB_GETTITLE : + if(m_pszTitle != NULL) + { + lstrcpy((LPTSTR)lParam, m_pszTitle); + m_pszTitle = NULL; + } + break; + case PSCB_GETLINKTEXT: + if(m_pszLink != NULL) + { + lstrcpy((LPTSTR)lParam, m_pszLink); + m_pszLink = NULL; + } + break; + default: + break; + } + } +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + + return nRet; + } + + void OnSheetInitialized() + { + } + +// Create method + HWND Create(HWND hWndParent = NULL) + { + ATLASSERT(m_hWnd == NULL); + + m_psh.dwFlags |= PSH_MODELESS; + if(m_psh.hwndParent == NULL) + m_psh.hwndParent = hWndParent; + m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); + m_psh.nPages = m_arrPages.GetSize(); + + T* pT = static_cast(this); + ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); + + HWND hWnd = (HWND)::PropertySheet(&m_psh); + _CleanUpPages(); // ensure clean-up, required if call failed + + ATLASSERT(m_hWnd == hWnd); + + return hWnd; + } + + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT(m_hWnd == NULL); + + m_psh.dwFlags &= ~PSH_MODELESS; + if(m_psh.hwndParent == NULL) + m_psh.hwndParent = hWndParent; + m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); + m_psh.nPages = m_arrPages.GetSize(); + + T* pT = static_cast(this); + ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); + + INT_PTR nRet = ::PropertySheet(&m_psh); + _CleanUpPages(); // ensure clean-up, required if call failed + + return nRet; + } + + // implementation helper - clean up pages array + void _CleanUpPages() + { + m_psh.nPages = 0; + m_psh.phpage = NULL; + m_arrPages.RemoveAll(); + } + +// Attributes (extended overrides of client class methods) +// These now can be called before the sheet is created +// Note: Calling these after the sheet is created gives unpredictable results + int GetPageCount() const + { + if(m_hWnd == NULL) // not created yet + return m_arrPages.GetSize(); + return TBase::GetPageCount(); + } + + int GetActiveIndex() const + { + if(m_hWnd == NULL) // not created yet + return m_psh.nStartPage; + return TBase::GetActiveIndex(); + } + + HPROPSHEETPAGE GetPage(int nPageIndex) const + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + return (HPROPSHEETPAGE)m_arrPages[nPageIndex]; + } + + int GetPageIndex(HPROPSHEETPAGE hPage) const + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + return m_arrPages.Find((HPROPSHEETPAGE&)hPage); + } + + BOOL SetActivePage(int nPageIndex) + { + if(m_hWnd == NULL) // not created yet + { + ATLASSERT(nPageIndex >= 0 && nPageIndex < m_arrPages.GetSize()); + m_psh.nStartPage = nPageIndex; + return TRUE; + } + return TBase::SetActivePage(nPageIndex); + } + + BOOL SetActivePage(HPROPSHEETPAGE hPage) + { + ATLASSERT(hPage != NULL); + if (m_hWnd == NULL) // not created yet + { + int nPageIndex = GetPageIndex(hPage); + if(nPageIndex == -1) + return FALSE; + + return SetActivePage(nPageIndex); + } + return TBase::SetActivePage(hPage); + + } + + void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) + { + ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid + ATLASSERT(lpszText != NULL); + + if(m_hWnd == NULL) + { + // set internal state + m_psh.pszCaption = lpszText; // must exist until sheet is created + m_psh.dwFlags &= ~PSH_PROPTITLE; + m_psh.dwFlags |= nStyle; + } + else + { + // set external state + TBase::SetTitle(lpszText, nStyle); + } + } + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific Link field + void SetLinkText(LPCTSTR lpszText) + { + ATLASSERT(lpszText != NULL); + ATLASSERT(lstrlen(lpszText) < PROPSHEET_LINK_SIZE); + lstrcpy(m_szLink, lpszText); + } +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + + void SetWizardMode() + { + m_psh.dwFlags |= PSH_WIZARD; + } + + void EnableHelp() + { + m_psh.dwFlags |= PSH_HASHELP; + } + +// Operations + BOOL AddPage(HPROPSHEETPAGE hPage) + { + ATLASSERT(hPage != NULL); + BOOL bRet = FALSE; + if(m_hWnd != NULL) + bRet = TBase::AddPage(hPage); + else // sheet not created yet, use internal data + bRet = m_arrPages.Add((HPROPSHEETPAGE&)hPage); + return bRet; + } + + BOOL AddPage(LPCPROPSHEETPAGE pPage) + { + ATLASSERT(pPage != NULL); + HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); + if(hPage == NULL) + return FALSE; + BOOL bRet = AddPage(hPage); + if(!bRet) + ::DestroyPropertySheetPage(hPage); + return bRet; + } + + BOOL RemovePage(HPROPSHEETPAGE hPage) + { + ATLASSERT(hPage != NULL); + if (m_hWnd == NULL) // not created yet + { + int nPage = GetPageIndex(hPage); + if(nPage == -1) + return FALSE; + return RemovePage(nPage); + } + TBase::RemovePage(hPage); + return TRUE; + + } + + BOOL RemovePage(int nPageIndex) + { + BOOL bRet = TRUE; + if(m_hWnd != NULL) + TBase::RemovePage(nPageIndex); + else // sheet not created yet, use internal data + bRet = m_arrPages.RemoveAt(nPageIndex); + return bRet; + } + +#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + void SetHeader(LPCTSTR szbmHeader) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + + m_psh.dwFlags &= ~PSH_WIZARD; + m_psh.dwFlags |= (PSH_HEADER | PSH_WIZARD97); + m_psh.pszbmHeader = szbmHeader; + } + + void SetHeader(HBITMAP hbmHeader) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + + m_psh.dwFlags &= ~PSH_WIZARD; + m_psh.dwFlags |= (PSH_HEADER | PSH_USEHBMHEADER | PSH_WIZARD97); + m_psh.hbmHeader = hbmHeader; + } + + void SetWatermark(LPCTSTR szbmWatermark, HPALETTE hplWatermark = NULL) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + + m_psh.dwFlags &= ~PSH_WIZARD; + m_psh.dwFlags |= PSH_WATERMARK | PSH_WIZARD97; + m_psh.pszbmWatermark = szbmWatermark; + + if (hplWatermark != NULL) + { + m_psh.dwFlags |= PSH_USEHPLWATERMARK; + m_psh.hplWatermark = hplWatermark; + } + } + + void SetWatermark(HBITMAP hbmWatermark, HPALETTE hplWatermark = NULL) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + + m_psh.dwFlags &= ~PSH_WIZARD; + m_psh.dwFlags |= (PSH_WATERMARK | PSH_USEHBMWATERMARK | PSH_WIZARD97); + m_psh.hbmWatermark = hbmWatermark; + + if (hplWatermark != NULL) + { + m_psh.dwFlags |= PSH_USEHPLWATERMARK; + m_psh.hplWatermark = hplWatermark; + } + } + + void StretchWatermark(bool bStretchWatermark) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + if (bStretchWatermark) + m_psh.dwFlags |= PSH_STRETCHWATERMARK; + else + m_psh.dwFlags &= ~PSH_STRETCHWATERMARK; + } +#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +// Message map and handlers + BEGIN_MSG_MAP(CPropertySheetImpl) + MESSAGE_HANDLER(WM_COMMAND, OnCommand) + MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand) + END_MSG_MAP() + + LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + if(HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) && + ((m_psh.dwFlags & PSH_MODELESS) != 0) && (GetActivePage() == NULL)) + DestroyWindow(); + return lRet; + } + + LRESULT OnSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(((m_psh.dwFlags & PSH_MODELESS) == PSH_MODELESS) && ((wParam & 0xFFF0) == SC_CLOSE)) + SendMessage(WM_CLOSE); + else + bHandled = FALSE; + return 0; + } +}; + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC static pointers +template < class T, class TBase > +LPCWSTR CPropertySheetImpl::m_pszTitle = NULL; +template < class T, class TBase> +LPCWSTR CPropertySheetImpl::m_pszLink = NULL; +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + +// for non-customized sheets +class CPropertySheet : public CPropertySheetImpl +{ +public: + CPropertySheet(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) + : CPropertySheetImpl(title, uStartPage, hWndParent) + { } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPropertyPageWindow - client side for a property page + +class CPropertyPageWindow : public ATL::CWindow +{ +public: +// Constructors + CPropertyPageWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) + { } + + CPropertyPageWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Attributes + CPropertySheetWindow GetPropertySheet() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CPropertySheetWindow(GetParent()); + } + +// Operations + BOOL Apply() + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + return GetPropertySheet().Apply(); + } + + void CancelToClose() + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetPropertySheet().CancelToClose(); + } + + void SetModified(BOOL bChanged = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetPropertySheet().SetModified(m_hWnd, bChanged); + } + + LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + return GetPropertySheet().QuerySiblings(wParam, lParam); + } + + void RebootSystem() + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetPropertySheet().RebootSystem(); + } + + void RestartWindows() + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetPropertySheet().RestartWindows(); + } + + void SetWizardButtons(DWORD dwFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetPropertySheet().SetWizardButtons(dwFlags); + } + +// Implementation - overrides to prevent usage + HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) + { + ATLASSERT(FALSE); + return NULL; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CPropertyPageImpl - implements a property page + +template +class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > +{ +public: + PROPSHEETPAGE m_psp; + + operator PROPSHEETPAGE*() { return &m_psp; } + +// Construction + CPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) + { + // initialize PROPSHEETPAGE struct + memset(&m_psp, 0, sizeof(PROPSHEETPAGE)); + m_psp.dwSize = sizeof(PROPSHEETPAGE); + m_psp.dwFlags = PSP_USECALLBACK; + m_psp.hInstance = ModuleHelper::GetResourceInstance(); + T* pT = static_cast(this); + m_psp.pszTemplate = MAKEINTRESOURCE(pT->IDD); + m_psp.pfnDlgProc = (DLGPROC)T::StartDialogProc; + m_psp.pfnCallback = T::PropPageCallback; + m_psp.lParam = (LPARAM)pT; + + if(title.m_lpstr != NULL) + SetTitle(title); + } + +// Callback function and overrideables + static UINT CALLBACK PropPageCallback(HWND hWnd, UINT uMsg, LPPROPSHEETPAGE ppsp) + { + hWnd; // avoid level 4 warning + ATLASSERT(hWnd == NULL); + T* pT = (T*)ppsp->lParam; + UINT uRet = 0; + + switch(uMsg) + { + case PSPCB_CREATE: + { + ATL::CDialogImplBaseT< TBase >* pPage = (ATL::CDialogImplBaseT< TBase >*)pT; + ModuleHelper::AddCreateWndData(&pPage->m_thunk.cd, pPage); + uRet = pT->OnPageCreate() ? 1 : 0; + } + break; +#if (_WIN32_IE >= 0x0500) + case PSPCB_ADDREF: + pT->OnPageAddRef(); + break; +#endif // (_WIN32_IE >= 0x0500) + case PSPCB_RELEASE: + pT->OnPageRelease(); + break; + default: + break; + } + + return uRet; + } + + bool OnPageCreate() + { + return true; // true - allow page to be created, false - prevent creation + } + +#if (_WIN32_IE >= 0x0500) + void OnPageAddRef() + { + } +#endif // (_WIN32_IE >= 0x0500) + + void OnPageRelease() + { + } + +// Create method + HPROPSHEETPAGE Create() + { + return ::CreatePropertySheetPage(&m_psp); + } + +// Attributes + void SetTitle(ATL::_U_STRINGorID title) + { + m_psp.pszTitle = title.m_lpstr; + m_psp.dwFlags |= PSP_USETITLE; + } + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + void SetHeaderTitle(LPCTSTR lpstrHeaderTitle) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + m_psp.dwFlags |= PSP_USEHEADERTITLE; + m_psp.pszHeaderTitle = lpstrHeaderTitle; + } + + void SetHeaderSubTitle(LPCTSTR lpstrHeaderSubTitle) + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + m_psp.dwFlags |= PSP_USEHEADERSUBTITLE; + m_psp.pszHeaderSubTitle = lpstrHeaderSubTitle; + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +// Operations + void EnableHelp() + { + m_psp.dwFlags |= PSP_HASHELP; + } + +// Message map and handlers + BEGIN_MSG_MAP(CPropertyPageImpl) + MESSAGE_HANDLER(WM_NOTIFY, OnNotify) + END_MSG_MAP() + + // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification + // handlers that return direct values without any restrictions + LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { +#ifndef _WIN32_WCE + // This notification is sometimes received on Windows CE after the window is already destroyed + ATLASSERT(::IsWindow(m_hWnd)); +#endif + NMHDR* pNMHDR = (NMHDR*)lParam; + + // don't handle messages not from the page/sheet itself + if(pNMHDR->hwndFrom != m_hWnd && pNMHDR->hwndFrom != ::GetParent(m_hWnd)) + { + bHandled = FALSE; + return 1; + } +#ifdef _WIN32_WCE + ATLASSERT(::IsWindow(m_hWnd)); +#endif + + T* pT = static_cast(this); + LRESULT lResult = 0; + switch(pNMHDR->code) + { +#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS + case PSN_SETACTIVE: + lResult = pT->OnSetActive(); + break; + case PSN_KILLACTIVE: + lResult = pT->OnKillActive(); + break; + case PSN_APPLY: + lResult = pT->OnApply(); + break; + case PSN_RESET: + pT->OnReset(); + break; + case PSN_QUERYCANCEL: + lResult = pT->OnQueryCancel(); + break; + case PSN_WIZNEXT: + lResult = pT->OnWizardNext(); + break; + case PSN_WIZBACK: + lResult = pT->OnWizardBack(); + break; + case PSN_WIZFINISH: + lResult = pT->OnWizardFinish(); + break; + case PSN_HELP: + pT->OnHelp(); + break; +#ifndef _WIN32_WCE +#if (_WIN32_IE >= 0x0400) + case PSN_GETOBJECT: + if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) + bHandled = FALSE; + break; +#endif // (_WIN32_IE >= 0x0400) +#if (_WIN32_IE >= 0x0500) + case PSN_TRANSLATEACCELERATOR: + { + LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; + lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam); + } + break; + case PSN_QUERYINITIALFOCUS: + { + LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; + lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); + } + break; +#endif // (_WIN32_IE >= 0x0500) +#endif // !_WIN32_WCE + +#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS + case PSN_SETACTIVE: + lResult = pT->OnSetActive() ? 0 : -1; + break; + case PSN_KILLACTIVE: + lResult = !pT->OnKillActive(); + break; + case PSN_APPLY: + lResult = pT->OnApply() ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE; + break; + case PSN_RESET: + pT->OnReset(); + break; + case PSN_QUERYCANCEL: + lResult = !pT->OnQueryCancel(); + break; + case PSN_WIZNEXT: + lResult = pT->OnWizardNext(); + break; + case PSN_WIZBACK: + lResult = pT->OnWizardBack(); + break; + case PSN_WIZFINISH: + lResult = !pT->OnWizardFinish(); + break; + case PSN_HELP: + pT->OnHelp(); + break; +#ifndef _WIN32_WCE +#if (_WIN32_IE >= 0x0400) + case PSN_GETOBJECT: + if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) + bHandled = FALSE; + break; +#endif // (_WIN32_IE >= 0x0400) +#if (_WIN32_IE >= 0x0500) + case PSN_TRANSLATEACCELERATOR: + { + LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; + lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; + } + break; + case PSN_QUERYINITIALFOCUS: + { + LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; + lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); + } + break; +#endif // (_WIN32_IE >= 0x0500) +#endif // !_WIN32_WCE + +#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS + default: + bHandled = FALSE; // not handled + } + + return lResult; + } + +// Overridables + // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification + // handlers that return direct values without any restrictions +#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS + int OnSetActive() + { + // 0 = allow activate + // -1 = go back that was active + // page ID = jump to page + return 0; + } + + BOOL OnKillActive() + { + // FALSE = allow deactivate + // TRUE = prevent deactivation + return FALSE; + } + + int OnApply() + { + // PSNRET_NOERROR = apply OK + // PSNRET_INVALID = apply not OK, return to this page + // PSNRET_INVALID_NOCHANGEPAGE = apply not OK, don't change focus + return PSNRET_NOERROR; + } + + void OnReset() + { + } + + BOOL OnQueryCancel() + { + // FALSE = allow cancel + // TRUE = prevent cancel + return FALSE; + } + + int OnWizardBack() + { + // 0 = goto previous page + // -1 = prevent page change + // >0 = jump to page by dlg ID + return 0; + } + + int OnWizardNext() + { + // 0 = goto next page + // -1 = prevent page change + // >0 = jump to page by dlg ID + return 0; + } + + INT_PTR OnWizardFinish() + { + // FALSE = allow finish + // TRUE = prevent finish + // HWND = prevent finish and set focus to HWND (CommCtrl 5.80 only) + return FALSE; + } + + void OnHelp() + { + } + +#ifndef _WIN32_WCE +#if (_WIN32_IE >= 0x0400) + BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) + { + return FALSE; // not processed + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) + int OnTranslateAccelerator(LPMSG /*lpMsg*/) + { + // PSNRET_NOERROR - message not handled + // PSNRET_MESSAGEHANDLED - message handled + return PSNRET_NOERROR; + } + + HWND OnQueryInitialFocus(HWND /*hWndFocus*/) + { + // NULL = set focus to default control + // HWND = set focus to HWND + return NULL; + } +#endif // (_WIN32_IE >= 0x0500) +#endif // !_WIN32_WCE + +#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS + BOOL OnSetActive() + { + return TRUE; + } + + BOOL OnKillActive() + { + return TRUE; + } + + BOOL OnApply() + { + return TRUE; + } + + void OnReset() + { + } + + BOOL OnQueryCancel() + { + return TRUE; // ok to cancel + } + + int OnWizardBack() + { + // 0 = goto previous page + // -1 = prevent page change + // >0 = jump to page by dlg ID + return 0; + } + + int OnWizardNext() + { + // 0 = goto next page + // -1 = prevent page change + // >0 = jump to page by dlg ID + return 0; + } + + BOOL OnWizardFinish() + { + return TRUE; + } + + void OnHelp() + { + } + +#ifndef _WIN32_WCE +#if (_WIN32_IE >= 0x0400) + BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) + { + return FALSE; // not processed + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) + BOOL OnTranslateAccelerator(LPMSG /*lpMsg*/) + { + return FALSE; // not translated + } + + HWND OnQueryInitialFocus(HWND /*hWndFocus*/) + { + return NULL; // default + } +#endif // (_WIN32_IE >= 0x0500) +#endif // !_WIN32_WCE + +#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS +}; + +// for non-customized pages +template +class CPropertyPage : public CPropertyPageImpl > +{ +public: + enum { IDD = t_wDlgTemplateID }; + + CPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) + { } + + DECLARE_EMPTY_MSG_MAP() +}; + +/////////////////////////////////////////////////////////////////////////////// +// CAxPropertyPageImpl - property page that hosts ActiveX controls + +#ifndef _ATL_NO_HOSTING + +// Note: You must #include to use these classes + +template +class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > +{ +public: +// Data members + HGLOBAL m_hInitData; + HGLOBAL m_hDlgRes; + HGLOBAL m_hDlgResSplit; + +// Constructor/destructor + CAxPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : + CPropertyPageImpl< T, TBase >(title), + m_hInitData(NULL), m_hDlgRes(NULL), m_hDlgResSplit(NULL) + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + + // initialize ActiveX hosting and modify dialog template + ATL::AtlAxWinInit(); + + HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); + LPCTSTR lpTemplateName = MAKEINTRESOURCE(pT->IDD); + HRSRC hDlg = ::FindResource(hInstance, lpTemplateName, (LPTSTR)RT_DIALOG); + if(hDlg != NULL) + { + HRSRC hDlgInit = ::FindResource(hInstance, lpTemplateName, (LPTSTR)_ATL_RT_DLGINIT); + + BYTE* pInitData = NULL; + if(hDlgInit != NULL) + { + m_hInitData = ::LoadResource(hInstance, hDlgInit); + pInitData = (BYTE*)::LockResource(m_hInitData); + } + + m_hDlgRes = ::LoadResource(hInstance, hDlg); + DLGTEMPLATE* pDlg = (DLGTEMPLATE*)::LockResource(m_hDlgRes); + LPCDLGTEMPLATE lpDialogTemplate = ATL::_DialogSplitHelper::SplitDialogTemplate(pDlg, pInitData); + if(lpDialogTemplate != pDlg) + m_hDlgResSplit = GlobalHandle(lpDialogTemplate); + + // set up property page to use in-memory dialog template + if(lpDialogTemplate != NULL) + { + m_psp.dwFlags |= PSP_DLGINDIRECT; + m_psp.pResource = lpDialogTemplate; + } + else + { + ATLASSERT(FALSE && _T("CAxPropertyPageImpl - ActiveX initializtion failed!")); + } + } + else + { + ATLASSERT(FALSE && _T("CAxPropertyPageImpl - Cannot find dialog template!")); + } + } + + ~CAxPropertyPageImpl() + { + if(m_hInitData != NULL) + { + UnlockResource(m_hInitData); + FreeResource(m_hInitData); + } + if(m_hDlgRes != NULL) + { + UnlockResource(m_hDlgRes); + FreeResource(m_hDlgRes); + } + if(m_hDlgResSplit != NULL) + { + ::GlobalFree(m_hDlgResSplit); + } + } + +// Methods + // call this one to handle keyboard message for ActiveX controls + BOOL PreTranslateMessage(LPMSG pMsg) + { + if ((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) && + (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST)) + return FALSE; + // find a direct child of the dialog from the window that has focus + HWND hWndCtl = ::GetFocus(); + if (IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd) + { + do + { + hWndCtl = ::GetParent(hWndCtl); + } + while (::GetParent(hWndCtl) != m_hWnd); + } + // give controls a chance to translate this message + return (BOOL)::SendMessage(hWndCtl, WM_FORWARDMSG, 0, (LPARAM)pMsg); + } + +// Overridables +#if (_WIN32_IE >= 0x0500) + // new default implementation for ActiveX hosting pages +#ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS + int OnTranslateAccelerator(LPMSG lpMsg) + { + T* pT = static_cast(this); + return (pT->PreTranslateMessage(lpMsg) != FALSE) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; + } +#else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS + BOOL OnTranslateAccelerator(LPMSG lpMsg) + { + T* pT = static_cast(this); + return pT->PreTranslateMessage(lpMsg); + } +#endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS +#endif // (_WIN32_IE >= 0x0500) + +// Support for new stuff in ATL7 +#if (_ATL_VER >= 0x0700) + int GetIDD() + { + return( static_cast(this)->IDD ); + } + + virtual DLGPROC GetDialogProc() + { + return DialogProc; + } + + static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + CAxPropertyPageImpl< T, TBase >* pThis = (CAxPropertyPageImpl< T, TBase >*)hWnd; + if (uMsg == WM_INITDIALOG) + { + HRESULT hr; + if (FAILED(hr = pThis->CreateActiveXControls(pThis->GetIDD()))) + { + ATLASSERT(FALSE); + return FALSE; + } + } + return CPropertyPageImpl< T, TBase >::DialogProc(hWnd, uMsg, wParam, lParam); + } + +// ActiveX controls creation + virtual HRESULT CreateActiveXControls(UINT nID) + { + // Load dialog template and InitData + HRSRC hDlgInit = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)_ATL_RT_DLGINIT); + BYTE* pInitData = NULL; + HGLOBAL hData = NULL; + HRESULT hr = S_OK; + if (hDlgInit != NULL) + { + hData = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlgInit); + if (hData != NULL) + pInitData = (BYTE*) ::LockResource(hData); + } + + HRSRC hDlg = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)RT_DIALOG); + if (hDlg != NULL) + { + HGLOBAL hResource = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlg); + DLGTEMPLATE* pDlg = NULL; + if (hResource != NULL) + { + pDlg = (DLGTEMPLATE*) ::LockResource(hResource); + if (pDlg != NULL) + { + // Get first control on the template + BOOL bDialogEx = ATL::_DialogSplitHelper::IsDialogEx(pDlg); + WORD nItems = ATL::_DialogSplitHelper::DlgTemplateItemCount(pDlg); + + // Get first control on the dialog + DLGITEMTEMPLATE* pItem = ATL::_DialogSplitHelper::FindFirstDlgItem(pDlg); + HWND hWndPrev = GetWindow(GW_CHILD); + + // Create all ActiveX cotnrols in the dialog template and place them in the correct tab order (z-order) + for (WORD nItem = 0; nItem < nItems; nItem++) + { + DWORD wID = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : pItem->id; + if (ATL::_DialogSplitHelper::IsActiveXControl(pItem, bDialogEx)) + { + BYTE* pData = NULL; + DWORD dwLen = ATL::_DialogSplitHelper::FindCreateData(wID, pInitData, &pData); + ATL::CComPtr spStream; + if (dwLen != 0) + { + HGLOBAL h = GlobalAlloc(GHND, dwLen); + if (h != NULL) + { + BYTE* pBytes = (BYTE*) GlobalLock(h); + BYTE* pSource = pData; + SecureHelper::memcpy_x(pBytes, dwLen, pSource, dwLen); + GlobalUnlock(h); + CreateStreamOnHGlobal(h, TRUE, &spStream); + } + else + { + hr = E_OUTOFMEMORY; + break; + } + } + + ATL::CComBSTR bstrLicKey; + hr = ATL::_DialogSplitHelper::ParseInitData(spStream, &bstrLicKey.m_str); + if (SUCCEEDED(hr)) + { + ATL::CAxWindow2 wnd; + // Get control caption. + LPWSTR pszClassName = + bDialogEx ? + (LPWSTR)(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem) + 1) : + (LPWSTR)(pItem + 1); + // Get control rect. + RECT rect; + rect.left = + bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->x : + pItem->x; + rect.top = + bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->y : + pItem->y; + rect.right = rect.left + + (bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cx : + pItem->cx); + rect.bottom = rect.top + + (bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cy : + pItem->cy); + + // Convert from dialog units to screen units + MapDialogRect(&rect); + + // Create AxWindow with a NULL caption. + wnd.Create(m_hWnd, + &rect, + NULL, + (bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->style : + pItem->style) | WS_TABSTOP, + bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->exStyle : + 0, + bDialogEx ? + ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : + pItem->id, + NULL); + + if (wnd != NULL) + { +#ifndef _WIN32_WCE + // Set the Help ID + if (bDialogEx && ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID != 0) + wnd.SetWindowContextHelpId(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID); +#endif // !_WIN32_WCE + // Try to create the ActiveX control. + hr = wnd.CreateControlLic(pszClassName, spStream, NULL, bstrLicKey); + if (FAILED(hr)) + break; + // Set the correct tab position. + if (nItem == 0) + hWndPrev = HWND_TOP; + wnd.SetWindowPos(hWndPrev, 0,0,0,0,SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); + hWndPrev = wnd; + } + else + { + hr = ATL::AtlHresultFromLastError(); + } + } + } + else + { + if (nItem != 0) + hWndPrev = ::GetWindow(hWndPrev, GW_HWNDNEXT); + } + pItem = ATL::_DialogSplitHelper::FindNextDlgItem(pItem, bDialogEx); + } + } + else + hr = ATL::AtlHresultFromLastError(); + } + else + hr = ATL::AtlHresultFromLastError(); + } + return hr; + } + +// Event handling support + HRESULT AdviseSinkMap(bool bAdvise) + { + if(!bAdvise && m_hWnd == NULL) + { + // window is gone, controls are already unadvised + ATLTRACE2(atlTraceUI, 0, _T("CAxPropertyPageImpl::AdviseSinkMap called after the window was destroyed\n")); + return S_OK; + } + HRESULT hRet = E_NOTIMPL; + __if_exists(T::_GetSinkMapFinder) + { + T* pT = static_cast(this); + hRet = AtlAdviseSinkMap(pT, bAdvise); + } + return hRet; + } + +// Message map and handlers + typedef CPropertyPageImpl< T, TBase> _baseClass; + BEGIN_MSG_MAP(CAxPropertyPageImpl) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + CHAIN_MSG_MAP(_baseClass) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + // initialize controls in dialog with DLGINIT resource section + ExecuteDlgInit(static_cast(this)->IDD); + AdviseSinkMap(true); + bHandled = FALSE; + return 1; + } + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + AdviseSinkMap(false); + bHandled = FALSE; + return 1; + } +#endif // (_ATL_VER >= 0x0700) +}; + +// for non-customized pages +template +class CAxPropertyPage : public CAxPropertyPageImpl > +{ +public: + enum { IDD = t_wDlgTemplateID }; + + CAxPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl(title) + { } + +#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) + // not empty so we handle accelerators/create controls + BEGIN_MSG_MAP(CAxPropertyPage) + CHAIN_MSG_MAP(CAxPropertyPageImpl >) + END_MSG_MAP() +#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) + DECLARE_EMPTY_MSG_MAP() +#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) +}; + +#endif // _ATL_NO_HOSTING + + +/////////////////////////////////////////////////////////////////////////////// +// Wizard97 Support + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +// Sample wizard dialog resources: +// +// IDD_WIZ97_INTERIOR_BLANK DIALOG 0, 0, 317, 143 +// STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +// CAPTION "Wizard97 Property Page - Interior" +// FONT 8, "MS Shell Dlg" +// BEGIN +// END +// +// IDD_WIZ97_EXTERIOR_BLANK DIALOGEX 0, 0, 317, 193 +// STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +// CAPTION "Wizard97 Property Page - Welcome/Complete" +// FONT 8, "MS Shell Dlg", 0, 0, 0x0 +// BEGIN +// LTEXT "Welcome to the X Wizard",IDC_WIZ97_EXTERIOR_TITLE,115,8, +// 195,24 +// LTEXT "Wizard Explanation\r\n(The height of the static text should be in multiples of 8 dlus)", +// IDC_STATIC,115,40,195,16 +// LTEXT "h",IDC_WIZ97_BULLET1,118,64,8,8 +// LTEXT "List Item 1 (the h is turned into a bullet)",IDC_STATIC, +// 127,63,122,8 +// LTEXT "h",IDC_WIZ97_BULLET2,118,79,8,8 +// LTEXT "List Item 2. Keep 7 dlus between paragraphs",IDC_STATIC, +// 127,78,33,8 +// CONTROL "&Do not show this Welcome page again", +// IDC_WIZ97_WELCOME_NOTAGAIN,"Button",BS_AUTOCHECKBOX | +// WS_TABSTOP,115,169,138,10 +// END +// +// GUIDELINES DESIGNINFO +// BEGIN +// IDD_WIZ97_INTERIOR_BLANK, DIALOG +// BEGIN +// LEFTMARGIN, 7 +// RIGHTMARGIN, 310 +// VERTGUIDE, 21 +// VERTGUIDE, 31 +// VERTGUIDE, 286 +// VERTGUIDE, 296 +// TOPMARGIN, 7 +// BOTTOMMARGIN, 136 +// HORZGUIDE, 8 +// END +// +// IDD_WIZ97_EXTERIOR_BLANK, DIALOG +// BEGIN +// RIGHTMARGIN, 310 +// VERTGUIDE, 115 +// VERTGUIDE, 118 +// VERTGUIDE, 127 +// TOPMARGIN, 7 +// BOTTOMMARGIN, 186 +// HORZGUIDE, 8 +// HORZGUIDE, 32 +// HORZGUIDE, 40 +// HORZGUIDE, 169 +// END +// END + +/////////////////////////////////////////////////////////////////////////////// +// CWizard97SheetWindow - client side for a Wizard 97 style wizard sheet + +class CWizard97SheetWindow : public CPropertySheetWindow +{ +public: +// Constructors + CWizard97SheetWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) + { } + + CWizard97SheetWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Operations + HFONT GetExteriorPageTitleFont(void) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HFONT)::SendMessage(m_hWnd, GetMessage_GetExteriorPageTitleFont(), 0, 0L); + } + + HFONT GetBulletFont(void) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HFONT)::SendMessage(m_hWnd, GetMessage_GetBulletFont(), 0, 0L); + } + +// Helpers + static UINT GetMessage_GetExteriorPageTitleFont() + { + static UINT uGetExteriorPageTitleFont = 0; + if(uGetExteriorPageTitleFont == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont().\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uGetExteriorPageTitleFont == 0) + uGetExteriorPageTitleFont = ::RegisterWindowMessage(_T("GetExteriorPageTitleFont_531AF056-B8BE-4c4c-B786-AC608DF0DF12")); + + lock.Unlock(); + } + ATLASSERT(uGetExteriorPageTitleFont != 0); + return uGetExteriorPageTitleFont; + } + + static UINT GetMessage_GetBulletFont() + { + static UINT uGetBulletFont = 0; + if(uGetBulletFont == 0) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetBulletFont().\n")); + ATLASSERT(FALSE); + return 0; + } + + if(uGetBulletFont == 0) + uGetBulletFont = ::RegisterWindowMessage(_T("GetBulletFont_AD347D08-8F65-45ef-982E-6352E8218AD5")); + + lock.Unlock(); + } + ATLASSERT(uGetBulletFont != 0); + return uGetBulletFont; + } + +// Implementation - override to prevent usage + HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) + { + ATLASSERT(FALSE); + return NULL; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CWizard97SheetImpl - implements a Wizard 97 style wizard sheet + +template +class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > +{ +protected: +// Typedefs + typedef CWizard97SheetImpl< T, TBase > thisClass; + typedef CPropertySheetImpl< T, TBase > baseClass; + +// Member variables + CFont m_fontExteriorPageTitle; // Welcome and Completion page title font + CFont m_fontBullet; // Bullet font (used on static text 'h' to produce a small bullet) + bool m_bReceivedFirstSizeMessage; + +public: + CWizard97SheetImpl(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : + baseClass(title, uStartPage, hWndParent), + m_bReceivedFirstSizeMessage(false) + { + m_psh.dwFlags &= ~(PSH_NOCONTEXTHELP); + m_psh.dwFlags &= ~(PSH_WIZARD | PSH_WIZARD_LITE); + + m_psh.dwFlags |= (PSH_HASHELP | PSH_WIZARDCONTEXTHELP); + m_psh.dwFlags |= PSH_WIZARD97; + + baseClass::SetHeader(headerBitmap.m_lpstr); + baseClass::SetWatermark(watermarkBitmap.m_lpstr); + } + +// Overrides from base class + void OnSheetInitialized() + { + T* pT = static_cast(this); + pT->_InitializeFonts(); + + // We'd like to center the wizard here, but its too early. + // Instead, we'll do CenterWindow upon our first WM_SIZE message + } + +// Initialization + void _InitializeFonts() + { + // Setup the Title and Bullet Font + // (Property pages can send the "get external page title font" and "get bullet font" messages) + // The derived class needs to do the actual SetFont for the dialog items) + + CFontHandle fontThisDialog = this->GetFont(); + CClientDC dcScreen(NULL); + + LOGFONT titleLogFont = {0}; + LOGFONT bulletLogFont = {0}; + fontThisDialog.GetLogFont(&titleLogFont); + fontThisDialog.GetLogFont(&bulletLogFont); + + // The Wizard 97 Spec recommends to do the Title Font + // as Verdana Bold, 12pt. + titleLogFont.lfCharSet = DEFAULT_CHARSET; + titleLogFont.lfWeight = FW_BOLD; + SecureHelper::strcpy_x(titleLogFont.lfFaceName, _countof(titleLogFont.lfFaceName), _T("Verdana Bold")); + INT titleFontPointSize = 12; + titleLogFont.lfHeight = -::MulDiv(titleFontPointSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); + m_fontExteriorPageTitle.CreateFontIndirect(&titleLogFont); + + // The Wizard 97 Spec recommends to do Bullets by having + // static text of "h" in the Marlett font. + bulletLogFont.lfCharSet = DEFAULT_CHARSET; + bulletLogFont.lfWeight = FW_NORMAL; + SecureHelper::strcpy_x(bulletLogFont.lfFaceName, _countof(bulletLogFont.lfFaceName), _T("Marlett")); + INT bulletFontSize = 8; + bulletLogFont.lfHeight = -::MulDiv(bulletFontSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); + m_fontBullet.CreateFontIndirect(&bulletLogFont); + } + +// Message Handling + BEGIN_MSG_MAP(thisClass) + MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont(), OnGetExteriorPageTitleFont) + MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetBulletFont(), OnGetBulletFont) + MESSAGE_HANDLER(WM_SIZE, OnSize) + CHAIN_MSG_MAP(baseClass) + END_MSG_MAP() + + LRESULT OnGetExteriorPageTitleFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return (LRESULT)(HFONT)m_fontExteriorPageTitle; + } + + LRESULT OnGetBulletFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return (LRESULT)(HFONT)m_fontBullet; + } + + LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(!m_bReceivedFirstSizeMessage) + { + m_bReceivedFirstSizeMessage = true; + this->CenterWindow(); + } + + bHandled = FALSE; + return 0; + } +}; + +// for non-customized sheets +class CWizard97Sheet : public CWizard97SheetImpl +{ +protected: +// Typedefs + typedef CWizard97Sheet thisClass; + typedef CWizard97SheetImpl baseClass; + +public: + CWizard97Sheet(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : + baseClass(title, headerBitmap, watermarkBitmap, uStartPage, hWndParent) + { } + + BEGIN_MSG_MAP(thisClass) + CHAIN_MSG_MAP(baseClass) + END_MSG_MAP() +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CWizard97PageWindow - client side for a Wizard 97 style wizard page + +#define WIZARD97_EXTERIOR_CXDLG 317 +#define WIZARD97_EXTERIOR_CYDLG 193 + +#define WIZARD97_INTERIOR_CXDLG 317 +#define WIZARD97_INTERIOR_CYDLG 143 + +class CWizard97PageWindow : public CPropertyPageWindow +{ +public: +// Constructors + CWizard97PageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) + { } + + CWizard97PageWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Attributes + CWizard97SheetWindow GetPropertySheet() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CWizard97SheetWindow(GetParent()); + } + +// Operations + HFONT GetExteriorPageTitleFont(void) + { + ATLASSERT(::IsWindow(m_hWnd)); + return GetPropertySheet().GetExteriorPageTitleFont(); + } + + HFONT GetBulletFont(void) + { + ATLASSERT(::IsWindow(m_hWnd)); + return GetPropertySheet().GetBulletFont(); + } + +// Implementation - overrides to prevent usage + HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) + { + ATLASSERT(FALSE); + return NULL; + } + +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CWizard97PageImpl - implements a Wizard 97 style wizard page + +template +class ATL_NO_VTABLE CWizard97PageImpl : public CPropertyPageImpl< T, TBase > +{ +protected: +// Typedefs + typedef CWizard97PageImpl< T, TBase > thisClass; + typedef CPropertyPageImpl< T, TBase > baseClass; + +public: + CWizard97PageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) + { } + +// Message Handling + BEGIN_MSG_MAP(thisClass) + CHAIN_MSG_MAP(baseClass) + END_MSG_MAP() +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CWizard97ExteriorPageImpl - implements a Wizard 97 style exterior wizard page + +template +class ATL_NO_VTABLE CWizard97ExteriorPageImpl : public CPropertyPageImpl< T, TBase > +{ +protected: +// Typedefs + typedef CWizard97ExteriorPageImpl< T, TBase > thisClass; + typedef CPropertyPageImpl< T, TBase > baseClass; + +public: +// Constructors + CWizard97ExteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) + { + m_psp.dwFlags |= PSP_HASHELP; + m_psp.dwFlags |= PSP_HIDEHEADER; + } + +// Message Handling + BEGIN_MSG_MAP(thisClass) + CHAIN_MSG_MAP(baseClass) + END_MSG_MAP() +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CWizard97InteriorPageImpl - implements a Wizard 97 style interior wizard page + +template +class ATL_NO_VTABLE CWizard97InteriorPageImpl : public CPropertyPageImpl< T, TBase > +{ +protected: +// Typedefs + typedef CWizard97InteriorPageImpl< T, TBase > thisClass; + typedef CPropertyPageImpl< T, TBase > baseClass; + +public: +// Constructors + CWizard97InteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) + { + m_psp.dwFlags |= PSP_HASHELP; + m_psp.dwFlags &= ~PSP_HIDEHEADER; + m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + + // Be sure to have the derived class define this in the constructor. + // We'll default it to something obvious in case its forgotten. + baseClass::SetHeaderTitle(_T("Call SetHeaderTitle in Derived Class")); + baseClass::SetHeaderSubTitle(_T("Call SetHeaderSubTitle in the constructor of the Derived Class.")); + } + +// Message Handling + BEGIN_MSG_MAP(thisClass) + CHAIN_MSG_MAP(baseClass) + END_MSG_MAP() +}; + +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// Aero Wizard support + +#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardFrameWindow - client side for an Aero Wizard frame window + +class CAeroWizardFrameWindow : public CPropertySheetWindow +{ +public: +// Constructors + CAeroWizardFrameWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) + { } + + CAeroWizardFrameWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Operations - new, Aero Wizard only + void SetNextText(LPCWSTR lpszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_SETNEXTTEXT, 0, (LPARAM)lpszText); + } + + void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::PostMessage(m_hWnd, PSM_SHOWWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); + } + + void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::PostMessage(m_hWnd, PSM_ENABLEWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); + } + + void SetButtonText(DWORD dwButton, LPCWSTR lpszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, PSM_SETBUTTONTEXT, (WPARAM)dwButton, (LPARAM)lpszText); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardFrameImpl - implements an Aero Wizard frame + +template +class ATL_NO_VTABLE CAeroWizardFrameImpl : public CPropertySheetImpl +{ +public: +// Constructor + CAeroWizardFrameImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : + CPropertySheetImpl(title, uStartPage, hWndParent) + { + m_psh.dwFlags |= PSH_WIZARD | PSH_AEROWIZARD; + } + +// Operations + void EnableResizing() + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + m_psh.dwFlags |= PSH_RESIZABLE; + } + + void UseHeaderBitmap() + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + m_psh.dwFlags |= PSH_HEADERBITMAP; + } + + void SetNoMargin() + { + ATLASSERT(m_hWnd == NULL); // can't do this after it's created + m_psh.dwFlags |= PSH_NOMARGIN; + } + +// Override to prevent use + HWND Create(HWND /*hWndParent*/ = NULL) + { + ATLASSERT(FALSE); // not supported for Aero Wizard + return NULL; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardFrame - for non-customized frames + +class CAeroWizardFrame : public CAeroWizardFrameImpl +{ +public: + CAeroWizardFrame(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) + : CAeroWizardFrameImpl(title, uStartPage, hWndParent) + { } + + BEGIN_MSG_MAP(CAeroWizardFrame) + MESSAGE_HANDLER(WM_COMMAND, CAeroWizardFrameImpl::OnCommand) + END_MSG_MAP() +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardPageWindow - client side for an Aero Wizard page + +class CAeroWizardPageWindow : public CPropertyPageWindow +{ +public: +// Constructors + CAeroWizardPageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) + { } + + CAeroWizardPageWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Attributes + CAeroWizardFrameWindow GetAeroWizardFrame() const + { + ATLASSERT(::IsWindow(m_hWnd)); + // This is not really top-level frame window, but it processes all frame messages + return CAeroWizardFrameWindow(GetParent()); + } + +// Operations - new, Aero Wizard only + void SetNextText(LPCWSTR lpszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetAeroWizardFrame().SetNextText(lpszText); + } + + void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetAeroWizardFrame().ShowWizardButtons(dwButtons, dwStates); + } + + void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetAeroWizardFrame().EnableWizardButtons(dwButtons, dwStates); + } + + void SetButtonText(DWORD dwButton, LPCWSTR lpszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(GetParent() != NULL); + GetAeroWizardFrame().SetButtonText(dwButton, lpszText); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardPageImpl - implements an Aero Wizard page + +template +class ATL_NO_VTABLE CAeroWizardPageImpl : public CPropertyPageImpl +{ +public: + CAeroWizardPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) + { } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardPage - for non-customized pages + +template +class CAeroWizardPage : public CAeroWizardPageImpl > +{ +public: + enum { IDD = t_wDlgTemplateID }; + + CAeroWizardPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardPageImpl(title) + { } + + DECLARE_EMPTY_MSG_MAP() +}; + + +#ifndef _ATL_NO_HOSTING + +// Note: You must #include to use these classes + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardAxPageImpl - Aero Wizard page that hosts ActiveX controls + +template +class ATL_NO_VTABLE CAeroWizardAxPageImpl : public CAxPropertyPageImpl< T, TBase > +{ +public: + CAeroWizardAxPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl< T, TBase >(title) + { } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAeroWizardAxPage - for non-customized pages + +template +class CAeroWizardAxPage : public CAeroWizardAxPageImpl > +{ +public: + enum { IDD = t_wDlgTemplateID }; + + CAeroWizardAxPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardAxPageImpl(title) + { } + +#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) + // not empty so we handle accelerators/create controls + BEGIN_MSG_MAP(CAeroWizardAxPage) + CHAIN_MSG_MAP(CAeroWizardAxPageImpl >) + END_MSG_MAP() +#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) + DECLARE_EMPTY_MSG_MAP() +#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) +}; + +#endif // _ATL_NO_HOSTING + +#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// TaskDialog support + +#if ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) + +/////////////////////////////////////////////////////////////////////////////// +// AtlTaskDialog - support for TaskDialog() function + +inline int AtlTaskDialog(HWND hWndParent, + ATL::_U_STRINGorID WindowTitle, ATL::_U_STRINGorID MainInstructionText, ATL::_U_STRINGorID ContentText, + TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons = 0U, ATL::_U_STRINGorID Icon = (LPCTSTR)NULL) +{ + int nRet = -1; + +#ifdef _WTL_TASKDIALOG_DIRECT + USES_CONVERSION; + HRESULT hRet = ::TaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), T2CW(WindowTitle.m_lpstr), T2CW(MainInstructionText.m_lpstr), T2CW(ContentText.m_lpstr), dwCommonButtons, T2CW(Icon.m_lpstr), &nRet); + ATLVERIFY(SUCCEEDED(hRet)); +#else + // This allows apps to run on older versions of Windows + typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialog)(HWND hwndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle, PCWSTR pszMainInstruction, PCWSTR pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon, int* pnButton); + + HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); + if(m_hCommCtrlDLL != NULL) + { + PFN_TaskDialog pfnTaskDialog = (PFN_TaskDialog)::GetProcAddress(m_hCommCtrlDLL, "TaskDialog"); + if(pfnTaskDialog != NULL) + { + USES_CONVERSION; + HRESULT hRet = pfnTaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), T2CW(WindowTitle.m_lpstr), T2CW(MainInstructionText.m_lpstr), T2CW(ContentText.m_lpstr), dwCommonButtons, T2CW(Icon.m_lpstr), &nRet); + ATLVERIFY(SUCCEEDED(hRet)); + } + + ::FreeLibrary(m_hCommCtrlDLL); + } +#endif + + return nRet; +} + + +/////////////////////////////////////////////////////////////////////////////// +// CTaskDialogConfig - TASKDIALOGCONFIG wrapper + +class CTaskDialogConfig : public TASKDIALOGCONFIG +{ +public: +// Constructor + CTaskDialogConfig() + { + Init(); + } + + void Init() + { + memset(this, 0, sizeof(TASKDIALOGCONFIG)); // initialize structure to 0/NULL + this->cbSize = sizeof(TASKDIALOGCONFIG); + this->hInstance = ModuleHelper::GetResourceInstance(); + } + +// Operations - setting values + // common buttons + void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) + { + this->dwCommonButtons = dwCommonButtons; + } + + // window title text + void SetWindowTitle(UINT nID) + { + this->pszWindowTitle = MAKEINTRESOURCEW(nID); + } + + void SetWindowTitle(LPCWSTR lpstrWindowTitle) + { + this->pszWindowTitle = lpstrWindowTitle; + } + + // main icon + void SetMainIcon(HICON hIcon) + { + this->dwFlags |= TDF_USE_HICON_MAIN; + this->hMainIcon = hIcon; + } + + void SetMainIcon(UINT nID) + { + this->dwFlags &= ~TDF_USE_HICON_MAIN; + this->pszMainIcon = MAKEINTRESOURCEW(nID); + } + + void SetMainIcon(LPCWSTR lpstrMainIcon) + { + this->dwFlags &= ~TDF_USE_HICON_MAIN; + this->pszMainIcon = lpstrMainIcon; + } + + // main instruction text + void SetMainInstructionText(UINT nID) + { + this->pszMainInstruction = MAKEINTRESOURCEW(nID); + } + + void SetMainInstructionText(LPCWSTR lpstrMainInstruction) + { + this->pszMainInstruction = lpstrMainInstruction; + } + + // content text + void SetContentText(UINT nID) + { + this->pszContent = MAKEINTRESOURCEW(nID); + } + + void SetContentText(LPCWSTR lpstrContent) + { + this->pszContent = lpstrContent; + } + + // buttons + void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) + { + this->pButtons = pButtons; + this->cButtons = cButtons; + if(nDefaultButton != 0) + this->nDefaultButton = nDefaultButton; + } + + void SetDefaultButton(int nDefaultButton) + { + this->nDefaultButton = nDefaultButton; + } + + // radio buttons + void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) + { + this->pRadioButtons = pRadioButtons; + this->cRadioButtons = cRadioButtons; + if(nDefaultRadioButton != 0) + this->nDefaultRadioButton = nDefaultRadioButton; + } + + void SetDefaultRadioButton(int nDefaultRadioButton) + { + this->nDefaultRadioButton = nDefaultRadioButton; + } + + // verification text + void SetVerificationText(UINT nID) + { + this->pszVerificationText = MAKEINTRESOURCEW(nID); + } + + void SetVerificationText(LPCWSTR lpstrVerificationText) + { + this->pszVerificationText = lpstrVerificationText; + } + + // expanded information text + void SetExpandedInformationText(UINT nID) + { + this->pszExpandedInformation = MAKEINTRESOURCEW(nID); + } + + void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) + { + this->pszExpandedInformation = lpstrExpandedInformation; + } + + // expanded control text + void SetExpandedControlText(UINT nID) + { + this->pszExpandedControlText = MAKEINTRESOURCEW(nID); + } + + void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) + { + this->pszExpandedControlText = lpstrExpandedControlText; + } + + // collapsed control text + void SetCollapsedControlText(UINT nID) + { + this->pszCollapsedControlText = MAKEINTRESOURCEW(nID); + } + + void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) + { + this->pszCollapsedControlText = lpstrCollapsedControlText; + } + + // footer icon + void SetFooterIcon(HICON hIcon) + { + this->dwFlags |= TDF_USE_HICON_FOOTER; + this->hFooterIcon = hIcon; + } + + void SetFooterIcon(UINT nID) + { + this->dwFlags &= ~TDF_USE_HICON_FOOTER; + this->pszFooterIcon = MAKEINTRESOURCEW(nID); + } + + void SetFooterIcon(LPCWSTR lpstrFooterIcon) + { + this->dwFlags &= ~TDF_USE_HICON_FOOTER; + this->pszFooterIcon = lpstrFooterIcon; + } + + // footer text + void SetFooterText(UINT nID) + { + this->pszFooter = MAKEINTRESOURCEW(nID); + } + + void SetFooterText(LPCWSTR lpstrFooterText) + { + this->pszFooter = lpstrFooterText; + } + + // width (in DLUs) + void SetWidth(UINT cxWidth) + { + this->cxWidth = cxWidth; + } + + // modify flags + void ModifyFlags(DWORD dwRemove, DWORD dwAdd) + { + this->dwFlags = (this->dwFlags & ~dwRemove) | dwAdd; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CTaskDialogImpl - implements a Task Dialog + +template +class ATL_NO_VTABLE CTaskDialogImpl +{ +public: + CTaskDialogConfig m_tdc; + HWND m_hWnd; // used only in callback functions + +// Constructor + CTaskDialogImpl(HWND hWndParent = NULL) : m_hWnd(NULL) + { + m_tdc.hwndParent = hWndParent; + m_tdc.pfCallback = T::TaskDialogCallback; + m_tdc.lpCallbackData = (LONG_PTR)static_cast(this); + } + +// Operations + HRESULT DoModal(HWND hWndParent = ::GetActiveWindow(), int* pnButton = NULL, int* pnRadioButton = NULL, BOOL* pfVerificationFlagChecked = NULL) + { + if(m_tdc.hwndParent == NULL) + m_tdc.hwndParent = hWndParent; + +#ifdef _WTL_TASKDIALOG_DIRECT + return ::TaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); +#else + + // This allows apps to run on older versions of Windows + typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialogIndirect)(const TASKDIALOGCONFIG* pTaskConfig, int* pnButton, int* pnRadioButton, BOOL* pfVerificationFlagChecked); + + HRESULT hRet = E_UNEXPECTED; + HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); + if(m_hCommCtrlDLL != NULL) + { + PFN_TaskDialogIndirect pfnTaskDialogIndirect = (PFN_TaskDialogIndirect)::GetProcAddress(m_hCommCtrlDLL, "TaskDialogIndirect"); + if(pfnTaskDialogIndirect != NULL) + hRet = pfnTaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); + + ::FreeLibrary(m_hCommCtrlDLL); + } + + return hRet; +#endif + } + +// Operations - setting values of TASKDIALOGCONFIG + // common buttons + void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) + { m_tdc.SetCommonButtons(dwCommonButtons); } + // window title text + void SetWindowTitle(UINT nID) + { m_tdc.SetWindowTitle(nID); } + void SetWindowTitle(LPCWSTR lpstrWindowTitle) + { m_tdc.SetWindowTitle(lpstrWindowTitle); } + // main icon + void SetMainIcon(HICON hIcon) + { m_tdc.SetMainIcon(hIcon); } + void SetMainIcon(UINT nID) + { m_tdc.SetMainIcon(nID); } + void SetMainIcon(LPCWSTR lpstrMainIcon) + { m_tdc.SetMainIcon(lpstrMainIcon); } + // main instruction text + void SetMainInstructionText(UINT nID) + { m_tdc.SetMainInstructionText(nID); } + void SetMainInstructionText(LPCWSTR lpstrMainInstruction) + { m_tdc.SetMainInstructionText(lpstrMainInstruction); } + // content text + void SetContentText(UINT nID) + { m_tdc.SetContentText(nID); } + void SetContentText(LPCWSTR lpstrContent) + { m_tdc.SetContentText(lpstrContent); } + // buttons + void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) + { m_tdc.SetButtons(pButtons, cButtons, nDefaultButton); } + void SetDefaultButton(int nDefaultButton) + { m_tdc.SetDefaultButton(nDefaultButton); } + // radio buttons + void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) + { m_tdc.SetRadioButtons(pRadioButtons, cRadioButtons, nDefaultRadioButton); } + void SetDefaultRadioButton(int nDefaultRadioButton) + { m_tdc.SetDefaultRadioButton(nDefaultRadioButton); } + // verification text + void SetVerificationText(UINT nID) + { m_tdc.SetVerificationText(nID); } + void SetVerificationText(LPCWSTR lpstrVerificationText) + { m_tdc.SetVerificationText(lpstrVerificationText); } + // expanded information text + void SetExpandedInformationText(UINT nID) + { m_tdc.SetExpandedInformationText(nID); } + void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) + { m_tdc.SetExpandedInformationText(lpstrExpandedInformation); } + // expanded control text + void SetExpandedControlText(UINT nID) + { m_tdc.SetExpandedControlText(nID); } + void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) + { m_tdc.SetExpandedControlText(lpstrExpandedControlText); } + // collapsed control text + void SetCollapsedControlText(UINT nID) + { m_tdc.SetCollapsedControlText(nID); } + void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) + { m_tdc.SetCollapsedControlText(lpstrCollapsedControlText); } + // footer icon + void SetFooterIcon(HICON hIcon) + { m_tdc.SetFooterIcon(hIcon); } + void SetFooterIcon(UINT nID) + { m_tdc.SetFooterIcon(nID); } + void SetFooterIcon(LPCWSTR lpstrFooterIcon) + { m_tdc.SetFooterIcon(lpstrFooterIcon); } + // footer text + void SetFooterText(UINT nID) + { m_tdc.SetFooterText(nID); } + void SetFooterText(LPCWSTR lpstrFooterText) + { m_tdc.SetFooterText(lpstrFooterText); } + // width (in DLUs) + void SetWidth(UINT cxWidth) + { m_tdc.SetWidth(cxWidth); } + // modify flags + void ModifyFlags(DWORD dwRemove, DWORD dwAdd) + { m_tdc.ModifyFlags(dwRemove, dwAdd); } + +// Implementation + static HRESULT CALLBACK TaskDialogCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) + { + T* pT = (T*)lpRefData; + ATLASSERT(pT->m_hWnd == NULL || pT->m_hWnd == hWnd); + + BOOL bRet = FALSE; + switch(uMsg) + { + case TDN_DIALOG_CONSTRUCTED: + pT->m_hWnd = hWnd; + pT->OnDialogConstructed(); + break; + case TDN_CREATED: + pT->OnCreated(); + break; + case TDN_BUTTON_CLICKED: + bRet = pT->OnButtonClicked((int)wParam); + break; + case TDN_RADIO_BUTTON_CLICKED: + pT->OnRadioButtonClicked((int)wParam); + break; + case TDN_HYPERLINK_CLICKED: + pT->OnHyperlinkClicked((LPCWSTR)lParam); + break; + case TDN_EXPANDO_BUTTON_CLICKED: + pT->OnExpandoButtonClicked((wParam != 0)); + break; + case TDN_VERIFICATION_CLICKED: + pT->OnVerificationClicked((wParam != 0)); + break; + case TDN_HELP: + pT->OnHelp(); + break; + case TDN_TIMER: + bRet = pT->OnTimer((DWORD)wParam); + break; + case TDN_NAVIGATED: + pT->OnNavigated(); + break; + case TDN_DESTROYED: + pT->OnDestroyed(); + pT->m_hWnd = NULL; + break; + default: + ATLTRACE2(atlTraceUI, 0, _T("Unknown notification received in CTaskDialogImpl::TaskDialogCallback\n")); + break; + } + + return (HRESULT)bRet; + } + +// Overrideables - notification handlers + void OnDialogConstructed() + { + } + + void OnCreated() + { + } + + BOOL OnButtonClicked(int /*nButton*/) + { + return FALSE; // don't prevent dialog to close + } + + void OnRadioButtonClicked(int /*nRadioButton*/) + { + } + + void OnHyperlinkClicked(LPCWSTR /*pszHREF*/) + { + } + + void OnExpandoButtonClicked(bool /*bExpanded*/) + { + } + + void OnVerificationClicked(bool /*bChecked*/) + { + } + + void OnHelp() + { + } + + BOOL OnTimer(DWORD /*dwTickCount*/) + { + return FALSE; // don't reset counter + } + + void OnNavigated() + { + } + + void OnDestroyed() + { + } + +// Commands - valid to call only from handlers + void NavigatePage(TASKDIALOGCONFIG& tdc) + { + ATLASSERT(m_hWnd != NULL); + + tdc.cbSize = sizeof(TASKDIALOGCONFIG); + if(tdc.hwndParent == NULL) + tdc.hwndParent = m_tdc.hwndParent; + tdc.pfCallback = m_tdc.pfCallback; + tdc.lpCallbackData = m_tdc.lpCallbackData; + (TASKDIALOGCONFIG)m_tdc = tdc; + + ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&tdc); + } + + // modify TASKDIALOGCONFIG values, then call this to update task dialog + void NavigatePage() + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&m_tdc); + } + + void ClickButton(int nButton) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_CLICK_BUTTON, nButton, 0L); + } + + void SetMarqueeProgressBar(BOOL bMarquee) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_SET_MARQUEE_PROGRESS_BAR, bMarquee, 0L); + } + + BOOL SetProgressBarState(int nNewState) + { + ATLASSERT(m_hWnd != NULL); + return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_STATE, nNewState, 0L); + } + + DWORD SetProgressBarRange(int nMinRange, int nMaxRange) + { + ATLASSERT(m_hWnd != NULL); + return (DWORD)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(nMinRange, nMaxRange)); + } + + int SetProgressBarPos(int nNewPos) + { + ATLASSERT(m_hWnd != NULL); + return (int)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_POS, nNewPos, 0L); + } + + BOOL SetProgressBarMarquee(BOOL bMarquee, UINT uSpeed) + { + ATLASSERT(m_hWnd != NULL); + return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_MARQUEE, bMarquee, uSpeed); + } + + void SetElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_SET_ELEMENT_TEXT, element, (LPARAM)lpstrText); + } + + void ClickRadioButton(int nRadioButton) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_CLICK_RADIO_BUTTON, nRadioButton, 0L); + } + + void EnableButton(int nButton, BOOL bEnable) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_ENABLE_BUTTON, nButton, bEnable); + } + + void EnableRadioButton(int nButton, BOOL bEnable) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_ENABLE_RADIO_BUTTON, nButton, bEnable); + } + + void ClickVerification(BOOL bCheck, BOOL bFocus) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_CLICK_VERIFICATION, bCheck, bFocus); + } + + void UpdateElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_UPDATE_ELEMENT_TEXT, element, (LPARAM)lpstrText); + } + + void SetButtonElevationRequiredState(int nButton, BOOL bElevation) + { + ATLASSERT(m_hWnd != NULL); + ::SendMessage(m_hWnd, TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, nButton, bElevation); + } + + void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, HICON hIcon) + { + ATLASSERT(m_hWnd != NULL); +#ifdef _DEBUG + if(element == TDIE_ICON_MAIN) + ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) != 0); + else if(element == TDIE_ICON_FOOTER) + ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) != 0); +#endif // _DEBUG + ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)hIcon); + } + + void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, LPCWSTR lpstrIcon) + { + ATLASSERT(m_hWnd != NULL); +#ifdef _DEBUG + if(element == TDIE_ICON_MAIN) + ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) == 0); + else if(element == TDIE_ICON_FOOTER) + ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) == 0); +#endif // _DEBUG + ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)lpstrIcon); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CTaskDialog - for non-customized task dialogs + +class CTaskDialog : public CTaskDialogImpl +{ +public: + CTaskDialog(HWND hWndParent = NULL) : CTaskDialogImpl(hWndParent) + { + m_tdc.pfCallback = NULL; + } +}; + +#endif // ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) + +}; // namespace WTL + +#endif // __ATLDLGS_H__ diff --git a/Externals/WTL80/atlfind.h b/Externals/WTL80/atlfind.h index a1dd52dbe6..0050a810da 100644 --- a/Externals/WTL80/atlfind.h +++ b/Externals/WTL80/atlfind.h @@ -1,1036 +1,1036 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLFIND_H__ -#define __ATLFIND_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifdef _WIN32_WCE - #error atlfind.h is not supported on Windows CE -#endif - -#ifndef __ATLCTRLS_H__ - #error atlfind.h requires atlctrls.h to be included first -#endif - -#ifndef __ATLDLGS_H__ - #error atlfind.h requires atldlgs.h to be included first -#endif - -#if !((defined(__ATLMISC_H__) && defined(_WTL_USE_CSTRING)) || defined(__ATLSTR_H__)) - #error atlfind.h requires CString (either from ATL's atlstr.h or WTL's atlmisc.h with _WTL_USE_CSTRING) -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CEditFindReplaceImplBase -// CEditFindReplaceImpl -// CRichEditFindReplaceImpl - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CEditFindReplaceImplBase - Base class for mixin classes that -// help implement Find/Replace for CEdit or CRichEditCtrl based window classes. - -template -class CEditFindReplaceImplBase -{ -protected: -// Typedefs - typedef CEditFindReplaceImplBase thisClass; - -// Data members - TFindReplaceDialog* m_pFindReplaceDialog; - _CSTRING_NS::CString m_sFindNext, m_sReplaceWith; - BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown; - LONG m_nInitialSearchPos; - HCURSOR m_hOldCursor; - -// Enumerations - enum TranslationTextItem - { - eText_OnReplaceAllMessage = 0, - eText_OnReplaceAllTitle = 1, - eText_OnTextNotFoundMessage = 2, - eText_OnTextNotFoundTitle = 3 - }; - -public: -// Constructors - CEditFindReplaceImplBase() : - m_pFindReplaceDialog(NULL), - m_bFindOnly(TRUE), - m_bFirstSearch(TRUE), - m_bMatchCase(FALSE), - m_bWholeWord(FALSE), - m_bFindDown(TRUE), - m_nInitialSearchPos(0), - m_hOldCursor(NULL) - { - } - -// Message Handlers - BEGIN_MSG_MAP(thisClass) - ALT_MSG_MAP(1) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd) - COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind) - COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat) - COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace) - END_MSG_MAP() - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_pFindReplaceDialog != NULL) - { - m_pFindReplaceDialog->SendMessage(WM_CLOSE); - ATLASSERT(m_pFindReplaceDialog == NULL); - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnFindReplaceCmd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - - TFindReplaceDialog* pDialog = TFindReplaceDialog::GetNotifier(lParam); - if(pDialog == NULL) - { - ATLASSERT(FALSE); - ::MessageBeep(MB_ICONERROR); - return 1; - } - ATLASSERT(pDialog == m_pFindReplaceDialog); - - LPFINDREPLACE findReplace = (LPFINDREPLACE)lParam; - if((m_pFindReplaceDialog != NULL) && (findReplace != NULL)) - { - if(pDialog->FindNext()) - { - pT->OnFindNext(pDialog->GetFindString(), pDialog->SearchDown(), - pDialog->MatchCase(), pDialog->MatchWholeWord()); - } - else if(pDialog->ReplaceCurrent()) - { - pT->OnReplaceSel(pDialog->GetFindString(), - pDialog->SearchDown(), pDialog->MatchCase(), pDialog->MatchWholeWord(), - pDialog->GetReplaceString()); - } - else if(pDialog->ReplaceAll()) - { - pT->OnReplaceAll(pDialog->GetFindString(), pDialog->GetReplaceString(), - pDialog->MatchCase(), pDialog->MatchWholeWord()); - } - else if(pDialog->IsTerminating()) - { - // Dialog is going away (but hasn't gone away yet) - // OnFinalMessage will "delete this" - pT->OnTerminatingFindReplaceDialog(m_pFindReplaceDialog); - m_pFindReplaceDialog = NULL; - } - } - - return 0; - } - - LRESULT OnEditFind(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->FindReplace(TRUE); - - return 0; - } - - LRESULT OnEditRepeat(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - - // If the user is holding down SHIFT when hitting F3, we'll - // search in reverse. Otherwise, we'll search forward. - // (be sure to have an accelerator mapped to ID_EDIT_REPEAT - // for both F3 and Shift+F3) - m_bFindDown = !((::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000); - - if(m_sFindNext.IsEmpty()) - { - pT->FindReplace(TRUE); - } - else - { - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - pT->TextNotFound(m_sFindNext); - } - - return 0; - } - - LRESULT OnEditReplace(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled) - { - T* pT = static_cast(this); - - DWORD style = pT->GetStyle(); - if((style & ES_READONLY) != ES_READONLY) - { - pT->FindReplace(FALSE); - } - else - { - // Don't allow replace when the edit control is read only - bHandled = FALSE; - } - - return 0; - } - -// Operations (overrideable) - TFindReplaceDialog* CreateFindReplaceDialog(BOOL bFindOnly, // TRUE for Find, FALSE for FindReplace - LPCTSTR lpszFindWhat, - LPCTSTR lpszReplaceWith = NULL, - DWORD dwFlags = FR_DOWN, - HWND hWndParent = NULL) - { - // You can override all of this in a derived class - - TFindReplaceDialog* findReplaceDialog = new TFindReplaceDialog(); - if(findReplaceDialog == NULL) - { - ::MessageBeep(MB_ICONHAND); - } - else - { - HWND hWndFindReplace = findReplaceDialog->Create(bFindOnly, - lpszFindWhat, lpszReplaceWith, dwFlags, hWndParent); - if(hWndFindReplace == NULL) - { - delete findReplaceDialog; - findReplaceDialog = NULL; - } - else - { - findReplaceDialog->SetActiveWindow(); - findReplaceDialog->ShowWindow(SW_SHOW); - } - } - - return findReplaceDialog; - } - - void AdjustDialogPosition(HWND hWndDialog) - { - ATLASSERT((hWndDialog != NULL) && ::IsWindow(hWndDialog)); - - T* pT = static_cast(this); - LONG nStartChar = 0, nEndChar = 0; - // Send EM_GETSEL so we can use both Edit and RichEdit - // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) - ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - POINT point = pT->PosFromChar(nStartChar); - ::ClientToScreen(pT->GetParent(), &point); - CRect rect; - ::GetWindowRect(hWndDialog, &rect); - if(rect.PtInRect(point)) - { - if(point.y > rect.Height()) - { - rect.OffsetRect(0, point.y - rect.bottom - 20); - } - else - { - int nVertExt = GetSystemMetrics(SM_CYSCREEN); - if(point.y + rect.Height() < nVertExt) - rect.OffsetRect(0, 40 + point.y - rect.top); - } - - ::MoveWindow(hWndDialog, rect.left, rect.top, rect.Width(), rect.Height(), TRUE); - } - } - - DWORD GetFindReplaceDialogFlags(void) const - { - DWORD dwFlags = 0; - - if(m_bFindDown) - dwFlags |= FR_DOWN; - if(m_bMatchCase) - dwFlags |= FR_MATCHCASE; - if(m_bWholeWord) - dwFlags |= FR_WHOLEWORD; - - return dwFlags; - } - - void FindReplace(BOOL bFindOnly) - { - T* pT = static_cast(this); - m_bFirstSearch = TRUE; - if(m_pFindReplaceDialog != NULL) - { - if(m_bFindOnly == bFindOnly) - { - m_pFindReplaceDialog->SetActiveWindow(); - m_pFindReplaceDialog->ShowWindow(SW_SHOW); - return; - } - else - { - m_pFindReplaceDialog->SendMessage(WM_CLOSE); - ATLASSERT(m_pFindReplaceDialog == NULL); - } - } - - ATLASSERT(m_pFindReplaceDialog == NULL); - - _CSTRING_NS::CString findNext; - pT->GetSelText(findNext); - // if selection is empty or spans multiple lines use old find text - if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1)) - findNext = m_sFindNext; - _CSTRING_NS::CString replaceWith = m_sReplaceWith; - DWORD dwFlags = pT->GetFindReplaceDialogFlags(); - - m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly, - findNext, replaceWith, dwFlags, pT->operator HWND()); - ATLASSERT(m_pFindReplaceDialog != NULL); - if(m_pFindReplaceDialog != NULL) - m_bFindOnly = bFindOnly; - } - - BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bMatchCase, BOOL /*bWholeWord*/) - { - T* pT = static_cast(this); - - // check length first - size_t nLen = lstrlen(lpszCompare); - LONG nStartChar = 0, nEndChar = 0; - // Send EM_GETSEL so we can use both Edit and RichEdit - // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) - ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - if(nLen != (size_t)(nEndChar - nStartChar)) - return FALSE; - - // length is the same, check contents - _CSTRING_NS::CString selectedText; - pT->GetSelText(selectedText); - - return (bMatchCase && selectedText.Compare(lpszCompare) == 0) || - (!bMatchCase && selectedText.CompareNoCase(lpszCompare) == 0); - } - - void TextNotFound(LPCTSTR lpszFind) - { - T* pT = static_cast(this); - m_bFirstSearch = TRUE; - pT->OnTextNotFound(lpszFind); - } - - _CSTRING_NS::CString GetTranslationText(enum TranslationTextItem eItem) const - { - _CSTRING_NS::CString text; - switch(eItem) - { - case eText_OnReplaceAllMessage: - text = _T("Replaced %d occurances of \"%s\" with \"%s\""); - break; - case eText_OnReplaceAllTitle: - text = _T("Replace All"); - break; - case eText_OnTextNotFoundMessage: - text = _T("Unable to find the text \"%s\""); - break; - case eText_OnTextNotFoundTitle: - text = _T("Text not found"); - break; - } - - return text; - } - -// Overrideable Handlers - void OnFindNext(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord) - { - T* pT = static_cast(this); - - m_sFindNext = lpszFind; - m_bMatchCase = bMatchCase; - m_bWholeWord = bWholeWord; - m_bFindDown = bFindDown; - - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - pT->TextNotFound(m_sFindNext); - else - pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); - } - - void OnReplaceSel(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord, LPCTSTR lpszReplace) - { - T* pT = static_cast(this); - - m_sFindNext = lpszFind; - m_sReplaceWith = lpszReplace; - m_bMatchCase = bMatchCase; - m_bWholeWord = bWholeWord; - m_bFindDown = bFindDown; - - if(pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) - pT->ReplaceSel(m_sReplaceWith); - - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - pT->TextNotFound(m_sFindNext); - else - pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); - } - - void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace, BOOL bMatchCase, BOOL bWholeWord) - { - T* pT = static_cast(this); - - m_sFindNext = lpszFind; - m_sReplaceWith = lpszReplace; - m_bMatchCase = bMatchCase; - m_bWholeWord = bWholeWord; - m_bFindDown = TRUE; - - // no selection or different than what looking for - if(!pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) - { - if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) - { - pT->TextNotFound(m_sFindNext); - return; - } - } - - pT->OnReplaceAllCoreBegin(); - - int replaceCount=0; - do - { - ++replaceCount; - pT->ReplaceSel(m_sReplaceWith); - } while(pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)); - - pT->OnReplaceAllCoreEnd(replaceCount); - } - - void OnReplaceAllCoreBegin() - { - T* pT = static_cast(this); - - m_hOldCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT)); - - pT->HideSelection(TRUE, FALSE); - - } - - void OnReplaceAllCoreEnd(int replaceCount) - { - T* pT = static_cast(this); - pT->HideSelection(FALSE, FALSE); - - ::SetCursor(m_hOldCursor); - - _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage); - if(message.GetLength() > 0) - { - _CSTRING_NS::CString formattedMessage; - formattedMessage.Format(message, - replaceCount, m_sFindNext, m_sReplaceWith); - if(m_pFindReplaceDialog != NULL) - { - m_pFindReplaceDialog->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnReplaceAllTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - else - { - pT->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnReplaceAllTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - } - } - - void OnTextNotFound(LPCTSTR lpszFind) - { - T* pT = static_cast(this); - _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage); - if(message.GetLength() > 0) - { - _CSTRING_NS::CString formattedMessage; - formattedMessage.Format(message, lpszFind); - if(m_pFindReplaceDialog != NULL) - { - m_pFindReplaceDialog->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnTextNotFoundTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - else - { - pT->MessageBox(formattedMessage, - pT->GetTranslationText(eText_OnTextNotFoundTitle), - MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); - } - } - else - { - ::MessageBeep(MB_ICONHAND); - } - } - - void OnTerminatingFindReplaceDialog(TFindReplaceDialog*& /*findReplaceDialog*/) - { - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CEditFindReplaceImpl - Mixin class for implementing Find/Replace for CEdit -// based window classes. - -// Chain to CEditFindReplaceImpl message map. Your class must also derive from CEdit. -// Example: -// class CMyEdit : public CWindowImpl, -// public CEditFindReplaceImpl -// { -// public: -// BEGIN_MSG_MAP(CMyEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CEditFindReplaceImpl, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CEditFindReplaceImpl : public CEditFindReplaceImplBase -{ -protected: - typedef CEditFindReplaceImpl thisClass; - typedef CEditFindReplaceImplBase baseClass; - -// Data members - LPTSTR m_pShadowBuffer; // Special shadow buffer only used in some cases. - UINT m_nShadowSize; - int m_bShadowBufferNeeded; // TRUE, FALSE, < 0 => Need to check - -public: -// Constructors - CEditFindReplaceImpl() : - m_pShadowBuffer(NULL), - m_nShadowSize(0), - m_bShadowBufferNeeded(-1) - { - } - - virtual ~CEditFindReplaceImpl() - { - if(m_pShadowBuffer != NULL) - { - delete [] m_pShadowBuffer; - m_pShadowBuffer = NULL; - } - } - -// Message Handlers - BEGIN_MSG_MAP(thisClass) - ALT_MSG_MAP(1) - CHAIN_MSG_MAP_ALT(baseClass, 1) - END_MSG_MAP() - -// Operations - // Supported only for RichEdit, so this does nothing for Edit - void HideSelection(BOOL /*bHide*/ = TRUE, BOOL /*bChangeStyle*/ = FALSE) - { - } - -// Operations (overrideable) - BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) - { - T* pT = static_cast(this); - - ATLASSERT(lpszFind != NULL); - ATLASSERT(*lpszFind != _T('\0')); - - UINT nLen = pT->GetBufferLength(); - int nStartChar = 0, nEndChar = 0; - pT->GetSel(nStartChar, nEndChar); - UINT nStart = nStartChar; - int iDir = bFindDown ? +1 : -1; - - // can't find a match before the first character - if(nStart == 0 && iDir < 0) - return FALSE; - - LPCTSTR lpszText = pT->LockBuffer(); - - bool isDBCS = false; -#ifdef _MBCS - CPINFO info = { 0 }; - ::GetCPInfo(::GetOEMCP(), &info); - isDBCS = (info.MaxCharSize > 1); -#endif - - if(iDir < 0) - { - // always go back one for search backwards - nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); - } - else if(nStartChar != nEndChar && pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord)) - { - // easy to go backward/forward with SBCS -#ifndef _UNICODE - if(::IsDBCSLeadByte(lpszText[nStart])) - nStart++; -#endif - nStart += iDir; - } - - // handle search with nStart past end of buffer - UINT nLenFind = ::lstrlen(lpszFind); - if(nStart + nLenFind - 1 >= nLen) - { - if(iDir < 0 && nLen >= nLenFind) - { - if(isDBCS) - { - // walk back to previous character n times - nStart = nLen; - int n = nLenFind; - while(n--) - { - nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); - } - } - else - { - // single-byte character set is easy and fast - nStart = nLen - nLenFind; - } - ATLASSERT(nStart + nLenFind - 1 <= nLen); - } - else - { - pT->UnlockBuffer(); - return FALSE; - } - } - - // start the search at nStart - LPCTSTR lpsz = lpszText + nStart; - typedef int (WINAPI* CompareProc)(LPCTSTR str1, LPCTSTR str2); - CompareProc pfnCompare = bMatchCase ? lstrcmp : lstrcmpi; - - if(isDBCS) - { - // double-byte string search - LPCTSTR lpszStop = NULL; - if(iDir > 0) - { - // start at current and find _first_ occurrance - lpszStop = lpszText + nLen - nLenFind + 1; - } - else - { - // start at top and find _last_ occurrance - lpszStop = lpsz; - lpsz = lpszText; - } - - LPCTSTR lpszFound = NULL; - while(lpsz <= lpszStop) - { -#ifndef _UNICODE - if(!bMatchCase || (*lpsz == *lpszFind && (!::IsDBCSLeadByte(*lpsz) || lpsz[1] == lpszFind[1]))) -#else - if(!bMatchCase || (*lpsz == *lpszFind && lpsz[1] == lpszFind[1])) -#endif - { - LPTSTR lpch = (LPTSTR)(lpsz + nLenFind); - TCHAR chSave = *lpch; - *lpch = _T('\0'); - int nResult = (*pfnCompare)(lpsz, lpszFind); - *lpch = chSave; - if(nResult == 0) - { - lpszFound = lpsz; - if(iDir > 0) - break; - } - } - lpsz = ::CharNext(lpsz); - } - pT->UnlockBuffer(); - - if(lpszFound != NULL) - { - int n = (int)(lpszFound - lpszText); - pT->SetSel(n, n + nLenFind); - return TRUE; - } - } - else - { - // single-byte string search - UINT nCompare; - if(iDir < 0) - nCompare = (UINT)(lpsz - lpszText) + 1; - else - nCompare = nLen - (UINT)(lpsz - lpszText) - nLenFind + 1; - - while(nCompare > 0) - { - ATLASSERT(lpsz >= lpszText); - ATLASSERT(lpsz + nLenFind - 1 <= lpszText + nLen - 1); - - LPSTR lpch = (LPSTR)(lpsz + nLenFind); - char chSave = *lpch; - *lpch = '\0'; - int nResult = (*pfnCompare)(lpsz, lpszFind); - *lpch = chSave; - if(nResult == 0) - { - pT->UnlockBuffer(); - int n = (int)(lpsz - lpszText); - pT->SetSel(n, n + nLenFind); - return TRUE; - } - - // restore character at end of search - *lpch = chSave; - - // move on to next substring - nCompare--; - lpsz += iDir; - } - pT->UnlockBuffer(); - } - - return FALSE; - } - - LPCTSTR LockBuffer() const - { - const T* pT = static_cast(this); - - ATLASSERT(pT->m_hWnd != NULL); - - BOOL useShadowBuffer = pT->UseShadowBuffer(); - if(useShadowBuffer) - { - if(m_pShadowBuffer == NULL || pT->GetModify()) - { - ATLASSERT(m_pShadowBuffer != NULL || m_nShadowSize == 0); - UINT nSize = pT->GetWindowTextLength() + 1; - if(nSize > m_nShadowSize) - { - // need more room for shadow buffer - T* pThisNoConst = const_cast(pT); - delete[] m_pShadowBuffer; - pThisNoConst->m_pShadowBuffer = NULL; - pThisNoConst->m_nShadowSize = 0; - pThisNoConst->m_pShadowBuffer = new TCHAR[nSize]; - pThisNoConst->m_nShadowSize = nSize; - } - - // update the shadow buffer with GetWindowText - ATLASSERT(m_nShadowSize >= nSize); - ATLASSERT(m_pShadowBuffer != NULL); - pT->GetWindowText(m_pShadowBuffer, nSize); - } - - return m_pShadowBuffer; - } - - HLOCAL hLocal = pT->GetHandle(); - ATLASSERT(hLocal != NULL); - LPCTSTR lpszText = (LPCTSTR)::LocalLock(hLocal); - ATLASSERT(lpszText != NULL); - - return lpszText; - } - - void UnlockBuffer() const - { - const T* pT = static_cast(this); - - ATLASSERT(pT->m_hWnd != NULL); - - BOOL useShadowBuffer = pT->UseShadowBuffer(); - if(!useShadowBuffer) - { - HLOCAL hLocal = pT->GetHandle(); - ATLASSERT(hLocal != NULL); - ::LocalUnlock(hLocal); - } - } - - UINT GetBufferLength() const - { - const T* pT = static_cast(this); - - ATLASSERT(pT->m_hWnd != NULL); - UINT nLen = 0; - LPCTSTR lpszText = pT->LockBuffer(); - if(lpszText != NULL) - nLen = ::lstrlen(lpszText); - pT->UnlockBuffer(); - - return nLen; - } - - LONG EndOfLine(LPCTSTR lpszText, UINT nLen, UINT nIndex) const - { - LPCTSTR lpsz = lpszText + nIndex; - LPCTSTR lpszStop = lpszText + nLen; - while(lpsz < lpszStop && *lpsz != _T('\r')) - ++lpsz; - return LONG(lpsz - lpszText); - } - - LONG GetSelText(_CSTRING_NS::CString& strText) const - { - const T* pT = static_cast(this); - - int nStartChar = 0, nEndChar = 0; - pT->GetSel(nStartChar, nEndChar); - ATLASSERT((UINT)nEndChar <= pT->GetBufferLength()); - LPCTSTR lpszText = pT->LockBuffer(); - LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar; - SecureHelper::memcpy_x(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR)); - strText.ReleaseBuffer(nLen); - pT->UnlockBuffer(); - - return nLen; - } - - BOOL UseShadowBuffer(void) const - { - const T* pT = static_cast(this); - - if(pT->m_bShadowBufferNeeded < 0) - { - T* pThisNoConst = const_cast(pT); - - OSVERSIONINFO ovi = { 0 }; - ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - ::GetVersionEx(&ovi); - - bool bWin9x = (ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); - if(bWin9x) - { - // Windows 95, 98, ME - // Under Win9x, it is necessary to maintain a shadow buffer. - // It is only updated when the control contents have been changed. - pThisNoConst->m_bShadowBufferNeeded = TRUE; - } - else - { - // Windows NT, 2000, XP, etc. - pThisNoConst->m_bShadowBufferNeeded = FALSE; - -#ifndef _UNICODE - // On Windows XP (or later), if common controls version 6 is in use - // (such as via theming), then EM_GETHANDLE will always return a UNICODE string. - // If theming is enabled and Common Controls version 6 is in use, - // you're really not suppose to superclass or subclass common controls - // with an ANSI windows procedure (so its best to only theme if you use UNICODE). - // Using a shadow buffer uses GetWindowText instead, so it solves - // this problem for us (although it makes it a little less efficient). - - if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) - { - // We use DLLVERSIONINFO_private so we don't have to depend on shlwapi.h - typedef struct _DLLVERSIONINFO_private - { - DWORD cbSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformID; - } DLLVERSIONINFO_private; - - HMODULE hModule = ::LoadLibrary("comctl32.dll"); - if(hModule != NULL) - { - typedef HRESULT (CALLBACK *LPFN_DllGetVersion)(DLLVERSIONINFO_private *); - LPFN_DllGetVersion fnDllGetVersion = (LPFN_DllGetVersion)::GetProcAddress(hModule, "DllGetVersion"); - if(fnDllGetVersion != NULL) - { - DLLVERSIONINFO_private version = { 0 }; - version.cbSize = sizeof(DLLVERSIONINFO_private); - if(SUCCEEDED(fnDllGetVersion(&version))) - { - if(version.dwMajorVersion >= 6) - { - pThisNoConst->m_bShadowBufferNeeded = TRUE; - - ATLTRACE2(atlTraceUI, 0, _T("Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later (likely through a manifest file).\r\n")); - ATLTRACE2(atlTraceUI, 0, _T("If you use common controls version 6 or later, you should only do so for UNICODE builds.\r\n")); - } - } - } - - ::FreeLibrary(hModule); - hModule = NULL; - } - } -#endif // !_UNICODE - } - } - - return (pT->m_bShadowBufferNeeded == TRUE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CRichEditFindReplaceImpl - Mixin class for implementing Find/Replace for CRichEditCtrl -// based window classes. - -// Chain to CRichEditFindReplaceImpl message map. Your class must also derive from CRichEditCtrl. -// Example: -// class CMyRichEdit : public CWindowImpl, -// public CRichEditFindReplaceImpl -// { -// public: -// BEGIN_MSG_MAP(CMyRichEdit) -// // your handlers... -// CHAIN_MSG_MAP_ALT(CRichEditFindReplaceImpl, 1) -// END_MSG_MAP() -// // other stuff... -// }; - -template -class CRichEditFindReplaceImpl : public CEditFindReplaceImplBase -{ -protected: - typedef CRichEditFindReplaceImpl thisClass; - typedef CEditFindReplaceImplBase baseClass; - -public: - BEGIN_MSG_MAP(thisClass) - ALT_MSG_MAP(1) - CHAIN_MSG_MAP_ALT(baseClass, 1) - END_MSG_MAP() - -// Operations (overrideable) - BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) - { - T* pT = static_cast(this); - - ATLASSERT(lpszFind != NULL); - FINDTEXTEX ft = { 0 }; - - pT->GetSel(ft.chrg); - if(m_bFirstSearch) - { - if(bFindDown) - m_nInitialSearchPos = ft.chrg.cpMin; - else - m_nInitialSearchPos = ft.chrg.cpMax; - m_bFirstSearch = FALSE; - } - -#if (_RICHEDIT_VER >= 0x0200) - ft.lpstrText = (LPTSTR)lpszFind; -#else // !(_RICHEDIT_VER >= 0x0200) - USES_CONVERSION; - ft.lpstrText = T2A((LPTSTR)lpszFind); -#endif // !(_RICHEDIT_VER >= 0x0200) - - if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection - { - if(bFindDown) - { - ft.chrg.cpMin++; - } - else - { - // won't wraparound backwards - ft.chrg.cpMin = max(ft.chrg.cpMin, 0); - } - } - - DWORD dwFlags = bMatchCase ? FR_MATCHCASE : 0; - dwFlags |= bWholeWord ? FR_WHOLEWORD : 0; - - ft.chrg.cpMax = pT->GetTextLength() + m_nInitialSearchPos; - - if(bFindDown) - { - if(m_nInitialSearchPos >= 0) - ft.chrg.cpMax = pT->GetTextLength(); - - dwFlags |= FR_DOWN; - ATLASSERT(ft.chrg.cpMax >= ft.chrg.cpMin); - } - else - { - if(m_nInitialSearchPos >= 0) - ft.chrg.cpMax = 0; - - dwFlags &= ~FR_DOWN; - ATLASSERT(ft.chrg.cpMax <= ft.chrg.cpMin); - } - - BOOL bRet = FALSE; - - if(pT->FindAndSelect(dwFlags, ft) != -1) - { - bRet = TRUE; // we found the text - } - else if(m_nInitialSearchPos > 0) - { - // if the original starting point was not the beginning - // of the buffer and we haven't already been here - if(bFindDown) - { - ft.chrg.cpMin = 0; - ft.chrg.cpMax = m_nInitialSearchPos; - } - else - { - ft.chrg.cpMin = pT->GetTextLength(); - ft.chrg.cpMax = m_nInitialSearchPos; - } - m_nInitialSearchPos = m_nInitialSearchPos - pT->GetTextLength(); - - bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE; - } - - return bRet; - } - - long FindAndSelect(DWORD dwFlags, FINDTEXTEX& ft) - { - T* pT = static_cast(this); - LONG index = pT->FindText(dwFlags, ft); - if(index != -1) // i.e. we found something - pT->SetSel(ft.chrgText); - - return index; - } -}; - -}; // namespace WTL - -#endif // __ATLFIND_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLFIND_H__ +#define __ATLFIND_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifdef _WIN32_WCE + #error atlfind.h is not supported on Windows CE +#endif + +#ifndef __ATLCTRLS_H__ + #error atlfind.h requires atlctrls.h to be included first +#endif + +#ifndef __ATLDLGS_H__ + #error atlfind.h requires atldlgs.h to be included first +#endif + +#if !((defined(__ATLMISC_H__) && defined(_WTL_USE_CSTRING)) || defined(__ATLSTR_H__)) + #error atlfind.h requires CString (either from ATL's atlstr.h or WTL's atlmisc.h with _WTL_USE_CSTRING) +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CEditFindReplaceImplBase +// CEditFindReplaceImpl +// CRichEditFindReplaceImpl + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CEditFindReplaceImplBase - Base class for mixin classes that +// help implement Find/Replace for CEdit or CRichEditCtrl based window classes. + +template +class CEditFindReplaceImplBase +{ +protected: +// Typedefs + typedef CEditFindReplaceImplBase thisClass; + +// Data members + TFindReplaceDialog* m_pFindReplaceDialog; + _CSTRING_NS::CString m_sFindNext, m_sReplaceWith; + BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown; + LONG m_nInitialSearchPos; + HCURSOR m_hOldCursor; + +// Enumerations + enum TranslationTextItem + { + eText_OnReplaceAllMessage = 0, + eText_OnReplaceAllTitle = 1, + eText_OnTextNotFoundMessage = 2, + eText_OnTextNotFoundTitle = 3 + }; + +public: +// Constructors + CEditFindReplaceImplBase() : + m_pFindReplaceDialog(NULL), + m_bFindOnly(TRUE), + m_bFirstSearch(TRUE), + m_bMatchCase(FALSE), + m_bWholeWord(FALSE), + m_bFindDown(TRUE), + m_nInitialSearchPos(0), + m_hOldCursor(NULL) + { + } + +// Message Handlers + BEGIN_MSG_MAP(thisClass) + ALT_MSG_MAP(1) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd) + COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind) + COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat) + COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace) + END_MSG_MAP() + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_pFindReplaceDialog != NULL) + { + m_pFindReplaceDialog->SendMessage(WM_CLOSE); + ATLASSERT(m_pFindReplaceDialog == NULL); + } + + bHandled = FALSE; + return 0; + } + + LRESULT OnFindReplaceCmd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + + TFindReplaceDialog* pDialog = TFindReplaceDialog::GetNotifier(lParam); + if(pDialog == NULL) + { + ATLASSERT(FALSE); + ::MessageBeep(MB_ICONERROR); + return 1; + } + ATLASSERT(pDialog == m_pFindReplaceDialog); + + LPFINDREPLACE findReplace = (LPFINDREPLACE)lParam; + if((m_pFindReplaceDialog != NULL) && (findReplace != NULL)) + { + if(pDialog->FindNext()) + { + pT->OnFindNext(pDialog->GetFindString(), pDialog->SearchDown(), + pDialog->MatchCase(), pDialog->MatchWholeWord()); + } + else if(pDialog->ReplaceCurrent()) + { + pT->OnReplaceSel(pDialog->GetFindString(), + pDialog->SearchDown(), pDialog->MatchCase(), pDialog->MatchWholeWord(), + pDialog->GetReplaceString()); + } + else if(pDialog->ReplaceAll()) + { + pT->OnReplaceAll(pDialog->GetFindString(), pDialog->GetReplaceString(), + pDialog->MatchCase(), pDialog->MatchWholeWord()); + } + else if(pDialog->IsTerminating()) + { + // Dialog is going away (but hasn't gone away yet) + // OnFinalMessage will "delete this" + pT->OnTerminatingFindReplaceDialog(m_pFindReplaceDialog); + m_pFindReplaceDialog = NULL; + } + } + + return 0; + } + + LRESULT OnEditFind(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->FindReplace(TRUE); + + return 0; + } + + LRESULT OnEditRepeat(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + + // If the user is holding down SHIFT when hitting F3, we'll + // search in reverse. Otherwise, we'll search forward. + // (be sure to have an accelerator mapped to ID_EDIT_REPEAT + // for both F3 and Shift+F3) + m_bFindDown = !((::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000); + + if(m_sFindNext.IsEmpty()) + { + pT->FindReplace(TRUE); + } + else + { + if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) + pT->TextNotFound(m_sFindNext); + } + + return 0; + } + + LRESULT OnEditReplace(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled) + { + T* pT = static_cast(this); + + DWORD style = pT->GetStyle(); + if((style & ES_READONLY) != ES_READONLY) + { + pT->FindReplace(FALSE); + } + else + { + // Don't allow replace when the edit control is read only + bHandled = FALSE; + } + + return 0; + } + +// Operations (overrideable) + TFindReplaceDialog* CreateFindReplaceDialog(BOOL bFindOnly, // TRUE for Find, FALSE for FindReplace + LPCTSTR lpszFindWhat, + LPCTSTR lpszReplaceWith = NULL, + DWORD dwFlags = FR_DOWN, + HWND hWndParent = NULL) + { + // You can override all of this in a derived class + + TFindReplaceDialog* findReplaceDialog = new TFindReplaceDialog(); + if(findReplaceDialog == NULL) + { + ::MessageBeep(MB_ICONHAND); + } + else + { + HWND hWndFindReplace = findReplaceDialog->Create(bFindOnly, + lpszFindWhat, lpszReplaceWith, dwFlags, hWndParent); + if(hWndFindReplace == NULL) + { + delete findReplaceDialog; + findReplaceDialog = NULL; + } + else + { + findReplaceDialog->SetActiveWindow(); + findReplaceDialog->ShowWindow(SW_SHOW); + } + } + + return findReplaceDialog; + } + + void AdjustDialogPosition(HWND hWndDialog) + { + ATLASSERT((hWndDialog != NULL) && ::IsWindow(hWndDialog)); + + T* pT = static_cast(this); + LONG nStartChar = 0, nEndChar = 0; + // Send EM_GETSEL so we can use both Edit and RichEdit + // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) + ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); + POINT point = pT->PosFromChar(nStartChar); + ::ClientToScreen(pT->GetParent(), &point); + CRect rect; + ::GetWindowRect(hWndDialog, &rect); + if(rect.PtInRect(point)) + { + if(point.y > rect.Height()) + { + rect.OffsetRect(0, point.y - rect.bottom - 20); + } + else + { + int nVertExt = GetSystemMetrics(SM_CYSCREEN); + if(point.y + rect.Height() < nVertExt) + rect.OffsetRect(0, 40 + point.y - rect.top); + } + + ::MoveWindow(hWndDialog, rect.left, rect.top, rect.Width(), rect.Height(), TRUE); + } + } + + DWORD GetFindReplaceDialogFlags(void) const + { + DWORD dwFlags = 0; + + if(m_bFindDown) + dwFlags |= FR_DOWN; + if(m_bMatchCase) + dwFlags |= FR_MATCHCASE; + if(m_bWholeWord) + dwFlags |= FR_WHOLEWORD; + + return dwFlags; + } + + void FindReplace(BOOL bFindOnly) + { + T* pT = static_cast(this); + m_bFirstSearch = TRUE; + if(m_pFindReplaceDialog != NULL) + { + if(m_bFindOnly == bFindOnly) + { + m_pFindReplaceDialog->SetActiveWindow(); + m_pFindReplaceDialog->ShowWindow(SW_SHOW); + return; + } + else + { + m_pFindReplaceDialog->SendMessage(WM_CLOSE); + ATLASSERT(m_pFindReplaceDialog == NULL); + } + } + + ATLASSERT(m_pFindReplaceDialog == NULL); + + _CSTRING_NS::CString findNext; + pT->GetSelText(findNext); + // if selection is empty or spans multiple lines use old find text + if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1)) + findNext = m_sFindNext; + _CSTRING_NS::CString replaceWith = m_sReplaceWith; + DWORD dwFlags = pT->GetFindReplaceDialogFlags(); + + m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly, + findNext, replaceWith, dwFlags, pT->operator HWND()); + ATLASSERT(m_pFindReplaceDialog != NULL); + if(m_pFindReplaceDialog != NULL) + m_bFindOnly = bFindOnly; + } + + BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bMatchCase, BOOL /*bWholeWord*/) + { + T* pT = static_cast(this); + + // check length first + size_t nLen = lstrlen(lpszCompare); + LONG nStartChar = 0, nEndChar = 0; + // Send EM_GETSEL so we can use both Edit and RichEdit + // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) + ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); + if(nLen != (size_t)(nEndChar - nStartChar)) + return FALSE; + + // length is the same, check contents + _CSTRING_NS::CString selectedText; + pT->GetSelText(selectedText); + + return (bMatchCase && selectedText.Compare(lpszCompare) == 0) || + (!bMatchCase && selectedText.CompareNoCase(lpszCompare) == 0); + } + + void TextNotFound(LPCTSTR lpszFind) + { + T* pT = static_cast(this); + m_bFirstSearch = TRUE; + pT->OnTextNotFound(lpszFind); + } + + _CSTRING_NS::CString GetTranslationText(enum TranslationTextItem eItem) const + { + _CSTRING_NS::CString text; + switch(eItem) + { + case eText_OnReplaceAllMessage: + text = _T("Replaced %d occurances of \"%s\" with \"%s\""); + break; + case eText_OnReplaceAllTitle: + text = _T("Replace All"); + break; + case eText_OnTextNotFoundMessage: + text = _T("Unable to find the text \"%s\""); + break; + case eText_OnTextNotFoundTitle: + text = _T("Text not found"); + break; + } + + return text; + } + +// Overrideable Handlers + void OnFindNext(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord) + { + T* pT = static_cast(this); + + m_sFindNext = lpszFind; + m_bMatchCase = bMatchCase; + m_bWholeWord = bWholeWord; + m_bFindDown = bFindDown; + + if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) + pT->TextNotFound(m_sFindNext); + else + pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); + } + + void OnReplaceSel(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord, LPCTSTR lpszReplace) + { + T* pT = static_cast(this); + + m_sFindNext = lpszFind; + m_sReplaceWith = lpszReplace; + m_bMatchCase = bMatchCase; + m_bWholeWord = bWholeWord; + m_bFindDown = bFindDown; + + if(pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) + pT->ReplaceSel(m_sReplaceWith); + + if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) + pT->TextNotFound(m_sFindNext); + else + pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); + } + + void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace, BOOL bMatchCase, BOOL bWholeWord) + { + T* pT = static_cast(this); + + m_sFindNext = lpszFind; + m_sReplaceWith = lpszReplace; + m_bMatchCase = bMatchCase; + m_bWholeWord = bWholeWord; + m_bFindDown = TRUE; + + // no selection or different than what looking for + if(!pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) + { + if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) + { + pT->TextNotFound(m_sFindNext); + return; + } + } + + pT->OnReplaceAllCoreBegin(); + + int replaceCount=0; + do + { + ++replaceCount; + pT->ReplaceSel(m_sReplaceWith); + } while(pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)); + + pT->OnReplaceAllCoreEnd(replaceCount); + } + + void OnReplaceAllCoreBegin() + { + T* pT = static_cast(this); + + m_hOldCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT)); + + pT->HideSelection(TRUE, FALSE); + + } + + void OnReplaceAllCoreEnd(int replaceCount) + { + T* pT = static_cast(this); + pT->HideSelection(FALSE, FALSE); + + ::SetCursor(m_hOldCursor); + + _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage); + if(message.GetLength() > 0) + { + _CSTRING_NS::CString formattedMessage; + formattedMessage.Format(message, + replaceCount, m_sFindNext, m_sReplaceWith); + if(m_pFindReplaceDialog != NULL) + { + m_pFindReplaceDialog->MessageBox(formattedMessage, + pT->GetTranslationText(eText_OnReplaceAllTitle), + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); + } + else + { + pT->MessageBox(formattedMessage, + pT->GetTranslationText(eText_OnReplaceAllTitle), + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); + } + } + } + + void OnTextNotFound(LPCTSTR lpszFind) + { + T* pT = static_cast(this); + _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage); + if(message.GetLength() > 0) + { + _CSTRING_NS::CString formattedMessage; + formattedMessage.Format(message, lpszFind); + if(m_pFindReplaceDialog != NULL) + { + m_pFindReplaceDialog->MessageBox(formattedMessage, + pT->GetTranslationText(eText_OnTextNotFoundTitle), + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); + } + else + { + pT->MessageBox(formattedMessage, + pT->GetTranslationText(eText_OnTextNotFoundTitle), + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); + } + } + else + { + ::MessageBeep(MB_ICONHAND); + } + } + + void OnTerminatingFindReplaceDialog(TFindReplaceDialog*& /*findReplaceDialog*/) + { + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CEditFindReplaceImpl - Mixin class for implementing Find/Replace for CEdit +// based window classes. + +// Chain to CEditFindReplaceImpl message map. Your class must also derive from CEdit. +// Example: +// class CMyEdit : public CWindowImpl, +// public CEditFindReplaceImpl +// { +// public: +// BEGIN_MSG_MAP(CMyEdit) +// // your handlers... +// CHAIN_MSG_MAP_ALT(CEditFindReplaceImpl, 1) +// END_MSG_MAP() +// // other stuff... +// }; + +template +class CEditFindReplaceImpl : public CEditFindReplaceImplBase +{ +protected: + typedef CEditFindReplaceImpl thisClass; + typedef CEditFindReplaceImplBase baseClass; + +// Data members + LPTSTR m_pShadowBuffer; // Special shadow buffer only used in some cases. + UINT m_nShadowSize; + int m_bShadowBufferNeeded; // TRUE, FALSE, < 0 => Need to check + +public: +// Constructors + CEditFindReplaceImpl() : + m_pShadowBuffer(NULL), + m_nShadowSize(0), + m_bShadowBufferNeeded(-1) + { + } + + virtual ~CEditFindReplaceImpl() + { + if(m_pShadowBuffer != NULL) + { + delete [] m_pShadowBuffer; + m_pShadowBuffer = NULL; + } + } + +// Message Handlers + BEGIN_MSG_MAP(thisClass) + ALT_MSG_MAP(1) + CHAIN_MSG_MAP_ALT(baseClass, 1) + END_MSG_MAP() + +// Operations + // Supported only for RichEdit, so this does nothing for Edit + void HideSelection(BOOL /*bHide*/ = TRUE, BOOL /*bChangeStyle*/ = FALSE) + { + } + +// Operations (overrideable) + BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) + { + T* pT = static_cast(this); + + ATLASSERT(lpszFind != NULL); + ATLASSERT(*lpszFind != _T('\0')); + + UINT nLen = pT->GetBufferLength(); + int nStartChar = 0, nEndChar = 0; + pT->GetSel(nStartChar, nEndChar); + UINT nStart = nStartChar; + int iDir = bFindDown ? +1 : -1; + + // can't find a match before the first character + if(nStart == 0 && iDir < 0) + return FALSE; + + LPCTSTR lpszText = pT->LockBuffer(); + + bool isDBCS = false; +#ifdef _MBCS + CPINFO info = { 0 }; + ::GetCPInfo(::GetOEMCP(), &info); + isDBCS = (info.MaxCharSize > 1); +#endif + + if(iDir < 0) + { + // always go back one for search backwards + nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); + } + else if(nStartChar != nEndChar && pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord)) + { + // easy to go backward/forward with SBCS +#ifndef _UNICODE + if(::IsDBCSLeadByte(lpszText[nStart])) + nStart++; +#endif + nStart += iDir; + } + + // handle search with nStart past end of buffer + UINT nLenFind = ::lstrlen(lpszFind); + if(nStart + nLenFind - 1 >= nLen) + { + if(iDir < 0 && nLen >= nLenFind) + { + if(isDBCS) + { + // walk back to previous character n times + nStart = nLen; + int n = nLenFind; + while(n--) + { + nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); + } + } + else + { + // single-byte character set is easy and fast + nStart = nLen - nLenFind; + } + ATLASSERT(nStart + nLenFind - 1 <= nLen); + } + else + { + pT->UnlockBuffer(); + return FALSE; + } + } + + // start the search at nStart + LPCTSTR lpsz = lpszText + nStart; + typedef int (WINAPI* CompareProc)(LPCTSTR str1, LPCTSTR str2); + CompareProc pfnCompare = bMatchCase ? lstrcmp : lstrcmpi; + + if(isDBCS) + { + // double-byte string search + LPCTSTR lpszStop = NULL; + if(iDir > 0) + { + // start at current and find _first_ occurrance + lpszStop = lpszText + nLen - nLenFind + 1; + } + else + { + // start at top and find _last_ occurrance + lpszStop = lpsz; + lpsz = lpszText; + } + + LPCTSTR lpszFound = NULL; + while(lpsz <= lpszStop) + { +#ifndef _UNICODE + if(!bMatchCase || (*lpsz == *lpszFind && (!::IsDBCSLeadByte(*lpsz) || lpsz[1] == lpszFind[1]))) +#else + if(!bMatchCase || (*lpsz == *lpszFind && lpsz[1] == lpszFind[1])) +#endif + { + LPTSTR lpch = (LPTSTR)(lpsz + nLenFind); + TCHAR chSave = *lpch; + *lpch = _T('\0'); + int nResult = (*pfnCompare)(lpsz, lpszFind); + *lpch = chSave; + if(nResult == 0) + { + lpszFound = lpsz; + if(iDir > 0) + break; + } + } + lpsz = ::CharNext(lpsz); + } + pT->UnlockBuffer(); + + if(lpszFound != NULL) + { + int n = (int)(lpszFound - lpszText); + pT->SetSel(n, n + nLenFind); + return TRUE; + } + } + else + { + // single-byte string search + UINT nCompare; + if(iDir < 0) + nCompare = (UINT)(lpsz - lpszText) + 1; + else + nCompare = nLen - (UINT)(lpsz - lpszText) - nLenFind + 1; + + while(nCompare > 0) + { + ATLASSERT(lpsz >= lpszText); + ATLASSERT(lpsz + nLenFind - 1 <= lpszText + nLen - 1); + + LPSTR lpch = (LPSTR)(lpsz + nLenFind); + char chSave = *lpch; + *lpch = '\0'; + int nResult = (*pfnCompare)(lpsz, lpszFind); + *lpch = chSave; + if(nResult == 0) + { + pT->UnlockBuffer(); + int n = (int)(lpsz - lpszText); + pT->SetSel(n, n + nLenFind); + return TRUE; + } + + // restore character at end of search + *lpch = chSave; + + // move on to next substring + nCompare--; + lpsz += iDir; + } + pT->UnlockBuffer(); + } + + return FALSE; + } + + LPCTSTR LockBuffer() const + { + const T* pT = static_cast(this); + + ATLASSERT(pT->m_hWnd != NULL); + + BOOL useShadowBuffer = pT->UseShadowBuffer(); + if(useShadowBuffer) + { + if(m_pShadowBuffer == NULL || pT->GetModify()) + { + ATLASSERT(m_pShadowBuffer != NULL || m_nShadowSize == 0); + UINT nSize = pT->GetWindowTextLength() + 1; + if(nSize > m_nShadowSize) + { + // need more room for shadow buffer + T* pThisNoConst = const_cast(pT); + delete[] m_pShadowBuffer; + pThisNoConst->m_pShadowBuffer = NULL; + pThisNoConst->m_nShadowSize = 0; + pThisNoConst->m_pShadowBuffer = new TCHAR[nSize]; + pThisNoConst->m_nShadowSize = nSize; + } + + // update the shadow buffer with GetWindowText + ATLASSERT(m_nShadowSize >= nSize); + ATLASSERT(m_pShadowBuffer != NULL); + pT->GetWindowText(m_pShadowBuffer, nSize); + } + + return m_pShadowBuffer; + } + + HLOCAL hLocal = pT->GetHandle(); + ATLASSERT(hLocal != NULL); + LPCTSTR lpszText = (LPCTSTR)::LocalLock(hLocal); + ATLASSERT(lpszText != NULL); + + return lpszText; + } + + void UnlockBuffer() const + { + const T* pT = static_cast(this); + + ATLASSERT(pT->m_hWnd != NULL); + + BOOL useShadowBuffer = pT->UseShadowBuffer(); + if(!useShadowBuffer) + { + HLOCAL hLocal = pT->GetHandle(); + ATLASSERT(hLocal != NULL); + ::LocalUnlock(hLocal); + } + } + + UINT GetBufferLength() const + { + const T* pT = static_cast(this); + + ATLASSERT(pT->m_hWnd != NULL); + UINT nLen = 0; + LPCTSTR lpszText = pT->LockBuffer(); + if(lpszText != NULL) + nLen = ::lstrlen(lpszText); + pT->UnlockBuffer(); + + return nLen; + } + + LONG EndOfLine(LPCTSTR lpszText, UINT nLen, UINT nIndex) const + { + LPCTSTR lpsz = lpszText + nIndex; + LPCTSTR lpszStop = lpszText + nLen; + while(lpsz < lpszStop && *lpsz != _T('\r')) + ++lpsz; + return LONG(lpsz - lpszText); + } + + LONG GetSelText(_CSTRING_NS::CString& strText) const + { + const T* pT = static_cast(this); + + int nStartChar = 0, nEndChar = 0; + pT->GetSel(nStartChar, nEndChar); + ATLASSERT((UINT)nEndChar <= pT->GetBufferLength()); + LPCTSTR lpszText = pT->LockBuffer(); + LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar; + SecureHelper::memcpy_x(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR)); + strText.ReleaseBuffer(nLen); + pT->UnlockBuffer(); + + return nLen; + } + + BOOL UseShadowBuffer(void) const + { + const T* pT = static_cast(this); + + if(pT->m_bShadowBufferNeeded < 0) + { + T* pThisNoConst = const_cast(pT); + + OSVERSIONINFO ovi = { 0 }; + ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + ::GetVersionEx(&ovi); + + bool bWin9x = (ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); + if(bWin9x) + { + // Windows 95, 98, ME + // Under Win9x, it is necessary to maintain a shadow buffer. + // It is only updated when the control contents have been changed. + pThisNoConst->m_bShadowBufferNeeded = TRUE; + } + else + { + // Windows NT, 2000, XP, etc. + pThisNoConst->m_bShadowBufferNeeded = FALSE; + +#ifndef _UNICODE + // On Windows XP (or later), if common controls version 6 is in use + // (such as via theming), then EM_GETHANDLE will always return a UNICODE string. + // If theming is enabled and Common Controls version 6 is in use, + // you're really not suppose to superclass or subclass common controls + // with an ANSI windows procedure (so its best to only theme if you use UNICODE). + // Using a shadow buffer uses GetWindowText instead, so it solves + // this problem for us (although it makes it a little less efficient). + + if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) + { + // We use DLLVERSIONINFO_private so we don't have to depend on shlwapi.h + typedef struct _DLLVERSIONINFO_private + { + DWORD cbSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformID; + } DLLVERSIONINFO_private; + + HMODULE hModule = ::LoadLibrary("comctl32.dll"); + if(hModule != NULL) + { + typedef HRESULT (CALLBACK *LPFN_DllGetVersion)(DLLVERSIONINFO_private *); + LPFN_DllGetVersion fnDllGetVersion = (LPFN_DllGetVersion)::GetProcAddress(hModule, "DllGetVersion"); + if(fnDllGetVersion != NULL) + { + DLLVERSIONINFO_private version = { 0 }; + version.cbSize = sizeof(DLLVERSIONINFO_private); + if(SUCCEEDED(fnDllGetVersion(&version))) + { + if(version.dwMajorVersion >= 6) + { + pThisNoConst->m_bShadowBufferNeeded = TRUE; + + ATLTRACE2(atlTraceUI, 0, _T("Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later (likely through a manifest file).\r\n")); + ATLTRACE2(atlTraceUI, 0, _T("If you use common controls version 6 or later, you should only do so for UNICODE builds.\r\n")); + } + } + } + + ::FreeLibrary(hModule); + hModule = NULL; + } + } +#endif // !_UNICODE + } + } + + return (pT->m_bShadowBufferNeeded == TRUE); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CRichEditFindReplaceImpl - Mixin class for implementing Find/Replace for CRichEditCtrl +// based window classes. + +// Chain to CRichEditFindReplaceImpl message map. Your class must also derive from CRichEditCtrl. +// Example: +// class CMyRichEdit : public CWindowImpl, +// public CRichEditFindReplaceImpl +// { +// public: +// BEGIN_MSG_MAP(CMyRichEdit) +// // your handlers... +// CHAIN_MSG_MAP_ALT(CRichEditFindReplaceImpl, 1) +// END_MSG_MAP() +// // other stuff... +// }; + +template +class CRichEditFindReplaceImpl : public CEditFindReplaceImplBase +{ +protected: + typedef CRichEditFindReplaceImpl thisClass; + typedef CEditFindReplaceImplBase baseClass; + +public: + BEGIN_MSG_MAP(thisClass) + ALT_MSG_MAP(1) + CHAIN_MSG_MAP_ALT(baseClass, 1) + END_MSG_MAP() + +// Operations (overrideable) + BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) + { + T* pT = static_cast(this); + + ATLASSERT(lpszFind != NULL); + FINDTEXTEX ft = { 0 }; + + pT->GetSel(ft.chrg); + if(m_bFirstSearch) + { + if(bFindDown) + m_nInitialSearchPos = ft.chrg.cpMin; + else + m_nInitialSearchPos = ft.chrg.cpMax; + m_bFirstSearch = FALSE; + } + +#if (_RICHEDIT_VER >= 0x0200) + ft.lpstrText = (LPTSTR)lpszFind; +#else // !(_RICHEDIT_VER >= 0x0200) + USES_CONVERSION; + ft.lpstrText = T2A((LPTSTR)lpszFind); +#endif // !(_RICHEDIT_VER >= 0x0200) + + if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection + { + if(bFindDown) + { + ft.chrg.cpMin++; + } + else + { + // won't wraparound backwards + ft.chrg.cpMin = max(ft.chrg.cpMin, 0); + } + } + + DWORD dwFlags = bMatchCase ? FR_MATCHCASE : 0; + dwFlags |= bWholeWord ? FR_WHOLEWORD : 0; + + ft.chrg.cpMax = pT->GetTextLength() + m_nInitialSearchPos; + + if(bFindDown) + { + if(m_nInitialSearchPos >= 0) + ft.chrg.cpMax = pT->GetTextLength(); + + dwFlags |= FR_DOWN; + ATLASSERT(ft.chrg.cpMax >= ft.chrg.cpMin); + } + else + { + if(m_nInitialSearchPos >= 0) + ft.chrg.cpMax = 0; + + dwFlags &= ~FR_DOWN; + ATLASSERT(ft.chrg.cpMax <= ft.chrg.cpMin); + } + + BOOL bRet = FALSE; + + if(pT->FindAndSelect(dwFlags, ft) != -1) + { + bRet = TRUE; // we found the text + } + else if(m_nInitialSearchPos > 0) + { + // if the original starting point was not the beginning + // of the buffer and we haven't already been here + if(bFindDown) + { + ft.chrg.cpMin = 0; + ft.chrg.cpMax = m_nInitialSearchPos; + } + else + { + ft.chrg.cpMin = pT->GetTextLength(); + ft.chrg.cpMax = m_nInitialSearchPos; + } + m_nInitialSearchPos = m_nInitialSearchPos - pT->GetTextLength(); + + bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE; + } + + return bRet; + } + + long FindAndSelect(DWORD dwFlags, FINDTEXTEX& ft) + { + T* pT = static_cast(this); + LONG index = pT->FindText(dwFlags, ft); + if(index != -1) // i.e. we found something + pT->SetSel(ft.chrgText); + + return index; + } +}; + +}; // namespace WTL + +#endif // __ATLFIND_H__ diff --git a/Externals/WTL80/atlframe.h b/Externals/WTL80/atlframe.h index 7eb102f8a4..f56c69aac9 100644 --- a/Externals/WTL80/atlframe.h +++ b/Externals/WTL80/atlframe.h @@ -1,3465 +1,3465 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLFRAME_H__ -#define __ATLFRAME_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlframe.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlframe.h requires atlwin.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CFrameWindowImpl -// CMDIWindow -// CMDIFrameWindowImpl -// CMDIChildWindowImpl -// COwnerDraw -// CUpdateUIBase -// CUpdateUI -// CDynamicUpdateUI -// CDialogResize -// CDoubleBufferImpl -// CDoubleBufferWindowImpl -// -// Global functions: -// AtlCreateSimpleToolBar() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CFrameWndClassInfo - Manages frame window Windows class information - -class CFrameWndClassInfo -{ -public: -#ifndef _WIN32_WCE - enum { cchAutoName = 5 + sizeof(void*) * 2 }; // sizeof(void*) * 2 is the number of digits %p outputs - WNDCLASSEX m_wc; -#else // CE specific - enum { cchAutoName = MAX_PATH }; // MAX_PATH because this can be set in the wizard generated CMainFrame::ActivatePreviousInstance to a user defined string. - WNDCLASS m_wc; -#endif // !_WIN32_WCE - LPCTSTR m_lpszOrigName; - WNDPROC pWndProc; - LPCTSTR m_lpszCursorID; - BOOL m_bSystemCursor; - ATOM m_atom; - TCHAR m_szAutoName[cchAutoName]; - UINT m_uCommonResourceID; - -#ifndef _WIN32_WCE - ATOM Register(WNDPROC* pProc) - { - if (m_atom == 0) - { - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(m_atom == 0) - { - HINSTANCE hInst = ModuleHelper::GetModuleInstance(); - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - LPCTSTR lpsz = m_wc.lpszClassName; - WNDPROC proc = m_wc.lpfnWndProc; - - WNDCLASSEX wc = { 0 }; - wc.cbSize = sizeof(WNDCLASSEX); - // try process local class first - if(!::GetClassInfoEx(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) - { - // try global class - if(!::GetClassInfoEx(NULL, m_lpszOrigName, &wc)) - { - lock.Unlock(); - return 0; - } - } - m_wc = wc; - pWndProc = m_wc.lpfnWndProc; - m_wc.lpszClassName = lpsz; - m_wc.lpfnWndProc = proc; - } - else - { - m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); - } - - m_wc.hInstance = hInst; - m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes - if (m_wc.lpszClassName == NULL) - { -#if (_WIN32_WINNT >= 0x0500) || defined(_WIN64) - SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%p"), &m_wc); -#else // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) - SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); -#endif // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) - m_wc.lpszClassName = m_szAutoName; - } - - WNDCLASSEX wcTemp = m_wc; - m_atom = (ATOM)::GetClassInfoEx(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); - if (m_atom == 0) - { - if(m_uCommonResourceID != 0) // use it if not zero - { - m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - m_wc.hIconSm = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - } - m_atom = ::RegisterClassEx(&m_wc); - } - } - - lock.Unlock(); - } - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - ATLASSERT(pWndProc != NULL); - *pProc = pWndProc; - } - - return m_atom; - } -#else // CE specific - ATOM Register(WNDPROC* pProc) - { - if (m_atom == 0) - { - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(m_atom == 0) - { - HINSTANCE hInst = ModuleHelper::GetModuleInstance(); - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - LPCTSTR lpsz = m_wc.lpszClassName; - WNDPROC proc = m_wc.lpfnWndProc; - - WNDCLASS wc = { 0 }; - // try process local class first - if(!::GetClassInfo(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) - { - // try global class - if(!::GetClassInfo(NULL, m_lpszOrigName, &wc)) - { - lock.Unlock(); - return 0; - } - } - m_wc = wc; - pWndProc = m_wc.lpfnWndProc; - m_wc.lpszClassName = lpsz; - m_wc.lpfnWndProc = proc; - } - else - { -#if defined(GWES_CURSOR) || defined(GWES_MCURSOR) - m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); -#else // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) - m_wc.hCursor = NULL; -#endif // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) - } - - m_wc.hInstance = hInst; - m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes - if (m_wc.lpszClassName == NULL) - { - wsprintf(m_szAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); - m_wc.lpszClassName = m_szAutoName; - } - - WNDCLASS wcTemp = m_wc; - m_atom = (ATOM)::GetClassInfo(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); - if (m_atom == 0) - { - if(m_uCommonResourceID != 0) // use it if not zero - m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - m_atom = ::RegisterClass(&m_wc); - } - } - - lock.Unlock(); - } - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - ATLASSERT(pWndProc != NULL); - *pProc = pWndProc; - } - - return m_atom; - } -#endif // _WIN32_WCE -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Macros for declaring frame window WNDCLASS - -#ifndef _WIN32_WCE - -#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { sizeof(WNDCLASSEX), 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName, NULL }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { sizeof(WNDCLASSEX), style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { sizeof(WNDCLASSEX), 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \ - OrigWndClassName, NULL, NULL, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#else // CE specific - -#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { NULL, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName }, \ - OrigWndClassName, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFrameWindowImpl - -// Client window command chaining macro (only for frame windows) -#define CHAIN_CLIENT_COMMANDS() \ - if(uMsg == WM_COMMAND && m_hWndClient != NULL) \ - ::SendMessage(m_hWndClient, uMsg, wParam, lParam); - -// standard toolbar styles -#define ATL_SIMPLE_TOOLBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS) -// toolbar in a rebar pane -#define ATL_SIMPLE_TOOLBAR_PANE_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT) -// standard rebar styles -#if (_WIN32_IE >= 0x0400) - #define ATL_SIMPLE_REBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE) -#else - #define ATL_SIMPLE_REBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS) -#endif // !(_WIN32_IE >= 0x0400) -// rebar without borders -#if (_WIN32_IE >= 0x0400) - #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE | CCS_NODIVIDER) -#else - #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | CCS_NODIVIDER) -#endif // !(_WIN32_IE >= 0x0400) - -// command bar support -#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - -#define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND -#define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu -#define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu - -struct _AtlFrameWnd_CmdBarPopupMenu -{ - int cbSize; - HMENU hMenu; - UINT uFlags; - int x; - int y; - LPTPMPARAMS lptpm; -}; - -#define CBRPOPUPMENU _AtlFrameWnd_CmdBarPopupMenu - -#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - - -template -class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, TWinTraits > -{ -public: - DECLARE_FRAME_WND_CLASS(NULL, 0) - -// Data members - HWND m_hWndToolBar; - HWND m_hWndStatusBar; - HWND m_hWndClient; - - HACCEL m_hAccel; - -#ifdef _WIN32_WCE - HWND m_hWndCECommandBar; -#endif // _WIN32_WCE - - struct _AtlToolBarData - { - WORD wVersion; - WORD wWidth; - WORD wHeight; - WORD wItemCount; - //WORD aItems[wItemCount] - - WORD* items() - { return (WORD*)(this+1); } - }; - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - struct _ChevronMenuInfo - { - HMENU hMenu; - LPNMREBARCHEVRON lpnm; - bool bCmdBar; - }; -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - -// Constructor - CFrameWindowImplBase() : -#ifdef _WIN32_WCE - m_hWndCECommandBar(NULL), -#endif // _WIN32_WCE - m_hWndToolBar(NULL), - m_hWndStatusBar(NULL), - m_hWndClient(NULL), - m_hAccel(NULL) - { } - -// Methods - HWND Create(HWND hWndParent, ATL::_U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, ATL::_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam) - { - ATLASSERT(m_hWnd == NULL); - - if(atom == 0) - return NULL; - - ModuleHelper::AddCreateWndData(&m_thunk.cd, this); - - if(MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD)) - MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this; - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - HWND hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, - dwStyle, rect.m_lpRect->left, rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, - rect.m_lpRect->bottom - rect.m_lpRect->top, hWndParent, MenuOrID.m_hMenu, - ModuleHelper::GetModuleInstance(), lpCreateParam); - - ATLASSERT(hWnd == NULL || m_hWnd == hWnd); - - return hWnd; - } - - static HWND CreateSimpleToolBarCtrl(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, - DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - HINSTANCE hInst = ModuleHelper::GetResourceInstance(); - HRSRC hRsrc = ::FindResource(hInst, MAKEINTRESOURCE(nResourceID), RT_TOOLBAR); - if (hRsrc == NULL) - return NULL; - - HGLOBAL hGlobal = ::LoadResource(hInst, hRsrc); - if (hGlobal == NULL) - return NULL; - - _AtlToolBarData* pData = (_AtlToolBarData*)::LockResource(hGlobal); - if (pData == NULL) - return NULL; - ATLASSERT(pData->wVersion == 1); - - WORD* pItems = pData->items(); - int nItems = pData->wItemCount + (bInitialSeparator ? 1 : 0); - CTempBuffer buff; - TBBUTTON* pTBBtn = buff.Allocate(nItems); - ATLASSERT(pTBBtn != NULL); - if(pTBBtn == NULL) - return NULL; - - const int cxSeparator = 8; - - // set initial separator (half width) - if(bInitialSeparator) - { - pTBBtn[0].iBitmap = cxSeparator / 2; - pTBBtn[0].idCommand = 0; - pTBBtn[0].fsState = 0; - pTBBtn[0].fsStyle = TBSTYLE_SEP; - pTBBtn[0].dwData = 0; - pTBBtn[0].iString = 0; - } - - int nBmp = 0; - for(int i = 0, j = bInitialSeparator ? 1 : 0; i < pData->wItemCount; i++, j++) - { - if(pItems[i] != 0) - { - pTBBtn[j].iBitmap = nBmp++; - pTBBtn[j].idCommand = pItems[i]; - pTBBtn[j].fsState = TBSTATE_ENABLED; - pTBBtn[j].fsStyle = TBSTYLE_BUTTON; - pTBBtn[j].dwData = 0; - pTBBtn[j].iString = 0; - } - else - { - pTBBtn[j].iBitmap = cxSeparator; - pTBBtn[j].idCommand = 0; - pTBBtn[j].fsState = 0; - pTBBtn[j].fsStyle = TBSTYLE_SEP; - pTBBtn[j].dwData = 0; - pTBBtn[j].iString = 0; - } - } - -#ifndef _WIN32_WCE - HWND hWnd = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); - if(hWnd == NULL) - { - ATLASSERT(FALSE); - return NULL; - } -#else // CE specific - dwStyle; - nID; - // The toolbar must go onto the existing CommandBar or MenuBar - HWND hWnd = hWndParent; -#endif // _WIN32_WCE - - ::SendMessage(hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0L); - - // check if font is taller than our bitmaps - CFontHandle font = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); - if(font.IsNull()) - font = AtlGetDefaultGuiFont(); - LOGFONT lf = { 0 }; - font.GetLogFont(lf); - WORD cyFontHeight = (WORD)abs(lf.lfHeight); - -#ifndef _WIN32_WCE - WORD bitsPerPixel = AtlGetBitmapResourceBitsPerPixel(nResourceID); - if(bitsPerPixel > 4) - { - COLORREF crMask = CLR_DEFAULT; - if(bitsPerPixel == 32) - { - // 32-bit color bitmap with alpha channel (valid for Windows XP and later) - crMask = CLR_NONE; - } - HIMAGELIST hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nResourceID), pData->wWidth, 1, crMask, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); - ATLASSERT(hImageList != NULL); - ::SendMessage(hWnd, TB_SETIMAGELIST, 0, (LPARAM)hImageList); - } - else -#endif // !_WIN32_WCE - { - TBADDBITMAP tbab = { 0 }; - tbab.hInst = hInst; - tbab.nID = nResourceID; - ::SendMessage(hWnd, TB_ADDBITMAP, nBmp, (LPARAM)&tbab); - } - - ::SendMessage(hWnd, TB_ADDBUTTONS, nItems, (LPARAM)pTBBtn); - ::SendMessage(hWnd, TB_SETBITMAPSIZE, 0, MAKELONG(pData->wWidth, max(pData->wHeight, cyFontHeight))); - const int cxyButtonMargin = 7; - ::SendMessage(hWnd, TB_SETBUTTONSIZE, 0, MAKELONG(pData->wWidth + cxyButtonMargin, max(pData->wHeight, cyFontHeight) + cxyButtonMargin)); - - return hWnd; - } - -#ifndef _WIN32_WCE - static HWND CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - // Ensure style combinations for proper rebar painting - if(dwStyle & CCS_NODIVIDER && dwStyle & WS_BORDER) - dwStyle &= ~WS_BORDER; - else if(!(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER)) - dwStyle |= CCS_NODIVIDER; - - // Create rebar window - HWND hWndReBar = ::CreateWindowEx(0, REBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); - if(hWndReBar == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Failed to create rebar.\n")); - return NULL; - } - - // Initialize and send the REBARINFO structure - REBARINFO rbi = { 0 }; - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = 0; - if(!::SendMessage(hWndReBar, RB_SETBARINFO, 0, (LPARAM)&rbi)) - { - ATLTRACE2(atlTraceUI, 0, _T("Failed to initialize rebar.\n")); - ::DestroyWindow(hWndReBar); - return NULL; - } - - return hWndReBar; - } - - BOOL CreateSimpleReBar(DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - ATLASSERT(!::IsWindow(m_hWndToolBar)); - m_hWndToolBar = CreateSimpleReBarCtrl(m_hWnd, dwStyle, nID); - return (m_hWndToolBar != NULL); - } - - static BOOL AddSimpleReBarBandCtrl(HWND hWndReBar, HWND hWndBand, int nID = 0, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) - { - ATLASSERT(::IsWindow(hWndReBar)); // must be already created -#ifdef _DEBUG - // block - check if this is really a rebar - { - TCHAR lpszClassName[sizeof(REBARCLASSNAME)] = { 0 }; - ::GetClassName(hWndReBar, lpszClassName, sizeof(REBARCLASSNAME)); - ATLASSERT(lstrcmp(lpszClassName, REBARCLASSNAME) == 0); - } -#endif // _DEBUG - ATLASSERT(::IsWindow(hWndBand)); // must be already created - - // Get number of buttons on the toolbar - int nBtnCount = (int)::SendMessage(hWndBand, TB_BUTTONCOUNT, 0, 0L); - - // Set band info structure - REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; -#if (_WIN32_IE >= 0x0400) - rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE | RBBIM_IDEALSIZE; -#else - rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE; -#endif // !(_WIN32_IE >= 0x0400) - if(lpstrTitle != NULL) - rbBand.fMask |= RBBIM_TEXT; - rbBand.fStyle = RBBS_CHILDEDGE; -#if (_WIN32_IE >= 0x0500) - if(nBtnCount > 0) // add chevron style for toolbar with buttons - rbBand.fStyle |= RBBS_USECHEVRON; -#endif // (_WIN32_IE >= 0x0500) - if(bNewRow) - rbBand.fStyle |= RBBS_BREAK; - - rbBand.lpText = (LPTSTR)lpstrTitle; - rbBand.hwndChild = hWndBand; - if(nID == 0) // calc band ID - nID = ATL_IDW_BAND_FIRST + (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); - rbBand.wID = nID; - - // Calculate the size of the band - BOOL bRet = FALSE; - RECT rcTmp = { 0 }; - if(nBtnCount > 0) - { - bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, nBtnCount - 1, (LPARAM)&rcTmp); - ATLASSERT(bRet); - rbBand.cx = (cxWidth != 0) ? cxWidth : rcTmp.right; - rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; - if(bFullWidthAlways) - { - rbBand.cxMinChild = rbBand.cx; - } - else if(lpstrTitle == NULL) - { - bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, 0, (LPARAM)&rcTmp); - ATLASSERT(bRet); - rbBand.cxMinChild = rcTmp.right; - } - else - { - rbBand.cxMinChild = 0; - } - } - else // no buttons, either not a toolbar or really has no buttons - { - bRet = ::GetWindowRect(hWndBand, &rcTmp); - ATLASSERT(bRet); - rbBand.cx = (cxWidth != 0) ? cxWidth : (rcTmp.right - rcTmp.left); - rbBand.cxMinChild = bFullWidthAlways ? rbBand.cx : 0; - rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; - } - -#if (_WIN32_IE >= 0x0400) - rbBand.cxIdeal = rbBand.cx; -#endif // (_WIN32_IE >= 0x0400) - - // Add the band - LRESULT lRes = ::SendMessage(hWndReBar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); - if(lRes == 0) - { - ATLTRACE2(atlTraceUI, 0, _T("Failed to add a band to the rebar.\n")); - return FALSE; - } - -#if (_WIN32_IE >= 0x0501) - DWORD dwExStyle = (DWORD)::SendMessage(hWndBand, TB_GETEXTENDEDSTYLE, 0, 0L); - ::SendMessage(hWndBand, TB_SETEXTENDEDSTYLE, 0, dwExStyle | TBSTYLE_EX_HIDECLIPPEDBUTTONS); -#endif // (_WIN32_IE >= 0x0501) - - return TRUE; - } - - BOOL AddSimpleReBarBand(HWND hWndBand, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) - { - ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar - ATLASSERT(::IsWindow(hWndBand)); // must be created - return AddSimpleReBarBandCtrl(m_hWndToolBar, hWndBand, 0, lpstrTitle, bNewRow, cxWidth, bFullWidthAlways); - } - -#if (_WIN32_IE >= 0x0400) - void SizeSimpleReBarBands() - { - ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar - - int nCount = (int)::SendMessage(m_hWndToolBar, RB_GETBANDCOUNT, 0, 0L); - - for(int i = 0; i < nCount; i++) - { - REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; - rbBand.fMask = RBBIM_SIZE; - BOOL bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_GETBANDINFO, i, (LPARAM)&rbBand); - ATLASSERT(bRet); - RECT rect = { 0, 0, 0, 0 }; - ::SendMessage(m_hWndToolBar, RB_GETBANDBORDERS, i, (LPARAM)&rect); - rbBand.cx += rect.left + rect.right; - bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_SETBANDINFO, i, (LPARAM)&rbBand); - ATLASSERT(bRet); - } - } -#endif // (_WIN32_IE >= 0x0400) -#endif // _WIN32_WCE - -#ifndef _WIN32_WCE - BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) -#else // CE specific - BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) -#endif // _WIN32_WCE - { - ATLASSERT(!::IsWindow(m_hWndStatusBar)); - m_hWndStatusBar = ::CreateStatusWindow(dwStyle, lpstrText, m_hWnd, nID); - return (m_hWndStatusBar != NULL); - } - -#ifndef _WIN32_WCE - BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) -#else // CE specific - BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) -#endif // _WIN32_WCE - { - const int cchMax = 128; // max text length is 127 for status bars (+1 for null) - TCHAR szText[cchMax]; - szText[0] = 0; - ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); - return CreateSimpleStatusBar(szText, dwStyle, nID); - } - -#ifdef _WIN32_WCE - BOOL CreateSimpleCECommandBar(LPTSTR pszMenu = NULL, WORD iButton = 0, DWORD dwFlags = 0, int nCmdBarID = 1) - { - ATLASSERT(m_hWndCECommandBar == NULL); - ATLASSERT(m_hWndToolBar == NULL); - - m_hWndCECommandBar = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), m_hWnd, nCmdBarID); - if(m_hWndCECommandBar == NULL) - return FALSE; - - m_hWndToolBar = m_hWndCECommandBar; - - BOOL bRet = TRUE; - - if(pszMenu != NULL) - bRet &= ::CommandBar_InsertMenubarEx(m_hWndCECommandBar, IS_INTRESOURCE(pszMenu) ? ModuleHelper::GetResourceInstance() : NULL, pszMenu, iButton); - - bRet &= ::CommandBar_AddAdornments(m_hWndCECommandBar, dwFlags, 0); - - return bRet; - } - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - BOOL CreateSimpleCEMenuBar(UINT nToolBarId = ATL_IDW_MENU_BAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0) - { - ATLASSERT(m_hWndCECommandBar == NULL); - - SHMENUBARINFO mbi = { 0 }; - mbi.cbSize = sizeof(mbi); - mbi.hwndParent = m_hWnd; - mbi.dwFlags = dwFlags; - mbi.nToolBarId = nToolBarId; - mbi.hInstRes = ModuleHelper::GetResourceInstance(); - mbi.nBmpId = nBmpId; - mbi.cBmpImages = cBmpImages; - mbi.hwndMB = NULL; // This gets set by SHCreateMenuBar - - BOOL bRet = ::SHCreateMenuBar(&mbi); - if(bRet != FALSE) - { - m_hWndCECommandBar = mbi.hwndMB; - SizeToMenuBar(); - } - - return bRet; - } - - void SizeToMenuBar() // for menu bar only - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(m_hWndCECommandBar)); - - RECT rect = { 0 }; - GetWindowRect(&rect); - RECT rectMB = { 0 }; - ::GetWindowRect(m_hWndCECommandBar, &rectMB); - int cy = ::IsWindowVisible(m_hWndCECommandBar) ? rectMB.top - rect.top : rectMB.bottom - rect.top; - SetWindowPos(NULL, 0, 0, rect.right - rect.left, cy, SWP_NOZORDER | SWP_NOMOVE); - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) -#endif // _WIN32_WCE - - void UpdateLayout(BOOL bResizeBars = TRUE) - { - RECT rect = { 0 }; - GetClientRect(&rect); - - // position bars and offset their dimensions - UpdateBarsPosition(rect, bResizeBars); - - // resize client window - if(m_hWndClient != NULL) - ::SetWindowPos(m_hWndClient, NULL, rect.left, rect.top, - rect.right - rect.left, rect.bottom - rect.top, - SWP_NOZORDER | SWP_NOACTIVATE); - } - - void UpdateBarsPosition(RECT& rect, BOOL bResizeBars = TRUE) - { - // resize toolbar - if(m_hWndToolBar != NULL && ((DWORD)::GetWindowLong(m_hWndToolBar, GWL_STYLE) & WS_VISIBLE)) - { - if(bResizeBars) - { - ::SendMessage(m_hWndToolBar, WM_SIZE, 0, 0); - ::InvalidateRect(m_hWndToolBar, NULL, FALSE); - } - RECT rectTB = { 0 }; - ::GetWindowRect(m_hWndToolBar, &rectTB); - rect.top += rectTB.bottom - rectTB.top; - } - - // resize status bar - if(m_hWndStatusBar != NULL && ((DWORD)::GetWindowLong(m_hWndStatusBar, GWL_STYLE) & WS_VISIBLE)) - { - if(bResizeBars) - ::SendMessage(m_hWndStatusBar, WM_SIZE, 0, 0); - RECT rectSB = { 0 }; - ::GetWindowRect(m_hWndStatusBar, &rectSB); - rect.bottom -= rectSB.bottom - rectSB.top; - } - } - - BOOL PreTranslateMessage(MSG* pMsg) - { - if(m_hAccel != NULL && ::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) - return TRUE; - return FALSE; - } - - BEGIN_MSG_MAP(CFrameWindowImplBase) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _WIN32_WCE - NOTIFY_CODE_HANDLER(TTN_GETDISPINFOA, OnToolTipTextA) - NOTIFY_CODE_HANDLER(TTN_GETDISPINFOW, OnToolTipTextW) -#endif // !_WIN32_WCE - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_hWndClient != NULL) // view will paint itself instead - return 1; - - bHandled = FALSE; - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnMenuSelect(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - bHandled = FALSE; - - if(m_hWndStatusBar == NULL) - return 1; - - WORD wFlags = HIWORD(wParam); - if(wFlags == 0xFFFF && lParam == NULL) // menu closing - { - ::SendMessage(m_hWndStatusBar, SB_SIMPLE, FALSE, 0L); - } - else - { - const int cchBuff = 256; - TCHAR szBuff[cchBuff]; - szBuff[0] = 0; - if(!(wFlags & MF_POPUP)) - { - WORD wID = LOWORD(wParam); - // check for special cases - if(wID >= 0xF000 && wID < 0xF1F0) // system menu IDs - wID = (WORD)(((wID - 0xF000) >> 4) + ATL_IDS_SCFIRST); - else if(wID >= ID_FILE_MRU_FIRST && wID <= ID_FILE_MRU_LAST) // MRU items - wID = ATL_IDS_MRU_FILE; - else if(wID >= ATL_IDM_FIRST_MDICHILD && wID <= ATL_IDM_LAST_MDICHILD) // MDI child windows - wID = ATL_IDS_MDICHILD; - - int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), wID, szBuff, cchBuff); - for(int i = 0; i < nRet; i++) - { - if(szBuff[i] == _T('\n')) - { - szBuff[i] = 0; - break; - } - } - } - ::SendMessage(m_hWndStatusBar, SB_SIMPLE, TRUE, 0L); - ::SendMessage(m_hWndStatusBar, SB_SETTEXT, (255 | SBT_NOBORDERS), (LPARAM)szBuff); - } - - return 1; - } -#endif // !_WIN32_WCE - - LRESULT OnSetFocus(UINT, WPARAM, LPARAM, BOOL& bHandled) - { - if(m_hWndClient != NULL) - ::SetFocus(m_hWndClient); - - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL& bHandled) - { - if((GetStyle() & (WS_CHILD | WS_POPUP)) == 0) - ::PostQuitMessage(1); - - bHandled = FALSE; - return 1; - } - -#ifndef _WIN32_WCE - LRESULT OnToolTipTextA(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - LPNMTTDISPINFOA pDispInfo = (LPNMTTDISPINFOA)pnmh; - pDispInfo->szText[0] = 0; - - if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) - { - const int cchBuff = 256; - char szBuff[cchBuff]; - szBuff[0] = 0; - int nRet = ::LoadStringA(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); - for(int i = 0; i < nRet; i++) - { - if(szBuff[i] == '\n') - { - SecureHelper::strncpyA_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); - break; - } - } -#if (_WIN32_IE >= 0x0300) - if(nRet > 0) // string was loaded, save it - pDispInfo->uFlags |= TTF_DI_SETITEM; -#endif // (_WIN32_IE >= 0x0300) - } - - return 0; - } - - LRESULT OnToolTipTextW(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) - { - LPNMTTDISPINFOW pDispInfo = (LPNMTTDISPINFOW)pnmh; - pDispInfo->szText[0] = 0; - - if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) - { - const int cchBuff = 256; - wchar_t szBuff[cchBuff]; - szBuff[0] = 0; - int nRet = ::LoadStringW(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); - for(int i = 0; i < nRet; i++) - { - if(szBuff[i] == L'\n') - { - SecureHelper::strncpyW_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); - break; - } - } -#if (_WIN32_IE >= 0x0300) - if(nRet > 0) // string was loaded, save it - pDispInfo->uFlags |= TTF_DI_SETITEM; -#endif // (_WIN32_IE >= 0x0300) - } - - return 0; - } -#endif // !_WIN32_WCE - -// Implementation - chevron menu support -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - bool PrepareChevronMenu(_ChevronMenuInfo& cmi) - { - // get rebar and toolbar - REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; - rbbi.fMask = RBBIM_CHILD; - BOOL bRet = (BOOL)::SendMessage(cmi.lpnm->hdr.hwndFrom, RB_GETBANDINFO, cmi.lpnm->uBand, (LPARAM)&rbbi); - ATLASSERT(bRet); - - // assume the band is a toolbar - ATL::CWindow wnd = rbbi.hwndChild; - int nCount = (int)wnd.SendMessage(TB_BUTTONCOUNT); - if(nCount <= 0) // probably not a toolbar - return false; - - // check if it's a command bar - CMenuHandle menuCmdBar = (HMENU)wnd.SendMessage(CBRM_GETMENU); - cmi.bCmdBar = (menuCmdBar.m_hMenu != NULL); - - // build a menu from hidden items - CMenuHandle menu; - bRet = menu.CreatePopupMenu(); - ATLASSERT(bRet); - RECT rcClient = { 0 }; - bRet = wnd.GetClientRect(&rcClient); - ATLASSERT(bRet); - for(int i = 0; i < nCount; i++) - { - TBBUTTON tbb = { 0 }; - bRet = (BOOL)wnd.SendMessage(TB_GETBUTTON, i, (LPARAM)&tbb); - ATLASSERT(bRet); - // skip hidden buttons - if((tbb.fsState & TBSTATE_HIDDEN) != 0) - continue; - RECT rcButton = { 0 }; - bRet = (BOOL)wnd.SendMessage(TB_GETITEMRECT, i, (LPARAM)&rcButton); - ATLASSERT(bRet); - bool bEnabled = ((tbb.fsState & TBSTATE_ENABLED) != 0); - if(rcButton.right > rcClient.right) - { - if(tbb.fsStyle & BTNS_SEP) - { - if(menu.GetMenuItemCount() > 0) - menu.AppendMenu(MF_SEPARATOR); - } - else if(cmi.bCmdBar) - { - const int cchBuff = 200; - TCHAR szBuff[cchBuff] = { 0 }; - CMenuItemInfo mii; - mii.fMask = MIIM_TYPE | MIIM_SUBMENU; - mii.dwTypeData = szBuff; - mii.cch = cchBuff; - bRet = menuCmdBar.GetMenuItemInfo(i, TRUE, &mii); - ATLASSERT(bRet); - // Note: CmdBar currently supports only drop-down items - ATLASSERT(::IsMenu(mii.hSubMenu)); - bRet = menu.AppendMenu(MF_STRING | MF_POPUP | (bEnabled ? MF_ENABLED : MF_GRAYED), (UINT_PTR)mii.hSubMenu, mii.dwTypeData); - ATLASSERT(bRet); - } - else - { - // get button's text - const int cchBuff = 200; - TCHAR szBuff[cchBuff] = { 0 }; - LPTSTR lpstrText = szBuff; - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = TBIF_TEXT; - tbbi.pszText = szBuff; - tbbi.cchText = cchBuff; - if(wnd.SendMessage(TB_GETBUTTONINFO, tbb.idCommand, (LPARAM)&tbbi) == -1 || lstrlen(szBuff) == 0) - { - // no text for this button, try a resource string - lpstrText = _T(""); - int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), tbb.idCommand, szBuff, cchBuff); - for(int n = 0; n < nRet; n++) - { - if(szBuff[n] == _T('\n')) - { - lpstrText = &szBuff[n + 1]; - break; - } - } - } - bRet = menu.AppendMenu(MF_STRING | (bEnabled ? MF_ENABLED : MF_GRAYED), tbb.idCommand, lpstrText); - ATLASSERT(bRet); - } - } - } - - if(menu.GetMenuItemCount() == 0) // no hidden buttons after all - { - menu.DestroyMenu(); - ::MessageBeep((UINT)-1); - return false; - } - - cmi.hMenu = menu; - return true; - } - - void DisplayChevronMenu(_ChevronMenuInfo& cmi) - { -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag -#endif - // convert chevron rect to screen coordinates - ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; - POINT pt = { cmi.lpnm->rc.left, cmi.lpnm->rc.bottom }; - wndFrom.MapWindowPoints(NULL, &pt, 1); - RECT rc = cmi.lpnm->rc; - wndFrom.MapWindowPoints(NULL, &rc); - // set up flags and rect - UINT uMenuFlags = TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | (!AtlIsOldWindows() ? TPM_VERPOSANIMATION : 0); - TPMPARAMS TPMParams = { 0 }; - TPMParams.cbSize = sizeof(TPMPARAMS); - TPMParams.rcExclude = rc; - // check if this window has a command bar - HWND hWndCmdBar = (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); - if(::IsWindow(hWndCmdBar)) - { - CBRPOPUPMENU CBRPopupMenu = { sizeof(CBRPOPUPMENU), cmi.hMenu, uMenuFlags, pt.x, pt.y, &TPMParams }; - ::SendMessage(hWndCmdBar, CBRM_TRACKPOPUPMENU, 0, (LPARAM)&CBRPopupMenu); - } - else - { - CMenuHandle menu = cmi.hMenu; - menu.TrackPopupMenuEx(uMenuFlags, pt.x, pt.y, m_hWnd, &TPMParams); - } - } - - void CleanupChevronMenu(_ChevronMenuInfo& cmi) - { - CMenuHandle menu = cmi.hMenu; - // if menu is from a command bar, detach submenus so they are not destroyed - if(cmi.bCmdBar) - { - for(int i = menu.GetMenuItemCount() - 1; i >=0; i--) - menu.RemoveMenu(i, MF_BYPOSITION); - } - // destroy menu - menu.DestroyMenu(); - // convert chevron rect to screen coordinates - ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; - RECT rc = cmi.lpnm->rc; - wndFrom.MapWindowPoints(NULL, &rc); - // eat next message if click is on the same button - MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rc, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -}; - - -template -class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinTraits > -{ -public: - HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) - { - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); - - dwStyle = T::GetWndStyle(dwStyle); - dwExStyle = T::GetWndExStyle(dwExStyle); - - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - return CFrameWindowImplBase< TBase, TWinTraits >::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); - } - - HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) - { - const int cchName = 256; - TCHAR szWindowName[cchName]; - szWindowName[0] = 0; -#ifndef _WIN32_WCE - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); -#else // CE specific - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - - // This always needs to be NULL for Windows CE. - // Frame Window menus have to go onto the CommandBar. - // Use CreateSimpleCECommandBar - HMENU hMenu = NULL; -#endif // _WIN32_WCE - - T* pT = static_cast(this); - HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); - - if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - return hWnd; - } - - BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; -#ifndef _WIN32_WCE - ATLASSERT(!::IsWindow(m_hWndToolBar)); - m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); - return (m_hWndToolBar != NULL); -#else // CE specific - HWND hWnd= T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); - return (hWnd != NULL); -#endif // _WIN32_WCE - } - -#ifdef _WIN32_WCE - // CE specific variant that returns the handle of the toolbar - HWND CreateSimpleCEToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - - return T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); - } -#endif // _WIN32_WCE - -// message map and handlers - typedef CFrameWindowImplBase< TBase, TWinTraits > _baseClass; - - BEGIN_MSG_MAP(CFrameWindowImpl) - MESSAGE_HANDLER(WM_SIZE, OnSize) -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -#endif // !_ATL_NO_REBAR_SUPPORT - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam != SIZE_MINIMIZED) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - bHandled = FALSE; - return 1; - } - -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(FALSE); - return 0; - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; - if(!pT->PrepareChevronMenu(cmi)) - { - bHandled = FALSE; - return 1; - } - // display a popup menu with hidden items - pT->DisplayChevronMenu(cmi); - // cleanup - pT->CleanupChevronMenu(cmi); - return 0; - } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -#endif // !_ATL_NO_REBAR_SUPPORT -}; - - -/////////////////////////////////////////////////////////////////////////////// -// AtlCreateSimpleToolBar - helper for creating simple toolbars - -#ifndef _WIN32_WCE - -inline HWND AtlCreateSimpleToolBar(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, - DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) -{ - return CFrameWindowImplBase<>::CreateSimpleToolBarCtrl(hWndParent, nResourceID, bInitialSeparator, dwStyle, nID); -} - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMDIWindow - -#ifndef _WIN32_WCE - -#ifndef _WTL_MDIWINDOWMENU_TEXT -#define _WTL_MDIWINDOWMENU_TEXT _T("&Window") -#endif - -class CMDIWindow : public ATL::CWindow -{ -public: -// Data members - HWND m_hWndMDIClient; - HMENU m_hMenu; - -// Constructors - CMDIWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd), m_hWndMDIClient(NULL), m_hMenu(NULL) - { } - - CMDIWindow& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Operations - HWND MDIGetActive(BOOL* lpbMaximized = NULL) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (HWND)::SendMessage(m_hWndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)lpbMaximized); - } - - void MDIActivate(HWND hWndChildToActivate) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToActivate)); - ::SendMessage(m_hWndMDIClient, WM_MDIACTIVATE, (WPARAM)hWndChildToActivate, 0); - } - - void MDINext(HWND hWndChild, BOOL bPrevious = FALSE) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(hWndChild == NULL || ::IsWindow(hWndChild)); - ::SendMessage(m_hWndMDIClient, WM_MDINEXT, (WPARAM)hWndChild, (LPARAM)bPrevious); - } - - void MDIMaximize(HWND hWndChildToMaximize) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToMaximize)); - ::SendMessage(m_hWndMDIClient, WM_MDIMAXIMIZE, (WPARAM)hWndChildToMaximize, 0); - } - - void MDIRestore(HWND hWndChildToRestore) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToRestore)); - ::SendMessage(m_hWndMDIClient, WM_MDIRESTORE, (WPARAM)hWndChildToRestore, 0); - } - - void MDIDestroy(HWND hWndChildToDestroy) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(::IsWindow(hWndChildToDestroy)); - ::SendMessage(m_hWndMDIClient, WM_MDIDESTROY, (WPARAM)hWndChildToDestroy, 0); - } - - BOOL MDICascade(UINT uFlags = 0) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDICASCADE, (WPARAM)uFlags, 0); - } - - BOOL MDITile(UINT uFlags = MDITILE_HORIZONTAL) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDITILE, (WPARAM)uFlags, 0); - } - - void MDIIconArrange() - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - ::SendMessage(m_hWndMDIClient, WM_MDIICONARRANGE, 0, 0); - } - - HMENU MDISetMenu(HMENU hMenuFrame, HMENU hMenuWindow) - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDISETMENU, (WPARAM)hMenuFrame, (LPARAM)hMenuWindow); - } - - HMENU MDIRefreshMenu() - { - ATLASSERT(::IsWindow(m_hWndMDIClient)); - return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0); - } - -// Additional operations - static HMENU GetStandardWindowMenu(HMENU hMenu) - { - int nCount = ::GetMenuItemCount(hMenu); - if(nCount == -1) - return NULL; - int nLen = ::GetMenuString(hMenu, nCount - 2, NULL, 0, MF_BYPOSITION); - if(nLen == 0) - return NULL; - CTempBuffer buff; - LPTSTR lpszText = buff.Allocate(nLen + 1); - if(lpszText == NULL) - return NULL; - if(::GetMenuString(hMenu, nCount - 2, lpszText, nLen + 1, MF_BYPOSITION) != nLen) - return NULL; - if(lstrcmp(lpszText, _WTL_MDIWINDOWMENU_TEXT) != 0) - return NULL; - return ::GetSubMenu(hMenu, nCount - 2); - } - - void SetMDIFrameMenu() - { - HMENU hWindowMenu = GetStandardWindowMenu(m_hMenu); - MDISetMenu(m_hMenu, hWindowMenu); - MDIRefreshMenu(); - ::DrawMenuBar(GetMDIFrame()); - } - - HWND GetMDIFrame() const - { - return ::GetParent(m_hWndMDIClient); - } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMDIFrameWindowImpl - -#ifndef _WIN32_WCE - -// MDI child command chaining macro (only for MDI frame windows) -#define CHAIN_MDI_CHILD_COMMANDS() \ - if(uMsg == WM_COMMAND) \ - { \ - HWND hWndChild = MDIGetActive(); \ - if(hWndChild != NULL) \ - ::SendMessage(hWndChild, uMsg, wParam, lParam); \ - } - -template -class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBase -{ -public: - HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) - { - m_hMenu = hMenu; - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); - - dwStyle = T::GetWndStyle(dwStyle); - dwExStyle = T::GetWndExStyle(dwExStyle); - - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - return CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); - } - - HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) - { - const int cchName = 256; - TCHAR szWindowName[cchName]; - szWindowName[0] = 0; - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - T* pT = static_cast(this); - HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); - - if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - return hWnd; - } - - BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - ATLASSERT(!::IsWindow(m_hWndToolBar)); - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); - return (m_hWndToolBar != NULL); - } - - virtual WNDPROC GetWindowProc() - { - return MDIFrameWindowProc; - } - - static LRESULT CALLBACK MDIFrameWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - CMDIFrameWindowImpl< T, TBase, TWinTraits >* pThis = (CMDIFrameWindowImpl< T, TBase, TWinTraits >*)hWnd; - // set a ptr to this message and save the old value -#if (_ATL_VER >= 0x0700) - ATL::_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam); - const ATL::_ATL_MSG* pOldMsg = pThis->m_pCurrentMsg; -#else // !(_ATL_VER >= 0x0700) - MSG msg = { pThis->m_hWnd, uMsg, wParam, lParam, 0, { 0, 0 } }; - const MSG* pOldMsg = pThis->m_pCurrentMsg; -#endif // !(_ATL_VER >= 0x0700) - pThis->m_pCurrentMsg = &msg; - // pass to the message map to process - LRESULT lRes = 0; - BOOL bRet = pThis->ProcessWindowMessage(pThis->m_hWnd, uMsg, wParam, lParam, lRes, 0); - // restore saved value for the current message - ATLASSERT(pThis->m_pCurrentMsg == &msg); - pThis->m_pCurrentMsg = pOldMsg; - // do the default processing if message was not handled - if(!bRet) - { - if(uMsg != WM_NCDESTROY) - lRes = pThis->DefWindowProc(uMsg, wParam, lParam); - else - { - // unsubclass, if needed - LONG_PTR pfnWndProc = ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC); - lRes = pThis->DefWindowProc(uMsg, wParam, lParam); - if(pThis->m_pfnSuperWindowProc != ::DefWindowProc && ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc) - ::SetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc); -#if (_ATL_VER >= 0x0700) - // mark window as destryed - pThis->m_dwState |= WINSTATE_DESTROYED; -#else // !(_ATL_VER >= 0x0700) - // clear out window handle - HWND hWnd = pThis->m_hWnd; - pThis->m_hWnd = NULL; - // clean up after window is destroyed - pThis->OnFinalMessage(hWnd); -#endif // !(_ATL_VER >= 0x0700) - } - } -#if (_ATL_VER >= 0x0700) - if(pThis->m_dwState & WINSTATE_DESTROYED && pThis->m_pCurrentMsg == NULL) - { - // clear out window handle - HWND hWnd = pThis->m_hWnd; - pThis->m_hWnd = NULL; - pThis->m_dwState &= ~WINSTATE_DESTROYED; - // clean up after window is destroyed - pThis->OnFinalMessage(hWnd); - } -#endif // (_ATL_VER >= 0x0700) - return lRes; - } - - // Overriden to call DefWindowProc which uses DefFrameProc - LRESULT DefWindowProc() - { - const MSG* pMsg = m_pCurrentMsg; - LRESULT lRes = 0; - if (pMsg != NULL) - lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); - return lRes; - } - - LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) - { - return ::DefFrameProc(m_hWnd, m_hWndMDIClient, uMsg, wParam, lParam); - } - - BOOL PreTranslateMessage(MSG* pMsg) - { - if(CFrameWindowImplBase::PreTranslateMessage(pMsg)) - return TRUE; - return ::TranslateMDISysAccel(m_hWndMDIClient, pMsg); - } - - HWND CreateMDIClient(HMENU hWindowMenu = NULL, UINT nID = ATL_IDW_CLIENT, UINT nFirstChildID = ATL_IDM_FIRST_MDICHILD) - { - DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MDIS_ALLCHILDSTYLES; - DWORD dwExStyle = WS_EX_CLIENTEDGE; - - CLIENTCREATESTRUCT ccs = { 0 }; - ccs.hWindowMenu = hWindowMenu; - ccs.idFirstChild = nFirstChildID; - - if((GetStyle() & (WS_HSCROLL | WS_VSCROLL)) != 0) - { - // parent MDI frame's scroll styles move to the MDICLIENT - dwStyle |= (GetStyle() & (WS_HSCROLL | WS_VSCROLL)); - - // fast way to turn off the scrollbar bits (without a resize) - ModifyStyle(WS_HSCROLL | WS_VSCROLL, 0, SWP_NOREDRAW | SWP_FRAMECHANGED); - } - - // Create MDICLIENT window - m_hWndClient = ::CreateWindowEx(dwExStyle, _T("MDIClient"), NULL, - dwStyle, 0, 0, 1, 1, m_hWnd, (HMENU)LongToHandle(nID), - ModuleHelper::GetModuleInstance(), (LPVOID)&ccs); - if (m_hWndClient == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("MDI Frame failed to create MDICLIENT.\n")); - return NULL; - } - - // Move it to the top of z-order - ::BringWindowToTop(m_hWndClient); - - // set as MDI client window - m_hWndMDIClient = m_hWndClient; - - // update to proper size - T* pT = static_cast(this); - pT->UpdateLayout(); - - return m_hWndClient; - } - - typedef CFrameWindowImplBase _baseClass; - - BEGIN_MSG_MAP(CMDIFrameWindowImpl) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(wParam != SIZE_MINIMIZED) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - // message must be handled, otherwise DefFrameProc would resize the client again - return 0; - } - - LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - // don't allow CFrameWindowImplBase to handle this one - return DefWindowProc(uMsg, wParam, lParam); - } - - LRESULT OnMDISetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - SetMDIFrameMenu(); - return 0; - } - -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(FALSE); - return 0; - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; - if(!pT->PrepareChevronMenu(cmi)) - { - bHandled = FALSE; - return 1; - } - // display a popup menu with hidden items - pT->DisplayChevronMenu(cmi); - // cleanup - pT->CleanupChevronMenu(cmi); - return 0; - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMDIChildWindowImpl - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase -{ -public: - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - UINT nMenuID = 0, LPVOID lpCreateParam = NULL) - { - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); - - if(nMenuID != 0) - m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nMenuID)); - - dwStyle = T::GetWndStyle(dwStyle); - dwExStyle = T::GetWndExStyle(dwExStyle); - - dwExStyle |= WS_EX_MDICHILD; // force this one - m_pfnSuperWindowProc = ::DefMDIChildProc; - m_hWndMDIClient = hWndParent; - ATLASSERT(::IsWindow(m_hWndMDIClient)); - - if(rect.m_lpRect == NULL) - rect.m_lpRect = &TBase::rcDefault; - - // If the currently active MDI child is maximized, we want to create this one maximized too - ATL::CWindow wndParent = hWndParent; - BOOL bMaximized = FALSE; - wndParent.SendMessage(WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - if(bMaximized) - wndParent.SetRedraw(FALSE); - - HWND hWnd = CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, (UINT)0U, atom, lpCreateParam); - - if(bMaximized) - { - // Maximize and redraw everything - if(hWnd != NULL) - MDIMaximize(hWnd); - wndParent.SetRedraw(TRUE); - wndParent.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); - ::SetFocus(GetMDIFrame()); // focus will be set back to this window - } - else if(hWnd != NULL && ::IsWindowVisible(m_hWnd) && !::IsChild(hWnd, ::GetFocus())) - { - ::SetFocus(hWnd); - } - - return hWnd; - } - - HWND CreateEx(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR lpcstrWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) - { - const int cchName = 256; - TCHAR szWindowName[cchName]; - szWindowName[0] = 0; - if(lpcstrWindowName == NULL) - { - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - lpcstrWindowName = szWindowName; - } - - T* pT = static_cast(this); - HWND hWnd = pT->Create(hWndParent, rect, lpcstrWindowName, dwStyle, dwExStyle, T::GetWndClassInfo().m_uCommonResourceID, lpCreateParam); - - if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); - - return hWnd; - } - - BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - ATLASSERT(!::IsWindow(m_hWndToolBar)); - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); - return (m_hWndToolBar != NULL); - } - - BOOL UpdateClientEdge(LPRECT lpRect = NULL) - { - // only adjust for active MDI child window - HWND hWndChild = MDIGetActive(); - if(hWndChild != NULL && hWndChild != m_hWnd) - return FALSE; - - // need to adjust the client edge style as max/restore happens - DWORD dwStyle = ::GetWindowLong(m_hWndMDIClient, GWL_EXSTYLE); - DWORD dwNewStyle = dwStyle; - if(hWndChild != NULL && ((GetExStyle() & WS_EX_CLIENTEDGE) == 0) && ((GetStyle() & WS_MAXIMIZE) != 0)) - dwNewStyle &= ~(WS_EX_CLIENTEDGE); - else - dwNewStyle |= WS_EX_CLIENTEDGE; - - if(dwStyle != dwNewStyle) - { - // SetWindowPos will not move invalid bits - ::RedrawWindow(m_hWndMDIClient, NULL, NULL, - RDW_INVALIDATE | RDW_ALLCHILDREN); - // remove/add WS_EX_CLIENTEDGE to MDI client area - ::SetWindowLong(m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); - ::SetWindowPos(m_hWndMDIClient, NULL, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | - SWP_NOZORDER | SWP_NOCOPYBITS); - - // return new client area - if (lpRect != NULL) - ::GetClientRect(m_hWndMDIClient, lpRect); - - return TRUE; - } - - return FALSE; - } - - typedef CFrameWindowImplBase _baseClass; - BEGIN_MSG_MAP(CMDIChildWindowImpl) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged) - MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) - MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) - MESSAGE_HANDLER(WM_MDIACTIVATE, OnMDIActivate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) - NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT - CHAIN_MSG_MAP(_baseClass) - END_MSG_MAP() - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - DefWindowProc(uMsg, wParam, lParam); // needed for MDI children - if(wParam != SIZE_MINIMIZED) - { - T* pT = static_cast(this); - pT->UpdateLayout(); - } - return 0; - } - - LRESULT OnWindowPosChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - // update MDI client edge and adjust MDI child rect - LPWINDOWPOS lpWndPos = (LPWINDOWPOS)lParam; - - if(!(lpWndPos->flags & SWP_NOSIZE)) - { - RECT rectClient; - if(UpdateClientEdge(&rectClient) && ((GetStyle() & WS_MAXIMIZE) != 0)) - { - ::AdjustWindowRectEx(&rectClient, GetStyle(), FALSE, GetExStyle()); - lpWndPos->x = rectClient.left; - lpWndPos->y = rectClient.top; - lpWndPos->cx = rectClient.right - rectClient.left; - lpWndPos->cy = rectClient.bottom - rectClient.top; - } - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - LRESULT lRes = DefWindowProc(uMsg, wParam, lParam); - - // Activate this MDI window if needed - if(lRes == MA_ACTIVATE || lRes == MA_ACTIVATEANDEAT) - { - if(MDIGetActive() != m_hWnd) - MDIActivate(m_hWnd); - } - - return lRes; - } - - LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - return ::SendMessage(GetMDIFrame(), uMsg, wParam, lParam); - } - - LRESULT OnMDIActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if((HWND)lParam == m_hWnd && m_hMenu != NULL) - SetMDIFrameMenu(); - else if((HWND)lParam == NULL) - ::SendMessage(GetMDIFrame(), WM_MDISETMENU, 0, 0); - - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_hMenu != NULL) - { - ::DestroyMenu(m_hMenu); - m_hMenu = NULL; - } - UpdateClientEdge(); - bHandled = FALSE; - return 1; - } - -#ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) - LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->UpdateLayout(FALSE); - return 0; - } -#endif // (_WIN32_IE >= 0x0400) - -#if (_WIN32_IE >= 0x0500) - LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) - { - T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; - if(!pT->PrepareChevronMenu(cmi)) - { - bHandled = FALSE; - return 1; - } - // display a popup menu with hidden items - pT->DisplayChevronMenu(cmi); - // cleanup - pT->CleanupChevronMenu(cmi); - return 0; - } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_ATL_NO_REBAR_SUPPORT -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// COwnerDraw - MI class for owner-draw support - -template -class COwnerDraw -{ -public: -#if (_ATL_VER < 0x0700) - BOOL m_bHandledOD; - - BOOL IsMsgHandled() const - { - return m_bHandledOD; - } - void SetMsgHandled(BOOL bHandled) - { - m_bHandledOD = bHandled; - } -#endif // (_ATL_VER < 0x0700) - -// Message map and handlers - BEGIN_MSG_MAP(COwnerDraw< T >) - MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) - MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) - MESSAGE_HANDLER(WM_COMPAREITEM, OnCompareItem) - MESSAGE_HANDLER(WM_DELETEITEM, OnDeleteItem) - ALT_MSG_MAP(1) - MESSAGE_HANDLER(OCM_DRAWITEM, OnDrawItem) - MESSAGE_HANDLER(OCM_MEASUREITEM, OnMeasureItem) - MESSAGE_HANDLER(OCM_COMPAREITEM, OnCompareItem) - MESSAGE_HANDLER(OCM_DELETEITEM, OnDeleteItem) - END_MSG_MAP() - - LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - pT->DrawItem((LPDRAWITEMSTRUCT)lParam); - bHandled = pT->IsMsgHandled(); - return (LRESULT)TRUE; - } - - LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - pT->MeasureItem((LPMEASUREITEMSTRUCT)lParam); - bHandled = pT->IsMsgHandled(); - return (LRESULT)TRUE; - } - - LRESULT OnCompareItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - bHandled = pT->IsMsgHandled(); - return (LRESULT)pT->CompareItem((LPCOMPAREITEMSTRUCT)lParam); - } - - LRESULT OnDeleteItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->SetMsgHandled(TRUE); - pT->DeleteItem((LPDELETEITEMSTRUCT)lParam); - bHandled = pT->IsMsgHandled(); - return (LRESULT)TRUE; - } - -// Overrideables - void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/) - { - // must be implemented - ATLASSERT(FALSE); - } - - void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) - { - if(lpMeasureItemStruct->CtlType != ODT_MENU) - { - // return default height for a system font - T* pT = static_cast(this); - HWND hWnd = pT->GetDlgItem(lpMeasureItemStruct->CtlID); - CClientDC dc(hWnd); - TEXTMETRIC tm = { 0 }; - dc.GetTextMetrics(&tm); - - lpMeasureItemStruct->itemHeight = tm.tmHeight; - } - else - lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU); - } - - int CompareItem(LPCOMPAREITEMSTRUCT /*lpCompareItemStruct*/) - { - // all items are equal - return 0; - } - - void DeleteItem(LPDELETEITEMSTRUCT /*lpDeleteItemStruct*/) - { - // default - nothing - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Update UI macros - -// these build the Update UI map inside a class definition -#define BEGIN_UPDATE_UI_MAP(thisClass) \ - static const CUpdateUIBase::_AtlUpdateUIMap* GetUpdateUIMap() \ - { \ - static const _AtlUpdateUIMap theMap[] = \ - { - -#define UPDATE_ELEMENT(nID, wType) \ - { nID, wType }, - -#define END_UPDATE_UI_MAP() \ - { (WORD)-1, 0 } \ - }; \ - return theMap; \ - } - -/////////////////////////////////////////////////////////////////////////////// -// CUpdateUI - manages UI elements updating - -class CUpdateUIBase -{ -public: - // constants - enum - { - // UI element type - UPDUI_MENUPOPUP = 0x0001, - UPDUI_MENUBAR = 0x0002, - UPDUI_CHILDWINDOW = 0x0004, - UPDUI_TOOLBAR = 0x0008, - UPDUI_STATUSBAR = 0x0010, - // state - UPDUI_ENABLED = 0x0000, - UPDUI_DISABLED = 0x0100, - UPDUI_CHECKED = 0x0200, - UPDUI_CHECKED2 = 0x0400, - UPDUI_RADIO = 0x0800, - UPDUI_DEFAULT = 0x1000, - UPDUI_TEXT = 0x2000, - // internal state - UPDUI_CLEARDEFAULT = 0x4000, - }; - - // element data - struct _AtlUpdateUIElement - { - HWND m_hWnd; - WORD m_wType; - - bool operator ==(const _AtlUpdateUIElement& e) const - { return (m_hWnd == e.m_hWnd && m_wType == e.m_wType); } - }; - - // map data - struct _AtlUpdateUIMap - { - WORD m_nID; - WORD m_wType; - - bool operator ==(const _AtlUpdateUIMap& e) const - { return (m_nID == e.m_nID && m_wType == e.m_wType); } - }; - - // instance data - struct _AtlUpdateUIData - { - WORD m_wState; - union - { - void* m_lpData; - LPTSTR m_lpstrText; - }; - - bool operator ==(const _AtlUpdateUIData& e) const - { return (m_wState == e.m_wState && m_lpData == e.m_lpData); } - }; - - ATL::CSimpleArray<_AtlUpdateUIElement> m_UIElements; // elements data - const _AtlUpdateUIMap* m_pUIMap; // static UI data - _AtlUpdateUIData* m_pUIData; // instance UI data - WORD m_wDirtyType; // global dirty flag - - bool m_bBlockAccelerators; - - -// Constructor, destructor - CUpdateUIBase() : m_pUIMap(NULL), m_pUIData(NULL), m_wDirtyType(0), m_bBlockAccelerators(false) - { } - - ~CUpdateUIBase() - { - if(m_pUIMap != NULL && m_pUIData != NULL) - { - const _AtlUpdateUIMap* pUIMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - while(pUIMap->m_nID != (WORD)-1) - { - if(pUIData->m_wState & UPDUI_TEXT) - delete [] pUIData->m_lpstrText; - pUIMap++; - pUIData++; - } - delete [] m_pUIData; - } - } - -// Check for disabled commands - bool UIGetBlockAccelerators() const - { - return m_bBlockAccelerators; - } - - bool UISetBlockAccelerators(bool bBlock) - { - bool bOld = m_bBlockAccelerators; - m_bBlockAccelerators = bBlock; - return bOld; - } - -// Add elements - BOOL UIAddMenuBar(HWND hWnd) // menu bar (main menu) - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_MENUBAR; - return m_UIElements.Add(e); - } - - BOOL UIAddToolBar(HWND hWnd) // toolbar - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_TOOLBAR; - return m_UIElements.Add(e); - } - - BOOL UIAddStatusBar(HWND hWnd) // status bar - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_STATUSBAR; - return m_UIElements.Add(e); - } - - BOOL UIAddChildWindowContainer(HWND hWnd) // child window - { - if(hWnd == NULL) - return FALSE; - _AtlUpdateUIElement e; - e.m_hWnd = hWnd; - e.m_wType = UPDUI_CHILDWINDOW; - return m_UIElements.Add(e); - } - -// Message map for popup menu updates and accelerator blocking - BEGIN_MSG_MAP(CUpdateUIBase) - MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - END_MSG_MAP() - - LRESULT OnInitMenuPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; - HMENU hMenu = (HMENU)wParam; - if(hMenu == NULL) - return 1; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return 1; - const _AtlUpdateUIMap* pMap = m_pUIMap; - while(pMap->m_nID != (WORD)-1) - { - if(pMap->m_wType & UPDUI_MENUPOPUP) - UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); - pMap++; - pUIData++; - } - return 0; - } - - LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - bHandled = FALSE; - if(m_bBlockAccelerators && HIWORD(wParam) == 1) // accelerators only - { - int nID = LOWORD(wParam); - if((UIGetState(nID) & UPDUI_DISABLED) == UPDUI_DISABLED) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIBase::OnCommand - blocked disabled command 0x%4.4X\n"), nID); - bHandled = TRUE; // eat the command, UI item is disabled - } - } - return 0; - } - -// methods for setting UI element state - BOOL UIEnable(int nID, BOOL bEnable, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(bEnable) - { - if(pUIData->m_wState & UPDUI_DISABLED) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_DISABLED; - } - } - else - { - if(!(pUIData->m_wState & UPDUI_DISABLED)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_DISABLED; - } - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - BOOL UISetCheck(int nID, int nCheck, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - switch(nCheck) - { - case 0: - if((pUIData->m_wState & UPDUI_CHECKED) || (pUIData->m_wState & UPDUI_CHECKED2)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~(UPDUI_CHECKED | UPDUI_CHECKED2); - } - break; - case 1: - if(!(pUIData->m_wState & UPDUI_CHECKED)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_CHECKED2; - pUIData->m_wState |= UPDUI_CHECKED; - } - break; - case 2: - if(!(pUIData->m_wState & UPDUI_CHECKED2)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_CHECKED; - pUIData->m_wState |= UPDUI_CHECKED2; - } - break; - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - // variant that supports bool (checked/not-checked, no intermediate state) - BOOL UISetCheck(int nID, bool bCheck, BOOL bForceUpdate = FALSE) - { - return UISetCheck(nID, bCheck ? 1 : 0, bForceUpdate); - } - - BOOL UISetRadio(int nID, BOOL bRadio, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(bRadio) - { - if(!(pUIData->m_wState & UPDUI_RADIO)) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_RADIO; - } - } - else - { - if(pUIData->m_wState & UPDUI_RADIO) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_RADIO; - } - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - BOOL UISetText(int nID, LPCTSTR lpstrText, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - if(lpstrText == NULL) - lpstrText = _T(""); - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(pUIData->m_lpstrText == NULL || lstrcmp(pUIData->m_lpstrText, lpstrText)) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - int nStrLen = lstrlen(lpstrText); - ATLTRY(pUIData->m_lpstrText = new TCHAR[nStrLen + 1]); - if(pUIData->m_lpstrText == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("UISetText - memory allocation failed\n")); - break; - } - SecureHelper::strcpy_x(pUIData->m_lpstrText, nStrLen + 1, lpstrText); - pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); - } - - if(bForceUpdate) - pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - - BOOL UISetDefault(int nID, BOOL bDefault, BOOL bForceUpdate = FALSE) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - if(bDefault) - { - if((pUIData->m_wState & UPDUI_DEFAULT) == 0) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState |= UPDUI_DEFAULT; - } - } - else - { - if((pUIData->m_wState & UPDUI_DEFAULT) != 0) - { - pUIData->m_wState |= pMap->m_wType; - pUIData->m_wState &= ~UPDUI_DEFAULT; - pUIData->m_wState |= UPDUI_CLEARDEFAULT; - } - } - - if(bForceUpdate) - pUIData->m_wState |= pMap->m_wType; - if(pUIData->m_wState & pMap->m_wType) - m_wDirtyType |= pMap->m_wType; - - break; // found - } - } - - return TRUE; - } - -// methods for complete state set/get - BOOL UISetState(int nID, DWORD dwState) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - { - pUIData->m_wState = (WORD)(dwState | pMap->m_wType); - m_wDirtyType |= pMap->m_wType; - break; // found - } - } - return TRUE; - } - - DWORD UIGetState(int nID) - { - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return 0; - for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) - { - if(nID == (int)pMap->m_nID) - return pUIData->m_wState; - } - return 0; - } - -// methods for updating UI -#ifndef _WIN32_WCE - BOOL UIUpdateMenuBar(BOOL bForceUpdate = FALSE, BOOL bMainMenu = FALSE) - { - if(!(m_wDirtyType & UPDUI_MENUBAR) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_MENUBAR) - { - HMENU hMenu = ::GetMenu(m_UIElements[i].m_hWnd); - if(hMenu != NULL && (pUIData->m_wState & UPDUI_MENUBAR) && (pMap->m_wType & UPDUI_MENUBAR)) - UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); - } - if(bMainMenu) - ::DrawMenuBar(m_UIElements[i].m_hWnd); - } - pMap++; - pUIData->m_wState &= ~UPDUI_MENUBAR; - if(pUIData->m_wState & UPDUI_TEXT) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - pUIData->m_wState &= ~UPDUI_TEXT; - } - pUIData++; - } - - m_wDirtyType &= ~UPDUI_MENUBAR; - return TRUE; - } -#endif // !_WIN32_WCE - - BOOL UIUpdateToolBar(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_TOOLBAR) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_TOOLBAR) - { - if((pUIData->m_wState & UPDUI_TOOLBAR) && (pMap->m_wType & UPDUI_TOOLBAR)) - UIUpdateToolBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); - } - } - pMap++; - pUIData->m_wState &= ~UPDUI_TOOLBAR; - pUIData++; - } - - m_wDirtyType &= ~UPDUI_TOOLBAR; - return TRUE; - } - - BOOL UIUpdateStatusBar(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_STATUSBAR) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_STATUSBAR) - { - if((pUIData->m_wState & UPDUI_STATUSBAR) && (pMap->m_wType & UPDUI_STATUSBAR)) - UIUpdateStatusBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); - } - } - pMap++; - pUIData->m_wState &= ~UPDUI_STATUSBAR; - if(pUIData->m_wState & UPDUI_TEXT) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - pUIData->m_wState &= ~UPDUI_TEXT; - } - pUIData++; - } - - m_wDirtyType &= ~UPDUI_STATUSBAR; - return TRUE; - } - - BOOL UIUpdateChildWindows(BOOL bForceUpdate = FALSE) - { - if(!(m_wDirtyType & UPDUI_CHILDWINDOW) && !bForceUpdate) - return TRUE; - - const _AtlUpdateUIMap* pMap = m_pUIMap; - _AtlUpdateUIData* pUIData = m_pUIData; - if(pUIData == NULL) - return FALSE; - - while(pMap->m_nID != (WORD)-1) - { - for(int i = 0; i < m_UIElements.GetSize(); i++) - { - if(m_UIElements[i].m_wType == UPDUI_CHILDWINDOW) - { - if((pUIData->m_wState & UPDUI_CHILDWINDOW) && (pMap->m_wType & UPDUI_CHILDWINDOW)) - UIUpdateChildWindow(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); - } - } - pMap++; - pUIData->m_wState &= ~UPDUI_CHILDWINDOW; - if(pUIData->m_wState & UPDUI_TEXT) - { - delete [] pUIData->m_lpstrText; - pUIData->m_lpstrText = NULL; - pUIData->m_wState &= ~UPDUI_TEXT; - } - pUIData++; - } - - m_wDirtyType &= ~UPDUI_CHILDWINDOW; - return TRUE; - } - -// internal element specific methods - static void UIUpdateMenuBarElement(int nID, _AtlUpdateUIData* pUIData, HMENU hMenu) - { -#ifndef _WIN32_WCE - if((pUIData->m_wState & UPDUI_CLEARDEFAULT) != 0) - { - ::SetMenuDefaultItem(hMenu, (UINT)-1, 0); - pUIData->m_wState &= ~UPDUI_CLEARDEFAULT; - } -#endif // !_WIN32_WCE - - CMenuItemInfo mii; - mii.fMask = MIIM_STATE; - mii.wID = nID; - -#ifndef _WIN32_WCE - if((pUIData->m_wState & UPDUI_DISABLED) != 0) - mii.fState |= MFS_DISABLED | MFS_GRAYED; - else - mii.fState |= MFS_ENABLED; - - if((pUIData->m_wState & UPDUI_CHECKED) != 0) - mii.fState |= MFS_CHECKED; - else - mii.fState |= MFS_UNCHECKED; - - if((pUIData->m_wState & UPDUI_DEFAULT) != 0) - mii.fState |= MFS_DEFAULT; -#else // CE specific - // ::SetMenuItemInfo() can't disable or check menu items - // on Windows CE, so we have to do that directly - UINT uEnable = MF_BYCOMMAND; - if((pUIData->m_wState & UPDUI_DISABLED) != 0) - uEnable |= MF_GRAYED; - else - uEnable |= MF_ENABLED; - ::EnableMenuItem(hMenu, nID, uEnable); - - UINT uCheck = MF_BYCOMMAND; - if((pUIData->m_wState & UPDUI_CHECKED) != 0) - uCheck |= MF_CHECKED; - else - uCheck |= MF_UNCHECKED; - ::CheckMenuItem(hMenu, nID, uCheck); -#endif // _WIN32_WCE - - if((pUIData->m_wState & UPDUI_TEXT) != 0) - { - CMenuItemInfo miiNow; - miiNow.fMask = MIIM_TYPE; - miiNow.wID = nID; - if(::GetMenuItemInfo(hMenu, nID, FALSE, &miiNow)) - { - mii.fMask |= MIIM_TYPE; - // MFT_BITMAP and MFT_SEPARATOR don't go together with MFT_STRING -#ifndef _WIN32_WCE - mii.fType |= (miiNow.fType & ~(MFT_BITMAP | MFT_SEPARATOR)) | MFT_STRING; -#else // CE specific - mii.fType |= (miiNow.fType & ~(MFT_SEPARATOR)) | MFT_STRING; -#endif // _WIN32_WCE - mii.dwTypeData = pUIData->m_lpstrText; - } - } - - ::SetMenuItemInfo(hMenu, nID, FALSE, &mii); - } - - static void UIUpdateToolBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndToolBar) - { - // Note: only handles enabled/disabled, checked state, and radio (press) - ::SendMessage(hWndToolBar, TB_ENABLEBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); - ::SendMessage(hWndToolBar, TB_CHECKBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED) ? TRUE : FALSE); - ::SendMessage(hWndToolBar, TB_INDETERMINATE, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED2) ? TRUE : FALSE); - ::SendMessage(hWndToolBar, TB_PRESSBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_RADIO) ? TRUE : FALSE); - } - - static void UIUpdateStatusBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndStatusBar) - { - // Note: only handles text - if(pUIData->m_wState & UPDUI_TEXT) - ::SendMessage(hWndStatusBar, SB_SETTEXT, nID, (LPARAM)pUIData->m_lpstrText); - } - - static void UIUpdateChildWindow(int nID, _AtlUpdateUIData* pUIData, HWND hWnd) - { - HWND hChild = ::GetDlgItem(hWnd, nID); - - ::EnableWindow(hChild, (pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); - // for check and radio, assume that window is a button - int nCheck = BST_UNCHECKED; - if(pUIData->m_wState & UPDUI_CHECKED || pUIData->m_wState & UPDUI_RADIO) - nCheck = BST_CHECKED; - else if(pUIData->m_wState & UPDUI_CHECKED2) - nCheck = BST_INDETERMINATE; - ::SendMessage(hChild, BM_SETCHECK, nCheck, 0L); - if(pUIData->m_wState & UPDUI_DEFAULT) - { - DWORD dwRet = (DWORD)::SendMessage(hWnd, DM_GETDEFID, 0, 0L); - if(HIWORD(dwRet) == DC_HASDEFID) - { - HWND hOldDef = ::GetDlgItem(hWnd, (int)(short)LOWORD(dwRet)); - // remove BS_DEFPUSHBUTTON - ::SendMessage(hOldDef, BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); - } - ::SendMessage(hWnd, DM_SETDEFID, nID, 0L); - } - if(pUIData->m_wState & UPDUI_TEXT) - ::SetWindowText(hChild, pUIData->m_lpstrText); - } -}; - -template -class CUpdateUI : public CUpdateUIBase -{ -public: - CUpdateUI() - { - T* pT = static_cast(this); - pT; - const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); - m_pUIMap = pMap; - ATLASSERT(m_pUIMap != NULL); - int nCount; - for(nCount = 1; pMap->m_nID != (WORD)-1; nCount++) - pMap++; - - // check for duplicates (debug only) -#ifdef _DEBUG - for(int i = 0; i < nCount; i++) - { - for(int j = 0; j < nCount; j++) - { - // shouldn't have duplicates in the update UI map - if(i != j) - ATLASSERT(m_pUIMap[j].m_nID != m_pUIMap[i].m_nID); - } - } -#endif // _DEBUG - - ATLTRY(m_pUIData = new _AtlUpdateUIData[nCount]); - ATLASSERT(m_pUIData != NULL); - - if(m_pUIData != NULL) - memset(m_pUIData, 0, sizeof(_AtlUpdateUIData) * nCount); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDynamicUpdateUI - allows update elements to dynamically added and removed -// in addition to a static update UI map - -template -class CDynamicUpdateUI : public CUpdateUIBase -{ -public: -// Data members - ATL::CSimpleArray<_AtlUpdateUIMap> m_arrUIMap; // copy of the static UI data - ATL::CSimpleArray<_AtlUpdateUIData> m_arrUIData; // instance UI data - -// Constructor/destructor - CDynamicUpdateUI() - { - T* pT = static_cast(this); - pT; - const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); - ATLASSERT(pMap != NULL); - - for(;;) - { - BOOL bRet = m_arrUIMap.Add(*(_AtlUpdateUIMap*)pMap); - ATLASSERT(bRet); - - if(bRet != FALSE) - { - _AtlUpdateUIData data = { 0, NULL }; - bRet = m_arrUIData.Add(data); - ATLASSERT(bRet); - } - - if(pMap->m_nID == (WORD)-1) - break; - - pMap++; - } - - ATLASSERT(m_arrUIMap.GetSize() == m_arrUIData.GetSize()); - -#ifdef _DEBUG - // check for duplicates (debug only) - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - for(int j = 0; j < m_arrUIMap.GetSize(); j++) - { - // shouldn't have duplicates in the update UI map - if(i != j) - ATLASSERT(m_arrUIMap[j].m_nID != m_arrUIMap[i].m_nID); - } - } -#endif // _DEBUG - - // Set internal data pointers to point to the new data arrays - m_pUIMap = m_arrUIMap.m_aT; - m_pUIData = m_arrUIData.m_aT; - } - - ~CDynamicUpdateUI() - { - for(int i = 0; i < m_arrUIData.GetSize(); i++) - { - if((m_arrUIData[i].m_wState & UPDUI_TEXT) != 0) - delete [] m_arrUIData[i].m_lpstrText; - } - - // Reset internal data pointers (memory will be released by CSimpleArray d-tor) - m_pUIMap = NULL; - m_pUIData = NULL; - } - -// Methods for dynamically adding and removing update elements - bool UIAddUpdateElement(WORD nID, WORD wType) - { - // check for duplicates - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - // shouldn't have duplicates in the update UI map - ATLASSERT(m_arrUIMap[i].m_nID != nID); - if(m_arrUIMap[i].m_nID == nID) - return false; - } - - bool bRetVal = false; - - // Add new end element - _AtlUpdateUIMap uumEnd = { (WORD)-1, 0 }; - BOOL bRet = m_arrUIMap.Add(uumEnd); - ATLASSERT(bRet); - - if(bRet != FALSE) - { - _AtlUpdateUIData uud = { 0, NULL }; - bRet = m_arrUIData.Add(uud); - ATLASSERT(bRet); - - // Set new data to the previous end element - if(bRet != FALSE) - { - int nSize = m_arrUIMap.GetSize(); - _AtlUpdateUIMap uum = { nID, wType }; - m_arrUIMap.SetAtIndex(nSize - 2, uum); - m_arrUIData.SetAtIndex(nSize - 2, uud); - - // Set internal data pointers again, just in case that memory moved - m_pUIMap = m_arrUIMap.m_aT; - m_pUIData = m_arrUIData.m_aT; - - bRetVal = true; - } - } - - return bRetVal; - } - - bool UIRemoveUpdateElement(WORD nID) - { - bool bRetVal = false; - - for(int i = 0; i < m_arrUIMap.GetSize(); i++) - { - if(m_arrUIMap[i].m_nID == nID) - { - BOOL bRet = m_arrUIMap.RemoveAt(i); - ATLASSERT(bRet); - bRet = m_arrUIData.RemoveAt(i); - ATLASSERT(bRet); - - bRetVal = true; - break; - } - } - - return bRetVal; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDialogResize - provides support for resizing dialog controls -// (works for any window that has child controls) - -// Put CDialogResize in the list of base classes for a dialog (or even plain window), -// then implement DLGRESIZE map by specifying controls and groups of control -// and using DLSZ_* values to specify how are they supposed to be resized. -// -// Notes: -// - Resizeable border (WS_THICKFRAME style) should be set in the dialog template -// for top level dialogs (popup or overlapped), so that users can resize the dialog. -// - Some flags cannot be combined; for instance DLSZ_CENTER_X overrides DLSZ_SIZE_X, -// DLSZ_SIZE_X overrides DLSZ_MOVE_X. X and Y flags can be combined. -// - Order of controls is important - group controls are resized and moved based -// on the position of the previous control in a group. - -// dialog resize map macros -#define BEGIN_DLGRESIZE_MAP(thisClass) \ - static const _AtlDlgResizeMap* GetDlgResizeMap() \ - { \ - static const _AtlDlgResizeMap theMap[] = \ - { - -#define END_DLGRESIZE_MAP() \ - { -1, 0 }, \ - }; \ - return theMap; \ - } - -#define DLGRESIZE_CONTROL(id, flags) \ - { id, flags }, - -#define BEGIN_DLGRESIZE_GROUP() \ - { -1, _DLSZ_BEGIN_GROUP }, - -#define END_DLGRESIZE_GROUP() \ - { -1, _DLSZ_END_GROUP }, - - -template -class CDialogResize -{ -public: -// Data declarations and members - enum - { - DLSZ_SIZE_X = 0x00000001, - DLSZ_SIZE_Y = 0x00000002, - DLSZ_MOVE_X = 0x00000004, - DLSZ_MOVE_Y = 0x00000008, - DLSZ_REPAINT = 0x00000010, - DLSZ_CENTER_X = 0x00000020, - DLSZ_CENTER_Y = 0x00000040, - - // internal use only - _DLSZ_BEGIN_GROUP = 0x00001000, - _DLSZ_END_GROUP = 0x00002000, - _DLSZ_GRIPPER = 0x00004000 - }; - - struct _AtlDlgResizeMap - { - int m_nCtlID; - DWORD m_dwResizeFlags; - }; - - struct _AtlDlgResizeData - { - int m_nCtlID; - DWORD m_dwResizeFlags; - RECT m_rect; - - int GetGroupCount() const - { - return (int)LOBYTE(HIWORD(m_dwResizeFlags)); - } - - void SetGroupCount(int nCount) - { - ATLASSERT(nCount > 0 && nCount < 256); - DWORD dwCount = (DWORD)MAKELONG(0, MAKEWORD(nCount, 0)); - m_dwResizeFlags &= 0xFF00FFFF; - m_dwResizeFlags |= dwCount; - } - - bool operator ==(const _AtlDlgResizeData& r) const - { return (m_nCtlID == r.m_nCtlID && m_dwResizeFlags == r.m_dwResizeFlags); } - }; - - ATL::CSimpleArray<_AtlDlgResizeData> m_arrData; - SIZE m_sizeDialog; - POINT m_ptMinTrackSize; - bool m_bGripper; - - -// Constructor - CDialogResize() : m_bGripper(false) - { - m_sizeDialog.cx = 0; - m_sizeDialog.cy = 0; - m_ptMinTrackSize.x = -1; - m_ptMinTrackSize.y = -1; - } - -// Operations - void DlgResize_Init(bool bAddGripper = true, bool bUseMinTrackSize = true, DWORD dwForceStyle = WS_CLIPCHILDREN) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - DWORD dwStyle = pT->GetStyle(); - -#ifdef _DEBUG - // Debug only: Check if top level dialogs have a resizeable border. - if(((dwStyle & WS_CHILD) == 0) && ((dwStyle & WS_THICKFRAME) == 0)) - ATLTRACE2(atlTraceUI, 0, _T("DlgResize_Init - warning: top level dialog without the WS_THICKFRAME style - user cannot resize it\n")); -#endif // _DEBUG - - // Force specified styles (default WS_CLIPCHILDREN reduces flicker) - if((dwStyle & dwForceStyle) != dwForceStyle) - pT->ModifyStyle(0, dwForceStyle); - - // Adding this style removes an empty icon that dialogs with WS_THICKFRAME have. - // Setting icon to NULL is required when XP themes are active. - // Note: This will not prevent adding an icon for the dialog using SetIcon() - if((dwStyle & WS_CHILD) == 0) - { - pT->ModifyStyleEx(0, WS_EX_DLGMODALFRAME); - if(pT->GetIcon(FALSE) == NULL) - pT->SetIcon(NULL, FALSE); - } - - // Cleanup in case of multiple initialization - // block: first check for the gripper control, destroy it if needed - { - ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); - if(wndGripper.IsWindow() && m_arrData.GetSize() > 0 && (m_arrData[0].m_dwResizeFlags & _DLSZ_GRIPPER) != 0) - wndGripper.DestroyWindow(); - } - // clear out everything else - m_arrData.RemoveAll(); - m_sizeDialog.cx = 0; - m_sizeDialog.cy = 0; - m_ptMinTrackSize.x = -1; - m_ptMinTrackSize.y = -1; - - // Get initial dialog client size - RECT rectDlg = { 0 }; - pT->GetClientRect(&rectDlg); - m_sizeDialog.cx = rectDlg.right; - m_sizeDialog.cy = rectDlg.bottom; - -#ifndef _WIN32_WCE - // Create gripper if requested - m_bGripper = false; - if(bAddGripper) - { - // shouldn't exist already - ATLASSERT(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))); - if(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))) - { - ATL::CWindow wndGripper; - wndGripper.Create(_T("SCROLLBAR"), pT->m_hWnd, rectDlg, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEBOX | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN, 0, ATL_IDW_STATUS_BAR); - ATLASSERT(wndGripper.IsWindow()); - if(wndGripper.IsWindow()) - { - m_bGripper = true; - RECT rectCtl = { 0 }; - wndGripper.GetWindowRect(&rectCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - _AtlDlgResizeData data = { ATL_IDW_STATUS_BAR, DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | _DLSZ_GRIPPER, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; - m_arrData.Add(data); - } - } - } -#else // CE specific - bAddGripper; // avoid level 4 warning -#endif // _WIN32_WCE - - // Get min track position if requested - if(bUseMinTrackSize) - { - if((dwStyle & WS_CHILD) != 0) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - m_ptMinTrackSize.x = rect.right - rect.left; - m_ptMinTrackSize.y = rect.bottom - rect.top; - } - else - { - RECT rect = { 0 }; - pT->GetWindowRect(&rect); - m_ptMinTrackSize.x = rect.right - rect.left; - m_ptMinTrackSize.y = rect.bottom - rect.top; - } - } - - // Walk the map and initialize data - const _AtlDlgResizeMap* pMap = pT->GetDlgResizeMap(); - ATLASSERT(pMap != NULL); - int nGroupStart = -1; - for(int nCount = 1; !(pMap->m_nCtlID == -1 && pMap->m_dwResizeFlags == 0); nCount++, pMap++) - { - if(pMap->m_nCtlID == -1) - { - switch(pMap->m_dwResizeFlags) - { - case _DLSZ_BEGIN_GROUP: - ATLASSERT(nGroupStart == -1); - nGroupStart = m_arrData.GetSize(); - break; - case _DLSZ_END_GROUP: - { - ATLASSERT(nGroupStart != -1); - int nGroupCount = m_arrData.GetSize() - nGroupStart; - m_arrData[nGroupStart].SetGroupCount(nGroupCount); - nGroupStart = -1; - } - break; - default: - ATLASSERT(FALSE && _T("Invalid DLGRESIZE Map Entry")); - break; - } - } - else - { - // this ID conflicts with the default gripper one - ATLASSERT(m_bGripper ? (pMap->m_nCtlID != ATL_IDW_STATUS_BAR) : TRUE); - - ATL::CWindow ctl = pT->GetDlgItem(pMap->m_nCtlID); - ATLASSERT(ctl.IsWindow()); - RECT rectCtl = { 0 }; - ctl.GetWindowRect(&rectCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - - DWORD dwGroupFlag = (nGroupStart != -1 && m_arrData.GetSize() == nGroupStart) ? _DLSZ_BEGIN_GROUP : 0; - _AtlDlgResizeData data = { pMap->m_nCtlID, pMap->m_dwResizeFlags | dwGroupFlag, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; - m_arrData.Add(data); - } - } - ATLASSERT((nGroupStart == -1) && _T("No End Group Entry in the DLGRESIZE Map")); - } - - void DlgResize_UpdateLayout(int cxWidth, int cyHeight) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - // Restrict minimum size if requested - if(((pT->GetStyle() & WS_CHILD) != 0) && m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) - { - if(cxWidth < m_ptMinTrackSize.x) - cxWidth = m_ptMinTrackSize.x; - if(cyHeight < m_ptMinTrackSize.y) - cyHeight = m_ptMinTrackSize.y; - } - - BOOL bVisible = pT->IsWindowVisible(); - if(bVisible) - pT->SetRedraw(FALSE); - - for(int i = 0; i < m_arrData.GetSize(); i++) - { - if((m_arrData[i].m_dwResizeFlags & _DLSZ_BEGIN_GROUP) != 0) // start of a group - { - int nGroupCount = m_arrData[i].GetGroupCount(); - ATLASSERT(nGroupCount > 0 && i + nGroupCount - 1 < m_arrData.GetSize()); - RECT rectGroup = m_arrData[i].m_rect; - - int j = 1; - for(j = 1; j < nGroupCount; j++) - { - rectGroup.left = min(rectGroup.left, m_arrData[i + j].m_rect.left); - rectGroup.top = min(rectGroup.top, m_arrData[i + j].m_rect.top); - rectGroup.right = max(rectGroup.right, m_arrData[i + j].m_rect.right); - rectGroup.bottom = max(rectGroup.bottom, m_arrData[i + j].m_rect.bottom); - } - - for(j = 0; j < nGroupCount; j++) - { - _AtlDlgResizeData* pDataPrev = NULL; - if(j > 0) - pDataPrev = &(m_arrData[i + j - 1]); - pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i + j], true, pDataPrev); - } - - i += nGroupCount - 1; // increment to skip all group controls - } - else // one control entry - { - RECT rectGroup = { 0, 0, 0, 0 }; - pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i], false); - } - } - - if(bVisible) - pT->SetRedraw(TRUE); - - pT->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - } - -// Message map and handlers - BEGIN_MSG_MAP(CDialogResize) - MESSAGE_HANDLER(WM_SIZE, OnSize) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo) -#endif // _WIN32_WCE - END_MSG_MAP() - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); -#ifndef _WIN32_WCE - if(m_bGripper) - { - ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); - if(wParam == SIZE_MAXIMIZED) - wndGripper.ShowWindow(SW_HIDE); - else if(wParam == SIZE_RESTORED) - wndGripper.ShowWindow(SW_SHOW); - } -#endif // _WIN32_WCE - if(wParam != SIZE_MINIMIZED) - { - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DlgResize_UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - } - return 0; - } - -#ifndef _WIN32_WCE - LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - if(m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) - { - LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; - lpMMI->ptMinTrackSize = m_ptMinTrackSize; - } - return 0; - } -#endif // _WIN32_WCE - -// Implementation - bool DlgResize_PositionControl(int cxWidth, int cyHeight, RECT& rectGroup, _AtlDlgResizeData& data, bool bGroup, - _AtlDlgResizeData* pDataPrev = NULL) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATL::CWindow ctl; - RECT rectCtl = { 0 }; - - ctl = pT->GetDlgItem(data.m_nCtlID); - if(!ctl.GetWindowRect(&rectCtl)) - return false; - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - - if(bGroup) - { - if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) - { - int cxRight = rectGroup.right + cxWidth - m_sizeDialog.cx; - int cxCtl = data.m_rect.right - data.m_rect.left; - rectCtl.left = rectGroup.left + (cxRight - rectGroup.left - cxCtl) / 2; - rectCtl.right = rectCtl.left + cxCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) - { - rectCtl.left = rectGroup.left + ::MulDiv(data.m_rect.left - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); - - if((data.m_dwResizeFlags & DLSZ_SIZE_X) != 0) - { - rectCtl.right = rectGroup.left + ::MulDiv(data.m_rect.right - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); - - if(pDataPrev != NULL) - { - ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); - RECT rcPrev = { 0 }; - ctlPrev.GetWindowRect(&rcPrev); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); - int dxAdjust = (rectCtl.left - rcPrev.right) - (data.m_rect.left - pDataPrev->m_rect.right); - rcPrev.right += dxAdjust; - ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); - } - } - else - { - rectCtl.right = rectCtl.left + (data.m_rect.right - data.m_rect.left); - } - } - - if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) - { - int cyBottom = rectGroup.bottom + cyHeight - m_sizeDialog.cy; - int cyCtl = data.m_rect.bottom - data.m_rect.top; - rectCtl.top = rectGroup.top + (cyBottom - rectGroup.top - cyCtl) / 2; - rectCtl.bottom = rectCtl.top + cyCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) - { - rectCtl.top = rectGroup.top + ::MulDiv(data.m_rect.top - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); - - if((data.m_dwResizeFlags & DLSZ_SIZE_Y) != 0) - { - rectCtl.bottom = rectGroup.top + ::MulDiv(data.m_rect.bottom - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); - - if(pDataPrev != NULL) - { - ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); - RECT rcPrev = { 0 }; - ctlPrev.GetWindowRect(&rcPrev); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); - int dxAdjust = (rectCtl.top - rcPrev.bottom) - (data.m_rect.top - pDataPrev->m_rect.bottom); - rcPrev.bottom += dxAdjust; - ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); - } - } - else - { - rectCtl.bottom = rectCtl.top + (data.m_rect.bottom - data.m_rect.top); - } - } - } - else // no group - { - if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) - { - int cxCtl = data.m_rect.right - data.m_rect.left; - rectCtl.left = (cxWidth - cxCtl) / 2; - rectCtl.right = rectCtl.left + cxCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) - { - rectCtl.right = data.m_rect.right + (cxWidth - m_sizeDialog.cx); - - if((data.m_dwResizeFlags & DLSZ_MOVE_X) != 0) - rectCtl.left = rectCtl.right - (data.m_rect.right - data.m_rect.left); - } - - if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) - { - int cyCtl = data.m_rect.bottom - data.m_rect.top; - rectCtl.top = (cyHeight - cyCtl) / 2; - rectCtl.bottom = rectCtl.top + cyCtl; - } - else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) - { - rectCtl.bottom = data.m_rect.bottom + (cyHeight - m_sizeDialog.cy); - - if((data.m_dwResizeFlags & DLSZ_MOVE_Y) != 0) - rectCtl.top = rectCtl.bottom - (data.m_rect.bottom - data.m_rect.top); - } - } - - if((data.m_dwResizeFlags & DLSZ_REPAINT) != 0) - ctl.Invalidate(); - - if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_SIZE_Y | DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | DLSZ_CENTER_X | DLSZ_CENTER_Y)) != 0) - ctl.SetWindowPos(NULL, &rectCtl, SWP_NOZORDER | SWP_NOACTIVATE); - - return true; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDoubleBufferImpl - Provides double-buffer painting support to any window - -template -class CDoubleBufferImpl -{ -public: -// Overrideables - void DoPaint(CDCHandle /*dc*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } - -// Message map and handlers - BEGIN_MSG_MAP(CDoubleBufferImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background painting needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - if(wParam != NULL) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - CMemoryDC dcMem((HDC)wParam, rect); - pT->DoPaint(dcMem.m_hDC); - } - else - { - CPaintDC dc(pT->m_hWnd); - CMemoryDC dcMem(dc.m_hDC, dc.m_ps.rcPaint); - pT->DoPaint(dcMem.m_hDC); - } - - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CDoubleBufferWindowImpl - Implements a double-buffer painting window - -template -class ATL_NO_VTABLE CDoubleBufferWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CDoubleBufferImpl< T > -{ -public: - BEGIN_MSG_MAP(CDoubleBufferWindowImpl) - CHAIN_MSG_MAP(CDoubleBufferImpl< T >) - END_MSG_MAP() -}; - - -// command bar support -#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - #undef CBRM_GETMENU - #undef CBRM_TRACKPOPUPMENU - #undef CBRM_GETCMDBAR - #undef CBRPOPUPMENU -#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) - -}; // namespace WTL - -#endif // __ATLFRAME_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLFRAME_H__ +#define __ATLFRAME_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlframe.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atlframe.h requires atlwin.h to be included first +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CFrameWindowImpl +// CMDIWindow +// CMDIFrameWindowImpl +// CMDIChildWindowImpl +// COwnerDraw +// CUpdateUIBase +// CUpdateUI +// CDynamicUpdateUI +// CDialogResize +// CDoubleBufferImpl +// CDoubleBufferWindowImpl +// +// Global functions: +// AtlCreateSimpleToolBar() + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CFrameWndClassInfo - Manages frame window Windows class information + +class CFrameWndClassInfo +{ +public: +#ifndef _WIN32_WCE + enum { cchAutoName = 5 + sizeof(void*) * 2 }; // sizeof(void*) * 2 is the number of digits %p outputs + WNDCLASSEX m_wc; +#else // CE specific + enum { cchAutoName = MAX_PATH }; // MAX_PATH because this can be set in the wizard generated CMainFrame::ActivatePreviousInstance to a user defined string. + WNDCLASS m_wc; +#endif // !_WIN32_WCE + LPCTSTR m_lpszOrigName; + WNDPROC pWndProc; + LPCTSTR m_lpszCursorID; + BOOL m_bSystemCursor; + ATOM m_atom; + TCHAR m_szAutoName[cchAutoName]; + UINT m_uCommonResourceID; + +#ifndef _WIN32_WCE + ATOM Register(WNDPROC* pProc) + { + if (m_atom == 0) + { + CWindowCreateCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(m_atom == 0) + { + HINSTANCE hInst = ModuleHelper::GetModuleInstance(); + + if (m_lpszOrigName != NULL) + { + ATLASSERT(pProc != NULL); + LPCTSTR lpsz = m_wc.lpszClassName; + WNDPROC proc = m_wc.lpfnWndProc; + + WNDCLASSEX wc = { 0 }; + wc.cbSize = sizeof(WNDCLASSEX); + // try process local class first + if(!::GetClassInfoEx(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) + { + // try global class + if(!::GetClassInfoEx(NULL, m_lpszOrigName, &wc)) + { + lock.Unlock(); + return 0; + } + } + m_wc = wc; + pWndProc = m_wc.lpfnWndProc; + m_wc.lpszClassName = lpsz; + m_wc.lpfnWndProc = proc; + } + else + { + m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); + } + + m_wc.hInstance = hInst; + m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes + if (m_wc.lpszClassName == NULL) + { +#if (_WIN32_WINNT >= 0x0500) || defined(_WIN64) + SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%p"), &m_wc); +#else // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) + SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); +#endif // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) + m_wc.lpszClassName = m_szAutoName; + } + + WNDCLASSEX wcTemp = m_wc; + m_atom = (ATOM)::GetClassInfoEx(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); + if (m_atom == 0) + { + if(m_uCommonResourceID != 0) // use it if not zero + { + m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); + m_wc.hIconSm = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + } + m_atom = ::RegisterClassEx(&m_wc); + } + } + + lock.Unlock(); + } + + if (m_lpszOrigName != NULL) + { + ATLASSERT(pProc != NULL); + ATLASSERT(pWndProc != NULL); + *pProc = pWndProc; + } + + return m_atom; + } +#else // CE specific + ATOM Register(WNDPROC* pProc) + { + if (m_atom == 0) + { + CWindowCreateCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); + ATLASSERT(FALSE); + return 0; + } + + if(m_atom == 0) + { + HINSTANCE hInst = ModuleHelper::GetModuleInstance(); + + if (m_lpszOrigName != NULL) + { + ATLASSERT(pProc != NULL); + LPCTSTR lpsz = m_wc.lpszClassName; + WNDPROC proc = m_wc.lpfnWndProc; + + WNDCLASS wc = { 0 }; + // try process local class first + if(!::GetClassInfo(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) + { + // try global class + if(!::GetClassInfo(NULL, m_lpszOrigName, &wc)) + { + lock.Unlock(); + return 0; + } + } + m_wc = wc; + pWndProc = m_wc.lpfnWndProc; + m_wc.lpszClassName = lpsz; + m_wc.lpfnWndProc = proc; + } + else + { +#if defined(GWES_CURSOR) || defined(GWES_MCURSOR) + m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); +#else // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) + m_wc.hCursor = NULL; +#endif // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) + } + + m_wc.hInstance = hInst; + m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes + if (m_wc.lpszClassName == NULL) + { + wsprintf(m_szAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); + m_wc.lpszClassName = m_szAutoName; + } + + WNDCLASS wcTemp = m_wc; + m_atom = (ATOM)::GetClassInfo(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); + if (m_atom == 0) + { + if(m_uCommonResourceID != 0) // use it if not zero + m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); + m_atom = ::RegisterClass(&m_wc); + } + } + + lock.Unlock(); + } + + if (m_lpszOrigName != NULL) + { + ATLASSERT(pProc != NULL); + ATLASSERT(pWndProc != NULL); + *pProc = pWndProc; + } + + return m_atom; + } +#endif // _WIN32_WCE +}; + + +/////////////////////////////////////////////////////////////////////////////// +// Macros for declaring frame window WNDCLASS + +#ifndef _WIN32_WCE + +#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ +static WTL::CFrameWndClassInfo& GetWndClassInfo() \ +{ \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { sizeof(WNDCLASSEX), 0, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName, NULL }, \ + NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ +} + +#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ +static WTL::CFrameWndClassInfo& GetWndClassInfo() \ +{ \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { sizeof(WNDCLASSEX), style, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \ + NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ +} + +#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ +static WTL::CFrameWndClassInfo& GetWndClassInfo() \ +{ \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { sizeof(WNDCLASSEX), 0, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \ + OrigWndClassName, NULL, NULL, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ +} + +#else // CE specific + +#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ +static WTL::CFrameWndClassInfo& GetWndClassInfo() \ +{ \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { 0, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ + NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ +} + +#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ +static WTL::CFrameWndClassInfo& GetWndClassInfo() \ +{ \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { style, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ + NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ +} + +#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ +static WTL::CFrameWndClassInfo& GetWndClassInfo() \ +{ \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { NULL, StartWindowProc, \ + 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName }, \ + OrigWndClassName, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ +} + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CFrameWindowImpl + +// Client window command chaining macro (only for frame windows) +#define CHAIN_CLIENT_COMMANDS() \ + if(uMsg == WM_COMMAND && m_hWndClient != NULL) \ + ::SendMessage(m_hWndClient, uMsg, wParam, lParam); + +// standard toolbar styles +#define ATL_SIMPLE_TOOLBAR_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS) +// toolbar in a rebar pane +#define ATL_SIMPLE_TOOLBAR_PANE_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT) +// standard rebar styles +#if (_WIN32_IE >= 0x0400) + #define ATL_SIMPLE_REBAR_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE) +#else + #define ATL_SIMPLE_REBAR_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS) +#endif // !(_WIN32_IE >= 0x0400) +// rebar without borders +#if (_WIN32_IE >= 0x0400) + #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE | CCS_NODIVIDER) +#else + #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ + (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | CCS_NODIVIDER) +#endif // !(_WIN32_IE >= 0x0400) + +// command bar support +#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) + +#define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND +#define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu +#define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu + +struct _AtlFrameWnd_CmdBarPopupMenu +{ + int cbSize; + HMENU hMenu; + UINT uFlags; + int x; + int y; + LPTPMPARAMS lptpm; +}; + +#define CBRPOPUPMENU _AtlFrameWnd_CmdBarPopupMenu + +#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) + + +template +class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, TWinTraits > +{ +public: + DECLARE_FRAME_WND_CLASS(NULL, 0) + +// Data members + HWND m_hWndToolBar; + HWND m_hWndStatusBar; + HWND m_hWndClient; + + HACCEL m_hAccel; + +#ifdef _WIN32_WCE + HWND m_hWndCECommandBar; +#endif // _WIN32_WCE + + struct _AtlToolBarData + { + WORD wVersion; + WORD wWidth; + WORD wHeight; + WORD wItemCount; + //WORD aItems[wItemCount] + + WORD* items() + { return (WORD*)(this+1); } + }; + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + struct _ChevronMenuInfo + { + HMENU hMenu; + LPNMREBARCHEVRON lpnm; + bool bCmdBar; + }; +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + +// Constructor + CFrameWindowImplBase() : +#ifdef _WIN32_WCE + m_hWndCECommandBar(NULL), +#endif // _WIN32_WCE + m_hWndToolBar(NULL), + m_hWndStatusBar(NULL), + m_hWndClient(NULL), + m_hAccel(NULL) + { } + +// Methods + HWND Create(HWND hWndParent, ATL::_U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, ATL::_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam) + { + ATLASSERT(m_hWnd == NULL); + + if(atom == 0) + return NULL; + + ModuleHelper::AddCreateWndData(&m_thunk.cd, this); + + if(MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD)) + MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this; + if(rect.m_lpRect == NULL) + rect.m_lpRect = &TBase::rcDefault; + + HWND hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, + dwStyle, rect.m_lpRect->left, rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, + rect.m_lpRect->bottom - rect.m_lpRect->top, hWndParent, MenuOrID.m_hMenu, + ModuleHelper::GetModuleInstance(), lpCreateParam); + + ATLASSERT(hWnd == NULL || m_hWnd == hWnd); + + return hWnd; + } + + static HWND CreateSimpleToolBarCtrl(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, + DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + HINSTANCE hInst = ModuleHelper::GetResourceInstance(); + HRSRC hRsrc = ::FindResource(hInst, MAKEINTRESOURCE(nResourceID), RT_TOOLBAR); + if (hRsrc == NULL) + return NULL; + + HGLOBAL hGlobal = ::LoadResource(hInst, hRsrc); + if (hGlobal == NULL) + return NULL; + + _AtlToolBarData* pData = (_AtlToolBarData*)::LockResource(hGlobal); + if (pData == NULL) + return NULL; + ATLASSERT(pData->wVersion == 1); + + WORD* pItems = pData->items(); + int nItems = pData->wItemCount + (bInitialSeparator ? 1 : 0); + CTempBuffer buff; + TBBUTTON* pTBBtn = buff.Allocate(nItems); + ATLASSERT(pTBBtn != NULL); + if(pTBBtn == NULL) + return NULL; + + const int cxSeparator = 8; + + // set initial separator (half width) + if(bInitialSeparator) + { + pTBBtn[0].iBitmap = cxSeparator / 2; + pTBBtn[0].idCommand = 0; + pTBBtn[0].fsState = 0; + pTBBtn[0].fsStyle = TBSTYLE_SEP; + pTBBtn[0].dwData = 0; + pTBBtn[0].iString = 0; + } + + int nBmp = 0; + for(int i = 0, j = bInitialSeparator ? 1 : 0; i < pData->wItemCount; i++, j++) + { + if(pItems[i] != 0) + { + pTBBtn[j].iBitmap = nBmp++; + pTBBtn[j].idCommand = pItems[i]; + pTBBtn[j].fsState = TBSTATE_ENABLED; + pTBBtn[j].fsStyle = TBSTYLE_BUTTON; + pTBBtn[j].dwData = 0; + pTBBtn[j].iString = 0; + } + else + { + pTBBtn[j].iBitmap = cxSeparator; + pTBBtn[j].idCommand = 0; + pTBBtn[j].fsState = 0; + pTBBtn[j].fsStyle = TBSTYLE_SEP; + pTBBtn[j].dwData = 0; + pTBBtn[j].iString = 0; + } + } + +#ifndef _WIN32_WCE + HWND hWnd = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); + if(hWnd == NULL) + { + ATLASSERT(FALSE); + return NULL; + } +#else // CE specific + dwStyle; + nID; + // The toolbar must go onto the existing CommandBar or MenuBar + HWND hWnd = hWndParent; +#endif // _WIN32_WCE + + ::SendMessage(hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0L); + + // check if font is taller than our bitmaps + CFontHandle font = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); + if(font.IsNull()) + font = AtlGetDefaultGuiFont(); + LOGFONT lf = { 0 }; + font.GetLogFont(lf); + WORD cyFontHeight = (WORD)abs(lf.lfHeight); + +#ifndef _WIN32_WCE + WORD bitsPerPixel = AtlGetBitmapResourceBitsPerPixel(nResourceID); + if(bitsPerPixel > 4) + { + COLORREF crMask = CLR_DEFAULT; + if(bitsPerPixel == 32) + { + // 32-bit color bitmap with alpha channel (valid for Windows XP and later) + crMask = CLR_NONE; + } + HIMAGELIST hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nResourceID), pData->wWidth, 1, crMask, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); + ATLASSERT(hImageList != NULL); + ::SendMessage(hWnd, TB_SETIMAGELIST, 0, (LPARAM)hImageList); + } + else +#endif // !_WIN32_WCE + { + TBADDBITMAP tbab = { 0 }; + tbab.hInst = hInst; + tbab.nID = nResourceID; + ::SendMessage(hWnd, TB_ADDBITMAP, nBmp, (LPARAM)&tbab); + } + + ::SendMessage(hWnd, TB_ADDBUTTONS, nItems, (LPARAM)pTBBtn); + ::SendMessage(hWnd, TB_SETBITMAPSIZE, 0, MAKELONG(pData->wWidth, max(pData->wHeight, cyFontHeight))); + const int cxyButtonMargin = 7; + ::SendMessage(hWnd, TB_SETBUTTONSIZE, 0, MAKELONG(pData->wWidth + cxyButtonMargin, max(pData->wHeight, cyFontHeight) + cxyButtonMargin)); + + return hWnd; + } + +#ifndef _WIN32_WCE + static HWND CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + // Ensure style combinations for proper rebar painting + if(dwStyle & CCS_NODIVIDER && dwStyle & WS_BORDER) + dwStyle &= ~WS_BORDER; + else if(!(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER)) + dwStyle |= CCS_NODIVIDER; + + // Create rebar window + HWND hWndReBar = ::CreateWindowEx(0, REBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); + if(hWndReBar == NULL) + { + ATLTRACE2(atlTraceUI, 0, _T("Failed to create rebar.\n")); + return NULL; + } + + // Initialize and send the REBARINFO structure + REBARINFO rbi = { 0 }; + rbi.cbSize = sizeof(REBARINFO); + rbi.fMask = 0; + if(!::SendMessage(hWndReBar, RB_SETBARINFO, 0, (LPARAM)&rbi)) + { + ATLTRACE2(atlTraceUI, 0, _T("Failed to initialize rebar.\n")); + ::DestroyWindow(hWndReBar); + return NULL; + } + + return hWndReBar; + } + + BOOL CreateSimpleReBar(DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + ATLASSERT(!::IsWindow(m_hWndToolBar)); + m_hWndToolBar = CreateSimpleReBarCtrl(m_hWnd, dwStyle, nID); + return (m_hWndToolBar != NULL); + } + + static BOOL AddSimpleReBarBandCtrl(HWND hWndReBar, HWND hWndBand, int nID = 0, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) + { + ATLASSERT(::IsWindow(hWndReBar)); // must be already created +#ifdef _DEBUG + // block - check if this is really a rebar + { + TCHAR lpszClassName[sizeof(REBARCLASSNAME)] = { 0 }; + ::GetClassName(hWndReBar, lpszClassName, sizeof(REBARCLASSNAME)); + ATLASSERT(lstrcmp(lpszClassName, REBARCLASSNAME) == 0); + } +#endif // _DEBUG + ATLASSERT(::IsWindow(hWndBand)); // must be already created + + // Get number of buttons on the toolbar + int nBtnCount = (int)::SendMessage(hWndBand, TB_BUTTONCOUNT, 0, 0L); + + // Set band info structure + REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; +#if (_WIN32_IE >= 0x0400) + rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE | RBBIM_IDEALSIZE; +#else + rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE; +#endif // !(_WIN32_IE >= 0x0400) + if(lpstrTitle != NULL) + rbBand.fMask |= RBBIM_TEXT; + rbBand.fStyle = RBBS_CHILDEDGE; +#if (_WIN32_IE >= 0x0500) + if(nBtnCount > 0) // add chevron style for toolbar with buttons + rbBand.fStyle |= RBBS_USECHEVRON; +#endif // (_WIN32_IE >= 0x0500) + if(bNewRow) + rbBand.fStyle |= RBBS_BREAK; + + rbBand.lpText = (LPTSTR)lpstrTitle; + rbBand.hwndChild = hWndBand; + if(nID == 0) // calc band ID + nID = ATL_IDW_BAND_FIRST + (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); + rbBand.wID = nID; + + // Calculate the size of the band + BOOL bRet = FALSE; + RECT rcTmp = { 0 }; + if(nBtnCount > 0) + { + bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, nBtnCount - 1, (LPARAM)&rcTmp); + ATLASSERT(bRet); + rbBand.cx = (cxWidth != 0) ? cxWidth : rcTmp.right; + rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; + if(bFullWidthAlways) + { + rbBand.cxMinChild = rbBand.cx; + } + else if(lpstrTitle == NULL) + { + bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, 0, (LPARAM)&rcTmp); + ATLASSERT(bRet); + rbBand.cxMinChild = rcTmp.right; + } + else + { + rbBand.cxMinChild = 0; + } + } + else // no buttons, either not a toolbar or really has no buttons + { + bRet = ::GetWindowRect(hWndBand, &rcTmp); + ATLASSERT(bRet); + rbBand.cx = (cxWidth != 0) ? cxWidth : (rcTmp.right - rcTmp.left); + rbBand.cxMinChild = bFullWidthAlways ? rbBand.cx : 0; + rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; + } + +#if (_WIN32_IE >= 0x0400) + rbBand.cxIdeal = rbBand.cx; +#endif // (_WIN32_IE >= 0x0400) + + // Add the band + LRESULT lRes = ::SendMessage(hWndReBar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); + if(lRes == 0) + { + ATLTRACE2(atlTraceUI, 0, _T("Failed to add a band to the rebar.\n")); + return FALSE; + } + +#if (_WIN32_IE >= 0x0501) + DWORD dwExStyle = (DWORD)::SendMessage(hWndBand, TB_GETEXTENDEDSTYLE, 0, 0L); + ::SendMessage(hWndBand, TB_SETEXTENDEDSTYLE, 0, dwExStyle | TBSTYLE_EX_HIDECLIPPEDBUTTONS); +#endif // (_WIN32_IE >= 0x0501) + + return TRUE; + } + + BOOL AddSimpleReBarBand(HWND hWndBand, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) + { + ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar + ATLASSERT(::IsWindow(hWndBand)); // must be created + return AddSimpleReBarBandCtrl(m_hWndToolBar, hWndBand, 0, lpstrTitle, bNewRow, cxWidth, bFullWidthAlways); + } + +#if (_WIN32_IE >= 0x0400) + void SizeSimpleReBarBands() + { + ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar + + int nCount = (int)::SendMessage(m_hWndToolBar, RB_GETBANDCOUNT, 0, 0L); + + for(int i = 0; i < nCount; i++) + { + REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; + rbBand.fMask = RBBIM_SIZE; + BOOL bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_GETBANDINFO, i, (LPARAM)&rbBand); + ATLASSERT(bRet); + RECT rect = { 0, 0, 0, 0 }; + ::SendMessage(m_hWndToolBar, RB_GETBANDBORDERS, i, (LPARAM)&rect); + rbBand.cx += rect.left + rect.right; + bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_SETBANDINFO, i, (LPARAM)&rbBand); + ATLASSERT(bRet); + } + } +#endif // (_WIN32_IE >= 0x0400) +#endif // _WIN32_WCE + +#ifndef _WIN32_WCE + BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) +#else // CE specific + BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) +#endif // _WIN32_WCE + { + ATLASSERT(!::IsWindow(m_hWndStatusBar)); + m_hWndStatusBar = ::CreateStatusWindow(dwStyle, lpstrText, m_hWnd, nID); + return (m_hWndStatusBar != NULL); + } + +#ifndef _WIN32_WCE + BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) +#else // CE specific + BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) +#endif // _WIN32_WCE + { + const int cchMax = 128; // max text length is 127 for status bars (+1 for null) + TCHAR szText[cchMax]; + szText[0] = 0; + ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); + return CreateSimpleStatusBar(szText, dwStyle, nID); + } + +#ifdef _WIN32_WCE + BOOL CreateSimpleCECommandBar(LPTSTR pszMenu = NULL, WORD iButton = 0, DWORD dwFlags = 0, int nCmdBarID = 1) + { + ATLASSERT(m_hWndCECommandBar == NULL); + ATLASSERT(m_hWndToolBar == NULL); + + m_hWndCECommandBar = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), m_hWnd, nCmdBarID); + if(m_hWndCECommandBar == NULL) + return FALSE; + + m_hWndToolBar = m_hWndCECommandBar; + + BOOL bRet = TRUE; + + if(pszMenu != NULL) + bRet &= ::CommandBar_InsertMenubarEx(m_hWndCECommandBar, IS_INTRESOURCE(pszMenu) ? ModuleHelper::GetResourceInstance() : NULL, pszMenu, iButton); + + bRet &= ::CommandBar_AddAdornments(m_hWndCECommandBar, dwFlags, 0); + + return bRet; + } + +#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) + BOOL CreateSimpleCEMenuBar(UINT nToolBarId = ATL_IDW_MENU_BAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0) + { + ATLASSERT(m_hWndCECommandBar == NULL); + + SHMENUBARINFO mbi = { 0 }; + mbi.cbSize = sizeof(mbi); + mbi.hwndParent = m_hWnd; + mbi.dwFlags = dwFlags; + mbi.nToolBarId = nToolBarId; + mbi.hInstRes = ModuleHelper::GetResourceInstance(); + mbi.nBmpId = nBmpId; + mbi.cBmpImages = cBmpImages; + mbi.hwndMB = NULL; // This gets set by SHCreateMenuBar + + BOOL bRet = ::SHCreateMenuBar(&mbi); + if(bRet != FALSE) + { + m_hWndCECommandBar = mbi.hwndMB; + SizeToMenuBar(); + } + + return bRet; + } + + void SizeToMenuBar() // for menu bar only + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(m_hWndCECommandBar)); + + RECT rect = { 0 }; + GetWindowRect(&rect); + RECT rectMB = { 0 }; + ::GetWindowRect(m_hWndCECommandBar, &rectMB); + int cy = ::IsWindowVisible(m_hWndCECommandBar) ? rectMB.top - rect.top : rectMB.bottom - rect.top; + SetWindowPos(NULL, 0, 0, rect.right - rect.left, cy, SWP_NOZORDER | SWP_NOMOVE); + } +#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) +#endif // _WIN32_WCE + + void UpdateLayout(BOOL bResizeBars = TRUE) + { + RECT rect = { 0 }; + GetClientRect(&rect); + + // position bars and offset their dimensions + UpdateBarsPosition(rect, bResizeBars); + + // resize client window + if(m_hWndClient != NULL) + ::SetWindowPos(m_hWndClient, NULL, rect.left, rect.top, + rect.right - rect.left, rect.bottom - rect.top, + SWP_NOZORDER | SWP_NOACTIVATE); + } + + void UpdateBarsPosition(RECT& rect, BOOL bResizeBars = TRUE) + { + // resize toolbar + if(m_hWndToolBar != NULL && ((DWORD)::GetWindowLong(m_hWndToolBar, GWL_STYLE) & WS_VISIBLE)) + { + if(bResizeBars) + { + ::SendMessage(m_hWndToolBar, WM_SIZE, 0, 0); + ::InvalidateRect(m_hWndToolBar, NULL, FALSE); + } + RECT rectTB = { 0 }; + ::GetWindowRect(m_hWndToolBar, &rectTB); + rect.top += rectTB.bottom - rectTB.top; + } + + // resize status bar + if(m_hWndStatusBar != NULL && ((DWORD)::GetWindowLong(m_hWndStatusBar, GWL_STYLE) & WS_VISIBLE)) + { + if(bResizeBars) + ::SendMessage(m_hWndStatusBar, WM_SIZE, 0, 0); + RECT rectSB = { 0 }; + ::GetWindowRect(m_hWndStatusBar, &rectSB); + rect.bottom -= rectSB.bottom - rectSB.top; + } + } + + BOOL PreTranslateMessage(MSG* pMsg) + { + if(m_hAccel != NULL && ::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) + return TRUE; + return FALSE; + } + + BEGIN_MSG_MAP(CFrameWindowImplBase) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) +#endif // !_WIN32_WCE + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) +#ifndef _WIN32_WCE + NOTIFY_CODE_HANDLER(TTN_GETDISPINFOA, OnToolTipTextA) + NOTIFY_CODE_HANDLER(TTN_GETDISPINFOW, OnToolTipTextW) +#endif // !_WIN32_WCE + END_MSG_MAP() + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_hWndClient != NULL) // view will paint itself instead + return 1; + + bHandled = FALSE; + return 0; + } + +#ifndef _WIN32_WCE + LRESULT OnMenuSelect(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + bHandled = FALSE; + + if(m_hWndStatusBar == NULL) + return 1; + + WORD wFlags = HIWORD(wParam); + if(wFlags == 0xFFFF && lParam == NULL) // menu closing + { + ::SendMessage(m_hWndStatusBar, SB_SIMPLE, FALSE, 0L); + } + else + { + const int cchBuff = 256; + TCHAR szBuff[cchBuff]; + szBuff[0] = 0; + if(!(wFlags & MF_POPUP)) + { + WORD wID = LOWORD(wParam); + // check for special cases + if(wID >= 0xF000 && wID < 0xF1F0) // system menu IDs + wID = (WORD)(((wID - 0xF000) >> 4) + ATL_IDS_SCFIRST); + else if(wID >= ID_FILE_MRU_FIRST && wID <= ID_FILE_MRU_LAST) // MRU items + wID = ATL_IDS_MRU_FILE; + else if(wID >= ATL_IDM_FIRST_MDICHILD && wID <= ATL_IDM_LAST_MDICHILD) // MDI child windows + wID = ATL_IDS_MDICHILD; + + int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), wID, szBuff, cchBuff); + for(int i = 0; i < nRet; i++) + { + if(szBuff[i] == _T('\n')) + { + szBuff[i] = 0; + break; + } + } + } + ::SendMessage(m_hWndStatusBar, SB_SIMPLE, TRUE, 0L); + ::SendMessage(m_hWndStatusBar, SB_SETTEXT, (255 | SBT_NOBORDERS), (LPARAM)szBuff); + } + + return 1; + } +#endif // !_WIN32_WCE + + LRESULT OnSetFocus(UINT, WPARAM, LPARAM, BOOL& bHandled) + { + if(m_hWndClient != NULL) + ::SetFocus(m_hWndClient); + + bHandled = FALSE; + return 1; + } + + LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL& bHandled) + { + if((GetStyle() & (WS_CHILD | WS_POPUP)) == 0) + ::PostQuitMessage(1); + + bHandled = FALSE; + return 1; + } + +#ifndef _WIN32_WCE + LRESULT OnToolTipTextA(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + LPNMTTDISPINFOA pDispInfo = (LPNMTTDISPINFOA)pnmh; + pDispInfo->szText[0] = 0; + + if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) + { + const int cchBuff = 256; + char szBuff[cchBuff]; + szBuff[0] = 0; + int nRet = ::LoadStringA(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); + for(int i = 0; i < nRet; i++) + { + if(szBuff[i] == '\n') + { + SecureHelper::strncpyA_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); + break; + } + } +#if (_WIN32_IE >= 0x0300) + if(nRet > 0) // string was loaded, save it + pDispInfo->uFlags |= TTF_DI_SETITEM; +#endif // (_WIN32_IE >= 0x0300) + } + + return 0; + } + + LRESULT OnToolTipTextW(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) + { + LPNMTTDISPINFOW pDispInfo = (LPNMTTDISPINFOW)pnmh; + pDispInfo->szText[0] = 0; + + if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) + { + const int cchBuff = 256; + wchar_t szBuff[cchBuff]; + szBuff[0] = 0; + int nRet = ::LoadStringW(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); + for(int i = 0; i < nRet; i++) + { + if(szBuff[i] == L'\n') + { + SecureHelper::strncpyW_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); + break; + } + } +#if (_WIN32_IE >= 0x0300) + if(nRet > 0) // string was loaded, save it + pDispInfo->uFlags |= TTF_DI_SETITEM; +#endif // (_WIN32_IE >= 0x0300) + } + + return 0; + } +#endif // !_WIN32_WCE + +// Implementation - chevron menu support +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + bool PrepareChevronMenu(_ChevronMenuInfo& cmi) + { + // get rebar and toolbar + REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; + rbbi.fMask = RBBIM_CHILD; + BOOL bRet = (BOOL)::SendMessage(cmi.lpnm->hdr.hwndFrom, RB_GETBANDINFO, cmi.lpnm->uBand, (LPARAM)&rbbi); + ATLASSERT(bRet); + + // assume the band is a toolbar + ATL::CWindow wnd = rbbi.hwndChild; + int nCount = (int)wnd.SendMessage(TB_BUTTONCOUNT); + if(nCount <= 0) // probably not a toolbar + return false; + + // check if it's a command bar + CMenuHandle menuCmdBar = (HMENU)wnd.SendMessage(CBRM_GETMENU); + cmi.bCmdBar = (menuCmdBar.m_hMenu != NULL); + + // build a menu from hidden items + CMenuHandle menu; + bRet = menu.CreatePopupMenu(); + ATLASSERT(bRet); + RECT rcClient = { 0 }; + bRet = wnd.GetClientRect(&rcClient); + ATLASSERT(bRet); + for(int i = 0; i < nCount; i++) + { + TBBUTTON tbb = { 0 }; + bRet = (BOOL)wnd.SendMessage(TB_GETBUTTON, i, (LPARAM)&tbb); + ATLASSERT(bRet); + // skip hidden buttons + if((tbb.fsState & TBSTATE_HIDDEN) != 0) + continue; + RECT rcButton = { 0 }; + bRet = (BOOL)wnd.SendMessage(TB_GETITEMRECT, i, (LPARAM)&rcButton); + ATLASSERT(bRet); + bool bEnabled = ((tbb.fsState & TBSTATE_ENABLED) != 0); + if(rcButton.right > rcClient.right) + { + if(tbb.fsStyle & BTNS_SEP) + { + if(menu.GetMenuItemCount() > 0) + menu.AppendMenu(MF_SEPARATOR); + } + else if(cmi.bCmdBar) + { + const int cchBuff = 200; + TCHAR szBuff[cchBuff] = { 0 }; + CMenuItemInfo mii; + mii.fMask = MIIM_TYPE | MIIM_SUBMENU; + mii.dwTypeData = szBuff; + mii.cch = cchBuff; + bRet = menuCmdBar.GetMenuItemInfo(i, TRUE, &mii); + ATLASSERT(bRet); + // Note: CmdBar currently supports only drop-down items + ATLASSERT(::IsMenu(mii.hSubMenu)); + bRet = menu.AppendMenu(MF_STRING | MF_POPUP | (bEnabled ? MF_ENABLED : MF_GRAYED), (UINT_PTR)mii.hSubMenu, mii.dwTypeData); + ATLASSERT(bRet); + } + else + { + // get button's text + const int cchBuff = 200; + TCHAR szBuff[cchBuff] = { 0 }; + LPTSTR lpstrText = szBuff; + TBBUTTONINFO tbbi = { 0 }; + tbbi.cbSize = sizeof(TBBUTTONINFO); + tbbi.dwMask = TBIF_TEXT; + tbbi.pszText = szBuff; + tbbi.cchText = cchBuff; + if(wnd.SendMessage(TB_GETBUTTONINFO, tbb.idCommand, (LPARAM)&tbbi) == -1 || lstrlen(szBuff) == 0) + { + // no text for this button, try a resource string + lpstrText = _T(""); + int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), tbb.idCommand, szBuff, cchBuff); + for(int n = 0; n < nRet; n++) + { + if(szBuff[n] == _T('\n')) + { + lpstrText = &szBuff[n + 1]; + break; + } + } + } + bRet = menu.AppendMenu(MF_STRING | (bEnabled ? MF_ENABLED : MF_GRAYED), tbb.idCommand, lpstrText); + ATLASSERT(bRet); + } + } + } + + if(menu.GetMenuItemCount() == 0) // no hidden buttons after all + { + menu.DestroyMenu(); + ::MessageBeep((UINT)-1); + return false; + } + + cmi.hMenu = menu; + return true; + } + + void DisplayChevronMenu(_ChevronMenuInfo& cmi) + { +#ifndef TPM_VERPOSANIMATION + const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag +#endif + // convert chevron rect to screen coordinates + ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; + POINT pt = { cmi.lpnm->rc.left, cmi.lpnm->rc.bottom }; + wndFrom.MapWindowPoints(NULL, &pt, 1); + RECT rc = cmi.lpnm->rc; + wndFrom.MapWindowPoints(NULL, &rc); + // set up flags and rect + UINT uMenuFlags = TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | (!AtlIsOldWindows() ? TPM_VERPOSANIMATION : 0); + TPMPARAMS TPMParams = { 0 }; + TPMParams.cbSize = sizeof(TPMPARAMS); + TPMParams.rcExclude = rc; + // check if this window has a command bar + HWND hWndCmdBar = (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); + if(::IsWindow(hWndCmdBar)) + { + CBRPOPUPMENU CBRPopupMenu = { sizeof(CBRPOPUPMENU), cmi.hMenu, uMenuFlags, pt.x, pt.y, &TPMParams }; + ::SendMessage(hWndCmdBar, CBRM_TRACKPOPUPMENU, 0, (LPARAM)&CBRPopupMenu); + } + else + { + CMenuHandle menu = cmi.hMenu; + menu.TrackPopupMenuEx(uMenuFlags, pt.x, pt.y, m_hWnd, &TPMParams); + } + } + + void CleanupChevronMenu(_ChevronMenuInfo& cmi) + { + CMenuHandle menu = cmi.hMenu; + // if menu is from a command bar, detach submenus so they are not destroyed + if(cmi.bCmdBar) + { + for(int i = menu.GetMenuItemCount() - 1; i >=0; i--) + menu.RemoveMenu(i, MF_BYPOSITION); + } + // destroy menu + menu.DestroyMenu(); + // convert chevron rect to screen coordinates + ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; + RECT rc = cmi.lpnm->rc; + wndFrom.MapWindowPoints(NULL, &rc); + // eat next message if click is on the same button + MSG msg = { 0 }; + if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rc, msg.pt)) + ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) +}; + + +template +class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinTraits > +{ +public: + HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) + { + ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); + + dwStyle = T::GetWndStyle(dwStyle); + dwExStyle = T::GetWndExStyle(dwExStyle); + + if(rect.m_lpRect == NULL) + rect.m_lpRect = &TBase::rcDefault; + + return CFrameWindowImplBase< TBase, TWinTraits >::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); + } + + HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) + { + const int cchName = 256; + TCHAR szWindowName[cchName]; + szWindowName[0] = 0; +#ifndef _WIN32_WCE + ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); + HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); +#else // CE specific + ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); + + // This always needs to be NULL for Windows CE. + // Frame Window menus have to go onto the CommandBar. + // Use CreateSimpleCECommandBar + HMENU hMenu = NULL; +#endif // _WIN32_WCE + + T* pT = static_cast(this); + HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); + + if(hWnd != NULL) + m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); + + return hWnd; + } + + BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + if(nResourceID == 0) + nResourceID = T::GetWndClassInfo().m_uCommonResourceID; +#ifndef _WIN32_WCE + ATLASSERT(!::IsWindow(m_hWndToolBar)); + m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); + return (m_hWndToolBar != NULL); +#else // CE specific + HWND hWnd= T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); + return (hWnd != NULL); +#endif // _WIN32_WCE + } + +#ifdef _WIN32_WCE + // CE specific variant that returns the handle of the toolbar + HWND CreateSimpleCEToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + if(nResourceID == 0) + nResourceID = T::GetWndClassInfo().m_uCommonResourceID; + + return T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); + } +#endif // _WIN32_WCE + +// message map and handlers + typedef CFrameWindowImplBase< TBase, TWinTraits > _baseClass; + + BEGIN_MSG_MAP(CFrameWindowImpl) + MESSAGE_HANDLER(WM_SIZE, OnSize) +#ifndef _ATL_NO_REBAR_SUPPORT +#if (_WIN32_IE >= 0x0400) + NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) +#endif // (_WIN32_IE >= 0x0400) +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) +#endif // !_ATL_NO_REBAR_SUPPORT + CHAIN_MSG_MAP(_baseClass) + END_MSG_MAP() + + LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(wParam != SIZE_MINIMIZED) + { + T* pT = static_cast(this); + pT->UpdateLayout(); + } + bHandled = FALSE; + return 1; + } + +#ifndef _ATL_NO_REBAR_SUPPORT +#if (_WIN32_IE >= 0x0400) + LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->UpdateLayout(FALSE); + return 0; + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) + LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + T* pT = static_cast(this); + _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; + if(!pT->PrepareChevronMenu(cmi)) + { + bHandled = FALSE; + return 1; + } + // display a popup menu with hidden items + pT->DisplayChevronMenu(cmi); + // cleanup + pT->CleanupChevronMenu(cmi); + return 0; + } +#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) +#endif // !_ATL_NO_REBAR_SUPPORT +}; + + +/////////////////////////////////////////////////////////////////////////////// +// AtlCreateSimpleToolBar - helper for creating simple toolbars + +#ifndef _WIN32_WCE + +inline HWND AtlCreateSimpleToolBar(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, + DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) +{ + return CFrameWindowImplBase<>::CreateSimpleToolBarCtrl(hWndParent, nResourceID, bInitialSeparator, dwStyle, nID); +} + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CMDIWindow + +#ifndef _WIN32_WCE + +#ifndef _WTL_MDIWINDOWMENU_TEXT +#define _WTL_MDIWINDOWMENU_TEXT _T("&Window") +#endif + +class CMDIWindow : public ATL::CWindow +{ +public: +// Data members + HWND m_hWndMDIClient; + HMENU m_hMenu; + +// Constructors + CMDIWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd), m_hWndMDIClient(NULL), m_hMenu(NULL) + { } + + CMDIWindow& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// Operations + HWND MDIGetActive(BOOL* lpbMaximized = NULL) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + return (HWND)::SendMessage(m_hWndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)lpbMaximized); + } + + void MDIActivate(HWND hWndChildToActivate) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + ATLASSERT(::IsWindow(hWndChildToActivate)); + ::SendMessage(m_hWndMDIClient, WM_MDIACTIVATE, (WPARAM)hWndChildToActivate, 0); + } + + void MDINext(HWND hWndChild, BOOL bPrevious = FALSE) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + ATLASSERT(hWndChild == NULL || ::IsWindow(hWndChild)); + ::SendMessage(m_hWndMDIClient, WM_MDINEXT, (WPARAM)hWndChild, (LPARAM)bPrevious); + } + + void MDIMaximize(HWND hWndChildToMaximize) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + ATLASSERT(::IsWindow(hWndChildToMaximize)); + ::SendMessage(m_hWndMDIClient, WM_MDIMAXIMIZE, (WPARAM)hWndChildToMaximize, 0); + } + + void MDIRestore(HWND hWndChildToRestore) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + ATLASSERT(::IsWindow(hWndChildToRestore)); + ::SendMessage(m_hWndMDIClient, WM_MDIRESTORE, (WPARAM)hWndChildToRestore, 0); + } + + void MDIDestroy(HWND hWndChildToDestroy) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + ATLASSERT(::IsWindow(hWndChildToDestroy)); + ::SendMessage(m_hWndMDIClient, WM_MDIDESTROY, (WPARAM)hWndChildToDestroy, 0); + } + + BOOL MDICascade(UINT uFlags = 0) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDICASCADE, (WPARAM)uFlags, 0); + } + + BOOL MDITile(UINT uFlags = MDITILE_HORIZONTAL) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDITILE, (WPARAM)uFlags, 0); + } + + void MDIIconArrange() + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + ::SendMessage(m_hWndMDIClient, WM_MDIICONARRANGE, 0, 0); + } + + HMENU MDISetMenu(HMENU hMenuFrame, HMENU hMenuWindow) + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDISETMENU, (WPARAM)hMenuFrame, (LPARAM)hMenuWindow); + } + + HMENU MDIRefreshMenu() + { + ATLASSERT(::IsWindow(m_hWndMDIClient)); + return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0); + } + +// Additional operations + static HMENU GetStandardWindowMenu(HMENU hMenu) + { + int nCount = ::GetMenuItemCount(hMenu); + if(nCount == -1) + return NULL; + int nLen = ::GetMenuString(hMenu, nCount - 2, NULL, 0, MF_BYPOSITION); + if(nLen == 0) + return NULL; + CTempBuffer buff; + LPTSTR lpszText = buff.Allocate(nLen + 1); + if(lpszText == NULL) + return NULL; + if(::GetMenuString(hMenu, nCount - 2, lpszText, nLen + 1, MF_BYPOSITION) != nLen) + return NULL; + if(lstrcmp(lpszText, _WTL_MDIWINDOWMENU_TEXT) != 0) + return NULL; + return ::GetSubMenu(hMenu, nCount - 2); + } + + void SetMDIFrameMenu() + { + HMENU hWindowMenu = GetStandardWindowMenu(m_hMenu); + MDISetMenu(m_hMenu, hWindowMenu); + MDIRefreshMenu(); + ::DrawMenuBar(GetMDIFrame()); + } + + HWND GetMDIFrame() const + { + return ::GetParent(m_hWndMDIClient); + } +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CMDIFrameWindowImpl + +#ifndef _WIN32_WCE + +// MDI child command chaining macro (only for MDI frame windows) +#define CHAIN_MDI_CHILD_COMMANDS() \ + if(uMsg == WM_COMMAND) \ + { \ + HWND hWndChild = MDIGetActive(); \ + if(hWndChild != NULL) \ + ::SendMessage(hWndChild, uMsg, wParam, lParam); \ + } + +template +class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBase +{ +public: + HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) + { + m_hMenu = hMenu; + ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); + + dwStyle = T::GetWndStyle(dwStyle); + dwExStyle = T::GetWndExStyle(dwExStyle); + + if(rect.m_lpRect == NULL) + rect.m_lpRect = &TBase::rcDefault; + + return CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); + } + + HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) + { + const int cchName = 256; + TCHAR szWindowName[cchName]; + szWindowName[0] = 0; + ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); + HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); + + T* pT = static_cast(this); + HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); + + if(hWnd != NULL) + m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); + + return hWnd; + } + + BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + ATLASSERT(!::IsWindow(m_hWndToolBar)); + if(nResourceID == 0) + nResourceID = T::GetWndClassInfo().m_uCommonResourceID; + m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); + return (m_hWndToolBar != NULL); + } + + virtual WNDPROC GetWindowProc() + { + return MDIFrameWindowProc; + } + + static LRESULT CALLBACK MDIFrameWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + CMDIFrameWindowImpl< T, TBase, TWinTraits >* pThis = (CMDIFrameWindowImpl< T, TBase, TWinTraits >*)hWnd; + // set a ptr to this message and save the old value +#if (_ATL_VER >= 0x0700) + ATL::_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam); + const ATL::_ATL_MSG* pOldMsg = pThis->m_pCurrentMsg; +#else // !(_ATL_VER >= 0x0700) + MSG msg = { pThis->m_hWnd, uMsg, wParam, lParam, 0, { 0, 0 } }; + const MSG* pOldMsg = pThis->m_pCurrentMsg; +#endif // !(_ATL_VER >= 0x0700) + pThis->m_pCurrentMsg = &msg; + // pass to the message map to process + LRESULT lRes = 0; + BOOL bRet = pThis->ProcessWindowMessage(pThis->m_hWnd, uMsg, wParam, lParam, lRes, 0); + // restore saved value for the current message + ATLASSERT(pThis->m_pCurrentMsg == &msg); + pThis->m_pCurrentMsg = pOldMsg; + // do the default processing if message was not handled + if(!bRet) + { + if(uMsg != WM_NCDESTROY) + lRes = pThis->DefWindowProc(uMsg, wParam, lParam); + else + { + // unsubclass, if needed + LONG_PTR pfnWndProc = ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC); + lRes = pThis->DefWindowProc(uMsg, wParam, lParam); + if(pThis->m_pfnSuperWindowProc != ::DefWindowProc && ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc) + ::SetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc); +#if (_ATL_VER >= 0x0700) + // mark window as destryed + pThis->m_dwState |= WINSTATE_DESTROYED; +#else // !(_ATL_VER >= 0x0700) + // clear out window handle + HWND hWnd = pThis->m_hWnd; + pThis->m_hWnd = NULL; + // clean up after window is destroyed + pThis->OnFinalMessage(hWnd); +#endif // !(_ATL_VER >= 0x0700) + } + } +#if (_ATL_VER >= 0x0700) + if(pThis->m_dwState & WINSTATE_DESTROYED && pThis->m_pCurrentMsg == NULL) + { + // clear out window handle + HWND hWnd = pThis->m_hWnd; + pThis->m_hWnd = NULL; + pThis->m_dwState &= ~WINSTATE_DESTROYED; + // clean up after window is destroyed + pThis->OnFinalMessage(hWnd); + } +#endif // (_ATL_VER >= 0x0700) + return lRes; + } + + // Overriden to call DefWindowProc which uses DefFrameProc + LRESULT DefWindowProc() + { + const MSG* pMsg = m_pCurrentMsg; + LRESULT lRes = 0; + if (pMsg != NULL) + lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); + return lRes; + } + + LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) + { + return ::DefFrameProc(m_hWnd, m_hWndMDIClient, uMsg, wParam, lParam); + } + + BOOL PreTranslateMessage(MSG* pMsg) + { + if(CFrameWindowImplBase::PreTranslateMessage(pMsg)) + return TRUE; + return ::TranslateMDISysAccel(m_hWndMDIClient, pMsg); + } + + HWND CreateMDIClient(HMENU hWindowMenu = NULL, UINT nID = ATL_IDW_CLIENT, UINT nFirstChildID = ATL_IDM_FIRST_MDICHILD) + { + DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MDIS_ALLCHILDSTYLES; + DWORD dwExStyle = WS_EX_CLIENTEDGE; + + CLIENTCREATESTRUCT ccs = { 0 }; + ccs.hWindowMenu = hWindowMenu; + ccs.idFirstChild = nFirstChildID; + + if((GetStyle() & (WS_HSCROLL | WS_VSCROLL)) != 0) + { + // parent MDI frame's scroll styles move to the MDICLIENT + dwStyle |= (GetStyle() & (WS_HSCROLL | WS_VSCROLL)); + + // fast way to turn off the scrollbar bits (without a resize) + ModifyStyle(WS_HSCROLL | WS_VSCROLL, 0, SWP_NOREDRAW | SWP_FRAMECHANGED); + } + + // Create MDICLIENT window + m_hWndClient = ::CreateWindowEx(dwExStyle, _T("MDIClient"), NULL, + dwStyle, 0, 0, 1, 1, m_hWnd, (HMENU)LongToHandle(nID), + ModuleHelper::GetModuleInstance(), (LPVOID)&ccs); + if (m_hWndClient == NULL) + { + ATLTRACE2(atlTraceUI, 0, _T("MDI Frame failed to create MDICLIENT.\n")); + return NULL; + } + + // Move it to the top of z-order + ::BringWindowToTop(m_hWndClient); + + // set as MDI client window + m_hWndMDIClient = m_hWndClient; + + // update to proper size + T* pT = static_cast(this); + pT->UpdateLayout(); + + return m_hWndClient; + } + + typedef CFrameWindowImplBase _baseClass; + + BEGIN_MSG_MAP(CMDIFrameWindowImpl) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) + MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) +#ifndef _ATL_NO_REBAR_SUPPORT +#if (_WIN32_IE >= 0x0400) + NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) +#endif // (_WIN32_IE >= 0x0400) +#if (_WIN32_IE >= 0x0500) + NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) +#endif // (_WIN32_IE >= 0x0500) +#endif // !_ATL_NO_REBAR_SUPPORT + CHAIN_MSG_MAP(_baseClass) + END_MSG_MAP() + + LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(wParam != SIZE_MINIMIZED) + { + T* pT = static_cast(this); + pT->UpdateLayout(); + } + // message must be handled, otherwise DefFrameProc would resize the client again + return 0; + } + + LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + // don't allow CFrameWindowImplBase to handle this one + return DefWindowProc(uMsg, wParam, lParam); + } + + LRESULT OnMDISetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + SetMDIFrameMenu(); + return 0; + } + +#ifndef _ATL_NO_REBAR_SUPPORT +#if (_WIN32_IE >= 0x0400) + LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->UpdateLayout(FALSE); + return 0; + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) + LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + T* pT = static_cast(this); + _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; + if(!pT->PrepareChevronMenu(cmi)) + { + bHandled = FALSE; + return 1; + } + // display a popup menu with hidden items + pT->DisplayChevronMenu(cmi); + // cleanup + pT->CleanupChevronMenu(cmi); + return 0; + } +#endif // (_WIN32_IE >= 0x0500) +#endif // !_ATL_NO_REBAR_SUPPORT +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CMDIChildWindowImpl + +#ifndef _WIN32_WCE + +template +class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase +{ +public: + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + UINT nMenuID = 0, LPVOID lpCreateParam = NULL) + { + ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); + + if(nMenuID != 0) + m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nMenuID)); + + dwStyle = T::GetWndStyle(dwStyle); + dwExStyle = T::GetWndExStyle(dwExStyle); + + dwExStyle |= WS_EX_MDICHILD; // force this one + m_pfnSuperWindowProc = ::DefMDIChildProc; + m_hWndMDIClient = hWndParent; + ATLASSERT(::IsWindow(m_hWndMDIClient)); + + if(rect.m_lpRect == NULL) + rect.m_lpRect = &TBase::rcDefault; + + // If the currently active MDI child is maximized, we want to create this one maximized too + ATL::CWindow wndParent = hWndParent; + BOOL bMaximized = FALSE; + wndParent.SendMessage(WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); + if(bMaximized) + wndParent.SetRedraw(FALSE); + + HWND hWnd = CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, (UINT)0U, atom, lpCreateParam); + + if(bMaximized) + { + // Maximize and redraw everything + if(hWnd != NULL) + MDIMaximize(hWnd); + wndParent.SetRedraw(TRUE); + wndParent.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); + ::SetFocus(GetMDIFrame()); // focus will be set back to this window + } + else if(hWnd != NULL && ::IsWindowVisible(m_hWnd) && !::IsChild(hWnd, ::GetFocus())) + { + ::SetFocus(hWnd); + } + + return hWnd; + } + + HWND CreateEx(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR lpcstrWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) + { + const int cchName = 256; + TCHAR szWindowName[cchName]; + szWindowName[0] = 0; + if(lpcstrWindowName == NULL) + { + ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); + lpcstrWindowName = szWindowName; + } + + T* pT = static_cast(this); + HWND hWnd = pT->Create(hWndParent, rect, lpcstrWindowName, dwStyle, dwExStyle, T::GetWndClassInfo().m_uCommonResourceID, lpCreateParam); + + if(hWnd != NULL) + m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); + + return hWnd; + } + + BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) + { + ATLASSERT(!::IsWindow(m_hWndToolBar)); + if(nResourceID == 0) + nResourceID = T::GetWndClassInfo().m_uCommonResourceID; + m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); + return (m_hWndToolBar != NULL); + } + + BOOL UpdateClientEdge(LPRECT lpRect = NULL) + { + // only adjust for active MDI child window + HWND hWndChild = MDIGetActive(); + if(hWndChild != NULL && hWndChild != m_hWnd) + return FALSE; + + // need to adjust the client edge style as max/restore happens + DWORD dwStyle = ::GetWindowLong(m_hWndMDIClient, GWL_EXSTYLE); + DWORD dwNewStyle = dwStyle; + if(hWndChild != NULL && ((GetExStyle() & WS_EX_CLIENTEDGE) == 0) && ((GetStyle() & WS_MAXIMIZE) != 0)) + dwNewStyle &= ~(WS_EX_CLIENTEDGE); + else + dwNewStyle |= WS_EX_CLIENTEDGE; + + if(dwStyle != dwNewStyle) + { + // SetWindowPos will not move invalid bits + ::RedrawWindow(m_hWndMDIClient, NULL, NULL, + RDW_INVALIDATE | RDW_ALLCHILDREN); + // remove/add WS_EX_CLIENTEDGE to MDI client area + ::SetWindowLong(m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); + ::SetWindowPos(m_hWndMDIClient, NULL, 0, 0, 0, 0, + SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | + SWP_NOZORDER | SWP_NOCOPYBITS); + + // return new client area + if (lpRect != NULL) + ::GetClientRect(m_hWndMDIClient, lpRect); + + return TRUE; + } + + return FALSE; + } + + typedef CFrameWindowImplBase _baseClass; + BEGIN_MSG_MAP(CMDIChildWindowImpl) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged) + MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) + MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) + MESSAGE_HANDLER(WM_MDIACTIVATE, OnMDIActivate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) +#ifndef _ATL_NO_REBAR_SUPPORT +#if (_WIN32_IE >= 0x0400) + NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) +#endif // (_WIN32_IE >= 0x0400) +#if (_WIN32_IE >= 0x0500) + NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) +#endif // (_WIN32_IE >= 0x0500) +#endif // !_ATL_NO_REBAR_SUPPORT + CHAIN_MSG_MAP(_baseClass) + END_MSG_MAP() + + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + DefWindowProc(uMsg, wParam, lParam); // needed for MDI children + if(wParam != SIZE_MINIMIZED) + { + T* pT = static_cast(this); + pT->UpdateLayout(); + } + return 0; + } + + LRESULT OnWindowPosChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + // update MDI client edge and adjust MDI child rect + LPWINDOWPOS lpWndPos = (LPWINDOWPOS)lParam; + + if(!(lpWndPos->flags & SWP_NOSIZE)) + { + RECT rectClient; + if(UpdateClientEdge(&rectClient) && ((GetStyle() & WS_MAXIMIZE) != 0)) + { + ::AdjustWindowRectEx(&rectClient, GetStyle(), FALSE, GetExStyle()); + lpWndPos->x = rectClient.left; + lpWndPos->y = rectClient.top; + lpWndPos->cx = rectClient.right - rectClient.left; + lpWndPos->cy = rectClient.bottom - rectClient.top; + } + } + + bHandled = FALSE; + return 1; + } + + LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + LRESULT lRes = DefWindowProc(uMsg, wParam, lParam); + + // Activate this MDI window if needed + if(lRes == MA_ACTIVATE || lRes == MA_ACTIVATEANDEAT) + { + if(MDIGetActive() != m_hWnd) + MDIActivate(m_hWnd); + } + + return lRes; + } + + LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + return ::SendMessage(GetMDIFrame(), uMsg, wParam, lParam); + } + + LRESULT OnMDIActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if((HWND)lParam == m_hWnd && m_hMenu != NULL) + SetMDIFrameMenu(); + else if((HWND)lParam == NULL) + ::SendMessage(GetMDIFrame(), WM_MDISETMENU, 0, 0); + + bHandled = FALSE; + return 1; + } + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_hMenu != NULL) + { + ::DestroyMenu(m_hMenu); + m_hMenu = NULL; + } + UpdateClientEdge(); + bHandled = FALSE; + return 1; + } + +#ifndef _ATL_NO_REBAR_SUPPORT +#if (_WIN32_IE >= 0x0400) + LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->UpdateLayout(FALSE); + return 0; + } +#endif // (_WIN32_IE >= 0x0400) + +#if (_WIN32_IE >= 0x0500) + LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) + { + T* pT = static_cast(this); + _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; + if(!pT->PrepareChevronMenu(cmi)) + { + bHandled = FALSE; + return 1; + } + // display a popup menu with hidden items + pT->DisplayChevronMenu(cmi); + // cleanup + pT->CleanupChevronMenu(cmi); + return 0; + } +#endif // (_WIN32_IE >= 0x0500) +#endif // !_ATL_NO_REBAR_SUPPORT +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// COwnerDraw - MI class for owner-draw support + +template +class COwnerDraw +{ +public: +#if (_ATL_VER < 0x0700) + BOOL m_bHandledOD; + + BOOL IsMsgHandled() const + { + return m_bHandledOD; + } + void SetMsgHandled(BOOL bHandled) + { + m_bHandledOD = bHandled; + } +#endif // (_ATL_VER < 0x0700) + +// Message map and handlers + BEGIN_MSG_MAP(COwnerDraw< T >) + MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) + MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) + MESSAGE_HANDLER(WM_COMPAREITEM, OnCompareItem) + MESSAGE_HANDLER(WM_DELETEITEM, OnDeleteItem) + ALT_MSG_MAP(1) + MESSAGE_HANDLER(OCM_DRAWITEM, OnDrawItem) + MESSAGE_HANDLER(OCM_MEASUREITEM, OnMeasureItem) + MESSAGE_HANDLER(OCM_COMPAREITEM, OnCompareItem) + MESSAGE_HANDLER(OCM_DELETEITEM, OnDeleteItem) + END_MSG_MAP() + + LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->SetMsgHandled(TRUE); + pT->DrawItem((LPDRAWITEMSTRUCT)lParam); + bHandled = pT->IsMsgHandled(); + return (LRESULT)TRUE; + } + + LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->SetMsgHandled(TRUE); + pT->MeasureItem((LPMEASUREITEMSTRUCT)lParam); + bHandled = pT->IsMsgHandled(); + return (LRESULT)TRUE; + } + + LRESULT OnCompareItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->SetMsgHandled(TRUE); + bHandled = pT->IsMsgHandled(); + return (LRESULT)pT->CompareItem((LPCOMPAREITEMSTRUCT)lParam); + } + + LRESULT OnDeleteItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->SetMsgHandled(TRUE); + pT->DeleteItem((LPDELETEITEMSTRUCT)lParam); + bHandled = pT->IsMsgHandled(); + return (LRESULT)TRUE; + } + +// Overrideables + void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/) + { + // must be implemented + ATLASSERT(FALSE); + } + + void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) + { + if(lpMeasureItemStruct->CtlType != ODT_MENU) + { + // return default height for a system font + T* pT = static_cast(this); + HWND hWnd = pT->GetDlgItem(lpMeasureItemStruct->CtlID); + CClientDC dc(hWnd); + TEXTMETRIC tm = { 0 }; + dc.GetTextMetrics(&tm); + + lpMeasureItemStruct->itemHeight = tm.tmHeight; + } + else + lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU); + } + + int CompareItem(LPCOMPAREITEMSTRUCT /*lpCompareItemStruct*/) + { + // all items are equal + return 0; + } + + void DeleteItem(LPDELETEITEMSTRUCT /*lpDeleteItemStruct*/) + { + // default - nothing + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// Update UI macros + +// these build the Update UI map inside a class definition +#define BEGIN_UPDATE_UI_MAP(thisClass) \ + static const CUpdateUIBase::_AtlUpdateUIMap* GetUpdateUIMap() \ + { \ + static const _AtlUpdateUIMap theMap[] = \ + { + +#define UPDATE_ELEMENT(nID, wType) \ + { nID, wType }, + +#define END_UPDATE_UI_MAP() \ + { (WORD)-1, 0 } \ + }; \ + return theMap; \ + } + +/////////////////////////////////////////////////////////////////////////////// +// CUpdateUI - manages UI elements updating + +class CUpdateUIBase +{ +public: + // constants + enum + { + // UI element type + UPDUI_MENUPOPUP = 0x0001, + UPDUI_MENUBAR = 0x0002, + UPDUI_CHILDWINDOW = 0x0004, + UPDUI_TOOLBAR = 0x0008, + UPDUI_STATUSBAR = 0x0010, + // state + UPDUI_ENABLED = 0x0000, + UPDUI_DISABLED = 0x0100, + UPDUI_CHECKED = 0x0200, + UPDUI_CHECKED2 = 0x0400, + UPDUI_RADIO = 0x0800, + UPDUI_DEFAULT = 0x1000, + UPDUI_TEXT = 0x2000, + // internal state + UPDUI_CLEARDEFAULT = 0x4000, + }; + + // element data + struct _AtlUpdateUIElement + { + HWND m_hWnd; + WORD m_wType; + + bool operator ==(const _AtlUpdateUIElement& e) const + { return (m_hWnd == e.m_hWnd && m_wType == e.m_wType); } + }; + + // map data + struct _AtlUpdateUIMap + { + WORD m_nID; + WORD m_wType; + + bool operator ==(const _AtlUpdateUIMap& e) const + { return (m_nID == e.m_nID && m_wType == e.m_wType); } + }; + + // instance data + struct _AtlUpdateUIData + { + WORD m_wState; + union + { + void* m_lpData; + LPTSTR m_lpstrText; + }; + + bool operator ==(const _AtlUpdateUIData& e) const + { return (m_wState == e.m_wState && m_lpData == e.m_lpData); } + }; + + ATL::CSimpleArray<_AtlUpdateUIElement> m_UIElements; // elements data + const _AtlUpdateUIMap* m_pUIMap; // static UI data + _AtlUpdateUIData* m_pUIData; // instance UI data + WORD m_wDirtyType; // global dirty flag + + bool m_bBlockAccelerators; + + +// Constructor, destructor + CUpdateUIBase() : m_pUIMap(NULL), m_pUIData(NULL), m_wDirtyType(0), m_bBlockAccelerators(false) + { } + + ~CUpdateUIBase() + { + if(m_pUIMap != NULL && m_pUIData != NULL) + { + const _AtlUpdateUIMap* pUIMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + while(pUIMap->m_nID != (WORD)-1) + { + if(pUIData->m_wState & UPDUI_TEXT) + delete [] pUIData->m_lpstrText; + pUIMap++; + pUIData++; + } + delete [] m_pUIData; + } + } + +// Check for disabled commands + bool UIGetBlockAccelerators() const + { + return m_bBlockAccelerators; + } + + bool UISetBlockAccelerators(bool bBlock) + { + bool bOld = m_bBlockAccelerators; + m_bBlockAccelerators = bBlock; + return bOld; + } + +// Add elements + BOOL UIAddMenuBar(HWND hWnd) // menu bar (main menu) + { + if(hWnd == NULL) + return FALSE; + _AtlUpdateUIElement e; + e.m_hWnd = hWnd; + e.m_wType = UPDUI_MENUBAR; + return m_UIElements.Add(e); + } + + BOOL UIAddToolBar(HWND hWnd) // toolbar + { + if(hWnd == NULL) + return FALSE; + _AtlUpdateUIElement e; + e.m_hWnd = hWnd; + e.m_wType = UPDUI_TOOLBAR; + return m_UIElements.Add(e); + } + + BOOL UIAddStatusBar(HWND hWnd) // status bar + { + if(hWnd == NULL) + return FALSE; + _AtlUpdateUIElement e; + e.m_hWnd = hWnd; + e.m_wType = UPDUI_STATUSBAR; + return m_UIElements.Add(e); + } + + BOOL UIAddChildWindowContainer(HWND hWnd) // child window + { + if(hWnd == NULL) + return FALSE; + _AtlUpdateUIElement e; + e.m_hWnd = hWnd; + e.m_wType = UPDUI_CHILDWINDOW; + return m_UIElements.Add(e); + } + +// Message map for popup menu updates and accelerator blocking + BEGIN_MSG_MAP(CUpdateUIBase) + MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) + MESSAGE_HANDLER(WM_COMMAND, OnCommand) + END_MSG_MAP() + + LRESULT OnInitMenuPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + bHandled = FALSE; + HMENU hMenu = (HMENU)wParam; + if(hMenu == NULL) + return 1; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return 1; + const _AtlUpdateUIMap* pMap = m_pUIMap; + while(pMap->m_nID != (WORD)-1) + { + if(pMap->m_wType & UPDUI_MENUPOPUP) + UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); + pMap++; + pUIData++; + } + return 0; + } + + LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + bHandled = FALSE; + if(m_bBlockAccelerators && HIWORD(wParam) == 1) // accelerators only + { + int nID = LOWORD(wParam); + if((UIGetState(nID) & UPDUI_DISABLED) == UPDUI_DISABLED) + { + ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIBase::OnCommand - blocked disabled command 0x%4.4X\n"), nID); + bHandled = TRUE; // eat the command, UI item is disabled + } + } + return 0; + } + +// methods for setting UI element state + BOOL UIEnable(int nID, BOOL bEnable, BOOL bForceUpdate = FALSE) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + { + if(bEnable) + { + if(pUIData->m_wState & UPDUI_DISABLED) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState &= ~UPDUI_DISABLED; + } + } + else + { + if(!(pUIData->m_wState & UPDUI_DISABLED)) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState |= UPDUI_DISABLED; + } + } + + if(bForceUpdate) + pUIData->m_wState |= pMap->m_wType; + if(pUIData->m_wState & pMap->m_wType) + m_wDirtyType |= pMap->m_wType; + + break; // found + } + } + + return TRUE; + } + + BOOL UISetCheck(int nID, int nCheck, BOOL bForceUpdate = FALSE) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + { + switch(nCheck) + { + case 0: + if((pUIData->m_wState & UPDUI_CHECKED) || (pUIData->m_wState & UPDUI_CHECKED2)) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState &= ~(UPDUI_CHECKED | UPDUI_CHECKED2); + } + break; + case 1: + if(!(pUIData->m_wState & UPDUI_CHECKED)) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState &= ~UPDUI_CHECKED2; + pUIData->m_wState |= UPDUI_CHECKED; + } + break; + case 2: + if(!(pUIData->m_wState & UPDUI_CHECKED2)) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState &= ~UPDUI_CHECKED; + pUIData->m_wState |= UPDUI_CHECKED2; + } + break; + } + + if(bForceUpdate) + pUIData->m_wState |= pMap->m_wType; + if(pUIData->m_wState & pMap->m_wType) + m_wDirtyType |= pMap->m_wType; + + break; // found + } + } + + return TRUE; + } + + // variant that supports bool (checked/not-checked, no intermediate state) + BOOL UISetCheck(int nID, bool bCheck, BOOL bForceUpdate = FALSE) + { + return UISetCheck(nID, bCheck ? 1 : 0, bForceUpdate); + } + + BOOL UISetRadio(int nID, BOOL bRadio, BOOL bForceUpdate = FALSE) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + { + if(bRadio) + { + if(!(pUIData->m_wState & UPDUI_RADIO)) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState |= UPDUI_RADIO; + } + } + else + { + if(pUIData->m_wState & UPDUI_RADIO) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState &= ~UPDUI_RADIO; + } + } + + if(bForceUpdate) + pUIData->m_wState |= pMap->m_wType; + if(pUIData->m_wState & pMap->m_wType) + m_wDirtyType |= pMap->m_wType; + + break; // found + } + } + + return TRUE; + } + + BOOL UISetText(int nID, LPCTSTR lpstrText, BOOL bForceUpdate = FALSE) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + if(lpstrText == NULL) + lpstrText = _T(""); + + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + { + if(pUIData->m_lpstrText == NULL || lstrcmp(pUIData->m_lpstrText, lpstrText)) + { + delete [] pUIData->m_lpstrText; + pUIData->m_lpstrText = NULL; + int nStrLen = lstrlen(lpstrText); + ATLTRY(pUIData->m_lpstrText = new TCHAR[nStrLen + 1]); + if(pUIData->m_lpstrText == NULL) + { + ATLTRACE2(atlTraceUI, 0, _T("UISetText - memory allocation failed\n")); + break; + } + SecureHelper::strcpy_x(pUIData->m_lpstrText, nStrLen + 1, lpstrText); + pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); + } + + if(bForceUpdate) + pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); + if(pUIData->m_wState & pMap->m_wType) + m_wDirtyType |= pMap->m_wType; + + break; // found + } + } + + return TRUE; + } + + BOOL UISetDefault(int nID, BOOL bDefault, BOOL bForceUpdate = FALSE) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + { + if(bDefault) + { + if((pUIData->m_wState & UPDUI_DEFAULT) == 0) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState |= UPDUI_DEFAULT; + } + } + else + { + if((pUIData->m_wState & UPDUI_DEFAULT) != 0) + { + pUIData->m_wState |= pMap->m_wType; + pUIData->m_wState &= ~UPDUI_DEFAULT; + pUIData->m_wState |= UPDUI_CLEARDEFAULT; + } + } + + if(bForceUpdate) + pUIData->m_wState |= pMap->m_wType; + if(pUIData->m_wState & pMap->m_wType) + m_wDirtyType |= pMap->m_wType; + + break; // found + } + } + + return TRUE; + } + +// methods for complete state set/get + BOOL UISetState(int nID, DWORD dwState) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + { + pUIData->m_wState = (WORD)(dwState | pMap->m_wType); + m_wDirtyType |= pMap->m_wType; + break; // found + } + } + return TRUE; + } + + DWORD UIGetState(int nID) + { + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return 0; + for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) + { + if(nID == (int)pMap->m_nID) + return pUIData->m_wState; + } + return 0; + } + +// methods for updating UI +#ifndef _WIN32_WCE + BOOL UIUpdateMenuBar(BOOL bForceUpdate = FALSE, BOOL bMainMenu = FALSE) + { + if(!(m_wDirtyType & UPDUI_MENUBAR) && !bForceUpdate) + return TRUE; + + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + while(pMap->m_nID != (WORD)-1) + { + for(int i = 0; i < m_UIElements.GetSize(); i++) + { + if(m_UIElements[i].m_wType == UPDUI_MENUBAR) + { + HMENU hMenu = ::GetMenu(m_UIElements[i].m_hWnd); + if(hMenu != NULL && (pUIData->m_wState & UPDUI_MENUBAR) && (pMap->m_wType & UPDUI_MENUBAR)) + UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); + } + if(bMainMenu) + ::DrawMenuBar(m_UIElements[i].m_hWnd); + } + pMap++; + pUIData->m_wState &= ~UPDUI_MENUBAR; + if(pUIData->m_wState & UPDUI_TEXT) + { + delete [] pUIData->m_lpstrText; + pUIData->m_lpstrText = NULL; + pUIData->m_wState &= ~UPDUI_TEXT; + } + pUIData++; + } + + m_wDirtyType &= ~UPDUI_MENUBAR; + return TRUE; + } +#endif // !_WIN32_WCE + + BOOL UIUpdateToolBar(BOOL bForceUpdate = FALSE) + { + if(!(m_wDirtyType & UPDUI_TOOLBAR) && !bForceUpdate) + return TRUE; + + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + while(pMap->m_nID != (WORD)-1) + { + for(int i = 0; i < m_UIElements.GetSize(); i++) + { + if(m_UIElements[i].m_wType == UPDUI_TOOLBAR) + { + if((pUIData->m_wState & UPDUI_TOOLBAR) && (pMap->m_wType & UPDUI_TOOLBAR)) + UIUpdateToolBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); + } + } + pMap++; + pUIData->m_wState &= ~UPDUI_TOOLBAR; + pUIData++; + } + + m_wDirtyType &= ~UPDUI_TOOLBAR; + return TRUE; + } + + BOOL UIUpdateStatusBar(BOOL bForceUpdate = FALSE) + { + if(!(m_wDirtyType & UPDUI_STATUSBAR) && !bForceUpdate) + return TRUE; + + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + while(pMap->m_nID != (WORD)-1) + { + for(int i = 0; i < m_UIElements.GetSize(); i++) + { + if(m_UIElements[i].m_wType == UPDUI_STATUSBAR) + { + if((pUIData->m_wState & UPDUI_STATUSBAR) && (pMap->m_wType & UPDUI_STATUSBAR)) + UIUpdateStatusBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); + } + } + pMap++; + pUIData->m_wState &= ~UPDUI_STATUSBAR; + if(pUIData->m_wState & UPDUI_TEXT) + { + delete [] pUIData->m_lpstrText; + pUIData->m_lpstrText = NULL; + pUIData->m_wState &= ~UPDUI_TEXT; + } + pUIData++; + } + + m_wDirtyType &= ~UPDUI_STATUSBAR; + return TRUE; + } + + BOOL UIUpdateChildWindows(BOOL bForceUpdate = FALSE) + { + if(!(m_wDirtyType & UPDUI_CHILDWINDOW) && !bForceUpdate) + return TRUE; + + const _AtlUpdateUIMap* pMap = m_pUIMap; + _AtlUpdateUIData* pUIData = m_pUIData; + if(pUIData == NULL) + return FALSE; + + while(pMap->m_nID != (WORD)-1) + { + for(int i = 0; i < m_UIElements.GetSize(); i++) + { + if(m_UIElements[i].m_wType == UPDUI_CHILDWINDOW) + { + if((pUIData->m_wState & UPDUI_CHILDWINDOW) && (pMap->m_wType & UPDUI_CHILDWINDOW)) + UIUpdateChildWindow(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); + } + } + pMap++; + pUIData->m_wState &= ~UPDUI_CHILDWINDOW; + if(pUIData->m_wState & UPDUI_TEXT) + { + delete [] pUIData->m_lpstrText; + pUIData->m_lpstrText = NULL; + pUIData->m_wState &= ~UPDUI_TEXT; + } + pUIData++; + } + + m_wDirtyType &= ~UPDUI_CHILDWINDOW; + return TRUE; + } + +// internal element specific methods + static void UIUpdateMenuBarElement(int nID, _AtlUpdateUIData* pUIData, HMENU hMenu) + { +#ifndef _WIN32_WCE + if((pUIData->m_wState & UPDUI_CLEARDEFAULT) != 0) + { + ::SetMenuDefaultItem(hMenu, (UINT)-1, 0); + pUIData->m_wState &= ~UPDUI_CLEARDEFAULT; + } +#endif // !_WIN32_WCE + + CMenuItemInfo mii; + mii.fMask = MIIM_STATE; + mii.wID = nID; + +#ifndef _WIN32_WCE + if((pUIData->m_wState & UPDUI_DISABLED) != 0) + mii.fState |= MFS_DISABLED | MFS_GRAYED; + else + mii.fState |= MFS_ENABLED; + + if((pUIData->m_wState & UPDUI_CHECKED) != 0) + mii.fState |= MFS_CHECKED; + else + mii.fState |= MFS_UNCHECKED; + + if((pUIData->m_wState & UPDUI_DEFAULT) != 0) + mii.fState |= MFS_DEFAULT; +#else // CE specific + // ::SetMenuItemInfo() can't disable or check menu items + // on Windows CE, so we have to do that directly + UINT uEnable = MF_BYCOMMAND; + if((pUIData->m_wState & UPDUI_DISABLED) != 0) + uEnable |= MF_GRAYED; + else + uEnable |= MF_ENABLED; + ::EnableMenuItem(hMenu, nID, uEnable); + + UINT uCheck = MF_BYCOMMAND; + if((pUIData->m_wState & UPDUI_CHECKED) != 0) + uCheck |= MF_CHECKED; + else + uCheck |= MF_UNCHECKED; + ::CheckMenuItem(hMenu, nID, uCheck); +#endif // _WIN32_WCE + + if((pUIData->m_wState & UPDUI_TEXT) != 0) + { + CMenuItemInfo miiNow; + miiNow.fMask = MIIM_TYPE; + miiNow.wID = nID; + if(::GetMenuItemInfo(hMenu, nID, FALSE, &miiNow)) + { + mii.fMask |= MIIM_TYPE; + // MFT_BITMAP and MFT_SEPARATOR don't go together with MFT_STRING +#ifndef _WIN32_WCE + mii.fType |= (miiNow.fType & ~(MFT_BITMAP | MFT_SEPARATOR)) | MFT_STRING; +#else // CE specific + mii.fType |= (miiNow.fType & ~(MFT_SEPARATOR)) | MFT_STRING; +#endif // _WIN32_WCE + mii.dwTypeData = pUIData->m_lpstrText; + } + } + + ::SetMenuItemInfo(hMenu, nID, FALSE, &mii); + } + + static void UIUpdateToolBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndToolBar) + { + // Note: only handles enabled/disabled, checked state, and radio (press) + ::SendMessage(hWndToolBar, TB_ENABLEBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); + ::SendMessage(hWndToolBar, TB_CHECKBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED) ? TRUE : FALSE); + ::SendMessage(hWndToolBar, TB_INDETERMINATE, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED2) ? TRUE : FALSE); + ::SendMessage(hWndToolBar, TB_PRESSBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_RADIO) ? TRUE : FALSE); + } + + static void UIUpdateStatusBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndStatusBar) + { + // Note: only handles text + if(pUIData->m_wState & UPDUI_TEXT) + ::SendMessage(hWndStatusBar, SB_SETTEXT, nID, (LPARAM)pUIData->m_lpstrText); + } + + static void UIUpdateChildWindow(int nID, _AtlUpdateUIData* pUIData, HWND hWnd) + { + HWND hChild = ::GetDlgItem(hWnd, nID); + + ::EnableWindow(hChild, (pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); + // for check and radio, assume that window is a button + int nCheck = BST_UNCHECKED; + if(pUIData->m_wState & UPDUI_CHECKED || pUIData->m_wState & UPDUI_RADIO) + nCheck = BST_CHECKED; + else if(pUIData->m_wState & UPDUI_CHECKED2) + nCheck = BST_INDETERMINATE; + ::SendMessage(hChild, BM_SETCHECK, nCheck, 0L); + if(pUIData->m_wState & UPDUI_DEFAULT) + { + DWORD dwRet = (DWORD)::SendMessage(hWnd, DM_GETDEFID, 0, 0L); + if(HIWORD(dwRet) == DC_HASDEFID) + { + HWND hOldDef = ::GetDlgItem(hWnd, (int)(short)LOWORD(dwRet)); + // remove BS_DEFPUSHBUTTON + ::SendMessage(hOldDef, BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + ::SendMessage(hWnd, DM_SETDEFID, nID, 0L); + } + if(pUIData->m_wState & UPDUI_TEXT) + ::SetWindowText(hChild, pUIData->m_lpstrText); + } +}; + +template +class CUpdateUI : public CUpdateUIBase +{ +public: + CUpdateUI() + { + T* pT = static_cast(this); + pT; + const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); + m_pUIMap = pMap; + ATLASSERT(m_pUIMap != NULL); + int nCount; + for(nCount = 1; pMap->m_nID != (WORD)-1; nCount++) + pMap++; + + // check for duplicates (debug only) +#ifdef _DEBUG + for(int i = 0; i < nCount; i++) + { + for(int j = 0; j < nCount; j++) + { + // shouldn't have duplicates in the update UI map + if(i != j) + ATLASSERT(m_pUIMap[j].m_nID != m_pUIMap[i].m_nID); + } + } +#endif // _DEBUG + + ATLTRY(m_pUIData = new _AtlUpdateUIData[nCount]); + ATLASSERT(m_pUIData != NULL); + + if(m_pUIData != NULL) + memset(m_pUIData, 0, sizeof(_AtlUpdateUIData) * nCount); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CDynamicUpdateUI - allows update elements to dynamically added and removed +// in addition to a static update UI map + +template +class CDynamicUpdateUI : public CUpdateUIBase +{ +public: +// Data members + ATL::CSimpleArray<_AtlUpdateUIMap> m_arrUIMap; // copy of the static UI data + ATL::CSimpleArray<_AtlUpdateUIData> m_arrUIData; // instance UI data + +// Constructor/destructor + CDynamicUpdateUI() + { + T* pT = static_cast(this); + pT; + const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); + ATLASSERT(pMap != NULL); + + for(;;) + { + BOOL bRet = m_arrUIMap.Add(*(_AtlUpdateUIMap*)pMap); + ATLASSERT(bRet); + + if(bRet != FALSE) + { + _AtlUpdateUIData data = { 0, NULL }; + bRet = m_arrUIData.Add(data); + ATLASSERT(bRet); + } + + if(pMap->m_nID == (WORD)-1) + break; + + pMap++; + } + + ATLASSERT(m_arrUIMap.GetSize() == m_arrUIData.GetSize()); + +#ifdef _DEBUG + // check for duplicates (debug only) + for(int i = 0; i < m_arrUIMap.GetSize(); i++) + { + for(int j = 0; j < m_arrUIMap.GetSize(); j++) + { + // shouldn't have duplicates in the update UI map + if(i != j) + ATLASSERT(m_arrUIMap[j].m_nID != m_arrUIMap[i].m_nID); + } + } +#endif // _DEBUG + + // Set internal data pointers to point to the new data arrays + m_pUIMap = m_arrUIMap.m_aT; + m_pUIData = m_arrUIData.m_aT; + } + + ~CDynamicUpdateUI() + { + for(int i = 0; i < m_arrUIData.GetSize(); i++) + { + if((m_arrUIData[i].m_wState & UPDUI_TEXT) != 0) + delete [] m_arrUIData[i].m_lpstrText; + } + + // Reset internal data pointers (memory will be released by CSimpleArray d-tor) + m_pUIMap = NULL; + m_pUIData = NULL; + } + +// Methods for dynamically adding and removing update elements + bool UIAddUpdateElement(WORD nID, WORD wType) + { + // check for duplicates + for(int i = 0; i < m_arrUIMap.GetSize(); i++) + { + // shouldn't have duplicates in the update UI map + ATLASSERT(m_arrUIMap[i].m_nID != nID); + if(m_arrUIMap[i].m_nID == nID) + return false; + } + + bool bRetVal = false; + + // Add new end element + _AtlUpdateUIMap uumEnd = { (WORD)-1, 0 }; + BOOL bRet = m_arrUIMap.Add(uumEnd); + ATLASSERT(bRet); + + if(bRet != FALSE) + { + _AtlUpdateUIData uud = { 0, NULL }; + bRet = m_arrUIData.Add(uud); + ATLASSERT(bRet); + + // Set new data to the previous end element + if(bRet != FALSE) + { + int nSize = m_arrUIMap.GetSize(); + _AtlUpdateUIMap uum = { nID, wType }; + m_arrUIMap.SetAtIndex(nSize - 2, uum); + m_arrUIData.SetAtIndex(nSize - 2, uud); + + // Set internal data pointers again, just in case that memory moved + m_pUIMap = m_arrUIMap.m_aT; + m_pUIData = m_arrUIData.m_aT; + + bRetVal = true; + } + } + + return bRetVal; + } + + bool UIRemoveUpdateElement(WORD nID) + { + bool bRetVal = false; + + for(int i = 0; i < m_arrUIMap.GetSize(); i++) + { + if(m_arrUIMap[i].m_nID == nID) + { + BOOL bRet = m_arrUIMap.RemoveAt(i); + ATLASSERT(bRet); + bRet = m_arrUIData.RemoveAt(i); + ATLASSERT(bRet); + + bRetVal = true; + break; + } + } + + return bRetVal; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CDialogResize - provides support for resizing dialog controls +// (works for any window that has child controls) + +// Put CDialogResize in the list of base classes for a dialog (or even plain window), +// then implement DLGRESIZE map by specifying controls and groups of control +// and using DLSZ_* values to specify how are they supposed to be resized. +// +// Notes: +// - Resizeable border (WS_THICKFRAME style) should be set in the dialog template +// for top level dialogs (popup or overlapped), so that users can resize the dialog. +// - Some flags cannot be combined; for instance DLSZ_CENTER_X overrides DLSZ_SIZE_X, +// DLSZ_SIZE_X overrides DLSZ_MOVE_X. X and Y flags can be combined. +// - Order of controls is important - group controls are resized and moved based +// on the position of the previous control in a group. + +// dialog resize map macros +#define BEGIN_DLGRESIZE_MAP(thisClass) \ + static const _AtlDlgResizeMap* GetDlgResizeMap() \ + { \ + static const _AtlDlgResizeMap theMap[] = \ + { + +#define END_DLGRESIZE_MAP() \ + { -1, 0 }, \ + }; \ + return theMap; \ + } + +#define DLGRESIZE_CONTROL(id, flags) \ + { id, flags }, + +#define BEGIN_DLGRESIZE_GROUP() \ + { -1, _DLSZ_BEGIN_GROUP }, + +#define END_DLGRESIZE_GROUP() \ + { -1, _DLSZ_END_GROUP }, + + +template +class CDialogResize +{ +public: +// Data declarations and members + enum + { + DLSZ_SIZE_X = 0x00000001, + DLSZ_SIZE_Y = 0x00000002, + DLSZ_MOVE_X = 0x00000004, + DLSZ_MOVE_Y = 0x00000008, + DLSZ_REPAINT = 0x00000010, + DLSZ_CENTER_X = 0x00000020, + DLSZ_CENTER_Y = 0x00000040, + + // internal use only + _DLSZ_BEGIN_GROUP = 0x00001000, + _DLSZ_END_GROUP = 0x00002000, + _DLSZ_GRIPPER = 0x00004000 + }; + + struct _AtlDlgResizeMap + { + int m_nCtlID; + DWORD m_dwResizeFlags; + }; + + struct _AtlDlgResizeData + { + int m_nCtlID; + DWORD m_dwResizeFlags; + RECT m_rect; + + int GetGroupCount() const + { + return (int)LOBYTE(HIWORD(m_dwResizeFlags)); + } + + void SetGroupCount(int nCount) + { + ATLASSERT(nCount > 0 && nCount < 256); + DWORD dwCount = (DWORD)MAKELONG(0, MAKEWORD(nCount, 0)); + m_dwResizeFlags &= 0xFF00FFFF; + m_dwResizeFlags |= dwCount; + } + + bool operator ==(const _AtlDlgResizeData& r) const + { return (m_nCtlID == r.m_nCtlID && m_dwResizeFlags == r.m_dwResizeFlags); } + }; + + ATL::CSimpleArray<_AtlDlgResizeData> m_arrData; + SIZE m_sizeDialog; + POINT m_ptMinTrackSize; + bool m_bGripper; + + +// Constructor + CDialogResize() : m_bGripper(false) + { + m_sizeDialog.cx = 0; + m_sizeDialog.cy = 0; + m_ptMinTrackSize.x = -1; + m_ptMinTrackSize.y = -1; + } + +// Operations + void DlgResize_Init(bool bAddGripper = true, bool bUseMinTrackSize = true, DWORD dwForceStyle = WS_CLIPCHILDREN) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + DWORD dwStyle = pT->GetStyle(); + +#ifdef _DEBUG + // Debug only: Check if top level dialogs have a resizeable border. + if(((dwStyle & WS_CHILD) == 0) && ((dwStyle & WS_THICKFRAME) == 0)) + ATLTRACE2(atlTraceUI, 0, _T("DlgResize_Init - warning: top level dialog without the WS_THICKFRAME style - user cannot resize it\n")); +#endif // _DEBUG + + // Force specified styles (default WS_CLIPCHILDREN reduces flicker) + if((dwStyle & dwForceStyle) != dwForceStyle) + pT->ModifyStyle(0, dwForceStyle); + + // Adding this style removes an empty icon that dialogs with WS_THICKFRAME have. + // Setting icon to NULL is required when XP themes are active. + // Note: This will not prevent adding an icon for the dialog using SetIcon() + if((dwStyle & WS_CHILD) == 0) + { + pT->ModifyStyleEx(0, WS_EX_DLGMODALFRAME); + if(pT->GetIcon(FALSE) == NULL) + pT->SetIcon(NULL, FALSE); + } + + // Cleanup in case of multiple initialization + // block: first check for the gripper control, destroy it if needed + { + ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); + if(wndGripper.IsWindow() && m_arrData.GetSize() > 0 && (m_arrData[0].m_dwResizeFlags & _DLSZ_GRIPPER) != 0) + wndGripper.DestroyWindow(); + } + // clear out everything else + m_arrData.RemoveAll(); + m_sizeDialog.cx = 0; + m_sizeDialog.cy = 0; + m_ptMinTrackSize.x = -1; + m_ptMinTrackSize.y = -1; + + // Get initial dialog client size + RECT rectDlg = { 0 }; + pT->GetClientRect(&rectDlg); + m_sizeDialog.cx = rectDlg.right; + m_sizeDialog.cy = rectDlg.bottom; + +#ifndef _WIN32_WCE + // Create gripper if requested + m_bGripper = false; + if(bAddGripper) + { + // shouldn't exist already + ATLASSERT(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))); + if(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))) + { + ATL::CWindow wndGripper; + wndGripper.Create(_T("SCROLLBAR"), pT->m_hWnd, rectDlg, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEBOX | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN, 0, ATL_IDW_STATUS_BAR); + ATLASSERT(wndGripper.IsWindow()); + if(wndGripper.IsWindow()) + { + m_bGripper = true; + RECT rectCtl = { 0 }; + wndGripper.GetWindowRect(&rectCtl); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); + _AtlDlgResizeData data = { ATL_IDW_STATUS_BAR, DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | _DLSZ_GRIPPER, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; + m_arrData.Add(data); + } + } + } +#else // CE specific + bAddGripper; // avoid level 4 warning +#endif // _WIN32_WCE + + // Get min track position if requested + if(bUseMinTrackSize) + { + if((dwStyle & WS_CHILD) != 0) + { + RECT rect = { 0 }; + pT->GetClientRect(&rect); + m_ptMinTrackSize.x = rect.right - rect.left; + m_ptMinTrackSize.y = rect.bottom - rect.top; + } + else + { + RECT rect = { 0 }; + pT->GetWindowRect(&rect); + m_ptMinTrackSize.x = rect.right - rect.left; + m_ptMinTrackSize.y = rect.bottom - rect.top; + } + } + + // Walk the map and initialize data + const _AtlDlgResizeMap* pMap = pT->GetDlgResizeMap(); + ATLASSERT(pMap != NULL); + int nGroupStart = -1; + for(int nCount = 1; !(pMap->m_nCtlID == -1 && pMap->m_dwResizeFlags == 0); nCount++, pMap++) + { + if(pMap->m_nCtlID == -1) + { + switch(pMap->m_dwResizeFlags) + { + case _DLSZ_BEGIN_GROUP: + ATLASSERT(nGroupStart == -1); + nGroupStart = m_arrData.GetSize(); + break; + case _DLSZ_END_GROUP: + { + ATLASSERT(nGroupStart != -1); + int nGroupCount = m_arrData.GetSize() - nGroupStart; + m_arrData[nGroupStart].SetGroupCount(nGroupCount); + nGroupStart = -1; + } + break; + default: + ATLASSERT(FALSE && _T("Invalid DLGRESIZE Map Entry")); + break; + } + } + else + { + // this ID conflicts with the default gripper one + ATLASSERT(m_bGripper ? (pMap->m_nCtlID != ATL_IDW_STATUS_BAR) : TRUE); + + ATL::CWindow ctl = pT->GetDlgItem(pMap->m_nCtlID); + ATLASSERT(ctl.IsWindow()); + RECT rectCtl = { 0 }; + ctl.GetWindowRect(&rectCtl); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); + + DWORD dwGroupFlag = (nGroupStart != -1 && m_arrData.GetSize() == nGroupStart) ? _DLSZ_BEGIN_GROUP : 0; + _AtlDlgResizeData data = { pMap->m_nCtlID, pMap->m_dwResizeFlags | dwGroupFlag, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; + m_arrData.Add(data); + } + } + ATLASSERT((nGroupStart == -1) && _T("No End Group Entry in the DLGRESIZE Map")); + } + + void DlgResize_UpdateLayout(int cxWidth, int cyHeight) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + // Restrict minimum size if requested + if(((pT->GetStyle() & WS_CHILD) != 0) && m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) + { + if(cxWidth < m_ptMinTrackSize.x) + cxWidth = m_ptMinTrackSize.x; + if(cyHeight < m_ptMinTrackSize.y) + cyHeight = m_ptMinTrackSize.y; + } + + BOOL bVisible = pT->IsWindowVisible(); + if(bVisible) + pT->SetRedraw(FALSE); + + for(int i = 0; i < m_arrData.GetSize(); i++) + { + if((m_arrData[i].m_dwResizeFlags & _DLSZ_BEGIN_GROUP) != 0) // start of a group + { + int nGroupCount = m_arrData[i].GetGroupCount(); + ATLASSERT(nGroupCount > 0 && i + nGroupCount - 1 < m_arrData.GetSize()); + RECT rectGroup = m_arrData[i].m_rect; + + int j = 1; + for(j = 1; j < nGroupCount; j++) + { + rectGroup.left = min(rectGroup.left, m_arrData[i + j].m_rect.left); + rectGroup.top = min(rectGroup.top, m_arrData[i + j].m_rect.top); + rectGroup.right = max(rectGroup.right, m_arrData[i + j].m_rect.right); + rectGroup.bottom = max(rectGroup.bottom, m_arrData[i + j].m_rect.bottom); + } + + for(j = 0; j < nGroupCount; j++) + { + _AtlDlgResizeData* pDataPrev = NULL; + if(j > 0) + pDataPrev = &(m_arrData[i + j - 1]); + pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i + j], true, pDataPrev); + } + + i += nGroupCount - 1; // increment to skip all group controls + } + else // one control entry + { + RECT rectGroup = { 0, 0, 0, 0 }; + pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i], false); + } + } + + if(bVisible) + pT->SetRedraw(TRUE); + + pT->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + } + +// Message map and handlers + BEGIN_MSG_MAP(CDialogResize) + MESSAGE_HANDLER(WM_SIZE, OnSize) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo) +#endif // _WIN32_WCE + END_MSG_MAP() + + LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); +#ifndef _WIN32_WCE + if(m_bGripper) + { + ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); + if(wParam == SIZE_MAXIMIZED) + wndGripper.ShowWindow(SW_HIDE); + else if(wParam == SIZE_RESTORED) + wndGripper.ShowWindow(SW_SHOW); + } +#endif // _WIN32_WCE + if(wParam != SIZE_MINIMIZED) + { + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DlgResize_UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + } + return 0; + } + +#ifndef _WIN32_WCE + LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + if(m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) + { + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; + lpMMI->ptMinTrackSize = m_ptMinTrackSize; + } + return 0; + } +#endif // _WIN32_WCE + +// Implementation + bool DlgResize_PositionControl(int cxWidth, int cyHeight, RECT& rectGroup, _AtlDlgResizeData& data, bool bGroup, + _AtlDlgResizeData* pDataPrev = NULL) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + ATL::CWindow ctl; + RECT rectCtl = { 0 }; + + ctl = pT->GetDlgItem(data.m_nCtlID); + if(!ctl.GetWindowRect(&rectCtl)) + return false; + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); + + if(bGroup) + { + if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) + { + int cxRight = rectGroup.right + cxWidth - m_sizeDialog.cx; + int cxCtl = data.m_rect.right - data.m_rect.left; + rectCtl.left = rectGroup.left + (cxRight - rectGroup.left - cxCtl) / 2; + rectCtl.right = rectCtl.left + cxCtl; + } + else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) + { + rectCtl.left = rectGroup.left + ::MulDiv(data.m_rect.left - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); + + if((data.m_dwResizeFlags & DLSZ_SIZE_X) != 0) + { + rectCtl.right = rectGroup.left + ::MulDiv(data.m_rect.right - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); + + if(pDataPrev != NULL) + { + ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); + RECT rcPrev = { 0 }; + ctlPrev.GetWindowRect(&rcPrev); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); + int dxAdjust = (rectCtl.left - rcPrev.right) - (data.m_rect.left - pDataPrev->m_rect.right); + rcPrev.right += dxAdjust; + ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + } + } + else + { + rectCtl.right = rectCtl.left + (data.m_rect.right - data.m_rect.left); + } + } + + if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) + { + int cyBottom = rectGroup.bottom + cyHeight - m_sizeDialog.cy; + int cyCtl = data.m_rect.bottom - data.m_rect.top; + rectCtl.top = rectGroup.top + (cyBottom - rectGroup.top - cyCtl) / 2; + rectCtl.bottom = rectCtl.top + cyCtl; + } + else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) + { + rectCtl.top = rectGroup.top + ::MulDiv(data.m_rect.top - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); + + if((data.m_dwResizeFlags & DLSZ_SIZE_Y) != 0) + { + rectCtl.bottom = rectGroup.top + ::MulDiv(data.m_rect.bottom - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); + + if(pDataPrev != NULL) + { + ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); + RECT rcPrev = { 0 }; + ctlPrev.GetWindowRect(&rcPrev); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); + int dxAdjust = (rectCtl.top - rcPrev.bottom) - (data.m_rect.top - pDataPrev->m_rect.bottom); + rcPrev.bottom += dxAdjust; + ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + } + } + else + { + rectCtl.bottom = rectCtl.top + (data.m_rect.bottom - data.m_rect.top); + } + } + } + else // no group + { + if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) + { + int cxCtl = data.m_rect.right - data.m_rect.left; + rectCtl.left = (cxWidth - cxCtl) / 2; + rectCtl.right = rectCtl.left + cxCtl; + } + else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) + { + rectCtl.right = data.m_rect.right + (cxWidth - m_sizeDialog.cx); + + if((data.m_dwResizeFlags & DLSZ_MOVE_X) != 0) + rectCtl.left = rectCtl.right - (data.m_rect.right - data.m_rect.left); + } + + if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) + { + int cyCtl = data.m_rect.bottom - data.m_rect.top; + rectCtl.top = (cyHeight - cyCtl) / 2; + rectCtl.bottom = rectCtl.top + cyCtl; + } + else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) + { + rectCtl.bottom = data.m_rect.bottom + (cyHeight - m_sizeDialog.cy); + + if((data.m_dwResizeFlags & DLSZ_MOVE_Y) != 0) + rectCtl.top = rectCtl.bottom - (data.m_rect.bottom - data.m_rect.top); + } + } + + if((data.m_dwResizeFlags & DLSZ_REPAINT) != 0) + ctl.Invalidate(); + + if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_SIZE_Y | DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | DLSZ_CENTER_X | DLSZ_CENTER_Y)) != 0) + ctl.SetWindowPos(NULL, &rectCtl, SWP_NOZORDER | SWP_NOACTIVATE); + + return true; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CDoubleBufferImpl - Provides double-buffer painting support to any window + +template +class CDoubleBufferImpl +{ +public: +// Overrideables + void DoPaint(CDCHandle /*dc*/) + { + // must be implemented in a derived class + ATLASSERT(FALSE); + } + +// Message map and handlers + BEGIN_MSG_MAP(CDoubleBufferImpl) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_PAINT, OnPaint) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) +#endif // !_WIN32_WCE + END_MSG_MAP() + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background painting needed + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + if(wParam != NULL) + { + RECT rect = { 0 }; + pT->GetClientRect(&rect); + CMemoryDC dcMem((HDC)wParam, rect); + pT->DoPaint(dcMem.m_hDC); + } + else + { + CPaintDC dc(pT->m_hWnd); + CMemoryDC dcMem(dc.m_hDC, dc.m_ps.rcPaint); + pT->DoPaint(dcMem.m_hDC); + } + + return 0; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CDoubleBufferWindowImpl - Implements a double-buffer painting window + +template +class ATL_NO_VTABLE CDoubleBufferWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CDoubleBufferImpl< T > +{ +public: + BEGIN_MSG_MAP(CDoubleBufferWindowImpl) + CHAIN_MSG_MAP(CDoubleBufferImpl< T >) + END_MSG_MAP() +}; + + +// command bar support +#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) + #undef CBRM_GETMENU + #undef CBRM_TRACKPOPUPMENU + #undef CBRM_GETCMDBAR + #undef CBRPOPUPMENU +#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) + +}; // namespace WTL + +#endif // __ATLFRAME_H__ diff --git a/Externals/WTL80/atlgdi.h b/Externals/WTL80/atlgdi.h index 49a1371cac..e7aa1d0d41 100644 --- a/Externals/WTL80/atlgdi.h +++ b/Externals/WTL80/atlgdi.h @@ -1,3850 +1,3850 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLGDI_H__ -#define __ATLGDI_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlgdi.h requires atlapp.h to be included first -#endif - - -// protect template members from windowsx.h macros -#ifdef _INC_WINDOWSX - #undef CopyRgn - #undef CreateBrush - #undef CreatePen - #undef SelectBrush - #undef SelectPen - #undef SelectFont - #undef SelectBitmap -#endif // _INC_WINDOWSX - -// required libraries -#if !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) - #pragma comment(lib, "msimg32.lib") -#endif // !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) -#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - #pragma comment(lib, "opengl32.lib") -#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CPenT -// CBrushT -// CLogFont -// CFontT -// CBitmapT -// CPaletteT -// CRgnT -// CDCT -// CPaintDC -// CClientDC -// CWindowDC -// CMemoryDC -// CEnhMetaFileInfo -// CEnhMetaFileT -// CEnhMetaFileDC -// -// Global functions: -// AtlGetBitmapResourceInfo() -// AtlGetBitmapResourceBitsPerPixel() -// AtlIsAlphaBitmapResource() -// AtlIsDib16() -// AtlGetDibColorTableSize() -// AtlGetDibNumColors(), -// AtlGetDibBitmap() -// AtlCopyBitmap() -// AtlCreatePackedDib16() -// AtlSetClipboardDib16() -// AtlGetClipboardDib() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// Bitmap resource helpers to extract bitmap information for a bitmap resource - -inline LPBITMAPINFOHEADER AtlGetBitmapResourceInfo(HMODULE hModule, ATL::_U_STRINGorID image) -{ - HRSRC hResource = ::FindResource(hModule, image.m_lpstr, RT_BITMAP); - ATLASSERT(hResource != NULL); - HGLOBAL hGlobal = ::LoadResource(hModule, hResource); - ATLASSERT(hGlobal != NULL); - LPBITMAPINFOHEADER pBitmapInfoHeader = (LPBITMAPINFOHEADER)::LockResource(hGlobal); - ATLASSERT(pBitmapInfoHeader != NULL); - return pBitmapInfoHeader; -} - -inline WORD AtlGetBitmapResourceBitsPerPixel(HMODULE hModule, ATL::_U_STRINGorID image) -{ - LPBITMAPINFOHEADER pBitmapInfoHeader = AtlGetBitmapResourceInfo(hModule, image); - ATLASSERT(pBitmapInfoHeader != NULL); - return pBitmapInfoHeader->biBitCount; -} - -inline WORD AtlGetBitmapResourceBitsPerPixel(ATL::_U_STRINGorID image) -{ - return AtlGetBitmapResourceBitsPerPixel(ModuleHelper::GetResourceInstance(), image); -} - -/////////////////////////////////////////////////////////////////////////////// -// 32-bit (alpha channel) bitmap resource helper - -// Note: 32-bit (alpha channel) images work only on Windows XP with Common Controls version 6. -// If you want your app to work on older version of Windows, load non-alpha images if Common -// Controls version is less than 6. - -inline bool AtlIsAlphaBitmapResource(ATL::_U_STRINGorID image) -{ - return (AtlGetBitmapResourceBitsPerPixel(image) == 32); -} - - -/////////////////////////////////////////////////////////////////////////////// -// CPen - -template -class CPenT -{ -public: -// Data members - HPEN m_hPen; - -// Constructor/destructor/operators - CPenT(HPEN hPen = NULL) : m_hPen(hPen) - { } - - ~CPenT() - { - if(t_bManaged && m_hPen != NULL) - DeleteObject(); - } - - CPenT& operator =(HPEN hPen) - { - Attach(hPen); - return *this; - } - - void Attach(HPEN hPen) - { - if(t_bManaged && m_hPen != NULL && m_hPen != hPen) - ::DeleteObject(m_hPen); - m_hPen = hPen; - } - - HPEN Detach() - { - HPEN hPen = m_hPen; - m_hPen = NULL; - return hPen; - } - - operator HPEN() const { return m_hPen; } - - bool IsNull() const { return (m_hPen == NULL); } - -// Create methods - HPEN CreatePen(int nPenStyle, int nWidth, COLORREF crColor) - { - ATLASSERT(m_hPen == NULL); - m_hPen = ::CreatePen(nPenStyle, nWidth, crColor); - return m_hPen; - } - -#ifndef _WIN32_WCE - HPEN CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL) - { - ATLASSERT(m_hPen == NULL); - m_hPen = ::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount, lpStyle); - return m_hPen; - } -#endif // !_WIN32_WCE - - HPEN CreatePenIndirect(LPLOGPEN lpLogPen) - { - ATLASSERT(m_hPen == NULL); - m_hPen = ::CreatePenIndirect(lpLogPen); - return m_hPen; - } - - BOOL DeleteObject() - { - ATLASSERT(m_hPen != NULL); - BOOL bRet = ::DeleteObject(m_hPen); - if(bRet) - m_hPen = NULL; - return bRet; - } - -// Attributes - int GetLogPen(LOGPEN* pLogPen) const - { - ATLASSERT(m_hPen != NULL); - return ::GetObject(m_hPen, sizeof(LOGPEN), pLogPen); - } - - bool GetLogPen(LOGPEN& LogPen) const - { - ATLASSERT(m_hPen != NULL); - return (::GetObject(m_hPen, sizeof(LOGPEN), &LogPen) == sizeof(LOGPEN)); - } - -#ifndef _WIN32_WCE - int GetExtLogPen(EXTLOGPEN* pLogPen) const - { - ATLASSERT(m_hPen != NULL); - return ::GetObject(m_hPen, sizeof(EXTLOGPEN), pLogPen); - } - - bool GetExtLogPen(EXTLOGPEN& ExtLogPen) const - { - ATLASSERT(m_hPen != NULL); - return (::GetObject(m_hPen, sizeof(EXTLOGPEN), &ExtLogPen) == sizeof(EXTLOGPEN)); - } -#endif // !_WIN32_WCE -}; - -typedef CPenT CPenHandle; -typedef CPenT CPen; - - -/////////////////////////////////////////////////////////////////////////////// -// CBrush - -template -class CBrushT -{ -public: -// Data members - HBRUSH m_hBrush; - -// Constructor/destructor/operators - CBrushT(HBRUSH hBrush = NULL) : m_hBrush(hBrush) - { } - - ~CBrushT() - { - if(t_bManaged && m_hBrush != NULL) - DeleteObject(); - } - - CBrushT& operator =(HBRUSH hBrush) - { - Attach(hBrush); - return *this; - } - - void Attach(HBRUSH hBrush) - { - if(t_bManaged && m_hBrush != NULL && m_hBrush != hBrush) - ::DeleteObject(m_hBrush); - m_hBrush = hBrush; - } - - HBRUSH Detach() - { - HBRUSH hBrush = m_hBrush; - m_hBrush = NULL; - return hBrush; - } - - operator HBRUSH() const { return m_hBrush; } - - bool IsNull() const { return (m_hBrush == NULL); } - -// Create methods - HBRUSH CreateSolidBrush(COLORREF crColor) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreateSolidBrush(crColor); - return m_hBrush; - } - -#ifndef _WIN32_WCE - HBRUSH CreateHatchBrush(int nIndex, COLORREF crColor) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreateHatchBrush(nIndex, crColor); - return m_hBrush; - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - HBRUSH CreateBrushIndirect(const LOGBRUSH* lpLogBrush) - { - ATLASSERT(m_hBrush == NULL); -#ifndef _WIN32_WCE - m_hBrush = ::CreateBrushIndirect(lpLogBrush); -#else // CE specific - m_hBrush = ATL::CreateBrushIndirect(lpLogBrush); -#endif // _WIN32_WCE - return m_hBrush; - } -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - - HBRUSH CreatePatternBrush(HBITMAP hBitmap) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreatePatternBrush(hBitmap); - return m_hBrush; - } - - HBRUSH CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage) - { - ATLASSERT(hPackedDIB != NULL); - const void* lpPackedDIB = GlobalLock(hPackedDIB); - ATLASSERT(lpPackedDIB != NULL); - m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); - GlobalUnlock(hPackedDIB); - return m_hBrush; - } - - HBRUSH CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); - return m_hBrush; - } - - HBRUSH CreateSysColorBrush(int nIndex) - { - ATLASSERT(m_hBrush == NULL); - m_hBrush = ::GetSysColorBrush(nIndex); - return m_hBrush; - } - - BOOL DeleteObject() - { - ATLASSERT(m_hBrush != NULL); - BOOL bRet = ::DeleteObject(m_hBrush); - if(bRet) - m_hBrush = NULL; - return bRet; - } - -// Attributes - int GetLogBrush(LOGBRUSH* pLogBrush) const - { - ATLASSERT(m_hBrush != NULL); - return ::GetObject(m_hBrush, sizeof(LOGBRUSH), pLogBrush); - } - - bool GetLogBrush(LOGBRUSH& LogBrush) const - { - ATLASSERT(m_hBrush != NULL); - return (::GetObject(m_hBrush, sizeof(LOGBRUSH), &LogBrush) == sizeof(LOGBRUSH)); - } -}; - -typedef CBrushT CBrushHandle; -typedef CBrushT CBrush; - - -/////////////////////////////////////////////////////////////////////////////// -// CFont - -class CLogFont : public LOGFONT -{ -public: - CLogFont() - { - memset(this, 0, sizeof(LOGFONT)); - } - - CLogFont(const LOGFONT& lf) - { - Copy(&lf); - } - - CLogFont(HFONT hFont) - { - ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); - ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); - } - - HFONT CreateFontIndirect() - { - return ::CreateFontIndirect(this); - } - - void SetBold() - { - lfWeight = FW_BOLD; - } - - bool IsBold() const - { - return (lfWeight >= FW_BOLD); - } - - void MakeBolder(int iScale = 1) - { - lfWeight += FW_BOLD * iScale; - } - - void MakeLarger(int iScale) - { - if(lfHeight > 0) - lfHeight += iScale; - else - lfHeight -= iScale; - } - - void SetHeight(LONG nPointSize, HDC hDC = NULL) - { - // For MM_TEXT mapping mode - lfHeight = -::MulDiv(nPointSize, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); - } - - LONG GetHeight(HDC hDC = NULL) const - { - // For MM_TEXT mapping mode - return ::MulDiv(-lfHeight, 72, ::GetDeviceCaps(hDC, LOGPIXELSY)); - } - - LONG GetDeciPointHeight(HDC hDC = NULL) const - { -#ifndef _WIN32_WCE - POINT ptOrg = { 0, 0 }; - ::DPtoLP(hDC, &ptOrg, 1); - POINT pt = { 0, 0 }; - pt.y = abs(lfHeight) + ptOrg.y; - ::LPtoDP(hDC,&pt,1); - return ::MulDiv(pt.y, 720, ::GetDeviceCaps(hDC, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point -#else // CE specific - // DP and LP are always the same on CE - return ::MulDiv(abs(lfHeight), 720, ::GetDeviceCaps(hDC, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE - } - - void SetHeightFromDeciPoint(LONG nDeciPtHeight, HDC hDC = NULL) - { -#ifndef _WIN32_WCE - POINT pt = { 0, 0 }; - pt.y = ::MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), nDeciPtHeight, 720); // 72 points/inch, 10 decipoints/point - ::DPtoLP(hDC, &pt, 1); - POINT ptOrg = { 0, 0 }; - ::DPtoLP(hDC, &ptOrg, 1); - lfHeight = -abs(pt.y - ptOrg.y); -#else // CE specific - // DP and LP are always the same on CE - lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), nDeciPtHeight, 720)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE - } - -#ifndef _WIN32_WCE - void SetCaptionFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfCaptionFont); - } - - void SetMenuFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfMenuFont); - } - - void SetStatusFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfStatusFont); - } - - void SetMessageBoxFont() - { - NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; - ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); - Copy(&ncm.lfMessageFont); - } -#endif // !_WIN32_WCE - - void Copy(const LOGFONT* pLogFont) - { - ATLASSERT(pLogFont != NULL); - *(LOGFONT*)this = *pLogFont; - } - - CLogFont& operator =(const CLogFont& src) - { - Copy(&src); - return *this; - } - - CLogFont& operator =(const LOGFONT& src) - { - Copy(&src); - return *this; - } - - CLogFont& operator =(HFONT hFont) - { - ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); - ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); - return *this; - } - - bool operator ==(const LOGFONT& logfont) const - { - return(logfont.lfHeight == lfHeight && - logfont.lfWidth == lfWidth && - logfont.lfEscapement == lfEscapement && - logfont.lfOrientation == lfOrientation && - logfont.lfWeight == lfWeight && - logfont.lfItalic == lfItalic && - logfont.lfUnderline == lfUnderline && - logfont.lfStrikeOut == lfStrikeOut && - logfont.lfCharSet == lfCharSet && - logfont.lfOutPrecision == lfOutPrecision && - logfont.lfClipPrecision == lfClipPrecision && - logfont.lfQuality == lfQuality && - logfont.lfPitchAndFamily == lfPitchAndFamily && - lstrcmp(logfont.lfFaceName, lfFaceName) == 0); - } -}; - - -template -class CFontT -{ -public: -// Data members - HFONT m_hFont; - -// Constructor/destructor/operators - CFontT(HFONT hFont = NULL) : m_hFont(hFont) - { } - - ~CFontT() - { - if(t_bManaged && m_hFont != NULL) - DeleteObject(); - } - - CFontT& operator =(HFONT hFont) - { - Attach(hFont); - return *this; - } - - void Attach(HFONT hFont) - { - if(t_bManaged && m_hFont != NULL && m_hFont != hFont) - ::DeleteObject(m_hFont); - m_hFont = hFont; - } - - HFONT Detach() - { - HFONT hFont = m_hFont; - m_hFont = NULL; - return hFont; - } - - operator HFONT() const { return m_hFont; } - - bool IsNull() const { return (m_hFont == NULL); } - -// Create methods - HFONT CreateFontIndirect(const LOGFONT* lpLogFont) - { - ATLASSERT(m_hFont == NULL); - m_hFont = ::CreateFontIndirect(lpLogFont); - return m_hFont; - } - -#if !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) - HFONT CreateFontIndirectEx(CONST ENUMLOGFONTEXDV* penumlfex) - { - ATLASSERT(m_hFont == NULL); - m_hFont = ::CreateFontIndirectEx(penumlfex); - return m_hFont; - } -#endif // !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) - -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - HFONT CreateFont(int nHeight, int nWidth, int nEscapement, - int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, - BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, - BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, - LPCTSTR lpszFacename) - { - ATLASSERT(m_hFont == NULL); -#ifndef _WIN32_WCE - m_hFont = ::CreateFont(nHeight, nWidth, nEscapement, - nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, - nCharSet, nOutPrecision, nClipPrecision, nQuality, - nPitchAndFamily, lpszFacename); -#else // CE specific - m_hFont = ATL::CreateFont(nHeight, nWidth, nEscapement, - nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, - nCharSet, nOutPrecision, nClipPrecision, nQuality, - nPitchAndFamily, lpszFacename); -#endif // _WIN32_WCE - return m_hFont; - } -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) - - HFONT CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, HDC hDC = NULL, bool bBold = false, bool bItalic = false) - { - LOGFONT logFont = { 0 }; - logFont.lfCharSet = DEFAULT_CHARSET; - logFont.lfHeight = nPointSize; - SecureHelper::strncpy_x(logFont.lfFaceName, _countof(logFont.lfFaceName), lpszFaceName, _TRUNCATE); - - if(bBold) - logFont.lfWeight = FW_BOLD; - if(bItalic) - logFont.lfItalic = (BYTE)TRUE; - - return CreatePointFontIndirect(&logFont, hDC); - } - - HFONT CreatePointFontIndirect(const LOGFONT* lpLogFont, HDC hDC = NULL) - { - HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); - - // convert nPointSize to logical units based on hDC - LOGFONT logFont = *lpLogFont; -#ifndef _WIN32_WCE - POINT pt = { 0, 0 }; - pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720); // 72 points/inch, 10 decipoints/point - ::DPtoLP(hDC1, &pt, 1); - POINT ptOrg = { 0, 0 }; - ::DPtoLP(hDC1, &ptOrg, 1); - logFont.lfHeight = -abs(pt.y - ptOrg.y); -#else // CE specific - // DP and LP are always the same on CE - logFont.lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE - - if(hDC == NULL) - ::ReleaseDC(NULL, hDC1); - - return CreateFontIndirect(&logFont); - } - - BOOL DeleteObject() - { - ATLASSERT(m_hFont != NULL); - BOOL bRet = ::DeleteObject(m_hFont); - if(bRet) - m_hFont = NULL; - return bRet; - } - -// Attributes - int GetLogFont(LOGFONT* pLogFont) const - { - ATLASSERT(m_hFont != NULL); - return ::GetObject(m_hFont, sizeof(LOGFONT), pLogFont); - } - - bool GetLogFont(LOGFONT& LogFont) const - { - ATLASSERT(m_hFont != NULL); - return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT)); - } -}; - -typedef CFontT CFontHandle; -typedef CFontT CFont; - - -/////////////////////////////////////////////////////////////////////////////// -// CBitmap - -template -class CBitmapT -{ -public: -// Data members - HBITMAP m_hBitmap; - -// Constructor/destructor/operators - CBitmapT(HBITMAP hBitmap = NULL) : m_hBitmap(hBitmap) - { } - - ~CBitmapT() - { - if(t_bManaged && m_hBitmap != NULL) - DeleteObject(); - } - - CBitmapT& operator =(HBITMAP hBitmap) - { - Attach(hBitmap); - return *this; - } - - void Attach(HBITMAP hBitmap) - { - if(t_bManaged && m_hBitmap != NULL&& m_hBitmap != hBitmap) - ::DeleteObject(m_hBitmap); - m_hBitmap = hBitmap; - } - - HBITMAP Detach() - { - HBITMAP hBitmap = m_hBitmap; - m_hBitmap = NULL; - return hBitmap; - } - - operator HBITMAP() const { return m_hBitmap; } - - bool IsNull() const { return (m_hBitmap == NULL); } - -// Create and load methods - HBITMAP LoadBitmap(ATL::_U_STRINGorID bitmap) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); - return m_hBitmap; - } - - HBITMAP LoadOEMBitmap(UINT nIDBitmap) // for OBM_/OCR_/OIC_ - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::LoadBitmap(NULL, MAKEINTRESOURCE(nIDBitmap)); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - HBITMAP LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateMappedBitmap(ModuleHelper::GetResourceInstance(), nIDBitmap, (WORD)nFlags, lpColorMap, nMapSize); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - HBITMAP CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitsPerPixel, const void* lpBits) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateBitmap(nWidth, nHeight, nPlanes, nBitsPerPixel, lpBits); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - HBITMAP CreateBitmapIndirect(LPBITMAP lpBitmap) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateBitmapIndirect(lpBitmap); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - HBITMAP CreateCompatibleBitmap(HDC hDC, int nWidth, int nHeight) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateCompatibleBitmap(hDC, nWidth, nHeight); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - HBITMAP CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateDiscardableBitmap(hDC, nWidth, nHeight); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - BOOL DeleteObject() - { - ATLASSERT(m_hBitmap != NULL); - BOOL bRet = ::DeleteObject(m_hBitmap); - if(bRet) - m_hBitmap = NULL; - return bRet; - } - -// Attributes - int GetBitmap(BITMAP* pBitMap) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetObject(m_hBitmap, sizeof(BITMAP), pBitMap); - } - - bool GetBitmap(BITMAP& bm) const - { - ATLASSERT(m_hBitmap != NULL); - return (::GetObject(m_hBitmap, sizeof(BITMAP), &bm) == sizeof(BITMAP)); - } - - bool GetSize(SIZE& size) const - { - ATLASSERT(m_hBitmap != NULL); - BITMAP bm = { 0 }; - if(!GetBitmap(&bm)) - return false; - size.cx = bm.bmWidth; - size.cy = bm.bmHeight; - return true; - } - -#ifndef _WIN32_WCE - DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetBitmapBits(m_hBitmap, dwCount, lpBits); - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - DWORD SetBitmapBits(DWORD dwCount, const void* lpBits) - { - ATLASSERT(m_hBitmap != NULL); - return ::SetBitmapBits(m_hBitmap, dwCount, lpBits); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - -#ifndef _WIN32_WCE - BOOL GetBitmapDimension(LPSIZE lpSize) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetBitmapDimensionEx(m_hBitmap, lpSize); - } - - BOOL SetBitmapDimension(int nWidth, int nHeight, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hBitmap != NULL); - return ::SetBitmapDimensionEx(m_hBitmap, nWidth, nHeight, lpSize); - } - -// DIB support - HBITMAP CreateDIBitmap(HDC hDC, CONST BITMAPINFOHEADER* lpbmih, DWORD dwInit, CONST VOID* lpbInit, CONST BITMAPINFO* lpbmi, UINT uColorUse) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateDIBitmap(hDC, lpbmih, dwInit, lpbInit, lpbmi, uColorUse); - return m_hBitmap; - } -#endif // !_WIN32_WCE - - HBITMAP CreateDIBSection(HDC hDC, CONST BITMAPINFO* lpbmi, UINT uColorUse, VOID** ppvBits, HANDLE hSection, DWORD dwOffset) - { - ATLASSERT(m_hBitmap == NULL); - m_hBitmap = ::CreateDIBSection(hDC, lpbmi, uColorUse, ppvBits, hSection, dwOffset); - return m_hBitmap; - } - -#ifndef _WIN32_WCE - int GetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT uColorUse) const - { - ATLASSERT(m_hBitmap != NULL); - return ::GetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); - } - - int SetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) - { - ATLASSERT(m_hBitmap != NULL); - return ::SetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); - } -#endif // !_WIN32_WCE -}; - -typedef CBitmapT CBitmapHandle; -typedef CBitmapT CBitmap; - - -/////////////////////////////////////////////////////////////////////////////// -// CPalette - -template -class CPaletteT -{ -public: -// Data members - HPALETTE m_hPalette; - -// Constructor/destructor/operators - CPaletteT(HPALETTE hPalette = NULL) : m_hPalette(hPalette) - { } - - ~CPaletteT() - { - if(t_bManaged && m_hPalette != NULL) - DeleteObject(); - } - - CPaletteT& operator =(HPALETTE hPalette) - { - Attach(hPalette); - return *this; - } - - void Attach(HPALETTE hPalette) - { - if(t_bManaged && m_hPalette != NULL && m_hPalette != hPalette) - ::DeleteObject(m_hPalette); - m_hPalette = hPalette; - } - - HPALETTE Detach() - { - HPALETTE hPalette = m_hPalette; - m_hPalette = NULL; - return hPalette; - } - - operator HPALETTE() const { return m_hPalette; } - - bool IsNull() const { return (m_hPalette == NULL); } - -// Create methods - HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette) - { - ATLASSERT(m_hPalette == NULL); - m_hPalette = ::CreatePalette(lpLogPalette); - return m_hPalette; - } - -#ifndef _WIN32_WCE - HPALETTE CreateHalftonePalette(HDC hDC) - { - ATLASSERT(m_hPalette == NULL); - ATLASSERT(hDC != NULL); - m_hPalette = ::CreateHalftonePalette(hDC); - return m_hPalette; - } -#endif // !_WIN32_WCE - - BOOL DeleteObject() - { - ATLASSERT(m_hPalette != NULL); - BOOL bRet = ::DeleteObject(m_hPalette); - if(bRet) - m_hPalette = NULL; - return bRet; - } - -// Attributes - int GetEntryCount() const - { - ATLASSERT(m_hPalette != NULL); - WORD nEntries = 0; - ::GetObject(m_hPalette, sizeof(WORD), &nEntries); - return (int)nEntries; - } - - UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) const - { - ATLASSERT(m_hPalette != NULL); - return ::GetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); - } - - UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) - { - ATLASSERT(m_hPalette != NULL); - return ::SetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); - } - -// Operations -#ifndef _WIN32_WCE - void AnimatePalette(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) - { - ATLASSERT(m_hPalette != NULL); - ::AnimatePalette(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); - } - - BOOL ResizePalette(UINT nNumEntries) - { - ATLASSERT(m_hPalette != NULL); - return ::ResizePalette(m_hPalette, nNumEntries); - } -#endif // !_WIN32_WCE - - UINT GetNearestPaletteIndex(COLORREF crColor) const - { - ATLASSERT(m_hPalette != NULL); - return ::GetNearestPaletteIndex(m_hPalette, crColor); - } -}; - -typedef CPaletteT CPaletteHandle; -typedef CPaletteT CPalette; - - -/////////////////////////////////////////////////////////////////////////////// -// CRgn - -template -class CRgnT -{ -public: -// Data members - HRGN m_hRgn; - -// Constructor/destructor/operators - CRgnT(HRGN hRgn = NULL) : m_hRgn(hRgn) - { } - - ~CRgnT() - { - if(t_bManaged && m_hRgn != NULL) - DeleteObject(); - } - - CRgnT& operator =(HRGN hRgn) - { - Attach(hRgn); - return *this; - } - - void Attach(HRGN hRgn) - { - if(t_bManaged && m_hRgn != NULL && m_hRgn != hRgn) - ::DeleteObject(m_hRgn); - m_hRgn = hRgn; - } - - HRGN Detach() - { - HRGN hRgn = m_hRgn; - m_hRgn = NULL; - return hRgn; - } - - operator HRGN() const { return m_hRgn; } - - bool IsNull() const { return (m_hRgn == NULL); } - -// Create methods - HRGN CreateRectRgn(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateRectRgn(x1, y1, x2, y2); - return m_hRgn; - } - - HRGN CreateRectRgnIndirect(LPCRECT lpRect) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateRectRgnIndirect(lpRect); - return m_hRgn; - } - -#ifndef _WIN32_WCE - HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateEllipticRgn(x1, y1, x2, y2); - return m_hRgn; - } - - HRGN CreateEllipticRgnIndirect(LPCRECT lpRect) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateEllipticRgnIndirect(lpRect); - return m_hRgn; - } - - HRGN CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreatePolygonRgn(lpPoints, nCount, nMode); - return m_hRgn; - } - - HRGN CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode); - return m_hRgn; - } - - HRGN CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3); - return m_hRgn; - } - - HRGN CreateFromPath(HDC hDC) - { - ATLASSERT(m_hRgn == NULL); - ATLASSERT(hDC != NULL); - m_hRgn = ::PathToRegion(hDC); - return m_hRgn; - } - - HRGN CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData) - { - ATLASSERT(m_hRgn == NULL); - m_hRgn = ::ExtCreateRegion(lpXForm, nCount, pRgnData); - return m_hRgn; - } -#endif // !_WIN32_WCE - - BOOL DeleteObject() - { - ATLASSERT(m_hRgn != NULL); - BOOL bRet = ::DeleteObject(m_hRgn); - if(bRet) - m_hRgn = NULL; - return bRet; - } - -// Operations - void SetRectRgn(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hRgn != NULL); - ::SetRectRgn(m_hRgn, x1, y1, x2, y2); - } - - void SetRectRgn(LPCRECT lpRect) - { - ATLASSERT(m_hRgn != NULL); - ::SetRectRgn(m_hRgn, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - - int CombineRgn(HRGN hRgnSrc1, HRGN hRgnSrc2, int nCombineMode) - { - ATLASSERT(m_hRgn != NULL); - return ::CombineRgn(m_hRgn, hRgnSrc1, hRgnSrc2, nCombineMode); - } - - int CombineRgn(HRGN hRgnSrc, int nCombineMode) - { - ATLASSERT(m_hRgn != NULL); - return ::CombineRgn(m_hRgn, m_hRgn, hRgnSrc, nCombineMode); - } - - int CopyRgn(HRGN hRgnSrc) - { - ATLASSERT(m_hRgn != NULL); - return ::CombineRgn(m_hRgn, hRgnSrc, NULL, RGN_COPY); - } - - BOOL EqualRgn(HRGN hRgn) const - { - ATLASSERT(m_hRgn != NULL); - return ::EqualRgn(m_hRgn, hRgn); - } - - int OffsetRgn(int x, int y) - { - ATLASSERT(m_hRgn != NULL); - return ::OffsetRgn(m_hRgn, x, y); - } - - int OffsetRgn(POINT point) - { - ATLASSERT(m_hRgn != NULL); - return ::OffsetRgn(m_hRgn, point.x, point.y); - } - - int GetRgnBox(LPRECT lpRect) const - { - ATLASSERT(m_hRgn != NULL); - return ::GetRgnBox(m_hRgn, lpRect); - } - - BOOL PtInRegion(int x, int y) const - { - ATLASSERT(m_hRgn != NULL); - return ::PtInRegion(m_hRgn, x, y); - } - - BOOL PtInRegion(POINT point) const - { - ATLASSERT(m_hRgn != NULL); - return ::PtInRegion(m_hRgn, point.x, point.y); - } - - BOOL RectInRegion(LPCRECT lpRect) const - { - ATLASSERT(m_hRgn != NULL); - return ::RectInRegion(m_hRgn, lpRect); - } - - int GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const - { - ATLASSERT(m_hRgn != NULL); - return (int)::GetRegionData(m_hRgn, nDataSize, lpRgnData); - } -}; - -typedef CRgnT CRgnHandle; -typedef CRgnT CRgn; - - -/////////////////////////////////////////////////////////////////////////////// -// CDC - The device context class - -template -class CDCT -{ -public: -// Data members - HDC m_hDC; - -// Constructor/destructor/operators - CDCT(HDC hDC = NULL) : m_hDC(hDC) - { - } - - ~CDCT() - { - if(t_bManaged && m_hDC != NULL) - ::DeleteDC(Detach()); - } - - CDCT& operator =(HDC hDC) - { - Attach(hDC); - return *this; - } - - void Attach(HDC hDC) - { - if(t_bManaged && m_hDC != NULL && m_hDC != hDC) - ::DeleteDC(m_hDC); - m_hDC = hDC; - } - - HDC Detach() - { - HDC hDC = m_hDC; - m_hDC = NULL; - return hDC; - } - - operator HDC() const { return m_hDC; } - - bool IsNull() const { return (m_hDC == NULL); } - -// Operations -#ifndef _WIN32_WCE - HWND WindowFromDC() const - { - ATLASSERT(m_hDC != NULL); - return ::WindowFromDC(m_hDC); - } -#endif // !_WIN32_WCE - - CPenHandle GetCurrentPen() const - { - ATLASSERT(m_hDC != NULL); - return CPenHandle((HPEN)::GetCurrentObject(m_hDC, OBJ_PEN)); - } - - CBrushHandle GetCurrentBrush() const - { - ATLASSERT(m_hDC != NULL); - return CBrushHandle((HBRUSH)::GetCurrentObject(m_hDC, OBJ_BRUSH)); - } - - CPaletteHandle GetCurrentPalette() const - { - ATLASSERT(m_hDC != NULL); - return CPaletteHandle((HPALETTE)::GetCurrentObject(m_hDC, OBJ_PAL)); - } - - CFontHandle GetCurrentFont() const - { - ATLASSERT(m_hDC != NULL); - return CFontHandle((HFONT)::GetCurrentObject(m_hDC, OBJ_FONT)); - } - - CBitmapHandle GetCurrentBitmap() const - { - ATLASSERT(m_hDC != NULL); - return CBitmapHandle((HBITMAP)::GetCurrentObject(m_hDC, OBJ_BITMAP)); - } - - HDC CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName, LPCTSTR lpszOutput, const DEVMODE* lpInitData) - { - ATLASSERT(m_hDC == NULL); - m_hDC = ::CreateDC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData); - return m_hDC; - } - - HDC CreateCompatibleDC(HDC hDC = NULL) - { - ATLASSERT(m_hDC == NULL); - m_hDC = ::CreateCompatibleDC(hDC); - return m_hDC; - } - - BOOL DeleteDC() - { - if(m_hDC == NULL) - return FALSE; - BOOL bRet = ::DeleteDC(m_hDC); - if(bRet) - m_hDC = NULL; - return bRet; - } - -// Device-Context Functions - int SaveDC() - { - ATLASSERT(m_hDC != NULL); - return ::SaveDC(m_hDC); - } - - BOOL RestoreDC(int nSavedDC) - { - ATLASSERT(m_hDC != NULL); - return ::RestoreDC(m_hDC, nSavedDC); - } - - int GetDeviceCaps(int nIndex) const - { - ATLASSERT(m_hDC != NULL); - return ::GetDeviceCaps(m_hDC, nIndex); - } - -#ifndef _WIN32_WCE - UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags) - { - ATLASSERT(m_hDC != NULL); - return ::SetBoundsRect(m_hDC, lpRectBounds, flags); - } - - UINT GetBoundsRect(LPRECT lpRectBounds, UINT flags) const - { - ATLASSERT(m_hDC != NULL); - return ::GetBoundsRect(m_hDC, lpRectBounds, flags); - } - - BOOL ResetDC(const DEVMODE* lpDevMode) - { - ATLASSERT(m_hDC != NULL); - return ::ResetDC(m_hDC, lpDevMode) != NULL; - } - -// Drawing-Tool Functions - BOOL GetBrushOrg(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetBrushOrgEx(m_hDC, lpPoint); - } -#endif // !_WIN32_WCE - - BOOL SetBrushOrg(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetBrushOrgEx(m_hDC, x, y, lpPoint); - } - - BOOL SetBrushOrg(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetBrushOrgEx(m_hDC, point.x, point.y, lpPointRet); - } - -#ifndef _WIN32_WCE - int EnumObjects(int nObjectType, int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData) - { - ATLASSERT(m_hDC != NULL); -#ifdef STRICT - return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, lpData); -#else - return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, (LPVOID)lpData); -#endif - } -#endif // !_WIN32_WCE - -// Type-safe selection helpers - HPEN SelectPen(HPEN hPen) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN || ::GetObjectType(hPen) == OBJ_EXTPEN); -#else // CE specific - ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN); -#endif // _WIN32_WCE - return (HPEN)::SelectObject(m_hDC, hPen); - } - - HBRUSH SelectBrush(HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hBrush == NULL || ::GetObjectType(hBrush) == OBJ_BRUSH); - return (HBRUSH)::SelectObject(m_hDC, hBrush); - } - - HFONT SelectFont(HFONT hFont) - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hFont == NULL || ::GetObjectType(hFont) == OBJ_FONT); - return (HFONT)::SelectObject(m_hDC, hFont); - } - - HBITMAP SelectBitmap(HBITMAP hBitmap) - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hBitmap == NULL || ::GetObjectType(hBitmap) == OBJ_BITMAP); - return (HBITMAP)::SelectObject(m_hDC, hBitmap); - } - - int SelectRgn(HRGN hRgn) // special return for regions - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(hRgn == NULL || ::GetObjectType(hRgn) == OBJ_REGION); - return PtrToInt(::SelectObject(m_hDC, hRgn)); - } - -// Type-safe selection helpers for stock objects - HPEN SelectStockPen(int nPen) - { - ATLASSERT(m_hDC != NULL); -#if (_WIN32_WINNT >= 0x0500) - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); -#else - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); -#endif // !(_WIN32_WINNT >= 0x0500) - return SelectPen((HPEN)::GetStockObject(nPen)); - } - - HBRUSH SelectStockBrush(int nBrush) - { -#if (_WIN32_WINNT >= 0x0500) - ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); -#else - ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); -#endif // !(_WIN32_WINNT >= 0x0500) - return SelectBrush((HBRUSH)::GetStockObject(nBrush)); - } - - HFONT SelectStockFont(int nFont) - { -#ifndef _WIN32_WCE - ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); -#else // CE specific - ATLASSERT(nFont == SYSTEM_FONT); -#endif // _WIN32_WCE - return SelectFont((HFONT)::GetStockObject(nFont)); - } - - HPALETTE SelectStockPalette(int nPalette, BOOL bForceBackground) - { - ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported - return SelectPalette((HPALETTE)::GetStockObject(nPalette), bForceBackground); - } - -// Color and Color Palette Functions - COLORREF GetNearestColor(COLORREF crColor) const - { - ATLASSERT(m_hDC != NULL); - return ::GetNearestColor(m_hDC, crColor); - } - - HPALETTE SelectPalette(HPALETTE hPalette, BOOL bForceBackground) - { - ATLASSERT(m_hDC != NULL); - - return ::SelectPalette(m_hDC, hPalette, bForceBackground); - } - - UINT RealizePalette() - { - ATLASSERT(m_hDC != NULL); - return ::RealizePalette(m_hDC); - } - -#ifndef _WIN32_WCE - void UpdateColors() - { - ATLASSERT(m_hDC != NULL); - ::UpdateColors(m_hDC); - } -#endif // !_WIN32_WCE - -// Drawing-Attribute Functions - COLORREF GetBkColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetBkColor(m_hDC); - } - - int GetBkMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetBkMode(m_hDC); - } - -#ifndef _WIN32_WCE - int GetPolyFillMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetPolyFillMode(m_hDC); - } - - int GetROP2() const - { - ATLASSERT(m_hDC != NULL); - return ::GetROP2(m_hDC); - } - - int GetStretchBltMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetStretchBltMode(m_hDC); - } -#endif // !_WIN32_WCE - - COLORREF GetTextColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextColor(m_hDC); - } - - COLORREF SetBkColor(COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetBkColor(m_hDC, crColor); - } - - int SetBkMode(int nBkMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetBkMode(m_hDC, nBkMode); - } - -#ifndef _WIN32_WCE - int SetPolyFillMode(int nPolyFillMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetPolyFillMode(m_hDC, nPolyFillMode); - } -#endif // !_WIN32_WCE - - int SetROP2(int nDrawMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetROP2(m_hDC, nDrawMode); - } - -#ifndef _WIN32_WCE - int SetStretchBltMode(int nStretchMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetStretchBltMode(m_hDC, nStretchMode); - } -#endif // !_WIN32_WCE - - COLORREF SetTextColor(COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextColor(m_hDC, crColor); - } - -#ifndef _WIN32_WCE - BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const - { - ATLASSERT(m_hDC != NULL); - return ::GetColorAdjustment(m_hDC, lpColorAdjust); - } - - BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust) - { - ATLASSERT(m_hDC != NULL); - return ::SetColorAdjustment(m_hDC, lpColorAdjust); - } - -// Mapping Functions - int GetMapMode() const - { - ATLASSERT(m_hDC != NULL); - return ::GetMapMode(m_hDC); - } - - BOOL GetViewportOrg(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetViewportOrgEx(m_hDC, lpPoint); - } - - int SetMapMode(int nMapMode) - { - ATLASSERT(m_hDC != NULL); - return ::SetMapMode(m_hDC, nMapMode); - } -#endif // !_WIN32_WCE - - // Viewport Origin - BOOL SetViewportOrg(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetViewportOrgEx(m_hDC, x, y, lpPoint); - } - - BOOL SetViewportOrg(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetViewportOrg(point.x, point.y, lpPointRet); - } - -#ifndef _WIN32_WCE - BOOL OffsetViewportOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetViewportOrgEx(m_hDC, nWidth, nHeight, lpPoint); - } - - // Viewport Extent - BOOL GetViewportExt(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetViewportExtEx(m_hDC, lpSize); - } - - BOOL SetViewportExt(int x, int y, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetViewportExtEx(m_hDC, x, y, lpSize); - } - - BOOL SetViewportExt(SIZE size, LPSIZE lpSizeRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetViewportExt(size.cx, size.cy, lpSizeRet); - } - - BOOL ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::ScaleViewportExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); - } -#endif // !_WIN32_WCE - - // Window Origin -#ifndef _WIN32_WCE - BOOL GetWindowOrg(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetWindowOrgEx(m_hDC, lpPoint); - } - - BOOL SetWindowOrg(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetWindowOrgEx(m_hDC, x, y, lpPoint); - } - - BOOL SetWindowOrg(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetWindowOrg(point.x, point.y, lpPointRet); - } - - BOOL OffsetWindowOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetWindowOrgEx(m_hDC, nWidth, nHeight, lpPoint); - } - - // Window extent - BOOL GetWindowExt(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetWindowExtEx(m_hDC, lpSize); - } - - BOOL SetWindowExt(int x, int y, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::SetWindowExtEx(m_hDC, x, y, lpSize); - } - - BOOL SetWindowExt(SIZE size, LPSIZE lpSizeRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return SetWindowExt(size.cx, size.cy, lpSizeRet); - } - - BOOL ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::ScaleWindowExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); - } - -// Coordinate Functions - BOOL DPtoLP(LPPOINT lpPoints, int nCount = 1) const - { - ATLASSERT(m_hDC != NULL); - return ::DPtoLP(m_hDC, lpPoints, nCount); - } - - BOOL DPtoLP(LPRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::DPtoLP(m_hDC, (LPPOINT)lpRect, 2); - } - - BOOL DPtoLP(LPSIZE lpSize) const - { - SIZE sizeWinExt = { 0, 0 }; - if(!GetWindowExt(&sizeWinExt)) - return FALSE; - SIZE sizeVpExt = { 0, 0 }; - if(!GetViewportExt(&sizeVpExt)) - return FALSE; - lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeWinExt.cx), abs(sizeVpExt.cx)); - lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeWinExt.cy), abs(sizeVpExt.cy)); - return TRUE; - } - - BOOL LPtoDP(LPPOINT lpPoints, int nCount = 1) const - { - ATLASSERT(m_hDC != NULL); - return ::LPtoDP(m_hDC, lpPoints, nCount); - } - - BOOL LPtoDP(LPRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::LPtoDP(m_hDC, (LPPOINT)lpRect, 2); - } - - BOOL LPtoDP(LPSIZE lpSize) const - { - SIZE sizeWinExt = { 0, 0 }; - if(!GetWindowExt(&sizeWinExt)) - return FALSE; - SIZE sizeVpExt = { 0, 0 }; - if(!GetViewportExt(&sizeVpExt)) - return FALSE; - lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeVpExt.cx), abs(sizeWinExt.cx)); - lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeVpExt.cy), abs(sizeWinExt.cy)); - return TRUE; - } - -// Special Coordinate Functions (useful for dealing with metafiles and OLE) - #define HIMETRIC_INCH 2540 // HIMETRIC units per inch - - void DPtoHIMETRIC(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - int nMapMode; - if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) - { - // when using a constrained map mode, map against physical inch - ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); - DPtoLP(lpSize); - ((CDCHandle*)this)->SetMapMode(nMapMode); - } - else - { - // map against logical inch for non-constrained mapping modes - int cxPerInch = GetDeviceCaps(LOGPIXELSX); - int cyPerInch = GetDeviceCaps(LOGPIXELSY); - ATLASSERT(cxPerInch != 0 && cyPerInch != 0); - lpSize->cx = ::MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch); - lpSize->cy = ::MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch); - } - } - - void HIMETRICtoDP(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - int nMapMode; - if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) - { - // when using a constrained map mode, map against physical inch - ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); - LPtoDP(lpSize); - ((CDCHandle*)this)->SetMapMode(nMapMode); - } - else - { - // map against logical inch for non-constrained mapping modes - int cxPerInch = GetDeviceCaps(LOGPIXELSX); - int cyPerInch = GetDeviceCaps(LOGPIXELSY); - ATLASSERT(cxPerInch != 0 && cyPerInch != 0); - lpSize->cx = ::MulDiv(lpSize->cx, cxPerInch, HIMETRIC_INCH); - lpSize->cy = ::MulDiv(lpSize->cy, cyPerInch, HIMETRIC_INCH); - } - } - - void LPtoHIMETRIC(LPSIZE lpSize) const - { - LPtoDP(lpSize); - DPtoHIMETRIC(lpSize); - } - - void HIMETRICtoLP(LPSIZE lpSize) const - { - HIMETRICtoDP(lpSize); - DPtoLP(lpSize); - } -#endif // !_WIN32_WCE - -// Region Functions - BOOL FillRgn(HRGN hRgn, HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - return ::FillRgn(m_hDC, hRgn, hBrush); - } - -#ifndef _WIN32_WCE - BOOL FrameRgn(HRGN hRgn, HBRUSH hBrush, int nWidth, int nHeight) - { - ATLASSERT(m_hDC != NULL); - return ::FrameRgn(m_hDC, hRgn, hBrush, nWidth, nHeight); - } - - BOOL InvertRgn(HRGN hRgn) - { - ATLASSERT(m_hDC != NULL); - return ::InvertRgn(m_hDC, hRgn); - } - - BOOL PaintRgn(HRGN hRgn) - { - ATLASSERT(m_hDC != NULL); - return ::PaintRgn(m_hDC, hRgn); - } -#endif // !_WIN32_WCE - -// Clipping Functions - int GetClipBox(LPRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::GetClipBox(m_hDC, lpRect); - } - - int GetClipRgn(CRgn& region) const - { - ATLASSERT(m_hDC != NULL); - if(region.IsNull()) - region.CreateRectRgn(0, 0, 0, 0); - - int nRet = ::GetClipRgn(m_hDC, region); - if(nRet != 1) - region.DeleteObject(); - - return nRet; - } - -#ifndef _WIN32_WCE - BOOL PtVisible(int x, int y) const - { - ATLASSERT(m_hDC != NULL); - return ::PtVisible(m_hDC, x, y); - } - - BOOL PtVisible(POINT point) const - { - ATLASSERT(m_hDC != NULL); - return ::PtVisible(m_hDC, point.x, point.y); - } -#endif // !_WIN32_WCE - - BOOL RectVisible(LPCRECT lpRect) const - { - ATLASSERT(m_hDC != NULL); - return ::RectVisible(m_hDC, lpRect); - } - - int SelectClipRgn(HRGN hRgn) - { - ATLASSERT(m_hDC != NULL); - return ::SelectClipRgn(m_hDC, (HRGN)hRgn); - } - - int ExcludeClipRect(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::ExcludeClipRect(m_hDC, x1, y1, x2, y2); - } - - int ExcludeClipRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::ExcludeClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - -#ifndef _WIN32_WCE - int ExcludeUpdateRgn(HWND hWnd) - { - ATLASSERT(m_hDC != NULL); - return ::ExcludeUpdateRgn(m_hDC, hWnd); - } -#endif // !_WIN32_WCE - - int IntersectClipRect(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::IntersectClipRect(m_hDC, x1, y1, x2, y2); - } - - int IntersectClipRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::IntersectClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - -#ifndef _WIN32_WCE - int OffsetClipRgn(int x, int y) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetClipRgn(m_hDC, x, y); - } - - int OffsetClipRgn(SIZE size) - { - ATLASSERT(m_hDC != NULL); - return ::OffsetClipRgn(m_hDC, size.cx, size.cy); - } - - int SelectClipRgn(HRGN hRgn, int nMode) - { - ATLASSERT(m_hDC != NULL); - return ::ExtSelectClipRgn(m_hDC, hRgn, nMode); - } -#endif // !_WIN32_WCE - -// Line-Output Functions -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - BOOL GetCurrentPosition(LPPOINT lpPoint) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCurrentPositionEx(m_hDC, lpPoint); - } - - BOOL MoveTo(int x, int y, LPPOINT lpPoint = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::MoveToEx(m_hDC, x, y, lpPoint); - } - - BOOL MoveTo(POINT point, LPPOINT lpPointRet = NULL) - { - ATLASSERT(m_hDC != NULL); - return MoveTo(point.x, point.y, lpPointRet); - } - - BOOL LineTo(int x, int y) - { - ATLASSERT(m_hDC != NULL); - return ::LineTo(m_hDC, x, y); - } - - BOOL LineTo(POINT point) - { - ATLASSERT(m_hDC != NULL); - return LineTo(point.x, point.y); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - -#ifndef _WIN32_WCE - BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ::Arc(m_hDC, lpRect->left, lpRect->top, - lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, - ptEnd.x, ptEnd.y); - } -#endif // !_WIN32_WCE - - BOOL Polyline(LPPOINT lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::Polyline(m_hDC, lpPoints, nCount); - } - -#ifndef _WIN32_WCE - BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle) - { - ATLASSERT(m_hDC != NULL); - return ::AngleArc(m_hDC, x, y, nRadius, fStartAngle, fSweepAngle); - } - - BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::ArcTo(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ArcTo(lpRect->left, lpRect->top, lpRect->right, - lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); - } - - int GetArcDirection() const - { - ATLASSERT(m_hDC != NULL); - return ::GetArcDirection(m_hDC); - } - - int SetArcDirection(int nArcDirection) - { - ATLASSERT(m_hDC != NULL); - return ::SetArcDirection(m_hDC, nArcDirection); - } - - BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyDraw(m_hDC, lpPoints, lpTypes, nCount); - } - - BOOL PolylineTo(const POINT* lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolylineTo(m_hDC, lpPoints, nCount); - } - - BOOL PolyPolyline(const POINT* lpPoints, - const DWORD* lpPolyPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyPolyline(m_hDC, lpPoints, lpPolyPoints, nCount); - } - - BOOL PolyBezier(const POINT* lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyBezier(m_hDC, lpPoints, nCount); - } - - BOOL PolyBezierTo(const POINT* lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyBezierTo(m_hDC, lpPoints, nCount); - } -#endif // !_WIN32_WCE - -// Simple Drawing Functions - BOOL FillRect(LPCRECT lpRect, HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - return ::FillRect(m_hDC, lpRect, hBrush); - } - - BOOL FillRect(LPCRECT lpRect, int nColorIndex) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - return ::FillRect(m_hDC, lpRect, (HBRUSH)LongToPtr(nColorIndex + 1)); -#else // CE specific - return ::FillRect(m_hDC, lpRect, ::GetSysColorBrush(nColorIndex)); -#endif // _WIN32_WCE - } - -#ifndef _WIN32_WCE - BOOL FrameRect(LPCRECT lpRect, HBRUSH hBrush) - { - ATLASSERT(m_hDC != NULL); - return ::FrameRect(m_hDC, lpRect, hBrush); - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - BOOL InvertRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::InvertRect(m_hDC, lpRect); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - - BOOL DrawIcon(int x, int y, HICON hIcon) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(m_hDC, x, y, hIcon); -#else // CE specific - return ::DrawIconEx(m_hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIcon(POINT point, HICON hIcon) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(m_hDC, point.x, point.y, hIcon); -#else // CE specific - return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIconEx(int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawIconEx(m_hDC, x, y, hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - - BOOL DrawIconEx(POINT point, HICON hIcon, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - -#ifndef _WIN32_WCE - BOOL DrawState(POINT pt, SIZE size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hBitmap, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_BITMAP); - } - - BOOL DrawState(POINT pt, SIZE size, HICON hIcon, UINT nFlags, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_ICON); - } - - BOOL DrawState(POINT pt, SIZE size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags | (bPrefixText ? DST_PREFIXTEXT : DST_TEXT)); - } - - BOOL DrawState(POINT pt, SIZE size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, HBRUSH hBrush = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawState(m_hDC, hBrush, lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_COMPLEX); - } -#endif // !_WIN32_WCE - -// Ellipse and Polygon Functions -#ifndef _WIN32_WCE - BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ::Chord(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); - } -#endif // !_WIN32_WCE - - void DrawFocusRect(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - ::DrawFocusRect(m_hDC, lpRect); - } - - BOOL Ellipse(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::Ellipse(m_hDC, x1, y1, x2, y2); - } - - BOOL Ellipse(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::Ellipse(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - -#ifndef _WIN32_WCE - BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) - { - ATLASSERT(m_hDC != NULL); - return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); - } - - BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd) - { - ATLASSERT(m_hDC != NULL); - return ::Pie(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); - } -#endif // !_WIN32_WCE - - BOOL Polygon(LPPOINT lpPoints, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::Polygon(m_hDC, lpPoints, nCount); - } - -#ifndef _WIN32_WCE - BOOL PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount) - { - ATLASSERT(m_hDC != NULL); - return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); - } -#endif // !_WIN32_WCE - - BOOL Rectangle(int x1, int y1, int x2, int y2) - { - ATLASSERT(m_hDC != NULL); - return ::Rectangle(m_hDC, x1, y1, x2, y2); - } - - BOOL Rectangle(LPCRECT lpRect) - { - ATLASSERT(m_hDC != NULL); - return ::Rectangle(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); - } - - BOOL RoundRect(int x1, int y1, int x2, int y2, int x3, int y3) - { - ATLASSERT(m_hDC != NULL); - return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3); - } - - BOOL RoundRect(LPCRECT lpRect, POINT point) - { - ATLASSERT(m_hDC != NULL); - return ::RoundRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, point.x, point.y); - } - -// Bitmap Functions - BOOL PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop); - } - - BOOL BitBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, - int xSrc, int ySrc, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::BitBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, dwRop); - } - - BOOL StretchBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::StretchBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwRop); - } - - COLORREF GetPixel(int x, int y) const - { - ATLASSERT(m_hDC != NULL); - return ::GetPixel(m_hDC, x, y); - } - - COLORREF GetPixel(POINT point) const - { - ATLASSERT(m_hDC != NULL); - return ::GetPixel(m_hDC, point.x, point.y); - } - - COLORREF SetPixel(int x, int y, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixel(m_hDC, x, y, crColor); - } - - COLORREF SetPixel(POINT point, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixel(m_hDC, point.x, point.y, crColor); - } - -#ifndef _WIN32_WCE - BOOL FloodFill(int x, int y, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::FloodFill(m_hDC, x, y, crColor); - } - - BOOL ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType) - { - ATLASSERT(m_hDC != NULL); - return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); - } -#endif // !_WIN32_WCE - - BOOL MaskBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, HBITMAP hMaskBitmap, int xMask, int yMask, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, hMaskBitmap, xMask, yMask, dwRop); - } - -#ifndef _WIN32_WCE - BOOL PlgBlt(LPPOINT lpPoint, HDC hSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, HBITMAP hMaskBitmap, int xMask, int yMask) - { - ATLASSERT(m_hDC != NULL); - return ::PlgBlt(m_hDC, lpPoint, hSrcDC, xSrc, ySrc, nWidth, nHeight, hMaskBitmap, xMask, yMask); - } - - BOOL SetPixelV(int x, int y, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixelV(m_hDC, x, y, crColor); - } - - BOOL SetPixelV(POINT point, COLORREF crColor) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixelV(m_hDC, point.x, point.y, crColor); - } -#endif // !_WIN32_WCE - -#if !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) -#ifndef _WIN32_WCE - BOOL TransparentBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) - { - ATLASSERT(m_hDC != NULL); - return ::TransparentBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); - } -#else // CE specific - BOOL TransparentImage(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) - { - ATLASSERT(m_hDC != NULL); - return ::TransparentImage(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); - } -#endif // _WIN32_WCE - -#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420)) - BOOL GradientFill(const PTRIVERTEX pVertices, DWORD nVertices, void* pMeshElements, DWORD nMeshElements, DWORD dwMode) - { - ATLASSERT(m_hDC != NULL); - return ::GradientFill(m_hDC, pVertices, nVertices, pMeshElements, nMeshElements, dwMode); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - -#if !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) - BOOL AlphaBlend(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BLENDFUNCTION bf) - { - ATLASSERT(m_hDC != NULL); - return ::AlphaBlend(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) -#endif // !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) - -// Extra bitmap functions - // Helper function for painting a disabled toolbar or menu bitmap - // This function can take either an HBITMAP (for SS) or a DC with - // the bitmap already painted (for cmdbar) - BOOL DitherBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, HBITMAP hBitmap, int xSrc, int ySrc, - HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), - HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), - HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) - { - ATLASSERT(m_hDC != NULL || hBitmap != NULL); - ATLASSERT(nWidth > 0 && nHeight > 0); - - // Create a generic DC for all BitBlts - CDCHandle dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC); - ATLASSERT(dc.m_hDC != NULL); - if(dc.m_hDC == NULL) - return FALSE; - - // Create a DC for the monochrome DIB section - CDC dcBW = ::CreateCompatibleDC(m_hDC); - ATLASSERT(dcBW.m_hDC != NULL); - if(dcBW.m_hDC == NULL) - { - if(hSrcDC == NULL) - dc.DeleteDC(); - return FALSE; - } - - // Create the monochrome DIB section with a black and white palette - struct RGBBWBITMAPINFO - { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[2]; - }; - - RGBBWBITMAPINFO rgbBWBitmapInfo = - { - { sizeof(BITMAPINFOHEADER), nWidth, nHeight, 1, 1, BI_RGB, 0, 0, 0, 0, 0 }, - { { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 } } - }; - - VOID* pbitsBW; - CBitmap bmpBW = ::CreateDIBSection(dcBW, (LPBITMAPINFO)&rgbBWBitmapInfo, DIB_RGB_COLORS, &pbitsBW, NULL, 0); - ATLASSERT(bmpBW.m_hBitmap != NULL); - if(bmpBW.m_hBitmap == NULL) - { - if(hSrcDC == NULL) - dc.DeleteDC(); - return FALSE; - } - - // Attach the monochrome DIB section and the bitmap to the DCs - HBITMAP hbmOldBW = dcBW.SelectBitmap(bmpBW); - HBITMAP hbmOldDC = NULL; - if(hBitmap != NULL) - hbmOldDC = dc.SelectBitmap(hBitmap); - - // Block: Dark gray removal: we want (128, 128, 128) pixels to become black and not white - { - CDC dcTemp1 = ::CreateCompatibleDC(m_hDC); - CDC dcTemp2 = ::CreateCompatibleDC(m_hDC); - CBitmap bmpTemp1; - bmpTemp1.CreateCompatibleBitmap(dc, nWidth, nHeight); - CBitmap bmpTemp2; - bmpTemp2.CreateBitmap(nWidth, nHeight, 1, 1, NULL); - HBITMAP hOldBmp1 = dcTemp1.SelectBitmap(bmpTemp1); - HBITMAP hOldBmp2 = dcTemp2.SelectBitmap(bmpTemp2); - // Let's copy our image, it will be altered - dcTemp1.BitBlt(0, 0, nWidth, nHeight, dc, xSrc, ySrc, SRCCOPY); - - // All dark gray pixels will become white, the others black - dcTemp1.SetBkColor(RGB(128, 128, 128)); - dcTemp2.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); - // Do an XOR to set to black these white pixels - dcTemp1.BitBlt(0, 0, nWidth, nHeight, dcTemp2, 0, 0, SRCINVERT); - - // BitBlt the bitmap into the monochrome DIB section - // The DIB section will do a true monochrome conversion - // The magenta background being closer to white will become white - dcBW.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); - - // Cleanup - dcTemp1.SelectBitmap(hOldBmp1); - dcTemp2.SelectBitmap(hOldBmp2); - } - - // Paint the destination rectangle using hBrushBackground - if(hBrushBackground != NULL) - { - RECT rc = { x, y, x + nWidth, y + nHeight }; - FillRect(&rc, hBrushBackground); - } - - // BitBlt the black bits in the monochrome bitmap into hBrush3DEffect color in the destination DC - // The magic ROP comes from the Charles Petzold's book - HBRUSH hOldBrush = SelectBrush(hBrush3DEffect); - BitBlt(x + 1, y + 1, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); - - // BitBlt the black bits in the monochrome bitmap into hBrushDisabledImage color in the destination DC - SelectBrush(hBrushDisabledImage); - BitBlt(x, y, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); - - SelectBrush(hOldBrush); - dcBW.SelectBitmap(hbmOldBW); - dc.SelectBitmap(hbmOldDC); - - if(hSrcDC == NULL) - dc.DeleteDC(); - - return TRUE; - } - -// Text Functions -#ifndef _WIN32_WCE - BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount = -1) - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::TextOut(m_hDC, x, y, lpszString, nCount); - } -#endif // !_WIN32_WCE - - BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, UINT nCount = -1, LPINT lpDxWidths = NULL) - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect, lpszString, nCount, lpDxWidths); - } - -#ifndef _WIN32_WCE - SIZE TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL, int nTabOrigin = 0) - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - LONG lRes = ::TabbedTextOut(m_hDC, x, y, lpszString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin); - SIZE size = { GET_X_LPARAM(lRes), GET_Y_LPARAM(lRes) }; - return size; - } -#endif // !_WIN32_WCE - - int DrawText(LPCTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) - { - ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - ATLASSERT((uFormat & DT_MODIFYSTRING) == 0); -#endif // !_WIN32_WCE - return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); - } - - int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) - { - ATLASSERT(m_hDC != NULL); - return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); - } - -#ifndef _WIN32_WCE - int DrawTextEx(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::DrawTextEx(m_hDC, lpstrText, cchText, lpRect, uFormat, lpDTParams); - } -#endif // !_WIN32_WCE - -#if (_WIN32_WINNT >= 0x0501) - int DrawShadowText(LPCWSTR lpstrText, int cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset) - { - ATLASSERT(m_hDC != NULL); - // This function is present only if comctl32.dll version 6 is loaded; - // we use LoadLibrary/GetProcAddress to allow apps compiled with - // _WIN32_WINNT >= 0x0501 to run on older Windows/CommCtrl - int nRet = 0; - HMODULE hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - ATLASSERT(hCommCtrlDLL != NULL); - if(hCommCtrlDLL != NULL) - { - typedef int (WINAPI *PFN_DrawShadowText)(HDC hDC, LPCWSTR lpstrText, UINT cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset); - PFN_DrawShadowText pfnDrawShadowText = (PFN_DrawShadowText)::GetProcAddress(hCommCtrlDLL, "DrawShadowText"); - ATLASSERT(pfnDrawShadowText != NULL); // this function requires CommCtrl6 - if(pfnDrawShadowText != NULL) - nRet = pfnDrawShadowText(m_hDC, lpstrText, cchText, lpRect, dwFlags, clrText, clrShadow, xOffset, yOffset); - ::FreeLibrary(hCommCtrlDLL); - } - return nRet; - } -#endif // (_WIN32_WINNT >= 0x0501) - - BOOL GetTextExtent(LPCTSTR lpszString, int nCount, LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::GetTextExtentPoint32(m_hDC, lpszString, nCount, lpSize); - } - - BOOL GetTextExtentExPoint(LPCTSTR lpszString, int cchString, LPSIZE lpSize, int nMaxExtent, LPINT lpnFit = NULL, LPINT alpDx = NULL) - { - ATLASSERT(m_hDC != NULL); - return ::GetTextExtentExPoint(m_hDC, lpszString, cchString, nMaxExtent, lpnFit, alpDx, lpSize); - } - -#ifndef _WIN32_WCE - DWORD GetTabbedTextExtent(LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL) const - { - ATLASSERT(m_hDC != NULL); - if(nCount == -1) - nCount = lstrlen(lpszString); - return ::GetTabbedTextExtent(m_hDC, lpszString, nCount, nTabPositions, lpnTabStopPositions); - } - - BOOL GrayString(HBRUSH hBrush, BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int), LPARAM lpData, int nCount, int x, int y, int nWidth, int nHeight) - { - ATLASSERT(m_hDC != NULL); - return ::GrayString(m_hDC, hBrush, (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - UINT GetTextAlign() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextAlign(m_hDC); - } - - UINT SetTextAlign(UINT nFlags) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextAlign(m_hDC, nFlags); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - - int GetTextFace(LPTSTR lpszFacename, int nCount) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextFace(m_hDC, nCount, lpszFacename); - } - - int GetTextFaceLen() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextFace(m_hDC, 0, NULL); - } - -#ifndef _ATL_NO_COM -#ifdef _OLEAUTO_H_ - BOOL GetTextFace(BSTR& bstrFace) const - { - USES_CONVERSION; - ATLASSERT(m_hDC != NULL); - ATLASSERT(bstrFace == NULL); - - int nLen = GetTextFaceLen(); - if(nLen == 0) - return FALSE; - - CTempBuffer buff; - LPTSTR lpszText = buff.Allocate(nLen); - if(lpszText == NULL) - return FALSE; - - if(!GetTextFace(lpszText, nLen)) - return FALSE; - - bstrFace = ::SysAllocString(T2OLE(lpszText)); - return (bstrFace != NULL) ? TRUE : FALSE; - } -#endif -#endif // !_ATL_NO_COM - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetTextFace(_CSTRING_NS::CString& strFace) const - { - ATLASSERT(m_hDC != NULL); - - int nLen = GetTextFaceLen(); - if(nLen == 0) - return 0; - - LPTSTR lpstr = strFace.GetBufferSetLength(nLen); - if(lpstr == NULL) - return 0; - int nRet = GetTextFace(lpstr, nLen); - strFace.ReleaseBuffer(); - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL GetTextMetrics(LPTEXTMETRIC lpMetrics) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextMetrics(m_hDC, lpMetrics); - } - -#ifndef _WIN32_WCE - int SetTextJustification(int nBreakExtra, int nBreakCount) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextJustification(m_hDC, nBreakExtra, nBreakCount); - } - - int GetTextCharacterExtra() const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextCharacterExtra(m_hDC); - } - - int SetTextCharacterExtra(int nCharExtra) - { - ATLASSERT(m_hDC != NULL); - return ::SetTextCharacterExtra(m_hDC, nCharExtra); - } -#endif // !_WIN32_WCE - -// Advanced Drawing - BOOL DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags) - { - ATLASSERT(m_hDC != NULL); - return ::DrawEdge(m_hDC, lpRect, nEdge, nFlags); - } - - BOOL DrawFrameControl(LPRECT lpRect, UINT nType, UINT nState) - { - ATLASSERT(m_hDC != NULL); - return ::DrawFrameControl(m_hDC, lpRect, nType, nState); - } - -// Scrolling Functions - BOOL ScrollDC(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate) - { - ATLASSERT(m_hDC != NULL); - return ::ScrollDC(m_hDC, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate); - } - -// Font Functions -#ifndef _WIN32_WCE - BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidth(m_hDC, nFirstChar, nLastChar, lpBuffer); - } - - // GetCharWidth32 is not supported under Win9x - BOOL GetCharWidth32(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidth32(m_hDC, nFirstChar, nLastChar, lpBuffer); - } - - DWORD SetMapperFlags(DWORD dwFlag) - { - ATLASSERT(m_hDC != NULL); - return ::SetMapperFlags(m_hDC, dwFlag); - } - - BOOL GetAspectRatioFilter(LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetAspectRatioFilterEx(m_hDC, lpSize); - } - - BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABC lpabc) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharABCWidths(m_hDC, nFirstChar, nLastChar, lpabc); - } - - DWORD GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData, DWORD cbData) const - { - ATLASSERT(m_hDC != NULL); - return ::GetFontData(m_hDC, dwTable, dwOffset, lpData, cbData); - } - - int GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const - { - ATLASSERT(m_hDC != NULL); - return ::GetKerningPairs(m_hDC, nPairs, lpkrnpair); - } - - UINT GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const - { - ATLASSERT(m_hDC != NULL); - return ::GetOutlineTextMetrics(m_hDC, cbData, lpotm); - } - - DWORD GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpBuffer, const MAT2* lpmat2) const - { - ATLASSERT(m_hDC != NULL); - return ::GetGlyphOutline(m_hDC, nChar, nFormat, lpgm, cbBuffer, lpBuffer, lpmat2); - } - - BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABCFLOAT lpABCF) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharABCWidthsFloat(m_hDC, nFirstChar, nLastChar, lpABCF); - } - - BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, float* lpFloatBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidthFloat(m_hDC, nFirstChar, nLastChar, lpFloatBuffer); - } -#endif // !_WIN32_WCE - -// Printer/Device Escape Functions -#ifndef _WIN32_WCE - int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData) - { - ATLASSERT(m_hDC != NULL); - return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData); - } -#endif // !_WIN32_WCE - - int Escape(int nEscape, int nInputSize, LPCSTR lpszInputData, - int nOutputSize, LPSTR lpszOutputData) - { - ATLASSERT(m_hDC != NULL); - return ::ExtEscape(m_hDC, nEscape, nInputSize, lpszInputData, nOutputSize, lpszOutputData); - } - -#ifndef _WIN32_WCE - int DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData) - { - ATLASSERT(m_hDC != NULL); - return ::DrawEscape(m_hDC, nEscape, nInputSize, lpszInputData); - } -#endif // !_WIN32_WCE - - // Escape helpers -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) - int StartDoc(LPCTSTR lpszDocName) // old Win3.0 version - { - DOCINFO di = { 0 }; - di.cbSize = sizeof(DOCINFO); - di.lpszDocName = lpszDocName; - return StartDoc(&di); - } - - int StartDoc(LPDOCINFO lpDocInfo) - { - ATLASSERT(m_hDC != NULL); - return ::StartDoc(m_hDC, lpDocInfo); - } - - int StartPage() - { - ATLASSERT(m_hDC != NULL); - return ::StartPage(m_hDC); - } - - int EndPage() - { - ATLASSERT(m_hDC != NULL); - return ::EndPage(m_hDC); - } - - int SetAbortProc(BOOL (CALLBACK* lpfn)(HDC, int)) - { - ATLASSERT(m_hDC != NULL); - return ::SetAbortProc(m_hDC, (ABORTPROC)lpfn); - } - - int AbortDoc() - { - ATLASSERT(m_hDC != NULL); - return ::AbortDoc(m_hDC); - } - - int EndDoc() - { - ATLASSERT(m_hDC != NULL); - return ::EndDoc(m_hDC); - } -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) - -// MetaFile Functions -#ifndef _WIN32_WCE - BOOL PlayMetaFile(HMETAFILE hMF) - { - ATLASSERT(m_hDC != NULL); - if(::GetDeviceCaps(m_hDC, TECHNOLOGY) == DT_METAFILE) - { - // playing metafile in metafile, just use core windows API - return ::PlayMetaFile(m_hDC, hMF); - } - - // for special playback, lParam == pDC - return ::EnumMetaFile(m_hDC, hMF, EnumMetaFileProc, (LPARAM)this); - } - - BOOL PlayMetaFile(HENHMETAFILE hEnhMetaFile, LPCRECT lpBounds) - { - ATLASSERT(m_hDC != NULL); - return ::PlayEnhMetaFile(m_hDC, hEnhMetaFile, lpBounds); - } - - BOOL AddMetaFileComment(UINT nDataSize, const BYTE* pCommentData) // can be used for enhanced metafiles only - { - ATLASSERT(m_hDC != NULL); - return ::GdiComment(m_hDC, nDataSize, pCommentData); - } - - // Special handling for metafile playback - static int CALLBACK EnumMetaFileProc(HDC hDC, HANDLETABLE* pHandleTable, METARECORD* pMetaRec, int nHandles, LPARAM lParam) - { - CDCHandle* pDC = (CDCHandle*)lParam; - - switch (pMetaRec->rdFunction) - { - case META_SETMAPMODE: - pDC->SetMapMode((int)(short)pMetaRec->rdParm[0]); - break; - case META_SETWINDOWEXT: - pDC->SetWindowExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SETWINDOWORG: - pDC->SetWindowOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SETVIEWPORTEXT: - pDC->SetViewportExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SETVIEWPORTORG: - pDC->SetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SCALEWINDOWEXT: - pDC->ScaleWindowExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], - (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SCALEVIEWPORTEXT: - pDC->ScaleViewportExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], - (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_OFFSETVIEWPORTORG: - pDC->OffsetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); - break; - case META_SAVEDC: - pDC->SaveDC(); - break; - case META_RESTOREDC: - pDC->RestoreDC((int)(short)pMetaRec->rdParm[0]); - break; - case META_SETBKCOLOR: - pDC->SetBkColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); - break; - case META_SETTEXTCOLOR: - pDC->SetTextColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); - break; - - // need to watch out for SelectObject(HFONT), for custom font mapping - case META_SELECTOBJECT: - { - HGDIOBJ hObject = pHandleTable->objectHandle[pMetaRec->rdParm[0]]; - UINT nObjType = ::GetObjectType(hObject); - if(nObjType == 0) - { - // object type is unknown, determine if it is a font - HFONT hStockFont = (HFONT)::GetStockObject(SYSTEM_FONT); - HFONT hFontOld = (HFONT)::SelectObject(pDC->m_hDC, hStockFont); - HGDIOBJ hObjOld = ::SelectObject(pDC->m_hDC, hObject); - if(hObjOld == hStockFont) - { - // got the stock object back, so must be selecting a font - pDC->SelectFont((HFONT)hObject); - break; // don't play the default record - } - else - { - // didn't get the stock object back, so restore everything - ::SelectObject(pDC->m_hDC, hFontOld); - ::SelectObject(pDC->m_hDC, hObjOld); - } - // and fall through to PlayMetaFileRecord... - } - else if(nObjType == OBJ_FONT) - { - // play back as CDCHandle::SelectFont(HFONT) - pDC->SelectFont((HFONT)hObject); - break; // don't play the default record - } - } - // fall through... - - default: - ::PlayMetaFileRecord(hDC, pHandleTable, pMetaRec, nHandles); - break; - } - - return 1; - } -#endif // !_WIN32_WCE - -// Path Functions -#ifndef _WIN32_WCE - BOOL AbortPath() - { - ATLASSERT(m_hDC != NULL); - return ::AbortPath(m_hDC); - } - - BOOL BeginPath() - { - ATLASSERT(m_hDC != NULL); - return ::BeginPath(m_hDC); - } - - BOOL CloseFigure() - { - ATLASSERT(m_hDC != NULL); - return ::CloseFigure(m_hDC); - } - - BOOL EndPath() - { - ATLASSERT(m_hDC != NULL); - return ::EndPath(m_hDC); - } - - BOOL FillPath() - { - ATLASSERT(m_hDC != NULL); - return ::FillPath(m_hDC); - } - - BOOL FlattenPath() - { - ATLASSERT(m_hDC != NULL); - return ::FlattenPath(m_hDC); - } - - BOOL StrokeAndFillPath() - { - ATLASSERT(m_hDC != NULL); - return ::StrokeAndFillPath(m_hDC); - } - - BOOL StrokePath() - { - ATLASSERT(m_hDC != NULL); - return ::StrokePath(m_hDC); - } - - BOOL WidenPath() - { - ATLASSERT(m_hDC != NULL); - return ::WidenPath(m_hDC); - } - - BOOL GetMiterLimit(PFLOAT pfMiterLimit) const - { - ATLASSERT(m_hDC != NULL); - return ::GetMiterLimit(m_hDC, pfMiterLimit); - } - - BOOL SetMiterLimit(float fMiterLimit) - { - ATLASSERT(m_hDC != NULL); - return ::SetMiterLimit(m_hDC, fMiterLimit, NULL); - } - - int GetPath(LPPOINT lpPoints, LPBYTE lpTypes, int nCount) const - { - ATLASSERT(m_hDC != NULL); - return ::GetPath(m_hDC, lpPoints, lpTypes, nCount); - } - - BOOL SelectClipPath(int nMode) - { - ATLASSERT(m_hDC != NULL); - return ::SelectClipPath(m_hDC, nMode); - } -#endif // !_WIN32_WCE - -// Misc Helper Functions - static CBrushHandle PASCAL GetHalftoneBrush() - { - HBRUSH halftoneBrush = NULL; - WORD grayPattern[8]; - for(int i = 0; i < 8; i++) - grayPattern[i] = (WORD)(0x5555 << (i & 1)); - HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern); - if(grayBitmap != NULL) - { - halftoneBrush = ::CreatePatternBrush(grayBitmap); - DeleteObject(grayBitmap); - } - return CBrushHandle(halftoneBrush); - } - - void DrawDragRect(LPCRECT lpRect, SIZE size, LPCRECT lpRectLast, SIZE sizeLast, HBRUSH hBrush = NULL, HBRUSH hBrushLast = NULL) - { - // first, determine the update region and select it - CRgn rgnOutside; - rgnOutside.CreateRectRgnIndirect(lpRect); - RECT rect = *lpRect; - ::InflateRect(&rect, -size.cx, -size.cy); - ::IntersectRect(&rect, &rect, lpRect); - CRgn rgnInside; - rgnInside.CreateRectRgnIndirect(&rect); - CRgn rgnNew; - rgnNew.CreateRectRgn(0, 0, 0, 0); - rgnNew.CombineRgn(rgnOutside, rgnInside, RGN_XOR); - - HBRUSH hBrushOld = NULL; - CBrush brushHalftone; - if(hBrush == NULL) - brushHalftone = hBrush = CDCHandle::GetHalftoneBrush(); - if(hBrushLast == NULL) - hBrushLast = hBrush; - - CRgn rgnLast; - CRgn rgnUpdate; - if(lpRectLast != NULL) - { - // find difference between new region and old region - rgnLast.CreateRectRgn(0, 0, 0, 0); - rgnOutside.SetRectRgn(lpRectLast->left, lpRectLast->top, lpRectLast->right, lpRectLast->bottom); - rect = *lpRectLast; - ::InflateRect(&rect, -sizeLast.cx, -sizeLast.cy); - ::IntersectRect(&rect, &rect, lpRectLast); - rgnInside.SetRectRgn(rect.left, rect.top, rect.right, rect.bottom); - rgnLast.CombineRgn(rgnOutside, rgnInside, RGN_XOR); - - // only diff them if brushes are the same - if(hBrush == hBrushLast) - { - rgnUpdate.CreateRectRgn(0, 0, 0, 0); - rgnUpdate.CombineRgn(rgnLast, rgnNew, RGN_XOR); - } - } - if(hBrush != hBrushLast && lpRectLast != NULL) - { - // brushes are different -- erase old region first - SelectClipRgn(rgnLast); - GetClipBox(&rect); - hBrushOld = SelectBrush(hBrushLast); - PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); - SelectBrush(hBrushOld); - hBrushOld = NULL; - } - - // draw into the update/new region - SelectClipRgn(rgnUpdate.IsNull() ? rgnNew : rgnUpdate); - GetClipBox(&rect); - hBrushOld = SelectBrush(hBrush); - PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); - - // cleanup DC - if(hBrushOld != NULL) - SelectBrush(hBrushOld); - SelectClipRgn(NULL); - } - - void FillSolidRect(LPCRECT lpRect, COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - - COLORREF clrOld = ::SetBkColor(m_hDC, clr); - ATLASSERT(clrOld != CLR_INVALID); - if(clrOld != CLR_INVALID) - { - ::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL); - ::SetBkColor(m_hDC, clrOld); - } - } - - void FillSolidRect(int x, int y, int cx, int cy, COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - - RECT rect = { x, y, x + cx, y + cy }; - FillSolidRect(&rect, clr); - } - - void Draw3dRect(LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight) - { - Draw3dRect(lpRect->left, lpRect->top, lpRect->right - lpRect->left, - lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight); - } - - void Draw3dRect(int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight) - { - FillSolidRect(x, y, cx - 1, 1, clrTopLeft); - FillSolidRect(x, y, 1, cy - 1, clrTopLeft); - FillSolidRect(x + cx, y, -1, cy, clrBottomRight); - FillSolidRect(x, y + cy, cx, -1, clrBottomRight); - } - -// DIB support -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - int SetDIBitsToDevice(int x, int y, DWORD dwWidth, DWORD dwHeight, int xSrc, int ySrc, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) - { - ATLASSERT(m_hDC != NULL); - return ::SetDIBitsToDevice(m_hDC, x, y, dwWidth, dwHeight, xSrc, ySrc, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - int StretchDIBits(int x, int y, int nWidth, int nHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse, DWORD dwRop) - { - ATLASSERT(m_hDC != NULL); - return ::StretchDIBits(m_hDC, x, y, nWidth, nHeight, xSrc, ySrc, nSrcWidth, nSrcHeight, lpvBits, lpbmi, uColorUse, dwRop); - } - - UINT GetDIBColorTable(UINT uStartIndex, UINT cEntries, RGBQUAD* pColors) const - { - ATLASSERT(m_hDC != NULL); - return ::GetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); - } - - UINT SetDIBColorTable(UINT uStartIndex, UINT cEntries, CONST RGBQUAD* pColors) - { - ATLASSERT(m_hDC != NULL); - return ::SetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - -// OpenGL support -#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - int ChoosePixelFormat(CONST PIXELFORMATDESCRIPTOR* ppfd) - { - ATLASSERT(m_hDC != NULL); - return ::ChoosePixelFormat(m_hDC, ppfd); - } - - int DescribePixelFormat(int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd) - { - ATLASSERT(m_hDC != NULL); - return ::DescribePixelFormat(m_hDC, iPixelFormat, nBytes, ppfd); - } - - int GetPixelFormat() const - { - ATLASSERT(m_hDC != NULL); - return ::GetPixelFormat(m_hDC); - } - - BOOL SetPixelFormat(int iPixelFormat, CONST PIXELFORMATDESCRIPTOR* ppfd) - { - ATLASSERT(m_hDC != NULL); - return ::SetPixelFormat(m_hDC, iPixelFormat, ppfd); - } - - BOOL SwapBuffers() - { - ATLASSERT(m_hDC != NULL); - return ::SwapBuffers(m_hDC); - } - - HGLRC wglCreateContext() - { - ATLASSERT(m_hDC != NULL); - return ::wglCreateContext(m_hDC); - } - - HGLRC wglCreateLayerContext(int iLayerPlane) - { - ATLASSERT(m_hDC != NULL); - return ::wglCreateLayerContext(m_hDC, iLayerPlane); - } - - BOOL wglMakeCurrent(HGLRC hglrc) - { - ATLASSERT(m_hDC != NULL); - return ::wglMakeCurrent(m_hDC, hglrc); - } - - BOOL wglUseFontBitmaps(DWORD dwFirst, DWORD dwCount, DWORD listBase) - { - ATLASSERT(m_hDC != NULL); - return ::wglUseFontBitmaps(m_hDC, dwFirst, dwCount, listBase); - } - - BOOL wglUseFontOutlines(DWORD dwFirst, DWORD dwCount, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf) - { - ATLASSERT(m_hDC != NULL); - return ::wglUseFontOutlines(m_hDC, dwFirst, dwCount, listBase, deviation, extrusion, format, lpgmf); - } - - BOOL wglDescribeLayerPlane(int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd) - { - ATLASSERT(m_hDC != NULL); - return ::wglDescribeLayerPlane(m_hDC, iPixelFormat, iLayerPlane, nBytes, plpd); - } - - int wglSetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, CONST COLORREF* pclr) - { - ATLASSERT(m_hDC != NULL); - return ::wglSetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); - } - - int wglGetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, COLORREF* pclr) - { - ATLASSERT(m_hDC != NULL); - return ::wglGetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); - } - - BOOL wglRealizeLayerPalette(int iLayerPlane, BOOL bRealize) - { - ATLASSERT(m_hDC != NULL); - return ::wglRealizeLayerPalette(m_hDC, iLayerPlane, bRealize); - } - - BOOL wglSwapLayerBuffers(UINT uPlanes) - { - ATLASSERT(m_hDC != NULL); - return ::wglSwapLayerBuffers(m_hDC, uPlanes); - } -#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) - -// New for Windows 2000 only -#if (_WIN32_WINNT >= 0x0500) - COLORREF GetDCPenColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetDCPenColor(m_hDC); - } - - COLORREF SetDCPenColor(COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - return ::SetDCPenColor(m_hDC, clr); - } - - COLORREF GetDCBrushColor() const - { - ATLASSERT(m_hDC != NULL); - return ::GetDCBrushColor(m_hDC); - } - - COLORREF SetDCBrushColor(COLORREF clr) - { - ATLASSERT(m_hDC != NULL); - return ::SetDCBrushColor(m_hDC, clr); - } - -#ifndef _WIN32_WCE - DWORD GetFontUnicodeRanges(LPGLYPHSET lpgs) const - { - ATLASSERT(m_hDC != NULL); - return ::GetFontUnicodeRanges(m_hDC, lpgs); - } -#endif // !_WIN32_WCE - - DWORD GetGlyphIndices(LPCTSTR lpstr, int cch, LPWORD pgi, DWORD dwFlags) const - { - ATLASSERT(m_hDC != NULL); - return ::GetGlyphIndices(m_hDC, lpstr, cch, pgi, dwFlags); - } - - BOOL GetTextExtentPointI(LPWORD pgiIn, int cgi, LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextExtentPointI(m_hDC, pgiIn, cgi, lpSize); - } - - BOOL GetTextExtentExPointI(LPWORD pgiIn, int cgi, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize) const - { - ATLASSERT(m_hDC != NULL); - return ::GetTextExtentExPointI(m_hDC, pgiIn, cgi, nMaxExtent, lpnFit, alpDx, lpSize); - } - - BOOL GetCharWidthI(UINT giFirst, UINT cgi, LPWORD pgi, LPINT lpBuffer) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharWidthI(m_hDC, giFirst, cgi, pgi, lpBuffer); - } - - BOOL GetCharABCWidthsI(UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc) const - { - ATLASSERT(m_hDC != NULL); - return ::GetCharABCWidthsI(m_hDC, giFirst, cgi, pgi, lpabc); - } -#endif // (_WIN32_WINNT >= 0x0500) - -// New for Windows 2000 and Windows 98 -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - BOOL ColorCorrectPalette(HPALETTE hPalette, DWORD dwFirstEntry, DWORD dwNumOfEntries) - { - ATLASSERT(m_hDC != NULL); - return ::ColorCorrectPalette(m_hDC, hPalette, dwFirstEntry, dwNumOfEntries); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CDCT CDCHandle; -typedef CDCT CDC; - - -/////////////////////////////////////////////////////////////////////////////// -// CDC Helpers - -class CPaintDC : public CDC -{ -public: -// Data members - HWND m_hWnd; - PAINTSTRUCT m_ps; - -// Constructor/destructor - CPaintDC(HWND hWnd) - { - ATLASSERT(::IsWindow(hWnd)); - m_hWnd = hWnd; - m_hDC = ::BeginPaint(hWnd, &m_ps); - } - - ~CPaintDC() - { - ATLASSERT(m_hDC != NULL); - ATLASSERT(::IsWindow(m_hWnd)); - ::EndPaint(m_hWnd, &m_ps); - Detach(); - } -}; - -class CClientDC : public CDC -{ -public: -// Data members - HWND m_hWnd; - -// Constructor/destructor - CClientDC(HWND hWnd) - { - ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); - m_hWnd = hWnd; - m_hDC = ::GetDC(hWnd); - } - - ~CClientDC() - { - ATLASSERT(m_hDC != NULL); - ::ReleaseDC(m_hWnd, Detach()); - } -}; - -class CWindowDC : public CDC -{ -public: -// Data members - HWND m_hWnd; - -// Constructor/destructor - CWindowDC(HWND hWnd) - { - ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); - m_hWnd = hWnd; - m_hDC = ::GetWindowDC(hWnd); - } - - ~CWindowDC() - { - ATLASSERT(m_hDC != NULL); - ::ReleaseDC(m_hWnd, Detach()); - } -}; - -class CMemoryDC : public CDC -{ -public: -// Data members - HDC m_hDCOriginal; - RECT m_rcPaint; - CBitmap m_bmp; - HBITMAP m_hBmpOld; - -// Constructor/destructor - CMemoryDC(HDC hDC, RECT& rcPaint) : m_hDCOriginal(hDC), m_hBmpOld(NULL) - { - m_rcPaint = rcPaint; - CreateCompatibleDC(m_hDCOriginal); - ATLASSERT(m_hDC != NULL); - m_bmp.CreateCompatibleBitmap(m_hDCOriginal, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top); - ATLASSERT(m_bmp.m_hBitmap != NULL); - m_hBmpOld = SelectBitmap(m_bmp); - SetViewportOrg(-m_rcPaint.left, -m_rcPaint.top); - } - - ~CMemoryDC() - { - ::BitBlt(m_hDCOriginal, m_rcPaint.left, m_rcPaint.top, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top, m_hDC, m_rcPaint.left, m_rcPaint.top, SRCCOPY); - SelectBitmap(m_hBmpOld); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Enhanced metafile support - -#ifndef _WIN32_WCE - -class CEnhMetaFileInfo -{ -public: -// Data members - HENHMETAFILE m_hEMF; - BYTE* m_pBits; - TCHAR* m_pDesc; - ENHMETAHEADER m_header; - PIXELFORMATDESCRIPTOR m_pfd; - -// Constructor/destructor - CEnhMetaFileInfo(HENHMETAFILE hEMF) : m_pBits(NULL), m_pDesc(NULL), m_hEMF(hEMF) - { } - - ~CEnhMetaFileInfo() - { - delete [] m_pBits; - delete [] m_pDesc; - } - -// Operations - BYTE* GetEnhMetaFileBits() - { - ATLASSERT(m_hEMF != NULL); - UINT nBytes = ::GetEnhMetaFileBits(m_hEMF, 0, NULL); - delete [] m_pBits; - m_pBits = NULL; - ATLTRY(m_pBits = new BYTE[nBytes]); - if (m_pBits != NULL) - ::GetEnhMetaFileBits(m_hEMF, nBytes, m_pBits); - return m_pBits; - } - - LPTSTR GetEnhMetaFileDescription() - { - ATLASSERT(m_hEMF != NULL); - UINT nLen = ::GetEnhMetaFileDescription(m_hEMF, 0, NULL); - delete [] m_pDesc; - m_pDesc = NULL; - ATLTRY(m_pDesc = new TCHAR[nLen]); - if (m_pDesc != NULL) - nLen = ::GetEnhMetaFileDescription(m_hEMF, nLen, m_pDesc); - return m_pDesc; - } - - ENHMETAHEADER* GetEnhMetaFileHeader() - { - ATLASSERT(m_hEMF != NULL); - memset(&m_header, 0, sizeof(m_header)); - m_header.iType = EMR_HEADER; - m_header.nSize = sizeof(ENHMETAHEADER); - UINT n = ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), &m_header); - return (n != 0) ? &m_header : NULL; - } - - PIXELFORMATDESCRIPTOR* GetEnhMetaFilePixelFormat() - { - ATLASSERT(m_hEMF != NULL); - memset(&m_pfd, 0, sizeof(m_pfd)); - UINT n = ::GetEnhMetaFilePixelFormat(m_hEMF, sizeof(m_pfd), &m_pfd); - return (n != 0) ? &m_pfd : NULL; - } -}; - - -template -class CEnhMetaFileT -{ -public: -// Data members - HENHMETAFILE m_hEMF; - -// Constructor/destructor - CEnhMetaFileT(HENHMETAFILE hEMF = NULL) : m_hEMF(hEMF) - { - } - - ~CEnhMetaFileT() - { - if(t_bManaged && m_hEMF != NULL) - DeleteObject(); - } - -// Operations - CEnhMetaFileT& operator =(HENHMETAFILE hEMF) - { - Attach(hEMF); - return *this; - } - - void Attach(HENHMETAFILE hEMF) - { - if(t_bManaged && m_hEMF != NULL && m_hEMF != hEMF) - DeleteObject(); - m_hEMF = hEMF; - } - - HENHMETAFILE Detach() - { - HENHMETAFILE hEMF = m_hEMF; - m_hEMF = NULL; - return hEMF; - } - - operator HENHMETAFILE() const { return m_hEMF; } - - bool IsNull() const { return (m_hEMF == NULL); } - - BOOL DeleteObject() - { - ATLASSERT(m_hEMF != NULL); - BOOL bRet = ::DeleteEnhMetaFile(m_hEMF); - m_hEMF = NULL; - return bRet; - } - - UINT GetEnhMetaFileBits(UINT cbBuffer, LPBYTE lpbBuffer) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFileBits(m_hEMF, cbBuffer, lpbBuffer); - } - - UINT GetEnhMetaFileDescription(UINT cchBuffer, LPTSTR lpszDescription) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFileDescription(m_hEMF, cchBuffer, lpszDescription); - } - - UINT GetEnhMetaFileHeader(LPENHMETAHEADER lpemh) const - { - ATLASSERT(m_hEMF != NULL); - lpemh->iType = EMR_HEADER; - lpemh->nSize = sizeof(ENHMETAHEADER); - return ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), lpemh); - } - - UINT GetEnhMetaFilePaletteEntries(UINT cEntries, LPPALETTEENTRY lppe) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFilePaletteEntries(m_hEMF, cEntries, lppe); - } - - UINT GetEnhMetaFilePixelFormat(DWORD cbBuffer, PIXELFORMATDESCRIPTOR* ppfd) const - { - ATLASSERT(m_hEMF != NULL); - return ::GetEnhMetaFilePixelFormat(m_hEMF, cbBuffer, ppfd); - } -}; - -typedef CEnhMetaFileT CEnhMetaFileHandle; -typedef CEnhMetaFileT CEnhMetaFile; - - -class CEnhMetaFileDC : public CDC -{ -public: -// Constructor/destructor - CEnhMetaFileDC() - { - } - - CEnhMetaFileDC(HDC hdc, LPCRECT lpRect) - { - Create(hdc, NULL, lpRect, NULL); - ATLASSERT(m_hDC != NULL); - } - - CEnhMetaFileDC(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) - { - Create(hdcRef, lpFilename, lpRect, lpDescription); - ATLASSERT(m_hDC != NULL); - } - - ~CEnhMetaFileDC() - { - HENHMETAFILE hEMF = Close(); - if (hEMF != NULL) - ::DeleteEnhMetaFile(hEMF); - } - -// Operations - void Create(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) - { - ATLASSERT(m_hDC == NULL); - m_hDC = ::CreateEnhMetaFile(hdcRef, lpFilename, lpRect, lpDescription); - } - - HENHMETAFILE Close() - { - HENHMETAFILE hEMF = NULL; - if (m_hDC != NULL) - { - hEMF = ::CloseEnhMetaFile(m_hDC); - m_hDC = NULL; - } - return hEMF; - } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// WinCE compatible clipboard CF_DIB format support functions - -#ifndef _WTL_NO_DIB16 - -#define DIBINFO16_BITFIELDS { 31744, 992, 31 } - -// DIBINFO16 - To avoid color table problems in WinCE we only create this type of Dib -struct DIBINFO16 // a BITMAPINFO with 2 additional color bitfields -{ - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[3]; - - DIBINFO16(SIZE size) - { - BITMAPINFOHEADER bmih = { sizeof(BITMAPINFOHEADER), size.cx, size.cy, - 1, 16, BI_BITFIELDS, 2 * size.cx * size.cy , 0, 0, 3 }; - DWORD dw[3] = DIBINFO16_BITFIELDS ; - - bmiHeader = bmih; - memcpy(bmiColors, dw, 3 * sizeof(DWORD)); - } -}; - - -// AtlxxxDibxxx minimal packed DIB implementation and helpers to copy and paste CF_DIB - -inline bool AtlIsDib16(LPBITMAPINFOHEADER pbmih) -{ - return (pbmih->biBitCount == 16) && (pbmih->biCompression == BI_BITFIELDS); -} - -inline int AtlGetDibColorTableSize(LPBITMAPINFOHEADER pbmih) -{ - switch (pbmih->biBitCount) - { - case 2: - case 4: - case 8: - return pbmih->biClrUsed ? pbmih->biClrUsed : 1 << pbmih->biBitCount; - case 24: - break; - case 16: - case 32: - return pbmih->biCompression == BI_BITFIELDS ? 3 : 0; - default: - ATLASSERT(FALSE); // should never come here - } - - return 0; -} - -inline int AtlGetDibNumColors(LPBITMAPINFOHEADER pbmih) -{ - switch (pbmih->biBitCount) - { - case 2: - case 4: - case 8: - if (pbmih->biClrUsed) - return pbmih->biClrUsed; - else - break; - case 16: - if (pbmih->biCompression == BI_BITFIELDS ) - return 1 << 15; - else - break; - case 24: - break; - case 32: - if (pbmih->biCompression == BI_BITFIELDS ) - return 1 << 24; - else - break; - default: - ATLASSERT(FALSE); - } - - return 1 << pbmih->biBitCount; -} - -inline HBITMAP AtlGetDibBitmap(LPBITMAPINFO pbmi) -{ - HBITMAP hbm = NULL; - CDC dc(NULL); - void * pBits = NULL; - - LPBYTE pDibBits = (LPBYTE)pbmi + sizeof(BITMAPINFOHEADER) + AtlGetDibColorTableSize(&pbmi->bmiHeader) * sizeof(RGBQUAD); - if (hbm = CreateDIBSection(dc, pbmi, DIB_RGB_COLORS, &pBits, NULL, NULL)) - memcpy(pBits, pDibBits, pbmi->bmiHeader.biSizeImage); - - return hbm; -} - -inline HBITMAP AtlCopyBitmap(HBITMAP hbm , SIZE sizeDst, bool bAsBitmap = false) -{ - CDC hdcSrc = CreateCompatibleDC(NULL); - CDC hdcDst = CreateCompatibleDC(NULL); - - CBitmapHandle hbmOld = NULL, hbmOld2 = NULL, bmSrc = hbm; - - CBitmap bmNew = NULL; - - SIZE sizeSrc = { 0 }; - bmSrc.GetSize(sizeSrc); - - hbmOld = hdcSrc.SelectBitmap(bmSrc); - - if (bAsBitmap) - { - bmNew.CreateCompatibleBitmap(hdcSrc, sizeDst.cx, sizeDst.cy); - } - else - { - DIBINFO16 dib16(sizeDst); - LPVOID pBits = NULL; - bmNew = CreateDIBSection(hdcDst, (const BITMAPINFO*)&dib16, DIB_RGB_COLORS, &pBits, NULL, NULL); - } - - ATLASSERT(!bmNew.IsNull()); - - hbmOld2 = hdcDst.SelectBitmap(bmNew); - BOOL bOK = FALSE; - - if ((sizeDst.cx == sizeSrc.cx) && (sizeDst.cy == sizeSrc.cy)) - bOK = hdcDst.BitBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, SRCCOPY); - else - bOK = hdcDst.StretchBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, sizeSrc.cx, sizeSrc.cy, SRCCOPY); - - hdcSrc.SelectBitmap(hbmOld); - hdcDst.SelectBitmap(hbmOld2); - - if (bOK == FALSE) - bmNew.DeleteObject(); - - return bmNew.Detach(); -} - -inline HLOCAL AtlCreatePackedDib16(HBITMAP hbm, SIZE size) -{ - DIBSECTION ds = { 0 }; - LPBYTE pDib = NULL; - bool bCopied = false; - - bool bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); - if ((bOK == FALSE) || (ds.dsBm.bmBits == NULL) || (AtlIsDib16(&ds.dsBmih) == FALSE) || - (ds.dsBmih.biWidth != size.cx ) || (ds.dsBmih.biHeight != size.cy )) - { - if ((hbm = AtlCopyBitmap(hbm, size)) != NULL) - { - bCopied = true; - bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); - } - else - { - bOK = FALSE; - } - } - - if((bOK == TRUE) && (AtlIsDib16(&ds.dsBmih) == TRUE) && (ds.dsBm.bmBits != NULL)) - { - pDib = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, sizeof(DIBINFO16) + ds.dsBmih.biSizeImage); - if (pDib != NULL) - { - memcpy(pDib , &ds.dsBmih, sizeof(DIBINFO16)); - memcpy(pDib + sizeof(DIBINFO16), ds.dsBm.bmBits, ds.dsBmih.biSizeImage); - } - } - - if (bCopied == true) - DeleteObject(hbm); - - return (HLOCAL)pDib; -} - -inline bool AtlSetClipboardDib16(HBITMAP hbm, SIZE size, HWND hWnd) -{ - ATLASSERT(::IsWindow(hWnd)); - BOOL bOK = OpenClipboard(hWnd); - if (bOK == TRUE) - { - if ((bOK = EmptyClipboard()) == TRUE) - { - HLOCAL hDib = AtlCreatePackedDib16(hbm, size); - if (hDib != NULL) - { - bOK = SetClipboardData(CF_DIB, hDib) != NULL; - if (bOK == FALSE) - LocalFree(hDib); - } - else - { - bOK = FALSE; - } - } - CloseClipboard(); - } - - return bOK == TRUE; -} - -inline HBITMAP AtlGetClipboardDib(HWND hWnd) -{ - ATLASSERT(::IsWindow(hWnd) == TRUE); - HBITMAP hbm = NULL; - if (OpenClipboard(hWnd) == TRUE) - { - LPBITMAPINFO pbmi = (LPBITMAPINFO)GetClipboardData(CF_DIB); - if (pbmi != NULL) - hbm = AtlGetDibBitmap(pbmi); - CloseClipboard(); - } - - return hbm; -} - -#endif // _WTL_NO_DIB16 - -}; // namespace WTL - -#endif // __ATLGDI_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLGDI_H__ +#define __ATLGDI_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlgdi.h requires atlapp.h to be included first +#endif + + +// protect template members from windowsx.h macros +#ifdef _INC_WINDOWSX + #undef CopyRgn + #undef CreateBrush + #undef CreatePen + #undef SelectBrush + #undef SelectPen + #undef SelectFont + #undef SelectBitmap +#endif // _INC_WINDOWSX + +// required libraries +#if !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) + #pragma comment(lib, "msimg32.lib") +#endif // !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) +#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) + #pragma comment(lib, "opengl32.lib") +#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CPenT +// CBrushT +// CLogFont +// CFontT +// CBitmapT +// CPaletteT +// CRgnT +// CDCT +// CPaintDC +// CClientDC +// CWindowDC +// CMemoryDC +// CEnhMetaFileInfo +// CEnhMetaFileT +// CEnhMetaFileDC +// +// Global functions: +// AtlGetBitmapResourceInfo() +// AtlGetBitmapResourceBitsPerPixel() +// AtlIsAlphaBitmapResource() +// AtlIsDib16() +// AtlGetDibColorTableSize() +// AtlGetDibNumColors(), +// AtlGetDibBitmap() +// AtlCopyBitmap() +// AtlCreatePackedDib16() +// AtlSetClipboardDib16() +// AtlGetClipboardDib() + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// Bitmap resource helpers to extract bitmap information for a bitmap resource + +inline LPBITMAPINFOHEADER AtlGetBitmapResourceInfo(HMODULE hModule, ATL::_U_STRINGorID image) +{ + HRSRC hResource = ::FindResource(hModule, image.m_lpstr, RT_BITMAP); + ATLASSERT(hResource != NULL); + HGLOBAL hGlobal = ::LoadResource(hModule, hResource); + ATLASSERT(hGlobal != NULL); + LPBITMAPINFOHEADER pBitmapInfoHeader = (LPBITMAPINFOHEADER)::LockResource(hGlobal); + ATLASSERT(pBitmapInfoHeader != NULL); + return pBitmapInfoHeader; +} + +inline WORD AtlGetBitmapResourceBitsPerPixel(HMODULE hModule, ATL::_U_STRINGorID image) +{ + LPBITMAPINFOHEADER pBitmapInfoHeader = AtlGetBitmapResourceInfo(hModule, image); + ATLASSERT(pBitmapInfoHeader != NULL); + return pBitmapInfoHeader->biBitCount; +} + +inline WORD AtlGetBitmapResourceBitsPerPixel(ATL::_U_STRINGorID image) +{ + return AtlGetBitmapResourceBitsPerPixel(ModuleHelper::GetResourceInstance(), image); +} + +/////////////////////////////////////////////////////////////////////////////// +// 32-bit (alpha channel) bitmap resource helper + +// Note: 32-bit (alpha channel) images work only on Windows XP with Common Controls version 6. +// If you want your app to work on older version of Windows, load non-alpha images if Common +// Controls version is less than 6. + +inline bool AtlIsAlphaBitmapResource(ATL::_U_STRINGorID image) +{ + return (AtlGetBitmapResourceBitsPerPixel(image) == 32); +} + + +/////////////////////////////////////////////////////////////////////////////// +// CPen + +template +class CPenT +{ +public: +// Data members + HPEN m_hPen; + +// Constructor/destructor/operators + CPenT(HPEN hPen = NULL) : m_hPen(hPen) + { } + + ~CPenT() + { + if(t_bManaged && m_hPen != NULL) + DeleteObject(); + } + + CPenT& operator =(HPEN hPen) + { + Attach(hPen); + return *this; + } + + void Attach(HPEN hPen) + { + if(t_bManaged && m_hPen != NULL && m_hPen != hPen) + ::DeleteObject(m_hPen); + m_hPen = hPen; + } + + HPEN Detach() + { + HPEN hPen = m_hPen; + m_hPen = NULL; + return hPen; + } + + operator HPEN() const { return m_hPen; } + + bool IsNull() const { return (m_hPen == NULL); } + +// Create methods + HPEN CreatePen(int nPenStyle, int nWidth, COLORREF crColor) + { + ATLASSERT(m_hPen == NULL); + m_hPen = ::CreatePen(nPenStyle, nWidth, crColor); + return m_hPen; + } + +#ifndef _WIN32_WCE + HPEN CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL) + { + ATLASSERT(m_hPen == NULL); + m_hPen = ::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount, lpStyle); + return m_hPen; + } +#endif // !_WIN32_WCE + + HPEN CreatePenIndirect(LPLOGPEN lpLogPen) + { + ATLASSERT(m_hPen == NULL); + m_hPen = ::CreatePenIndirect(lpLogPen); + return m_hPen; + } + + BOOL DeleteObject() + { + ATLASSERT(m_hPen != NULL); + BOOL bRet = ::DeleteObject(m_hPen); + if(bRet) + m_hPen = NULL; + return bRet; + } + +// Attributes + int GetLogPen(LOGPEN* pLogPen) const + { + ATLASSERT(m_hPen != NULL); + return ::GetObject(m_hPen, sizeof(LOGPEN), pLogPen); + } + + bool GetLogPen(LOGPEN& LogPen) const + { + ATLASSERT(m_hPen != NULL); + return (::GetObject(m_hPen, sizeof(LOGPEN), &LogPen) == sizeof(LOGPEN)); + } + +#ifndef _WIN32_WCE + int GetExtLogPen(EXTLOGPEN* pLogPen) const + { + ATLASSERT(m_hPen != NULL); + return ::GetObject(m_hPen, sizeof(EXTLOGPEN), pLogPen); + } + + bool GetExtLogPen(EXTLOGPEN& ExtLogPen) const + { + ATLASSERT(m_hPen != NULL); + return (::GetObject(m_hPen, sizeof(EXTLOGPEN), &ExtLogPen) == sizeof(EXTLOGPEN)); + } +#endif // !_WIN32_WCE +}; + +typedef CPenT CPenHandle; +typedef CPenT CPen; + + +/////////////////////////////////////////////////////////////////////////////// +// CBrush + +template +class CBrushT +{ +public: +// Data members + HBRUSH m_hBrush; + +// Constructor/destructor/operators + CBrushT(HBRUSH hBrush = NULL) : m_hBrush(hBrush) + { } + + ~CBrushT() + { + if(t_bManaged && m_hBrush != NULL) + DeleteObject(); + } + + CBrushT& operator =(HBRUSH hBrush) + { + Attach(hBrush); + return *this; + } + + void Attach(HBRUSH hBrush) + { + if(t_bManaged && m_hBrush != NULL && m_hBrush != hBrush) + ::DeleteObject(m_hBrush); + m_hBrush = hBrush; + } + + HBRUSH Detach() + { + HBRUSH hBrush = m_hBrush; + m_hBrush = NULL; + return hBrush; + } + + operator HBRUSH() const { return m_hBrush; } + + bool IsNull() const { return (m_hBrush == NULL); } + +// Create methods + HBRUSH CreateSolidBrush(COLORREF crColor) + { + ATLASSERT(m_hBrush == NULL); + m_hBrush = ::CreateSolidBrush(crColor); + return m_hBrush; + } + +#ifndef _WIN32_WCE + HBRUSH CreateHatchBrush(int nIndex, COLORREF crColor) + { + ATLASSERT(m_hBrush == NULL); + m_hBrush = ::CreateHatchBrush(nIndex, crColor); + return m_hBrush; + } +#endif // !_WIN32_WCE + +#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) + HBRUSH CreateBrushIndirect(const LOGBRUSH* lpLogBrush) + { + ATLASSERT(m_hBrush == NULL); +#ifndef _WIN32_WCE + m_hBrush = ::CreateBrushIndirect(lpLogBrush); +#else // CE specific + m_hBrush = ATL::CreateBrushIndirect(lpLogBrush); +#endif // _WIN32_WCE + return m_hBrush; + } +#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) + + HBRUSH CreatePatternBrush(HBITMAP hBitmap) + { + ATLASSERT(m_hBrush == NULL); + m_hBrush = ::CreatePatternBrush(hBitmap); + return m_hBrush; + } + + HBRUSH CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage) + { + ATLASSERT(hPackedDIB != NULL); + const void* lpPackedDIB = GlobalLock(hPackedDIB); + ATLASSERT(lpPackedDIB != NULL); + m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); + GlobalUnlock(hPackedDIB); + return m_hBrush; + } + + HBRUSH CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage) + { + ATLASSERT(m_hBrush == NULL); + m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); + return m_hBrush; + } + + HBRUSH CreateSysColorBrush(int nIndex) + { + ATLASSERT(m_hBrush == NULL); + m_hBrush = ::GetSysColorBrush(nIndex); + return m_hBrush; + } + + BOOL DeleteObject() + { + ATLASSERT(m_hBrush != NULL); + BOOL bRet = ::DeleteObject(m_hBrush); + if(bRet) + m_hBrush = NULL; + return bRet; + } + +// Attributes + int GetLogBrush(LOGBRUSH* pLogBrush) const + { + ATLASSERT(m_hBrush != NULL); + return ::GetObject(m_hBrush, sizeof(LOGBRUSH), pLogBrush); + } + + bool GetLogBrush(LOGBRUSH& LogBrush) const + { + ATLASSERT(m_hBrush != NULL); + return (::GetObject(m_hBrush, sizeof(LOGBRUSH), &LogBrush) == sizeof(LOGBRUSH)); + } +}; + +typedef CBrushT CBrushHandle; +typedef CBrushT CBrush; + + +/////////////////////////////////////////////////////////////////////////////// +// CFont + +class CLogFont : public LOGFONT +{ +public: + CLogFont() + { + memset(this, 0, sizeof(LOGFONT)); + } + + CLogFont(const LOGFONT& lf) + { + Copy(&lf); + } + + CLogFont(HFONT hFont) + { + ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); + ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); + } + + HFONT CreateFontIndirect() + { + return ::CreateFontIndirect(this); + } + + void SetBold() + { + lfWeight = FW_BOLD; + } + + bool IsBold() const + { + return (lfWeight >= FW_BOLD); + } + + void MakeBolder(int iScale = 1) + { + lfWeight += FW_BOLD * iScale; + } + + void MakeLarger(int iScale) + { + if(lfHeight > 0) + lfHeight += iScale; + else + lfHeight -= iScale; + } + + void SetHeight(LONG nPointSize, HDC hDC = NULL) + { + // For MM_TEXT mapping mode + lfHeight = -::MulDiv(nPointSize, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + } + + LONG GetHeight(HDC hDC = NULL) const + { + // For MM_TEXT mapping mode + return ::MulDiv(-lfHeight, 72, ::GetDeviceCaps(hDC, LOGPIXELSY)); + } + + LONG GetDeciPointHeight(HDC hDC = NULL) const + { +#ifndef _WIN32_WCE + POINT ptOrg = { 0, 0 }; + ::DPtoLP(hDC, &ptOrg, 1); + POINT pt = { 0, 0 }; + pt.y = abs(lfHeight) + ptOrg.y; + ::LPtoDP(hDC,&pt,1); + return ::MulDiv(pt.y, 720, ::GetDeviceCaps(hDC, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point +#else // CE specific + // DP and LP are always the same on CE + return ::MulDiv(abs(lfHeight), 720, ::GetDeviceCaps(hDC, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point +#endif // _WIN32_WCE + } + + void SetHeightFromDeciPoint(LONG nDeciPtHeight, HDC hDC = NULL) + { +#ifndef _WIN32_WCE + POINT pt = { 0, 0 }; + pt.y = ::MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), nDeciPtHeight, 720); // 72 points/inch, 10 decipoints/point + ::DPtoLP(hDC, &pt, 1); + POINT ptOrg = { 0, 0 }; + ::DPtoLP(hDC, &ptOrg, 1); + lfHeight = -abs(pt.y - ptOrg.y); +#else // CE specific + // DP and LP are always the same on CE + lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), nDeciPtHeight, 720)); // 72 points/inch, 10 decipoints/point +#endif // _WIN32_WCE + } + +#ifndef _WIN32_WCE + void SetCaptionFont() + { + NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; + ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); + Copy(&ncm.lfCaptionFont); + } + + void SetMenuFont() + { + NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; + ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); + Copy(&ncm.lfMenuFont); + } + + void SetStatusFont() + { + NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; + ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); + Copy(&ncm.lfStatusFont); + } + + void SetMessageBoxFont() + { + NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; + ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); + Copy(&ncm.lfMessageFont); + } +#endif // !_WIN32_WCE + + void Copy(const LOGFONT* pLogFont) + { + ATLASSERT(pLogFont != NULL); + *(LOGFONT*)this = *pLogFont; + } + + CLogFont& operator =(const CLogFont& src) + { + Copy(&src); + return *this; + } + + CLogFont& operator =(const LOGFONT& src) + { + Copy(&src); + return *this; + } + + CLogFont& operator =(HFONT hFont) + { + ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); + ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); + return *this; + } + + bool operator ==(const LOGFONT& logfont) const + { + return(logfont.lfHeight == lfHeight && + logfont.lfWidth == lfWidth && + logfont.lfEscapement == lfEscapement && + logfont.lfOrientation == lfOrientation && + logfont.lfWeight == lfWeight && + logfont.lfItalic == lfItalic && + logfont.lfUnderline == lfUnderline && + logfont.lfStrikeOut == lfStrikeOut && + logfont.lfCharSet == lfCharSet && + logfont.lfOutPrecision == lfOutPrecision && + logfont.lfClipPrecision == lfClipPrecision && + logfont.lfQuality == lfQuality && + logfont.lfPitchAndFamily == lfPitchAndFamily && + lstrcmp(logfont.lfFaceName, lfFaceName) == 0); + } +}; + + +template +class CFontT +{ +public: +// Data members + HFONT m_hFont; + +// Constructor/destructor/operators + CFontT(HFONT hFont = NULL) : m_hFont(hFont) + { } + + ~CFontT() + { + if(t_bManaged && m_hFont != NULL) + DeleteObject(); + } + + CFontT& operator =(HFONT hFont) + { + Attach(hFont); + return *this; + } + + void Attach(HFONT hFont) + { + if(t_bManaged && m_hFont != NULL && m_hFont != hFont) + ::DeleteObject(m_hFont); + m_hFont = hFont; + } + + HFONT Detach() + { + HFONT hFont = m_hFont; + m_hFont = NULL; + return hFont; + } + + operator HFONT() const { return m_hFont; } + + bool IsNull() const { return (m_hFont == NULL); } + +// Create methods + HFONT CreateFontIndirect(const LOGFONT* lpLogFont) + { + ATLASSERT(m_hFont == NULL); + m_hFont = ::CreateFontIndirect(lpLogFont); + return m_hFont; + } + +#if !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) + HFONT CreateFontIndirectEx(CONST ENUMLOGFONTEXDV* penumlfex) + { + ATLASSERT(m_hFont == NULL); + m_hFont = ::CreateFontIndirectEx(penumlfex); + return m_hFont; + } +#endif // !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) + +#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) + HFONT CreateFont(int nHeight, int nWidth, int nEscapement, + int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, + BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, + BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, + LPCTSTR lpszFacename) + { + ATLASSERT(m_hFont == NULL); +#ifndef _WIN32_WCE + m_hFont = ::CreateFont(nHeight, nWidth, nEscapement, + nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, + nCharSet, nOutPrecision, nClipPrecision, nQuality, + nPitchAndFamily, lpszFacename); +#else // CE specific + m_hFont = ATL::CreateFont(nHeight, nWidth, nEscapement, + nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, + nCharSet, nOutPrecision, nClipPrecision, nQuality, + nPitchAndFamily, lpszFacename); +#endif // _WIN32_WCE + return m_hFont; + } +#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) + + HFONT CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, HDC hDC = NULL, bool bBold = false, bool bItalic = false) + { + LOGFONT logFont = { 0 }; + logFont.lfCharSet = DEFAULT_CHARSET; + logFont.lfHeight = nPointSize; + SecureHelper::strncpy_x(logFont.lfFaceName, _countof(logFont.lfFaceName), lpszFaceName, _TRUNCATE); + + if(bBold) + logFont.lfWeight = FW_BOLD; + if(bItalic) + logFont.lfItalic = (BYTE)TRUE; + + return CreatePointFontIndirect(&logFont, hDC); + } + + HFONT CreatePointFontIndirect(const LOGFONT* lpLogFont, HDC hDC = NULL) + { + HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); + + // convert nPointSize to logical units based on hDC + LOGFONT logFont = *lpLogFont; +#ifndef _WIN32_WCE + POINT pt = { 0, 0 }; + pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720); // 72 points/inch, 10 decipoints/point + ::DPtoLP(hDC1, &pt, 1); + POINT ptOrg = { 0, 0 }; + ::DPtoLP(hDC1, &ptOrg, 1); + logFont.lfHeight = -abs(pt.y - ptOrg.y); +#else // CE specific + // DP and LP are always the same on CE + logFont.lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720)); // 72 points/inch, 10 decipoints/point +#endif // _WIN32_WCE + + if(hDC == NULL) + ::ReleaseDC(NULL, hDC1); + + return CreateFontIndirect(&logFont); + } + + BOOL DeleteObject() + { + ATLASSERT(m_hFont != NULL); + BOOL bRet = ::DeleteObject(m_hFont); + if(bRet) + m_hFont = NULL; + return bRet; + } + +// Attributes + int GetLogFont(LOGFONT* pLogFont) const + { + ATLASSERT(m_hFont != NULL); + return ::GetObject(m_hFont, sizeof(LOGFONT), pLogFont); + } + + bool GetLogFont(LOGFONT& LogFont) const + { + ATLASSERT(m_hFont != NULL); + return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT)); + } +}; + +typedef CFontT CFontHandle; +typedef CFontT CFont; + + +/////////////////////////////////////////////////////////////////////////////// +// CBitmap + +template +class CBitmapT +{ +public: +// Data members + HBITMAP m_hBitmap; + +// Constructor/destructor/operators + CBitmapT(HBITMAP hBitmap = NULL) : m_hBitmap(hBitmap) + { } + + ~CBitmapT() + { + if(t_bManaged && m_hBitmap != NULL) + DeleteObject(); + } + + CBitmapT& operator =(HBITMAP hBitmap) + { + Attach(hBitmap); + return *this; + } + + void Attach(HBITMAP hBitmap) + { + if(t_bManaged && m_hBitmap != NULL&& m_hBitmap != hBitmap) + ::DeleteObject(m_hBitmap); + m_hBitmap = hBitmap; + } + + HBITMAP Detach() + { + HBITMAP hBitmap = m_hBitmap; + m_hBitmap = NULL; + return hBitmap; + } + + operator HBITMAP() const { return m_hBitmap; } + + bool IsNull() const { return (m_hBitmap == NULL); } + +// Create and load methods + HBITMAP LoadBitmap(ATL::_U_STRINGorID bitmap) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); + return m_hBitmap; + } + + HBITMAP LoadOEMBitmap(UINT nIDBitmap) // for OBM_/OCR_/OIC_ + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::LoadBitmap(NULL, MAKEINTRESOURCE(nIDBitmap)); + return m_hBitmap; + } + +#ifndef _WIN32_WCE + HBITMAP LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateMappedBitmap(ModuleHelper::GetResourceInstance(), nIDBitmap, (WORD)nFlags, lpColorMap, nMapSize); + return m_hBitmap; + } +#endif // !_WIN32_WCE + + HBITMAP CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitsPerPixel, const void* lpBits) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateBitmap(nWidth, nHeight, nPlanes, nBitsPerPixel, lpBits); + return m_hBitmap; + } + +#ifndef _WIN32_WCE + HBITMAP CreateBitmapIndirect(LPBITMAP lpBitmap) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateBitmapIndirect(lpBitmap); + return m_hBitmap; + } +#endif // !_WIN32_WCE + + HBITMAP CreateCompatibleBitmap(HDC hDC, int nWidth, int nHeight) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateCompatibleBitmap(hDC, nWidth, nHeight); + return m_hBitmap; + } + +#ifndef _WIN32_WCE + HBITMAP CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateDiscardableBitmap(hDC, nWidth, nHeight); + return m_hBitmap; + } +#endif // !_WIN32_WCE + + BOOL DeleteObject() + { + ATLASSERT(m_hBitmap != NULL); + BOOL bRet = ::DeleteObject(m_hBitmap); + if(bRet) + m_hBitmap = NULL; + return bRet; + } + +// Attributes + int GetBitmap(BITMAP* pBitMap) const + { + ATLASSERT(m_hBitmap != NULL); + return ::GetObject(m_hBitmap, sizeof(BITMAP), pBitMap); + } + + bool GetBitmap(BITMAP& bm) const + { + ATLASSERT(m_hBitmap != NULL); + return (::GetObject(m_hBitmap, sizeof(BITMAP), &bm) == sizeof(BITMAP)); + } + + bool GetSize(SIZE& size) const + { + ATLASSERT(m_hBitmap != NULL); + BITMAP bm = { 0 }; + if(!GetBitmap(&bm)) + return false; + size.cx = bm.bmWidth; + size.cy = bm.bmHeight; + return true; + } + +#ifndef _WIN32_WCE + DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const + { + ATLASSERT(m_hBitmap != NULL); + return ::GetBitmapBits(m_hBitmap, dwCount, lpBits); + } +#endif // !_WIN32_WCE + +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) + DWORD SetBitmapBits(DWORD dwCount, const void* lpBits) + { + ATLASSERT(m_hBitmap != NULL); + return ::SetBitmapBits(m_hBitmap, dwCount, lpBits); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) + +#ifndef _WIN32_WCE + BOOL GetBitmapDimension(LPSIZE lpSize) const + { + ATLASSERT(m_hBitmap != NULL); + return ::GetBitmapDimensionEx(m_hBitmap, lpSize); + } + + BOOL SetBitmapDimension(int nWidth, int nHeight, LPSIZE lpSize = NULL) + { + ATLASSERT(m_hBitmap != NULL); + return ::SetBitmapDimensionEx(m_hBitmap, nWidth, nHeight, lpSize); + } + +// DIB support + HBITMAP CreateDIBitmap(HDC hDC, CONST BITMAPINFOHEADER* lpbmih, DWORD dwInit, CONST VOID* lpbInit, CONST BITMAPINFO* lpbmi, UINT uColorUse) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateDIBitmap(hDC, lpbmih, dwInit, lpbInit, lpbmi, uColorUse); + return m_hBitmap; + } +#endif // !_WIN32_WCE + + HBITMAP CreateDIBSection(HDC hDC, CONST BITMAPINFO* lpbmi, UINT uColorUse, VOID** ppvBits, HANDLE hSection, DWORD dwOffset) + { + ATLASSERT(m_hBitmap == NULL); + m_hBitmap = ::CreateDIBSection(hDC, lpbmi, uColorUse, ppvBits, hSection, dwOffset); + return m_hBitmap; + } + +#ifndef _WIN32_WCE + int GetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT uColorUse) const + { + ATLASSERT(m_hBitmap != NULL); + return ::GetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); + } + + int SetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) + { + ATLASSERT(m_hBitmap != NULL); + return ::SetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); + } +#endif // !_WIN32_WCE +}; + +typedef CBitmapT CBitmapHandle; +typedef CBitmapT CBitmap; + + +/////////////////////////////////////////////////////////////////////////////// +// CPalette + +template +class CPaletteT +{ +public: +// Data members + HPALETTE m_hPalette; + +// Constructor/destructor/operators + CPaletteT(HPALETTE hPalette = NULL) : m_hPalette(hPalette) + { } + + ~CPaletteT() + { + if(t_bManaged && m_hPalette != NULL) + DeleteObject(); + } + + CPaletteT& operator =(HPALETTE hPalette) + { + Attach(hPalette); + return *this; + } + + void Attach(HPALETTE hPalette) + { + if(t_bManaged && m_hPalette != NULL && m_hPalette != hPalette) + ::DeleteObject(m_hPalette); + m_hPalette = hPalette; + } + + HPALETTE Detach() + { + HPALETTE hPalette = m_hPalette; + m_hPalette = NULL; + return hPalette; + } + + operator HPALETTE() const { return m_hPalette; } + + bool IsNull() const { return (m_hPalette == NULL); } + +// Create methods + HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette) + { + ATLASSERT(m_hPalette == NULL); + m_hPalette = ::CreatePalette(lpLogPalette); + return m_hPalette; + } + +#ifndef _WIN32_WCE + HPALETTE CreateHalftonePalette(HDC hDC) + { + ATLASSERT(m_hPalette == NULL); + ATLASSERT(hDC != NULL); + m_hPalette = ::CreateHalftonePalette(hDC); + return m_hPalette; + } +#endif // !_WIN32_WCE + + BOOL DeleteObject() + { + ATLASSERT(m_hPalette != NULL); + BOOL bRet = ::DeleteObject(m_hPalette); + if(bRet) + m_hPalette = NULL; + return bRet; + } + +// Attributes + int GetEntryCount() const + { + ATLASSERT(m_hPalette != NULL); + WORD nEntries = 0; + ::GetObject(m_hPalette, sizeof(WORD), &nEntries); + return (int)nEntries; + } + + UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) const + { + ATLASSERT(m_hPalette != NULL); + return ::GetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); + } + + UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) + { + ATLASSERT(m_hPalette != NULL); + return ::SetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); + } + +// Operations +#ifndef _WIN32_WCE + void AnimatePalette(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) + { + ATLASSERT(m_hPalette != NULL); + ::AnimatePalette(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); + } + + BOOL ResizePalette(UINT nNumEntries) + { + ATLASSERT(m_hPalette != NULL); + return ::ResizePalette(m_hPalette, nNumEntries); + } +#endif // !_WIN32_WCE + + UINT GetNearestPaletteIndex(COLORREF crColor) const + { + ATLASSERT(m_hPalette != NULL); + return ::GetNearestPaletteIndex(m_hPalette, crColor); + } +}; + +typedef CPaletteT CPaletteHandle; +typedef CPaletteT CPalette; + + +/////////////////////////////////////////////////////////////////////////////// +// CRgn + +template +class CRgnT +{ +public: +// Data members + HRGN m_hRgn; + +// Constructor/destructor/operators + CRgnT(HRGN hRgn = NULL) : m_hRgn(hRgn) + { } + + ~CRgnT() + { + if(t_bManaged && m_hRgn != NULL) + DeleteObject(); + } + + CRgnT& operator =(HRGN hRgn) + { + Attach(hRgn); + return *this; + } + + void Attach(HRGN hRgn) + { + if(t_bManaged && m_hRgn != NULL && m_hRgn != hRgn) + ::DeleteObject(m_hRgn); + m_hRgn = hRgn; + } + + HRGN Detach() + { + HRGN hRgn = m_hRgn; + m_hRgn = NULL; + return hRgn; + } + + operator HRGN() const { return m_hRgn; } + + bool IsNull() const { return (m_hRgn == NULL); } + +// Create methods + HRGN CreateRectRgn(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreateRectRgn(x1, y1, x2, y2); + return m_hRgn; + } + + HRGN CreateRectRgnIndirect(LPCRECT lpRect) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreateRectRgnIndirect(lpRect); + return m_hRgn; + } + +#ifndef _WIN32_WCE + HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreateEllipticRgn(x1, y1, x2, y2); + return m_hRgn; + } + + HRGN CreateEllipticRgnIndirect(LPCRECT lpRect) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreateEllipticRgnIndirect(lpRect); + return m_hRgn; + } + + HRGN CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreatePolygonRgn(lpPoints, nCount, nMode); + return m_hRgn; + } + + HRGN CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode); + return m_hRgn; + } + + HRGN CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3); + return m_hRgn; + } + + HRGN CreateFromPath(HDC hDC) + { + ATLASSERT(m_hRgn == NULL); + ATLASSERT(hDC != NULL); + m_hRgn = ::PathToRegion(hDC); + return m_hRgn; + } + + HRGN CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData) + { + ATLASSERT(m_hRgn == NULL); + m_hRgn = ::ExtCreateRegion(lpXForm, nCount, pRgnData); + return m_hRgn; + } +#endif // !_WIN32_WCE + + BOOL DeleteObject() + { + ATLASSERT(m_hRgn != NULL); + BOOL bRet = ::DeleteObject(m_hRgn); + if(bRet) + m_hRgn = NULL; + return bRet; + } + +// Operations + void SetRectRgn(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hRgn != NULL); + ::SetRectRgn(m_hRgn, x1, y1, x2, y2); + } + + void SetRectRgn(LPCRECT lpRect) + { + ATLASSERT(m_hRgn != NULL); + ::SetRectRgn(m_hRgn, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + + int CombineRgn(HRGN hRgnSrc1, HRGN hRgnSrc2, int nCombineMode) + { + ATLASSERT(m_hRgn != NULL); + return ::CombineRgn(m_hRgn, hRgnSrc1, hRgnSrc2, nCombineMode); + } + + int CombineRgn(HRGN hRgnSrc, int nCombineMode) + { + ATLASSERT(m_hRgn != NULL); + return ::CombineRgn(m_hRgn, m_hRgn, hRgnSrc, nCombineMode); + } + + int CopyRgn(HRGN hRgnSrc) + { + ATLASSERT(m_hRgn != NULL); + return ::CombineRgn(m_hRgn, hRgnSrc, NULL, RGN_COPY); + } + + BOOL EqualRgn(HRGN hRgn) const + { + ATLASSERT(m_hRgn != NULL); + return ::EqualRgn(m_hRgn, hRgn); + } + + int OffsetRgn(int x, int y) + { + ATLASSERT(m_hRgn != NULL); + return ::OffsetRgn(m_hRgn, x, y); + } + + int OffsetRgn(POINT point) + { + ATLASSERT(m_hRgn != NULL); + return ::OffsetRgn(m_hRgn, point.x, point.y); + } + + int GetRgnBox(LPRECT lpRect) const + { + ATLASSERT(m_hRgn != NULL); + return ::GetRgnBox(m_hRgn, lpRect); + } + + BOOL PtInRegion(int x, int y) const + { + ATLASSERT(m_hRgn != NULL); + return ::PtInRegion(m_hRgn, x, y); + } + + BOOL PtInRegion(POINT point) const + { + ATLASSERT(m_hRgn != NULL); + return ::PtInRegion(m_hRgn, point.x, point.y); + } + + BOOL RectInRegion(LPCRECT lpRect) const + { + ATLASSERT(m_hRgn != NULL); + return ::RectInRegion(m_hRgn, lpRect); + } + + int GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const + { + ATLASSERT(m_hRgn != NULL); + return (int)::GetRegionData(m_hRgn, nDataSize, lpRgnData); + } +}; + +typedef CRgnT CRgnHandle; +typedef CRgnT CRgn; + + +/////////////////////////////////////////////////////////////////////////////// +// CDC - The device context class + +template +class CDCT +{ +public: +// Data members + HDC m_hDC; + +// Constructor/destructor/operators + CDCT(HDC hDC = NULL) : m_hDC(hDC) + { + } + + ~CDCT() + { + if(t_bManaged && m_hDC != NULL) + ::DeleteDC(Detach()); + } + + CDCT& operator =(HDC hDC) + { + Attach(hDC); + return *this; + } + + void Attach(HDC hDC) + { + if(t_bManaged && m_hDC != NULL && m_hDC != hDC) + ::DeleteDC(m_hDC); + m_hDC = hDC; + } + + HDC Detach() + { + HDC hDC = m_hDC; + m_hDC = NULL; + return hDC; + } + + operator HDC() const { return m_hDC; } + + bool IsNull() const { return (m_hDC == NULL); } + +// Operations +#ifndef _WIN32_WCE + HWND WindowFromDC() const + { + ATLASSERT(m_hDC != NULL); + return ::WindowFromDC(m_hDC); + } +#endif // !_WIN32_WCE + + CPenHandle GetCurrentPen() const + { + ATLASSERT(m_hDC != NULL); + return CPenHandle((HPEN)::GetCurrentObject(m_hDC, OBJ_PEN)); + } + + CBrushHandle GetCurrentBrush() const + { + ATLASSERT(m_hDC != NULL); + return CBrushHandle((HBRUSH)::GetCurrentObject(m_hDC, OBJ_BRUSH)); + } + + CPaletteHandle GetCurrentPalette() const + { + ATLASSERT(m_hDC != NULL); + return CPaletteHandle((HPALETTE)::GetCurrentObject(m_hDC, OBJ_PAL)); + } + + CFontHandle GetCurrentFont() const + { + ATLASSERT(m_hDC != NULL); + return CFontHandle((HFONT)::GetCurrentObject(m_hDC, OBJ_FONT)); + } + + CBitmapHandle GetCurrentBitmap() const + { + ATLASSERT(m_hDC != NULL); + return CBitmapHandle((HBITMAP)::GetCurrentObject(m_hDC, OBJ_BITMAP)); + } + + HDC CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName, LPCTSTR lpszOutput, const DEVMODE* lpInitData) + { + ATLASSERT(m_hDC == NULL); + m_hDC = ::CreateDC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData); + return m_hDC; + } + + HDC CreateCompatibleDC(HDC hDC = NULL) + { + ATLASSERT(m_hDC == NULL); + m_hDC = ::CreateCompatibleDC(hDC); + return m_hDC; + } + + BOOL DeleteDC() + { + if(m_hDC == NULL) + return FALSE; + BOOL bRet = ::DeleteDC(m_hDC); + if(bRet) + m_hDC = NULL; + return bRet; + } + +// Device-Context Functions + int SaveDC() + { + ATLASSERT(m_hDC != NULL); + return ::SaveDC(m_hDC); + } + + BOOL RestoreDC(int nSavedDC) + { + ATLASSERT(m_hDC != NULL); + return ::RestoreDC(m_hDC, nSavedDC); + } + + int GetDeviceCaps(int nIndex) const + { + ATLASSERT(m_hDC != NULL); + return ::GetDeviceCaps(m_hDC, nIndex); + } + +#ifndef _WIN32_WCE + UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags) + { + ATLASSERT(m_hDC != NULL); + return ::SetBoundsRect(m_hDC, lpRectBounds, flags); + } + + UINT GetBoundsRect(LPRECT lpRectBounds, UINT flags) const + { + ATLASSERT(m_hDC != NULL); + return ::GetBoundsRect(m_hDC, lpRectBounds, flags); + } + + BOOL ResetDC(const DEVMODE* lpDevMode) + { + ATLASSERT(m_hDC != NULL); + return ::ResetDC(m_hDC, lpDevMode) != NULL; + } + +// Drawing-Tool Functions + BOOL GetBrushOrg(LPPOINT lpPoint) const + { + ATLASSERT(m_hDC != NULL); + return ::GetBrushOrgEx(m_hDC, lpPoint); + } +#endif // !_WIN32_WCE + + BOOL SetBrushOrg(int x, int y, LPPOINT lpPoint = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::SetBrushOrgEx(m_hDC, x, y, lpPoint); + } + + BOOL SetBrushOrg(POINT point, LPPOINT lpPointRet = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::SetBrushOrgEx(m_hDC, point.x, point.y, lpPointRet); + } + +#ifndef _WIN32_WCE + int EnumObjects(int nObjectType, int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData) + { + ATLASSERT(m_hDC != NULL); +#ifdef STRICT + return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, lpData); +#else + return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, (LPVOID)lpData); +#endif + } +#endif // !_WIN32_WCE + +// Type-safe selection helpers + HPEN SelectPen(HPEN hPen) + { + ATLASSERT(m_hDC != NULL); +#ifndef _WIN32_WCE + ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN || ::GetObjectType(hPen) == OBJ_EXTPEN); +#else // CE specific + ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN); +#endif // _WIN32_WCE + return (HPEN)::SelectObject(m_hDC, hPen); + } + + HBRUSH SelectBrush(HBRUSH hBrush) + { + ATLASSERT(m_hDC != NULL); + ATLASSERT(hBrush == NULL || ::GetObjectType(hBrush) == OBJ_BRUSH); + return (HBRUSH)::SelectObject(m_hDC, hBrush); + } + + HFONT SelectFont(HFONT hFont) + { + ATLASSERT(m_hDC != NULL); + ATLASSERT(hFont == NULL || ::GetObjectType(hFont) == OBJ_FONT); + return (HFONT)::SelectObject(m_hDC, hFont); + } + + HBITMAP SelectBitmap(HBITMAP hBitmap) + { + ATLASSERT(m_hDC != NULL); + ATLASSERT(hBitmap == NULL || ::GetObjectType(hBitmap) == OBJ_BITMAP); + return (HBITMAP)::SelectObject(m_hDC, hBitmap); + } + + int SelectRgn(HRGN hRgn) // special return for regions + { + ATLASSERT(m_hDC != NULL); + ATLASSERT(hRgn == NULL || ::GetObjectType(hRgn) == OBJ_REGION); + return PtrToInt(::SelectObject(m_hDC, hRgn)); + } + +// Type-safe selection helpers for stock objects + HPEN SelectStockPen(int nPen) + { + ATLASSERT(m_hDC != NULL); +#if (_WIN32_WINNT >= 0x0500) + ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); +#else + ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); +#endif // !(_WIN32_WINNT >= 0x0500) + return SelectPen((HPEN)::GetStockObject(nPen)); + } + + HBRUSH SelectStockBrush(int nBrush) + { +#if (_WIN32_WINNT >= 0x0500) + ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); +#else + ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); +#endif // !(_WIN32_WINNT >= 0x0500) + return SelectBrush((HBRUSH)::GetStockObject(nBrush)); + } + + HFONT SelectStockFont(int nFont) + { +#ifndef _WIN32_WCE + ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); +#else // CE specific + ATLASSERT(nFont == SYSTEM_FONT); +#endif // _WIN32_WCE + return SelectFont((HFONT)::GetStockObject(nFont)); + } + + HPALETTE SelectStockPalette(int nPalette, BOOL bForceBackground) + { + ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported + return SelectPalette((HPALETTE)::GetStockObject(nPalette), bForceBackground); + } + +// Color and Color Palette Functions + COLORREF GetNearestColor(COLORREF crColor) const + { + ATLASSERT(m_hDC != NULL); + return ::GetNearestColor(m_hDC, crColor); + } + + HPALETTE SelectPalette(HPALETTE hPalette, BOOL bForceBackground) + { + ATLASSERT(m_hDC != NULL); + + return ::SelectPalette(m_hDC, hPalette, bForceBackground); + } + + UINT RealizePalette() + { + ATLASSERT(m_hDC != NULL); + return ::RealizePalette(m_hDC); + } + +#ifndef _WIN32_WCE + void UpdateColors() + { + ATLASSERT(m_hDC != NULL); + ::UpdateColors(m_hDC); + } +#endif // !_WIN32_WCE + +// Drawing-Attribute Functions + COLORREF GetBkColor() const + { + ATLASSERT(m_hDC != NULL); + return ::GetBkColor(m_hDC); + } + + int GetBkMode() const + { + ATLASSERT(m_hDC != NULL); + return ::GetBkMode(m_hDC); + } + +#ifndef _WIN32_WCE + int GetPolyFillMode() const + { + ATLASSERT(m_hDC != NULL); + return ::GetPolyFillMode(m_hDC); + } + + int GetROP2() const + { + ATLASSERT(m_hDC != NULL); + return ::GetROP2(m_hDC); + } + + int GetStretchBltMode() const + { + ATLASSERT(m_hDC != NULL); + return ::GetStretchBltMode(m_hDC); + } +#endif // !_WIN32_WCE + + COLORREF GetTextColor() const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextColor(m_hDC); + } + + COLORREF SetBkColor(COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::SetBkColor(m_hDC, crColor); + } + + int SetBkMode(int nBkMode) + { + ATLASSERT(m_hDC != NULL); + return ::SetBkMode(m_hDC, nBkMode); + } + +#ifndef _WIN32_WCE + int SetPolyFillMode(int nPolyFillMode) + { + ATLASSERT(m_hDC != NULL); + return ::SetPolyFillMode(m_hDC, nPolyFillMode); + } +#endif // !_WIN32_WCE + + int SetROP2(int nDrawMode) + { + ATLASSERT(m_hDC != NULL); + return ::SetROP2(m_hDC, nDrawMode); + } + +#ifndef _WIN32_WCE + int SetStretchBltMode(int nStretchMode) + { + ATLASSERT(m_hDC != NULL); + return ::SetStretchBltMode(m_hDC, nStretchMode); + } +#endif // !_WIN32_WCE + + COLORREF SetTextColor(COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::SetTextColor(m_hDC, crColor); + } + +#ifndef _WIN32_WCE + BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const + { + ATLASSERT(m_hDC != NULL); + return ::GetColorAdjustment(m_hDC, lpColorAdjust); + } + + BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust) + { + ATLASSERT(m_hDC != NULL); + return ::SetColorAdjustment(m_hDC, lpColorAdjust); + } + +// Mapping Functions + int GetMapMode() const + { + ATLASSERT(m_hDC != NULL); + return ::GetMapMode(m_hDC); + } + + BOOL GetViewportOrg(LPPOINT lpPoint) const + { + ATLASSERT(m_hDC != NULL); + return ::GetViewportOrgEx(m_hDC, lpPoint); + } + + int SetMapMode(int nMapMode) + { + ATLASSERT(m_hDC != NULL); + return ::SetMapMode(m_hDC, nMapMode); + } +#endif // !_WIN32_WCE + + // Viewport Origin + BOOL SetViewportOrg(int x, int y, LPPOINT lpPoint = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::SetViewportOrgEx(m_hDC, x, y, lpPoint); + } + + BOOL SetViewportOrg(POINT point, LPPOINT lpPointRet = NULL) + { + ATLASSERT(m_hDC != NULL); + return SetViewportOrg(point.x, point.y, lpPointRet); + } + +#ifndef _WIN32_WCE + BOOL OffsetViewportOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::OffsetViewportOrgEx(m_hDC, nWidth, nHeight, lpPoint); + } + + // Viewport Extent + BOOL GetViewportExt(LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + return ::GetViewportExtEx(m_hDC, lpSize); + } + + BOOL SetViewportExt(int x, int y, LPSIZE lpSize = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::SetViewportExtEx(m_hDC, x, y, lpSize); + } + + BOOL SetViewportExt(SIZE size, LPSIZE lpSizeRet = NULL) + { + ATLASSERT(m_hDC != NULL); + return SetViewportExt(size.cx, size.cy, lpSizeRet); + } + + BOOL ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::ScaleViewportExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); + } +#endif // !_WIN32_WCE + + // Window Origin +#ifndef _WIN32_WCE + BOOL GetWindowOrg(LPPOINT lpPoint) const + { + ATLASSERT(m_hDC != NULL); + return ::GetWindowOrgEx(m_hDC, lpPoint); + } + + BOOL SetWindowOrg(int x, int y, LPPOINT lpPoint = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::SetWindowOrgEx(m_hDC, x, y, lpPoint); + } + + BOOL SetWindowOrg(POINT point, LPPOINT lpPointRet = NULL) + { + ATLASSERT(m_hDC != NULL); + return SetWindowOrg(point.x, point.y, lpPointRet); + } + + BOOL OffsetWindowOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::OffsetWindowOrgEx(m_hDC, nWidth, nHeight, lpPoint); + } + + // Window extent + BOOL GetWindowExt(LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + return ::GetWindowExtEx(m_hDC, lpSize); + } + + BOOL SetWindowExt(int x, int y, LPSIZE lpSize = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::SetWindowExtEx(m_hDC, x, y, lpSize); + } + + BOOL SetWindowExt(SIZE size, LPSIZE lpSizeRet = NULL) + { + ATLASSERT(m_hDC != NULL); + return SetWindowExt(size.cx, size.cy, lpSizeRet); + } + + BOOL ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::ScaleWindowExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); + } + +// Coordinate Functions + BOOL DPtoLP(LPPOINT lpPoints, int nCount = 1) const + { + ATLASSERT(m_hDC != NULL); + return ::DPtoLP(m_hDC, lpPoints, nCount); + } + + BOOL DPtoLP(LPRECT lpRect) const + { + ATLASSERT(m_hDC != NULL); + return ::DPtoLP(m_hDC, (LPPOINT)lpRect, 2); + } + + BOOL DPtoLP(LPSIZE lpSize) const + { + SIZE sizeWinExt = { 0, 0 }; + if(!GetWindowExt(&sizeWinExt)) + return FALSE; + SIZE sizeVpExt = { 0, 0 }; + if(!GetViewportExt(&sizeVpExt)) + return FALSE; + lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeWinExt.cx), abs(sizeVpExt.cx)); + lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeWinExt.cy), abs(sizeVpExt.cy)); + return TRUE; + } + + BOOL LPtoDP(LPPOINT lpPoints, int nCount = 1) const + { + ATLASSERT(m_hDC != NULL); + return ::LPtoDP(m_hDC, lpPoints, nCount); + } + + BOOL LPtoDP(LPRECT lpRect) const + { + ATLASSERT(m_hDC != NULL); + return ::LPtoDP(m_hDC, (LPPOINT)lpRect, 2); + } + + BOOL LPtoDP(LPSIZE lpSize) const + { + SIZE sizeWinExt = { 0, 0 }; + if(!GetWindowExt(&sizeWinExt)) + return FALSE; + SIZE sizeVpExt = { 0, 0 }; + if(!GetViewportExt(&sizeVpExt)) + return FALSE; + lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeVpExt.cx), abs(sizeWinExt.cx)); + lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeVpExt.cy), abs(sizeWinExt.cy)); + return TRUE; + } + +// Special Coordinate Functions (useful for dealing with metafiles and OLE) + #define HIMETRIC_INCH 2540 // HIMETRIC units per inch + + void DPtoHIMETRIC(LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + int nMapMode; + if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) + { + // when using a constrained map mode, map against physical inch + ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); + DPtoLP(lpSize); + ((CDCHandle*)this)->SetMapMode(nMapMode); + } + else + { + // map against logical inch for non-constrained mapping modes + int cxPerInch = GetDeviceCaps(LOGPIXELSX); + int cyPerInch = GetDeviceCaps(LOGPIXELSY); + ATLASSERT(cxPerInch != 0 && cyPerInch != 0); + lpSize->cx = ::MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch); + lpSize->cy = ::MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch); + } + } + + void HIMETRICtoDP(LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + int nMapMode; + if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) + { + // when using a constrained map mode, map against physical inch + ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); + LPtoDP(lpSize); + ((CDCHandle*)this)->SetMapMode(nMapMode); + } + else + { + // map against logical inch for non-constrained mapping modes + int cxPerInch = GetDeviceCaps(LOGPIXELSX); + int cyPerInch = GetDeviceCaps(LOGPIXELSY); + ATLASSERT(cxPerInch != 0 && cyPerInch != 0); + lpSize->cx = ::MulDiv(lpSize->cx, cxPerInch, HIMETRIC_INCH); + lpSize->cy = ::MulDiv(lpSize->cy, cyPerInch, HIMETRIC_INCH); + } + } + + void LPtoHIMETRIC(LPSIZE lpSize) const + { + LPtoDP(lpSize); + DPtoHIMETRIC(lpSize); + } + + void HIMETRICtoLP(LPSIZE lpSize) const + { + HIMETRICtoDP(lpSize); + DPtoLP(lpSize); + } +#endif // !_WIN32_WCE + +// Region Functions + BOOL FillRgn(HRGN hRgn, HBRUSH hBrush) + { + ATLASSERT(m_hDC != NULL); + return ::FillRgn(m_hDC, hRgn, hBrush); + } + +#ifndef _WIN32_WCE + BOOL FrameRgn(HRGN hRgn, HBRUSH hBrush, int nWidth, int nHeight) + { + ATLASSERT(m_hDC != NULL); + return ::FrameRgn(m_hDC, hRgn, hBrush, nWidth, nHeight); + } + + BOOL InvertRgn(HRGN hRgn) + { + ATLASSERT(m_hDC != NULL); + return ::InvertRgn(m_hDC, hRgn); + } + + BOOL PaintRgn(HRGN hRgn) + { + ATLASSERT(m_hDC != NULL); + return ::PaintRgn(m_hDC, hRgn); + } +#endif // !_WIN32_WCE + +// Clipping Functions + int GetClipBox(LPRECT lpRect) const + { + ATLASSERT(m_hDC != NULL); + return ::GetClipBox(m_hDC, lpRect); + } + + int GetClipRgn(CRgn& region) const + { + ATLASSERT(m_hDC != NULL); + if(region.IsNull()) + region.CreateRectRgn(0, 0, 0, 0); + + int nRet = ::GetClipRgn(m_hDC, region); + if(nRet != 1) + region.DeleteObject(); + + return nRet; + } + +#ifndef _WIN32_WCE + BOOL PtVisible(int x, int y) const + { + ATLASSERT(m_hDC != NULL); + return ::PtVisible(m_hDC, x, y); + } + + BOOL PtVisible(POINT point) const + { + ATLASSERT(m_hDC != NULL); + return ::PtVisible(m_hDC, point.x, point.y); + } +#endif // !_WIN32_WCE + + BOOL RectVisible(LPCRECT lpRect) const + { + ATLASSERT(m_hDC != NULL); + return ::RectVisible(m_hDC, lpRect); + } + + int SelectClipRgn(HRGN hRgn) + { + ATLASSERT(m_hDC != NULL); + return ::SelectClipRgn(m_hDC, (HRGN)hRgn); + } + + int ExcludeClipRect(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hDC != NULL); + return ::ExcludeClipRect(m_hDC, x1, y1, x2, y2); + } + + int ExcludeClipRect(LPCRECT lpRect) + { + ATLASSERT(m_hDC != NULL); + return ::ExcludeClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + +#ifndef _WIN32_WCE + int ExcludeUpdateRgn(HWND hWnd) + { + ATLASSERT(m_hDC != NULL); + return ::ExcludeUpdateRgn(m_hDC, hWnd); + } +#endif // !_WIN32_WCE + + int IntersectClipRect(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hDC != NULL); + return ::IntersectClipRect(m_hDC, x1, y1, x2, y2); + } + + int IntersectClipRect(LPCRECT lpRect) + { + ATLASSERT(m_hDC != NULL); + return ::IntersectClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + +#ifndef _WIN32_WCE + int OffsetClipRgn(int x, int y) + { + ATLASSERT(m_hDC != NULL); + return ::OffsetClipRgn(m_hDC, x, y); + } + + int OffsetClipRgn(SIZE size) + { + ATLASSERT(m_hDC != NULL); + return ::OffsetClipRgn(m_hDC, size.cx, size.cy); + } + + int SelectClipRgn(HRGN hRgn, int nMode) + { + ATLASSERT(m_hDC != NULL); + return ::ExtSelectClipRgn(m_hDC, hRgn, nMode); + } +#endif // !_WIN32_WCE + +// Line-Output Functions +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + BOOL GetCurrentPosition(LPPOINT lpPoint) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCurrentPositionEx(m_hDC, lpPoint); + } + + BOOL MoveTo(int x, int y, LPPOINT lpPoint = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::MoveToEx(m_hDC, x, y, lpPoint); + } + + BOOL MoveTo(POINT point, LPPOINT lpPointRet = NULL) + { + ATLASSERT(m_hDC != NULL); + return MoveTo(point.x, point.y, lpPointRet); + } + + BOOL LineTo(int x, int y) + { + ATLASSERT(m_hDC != NULL); + return ::LineTo(m_hDC, x, y); + } + + BOOL LineTo(POINT point) + { + ATLASSERT(m_hDC != NULL); + return LineTo(point.x, point.y); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + +#ifndef _WIN32_WCE + BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) + { + ATLASSERT(m_hDC != NULL); + return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); + } + + BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd) + { + ATLASSERT(m_hDC != NULL); + return ::Arc(m_hDC, lpRect->left, lpRect->top, + lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, + ptEnd.x, ptEnd.y); + } +#endif // !_WIN32_WCE + + BOOL Polyline(LPPOINT lpPoints, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::Polyline(m_hDC, lpPoints, nCount); + } + +#ifndef _WIN32_WCE + BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle) + { + ATLASSERT(m_hDC != NULL); + return ::AngleArc(m_hDC, x, y, nRadius, fStartAngle, fSweepAngle); + } + + BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) + { + ATLASSERT(m_hDC != NULL); + return ::ArcTo(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); + } + + BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd) + { + ATLASSERT(m_hDC != NULL); + return ArcTo(lpRect->left, lpRect->top, lpRect->right, + lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); + } + + int GetArcDirection() const + { + ATLASSERT(m_hDC != NULL); + return ::GetArcDirection(m_hDC); + } + + int SetArcDirection(int nArcDirection) + { + ATLASSERT(m_hDC != NULL); + return ::SetArcDirection(m_hDC, nArcDirection); + } + + BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::PolyDraw(m_hDC, lpPoints, lpTypes, nCount); + } + + BOOL PolylineTo(const POINT* lpPoints, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::PolylineTo(m_hDC, lpPoints, nCount); + } + + BOOL PolyPolyline(const POINT* lpPoints, + const DWORD* lpPolyPoints, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::PolyPolyline(m_hDC, lpPoints, lpPolyPoints, nCount); + } + + BOOL PolyBezier(const POINT* lpPoints, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::PolyBezier(m_hDC, lpPoints, nCount); + } + + BOOL PolyBezierTo(const POINT* lpPoints, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::PolyBezierTo(m_hDC, lpPoints, nCount); + } +#endif // !_WIN32_WCE + +// Simple Drawing Functions + BOOL FillRect(LPCRECT lpRect, HBRUSH hBrush) + { + ATLASSERT(m_hDC != NULL); + return ::FillRect(m_hDC, lpRect, hBrush); + } + + BOOL FillRect(LPCRECT lpRect, int nColorIndex) + { + ATLASSERT(m_hDC != NULL); +#ifndef _WIN32_WCE + return ::FillRect(m_hDC, lpRect, (HBRUSH)LongToPtr(nColorIndex + 1)); +#else // CE specific + return ::FillRect(m_hDC, lpRect, ::GetSysColorBrush(nColorIndex)); +#endif // _WIN32_WCE + } + +#ifndef _WIN32_WCE + BOOL FrameRect(LPCRECT lpRect, HBRUSH hBrush) + { + ATLASSERT(m_hDC != NULL); + return ::FrameRect(m_hDC, lpRect, hBrush); + } +#endif // !_WIN32_WCE + +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) + BOOL InvertRect(LPCRECT lpRect) + { + ATLASSERT(m_hDC != NULL); + return ::InvertRect(m_hDC, lpRect); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) + + BOOL DrawIcon(int x, int y, HICON hIcon) + { + ATLASSERT(m_hDC != NULL); +#ifndef _WIN32_WCE + return ::DrawIcon(m_hDC, x, y, hIcon); +#else // CE specific + return ::DrawIconEx(m_hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL); +#endif // _WIN32_WCE + } + + BOOL DrawIcon(POINT point, HICON hIcon) + { + ATLASSERT(m_hDC != NULL); +#ifndef _WIN32_WCE + return ::DrawIcon(m_hDC, point.x, point.y, hIcon); +#else // CE specific + return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, 0, 0, 0, NULL, DI_NORMAL); +#endif // _WIN32_WCE + } + + BOOL DrawIconEx(int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawIconEx(m_hDC, x, y, hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); + } + + BOOL DrawIconEx(POINT point, HICON hIcon, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); + } + +#ifndef _WIN32_WCE + BOOL DrawState(POINT pt, SIZE size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hBitmap, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_BITMAP); + } + + BOOL DrawState(POINT pt, SIZE size, HICON hIcon, UINT nFlags, HBRUSH hBrush = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_ICON); + } + + BOOL DrawState(POINT pt, SIZE size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags | (bPrefixText ? DST_PREFIXTEXT : DST_TEXT)); + } + + BOOL DrawState(POINT pt, SIZE size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, HBRUSH hBrush = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawState(m_hDC, hBrush, lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_COMPLEX); + } +#endif // !_WIN32_WCE + +// Ellipse and Polygon Functions +#ifndef _WIN32_WCE + BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) + { + ATLASSERT(m_hDC != NULL); + return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); + } + + BOOL Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd) + { + ATLASSERT(m_hDC != NULL); + return ::Chord(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); + } +#endif // !_WIN32_WCE + + void DrawFocusRect(LPCRECT lpRect) + { + ATLASSERT(m_hDC != NULL); + ::DrawFocusRect(m_hDC, lpRect); + } + + BOOL Ellipse(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hDC != NULL); + return ::Ellipse(m_hDC, x1, y1, x2, y2); + } + + BOOL Ellipse(LPCRECT lpRect) + { + ATLASSERT(m_hDC != NULL); + return ::Ellipse(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + +#ifndef _WIN32_WCE + BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) + { + ATLASSERT(m_hDC != NULL); + return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); + } + + BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd) + { + ATLASSERT(m_hDC != NULL); + return ::Pie(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); + } +#endif // !_WIN32_WCE + + BOOL Polygon(LPPOINT lpPoints, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::Polygon(m_hDC, lpPoints, nCount); + } + +#ifndef _WIN32_WCE + BOOL PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount) + { + ATLASSERT(m_hDC != NULL); + return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); + } +#endif // !_WIN32_WCE + + BOOL Rectangle(int x1, int y1, int x2, int y2) + { + ATLASSERT(m_hDC != NULL); + return ::Rectangle(m_hDC, x1, y1, x2, y2); + } + + BOOL Rectangle(LPCRECT lpRect) + { + ATLASSERT(m_hDC != NULL); + return ::Rectangle(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); + } + + BOOL RoundRect(int x1, int y1, int x2, int y2, int x3, int y3) + { + ATLASSERT(m_hDC != NULL); + return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3); + } + + BOOL RoundRect(LPCRECT lpRect, POINT point) + { + ATLASSERT(m_hDC != NULL); + return ::RoundRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, point.x, point.y); + } + +// Bitmap Functions + BOOL PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop) + { + ATLASSERT(m_hDC != NULL); + return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop); + } + + BOOL BitBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, + int xSrc, int ySrc, DWORD dwRop) + { + ATLASSERT(m_hDC != NULL); + return ::BitBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, dwRop); + } + + BOOL StretchBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop) + { + ATLASSERT(m_hDC != NULL); + return ::StretchBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwRop); + } + + COLORREF GetPixel(int x, int y) const + { + ATLASSERT(m_hDC != NULL); + return ::GetPixel(m_hDC, x, y); + } + + COLORREF GetPixel(POINT point) const + { + ATLASSERT(m_hDC != NULL); + return ::GetPixel(m_hDC, point.x, point.y); + } + + COLORREF SetPixel(int x, int y, COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::SetPixel(m_hDC, x, y, crColor); + } + + COLORREF SetPixel(POINT point, COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::SetPixel(m_hDC, point.x, point.y, crColor); + } + +#ifndef _WIN32_WCE + BOOL FloodFill(int x, int y, COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::FloodFill(m_hDC, x, y, crColor); + } + + BOOL ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType) + { + ATLASSERT(m_hDC != NULL); + return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); + } +#endif // !_WIN32_WCE + + BOOL MaskBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, HBITMAP hMaskBitmap, int xMask, int yMask, DWORD dwRop) + { + ATLASSERT(m_hDC != NULL); + return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, hMaskBitmap, xMask, yMask, dwRop); + } + +#ifndef _WIN32_WCE + BOOL PlgBlt(LPPOINT lpPoint, HDC hSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, HBITMAP hMaskBitmap, int xMask, int yMask) + { + ATLASSERT(m_hDC != NULL); + return ::PlgBlt(m_hDC, lpPoint, hSrcDC, xSrc, ySrc, nWidth, nHeight, hMaskBitmap, xMask, yMask); + } + + BOOL SetPixelV(int x, int y, COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::SetPixelV(m_hDC, x, y, crColor); + } + + BOOL SetPixelV(POINT point, COLORREF crColor) + { + ATLASSERT(m_hDC != NULL); + return ::SetPixelV(m_hDC, point.x, point.y, crColor); + } +#endif // !_WIN32_WCE + +#if !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) +#ifndef _WIN32_WCE + BOOL TransparentBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) + { + ATLASSERT(m_hDC != NULL); + return ::TransparentBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); + } +#else // CE specific + BOOL TransparentImage(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) + { + ATLASSERT(m_hDC != NULL); + return ::TransparentImage(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); + } +#endif // _WIN32_WCE + +#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420)) + BOOL GradientFill(const PTRIVERTEX pVertices, DWORD nVertices, void* pMeshElements, DWORD nMeshElements, DWORD dwMode) + { + ATLASSERT(m_hDC != NULL); + return ::GradientFill(m_hDC, pVertices, nVertices, pMeshElements, nMeshElements, dwMode); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) + +#if !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) + BOOL AlphaBlend(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BLENDFUNCTION bf) + { + ATLASSERT(m_hDC != NULL); + return ::AlphaBlend(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) +#endif // !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) + +// Extra bitmap functions + // Helper function for painting a disabled toolbar or menu bitmap + // This function can take either an HBITMAP (for SS) or a DC with + // the bitmap already painted (for cmdbar) + BOOL DitherBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, HBITMAP hBitmap, int xSrc, int ySrc, + HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), + HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), + HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) + { + ATLASSERT(m_hDC != NULL || hBitmap != NULL); + ATLASSERT(nWidth > 0 && nHeight > 0); + + // Create a generic DC for all BitBlts + CDCHandle dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC); + ATLASSERT(dc.m_hDC != NULL); + if(dc.m_hDC == NULL) + return FALSE; + + // Create a DC for the monochrome DIB section + CDC dcBW = ::CreateCompatibleDC(m_hDC); + ATLASSERT(dcBW.m_hDC != NULL); + if(dcBW.m_hDC == NULL) + { + if(hSrcDC == NULL) + dc.DeleteDC(); + return FALSE; + } + + // Create the monochrome DIB section with a black and white palette + struct RGBBWBITMAPINFO + { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[2]; + }; + + RGBBWBITMAPINFO rgbBWBitmapInfo = + { + { sizeof(BITMAPINFOHEADER), nWidth, nHeight, 1, 1, BI_RGB, 0, 0, 0, 0, 0 }, + { { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 } } + }; + + VOID* pbitsBW; + CBitmap bmpBW = ::CreateDIBSection(dcBW, (LPBITMAPINFO)&rgbBWBitmapInfo, DIB_RGB_COLORS, &pbitsBW, NULL, 0); + ATLASSERT(bmpBW.m_hBitmap != NULL); + if(bmpBW.m_hBitmap == NULL) + { + if(hSrcDC == NULL) + dc.DeleteDC(); + return FALSE; + } + + // Attach the monochrome DIB section and the bitmap to the DCs + HBITMAP hbmOldBW = dcBW.SelectBitmap(bmpBW); + HBITMAP hbmOldDC = NULL; + if(hBitmap != NULL) + hbmOldDC = dc.SelectBitmap(hBitmap); + + // Block: Dark gray removal: we want (128, 128, 128) pixels to become black and not white + { + CDC dcTemp1 = ::CreateCompatibleDC(m_hDC); + CDC dcTemp2 = ::CreateCompatibleDC(m_hDC); + CBitmap bmpTemp1; + bmpTemp1.CreateCompatibleBitmap(dc, nWidth, nHeight); + CBitmap bmpTemp2; + bmpTemp2.CreateBitmap(nWidth, nHeight, 1, 1, NULL); + HBITMAP hOldBmp1 = dcTemp1.SelectBitmap(bmpTemp1); + HBITMAP hOldBmp2 = dcTemp2.SelectBitmap(bmpTemp2); + // Let's copy our image, it will be altered + dcTemp1.BitBlt(0, 0, nWidth, nHeight, dc, xSrc, ySrc, SRCCOPY); + + // All dark gray pixels will become white, the others black + dcTemp1.SetBkColor(RGB(128, 128, 128)); + dcTemp2.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); + // Do an XOR to set to black these white pixels + dcTemp1.BitBlt(0, 0, nWidth, nHeight, dcTemp2, 0, 0, SRCINVERT); + + // BitBlt the bitmap into the monochrome DIB section + // The DIB section will do a true monochrome conversion + // The magenta background being closer to white will become white + dcBW.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); + + // Cleanup + dcTemp1.SelectBitmap(hOldBmp1); + dcTemp2.SelectBitmap(hOldBmp2); + } + + // Paint the destination rectangle using hBrushBackground + if(hBrushBackground != NULL) + { + RECT rc = { x, y, x + nWidth, y + nHeight }; + FillRect(&rc, hBrushBackground); + } + + // BitBlt the black bits in the monochrome bitmap into hBrush3DEffect color in the destination DC + // The magic ROP comes from the Charles Petzold's book + HBRUSH hOldBrush = SelectBrush(hBrush3DEffect); + BitBlt(x + 1, y + 1, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); + + // BitBlt the black bits in the monochrome bitmap into hBrushDisabledImage color in the destination DC + SelectBrush(hBrushDisabledImage); + BitBlt(x, y, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); + + SelectBrush(hOldBrush); + dcBW.SelectBitmap(hbmOldBW); + dc.SelectBitmap(hbmOldDC); + + if(hSrcDC == NULL) + dc.DeleteDC(); + + return TRUE; + } + +// Text Functions +#ifndef _WIN32_WCE + BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount = -1) + { + ATLASSERT(m_hDC != NULL); + if(nCount == -1) + nCount = lstrlen(lpszString); + return ::TextOut(m_hDC, x, y, lpszString, nCount); + } +#endif // !_WIN32_WCE + + BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, UINT nCount = -1, LPINT lpDxWidths = NULL) + { + ATLASSERT(m_hDC != NULL); + if(nCount == -1) + nCount = lstrlen(lpszString); + return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect, lpszString, nCount, lpDxWidths); + } + +#ifndef _WIN32_WCE + SIZE TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL, int nTabOrigin = 0) + { + ATLASSERT(m_hDC != NULL); + if(nCount == -1) + nCount = lstrlen(lpszString); + LONG lRes = ::TabbedTextOut(m_hDC, x, y, lpszString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin); + SIZE size = { GET_X_LPARAM(lRes), GET_Y_LPARAM(lRes) }; + return size; + } +#endif // !_WIN32_WCE + + int DrawText(LPCTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) + { + ATLASSERT(m_hDC != NULL); +#ifndef _WIN32_WCE + ATLASSERT((uFormat & DT_MODIFYSTRING) == 0); +#endif // !_WIN32_WCE + return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); + } + + int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) + { + ATLASSERT(m_hDC != NULL); + return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); + } + +#ifndef _WIN32_WCE + int DrawTextEx(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::DrawTextEx(m_hDC, lpstrText, cchText, lpRect, uFormat, lpDTParams); + } +#endif // !_WIN32_WCE + +#if (_WIN32_WINNT >= 0x0501) + int DrawShadowText(LPCWSTR lpstrText, int cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset) + { + ATLASSERT(m_hDC != NULL); + // This function is present only if comctl32.dll version 6 is loaded; + // we use LoadLibrary/GetProcAddress to allow apps compiled with + // _WIN32_WINNT >= 0x0501 to run on older Windows/CommCtrl + int nRet = 0; + HMODULE hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); + ATLASSERT(hCommCtrlDLL != NULL); + if(hCommCtrlDLL != NULL) + { + typedef int (WINAPI *PFN_DrawShadowText)(HDC hDC, LPCWSTR lpstrText, UINT cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset); + PFN_DrawShadowText pfnDrawShadowText = (PFN_DrawShadowText)::GetProcAddress(hCommCtrlDLL, "DrawShadowText"); + ATLASSERT(pfnDrawShadowText != NULL); // this function requires CommCtrl6 + if(pfnDrawShadowText != NULL) + nRet = pfnDrawShadowText(m_hDC, lpstrText, cchText, lpRect, dwFlags, clrText, clrShadow, xOffset, yOffset); + ::FreeLibrary(hCommCtrlDLL); + } + return nRet; + } +#endif // (_WIN32_WINNT >= 0x0501) + + BOOL GetTextExtent(LPCTSTR lpszString, int nCount, LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + if(nCount == -1) + nCount = lstrlen(lpszString); + return ::GetTextExtentPoint32(m_hDC, lpszString, nCount, lpSize); + } + + BOOL GetTextExtentExPoint(LPCTSTR lpszString, int cchString, LPSIZE lpSize, int nMaxExtent, LPINT lpnFit = NULL, LPINT alpDx = NULL) + { + ATLASSERT(m_hDC != NULL); + return ::GetTextExtentExPoint(m_hDC, lpszString, cchString, nMaxExtent, lpnFit, alpDx, lpSize); + } + +#ifndef _WIN32_WCE + DWORD GetTabbedTextExtent(LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL) const + { + ATLASSERT(m_hDC != NULL); + if(nCount == -1) + nCount = lstrlen(lpszString); + return ::GetTabbedTextExtent(m_hDC, lpszString, nCount, nTabPositions, lpnTabStopPositions); + } + + BOOL GrayString(HBRUSH hBrush, BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int), LPARAM lpData, int nCount, int x, int y, int nWidth, int nHeight) + { + ATLASSERT(m_hDC != NULL); + return ::GrayString(m_hDC, hBrush, (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); + } +#endif // !_WIN32_WCE + +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + UINT GetTextAlign() const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextAlign(m_hDC); + } + + UINT SetTextAlign(UINT nFlags) + { + ATLASSERT(m_hDC != NULL); + return ::SetTextAlign(m_hDC, nFlags); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + + int GetTextFace(LPTSTR lpszFacename, int nCount) const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextFace(m_hDC, nCount, lpszFacename); + } + + int GetTextFaceLen() const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextFace(m_hDC, 0, NULL); + } + +#ifndef _ATL_NO_COM +#ifdef _OLEAUTO_H_ + BOOL GetTextFace(BSTR& bstrFace) const + { + USES_CONVERSION; + ATLASSERT(m_hDC != NULL); + ATLASSERT(bstrFace == NULL); + + int nLen = GetTextFaceLen(); + if(nLen == 0) + return FALSE; + + CTempBuffer buff; + LPTSTR lpszText = buff.Allocate(nLen); + if(lpszText == NULL) + return FALSE; + + if(!GetTextFace(lpszText, nLen)) + return FALSE; + + bstrFace = ::SysAllocString(T2OLE(lpszText)); + return (bstrFace != NULL) ? TRUE : FALSE; + } +#endif +#endif // !_ATL_NO_COM + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetTextFace(_CSTRING_NS::CString& strFace) const + { + ATLASSERT(m_hDC != NULL); + + int nLen = GetTextFaceLen(); + if(nLen == 0) + return 0; + + LPTSTR lpstr = strFace.GetBufferSetLength(nLen); + if(lpstr == NULL) + return 0; + int nRet = GetTextFace(lpstr, nLen); + strFace.ReleaseBuffer(); + return nRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + BOOL GetTextMetrics(LPTEXTMETRIC lpMetrics) const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextMetrics(m_hDC, lpMetrics); + } + +#ifndef _WIN32_WCE + int SetTextJustification(int nBreakExtra, int nBreakCount) + { + ATLASSERT(m_hDC != NULL); + return ::SetTextJustification(m_hDC, nBreakExtra, nBreakCount); + } + + int GetTextCharacterExtra() const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextCharacterExtra(m_hDC); + } + + int SetTextCharacterExtra(int nCharExtra) + { + ATLASSERT(m_hDC != NULL); + return ::SetTextCharacterExtra(m_hDC, nCharExtra); + } +#endif // !_WIN32_WCE + +// Advanced Drawing + BOOL DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags) + { + ATLASSERT(m_hDC != NULL); + return ::DrawEdge(m_hDC, lpRect, nEdge, nFlags); + } + + BOOL DrawFrameControl(LPRECT lpRect, UINT nType, UINT nState) + { + ATLASSERT(m_hDC != NULL); + return ::DrawFrameControl(m_hDC, lpRect, nType, nState); + } + +// Scrolling Functions + BOOL ScrollDC(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate) + { + ATLASSERT(m_hDC != NULL); + return ::ScrollDC(m_hDC, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate); + } + +// Font Functions +#ifndef _WIN32_WCE + BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharWidth(m_hDC, nFirstChar, nLastChar, lpBuffer); + } + + // GetCharWidth32 is not supported under Win9x + BOOL GetCharWidth32(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharWidth32(m_hDC, nFirstChar, nLastChar, lpBuffer); + } + + DWORD SetMapperFlags(DWORD dwFlag) + { + ATLASSERT(m_hDC != NULL); + return ::SetMapperFlags(m_hDC, dwFlag); + } + + BOOL GetAspectRatioFilter(LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + return ::GetAspectRatioFilterEx(m_hDC, lpSize); + } + + BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABC lpabc) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharABCWidths(m_hDC, nFirstChar, nLastChar, lpabc); + } + + DWORD GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData, DWORD cbData) const + { + ATLASSERT(m_hDC != NULL); + return ::GetFontData(m_hDC, dwTable, dwOffset, lpData, cbData); + } + + int GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const + { + ATLASSERT(m_hDC != NULL); + return ::GetKerningPairs(m_hDC, nPairs, lpkrnpair); + } + + UINT GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const + { + ATLASSERT(m_hDC != NULL); + return ::GetOutlineTextMetrics(m_hDC, cbData, lpotm); + } + + DWORD GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpBuffer, const MAT2* lpmat2) const + { + ATLASSERT(m_hDC != NULL); + return ::GetGlyphOutline(m_hDC, nChar, nFormat, lpgm, cbBuffer, lpBuffer, lpmat2); + } + + BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABCFLOAT lpABCF) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharABCWidthsFloat(m_hDC, nFirstChar, nLastChar, lpABCF); + } + + BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, float* lpFloatBuffer) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharWidthFloat(m_hDC, nFirstChar, nLastChar, lpFloatBuffer); + } +#endif // !_WIN32_WCE + +// Printer/Device Escape Functions +#ifndef _WIN32_WCE + int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData) + { + ATLASSERT(m_hDC != NULL); + return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData); + } +#endif // !_WIN32_WCE + + int Escape(int nEscape, int nInputSize, LPCSTR lpszInputData, + int nOutputSize, LPSTR lpszOutputData) + { + ATLASSERT(m_hDC != NULL); + return ::ExtEscape(m_hDC, nEscape, nInputSize, lpszInputData, nOutputSize, lpszOutputData); + } + +#ifndef _WIN32_WCE + int DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData) + { + ATLASSERT(m_hDC != NULL); + return ::DrawEscape(m_hDC, nEscape, nInputSize, lpszInputData); + } +#endif // !_WIN32_WCE + + // Escape helpers +#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) + int StartDoc(LPCTSTR lpszDocName) // old Win3.0 version + { + DOCINFO di = { 0 }; + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = lpszDocName; + return StartDoc(&di); + } + + int StartDoc(LPDOCINFO lpDocInfo) + { + ATLASSERT(m_hDC != NULL); + return ::StartDoc(m_hDC, lpDocInfo); + } + + int StartPage() + { + ATLASSERT(m_hDC != NULL); + return ::StartPage(m_hDC); + } + + int EndPage() + { + ATLASSERT(m_hDC != NULL); + return ::EndPage(m_hDC); + } + + int SetAbortProc(BOOL (CALLBACK* lpfn)(HDC, int)) + { + ATLASSERT(m_hDC != NULL); + return ::SetAbortProc(m_hDC, (ABORTPROC)lpfn); + } + + int AbortDoc() + { + ATLASSERT(m_hDC != NULL); + return ::AbortDoc(m_hDC); + } + + int EndDoc() + { + ATLASSERT(m_hDC != NULL); + return ::EndDoc(m_hDC); + } +#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) + +// MetaFile Functions +#ifndef _WIN32_WCE + BOOL PlayMetaFile(HMETAFILE hMF) + { + ATLASSERT(m_hDC != NULL); + if(::GetDeviceCaps(m_hDC, TECHNOLOGY) == DT_METAFILE) + { + // playing metafile in metafile, just use core windows API + return ::PlayMetaFile(m_hDC, hMF); + } + + // for special playback, lParam == pDC + return ::EnumMetaFile(m_hDC, hMF, EnumMetaFileProc, (LPARAM)this); + } + + BOOL PlayMetaFile(HENHMETAFILE hEnhMetaFile, LPCRECT lpBounds) + { + ATLASSERT(m_hDC != NULL); + return ::PlayEnhMetaFile(m_hDC, hEnhMetaFile, lpBounds); + } + + BOOL AddMetaFileComment(UINT nDataSize, const BYTE* pCommentData) // can be used for enhanced metafiles only + { + ATLASSERT(m_hDC != NULL); + return ::GdiComment(m_hDC, nDataSize, pCommentData); + } + + // Special handling for metafile playback + static int CALLBACK EnumMetaFileProc(HDC hDC, HANDLETABLE* pHandleTable, METARECORD* pMetaRec, int nHandles, LPARAM lParam) + { + CDCHandle* pDC = (CDCHandle*)lParam; + + switch (pMetaRec->rdFunction) + { + case META_SETMAPMODE: + pDC->SetMapMode((int)(short)pMetaRec->rdParm[0]); + break; + case META_SETWINDOWEXT: + pDC->SetWindowExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_SETWINDOWORG: + pDC->SetWindowOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_SETVIEWPORTEXT: + pDC->SetViewportExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_SETVIEWPORTORG: + pDC->SetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_SCALEWINDOWEXT: + pDC->ScaleWindowExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], + (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_SCALEVIEWPORTEXT: + pDC->ScaleViewportExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], + (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_OFFSETVIEWPORTORG: + pDC->OffsetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); + break; + case META_SAVEDC: + pDC->SaveDC(); + break; + case META_RESTOREDC: + pDC->RestoreDC((int)(short)pMetaRec->rdParm[0]); + break; + case META_SETBKCOLOR: + pDC->SetBkColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); + break; + case META_SETTEXTCOLOR: + pDC->SetTextColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); + break; + + // need to watch out for SelectObject(HFONT), for custom font mapping + case META_SELECTOBJECT: + { + HGDIOBJ hObject = pHandleTable->objectHandle[pMetaRec->rdParm[0]]; + UINT nObjType = ::GetObjectType(hObject); + if(nObjType == 0) + { + // object type is unknown, determine if it is a font + HFONT hStockFont = (HFONT)::GetStockObject(SYSTEM_FONT); + HFONT hFontOld = (HFONT)::SelectObject(pDC->m_hDC, hStockFont); + HGDIOBJ hObjOld = ::SelectObject(pDC->m_hDC, hObject); + if(hObjOld == hStockFont) + { + // got the stock object back, so must be selecting a font + pDC->SelectFont((HFONT)hObject); + break; // don't play the default record + } + else + { + // didn't get the stock object back, so restore everything + ::SelectObject(pDC->m_hDC, hFontOld); + ::SelectObject(pDC->m_hDC, hObjOld); + } + // and fall through to PlayMetaFileRecord... + } + else if(nObjType == OBJ_FONT) + { + // play back as CDCHandle::SelectFont(HFONT) + pDC->SelectFont((HFONT)hObject); + break; // don't play the default record + } + } + // fall through... + + default: + ::PlayMetaFileRecord(hDC, pHandleTable, pMetaRec, nHandles); + break; + } + + return 1; + } +#endif // !_WIN32_WCE + +// Path Functions +#ifndef _WIN32_WCE + BOOL AbortPath() + { + ATLASSERT(m_hDC != NULL); + return ::AbortPath(m_hDC); + } + + BOOL BeginPath() + { + ATLASSERT(m_hDC != NULL); + return ::BeginPath(m_hDC); + } + + BOOL CloseFigure() + { + ATLASSERT(m_hDC != NULL); + return ::CloseFigure(m_hDC); + } + + BOOL EndPath() + { + ATLASSERT(m_hDC != NULL); + return ::EndPath(m_hDC); + } + + BOOL FillPath() + { + ATLASSERT(m_hDC != NULL); + return ::FillPath(m_hDC); + } + + BOOL FlattenPath() + { + ATLASSERT(m_hDC != NULL); + return ::FlattenPath(m_hDC); + } + + BOOL StrokeAndFillPath() + { + ATLASSERT(m_hDC != NULL); + return ::StrokeAndFillPath(m_hDC); + } + + BOOL StrokePath() + { + ATLASSERT(m_hDC != NULL); + return ::StrokePath(m_hDC); + } + + BOOL WidenPath() + { + ATLASSERT(m_hDC != NULL); + return ::WidenPath(m_hDC); + } + + BOOL GetMiterLimit(PFLOAT pfMiterLimit) const + { + ATLASSERT(m_hDC != NULL); + return ::GetMiterLimit(m_hDC, pfMiterLimit); + } + + BOOL SetMiterLimit(float fMiterLimit) + { + ATLASSERT(m_hDC != NULL); + return ::SetMiterLimit(m_hDC, fMiterLimit, NULL); + } + + int GetPath(LPPOINT lpPoints, LPBYTE lpTypes, int nCount) const + { + ATLASSERT(m_hDC != NULL); + return ::GetPath(m_hDC, lpPoints, lpTypes, nCount); + } + + BOOL SelectClipPath(int nMode) + { + ATLASSERT(m_hDC != NULL); + return ::SelectClipPath(m_hDC, nMode); + } +#endif // !_WIN32_WCE + +// Misc Helper Functions + static CBrushHandle PASCAL GetHalftoneBrush() + { + HBRUSH halftoneBrush = NULL; + WORD grayPattern[8]; + for(int i = 0; i < 8; i++) + grayPattern[i] = (WORD)(0x5555 << (i & 1)); + HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern); + if(grayBitmap != NULL) + { + halftoneBrush = ::CreatePatternBrush(grayBitmap); + DeleteObject(grayBitmap); + } + return CBrushHandle(halftoneBrush); + } + + void DrawDragRect(LPCRECT lpRect, SIZE size, LPCRECT lpRectLast, SIZE sizeLast, HBRUSH hBrush = NULL, HBRUSH hBrushLast = NULL) + { + // first, determine the update region and select it + CRgn rgnOutside; + rgnOutside.CreateRectRgnIndirect(lpRect); + RECT rect = *lpRect; + ::InflateRect(&rect, -size.cx, -size.cy); + ::IntersectRect(&rect, &rect, lpRect); + CRgn rgnInside; + rgnInside.CreateRectRgnIndirect(&rect); + CRgn rgnNew; + rgnNew.CreateRectRgn(0, 0, 0, 0); + rgnNew.CombineRgn(rgnOutside, rgnInside, RGN_XOR); + + HBRUSH hBrushOld = NULL; + CBrush brushHalftone; + if(hBrush == NULL) + brushHalftone = hBrush = CDCHandle::GetHalftoneBrush(); + if(hBrushLast == NULL) + hBrushLast = hBrush; + + CRgn rgnLast; + CRgn rgnUpdate; + if(lpRectLast != NULL) + { + // find difference between new region and old region + rgnLast.CreateRectRgn(0, 0, 0, 0); + rgnOutside.SetRectRgn(lpRectLast->left, lpRectLast->top, lpRectLast->right, lpRectLast->bottom); + rect = *lpRectLast; + ::InflateRect(&rect, -sizeLast.cx, -sizeLast.cy); + ::IntersectRect(&rect, &rect, lpRectLast); + rgnInside.SetRectRgn(rect.left, rect.top, rect.right, rect.bottom); + rgnLast.CombineRgn(rgnOutside, rgnInside, RGN_XOR); + + // only diff them if brushes are the same + if(hBrush == hBrushLast) + { + rgnUpdate.CreateRectRgn(0, 0, 0, 0); + rgnUpdate.CombineRgn(rgnLast, rgnNew, RGN_XOR); + } + } + if(hBrush != hBrushLast && lpRectLast != NULL) + { + // brushes are different -- erase old region first + SelectClipRgn(rgnLast); + GetClipBox(&rect); + hBrushOld = SelectBrush(hBrushLast); + PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); + SelectBrush(hBrushOld); + hBrushOld = NULL; + } + + // draw into the update/new region + SelectClipRgn(rgnUpdate.IsNull() ? rgnNew : rgnUpdate); + GetClipBox(&rect); + hBrushOld = SelectBrush(hBrush); + PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); + + // cleanup DC + if(hBrushOld != NULL) + SelectBrush(hBrushOld); + SelectClipRgn(NULL); + } + + void FillSolidRect(LPCRECT lpRect, COLORREF clr) + { + ATLASSERT(m_hDC != NULL); + + COLORREF clrOld = ::SetBkColor(m_hDC, clr); + ATLASSERT(clrOld != CLR_INVALID); + if(clrOld != CLR_INVALID) + { + ::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL); + ::SetBkColor(m_hDC, clrOld); + } + } + + void FillSolidRect(int x, int y, int cx, int cy, COLORREF clr) + { + ATLASSERT(m_hDC != NULL); + + RECT rect = { x, y, x + cx, y + cy }; + FillSolidRect(&rect, clr); + } + + void Draw3dRect(LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight) + { + Draw3dRect(lpRect->left, lpRect->top, lpRect->right - lpRect->left, + lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight); + } + + void Draw3dRect(int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight) + { + FillSolidRect(x, y, cx - 1, 1, clrTopLeft); + FillSolidRect(x, y, 1, cy - 1, clrTopLeft); + FillSolidRect(x + cx, y, -1, cy, clrBottomRight); + FillSolidRect(x, y + cy, cx, -1, clrBottomRight); + } + +// DIB support +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) + int SetDIBitsToDevice(int x, int y, DWORD dwWidth, DWORD dwHeight, int xSrc, int ySrc, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) + { + ATLASSERT(m_hDC != NULL); + return ::SetDIBitsToDevice(m_hDC, x, y, dwWidth, dwHeight, xSrc, ySrc, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) + +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + int StretchDIBits(int x, int y, int nWidth, int nHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse, DWORD dwRop) + { + ATLASSERT(m_hDC != NULL); + return ::StretchDIBits(m_hDC, x, y, nWidth, nHeight, xSrc, ySrc, nSrcWidth, nSrcHeight, lpvBits, lpbmi, uColorUse, dwRop); + } + + UINT GetDIBColorTable(UINT uStartIndex, UINT cEntries, RGBQUAD* pColors) const + { + ATLASSERT(m_hDC != NULL); + return ::GetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); + } + + UINT SetDIBColorTable(UINT uStartIndex, UINT cEntries, CONST RGBQUAD* pColors) + { + ATLASSERT(m_hDC != NULL); + return ::SetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); + } +#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) + +// OpenGL support +#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) + int ChoosePixelFormat(CONST PIXELFORMATDESCRIPTOR* ppfd) + { + ATLASSERT(m_hDC != NULL); + return ::ChoosePixelFormat(m_hDC, ppfd); + } + + int DescribePixelFormat(int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd) + { + ATLASSERT(m_hDC != NULL); + return ::DescribePixelFormat(m_hDC, iPixelFormat, nBytes, ppfd); + } + + int GetPixelFormat() const + { + ATLASSERT(m_hDC != NULL); + return ::GetPixelFormat(m_hDC); + } + + BOOL SetPixelFormat(int iPixelFormat, CONST PIXELFORMATDESCRIPTOR* ppfd) + { + ATLASSERT(m_hDC != NULL); + return ::SetPixelFormat(m_hDC, iPixelFormat, ppfd); + } + + BOOL SwapBuffers() + { + ATLASSERT(m_hDC != NULL); + return ::SwapBuffers(m_hDC); + } + + HGLRC wglCreateContext() + { + ATLASSERT(m_hDC != NULL); + return ::wglCreateContext(m_hDC); + } + + HGLRC wglCreateLayerContext(int iLayerPlane) + { + ATLASSERT(m_hDC != NULL); + return ::wglCreateLayerContext(m_hDC, iLayerPlane); + } + + BOOL wglMakeCurrent(HGLRC hglrc) + { + ATLASSERT(m_hDC != NULL); + return ::wglMakeCurrent(m_hDC, hglrc); + } + + BOOL wglUseFontBitmaps(DWORD dwFirst, DWORD dwCount, DWORD listBase) + { + ATLASSERT(m_hDC != NULL); + return ::wglUseFontBitmaps(m_hDC, dwFirst, dwCount, listBase); + } + + BOOL wglUseFontOutlines(DWORD dwFirst, DWORD dwCount, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf) + { + ATLASSERT(m_hDC != NULL); + return ::wglUseFontOutlines(m_hDC, dwFirst, dwCount, listBase, deviation, extrusion, format, lpgmf); + } + + BOOL wglDescribeLayerPlane(int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd) + { + ATLASSERT(m_hDC != NULL); + return ::wglDescribeLayerPlane(m_hDC, iPixelFormat, iLayerPlane, nBytes, plpd); + } + + int wglSetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, CONST COLORREF* pclr) + { + ATLASSERT(m_hDC != NULL); + return ::wglSetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); + } + + int wglGetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, COLORREF* pclr) + { + ATLASSERT(m_hDC != NULL); + return ::wglGetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); + } + + BOOL wglRealizeLayerPalette(int iLayerPlane, BOOL bRealize) + { + ATLASSERT(m_hDC != NULL); + return ::wglRealizeLayerPalette(m_hDC, iLayerPlane, bRealize); + } + + BOOL wglSwapLayerBuffers(UINT uPlanes) + { + ATLASSERT(m_hDC != NULL); + return ::wglSwapLayerBuffers(m_hDC, uPlanes); + } +#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) + +// New for Windows 2000 only +#if (_WIN32_WINNT >= 0x0500) + COLORREF GetDCPenColor() const + { + ATLASSERT(m_hDC != NULL); + return ::GetDCPenColor(m_hDC); + } + + COLORREF SetDCPenColor(COLORREF clr) + { + ATLASSERT(m_hDC != NULL); + return ::SetDCPenColor(m_hDC, clr); + } + + COLORREF GetDCBrushColor() const + { + ATLASSERT(m_hDC != NULL); + return ::GetDCBrushColor(m_hDC); + } + + COLORREF SetDCBrushColor(COLORREF clr) + { + ATLASSERT(m_hDC != NULL); + return ::SetDCBrushColor(m_hDC, clr); + } + +#ifndef _WIN32_WCE + DWORD GetFontUnicodeRanges(LPGLYPHSET lpgs) const + { + ATLASSERT(m_hDC != NULL); + return ::GetFontUnicodeRanges(m_hDC, lpgs); + } +#endif // !_WIN32_WCE + + DWORD GetGlyphIndices(LPCTSTR lpstr, int cch, LPWORD pgi, DWORD dwFlags) const + { + ATLASSERT(m_hDC != NULL); + return ::GetGlyphIndices(m_hDC, lpstr, cch, pgi, dwFlags); + } + + BOOL GetTextExtentPointI(LPWORD pgiIn, int cgi, LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextExtentPointI(m_hDC, pgiIn, cgi, lpSize); + } + + BOOL GetTextExtentExPointI(LPWORD pgiIn, int cgi, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize) const + { + ATLASSERT(m_hDC != NULL); + return ::GetTextExtentExPointI(m_hDC, pgiIn, cgi, nMaxExtent, lpnFit, alpDx, lpSize); + } + + BOOL GetCharWidthI(UINT giFirst, UINT cgi, LPWORD pgi, LPINT lpBuffer) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharWidthI(m_hDC, giFirst, cgi, pgi, lpBuffer); + } + + BOOL GetCharABCWidthsI(UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc) const + { + ATLASSERT(m_hDC != NULL); + return ::GetCharABCWidthsI(m_hDC, giFirst, cgi, pgi, lpabc); + } +#endif // (_WIN32_WINNT >= 0x0500) + +// New for Windows 2000 and Windows 98 +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + BOOL ColorCorrectPalette(HPALETTE hPalette, DWORD dwFirstEntry, DWORD dwNumOfEntries) + { + ATLASSERT(m_hDC != NULL); + return ::ColorCorrectPalette(m_hDC, hPalette, dwFirstEntry, dwNumOfEntries); + } +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) +}; + +typedef CDCT CDCHandle; +typedef CDCT CDC; + + +/////////////////////////////////////////////////////////////////////////////// +// CDC Helpers + +class CPaintDC : public CDC +{ +public: +// Data members + HWND m_hWnd; + PAINTSTRUCT m_ps; + +// Constructor/destructor + CPaintDC(HWND hWnd) + { + ATLASSERT(::IsWindow(hWnd)); + m_hWnd = hWnd; + m_hDC = ::BeginPaint(hWnd, &m_ps); + } + + ~CPaintDC() + { + ATLASSERT(m_hDC != NULL); + ATLASSERT(::IsWindow(m_hWnd)); + ::EndPaint(m_hWnd, &m_ps); + Detach(); + } +}; + +class CClientDC : public CDC +{ +public: +// Data members + HWND m_hWnd; + +// Constructor/destructor + CClientDC(HWND hWnd) + { + ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); + m_hWnd = hWnd; + m_hDC = ::GetDC(hWnd); + } + + ~CClientDC() + { + ATLASSERT(m_hDC != NULL); + ::ReleaseDC(m_hWnd, Detach()); + } +}; + +class CWindowDC : public CDC +{ +public: +// Data members + HWND m_hWnd; + +// Constructor/destructor + CWindowDC(HWND hWnd) + { + ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); + m_hWnd = hWnd; + m_hDC = ::GetWindowDC(hWnd); + } + + ~CWindowDC() + { + ATLASSERT(m_hDC != NULL); + ::ReleaseDC(m_hWnd, Detach()); + } +}; + +class CMemoryDC : public CDC +{ +public: +// Data members + HDC m_hDCOriginal; + RECT m_rcPaint; + CBitmap m_bmp; + HBITMAP m_hBmpOld; + +// Constructor/destructor + CMemoryDC(HDC hDC, RECT& rcPaint) : m_hDCOriginal(hDC), m_hBmpOld(NULL) + { + m_rcPaint = rcPaint; + CreateCompatibleDC(m_hDCOriginal); + ATLASSERT(m_hDC != NULL); + m_bmp.CreateCompatibleBitmap(m_hDCOriginal, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top); + ATLASSERT(m_bmp.m_hBitmap != NULL); + m_hBmpOld = SelectBitmap(m_bmp); + SetViewportOrg(-m_rcPaint.left, -m_rcPaint.top); + } + + ~CMemoryDC() + { + ::BitBlt(m_hDCOriginal, m_rcPaint.left, m_rcPaint.top, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top, m_hDC, m_rcPaint.left, m_rcPaint.top, SRCCOPY); + SelectBitmap(m_hBmpOld); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// Enhanced metafile support + +#ifndef _WIN32_WCE + +class CEnhMetaFileInfo +{ +public: +// Data members + HENHMETAFILE m_hEMF; + BYTE* m_pBits; + TCHAR* m_pDesc; + ENHMETAHEADER m_header; + PIXELFORMATDESCRIPTOR m_pfd; + +// Constructor/destructor + CEnhMetaFileInfo(HENHMETAFILE hEMF) : m_pBits(NULL), m_pDesc(NULL), m_hEMF(hEMF) + { } + + ~CEnhMetaFileInfo() + { + delete [] m_pBits; + delete [] m_pDesc; + } + +// Operations + BYTE* GetEnhMetaFileBits() + { + ATLASSERT(m_hEMF != NULL); + UINT nBytes = ::GetEnhMetaFileBits(m_hEMF, 0, NULL); + delete [] m_pBits; + m_pBits = NULL; + ATLTRY(m_pBits = new BYTE[nBytes]); + if (m_pBits != NULL) + ::GetEnhMetaFileBits(m_hEMF, nBytes, m_pBits); + return m_pBits; + } + + LPTSTR GetEnhMetaFileDescription() + { + ATLASSERT(m_hEMF != NULL); + UINT nLen = ::GetEnhMetaFileDescription(m_hEMF, 0, NULL); + delete [] m_pDesc; + m_pDesc = NULL; + ATLTRY(m_pDesc = new TCHAR[nLen]); + if (m_pDesc != NULL) + nLen = ::GetEnhMetaFileDescription(m_hEMF, nLen, m_pDesc); + return m_pDesc; + } + + ENHMETAHEADER* GetEnhMetaFileHeader() + { + ATLASSERT(m_hEMF != NULL); + memset(&m_header, 0, sizeof(m_header)); + m_header.iType = EMR_HEADER; + m_header.nSize = sizeof(ENHMETAHEADER); + UINT n = ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), &m_header); + return (n != 0) ? &m_header : NULL; + } + + PIXELFORMATDESCRIPTOR* GetEnhMetaFilePixelFormat() + { + ATLASSERT(m_hEMF != NULL); + memset(&m_pfd, 0, sizeof(m_pfd)); + UINT n = ::GetEnhMetaFilePixelFormat(m_hEMF, sizeof(m_pfd), &m_pfd); + return (n != 0) ? &m_pfd : NULL; + } +}; + + +template +class CEnhMetaFileT +{ +public: +// Data members + HENHMETAFILE m_hEMF; + +// Constructor/destructor + CEnhMetaFileT(HENHMETAFILE hEMF = NULL) : m_hEMF(hEMF) + { + } + + ~CEnhMetaFileT() + { + if(t_bManaged && m_hEMF != NULL) + DeleteObject(); + } + +// Operations + CEnhMetaFileT& operator =(HENHMETAFILE hEMF) + { + Attach(hEMF); + return *this; + } + + void Attach(HENHMETAFILE hEMF) + { + if(t_bManaged && m_hEMF != NULL && m_hEMF != hEMF) + DeleteObject(); + m_hEMF = hEMF; + } + + HENHMETAFILE Detach() + { + HENHMETAFILE hEMF = m_hEMF; + m_hEMF = NULL; + return hEMF; + } + + operator HENHMETAFILE() const { return m_hEMF; } + + bool IsNull() const { return (m_hEMF == NULL); } + + BOOL DeleteObject() + { + ATLASSERT(m_hEMF != NULL); + BOOL bRet = ::DeleteEnhMetaFile(m_hEMF); + m_hEMF = NULL; + return bRet; + } + + UINT GetEnhMetaFileBits(UINT cbBuffer, LPBYTE lpbBuffer) const + { + ATLASSERT(m_hEMF != NULL); + return ::GetEnhMetaFileBits(m_hEMF, cbBuffer, lpbBuffer); + } + + UINT GetEnhMetaFileDescription(UINT cchBuffer, LPTSTR lpszDescription) const + { + ATLASSERT(m_hEMF != NULL); + return ::GetEnhMetaFileDescription(m_hEMF, cchBuffer, lpszDescription); + } + + UINT GetEnhMetaFileHeader(LPENHMETAHEADER lpemh) const + { + ATLASSERT(m_hEMF != NULL); + lpemh->iType = EMR_HEADER; + lpemh->nSize = sizeof(ENHMETAHEADER); + return ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), lpemh); + } + + UINT GetEnhMetaFilePaletteEntries(UINT cEntries, LPPALETTEENTRY lppe) const + { + ATLASSERT(m_hEMF != NULL); + return ::GetEnhMetaFilePaletteEntries(m_hEMF, cEntries, lppe); + } + + UINT GetEnhMetaFilePixelFormat(DWORD cbBuffer, PIXELFORMATDESCRIPTOR* ppfd) const + { + ATLASSERT(m_hEMF != NULL); + return ::GetEnhMetaFilePixelFormat(m_hEMF, cbBuffer, ppfd); + } +}; + +typedef CEnhMetaFileT CEnhMetaFileHandle; +typedef CEnhMetaFileT CEnhMetaFile; + + +class CEnhMetaFileDC : public CDC +{ +public: +// Constructor/destructor + CEnhMetaFileDC() + { + } + + CEnhMetaFileDC(HDC hdc, LPCRECT lpRect) + { + Create(hdc, NULL, lpRect, NULL); + ATLASSERT(m_hDC != NULL); + } + + CEnhMetaFileDC(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) + { + Create(hdcRef, lpFilename, lpRect, lpDescription); + ATLASSERT(m_hDC != NULL); + } + + ~CEnhMetaFileDC() + { + HENHMETAFILE hEMF = Close(); + if (hEMF != NULL) + ::DeleteEnhMetaFile(hEMF); + } + +// Operations + void Create(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) + { + ATLASSERT(m_hDC == NULL); + m_hDC = ::CreateEnhMetaFile(hdcRef, lpFilename, lpRect, lpDescription); + } + + HENHMETAFILE Close() + { + HENHMETAFILE hEMF = NULL; + if (m_hDC != NULL) + { + hEMF = ::CloseEnhMetaFile(m_hDC); + m_hDC = NULL; + } + return hEMF; + } +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// WinCE compatible clipboard CF_DIB format support functions + +#ifndef _WTL_NO_DIB16 + +#define DIBINFO16_BITFIELDS { 31744, 992, 31 } + +// DIBINFO16 - To avoid color table problems in WinCE we only create this type of Dib +struct DIBINFO16 // a BITMAPINFO with 2 additional color bitfields +{ + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[3]; + + DIBINFO16(SIZE size) + { + BITMAPINFOHEADER bmih = { sizeof(BITMAPINFOHEADER), size.cx, size.cy, + 1, 16, BI_BITFIELDS, 2 * size.cx * size.cy , 0, 0, 3 }; + DWORD dw[3] = DIBINFO16_BITFIELDS ; + + bmiHeader = bmih; + memcpy(bmiColors, dw, 3 * sizeof(DWORD)); + } +}; + + +// AtlxxxDibxxx minimal packed DIB implementation and helpers to copy and paste CF_DIB + +inline bool AtlIsDib16(LPBITMAPINFOHEADER pbmih) +{ + return (pbmih->biBitCount == 16) && (pbmih->biCompression == BI_BITFIELDS); +} + +inline int AtlGetDibColorTableSize(LPBITMAPINFOHEADER pbmih) +{ + switch (pbmih->biBitCount) + { + case 2: + case 4: + case 8: + return pbmih->biClrUsed ? pbmih->biClrUsed : 1 << pbmih->biBitCount; + case 24: + break; + case 16: + case 32: + return pbmih->biCompression == BI_BITFIELDS ? 3 : 0; + default: + ATLASSERT(FALSE); // should never come here + } + + return 0; +} + +inline int AtlGetDibNumColors(LPBITMAPINFOHEADER pbmih) +{ + switch (pbmih->biBitCount) + { + case 2: + case 4: + case 8: + if (pbmih->biClrUsed) + return pbmih->biClrUsed; + else + break; + case 16: + if (pbmih->biCompression == BI_BITFIELDS ) + return 1 << 15; + else + break; + case 24: + break; + case 32: + if (pbmih->biCompression == BI_BITFIELDS ) + return 1 << 24; + else + break; + default: + ATLASSERT(FALSE); + } + + return 1 << pbmih->biBitCount; +} + +inline HBITMAP AtlGetDibBitmap(LPBITMAPINFO pbmi) +{ + HBITMAP hbm = NULL; + CDC dc(NULL); + void * pBits = NULL; + + LPBYTE pDibBits = (LPBYTE)pbmi + sizeof(BITMAPINFOHEADER) + AtlGetDibColorTableSize(&pbmi->bmiHeader) * sizeof(RGBQUAD); + if (hbm = CreateDIBSection(dc, pbmi, DIB_RGB_COLORS, &pBits, NULL, NULL)) + memcpy(pBits, pDibBits, pbmi->bmiHeader.biSizeImage); + + return hbm; +} + +inline HBITMAP AtlCopyBitmap(HBITMAP hbm , SIZE sizeDst, bool bAsBitmap = false) +{ + CDC hdcSrc = CreateCompatibleDC(NULL); + CDC hdcDst = CreateCompatibleDC(NULL); + + CBitmapHandle hbmOld = NULL, hbmOld2 = NULL, bmSrc = hbm; + + CBitmap bmNew = NULL; + + SIZE sizeSrc = { 0 }; + bmSrc.GetSize(sizeSrc); + + hbmOld = hdcSrc.SelectBitmap(bmSrc); + + if (bAsBitmap) + { + bmNew.CreateCompatibleBitmap(hdcSrc, sizeDst.cx, sizeDst.cy); + } + else + { + DIBINFO16 dib16(sizeDst); + LPVOID pBits = NULL; + bmNew = CreateDIBSection(hdcDst, (const BITMAPINFO*)&dib16, DIB_RGB_COLORS, &pBits, NULL, NULL); + } + + ATLASSERT(!bmNew.IsNull()); + + hbmOld2 = hdcDst.SelectBitmap(bmNew); + BOOL bOK = FALSE; + + if ((sizeDst.cx == sizeSrc.cx) && (sizeDst.cy == sizeSrc.cy)) + bOK = hdcDst.BitBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, SRCCOPY); + else + bOK = hdcDst.StretchBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, sizeSrc.cx, sizeSrc.cy, SRCCOPY); + + hdcSrc.SelectBitmap(hbmOld); + hdcDst.SelectBitmap(hbmOld2); + + if (bOK == FALSE) + bmNew.DeleteObject(); + + return bmNew.Detach(); +} + +inline HLOCAL AtlCreatePackedDib16(HBITMAP hbm, SIZE size) +{ + DIBSECTION ds = { 0 }; + LPBYTE pDib = NULL; + bool bCopied = false; + + bool bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); + if ((bOK == FALSE) || (ds.dsBm.bmBits == NULL) || (AtlIsDib16(&ds.dsBmih) == FALSE) || + (ds.dsBmih.biWidth != size.cx ) || (ds.dsBmih.biHeight != size.cy )) + { + if ((hbm = AtlCopyBitmap(hbm, size)) != NULL) + { + bCopied = true; + bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); + } + else + { + bOK = FALSE; + } + } + + if((bOK == TRUE) && (AtlIsDib16(&ds.dsBmih) == TRUE) && (ds.dsBm.bmBits != NULL)) + { + pDib = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, sizeof(DIBINFO16) + ds.dsBmih.biSizeImage); + if (pDib != NULL) + { + memcpy(pDib , &ds.dsBmih, sizeof(DIBINFO16)); + memcpy(pDib + sizeof(DIBINFO16), ds.dsBm.bmBits, ds.dsBmih.biSizeImage); + } + } + + if (bCopied == true) + DeleteObject(hbm); + + return (HLOCAL)pDib; +} + +inline bool AtlSetClipboardDib16(HBITMAP hbm, SIZE size, HWND hWnd) +{ + ATLASSERT(::IsWindow(hWnd)); + BOOL bOK = OpenClipboard(hWnd); + if (bOK == TRUE) + { + if ((bOK = EmptyClipboard()) == TRUE) + { + HLOCAL hDib = AtlCreatePackedDib16(hbm, size); + if (hDib != NULL) + { + bOK = SetClipboardData(CF_DIB, hDib) != NULL; + if (bOK == FALSE) + LocalFree(hDib); + } + else + { + bOK = FALSE; + } + } + CloseClipboard(); + } + + return bOK == TRUE; +} + +inline HBITMAP AtlGetClipboardDib(HWND hWnd) +{ + ATLASSERT(::IsWindow(hWnd) == TRUE); + HBITMAP hbm = NULL; + if (OpenClipboard(hWnd) == TRUE) + { + LPBITMAPINFO pbmi = (LPBITMAPINFO)GetClipboardData(CF_DIB); + if (pbmi != NULL) + hbm = AtlGetDibBitmap(pbmi); + CloseClipboard(); + } + + return hbm; +} + +#endif // _WTL_NO_DIB16 + +}; // namespace WTL + +#endif // __ATLGDI_H__ diff --git a/Externals/WTL80/atlmisc.h b/Externals/WTL80/atlmisc.h index 70c8745f91..cdd5d1d03e 100644 --- a/Externals/WTL80/atlmisc.h +++ b/Externals/WTL80/atlmisc.h @@ -1,4021 +1,4021 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLMISC_H__ -#define __ATLMISC_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlmisc.h requires atlapp.h to be included first -#endif - - -#ifdef _ATL_TMP_NO_CSTRING - #define _WTL_NO_CSTRING -#endif - -#if defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) - #error Conflicting options - both _WTL_USE_CSTRING and _WTL_NO_CSTRING are defined -#endif // defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) - -#if !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) - #define _WTL_USE_CSTRING -#endif // !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) - -#ifndef _WTL_NO_CSTRING - #if defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) - #error Cannot use CString floating point formatting with _ATL_MIN_CRT defined - #endif // defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) -#endif // !_WTL_NO_CSTRING - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CSize -// CPoint -// CRect -// CString -// -// CRecentDocumentListBase -// CRecentDocumentList -// CFindFile -// -// Global functions: -// AtlLoadAccelerators() -// AtlLoadMenu() -// AtlLoadBitmap() -// AtlLoadSysBitmap() -// AtlLoadCursor() -// AtlLoadSysCursor() -// AtlLoadIcon() -// AtlLoadSysIcon() -// AtlLoadBitmapImage() -// AtlLoadCursorImage() -// AtlLoadIconImage() -// AtlLoadSysBitmapImage() -// AtlLoadSysCursorImage() -// AtlLoadSysIconImage() -// AtlLoadString() -// -// AtlGetStockPen() -// AtlGetStockBrush() -// AtlGetStockFont() -// AtlGetStockPalette() -// -// AtlCompactPath() - - -namespace WTL -{ - -#ifndef _WTL_NO_WTYPES - -// forward declarations -class CSize; -class CPoint; -class CRect; - -/////////////////////////////////////////////////////////////////////////////// -// CSize - Wrapper for Windows SIZE structure. - -class CSize : public SIZE -{ -public: -// Constructors - CSize() - { - cx = 0; - cy = 0; - } - - CSize(int initCX, int initCY) - { - cx = initCX; - cy = initCY; - } - - CSize(SIZE initSize) - { - *(SIZE*)this = initSize; - } - - CSize(POINT initPt) - { - *(POINT*)this = initPt; - } - - CSize(DWORD dwSize) - { - cx = (short)LOWORD(dwSize); - cy = (short)HIWORD(dwSize); - } - -// Operations - BOOL operator ==(SIZE size) const - { - return (cx == size.cx && cy == size.cy); - } - - BOOL operator !=(SIZE size) const - { - return (cx != size.cx || cy != size.cy); - } - - void operator +=(SIZE size) - { - cx += size.cx; - cy += size.cy; - } - - void operator -=(SIZE size) - { - cx -= size.cx; - cy -= size.cy; - } - - void SetSize(int CX, int CY) - { - cx = CX; - cy = CY; - } - -// Operators returning CSize values - CSize operator +(SIZE size) const - { - return CSize(cx + size.cx, cy + size.cy); - } - - CSize operator -(SIZE size) const - { - return CSize(cx - size.cx, cy - size.cy); - } - - CSize operator -() const - { - return CSize(-cx, -cy); - } - -// Operators returning CPoint values - CPoint operator +(POINT point) const; - CPoint operator -(POINT point) const; - -// Operators returning CRect values - CRect operator +(const RECT* lpRect) const; - CRect operator -(const RECT* lpRect) const; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPoint - Wrapper for Windows POINT structure. - -class CPoint : public POINT -{ -public: -// Constructors - CPoint() - { - x = 0; - y = 0; - } - - CPoint(int initX, int initY) - { - x = initX; - y = initY; - } - - CPoint(POINT initPt) - { - *(POINT*)this = initPt; - } - - CPoint(SIZE initSize) - { - *(SIZE*)this = initSize; - } - - CPoint(DWORD dwPoint) - { - x = (short)LOWORD(dwPoint); - y = (short)HIWORD(dwPoint); - } - -// Operations - void Offset(int xOffset, int yOffset) - { - x += xOffset; - y += yOffset; - } - - void Offset(POINT point) - { - x += point.x; - y += point.y; - } - - void Offset(SIZE size) - { - x += size.cx; - y += size.cy; - } - - BOOL operator ==(POINT point) const - { - return (x == point.x && y == point.y); - } - - BOOL operator !=(POINT point) const - { - return (x != point.x || y != point.y); - } - - void operator +=(SIZE size) - { - x += size.cx; - y += size.cy; - } - - void operator -=(SIZE size) - { - x -= size.cx; - y -= size.cy; - } - - void operator +=(POINT point) - { - x += point.x; - y += point.y; - } - - void operator -=(POINT point) - { - x -= point.x; - y -= point.y; - } - - void SetPoint(int X, int Y) - { - x = X; - y = Y; - } - -// Operators returning CPoint values - CPoint operator +(SIZE size) const - { - return CPoint(x + size.cx, y + size.cy); - } - - CPoint operator -(SIZE size) const - { - return CPoint(x - size.cx, y - size.cy); - } - - CPoint operator -() const - { - return CPoint(-x, -y); - } - - CPoint operator +(POINT point) const - { - return CPoint(x + point.x, y + point.y); - } - -// Operators returning CSize values - CSize operator -(POINT point) const - { - return CSize(x - point.x, y - point.y); - } - -// Operators returning CRect values - CRect operator +(const RECT* lpRect) const; - CRect operator -(const RECT* lpRect) const; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CRect - Wrapper for Windows RECT structure. - -class CRect : public RECT -{ -public: -// Constructors - CRect() - { - left = 0; - top = 0; - right = 0; - bottom = 0; - } - - CRect(int l, int t, int r, int b) - { - left = l; - top = t; - right = r; - bottom = b; - } - - CRect(const RECT& srcRect) - { - ::CopyRect(this, &srcRect); - } - - CRect(LPCRECT lpSrcRect) - { - ::CopyRect(this, lpSrcRect); - } - - CRect(POINT point, SIZE size) - { - right = (left = point.x) + size.cx; - bottom = (top = point.y) + size.cy; - } - - CRect(POINT topLeft, POINT bottomRight) - { - left = topLeft.x; - top = topLeft.y; - right = bottomRight.x; - bottom = bottomRight.y; - } - -// Attributes (in addition to RECT members) - int Width() const - { - return right - left; - } - - int Height() const - { - return bottom - top; - } - - CSize Size() const - { - return CSize(right - left, bottom - top); - } - - CPoint& TopLeft() - { - return *((CPoint*)this); - } - - CPoint& BottomRight() - { - return *((CPoint*)this + 1); - } - - const CPoint& TopLeft() const - { - return *((CPoint*)this); - } - - const CPoint& BottomRight() const - { - return *((CPoint*)this + 1); - } - - CPoint CenterPoint() const - { - return CPoint((left + right) / 2, (top + bottom) / 2); - } - - // convert between CRect and LPRECT/LPCRECT (no need for &) - operator LPRECT() - { - return this; - } - - operator LPCRECT() const - { - return this; - } - - BOOL IsRectEmpty() const - { - return ::IsRectEmpty(this); - } - - BOOL IsRectNull() const - { - return (left == 0 && right == 0 && top == 0 && bottom == 0); - } - - BOOL PtInRect(POINT point) const - { - return ::PtInRect(this, point); - } - -// Operations - void SetRect(int x1, int y1, int x2, int y2) - { - ::SetRect(this, x1, y1, x2, y2); - } - - void SetRect(POINT topLeft, POINT bottomRight) - { - ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); - } - - void SetRectEmpty() - { - ::SetRectEmpty(this); - } - - void CopyRect(LPCRECT lpSrcRect) - { - ::CopyRect(this, lpSrcRect); - } - - BOOL EqualRect(LPCRECT lpRect) const - { - return ::EqualRect(this, lpRect); - } - - void InflateRect(int x, int y) - { - ::InflateRect(this, x, y); - } - - void InflateRect(SIZE size) - { - ::InflateRect(this, size.cx, size.cy); - } - - void InflateRect(LPCRECT lpRect) - { - left -= lpRect->left; - top -= lpRect->top; - right += lpRect->right; - bottom += lpRect->bottom; - } - - void InflateRect(int l, int t, int r, int b) - { - left -= l; - top -= t; - right += r; - bottom += b; - } - - void DeflateRect(int x, int y) - { - ::InflateRect(this, -x, -y); - } - - void DeflateRect(SIZE size) - { - ::InflateRect(this, -size.cx, -size.cy); - } - - void DeflateRect(LPCRECT lpRect) - { - left += lpRect->left; - top += lpRect->top; - right -= lpRect->right; - bottom -= lpRect->bottom; - } - - void DeflateRect(int l, int t, int r, int b) - { - left += l; - top += t; - right -= r; - bottom -= b; - } - - void OffsetRect(int x, int y) - { - ::OffsetRect(this, x, y); - } - void OffsetRect(SIZE size) - { - ::OffsetRect(this, size.cx, size.cy); - } - - void OffsetRect(POINT point) - { - ::OffsetRect(this, point.x, point.y); - } - - void NormalizeRect() - { - int nTemp; - if (left > right) - { - nTemp = left; - left = right; - right = nTemp; - } - if (top > bottom) - { - nTemp = top; - top = bottom; - bottom = nTemp; - } - } - - // absolute position of rectangle - void MoveToY(int y) - { - bottom = Height() + y; - top = y; - } - - void MoveToX(int x) - { - right = Width() + x; - left = x; - } - - void MoveToXY(int x, int y) - { - MoveToX(x); - MoveToY(y); - } - - void MoveToXY(POINT pt) - { - MoveToX(pt.x); - MoveToY(pt.y); - } - - // operations that fill '*this' with result - BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2) - { - return ::IntersectRect(this, lpRect1, lpRect2); - } - - BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2) - { - return ::UnionRect(this, lpRect1, lpRect2); - } - - BOOL SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2) - { - return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); - } - -// Additional Operations - void operator =(const RECT& srcRect) - { - ::CopyRect(this, &srcRect); - } - - BOOL operator ==(const RECT& rect) const - { - return ::EqualRect(this, &rect); - } - - BOOL operator !=(const RECT& rect) const - { - return !::EqualRect(this, &rect); - } - - void operator +=(POINT point) - { - ::OffsetRect(this, point.x, point.y); - } - - void operator +=(SIZE size) - { - ::OffsetRect(this, size.cx, size.cy); - } - - void operator +=(LPCRECT lpRect) - { - InflateRect(lpRect); - } - - void operator -=(POINT point) - { - ::OffsetRect(this, -point.x, -point.y); - } - - void operator -=(SIZE size) - { - ::OffsetRect(this, -size.cx, -size.cy); - } - - void operator -=(LPCRECT lpRect) - { - DeflateRect(lpRect); - } - - void operator &=(const RECT& rect) - { - ::IntersectRect(this, this, &rect); - } - - void operator |=(const RECT& rect) - { - ::UnionRect(this, this, &rect); - } - -// Operators returning CRect values - CRect operator +(POINT pt) const - { - CRect rect(*this); - ::OffsetRect(&rect, pt.x, pt.y); - return rect; - } - - CRect operator -(POINT pt) const - { - CRect rect(*this); - ::OffsetRect(&rect, -pt.x, -pt.y); - return rect; - } - - CRect operator +(LPCRECT lpRect) const - { - CRect rect(this); - rect.InflateRect(lpRect); - return rect; - } - - CRect operator +(SIZE size) const - { - CRect rect(*this); - ::OffsetRect(&rect, size.cx, size.cy); - return rect; - } - - CRect operator -(SIZE size) const - { - CRect rect(*this); - ::OffsetRect(&rect, -size.cx, -size.cy); - return rect; - } - - CRect operator -(LPCRECT lpRect) const - { - CRect rect(this); - rect.DeflateRect(lpRect); - return rect; - } - - CRect operator &(const RECT& rect2) const - { - CRect rect; - ::IntersectRect(&rect, this, &rect2); - return rect; - } - - CRect operator |(const RECT& rect2) const - { - CRect rect; - ::UnionRect(&rect, this, &rect2); - return rect; - } - - CRect MulDiv(int nMultiplier, int nDivisor) const - { - return CRect( - ::MulDiv(left, nMultiplier, nDivisor), - ::MulDiv(top, nMultiplier, nDivisor), - ::MulDiv(right, nMultiplier, nDivisor), - ::MulDiv(bottom, nMultiplier, nDivisor)); - } -}; - - -// CSize implementation - -inline CPoint CSize::operator +(POINT point) const -{ return CPoint(cx + point.x, cy + point.y); } - -inline CPoint CSize::operator -(POINT point) const -{ return CPoint(cx - point.x, cy - point.y); } - -inline CRect CSize::operator +(const RECT* lpRect) const -{ return CRect(lpRect) + *this; } - -inline CRect CSize::operator -(const RECT* lpRect) const -{ return CRect(lpRect) - *this; } - - -// CPoint implementation - -inline CRect CPoint::operator +(const RECT* lpRect) const -{ return CRect(lpRect) + *this; } - -inline CRect CPoint::operator -(const RECT* lpRect) const -{ return CRect(lpRect) - *this; } - -#endif // !_WTL_NO_WTYPES - - -// WTL::CSize or ATL::CSize scalar operators - -#if !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) - -template -inline CSize operator *(SIZE s, Num n) -{ - return CSize((int)(s.cx * n), (int)(s.cy * n)); -}; - -template -inline void operator *=(SIZE & s, Num n) -{ - s = s * n; -}; - -template -inline CSize operator /(SIZE s, Num n) -{ - return CSize((int)(s.cx / n), (int)(s.cy / n)); -}; - -template -inline void operator /=(SIZE & s, Num n) -{ - s = s / n; -}; - -#endif // !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) - - -/////////////////////////////////////////////////////////////////////////////// -// CString - String class - -#ifndef _WTL_NO_CSTRING - -struct CStringData -{ - long nRefs; // reference count - int nDataLength; - int nAllocLength; - // TCHAR data[nAllocLength] - - TCHAR* data() - { return (TCHAR*)(this + 1); } -}; - -// Globals - -// For an empty string, m_pchData will point here -// (note: avoids special case of checking for NULL m_pchData) -// empty string data (and locked) -_declspec(selectany) int rgInitData[] = { -1, 0, 0, 0 }; -_declspec(selectany) CStringData* _atltmpDataNil = (CStringData*)&rgInitData; -_declspec(selectany) LPCTSTR _atltmpPchNil = (LPCTSTR)(((BYTE*)&rgInitData) + sizeof(CStringData)); - - -class CString -{ -public: -// Constructors - CString() - { - Init(); - } - - CString(const CString& stringSrc) - { - ATLASSERT(stringSrc.GetData()->nRefs != 0); - if (stringSrc.GetData()->nRefs >= 0) - { - ATLASSERT(stringSrc.GetData() != _atltmpDataNil); - m_pchData = stringSrc.m_pchData; - InterlockedIncrement(&GetData()->nRefs); - } - else - { - Init(); - *this = stringSrc.m_pchData; - } - } - - CString(TCHAR ch, int nRepeat = 1) - { - ATLASSERT(!_istlead(ch)); // can't create a lead byte string - Init(); - if (nRepeat >= 1) - { - if(AllocBuffer(nRepeat)) - { -#ifdef _UNICODE - for (int i = 0; i < nRepeat; i++) - m_pchData[i] = ch; -#else - memset(m_pchData, ch, nRepeat); -#endif - } - } - } - - CString(LPCTSTR lpsz) - { - Init(); - if (lpsz != NULL && HIWORD(lpsz) == NULL) - { - UINT nID = LOWORD((DWORD_PTR)lpsz); - if (!LoadString(nID)) - ATLTRACE2(atlTraceUI, 0, _T("Warning: implicit LoadString(%u) in CString failed\n"), nID); - } - else - { - int nLen = SafeStrlen(lpsz); - if (nLen != 0) - { - if(AllocBuffer(nLen)) - SecureHelper::memcpy_x(m_pchData, (nLen + 1) * sizeof(TCHAR), lpsz, nLen * sizeof(TCHAR)); - } - } - } - -#ifdef _UNICODE - CString(LPCSTR lpsz) - { - Init(); -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; -#else - int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; -#endif - if (nSrcLen != 0) - { - if(AllocBuffer(nSrcLen)) - { - _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); - ReleaseBuffer(); - } - } - } -#else // !_UNICODE - CString(LPCWSTR lpsz) - { - Init(); - int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; - if (nSrcLen != 0) - { - if(AllocBuffer(nSrcLen * 2)) - { - _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); - ReleaseBuffer(); - } - } - } -#endif // !_UNICODE - - CString(LPCTSTR lpch, int nLength) - { - Init(); - if (nLength != 0) - { - if(AllocBuffer(nLength)) - SecureHelper::memcpy_x(m_pchData, (nLength + 1) * sizeof(TCHAR), lpch, nLength * sizeof(TCHAR)); - } - } - -#ifdef _UNICODE - CString(LPCSTR lpsz, int nLength) - { - Init(); - if (nLength != 0) - { - if(AllocBuffer(nLength)) - { - int n = ::MultiByteToWideChar(CP_ACP, 0, lpsz, nLength, m_pchData, nLength + 1); - ReleaseBuffer((n >= 0) ? n : -1); - } - } - } -#else // !_UNICODE - CString(LPCWSTR lpsz, int nLength) - { - Init(); - if (nLength != 0) - { - if(((nLength * 2) > nLength) && AllocBuffer(nLength * 2)) - { - int n = ::WideCharToMultiByte(CP_ACP, 0, lpsz, nLength, m_pchData, (nLength * 2) + 1, NULL, NULL); - ReleaseBuffer((n >= 0) ? n : -1); - } - } - } -#endif // !_UNICODE - - CString(const unsigned char* lpsz) - { - Init(); - *this = (LPCSTR)lpsz; - } - -// Attributes & Operations - int GetLength() const // as an array of characters - { - return GetData()->nDataLength; - } - - BOOL IsEmpty() const - { - return GetData()->nDataLength == 0; - } - - void Empty() // free up the data - { - if (GetData()->nDataLength == 0) - return; - - if (GetData()->nRefs >= 0) - Release(); - else - *this = _T(""); - - ATLASSERT(GetData()->nDataLength == 0); - ATLASSERT(GetData()->nRefs < 0 || GetData()->nAllocLength == 0); - } - - TCHAR GetAt(int nIndex) const // 0 based - { - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - return m_pchData[nIndex]; - } - - TCHAR operator [](int nIndex) const // same as GetAt - { - // same as GetAt - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - return m_pchData[nIndex]; - } - - void SetAt(int nIndex, TCHAR ch) - { - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - - CopyBeforeWrite(); - m_pchData[nIndex] = ch; - } - - operator LPCTSTR() const // as a C string - { - return m_pchData; - } - - // overloaded assignment - CString& operator =(const CString& stringSrc) - { - if (m_pchData != stringSrc.m_pchData) - { - if ((GetData()->nRefs < 0 && GetData() != _atltmpDataNil) || stringSrc.GetData()->nRefs < 0) - { - // actual copy necessary since one of the strings is locked - AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData); - } - else - { - // can just copy references around - Release(); - ATLASSERT(stringSrc.GetData() != _atltmpDataNil); - m_pchData = stringSrc.m_pchData; - InterlockedIncrement(&GetData()->nRefs); - } - } - return *this; - } - - CString& operator =(TCHAR ch) - { - ATLASSERT(!_istlead(ch)); // can't set single lead byte - AssignCopy(1, &ch); - return *this; - } - -#ifdef _UNICODE - CString& operator =(char ch) - { - *this = (TCHAR)ch; - return *this; - } -#endif - - CString& operator =(LPCTSTR lpsz) - { - ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); - AssignCopy(SafeStrlen(lpsz), lpsz); - return *this; - } - -#ifdef _UNICODE - CString& operator =(LPCSTR lpsz) - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; -#else - int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; -#endif - if(AllocBeforeWrite(nSrcLen)) - { - _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); - ReleaseBuffer(); - } - return *this; - } -#else // !_UNICODE - CString& operator =(LPCWSTR lpsz) - { - int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; - if(AllocBeforeWrite(nSrcLen * 2)) - { - _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); - ReleaseBuffer(); - } - return *this; - } -#endif // !_UNICODE - - CString& operator =(const unsigned char* lpsz) - { - *this = (LPCSTR)lpsz; - return *this; - } - - // string concatenation - CString& operator +=(const CString& string) - { - ConcatInPlace(string.GetData()->nDataLength, string.m_pchData); - return *this; - } - - CString& operator +=(TCHAR ch) - { - ConcatInPlace(1, &ch); - return *this; - } - -#ifdef _UNICODE - CString& operator +=(char ch) - { - *this += (TCHAR)ch; - return *this; - } -#endif - - CString& operator +=(LPCTSTR lpsz) - { - ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); - ConcatInPlace(SafeStrlen(lpsz), lpsz); - return *this; - } - - friend CString __stdcall operator +(const CString& string1, const CString& string2); - friend CString __stdcall operator +(const CString& string, TCHAR ch); - friend CString __stdcall operator +(TCHAR ch, const CString& string); -#ifdef _UNICODE - friend CString __stdcall operator +(const CString& string, char ch); - friend CString __stdcall operator +(char ch, const CString& string); -#endif - friend CString __stdcall operator +(const CString& string, LPCTSTR lpsz); - friend CString __stdcall operator +(LPCTSTR lpsz, const CString& string); - - // string comparison - int Compare(LPCTSTR lpsz) const // straight character (MBCS/Unicode aware) - { - return _cstrcmp(m_pchData, lpsz); - } - - int CompareNoCase(LPCTSTR lpsz) const // ignore case (MBCS/Unicode aware) - { - return _cstrcmpi(m_pchData, lpsz); - } - -#ifndef _WIN32_WCE - // CString::Collate is often slower than Compare but is MBSC/Unicode - // aware as well as locale-sensitive with respect to sort order. - int Collate(LPCTSTR lpsz) const // NLS aware - { - return _cstrcoll(m_pchData, lpsz); - } - - int CollateNoCase(LPCTSTR lpsz) const // ignore case - { - return _cstrcolli(m_pchData, lpsz); - } -#endif // !_WIN32_WCE - - // simple sub-string extraction - CString Mid(int nFirst, int nCount) const - { - // out-of-bounds requests return sensible things - if (nFirst < 0) - nFirst = 0; - if (nCount < 0) - nCount = 0; - - if (nFirst + nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength - nFirst; - if (nFirst > GetData()->nDataLength) - nCount = 0; - - CString dest; - AllocCopy(dest, nCount, nFirst, 0); - return dest; - } - - CString Mid(int nFirst) const - { - return Mid(nFirst, GetData()->nDataLength - nFirst); - } - - CString Left(int nCount) const - { - if (nCount < 0) - nCount = 0; - else if (nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength; - - CString dest; - AllocCopy(dest, nCount, 0, 0); - return dest; - } - - CString Right(int nCount) const - { - if (nCount < 0) - nCount = 0; - else if (nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength; - - CString dest; - AllocCopy(dest, nCount, GetData()->nDataLength-nCount, 0); - return dest; - } - - CString SpanIncluding(LPCTSTR lpszCharSet) const // strspn equivalent - { - ATLASSERT(_IsValidString(lpszCharSet)); - return Left(_cstrspn(m_pchData, lpszCharSet)); - } - - CString SpanExcluding(LPCTSTR lpszCharSet) const // strcspn equivalent - { - ATLASSERT(_IsValidString(lpszCharSet)); - return Left(_cstrcspn(m_pchData, lpszCharSet)); - } - - // upper/lower/reverse conversion - void MakeUpper() - { - CopyBeforeWrite(); - CharUpper(m_pchData); - } - - void MakeLower() - { - CopyBeforeWrite(); - CharLower(m_pchData); - } - - void MakeReverse() - { - CopyBeforeWrite(); - _cstrrev(m_pchData); - } - - // trimming whitespace (either side) - void TrimRight() - { - CopyBeforeWrite(); - - // find beginning of trailing spaces by starting at beginning (DBCS aware) - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - while (*lpsz != _T('\0')) - { - if (_cstrisspace(*lpsz)) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - lpsz = ::CharNext(lpsz); - } - - if (lpszLast != NULL) - { - // truncate at trailing space start - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - void TrimLeft() - { - CopyBeforeWrite(); - - // find first non-space character - LPCTSTR lpsz = m_pchData; - while (_cstrisspace(*lpsz)) - lpsz = ::CharNext(lpsz); - - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - - // remove continuous occurrences of chTarget starting from right - void TrimRight(TCHAR chTarget) - { - // find beginning of trailing matches - // by starting at beginning (DBCS aware) - - CopyBeforeWrite(); - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - - while (*lpsz != _T('\0')) - { - if (*lpsz == chTarget) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - lpszLast = NULL; - lpsz = ::CharNext(lpsz); - } - - if (lpszLast != NULL) - { - // truncate at left-most matching character - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - // remove continuous occcurrences of characters in passed string, starting from right - void TrimRight(LPCTSTR lpszTargetList) - { - // find beginning of trailing matches by starting at beginning (DBCS aware) - - CopyBeforeWrite(); - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - - while (*lpsz != _T('\0')) - { - TCHAR* pNext = ::CharNext(lpsz); - if(pNext > lpsz + 1) - { - if (_cstrchr_db(lpszTargetList, *lpsz, *(lpsz + 1)) != NULL) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - } - else - { - if (_cstrchr(lpszTargetList, *lpsz) != NULL) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - } - - lpsz = pNext; - } - - if (lpszLast != NULL) - { - // truncate at left-most matching character - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - // remove continuous occurrences of chTarget starting from left - void TrimLeft(TCHAR chTarget) - { - // find first non-matching character - - CopyBeforeWrite(); - LPCTSTR lpsz = m_pchData; - - while (chTarget == *lpsz) - lpsz = ::CharNext(lpsz); - - if (lpsz != m_pchData) - { - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - } - - // remove continuous occcurrences of characters in passed string, starting from left - void TrimLeft(LPCTSTR lpszTargets) - { - // if we're not trimming anything, we're not doing any work - if (SafeStrlen(lpszTargets) == 0) - return; - - CopyBeforeWrite(); - LPCTSTR lpsz = m_pchData; - - while (*lpsz != _T('\0')) - { - TCHAR* pNext = ::CharNext(lpsz); - if(pNext > lpsz + 1) - { - if (_cstrchr_db(lpszTargets, *lpsz, *(lpsz + 1)) == NULL) - break; - } - else - { - if (_cstrchr(lpszTargets, *lpsz) == NULL) - break; - } - lpsz = pNext; - } - - if (lpsz != m_pchData) - { - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - } - - // advanced manipulation - // replace occurrences of chOld with chNew - int Replace(TCHAR chOld, TCHAR chNew) - { - int nCount = 0; - - // short-circuit the nop case - if (chOld != chNew) - { - // otherwise modify each character that matches in the string - CopyBeforeWrite(); - LPTSTR psz = m_pchData; - LPTSTR pszEnd = psz + GetData()->nDataLength; - while (psz < pszEnd) - { - // replace instances of the specified character only - if (*psz == chOld) - { - *psz = chNew; - nCount++; - } - psz = ::CharNext(psz); - } - } - return nCount; - } - - // replace occurrences of substring lpszOld with lpszNew; - // empty lpszNew removes instances of lpszOld - int Replace(LPCTSTR lpszOld, LPCTSTR lpszNew) - { - // can't have empty or NULL lpszOld - - int nSourceLen = SafeStrlen(lpszOld); - if (nSourceLen == 0) - return 0; - int nReplacementLen = SafeStrlen(lpszNew); - - // loop once to figure out the size of the result string - int nCount = 0; - LPTSTR lpszStart = m_pchData; - LPTSTR lpszEnd = m_pchData + GetData()->nDataLength; - LPTSTR lpszTarget = NULL; - while (lpszStart < lpszEnd) - { - while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) - { - nCount++; - lpszStart = lpszTarget + nSourceLen; - } - lpszStart += lstrlen(lpszStart) + 1; - } - - // if any changes were made, make them - if (nCount > 0) - { - CopyBeforeWrite(); - - // if the buffer is too small, just allocate a new buffer (slow but sure) - int nOldLength = GetData()->nDataLength; - int nNewLength = nOldLength + (nReplacementLen - nSourceLen) * nCount; - if (GetData()->nAllocLength < nNewLength || GetData()->nRefs > 1) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, pOldData->nDataLength * sizeof(TCHAR)); - CString::Release(pOldData); - } - // else, we just do it in-place - lpszStart = m_pchData; - lpszEnd = m_pchData + GetData()->nDataLength; - - // loop again to actually do the work - while (lpszStart < lpszEnd) - { - while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) - { - int nBalance = nOldLength - ((int)(DWORD_PTR)(lpszTarget - m_pchData) + nSourceLen); - int cchBuffLen = GetData()->nAllocLength - (int)(DWORD_PTR)(lpszTarget - m_pchData); - SecureHelper::memmove_x(lpszTarget + nReplacementLen, (cchBuffLen - nReplacementLen + 1) * sizeof(TCHAR), lpszTarget + nSourceLen, nBalance * sizeof(TCHAR)); - SecureHelper::memcpy_x(lpszTarget, (cchBuffLen + 1) * sizeof(TCHAR), lpszNew, nReplacementLen * sizeof(TCHAR)); - lpszStart = lpszTarget + nReplacementLen; - lpszStart[nBalance] = _T('\0'); - nOldLength += (nReplacementLen - nSourceLen); - } - lpszStart += lstrlen(lpszStart) + 1; - } - ATLASSERT(m_pchData[nNewLength] == _T('\0')); - GetData()->nDataLength = nNewLength; - } - - return nCount; - } - - // remove occurrences of chRemove - int Remove(TCHAR chRemove) - { - CopyBeforeWrite(); - - LPTSTR pstrSource = m_pchData; - LPTSTR pstrDest = m_pchData; - LPTSTR pstrEnd = m_pchData + GetData()->nDataLength; - - while (pstrSource < pstrEnd) - { - if (*pstrSource != chRemove) - { - *pstrDest = *pstrSource; - pstrDest = ::CharNext(pstrDest); - } - pstrSource = ::CharNext(pstrSource); - } - *pstrDest = _T('\0'); - int nCount = (int)(DWORD_PTR)(pstrSource - pstrDest); - GetData()->nDataLength -= nCount; - - return nCount; - } - - // insert character at zero-based index; concatenates if index is past end of string - int Insert(int nIndex, TCHAR ch) - { - CopyBeforeWrite(); - - if (nIndex < 0) - nIndex = 0; - - int nNewLength = GetData()->nDataLength; - if (nIndex > nNewLength) - nIndex = nNewLength; - nNewLength++; - - if (GetData()->nAllocLength < nNewLength) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); - CString::Release(pOldData); - } - - // move existing bytes down - SecureHelper::memmove_x(m_pchData + nIndex + 1, (GetData()->nAllocLength - nIndex) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex) * sizeof(TCHAR)); - m_pchData[nIndex] = ch; - GetData()->nDataLength = nNewLength; - - return nNewLength; - } - - // insert substring at zero-based index; concatenates if index is past end of string - int Insert(int nIndex, LPCTSTR pstr) - { - if (nIndex < 0) - nIndex = 0; - - int nInsertLength = SafeStrlen(pstr); - int nNewLength = GetData()->nDataLength; - if (nInsertLength > 0) - { - CopyBeforeWrite(); - if (nIndex > nNewLength) - nIndex = nNewLength; - nNewLength += nInsertLength; - - if (GetData()->nAllocLength < nNewLength) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); - CString::Release(pOldData); - } - - // move existing bytes down - SecureHelper::memmove_x(m_pchData + nIndex + nInsertLength, (GetData()->nAllocLength + 1 - nIndex - nInsertLength) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex - nInsertLength + 1) * sizeof(TCHAR)); - SecureHelper::memcpy_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), pstr, nInsertLength * sizeof(TCHAR)); - GetData()->nDataLength = nNewLength; - } - - return nNewLength; - } - - // delete nCount characters starting at zero-based index - int Delete(int nIndex, int nCount = 1) - { - if (nIndex < 0) - nIndex = 0; - int nLength = GetData()->nDataLength; - if (nCount > 0 && nIndex < nLength) - { - if((nIndex + nCount) > nLength) - nCount = nLength - nIndex; - CopyBeforeWrite(); - int nBytesToCopy = nLength - (nIndex + nCount) + 1; - - SecureHelper::memmove_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), m_pchData + nIndex + nCount, nBytesToCopy * sizeof(TCHAR)); - nLength -= nCount; - GetData()->nDataLength = nLength; - } - - return nLength; - } - - // searching (return starting index, or -1 if not found) - // look for a single character match - int Find(TCHAR ch) const // like "C" strchr - { - return Find(ch, 0); - } - - int ReverseFind(TCHAR ch) const - { - // find last single character - LPCTSTR lpsz = _cstrrchr(m_pchData, (_TUCHAR)ch); - - // return -1 if not found, distance from beginning otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - int Find(TCHAR ch, int nStart) const // starting at index - { - int nLength = GetData()->nDataLength; - if (nStart < 0 || nStart >= nLength) - return -1; - - // find first single character - LPCTSTR lpsz = _cstrchr(m_pchData + nStart, (_TUCHAR)ch); - - // return -1 if not found and index otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - int FindOneOf(LPCTSTR lpszCharSet) const - { - ATLASSERT(_IsValidString(lpszCharSet)); - LPCTSTR lpsz = _cstrpbrk(m_pchData, lpszCharSet); - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - // look for a specific sub-string - // find a sub-string (like strstr) - int Find(LPCTSTR lpszSub) const // like "C" strstr - { - return Find(lpszSub, 0); - } - - int Find(LPCTSTR lpszSub, int nStart) const // starting at index - { - ATLASSERT(_IsValidString(lpszSub)); - - int nLength = GetData()->nDataLength; - if (nStart < 0 || nStart > nLength) - return -1; - - // find first matching substring - LPCTSTR lpsz = _cstrstr(m_pchData + nStart, lpszSub); - - // return -1 for not found, distance from beginning otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - // Concatentation for non strings - CString& Append(int n) - { - const int cchBuff = 12; - TCHAR szBuffer[cchBuff] = { 0 }; - SecureHelper::wsprintf_x(szBuffer, cchBuff, _T("%d"), n); - ConcatInPlace(SafeStrlen(szBuffer), szBuffer); - return *this; - } - - // simple formatting - // formatting (using wsprintf style formatting) - BOOL __cdecl Format(LPCTSTR lpszFormat, ...) - { - ATLASSERT(_IsValidString(lpszFormat)); - - va_list argList; - va_start(argList, lpszFormat); - BOOL bRet = FormatV(lpszFormat, argList); - va_end(argList); - return bRet; - } - - BOOL __cdecl Format(UINT nFormatID, ...) - { - CString strFormat; - BOOL bRet = strFormat.LoadString(nFormatID); - ATLASSERT(bRet != 0); - - va_list argList; - va_start(argList, nFormatID); - bRet = FormatV(strFormat, argList); - va_end(argList); - return bRet; - } - - BOOL FormatV(LPCTSTR lpszFormat, va_list argList) - { - ATLASSERT(_IsValidString(lpszFormat)); - - enum _FormatModifiers - { - FORCE_ANSI = 0x10000, - FORCE_UNICODE = 0x20000, - FORCE_INT64 = 0x40000 - }; - - va_list argListSave = argList; - - // make a guess at the maximum length of the resulting string - int nMaxLen = 0; - for (LPCTSTR lpsz = lpszFormat; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) - { - // handle '%' character, but watch out for '%%' - if (*lpsz != _T('%') || *(lpsz = ::CharNext(lpsz)) == _T('%')) - { - nMaxLen += (int)(::CharNext(lpsz) - lpsz); - continue; - } - - int nItemLen = 0; - - // handle '%' character with format - int nWidth = 0; - for (; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) - { - // check for valid flags - if (*lpsz == _T('#')) - nMaxLen += 2; // for '0x' - else if (*lpsz == _T('*')) - nWidth = va_arg(argList, int); - else if (*lpsz == _T('-') || *lpsz == _T('+') || *lpsz == _T('0') || *lpsz == _T(' ')) - ; - else // hit non-flag character - break; - } - // get width and skip it - if (nWidth == 0) - { - // width indicated by - nWidth = _cstrtoi(lpsz); - for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) - ; - } - ATLASSERT(nWidth >= 0); - - int nPrecision = 0; - if (*lpsz == _T('.')) - { - // skip past '.' separator (width.precision) - lpsz = ::CharNext(lpsz); - - // get precision and skip it - if (*lpsz == _T('*')) - { - nPrecision = va_arg(argList, int); - lpsz = ::CharNext(lpsz); - } - else - { - nPrecision = _cstrtoi(lpsz); - for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) - ; - } - ATLASSERT(nPrecision >= 0); - } - - // should be on type modifier or specifier - int nModifier = 0; - if(lpsz[0] == _T('I') && lpsz[1] == _T('6') && lpsz[2] == _T('4')) - { - lpsz += 3; - nModifier = FORCE_INT64; - } - else - { - switch (*lpsz) - { - // modifiers that affect size - case _T('h'): - nModifier = FORCE_ANSI; - lpsz = ::CharNext(lpsz); - break; - case _T('l'): - nModifier = FORCE_UNICODE; - lpsz = ::CharNext(lpsz); - break; - - // modifiers that do not affect size - case _T('F'): - case _T('N'): - case _T('L'): - lpsz = ::CharNext(lpsz); - break; - } - } - - // now should be on specifier - switch (*lpsz | nModifier) - { - // single characters - case _T('c'): - case _T('C'): - nItemLen = 2; - va_arg(argList, TCHAR); - break; - case _T('c') | FORCE_ANSI: - case _T('C') | FORCE_ANSI: - nItemLen = 2; - va_arg(argList, char); - break; - case _T('c') | FORCE_UNICODE: - case _T('C') | FORCE_UNICODE: - nItemLen = 2; - va_arg(argList, WCHAR); - break; - - // strings - case _T('s'): - { - LPCTSTR pstrNextArg = va_arg(argList, LPCTSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = lstrlen(pstrNextArg); - nItemLen = max(1, nItemLen); - } - break; - } - - case _T('S'): - { -#ifndef _UNICODE - LPWSTR pstrNextArg = va_arg(argList, LPWSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = (int)wcslen(pstrNextArg); - nItemLen = max(1, nItemLen); - } -#else // _UNICODE - LPCSTR pstrNextArg = va_arg(argList, LPCSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - nItemLen = ATL::lstrlenA(pstrNextArg); -#else - nItemLen = lstrlenA(pstrNextArg); -#endif - nItemLen = max(1, nItemLen); - } -#endif // _UNICODE - break; - } - - case _T('s') | FORCE_ANSI: - case _T('S') | FORCE_ANSI: - { - LPCSTR pstrNextArg = va_arg(argList, LPCSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - nItemLen = ATL::lstrlenA(pstrNextArg); -#else - nItemLen = lstrlenA(pstrNextArg); -#endif - nItemLen = max(1, nItemLen); - } - break; - } - - case _T('s') | FORCE_UNICODE: - case _T('S') | FORCE_UNICODE: - { - LPWSTR pstrNextArg = va_arg(argList, LPWSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = (int)wcslen(pstrNextArg); - nItemLen = max(1, nItemLen); - } - break; - } - } - - // adjust nItemLen for strings - if (nItemLen != 0) - { - nItemLen = max(nItemLen, nWidth); - if (nPrecision != 0) - nItemLen = min(nItemLen, nPrecision); - } - else - { - switch (*lpsz) - { - // integers - case _T('d'): - case _T('i'): - case _T('u'): - case _T('x'): - case _T('X'): - case _T('o'): - if (nModifier & FORCE_INT64) - va_arg(argList, __int64); - else - va_arg(argList, int); - nItemLen = 32; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - -#ifndef _ATL_USE_CSTRING_FLOAT - case _T('e'): - case _T('E'): - case _T('f'): - case _T('g'): - case _T('G'): - ATLASSERT(!"Floating point (%%e, %%E, %%f, %%g, and %%G) is not supported by the WTL::CString class."); -#ifndef _DEBUG - ::OutputDebugString(_T("Floating point (%%e, %%f, %%g, and %%G) is not supported by the WTL::CString class.")); -#ifndef _WIN32_WCE - ::DebugBreak(); -#else // CE specific - DebugBreak(); -#endif // _WIN32_WCE -#endif // !_DEBUG - break; -#else // _ATL_USE_CSTRING_FLOAT - case _T('e'): - case _T('E'): - case _T('g'): - case _T('G'): - va_arg(argList, double); - nItemLen = 128; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - case _T('f'): - { - double f = va_arg(argList, double); - // 312 == strlen("-1+(309 zeroes).") - // 309 zeroes == max precision of a double - // 6 == adjustment in case precision is not specified, - // which means that the precision defaults to 6 - int cchLen = max(nWidth, 312 + nPrecision + 6); - CTempBuffer buff; - LPTSTR pszTemp = buff.Allocate(cchLen); - if(pszTemp != NULL) - { - SecureHelper::sprintf_x(pszTemp, cchLen, _T("%*.*f"), nWidth, nPrecision + 6, f); - nItemLen = (int)_tcslen(pszTemp); - } - else - { - nItemLen = cchLen; - } - } - break; -#endif // _ATL_USE_CSTRING_FLOAT - - case _T('p'): - va_arg(argList, void*); - nItemLen = 32; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - - // no output - case _T('n'): - va_arg(argList, int*); - break; - - default: - ATLASSERT(FALSE); // unknown formatting option - } - } - - // adjust nMaxLen for output nItemLen - nMaxLen += nItemLen; - } - - if(GetBuffer(nMaxLen) == NULL) - return FALSE; -#ifndef _ATL_USE_CSTRING_FLOAT - int nRet = SecureHelper::wvsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); -#else // _ATL_USE_CSTRING_FLOAT - int nRet = SecureHelper::vsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); -#endif // _ATL_USE_CSTRING_FLOAT - nRet; // ref - ATLASSERT(nRet <= GetAllocLength()); - ReleaseBuffer(); - - va_end(argListSave); - return TRUE; - } - - // formatting for localization (uses FormatMessage API) - // formatting (using FormatMessage style formatting) - BOOL __cdecl FormatMessage(LPCTSTR lpszFormat, ...) - { - // format message into temporary buffer lpszTemp - va_list argList; - va_start(argList, lpszFormat); - LPTSTR lpszTemp; - BOOL bRet = TRUE; - - if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, - lpszFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) - bRet = FALSE; - - // assign lpszTemp into the resulting string and free the temporary - *this = lpszTemp; - LocalFree(lpszTemp); - va_end(argList); - return bRet; - } - - BOOL __cdecl FormatMessage(UINT nFormatID, ...) - { - // get format string from string table - CString strFormat; - BOOL bRetTmp = strFormat.LoadString(nFormatID); - bRetTmp; // ref - ATLASSERT(bRetTmp != 0); - - // format message into temporary buffer lpszTemp - va_list argList; - va_start(argList, nFormatID); - LPTSTR lpszTemp; - BOOL bRet = TRUE; - - if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, - strFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) - bRet = FALSE; - - // assign lpszTemp into the resulting string and free lpszTemp - *this = lpszTemp; - LocalFree(lpszTemp); - va_end(argList); - return bRet; - } - - // Windows support - BOOL LoadString(UINT nID) // load from string resource (255 chars max.) - { -#ifdef _UNICODE - const int CHAR_FUDGE = 1; // one TCHAR unused is good enough -#else - const int CHAR_FUDGE = 2; // two BYTES unused for case of DBC last char -#endif - - // try fixed buffer first (to avoid wasting space in the heap) - TCHAR szTemp[256]; - int nCount = sizeof(szTemp) / sizeof(szTemp[0]); - int nLen = _LoadString(nID, szTemp, nCount); - if (nCount - nLen > CHAR_FUDGE) - { - *this = szTemp; - return (nLen > 0); - } - - // try buffer size of 512, then larger size until entire string is retrieved - int nSize = 256; - do - { - nSize += 256; - LPTSTR lpstr = GetBuffer(nSize - 1); - if(lpstr == NULL) - { - nLen = 0; - break; - } - nLen = _LoadString(nID, lpstr, nSize); - } while (nSize - nLen <= CHAR_FUDGE); - ReleaseBuffer(); - - return (nLen > 0); - } - -#ifndef _UNICODE - // ANSI <-> OEM support (convert string in place) - void AnsiToOem() - { - CopyBeforeWrite(); - ::AnsiToOem(m_pchData, m_pchData); - } - - void OemToAnsi() - { - CopyBeforeWrite(); - ::OemToAnsi(m_pchData, m_pchData); - } -#endif - -#ifndef _ATL_NO_COM - // OLE BSTR support (use for OLE automation) - BSTR AllocSysString() const - { -#if defined(_UNICODE) || defined(OLE2ANSI) - BSTR bstr = ::SysAllocStringLen(m_pchData, GetData()->nDataLength); -#else - int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, - GetData()->nDataLength, NULL, NULL); - BSTR bstr = ::SysAllocStringLen(NULL, nLen); - if(bstr != NULL) - MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, bstr, nLen); -#endif - return bstr; - } - - BSTR SetSysString(BSTR* pbstr) const - { -#if defined(_UNICODE) || defined(OLE2ANSI) - ::SysReAllocStringLen(pbstr, m_pchData, GetData()->nDataLength); -#else - int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, - GetData()->nDataLength, NULL, NULL); - if(::SysReAllocStringLen(pbstr, NULL, nLen)) - MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, *pbstr, nLen); -#endif - ATLASSERT(*pbstr != NULL); - return *pbstr; - } -#endif // !_ATL_NO_COM - - // Access to string implementation buffer as "C" character array - LPTSTR GetBuffer(int nMinBufLength) - { - ATLASSERT(nMinBufLength >= 0); - - if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength) - { - // we have to grow the buffer - CStringData* pOldData = GetData(); - int nOldLen = GetData()->nDataLength; // AllocBuffer will tromp it - if (nMinBufLength < nOldLen) - nMinBufLength = nOldLen; - - if(!AllocBuffer(nMinBufLength)) - return NULL; - - SecureHelper::memcpy_x(m_pchData, (nMinBufLength + 1) * sizeof(TCHAR), pOldData->data(), (nOldLen + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nOldLen; - CString::Release(pOldData); - } - ATLASSERT(GetData()->nRefs <= 1); - - // return a pointer to the character storage for this string - ATLASSERT(m_pchData != NULL); - return m_pchData; - } - - void ReleaseBuffer(int nNewLength = -1) - { - CopyBeforeWrite(); // just in case GetBuffer was not called - - if (nNewLength == -1) - nNewLength = lstrlen(m_pchData); // zero terminated - - ATLASSERT(nNewLength <= GetData()->nAllocLength); - GetData()->nDataLength = nNewLength; - m_pchData[nNewLength] = _T('\0'); - } - - LPTSTR GetBufferSetLength(int nNewLength) - { - ATLASSERT(nNewLength >= 0); - - if(GetBuffer(nNewLength) == NULL) - return NULL; - - GetData()->nDataLength = nNewLength; - m_pchData[nNewLength] = _T('\0'); - return m_pchData; - } - - void FreeExtra() - { - ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); - if (GetData()->nDataLength != GetData()->nAllocLength) - { - CStringData* pOldData = GetData(); - if(AllocBuffer(GetData()->nDataLength)) - { - SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pOldData->data(), pOldData->nDataLength * sizeof(TCHAR)); - ATLASSERT(m_pchData[GetData()->nDataLength] == _T('\0')); - CString::Release(pOldData); - } - } - ATLASSERT(GetData() != NULL); - } - - // Use LockBuffer/UnlockBuffer to turn refcounting off - LPTSTR LockBuffer() - { - LPTSTR lpsz = GetBuffer(0); - if(lpsz != NULL) - GetData()->nRefs = -1; - return lpsz; - } - - void UnlockBuffer() - { - ATLASSERT(GetData()->nRefs == -1); - if (GetData() != _atltmpDataNil) - GetData()->nRefs = 1; - } - -// Implementation -public: - ~CString() // free any attached data - { - if (GetData() != _atltmpDataNil) - { - if (InterlockedDecrement(&GetData()->nRefs) <= 0) - delete[] (BYTE*)GetData(); - } - } - - int GetAllocLength() const - { - return GetData()->nAllocLength; - } - - static BOOL __stdcall _IsValidString(LPCTSTR lpsz, int /*nLength*/ = -1) - { - return (lpsz != NULL) ? TRUE : FALSE; - } - -protected: - LPTSTR m_pchData; // pointer to ref counted string data - - // implementation helpers - CStringData* GetData() const - { - ATLASSERT(m_pchData != NULL); - return ((CStringData*)m_pchData) - 1; - } - - void Init() - { - m_pchData = _GetEmptyString().m_pchData; - } - - BOOL AllocCopy(CString& dest, int nCopyLen, int nCopyIndex, int nExtraLen) const - { - // will clone the data attached to this string - // allocating 'nExtraLen' characters - // Places results in uninitialized string 'dest' - // Will copy the part or all of original data to start of new string - - BOOL bRet = FALSE; - int nNewLen = nCopyLen + nExtraLen; - if (nNewLen == 0) - { - dest.Init(); - bRet = TRUE; - } - else if(nNewLen >= nCopyLen) - { - if(dest.AllocBuffer(nNewLen)) - { - SecureHelper::memcpy_x(dest.m_pchData, (nNewLen + 1) * sizeof(TCHAR), m_pchData + nCopyIndex, nCopyLen * sizeof(TCHAR)); - bRet = TRUE; - } - } - - return bRet; - } - - // always allocate one extra character for '\0' termination - // assumes [optimistically] that data length will equal allocation length - BOOL AllocBuffer(int nLen) - { - ATLASSERT(nLen >= 0); - ATLASSERT(nLen <= INT_MAX - 1); // max size (enough room for 1 extra) - - if (nLen == 0) - { - Init(); - } - else - { - CStringData* pData = NULL; - ATLTRY(pData = (CStringData*)new BYTE[sizeof(CStringData) + (nLen + 1) * sizeof(TCHAR)]); - if(pData == NULL) - return FALSE; - - pData->nRefs = 1; - pData->data()[nLen] = _T('\0'); - pData->nDataLength = nLen; - pData->nAllocLength = nLen; - m_pchData = pData->data(); - } - - return TRUE; - } - - // Assignment operators - // All assign a new value to the string - // (a) first see if the buffer is big enough - // (b) if enough room, copy on top of old buffer, set size and type - // (c) otherwise free old string data, and create a new one - // - // All routines return the new string (but as a 'const CString&' so that - // assigning it again will cause a copy, eg: s1 = s2 = "hi there". - // - void AssignCopy(int nSrcLen, LPCTSTR lpszSrcData) - { - if(AllocBeforeWrite(nSrcLen)) - { - SecureHelper::memcpy_x(m_pchData, (nSrcLen + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); - GetData()->nDataLength = nSrcLen; - m_pchData[nSrcLen] = _T('\0'); - } - } - - // Concatenation - // NOTE: "operator +" is done as friend functions for simplicity - // There are three variants: - // CString + CString - // and for ? = TCHAR, LPCTSTR - // CString + ? - // ? + CString - BOOL ConcatCopy(int nSrc1Len, LPCTSTR lpszSrc1Data, int nSrc2Len, LPCTSTR lpszSrc2Data) - { - // -- master concatenation routine - // Concatenate two sources - // -- assume that 'this' is a new CString object - - BOOL bRet = TRUE; - int nNewLen = nSrc1Len + nSrc2Len; - if(nNewLen < nSrc1Len || nNewLen < nSrc2Len) - { - bRet = FALSE; - } - else if(nNewLen != 0) - { - bRet = AllocBuffer(nNewLen); - if (bRet) - { - SecureHelper::memcpy_x(m_pchData, (nNewLen + 1) * sizeof(TCHAR), lpszSrc1Data, nSrc1Len * sizeof(TCHAR)); - SecureHelper::memcpy_x(m_pchData + nSrc1Len, (nNewLen + 1 - nSrc1Len) * sizeof(TCHAR), lpszSrc2Data, nSrc2Len * sizeof(TCHAR)); - } - } - return bRet; - } - - void ConcatInPlace(int nSrcLen, LPCTSTR lpszSrcData) - { - // -- the main routine for += operators - - // concatenating an empty string is a no-op! - if (nSrcLen == 0) - return; - - // if the buffer is too small, or we have a width mis-match, just - // allocate a new buffer (slow but sure) - if (GetData()->nRefs > 1 || GetData()->nDataLength + nSrcLen > GetData()->nAllocLength) - { - // we have to grow the buffer, use the ConcatCopy routine - CStringData* pOldData = GetData(); - if (ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData)) - { - ATLASSERT(pOldData != NULL); - CString::Release(pOldData); - } - } - else - { - // fast concatenation when buffer big enough - SecureHelper::memcpy_x(m_pchData + GetData()->nDataLength, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); - GetData()->nDataLength += nSrcLen; - ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); - m_pchData[GetData()->nDataLength] = _T('\0'); - } - } - - void CopyBeforeWrite() - { - if (GetData()->nRefs > 1) - { - CStringData* pData = GetData(); - Release(); - if(AllocBuffer(pData->nDataLength)) - SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pData->data(), (pData->nDataLength + 1) * sizeof(TCHAR)); - } - ATLASSERT(GetData()->nRefs <= 1); - } - - BOOL AllocBeforeWrite(int nLen) - { - BOOL bRet = TRUE; - if (GetData()->nRefs > 1 || nLen > GetData()->nAllocLength) - { - Release(); - bRet = AllocBuffer(nLen); - } - ATLASSERT(GetData()->nRefs <= 1); - return bRet; - } - - void Release() - { - if (GetData() != _atltmpDataNil) - { - ATLASSERT(GetData()->nRefs != 0); - if (InterlockedDecrement(&GetData()->nRefs) <= 0) - delete[] (BYTE*)GetData(); - Init(); - } - } - - static void PASCAL Release(CStringData* pData) - { - if (pData != _atltmpDataNil) - { - ATLASSERT(pData->nRefs != 0); - if (InterlockedDecrement(&pData->nRefs) <= 0) - delete[] (BYTE*)pData; - } - } - - static int PASCAL SafeStrlen(LPCTSTR lpsz) - { - return (lpsz == NULL) ? 0 : lstrlen(lpsz); - } - - static int __stdcall _LoadString(UINT nID, LPTSTR lpszBuf, UINT nMaxBuf) - { -#ifdef _DEBUG - // LoadString without annoying warning from the Debug kernel if the - // segment containing the string is not present - if (::FindResource(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE((nID >> 4) + 1), RT_STRING) == NULL) - { - lpszBuf[0] = _T('\0'); - return 0; // not found - } -#endif // _DEBUG - - int nLen = ::LoadString(ModuleHelper::GetResourceInstance(), nID, lpszBuf, nMaxBuf); - if (nLen == 0) - lpszBuf[0] = _T('\0'); - - return nLen; - } - - static const CString& __stdcall _GetEmptyString() - { - return *(CString*)&_atltmpPchNil; - } - -// CString conversion helpers - static int __cdecl _wcstombsz(char* mbstr, const wchar_t* wcstr, size_t count) - { - if (count == 0 && mbstr != NULL) - return 0; - - int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1, mbstr, (int)count, NULL, NULL); - ATLASSERT(mbstr == NULL || result <= (int)count); - if (result > 0) - mbstr[result - 1] = 0; - return result; - } - - static int __cdecl _mbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count) - { - if (count == 0 && wcstr != NULL) - return 0; - - int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wcstr, (int)count); - ATLASSERT(wcstr == NULL || result <= (int)count); - if (result > 0) - wcstr[result - 1] = 0; - return result; - } - -// Helpers to avoid CRT startup code -#ifdef _ATL_MIN_CRT - static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) - { - // strchr for '\0' should succeed - while (*p != 0) - { - if (*p == ch) - break; - p = ::CharNext(p); - } - return (*p == ch) ? p : NULL; - } - - static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) - { - const TCHAR* lpsz = NULL; - while (*p != 0) - { - if (*p == ch) - lpsz = p; - p = ::CharNext(p); - } - return lpsz; - } - - static TCHAR* _cstrrev(TCHAR* pStr) - { - // optimize NULL, zero-length, and single-char case - if ((pStr == NULL) || (pStr[0] == _T('\0')) || (pStr[1] == _T('\0'))) - return pStr; - - TCHAR* p = pStr; - - while (*p != 0) - { - TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - char p1 = *(char*)p; - *(char*)p = *(char*)(p + 1); - *(char*)(p + 1) = p1; - } - p = pNext; - } - - p--; - TCHAR* q = pStr; - - while (q < p) - { - TCHAR t = *q; - *q = *p; - *p = t; - q++; - p--; - } - return pStr; - } - - static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nLen = lstrlen(pCharSet); - if (nLen == 0) - return (TCHAR*)pStr; - - const TCHAR* pRet = NULL; - const TCHAR* pCur = pStr; - while((pCur = _cstrchr(pCur, *pCharSet)) != NULL) - { - if(memcmp(pCur, pCharSet, nLen * sizeof(TCHAR)) == 0) - { - pRet = pCur; - break; - } - pCur = ::CharNext(pCur); - } - return pRet; - } - - static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nRet = 0; - const TCHAR* p = pStr; - while (*p != 0) - { - const TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - if(_cstrchr_db(pCharSet, *p, *(p + 1)) == NULL) - break; - nRet += 2; - } - else - { - if(_cstrchr(pCharSet, *p) == NULL) - break; - nRet++; - } - p = pNext; - } - return nRet; - } - - static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nRet = 0; - TCHAR* p = (TCHAR*)pStr; - while (*p != 0) - { - TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - if(_cstrchr_db(pCharSet, *p, *(p + 1)) != NULL) - break; - nRet += 2; - } - else - { - if(_cstrchr(pCharSet, *p) != NULL) - break; - nRet++; - } - p = pNext; - } - return nRet; - } - - static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) - { - int n = _cstrcspn(p, lpszCharSet); - return (p[n] != 0) ? &p[n] : NULL; - } - - static int _cstrisdigit(TCHAR ch) - { - WORD type; - GetStringTypeEx(GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); - return (type & C1_DIGIT) == C1_DIGIT; - } - - static int _cstrisspace(TCHAR ch) - { - WORD type; - GetStringTypeEx(GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); - return (type & C1_SPACE) == C1_SPACE; - } - - static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return lstrcmp(pstrOne, pstrOther); - } - - static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return lstrcmpi(pstrOne, pstrOther); - } - - static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - int nRet = CompareString(GetThreadLocale(), 0, pstrOne, -1, pstrOther, -1); - ATLASSERT(nRet != 0); - return nRet - 2; // convert to strcmp convention - } - - static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - int nRet = CompareString(GetThreadLocale(), NORM_IGNORECASE, pstrOne, -1, pstrOther, -1); - ATLASSERT(nRet != 0); - return nRet - 2; // convert to strcmp convention - } - - static int _cstrtoi(const TCHAR* nptr) - { - int c; // current char - int total; // current total - int sign; // if '-', then negative, otherwise positive - - while (_cstrisspace(*nptr)) - ++nptr; - - c = (int)(_TUCHAR)*nptr++; - sign = c; // save sign indication - if (c == _T('-') || c == _T('+')) - c = (int)(_TUCHAR)*nptr++; // skip sign - - total = 0; - - while (_cstrisdigit((TCHAR)c)) - { - total = 10 * total + (c - '0'); // accumulate digit - c = (int)(_TUCHAR)*nptr++; // get next char - } - - if (sign == '-') - return -total; - else - return total; // return result, negated if necessary - } -#else // !_ATL_MIN_CRT - static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) - { - return _tcschr(p, ch); - } - - static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) - { - return _tcsrchr(p, ch); - } - - static TCHAR* _cstrrev(TCHAR* pStr) - { - return _tcsrev(pStr); - } - - static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) - { - return _tcsstr(pStr, pCharSet); - } - - static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - return (int)_tcsspn(pStr, pCharSet); - } - - static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - return (int)_tcscspn(pStr, pCharSet); - } - - static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) - { - return _tcspbrk(p, lpszCharSet); - } - - static int _cstrisdigit(TCHAR ch) - { - return _istdigit(ch); - } - - static int _cstrisspace(TCHAR ch) - { - return _istspace((_TUCHAR)ch); - } - - static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcscmp(pstrOne, pstrOther); - } - - static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcsicmp(pstrOne, pstrOther); - } - -#ifndef _WIN32_WCE - static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcscoll(pstrOne, pstrOther); - } - - static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcsicoll(pstrOne, pstrOther); - } -#endif // !_WIN32_WCE - - static int _cstrtoi(const TCHAR* nptr) - { - return _ttoi(nptr); - } -#endif // !_ATL_MIN_CRT - - static const TCHAR* _cstrchr_db(const TCHAR* p, TCHAR ch1, TCHAR ch2) - { - const TCHAR* lpsz = NULL; - while (*p != 0) - { - if (*p == ch1 && *(p + 1) == ch2) - { - lpsz = p; - break; - } - p = ::CharNext(p); - } - return lpsz; - } -}; - - -// Compare helpers - -inline bool __stdcall operator ==(const CString& s1, const CString& s2) -{ return s1.Compare(s2) == 0; } - -inline bool __stdcall operator ==(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) == 0; } - -inline bool __stdcall operator ==(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) == 0; } - -inline bool __stdcall operator !=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) != 0; } - -inline bool __stdcall operator !=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) != 0; } - -inline bool __stdcall operator !=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) != 0; } - -inline bool __stdcall operator <(const CString& s1, const CString& s2) -{ return s1.Compare(s2) < 0; } - -inline bool __stdcall operator <(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) < 0; } - -inline bool __stdcall operator <(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) > 0; } - -inline bool __stdcall operator >(const CString& s1, const CString& s2) -{ return s1.Compare(s2) > 0; } - -inline bool __stdcall operator >(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) > 0; } - -inline bool __stdcall operator >(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) < 0; } - -inline bool __stdcall operator <=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) <= 0; } - -inline bool __stdcall operator <=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) <= 0; } - -inline bool __stdcall operator <=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) >= 0; } - -inline bool __stdcall operator >=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) >= 0; } - -inline bool __stdcall operator >=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) >= 0; } - -inline bool __stdcall operator >=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) <= 0; } - - -// CString "operator +" functions - -inline CString __stdcall operator +(const CString& string1, const CString& string2) -{ - CString s; - s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData, string2.GetData()->nDataLength, string2.m_pchData); - return s; -} - -inline CString __stdcall operator +(const CString& string, TCHAR ch) -{ - CString s; - s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch); - return s; -} - -inline CString __stdcall operator +(TCHAR ch, const CString& string) -{ - CString s; - s.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData); - return s; -} - -#ifdef _UNICODE -inline CString __stdcall operator +(const CString& string, char ch) -{ - return string + (TCHAR)ch; -} - -inline CString __stdcall operator +(char ch, const CString& string) -{ - return (TCHAR)ch + string; -} -#endif // _UNICODE - -inline CString __stdcall operator +(const CString& string, LPCTSTR lpsz) -{ - ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); - CString s; - s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, CString::SafeStrlen(lpsz), lpsz); - return s; -} - -inline CString __stdcall operator +(LPCTSTR lpsz, const CString& string) -{ - ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); - CString s; - s.ConcatCopy(CString::SafeStrlen(lpsz), lpsz, string.GetData()->nDataLength, string.m_pchData); - return s; -} - -#endif // !_WTL_NO_CSTRING - - -/////////////////////////////////////////////////////////////////////////////// -// CRecentDocumentList - MRU List Support - -#ifndef _WIN32_WCE - -#ifndef _WTL_MRUEMPTY_TEXT - #define _WTL_MRUEMPTY_TEXT _T("(empty)") -#endif - -// forward declaration -inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen); - -template -class CRecentDocumentListBase -{ -public: -// Declarations - struct _DocEntry - { - TCHAR szDocName[t_cchItemLen]; - bool operator ==(const _DocEntry& de) const - { return (lstrcmpi(szDocName, de.szDocName) == 0); } - }; - - enum - { - m_nMaxEntries_Min = 2, - m_nMaxEntries_Max = t_nLastID - t_nFirstID + 1, - m_cchMaxItemLen_Min = 6, - m_cchMaxItemLen_Max = t_cchItemLen, - m_cchItemNameLen = 11 - }; - -// Data members - ATL::CSimpleArray<_DocEntry> m_arrDocs; - int m_nMaxEntries; // default is 4 - HMENU m_hMenu; - - TCHAR m_szNoEntries[t_cchItemLen]; - - int m_cchMaxItemLen; - -// Constructor - CRecentDocumentListBase() : m_hMenu(NULL), m_nMaxEntries(4), m_cchMaxItemLen(-1) - { - // These ASSERTs verify values of the template arguments - ATLASSERT(t_cchItemLen > m_cchMaxItemLen_Min); - ATLASSERT(m_nMaxEntries_Max > m_nMaxEntries_Min); - } - -// Attributes - HMENU GetMenuHandle() const - { - return m_hMenu; - } - - void SetMenuHandle(HMENU hMenu) - { - ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); - m_hMenu = hMenu; - if(m_hMenu == NULL || (::GetMenuString(m_hMenu, t_nFirstID, m_szNoEntries, t_cchItemLen, MF_BYCOMMAND) == 0)) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - SecureHelper::strncpy_x(m_szNoEntries, _countof(m_szNoEntries), pT->GetMRUEmptyText(), _TRUNCATE); - } - } - - int GetMaxEntries() const - { - return m_nMaxEntries; - } - - void SetMaxEntries(int nMaxEntries) - { - ATLASSERT(nMaxEntries >= m_nMaxEntries_Min && nMaxEntries <= m_nMaxEntries_Max); - if(nMaxEntries < m_nMaxEntries_Min) - nMaxEntries = m_nMaxEntries_Min; - else if(nMaxEntries > m_nMaxEntries_Max) - nMaxEntries = m_nMaxEntries_Max; - m_nMaxEntries = nMaxEntries; - } - - int GetMaxItemLength() const - { - return m_cchMaxItemLen; - } - - void SetMaxItemLength(int cchMaxLen) - { - ATLASSERT((cchMaxLen >= m_cchMaxItemLen_Min && cchMaxLen <= m_cchMaxItemLen_Max) || cchMaxLen == -1); - if(cchMaxLen != -1) - { - if(cchMaxLen < m_cchMaxItemLen_Min) - cchMaxLen = m_cchMaxItemLen_Min; - else if(cchMaxLen > m_cchMaxItemLen_Max) - cchMaxLen = m_cchMaxItemLen_Max; - } - m_cchMaxItemLen = cchMaxLen; - T* pT = static_cast(this); - pT->UpdateMenu(); - } - -// Operations - BOOL AddToList(LPCTSTR lpstrDocName) - { - _DocEntry de; - errno_t nRet = SecureHelper::strncpy_x(de.szDocName, _countof(de.szDocName), lpstrDocName, _TRUNCATE); - if(nRet != 0 && nRet != STRUNCATE) - return FALSE; - - for(int i = 0; i < m_arrDocs.GetSize(); i++) - { - if(lstrcmpi(m_arrDocs[i].szDocName, lpstrDocName) == 0) - { - m_arrDocs.RemoveAt(i); - break; - } - } - - if(m_arrDocs.GetSize() == m_nMaxEntries) - m_arrDocs.RemoveAt(0); - - BOOL bRet = m_arrDocs.Add(de); - if(bRet) - { - T* pT = static_cast(this); - bRet = pT->UpdateMenu(); - } - return bRet; - } - - // This function is deprecated because it is not safe. - // Use the version below that accepts the buffer length. -#if (_MSC_VER >= 1300) - __declspec(deprecated) -#endif - BOOL GetFromList(int /*nItemID*/, LPTSTR /*lpstrDocName*/) - { - ATLASSERT(FALSE); - return FALSE; - } - - BOOL GetFromList(int nItemID, LPTSTR lpstrDocName, int cchLength) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) - return FALSE; - if(lstrlen(m_arrDocs[nIndex].szDocName) >= cchLength) - return FALSE; - SecureHelper::strcpy_x(lpstrDocName, cchLength, m_arrDocs[nIndex].szDocName); - - return TRUE; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetFromList(int nItemID, _CSTRING_NS::CString& strDocName) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) - return FALSE; - strDocName = m_arrDocs[nIndex].szDocName; - return TRUE; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL RemoveFromList(int nItemID) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - BOOL bRet = m_arrDocs.RemoveAt(nIndex); - if(bRet) - { - T* pT = static_cast(this); - bRet = pT->UpdateMenu(); - } - return bRet; - } - - BOOL MoveToTop(int nItemID) - { - int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) - return FALSE; - _DocEntry de; - de = m_arrDocs[nIndex]; - m_arrDocs.RemoveAt(nIndex); - BOOL bRet = m_arrDocs.Add(de); - if(bRet) - { - T* pT = static_cast(this); - bRet = pT->UpdateMenu(); - } - return bRet; - } - - BOOL ReadFromRegistry(LPCTSTR lpstrRegKey) - { - T* pT = static_cast(this); - ATL::CRegKey rkParent; - ATL::CRegKey rk; - - LONG lRet = rkParent.Open(HKEY_CURRENT_USER, lpstrRegKey); - if(lRet != ERROR_SUCCESS) - return FALSE; - lRet = rk.Open(rkParent, pT->GetRegKeyName()); - if(lRet != ERROR_SUCCESS) - return FALSE; - - DWORD dwRet = 0; -#if (_ATL_VER >= 0x0700) - lRet = rk.QueryDWORDValue(pT->GetRegCountName(), dwRet); -#else - lRet = rk.QueryValue(dwRet, pT->GetRegCountName()); -#endif - if(lRet != ERROR_SUCCESS) - return FALSE; - SetMaxEntries(dwRet); - - m_arrDocs.RemoveAll(); - - TCHAR szRetString[t_cchItemLen] = { 0 }; - _DocEntry de; - - for(int nItem = m_nMaxEntries; nItem > 0; nItem--) - { - TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); -#if (_ATL_VER >= 0x0700) - ULONG ulCount = t_cchItemLen; - lRet = rk.QueryStringValue(szBuff, szRetString, &ulCount); -#else - DWORD dwCount = t_cchItemLen * sizeof(TCHAR); - lRet = rk.QueryValue(szRetString, szBuff, &dwCount); -#endif - if(lRet == ERROR_SUCCESS) - { - SecureHelper::strcpy_x(de.szDocName, _countof(de.szDocName), szRetString); - m_arrDocs.Add(de); - } - } - - rk.Close(); - rkParent.Close(); - - return pT->UpdateMenu(); - } - - BOOL WriteToRegistry(LPCTSTR lpstrRegKey) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - ATL::CRegKey rkParent; - ATL::CRegKey rk; - - LONG lRet = rkParent.Create(HKEY_CURRENT_USER, lpstrRegKey); - if(lRet != ERROR_SUCCESS) - return FALSE; - lRet = rk.Create(rkParent, pT->GetRegKeyName()); - if(lRet != ERROR_SUCCESS) - return FALSE; - -#if (_ATL_VER >= 0x0700) - lRet = rk.SetDWORDValue(pT->GetRegCountName(), m_nMaxEntries); -#else - lRet = rk.SetValue(m_nMaxEntries, pT->GetRegCountName()); -#endif - ATLASSERT(lRet == ERROR_SUCCESS); - - // set new values - int nItem; - for(nItem = m_arrDocs.GetSize(); nItem > 0; nItem--) - { - TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); - TCHAR szDocName[t_cchItemLen] = { 0 }; - GetFromList(t_nFirstID + nItem - 1, szDocName, t_cchItemLen); -#if (_ATL_VER >= 0x0700) - lRet = rk.SetStringValue(szBuff, szDocName); -#else - lRet = rk.SetValue(szDocName, szBuff); -#endif - ATLASSERT(lRet == ERROR_SUCCESS); - } - - // delete unused keys - for(nItem = m_arrDocs.GetSize() + 1; nItem < m_nMaxEntries_Max; nItem++) - { - TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); - rk.DeleteValue(szBuff); - } - - rk.Close(); - rkParent.Close(); - - return TRUE; - } - -// Implementation - BOOL UpdateMenu() - { - if(m_hMenu == NULL) - return FALSE; - ATLASSERT(::IsMenu(m_hMenu)); - - int nItems = ::GetMenuItemCount(m_hMenu); - int nInsertPoint; - for(nInsertPoint = 0; nInsertPoint < nItems; nInsertPoint++) - { - CMenuItemInfo mi; - mi.fMask = MIIM_ID; - ::GetMenuItemInfo(m_hMenu, nInsertPoint, TRUE, &mi); - if (mi.wID == t_nFirstID) - break; - } - ATLASSERT(nInsertPoint < nItems && "You need a menu item with an ID = t_nFirstID"); - - int nItem; - for(nItem = t_nFirstID; nItem < t_nFirstID + m_nMaxEntries; nItem++) - { - // keep the first one as an insertion point - if (nItem != t_nFirstID) - ::DeleteMenu(m_hMenu, nItem, MF_BYCOMMAND); - } - - TCHAR szItemText[t_cchItemLen + 6] = { 0 }; // add space for &, 2 digits, and a space - int nSize = m_arrDocs.GetSize(); - nItem = 0; - if(nSize > 0) - { - for(nItem = 0; nItem < nSize; nItem++) - { - if(m_cchMaxItemLen == -1) - { - SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, m_arrDocs[nSize - 1 - nItem].szDocName); - } - else - { - TCHAR szBuff[t_cchItemLen] = { 0 }; - T* pT = static_cast(this); - pT; // avoid level 4 warning - bool bRet = pT->CompactDocumentName(szBuff, m_arrDocs[nSize - 1 - nItem].szDocName, m_cchMaxItemLen); - bRet; // avoid level 4 warning - ATLASSERT(bRet); - SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, szBuff); - } - ::InsertMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION | MF_STRING, t_nFirstID + nItem, szItemText); - } - } - else // empty - { - ::InsertMenu(m_hMenu, nInsertPoint, MF_BYPOSITION | MF_STRING, t_nFirstID, m_szNoEntries); - ::EnableMenuItem(m_hMenu, t_nFirstID, MF_GRAYED); - nItem++; - } - ::DeleteMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION); - - return TRUE; - } - -// Overrideables - // override to provide a different method of compacting document names - static bool CompactDocumentName(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) - { - return AtlCompactPath(lpstrOut, lpstrIn, cchLen); - } - - static LPCTSTR GetRegKeyName() - { - return _T("Recent Document List"); - } - - static LPCTSTR GetRegCountName() - { - return _T("DocumentCount"); - } - - static LPCTSTR GetRegItemName() - { - // Note: This string is a format string used with wsprintf(). - // Resulting formatted string must be m_cchItemNameLen or less - // characters long, including the terminating null character. - return _T("Document%i"); - } - - static LPCTSTR GetMRUEmptyText() - { - return _WTL_MRUEMPTY_TEXT; - } -}; - -class CRecentDocumentList : public CRecentDocumentListBase -{ -public: -// nothing here -}; - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFindFile - file search helper class - -class CFindFile -{ -public: -// Data members - WIN32_FIND_DATA m_fd; - TCHAR m_lpszRoot[MAX_PATH]; - TCHAR m_chDirSeparator; - HANDLE m_hFind; - BOOL m_bFound; - -// Constructor/destructor - CFindFile() : m_hFind(NULL), m_chDirSeparator(_T('\\')), m_bFound(FALSE) - { } - - ~CFindFile() - { - Close(); - } - -// Attributes - ULONGLONG GetFileSize() const - { - ATLASSERT(m_hFind != NULL); - - ULARGE_INTEGER nFileSize = { 0 }; - - if(m_bFound) - { - nFileSize.LowPart = m_fd.nFileSizeLow; - nFileSize.HighPart = m_fd.nFileSizeHigh; - } - else - { - nFileSize.QuadPart = 0; - } - - return nFileSize.QuadPart; - } - - BOOL GetFileName(LPTSTR lpstrFileName, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - if(lstrlen(m_fd.cFileName) >= cchLength) - return FALSE; - - if(m_bFound) - SecureHelper::strcpy_x(lpstrFileName, cchLength, m_fd.cFileName); - - return m_bFound; - } - - BOOL GetFilePath(LPTSTR lpstrFilePath, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - - int nLen = lstrlen(m_lpszRoot); -#ifndef _WIN32_WCE - ATLASSERT(nLen > 0); - if(nLen == 0) - return FALSE; - - bool bAddSep = (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/')); -#else // CE specific - // allow diskless devices (nLen == 0) - bool bAddSep = ((nLen == 0) || (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/'))); -#endif // _WIN32_WCE - - if((lstrlen(m_lpszRoot) + (bAddSep ? 1 : 0)) >= cchLength) - return FALSE; - - SecureHelper::strcpy_x(lpstrFilePath, cchLength, m_lpszRoot); - - if(bAddSep) - { - TCHAR szSeparator[2] = { m_chDirSeparator, 0 }; - SecureHelper::strcat_x(lpstrFilePath, cchLength, szSeparator); - } - - SecureHelper::strcat_x(lpstrFilePath, cchLength, m_fd.cFileName); - - return TRUE; - } - -#ifndef _WIN32_WCE - BOOL GetFileTitle(LPTSTR lpstrFileTitle, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - - TCHAR szBuff[MAX_PATH] = { 0 }; - if(!GetFileName(szBuff, MAX_PATH)) - return FALSE; - - if(lstrlen(szBuff) >= cchLength || cchLength < 1) - return FALSE; - - // find the last dot - LPTSTR pstrDot = (LPTSTR)_cstrrchr(szBuff, _T('.')); - if(pstrDot != NULL) - *pstrDot = 0; - - SecureHelper::strcpy_x(lpstrFileTitle, cchLength, szBuff); - - return TRUE; - } -#endif // !_WIN32_WCE - - BOOL GetFileURL(LPTSTR lpstrFileURL, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - - TCHAR szBuff[MAX_PATH] = { 0 }; - if(!GetFilePath(szBuff, MAX_PATH)) - return FALSE; - LPCTSTR lpstrFileURLPrefix = _T("file://"); - if(lstrlen(szBuff) + lstrlen(lpstrFileURLPrefix) >= cchLength) - return FALSE; - SecureHelper::strcpy_x(lpstrFileURL, cchLength, lpstrFileURLPrefix); - SecureHelper::strcat_x(lpstrFileURL, cchLength, szBuff); - - return TRUE; - } - - BOOL GetRoot(LPTSTR lpstrRoot, int cchLength) const - { - ATLASSERT(m_hFind != NULL); - if(lstrlen(m_lpszRoot) >= cchLength) - return FALSE; - - SecureHelper::strcpy_x(lpstrRoot, cchLength, m_lpszRoot); - - return TRUE; - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - _CSTRING_NS::CString GetFileName() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString ret; - - if(m_bFound) - ret = m_fd.cFileName; - return ret; - } - - _CSTRING_NS::CString GetFilePath() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString strResult = m_lpszRoot; - int nLen = strResult.GetLength(); -#ifndef _WIN32_WCE - ATLASSERT(nLen > 0); - if(nLen == 0) - return strResult; - - if((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/'))) -#else // CE specific - // allow diskless devices (nLen == 0) - if((nLen == 0) || ((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/')))) -#endif // _WIN32_WCE - strResult += m_chDirSeparator; - strResult += GetFileName(); - return strResult; - } - -#ifndef _WIN32_WCE - _CSTRING_NS::CString GetFileTitle() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString strResult; - GetFileTitle(strResult.GetBuffer(MAX_PATH), MAX_PATH); - strResult.ReleaseBuffer(); - - return strResult; - } -#endif // !_WIN32_WCE - - _CSTRING_NS::CString GetFileURL() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString strResult("file://"); - strResult += GetFilePath(); - return strResult; - } - - _CSTRING_NS::CString GetRoot() const - { - ATLASSERT(m_hFind != NULL); - - _CSTRING_NS::CString str = m_lpszRoot; - return str; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - BOOL GetLastWriteTime(FILETIME* pTimeStamp) const - { - ATLASSERT(m_hFind != NULL); - ATLASSERT(pTimeStamp != NULL); - - if(m_bFound && pTimeStamp != NULL) - { - *pTimeStamp = m_fd.ftLastWriteTime; - return TRUE; - } - - return FALSE; - } - - BOOL GetLastAccessTime(FILETIME* pTimeStamp) const - { - ATLASSERT(m_hFind != NULL); - ATLASSERT(pTimeStamp != NULL); - - if(m_bFound && pTimeStamp != NULL) - { - *pTimeStamp = m_fd.ftLastAccessTime; - return TRUE; - } - - return FALSE; - } - - BOOL GetCreationTime(FILETIME* pTimeStamp) const - { - ATLASSERT(m_hFind != NULL); - - if(m_bFound && pTimeStamp != NULL) - { - *pTimeStamp = m_fd.ftCreationTime; - return TRUE; - } - - return FALSE; - } - - BOOL MatchesMask(DWORD dwMask) const - { - ATLASSERT(m_hFind != NULL); - - if(m_bFound) - return ((m_fd.dwFileAttributes & dwMask) != 0); - - return FALSE; - } - - BOOL IsDots() const - { - ATLASSERT(m_hFind != NULL); - - // return TRUE if the file name is "." or ".." and - // the file is a directory - - BOOL bResult = FALSE; - if(m_bFound && IsDirectory()) - { - if(m_fd.cFileName[0] == _T('.') && (m_fd.cFileName[1] == _T('\0') || (m_fd.cFileName[1] == _T('.') && m_fd.cFileName[2] == _T('\0')))) - bResult = TRUE; - } - - return bResult; - } - - BOOL IsReadOnly() const - { - return MatchesMask(FILE_ATTRIBUTE_READONLY); - } - - BOOL IsDirectory() const - { - return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); - } - - BOOL IsCompressed() const - { - return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); - } - - BOOL IsSystem() const - { - return MatchesMask(FILE_ATTRIBUTE_SYSTEM); - } - - BOOL IsHidden() const - { - return MatchesMask(FILE_ATTRIBUTE_HIDDEN); - } - - BOOL IsTemporary() const - { - return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); - } - - BOOL IsNormal() const - { - return MatchesMask(FILE_ATTRIBUTE_NORMAL); - } - - BOOL IsArchived() const - { - return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); - } - -// Operations - BOOL FindFile(LPCTSTR pstrName = NULL) - { - Close(); - - if(pstrName == NULL) - { - pstrName = _T("*.*"); - } - else if(lstrlen(pstrName) >= MAX_PATH) - { - ATLASSERT(FALSE); - return FALSE; - } - - SecureHelper::strcpy_x(m_fd.cFileName, _countof(m_fd.cFileName), pstrName); - - m_hFind = ::FindFirstFile(pstrName, &m_fd); - - if(m_hFind == INVALID_HANDLE_VALUE) - return FALSE; - -#ifndef _WIN32_WCE - bool bFullPath = (::GetFullPathName(pstrName, MAX_PATH, m_lpszRoot, NULL) != 0); -#else // CE specific - errno_t nRet = SecureHelper::strncpy_x(m_lpszRoot, _countof(m_lpszRoot), pstrName, _TRUNCATE); - bool bFullPath = (nRet == 0 || nRet == STRUNCATE); -#endif // _WIN32_WCE - - // passed name isn't a valid path but was found by the API - ATLASSERT(bFullPath); - if(!bFullPath) - { - Close(); - ::SetLastError(ERROR_INVALID_NAME); - return FALSE; - } - else - { - // find the last forward or backward whack - LPTSTR pstrBack = (LPTSTR)_cstrrchr(m_lpszRoot, _T('\\')); - LPTSTR pstrFront = (LPTSTR)_cstrrchr(m_lpszRoot, _T('/')); - - if(pstrFront != NULL || pstrBack != NULL) - { - if(pstrFront == NULL) - pstrFront = m_lpszRoot; - if(pstrBack == NULL) - pstrBack = m_lpszRoot; - - // from the start to the last whack is the root - - if(pstrFront >= pstrBack) - *pstrFront = _T('\0'); - else - *pstrBack = _T('\0'); - } - } - - m_bFound = TRUE; - - return TRUE; - } - - BOOL FindNextFile() - { - ATLASSERT(m_hFind != NULL); - - if(m_hFind == NULL) - return FALSE; - - if(!m_bFound) - return FALSE; - - m_bFound = ::FindNextFile(m_hFind, &m_fd); - - return m_bFound; - } - - void Close() - { - m_bFound = FALSE; - - if(m_hFind != NULL && m_hFind != INVALID_HANDLE_VALUE) - { - ::FindClose(m_hFind); - m_hFind = NULL; - } - } - -// Helper - static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) - { -#ifdef _ATL_MIN_CRT - const TCHAR* lpsz = NULL; - while (*p != 0) - { - if (*p == ch) - lpsz = p; - p = ::CharNext(p); - } - return lpsz; -#else // !_ATL_MIN_CRT - return _tcsrchr(p, ch); -#endif // !_ATL_MIN_CRT - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Global functions for loading resources - -inline HACCEL AtlLoadAccelerators(ATL::_U_STRINGorID table) -{ - return ::LoadAccelerators(ModuleHelper::GetResourceInstance(), table.m_lpstr); -} - -inline HMENU AtlLoadMenu(ATL::_U_STRINGorID menu) -{ - return ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); -} - -inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap) -{ - return ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); -} - -#ifdef OEMRESOURCE -inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap) -{ -#ifdef _DEBUG - WORD wID = (WORD)bitmap.m_lpstr; - ATLASSERT(wID >= 32734 && wID <= 32767); -#endif // _DEBUG - return ::LoadBitmap(NULL, bitmap.m_lpstr); -} -#endif // OEMRESOURCE - -inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor) -{ - return ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); -} - -inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName) -{ -#if (WINVER >= 0x0500) - ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || - lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || - lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || - lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || - lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP || - lpCursorName == IDC_HAND); -#else // !(WINVER >= 0x0500) - ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || - lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || - lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || - lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || - lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP); -#endif // !(WINVER >= 0x0500) - return ::LoadCursor(NULL, lpCursorName); -} - -inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon) -{ - return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); -} - -#ifndef _WIN32_WCE -inline HICON AtlLoadSysIcon(LPCTSTR lpIconName) -{ -#if (WINVER >= 0x0600) - ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || - lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO || - lpIconName == IDI_SHIELD); -#else // !(WINVER >= 0x0600) - ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || - lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO); -#endif // !(WINVER >= 0x0600) - return ::LoadIcon(NULL, lpIconName); -} -#endif // !_WIN32_WCE - -inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR) -{ - return (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, IMAGE_BITMAP, 0, 0, fuLoad); -} - -inline HCURSOR AtlLoadCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ - return (HCURSOR)::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); -} - -inline HICON AtlLoadIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ - return (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); -} - -#ifdef OEMRESOURCE -inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR) -{ - ATLASSERT(wBitmapID >= 32734 && wBitmapID <= 32767); - ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file - return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad); -} -#endif // OEMRESOURCE - -inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ -#ifdef _DEBUG - WORD wID = (WORD)cursor.m_lpstr; - ATLASSERT((wID >= 32512 && wID <= 32516) || (wID >= 32640 && wID <= 32648) || (wID == 32650) || (wID == 32651)); - ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file -#endif // _DEBUG - return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); -} - -inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) -{ -#ifdef _DEBUG - WORD wID = (WORD)icon.m_lpstr; - ATLASSERT(wID >= 32512 && wID <= 32517); - ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file -#endif // _DEBUG - return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); -} - -#if (_ATL_VER < 0x0700) -inline int AtlLoadString(UINT uID, LPTSTR lpBuffer, int nBufferMax) -{ - return ::LoadString(_Module.GetResourceInstance(), uID, lpBuffer, nBufferMax); -} -#endif // (_ATL_VER < 0x0700) - -#ifdef _WIN32_WCE // CE only direct access to the resource -inline LPCTSTR AtlLoadString(UINT uID) -{ - LPCTSTR s = (LPCTSTR)::LoadString(ModuleHelper::GetResourceInstance(), uID, NULL, 0); -#ifdef DEBUG // Check for null-termination - if(s != NULL) - // Note: RC -n compiles null-terminated resource strings - ATLASSERT(s[*((WORD*)s -1) - 1] == L'\0'); -#endif - return s; -} -#endif // _WIN32_WCE - -inline bool AtlLoadString(UINT uID, BSTR& bstrText) -{ - USES_CONVERSION; - ATLASSERT(bstrText == NULL); - - LPTSTR lpstrText = NULL; - int nRes = 0; - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrText = new TCHAR[nLen]); - if(lpstrText == NULL) - break; - nRes = ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpstrText, nLen); - if(nRes < nLen - 1) - break; - delete [] lpstrText; - lpstrText = NULL; - } - - if(lpstrText != NULL) - { - if(nRes != 0) - bstrText = ::SysAllocString(T2OLE(lpstrText)); - delete [] lpstrText; - } - - return (bstrText != NULL) ? true : false; -} - - -/////////////////////////////////////////////////////////////////////////////// -// Global functions for stock GDI objects - -inline HPEN AtlGetStockPen(int nPen) -{ -#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); -#else - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); -#endif - return (HPEN)::GetStockObject(nPen); -} - -inline HBRUSH AtlGetStockBrush(int nBrush) -{ -#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) - ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); -#else - ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); -#endif - return (HBRUSH)::GetStockObject(nBrush); -} - -inline HFONT AtlGetStockFont(int nFont) -{ -#ifndef _WIN32_WCE - ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); -#else // CE specific - ATLASSERT(nFont == SYSTEM_FONT); -#endif // _WIN32_WCE - return (HFONT)::GetStockObject(nFont); -} - -inline HPALETTE AtlGetStockPalette(int nPalette) -{ - ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported - return (HPALETTE)::GetStockObject(nPalette); -} - - -/////////////////////////////////////////////////////////////////////////////// -// Global function for compacting a path by replacing parts with ellipsis - -// helper for multi-byte character sets -inline bool _IsDBCSTrailByte(LPCTSTR lpstr, int nChar) -{ -#ifndef _UNICODE - int i = nChar; - for( ; i > 0; i--) - { - if(!::IsDBCSLeadByte(lpstr[i - 1])) - break; - } - return ((nChar > 0) && (((nChar - i) & 1) != 0)); -#else // _UNICODE - lpstr; nChar; - return false; -#endif // _UNICODE -} - -inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) -{ - ATLASSERT(lpstrOut != NULL); - ATLASSERT(lpstrIn != NULL); - ATLASSERT(cchLen > 0); - - LPCTSTR szEllipsis = _T("..."); - const int cchEndEllipsis = 3; - const int cchMidEllipsis = 4; - - if(lstrlen(lpstrIn) < cchLen) - { - SecureHelper::strcpy_x(lpstrOut, cchLen, lpstrIn); - return true; - } - - lpstrOut[0] = 0; - - // check if the separator is a slash or a backslash - TCHAR chSlash = _T('\\'); - for(LPTSTR lpstr = (LPTSTR)lpstrIn; *lpstr != 0; lpstr = ::CharNext(lpstr)) - { - if((*lpstr == _T('/')) || (*lpstr == _T('\\'))) - chSlash = *lpstr; - } - - // find the filename portion of the path - LPCTSTR lpstrFileName = lpstrIn; - for(LPCTSTR pPath = lpstrIn; *pPath; pPath = ::CharNext(pPath)) - { - if((pPath[0] == _T('\\') || pPath[0] == _T(':') || pPath[0] == _T('/')) - && pPath[1] && pPath[1] != _T('\\') && pPath[1] != _T('/')) - lpstrFileName = pPath + 1; - } - int cchFileName = lstrlen(lpstrFileName); - - // handle just the filename without a path - if(lpstrFileName == lpstrIn && cchLen > cchEndEllipsis) - { - bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchLen - cchEndEllipsis - 1) == 0); - if(bRet) - { -#ifndef _UNICODE - if(_IsDBCSTrailByte(lpstrIn, cchLen - cchEndEllipsis)) - lpstrOut[cchLen - cchEndEllipsis - 1] = 0; -#endif // _UNICODE - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - } - return bRet; - } - - // handle just ellipsis - if((cchLen < (cchMidEllipsis + cchEndEllipsis))) - { - for(int i = 0; i < cchLen - 1; i++) - lpstrOut[i] = ((i + 1) == cchMidEllipsis) ? chSlash : _T('.'); - lpstrOut[cchLen - 1] = 0; - return true; - } - - // calc how much we have to copy - int cchToCopy = cchLen - (cchMidEllipsis + cchFileName) - 1; - - if(cchToCopy < 0) - cchToCopy = 0; - -#ifndef _UNICODE - if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrIn, cchToCopy)) - cchToCopy--; -#endif // _UNICODE - - bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchToCopy) == 0); - if(!bRet) - return false; - - // add ellipsis - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - if(!bRet) - return false; - TCHAR szSlash[2] = { chSlash, 0 }; - SecureHelper::strcat_x(lpstrOut, cchLen, szSlash); - if(!bRet) - return false; - - // add filename (and ellipsis, if needed) - if(cchLen > (cchMidEllipsis + cchFileName)) - { - SecureHelper::strcat_x(lpstrOut, cchLen, lpstrFileName); - } - else - { - cchToCopy = cchLen - cchMidEllipsis - cchEndEllipsis - 1; -#ifndef _UNICODE - if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrFileName, cchToCopy)) - cchToCopy--; -#endif // _UNICODE - bRet = (SecureHelper::strncpy_x(&lpstrOut[cchMidEllipsis], cchLen - cchMidEllipsis, lpstrFileName, cchToCopy) == 0); - if(bRet) - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - } - - return bRet; -} - -}; // namespace WTL - -#endif // __ATLMISC_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLMISC_H__ +#define __ATLMISC_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlmisc.h requires atlapp.h to be included first +#endif + + +#ifdef _ATL_TMP_NO_CSTRING + #define _WTL_NO_CSTRING +#endif + +#if defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) + #error Conflicting options - both _WTL_USE_CSTRING and _WTL_NO_CSTRING are defined +#endif // defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) + +#if !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) + #define _WTL_USE_CSTRING +#endif // !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) + +#ifndef _WTL_NO_CSTRING + #if defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) + #error Cannot use CString floating point formatting with _ATL_MIN_CRT defined + #endif // defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) +#endif // !_WTL_NO_CSTRING + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CSize +// CPoint +// CRect +// CString +// +// CRecentDocumentListBase +// CRecentDocumentList +// CFindFile +// +// Global functions: +// AtlLoadAccelerators() +// AtlLoadMenu() +// AtlLoadBitmap() +// AtlLoadSysBitmap() +// AtlLoadCursor() +// AtlLoadSysCursor() +// AtlLoadIcon() +// AtlLoadSysIcon() +// AtlLoadBitmapImage() +// AtlLoadCursorImage() +// AtlLoadIconImage() +// AtlLoadSysBitmapImage() +// AtlLoadSysCursorImage() +// AtlLoadSysIconImage() +// AtlLoadString() +// +// AtlGetStockPen() +// AtlGetStockBrush() +// AtlGetStockFont() +// AtlGetStockPalette() +// +// AtlCompactPath() + + +namespace WTL +{ + +#ifndef _WTL_NO_WTYPES + +// forward declarations +class CSize; +class CPoint; +class CRect; + +/////////////////////////////////////////////////////////////////////////////// +// CSize - Wrapper for Windows SIZE structure. + +class CSize : public SIZE +{ +public: +// Constructors + CSize() + { + cx = 0; + cy = 0; + } + + CSize(int initCX, int initCY) + { + cx = initCX; + cy = initCY; + } + + CSize(SIZE initSize) + { + *(SIZE*)this = initSize; + } + + CSize(POINT initPt) + { + *(POINT*)this = initPt; + } + + CSize(DWORD dwSize) + { + cx = (short)LOWORD(dwSize); + cy = (short)HIWORD(dwSize); + } + +// Operations + BOOL operator ==(SIZE size) const + { + return (cx == size.cx && cy == size.cy); + } + + BOOL operator !=(SIZE size) const + { + return (cx != size.cx || cy != size.cy); + } + + void operator +=(SIZE size) + { + cx += size.cx; + cy += size.cy; + } + + void operator -=(SIZE size) + { + cx -= size.cx; + cy -= size.cy; + } + + void SetSize(int CX, int CY) + { + cx = CX; + cy = CY; + } + +// Operators returning CSize values + CSize operator +(SIZE size) const + { + return CSize(cx + size.cx, cy + size.cy); + } + + CSize operator -(SIZE size) const + { + return CSize(cx - size.cx, cy - size.cy); + } + + CSize operator -() const + { + return CSize(-cx, -cy); + } + +// Operators returning CPoint values + CPoint operator +(POINT point) const; + CPoint operator -(POINT point) const; + +// Operators returning CRect values + CRect operator +(const RECT* lpRect) const; + CRect operator -(const RECT* lpRect) const; +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPoint - Wrapper for Windows POINT structure. + +class CPoint : public POINT +{ +public: +// Constructors + CPoint() + { + x = 0; + y = 0; + } + + CPoint(int initX, int initY) + { + x = initX; + y = initY; + } + + CPoint(POINT initPt) + { + *(POINT*)this = initPt; + } + + CPoint(SIZE initSize) + { + *(SIZE*)this = initSize; + } + + CPoint(DWORD dwPoint) + { + x = (short)LOWORD(dwPoint); + y = (short)HIWORD(dwPoint); + } + +// Operations + void Offset(int xOffset, int yOffset) + { + x += xOffset; + y += yOffset; + } + + void Offset(POINT point) + { + x += point.x; + y += point.y; + } + + void Offset(SIZE size) + { + x += size.cx; + y += size.cy; + } + + BOOL operator ==(POINT point) const + { + return (x == point.x && y == point.y); + } + + BOOL operator !=(POINT point) const + { + return (x != point.x || y != point.y); + } + + void operator +=(SIZE size) + { + x += size.cx; + y += size.cy; + } + + void operator -=(SIZE size) + { + x -= size.cx; + y -= size.cy; + } + + void operator +=(POINT point) + { + x += point.x; + y += point.y; + } + + void operator -=(POINT point) + { + x -= point.x; + y -= point.y; + } + + void SetPoint(int X, int Y) + { + x = X; + y = Y; + } + +// Operators returning CPoint values + CPoint operator +(SIZE size) const + { + return CPoint(x + size.cx, y + size.cy); + } + + CPoint operator -(SIZE size) const + { + return CPoint(x - size.cx, y - size.cy); + } + + CPoint operator -() const + { + return CPoint(-x, -y); + } + + CPoint operator +(POINT point) const + { + return CPoint(x + point.x, y + point.y); + } + +// Operators returning CSize values + CSize operator -(POINT point) const + { + return CSize(x - point.x, y - point.y); + } + +// Operators returning CRect values + CRect operator +(const RECT* lpRect) const; + CRect operator -(const RECT* lpRect) const; +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CRect - Wrapper for Windows RECT structure. + +class CRect : public RECT +{ +public: +// Constructors + CRect() + { + left = 0; + top = 0; + right = 0; + bottom = 0; + } + + CRect(int l, int t, int r, int b) + { + left = l; + top = t; + right = r; + bottom = b; + } + + CRect(const RECT& srcRect) + { + ::CopyRect(this, &srcRect); + } + + CRect(LPCRECT lpSrcRect) + { + ::CopyRect(this, lpSrcRect); + } + + CRect(POINT point, SIZE size) + { + right = (left = point.x) + size.cx; + bottom = (top = point.y) + size.cy; + } + + CRect(POINT topLeft, POINT bottomRight) + { + left = topLeft.x; + top = topLeft.y; + right = bottomRight.x; + bottom = bottomRight.y; + } + +// Attributes (in addition to RECT members) + int Width() const + { + return right - left; + } + + int Height() const + { + return bottom - top; + } + + CSize Size() const + { + return CSize(right - left, bottom - top); + } + + CPoint& TopLeft() + { + return *((CPoint*)this); + } + + CPoint& BottomRight() + { + return *((CPoint*)this + 1); + } + + const CPoint& TopLeft() const + { + return *((CPoint*)this); + } + + const CPoint& BottomRight() const + { + return *((CPoint*)this + 1); + } + + CPoint CenterPoint() const + { + return CPoint((left + right) / 2, (top + bottom) / 2); + } + + // convert between CRect and LPRECT/LPCRECT (no need for &) + operator LPRECT() + { + return this; + } + + operator LPCRECT() const + { + return this; + } + + BOOL IsRectEmpty() const + { + return ::IsRectEmpty(this); + } + + BOOL IsRectNull() const + { + return (left == 0 && right == 0 && top == 0 && bottom == 0); + } + + BOOL PtInRect(POINT point) const + { + return ::PtInRect(this, point); + } + +// Operations + void SetRect(int x1, int y1, int x2, int y2) + { + ::SetRect(this, x1, y1, x2, y2); + } + + void SetRect(POINT topLeft, POINT bottomRight) + { + ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); + } + + void SetRectEmpty() + { + ::SetRectEmpty(this); + } + + void CopyRect(LPCRECT lpSrcRect) + { + ::CopyRect(this, lpSrcRect); + } + + BOOL EqualRect(LPCRECT lpRect) const + { + return ::EqualRect(this, lpRect); + } + + void InflateRect(int x, int y) + { + ::InflateRect(this, x, y); + } + + void InflateRect(SIZE size) + { + ::InflateRect(this, size.cx, size.cy); + } + + void InflateRect(LPCRECT lpRect) + { + left -= lpRect->left; + top -= lpRect->top; + right += lpRect->right; + bottom += lpRect->bottom; + } + + void InflateRect(int l, int t, int r, int b) + { + left -= l; + top -= t; + right += r; + bottom += b; + } + + void DeflateRect(int x, int y) + { + ::InflateRect(this, -x, -y); + } + + void DeflateRect(SIZE size) + { + ::InflateRect(this, -size.cx, -size.cy); + } + + void DeflateRect(LPCRECT lpRect) + { + left += lpRect->left; + top += lpRect->top; + right -= lpRect->right; + bottom -= lpRect->bottom; + } + + void DeflateRect(int l, int t, int r, int b) + { + left += l; + top += t; + right -= r; + bottom -= b; + } + + void OffsetRect(int x, int y) + { + ::OffsetRect(this, x, y); + } + void OffsetRect(SIZE size) + { + ::OffsetRect(this, size.cx, size.cy); + } + + void OffsetRect(POINT point) + { + ::OffsetRect(this, point.x, point.y); + } + + void NormalizeRect() + { + int nTemp; + if (left > right) + { + nTemp = left; + left = right; + right = nTemp; + } + if (top > bottom) + { + nTemp = top; + top = bottom; + bottom = nTemp; + } + } + + // absolute position of rectangle + void MoveToY(int y) + { + bottom = Height() + y; + top = y; + } + + void MoveToX(int x) + { + right = Width() + x; + left = x; + } + + void MoveToXY(int x, int y) + { + MoveToX(x); + MoveToY(y); + } + + void MoveToXY(POINT pt) + { + MoveToX(pt.x); + MoveToY(pt.y); + } + + // operations that fill '*this' with result + BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2) + { + return ::IntersectRect(this, lpRect1, lpRect2); + } + + BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2) + { + return ::UnionRect(this, lpRect1, lpRect2); + } + + BOOL SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2) + { + return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); + } + +// Additional Operations + void operator =(const RECT& srcRect) + { + ::CopyRect(this, &srcRect); + } + + BOOL operator ==(const RECT& rect) const + { + return ::EqualRect(this, &rect); + } + + BOOL operator !=(const RECT& rect) const + { + return !::EqualRect(this, &rect); + } + + void operator +=(POINT point) + { + ::OffsetRect(this, point.x, point.y); + } + + void operator +=(SIZE size) + { + ::OffsetRect(this, size.cx, size.cy); + } + + void operator +=(LPCRECT lpRect) + { + InflateRect(lpRect); + } + + void operator -=(POINT point) + { + ::OffsetRect(this, -point.x, -point.y); + } + + void operator -=(SIZE size) + { + ::OffsetRect(this, -size.cx, -size.cy); + } + + void operator -=(LPCRECT lpRect) + { + DeflateRect(lpRect); + } + + void operator &=(const RECT& rect) + { + ::IntersectRect(this, this, &rect); + } + + void operator |=(const RECT& rect) + { + ::UnionRect(this, this, &rect); + } + +// Operators returning CRect values + CRect operator +(POINT pt) const + { + CRect rect(*this); + ::OffsetRect(&rect, pt.x, pt.y); + return rect; + } + + CRect operator -(POINT pt) const + { + CRect rect(*this); + ::OffsetRect(&rect, -pt.x, -pt.y); + return rect; + } + + CRect operator +(LPCRECT lpRect) const + { + CRect rect(this); + rect.InflateRect(lpRect); + return rect; + } + + CRect operator +(SIZE size) const + { + CRect rect(*this); + ::OffsetRect(&rect, size.cx, size.cy); + return rect; + } + + CRect operator -(SIZE size) const + { + CRect rect(*this); + ::OffsetRect(&rect, -size.cx, -size.cy); + return rect; + } + + CRect operator -(LPCRECT lpRect) const + { + CRect rect(this); + rect.DeflateRect(lpRect); + return rect; + } + + CRect operator &(const RECT& rect2) const + { + CRect rect; + ::IntersectRect(&rect, this, &rect2); + return rect; + } + + CRect operator |(const RECT& rect2) const + { + CRect rect; + ::UnionRect(&rect, this, &rect2); + return rect; + } + + CRect MulDiv(int nMultiplier, int nDivisor) const + { + return CRect( + ::MulDiv(left, nMultiplier, nDivisor), + ::MulDiv(top, nMultiplier, nDivisor), + ::MulDiv(right, nMultiplier, nDivisor), + ::MulDiv(bottom, nMultiplier, nDivisor)); + } +}; + + +// CSize implementation + +inline CPoint CSize::operator +(POINT point) const +{ return CPoint(cx + point.x, cy + point.y); } + +inline CPoint CSize::operator -(POINT point) const +{ return CPoint(cx - point.x, cy - point.y); } + +inline CRect CSize::operator +(const RECT* lpRect) const +{ return CRect(lpRect) + *this; } + +inline CRect CSize::operator -(const RECT* lpRect) const +{ return CRect(lpRect) - *this; } + + +// CPoint implementation + +inline CRect CPoint::operator +(const RECT* lpRect) const +{ return CRect(lpRect) + *this; } + +inline CRect CPoint::operator -(const RECT* lpRect) const +{ return CRect(lpRect) - *this; } + +#endif // !_WTL_NO_WTYPES + + +// WTL::CSize or ATL::CSize scalar operators + +#if !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) + +template +inline CSize operator *(SIZE s, Num n) +{ + return CSize((int)(s.cx * n), (int)(s.cy * n)); +}; + +template +inline void operator *=(SIZE & s, Num n) +{ + s = s * n; +}; + +template +inline CSize operator /(SIZE s, Num n) +{ + return CSize((int)(s.cx / n), (int)(s.cy / n)); +}; + +template +inline void operator /=(SIZE & s, Num n) +{ + s = s / n; +}; + +#endif // !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) + + +/////////////////////////////////////////////////////////////////////////////// +// CString - String class + +#ifndef _WTL_NO_CSTRING + +struct CStringData +{ + long nRefs; // reference count + int nDataLength; + int nAllocLength; + // TCHAR data[nAllocLength] + + TCHAR* data() + { return (TCHAR*)(this + 1); } +}; + +// Globals + +// For an empty string, m_pchData will point here +// (note: avoids special case of checking for NULL m_pchData) +// empty string data (and locked) +_declspec(selectany) int rgInitData[] = { -1, 0, 0, 0 }; +_declspec(selectany) CStringData* _atltmpDataNil = (CStringData*)&rgInitData; +_declspec(selectany) LPCTSTR _atltmpPchNil = (LPCTSTR)(((BYTE*)&rgInitData) + sizeof(CStringData)); + + +class CString +{ +public: +// Constructors + CString() + { + Init(); + } + + CString(const CString& stringSrc) + { + ATLASSERT(stringSrc.GetData()->nRefs != 0); + if (stringSrc.GetData()->nRefs >= 0) + { + ATLASSERT(stringSrc.GetData() != _atltmpDataNil); + m_pchData = stringSrc.m_pchData; + InterlockedIncrement(&GetData()->nRefs); + } + else + { + Init(); + *this = stringSrc.m_pchData; + } + } + + CString(TCHAR ch, int nRepeat = 1) + { + ATLASSERT(!_istlead(ch)); // can't create a lead byte string + Init(); + if (nRepeat >= 1) + { + if(AllocBuffer(nRepeat)) + { +#ifdef _UNICODE + for (int i = 0; i < nRepeat; i++) + m_pchData[i] = ch; +#else + memset(m_pchData, ch, nRepeat); +#endif + } + } + } + + CString(LPCTSTR lpsz) + { + Init(); + if (lpsz != NULL && HIWORD(lpsz) == NULL) + { + UINT nID = LOWORD((DWORD_PTR)lpsz); + if (!LoadString(nID)) + ATLTRACE2(atlTraceUI, 0, _T("Warning: implicit LoadString(%u) in CString failed\n"), nID); + } + else + { + int nLen = SafeStrlen(lpsz); + if (nLen != 0) + { + if(AllocBuffer(nLen)) + SecureHelper::memcpy_x(m_pchData, (nLen + 1) * sizeof(TCHAR), lpsz, nLen * sizeof(TCHAR)); + } + } + } + +#ifdef _UNICODE + CString(LPCSTR lpsz) + { + Init(); +#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) + int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; +#else + int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; +#endif + if (nSrcLen != 0) + { + if(AllocBuffer(nSrcLen)) + { + _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); + ReleaseBuffer(); + } + } + } +#else // !_UNICODE + CString(LPCWSTR lpsz) + { + Init(); + int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; + if (nSrcLen != 0) + { + if(AllocBuffer(nSrcLen * 2)) + { + _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); + ReleaseBuffer(); + } + } + } +#endif // !_UNICODE + + CString(LPCTSTR lpch, int nLength) + { + Init(); + if (nLength != 0) + { + if(AllocBuffer(nLength)) + SecureHelper::memcpy_x(m_pchData, (nLength + 1) * sizeof(TCHAR), lpch, nLength * sizeof(TCHAR)); + } + } + +#ifdef _UNICODE + CString(LPCSTR lpsz, int nLength) + { + Init(); + if (nLength != 0) + { + if(AllocBuffer(nLength)) + { + int n = ::MultiByteToWideChar(CP_ACP, 0, lpsz, nLength, m_pchData, nLength + 1); + ReleaseBuffer((n >= 0) ? n : -1); + } + } + } +#else // !_UNICODE + CString(LPCWSTR lpsz, int nLength) + { + Init(); + if (nLength != 0) + { + if(((nLength * 2) > nLength) && AllocBuffer(nLength * 2)) + { + int n = ::WideCharToMultiByte(CP_ACP, 0, lpsz, nLength, m_pchData, (nLength * 2) + 1, NULL, NULL); + ReleaseBuffer((n >= 0) ? n : -1); + } + } + } +#endif // !_UNICODE + + CString(const unsigned char* lpsz) + { + Init(); + *this = (LPCSTR)lpsz; + } + +// Attributes & Operations + int GetLength() const // as an array of characters + { + return GetData()->nDataLength; + } + + BOOL IsEmpty() const + { + return GetData()->nDataLength == 0; + } + + void Empty() // free up the data + { + if (GetData()->nDataLength == 0) + return; + + if (GetData()->nRefs >= 0) + Release(); + else + *this = _T(""); + + ATLASSERT(GetData()->nDataLength == 0); + ATLASSERT(GetData()->nRefs < 0 || GetData()->nAllocLength == 0); + } + + TCHAR GetAt(int nIndex) const // 0 based + { + ATLASSERT(nIndex >= 0); + ATLASSERT(nIndex < GetData()->nDataLength); + return m_pchData[nIndex]; + } + + TCHAR operator [](int nIndex) const // same as GetAt + { + // same as GetAt + ATLASSERT(nIndex >= 0); + ATLASSERT(nIndex < GetData()->nDataLength); + return m_pchData[nIndex]; + } + + void SetAt(int nIndex, TCHAR ch) + { + ATLASSERT(nIndex >= 0); + ATLASSERT(nIndex < GetData()->nDataLength); + + CopyBeforeWrite(); + m_pchData[nIndex] = ch; + } + + operator LPCTSTR() const // as a C string + { + return m_pchData; + } + + // overloaded assignment + CString& operator =(const CString& stringSrc) + { + if (m_pchData != stringSrc.m_pchData) + { + if ((GetData()->nRefs < 0 && GetData() != _atltmpDataNil) || stringSrc.GetData()->nRefs < 0) + { + // actual copy necessary since one of the strings is locked + AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData); + } + else + { + // can just copy references around + Release(); + ATLASSERT(stringSrc.GetData() != _atltmpDataNil); + m_pchData = stringSrc.m_pchData; + InterlockedIncrement(&GetData()->nRefs); + } + } + return *this; + } + + CString& operator =(TCHAR ch) + { + ATLASSERT(!_istlead(ch)); // can't set single lead byte + AssignCopy(1, &ch); + return *this; + } + +#ifdef _UNICODE + CString& operator =(char ch) + { + *this = (TCHAR)ch; + return *this; + } +#endif + + CString& operator =(LPCTSTR lpsz) + { + ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); + AssignCopy(SafeStrlen(lpsz), lpsz); + return *this; + } + +#ifdef _UNICODE + CString& operator =(LPCSTR lpsz) + { +#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) + int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; +#else + int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; +#endif + if(AllocBeforeWrite(nSrcLen)) + { + _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); + ReleaseBuffer(); + } + return *this; + } +#else // !_UNICODE + CString& operator =(LPCWSTR lpsz) + { + int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; + if(AllocBeforeWrite(nSrcLen * 2)) + { + _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); + ReleaseBuffer(); + } + return *this; + } +#endif // !_UNICODE + + CString& operator =(const unsigned char* lpsz) + { + *this = (LPCSTR)lpsz; + return *this; + } + + // string concatenation + CString& operator +=(const CString& string) + { + ConcatInPlace(string.GetData()->nDataLength, string.m_pchData); + return *this; + } + + CString& operator +=(TCHAR ch) + { + ConcatInPlace(1, &ch); + return *this; + } + +#ifdef _UNICODE + CString& operator +=(char ch) + { + *this += (TCHAR)ch; + return *this; + } +#endif + + CString& operator +=(LPCTSTR lpsz) + { + ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); + ConcatInPlace(SafeStrlen(lpsz), lpsz); + return *this; + } + + friend CString __stdcall operator +(const CString& string1, const CString& string2); + friend CString __stdcall operator +(const CString& string, TCHAR ch); + friend CString __stdcall operator +(TCHAR ch, const CString& string); +#ifdef _UNICODE + friend CString __stdcall operator +(const CString& string, char ch); + friend CString __stdcall operator +(char ch, const CString& string); +#endif + friend CString __stdcall operator +(const CString& string, LPCTSTR lpsz); + friend CString __stdcall operator +(LPCTSTR lpsz, const CString& string); + + // string comparison + int Compare(LPCTSTR lpsz) const // straight character (MBCS/Unicode aware) + { + return _cstrcmp(m_pchData, lpsz); + } + + int CompareNoCase(LPCTSTR lpsz) const // ignore case (MBCS/Unicode aware) + { + return _cstrcmpi(m_pchData, lpsz); + } + +#ifndef _WIN32_WCE + // CString::Collate is often slower than Compare but is MBSC/Unicode + // aware as well as locale-sensitive with respect to sort order. + int Collate(LPCTSTR lpsz) const // NLS aware + { + return _cstrcoll(m_pchData, lpsz); + } + + int CollateNoCase(LPCTSTR lpsz) const // ignore case + { + return _cstrcolli(m_pchData, lpsz); + } +#endif // !_WIN32_WCE + + // simple sub-string extraction + CString Mid(int nFirst, int nCount) const + { + // out-of-bounds requests return sensible things + if (nFirst < 0) + nFirst = 0; + if (nCount < 0) + nCount = 0; + + if (nFirst + nCount > GetData()->nDataLength) + nCount = GetData()->nDataLength - nFirst; + if (nFirst > GetData()->nDataLength) + nCount = 0; + + CString dest; + AllocCopy(dest, nCount, nFirst, 0); + return dest; + } + + CString Mid(int nFirst) const + { + return Mid(nFirst, GetData()->nDataLength - nFirst); + } + + CString Left(int nCount) const + { + if (nCount < 0) + nCount = 0; + else if (nCount > GetData()->nDataLength) + nCount = GetData()->nDataLength; + + CString dest; + AllocCopy(dest, nCount, 0, 0); + return dest; + } + + CString Right(int nCount) const + { + if (nCount < 0) + nCount = 0; + else if (nCount > GetData()->nDataLength) + nCount = GetData()->nDataLength; + + CString dest; + AllocCopy(dest, nCount, GetData()->nDataLength-nCount, 0); + return dest; + } + + CString SpanIncluding(LPCTSTR lpszCharSet) const // strspn equivalent + { + ATLASSERT(_IsValidString(lpszCharSet)); + return Left(_cstrspn(m_pchData, lpszCharSet)); + } + + CString SpanExcluding(LPCTSTR lpszCharSet) const // strcspn equivalent + { + ATLASSERT(_IsValidString(lpszCharSet)); + return Left(_cstrcspn(m_pchData, lpszCharSet)); + } + + // upper/lower/reverse conversion + void MakeUpper() + { + CopyBeforeWrite(); + CharUpper(m_pchData); + } + + void MakeLower() + { + CopyBeforeWrite(); + CharLower(m_pchData); + } + + void MakeReverse() + { + CopyBeforeWrite(); + _cstrrev(m_pchData); + } + + // trimming whitespace (either side) + void TrimRight() + { + CopyBeforeWrite(); + + // find beginning of trailing spaces by starting at beginning (DBCS aware) + LPTSTR lpsz = m_pchData; + LPTSTR lpszLast = NULL; + while (*lpsz != _T('\0')) + { + if (_cstrisspace(*lpsz)) + { + if (lpszLast == NULL) + lpszLast = lpsz; + } + else + { + lpszLast = NULL; + } + lpsz = ::CharNext(lpsz); + } + + if (lpszLast != NULL) + { + // truncate at trailing space start + *lpszLast = _T('\0'); + GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); + } + } + + void TrimLeft() + { + CopyBeforeWrite(); + + // find first non-space character + LPCTSTR lpsz = m_pchData; + while (_cstrisspace(*lpsz)) + lpsz = ::CharNext(lpsz); + + // fix up data and length + int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); + SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); + GetData()->nDataLength = nDataLength; + } + + // remove continuous occurrences of chTarget starting from right + void TrimRight(TCHAR chTarget) + { + // find beginning of trailing matches + // by starting at beginning (DBCS aware) + + CopyBeforeWrite(); + LPTSTR lpsz = m_pchData; + LPTSTR lpszLast = NULL; + + while (*lpsz != _T('\0')) + { + if (*lpsz == chTarget) + { + if (lpszLast == NULL) + lpszLast = lpsz; + } + else + lpszLast = NULL; + lpsz = ::CharNext(lpsz); + } + + if (lpszLast != NULL) + { + // truncate at left-most matching character + *lpszLast = _T('\0'); + GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); + } + } + + // remove continuous occcurrences of characters in passed string, starting from right + void TrimRight(LPCTSTR lpszTargetList) + { + // find beginning of trailing matches by starting at beginning (DBCS aware) + + CopyBeforeWrite(); + LPTSTR lpsz = m_pchData; + LPTSTR lpszLast = NULL; + + while (*lpsz != _T('\0')) + { + TCHAR* pNext = ::CharNext(lpsz); + if(pNext > lpsz + 1) + { + if (_cstrchr_db(lpszTargetList, *lpsz, *(lpsz + 1)) != NULL) + { + if (lpszLast == NULL) + lpszLast = lpsz; + } + else + { + lpszLast = NULL; + } + } + else + { + if (_cstrchr(lpszTargetList, *lpsz) != NULL) + { + if (lpszLast == NULL) + lpszLast = lpsz; + } + else + { + lpszLast = NULL; + } + } + + lpsz = pNext; + } + + if (lpszLast != NULL) + { + // truncate at left-most matching character + *lpszLast = _T('\0'); + GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); + } + } + + // remove continuous occurrences of chTarget starting from left + void TrimLeft(TCHAR chTarget) + { + // find first non-matching character + + CopyBeforeWrite(); + LPCTSTR lpsz = m_pchData; + + while (chTarget == *lpsz) + lpsz = ::CharNext(lpsz); + + if (lpsz != m_pchData) + { + // fix up data and length + int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); + SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); + GetData()->nDataLength = nDataLength; + } + } + + // remove continuous occcurrences of characters in passed string, starting from left + void TrimLeft(LPCTSTR lpszTargets) + { + // if we're not trimming anything, we're not doing any work + if (SafeStrlen(lpszTargets) == 0) + return; + + CopyBeforeWrite(); + LPCTSTR lpsz = m_pchData; + + while (*lpsz != _T('\0')) + { + TCHAR* pNext = ::CharNext(lpsz); + if(pNext > lpsz + 1) + { + if (_cstrchr_db(lpszTargets, *lpsz, *(lpsz + 1)) == NULL) + break; + } + else + { + if (_cstrchr(lpszTargets, *lpsz) == NULL) + break; + } + lpsz = pNext; + } + + if (lpsz != m_pchData) + { + // fix up data and length + int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); + SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); + GetData()->nDataLength = nDataLength; + } + } + + // advanced manipulation + // replace occurrences of chOld with chNew + int Replace(TCHAR chOld, TCHAR chNew) + { + int nCount = 0; + + // short-circuit the nop case + if (chOld != chNew) + { + // otherwise modify each character that matches in the string + CopyBeforeWrite(); + LPTSTR psz = m_pchData; + LPTSTR pszEnd = psz + GetData()->nDataLength; + while (psz < pszEnd) + { + // replace instances of the specified character only + if (*psz == chOld) + { + *psz = chNew; + nCount++; + } + psz = ::CharNext(psz); + } + } + return nCount; + } + + // replace occurrences of substring lpszOld with lpszNew; + // empty lpszNew removes instances of lpszOld + int Replace(LPCTSTR lpszOld, LPCTSTR lpszNew) + { + // can't have empty or NULL lpszOld + + int nSourceLen = SafeStrlen(lpszOld); + if (nSourceLen == 0) + return 0; + int nReplacementLen = SafeStrlen(lpszNew); + + // loop once to figure out the size of the result string + int nCount = 0; + LPTSTR lpszStart = m_pchData; + LPTSTR lpszEnd = m_pchData + GetData()->nDataLength; + LPTSTR lpszTarget = NULL; + while (lpszStart < lpszEnd) + { + while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) + { + nCount++; + lpszStart = lpszTarget + nSourceLen; + } + lpszStart += lstrlen(lpszStart) + 1; + } + + // if any changes were made, make them + if (nCount > 0) + { + CopyBeforeWrite(); + + // if the buffer is too small, just allocate a new buffer (slow but sure) + int nOldLength = GetData()->nDataLength; + int nNewLength = nOldLength + (nReplacementLen - nSourceLen) * nCount; + if (GetData()->nAllocLength < nNewLength || GetData()->nRefs > 1) + { + CStringData* pOldData = GetData(); + LPTSTR pstr = m_pchData; + if(!AllocBuffer(nNewLength)) + return -1; + SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, pOldData->nDataLength * sizeof(TCHAR)); + CString::Release(pOldData); + } + // else, we just do it in-place + lpszStart = m_pchData; + lpszEnd = m_pchData + GetData()->nDataLength; + + // loop again to actually do the work + while (lpszStart < lpszEnd) + { + while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) + { + int nBalance = nOldLength - ((int)(DWORD_PTR)(lpszTarget - m_pchData) + nSourceLen); + int cchBuffLen = GetData()->nAllocLength - (int)(DWORD_PTR)(lpszTarget - m_pchData); + SecureHelper::memmove_x(lpszTarget + nReplacementLen, (cchBuffLen - nReplacementLen + 1) * sizeof(TCHAR), lpszTarget + nSourceLen, nBalance * sizeof(TCHAR)); + SecureHelper::memcpy_x(lpszTarget, (cchBuffLen + 1) * sizeof(TCHAR), lpszNew, nReplacementLen * sizeof(TCHAR)); + lpszStart = lpszTarget + nReplacementLen; + lpszStart[nBalance] = _T('\0'); + nOldLength += (nReplacementLen - nSourceLen); + } + lpszStart += lstrlen(lpszStart) + 1; + } + ATLASSERT(m_pchData[nNewLength] == _T('\0')); + GetData()->nDataLength = nNewLength; + } + + return nCount; + } + + // remove occurrences of chRemove + int Remove(TCHAR chRemove) + { + CopyBeforeWrite(); + + LPTSTR pstrSource = m_pchData; + LPTSTR pstrDest = m_pchData; + LPTSTR pstrEnd = m_pchData + GetData()->nDataLength; + + while (pstrSource < pstrEnd) + { + if (*pstrSource != chRemove) + { + *pstrDest = *pstrSource; + pstrDest = ::CharNext(pstrDest); + } + pstrSource = ::CharNext(pstrSource); + } + *pstrDest = _T('\0'); + int nCount = (int)(DWORD_PTR)(pstrSource - pstrDest); + GetData()->nDataLength -= nCount; + + return nCount; + } + + // insert character at zero-based index; concatenates if index is past end of string + int Insert(int nIndex, TCHAR ch) + { + CopyBeforeWrite(); + + if (nIndex < 0) + nIndex = 0; + + int nNewLength = GetData()->nDataLength; + if (nIndex > nNewLength) + nIndex = nNewLength; + nNewLength++; + + if (GetData()->nAllocLength < nNewLength) + { + CStringData* pOldData = GetData(); + LPTSTR pstr = m_pchData; + if(!AllocBuffer(nNewLength)) + return -1; + SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); + CString::Release(pOldData); + } + + // move existing bytes down + SecureHelper::memmove_x(m_pchData + nIndex + 1, (GetData()->nAllocLength - nIndex) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex) * sizeof(TCHAR)); + m_pchData[nIndex] = ch; + GetData()->nDataLength = nNewLength; + + return nNewLength; + } + + // insert substring at zero-based index; concatenates if index is past end of string + int Insert(int nIndex, LPCTSTR pstr) + { + if (nIndex < 0) + nIndex = 0; + + int nInsertLength = SafeStrlen(pstr); + int nNewLength = GetData()->nDataLength; + if (nInsertLength > 0) + { + CopyBeforeWrite(); + if (nIndex > nNewLength) + nIndex = nNewLength; + nNewLength += nInsertLength; + + if (GetData()->nAllocLength < nNewLength) + { + CStringData* pOldData = GetData(); + LPTSTR pstr = m_pchData; + if(!AllocBuffer(nNewLength)) + return -1; + SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); + CString::Release(pOldData); + } + + // move existing bytes down + SecureHelper::memmove_x(m_pchData + nIndex + nInsertLength, (GetData()->nAllocLength + 1 - nIndex - nInsertLength) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex - nInsertLength + 1) * sizeof(TCHAR)); + SecureHelper::memcpy_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), pstr, nInsertLength * sizeof(TCHAR)); + GetData()->nDataLength = nNewLength; + } + + return nNewLength; + } + + // delete nCount characters starting at zero-based index + int Delete(int nIndex, int nCount = 1) + { + if (nIndex < 0) + nIndex = 0; + int nLength = GetData()->nDataLength; + if (nCount > 0 && nIndex < nLength) + { + if((nIndex + nCount) > nLength) + nCount = nLength - nIndex; + CopyBeforeWrite(); + int nBytesToCopy = nLength - (nIndex + nCount) + 1; + + SecureHelper::memmove_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), m_pchData + nIndex + nCount, nBytesToCopy * sizeof(TCHAR)); + nLength -= nCount; + GetData()->nDataLength = nLength; + } + + return nLength; + } + + // searching (return starting index, or -1 if not found) + // look for a single character match + int Find(TCHAR ch) const // like "C" strchr + { + return Find(ch, 0); + } + + int ReverseFind(TCHAR ch) const + { + // find last single character + LPCTSTR lpsz = _cstrrchr(m_pchData, (_TUCHAR)ch); + + // return -1 if not found, distance from beginning otherwise + return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); + } + + int Find(TCHAR ch, int nStart) const // starting at index + { + int nLength = GetData()->nDataLength; + if (nStart < 0 || nStart >= nLength) + return -1; + + // find first single character + LPCTSTR lpsz = _cstrchr(m_pchData + nStart, (_TUCHAR)ch); + + // return -1 if not found and index otherwise + return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); + } + + int FindOneOf(LPCTSTR lpszCharSet) const + { + ATLASSERT(_IsValidString(lpszCharSet)); + LPCTSTR lpsz = _cstrpbrk(m_pchData, lpszCharSet); + return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); + } + + // look for a specific sub-string + // find a sub-string (like strstr) + int Find(LPCTSTR lpszSub) const // like "C" strstr + { + return Find(lpszSub, 0); + } + + int Find(LPCTSTR lpszSub, int nStart) const // starting at index + { + ATLASSERT(_IsValidString(lpszSub)); + + int nLength = GetData()->nDataLength; + if (nStart < 0 || nStart > nLength) + return -1; + + // find first matching substring + LPCTSTR lpsz = _cstrstr(m_pchData + nStart, lpszSub); + + // return -1 for not found, distance from beginning otherwise + return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); + } + + // Concatentation for non strings + CString& Append(int n) + { + const int cchBuff = 12; + TCHAR szBuffer[cchBuff] = { 0 }; + SecureHelper::wsprintf_x(szBuffer, cchBuff, _T("%d"), n); + ConcatInPlace(SafeStrlen(szBuffer), szBuffer); + return *this; + } + + // simple formatting + // formatting (using wsprintf style formatting) + BOOL __cdecl Format(LPCTSTR lpszFormat, ...) + { + ATLASSERT(_IsValidString(lpszFormat)); + + va_list argList; + va_start(argList, lpszFormat); + BOOL bRet = FormatV(lpszFormat, argList); + va_end(argList); + return bRet; + } + + BOOL __cdecl Format(UINT nFormatID, ...) + { + CString strFormat; + BOOL bRet = strFormat.LoadString(nFormatID); + ATLASSERT(bRet != 0); + + va_list argList; + va_start(argList, nFormatID); + bRet = FormatV(strFormat, argList); + va_end(argList); + return bRet; + } + + BOOL FormatV(LPCTSTR lpszFormat, va_list argList) + { + ATLASSERT(_IsValidString(lpszFormat)); + + enum _FormatModifiers + { + FORCE_ANSI = 0x10000, + FORCE_UNICODE = 0x20000, + FORCE_INT64 = 0x40000 + }; + + va_list argListSave = argList; + + // make a guess at the maximum length of the resulting string + int nMaxLen = 0; + for (LPCTSTR lpsz = lpszFormat; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) + { + // handle '%' character, but watch out for '%%' + if (*lpsz != _T('%') || *(lpsz = ::CharNext(lpsz)) == _T('%')) + { + nMaxLen += (int)(::CharNext(lpsz) - lpsz); + continue; + } + + int nItemLen = 0; + + // handle '%' character with format + int nWidth = 0; + for (; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) + { + // check for valid flags + if (*lpsz == _T('#')) + nMaxLen += 2; // for '0x' + else if (*lpsz == _T('*')) + nWidth = va_arg(argList, int); + else if (*lpsz == _T('-') || *lpsz == _T('+') || *lpsz == _T('0') || *lpsz == _T(' ')) + ; + else // hit non-flag character + break; + } + // get width and skip it + if (nWidth == 0) + { + // width indicated by + nWidth = _cstrtoi(lpsz); + for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) + ; + } + ATLASSERT(nWidth >= 0); + + int nPrecision = 0; + if (*lpsz == _T('.')) + { + // skip past '.' separator (width.precision) + lpsz = ::CharNext(lpsz); + + // get precision and skip it + if (*lpsz == _T('*')) + { + nPrecision = va_arg(argList, int); + lpsz = ::CharNext(lpsz); + } + else + { + nPrecision = _cstrtoi(lpsz); + for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) + ; + } + ATLASSERT(nPrecision >= 0); + } + + // should be on type modifier or specifier + int nModifier = 0; + if(lpsz[0] == _T('I') && lpsz[1] == _T('6') && lpsz[2] == _T('4')) + { + lpsz += 3; + nModifier = FORCE_INT64; + } + else + { + switch (*lpsz) + { + // modifiers that affect size + case _T('h'): + nModifier = FORCE_ANSI; + lpsz = ::CharNext(lpsz); + break; + case _T('l'): + nModifier = FORCE_UNICODE; + lpsz = ::CharNext(lpsz); + break; + + // modifiers that do not affect size + case _T('F'): + case _T('N'): + case _T('L'): + lpsz = ::CharNext(lpsz); + break; + } + } + + // now should be on specifier + switch (*lpsz | nModifier) + { + // single characters + case _T('c'): + case _T('C'): + nItemLen = 2; + va_arg(argList, TCHAR); + break; + case _T('c') | FORCE_ANSI: + case _T('C') | FORCE_ANSI: + nItemLen = 2; + va_arg(argList, char); + break; + case _T('c') | FORCE_UNICODE: + case _T('C') | FORCE_UNICODE: + nItemLen = 2; + va_arg(argList, WCHAR); + break; + + // strings + case _T('s'): + { + LPCTSTR pstrNextArg = va_arg(argList, LPCTSTR); + if (pstrNextArg == NULL) + { + nItemLen = 6; // "(null)" + } + else + { + nItemLen = lstrlen(pstrNextArg); + nItemLen = max(1, nItemLen); + } + break; + } + + case _T('S'): + { +#ifndef _UNICODE + LPWSTR pstrNextArg = va_arg(argList, LPWSTR); + if (pstrNextArg == NULL) + { + nItemLen = 6; // "(null)" + } + else + { + nItemLen = (int)wcslen(pstrNextArg); + nItemLen = max(1, nItemLen); + } +#else // _UNICODE + LPCSTR pstrNextArg = va_arg(argList, LPCSTR); + if (pstrNextArg == NULL) + { + nItemLen = 6; // "(null)" + } + else + { +#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) + nItemLen = ATL::lstrlenA(pstrNextArg); +#else + nItemLen = lstrlenA(pstrNextArg); +#endif + nItemLen = max(1, nItemLen); + } +#endif // _UNICODE + break; + } + + case _T('s') | FORCE_ANSI: + case _T('S') | FORCE_ANSI: + { + LPCSTR pstrNextArg = va_arg(argList, LPCSTR); + if (pstrNextArg == NULL) + { + nItemLen = 6; // "(null)" + } + else + { +#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) + nItemLen = ATL::lstrlenA(pstrNextArg); +#else + nItemLen = lstrlenA(pstrNextArg); +#endif + nItemLen = max(1, nItemLen); + } + break; + } + + case _T('s') | FORCE_UNICODE: + case _T('S') | FORCE_UNICODE: + { + LPWSTR pstrNextArg = va_arg(argList, LPWSTR); + if (pstrNextArg == NULL) + { + nItemLen = 6; // "(null)" + } + else + { + nItemLen = (int)wcslen(pstrNextArg); + nItemLen = max(1, nItemLen); + } + break; + } + } + + // adjust nItemLen for strings + if (nItemLen != 0) + { + nItemLen = max(nItemLen, nWidth); + if (nPrecision != 0) + nItemLen = min(nItemLen, nPrecision); + } + else + { + switch (*lpsz) + { + // integers + case _T('d'): + case _T('i'): + case _T('u'): + case _T('x'): + case _T('X'): + case _T('o'): + if (nModifier & FORCE_INT64) + va_arg(argList, __int64); + else + va_arg(argList, int); + nItemLen = 32; + nItemLen = max(nItemLen, nWidth + nPrecision); + break; + +#ifndef _ATL_USE_CSTRING_FLOAT + case _T('e'): + case _T('E'): + case _T('f'): + case _T('g'): + case _T('G'): + ATLASSERT(!"Floating point (%%e, %%E, %%f, %%g, and %%G) is not supported by the WTL::CString class."); +#ifndef _DEBUG + ::OutputDebugString(_T("Floating point (%%e, %%f, %%g, and %%G) is not supported by the WTL::CString class.")); +#ifndef _WIN32_WCE + ::DebugBreak(); +#else // CE specific + DebugBreak(); +#endif // _WIN32_WCE +#endif // !_DEBUG + break; +#else // _ATL_USE_CSTRING_FLOAT + case _T('e'): + case _T('E'): + case _T('g'): + case _T('G'): + va_arg(argList, double); + nItemLen = 128; + nItemLen = max(nItemLen, nWidth + nPrecision); + break; + case _T('f'): + { + double f = va_arg(argList, double); + // 312 == strlen("-1+(309 zeroes).") + // 309 zeroes == max precision of a double + // 6 == adjustment in case precision is not specified, + // which means that the precision defaults to 6 + int cchLen = max(nWidth, 312 + nPrecision + 6); + CTempBuffer buff; + LPTSTR pszTemp = buff.Allocate(cchLen); + if(pszTemp != NULL) + { + SecureHelper::sprintf_x(pszTemp, cchLen, _T("%*.*f"), nWidth, nPrecision + 6, f); + nItemLen = (int)_tcslen(pszTemp); + } + else + { + nItemLen = cchLen; + } + } + break; +#endif // _ATL_USE_CSTRING_FLOAT + + case _T('p'): + va_arg(argList, void*); + nItemLen = 32; + nItemLen = max(nItemLen, nWidth + nPrecision); + break; + + // no output + case _T('n'): + va_arg(argList, int*); + break; + + default: + ATLASSERT(FALSE); // unknown formatting option + } + } + + // adjust nMaxLen for output nItemLen + nMaxLen += nItemLen; + } + + if(GetBuffer(nMaxLen) == NULL) + return FALSE; +#ifndef _ATL_USE_CSTRING_FLOAT + int nRet = SecureHelper::wvsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); +#else // _ATL_USE_CSTRING_FLOAT + int nRet = SecureHelper::vsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); +#endif // _ATL_USE_CSTRING_FLOAT + nRet; // ref + ATLASSERT(nRet <= GetAllocLength()); + ReleaseBuffer(); + + va_end(argListSave); + return TRUE; + } + + // formatting for localization (uses FormatMessage API) + // formatting (using FormatMessage style formatting) + BOOL __cdecl FormatMessage(LPCTSTR lpszFormat, ...) + { + // format message into temporary buffer lpszTemp + va_list argList; + va_start(argList, lpszFormat); + LPTSTR lpszTemp; + BOOL bRet = TRUE; + + if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, + lpszFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) + bRet = FALSE; + + // assign lpszTemp into the resulting string and free the temporary + *this = lpszTemp; + LocalFree(lpszTemp); + va_end(argList); + return bRet; + } + + BOOL __cdecl FormatMessage(UINT nFormatID, ...) + { + // get format string from string table + CString strFormat; + BOOL bRetTmp = strFormat.LoadString(nFormatID); + bRetTmp; // ref + ATLASSERT(bRetTmp != 0); + + // format message into temporary buffer lpszTemp + va_list argList; + va_start(argList, nFormatID); + LPTSTR lpszTemp; + BOOL bRet = TRUE; + + if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, + strFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) + bRet = FALSE; + + // assign lpszTemp into the resulting string and free lpszTemp + *this = lpszTemp; + LocalFree(lpszTemp); + va_end(argList); + return bRet; + } + + // Windows support + BOOL LoadString(UINT nID) // load from string resource (255 chars max.) + { +#ifdef _UNICODE + const int CHAR_FUDGE = 1; // one TCHAR unused is good enough +#else + const int CHAR_FUDGE = 2; // two BYTES unused for case of DBC last char +#endif + + // try fixed buffer first (to avoid wasting space in the heap) + TCHAR szTemp[256]; + int nCount = sizeof(szTemp) / sizeof(szTemp[0]); + int nLen = _LoadString(nID, szTemp, nCount); + if (nCount - nLen > CHAR_FUDGE) + { + *this = szTemp; + return (nLen > 0); + } + + // try buffer size of 512, then larger size until entire string is retrieved + int nSize = 256; + do + { + nSize += 256; + LPTSTR lpstr = GetBuffer(nSize - 1); + if(lpstr == NULL) + { + nLen = 0; + break; + } + nLen = _LoadString(nID, lpstr, nSize); + } while (nSize - nLen <= CHAR_FUDGE); + ReleaseBuffer(); + + return (nLen > 0); + } + +#ifndef _UNICODE + // ANSI <-> OEM support (convert string in place) + void AnsiToOem() + { + CopyBeforeWrite(); + ::AnsiToOem(m_pchData, m_pchData); + } + + void OemToAnsi() + { + CopyBeforeWrite(); + ::OemToAnsi(m_pchData, m_pchData); + } +#endif + +#ifndef _ATL_NO_COM + // OLE BSTR support (use for OLE automation) + BSTR AllocSysString() const + { +#if defined(_UNICODE) || defined(OLE2ANSI) + BSTR bstr = ::SysAllocStringLen(m_pchData, GetData()->nDataLength); +#else + int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, + GetData()->nDataLength, NULL, NULL); + BSTR bstr = ::SysAllocStringLen(NULL, nLen); + if(bstr != NULL) + MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, bstr, nLen); +#endif + return bstr; + } + + BSTR SetSysString(BSTR* pbstr) const + { +#if defined(_UNICODE) || defined(OLE2ANSI) + ::SysReAllocStringLen(pbstr, m_pchData, GetData()->nDataLength); +#else + int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, + GetData()->nDataLength, NULL, NULL); + if(::SysReAllocStringLen(pbstr, NULL, nLen)) + MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, *pbstr, nLen); +#endif + ATLASSERT(*pbstr != NULL); + return *pbstr; + } +#endif // !_ATL_NO_COM + + // Access to string implementation buffer as "C" character array + LPTSTR GetBuffer(int nMinBufLength) + { + ATLASSERT(nMinBufLength >= 0); + + if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength) + { + // we have to grow the buffer + CStringData* pOldData = GetData(); + int nOldLen = GetData()->nDataLength; // AllocBuffer will tromp it + if (nMinBufLength < nOldLen) + nMinBufLength = nOldLen; + + if(!AllocBuffer(nMinBufLength)) + return NULL; + + SecureHelper::memcpy_x(m_pchData, (nMinBufLength + 1) * sizeof(TCHAR), pOldData->data(), (nOldLen + 1) * sizeof(TCHAR)); + GetData()->nDataLength = nOldLen; + CString::Release(pOldData); + } + ATLASSERT(GetData()->nRefs <= 1); + + // return a pointer to the character storage for this string + ATLASSERT(m_pchData != NULL); + return m_pchData; + } + + void ReleaseBuffer(int nNewLength = -1) + { + CopyBeforeWrite(); // just in case GetBuffer was not called + + if (nNewLength == -1) + nNewLength = lstrlen(m_pchData); // zero terminated + + ATLASSERT(nNewLength <= GetData()->nAllocLength); + GetData()->nDataLength = nNewLength; + m_pchData[nNewLength] = _T('\0'); + } + + LPTSTR GetBufferSetLength(int nNewLength) + { + ATLASSERT(nNewLength >= 0); + + if(GetBuffer(nNewLength) == NULL) + return NULL; + + GetData()->nDataLength = nNewLength; + m_pchData[nNewLength] = _T('\0'); + return m_pchData; + } + + void FreeExtra() + { + ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); + if (GetData()->nDataLength != GetData()->nAllocLength) + { + CStringData* pOldData = GetData(); + if(AllocBuffer(GetData()->nDataLength)) + { + SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pOldData->data(), pOldData->nDataLength * sizeof(TCHAR)); + ATLASSERT(m_pchData[GetData()->nDataLength] == _T('\0')); + CString::Release(pOldData); + } + } + ATLASSERT(GetData() != NULL); + } + + // Use LockBuffer/UnlockBuffer to turn refcounting off + LPTSTR LockBuffer() + { + LPTSTR lpsz = GetBuffer(0); + if(lpsz != NULL) + GetData()->nRefs = -1; + return lpsz; + } + + void UnlockBuffer() + { + ATLASSERT(GetData()->nRefs == -1); + if (GetData() != _atltmpDataNil) + GetData()->nRefs = 1; + } + +// Implementation +public: + ~CString() // free any attached data + { + if (GetData() != _atltmpDataNil) + { + if (InterlockedDecrement(&GetData()->nRefs) <= 0) + delete[] (BYTE*)GetData(); + } + } + + int GetAllocLength() const + { + return GetData()->nAllocLength; + } + + static BOOL __stdcall _IsValidString(LPCTSTR lpsz, int /*nLength*/ = -1) + { + return (lpsz != NULL) ? TRUE : FALSE; + } + +protected: + LPTSTR m_pchData; // pointer to ref counted string data + + // implementation helpers + CStringData* GetData() const + { + ATLASSERT(m_pchData != NULL); + return ((CStringData*)m_pchData) - 1; + } + + void Init() + { + m_pchData = _GetEmptyString().m_pchData; + } + + BOOL AllocCopy(CString& dest, int nCopyLen, int nCopyIndex, int nExtraLen) const + { + // will clone the data attached to this string + // allocating 'nExtraLen' characters + // Places results in uninitialized string 'dest' + // Will copy the part or all of original data to start of new string + + BOOL bRet = FALSE; + int nNewLen = nCopyLen + nExtraLen; + if (nNewLen == 0) + { + dest.Init(); + bRet = TRUE; + } + else if(nNewLen >= nCopyLen) + { + if(dest.AllocBuffer(nNewLen)) + { + SecureHelper::memcpy_x(dest.m_pchData, (nNewLen + 1) * sizeof(TCHAR), m_pchData + nCopyIndex, nCopyLen * sizeof(TCHAR)); + bRet = TRUE; + } + } + + return bRet; + } + + // always allocate one extra character for '\0' termination + // assumes [optimistically] that data length will equal allocation length + BOOL AllocBuffer(int nLen) + { + ATLASSERT(nLen >= 0); + ATLASSERT(nLen <= INT_MAX - 1); // max size (enough room for 1 extra) + + if (nLen == 0) + { + Init(); + } + else + { + CStringData* pData = NULL; + ATLTRY(pData = (CStringData*)new BYTE[sizeof(CStringData) + (nLen + 1) * sizeof(TCHAR)]); + if(pData == NULL) + return FALSE; + + pData->nRefs = 1; + pData->data()[nLen] = _T('\0'); + pData->nDataLength = nLen; + pData->nAllocLength = nLen; + m_pchData = pData->data(); + } + + return TRUE; + } + + // Assignment operators + // All assign a new value to the string + // (a) first see if the buffer is big enough + // (b) if enough room, copy on top of old buffer, set size and type + // (c) otherwise free old string data, and create a new one + // + // All routines return the new string (but as a 'const CString&' so that + // assigning it again will cause a copy, eg: s1 = s2 = "hi there". + // + void AssignCopy(int nSrcLen, LPCTSTR lpszSrcData) + { + if(AllocBeforeWrite(nSrcLen)) + { + SecureHelper::memcpy_x(m_pchData, (nSrcLen + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); + GetData()->nDataLength = nSrcLen; + m_pchData[nSrcLen] = _T('\0'); + } + } + + // Concatenation + // NOTE: "operator +" is done as friend functions for simplicity + // There are three variants: + // CString + CString + // and for ? = TCHAR, LPCTSTR + // CString + ? + // ? + CString + BOOL ConcatCopy(int nSrc1Len, LPCTSTR lpszSrc1Data, int nSrc2Len, LPCTSTR lpszSrc2Data) + { + // -- master concatenation routine + // Concatenate two sources + // -- assume that 'this' is a new CString object + + BOOL bRet = TRUE; + int nNewLen = nSrc1Len + nSrc2Len; + if(nNewLen < nSrc1Len || nNewLen < nSrc2Len) + { + bRet = FALSE; + } + else if(nNewLen != 0) + { + bRet = AllocBuffer(nNewLen); + if (bRet) + { + SecureHelper::memcpy_x(m_pchData, (nNewLen + 1) * sizeof(TCHAR), lpszSrc1Data, nSrc1Len * sizeof(TCHAR)); + SecureHelper::memcpy_x(m_pchData + nSrc1Len, (nNewLen + 1 - nSrc1Len) * sizeof(TCHAR), lpszSrc2Data, nSrc2Len * sizeof(TCHAR)); + } + } + return bRet; + } + + void ConcatInPlace(int nSrcLen, LPCTSTR lpszSrcData) + { + // -- the main routine for += operators + + // concatenating an empty string is a no-op! + if (nSrcLen == 0) + return; + + // if the buffer is too small, or we have a width mis-match, just + // allocate a new buffer (slow but sure) + if (GetData()->nRefs > 1 || GetData()->nDataLength + nSrcLen > GetData()->nAllocLength) + { + // we have to grow the buffer, use the ConcatCopy routine + CStringData* pOldData = GetData(); + if (ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData)) + { + ATLASSERT(pOldData != NULL); + CString::Release(pOldData); + } + } + else + { + // fast concatenation when buffer big enough + SecureHelper::memcpy_x(m_pchData + GetData()->nDataLength, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); + GetData()->nDataLength += nSrcLen; + ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); + m_pchData[GetData()->nDataLength] = _T('\0'); + } + } + + void CopyBeforeWrite() + { + if (GetData()->nRefs > 1) + { + CStringData* pData = GetData(); + Release(); + if(AllocBuffer(pData->nDataLength)) + SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pData->data(), (pData->nDataLength + 1) * sizeof(TCHAR)); + } + ATLASSERT(GetData()->nRefs <= 1); + } + + BOOL AllocBeforeWrite(int nLen) + { + BOOL bRet = TRUE; + if (GetData()->nRefs > 1 || nLen > GetData()->nAllocLength) + { + Release(); + bRet = AllocBuffer(nLen); + } + ATLASSERT(GetData()->nRefs <= 1); + return bRet; + } + + void Release() + { + if (GetData() != _atltmpDataNil) + { + ATLASSERT(GetData()->nRefs != 0); + if (InterlockedDecrement(&GetData()->nRefs) <= 0) + delete[] (BYTE*)GetData(); + Init(); + } + } + + static void PASCAL Release(CStringData* pData) + { + if (pData != _atltmpDataNil) + { + ATLASSERT(pData->nRefs != 0); + if (InterlockedDecrement(&pData->nRefs) <= 0) + delete[] (BYTE*)pData; + } + } + + static int PASCAL SafeStrlen(LPCTSTR lpsz) + { + return (lpsz == NULL) ? 0 : lstrlen(lpsz); + } + + static int __stdcall _LoadString(UINT nID, LPTSTR lpszBuf, UINT nMaxBuf) + { +#ifdef _DEBUG + // LoadString without annoying warning from the Debug kernel if the + // segment containing the string is not present + if (::FindResource(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE((nID >> 4) + 1), RT_STRING) == NULL) + { + lpszBuf[0] = _T('\0'); + return 0; // not found + } +#endif // _DEBUG + + int nLen = ::LoadString(ModuleHelper::GetResourceInstance(), nID, lpszBuf, nMaxBuf); + if (nLen == 0) + lpszBuf[0] = _T('\0'); + + return nLen; + } + + static const CString& __stdcall _GetEmptyString() + { + return *(CString*)&_atltmpPchNil; + } + +// CString conversion helpers + static int __cdecl _wcstombsz(char* mbstr, const wchar_t* wcstr, size_t count) + { + if (count == 0 && mbstr != NULL) + return 0; + + int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1, mbstr, (int)count, NULL, NULL); + ATLASSERT(mbstr == NULL || result <= (int)count); + if (result > 0) + mbstr[result - 1] = 0; + return result; + } + + static int __cdecl _mbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count) + { + if (count == 0 && wcstr != NULL) + return 0; + + int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wcstr, (int)count); + ATLASSERT(wcstr == NULL || result <= (int)count); + if (result > 0) + wcstr[result - 1] = 0; + return result; + } + +// Helpers to avoid CRT startup code +#ifdef _ATL_MIN_CRT + static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) + { + // strchr for '\0' should succeed + while (*p != 0) + { + if (*p == ch) + break; + p = ::CharNext(p); + } + return (*p == ch) ? p : NULL; + } + + static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) + { + const TCHAR* lpsz = NULL; + while (*p != 0) + { + if (*p == ch) + lpsz = p; + p = ::CharNext(p); + } + return lpsz; + } + + static TCHAR* _cstrrev(TCHAR* pStr) + { + // optimize NULL, zero-length, and single-char case + if ((pStr == NULL) || (pStr[0] == _T('\0')) || (pStr[1] == _T('\0'))) + return pStr; + + TCHAR* p = pStr; + + while (*p != 0) + { + TCHAR* pNext = ::CharNext(p); + if(pNext > p + 1) + { + char p1 = *(char*)p; + *(char*)p = *(char*)(p + 1); + *(char*)(p + 1) = p1; + } + p = pNext; + } + + p--; + TCHAR* q = pStr; + + while (q < p) + { + TCHAR t = *q; + *q = *p; + *p = t; + q++; + p--; + } + return pStr; + } + + static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) + { + int nLen = lstrlen(pCharSet); + if (nLen == 0) + return (TCHAR*)pStr; + + const TCHAR* pRet = NULL; + const TCHAR* pCur = pStr; + while((pCur = _cstrchr(pCur, *pCharSet)) != NULL) + { + if(memcmp(pCur, pCharSet, nLen * sizeof(TCHAR)) == 0) + { + pRet = pCur; + break; + } + pCur = ::CharNext(pCur); + } + return pRet; + } + + static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) + { + int nRet = 0; + const TCHAR* p = pStr; + while (*p != 0) + { + const TCHAR* pNext = ::CharNext(p); + if(pNext > p + 1) + { + if(_cstrchr_db(pCharSet, *p, *(p + 1)) == NULL) + break; + nRet += 2; + } + else + { + if(_cstrchr(pCharSet, *p) == NULL) + break; + nRet++; + } + p = pNext; + } + return nRet; + } + + static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) + { + int nRet = 0; + TCHAR* p = (TCHAR*)pStr; + while (*p != 0) + { + TCHAR* pNext = ::CharNext(p); + if(pNext > p + 1) + { + if(_cstrchr_db(pCharSet, *p, *(p + 1)) != NULL) + break; + nRet += 2; + } + else + { + if(_cstrchr(pCharSet, *p) != NULL) + break; + nRet++; + } + p = pNext; + } + return nRet; + } + + static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) + { + int n = _cstrcspn(p, lpszCharSet); + return (p[n] != 0) ? &p[n] : NULL; + } + + static int _cstrisdigit(TCHAR ch) + { + WORD type; + GetStringTypeEx(GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); + return (type & C1_DIGIT) == C1_DIGIT; + } + + static int _cstrisspace(TCHAR ch) + { + WORD type; + GetStringTypeEx(GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); + return (type & C1_SPACE) == C1_SPACE; + } + + static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + return lstrcmp(pstrOne, pstrOther); + } + + static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + return lstrcmpi(pstrOne, pstrOther); + } + + static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + int nRet = CompareString(GetThreadLocale(), 0, pstrOne, -1, pstrOther, -1); + ATLASSERT(nRet != 0); + return nRet - 2; // convert to strcmp convention + } + + static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + int nRet = CompareString(GetThreadLocale(), NORM_IGNORECASE, pstrOne, -1, pstrOther, -1); + ATLASSERT(nRet != 0); + return nRet - 2; // convert to strcmp convention + } + + static int _cstrtoi(const TCHAR* nptr) + { + int c; // current char + int total; // current total + int sign; // if '-', then negative, otherwise positive + + while (_cstrisspace(*nptr)) + ++nptr; + + c = (int)(_TUCHAR)*nptr++; + sign = c; // save sign indication + if (c == _T('-') || c == _T('+')) + c = (int)(_TUCHAR)*nptr++; // skip sign + + total = 0; + + while (_cstrisdigit((TCHAR)c)) + { + total = 10 * total + (c - '0'); // accumulate digit + c = (int)(_TUCHAR)*nptr++; // get next char + } + + if (sign == '-') + return -total; + else + return total; // return result, negated if necessary + } +#else // !_ATL_MIN_CRT + static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) + { + return _tcschr(p, ch); + } + + static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) + { + return _tcsrchr(p, ch); + } + + static TCHAR* _cstrrev(TCHAR* pStr) + { + return _tcsrev(pStr); + } + + static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) + { + return _tcsstr(pStr, pCharSet); + } + + static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) + { + return (int)_tcsspn(pStr, pCharSet); + } + + static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) + { + return (int)_tcscspn(pStr, pCharSet); + } + + static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) + { + return _tcspbrk(p, lpszCharSet); + } + + static int _cstrisdigit(TCHAR ch) + { + return _istdigit(ch); + } + + static int _cstrisspace(TCHAR ch) + { + return _istspace((_TUCHAR)ch); + } + + static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + return _tcscmp(pstrOne, pstrOther); + } + + static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + return _tcsicmp(pstrOne, pstrOther); + } + +#ifndef _WIN32_WCE + static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + return _tcscoll(pstrOne, pstrOther); + } + + static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) + { + return _tcsicoll(pstrOne, pstrOther); + } +#endif // !_WIN32_WCE + + static int _cstrtoi(const TCHAR* nptr) + { + return _ttoi(nptr); + } +#endif // !_ATL_MIN_CRT + + static const TCHAR* _cstrchr_db(const TCHAR* p, TCHAR ch1, TCHAR ch2) + { + const TCHAR* lpsz = NULL; + while (*p != 0) + { + if (*p == ch1 && *(p + 1) == ch2) + { + lpsz = p; + break; + } + p = ::CharNext(p); + } + return lpsz; + } +}; + + +// Compare helpers + +inline bool __stdcall operator ==(const CString& s1, const CString& s2) +{ return s1.Compare(s2) == 0; } + +inline bool __stdcall operator ==(const CString& s1, LPCTSTR s2) +{ return s1.Compare(s2) == 0; } + +inline bool __stdcall operator ==(LPCTSTR s1, const CString& s2) +{ return s2.Compare(s1) == 0; } + +inline bool __stdcall operator !=(const CString& s1, const CString& s2) +{ return s1.Compare(s2) != 0; } + +inline bool __stdcall operator !=(const CString& s1, LPCTSTR s2) +{ return s1.Compare(s2) != 0; } + +inline bool __stdcall operator !=(LPCTSTR s1, const CString& s2) +{ return s2.Compare(s1) != 0; } + +inline bool __stdcall operator <(const CString& s1, const CString& s2) +{ return s1.Compare(s2) < 0; } + +inline bool __stdcall operator <(const CString& s1, LPCTSTR s2) +{ return s1.Compare(s2) < 0; } + +inline bool __stdcall operator <(LPCTSTR s1, const CString& s2) +{ return s2.Compare(s1) > 0; } + +inline bool __stdcall operator >(const CString& s1, const CString& s2) +{ return s1.Compare(s2) > 0; } + +inline bool __stdcall operator >(const CString& s1, LPCTSTR s2) +{ return s1.Compare(s2) > 0; } + +inline bool __stdcall operator >(LPCTSTR s1, const CString& s2) +{ return s2.Compare(s1) < 0; } + +inline bool __stdcall operator <=(const CString& s1, const CString& s2) +{ return s1.Compare(s2) <= 0; } + +inline bool __stdcall operator <=(const CString& s1, LPCTSTR s2) +{ return s1.Compare(s2) <= 0; } + +inline bool __stdcall operator <=(LPCTSTR s1, const CString& s2) +{ return s2.Compare(s1) >= 0; } + +inline bool __stdcall operator >=(const CString& s1, const CString& s2) +{ return s1.Compare(s2) >= 0; } + +inline bool __stdcall operator >=(const CString& s1, LPCTSTR s2) +{ return s1.Compare(s2) >= 0; } + +inline bool __stdcall operator >=(LPCTSTR s1, const CString& s2) +{ return s2.Compare(s1) <= 0; } + + +// CString "operator +" functions + +inline CString __stdcall operator +(const CString& string1, const CString& string2) +{ + CString s; + s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData, string2.GetData()->nDataLength, string2.m_pchData); + return s; +} + +inline CString __stdcall operator +(const CString& string, TCHAR ch) +{ + CString s; + s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch); + return s; +} + +inline CString __stdcall operator +(TCHAR ch, const CString& string) +{ + CString s; + s.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData); + return s; +} + +#ifdef _UNICODE +inline CString __stdcall operator +(const CString& string, char ch) +{ + return string + (TCHAR)ch; +} + +inline CString __stdcall operator +(char ch, const CString& string) +{ + return (TCHAR)ch + string; +} +#endif // _UNICODE + +inline CString __stdcall operator +(const CString& string, LPCTSTR lpsz) +{ + ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); + CString s; + s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, CString::SafeStrlen(lpsz), lpsz); + return s; +} + +inline CString __stdcall operator +(LPCTSTR lpsz, const CString& string) +{ + ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); + CString s; + s.ConcatCopy(CString::SafeStrlen(lpsz), lpsz, string.GetData()->nDataLength, string.m_pchData); + return s; +} + +#endif // !_WTL_NO_CSTRING + + +/////////////////////////////////////////////////////////////////////////////// +// CRecentDocumentList - MRU List Support + +#ifndef _WIN32_WCE + +#ifndef _WTL_MRUEMPTY_TEXT + #define _WTL_MRUEMPTY_TEXT _T("(empty)") +#endif + +// forward declaration +inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen); + +template +class CRecentDocumentListBase +{ +public: +// Declarations + struct _DocEntry + { + TCHAR szDocName[t_cchItemLen]; + bool operator ==(const _DocEntry& de) const + { return (lstrcmpi(szDocName, de.szDocName) == 0); } + }; + + enum + { + m_nMaxEntries_Min = 2, + m_nMaxEntries_Max = t_nLastID - t_nFirstID + 1, + m_cchMaxItemLen_Min = 6, + m_cchMaxItemLen_Max = t_cchItemLen, + m_cchItemNameLen = 11 + }; + +// Data members + ATL::CSimpleArray<_DocEntry> m_arrDocs; + int m_nMaxEntries; // default is 4 + HMENU m_hMenu; + + TCHAR m_szNoEntries[t_cchItemLen]; + + int m_cchMaxItemLen; + +// Constructor + CRecentDocumentListBase() : m_hMenu(NULL), m_nMaxEntries(4), m_cchMaxItemLen(-1) + { + // These ASSERTs verify values of the template arguments + ATLASSERT(t_cchItemLen > m_cchMaxItemLen_Min); + ATLASSERT(m_nMaxEntries_Max > m_nMaxEntries_Min); + } + +// Attributes + HMENU GetMenuHandle() const + { + return m_hMenu; + } + + void SetMenuHandle(HMENU hMenu) + { + ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); + m_hMenu = hMenu; + if(m_hMenu == NULL || (::GetMenuString(m_hMenu, t_nFirstID, m_szNoEntries, t_cchItemLen, MF_BYCOMMAND) == 0)) + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + SecureHelper::strncpy_x(m_szNoEntries, _countof(m_szNoEntries), pT->GetMRUEmptyText(), _TRUNCATE); + } + } + + int GetMaxEntries() const + { + return m_nMaxEntries; + } + + void SetMaxEntries(int nMaxEntries) + { + ATLASSERT(nMaxEntries >= m_nMaxEntries_Min && nMaxEntries <= m_nMaxEntries_Max); + if(nMaxEntries < m_nMaxEntries_Min) + nMaxEntries = m_nMaxEntries_Min; + else if(nMaxEntries > m_nMaxEntries_Max) + nMaxEntries = m_nMaxEntries_Max; + m_nMaxEntries = nMaxEntries; + } + + int GetMaxItemLength() const + { + return m_cchMaxItemLen; + } + + void SetMaxItemLength(int cchMaxLen) + { + ATLASSERT((cchMaxLen >= m_cchMaxItemLen_Min && cchMaxLen <= m_cchMaxItemLen_Max) || cchMaxLen == -1); + if(cchMaxLen != -1) + { + if(cchMaxLen < m_cchMaxItemLen_Min) + cchMaxLen = m_cchMaxItemLen_Min; + else if(cchMaxLen > m_cchMaxItemLen_Max) + cchMaxLen = m_cchMaxItemLen_Max; + } + m_cchMaxItemLen = cchMaxLen; + T* pT = static_cast(this); + pT->UpdateMenu(); + } + +// Operations + BOOL AddToList(LPCTSTR lpstrDocName) + { + _DocEntry de; + errno_t nRet = SecureHelper::strncpy_x(de.szDocName, _countof(de.szDocName), lpstrDocName, _TRUNCATE); + if(nRet != 0 && nRet != STRUNCATE) + return FALSE; + + for(int i = 0; i < m_arrDocs.GetSize(); i++) + { + if(lstrcmpi(m_arrDocs[i].szDocName, lpstrDocName) == 0) + { + m_arrDocs.RemoveAt(i); + break; + } + } + + if(m_arrDocs.GetSize() == m_nMaxEntries) + m_arrDocs.RemoveAt(0); + + BOOL bRet = m_arrDocs.Add(de); + if(bRet) + { + T* pT = static_cast(this); + bRet = pT->UpdateMenu(); + } + return bRet; + } + + // This function is deprecated because it is not safe. + // Use the version below that accepts the buffer length. +#if (_MSC_VER >= 1300) + __declspec(deprecated) +#endif + BOOL GetFromList(int /*nItemID*/, LPTSTR /*lpstrDocName*/) + { + ATLASSERT(FALSE); + return FALSE; + } + + BOOL GetFromList(int nItemID, LPTSTR lpstrDocName, int cchLength) + { + int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; + if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) + return FALSE; + if(lstrlen(m_arrDocs[nIndex].szDocName) >= cchLength) + return FALSE; + SecureHelper::strcpy_x(lpstrDocName, cchLength, m_arrDocs[nIndex].szDocName); + + return TRUE; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + BOOL GetFromList(int nItemID, _CSTRING_NS::CString& strDocName) + { + int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; + if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) + return FALSE; + strDocName = m_arrDocs[nIndex].szDocName; + return TRUE; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + BOOL RemoveFromList(int nItemID) + { + int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; + BOOL bRet = m_arrDocs.RemoveAt(nIndex); + if(bRet) + { + T* pT = static_cast(this); + bRet = pT->UpdateMenu(); + } + return bRet; + } + + BOOL MoveToTop(int nItemID) + { + int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; + if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) + return FALSE; + _DocEntry de; + de = m_arrDocs[nIndex]; + m_arrDocs.RemoveAt(nIndex); + BOOL bRet = m_arrDocs.Add(de); + if(bRet) + { + T* pT = static_cast(this); + bRet = pT->UpdateMenu(); + } + return bRet; + } + + BOOL ReadFromRegistry(LPCTSTR lpstrRegKey) + { + T* pT = static_cast(this); + ATL::CRegKey rkParent; + ATL::CRegKey rk; + + LONG lRet = rkParent.Open(HKEY_CURRENT_USER, lpstrRegKey); + if(lRet != ERROR_SUCCESS) + return FALSE; + lRet = rk.Open(rkParent, pT->GetRegKeyName()); + if(lRet != ERROR_SUCCESS) + return FALSE; + + DWORD dwRet = 0; +#if (_ATL_VER >= 0x0700) + lRet = rk.QueryDWORDValue(pT->GetRegCountName(), dwRet); +#else + lRet = rk.QueryValue(dwRet, pT->GetRegCountName()); +#endif + if(lRet != ERROR_SUCCESS) + return FALSE; + SetMaxEntries(dwRet); + + m_arrDocs.RemoveAll(); + + TCHAR szRetString[t_cchItemLen] = { 0 }; + _DocEntry de; + + for(int nItem = m_nMaxEntries; nItem > 0; nItem--) + { + TCHAR szBuff[m_cchItemNameLen] = { 0 }; + SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); +#if (_ATL_VER >= 0x0700) + ULONG ulCount = t_cchItemLen; + lRet = rk.QueryStringValue(szBuff, szRetString, &ulCount); +#else + DWORD dwCount = t_cchItemLen * sizeof(TCHAR); + lRet = rk.QueryValue(szRetString, szBuff, &dwCount); +#endif + if(lRet == ERROR_SUCCESS) + { + SecureHelper::strcpy_x(de.szDocName, _countof(de.szDocName), szRetString); + m_arrDocs.Add(de); + } + } + + rk.Close(); + rkParent.Close(); + + return pT->UpdateMenu(); + } + + BOOL WriteToRegistry(LPCTSTR lpstrRegKey) + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + ATL::CRegKey rkParent; + ATL::CRegKey rk; + + LONG lRet = rkParent.Create(HKEY_CURRENT_USER, lpstrRegKey); + if(lRet != ERROR_SUCCESS) + return FALSE; + lRet = rk.Create(rkParent, pT->GetRegKeyName()); + if(lRet != ERROR_SUCCESS) + return FALSE; + +#if (_ATL_VER >= 0x0700) + lRet = rk.SetDWORDValue(pT->GetRegCountName(), m_nMaxEntries); +#else + lRet = rk.SetValue(m_nMaxEntries, pT->GetRegCountName()); +#endif + ATLASSERT(lRet == ERROR_SUCCESS); + + // set new values + int nItem; + for(nItem = m_arrDocs.GetSize(); nItem > 0; nItem--) + { + TCHAR szBuff[m_cchItemNameLen] = { 0 }; + SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); + TCHAR szDocName[t_cchItemLen] = { 0 }; + GetFromList(t_nFirstID + nItem - 1, szDocName, t_cchItemLen); +#if (_ATL_VER >= 0x0700) + lRet = rk.SetStringValue(szBuff, szDocName); +#else + lRet = rk.SetValue(szDocName, szBuff); +#endif + ATLASSERT(lRet == ERROR_SUCCESS); + } + + // delete unused keys + for(nItem = m_arrDocs.GetSize() + 1; nItem < m_nMaxEntries_Max; nItem++) + { + TCHAR szBuff[m_cchItemNameLen] = { 0 }; + SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); + rk.DeleteValue(szBuff); + } + + rk.Close(); + rkParent.Close(); + + return TRUE; + } + +// Implementation + BOOL UpdateMenu() + { + if(m_hMenu == NULL) + return FALSE; + ATLASSERT(::IsMenu(m_hMenu)); + + int nItems = ::GetMenuItemCount(m_hMenu); + int nInsertPoint; + for(nInsertPoint = 0; nInsertPoint < nItems; nInsertPoint++) + { + CMenuItemInfo mi; + mi.fMask = MIIM_ID; + ::GetMenuItemInfo(m_hMenu, nInsertPoint, TRUE, &mi); + if (mi.wID == t_nFirstID) + break; + } + ATLASSERT(nInsertPoint < nItems && "You need a menu item with an ID = t_nFirstID"); + + int nItem; + for(nItem = t_nFirstID; nItem < t_nFirstID + m_nMaxEntries; nItem++) + { + // keep the first one as an insertion point + if (nItem != t_nFirstID) + ::DeleteMenu(m_hMenu, nItem, MF_BYCOMMAND); + } + + TCHAR szItemText[t_cchItemLen + 6] = { 0 }; // add space for &, 2 digits, and a space + int nSize = m_arrDocs.GetSize(); + nItem = 0; + if(nSize > 0) + { + for(nItem = 0; nItem < nSize; nItem++) + { + if(m_cchMaxItemLen == -1) + { + SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, m_arrDocs[nSize - 1 - nItem].szDocName); + } + else + { + TCHAR szBuff[t_cchItemLen] = { 0 }; + T* pT = static_cast(this); + pT; // avoid level 4 warning + bool bRet = pT->CompactDocumentName(szBuff, m_arrDocs[nSize - 1 - nItem].szDocName, m_cchMaxItemLen); + bRet; // avoid level 4 warning + ATLASSERT(bRet); + SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, szBuff); + } + ::InsertMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION | MF_STRING, t_nFirstID + nItem, szItemText); + } + } + else // empty + { + ::InsertMenu(m_hMenu, nInsertPoint, MF_BYPOSITION | MF_STRING, t_nFirstID, m_szNoEntries); + ::EnableMenuItem(m_hMenu, t_nFirstID, MF_GRAYED); + nItem++; + } + ::DeleteMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION); + + return TRUE; + } + +// Overrideables + // override to provide a different method of compacting document names + static bool CompactDocumentName(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) + { + return AtlCompactPath(lpstrOut, lpstrIn, cchLen); + } + + static LPCTSTR GetRegKeyName() + { + return _T("Recent Document List"); + } + + static LPCTSTR GetRegCountName() + { + return _T("DocumentCount"); + } + + static LPCTSTR GetRegItemName() + { + // Note: This string is a format string used with wsprintf(). + // Resulting formatted string must be m_cchItemNameLen or less + // characters long, including the terminating null character. + return _T("Document%i"); + } + + static LPCTSTR GetMRUEmptyText() + { + return _WTL_MRUEMPTY_TEXT; + } +}; + +class CRecentDocumentList : public CRecentDocumentListBase +{ +public: +// nothing here +}; + +#endif // _WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CFindFile - file search helper class + +class CFindFile +{ +public: +// Data members + WIN32_FIND_DATA m_fd; + TCHAR m_lpszRoot[MAX_PATH]; + TCHAR m_chDirSeparator; + HANDLE m_hFind; + BOOL m_bFound; + +// Constructor/destructor + CFindFile() : m_hFind(NULL), m_chDirSeparator(_T('\\')), m_bFound(FALSE) + { } + + ~CFindFile() + { + Close(); + } + +// Attributes + ULONGLONG GetFileSize() const + { + ATLASSERT(m_hFind != NULL); + + ULARGE_INTEGER nFileSize = { 0 }; + + if(m_bFound) + { + nFileSize.LowPart = m_fd.nFileSizeLow; + nFileSize.HighPart = m_fd.nFileSizeHigh; + } + else + { + nFileSize.QuadPart = 0; + } + + return nFileSize.QuadPart; + } + + BOOL GetFileName(LPTSTR lpstrFileName, int cchLength) const + { + ATLASSERT(m_hFind != NULL); + if(lstrlen(m_fd.cFileName) >= cchLength) + return FALSE; + + if(m_bFound) + SecureHelper::strcpy_x(lpstrFileName, cchLength, m_fd.cFileName); + + return m_bFound; + } + + BOOL GetFilePath(LPTSTR lpstrFilePath, int cchLength) const + { + ATLASSERT(m_hFind != NULL); + + int nLen = lstrlen(m_lpszRoot); +#ifndef _WIN32_WCE + ATLASSERT(nLen > 0); + if(nLen == 0) + return FALSE; + + bool bAddSep = (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/')); +#else // CE specific + // allow diskless devices (nLen == 0) + bool bAddSep = ((nLen == 0) || (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/'))); +#endif // _WIN32_WCE + + if((lstrlen(m_lpszRoot) + (bAddSep ? 1 : 0)) >= cchLength) + return FALSE; + + SecureHelper::strcpy_x(lpstrFilePath, cchLength, m_lpszRoot); + + if(bAddSep) + { + TCHAR szSeparator[2] = { m_chDirSeparator, 0 }; + SecureHelper::strcat_x(lpstrFilePath, cchLength, szSeparator); + } + + SecureHelper::strcat_x(lpstrFilePath, cchLength, m_fd.cFileName); + + return TRUE; + } + +#ifndef _WIN32_WCE + BOOL GetFileTitle(LPTSTR lpstrFileTitle, int cchLength) const + { + ATLASSERT(m_hFind != NULL); + + TCHAR szBuff[MAX_PATH] = { 0 }; + if(!GetFileName(szBuff, MAX_PATH)) + return FALSE; + + if(lstrlen(szBuff) >= cchLength || cchLength < 1) + return FALSE; + + // find the last dot + LPTSTR pstrDot = (LPTSTR)_cstrrchr(szBuff, _T('.')); + if(pstrDot != NULL) + *pstrDot = 0; + + SecureHelper::strcpy_x(lpstrFileTitle, cchLength, szBuff); + + return TRUE; + } +#endif // !_WIN32_WCE + + BOOL GetFileURL(LPTSTR lpstrFileURL, int cchLength) const + { + ATLASSERT(m_hFind != NULL); + + TCHAR szBuff[MAX_PATH] = { 0 }; + if(!GetFilePath(szBuff, MAX_PATH)) + return FALSE; + LPCTSTR lpstrFileURLPrefix = _T("file://"); + if(lstrlen(szBuff) + lstrlen(lpstrFileURLPrefix) >= cchLength) + return FALSE; + SecureHelper::strcpy_x(lpstrFileURL, cchLength, lpstrFileURLPrefix); + SecureHelper::strcat_x(lpstrFileURL, cchLength, szBuff); + + return TRUE; + } + + BOOL GetRoot(LPTSTR lpstrRoot, int cchLength) const + { + ATLASSERT(m_hFind != NULL); + if(lstrlen(m_lpszRoot) >= cchLength) + return FALSE; + + SecureHelper::strcpy_x(lpstrRoot, cchLength, m_lpszRoot); + + return TRUE; + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + _CSTRING_NS::CString GetFileName() const + { + ATLASSERT(m_hFind != NULL); + + _CSTRING_NS::CString ret; + + if(m_bFound) + ret = m_fd.cFileName; + return ret; + } + + _CSTRING_NS::CString GetFilePath() const + { + ATLASSERT(m_hFind != NULL); + + _CSTRING_NS::CString strResult = m_lpszRoot; + int nLen = strResult.GetLength(); +#ifndef _WIN32_WCE + ATLASSERT(nLen > 0); + if(nLen == 0) + return strResult; + + if((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/'))) +#else // CE specific + // allow diskless devices (nLen == 0) + if((nLen == 0) || ((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/')))) +#endif // _WIN32_WCE + strResult += m_chDirSeparator; + strResult += GetFileName(); + return strResult; + } + +#ifndef _WIN32_WCE + _CSTRING_NS::CString GetFileTitle() const + { + ATLASSERT(m_hFind != NULL); + + _CSTRING_NS::CString strResult; + GetFileTitle(strResult.GetBuffer(MAX_PATH), MAX_PATH); + strResult.ReleaseBuffer(); + + return strResult; + } +#endif // !_WIN32_WCE + + _CSTRING_NS::CString GetFileURL() const + { + ATLASSERT(m_hFind != NULL); + + _CSTRING_NS::CString strResult("file://"); + strResult += GetFilePath(); + return strResult; + } + + _CSTRING_NS::CString GetRoot() const + { + ATLASSERT(m_hFind != NULL); + + _CSTRING_NS::CString str = m_lpszRoot; + return str; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + BOOL GetLastWriteTime(FILETIME* pTimeStamp) const + { + ATLASSERT(m_hFind != NULL); + ATLASSERT(pTimeStamp != NULL); + + if(m_bFound && pTimeStamp != NULL) + { + *pTimeStamp = m_fd.ftLastWriteTime; + return TRUE; + } + + return FALSE; + } + + BOOL GetLastAccessTime(FILETIME* pTimeStamp) const + { + ATLASSERT(m_hFind != NULL); + ATLASSERT(pTimeStamp != NULL); + + if(m_bFound && pTimeStamp != NULL) + { + *pTimeStamp = m_fd.ftLastAccessTime; + return TRUE; + } + + return FALSE; + } + + BOOL GetCreationTime(FILETIME* pTimeStamp) const + { + ATLASSERT(m_hFind != NULL); + + if(m_bFound && pTimeStamp != NULL) + { + *pTimeStamp = m_fd.ftCreationTime; + return TRUE; + } + + return FALSE; + } + + BOOL MatchesMask(DWORD dwMask) const + { + ATLASSERT(m_hFind != NULL); + + if(m_bFound) + return ((m_fd.dwFileAttributes & dwMask) != 0); + + return FALSE; + } + + BOOL IsDots() const + { + ATLASSERT(m_hFind != NULL); + + // return TRUE if the file name is "." or ".." and + // the file is a directory + + BOOL bResult = FALSE; + if(m_bFound && IsDirectory()) + { + if(m_fd.cFileName[0] == _T('.') && (m_fd.cFileName[1] == _T('\0') || (m_fd.cFileName[1] == _T('.') && m_fd.cFileName[2] == _T('\0')))) + bResult = TRUE; + } + + return bResult; + } + + BOOL IsReadOnly() const + { + return MatchesMask(FILE_ATTRIBUTE_READONLY); + } + + BOOL IsDirectory() const + { + return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); + } + + BOOL IsCompressed() const + { + return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); + } + + BOOL IsSystem() const + { + return MatchesMask(FILE_ATTRIBUTE_SYSTEM); + } + + BOOL IsHidden() const + { + return MatchesMask(FILE_ATTRIBUTE_HIDDEN); + } + + BOOL IsTemporary() const + { + return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); + } + + BOOL IsNormal() const + { + return MatchesMask(FILE_ATTRIBUTE_NORMAL); + } + + BOOL IsArchived() const + { + return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); + } + +// Operations + BOOL FindFile(LPCTSTR pstrName = NULL) + { + Close(); + + if(pstrName == NULL) + { + pstrName = _T("*.*"); + } + else if(lstrlen(pstrName) >= MAX_PATH) + { + ATLASSERT(FALSE); + return FALSE; + } + + SecureHelper::strcpy_x(m_fd.cFileName, _countof(m_fd.cFileName), pstrName); + + m_hFind = ::FindFirstFile(pstrName, &m_fd); + + if(m_hFind == INVALID_HANDLE_VALUE) + return FALSE; + +#ifndef _WIN32_WCE + bool bFullPath = (::GetFullPathName(pstrName, MAX_PATH, m_lpszRoot, NULL) != 0); +#else // CE specific + errno_t nRet = SecureHelper::strncpy_x(m_lpszRoot, _countof(m_lpszRoot), pstrName, _TRUNCATE); + bool bFullPath = (nRet == 0 || nRet == STRUNCATE); +#endif // _WIN32_WCE + + // passed name isn't a valid path but was found by the API + ATLASSERT(bFullPath); + if(!bFullPath) + { + Close(); + ::SetLastError(ERROR_INVALID_NAME); + return FALSE; + } + else + { + // find the last forward or backward whack + LPTSTR pstrBack = (LPTSTR)_cstrrchr(m_lpszRoot, _T('\\')); + LPTSTR pstrFront = (LPTSTR)_cstrrchr(m_lpszRoot, _T('/')); + + if(pstrFront != NULL || pstrBack != NULL) + { + if(pstrFront == NULL) + pstrFront = m_lpszRoot; + if(pstrBack == NULL) + pstrBack = m_lpszRoot; + + // from the start to the last whack is the root + + if(pstrFront >= pstrBack) + *pstrFront = _T('\0'); + else + *pstrBack = _T('\0'); + } + } + + m_bFound = TRUE; + + return TRUE; + } + + BOOL FindNextFile() + { + ATLASSERT(m_hFind != NULL); + + if(m_hFind == NULL) + return FALSE; + + if(!m_bFound) + return FALSE; + + m_bFound = ::FindNextFile(m_hFind, &m_fd); + + return m_bFound; + } + + void Close() + { + m_bFound = FALSE; + + if(m_hFind != NULL && m_hFind != INVALID_HANDLE_VALUE) + { + ::FindClose(m_hFind); + m_hFind = NULL; + } + } + +// Helper + static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) + { +#ifdef _ATL_MIN_CRT + const TCHAR* lpsz = NULL; + while (*p != 0) + { + if (*p == ch) + lpsz = p; + p = ::CharNext(p); + } + return lpsz; +#else // !_ATL_MIN_CRT + return _tcsrchr(p, ch); +#endif // !_ATL_MIN_CRT + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// Global functions for loading resources + +inline HACCEL AtlLoadAccelerators(ATL::_U_STRINGorID table) +{ + return ::LoadAccelerators(ModuleHelper::GetResourceInstance(), table.m_lpstr); +} + +inline HMENU AtlLoadMenu(ATL::_U_STRINGorID menu) +{ + return ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); +} + +inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap) +{ + return ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); +} + +#ifdef OEMRESOURCE +inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap) +{ +#ifdef _DEBUG + WORD wID = (WORD)bitmap.m_lpstr; + ATLASSERT(wID >= 32734 && wID <= 32767); +#endif // _DEBUG + return ::LoadBitmap(NULL, bitmap.m_lpstr); +} +#endif // OEMRESOURCE + +inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor) +{ + return ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); +} + +inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName) +{ +#if (WINVER >= 0x0500) + ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || + lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || + lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || + lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || + lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP || + lpCursorName == IDC_HAND); +#else // !(WINVER >= 0x0500) + ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || + lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || + lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || + lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || + lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP); +#endif // !(WINVER >= 0x0500) + return ::LoadCursor(NULL, lpCursorName); +} + +inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon) +{ + return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); +} + +#ifndef _WIN32_WCE +inline HICON AtlLoadSysIcon(LPCTSTR lpIconName) +{ +#if (WINVER >= 0x0600) + ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || + lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO || + lpIconName == IDI_SHIELD); +#else // !(WINVER >= 0x0600) + ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || + lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO); +#endif // !(WINVER >= 0x0600) + return ::LoadIcon(NULL, lpIconName); +} +#endif // !_WIN32_WCE + +inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR) +{ + return (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, IMAGE_BITMAP, 0, 0, fuLoad); +} + +inline HCURSOR AtlLoadCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) +{ + return (HCURSOR)::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); +} + +inline HICON AtlLoadIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) +{ + return (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); +} + +#ifdef OEMRESOURCE +inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR) +{ + ATLASSERT(wBitmapID >= 32734 && wBitmapID <= 32767); + ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file + return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad); +} +#endif // OEMRESOURCE + +inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) +{ +#ifdef _DEBUG + WORD wID = (WORD)cursor.m_lpstr; + ATLASSERT((wID >= 32512 && wID <= 32516) || (wID >= 32640 && wID <= 32648) || (wID == 32650) || (wID == 32651)); + ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file +#endif // _DEBUG + return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); +} + +inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) +{ +#ifdef _DEBUG + WORD wID = (WORD)icon.m_lpstr; + ATLASSERT(wID >= 32512 && wID <= 32517); + ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file +#endif // _DEBUG + return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); +} + +#if (_ATL_VER < 0x0700) +inline int AtlLoadString(UINT uID, LPTSTR lpBuffer, int nBufferMax) +{ + return ::LoadString(_Module.GetResourceInstance(), uID, lpBuffer, nBufferMax); +} +#endif // (_ATL_VER < 0x0700) + +#ifdef _WIN32_WCE // CE only direct access to the resource +inline LPCTSTR AtlLoadString(UINT uID) +{ + LPCTSTR s = (LPCTSTR)::LoadString(ModuleHelper::GetResourceInstance(), uID, NULL, 0); +#ifdef DEBUG // Check for null-termination + if(s != NULL) + // Note: RC -n compiles null-terminated resource strings + ATLASSERT(s[*((WORD*)s -1) - 1] == L'\0'); +#endif + return s; +} +#endif // _WIN32_WCE + +inline bool AtlLoadString(UINT uID, BSTR& bstrText) +{ + USES_CONVERSION; + ATLASSERT(bstrText == NULL); + + LPTSTR lpstrText = NULL; + int nRes = 0; + for(int nLen = 256; ; nLen *= 2) + { + ATLTRY(lpstrText = new TCHAR[nLen]); + if(lpstrText == NULL) + break; + nRes = ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpstrText, nLen); + if(nRes < nLen - 1) + break; + delete [] lpstrText; + lpstrText = NULL; + } + + if(lpstrText != NULL) + { + if(nRes != 0) + bstrText = ::SysAllocString(T2OLE(lpstrText)); + delete [] lpstrText; + } + + return (bstrText != NULL) ? true : false; +} + + +/////////////////////////////////////////////////////////////////////////////// +// Global functions for stock GDI objects + +inline HPEN AtlGetStockPen(int nPen) +{ +#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) + ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); +#else + ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); +#endif + return (HPEN)::GetStockObject(nPen); +} + +inline HBRUSH AtlGetStockBrush(int nBrush) +{ +#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) + ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); +#else + ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); +#endif + return (HBRUSH)::GetStockObject(nBrush); +} + +inline HFONT AtlGetStockFont(int nFont) +{ +#ifndef _WIN32_WCE + ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); +#else // CE specific + ATLASSERT(nFont == SYSTEM_FONT); +#endif // _WIN32_WCE + return (HFONT)::GetStockObject(nFont); +} + +inline HPALETTE AtlGetStockPalette(int nPalette) +{ + ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported + return (HPALETTE)::GetStockObject(nPalette); +} + + +/////////////////////////////////////////////////////////////////////////////// +// Global function for compacting a path by replacing parts with ellipsis + +// helper for multi-byte character sets +inline bool _IsDBCSTrailByte(LPCTSTR lpstr, int nChar) +{ +#ifndef _UNICODE + int i = nChar; + for( ; i > 0; i--) + { + if(!::IsDBCSLeadByte(lpstr[i - 1])) + break; + } + return ((nChar > 0) && (((nChar - i) & 1) != 0)); +#else // _UNICODE + lpstr; nChar; + return false; +#endif // _UNICODE +} + +inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) +{ + ATLASSERT(lpstrOut != NULL); + ATLASSERT(lpstrIn != NULL); + ATLASSERT(cchLen > 0); + + LPCTSTR szEllipsis = _T("..."); + const int cchEndEllipsis = 3; + const int cchMidEllipsis = 4; + + if(lstrlen(lpstrIn) < cchLen) + { + SecureHelper::strcpy_x(lpstrOut, cchLen, lpstrIn); + return true; + } + + lpstrOut[0] = 0; + + // check if the separator is a slash or a backslash + TCHAR chSlash = _T('\\'); + for(LPTSTR lpstr = (LPTSTR)lpstrIn; *lpstr != 0; lpstr = ::CharNext(lpstr)) + { + if((*lpstr == _T('/')) || (*lpstr == _T('\\'))) + chSlash = *lpstr; + } + + // find the filename portion of the path + LPCTSTR lpstrFileName = lpstrIn; + for(LPCTSTR pPath = lpstrIn; *pPath; pPath = ::CharNext(pPath)) + { + if((pPath[0] == _T('\\') || pPath[0] == _T(':') || pPath[0] == _T('/')) + && pPath[1] && pPath[1] != _T('\\') && pPath[1] != _T('/')) + lpstrFileName = pPath + 1; + } + int cchFileName = lstrlen(lpstrFileName); + + // handle just the filename without a path + if(lpstrFileName == lpstrIn && cchLen > cchEndEllipsis) + { + bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchLen - cchEndEllipsis - 1) == 0); + if(bRet) + { +#ifndef _UNICODE + if(_IsDBCSTrailByte(lpstrIn, cchLen - cchEndEllipsis)) + lpstrOut[cchLen - cchEndEllipsis - 1] = 0; +#endif // _UNICODE + SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); + } + return bRet; + } + + // handle just ellipsis + if((cchLen < (cchMidEllipsis + cchEndEllipsis))) + { + for(int i = 0; i < cchLen - 1; i++) + lpstrOut[i] = ((i + 1) == cchMidEllipsis) ? chSlash : _T('.'); + lpstrOut[cchLen - 1] = 0; + return true; + } + + // calc how much we have to copy + int cchToCopy = cchLen - (cchMidEllipsis + cchFileName) - 1; + + if(cchToCopy < 0) + cchToCopy = 0; + +#ifndef _UNICODE + if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrIn, cchToCopy)) + cchToCopy--; +#endif // _UNICODE + + bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchToCopy) == 0); + if(!bRet) + return false; + + // add ellipsis + SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); + if(!bRet) + return false; + TCHAR szSlash[2] = { chSlash, 0 }; + SecureHelper::strcat_x(lpstrOut, cchLen, szSlash); + if(!bRet) + return false; + + // add filename (and ellipsis, if needed) + if(cchLen > (cchMidEllipsis + cchFileName)) + { + SecureHelper::strcat_x(lpstrOut, cchLen, lpstrFileName); + } + else + { + cchToCopy = cchLen - cchMidEllipsis - cchEndEllipsis - 1; +#ifndef _UNICODE + if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrFileName, cchToCopy)) + cchToCopy--; +#endif // _UNICODE + bRet = (SecureHelper::strncpy_x(&lpstrOut[cchMidEllipsis], cchLen - cchMidEllipsis, lpstrFileName, cchToCopy) == 0); + if(bRet) + SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); + } + + return bRet; +} + +}; // namespace WTL + +#endif // __ATLMISC_H__ diff --git a/Externals/WTL80/atlprint.h b/Externals/WTL80/atlprint.h index fed9a3fba3..201cb4e496 100644 --- a/Externals/WTL80/atlprint.h +++ b/Externals/WTL80/atlprint.h @@ -1,1113 +1,1113 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLPRINT_H__ -#define __ATLPRINT_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifdef _WIN32_WCE - #error atlprint.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atlprint.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlprint.h requires atlwin.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CPrinterInfo -// CPrinterT -// CDevModeT -// CPrinterDC -// CPrintJobInfo -// CPrintJob -// CPrintPreview -// CPrintPreviewWindowImpl -// CPrintPreviewWindow -// CZoomPrintPreviewWindowImpl -// CZoomPrintPreviewWindow - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CPrinterInfo - This class wraps all of the PRINTER_INFO_* structures -// and provided by ::GetPrinter. - -template -class _printer_info -{ -public: - typedef void infotype; -}; - -template <> class _printer_info<1> { public: typedef PRINTER_INFO_1 infotype; }; -template <> class _printer_info<2> { public: typedef PRINTER_INFO_2 infotype; }; -template <> class _printer_info<3> { public: typedef PRINTER_INFO_3 infotype; }; -template <> class _printer_info<4> { public: typedef PRINTER_INFO_4 infotype; }; -template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; }; -template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; }; -template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; }; -// these are not in the old (vc6.0) headers -#ifdef _ATL_USE_NEW_PRINTER_INFO -template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; }; -template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; }; -#endif // _ATL_USE_NEW_PRINTER_INFO - - -template -class CPrinterInfo -{ -public: -// Data members - typename _printer_info::infotype* m_pi; - -// Constructor/destructor - CPrinterInfo() : m_pi(NULL) - { } - - CPrinterInfo(HANDLE hPrinter) : m_pi(NULL) - { - GetPrinterInfo(hPrinter); - } - - ~CPrinterInfo() - { - Cleanup(); - } - -// Operations - bool GetPrinterInfo(HANDLE hPrinter) - { - Cleanup(); - return GetPrinterInfoHelper(hPrinter, (BYTE**)&m_pi, t_nInfo); - } - -// Implementation - void Cleanup() - { - delete [] (BYTE*)m_pi; - m_pi = NULL; - } - - static bool GetPrinterInfoHelper(HANDLE hPrinter, BYTE** pi, int nIndex) - { - ATLASSERT(pi != NULL); - DWORD dw = 0; - BYTE* pb = NULL; - ::GetPrinter(hPrinter, nIndex, NULL, 0, &dw); - if (dw > 0) - { - ATLTRY(pb = new BYTE[dw]); - if (pb != NULL) - { - memset(pb, 0, dw); - DWORD dwNew; - if (!::GetPrinter(hPrinter, nIndex, pb, dw, &dwNew)) - { - delete [] pb; - pb = NULL; - } - } - } - *pi = pb; - return (pb != NULL); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrinter - Wrapper class for a HANDLE to a printer - -template -class CPrinterT -{ -public: -// Data members - HANDLE m_hPrinter; - -// Constructor/destructor - CPrinterT(HANDLE hPrinter = NULL) : m_hPrinter(hPrinter) - { } - - ~CPrinterT() - { - ClosePrinter(); - } - -// Operations - CPrinterT& operator =(HANDLE hPrinter) - { - if (hPrinter != m_hPrinter) - { - ClosePrinter(); - m_hPrinter = hPrinter; - } - return *this; - } - - bool IsNull() const { return (m_hPrinter == NULL); } - - bool OpenPrinter(HANDLE hDevNames, const DEVMODE* pDevMode = NULL) - { - bool b = false; - DEVNAMES* pdn = (DEVNAMES*)::GlobalLock(hDevNames); - if (pdn != NULL) - { - LPTSTR lpszPrinterName = (LPTSTR)pdn + pdn->wDeviceOffset; - b = OpenPrinter(lpszPrinterName, pDevMode); - ::GlobalUnlock(hDevNames); - } - return b; - } - - bool OpenPrinter(LPCTSTR lpszPrinterName, const DEVMODE* pDevMode = NULL) - { - ClosePrinter(); - PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; - ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); - - return (m_hPrinter != NULL); - } - - bool OpenPrinter(LPCTSTR lpszPrinterName, PRINTER_DEFAULTS* pprintdefs) - { - ClosePrinter(); - ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, pprintdefs); - return (m_hPrinter != NULL); - } - - bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL) - { - ClosePrinter(); - const int cchBuff = 512; - TCHAR buffer[cchBuff]; - buffer[0] = 0; - ::GetProfileString(_T("windows"), _T("device"), _T(",,,"), buffer, cchBuff); - int nLen = lstrlen(buffer); - if (nLen != 0) - { - LPTSTR lpsz = buffer; - while (*lpsz) - { - if (*lpsz == _T(',')) - { - *lpsz = 0; - break; - } - lpsz = CharNext(lpsz); - } - PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; - ::OpenPrinter(buffer, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); - } - return m_hPrinter != NULL; - } - - void ClosePrinter() - { - if (m_hPrinter != NULL) - { - if (t_bManaged) - ::ClosePrinter(m_hPrinter); - m_hPrinter = NULL; - } - } - - bool PrinterProperties(HWND hWnd = NULL) - { - if (hWnd == NULL) - hWnd = ::GetActiveWindow(); - return !!::PrinterProperties(hWnd, m_hPrinter); - } - - HANDLE CopyToHDEVNAMES() const - { - HANDLE h = NULL; - CPrinterInfo<5> pinfon5; - CPrinterInfo<2> pinfon2; - LPTSTR lpszPrinterName = NULL; - // Some printers fail for PRINTER_INFO_5 in some situations - if (pinfon5.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfon5.m_pi->pPrinterName; - else if (pinfon2.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfon2.m_pi->pPrinterName; - if (lpszPrinterName != NULL) - { - int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR); - h = ::GlobalAlloc(GMEM_MOVEABLE, nLen); - BYTE* pv = (BYTE*)::GlobalLock(h); - DEVNAMES* pdev = (DEVNAMES*)pv; - if (pv != NULL) - { - memset(pv, 0, nLen); - pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR); - pv = pv + sizeof(DEVNAMES); // now points to end - SecureHelper::strcpy_x((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName); - ::GlobalUnlock(h); - } - } - return h; - } - - HDC CreatePrinterDC(const DEVMODE* pdm = NULL) const - { - CPrinterInfo<5> pinfo5; - CPrinterInfo<2> pinfo2; - HDC hDC = NULL; - LPTSTR lpszPrinterName = NULL; - // Some printers fail for PRINTER_INFO_5 in some situations - if (pinfo5.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo5.m_pi->pPrinterName; - else if (pinfo2.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo2.m_pi->pPrinterName; - if (lpszPrinterName != NULL) - hDC = ::CreateDC(NULL, lpszPrinterName, NULL, pdm); - return hDC; - } - - HDC CreatePrinterIC(const DEVMODE* pdm = NULL) const - { - CPrinterInfo<5> pinfo5; - CPrinterInfo<2> pinfo2; - HDC hDC = NULL; - LPTSTR lpszPrinterName = NULL; - // Some printers fail for PRINTER_INFO_5 in some situations - if (pinfo5.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo5.m_pi->pPrinterName; - else if (pinfo2.GetPrinterInfo(m_hPrinter)) - lpszPrinterName = pinfo2.m_pi->pPrinterName; - if (lpszPrinterName != NULL) - hDC = ::CreateIC(NULL, lpszPrinterName, NULL, pdm); - return hDC; - } - - void Attach(HANDLE hPrinter) - { - ClosePrinter(); - m_hPrinter = hPrinter; - } - - HANDLE Detach() - { - HANDLE hPrinter = m_hPrinter; - m_hPrinter = NULL; - return hPrinter; - } - - operator HANDLE() const { return m_hPrinter; } -}; - -typedef CPrinterT CPrinterHandle; -typedef CPrinterT CPrinter; - - -/////////////////////////////////////////////////////////////////////////////// -// CDevMode - Wrapper class for DEVMODE - -template -class CDevModeT -{ -public: -// Data members - HANDLE m_hDevMode; - DEVMODE* m_pDevMode; - -// Constructor/destructor - CDevModeT(HANDLE hDevMode = NULL) : m_hDevMode(hDevMode) - { - m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; - } - - ~CDevModeT() - { - Cleanup(); - } - -// Operations - CDevModeT& operator =(HANDLE hDevMode) - { - Attach(hDevMode); - return *this; - } - - void Attach(HANDLE hDevModeNew) - { - Cleanup(); - m_hDevMode = hDevModeNew; - m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; - } - - HANDLE Detach() - { - if (m_hDevMode != NULL) - ::GlobalUnlock(m_hDevMode); - HANDLE hDevMode = m_hDevMode; - m_hDevMode = NULL; - return hDevMode; - } - - bool IsNull() const { return (m_hDevMode == NULL); } - - bool CopyFromPrinter(HANDLE hPrinter) - { - CPrinterInfo<2> pinfo; - bool b = pinfo.GetPrinterInfo(hPrinter); - if (b) - b = CopyFromDEVMODE(pinfo.m_pi->pDevMode); - return b; - } - - bool CopyFromDEVMODE(const DEVMODE* pdm) - { - if (pdm == NULL) - return false; - int nSize = pdm->dmSize + pdm->dmDriverExtra; - HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); - if (h != NULL) - { - void* p = ::GlobalLock(h); - SecureHelper::memcpy_x(p, nSize, pdm, nSize); - ::GlobalUnlock(h); - } - Attach(h); - return (h != NULL); - } - - bool CopyFromHDEVMODE(HANDLE hdm) - { - bool b = false; - if (hdm != NULL) - { - DEVMODE* pdm = (DEVMODE*)::GlobalLock(hdm); - b = CopyFromDEVMODE(pdm); - ::GlobalUnlock(hdm); - } - return b; - } - - HANDLE CopyToHDEVMODE() - { - if ((m_hDevMode == NULL) || (m_pDevMode == NULL)) - return NULL; - int nSize = m_pDevMode->dmSize + m_pDevMode->dmDriverExtra; - HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); - if (h != NULL) - { - void* p = ::GlobalLock(h); - SecureHelper::memcpy_x(p, nSize, m_pDevMode, nSize); - ::GlobalUnlock(h); - } - return h; - } - - // If this devmode was for another printer, this will create a new devmode - // based on the existing devmode, but retargeted at the new printer - bool UpdateForNewPrinter(HANDLE hPrinter) - { - bool bRet = false; - LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0); - CTempBuffer buff; - DEVMODE* pdm = buff.AllocateBytes(nLen); - if(pdm != NULL) - { - memset(pdm, 0, nLen); - LONG l = ::DocumentProperties(NULL, hPrinter, NULL, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER); - if (l == IDOK) - bRet = CopyFromDEVMODE(pdm); - } - - return bRet; - } - - bool DocumentProperties(HANDLE hPrinter, HWND hWnd = NULL) - { - CPrinterInfo<1> pi; - pi.GetPrinterInfo(hPrinter); - if (hWnd == NULL) - hWnd = ::GetActiveWindow(); - - bool bRet = false; - LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0); - CTempBuffer buff; - DEVMODE* pdm = buff.AllocateBytes(nLen); - if(pdm != NULL) - { - memset(pdm, 0, nLen); - LONG l = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER | DM_PROMPT); - if (l == IDOK) - bRet = CopyFromDEVMODE(pdm); - } - - return bRet; - } - - operator HANDLE() const { return m_hDevMode; } - - operator DEVMODE*() const { return m_pDevMode; } - -// Implementation - void Cleanup() - { - if (m_hDevMode != NULL) - { - ::GlobalUnlock(m_hDevMode); - if(t_bManaged) - ::GlobalFree(m_hDevMode); - m_hDevMode = NULL; - } - } -}; - -typedef CDevModeT CDevModeHandle; -typedef CDevModeT CDevMode; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrinterDC - -class CPrinterDC : public CDC -{ -public: -// Constructors/destructor - CPrinterDC() - { - CPrinter printer; - printer.OpenDefaultPrinter(); - Attach(printer.CreatePrinterDC()); - ATLASSERT(m_hDC != NULL); - } - - CPrinterDC(HANDLE hPrinter, const DEVMODE* pdm = NULL) - { - CPrinterHandle p; - p.Attach(hPrinter); - Attach(p.CreatePrinterDC(pdm)); - ATLASSERT(m_hDC != NULL); - } - - ~CPrinterDC() - { - DeleteDC(); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintJob - Wraps a set of tasks for a specific printer (StartDoc/EndDoc) -// Handles aborting, background printing - -// Defines callbacks used by CPrintJob (not a COM interface) -class ATL_NO_VTABLE IPrintJobInfo -{ -public: - virtual void BeginPrintJob(HDC hDC) = 0; // allocate handles needed, etc. - virtual void EndPrintJob(HDC hDC, bool bAborted) = 0; // free handles, etc. - virtual void PrePrintPage(UINT nPage, HDC hDC) = 0; - virtual bool PrintPage(UINT nPage, HDC hDC) = 0; - virtual void PostPrintPage(UINT nPage, HDC hDC) = 0; - // If you want per page devmodes, return the DEVMODE* to use for nPage. - // You can optimize by only returning a new DEVMODE* when it is different - // from the one for nLastPage, otherwise return NULL. - // When nLastPage==0, the current DEVMODE* will be the default passed to - // StartPrintJob. - // Note: During print preview, nLastPage will always be "0". - virtual DEVMODE* GetNewDevModeForPage(UINT nLastPage, UINT nPage) = 0; - virtual bool IsValidPage(UINT nPage) = 0; -}; - -// Provides a default implementatin for IPrintJobInfo -// Typically, MI'd into a document or view class -class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo -{ -public: - virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc - { - } - - virtual void EndPrintJob(HDC /*hDC*/, bool /*bAborted*/) // free handles, etc - { - } - - virtual void PrePrintPage(UINT /*nPage*/, HDC hDC) - { - m_nPJState = ::SaveDC(hDC); - } - - virtual bool PrintPage(UINT /*nPage*/, HDC /*hDC*/) = 0; - - virtual void PostPrintPage(UINT /*nPage*/, HDC hDC) - { - RestoreDC(hDC, m_nPJState); - } - - virtual DEVMODE* GetNewDevModeForPage(UINT /*nLastPage*/, UINT /*nPage*/) - { - return NULL; - } - - virtual bool IsValidPage(UINT /*nPage*/) - { - return true; - } - -// Implementation - data - int m_nPJState; -}; - - -class CPrintJob -{ -public: -// Data members - CPrinterHandle m_printer; - IPrintJobInfo* m_pInfo; - DEVMODE* m_pDefDevMode; - DOCINFO m_docinfo; - int m_nJobID; - bool m_bCancel; - bool m_bComplete; - unsigned long m_nStartPage; - unsigned long m_nEndPage; - -// Constructor/destructor - CPrintJob() : m_nJobID(0), m_bCancel(false), m_bComplete(true) - { } - - ~CPrintJob() - { - ATLASSERT(IsJobComplete()); // premature destruction? - } - -// Operations - bool IsJobComplete() const - { - return m_bComplete; - } - - bool StartPrintJob(bool bBackground, HANDLE hPrinter, DEVMODE* pDefaultDevMode, - IPrintJobInfo* pInfo, LPCTSTR lpszDocName, - unsigned long nStartPage, unsigned long nEndPage, - bool bPrintToFile = false, LPCTSTR lpstrOutputFile = NULL) - { - ATLASSERT(m_bComplete); // previous job not done yet? - if (pInfo == NULL) - return false; - - memset(&m_docinfo, 0, sizeof(m_docinfo)); - m_docinfo.cbSize = sizeof(m_docinfo); - m_docinfo.lpszDocName = lpszDocName; - m_pInfo = pInfo; - m_nStartPage = nStartPage; - m_nEndPage = nEndPage; - m_printer.Attach(hPrinter); - m_pDefDevMode = pDefaultDevMode; - m_bComplete = false; - - if(bPrintToFile) - m_docinfo.lpszOutput = (lpstrOutputFile != NULL) ? lpstrOutputFile : _T("FILE:"); - - if (!bBackground) - { - m_bComplete = true; - return StartHelper(); - } - - // Create a thread and return - DWORD dwThreadID = 0; -#if !defined(_ATL_MIN_CRT) && defined(_MT) - HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID); -#else - HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID); -#endif - if (hThread == NULL) - return false; - - ::CloseHandle(hThread); - - return true; - } - -// Implementation - static DWORD WINAPI StartProc(void* p) - { - CPrintJob* pThis = (CPrintJob*)p; - pThis->StartHelper(); - pThis->m_bComplete = true; - return 0; - } - - bool StartHelper() - { - CDC dcPrinter; - dcPrinter.Attach(m_printer.CreatePrinterDC(m_pDefDevMode)); - if (dcPrinter.IsNull()) - return false; - - m_nJobID = ::StartDoc(dcPrinter, &m_docinfo); - if (m_nJobID <= 0) - return false; - - m_pInfo->BeginPrintJob(dcPrinter); - - // print all the pages now - unsigned long nLastPage = 0; - for (unsigned long nPage = m_nStartPage; nPage <= m_nEndPage; nPage++) - { - if (!m_pInfo->IsValidPage(nPage)) - break; - DEVMODE* pdm = m_pInfo->GetNewDevModeForPage(nLastPage, nPage); - if (pdm != NULL) - dcPrinter.ResetDC(pdm); - dcPrinter.StartPage(); - m_pInfo->PrePrintPage(nPage, dcPrinter); - if (!m_pInfo->PrintPage(nPage, dcPrinter)) - m_bCancel = true; - m_pInfo->PostPrintPage(nPage, dcPrinter); - dcPrinter.EndPage(); - if (m_bCancel) - break; - nLastPage = nPage; - } - - m_pInfo->EndPrintJob(dcPrinter, m_bCancel); - if (m_bCancel) - ::AbortDoc(dcPrinter); - else - ::EndDoc(dcPrinter); - m_nJobID = 0; - return true; - } - - // Cancels a print job. Can be called asynchronously. - void CancelPrintJob() - { - m_bCancel = true; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintPreview - Adds print preview support to an existing window - -class CPrintPreview -{ -public: -// Data members - IPrintJobInfo* m_pInfo; - CPrinterHandle m_printer; - CEnhMetaFile m_meta; - DEVMODE* m_pDefDevMode; - DEVMODE* m_pCurDevMode; - SIZE m_sizeCurPhysOffset; - -// Constructor - CPrintPreview() : m_pInfo(NULL), m_pDefDevMode(NULL), m_pCurDevMode(NULL) - { - m_sizeCurPhysOffset.cx = 0; - m_sizeCurPhysOffset.cy = 0; - } - -// Operations - void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, IPrintJobInfo* pji) - { - m_printer.Attach(hPrinter); - m_pDefDevMode = pDefaultDevMode; - m_pInfo = pji; - m_nCurPage = 0; - m_pCurDevMode = NULL; - } - - void SetEnhMetaFile(HENHMETAFILE hEMF) - { - m_meta = hEMF; - } - - void SetPage(int nPage) - { - if (!m_pInfo->IsValidPage(nPage)) - return; - m_nCurPage = nPage; - m_pCurDevMode = m_pInfo->GetNewDevModeForPage(0, nPage); - if (m_pCurDevMode == NULL) - m_pCurDevMode = m_pDefDevMode; - CDC dcPrinter = m_printer.CreatePrinterDC(m_pCurDevMode); - - int iWidth = dcPrinter.GetDeviceCaps(PHYSICALWIDTH); - int iHeight = dcPrinter.GetDeviceCaps(PHYSICALHEIGHT); - int nLogx = dcPrinter.GetDeviceCaps(LOGPIXELSX); - int nLogy = dcPrinter.GetDeviceCaps(LOGPIXELSY); - - RECT rcMM = { 0, 0, ::MulDiv(iWidth, 2540, nLogx), ::MulDiv(iHeight, 2540, nLogy) }; - - m_sizeCurPhysOffset.cx = dcPrinter.GetDeviceCaps(PHYSICALOFFSETX); - m_sizeCurPhysOffset.cy = dcPrinter.GetDeviceCaps(PHYSICALOFFSETY); - - CEnhMetaFileDC dcMeta(dcPrinter, &rcMM); - m_pInfo->PrePrintPage(nPage, dcMeta); - m_pInfo->PrintPage(nPage, dcMeta); - m_pInfo->PostPrintPage(nPage, dcMeta); - m_meta.Attach(dcMeta.Close()); - } - - void GetPageRect(RECT& rc, LPRECT prc) - { - int x1 = rc.right-rc.left; - int y1 = rc.bottom - rc.top; - if ((x1 < 0) || (y1 < 0)) - return; - - CEnhMetaFileInfo emfinfo(m_meta); - ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - - // Compute whether we are OK vertically or horizontally - int x2 = pmh->szlDevice.cx; - int y2 = pmh->szlDevice.cy; - int y1p = MulDiv(x1, y2, x2); - int x1p = MulDiv(y1, x2, y2); - ATLASSERT((x1p <= x1) || (y1p <= y1)); - if (x1p <= x1) - { - prc->left = rc.left + (x1 - x1p) / 2; - prc->right = prc->left + x1p; - prc->top = rc.top; - prc->bottom = rc.bottom; - } - else - { - prc->left = rc.left; - prc->right = rc.right; - prc->top = rc.top + (y1 - y1p) / 2; - prc->bottom = prc->top + y1p; - } - } - -// Painting helpers - void DoPaint(CDCHandle dc) - { - // this one is not used - } - - void DoPaint(CDCHandle dc, RECT& rc) - { - CEnhMetaFileInfo emfinfo(m_meta); - ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); - int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); - - dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); - dc.PlayMetaFile(m_meta, &rc); - } - -// Implementation - data - int m_nCurPage; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPrintPreviewWindow - Implements a print preview window - -template -class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImpl, public CPrintPreview -{ -public: - DECLARE_WND_CLASS_EX(NULL, CS_VREDRAW | CS_HREDRAW, -1) - - enum { m_cxOffset = 10, m_cyOffset = 10 }; - -// Constructor - CPrintPreviewWindowImpl() : m_nMaxPage(0), m_nMinPage(0) - { } - -// Operations - void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, - IPrintJobInfo* pji, int nMinPage, int nMaxPage) - { - CPrintPreview::SetPrintPreviewInfo(hPrinter, pDefaultDevMode, pji); - m_nMinPage = nMinPage; - m_nMaxPage = nMaxPage; - } - - bool NextPage() - { - if (m_nCurPage == m_nMaxPage) - return false; - SetPage(m_nCurPage + 1); - Invalidate(); - return true; - } - - bool PrevPage() - { - if (m_nCurPage == m_nMinPage) - return false; - if (m_nCurPage == 0) - return false; - SetPage(m_nCurPage - 1); - Invalidate(); - return true; - } - -// Message map and handlers - BEGIN_MSG_MAP(CPrintPreviewWindowImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - END_MSG_MAP() - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no need for the background - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - RECT rc = { 0 }; - - if(wParam != NULL) - { - pT->DoPrePaint((HDC)wParam, rc); - pT->DoPaint((HDC)wParam, rc); - } - else - { - CPaintDC dc(m_hWnd); - pT->DoPrePaint(dc.m_hDC, rc); - pT->DoPaint(dc.m_hDC, rc); - } - - return 0; - } - -// Painting helper - void DoPrePaint(CDCHandle dc, RECT& rc) - { - RECT rcClient = { 0 }; - GetClientRect(&rcClient); - RECT rcArea = rcClient; - T* pT = static_cast(this); - pT; // avoid level 4 warning - ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); - if (rcArea.left > rcArea.right) - rcArea.right = rcArea.left; - if (rcArea.top > rcArea.bottom) - rcArea.bottom = rcArea.top; - GetPageRect(rcArea, &rc); - CRgn rgn1, rgn2; - rgn1.CreateRectRgnIndirect(&rc); - rgn2.CreateRectRgnIndirect(&rcClient); - rgn2.CombineRgn(rgn1, RGN_DIFF); - dc.SelectClipRgn(rgn2); - dc.FillRect(&rcClient, COLOR_BTNSHADOW); - dc.SelectClipRgn(NULL); - dc.FillRect(&rc, (HBRUSH)::GetStockObject(WHITE_BRUSH)); - } - -// Implementation - data - int m_nMinPage; - int m_nMaxPage; -}; - - -class CPrintPreviewWindow : public CPrintPreviewWindowImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_PrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CZoomPrintPreviewWindowImpl - Implements print preview window with zooming - -#ifdef __ATLSCRL_H__ - -template -class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > -{ -public: - bool m_bSized; - - CZoomPrintPreviewWindowImpl() - { - SetScrollExtendedStyle(SCRL_DISABLENOSCROLL); - InitZoom(); - } - - // should be called to reset data members before recreating window - void InitZoom() - { - m_bSized = false; - m_nZoomMode = ZOOMMODE_OFF; - m_fZoomScaleMin = 1.0; - m_fZoomScale = 1.0; - } - - BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl) - MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; - POINT ptOffset = m_ptOffset; - SIZE sizeAll = m_sizeAll; - SetScrollSize(sizeClient); - if(sizeAll.cx > 0) - ptOffset.x = ::MulDiv(ptOffset.x, m_sizeAll.cx, sizeAll.cx); - if(sizeAll.cy > 0) - ptOffset.y = ::MulDiv(ptOffset.y, m_sizeAll.cy, sizeAll.cy); - SetScrollOffset(ptOffset); - CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled); - if(!m_bSized) - { - m_bSized = true; - T* pT = static_cast(this); - pT->ShowScrollBar(SB_HORZ, TRUE); - pT->ShowScrollBar(SB_VERT, TRUE); - } - return 0; - } - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - RECT rc = { 0 }; - - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - int nMapModeSav = dc.GetMapMode(); - dc.SetMapMode(MM_ANISOTROPIC); - SIZE szWindowExt = { 0, 0 }; - dc.SetWindowExt(m_sizeLogAll, &szWindowExt); - SIZE szViewportExt = { 0, 0 }; - dc.SetViewportExt(m_sizeAll, &szViewportExt); - POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - - pT->DoPrePaint(dc, rc); - pT->DoPaint(dc, rc); - - dc.SetMapMode(nMapModeSav); - dc.SetWindowExt(szWindowExt); - dc.SetViewportExt(szViewportExt); - dc.SetViewportOrg(ptViewportOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - pT->DoPrePaint(dc.m_hDC, rc); - pT->DoPaint(dc.m_hDC, rc); - } - - return 0; - } - - // Painting helpers - void DoPaint(CDCHandle dc) - { - // this one is not used - } - - void DoPrePaint(CDCHandle dc, RECT& rc) - { - RECT rcClient; - GetClientRect(&rcClient); - RECT rcArea = rcClient; - T* pT = static_cast(this); - pT; // avoid level 4 warning - ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); - if (rcArea.left > rcArea.right) - rcArea.right = rcArea.left; - if (rcArea.top > rcArea.bottom) - rcArea.bottom = rcArea.top; - GetPageRect(rcArea, &rc); - HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); - dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY); - dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY); - dc.PatBlt(rc.right, rcClient.top, rcClient.right - rc.right, rcClient.bottom - rcClient.top, PATCOPY); - dc.PatBlt(rc.left, rc.bottom, rc.right - rc.left, rcClient.bottom - rc.bottom, PATCOPY); - dc.SelectBrush((HBRUSH)::GetStockObject(WHITE_BRUSH)); - dc.PatBlt(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); - dc.SelectBrush(::GetSysColorBrush(COLOR_3DDKSHADOW)); - dc.PatBlt(rc.right, rc.top + 4, 4, rc.bottom - rc.top, PATCOPY); - dc.PatBlt(rc.left + 4, rc.bottom, rc.right - rc.left, 4, PATCOPY); - dc.SelectBrush(hbrOld); - } - - void DoPaint(CDCHandle dc, RECT& rc) - { - CEnhMetaFileInfo emfinfo(m_meta); - ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); - int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); - - dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); - dc.PlayMetaFile(m_meta, &rc); - } -}; - -class CZoomPrintPreviewWindow : public CZoomPrintPreviewWindowImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_ZoomPrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) -}; - -#endif // __ATLSCRL_H__ - -}; // namespace WTL - -#endif // __ATLPRINT_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLPRINT_H__ +#define __ATLPRINT_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifdef _WIN32_WCE + #error atlprint.h is not supported on Windows CE +#endif + +#ifndef __ATLAPP_H__ + #error atlprint.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atlprint.h requires atlwin.h to be included first +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CPrinterInfo +// CPrinterT +// CDevModeT +// CPrinterDC +// CPrintJobInfo +// CPrintJob +// CPrintPreview +// CPrintPreviewWindowImpl +// CPrintPreviewWindow +// CZoomPrintPreviewWindowImpl +// CZoomPrintPreviewWindow + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CPrinterInfo - This class wraps all of the PRINTER_INFO_* structures +// and provided by ::GetPrinter. + +template +class _printer_info +{ +public: + typedef void infotype; +}; + +template <> class _printer_info<1> { public: typedef PRINTER_INFO_1 infotype; }; +template <> class _printer_info<2> { public: typedef PRINTER_INFO_2 infotype; }; +template <> class _printer_info<3> { public: typedef PRINTER_INFO_3 infotype; }; +template <> class _printer_info<4> { public: typedef PRINTER_INFO_4 infotype; }; +template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; }; +template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; }; +template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; }; +// these are not in the old (vc6.0) headers +#ifdef _ATL_USE_NEW_PRINTER_INFO +template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; }; +template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; }; +#endif // _ATL_USE_NEW_PRINTER_INFO + + +template +class CPrinterInfo +{ +public: +// Data members + typename _printer_info::infotype* m_pi; + +// Constructor/destructor + CPrinterInfo() : m_pi(NULL) + { } + + CPrinterInfo(HANDLE hPrinter) : m_pi(NULL) + { + GetPrinterInfo(hPrinter); + } + + ~CPrinterInfo() + { + Cleanup(); + } + +// Operations + bool GetPrinterInfo(HANDLE hPrinter) + { + Cleanup(); + return GetPrinterInfoHelper(hPrinter, (BYTE**)&m_pi, t_nInfo); + } + +// Implementation + void Cleanup() + { + delete [] (BYTE*)m_pi; + m_pi = NULL; + } + + static bool GetPrinterInfoHelper(HANDLE hPrinter, BYTE** pi, int nIndex) + { + ATLASSERT(pi != NULL); + DWORD dw = 0; + BYTE* pb = NULL; + ::GetPrinter(hPrinter, nIndex, NULL, 0, &dw); + if (dw > 0) + { + ATLTRY(pb = new BYTE[dw]); + if (pb != NULL) + { + memset(pb, 0, dw); + DWORD dwNew; + if (!::GetPrinter(hPrinter, nIndex, pb, dw, &dwNew)) + { + delete [] pb; + pb = NULL; + } + } + } + *pi = pb; + return (pb != NULL); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPrinter - Wrapper class for a HANDLE to a printer + +template +class CPrinterT +{ +public: +// Data members + HANDLE m_hPrinter; + +// Constructor/destructor + CPrinterT(HANDLE hPrinter = NULL) : m_hPrinter(hPrinter) + { } + + ~CPrinterT() + { + ClosePrinter(); + } + +// Operations + CPrinterT& operator =(HANDLE hPrinter) + { + if (hPrinter != m_hPrinter) + { + ClosePrinter(); + m_hPrinter = hPrinter; + } + return *this; + } + + bool IsNull() const { return (m_hPrinter == NULL); } + + bool OpenPrinter(HANDLE hDevNames, const DEVMODE* pDevMode = NULL) + { + bool b = false; + DEVNAMES* pdn = (DEVNAMES*)::GlobalLock(hDevNames); + if (pdn != NULL) + { + LPTSTR lpszPrinterName = (LPTSTR)pdn + pdn->wDeviceOffset; + b = OpenPrinter(lpszPrinterName, pDevMode); + ::GlobalUnlock(hDevNames); + } + return b; + } + + bool OpenPrinter(LPCTSTR lpszPrinterName, const DEVMODE* pDevMode = NULL) + { + ClosePrinter(); + PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; + ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); + + return (m_hPrinter != NULL); + } + + bool OpenPrinter(LPCTSTR lpszPrinterName, PRINTER_DEFAULTS* pprintdefs) + { + ClosePrinter(); + ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, pprintdefs); + return (m_hPrinter != NULL); + } + + bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL) + { + ClosePrinter(); + const int cchBuff = 512; + TCHAR buffer[cchBuff]; + buffer[0] = 0; + ::GetProfileString(_T("windows"), _T("device"), _T(",,,"), buffer, cchBuff); + int nLen = lstrlen(buffer); + if (nLen != 0) + { + LPTSTR lpsz = buffer; + while (*lpsz) + { + if (*lpsz == _T(',')) + { + *lpsz = 0; + break; + } + lpsz = CharNext(lpsz); + } + PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; + ::OpenPrinter(buffer, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); + } + return m_hPrinter != NULL; + } + + void ClosePrinter() + { + if (m_hPrinter != NULL) + { + if (t_bManaged) + ::ClosePrinter(m_hPrinter); + m_hPrinter = NULL; + } + } + + bool PrinterProperties(HWND hWnd = NULL) + { + if (hWnd == NULL) + hWnd = ::GetActiveWindow(); + return !!::PrinterProperties(hWnd, m_hPrinter); + } + + HANDLE CopyToHDEVNAMES() const + { + HANDLE h = NULL; + CPrinterInfo<5> pinfon5; + CPrinterInfo<2> pinfon2; + LPTSTR lpszPrinterName = NULL; + // Some printers fail for PRINTER_INFO_5 in some situations + if (pinfon5.GetPrinterInfo(m_hPrinter)) + lpszPrinterName = pinfon5.m_pi->pPrinterName; + else if (pinfon2.GetPrinterInfo(m_hPrinter)) + lpszPrinterName = pinfon2.m_pi->pPrinterName; + if (lpszPrinterName != NULL) + { + int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR); + h = ::GlobalAlloc(GMEM_MOVEABLE, nLen); + BYTE* pv = (BYTE*)::GlobalLock(h); + DEVNAMES* pdev = (DEVNAMES*)pv; + if (pv != NULL) + { + memset(pv, 0, nLen); + pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR); + pv = pv + sizeof(DEVNAMES); // now points to end + SecureHelper::strcpy_x((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName); + ::GlobalUnlock(h); + } + } + return h; + } + + HDC CreatePrinterDC(const DEVMODE* pdm = NULL) const + { + CPrinterInfo<5> pinfo5; + CPrinterInfo<2> pinfo2; + HDC hDC = NULL; + LPTSTR lpszPrinterName = NULL; + // Some printers fail for PRINTER_INFO_5 in some situations + if (pinfo5.GetPrinterInfo(m_hPrinter)) + lpszPrinterName = pinfo5.m_pi->pPrinterName; + else if (pinfo2.GetPrinterInfo(m_hPrinter)) + lpszPrinterName = pinfo2.m_pi->pPrinterName; + if (lpszPrinterName != NULL) + hDC = ::CreateDC(NULL, lpszPrinterName, NULL, pdm); + return hDC; + } + + HDC CreatePrinterIC(const DEVMODE* pdm = NULL) const + { + CPrinterInfo<5> pinfo5; + CPrinterInfo<2> pinfo2; + HDC hDC = NULL; + LPTSTR lpszPrinterName = NULL; + // Some printers fail for PRINTER_INFO_5 in some situations + if (pinfo5.GetPrinterInfo(m_hPrinter)) + lpszPrinterName = pinfo5.m_pi->pPrinterName; + else if (pinfo2.GetPrinterInfo(m_hPrinter)) + lpszPrinterName = pinfo2.m_pi->pPrinterName; + if (lpszPrinterName != NULL) + hDC = ::CreateIC(NULL, lpszPrinterName, NULL, pdm); + return hDC; + } + + void Attach(HANDLE hPrinter) + { + ClosePrinter(); + m_hPrinter = hPrinter; + } + + HANDLE Detach() + { + HANDLE hPrinter = m_hPrinter; + m_hPrinter = NULL; + return hPrinter; + } + + operator HANDLE() const { return m_hPrinter; } +}; + +typedef CPrinterT CPrinterHandle; +typedef CPrinterT CPrinter; + + +/////////////////////////////////////////////////////////////////////////////// +// CDevMode - Wrapper class for DEVMODE + +template +class CDevModeT +{ +public: +// Data members + HANDLE m_hDevMode; + DEVMODE* m_pDevMode; + +// Constructor/destructor + CDevModeT(HANDLE hDevMode = NULL) : m_hDevMode(hDevMode) + { + m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; + } + + ~CDevModeT() + { + Cleanup(); + } + +// Operations + CDevModeT& operator =(HANDLE hDevMode) + { + Attach(hDevMode); + return *this; + } + + void Attach(HANDLE hDevModeNew) + { + Cleanup(); + m_hDevMode = hDevModeNew; + m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; + } + + HANDLE Detach() + { + if (m_hDevMode != NULL) + ::GlobalUnlock(m_hDevMode); + HANDLE hDevMode = m_hDevMode; + m_hDevMode = NULL; + return hDevMode; + } + + bool IsNull() const { return (m_hDevMode == NULL); } + + bool CopyFromPrinter(HANDLE hPrinter) + { + CPrinterInfo<2> pinfo; + bool b = pinfo.GetPrinterInfo(hPrinter); + if (b) + b = CopyFromDEVMODE(pinfo.m_pi->pDevMode); + return b; + } + + bool CopyFromDEVMODE(const DEVMODE* pdm) + { + if (pdm == NULL) + return false; + int nSize = pdm->dmSize + pdm->dmDriverExtra; + HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); + if (h != NULL) + { + void* p = ::GlobalLock(h); + SecureHelper::memcpy_x(p, nSize, pdm, nSize); + ::GlobalUnlock(h); + } + Attach(h); + return (h != NULL); + } + + bool CopyFromHDEVMODE(HANDLE hdm) + { + bool b = false; + if (hdm != NULL) + { + DEVMODE* pdm = (DEVMODE*)::GlobalLock(hdm); + b = CopyFromDEVMODE(pdm); + ::GlobalUnlock(hdm); + } + return b; + } + + HANDLE CopyToHDEVMODE() + { + if ((m_hDevMode == NULL) || (m_pDevMode == NULL)) + return NULL; + int nSize = m_pDevMode->dmSize + m_pDevMode->dmDriverExtra; + HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); + if (h != NULL) + { + void* p = ::GlobalLock(h); + SecureHelper::memcpy_x(p, nSize, m_pDevMode, nSize); + ::GlobalUnlock(h); + } + return h; + } + + // If this devmode was for another printer, this will create a new devmode + // based on the existing devmode, but retargeted at the new printer + bool UpdateForNewPrinter(HANDLE hPrinter) + { + bool bRet = false; + LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0); + CTempBuffer buff; + DEVMODE* pdm = buff.AllocateBytes(nLen); + if(pdm != NULL) + { + memset(pdm, 0, nLen); + LONG l = ::DocumentProperties(NULL, hPrinter, NULL, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER); + if (l == IDOK) + bRet = CopyFromDEVMODE(pdm); + } + + return bRet; + } + + bool DocumentProperties(HANDLE hPrinter, HWND hWnd = NULL) + { + CPrinterInfo<1> pi; + pi.GetPrinterInfo(hPrinter); + if (hWnd == NULL) + hWnd = ::GetActiveWindow(); + + bool bRet = false; + LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0); + CTempBuffer buff; + DEVMODE* pdm = buff.AllocateBytes(nLen); + if(pdm != NULL) + { + memset(pdm, 0, nLen); + LONG l = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER | DM_PROMPT); + if (l == IDOK) + bRet = CopyFromDEVMODE(pdm); + } + + return bRet; + } + + operator HANDLE() const { return m_hDevMode; } + + operator DEVMODE*() const { return m_pDevMode; } + +// Implementation + void Cleanup() + { + if (m_hDevMode != NULL) + { + ::GlobalUnlock(m_hDevMode); + if(t_bManaged) + ::GlobalFree(m_hDevMode); + m_hDevMode = NULL; + } + } +}; + +typedef CDevModeT CDevModeHandle; +typedef CDevModeT CDevMode; + + +/////////////////////////////////////////////////////////////////////////////// +// CPrinterDC + +class CPrinterDC : public CDC +{ +public: +// Constructors/destructor + CPrinterDC() + { + CPrinter printer; + printer.OpenDefaultPrinter(); + Attach(printer.CreatePrinterDC()); + ATLASSERT(m_hDC != NULL); + } + + CPrinterDC(HANDLE hPrinter, const DEVMODE* pdm = NULL) + { + CPrinterHandle p; + p.Attach(hPrinter); + Attach(p.CreatePrinterDC(pdm)); + ATLASSERT(m_hDC != NULL); + } + + ~CPrinterDC() + { + DeleteDC(); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPrintJob - Wraps a set of tasks for a specific printer (StartDoc/EndDoc) +// Handles aborting, background printing + +// Defines callbacks used by CPrintJob (not a COM interface) +class ATL_NO_VTABLE IPrintJobInfo +{ +public: + virtual void BeginPrintJob(HDC hDC) = 0; // allocate handles needed, etc. + virtual void EndPrintJob(HDC hDC, bool bAborted) = 0; // free handles, etc. + virtual void PrePrintPage(UINT nPage, HDC hDC) = 0; + virtual bool PrintPage(UINT nPage, HDC hDC) = 0; + virtual void PostPrintPage(UINT nPage, HDC hDC) = 0; + // If you want per page devmodes, return the DEVMODE* to use for nPage. + // You can optimize by only returning a new DEVMODE* when it is different + // from the one for nLastPage, otherwise return NULL. + // When nLastPage==0, the current DEVMODE* will be the default passed to + // StartPrintJob. + // Note: During print preview, nLastPage will always be "0". + virtual DEVMODE* GetNewDevModeForPage(UINT nLastPage, UINT nPage) = 0; + virtual bool IsValidPage(UINT nPage) = 0; +}; + +// Provides a default implementatin for IPrintJobInfo +// Typically, MI'd into a document or view class +class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo +{ +public: + virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc + { + } + + virtual void EndPrintJob(HDC /*hDC*/, bool /*bAborted*/) // free handles, etc + { + } + + virtual void PrePrintPage(UINT /*nPage*/, HDC hDC) + { + m_nPJState = ::SaveDC(hDC); + } + + virtual bool PrintPage(UINT /*nPage*/, HDC /*hDC*/) = 0; + + virtual void PostPrintPage(UINT /*nPage*/, HDC hDC) + { + RestoreDC(hDC, m_nPJState); + } + + virtual DEVMODE* GetNewDevModeForPage(UINT /*nLastPage*/, UINT /*nPage*/) + { + return NULL; + } + + virtual bool IsValidPage(UINT /*nPage*/) + { + return true; + } + +// Implementation - data + int m_nPJState; +}; + + +class CPrintJob +{ +public: +// Data members + CPrinterHandle m_printer; + IPrintJobInfo* m_pInfo; + DEVMODE* m_pDefDevMode; + DOCINFO m_docinfo; + int m_nJobID; + bool m_bCancel; + bool m_bComplete; + unsigned long m_nStartPage; + unsigned long m_nEndPage; + +// Constructor/destructor + CPrintJob() : m_nJobID(0), m_bCancel(false), m_bComplete(true) + { } + + ~CPrintJob() + { + ATLASSERT(IsJobComplete()); // premature destruction? + } + +// Operations + bool IsJobComplete() const + { + return m_bComplete; + } + + bool StartPrintJob(bool bBackground, HANDLE hPrinter, DEVMODE* pDefaultDevMode, + IPrintJobInfo* pInfo, LPCTSTR lpszDocName, + unsigned long nStartPage, unsigned long nEndPage, + bool bPrintToFile = false, LPCTSTR lpstrOutputFile = NULL) + { + ATLASSERT(m_bComplete); // previous job not done yet? + if (pInfo == NULL) + return false; + + memset(&m_docinfo, 0, sizeof(m_docinfo)); + m_docinfo.cbSize = sizeof(m_docinfo); + m_docinfo.lpszDocName = lpszDocName; + m_pInfo = pInfo; + m_nStartPage = nStartPage; + m_nEndPage = nEndPage; + m_printer.Attach(hPrinter); + m_pDefDevMode = pDefaultDevMode; + m_bComplete = false; + + if(bPrintToFile) + m_docinfo.lpszOutput = (lpstrOutputFile != NULL) ? lpstrOutputFile : _T("FILE:"); + + if (!bBackground) + { + m_bComplete = true; + return StartHelper(); + } + + // Create a thread and return + DWORD dwThreadID = 0; +#if !defined(_ATL_MIN_CRT) && defined(_MT) + HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID); +#else + HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID); +#endif + if (hThread == NULL) + return false; + + ::CloseHandle(hThread); + + return true; + } + +// Implementation + static DWORD WINAPI StartProc(void* p) + { + CPrintJob* pThis = (CPrintJob*)p; + pThis->StartHelper(); + pThis->m_bComplete = true; + return 0; + } + + bool StartHelper() + { + CDC dcPrinter; + dcPrinter.Attach(m_printer.CreatePrinterDC(m_pDefDevMode)); + if (dcPrinter.IsNull()) + return false; + + m_nJobID = ::StartDoc(dcPrinter, &m_docinfo); + if (m_nJobID <= 0) + return false; + + m_pInfo->BeginPrintJob(dcPrinter); + + // print all the pages now + unsigned long nLastPage = 0; + for (unsigned long nPage = m_nStartPage; nPage <= m_nEndPage; nPage++) + { + if (!m_pInfo->IsValidPage(nPage)) + break; + DEVMODE* pdm = m_pInfo->GetNewDevModeForPage(nLastPage, nPage); + if (pdm != NULL) + dcPrinter.ResetDC(pdm); + dcPrinter.StartPage(); + m_pInfo->PrePrintPage(nPage, dcPrinter); + if (!m_pInfo->PrintPage(nPage, dcPrinter)) + m_bCancel = true; + m_pInfo->PostPrintPage(nPage, dcPrinter); + dcPrinter.EndPage(); + if (m_bCancel) + break; + nLastPage = nPage; + } + + m_pInfo->EndPrintJob(dcPrinter, m_bCancel); + if (m_bCancel) + ::AbortDoc(dcPrinter); + else + ::EndDoc(dcPrinter); + m_nJobID = 0; + return true; + } + + // Cancels a print job. Can be called asynchronously. + void CancelPrintJob() + { + m_bCancel = true; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPrintPreview - Adds print preview support to an existing window + +class CPrintPreview +{ +public: +// Data members + IPrintJobInfo* m_pInfo; + CPrinterHandle m_printer; + CEnhMetaFile m_meta; + DEVMODE* m_pDefDevMode; + DEVMODE* m_pCurDevMode; + SIZE m_sizeCurPhysOffset; + +// Constructor + CPrintPreview() : m_pInfo(NULL), m_pDefDevMode(NULL), m_pCurDevMode(NULL) + { + m_sizeCurPhysOffset.cx = 0; + m_sizeCurPhysOffset.cy = 0; + } + +// Operations + void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, IPrintJobInfo* pji) + { + m_printer.Attach(hPrinter); + m_pDefDevMode = pDefaultDevMode; + m_pInfo = pji; + m_nCurPage = 0; + m_pCurDevMode = NULL; + } + + void SetEnhMetaFile(HENHMETAFILE hEMF) + { + m_meta = hEMF; + } + + void SetPage(int nPage) + { + if (!m_pInfo->IsValidPage(nPage)) + return; + m_nCurPage = nPage; + m_pCurDevMode = m_pInfo->GetNewDevModeForPage(0, nPage); + if (m_pCurDevMode == NULL) + m_pCurDevMode = m_pDefDevMode; + CDC dcPrinter = m_printer.CreatePrinterDC(m_pCurDevMode); + + int iWidth = dcPrinter.GetDeviceCaps(PHYSICALWIDTH); + int iHeight = dcPrinter.GetDeviceCaps(PHYSICALHEIGHT); + int nLogx = dcPrinter.GetDeviceCaps(LOGPIXELSX); + int nLogy = dcPrinter.GetDeviceCaps(LOGPIXELSY); + + RECT rcMM = { 0, 0, ::MulDiv(iWidth, 2540, nLogx), ::MulDiv(iHeight, 2540, nLogy) }; + + m_sizeCurPhysOffset.cx = dcPrinter.GetDeviceCaps(PHYSICALOFFSETX); + m_sizeCurPhysOffset.cy = dcPrinter.GetDeviceCaps(PHYSICALOFFSETY); + + CEnhMetaFileDC dcMeta(dcPrinter, &rcMM); + m_pInfo->PrePrintPage(nPage, dcMeta); + m_pInfo->PrintPage(nPage, dcMeta); + m_pInfo->PostPrintPage(nPage, dcMeta); + m_meta.Attach(dcMeta.Close()); + } + + void GetPageRect(RECT& rc, LPRECT prc) + { + int x1 = rc.right-rc.left; + int y1 = rc.bottom - rc.top; + if ((x1 < 0) || (y1 < 0)) + return; + + CEnhMetaFileInfo emfinfo(m_meta); + ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); + + // Compute whether we are OK vertically or horizontally + int x2 = pmh->szlDevice.cx; + int y2 = pmh->szlDevice.cy; + int y1p = MulDiv(x1, y2, x2); + int x1p = MulDiv(y1, x2, y2); + ATLASSERT((x1p <= x1) || (y1p <= y1)); + if (x1p <= x1) + { + prc->left = rc.left + (x1 - x1p) / 2; + prc->right = prc->left + x1p; + prc->top = rc.top; + prc->bottom = rc.bottom; + } + else + { + prc->left = rc.left; + prc->right = rc.right; + prc->top = rc.top + (y1 - y1p) / 2; + prc->bottom = prc->top + y1p; + } + } + +// Painting helpers + void DoPaint(CDCHandle dc) + { + // this one is not used + } + + void DoPaint(CDCHandle dc, RECT& rc) + { + CEnhMetaFileInfo emfinfo(m_meta); + ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); + int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); + int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); + + dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); + dc.PlayMetaFile(m_meta, &rc); + } + +// Implementation - data + int m_nCurPage; +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CPrintPreviewWindow - Implements a print preview window + +template +class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImpl, public CPrintPreview +{ +public: + DECLARE_WND_CLASS_EX(NULL, CS_VREDRAW | CS_HREDRAW, -1) + + enum { m_cxOffset = 10, m_cyOffset = 10 }; + +// Constructor + CPrintPreviewWindowImpl() : m_nMaxPage(0), m_nMinPage(0) + { } + +// Operations + void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, + IPrintJobInfo* pji, int nMinPage, int nMaxPage) + { + CPrintPreview::SetPrintPreviewInfo(hPrinter, pDefaultDevMode, pji); + m_nMinPage = nMinPage; + m_nMaxPage = nMaxPage; + } + + bool NextPage() + { + if (m_nCurPage == m_nMaxPage) + return false; + SetPage(m_nCurPage + 1); + Invalidate(); + return true; + } + + bool PrevPage() + { + if (m_nCurPage == m_nMinPage) + return false; + if (m_nCurPage == 0) + return false; + SetPage(m_nCurPage - 1); + Invalidate(); + return true; + } + +// Message map and handlers + BEGIN_MSG_MAP(CPrintPreviewWindowImpl) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + END_MSG_MAP() + + LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no need for the background + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + RECT rc = { 0 }; + + if(wParam != NULL) + { + pT->DoPrePaint((HDC)wParam, rc); + pT->DoPaint((HDC)wParam, rc); + } + else + { + CPaintDC dc(m_hWnd); + pT->DoPrePaint(dc.m_hDC, rc); + pT->DoPaint(dc.m_hDC, rc); + } + + return 0; + } + +// Painting helper + void DoPrePaint(CDCHandle dc, RECT& rc) + { + RECT rcClient = { 0 }; + GetClientRect(&rcClient); + RECT rcArea = rcClient; + T* pT = static_cast(this); + pT; // avoid level 4 warning + ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); + if (rcArea.left > rcArea.right) + rcArea.right = rcArea.left; + if (rcArea.top > rcArea.bottom) + rcArea.bottom = rcArea.top; + GetPageRect(rcArea, &rc); + CRgn rgn1, rgn2; + rgn1.CreateRectRgnIndirect(&rc); + rgn2.CreateRectRgnIndirect(&rcClient); + rgn2.CombineRgn(rgn1, RGN_DIFF); + dc.SelectClipRgn(rgn2); + dc.FillRect(&rcClient, COLOR_BTNSHADOW); + dc.SelectClipRgn(NULL); + dc.FillRect(&rc, (HBRUSH)::GetStockObject(WHITE_BRUSH)); + } + +// Implementation - data + int m_nMinPage; + int m_nMaxPage; +}; + + +class CPrintPreviewWindow : public CPrintPreviewWindowImpl +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_PrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CZoomPrintPreviewWindowImpl - Implements print preview window with zooming + +#ifdef __ATLSCRL_H__ + +template +class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > +{ +public: + bool m_bSized; + + CZoomPrintPreviewWindowImpl() + { + SetScrollExtendedStyle(SCRL_DISABLENOSCROLL); + InitZoom(); + } + + // should be called to reset data members before recreating window + void InitZoom() + { + m_bSized = false; + m_nZoomMode = ZOOMMODE_OFF; + m_fZoomScaleMin = 1.0; + m_fZoomScale = 1.0; + } + + BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl) + MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) + MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) + MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) + MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) + MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) + MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) + END_MSG_MAP() + + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; + POINT ptOffset = m_ptOffset; + SIZE sizeAll = m_sizeAll; + SetScrollSize(sizeClient); + if(sizeAll.cx > 0) + ptOffset.x = ::MulDiv(ptOffset.x, m_sizeAll.cx, sizeAll.cx); + if(sizeAll.cy > 0) + ptOffset.y = ::MulDiv(ptOffset.y, m_sizeAll.cy, sizeAll.cy); + SetScrollOffset(ptOffset); + CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled); + if(!m_bSized) + { + m_bSized = true; + T* pT = static_cast(this); + pT->ShowScrollBar(SB_HORZ, TRUE); + pT->ShowScrollBar(SB_VERT, TRUE); + } + return 0; + } + + LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + RECT rc = { 0 }; + + if(wParam != NULL) + { + CDCHandle dc = (HDC)wParam; + int nMapModeSav = dc.GetMapMode(); + dc.SetMapMode(MM_ANISOTROPIC); + SIZE szWindowExt = { 0, 0 }; + dc.SetWindowExt(m_sizeLogAll, &szWindowExt); + SIZE szViewportExt = { 0, 0 }; + dc.SetViewportExt(m_sizeAll, &szViewportExt); + POINT ptViewportOrg = { 0, 0 }; + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + + pT->DoPrePaint(dc, rc); + pT->DoPaint(dc, rc); + + dc.SetMapMode(nMapModeSav); + dc.SetWindowExt(szWindowExt); + dc.SetViewportExt(szViewportExt); + dc.SetViewportOrg(ptViewportOrg); + } + else + { + CPaintDC dc(pT->m_hWnd); + pT->PrepareDC(dc.m_hDC); + pT->DoPrePaint(dc.m_hDC, rc); + pT->DoPaint(dc.m_hDC, rc); + } + + return 0; + } + + // Painting helpers + void DoPaint(CDCHandle dc) + { + // this one is not used + } + + void DoPrePaint(CDCHandle dc, RECT& rc) + { + RECT rcClient; + GetClientRect(&rcClient); + RECT rcArea = rcClient; + T* pT = static_cast(this); + pT; // avoid level 4 warning + ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); + if (rcArea.left > rcArea.right) + rcArea.right = rcArea.left; + if (rcArea.top > rcArea.bottom) + rcArea.bottom = rcArea.top; + GetPageRect(rcArea, &rc); + HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); + dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY); + dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY); + dc.PatBlt(rc.right, rcClient.top, rcClient.right - rc.right, rcClient.bottom - rcClient.top, PATCOPY); + dc.PatBlt(rc.left, rc.bottom, rc.right - rc.left, rcClient.bottom - rc.bottom, PATCOPY); + dc.SelectBrush((HBRUSH)::GetStockObject(WHITE_BRUSH)); + dc.PatBlt(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); + dc.SelectBrush(::GetSysColorBrush(COLOR_3DDKSHADOW)); + dc.PatBlt(rc.right, rc.top + 4, 4, rc.bottom - rc.top, PATCOPY); + dc.PatBlt(rc.left + 4, rc.bottom, rc.right - rc.left, 4, PATCOPY); + dc.SelectBrush(hbrOld); + } + + void DoPaint(CDCHandle dc, RECT& rc) + { + CEnhMetaFileInfo emfinfo(m_meta); + ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); + int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); + int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); + + dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); + dc.PlayMetaFile(m_meta, &rc); + } +}; + +class CZoomPrintPreviewWindow : public CZoomPrintPreviewWindowImpl +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_ZoomPrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) +}; + +#endif // __ATLSCRL_H__ + +}; // namespace WTL + +#endif // __ATLPRINT_H__ diff --git a/Externals/WTL80/atlres.h b/Externals/WTL80/atlres.h index ae058876ae..b2ed9eaab8 100644 --- a/Externals/WTL80/atlres.h +++ b/Externals/WTL80/atlres.h @@ -1,262 +1,262 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRES_H__ -#define __ATLRES_H__ - -#pragma once - -#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__) - #error Use atlresCE.h instead of atlres.h for Windows CE -#endif - - -#ifdef RC_INVOKED -#ifndef _INC_WINDOWS - - #define _INC_WINDOWS - - #ifndef _WIN32_WCE - #define VS_VERSION_INFO 1 - - #ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED - - #ifndef WINVER - #define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER - - #include - - // operation messages sent to DLGINIT - #define LB_ADDSTRING (WM_USER+1) - #define CB_ADDSTRING (WM_USER+3) - #endif // !_WIN32_WCE - - #ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS - #endif // APSTUDIO_INVOKED - - #ifdef IDC_STATIC - #undef IDC_STATIC - #endif // IDC_STATIC - #define IDC_STATIC (-1) - -#endif // !_INC_WINDOWS -#endif // RC_INVOKED - -#ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// ATL resource types - -#ifndef RC_INVOKED - #define RT_DLGINIT MAKEINTRESOURCE(240) - #define RT_TOOLBAR MAKEINTRESOURCE(241) -#endif // RC_INVOKED - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// Standard window components - -#define ID_SEPARATOR 0 // special separator value -#define ID_DEFAULT_PANE 0 // default status bar pane - -#ifndef RC_INVOKED // code only -// standard control bars (IDW = window ID) - #define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window - #define ATL_IDW_STATUS_BAR 0xE801 // Status bar window - #define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window - -// parts of a frame window - #define ATL_IDW_CLIENT 0xE900 - #define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) - #define ATL_IDW_PANE_LAST 0xE9FF - #define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) - #define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) - - #define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters - #define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST - -// bands for a rebar - #define ATL_IDW_BAND_FIRST 0xEB00 - #define ATL_IDW_BAND_LAST 0xEBFF -#endif // !RC_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// Standard Commands - -// File commands -#define ID_FILE_NEW 0xE100 -#define ID_FILE_OPEN 0xE101 -#define ID_FILE_CLOSE 0xE102 -#define ID_FILE_SAVE 0xE103 -#define ID_FILE_SAVE_AS 0xE104 -#define ID_FILE_PAGE_SETUP 0xE105 -#define ID_FILE_PRINT_SETUP 0xE106 -#define ID_FILE_PRINT 0xE107 -#define ID_FILE_PRINT_DIRECT 0xE108 -#define ID_FILE_PRINT_PREVIEW 0xE109 -#define ID_FILE_UPDATE 0xE10A -#define ID_FILE_SAVE_COPY_AS 0xE10B -#define ID_FILE_SEND_MAIL 0xE10C - -#define ID_FILE_MRU_FIRST 0xE110 -#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max -#define ID_FILE_MRU_FILE2 0xE111 -#define ID_FILE_MRU_FILE3 0xE112 -#define ID_FILE_MRU_FILE4 0xE113 -#define ID_FILE_MRU_FILE5 0xE114 -#define ID_FILE_MRU_FILE6 0xE115 -#define ID_FILE_MRU_FILE7 0xE116 -#define ID_FILE_MRU_FILE8 0xE117 -#define ID_FILE_MRU_FILE9 0xE118 -#define ID_FILE_MRU_FILE10 0xE119 -#define ID_FILE_MRU_FILE11 0xE11A -#define ID_FILE_MRU_FILE12 0xE11B -#define ID_FILE_MRU_FILE13 0xE11C -#define ID_FILE_MRU_FILE14 0xE11D -#define ID_FILE_MRU_FILE15 0xE11E -#define ID_FILE_MRU_FILE16 0xE11F -#define ID_FILE_MRU_LAST 0xE11F - -// Edit commands -#define ID_EDIT_CLEAR 0xE120 -#define ID_EDIT_CLEAR_ALL 0xE121 -#define ID_EDIT_COPY 0xE122 -#define ID_EDIT_CUT 0xE123 -#define ID_EDIT_FIND 0xE124 -#define ID_EDIT_PASTE 0xE125 -#define ID_EDIT_PASTE_LINK 0xE126 -#define ID_EDIT_PASTE_SPECIAL 0xE127 -#define ID_EDIT_REPEAT 0xE128 -#define ID_EDIT_REPLACE 0xE129 -#define ID_EDIT_SELECT_ALL 0xE12A -#define ID_EDIT_UNDO 0xE12B -#define ID_EDIT_REDO 0xE12C - -// Window commands -#define ID_WINDOW_NEW 0xE130 -#define ID_WINDOW_ARRANGE 0xE131 -#define ID_WINDOW_CASCADE 0xE132 -#define ID_WINDOW_TILE_HORZ 0xE133 -#define ID_WINDOW_TILE_VERT 0xE134 -#define ID_WINDOW_SPLIT 0xE135 -#ifndef RC_INVOKED // code only - #define ATL_IDM_WINDOW_FIRST 0xE130 - #define ATL_IDM_WINDOW_LAST 0xE13F - #define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here - #define ATL_IDM_LAST_MDICHILD 0xFFFD -#endif // !RC_INVOKED -// TabView -#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD -#define ID_WINDOW_TABLAST 0xFFFD -#define ID_WINDOW_SHOWTABLIST 0xFFFE - -// Help and App commands -#define ID_APP_ABOUT 0xE140 -#define ID_APP_EXIT 0xE141 -#define ID_HELP_INDEX 0xE142 -#define ID_HELP_FINDER 0xE143 -#define ID_HELP_USING 0xE144 -#define ID_CONTEXT_HELP 0xE145 // shift-F1 -// special commands for processing help -#define ID_HELP 0xE146 // first attempt for F1 -#define ID_DEFAULT_HELP 0xE147 // last attempt - -// Misc -#define ID_NEXT_PANE 0xE150 -#define ID_PREV_PANE 0xE151 -#define ID_PANE_CLOSE 0xE152 - -// Format -#define ID_FORMAT_FONT 0xE160 - -// Scroll -#define ID_SCROLL_UP 0xE170 -#define ID_SCROLL_DOWN 0xE171 -#define ID_SCROLL_PAGE_UP 0xE172 -#define ID_SCROLL_PAGE_DOWN 0xE173 -#define ID_SCROLL_TOP 0xE174 -#define ID_SCROLL_BOTTOM 0xE175 -#define ID_SCROLL_LEFT 0xE176 -#define ID_SCROLL_RIGHT 0xE177 -#define ID_SCROLL_PAGE_LEFT 0xE178 -#define ID_SCROLL_PAGE_RIGHT 0xE179 -#define ID_SCROLL_ALL_LEFT 0xE17A -#define ID_SCROLL_ALL_RIGHT 0xE17B - -// OLE commands -#define ID_OLE_INSERT_NEW 0xE200 -#define ID_OLE_EDIT_LINKS 0xE201 -#define ID_OLE_EDIT_CONVERT 0xE202 -#define ID_OLE_EDIT_CHANGE_ICON 0xE203 -#define ID_OLE_EDIT_PROPERTIES 0xE204 -#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max -#ifndef RC_INVOKED // code only - #define ID_OLE_VERB_LAST 0xE21F -#endif // !RC_INVOKED - -// View commands (same number used as IDW used for toolbar and status bar) -#define ID_VIEW_TOOLBAR 0xE800 -#define ID_VIEW_STATUS_BAR 0xE801 -#define ID_VIEW_REFRESH 0xE803 - -/////////////////////////////////////////////////////////////////////////////// -// Standard control IDs - -#ifdef IDC_STATIC - #undef IDC_STATIC -#endif // IDC_STATIC -#define IDC_STATIC (-1) // all static controls - -/////////////////////////////////////////////////////////////////////////////// -// Standard string error/warnings - -// idle status bar message -#define ATL_IDS_IDLEMESSAGE 0xE001 - -#ifndef RC_INVOKED // code only - #define ATL_IDS_SCFIRST 0xEF00 -#endif // !RC_INVOKED - -#define ATL_IDS_SCSIZE 0xEF00 -#define ATL_IDS_SCMOVE 0xEF01 -#define ATL_IDS_SCMINIMIZE 0xEF02 -#define ATL_IDS_SCMAXIMIZE 0xEF03 -#define ATL_IDS_SCNEXTWINDOW 0xEF04 -#define ATL_IDS_SCPREVWINDOW 0xEF05 -#define ATL_IDS_SCCLOSE 0xEF06 -#define ATL_IDS_SCRESTORE 0xEF12 -#define ATL_IDS_SCTASKLIST 0xEF13 - -#define ATL_IDS_MDICHILD 0xEF1F -#define ATL_IDS_MRU_FILE 0xEFDA - -/////////////////////////////////////////////////////////////////////////////// -// Misc. control IDs - -// Property Sheet control id's (determined with Spy++) -#define ID_APPLY_NOW 0x3021 -#define ID_WIZBACK 0x3023 -#define ID_WIZNEXT 0x3024 -#define ID_WIZFINISH 0x3025 -#define ATL_IDC_TAB_CONTROL 0x3020 - -#endif // __ATLRES_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLRES_H__ +#define __ATLRES_H__ + +#pragma once + +#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__) + #error Use atlresCE.h instead of atlres.h for Windows CE +#endif + + +#ifdef RC_INVOKED +#ifndef _INC_WINDOWS + + #define _INC_WINDOWS + + #ifndef _WIN32_WCE + #define VS_VERSION_INFO 1 + + #ifdef APSTUDIO_INVOKED + #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols + #endif // APSTUDIO_INVOKED + + #ifndef WINVER + #define WINVER 0x0400 // default to Windows Version 4.0 + #endif // !WINVER + + #include + + // operation messages sent to DLGINIT + #define LB_ADDSTRING (WM_USER+1) + #define CB_ADDSTRING (WM_USER+3) + #endif // !_WIN32_WCE + + #ifdef APSTUDIO_INVOKED + #undef APSTUDIO_HIDDEN_SYMBOLS + #endif // APSTUDIO_INVOKED + + #ifdef IDC_STATIC + #undef IDC_STATIC + #endif // IDC_STATIC + #define IDC_STATIC (-1) + +#endif // !_INC_WINDOWS +#endif // RC_INVOKED + +#ifdef APSTUDIO_INVOKED + #define APSTUDIO_HIDDEN_SYMBOLS +#endif // APSTUDIO_INVOKED + +/////////////////////////////////////////////////////////////////////////////// +// ATL resource types + +#ifndef RC_INVOKED + #define RT_DLGINIT MAKEINTRESOURCE(240) + #define RT_TOOLBAR MAKEINTRESOURCE(241) +#endif // RC_INVOKED + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef APSTUDIO_INVOKED + #undef APSTUDIO_HIDDEN_SYMBOLS +#endif // APSTUDIO_INVOKED + +/////////////////////////////////////////////////////////////////////////////// +// Standard window components + +#define ID_SEPARATOR 0 // special separator value +#define ID_DEFAULT_PANE 0 // default status bar pane + +#ifndef RC_INVOKED // code only +// standard control bars (IDW = window ID) + #define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window + #define ATL_IDW_STATUS_BAR 0xE801 // Status bar window + #define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window + +// parts of a frame window + #define ATL_IDW_CLIENT 0xE900 + #define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) + #define ATL_IDW_PANE_LAST 0xE9FF + #define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) + #define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) + + #define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters + #define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST + +// bands for a rebar + #define ATL_IDW_BAND_FIRST 0xEB00 + #define ATL_IDW_BAND_LAST 0xEBFF +#endif // !RC_INVOKED + +/////////////////////////////////////////////////////////////////////////////// +// Standard Commands + +// File commands +#define ID_FILE_NEW 0xE100 +#define ID_FILE_OPEN 0xE101 +#define ID_FILE_CLOSE 0xE102 +#define ID_FILE_SAVE 0xE103 +#define ID_FILE_SAVE_AS 0xE104 +#define ID_FILE_PAGE_SETUP 0xE105 +#define ID_FILE_PRINT_SETUP 0xE106 +#define ID_FILE_PRINT 0xE107 +#define ID_FILE_PRINT_DIRECT 0xE108 +#define ID_FILE_PRINT_PREVIEW 0xE109 +#define ID_FILE_UPDATE 0xE10A +#define ID_FILE_SAVE_COPY_AS 0xE10B +#define ID_FILE_SEND_MAIL 0xE10C + +#define ID_FILE_MRU_FIRST 0xE110 +#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max +#define ID_FILE_MRU_FILE2 0xE111 +#define ID_FILE_MRU_FILE3 0xE112 +#define ID_FILE_MRU_FILE4 0xE113 +#define ID_FILE_MRU_FILE5 0xE114 +#define ID_FILE_MRU_FILE6 0xE115 +#define ID_FILE_MRU_FILE7 0xE116 +#define ID_FILE_MRU_FILE8 0xE117 +#define ID_FILE_MRU_FILE9 0xE118 +#define ID_FILE_MRU_FILE10 0xE119 +#define ID_FILE_MRU_FILE11 0xE11A +#define ID_FILE_MRU_FILE12 0xE11B +#define ID_FILE_MRU_FILE13 0xE11C +#define ID_FILE_MRU_FILE14 0xE11D +#define ID_FILE_MRU_FILE15 0xE11E +#define ID_FILE_MRU_FILE16 0xE11F +#define ID_FILE_MRU_LAST 0xE11F + +// Edit commands +#define ID_EDIT_CLEAR 0xE120 +#define ID_EDIT_CLEAR_ALL 0xE121 +#define ID_EDIT_COPY 0xE122 +#define ID_EDIT_CUT 0xE123 +#define ID_EDIT_FIND 0xE124 +#define ID_EDIT_PASTE 0xE125 +#define ID_EDIT_PASTE_LINK 0xE126 +#define ID_EDIT_PASTE_SPECIAL 0xE127 +#define ID_EDIT_REPEAT 0xE128 +#define ID_EDIT_REPLACE 0xE129 +#define ID_EDIT_SELECT_ALL 0xE12A +#define ID_EDIT_UNDO 0xE12B +#define ID_EDIT_REDO 0xE12C + +// Window commands +#define ID_WINDOW_NEW 0xE130 +#define ID_WINDOW_ARRANGE 0xE131 +#define ID_WINDOW_CASCADE 0xE132 +#define ID_WINDOW_TILE_HORZ 0xE133 +#define ID_WINDOW_TILE_VERT 0xE134 +#define ID_WINDOW_SPLIT 0xE135 +#ifndef RC_INVOKED // code only + #define ATL_IDM_WINDOW_FIRST 0xE130 + #define ATL_IDM_WINDOW_LAST 0xE13F + #define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here + #define ATL_IDM_LAST_MDICHILD 0xFFFD +#endif // !RC_INVOKED +// TabView +#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD +#define ID_WINDOW_TABLAST 0xFFFD +#define ID_WINDOW_SHOWTABLIST 0xFFFE + +// Help and App commands +#define ID_APP_ABOUT 0xE140 +#define ID_APP_EXIT 0xE141 +#define ID_HELP_INDEX 0xE142 +#define ID_HELP_FINDER 0xE143 +#define ID_HELP_USING 0xE144 +#define ID_CONTEXT_HELP 0xE145 // shift-F1 +// special commands for processing help +#define ID_HELP 0xE146 // first attempt for F1 +#define ID_DEFAULT_HELP 0xE147 // last attempt + +// Misc +#define ID_NEXT_PANE 0xE150 +#define ID_PREV_PANE 0xE151 +#define ID_PANE_CLOSE 0xE152 + +// Format +#define ID_FORMAT_FONT 0xE160 + +// Scroll +#define ID_SCROLL_UP 0xE170 +#define ID_SCROLL_DOWN 0xE171 +#define ID_SCROLL_PAGE_UP 0xE172 +#define ID_SCROLL_PAGE_DOWN 0xE173 +#define ID_SCROLL_TOP 0xE174 +#define ID_SCROLL_BOTTOM 0xE175 +#define ID_SCROLL_LEFT 0xE176 +#define ID_SCROLL_RIGHT 0xE177 +#define ID_SCROLL_PAGE_LEFT 0xE178 +#define ID_SCROLL_PAGE_RIGHT 0xE179 +#define ID_SCROLL_ALL_LEFT 0xE17A +#define ID_SCROLL_ALL_RIGHT 0xE17B + +// OLE commands +#define ID_OLE_INSERT_NEW 0xE200 +#define ID_OLE_EDIT_LINKS 0xE201 +#define ID_OLE_EDIT_CONVERT 0xE202 +#define ID_OLE_EDIT_CHANGE_ICON 0xE203 +#define ID_OLE_EDIT_PROPERTIES 0xE204 +#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max +#ifndef RC_INVOKED // code only + #define ID_OLE_VERB_LAST 0xE21F +#endif // !RC_INVOKED + +// View commands (same number used as IDW used for toolbar and status bar) +#define ID_VIEW_TOOLBAR 0xE800 +#define ID_VIEW_STATUS_BAR 0xE801 +#define ID_VIEW_REFRESH 0xE803 + +/////////////////////////////////////////////////////////////////////////////// +// Standard control IDs + +#ifdef IDC_STATIC + #undef IDC_STATIC +#endif // IDC_STATIC +#define IDC_STATIC (-1) // all static controls + +/////////////////////////////////////////////////////////////////////////////// +// Standard string error/warnings + +// idle status bar message +#define ATL_IDS_IDLEMESSAGE 0xE001 + +#ifndef RC_INVOKED // code only + #define ATL_IDS_SCFIRST 0xEF00 +#endif // !RC_INVOKED + +#define ATL_IDS_SCSIZE 0xEF00 +#define ATL_IDS_SCMOVE 0xEF01 +#define ATL_IDS_SCMINIMIZE 0xEF02 +#define ATL_IDS_SCMAXIMIZE 0xEF03 +#define ATL_IDS_SCNEXTWINDOW 0xEF04 +#define ATL_IDS_SCPREVWINDOW 0xEF05 +#define ATL_IDS_SCCLOSE 0xEF06 +#define ATL_IDS_SCRESTORE 0xEF12 +#define ATL_IDS_SCTASKLIST 0xEF13 + +#define ATL_IDS_MDICHILD 0xEF1F +#define ATL_IDS_MRU_FILE 0xEFDA + +/////////////////////////////////////////////////////////////////////////////// +// Misc. control IDs + +// Property Sheet control id's (determined with Spy++) +#define ID_APPLY_NOW 0x3021 +#define ID_WIZBACK 0x3023 +#define ID_WIZNEXT 0x3024 +#define ID_WIZFINISH 0x3025 +#define ATL_IDC_TAB_CONTROL 0x3020 + +#endif // __ATLRES_H__ diff --git a/Externals/WTL80/atlresce.h b/Externals/WTL80/atlresce.h index 64346b1e5e..b4cb10b451 100644 --- a/Externals/WTL80/atlresce.h +++ b/Externals/WTL80/atlresce.h @@ -1,93 +1,93 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRESCE_H__ -#define __ATLRESCE_H__ - -#pragma once - -#ifndef _WIN32_WCE - #error atlresCE.h is only for Windows CE -#endif - - -#ifdef RC_INVOKED -#ifndef _INC_WINDOWS - - #define VS_VERSION_INFO 1 - - #ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED - - #ifndef WINVER - #define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER - - #if !defined(WCEOLE_ENABLE_DIALOGEX) - #define DIALOGEX DIALOG DISCARDABLE - #endif - - #include - #define SHMENUBAR RCDATA - - #if defined(SHELLSDK_MODULES_AYGSHELL) - #include - #else - #define NOMENU 0xFFFF - #define IDS_SHNEW 1 - #define IDM_SHAREDNEW 10 - #define IDM_SHAREDNEWDEFAULT 11 - #endif - #ifndef I_IMAGENONE - #define I_IMAGENONE (-2) - #endif - - #include - -#endif // !_INC_WINDOWS -#endif // RC_INVOKED - -#include "atlres.h" - -#ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -// Visual Studio dialog editor bug fix -#ifndef DS_FIXEDSYS - #define DS_FIXEDSYS 0 -#endif - -#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1 - -/////////////////////////////////////////////////////////////////////////////// -// Smartphone and PPC 2005 Resource IDs - -// Command and associated string resource IDs -#define ID_MENU_OK 0xE790 -#define ID_MENU_CANCEL 0xE791 -#define ID_MENU 0xE792 -#define ID_ACTION 0xE793 -#define ID_VIEW_FULLSCREEN 0xE802 - -// MenuBar resource IDs -#define ATL_IDM_MENU_DONE 0xE701 -#define ATL_IDM_MENU_CANCEL 0xE702 -#define ATL_IDM_MENU_DONECANCEL 0xE703 - -// Default device MenuBar control ID and MenuBar resource ID -#define ATL_IDW_MENU_BAR 0xE802 - -// SmartPhone spinned controls ID offset for CSpinCtrl -#define ATL_IDW_SPIN_ID 9999 - -#endif // __ATLRESCE_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLRESCE_H__ +#define __ATLRESCE_H__ + +#pragma once + +#ifndef _WIN32_WCE + #error atlresCE.h is only for Windows CE +#endif + + +#ifdef RC_INVOKED +#ifndef _INC_WINDOWS + + #define VS_VERSION_INFO 1 + + #ifdef APSTUDIO_INVOKED + #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols + #endif // APSTUDIO_INVOKED + + #ifndef WINVER + #define WINVER 0x0400 // default to Windows Version 4.0 + #endif // !WINVER + + #if !defined(WCEOLE_ENABLE_DIALOGEX) + #define DIALOGEX DIALOG DISCARDABLE + #endif + + #include + #define SHMENUBAR RCDATA + + #if defined(SHELLSDK_MODULES_AYGSHELL) + #include + #else + #define NOMENU 0xFFFF + #define IDS_SHNEW 1 + #define IDM_SHAREDNEW 10 + #define IDM_SHAREDNEWDEFAULT 11 + #endif + #ifndef I_IMAGENONE + #define I_IMAGENONE (-2) + #endif + + #include + +#endif // !_INC_WINDOWS +#endif // RC_INVOKED + +#include "atlres.h" + +#ifdef APSTUDIO_INVOKED + #undef APSTUDIO_HIDDEN_SYMBOLS +#endif // APSTUDIO_INVOKED + +// Visual Studio dialog editor bug fix +#ifndef DS_FIXEDSYS + #define DS_FIXEDSYS 0 +#endif + +#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1 + +/////////////////////////////////////////////////////////////////////////////// +// Smartphone and PPC 2005 Resource IDs + +// Command and associated string resource IDs +#define ID_MENU_OK 0xE790 +#define ID_MENU_CANCEL 0xE791 +#define ID_MENU 0xE792 +#define ID_ACTION 0xE793 +#define ID_VIEW_FULLSCREEN 0xE802 + +// MenuBar resource IDs +#define ATL_IDM_MENU_DONE 0xE701 +#define ATL_IDM_MENU_CANCEL 0xE702 +#define ATL_IDM_MENU_DONECANCEL 0xE703 + +// Default device MenuBar control ID and MenuBar resource ID +#define ATL_IDW_MENU_BAR 0xE802 + +// SmartPhone spinned controls ID offset for CSpinCtrl +#define ATL_IDW_SPIN_ID 9999 + +#endif // __ATLRESCE_H__ diff --git a/Externals/WTL80/atlscrl.h b/Externals/WTL80/atlscrl.h index 9eb32eda9d..c765a4be9c 100644 --- a/Externals/WTL80/atlscrl.h +++ b/Externals/WTL80/atlscrl.h @@ -1,2015 +1,2015 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLSCRL_H__ -#define __ATLSCRL_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlscrl.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlscrl.h requires atlwin.h to be included first -#endif - -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - #include -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - -#ifndef GET_WHEEL_DELTA_WPARAM - #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) -#endif - -#ifndef WM_MOUSEHWHEEL - #define WM_MOUSEHWHEEL 0x020E -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CScrollImpl -// CScrollWindowImpl -// CMapScrollImpl -// CMapScrollWindowImpl -// CFSBWindowT -// CZoomScrollImpl -// CZoomScrollWindowImpl -// CScrollContainerImpl -// CScrollContainer - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CScrollImpl - Provides scrolling support to any window - -// Scroll extended styles -#define SCRL_SCROLLCHILDREN 0x00000001 -#define SCRL_ERASEBACKGROUND 0x00000002 -#define SCRL_NOTHUMBTRACKING 0x00000004 -#if (WINVER >= 0x0500) -#define SCRL_SMOOTHSCROLL 0x00000008 -#endif // (WINVER >= 0x0500) -#define SCRL_DISABLENOSCROLLV 0x00000010 -#define SCRL_DISABLENOSCROLLH 0x00000020 -#define SCRL_DISABLENOSCROLL (SCRL_DISABLENOSCROLLV | SCRL_DISABLENOSCROLLH) - - -template -class CScrollImpl -{ -public: - enum { uSCROLL_FLAGS = SW_INVALIDATE }; - - POINT m_ptOffset; - SIZE m_sizeAll; - SIZE m_sizeLine; - SIZE m_sizePage; - SIZE m_sizeClient; - int m_zDelta; // current wheel value - int m_nWheelLines; // number of lines to scroll on wheel -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - // Note that this message must be forwarded from a top level window - UINT m_uMsgMouseWheel; // MSH_MOUSEWHEEL -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - int m_zHDelta; // current horizontal wheel value - int m_nHWheelChars; // number of chars to scroll on horizontal wheel - UINT m_uScrollFlags; - DWORD m_dwExtendedStyle; // scroll specific extended styles - -// Constructor - CScrollImpl() : m_zDelta(0), m_nWheelLines(3), -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - m_uMsgMouseWheel(0U), -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - m_zHDelta(0), m_nHWheelChars(3), - m_uScrollFlags(0U), m_dwExtendedStyle(0) - { - m_ptOffset.x = 0; - m_ptOffset.y = 0; - m_sizeAll.cx = 0; - m_sizeAll.cy = 0; - m_sizePage.cx = 0; - m_sizePage.cy = 0; - m_sizeLine.cx = 0; - m_sizeLine.cy = 0; - m_sizeClient.cx = 0; - m_sizeClient.cy = 0; - - SetScrollExtendedStyle(SCRL_SCROLLCHILDREN | SCRL_ERASEBACKGROUND); - } - -// Attributes & Operations - DWORD GetScrollExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetScrollExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - // cache scroll flags - T* pT = static_cast(this); - pT; // avoid level 4 warning - m_uScrollFlags = pT->uSCROLL_FLAGS | (IsScrollingChildren() ? SW_SCROLLCHILDREN : 0) | (IsErasingBackground() ? SW_ERASE : 0); -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - m_uScrollFlags |= (IsSmoothScroll() ? SW_SMOOTHSCROLL : 0); -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - return dwPrevStyle; - } - - // offset operations - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - pT->AdjustScrollOffset(x, y); - - int dx = m_ptOffset.x - x; - int dy = m_ptOffset.y - y; - m_ptOffset.x = x; - m_ptOffset.y = y; - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, bRedraw); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, bRedraw); - } - - // Move all children if needed - if(IsScrollingChildren() && (dx != 0 || dy != 0)) - { - for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) - { - RECT rect = { 0 }; - ::GetWindowRect(hWndChild, &rect); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); - ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - } - } - - if(bRedraw) - pT->Invalidate(); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) const - { - ptOffset = m_ptOffset; - } - - // size operations - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - m_sizeAll.cx = cx; - m_sizeAll.cy = cy; - - int x = 0; - int y = 0; - if(!bResetOffset) - { - x = m_ptOffset.x; - y = m_ptOffset.y; - pT->AdjustScrollOffset(x, y); - } - - int dx = m_ptOffset.x - x; - int dy = m_ptOffset.y - y; - m_ptOffset.x = x; - m_ptOffset.y = y; - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = m_sizeAll.cx - 1; - si.nPage = m_sizeClient.cx; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, bRedraw); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = m_sizeAll.cy - 1; - si.nPage = m_sizeClient.cy; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, bRedraw); - } - - // Move all children if needed - if(IsScrollingChildren() && (dx != 0 || dy != 0)) - { - for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) - { - RECT rect = { 0 }; - ::GetWindowRect(hWndChild, &rect); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); - ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - } - } - - SetScrollLine(0, 0); - SetScrollPage(0, 0); - - if(bRedraw) - pT->Invalidate(); - } - - void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(size.cx, size.cy, bRedraw, bResetOffset); - } - - void GetScrollSize(SIZE& sizeWnd) const - { - sizeWnd = m_sizeAll; - } - - // line operations - void SetScrollLine(int cxLine, int cyLine) - { - ATLASSERT(cxLine >= 0 && cyLine >= 0); - ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); - - m_sizeLine.cx = T::CalcLineOrPage(cxLine, m_sizeAll.cx, 100); - m_sizeLine.cy = T::CalcLineOrPage(cyLine, m_sizeAll.cy, 100); - } - - void SetScrollLine(SIZE sizeLine) - { - SetScrollLine(sizeLine.cx, sizeLine.cy); - } - - void GetScrollLine(SIZE& sizeLine) const - { - sizeLine = m_sizeLine; - } - - // page operations - void SetScrollPage(int cxPage, int cyPage) - { - ATLASSERT(cxPage >= 0 && cyPage >= 0); - ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); - - m_sizePage.cx = T::CalcLineOrPage(cxPage, m_sizeAll.cx, 10); - m_sizePage.cy = T::CalcLineOrPage(cyPage, m_sizeAll.cy, 10); - } - - void SetScrollPage(SIZE sizePage) - { - SetScrollPage(sizePage.cx, sizePage.cy); - } - - void GetScrollPage(SIZE& sizePage) const - { - sizePage = m_sizePage; - } - - // commands - void ScrollLineDown() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_LINEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollLineUp() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_LINEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollPageDown() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_PAGEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollPageUp() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_PAGEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollTop() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_TOP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollBottom() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, SB_BOTTOM, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - } - - void ScrollLineRight() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_LINEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollLineLeft() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_LINEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollPageRight() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_PAGEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollPageLeft() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_PAGEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollAllLeft() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_TOP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - void ScrollAllRight() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, SB_BOTTOM, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - } - - // scroll to make point/view/window visible - void ScrollToView(POINT pt) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - RECT rect = { pt.x, pt.y, pt.x, pt.y }; - pT->ScrollToView(rect); - } - - void ScrollToView(RECT& rect) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - RECT rcClient = { 0 }; - pT->GetClientRect(&rcClient); - - int x = m_ptOffset.x; - if(rect.left < m_ptOffset.x) - x = rect.left; - else if(rect.right > (m_ptOffset.x + rcClient.right)) - x = rect.right - rcClient.right; - - int y = m_ptOffset.y; - if(rect.top < m_ptOffset.y) - y = rect.top; - else if(rect.bottom > (m_ptOffset.y + rcClient.bottom)) - y = rect.bottom - rcClient.bottom; - - SetScrollOffset(x, y); - } - - void ScrollToView(HWND hWnd) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - RECT rect = { 0 }; - ::GetWindowRect(hWnd, &rect); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); - ScrollToView(rect); - } - - BEGIN_MSG_MAP(CScrollImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_VSCROLL, OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(m_uMsgMouseWheel, OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - // standard scroll commands - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - GetSystemSettings(); - bHandled = FALSE; - return 1; - } - - LRESULT OnVScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_VERT, (int)(short)LOWORD(wParam), (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - return 0; - } - - LRESULT OnHScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - pT->DoScroll(SB_HORZ, (int)(short)LOWORD(wParam), (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - return 0; - } - - LRESULT OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - -#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE) - uMsg; - int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); -#else - int zDelta = (uMsg == WM_MOUSEWHEEL) ? (int)GET_WHEEL_DELTA_WPARAM(wParam) : (int)wParam; -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE)) - int nScrollCode = (m_nWheelLines == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGEUP : SB_PAGEDOWN) : ((zDelta > 0) ? SB_LINEUP : SB_LINEDOWN); - m_zDelta += zDelta; // cumulative - int zTotal = (m_nWheelLines == WHEEL_PAGESCROLL) ? abs(m_zDelta) : abs(m_zDelta) * m_nWheelLines; - if(m_sizeAll.cy > m_sizeClient.cy) - { - for(int i = 0; i < zTotal; i += WHEEL_DELTA) - { - pT->DoScroll(SB_VERT, nScrollCode, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); - pT->UpdateWindow(); - } - } - else // can't scroll vertically, scroll horizontally - { - for(int i = 0; i < zTotal; i += WHEEL_DELTA) - { - pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - pT->UpdateWindow(); - } - } - m_zDelta %= WHEEL_DELTA; - - return 0; - } - - LRESULT OnMouseHWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); - int nScrollCode = (m_nHWheelChars == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGERIGHT : SB_PAGELEFT) : ((zDelta > 0) ? SB_LINERIGHT : SB_LINELEFT); - m_zHDelta += zDelta; // cumulative - int zTotal = (m_nHWheelChars == WHEEL_PAGESCROLL) ? abs(m_zHDelta) : abs(m_zHDelta) * m_nHWheelChars; - if(m_sizeAll.cx > m_sizeClient.cx) - { - for(int i = 0; i < zTotal; i += WHEEL_DELTA) - { - pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); - pT->UpdateWindow(); - } - } - m_zHDelta %= WHEEL_DELTA; - - return 0; - } - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - GetSystemSettings(); - return 0; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - m_sizeClient.cx = GET_X_LPARAM(lParam); - m_sizeClient.cy = GET_Y_LPARAM(lParam); - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - si.nMin = 0; - si.nMax = m_sizeAll.cx - 1; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPage = m_sizeClient.cx; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, TRUE); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - si.nMin = 0; - si.nMax = m_sizeAll.cy - 1; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPage = m_sizeClient.cy; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, TRUE); - } - - int x = m_ptOffset.x; - int y = m_ptOffset.y; - if(pT->AdjustScrollOffset(x, y)) - { - // Children will be moved in SetScrollOffset, if needed - pT->ScrollWindowEx(m_ptOffset.x - x, m_ptOffset.y - y, (m_uScrollFlags & ~SCRL_SCROLLCHILDREN)); - SetScrollOffset(x, y, FALSE); - } - - bHandled = FALSE; - return 1; - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - pT->DoPaint(dc); - dc.SetViewportOrg(ptViewportOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); - pT->DoPaint(dc.m_hDC); - } - return 0; - } - - // scrolling handlers - LRESULT OnScrollUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineUp(); - return 0; - } - - LRESULT OnScrollDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineDown(); - return 0; - } - - LRESULT OnScrollPageUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageUp(); - return 0; - } - - LRESULT OnScrollPageDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageDown(); - return 0; - } - - LRESULT OnScrollTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollTop(); - return 0; - } - - LRESULT OnScrollBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollBottom(); - return 0; - } - - LRESULT OnScrollLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineLeft(); - return 0; - } - - LRESULT OnScrollRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollLineRight(); - return 0; - } - - LRESULT OnScrollPageLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageLeft(); - return 0; - } - - LRESULT OnScrollPageRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollPageRight(); - return 0; - } - - LRESULT OnScrollAllLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollAllLeft(); - return 0; - } - - LRESULT OnScrollAllRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - ScrollAllRight(); - return 0; - } - -// Overrideables - void DoPaint(CDCHandle /*dc*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } - -// Implementation - void DoScroll(int nType, int nScrollCode, int& cxyOffset, int cxySizeAll, int cxySizePage, int cxySizeLine) - { - T* pT = static_cast(this); - RECT rect = { 0 }; - pT->GetClientRect(&rect); - int cxyClient = (nType == SB_VERT) ? rect.bottom : rect.right; - int cxyMax = cxySizeAll - cxyClient; - - if(cxyMax < 0) // can't scroll, client area is bigger - return; - - bool bUpdate = true; - int cxyScroll = 0; - - switch(nScrollCode) - { - case SB_TOP: // top or all left - cxyScroll = cxyOffset; - cxyOffset = 0; - break; - case SB_BOTTOM: // bottom or all right - cxyScroll = cxyOffset - cxyMax; - cxyOffset = cxyMax; - break; - case SB_LINEUP: // line up or line left - if(cxyOffset >= cxySizeLine) - { - cxyScroll = cxySizeLine; - cxyOffset -= cxySizeLine; - } - else - { - cxyScroll = cxyOffset; - cxyOffset = 0; - } - break; - case SB_LINEDOWN: // line down or line right - if(cxyOffset < cxyMax - cxySizeLine) - { - cxyScroll = -cxySizeLine; - cxyOffset += cxySizeLine; - } - else - { - cxyScroll = cxyOffset - cxyMax; - cxyOffset = cxyMax; - } - break; - case SB_PAGEUP: // page up or page left - if(cxyOffset >= cxySizePage) - { - cxyScroll = cxySizePage; - cxyOffset -= cxySizePage; - } - else - { - cxyScroll = cxyOffset; - cxyOffset = 0; - } - break; - case SB_PAGEDOWN: // page down or page right - if(cxyOffset < cxyMax - cxySizePage) - { - cxyScroll = -cxySizePage; - cxyOffset += cxySizePage; - } - else - { - cxyScroll = cxyOffset - cxyMax; - cxyOffset = cxyMax; - } - break; - case SB_THUMBTRACK: - if(IsNoThumbTracking()) - break; - // else fall through - case SB_THUMBPOSITION: - { - SCROLLINFO si = { sizeof(SCROLLINFO), SIF_TRACKPOS }; - if(pT->GetScrollInfo(nType, &si)) - { - cxyScroll = cxyOffset - si.nTrackPos; - cxyOffset = si.nTrackPos; - } - } - break; - case SB_ENDSCROLL: - default: - bUpdate = false; - break; - } - - if(bUpdate && cxyScroll != 0) - { - pT->SetScrollPos(nType, cxyOffset, TRUE); - if(nType == SB_VERT) - pT->ScrollWindowEx(0, cxyScroll, m_uScrollFlags); - else - pT->ScrollWindowEx(cxyScroll, 0, m_uScrollFlags); - } - } - - static int CalcLineOrPage(int nVal, int nMax, int nDiv) - { - if(nVal == 0) - { - nVal = nMax / nDiv; - if(nVal < 1) - nVal = 1; - } - else if(nVal > nMax) - { - nVal = nMax; - } - - return nVal; - } - - bool AdjustScrollOffset(int& x, int& y) - { - int xOld = x; - int yOld = y; - - int cxMax = m_sizeAll.cx - m_sizeClient.cx; - if(x > cxMax) - x = (cxMax >= 0) ? cxMax : 0; - else if(x < 0) - x = 0; - - int cyMax = m_sizeAll.cy - m_sizeClient.cy; - if(y > cyMax) - y = (cyMax >= 0) ? cyMax : 0; - else if(y < 0) - y = 0; - - return (x != xOld || y != yOld); - } - - void GetSystemSettings() - { -#ifndef _WIN32_WCE -#ifndef SPI_GETWHEELSCROLLLINES - const UINT SPI_GETWHEELSCROLLLINES = 104; -#endif // !SPI_GETWHEELSCROLLLINES - ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &m_nWheelLines, 0); - -#ifndef SPI_GETWHEELSCROLLCHARS - const UINT SPI_GETWHEELSCROLLCHARS = 0x006C; -#endif // !SPI_GETWHEELSCROLLCHARS - ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &m_nHWheelChars, 0); - -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - if(m_uMsgMouseWheel != 0) - m_uMsgMouseWheel = ::RegisterWindowMessage(MSH_MOUSEWHEEL); - - HWND hWndWheel = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE); - if(::IsWindow(hWndWheel)) - { - UINT uMsgScrollLines = ::RegisterWindowMessage(MSH_SCROLL_LINES); - if(uMsgScrollLines != 0) - m_nWheelLines = (int)::SendMessage(hWndWheel, uMsgScrollLines, 0, 0L); - } -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) -#endif // !_WIN32_WCE - } - - bool IsScrollingChildren() const - { - return (m_dwExtendedStyle & SCRL_SCROLLCHILDREN) != 0; - } - - bool IsErasingBackground() const - { - return (m_dwExtendedStyle & SCRL_ERASEBACKGROUND) != 0; - } - - bool IsNoThumbTracking() const - { - return (m_dwExtendedStyle & SCRL_NOTHUMBTRACKING) != 0; - } - -#if (WINVER >= 0x0500) - bool IsSmoothScroll() const - { - return (m_dwExtendedStyle & SCRL_SMOOTHSCROLL) != 0; - } -#endif // (WINVER >= 0x0500) -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CScrollWindowImpl - Implements a scrollable window - -template -class ATL_NO_VTABLE CScrollWindowImpl : public ATL::CWindowImpl, public CScrollImpl< T > -{ -public: - BEGIN_MSG_MAP(CScrollWindowImpl) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, CScrollImpl< T >::OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, CScrollImpl< T >::OnPaint) -#endif // !_WIN32_WCE - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CMapScrollImpl - Provides mapping and scrolling support to any window - -#ifndef _WIN32_WCE - -template -class CMapScrollImpl : public CScrollImpl< T > -{ -public: - int m_nMapMode; - RECT m_rectLogAll; - SIZE m_sizeLogLine; - SIZE m_sizeLogPage; - -// Constructor - CMapScrollImpl() : m_nMapMode(MM_TEXT) - { - ::SetRectEmpty(&m_rectLogAll); - m_sizeLogPage.cx = 0; - m_sizeLogPage.cy = 0; - m_sizeLogLine.cx = 0; - m_sizeLogLine.cy = 0; - } - -// Attributes & Operations - // mapping mode operations - void SetScrollMapMode(int nMapMode) - { - ATLASSERT(nMapMode >= MM_MIN && nMapMode <= MM_MAX_FIXEDSCALE); - m_nMapMode = nMapMode; - } - - int GetScrollMapMode() const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - return m_nMapMode; - } - - // offset operations - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - POINT ptOff = { x, y }; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&ptOff); - } - CScrollImpl< T >::SetScrollOffset(ptOff, bRedraw); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - ptOffset = m_ptOffset; - // block: convert device to logical units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.DPtoLP(&ptOffset); - } - } - - // size operations - void SetScrollSize(int xMin, int yMin, int xMax, int yMax, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - ATLASSERT(xMax > xMin && yMax > yMin); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - - ::SetRect(&m_rectLogAll, xMin, yMin, xMax, yMax); - - SIZE sizeAll = { 0 }; - sizeAll.cx = xMax - xMin + 1; - sizeAll.cy = yMax - yMin + 1; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&sizeAll); - } - CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); - SetScrollLine(0, 0); - SetScrollPage(0, 0); - } - - void SetScrollSize(RECT& rcScroll, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(rcScroll.left, rcScroll.top, rcScroll.right, rcScroll.bottom, bRedraw, bResetOffset); - } - - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(0, 0, cx, cy, bRedraw, bResetOffset); - } - - void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(0, 0, size.cx, size.cy, bRedraw, bResetOffset); - } - - void GetScrollSize(RECT& rcScroll) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - rcScroll = m_rectLogAll; - } - - // line operations - void SetScrollLine(int cxLine, int cyLine) - { - ATLASSERT(cxLine >= 0 && cyLine >= 0); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - - m_sizeLogLine.cx = cxLine; - m_sizeLogLine.cy = cyLine; - SIZE sizeLine = m_sizeLogLine; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&sizeLine); - } - CScrollImpl< T >::SetScrollLine(sizeLine); - } - - void SetScrollLine(SIZE sizeLine) - { - SetScrollLine(sizeLine.cx, sizeLine.cy); - } - - void GetScrollLine(SIZE& sizeLine) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - sizeLine = m_sizeLogLine; - } - - // page operations - void SetScrollPage(int cxPage, int cyPage) - { - ATLASSERT(cxPage >= 0 && cyPage >= 0); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - - m_sizeLogPage.cx = cxPage; - m_sizeLogPage.cy = cyPage; - SIZE sizePage = m_sizeLogPage; - // block: convert logical to device units - { - CWindowDC dc(NULL); - dc.SetMapMode(m_nMapMode); - dc.LPtoDP(&sizePage); - } - CScrollImpl< T >::SetScrollPage(sizePage); - } - - void SetScrollPage(SIZE sizePage) - { - SetScrollPage(sizePage.cx, sizePage.cy); - } - - void GetScrollPage(SIZE& sizePage) const - { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); - sizePage = m_sizeLogPage; - } - - BEGIN_MSG_MAP(CMapScrollImpl) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - int nMapModeSav = dc.GetMapMode(); - dc.SetMapMode(m_nMapMode); - POINT ptViewportOrg = { 0, 0 }; - if(m_nMapMode == MM_TEXT) - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - else - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy, &ptViewportOrg); - POINT ptWindowOrg = { 0, 0 }; - dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top, &ptWindowOrg); - - pT->DoPaint(dc); - - dc.SetMapMode(nMapModeSav); - dc.SetViewportOrg(ptViewportOrg); - dc.SetWindowOrg(ptWindowOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - dc.SetMapMode(m_nMapMode); - if(m_nMapMode == MM_TEXT) - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); - else - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy); - dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top); - pT->DoPaint(dc.m_hDC); - } - return 0; - } -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CMapScrollWindowImpl - Implements scrolling window with mapping - -#ifndef _WIN32_WCE - -template -class ATL_NO_VTABLE CMapScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CMapScrollImpl< T > -{ -public: - BEGIN_MSG_MAP(CMapScrollWindowImpl) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, CMapScrollImpl< T >::OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, CMapScrollImpl< T >::OnPaint) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CFSBWindow - Use as a base instead of CWindow to get flat scroll bar support - -#if defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - -template -class CFSBWindowT : public TBase, public CFlatScrollBarImpl > -{ -public: -// Constructors - CFSBWindowT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CFSBWindowT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// CWindow overrides that use flat scroll bar API -// (only those methods that are used by scroll window classes) - int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_SetScrollPos(nBar, nPos, bRedraw); - } - - BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_GetScrollInfo(nBar, lpScrollInfo); - } - - BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_SetScrollInfo(nBar, lpScrollInfo, bRedraw); - } -}; - -typedef CFSBWindowT CFSBWindow; - -#endif // defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollImpl - Provides zooming and scrolling support to any window - -#ifndef _WIN32_WCE - -// The zoom modes that can be set with the SetZoomMode method -enum -{ - ZOOMMODE_OFF, - ZOOMMODE_IN, // If left mouse button is clicked or dragged, zoom in on point clicked or rectangle dragged. - ZOOMMODE_OUT // If left mouse button clicked, zoom out on point clicked. -}; - -// Notification to parent that zoom scale changed as a result of user mouse action. -#define ZSN_ZOOMCHANGED (NM_FIRST - 50) - -template -class CZoomScrollImpl : public CScrollImpl< T > -{ -public: - enum { m_cxyMinZoomRect = 12 }; // min rect size to zoom in on rect. - -// Data members - SIZE m_sizeLogAll; - SIZE m_sizeLogLine; - SIZE m_sizeLogPage; - float m_fZoomScale; - float m_fZoomScaleMin; - float m_fZoomDelta; // Used in ZOOMMODE_IN and ZOOMMODE_OUT on left-button click. - int m_nZoomMode; - RECT m_rcTrack; - bool m_bTracking; - -// Constructor - CZoomScrollImpl(): - m_fZoomScale(1.0), - m_fZoomScaleMin(0.5), - m_fZoomDelta(0.5), - m_nZoomMode(ZOOMMODE_OFF), - m_bTracking(false) - { - m_sizeLogAll.cx = 0; - m_sizeLogAll.cy = 0; - m_sizeLogPage.cx = 0; - m_sizeLogPage.cy = 0; - m_sizeLogLine.cx = 0; - m_sizeLogLine.cy = 0; - ::SetRectEmpty(&m_rcTrack); - } - -// Attributes & Operations - - // size operations - void SetScrollSize(int cxLog, int cyLog, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - ATLASSERT(cxLog >= 0 && cyLog >= 0); - - // Set up the defaults - if (cxLog == 0 && cyLog == 0) - { - cxLog = 1; - cyLog = 1; - } - - m_sizeLogAll.cx = cxLog; - m_sizeLogAll.cy = cyLog; - SIZE sizeAll = { 0 }; - sizeAll.cx = (int)((float)m_sizeLogAll.cx * m_fZoomScale); - sizeAll.cy = (int)((float)m_sizeLogAll.cy * m_fZoomScale); - - CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); - } - - void SetScrollSize(SIZE sizeLog, BOOL bRedraw = TRUE, bool bResetOffset = true) - { - SetScrollSize(sizeLog.cx, sizeLog.cy, bRedraw, bResetOffset); - } - - void GetScrollSize(SIZE& sizeLog) const - { - sizeLog = m_sizeLogAll; - } - - // line operations - void SetScrollLine(int cxLogLine, int cyLogLine) - { - ATLASSERT(cxLogLine >= 0 && cyLogLine >= 0); - - m_sizeLogLine.cx = cxLogLine; - m_sizeLogLine.cy = cyLogLine; - - SIZE sizeLine = { 0 }; - sizeLine.cx = (int)((float)m_sizeLogLine.cx * m_fZoomScale); - sizeLine.cy = (int)((float)m_sizeLogLine.cy * m_fZoomScale); - CScrollImpl< T >::SetScrollLine(sizeLine); - } - - void SetScrollLine(SIZE sizeLogLine) - { - SetScrollLine(sizeLogLine.cx, sizeLogLine.cy); - } - - void GetScrollLine(SIZE& sizeLogLine) const - { - sizeLogLine = m_sizeLogLine; - } - - // page operations - void SetScrollPage(int cxLogPage, int cyLogPage) - { - ATLASSERT(cxLogPage >= 0 && cyLogPage >= 0); - - m_sizeLogPage.cx = cxLogPage; - m_sizeLogPage.cy = cyLogPage; - - SIZE sizePage = { 0 }; - sizePage.cx = (int)((float)m_sizeLogPage.cx * m_fZoomScale); - sizePage.cy = (int)((float)m_sizeLogPage.cy * m_fZoomScale); - - CScrollImpl< T >::SetScrollPage(sizePage); - } - - void SetScrollPage(SIZE sizeLogPage) - { - SetScrollPage(sizeLogPage.cx, sizeLogPage.cy); - } - - void GetScrollPage(SIZE& sizeLogPage) const - { - sizeLogPage = m_sizeLogPage; - } - - void SetZoomScale(float fZoomScale) - { - ATLASSERT(fZoomScale > 0); - - if(fZoomScale > 0 && fZoomScale >= m_fZoomScaleMin) - m_fZoomScale = fZoomScale; - } - - float GetZoomScale() const - { - return m_fZoomScale; - } - - void SetZoomScaleMin(float fZoomScaleMin) - { - m_fZoomScaleMin = fZoomScaleMin; - } - - float GetZoomScaleMin() const - { - return m_fZoomScaleMin; - } - - void SetZoomDelta(float fZoomDelta) - { - ATLASSERT(fZoomDelta >= 0); - - if(fZoomDelta >= 0) - m_fZoomDelta = fZoomDelta; - } - - float GetZoomDelta() const - { - return m_fZoomDelta; - } - - void SetZoomMode(int nZoomMode) - { - m_nZoomMode = nZoomMode; - } - - int GetZoomMode() const - { - return m_nZoomMode; - } - - void Zoom(int x, int y, float fZoomScale) - { - if(fZoomScale <= 0) - return; - - fZoomScale = max(fZoomScale, m_fZoomScaleMin); - - T* pT = static_cast(this); - POINT pt = { x, y }; - if(!pT->PtInDevRect(pt)) - return; - - pT->ViewDPtoLP(&pt); - pT->Zoom(fZoomScale, false); - pT->CenterOnLogicalPoint(pt); - } - - void Zoom(POINT pt, float fZoomScale) - { - T* pT = static_cast(this); - pT->Zoom(pt.x, pt.y, fZoomScale); - } - - void Zoom(RECT& rc) - { - T* pT = static_cast(this); - RECT rcZoom = rc; - pT->NormalizeRect(rcZoom); - SIZE size = { rcZoom.right - rcZoom.left, rcZoom.bottom - rcZoom.top }; - POINT pt = { rcZoom.left + size.cx / 2, rcZoom.top + size.cy / 2 }; - if(size.cx < m_cxyMinZoomRect || size.cy < m_cxyMinZoomRect) - { - pT->Zoom(pt, m_fZoomScale + m_fZoomDelta); - return; - } - - ATLASSERT(size.cx > 0 && size.cy > 0); - - float fScaleH = (float)(m_sizeClient.cx + 1) / (float)size.cx; - float fScaleV = (float)(m_sizeClient.cy + 1) / (float)size.cy; - float fZoomScale = min(fScaleH, fScaleV) * m_fZoomScale; - pT->Zoom(pt, fZoomScale); - } - - void Zoom(float fZoomScale, bool bCenter = true) - { - if(fZoomScale <= 0) - return; - - fZoomScale = max(fZoomScale, m_fZoomScaleMin); - - - T* pT = static_cast(this); - POINT pt = { 0 }; - if(bCenter) - { - RECT rc; - ::GetClientRect(pT->m_hWnd, &rc); - pt.x = rc.right / 2; - pt.y = rc.bottom / 2; - pT->ViewDPtoLP(&pt); - } - - // Modify the Viewport extent - m_fZoomScale = fZoomScale; - SIZE sizeAll = { 0 }; - sizeAll.cx = (int)((float)m_sizeLogAll.cx * fZoomScale); - sizeAll.cy = (int)((float)m_sizeLogAll.cy * fZoomScale); - - // Update scroll bars and window - CScrollImpl< T >::SetScrollSize(sizeAll); - - if(bCenter) - pT->CenterOnLogicalPoint(pt); - } - - // Helper functions - void PrepareDC(CDCHandle dc) - { - ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); - dc.SetMapMode(MM_ANISOTROPIC); - dc.SetWindowExt(m_sizeLogAll); - dc.SetViewportExt(m_sizeAll); - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); - } - - void ViewDPtoLP(LPPOINT lpPoints, int nCount = 1) - { - ATLASSERT(lpPoints); - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - CWindowDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - dc.DPtoLP(lpPoints, nCount); - } - - void ViewLPtoDP(LPPOINT lpPoints, int nCount = 1) - { - ATLASSERT(lpPoints); - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - - CWindowDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - dc.LPtoDP(lpPoints, nCount); - } - - void ClientToDevice(POINT &pt) - { - pt.x += m_ptOffset.x; - pt.y += m_ptOffset.y; - } - - void DeviceToClient(POINT &pt) - { - pt.x -= m_ptOffset.x; - pt.y -= m_ptOffset.y; - } - - void CenterOnPoint(POINT pt) - { - T* pT = static_cast(this); - RECT rect; - pT->GetClientRect(&rect); - - int xOfs = pt.x - (rect.right / 2) + m_ptOffset.x; - if(xOfs < 0) - { - xOfs = 0; - } - else - { - int xMax = max((int)(m_sizeAll.cx - rect.right), 0); - if(xOfs > xMax) - xOfs = xMax; - } - - int yOfs = pt.y - (rect.bottom / 2) + m_ptOffset.y; - if(yOfs < 0) - { - yOfs = 0; - } - else - { - int yMax = max((int)(m_sizeAll.cy - rect.bottom), 0); - if(yOfs > yMax) - yOfs = yMax; - } - - CScrollImpl< T >::SetScrollOffset(xOfs, yOfs); - } - - void CenterOnLogicalPoint(POINT ptLog) - { - T* pT = static_cast(this); - pT->ViewLPtoDP(&ptLog); - pT->DeviceToClient(ptLog); - pT->CenterOnPoint(ptLog); - } - - BOOL PtInDevRect(POINT pt) - { - RECT rc = { 0, 0, m_sizeAll.cx, m_sizeAll.cy }; - ::OffsetRect(&rc, -m_ptOffset.x, -m_ptOffset.y); - return ::PtInRect(&rc, pt); - } - - void NormalizeRect(RECT& rc) - { - if(rc.left > rc.right) - { - int r = rc.right; - rc.right = rc.left; - rc.left = r; - } - if(rc.top > rc.bottom) - { - int b = rc.bottom; - rc.bottom = rc.top; - rc.top = b; - } - } - - void DrawTrackRect() - { - T* pT = static_cast(this); - const SIZE sizeLines = { 2, 2 }; - RECT rc = m_rcTrack; - pT->NormalizeRect(rc); - if(!::IsRectEmpty(&rc)) - { - ::MapWindowPoints(pT->m_hWnd, NULL, (LPPOINT)&rc, 2); - CWindowDC dc(NULL); - dc.DrawDragRect(&rc, sizeLines, NULL, sizeLines); - } - } - - void NotifyParentZoomChanged() - { - T* pT = static_cast(this); - int nId = pT->GetDlgCtrlID(); - NMHDR nmhdr = { pT->m_hWnd, nId, ZSN_ZOOMCHANGED }; - ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nId, (LPARAM)&nmhdr); - } - - BEGIN_MSG_MAP(CZoomScrollImpl) - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_sizeLogAll.cx >= 0 && m_sizeLogAll.cy >= 0); - ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); - - if(wParam != NULL) - { - CDCHandle dc = (HDC)wParam; - int nMapModeSav = dc.GetMapMode(); - dc.SetMapMode(MM_ANISOTROPIC); - SIZE szWindowExt = { 0, 0 }; - dc.SetWindowExt(m_sizeLogAll, &szWindowExt); - SIZE szViewportExt = { 0, 0 }; - dc.SetViewportExt(m_sizeAll, &szViewportExt); - POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); - - pT->DoPaint(dc); - - dc.SetMapMode(nMapModeSav); - dc.SetWindowExt(szWindowExt); - dc.SetViewportExt(szViewportExt); - dc.SetViewportOrg(ptViewportOrg); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->PrepareDC(dc.m_hDC); - pT->DoPaint(dc.m_hDC); - } - return 0; - } - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_nZoomMode == ZOOMMODE_IN && !m_bTracking) - { - T* pT = static_cast(this); - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(pT->PtInDevRect(pt)) - { - pT->SetCapture(); - m_bTracking = true; - ::SetRect(&m_rcTrack, pt.x, pt.y, pt.x, pt.y); - } - } - bHandled = FALSE; - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - if(m_bTracking) - { - T* pT = static_cast(this); - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if(pT->PtInDevRect(pt)) - { - pT->DrawTrackRect(); - m_rcTrack.right = pt.x; - m_rcTrack.bottom = pt.y; - pT->DrawTrackRect(); - } - } - bHandled = FALSE; - return 0; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - ::ReleaseCapture(); - if(m_nZoomMode == ZOOMMODE_OUT) - { - T* pT = static_cast(this); - pT->Zoom(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), m_fZoomScale - m_fZoomDelta); - pT->NotifyParentZoomChanged(); - } - bHandled = FALSE; - return 0; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_bTracking) - { - m_bTracking = false; - T* pT = static_cast(this); - pT->DrawTrackRect(); - pT->Zoom(m_rcTrack); - pT->NotifyParentZoomChanged(); - ::SetRectEmpty(&m_rcTrack); - } - bHandled = FALSE; - return 0; - } - - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if(LOWORD(lParam) == HTCLIENT && m_nZoomMode != ZOOMMODE_OFF) - { - T* pT = static_cast(this); - if((HWND)wParam == pT->m_hWnd) - { - DWORD dwPos = ::GetMessagePos(); - POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&pt); - if(pT->PtInDevRect(pt)) - { - ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); - return 1; - } - } - } - bHandled = FALSE; - return 0; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollWindowImpl - Implements scrolling window with zooming - -template -class ATL_NO_VTABLE CZoomScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > -{ -public: - BEGIN_MSG_MAP(CZoomScrollWindowImpl) - MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) - MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) - MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) - MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) - MESSAGE_HANDLER(WM_PAINT, CZoomScrollImpl< T >::OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, CZoomScrollImpl< T >::OnPaint) - MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) - MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) - MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) - ALT_MSG_MAP(1) - COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) - COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) - COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) - COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) - COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) - COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) - COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) - COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) - END_MSG_MAP() -}; - -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// CScrollContainer - -template -class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, TWinTraits > -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, -1) - - typedef CScrollWindowImpl< T, TBase, TWinTraits > _baseClass; - -// Data members - ATL::CWindow m_wndClient; - bool m_bAutoSizeClient; - bool m_bDrawEdgeIfEmpty; - -// Constructor - CScrollContainerImpl() : m_bAutoSizeClient(true), m_bDrawEdgeIfEmpty(false) - { - // Set CScrollWindowImpl extended style - SetScrollExtendedStyle(SCRL_SCROLLCHILDREN); - } - -// Attributes - HWND GetClient() const - { - return m_wndClient; - } - - HWND SetClient(HWND hWndClient, bool bClientSizeAsMin = true) - { - ATLASSERT(::IsWindow(m_hWnd)); - - HWND hWndOldClient = m_wndClient; - m_wndClient = hWndClient; - - SetRedraw(FALSE); - SetScrollSize(1, 1, FALSE); - - if(m_wndClient.m_hWnd != NULL) - { - m_wndClient.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - - if(bClientSizeAsMin) - { - RECT rect = { 0 }; - m_wndClient.GetWindowRect(&rect); - if((rect.right - rect.left) > 0 && (rect.bottom - rect.top) > 0) - SetScrollSize(rect.right - rect.left, rect.bottom - rect.top, FALSE); - } - - T* pT = static_cast(this); - pT->UpdateLayout(); - } - - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - - return hWndOldClient; - } - -// Message map and handlers - BEGIN_MSG_MAP(CScrollContainerImpl) - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(_baseClass) - FORWARD_NOTIFICATIONS() - ALT_MSG_MAP(1) - CHAIN_MSG_MAP_ALT(_baseClass, 1) - END_MSG_MAP() - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(m_wndClient.m_hWnd != NULL) - m_wndClient.SetFocus(); - - return 0; - } - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - BOOL bTmp = TRUE; - LRESULT lRet = _baseClass::OnSize(uMsg, wParam, lParam, bTmp); - - T* pT = static_cast(this); - pT->UpdateLayout(); - - return lRet; - } - -// Overrides for CScrollWindowImpl - void DoPaint(CDCHandle dc) - { - if(!m_bAutoSizeClient || m_wndClient.m_hWnd == NULL) - { - T* pT = static_cast(this); - RECT rect = { 0 }; - pT->GetContainerRect(rect); - - if(m_bDrawEdgeIfEmpty && m_wndClient.m_hWnd == NULL) - dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - - dc.FillRect(&rect, COLOR_APPWORKSPACE); - } - } - - void ScrollToView(POINT pt) - { - CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(pt); - } - - void ScrollToView(RECT& rect) - { - CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(rect); - } - - void ScrollToView(HWND hWnd) // client window coordinates - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_wndClient.IsWindow()); - - RECT rect = { 0 }; - ::GetWindowRect(hWnd, &rect); - ::MapWindowPoints(NULL, m_wndClient.m_hWnd, (LPPOINT)&rect, 2); - ScrollToView(rect); - } - -// Implementation - overrideable methods - void UpdateLayout() - { - ATLASSERT(::IsWindow(m_hWnd)); - - if(m_bAutoSizeClient && m_wndClient.m_hWnd != NULL) - { - T* pT = static_cast(this); - RECT rect = { 0 }; - pT->GetContainerRect(rect); - - m_wndClient.SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); - } - else - { - Invalidate(); - } - } - - void GetContainerRect(RECT& rect) - { - GetClientRect(&rect); - - if(rect.right < m_sizeAll.cx) - rect.right = m_sizeAll.cx; - - if(rect.bottom < m_sizeAll.cy) - rect.bottom = m_sizeAll.cy; - } -}; - -class CScrollContainer : public CScrollContainerImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_ScrollContainer"), 0, -1) -}; - -}; // namespace WTL - -#endif // __ATLSCRL_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLSCRL_H__ +#define __ATLSCRL_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlscrl.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atlscrl.h requires atlwin.h to be included first +#endif + +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + #include +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + +#ifndef GET_WHEEL_DELTA_WPARAM + #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) +#endif + +#ifndef WM_MOUSEHWHEEL + #define WM_MOUSEHWHEEL 0x020E +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CScrollImpl +// CScrollWindowImpl +// CMapScrollImpl +// CMapScrollWindowImpl +// CFSBWindowT +// CZoomScrollImpl +// CZoomScrollWindowImpl +// CScrollContainerImpl +// CScrollContainer + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CScrollImpl - Provides scrolling support to any window + +// Scroll extended styles +#define SCRL_SCROLLCHILDREN 0x00000001 +#define SCRL_ERASEBACKGROUND 0x00000002 +#define SCRL_NOTHUMBTRACKING 0x00000004 +#if (WINVER >= 0x0500) +#define SCRL_SMOOTHSCROLL 0x00000008 +#endif // (WINVER >= 0x0500) +#define SCRL_DISABLENOSCROLLV 0x00000010 +#define SCRL_DISABLENOSCROLLH 0x00000020 +#define SCRL_DISABLENOSCROLL (SCRL_DISABLENOSCROLLV | SCRL_DISABLENOSCROLLH) + + +template +class CScrollImpl +{ +public: + enum { uSCROLL_FLAGS = SW_INVALIDATE }; + + POINT m_ptOffset; + SIZE m_sizeAll; + SIZE m_sizeLine; + SIZE m_sizePage; + SIZE m_sizeClient; + int m_zDelta; // current wheel value + int m_nWheelLines; // number of lines to scroll on wheel +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + // Note that this message must be forwarded from a top level window + UINT m_uMsgMouseWheel; // MSH_MOUSEWHEEL +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + int m_zHDelta; // current horizontal wheel value + int m_nHWheelChars; // number of chars to scroll on horizontal wheel + UINT m_uScrollFlags; + DWORD m_dwExtendedStyle; // scroll specific extended styles + +// Constructor + CScrollImpl() : m_zDelta(0), m_nWheelLines(3), +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + m_uMsgMouseWheel(0U), +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + m_zHDelta(0), m_nHWheelChars(3), + m_uScrollFlags(0U), m_dwExtendedStyle(0) + { + m_ptOffset.x = 0; + m_ptOffset.y = 0; + m_sizeAll.cx = 0; + m_sizeAll.cy = 0; + m_sizePage.cx = 0; + m_sizePage.cy = 0; + m_sizeLine.cx = 0; + m_sizeLine.cy = 0; + m_sizeClient.cx = 0; + m_sizeClient.cy = 0; + + SetScrollExtendedStyle(SCRL_SCROLLCHILDREN | SCRL_ERASEBACKGROUND); + } + +// Attributes & Operations + DWORD GetScrollExtendedStyle() const + { + return m_dwExtendedStyle; + } + + DWORD SetScrollExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + // cache scroll flags + T* pT = static_cast(this); + pT; // avoid level 4 warning + m_uScrollFlags = pT->uSCROLL_FLAGS | (IsScrollingChildren() ? SW_SCROLLCHILDREN : 0) | (IsErasingBackground() ? SW_ERASE : 0); +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + m_uScrollFlags |= (IsSmoothScroll() ? SW_SMOOTHSCROLL : 0); +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) + return dwPrevStyle; + } + + // offset operations + void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + pT->AdjustScrollOffset(x, y); + + int dx = m_ptOffset.x - x; + int dy = m_ptOffset.y - y; + m_ptOffset.x = x; + m_ptOffset.y = y; + + // block: set horizontal scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_POS; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nPos = m_ptOffset.x; + pT->SetScrollInfo(SB_HORZ, &si, bRedraw); + } + + // block: set vertical scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_POS; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nPos = m_ptOffset.y; + pT->SetScrollInfo(SB_VERT, &si, bRedraw); + } + + // Move all children if needed + if(IsScrollingChildren() && (dx != 0 || dy != 0)) + { + for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) + { + RECT rect = { 0 }; + ::GetWindowRect(hWndChild, &rect); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); + ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + } + } + + if(bRedraw) + pT->Invalidate(); + } + + void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) + { + SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); + } + + void GetScrollOffset(POINT& ptOffset) const + { + ptOffset = m_ptOffset; + } + + // size operations + void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + m_sizeAll.cx = cx; + m_sizeAll.cy = cy; + + int x = 0; + int y = 0; + if(!bResetOffset) + { + x = m_ptOffset.x; + y = m_ptOffset.y; + pT->AdjustScrollOffset(x, y); + } + + int dx = m_ptOffset.x - x; + int dy = m_ptOffset.y - y; + m_ptOffset.x = x; + m_ptOffset.y = y; + + // block: set horizontal scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nMin = 0; + si.nMax = m_sizeAll.cx - 1; + si.nPage = m_sizeClient.cx; + si.nPos = m_ptOffset.x; + pT->SetScrollInfo(SB_HORZ, &si, bRedraw); + } + + // block: set vertical scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nMin = 0; + si.nMax = m_sizeAll.cy - 1; + si.nPage = m_sizeClient.cy; + si.nPos = m_ptOffset.y; + pT->SetScrollInfo(SB_VERT, &si, bRedraw); + } + + // Move all children if needed + if(IsScrollingChildren() && (dx != 0 || dy != 0)) + { + for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) + { + RECT rect = { 0 }; + ::GetWindowRect(hWndChild, &rect); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); + ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + } + } + + SetScrollLine(0, 0); + SetScrollPage(0, 0); + + if(bRedraw) + pT->Invalidate(); + } + + void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + SetScrollSize(size.cx, size.cy, bRedraw, bResetOffset); + } + + void GetScrollSize(SIZE& sizeWnd) const + { + sizeWnd = m_sizeAll; + } + + // line operations + void SetScrollLine(int cxLine, int cyLine) + { + ATLASSERT(cxLine >= 0 && cyLine >= 0); + ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); + + m_sizeLine.cx = T::CalcLineOrPage(cxLine, m_sizeAll.cx, 100); + m_sizeLine.cy = T::CalcLineOrPage(cyLine, m_sizeAll.cy, 100); + } + + void SetScrollLine(SIZE sizeLine) + { + SetScrollLine(sizeLine.cx, sizeLine.cy); + } + + void GetScrollLine(SIZE& sizeLine) const + { + sizeLine = m_sizeLine; + } + + // page operations + void SetScrollPage(int cxPage, int cyPage) + { + ATLASSERT(cxPage >= 0 && cyPage >= 0); + ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); + + m_sizePage.cx = T::CalcLineOrPage(cxPage, m_sizeAll.cx, 10); + m_sizePage.cy = T::CalcLineOrPage(cyPage, m_sizeAll.cy, 10); + } + + void SetScrollPage(SIZE sizePage) + { + SetScrollPage(sizePage.cx, sizePage.cy); + } + + void GetScrollPage(SIZE& sizePage) const + { + sizePage = m_sizePage; + } + + // commands + void ScrollLineDown() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, SB_LINEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + } + + void ScrollLineUp() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, SB_LINEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + } + + void ScrollPageDown() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, SB_PAGEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + } + + void ScrollPageUp() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, SB_PAGEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + } + + void ScrollTop() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, SB_TOP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + } + + void ScrollBottom() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, SB_BOTTOM, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + } + + void ScrollLineRight() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, SB_LINEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + } + + void ScrollLineLeft() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, SB_LINEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + } + + void ScrollPageRight() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, SB_PAGEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + } + + void ScrollPageLeft() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, SB_PAGEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + } + + void ScrollAllLeft() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, SB_TOP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + } + + void ScrollAllRight() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, SB_BOTTOM, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + } + + // scroll to make point/view/window visible + void ScrollToView(POINT pt) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + RECT rect = { pt.x, pt.y, pt.x, pt.y }; + pT->ScrollToView(rect); + } + + void ScrollToView(RECT& rect) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + RECT rcClient = { 0 }; + pT->GetClientRect(&rcClient); + + int x = m_ptOffset.x; + if(rect.left < m_ptOffset.x) + x = rect.left; + else if(rect.right > (m_ptOffset.x + rcClient.right)) + x = rect.right - rcClient.right; + + int y = m_ptOffset.y; + if(rect.top < m_ptOffset.y) + y = rect.top; + else if(rect.bottom > (m_ptOffset.y + rcClient.bottom)) + y = rect.bottom - rcClient.bottom; + + SetScrollOffset(x, y); + } + + void ScrollToView(HWND hWnd) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + RECT rect = { 0 }; + ::GetWindowRect(hWnd, &rect); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); + ScrollToView(rect); + } + + BEGIN_MSG_MAP(CScrollImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_VSCROLL, OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + MESSAGE_HANDLER(m_uMsgMouseWheel, OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnMouseHWheel) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_PAINT, OnPaint) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) +#endif // !_WIN32_WCE + // standard scroll commands + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, OnScrollAllRight) + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + GetSystemSettings(); + bHandled = FALSE; + return 1; + } + + LRESULT OnVScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_VERT, (int)(short)LOWORD(wParam), (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + return 0; + } + + LRESULT OnHScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + pT->DoScroll(SB_HORZ, (int)(short)LOWORD(wParam), (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + return 0; + } + + LRESULT OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + +#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE) + uMsg; + int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); +#else + int zDelta = (uMsg == WM_MOUSEWHEEL) ? (int)GET_WHEEL_DELTA_WPARAM(wParam) : (int)wParam; +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE)) + int nScrollCode = (m_nWheelLines == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGEUP : SB_PAGEDOWN) : ((zDelta > 0) ? SB_LINEUP : SB_LINEDOWN); + m_zDelta += zDelta; // cumulative + int zTotal = (m_nWheelLines == WHEEL_PAGESCROLL) ? abs(m_zDelta) : abs(m_zDelta) * m_nWheelLines; + if(m_sizeAll.cy > m_sizeClient.cy) + { + for(int i = 0; i < zTotal; i += WHEEL_DELTA) + { + pT->DoScroll(SB_VERT, nScrollCode, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); + pT->UpdateWindow(); + } + } + else // can't scroll vertically, scroll horizontally + { + for(int i = 0; i < zTotal; i += WHEEL_DELTA) + { + pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + pT->UpdateWindow(); + } + } + m_zDelta %= WHEEL_DELTA; + + return 0; + } + + LRESULT OnMouseHWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); + int nScrollCode = (m_nHWheelChars == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGERIGHT : SB_PAGELEFT) : ((zDelta > 0) ? SB_LINERIGHT : SB_LINELEFT); + m_zHDelta += zDelta; // cumulative + int zTotal = (m_nHWheelChars == WHEEL_PAGESCROLL) ? abs(m_zHDelta) : abs(m_zHDelta) * m_nHWheelChars; + if(m_sizeAll.cx > m_sizeClient.cx) + { + for(int i = 0; i < zTotal; i += WHEEL_DELTA) + { + pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); + pT->UpdateWindow(); + } + } + m_zHDelta %= WHEEL_DELTA; + + return 0; + } + + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + GetSystemSettings(); + return 0; + } + + LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + m_sizeClient.cx = GET_X_LPARAM(lParam); + m_sizeClient.cy = GET_Y_LPARAM(lParam); + + // block: set horizontal scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + si.nMin = 0; + si.nMax = m_sizeAll.cx - 1; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nPage = m_sizeClient.cx; + si.nPos = m_ptOffset.x; + pT->SetScrollInfo(SB_HORZ, &si, TRUE); + } + + // block: set vertical scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + si.nMin = 0; + si.nMax = m_sizeAll.cy - 1; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nPage = m_sizeClient.cy; + si.nPos = m_ptOffset.y; + pT->SetScrollInfo(SB_VERT, &si, TRUE); + } + + int x = m_ptOffset.x; + int y = m_ptOffset.y; + if(pT->AdjustScrollOffset(x, y)) + { + // Children will be moved in SetScrollOffset, if needed + pT->ScrollWindowEx(m_ptOffset.x - x, m_ptOffset.y - y, (m_uScrollFlags & ~SCRL_SCROLLCHILDREN)); + SetScrollOffset(x, y, FALSE); + } + + bHandled = FALSE; + return 1; + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + if(wParam != NULL) + { + CDCHandle dc = (HDC)wParam; + POINT ptViewportOrg = { 0, 0 }; + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + pT->DoPaint(dc); + dc.SetViewportOrg(ptViewportOrg); + } + else + { + CPaintDC dc(pT->m_hWnd); + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); + pT->DoPaint(dc.m_hDC); + } + return 0; + } + + // scrolling handlers + LRESULT OnScrollUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollLineUp(); + return 0; + } + + LRESULT OnScrollDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollLineDown(); + return 0; + } + + LRESULT OnScrollPageUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollPageUp(); + return 0; + } + + LRESULT OnScrollPageDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollPageDown(); + return 0; + } + + LRESULT OnScrollTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollTop(); + return 0; + } + + LRESULT OnScrollBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollBottom(); + return 0; + } + + LRESULT OnScrollLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollLineLeft(); + return 0; + } + + LRESULT OnScrollRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollLineRight(); + return 0; + } + + LRESULT OnScrollPageLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollPageLeft(); + return 0; + } + + LRESULT OnScrollPageRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollPageRight(); + return 0; + } + + LRESULT OnScrollAllLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollAllLeft(); + return 0; + } + + LRESULT OnScrollAllRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + ScrollAllRight(); + return 0; + } + +// Overrideables + void DoPaint(CDCHandle /*dc*/) + { + // must be implemented in a derived class + ATLASSERT(FALSE); + } + +// Implementation + void DoScroll(int nType, int nScrollCode, int& cxyOffset, int cxySizeAll, int cxySizePage, int cxySizeLine) + { + T* pT = static_cast(this); + RECT rect = { 0 }; + pT->GetClientRect(&rect); + int cxyClient = (nType == SB_VERT) ? rect.bottom : rect.right; + int cxyMax = cxySizeAll - cxyClient; + + if(cxyMax < 0) // can't scroll, client area is bigger + return; + + bool bUpdate = true; + int cxyScroll = 0; + + switch(nScrollCode) + { + case SB_TOP: // top or all left + cxyScroll = cxyOffset; + cxyOffset = 0; + break; + case SB_BOTTOM: // bottom or all right + cxyScroll = cxyOffset - cxyMax; + cxyOffset = cxyMax; + break; + case SB_LINEUP: // line up or line left + if(cxyOffset >= cxySizeLine) + { + cxyScroll = cxySizeLine; + cxyOffset -= cxySizeLine; + } + else + { + cxyScroll = cxyOffset; + cxyOffset = 0; + } + break; + case SB_LINEDOWN: // line down or line right + if(cxyOffset < cxyMax - cxySizeLine) + { + cxyScroll = -cxySizeLine; + cxyOffset += cxySizeLine; + } + else + { + cxyScroll = cxyOffset - cxyMax; + cxyOffset = cxyMax; + } + break; + case SB_PAGEUP: // page up or page left + if(cxyOffset >= cxySizePage) + { + cxyScroll = cxySizePage; + cxyOffset -= cxySizePage; + } + else + { + cxyScroll = cxyOffset; + cxyOffset = 0; + } + break; + case SB_PAGEDOWN: // page down or page right + if(cxyOffset < cxyMax - cxySizePage) + { + cxyScroll = -cxySizePage; + cxyOffset += cxySizePage; + } + else + { + cxyScroll = cxyOffset - cxyMax; + cxyOffset = cxyMax; + } + break; + case SB_THUMBTRACK: + if(IsNoThumbTracking()) + break; + // else fall through + case SB_THUMBPOSITION: + { + SCROLLINFO si = { sizeof(SCROLLINFO), SIF_TRACKPOS }; + if(pT->GetScrollInfo(nType, &si)) + { + cxyScroll = cxyOffset - si.nTrackPos; + cxyOffset = si.nTrackPos; + } + } + break; + case SB_ENDSCROLL: + default: + bUpdate = false; + break; + } + + if(bUpdate && cxyScroll != 0) + { + pT->SetScrollPos(nType, cxyOffset, TRUE); + if(nType == SB_VERT) + pT->ScrollWindowEx(0, cxyScroll, m_uScrollFlags); + else + pT->ScrollWindowEx(cxyScroll, 0, m_uScrollFlags); + } + } + + static int CalcLineOrPage(int nVal, int nMax, int nDiv) + { + if(nVal == 0) + { + nVal = nMax / nDiv; + if(nVal < 1) + nVal = 1; + } + else if(nVal > nMax) + { + nVal = nMax; + } + + return nVal; + } + + bool AdjustScrollOffset(int& x, int& y) + { + int xOld = x; + int yOld = y; + + int cxMax = m_sizeAll.cx - m_sizeClient.cx; + if(x > cxMax) + x = (cxMax >= 0) ? cxMax : 0; + else if(x < 0) + x = 0; + + int cyMax = m_sizeAll.cy - m_sizeClient.cy; + if(y > cyMax) + y = (cyMax >= 0) ? cyMax : 0; + else if(y < 0) + y = 0; + + return (x != xOld || y != yOld); + } + + void GetSystemSettings() + { +#ifndef _WIN32_WCE +#ifndef SPI_GETWHEELSCROLLLINES + const UINT SPI_GETWHEELSCROLLLINES = 104; +#endif // !SPI_GETWHEELSCROLLLINES + ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &m_nWheelLines, 0); + +#ifndef SPI_GETWHEELSCROLLCHARS + const UINT SPI_GETWHEELSCROLLCHARS = 0x006C; +#endif // !SPI_GETWHEELSCROLLCHARS + ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &m_nHWheelChars, 0); + +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + if(m_uMsgMouseWheel != 0) + m_uMsgMouseWheel = ::RegisterWindowMessage(MSH_MOUSEWHEEL); + + HWND hWndWheel = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE); + if(::IsWindow(hWndWheel)) + { + UINT uMsgScrollLines = ::RegisterWindowMessage(MSH_SCROLL_LINES); + if(uMsgScrollLines != 0) + m_nWheelLines = (int)::SendMessage(hWndWheel, uMsgScrollLines, 0, 0L); + } +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) +#endif // !_WIN32_WCE + } + + bool IsScrollingChildren() const + { + return (m_dwExtendedStyle & SCRL_SCROLLCHILDREN) != 0; + } + + bool IsErasingBackground() const + { + return (m_dwExtendedStyle & SCRL_ERASEBACKGROUND) != 0; + } + + bool IsNoThumbTracking() const + { + return (m_dwExtendedStyle & SCRL_NOTHUMBTRACKING) != 0; + } + +#if (WINVER >= 0x0500) + bool IsSmoothScroll() const + { + return (m_dwExtendedStyle & SCRL_SMOOTHSCROLL) != 0; + } +#endif // (WINVER >= 0x0500) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CScrollWindowImpl - Implements a scrollable window + +template +class ATL_NO_VTABLE CScrollWindowImpl : public ATL::CWindowImpl, public CScrollImpl< T > +{ +public: + BEGIN_MSG_MAP(CScrollWindowImpl) + MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) + MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) + MESSAGE_HANDLER(WM_PAINT, CScrollImpl< T >::OnPaint) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_PRINTCLIENT, CScrollImpl< T >::OnPaint) +#endif // !_WIN32_WCE + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) + END_MSG_MAP() +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CMapScrollImpl - Provides mapping and scrolling support to any window + +#ifndef _WIN32_WCE + +template +class CMapScrollImpl : public CScrollImpl< T > +{ +public: + int m_nMapMode; + RECT m_rectLogAll; + SIZE m_sizeLogLine; + SIZE m_sizeLogPage; + +// Constructor + CMapScrollImpl() : m_nMapMode(MM_TEXT) + { + ::SetRectEmpty(&m_rectLogAll); + m_sizeLogPage.cx = 0; + m_sizeLogPage.cy = 0; + m_sizeLogLine.cx = 0; + m_sizeLogLine.cy = 0; + } + +// Attributes & Operations + // mapping mode operations + void SetScrollMapMode(int nMapMode) + { + ATLASSERT(nMapMode >= MM_MIN && nMapMode <= MM_MAX_FIXEDSCALE); + m_nMapMode = nMapMode; + } + + int GetScrollMapMode() const + { + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + return m_nMapMode; + } + + // offset operations + void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) + { + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + POINT ptOff = { x, y }; + // block: convert logical to device units + { + CWindowDC dc(NULL); + dc.SetMapMode(m_nMapMode); + dc.LPtoDP(&ptOff); + } + CScrollImpl< T >::SetScrollOffset(ptOff, bRedraw); + } + + void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) + { + SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); + } + + void GetScrollOffset(POINT& ptOffset) const + { + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ptOffset = m_ptOffset; + // block: convert device to logical units + { + CWindowDC dc(NULL); + dc.SetMapMode(m_nMapMode); + dc.DPtoLP(&ptOffset); + } + } + + // size operations + void SetScrollSize(int xMin, int yMin, int xMax, int yMax, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + ATLASSERT(xMax > xMin && yMax > yMin); + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + + ::SetRect(&m_rectLogAll, xMin, yMin, xMax, yMax); + + SIZE sizeAll = { 0 }; + sizeAll.cx = xMax - xMin + 1; + sizeAll.cy = yMax - yMin + 1; + // block: convert logical to device units + { + CWindowDC dc(NULL); + dc.SetMapMode(m_nMapMode); + dc.LPtoDP(&sizeAll); + } + CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); + SetScrollLine(0, 0); + SetScrollPage(0, 0); + } + + void SetScrollSize(RECT& rcScroll, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + SetScrollSize(rcScroll.left, rcScroll.top, rcScroll.right, rcScroll.bottom, bRedraw, bResetOffset); + } + + void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + SetScrollSize(0, 0, cx, cy, bRedraw, bResetOffset); + } + + void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + SetScrollSize(0, 0, size.cx, size.cy, bRedraw, bResetOffset); + } + + void GetScrollSize(RECT& rcScroll) const + { + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + rcScroll = m_rectLogAll; + } + + // line operations + void SetScrollLine(int cxLine, int cyLine) + { + ATLASSERT(cxLine >= 0 && cyLine >= 0); + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + + m_sizeLogLine.cx = cxLine; + m_sizeLogLine.cy = cyLine; + SIZE sizeLine = m_sizeLogLine; + // block: convert logical to device units + { + CWindowDC dc(NULL); + dc.SetMapMode(m_nMapMode); + dc.LPtoDP(&sizeLine); + } + CScrollImpl< T >::SetScrollLine(sizeLine); + } + + void SetScrollLine(SIZE sizeLine) + { + SetScrollLine(sizeLine.cx, sizeLine.cy); + } + + void GetScrollLine(SIZE& sizeLine) const + { + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + sizeLine = m_sizeLogLine; + } + + // page operations + void SetScrollPage(int cxPage, int cyPage) + { + ATLASSERT(cxPage >= 0 && cyPage >= 0); + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + + m_sizeLogPage.cx = cxPage; + m_sizeLogPage.cy = cyPage; + SIZE sizePage = m_sizeLogPage; + // block: convert logical to device units + { + CWindowDC dc(NULL); + dc.SetMapMode(m_nMapMode); + dc.LPtoDP(&sizePage); + } + CScrollImpl< T >::SetScrollPage(sizePage); + } + + void SetScrollPage(SIZE sizePage) + { + SetScrollPage(sizePage.cx, sizePage.cy); + } + + void GetScrollPage(SIZE& sizePage) const + { + ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + sizePage = m_sizeLogPage; + } + + BEGIN_MSG_MAP(CMapScrollImpl) + MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) + MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) + END_MSG_MAP() + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + if(wParam != NULL) + { + CDCHandle dc = (HDC)wParam; + int nMapModeSav = dc.GetMapMode(); + dc.SetMapMode(m_nMapMode); + POINT ptViewportOrg = { 0, 0 }; + if(m_nMapMode == MM_TEXT) + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + else + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy, &ptViewportOrg); + POINT ptWindowOrg = { 0, 0 }; + dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top, &ptWindowOrg); + + pT->DoPaint(dc); + + dc.SetMapMode(nMapModeSav); + dc.SetViewportOrg(ptViewportOrg); + dc.SetWindowOrg(ptWindowOrg); + } + else + { + CPaintDC dc(pT->m_hWnd); + dc.SetMapMode(m_nMapMode); + if(m_nMapMode == MM_TEXT) + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); + else + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy); + dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top); + pT->DoPaint(dc.m_hDC); + } + return 0; + } +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CMapScrollWindowImpl - Implements scrolling window with mapping + +#ifndef _WIN32_WCE + +template +class ATL_NO_VTABLE CMapScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CMapScrollImpl< T > +{ +public: + BEGIN_MSG_MAP(CMapScrollWindowImpl) + MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) + MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) + MESSAGE_HANDLER(WM_PAINT, CMapScrollImpl< T >::OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, CMapScrollImpl< T >::OnPaint) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) + END_MSG_MAP() +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CFSBWindow - Use as a base instead of CWindow to get flat scroll bar support + +#if defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + +template +class CFSBWindowT : public TBase, public CFlatScrollBarImpl > +{ +public: +// Constructors + CFSBWindowT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CFSBWindowT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + +// CWindow overrides that use flat scroll bar API +// (only those methods that are used by scroll window classes) + int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return FlatSB_SetScrollPos(nBar, nPos, bRedraw); + } + + BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + return FlatSB_GetScrollInfo(nBar, lpScrollInfo); + } + + BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + return FlatSB_SetScrollInfo(nBar, lpScrollInfo, bRedraw); + } +}; + +typedef CFSBWindowT CFSBWindow; + +#endif // defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) + + +/////////////////////////////////////////////////////////////////////////////// +// CZoomScrollImpl - Provides zooming and scrolling support to any window + +#ifndef _WIN32_WCE + +// The zoom modes that can be set with the SetZoomMode method +enum +{ + ZOOMMODE_OFF, + ZOOMMODE_IN, // If left mouse button is clicked or dragged, zoom in on point clicked or rectangle dragged. + ZOOMMODE_OUT // If left mouse button clicked, zoom out on point clicked. +}; + +// Notification to parent that zoom scale changed as a result of user mouse action. +#define ZSN_ZOOMCHANGED (NM_FIRST - 50) + +template +class CZoomScrollImpl : public CScrollImpl< T > +{ +public: + enum { m_cxyMinZoomRect = 12 }; // min rect size to zoom in on rect. + +// Data members + SIZE m_sizeLogAll; + SIZE m_sizeLogLine; + SIZE m_sizeLogPage; + float m_fZoomScale; + float m_fZoomScaleMin; + float m_fZoomDelta; // Used in ZOOMMODE_IN and ZOOMMODE_OUT on left-button click. + int m_nZoomMode; + RECT m_rcTrack; + bool m_bTracking; + +// Constructor + CZoomScrollImpl(): + m_fZoomScale(1.0), + m_fZoomScaleMin(0.5), + m_fZoomDelta(0.5), + m_nZoomMode(ZOOMMODE_OFF), + m_bTracking(false) + { + m_sizeLogAll.cx = 0; + m_sizeLogAll.cy = 0; + m_sizeLogPage.cx = 0; + m_sizeLogPage.cy = 0; + m_sizeLogLine.cx = 0; + m_sizeLogLine.cy = 0; + ::SetRectEmpty(&m_rcTrack); + } + +// Attributes & Operations + + // size operations + void SetScrollSize(int cxLog, int cyLog, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + ATLASSERT(cxLog >= 0 && cyLog >= 0); + + // Set up the defaults + if (cxLog == 0 && cyLog == 0) + { + cxLog = 1; + cyLog = 1; + } + + m_sizeLogAll.cx = cxLog; + m_sizeLogAll.cy = cyLog; + SIZE sizeAll = { 0 }; + sizeAll.cx = (int)((float)m_sizeLogAll.cx * m_fZoomScale); + sizeAll.cy = (int)((float)m_sizeLogAll.cy * m_fZoomScale); + + CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); + } + + void SetScrollSize(SIZE sizeLog, BOOL bRedraw = TRUE, bool bResetOffset = true) + { + SetScrollSize(sizeLog.cx, sizeLog.cy, bRedraw, bResetOffset); + } + + void GetScrollSize(SIZE& sizeLog) const + { + sizeLog = m_sizeLogAll; + } + + // line operations + void SetScrollLine(int cxLogLine, int cyLogLine) + { + ATLASSERT(cxLogLine >= 0 && cyLogLine >= 0); + + m_sizeLogLine.cx = cxLogLine; + m_sizeLogLine.cy = cyLogLine; + + SIZE sizeLine = { 0 }; + sizeLine.cx = (int)((float)m_sizeLogLine.cx * m_fZoomScale); + sizeLine.cy = (int)((float)m_sizeLogLine.cy * m_fZoomScale); + CScrollImpl< T >::SetScrollLine(sizeLine); + } + + void SetScrollLine(SIZE sizeLogLine) + { + SetScrollLine(sizeLogLine.cx, sizeLogLine.cy); + } + + void GetScrollLine(SIZE& sizeLogLine) const + { + sizeLogLine = m_sizeLogLine; + } + + // page operations + void SetScrollPage(int cxLogPage, int cyLogPage) + { + ATLASSERT(cxLogPage >= 0 && cyLogPage >= 0); + + m_sizeLogPage.cx = cxLogPage; + m_sizeLogPage.cy = cyLogPage; + + SIZE sizePage = { 0 }; + sizePage.cx = (int)((float)m_sizeLogPage.cx * m_fZoomScale); + sizePage.cy = (int)((float)m_sizeLogPage.cy * m_fZoomScale); + + CScrollImpl< T >::SetScrollPage(sizePage); + } + + void SetScrollPage(SIZE sizeLogPage) + { + SetScrollPage(sizeLogPage.cx, sizeLogPage.cy); + } + + void GetScrollPage(SIZE& sizeLogPage) const + { + sizeLogPage = m_sizeLogPage; + } + + void SetZoomScale(float fZoomScale) + { + ATLASSERT(fZoomScale > 0); + + if(fZoomScale > 0 && fZoomScale >= m_fZoomScaleMin) + m_fZoomScale = fZoomScale; + } + + float GetZoomScale() const + { + return m_fZoomScale; + } + + void SetZoomScaleMin(float fZoomScaleMin) + { + m_fZoomScaleMin = fZoomScaleMin; + } + + float GetZoomScaleMin() const + { + return m_fZoomScaleMin; + } + + void SetZoomDelta(float fZoomDelta) + { + ATLASSERT(fZoomDelta >= 0); + + if(fZoomDelta >= 0) + m_fZoomDelta = fZoomDelta; + } + + float GetZoomDelta() const + { + return m_fZoomDelta; + } + + void SetZoomMode(int nZoomMode) + { + m_nZoomMode = nZoomMode; + } + + int GetZoomMode() const + { + return m_nZoomMode; + } + + void Zoom(int x, int y, float fZoomScale) + { + if(fZoomScale <= 0) + return; + + fZoomScale = max(fZoomScale, m_fZoomScaleMin); + + T* pT = static_cast(this); + POINT pt = { x, y }; + if(!pT->PtInDevRect(pt)) + return; + + pT->ViewDPtoLP(&pt); + pT->Zoom(fZoomScale, false); + pT->CenterOnLogicalPoint(pt); + } + + void Zoom(POINT pt, float fZoomScale) + { + T* pT = static_cast(this); + pT->Zoom(pt.x, pt.y, fZoomScale); + } + + void Zoom(RECT& rc) + { + T* pT = static_cast(this); + RECT rcZoom = rc; + pT->NormalizeRect(rcZoom); + SIZE size = { rcZoom.right - rcZoom.left, rcZoom.bottom - rcZoom.top }; + POINT pt = { rcZoom.left + size.cx / 2, rcZoom.top + size.cy / 2 }; + if(size.cx < m_cxyMinZoomRect || size.cy < m_cxyMinZoomRect) + { + pT->Zoom(pt, m_fZoomScale + m_fZoomDelta); + return; + } + + ATLASSERT(size.cx > 0 && size.cy > 0); + + float fScaleH = (float)(m_sizeClient.cx + 1) / (float)size.cx; + float fScaleV = (float)(m_sizeClient.cy + 1) / (float)size.cy; + float fZoomScale = min(fScaleH, fScaleV) * m_fZoomScale; + pT->Zoom(pt, fZoomScale); + } + + void Zoom(float fZoomScale, bool bCenter = true) + { + if(fZoomScale <= 0) + return; + + fZoomScale = max(fZoomScale, m_fZoomScaleMin); + + + T* pT = static_cast(this); + POINT pt = { 0 }; + if(bCenter) + { + RECT rc; + ::GetClientRect(pT->m_hWnd, &rc); + pt.x = rc.right / 2; + pt.y = rc.bottom / 2; + pT->ViewDPtoLP(&pt); + } + + // Modify the Viewport extent + m_fZoomScale = fZoomScale; + SIZE sizeAll = { 0 }; + sizeAll.cx = (int)((float)m_sizeLogAll.cx * fZoomScale); + sizeAll.cy = (int)((float)m_sizeLogAll.cy * fZoomScale); + + // Update scroll bars and window + CScrollImpl< T >::SetScrollSize(sizeAll); + + if(bCenter) + pT->CenterOnLogicalPoint(pt); + } + + // Helper functions + void PrepareDC(CDCHandle dc) + { + ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); + dc.SetMapMode(MM_ANISOTROPIC); + dc.SetWindowExt(m_sizeLogAll); + dc.SetViewportExt(m_sizeAll); + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); + } + + void ViewDPtoLP(LPPOINT lpPoints, int nCount = 1) + { + ATLASSERT(lpPoints); + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + CWindowDC dc(pT->m_hWnd); + pT->PrepareDC(dc.m_hDC); + dc.DPtoLP(lpPoints, nCount); + } + + void ViewLPtoDP(LPPOINT lpPoints, int nCount = 1) + { + ATLASSERT(lpPoints); + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + CWindowDC dc(pT->m_hWnd); + pT->PrepareDC(dc.m_hDC); + dc.LPtoDP(lpPoints, nCount); + } + + void ClientToDevice(POINT &pt) + { + pt.x += m_ptOffset.x; + pt.y += m_ptOffset.y; + } + + void DeviceToClient(POINT &pt) + { + pt.x -= m_ptOffset.x; + pt.y -= m_ptOffset.y; + } + + void CenterOnPoint(POINT pt) + { + T* pT = static_cast(this); + RECT rect; + pT->GetClientRect(&rect); + + int xOfs = pt.x - (rect.right / 2) + m_ptOffset.x; + if(xOfs < 0) + { + xOfs = 0; + } + else + { + int xMax = max((int)(m_sizeAll.cx - rect.right), 0); + if(xOfs > xMax) + xOfs = xMax; + } + + int yOfs = pt.y - (rect.bottom / 2) + m_ptOffset.y; + if(yOfs < 0) + { + yOfs = 0; + } + else + { + int yMax = max((int)(m_sizeAll.cy - rect.bottom), 0); + if(yOfs > yMax) + yOfs = yMax; + } + + CScrollImpl< T >::SetScrollOffset(xOfs, yOfs); + } + + void CenterOnLogicalPoint(POINT ptLog) + { + T* pT = static_cast(this); + pT->ViewLPtoDP(&ptLog); + pT->DeviceToClient(ptLog); + pT->CenterOnPoint(ptLog); + } + + BOOL PtInDevRect(POINT pt) + { + RECT rc = { 0, 0, m_sizeAll.cx, m_sizeAll.cy }; + ::OffsetRect(&rc, -m_ptOffset.x, -m_ptOffset.y); + return ::PtInRect(&rc, pt); + } + + void NormalizeRect(RECT& rc) + { + if(rc.left > rc.right) + { + int r = rc.right; + rc.right = rc.left; + rc.left = r; + } + if(rc.top > rc.bottom) + { + int b = rc.bottom; + rc.bottom = rc.top; + rc.top = b; + } + } + + void DrawTrackRect() + { + T* pT = static_cast(this); + const SIZE sizeLines = { 2, 2 }; + RECT rc = m_rcTrack; + pT->NormalizeRect(rc); + if(!::IsRectEmpty(&rc)) + { + ::MapWindowPoints(pT->m_hWnd, NULL, (LPPOINT)&rc, 2); + CWindowDC dc(NULL); + dc.DrawDragRect(&rc, sizeLines, NULL, sizeLines); + } + } + + void NotifyParentZoomChanged() + { + T* pT = static_cast(this); + int nId = pT->GetDlgCtrlID(); + NMHDR nmhdr = { pT->m_hWnd, nId, ZSN_ZOOMCHANGED }; + ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nId, (LPARAM)&nmhdr); + } + + BEGIN_MSG_MAP(CZoomScrollImpl) + MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) + MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) + MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) + MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) + END_MSG_MAP() + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + ATLASSERT(m_sizeLogAll.cx >= 0 && m_sizeLogAll.cy >= 0); + ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); + + if(wParam != NULL) + { + CDCHandle dc = (HDC)wParam; + int nMapModeSav = dc.GetMapMode(); + dc.SetMapMode(MM_ANISOTROPIC); + SIZE szWindowExt = { 0, 0 }; + dc.SetWindowExt(m_sizeLogAll, &szWindowExt); + SIZE szViewportExt = { 0, 0 }; + dc.SetViewportExt(m_sizeAll, &szViewportExt); + POINT ptViewportOrg = { 0, 0 }; + dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + + pT->DoPaint(dc); + + dc.SetMapMode(nMapModeSav); + dc.SetWindowExt(szWindowExt); + dc.SetViewportExt(szViewportExt); + dc.SetViewportOrg(ptViewportOrg); + } + else + { + CPaintDC dc(pT->m_hWnd); + pT->PrepareDC(dc.m_hDC); + pT->DoPaint(dc.m_hDC); + } + return 0; + } + + LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(m_nZoomMode == ZOOMMODE_IN && !m_bTracking) + { + T* pT = static_cast(this); + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + if(pT->PtInDevRect(pt)) + { + pT->SetCapture(); + m_bTracking = true; + ::SetRect(&m_rcTrack, pt.x, pt.y, pt.x, pt.y); + } + } + bHandled = FALSE; + return 0; + } + + LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + if(m_bTracking) + { + T* pT = static_cast(this); + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + if(pT->PtInDevRect(pt)) + { + pT->DrawTrackRect(); + m_rcTrack.right = pt.x; + m_rcTrack.bottom = pt.y; + pT->DrawTrackRect(); + } + } + bHandled = FALSE; + return 0; + } + + LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + ::ReleaseCapture(); + if(m_nZoomMode == ZOOMMODE_OUT) + { + T* pT = static_cast(this); + pT->Zoom(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), m_fZoomScale - m_fZoomDelta); + pT->NotifyParentZoomChanged(); + } + bHandled = FALSE; + return 0; + } + + LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_bTracking) + { + m_bTracking = false; + T* pT = static_cast(this); + pT->DrawTrackRect(); + pT->Zoom(m_rcTrack); + pT->NotifyParentZoomChanged(); + ::SetRectEmpty(&m_rcTrack); + } + bHandled = FALSE; + return 0; + } + + LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if(LOWORD(lParam) == HTCLIENT && m_nZoomMode != ZOOMMODE_OFF) + { + T* pT = static_cast(this); + if((HWND)wParam == pT->m_hWnd) + { + DWORD dwPos = ::GetMessagePos(); + POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; + pT->ScreenToClient(&pt); + if(pT->PtInDevRect(pt)) + { + ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); + return 1; + } + } + } + bHandled = FALSE; + return 0; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CZoomScrollWindowImpl - Implements scrolling window with zooming + +template +class ATL_NO_VTABLE CZoomScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > +{ +public: + BEGIN_MSG_MAP(CZoomScrollWindowImpl) + MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) + MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) + MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) +#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) +#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) + MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) + MESSAGE_HANDLER(WM_PAINT, CZoomScrollImpl< T >::OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, CZoomScrollImpl< T >::OnPaint) + MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) + MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) + MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) + MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) + ALT_MSG_MAP(1) + COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) + COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) + COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) + COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) + COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) + COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) + COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) + COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) + END_MSG_MAP() +}; + +#endif // !_WIN32_WCE + + +/////////////////////////////////////////////////////////////////////////////// +// CScrollContainer + +template +class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, TWinTraits > +{ +public: + DECLARE_WND_CLASS_EX(NULL, 0, -1) + + typedef CScrollWindowImpl< T, TBase, TWinTraits > _baseClass; + +// Data members + ATL::CWindow m_wndClient; + bool m_bAutoSizeClient; + bool m_bDrawEdgeIfEmpty; + +// Constructor + CScrollContainerImpl() : m_bAutoSizeClient(true), m_bDrawEdgeIfEmpty(false) + { + // Set CScrollWindowImpl extended style + SetScrollExtendedStyle(SCRL_SCROLLCHILDREN); + } + +// Attributes + HWND GetClient() const + { + return m_wndClient; + } + + HWND SetClient(HWND hWndClient, bool bClientSizeAsMin = true) + { + ATLASSERT(::IsWindow(m_hWnd)); + + HWND hWndOldClient = m_wndClient; + m_wndClient = hWndClient; + + SetRedraw(FALSE); + SetScrollSize(1, 1, FALSE); + + if(m_wndClient.m_hWnd != NULL) + { + m_wndClient.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + if(bClientSizeAsMin) + { + RECT rect = { 0 }; + m_wndClient.GetWindowRect(&rect); + if((rect.right - rect.left) > 0 && (rect.bottom - rect.top) > 0) + SetScrollSize(rect.right - rect.left, rect.bottom - rect.top, FALSE); + } + + T* pT = static_cast(this); + pT->UpdateLayout(); + } + + SetRedraw(TRUE); + RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + + return hWndOldClient; + } + +// Message map and handlers + BEGIN_MSG_MAP(CScrollContainerImpl) + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_SIZE, OnSize) + CHAIN_MSG_MAP(_baseClass) + FORWARD_NOTIFICATIONS() + ALT_MSG_MAP(1) + CHAIN_MSG_MAP_ALT(_baseClass, 1) + END_MSG_MAP() + + LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(m_wndClient.m_hWnd != NULL) + m_wndClient.SetFocus(); + + return 0; + } + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background needed + } + + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + BOOL bTmp = TRUE; + LRESULT lRet = _baseClass::OnSize(uMsg, wParam, lParam, bTmp); + + T* pT = static_cast(this); + pT->UpdateLayout(); + + return lRet; + } + +// Overrides for CScrollWindowImpl + void DoPaint(CDCHandle dc) + { + if(!m_bAutoSizeClient || m_wndClient.m_hWnd == NULL) + { + T* pT = static_cast(this); + RECT rect = { 0 }; + pT->GetContainerRect(rect); + + if(m_bDrawEdgeIfEmpty && m_wndClient.m_hWnd == NULL) + dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); + + dc.FillRect(&rect, COLOR_APPWORKSPACE); + } + } + + void ScrollToView(POINT pt) + { + CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(pt); + } + + void ScrollToView(RECT& rect) + { + CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(rect); + } + + void ScrollToView(HWND hWnd) // client window coordinates + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + ATLASSERT(::IsWindow(pT->m_hWnd)); + ATLASSERT(m_wndClient.IsWindow()); + + RECT rect = { 0 }; + ::GetWindowRect(hWnd, &rect); + ::MapWindowPoints(NULL, m_wndClient.m_hWnd, (LPPOINT)&rect, 2); + ScrollToView(rect); + } + +// Implementation - overrideable methods + void UpdateLayout() + { + ATLASSERT(::IsWindow(m_hWnd)); + + if(m_bAutoSizeClient && m_wndClient.m_hWnd != NULL) + { + T* pT = static_cast(this); + RECT rect = { 0 }; + pT->GetContainerRect(rect); + + m_wndClient.SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); + } + else + { + Invalidate(); + } + } + + void GetContainerRect(RECT& rect) + { + GetClientRect(&rect); + + if(rect.right < m_sizeAll.cx) + rect.right = m_sizeAll.cx; + + if(rect.bottom < m_sizeAll.cy) + rect.bottom = m_sizeAll.cy; + } +}; + +class CScrollContainer : public CScrollContainerImpl +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_ScrollContainer"), 0, -1) +}; + +}; // namespace WTL + +#endif // __ATLSCRL_H__ diff --git a/Externals/WTL80/atlsplit.h b/Externals/WTL80/atlsplit.h index df879dbc78..8b012a0d70 100644 --- a/Externals/WTL80/atlsplit.h +++ b/Externals/WTL80/atlsplit.h @@ -1,892 +1,892 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLSPLIT_H__ -#define __ATLSPLIT_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlsplit.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlsplit.h requires atlwin.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CSplitterImpl -// CSplitterWindowImpl -// CSplitterWindowT - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CSplitterImpl - Provides splitter support to any window - -// Splitter panes constants -#define SPLIT_PANE_LEFT 0 -#define SPLIT_PANE_RIGHT 1 -#define SPLIT_PANE_TOP SPLIT_PANE_LEFT -#define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT -#define SPLIT_PANE_NONE -1 - -// Splitter extended styles -#define SPLIT_PROPORTIONAL 0x00000001 -#define SPLIT_NONINTERACTIVE 0x00000002 -#define SPLIT_RIGHTALIGNED 0x00000004 -#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED - -// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are -// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL - - -template -class CSplitterImpl -{ -public: - enum { m_nPanesCount = 2, m_nPropMax = 10000 }; - - HWND m_hWndPane[m_nPanesCount]; - RECT m_rcSplitter; - int m_xySplitterPos; - int m_nDefActivePane; - int m_cxySplitBar; // splitter bar width/height - static HCURSOR m_hCursor; - int m_cxyMin; // minimum pane size - int m_cxyBarEdge; // splitter bar edge - bool m_bFullDrag; - int m_cxyDragOffset; - int m_nProportionalPos; - bool m_bUpdateProportionalPos; - DWORD m_dwExtendedStyle; // splitter specific extended styles - int m_nSinglePane; // single pane mode - -// Constructor - CSplitterImpl() : - m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE), - m_cxySplitBar(0), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true), - m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true), - m_dwExtendedStyle(SPLIT_PROPORTIONAL), - m_nSinglePane(SPLIT_PANE_NONE) - { - m_hWndPane[SPLIT_PANE_LEFT] = NULL; - m_hWndPane[SPLIT_PANE_RIGHT] = NULL; - - ::SetRectEmpty(&m_rcSplitter); - - if(m_hCursor == NULL) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CSplitterImpl::CSplitterImpl.\n")); - ATLASSERT(FALSE); - return; - } - - if(m_hCursor == NULL) - m_hCursor = ::LoadCursor(NULL, t_bVertical ? IDC_SIZEWE : IDC_SIZENS); - - lock.Unlock(); - } - } - -// Attributes - void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true) - { - if(lpRect == NULL) - { - T* pT = static_cast(this); - pT->GetClientRect(&m_rcSplitter); - } - else - { - m_rcSplitter = *lpRect; - } - - if(IsProportional()) - UpdateProportionalPos(); - else if(IsRightAligned()) - UpdateRightAlignPos(); - - if(bUpdate) - UpdateSplitterLayout(); - } - - void GetSplitterRect(LPRECT lpRect) const - { - ATLASSERT(lpRect != NULL); - *lpRect = m_rcSplitter; - } - - bool SetSplitterPos(int xyPos = -1, bool bUpdate = true) - { - if(xyPos == -1) // -1 == middle - { - if(t_bVertical) - xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; - else - xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; - } - - // Adjust if out of valid range - int cxyMax = 0; - if(t_bVertical) - cxyMax = m_rcSplitter.right - m_rcSplitter.left; - else - cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; - - if(xyPos < m_cxyMin + m_cxyBarEdge) - xyPos = m_cxyMin; - else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) - xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; - - // Set new position and update if requested - bool bRet = (m_xySplitterPos != xyPos); - m_xySplitterPos = xyPos; - - if(m_bUpdateProportionalPos) - { - if(IsProportional()) - StoreProportionalPos(); - else if(IsRightAligned()) - StoreRightAlignPos(); - } - else - { - m_bUpdateProportionalPos = true; - } - - if(bUpdate && bRet) - UpdateSplitterLayout(); - - return bRet; - } - - void SetSplitterPosPct(int nPct, bool bUpdate = true) - { - ATLASSERT(nPct >= 0 && nPct <= 100); - - m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100); - UpdateProportionalPos(); - - if(bUpdate) - UpdateSplitterLayout(); - } - - int GetSplitterPos() const - { - return m_xySplitterPos; - } - - bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE); - if(!(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE)) - return false; - - if(nPane != SPLIT_PANE_NONE) - { - if(!::IsWindowVisible(m_hWndPane[nPane])) - ::ShowWindow(m_hWndPane[nPane], SW_SHOW); - int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; - ::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE); - if(m_nDefActivePane != nPane) - m_nDefActivePane = nPane; - } - else if(m_nSinglePane != SPLIT_PANE_NONE) - { - int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; - ::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW); - } - - m_nSinglePane = nPane; - UpdateSplitterLayout(); - return true; - } - - int GetSinglePaneMode() const - { - return m_nSinglePane; - } - - DWORD GetSplitterExtendedStyle() const - { - return m_dwExtendedStyle; - } - - DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); -#ifdef _DEBUG - if(IsProportional() && IsRightAligned()) - ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n")); -#endif // _DEBUG - return dwPrevStyle; - } - -// Splitter operations - void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true) - { - m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop; - m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom; - ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); - if(bUpdate) - UpdateSplitterLayout(); - } - - bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - m_hWndPane[nPane] = hWnd; - ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); - if(bUpdate) - UpdateSplitterLayout(); - return true; - } - - HWND GetSplitterPane(int nPane) const - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - return m_hWndPane[nPane]; - } - - bool SetActivePane(int nPane) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - if(m_nSinglePane != SPLIT_PANE_NONE && nPane != m_nSinglePane) - return false; - ::SetFocus(m_hWndPane[nPane]); - m_nDefActivePane = nPane; - return true; - } - - int GetActivePane() const - { - int nRet = SPLIT_PANE_NONE; - HWND hWndFocus = ::GetFocus(); - if(hWndFocus != NULL) - { - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus)) - { - nRet = nPane; - break; - } - } - } - return nRet; - } - - bool ActivateNextPane(bool bNext = true) - { - int nPane = m_nSinglePane; - if(nPane == SPLIT_PANE_NONE) - { - switch(GetActivePane()) - { - case SPLIT_PANE_LEFT: - nPane = SPLIT_PANE_RIGHT; - break; - case SPLIT_PANE_RIGHT: - nPane = SPLIT_PANE_LEFT; - break; - default: - nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT; - break; - } - } - return SetActivePane(nPane); - } - - bool SetDefaultActivePane(int nPane) - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; - m_nDefActivePane = nPane; - return true; - } - - bool SetDefaultActivePane(HWND hWnd) - { - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(hWnd == m_hWndPane[nPane]) - { - m_nDefActivePane = nPane; - return true; - } - } - return false; // not found - } - - int GetDefaultActivePane() const - { - return m_nDefActivePane; - } - - void DrawSplitter(CDCHandle dc) - { - ATLASSERT(dc.m_hDC != NULL); - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) - return; - - T* pT = static_cast(this); - if(m_nSinglePane == SPLIT_PANE_NONE) - { - pT->DrawSplitterBar(dc); - - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(m_hWndPane[nPane] == NULL) - pT->DrawSplitterPane(dc, nPane); - } - } - else - { - if(m_hWndPane[m_nSinglePane] == NULL) - pT->DrawSplitterPane(dc, m_nSinglePane); - } - } - -// Overrideables - void DrawSplitterBar(CDCHandle dc) - { - RECT rect; - if(GetSplitterBarRect(&rect)) - { - dc.FillRect(&rect, COLOR_3DFACE); - // draw 3D edge if needed - T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) - dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM)); - } - } - - // called only if pane is empty - void DrawSplitterPane(CDCHandle dc, int nPane) - { - RECT rect; - if(GetSplitterPaneRect(nPane, &rect)) - { - T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0) - dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); - dc.FillRect(&rect, COLOR_APPWORKSPACE); - } - } - -// Message map and handlers - BEGIN_MSG_MAP(CSplitterImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE - if(IsInteractive()) - { - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) - } - MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) -#ifndef _WIN32_WCE - MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) -#endif // !_WIN32_WCE - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - GetSystemSettings(false); - bHandled = FALSE; - return 1; - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - // try setting position if not set - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) - pT->SetSplitterPos(); - // do painting - CPaintDC dc(pT->m_hWnd); - pT->DrawSplitter(dc.m_hDC); - return 0; - } - - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - if((HWND)wParam == pT->m_hWnd && LOWORD(lParam) == HTCLIENT) - { - DWORD dwPos = ::GetMessagePos(); - POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&ptPos); - if(IsOverSplitterBar(ptPos.x, ptPos.y)) - return 1; - } - - bHandled = FALSE; - return 0; - } - - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - int xPos = GET_X_LPARAM(lParam); - int yPos = GET_Y_LPARAM(lParam); - if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd) - { - int xyNewSplitPos = 0; - if(t_bVertical) - xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset; - else - xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset; - - if(xyNewSplitPos == -1) // avoid -1, that means middle - xyNewSplitPos = -2; - - if(m_xySplitterPos != xyNewSplitPos) - { - if(m_bFullDrag) - { - if(pT->SetSplitterPos(xyNewSplitPos, true)) - pT->UpdateWindow(); - } - else - { - DrawGhostBar(); - pT->SetSplitterPos(xyNewSplitPos, false); - DrawGhostBar(); - } - } - } - else // not dragging, just set cursor - { - if(IsOverSplitterBar(xPos, yPos)) - ::SetCursor(m_hCursor); - bHandled = FALSE; - } - - return 0; - } - - LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) - { - int xPos = GET_X_LPARAM(lParam); - int yPos = GET_Y_LPARAM(lParam); - if(IsOverSplitterBar(xPos, yPos)) - { - T* pT = static_cast(this); - pT->SetCapture(); - ::SetCursor(m_hCursor); - if(!m_bFullDrag) - DrawGhostBar(); - if(t_bVertical) - m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos; - else - m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos; - } - bHandled = FALSE; - return 1; - } - - LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - ::ReleaseCapture(); - bHandled = FALSE; - return 1; - } - - LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->SetSplitterPos(); // middle - return 0; - } - - LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - if(!m_bFullDrag) - { - DrawGhostBar(); - UpdateSplitterLayout(); - T* pT = static_cast(this); - pT->UpdateWindow(); - } - return 0; - } - - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled) - { - if(m_nSinglePane == SPLIT_PANE_NONE) - { - if(m_nDefActivePane == SPLIT_PANE_LEFT || m_nDefActivePane == SPLIT_PANE_RIGHT) - ::SetFocus(m_hWndPane[m_nDefActivePane]); - } - else - { - ::SetFocus(m_hWndPane[m_nSinglePane]); - } - bHandled = FALSE; - return 1; - } - -#ifndef _WIN32_WCE - LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT) - { - DWORD dwPos = ::GetMessagePos(); - POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&pt); - RECT rcPane; - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt)) - { - m_nDefActivePane = nPane; - break; - } - } - } - return lRet; - } -#endif // !_WIN32_WCE - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - GetSystemSettings(true); - return 0; - } - -// Implementation - internal helpers - void UpdateSplitterLayout() - { - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) - return; - - T* pT = static_cast(this); - RECT rect = { 0, 0, 0, 0 }; - if(m_nSinglePane == SPLIT_PANE_NONE) - { - if(GetSplitterBarRect(&rect)) - pT->InvalidateRect(&rect); - - for(int nPane = 0; nPane < m_nPanesCount; nPane++) - { - if(GetSplitterPaneRect(nPane, &rect)) - { - if(m_hWndPane[nPane] != NULL) - ::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); - else - pT->InvalidateRect(&rect); - } - } - } - else - { - if(GetSplitterPaneRect(m_nSinglePane, &rect)) - { - if(m_hWndPane[m_nSinglePane] != NULL) - ::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); - else - pT->InvalidateRect(&rect); - } - } - } - - bool GetSplitterBarRect(LPRECT lpRect) const - { - ATLASSERT(lpRect != NULL); - if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1) - return false; - - if(t_bVertical) - { - lpRect->left = m_rcSplitter.left + m_xySplitterPos; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - lpRect->bottom = m_rcSplitter.bottom; - } - else - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top + m_xySplitterPos; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - } - - return true; - } - - bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const - { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - ATLASSERT(lpRect != NULL); - bool bRet = true; - if(m_nSinglePane != SPLIT_PANE_NONE) - { - if(nPane == m_nSinglePane) - *lpRect = m_rcSplitter; - else - bRet = false; - } - else if(nPane == SPLIT_PANE_LEFT) - { - if(t_bVertical) - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.left + m_xySplitterPos; - lpRect->bottom = m_rcSplitter.bottom; - } - else - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.top + m_xySplitterPos; - } - } - else if(nPane == SPLIT_PANE_RIGHT) - { - if(t_bVertical) - { - lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - lpRect->top = m_rcSplitter.top; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.bottom; - } - else - { - lpRect->left = m_rcSplitter.left; - lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; - lpRect->right = m_rcSplitter.right; - lpRect->bottom = m_rcSplitter.bottom; - } - } - else - { - bRet = false; - } - return bRet; - } - - bool IsOverSplitterRect(int x, int y) const - { - // -1 == don't check - return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) && - (y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom))); - } - - bool IsOverSplitterBar(int x, int y) const - { - if(m_nSinglePane != SPLIT_PANE_NONE) - return false; - if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y)) - return false; - int xy = t_bVertical ? x : y; - int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top; - return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)); - } - - void DrawGhostBar() - { - RECT rect = { 0, 0, 0, 0 }; - if(GetSplitterBarRect(&rect)) - { - // invert the brush pattern (looks just like frame window sizing) - T* pT = static_cast(this); - CWindowDC dc(pT->m_hWnd); - CBrush brush = CDCHandle::GetHalftoneBrush(); - if(brush.m_hBrush != NULL) - { - CBrushHandle brushOld = dc.SelectBrush(brush); - dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); - dc.SelectBrush(brushOld); - } - } - } - - void GetSystemSettings(bool bUpdate) - { -#ifndef _WIN32_WCE - m_cxySplitBar = ::GetSystemMetrics(t_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME); -#else // CE specific - m_cxySplitBar = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); -#endif // _WIN32_WCE - - T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE)) - { - m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); - m_cxyMin = 0; - } - else - { - m_cxyBarEdge = 0; - m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); - } - -#ifndef _WIN32_WCE - ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0); -#endif // !_WIN32_WCE - - if(bUpdate) - UpdateSplitterLayout(); - } - - bool IsProportional() const - { - return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0); - } - - void StoreProportionalPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal); - else - m_nProportionalPos = 0; - ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos); - } - - void UpdateProportionalPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - { - int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax); - m_bUpdateProportionalPos = false; - T* pT = static_cast(this); - pT->SetSplitterPos(xyNewPos, false); - } - } - - bool IsRightAligned() const - { - return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0); - } - - void StoreRightAlignPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - m_nProportionalPos = cxyTotal - m_xySplitterPos; - else - m_nProportionalPos = 0; - ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos); - } - - void UpdateRightAlignPos() - { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); - if(cxyTotal > 0) - { - m_bUpdateProportionalPos = false; - T* pT = static_cast(this); - pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false); - } - } - - bool IsInteractive() const - { - return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0); - } -}; - -template HCURSOR CSplitterImpl< T, t_bVertical>::m_hCursor = NULL; - - -/////////////////////////////////////////////////////////////////////////////// -// CSplitterWindowImpl - Implements a splitter window - -template -class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical > -{ -public: - DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW) - - typedef CSplitterImpl< T , t_bVertical > _baseClass; - - BEGIN_MSG_MAP(CSplitterWindowImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(_baseClass) - FORWARD_NOTIFICATIONS() - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - // handled, no background painting needed - return 1; - } - - LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if(wParam != SIZE_MINIMIZED) - SetSplitterRect(); - - bHandled = FALSE; - return 1; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSplitterWindow - Implements a splitter window to be used as is - -template -class CSplitterWindowT : public CSplitterWindowImpl, t_bVertical> -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW) -}; - -typedef CSplitterWindowT CSplitterWindow; -typedef CSplitterWindowT CHorSplitterWindow; - -}; // namespace WTL - -#endif // __ATLSPLIT_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLSPLIT_H__ +#define __ATLSPLIT_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlsplit.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atlsplit.h requires atlwin.h to be included first +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CSplitterImpl +// CSplitterWindowImpl +// CSplitterWindowT + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CSplitterImpl - Provides splitter support to any window + +// Splitter panes constants +#define SPLIT_PANE_LEFT 0 +#define SPLIT_PANE_RIGHT 1 +#define SPLIT_PANE_TOP SPLIT_PANE_LEFT +#define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT +#define SPLIT_PANE_NONE -1 + +// Splitter extended styles +#define SPLIT_PROPORTIONAL 0x00000001 +#define SPLIT_NONINTERACTIVE 0x00000002 +#define SPLIT_RIGHTALIGNED 0x00000004 +#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED + +// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are +// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL + + +template +class CSplitterImpl +{ +public: + enum { m_nPanesCount = 2, m_nPropMax = 10000 }; + + HWND m_hWndPane[m_nPanesCount]; + RECT m_rcSplitter; + int m_xySplitterPos; + int m_nDefActivePane; + int m_cxySplitBar; // splitter bar width/height + static HCURSOR m_hCursor; + int m_cxyMin; // minimum pane size + int m_cxyBarEdge; // splitter bar edge + bool m_bFullDrag; + int m_cxyDragOffset; + int m_nProportionalPos; + bool m_bUpdateProportionalPos; + DWORD m_dwExtendedStyle; // splitter specific extended styles + int m_nSinglePane; // single pane mode + +// Constructor + CSplitterImpl() : + m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE), + m_cxySplitBar(0), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true), + m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true), + m_dwExtendedStyle(SPLIT_PROPORTIONAL), + m_nSinglePane(SPLIT_PANE_NONE) + { + m_hWndPane[SPLIT_PANE_LEFT] = NULL; + m_hWndPane[SPLIT_PANE_RIGHT] = NULL; + + ::SetRectEmpty(&m_rcSplitter); + + if(m_hCursor == NULL) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CSplitterImpl::CSplitterImpl.\n")); + ATLASSERT(FALSE); + return; + } + + if(m_hCursor == NULL) + m_hCursor = ::LoadCursor(NULL, t_bVertical ? IDC_SIZEWE : IDC_SIZENS); + + lock.Unlock(); + } + } + +// Attributes + void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true) + { + if(lpRect == NULL) + { + T* pT = static_cast(this); + pT->GetClientRect(&m_rcSplitter); + } + else + { + m_rcSplitter = *lpRect; + } + + if(IsProportional()) + UpdateProportionalPos(); + else if(IsRightAligned()) + UpdateRightAlignPos(); + + if(bUpdate) + UpdateSplitterLayout(); + } + + void GetSplitterRect(LPRECT lpRect) const + { + ATLASSERT(lpRect != NULL); + *lpRect = m_rcSplitter; + } + + bool SetSplitterPos(int xyPos = -1, bool bUpdate = true) + { + if(xyPos == -1) // -1 == middle + { + if(t_bVertical) + xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; + else + xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; + } + + // Adjust if out of valid range + int cxyMax = 0; + if(t_bVertical) + cxyMax = m_rcSplitter.right - m_rcSplitter.left; + else + cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; + + if(xyPos < m_cxyMin + m_cxyBarEdge) + xyPos = m_cxyMin; + else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) + xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; + + // Set new position and update if requested + bool bRet = (m_xySplitterPos != xyPos); + m_xySplitterPos = xyPos; + + if(m_bUpdateProportionalPos) + { + if(IsProportional()) + StoreProportionalPos(); + else if(IsRightAligned()) + StoreRightAlignPos(); + } + else + { + m_bUpdateProportionalPos = true; + } + + if(bUpdate && bRet) + UpdateSplitterLayout(); + + return bRet; + } + + void SetSplitterPosPct(int nPct, bool bUpdate = true) + { + ATLASSERT(nPct >= 0 && nPct <= 100); + + m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100); + UpdateProportionalPos(); + + if(bUpdate) + UpdateSplitterLayout(); + } + + int GetSplitterPos() const + { + return m_xySplitterPos; + } + + bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE) + { + ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE); + if(!(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE)) + return false; + + if(nPane != SPLIT_PANE_NONE) + { + if(!::IsWindowVisible(m_hWndPane[nPane])) + ::ShowWindow(m_hWndPane[nPane], SW_SHOW); + int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; + ::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE); + if(m_nDefActivePane != nPane) + m_nDefActivePane = nPane; + } + else if(m_nSinglePane != SPLIT_PANE_NONE) + { + int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; + ::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW); + } + + m_nSinglePane = nPane; + UpdateSplitterLayout(); + return true; + } + + int GetSinglePaneMode() const + { + return m_nSinglePane; + } + + DWORD GetSplitterExtendedStyle() const + { + return m_dwExtendedStyle; + } + + DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); +#ifdef _DEBUG + if(IsProportional() && IsRightAligned()) + ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n")); +#endif // _DEBUG + return dwPrevStyle; + } + +// Splitter operations + void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true) + { + m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop; + m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom; + ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); + if(bUpdate) + UpdateSplitterLayout(); + } + + bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true) + { + ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + + if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + return false; + m_hWndPane[nPane] = hWnd; + ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); + if(bUpdate) + UpdateSplitterLayout(); + return true; + } + + HWND GetSplitterPane(int nPane) const + { + ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + + if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + return false; + return m_hWndPane[nPane]; + } + + bool SetActivePane(int nPane) + { + ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + + if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + return false; + if(m_nSinglePane != SPLIT_PANE_NONE && nPane != m_nSinglePane) + return false; + ::SetFocus(m_hWndPane[nPane]); + m_nDefActivePane = nPane; + return true; + } + + int GetActivePane() const + { + int nRet = SPLIT_PANE_NONE; + HWND hWndFocus = ::GetFocus(); + if(hWndFocus != NULL) + { + for(int nPane = 0; nPane < m_nPanesCount; nPane++) + { + if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus)) + { + nRet = nPane; + break; + } + } + } + return nRet; + } + + bool ActivateNextPane(bool bNext = true) + { + int nPane = m_nSinglePane; + if(nPane == SPLIT_PANE_NONE) + { + switch(GetActivePane()) + { + case SPLIT_PANE_LEFT: + nPane = SPLIT_PANE_RIGHT; + break; + case SPLIT_PANE_RIGHT: + nPane = SPLIT_PANE_LEFT; + break; + default: + nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT; + break; + } + } + return SetActivePane(nPane); + } + + bool SetDefaultActivePane(int nPane) + { + ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + + if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + return false; + m_nDefActivePane = nPane; + return true; + } + + bool SetDefaultActivePane(HWND hWnd) + { + for(int nPane = 0; nPane < m_nPanesCount; nPane++) + { + if(hWnd == m_hWndPane[nPane]) + { + m_nDefActivePane = nPane; + return true; + } + } + return false; // not found + } + + int GetDefaultActivePane() const + { + return m_nDefActivePane; + } + + void DrawSplitter(CDCHandle dc) + { + ATLASSERT(dc.m_hDC != NULL); + if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) + return; + + T* pT = static_cast(this); + if(m_nSinglePane == SPLIT_PANE_NONE) + { + pT->DrawSplitterBar(dc); + + for(int nPane = 0; nPane < m_nPanesCount; nPane++) + { + if(m_hWndPane[nPane] == NULL) + pT->DrawSplitterPane(dc, nPane); + } + } + else + { + if(m_hWndPane[m_nSinglePane] == NULL) + pT->DrawSplitterPane(dc, m_nSinglePane); + } + } + +// Overrideables + void DrawSplitterBar(CDCHandle dc) + { + RECT rect; + if(GetSplitterBarRect(&rect)) + { + dc.FillRect(&rect, COLOR_3DFACE); + // draw 3D edge if needed + T* pT = static_cast(this); + if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) + dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM)); + } + } + + // called only if pane is empty + void DrawSplitterPane(CDCHandle dc, int nPane) + { + RECT rect; + if(GetSplitterPaneRect(nPane, &rect)) + { + T* pT = static_cast(this); + if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0) + dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); + dc.FillRect(&rect, COLOR_APPWORKSPACE); + } + } + +// Message map and handlers + BEGIN_MSG_MAP(CSplitterImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_PAINT, OnPaint) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) +#endif // !_WIN32_WCE + if(IsInteractive()) + { + MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) + MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick) + MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) + } + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) +#ifndef _WIN32_WCE + MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) +#endif // !_WIN32_WCE + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + GetSystemSettings(false); + bHandled = FALSE; + return 1; + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + // try setting position if not set + if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) + pT->SetSplitterPos(); + // do painting + CPaintDC dc(pT->m_hWnd); + pT->DrawSplitter(dc.m_hDC); + return 0; + } + + LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + if((HWND)wParam == pT->m_hWnd && LOWORD(lParam) == HTCLIENT) + { + DWORD dwPos = ::GetMessagePos(); + POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; + pT->ScreenToClient(&ptPos); + if(IsOverSplitterBar(ptPos.x, ptPos.y)) + return 1; + } + + bHandled = FALSE; + return 0; + } + + LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + int xPos = GET_X_LPARAM(lParam); + int yPos = GET_Y_LPARAM(lParam); + if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd) + { + int xyNewSplitPos = 0; + if(t_bVertical) + xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset; + else + xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset; + + if(xyNewSplitPos == -1) // avoid -1, that means middle + xyNewSplitPos = -2; + + if(m_xySplitterPos != xyNewSplitPos) + { + if(m_bFullDrag) + { + if(pT->SetSplitterPos(xyNewSplitPos, true)) + pT->UpdateWindow(); + } + else + { + DrawGhostBar(); + pT->SetSplitterPos(xyNewSplitPos, false); + DrawGhostBar(); + } + } + } + else // not dragging, just set cursor + { + if(IsOverSplitterBar(xPos, yPos)) + ::SetCursor(m_hCursor); + bHandled = FALSE; + } + + return 0; + } + + LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) + { + int xPos = GET_X_LPARAM(lParam); + int yPos = GET_Y_LPARAM(lParam); + if(IsOverSplitterBar(xPos, yPos)) + { + T* pT = static_cast(this); + pT->SetCapture(); + ::SetCursor(m_hCursor); + if(!m_bFullDrag) + DrawGhostBar(); + if(t_bVertical) + m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos; + else + m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos; + } + bHandled = FALSE; + return 1; + } + + LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + ::ReleaseCapture(); + bHandled = FALSE; + return 1; + } + + LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->SetSplitterPos(); // middle + return 0; + } + + LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + if(!m_bFullDrag) + { + DrawGhostBar(); + UpdateSplitterLayout(); + T* pT = static_cast(this); + pT->UpdateWindow(); + } + return 0; + } + + LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled) + { + if(m_nSinglePane == SPLIT_PANE_NONE) + { + if(m_nDefActivePane == SPLIT_PANE_LEFT || m_nDefActivePane == SPLIT_PANE_RIGHT) + ::SetFocus(m_hWndPane[m_nDefActivePane]); + } + else + { + ::SetFocus(m_hWndPane[m_nSinglePane]); + } + bHandled = FALSE; + return 1; + } + +#ifndef _WIN32_WCE + LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); + if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT) + { + DWORD dwPos = ::GetMessagePos(); + POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; + pT->ScreenToClient(&pt); + RECT rcPane; + for(int nPane = 0; nPane < m_nPanesCount; nPane++) + { + if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt)) + { + m_nDefActivePane = nPane; + break; + } + } + } + return lRet; + } +#endif // !_WIN32_WCE + + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + GetSystemSettings(true); + return 0; + } + +// Implementation - internal helpers + void UpdateSplitterLayout() + { + if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) + return; + + T* pT = static_cast(this); + RECT rect = { 0, 0, 0, 0 }; + if(m_nSinglePane == SPLIT_PANE_NONE) + { + if(GetSplitterBarRect(&rect)) + pT->InvalidateRect(&rect); + + for(int nPane = 0; nPane < m_nPanesCount; nPane++) + { + if(GetSplitterPaneRect(nPane, &rect)) + { + if(m_hWndPane[nPane] != NULL) + ::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); + else + pT->InvalidateRect(&rect); + } + } + } + else + { + if(GetSplitterPaneRect(m_nSinglePane, &rect)) + { + if(m_hWndPane[m_nSinglePane] != NULL) + ::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); + else + pT->InvalidateRect(&rect); + } + } + } + + bool GetSplitterBarRect(LPRECT lpRect) const + { + ATLASSERT(lpRect != NULL); + if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1) + return false; + + if(t_bVertical) + { + lpRect->left = m_rcSplitter.left + m_xySplitterPos; + lpRect->top = m_rcSplitter.top; + lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; + lpRect->bottom = m_rcSplitter.bottom; + } + else + { + lpRect->left = m_rcSplitter.left; + lpRect->top = m_rcSplitter.top + m_xySplitterPos; + lpRect->right = m_rcSplitter.right; + lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; + } + + return true; + } + + bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const + { + ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + ATLASSERT(lpRect != NULL); + bool bRet = true; + if(m_nSinglePane != SPLIT_PANE_NONE) + { + if(nPane == m_nSinglePane) + *lpRect = m_rcSplitter; + else + bRet = false; + } + else if(nPane == SPLIT_PANE_LEFT) + { + if(t_bVertical) + { + lpRect->left = m_rcSplitter.left; + lpRect->top = m_rcSplitter.top; + lpRect->right = m_rcSplitter.left + m_xySplitterPos; + lpRect->bottom = m_rcSplitter.bottom; + } + else + { + lpRect->left = m_rcSplitter.left; + lpRect->top = m_rcSplitter.top; + lpRect->right = m_rcSplitter.right; + lpRect->bottom = m_rcSplitter.top + m_xySplitterPos; + } + } + else if(nPane == SPLIT_PANE_RIGHT) + { + if(t_bVertical) + { + lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; + lpRect->top = m_rcSplitter.top; + lpRect->right = m_rcSplitter.right; + lpRect->bottom = m_rcSplitter.bottom; + } + else + { + lpRect->left = m_rcSplitter.left; + lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; + lpRect->right = m_rcSplitter.right; + lpRect->bottom = m_rcSplitter.bottom; + } + } + else + { + bRet = false; + } + return bRet; + } + + bool IsOverSplitterRect(int x, int y) const + { + // -1 == don't check + return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) && + (y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom))); + } + + bool IsOverSplitterBar(int x, int y) const + { + if(m_nSinglePane != SPLIT_PANE_NONE) + return false; + if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y)) + return false; + int xy = t_bVertical ? x : y; + int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top; + return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)); + } + + void DrawGhostBar() + { + RECT rect = { 0, 0, 0, 0 }; + if(GetSplitterBarRect(&rect)) + { + // invert the brush pattern (looks just like frame window sizing) + T* pT = static_cast(this); + CWindowDC dc(pT->m_hWnd); + CBrush brush = CDCHandle::GetHalftoneBrush(); + if(brush.m_hBrush != NULL) + { + CBrushHandle brushOld = dc.SelectBrush(brush); + dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); + dc.SelectBrush(brushOld); + } + } + } + + void GetSystemSettings(bool bUpdate) + { +#ifndef _WIN32_WCE + m_cxySplitBar = ::GetSystemMetrics(t_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME); +#else // CE specific + m_cxySplitBar = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); +#endif // _WIN32_WCE + + T* pT = static_cast(this); + if((pT->GetExStyle() & WS_EX_CLIENTEDGE)) + { + m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); + m_cxyMin = 0; + } + else + { + m_cxyBarEdge = 0; + m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); + } + +#ifndef _WIN32_WCE + ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0); +#endif // !_WIN32_WCE + + if(bUpdate) + UpdateSplitterLayout(); + } + + bool IsProportional() const + { + return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0); + } + + void StoreProportionalPos() + { + int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + if(cxyTotal > 0) + m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal); + else + m_nProportionalPos = 0; + ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos); + } + + void UpdateProportionalPos() + { + int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + if(cxyTotal > 0) + { + int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax); + m_bUpdateProportionalPos = false; + T* pT = static_cast(this); + pT->SetSplitterPos(xyNewPos, false); + } + } + + bool IsRightAligned() const + { + return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0); + } + + void StoreRightAlignPos() + { + int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + if(cxyTotal > 0) + m_nProportionalPos = cxyTotal - m_xySplitterPos; + else + m_nProportionalPos = 0; + ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos); + } + + void UpdateRightAlignPos() + { + int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + if(cxyTotal > 0) + { + m_bUpdateProportionalPos = false; + T* pT = static_cast(this); + pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false); + } + } + + bool IsInteractive() const + { + return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0); + } +}; + +template HCURSOR CSplitterImpl< T, t_bVertical>::m_hCursor = NULL; + + +/////////////////////////////////////////////////////////////////////////////// +// CSplitterWindowImpl - Implements a splitter window + +template +class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical > +{ +public: + DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW) + + typedef CSplitterImpl< T , t_bVertical > _baseClass; + + BEGIN_MSG_MAP(CSplitterWindowImpl) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_SIZE, OnSize) + CHAIN_MSG_MAP(_baseClass) + FORWARD_NOTIFICATIONS() + END_MSG_MAP() + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + // handled, no background painting needed + return 1; + } + + LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if(wParam != SIZE_MINIMIZED) + SetSplitterRect(); + + bHandled = FALSE; + return 1; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CSplitterWindow - Implements a splitter window to be used as is + +template +class CSplitterWindowT : public CSplitterWindowImpl, t_bVertical> +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW) +}; + +typedef CSplitterWindowT CSplitterWindow; +typedef CSplitterWindowT CHorSplitterWindow; + +}; // namespace WTL + +#endif // __ATLSPLIT_H__ diff --git a/Externals/WTL80/atltheme.h b/Externals/WTL80/atltheme.h index 4c0725f4d9..bf78e06f97 100644 --- a/Externals/WTL80/atltheme.h +++ b/Externals/WTL80/atltheme.h @@ -1,1218 +1,1218 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLTHEME_H__ -#define __ATLTHEME_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifdef _WIN32_WCE - #error atltheme.h is not supported on Windows CE -#endif - -#ifndef __ATLAPP_H__ - #error atltheme.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atltheme.h requires atlwin.h to be included first -#endif - -#if (_WIN32_WINNT < 0x0501) - #error atltheme.h requires _WIN32_WINNT >= 0x0501 -#endif // (_WIN32_WINNT < 0x0501) - -#if defined(_WTL_USE_VSSYM32) || (defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)) - #include -#else - #include -#endif - -#include -#pragma comment(lib, "uxtheme.lib") - -// Note: To create an application that also runs on older versions of Windows, -// use delay load of uxtheme.dll and ensure that no calls to the Theme API are -// made if theming is not supported. It is enough to check if m_hTheme is NULL. -// Example: -// if(m_hTheme != NULL) -// { -// DrawThemeBackground(dc, BP_PUSHBUTTON, PBS_NORMAL, &rect, NULL); -// DrawThemeText(dc, BP_PUSHBUTTON, PBS_NORMAL, L"Button", -1, DT_SINGLELINE | DT_CENTER | DT_VCENTER, 0, &rect); -// } -// else -// { -// dc.DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH); -// dc.DrawText(_T("Button"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); -// } -// -// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, -// and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the -// project properties. -#if (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) - #pragma comment(lib, "delayimp.lib") - #pragma comment(linker, "/delayload:uxtheme.dll") -#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) - -// Hack: Signatures in uxtheme.h changed - the only way to check which variant of uxtheme.h -// is included is to check for presence of new defines MAX_THEMECOLOR and MAX_THEMESIZE -#ifndef _WTL_NEW_UXTHEME - #if defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) - #define _WTL_NEW_UXTHEME - #endif // defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) -#endif // _WTL_NEW_UXTHEME - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CTheme -// CThemeImpl -// -// CBufferedPaint -// CBufferedPaintImpl -// CBufferedPaintWindowImpl -// CBufferedAnimation -// CBufferedAnimationImpl -// CBufferedAnimationWindowImpl -// -// Global functions: -// AtlDrawThemeClientEdge() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// CTheme - wrapper for theme handle - -class CTheme -{ -public: -// Data members - HTHEME m_hTheme; - static int m_nIsThemingSupported; - -// Constructor - CTheme(HTHEME hTheme = NULL) : m_hTheme(hTheme) - { - IsThemingSupported(); - } - -// Operators and helpers - bool IsThemeNull() const - { - return (m_hTheme == NULL); - } - - CTheme& operator =(HTHEME hTheme) - { - m_hTheme = hTheme; - return *this; - } - - operator HTHEME() const - { - return m_hTheme; - } - - void Attach(HTHEME hTheme) - { - m_hTheme = hTheme; - } - - HTHEME Detach() - { - HTHEME hTheme = m_hTheme; - m_hTheme = NULL; - return hTheme; - } - -// Theme support helper - static bool IsThemingSupported() - { - if(m_nIsThemingSupported == -1) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CTheme::IsThemingSupported.\n")); - ATLASSERT(FALSE); - return false; - } - - if(m_nIsThemingSupported == -1) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - m_nIsThemingSupported = (hThemeDLL != NULL) ? 1 : 0; - if(hThemeDLL != NULL) - ::FreeLibrary(hThemeDLL); - } - - lock.Unlock(); - } - - ATLASSERT(m_nIsThemingSupported != -1); - return (m_nIsThemingSupported == 1); - } - -// Operations and theme properties - HTHEME OpenThemeData(HWND hWnd, LPCWSTR pszClassList) - { - if(!IsThemingSupported()) - return NULL; - - ATLASSERT(m_hTheme == NULL); - m_hTheme = ::OpenThemeData(hWnd, pszClassList); - return m_hTheme; - } - - HRESULT CloseThemeData() - { - HRESULT hRet = S_FALSE; - if(m_hTheme != NULL) - { - hRet = ::CloseThemeData(m_hTheme); - if(SUCCEEDED(hRet)) - m_hTheme = NULL; - } - return hRet; - } - - HRESULT DrawThemeBackground(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, LPCRECT pClipRect = NULL) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect); - } - - HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions); - } - - HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeText(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, dwTextFlags2, pRect); - } - - HRESULT GetThemeBackgroundContentRect(HDC hDC, int nPartID, int nStateID, LPCRECT pBoundingRect, LPRECT pContentRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBackgroundContentRect(m_hTheme, hDC, nPartID, nStateID, pBoundingRect, pContentRect); - } - - HRESULT GetThemeBackgroundExtent(HDC hDC, int nPartID, int nStateID, LPCRECT pContentRect, LPRECT pExtentRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect); - } - - HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize); - } - - HRESULT GetThemeTextExtent(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, LPCRECT pBoundingRect, LPRECT pExtentRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeTextExtent(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, pBoundingRect, pExtentRect); - } - - HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to PTEXTMETRIC is because uxtheme.h incorrectly uses it instead of PTEXTMETRICW - return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, (PTEXTMETRIC)pTextMetric); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBackgroundRegion(m_hTheme, hDC, nPartID, nStateID, pRect, pRegion); - } - - HRESULT HitTestThemeBackground(HDC hDC, int nPartID, int nStateID, DWORD dwOptions, LPCRECT pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) const - { - ATLASSERT(m_hTheme != NULL); - return ::HitTestThemeBackground(m_hTheme, hDC, nPartID, nStateID, dwOptions, pRect, hrgn, ptTest, pwHitTestCode); - } - - HRESULT DrawThemeEdge(HDC hDC, int nPartID, int nStateID, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect = NULL) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeEdge(m_hTheme, hDC, nPartID, nStateID, pDestRect, uEdge, uFlags, pContentRect); - } - - HRESULT DrawThemeIcon(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HIMAGELIST himl, int nImageIndex) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeIcon(m_hTheme, hDC, nPartID, nStateID, pRect, himl, nImageIndex); - } - - BOOL IsThemePartDefined(int nPartID, int nStateID) const - { - ATLASSERT(m_hTheme != NULL); - return ::IsThemePartDefined(m_hTheme, nPartID, nStateID); - } - - BOOL IsThemeBackgroundPartiallyTransparent(int nPartID, int nStateID) const - { - ATLASSERT(m_hTheme != NULL); - return ::IsThemeBackgroundPartiallyTransparent(m_hTheme, nPartID, nStateID); - } - - HRESULT GetThemeColor(int nPartID, int nStateID, int nPropID, COLORREF* pColor) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeColor(m_hTheme, nPartID, nStateID, nPropID, pColor); - } - - HRESULT GetThemeMetric(HDC hDC, int nPartID, int nStateID, int nPropID, int* pnVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeMetric(m_hTheme, hDC, nPartID, nStateID, nPropID, pnVal); - } - - HRESULT GetThemeString(int nPartID, int nStateID, int nPropID, LPWSTR pszBuff, int cchMaxBuffChars) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeString(m_hTheme, nPartID, nStateID, nPropID, pszBuff, cchMaxBuffChars); - } - - HRESULT GetThemeBool(int nPartID, int nStateID, int nPropID, BOOL* pfVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBool(m_hTheme, nPartID, nStateID, nPropID, pfVal); - } - - HRESULT GetThemeInt(int nPartID, int nStateID, int nPropID, int* pnVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeInt(m_hTheme, nPartID, nStateID, nPropID, pnVal); - } - - HRESULT GetThemeEnumValue(int nPartID, int nStateID, int nPropID, int* pnVal) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeEnumValue(m_hTheme, nPartID, nStateID, nPropID, pnVal); - } - - HRESULT GetThemePosition(int nPartID, int nStateID, int nPropID, LPPOINT pPoint) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemePosition(m_hTheme, nPartID, nStateID, nPropID, pPoint); - } - - // deprecated - HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeRect(m_hTheme, nPartID, nStateID, nPropID, pRect); - } - - HRESULT GetThemeMargins(HDC hDC, int nPartID, int nStateID, int nPropID, LPRECT pRect, PMARGINS pMargins) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeMargins(m_hTheme, hDC, nPartID, nStateID, nPropID, pRect, pMargins); - } - - HRESULT GetThemeIntList(int nPartID, int nStateID, int nPropID, INTLIST* pIntList) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeIntList(m_hTheme, nPartID, nStateID, nPropID, pIntList); - } - - HRESULT GetThemePropertyOrigin(int nPartID, int nStateID, int nPropID, enum PROPERTYORIGIN* pOrigin) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemePropertyOrigin(m_hTheme, nPartID, nStateID, nPropID, pOrigin); - } - - HRESULT GetThemeFilename(int nPartID, int nStateID, int nPropID, LPWSTR pszThemeFileName, int cchMaxBuffChars) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeFilename(m_hTheme, nPartID, nStateID, nPropID, pszThemeFileName, cchMaxBuffChars); - } - - COLORREF GetThemeSysColor(int nColorID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysColor(m_hTheme, nColorID); - } - - HBRUSH GetThemeSysColorBrush(int nColorID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysColorBrush(m_hTheme, nColorID); - } - - int GetThemeSysSize(int nSizeID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysSize(m_hTheme, nSizeID); - } - - BOOL GetThemeSysBool(int nBoolID) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysBool(m_hTheme, nBoolID); - } - - HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const - { - ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME - return ::GetThemeSysFont(m_hTheme, nFontID, plf); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeSysFont(m_hTheme, nFontID, (LOGFONT*)plf); -#endif // !_WTL_NEW_UXTHEME - } - - HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysString(m_hTheme, nStringID, pszStringBuff, cchMaxStringChars); - } - - HRESULT GetThemeSysInt(int nIntID, int* pnValue) const - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeSysInt(m_hTheme, nIntID, pnValue); - } - -#ifdef _WTL_NEW_UXTHEME - HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags) - { - if(!IsThemingSupported()) - return NULL; - - ATLASSERT(m_hTheme == NULL); - m_hTheme = ::OpenThemeDataEx(hWnd, pszClassList, dwFlags); - return m_hTheme; - } - - HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions) - { - ATLASSERT(m_hTheme != NULL); - return ::DrawThemeTextEx(m_hTheme, hDC, nPartID, nStateID, pszText, cchText, dwTextFlags, lpRect, pOptions); - } - - HRESULT GetThemeTransitionDuration(int nPartID, int nFromStateID, int nToStateID, int nPropID, DWORD& dwDuration) - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration); - } -#endif // _WTL_NEW_UXTHEME - -#if (_WIN32_WINNT >= 0x0600) - HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap) - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeBitmap(m_hTheme, nPartID, nStateID, nPropID, uFlags, &hBitmap); - } - - HRESULT GetThemeStream(int nPartID, int nStateID, int nPropID, VOID** ppvStream, DWORD* pcbStream, HINSTANCE hInstance) - { - ATLASSERT(m_hTheme != NULL); - return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance); - } -#endif // (_WIN32_WINNT >= 0x0600) -}; - -__declspec(selectany) int CTheme::m_nIsThemingSupported = -1; - - -/////////////////////////////////////////////////////////////////////////////// -// CThemeImpl - theme support implementation - -// Derive from this class to implement window with theme support. -// Example: -// class CMyThemeWindow : public CWindowImpl, public CThemeImpl -// { -// ... -// BEGIN_MSG_MAP(CMyThemeWindow) -// CHAIN_MSG_MAP(CThemeImpl) -// ... -// END_MSG_MAP() -// ... -// }; -// -// If you set theme class list, the class will automaticaly open/close/reopen theme data. - - -// Helper for drawing theme client edge -inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = NULL, HBRUSH hBrush = NULL, int nPartID = 0, int nStateID = 0) -{ - ATLASSERT(hTheme != NULL); - ATLASSERT(::IsWindow(hWnd)); - - CWindowDC dc(hWnd); - if(dc.IsNull()) - return false; - - // Get border size - int cxBorder = GetSystemMetrics(SM_CXBORDER); - int cyBorder = GetSystemMetrics(SM_CYBORDER); - if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder))) - cyBorder = cxBorder; - - RECT rect; - ::GetWindowRect(hWnd, &rect); - - // Remove the client edge from the update region - int cxEdge = GetSystemMetrics(SM_CXEDGE); - int cyEdge = GetSystemMetrics(SM_CYEDGE); - ::InflateRect(&rect, -cxEdge, -cyEdge); - CRgn rgn; - rgn.CreateRectRgnIndirect(&rect); - if(rgn.IsNull()) - return false; - - if(hRgnUpdate != NULL) - rgn.CombineRgn(hRgnUpdate, rgn, RGN_AND); - - ::OffsetRect(&rect, -rect.left, -rect.top); - - ::OffsetRect(&rect, cxEdge, cyEdge); - dc.ExcludeClipRect(&rect); - ::InflateRect(&rect, cxEdge, cyEdge); - - ::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL); - - // Use background brush too, since theme border might not cover everything - if(cxBorder < cxEdge && cyBorder < cyEdge) - { - if(hBrush == NULL) -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 - hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND); -#else - hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND)); -#endif - - ::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge); - dc.FillRect(&rect, hBrush); - } - - ::DefWindowProc(hWnd, WM_NCPAINT, (WPARAM)rgn.m_hRgn, 0L); - - return true; -} - - -// Theme extended styles -#define THEME_EX_3DCLIENTEDGE 0x00000001 -#define THEME_EX_THEMECLIENTEDGE 0x00000002 - -template -class CThemeImpl : public TBase -{ -public: -// Data members - LPWSTR m_lpstrThemeClassList; - DWORD m_dwExtendedStyle; // theme specific extended styles - -// Constructor & destructor - CThemeImpl() : m_lpstrThemeClassList(NULL), m_dwExtendedStyle(0) - { } - - ~CThemeImpl() - { - delete [] m_lpstrThemeClassList; - } - -// Attributes - bool SetThemeClassList(LPCWSTR lpstrThemeClassList) - { - if(m_lpstrThemeClassList != NULL) - { - delete [] m_lpstrThemeClassList; - m_lpstrThemeClassList = NULL; - } - - if(lpstrThemeClassList == NULL) - return true; - - int cchLen = lstrlenW(lpstrThemeClassList) + 1; - ATLTRY(m_lpstrThemeClassList = new WCHAR[cchLen]); - if(m_lpstrThemeClassList == NULL) - return false; - - SecureHelper::strcpyW_x(m_lpstrThemeClassList, cchLen, lpstrThemeClassList); - - return true; - } - - bool GetThemeClassList(LPWSTR lpstrThemeClassList, int cchListBuffer) const - { - int cchLen = lstrlenW(m_lpstrThemeClassList) + 1; - if(cchListBuffer < cchLen) - return false; - - SecureHelper::strcpyW_x(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList); - - return true; - } - - LPCWSTR GetThemeClassList() const - { - return m_lpstrThemeClassList; - } - - DWORD SetThemeExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) - { - DWORD dwPrevStyle = m_dwExtendedStyle; - if(dwMask == 0) - m_dwExtendedStyle = dwExtendedStyle; - else - m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - return dwPrevStyle; - } - - DWORD GetThemeExtendedStyle() const - { - return m_dwExtendedStyle; - } - -// Operations - HTHEME OpenThemeData() - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_lpstrThemeClassList != NULL); - if(m_lpstrThemeClassList == NULL) - return NULL; - CloseThemeData(); - return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList); - } - - HTHEME OpenThemeData(LPCWSTR pszClassList) - { - if(!SetThemeClassList(pszClassList)) - return NULL; - return OpenThemeData(); - } - - HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::SetWindowTheme(pT->m_hWnd, pszSubAppName, pszSubIDList); - } - - HTHEME GetWindowTheme() const - { - if(!IsThemingSupported()) - return NULL; - - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::GetWindowTheme(pT->m_hWnd); - } - - HRESULT EnableThemeDialogTexture(DWORD dwFlags) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::EnableThemeDialogTexture(pT->m_hWnd, dwFlags); - } - - BOOL IsThemeDialogTextureEnabled() const - { - if(!IsThemingSupported()) - return FALSE; - - const T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::IsThemeDialogTextureEnabled(pT->m_hWnd); - } - - HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); -#ifdef _WTL_NEW_UXTHEME - return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect); -#else - return ::DrawThemeParentBackground(pT->m_hWnd, hDC, (RECT*)pRect); -#endif - } - -#ifdef _WTL_NEW_UXTHEME - HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::SetWindowThemeAttribute(pT->m_hWnd, type, pvAttribute, cbAttribute); - } - - HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - WTA_OPTIONS opt = { dwAttributes, dwMask }; - return ::SetWindowThemeAttribute(pT->m_hWnd, WTA_NONCLIENT, (PVOID)&opt, sizeof(opt)); - } - - HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL) - { - if(!IsThemingSupported()) - return S_FALSE; - - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect); - } -#endif // _WTL_NEW_UXTHEME - -// Message map and handlers - // Note: If you handle any of these messages in your derived class, - // it is better to put CHAIN_MSG_MAP at the start of your message map. - BEGIN_MSG_MAP(CThemeImpl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) - MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) - END_MSG_MAP() - - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if(m_lpstrThemeClassList != NULL) - OpenThemeData(); - bHandled = FALSE; - return 1; - } - - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - CloseThemeData(); - bHandled = FALSE; - return 1; - } - - LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - CloseThemeData(); - if(m_lpstrThemeClassList != NULL) - OpenThemeData(); - bHandled = FALSE; - return 1; - } - - LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - LRESULT lRet = 0; - bHandled = FALSE; - if(IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)) - { - if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0) - { - lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam); - bHandled = TRUE; - } - else if((m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0)) - { - HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL; - if(pT->DrawThemeClientEdge(hRgn)) - bHandled = TRUE; - } - } - return lRet; - } - -// Drawing helper - bool DrawThemeClientEdge(HRGN hRgnUpdate) - { - T* pT = static_cast(this); - return AtlDrawThemeClientEdge(m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Buffered Paint and Animation - -#ifdef _WTL_NEW_UXTHEME - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaintBase - Buffered Paint support for othe classes - -class CBufferedPaintBase -{ -public: - static int m_nIsBufferedPaintSupported; - - CBufferedPaintBase() - { - if(IsBufferedPaintSupported()) - ATLVERIFY(SUCCEEDED(::BufferedPaintInit())); - } - - ~CBufferedPaintBase() - { - if(IsBufferedPaintSupported()) - ATLVERIFY(SUCCEEDED(::BufferedPaintUnInit())); - } - - static bool IsBufferedPaintSupported() - { - if(m_nIsBufferedPaintSupported == -1) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CBufferedPaintBase::IsBufferedPaintSupported.\n")); - ATLASSERT(FALSE); - return false; - } - - if(m_nIsBufferedPaintSupported == -1) - m_nIsBufferedPaintSupported = RunTimeHelper::IsVista() ? 1 : 0; - - lock.Unlock(); - } - - ATLASSERT(m_nIsBufferedPaintSupported != -1); - return (m_nIsBufferedPaintSupported == 1); - } -}; - -__declspec(selectany) int CBufferedPaintBase::m_nIsBufferedPaintSupported = -1; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaint - support for buffered paint functions - -class CBufferedPaint -{ -public: - HPAINTBUFFER m_hPaintBuffer; - - CBufferedPaint() : m_hPaintBuffer(NULL) - { } - - ~CBufferedPaint() - { - ATLVERIFY(SUCCEEDED(End())); - } - - bool IsNull() const - { - return (m_hPaintBuffer == NULL); - } - - HPAINTBUFFER Begin(HDC hdcTarget, const RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, HDC* phdcPaint) - { - ATLASSERT(m_hPaintBuffer == NULL); - m_hPaintBuffer = ::BeginBufferedPaint(hdcTarget, prcTarget, dwFormat, pPaintParams, phdcPaint); - return m_hPaintBuffer; - } - - HRESULT End(BOOL bUpdate = TRUE) - { - HRESULT hRet = S_FALSE; - if(m_hPaintBuffer != NULL) - { - hRet = ::EndBufferedPaint(m_hPaintBuffer, bUpdate); - m_hPaintBuffer = NULL; - } - return hRet; - } - - HRESULT GetTargetRect(LPRECT pRect) const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintTargetRect(m_hPaintBuffer, pRect); - } - - HDC GetTargetDC() const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintTargetDC(m_hPaintBuffer); - } - - HDC GetPaintDC() const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintDC(m_hPaintBuffer); - } - - HRESULT GetBits(RGBQUAD** ppbBuffer, int* pcxRow) const - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::GetBufferedPaintBits(m_hPaintBuffer, ppbBuffer, pcxRow); - } - - HRESULT Clear(const RECT* pRect = NULL) - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::BufferedPaintClear(m_hPaintBuffer, pRect); - } - - HRESULT SetAlpha(BYTE alpha, const RECT* pRect = NULL) - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, alpha); - } - - HRESULT MakeOpaque(const RECT* pRect = NULL) - { - ATLASSERT(m_hPaintBuffer != NULL); - return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, 255); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaintImpl - provides buffered paint for any window - -template -class ATL_NO_VTABLE CBufferedPaintImpl : public CBufferedPaintBase -{ -public: - CBufferedPaint m_BufferedPaint; - BP_BUFFERFORMAT m_dwFormat; - BP_PAINTPARAMS m_PaintParams; - - CBufferedPaintImpl() : m_dwFormat(BPBF_TOPDOWNDIB) - { - memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); - m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); - } - -// Message map and handlers - BEGIN_MSG_MAP(CBufferedPaintImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - pT->DoPaint((HDC)wParam, rect); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->DoBufferedPaint(dc.m_hDC, dc.m_ps.rcPaint); - } - - return 0; - } - -// Overrideables - void DoBufferedPaint(CDCHandle dc, RECT& rect) - { - HDC hDCPaint = NULL; - if(IsBufferedPaintSupported()) - m_BufferedPaint.Begin(dc, &rect, m_dwFormat, &m_PaintParams, &hDCPaint); - - T* pT = static_cast(this); - if(hDCPaint != NULL) - pT->DoPaint(hDCPaint, rect); - else - pT->DoPaint(dc.m_hDC, rect); - - if(IsBufferedPaintSupported()) - m_BufferedPaint.End(); - } - - void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedPaintWindowImpl - implements a window that uses buffered paint - -template -class ATL_NO_VTABLE CBufferedPaintWindowImpl : - public ATL::CWindowImpl, - public CBufferedPaintImpl< T > -{ -public: - BEGIN_MSG_MAP(CBufferedPaintWindowImpl) - CHAIN_MSG_MAP(CBufferedPaintImpl< T >) - END_MSG_MAP() -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedAnimation - support for buffered animation - -class CBufferedAnimation -{ -public: - HANIMATIONBUFFER m_hAnimationBuffer; - - CBufferedAnimation() : m_hAnimationBuffer(NULL) - { } - - ~CBufferedAnimation() - { - ATLVERIFY(SUCCEEDED(End())); - } - - bool IsNull() const - { - return (m_hAnimationBuffer == NULL); - } - - HANIMATIONBUFFER Begin(HWND hWnd, HDC hDCTarget, const RECT* pRectTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, BP_ANIMATIONPARAMS* pAnimationParams, HDC* phdcFrom, HDC* phdcTo) - { - ATLASSERT(m_hAnimationBuffer == NULL); - m_hAnimationBuffer = ::BeginBufferedAnimation(hWnd, hDCTarget, pRectTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo); - return m_hAnimationBuffer; - } - - HRESULT End(BOOL bUpdate = TRUE) - { - HRESULT hRet = S_FALSE; - if(m_hAnimationBuffer != NULL) - { - hRet = ::EndBufferedAnimation(m_hAnimationBuffer, bUpdate); - m_hAnimationBuffer = NULL; - } - return hRet; - } - - static bool IsRendering(HWND hWnd, HDC hDC) - { - return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedAnimationImpl - provides buffered animation support for any window - -// Note: You can either use m_State and m_NewState to store the state information -// for the animation change, or map your state to those data members. DoPaint() -// should only rely on the state information that is passed to it. - -template -class ATL_NO_VTABLE CBufferedAnimationImpl : public CBufferedPaintBase -{ -public: - BP_BUFFERFORMAT m_dwFormat; - BP_PAINTPARAMS m_PaintParams; - BP_ANIMATIONPARAMS m_AnimationParams; - - TState m_State; - TState m_NewState; - - CBufferedAnimationImpl(TState InitialState) : m_dwFormat(BPBF_TOPDOWNDIB) - { - memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); - m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); - - memset(&m_AnimationParams, 0, sizeof(BP_ANIMATIONPARAMS)); - m_AnimationParams.cbSize = sizeof(BP_ANIMATIONPARAMS); - m_AnimationParams.style = BPAS_LINEAR; - m_AnimationParams.dwDuration = 500; - - T* pT = static_cast(this); - pT->SetState(InitialState); - pT->SetNewState(InitialState); - } - - DWORD GetDuration() const - { - return m_AnimationParams.dwDuration; - } - - void SetDuration(DWORD dwDuration) - { - m_AnimationParams.dwDuration = dwDuration; - } - - void DoAnimation(TState NewState, const RECT* pRect = NULL) - { - T* pT = static_cast(this); - pT->SetNewState(NewState); - - pT->InvalidateRect(pRect, FALSE); - pT->UpdateWindow(); - - pT->SetState(NewState); - } - -// Message map and handlers - BEGIN_MSG_MAP(CBufferedAnimationImpl) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_PAINT, OnPaint) - MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) - END_MSG_MAP() - - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - return 1; // no background needed - } - - LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - if(wParam != NULL) - { - RECT rect = { 0 }; - pT->GetClientRect(&rect); - pT->DoPaint((HDC)wParam, rect, m_NewState); - } - else - { - CPaintDC dc(pT->m_hWnd); - pT->DoAnimationPaint(dc.m_hDC, dc.m_ps.rcPaint); - } - - return 0; - } - -// Overrideables - void SetState(TState State) - { - m_State = State; - } - - void SetNewState(TState State) - { - m_NewState = State; - } - - bool AreStatesEqual() const - { - return (m_State == m_NewState); - } - - void DoAnimationPaint(CDCHandle dc, RECT& rect) - { - T* pT = static_cast(this); - if(IsBufferedPaintSupported() && CBufferedAnimation::IsRendering(pT->m_hWnd, dc)) - return; - - DWORD dwDurationSave = m_AnimationParams.dwDuration; - if(pT->AreStatesEqual()) - m_AnimationParams.dwDuration = 0; - - HDC hdcFrom = NULL, hdcTo = NULL; - CBufferedAnimation ba; - if(IsBufferedPaintSupported()) - ba.Begin(pT->m_hWnd, dc, &rect, m_dwFormat, &m_PaintParams, &m_AnimationParams, &hdcFrom, &hdcTo); - - if(!ba.IsNull()) - { - if(hdcFrom != NULL) - pT->DoPaint(hdcFrom, rect, m_State); - - if (hdcTo != NULL) - pT->DoPaint(hdcTo, rect, m_NewState); - } - else - { - pT->DoPaint(dc.m_hDC, rect, m_NewState); - } - - m_AnimationParams.dwDuration = dwDurationSave; - } - - void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/, TState /*State*/) - { - // must be implemented in a derived class - ATLASSERT(FALSE); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CBufferedAnimationWindowImpl - implements a window that uses buffered animation - -template -class ATL_NO_VTABLE CBufferedAnimationWindowImpl : - public ATL::CWindowImpl, - public CBufferedAnimationImpl< T, TState > -{ -public: - CBufferedAnimationWindowImpl(TState InitialState) : CBufferedAnimationImpl< T, TState >(InitialState) - { } - - typedef CBufferedAnimationImpl< T, TState > _baseBufferedAnimation; - BEGIN_MSG_MAP(CBufferedAnimationWindowImpl) - CHAIN_MSG_MAP(_baseBufferedAnimation) - END_MSG_MAP() -}; - -#endif // _WTL_NEW_UXTHEME - -}; // namespace WTL - -#endif // __ATLTHEME_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLTHEME_H__ +#define __ATLTHEME_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifdef _WIN32_WCE + #error atltheme.h is not supported on Windows CE +#endif + +#ifndef __ATLAPP_H__ + #error atltheme.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atltheme.h requires atlwin.h to be included first +#endif + +#if (_WIN32_WINNT < 0x0501) + #error atltheme.h requires _WIN32_WINNT >= 0x0501 +#endif // (_WIN32_WINNT < 0x0501) + +#if defined(_WTL_USE_VSSYM32) || (defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)) + #include +#else + #include +#endif + +#include +#pragma comment(lib, "uxtheme.lib") + +// Note: To create an application that also runs on older versions of Windows, +// use delay load of uxtheme.dll and ensure that no calls to the Theme API are +// made if theming is not supported. It is enough to check if m_hTheme is NULL. +// Example: +// if(m_hTheme != NULL) +// { +// DrawThemeBackground(dc, BP_PUSHBUTTON, PBS_NORMAL, &rect, NULL); +// DrawThemeText(dc, BP_PUSHBUTTON, PBS_NORMAL, L"Button", -1, DT_SINGLELINE | DT_CENTER | DT_VCENTER, 0, &rect); +// } +// else +// { +// dc.DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH); +// dc.DrawText(_T("Button"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); +// } +// +// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, +// and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the +// project properties. +#if (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) + #pragma comment(lib, "delayimp.lib") + #pragma comment(linker, "/delayload:uxtheme.dll") +#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) + +// Hack: Signatures in uxtheme.h changed - the only way to check which variant of uxtheme.h +// is included is to check for presence of new defines MAX_THEMECOLOR and MAX_THEMESIZE +#ifndef _WTL_NEW_UXTHEME + #if defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) + #define _WTL_NEW_UXTHEME + #endif // defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) +#endif // _WTL_NEW_UXTHEME + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CTheme +// CThemeImpl +// +// CBufferedPaint +// CBufferedPaintImpl +// CBufferedPaintWindowImpl +// CBufferedAnimation +// CBufferedAnimationImpl +// CBufferedAnimationWindowImpl +// +// Global functions: +// AtlDrawThemeClientEdge() + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// CTheme - wrapper for theme handle + +class CTheme +{ +public: +// Data members + HTHEME m_hTheme; + static int m_nIsThemingSupported; + +// Constructor + CTheme(HTHEME hTheme = NULL) : m_hTheme(hTheme) + { + IsThemingSupported(); + } + +// Operators and helpers + bool IsThemeNull() const + { + return (m_hTheme == NULL); + } + + CTheme& operator =(HTHEME hTheme) + { + m_hTheme = hTheme; + return *this; + } + + operator HTHEME() const + { + return m_hTheme; + } + + void Attach(HTHEME hTheme) + { + m_hTheme = hTheme; + } + + HTHEME Detach() + { + HTHEME hTheme = m_hTheme; + m_hTheme = NULL; + return hTheme; + } + +// Theme support helper + static bool IsThemingSupported() + { + if(m_nIsThemingSupported == -1) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CTheme::IsThemingSupported.\n")); + ATLASSERT(FALSE); + return false; + } + + if(m_nIsThemingSupported == -1) + { + HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); + m_nIsThemingSupported = (hThemeDLL != NULL) ? 1 : 0; + if(hThemeDLL != NULL) + ::FreeLibrary(hThemeDLL); + } + + lock.Unlock(); + } + + ATLASSERT(m_nIsThemingSupported != -1); + return (m_nIsThemingSupported == 1); + } + +// Operations and theme properties + HTHEME OpenThemeData(HWND hWnd, LPCWSTR pszClassList) + { + if(!IsThemingSupported()) + return NULL; + + ATLASSERT(m_hTheme == NULL); + m_hTheme = ::OpenThemeData(hWnd, pszClassList); + return m_hTheme; + } + + HRESULT CloseThemeData() + { + HRESULT hRet = S_FALSE; + if(m_hTheme != NULL) + { + hRet = ::CloseThemeData(m_hTheme); + if(SUCCEEDED(hRet)) + m_hTheme = NULL; + } + return hRet; + } + + HRESULT DrawThemeBackground(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, LPCRECT pClipRect = NULL) + { + ATLASSERT(m_hTheme != NULL); + return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect); + } + + HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL) + { + ATLASSERT(m_hTheme != NULL); + return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions); + } + + HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect) + { + ATLASSERT(m_hTheme != NULL); + return ::DrawThemeText(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, dwTextFlags2, pRect); + } + + HRESULT GetThemeBackgroundContentRect(HDC hDC, int nPartID, int nStateID, LPCRECT pBoundingRect, LPRECT pContentRect) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeBackgroundContentRect(m_hTheme, hDC, nPartID, nStateID, pBoundingRect, pContentRect); + } + + HRESULT GetThemeBackgroundExtent(HDC hDC, int nPartID, int nStateID, LPCRECT pContentRect, LPRECT pExtentRect) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect); + } + + HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize); + } + + HRESULT GetThemeTextExtent(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, LPCRECT pBoundingRect, LPRECT pExtentRect) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeTextExtent(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, pBoundingRect, pExtentRect); + } + + HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const + { + ATLASSERT(m_hTheme != NULL); +#ifdef _WTL_NEW_UXTHEME + return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric); +#else // !_WTL_NEW_UXTHEME + // Note: The cast to PTEXTMETRIC is because uxtheme.h incorrectly uses it instead of PTEXTMETRICW + return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, (PTEXTMETRIC)pTextMetric); +#endif // !_WTL_NEW_UXTHEME + } + + HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeBackgroundRegion(m_hTheme, hDC, nPartID, nStateID, pRect, pRegion); + } + + HRESULT HitTestThemeBackground(HDC hDC, int nPartID, int nStateID, DWORD dwOptions, LPCRECT pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) const + { + ATLASSERT(m_hTheme != NULL); + return ::HitTestThemeBackground(m_hTheme, hDC, nPartID, nStateID, dwOptions, pRect, hrgn, ptTest, pwHitTestCode); + } + + HRESULT DrawThemeEdge(HDC hDC, int nPartID, int nStateID, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect = NULL) + { + ATLASSERT(m_hTheme != NULL); + return ::DrawThemeEdge(m_hTheme, hDC, nPartID, nStateID, pDestRect, uEdge, uFlags, pContentRect); + } + + HRESULT DrawThemeIcon(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HIMAGELIST himl, int nImageIndex) + { + ATLASSERT(m_hTheme != NULL); + return ::DrawThemeIcon(m_hTheme, hDC, nPartID, nStateID, pRect, himl, nImageIndex); + } + + BOOL IsThemePartDefined(int nPartID, int nStateID) const + { + ATLASSERT(m_hTheme != NULL); + return ::IsThemePartDefined(m_hTheme, nPartID, nStateID); + } + + BOOL IsThemeBackgroundPartiallyTransparent(int nPartID, int nStateID) const + { + ATLASSERT(m_hTheme != NULL); + return ::IsThemeBackgroundPartiallyTransparent(m_hTheme, nPartID, nStateID); + } + + HRESULT GetThemeColor(int nPartID, int nStateID, int nPropID, COLORREF* pColor) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeColor(m_hTheme, nPartID, nStateID, nPropID, pColor); + } + + HRESULT GetThemeMetric(HDC hDC, int nPartID, int nStateID, int nPropID, int* pnVal) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeMetric(m_hTheme, hDC, nPartID, nStateID, nPropID, pnVal); + } + + HRESULT GetThemeString(int nPartID, int nStateID, int nPropID, LPWSTR pszBuff, int cchMaxBuffChars) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeString(m_hTheme, nPartID, nStateID, nPropID, pszBuff, cchMaxBuffChars); + } + + HRESULT GetThemeBool(int nPartID, int nStateID, int nPropID, BOOL* pfVal) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeBool(m_hTheme, nPartID, nStateID, nPropID, pfVal); + } + + HRESULT GetThemeInt(int nPartID, int nStateID, int nPropID, int* pnVal) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeInt(m_hTheme, nPartID, nStateID, nPropID, pnVal); + } + + HRESULT GetThemeEnumValue(int nPartID, int nStateID, int nPropID, int* pnVal) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeEnumValue(m_hTheme, nPartID, nStateID, nPropID, pnVal); + } + + HRESULT GetThemePosition(int nPartID, int nStateID, int nPropID, LPPOINT pPoint) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemePosition(m_hTheme, nPartID, nStateID, nPropID, pPoint); + } + + // deprecated + HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const + { + ATLASSERT(m_hTheme != NULL); +#ifdef _WTL_NEW_UXTHEME + return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); +#else // !_WTL_NEW_UXTHEME + // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* + return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); +#endif // !_WTL_NEW_UXTHEME + } + + HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const + { + ATLASSERT(m_hTheme != NULL); +#ifdef _WTL_NEW_UXTHEME + return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); +#else // !_WTL_NEW_UXTHEME + // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* + return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); +#endif // !_WTL_NEW_UXTHEME + } + + HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeRect(m_hTheme, nPartID, nStateID, nPropID, pRect); + } + + HRESULT GetThemeMargins(HDC hDC, int nPartID, int nStateID, int nPropID, LPRECT pRect, PMARGINS pMargins) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeMargins(m_hTheme, hDC, nPartID, nStateID, nPropID, pRect, pMargins); + } + + HRESULT GetThemeIntList(int nPartID, int nStateID, int nPropID, INTLIST* pIntList) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeIntList(m_hTheme, nPartID, nStateID, nPropID, pIntList); + } + + HRESULT GetThemePropertyOrigin(int nPartID, int nStateID, int nPropID, enum PROPERTYORIGIN* pOrigin) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemePropertyOrigin(m_hTheme, nPartID, nStateID, nPropID, pOrigin); + } + + HRESULT GetThemeFilename(int nPartID, int nStateID, int nPropID, LPWSTR pszThemeFileName, int cchMaxBuffChars) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeFilename(m_hTheme, nPartID, nStateID, nPropID, pszThemeFileName, cchMaxBuffChars); + } + + COLORREF GetThemeSysColor(int nColorID) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeSysColor(m_hTheme, nColorID); + } + + HBRUSH GetThemeSysColorBrush(int nColorID) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeSysColorBrush(m_hTheme, nColorID); + } + + int GetThemeSysSize(int nSizeID) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeSysSize(m_hTheme, nSizeID); + } + + BOOL GetThemeSysBool(int nBoolID) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeSysBool(m_hTheme, nBoolID); + } + + HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const + { + ATLASSERT(m_hTheme != NULL); +#ifdef _WTL_NEW_UXTHEME + return ::GetThemeSysFont(m_hTheme, nFontID, plf); +#else // !_WTL_NEW_UXTHEME + // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* + return ::GetThemeSysFont(m_hTheme, nFontID, (LOGFONT*)plf); +#endif // !_WTL_NEW_UXTHEME + } + + HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeSysString(m_hTheme, nStringID, pszStringBuff, cchMaxStringChars); + } + + HRESULT GetThemeSysInt(int nIntID, int* pnValue) const + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeSysInt(m_hTheme, nIntID, pnValue); + } + +#ifdef _WTL_NEW_UXTHEME + HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags) + { + if(!IsThemingSupported()) + return NULL; + + ATLASSERT(m_hTheme == NULL); + m_hTheme = ::OpenThemeDataEx(hWnd, pszClassList, dwFlags); + return m_hTheme; + } + + HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions) + { + ATLASSERT(m_hTheme != NULL); + return ::DrawThemeTextEx(m_hTheme, hDC, nPartID, nStateID, pszText, cchText, dwTextFlags, lpRect, pOptions); + } + + HRESULT GetThemeTransitionDuration(int nPartID, int nFromStateID, int nToStateID, int nPropID, DWORD& dwDuration) + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration); + } +#endif // _WTL_NEW_UXTHEME + +#if (_WIN32_WINNT >= 0x0600) + HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap) + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeBitmap(m_hTheme, nPartID, nStateID, nPropID, uFlags, &hBitmap); + } + + HRESULT GetThemeStream(int nPartID, int nStateID, int nPropID, VOID** ppvStream, DWORD* pcbStream, HINSTANCE hInstance) + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance); + } +#endif // (_WIN32_WINNT >= 0x0600) +}; + +__declspec(selectany) int CTheme::m_nIsThemingSupported = -1; + + +/////////////////////////////////////////////////////////////////////////////// +// CThemeImpl - theme support implementation + +// Derive from this class to implement window with theme support. +// Example: +// class CMyThemeWindow : public CWindowImpl, public CThemeImpl +// { +// ... +// BEGIN_MSG_MAP(CMyThemeWindow) +// CHAIN_MSG_MAP(CThemeImpl) +// ... +// END_MSG_MAP() +// ... +// }; +// +// If you set theme class list, the class will automaticaly open/close/reopen theme data. + + +// Helper for drawing theme client edge +inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = NULL, HBRUSH hBrush = NULL, int nPartID = 0, int nStateID = 0) +{ + ATLASSERT(hTheme != NULL); + ATLASSERT(::IsWindow(hWnd)); + + CWindowDC dc(hWnd); + if(dc.IsNull()) + return false; + + // Get border size + int cxBorder = GetSystemMetrics(SM_CXBORDER); + int cyBorder = GetSystemMetrics(SM_CYBORDER); + if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder))) + cyBorder = cxBorder; + + RECT rect; + ::GetWindowRect(hWnd, &rect); + + // Remove the client edge from the update region + int cxEdge = GetSystemMetrics(SM_CXEDGE); + int cyEdge = GetSystemMetrics(SM_CYEDGE); + ::InflateRect(&rect, -cxEdge, -cyEdge); + CRgn rgn; + rgn.CreateRectRgnIndirect(&rect); + if(rgn.IsNull()) + return false; + + if(hRgnUpdate != NULL) + rgn.CombineRgn(hRgnUpdate, rgn, RGN_AND); + + ::OffsetRect(&rect, -rect.left, -rect.top); + + ::OffsetRect(&rect, cxEdge, cyEdge); + dc.ExcludeClipRect(&rect); + ::InflateRect(&rect, cxEdge, cyEdge); + + ::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL); + + // Use background brush too, since theme border might not cover everything + if(cxBorder < cxEdge && cyBorder < cyEdge) + { + if(hBrush == NULL) +// need conditional code because types don't match in winuser.h +#ifdef _WIN64 + hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND); +#else + hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND)); +#endif + + ::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge); + dc.FillRect(&rect, hBrush); + } + + ::DefWindowProc(hWnd, WM_NCPAINT, (WPARAM)rgn.m_hRgn, 0L); + + return true; +} + + +// Theme extended styles +#define THEME_EX_3DCLIENTEDGE 0x00000001 +#define THEME_EX_THEMECLIENTEDGE 0x00000002 + +template +class CThemeImpl : public TBase +{ +public: +// Data members + LPWSTR m_lpstrThemeClassList; + DWORD m_dwExtendedStyle; // theme specific extended styles + +// Constructor & destructor + CThemeImpl() : m_lpstrThemeClassList(NULL), m_dwExtendedStyle(0) + { } + + ~CThemeImpl() + { + delete [] m_lpstrThemeClassList; + } + +// Attributes + bool SetThemeClassList(LPCWSTR lpstrThemeClassList) + { + if(m_lpstrThemeClassList != NULL) + { + delete [] m_lpstrThemeClassList; + m_lpstrThemeClassList = NULL; + } + + if(lpstrThemeClassList == NULL) + return true; + + int cchLen = lstrlenW(lpstrThemeClassList) + 1; + ATLTRY(m_lpstrThemeClassList = new WCHAR[cchLen]); + if(m_lpstrThemeClassList == NULL) + return false; + + SecureHelper::strcpyW_x(m_lpstrThemeClassList, cchLen, lpstrThemeClassList); + + return true; + } + + bool GetThemeClassList(LPWSTR lpstrThemeClassList, int cchListBuffer) const + { + int cchLen = lstrlenW(m_lpstrThemeClassList) + 1; + if(cchListBuffer < cchLen) + return false; + + SecureHelper::strcpyW_x(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList); + + return true; + } + + LPCWSTR GetThemeClassList() const + { + return m_lpstrThemeClassList; + } + + DWORD SetThemeExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) + { + DWORD dwPrevStyle = m_dwExtendedStyle; + if(dwMask == 0) + m_dwExtendedStyle = dwExtendedStyle; + else + m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + return dwPrevStyle; + } + + DWORD GetThemeExtendedStyle() const + { + return m_dwExtendedStyle; + } + +// Operations + HTHEME OpenThemeData() + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + ATLASSERT(m_lpstrThemeClassList != NULL); + if(m_lpstrThemeClassList == NULL) + return NULL; + CloseThemeData(); + return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList); + } + + HTHEME OpenThemeData(LPCWSTR pszClassList) + { + if(!SetThemeClassList(pszClassList)) + return NULL; + return OpenThemeData(); + } + + HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList) + { + if(!IsThemingSupported()) + return S_FALSE; + + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::SetWindowTheme(pT->m_hWnd, pszSubAppName, pszSubIDList); + } + + HTHEME GetWindowTheme() const + { + if(!IsThemingSupported()) + return NULL; + + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::GetWindowTheme(pT->m_hWnd); + } + + HRESULT EnableThemeDialogTexture(DWORD dwFlags) + { + if(!IsThemingSupported()) + return S_FALSE; + + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::EnableThemeDialogTexture(pT->m_hWnd, dwFlags); + } + + BOOL IsThemeDialogTextureEnabled() const + { + if(!IsThemingSupported()) + return FALSE; + + const T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::IsThemeDialogTextureEnabled(pT->m_hWnd); + } + + HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL) + { + if(!IsThemingSupported()) + return S_FALSE; + + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); +#ifdef _WTL_NEW_UXTHEME + return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect); +#else + return ::DrawThemeParentBackground(pT->m_hWnd, hDC, (RECT*)pRect); +#endif + } + +#ifdef _WTL_NEW_UXTHEME + HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute) + { + if(!IsThemingSupported()) + return S_FALSE; + + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::SetWindowThemeAttribute(pT->m_hWnd, type, pvAttribute, cbAttribute); + } + + HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask) + { + if(!IsThemingSupported()) + return S_FALSE; + + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + WTA_OPTIONS opt = { dwAttributes, dwMask }; + return ::SetWindowThemeAttribute(pT->m_hWnd, WTA_NONCLIENT, (PVOID)&opt, sizeof(opt)); + } + + HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL) + { + if(!IsThemingSupported()) + return S_FALSE; + + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect); + } +#endif // _WTL_NEW_UXTHEME + +// Message map and handlers + // Note: If you handle any of these messages in your derived class, + // it is better to put CHAIN_MSG_MAP at the start of your message map. + BEGIN_MSG_MAP(CThemeImpl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) + MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) + END_MSG_MAP() + + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_lpstrThemeClassList != NULL) + OpenThemeData(); + bHandled = FALSE; + return 1; + } + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + CloseThemeData(); + bHandled = FALSE; + return 1; + } + + LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + CloseThemeData(); + if(m_lpstrThemeClassList != NULL) + OpenThemeData(); + bHandled = FALSE; + return 1; + } + + LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + LRESULT lRet = 0; + bHandled = FALSE; + if(IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)) + { + if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0) + { + lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam); + bHandled = TRUE; + } + else if((m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0)) + { + HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL; + if(pT->DrawThemeClientEdge(hRgn)) + bHandled = TRUE; + } + } + return lRet; + } + +// Drawing helper + bool DrawThemeClientEdge(HRGN hRgnUpdate) + { + T* pT = static_cast(this); + return AtlDrawThemeClientEdge(m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// Buffered Paint and Animation + +#ifdef _WTL_NEW_UXTHEME + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedPaintBase - Buffered Paint support for othe classes + +class CBufferedPaintBase +{ +public: + static int m_nIsBufferedPaintSupported; + + CBufferedPaintBase() + { + if(IsBufferedPaintSupported()) + ATLVERIFY(SUCCEEDED(::BufferedPaintInit())); + } + + ~CBufferedPaintBase() + { + if(IsBufferedPaintSupported()) + ATLVERIFY(SUCCEEDED(::BufferedPaintUnInit())); + } + + static bool IsBufferedPaintSupported() + { + if(m_nIsBufferedPaintSupported == -1) + { + CStaticDataInitCriticalSectionLock lock; + if(FAILED(lock.Lock())) + { + ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CBufferedPaintBase::IsBufferedPaintSupported.\n")); + ATLASSERT(FALSE); + return false; + } + + if(m_nIsBufferedPaintSupported == -1) + m_nIsBufferedPaintSupported = RunTimeHelper::IsVista() ? 1 : 0; + + lock.Unlock(); + } + + ATLASSERT(m_nIsBufferedPaintSupported != -1); + return (m_nIsBufferedPaintSupported == 1); + } +}; + +__declspec(selectany) int CBufferedPaintBase::m_nIsBufferedPaintSupported = -1; + + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedPaint - support for buffered paint functions + +class CBufferedPaint +{ +public: + HPAINTBUFFER m_hPaintBuffer; + + CBufferedPaint() : m_hPaintBuffer(NULL) + { } + + ~CBufferedPaint() + { + ATLVERIFY(SUCCEEDED(End())); + } + + bool IsNull() const + { + return (m_hPaintBuffer == NULL); + } + + HPAINTBUFFER Begin(HDC hdcTarget, const RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, HDC* phdcPaint) + { + ATLASSERT(m_hPaintBuffer == NULL); + m_hPaintBuffer = ::BeginBufferedPaint(hdcTarget, prcTarget, dwFormat, pPaintParams, phdcPaint); + return m_hPaintBuffer; + } + + HRESULT End(BOOL bUpdate = TRUE) + { + HRESULT hRet = S_FALSE; + if(m_hPaintBuffer != NULL) + { + hRet = ::EndBufferedPaint(m_hPaintBuffer, bUpdate); + m_hPaintBuffer = NULL; + } + return hRet; + } + + HRESULT GetTargetRect(LPRECT pRect) const + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::GetBufferedPaintTargetRect(m_hPaintBuffer, pRect); + } + + HDC GetTargetDC() const + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::GetBufferedPaintTargetDC(m_hPaintBuffer); + } + + HDC GetPaintDC() const + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::GetBufferedPaintDC(m_hPaintBuffer); + } + + HRESULT GetBits(RGBQUAD** ppbBuffer, int* pcxRow) const + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::GetBufferedPaintBits(m_hPaintBuffer, ppbBuffer, pcxRow); + } + + HRESULT Clear(const RECT* pRect = NULL) + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::BufferedPaintClear(m_hPaintBuffer, pRect); + } + + HRESULT SetAlpha(BYTE alpha, const RECT* pRect = NULL) + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, alpha); + } + + HRESULT MakeOpaque(const RECT* pRect = NULL) + { + ATLASSERT(m_hPaintBuffer != NULL); + return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, 255); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedPaintImpl - provides buffered paint for any window + +template +class ATL_NO_VTABLE CBufferedPaintImpl : public CBufferedPaintBase +{ +public: + CBufferedPaint m_BufferedPaint; + BP_BUFFERFORMAT m_dwFormat; + BP_PAINTPARAMS m_PaintParams; + + CBufferedPaintImpl() : m_dwFormat(BPBF_TOPDOWNDIB) + { + memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); + m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); + } + +// Message map and handlers + BEGIN_MSG_MAP(CBufferedPaintImpl) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + END_MSG_MAP() + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background needed + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + if(wParam != NULL) + { + RECT rect = { 0 }; + pT->GetClientRect(&rect); + pT->DoPaint((HDC)wParam, rect); + } + else + { + CPaintDC dc(pT->m_hWnd); + pT->DoBufferedPaint(dc.m_hDC, dc.m_ps.rcPaint); + } + + return 0; + } + +// Overrideables + void DoBufferedPaint(CDCHandle dc, RECT& rect) + { + HDC hDCPaint = NULL; + if(IsBufferedPaintSupported()) + m_BufferedPaint.Begin(dc, &rect, m_dwFormat, &m_PaintParams, &hDCPaint); + + T* pT = static_cast(this); + if(hDCPaint != NULL) + pT->DoPaint(hDCPaint, rect); + else + pT->DoPaint(dc.m_hDC, rect); + + if(IsBufferedPaintSupported()) + m_BufferedPaint.End(); + } + + void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/) + { + // must be implemented in a derived class + ATLASSERT(FALSE); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedPaintWindowImpl - implements a window that uses buffered paint + +template +class ATL_NO_VTABLE CBufferedPaintWindowImpl : + public ATL::CWindowImpl, + public CBufferedPaintImpl< T > +{ +public: + BEGIN_MSG_MAP(CBufferedPaintWindowImpl) + CHAIN_MSG_MAP(CBufferedPaintImpl< T >) + END_MSG_MAP() +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedAnimation - support for buffered animation + +class CBufferedAnimation +{ +public: + HANIMATIONBUFFER m_hAnimationBuffer; + + CBufferedAnimation() : m_hAnimationBuffer(NULL) + { } + + ~CBufferedAnimation() + { + ATLVERIFY(SUCCEEDED(End())); + } + + bool IsNull() const + { + return (m_hAnimationBuffer == NULL); + } + + HANIMATIONBUFFER Begin(HWND hWnd, HDC hDCTarget, const RECT* pRectTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, BP_ANIMATIONPARAMS* pAnimationParams, HDC* phdcFrom, HDC* phdcTo) + { + ATLASSERT(m_hAnimationBuffer == NULL); + m_hAnimationBuffer = ::BeginBufferedAnimation(hWnd, hDCTarget, pRectTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo); + return m_hAnimationBuffer; + } + + HRESULT End(BOOL bUpdate = TRUE) + { + HRESULT hRet = S_FALSE; + if(m_hAnimationBuffer != NULL) + { + hRet = ::EndBufferedAnimation(m_hAnimationBuffer, bUpdate); + m_hAnimationBuffer = NULL; + } + return hRet; + } + + static bool IsRendering(HWND hWnd, HDC hDC) + { + return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedAnimationImpl - provides buffered animation support for any window + +// Note: You can either use m_State and m_NewState to store the state information +// for the animation change, or map your state to those data members. DoPaint() +// should only rely on the state information that is passed to it. + +template +class ATL_NO_VTABLE CBufferedAnimationImpl : public CBufferedPaintBase +{ +public: + BP_BUFFERFORMAT m_dwFormat; + BP_PAINTPARAMS m_PaintParams; + BP_ANIMATIONPARAMS m_AnimationParams; + + TState m_State; + TState m_NewState; + + CBufferedAnimationImpl(TState InitialState) : m_dwFormat(BPBF_TOPDOWNDIB) + { + memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); + m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); + + memset(&m_AnimationParams, 0, sizeof(BP_ANIMATIONPARAMS)); + m_AnimationParams.cbSize = sizeof(BP_ANIMATIONPARAMS); + m_AnimationParams.style = BPAS_LINEAR; + m_AnimationParams.dwDuration = 500; + + T* pT = static_cast(this); + pT->SetState(InitialState); + pT->SetNewState(InitialState); + } + + DWORD GetDuration() const + { + return m_AnimationParams.dwDuration; + } + + void SetDuration(DWORD dwDuration) + { + m_AnimationParams.dwDuration = dwDuration; + } + + void DoAnimation(TState NewState, const RECT* pRect = NULL) + { + T* pT = static_cast(this); + pT->SetNewState(NewState); + + pT->InvalidateRect(pRect, FALSE); + pT->UpdateWindow(); + + pT->SetState(NewState); + } + +// Message map and handlers + BEGIN_MSG_MAP(CBufferedAnimationImpl) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) + END_MSG_MAP() + + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + return 1; // no background needed + } + + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + if(wParam != NULL) + { + RECT rect = { 0 }; + pT->GetClientRect(&rect); + pT->DoPaint((HDC)wParam, rect, m_NewState); + } + else + { + CPaintDC dc(pT->m_hWnd); + pT->DoAnimationPaint(dc.m_hDC, dc.m_ps.rcPaint); + } + + return 0; + } + +// Overrideables + void SetState(TState State) + { + m_State = State; + } + + void SetNewState(TState State) + { + m_NewState = State; + } + + bool AreStatesEqual() const + { + return (m_State == m_NewState); + } + + void DoAnimationPaint(CDCHandle dc, RECT& rect) + { + T* pT = static_cast(this); + if(IsBufferedPaintSupported() && CBufferedAnimation::IsRendering(pT->m_hWnd, dc)) + return; + + DWORD dwDurationSave = m_AnimationParams.dwDuration; + if(pT->AreStatesEqual()) + m_AnimationParams.dwDuration = 0; + + HDC hdcFrom = NULL, hdcTo = NULL; + CBufferedAnimation ba; + if(IsBufferedPaintSupported()) + ba.Begin(pT->m_hWnd, dc, &rect, m_dwFormat, &m_PaintParams, &m_AnimationParams, &hdcFrom, &hdcTo); + + if(!ba.IsNull()) + { + if(hdcFrom != NULL) + pT->DoPaint(hdcFrom, rect, m_State); + + if (hdcTo != NULL) + pT->DoPaint(hdcTo, rect, m_NewState); + } + else + { + pT->DoPaint(dc.m_hDC, rect, m_NewState); + } + + m_AnimationParams.dwDuration = dwDurationSave; + } + + void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/, TState /*State*/) + { + // must be implemented in a derived class + ATLASSERT(FALSE); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CBufferedAnimationWindowImpl - implements a window that uses buffered animation + +template +class ATL_NO_VTABLE CBufferedAnimationWindowImpl : + public ATL::CWindowImpl, + public CBufferedAnimationImpl< T, TState > +{ +public: + CBufferedAnimationWindowImpl(TState InitialState) : CBufferedAnimationImpl< T, TState >(InitialState) + { } + + typedef CBufferedAnimationImpl< T, TState > _baseBufferedAnimation; + BEGIN_MSG_MAP(CBufferedAnimationWindowImpl) + CHAIN_MSG_MAP(_baseBufferedAnimation) + END_MSG_MAP() +}; + +#endif // _WTL_NEW_UXTHEME + +}; // namespace WTL + +#endif // __ATLTHEME_H__ diff --git a/Externals/WTL80/atluser.h b/Externals/WTL80/atluser.h index 6570b8bbec..4a269b1c68 100644 --- a/Externals/WTL80/atluser.h +++ b/Externals/WTL80/atluser.h @@ -1,1162 +1,1162 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLUSER_H__ -#define __ATLUSER_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atluser.h requires atlapp.h to be included first -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CMenuItemInfo -// CMenuT -// CAcceleratorT -// CIconT -// CCursorT -// CResource -// -// Global functions: -// AtlMessageBox() - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// AtlMessageBox - accepts both memory and resource based strings - -inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION) -{ - ATLASSERT(hWndOwner == NULL || ::IsWindow(hWndOwner)); - - LPTSTR lpstrMessage = NULL; - if(IS_INTRESOURCE(message.m_lpstr)) - { - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrMessage = new TCHAR[nLen]); - if(lpstrMessage == NULL) - { - ATLASSERT(FALSE); - return 0; - } - int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(message.m_lpstr), lpstrMessage, nLen); - if(nRes < nLen - 1) - break; - delete [] lpstrMessage; - lpstrMessage = NULL; - } - - message.m_lpstr = lpstrMessage; - } - - LPTSTR lpstrTitle = NULL; - if(IS_INTRESOURCE(title.m_lpstr) && LOWORD(title.m_lpstr) != 0) - { - for(int nLen = 256; ; nLen *= 2) - { - ATLTRY(lpstrTitle = new TCHAR[nLen]); - if(lpstrTitle == NULL) - { - ATLASSERT(FALSE); - return 0; - } - int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(title.m_lpstr), lpstrTitle, nLen); - if(nRes < nLen - 1) - break; - delete [] lpstrTitle; - lpstrTitle = NULL; - } - - title.m_lpstr = lpstrTitle; - } - - int nRet = ::MessageBox(hWndOwner, message.m_lpstr, title.m_lpstr, uType); - - delete [] lpstrMessage; - delete [] lpstrTitle; - - return nRet; -} - - -/////////////////////////////////////////////////////////////////////////////// -// CMenu - -#if (WINVER >= 0x0500) - #ifndef MII_SIZEOF_STRUCT - #define MII_SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) - #endif - #define MENUITEMINFO_SIZE_VERSION_400A MII_SIZEOF_STRUCT(MENUITEMINFOA, cch) - #define MENUITEMINFO_SIZE_VERSION_400W MII_SIZEOF_STRUCT(MENUITEMINFOW, cch) - #ifdef UNICODE - #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400W - #else - #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400A - #endif // !UNICODE -#endif // (WINVER >= 0x0500) - -class CMenuItemInfo : public MENUITEMINFO -{ -public: - CMenuItemInfo() - { - memset(this, 0, sizeof(MENUITEMINFO)); - cbSize = sizeof(MENUITEMINFO); -#if (WINVER >= 0x0500) - // adjust struct size if running on older version of Windows - if(AtlIsOldWindows()) - { - ATLASSERT(cbSize > MENUITEMINFO_SIZE_VERSION_400); // must be - cbSize = MENUITEMINFO_SIZE_VERSION_400; - } -#endif // (WINVER >= 0x0500) - } -}; - - -// forward declarations -template class CMenuT; -typedef CMenuT CMenuHandle; -typedef CMenuT CMenu; - - -template -class CMenuT -{ -public: -// Data members - HMENU m_hMenu; - -// Constructor/destructor/operators - CMenuT(HMENU hMenu = NULL) : m_hMenu(hMenu) - { } - - ~CMenuT() - { - if(t_bManaged && m_hMenu != NULL) - DestroyMenu(); - } - - CMenuT& operator =(HMENU hMenu) - { - Attach(hMenu); - return *this; - } - - void Attach(HMENU hMenuNew) - { - ATLASSERT(::IsMenu(hMenuNew)); - if(t_bManaged && m_hMenu != NULL && m_hMenu != hMenuNew) - ::DestroyMenu(m_hMenu); - m_hMenu = hMenuNew; - } - - HMENU Detach() - { - HMENU hMenu = m_hMenu; - m_hMenu = NULL; - return hMenu; - } - - operator HMENU() const { return m_hMenu; } - - bool IsNull() const { return (m_hMenu == NULL); } - - BOOL IsMenu() const - { - return ::IsMenu(m_hMenu); - } - -// Create/destroy methods - BOOL CreateMenu() - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::CreateMenu(); - return (m_hMenu != NULL) ? TRUE : FALSE; - } - - BOOL CreatePopupMenu() - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::CreatePopupMenu(); - return (m_hMenu != NULL) ? TRUE : FALSE; - } - - BOOL LoadMenu(ATL::_U_STRINGorID menu) - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); - return (m_hMenu != NULL) ? TRUE : FALSE; - } - -#ifndef _WIN32_WCE - BOOL LoadMenuIndirect(const void* lpMenuTemplate) - { - ATLASSERT(m_hMenu == NULL); - m_hMenu = ::LoadMenuIndirect(lpMenuTemplate); - return (m_hMenu != NULL) ? TRUE : FALSE; - } -#endif // !_WIN32_WCE - - BOOL DestroyMenu() - { - if (m_hMenu == NULL) - return FALSE; - BOOL bRet = ::DestroyMenu(m_hMenu); - if(bRet) - m_hMenu = NULL; - return bRet; - } - -// Menu Operations - BOOL DeleteMenu(UINT nPosition, UINT nFlags) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::DeleteMenu(m_hMenu, nPosition, nFlags); - } - - BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); -#ifndef _WIN32_WCE -#if (WINVER >= 0x0500) - x = _FixTrackMenuPopupX(x, y); -#endif // !(WINVER >= 0x0500) - return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect); -#else // CE specific - lpRect; - return ::TrackPopupMenuEx(m_hMenu, nFlags, x, y, hWnd, NULL); -#endif // _WIN32_WCE - } - - BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - x = _FixTrackMenuPopupX(x, y); -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm); - } - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - // helper that fixes popup menu X position when it's off-screen - static int _FixTrackMenuPopupX(int x, int y) - { - POINT pt = { x, y }; - HMONITOR hMonitor = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); - if(hMonitor == NULL) - { - HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); - if(hMonitorNear != NULL) - { - MONITORINFO mi = { 0 }; - mi.cbSize = sizeof(MONITORINFO); - if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE) - { - if(x < mi.rcWork.left) - x = mi.rcWork.left; - else if(x > mi.rcWork.right) - x = mi.rcWork.right; - } - } - } - - return x; - } - - BOOL GetMenuInfo(LPMENUINFO lpMenuInfo) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuInfo(m_hMenu, lpMenuInfo); - } - - BOOL SetMenuInfo(LPCMENUINFO lpMenuInfo) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuInfo(m_hMenu, lpMenuInfo); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - -// Menu Item Operations - BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, lpszNewItem); - } - - BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); - } - -#ifndef _WIN32_WCE - BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::AppendMenu(m_hMenu, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); - } - - BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); - } -#endif // !_WIN32_WCE - - UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck) - { - ATLASSERT(::IsMenu(m_hMenu)); - return (UINT)::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); - } - - UINT EnableMenuItem(UINT nIDEnableItem, UINT nEnable) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); - } - -#ifndef _WIN32_WCE - BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::HiliteMenuItem(hWnd, m_hMenu, uIDHiliteItem, uHilite); - } - - int GetMenuItemCount() const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuItemCount(m_hMenu); - } - - UINT GetMenuItemID(int nPos) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuItemID(m_hMenu, nPos); - } - - UINT GetMenuState(UINT nID, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuState(m_hMenu, nID, nFlags); - } - - int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); - } - - int GetMenuStringLen(UINT nIDItem, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); - } - -#ifndef _ATL_NO_COM - BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const - { - USES_CONVERSION; - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(bstrText == NULL); - - int nLen = GetMenuStringLen(nIDItem, nFlags); - if(nLen == 0) - { - bstrText = ::SysAllocString(OLESTR("")); - return (bstrText != NULL) ? TRUE : FALSE; - } - - nLen++; // increment to include terminating NULL char - CTempBuffer buff; - LPTSTR lpszText = buff.Allocate(nLen); - if(lpszText == NULL) - return FALSE; - - if(!GetMenuString(nIDItem, lpszText, nLen, nFlags)) - return FALSE; - - bstrText = ::SysAllocString(T2OLE(lpszText)); - return (bstrText != NULL) ? TRUE : FALSE; - } -#endif // !_ATL_NO_COM -#endif // !_WIN32_WCE - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetMenuString(UINT nIDItem, _CSTRING_NS::CString& strText, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - - int nLen = GetMenuStringLen(nIDItem, nFlags); - if(nLen == 0) - return 0; - - nLen++; // increment to include terminating NULL char - LPTSTR lpstr = strText.GetBufferSetLength(nLen); - if(lpstr == NULL) - return 0; - int nRet = GetMenuString(nIDItem, lpstr, nLen, nFlags); - strText.ReleaseBuffer(); - return nRet; - } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - CMenuHandle GetSubMenu(int nPos) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return CMenuHandle(::GetSubMenu(m_hMenu, nPos)); - } - - BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); - } - - BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); - } - -#ifndef _WIN32_WCE - BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); - } - - BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::InsertMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); - } - - BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) - { - ATLASSERT(::IsMenu(m_hMenu)); - ATLASSERT(::IsMenu(hSubMenu)); - return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); - } -#endif // !_WIN32_WCE - - BOOL RemoveMenu(UINT nPosition, UINT nFlags) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::RemoveMenu(m_hMenu, nPosition, nFlags); - } - -#ifndef _WIN32_WCE - BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked); - } -#endif // !_WIN32_WCE - - BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::CheckMenuRadioItem(m_hMenu, nIDFirst, nIDLast, nIDItem, nFlags); - } - - BOOL GetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return (BOOL)::GetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); - } - - BOOL SetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) - { - ATLASSERT(::IsMenu(m_hMenu)); - return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); - } - -#ifndef _WIN32_WCE - BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) - { - ATLASSERT(::IsMenu(m_hMenu)); - return (BOOL)::InsertMenuItem(m_hMenu, uItem, bByPosition, lpmii); - } - - UINT GetMenuDefaultItem(BOOL bByPosition = FALSE, UINT uFlags = 0U) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuDefaultItem(m_hMenu, (UINT)bByPosition, uFlags); - } - - BOOL SetMenuDefaultItem(UINT uItem = (UINT)-1, BOOL bByPosition = FALSE) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuDefaultItem(m_hMenu, uItem, (UINT)bByPosition); - } - - BOOL GetMenuItemRect(HWND hWnd, UINT uItem, LPRECT lprcItem) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuItemRect(hWnd, m_hMenu, uItem, lprcItem); - } - - int MenuItemFromPoint(HWND hWnd, POINT point) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::MenuItemFromPoint(hWnd, m_hMenu, point); - } - -// Context Help Functions - BOOL SetMenuContextHelpId(DWORD dwContextHelpId) - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::SetMenuContextHelpId(m_hMenu, dwContextHelpId); - } - - DWORD GetMenuContextHelpId() const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ::GetMenuContextHelpId(m_hMenu); - } -#endif // !_WIN32_WCE -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAccelerator - -template -class CAcceleratorT -{ -public: - HACCEL m_hAccel; - -// Constructor/destructor/operators - CAcceleratorT(HACCEL hAccel = NULL) : m_hAccel(hAccel) - { } - - ~CAcceleratorT() - { - if(t_bManaged && m_hAccel != NULL) - ::DestroyAcceleratorTable(m_hAccel); - } - - CAcceleratorT& operator =(HACCEL hAccel) - { - Attach(hAccel); - return *this; - } - - void Attach(HACCEL hAccel) - { - if(t_bManaged && m_hAccel != NULL) - ::DestroyAcceleratorTable(m_hAccel); - m_hAccel = hAccel; - } - - HACCEL Detach() - { - HACCEL hAccel = m_hAccel; - m_hAccel = NULL; - return hAccel; - } - - operator HACCEL() const { return m_hAccel; } - - bool IsNull() const { return m_hAccel == NULL; } - -// Create/destroy methods - HACCEL LoadAccelerators(ATL::_U_STRINGorID accel) - { - ATLASSERT(m_hAccel == NULL); - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), accel.m_lpstr); - return m_hAccel; - } - - HACCEL CreateAcceleratorTable(LPACCEL pAccel, int cEntries) - { - ATLASSERT(m_hAccel == NULL); - ATLASSERT(pAccel != NULL); - m_hAccel = ::CreateAcceleratorTable(pAccel, cEntries); - return m_hAccel; - } - - void DestroyObject() - { - if(m_hAccel != NULL) - { - ::DestroyAcceleratorTable(m_hAccel); - m_hAccel = NULL; - } - } - -// Operations -#ifndef _WIN32_WCE - int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries) - { - ATLASSERT(m_hAccel != NULL); - ATLASSERT(lpAccelDst != NULL); - return ::CopyAcceleratorTable(m_hAccel, lpAccelDst, cEntries); - } - - int GetEntriesCount() const - { - ATLASSERT(m_hAccel != NULL); - return ::CopyAcceleratorTable(m_hAccel, NULL, 0); - } -#endif // !_WIN32_WCE - - BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg) - { - ATLASSERT(m_hAccel != NULL); - ATLASSERT(::IsWindow(hWnd)); - ATLASSERT(pMsg != NULL); - return ::TranslateAccelerator(hWnd, m_hAccel, pMsg); - } -}; - -typedef CAcceleratorT CAcceleratorHandle; -typedef CAcceleratorT CAccelerator; - - -/////////////////////////////////////////////////////////////////////////////// -// CIcon - -template -class CIconT -{ -public: - HICON m_hIcon; - -// Constructor/destructor/operators - CIconT(HICON hIcon = NULL) : m_hIcon(hIcon) - { } - - ~CIconT() - { - if(t_bManaged && m_hIcon != NULL) - ::DestroyIcon(m_hIcon); - } - - CIconT& operator =(HICON hIcon) - { - Attach(hIcon); - return *this; - } - - void Attach(HICON hIcon) - { - if(t_bManaged && m_hIcon != NULL) - ::DestroyIcon(m_hIcon); - m_hIcon = hIcon; - } - - HICON Detach() - { - HICON hIcon = m_hIcon; - m_hIcon = NULL; - return hIcon; - } - - operator HICON() const { return m_hIcon; } - - bool IsNull() const { return m_hIcon == NULL; } - -// Create/destroy methods - HICON LoadIcon(ATL::_U_STRINGorID icon) - { - ATLASSERT(m_hIcon == NULL); - m_hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); - return m_hIcon; - } - - HICON LoadIcon(ATL::_U_STRINGorID icon, int cxDesired, int cyDesired, UINT fuLoad = 0) - { - ATLASSERT(m_hIcon == NULL); - m_hIcon = (HICON) ::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); - return m_hIcon; - } - -#ifndef _WIN32_WCE - HICON LoadOEMIcon(LPCTSTR lpstrIconName) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(IsOEMIcon(lpstrIconName)); - m_hIcon = ::LoadIcon(NULL, lpstrIconName); - return m_hIcon; - } - - HICON CreateIcon(int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, CONST BYTE* lpbANDbits, CONST BYTE *lpbXORbits) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(lpbANDbits != NULL); - ATLASSERT(lpbXORbits != NULL); - m_hIcon = ::CreateIcon(ModuleHelper::GetResourceInstance(), nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits); - return m_hIcon; - } - - HICON CreateIconFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(pBits != NULL); - m_hIcon = ::CreateIconFromResource(pBits, dwResSize, TRUE, dwVersion); - return m_hIcon; - } - - HICON CreateIconFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(pbBits != NULL); - ATLASSERT(cbBits > 0); - m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags); - return m_hIcon; - } -#endif // !_WIN32_WCE - - HICON CreateIconIndirect(PICONINFO pIconInfo) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(pIconInfo != NULL); - m_hIcon = ::CreateIconIndirect(pIconInfo); - return m_hIcon; - } - -#ifndef _WIN32_WCE - HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(lpszExeFileName != NULL); - m_hIcon = ::ExtractIcon(ModuleHelper::GetModuleInstance(), lpszExeFileName, nIconIndex); - return m_hIcon; - } - - HICON ExtractAssociatedIcon(HINSTANCE hInst, LPTSTR lpIconPath, LPWORD lpiIcon) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(lpIconPath != NULL); - ATLASSERT(lpiIcon != NULL); - m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon); - return m_hIcon; - } -#endif // !_WIN32_WCE - - BOOL DestroyIcon() - { - ATLASSERT(m_hIcon != NULL); - BOOL bRet = ::DestroyIcon(m_hIcon); - if(bRet != FALSE) - m_hIcon = NULL; - return bRet; - } - -// Operations -#ifndef _WIN32_WCE - HICON CopyIcon() - { - ATLASSERT(m_hIcon != NULL); - return ::CopyIcon(m_hIcon); - } - - HICON DuplicateIcon() - { - ATLASSERT(m_hIcon != NULL); - return ::DuplicateIcon(NULL, m_hIcon); - } -#endif // !_WIN32_WCE - - BOOL DrawIcon(HDC hDC, int x, int y) - { - ATLASSERT(m_hIcon != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(hDC, x, y, m_hIcon); -#else // CE specific - return ::DrawIconEx(hDC, x, y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIcon(HDC hDC, POINT pt) - { - ATLASSERT(m_hIcon != NULL); -#ifndef _WIN32_WCE - return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon); -#else // CE specific - return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE - } - - BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hIcon != NULL); - return ::DrawIconEx(hDC, x, y, m_hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - - BOOL DrawIconEx(HDC hDC, POINT pt, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) - { - ATLASSERT(m_hIcon != NULL); - return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); - } - -#ifndef _WIN32_WCE - BOOL GetIconInfo(PICONINFO pIconInfo) const - { - ATLASSERT(m_hIcon != NULL); - ATLASSERT(pIconInfo != NULL); - return ::GetIconInfo(m_hIcon, pIconInfo); - } - -#if (_WIN32_WINNT >= 0x0600) - BOOL GetIconInfoEx(PICONINFOEX pIconInfo) const - { - ATLASSERT(m_hIcon != NULL); - ATLASSERT(pIconInfo != NULL); - return ::GetIconInfoEx(m_hIcon, pIconInfo); - } -#endif // (_WIN32_WINNT >= 0x0600) - -#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - HRESULT LoadIconMetric(ATL::_U_STRINGorID icon, int lims) - { - ATLASSERT(m_hIcon == NULL); - USES_CONVERSION; - return ::LoadIconMetric(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), lims, &m_hIcon); - } - - HRESULT LoadIconWithScaleDown(ATL::_U_STRINGorID icon, int cx, int cy) - { - ATLASSERT(m_hIcon == NULL); - USES_CONVERSION; - return ::LoadIconWithScaleDown(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), cx, cy, &m_hIcon); - } - - HRESULT LoadOEMIconMetric(LPCTSTR lpstrIconName, int lims) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(IsOEMIcon(lpstrIconName)); - return ::LoadIconMetric(NULL, (LPCWSTR)lpstrIconName, lims, &m_hIcon); - } - - HRESULT LoadOEMIconWithScaleDown(LPCTSTR lpstrIconName, int cx, int cy) - { - ATLASSERT(m_hIcon == NULL); - ATLASSERT(IsOEMIcon(lpstrIconName)); - USES_CONVERSION; - return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon); - } -#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -#endif // !_WIN32_WCE - - // Helper -#ifndef _WIN32_WCE - static bool IsOEMIcon(LPCTSTR lpstrIconName) - { -#if (WINVER >= 0x0600) - return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || - lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO || - lpstrIconName == IDI_SHIELD); -#else // !(WINVER >= 0x0600) - return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || - lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO); -#endif // !(WINVER >= 0x0600) - } -#endif // !_WIN32_WCE -}; - -typedef CIconT CIconHandle; -typedef CIconT CIcon; - - -/////////////////////////////////////////////////////////////////////////////// -// CCursor - -// protect template member from a winuser.h macro -#ifdef CopyCursor - #undef CopyCursor -#endif - -template -class CCursorT -{ -public: - HCURSOR m_hCursor; - -// Constructor/destructor/operators - CCursorT(HCURSOR hCursor = NULL) : m_hCursor(hCursor) - { } - - ~CCursorT() - { - if(t_bManaged && m_hCursor != NULL) - DestroyCursor(); - } - - CCursorT& operator =(HCURSOR hCursor) - { - Attach(hCursor); - return *this; - } - - void Attach(HCURSOR hCursor) - { - if(t_bManaged && m_hCursor != NULL) - DestroyCursor(); - m_hCursor = hCursor; - } - - HCURSOR Detach() - { - HCURSOR hCursor = m_hCursor; - m_hCursor = NULL; - return hCursor; - } - - operator HCURSOR() const { return m_hCursor; } - - bool IsNull() const { return m_hCursor == NULL; } - -// Create/destroy methods - HCURSOR LoadCursor(ATL::_U_STRINGorID cursor) - { - ATLASSERT(m_hCursor == NULL); - m_hCursor = ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); - return m_hCursor; - } - - HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName) - { - ATLASSERT(m_hCursor == NULL); -#if (WINVER >= 0x0500) - ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || - lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || - lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || - lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || - lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP || - lpstrCursorName == IDC_HAND); -#else // !(WINVER >= 0x0500) - ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || - lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || - lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || - lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || - lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP); -#endif // !(WINVER >= 0x0500) - m_hCursor = ::LoadCursor(NULL, lpstrCursorName); - return m_hCursor; - } - - // deprecated - HCURSOR LoadOEMCursor(LPCTSTR lpstrCursorName) - { - return LoadSysCursor(lpstrCursorName); - } - - HCURSOR LoadCursor(ATL::_U_STRINGorID cursor, int cxDesired, int cyDesired, UINT fuLoad = 0) - { - ATLASSERT(m_hCursor == NULL); - m_hCursor = (HCURSOR) ::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); - return m_hCursor; - } - -#ifndef _WIN32_WCE - HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename) - { - ATLASSERT(m_hCursor == NULL); - ATLASSERT(pstrFilename != NULL); - m_hCursor = ::LoadCursorFromFile(pstrFilename); - return m_hCursor; - } -#endif // !_WIN32_WCE - -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane) - { - ATLASSERT(m_hCursor == NULL); - m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane); - return m_hCursor; - } -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - -#ifndef _WIN32_WCE - HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) - { - ATLASSERT(m_hCursor == NULL); - ATLASSERT(pBits != NULL); - m_hCursor = (HCURSOR)::CreateIconFromResource(pBits, dwResSize, FALSE, dwVersion); - return m_hCursor; - } - - HCURSOR CreateCursorFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) - { - ATLASSERT(m_hCursor == NULL); - ATLASSERT(pbBits != NULL); - ATLASSERT(cbBits > 0); - m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags); - return m_hCursor; - } -#endif // !_WIN32_WCE - - BOOL DestroyCursor() - { - ATLASSERT(m_hCursor != NULL); -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) - BOOL bRet = ::DestroyCursor(m_hCursor); - if(bRet != FALSE) - m_hCursor = NULL; - return bRet; -#else // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) - ATLTRACE2(atlTraceUI, 0, _T("Warning: This version of Windows CE does not have ::DestroyCursor()\n")); - return FALSE; -#endif // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) - } - -// Operations -#ifndef _WIN32_WCE - HCURSOR CopyCursor() - { - ATLASSERT(m_hCursor != NULL); - return (HCURSOR)::CopyIcon((HICON)m_hCursor); - } -#endif // !_WIN32_WCE - -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - BOOL GetCursorInfo(LPCURSORINFO pCursorInfo) - { - ATLASSERT(m_hCursor != NULL); - ATLASSERT(pCursorInfo != NULL); - return ::GetCursorInfo(pCursorInfo); - } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) -}; - -typedef CCursorT CCursorHandle; -typedef CCursorT CCursor; - - -/////////////////////////////////////////////////////////////////////////////// -// CResource - Wraps a generic Windows resource. -// Use it with custom resource types other than the -// standard RT_CURSOR, RT_BITMAP, etc. - -class CResource -{ -public: - HGLOBAL m_hGlobal; - HRSRC m_hResource; - -// Constructor/destructor - CResource() : m_hGlobal(NULL), m_hResource(NULL) - { } - - ~CResource() - { - Release(); - } - -// Load methods - bool Load(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID) - { - ATLASSERT(m_hResource == NULL); - ATLASSERT(m_hGlobal == NULL); - - m_hResource = ::FindResource(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr); - if(m_hResource == NULL) - return false; - - m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); - if(m_hGlobal == NULL) - { - m_hResource = NULL; - return false; - } - - return true; - } - -#ifndef _WIN32_WCE - bool LoadEx(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID, WORD wLanguage) - { - ATLASSERT(m_hResource == NULL); - ATLASSERT(m_hGlobal == NULL); - - m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr, wLanguage); - if(m_hResource == NULL) - return false; - - m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); - if(m_hGlobal == NULL) - { - m_hResource = NULL; - return false; - } - - return true; - } -#endif // !_WIN32_WCE - -// Misc. operations - DWORD GetSize() const - { - ATLASSERT(m_hResource != NULL); - return ::SizeofResource(ModuleHelper::GetResourceInstance(), m_hResource); - } - - LPVOID Lock() - { - ATLASSERT(m_hResource != NULL); - ATLASSERT(m_hGlobal != NULL); - LPVOID pVoid = ::LockResource(m_hGlobal); - ATLASSERT(pVoid != NULL); - return pVoid; - } - - void Release() - { - if(m_hGlobal != NULL) - { - FreeResource(m_hGlobal); - m_hGlobal = NULL; - m_hResource = NULL; - } - } -}; - -}; // namespace WTL - -#endif // __ATLUSER_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLUSER_H__ +#define __ATLUSER_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atluser.h requires atlapp.h to be included first +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CMenuItemInfo +// CMenuT +// CAcceleratorT +// CIconT +// CCursorT +// CResource +// +// Global functions: +// AtlMessageBox() + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// AtlMessageBox - accepts both memory and resource based strings + +inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION) +{ + ATLASSERT(hWndOwner == NULL || ::IsWindow(hWndOwner)); + + LPTSTR lpstrMessage = NULL; + if(IS_INTRESOURCE(message.m_lpstr)) + { + for(int nLen = 256; ; nLen *= 2) + { + ATLTRY(lpstrMessage = new TCHAR[nLen]); + if(lpstrMessage == NULL) + { + ATLASSERT(FALSE); + return 0; + } + int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(message.m_lpstr), lpstrMessage, nLen); + if(nRes < nLen - 1) + break; + delete [] lpstrMessage; + lpstrMessage = NULL; + } + + message.m_lpstr = lpstrMessage; + } + + LPTSTR lpstrTitle = NULL; + if(IS_INTRESOURCE(title.m_lpstr) && LOWORD(title.m_lpstr) != 0) + { + for(int nLen = 256; ; nLen *= 2) + { + ATLTRY(lpstrTitle = new TCHAR[nLen]); + if(lpstrTitle == NULL) + { + ATLASSERT(FALSE); + return 0; + } + int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(title.m_lpstr), lpstrTitle, nLen); + if(nRes < nLen - 1) + break; + delete [] lpstrTitle; + lpstrTitle = NULL; + } + + title.m_lpstr = lpstrTitle; + } + + int nRet = ::MessageBox(hWndOwner, message.m_lpstr, title.m_lpstr, uType); + + delete [] lpstrMessage; + delete [] lpstrTitle; + + return nRet; +} + + +/////////////////////////////////////////////////////////////////////////////// +// CMenu + +#if (WINVER >= 0x0500) + #ifndef MII_SIZEOF_STRUCT + #define MII_SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) + #endif + #define MENUITEMINFO_SIZE_VERSION_400A MII_SIZEOF_STRUCT(MENUITEMINFOA, cch) + #define MENUITEMINFO_SIZE_VERSION_400W MII_SIZEOF_STRUCT(MENUITEMINFOW, cch) + #ifdef UNICODE + #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400W + #else + #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400A + #endif // !UNICODE +#endif // (WINVER >= 0x0500) + +class CMenuItemInfo : public MENUITEMINFO +{ +public: + CMenuItemInfo() + { + memset(this, 0, sizeof(MENUITEMINFO)); + cbSize = sizeof(MENUITEMINFO); +#if (WINVER >= 0x0500) + // adjust struct size if running on older version of Windows + if(AtlIsOldWindows()) + { + ATLASSERT(cbSize > MENUITEMINFO_SIZE_VERSION_400); // must be + cbSize = MENUITEMINFO_SIZE_VERSION_400; + } +#endif // (WINVER >= 0x0500) + } +}; + + +// forward declarations +template class CMenuT; +typedef CMenuT CMenuHandle; +typedef CMenuT CMenu; + + +template +class CMenuT +{ +public: +// Data members + HMENU m_hMenu; + +// Constructor/destructor/operators + CMenuT(HMENU hMenu = NULL) : m_hMenu(hMenu) + { } + + ~CMenuT() + { + if(t_bManaged && m_hMenu != NULL) + DestroyMenu(); + } + + CMenuT& operator =(HMENU hMenu) + { + Attach(hMenu); + return *this; + } + + void Attach(HMENU hMenuNew) + { + ATLASSERT(::IsMenu(hMenuNew)); + if(t_bManaged && m_hMenu != NULL && m_hMenu != hMenuNew) + ::DestroyMenu(m_hMenu); + m_hMenu = hMenuNew; + } + + HMENU Detach() + { + HMENU hMenu = m_hMenu; + m_hMenu = NULL; + return hMenu; + } + + operator HMENU() const { return m_hMenu; } + + bool IsNull() const { return (m_hMenu == NULL); } + + BOOL IsMenu() const + { + return ::IsMenu(m_hMenu); + } + +// Create/destroy methods + BOOL CreateMenu() + { + ATLASSERT(m_hMenu == NULL); + m_hMenu = ::CreateMenu(); + return (m_hMenu != NULL) ? TRUE : FALSE; + } + + BOOL CreatePopupMenu() + { + ATLASSERT(m_hMenu == NULL); + m_hMenu = ::CreatePopupMenu(); + return (m_hMenu != NULL) ? TRUE : FALSE; + } + + BOOL LoadMenu(ATL::_U_STRINGorID menu) + { + ATLASSERT(m_hMenu == NULL); + m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); + return (m_hMenu != NULL) ? TRUE : FALSE; + } + +#ifndef _WIN32_WCE + BOOL LoadMenuIndirect(const void* lpMenuTemplate) + { + ATLASSERT(m_hMenu == NULL); + m_hMenu = ::LoadMenuIndirect(lpMenuTemplate); + return (m_hMenu != NULL) ? TRUE : FALSE; + } +#endif // !_WIN32_WCE + + BOOL DestroyMenu() + { + if (m_hMenu == NULL) + return FALSE; + BOOL bRet = ::DestroyMenu(m_hMenu); + if(bRet) + m_hMenu = NULL; + return bRet; + } + +// Menu Operations + BOOL DeleteMenu(UINT nPosition, UINT nFlags) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::DeleteMenu(m_hMenu, nPosition, nFlags); + } + + BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL) + { + ATLASSERT(::IsMenu(m_hMenu)); +#ifndef _WIN32_WCE +#if (WINVER >= 0x0500) + x = _FixTrackMenuPopupX(x, y); +#endif // !(WINVER >= 0x0500) + return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect); +#else // CE specific + lpRect; + return ::TrackPopupMenuEx(m_hMenu, nFlags, x, y, hWnd, NULL); +#endif // _WIN32_WCE + } + + BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL) + { + ATLASSERT(::IsMenu(m_hMenu)); +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + x = _FixTrackMenuPopupX(x, y); +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) + return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm); + } + +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + // helper that fixes popup menu X position when it's off-screen + static int _FixTrackMenuPopupX(int x, int y) + { + POINT pt = { x, y }; + HMONITOR hMonitor = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + if(hMonitor == NULL) + { + HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); + if(hMonitorNear != NULL) + { + MONITORINFO mi = { 0 }; + mi.cbSize = sizeof(MONITORINFO); + if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE) + { + if(x < mi.rcWork.left) + x = mi.rcWork.left; + else if(x > mi.rcWork.right) + x = mi.rcWork.right; + } + } + } + + return x; + } + + BOOL GetMenuInfo(LPMENUINFO lpMenuInfo) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuInfo(m_hMenu, lpMenuInfo); + } + + BOOL SetMenuInfo(LPCMENUINFO lpMenuInfo) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::SetMenuInfo(m_hMenu, lpMenuInfo); + } +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) + +// Menu Item Operations + BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, lpszNewItem); + } + + BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) + { + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(::IsMenu(hSubMenu)); + return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); + } + +#ifndef _WIN32_WCE + BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::AppendMenu(m_hMenu, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); + } + + BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) + { + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(::IsMenu(hSubMenu)); + return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); + } +#endif // !_WIN32_WCE + + UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck) + { + ATLASSERT(::IsMenu(m_hMenu)); + return (UINT)::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); + } + + UINT EnableMenuItem(UINT nIDEnableItem, UINT nEnable) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); + } + +#ifndef _WIN32_WCE + BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::HiliteMenuItem(hWnd, m_hMenu, uIDHiliteItem, uHilite); + } + + int GetMenuItemCount() const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuItemCount(m_hMenu); + } + + UINT GetMenuItemID(int nPos) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuItemID(m_hMenu, nPos); + } + + UINT GetMenuState(UINT nID, UINT nFlags) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuState(m_hMenu, nID, nFlags); + } + + int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); + } + + int GetMenuStringLen(UINT nIDItem, UINT nFlags) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); + } + +#ifndef _ATL_NO_COM + BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const + { + USES_CONVERSION; + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(bstrText == NULL); + + int nLen = GetMenuStringLen(nIDItem, nFlags); + if(nLen == 0) + { + bstrText = ::SysAllocString(OLESTR("")); + return (bstrText != NULL) ? TRUE : FALSE; + } + + nLen++; // increment to include terminating NULL char + CTempBuffer buff; + LPTSTR lpszText = buff.Allocate(nLen); + if(lpszText == NULL) + return FALSE; + + if(!GetMenuString(nIDItem, lpszText, nLen, nFlags)) + return FALSE; + + bstrText = ::SysAllocString(T2OLE(lpszText)); + return (bstrText != NULL) ? TRUE : FALSE; + } +#endif // !_ATL_NO_COM +#endif // !_WIN32_WCE + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + int GetMenuString(UINT nIDItem, _CSTRING_NS::CString& strText, UINT nFlags) const + { + ATLASSERT(::IsMenu(m_hMenu)); + + int nLen = GetMenuStringLen(nIDItem, nFlags); + if(nLen == 0) + return 0; + + nLen++; // increment to include terminating NULL char + LPTSTR lpstr = strText.GetBufferSetLength(nLen); + if(lpstr == NULL) + return 0; + int nRet = GetMenuString(nIDItem, lpstr, nLen, nFlags); + strText.ReleaseBuffer(); + return nRet; + } +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + + CMenuHandle GetSubMenu(int nPos) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return CMenuHandle(::GetSubMenu(m_hMenu, nPos)); + } + + BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::InsertMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); + } + + BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) + { + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(::IsMenu(hSubMenu)); + return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); + } + +#ifndef _WIN32_WCE + BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); + } + + BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) + { + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(::IsMenu(hSubMenu)); + return ::InsertMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); + } + + BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::ModifyMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); + } + + BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) + { + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(::IsMenu(hSubMenu)); + return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); + } + + BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); + } + + BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) + { + ATLASSERT(::IsMenu(m_hMenu)); + ATLASSERT(::IsMenu(hSubMenu)); + return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); + } +#endif // !_WIN32_WCE + + BOOL RemoveMenu(UINT nPosition, UINT nFlags) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::RemoveMenu(m_hMenu, nPosition, nFlags); + } + +#ifndef _WIN32_WCE + BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked); + } +#endif // !_WIN32_WCE + + BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::CheckMenuRadioItem(m_hMenu, nIDFirst, nIDLast, nIDItem, nFlags); + } + + BOOL GetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return (BOOL)::GetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); + } + + BOOL SetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) + { + ATLASSERT(::IsMenu(m_hMenu)); + return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); + } + +#ifndef _WIN32_WCE + BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) + { + ATLASSERT(::IsMenu(m_hMenu)); + return (BOOL)::InsertMenuItem(m_hMenu, uItem, bByPosition, lpmii); + } + + UINT GetMenuDefaultItem(BOOL bByPosition = FALSE, UINT uFlags = 0U) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuDefaultItem(m_hMenu, (UINT)bByPosition, uFlags); + } + + BOOL SetMenuDefaultItem(UINT uItem = (UINT)-1, BOOL bByPosition = FALSE) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::SetMenuDefaultItem(m_hMenu, uItem, (UINT)bByPosition); + } + + BOOL GetMenuItemRect(HWND hWnd, UINT uItem, LPRECT lprcItem) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuItemRect(hWnd, m_hMenu, uItem, lprcItem); + } + + int MenuItemFromPoint(HWND hWnd, POINT point) const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::MenuItemFromPoint(hWnd, m_hMenu, point); + } + +// Context Help Functions + BOOL SetMenuContextHelpId(DWORD dwContextHelpId) + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::SetMenuContextHelpId(m_hMenu, dwContextHelpId); + } + + DWORD GetMenuContextHelpId() const + { + ATLASSERT(::IsMenu(m_hMenu)); + return ::GetMenuContextHelpId(m_hMenu); + } +#endif // !_WIN32_WCE +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAccelerator + +template +class CAcceleratorT +{ +public: + HACCEL m_hAccel; + +// Constructor/destructor/operators + CAcceleratorT(HACCEL hAccel = NULL) : m_hAccel(hAccel) + { } + + ~CAcceleratorT() + { + if(t_bManaged && m_hAccel != NULL) + ::DestroyAcceleratorTable(m_hAccel); + } + + CAcceleratorT& operator =(HACCEL hAccel) + { + Attach(hAccel); + return *this; + } + + void Attach(HACCEL hAccel) + { + if(t_bManaged && m_hAccel != NULL) + ::DestroyAcceleratorTable(m_hAccel); + m_hAccel = hAccel; + } + + HACCEL Detach() + { + HACCEL hAccel = m_hAccel; + m_hAccel = NULL; + return hAccel; + } + + operator HACCEL() const { return m_hAccel; } + + bool IsNull() const { return m_hAccel == NULL; } + +// Create/destroy methods + HACCEL LoadAccelerators(ATL::_U_STRINGorID accel) + { + ATLASSERT(m_hAccel == NULL); + m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), accel.m_lpstr); + return m_hAccel; + } + + HACCEL CreateAcceleratorTable(LPACCEL pAccel, int cEntries) + { + ATLASSERT(m_hAccel == NULL); + ATLASSERT(pAccel != NULL); + m_hAccel = ::CreateAcceleratorTable(pAccel, cEntries); + return m_hAccel; + } + + void DestroyObject() + { + if(m_hAccel != NULL) + { + ::DestroyAcceleratorTable(m_hAccel); + m_hAccel = NULL; + } + } + +// Operations +#ifndef _WIN32_WCE + int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries) + { + ATLASSERT(m_hAccel != NULL); + ATLASSERT(lpAccelDst != NULL); + return ::CopyAcceleratorTable(m_hAccel, lpAccelDst, cEntries); + } + + int GetEntriesCount() const + { + ATLASSERT(m_hAccel != NULL); + return ::CopyAcceleratorTable(m_hAccel, NULL, 0); + } +#endif // !_WIN32_WCE + + BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg) + { + ATLASSERT(m_hAccel != NULL); + ATLASSERT(::IsWindow(hWnd)); + ATLASSERT(pMsg != NULL); + return ::TranslateAccelerator(hWnd, m_hAccel, pMsg); + } +}; + +typedef CAcceleratorT CAcceleratorHandle; +typedef CAcceleratorT CAccelerator; + + +/////////////////////////////////////////////////////////////////////////////// +// CIcon + +template +class CIconT +{ +public: + HICON m_hIcon; + +// Constructor/destructor/operators + CIconT(HICON hIcon = NULL) : m_hIcon(hIcon) + { } + + ~CIconT() + { + if(t_bManaged && m_hIcon != NULL) + ::DestroyIcon(m_hIcon); + } + + CIconT& operator =(HICON hIcon) + { + Attach(hIcon); + return *this; + } + + void Attach(HICON hIcon) + { + if(t_bManaged && m_hIcon != NULL) + ::DestroyIcon(m_hIcon); + m_hIcon = hIcon; + } + + HICON Detach() + { + HICON hIcon = m_hIcon; + m_hIcon = NULL; + return hIcon; + } + + operator HICON() const { return m_hIcon; } + + bool IsNull() const { return m_hIcon == NULL; } + +// Create/destroy methods + HICON LoadIcon(ATL::_U_STRINGorID icon) + { + ATLASSERT(m_hIcon == NULL); + m_hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); + return m_hIcon; + } + + HICON LoadIcon(ATL::_U_STRINGorID icon, int cxDesired, int cyDesired, UINT fuLoad = 0) + { + ATLASSERT(m_hIcon == NULL); + m_hIcon = (HICON) ::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); + return m_hIcon; + } + +#ifndef _WIN32_WCE + HICON LoadOEMIcon(LPCTSTR lpstrIconName) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(IsOEMIcon(lpstrIconName)); + m_hIcon = ::LoadIcon(NULL, lpstrIconName); + return m_hIcon; + } + + HICON CreateIcon(int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, CONST BYTE* lpbANDbits, CONST BYTE *lpbXORbits) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(lpbANDbits != NULL); + ATLASSERT(lpbXORbits != NULL); + m_hIcon = ::CreateIcon(ModuleHelper::GetResourceInstance(), nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits); + return m_hIcon; + } + + HICON CreateIconFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(pBits != NULL); + m_hIcon = ::CreateIconFromResource(pBits, dwResSize, TRUE, dwVersion); + return m_hIcon; + } + + HICON CreateIconFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(pbBits != NULL); + ATLASSERT(cbBits > 0); + m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags); + return m_hIcon; + } +#endif // !_WIN32_WCE + + HICON CreateIconIndirect(PICONINFO pIconInfo) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(pIconInfo != NULL); + m_hIcon = ::CreateIconIndirect(pIconInfo); + return m_hIcon; + } + +#ifndef _WIN32_WCE + HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(lpszExeFileName != NULL); + m_hIcon = ::ExtractIcon(ModuleHelper::GetModuleInstance(), lpszExeFileName, nIconIndex); + return m_hIcon; + } + + HICON ExtractAssociatedIcon(HINSTANCE hInst, LPTSTR lpIconPath, LPWORD lpiIcon) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(lpIconPath != NULL); + ATLASSERT(lpiIcon != NULL); + m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon); + return m_hIcon; + } +#endif // !_WIN32_WCE + + BOOL DestroyIcon() + { + ATLASSERT(m_hIcon != NULL); + BOOL bRet = ::DestroyIcon(m_hIcon); + if(bRet != FALSE) + m_hIcon = NULL; + return bRet; + } + +// Operations +#ifndef _WIN32_WCE + HICON CopyIcon() + { + ATLASSERT(m_hIcon != NULL); + return ::CopyIcon(m_hIcon); + } + + HICON DuplicateIcon() + { + ATLASSERT(m_hIcon != NULL); + return ::DuplicateIcon(NULL, m_hIcon); + } +#endif // !_WIN32_WCE + + BOOL DrawIcon(HDC hDC, int x, int y) + { + ATLASSERT(m_hIcon != NULL); +#ifndef _WIN32_WCE + return ::DrawIcon(hDC, x, y, m_hIcon); +#else // CE specific + return ::DrawIconEx(hDC, x, y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); +#endif // _WIN32_WCE + } + + BOOL DrawIcon(HDC hDC, POINT pt) + { + ATLASSERT(m_hIcon != NULL); +#ifndef _WIN32_WCE + return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon); +#else // CE specific + return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); +#endif // _WIN32_WCE + } + + BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) + { + ATLASSERT(m_hIcon != NULL); + return ::DrawIconEx(hDC, x, y, m_hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); + } + + BOOL DrawIconEx(HDC hDC, POINT pt, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) + { + ATLASSERT(m_hIcon != NULL); + return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); + } + +#ifndef _WIN32_WCE + BOOL GetIconInfo(PICONINFO pIconInfo) const + { + ATLASSERT(m_hIcon != NULL); + ATLASSERT(pIconInfo != NULL); + return ::GetIconInfo(m_hIcon, pIconInfo); + } + +#if (_WIN32_WINNT >= 0x0600) + BOOL GetIconInfoEx(PICONINFOEX pIconInfo) const + { + ATLASSERT(m_hIcon != NULL); + ATLASSERT(pIconInfo != NULL); + return ::GetIconInfoEx(m_hIcon, pIconInfo); + } +#endif // (_WIN32_WINNT >= 0x0600) + +#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) + HRESULT LoadIconMetric(ATL::_U_STRINGorID icon, int lims) + { + ATLASSERT(m_hIcon == NULL); + USES_CONVERSION; + return ::LoadIconMetric(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), lims, &m_hIcon); + } + + HRESULT LoadIconWithScaleDown(ATL::_U_STRINGorID icon, int cx, int cy) + { + ATLASSERT(m_hIcon == NULL); + USES_CONVERSION; + return ::LoadIconWithScaleDown(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), cx, cy, &m_hIcon); + } + + HRESULT LoadOEMIconMetric(LPCTSTR lpstrIconName, int lims) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(IsOEMIcon(lpstrIconName)); + return ::LoadIconMetric(NULL, (LPCWSTR)lpstrIconName, lims, &m_hIcon); + } + + HRESULT LoadOEMIconWithScaleDown(LPCTSTR lpstrIconName, int cx, int cy) + { + ATLASSERT(m_hIcon == NULL); + ATLASSERT(IsOEMIcon(lpstrIconName)); + USES_CONVERSION; + return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon); + } +#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) +#endif // !_WIN32_WCE + + // Helper +#ifndef _WIN32_WCE + static bool IsOEMIcon(LPCTSTR lpstrIconName) + { +#if (WINVER >= 0x0600) + return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || + lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO || + lpstrIconName == IDI_SHIELD); +#else // !(WINVER >= 0x0600) + return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || + lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO); +#endif // !(WINVER >= 0x0600) + } +#endif // !_WIN32_WCE +}; + +typedef CIconT CIconHandle; +typedef CIconT CIcon; + + +/////////////////////////////////////////////////////////////////////////////// +// CCursor + +// protect template member from a winuser.h macro +#ifdef CopyCursor + #undef CopyCursor +#endif + +template +class CCursorT +{ +public: + HCURSOR m_hCursor; + +// Constructor/destructor/operators + CCursorT(HCURSOR hCursor = NULL) : m_hCursor(hCursor) + { } + + ~CCursorT() + { + if(t_bManaged && m_hCursor != NULL) + DestroyCursor(); + } + + CCursorT& operator =(HCURSOR hCursor) + { + Attach(hCursor); + return *this; + } + + void Attach(HCURSOR hCursor) + { + if(t_bManaged && m_hCursor != NULL) + DestroyCursor(); + m_hCursor = hCursor; + } + + HCURSOR Detach() + { + HCURSOR hCursor = m_hCursor; + m_hCursor = NULL; + return hCursor; + } + + operator HCURSOR() const { return m_hCursor; } + + bool IsNull() const { return m_hCursor == NULL; } + +// Create/destroy methods + HCURSOR LoadCursor(ATL::_U_STRINGorID cursor) + { + ATLASSERT(m_hCursor == NULL); + m_hCursor = ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); + return m_hCursor; + } + + HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName) + { + ATLASSERT(m_hCursor == NULL); +#if (WINVER >= 0x0500) + ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || + lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || + lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || + lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || + lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP || + lpstrCursorName == IDC_HAND); +#else // !(WINVER >= 0x0500) + ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || + lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || + lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || + lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || + lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP); +#endif // !(WINVER >= 0x0500) + m_hCursor = ::LoadCursor(NULL, lpstrCursorName); + return m_hCursor; + } + + // deprecated + HCURSOR LoadOEMCursor(LPCTSTR lpstrCursorName) + { + return LoadSysCursor(lpstrCursorName); + } + + HCURSOR LoadCursor(ATL::_U_STRINGorID cursor, int cxDesired, int cyDesired, UINT fuLoad = 0) + { + ATLASSERT(m_hCursor == NULL); + m_hCursor = (HCURSOR) ::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); + return m_hCursor; + } + +#ifndef _WIN32_WCE + HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename) + { + ATLASSERT(m_hCursor == NULL); + ATLASSERT(pstrFilename != NULL); + m_hCursor = ::LoadCursorFromFile(pstrFilename); + return m_hCursor; + } +#endif // !_WIN32_WCE + +#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) + HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane) + { + ATLASSERT(m_hCursor == NULL); + m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane); + return m_hCursor; + } +#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) + +#ifndef _WIN32_WCE + HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) + { + ATLASSERT(m_hCursor == NULL); + ATLASSERT(pBits != NULL); + m_hCursor = (HCURSOR)::CreateIconFromResource(pBits, dwResSize, FALSE, dwVersion); + return m_hCursor; + } + + HCURSOR CreateCursorFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) + { + ATLASSERT(m_hCursor == NULL); + ATLASSERT(pbBits != NULL); + ATLASSERT(cbBits > 0); + m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags); + return m_hCursor; + } +#endif // !_WIN32_WCE + + BOOL DestroyCursor() + { + ATLASSERT(m_hCursor != NULL); +#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) + BOOL bRet = ::DestroyCursor(m_hCursor); + if(bRet != FALSE) + m_hCursor = NULL; + return bRet; +#else // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) + ATLTRACE2(atlTraceUI, 0, _T("Warning: This version of Windows CE does not have ::DestroyCursor()\n")); + return FALSE; +#endif // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) + } + +// Operations +#ifndef _WIN32_WCE + HCURSOR CopyCursor() + { + ATLASSERT(m_hCursor != NULL); + return (HCURSOR)::CopyIcon((HICON)m_hCursor); + } +#endif // !_WIN32_WCE + +#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) + BOOL GetCursorInfo(LPCURSORINFO pCursorInfo) + { + ATLASSERT(m_hCursor != NULL); + ATLASSERT(pCursorInfo != NULL); + return ::GetCursorInfo(pCursorInfo); + } +#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) +}; + +typedef CCursorT CCursorHandle; +typedef CCursorT CCursor; + + +/////////////////////////////////////////////////////////////////////////////// +// CResource - Wraps a generic Windows resource. +// Use it with custom resource types other than the +// standard RT_CURSOR, RT_BITMAP, etc. + +class CResource +{ +public: + HGLOBAL m_hGlobal; + HRSRC m_hResource; + +// Constructor/destructor + CResource() : m_hGlobal(NULL), m_hResource(NULL) + { } + + ~CResource() + { + Release(); + } + +// Load methods + bool Load(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID) + { + ATLASSERT(m_hResource == NULL); + ATLASSERT(m_hGlobal == NULL); + + m_hResource = ::FindResource(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr); + if(m_hResource == NULL) + return false; + + m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); + if(m_hGlobal == NULL) + { + m_hResource = NULL; + return false; + } + + return true; + } + +#ifndef _WIN32_WCE + bool LoadEx(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID, WORD wLanguage) + { + ATLASSERT(m_hResource == NULL); + ATLASSERT(m_hGlobal == NULL); + + m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr, wLanguage); + if(m_hResource == NULL) + return false; + + m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); + if(m_hGlobal == NULL) + { + m_hResource = NULL; + return false; + } + + return true; + } +#endif // !_WIN32_WCE + +// Misc. operations + DWORD GetSize() const + { + ATLASSERT(m_hResource != NULL); + return ::SizeofResource(ModuleHelper::GetResourceInstance(), m_hResource); + } + + LPVOID Lock() + { + ATLASSERT(m_hResource != NULL); + ATLASSERT(m_hGlobal != NULL); + LPVOID pVoid = ::LockResource(m_hGlobal); + ATLASSERT(pVoid != NULL); + return pVoid; + } + + void Release() + { + if(m_hGlobal != NULL) + { + FreeResource(m_hGlobal); + m_hGlobal = NULL; + m_hResource = NULL; + } + } +}; + +}; // namespace WTL + +#endif // __ATLUSER_H__ diff --git a/Externals/WTL80/atlwince.h b/Externals/WTL80/atlwince.h index 5502d2ec15..295397abc6 100644 --- a/Externals/WTL80/atlwince.h +++ b/Externals/WTL80/atlwince.h @@ -1,3010 +1,3010 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLWINCE_H__ -#define __ATLWINCE_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlwince.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlwince.h requires atlwin.h to be included first -#endif - -#ifndef _WIN32_WCE - #error atlwince.h compiles under Windows CE only -#elif (_WIN32_WCE < 300) - #error atlwince.h requires Windows CE 3.0 or higher. -#endif - -#if defined(WIN32_PLATFORM_WFSP) && _MSC_VER < 1400 // EVC compiling SmartPhone code - #if (WIN32_PLATFORM_WFSP < 200) - #error atlwince.h requires Smartphone 2003 or higher - #endif -#endif // WIN32_PLATFORM_WFSP - -#if defined(WIN32_PLATFORM_PSPC) && _MSC_VER < 1400 // EVC compiling Pocket PC code - #if (WIN32_PLATFORM_PSPC < 310) - #error atlwince.h requires Pocket PC 2002 or higher - #endif -#endif // WIN32_PLATFORM_PSPC - -#if !defined(_AYGSHELL_H_) && !defined(__AYGSHELL_H__) - #error atlwince.h requires aygshell.h to be included first -#else - #if defined(WIN32_PLATFORM_WFSP) && !defined(_TPCSHELL_H_) - #error SmartPhone dialog classes require tpcshell.h to be included first - #endif -#endif - -#if (_MSC_VER >= 1400) // VS2005 - #include - #define _WTL_CE_DRA -#endif // (_MSC_VER >= 1400) - -#if !defined(_WTL_CE_NO_DIALOGS) && !defined(__ATLFRAME_H__) - #error Orientation aware dialog classes require atlframe.h to be included first -#endif - -#if !defined(_WTL_CE_NO_APPWINDOW) && !defined(__ATLFRAME_H__) - #error Application window class require atlframe.h to be included first -#endif - -#if !defined(_WTL_CE_NO_ZOOMSCROLL) && !defined(__ATLSCRL_H__) - #error ZoomScroll implementation requires atlscrl.h to be included first -#endif - -#if !defined(_WTL_CE_NO_ZOOMSCROLL) - #if !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) - #error ZoomScroll requires _WTL_NO_WTYPES not to be defined and either atlmisc.h or atltypes.h to be included first - #endif // !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) -#endif // !defined(_WTL_CE_NO_ZOOMSCROLL) - -#if !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) - #define _WTL_CE_NO_CONTROLS -#endif // !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) - -#ifndef _WTL_CE_NO_CONTROLS - #ifndef __ATLCTRLS_H__ - #error The PPC/SmartPhone controls classes require atlctrls.h to be included first - #endif - - #include - #pragma comment(lib, "htmlview.lib") - - #include - #pragma comment(lib, "voicectl.lib") - - #ifdef WIN32_PLATFORM_PSPC - #include - #pragma comment(lib, "richink.lib") - - #include - #pragma comment(lib, "inkx.lib") - - #include - #pragma comment(lib, "doclist.lib") - #endif -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CStdDialogBase : Standard PPC/SmartPhone dialog base class -// CStdDialogImplBase - Base implementation of standard dialog -// CStdDialogImpl : Standard dialog implementation -// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog -// CStdAxDialogImpl : Standard AxDialog implementation -// CStdSimpleDialog : Standard simple dialog -// CStdDialogResizeImplBase - Base implementation of orientation resizing standard dialog -// CStdDialogResizeImpl : Orientation resizing standard dialog implementation -// CStdAxDialogResizeImpl - implementation of orientation resizing standard AxDialog -// CStdSimpleDialogResizeImpl : Standard resizing simple dialog implementation -// CStdOrientedDialogBase - Oriented PPC standard dialog base class -// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation -// CStdOrientedDialogImpl : Oriented PPC standard dialog implementation -// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation -// CStdSimpleOrientedDialog : Standard simple orientable dialog -// -// CAppInfoBase : Helper for application state save/restore to registry -// CAppInfoT : CAppInfoBase constructed from a CAppWindow -// CAppWindowBase : Base class for PPC/SmartPhone well-behaved application window or dialog -// CAppWindow : PPC/SmartPhone well-behaved application window class -// CAppDialog : PPC/SmartPhone well-behaved application dialog class -// CAppStdDialogImplBase - Base implementation of standard application dialogs -// CAppStdDialogImpl : Implementation of standard application dialog -// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog -// CAppStdAxDialogImpl - Implementation of standard application AxDialog -// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog -// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog -// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog -// -// CFullScreenFrame : Full screen frame class -// -// CZoomScrollImpl : WinCE zooming implementation -// -// CBottomTabViewImpl - CBottomTabView -// CHtmlCtrlT - CHtmlCtrl -// CRichInkCtrlT - CRichInkCtrl -// CInkXCtrlT - CInkXCtrl -// CVoiceRecorderCtrlT - CVoiceRecorderCtrl -// CDocListCtrlT - CDocListCtrl -// CCapEditT - CCapEdit -// CTTStaticT - CTTStatic -// CTTButtonT - CTTButton -// -// CSpinCtrlT - CSpinCtrl : SmartPhone specific UpDown control -// CSpinned : SmartPhone association of control and Spin -// CSpinListBox : SmartPhone spinned ListBox control -// CExpandListBox : SmartPhone expandable ListBox control -// CExpandEdit : SmartPhone expandable Edit control -// CExpandCapEdit : SmartPhone expandable CapEdit control -// -// Global functions: -// AtlCreateMenuBar() -// AtlCreateEmptyMenuBar() -// AtlIsEditFocus() -// AtlActivateBackKey() - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// MenuBar creation functions for property sheets and dialogs -// Frame windows use CreateSimpleCEMenuBar - -inline HWND AtlCreateMenuBar(SHMENUBARINFO& mbi) -{ - ATLASSERT(::IsWindow(mbi.hwndParent)); - ATLVERIFY(::SHCreateMenuBar(&mbi) != FALSE); - return mbi.hwndMB; -}; - -inline HWND AtlCreateMenuBar(HWND hWnd, UINT nToolBarId = ATL_IDW_TOOLBAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0, COLORREF clrBk = 0) -{ - SHMENUBARINFO mbi = { sizeof(mbi), hWnd, dwFlags, nToolBarId, ModuleHelper::GetResourceInstance(), nBmpId, cBmpImages, 0, clrBk }; - return AtlCreateMenuBar(mbi); -} - -inline HWND AtlCreateEmptyMenuBar(HWND hWnd, bool bSip = true) -{ - SHMENUBARINFO embi = { sizeof(SHMENUBARINFO), hWnd, SHCMBF_EMPTYBAR }; - if (!bSip) - embi.dwFlags |= SHCMBF_HIDESIPBUTTON; - - return AtlCreateMenuBar(embi); -} - -/////////////////////////////////////////////////////////////////////////////// -// Helper functions for SmartPhone back key handling - -inline bool AtlIsEditFocus() -{ - ATL::CWindow wCtrl = GetFocus(); - if (wCtrl.IsWindow()) - { - TCHAR szClassName[8] = {0}; - ATLVERIFY(::GetClassName(wCtrl.m_hWnd, szClassName, 8)); - return !_tcscmp(szClassName, _T("Edit")) || !_tcscmp(szClassName, WC_CAPEDIT); - } - return false; -} - -#if defined WIN32_PLATFORM_WFSP -inline void AtlActivateBackKey(HWND hMenuBar) -{ - ATLASSERT(::IsWindow(hMenuBar)); - ::SendMessage(hMenuBar, SHCMBM_OVERRIDEKEY, VK_TBACK, - MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); -} -#endif // WIN32_PLATFORM_WFSP - -// --- Standard PPC/SmartPhone dialogs --- - -#ifndef _WTL_CE_NO_DIALOGS - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogBase - base class for standard PPC/SmartPhone dialogs - -#define WTL_STD_SHIDIF SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN -#define WTL_SP_SHIDIF SHIDIF_SIZEDLGFULLSCREEN - -// Title setting macros -#define WTL_DLG_TITLEHEIGHT(iHeight) static const int GetTitleHeight(){return iHeight;} -#define WTL_DLG_NOTITLE WTL_DLG_TITLEHEIGHT(0) - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogBase - Base class for standard PPC/SmartPhone dialog - -template -class CStdDialogBase -{ -public: -#ifdef WIN32_PLATFORM_PSPC -// Pocket PC only Dialog title handling - const int nTitleHeight; - - CStdDialogBase() : nTitleHeight(T::GetTitleHeight()) - { } - -// Overloads - BOOL GetClientRect(LPRECT lpRect) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - BOOL bRes = ::GetClientRect(pT->m_hWnd, lpRect); - lpRect->top += nTitleHeight; - return bRes; - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - BOOL bRes = ::SetWindowText(pT->m_hWnd, lpszString); - if (nTitleHeight != 0) - pT->DoPaintTitle(); - return bRes; - } - -// Overrideables - static const int GetTitleHeight() - { - #ifdef _WTL_CE_DRA - return DRA::SCALEY(24); - #else // !_WTL_CE_DRA - CWindowDC dc(NULL); - return dc.GetDeviceCaps(LOGPIXELSY) >> 2; // LOGPIXELSY * 24 / 96, - #endif // !_WTL_CE_DRA - } - - // Title painting - bool DoPaintTitle() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - TCHAR sTitle[48]; - - // Preparation - CPaintDC dc(pT->m_hWnd); - CFont fontTitle = AtlCreateBoldFont(); - CFontHandle fontOld = dc.SelectFont(fontTitle); - dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHT)); - int nLen = pT->GetWindowText(sTitle, 48); - int nWidth = dc.GetDeviceCaps(HORZRES); - - // Display title text - RECT rTitle = { 0, 0, nWidth, nTitleHeight }; - dc.FillRect(&rTitle, COLOR_3DHIGHLIGHT); - #ifdef _WTL_CE_DRA - rTitle.left = DRA::SCALEX(8); - #else // !_WTL_CE_DRA - rTitle.left = nTitleHeight / 3; // 8 == 24 / 3 - #endif // !_WTL_CE_DRA - dc.DrawText(sTitle, nLen, &rTitle, DT_VCENTER | DT_SINGLELINE); - dc.SelectFont(fontOld); - - // Draw bottom line, 2 pixels thick if HI_RES_AWARE - CPenHandle penOld = dc.SelectStockPen(BLACK_PEN); - POINT line[4] = {{0, nTitleHeight}, {nWidth, nTitleHeight}, {0, nTitleHeight - 1}, {nWidth, nTitleHeight - 1}}; - - #ifdef _WTL_CE_DRA - int nSeg = DRA::SCALEY(1); - #else // !_WTL_CE_DRA - int nSeg = nTitleHeight / 24; - #endif // !_WTL_CE_DRA - - dc.Polyline(line, nSeg <= 2 ? nSeg * 2 : 4); - dc.SelectPen(penOld); - - return false; - } - - // Title preparation: move the dialog controls down to make room for title - void DialogTitleInit() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); - while (wCtl.IsWindow()) - { - RECT rCtl = { 0 }; - wCtl.GetWindowRect(&rCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rCtl, 2); - ::OffsetRect(&rCtl, 0, nTitleHeight); - wCtl.MoveWindow(&rCtl, FALSE); - wCtl = wCtl.GetWindow(GW_HWNDNEXT); - } - } - - // SIP management - void DoSipInfo() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - SIPINFO si = {sizeof(SIPINFO)}; - SipGetInfo(&si); - if ((si.fdwFlags & SIPF_ON) ^ SIPF_ON) - si.rcVisibleDesktop.bottom = si.rcSipRect.bottom; - pT->MoveWindow(&si.rcVisibleDesktop, FALSE); - } - -// Title painting handler - LRESULT OnPaintTitle(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - return bHandled = nTitleHeight ? pT->DoPaintTitle() : FALSE; - } - -// SIP handler - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - if (wParam == SPI_SETSIPINFO) - { - pT->DoSipInfo(); - return TRUE; - } - return bHandled = FALSE; - } - -#elif defined WIN32_PLATFORM_WFSP -// SmartPhone VK_TBACK key standard management - LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - const UINT uModif = (UINT)LOWORD(lParam); - const UINT uVirtKey = (UINT)HIWORD(lParam); - - if(uVirtKey == VK_TBACK) - if (AtlIsEditFocus()) - ::SHSendBackToFocusWindow(uMsg, wParam, lParam); - else if (uModif & MOD_KEYUP) - pT->StdCloseDialog(IDCANCEL); - return 1; - } - - // SmartPhone MenuBar and VK_TBACK key initialization - void StdSPInit() - { - T* pT = static_cast(this); - HWND hMenuBar = ::SHFindMenuBar(pT->m_hWnd); - - if (!hMenuBar && (t_shidiFlags & SHIDIF_DONEBUTTON)) - hMenuBar = CreateMenuBar(ATL_IDM_MENU_DONE); - - if(hMenuBar != NULL) - AtlActivateBackKey(hMenuBar); - } - - void SetStaticBold() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - CFontHandle fontBold = AtlCreateBoldFont(pT->GetFont()); - - ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); - - while (wCtl.IsWindow()) - { - if ((short int)wCtl.GetDlgCtrlID() == IDC_STATIC) - wCtl.SetFont(fontBold); - wCtl = wCtl.GetWindow(GW_HWNDNEXT); - } - } -#endif // WIN32_PLATFORM_WFSP - -// Platform dependant initialization - void StdPlatformInit() - { - T* pT = static_cast(this); -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title initialization - if (nTitleHeight != 0) - pT->DialogTitleInit(); -#elif defined(WIN32_PLATFORM_WFSP) - pT->StdSPInit(); - SetStaticBold(); -#endif // WIN32_PLATFORM_WFSP - } - - // Menu bar creation - HWND CreateMenuBar(UINT uiMB = T::IDD, int nBmpImages = 0) - { - T* pT = static_cast(this); - return AtlCreateMenuBar(pT->m_hWnd, uiMB, 0, nBmpImages ? uiMB : 0, nBmpImages); - } - - // Dialog closing - void StdCloseDialog(WORD wID) - { - T* pT = static_cast(this); - if (t_bModal) - ::EndDialog(pT->m_hWnd, wID); - else - pT->DestroyWindow(); - } - - // Shell dialog layout initialization - void StdShidInit() - { - T* pT = static_cast(this); - SHINITDLGINFO shidi = { SHIDIM_FLAGS, pT->m_hWnd, t_shidiFlags }; - ::SHInitDialog(&shidi); - } - -// IDC_INFOSTATIC background setting - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if (::GetDlgCtrlID((HWND)lParam) == IDC_INFOSTATIC) - { - ::SetBkMode((HDC)wParam, TRANSPARENT); - return (LRESULT)::GetSysColorBrush(COLOR_INFOBK); - } - return bHandled = FALSE; - } - -// Menu dialog ending - LRESULT OnMenuClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog((WORD)(wID - ID_MENU_OK + IDOK)); - return 0; - } - -// Standard dialog ending: may be used with any command - LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog(wID); - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogImplBase - Base implementation of standard PPC/SmartPhone dialog - -template > -class ATL_NO_VTABLE CStdDialogImplBase : - public TBase, - public CStdDialogBase -{ -public: -#ifdef WIN32_PLATFORM_PSPC - BOOL GetClientRect(LPRECT lpRect) - { - return CStdDialogBase::GetClientRect(lpRect); - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - return CStdDialogBase::SetWindowText(lpszString); - } -#endif - - BEGIN_MSG_MAP(CStdDialogImplBase) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _DEBUG - T* pT = static_cast(this); - ATLASSERT(t_bModal == pT->m_bModal); -#endif - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogImpl - implementation of standard PPC/SmartPhone dialog - -template -class ATL_NO_VTABLE CStdDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog - -#if defined __ATLDLGS_H__ - -template -class ATL_NO_VTABLE CStdIndirectDialogImpl : - public CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > -{ -public: - typedef CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > _baseClass; - typedef CStdDialogImpl _baseStd; - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) - { - ATLASSERT(t_bModal); - - if (!m_Template.IsValid()) - CreateTemplate(); - - if (m_Template.IsTemplateEx()) - { - if (m_Template.GetTemplateExPtr()->style & DS_CENTER) - { - ATLASSERT(m_Template.GetTemplateExPtr()->style ^ WS_CHILD); - GetTemplateExPtr()->style |= WS_POPUP; - } - } - else - { - if (m_Template.GetTemplatePtr()->style & DS_CENTER) - { - ATLASSERT(m_Template.GetTemplatePtr()->style ^ WS_CHILD); - m_Template.GetTemplatePtr()->style |= WS_POPUP; - } - } - - return _baseClass::DoModal(hWndParent, dwInitParam); - } - - HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) - { - ATLASSERT(!t_bModal); - - if (!m_Template.IsValid()) - CreateTemplate(); - - if (m_Template.IsTemplateEx()) - { - if (GetTemplateExPtr()->style & DS_CENTER) - { - ATLASSERT(GetTemplateExPtr()->style ^ WS_CHILD); - GetTemplateExPtr()->style |= WS_POPUP; - } - } - else - { - if (GetTemplatePtr()->style & DS_CENTER) - { - ATLASSERT(GetTemplatePtr()->style ^ WS_CHILD); - GetTemplatePtr()->style |= WS_POPUP; - } - } - - return _baseClass::Create(hWndParent, dwInitParam); - } - - BEGIN_MSG_MAP(CStdIndirectDialogImpl) - CHAIN_MSG_MAP(_baseStd) - END_MSG_MAP() - -}; - -#endif // defined __ATLDLGS_H__ - -#ifndef _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdAxDialogImpl - implementation of standard PPC/SmartPhone AxDialog - -template -class ATL_NO_VTABLE CStdAxDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl< T > > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleDialog - standard PPC/SmartPhone simple dialog with SHIDIF_xxx flags - -template -class CStdSimpleDialog : - public ATL::CSimpleDialog, - public CStdDialogBase, t_shidiFlags> -{ -public: - typedef CStdDialogBase, t_shidiFlags> baseClass; - -#ifdef WIN32_PLATFORM_PSPC - BOOL GetClientRect(LPRECT lpRect) - { - return baseClass::GetClientRect(lpRect); - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - return baseClass::SetWindowText(lpszString); - } -#endif - - BEGIN_MSG_MAP(CStdSimpleDialog) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogResizeImplBase - Base implementation of orientation resizing standard PPC/SmartPhone dialog - -template > -class ATL_NO_VTABLE CStdDialogResizeImplBase : - public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, - public CDialogResize -{ -public: - // Note: BEGIN_DLGRESIZE_MAP is required in the derived class. - - BEGIN_MSG_MAP(CStdResizeDialogImplBase) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - CHAIN_MSG_MAP(CDialogResize< T >) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _DEBUG - T* pT = static_cast(this); - ATLASSERT(t_bModal == pT->m_bModal); -#endif - StdPlatformInit(); - DlgResize_Init(FALSE); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone dialog - -template -class ATL_NO_VTABLE CStdDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdAxDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone AxDialog - -template -class ATL_NO_VTABLE CStdAxDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleDialogResizeImpl - implementation of standard resizing simple dialog with SHIDIF_xxx flags - -// Usage: -// class CMyDlg : public CStdSimpleDialogResize -// { -// public: -// BEGIN_DLGRESIZE_MAP(CMyDlg) -// ... -// END_DLGRESIZE_MAP() -// }; - -template -class ATL_NO_VTABLE CStdSimpleDialogResizeImpl : - public CStdSimpleDialog, - public CDialogResize< T > -{ -public: - typedef CStdSimpleDialog::baseClass baseClass; - - BEGIN_MSG_MAP(CStdSimpleDialogResizeImpl) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - CHAIN_MSG_MAP(CDialogResize< T >) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - StdPlatformInit(); - DlgResize_Init(FALSE); - StdShidInit(); - return bHandled = FALSE; - } -}; - -#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogBase - Oriented PPC standard dialog base class - -template -class CStdOrientedDialogBase -{ -public: -// Operation - BOOL SetOrientation(DRA::DisplayMode mode) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - ATLASSERT(mode == DRA::GetDisplayMode()); - - // Derived dialog must enumerate TWO dialog templates with the same control ids and types ie: - // enum { IDD = IDD_MYDLG, IDD_LANDSCAPE = IDD_MYDLG_L }; - UINT iResource = (mode == DRA::Landscape)? T::IDD_LANDSCAPE : T::IDD; - - BOOL bRes = DRA::RelayoutDialog(ModuleHelper::GetResourceInstance(), pT->m_hWnd, MAKEINTRESOURCE(iResource)); - pT->OnOrientation(mode); - return bRes; - } - -// Override - void OnOrientation(DRA::DisplayMode /*mode*/) - {} - -// Message handlers - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - if (wParam == SETTINGCHANGE_RESET) - { - SetOrientation(DRA::GetDisplayMode()); - pT->StdPlatformInit(); - pT->StdShidInit(); - } - else if (wParam == SPI_SETSIPINFO) - { - pT->DoSipInfo(); - return TRUE; - } - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation - -template > -class ATL_NO_VTABLE CStdOrientedDialogImplBase : - public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, - public CStdOrientedDialogBase -{ -public: - BEGIN_MSG_MAP(CStdOrientedDialogImpl) - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CStdOrientedDialogBase::OnSettingChange) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); -#ifdef _DEBUG - ATLASSERT(t_bModal == pT->m_bModal); -#endif - if (DRA::GetDisplayMode() == DRA::Landscape) - SetOrientation(DRA::Landscape); - pT->StdPlatformInit(); - pT->StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogImpl - Oriented PPC standard dialog implementation - -template -class ATL_NO_VTABLE CStdOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation - -template -class ATL_NO_VTABLE CStdAxOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleOrientedDialog - Standard simple orientable dialog - -template -class CStdSimpleOrientedDialog : - public CStdSimpleDialog, - public CStdOrientedDialogBase > -{ -public: - typedef CStdSimpleDialog::baseClass baseClass; - typedef CStdOrientedDialogBase > baseOriented; - - enum {IDD = t_wDlgTemplateID, IDD_LANDSCAPE = t_wDlgLandscapeID}; - - BEGIN_MSG_MAP(CStdSimpleDialog) - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_SETTINGCHANGE, baseOriented::OnSettingChange) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if (DRA::GetDisplayMode() == DRA::Landscape) - SetOrientation(DRA::Landscape); - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -#endif // _WTL_CE_DRA - - -#endif // _WTL_CE_NO_DIALOGS - - -// --- PPC/SmartPhone application window and helpers --- - -#ifndef _WTL_CE_NO_APPWINDOW - -/////////////////////////////////////////////////////////////////////////////// -// CAppInfoBase - Helper for application state save/restore to registry - -class CAppInfoBase -{ -public: - ATL::CRegKey m_Key; - - CAppInfoBase(ATL::_U_STRINGorID sAppKey) - { - m_Key.Create(HKEY_CURRENT_USER, sAppKey.m_lpstr); - ATLASSERT(m_Key.m_hKey); - } - - template - LONG Save(V& val, ATL::_U_STRINGorID sName) - { - return ::RegSetValueEx(m_Key, sName.m_lpstr, 0, REG_BINARY, (LPBYTE)&val, sizeof(V)); - } - - template - LONG Save(int nb, V& val0, ATL::_U_STRINGorID sName) - { - return ::RegSetValueEx(m_Key, sName.m_lpstr, 0, REG_BINARY, (LPBYTE)&val0, nb * sizeof(V)); - } - - template - LONG Restore(V& val, ATL::_U_STRINGorID sName) - { - DWORD valtype; - DWORD bufSize = sizeof(V); - return ::RegQueryValueEx(m_Key, sName.m_lpstr, 0, &valtype, (LPBYTE)&val, &bufSize); - } - - template - LONG Restore(int nb, V& val0, ATL::_U_STRINGorID sName) - { - DWORD valtype; - DWORD bufSize = nb * sizeof(V); - return ::RegQueryValueEx(m_Key, sName.m_lpstr, 0, &valtype, (LPBYTE)&val0, &bufSize); - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) -#if (_ATL_VER < 0x0800) - LONG Save(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetValue(sval, sName.m_lpstr); - } - - LONG Restore(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - DWORD size = MAX_PATH; - LONG res = m_Key.QueryValue(sval.GetBuffer(size), sName.m_lpstr, &size); - sval.ReleaseBuffer(); - return res; - } -#else // !(_ATL_VER < 0x0800) - LONG Save(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetStringValue(sName.m_lpstr, sval); - } - - LONG Restore(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - DWORD size = MAX_PATH; - LONG res = m_Key.QueryStringValue(sName.m_lpstr, sval.GetBuffer(size), &size); - sval.ReleaseBuffer(); - return res; - } -#endif // !(_ATL_VER < 0x0800) -#else - #pragma message("Warning: CAppInfoBase compiles without CString support. Do not use CString in Save or Restore.") -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - -#if (_ATL_VER < 0x0800) - LONG Save(LPCTSTR sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetValue(sval, sName.m_lpstr); - } - - LONG Restore(LPTSTR sval, ATL::_U_STRINGorID sName, DWORD *plength) - { - return m_Key.QueryValue(sval, sName.m_lpstr, plength); - } -#else // !(_ATL_VER < 0x0800) - LONG Save(LPCTSTR sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetStringValue(sName.m_lpstr, sval); - } - - LONG Restore(LPTSTR sval, ATL::_U_STRINGorID sName, DWORD *plength) - { - return m_Key.QueryStringValue(sName.m_lpstr, sval, plength); - } -#endif // !(_ATL_VER < 0x0800) - - LONG Delete(ATL::_U_STRINGorID sName) - { - return m_Key.DeleteValue(sName.m_lpstr); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppInfoT - CAppInfoBase constructed from a class with T::GetAppKey() - -// Macro for declaring AppKey -#define DECLARE_APPKEY(uAppKey) \ - static LPCTSTR GetAppKey() \ - { \ - static LPCTSTR sAppKey = ATL::_U_STRINGorID(uAppKey).m_lpstr; \ - return sAppKey; \ - } - -template -class CAppInfoT : public CAppInfoBase -{ -public: - CAppInfoT() : CAppInfoBase(T::GetAppKey()){} -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppWindowBase - Base class for PPC/SmartPhone "well-behaved" application window or dialog - -// Macros for declaring frame WNDCLASS and AppKey -#define DECLARE_APP_FRAME_CLASS(WndClassName, uCommonResourceID, uAppKey) \ - DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ - DECLARE_APPKEY(uAppKey) - -#define DECLARE_APP_FRAME_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd, uAppKey) \ - DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ - DECLARE_APPKEY(uAppKey) - -template -class CAppWindowBase -{ -public: - typedef class CAppInfoT< T > CAppInfo; - -#ifndef WIN32_PLATFORM_WFSP - SHACTIVATEINFO m_sai; // NoOp on SmartPhones -#endif // WIN32_PLATFORM_WFSP - - bool m_bHibernate; - - CAppWindowBase< T >() : m_bHibernate(false) - { -#ifndef WIN32_PLATFORM_WFSP - SHACTIVATEINFO sai = { sizeof(SHACTIVATEINFO) }; - m_sai = sai; -#endif // WIN32_PLATFORM_WFSP - }; - - // Same as WTL 7.1 AppWizard generated ActivatePreviousInstance + SendMessage WM_COPYDATA - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine, bool bDialog) - { - // requires T does DECLARE_APP_FRAME_CLASS, DECLARE_APP_FRAME_CLASS_EX or DECLARE_APP_DLG_CLASS - CFrameWndClassInfo& classInfo = T::GetWndClassInfo(); - - ATLVERIFY(::LoadString(hInstance, classInfo.m_uCommonResourceID, classInfo.m_szAutoName, sizeof(classInfo.m_szAutoName)/sizeof(classInfo.m_szAutoName[0])) != 0); - - classInfo.m_wc.lpszClassName = classInfo.m_szAutoName; - - const TCHAR* pszClass = classInfo.m_wc.lpszClassName; - - if(NULL == pszClass || '\0' == *pszClass) - { - return E_FAIL; - } - - const DWORD dRetryInterval = 100; - const int iMaxRetries = 25; - - for(int i = 0; i < iMaxRetries; ++i) - { - HANDLE hMutex = CreateMutex(NULL, FALSE, pszClass); - - DWORD dw = GetLastError(); - - if(NULL == hMutex) - { - HRESULT hr; - - switch(dw) - { - case ERROR_INVALID_HANDLE: - // A non-mutext object with this name already exists. - hr = E_INVALIDARG; - break; - default: - // This should never happen... - hr = E_FAIL; - } - - return hr; - } - - // If the mutex already exists, then there should be another instance running - if(dw == ERROR_ALREADY_EXISTS) - { - CloseHandle(hMutex); - - HWND hwnd = NULL; - if (bDialog) - hwnd = FindWindow(NULL, pszClass); - else - hwnd = FindWindow(pszClass, NULL); - - if(hwnd == NULL) - { - Sleep(dRetryInterval); - continue; - } - else - { - // Transmit our params to previous instance - if (lpstrCmdLine && *lpstrCmdLine) - { - COPYDATASTRUCT cd = { NULL, sizeof(TCHAR) * (wcslen(lpstrCmdLine) + 1), (PVOID)lpstrCmdLine }; - ::SendMessage(hwnd, WM_COPYDATA, NULL, (LPARAM)&cd); - } - // Set the previous instance as the foreground window - if(0 != SetForegroundWindow(reinterpret_cast(reinterpret_cast(hwnd) | 0x1))) - return S_FALSE; - } - } - else - { - return S_OK; - } - } - return S_OK; - } - -// Operations overriden in derived class - bool AppHibernate(bool /*bHibernate*/) - { - return false; - } - - bool AppNewInstance(LPCTSTR /*lpstrCmdLine*/) - { - return false; - } - - void AppSave() - { - } - -#ifdef WIN32_PLATFORM_WFSP - void AppBackKey() - { - ::SHNavigateBack(); - } -#endif - -// Message map and handlers - BEGIN_MSG_MAP(CAppWindowBase) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) -#ifdef WIN32_PLATFORM_WFSP - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#else - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#endif // WIN32_PLATFORM_WFSP - MESSAGE_HANDLER(WM_HIBERNATE, OnHibernate) - MESSAGE_HANDLER(WM_COPYDATA, OnNewInstance) - MESSAGE_HANDLER(WM_CLOSE, OnClose) - END_MSG_MAP() - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - if (m_bHibernate) - m_bHibernate = pT->AppHibernate(false); -#ifndef WIN32_PLATFORM_WFSP - ::SHHandleWMActivate(pT->m_hWnd, wParam, lParam, &m_sai, 0); -#else - wParam; - lParam; -#endif // WIN32_PLATFORM_WFSP - return bHandled = FALSE; - } - -#ifdef WIN32_PLATFORM_WFSP -// SmartPhone VK_TBACK key standard management - LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - const UINT uModif = (UINT)LOWORD(lParam); - const UINT uVirtKey = (UINT)HIWORD(lParam); - if(uVirtKey == VK_TBACK) - if (AtlIsEditFocus()) - ::SHSendBackToFocusWindow(uMsg, wParam, lParam); - else if (uModif & MOD_KEYUP) - pT->AppBackKey(); - return 1; - } - -#else // !WIN32_PLATFORM_WFSP -// PPC SIP handling - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - bHandled = FALSE; - return ::SHHandleWMSettingChange(pT->m_hWnd, wParam, lParam, &m_sai); - } -#endif // !WIN32_PLATFORM_WFSP - - LRESULT OnHibernate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - return m_bHibernate = pT->AppHibernate(true); - } - - LRESULT OnNewInstance(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam; - return pT->AppNewInstance((LPCTSTR)pcds->lpData); - } - - LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->AppSave(); - bHandled = FALSE; - return 1; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppWindow - PPC/SmartPhone "well-behaved" application window class - -template -class CAppWindow : public CAppWindowBase< T > -{ -public: - // Same as WTL 7.1 AppWizard generated Run + lpstrCmdLine in CreateEx - static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) - { - CMessageLoop theLoop; - _Module.AddMessageLoop(&theLoop); - - T wndMain; - - if(wndMain.CreateEx(NULL, NULL, 0, 0, lpstrCmdLine) == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Main window creation failed!\n")); - return 0; - } - - wndMain.ShowWindow(nCmdShow); - - int nRet = theLoop.Run(); - - _Module.RemoveMessageLoop(); - return nRet; - } - - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) - { - return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, false); - } -}; - - -#ifndef _WTL_CE_NO_DIALOGS - -/////////////////////////////////////////////////////////////////////////////// -// CAppDialog - PPC/SmartPhone "well-behaved" dialog application class - -// Macro for declaring dialog WNDCLASS and AppKey -#define DECLARE_APP_DLG_CLASS(WndClassName, uCommonResourceID, uAppKey) \ - static WTL::CFrameWndClassInfo& GetWndClassInfo() \ - { \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { 0, (WNDPROC)StartDialogProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ - }; \ - DECLARE_APPKEY(uAppKey) - -template -class CAppDialog : public CAppWindowBase< T > -{ -public: - static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) - { - CMessageLoop theLoop; - _Module.AddMessageLoop(&theLoop); - - T dlgMain; - - if(dlgMain.Create(NULL, (LPARAM)lpstrCmdLine) == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Main dialog creation failed!\n")); - return 0; - } - - dlgMain.ShowWindow(nCmdShow); - - int nRet = theLoop.Run(); - - _Module.RemoveMessageLoop(); - return nRet; - } - - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) - { - return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, true); - }; -}; - -// PPC/SmartPhone standard application dialogs - -#ifdef WIN32_PLATFORM_WFSP -#define WTL_APP_SHIDIF WTL_SP_SHIDIF -#else -#define WTL_APP_SHIDIF WTL_STD_SHIDIF -#endif - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogImplBase - Base implementation of standard application dialogs - -template -class ATL_NO_VTABLE CAppStdDialogImplBase : - public TImplBase, - public CAppDialog< T > -{ -public: - WTL_DLG_NOTITLE; - - void StdCloseDialog(int nVal) - { - T* pT = static_cast(this); - if (nVal != IDCANCEL) - pT->AppSave(); - if (t_bModal == false) - { - pT->DestroyWindow(); - ::PostQuitMessage(nVal); - } - else - ::EndDialog(pT->m_hWnd, nVal); - } - - BEGIN_MSG_MAP(CAppStdDialogImplBase) - MESSAGE_HANDLER(WM_CLOSE, OnSystemClose) - CHAIN_MSG_MAP(TImplBase) - CHAIN_MSG_MAP(CAppDialog< T >) - END_MSG_MAP() - - LRESULT OnSystemClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog(IDCANCEL); - return 0; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogImpl - Implementation of standard application dialog - -template -class ATL_NO_VTABLE CAppStdDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog - -template -class ATL_NO_VTABLE CAppStdDialogResizeImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxDialogImpl - Implementation of standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxDialogResizeImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; -#endif // _ATL_NO_HOSTING - -#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) -/////////////////////////////////////////////////////////////////////////////// -// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog - -template -class ATL_NO_VTABLE CAppStdOrientedDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxOrientedDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; -#endif // _ATL_NO_HOSTING - -#endif // defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) - -#endif // _WTL_CE_NO_DIALOGS - -#endif // _WTL_CE_NO_APPWINDOW - - -// --- Full screen support --- - -#ifndef _WTL_CE_NO_FULLSCREEN - -/////////////////////////////////////////////////////////////////////////////// -// CFullScreenFrame - full screen frame implementation - -template -class CFullScreenFrame -{ -public: - bool m_bFullScreen; - - CFullScreenFrame() : m_bFullScreen(false) - { } - -// Operation - void SetFullScreen(bool bFull) - { - m_bFullScreen = bFull; - ShowTaskBar(!bFull, false); - ShowMenuBar(!bFull); - } - -// Manage TaskBar for modal dialogs and property sheets - template - int FSDoModal(D& dlg) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - ATLASSERT(pT->IsWindow()); - if (m_bFullScreen) // Show taskbar if hidden - ShowTaskBar(true, false); - int iRet = dlg.DoModal(); - if (m_bFullScreen) // Hide taskbar if restored - ShowTaskBar(false); - return iRet; - } - -// Implementation - void ShowMenuBar(bool bShow) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - ATL::CWindow MenuBar = pT->m_hWndCECommandBar; - ATLASSERT(MenuBar.IsWindow()); - MenuBar.ShowWindow(bShow ? SW_SHOWNORMAL : SW_HIDE); - pT->SizeToMenuBar(); - } - - void ShowTaskBar(bool bShow, bool bRepaint = true) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - RECT rect = { 0 }; - SystemParametersInfo(SPI_GETWORKAREA, NULL, &rect, FALSE); - if (!bShow) - rect.top = 0; - -#ifdef WIN32_PLATFORM_PSPC // Pocket PC code - UINT uShow = t_bHasSip ? SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON : SHFS_SHOWTASKBAR | SHFS_HIDESIPBUTTON; - SHFullScreen(pT->m_hWnd, bShow ? uShow : SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); -#elif _WIN32_WCE > 0x500 // Smartphone 2005 code - SHFullScreen(pT->m_hWnd, bShow ? SHFS_SHOWTASKBAR : SHFS_HIDETASKBAR); -#else // Smartphone 2003 - HWND hTaskBar = FindWindow(_T("tray"), NULL); - ATLASSERT(::IsWindow(hTaskBar)); - ::ShowWindow(hTaskBar, bShow ? SW_SHOW : SW_HIDE); -#endif // WIN32_PLATFORM_PSPC - - pT->MoveWindow(&rect, bRepaint); - } - -// Message map and handler - BEGIN_MSG_MAP(CFullScreenFrame) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) - END_MSG_MAP() - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifndef SETTINGCHANGE_RESET // not defined for PPC 2002 - #define SETTINGCHANGE_RESET SPI_SETWORKAREA -#endif - if (m_bFullScreen && (wParam & SETTINGCHANGE_RESET)) - SetFullScreen(m_bFullScreen); - return bHandled = FALSE; - } - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if (m_bFullScreen) - { - ShowTaskBar(!wParam); - ShowMenuBar(!wParam); - } - return bHandled = FALSE; - } -}; - -#endif // _WTL_CE_NO_FULLSCREEN - - -// --- WinCE zoom support --- - -#ifndef _WTL_CE_NO_ZOOMSCROLL - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollImpl - WinCE zooming implementation on top of CScrollImpl - -template -class CZoomScrollImpl: public CScrollImpl< T > -{ -public: -// Data members - _WTYPES_NS::CSize m_sizeTrue; - double m_fzoom; - -// Creation - CZoomScrollImpl() : m_sizeTrue(0), m_fzoom(1.) - { } - -// Zoom operations and access - void SetZoomScrollSize(_WTYPES_NS::CSize sizeTrue, double fzoom = 1., BOOL bRedraw = TRUE) - { - ATLASSERT(fzoom > 0.); - m_sizeTrue = sizeTrue; - m_fzoom = fzoom; - - CScrollImpl< T >::SetScrollSize(sizeTrue / fzoom, bRedraw); - } - - void SetZoomScrollSize(int cx, int cy, double fzoom=1., BOOL bRedraw = TRUE) - { - SetZoomScrollSize(_WTYPES_NS::CSize(cx, cy), fzoom, bRedraw); - } - - void SetZoom(double fzoom, BOOL bRedraw = TRUE) - { - _WTYPES_NS::CPoint ptCenter = WndtoTrue(m_sizeClient / 2); - _WTYPES_NS::CSize sizePage = GetScrollPage(); - _WTYPES_NS::CSize sizeLine = GetScrollLine(); - - SetZoomScrollSize(GetScrollSize(), fzoom, bRedraw); - - SetScrollLine(sizeLine); - SetScrollPage(sizePage); - _WTYPES_NS::CPoint ptOffset = ptCenter - (m_sizeClient / 2) * fzoom; - SetScrollOffset(ptOffset, bRedraw); - } - - double GetZoom() - { - return m_fzoom; - } - -// CScrollImpl overrides - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - CScrollImpl< T >::SetScrollOffset((int)(x / m_fzoom), (int)(y / m_fzoom), bRedraw); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) - { - ptOffset.x = (LONG)(m_ptOffset.x * m_fzoom); - ptOffset.y = (LONG)(m_ptOffset.y * m_fzoom); - } - - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE) - { - SetZoomScrollSize(cx, cy, GetZoom(), bRedraw); - } - - void SetScrollSize(SIZE sizeTrue, BOOL bRedraw = TRUE) - { - SetZoomScrollSize(sizeTrue, GetZoom(), bRedraw); - } - - void GetScrollSize(SIZE& sizeTrue) const - { - sizeTrue = m_sizeTrue; - } - - void SetScrollPage(int cxPage, int cyPage) - { - SetScrollPage(_WTYPES_NS::CSize(cxPage, cyPage)); - } - - void SetScrollPage(SIZE sizePage) - { - CScrollImpl< T >::SetScrollPage(sizePage / m_fzoom); - } - - void GetScrollPage(SIZE& sizePage) const - { - sizePage = m_sizePage * m_fzoom; - } - - void SetScrollLine(int cxLine, int cyLine) - { - SetScrollLine(_WTYPES_NS::CSize(cxLine, cyLine)); - } - - void SetScrollLine(SIZE sizeLine) - { - CScrollImpl< T >::SetScrollLine(sizeLine / m_fzoom); - } - - void GetScrollLine(SIZE& sizeLine) const - { - sizeLine = m_sizeLine * m_fzoom; - } - -// Data access complements - _WTYPES_NS::CSize GetScrollSize() - { - return m_sizeTrue; - } - - _WTYPES_NS::CSize GetScrollPage() - { - return m_sizePage * m_fzoom; - } - - _WTYPES_NS::CSize GetScrollLine() - { - return m_sizeLine * m_fzoom; - } - - _WTYPES_NS::CPoint GetScrollOffset() - { - return (_WTYPES_NS::CSize)m_ptOffset * m_fzoom; - } - -// Helper coordinate functions - _WTYPES_NS::CPoint WndtoTrue(CPoint ptW) - { - return (_WTYPES_NS::CSize)ptW * GetZoom() + GetScrollOffset(); - } - - void WndtoTrue(LPPOINT aptW, int nPts) // in place coord transformation - { - for (int i = 0 ; i < nPts ; i++) - aptW[i] = WndtoTrue(aptW[i]); - } - - void WndtoTrue(LPRECT prectW) // in place coord transformation - { - WndtoTrue((LPPOINT)prectW, 2); - } - - _WTYPES_NS::CPoint TruetoWnd(CPoint ptT) - { - return (ptT - GetScrollOffset()) / GetZoom(); - } - - void TruetoWnd(LPPOINT aptT, int nPts) // in place coord transformation - { - for (int i = 0 ; i < nPts ; i++) - aptT[i] = TruetoWnd(aptT[i]); - } - - void TruetoWnd(LPRECT prectT) // in place coord transformation - { - TruetoWnd((LPPOINT)prectT, 2); - } - -// Drawing operations : assume adequate setting of data members - BOOL Draw(HBITMAP hbm, HDC hdestDC, DWORD dwROP = SRCCOPY) - { - CDC memDC = CreateCompatibleDC(hdestDC); - CBitmapHandle bmpOld = memDC.SelectBitmap(hbm); - BOOL bRes = Draw(memDC, hdestDC, dwROP); - memDC.SelectBitmap(bmpOld); - return bRes; - } - - BOOL Draw(HDC hsourceDC, HDC hdestDC, DWORD dwROP = SRCCOPY) - { - CDCHandle destDC = hdestDC; - destDC.SetViewportOrg(0,0); - _WTYPES_NS::CPoint ptOffset = GetScrollOffset(); - _WTYPES_NS::CSize sizeZClient = m_sizeClient * GetZoom(); - return destDC.StretchBlt(0, 0, m_sizeClient.cx, m_sizeClient.cy, hsourceDC, ptOffset.x, ptOffset.y, sizeZClient.cx, sizeZClient.cy, dwROP); - } - -#ifdef _IMAGING_H - BOOL Draw(IImage* pIImage, HDC hdestDC) - { - CDCHandle destDC = hdestDC; - destDC.SetViewportOrg(0,0); - return SUCCEEDED(pIImage->Draw(destDC, _WTYPES_NS::CRect(-_WTYPES_NS::CPoint(m_ptOffset), m_sizeAll), NULL)); - } -#endif - -// Message map and handlers - BEGIN_MSG_MAP(CZoomScrollImpl< T >) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - CHAIN_MSG_MAP(CScrollImpl< T >) - END_MSG_MAP() - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if ((GetScrollExtendedStyle() & SCRL_ERASEBACKGROUND)) - { - _WTYPES_NS::CRect rect; - pT->GetClientRect(rect); - _WTYPES_NS::CSize sizeClient=rect.Size(); - - if (m_sizeAll.cx < sizeClient.cx || m_sizeAll.cy < sizeClient.cy) - { - CDCHandle hdc = (HDC)wParam; - HBRUSH hbr = GetSysColorBrush((int)T::GetWndClassInfo().m_wc.hbrBackground - 1); - - if (m_sizeAll.cx < sizeClient.cx) - { - _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(m_sizeAll.cx, 0), sizeClient); - hdc.FillRect(rectBG, hbr); - } - - if (m_sizeAll.cy < sizeClient.cy) - { - _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(0, m_sizeAll.cy), sizeClient); - hdc.FillRect(rectBG, hbr); - } - } - } - else - { - bHandled = FALSE; - } - - return 1; - } -}; - -#endif // _WTL_CE_NO_ZOOMSCROLL - -#ifndef _WTL_CE_NO_CONTROLS - -// --- PPC bottom TabView control --- - -#if defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) - -/////////////////////////////////////////////////////////////////////////////// -// CBottomTabViewImpl - -template -class ATL_NO_VTABLE CBottomTabViewImpl : public CTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) - -// Implementation overrideables - bool CreateTabControl() - { - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | TCS_BOTTOM, 0, m_nTabID); - - ATLASSERT(m_tab.m_hWnd != NULL); - if(m_tab.m_hWnd == NULL) - return false; - - m_tab.SendMessage(CCM_SETVERSION, COMCTL32_VERSION); - m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); - - T* pT = static_cast(this); - m_cyTabHeight = pT->CalcTabHeight(); - - return true; - } - - int CalcTabHeight() - { - int nCount = m_tab.GetItemCount(); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT; - tcix.tciheader.pszText = _T("NS"); - int nIndex = m_tab.InsertItem(nCount, tcix); - - RECT rect = { 0 }; - SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); - RECT rcWnd = rect; - - m_tab.AdjustRect(FALSE, &rect); - rcWnd.top = rect.bottom; - ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); - m_tab.DeleteItem(nIndex); - - return rcWnd.bottom - rcWnd.top; - } - - void UpdateLayout() - { - RECT rect; - GetClientRect(&rect); - - if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) - m_tab.SetWindowPos(NULL, 0, rect.bottom - m_cyTabHeight, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER /*| SWP_SHOWWINDOW*/); - - if(m_nActivePage != -1) - ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, 0, rect.right - rect.left, rect.bottom - m_cyTabHeight, SWP_NOZORDER); - } - -}; - -class CBottomTabView : public CBottomTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_BottomTabView"), 0, COLOR_APPWORKSPACE) -}; - -#endif // defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) - - -// --- PPC/SmartPhone controls --- - -//////////////////////////////////////////////////////////////////////////////// -// These are wrapper classes for the Pocket PC 2002/2003 and SmartPhone 2003 controls -// To implement a window based on a control, use following: -// Example: Implementing a window based on a Html control -// -// class CMyHtml : CWindowImpl -// { -// public: -// BEGIN_MSG_MAP(CMyHtml) -// // put your message handler entries here -// END_MSG_MAP() -// }; -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// CHtmlCtrl - -template -class CHtmlCtrlT : public TBase -{ -public: -// Constructors - CHtmlCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHtmlCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitHTMLControl(hInstance) ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_HTML; - } - -#if (_WIN32_WCE >= 400) - void AddStyle(LPCWSTR pszStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDSTYLE, 0, (LPARAM)pszStyle); - } -#endif // (_WIN32_WCE >= 400) - - void AddText(BOOL bPlainText, LPCSTR pszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)bPlainText, (LPARAM)pszText); - } - - void AddHTML(LPCSTR pszHTML) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)FALSE, (LPARAM)pszHTML); - } - - void AddText(BOOL bPlainText, LPCWSTR pszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)bPlainText, (LPARAM)pszText); - } - - void AddHTML(LPCWSTR pszHTML) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)FALSE, (LPARAM)pszHTML); - } - - void Anchor(LPCSTR pszAnchor) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ANCHOR, 0, (LPARAM)pszAnchor); - } - - void Anchor(LPCWSTR pszAnchor) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ANCHORW, 0, (LPARAM)pszAnchor); - } - -#if (_WIN32_WCE >= 420) - void GetBrowserDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_BROWSERDISPATCH, 0, (LPARAM)ppDispatch); - } - void GetDocumentDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_DOCUMENTDISPATCH , 0, (LPARAM)ppDispatch); - } -#endif // (_WIN32_WCE >= 420) - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_CLEAR, 0, 0L); - } - - void EnableClearType(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLECLEARTYPE, 0, (LPARAM)bEnable); - } - - void EnableContextMenu(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLECONTEXTMENU, 0, (LPARAM)bEnable); - } - - void EnableScripting(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLESCRIPTING, 0, (LPARAM)bEnable); - } - - void EnableShrink(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLESHRINK, 0, (LPARAM)bEnable); - } - - void EndOfSource() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENDOFSOURCE, 0, 0L); - } - - void ImageFail(DWORD dwCookie) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_IMAGEFAIL, 0, (LPARAM)dwCookie); - } - - int GetLayoutHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DTM_LAYOUTHEIGHT, 0, 0L); - } - - int GetLayoutWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DTM_LAYOUTWIDTH, 0, 0L); - } - - void Navigate(LPCTSTR pstrURL, UINT uFlags = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrURL); - ::SendMessage(m_hWnd, DTM_NAVIGATE, (WPARAM)uFlags, (LPARAM)pstrURL); - } - - void SelectAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_SELECTALL, 0, 0L); - } - - void SetImage(INLINEIMAGEINFO* pImageInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pImageInfo); - ::SendMessage(m_hWnd, DTM_SETIMAGE, 0, (LPARAM)pImageInfo); - } - - void ZoomLevel(int iLevel) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ZOOMLEVEL, 0, (LPARAM)iLevel); - } - -#if (_WIN32_WCE >= 400) - void Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_STOP, 0, 0L); - } -#endif // (_WIN32_WCE >= 400) - - void GetScriptDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_SCRIPTDISPATCH, 0, (LPARAM)ppDispatch); - } -}; - -typedef CHtmlCtrlT CHtmlCtrl; - - -#ifdef WIN32_PLATFORM_PSPC - -/////////////////////////////////////////////////////////////////////////////// -// CRichInkCtrl - -template -class CRichInkCtrlT : public TBase -{ -public: -// Constructors - CRichInkCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CRichInkCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitRichInkDLL() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_RICHINK; - } - - BOOL CanPaste(UINT uFormat = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, (WPARAM)uFormat, 0L); - } - - BOOL CanRedo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - void ClearAll(BOOL bRepaint = TRUE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_CLEARALL, (WPARAM)bRepaint, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - UINT GetPageStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETPAGESTYLE, 0, 0L); - } - - UINT GetPenMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETPENMODE, 0, 0L); - } - - UINT GetViewStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETVIEW, 0, 0L); - } - - UINT GetWrapMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETWRAPMODE, 0, 0L); - } - - UINT GetZoomPercent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETZOOMPERCENT, 0, 0L); - } - - void InsertLinks(LPWSTR lpString, int cchLength = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - if(cchLength == -1) - cchLength = lstrlen(lpString); - ::SendMessage(m_hWnd, EM_INSERTLINKS, (WPARAM)cchLength, (LPARAM)lpString); - } - - void RedoEvent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REDOEVENT, 0, 0L); - } - - UINT SetInkLayer(UINT uLayer) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETINKLAYER, (WPARAM)uLayer, 0L); - } - - void SetPageStyle(UINT uStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPAGESTYLE, (WPARAM)uStyle, 0L); - } - - void SetPenMode(UINT uMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPENMODE, (WPARAM)uMode, 0L); - } - - void SetViewStyle(UINT uStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETVIEW, (WPARAM)uStyle, 0L); - } - - void SetViewAttributes(VIEWATTRIBUTES* pAttribs) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pAttribs); - ::SendMessage(m_hWnd, EM_SETVIEWATTRIBUTES, 0, (LPARAM)pAttribs); - } - - void SetWrapMode(UINT uMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETWRAPMODE, (WPARAM)uMode, 0L); - } - - void SetZoomPercent(UINT uPercent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETZOOMPERCENT, (WPARAM)uPercent, 0L); - } - - LONG StreamIn(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, (WPARAM)uFormat, (LPARAM)&es); - } - - LONG StreamOut(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, (WPARAM)uFormat, (LPARAM)&es); - } - - void UndoEvent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_UNDOEVENT, 0, 0L); - } - -// Standard EM_xxx messages - DWORD GetSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); - } - - void GetSel(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)lpszNewText); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, (WPARAM)bModified, 0L); - } - - int GetTextLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); - } - -// Clipboard operations - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } -}; - -typedef CRichInkCtrlT CRichInkCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CInkXCtrl - -template -class CInkXCtrlT : public TBase -{ -public: -// Constructors - CInkXCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CInkXCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitInkX() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_INKX; - } - - static UINT GetHotRecordingMessage() - { - return ::RegisterWindowMessage(szHotRecording); - } - - void ClearAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_CLEARALL, 0, 0L); - } - - int GetData(BYTE* lpBuffer, INT cbBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpBuffer); - return (int)::SendMessage(m_hWnd, IM_GETDATA, (WPARAM)cbBuffer, (LPARAM)lpBuffer); - } - - int GetDataLen() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, IM_GETDATALEN, 0, 0L); - } - - CRichInkCtrl GetRichInk() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, IM_GETRICHINK, 0, 0L); - } - - BOOL IsRecording() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_RECORDING, 0, 0L); - } - - void ReInit() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_REINIT, 0, 0L); - } - - void SetData(const BYTE* lpInkData, INT cbInkData) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpInkData); - ::SendMessage(m_hWnd, IM_SETDATA, (WPARAM)cbInkData, (LPARAM)lpInkData); - } - - void VoicePlay() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICE_PLAY, 0, 0L); - } - - BOOL IsVoicePlaying() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_VOICE_PLAYING, 0, 0L); - } - - BOOL VoiceRecord() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_VOICE_RECORD, 0, 0L); - } - - void VoiceStop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICE_STOP, 0, 0L); - } - - void ShowVoiceBar(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICEBAR, (WPARAM)bShow, 0L); - } -}; - -typedef CInkXCtrlT CInkXCtrl; - -#endif // WIN32_PLATFORM_PSPC - - -/////////////////////////////////////////////////////////////////////////////// -// CVoiceRecorderCtrl - -template -class CVoiceRecorderCtrlT : public TBase -{ -public: -// Constructors - CVoiceRecorderCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CVoiceRecorderCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, const POINT pt, LPTSTR pstrFileName, UINT nID, DWORD dwStyle = 0) - { - ATLASSERT(pstrFileName != NULL); - CM_VOICE_RECORDER cmvr = { 0 }; - cmvr.cb = sizeof(CM_VOICE_RECORDER); - cmvr.dwStyle = dwStyle; - cmvr.xPos = pt.x; - cmvr.yPos = pt.y; - cmvr.hwndParent = hWndParent; - cmvr.id = nID; - cmvr.lpszRecordFileName = pstrFileName; - m_hWnd = VoiceRecorder_Create(&cmvr); - return m_hWnd; - } - - HWND Create(LPCM_VOICE_RECORDER pAttribs) - { - ATLASSERT(pAttribs); - m_hWnd = VoiceRecorder_Create(pAttribs); - return m_hWnd; - } - -// Attributes - void Record() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_RECORD, 0, 0L); - } - - void Play() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_PLAY, 0, 0L); - } - - void Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_STOP, 0, 0L); - } - - void Cancel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_CANCEL, 0, 0L); - } - - void Done() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_OK, 0, 0L); - } -}; - -typedef CVoiceRecorderCtrlT CVoiceRecorderCtrl; - - -#ifdef WIN32_PLATFORM_PSPC - -/////////////////////////////////////////////////////////////////////////////// -// CDocListCtrl - -template -class CDocListCtrlT : public TBase -{ -public: -// Attributes - DOCLISTCREATE m_dlc; - TCHAR m_szPath[MAX_PATH]; - -// Constructors - CDocListCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CDocListCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, WORD wId, LPCTSTR pszFolder = NULL, LPCTSTR pstrFilter = NULL, - WORD wFilterIndex = 0, DWORD dwFlags = DLF_SHOWEXTENSION) - { - ATLASSERT(pstrFilter != NULL); // It seems to need a filter badly!! - ::ZeroMemory(&m_dlc, sizeof(DOCLISTCREATE)); - ::ZeroMemory(m_szPath, sizeof(m_szPath)); - if(pszFolder != NULL) - ::lstrcpyn(m_szPath, pszFolder, MAX_PATH - 1); - m_dlc.dwStructSize = sizeof(DOCLISTCREATE); - m_dlc.hwndParent = hWndParent; - m_dlc.pszFolder = m_szPath; - m_dlc.pstrFilter = pstrFilter; - m_dlc.wFilterIndex = wFilterIndex; - m_dlc.wId = wId; - m_dlc.dwFlags = dwFlags; - m_hWnd = DocList_Create(&m_dlc); - return m_hWnd; - } - - HWND Create(DOCLISTCREATE* pDlc) - { - m_dlc = *pDlc; - m_hWnd = DocList_Create(&m_dlc); - return m_hWnd; - } - -// Attributes - void DeleteSel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_DELETESEL, 0, 0L); - } - - void DisableUpdates() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_DISABLEUPDATES, 0, 0L); - } - - void EnableUpdates() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_ENABLEUPDATES, 0, 0L); - } - - int GetFilterIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETFILTERINDEX, 0, 0L); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETITEMCOUNT, 0, 0L); - } - - int GetNextItem(int iIndex, DWORD dwRelation = LVNI_ALL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)iIndex, (LPARAM)dwRelation); - } - - int GetFirstItem(DWORD dwRelation = LVNI_ALL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)-1, (LPARAM)dwRelation); - } - - BOOL GetNextWave(int* pIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pIndex); - return (BOOL)::SendMessage(m_hWnd, DLM_GETNEXTWAVE, 0, (LPARAM)pIndex); - } - - BOOL GetPrevWave(int* pIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pIndex); - return (BOOL)::SendMessage(m_hWnd, DLM_GETPREVWAVE, 0, (LPARAM)pIndex); - } - - int GetSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETSELCOUNT, 0, 0L); - } - - BOOL GetSelPathName(LPTSTR pstrPath, int cchMax) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - return (BOOL)::SendMessage(m_hWnd, DLM_GETSELPATHNAME, (WPARAM)cchMax, (LPARAM)pstrPath); - } - - void ReceiveIR(LPCTSTR pstrPath) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_RECEIVEIR, 0, (LPARAM)pstrPath); - } - - void Refresh() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_REFRESH, 0, 0L); - } - - BOOL RenameMoveSelectedItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_RENAMEMOVE, 0, 0L); - } - - int SelectAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_SELECTALL, 0, 0L); - } - - HRESULT SelectItem(LPCTSTR pstrPath, BOOL bVisible = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - return (HRESULT)::SendMessage(m_hWnd, DLM_SELECTITEM, (WPARAM)bVisible, (LPARAM)pstrPath); - } - - void SendEMail(LPCTSTR pstrAttachment) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SENDEMAIL, 0, (LPARAM)pstrAttachment); - } - - void SendIR(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SENDIR, 0, (LPARAM)pstrPath); - } - - HRESULT SetFilterIndex(int iIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, DLM_SETFILTERINDEX, (WPARAM)iIndex, 0L); - } - - void SetFolder(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_SETFOLDER, 0, (LPARAM)pstrPath); - } - - BOOL SetItemState(int iIndex, const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pItem); - return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)pItem); - } - - BOOL SetItemState(int iIndex, UINT uState, UINT uMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LV_ITEM lvi = { 0 }; - lvi.stateMask = uMask; - lvi.state = uState; - return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)&lvi); - } - - void SetOneItem(int iIndex, LPCVOID pPA) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SETONEITEM, (WPARAM)iIndex, (LPARAM)pPA); - } - - void SetSelect(int iIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SETSELECT, (WPARAM)iIndex, 0L); - } - - void SetSelPathName(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_SETSELPATHNAME, 0, (LPARAM)pstrPath); - } - - BOOL SetSortOrder() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_SETSORTORDER, 0, 0L); - } - - HRESULT Update() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, DLM_UPDATE, 0, 0L); - } - - BOOL ValidateFolder() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_VALIDATEFOLDER, 0, 0L); - } - -// Functions - BOOL GetFirstSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - return DocList_GetFirstSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); - } - - BOOL GetNextSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - return DocList_GetNextSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); - } -}; - -typedef CDocListCtrlT CDocListCtrl; - -#endif // WIN32_PLATFORM_PSPC - - -/////////////////////////////////////////////////////////////////////////////// -// CCapEdit - -template -class CCapEditT : public TBase -{ -public: -// Constructors - CCapEditT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CCapEditT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = /*TBase*/CWindow::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_CAPEDIT; - } -}; - -typedef CCapEditT CCapEdit; - -/////////////////////////////////////////////////////////////////////////////// -// CTTStatic - -#ifndef WIN32_PLATFORM_WFSP // Tooltips not supported on SmartPhone - -template -class CTTStaticT : public TBase -{ -public: -// Constructors - CTTStaticT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTTStaticT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TSTATIC; - } - -// Operations - BOOL SetToolTipText(LPCTSTR pstrTipText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrTipText); - ATLASSERT(lstrlen(pstrTipText)<= 253); - CTempBuffer buff; - LPTSTR pstr = buff.Allocate(lstrlen(pstrTipText) + 3); - if(pstr == NULL) - return FALSE; - ::lstrcpy(pstr, _T("~~")); - ::lstrcat(pstr, pstrTipText); - return SetWindowText(pstr); - } -}; - -typedef CTTStaticT CTTStatic; - - -/////////////////////////////////////////////////////////////////////////////// -// CTTButton - -template -class CTTButtonT : public TBase -{ -public: -// Constructors - CTTButtonT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTTButtonT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TBUTTON; - } - -// Operations - BOOL SetToolTipText(LPCTSTR pstrTipText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrTipText); - ATLASSERT(lstrlen(pstrTipText)<= 253); - CTempBuffer buff; - LPTSTR pstr = buff.Allocate(lstrlen(pstrTipText) + 3); - if(pstr == NULL) - return FALSE; - ::lstrcpy(pstr, _T("~~")); - ::lstrcat(pstr, pstrTipText); - return SetWindowText(pstr); - } -}; - -typedef CTTButtonT CTTButton; - -#endif // !WIN32_PLATFORM_WFSP - - -// --- SmartPhone specific controls --- - -#ifdef WIN32_PLATFORM_WFSP - -/////////////////////////////////////////////////////////////////////////////// -// CSpinCtrlT - CSpinCtrl : SmartPhone adapted UpDown control - -template -class CSpinCtrlT : public CUpDownCtrlT< TBase > -{ -public: -// Constructors - CSpinCtrlT(HWND hWnd = NULL) : CUpDownCtrlT< TBase >(hWnd) - { } - - CSpinCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, HWND hBuddy, DWORD dwStyle, int nID, LPCTSTR szExpandedName = NULL) - { - ATLASSERT(::IsWindow(hWndParent)); - CUpDownCtrlT< TBase >::Create(hWndParent, NULL, szExpandedName, dwStyle, 0, nID, NULL); - ATLASSERT(m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? - if (hBuddy != NULL) - { - ATLASSERT(::IsWindow(hBuddy)); - SetBuddy(hBuddy); - } - return m_hWnd; - } -}; - -typedef CSpinCtrlT CSpinCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CSpinned - SmartPhone association of control and Spin - -template -class CSpinned : public TBase -{ -public: - CSpinCtrl m_SpinCtrl; - DWORD m_dwSpinnedStyle; - -// Constructors - CSpinned(HWND hWnd = NULL) : TBase(hWnd) - { - m_dwSpinnedStyle = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_EXPANDABLE; - - if (t_bExpandOnly == true) - m_dwSpinnedStyle |= UDS_NOSCROLL; - else - m_dwSpinnedStyle |= UDS_HORZ | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_WRAP; - - if (hWnd != NULL) - AttachOrCreateSpinCtrl(); - } - - CSpinned& operator =(HWND hWnd) - { - Attach(hWnd); - return *this; - } - - void Attach(HWND hWnd) - { - ATLASSERT(!IsWindow()); - TBase* pT = static_cast(this); - pT->m_hWnd = hWnd; - if (hWnd != NULL) - AttachOrCreateSpinCtrl(); - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szExpandedName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - - TBase* pT = static_cast(this); - TBase::Create(hWndParent, rect, NULL, dwStyle, dwExStyle, MenuOrID, lpCreateParam); - ATLASSERT(pT->m_hWnd != NULL); - - m_SpinCtrl.Create(hWndParent, pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + (int)MenuOrID.m_hMenu, szExpandedName); - - ATLASSERT(m_SpinCtrl.m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? - - return pT->m_hWnd; - } - -// Attributes - CSpinCtrl& GetSpinCtrl() - { - return m_SpinCtrl; - } - -// Implementation - // Attach our existing SpinCtrl or create one - bool AttachOrCreateSpinCtrl() - { - TBase* pT = static_cast(this); - - HWND hSpin = ::GetDlgItem(pT->GetParent(), ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); - - if (hSpin != NULL) - { - m_SpinCtrl.Attach(hSpin); -#ifdef DEBUG - TCHAR sClassName[16]; - ::GetClassName(hSpin, sClassName, 16); - ATLASSERT(!_tcscmp(sClassName, UPDOWN_CLASS)); - ATLASSERT(m_SpinCtrl.GetBuddy().m_hWnd == pT->m_hWnd); -#endif // DEBUG - } - else - { - m_SpinCtrl.Create(pT->GetParent(), pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); - } - - return m_SpinCtrl.m_hWnd != NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSpinListBox - SmartPhone spinned ListBox control -// CExpandListBox - SmartPhone expandable ListBox control -// CExpandEdit - SmartPhone expandable Edit control -// CExpandCapEdit - SmartPhone expandable CapEdit control - -typedef CSpinned CSpinListBox; -typedef CSpinned CExpandListBox; -typedef CSpinned CExpandEdit; -typedef CSpinned CExpandCapEdit; - -#endif // WIN32_PLATFORM_WFSP - -#endif // _WTL_CE_NO_CONTROLS - -}; // namespace WTL - -#endif // __ATLWINCE_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLWINCE_H__ +#define __ATLWINCE_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlwince.h requires atlapp.h to be included first +#endif + +#ifndef __ATLWIN_H__ + #error atlwince.h requires atlwin.h to be included first +#endif + +#ifndef _WIN32_WCE + #error atlwince.h compiles under Windows CE only +#elif (_WIN32_WCE < 300) + #error atlwince.h requires Windows CE 3.0 or higher. +#endif + +#if defined(WIN32_PLATFORM_WFSP) && _MSC_VER < 1400 // EVC compiling SmartPhone code + #if (WIN32_PLATFORM_WFSP < 200) + #error atlwince.h requires Smartphone 2003 or higher + #endif +#endif // WIN32_PLATFORM_WFSP + +#if defined(WIN32_PLATFORM_PSPC) && _MSC_VER < 1400 // EVC compiling Pocket PC code + #if (WIN32_PLATFORM_PSPC < 310) + #error atlwince.h requires Pocket PC 2002 or higher + #endif +#endif // WIN32_PLATFORM_PSPC + +#if !defined(_AYGSHELL_H_) && !defined(__AYGSHELL_H__) + #error atlwince.h requires aygshell.h to be included first +#else + #if defined(WIN32_PLATFORM_WFSP) && !defined(_TPCSHELL_H_) + #error SmartPhone dialog classes require tpcshell.h to be included first + #endif +#endif + +#if (_MSC_VER >= 1400) // VS2005 + #include + #define _WTL_CE_DRA +#endif // (_MSC_VER >= 1400) + +#if !defined(_WTL_CE_NO_DIALOGS) && !defined(__ATLFRAME_H__) + #error Orientation aware dialog classes require atlframe.h to be included first +#endif + +#if !defined(_WTL_CE_NO_APPWINDOW) && !defined(__ATLFRAME_H__) + #error Application window class require atlframe.h to be included first +#endif + +#if !defined(_WTL_CE_NO_ZOOMSCROLL) && !defined(__ATLSCRL_H__) + #error ZoomScroll implementation requires atlscrl.h to be included first +#endif + +#if !defined(_WTL_CE_NO_ZOOMSCROLL) + #if !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) + #error ZoomScroll requires _WTL_NO_WTYPES not to be defined and either atlmisc.h or atltypes.h to be included first + #endif // !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) +#endif // !defined(_WTL_CE_NO_ZOOMSCROLL) + +#if !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) + #define _WTL_CE_NO_CONTROLS +#endif // !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) + +#ifndef _WTL_CE_NO_CONTROLS + #ifndef __ATLCTRLS_H__ + #error The PPC/SmartPhone controls classes require atlctrls.h to be included first + #endif + + #include + #pragma comment(lib, "htmlview.lib") + + #include + #pragma comment(lib, "voicectl.lib") + + #ifdef WIN32_PLATFORM_PSPC + #include + #pragma comment(lib, "richink.lib") + + #include + #pragma comment(lib, "inkx.lib") + + #include + #pragma comment(lib, "doclist.lib") + #endif +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CStdDialogBase : Standard PPC/SmartPhone dialog base class +// CStdDialogImplBase - Base implementation of standard dialog +// CStdDialogImpl : Standard dialog implementation +// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog +// CStdAxDialogImpl : Standard AxDialog implementation +// CStdSimpleDialog : Standard simple dialog +// CStdDialogResizeImplBase - Base implementation of orientation resizing standard dialog +// CStdDialogResizeImpl : Orientation resizing standard dialog implementation +// CStdAxDialogResizeImpl - implementation of orientation resizing standard AxDialog +// CStdSimpleDialogResizeImpl : Standard resizing simple dialog implementation +// CStdOrientedDialogBase - Oriented PPC standard dialog base class +// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation +// CStdOrientedDialogImpl : Oriented PPC standard dialog implementation +// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation +// CStdSimpleOrientedDialog : Standard simple orientable dialog +// +// CAppInfoBase : Helper for application state save/restore to registry +// CAppInfoT : CAppInfoBase constructed from a CAppWindow +// CAppWindowBase : Base class for PPC/SmartPhone well-behaved application window or dialog +// CAppWindow : PPC/SmartPhone well-behaved application window class +// CAppDialog : PPC/SmartPhone well-behaved application dialog class +// CAppStdDialogImplBase - Base implementation of standard application dialogs +// CAppStdDialogImpl : Implementation of standard application dialog +// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog +// CAppStdAxDialogImpl - Implementation of standard application AxDialog +// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog +// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog +// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog +// +// CFullScreenFrame : Full screen frame class +// +// CZoomScrollImpl : WinCE zooming implementation +// +// CBottomTabViewImpl - CBottomTabView +// CHtmlCtrlT - CHtmlCtrl +// CRichInkCtrlT - CRichInkCtrl +// CInkXCtrlT - CInkXCtrl +// CVoiceRecorderCtrlT - CVoiceRecorderCtrl +// CDocListCtrlT - CDocListCtrl +// CCapEditT - CCapEdit +// CTTStaticT - CTTStatic +// CTTButtonT - CTTButton +// +// CSpinCtrlT - CSpinCtrl : SmartPhone specific UpDown control +// CSpinned : SmartPhone association of control and Spin +// CSpinListBox : SmartPhone spinned ListBox control +// CExpandListBox : SmartPhone expandable ListBox control +// CExpandEdit : SmartPhone expandable Edit control +// CExpandCapEdit : SmartPhone expandable CapEdit control +// +// Global functions: +// AtlCreateMenuBar() +// AtlCreateEmptyMenuBar() +// AtlIsEditFocus() +// AtlActivateBackKey() + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// MenuBar creation functions for property sheets and dialogs +// Frame windows use CreateSimpleCEMenuBar + +inline HWND AtlCreateMenuBar(SHMENUBARINFO& mbi) +{ + ATLASSERT(::IsWindow(mbi.hwndParent)); + ATLVERIFY(::SHCreateMenuBar(&mbi) != FALSE); + return mbi.hwndMB; +}; + +inline HWND AtlCreateMenuBar(HWND hWnd, UINT nToolBarId = ATL_IDW_TOOLBAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0, COLORREF clrBk = 0) +{ + SHMENUBARINFO mbi = { sizeof(mbi), hWnd, dwFlags, nToolBarId, ModuleHelper::GetResourceInstance(), nBmpId, cBmpImages, 0, clrBk }; + return AtlCreateMenuBar(mbi); +} + +inline HWND AtlCreateEmptyMenuBar(HWND hWnd, bool bSip = true) +{ + SHMENUBARINFO embi = { sizeof(SHMENUBARINFO), hWnd, SHCMBF_EMPTYBAR }; + if (!bSip) + embi.dwFlags |= SHCMBF_HIDESIPBUTTON; + + return AtlCreateMenuBar(embi); +} + +/////////////////////////////////////////////////////////////////////////////// +// Helper functions for SmartPhone back key handling + +inline bool AtlIsEditFocus() +{ + ATL::CWindow wCtrl = GetFocus(); + if (wCtrl.IsWindow()) + { + TCHAR szClassName[8] = {0}; + ATLVERIFY(::GetClassName(wCtrl.m_hWnd, szClassName, 8)); + return !_tcscmp(szClassName, _T("Edit")) || !_tcscmp(szClassName, WC_CAPEDIT); + } + return false; +} + +#if defined WIN32_PLATFORM_WFSP +inline void AtlActivateBackKey(HWND hMenuBar) +{ + ATLASSERT(::IsWindow(hMenuBar)); + ::SendMessage(hMenuBar, SHCMBM_OVERRIDEKEY, VK_TBACK, + MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); +} +#endif // WIN32_PLATFORM_WFSP + +// --- Standard PPC/SmartPhone dialogs --- + +#ifndef _WTL_CE_NO_DIALOGS + +/////////////////////////////////////////////////////////////////////////////// +// CStdDialogBase - base class for standard PPC/SmartPhone dialogs + +#define WTL_STD_SHIDIF SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN +#define WTL_SP_SHIDIF SHIDIF_SIZEDLGFULLSCREEN + +// Title setting macros +#define WTL_DLG_TITLEHEIGHT(iHeight) static const int GetTitleHeight(){return iHeight;} +#define WTL_DLG_NOTITLE WTL_DLG_TITLEHEIGHT(0) + +/////////////////////////////////////////////////////////////////////////////// +// CStdDialogBase - Base class for standard PPC/SmartPhone dialog + +template +class CStdDialogBase +{ +public: +#ifdef WIN32_PLATFORM_PSPC +// Pocket PC only Dialog title handling + const int nTitleHeight; + + CStdDialogBase() : nTitleHeight(T::GetTitleHeight()) + { } + +// Overloads + BOOL GetClientRect(LPRECT lpRect) + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + BOOL bRes = ::GetClientRect(pT->m_hWnd, lpRect); + lpRect->top += nTitleHeight; + return bRes; + } + + BOOL SetWindowText(LPCTSTR lpszString) + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + BOOL bRes = ::SetWindowText(pT->m_hWnd, lpszString); + if (nTitleHeight != 0) + pT->DoPaintTitle(); + return bRes; + } + +// Overrideables + static const int GetTitleHeight() + { + #ifdef _WTL_CE_DRA + return DRA::SCALEY(24); + #else // !_WTL_CE_DRA + CWindowDC dc(NULL); + return dc.GetDeviceCaps(LOGPIXELSY) >> 2; // LOGPIXELSY * 24 / 96, + #endif // !_WTL_CE_DRA + } + + // Title painting + bool DoPaintTitle() + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + TCHAR sTitle[48]; + + // Preparation + CPaintDC dc(pT->m_hWnd); + CFont fontTitle = AtlCreateBoldFont(); + CFontHandle fontOld = dc.SelectFont(fontTitle); + dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHT)); + int nLen = pT->GetWindowText(sTitle, 48); + int nWidth = dc.GetDeviceCaps(HORZRES); + + // Display title text + RECT rTitle = { 0, 0, nWidth, nTitleHeight }; + dc.FillRect(&rTitle, COLOR_3DHIGHLIGHT); + #ifdef _WTL_CE_DRA + rTitle.left = DRA::SCALEX(8); + #else // !_WTL_CE_DRA + rTitle.left = nTitleHeight / 3; // 8 == 24 / 3 + #endif // !_WTL_CE_DRA + dc.DrawText(sTitle, nLen, &rTitle, DT_VCENTER | DT_SINGLELINE); + dc.SelectFont(fontOld); + + // Draw bottom line, 2 pixels thick if HI_RES_AWARE + CPenHandle penOld = dc.SelectStockPen(BLACK_PEN); + POINT line[4] = {{0, nTitleHeight}, {nWidth, nTitleHeight}, {0, nTitleHeight - 1}, {nWidth, nTitleHeight - 1}}; + + #ifdef _WTL_CE_DRA + int nSeg = DRA::SCALEY(1); + #else // !_WTL_CE_DRA + int nSeg = nTitleHeight / 24; + #endif // !_WTL_CE_DRA + + dc.Polyline(line, nSeg <= 2 ? nSeg * 2 : 4); + dc.SelectPen(penOld); + + return false; + } + + // Title preparation: move the dialog controls down to make room for title + void DialogTitleInit() + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + + ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); + while (wCtl.IsWindow()) + { + RECT rCtl = { 0 }; + wCtl.GetWindowRect(&rCtl); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rCtl, 2); + ::OffsetRect(&rCtl, 0, nTitleHeight); + wCtl.MoveWindow(&rCtl, FALSE); + wCtl = wCtl.GetWindow(GW_HWNDNEXT); + } + } + + // SIP management + void DoSipInfo() + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + + SIPINFO si = {sizeof(SIPINFO)}; + SipGetInfo(&si); + if ((si.fdwFlags & SIPF_ON) ^ SIPF_ON) + si.rcVisibleDesktop.bottom = si.rcSipRect.bottom; + pT->MoveWindow(&si.rcVisibleDesktop, FALSE); + } + +// Title painting handler + LRESULT OnPaintTitle(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = static_cast(this); + return bHandled = nTitleHeight ? pT->DoPaintTitle() : FALSE; + } + +// SIP handler + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = static_cast(this); + if (wParam == SPI_SETSIPINFO) + { + pT->DoSipInfo(); + return TRUE; + } + return bHandled = FALSE; + } + +#elif defined WIN32_PLATFORM_WFSP +// SmartPhone VK_TBACK key standard management + LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + const UINT uModif = (UINT)LOWORD(lParam); + const UINT uVirtKey = (UINT)HIWORD(lParam); + + if(uVirtKey == VK_TBACK) + if (AtlIsEditFocus()) + ::SHSendBackToFocusWindow(uMsg, wParam, lParam); + else if (uModif & MOD_KEYUP) + pT->StdCloseDialog(IDCANCEL); + return 1; + } + + // SmartPhone MenuBar and VK_TBACK key initialization + void StdSPInit() + { + T* pT = static_cast(this); + HWND hMenuBar = ::SHFindMenuBar(pT->m_hWnd); + + if (!hMenuBar && (t_shidiFlags & SHIDIF_DONEBUTTON)) + hMenuBar = CreateMenuBar(ATL_IDM_MENU_DONE); + + if(hMenuBar != NULL) + AtlActivateBackKey(hMenuBar); + } + + void SetStaticBold() + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + + CFontHandle fontBold = AtlCreateBoldFont(pT->GetFont()); + + ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); + + while (wCtl.IsWindow()) + { + if ((short int)wCtl.GetDlgCtrlID() == IDC_STATIC) + wCtl.SetFont(fontBold); + wCtl = wCtl.GetWindow(GW_HWNDNEXT); + } + } +#endif // WIN32_PLATFORM_WFSP + +// Platform dependant initialization + void StdPlatformInit() + { + T* pT = static_cast(this); +#ifdef WIN32_PLATFORM_PSPC // Pocket PC title initialization + if (nTitleHeight != 0) + pT->DialogTitleInit(); +#elif defined(WIN32_PLATFORM_WFSP) + pT->StdSPInit(); + SetStaticBold(); +#endif // WIN32_PLATFORM_WFSP + } + + // Menu bar creation + HWND CreateMenuBar(UINT uiMB = T::IDD, int nBmpImages = 0) + { + T* pT = static_cast(this); + return AtlCreateMenuBar(pT->m_hWnd, uiMB, 0, nBmpImages ? uiMB : 0, nBmpImages); + } + + // Dialog closing + void StdCloseDialog(WORD wID) + { + T* pT = static_cast(this); + if (t_bModal) + ::EndDialog(pT->m_hWnd, wID); + else + pT->DestroyWindow(); + } + + // Shell dialog layout initialization + void StdShidInit() + { + T* pT = static_cast(this); + SHINITDLGINFO shidi = { SHIDIM_FLAGS, pT->m_hWnd, t_shidiFlags }; + ::SHInitDialog(&shidi); + } + +// IDC_INFOSTATIC background setting + LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if (::GetDlgCtrlID((HWND)lParam) == IDC_INFOSTATIC) + { + ::SetBkMode((HDC)wParam, TRANSPARENT); + return (LRESULT)::GetSysColorBrush(COLOR_INFOBK); + } + return bHandled = FALSE; + } + +// Menu dialog ending + LRESULT OnMenuClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->StdCloseDialog((WORD)(wID - ID_MENU_OK + IDOK)); + return 0; + } + +// Standard dialog ending: may be used with any command + LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->StdCloseDialog(wID); + return 0; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CStdDialogImplBase - Base implementation of standard PPC/SmartPhone dialog + +template > +class ATL_NO_VTABLE CStdDialogImplBase : + public TBase, + public CStdDialogBase +{ +public: +#ifdef WIN32_PLATFORM_PSPC + BOOL GetClientRect(LPRECT lpRect) + { + return CStdDialogBase::GetClientRect(lpRect); + } + + BOOL SetWindowText(LPCTSTR lpszString) + { + return CStdDialogBase::SetWindowText(lpszString); + } +#endif + + BEGIN_MSG_MAP(CStdDialogImplBase) +#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP + MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) +#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key + MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) +#endif + MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) + COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _DEBUG + T* pT = static_cast(this); + ATLASSERT(t_bModal == pT->m_bModal); +#endif + StdPlatformInit(); + StdShidInit(); + return bHandled = FALSE; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CStdDialogImpl - implementation of standard PPC/SmartPhone dialog + +template +class ATL_NO_VTABLE CStdDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal> +{}; + +/////////////////////////////////////////////////////////////////////////////// +// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog + +#if defined __ATLDLGS_H__ + +template +class ATL_NO_VTABLE CStdIndirectDialogImpl : + public CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > +{ +public: + typedef CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > _baseClass; + typedef CStdDialogImpl _baseStd; + + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) + { + ATLASSERT(t_bModal); + + if (!m_Template.IsValid()) + CreateTemplate(); + + if (m_Template.IsTemplateEx()) + { + if (m_Template.GetTemplateExPtr()->style & DS_CENTER) + { + ATLASSERT(m_Template.GetTemplateExPtr()->style ^ WS_CHILD); + GetTemplateExPtr()->style |= WS_POPUP; + } + } + else + { + if (m_Template.GetTemplatePtr()->style & DS_CENTER) + { + ATLASSERT(m_Template.GetTemplatePtr()->style ^ WS_CHILD); + m_Template.GetTemplatePtr()->style |= WS_POPUP; + } + } + + return _baseClass::DoModal(hWndParent, dwInitParam); + } + + HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) + { + ATLASSERT(!t_bModal); + + if (!m_Template.IsValid()) + CreateTemplate(); + + if (m_Template.IsTemplateEx()) + { + if (GetTemplateExPtr()->style & DS_CENTER) + { + ATLASSERT(GetTemplateExPtr()->style ^ WS_CHILD); + GetTemplateExPtr()->style |= WS_POPUP; + } + } + else + { + if (GetTemplatePtr()->style & DS_CENTER) + { + ATLASSERT(GetTemplatePtr()->style ^ WS_CHILD); + GetTemplatePtr()->style |= WS_POPUP; + } + } + + return _baseClass::Create(hWndParent, dwInitParam); + } + + BEGIN_MSG_MAP(CStdIndirectDialogImpl) + CHAIN_MSG_MAP(_baseStd) + END_MSG_MAP() + +}; + +#endif // defined __ATLDLGS_H__ + +#ifndef _ATL_NO_HOSTING + +/////////////////////////////////////////////////////////////////////////////// +// CStdAxDialogImpl - implementation of standard PPC/SmartPhone AxDialog + +template +class ATL_NO_VTABLE CStdAxDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl< T > > +{}; +#endif // _ATL_NO_HOSTING + +/////////////////////////////////////////////////////////////////////////////// +// CStdSimpleDialog - standard PPC/SmartPhone simple dialog with SHIDIF_xxx flags + +template +class CStdSimpleDialog : + public ATL::CSimpleDialog, + public CStdDialogBase, t_shidiFlags> +{ +public: + typedef CStdDialogBase, t_shidiFlags> baseClass; + +#ifdef WIN32_PLATFORM_PSPC + BOOL GetClientRect(LPRECT lpRect) + { + return baseClass::GetClientRect(lpRect); + } + + BOOL SetWindowText(LPCTSTR lpszString) + { + return baseClass::SetWindowText(lpszString); + } +#endif + + BEGIN_MSG_MAP(CStdSimpleDialog) +#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP + MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) +#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key + MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) +#endif + MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) + COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + StdPlatformInit(); + StdShidInit(); + return bHandled = FALSE; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CStdDialogResizeImplBase - Base implementation of orientation resizing standard PPC/SmartPhone dialog + +template > +class ATL_NO_VTABLE CStdDialogResizeImplBase : + public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, + public CDialogResize +{ +public: + // Note: BEGIN_DLGRESIZE_MAP is required in the derived class. + + BEGIN_MSG_MAP(CStdResizeDialogImplBase) +#ifdef WIN32_PLATFORM_PSPC // Pocket PC title + MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) +#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key + MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) +#endif + MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) + COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) + CHAIN_MSG_MAP(CDialogResize< T >) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifdef _DEBUG + T* pT = static_cast(this); + ATLASSERT(t_bModal == pT->m_bModal); +#endif + StdPlatformInit(); + DlgResize_Init(FALSE); + StdShidInit(); + return bHandled = FALSE; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CStdDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone dialog + +template +class ATL_NO_VTABLE CStdDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal> +{}; + +#ifndef _ATL_NO_HOSTING + +/////////////////////////////////////////////////////////////////////////////// +// CStdAxDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone AxDialog + +template +class ATL_NO_VTABLE CStdAxDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > +{}; +#endif // _ATL_NO_HOSTING + +/////////////////////////////////////////////////////////////////////////////// +// CStdSimpleDialogResizeImpl - implementation of standard resizing simple dialog with SHIDIF_xxx flags + +// Usage: +// class CMyDlg : public CStdSimpleDialogResize +// { +// public: +// BEGIN_DLGRESIZE_MAP(CMyDlg) +// ... +// END_DLGRESIZE_MAP() +// }; + +template +class ATL_NO_VTABLE CStdSimpleDialogResizeImpl : + public CStdSimpleDialog, + public CDialogResize< T > +{ +public: + typedef CStdSimpleDialog::baseClass baseClass; + + BEGIN_MSG_MAP(CStdSimpleDialogResizeImpl) +#ifdef WIN32_PLATFORM_PSPC // Pocket PC title + MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) +#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key + MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) +#endif + MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) + COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) + CHAIN_MSG_MAP(CDialogResize< T >) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + StdPlatformInit(); + DlgResize_Init(FALSE); + StdShidInit(); + return bHandled = FALSE; + } +}; + +#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) + +/////////////////////////////////////////////////////////////////////////////// +// CStdOrientedDialogBase - Oriented PPC standard dialog base class + +template +class CStdOrientedDialogBase +{ +public: +// Operation + BOOL SetOrientation(DRA::DisplayMode mode) + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + ATLASSERT(mode == DRA::GetDisplayMode()); + + // Derived dialog must enumerate TWO dialog templates with the same control ids and types ie: + // enum { IDD = IDD_MYDLG, IDD_LANDSCAPE = IDD_MYDLG_L }; + UINT iResource = (mode == DRA::Landscape)? T::IDD_LANDSCAPE : T::IDD; + + BOOL bRes = DRA::RelayoutDialog(ModuleHelper::GetResourceInstance(), pT->m_hWnd, MAKEINTRESOURCE(iResource)); + pT->OnOrientation(mode); + return bRes; + } + +// Override + void OnOrientation(DRA::DisplayMode /*mode*/) + {} + +// Message handlers + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + if (wParam == SETTINGCHANGE_RESET) + { + SetOrientation(DRA::GetDisplayMode()); + pT->StdPlatformInit(); + pT->StdShidInit(); + } + else if (wParam == SPI_SETSIPINFO) + { + pT->DoSipInfo(); + return TRUE; + } + return bHandled = FALSE; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation + +template > +class ATL_NO_VTABLE CStdOrientedDialogImplBase : + public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, + public CStdOrientedDialogBase +{ +public: + BEGIN_MSG_MAP(CStdOrientedDialogImpl) + MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) + MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) + MESSAGE_HANDLER(WM_SETTINGCHANGE, CStdOrientedDialogBase::OnSettingChange) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) + COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = static_cast(this); +#ifdef _DEBUG + ATLASSERT(t_bModal == pT->m_bModal); +#endif + if (DRA::GetDisplayMode() == DRA::Landscape) + SetOrientation(DRA::Landscape); + pT->StdPlatformInit(); + pT->StdShidInit(); + return bHandled = FALSE; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CStdOrientedDialogImpl - Oriented PPC standard dialog implementation + +template +class ATL_NO_VTABLE CStdOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal> +{}; + +#ifndef _ATL_NO_HOSTING +/////////////////////////////////////////////////////////////////////////////// +// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation + +template +class ATL_NO_VTABLE CStdAxOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > +{}; +#endif // _ATL_NO_HOSTING + +/////////////////////////////////////////////////////////////////////////////// +// CStdSimpleOrientedDialog - Standard simple orientable dialog + +template +class CStdSimpleOrientedDialog : + public CStdSimpleDialog, + public CStdOrientedDialogBase > +{ +public: + typedef CStdSimpleDialog::baseClass baseClass; + typedef CStdOrientedDialogBase > baseOriented; + + enum {IDD = t_wDlgTemplateID, IDD_LANDSCAPE = t_wDlgLandscapeID}; + + BEGIN_MSG_MAP(CStdSimpleDialog) + MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) + MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) + MESSAGE_HANDLER(WM_SETTINGCHANGE, baseOriented::OnSettingChange) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) + COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) + END_MSG_MAP() + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if (DRA::GetDisplayMode() == DRA::Landscape) + SetOrientation(DRA::Landscape); + StdPlatformInit(); + StdShidInit(); + return bHandled = FALSE; + } +}; + +#endif // _WTL_CE_DRA + + +#endif // _WTL_CE_NO_DIALOGS + + +// --- PPC/SmartPhone application window and helpers --- + +#ifndef _WTL_CE_NO_APPWINDOW + +/////////////////////////////////////////////////////////////////////////////// +// CAppInfoBase - Helper for application state save/restore to registry + +class CAppInfoBase +{ +public: + ATL::CRegKey m_Key; + + CAppInfoBase(ATL::_U_STRINGorID sAppKey) + { + m_Key.Create(HKEY_CURRENT_USER, sAppKey.m_lpstr); + ATLASSERT(m_Key.m_hKey); + } + + template + LONG Save(V& val, ATL::_U_STRINGorID sName) + { + return ::RegSetValueEx(m_Key, sName.m_lpstr, 0, REG_BINARY, (LPBYTE)&val, sizeof(V)); + } + + template + LONG Save(int nb, V& val0, ATL::_U_STRINGorID sName) + { + return ::RegSetValueEx(m_Key, sName.m_lpstr, 0, REG_BINARY, (LPBYTE)&val0, nb * sizeof(V)); + } + + template + LONG Restore(V& val, ATL::_U_STRINGorID sName) + { + DWORD valtype; + DWORD bufSize = sizeof(V); + return ::RegQueryValueEx(m_Key, sName.m_lpstr, 0, &valtype, (LPBYTE)&val, &bufSize); + } + + template + LONG Restore(int nb, V& val0, ATL::_U_STRINGorID sName) + { + DWORD valtype; + DWORD bufSize = nb * sizeof(V); + return ::RegQueryValueEx(m_Key, sName.m_lpstr, 0, &valtype, (LPBYTE)&val0, &bufSize); + } + +#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#if (_ATL_VER < 0x0800) + LONG Save(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) + { + return m_Key.SetValue(sval, sName.m_lpstr); + } + + LONG Restore(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) + { + DWORD size = MAX_PATH; + LONG res = m_Key.QueryValue(sval.GetBuffer(size), sName.m_lpstr, &size); + sval.ReleaseBuffer(); + return res; + } +#else // !(_ATL_VER < 0x0800) + LONG Save(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) + { + return m_Key.SetStringValue(sName.m_lpstr, sval); + } + + LONG Restore(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) + { + DWORD size = MAX_PATH; + LONG res = m_Key.QueryStringValue(sName.m_lpstr, sval.GetBuffer(size), &size); + sval.ReleaseBuffer(); + return res; + } +#endif // !(_ATL_VER < 0x0800) +#else + #pragma message("Warning: CAppInfoBase compiles without CString support. Do not use CString in Save or Restore.") +#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) + +#if (_ATL_VER < 0x0800) + LONG Save(LPCTSTR sval, ATL::_U_STRINGorID sName) + { + return m_Key.SetValue(sval, sName.m_lpstr); + } + + LONG Restore(LPTSTR sval, ATL::_U_STRINGorID sName, DWORD *plength) + { + return m_Key.QueryValue(sval, sName.m_lpstr, plength); + } +#else // !(_ATL_VER < 0x0800) + LONG Save(LPCTSTR sval, ATL::_U_STRINGorID sName) + { + return m_Key.SetStringValue(sName.m_lpstr, sval); + } + + LONG Restore(LPTSTR sval, ATL::_U_STRINGorID sName, DWORD *plength) + { + return m_Key.QueryStringValue(sName.m_lpstr, sval, plength); + } +#endif // !(_ATL_VER < 0x0800) + + LONG Delete(ATL::_U_STRINGorID sName) + { + return m_Key.DeleteValue(sName.m_lpstr); + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAppInfoT - CAppInfoBase constructed from a class with T::GetAppKey() + +// Macro for declaring AppKey +#define DECLARE_APPKEY(uAppKey) \ + static LPCTSTR GetAppKey() \ + { \ + static LPCTSTR sAppKey = ATL::_U_STRINGorID(uAppKey).m_lpstr; \ + return sAppKey; \ + } + +template +class CAppInfoT : public CAppInfoBase +{ +public: + CAppInfoT() : CAppInfoBase(T::GetAppKey()){} +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAppWindowBase - Base class for PPC/SmartPhone "well-behaved" application window or dialog + +// Macros for declaring frame WNDCLASS and AppKey +#define DECLARE_APP_FRAME_CLASS(WndClassName, uCommonResourceID, uAppKey) \ + DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ + DECLARE_APPKEY(uAppKey) + +#define DECLARE_APP_FRAME_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd, uAppKey) \ + DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ + DECLARE_APPKEY(uAppKey) + +template +class CAppWindowBase +{ +public: + typedef class CAppInfoT< T > CAppInfo; + +#ifndef WIN32_PLATFORM_WFSP + SHACTIVATEINFO m_sai; // NoOp on SmartPhones +#endif // WIN32_PLATFORM_WFSP + + bool m_bHibernate; + + CAppWindowBase< T >() : m_bHibernate(false) + { +#ifndef WIN32_PLATFORM_WFSP + SHACTIVATEINFO sai = { sizeof(SHACTIVATEINFO) }; + m_sai = sai; +#endif // WIN32_PLATFORM_WFSP + }; + + // Same as WTL 7.1 AppWizard generated ActivatePreviousInstance + SendMessage WM_COPYDATA + static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine, bool bDialog) + { + // requires T does DECLARE_APP_FRAME_CLASS, DECLARE_APP_FRAME_CLASS_EX or DECLARE_APP_DLG_CLASS + CFrameWndClassInfo& classInfo = T::GetWndClassInfo(); + + ATLVERIFY(::LoadString(hInstance, classInfo.m_uCommonResourceID, classInfo.m_szAutoName, sizeof(classInfo.m_szAutoName)/sizeof(classInfo.m_szAutoName[0])) != 0); + + classInfo.m_wc.lpszClassName = classInfo.m_szAutoName; + + const TCHAR* pszClass = classInfo.m_wc.lpszClassName; + + if(NULL == pszClass || '\0' == *pszClass) + { + return E_FAIL; + } + + const DWORD dRetryInterval = 100; + const int iMaxRetries = 25; + + for(int i = 0; i < iMaxRetries; ++i) + { + HANDLE hMutex = CreateMutex(NULL, FALSE, pszClass); + + DWORD dw = GetLastError(); + + if(NULL == hMutex) + { + HRESULT hr; + + switch(dw) + { + case ERROR_INVALID_HANDLE: + // A non-mutext object with this name already exists. + hr = E_INVALIDARG; + break; + default: + // This should never happen... + hr = E_FAIL; + } + + return hr; + } + + // If the mutex already exists, then there should be another instance running + if(dw == ERROR_ALREADY_EXISTS) + { + CloseHandle(hMutex); + + HWND hwnd = NULL; + if (bDialog) + hwnd = FindWindow(NULL, pszClass); + else + hwnd = FindWindow(pszClass, NULL); + + if(hwnd == NULL) + { + Sleep(dRetryInterval); + continue; + } + else + { + // Transmit our params to previous instance + if (lpstrCmdLine && *lpstrCmdLine) + { + COPYDATASTRUCT cd = { NULL, sizeof(TCHAR) * (wcslen(lpstrCmdLine) + 1), (PVOID)lpstrCmdLine }; + ::SendMessage(hwnd, WM_COPYDATA, NULL, (LPARAM)&cd); + } + // Set the previous instance as the foreground window + if(0 != SetForegroundWindow(reinterpret_cast(reinterpret_cast(hwnd) | 0x1))) + return S_FALSE; + } + } + else + { + return S_OK; + } + } + return S_OK; + } + +// Operations overriden in derived class + bool AppHibernate(bool /*bHibernate*/) + { + return false; + } + + bool AppNewInstance(LPCTSTR /*lpstrCmdLine*/) + { + return false; + } + + void AppSave() + { + } + +#ifdef WIN32_PLATFORM_WFSP + void AppBackKey() + { + ::SHNavigateBack(); + } +#endif + +// Message map and handlers + BEGIN_MSG_MAP(CAppWindowBase) + MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) +#ifdef WIN32_PLATFORM_WFSP + MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) +#else + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) +#endif // WIN32_PLATFORM_WFSP + MESSAGE_HANDLER(WM_HIBERNATE, OnHibernate) + MESSAGE_HANDLER(WM_COPYDATA, OnNewInstance) + MESSAGE_HANDLER(WM_CLOSE, OnClose) + END_MSG_MAP() + + LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + if (m_bHibernate) + m_bHibernate = pT->AppHibernate(false); +#ifndef WIN32_PLATFORM_WFSP + ::SHHandleWMActivate(pT->m_hWnd, wParam, lParam, &m_sai, 0); +#else + wParam; + lParam; +#endif // WIN32_PLATFORM_WFSP + return bHandled = FALSE; + } + +#ifdef WIN32_PLATFORM_WFSP +// SmartPhone VK_TBACK key standard management + LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + const UINT uModif = (UINT)LOWORD(lParam); + const UINT uVirtKey = (UINT)HIWORD(lParam); + if(uVirtKey == VK_TBACK) + if (AtlIsEditFocus()) + ::SHSendBackToFocusWindow(uMsg, wParam, lParam); + else if (uModif & MOD_KEYUP) + pT->AppBackKey(); + return 1; + } + +#else // !WIN32_PLATFORM_WFSP +// PPC SIP handling + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + T* pT = static_cast(this); + bHandled = FALSE; + return ::SHHandleWMSettingChange(pT->m_hWnd, wParam, lParam, &m_sai); + } +#endif // !WIN32_PLATFORM_WFSP + + LRESULT OnHibernate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + return m_bHibernate = pT->AppHibernate(true); + } + + LRESULT OnNewInstance(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam; + return pT->AppNewInstance((LPCTSTR)pcds->lpData); + } + + LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = static_cast(this); + pT->AppSave(); + bHandled = FALSE; + return 1; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CAppWindow - PPC/SmartPhone "well-behaved" application window class + +template +class CAppWindow : public CAppWindowBase< T > +{ +public: + // Same as WTL 7.1 AppWizard generated Run + lpstrCmdLine in CreateEx + static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) + { + CMessageLoop theLoop; + _Module.AddMessageLoop(&theLoop); + + T wndMain; + + if(wndMain.CreateEx(NULL, NULL, 0, 0, lpstrCmdLine) == NULL) + { + ATLTRACE2(atlTraceUI, 0, _T("Main window creation failed!\n")); + return 0; + } + + wndMain.ShowWindow(nCmdShow); + + int nRet = theLoop.Run(); + + _Module.RemoveMessageLoop(); + return nRet; + } + + static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) + { + return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, false); + } +}; + + +#ifndef _WTL_CE_NO_DIALOGS + +/////////////////////////////////////////////////////////////////////////////// +// CAppDialog - PPC/SmartPhone "well-behaved" dialog application class + +// Macro for declaring dialog WNDCLASS and AppKey +#define DECLARE_APP_DLG_CLASS(WndClassName, uCommonResourceID, uAppKey) \ + static WTL::CFrameWndClassInfo& GetWndClassInfo() \ + { \ + static WTL::CFrameWndClassInfo wc = \ + { \ + { 0, (WNDPROC)StartDialogProc, \ + 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ + NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ + }; \ + return wc; \ + }; \ + DECLARE_APPKEY(uAppKey) + +template +class CAppDialog : public CAppWindowBase< T > +{ +public: + static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) + { + CMessageLoop theLoop; + _Module.AddMessageLoop(&theLoop); + + T dlgMain; + + if(dlgMain.Create(NULL, (LPARAM)lpstrCmdLine) == NULL) + { + ATLTRACE2(atlTraceUI, 0, _T("Main dialog creation failed!\n")); + return 0; + } + + dlgMain.ShowWindow(nCmdShow); + + int nRet = theLoop.Run(); + + _Module.RemoveMessageLoop(); + return nRet; + } + + static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) + { + return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, true); + }; +}; + +// PPC/SmartPhone standard application dialogs + +#ifdef WIN32_PLATFORM_WFSP +#define WTL_APP_SHIDIF WTL_SP_SHIDIF +#else +#define WTL_APP_SHIDIF WTL_STD_SHIDIF +#endif + +/////////////////////////////////////////////////////////////////////////////// +// CAppStdDialogImplBase - Base implementation of standard application dialogs + +template +class ATL_NO_VTABLE CAppStdDialogImplBase : + public TImplBase, + public CAppDialog< T > +{ +public: + WTL_DLG_NOTITLE; + + void StdCloseDialog(int nVal) + { + T* pT = static_cast(this); + if (nVal != IDCANCEL) + pT->AppSave(); + if (t_bModal == false) + { + pT->DestroyWindow(); + ::PostQuitMessage(nVal); + } + else + ::EndDialog(pT->m_hWnd, nVal); + } + + BEGIN_MSG_MAP(CAppStdDialogImplBase) + MESSAGE_HANDLER(WM_CLOSE, OnSystemClose) + CHAIN_MSG_MAP(TImplBase) + CHAIN_MSG_MAP(CAppDialog< T >) + END_MSG_MAP() + + LRESULT OnSystemClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + T* pT = static_cast(this); + pT->StdCloseDialog(IDCANCEL); + return 0; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// CAppStdDialogImpl - Implementation of standard application dialog + +template +class ATL_NO_VTABLE CAppStdDialogImpl : + public CAppStdDialogImplBase, t_shidiFlags, t_bModal> +{}; + +/////////////////////////////////////////////////////////////////////////////// +// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog + +template +class ATL_NO_VTABLE CAppStdDialogResizeImpl : + public CAppStdDialogImplBase, t_shidiFlags, t_bModal> +{}; + +#ifndef _ATL_NO_HOSTING +/////////////////////////////////////////////////////////////////////////////// +// CAppStdAxDialogImpl - Implementation of standard application AxDialog + +template +class ATL_NO_VTABLE CAppStdAxDialogImpl : + public CAppStdDialogImplBase, t_shidiFlags, t_bModal> +{}; + +/////////////////////////////////////////////////////////////////////////////// +// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog + +template +class ATL_NO_VTABLE CAppStdAxDialogResizeImpl : + public CAppStdDialogImplBase, t_shidiFlags, t_bModal> +{}; +#endif // _ATL_NO_HOSTING + +#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) +/////////////////////////////////////////////////////////////////////////////// +// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog + +template +class ATL_NO_VTABLE CAppStdOrientedDialogImpl : + public CAppStdDialogImplBase, t_shidiFlags, t_bModal> +{}; + +#ifndef _ATL_NO_HOSTING +/////////////////////////////////////////////////////////////////////////////// +// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog + +template +class ATL_NO_VTABLE CAppStdAxOrientedDialogImpl : + public CAppStdDialogImplBase, t_shidiFlags, t_bModal> +{}; +#endif // _ATL_NO_HOSTING + +#endif // defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) + +#endif // _WTL_CE_NO_DIALOGS + +#endif // _WTL_CE_NO_APPWINDOW + + +// --- Full screen support --- + +#ifndef _WTL_CE_NO_FULLSCREEN + +/////////////////////////////////////////////////////////////////////////////// +// CFullScreenFrame - full screen frame implementation + +template +class CFullScreenFrame +{ +public: + bool m_bFullScreen; + + CFullScreenFrame() : m_bFullScreen(false) + { } + +// Operation + void SetFullScreen(bool bFull) + { + m_bFullScreen = bFull; + ShowTaskBar(!bFull, false); + ShowMenuBar(!bFull); + } + +// Manage TaskBar for modal dialogs and property sheets + template + int FSDoModal(D& dlg) + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + ATLASSERT(pT->IsWindow()); + if (m_bFullScreen) // Show taskbar if hidden + ShowTaskBar(true, false); + int iRet = dlg.DoModal(); + if (m_bFullScreen) // Hide taskbar if restored + ShowTaskBar(false); + return iRet; + } + +// Implementation + void ShowMenuBar(bool bShow) + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + ATL::CWindow MenuBar = pT->m_hWndCECommandBar; + ATLASSERT(MenuBar.IsWindow()); + MenuBar.ShowWindow(bShow ? SW_SHOWNORMAL : SW_HIDE); + pT->SizeToMenuBar(); + } + + void ShowTaskBar(bool bShow, bool bRepaint = true) + { + T* pT = static_cast(this); + ATLASSERT(pT->IsWindow()); + RECT rect = { 0 }; + SystemParametersInfo(SPI_GETWORKAREA, NULL, &rect, FALSE); + if (!bShow) + rect.top = 0; + +#ifdef WIN32_PLATFORM_PSPC // Pocket PC code + UINT uShow = t_bHasSip ? SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON : SHFS_SHOWTASKBAR | SHFS_HIDESIPBUTTON; + SHFullScreen(pT->m_hWnd, bShow ? uShow : SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); +#elif _WIN32_WCE > 0x500 // Smartphone 2005 code + SHFullScreen(pT->m_hWnd, bShow ? SHFS_SHOWTASKBAR : SHFS_HIDETASKBAR); +#else // Smartphone 2003 + HWND hTaskBar = FindWindow(_T("tray"), NULL); + ATLASSERT(::IsWindow(hTaskBar)); + ::ShowWindow(hTaskBar, bShow ? SW_SHOW : SW_HIDE); +#endif // WIN32_PLATFORM_PSPC + + pT->MoveWindow(&rect, bRepaint); + } + +// Message map and handler + BEGIN_MSG_MAP(CFullScreenFrame) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) + MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) + END_MSG_MAP() + + LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { +#ifndef SETTINGCHANGE_RESET // not defined for PPC 2002 + #define SETTINGCHANGE_RESET SPI_SETWORKAREA +#endif + if (m_bFullScreen && (wParam & SETTINGCHANGE_RESET)) + SetFullScreen(m_bFullScreen); + return bHandled = FALSE; + } + + LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + if (m_bFullScreen) + { + ShowTaskBar(!wParam); + ShowMenuBar(!wParam); + } + return bHandled = FALSE; + } +}; + +#endif // _WTL_CE_NO_FULLSCREEN + + +// --- WinCE zoom support --- + +#ifndef _WTL_CE_NO_ZOOMSCROLL + +/////////////////////////////////////////////////////////////////////////////// +// CZoomScrollImpl - WinCE zooming implementation on top of CScrollImpl + +template +class CZoomScrollImpl: public CScrollImpl< T > +{ +public: +// Data members + _WTYPES_NS::CSize m_sizeTrue; + double m_fzoom; + +// Creation + CZoomScrollImpl() : m_sizeTrue(0), m_fzoom(1.) + { } + +// Zoom operations and access + void SetZoomScrollSize(_WTYPES_NS::CSize sizeTrue, double fzoom = 1., BOOL bRedraw = TRUE) + { + ATLASSERT(fzoom > 0.); + m_sizeTrue = sizeTrue; + m_fzoom = fzoom; + + CScrollImpl< T >::SetScrollSize(sizeTrue / fzoom, bRedraw); + } + + void SetZoomScrollSize(int cx, int cy, double fzoom=1., BOOL bRedraw = TRUE) + { + SetZoomScrollSize(_WTYPES_NS::CSize(cx, cy), fzoom, bRedraw); + } + + void SetZoom(double fzoom, BOOL bRedraw = TRUE) + { + _WTYPES_NS::CPoint ptCenter = WndtoTrue(m_sizeClient / 2); + _WTYPES_NS::CSize sizePage = GetScrollPage(); + _WTYPES_NS::CSize sizeLine = GetScrollLine(); + + SetZoomScrollSize(GetScrollSize(), fzoom, bRedraw); + + SetScrollLine(sizeLine); + SetScrollPage(sizePage); + _WTYPES_NS::CPoint ptOffset = ptCenter - (m_sizeClient / 2) * fzoom; + SetScrollOffset(ptOffset, bRedraw); + } + + double GetZoom() + { + return m_fzoom; + } + +// CScrollImpl overrides + void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) + { + CScrollImpl< T >::SetScrollOffset((int)(x / m_fzoom), (int)(y / m_fzoom), bRedraw); + } + + void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) + { + SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); + } + + void GetScrollOffset(POINT& ptOffset) + { + ptOffset.x = (LONG)(m_ptOffset.x * m_fzoom); + ptOffset.y = (LONG)(m_ptOffset.y * m_fzoom); + } + + void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE) + { + SetZoomScrollSize(cx, cy, GetZoom(), bRedraw); + } + + void SetScrollSize(SIZE sizeTrue, BOOL bRedraw = TRUE) + { + SetZoomScrollSize(sizeTrue, GetZoom(), bRedraw); + } + + void GetScrollSize(SIZE& sizeTrue) const + { + sizeTrue = m_sizeTrue; + } + + void SetScrollPage(int cxPage, int cyPage) + { + SetScrollPage(_WTYPES_NS::CSize(cxPage, cyPage)); + } + + void SetScrollPage(SIZE sizePage) + { + CScrollImpl< T >::SetScrollPage(sizePage / m_fzoom); + } + + void GetScrollPage(SIZE& sizePage) const + { + sizePage = m_sizePage * m_fzoom; + } + + void SetScrollLine(int cxLine, int cyLine) + { + SetScrollLine(_WTYPES_NS::CSize(cxLine, cyLine)); + } + + void SetScrollLine(SIZE sizeLine) + { + CScrollImpl< T >::SetScrollLine(sizeLine / m_fzoom); + } + + void GetScrollLine(SIZE& sizeLine) const + { + sizeLine = m_sizeLine * m_fzoom; + } + +// Data access complements + _WTYPES_NS::CSize GetScrollSize() + { + return m_sizeTrue; + } + + _WTYPES_NS::CSize GetScrollPage() + { + return m_sizePage * m_fzoom; + } + + _WTYPES_NS::CSize GetScrollLine() + { + return m_sizeLine * m_fzoom; + } + + _WTYPES_NS::CPoint GetScrollOffset() + { + return (_WTYPES_NS::CSize)m_ptOffset * m_fzoom; + } + +// Helper coordinate functions + _WTYPES_NS::CPoint WndtoTrue(CPoint ptW) + { + return (_WTYPES_NS::CSize)ptW * GetZoom() + GetScrollOffset(); + } + + void WndtoTrue(LPPOINT aptW, int nPts) // in place coord transformation + { + for (int i = 0 ; i < nPts ; i++) + aptW[i] = WndtoTrue(aptW[i]); + } + + void WndtoTrue(LPRECT prectW) // in place coord transformation + { + WndtoTrue((LPPOINT)prectW, 2); + } + + _WTYPES_NS::CPoint TruetoWnd(CPoint ptT) + { + return (ptT - GetScrollOffset()) / GetZoom(); + } + + void TruetoWnd(LPPOINT aptT, int nPts) // in place coord transformation + { + for (int i = 0 ; i < nPts ; i++) + aptT[i] = TruetoWnd(aptT[i]); + } + + void TruetoWnd(LPRECT prectT) // in place coord transformation + { + TruetoWnd((LPPOINT)prectT, 2); + } + +// Drawing operations : assume adequate setting of data members + BOOL Draw(HBITMAP hbm, HDC hdestDC, DWORD dwROP = SRCCOPY) + { + CDC memDC = CreateCompatibleDC(hdestDC); + CBitmapHandle bmpOld = memDC.SelectBitmap(hbm); + BOOL bRes = Draw(memDC, hdestDC, dwROP); + memDC.SelectBitmap(bmpOld); + return bRes; + } + + BOOL Draw(HDC hsourceDC, HDC hdestDC, DWORD dwROP = SRCCOPY) + { + CDCHandle destDC = hdestDC; + destDC.SetViewportOrg(0,0); + _WTYPES_NS::CPoint ptOffset = GetScrollOffset(); + _WTYPES_NS::CSize sizeZClient = m_sizeClient * GetZoom(); + return destDC.StretchBlt(0, 0, m_sizeClient.cx, m_sizeClient.cy, hsourceDC, ptOffset.x, ptOffset.y, sizeZClient.cx, sizeZClient.cy, dwROP); + } + +#ifdef _IMAGING_H + BOOL Draw(IImage* pIImage, HDC hdestDC) + { + CDCHandle destDC = hdestDC; + destDC.SetViewportOrg(0,0); + return SUCCEEDED(pIImage->Draw(destDC, _WTYPES_NS::CRect(-_WTYPES_NS::CPoint(m_ptOffset), m_sizeAll), NULL)); + } +#endif + +// Message map and handlers + BEGIN_MSG_MAP(CZoomScrollImpl< T >) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) + CHAIN_MSG_MAP(CScrollImpl< T >) + END_MSG_MAP() + + LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + if ((GetScrollExtendedStyle() & SCRL_ERASEBACKGROUND)) + { + _WTYPES_NS::CRect rect; + pT->GetClientRect(rect); + _WTYPES_NS::CSize sizeClient=rect.Size(); + + if (m_sizeAll.cx < sizeClient.cx || m_sizeAll.cy < sizeClient.cy) + { + CDCHandle hdc = (HDC)wParam; + HBRUSH hbr = GetSysColorBrush((int)T::GetWndClassInfo().m_wc.hbrBackground - 1); + + if (m_sizeAll.cx < sizeClient.cx) + { + _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(m_sizeAll.cx, 0), sizeClient); + hdc.FillRect(rectBG, hbr); + } + + if (m_sizeAll.cy < sizeClient.cy) + { + _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(0, m_sizeAll.cy), sizeClient); + hdc.FillRect(rectBG, hbr); + } + } + } + else + { + bHandled = FALSE; + } + + return 1; + } +}; + +#endif // _WTL_CE_NO_ZOOMSCROLL + +#ifndef _WTL_CE_NO_CONTROLS + +// --- PPC bottom TabView control --- + +#if defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) + +/////////////////////////////////////////////////////////////////////////////// +// CBottomTabViewImpl + +template +class ATL_NO_VTABLE CBottomTabViewImpl : public CTabViewImpl +{ +public: + DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) + +// Implementation overrideables + bool CreateTabControl() + { + m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | TCS_BOTTOM, 0, m_nTabID); + + ATLASSERT(m_tab.m_hWnd != NULL); + if(m_tab.m_hWnd == NULL) + return false; + + m_tab.SendMessage(CCM_SETVERSION, COMCTL32_VERSION); + m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); + + T* pT = static_cast(this); + m_cyTabHeight = pT->CalcTabHeight(); + + return true; + } + + int CalcTabHeight() + { + int nCount = m_tab.GetItemCount(); + TCITEMEXTRA tcix = { 0 }; + tcix.tciheader.mask = TCIF_TEXT; + tcix.tciheader.pszText = _T("NS"); + int nIndex = m_tab.InsertItem(nCount, tcix); + + RECT rect = { 0 }; + SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); + RECT rcWnd = rect; + + m_tab.AdjustRect(FALSE, &rect); + rcWnd.top = rect.bottom; + ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); + m_tab.DeleteItem(nIndex); + + return rcWnd.bottom - rcWnd.top; + } + + void UpdateLayout() + { + RECT rect; + GetClientRect(&rect); + + if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) + m_tab.SetWindowPos(NULL, 0, rect.bottom - m_cyTabHeight, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER /*| SWP_SHOWWINDOW*/); + + if(m_nActivePage != -1) + ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, 0, rect.right - rect.left, rect.bottom - m_cyTabHeight, SWP_NOZORDER); + } + +}; + +class CBottomTabView : public CBottomTabViewImpl +{ +public: + DECLARE_WND_CLASS_EX(_T("WTL_BottomTabView"), 0, COLOR_APPWORKSPACE) +}; + +#endif // defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) + + +// --- PPC/SmartPhone controls --- + +//////////////////////////////////////////////////////////////////////////////// +// These are wrapper classes for the Pocket PC 2002/2003 and SmartPhone 2003 controls +// To implement a window based on a control, use following: +// Example: Implementing a window based on a Html control +// +// class CMyHtml : CWindowImpl +// { +// public: +// BEGIN_MSG_MAP(CMyHtml) +// // put your message handler entries here +// END_MSG_MAP() +// }; +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// CHtmlCtrl + +template +class CHtmlCtrlT : public TBase +{ +public: +// Constructors + CHtmlCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CHtmlCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + ATLASSERT(hWnd != NULL); // Did you remember to call InitHTMLControl(hInstance) ?? + return hWnd; + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_HTML; + } + +#if (_WIN32_WCE >= 400) + void AddStyle(LPCWSTR pszStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ADDSTYLE, 0, (LPARAM)pszStyle); + } +#endif // (_WIN32_WCE >= 400) + + void AddText(BOOL bPlainText, LPCSTR pszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)bPlainText, (LPARAM)pszText); + } + + void AddHTML(LPCSTR pszHTML) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)FALSE, (LPARAM)pszHTML); + } + + void AddText(BOOL bPlainText, LPCWSTR pszText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)bPlainText, (LPARAM)pszText); + } + + void AddHTML(LPCWSTR pszHTML) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)FALSE, (LPARAM)pszHTML); + } + + void Anchor(LPCSTR pszAnchor) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ANCHOR, 0, (LPARAM)pszAnchor); + } + + void Anchor(LPCWSTR pszAnchor) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ANCHORW, 0, (LPARAM)pszAnchor); + } + +#if (_WIN32_WCE >= 420) + void GetBrowserDispatch(IDispatch** ppDispatch) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(ppDispatch); + ATLASSERT(*ppDispatch==NULL); + ::SendMessage(m_hWnd, DTM_BROWSERDISPATCH, 0, (LPARAM)ppDispatch); + } + void GetDocumentDispatch(IDispatch** ppDispatch) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(ppDispatch); + ATLASSERT(*ppDispatch==NULL); + ::SendMessage(m_hWnd, DTM_DOCUMENTDISPATCH , 0, (LPARAM)ppDispatch); + } +#endif // (_WIN32_WCE >= 420) + + void Clear() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_CLEAR, 0, 0L); + } + + void EnableClearType(BOOL bEnable = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ENABLECLEARTYPE, 0, (LPARAM)bEnable); + } + + void EnableContextMenu(BOOL bEnable = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ENABLECONTEXTMENU, 0, (LPARAM)bEnable); + } + + void EnableScripting(BOOL bEnable = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ENABLESCRIPTING, 0, (LPARAM)bEnable); + } + + void EnableShrink(BOOL bEnable = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ENABLESHRINK, 0, (LPARAM)bEnable); + } + + void EndOfSource() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ENDOFSOURCE, 0, 0L); + } + + void ImageFail(DWORD dwCookie) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_IMAGEFAIL, 0, (LPARAM)dwCookie); + } + + int GetLayoutHeight() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DTM_LAYOUTHEIGHT, 0, 0L); + } + + int GetLayoutWidth() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DTM_LAYOUTWIDTH, 0, 0L); + } + + void Navigate(LPCTSTR pstrURL, UINT uFlags = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrURL); + ::SendMessage(m_hWnd, DTM_NAVIGATE, (WPARAM)uFlags, (LPARAM)pstrURL); + } + + void SelectAll() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_SELECTALL, 0, 0L); + } + + void SetImage(INLINEIMAGEINFO* pImageInfo) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pImageInfo); + ::SendMessage(m_hWnd, DTM_SETIMAGE, 0, (LPARAM)pImageInfo); + } + + void ZoomLevel(int iLevel) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_ZOOMLEVEL, 0, (LPARAM)iLevel); + } + +#if (_WIN32_WCE >= 400) + void Stop() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DTM_STOP, 0, 0L); + } +#endif // (_WIN32_WCE >= 400) + + void GetScriptDispatch(IDispatch** ppDispatch) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(ppDispatch); + ATLASSERT(*ppDispatch==NULL); + ::SendMessage(m_hWnd, DTM_SCRIPTDISPATCH, 0, (LPARAM)ppDispatch); + } +}; + +typedef CHtmlCtrlT CHtmlCtrl; + + +#ifdef WIN32_PLATFORM_PSPC + +/////////////////////////////////////////////////////////////////////////////// +// CRichInkCtrl + +template +class CRichInkCtrlT : public TBase +{ +public: +// Constructors + CRichInkCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CRichInkCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + ATLASSERT(hWnd != NULL); // Did you remember to call InitRichInkDLL() ?? + return hWnd; + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_RICHINK; + } + + BOOL CanPaste(UINT uFormat = 0) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, (WPARAM)uFormat, 0L); + } + + BOOL CanRedo() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); + } + + BOOL CanUndo() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); + } + + void ClearAll(BOOL bRepaint = TRUE) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_CLEARALL, (WPARAM)bRepaint, 0L); + } + + BOOL GetModify() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); + } + + UINT GetPageStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETPAGESTYLE, 0, 0L); + } + + UINT GetPenMode() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETPENMODE, 0, 0L); + } + + UINT GetViewStyle() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETVIEW, 0, 0L); + } + + UINT GetWrapMode() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETWRAPMODE, 0, 0L); + } + + UINT GetZoomPercent() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_GETZOOMPERCENT, 0, 0L); + } + + void InsertLinks(LPWSTR lpString, int cchLength = -1) + { + ATLASSERT(::IsWindow(m_hWnd)); + if(cchLength == -1) + cchLength = lstrlen(lpString); + ::SendMessage(m_hWnd, EM_INSERTLINKS, (WPARAM)cchLength, (LPARAM)lpString); + } + + void RedoEvent() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_REDOEVENT, 0, 0L); + } + + UINT SetInkLayer(UINT uLayer) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (UINT)::SendMessage(m_hWnd, EM_SETINKLAYER, (WPARAM)uLayer, 0L); + } + + void SetPageStyle(UINT uStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETPAGESTYLE, (WPARAM)uStyle, 0L); + } + + void SetPenMode(UINT uMode) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETPENMODE, (WPARAM)uMode, 0L); + } + + void SetViewStyle(UINT uStyle) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETVIEW, (WPARAM)uStyle, 0L); + } + + void SetViewAttributes(VIEWATTRIBUTES* pAttribs) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pAttribs); + ::SendMessage(m_hWnd, EM_SETVIEWATTRIBUTES, 0, (LPARAM)pAttribs); + } + + void SetWrapMode(UINT uMode) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETWRAPMODE, (WPARAM)uMode, 0L); + } + + void SetZoomPercent(UINT uPercent) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETZOOMPERCENT, (WPARAM)uPercent, 0L); + } + + LONG StreamIn(UINT uFormat, EDITSTREAM& es) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, (WPARAM)uFormat, (LPARAM)&es); + } + + LONG StreamOut(UINT uFormat, EDITSTREAM& es) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, (WPARAM)uFormat, (LPARAM)&es); + } + + void UndoEvent() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_UNDOEVENT, 0, 0L); + } + +// Standard EM_xxx messages + DWORD GetSel() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); + } + + void GetSel(int& nStartChar, int& nEndChar) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); + } + + void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)lpszNewText); + } + + void SetModify(BOOL bModified = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, EM_SETMODIFY, (WPARAM)bModified, 0L); + } + + int GetTextLength() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); + } + +// Clipboard operations + void Clear() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + } + + void Copy() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + } + + void Cut() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + } + + void Paste() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); + } +}; + +typedef CRichInkCtrlT CRichInkCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CInkXCtrl + +template +class CInkXCtrlT : public TBase +{ +public: +// Constructors + CInkXCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CInkXCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + ATLASSERT(hWnd != NULL); // Did you remember to call InitInkX() ?? + return hWnd; + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_INKX; + } + + static UINT GetHotRecordingMessage() + { + return ::RegisterWindowMessage(szHotRecording); + } + + void ClearAll() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IM_CLEARALL, 0, 0L); + } + + int GetData(BYTE* lpBuffer, INT cbBuffer) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpBuffer); + return (int)::SendMessage(m_hWnd, IM_GETDATA, (WPARAM)cbBuffer, (LPARAM)lpBuffer); + } + + int GetDataLen() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, IM_GETDATALEN, 0, 0L); + } + + CRichInkCtrl GetRichInk() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HWND)::SendMessage(m_hWnd, IM_GETRICHINK, 0, 0L); + } + + BOOL IsRecording() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, IM_RECORDING, 0, 0L); + } + + void ReInit() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IM_REINIT, 0, 0L); + } + + void SetData(const BYTE* lpInkData, INT cbInkData) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(lpInkData); + ::SendMessage(m_hWnd, IM_SETDATA, (WPARAM)cbInkData, (LPARAM)lpInkData); + } + + void VoicePlay() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IM_VOICE_PLAY, 0, 0L); + } + + BOOL IsVoicePlaying() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, IM_VOICE_PLAYING, 0, 0L); + } + + BOOL VoiceRecord() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, IM_VOICE_RECORD, 0, 0L); + } + + void VoiceStop() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IM_VOICE_STOP, 0, 0L); + } + + void ShowVoiceBar(BOOL bShow = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, IM_VOICEBAR, (WPARAM)bShow, 0L); + } +}; + +typedef CInkXCtrlT CInkXCtrl; + +#endif // WIN32_PLATFORM_PSPC + + +/////////////////////////////////////////////////////////////////////////////// +// CVoiceRecorderCtrl + +template +class CVoiceRecorderCtrlT : public TBase +{ +public: +// Constructors + CVoiceRecorderCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CVoiceRecorderCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, const POINT pt, LPTSTR pstrFileName, UINT nID, DWORD dwStyle = 0) + { + ATLASSERT(pstrFileName != NULL); + CM_VOICE_RECORDER cmvr = { 0 }; + cmvr.cb = sizeof(CM_VOICE_RECORDER); + cmvr.dwStyle = dwStyle; + cmvr.xPos = pt.x; + cmvr.yPos = pt.y; + cmvr.hwndParent = hWndParent; + cmvr.id = nID; + cmvr.lpszRecordFileName = pstrFileName; + m_hWnd = VoiceRecorder_Create(&cmvr); + return m_hWnd; + } + + HWND Create(LPCM_VOICE_RECORDER pAttribs) + { + ATLASSERT(pAttribs); + m_hWnd = VoiceRecorder_Create(pAttribs); + return m_hWnd; + } + +// Attributes + void Record() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, VRM_RECORD, 0, 0L); + } + + void Play() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, VRM_PLAY, 0, 0L); + } + + void Stop() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, VRM_STOP, 0, 0L); + } + + void Cancel() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, VRM_CANCEL, 0, 0L); + } + + void Done() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, VRM_OK, 0, 0L); + } +}; + +typedef CVoiceRecorderCtrlT CVoiceRecorderCtrl; + + +#ifdef WIN32_PLATFORM_PSPC + +/////////////////////////////////////////////////////////////////////////////// +// CDocListCtrl + +template +class CDocListCtrlT : public TBase +{ +public: +// Attributes + DOCLISTCREATE m_dlc; + TCHAR m_szPath[MAX_PATH]; + +// Constructors + CDocListCtrlT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CDocListCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, WORD wId, LPCTSTR pszFolder = NULL, LPCTSTR pstrFilter = NULL, + WORD wFilterIndex = 0, DWORD dwFlags = DLF_SHOWEXTENSION) + { + ATLASSERT(pstrFilter != NULL); // It seems to need a filter badly!! + ::ZeroMemory(&m_dlc, sizeof(DOCLISTCREATE)); + ::ZeroMemory(m_szPath, sizeof(m_szPath)); + if(pszFolder != NULL) + ::lstrcpyn(m_szPath, pszFolder, MAX_PATH - 1); + m_dlc.dwStructSize = sizeof(DOCLISTCREATE); + m_dlc.hwndParent = hWndParent; + m_dlc.pszFolder = m_szPath; + m_dlc.pstrFilter = pstrFilter; + m_dlc.wFilterIndex = wFilterIndex; + m_dlc.wId = wId; + m_dlc.dwFlags = dwFlags; + m_hWnd = DocList_Create(&m_dlc); + return m_hWnd; + } + + HWND Create(DOCLISTCREATE* pDlc) + { + m_dlc = *pDlc; + m_hWnd = DocList_Create(&m_dlc); + return m_hWnd; + } + +// Attributes + void DeleteSel() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_DELETESEL, 0, 0L); + } + + void DisableUpdates() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_DISABLEUPDATES, 0, 0L); + } + + void EnableUpdates() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_ENABLEUPDATES, 0, 0L); + } + + int GetFilterIndex() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DLM_GETFILTERINDEX, 0, 0L); + } + + int GetItemCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DLM_GETITEMCOUNT, 0, 0L); + } + + int GetNextItem(int iIndex, DWORD dwRelation = LVNI_ALL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)iIndex, (LPARAM)dwRelation); + } + + int GetFirstItem(DWORD dwRelation = LVNI_ALL) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)-1, (LPARAM)dwRelation); + } + + BOOL GetNextWave(int* pIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pIndex); + return (BOOL)::SendMessage(m_hWnd, DLM_GETNEXTWAVE, 0, (LPARAM)pIndex); + } + + BOOL GetPrevWave(int* pIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pIndex); + return (BOOL)::SendMessage(m_hWnd, DLM_GETPREVWAVE, 0, (LPARAM)pIndex); + } + + int GetSelCount() const + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DLM_GETSELCOUNT, 0, 0L); + } + + BOOL GetSelPathName(LPTSTR pstrPath, int cchMax) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrPath); + return (BOOL)::SendMessage(m_hWnd, DLM_GETSELPATHNAME, (WPARAM)cchMax, (LPARAM)pstrPath); + } + + void ReceiveIR(LPCTSTR pstrPath) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrPath); + ::SendMessage(m_hWnd, DLM_RECEIVEIR, 0, (LPARAM)pstrPath); + } + + void Refresh() + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_REFRESH, 0, 0L); + } + + BOOL RenameMoveSelectedItems() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DLM_RENAMEMOVE, 0, 0L); + } + + int SelectAll() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (int)::SendMessage(m_hWnd, DLM_SELECTALL, 0, 0L); + } + + HRESULT SelectItem(LPCTSTR pstrPath, BOOL bVisible = TRUE) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrPath); + return (HRESULT)::SendMessage(m_hWnd, DLM_SELECTITEM, (WPARAM)bVisible, (LPARAM)pstrPath); + } + + void SendEMail(LPCTSTR pstrAttachment) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_SENDEMAIL, 0, (LPARAM)pstrAttachment); + } + + void SendIR(LPCTSTR pstrPath) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_SENDIR, 0, (LPARAM)pstrPath); + } + + HRESULT SetFilterIndex(int iIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HRESULT)::SendMessage(m_hWnd, DLM_SETFILTERINDEX, (WPARAM)iIndex, 0L); + } + + void SetFolder(LPCTSTR pstrPath) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrPath); + ::SendMessage(m_hWnd, DLM_SETFOLDER, 0, (LPARAM)pstrPath); + } + + BOOL SetItemState(int iIndex, const LVITEM* pItem) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pItem); + return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)pItem); + } + + BOOL SetItemState(int iIndex, UINT uState, UINT uMask) + { + ATLASSERT(::IsWindow(m_hWnd)); + LV_ITEM lvi = { 0 }; + lvi.stateMask = uMask; + lvi.state = uState; + return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)&lvi); + } + + void SetOneItem(int iIndex, LPCVOID pPA) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_SETONEITEM, (WPARAM)iIndex, (LPARAM)pPA); + } + + void SetSelect(int iIndex) + { + ATLASSERT(::IsWindow(m_hWnd)); + ::SendMessage(m_hWnd, DLM_SETSELECT, (WPARAM)iIndex, 0L); + } + + void SetSelPathName(LPCTSTR pstrPath) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrPath); + ::SendMessage(m_hWnd, DLM_SETSELPATHNAME, 0, (LPARAM)pstrPath); + } + + BOOL SetSortOrder() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DLM_SETSORTORDER, 0, 0L); + } + + HRESULT Update() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (HRESULT)::SendMessage(m_hWnd, DLM_UPDATE, 0, 0L); + } + + BOOL ValidateFolder() + { + ATLASSERT(::IsWindow(m_hWnd)); + return (BOOL)::SendMessage(m_hWnd, DLM_VALIDATEFOLDER, 0, 0L); + } + +// Functions + BOOL GetFirstSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) + { + ATLASSERT(::IsWindow(m_hWnd)); + return DocList_GetFirstSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); + } + + BOOL GetNextSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) + { + ATLASSERT(::IsWindow(m_hWnd)); + return DocList_GetNextSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); + } +}; + +typedef CDocListCtrlT CDocListCtrl; + +#endif // WIN32_PLATFORM_PSPC + + +/////////////////////////////////////////////////////////////////////////////// +// CCapEdit + +template +class CCapEditT : public TBase +{ +public: +// Constructors + CCapEditT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CCapEditT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = /*TBase*/CWindow::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? + return hWnd; + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_CAPEDIT; + } +}; + +typedef CCapEditT CCapEdit; + +/////////////////////////////////////////////////////////////////////////////// +// CTTStatic + +#ifndef WIN32_PLATFORM_WFSP // Tooltips not supported on SmartPhone + +template +class CTTStaticT : public TBase +{ +public: +// Constructors + CTTStaticT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CTTStaticT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? + return hWnd; + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_TSTATIC; + } + +// Operations + BOOL SetToolTipText(LPCTSTR pstrTipText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrTipText); + ATLASSERT(lstrlen(pstrTipText)<= 253); + CTempBuffer buff; + LPTSTR pstr = buff.Allocate(lstrlen(pstrTipText) + 3); + if(pstr == NULL) + return FALSE; + ::lstrcpy(pstr, _T("~~")); + ::lstrcat(pstr, pstrTipText); + return SetWindowText(pstr); + } +}; + +typedef CTTStaticT CTTStatic; + + +/////////////////////////////////////////////////////////////////////////////// +// CTTButton + +template +class CTTButtonT : public TBase +{ +public: +// Constructors + CTTButtonT(HWND hWnd = NULL) : TBase(hWnd) + { } + + CTTButtonT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); + ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? + return hWnd; + } + +// Attributes + static LPCTSTR GetWndClassName() + { + return WC_TBUTTON; + } + +// Operations + BOOL SetToolTipText(LPCTSTR pstrTipText) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(pstrTipText); + ATLASSERT(lstrlen(pstrTipText)<= 253); + CTempBuffer buff; + LPTSTR pstr = buff.Allocate(lstrlen(pstrTipText) + 3); + if(pstr == NULL) + return FALSE; + ::lstrcpy(pstr, _T("~~")); + ::lstrcat(pstr, pstrTipText); + return SetWindowText(pstr); + } +}; + +typedef CTTButtonT CTTButton; + +#endif // !WIN32_PLATFORM_WFSP + + +// --- SmartPhone specific controls --- + +#ifdef WIN32_PLATFORM_WFSP + +/////////////////////////////////////////////////////////////////////////////// +// CSpinCtrlT - CSpinCtrl : SmartPhone adapted UpDown control + +template +class CSpinCtrlT : public CUpDownCtrlT< TBase > +{ +public: +// Constructors + CSpinCtrlT(HWND hWnd = NULL) : CUpDownCtrlT< TBase >(hWnd) + { } + + CSpinCtrlT< TBase >& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; + } + + HWND Create(HWND hWndParent, HWND hBuddy, DWORD dwStyle, int nID, LPCTSTR szExpandedName = NULL) + { + ATLASSERT(::IsWindow(hWndParent)); + CUpDownCtrlT< TBase >::Create(hWndParent, NULL, szExpandedName, dwStyle, 0, nID, NULL); + ATLASSERT(m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? + if (hBuddy != NULL) + { + ATLASSERT(::IsWindow(hBuddy)); + SetBuddy(hBuddy); + } + return m_hWnd; + } +}; + +typedef CSpinCtrlT CSpinCtrl; + + +/////////////////////////////////////////////////////////////////////////////// +// CSpinned - SmartPhone association of control and Spin + +template +class CSpinned : public TBase +{ +public: + CSpinCtrl m_SpinCtrl; + DWORD m_dwSpinnedStyle; + +// Constructors + CSpinned(HWND hWnd = NULL) : TBase(hWnd) + { + m_dwSpinnedStyle = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_EXPANDABLE; + + if (t_bExpandOnly == true) + m_dwSpinnedStyle |= UDS_NOSCROLL; + else + m_dwSpinnedStyle |= UDS_HORZ | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_WRAP; + + if (hWnd != NULL) + AttachOrCreateSpinCtrl(); + } + + CSpinned& operator =(HWND hWnd) + { + Attach(hWnd); + return *this; + } + + void Attach(HWND hWnd) + { + ATLASSERT(!IsWindow()); + TBase* pT = static_cast(this); + pT->m_hWnd = hWnd; + if (hWnd != NULL) + AttachOrCreateSpinCtrl(); + } + + HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szExpandedName = NULL, + DWORD dwStyle = 0, DWORD dwExStyle = 0, + ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) + { + + TBase* pT = static_cast(this); + TBase::Create(hWndParent, rect, NULL, dwStyle, dwExStyle, MenuOrID, lpCreateParam); + ATLASSERT(pT->m_hWnd != NULL); + + m_SpinCtrl.Create(hWndParent, pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + (int)MenuOrID.m_hMenu, szExpandedName); + + ATLASSERT(m_SpinCtrl.m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? + + return pT->m_hWnd; + } + +// Attributes + CSpinCtrl& GetSpinCtrl() + { + return m_SpinCtrl; + } + +// Implementation + // Attach our existing SpinCtrl or create one + bool AttachOrCreateSpinCtrl() + { + TBase* pT = static_cast(this); + + HWND hSpin = ::GetDlgItem(pT->GetParent(), ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); + + if (hSpin != NULL) + { + m_SpinCtrl.Attach(hSpin); +#ifdef DEBUG + TCHAR sClassName[16]; + ::GetClassName(hSpin, sClassName, 16); + ATLASSERT(!_tcscmp(sClassName, UPDOWN_CLASS)); + ATLASSERT(m_SpinCtrl.GetBuddy().m_hWnd == pT->m_hWnd); +#endif // DEBUG + } + else + { + m_SpinCtrl.Create(pT->GetParent(), pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); + } + + return m_SpinCtrl.m_hWnd != NULL; + } +}; + + +/////////////////////////////////////////////////////////////////////////////// +// CSpinListBox - SmartPhone spinned ListBox control +// CExpandListBox - SmartPhone expandable ListBox control +// CExpandEdit - SmartPhone expandable Edit control +// CExpandCapEdit - SmartPhone expandable CapEdit control + +typedef CSpinned CSpinListBox; +typedef CSpinned CExpandListBox; +typedef CSpinned CExpandEdit; +typedef CSpinned CExpandCapEdit; + +#endif // WIN32_PLATFORM_WFSP + +#endif // _WTL_CE_NO_CONTROLS + +}; // namespace WTL + +#endif // __ATLWINCE_H__ diff --git a/Externals/WTL80/atlwinx.h b/Externals/WTL80/atlwinx.h index 9767fa1039..afa9efae5c 100644 --- a/Externals/WTL80/atlwinx.h +++ b/Externals/WTL80/atlwinx.h @@ -1,529 +1,529 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLWINX_H__ -#define __ATLWINX_H__ - -#pragma once - -#ifndef __cplusplus - #error ATL requires C++ compilation (use a .cpp suffix) -#endif - -#ifndef __ATLAPP_H__ - #error atlwinx.h requires atlapp.h to be included first -#endif - -#if (_ATL_VER >= 0x0700) - #include -#endif // (_ATL_VER >= 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// _U_RECT -// _U_MENUorID -// _U_STRINGorID - - -/////////////////////////////////////////////////////////////////////////////// -// Command Chaining Macros - -#define CHAIN_COMMANDS(theChainClass) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP(theChainClass) - -#define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP_ALT(theChainClass, msgMapID) - -#define CHAIN_COMMANDS_MEMBER(theChainMember) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP_MEMBER(theChainMember) - -#define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \ - if(uMsg == WM_COMMAND) \ - CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID) - - -/////////////////////////////////////////////////////////////////////////////// -// Macros for parent message map to selectively reflect control messages - -// NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot -// (and overridden in 2 cases - CContainedWindowT and CAxHostWindow) -// Since we can't modify ATL, we'll provide the needed additions -// in a separate function (that is not a member of CWindowImplRoot) - -namespace WTL -{ - -inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, - UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL) -{ - if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg)) - { - // The notification message doesn't match the filter. - bHandled = FALSE; - return 1; - } - - HWND hWndChild = NULL; - UINT_PTR idFrom = 0; - - switch(uMsg) - { - case WM_COMMAND: - if(lParam != NULL) // not from a menu - { - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)LOWORD(wParam); - } - break; - case WM_NOTIFY: - hWndChild = ((LPNMHDR)lParam)->hwndFrom; - idFrom = ((LPNMHDR)lParam)->idFrom; - break; -#ifndef _WIN32_WCE - case WM_PARENTNOTIFY: - switch(LOWORD(wParam)) - { - case WM_CREATE: - case WM_DESTROY: - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)HIWORD(wParam); - break; - default: - hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam)); - idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); - break; - } - break; -#endif // !_WIN32_WCE - case WM_DRAWITEM: - if(wParam) // not from a menu - { - hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem; - idFrom = (UINT_PTR)wParam; - } - break; - case WM_MEASUREITEM: - if(wParam) // not from a menu - { - hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID); - idFrom = (UINT_PTR)wParam; - } - break; - case WM_COMPAREITEM: - if(wParam) // not from a menu - { - hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem; - idFrom = (UINT_PTR)wParam; - } - break; - case WM_DELETEITEM: - if(wParam) // not from a menu - { - hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem; - idFrom = (UINT_PTR)wParam; - } - break; - case WM_VKEYTOITEM: - case WM_CHARTOITEM: - case WM_HSCROLL: - case WM_VSCROLL: - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); - break; - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - hWndChild = (HWND)lParam; - idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); - break; - default: - break; - } - - if((hWndChild == NULL) || - ((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild))) - { - // Either hWndChild isn't valid, or - // hWndChild doesn't match the filter. - bHandled = FALSE; - return 1; - } - - if((idFromFilter != 0) && (idFromFilter != idFrom)) - { - // The dialog control id doesn't match the filter. - bHandled = FALSE; - return 1; - } - - ATLASSERT(::IsWindow(hWndChild)); - LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam); - if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) - { - // Try to prevent problems with WM_CTLCOLOR* messages when - // the message wasn't really handled - bHandled = FALSE; - } - - return lResult; -} - -}; // namespace WTL - -// Try to prevent problems with WM_CTLCOLOR* messages when -// the message wasn't really handled -#define REFLECT_NOTIFICATIONS_EX() \ -{ \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \ - bHandled = FALSE; \ - if(bHandled) \ - return TRUE; \ -} - -#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \ - { \ - bHandled = TRUE; \ - lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND(id, code) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_ID(id) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_CODE(code) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_RANGE(idFirst, idLast) \ - if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY(id, cd) \ - if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_ID(id) \ - if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_CODE(cd) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \ - if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - - -/////////////////////////////////////////////////////////////////////////////// -// Reflected message handler macros for message maps (for ATL 3.0) - -#if (_ATL_VER < 0x0700) - -#define REFLECTED_COMMAND_HANDLER(id, code, func) \ - if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_ID_HANDLER(id, func) \ - if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \ - if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \ - if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \ - if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \ - if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -#endif // (_ATL_VER < 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// Dual argument helper classes (for ATL 3.0) - -#if (_ATL_VER < 0x0700) - -namespace ATL -{ - -class _U_RECT -{ -public: - _U_RECT(LPRECT lpRect) : m_lpRect(lpRect) - { } - _U_RECT(RECT& rc) : m_lpRect(&rc) - { } - LPRECT m_lpRect; -}; - -class _U_MENUorID -{ -public: - _U_MENUorID(HMENU hMenu) : m_hMenu(hMenu) - { } - _U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID)) - { } - HMENU m_hMenu; -}; - -class _U_STRINGorID -{ -public: - _U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString) - { } - _U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID)) - { } - LPCTSTR m_lpstr; -}; - -}; // namespace ATL - -#endif // (_ATL_VER < 0x0700) - - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// Forward notifications support for message maps (for ATL 3.0) - -#if (_ATL_VER < 0x0700) - -// forward notifications support -#define FORWARD_NOTIFICATIONS() \ - { \ - bHandled = TRUE; \ - lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ - } - -static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - LRESULT lResult = 0; - switch(uMsg) - { - case WM_COMMAND: - case WM_NOTIFY: -#ifndef _WIN32_WCE - case WM_PARENTNOTIFY: -#endif // !_WIN32_WCE - case WM_DRAWITEM: - case WM_MEASUREITEM: - case WM_COMPAREITEM: - case WM_DELETEITEM: - case WM_VKEYTOITEM: - case WM_CHARTOITEM: - case WM_HSCROLL: - case WM_VSCROLL: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam); - break; - default: - bHandled = FALSE; - break; - } - return lResult; -} - -#endif // (_ATL_VER < 0x0700) - -}; // namespace WTL - -#endif // __ATLWINX_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLWINX_H__ +#define __ATLWINX_H__ + +#pragma once + +#ifndef __cplusplus + #error ATL requires C++ compilation (use a .cpp suffix) +#endif + +#ifndef __ATLAPP_H__ + #error atlwinx.h requires atlapp.h to be included first +#endif + +#if (_ATL_VER >= 0x0700) + #include +#endif // (_ATL_VER >= 0x0700) + + +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// _U_RECT +// _U_MENUorID +// _U_STRINGorID + + +/////////////////////////////////////////////////////////////////////////////// +// Command Chaining Macros + +#define CHAIN_COMMANDS(theChainClass) \ + if(uMsg == WM_COMMAND) \ + CHAIN_MSG_MAP(theChainClass) + +#define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \ + if(uMsg == WM_COMMAND) \ + CHAIN_MSG_MAP_ALT(theChainClass, msgMapID) + +#define CHAIN_COMMANDS_MEMBER(theChainMember) \ + if(uMsg == WM_COMMAND) \ + CHAIN_MSG_MAP_MEMBER(theChainMember) + +#define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \ + if(uMsg == WM_COMMAND) \ + CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID) + + +/////////////////////////////////////////////////////////////////////////////// +// Macros for parent message map to selectively reflect control messages + +// NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot +// (and overridden in 2 cases - CContainedWindowT and CAxHostWindow) +// Since we can't modify ATL, we'll provide the needed additions +// in a separate function (that is not a member of CWindowImplRoot) + +namespace WTL +{ + +inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, + UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL) +{ + if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg)) + { + // The notification message doesn't match the filter. + bHandled = FALSE; + return 1; + } + + HWND hWndChild = NULL; + UINT_PTR idFrom = 0; + + switch(uMsg) + { + case WM_COMMAND: + if(lParam != NULL) // not from a menu + { + hWndChild = (HWND)lParam; + idFrom = (UINT_PTR)LOWORD(wParam); + } + break; + case WM_NOTIFY: + hWndChild = ((LPNMHDR)lParam)->hwndFrom; + idFrom = ((LPNMHDR)lParam)->idFrom; + break; +#ifndef _WIN32_WCE + case WM_PARENTNOTIFY: + switch(LOWORD(wParam)) + { + case WM_CREATE: + case WM_DESTROY: + hWndChild = (HWND)lParam; + idFrom = (UINT_PTR)HIWORD(wParam); + break; + default: + hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam)); + idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); + break; + } + break; +#endif // !_WIN32_WCE + case WM_DRAWITEM: + if(wParam) // not from a menu + { + hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem; + idFrom = (UINT_PTR)wParam; + } + break; + case WM_MEASUREITEM: + if(wParam) // not from a menu + { + hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID); + idFrom = (UINT_PTR)wParam; + } + break; + case WM_COMPAREITEM: + if(wParam) // not from a menu + { + hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem; + idFrom = (UINT_PTR)wParam; + } + break; + case WM_DELETEITEM: + if(wParam) // not from a menu + { + hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem; + idFrom = (UINT_PTR)wParam; + } + break; + case WM_VKEYTOITEM: + case WM_CHARTOITEM: + case WM_HSCROLL: + case WM_VSCROLL: + hWndChild = (HWND)lParam; + idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); + break; + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + hWndChild = (HWND)lParam; + idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); + break; + default: + break; + } + + if((hWndChild == NULL) || + ((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild))) + { + // Either hWndChild isn't valid, or + // hWndChild doesn't match the filter. + bHandled = FALSE; + return 1; + } + + if((idFromFilter != 0) && (idFromFilter != idFrom)) + { + // The dialog control id doesn't match the filter. + bHandled = FALSE; + return 1; + } + + ATLASSERT(::IsWindow(hWndChild)); + LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam); + if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) + { + // Try to prevent problems with WM_CTLCOLOR* messages when + // the message wasn't really handled + bHandled = FALSE; + } + + return lResult; +} + +}; // namespace WTL + +// Try to prevent problems with WM_CTLCOLOR* messages when +// the message wasn't really handled +#define REFLECT_NOTIFICATIONS_EX() \ +{ \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \ + bHandled = FALSE; \ + if(bHandled) \ + return TRUE; \ +} + +#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \ + { \ + bHandled = TRUE; \ + lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \ + { \ + bHandled = TRUE; \ + lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \ + { \ + bHandled = TRUE; \ + lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \ + { \ + bHandled = TRUE; \ + lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \ + { \ + bHandled = TRUE; \ + lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_COMMAND(id, code) \ + if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_COMMAND_ID(id) \ + if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_COMMAND_CODE(code) \ + if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_COMMAND_RANGE(idFirst, idLast) \ + if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \ + if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFY(id, cd) \ + if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFY_ID(id) \ + if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFY_CODE(cd) \ + if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \ + if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \ + if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + + +/////////////////////////////////////////////////////////////////////////////// +// Reflected message handler macros for message maps (for ATL 3.0) + +#if (_ATL_VER < 0x0700) + +#define REFLECTED_COMMAND_HANDLER(id, code, func) \ + if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ + { \ + bHandled = TRUE; \ + lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_COMMAND_ID_HANDLER(id, func) \ + if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ + { \ + bHandled = TRUE; \ + lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \ + if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ + { \ + bHandled = TRUE; \ + lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \ + if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \ + if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \ + if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ + { \ + bHandled = TRUE; \ + lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \ + if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + { \ + bHandled = TRUE; \ + lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \ + if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + { \ + bHandled = TRUE; \ + lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \ + if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \ + if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + { \ + bHandled = TRUE; \ + lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +#endif // (_ATL_VER < 0x0700) + + +/////////////////////////////////////////////////////////////////////////////// +// Dual argument helper classes (for ATL 3.0) + +#if (_ATL_VER < 0x0700) + +namespace ATL +{ + +class _U_RECT +{ +public: + _U_RECT(LPRECT lpRect) : m_lpRect(lpRect) + { } + _U_RECT(RECT& rc) : m_lpRect(&rc) + { } + LPRECT m_lpRect; +}; + +class _U_MENUorID +{ +public: + _U_MENUorID(HMENU hMenu) : m_hMenu(hMenu) + { } + _U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID)) + { } + HMENU m_hMenu; +}; + +class _U_STRINGorID +{ +public: + _U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString) + { } + _U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID)) + { } + LPCTSTR m_lpstr; +}; + +}; // namespace ATL + +#endif // (_ATL_VER < 0x0700) + + +namespace WTL +{ + +/////////////////////////////////////////////////////////////////////////////// +// Forward notifications support for message maps (for ATL 3.0) + +#if (_ATL_VER < 0x0700) + +// forward notifications support +#define FORWARD_NOTIFICATIONS() \ + { \ + bHandled = TRUE; \ + lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \ + if(bHandled) \ + return TRUE; \ + } + +static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + LRESULT lResult = 0; + switch(uMsg) + { + case WM_COMMAND: + case WM_NOTIFY: +#ifndef _WIN32_WCE + case WM_PARENTNOTIFY: +#endif // !_WIN32_WCE + case WM_DRAWITEM: + case WM_MEASUREITEM: + case WM_COMPAREITEM: + case WM_DELETEITEM: + case WM_VKEYTOITEM: + case WM_CHARTOITEM: + case WM_HSCROLL: + case WM_VSCROLL: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam); + break; + default: + bHandled = FALSE; + break; + } + return lResult; +} + +#endif // (_ATL_VER < 0x0700) + +}; // namespace WTL + +#endif // __ATLWINX_H__ diff --git a/Externals/WiiUse/Inc/wiiuse.h b/Externals/WiiUse/Inc/wiiuse.h index a70dc9e344..8b46c900f2 100644 --- a/Externals/WiiUse/Inc/wiiuse.h +++ b/Externals/WiiUse/Inc/wiiuse.h @@ -1,173 +1,173 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * - * @brief API header file. - * - * If this file is included from inside the wiiuse source - * and not from a third party program, then wiimote_internal.h - * is also included which extends this file. - */ - -#ifndef WIIUSE_H_INCLUDED -#define WIIUSE_H_INCLUDED - -#ifdef _WIN32 - /* windows */ - #include -#else - /* nix */ - #include -#endif - -#ifdef WIIUSE_INTERNAL_H_INCLUDED - #define WCONST -#else - #define WCONST const -#endif - -/* led bit masks */ -#define WIIMOTE_LED_NONE 0x00 -#define WIIMOTE_LED_1 0x10 -#define WIIMOTE_LED_2 0x20 -#define WIIMOTE_LED_3 0x40 -#define WIIMOTE_LED_4 0x80 - -/* button codes */ -#define WIIMOTE_BUTTON_TWO 0x0001 -#define WIIMOTE_BUTTON_ONE 0x0002 -#define WIIMOTE_BUTTON_B 0x0004 -#define WIIMOTE_BUTTON_A 0x0008 -#define WIIMOTE_BUTTON_MINUS 0x0010 -#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 -#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 -#define WIIMOTE_BUTTON_HOME 0x0080 -#define WIIMOTE_BUTTON_LEFT 0x0100 -#define WIIMOTE_BUTTON_RIGHT 0x0200 -#define WIIMOTE_BUTTON_DOWN 0x0400 -#define WIIMOTE_BUTTON_UP 0x0800 -#define WIIMOTE_BUTTON_PLUS 0x1000 -#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 -#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 -#define WIIMOTE_BUTTON_UNKNOWN 0x8000 -#define WIIMOTE_BUTTON_ALL 0x1F9F - -/* nunchul button codes */ -#define NUNCHUK_BUTTON_Z 0x01 -#define NUNCHUK_BUTTON_C 0x02 -#define NUNCHUK_BUTTON_ALL 0x03 - -/* classic controller button codes */ -#define CLASSIC_CTRL_BUTTON_UP 0x0001 -#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 -#define CLASSIC_CTRL_BUTTON_ZR 0x0004 -#define CLASSIC_CTRL_BUTTON_X 0x0008 -#define CLASSIC_CTRL_BUTTON_A 0x0010 -#define CLASSIC_CTRL_BUTTON_Y 0x0020 -#define CLASSIC_CTRL_BUTTON_B 0x0040 -#define CLASSIC_CTRL_BUTTON_ZL 0x0080 -#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 -#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 -#define CLASSIC_CTRL_BUTTON_HOME 0x0800 -#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 -#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 -#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 -#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 -#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF - -/* guitar hero 3 button codes */ -#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 -#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 -#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 -#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 -#define GUITAR_HERO_3_BUTTON_RED 0x0040 -#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 -#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 -#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 -#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 -#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF - - -/* wiimote option flags */ -#define WIIUSE_SMOOTHING 0x01 -#define WIIUSE_CONTINUOUS 0x02 -#define WIIUSE_ORIENT_THRESH 0x04 -#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) - -#define WIIUSE_ORIENT_PRECISION 100.0f - -/* expansion codes */ -#define EXP_NONE 0 -#define EXP_NUNCHUK 1 -#define EXP_CLASSIC 2 -#define EXP_GUITAR_HERO_3 3 - -/* IR correction types */ -typedef enum ir_position_t { - WIIUSE_IR_ABOVE, - WIIUSE_IR_BELOW -} ir_position_t; - -/** - * @brief Check if a button is pressed. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ -#define IS_PRESSED(dev, button) ((dev->btns & button) == button) - -/** - * @brief Check if a button is being held. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is held, 0 if not. - */ -#define IS_HELD(dev, button) ((dev->btns_held & button) == button) - -/** - * @brief Check if a button is released on this event. \n\n - * This does not mean the button is not pressed, it means \n - * this button was just now released. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is released, 0 if not. - * - */ -#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) - -/** - * @brief Check if a button has just been pressed this event. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * + * @brief API header file. + * + * If this file is included from inside the wiiuse source + * and not from a third party program, then wiimote_internal.h + * is also included which extends this file. + */ + +#ifndef WIIUSE_H_INCLUDED +#define WIIUSE_H_INCLUDED + +#ifdef _WIN32 + /* windows */ + #include +#else + /* nix */ + #include +#endif + +#ifdef WIIUSE_INTERNAL_H_INCLUDED + #define WCONST +#else + #define WCONST const +#endif + +/* led bit masks */ +#define WIIMOTE_LED_NONE 0x00 +#define WIIMOTE_LED_1 0x10 +#define WIIMOTE_LED_2 0x20 +#define WIIMOTE_LED_3 0x40 +#define WIIMOTE_LED_4 0x80 + +/* button codes */ +#define WIIMOTE_BUTTON_TWO 0x0001 +#define WIIMOTE_BUTTON_ONE 0x0002 +#define WIIMOTE_BUTTON_B 0x0004 +#define WIIMOTE_BUTTON_A 0x0008 +#define WIIMOTE_BUTTON_MINUS 0x0010 +#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 +#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 +#define WIIMOTE_BUTTON_HOME 0x0080 +#define WIIMOTE_BUTTON_LEFT 0x0100 +#define WIIMOTE_BUTTON_RIGHT 0x0200 +#define WIIMOTE_BUTTON_DOWN 0x0400 +#define WIIMOTE_BUTTON_UP 0x0800 +#define WIIMOTE_BUTTON_PLUS 0x1000 +#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 +#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 +#define WIIMOTE_BUTTON_UNKNOWN 0x8000 +#define WIIMOTE_BUTTON_ALL 0x1F9F + +/* nunchul button codes */ +#define NUNCHUK_BUTTON_Z 0x01 +#define NUNCHUK_BUTTON_C 0x02 +#define NUNCHUK_BUTTON_ALL 0x03 + +/* classic controller button codes */ +#define CLASSIC_CTRL_BUTTON_UP 0x0001 +#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 +#define CLASSIC_CTRL_BUTTON_ZR 0x0004 +#define CLASSIC_CTRL_BUTTON_X 0x0008 +#define CLASSIC_CTRL_BUTTON_A 0x0010 +#define CLASSIC_CTRL_BUTTON_Y 0x0020 +#define CLASSIC_CTRL_BUTTON_B 0x0040 +#define CLASSIC_CTRL_BUTTON_ZL 0x0080 +#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 +#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 +#define CLASSIC_CTRL_BUTTON_HOME 0x0800 +#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 +#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 +#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 +#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 +#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF + +/* guitar hero 3 button codes */ +#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 +#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 +#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 +#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 +#define GUITAR_HERO_3_BUTTON_RED 0x0040 +#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 +#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 +#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 +#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 +#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF + + +/* wiimote option flags */ +#define WIIUSE_SMOOTHING 0x01 +#define WIIUSE_CONTINUOUS 0x02 +#define WIIUSE_ORIENT_THRESH 0x04 +#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) + +#define WIIUSE_ORIENT_PRECISION 100.0f + +/* expansion codes */ +#define EXP_NONE 0 +#define EXP_NUNCHUK 1 +#define EXP_CLASSIC 2 +#define EXP_GUITAR_HERO_3 3 + +/* IR correction types */ +typedef enum ir_position_t { + WIIUSE_IR_ABOVE, + WIIUSE_IR_BELOW +} ir_position_t; + +/** + * @brief Check if a button is pressed. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ +#define IS_PRESSED(dev, button) ((dev->btns & button) == button) + +/** + * @brief Check if a button is being held. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is held, 0 if not. + */ +#define IS_HELD(dev, button) ((dev->btns_held & button) == button) + +/** + * @brief Check if a button is released on this event. \n\n + * This does not mean the button is not pressed, it means \n + * this button was just now released. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is released, 0 if not. + * + */ +#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) + +/** + * @brief Check if a button has just been pressed this event. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ #define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button)) /** @@ -185,457 +185,457 @@ typedef enum ir_position_t { else if ((wm->state & 0x2000) == 0x2000) *lvl = 5; \ else *lvl = 0; \ } while (0) - -#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) -#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) -#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) -#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) - -#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) - -/* - * Largest known payload is 21 bytes. - * Add 2 for the prefix and round up to a power of 2. - */ -#define MAX_PAYLOAD 32 - -/* - * This is left over from an old hack, but it may actually - * be a useful feature to keep so it wasn't removed. - */ -#ifdef WIN32 - #define WIIMOTE_DEFAULT_TIMEOUT 10 - #define WIIMOTE_EXP_TIMEOUT 10 -#endif - -typedef unsigned char byte; -typedef char sbyte; - -struct wiimote_t; -struct vec3b_t; -struct orient_t; -struct gforce_t; - - -/** - * @brief Callback that handles a read event. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Pointer to the filled data block. - * @param len Length in bytes of the data block. - * - * @see wiiuse_init() - * - * A registered function of this type is called automatically by the wiiuse - * library when the wiimote has returned the full data requested by a previous - * call to wiiuse_read_data(). - */ -typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len); - - -/** - * @struct read_req_t - * @brief Data read request structure. - */ -struct read_req_t { - wiiuse_read_cb cb; /**< read data callback */ - byte* buf; /**< buffer where read data is written */ - unsigned int addr; /**< the offset that the read started at */ - unsigned short size; /**< the length of the data read */ + +#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) +#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) +#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) +#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) + +#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) + +/* + * Largest known payload is 21 bytes. + * Add 2 for the prefix and round up to a power of 2. + */ +#define MAX_PAYLOAD 32 + +/* + * This is left over from an old hack, but it may actually + * be a useful feature to keep so it wasn't removed. + */ +#ifdef WIN32 + #define WIIMOTE_DEFAULT_TIMEOUT 10 + #define WIIMOTE_EXP_TIMEOUT 10 +#endif + +typedef unsigned char byte; +typedef char sbyte; + +struct wiimote_t; +struct vec3b_t; +struct orient_t; +struct gforce_t; + + +/** + * @brief Callback that handles a read event. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Pointer to the filled data block. + * @param len Length in bytes of the data block. + * + * @see wiiuse_init() + * + * A registered function of this type is called automatically by the wiiuse + * library when the wiimote has returned the full data requested by a previous + * call to wiiuse_read_data(). + */ +typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len); + + +/** + * @struct read_req_t + * @brief Data read request structure. + */ +struct read_req_t { + wiiuse_read_cb cb; /**< read data callback */ + byte* buf; /**< buffer where read data is written */ + unsigned int addr; /**< the offset that the read started at */ + unsigned short size; /**< the length of the data read */ unsigned short wait; /**< num bytes still needed to finish read */ - byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ - - struct read_req_t* next; /**< next read request in the queue */ -}; - - -/** - * @struct vec2b_t - * @brief Unsigned x,y byte vector. - */ -typedef struct vec2b_t { - byte x, y; -} vec2b_t; - - -/** - * @struct vec3b_t - * @brief Unsigned x,y,z byte vector. - */ -typedef struct vec3b_t { - byte x, y, z; -} vec3b_t; - - -/** - * @struct vec3f_t - * @brief Signed x,y,z float struct. - */ -typedef struct vec3f_t { - float x, y, z; -} vec3f_t; - - -/** - * @struct orient_t - * @brief Orientation struct. - * - * Yaw, pitch, and roll range from -180 to 180 degrees. - */ -typedef struct orient_t { - float roll; /**< roll, this may be smoothed if enabled */ - float pitch; /**< pitch, this may be smoothed if enabled */ - float yaw; - - float a_roll; /**< absolute roll, unsmoothed */ - float a_pitch; /**< absolute pitch, unsmoothed */ -} orient_t; - - -/** - * @struct gforce_t - * @brief Gravity force struct. - */ -typedef struct gforce_t { - float x, y, z; -} gforce_t; - - -/** - * @struct accel_t - * @brief Accelerometer struct. For any device with an accelerometer. - */ -typedef struct accel_t { - struct vec3b_t cal_zero; /**< zero calibration */ - struct vec3b_t cal_g; /**< 1g difference around 0cal */ - - float st_roll; /**< last smoothed roll value */ - float st_pitch; /**< last smoothed roll pitch */ - float st_alpha; /**< alpha value for smoothing [0-1] */ -} accel_t; - - -/** - * @struct ir_dot_t - * @brief A single IR source. - */ -typedef struct ir_dot_t { - byte visible; /**< if the IR source is visible */ - - unsigned int x; /**< interpolated X coordinate */ - unsigned int y; /**< interpolated Y coordinate */ - - short rx; /**< raw X coordinate (0-1023) */ - short ry; /**< raw Y coordinate (0-767) */ - - byte order; /**< increasing order by x-axis value */ - - byte size; /**< size of the IR dot (0-15) */ -} ir_dot_t; - - -/** - * @enum aspect_t - * @brief Screen aspect ratio. - */ -typedef enum aspect_t { - WIIUSE_ASPECT_4_3, - WIIUSE_ASPECT_16_9 -} aspect_t; - - -/** - * @struct ir_t - * @brief IR struct. Hold all data related to the IR tracking. - */ -typedef struct ir_t { - struct ir_dot_t dot[4]; /**< IR dots */ - byte num_dots; /**< number of dots at this time */ - - enum aspect_t aspect; /**< aspect ratio of the screen */ - - enum ir_position_t pos; /**< IR sensor bar position */ - - unsigned int vres[2]; /**< IR virtual screen resolution */ - int offset[2]; /**< IR XY correction offset */ - int state; /**< keeps track of the IR state */ - - int ax; /**< absolute X coordinate */ - int ay; /**< absolute Y coordinate */ - - int x; /**< calculated X coordinate */ - int y; /**< calculated Y coordinate */ - - float distance; /**< pixel distance between first 2 dots*/ - float z; /**< calculated distance */ -} ir_t; - - -/** - * @struct joystick_t - * @brief Joystick calibration structure. - * - * The angle \a ang is relative to the positive y-axis into quadrant I - * and ranges from 0 to 360 degrees. So if the joystick is held straight - * upwards then angle is 0 degrees. If it is held to the right it is 90, - * down is 180, and left is 270. - * - * The magnitude \a mag is the distance from the center to where the - * joystick is being held. The magnitude ranges from 0 to 1. - * If the joystick is only slightly tilted from the center the magnitude - * will be low, but if it is closer to the outter edge the value will - * be higher. - */ -typedef struct joystick_t { - struct vec2b_t max; /**< maximum joystick values */ - struct vec2b_t min; /**< minimum joystick values */ - struct vec2b_t center; /**< center joystick values */ - - float ang; /**< angle the joystick is being held */ - float mag; /**< magnitude of the joystick (range 0-1) */ -} joystick_t; - - -/** - * @struct nunchuk_t - * @brief Nunchuk expansion device. - */ -typedef struct nunchuk_t { - struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ - struct joystick_t js; /**< joystick calibration */ - - int* flags; /**< options flag (points to wiimote_t.flags) */ - - byte btns; /**< what buttons have just been pressed */ - byte btns_held; /**< what buttons are being held down */ - byte btns_released; /**< what buttons were just released this */ + byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ + + struct read_req_t* next; /**< next read request in the queue */ +}; + + +/** + * @struct vec2b_t + * @brief Unsigned x,y byte vector. + */ +typedef struct vec2b_t { + byte x, y; +} vec2b_t; + + +/** + * @struct vec3b_t + * @brief Unsigned x,y,z byte vector. + */ +typedef struct vec3b_t { + byte x, y, z; +} vec3b_t; + + +/** + * @struct vec3f_t + * @brief Signed x,y,z float struct. + */ +typedef struct vec3f_t { + float x, y, z; +} vec3f_t; + + +/** + * @struct orient_t + * @brief Orientation struct. + * + * Yaw, pitch, and roll range from -180 to 180 degrees. + */ +typedef struct orient_t { + float roll; /**< roll, this may be smoothed if enabled */ + float pitch; /**< pitch, this may be smoothed if enabled */ + float yaw; + + float a_roll; /**< absolute roll, unsmoothed */ + float a_pitch; /**< absolute pitch, unsmoothed */ +} orient_t; + + +/** + * @struct gforce_t + * @brief Gravity force struct. + */ +typedef struct gforce_t { + float x, y, z; +} gforce_t; + + +/** + * @struct accel_t + * @brief Accelerometer struct. For any device with an accelerometer. + */ +typedef struct accel_t { + struct vec3b_t cal_zero; /**< zero calibration */ + struct vec3b_t cal_g; /**< 1g difference around 0cal */ + + float st_roll; /**< last smoothed roll value */ + float st_pitch; /**< last smoothed roll pitch */ + float st_alpha; /**< alpha value for smoothing [0-1] */ +} accel_t; + + +/** + * @struct ir_dot_t + * @brief A single IR source. + */ +typedef struct ir_dot_t { + byte visible; /**< if the IR source is visible */ + + unsigned int x; /**< interpolated X coordinate */ + unsigned int y; /**< interpolated Y coordinate */ + + short rx; /**< raw X coordinate (0-1023) */ + short ry; /**< raw Y coordinate (0-767) */ + + byte order; /**< increasing order by x-axis value */ + + byte size; /**< size of the IR dot (0-15) */ +} ir_dot_t; + + +/** + * @enum aspect_t + * @brief Screen aspect ratio. + */ +typedef enum aspect_t { + WIIUSE_ASPECT_4_3, + WIIUSE_ASPECT_16_9 +} aspect_t; + + +/** + * @struct ir_t + * @brief IR struct. Hold all data related to the IR tracking. + */ +typedef struct ir_t { + struct ir_dot_t dot[4]; /**< IR dots */ + byte num_dots; /**< number of dots at this time */ + + enum aspect_t aspect; /**< aspect ratio of the screen */ + + enum ir_position_t pos; /**< IR sensor bar position */ + + unsigned int vres[2]; /**< IR virtual screen resolution */ + int offset[2]; /**< IR XY correction offset */ + int state; /**< keeps track of the IR state */ + + int ax; /**< absolute X coordinate */ + int ay; /**< absolute Y coordinate */ + + int x; /**< calculated X coordinate */ + int y; /**< calculated Y coordinate */ + + float distance; /**< pixel distance between first 2 dots*/ + float z; /**< calculated distance */ +} ir_t; + + +/** + * @struct joystick_t + * @brief Joystick calibration structure. + * + * The angle \a ang is relative to the positive y-axis into quadrant I + * and ranges from 0 to 360 degrees. So if the joystick is held straight + * upwards then angle is 0 degrees. If it is held to the right it is 90, + * down is 180, and left is 270. + * + * The magnitude \a mag is the distance from the center to where the + * joystick is being held. The magnitude ranges from 0 to 1. + * If the joystick is only slightly tilted from the center the magnitude + * will be low, but if it is closer to the outter edge the value will + * be higher. + */ +typedef struct joystick_t { + struct vec2b_t max; /**< maximum joystick values */ + struct vec2b_t min; /**< minimum joystick values */ + struct vec2b_t center; /**< center joystick values */ + + float ang; /**< angle the joystick is being held */ + float mag; /**< magnitude of the joystick (range 0-1) */ +} joystick_t; + + +/** + * @struct nunchuk_t + * @brief Nunchuk expansion device. + */ +typedef struct nunchuk_t { + struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ + struct joystick_t js; /**< joystick calibration */ + + int* flags; /**< options flag (points to wiimote_t.flags) */ + + byte btns; /**< what buttons have just been pressed */ + byte btns_held; /**< what buttons are being held down */ + byte btns_released; /**< what buttons were just released this */ float orient_threshold; /**< threshold for orient to generate an event */ int accel_threshold; /**< threshold for accel to generate an event */ - - struct vec3b_t accel; /**< current raw acceleration data */ - struct orient_t orient; /**< current orientation on each axis */ - struct gforce_t gforce; /**< current gravity forces on each axis */ -} nunchuk_t; - - -/** - * @struct classic_ctrl_t - * @brief Classic controller expansion device. - */ -typedef struct classic_ctrl_t { - short btns; /**< what buttons have just been pressed */ - short btns_held; /**< what buttons are being held down */ - short btns_released; /**< what buttons were just released this */ - - float r_shoulder; /**< right shoulder button (range 0-1) */ - float l_shoulder; /**< left shoulder button (range 0-1) */ - - struct joystick_t ljs; /**< left joystick calibration */ - struct joystick_t rjs; /**< right joystick calibration */ -} classic_ctrl_t; - - -/** - * @struct guitar_hero_3_t - * @brief Guitar Hero 3 expansion device. - */ -typedef struct guitar_hero_3_t { - short btns; /**< what buttons have just been pressed */ - short btns_held; /**< what buttons are being held down */ - short btns_released; /**< what buttons were just released this */ - - float whammy_bar; /**< whammy bar (range 0-1) */ - - struct joystick_t js; /**< joystick calibration */ -} guitar_hero_3_t; - - -/** - * @struct expansion_t - * @brief Generic expansion device plugged into wiimote. - */ -typedef struct expansion_t { - int type; /**< type of expansion attached */ - - union { - struct nunchuk_t nunchuk; - struct classic_ctrl_t classic; - struct guitar_hero_3_t gh3; - }; -} expansion_t; - - -/** - * @enum win32_bt_stack_t - * @brief Available bluetooth stacks for Windows. - */ -typedef enum win_bt_stack_t { - WIIUSE_STACK_UNKNOWN, - WIIUSE_STACK_MS, - WIIUSE_STACK_BLUESOLEIL -} win_bt_stack_t; - - -/** - * @struct wiimote_state_t - * @brief Significant data from the previous event. - */ -typedef struct wiimote_state_t { - /* expansion_t */ - float exp_ljs_ang; - float exp_rjs_ang; - float exp_ljs_mag; - float exp_rjs_mag; - unsigned short exp_btns; - struct orient_t exp_orient; + + struct vec3b_t accel; /**< current raw acceleration data */ + struct orient_t orient; /**< current orientation on each axis */ + struct gforce_t gforce; /**< current gravity forces on each axis */ +} nunchuk_t; + + +/** + * @struct classic_ctrl_t + * @brief Classic controller expansion device. + */ +typedef struct classic_ctrl_t { + short btns; /**< what buttons have just been pressed */ + short btns_held; /**< what buttons are being held down */ + short btns_released; /**< what buttons were just released this */ + + float r_shoulder; /**< right shoulder button (range 0-1) */ + float l_shoulder; /**< left shoulder button (range 0-1) */ + + struct joystick_t ljs; /**< left joystick calibration */ + struct joystick_t rjs; /**< right joystick calibration */ +} classic_ctrl_t; + + +/** + * @struct guitar_hero_3_t + * @brief Guitar Hero 3 expansion device. + */ +typedef struct guitar_hero_3_t { + short btns; /**< what buttons have just been pressed */ + short btns_held; /**< what buttons are being held down */ + short btns_released; /**< what buttons were just released this */ + + float whammy_bar; /**< whammy bar (range 0-1) */ + + struct joystick_t js; /**< joystick calibration */ +} guitar_hero_3_t; + + +/** + * @struct expansion_t + * @brief Generic expansion device plugged into wiimote. + */ +typedef struct expansion_t { + int type; /**< type of expansion attached */ + + union { + struct nunchuk_t nunchuk; + struct classic_ctrl_t classic; + struct guitar_hero_3_t gh3; + }; +} expansion_t; + + +/** + * @enum win32_bt_stack_t + * @brief Available bluetooth stacks for Windows. + */ +typedef enum win_bt_stack_t { + WIIUSE_STACK_UNKNOWN, + WIIUSE_STACK_MS, + WIIUSE_STACK_BLUESOLEIL +} win_bt_stack_t; + + +/** + * @struct wiimote_state_t + * @brief Significant data from the previous event. + */ +typedef struct wiimote_state_t { + /* expansion_t */ + float exp_ljs_ang; + float exp_rjs_ang; + float exp_ljs_mag; + float exp_rjs_mag; + unsigned short exp_btns; + struct orient_t exp_orient; struct vec3b_t exp_accel; - float exp_r_shoulder; - float exp_l_shoulder; - - /* ir_t */ - int ir_ax; - int ir_ay; - float ir_distance; - - struct orient_t orient; - unsigned short btns; - - struct vec3b_t accel; -} wiimote_state_t; - - -/** - * @enum WIIUSE_EVENT_TYPE - * @brief Events that wiiuse can generate from a poll. - */ -typedef enum WIIUSE_EVENT_TYPE { - WIIUSE_NONE = 0, - WIIUSE_EVENT, + float exp_r_shoulder; + float exp_l_shoulder; + + /* ir_t */ + int ir_ax; + int ir_ay; + float ir_distance; + + struct orient_t orient; + unsigned short btns; + + struct vec3b_t accel; +} wiimote_state_t; + + +/** + * @enum WIIUSE_EVENT_TYPE + * @brief Events that wiiuse can generate from a poll. + */ +typedef enum WIIUSE_EVENT_TYPE { + WIIUSE_NONE = 0, + WIIUSE_EVENT, WIIUSE_STATUS, - WIIUSE_CONNECT, + WIIUSE_CONNECT, WIIUSE_DISCONNECT, WIIUSE_UNEXPECTED_DISCONNECT, WIIUSE_READ_DATA, - WIIUSE_NUNCHUK_INSERTED, + WIIUSE_NUNCHUK_INSERTED, WIIUSE_NUNCHUK_REMOVED, WIIUSE_CLASSIC_CTRL_INSERTED, WIIUSE_CLASSIC_CTRL_REMOVED, WIIUSE_GUITAR_HERO_3_CTRL_INSERTED, WIIUSE_GUITAR_HERO_3_CTRL_REMOVED -} WIIUSE_EVENT_TYPE; - -/** - * @struct wiimote_t - * @brief Wiimote structure. - */ -typedef struct wiimote_t { - WCONST int unid; /**< user specified id */ - - #ifndef WIN32 - WCONST bdaddr_t bdaddr; /**< bt address */ - WCONST char bdaddr_str[18]; /**< readable bt address */ - WCONST int out_sock; /**< output socket */ - WCONST int in_sock; /**< input socket */ - #else - WCONST HANDLE dev_handle; /**< HID handle */ - WCONST OVERLAPPED hid_overlap; /**< overlap handle */ - WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ - WCONST int timeout; /**< read timeout */ - WCONST byte normal_timeout; /**< normal timeout */ - WCONST byte exp_timeout; /**< timeout for expansion handshake */ - #endif - - WCONST int state; /**< various state flags */ - WCONST byte leds; /**< currently lit leds */ - WCONST float battery_level; /**< battery level */ - +} WIIUSE_EVENT_TYPE; + +/** + * @struct wiimote_t + * @brief Wiimote structure. + */ +typedef struct wiimote_t { + WCONST int unid; /**< user specified id */ + + #ifndef WIN32 + WCONST bdaddr_t bdaddr; /**< bt address */ + WCONST char bdaddr_str[18]; /**< readable bt address */ + WCONST int out_sock; /**< output socket */ + WCONST int in_sock; /**< input socket */ + #else + WCONST HANDLE dev_handle; /**< HID handle */ + WCONST OVERLAPPED hid_overlap; /**< overlap handle */ + WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ + WCONST int timeout; /**< read timeout */ + WCONST byte normal_timeout; /**< normal timeout */ + WCONST byte exp_timeout; /**< timeout for expansion handshake */ + #endif + + WCONST int state; /**< various state flags */ + WCONST byte leds; /**< currently lit leds */ + WCONST float battery_level; /**< battery level */ + WCONST int flags; /**< options flag */ - WCONST byte handshake_state; /**< the state of the connection handshake */ - - WCONST struct read_req_t* read_req; /**< list of data read requests */ - WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ - WCONST struct expansion_t exp; /**< wiimote expansion device */ - - WCONST struct vec3b_t accel; /**< current raw acceleration data */ - WCONST struct orient_t orient; /**< current orientation on each axis */ - WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ - - WCONST struct ir_t ir; /**< IR data */ - - WCONST unsigned short btns; /**< what buttons have just been pressed */ - WCONST unsigned short btns_held; /**< what buttons are being held down */ - WCONST unsigned short btns_released; /**< what buttons were just released this */ - - WCONST float orient_threshold; /**< threshold for orient to generate an event */ - WCONST int accel_threshold; /**< threshold for accel to generate an event */ - - WCONST struct wiimote_state_t lstate; /**< last saved state */ - - WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */ - WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */ -} wiimote; - - -/***************************************** - * - * Include API specific stuff - * - *****************************************/ - -#ifdef _WIN32 - #define WIIUSE_EXPORT_DECL __declspec(dllexport) - #define WIIUSE_IMPORT_DECL __declspec(dllimport) -#else - #define WIIUSE_EXPORT_DECL - #define WIIUSE_IMPORT_DECL -#endif - -#ifdef WIIUSE_COMPILE_LIB - #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL -#else - #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* wiiuse.c */ -WIIUSE_EXPORT extern const char* wiiuse_version(); - -WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); -WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); -WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); -WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, unsigned short len); -WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len); -WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); -WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); -WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); -WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); -WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); -WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); -WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); -WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); - -/* connect.c */ -WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); -WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); -WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); - -/* events.c */ -WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); - -/* ir.c */ -WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); -WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); + WCONST byte handshake_state; /**< the state of the connection handshake */ + + WCONST struct read_req_t* read_req; /**< list of data read requests */ + WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ + WCONST struct expansion_t exp; /**< wiimote expansion device */ + + WCONST struct vec3b_t accel; /**< current raw acceleration data */ + WCONST struct orient_t orient; /**< current orientation on each axis */ + WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ + + WCONST struct ir_t ir; /**< IR data */ + + WCONST unsigned short btns; /**< what buttons have just been pressed */ + WCONST unsigned short btns_held; /**< what buttons are being held down */ + WCONST unsigned short btns_released; /**< what buttons were just released this */ + + WCONST float orient_threshold; /**< threshold for orient to generate an event */ + WCONST int accel_threshold; /**< threshold for accel to generate an event */ + + WCONST struct wiimote_state_t lstate; /**< last saved state */ + + WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */ + WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */ +} wiimote; + + +/***************************************** + * + * Include API specific stuff + * + *****************************************/ + +#ifdef _WIN32 + #define WIIUSE_EXPORT_DECL __declspec(dllexport) + #define WIIUSE_IMPORT_DECL __declspec(dllimport) +#else + #define WIIUSE_EXPORT_DECL + #define WIIUSE_IMPORT_DECL +#endif + +#ifdef WIIUSE_COMPILE_LIB + #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL +#else + #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* wiiuse.c */ +WIIUSE_EXPORT extern const char* wiiuse_version(); + +WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); +WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, unsigned short len); +WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len); +WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); +WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); +WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); +WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); +WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); +WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); +WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); +WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); + +/* connect.c */ +WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); +WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); + +/* events.c */ +WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); + +/* ir.c */ +WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); +WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); WIIUSE_EXPORT extern void wiiuse_set_aspect_ratio(struct wiimote_t* wm, enum aspect_t aspect); WIIUSE_EXPORT extern void wiiuse_set_ir_sensitivity(struct wiimote_t* wm, int level); @@ -646,12 +646,12 @@ WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* w /* io.c */ WIIUSE_EXPORT extern int wiiuse_io_read(struct wiimote_t* wm); WIIUSE_EXPORT extern int wiiuse_io_write(struct wiimote_t* wm, byte* buf, int len); - - -#ifdef __cplusplus -} -#endif - - -#endif /* WIIUSE_H_INCLUDED */ - + + +#ifdef __cplusplus +} +#endif + + +#endif /* WIIUSE_H_INCLUDED */ + diff --git a/Externals/WiiUseSrc/Src/definitions.h b/Externals/WiiUseSrc/Src/definitions.h index 5a8da85def..13ca132581 100644 --- a/Externals/WiiUseSrc/Src/definitions.h +++ b/Externals/WiiUseSrc/Src/definitions.h @@ -50,16 +50,16 @@ /* Information output macros */ #define WIIUSE_INFO(fmt, ...) fprintf(stderr, "[INFO] " fmt "\n", ##__VA_ARGS__) -#ifdef WITH_WIIUSE_DEBUG - #ifdef WIN32 - #define WIIUSE_DEBUG(fmt, ...) do { \ - char* file = __FILE__; \ - int i = strlen(file) - 1; \ - for (; i && (file[i] != '\\'); --i); \ - fprintf(stderr, "[DEBUG] %s:%i: " fmt "\n", file+i+1, __LINE__, ##__VA_ARGS__); \ - } while (0) +#ifdef WITH_WIIUSE_DEBUG + #ifdef WIN32 + #define WIIUSE_DEBUG(fmt, ...) do { \ + char* file = __FILE__; \ + int i = strlen(file) - 1; \ + for (; i && (file[i] != '\\'); --i); \ + fprintf(stderr, "[DEBUG] %s:%i: " fmt "\n", file+i+1, __LINE__, ##__VA_ARGS__); \ + } while (0) #else - #define WIIUSE_DEBUG(fmt, ...) fprintf(stderr, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__) + #define WIIUSE_DEBUG(fmt, ...) fprintf(stderr, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__) #endif #else #define WIIUSE_DEBUG(fmt, ...) diff --git a/Externals/WiiUseSrc/Src/events.h b/Externals/WiiUseSrc/Src/events.h index 5e9b955c55..12fa74281d 100644 --- a/Externals/WiiUseSrc/Src/events.h +++ b/Externals/WiiUseSrc/Src/events.h @@ -44,7 +44,7 @@ extern "C" { void wiiuse_pressed_buttons(struct wiimote_t* wm, byte* msg); void handshake_expansion(struct wiimote_t* wm, byte* data, unsigned short len); -void disable_expansion(struct wiimote_t* wm); +void disable_expansion(struct wiimote_t* wm); #ifdef __cplusplus } diff --git a/Externals/WiiUseSrc/Src/os.h b/Externals/WiiUseSrc/Src/os.h index 53b80f557c..79d4ce6edf 100644 --- a/Externals/WiiUseSrc/Src/os.h +++ b/Externals/WiiUseSrc/Src/os.h @@ -39,14 +39,14 @@ #ifndef OS_H_INCLUDED #define OS_H_INCLUDED -#ifdef WIN32 +#ifdef WIN32 /* windows */ #define isnan(x) _isnan(x) #define isinf(x) !_finite(x) - /* disable warnings I don't care about */ - #pragma warning(disable:4244) /* possible loss of data conversion */ - #pragma warning(disable:4273) /* inconsistent dll linkage */ + /* disable warnings I don't care about */ + #pragma warning(disable:4244) /* possible loss of data conversion */ + #pragma warning(disable:4273) /* inconsistent dll linkage */ #pragma warning(disable:4217) #else /* nix */ diff --git a/Externals/WiiUseSrc/Src/wiiuse.h b/Externals/WiiUseSrc/Src/wiiuse.h index a70dc9e344..8b46c900f2 100644 --- a/Externals/WiiUseSrc/Src/wiiuse.h +++ b/Externals/WiiUseSrc/Src/wiiuse.h @@ -1,173 +1,173 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * - * @brief API header file. - * - * If this file is included from inside the wiiuse source - * and not from a third party program, then wiimote_internal.h - * is also included which extends this file. - */ - -#ifndef WIIUSE_H_INCLUDED -#define WIIUSE_H_INCLUDED - -#ifdef _WIN32 - /* windows */ - #include -#else - /* nix */ - #include -#endif - -#ifdef WIIUSE_INTERNAL_H_INCLUDED - #define WCONST -#else - #define WCONST const -#endif - -/* led bit masks */ -#define WIIMOTE_LED_NONE 0x00 -#define WIIMOTE_LED_1 0x10 -#define WIIMOTE_LED_2 0x20 -#define WIIMOTE_LED_3 0x40 -#define WIIMOTE_LED_4 0x80 - -/* button codes */ -#define WIIMOTE_BUTTON_TWO 0x0001 -#define WIIMOTE_BUTTON_ONE 0x0002 -#define WIIMOTE_BUTTON_B 0x0004 -#define WIIMOTE_BUTTON_A 0x0008 -#define WIIMOTE_BUTTON_MINUS 0x0010 -#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 -#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 -#define WIIMOTE_BUTTON_HOME 0x0080 -#define WIIMOTE_BUTTON_LEFT 0x0100 -#define WIIMOTE_BUTTON_RIGHT 0x0200 -#define WIIMOTE_BUTTON_DOWN 0x0400 -#define WIIMOTE_BUTTON_UP 0x0800 -#define WIIMOTE_BUTTON_PLUS 0x1000 -#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 -#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 -#define WIIMOTE_BUTTON_UNKNOWN 0x8000 -#define WIIMOTE_BUTTON_ALL 0x1F9F - -/* nunchul button codes */ -#define NUNCHUK_BUTTON_Z 0x01 -#define NUNCHUK_BUTTON_C 0x02 -#define NUNCHUK_BUTTON_ALL 0x03 - -/* classic controller button codes */ -#define CLASSIC_CTRL_BUTTON_UP 0x0001 -#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 -#define CLASSIC_CTRL_BUTTON_ZR 0x0004 -#define CLASSIC_CTRL_BUTTON_X 0x0008 -#define CLASSIC_CTRL_BUTTON_A 0x0010 -#define CLASSIC_CTRL_BUTTON_Y 0x0020 -#define CLASSIC_CTRL_BUTTON_B 0x0040 -#define CLASSIC_CTRL_BUTTON_ZL 0x0080 -#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 -#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 -#define CLASSIC_CTRL_BUTTON_HOME 0x0800 -#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 -#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 -#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 -#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 -#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF - -/* guitar hero 3 button codes */ -#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 -#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 -#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 -#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 -#define GUITAR_HERO_3_BUTTON_RED 0x0040 -#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 -#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 -#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 -#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 -#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF - - -/* wiimote option flags */ -#define WIIUSE_SMOOTHING 0x01 -#define WIIUSE_CONTINUOUS 0x02 -#define WIIUSE_ORIENT_THRESH 0x04 -#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) - -#define WIIUSE_ORIENT_PRECISION 100.0f - -/* expansion codes */ -#define EXP_NONE 0 -#define EXP_NUNCHUK 1 -#define EXP_CLASSIC 2 -#define EXP_GUITAR_HERO_3 3 - -/* IR correction types */ -typedef enum ir_position_t { - WIIUSE_IR_ABOVE, - WIIUSE_IR_BELOW -} ir_position_t; - -/** - * @brief Check if a button is pressed. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ -#define IS_PRESSED(dev, button) ((dev->btns & button) == button) - -/** - * @brief Check if a button is being held. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is held, 0 if not. - */ -#define IS_HELD(dev, button) ((dev->btns_held & button) == button) - -/** - * @brief Check if a button is released on this event. \n\n - * This does not mean the button is not pressed, it means \n - * this button was just now released. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is released, 0 if not. - * - */ -#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) - -/** - * @brief Check if a button has just been pressed this event. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * + * @brief API header file. + * + * If this file is included from inside the wiiuse source + * and not from a third party program, then wiimote_internal.h + * is also included which extends this file. + */ + +#ifndef WIIUSE_H_INCLUDED +#define WIIUSE_H_INCLUDED + +#ifdef _WIN32 + /* windows */ + #include +#else + /* nix */ + #include +#endif + +#ifdef WIIUSE_INTERNAL_H_INCLUDED + #define WCONST +#else + #define WCONST const +#endif + +/* led bit masks */ +#define WIIMOTE_LED_NONE 0x00 +#define WIIMOTE_LED_1 0x10 +#define WIIMOTE_LED_2 0x20 +#define WIIMOTE_LED_3 0x40 +#define WIIMOTE_LED_4 0x80 + +/* button codes */ +#define WIIMOTE_BUTTON_TWO 0x0001 +#define WIIMOTE_BUTTON_ONE 0x0002 +#define WIIMOTE_BUTTON_B 0x0004 +#define WIIMOTE_BUTTON_A 0x0008 +#define WIIMOTE_BUTTON_MINUS 0x0010 +#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 +#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 +#define WIIMOTE_BUTTON_HOME 0x0080 +#define WIIMOTE_BUTTON_LEFT 0x0100 +#define WIIMOTE_BUTTON_RIGHT 0x0200 +#define WIIMOTE_BUTTON_DOWN 0x0400 +#define WIIMOTE_BUTTON_UP 0x0800 +#define WIIMOTE_BUTTON_PLUS 0x1000 +#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 +#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 +#define WIIMOTE_BUTTON_UNKNOWN 0x8000 +#define WIIMOTE_BUTTON_ALL 0x1F9F + +/* nunchul button codes */ +#define NUNCHUK_BUTTON_Z 0x01 +#define NUNCHUK_BUTTON_C 0x02 +#define NUNCHUK_BUTTON_ALL 0x03 + +/* classic controller button codes */ +#define CLASSIC_CTRL_BUTTON_UP 0x0001 +#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 +#define CLASSIC_CTRL_BUTTON_ZR 0x0004 +#define CLASSIC_CTRL_BUTTON_X 0x0008 +#define CLASSIC_CTRL_BUTTON_A 0x0010 +#define CLASSIC_CTRL_BUTTON_Y 0x0020 +#define CLASSIC_CTRL_BUTTON_B 0x0040 +#define CLASSIC_CTRL_BUTTON_ZL 0x0080 +#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 +#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 +#define CLASSIC_CTRL_BUTTON_HOME 0x0800 +#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 +#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 +#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 +#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 +#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF + +/* guitar hero 3 button codes */ +#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 +#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 +#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 +#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 +#define GUITAR_HERO_3_BUTTON_RED 0x0040 +#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 +#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 +#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 +#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 +#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF + + +/* wiimote option flags */ +#define WIIUSE_SMOOTHING 0x01 +#define WIIUSE_CONTINUOUS 0x02 +#define WIIUSE_ORIENT_THRESH 0x04 +#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) + +#define WIIUSE_ORIENT_PRECISION 100.0f + +/* expansion codes */ +#define EXP_NONE 0 +#define EXP_NUNCHUK 1 +#define EXP_CLASSIC 2 +#define EXP_GUITAR_HERO_3 3 + +/* IR correction types */ +typedef enum ir_position_t { + WIIUSE_IR_ABOVE, + WIIUSE_IR_BELOW +} ir_position_t; + +/** + * @brief Check if a button is pressed. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ +#define IS_PRESSED(dev, button) ((dev->btns & button) == button) + +/** + * @brief Check if a button is being held. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is held, 0 if not. + */ +#define IS_HELD(dev, button) ((dev->btns_held & button) == button) + +/** + * @brief Check if a button is released on this event. \n\n + * This does not mean the button is not pressed, it means \n + * this button was just now released. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is released, 0 if not. + * + */ +#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) + +/** + * @brief Check if a button has just been pressed this event. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ #define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button)) /** @@ -185,457 +185,457 @@ typedef enum ir_position_t { else if ((wm->state & 0x2000) == 0x2000) *lvl = 5; \ else *lvl = 0; \ } while (0) - -#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) -#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) -#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) -#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) - -#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) - -/* - * Largest known payload is 21 bytes. - * Add 2 for the prefix and round up to a power of 2. - */ -#define MAX_PAYLOAD 32 - -/* - * This is left over from an old hack, but it may actually - * be a useful feature to keep so it wasn't removed. - */ -#ifdef WIN32 - #define WIIMOTE_DEFAULT_TIMEOUT 10 - #define WIIMOTE_EXP_TIMEOUT 10 -#endif - -typedef unsigned char byte; -typedef char sbyte; - -struct wiimote_t; -struct vec3b_t; -struct orient_t; -struct gforce_t; - - -/** - * @brief Callback that handles a read event. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Pointer to the filled data block. - * @param len Length in bytes of the data block. - * - * @see wiiuse_init() - * - * A registered function of this type is called automatically by the wiiuse - * library when the wiimote has returned the full data requested by a previous - * call to wiiuse_read_data(). - */ -typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len); - - -/** - * @struct read_req_t - * @brief Data read request structure. - */ -struct read_req_t { - wiiuse_read_cb cb; /**< read data callback */ - byte* buf; /**< buffer where read data is written */ - unsigned int addr; /**< the offset that the read started at */ - unsigned short size; /**< the length of the data read */ + +#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) +#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) +#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) +#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) + +#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) + +/* + * Largest known payload is 21 bytes. + * Add 2 for the prefix and round up to a power of 2. + */ +#define MAX_PAYLOAD 32 + +/* + * This is left over from an old hack, but it may actually + * be a useful feature to keep so it wasn't removed. + */ +#ifdef WIN32 + #define WIIMOTE_DEFAULT_TIMEOUT 10 + #define WIIMOTE_EXP_TIMEOUT 10 +#endif + +typedef unsigned char byte; +typedef char sbyte; + +struct wiimote_t; +struct vec3b_t; +struct orient_t; +struct gforce_t; + + +/** + * @brief Callback that handles a read event. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Pointer to the filled data block. + * @param len Length in bytes of the data block. + * + * @see wiiuse_init() + * + * A registered function of this type is called automatically by the wiiuse + * library when the wiimote has returned the full data requested by a previous + * call to wiiuse_read_data(). + */ +typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len); + + +/** + * @struct read_req_t + * @brief Data read request structure. + */ +struct read_req_t { + wiiuse_read_cb cb; /**< read data callback */ + byte* buf; /**< buffer where read data is written */ + unsigned int addr; /**< the offset that the read started at */ + unsigned short size; /**< the length of the data read */ unsigned short wait; /**< num bytes still needed to finish read */ - byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ - - struct read_req_t* next; /**< next read request in the queue */ -}; - - -/** - * @struct vec2b_t - * @brief Unsigned x,y byte vector. - */ -typedef struct vec2b_t { - byte x, y; -} vec2b_t; - - -/** - * @struct vec3b_t - * @brief Unsigned x,y,z byte vector. - */ -typedef struct vec3b_t { - byte x, y, z; -} vec3b_t; - - -/** - * @struct vec3f_t - * @brief Signed x,y,z float struct. - */ -typedef struct vec3f_t { - float x, y, z; -} vec3f_t; - - -/** - * @struct orient_t - * @brief Orientation struct. - * - * Yaw, pitch, and roll range from -180 to 180 degrees. - */ -typedef struct orient_t { - float roll; /**< roll, this may be smoothed if enabled */ - float pitch; /**< pitch, this may be smoothed if enabled */ - float yaw; - - float a_roll; /**< absolute roll, unsmoothed */ - float a_pitch; /**< absolute pitch, unsmoothed */ -} orient_t; - - -/** - * @struct gforce_t - * @brief Gravity force struct. - */ -typedef struct gforce_t { - float x, y, z; -} gforce_t; - - -/** - * @struct accel_t - * @brief Accelerometer struct. For any device with an accelerometer. - */ -typedef struct accel_t { - struct vec3b_t cal_zero; /**< zero calibration */ - struct vec3b_t cal_g; /**< 1g difference around 0cal */ - - float st_roll; /**< last smoothed roll value */ - float st_pitch; /**< last smoothed roll pitch */ - float st_alpha; /**< alpha value for smoothing [0-1] */ -} accel_t; - - -/** - * @struct ir_dot_t - * @brief A single IR source. - */ -typedef struct ir_dot_t { - byte visible; /**< if the IR source is visible */ - - unsigned int x; /**< interpolated X coordinate */ - unsigned int y; /**< interpolated Y coordinate */ - - short rx; /**< raw X coordinate (0-1023) */ - short ry; /**< raw Y coordinate (0-767) */ - - byte order; /**< increasing order by x-axis value */ - - byte size; /**< size of the IR dot (0-15) */ -} ir_dot_t; - - -/** - * @enum aspect_t - * @brief Screen aspect ratio. - */ -typedef enum aspect_t { - WIIUSE_ASPECT_4_3, - WIIUSE_ASPECT_16_9 -} aspect_t; - - -/** - * @struct ir_t - * @brief IR struct. Hold all data related to the IR tracking. - */ -typedef struct ir_t { - struct ir_dot_t dot[4]; /**< IR dots */ - byte num_dots; /**< number of dots at this time */ - - enum aspect_t aspect; /**< aspect ratio of the screen */ - - enum ir_position_t pos; /**< IR sensor bar position */ - - unsigned int vres[2]; /**< IR virtual screen resolution */ - int offset[2]; /**< IR XY correction offset */ - int state; /**< keeps track of the IR state */ - - int ax; /**< absolute X coordinate */ - int ay; /**< absolute Y coordinate */ - - int x; /**< calculated X coordinate */ - int y; /**< calculated Y coordinate */ - - float distance; /**< pixel distance between first 2 dots*/ - float z; /**< calculated distance */ -} ir_t; - - -/** - * @struct joystick_t - * @brief Joystick calibration structure. - * - * The angle \a ang is relative to the positive y-axis into quadrant I - * and ranges from 0 to 360 degrees. So if the joystick is held straight - * upwards then angle is 0 degrees. If it is held to the right it is 90, - * down is 180, and left is 270. - * - * The magnitude \a mag is the distance from the center to where the - * joystick is being held. The magnitude ranges from 0 to 1. - * If the joystick is only slightly tilted from the center the magnitude - * will be low, but if it is closer to the outter edge the value will - * be higher. - */ -typedef struct joystick_t { - struct vec2b_t max; /**< maximum joystick values */ - struct vec2b_t min; /**< minimum joystick values */ - struct vec2b_t center; /**< center joystick values */ - - float ang; /**< angle the joystick is being held */ - float mag; /**< magnitude of the joystick (range 0-1) */ -} joystick_t; - - -/** - * @struct nunchuk_t - * @brief Nunchuk expansion device. - */ -typedef struct nunchuk_t { - struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ - struct joystick_t js; /**< joystick calibration */ - - int* flags; /**< options flag (points to wiimote_t.flags) */ - - byte btns; /**< what buttons have just been pressed */ - byte btns_held; /**< what buttons are being held down */ - byte btns_released; /**< what buttons were just released this */ + byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ + + struct read_req_t* next; /**< next read request in the queue */ +}; + + +/** + * @struct vec2b_t + * @brief Unsigned x,y byte vector. + */ +typedef struct vec2b_t { + byte x, y; +} vec2b_t; + + +/** + * @struct vec3b_t + * @brief Unsigned x,y,z byte vector. + */ +typedef struct vec3b_t { + byte x, y, z; +} vec3b_t; + + +/** + * @struct vec3f_t + * @brief Signed x,y,z float struct. + */ +typedef struct vec3f_t { + float x, y, z; +} vec3f_t; + + +/** + * @struct orient_t + * @brief Orientation struct. + * + * Yaw, pitch, and roll range from -180 to 180 degrees. + */ +typedef struct orient_t { + float roll; /**< roll, this may be smoothed if enabled */ + float pitch; /**< pitch, this may be smoothed if enabled */ + float yaw; + + float a_roll; /**< absolute roll, unsmoothed */ + float a_pitch; /**< absolute pitch, unsmoothed */ +} orient_t; + + +/** + * @struct gforce_t + * @brief Gravity force struct. + */ +typedef struct gforce_t { + float x, y, z; +} gforce_t; + + +/** + * @struct accel_t + * @brief Accelerometer struct. For any device with an accelerometer. + */ +typedef struct accel_t { + struct vec3b_t cal_zero; /**< zero calibration */ + struct vec3b_t cal_g; /**< 1g difference around 0cal */ + + float st_roll; /**< last smoothed roll value */ + float st_pitch; /**< last smoothed roll pitch */ + float st_alpha; /**< alpha value for smoothing [0-1] */ +} accel_t; + + +/** + * @struct ir_dot_t + * @brief A single IR source. + */ +typedef struct ir_dot_t { + byte visible; /**< if the IR source is visible */ + + unsigned int x; /**< interpolated X coordinate */ + unsigned int y; /**< interpolated Y coordinate */ + + short rx; /**< raw X coordinate (0-1023) */ + short ry; /**< raw Y coordinate (0-767) */ + + byte order; /**< increasing order by x-axis value */ + + byte size; /**< size of the IR dot (0-15) */ +} ir_dot_t; + + +/** + * @enum aspect_t + * @brief Screen aspect ratio. + */ +typedef enum aspect_t { + WIIUSE_ASPECT_4_3, + WIIUSE_ASPECT_16_9 +} aspect_t; + + +/** + * @struct ir_t + * @brief IR struct. Hold all data related to the IR tracking. + */ +typedef struct ir_t { + struct ir_dot_t dot[4]; /**< IR dots */ + byte num_dots; /**< number of dots at this time */ + + enum aspect_t aspect; /**< aspect ratio of the screen */ + + enum ir_position_t pos; /**< IR sensor bar position */ + + unsigned int vres[2]; /**< IR virtual screen resolution */ + int offset[2]; /**< IR XY correction offset */ + int state; /**< keeps track of the IR state */ + + int ax; /**< absolute X coordinate */ + int ay; /**< absolute Y coordinate */ + + int x; /**< calculated X coordinate */ + int y; /**< calculated Y coordinate */ + + float distance; /**< pixel distance between first 2 dots*/ + float z; /**< calculated distance */ +} ir_t; + + +/** + * @struct joystick_t + * @brief Joystick calibration structure. + * + * The angle \a ang is relative to the positive y-axis into quadrant I + * and ranges from 0 to 360 degrees. So if the joystick is held straight + * upwards then angle is 0 degrees. If it is held to the right it is 90, + * down is 180, and left is 270. + * + * The magnitude \a mag is the distance from the center to where the + * joystick is being held. The magnitude ranges from 0 to 1. + * If the joystick is only slightly tilted from the center the magnitude + * will be low, but if it is closer to the outter edge the value will + * be higher. + */ +typedef struct joystick_t { + struct vec2b_t max; /**< maximum joystick values */ + struct vec2b_t min; /**< minimum joystick values */ + struct vec2b_t center; /**< center joystick values */ + + float ang; /**< angle the joystick is being held */ + float mag; /**< magnitude of the joystick (range 0-1) */ +} joystick_t; + + +/** + * @struct nunchuk_t + * @brief Nunchuk expansion device. + */ +typedef struct nunchuk_t { + struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ + struct joystick_t js; /**< joystick calibration */ + + int* flags; /**< options flag (points to wiimote_t.flags) */ + + byte btns; /**< what buttons have just been pressed */ + byte btns_held; /**< what buttons are being held down */ + byte btns_released; /**< what buttons were just released this */ float orient_threshold; /**< threshold for orient to generate an event */ int accel_threshold; /**< threshold for accel to generate an event */ - - struct vec3b_t accel; /**< current raw acceleration data */ - struct orient_t orient; /**< current orientation on each axis */ - struct gforce_t gforce; /**< current gravity forces on each axis */ -} nunchuk_t; - - -/** - * @struct classic_ctrl_t - * @brief Classic controller expansion device. - */ -typedef struct classic_ctrl_t { - short btns; /**< what buttons have just been pressed */ - short btns_held; /**< what buttons are being held down */ - short btns_released; /**< what buttons were just released this */ - - float r_shoulder; /**< right shoulder button (range 0-1) */ - float l_shoulder; /**< left shoulder button (range 0-1) */ - - struct joystick_t ljs; /**< left joystick calibration */ - struct joystick_t rjs; /**< right joystick calibration */ -} classic_ctrl_t; - - -/** - * @struct guitar_hero_3_t - * @brief Guitar Hero 3 expansion device. - */ -typedef struct guitar_hero_3_t { - short btns; /**< what buttons have just been pressed */ - short btns_held; /**< what buttons are being held down */ - short btns_released; /**< what buttons were just released this */ - - float whammy_bar; /**< whammy bar (range 0-1) */ - - struct joystick_t js; /**< joystick calibration */ -} guitar_hero_3_t; - - -/** - * @struct expansion_t - * @brief Generic expansion device plugged into wiimote. - */ -typedef struct expansion_t { - int type; /**< type of expansion attached */ - - union { - struct nunchuk_t nunchuk; - struct classic_ctrl_t classic; - struct guitar_hero_3_t gh3; - }; -} expansion_t; - - -/** - * @enum win32_bt_stack_t - * @brief Available bluetooth stacks for Windows. - */ -typedef enum win_bt_stack_t { - WIIUSE_STACK_UNKNOWN, - WIIUSE_STACK_MS, - WIIUSE_STACK_BLUESOLEIL -} win_bt_stack_t; - - -/** - * @struct wiimote_state_t - * @brief Significant data from the previous event. - */ -typedef struct wiimote_state_t { - /* expansion_t */ - float exp_ljs_ang; - float exp_rjs_ang; - float exp_ljs_mag; - float exp_rjs_mag; - unsigned short exp_btns; - struct orient_t exp_orient; + + struct vec3b_t accel; /**< current raw acceleration data */ + struct orient_t orient; /**< current orientation on each axis */ + struct gforce_t gforce; /**< current gravity forces on each axis */ +} nunchuk_t; + + +/** + * @struct classic_ctrl_t + * @brief Classic controller expansion device. + */ +typedef struct classic_ctrl_t { + short btns; /**< what buttons have just been pressed */ + short btns_held; /**< what buttons are being held down */ + short btns_released; /**< what buttons were just released this */ + + float r_shoulder; /**< right shoulder button (range 0-1) */ + float l_shoulder; /**< left shoulder button (range 0-1) */ + + struct joystick_t ljs; /**< left joystick calibration */ + struct joystick_t rjs; /**< right joystick calibration */ +} classic_ctrl_t; + + +/** + * @struct guitar_hero_3_t + * @brief Guitar Hero 3 expansion device. + */ +typedef struct guitar_hero_3_t { + short btns; /**< what buttons have just been pressed */ + short btns_held; /**< what buttons are being held down */ + short btns_released; /**< what buttons were just released this */ + + float whammy_bar; /**< whammy bar (range 0-1) */ + + struct joystick_t js; /**< joystick calibration */ +} guitar_hero_3_t; + + +/** + * @struct expansion_t + * @brief Generic expansion device plugged into wiimote. + */ +typedef struct expansion_t { + int type; /**< type of expansion attached */ + + union { + struct nunchuk_t nunchuk; + struct classic_ctrl_t classic; + struct guitar_hero_3_t gh3; + }; +} expansion_t; + + +/** + * @enum win32_bt_stack_t + * @brief Available bluetooth stacks for Windows. + */ +typedef enum win_bt_stack_t { + WIIUSE_STACK_UNKNOWN, + WIIUSE_STACK_MS, + WIIUSE_STACK_BLUESOLEIL +} win_bt_stack_t; + + +/** + * @struct wiimote_state_t + * @brief Significant data from the previous event. + */ +typedef struct wiimote_state_t { + /* expansion_t */ + float exp_ljs_ang; + float exp_rjs_ang; + float exp_ljs_mag; + float exp_rjs_mag; + unsigned short exp_btns; + struct orient_t exp_orient; struct vec3b_t exp_accel; - float exp_r_shoulder; - float exp_l_shoulder; - - /* ir_t */ - int ir_ax; - int ir_ay; - float ir_distance; - - struct orient_t orient; - unsigned short btns; - - struct vec3b_t accel; -} wiimote_state_t; - - -/** - * @enum WIIUSE_EVENT_TYPE - * @brief Events that wiiuse can generate from a poll. - */ -typedef enum WIIUSE_EVENT_TYPE { - WIIUSE_NONE = 0, - WIIUSE_EVENT, + float exp_r_shoulder; + float exp_l_shoulder; + + /* ir_t */ + int ir_ax; + int ir_ay; + float ir_distance; + + struct orient_t orient; + unsigned short btns; + + struct vec3b_t accel; +} wiimote_state_t; + + +/** + * @enum WIIUSE_EVENT_TYPE + * @brief Events that wiiuse can generate from a poll. + */ +typedef enum WIIUSE_EVENT_TYPE { + WIIUSE_NONE = 0, + WIIUSE_EVENT, WIIUSE_STATUS, - WIIUSE_CONNECT, + WIIUSE_CONNECT, WIIUSE_DISCONNECT, WIIUSE_UNEXPECTED_DISCONNECT, WIIUSE_READ_DATA, - WIIUSE_NUNCHUK_INSERTED, + WIIUSE_NUNCHUK_INSERTED, WIIUSE_NUNCHUK_REMOVED, WIIUSE_CLASSIC_CTRL_INSERTED, WIIUSE_CLASSIC_CTRL_REMOVED, WIIUSE_GUITAR_HERO_3_CTRL_INSERTED, WIIUSE_GUITAR_HERO_3_CTRL_REMOVED -} WIIUSE_EVENT_TYPE; - -/** - * @struct wiimote_t - * @brief Wiimote structure. - */ -typedef struct wiimote_t { - WCONST int unid; /**< user specified id */ - - #ifndef WIN32 - WCONST bdaddr_t bdaddr; /**< bt address */ - WCONST char bdaddr_str[18]; /**< readable bt address */ - WCONST int out_sock; /**< output socket */ - WCONST int in_sock; /**< input socket */ - #else - WCONST HANDLE dev_handle; /**< HID handle */ - WCONST OVERLAPPED hid_overlap; /**< overlap handle */ - WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ - WCONST int timeout; /**< read timeout */ - WCONST byte normal_timeout; /**< normal timeout */ - WCONST byte exp_timeout; /**< timeout for expansion handshake */ - #endif - - WCONST int state; /**< various state flags */ - WCONST byte leds; /**< currently lit leds */ - WCONST float battery_level; /**< battery level */ - +} WIIUSE_EVENT_TYPE; + +/** + * @struct wiimote_t + * @brief Wiimote structure. + */ +typedef struct wiimote_t { + WCONST int unid; /**< user specified id */ + + #ifndef WIN32 + WCONST bdaddr_t bdaddr; /**< bt address */ + WCONST char bdaddr_str[18]; /**< readable bt address */ + WCONST int out_sock; /**< output socket */ + WCONST int in_sock; /**< input socket */ + #else + WCONST HANDLE dev_handle; /**< HID handle */ + WCONST OVERLAPPED hid_overlap; /**< overlap handle */ + WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ + WCONST int timeout; /**< read timeout */ + WCONST byte normal_timeout; /**< normal timeout */ + WCONST byte exp_timeout; /**< timeout for expansion handshake */ + #endif + + WCONST int state; /**< various state flags */ + WCONST byte leds; /**< currently lit leds */ + WCONST float battery_level; /**< battery level */ + WCONST int flags; /**< options flag */ - WCONST byte handshake_state; /**< the state of the connection handshake */ - - WCONST struct read_req_t* read_req; /**< list of data read requests */ - WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ - WCONST struct expansion_t exp; /**< wiimote expansion device */ - - WCONST struct vec3b_t accel; /**< current raw acceleration data */ - WCONST struct orient_t orient; /**< current orientation on each axis */ - WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ - - WCONST struct ir_t ir; /**< IR data */ - - WCONST unsigned short btns; /**< what buttons have just been pressed */ - WCONST unsigned short btns_held; /**< what buttons are being held down */ - WCONST unsigned short btns_released; /**< what buttons were just released this */ - - WCONST float orient_threshold; /**< threshold for orient to generate an event */ - WCONST int accel_threshold; /**< threshold for accel to generate an event */ - - WCONST struct wiimote_state_t lstate; /**< last saved state */ - - WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */ - WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */ -} wiimote; - - -/***************************************** - * - * Include API specific stuff - * - *****************************************/ - -#ifdef _WIN32 - #define WIIUSE_EXPORT_DECL __declspec(dllexport) - #define WIIUSE_IMPORT_DECL __declspec(dllimport) -#else - #define WIIUSE_EXPORT_DECL - #define WIIUSE_IMPORT_DECL -#endif - -#ifdef WIIUSE_COMPILE_LIB - #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL -#else - #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* wiiuse.c */ -WIIUSE_EXPORT extern const char* wiiuse_version(); - -WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); -WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); -WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); -WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, unsigned short len); -WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len); -WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); -WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); -WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); -WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); -WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); -WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); -WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); -WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); - -/* connect.c */ -WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); -WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); -WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); - -/* events.c */ -WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); - -/* ir.c */ -WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); -WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); + WCONST byte handshake_state; /**< the state of the connection handshake */ + + WCONST struct read_req_t* read_req; /**< list of data read requests */ + WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ + WCONST struct expansion_t exp; /**< wiimote expansion device */ + + WCONST struct vec3b_t accel; /**< current raw acceleration data */ + WCONST struct orient_t orient; /**< current orientation on each axis */ + WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ + + WCONST struct ir_t ir; /**< IR data */ + + WCONST unsigned short btns; /**< what buttons have just been pressed */ + WCONST unsigned short btns_held; /**< what buttons are being held down */ + WCONST unsigned short btns_released; /**< what buttons were just released this */ + + WCONST float orient_threshold; /**< threshold for orient to generate an event */ + WCONST int accel_threshold; /**< threshold for accel to generate an event */ + + WCONST struct wiimote_state_t lstate; /**< last saved state */ + + WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */ + WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */ +} wiimote; + + +/***************************************** + * + * Include API specific stuff + * + *****************************************/ + +#ifdef _WIN32 + #define WIIUSE_EXPORT_DECL __declspec(dllexport) + #define WIIUSE_IMPORT_DECL __declspec(dllimport) +#else + #define WIIUSE_EXPORT_DECL + #define WIIUSE_IMPORT_DECL +#endif + +#ifdef WIIUSE_COMPILE_LIB + #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL +#else + #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* wiiuse.c */ +WIIUSE_EXPORT extern const char* wiiuse_version(); + +WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); +WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, unsigned short len); +WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len); +WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); +WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); +WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); +WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); +WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); +WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); +WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); +WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); + +/* connect.c */ +WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); +WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); + +/* events.c */ +WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); + +/* ir.c */ +WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); +WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); WIIUSE_EXPORT extern void wiiuse_set_aspect_ratio(struct wiimote_t* wm, enum aspect_t aspect); WIIUSE_EXPORT extern void wiiuse_set_ir_sensitivity(struct wiimote_t* wm, int level); @@ -646,12 +646,12 @@ WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* w /* io.c */ WIIUSE_EXPORT extern int wiiuse_io_read(struct wiimote_t* wm); WIIUSE_EXPORT extern int wiiuse_io_write(struct wiimote_t* wm, byte* buf, int len); - - -#ifdef __cplusplus -} -#endif - - -#endif /* WIIUSE_H_INCLUDED */ - + + +#ifdef __cplusplus +} +#endif + + +#endif /* WIIUSE_H_INCLUDED */ + diff --git a/Externals/WiiUseSrc/Src/wiiuse_internal.h b/Externals/WiiUseSrc/Src/wiiuse_internal.h index 1b2f423862..a7fe30a578 100644 --- a/Externals/WiiUseSrc/Src/wiiuse_internal.h +++ b/Externals/WiiUseSrc/Src/wiiuse_internal.h @@ -153,8 +153,8 @@ #define EXP_ID_CODE_CLASSIC_CONTROLLER 0x9A1EFDFD #define EXP_ID_CODE_GUITAR 0x9A1EFDFB -#define EXP_HANDSHAKE_LEN 224 - +#define EXP_HANDSHAKE_LEN 224 + /******************** * * End Wiimote internal codes @@ -205,10 +205,10 @@ #define WIIUSE_DEFAULT_SMOOTH_ALPHA 0.07f #define SMOOTH_ROLL 0x01 -#define SMOOTH_PITCH 0x02 - +#define SMOOTH_PITCH 0x02 + #include "wiiuse.h" - + #ifdef __cplusplus extern "C" { #endif diff --git a/Externals/libjpeg/jconfig.h b/Externals/libjpeg/jconfig.h index 1f43a6e119..cf6420d500 100644 --- a/Externals/libjpeg/jconfig.h +++ b/Externals/libjpeg/jconfig.h @@ -1,52 +1,52 @@ -/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -//#define NEED_FAR_POINTERS /* for small or medium memory model */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -//#define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ - -#define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ - -//#define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */ - -#define NEED_FHEAPMIN /* far heap management routines are broken */ - -#define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */ -/* Note: the above define is known to improve the code with Microsoft C 6.00A. - * I do not know whether it is good for later compiler versions. - * Please report any info on this point to jpeg-info@uunet.uu.net. - */ - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE -#define USE_SETMODE /* Microsoft has setmode() */ -#define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ +/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */ +/* see jconfig.doc for explanations */ + +#define HAVE_PROTOTYPES +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT +/* #define void char */ +/* #define const */ +#undef CHAR_IS_UNSIGNED +#define HAVE_STDDEF_H +#define HAVE_STDLIB_H +#undef NEED_BSD_STRINGS +#undef NEED_SYS_TYPES_H +//#define NEED_FAR_POINTERS /* for small or medium memory model */ +#undef NEED_SHORT_EXTERNAL_NAMES +#undef INCOMPLETE_TYPES_BROKEN + +#ifdef JPEG_INTERNALS + +#undef RIGHT_SHIFT_IS_UNSIGNED + +//#define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ + +#define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ + +//#define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */ + +#define NEED_FHEAPMIN /* far heap management routines are broken */ + +#define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */ +/* Note: the above define is known to improve the code with Microsoft C 6.00A. + * I do not know whether it is good for later compiler versions. + * Please report any info on this point to jpeg-info@uunet.uu.net. + */ + +#endif /* JPEG_INTERNALS */ + +#ifdef JPEG_CJPEG_DJPEG + +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +#undef RLE_SUPPORTED /* Utah RLE image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ + +#define TWO_FILE_COMMANDLINE +#define USE_SETMODE /* Microsoft has setmode() */ +#define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ +#undef DONT_USE_B_MODE +#undef PROGRESS_REPORT /* optional */ + +#endif /* JPEG_CJPEG_DJPEG */ diff --git a/Externals/libjpeg/jmorecfg.h b/Externals/libjpeg/jmorecfg.h index c856e2260c..54a7d1c447 100644 --- a/Externals/libjpeg/jmorecfg.h +++ b/Externals/libjpeg/jmorecfg.h @@ -1,363 +1,363 @@ -/* - * jmorecfg.h - * - * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains additional configuration options that customize the - * JPEG software for special applications or support machine-dependent - * optimizations. Most users will not need to touch this file. - */ - - -/* - * Define BITS_IN_JSAMPLE as either - * 8 for 8-bit sample values (the usual setting) - * 12 for 12-bit sample values - * Only 8 and 12 are legal data precisions for lossy JPEG according to the - * JPEG standard, and the IJG code does not support anything else! - * We do not support run-time selection of data precision, sorry. - */ - -#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ - - -/* - * Maximum number of components (color channels) allowed in JPEG image. - * To meet the letter of the JPEG spec, set this to 255. However, darn - * few applications need more than 4 channels (maybe 5 for CMYK + alpha - * mask). We recommend 10 as a reasonable compromise; use 4 if you are - * really short on memory. (Each allowed component costs a hundred or so - * bytes of storage, whether actually used in an image or not.) - */ - -#define MAX_COMPONENTS 10 /* maximum number of image components */ - - -/* - * Basic data types. - * You may need to change these if you have a machine with unusual data - * type sizes; for example, "char" not 8 bits, "short" not 16 bits, - * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, - * but it had better be at least 16. - */ - -/* Representation of a single sample (pixel element value). - * We frequently allocate large arrays of these, so it's important to keep - * them small. But if you have memory to burn and access to char or short - * arrays is very slow on your hardware, you might want to change these. - */ - -#if BITS_IN_JSAMPLE == 8 -/* JSAMPLE should be the smallest type that will hold the values 0..255. - * You can use a signed char by having GETJSAMPLE mask it with 0xFF. - */ - -#ifdef HAVE_UNSIGNED_CHAR - -typedef unsigned char JSAMPLE; -#define GETJSAMPLE(value) ((int) (value)) - -#else /* not HAVE_UNSIGNED_CHAR */ - -typedef char JSAMPLE; -#ifdef CHAR_IS_UNSIGNED -#define GETJSAMPLE(value) ((int) (value)) -#else -#define GETJSAMPLE(value) ((int) (value) & 0xFF) -#endif /* CHAR_IS_UNSIGNED */ - -#endif /* HAVE_UNSIGNED_CHAR */ - -#define MAXJSAMPLE 255 -#define CENTERJSAMPLE 128 - -#endif /* BITS_IN_JSAMPLE == 8 */ - - -#if BITS_IN_JSAMPLE == 12 -/* JSAMPLE should be the smallest type that will hold the values 0..4095. - * On nearly all machines "short" will do nicely. - */ - -typedef short JSAMPLE; -#define GETJSAMPLE(value) ((int) (value)) - -#define MAXJSAMPLE 4095 -#define CENTERJSAMPLE 2048 - -#endif /* BITS_IN_JSAMPLE == 12 */ - - -/* Representation of a DCT frequency coefficient. - * This should be a signed value of at least 16 bits; "short" is usually OK. - * Again, we allocate large arrays of these, but you can change to int - * if you have memory to burn and "short" is really slow. - */ - -typedef short JCOEF; - - -/* Compressed datastreams are represented as arrays of JOCTET. - * These must be EXACTLY 8 bits wide, at least once they are written to - * external storage. Note that when using the stdio data source/destination - * managers, this is also the data type passed to fread/fwrite. - */ - -#ifdef HAVE_UNSIGNED_CHAR - -typedef unsigned char JOCTET; -#define GETJOCTET(value) (value) - -#else /* not HAVE_UNSIGNED_CHAR */ - -typedef char JOCTET; -#ifdef CHAR_IS_UNSIGNED -#define GETJOCTET(value) (value) -#else -#define GETJOCTET(value) ((value) & 0xFF) -#endif /* CHAR_IS_UNSIGNED */ - -#endif /* HAVE_UNSIGNED_CHAR */ - - -/* These typedefs are used for various table entries and so forth. - * They must be at least as wide as specified; but making them too big - * won't cost a huge amount of memory, so we don't provide special - * extraction code like we did for JSAMPLE. (In other words, these - * typedefs live at a different point on the speed/space tradeoff curve.) - */ - -/* UINT8 must hold at least the values 0..255. */ - -#ifdef HAVE_UNSIGNED_CHAR -typedef unsigned char UINT8; -#else /* not HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED -typedef char UINT8; -#else /* not CHAR_IS_UNSIGNED */ -typedef short UINT8; -#endif /* CHAR_IS_UNSIGNED */ -#endif /* HAVE_UNSIGNED_CHAR */ - -/* UINT16 must hold at least the values 0..65535. */ - -#ifdef HAVE_UNSIGNED_SHORT -typedef unsigned short UINT16; -#else /* not HAVE_UNSIGNED_SHORT */ -typedef unsigned int UINT16; -#endif /* HAVE_UNSIGNED_SHORT */ - -/* INT16 must hold at least the values -32768..32767. */ - -#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ -typedef short INT16; -#endif - -/* INT32 must hold at least signed 32-bit values. */ - -#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ -typedef long INT32; -#endif - -/* Datatype used for image dimensions. The JPEG standard only supports - * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore - * "unsigned int" is sufficient on all machines. However, if you need to - * handle larger images and you don't mind deviating from the spec, you - * can change this datatype. - */ - -typedef unsigned int JDIMENSION; - -#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ - - -/* These macros are used in all function definitions and extern declarations. - * You could modify them if you need to change function linkage conventions; - * in particular, you'll need to do that to make the library a Windows DLL. - * Another application is to make all functions global for use with debuggers - * or code profilers that require it. - */ - -/* a function called through method pointers: */ -#define METHODDEF(type) static type -/* a function used only in its module: */ -#define LOCAL(type) static type -/* a function referenced thru EXTERNs: */ -#define GLOBAL(type) type -/* a reference to a GLOBAL function: */ -#define EXTERN(type) extern type - - -/* This macro is used to declare a "method", that is, a function pointer. - * We want to supply prototype parameters if the compiler can cope. - * Note that the arglist parameter must be parenthesized! - * Again, you can customize this if you need special linkage keywords. - */ - -#ifdef HAVE_PROTOTYPES -#define JMETHOD(type,methodname,arglist) type (*methodname) arglist -#else -#define JMETHOD(type,methodname,arglist) type (*methodname) () -#endif - - -/* Here is the pseudo-keyword for declaring pointers that must be "far" - * on 80x86 machines. Most of the specialized coding for 80x86 is handled - * by just saying "FAR *" where such a pointer is needed. In a few places - * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. - */ - -#ifdef NEED_FAR_POINTERS -#define FAR far -#else -#define FAR -#endif - - -/* - * On a few systems, type boolean and/or its values FALSE, TRUE may appear - * in standard header files. Or you may have conflicts with application- - * specific header files that you want to include together with these files. - * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. - */ - -#ifndef HAVE_BOOLEAN -typedef int boolean; -#endif -#ifndef FALSE /* in case these macros already exist */ -#define FALSE 0 /* values of boolean */ -#endif -#ifndef TRUE -#define TRUE 1 -#endif - - -/* - * The remaining options affect code selection within the JPEG library, - * but they don't need to be visible to most applications using the library. - * To minimize application namespace pollution, the symbols won't be - * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. - */ - -#ifdef JPEG_INTERNALS -#define JPEG_INTERNAL_OPTIONS -#endif - -#ifdef JPEG_INTERNAL_OPTIONS - - -/* - * These defines indicate whether to include various optional functions. - * Undefining some of these symbols will produce a smaller but less capable - * library. Note that you can leave certain source files out of the - * compilation/linking process if you've #undef'd the corresponding symbols. - * (You may HAVE to do that if your compiler doesn't like null source files.) - */ - -/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ - -/* Capability options common to encoder and decoder: */ - -#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ -#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ -#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ - -/* Encoder capability options: */ - -#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ -#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ -/* Note: if you selected 12-bit data precision, it is dangerous to turn off - * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit - * precision, so jchuff.c normally uses entropy optimization to compute - * usable tables for higher precision. If you don't want to do optimization, - * you'll have to supply different default Huffman tables. - * The exact same statements apply for progressive JPEG: the default tables - * don't work for progressive mode. (This may get fixed, however.) - */ -#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ - -/* Decoder capability options: */ - -#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ -#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ -#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ -#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ -#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ -#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ -#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ -#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ - -/* more capability options later, no doubt */ - - -/* - * Ordering of RGB data in scanlines passed to or from the application. - * If your application wants to deal with data in the order B,G,R, just - * change these macros. You can also deal with formats such as R,G,B,X - * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing - * the offsets will also change the order in which colormap data is organized. - * RESTRICTIONS: - * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. - * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not - * useful if you are using JPEG color spaces other than YCbCr or grayscale. - * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE - * is not 3 (they don't understand about dummy color components!). So you - * can't use color quantization if you change that value. - */ - -#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ -#define RGB_GREEN 1 /* Offset of Green */ -#define RGB_BLUE 2 /* Offset of Blue */ -#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ - - -/* Definitions for speed-related optimizations. */ - - -/* If your compiler supports inline functions, define INLINE - * as the inline keyword; otherwise define it as empty. - */ - -#ifndef INLINE -#ifdef __GNUC__ /* for instance, GNU C knows about inline */ -#define INLINE __inline__ -#endif -#ifndef INLINE -#define INLINE /* default is to define it as empty */ -#endif -#endif - - -/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying - * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER - * as short on such a machine. MULTIPLIER must be at least 16 bits wide. - */ - -#ifndef MULTIPLIER -#define MULTIPLIER int /* type for fastest integer multiply */ -#endif - - -/* FAST_FLOAT should be either float or double, whichever is done faster - * by your compiler. (Note that this type is only used in the floating point - * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) - * Typically, float is faster in ANSI C compilers, while double is faster in - * pre-ANSI compilers (because they insist on converting to double anyway). - * The code below therefore chooses float if we have ANSI-style prototypes. - */ - -#ifndef FAST_FLOAT -#ifdef HAVE_PROTOTYPES -#define FAST_FLOAT float -#else -#define FAST_FLOAT double -#endif -#endif - -#endif /* JPEG_INTERNAL_OPTIONS */ +/* + * jmorecfg.h + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains additional configuration options that customize the + * JPEG software for special applications or support machine-dependent + * optimizations. Most users will not need to touch this file. + */ + + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ + + +/* + * Maximum number of components (color channels) allowed in JPEG image. + * To meet the letter of the JPEG spec, set this to 255. However, darn + * few applications need more than 4 channels (maybe 5 for CMYK + alpha + * mask). We recommend 10 as a reasonable compromise; use 4 if you are + * really short on memory. (Each allowed component costs a hundred or so + * bytes of storage, whether actually used in an image or not.) + */ + +#define MAX_COMPONENTS 10 /* maximum number of image components */ + + +/* + * Basic data types. + * You may need to change these if you have a machine with unusual data + * type sizes; for example, "char" not 8 bits, "short" not 16 bits, + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, + * but it had better be at least 16. + */ + +/* Representation of a single sample (pixel element value). + * We frequently allocate large arrays of these, so it's important to keep + * them small. But if you have memory to burn and access to char or short + * arrays is very slow on your hardware, you might want to change these. + */ + +#if BITS_IN_JSAMPLE == 8 +/* JSAMPLE should be the smallest type that will hold the values 0..255. + * You can use a signed char by having GETJSAMPLE mask it with 0xFF. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JSAMPLE; +#define GETJSAMPLE(value) ((int) (value)) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JSAMPLE; +#ifdef CHAR_IS_UNSIGNED +#define GETJSAMPLE(value) ((int) (value)) +#else +#define GETJSAMPLE(value) ((int) (value) & 0xFF) +#endif /* CHAR_IS_UNSIGNED */ + +#endif /* HAVE_UNSIGNED_CHAR */ + +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 + +#endif /* BITS_IN_JSAMPLE == 8 */ + + +#if BITS_IN_JSAMPLE == 12 +/* JSAMPLE should be the smallest type that will hold the values 0..4095. + * On nearly all machines "short" will do nicely. + */ + +typedef short JSAMPLE; +#define GETJSAMPLE(value) ((int) (value)) + +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 + +#endif /* BITS_IN_JSAMPLE == 12 */ + + +/* Representation of a DCT frequency coefficient. + * This should be a signed value of at least 16 bits; "short" is usually OK. + * Again, we allocate large arrays of these, but you can change to int + * if you have memory to burn and "short" is really slow. + */ + +typedef short JCOEF; + + +/* Compressed datastreams are represented as arrays of JOCTET. + * These must be EXACTLY 8 bits wide, at least once they are written to + * external storage. Note that when using the stdio data source/destination + * managers, this is also the data type passed to fread/fwrite. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JOCTET; +#define GETJOCTET(value) (value) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JOCTET; +#ifdef CHAR_IS_UNSIGNED +#define GETJOCTET(value) (value) +#else +#define GETJOCTET(value) ((value) & 0xFF) +#endif /* CHAR_IS_UNSIGNED */ + +#endif /* HAVE_UNSIGNED_CHAR */ + + +/* These typedefs are used for various table entries and so forth. + * They must be at least as wide as specified; but making them too big + * won't cost a huge amount of memory, so we don't provide special + * extraction code like we did for JSAMPLE. (In other words, these + * typedefs live at a different point on the speed/space tradeoff curve.) + */ + +/* UINT8 must hold at least the values 0..255. */ + +#ifdef HAVE_UNSIGNED_CHAR +typedef unsigned char UINT8; +#else /* not HAVE_UNSIGNED_CHAR */ +#ifdef CHAR_IS_UNSIGNED +typedef char UINT8; +#else /* not CHAR_IS_UNSIGNED */ +typedef short UINT8; +#endif /* CHAR_IS_UNSIGNED */ +#endif /* HAVE_UNSIGNED_CHAR */ + +/* UINT16 must hold at least the values 0..65535. */ + +#ifdef HAVE_UNSIGNED_SHORT +typedef unsigned short UINT16; +#else /* not HAVE_UNSIGNED_SHORT */ +typedef unsigned int UINT16; +#endif /* HAVE_UNSIGNED_SHORT */ + +/* INT16 must hold at least the values -32768..32767. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ +typedef short INT16; +#endif + +/* INT32 must hold at least signed 32-bit values. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +typedef long INT32; +#endif + +/* Datatype used for image dimensions. The JPEG standard only supports + * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore + * "unsigned int" is sufficient on all machines. However, if you need to + * handle larger images and you don't mind deviating from the spec, you + * can change this datatype. + */ + +typedef unsigned int JDIMENSION; + +#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ + + +/* These macros are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions; + * in particular, you'll need to do that to make the library a Windows DLL. + * Another application is to make all functions global for use with debuggers + * or code profilers that require it. + */ + +/* a function called through method pointers: */ +#define METHODDEF(type) static type +/* a function used only in its module: */ +#define LOCAL(type) static type +/* a function referenced thru EXTERNs: */ +#define GLOBAL(type) type +/* a reference to a GLOBAL function: */ +#define EXTERN(type) extern type + + +/* This macro is used to declare a "method", that is, a function pointer. + * We want to supply prototype parameters if the compiler can cope. + * Note that the arglist parameter must be parenthesized! + * Again, you can customize this if you need special linkage keywords. + */ + +#ifdef HAVE_PROTOTYPES +#define JMETHOD(type,methodname,arglist) type (*methodname) arglist +#else +#define JMETHOD(type,methodname,arglist) type (*methodname) () +#endif + + +/* Here is the pseudo-keyword for declaring pointers that must be "far" + * on 80x86 machines. Most of the specialized coding for 80x86 is handled + * by just saying "FAR *" where such a pointer is needed. In a few places + * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. + */ + +#ifdef NEED_FAR_POINTERS +#define FAR far +#else +#define FAR +#endif + + +/* + * On a few systems, type boolean and/or its values FALSE, TRUE may appear + * in standard header files. Or you may have conflicts with application- + * specific header files that you want to include together with these files. + * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. + */ + +#ifndef HAVE_BOOLEAN +typedef int boolean; +#endif +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ +#endif +#ifndef TRUE +#define TRUE 1 +#endif + + +/* + * The remaining options affect code selection within the JPEG library, + * but they don't need to be visible to most applications using the library. + * To minimize application namespace pollution, the symbols won't be + * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. + */ + +#ifdef JPEG_INTERNALS +#define JPEG_INTERNAL_OPTIONS +#endif + +#ifdef JPEG_INTERNAL_OPTIONS + + +/* + * These defines indicate whether to include various optional functions. + * Undefining some of these symbols will produce a smaller but less capable + * library. Note that you can leave certain source files out of the + * compilation/linking process if you've #undef'd the corresponding symbols. + * (You may HAVE to do that if your compiler doesn't like null source files.) + */ + +/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ + +/* Capability options common to encoder and decoder: */ + +#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ +#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ +#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ + +/* Encoder capability options: */ + +#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +/* Note: if you selected 12-bit data precision, it is dangerous to turn off + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit + * precision, so jchuff.c normally uses entropy optimization to compute + * usable tables for higher precision. If you don't want to do optimization, + * you'll have to supply different default Huffman tables. + * The exact same statements apply for progressive JPEG: the default tables + * don't work for progressive mode. (This may get fixed, however.) + */ +#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ + +/* Decoder capability options: */ + +#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ +#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ +#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ + +/* more capability options later, no doubt */ + + +/* + * Ordering of RGB data in scanlines passed to or from the application. + * If your application wants to deal with data in the order B,G,R, just + * change these macros. You can also deal with formats such as R,G,B,X + * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing + * the offsets will also change the order in which colormap data is organized. + * RESTRICTIONS: + * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. + * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not + * useful if you are using JPEG color spaces other than YCbCr or grayscale. + * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE + * is not 3 (they don't understand about dummy color components!). So you + * can't use color quantization if you change that value. + */ + +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 2 /* Offset of Blue */ +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ + + +/* Definitions for speed-related optimizations. */ + + +/* If your compiler supports inline functions, define INLINE + * as the inline keyword; otherwise define it as empty. + */ + +#ifndef INLINE +#ifdef __GNUC__ /* for instance, GNU C knows about inline */ +#define INLINE __inline__ +#endif +#ifndef INLINE +#define INLINE /* default is to define it as empty */ +#endif +#endif + + +/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying + * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER + * as short on such a machine. MULTIPLIER must be at least 16 bits wide. + */ + +#ifndef MULTIPLIER +#define MULTIPLIER int /* type for fastest integer multiply */ +#endif + + +/* FAST_FLOAT should be either float or double, whichever is done faster + * by your compiler. (Note that this type is only used in the floating point + * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) + * Typically, float is faster in ANSI C compilers, while double is faster in + * pre-ANSI compilers (because they insist on converting to double anyway). + * The code below therefore chooses float if we have ANSI-style prototypes. + */ + +#ifndef FAST_FLOAT +#ifdef HAVE_PROTOTYPES +#define FAST_FLOAT float +#else +#define FAST_FLOAT double +#endif +#endif + +#endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/Externals/libjpeg/jpeglib.h b/Externals/libjpeg/jpeglib.h index a893130b38..c1d119199a 100644 --- a/Externals/libjpeg/jpeglib.h +++ b/Externals/libjpeg/jpeglib.h @@ -1,1099 +1,1099 @@ -/* - * jpeglib.h - * - * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file defines the application interface for the JPEG library. - * Most applications using the library need only include this file, - * and perhaps jerror.h if they want to know the exact error codes. - */ - -#ifndef JPEGLIB_H -#define JPEGLIB_H - -/* - * First we include the configuration files that record how this - * installation of the JPEG library is set up. jconfig.h can be - * generated automatically for many systems. jmorecfg.h contains - * manual configuration options that most people need not worry about. - */ - -#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ -#include "jconfig.h" /* widely used configuration options */ -#endif -#include "jmorecfg.h" /* seldom changed options */ - - -/* Version ID for the JPEG library. - * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". - */ - -#define JPEG_LIB_VERSION 62 /* Version 6b */ - - -/* Various constants determining the sizes of things. - * All of these are specified by the JPEG standard, so don't change them - * if you want to be compatible. - */ - -#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ -#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ -#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ -#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ -#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ -#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ -#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ -/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; - * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. - * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU - * to handle it. We even let you do this from the jconfig.h file. However, - * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe - * sometimes emits noncompliant files doesn't mean you should too. - */ -#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ -#ifndef D_MAX_BLOCKS_IN_MCU -#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ -#endif - - -/* Data structures for images (arrays of samples and of DCT coefficients). - * On 80x86 machines, the image arrays are too big for near pointers, - * but the pointer arrays can fit in near memory. - */ - -#undef FAR -#define FAR - -typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */ -typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ -typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ - -typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ -typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */ -typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ -typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ - -typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ - - -/* Types for JPEG compression parameters and working tables. */ - - -/* DCT coefficient quantization tables. */ - -typedef struct { - /* This array gives the coefficient quantizers in natural array order - * (not the zigzag order in which they are stored in a JPEG DQT marker). - * CAUTION: IJG versions prior to v6a kept this array in zigzag order. - */ - UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ - /* This field is used only during compression. It's initialized FALSE when - * the table is created, and set TRUE when it's been output to the file. - * You could suppress output of a table by setting this to TRUE. - * (See jpeg_suppress_tables for an example.) - */ - boolean sent_table; /* TRUE when table has been output */ -} JQUANT_TBL; - - -/* Huffman coding tables. */ - -typedef struct { - /* These two fields directly represent the contents of a JPEG DHT marker */ - UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ - /* length k bits; bits[0] is unused */ - UINT8 huffval[256]; /* The symbols, in order of incr code length */ - /* This field is used only during compression. It's initialized FALSE when - * the table is created, and set TRUE when it's been output to the file. - * You could suppress output of a table by setting this to TRUE. - * (See jpeg_suppress_tables for an example.) - */ - boolean sent_table; /* TRUE when table has been output */ -} JHUFF_TBL; - - -/* Basic info about one component (color channel). */ - -typedef struct { - /* These values are fixed over the whole image. */ - /* For compression, they must be supplied by parameter setup; */ - /* for decompression, they are read from the SOF marker. */ - int component_id; /* identifier for this component (0..255) */ - int component_index; /* its index in SOF or cinfo->comp_info[] */ - int h_samp_factor; /* horizontal sampling factor (1..4) */ - int v_samp_factor; /* vertical sampling factor (1..4) */ - int quant_tbl_no; /* quantization table selector (0..3) */ - /* These values may vary between scans. */ - /* For compression, they must be supplied by parameter setup; */ - /* for decompression, they are read from the SOS marker. */ - /* The decompressor output side may not use these variables. */ - int dc_tbl_no; /* DC entropy table selector (0..3) */ - int ac_tbl_no; /* AC entropy table selector (0..3) */ - - /* Remaining fields should be treated as private by applications. */ - - /* These values are computed during compression or decompression startup: */ - /* Component's size in DCT blocks. - * Any dummy blocks added to complete an MCU are not counted; therefore - * these values do not depend on whether a scan is interleaved or not. - */ - JDIMENSION width_in_blocks; - JDIMENSION height_in_blocks; - /* Size of a DCT block in samples. Always DCTSIZE for compression. - * For decompression this is the size of the output from one DCT block, - * reflecting any scaling we choose to apply during the IDCT step. - * Values of 1,2,4,8 are likely to be supported. Note that different - * components may receive different IDCT scalings. - */ - int DCT_scaled_size; - /* The downsampled dimensions are the component's actual, unpadded number - * of samples at the main buffer (preprocessing/compression interface), thus - * downsampled_width = ceil(image_width * Hi/Hmax) - * and similarly for height. For decompression, IDCT scaling is included, so - * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE) - */ - JDIMENSION downsampled_width; /* actual width in samples */ - JDIMENSION downsampled_height; /* actual height in samples */ - /* This flag is used only for decompression. In cases where some of the - * components will be ignored (eg grayscale output from YCbCr image), - * we can skip most computations for the unused components. - */ - boolean component_needed; /* do we need the value of this component? */ - - /* These values are computed before starting a scan of the component. */ - /* The decompressor output side may not use these variables. */ - int MCU_width; /* number of blocks per MCU, horizontally */ - int MCU_height; /* number of blocks per MCU, vertically */ - int MCU_blocks; /* MCU_width * MCU_height */ - int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */ - int last_col_width; /* # of non-dummy blocks across in last MCU */ - int last_row_height; /* # of non-dummy blocks down in last MCU */ - - /* Saved quantization table for component; NULL if none yet saved. - * See jdinput.c comments about the need for this information. - * This field is currently used only for decompression. - */ - JQUANT_TBL * quant_table; - - /* Private per-component storage for DCT or IDCT subsystem. */ - void * dct_table; -} jpeg_component_info; - - -/* The script for encoding a multiple-scan file is an array of these: */ - -typedef struct { - int comps_in_scan; /* number of components encoded in this scan */ - int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ - int Ss, Se; /* progressive JPEG spectral selection parms */ - int Ah, Al; /* progressive JPEG successive approx. parms */ -} jpeg_scan_info; - -/* The decompressor can save APPn and COM markers in a list of these: */ - -typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; - -struct jpeg_marker_struct { - jpeg_saved_marker_ptr next; /* next in list, or NULL */ - UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ - unsigned int original_length; /* # bytes of data in the file */ - unsigned int data_length; /* # bytes of data saved at data[] */ - JOCTET FAR * data; /* the data contained in the marker */ - /* the marker length word is not counted in data_length or original_length */ -}; - -/* Known color spaces. */ - -typedef enum { - JCS_UNKNOWN, /* error/unspecified */ - JCS_GRAYSCALE, /* monochrome */ - JCS_RGB, /* red/green/blue */ - JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ - JCS_CMYK, /* C/M/Y/K */ - JCS_YCCK /* Y/Cb/Cr/K */ -} J_COLOR_SPACE; - -/* DCT/IDCT algorithm options. */ - -typedef enum { - JDCT_ISLOW, /* slow but accurate integer algorithm */ - JDCT_IFAST, /* faster, less accurate integer method */ - JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ -} J_DCT_METHOD; - -#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ -#define JDCT_DEFAULT JDCT_ISLOW -#endif -#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ -#define JDCT_FASTEST JDCT_IFAST -#endif - -/* Dithering options for decompression. */ - -typedef enum { - JDITHER_NONE, /* no dithering */ - JDITHER_ORDERED, /* simple ordered dither */ - JDITHER_FS /* Floyd-Steinberg error diffusion dither */ -} J_DITHER_MODE; - - -/* Common fields between JPEG compression and decompression master structs. */ - -#define jpeg_common_fields \ - struct jpeg_error_mgr * err; /* Error handler module */\ - struct jpeg_memory_mgr * mem; /* Memory manager module */\ - struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ - void * client_data; /* Available for use by application */\ - boolean is_decompressor; /* So common code can tell which is which */\ - int global_state /* For checking call sequence validity */ - -/* Routines that are to be used by both halves of the library are declared - * to receive a pointer to this structure. There are no actual instances of - * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. - */ -struct jpeg_common_struct { - jpeg_common_fields; /* Fields common to both master struct types */ - /* Additional fields follow in an actual jpeg_compress_struct or - * jpeg_decompress_struct. All three structs must agree on these - * initial fields! (This would be a lot cleaner in C++.) - */ -}; - -typedef struct jpeg_common_struct * j_common_ptr; -typedef struct jpeg_compress_struct * j_compress_ptr; -typedef struct jpeg_decompress_struct * j_decompress_ptr; - - -/* Master record for a compression instance */ - -struct jpeg_compress_struct { - jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ - - /* Destination for compressed data */ - struct jpeg_destination_mgr * dest; - - /* Description of source image --- these fields must be filled in by - * outer application before starting compression. in_color_space must - * be correct before you can even call jpeg_set_defaults(). - */ - - JDIMENSION image_width; /* input image width */ - JDIMENSION image_height; /* input image height */ - int input_components; /* # of color components in input image */ - J_COLOR_SPACE in_color_space; /* colorspace of input image */ - - double input_gamma; /* image gamma of input image */ - - /* Compression parameters --- these fields must be set before calling - * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to - * initialize everything to reasonable defaults, then changing anything - * the application specifically wants to change. That way you won't get - * burnt when new parameters are added. Also note that there are several - * helper routines to simplify changing parameters. - */ - - int data_precision; /* bits of precision in image data */ - - int num_components; /* # of color components in JPEG image */ - J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ - - jpeg_component_info * comp_info; - /* comp_info[i] describes component that appears i'th in SOF */ - - JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; - /* ptrs to coefficient quantization tables, or NULL if not defined */ - - JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; - JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; - /* ptrs to Huffman coding tables, or NULL if not defined */ - - UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ - UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ - UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ - - int num_scans; /* # of entries in scan_info array */ - const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ - /* The default value of scan_info is NULL, which causes a single-scan - * sequential JPEG file to be emitted. To create a multi-scan file, - * set num_scans and scan_info to point to an array of scan definitions. - */ - - boolean raw_data_in; /* TRUE=caller supplies downsampled data */ - boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ - boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ - boolean CCIR601_sampling; /* TRUE=first samples are cosited */ - int smoothing_factor; /* 1..100, or 0 for no input smoothing */ - J_DCT_METHOD dct_method; /* DCT algorithm selector */ - - /* The restart interval can be specified in absolute MCUs by setting - * restart_interval, or in MCU rows by setting restart_in_rows - * (in which case the correct restart_interval will be figured - * for each scan). - */ - unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ - int restart_in_rows; /* if > 0, MCU rows per restart interval */ - - /* Parameters controlling emission of special markers. */ - - boolean write_JFIF_header; /* should a JFIF marker be written? */ - UINT8 JFIF_major_version; /* What to write for the JFIF version number */ - UINT8 JFIF_minor_version; - /* These three values are not used by the JPEG code, merely copied */ - /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ - /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ - /* ratio is defined by X_density/Y_density even when density_unit=0. */ - UINT8 density_unit; /* JFIF code for pixel size units */ - UINT16 X_density; /* Horizontal pixel density */ - UINT16 Y_density; /* Vertical pixel density */ - boolean write_Adobe_marker; /* should an Adobe marker be written? */ - - /* State variable: index of next scanline to be written to - * jpeg_write_scanlines(). Application may use this to control its - * processing loop, e.g., "while (next_scanline < image_height)". - */ - - JDIMENSION next_scanline; /* 0 .. image_height-1 */ - - /* Remaining fields are known throughout compressor, but generally - * should not be touched by a surrounding application. - */ - - /* - * These fields are computed during compression startup - */ - boolean progressive_mode; /* TRUE if scan script uses progressive mode */ - int max_h_samp_factor; /* largest h_samp_factor */ - int max_v_samp_factor; /* largest v_samp_factor */ - - JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ - /* The coefficient controller receives data in units of MCU rows as defined - * for fully interleaved scans (whether the JPEG file is interleaved or not). - * There are v_samp_factor * DCTSIZE sample rows of each component in an - * "iMCU" (interleaved MCU) row. - */ - - /* - * These fields are valid during any one scan. - * They describe the components and MCUs actually appearing in the scan. - */ - int comps_in_scan; /* # of JPEG components in this scan */ - jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; - /* *cur_comp_info[i] describes component that appears i'th in SOS */ - - JDIMENSION MCUs_per_row; /* # of MCUs across the image */ - JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - - int blocks_in_MCU; /* # of DCT blocks per MCU */ - int MCU_membership[C_MAX_BLOCKS_IN_MCU]; - /* MCU_membership[i] is index in cur_comp_info of component owning */ - /* i'th block in an MCU */ - - int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ - - /* - * Links to compression subobjects (methods and private variables of modules) - */ - struct jpeg_comp_master * master; - struct jpeg_c_main_controller * main; - struct jpeg_c_prep_controller * prep; - struct jpeg_c_coef_controller * coef; - struct jpeg_marker_writer * marker; - struct jpeg_color_converter * cconvert; - struct jpeg_downsampler * downsample; - struct jpeg_forward_dct * fdct; - struct jpeg_entropy_encoder * entropy; - jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ - int script_space_size; -}; - - -/* Master record for a decompression instance */ - -struct jpeg_decompress_struct { - jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ - - /* Source of compressed data */ - struct jpeg_source_mgr * src; - - /* Basic description of image --- filled in by jpeg_read_header(). */ - /* Application may inspect these values to decide how to process image. */ - - JDIMENSION image_width; /* nominal image width (from SOF marker) */ - JDIMENSION image_height; /* nominal image height */ - int num_components; /* # of color components in JPEG image */ - J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ - - /* Decompression processing parameters --- these fields must be set before - * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes - * them to default values. - */ - - J_COLOR_SPACE out_color_space; /* colorspace for output */ - - unsigned int scale_num, scale_denom; /* fraction by which to scale image */ - - double output_gamma; /* image gamma wanted in output */ - - boolean buffered_image; /* TRUE=multiple output passes */ - boolean raw_data_out; /* TRUE=downsampled data wanted */ - - J_DCT_METHOD dct_method; /* IDCT algorithm selector */ - boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ - boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ - - boolean quantize_colors; /* TRUE=colormapped output wanted */ - /* the following are ignored if not quantize_colors: */ - J_DITHER_MODE dither_mode; /* type of color dithering to use */ - boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ - int desired_number_of_colors; /* max # colors to use in created colormap */ - /* these are significant only in buffered-image mode: */ - boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ - boolean enable_external_quant;/* enable future use of external colormap */ - boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ - - /* Description of actual output image that will be returned to application. - * These fields are computed by jpeg_start_decompress(). - * You can also use jpeg_calc_output_dimensions() to determine these values - * in advance of calling jpeg_start_decompress(). - */ - - JDIMENSION output_width; /* scaled image width */ - JDIMENSION output_height; /* scaled image height */ - int out_color_components; /* # of color components in out_color_space */ - int output_components; /* # of color components returned */ - /* output_components is 1 (a colormap index) when quantizing colors; - * otherwise it equals out_color_components. - */ - int rec_outbuf_height; /* min recommended height of scanline buffer */ - /* If the buffer passed to jpeg_read_scanlines() is less than this many rows - * high, space and time will be wasted due to unnecessary data copying. - * Usually rec_outbuf_height will be 1 or 2, at most 4. - */ - - /* When quantizing colors, the output colormap is described by these fields. - * The application can supply a colormap by setting colormap non-NULL before - * calling jpeg_start_decompress; otherwise a colormap is created during - * jpeg_start_decompress or jpeg_start_output. - * The map has out_color_components rows and actual_number_of_colors columns. - */ - int actual_number_of_colors; /* number of entries in use */ - JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ - - /* State variables: these variables indicate the progress of decompression. - * The application may examine these but must not modify them. - */ - - /* Row index of next scanline to be read from jpeg_read_scanlines(). - * Application may use this to control its processing loop, e.g., - * "while (output_scanline < output_height)". - */ - JDIMENSION output_scanline; /* 0 .. output_height-1 */ - - /* Current input scan number and number of iMCU rows completed in scan. - * These indicate the progress of the decompressor input side. - */ - int input_scan_number; /* Number of SOS markers seen so far */ - JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ - - /* The "output scan number" is the notional scan being displayed by the - * output side. The decompressor will not allow output scan/row number - * to get ahead of input scan/row, but it can fall arbitrarily far behind. - */ - int output_scan_number; /* Nominal scan number being displayed */ - JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ - - /* Current progression status. coef_bits[c][i] indicates the precision - * with which component c's DCT coefficient i (in zigzag order) is known. - * It is -1 when no data has yet been received, otherwise it is the point - * transform (shift) value for the most recent scan of the coefficient - * (thus, 0 at completion of the progression). - * This pointer is NULL when reading a non-progressive file. - */ - int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ - - /* Internal JPEG parameters --- the application usually need not look at - * these fields. Note that the decompressor output side may not use - * any parameters that can change between scans. - */ - - /* Quantization and Huffman tables are carried forward across input - * datastreams when processing abbreviated JPEG datastreams. - */ - - JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; - /* ptrs to coefficient quantization tables, or NULL if not defined */ - - JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; - JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; - /* ptrs to Huffman coding tables, or NULL if not defined */ - - /* These parameters are never carried across datastreams, since they - * are given in SOF/SOS markers or defined to be reset by SOI. - */ - - int data_precision; /* bits of precision in image data */ - - jpeg_component_info * comp_info; - /* comp_info[i] describes component that appears i'th in SOF */ - - boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ - boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ - - UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ - UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ - UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ - - unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ - - /* These fields record data obtained from optional markers recognized by - * the JPEG library. - */ - boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ - /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ - UINT8 JFIF_major_version; /* JFIF version number */ - UINT8 JFIF_minor_version; - UINT8 density_unit; /* JFIF code for pixel size units */ - UINT16 X_density; /* Horizontal pixel density */ - UINT16 Y_density; /* Vertical pixel density */ - boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ - UINT8 Adobe_transform; /* Color transform code from Adobe marker */ - - boolean CCIR601_sampling; /* TRUE=first samples are cosited */ - - /* Aside from the specific data retained from APPn markers known to the - * library, the uninterpreted contents of any or all APPn and COM markers - * can be saved in a list for examination by the application. - */ - jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ - - /* Remaining fields are known throughout decompressor, but generally - * should not be touched by a surrounding application. - */ - - /* - * These fields are computed during decompression startup - */ - int max_h_samp_factor; /* largest h_samp_factor */ - int max_v_samp_factor; /* largest v_samp_factor */ - - int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ - - JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ - /* The coefficient controller's input and output progress is measured in - * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows - * in fully interleaved JPEG scans, but are used whether the scan is - * interleaved or not. We define an iMCU row as v_samp_factor DCT block - * rows of each component. Therefore, the IDCT output contains - * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row. - */ - - JSAMPLE * sample_range_limit; /* table for fast range-limiting */ - - /* - * These fields are valid during any one scan. - * They describe the components and MCUs actually appearing in the scan. - * Note that the decompressor output side must not use these fields. - */ - int comps_in_scan; /* # of JPEG components in this scan */ - jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; - /* *cur_comp_info[i] describes component that appears i'th in SOS */ - - JDIMENSION MCUs_per_row; /* # of MCUs across the image */ - JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - - int blocks_in_MCU; /* # of DCT blocks per MCU */ - int MCU_membership[D_MAX_BLOCKS_IN_MCU]; - /* MCU_membership[i] is index in cur_comp_info of component owning */ - /* i'th block in an MCU */ - - int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ - - /* This field is shared between entropy decoder and marker parser. - * It is either zero or the code of a JPEG marker that has been - * read from the data source, but has not yet been processed. - */ - int unread_marker; - - /* - * Links to decompression subobjects (methods, private variables of modules) - */ - struct jpeg_decomp_master * master; - struct jpeg_d_main_controller * main; - struct jpeg_d_coef_controller * coef; - struct jpeg_d_post_controller * post; - struct jpeg_input_controller * inputctl; - struct jpeg_marker_reader * marker; - struct jpeg_entropy_decoder * entropy; - struct jpeg_inverse_dct * idct; - struct jpeg_upsampler * upsample; - struct jpeg_color_deconverter * cconvert; - struct jpeg_color_quantizer * cquantize; -}; - - -/* "Object" declarations for JPEG modules that may be supplied or called - * directly by the surrounding application. - * As with all objects in the JPEG library, these structs only define the - * publicly visible methods and state variables of a module. Additional - * private fields may exist after the public ones. - */ - - -/* Error handler object */ - -struct jpeg_error_mgr { - /* Error exit handler: does not return to caller */ - JMETHOD(void, error_exit, (j_common_ptr cinfo)); - /* Conditionally emit a trace or warning message */ - JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); - /* Routine that actually outputs a trace or error message */ - JMETHOD(void, output_message, (j_common_ptr cinfo)); - /* Format a message string for the most recent JPEG error or message */ - JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); -#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ - /* Reset error state variables at start of a new image */ - JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); - - /* The message ID code and any parameters are saved here. - * A message can have one string parameter or up to 8 int parameters. - */ - int msg_code; -#define JMSG_STR_PARM_MAX 80 - union { - int i[8]; - char s[JMSG_STR_PARM_MAX]; - } msg_parm; - - /* Standard state variables for error facility */ - - int trace_level; /* max msg_level that will be displayed */ - - /* For recoverable corrupt-data errors, we emit a warning message, - * but keep going unless emit_message chooses to abort. emit_message - * should count warnings in num_warnings. The surrounding application - * can check for bad data by seeing if num_warnings is nonzero at the - * end of processing. - */ - long num_warnings; /* number of corrupt-data warnings */ - - /* These fields point to the table(s) of error message strings. - * An application can change the table pointer to switch to a different - * message list (typically, to change the language in which errors are - * reported). Some applications may wish to add additional error codes - * that will be handled by the JPEG library error mechanism; the second - * table pointer is used for this purpose. - * - * First table includes all errors generated by JPEG library itself. - * Error code 0 is reserved for a "no such error string" message. - */ - const char * const * jpeg_message_table; /* Library errors */ - int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ - /* Second table can be added by application (see cjpeg/djpeg for example). - * It contains strings numbered first_addon_message..last_addon_message. - */ - const char * const * addon_message_table; /* Non-library errors */ - int first_addon_message; /* code for first string in addon table */ - int last_addon_message; /* code for last string in addon table */ -}; - - -/* Progress monitor object */ - -struct jpeg_progress_mgr { - JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); - - long pass_counter; /* work units completed in this pass */ - long pass_limit; /* total number of work units in this pass */ - int completed_passes; /* passes completed so far */ - int total_passes; /* total number of passes expected */ -}; - - -/* Data destination object for compression */ - -struct jpeg_destination_mgr { - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - - JMETHOD(void, init_destination, (j_compress_ptr cinfo)); - JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); - JMETHOD(void, term_destination, (j_compress_ptr cinfo)); -}; - - -/* Data source object for decompression */ - -struct jpeg_source_mgr { - const JOCTET * next_input_byte; /* => next byte to read from buffer */ - size_t bytes_in_buffer; /* # of bytes remaining in buffer */ - - JMETHOD(void, init_source, (j_decompress_ptr cinfo)); - JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); - JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); - JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); - JMETHOD(void, term_source, (j_decompress_ptr cinfo)); -}; - - -/* Memory manager object. - * Allocates "small" objects (a few K total), "large" objects (tens of K), - * and "really big" objects (virtual arrays with backing store if needed). - * The memory manager does not allow individual objects to be freed; rather, - * each created object is assigned to a pool, and whole pools can be freed - * at once. This is faster and more convenient than remembering exactly what - * to free, especially where malloc()/free() are not too speedy. - * NB: alloc routines never return NULL. They exit to error_exit if not - * successful. - */ - -#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ -#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ -#define JPOOL_NUMPOOLS 2 - -typedef struct jvirt_sarray_control * jvirt_sarray_ptr; -typedef struct jvirt_barray_control * jvirt_barray_ptr; - - -struct jpeg_memory_mgr { - /* Method pointers */ - JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); - JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); - JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, - JDIMENSION samplesperrow, - JDIMENSION numrows)); - JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, - JDIMENSION blocksperrow, - JDIMENSION numrows)); - JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, - int pool_id, - boolean pre_zero, - JDIMENSION samplesperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); - JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, - int pool_id, - boolean pre_zero, - JDIMENSION blocksperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); - JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); - JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, - jvirt_sarray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - boolean writable)); - JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, - jvirt_barray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - boolean writable)); - JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); - JMETHOD(void, self_destruct, (j_common_ptr cinfo)); - - /* Limit on memory allocation for this JPEG object. (Note that this is - * merely advisory, not a guaranteed maximum; it only affects the space - * used for virtual-array buffers.) May be changed by outer application - * after creating the JPEG object. - */ - long max_memory_to_use; - - /* Maximum allocation request accepted by alloc_large. */ - long max_alloc_chunk; -}; - - -/* Routine signature for application-supplied marker processing methods. - * Need not pass marker code since it is stored in cinfo->unread_marker. - */ -typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); - - -/* Declarations for routines called by application. - * The JPP macro hides prototype parameters from compilers that can't cope. - * Note JPP requires double parentheses. - */ - -#ifdef HAVE_PROTOTYPES -#define JPP(arglist) arglist -#else -#define JPP(arglist) () -#endif - - -/* Short forms of external names for systems with brain-damaged linkers. - * We shorten external names to be unique in the first six letters, which - * is good enough for all known systems. - * (If your compiler itself needs names to be unique in less than 15 - * characters, you are out of luck. Get a better compiler.) - */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_error jStdError -#define jpeg_CreateCompress jCreaCompress -#define jpeg_CreateDecompress jCreaDecompress -#define jpeg_destroy_compress jDestCompress -#define jpeg_destroy_decompress jDestDecompress -#define jpeg_stdio_dest jStdDest -#define jpeg_stdio_src jStdSrc -#define jpeg_set_defaults jSetDefaults -#define jpeg_set_colorspace jSetColorspace -#define jpeg_default_colorspace jDefColorspace -#define jpeg_set_quality jSetQuality -#define jpeg_set_linear_quality jSetLQuality -#define jpeg_add_quant_table jAddQuantTable -#define jpeg_quality_scaling jQualityScaling -#define jpeg_simple_progression jSimProgress -#define jpeg_suppress_tables jSuppressTables -#define jpeg_alloc_quant_table jAlcQTable -#define jpeg_alloc_huff_table jAlcHTable -#define jpeg_start_compress jStrtCompress -#define jpeg_write_scanlines jWrtScanlines -#define jpeg_finish_compress jFinCompress -#define jpeg_write_raw_data jWrtRawData -#define jpeg_write_marker jWrtMarker -#define jpeg_write_m_header jWrtMHeader -#define jpeg_write_m_byte jWrtMByte -#define jpeg_write_tables jWrtTables -#define jpeg_read_header jReadHeader -#define jpeg_start_decompress jStrtDecompress -#define jpeg_read_scanlines jReadScanlines -#define jpeg_finish_decompress jFinDecompress -#define jpeg_read_raw_data jReadRawData -#define jpeg_has_multiple_scans jHasMultScn -#define jpeg_start_output jStrtOutput -#define jpeg_finish_output jFinOutput -#define jpeg_input_complete jInComplete -#define jpeg_new_colormap jNewCMap -#define jpeg_consume_input jConsumeInput -#define jpeg_calc_output_dimensions jCalcDimensions -#define jpeg_save_markers jSaveMarkers -#define jpeg_set_marker_processor jSetMarker -#define jpeg_read_coefficients jReadCoefs -#define jpeg_write_coefficients jWrtCoefs -#define jpeg_copy_critical_parameters jCopyCrit -#define jpeg_abort_compress jAbrtCompress -#define jpeg_abort_decompress jAbrtDecompress -#define jpeg_abort jAbort -#define jpeg_destroy jDestroy -#define jpeg_resync_to_restart jResyncRestart -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - -/* Default error-management setup */ -EXTERN(struct jpeg_error_mgr *) jpeg_std_error - JPP((struct jpeg_error_mgr * err)); - -/* Initialization of JPEG compression objects. - * jpeg_create_compress() and jpeg_create_decompress() are the exported - * names that applications should call. These expand to calls on - * jpeg_CreateCompress and jpeg_CreateDecompress with additional information - * passed for version mismatch checking. - * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. - */ -#define jpeg_create_compress(cinfo) \ - jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_compress_struct)) -#define jpeg_create_decompress(cinfo) \ - jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_decompress_struct)) -EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, - int version, size_t structsize)); -EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, - int version, size_t structsize)); -/* Destruction of JPEG compression objects */ -EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); - -/* Standard data source and destination managers: stdio streams. */ -/* Caller is responsible for opening the file before and closing after. */ -EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); -EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); - -/* Default parameter setup for compression */ -EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); -/* Compression parameter setup aids */ -EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, - J_COLOR_SPACE colorspace)); -EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, - boolean force_baseline)); -EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, - int scale_factor, - boolean force_baseline)); -EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - int scale_factor, - boolean force_baseline)); -EXTERN(int) jpeg_quality_scaling JPP((int quality)); -EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, - boolean suppress)); -EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); -EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); - -/* Main entry points for compression */ -EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, - boolean write_all_tables)); -EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION num_lines)); -EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); - -/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ -EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, - JSAMPIMAGE data, - JDIMENSION num_lines)); - -/* Write a special marker. See libjpeg.doc concerning safe usage. */ -EXTERN(void) jpeg_write_marker - JPP((j_compress_ptr cinfo, int marker, - const JOCTET * dataptr, unsigned int datalen)); -/* Same, but piecemeal. */ -EXTERN(void) jpeg_write_m_header - JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); -EXTERN(void) jpeg_write_m_byte - JPP((j_compress_ptr cinfo, int val)); - -/* Alternate compression function: just write an abbreviated table file */ -EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); - -/* Decompression startup: read start of JPEG datastream to see what's there */ -EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, - boolean require_image)); -/* Return value is one of: */ -#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ -#define JPEG_HEADER_OK 1 /* Found valid image datastream */ -#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ -/* If you pass require_image = TRUE (normal case), you need not check for - * a TABLES_ONLY return code; an abbreviated file will cause an error exit. - * JPEG_SUSPENDED is only possible if you use a data source module that can - * give a suspension return (the stdio source module doesn't). - */ - -/* Main entry points for decompression */ -EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); -EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION max_lines)); -EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); - -/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ -EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, - JSAMPIMAGE data, - JDIMENSION max_lines)); - -/* Additional entry points for buffered-image mode. */ -EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); -EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, - int scan_number)); -EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); -EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); -EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); -EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); -/* Return value is one of: */ -/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ -#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ -#define JPEG_REACHED_EOI 2 /* Reached end of image */ -#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ -#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ - -/* Precalculate output dimensions for current decompression parameters. */ -EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); - -/* Control saving of COM and APPn markers into marker_list. */ -EXTERN(void) jpeg_save_markers - JPP((j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit)); - -/* Install a special processing method for COM or APPn markers. */ -EXTERN(void) jpeg_set_marker_processor - JPP((j_decompress_ptr cinfo, int marker_code, - jpeg_marker_parser_method routine)); - -/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ -EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); -EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays)); -EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, - j_compress_ptr dstinfo)); - -/* If you choose to abort compression or decompression before completing - * jpeg_finish_(de)compress, then you need to clean up to release memory, - * temporary files, etc. You can just call jpeg_destroy_(de)compress - * if you're done with the JPEG object, but if you want to clean it up and - * reuse it, call this: - */ -EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); -EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); - -/* Generic versions of jpeg_abort and jpeg_destroy that work on either - * flavor of JPEG object. These may be more convenient in some places. - */ -EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); -EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); - -/* Default restart-marker-resync procedure for use by data source modules */ -EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, - int desired)); - - -/* These marker codes are exported since applications and data source modules - * are likely to want to use them. - */ - -#define JPEG_RST0 0xD0 /* RST0 marker code */ -#define JPEG_EOI 0xD9 /* EOI marker code */ -#define JPEG_APP0 0xE0 /* APP0 marker code */ -#define JPEG_COM 0xFE /* COM marker code */ - - -/* If we have a brain-damaged compiler that emits warnings (or worse, errors) - * for structure definitions that are never filled in, keep it quiet by - * supplying dummy definitions for the various substructures. - */ - -#ifdef INCOMPLETE_TYPES_BROKEN -#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ -struct jvirt_sarray_control { long dummy; }; -struct jvirt_barray_control { long dummy; }; -struct jpeg_comp_master { long dummy; }; -struct jpeg_c_main_controller { long dummy; }; -struct jpeg_c_prep_controller { long dummy; }; -struct jpeg_c_coef_controller { long dummy; }; -struct jpeg_marker_writer { long dummy; }; -struct jpeg_color_converter { long dummy; }; -struct jpeg_downsampler { long dummy; }; -struct jpeg_forward_dct { long dummy; }; -struct jpeg_entropy_encoder { long dummy; }; -struct jpeg_decomp_master { long dummy; }; -struct jpeg_d_main_controller { long dummy; }; -struct jpeg_d_coef_controller { long dummy; }; -struct jpeg_d_post_controller { long dummy; }; -struct jpeg_input_controller { long dummy; }; -struct jpeg_marker_reader { long dummy; }; -struct jpeg_entropy_decoder { long dummy; }; -struct jpeg_inverse_dct { long dummy; }; -struct jpeg_upsampler { long dummy; }; -struct jpeg_color_deconverter { long dummy; }; -struct jpeg_color_quantizer { long dummy; }; -#endif /* JPEG_INTERNALS */ -#endif /* INCOMPLETE_TYPES_BROKEN */ - - -/* - * The JPEG library modules define JPEG_INTERNALS before including this file. - * The internal structure declarations are read only when that is true. - * Applications using the library should not include jpegint.h, but may wish - * to include jerror.h. - */ - -#ifdef JPEG_INTERNALS -#include "jpegint.h" /* fetch private declarations */ -#include "jerror.h" /* fetch error codes too */ -#endif - -#endif /* JPEGLIB_H */ +/* + * jpeglib.h + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the application interface for the JPEG library. + * Most applications using the library need only include this file, + * and perhaps jerror.h if they want to know the exact error codes. + */ + +#ifndef JPEGLIB_H +#define JPEGLIB_H + +/* + * First we include the configuration files that record how this + * installation of the JPEG library is set up. jconfig.h can be + * generated automatically for many systems. jmorecfg.h contains + * manual configuration options that most people need not worry about. + */ + +#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ +#include "jconfig.h" /* widely used configuration options */ +#endif +#include "jmorecfg.h" /* seldom changed options */ + + +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ + +#define JPEG_LIB_VERSION 62 /* Version 6b */ + + +/* Various constants determining the sizes of things. + * All of these are specified by the JPEG standard, so don't change them + * if you want to be compatible. + */ + +#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ +#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; + * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. + * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU + * to handle it. We even let you do this from the jconfig.h file. However, + * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe + * sometimes emits noncompliant files doesn't mean you should too. + */ +#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ +#ifndef D_MAX_BLOCKS_IN_MCU +#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ +#endif + + +/* Data structures for images (arrays of samples and of DCT coefficients). + * On 80x86 machines, the image arrays are too big for near pointers, + * but the pointer arrays can fit in near memory. + */ + +#undef FAR +#define FAR + +typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ + +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ + +typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ + + +/* Types for JPEG compression parameters and working tables. */ + + +/* DCT coefficient quantization tables. */ + +typedef struct { + /* This array gives the coefficient quantizers in natural array order + * (not the zigzag order in which they are stored in a JPEG DQT marker). + * CAUTION: IJG versions prior to v6a kept this array in zigzag order. + */ + UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JQUANT_TBL; + + +/* Huffman coding tables. */ + +typedef struct { + /* These two fields directly represent the contents of a JPEG DHT marker */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JHUFF_TBL; + + +/* Basic info about one component (color channel). */ + +typedef struct { + /* These values are fixed over the whole image. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOF marker. */ + int component_id; /* identifier for this component (0..255) */ + int component_index; /* its index in SOF or cinfo->comp_info[] */ + int h_samp_factor; /* horizontal sampling factor (1..4) */ + int v_samp_factor; /* vertical sampling factor (1..4) */ + int quant_tbl_no; /* quantization table selector (0..3) */ + /* These values may vary between scans. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOS marker. */ + /* The decompressor output side may not use these variables. */ + int dc_tbl_no; /* DC entropy table selector (0..3) */ + int ac_tbl_no; /* AC entropy table selector (0..3) */ + + /* Remaining fields should be treated as private by applications. */ + + /* These values are computed during compression or decompression startup: */ + /* Component's size in DCT blocks. + * Any dummy blocks added to complete an MCU are not counted; therefore + * these values do not depend on whether a scan is interleaved or not. + */ + JDIMENSION width_in_blocks; + JDIMENSION height_in_blocks; + /* Size of a DCT block in samples. Always DCTSIZE for compression. + * For decompression this is the size of the output from one DCT block, + * reflecting any scaling we choose to apply during the IDCT step. + * Values of 1,2,4,8 are likely to be supported. Note that different + * components may receive different IDCT scalings. + */ + int DCT_scaled_size; + /* The downsampled dimensions are the component's actual, unpadded number + * of samples at the main buffer (preprocessing/compression interface), thus + * downsampled_width = ceil(image_width * Hi/Hmax) + * and similarly for height. For decompression, IDCT scaling is included, so + * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE) + */ + JDIMENSION downsampled_width; /* actual width in samples */ + JDIMENSION downsampled_height; /* actual height in samples */ + /* This flag is used only for decompression. In cases where some of the + * components will be ignored (eg grayscale output from YCbCr image), + * we can skip most computations for the unused components. + */ + boolean component_needed; /* do we need the value of this component? */ + + /* These values are computed before starting a scan of the component. */ + /* The decompressor output side may not use these variables. */ + int MCU_width; /* number of blocks per MCU, horizontally */ + int MCU_height; /* number of blocks per MCU, vertically */ + int MCU_blocks; /* MCU_width * MCU_height */ + int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */ + int last_col_width; /* # of non-dummy blocks across in last MCU */ + int last_row_height; /* # of non-dummy blocks down in last MCU */ + + /* Saved quantization table for component; NULL if none yet saved. + * See jdinput.c comments about the need for this information. + * This field is currently used only for decompression. + */ + JQUANT_TBL * quant_table; + + /* Private per-component storage for DCT or IDCT subsystem. */ + void * dct_table; +} jpeg_component_info; + + +/* The script for encoding a multiple-scan file is an array of these: */ + +typedef struct { + int comps_in_scan; /* number of components encoded in this scan */ + int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ + int Ss, Se; /* progressive JPEG spectral selection parms */ + int Ah, Al; /* progressive JPEG successive approx. parms */ +} jpeg_scan_info; + +/* The decompressor can save APPn and COM markers in a list of these: */ + +typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; + +struct jpeg_marker_struct { + jpeg_saved_marker_ptr next; /* next in list, or NULL */ + UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ + unsigned int original_length; /* # bytes of data in the file */ + unsigned int data_length; /* # bytes of data saved at data[] */ + JOCTET FAR * data; /* the data contained in the marker */ + /* the marker length word is not counted in data_length or original_length */ +}; + +/* Known color spaces. */ + +typedef enum { + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK /* Y/Cb/Cr/K */ +} J_COLOR_SPACE; + +/* DCT/IDCT algorithm options. */ + +typedef enum { + JDCT_ISLOW, /* slow but accurate integer algorithm */ + JDCT_IFAST, /* faster, less accurate integer method */ + JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ +} J_DCT_METHOD; + +#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ +#define JDCT_DEFAULT JDCT_ISLOW +#endif +#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ +#define JDCT_FASTEST JDCT_IFAST +#endif + +/* Dithering options for decompression. */ + +typedef enum { + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ +} J_DITHER_MODE; + + +/* Common fields between JPEG compression and decompression master structs. */ + +#define jpeg_common_fields \ + struct jpeg_error_mgr * err; /* Error handler module */\ + struct jpeg_memory_mgr * mem; /* Memory manager module */\ + struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ + void * client_data; /* Available for use by application */\ + boolean is_decompressor; /* So common code can tell which is which */\ + int global_state /* For checking call sequence validity */ + +/* Routines that are to be used by both halves of the library are declared + * to receive a pointer to this structure. There are no actual instances of + * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. + */ +struct jpeg_common_struct { + jpeg_common_fields; /* Fields common to both master struct types */ + /* Additional fields follow in an actual jpeg_compress_struct or + * jpeg_decompress_struct. All three structs must agree on these + * initial fields! (This would be a lot cleaner in C++.) + */ +}; + +typedef struct jpeg_common_struct * j_common_ptr; +typedef struct jpeg_compress_struct * j_compress_ptr; +typedef struct jpeg_decompress_struct * j_decompress_ptr; + + +/* Master record for a compression instance */ + +struct jpeg_compress_struct { + jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ + + /* Destination for compressed data */ + struct jpeg_destination_mgr * dest; + + /* Description of source image --- these fields must be filled in by + * outer application before starting compression. in_color_space must + * be correct before you can even call jpeg_set_defaults(). + */ + + JDIMENSION image_width; /* input image width */ + JDIMENSION image_height; /* input image height */ + int input_components; /* # of color components in input image */ + J_COLOR_SPACE in_color_space; /* colorspace of input image */ + + double input_gamma; /* image gamma of input image */ + + /* Compression parameters --- these fields must be set before calling + * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to + * initialize everything to reasonable defaults, then changing anything + * the application specifically wants to change. That way you won't get + * burnt when new parameters are added. Also note that there are several + * helper routines to simplify changing parameters. + */ + + int data_precision; /* bits of precision in image data */ + + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + int num_scans; /* # of entries in scan_info array */ + const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ + /* The default value of scan_info is NULL, which causes a single-scan + * sequential JPEG file to be emitted. To create a multi-scan file, + * set num_scans and scan_info to point to an array of scan definitions. + */ + + boolean raw_data_in; /* TRUE=caller supplies downsampled data */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + int smoothing_factor; /* 1..100, or 0 for no input smoothing */ + J_DCT_METHOD dct_method; /* DCT algorithm selector */ + + /* The restart interval can be specified in absolute MCUs by setting + * restart_interval, or in MCU rows by setting restart_in_rows + * (in which case the correct restart_interval will be figured + * for each scan). + */ + unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ + int restart_in_rows; /* if > 0, MCU rows per restart interval */ + + /* Parameters controlling emission of special markers. */ + + boolean write_JFIF_header; /* should a JFIF marker be written? */ + UINT8 JFIF_major_version; /* What to write for the JFIF version number */ + UINT8 JFIF_minor_version; + /* These three values are not used by the JPEG code, merely copied */ + /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ + /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ + /* ratio is defined by X_density/Y_density even when density_unit=0. */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean write_Adobe_marker; /* should an Adobe marker be written? */ + + /* State variable: index of next scanline to be written to + * jpeg_write_scanlines(). Application may use this to control its + * processing loop, e.g., "while (next_scanline < image_height)". + */ + + JDIMENSION next_scanline; /* 0 .. image_height-1 */ + + /* Remaining fields are known throughout compressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during compression startup + */ + boolean progressive_mode; /* TRUE if scan script uses progressive mode */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + + JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ + /* The coefficient controller receives data in units of MCU rows as defined + * for fully interleaved scans (whether the JPEG file is interleaved or not). + * There are v_samp_factor * DCTSIZE sample rows of each component in an + * "iMCU" (interleaved MCU) row. + */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[C_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + + /* + * Links to compression subobjects (methods and private variables of modules) + */ + struct jpeg_comp_master * master; + struct jpeg_c_main_controller * main; + struct jpeg_c_prep_controller * prep; + struct jpeg_c_coef_controller * coef; + struct jpeg_marker_writer * marker; + struct jpeg_color_converter * cconvert; + struct jpeg_downsampler * downsample; + struct jpeg_forward_dct * fdct; + struct jpeg_entropy_encoder * entropy; + jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ + int script_space_size; +}; + + +/* Master record for a decompression instance */ + +struct jpeg_decompress_struct { + jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ + + /* Source of compressed data */ + struct jpeg_source_mgr * src; + + /* Basic description of image --- filled in by jpeg_read_header(). */ + /* Application may inspect these values to decide how to process image. */ + + JDIMENSION image_width; /* nominal image width (from SOF marker) */ + JDIMENSION image_height; /* nominal image height */ + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + /* Decompression processing parameters --- these fields must be set before + * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes + * them to default values. + */ + + J_COLOR_SPACE out_color_space; /* colorspace for output */ + + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + double output_gamma; /* image gamma wanted in output */ + + boolean buffered_image; /* TRUE=multiple output passes */ + boolean raw_data_out; /* TRUE=downsampled data wanted */ + + J_DCT_METHOD dct_method; /* IDCT algorithm selector */ + boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ + boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ + + boolean quantize_colors; /* TRUE=colormapped output wanted */ + /* the following are ignored if not quantize_colors: */ + J_DITHER_MODE dither_mode; /* type of color dithering to use */ + boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ + int desired_number_of_colors; /* max # colors to use in created colormap */ + /* these are significant only in buffered-image mode: */ + boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ + boolean enable_external_quant;/* enable future use of external colormap */ + boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ + + /* Description of actual output image that will be returned to application. + * These fields are computed by jpeg_start_decompress(). + * You can also use jpeg_calc_output_dimensions() to determine these values + * in advance of calling jpeg_start_decompress(). + */ + + JDIMENSION output_width; /* scaled image width */ + JDIMENSION output_height; /* scaled image height */ + int out_color_components; /* # of color components in out_color_space */ + int output_components; /* # of color components returned */ + /* output_components is 1 (a colormap index) when quantizing colors; + * otherwise it equals out_color_components. + */ + int rec_outbuf_height; /* min recommended height of scanline buffer */ + /* If the buffer passed to jpeg_read_scanlines() is less than this many rows + * high, space and time will be wasted due to unnecessary data copying. + * Usually rec_outbuf_height will be 1 or 2, at most 4. + */ + + /* When quantizing colors, the output colormap is described by these fields. + * The application can supply a colormap by setting colormap non-NULL before + * calling jpeg_start_decompress; otherwise a colormap is created during + * jpeg_start_decompress or jpeg_start_output. + * The map has out_color_components rows and actual_number_of_colors columns. + */ + int actual_number_of_colors; /* number of entries in use */ + JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ + + /* State variables: these variables indicate the progress of decompression. + * The application may examine these but must not modify them. + */ + + /* Row index of next scanline to be read from jpeg_read_scanlines(). + * Application may use this to control its processing loop, e.g., + * "while (output_scanline < output_height)". + */ + JDIMENSION output_scanline; /* 0 .. output_height-1 */ + + /* Current input scan number and number of iMCU rows completed in scan. + * These indicate the progress of the decompressor input side. + */ + int input_scan_number; /* Number of SOS markers seen so far */ + JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ + + /* The "output scan number" is the notional scan being displayed by the + * output side. The decompressor will not allow output scan/row number + * to get ahead of input scan/row, but it can fall arbitrarily far behind. + */ + int output_scan_number; /* Nominal scan number being displayed */ + JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ + + /* Current progression status. coef_bits[c][i] indicates the precision + * with which component c's DCT coefficient i (in zigzag order) is known. + * It is -1 when no data has yet been received, otherwise it is the point + * transform (shift) value for the most recent scan of the coefficient + * (thus, 0 at completion of the progression). + * This pointer is NULL when reading a non-progressive file. + */ + int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ + + /* Internal JPEG parameters --- the application usually need not look at + * these fields. Note that the decompressor output side may not use + * any parameters that can change between scans. + */ + + /* Quantization and Huffman tables are carried forward across input + * datastreams when processing abbreviated JPEG datastreams. + */ + + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + /* These parameters are never carried across datastreams, since they + * are given in SOF/SOS markers or defined to be reset by SOI. + */ + + int data_precision; /* bits of precision in image data */ + + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ + + /* These fields record data obtained from optional markers recognized by + * the JPEG library. + */ + boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ + /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ + UINT8 JFIF_major_version; /* JFIF version number */ + UINT8 JFIF_minor_version; + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ + UINT8 Adobe_transform; /* Color transform code from Adobe marker */ + + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + /* Aside from the specific data retained from APPn markers known to the + * library, the uninterpreted contents of any or all APPn and COM markers + * can be saved in a list for examination by the application. + */ + jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ + + /* Remaining fields are known throughout decompressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during decompression startup + */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + + int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ + + JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ + /* The coefficient controller's input and output progress is measured in + * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows + * in fully interleaved JPEG scans, but are used whether the scan is + * interleaved or not. We define an iMCU row as v_samp_factor DCT block + * rows of each component. Therefore, the IDCT output contains + * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row. + */ + + JSAMPLE * sample_range_limit; /* table for fast range-limiting */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + * Note that the decompressor output side must not use these fields. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[D_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + + /* This field is shared between entropy decoder and marker parser. + * It is either zero or the code of a JPEG marker that has been + * read from the data source, but has not yet been processed. + */ + int unread_marker; + + /* + * Links to decompression subobjects (methods, private variables of modules) + */ + struct jpeg_decomp_master * master; + struct jpeg_d_main_controller * main; + struct jpeg_d_coef_controller * coef; + struct jpeg_d_post_controller * post; + struct jpeg_input_controller * inputctl; + struct jpeg_marker_reader * marker; + struct jpeg_entropy_decoder * entropy; + struct jpeg_inverse_dct * idct; + struct jpeg_upsampler * upsample; + struct jpeg_color_deconverter * cconvert; + struct jpeg_color_quantizer * cquantize; +}; + + +/* "Object" declarations for JPEG modules that may be supplied or called + * directly by the surrounding application. + * As with all objects in the JPEG library, these structs only define the + * publicly visible methods and state variables of a module. Additional + * private fields may exist after the public ones. + */ + + +/* Error handler object */ + +struct jpeg_error_mgr { + /* Error exit handler: does not return to caller */ + JMETHOD(void, error_exit, (j_common_ptr cinfo)); + /* Conditionally emit a trace or warning message */ + JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); + /* Routine that actually outputs a trace or error message */ + JMETHOD(void, output_message, (j_common_ptr cinfo)); + /* Format a message string for the most recent JPEG error or message */ + JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); +#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ + /* Reset error state variables at start of a new image */ + JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); + + /* The message ID code and any parameters are saved here. + * A message can have one string parameter or up to 8 int parameters. + */ + int msg_code; +#define JMSG_STR_PARM_MAX 80 + union { + int i[8]; + char s[JMSG_STR_PARM_MAX]; + } msg_parm; + + /* Standard state variables for error facility */ + + int trace_level; /* max msg_level that will be displayed */ + + /* For recoverable corrupt-data errors, we emit a warning message, + * but keep going unless emit_message chooses to abort. emit_message + * should count warnings in num_warnings. The surrounding application + * can check for bad data by seeing if num_warnings is nonzero at the + * end of processing. + */ + long num_warnings; /* number of corrupt-data warnings */ + + /* These fields point to the table(s) of error message strings. + * An application can change the table pointer to switch to a different + * message list (typically, to change the language in which errors are + * reported). Some applications may wish to add additional error codes + * that will be handled by the JPEG library error mechanism; the second + * table pointer is used for this purpose. + * + * First table includes all errors generated by JPEG library itself. + * Error code 0 is reserved for a "no such error string" message. + */ + const char * const * jpeg_message_table; /* Library errors */ + int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ + /* Second table can be added by application (see cjpeg/djpeg for example). + * It contains strings numbered first_addon_message..last_addon_message. + */ + const char * const * addon_message_table; /* Non-library errors */ + int first_addon_message; /* code for first string in addon table */ + int last_addon_message; /* code for last string in addon table */ +}; + + +/* Progress monitor object */ + +struct jpeg_progress_mgr { + JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); + + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ +}; + + +/* Data destination object for compression */ + +struct jpeg_destination_mgr { + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + + JMETHOD(void, init_destination, (j_compress_ptr cinfo)); + JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); + JMETHOD(void, term_destination, (j_compress_ptr cinfo)); +}; + + +/* Data source object for decompression */ + +struct jpeg_source_mgr { + const JOCTET * next_input_byte; /* => next byte to read from buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + + JMETHOD(void, init_source, (j_decompress_ptr cinfo)); + JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); + JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); + JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); + JMETHOD(void, term_source, (j_decompress_ptr cinfo)); +}; + + +/* Memory manager object. + * Allocates "small" objects (a few K total), "large" objects (tens of K), + * and "really big" objects (virtual arrays with backing store if needed). + * The memory manager does not allow individual objects to be freed; rather, + * each created object is assigned to a pool, and whole pools can be freed + * at once. This is faster and more convenient than remembering exactly what + * to free, especially where malloc()/free() are not too speedy. + * NB: alloc routines never return NULL. They exit to error_exit if not + * successful. + */ + +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 + +typedef struct jvirt_sarray_control * jvirt_sarray_ptr; +typedef struct jvirt_barray_control * jvirt_barray_ptr; + + +struct jpeg_memory_mgr { + /* Method pointers */ + JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, + size_t sizeofobject)); + JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, + size_t sizeofobject)); + JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, + JDIMENSION numrows)); + JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, + JDIMENSION numrows)); + JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, + int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); + JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, + int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); + JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); + JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, + jvirt_sarray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); + JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, + jvirt_barray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); + JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); + JMETHOD(void, self_destruct, (j_common_ptr cinfo)); + + /* Limit on memory allocation for this JPEG object. (Note that this is + * merely advisory, not a guaranteed maximum; it only affects the space + * used for virtual-array buffers.) May be changed by outer application + * after creating the JPEG object. + */ + long max_memory_to_use; + + /* Maximum allocation request accepted by alloc_large. */ + long max_alloc_chunk; +}; + + +/* Routine signature for application-supplied marker processing methods. + * Need not pass marker code since it is stored in cinfo->unread_marker. + */ +typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); + + +/* Declarations for routines called by application. + * The JPP macro hides prototype parameters from compilers that can't cope. + * Note JPP requires double parentheses. + */ + +#ifdef HAVE_PROTOTYPES +#define JPP(arglist) arglist +#else +#define JPP(arglist) () +#endif + + +/* Short forms of external names for systems with brain-damaged linkers. + * We shorten external names to be unique in the first six letters, which + * is good enough for all known systems. + * (If your compiler itself needs names to be unique in less than 15 + * characters, you are out of luck. Get a better compiler.) + */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_std_error jStdError +#define jpeg_CreateCompress jCreaCompress +#define jpeg_CreateDecompress jCreaDecompress +#define jpeg_destroy_compress jDestCompress +#define jpeg_destroy_decompress jDestDecompress +#define jpeg_stdio_dest jStdDest +#define jpeg_stdio_src jStdSrc +#define jpeg_set_defaults jSetDefaults +#define jpeg_set_colorspace jSetColorspace +#define jpeg_default_colorspace jDefColorspace +#define jpeg_set_quality jSetQuality +#define jpeg_set_linear_quality jSetLQuality +#define jpeg_add_quant_table jAddQuantTable +#define jpeg_quality_scaling jQualityScaling +#define jpeg_simple_progression jSimProgress +#define jpeg_suppress_tables jSuppressTables +#define jpeg_alloc_quant_table jAlcQTable +#define jpeg_alloc_huff_table jAlcHTable +#define jpeg_start_compress jStrtCompress +#define jpeg_write_scanlines jWrtScanlines +#define jpeg_finish_compress jFinCompress +#define jpeg_write_raw_data jWrtRawData +#define jpeg_write_marker jWrtMarker +#define jpeg_write_m_header jWrtMHeader +#define jpeg_write_m_byte jWrtMByte +#define jpeg_write_tables jWrtTables +#define jpeg_read_header jReadHeader +#define jpeg_start_decompress jStrtDecompress +#define jpeg_read_scanlines jReadScanlines +#define jpeg_finish_decompress jFinDecompress +#define jpeg_read_raw_data jReadRawData +#define jpeg_has_multiple_scans jHasMultScn +#define jpeg_start_output jStrtOutput +#define jpeg_finish_output jFinOutput +#define jpeg_input_complete jInComplete +#define jpeg_new_colormap jNewCMap +#define jpeg_consume_input jConsumeInput +#define jpeg_calc_output_dimensions jCalcDimensions +#define jpeg_save_markers jSaveMarkers +#define jpeg_set_marker_processor jSetMarker +#define jpeg_read_coefficients jReadCoefs +#define jpeg_write_coefficients jWrtCoefs +#define jpeg_copy_critical_parameters jCopyCrit +#define jpeg_abort_compress jAbrtCompress +#define jpeg_abort_decompress jAbrtDecompress +#define jpeg_abort jAbort +#define jpeg_destroy jDestroy +#define jpeg_resync_to_restart jResyncRestart +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* Default error-management setup */ +EXTERN(struct jpeg_error_mgr *) jpeg_std_error + JPP((struct jpeg_error_mgr * err)); + +/* Initialization of JPEG compression objects. + * jpeg_create_compress() and jpeg_create_decompress() are the exported + * names that applications should call. These expand to calls on + * jpeg_CreateCompress and jpeg_CreateDecompress with additional information + * passed for version mismatch checking. + * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. + */ +#define jpeg_create_compress(cinfo) \ + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_compress_struct)) +#define jpeg_create_decompress(cinfo) \ + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, + int version, size_t structsize)); +EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, + int version, size_t structsize)); +/* Destruction of JPEG compression objects */ +EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); + +/* Standard data source and destination managers: stdio streams. */ +/* Caller is responsible for opening the file before and closing after. */ +EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); +EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); + +/* Default parameter setup for compression */ +EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); +/* Compression parameter setup aids */ +EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, + J_COLOR_SPACE colorspace)); +EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, + boolean force_baseline)); +EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, + int scale_factor, + boolean force_baseline)); +EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, + boolean force_baseline)); +EXTERN(int) jpeg_quality_scaling JPP((int quality)); +EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, + boolean suppress)); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); + +/* Main entry points for compression */ +EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, + boolean write_all_tables)); +EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines)); +EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); + +/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION num_lines)); + +/* Write a special marker. See libjpeg.doc concerning safe usage. */ +EXTERN(void) jpeg_write_marker + JPP((j_compress_ptr cinfo, int marker, + const JOCTET * dataptr, unsigned int datalen)); +/* Same, but piecemeal. */ +EXTERN(void) jpeg_write_m_header + JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); +EXTERN(void) jpeg_write_m_byte + JPP((j_compress_ptr cinfo, int val)); + +/* Alternate compression function: just write an abbreviated table file */ +EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); + +/* Decompression startup: read start of JPEG datastream to see what's there */ +EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, + boolean require_image)); +/* Return value is one of: */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +/* If you pass require_image = TRUE (normal case), you need not check for + * a TABLES_ONLY return code; an abbreviated file will cause an error exit. + * JPEG_SUSPENDED is only possible if you use a data source module that can + * give a suspension return (the stdio source module doesn't). + */ + +/* Main entry points for decompression */ +EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines)); +EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); + +/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION max_lines)); + +/* Additional entry points for buffered-image mode. */ +EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, + int scan_number)); +EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); +EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); +/* Return value is one of: */ +/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ +#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ +#define JPEG_REACHED_EOI 2 /* Reached end of image */ +#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ +#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ + +/* Precalculate output dimensions for current decompression parameters. */ +EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); + +/* Control saving of COM and APPn markers into marker_list. */ +EXTERN(void) jpeg_save_markers + JPP((j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit)); + +/* Install a special processing method for COM or APPn markers. */ +EXTERN(void) jpeg_set_marker_processor + JPP((j_decompress_ptr cinfo, int marker_code, + jpeg_marker_parser_method routine)); + +/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays)); +EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, + j_compress_ptr dstinfo)); + +/* If you choose to abort compression or decompression before completing + * jpeg_finish_(de)compress, then you need to clean up to release memory, + * temporary files, etc. You can just call jpeg_destroy_(de)compress + * if you're done with the JPEG object, but if you want to clean it up and + * reuse it, call this: + */ +EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); + +/* Generic versions of jpeg_abort and jpeg_destroy that work on either + * flavor of JPEG object. These may be more convenient in some places. + */ +EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); + +/* Default restart-marker-resync procedure for use by data source modules */ +EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, + int desired)); + + +/* These marker codes are exported since applications and data source modules + * are likely to want to use them. + */ + +#define JPEG_RST0 0xD0 /* RST0 marker code */ +#define JPEG_EOI 0xD9 /* EOI marker code */ +#define JPEG_APP0 0xE0 /* APP0 marker code */ +#define JPEG_COM 0xFE /* COM marker code */ + + +/* If we have a brain-damaged compiler that emits warnings (or worse, errors) + * for structure definitions that are never filled in, keep it quiet by + * supplying dummy definitions for the various substructures. + */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ +struct jvirt_sarray_control { long dummy; }; +struct jvirt_barray_control { long dummy; }; +struct jpeg_comp_master { long dummy; }; +struct jpeg_c_main_controller { long dummy; }; +struct jpeg_c_prep_controller { long dummy; }; +struct jpeg_c_coef_controller { long dummy; }; +struct jpeg_marker_writer { long dummy; }; +struct jpeg_color_converter { long dummy; }; +struct jpeg_downsampler { long dummy; }; +struct jpeg_forward_dct { long dummy; }; +struct jpeg_entropy_encoder { long dummy; }; +struct jpeg_decomp_master { long dummy; }; +struct jpeg_d_main_controller { long dummy; }; +struct jpeg_d_coef_controller { long dummy; }; +struct jpeg_d_post_controller { long dummy; }; +struct jpeg_input_controller { long dummy; }; +struct jpeg_marker_reader { long dummy; }; +struct jpeg_entropy_decoder { long dummy; }; +struct jpeg_inverse_dct { long dummy; }; +struct jpeg_upsampler { long dummy; }; +struct jpeg_color_deconverter { long dummy; }; +struct jpeg_color_quantizer { long dummy; }; +#endif /* JPEG_INTERNALS */ +#endif /* INCOMPLETE_TYPES_BROKEN */ + + +/* + * The JPEG library modules define JPEG_INTERNALS before including this file. + * The internal structure declarations are read only when that is true. + * Applications using the library should not include jpegint.h, but may wish + * to include jerror.h. + */ + +#ifdef JPEG_INTERNALS +#include "jpegint.h" /* fetch private declarations */ +#include "jerror.h" /* fetch error codes too */ +#endif + +#endif /* JPEGLIB_H */ diff --git a/Externals/wxWidgets/include/msvc/wx/setup.h b/Externals/wxWidgets/include/msvc/wx/setup.h index 7cc58760bb..3f0e0cd5e4 100644 --- a/Externals/wxWidgets/include/msvc/wx/setup.h +++ b/Externals/wxWidgets/include/msvc/wx/setup.h @@ -1,249 +1,249 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msvc/wx/msw/setup.h -// Purpose: wrapper around the real wx/setup.h for Visual C++ -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-12-12 -// RCS-ID: $Id: setup.h 43687 2006-11-27 15:03:59Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but -// the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined -// explicitly! - -#ifdef _MSC_VER - #ifdef _UNICODE - #ifdef WXUSINGDLL - #ifdef _DEBUG - #include "../../../lib/vc_dll/mswud/wx/setup.h" - #else - #include "../../../lib/vc_dll/mswu/wx/setup.h" - #endif - #else - #ifdef _DEBUG - #include "../../../lib/vc_lib/mswud/wx/setup.h" - #else - #include "../../../lib/vc_lib/mswu/wx/setup.h" - #endif - #endif - - #ifdef _DEBUG - #pragma comment(lib,"wxbase28ud") - #pragma comment(lib,"wxbase28ud_net") - #pragma comment(lib,"wxbase28ud_xml") - #if wxUSE_REGEX - #pragma comment(lib,"wxregexud") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpatd") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpegd") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpngd") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiffd") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlibd") - #endif - #pragma comment(lib,"wxmsw28ud_adv") - #pragma comment(lib,"wxmsw28ud_core") - #pragma comment(lib,"wxmsw28ud_html") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28ud_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28ud_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28ud_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28ud_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28ud_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28ud_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28ud_odbc") - #endif - #endif // wxUSE_GUI - #else // release - #pragma comment(lib,"wxbase28u") - #pragma comment(lib,"wxbase28u_net") - #pragma comment(lib,"wxbase28u_xml") - #if wxUSE_REGEX - #pragma comment(lib,"wxregexu") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpat") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpeg") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpng") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiff") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlib") - #endif - #pragma comment(lib,"wxmsw28u_adv") - #pragma comment(lib,"wxmsw28u_core") - #pragma comment(lib,"wxmsw28u_html") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28u_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28u_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28u_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28u_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28u_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28u_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28u_odbc") - #endif - #endif // wxUSE_GUI - #endif // debug/release - #else // !_UNICODE - #ifdef WXUSINGDLL - #ifdef _DEBUG - #include "../../../lib/vc_dll/mswd/wx/setup.h" - #else - #include "../../../lib/vc_dll/msw/wx/setup.h" - #endif - #else // static lib - #ifdef _DEBUG - #include "../../../lib/vc_lib/mswd/wx/setup.h" - #else - #include "../../../lib/vc_lib/msw/wx/setup.h" - #endif - #endif // shared/static - - #ifdef _DEBUG - #pragma comment(lib,"wxbase28d") - #pragma comment(lib,"wxbase28d_net") - #pragma comment(lib,"wxbase28d_xml") - #if wxUSE_REGEX - #pragma comment(lib,"wxregexd") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpatd") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpegd") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpngd") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiffd") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlibd") - #endif - #pragma comment(lib,"wxmsw28d_adv") - #pragma comment(lib,"wxmsw28d_core") - #pragma comment(lib,"wxmsw28d_html") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28d_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28d_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28d_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28d_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28d_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28d_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28d_odbc") - #endif - #endif // wxUSE_GUI - #else // release - #pragma comment(lib,"wxbase28") - #pragma comment(lib,"wxbase28_net") - #pragma comment(lib,"wxbase28_xml") - #if wxUSE_REGEX - #pragma comment(lib,"wxregex") - #endif - - #if wxUSE_GUI - #if wxUSE_XML - #pragma comment(lib,"wxexpat") - #endif - #if wxUSE_LIBJPEG - #pragma comment(lib,"wxjpeg") - #endif - #if wxUSE_LIBPNG - #pragma comment(lib,"wxpng") - #endif - #if wxUSE_LIBTIFF - #pragma comment(lib,"wxtiff") - #endif - #if wxUSE_ZLIB - #pragma comment(lib,"wxzlib") - #endif - #pragma comment(lib,"wxmsw28_adv") - #pragma comment(lib,"wxmsw28_core") - #pragma comment(lib,"wxmsw28_html") - #if wxUSE_GLCANVAS - #pragma comment(lib,"wxmsw28_gl") - #endif - #if wxUSE_DEBUGREPORT - #pragma comment(lib,"wxmsw28_qa") - #endif - #if wxUSE_XRC - #pragma comment(lib,"wxmsw28_xrc") - #endif - #if wxUSE_AUI - #pragma comment(lib,"wxmsw28_aui") - #endif - #if wxUSE_RICHTEXT - #pragma comment(lib,"wxmsw28_richtext") - #endif - #if wxUSE_MEDIACTRL - #pragma comment(lib,"wxmsw28_media") - #endif - #if wxUSE_ODBC - #pragma comment(lib,"wxbase28_odbc") - #endif - #endif // wxUSE_GUI - #endif // debug/release - #endif // _UNICODE/!_UNICODE -#else - #error "This file should only be included when using Microsoft Visual C++" -#endif - +///////////////////////////////////////////////////////////////////////////// +// Name: msvc/wx/msw/setup.h +// Purpose: wrapper around the real wx/setup.h for Visual C++ +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-12-12 +// RCS-ID: $Id: setup.h 43687 2006-11-27 15:03:59Z VZ $ +// Copyright: (c) 2004 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but +// the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined +// explicitly! + +#ifdef _MSC_VER + #ifdef _UNICODE + #ifdef WXUSINGDLL + #ifdef _DEBUG + #include "../../../lib/vc_dll/mswud/wx/setup.h" + #else + #include "../../../lib/vc_dll/mswu/wx/setup.h" + #endif + #else + #ifdef _DEBUG + #include "../../../lib/vc_lib/mswud/wx/setup.h" + #else + #include "../../../lib/vc_lib/mswu/wx/setup.h" + #endif + #endif + + #ifdef _DEBUG + #pragma comment(lib,"wxbase28ud") + #pragma comment(lib,"wxbase28ud_net") + #pragma comment(lib,"wxbase28ud_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregexud") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpatd") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpegd") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpngd") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiffd") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlibd") + #endif + #pragma comment(lib,"wxmsw28ud_adv") + #pragma comment(lib,"wxmsw28ud_core") + #pragma comment(lib,"wxmsw28ud_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28ud_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28ud_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28ud_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28ud_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28ud_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28ud_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28ud_odbc") + #endif + #endif // wxUSE_GUI + #else // release + #pragma comment(lib,"wxbase28u") + #pragma comment(lib,"wxbase28u_net") + #pragma comment(lib,"wxbase28u_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregexu") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpat") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpeg") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpng") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiff") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlib") + #endif + #pragma comment(lib,"wxmsw28u_adv") + #pragma comment(lib,"wxmsw28u_core") + #pragma comment(lib,"wxmsw28u_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28u_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28u_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28u_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28u_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28u_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28u_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28u_odbc") + #endif + #endif // wxUSE_GUI + #endif // debug/release + #else // !_UNICODE + #ifdef WXUSINGDLL + #ifdef _DEBUG + #include "../../../lib/vc_dll/mswd/wx/setup.h" + #else + #include "../../../lib/vc_dll/msw/wx/setup.h" + #endif + #else // static lib + #ifdef _DEBUG + #include "../../../lib/vc_lib/mswd/wx/setup.h" + #else + #include "../../../lib/vc_lib/msw/wx/setup.h" + #endif + #endif // shared/static + + #ifdef _DEBUG + #pragma comment(lib,"wxbase28d") + #pragma comment(lib,"wxbase28d_net") + #pragma comment(lib,"wxbase28d_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregexd") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpatd") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpegd") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpngd") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiffd") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlibd") + #endif + #pragma comment(lib,"wxmsw28d_adv") + #pragma comment(lib,"wxmsw28d_core") + #pragma comment(lib,"wxmsw28d_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28d_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28d_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28d_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28d_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28d_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28d_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28d_odbc") + #endif + #endif // wxUSE_GUI + #else // release + #pragma comment(lib,"wxbase28") + #pragma comment(lib,"wxbase28_net") + #pragma comment(lib,"wxbase28_xml") + #if wxUSE_REGEX + #pragma comment(lib,"wxregex") + #endif + + #if wxUSE_GUI + #if wxUSE_XML + #pragma comment(lib,"wxexpat") + #endif + #if wxUSE_LIBJPEG + #pragma comment(lib,"wxjpeg") + #endif + #if wxUSE_LIBPNG + #pragma comment(lib,"wxpng") + #endif + #if wxUSE_LIBTIFF + #pragma comment(lib,"wxtiff") + #endif + #if wxUSE_ZLIB + #pragma comment(lib,"wxzlib") + #endif + #pragma comment(lib,"wxmsw28_adv") + #pragma comment(lib,"wxmsw28_core") + #pragma comment(lib,"wxmsw28_html") + #if wxUSE_GLCANVAS + #pragma comment(lib,"wxmsw28_gl") + #endif + #if wxUSE_DEBUGREPORT + #pragma comment(lib,"wxmsw28_qa") + #endif + #if wxUSE_XRC + #pragma comment(lib,"wxmsw28_xrc") + #endif + #if wxUSE_AUI + #pragma comment(lib,"wxmsw28_aui") + #endif + #if wxUSE_RICHTEXT + #pragma comment(lib,"wxmsw28_richtext") + #endif + #if wxUSE_MEDIACTRL + #pragma comment(lib,"wxmsw28_media") + #endif + #if wxUSE_ODBC + #pragma comment(lib,"wxbase28_odbc") + #endif + #endif // wxUSE_GUI + #endif // debug/release + #endif // _UNICODE/!_UNICODE +#else + #error "This file should only be included when using Microsoft Visual C++" +#endif + diff --git a/Externals/wxWidgets/include/wx/aboutdlg.h b/Externals/wxWidgets/include/wx/aboutdlg.h index 15b80f9916..99f452123e 100644 --- a/Externals/wxWidgets/include/wx/aboutdlg.h +++ b/Externals/wxWidgets/include/wx/aboutdlg.h @@ -1,155 +1,155 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/aboutdlg.h -// Purpose: declaration of wxAboutDialog class -// Author: Vadim Zeitlin -// Created: 2006-10-07 -// RCS-ID: $Id: aboutdlg.h 41813 2006-10-09 16:56:18Z RD $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ABOUTDLG_H_ -#define _WX_ABOUTDLG_H_ - -#include "wx/defs.h" - -#if wxUSE_ABOUTDLG - -#include "wx/app.h" -#include "wx/icon.h" - -// ---------------------------------------------------------------------------- -// wxAboutDialogInfo: information shown by the standard "About" dialog -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxAboutDialogInfo -{ -public: - // all fields are initially uninitialized - wxAboutDialogInfo() { } - - // accessors for various simply fields - // ----------------------------------- - - // name of the program, if not used defaults wxApp::GetAppName() - void SetName(const wxString& name) { m_name = name; } - wxString GetName() const - { return m_name.empty() ? wxTheApp->GetAppName() : m_name; } - - // version of the program, in free format (but without "version" word) - void SetVersion(const wxString& version) { m_version = version; } - bool HasVersion() const { return !m_version.empty(); } - wxString GetVersion() const { return m_version; } - - // brief, but possibly multiline, description of the program - void SetDescription(const wxString& desc) { m_description = desc; } - bool HasDescription() const { return !m_description.empty(); } - wxString GetDescription() const { return m_description; } - - // short string containing the program copyright information - void SetCopyright(const wxString& copyright) { m_copyright = copyright; } - bool HasCopyright() const { return !m_copyright.empty(); } - wxString GetCopyright() const { return m_copyright; } - - // long, multiline string containing the text of the program licence - void SetLicence(const wxString& licence) { m_licence = licence; } - void SetLicense(const wxString& licence) { m_licence = licence; } - bool HasLicence() const { return !m_licence.empty(); } - wxString GetLicence() const { return m_licence; } - - // icon to be shown in the dialog, defaults to the main frame icon - void SetIcon(const wxIcon& icon) { m_icon = icon; } - bool HasIcon() const { return m_icon.Ok(); } - wxIcon GetIcon() const; - - // web site for the program and its description (defaults to URL itself if - // empty) - void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString) - { - m_url = url; - m_urlDesc = desc.empty() ? url : desc; - } - - bool HasWebSite() const { return !m_url.empty(); } - - wxString GetWebSiteURL() const { return m_url; } - wxString GetWebSiteDescription() const { return m_urlDesc; } - - // accessors for the arrays - // ------------------------ - - // the list of developers of the program - void SetDevelopers(const wxArrayString& developers) - { m_developers = developers; } - void AddDeveloper(const wxString& developer) - { m_developers.push_back(developer); } - - bool HasDevelopers() const { return !m_developers.empty(); } - const wxArrayString& GetDevelopers() const { return m_developers; } - - // the list of documentation writers - void SetDocWriters(const wxArrayString& docwriters) - { m_docwriters = docwriters; } - void AddDocWriter(const wxString& docwriter) - { m_docwriters.push_back(docwriter); } - - bool HasDocWriters() const { return !m_docwriters.empty(); } - const wxArrayString& GetDocWriters() const { return m_docwriters; } - - // the list of artists for the program art - void SetArtists(const wxArrayString& artists) - { m_artists = artists; } - void AddArtist(const wxString& artist) - { m_artists.push_back(artist); } - - bool HasArtists() const { return !m_artists.empty(); } - const wxArrayString& GetArtists() const { return m_artists; } - - // the list of translators - void SetTranslators(const wxArrayString& translators) - { m_translators = translators; } - void AddTranslator(const wxString& translator) - { m_translators.push_back(translator); } - - bool HasTranslators() const { return !m_translators.empty(); } - const wxArrayString& GetTranslators() const { return m_translators; } - - - // implementation only - // ------------------- - - // "simple" about dialog shows only textual information (with possibly - // default icon but without hyperlink nor any long texts such as the - // licence text) - bool IsSimple() const - { return !HasWebSite() && !HasIcon() && !HasLicence(); } - - // get the description and credits (i.e. all of developers, doc writers, - // artists and translators) as a one long multiline string - wxString GetDescriptionAndCredits() const; - -private: - wxString m_name, - m_version, - m_description, - m_copyright, - m_licence; - - wxIcon m_icon; - - wxString m_url, - m_urlDesc; - - wxArrayString m_developers, - m_docwriters, - m_artists, - m_translators; -}; - -// functions to show the about dialog box -WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info); - -#endif // wxUSE_ABOUTDLG - -#endif // _WX_ABOUTDLG_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aboutdlg.h +// Purpose: declaration of wxAboutDialog class +// Author: Vadim Zeitlin +// Created: 2006-10-07 +// RCS-ID: $Id: aboutdlg.h 41813 2006-10-09 16:56:18Z RD $ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ABOUTDLG_H_ +#define _WX_ABOUTDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_ABOUTDLG + +#include "wx/app.h" +#include "wx/icon.h" + +// ---------------------------------------------------------------------------- +// wxAboutDialogInfo: information shown by the standard "About" dialog +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAboutDialogInfo +{ +public: + // all fields are initially uninitialized + wxAboutDialogInfo() { } + + // accessors for various simply fields + // ----------------------------------- + + // name of the program, if not used defaults wxApp::GetAppName() + void SetName(const wxString& name) { m_name = name; } + wxString GetName() const + { return m_name.empty() ? wxTheApp->GetAppName() : m_name; } + + // version of the program, in free format (but without "version" word) + void SetVersion(const wxString& version) { m_version = version; } + bool HasVersion() const { return !m_version.empty(); } + wxString GetVersion() const { return m_version; } + + // brief, but possibly multiline, description of the program + void SetDescription(const wxString& desc) { m_description = desc; } + bool HasDescription() const { return !m_description.empty(); } + wxString GetDescription() const { return m_description; } + + // short string containing the program copyright information + void SetCopyright(const wxString& copyright) { m_copyright = copyright; } + bool HasCopyright() const { return !m_copyright.empty(); } + wxString GetCopyright() const { return m_copyright; } + + // long, multiline string containing the text of the program licence + void SetLicence(const wxString& licence) { m_licence = licence; } + void SetLicense(const wxString& licence) { m_licence = licence; } + bool HasLicence() const { return !m_licence.empty(); } + wxString GetLicence() const { return m_licence; } + + // icon to be shown in the dialog, defaults to the main frame icon + void SetIcon(const wxIcon& icon) { m_icon = icon; } + bool HasIcon() const { return m_icon.Ok(); } + wxIcon GetIcon() const; + + // web site for the program and its description (defaults to URL itself if + // empty) + void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString) + { + m_url = url; + m_urlDesc = desc.empty() ? url : desc; + } + + bool HasWebSite() const { return !m_url.empty(); } + + wxString GetWebSiteURL() const { return m_url; } + wxString GetWebSiteDescription() const { return m_urlDesc; } + + // accessors for the arrays + // ------------------------ + + // the list of developers of the program + void SetDevelopers(const wxArrayString& developers) + { m_developers = developers; } + void AddDeveloper(const wxString& developer) + { m_developers.push_back(developer); } + + bool HasDevelopers() const { return !m_developers.empty(); } + const wxArrayString& GetDevelopers() const { return m_developers; } + + // the list of documentation writers + void SetDocWriters(const wxArrayString& docwriters) + { m_docwriters = docwriters; } + void AddDocWriter(const wxString& docwriter) + { m_docwriters.push_back(docwriter); } + + bool HasDocWriters() const { return !m_docwriters.empty(); } + const wxArrayString& GetDocWriters() const { return m_docwriters; } + + // the list of artists for the program art + void SetArtists(const wxArrayString& artists) + { m_artists = artists; } + void AddArtist(const wxString& artist) + { m_artists.push_back(artist); } + + bool HasArtists() const { return !m_artists.empty(); } + const wxArrayString& GetArtists() const { return m_artists; } + + // the list of translators + void SetTranslators(const wxArrayString& translators) + { m_translators = translators; } + void AddTranslator(const wxString& translator) + { m_translators.push_back(translator); } + + bool HasTranslators() const { return !m_translators.empty(); } + const wxArrayString& GetTranslators() const { return m_translators; } + + + // implementation only + // ------------------- + + // "simple" about dialog shows only textual information (with possibly + // default icon but without hyperlink nor any long texts such as the + // licence text) + bool IsSimple() const + { return !HasWebSite() && !HasIcon() && !HasLicence(); } + + // get the description and credits (i.e. all of developers, doc writers, + // artists and translators) as a one long multiline string + wxString GetDescriptionAndCredits() const; + +private: + wxString m_name, + m_version, + m_description, + m_copyright, + m_licence; + + wxIcon m_icon; + + wxString m_url, + m_urlDesc; + + wxArrayString m_developers, + m_docwriters, + m_artists, + m_translators; +}; + +// functions to show the about dialog box +WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info); + +#endif // wxUSE_ABOUTDLG + +#endif // _WX_ABOUTDLG_H_ + diff --git a/Externals/wxWidgets/include/wx/accel.h b/Externals/wxWidgets/include/wx/accel.h index a5bcd506a2..78c038f34a 100644 --- a/Externals/wxWidgets/include/wx/accel.h +++ b/Externals/wxWidgets/include/wx/accel.h @@ -1,171 +1,171 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/accel.h -// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes -// Author: Julian Smart, Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 31.05.01 (extracted from other files) -// RCS-ID: $Id: accel.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCEL_H_BASE_ -#define _WX_ACCEL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_ACCEL - -#include "wx/object.h" - -class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; -class WXDLLIMPEXP_FWD_CORE wxKeyEvent; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxAcceleratorEntry flags -enum -{ - wxACCEL_NORMAL = 0x0000, // no modifiers - wxACCEL_ALT = 0x0001, // hold Alt key down - wxACCEL_CTRL = 0x0002, // hold Ctrl key down - wxACCEL_SHIFT = 0x0004, // hold Shift key down -#if defined(__WXMAC__) || defined(__WXCOCOA__) - wxACCEL_CMD = 0x0008 // Command key on OS X -#else - wxACCEL_CMD = wxACCEL_CTRL -#endif -}; - -// ---------------------------------------------------------------------------- -// an entry in wxAcceleratorTable corresponds to one accelerator -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAcceleratorEntry -{ -public: - wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, - wxMenuItem *item = NULL) - : m_flags(flags) - , m_keyCode(keyCode) - , m_command(cmd) - , m_item(item) - { } - - wxAcceleratorEntry(const wxAcceleratorEntry& entry) - : m_flags(entry.m_flags) - , m_keyCode(entry.m_keyCode) - , m_command(entry.m_command) - , m_item(entry.m_item) - { } - - // create accelerator corresponding to the specified string, return NULL if - // string couldn't be parsed or a pointer to be deleted by the caller - static wxAcceleratorEntry *Create(const wxString& str); - - wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry) - { - Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item); - return *this; - } - - void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL) - { - m_flags = flags; - m_keyCode = keyCode; - m_command = cmd; - m_item = item; - } - - void SetMenuItem(wxMenuItem *item) { m_item = item; } - - int GetFlags() const { return m_flags; } - int GetKeyCode() const { return m_keyCode; } - int GetCommand() const { return m_command; } - - wxMenuItem *GetMenuItem() const { return m_item; } - - bool operator==(const wxAcceleratorEntry& entry) const - { - return m_flags == entry.m_flags && - m_keyCode == entry.m_keyCode && - m_command == entry.m_command && - m_item == entry.m_item; - } - - bool operator!=(const wxAcceleratorEntry& entry) const - { return !(*this == entry); } - -#if defined(__WXMOTIF__) - // Implementation use only - bool MatchesEvent(const wxKeyEvent& event) const; -#endif - - bool IsOk() const - { - return m_flags != 0 && - m_keyCode != 0; - } - - - // string <-> wxAcceleratorEntry conversion - // ---------------------------------------- - - // returns a wxString for the this accelerator. - // this function formats it using the - format - // where maybe a hyphen-separed list of "shift|alt|ctrl" - wxString ToString() const; - - // returns true if the given string correctly initialized this object - // (i.e. if IsOk() returns true after this call) - bool FromString(const wxString& str); - - -private: - // common part of Create() and FromString() - static bool ParseAccel(const wxString& str, int *flags, int *keycode); - - - int m_flags; // combination of wxACCEL_XXX constants - int m_keyCode; // ASCII or virtual keycode - int m_command; // Command id to generate - - // the menu item this entry corresponds to, may be NULL - wxMenuItem *m_item; - - // for compatibility with old code, use accessors now! - friend class WXDLLIMPEXP_FWD_CORE wxMenu; -}; - -// ---------------------------------------------------------------------------- -// include wxAcceleratorTable class declaration, it is only used by the library -// and so doesn't have any published user visible interface -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/accel.h" -#elif defined(__WXMSW__) - #include "wx/msw/accel.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/accel.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/accel.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/accel.h" -#elif defined(__WXMAC__) - #include "wx/mac/accel.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/accel.h" -#elif defined(__WXPM__) - #include "wx/os2/accel.h" -#endif - -extern WXDLLEXPORT_DATA(wxAcceleratorTable) wxNullAcceleratorTable; - -#endif // wxUSE_ACCEL - -#endif - // _WX_ACCEL_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/accel.h +// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes +// Author: Julian Smart, Robert Roebling, Vadim Zeitlin +// Modified by: +// Created: 31.05.01 (extracted from other files) +// RCS-ID: $Id: accel.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_BASE_ +#define _WX_ACCEL_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_ACCEL + +#include "wx/object.h" + +class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; +class WXDLLIMPEXP_FWD_CORE wxMenuItem; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxAcceleratorEntry flags +enum +{ + wxACCEL_NORMAL = 0x0000, // no modifiers + wxACCEL_ALT = 0x0001, // hold Alt key down + wxACCEL_CTRL = 0x0002, // hold Ctrl key down + wxACCEL_SHIFT = 0x0004, // hold Shift key down +#if defined(__WXMAC__) || defined(__WXCOCOA__) + wxACCEL_CMD = 0x0008 // Command key on OS X +#else + wxACCEL_CMD = wxACCEL_CTRL +#endif +}; + +// ---------------------------------------------------------------------------- +// an entry in wxAcceleratorTable corresponds to one accelerator +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAcceleratorEntry +{ +public: + wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, + wxMenuItem *item = NULL) + : m_flags(flags) + , m_keyCode(keyCode) + , m_command(cmd) + , m_item(item) + { } + + wxAcceleratorEntry(const wxAcceleratorEntry& entry) + : m_flags(entry.m_flags) + , m_keyCode(entry.m_keyCode) + , m_command(entry.m_command) + , m_item(entry.m_item) + { } + + // create accelerator corresponding to the specified string, return NULL if + // string couldn't be parsed or a pointer to be deleted by the caller + static wxAcceleratorEntry *Create(const wxString& str); + + wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry) + { + Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item); + return *this; + } + + void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL) + { + m_flags = flags; + m_keyCode = keyCode; + m_command = cmd; + m_item = item; + } + + void SetMenuItem(wxMenuItem *item) { m_item = item; } + + int GetFlags() const { return m_flags; } + int GetKeyCode() const { return m_keyCode; } + int GetCommand() const { return m_command; } + + wxMenuItem *GetMenuItem() const { return m_item; } + + bool operator==(const wxAcceleratorEntry& entry) const + { + return m_flags == entry.m_flags && + m_keyCode == entry.m_keyCode && + m_command == entry.m_command && + m_item == entry.m_item; + } + + bool operator!=(const wxAcceleratorEntry& entry) const + { return !(*this == entry); } + +#if defined(__WXMOTIF__) + // Implementation use only + bool MatchesEvent(const wxKeyEvent& event) const; +#endif + + bool IsOk() const + { + return m_flags != 0 && + m_keyCode != 0; + } + + + // string <-> wxAcceleratorEntry conversion + // ---------------------------------------- + + // returns a wxString for the this accelerator. + // this function formats it using the - format + // where maybe a hyphen-separed list of "shift|alt|ctrl" + wxString ToString() const; + + // returns true if the given string correctly initialized this object + // (i.e. if IsOk() returns true after this call) + bool FromString(const wxString& str); + + +private: + // common part of Create() and FromString() + static bool ParseAccel(const wxString& str, int *flags, int *keycode); + + + int m_flags; // combination of wxACCEL_XXX constants + int m_keyCode; // ASCII or virtual keycode + int m_command; // Command id to generate + + // the menu item this entry corresponds to, may be NULL + wxMenuItem *m_item; + + // for compatibility with old code, use accessors now! + friend class WXDLLIMPEXP_FWD_CORE wxMenu; +}; + +// ---------------------------------------------------------------------------- +// include wxAcceleratorTable class declaration, it is only used by the library +// and so doesn't have any published user visible interface +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/generic/accel.h" +#elif defined(__WXMSW__) + #include "wx/msw/accel.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/accel.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/accel.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/accel.h" +#elif defined(__WXMAC__) + #include "wx/mac/accel.h" +#elif defined(__WXCOCOA__) + #include "wx/generic/accel.h" +#elif defined(__WXPM__) + #include "wx/os2/accel.h" +#endif + +extern WXDLLEXPORT_DATA(wxAcceleratorTable) wxNullAcceleratorTable; + +#endif // wxUSE_ACCEL + +#endif + // _WX_ACCEL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/access.h b/Externals/wxWidgets/include/wx/access.h index b361415562..0a83346ab2 100644 --- a/Externals/wxWidgets/include/wx/access.h +++ b/Externals/wxWidgets/include/wx/access.h @@ -1,377 +1,377 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/access.h -// Purpose: Accessibility classes -// Author: Julian Smart -// Modified by: -// Created: 2003-02-12 -// RCS-ID: $Id: access.h 51246 2008-01-16 12:56:37Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCESSBASE_H_ -#define _WX_ACCESSBASE_H_ - -// ---------------------------------------------------------------------------- -// headers we have to include here -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_ACCESSIBILITY - -#include "wx/variant.h" - -typedef enum -{ - wxACC_FAIL, - wxACC_FALSE, - wxACC_OK, - wxACC_NOT_IMPLEMENTED, - wxACC_NOT_SUPPORTED -} wxAccStatus; - -// Child ids are integer identifiers from 1 up. -// So zero represents 'this' object. -#define wxACC_SELF 0 - -// Navigation constants - -typedef enum -{ - wxNAVDIR_DOWN, - wxNAVDIR_FIRSTCHILD, - wxNAVDIR_LASTCHILD, - wxNAVDIR_LEFT, - wxNAVDIR_NEXT, - wxNAVDIR_PREVIOUS, - wxNAVDIR_RIGHT, - wxNAVDIR_UP -} wxNavDir; - -// Role constants - -typedef enum { - wxROLE_NONE, - wxROLE_SYSTEM_ALERT, - wxROLE_SYSTEM_ANIMATION, - wxROLE_SYSTEM_APPLICATION, - wxROLE_SYSTEM_BORDER, - wxROLE_SYSTEM_BUTTONDROPDOWN, - wxROLE_SYSTEM_BUTTONDROPDOWNGRID, - wxROLE_SYSTEM_BUTTONMENU, - wxROLE_SYSTEM_CARET, - wxROLE_SYSTEM_CELL, - wxROLE_SYSTEM_CHARACTER, - wxROLE_SYSTEM_CHART, - wxROLE_SYSTEM_CHECKBUTTON, - wxROLE_SYSTEM_CLIENT, - wxROLE_SYSTEM_CLOCK, - wxROLE_SYSTEM_COLUMN, - wxROLE_SYSTEM_COLUMNHEADER, - wxROLE_SYSTEM_COMBOBOX, - wxROLE_SYSTEM_CURSOR, - wxROLE_SYSTEM_DIAGRAM, - wxROLE_SYSTEM_DIAL, - wxROLE_SYSTEM_DIALOG, - wxROLE_SYSTEM_DOCUMENT, - wxROLE_SYSTEM_DROPLIST, - wxROLE_SYSTEM_EQUATION, - wxROLE_SYSTEM_GRAPHIC, - wxROLE_SYSTEM_GRIP, - wxROLE_SYSTEM_GROUPING, - wxROLE_SYSTEM_HELPBALLOON, - wxROLE_SYSTEM_HOTKEYFIELD, - wxROLE_SYSTEM_INDICATOR, - wxROLE_SYSTEM_LINK, - wxROLE_SYSTEM_LIST, - wxROLE_SYSTEM_LISTITEM, - wxROLE_SYSTEM_MENUBAR, - wxROLE_SYSTEM_MENUITEM, - wxROLE_SYSTEM_MENUPOPUP, - wxROLE_SYSTEM_OUTLINE, - wxROLE_SYSTEM_OUTLINEITEM, - wxROLE_SYSTEM_PAGETAB, - wxROLE_SYSTEM_PAGETABLIST, - wxROLE_SYSTEM_PANE, - wxROLE_SYSTEM_PROGRESSBAR, - wxROLE_SYSTEM_PROPERTYPAGE, - wxROLE_SYSTEM_PUSHBUTTON, - wxROLE_SYSTEM_RADIOBUTTON, - wxROLE_SYSTEM_ROW, - wxROLE_SYSTEM_ROWHEADER, - wxROLE_SYSTEM_SCROLLBAR, - wxROLE_SYSTEM_SEPARATOR, - wxROLE_SYSTEM_SLIDER, - wxROLE_SYSTEM_SOUND, - wxROLE_SYSTEM_SPINBUTTON, - wxROLE_SYSTEM_STATICTEXT, - wxROLE_SYSTEM_STATUSBAR, - wxROLE_SYSTEM_TABLE, - wxROLE_SYSTEM_TEXT, - wxROLE_SYSTEM_TITLEBAR, - wxROLE_SYSTEM_TOOLBAR, - wxROLE_SYSTEM_TOOLTIP, - wxROLE_SYSTEM_WHITESPACE, - wxROLE_SYSTEM_WINDOW -} wxAccRole; - -// Object types - -typedef enum { - wxOBJID_WINDOW = 0x00000000, - wxOBJID_SYSMENU = 0xFFFFFFFF, - wxOBJID_TITLEBAR = 0xFFFFFFFE, - wxOBJID_MENU = 0xFFFFFFFD, - wxOBJID_CLIENT = 0xFFFFFFFC, - wxOBJID_VSCROLL = 0xFFFFFFFB, - wxOBJID_HSCROLL = 0xFFFFFFFA, - wxOBJID_SIZEGRIP = 0xFFFFFFF9, - wxOBJID_CARET = 0xFFFFFFF8, - wxOBJID_CURSOR = 0xFFFFFFF7, - wxOBJID_ALERT = 0xFFFFFFF6, - wxOBJID_SOUND = 0xFFFFFFF5 -} wxAccObject; - -// Accessible states - -#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001 -#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002 -#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004 -#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008 -#define wxACC_STATE_SYSTEM_BUSY 0x00000010 -#define wxACC_STATE_SYSTEM_CHECKED 0x00000020 -#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040 -#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080 -#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100 -#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200 -#define wxACC_STATE_SYSTEM_FLOATING 0x00000400 -#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800 -#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000 -#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000 -#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000 -#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000 -#define wxACC_STATE_SYSTEM_MIXED 0x00010000 -#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000 -#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000 -#define wxACC_STATE_SYSTEM_PRESSED 0x00080000 -#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000 -#define wxACC_STATE_SYSTEM_READONLY 0x00200000 -#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000 -#define wxACC_STATE_SYSTEM_SELECTED 0x00800000 -#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000 -#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000 - -// Selection flag - -typedef enum -{ - wxACC_SEL_NONE = 0, - wxACC_SEL_TAKEFOCUS = 1, - wxACC_SEL_TAKESELECTION = 2, - wxACC_SEL_EXTENDSELECTION = 4, - wxACC_SEL_ADDSELECTION = 8, - wxACC_SEL_REMOVESELECTION = 16 -} wxAccSelectionFlags; - -// Accessibility event identifiers - -#define wxACC_EVENT_SYSTEM_SOUND 0x0001 -#define wxACC_EVENT_SYSTEM_ALERT 0x0002 -#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003 -#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004 -#define wxACC_EVENT_SYSTEM_MENUEND 0x0005 -#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006 -#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007 -#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008 -#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009 -#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A -#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B -#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C -#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D -#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E -#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F -#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010 -#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011 -#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012 -#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013 -#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014 -#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015 -#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016 -#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017 -#define wxACC_EVENT_OBJECT_CREATE 0x8000 -#define wxACC_EVENT_OBJECT_DESTROY 0x8001 -#define wxACC_EVENT_OBJECT_SHOW 0x8002 -#define wxACC_EVENT_OBJECT_HIDE 0x8003 -#define wxACC_EVENT_OBJECT_REORDER 0x8004 -#define wxACC_EVENT_OBJECT_FOCUS 0x8005 -#define wxACC_EVENT_OBJECT_SELECTION 0x8006 -#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007 -#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008 -#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009 -#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A -#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B -#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C -#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D -#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E -#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F -#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010 -#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011 -#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012 - -// ---------------------------------------------------------------------------- -// wxAccessible -// All functions return an indication of success, failure, or not implemented. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxAccessible; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxPoint; -class WXDLLIMPEXP_FWD_CORE wxRect; -class WXDLLEXPORT wxAccessibleBase : public wxObject -{ - DECLARE_NO_COPY_CLASS(wxAccessibleBase) - -public: - wxAccessibleBase(wxWindow* win): m_window(win) {} - virtual ~wxAccessibleBase() {} - -// Overridables - - // Can return either a child object, or an integer - // representing the child element, starting from 1. - // pt is in screen coordinates. - virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns the rectangle for this object (id = 0) or a child element (id > 0). - // rect is in screen coordinates. - virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId)) - { return wxACC_NOT_IMPLEMENTED; } - - // Navigates from fromId to toId/toObject. - virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId), - int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject)) - { return wxACC_NOT_IMPLEMENTED; } - - // Gets the name of the specified object. - virtual wxAccStatus GetName(int WXUNUSED(childId), wxString* WXUNUSED(name)) - { return wxACC_NOT_IMPLEMENTED; } - - // Gets the number of children. - virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount)) - { return wxACC_NOT_IMPLEMENTED; } - - // Gets the specified child (starting from 1). - // If *child is NULL and return value is wxACC_OK, - // this means that the child is a simple element and - // not an accessible object. - virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child)) - { return wxACC_NOT_IMPLEMENTED; } - - // Gets the parent, or NULL. - virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent)) - { return wxACC_NOT_IMPLEMENTED; } - - // Performs the default action. childId is 0 (the action for this object) - // or > 0 (the action for a child). - // Return wxACC_NOT_SUPPORTED if there is no default action for this - // window (e.g. an edit control). - virtual wxAccStatus DoDefaultAction(int WXUNUSED(childId)) - { return wxACC_NOT_IMPLEMENTED; } - - // Gets the default action for this object (0) or > 0 (the action for a child). - // Return wxACC_OK even if there is no action. actionName is the action, or the empty - // string if there is no action. - // The retrieved string describes the action that is performed on an object, - // not what the object does as a result. For example, a toolbar button that prints - // a document has a default action of "Press" rather than "Prints the current document." - virtual wxAccStatus GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns the description for this object or a child. - virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns help text for this object or a child, similar to tooltip text. - virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns the keyboard shortcut for this object or child. - // Return e.g. ALT+K - virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns a role constant. - virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns a state constant. - virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state)) - { return wxACC_NOT_IMPLEMENTED; } - - // Returns a localized string representing the value for the object - // or child. - virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue)) - { return wxACC_NOT_IMPLEMENTED; } - - // Selects the object or child. - virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags)) - { return wxACC_NOT_IMPLEMENTED; } - - // Gets the window with the keyboard focus. - // If childId is 0 and child is NULL, no object in - // this subhierarchy has the focus. - // If this object has the focus, child should be 'this'. - virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) - { return wxACC_NOT_IMPLEMENTED; } - -#if wxUSE_VARIANT - // Gets a variant representing the selected children - // of this object. - // Acceptable values: - // - a null variant (IsNull() returns TRUE) - // - a list variant (GetType() == wxT("list")) - // - an integer representing the selected child element, - // or 0 if this object is selected (GetType() == wxT("long")) - // - a "void*" pointer to a wxAccessible child object - virtual wxAccStatus GetSelections(wxVariant* WXUNUSED(selections)) - { return wxACC_NOT_IMPLEMENTED; } -#endif // wxUSE_VARIANT - -// Accessors - - // Returns the window associated with this object. - - wxWindow* GetWindow() { return m_window; } - - // Sets the window associated with this object. - - void SetWindow(wxWindow* window) { m_window = window; } - -// Operations - - // Each platform's implementation must define this - // static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType, - // int objectId); - -private: - -// Data members - - wxWindow* m_window; -}; - - -// ---------------------------------------------------------------------------- -// now include the declaration of the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/access.h" -#endif - -#endif // wxUSE_ACCESSIBILITY - -#endif // _WX_ACCESSBASE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/access.h +// Purpose: Accessibility classes +// Author: Julian Smart +// Modified by: +// Created: 2003-02-12 +// RCS-ID: $Id: access.h 51246 2008-01-16 12:56:37Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCESSBASE_H_ +#define _WX_ACCESSBASE_H_ + +// ---------------------------------------------------------------------------- +// headers we have to include here +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_ACCESSIBILITY + +#include "wx/variant.h" + +typedef enum +{ + wxACC_FAIL, + wxACC_FALSE, + wxACC_OK, + wxACC_NOT_IMPLEMENTED, + wxACC_NOT_SUPPORTED +} wxAccStatus; + +// Child ids are integer identifiers from 1 up. +// So zero represents 'this' object. +#define wxACC_SELF 0 + +// Navigation constants + +typedef enum +{ + wxNAVDIR_DOWN, + wxNAVDIR_FIRSTCHILD, + wxNAVDIR_LASTCHILD, + wxNAVDIR_LEFT, + wxNAVDIR_NEXT, + wxNAVDIR_PREVIOUS, + wxNAVDIR_RIGHT, + wxNAVDIR_UP +} wxNavDir; + +// Role constants + +typedef enum { + wxROLE_NONE, + wxROLE_SYSTEM_ALERT, + wxROLE_SYSTEM_ANIMATION, + wxROLE_SYSTEM_APPLICATION, + wxROLE_SYSTEM_BORDER, + wxROLE_SYSTEM_BUTTONDROPDOWN, + wxROLE_SYSTEM_BUTTONDROPDOWNGRID, + wxROLE_SYSTEM_BUTTONMENU, + wxROLE_SYSTEM_CARET, + wxROLE_SYSTEM_CELL, + wxROLE_SYSTEM_CHARACTER, + wxROLE_SYSTEM_CHART, + wxROLE_SYSTEM_CHECKBUTTON, + wxROLE_SYSTEM_CLIENT, + wxROLE_SYSTEM_CLOCK, + wxROLE_SYSTEM_COLUMN, + wxROLE_SYSTEM_COLUMNHEADER, + wxROLE_SYSTEM_COMBOBOX, + wxROLE_SYSTEM_CURSOR, + wxROLE_SYSTEM_DIAGRAM, + wxROLE_SYSTEM_DIAL, + wxROLE_SYSTEM_DIALOG, + wxROLE_SYSTEM_DOCUMENT, + wxROLE_SYSTEM_DROPLIST, + wxROLE_SYSTEM_EQUATION, + wxROLE_SYSTEM_GRAPHIC, + wxROLE_SYSTEM_GRIP, + wxROLE_SYSTEM_GROUPING, + wxROLE_SYSTEM_HELPBALLOON, + wxROLE_SYSTEM_HOTKEYFIELD, + wxROLE_SYSTEM_INDICATOR, + wxROLE_SYSTEM_LINK, + wxROLE_SYSTEM_LIST, + wxROLE_SYSTEM_LISTITEM, + wxROLE_SYSTEM_MENUBAR, + wxROLE_SYSTEM_MENUITEM, + wxROLE_SYSTEM_MENUPOPUP, + wxROLE_SYSTEM_OUTLINE, + wxROLE_SYSTEM_OUTLINEITEM, + wxROLE_SYSTEM_PAGETAB, + wxROLE_SYSTEM_PAGETABLIST, + wxROLE_SYSTEM_PANE, + wxROLE_SYSTEM_PROGRESSBAR, + wxROLE_SYSTEM_PROPERTYPAGE, + wxROLE_SYSTEM_PUSHBUTTON, + wxROLE_SYSTEM_RADIOBUTTON, + wxROLE_SYSTEM_ROW, + wxROLE_SYSTEM_ROWHEADER, + wxROLE_SYSTEM_SCROLLBAR, + wxROLE_SYSTEM_SEPARATOR, + wxROLE_SYSTEM_SLIDER, + wxROLE_SYSTEM_SOUND, + wxROLE_SYSTEM_SPINBUTTON, + wxROLE_SYSTEM_STATICTEXT, + wxROLE_SYSTEM_STATUSBAR, + wxROLE_SYSTEM_TABLE, + wxROLE_SYSTEM_TEXT, + wxROLE_SYSTEM_TITLEBAR, + wxROLE_SYSTEM_TOOLBAR, + wxROLE_SYSTEM_TOOLTIP, + wxROLE_SYSTEM_WHITESPACE, + wxROLE_SYSTEM_WINDOW +} wxAccRole; + +// Object types + +typedef enum { + wxOBJID_WINDOW = 0x00000000, + wxOBJID_SYSMENU = 0xFFFFFFFF, + wxOBJID_TITLEBAR = 0xFFFFFFFE, + wxOBJID_MENU = 0xFFFFFFFD, + wxOBJID_CLIENT = 0xFFFFFFFC, + wxOBJID_VSCROLL = 0xFFFFFFFB, + wxOBJID_HSCROLL = 0xFFFFFFFA, + wxOBJID_SIZEGRIP = 0xFFFFFFF9, + wxOBJID_CARET = 0xFFFFFFF8, + wxOBJID_CURSOR = 0xFFFFFFF7, + wxOBJID_ALERT = 0xFFFFFFF6, + wxOBJID_SOUND = 0xFFFFFFF5 +} wxAccObject; + +// Accessible states + +#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001 +#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002 +#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004 +#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008 +#define wxACC_STATE_SYSTEM_BUSY 0x00000010 +#define wxACC_STATE_SYSTEM_CHECKED 0x00000020 +#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040 +#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080 +#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100 +#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200 +#define wxACC_STATE_SYSTEM_FLOATING 0x00000400 +#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800 +#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000 +#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000 +#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000 +#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000 +#define wxACC_STATE_SYSTEM_MIXED 0x00010000 +#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000 +#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000 +#define wxACC_STATE_SYSTEM_PRESSED 0x00080000 +#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000 +#define wxACC_STATE_SYSTEM_READONLY 0x00200000 +#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000 +#define wxACC_STATE_SYSTEM_SELECTED 0x00800000 +#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000 +#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000 + +// Selection flag + +typedef enum +{ + wxACC_SEL_NONE = 0, + wxACC_SEL_TAKEFOCUS = 1, + wxACC_SEL_TAKESELECTION = 2, + wxACC_SEL_EXTENDSELECTION = 4, + wxACC_SEL_ADDSELECTION = 8, + wxACC_SEL_REMOVESELECTION = 16 +} wxAccSelectionFlags; + +// Accessibility event identifiers + +#define wxACC_EVENT_SYSTEM_SOUND 0x0001 +#define wxACC_EVENT_SYSTEM_ALERT 0x0002 +#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003 +#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004 +#define wxACC_EVENT_SYSTEM_MENUEND 0x0005 +#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006 +#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007 +#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008 +#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009 +#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A +#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B +#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C +#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D +#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E +#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F +#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010 +#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011 +#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012 +#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013 +#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014 +#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015 +#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016 +#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017 +#define wxACC_EVENT_OBJECT_CREATE 0x8000 +#define wxACC_EVENT_OBJECT_DESTROY 0x8001 +#define wxACC_EVENT_OBJECT_SHOW 0x8002 +#define wxACC_EVENT_OBJECT_HIDE 0x8003 +#define wxACC_EVENT_OBJECT_REORDER 0x8004 +#define wxACC_EVENT_OBJECT_FOCUS 0x8005 +#define wxACC_EVENT_OBJECT_SELECTION 0x8006 +#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007 +#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008 +#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009 +#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A +#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B +#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C +#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D +#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E +#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F +#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010 +#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011 +#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012 + +// ---------------------------------------------------------------------------- +// wxAccessible +// All functions return an indication of success, failure, or not implemented. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxAccessible; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxPoint; +class WXDLLIMPEXP_FWD_CORE wxRect; +class WXDLLEXPORT wxAccessibleBase : public wxObject +{ + DECLARE_NO_COPY_CLASS(wxAccessibleBase) + +public: + wxAccessibleBase(wxWindow* win): m_window(win) {} + virtual ~wxAccessibleBase() {} + +// Overridables + + // Can return either a child object, or an integer + // representing the child element, starting from 1. + // pt is in screen coordinates. + virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns the rectangle for this object (id = 0) or a child element (id > 0). + // rect is in screen coordinates. + virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId)) + { return wxACC_NOT_IMPLEMENTED; } + + // Navigates from fromId to toId/toObject. + virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId), + int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject)) + { return wxACC_NOT_IMPLEMENTED; } + + // Gets the name of the specified object. + virtual wxAccStatus GetName(int WXUNUSED(childId), wxString* WXUNUSED(name)) + { return wxACC_NOT_IMPLEMENTED; } + + // Gets the number of children. + virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount)) + { return wxACC_NOT_IMPLEMENTED; } + + // Gets the specified child (starting from 1). + // If *child is NULL and return value is wxACC_OK, + // this means that the child is a simple element and + // not an accessible object. + virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child)) + { return wxACC_NOT_IMPLEMENTED; } + + // Gets the parent, or NULL. + virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent)) + { return wxACC_NOT_IMPLEMENTED; } + + // Performs the default action. childId is 0 (the action for this object) + // or > 0 (the action for a child). + // Return wxACC_NOT_SUPPORTED if there is no default action for this + // window (e.g. an edit control). + virtual wxAccStatus DoDefaultAction(int WXUNUSED(childId)) + { return wxACC_NOT_IMPLEMENTED; } + + // Gets the default action for this object (0) or > 0 (the action for a child). + // Return wxACC_OK even if there is no action. actionName is the action, or the empty + // string if there is no action. + // The retrieved string describes the action that is performed on an object, + // not what the object does as a result. For example, a toolbar button that prints + // a document has a default action of "Press" rather than "Prints the current document." + virtual wxAccStatus GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns the description for this object or a child. + virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns help text for this object or a child, similar to tooltip text. + virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns the keyboard shortcut for this object or child. + // Return e.g. ALT+K + virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns a role constant. + virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns a state constant. + virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state)) + { return wxACC_NOT_IMPLEMENTED; } + + // Returns a localized string representing the value for the object + // or child. + virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue)) + { return wxACC_NOT_IMPLEMENTED; } + + // Selects the object or child. + virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags)) + { return wxACC_NOT_IMPLEMENTED; } + + // Gets the window with the keyboard focus. + // If childId is 0 and child is NULL, no object in + // this subhierarchy has the focus. + // If this object has the focus, child should be 'this'. + virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) + { return wxACC_NOT_IMPLEMENTED; } + +#if wxUSE_VARIANT + // Gets a variant representing the selected children + // of this object. + // Acceptable values: + // - a null variant (IsNull() returns TRUE) + // - a list variant (GetType() == wxT("list")) + // - an integer representing the selected child element, + // or 0 if this object is selected (GetType() == wxT("long")) + // - a "void*" pointer to a wxAccessible child object + virtual wxAccStatus GetSelections(wxVariant* WXUNUSED(selections)) + { return wxACC_NOT_IMPLEMENTED; } +#endif // wxUSE_VARIANT + +// Accessors + + // Returns the window associated with this object. + + wxWindow* GetWindow() { return m_window; } + + // Sets the window associated with this object. + + void SetWindow(wxWindow* window) { m_window = window; } + +// Operations + + // Each platform's implementation must define this + // static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType, + // int objectId); + +private: + +// Data members + + wxWindow* m_window; +}; + + +// ---------------------------------------------------------------------------- +// now include the declaration of the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/access.h" +#endif + +#endif // wxUSE_ACCESSIBILITY + +#endif // _WX_ACCESSBASE_H_ + diff --git a/Externals/wxWidgets/include/wx/afterstd.h b/Externals/wxWidgets/include/wx/afterstd.h index df325f06f9..4c1d4a5a25 100644 --- a/Externals/wxWidgets/include/wx/afterstd.h +++ b/Externals/wxWidgets/include/wx/afterstd.h @@ -1,48 +1,48 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/afterstd.h -// Purpose: #include after STL headers -// Author: Vadim Zeitlin -// Modified by: -// Created: 07/07/03 -// RCS-ID: $Id: afterstd.h 42906 2006-11-01 14:16:42Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/** - See the comments in beforestd.h. - */ - -#if defined(__WXMSW__) - #include "wx/msw/winundef.h" -#endif - -// undo what we did in wx/beforestd.h -#if defined(__VISUALC__) && __VISUALC__ <= 1201 - // MSVC 5 does not have this - #if _MSC_VER > 1100 - // don't restore this one for VC6, it gives it in each try/catch which is a - // bit annoying to say the least - #if _MSC_VER >= 0x1300 - // unreachable code - #pragma warning(default:4702) - #endif // VC++ >= 7 - - #pragma warning(pop) - #else - // 'expression' : signed/unsigned mismatch - #pragma warning(default:4018) - - // 'identifier' : unreferenced formal parameter - #pragma warning(default:4100) - - // 'conversion' : conversion from 'type1' to 'type2', - // possible loss of data - #pragma warning(default:4244) - - // C++ language change: to explicitly specialize class template - // 'identifier' use the following syntax - #pragma warning(default:4663) - #endif -#endif - +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/afterstd.h +// Purpose: #include after STL headers +// Author: Vadim Zeitlin +// Modified by: +// Created: 07/07/03 +// RCS-ID: $Id: afterstd.h 42906 2006-11-01 14:16:42Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/** + See the comments in beforestd.h. + */ + +#if defined(__WXMSW__) + #include "wx/msw/winundef.h" +#endif + +// undo what we did in wx/beforestd.h +#if defined(__VISUALC__) && __VISUALC__ <= 1201 + // MSVC 5 does not have this + #if _MSC_VER > 1100 + // don't restore this one for VC6, it gives it in each try/catch which is a + // bit annoying to say the least + #if _MSC_VER >= 0x1300 + // unreachable code + #pragma warning(default:4702) + #endif // VC++ >= 7 + + #pragma warning(pop) + #else + // 'expression' : signed/unsigned mismatch + #pragma warning(default:4018) + + // 'identifier' : unreferenced formal parameter + #pragma warning(default:4100) + + // 'conversion' : conversion from 'type1' to 'type2', + // possible loss of data + #pragma warning(default:4244) + + // C++ language change: to explicitly specialize class template + // 'identifier' use the following syntax + #pragma warning(default:4663) + #endif +#endif + diff --git a/Externals/wxWidgets/include/wx/anidecod.h b/Externals/wxWidgets/include/wx/anidecod.h index 6e3847614a..0b664d86b8 100644 --- a/Externals/wxWidgets/include/wx/anidecod.h +++ b/Externals/wxWidgets/include/wx/anidecod.h @@ -1,77 +1,77 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/anidecod.h -// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation -// Author: Francesco Montorsi -// CVS-ID: $Id: anidecod.h 45563 2007-04-21 18:17:50Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANIDECOD_H -#define _WX_ANIDECOD_H - -#include "wx/defs.h" - -#if wxUSE_STREAMS && wxUSE_ICO_CUR - -#include "wx/stream.h" -#include "wx/image.h" -#include "wx/animdecod.h" -#include "wx/dynarray.h" - - -class /*WXDLLEXPORT*/ wxANIFrameInfo; - -WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); -WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); - -// -------------------------------------------------------------------------- -// wxANIDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder -{ -public: - // constructor, destructor, etc. - wxANIDecoder(); - ~wxANIDecoder(); - - - virtual wxSize GetFrameSize(unsigned int frame) const; - virtual wxPoint GetFramePosition(unsigned int frame) const; - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - virtual long GetDelay(unsigned int frame) const; - virtual wxColour GetTransparentColour(unsigned int frame) const; - - // implementation of wxAnimationDecoder's pure virtuals - virtual bool CanRead( wxInputStream& stream ) const; - virtual bool Load( wxInputStream& stream ); - - bool ConvertToImage(unsigned int frame, wxImage *image) const; - - wxAnimationDecoder *Clone() const - { return new wxANIDecoder; } - wxAnimationType GetType() const - { return wxANIMATION_TYPE_ANI; } - -private: - // frames stored as wxImage(s): ANI files are meant to be used mostly for animated - // cursors and thus they do not use any optimization to encode differences between - // two frames: they are just a list of images to display sequentially. - wxImageArray m_images; - - // the info about each image stored in m_images. - // NB: m_info.GetCount() may differ from m_images.GetCount()! - wxANIFrameInfoArray m_info; - - // this is the wxCURHandler used to load the ICON chunk of the ANI files - static wxCURHandler sm_handler; - - - DECLARE_NO_COPY_CLASS(wxANIDecoder) -}; - - -#endif // wxUSE_STREAM && wxUSE_ICO_CUR - -#endif // _WX_ANIDECOD_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/anidecod.h +// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation +// Author: Francesco Montorsi +// CVS-ID: $Id: anidecod.h 45563 2007-04-21 18:17:50Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANIDECOD_H +#define _WX_ANIDECOD_H + +#include "wx/defs.h" + +#if wxUSE_STREAMS && wxUSE_ICO_CUR + +#include "wx/stream.h" +#include "wx/image.h" +#include "wx/animdecod.h" +#include "wx/dynarray.h" + + +class /*WXDLLEXPORT*/ wxANIFrameInfo; + +WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); +WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); + +// -------------------------------------------------------------------------- +// wxANIDecoder class +// -------------------------------------------------------------------------- + +class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder +{ +public: + // constructor, destructor, etc. + wxANIDecoder(); + ~wxANIDecoder(); + + + virtual wxSize GetFrameSize(unsigned int frame) const; + virtual wxPoint GetFramePosition(unsigned int frame) const; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; + virtual long GetDelay(unsigned int frame) const; + virtual wxColour GetTransparentColour(unsigned int frame) const; + + // implementation of wxAnimationDecoder's pure virtuals + virtual bool CanRead( wxInputStream& stream ) const; + virtual bool Load( wxInputStream& stream ); + + bool ConvertToImage(unsigned int frame, wxImage *image) const; + + wxAnimationDecoder *Clone() const + { return new wxANIDecoder; } + wxAnimationType GetType() const + { return wxANIMATION_TYPE_ANI; } + +private: + // frames stored as wxImage(s): ANI files are meant to be used mostly for animated + // cursors and thus they do not use any optimization to encode differences between + // two frames: they are just a list of images to display sequentially. + wxImageArray m_images; + + // the info about each image stored in m_images. + // NB: m_info.GetCount() may differ from m_images.GetCount()! + wxANIFrameInfoArray m_info; + + // this is the wxCURHandler used to load the ICON chunk of the ANI files + static wxCURHandler sm_handler; + + + DECLARE_NO_COPY_CLASS(wxANIDecoder) +}; + + +#endif // wxUSE_STREAM && wxUSE_ICO_CUR + +#endif // _WX_ANIDECOD_H diff --git a/Externals/wxWidgets/include/wx/animate.h b/Externals/wxWidgets/include/wx/animate.h index 15cf932dcd..451cce52fc 100644 --- a/Externals/wxWidgets/include/wx/animate.h +++ b/Externals/wxWidgets/include/wx/animate.h @@ -1,124 +1,124 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/animate.h -// Purpose: wxAnimation and wxAnimationCtrl -// Author: Julian Smart and Guillermo Rodriguez Garcia -// Modified by: Francesco Montorsi -// Created: 13/8/99 -// RCS-ID: $Id: animate.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANIMATE_H_ -#define _WX_ANIMATE_H_ - -#include "wx/defs.h" - -#if wxUSE_ANIMATIONCTRL - -#include "wx/animdecod.h" -#include "wx/control.h" -#include "wx/timer.h" -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_ADV wxAnimation; - -extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation; -extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[]; - - -// ---------------------------------------------------------------------------- -// wxAnimationBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject -{ -public: - wxAnimationBase() {} - - virtual bool IsOk() const = 0; - - // can be -1 - virtual int GetDelay(unsigned int frame) const = 0; - - virtual unsigned int GetFrameCount() const = 0; - virtual wxImage GetFrame(unsigned int frame) const = 0; - virtual wxSize GetSize() const = 0; - - virtual bool LoadFile(const wxString& name, - wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; - virtual bool Load(wxInputStream& stream, - wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; - -protected: - DECLARE_ABSTRACT_CLASS(wxAnimationBase) -}; - - - -// ---------------------------------------------------------------------------- -// wxAnimationCtrlBase -// ---------------------------------------------------------------------------- - -// do not autoresize to the animation's size when SetAnimation() is called -#define wxAC_NO_AUTORESIZE (0x0010) - -// default style does not include wxAC_NO_AUTORESIZE, that is, the control -// auto-resizes by default to fit the new animation when SetAnimation() is called -#define wxAC_DEFAULT_STYLE (wxNO_BORDER) - -class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl -{ -public: - wxAnimationCtrlBase() { } - - // public API - virtual bool LoadFile(const wxString& filename, - wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; - - virtual void SetAnimation(const wxAnimation &anim) = 0; - virtual wxAnimation GetAnimation() const = 0; - - virtual bool Play() = 0; - virtual void Stop() = 0; - - virtual bool IsPlaying() const = 0; - - virtual void SetInactiveBitmap(const wxBitmap &bmp); - - // always return the original bitmap set in this control - wxBitmap GetInactiveBitmap() const - { return m_bmpStatic; } - -protected: - // the inactive bitmap as it was set by the user - wxBitmap m_bmpStatic; - - // the inactive bitmap currently shown in the control - // (may differ in the size from m_bmpStatic) - wxBitmap m_bmpStaticReal; - - // updates m_bmpStaticReal from m_bmpStatic if needed - virtual void UpdateStaticImage(); - - // called by SetInactiveBitmap - virtual void DisplayStaticImage() = 0; - -private: - DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) -}; - - -// ---------------------------------------------------------------------------- -// include the platform-specific version of the wxAnimationCtrl class -// ---------------------------------------------------------------------------- - -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/animate.h" -#else - #include "wx/generic/animate.h" -#endif - -#endif // wxUSE_ANIMATIONCTRL - -#endif // _WX_ANIMATE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/animate.h +// Purpose: wxAnimation and wxAnimationCtrl +// Author: Julian Smart and Guillermo Rodriguez Garcia +// Modified by: Francesco Montorsi +// Created: 13/8/99 +// RCS-ID: $Id: animate.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANIMATE_H_ +#define _WX_ANIMATE_H_ + +#include "wx/defs.h" + +#if wxUSE_ANIMATIONCTRL + +#include "wx/animdecod.h" +#include "wx/control.h" +#include "wx/timer.h" +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_ADV wxAnimation; + +extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation; +extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxAnimationBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject +{ +public: + wxAnimationBase() {} + + virtual bool IsOk() const = 0; + + // can be -1 + virtual int GetDelay(unsigned int frame) const = 0; + + virtual unsigned int GetFrameCount() const = 0; + virtual wxImage GetFrame(unsigned int frame) const = 0; + virtual wxSize GetSize() const = 0; + + virtual bool LoadFile(const wxString& name, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + virtual bool Load(wxInputStream& stream, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + +protected: + DECLARE_ABSTRACT_CLASS(wxAnimationBase) +}; + + + +// ---------------------------------------------------------------------------- +// wxAnimationCtrlBase +// ---------------------------------------------------------------------------- + +// do not autoresize to the animation's size when SetAnimation() is called +#define wxAC_NO_AUTORESIZE (0x0010) + +// default style does not include wxAC_NO_AUTORESIZE, that is, the control +// auto-resizes by default to fit the new animation when SetAnimation() is called +#define wxAC_DEFAULT_STYLE (wxNO_BORDER) + +class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl +{ +public: + wxAnimationCtrlBase() { } + + // public API + virtual bool LoadFile(const wxString& filename, + wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; + + virtual void SetAnimation(const wxAnimation &anim) = 0; + virtual wxAnimation GetAnimation() const = 0; + + virtual bool Play() = 0; + virtual void Stop() = 0; + + virtual bool IsPlaying() const = 0; + + virtual void SetInactiveBitmap(const wxBitmap &bmp); + + // always return the original bitmap set in this control + wxBitmap GetInactiveBitmap() const + { return m_bmpStatic; } + +protected: + // the inactive bitmap as it was set by the user + wxBitmap m_bmpStatic; + + // the inactive bitmap currently shown in the control + // (may differ in the size from m_bmpStatic) + wxBitmap m_bmpStaticReal; + + // updates m_bmpStaticReal from m_bmpStatic if needed + virtual void UpdateStaticImage(); + + // called by SetInactiveBitmap + virtual void DisplayStaticImage() = 0; + +private: + DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) +}; + + +// ---------------------------------------------------------------------------- +// include the platform-specific version of the wxAnimationCtrl class +// ---------------------------------------------------------------------------- + +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/animate.h" +#else + #include "wx/generic/animate.h" +#endif + +#endif // wxUSE_ANIMATIONCTRL + +#endif // _WX_ANIMATE_H_ diff --git a/Externals/wxWidgets/include/wx/animdecod.h b/Externals/wxWidgets/include/wx/animdecod.h index a1cb15eaa1..d6dc9a48df 100644 --- a/Externals/wxWidgets/include/wx/animdecod.h +++ b/Externals/wxWidgets/include/wx/animdecod.h @@ -1,146 +1,146 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/animdecod.h -// Purpose: wxAnimationDecoder -// Author: Francesco Montorsi -// CVS-ID: $Id: animdecod.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ANIMDECOD_H -#define _WX_ANIMDECOD_H - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include "wx/colour.h" -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_CORE wxImage; - -/* - - Differences between a wxAnimationDecoder and a wxImageHandler: - - 1) wxImageHandlers always load an input stream directly into a given wxImage - object converting from the format-specific data representation to the - wxImage native format (RGB24). - wxAnimationDecoders always load an input stream using some optimized format - to store it which is format-depedent. This allows to store a (possibly big) - animation using a format which is a good compromise between required memory - and time required to blit in on the screen. - - 2) wxAnimationDecoders contain the animation data in some internal var. - That's why they derive from wxObjectRefData: they are data which can be shared. - - 3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame - in wxImage format; the viceversa cannot be done. - - 4) wxAnimationDecoders are decoders only, thus do not support save features. - - 5) wxAnimationDecoders are directly used by wxAnimation (generic implementation) - as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for - wxImage uses. - -*/ - - -// -------------------------------------------------------------------------- -// Constants -// -------------------------------------------------------------------------- - -// NB: the values of these enum items are not casual but coincide with the -// GIF disposal codes. Do not change them !! -enum wxAnimationDisposal -{ - // No disposal specified. The decoder is not required to take any action. - wxANIM_UNSPECIFIED = -1, - - // Do not dispose. The graphic is to be left in place. - wxANIM_DONOTREMOVE = 0, - - // Restore to background color. The area used by the graphic must be - // restored to the background color. - wxANIM_TOBACKGROUND = 1, - - // Restore to previous. The decoder is required to restore the area - // overwritten by the graphic with what was there prior to rendering the graphic. - wxANIM_TOPREVIOUS = 2 -}; - -enum wxAnimationType -{ - wxANIMATION_TYPE_INVALID, - wxANIMATION_TYPE_GIF, - wxANIMATION_TYPE_ANI, - - wxANIMATION_TYPE_ANY -}; - - -// -------------------------------------------------------------------------- -// wxAnimationDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxAnimationDecoder : public wxObjectRefData -{ -public: - wxAnimationDecoder() - { - m_background = wxNullColour; - m_nFrames = 0; - } - virtual ~wxAnimationDecoder() { } - - - virtual bool Load( wxInputStream& stream ) = 0; - virtual bool CanRead( wxInputStream& stream ) const = 0; - - virtual wxAnimationDecoder *Clone() const = 0; - virtual wxAnimationType GetType() const = 0; - - // convert given frame to wxImage - virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0; - - - // frame specific data getters - - // not all frames may be of the same size; e.g. GIF allows to - // specify that between two frames only a smaller portion of the - // entire animation has changed. - virtual wxSize GetFrameSize(unsigned int frame) const = 0; - - // the position of this frame in case it's not as big as m_szAnimation - // or wxPoint(0,0) otherwise. - virtual wxPoint GetFramePosition(unsigned int frame) const = 0; - - // what should be done after displaying this frame. - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0; - - // the number of milliseconds this frame should be displayed. - // if returns -1 then the frame must be displayed forever. - virtual long GetDelay(unsigned int frame) const = 0; - - // the transparent colour for this frame if any or wxNullColour. - virtual wxColour GetTransparentColour(unsigned int frame) const = 0; - - // get global data - wxSize GetAnimationSize() const { return m_szAnimation; } - wxColour GetBackgroundColour() const { return m_background; } - unsigned int GetFrameCount() const { return m_nFrames; } - -protected: - wxSize m_szAnimation; - unsigned int m_nFrames; - - // this is the colour to use for the wxANIM_TOBACKGROUND disposal. - // if not specified by the animation, it's set to wxNullColour - wxColour m_background; -}; - - -#endif // wxUSE_STREAM -#endif // _WX_ANIMDECOD_H - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/animdecod.h +// Purpose: wxAnimationDecoder +// Author: Francesco Montorsi +// CVS-ID: $Id: animdecod.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANIMDECOD_H +#define _WX_ANIMDECOD_H + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include "wx/colour.h" +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_CORE wxImage; + +/* + + Differences between a wxAnimationDecoder and a wxImageHandler: + + 1) wxImageHandlers always load an input stream directly into a given wxImage + object converting from the format-specific data representation to the + wxImage native format (RGB24). + wxAnimationDecoders always load an input stream using some optimized format + to store it which is format-depedent. This allows to store a (possibly big) + animation using a format which is a good compromise between required memory + and time required to blit in on the screen. + + 2) wxAnimationDecoders contain the animation data in some internal var. + That's why they derive from wxObjectRefData: they are data which can be shared. + + 3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame + in wxImage format; the viceversa cannot be done. + + 4) wxAnimationDecoders are decoders only, thus do not support save features. + + 5) wxAnimationDecoders are directly used by wxAnimation (generic implementation) + as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for + wxImage uses. + +*/ + + +// -------------------------------------------------------------------------- +// Constants +// -------------------------------------------------------------------------- + +// NB: the values of these enum items are not casual but coincide with the +// GIF disposal codes. Do not change them !! +enum wxAnimationDisposal +{ + // No disposal specified. The decoder is not required to take any action. + wxANIM_UNSPECIFIED = -1, + + // Do not dispose. The graphic is to be left in place. + wxANIM_DONOTREMOVE = 0, + + // Restore to background color. The area used by the graphic must be + // restored to the background color. + wxANIM_TOBACKGROUND = 1, + + // Restore to previous. The decoder is required to restore the area + // overwritten by the graphic with what was there prior to rendering the graphic. + wxANIM_TOPREVIOUS = 2 +}; + +enum wxAnimationType +{ + wxANIMATION_TYPE_INVALID, + wxANIMATION_TYPE_GIF, + wxANIMATION_TYPE_ANI, + + wxANIMATION_TYPE_ANY +}; + + +// -------------------------------------------------------------------------- +// wxAnimationDecoder class +// -------------------------------------------------------------------------- + +class WXDLLEXPORT wxAnimationDecoder : public wxObjectRefData +{ +public: + wxAnimationDecoder() + { + m_background = wxNullColour; + m_nFrames = 0; + } + virtual ~wxAnimationDecoder() { } + + + virtual bool Load( wxInputStream& stream ) = 0; + virtual bool CanRead( wxInputStream& stream ) const = 0; + + virtual wxAnimationDecoder *Clone() const = 0; + virtual wxAnimationType GetType() const = 0; + + // convert given frame to wxImage + virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0; + + + // frame specific data getters + + // not all frames may be of the same size; e.g. GIF allows to + // specify that between two frames only a smaller portion of the + // entire animation has changed. + virtual wxSize GetFrameSize(unsigned int frame) const = 0; + + // the position of this frame in case it's not as big as m_szAnimation + // or wxPoint(0,0) otherwise. + virtual wxPoint GetFramePosition(unsigned int frame) const = 0; + + // what should be done after displaying this frame. + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0; + + // the number of milliseconds this frame should be displayed. + // if returns -1 then the frame must be displayed forever. + virtual long GetDelay(unsigned int frame) const = 0; + + // the transparent colour for this frame if any or wxNullColour. + virtual wxColour GetTransparentColour(unsigned int frame) const = 0; + + // get global data + wxSize GetAnimationSize() const { return m_szAnimation; } + wxColour GetBackgroundColour() const { return m_background; } + unsigned int GetFrameCount() const { return m_nFrames; } + +protected: + wxSize m_szAnimation; + unsigned int m_nFrames; + + // this is the colour to use for the wxANIM_TOBACKGROUND disposal. + // if not specified by the animation, it's set to wxNullColour + wxColour m_background; +}; + + +#endif // wxUSE_STREAM +#endif // _WX_ANIMDECOD_H + diff --git a/Externals/wxWidgets/include/wx/app.h b/Externals/wxWidgets/include/wx/app.h index b7d500b126..1846d563e2 100644 --- a/Externals/wxWidgets/include/wx/app.h +++ b/Externals/wxWidgets/include/wx/app.h @@ -1,708 +1,708 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/app.h -// Purpose: wxAppBase class and macros used for declaration of wxApp -// derived class in the user code -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: app.h 51592 2008-02-08 08:17:41Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_APP_H_BASE_ -#define _WX_APP_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers we have to include here -// ---------------------------------------------------------------------------- - -#include "wx/event.h" // for the base class -#include "wx/build.h" -#include "wx/init.h" // we must declare wxEntry() -#include "wx/intl.h" // for wxLayoutDirection - -class WXDLLIMPEXP_FWD_BASE wxAppConsole; -class WXDLLIMPEXP_FWD_BASE wxAppTraits; -class WXDLLIMPEXP_FWD_BASE wxCmdLineParser; -class WXDLLIMPEXP_FWD_BASE wxLog; -class WXDLLIMPEXP_FWD_BASE wxMessageOutput; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_BASE wxEventLoop; - struct WXDLLIMPEXP_FWD_CORE wxVideoMode; -#endif - -// ---------------------------------------------------------------------------- -// typedefs -// ---------------------------------------------------------------------------- - -// the type of the function used to create a wxApp object on program start up -typedef wxAppConsole* (*wxAppInitializerFunction)(); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum -{ - wxPRINT_WINDOWS = 1, - wxPRINT_POSTSCRIPT = 2 -}; - -// ---------------------------------------------------------------------------- -// wxAppConsole: wxApp for non-GUI applications -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler -{ -public: - // ctor and dtor - wxAppConsole(); - virtual ~wxAppConsole(); - - - // the virtual functions which may/must be overridden in the derived class - // ----------------------------------------------------------------------- - - // This is the very first function called for a newly created wxApp object, - // it is used by the library to do the global initialization. If, for some - // reason, you must override it (instead of just overriding OnInit(), as - // usual, for app-specific initializations), do not forget to call the base - // class version! - virtual bool Initialize(int& argc, wxChar **argv); - - // This gives wxCocoa a chance to call OnInit() with a memory pool in place - virtual bool CallOnInit() { return OnInit(); } - - // Called before OnRun(), this is a good place to do initialization -- if - // anything fails, return false from here to prevent the program from - // continuing. The command line is normally parsed here, call the base - // class OnInit() to do it. - virtual bool OnInit(); - - // this is here only temporary hopefully (FIXME) - virtual bool OnInitGui() { return true; } - - // This is the replacement for the normal main(): all program work should - // be done here. When OnRun() returns, the programs starts shutting down. - virtual int OnRun() = 0; - - // This is only called if OnInit() returned true so it's a good place to do - // any cleanup matching the initializations done there. - virtual int OnExit(); - - // This is the very last function called on wxApp object before it is - // destroyed. If you override it (instead of overriding OnExit() as usual) - // do not forget to call the base class version! - virtual void CleanUp(); - - // Called when a fatal exception occurs, this function should take care not - // to do anything which might provoke a nested exception! It may be - // overridden if you wish to react somehow in non-default way (core dump - // under Unix, application crash under Windows) to fatal program errors, - // however extreme care should be taken if you don't want this function to - // crash. - virtual void OnFatalException() { } - - // Called from wxExit() function, should terminate the application a.s.a.p. - virtual void Exit(); - - - // application info: name, description, vendor - // ------------------------------------------- - - // NB: all these should be set by the application itself, there are no - // reasonable default except for the application name which is taken to - // be argv[0] - - // set/get the application name - wxString GetAppName() const - { - return m_appName.empty() ? m_className : m_appName; - } - void SetAppName(const wxString& name) { m_appName = name; } - - // set/get the app class name - wxString GetClassName() const { return m_className; } - void SetClassName(const wxString& name) { m_className = name; } - - // set/get the vendor name - const wxString& GetVendorName() const { return m_vendorName; } - void SetVendorName(const wxString& name) { m_vendorName = name; } - - - // cmd line parsing stuff - // ---------------------- - - // all of these methods may be overridden in the derived class to - // customize the command line parsing (by default only a few standard - // options are handled) - // - // you also need to call wxApp::OnInit() from YourApp::OnInit() for all - // this to work - -#if wxUSE_CMDLINE_PARSER - // this one is called from OnInit() to add all supported options - // to the given parser (don't forget to call the base class version if you - // override it!) - virtual void OnInitCmdLine(wxCmdLineParser& parser); - - // called after successfully parsing the command line, return true - // to continue and false to exit (don't forget to call the base class - // version if you override it!) - virtual bool OnCmdLineParsed(wxCmdLineParser& parser); - - // called if "--help" option was specified, return true to continue - // and false to exit - virtual bool OnCmdLineHelp(wxCmdLineParser& parser); - - // called if incorrect command line options were given, return - // false to abort and true to continue - virtual bool OnCmdLineError(wxCmdLineParser& parser); -#endif // wxUSE_CMDLINE_PARSER - - - // miscellaneous customization functions - // ------------------------------------- - - // create the app traits object to which we delegate for everything which - // either should be configurable by the user (then he can change the - // default behaviour simply by overriding CreateTraits() and returning his - // own traits object) or which is GUI/console dependent as then wxAppTraits - // allows us to abstract the differences behind the common façade - wxAppTraits *GetTraits(); - - // the functions below shouldn't be used now that we have wxAppTraits -#if WXWIN_COMPATIBILITY_2_4 - -#if wxUSE_LOG - // override this function to create default log target of arbitrary - // user-defined class (default implementation creates a wxLogGui - // object) -- this log object is used by default by all wxLogXXX() - // functions. - wxDEPRECATED( virtual wxLog *CreateLogTarget() ); -#endif // wxUSE_LOG - - // similar to CreateLogTarget() but for the global wxMessageOutput - // object - wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() ); - -#endif // WXWIN_COMPATIBILITY_2_4 - - - // event processing functions - // -------------------------- - - // this method allows to filter all the events processed by the program, so - // you should try to return quickly from it to avoid slowing down the - // program to the crawl - // - // return value should be -1 to continue with the normal event processing, - // or TRUE or FALSE to stop further processing and pretend that the event - // had been already processed or won't be processed at all, respectively - virtual int FilterEvent(wxEvent& event); - -#if wxUSE_EXCEPTIONS - // call the specified handler on the given object with the given event - // - // this method only exists to allow catching the exceptions thrown by any - // event handler, it would lead to an extra (useless) virtual function call - // if the exceptions were not used, so it doesn't even exist in that case - virtual void HandleEvent(wxEvtHandler *handler, - wxEventFunction func, - wxEvent& event) const; - - // Called when an unhandled C++ exception occurs inside OnRun(): note that - // the exception type is lost by now, so if you really want to handle the - // exception you should override OnRun() and put a try/catch around - // MainLoop() call there or use OnExceptionInMainLoop() - virtual void OnUnhandledException() { } -#endif // wxUSE_EXCEPTIONS - - // process all events in the wxPendingEvents list -- it is necessary to - // call this function to process posted events. This happens during each - // event loop iteration in GUI mode but if there is no main loop, it may be - // also called directly. - virtual void ProcessPendingEvents(); - - // doesn't do anything in this class, just a hook for GUI wxApp - virtual bool Yield(bool WXUNUSED(onlyIfNeeded) = false) { return true; } - - // make sure that idle events are sent again - virtual void WakeUpIdle() { } - - // this is just a convenience: by providing its implementation here we - // avoid #ifdefs in the code using it - static bool IsMainLoopRunning() { return false; } - - - // debugging support - // ----------------- - -#ifdef __WXDEBUG__ - // this function is called when an assert failure occurs, the base class - // version does the normal processing (i.e. shows the usual assert failure - // dialog box) - // - // the arguments are the location of the failed assert (func may be empty - // if the compiler doesn't support C99 __FUNCTION__), the text of the - // assert itself and the user-specified message - virtual void OnAssertFailure(const wxChar *file, - int line, - const wxChar *func, - const wxChar *cond, - const wxChar *msg); - - // old version of the function without func parameter, for compatibility - // only, override OnAssertFailure() in the new code - virtual void OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg); -#endif // __WXDEBUG__ - - // check that the wxBuildOptions object (constructed in the application - // itself, usually the one from IMPLEMENT_APP() macro) matches the build - // options of the library and abort if it doesn't - static bool CheckBuildOptions(const char *optionsSignature, - const char *componentName); -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) ); -#endif - - // implementation only from now on - // ------------------------------- - - // helpers for dynamic wxApp construction - static void SetInitializerFunction(wxAppInitializerFunction fn) - { ms_appInitFn = fn; } - static wxAppInitializerFunction GetInitializerFunction() - { return ms_appInitFn; } - - // accessors for ms_appInstance field (external code might wish to modify - // it, this is why we provide a setter here as well, but you should really - // know what you're doing if you call it), wxTheApp is usually used instead - // of GetInstance() - static wxAppConsole *GetInstance() { return ms_appInstance; } - static void SetInstance(wxAppConsole *app) { ms_appInstance = app; } - - - // command line arguments (public for backwards compatibility) - int argc; - wxChar **argv; - -protected: - // the function which creates the traits object when GetTraits() needs it - // for the first time - virtual wxAppTraits *CreateTraits(); - - - // function used for dynamic wxApp creation - static wxAppInitializerFunction ms_appInitFn; - - // the one and only global application object - static wxAppConsole *ms_appInstance; - - - // application info (must be set from the user code) - wxString m_vendorName, // vendor name (ACME Inc) - m_appName, // app name - m_className; // class name - - // the class defining the application behaviour, NULL initially and created - // by GetTraits() when first needed - wxAppTraits *m_traits; - - - // the application object is a singleton anyhow, there is no sense in - // copying it - DECLARE_NO_COPY_CLASS(wxAppConsole) -}; - -// ---------------------------------------------------------------------------- -// wxAppBase: the common part of wxApp implementations for all platforms -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxAppBase : public wxAppConsole -{ -public: - wxAppBase(); - virtual ~wxAppBase(); - - // the virtual functions which may/must be overridden in the derived class - // ----------------------------------------------------------------------- - - // very first initialization function - // - // Override: very rarely - virtual bool Initialize(int& argc, wxChar **argv); - - // a platform-dependent version of OnInit(): the code here is likely to - // depend on the toolkit. default version does nothing. - // - // Override: rarely. - virtual bool OnInitGui(); - - // called to start program execution - the default version just enters - // the main GUI loop in which events are received and processed until - // the last window is not deleted (if GetExitOnFrameDelete) or - // ExitMainLoop() is called. In console mode programs, the execution - // of the program really starts here - // - // Override: rarely in GUI applications, always in console ones. - virtual int OnRun(); - - // a matching function for OnInit() - virtual int OnExit(); - - // very last clean up function - // - // Override: very rarely - virtual void CleanUp(); - - - // the worker functions - usually not used directly by the user code - // ----------------------------------------------------------------- - - // return true if we're running main loop, i.e. if the events can - // (already) be dispatched - static bool IsMainLoopRunning() - { - wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance()); - return app && app->m_mainLoop != NULL; - } - - // execute the main GUI loop, the function returns when the loop ends - virtual int MainLoop(); - - // exit the main loop thus terminating the application - virtual void Exit(); - - // exit the main GUI loop during the next iteration (i.e. it does not - // stop the program immediately!) - virtual void ExitMainLoop(); - - // returns true if there are unprocessed events in the event queue - virtual bool Pending(); - - // process the first event in the event queue (blocks until an event - // appears if there are none currently, use Pending() if this is not - // wanted), returns false if the event loop should stop and true - // otherwise - virtual bool Dispatch(); - - // process all currently pending events right now - // - // it is an error to call Yield() recursively unless the value of - // onlyIfNeeded is true - // - // WARNING: this function is dangerous as it can lead to unexpected - // reentrancies (i.e. when called from an event handler it - // may result in calling the same event handler again), use - // with _extreme_ care or, better, don't use at all! - virtual bool Yield(bool onlyIfNeeded = false) = 0; - - // this virtual function is called in the GUI mode when the application - // becomes idle and normally just sends wxIdleEvent to all interested - // parties - // - // it should return true if more idle events are needed, false if not - virtual bool ProcessIdle(); - - // Send idle event to window and all subwindows - // Returns true if more idle time is requested. - virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event); - - -#if wxUSE_EXCEPTIONS - // Function called if an uncaught exception is caught inside the main - // event loop: it may return true to continue running the event loop or - // false to stop it (in the latter case it may rethrow the exception as - // well) - virtual bool OnExceptionInMainLoop(); -#endif // wxUSE_EXCEPTIONS - - - // top level window functions - // -------------------------- - - // return true if our app has focus - virtual bool IsActive() const { return m_isActive; } - - // set the "main" top level window - void SetTopWindow(wxWindow *win) { m_topWindow = win; } - - // return the "main" top level window (if it hadn't been set previously - // with SetTopWindow(), will return just some top level window and, if - // there are none, will return NULL) - virtual wxWindow *GetTopWindow() const; - - // control the exit behaviour: by default, the program will exit the - // main loop (and so, usually, terminate) when the last top-level - // program window is deleted. Beware that if you disable this behaviour - // (with SetExitOnFrameDelete(false)), you'll have to call - // ExitMainLoop() explicitly from somewhere. - void SetExitOnFrameDelete(bool flag) - { m_exitOnFrameDelete = flag ? Yes : No; } - bool GetExitOnFrameDelete() const - { return m_exitOnFrameDelete == Yes; } - - - // display mode, visual, printing mode, ... - // ------------------------------------------------------------------------ - - // Get display mode that is used use. This is only used in framebuffer - // wxWin ports (such as wxMGL or wxDFB). - virtual wxVideoMode GetDisplayMode() const; - // Set display mode to use. This is only used in framebuffer wxWin - // ports (such as wxMGL or wxDFB). This method should be called from - // wxApp::OnInitGui - virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; } - - // set use of best visual flag (see below) - void SetUseBestVisual( bool flag, bool forceTrueColour = false ) - { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; } - bool GetUseBestVisual() const { return m_useBestVisual; } - - // set/get printing mode: see wxPRINT_XXX constants. - // - // default behaviour is the normal one for Unix: always use PostScript - // printing. - virtual void SetPrintMode(int WXUNUSED(mode)) { } - int GetPrintMode() const { return wxPRINT_POSTSCRIPT; } - - // Return the layout direction for the current locale or wxLayout_Default - // if it's unknown - virtual wxLayoutDirection GetLayoutDirection() const; - - - // command line parsing (GUI-specific) - // ------------------------------------------------------------------------ - -#if wxUSE_CMDLINE_PARSER - virtual bool OnCmdLineParsed(wxCmdLineParser& parser); - virtual void OnInitCmdLine(wxCmdLineParser& parser); -#endif - - // miscellaneous other stuff - // ------------------------------------------------------------------------ - - // called by toolkit-specific code to set the app status: active (we have - // focus) or not and also the last window which had focus before we were - // deactivated - virtual void SetActive(bool isActive, wxWindow *lastFocus); - -#if WXWIN_COMPATIBILITY_2_6 - // OBSOLETE: don't use, always returns true - // - // returns true if the program is successfully initialized - wxDEPRECATED( bool Initialized() ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // perform standard OnIdle behaviour, ensure that this is always called - void OnIdle(wxIdleEvent& event); - - -protected: - // delete all objects in wxPendingDelete list - void DeletePendingObjects(); - - // override base class method to use GUI traits - virtual wxAppTraits *CreateTraits(); - - - // the main event loop of the application (may be NULL if the loop hasn't - // been started yet or has already terminated) - wxEventLoop *m_mainLoop; - - // the main top level window (may be NULL) - wxWindow *m_topWindow; - - // if Yes, exit the main loop when the last top level window is deleted, if - // No don't do it and if Later -- only do it once we reach our OnRun() - // - // the explanation for using this strange scheme is given in appcmn.cpp - enum - { - Later = -1, - No, - Yes - } m_exitOnFrameDelete; - - // true if the app wants to use the best visual on systems where - // more than one are available (Sun, SGI, XFree86 4.0 ?) - bool m_useBestVisual; - // force TrueColour just in case "best" isn't TrueColour - bool m_forceTrueColour; - - // does any of our windows have focus? - bool m_isActive; - - - DECLARE_NO_COPY_CLASS(wxAppBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxAppBase::Initialized() { return true; } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// now include the declaration of the real class -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - #if defined(__WXPALMOS__) - #include "wx/palmos/app.h" - #elif defined(__WXMSW__) - #include "wx/msw/app.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/app.h" - #elif defined(__WXMGL__) - #include "wx/mgl/app.h" - #elif defined(__WXDFB__) - #include "wx/dfb/app.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/app.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/app.h" - #elif defined(__WXX11__) - #include "wx/x11/app.h" - #elif defined(__WXMAC__) - #include "wx/mac/app.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/app.h" - #elif defined(__WXPM__) - #include "wx/os2/app.h" - #endif -#else // !GUI - // allow using just wxApp (instead of wxAppConsole) in console programs - typedef wxAppConsole wxApp; -#endif // GUI/!GUI - -// ---------------------------------------------------------------------------- -// the global data -// ---------------------------------------------------------------------------- - -// for compatibility, we define this macro to access the global application -// object of type wxApp -// -// note that instead of using of wxTheApp in application code you should -// consider using DECLARE_APP() after which you may call wxGetApp() which will -// return the object of the correct type (i.e. MyApp and not wxApp) -// -// the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in -// console mode it does nothing at all -#define wxTheApp wx_static_cast(wxApp*, wxApp::GetInstance()) - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// event loop related functions only work in GUI programs -// ------------------------------------------------------ - -// Force an exit from main loop -extern void WXDLLIMPEXP_BASE wxExit(); - -// avoid redeclaring this function here if it had been already declated by -// wx/utils.h, this results in warnings from g++ with -Wredundant-decls -#ifndef wx_YIELD_DECLARED -#define wx_YIELD_DECLARED - -// Yield to other apps/messages -extern bool WXDLLIMPEXP_BASE wxYield(); - -#endif // wx_YIELD_DECLARED - -// Yield to other apps/messages -extern void WXDLLIMPEXP_BASE wxWakeUpIdle(); - -// ---------------------------------------------------------------------------- -// macros for dynamic creation of the application object -// ---------------------------------------------------------------------------- - -// Having a global instance of this class allows wxApp to be aware of the app -// creator function. wxApp can then call this function to create a new app -// object. Convoluted, but necessary. - -class WXDLLIMPEXP_BASE wxAppInitializer -{ -public: - wxAppInitializer(wxAppInitializerFunction fn) - { wxApp::SetInitializerFunction(fn); } -}; - -// the code below defines a IMPLEMENT_WXWIN_MAIN macro which you can use if -// your compiler really, really wants main() to be in your main program (e.g. -// hello.cpp). Now IMPLEMENT_APP should add this code if required. - -#define IMPLEMENT_WXWIN_MAIN_CONSOLE \ - int main(int argc, char **argv) { return wxEntry(argc, argv); } - -// port-specific header could have defined it already in some special way -#ifndef IMPLEMENT_WXWIN_MAIN - #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE -#endif // defined(IMPLEMENT_WXWIN_MAIN) - -#ifdef __WXUNIVERSAL__ - #include "wx/univ/theme.h" - - #ifdef wxUNIV_DEFAULT_THEME - #define IMPLEMENT_WX_THEME_SUPPORT \ - WX_USE_THEME(wxUNIV_DEFAULT_THEME); - #else - #define IMPLEMENT_WX_THEME_SUPPORT - #endif -#else - #define IMPLEMENT_WX_THEME_SUPPORT -#endif - -// Use this macro if you want to define your own main() or WinMain() function -// and call wxEntry() from there. -#define IMPLEMENT_APP_NO_MAIN(appname) \ - wxAppConsole *wxCreateApp() \ - { \ - wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ - "your program"); \ - return new appname; \ - } \ - wxAppInitializer \ - wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ - DECLARE_APP(appname) \ - appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); } - -// Same as IMPLEMENT_APP() normally but doesn't include themes support in -// wxUniversal builds -#define IMPLEMENT_APP_NO_THEMES(appname) \ - IMPLEMENT_APP_NO_MAIN(appname) \ - IMPLEMENT_WXWIN_MAIN - -// Use this macro exactly once, the argument is the name of the wxApp-derived -// class which is the class of your application. -#define IMPLEMENT_APP(appname) \ - IMPLEMENT_APP_NO_THEMES(appname) \ - IMPLEMENT_WX_THEME_SUPPORT - -// Same as IMPLEMENT_APP(), but for console applications. -#define IMPLEMENT_APP_CONSOLE(appname) \ - IMPLEMENT_APP_NO_MAIN(appname) \ - IMPLEMENT_WXWIN_MAIN_CONSOLE - -// this macro can be used multiple times and just allows you to use wxGetApp() -// function -#define DECLARE_APP(appname) extern appname& wxGetApp(); - - -// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed -// anywhere else but at the very least it suppresses icc warnings about -// defining extern symbols without prior declaration, and it shouldn't do any -// harm -extern wxAppConsole *wxCreateApp(); -extern wxAppInitializer wxTheAppInitializer; - -#endif // _WX_APP_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/app.h +// Purpose: wxAppBase class and macros used for declaration of wxApp +// derived class in the user code +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: app.h 51592 2008-02-08 08:17:41Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_BASE_ +#define _WX_APP_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers we have to include here +// ---------------------------------------------------------------------------- + +#include "wx/event.h" // for the base class +#include "wx/build.h" +#include "wx/init.h" // we must declare wxEntry() +#include "wx/intl.h" // for wxLayoutDirection + +class WXDLLIMPEXP_FWD_BASE wxAppConsole; +class WXDLLIMPEXP_FWD_BASE wxAppTraits; +class WXDLLIMPEXP_FWD_BASE wxCmdLineParser; +class WXDLLIMPEXP_FWD_BASE wxLog; +class WXDLLIMPEXP_FWD_BASE wxMessageOutput; + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_BASE wxEventLoop; + struct WXDLLIMPEXP_FWD_CORE wxVideoMode; +#endif + +// ---------------------------------------------------------------------------- +// typedefs +// ---------------------------------------------------------------------------- + +// the type of the function used to create a wxApp object on program start up +typedef wxAppConsole* (*wxAppInitializerFunction)(); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum +{ + wxPRINT_WINDOWS = 1, + wxPRINT_POSTSCRIPT = 2 +}; + +// ---------------------------------------------------------------------------- +// wxAppConsole: wxApp for non-GUI applications +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler +{ +public: + // ctor and dtor + wxAppConsole(); + virtual ~wxAppConsole(); + + + // the virtual functions which may/must be overridden in the derived class + // ----------------------------------------------------------------------- + + // This is the very first function called for a newly created wxApp object, + // it is used by the library to do the global initialization. If, for some + // reason, you must override it (instead of just overriding OnInit(), as + // usual, for app-specific initializations), do not forget to call the base + // class version! + virtual bool Initialize(int& argc, wxChar **argv); + + // This gives wxCocoa a chance to call OnInit() with a memory pool in place + virtual bool CallOnInit() { return OnInit(); } + + // Called before OnRun(), this is a good place to do initialization -- if + // anything fails, return false from here to prevent the program from + // continuing. The command line is normally parsed here, call the base + // class OnInit() to do it. + virtual bool OnInit(); + + // this is here only temporary hopefully (FIXME) + virtual bool OnInitGui() { return true; } + + // This is the replacement for the normal main(): all program work should + // be done here. When OnRun() returns, the programs starts shutting down. + virtual int OnRun() = 0; + + // This is only called if OnInit() returned true so it's a good place to do + // any cleanup matching the initializations done there. + virtual int OnExit(); + + // This is the very last function called on wxApp object before it is + // destroyed. If you override it (instead of overriding OnExit() as usual) + // do not forget to call the base class version! + virtual void CleanUp(); + + // Called when a fatal exception occurs, this function should take care not + // to do anything which might provoke a nested exception! It may be + // overridden if you wish to react somehow in non-default way (core dump + // under Unix, application crash under Windows) to fatal program errors, + // however extreme care should be taken if you don't want this function to + // crash. + virtual void OnFatalException() { } + + // Called from wxExit() function, should terminate the application a.s.a.p. + virtual void Exit(); + + + // application info: name, description, vendor + // ------------------------------------------- + + // NB: all these should be set by the application itself, there are no + // reasonable default except for the application name which is taken to + // be argv[0] + + // set/get the application name + wxString GetAppName() const + { + return m_appName.empty() ? m_className : m_appName; + } + void SetAppName(const wxString& name) { m_appName = name; } + + // set/get the app class name + wxString GetClassName() const { return m_className; } + void SetClassName(const wxString& name) { m_className = name; } + + // set/get the vendor name + const wxString& GetVendorName() const { return m_vendorName; } + void SetVendorName(const wxString& name) { m_vendorName = name; } + + + // cmd line parsing stuff + // ---------------------- + + // all of these methods may be overridden in the derived class to + // customize the command line parsing (by default only a few standard + // options are handled) + // + // you also need to call wxApp::OnInit() from YourApp::OnInit() for all + // this to work + +#if wxUSE_CMDLINE_PARSER + // this one is called from OnInit() to add all supported options + // to the given parser (don't forget to call the base class version if you + // override it!) + virtual void OnInitCmdLine(wxCmdLineParser& parser); + + // called after successfully parsing the command line, return true + // to continue and false to exit (don't forget to call the base class + // version if you override it!) + virtual bool OnCmdLineParsed(wxCmdLineParser& parser); + + // called if "--help" option was specified, return true to continue + // and false to exit + virtual bool OnCmdLineHelp(wxCmdLineParser& parser); + + // called if incorrect command line options were given, return + // false to abort and true to continue + virtual bool OnCmdLineError(wxCmdLineParser& parser); +#endif // wxUSE_CMDLINE_PARSER + + + // miscellaneous customization functions + // ------------------------------------- + + // create the app traits object to which we delegate for everything which + // either should be configurable by the user (then he can change the + // default behaviour simply by overriding CreateTraits() and returning his + // own traits object) or which is GUI/console dependent as then wxAppTraits + // allows us to abstract the differences behind the common façade + wxAppTraits *GetTraits(); + + // the functions below shouldn't be used now that we have wxAppTraits +#if WXWIN_COMPATIBILITY_2_4 + +#if wxUSE_LOG + // override this function to create default log target of arbitrary + // user-defined class (default implementation creates a wxLogGui + // object) -- this log object is used by default by all wxLogXXX() + // functions. + wxDEPRECATED( virtual wxLog *CreateLogTarget() ); +#endif // wxUSE_LOG + + // similar to CreateLogTarget() but for the global wxMessageOutput + // object + wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() ); + +#endif // WXWIN_COMPATIBILITY_2_4 + + + // event processing functions + // -------------------------- + + // this method allows to filter all the events processed by the program, so + // you should try to return quickly from it to avoid slowing down the + // program to the crawl + // + // return value should be -1 to continue with the normal event processing, + // or TRUE or FALSE to stop further processing and pretend that the event + // had been already processed or won't be processed at all, respectively + virtual int FilterEvent(wxEvent& event); + +#if wxUSE_EXCEPTIONS + // call the specified handler on the given object with the given event + // + // this method only exists to allow catching the exceptions thrown by any + // event handler, it would lead to an extra (useless) virtual function call + // if the exceptions were not used, so it doesn't even exist in that case + virtual void HandleEvent(wxEvtHandler *handler, + wxEventFunction func, + wxEvent& event) const; + + // Called when an unhandled C++ exception occurs inside OnRun(): note that + // the exception type is lost by now, so if you really want to handle the + // exception you should override OnRun() and put a try/catch around + // MainLoop() call there or use OnExceptionInMainLoop() + virtual void OnUnhandledException() { } +#endif // wxUSE_EXCEPTIONS + + // process all events in the wxPendingEvents list -- it is necessary to + // call this function to process posted events. This happens during each + // event loop iteration in GUI mode but if there is no main loop, it may be + // also called directly. + virtual void ProcessPendingEvents(); + + // doesn't do anything in this class, just a hook for GUI wxApp + virtual bool Yield(bool WXUNUSED(onlyIfNeeded) = false) { return true; } + + // make sure that idle events are sent again + virtual void WakeUpIdle() { } + + // this is just a convenience: by providing its implementation here we + // avoid #ifdefs in the code using it + static bool IsMainLoopRunning() { return false; } + + + // debugging support + // ----------------- + +#ifdef __WXDEBUG__ + // this function is called when an assert failure occurs, the base class + // version does the normal processing (i.e. shows the usual assert failure + // dialog box) + // + // the arguments are the location of the failed assert (func may be empty + // if the compiler doesn't support C99 __FUNCTION__), the text of the + // assert itself and the user-specified message + virtual void OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg); + + // old version of the function without func parameter, for compatibility + // only, override OnAssertFailure() in the new code + virtual void OnAssert(const wxChar *file, + int line, + const wxChar *cond, + const wxChar *msg); +#endif // __WXDEBUG__ + + // check that the wxBuildOptions object (constructed in the application + // itself, usually the one from IMPLEMENT_APP() macro) matches the build + // options of the library and abort if it doesn't + static bool CheckBuildOptions(const char *optionsSignature, + const char *componentName); +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) ); +#endif + + // implementation only from now on + // ------------------------------- + + // helpers for dynamic wxApp construction + static void SetInitializerFunction(wxAppInitializerFunction fn) + { ms_appInitFn = fn; } + static wxAppInitializerFunction GetInitializerFunction() + { return ms_appInitFn; } + + // accessors for ms_appInstance field (external code might wish to modify + // it, this is why we provide a setter here as well, but you should really + // know what you're doing if you call it), wxTheApp is usually used instead + // of GetInstance() + static wxAppConsole *GetInstance() { return ms_appInstance; } + static void SetInstance(wxAppConsole *app) { ms_appInstance = app; } + + + // command line arguments (public for backwards compatibility) + int argc; + wxChar **argv; + +protected: + // the function which creates the traits object when GetTraits() needs it + // for the first time + virtual wxAppTraits *CreateTraits(); + + + // function used for dynamic wxApp creation + static wxAppInitializerFunction ms_appInitFn; + + // the one and only global application object + static wxAppConsole *ms_appInstance; + + + // application info (must be set from the user code) + wxString m_vendorName, // vendor name (ACME Inc) + m_appName, // app name + m_className; // class name + + // the class defining the application behaviour, NULL initially and created + // by GetTraits() when first needed + wxAppTraits *m_traits; + + + // the application object is a singleton anyhow, there is no sense in + // copying it + DECLARE_NO_COPY_CLASS(wxAppConsole) +}; + +// ---------------------------------------------------------------------------- +// wxAppBase: the common part of wxApp implementations for all platforms +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxAppBase : public wxAppConsole +{ +public: + wxAppBase(); + virtual ~wxAppBase(); + + // the virtual functions which may/must be overridden in the derived class + // ----------------------------------------------------------------------- + + // very first initialization function + // + // Override: very rarely + virtual bool Initialize(int& argc, wxChar **argv); + + // a platform-dependent version of OnInit(): the code here is likely to + // depend on the toolkit. default version does nothing. + // + // Override: rarely. + virtual bool OnInitGui(); + + // called to start program execution - the default version just enters + // the main GUI loop in which events are received and processed until + // the last window is not deleted (if GetExitOnFrameDelete) or + // ExitMainLoop() is called. In console mode programs, the execution + // of the program really starts here + // + // Override: rarely in GUI applications, always in console ones. + virtual int OnRun(); + + // a matching function for OnInit() + virtual int OnExit(); + + // very last clean up function + // + // Override: very rarely + virtual void CleanUp(); + + + // the worker functions - usually not used directly by the user code + // ----------------------------------------------------------------- + + // return true if we're running main loop, i.e. if the events can + // (already) be dispatched + static bool IsMainLoopRunning() + { + wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance()); + return app && app->m_mainLoop != NULL; + } + + // execute the main GUI loop, the function returns when the loop ends + virtual int MainLoop(); + + // exit the main loop thus terminating the application + virtual void Exit(); + + // exit the main GUI loop during the next iteration (i.e. it does not + // stop the program immediately!) + virtual void ExitMainLoop(); + + // returns true if there are unprocessed events in the event queue + virtual bool Pending(); + + // process the first event in the event queue (blocks until an event + // appears if there are none currently, use Pending() if this is not + // wanted), returns false if the event loop should stop and true + // otherwise + virtual bool Dispatch(); + + // process all currently pending events right now + // + // it is an error to call Yield() recursively unless the value of + // onlyIfNeeded is true + // + // WARNING: this function is dangerous as it can lead to unexpected + // reentrancies (i.e. when called from an event handler it + // may result in calling the same event handler again), use + // with _extreme_ care or, better, don't use at all! + virtual bool Yield(bool onlyIfNeeded = false) = 0; + + // this virtual function is called in the GUI mode when the application + // becomes idle and normally just sends wxIdleEvent to all interested + // parties + // + // it should return true if more idle events are needed, false if not + virtual bool ProcessIdle(); + + // Send idle event to window and all subwindows + // Returns true if more idle time is requested. + virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event); + + +#if wxUSE_EXCEPTIONS + // Function called if an uncaught exception is caught inside the main + // event loop: it may return true to continue running the event loop or + // false to stop it (in the latter case it may rethrow the exception as + // well) + virtual bool OnExceptionInMainLoop(); +#endif // wxUSE_EXCEPTIONS + + + // top level window functions + // -------------------------- + + // return true if our app has focus + virtual bool IsActive() const { return m_isActive; } + + // set the "main" top level window + void SetTopWindow(wxWindow *win) { m_topWindow = win; } + + // return the "main" top level window (if it hadn't been set previously + // with SetTopWindow(), will return just some top level window and, if + // there are none, will return NULL) + virtual wxWindow *GetTopWindow() const; + + // control the exit behaviour: by default, the program will exit the + // main loop (and so, usually, terminate) when the last top-level + // program window is deleted. Beware that if you disable this behaviour + // (with SetExitOnFrameDelete(false)), you'll have to call + // ExitMainLoop() explicitly from somewhere. + void SetExitOnFrameDelete(bool flag) + { m_exitOnFrameDelete = flag ? Yes : No; } + bool GetExitOnFrameDelete() const + { return m_exitOnFrameDelete == Yes; } + + + // display mode, visual, printing mode, ... + // ------------------------------------------------------------------------ + + // Get display mode that is used use. This is only used in framebuffer + // wxWin ports (such as wxMGL or wxDFB). + virtual wxVideoMode GetDisplayMode() const; + // Set display mode to use. This is only used in framebuffer wxWin + // ports (such as wxMGL or wxDFB). This method should be called from + // wxApp::OnInitGui + virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; } + + // set use of best visual flag (see below) + void SetUseBestVisual( bool flag, bool forceTrueColour = false ) + { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; } + bool GetUseBestVisual() const { return m_useBestVisual; } + + // set/get printing mode: see wxPRINT_XXX constants. + // + // default behaviour is the normal one for Unix: always use PostScript + // printing. + virtual void SetPrintMode(int WXUNUSED(mode)) { } + int GetPrintMode() const { return wxPRINT_POSTSCRIPT; } + + // Return the layout direction for the current locale or wxLayout_Default + // if it's unknown + virtual wxLayoutDirection GetLayoutDirection() const; + + + // command line parsing (GUI-specific) + // ------------------------------------------------------------------------ + +#if wxUSE_CMDLINE_PARSER + virtual bool OnCmdLineParsed(wxCmdLineParser& parser); + virtual void OnInitCmdLine(wxCmdLineParser& parser); +#endif + + // miscellaneous other stuff + // ------------------------------------------------------------------------ + + // called by toolkit-specific code to set the app status: active (we have + // focus) or not and also the last window which had focus before we were + // deactivated + virtual void SetActive(bool isActive, wxWindow *lastFocus); + +#if WXWIN_COMPATIBILITY_2_6 + // OBSOLETE: don't use, always returns true + // + // returns true if the program is successfully initialized + wxDEPRECATED( bool Initialized() ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // perform standard OnIdle behaviour, ensure that this is always called + void OnIdle(wxIdleEvent& event); + + +protected: + // delete all objects in wxPendingDelete list + void DeletePendingObjects(); + + // override base class method to use GUI traits + virtual wxAppTraits *CreateTraits(); + + + // the main event loop of the application (may be NULL if the loop hasn't + // been started yet or has already terminated) + wxEventLoop *m_mainLoop; + + // the main top level window (may be NULL) + wxWindow *m_topWindow; + + // if Yes, exit the main loop when the last top level window is deleted, if + // No don't do it and if Later -- only do it once we reach our OnRun() + // + // the explanation for using this strange scheme is given in appcmn.cpp + enum + { + Later = -1, + No, + Yes + } m_exitOnFrameDelete; + + // true if the app wants to use the best visual on systems where + // more than one are available (Sun, SGI, XFree86 4.0 ?) + bool m_useBestVisual; + // force TrueColour just in case "best" isn't TrueColour + bool m_forceTrueColour; + + // does any of our windows have focus? + bool m_isActive; + + + DECLARE_NO_COPY_CLASS(wxAppBase) +}; + +#if WXWIN_COMPATIBILITY_2_6 + inline bool wxAppBase::Initialized() { return true; } +#endif // WXWIN_COMPATIBILITY_2_6 + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// now include the declaration of the real class +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + #if defined(__WXPALMOS__) + #include "wx/palmos/app.h" + #elif defined(__WXMSW__) + #include "wx/msw/app.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/app.h" + #elif defined(__WXMGL__) + #include "wx/mgl/app.h" + #elif defined(__WXDFB__) + #include "wx/dfb/app.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/app.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/app.h" + #elif defined(__WXX11__) + #include "wx/x11/app.h" + #elif defined(__WXMAC__) + #include "wx/mac/app.h" + #elif defined(__WXCOCOA__) + #include "wx/cocoa/app.h" + #elif defined(__WXPM__) + #include "wx/os2/app.h" + #endif +#else // !GUI + // allow using just wxApp (instead of wxAppConsole) in console programs + typedef wxAppConsole wxApp; +#endif // GUI/!GUI + +// ---------------------------------------------------------------------------- +// the global data +// ---------------------------------------------------------------------------- + +// for compatibility, we define this macro to access the global application +// object of type wxApp +// +// note that instead of using of wxTheApp in application code you should +// consider using DECLARE_APP() after which you may call wxGetApp() which will +// return the object of the correct type (i.e. MyApp and not wxApp) +// +// the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in +// console mode it does nothing at all +#define wxTheApp wx_static_cast(wxApp*, wxApp::GetInstance()) + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// event loop related functions only work in GUI programs +// ------------------------------------------------------ + +// Force an exit from main loop +extern void WXDLLIMPEXP_BASE wxExit(); + +// avoid redeclaring this function here if it had been already declated by +// wx/utils.h, this results in warnings from g++ with -Wredundant-decls +#ifndef wx_YIELD_DECLARED +#define wx_YIELD_DECLARED + +// Yield to other apps/messages +extern bool WXDLLIMPEXP_BASE wxYield(); + +#endif // wx_YIELD_DECLARED + +// Yield to other apps/messages +extern void WXDLLIMPEXP_BASE wxWakeUpIdle(); + +// ---------------------------------------------------------------------------- +// macros for dynamic creation of the application object +// ---------------------------------------------------------------------------- + +// Having a global instance of this class allows wxApp to be aware of the app +// creator function. wxApp can then call this function to create a new app +// object. Convoluted, but necessary. + +class WXDLLIMPEXP_BASE wxAppInitializer +{ +public: + wxAppInitializer(wxAppInitializerFunction fn) + { wxApp::SetInitializerFunction(fn); } +}; + +// the code below defines a IMPLEMENT_WXWIN_MAIN macro which you can use if +// your compiler really, really wants main() to be in your main program (e.g. +// hello.cpp). Now IMPLEMENT_APP should add this code if required. + +#define IMPLEMENT_WXWIN_MAIN_CONSOLE \ + int main(int argc, char **argv) { return wxEntry(argc, argv); } + +// port-specific header could have defined it already in some special way +#ifndef IMPLEMENT_WXWIN_MAIN + #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE +#endif // defined(IMPLEMENT_WXWIN_MAIN) + +#ifdef __WXUNIVERSAL__ + #include "wx/univ/theme.h" + + #ifdef wxUNIV_DEFAULT_THEME + #define IMPLEMENT_WX_THEME_SUPPORT \ + WX_USE_THEME(wxUNIV_DEFAULT_THEME); + #else + #define IMPLEMENT_WX_THEME_SUPPORT + #endif +#else + #define IMPLEMENT_WX_THEME_SUPPORT +#endif + +// Use this macro if you want to define your own main() or WinMain() function +// and call wxEntry() from there. +#define IMPLEMENT_APP_NO_MAIN(appname) \ + wxAppConsole *wxCreateApp() \ + { \ + wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ + "your program"); \ + return new appname; \ + } \ + wxAppInitializer \ + wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ + DECLARE_APP(appname) \ + appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); } + +// Same as IMPLEMENT_APP() normally but doesn't include themes support in +// wxUniversal builds +#define IMPLEMENT_APP_NO_THEMES(appname) \ + IMPLEMENT_APP_NO_MAIN(appname) \ + IMPLEMENT_WXWIN_MAIN + +// Use this macro exactly once, the argument is the name of the wxApp-derived +// class which is the class of your application. +#define IMPLEMENT_APP(appname) \ + IMPLEMENT_APP_NO_THEMES(appname) \ + IMPLEMENT_WX_THEME_SUPPORT + +// Same as IMPLEMENT_APP(), but for console applications. +#define IMPLEMENT_APP_CONSOLE(appname) \ + IMPLEMENT_APP_NO_MAIN(appname) \ + IMPLEMENT_WXWIN_MAIN_CONSOLE + +// this macro can be used multiple times and just allows you to use wxGetApp() +// function +#define DECLARE_APP(appname) extern appname& wxGetApp(); + + +// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed +// anywhere else but at the very least it suppresses icc warnings about +// defining extern symbols without prior declaration, and it shouldn't do any +// harm +extern wxAppConsole *wxCreateApp(); +extern wxAppInitializer wxTheAppInitializer; + +#endif // _WX_APP_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/apptrait.h b/Externals/wxWidgets/include/wx/apptrait.h index 56f36dfea7..3bb91f520a 100644 --- a/Externals/wxWidgets/include/wx/apptrait.h +++ b/Externals/wxWidgets/include/wx/apptrait.h @@ -1,272 +1,272 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/apptrait.h -// Purpose: declaration of wxAppTraits and derived classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.06.2003 -// RCS-ID: $Id: apptrait.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_APPTRAIT_H_ -#define _WX_APPTRAIT_H_ - -#include "wx/string.h" -#include "wx/platinfo.h" - -class WXDLLIMPEXP_FWD_BASE wxObject; -class WXDLLIMPEXP_FWD_BASE wxAppTraits; -#if wxUSE_FONTMAP - class WXDLLIMPEXP_FWD_CORE wxFontMapper; -#endif // wxUSE_FONTMAP -class WXDLLIMPEXP_FWD_BASE wxLog; -class WXDLLIMPEXP_FWD_BASE wxMessageOutput; -class WXDLLIMPEXP_FWD_CORE wxRendererNative; -class WXDLLIMPEXP_FWD_BASE wxString; - -class GSocketGUIFunctionsTable; - - -// ---------------------------------------------------------------------------- -// wxAppTraits: this class defines various configurable aspects of wxApp -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxStandardPathsBase; - -class WXDLLIMPEXP_BASE wxAppTraitsBase -{ -public: - // needed since this class declares virtual members - virtual ~wxAppTraitsBase() { } - - // hooks for creating the global objects, may be overridden by the user - // ------------------------------------------------------------------------ - -#if wxUSE_LOG - // create the default log target - virtual wxLog *CreateLogTarget() = 0; -#endif // wxUSE_LOG - - // create the global object used for printing out messages - virtual wxMessageOutput *CreateMessageOutput() = 0; - -#if wxUSE_FONTMAP - // create the global font mapper object used for encodings/charset mapping - virtual wxFontMapper *CreateFontMapper() = 0; -#endif // wxUSE_FONTMAP - - // get the renderer to use for drawing the generic controls (return value - // may be NULL in which case the default renderer for the current platform - // is used); this is used in GUI only and always returns NULL in console - // - // NB: returned pointer will be deleted by the caller - virtual wxRendererNative *CreateRenderer() = 0; - -#if wxUSE_STDPATHS - // wxStandardPaths object is normally the same for wxBase and wxGUI - // except in the case of wxMac and wxCocoa - virtual wxStandardPathsBase& GetStandardPaths(); -#endif // wxUSE_STDPATHS - - // functions abstracting differences between GUI and console modes - // ------------------------------------------------------------------------ - -#ifdef __WXDEBUG__ - // show the assert dialog with the specified message in GUI or just print - // the string to stderr in console mode - // - // base class version has an implementation (in spite of being pure - // virtual) in base/appbase.cpp which can be called as last resort. - // - // return true to suppress subsequent asserts, false to continue as before - virtual bool ShowAssertDialog(const wxString& msg) = 0; -#endif // __WXDEBUG__ - - // return true if fprintf(stderr) goes somewhere, false otherwise - virtual bool HasStderr() = 0; - - // managing "pending delete" list: in GUI mode we can't immediately delete - // some objects because there may be unprocessed events for them and so we - // only do it during the next idle loop iteration while this is, of course, - // unnecessary in wxBase, so we have a few functions to abstract these - // operations - - // add the object to the pending delete list in GUI, delete it immediately - // in wxBase - virtual void ScheduleForDestroy(wxObject *object) = 0; - - // remove this object from the pending delete list in GUI, do nothing in - // wxBase - virtual void RemoveFromPendingDelete(wxObject *object) = 0; - -#if wxUSE_SOCKETS - // return table of GUI callbacks for GSocket code or NULL in wxBase. This - // is needed because networking classes are in their own library and so - // they can't directly call GUI functions (the same net library can be - // used in both GUI and base apps). To complicate it further, GUI library - // ("wxCore") doesn't depend on networking library and so only a functions - // table can be passed around - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0; -#endif - - // return information about the (native) toolkit currently used and its - // runtime (not compile-time) version. - // returns wxPORT_BASE for console applications and one of the remaining - // wxPORT_* values for GUI applications. - virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const = 0; - - // return true if the port is using wxUniversal for the GUI, false if not - virtual bool IsUsingUniversalWidgets() const = 0; - - // return the name of the Desktop Environment such as - // "KDE" or "GNOME". May return an empty string. - virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } - -protected: -#if wxUSE_STACKWALKER && defined( __WXDEBUG__ ) - // utility function: returns the stack frame as a plain wxString - virtual wxString GetAssertStackTrace(); -#endif -}; - -// ---------------------------------------------------------------------------- -// include the platform-specific version of the class -// ---------------------------------------------------------------------------- - -// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the -// Unix code (and otherwise __UNIX__ wouldn't be defined) -// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WXPALMOS__) - #include "wx/palmos/apptbase.h" -#elif defined(__WIN32__) - #include "wx/msw/apptbase.h" -#elif defined(__UNIX__) && !defined(__EMX__) - #include "wx/unix/apptbase.h" -#elif defined(__WXMAC__) - #include "wx/mac/apptbase.h" -#elif defined(__OS2__) - #include "wx/os2/apptbase.h" -#else // no platform-specific methods to add to wxAppTraits - // wxAppTraits must be a class because it was forward declared as class - class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase - { - }; -#endif // platform - -// ============================================================================ -// standard traits for console and GUI applications -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits -{ -public: -#if wxUSE_LOG - virtual wxLog *CreateLogTarget(); -#endif // wxUSE_LOG - virtual wxMessageOutput *CreateMessageOutput(); -#if wxUSE_FONTMAP - virtual wxFontMapper *CreateFontMapper(); -#endif // wxUSE_FONTMAP - virtual wxRendererNative *CreateRenderer(); -#if wxUSE_SOCKETS - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); -#endif - -#ifdef __WXDEBUG__ - virtual bool ShowAssertDialog(const wxString& msg); -#endif // __WXDEBUG__ - virtual bool HasStderr(); - - virtual void ScheduleForDestroy(wxObject *object); - virtual void RemoveFromPendingDelete(wxObject *object); - - // the GetToolkitVersion for console application is always the same - virtual wxPortId GetToolkitVersion(int *verMaj, int *verMin) const - { - // no toolkits (wxBase is for console applications without GUI support) - // NB: zero means "no toolkit", -1 means "not initialized yet" - // so we must use zero here! - if (verMaj) *verMaj = 0; - if (verMin) *verMin = 0; - return wxPORT_BASE; - } - - virtual bool IsUsingUniversalWidgets() const { return false; } -}; - -// ---------------------------------------------------------------------------- -// wxGUIAppTraitsBase: wxAppTraits implementation for the GUI apps -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLEXPORT wxGUIAppTraitsBase : public wxAppTraits -{ -public: -#if wxUSE_LOG - virtual wxLog *CreateLogTarget(); -#endif // wxUSE_LOG - virtual wxMessageOutput *CreateMessageOutput(); -#if wxUSE_FONTMAP - virtual wxFontMapper *CreateFontMapper(); -#endif // wxUSE_FONTMAP - virtual wxRendererNative *CreateRenderer(); -#if wxUSE_SOCKETS - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); -#endif - -#ifdef __WXDEBUG__ - virtual bool ShowAssertDialog(const wxString& msg); -#endif // __WXDEBUG__ - virtual bool HasStderr(); - - virtual void ScheduleForDestroy(wxObject *object); - virtual void RemoveFromPendingDelete(wxObject *object); - - virtual bool IsUsingUniversalWidgets() const - { - #ifdef __WXUNIVERSAL__ - return true; - #else - return false; - #endif - } -}; - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// include the platform-specific version of the classes above -// ---------------------------------------------------------------------------- - -// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port -#if defined(__WXPALMOS__) - #include "wx/palmos/apptrait.h" -#elif defined(__WIN32__) - #include "wx/msw/apptrait.h" -#elif defined(__OS2__) - #include "wx/os2/apptrait.h" -#elif defined(__UNIX__) - #include "wx/unix/apptrait.h" -#elif defined(__WXMAC__) - #include "wx/mac/apptrait.h" -#elif defined(__DOS__) - #include "wx/msdos/apptrait.h" -#else - #if wxUSE_GUI - class wxGUIAppTraits : public wxGUIAppTraitsBase - { - }; - #endif // wxUSE_GUI - class wxConsoleAppTraits: public wxConsoleAppTraitsBase - { - }; -#endif // platform - -#endif // _WX_APPTRAIT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/apptrait.h +// Purpose: declaration of wxAppTraits and derived classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.06.2003 +// RCS-ID: $Id: apptrait.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APPTRAIT_H_ +#define _WX_APPTRAIT_H_ + +#include "wx/string.h" +#include "wx/platinfo.h" + +class WXDLLIMPEXP_FWD_BASE wxObject; +class WXDLLIMPEXP_FWD_BASE wxAppTraits; +#if wxUSE_FONTMAP + class WXDLLIMPEXP_FWD_CORE wxFontMapper; +#endif // wxUSE_FONTMAP +class WXDLLIMPEXP_FWD_BASE wxLog; +class WXDLLIMPEXP_FWD_BASE wxMessageOutput; +class WXDLLIMPEXP_FWD_CORE wxRendererNative; +class WXDLLIMPEXP_FWD_BASE wxString; + +class GSocketGUIFunctionsTable; + + +// ---------------------------------------------------------------------------- +// wxAppTraits: this class defines various configurable aspects of wxApp +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxStandardPathsBase; + +class WXDLLIMPEXP_BASE wxAppTraitsBase +{ +public: + // needed since this class declares virtual members + virtual ~wxAppTraitsBase() { } + + // hooks for creating the global objects, may be overridden by the user + // ------------------------------------------------------------------------ + +#if wxUSE_LOG + // create the default log target + virtual wxLog *CreateLogTarget() = 0; +#endif // wxUSE_LOG + + // create the global object used for printing out messages + virtual wxMessageOutput *CreateMessageOutput() = 0; + +#if wxUSE_FONTMAP + // create the global font mapper object used for encodings/charset mapping + virtual wxFontMapper *CreateFontMapper() = 0; +#endif // wxUSE_FONTMAP + + // get the renderer to use for drawing the generic controls (return value + // may be NULL in which case the default renderer for the current platform + // is used); this is used in GUI only and always returns NULL in console + // + // NB: returned pointer will be deleted by the caller + virtual wxRendererNative *CreateRenderer() = 0; + +#if wxUSE_STDPATHS + // wxStandardPaths object is normally the same for wxBase and wxGUI + // except in the case of wxMac and wxCocoa + virtual wxStandardPathsBase& GetStandardPaths(); +#endif // wxUSE_STDPATHS + + // functions abstracting differences between GUI and console modes + // ------------------------------------------------------------------------ + +#ifdef __WXDEBUG__ + // show the assert dialog with the specified message in GUI or just print + // the string to stderr in console mode + // + // base class version has an implementation (in spite of being pure + // virtual) in base/appbase.cpp which can be called as last resort. + // + // return true to suppress subsequent asserts, false to continue as before + virtual bool ShowAssertDialog(const wxString& msg) = 0; +#endif // __WXDEBUG__ + + // return true if fprintf(stderr) goes somewhere, false otherwise + virtual bool HasStderr() = 0; + + // managing "pending delete" list: in GUI mode we can't immediately delete + // some objects because there may be unprocessed events for them and so we + // only do it during the next idle loop iteration while this is, of course, + // unnecessary in wxBase, so we have a few functions to abstract these + // operations + + // add the object to the pending delete list in GUI, delete it immediately + // in wxBase + virtual void ScheduleForDestroy(wxObject *object) = 0; + + // remove this object from the pending delete list in GUI, do nothing in + // wxBase + virtual void RemoveFromPendingDelete(wxObject *object) = 0; + +#if wxUSE_SOCKETS + // return table of GUI callbacks for GSocket code or NULL in wxBase. This + // is needed because networking classes are in their own library and so + // they can't directly call GUI functions (the same net library can be + // used in both GUI and base apps). To complicate it further, GUI library + // ("wxCore") doesn't depend on networking library and so only a functions + // table can be passed around + virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0; +#endif + + // return information about the (native) toolkit currently used and its + // runtime (not compile-time) version. + // returns wxPORT_BASE for console applications and one of the remaining + // wxPORT_* values for GUI applications. + virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const = 0; + + // return true if the port is using wxUniversal for the GUI, false if not + virtual bool IsUsingUniversalWidgets() const = 0; + + // return the name of the Desktop Environment such as + // "KDE" or "GNOME". May return an empty string. + virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } + +protected: +#if wxUSE_STACKWALKER && defined( __WXDEBUG__ ) + // utility function: returns the stack frame as a plain wxString + virtual wxString GetAssertStackTrace(); +#endif +}; + +// ---------------------------------------------------------------------------- +// include the platform-specific version of the class +// ---------------------------------------------------------------------------- + +// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the +// Unix code (and otherwise __UNIX__ wouldn't be defined) +// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port +#if defined(__WXPALMOS__) + #include "wx/palmos/apptbase.h" +#elif defined(__WIN32__) + #include "wx/msw/apptbase.h" +#elif defined(__UNIX__) && !defined(__EMX__) + #include "wx/unix/apptbase.h" +#elif defined(__WXMAC__) + #include "wx/mac/apptbase.h" +#elif defined(__OS2__) + #include "wx/os2/apptbase.h" +#else // no platform-specific methods to add to wxAppTraits + // wxAppTraits must be a class because it was forward declared as class + class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase + { + }; +#endif // platform + +// ============================================================================ +// standard traits for console and GUI applications +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits +{ +public: +#if wxUSE_LOG + virtual wxLog *CreateLogTarget(); +#endif // wxUSE_LOG + virtual wxMessageOutput *CreateMessageOutput(); +#if wxUSE_FONTMAP + virtual wxFontMapper *CreateFontMapper(); +#endif // wxUSE_FONTMAP + virtual wxRendererNative *CreateRenderer(); +#if wxUSE_SOCKETS + virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); +#endif + +#ifdef __WXDEBUG__ + virtual bool ShowAssertDialog(const wxString& msg); +#endif // __WXDEBUG__ + virtual bool HasStderr(); + + virtual void ScheduleForDestroy(wxObject *object); + virtual void RemoveFromPendingDelete(wxObject *object); + + // the GetToolkitVersion for console application is always the same + virtual wxPortId GetToolkitVersion(int *verMaj, int *verMin) const + { + // no toolkits (wxBase is for console applications without GUI support) + // NB: zero means "no toolkit", -1 means "not initialized yet" + // so we must use zero here! + if (verMaj) *verMaj = 0; + if (verMin) *verMin = 0; + return wxPORT_BASE; + } + + virtual bool IsUsingUniversalWidgets() const { return false; } +}; + +// ---------------------------------------------------------------------------- +// wxGUIAppTraitsBase: wxAppTraits implementation for the GUI apps +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLEXPORT wxGUIAppTraitsBase : public wxAppTraits +{ +public: +#if wxUSE_LOG + virtual wxLog *CreateLogTarget(); +#endif // wxUSE_LOG + virtual wxMessageOutput *CreateMessageOutput(); +#if wxUSE_FONTMAP + virtual wxFontMapper *CreateFontMapper(); +#endif // wxUSE_FONTMAP + virtual wxRendererNative *CreateRenderer(); +#if wxUSE_SOCKETS + virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); +#endif + +#ifdef __WXDEBUG__ + virtual bool ShowAssertDialog(const wxString& msg); +#endif // __WXDEBUG__ + virtual bool HasStderr(); + + virtual void ScheduleForDestroy(wxObject *object); + virtual void RemoveFromPendingDelete(wxObject *object); + + virtual bool IsUsingUniversalWidgets() const + { + #ifdef __WXUNIVERSAL__ + return true; + #else + return false; + #endif + } +}; + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// include the platform-specific version of the classes above +// ---------------------------------------------------------------------------- + +// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port +#if defined(__WXPALMOS__) + #include "wx/palmos/apptrait.h" +#elif defined(__WIN32__) + #include "wx/msw/apptrait.h" +#elif defined(__OS2__) + #include "wx/os2/apptrait.h" +#elif defined(__UNIX__) + #include "wx/unix/apptrait.h" +#elif defined(__WXMAC__) + #include "wx/mac/apptrait.h" +#elif defined(__DOS__) + #include "wx/msdos/apptrait.h" +#else + #if wxUSE_GUI + class wxGUIAppTraits : public wxGUIAppTraitsBase + { + }; + #endif // wxUSE_GUI + class wxConsoleAppTraits: public wxConsoleAppTraitsBase + { + }; +#endif // platform + +#endif // _WX_APPTRAIT_H_ + diff --git a/Externals/wxWidgets/include/wx/archive.h b/Externals/wxWidgets/include/wx/archive.h index dbf26c25c5..43b9ec0256 100644 --- a/Externals/wxWidgets/include/wx/archive.h +++ b/Externals/wxWidgets/include/wx/archive.h @@ -1,381 +1,381 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/archive.h -// Purpose: Streams for archive formats -// Author: Mike Wetherell -// RCS-ID: $Id: archive.h 43445 2006-11-16 14:30:20Z MW $ -// Copyright: (c) 2004 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ARCHIVE_H__ -#define _WX_ARCHIVE_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS - -#include "wx/stream.h" -#include "wx/filename.h" - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveNotifier - -class WXDLLIMPEXP_BASE wxArchiveNotifier -{ -public: - virtual ~wxArchiveNotifier() { } - - virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0; -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveEntry -// -// Holds an entry's meta data, such as filename and timestamp. - -class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject -{ -public: - virtual ~wxArchiveEntry() { } - - virtual wxDateTime GetDateTime() const = 0; - virtual wxFileOffset GetSize() const = 0; - virtual wxFileOffset GetOffset() const = 0; - virtual bool IsDir() const = 0; - virtual bool IsReadOnly() const = 0; - virtual wxString GetInternalName() const = 0; - virtual wxPathFormat GetInternalFormat() const = 0; - virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0; - - virtual void SetDateTime(const wxDateTime& dt) = 0; - virtual void SetSize(wxFileOffset size) = 0; - virtual void SetIsDir(bool isDir = true) = 0; - virtual void SetIsReadOnly(bool isReadOnly = true) = 0; - virtual void SetName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) = 0; - - wxArchiveEntry *Clone() const { return DoClone(); } - - void SetNotifier(wxArchiveNotifier& notifier); - virtual void UnsetNotifier() { m_notifier = NULL; } - -protected: - wxArchiveEntry() : m_notifier(NULL) { } - wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { } - - virtual void SetOffset(wxFileOffset offset) = 0; - virtual wxArchiveEntry* DoClone() const = 0; - - wxArchiveNotifier *GetNotifier() const { return m_notifier; } - wxArchiveEntry& operator=(const wxArchiveEntry& entry); - -private: - wxArchiveNotifier *m_notifier; - - DECLARE_ABSTRACT_CLASS(wxArchiveEntry) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveInputStream -// -// GetNextEntry() returns an wxArchiveEntry object containing the meta-data -// for the next entry in the archive (and gives away ownership). Reading from -// the wxArchiveInputStream then returns the entry's data. Eof() becomes true -// after an attempt has been made to read past the end of the entry's data. -// -// When there are no more entries, GetNextEntry() returns NULL and sets Eof(). - -class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream -{ -public: - typedef wxArchiveEntry entry_type; - - virtual ~wxArchiveInputStream() { } - - virtual bool OpenEntry(wxArchiveEntry& entry) = 0; - virtual bool CloseEntry() = 0; - - wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); } - - virtual char Peek() { return wxInputStream::Peek(); } - -protected: - wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv); - wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv); - - virtual wxArchiveEntry *DoGetNextEntry() = 0; - - wxMBConv& GetConv() const { return m_conv; } - -private: - wxMBConv& m_conv; -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveOutputStream -// -// PutNextEntry is used to create a new entry in the output archive, then -// the entry's data is written to the wxArchiveOutputStream. -// -// Only one entry can be open for output at a time; another call to -// PutNextEntry closes the current entry and begins the next. -// -// The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership -// of the entry object. - -class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream -{ -public: - virtual ~wxArchiveOutputStream() { } - - virtual bool PutNextEntry(wxArchiveEntry *entry) = 0; - - virtual bool PutNextEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset) = 0; - - virtual bool PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()) = 0; - - virtual bool CopyEntry(wxArchiveEntry *entry, - wxArchiveInputStream& stream) = 0; - - virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0; - - virtual bool CloseEntry() = 0; - -protected: - wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv); - wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv); - - wxMBConv& GetConv() const { return m_conv; } - -private: - wxMBConv& m_conv; -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveIterator -// -// An input iterator that can be used to transfer an archive's catalog to -// a container. - -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR -#include -#include - -template inline -void _wxSetArchiveIteratorValue( - X& val, Y entry, void *WXUNUSED(d)) -{ - val = X(entry); -} -template inline -void _wxSetArchiveIteratorValue( - std::pair& val, Z entry, Z WXUNUSED(d)) -{ - val = std::make_pair(X(entry->GetInternalName()), Y(entry)); -} - -#if defined _MSC_VER && _MSC_VER < 1300 -template -#else -template -#endif -class wxArchiveIterator -{ -public: - typedef std::input_iterator_tag iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; - - wxArchiveIterator() : m_rep(NULL) { } - - wxArchiveIterator(Arc& arc) { - typename Arc::entry_type* entry = arc.GetNextEntry(); - m_rep = entry ? new Rep(arc, entry) : NULL; - } - - wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) { - if (m_rep) - m_rep->AddRef(); - } - - ~wxArchiveIterator() { - if (m_rep) - m_rep->UnRef(); - } - - const T& operator *() const { - return m_rep->GetValue(); - } - - const T* operator ->() const { - return &**this; - } - - wxArchiveIterator& operator =(const wxArchiveIterator& it) { - if (it.m_rep) - it.m_rep.AddRef(); - if (m_rep) - m_rep.UnRef(); - m_rep = it.m_rep; - return *this; - } - - wxArchiveIterator& operator ++() { - m_rep = m_rep->Next(); - return *this; - } - - wxArchiveIterator operator ++(int) { - wxArchiveIterator it(*this); - ++(*this); - return it; - } - - bool operator ==(const wxArchiveIterator& j) const { - return m_rep == j.m_rep; - } - - bool operator !=(const wxArchiveIterator& j) const { - return !(*this == j); - } - -private: - class Rep { - Arc& m_arc; - typename Arc::entry_type* m_entry; - T m_value; - int m_ref; - - public: - Rep(Arc& arc, typename Arc::entry_type* entry) - : m_arc(arc), m_entry(entry), m_value(), m_ref(1) { } - ~Rep() - { delete m_entry; } - - void AddRef() { - m_ref++; - } - - void UnRef() { - if (--m_ref == 0) - delete this; - } - - Rep *Next() { - typename Arc::entry_type* entry = m_arc.GetNextEntry(); - if (!entry) { - UnRef(); - return NULL; - } - if (m_ref > 1) { - m_ref--; - return new Rep(m_arc, entry); - } - delete m_entry; - m_entry = entry; - m_value = T(); - return this; - } - - const T& GetValue() { - if (m_entry) { - _wxSetArchiveIteratorValue(m_value, m_entry, m_entry); - m_entry = NULL; - } - return m_value; - } - } *m_rep; -}; - -typedef wxArchiveIterator wxArchiveIter; -typedef wxArchiveIterator > wxArchivePairIter; - -#endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - - -///////////////////////////////////////////////////////////////////////////// -// wxArchiveClassFactory -// -// A wxArchiveClassFactory instance for a particular archive type allows -// the creation of the other classes that may be needed. - -void WXDLLIMPEXP_BASE wxUseArchiveClasses(); - -class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase -{ -public: - typedef wxArchiveEntry entry_type; - typedef wxArchiveInputStream instream_type; - typedef wxArchiveOutputStream outstream_type; - typedef wxArchiveNotifier notifier_type; -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - typedef wxArchiveIter iter_type; - typedef wxArchivePairIter pairiter_type; -#endif - - virtual ~wxArchiveClassFactory() { } - - wxArchiveEntry *NewEntry() const - { return DoNewEntry(); } - wxArchiveInputStream *NewStream(wxInputStream& stream) const - { return DoNewStream(stream); } - wxArchiveOutputStream *NewStream(wxOutputStream& stream) const - { return DoNewStream(stream); } - wxArchiveInputStream *NewStream(wxInputStream *stream) const - { return DoNewStream(stream); } - wxArchiveOutputStream *NewStream(wxOutputStream *stream) const - { return DoNewStream(stream); } - - virtual wxString GetInternalName( - const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const = 0; - - void SetConv(wxMBConv& conv) { m_pConv = &conv; } - wxMBConv& GetConv() const - { if (m_pConv) return *m_pConv; else return wxConvLocal; } - - static const wxArchiveClassFactory *Find(const wxChar *protocol, - wxStreamProtocolType type - = wxSTREAM_PROTOCOL); - - static const wxArchiveClassFactory *GetFirst(); - const wxArchiveClassFactory *GetNext() const { return m_next; } - - void PushFront() { Remove(); m_next = sm_first; sm_first = this; } - void Remove(); - -protected: - // old compilers don't support covarient returns, so 'Do' methods are - // used to simulate them - virtual wxArchiveEntry *DoNewEntry() const = 0; - virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0; - virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0; - virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0; - virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0; - - wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { } - wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f)) - { return *this; } - -private: - wxMBConv *m_pConv; - static wxArchiveClassFactory *sm_first; - wxArchiveClassFactory *m_next; - - DECLARE_ABSTRACT_CLASS(wxArchiveClassFactory) -}; - -#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS - -#endif // _WX_ARCHIVE_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/archive.h +// Purpose: Streams for archive formats +// Author: Mike Wetherell +// RCS-ID: $Id: archive.h 43445 2006-11-16 14:30:20Z MW $ +// Copyright: (c) 2004 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ARCHIVE_H__ +#define _WX_ARCHIVE_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS + +#include "wx/stream.h" +#include "wx/filename.h" + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveNotifier + +class WXDLLIMPEXP_BASE wxArchiveNotifier +{ +public: + virtual ~wxArchiveNotifier() { } + + virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0; +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveEntry +// +// Holds an entry's meta data, such as filename and timestamp. + +class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject +{ +public: + virtual ~wxArchiveEntry() { } + + virtual wxDateTime GetDateTime() const = 0; + virtual wxFileOffset GetSize() const = 0; + virtual wxFileOffset GetOffset() const = 0; + virtual bool IsDir() const = 0; + virtual bool IsReadOnly() const = 0; + virtual wxString GetInternalName() const = 0; + virtual wxPathFormat GetInternalFormat() const = 0; + virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0; + + virtual void SetDateTime(const wxDateTime& dt) = 0; + virtual void SetSize(wxFileOffset size) = 0; + virtual void SetIsDir(bool isDir = true) = 0; + virtual void SetIsReadOnly(bool isReadOnly = true) = 0; + virtual void SetName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) = 0; + + wxArchiveEntry *Clone() const { return DoClone(); } + + void SetNotifier(wxArchiveNotifier& notifier); + virtual void UnsetNotifier() { m_notifier = NULL; } + +protected: + wxArchiveEntry() : m_notifier(NULL) { } + wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { } + + virtual void SetOffset(wxFileOffset offset) = 0; + virtual wxArchiveEntry* DoClone() const = 0; + + wxArchiveNotifier *GetNotifier() const { return m_notifier; } + wxArchiveEntry& operator=(const wxArchiveEntry& entry); + +private: + wxArchiveNotifier *m_notifier; + + DECLARE_ABSTRACT_CLASS(wxArchiveEntry) +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveInputStream +// +// GetNextEntry() returns an wxArchiveEntry object containing the meta-data +// for the next entry in the archive (and gives away ownership). Reading from +// the wxArchiveInputStream then returns the entry's data. Eof() becomes true +// after an attempt has been made to read past the end of the entry's data. +// +// When there are no more entries, GetNextEntry() returns NULL and sets Eof(). + +class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream +{ +public: + typedef wxArchiveEntry entry_type; + + virtual ~wxArchiveInputStream() { } + + virtual bool OpenEntry(wxArchiveEntry& entry) = 0; + virtual bool CloseEntry() = 0; + + wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); } + + virtual char Peek() { return wxInputStream::Peek(); } + +protected: + wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv); + wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv); + + virtual wxArchiveEntry *DoGetNextEntry() = 0; + + wxMBConv& GetConv() const { return m_conv; } + +private: + wxMBConv& m_conv; +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveOutputStream +// +// PutNextEntry is used to create a new entry in the output archive, then +// the entry's data is written to the wxArchiveOutputStream. +// +// Only one entry can be open for output at a time; another call to +// PutNextEntry closes the current entry and begins the next. +// +// The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership +// of the entry object. + +class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream +{ +public: + virtual ~wxArchiveOutputStream() { } + + virtual bool PutNextEntry(wxArchiveEntry *entry) = 0; + + virtual bool PutNextEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset) = 0; + + virtual bool PutNextDirEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now()) = 0; + + virtual bool CopyEntry(wxArchiveEntry *entry, + wxArchiveInputStream& stream) = 0; + + virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0; + + virtual bool CloseEntry() = 0; + +protected: + wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv); + wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv); + + wxMBConv& GetConv() const { return m_conv; } + +private: + wxMBConv& m_conv; +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveIterator +// +// An input iterator that can be used to transfer an archive's catalog to +// a container. + +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR +#include +#include + +template inline +void _wxSetArchiveIteratorValue( + X& val, Y entry, void *WXUNUSED(d)) +{ + val = X(entry); +} +template inline +void _wxSetArchiveIteratorValue( + std::pair& val, Z entry, Z WXUNUSED(d)) +{ + val = std::make_pair(X(entry->GetInternalName()), Y(entry)); +} + +#if defined _MSC_VER && _MSC_VER < 1300 +template +#else +template +#endif +class wxArchiveIterator +{ +public: + typedef std::input_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + + wxArchiveIterator() : m_rep(NULL) { } + + wxArchiveIterator(Arc& arc) { + typename Arc::entry_type* entry = arc.GetNextEntry(); + m_rep = entry ? new Rep(arc, entry) : NULL; + } + + wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) { + if (m_rep) + m_rep->AddRef(); + } + + ~wxArchiveIterator() { + if (m_rep) + m_rep->UnRef(); + } + + const T& operator *() const { + return m_rep->GetValue(); + } + + const T* operator ->() const { + return &**this; + } + + wxArchiveIterator& operator =(const wxArchiveIterator& it) { + if (it.m_rep) + it.m_rep.AddRef(); + if (m_rep) + m_rep.UnRef(); + m_rep = it.m_rep; + return *this; + } + + wxArchiveIterator& operator ++() { + m_rep = m_rep->Next(); + return *this; + } + + wxArchiveIterator operator ++(int) { + wxArchiveIterator it(*this); + ++(*this); + return it; + } + + bool operator ==(const wxArchiveIterator& j) const { + return m_rep == j.m_rep; + } + + bool operator !=(const wxArchiveIterator& j) const { + return !(*this == j); + } + +private: + class Rep { + Arc& m_arc; + typename Arc::entry_type* m_entry; + T m_value; + int m_ref; + + public: + Rep(Arc& arc, typename Arc::entry_type* entry) + : m_arc(arc), m_entry(entry), m_value(), m_ref(1) { } + ~Rep() + { delete m_entry; } + + void AddRef() { + m_ref++; + } + + void UnRef() { + if (--m_ref == 0) + delete this; + } + + Rep *Next() { + typename Arc::entry_type* entry = m_arc.GetNextEntry(); + if (!entry) { + UnRef(); + return NULL; + } + if (m_ref > 1) { + m_ref--; + return new Rep(m_arc, entry); + } + delete m_entry; + m_entry = entry; + m_value = T(); + return this; + } + + const T& GetValue() { + if (m_entry) { + _wxSetArchiveIteratorValue(m_value, m_entry, m_entry); + m_entry = NULL; + } + return m_value; + } + } *m_rep; +}; + +typedef wxArchiveIterator wxArchiveIter; +typedef wxArchiveIterator > wxArchivePairIter; + +#endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveClassFactory +// +// A wxArchiveClassFactory instance for a particular archive type allows +// the creation of the other classes that may be needed. + +void WXDLLIMPEXP_BASE wxUseArchiveClasses(); + +class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase +{ +public: + typedef wxArchiveEntry entry_type; + typedef wxArchiveInputStream instream_type; + typedef wxArchiveOutputStream outstream_type; + typedef wxArchiveNotifier notifier_type; +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + typedef wxArchiveIter iter_type; + typedef wxArchivePairIter pairiter_type; +#endif + + virtual ~wxArchiveClassFactory() { } + + wxArchiveEntry *NewEntry() const + { return DoNewEntry(); } + wxArchiveInputStream *NewStream(wxInputStream& stream) const + { return DoNewStream(stream); } + wxArchiveOutputStream *NewStream(wxOutputStream& stream) const + { return DoNewStream(stream); } + wxArchiveInputStream *NewStream(wxInputStream *stream) const + { return DoNewStream(stream); } + wxArchiveOutputStream *NewStream(wxOutputStream *stream) const + { return DoNewStream(stream); } + + virtual wxString GetInternalName( + const wxString& name, + wxPathFormat format = wxPATH_NATIVE) const = 0; + + void SetConv(wxMBConv& conv) { m_pConv = &conv; } + wxMBConv& GetConv() const + { if (m_pConv) return *m_pConv; else return wxConvLocal; } + + static const wxArchiveClassFactory *Find(const wxChar *protocol, + wxStreamProtocolType type + = wxSTREAM_PROTOCOL); + + static const wxArchiveClassFactory *GetFirst(); + const wxArchiveClassFactory *GetNext() const { return m_next; } + + void PushFront() { Remove(); m_next = sm_first; sm_first = this; } + void Remove(); + +protected: + // old compilers don't support covarient returns, so 'Do' methods are + // used to simulate them + virtual wxArchiveEntry *DoNewEntry() const = 0; + virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0; + virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0; + virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0; + virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0; + + wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { } + wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f)) + { return *this; } + +private: + wxMBConv *m_pConv; + static wxArchiveClassFactory *sm_first; + wxArchiveClassFactory *m_next; + + DECLARE_ABSTRACT_CLASS(wxArchiveClassFactory) +}; + +#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS + +#endif // _WX_ARCHIVE_H__ diff --git a/Externals/wxWidgets/include/wx/arrstr.h b/Externals/wxWidgets/include/wx/arrstr.h index d2dd4770ae..0229f1817d 100644 --- a/Externals/wxWidgets/include/wx/arrstr.h +++ b/Externals/wxWidgets/include/wx/arrstr.h @@ -1,372 +1,372 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/arrstr.h -// Purpose: wxArrayString class -// Author: Mattia Barbon and Vadim Zeitlin -// Modified by: -// Created: 07/07/03 -// RCS-ID: $Id: arrstr.h 33888 2005-04-26 19:24:12Z MBN $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ARRSTR_H -#define _WX_ARRSTR_H - -#include "wx/defs.h" -#include "wx/string.h" - -WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortAscending(wxString*, wxString*); -WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortDescending(wxString*, wxString*); - -#if wxUSE_STL - -#include "wx/dynarray.h" - -typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*); -typedef wxString _wxArraywxBaseArrayStringBase; -_WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase, - wxArray_SortFunction, - class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, - wxBaseArrayStringBase, WXDLLIMPEXP_BASE); -_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, - wxBaseArrayStringBase, = wxStringSortAscending, - class WXDLLIMPEXP_BASE, CMPFUNCwxString); - -class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase -{ -public: - // type of function used by wxArrayString::Sort() - typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, - const wxString& second); - - wxArrayString() { } - wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { } - wxArrayString(size_t sz, const wxChar** a); - wxArrayString(size_t sz, const wxString* a); - - int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; - - void Sort(bool reverseOrder = false); - void Sort(CompareFunction function); - void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); } - - size_t Add(const wxString& string, size_t copies = 1) - { - wxArrayStringBase::Add(string, copies); - return size() - copies; - } -}; - -class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase -{ -public: - wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending) - { } - wxSortedArrayString(const wxSortedArrayString& array) - : wxSortedArrayStringBase(array) - { } - wxSortedArrayString(const wxArrayString& src) - : wxSortedArrayStringBase(wxStringSortAscending) - { - reserve(src.size()); - - for ( size_t n = 0; n < src.size(); n++ ) - Add(src[n]); - } - - int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; -}; - -#else // if !wxUSE_STL - -// ---------------------------------------------------------------------------- -// The string array uses it's knowledge of internal structure of the wxString -// class to optimize string storage. Normally, we would store pointers to -// string, but as wxString is, in fact, itself a pointer (sizeof(wxString) is -// sizeof(char *)) we store these pointers instead. The cast to "wxString *" is -// really all we need to turn such pointer into a string! -// -// Of course, it can be called a dirty hack, but we use twice less memory and -// this approach is also more speed efficient, so it's probably worth it. -// -// Usage notes: when a string is added/inserted, a new copy of it is created, -// so the original string may be safely deleted. When a string is retrieved -// from the array (operator[] or Item() method), a reference is returned. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxArrayString -{ -public: - // type of function used by wxArrayString::Sort() - typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, - const wxString& second); - // type of function used by wxArrayString::Sort(), for compatibility with - // wxArray - typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first, - wxString* second); - - // constructors and destructor - // default ctor - wxArrayString() { Init(false); } - // if autoSort is true, the array is always sorted (in alphabetical order) - // - // NB: the reason for using int and not bool is that like this we can avoid - // using this ctor for implicit conversions from "const char *" (which - // we'd like to be implicitly converted to wxString instead!) - // - // of course, using explicit would be even better - if all compilers - // supported it... - wxArrayString(int autoSort) { Init(autoSort != 0); } - // C string array ctor - wxArrayString(size_t sz, const wxChar** a); - // wxString string array ctor - wxArrayString(size_t sz, const wxString* a); - // copy ctor - wxArrayString(const wxArrayString& array); - // assignment operator - wxArrayString& operator=(const wxArrayString& src); - // not virtual, this class should not be derived from - ~wxArrayString(); - - // memory management - // empties the list, but doesn't release memory - void Empty(); - // empties the list and releases memory - void Clear(); - // preallocates memory for given number of items - void Alloc(size_t nCount); - // minimzes the memory usage (by freeing all extra memory) - void Shrink(); - - // simple accessors - // number of elements in the array - size_t GetCount() const { return m_nCount; } - // is it empty? - bool IsEmpty() const { return m_nCount == 0; } - // number of elements in the array (GetCount is preferred API) - size_t Count() const { return m_nCount; } - - // items access (range checking is done in debug version) - // get item at position uiIndex - wxString& Item(size_t nIndex) const - { - wxASSERT_MSG( nIndex < m_nCount, - _T("wxArrayString: index out of bounds") ); - - return *(wxString *)&(m_pItems[nIndex]); - } - - // same as Item() - wxString& operator[](size_t nIndex) const { return Item(nIndex); } - // get last item - wxString& Last() const - { - wxASSERT_MSG( !IsEmpty(), - _T("wxArrayString: index out of bounds") ); - return Item(Count() - 1); - } - - // return a wxString[], useful for the controls which - // take one in their ctor. You must delete[] it yourself - // once you are done with it. Will return NULL if the - // ArrayString was empty. -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( wxString* GetStringArray() const ); -#endif - - // item management - // Search the element in the array, starting from the beginning if - // bFromEnd is false or from end otherwise. If bCase, comparison is case - // sensitive (default). Returns index of the first item matched or - // wxNOT_FOUND - int Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const; - // add new element at the end (if the array is not sorted), return its - // index - size_t Add(const wxString& str, size_t nInsert = 1); - // add new element at given position - void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1); - // expand the array to have count elements - void SetCount(size_t count); - // remove first item matching this value - void Remove(const wxChar *sz); - // remove item by index -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( void Remove(size_t nIndex, size_t nRemove = 1) ); -#endif - void RemoveAt(size_t nIndex, size_t nRemove = 1); - - // sorting - // sort array elements in alphabetical order (or reversed alphabetical - // order if reverseOrder parameter is true) - void Sort(bool reverseOrder = false); - // sort array elements using specified comparaison function - void Sort(CompareFunction compareFunction); - void Sort(CompareFunction2 compareFunction); - - // comparison - // compare two arrays case sensitively - bool operator==(const wxArrayString& a) const; - // compare two arrays case sensitively - bool operator!=(const wxArrayString& a) const { return !(*this == a); } - - // STL-like interface - typedef wxString value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef int difference_type; - typedef size_t size_type; - - // TODO: this code duplicates the one in dynarray.h - class reverse_iterator - { - typedef wxString value_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef reverse_iterator itor; - friend itor operator+(int o, const itor& it); - friend itor operator+(const itor& it, int o); - friend itor operator-(const itor& it, int o); - friend difference_type operator -(const itor& i1, const itor& i2); - public: - pointer m_ptr; - reverse_iterator() : m_ptr(NULL) { } - reverse_iterator(pointer ptr) : m_ptr(ptr) { } - reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } - reference operator*() const { return *m_ptr; } - pointer operator->() const { return m_ptr; } - itor& operator++() { --m_ptr; return *this; } - const itor operator++(int) - { reverse_iterator tmp = *this; --m_ptr; return tmp; } - itor& operator--() { ++m_ptr; return *this; } - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } - }; - - class const_reverse_iterator - { - typedef wxString value_type; - typedef const value_type* pointer; - typedef const value_type& reference; - typedef const_reverse_iterator itor; - friend itor operator+(int o, const itor& it); - friend itor operator+(const itor& it, int o); - friend itor operator-(const itor& it, int o); - friend difference_type operator -(const itor& i1, const itor& i2); - public: - pointer m_ptr; - const_reverse_iterator() : m_ptr(NULL) { } - const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } - const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } - const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } - reference operator*() const { return *m_ptr; } - pointer operator->() const { return m_ptr; } - itor& operator++() { --m_ptr; return *this; } - const itor operator++(int) - { itor tmp = *this; --m_ptr; return tmp; } - itor& operator--() { ++m_ptr; return *this; } - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } - }; - - wxArrayString(const_iterator first, const_iterator last) - { Init(false); assign(first, last); } - wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } - void assign(const_iterator first, const_iterator last); - void assign(size_type n, const_reference v) - { clear(); Add(v, n); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - iterator begin() { return (wxString *)&(m_pItems[0]); } - const_iterator begin() const { return (wxString *)&(m_pItems[0]); } - size_type capacity() const { return m_nSize; } - void clear() { Clear(); } - bool empty() const { return IsEmpty(); } - iterator end() { return begin() + GetCount(); } - const_iterator end() const { return begin() + GetCount(); } - iterator erase(iterator first, iterator last) - { - size_t idx = first - begin(); - RemoveAt(idx, last - first); - return begin() + idx; - } - iterator erase(iterator it) { return erase(it, it + 1); } - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - void insert(iterator it, size_type n, const_reference v) - { Insert(v, it - begin(), n); } - iterator insert(iterator it, const_reference v = value_type()) - { size_t idx = it - begin(); Insert(v, idx); return begin() + idx; } - void insert(iterator it, const_iterator first, const_iterator last); - size_type max_size() const { return INT_MAX; } - void pop_back() { RemoveAt(GetCount() - 1); } - void push_back(const_reference v) { Add(v); } - reverse_iterator rbegin() { return reverse_iterator(end() - 1); } - const_reverse_iterator rbegin() const; - reverse_iterator rend() { return reverse_iterator(begin() - 1); } - const_reverse_iterator rend() const; - void reserve(size_type n) /* base::reserve*/; - void resize(size_type n, value_type v = value_type()); - size_type size() const { return GetCount(); } - -protected: - void Init(bool autoSort); // common part of all ctors - void Copy(const wxArrayString& src); // copies the contents of another array - -private: - void Grow(size_t nIncrement = 0); // makes array bigger if needed - void Free(); // free all the strings stored - - void DoSort(); // common part of all Sort() variants - - size_t m_nSize, // current size of the array - m_nCount; // current number of elements - - wxChar **m_pItems; // pointer to data - - bool m_autoSort; // if true, keep the array always sorted -}; - -class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString -{ -public: - wxSortedArrayString() : wxArrayString(true) - { } - wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) - { Copy(array); } -}; - -#endif // !wxUSE_STL - -// this class provides a temporary wxString* from a -// wxArrayString -class WXDLLIMPEXP_BASE wxCArrayString -{ -public: - wxCArrayString( const wxArrayString& array ) - : m_array( array ), m_strings( NULL ) - { } - ~wxCArrayString() { delete[] m_strings; } - - size_t GetCount() const { return m_array.GetCount(); } - wxString* GetStrings() - { - if( m_strings ) return m_strings; - size_t count = m_array.GetCount(); - m_strings = new wxString[count]; - for( size_t i = 0; i < count; ++i ) - m_strings[i] = m_array[i]; - return m_strings; - } -private: - const wxArrayString& m_array; - wxString* m_strings; -}; - -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/arrstr.h +// Purpose: wxArrayString class +// Author: Mattia Barbon and Vadim Zeitlin +// Modified by: +// Created: 07/07/03 +// RCS-ID: $Id: arrstr.h 33888 2005-04-26 19:24:12Z MBN $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ARRSTR_H +#define _WX_ARRSTR_H + +#include "wx/defs.h" +#include "wx/string.h" + +WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortAscending(wxString*, wxString*); +WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortDescending(wxString*, wxString*); + +#if wxUSE_STL + +#include "wx/dynarray.h" + +typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*); +typedef wxString _wxArraywxBaseArrayStringBase; +_WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase, + wxArray_SortFunction, + class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, + wxBaseArrayStringBase, WXDLLIMPEXP_BASE); +_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, + wxBaseArrayStringBase, = wxStringSortAscending, + class WXDLLIMPEXP_BASE, CMPFUNCwxString); + +class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase +{ +public: + // type of function used by wxArrayString::Sort() + typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, + const wxString& second); + + wxArrayString() { } + wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { } + wxArrayString(size_t sz, const wxChar** a); + wxArrayString(size_t sz, const wxString* a); + + int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; + + void Sort(bool reverseOrder = false); + void Sort(CompareFunction function); + void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); } + + size_t Add(const wxString& string, size_t copies = 1) + { + wxArrayStringBase::Add(string, copies); + return size() - copies; + } +}; + +class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase +{ +public: + wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending) + { } + wxSortedArrayString(const wxSortedArrayString& array) + : wxSortedArrayStringBase(array) + { } + wxSortedArrayString(const wxArrayString& src) + : wxSortedArrayStringBase(wxStringSortAscending) + { + reserve(src.size()); + + for ( size_t n = 0; n < src.size(); n++ ) + Add(src[n]); + } + + int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; +}; + +#else // if !wxUSE_STL + +// ---------------------------------------------------------------------------- +// The string array uses it's knowledge of internal structure of the wxString +// class to optimize string storage. Normally, we would store pointers to +// string, but as wxString is, in fact, itself a pointer (sizeof(wxString) is +// sizeof(char *)) we store these pointers instead. The cast to "wxString *" is +// really all we need to turn such pointer into a string! +// +// Of course, it can be called a dirty hack, but we use twice less memory and +// this approach is also more speed efficient, so it's probably worth it. +// +// Usage notes: when a string is added/inserted, a new copy of it is created, +// so the original string may be safely deleted. When a string is retrieved +// from the array (operator[] or Item() method), a reference is returned. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxArrayString +{ +public: + // type of function used by wxArrayString::Sort() + typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, + const wxString& second); + // type of function used by wxArrayString::Sort(), for compatibility with + // wxArray + typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first, + wxString* second); + + // constructors and destructor + // default ctor + wxArrayString() { Init(false); } + // if autoSort is true, the array is always sorted (in alphabetical order) + // + // NB: the reason for using int and not bool is that like this we can avoid + // using this ctor for implicit conversions from "const char *" (which + // we'd like to be implicitly converted to wxString instead!) + // + // of course, using explicit would be even better - if all compilers + // supported it... + wxArrayString(int autoSort) { Init(autoSort != 0); } + // C string array ctor + wxArrayString(size_t sz, const wxChar** a); + // wxString string array ctor + wxArrayString(size_t sz, const wxString* a); + // copy ctor + wxArrayString(const wxArrayString& array); + // assignment operator + wxArrayString& operator=(const wxArrayString& src); + // not virtual, this class should not be derived from + ~wxArrayString(); + + // memory management + // empties the list, but doesn't release memory + void Empty(); + // empties the list and releases memory + void Clear(); + // preallocates memory for given number of items + void Alloc(size_t nCount); + // minimzes the memory usage (by freeing all extra memory) + void Shrink(); + + // simple accessors + // number of elements in the array + size_t GetCount() const { return m_nCount; } + // is it empty? + bool IsEmpty() const { return m_nCount == 0; } + // number of elements in the array (GetCount is preferred API) + size_t Count() const { return m_nCount; } + + // items access (range checking is done in debug version) + // get item at position uiIndex + wxString& Item(size_t nIndex) const + { + wxASSERT_MSG( nIndex < m_nCount, + _T("wxArrayString: index out of bounds") ); + + return *(wxString *)&(m_pItems[nIndex]); + } + + // same as Item() + wxString& operator[](size_t nIndex) const { return Item(nIndex); } + // get last item + wxString& Last() const + { + wxASSERT_MSG( !IsEmpty(), + _T("wxArrayString: index out of bounds") ); + return Item(Count() - 1); + } + + // return a wxString[], useful for the controls which + // take one in their ctor. You must delete[] it yourself + // once you are done with it. Will return NULL if the + // ArrayString was empty. +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( wxString* GetStringArray() const ); +#endif + + // item management + // Search the element in the array, starting from the beginning if + // bFromEnd is false or from end otherwise. If bCase, comparison is case + // sensitive (default). Returns index of the first item matched or + // wxNOT_FOUND + int Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const; + // add new element at the end (if the array is not sorted), return its + // index + size_t Add(const wxString& str, size_t nInsert = 1); + // add new element at given position + void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1); + // expand the array to have count elements + void SetCount(size_t count); + // remove first item matching this value + void Remove(const wxChar *sz); + // remove item by index +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void Remove(size_t nIndex, size_t nRemove = 1) ); +#endif + void RemoveAt(size_t nIndex, size_t nRemove = 1); + + // sorting + // sort array elements in alphabetical order (or reversed alphabetical + // order if reverseOrder parameter is true) + void Sort(bool reverseOrder = false); + // sort array elements using specified comparaison function + void Sort(CompareFunction compareFunction); + void Sort(CompareFunction2 compareFunction); + + // comparison + // compare two arrays case sensitively + bool operator==(const wxArrayString& a) const; + // compare two arrays case sensitively + bool operator!=(const wxArrayString& a) const { return !(*this == a); } + + // STL-like interface + typedef wxString value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef int difference_type; + typedef size_t size_type; + + // TODO: this code duplicates the one in dynarray.h + class reverse_iterator + { + typedef wxString value_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef reverse_iterator itor; + friend itor operator+(int o, const itor& it); + friend itor operator+(const itor& it, int o); + friend itor operator-(const itor& it, int o); + friend difference_type operator -(const itor& i1, const itor& i2); + public: + pointer m_ptr; + reverse_iterator() : m_ptr(NULL) { } + reverse_iterator(pointer ptr) : m_ptr(ptr) { } + reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } + reference operator*() const { return *m_ptr; } + pointer operator->() const { return m_ptr; } + itor& operator++() { --m_ptr; return *this; } + const itor operator++(int) + { reverse_iterator tmp = *this; --m_ptr; return tmp; } + itor& operator--() { ++m_ptr; return *this; } + const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } + }; + + class const_reverse_iterator + { + typedef wxString value_type; + typedef const value_type* pointer; + typedef const value_type& reference; + typedef const_reverse_iterator itor; + friend itor operator+(int o, const itor& it); + friend itor operator+(const itor& it, int o); + friend itor operator-(const itor& it, int o); + friend difference_type operator -(const itor& i1, const itor& i2); + public: + pointer m_ptr; + const_reverse_iterator() : m_ptr(NULL) { } + const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } + const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } + const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } + reference operator*() const { return *m_ptr; } + pointer operator->() const { return m_ptr; } + itor& operator++() { --m_ptr; return *this; } + const itor operator++(int) + { itor tmp = *this; --m_ptr; return tmp; } + itor& operator--() { ++m_ptr; return *this; } + const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } + }; + + wxArrayString(const_iterator first, const_iterator last) + { Init(false); assign(first, last); } + wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } + void assign(const_iterator first, const_iterator last); + void assign(size_type n, const_reference v) + { clear(); Add(v, n); } + reference back() { return *(end() - 1); } + const_reference back() const { return *(end() - 1); } + iterator begin() { return (wxString *)&(m_pItems[0]); } + const_iterator begin() const { return (wxString *)&(m_pItems[0]); } + size_type capacity() const { return m_nSize; } + void clear() { Clear(); } + bool empty() const { return IsEmpty(); } + iterator end() { return begin() + GetCount(); } + const_iterator end() const { return begin() + GetCount(); } + iterator erase(iterator first, iterator last) + { + size_t idx = first - begin(); + RemoveAt(idx, last - first); + return begin() + idx; + } + iterator erase(iterator it) { return erase(it, it + 1); } + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + void insert(iterator it, size_type n, const_reference v) + { Insert(v, it - begin(), n); } + iterator insert(iterator it, const_reference v = value_type()) + { size_t idx = it - begin(); Insert(v, idx); return begin() + idx; } + void insert(iterator it, const_iterator first, const_iterator last); + size_type max_size() const { return INT_MAX; } + void pop_back() { RemoveAt(GetCount() - 1); } + void push_back(const_reference v) { Add(v); } + reverse_iterator rbegin() { return reverse_iterator(end() - 1); } + const_reverse_iterator rbegin() const; + reverse_iterator rend() { return reverse_iterator(begin() - 1); } + const_reverse_iterator rend() const; + void reserve(size_type n) /* base::reserve*/; + void resize(size_type n, value_type v = value_type()); + size_type size() const { return GetCount(); } + +protected: + void Init(bool autoSort); // common part of all ctors + void Copy(const wxArrayString& src); // copies the contents of another array + +private: + void Grow(size_t nIncrement = 0); // makes array bigger if needed + void Free(); // free all the strings stored + + void DoSort(); // common part of all Sort() variants + + size_t m_nSize, // current size of the array + m_nCount; // current number of elements + + wxChar **m_pItems; // pointer to data + + bool m_autoSort; // if true, keep the array always sorted +}; + +class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString +{ +public: + wxSortedArrayString() : wxArrayString(true) + { } + wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) + { Copy(array); } +}; + +#endif // !wxUSE_STL + +// this class provides a temporary wxString* from a +// wxArrayString +class WXDLLIMPEXP_BASE wxCArrayString +{ +public: + wxCArrayString( const wxArrayString& array ) + : m_array( array ), m_strings( NULL ) + { } + ~wxCArrayString() { delete[] m_strings; } + + size_t GetCount() const { return m_array.GetCount(); } + wxString* GetStrings() + { + if( m_strings ) return m_strings; + size_t count = m_array.GetCount(); + m_strings = new wxString[count]; + for( size_t i = 0; i < count; ++i ) + m_strings[i] = m_array[i]; + return m_strings; + } +private: + const wxArrayString& m_array; + wxString* m_strings; +}; + +#endif diff --git a/Externals/wxWidgets/include/wx/artprov.h b/Externals/wxWidgets/include/wx/artprov.h index 9a15f57679..c5f0ff8642 100644 --- a/Externals/wxWidgets/include/wx/artprov.h +++ b/Externals/wxWidgets/include/wx/artprov.h @@ -1,200 +1,200 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/artprov.h -// Purpose: wxArtProvider class -// Author: Vaclav Slavik -// Modified by: -// Created: 18/03/2002 -// RCS-ID: $Id: artprov.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ARTPROV_H_ -#define _WX_ARTPROV_H_ - -#include "wx/string.h" -#include "wx/bitmap.h" -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxArtProvidersList; -class WXDLLIMPEXP_FWD_CORE wxArtProviderCache; -class wxArtProviderModule; - -// ---------------------------------------------------------------------------- -// Types -// ---------------------------------------------------------------------------- - -typedef wxString wxArtClient; -typedef wxString wxArtID; - -#define wxART_MAKE_CLIENT_ID_FROM_STR(id) (id + _T("_C")) -#define wxART_MAKE_CLIENT_ID(id) _T(#id) _T("_C") -#define wxART_MAKE_ART_ID_FROM_STR(id) (id) -#define wxART_MAKE_ART_ID(id) _T(#id) - -// ---------------------------------------------------------------------------- -// Art clients -// ---------------------------------------------------------------------------- - -#define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) -#define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) -#define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) - -#define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) -#define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) -#define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) -#define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON) - -#define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) - -// ---------------------------------------------------------------------------- -// Art IDs -// ---------------------------------------------------------------------------- - -#define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) -#define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) -#define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) -#define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) -#define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) -#define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) -#define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) -#define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) -#define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) -#define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) -#define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) -#define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) -#define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) -#define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) -#define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE) -#define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS) -#define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) -#define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) -#define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) -#define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) -#define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) -#define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) -#define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK) -#define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY) -#define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM) -#define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE) -#define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) -#define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN) -#define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) -#define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) -#define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) -#define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) -#define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) -#define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) -#define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) -#define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) -#define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) -#define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE) - -#define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY) -#define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT) -#define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE) -#define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE) -#define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW) - -#define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO) -#define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO) - -#define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT) - -#define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) -#define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) - - -// ---------------------------------------------------------------------------- -// wxArtProvider class -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxArtProvider : public wxObject -{ -public: - // Dtor removes the provider from providers stack if it's still on it - virtual ~wxArtProvider(); - - - // Add new provider to the top of providers stack (i.e. the provider will - // be queried first of all). - static void Push(wxArtProvider *provider); - - // Add new provider to the bottom of providers stack (i.e. the provider - // will be queried as the last one). - static void Insert(wxArtProvider *provider); - - // Remove latest added provider and delete it. - static bool Pop(); - - // Remove provider from providers stack but don't delete it. - static bool Remove(wxArtProvider *provider); - - // Delete the given provider and remove it from the providers stack. - static bool Delete(wxArtProvider *provider); - - - // Query the providers for bitmap with given ID and return it. Return - // wxNullBitmap if no provider provides it. - static wxBitmap GetBitmap(const wxArtID& id, - const wxArtClient& client = wxART_OTHER, - const wxSize& size = wxDefaultSize); - - // Query the providers for icon with given ID and return it. Return - // wxNullIcon if no provider provides it. - static wxIcon GetIcon(const wxArtID& id, - const wxArtClient& client = wxART_OTHER, - const wxSize& size = wxDefaultSize); - - // Get the size hint of an icon from a specific wxArtClient, queries - // the topmost provider if platform_dependent = false - static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false); - -#if WXWIN_COMPATIBILITY_2_6 - // use the corresponding methods without redundant "Provider" suffix - wxDEPRECATED( static void PushProvider(wxArtProvider *provider) ); - wxDEPRECATED( static void InsertProvider(wxArtProvider *provider) ); - wxDEPRECATED( static bool PopProvider() ); - - // use Delete() if this is what you really need, or just delete the - // provider pointer, do not use Remove() as it does not delete the pointer - // unlike RemoveProvider() which does - wxDEPRECATED( static bool RemoveProvider(wxArtProvider *provider) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - friend class wxArtProviderModule; - // Initializes default provider - static void InitStdProvider(); - // Initializes platform's native provider, if available (e.g. GTK2) - static void InitNativeProvider(); - // Destroy caches & all providers - static void CleanUpProviders(); - - // Get the default size of an icon for a specific client - virtual wxSize DoGetSizeHint(const wxArtClient& client) - { - return GetSizeHint(client, true); - } - - // Derived classes must override this method to create requested - // art resource. This method is called only once per instance's - // lifetime for each requested wxArtID. - virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), - const wxArtClient& WXUNUSED(client), - const wxSize& WXUNUSED(size)) = 0; - -private: - static void CommonAddingProvider(); - -private: - // list of providers: - static wxArtProvidersList *sm_providers; - // art resources cache (so that CreateXXX is not called that often): - static wxArtProviderCache *sm_cache; - - DECLARE_ABSTRACT_CLASS(wxArtProvider) -}; - - -#endif // _WX_ARTPROV_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/artprov.h +// Purpose: wxArtProvider class +// Author: Vaclav Slavik +// Modified by: +// Created: 18/03/2002 +// RCS-ID: $Id: artprov.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ARTPROV_H_ +#define _WX_ARTPROV_H_ + +#include "wx/string.h" +#include "wx/bitmap.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxArtProvidersList; +class WXDLLIMPEXP_FWD_CORE wxArtProviderCache; +class wxArtProviderModule; + +// ---------------------------------------------------------------------------- +// Types +// ---------------------------------------------------------------------------- + +typedef wxString wxArtClient; +typedef wxString wxArtID; + +#define wxART_MAKE_CLIENT_ID_FROM_STR(id) (id + _T("_C")) +#define wxART_MAKE_CLIENT_ID(id) _T(#id) _T("_C") +#define wxART_MAKE_ART_ID_FROM_STR(id) (id) +#define wxART_MAKE_ART_ID(id) _T(#id) + +// ---------------------------------------------------------------------------- +// Art clients +// ---------------------------------------------------------------------------- + +#define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) +#define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) +#define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) + +#define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) +#define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) +#define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) +#define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON) + +#define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) + +// ---------------------------------------------------------------------------- +// Art IDs +// ---------------------------------------------------------------------------- + +#define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) +#define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) +#define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) +#define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) +#define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) +#define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) +#define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) +#define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) +#define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) +#define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) +#define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) +#define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) +#define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) +#define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) +#define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE) +#define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS) +#define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) +#define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) +#define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) +#define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) +#define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) +#define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) +#define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK) +#define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY) +#define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM) +#define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE) +#define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) +#define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN) +#define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) +#define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) +#define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) +#define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) +#define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) +#define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) +#define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) +#define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) +#define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) +#define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE) + +#define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY) +#define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT) +#define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE) +#define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE) +#define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW) + +#define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO) +#define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO) + +#define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT) + +#define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) +#define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) + + +// ---------------------------------------------------------------------------- +// wxArtProvider class +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxArtProvider : public wxObject +{ +public: + // Dtor removes the provider from providers stack if it's still on it + virtual ~wxArtProvider(); + + + // Add new provider to the top of providers stack (i.e. the provider will + // be queried first of all). + static void Push(wxArtProvider *provider); + + // Add new provider to the bottom of providers stack (i.e. the provider + // will be queried as the last one). + static void Insert(wxArtProvider *provider); + + // Remove latest added provider and delete it. + static bool Pop(); + + // Remove provider from providers stack but don't delete it. + static bool Remove(wxArtProvider *provider); + + // Delete the given provider and remove it from the providers stack. + static bool Delete(wxArtProvider *provider); + + + // Query the providers for bitmap with given ID and return it. Return + // wxNullBitmap if no provider provides it. + static wxBitmap GetBitmap(const wxArtID& id, + const wxArtClient& client = wxART_OTHER, + const wxSize& size = wxDefaultSize); + + // Query the providers for icon with given ID and return it. Return + // wxNullIcon if no provider provides it. + static wxIcon GetIcon(const wxArtID& id, + const wxArtClient& client = wxART_OTHER, + const wxSize& size = wxDefaultSize); + + // Get the size hint of an icon from a specific wxArtClient, queries + // the topmost provider if platform_dependent = false + static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false); + +#if WXWIN_COMPATIBILITY_2_6 + // use the corresponding methods without redundant "Provider" suffix + wxDEPRECATED( static void PushProvider(wxArtProvider *provider) ); + wxDEPRECATED( static void InsertProvider(wxArtProvider *provider) ); + wxDEPRECATED( static bool PopProvider() ); + + // use Delete() if this is what you really need, or just delete the + // provider pointer, do not use Remove() as it does not delete the pointer + // unlike RemoveProvider() which does + wxDEPRECATED( static bool RemoveProvider(wxArtProvider *provider) ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + friend class wxArtProviderModule; + // Initializes default provider + static void InitStdProvider(); + // Initializes platform's native provider, if available (e.g. GTK2) + static void InitNativeProvider(); + // Destroy caches & all providers + static void CleanUpProviders(); + + // Get the default size of an icon for a specific client + virtual wxSize DoGetSizeHint(const wxArtClient& client) + { + return GetSizeHint(client, true); + } + + // Derived classes must override this method to create requested + // art resource. This method is called only once per instance's + // lifetime for each requested wxArtID. + virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), + const wxArtClient& WXUNUSED(client), + const wxSize& WXUNUSED(size)) = 0; + +private: + static void CommonAddingProvider(); + +private: + // list of providers: + static wxArtProvidersList *sm_providers; + // art resources cache (so that CreateXXX is not called that often): + static wxArtProviderCache *sm_cache; + + DECLARE_ABSTRACT_CLASS(wxArtProvider) +}; + + +#endif // _WX_ARTPROV_H_ diff --git a/Externals/wxWidgets/include/wx/aui/aui.h b/Externals/wxWidgets/include/wx/aui/aui.h index 6902fa99bf..c926462eea 100644 --- a/Externals/wxWidgets/include/wx/aui/aui.h +++ b/Externals/wxWidgets/include/wx/aui/aui.h @@ -1,22 +1,22 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/aui/aui.h -// Purpose: wxaui: wx advanced user interface - docking window manager -// Author: Benjamin I. Williams -// Modified by: -// Created: 2005-05-17 -// RCS-ID: $Id: aui.h 40232 2006-07-22 13:14:07Z BIW $ -// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. -// Licence: wxWindows Library Licence, Version 3.1 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_AUI_H_ -#define _WX_AUI_H_ - -#include "wx/aui/framemanager.h" -#include "wx/aui/dockart.h" -#include "wx/aui/floatpane.h" -#include "wx/aui/auibook.h" -#include "wx/aui/tabmdi.h" - -#endif // _WX_AUI_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/aui.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// RCS-ID: $Id: aui.h 40232 2006-07-22 13:14:07Z BIW $ +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_H_ +#define _WX_AUI_H_ + +#include "wx/aui/framemanager.h" +#include "wx/aui/dockart.h" +#include "wx/aui/floatpane.h" +#include "wx/aui/auibook.h" +#include "wx/aui/tabmdi.h" + +#endif // _WX_AUI_H_ + diff --git a/Externals/wxWidgets/include/wx/aui/auibook.h b/Externals/wxWidgets/include/wx/aui/auibook.h index fbef53ca4b..9611387820 100644 --- a/Externals/wxWidgets/include/wx/aui/auibook.h +++ b/Externals/wxWidgets/include/wx/aui/auibook.h @@ -1,751 +1,751 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/aui/auibook.h -// Purpose: wxaui: wx advanced user interface - notebook -// Author: Benjamin I. Williams -// Modified by: -// Created: 2006-06-28 -// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved. -// Licence: wxWindows Library Licence, Version 3.1 -/////////////////////////////////////////////////////////////////////////////// - - - -#ifndef _WX_AUINOTEBOOK_H_ -#define _WX_AUINOTEBOOK_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_AUI - -#include "wx/aui/framemanager.h" -#include "wx/aui/dockart.h" -#include "wx/aui/floatpane.h" -#include "wx/control.h" - - -class wxAuiNotebook; - - -enum wxAuiNotebookOption -{ - wxAUI_NB_TOP = 1 << 0, - wxAUI_NB_LEFT = 1 << 1, // not implemented yet - wxAUI_NB_RIGHT = 1 << 2, // not implemented yet - wxAUI_NB_BOTTOM = 1 << 3, - wxAUI_NB_TAB_SPLIT = 1 << 4, - wxAUI_NB_TAB_MOVE = 1 << 5, - wxAUI_NB_TAB_EXTERNAL_MOVE = 1 << 6, - wxAUI_NB_TAB_FIXED_WIDTH = 1 << 7, - wxAUI_NB_SCROLL_BUTTONS = 1 << 8, - wxAUI_NB_WINDOWLIST_BUTTON = 1 << 9, - wxAUI_NB_CLOSE_BUTTON = 1 << 10, - wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 11, - wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 12, - wxAUI_NB_MIDDLE_CLICK_CLOSE = 1 << 13, - - wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP | - wxAUI_NB_TAB_SPLIT | - wxAUI_NB_TAB_MOVE | - wxAUI_NB_SCROLL_BUTTONS | - wxAUI_NB_CLOSE_ON_ACTIVE_TAB | - wxAUI_NB_MIDDLE_CLICK_CLOSE -}; - - - - -// aui notebook event class - -class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent -{ -public: - wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, - int win_id = 0) - : wxNotifyEvent(command_type, win_id) - { - old_selection = -1; - selection = -1; - drag_source = NULL; - } -#ifndef SWIG - wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxNotifyEvent(c) - { - old_selection = c.old_selection; - selection = c.selection; - drag_source = c.drag_source; - } -#endif - wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); } - - void SetSelection(int s) { selection = s; m_commandInt = s; } - int GetSelection() const { return selection; } - - void SetOldSelection(int s) { old_selection = s; } - int GetOldSelection() const { return old_selection; } - - void SetDragSource(wxAuiNotebook* s) { drag_source = s; } - wxAuiNotebook* GetDragSource() const { return drag_source; } - -public: - int old_selection; - int selection; - wxAuiNotebook* drag_source; - -#ifndef SWIG -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent) -#endif -}; - - -class WXDLLIMPEXP_AUI wxAuiNotebookPage -{ -public: - wxWindow* window; // page's associated window - wxString caption; // caption displayed on the tab - wxBitmap bitmap; // tab's bitmap - wxRect rect; // tab's hit rectangle - bool active; // true if the page is currently active -}; - -class WXDLLIMPEXP_AUI wxAuiTabContainerButton -{ -public: - - int id; // button's id - int cur_state; // current state (normal, hover, pressed, etc.) - int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER) - wxBitmap bitmap; // button's hover bitmap - wxBitmap dis_bitmap; // button's disabled bitmap - wxRect rect; // button's hit rectangle -}; - - -#ifndef SWIG -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI); -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI); -#endif - - -// tab art class - -class WXDLLIMPEXP_AUI wxAuiTabArt -{ -public: - - wxAuiTabArt() { } - virtual ~wxAuiTabArt() { } - - virtual wxAuiTabArt* Clone() = 0; - virtual void SetFlags(unsigned int flags) = 0; - - virtual void SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count) = 0; - - virtual void SetNormalFont(const wxFont& font) = 0; - virtual void SetSelectedFont(const wxFont& font) = 0; - virtual void SetMeasuringFont(const wxFont& font) = 0; - - virtual void DrawBackground( - wxDC& dc, - wxWindow* wnd, - const wxRect& rect) = 0; - - virtual void DrawTab(wxDC& dc, - wxWindow* wnd, - const wxAuiNotebookPage& pane, - const wxRect& in_rect, - int close_button_state, - wxRect* out_tab_rect, - wxRect* out_button_rect, - int* x_extent) = 0; - - virtual void DrawButton( - wxDC& dc, - wxWindow* wnd, - const wxRect& in_rect, - int bitmap_id, - int button_state, - int orientation, - wxRect* out_rect) = 0; - - virtual wxSize GetTabSize( - wxDC& dc, - wxWindow* wnd, - const wxString& caption, - const wxBitmap& bitmap, - bool active, - int close_button_state, - int* x_extent) = 0; - - virtual int ShowDropDown( - wxWindow* wnd, - const wxAuiNotebookPageArray& items, - int active_idx) = 0; - - virtual int GetIndentSize() = 0; - - virtual int GetBestTabCtrlSize( - wxWindow* wnd, - const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size) = 0; -}; - - -class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt -{ - -public: - - wxAuiDefaultTabArt(); - virtual ~wxAuiDefaultTabArt(); - - wxAuiTabArt* Clone(); - void SetFlags(unsigned int flags); - void SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count); - - void SetNormalFont(const wxFont& font); - void SetSelectedFont(const wxFont& font); - void SetMeasuringFont(const wxFont& font); - - void DrawBackground( - wxDC& dc, - wxWindow* wnd, - const wxRect& rect); - - void DrawTab(wxDC& dc, - wxWindow* wnd, - const wxAuiNotebookPage& pane, - const wxRect& in_rect, - int close_button_state, - wxRect* out_tab_rect, - wxRect* out_button_rect, - int* x_extent); - - void DrawButton( - wxDC& dc, - wxWindow* wnd, - const wxRect& in_rect, - int bitmap_id, - int button_state, - int orientation, - wxRect* out_rect); - - int GetIndentSize(); - - wxSize GetTabSize( - wxDC& dc, - wxWindow* wnd, - const wxString& caption, - const wxBitmap& bitmap, - bool active, - int close_button_state, - int* x_extent); - - int ShowDropDown( - wxWindow* wnd, - const wxAuiNotebookPageArray& items, - int active_idx); - - int GetBestTabCtrlSize(wxWindow* wnd, - const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size); - -protected: - - wxFont m_normal_font; - wxFont m_selected_font; - wxFont m_measuring_font; - wxColour m_base_colour; - wxPen m_base_colour_pen; - wxPen m_border_pen; - wxBrush m_base_colour_brush; - wxBitmap m_active_close_bmp; - wxBitmap m_disabled_close_bmp; - wxBitmap m_active_left_bmp; - wxBitmap m_disabled_left_bmp; - wxBitmap m_active_right_bmp; - wxBitmap m_disabled_right_bmp; - wxBitmap m_active_windowlist_bmp; - wxBitmap m_disabled_windowlist_bmp; - - int m_fixed_tab_width; - int m_tab_ctrl_height; - unsigned int m_flags; -}; - - -class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt -{ - -public: - - wxAuiSimpleTabArt(); - virtual ~wxAuiSimpleTabArt(); - - wxAuiTabArt* Clone(); - void SetFlags(unsigned int flags); - - void SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count); - - void SetNormalFont(const wxFont& font); - void SetSelectedFont(const wxFont& font); - void SetMeasuringFont(const wxFont& font); - - void DrawBackground( - wxDC& dc, - wxWindow* wnd, - const wxRect& rect); - - void DrawTab(wxDC& dc, - wxWindow* wnd, - const wxAuiNotebookPage& pane, - const wxRect& in_rect, - int close_button_state, - wxRect* out_tab_rect, - wxRect* out_button_rect, - int* x_extent); - - void DrawButton( - wxDC& dc, - wxWindow* wnd, - const wxRect& in_rect, - int bitmap_id, - int button_state, - int orientation, - wxRect* out_rect); - - int GetIndentSize(); - - wxSize GetTabSize( - wxDC& dc, - wxWindow* wnd, - const wxString& caption, - const wxBitmap& bitmap, - bool active, - int close_button_state, - int* x_extent); - - int ShowDropDown( - wxWindow* wnd, - const wxAuiNotebookPageArray& items, - int active_idx); - - int GetBestTabCtrlSize(wxWindow* wnd, - const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size); - -protected: - - wxFont m_normal_font; - wxFont m_selected_font; - wxFont m_measuring_font; - wxPen m_normal_bkpen; - wxPen m_selected_bkpen; - wxBrush m_normal_bkbrush; - wxBrush m_selected_bkbrush; - wxBrush m_bkbrush; - wxBitmap m_active_close_bmp; - wxBitmap m_disabled_close_bmp; - wxBitmap m_active_left_bmp; - wxBitmap m_disabled_left_bmp; - wxBitmap m_active_right_bmp; - wxBitmap m_disabled_right_bmp; - wxBitmap m_active_windowlist_bmp; - wxBitmap m_disabled_windowlist_bmp; - - int m_fixed_tab_width; - unsigned int m_flags; -}; - - - - - - - - - -class WXDLLIMPEXP_AUI wxAuiTabContainer -{ -public: - - wxAuiTabContainer(); - virtual ~wxAuiTabContainer(); - - void SetArtProvider(wxAuiTabArt* art); - wxAuiTabArt* GetArtProvider() const; - - void SetFlags(unsigned int flags); - unsigned int GetFlags() const; - - bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); - bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); - bool MovePage(wxWindow* page, size_t new_idx); - bool RemovePage(wxWindow* page); - bool SetActivePage(wxWindow* page); - bool SetActivePage(size_t page); - void SetNoneActive(); - int GetActivePage() const; - bool TabHitTest(int x, int y, wxWindow** hit) const; - bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const; - wxWindow* GetWindowFromIdx(size_t idx) const; - int GetIdxFromWindow(wxWindow* page) const; - size_t GetPageCount() const; - wxAuiNotebookPage& GetPage(size_t idx); - const wxAuiNotebookPage& GetPage(size_t idx) const; - wxAuiNotebookPageArray& GetPages(); - void SetNormalFont(const wxFont& normal_font); - void SetSelectedFont(const wxFont& selected_font); - void SetMeasuringFont(const wxFont& measuring_font); - void DoShowHide(); - void SetRect(const wxRect& rect); - - void RemoveButton(int id); - void AddButton(int id, - int location, - const wxBitmap& normal_bitmap = wxNullBitmap, - const wxBitmap& disabled_bitmap = wxNullBitmap); - - size_t GetTabOffset() const; - void SetTabOffset(size_t offset); - - // Is the tab visible? - bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd); - - // Make the tab visible if it wasn't already - void MakeTabVisible(int tabPage, wxWindow* win); - -protected: - - virtual void Render(wxDC* dc, wxWindow* wnd); - -protected: - - wxAuiTabArt* m_art; - wxAuiNotebookPageArray m_pages; - wxAuiTabContainerButtonArray m_buttons; - wxAuiTabContainerButtonArray m_tab_close_buttons; - wxRect m_rect; - size_t m_tab_offset; - unsigned int m_flags; -}; - - - -class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl, - public wxAuiTabContainer -{ -public: - - wxAuiTabCtrl(wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0); - - ~wxAuiTabCtrl(); - -#if wxABI_VERSION >= 20805 - bool IsDragging() const { return m_is_dragging; } -#endif - -protected: - - void OnPaint(wxPaintEvent& evt); - void OnEraseBackground(wxEraseEvent& evt); - void OnSize(wxSizeEvent& evt); - void OnLeftDown(wxMouseEvent& evt); - void OnLeftUp(wxMouseEvent& evt); -#if wxABI_VERSION >= 20805 - void OnMiddleDown(wxMouseEvent& evt); - void OnMiddleUp(wxMouseEvent& evt); - void OnRightDown(wxMouseEvent& evt); - void OnRightUp(wxMouseEvent& evt); - void OnLeftDClick(wxMouseEvent& evt); - void OnSetFocus(wxFocusEvent& event); - void OnKillFocus(wxFocusEvent& event); - void OnChar(wxKeyEvent& event); -#endif - void OnMotion(wxMouseEvent& evt); - void OnLeaveWindow(wxMouseEvent& evt); - void OnButton(wxAuiNotebookEvent& evt); - - -protected: - - wxPoint m_click_pt; - wxWindow* m_click_tab; - bool m_is_dragging; - wxAuiTabContainerButton* m_hover_button; - wxAuiTabContainerButton* m_pressed_button; - -#ifndef SWIG - DECLARE_CLASS(wxAuiTabCtrl) - DECLARE_EVENT_TABLE() -#endif -}; - - - - -class WXDLLIMPEXP_AUI wxAuiNotebook : public wxControl -{ - -public: - - wxAuiNotebook(); - - wxAuiNotebook(wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxAUI_NB_DEFAULT_STYLE); - - virtual ~wxAuiNotebook(); - - bool Create(wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0); - - void SetWindowStyleFlag(long style); - void SetArtProvider(wxAuiTabArt* art); - wxAuiTabArt* GetArtProvider() const; - - virtual void SetUniformBitmapSize(const wxSize& size); - virtual void SetTabCtrlHeight(int height); - - bool AddPage(wxWindow* page, - const wxString& caption, - bool select = false, - const wxBitmap& bitmap = wxNullBitmap); - - bool InsertPage(size_t page_idx, - wxWindow* page, - const wxString& caption, - bool select = false, - const wxBitmap& bitmap = wxNullBitmap); - - bool DeletePage(size_t page); - bool RemovePage(size_t page); - - size_t GetPageCount() const; - wxWindow* GetPage(size_t page_idx) const; - int GetPageIndex(wxWindow* page_wnd) const; - - bool SetPageText(size_t page, const wxString& text); - wxString GetPageText(size_t page_idx) const; - - bool SetPageBitmap(size_t page, const wxBitmap& bitmap); - wxBitmap GetPageBitmap(size_t page_idx) const; - - size_t SetSelection(size_t new_page); - int GetSelection() const; - - virtual void Split(size_t page, int direction); - -#if wxABI_VERSION >= 20801 - const wxAuiManager& GetAuiManager() const { return m_mgr; } -#endif - -#if wxABI_VERSION >= 20805 - // Sets the normal font - void SetNormalFont(const wxFont& font); - - // Sets the selected tab font - void SetSelectedFont(const wxFont& font); - - // Sets the measuring font - void SetMeasuringFont(const wxFont& font); - - // Sets the tab font - virtual bool SetFont(const wxFont& font); - - // Gets the tab control height - int GetTabCtrlHeight() const; - - // Gets the height of the notebook for a given page height - int GetHeightForPageHeight(int pageHeight); - - // Advances the selection, generation page selection events - void AdvanceSelection(bool forward = true); - - // Shows the window menu - bool ShowWindowMenu(); -#endif - -protected: - - // these can be overridden - virtual void UpdateTabCtrlHeight(); - virtual int CalculateTabCtrlHeight(); - virtual wxSize CalculateNewSplitSize(); - -protected: - - void DoSizing(); - void InitNotebook(long style); - wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); - wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl); - wxAuiTabCtrl* GetActiveTabCtrl(); - bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx); - void RemoveEmptyTabFrames(); - void UpdateHintWindowSize(); - -protected: - - void OnChildFocus(wxChildFocusEvent& evt); - void OnRender(wxAuiManagerEvent& evt); - void OnSize(wxSizeEvent& evt); - void OnTabClicked(wxCommandEvent& evt); - void OnTabBeginDrag(wxCommandEvent& evt); - void OnTabDragMotion(wxCommandEvent& evt); - void OnTabEndDrag(wxCommandEvent& evt); - void OnTabButton(wxCommandEvent& evt); -#if wxABI_VERSION >= 20805 - void OnTabMiddleDown(wxCommandEvent& evt); - void OnTabMiddleUp(wxCommandEvent& evt); - void OnTabRightDown(wxCommandEvent& evt); - void OnTabRightUp(wxCommandEvent& evt); - void OnNavigationKey(wxNavigationKeyEvent& event); - void OnTabBgDClick(wxCommandEvent& evt); -#endif - -protected: - - wxAuiManager m_mgr; - wxAuiTabContainer m_tabs; - int m_curpage; - int m_tab_id_counter; - wxWindow* m_dummy_wnd; - - wxSize m_requested_bmp_size; - int m_requested_tabctrl_height; - wxFont m_selected_font; - wxFont m_normal_font; - int m_tab_ctrl_height; - - int m_last_drag_x; - unsigned int m_flags; - -#ifndef SWIG - DECLARE_CLASS(wxAuiNotebook) - DECLARE_EVENT_TABLE() -#endif -}; - - - - -// wx event machinery - -#ifndef SWIG - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 0) -#if wxABI_VERSION >= 20805 - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 0) -#endif -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&); - -#define wxAuiNotebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiNotebookEventFunction, &func) - -#define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn)) - -#if wxABI_VERSION >= 20805 -#define EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, winid, wxAuiNotebookEventHandler(fn)) -#endif - -#else - -// wxpython/swig event work -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BUTTON; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_END_DRAG; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN; -%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP; - -%pythoncode { - EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 1 ) - EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 1 ) - EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 1 ) - EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 1 ) - EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 1 ) - EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 1 ) - EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 1 ) - EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 1 ) - EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 1 ) - EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 1 ) - EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 1 ) - EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 ) - EVT_AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP , 1 ) - EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 ) - EVT_AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 1 ) -} -#endif - - -#endif // wxUSE_AUI -#endif // _WX_AUINOTEBOOK_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/auibook.h +// Purpose: wxaui: wx advanced user interface - notebook +// Author: Benjamin I. Williams +// Modified by: +// Created: 2006-06-28 +// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + + + +#ifndef _WX_AUINOTEBOOK_H_ +#define _WX_AUINOTEBOOK_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/aui/framemanager.h" +#include "wx/aui/dockart.h" +#include "wx/aui/floatpane.h" +#include "wx/control.h" + + +class wxAuiNotebook; + + +enum wxAuiNotebookOption +{ + wxAUI_NB_TOP = 1 << 0, + wxAUI_NB_LEFT = 1 << 1, // not implemented yet + wxAUI_NB_RIGHT = 1 << 2, // not implemented yet + wxAUI_NB_BOTTOM = 1 << 3, + wxAUI_NB_TAB_SPLIT = 1 << 4, + wxAUI_NB_TAB_MOVE = 1 << 5, + wxAUI_NB_TAB_EXTERNAL_MOVE = 1 << 6, + wxAUI_NB_TAB_FIXED_WIDTH = 1 << 7, + wxAUI_NB_SCROLL_BUTTONS = 1 << 8, + wxAUI_NB_WINDOWLIST_BUTTON = 1 << 9, + wxAUI_NB_CLOSE_BUTTON = 1 << 10, + wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 11, + wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 12, + wxAUI_NB_MIDDLE_CLICK_CLOSE = 1 << 13, + + wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP | + wxAUI_NB_TAB_SPLIT | + wxAUI_NB_TAB_MOVE | + wxAUI_NB_SCROLL_BUTTONS | + wxAUI_NB_CLOSE_ON_ACTIVE_TAB | + wxAUI_NB_MIDDLE_CLICK_CLOSE +}; + + + + +// aui notebook event class + +class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent +{ +public: + wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, + int win_id = 0) + : wxNotifyEvent(command_type, win_id) + { + old_selection = -1; + selection = -1; + drag_source = NULL; + } +#ifndef SWIG + wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxNotifyEvent(c) + { + old_selection = c.old_selection; + selection = c.selection; + drag_source = c.drag_source; + } +#endif + wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); } + + void SetSelection(int s) { selection = s; m_commandInt = s; } + int GetSelection() const { return selection; } + + void SetOldSelection(int s) { old_selection = s; } + int GetOldSelection() const { return old_selection; } + + void SetDragSource(wxAuiNotebook* s) { drag_source = s; } + wxAuiNotebook* GetDragSource() const { return drag_source; } + +public: + int old_selection; + int selection; + wxAuiNotebook* drag_source; + +#ifndef SWIG +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent) +#endif +}; + + +class WXDLLIMPEXP_AUI wxAuiNotebookPage +{ +public: + wxWindow* window; // page's associated window + wxString caption; // caption displayed on the tab + wxBitmap bitmap; // tab's bitmap + wxRect rect; // tab's hit rectangle + bool active; // true if the page is currently active +}; + +class WXDLLIMPEXP_AUI wxAuiTabContainerButton +{ +public: + + int id; // button's id + int cur_state; // current state (normal, hover, pressed, etc.) + int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER) + wxBitmap bitmap; // button's hover bitmap + wxBitmap dis_bitmap; // button's disabled bitmap + wxRect rect; // button's hit rectangle +}; + + +#ifndef SWIG +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI); +#endif + + +// tab art class + +class WXDLLIMPEXP_AUI wxAuiTabArt +{ +public: + + wxAuiTabArt() { } + virtual ~wxAuiTabArt() { } + + virtual wxAuiTabArt* Clone() = 0; + virtual void SetFlags(unsigned int flags) = 0; + + virtual void SetSizingInfo(const wxSize& tab_ctrl_size, + size_t tab_count) = 0; + + virtual void SetNormalFont(const wxFont& font) = 0; + virtual void SetSelectedFont(const wxFont& font) = 0; + virtual void SetMeasuringFont(const wxFont& font) = 0; + + virtual void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& in_rect, + int close_button_state, + wxRect* out_tab_rect, + wxRect* out_button_rect, + int* x_extent) = 0; + + virtual void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& in_rect, + int bitmap_id, + int button_state, + int orientation, + wxRect* out_rect) = 0; + + virtual wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmap& bitmap, + bool active, + int close_button_state, + int* x_extent) = 0; + + virtual int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int active_idx) = 0; + + virtual int GetIndentSize() = 0; + + virtual int GetBestTabCtrlSize( + wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& required_bmp_size) = 0; +}; + + +class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt +{ + +public: + + wxAuiDefaultTabArt(); + virtual ~wxAuiDefaultTabArt(); + + wxAuiTabArt* Clone(); + void SetFlags(unsigned int flags); + void SetSizingInfo(const wxSize& tab_ctrl_size, + size_t tab_count); + + void SetNormalFont(const wxFont& font); + void SetSelectedFont(const wxFont& font); + void SetMeasuringFont(const wxFont& font); + + void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& in_rect, + int close_button_state, + wxRect* out_tab_rect, + wxRect* out_button_rect, + int* x_extent); + + void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& in_rect, + int bitmap_id, + int button_state, + int orientation, + wxRect* out_rect); + + int GetIndentSize(); + + wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmap& bitmap, + bool active, + int close_button_state, + int* x_extent); + + int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int active_idx); + + int GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& required_bmp_size); + +protected: + + wxFont m_normal_font; + wxFont m_selected_font; + wxFont m_measuring_font; + wxColour m_base_colour; + wxPen m_base_colour_pen; + wxPen m_border_pen; + wxBrush m_base_colour_brush; + wxBitmap m_active_close_bmp; + wxBitmap m_disabled_close_bmp; + wxBitmap m_active_left_bmp; + wxBitmap m_disabled_left_bmp; + wxBitmap m_active_right_bmp; + wxBitmap m_disabled_right_bmp; + wxBitmap m_active_windowlist_bmp; + wxBitmap m_disabled_windowlist_bmp; + + int m_fixed_tab_width; + int m_tab_ctrl_height; + unsigned int m_flags; +}; + + +class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt +{ + +public: + + wxAuiSimpleTabArt(); + virtual ~wxAuiSimpleTabArt(); + + wxAuiTabArt* Clone(); + void SetFlags(unsigned int flags); + + void SetSizingInfo(const wxSize& tab_ctrl_size, + size_t tab_count); + + void SetNormalFont(const wxFont& font); + void SetSelectedFont(const wxFont& font); + void SetMeasuringFont(const wxFont& font); + + void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& in_rect, + int close_button_state, + wxRect* out_tab_rect, + wxRect* out_button_rect, + int* x_extent); + + void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& in_rect, + int bitmap_id, + int button_state, + int orientation, + wxRect* out_rect); + + int GetIndentSize(); + + wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmap& bitmap, + bool active, + int close_button_state, + int* x_extent); + + int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int active_idx); + + int GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& required_bmp_size); + +protected: + + wxFont m_normal_font; + wxFont m_selected_font; + wxFont m_measuring_font; + wxPen m_normal_bkpen; + wxPen m_selected_bkpen; + wxBrush m_normal_bkbrush; + wxBrush m_selected_bkbrush; + wxBrush m_bkbrush; + wxBitmap m_active_close_bmp; + wxBitmap m_disabled_close_bmp; + wxBitmap m_active_left_bmp; + wxBitmap m_disabled_left_bmp; + wxBitmap m_active_right_bmp; + wxBitmap m_disabled_right_bmp; + wxBitmap m_active_windowlist_bmp; + wxBitmap m_disabled_windowlist_bmp; + + int m_fixed_tab_width; + unsigned int m_flags; +}; + + + + + + + + + +class WXDLLIMPEXP_AUI wxAuiTabContainer +{ +public: + + wxAuiTabContainer(); + virtual ~wxAuiTabContainer(); + + void SetArtProvider(wxAuiTabArt* art); + wxAuiTabArt* GetArtProvider() const; + + void SetFlags(unsigned int flags); + unsigned int GetFlags() const; + + bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); + bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); + bool MovePage(wxWindow* page, size_t new_idx); + bool RemovePage(wxWindow* page); + bool SetActivePage(wxWindow* page); + bool SetActivePage(size_t page); + void SetNoneActive(); + int GetActivePage() const; + bool TabHitTest(int x, int y, wxWindow** hit) const; + bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const; + wxWindow* GetWindowFromIdx(size_t idx) const; + int GetIdxFromWindow(wxWindow* page) const; + size_t GetPageCount() const; + wxAuiNotebookPage& GetPage(size_t idx); + const wxAuiNotebookPage& GetPage(size_t idx) const; + wxAuiNotebookPageArray& GetPages(); + void SetNormalFont(const wxFont& normal_font); + void SetSelectedFont(const wxFont& selected_font); + void SetMeasuringFont(const wxFont& measuring_font); + void DoShowHide(); + void SetRect(const wxRect& rect); + + void RemoveButton(int id); + void AddButton(int id, + int location, + const wxBitmap& normal_bitmap = wxNullBitmap, + const wxBitmap& disabled_bitmap = wxNullBitmap); + + size_t GetTabOffset() const; + void SetTabOffset(size_t offset); + + // Is the tab visible? + bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd); + + // Make the tab visible if it wasn't already + void MakeTabVisible(int tabPage, wxWindow* win); + +protected: + + virtual void Render(wxDC* dc, wxWindow* wnd); + +protected: + + wxAuiTabArt* m_art; + wxAuiNotebookPageArray m_pages; + wxAuiTabContainerButtonArray m_buttons; + wxAuiTabContainerButtonArray m_tab_close_buttons; + wxRect m_rect; + size_t m_tab_offset; + unsigned int m_flags; +}; + + + +class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl, + public wxAuiTabContainer +{ +public: + + wxAuiTabCtrl(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + ~wxAuiTabCtrl(); + +#if wxABI_VERSION >= 20805 + bool IsDragging() const { return m_is_dragging; } +#endif + +protected: + + void OnPaint(wxPaintEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnLeftDown(wxMouseEvent& evt); + void OnLeftUp(wxMouseEvent& evt); +#if wxABI_VERSION >= 20805 + void OnMiddleDown(wxMouseEvent& evt); + void OnMiddleUp(wxMouseEvent& evt); + void OnRightDown(wxMouseEvent& evt); + void OnRightUp(wxMouseEvent& evt); + void OnLeftDClick(wxMouseEvent& evt); + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + void OnChar(wxKeyEvent& event); +#endif + void OnMotion(wxMouseEvent& evt); + void OnLeaveWindow(wxMouseEvent& evt); + void OnButton(wxAuiNotebookEvent& evt); + + +protected: + + wxPoint m_click_pt; + wxWindow* m_click_tab; + bool m_is_dragging; + wxAuiTabContainerButton* m_hover_button; + wxAuiTabContainerButton* m_pressed_button; + +#ifndef SWIG + DECLARE_CLASS(wxAuiTabCtrl) + DECLARE_EVENT_TABLE() +#endif +}; + + + + +class WXDLLIMPEXP_AUI wxAuiNotebook : public wxControl +{ + +public: + + wxAuiNotebook(); + + wxAuiNotebook(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAUI_NB_DEFAULT_STYLE); + + virtual ~wxAuiNotebook(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + void SetWindowStyleFlag(long style); + void SetArtProvider(wxAuiTabArt* art); + wxAuiTabArt* GetArtProvider() const; + + virtual void SetUniformBitmapSize(const wxSize& size); + virtual void SetTabCtrlHeight(int height); + + bool AddPage(wxWindow* page, + const wxString& caption, + bool select = false, + const wxBitmap& bitmap = wxNullBitmap); + + bool InsertPage(size_t page_idx, + wxWindow* page, + const wxString& caption, + bool select = false, + const wxBitmap& bitmap = wxNullBitmap); + + bool DeletePage(size_t page); + bool RemovePage(size_t page); + + size_t GetPageCount() const; + wxWindow* GetPage(size_t page_idx) const; + int GetPageIndex(wxWindow* page_wnd) const; + + bool SetPageText(size_t page, const wxString& text); + wxString GetPageText(size_t page_idx) const; + + bool SetPageBitmap(size_t page, const wxBitmap& bitmap); + wxBitmap GetPageBitmap(size_t page_idx) const; + + size_t SetSelection(size_t new_page); + int GetSelection() const; + + virtual void Split(size_t page, int direction); + +#if wxABI_VERSION >= 20801 + const wxAuiManager& GetAuiManager() const { return m_mgr; } +#endif + +#if wxABI_VERSION >= 20805 + // Sets the normal font + void SetNormalFont(const wxFont& font); + + // Sets the selected tab font + void SetSelectedFont(const wxFont& font); + + // Sets the measuring font + void SetMeasuringFont(const wxFont& font); + + // Sets the tab font + virtual bool SetFont(const wxFont& font); + + // Gets the tab control height + int GetTabCtrlHeight() const; + + // Gets the height of the notebook for a given page height + int GetHeightForPageHeight(int pageHeight); + + // Advances the selection, generation page selection events + void AdvanceSelection(bool forward = true); + + // Shows the window menu + bool ShowWindowMenu(); +#endif + +protected: + + // these can be overridden + virtual void UpdateTabCtrlHeight(); + virtual int CalculateTabCtrlHeight(); + virtual wxSize CalculateNewSplitSize(); + +protected: + + void DoSizing(); + void InitNotebook(long style); + wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); + wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl); + wxAuiTabCtrl* GetActiveTabCtrl(); + bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx); + void RemoveEmptyTabFrames(); + void UpdateHintWindowSize(); + +protected: + + void OnChildFocus(wxChildFocusEvent& evt); + void OnRender(wxAuiManagerEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnTabClicked(wxCommandEvent& evt); + void OnTabBeginDrag(wxCommandEvent& evt); + void OnTabDragMotion(wxCommandEvent& evt); + void OnTabEndDrag(wxCommandEvent& evt); + void OnTabButton(wxCommandEvent& evt); +#if wxABI_VERSION >= 20805 + void OnTabMiddleDown(wxCommandEvent& evt); + void OnTabMiddleUp(wxCommandEvent& evt); + void OnTabRightDown(wxCommandEvent& evt); + void OnTabRightUp(wxCommandEvent& evt); + void OnNavigationKey(wxNavigationKeyEvent& event); + void OnTabBgDClick(wxCommandEvent& evt); +#endif + +protected: + + wxAuiManager m_mgr; + wxAuiTabContainer m_tabs; + int m_curpage; + int m_tab_id_counter; + wxWindow* m_dummy_wnd; + + wxSize m_requested_bmp_size; + int m_requested_tabctrl_height; + wxFont m_selected_font; + wxFont m_normal_font; + int m_tab_ctrl_height; + + int m_last_drag_x; + unsigned int m_flags; + +#ifndef SWIG + DECLARE_CLASS(wxAuiNotebook) + DECLARE_EVENT_TABLE() +#endif +}; + + + + +// wx event machinery + +#ifndef SWIG + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 0) +#if wxABI_VERSION >= 20805 + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 0) +#endif +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&); + +#define wxAuiNotebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiNotebookEventFunction, &func) + +#define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn)) + +#if wxABI_VERSION >= 20805 +#define EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, winid, wxAuiNotebookEventHandler(fn)) +#endif + +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BUTTON; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_END_DRAG; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN; +%constant wxEventType wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP; + +%pythoncode { + EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 1 ) + EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 1 ) + EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 1 ) + EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 1 ) + EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 1 ) + EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 1 ) + EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 1 ) + EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 1 ) + EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 1 ) + EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 1 ) + EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 1 ) + EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 ) + EVT_AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP , 1 ) + EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 ) + EVT_AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 1 ) +} +#endif + + +#endif // wxUSE_AUI +#endif // _WX_AUINOTEBOOK_H_ diff --git a/Externals/wxWidgets/include/wx/aui/dockart.h b/Externals/wxWidgets/include/wx/aui/dockart.h index 4ff4a5122f..0c5bfe2a6a 100644 --- a/Externals/wxWidgets/include/wx/aui/dockart.h +++ b/Externals/wxWidgets/include/wx/aui/dockart.h @@ -1,173 +1,173 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/aui/dockart.h -// Purpose: wxaui: wx advanced user interface - docking window manager -// Author: Benjamin I. Williams -// Modified by: -// Created: 2005-05-17 -// RCS-ID: $Id: dockart.h 43154 2006-11-07 10:29:02Z BIW $ -// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. -// Licence: wxWindows Library Licence, Version 3.1 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DOCKART_H_ -#define _WX_DOCKART_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_AUI - -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/bitmap.h" -#include "wx/colour.h" - -// dock art provider code - a dock provider provides all drawing -// functionality to the wxAui dock manager. This allows the dock -// manager to have plugable look-and-feels - -class WXDLLIMPEXP_AUI wxAuiDockArt -{ -public: - - wxAuiDockArt() { } - virtual ~wxAuiDockArt() { } - - virtual int GetMetric(int id) = 0; - virtual void SetMetric(int id, int new_val) = 0; - virtual void SetFont(int id, const wxFont& font) = 0; - virtual wxFont GetFont(int id) = 0; - virtual wxColour GetColour(int id) = 0; - virtual void SetColour(int id, const wxColor& colour) = 0; - wxColour GetColor(int id) { return GetColour(id); } - void SetColor(int id, const wxColour& color) { SetColour(id, color); } - - virtual void DrawSash(wxDC& dc, - wxWindow* window, - int orientation, - const wxRect& rect) = 0; - - virtual void DrawBackground(wxDC& dc, - wxWindow* window, - int orientation, - const wxRect& rect) = 0; - - virtual void DrawCaption(wxDC& dc, - wxWindow* window, - const wxString& text, - const wxRect& rect, - wxAuiPaneInfo& pane) = 0; - - virtual void DrawGripper(wxDC& dc, - wxWindow* window, - const wxRect& rect, - wxAuiPaneInfo& pane) = 0; - - virtual void DrawBorder(wxDC& dc, - wxWindow* window, - const wxRect& rect, - wxAuiPaneInfo& pane) = 0; - - virtual void DrawPaneButton(wxDC& dc, - wxWindow* window, - int button, - int button_state, - const wxRect& rect, - wxAuiPaneInfo& pane) = 0; -}; - - -// this is the default art provider for wxAuiManager. Dock art -// can be customized by creating a class derived from this one, -// or replacing this class entirely - -class WXDLLIMPEXP_AUI wxAuiDefaultDockArt : public wxAuiDockArt -{ -public: - - wxAuiDefaultDockArt(); - - int GetMetric(int metric_id); - void SetMetric(int metric_id, int new_val); - wxColour GetColour(int id); - void SetColour(int id, const wxColor& colour); - void SetFont(int id, const wxFont& font); - wxFont GetFont(int id); - - void DrawSash(wxDC& dc, - wxWindow *window, - int orientation, - const wxRect& rect); - - void DrawBackground(wxDC& dc, - wxWindow *window, - int orientation, - const wxRect& rect); - - void DrawCaption(wxDC& dc, - wxWindow *window, - const wxString& text, - const wxRect& rect, - wxAuiPaneInfo& pane); - - void DrawGripper(wxDC& dc, - wxWindow *window, - const wxRect& rect, - wxAuiPaneInfo& pane); - - void DrawBorder(wxDC& dc, - wxWindow *window, - const wxRect& rect, - wxAuiPaneInfo& pane); - - void DrawPaneButton(wxDC& dc, - wxWindow *window, - int button, - int button_state, - const wxRect& rect, - wxAuiPaneInfo& pane); - -protected: - - void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active); - -protected: - - wxPen m_border_pen; - wxBrush m_sash_brush; - wxBrush m_background_brush; - wxBrush m_gripper_brush; - wxFont m_caption_font; - wxBitmap m_inactive_close_bitmap; - wxBitmap m_inactive_pin_bitmap; - wxBitmap m_inactive_maximize_bitmap; - wxBitmap m_inactive_restore_bitmap; - wxBitmap m_active_close_bitmap; - wxBitmap m_active_pin_bitmap; - wxBitmap m_active_maximize_bitmap; - wxBitmap m_active_restore_bitmap; - wxPen m_gripper_pen1; - wxPen m_gripper_pen2; - wxPen m_gripper_pen3; - wxColour m_base_colour; - wxColour m_active_caption_colour; - wxColour m_active_caption_gradient_colour; - wxColour m_active_caption_text_colour; - wxColour m_inactive_caption_colour; - wxColour m_inactive_caption_gradient_colour; - wxColour m_inactive_caption_text_colour; - int m_border_size; - int m_caption_size; - int m_sash_size; - int m_button_size; - int m_gripper_size; - int m_gradient_type; -}; - - - -#endif // wxUSE_AUI -#endif //_WX_DOCKART_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/dockart.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// RCS-ID: $Id: dockart.h 43154 2006-11-07 10:29:02Z BIW $ +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DOCKART_H_ +#define _WX_DOCKART_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/bitmap.h" +#include "wx/colour.h" + +// dock art provider code - a dock provider provides all drawing +// functionality to the wxAui dock manager. This allows the dock +// manager to have plugable look-and-feels + +class WXDLLIMPEXP_AUI wxAuiDockArt +{ +public: + + wxAuiDockArt() { } + virtual ~wxAuiDockArt() { } + + virtual int GetMetric(int id) = 0; + virtual void SetMetric(int id, int new_val) = 0; + virtual void SetFont(int id, const wxFont& font) = 0; + virtual wxFont GetFont(int id) = 0; + virtual wxColour GetColour(int id) = 0; + virtual void SetColour(int id, const wxColor& colour) = 0; + wxColour GetColor(int id) { return GetColour(id); } + void SetColor(int id, const wxColour& color) { SetColour(id, color); } + + virtual void DrawSash(wxDC& dc, + wxWindow* window, + int orientation, + const wxRect& rect) = 0; + + virtual void DrawBackground(wxDC& dc, + wxWindow* window, + int orientation, + const wxRect& rect) = 0; + + virtual void DrawCaption(wxDC& dc, + wxWindow* window, + const wxString& text, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + virtual void DrawGripper(wxDC& dc, + wxWindow* window, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + virtual void DrawBorder(wxDC& dc, + wxWindow* window, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + virtual void DrawPaneButton(wxDC& dc, + wxWindow* window, + int button, + int button_state, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; +}; + + +// this is the default art provider for wxAuiManager. Dock art +// can be customized by creating a class derived from this one, +// or replacing this class entirely + +class WXDLLIMPEXP_AUI wxAuiDefaultDockArt : public wxAuiDockArt +{ +public: + + wxAuiDefaultDockArt(); + + int GetMetric(int metric_id); + void SetMetric(int metric_id, int new_val); + wxColour GetColour(int id); + void SetColour(int id, const wxColor& colour); + void SetFont(int id, const wxFont& font); + wxFont GetFont(int id); + + void DrawSash(wxDC& dc, + wxWindow *window, + int orientation, + const wxRect& rect); + + void DrawBackground(wxDC& dc, + wxWindow *window, + int orientation, + const wxRect& rect); + + void DrawCaption(wxDC& dc, + wxWindow *window, + const wxString& text, + const wxRect& rect, + wxAuiPaneInfo& pane); + + void DrawGripper(wxDC& dc, + wxWindow *window, + const wxRect& rect, + wxAuiPaneInfo& pane); + + void DrawBorder(wxDC& dc, + wxWindow *window, + const wxRect& rect, + wxAuiPaneInfo& pane); + + void DrawPaneButton(wxDC& dc, + wxWindow *window, + int button, + int button_state, + const wxRect& rect, + wxAuiPaneInfo& pane); + +protected: + + void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active); + +protected: + + wxPen m_border_pen; + wxBrush m_sash_brush; + wxBrush m_background_brush; + wxBrush m_gripper_brush; + wxFont m_caption_font; + wxBitmap m_inactive_close_bitmap; + wxBitmap m_inactive_pin_bitmap; + wxBitmap m_inactive_maximize_bitmap; + wxBitmap m_inactive_restore_bitmap; + wxBitmap m_active_close_bitmap; + wxBitmap m_active_pin_bitmap; + wxBitmap m_active_maximize_bitmap; + wxBitmap m_active_restore_bitmap; + wxPen m_gripper_pen1; + wxPen m_gripper_pen2; + wxPen m_gripper_pen3; + wxColour m_base_colour; + wxColour m_active_caption_colour; + wxColour m_active_caption_gradient_colour; + wxColour m_active_caption_text_colour; + wxColour m_inactive_caption_colour; + wxColour m_inactive_caption_gradient_colour; + wxColour m_inactive_caption_text_colour; + int m_border_size; + int m_caption_size; + int m_sash_size; + int m_button_size; + int m_gripper_size; + int m_gradient_type; +}; + + + +#endif // wxUSE_AUI +#endif //_WX_DOCKART_H_ diff --git a/Externals/wxWidgets/include/wx/aui/floatpane.h b/Externals/wxWidgets/include/wx/aui/floatpane.h index 34baea5bc0..7529594771 100644 --- a/Externals/wxWidgets/include/wx/aui/floatpane.h +++ b/Externals/wxWidgets/include/wx/aui/floatpane.h @@ -1,81 +1,81 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/aui/floatpane.h -// Purpose: wxaui: wx advanced user interface - docking window manager -// Author: Benjamin I. Williams -// Modified by: -// Created: 2005-05-17 -// RCS-ID: $Id: floatpane.h 43467 2006-11-17 13:07:01Z BIW $ -// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. -// Licence: wxWindows Library Licence, Version 3.1 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FLOATPANE_H_ -#define _WX_FLOATPANE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_AUI - -#include "wx/frame.h" - -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) || defined( __WXGTK__ ) -#include "wx/minifram.h" -#define wxAuiFloatingFrameBaseClass wxMiniFrame -#else -#define wxAuiFloatingFrameBaseClass wxFrame -#endif - -class WXDLLIMPEXP_AUI wxAuiFloatingFrame : public wxAuiFloatingFrameBaseClass -{ -public: - wxAuiFloatingFrame(wxWindow* parent, - wxAuiManager* owner_mgr, - const wxAuiPaneInfo& pane, - wxWindowID id = wxID_ANY, - long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | - wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT | - wxCLIP_CHILDREN - ); - virtual ~wxAuiFloatingFrame(); - void SetPaneWindow(const wxAuiPaneInfo& pane); - wxAuiManager* GetOwnerManager() const; - -protected: - virtual void OnMoveStart(); - virtual void OnMoving(const wxRect& window_rect, wxDirection dir); - virtual void OnMoveFinished(); - -private: - void OnSize(wxSizeEvent& event); - void OnClose(wxCloseEvent& event); - void OnMoveEvent(wxMoveEvent& event); - void OnIdle(wxIdleEvent& event); - void OnActivate(wxActivateEvent& event); - static bool isMouseDown(); - -private: - wxWindow* m_pane_window; // pane window being managed - bool m_solid_drag; // true if system uses solid window drag - bool m_moving; - wxRect m_last_rect; - wxRect m_last2_rect; - wxRect m_last3_rect; - wxSize m_last_size; - wxDirection m_lastDirection; - - wxAuiManager* m_owner_mgr; - wxAuiManager m_mgr; - -#ifndef SWIG - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxAuiFloatingFrame) -#endif // SWIG -}; - -#endif // wxUSE_AUI -#endif //_WX_FLOATPANE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/floatpane.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// RCS-ID: $Id: floatpane.h 43467 2006-11-17 13:07:01Z BIW $ +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FLOATPANE_H_ +#define _WX_FLOATPANE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/frame.h" + +#if defined( __WXMSW__ ) || defined( __WXMAC__ ) || defined( __WXGTK__ ) +#include "wx/minifram.h" +#define wxAuiFloatingFrameBaseClass wxMiniFrame +#else +#define wxAuiFloatingFrameBaseClass wxFrame +#endif + +class WXDLLIMPEXP_AUI wxAuiFloatingFrame : public wxAuiFloatingFrameBaseClass +{ +public: + wxAuiFloatingFrame(wxWindow* parent, + wxAuiManager* owner_mgr, + const wxAuiPaneInfo& pane, + wxWindowID id = wxID_ANY, + long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | + wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT | + wxCLIP_CHILDREN + ); + virtual ~wxAuiFloatingFrame(); + void SetPaneWindow(const wxAuiPaneInfo& pane); + wxAuiManager* GetOwnerManager() const; + +protected: + virtual void OnMoveStart(); + virtual void OnMoving(const wxRect& window_rect, wxDirection dir); + virtual void OnMoveFinished(); + +private: + void OnSize(wxSizeEvent& event); + void OnClose(wxCloseEvent& event); + void OnMoveEvent(wxMoveEvent& event); + void OnIdle(wxIdleEvent& event); + void OnActivate(wxActivateEvent& event); + static bool isMouseDown(); + +private: + wxWindow* m_pane_window; // pane window being managed + bool m_solid_drag; // true if system uses solid window drag + bool m_moving; + wxRect m_last_rect; + wxRect m_last2_rect; + wxRect m_last3_rect; + wxSize m_last_size; + wxDirection m_lastDirection; + + wxAuiManager* m_owner_mgr; + wxAuiManager m_mgr; + +#ifndef SWIG + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxAuiFloatingFrame) +#endif // SWIG +}; + +#endif // wxUSE_AUI +#endif //_WX_FLOATPANE_H_ + diff --git a/Externals/wxWidgets/include/wx/aui/framemanager.h b/Externals/wxWidgets/include/wx/aui/framemanager.h index defd1033e6..0b04c4b4b1 100644 --- a/Externals/wxWidgets/include/wx/aui/framemanager.h +++ b/Externals/wxWidgets/include/wx/aui/framemanager.h @@ -1,851 +1,851 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/aui/framemanager.h -// Purpose: wxaui: wx advanced user interface - docking window manager -// Author: Benjamin I. Williams -// Modified by: -// Created: 2005-05-17 -// RCS-ID: $Id: framemanager.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. -// Licence: wxWindows Library Licence, Version 3.1 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FRAMEMANAGER_H_ -#define _WX_FRAMEMANAGER_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_AUI - -#include "wx/dynarray.h" -#include "wx/gdicmn.h" -#include "wx/window.h" -#include "wx/timer.h" -#include "wx/sizer.h" - -enum wxAuiManagerDock -{ - wxAUI_DOCK_NONE = 0, - wxAUI_DOCK_TOP = 1, - wxAUI_DOCK_RIGHT = 2, - wxAUI_DOCK_BOTTOM = 3, - wxAUI_DOCK_LEFT = 4, - wxAUI_DOCK_CENTER = 5, - wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER -}; - -enum wxAuiManagerOption -{ - wxAUI_MGR_ALLOW_FLOATING = 1 << 0, - wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1, - wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2, - wxAUI_MGR_TRANSPARENT_HINT = 1 << 3, - wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4, - wxAUI_MGR_RECTANGLE_HINT = 1 << 5, - wxAUI_MGR_HINT_FADE = 1 << 6, - wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7, - - wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING | - wxAUI_MGR_TRANSPARENT_HINT | - wxAUI_MGR_HINT_FADE | - wxAUI_MGR_NO_VENETIAN_BLINDS_FADE -}; - - -enum wxAuiPaneDockArtSetting -{ - wxAUI_DOCKART_SASH_SIZE = 0, - wxAUI_DOCKART_CAPTION_SIZE = 1, - wxAUI_DOCKART_GRIPPER_SIZE = 2, - wxAUI_DOCKART_PANE_BORDER_SIZE = 3, - wxAUI_DOCKART_PANE_BUTTON_SIZE = 4, - wxAUI_DOCKART_BACKGROUND_COLOUR = 5, - wxAUI_DOCKART_SASH_COLOUR = 6, - wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7, - wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8, - wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9, - wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10, - wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11, - wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12, - wxAUI_DOCKART_BORDER_COLOUR = 13, - wxAUI_DOCKART_GRIPPER_COLOUR = 14, - wxAUI_DOCKART_CAPTION_FONT = 15, - wxAUI_DOCKART_GRADIENT_TYPE = 16 -}; - -enum wxAuiPaneDockArtGradients -{ - wxAUI_GRADIENT_NONE = 0, - wxAUI_GRADIENT_VERTICAL = 1, - wxAUI_GRADIENT_HORIZONTAL = 2 -}; - -enum wxAuiPaneButtonState -{ - wxAUI_BUTTON_STATE_NORMAL = 0, - wxAUI_BUTTON_STATE_HOVER = 1 << 1, - wxAUI_BUTTON_STATE_PRESSED = 1 << 2, - wxAUI_BUTTON_STATE_DISABLED = 1 << 3, - wxAUI_BUTTON_STATE_HIDDEN = 1 << 4, - wxAUI_BUTTON_STATE_CHECKED = 1 << 5 -}; - -enum wxAuiButtonId -{ - wxAUI_BUTTON_CLOSE = 101, - wxAUI_BUTTON_MAXIMIZE_RESTORE = 102, - wxAUI_BUTTON_MINIMIZE = 103, - wxAUI_BUTTON_PIN = 104, - wxAUI_BUTTON_OPTIONS = 105, - wxAUI_BUTTON_WINDOWLIST = 106, - wxAUI_BUTTON_LEFT = 107, - wxAUI_BUTTON_RIGHT = 108, - wxAUI_BUTTON_UP = 109, - wxAUI_BUTTON_DOWN = 110, - wxAUI_BUTTON_CUSTOM1 = 201, - wxAUI_BUTTON_CUSTOM2 = 202, - wxAUI_BUTTON_CUSTOM3 = 203 -}; - -enum wxAuiPaneInsertLevel -{ - wxAUI_INSERT_PANE = 0, - wxAUI_INSERT_ROW = 1, - wxAUI_INSERT_DOCK = 2 -}; - - - - -// forwards and array declarations -class wxAuiDockUIPart; -class wxAuiPaneButton; -class wxAuiPaneInfo; -class wxAuiDockInfo; -class wxAuiDockArt; -class wxAuiManagerEvent; - -#ifndef SWIG -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI); -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI); -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI); -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI); -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI); -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI); -#endif // SWIG - -extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo; -extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo; - - - -class WXDLLIMPEXP_AUI wxAuiPaneInfo -{ -public: - - wxAuiPaneInfo() - { - window = NULL; - frame = NULL; - state = 0; - dock_direction = wxAUI_DOCK_LEFT; - dock_layer = 0; - dock_row = 0; - dock_pos = 0; - floating_pos = wxDefaultPosition; - floating_size = wxDefaultSize; - best_size = wxDefaultSize; - min_size = wxDefaultSize; - max_size = wxDefaultSize; - dock_proportion = 0; - - DefaultPane(); - } - - ~wxAuiPaneInfo() {} - -#ifndef SWIG - wxAuiPaneInfo(const wxAuiPaneInfo& c) - { - name = c.name; - caption = c.caption; - window = c.window; - frame = c.frame; - state = c.state; - dock_direction = c.dock_direction; - dock_layer = c.dock_layer; - dock_row = c.dock_row; - dock_pos = c.dock_pos; - best_size = c.best_size; - min_size = c.min_size; - max_size = c.max_size; - floating_pos = c.floating_pos; - floating_size = c.floating_size; - dock_proportion = c.dock_proportion; - buttons = c.buttons; - rect = c.rect; - } - - wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c) - { - name = c.name; - caption = c.caption; - window = c.window; - frame = c.frame; - state = c.state; - dock_direction = c.dock_direction; - dock_layer = c.dock_layer; - dock_row = c.dock_row; - dock_pos = c.dock_pos; - best_size = c.best_size; - min_size = c.min_size; - max_size = c.max_size; - floating_pos = c.floating_pos; - floating_size = c.floating_size; - dock_proportion = c.dock_proportion; - buttons = c.buttons; - rect = c.rect; - return *this; - } -#endif // SWIG - - // Write the safe parts of a newly loaded PaneInfo structure "source" into "this" - // used on loading perspectives etc. - void SafeSet(wxAuiPaneInfo source) - { - // note source is not passed by reference so we can overwrite, to keep the - // unsafe bits of "dest" - source.window = window; - source.frame = frame; - source.buttons = buttons; - // now assign - *this = source; - } - - bool IsOk() const { return (window != NULL) ? true : false; } - bool IsFixed() const { return !HasFlag(optionResizable); } - bool IsResizable() const { return HasFlag(optionResizable); } - bool IsShown() const { return !HasFlag(optionHidden); } - bool IsFloating() const { return HasFlag(optionFloating); } - bool IsDocked() const { return !HasFlag(optionFloating); } - bool IsToolbar() const { return HasFlag(optionToolbar); } - bool IsTopDockable() const { return HasFlag(optionTopDockable); } - bool IsBottomDockable() const { return HasFlag(optionBottomDockable); } - bool IsLeftDockable() const { return HasFlag(optionLeftDockable); } - bool IsRightDockable() const { return HasFlag(optionRightDockable); } - bool IsFloatable() const { return HasFlag(optionFloatable); } - bool IsMovable() const { return HasFlag(optionMovable); } - bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); } - bool IsMaximized() const { return HasFlag(optionMaximized); } - bool HasCaption() const { return HasFlag(optionCaption); } - bool HasGripper() const { return HasFlag(optionGripper); } - bool HasBorder() const { return HasFlag(optionPaneBorder); } - bool HasCloseButton() const { return HasFlag(buttonClose); } - bool HasMaximizeButton() const { return HasFlag(buttonMaximize); } - bool HasMinimizeButton() const { return HasFlag(buttonMinimize); } - bool HasPinButton() const { return HasFlag(buttonPin); } - bool HasGripperTop() const { return HasFlag(optionGripperTop); } - -#ifdef SWIG - %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); } -#endif - wxAuiPaneInfo& Window(wxWindow* w) { window = w; return *this; } - wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; } - wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; } - wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; } - wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; } - wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; } - wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; } - wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; } - wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; } - wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; } - wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; } - wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; } - wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; } - wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; } - wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; } - wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; } - wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; } - wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; } - wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; } - wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; } - wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; } - wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; } - wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; } - wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); } - wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); } - wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); } - wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); } - wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); } - wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); } - wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); } - wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); } - wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); } - wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); } - wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); } - wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); } - wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); } - wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); } - wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); } - wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); } - wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); } - wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); } - wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); } - wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); } - wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); } - wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); } - wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); } -#if wxABI_VERSION >= 20807 - wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); } -#endif - - wxAuiPaneInfo& Dockable(bool b = true) - { - return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b); - } - - wxAuiPaneInfo& DefaultPane() - { - state |= optionTopDockable | optionBottomDockable | - optionLeftDockable | optionRightDockable | - optionFloatable | optionMovable | optionResizable | - optionCaption | optionPaneBorder | buttonClose; - return *this; - } - - wxAuiPaneInfo& CentrePane() { return CenterPane(); } - wxAuiPaneInfo& CenterPane() - { - state = 0; - return Center().PaneBorder().Resizable(); - } - - wxAuiPaneInfo& ToolbarPane() - { - DefaultPane(); - state |= (optionToolbar | optionGripper); - state &= ~(optionResizable | optionCaption); - if (dock_layer == 0) - dock_layer = 10; - return *this; - } - - wxAuiPaneInfo& SetFlag(unsigned int flag, bool option_state) - { - if (option_state) - state |= flag; - else - state &= ~flag; - return *this; - } - - bool HasFlag(unsigned int flag) const - { - return (state & flag) ? true:false; - } - -#ifdef SWIG - %typemap(out) wxAuiPaneInfo& ; -#endif - -public: - - // NOTE: You can add and subtract flags from this list, - // but do not change the values of the flags, because - // they are stored in a binary integer format in the - // perspective string. If you really need to change the - // values around, you'll have to ensure backwards-compatibility - // in the perspective loading code. - enum wxAuiPaneState - { - optionFloating = 1 << 0, - optionHidden = 1 << 1, - optionLeftDockable = 1 << 2, - optionRightDockable = 1 << 3, - optionTopDockable = 1 << 4, - optionBottomDockable = 1 << 5, - optionFloatable = 1 << 6, - optionMovable = 1 << 7, - optionResizable = 1 << 8, - optionPaneBorder = 1 << 9, - optionCaption = 1 << 10, - optionGripper = 1 << 11, - optionDestroyOnClose = 1 << 12, - optionToolbar = 1 << 13, - optionActive = 1 << 14, - optionGripperTop = 1 << 15, - optionMaximized = 1 << 16, - optionDockFixed = 1 << 17, - - buttonClose = 1 << 21, - buttonMaximize = 1 << 22, - buttonMinimize = 1 << 23, - buttonPin = 1 << 24, - - buttonCustom1 = 1 << 26, - buttonCustom2 = 1 << 27, - buttonCustom3 = 1 << 28, - - savedHiddenState = 1 << 30, // used internally - actionPane = 1 << 31 // used internally - }; - -public: - wxString name; // name of the pane - wxString caption; // caption displayed on the window - - wxWindow* window; // window that is in this pane - wxFrame* frame; // floating frame window that holds the pane - unsigned int state; // a combination of wxPaneState values - - int dock_direction; // dock direction (top, bottom, left, right, center) - int dock_layer; // layer number (0 = innermost layer) - int dock_row; // row number on the docking bar (0 = first row) - int dock_pos; // position inside the row (0 = first position) - - wxSize best_size; // size that the layout engine will prefer - wxSize min_size; // minimum size the pane window can tolerate - wxSize max_size; // maximum size the pane window can tolerate - - wxPoint floating_pos; // position while floating - wxSize floating_size; // size while floating - int dock_proportion; // proportion while docked - - wxAuiPaneButtonArray buttons; // buttons on the pane - - wxRect rect; // current rectangle (populated by wxAUI) -}; - - - -class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame; - -class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler -{ -friend class wxAuiFloatingFrame; - -public: - - wxAuiManager(wxWindow* managed_wnd = NULL, - unsigned int flags = wxAUI_MGR_DEFAULT); - virtual ~wxAuiManager(); - void UnInit(); - - void SetFlags(unsigned int flags); - unsigned int GetFlags() const; - - void SetManagedWindow(wxWindow* managed_wnd); - wxWindow* GetManagedWindow() const; - - static wxAuiManager* GetManager(wxWindow* window); - - void SetArtProvider(wxAuiDockArt* art_provider); - wxAuiDockArt* GetArtProvider() const; - - wxAuiPaneInfo& GetPane(wxWindow* window); - wxAuiPaneInfo& GetPane(const wxString& name); - wxAuiPaneInfoArray& GetAllPanes(); - - bool AddPane(wxWindow* window, - const wxAuiPaneInfo& pane_info); - - bool AddPane(wxWindow* window, - const wxAuiPaneInfo& pane_info, - const wxPoint& drop_pos); - - bool AddPane(wxWindow* window, - int direction = wxLEFT, - const wxString& caption = wxEmptyString); - - bool InsertPane(wxWindow* window, - const wxAuiPaneInfo& insert_location, - int insert_level = wxAUI_INSERT_PANE); - - bool DetachPane(wxWindow* window); - - void Update(); - - wxString SavePaneInfo(wxAuiPaneInfo& pane); - void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane); - wxString SavePerspective(); - bool LoadPerspective(const wxString& perspective, bool update = true); - - void SetDockSizeConstraint(double width_pct, double height_pct); - void GetDockSizeConstraint(double* width_pct, double* height_pct) const; - - void ClosePane(wxAuiPaneInfo& pane_info); - void MaximizePane(wxAuiPaneInfo& pane_info); - void RestorePane(wxAuiPaneInfo& pane_info); - void RestoreMaximizedPane(); - -public: - - virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p); - - void StartPaneDrag( - wxWindow* pane_window, - const wxPoint& offset); - - wxRect CalculateHintRect( - wxWindow* pane_window, - const wxPoint& pt, - const wxPoint& offset); - - void DrawHintRect( - wxWindow* pane_window, - const wxPoint& pt, - const wxPoint& offset); - - virtual void ShowHint(const wxRect& rect); - virtual void HideHint(); - -public: - - // deprecated -- please use SetManagedWindow() and - // and GetManagedWindow() instead - - wxDEPRECATED( void SetFrame(wxFrame* frame) ); - wxDEPRECATED( wxFrame* GetFrame() const ); - -protected: - - void UpdateHintWindowConfig(); - - void DoFrameLayout(); - - void LayoutAddPane(wxSizer* container, - wxAuiDockInfo& dock, - wxAuiPaneInfo& pane, - wxAuiDockUIPartArray& uiparts, - bool spacer_only); - - void LayoutAddDock(wxSizer* container, - wxAuiDockInfo& dock, - wxAuiDockUIPartArray& uiparts, - bool spacer_only); - - wxSizer* LayoutAll(wxAuiPaneInfoArray& panes, - wxAuiDockInfoArray& docks, - wxAuiDockUIPartArray& uiparts, - bool spacer_only = false); - - virtual bool ProcessDockResult(wxAuiPaneInfo& target, - const wxAuiPaneInfo& new_pos); - - bool DoDrop(wxAuiDockInfoArray& docks, - wxAuiPaneInfoArray& panes, - wxAuiPaneInfo& drop, - const wxPoint& pt, - const wxPoint& action_offset = wxPoint(0,0)); - - wxAuiDockUIPart* HitTest(int x, int y); - wxAuiDockUIPart* GetPanePart(wxWindow* pane); - int GetDockPixelOffset(wxAuiPaneInfo& test); - void OnFloatingPaneMoveStart(wxWindow* window); - void OnFloatingPaneMoving(wxWindow* window, wxDirection dir ); - void OnFloatingPaneMoved(wxWindow* window, wxDirection dir); - void OnFloatingPaneActivated(wxWindow* window); - void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt); - void OnFloatingPaneResized(wxWindow* window, const wxSize& size); - void Render(wxDC* dc); - void Repaint(wxDC* dc = NULL); - void ProcessMgrEvent(wxAuiManagerEvent& event); - void UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part, - const wxMouseEvent& event); - void GetPanePositionsAndSizes(wxAuiDockInfo& dock, - wxArrayInt& positions, - wxArrayInt& sizes); - - -public: - - // public events (which can be invoked externally) - void OnRender(wxAuiManagerEvent& evt); - void OnPaneButton(wxAuiManagerEvent& evt); - -protected: - - // protected events - void OnPaint(wxPaintEvent& evt); - void OnEraseBackground(wxEraseEvent& evt); - void OnSize(wxSizeEvent& evt); - void OnSetCursor(wxSetCursorEvent& evt); - void OnLeftDown(wxMouseEvent& evt); - void OnLeftUp(wxMouseEvent& evt); - void OnMotion(wxMouseEvent& evt); - void OnLeaveWindow(wxMouseEvent& evt); - void OnChildFocus(wxChildFocusEvent& evt); - void OnHintFadeTimer(wxTimerEvent& evt); - void OnFindManager(wxAuiManagerEvent& evt); - -protected: - - enum - { - actionNone = 0, - actionResize, - actionClickButton, - actionClickCaption, - actionDragToolbarPane, - actionDragFloatingPane - }; - -protected: - - wxWindow* m_frame; // the window being managed - wxAuiDockArt* m_art; // dock art object which does all drawing - unsigned int m_flags; // manager flags wxAUI_MGR_* - - wxAuiPaneInfoArray m_panes; // array of panes structures - wxAuiDockInfoArray m_docks; // array of docks structures - wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc) - - int m_action; // current mouse action - wxPoint m_action_start; // position where the action click started - wxPoint m_action_offset; // offset from upper left of the item clicked - wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to - wxWindow* m_action_window; // action frame or window (NULL if none) - wxRect m_action_hintrect; // hint rectangle for the action - wxRect m_last_rect; - wxAuiDockUIPart* m_hover_button;// button uipart being hovered over - wxRect m_last_hint; // last hint rectangle - wxPoint m_last_mouse_move; // last mouse move position (see OnMotion) - bool m_skipping; - bool m_has_maximized; - - double m_dock_constraint_x; // 0.0 .. 1.0; max pct of window width a dock can consume - double m_dock_constraint_y; // 0.0 .. 1.0; max pct of window height a dock can consume - - wxFrame* m_hint_wnd; // transparent hint window, if supported by platform - wxTimer m_hint_fadetimer; // transparent fade timer - wxByte m_hint_fadeamt; // transparent fade amount - wxByte m_hint_fademax; // maximum value of hint fade - - void* m_reserved; - -#ifndef SWIG - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxAuiManager) -#endif // SWIG -}; - - - -// event declarations/classes - -class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent -{ -public: - wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type) - { - manager = NULL; - pane = NULL; - button = 0; - veto_flag = false; - canveto_flag = true; - dc = NULL; - } -#ifndef SWIG - wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c) - { - manager = c.manager; - pane = c.pane; - button = c.button; - veto_flag = c.veto_flag; - canveto_flag = c.canveto_flag; - dc = c.dc; - } -#endif - wxEvent *Clone() const { return new wxAuiManagerEvent(*this); } - - void SetManager(wxAuiManager* mgr) { manager = mgr; } - void SetPane(wxAuiPaneInfo* p) { pane = p; } - void SetButton(int b) { button = b; } - void SetDC(wxDC* pdc) { dc = pdc; } - - wxAuiManager* GetManager() const { return manager; } - wxAuiPaneInfo* GetPane() const { return pane; } - int GetButton() const { return button; } - wxDC* GetDC() const { return dc; } - - void Veto(bool veto = true) { veto_flag = veto; } - bool GetVeto() const { return veto_flag; } - void SetCanVeto(bool can_veto) { canveto_flag = can_veto; } - bool CanVeto() const { return canveto_flag && veto_flag; } - -public: - wxAuiManager* manager; - wxAuiPaneInfo* pane; - int button; - bool veto_flag; - bool canveto_flag; - wxDC* dc; - -#ifndef SWIG -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent) -#endif -}; - - -class WXDLLIMPEXP_AUI wxAuiDockInfo -{ -public: - wxAuiDockInfo() - { - dock_direction = 0; - dock_layer = 0; - dock_row = 0; - size = 0; - min_size = 0; - resizable = true; - fixed = false; - toolbar = false; - reserved1 = false; - } - -#ifndef SWIG - wxAuiDockInfo(const wxAuiDockInfo& c) - { - dock_direction = c.dock_direction; - dock_layer = c.dock_layer; - dock_row = c.dock_row; - size = c.size; - min_size = c.min_size; - resizable = c.resizable; - fixed = c.fixed; - toolbar = c.toolbar; - panes = c.panes; - rect = c.rect; - reserved1 = c.reserved1; - } - - wxAuiDockInfo& operator=(const wxAuiDockInfo& c) - { - dock_direction = c.dock_direction; - dock_layer = c.dock_layer; - dock_row = c.dock_row; - size = c.size; - min_size = c.min_size; - resizable = c.resizable; - fixed = c.fixed; - toolbar = c.toolbar; - panes = c.panes; - rect = c.rect; - reserved1 = c.reserved1; - return *this; - } -#endif // SWIG - - bool IsOk() const { return (dock_direction != 0) ? true : false; } - bool IsHorizontal() const { return (dock_direction == wxAUI_DOCK_TOP || - dock_direction == wxAUI_DOCK_BOTTOM) ? true:false; } - bool IsVertical() const { return (dock_direction == wxAUI_DOCK_LEFT || - dock_direction == wxAUI_DOCK_RIGHT || - dock_direction == wxAUI_DOCK_CENTER) ? true:false; } -public: - wxAuiPaneInfoPtrArray panes; // array of panes - wxRect rect; // current rectangle - int dock_direction; // dock direction (top, bottom, left, right, center) - int dock_layer; // layer number (0 = innermost layer) - int dock_row; // row number on the docking bar (0 = first row) - int size; // size of the dock - int min_size; // minimum size of a dock (0 if there is no min) - bool resizable; // flag indicating whether the dock is resizable - bool toolbar; // flag indicating dock contains only toolbars - bool fixed; // flag indicating that the dock operates on - // absolute coordinates as opposed to proportional - bool reserved1; -}; - - -class WXDLLIMPEXP_AUI wxAuiDockUIPart -{ -public: - enum - { - typeCaption, - typeGripper, - typeDock, - typeDockSizer, - typePane, - typePaneSizer, - typeBackground, - typePaneBorder, - typePaneButton - }; - - int type; // ui part type (see enum above) - int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL) - wxAuiDockInfo* dock; // which dock the item is associated with - wxAuiPaneInfo* pane; // which pane the item is associated with - wxAuiPaneButton* button; // which pane button the item is associated with - wxSizer* cont_sizer; // the part's containing sizer - wxSizerItem* sizer_item; // the sizer item of the part - wxRect rect; // client coord rectangle of the part itself -}; - - -class WXDLLIMPEXP_AUI wxAuiPaneButton -{ -public: - int button_id; // id of the button (e.g. buttonClose) -}; - - - -#ifndef SWIG -// wx event machinery - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, 0) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&); - -#define wxAuiManagerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiManagerEventFunction, &func) - -#define EVT_AUI_PANE_BUTTON(func) \ - wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func)) -#define EVT_AUI_PANE_CLOSE(func) \ - wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func)) -#define EVT_AUI_PANE_MAXIMIZE(func) \ - wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func)) -#define EVT_AUI_PANE_RESTORE(func) \ - wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func)) -#define EVT_AUI_RENDER(func) \ - wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func)) -#define EVT_AUI_FIND_MANAGER(func) \ - wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func)) - -#else - -%constant wxEventType wxEVT_AUI_PANE_BUTTON; -%constant wxEventType wxEVT_AUI_PANE_CLOSE; -%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE; -%constant wxEventType wxEVT_AUI_PANE_RESTORE; -%constant wxEventType wxEVT_AUI_RENDER; -%constant wxEventType wxEVT_AUI_FIND_MANAGER; - -%pythoncode { - EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON ) - EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) - EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) - EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) - EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) - EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) -} -#endif // SWIG - -#endif // wxUSE_AUI -#endif //_WX_FRAMEMANAGER_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/framemanager.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// RCS-ID: $Id: framemanager.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAMEMANAGER_H_ +#define _WX_FRAMEMANAGER_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/dynarray.h" +#include "wx/gdicmn.h" +#include "wx/window.h" +#include "wx/timer.h" +#include "wx/sizer.h" + +enum wxAuiManagerDock +{ + wxAUI_DOCK_NONE = 0, + wxAUI_DOCK_TOP = 1, + wxAUI_DOCK_RIGHT = 2, + wxAUI_DOCK_BOTTOM = 3, + wxAUI_DOCK_LEFT = 4, + wxAUI_DOCK_CENTER = 5, + wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER +}; + +enum wxAuiManagerOption +{ + wxAUI_MGR_ALLOW_FLOATING = 1 << 0, + wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1, + wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2, + wxAUI_MGR_TRANSPARENT_HINT = 1 << 3, + wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4, + wxAUI_MGR_RECTANGLE_HINT = 1 << 5, + wxAUI_MGR_HINT_FADE = 1 << 6, + wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7, + + wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING | + wxAUI_MGR_TRANSPARENT_HINT | + wxAUI_MGR_HINT_FADE | + wxAUI_MGR_NO_VENETIAN_BLINDS_FADE +}; + + +enum wxAuiPaneDockArtSetting +{ + wxAUI_DOCKART_SASH_SIZE = 0, + wxAUI_DOCKART_CAPTION_SIZE = 1, + wxAUI_DOCKART_GRIPPER_SIZE = 2, + wxAUI_DOCKART_PANE_BORDER_SIZE = 3, + wxAUI_DOCKART_PANE_BUTTON_SIZE = 4, + wxAUI_DOCKART_BACKGROUND_COLOUR = 5, + wxAUI_DOCKART_SASH_COLOUR = 6, + wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7, + wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8, + wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9, + wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10, + wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11, + wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12, + wxAUI_DOCKART_BORDER_COLOUR = 13, + wxAUI_DOCKART_GRIPPER_COLOUR = 14, + wxAUI_DOCKART_CAPTION_FONT = 15, + wxAUI_DOCKART_GRADIENT_TYPE = 16 +}; + +enum wxAuiPaneDockArtGradients +{ + wxAUI_GRADIENT_NONE = 0, + wxAUI_GRADIENT_VERTICAL = 1, + wxAUI_GRADIENT_HORIZONTAL = 2 +}; + +enum wxAuiPaneButtonState +{ + wxAUI_BUTTON_STATE_NORMAL = 0, + wxAUI_BUTTON_STATE_HOVER = 1 << 1, + wxAUI_BUTTON_STATE_PRESSED = 1 << 2, + wxAUI_BUTTON_STATE_DISABLED = 1 << 3, + wxAUI_BUTTON_STATE_HIDDEN = 1 << 4, + wxAUI_BUTTON_STATE_CHECKED = 1 << 5 +}; + +enum wxAuiButtonId +{ + wxAUI_BUTTON_CLOSE = 101, + wxAUI_BUTTON_MAXIMIZE_RESTORE = 102, + wxAUI_BUTTON_MINIMIZE = 103, + wxAUI_BUTTON_PIN = 104, + wxAUI_BUTTON_OPTIONS = 105, + wxAUI_BUTTON_WINDOWLIST = 106, + wxAUI_BUTTON_LEFT = 107, + wxAUI_BUTTON_RIGHT = 108, + wxAUI_BUTTON_UP = 109, + wxAUI_BUTTON_DOWN = 110, + wxAUI_BUTTON_CUSTOM1 = 201, + wxAUI_BUTTON_CUSTOM2 = 202, + wxAUI_BUTTON_CUSTOM3 = 203 +}; + +enum wxAuiPaneInsertLevel +{ + wxAUI_INSERT_PANE = 0, + wxAUI_INSERT_ROW = 1, + wxAUI_INSERT_DOCK = 2 +}; + + + + +// forwards and array declarations +class wxAuiDockUIPart; +class wxAuiPaneButton; +class wxAuiPaneInfo; +class wxAuiDockInfo; +class wxAuiDockArt; +class wxAuiManagerEvent; + +#ifndef SWIG +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI); +#endif // SWIG + +extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo; +extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo; + + + +class WXDLLIMPEXP_AUI wxAuiPaneInfo +{ +public: + + wxAuiPaneInfo() + { + window = NULL; + frame = NULL; + state = 0; + dock_direction = wxAUI_DOCK_LEFT; + dock_layer = 0; + dock_row = 0; + dock_pos = 0; + floating_pos = wxDefaultPosition; + floating_size = wxDefaultSize; + best_size = wxDefaultSize; + min_size = wxDefaultSize; + max_size = wxDefaultSize; + dock_proportion = 0; + + DefaultPane(); + } + + ~wxAuiPaneInfo() {} + +#ifndef SWIG + wxAuiPaneInfo(const wxAuiPaneInfo& c) + { + name = c.name; + caption = c.caption; + window = c.window; + frame = c.frame; + state = c.state; + dock_direction = c.dock_direction; + dock_layer = c.dock_layer; + dock_row = c.dock_row; + dock_pos = c.dock_pos; + best_size = c.best_size; + min_size = c.min_size; + max_size = c.max_size; + floating_pos = c.floating_pos; + floating_size = c.floating_size; + dock_proportion = c.dock_proportion; + buttons = c.buttons; + rect = c.rect; + } + + wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c) + { + name = c.name; + caption = c.caption; + window = c.window; + frame = c.frame; + state = c.state; + dock_direction = c.dock_direction; + dock_layer = c.dock_layer; + dock_row = c.dock_row; + dock_pos = c.dock_pos; + best_size = c.best_size; + min_size = c.min_size; + max_size = c.max_size; + floating_pos = c.floating_pos; + floating_size = c.floating_size; + dock_proportion = c.dock_proportion; + buttons = c.buttons; + rect = c.rect; + return *this; + } +#endif // SWIG + + // Write the safe parts of a newly loaded PaneInfo structure "source" into "this" + // used on loading perspectives etc. + void SafeSet(wxAuiPaneInfo source) + { + // note source is not passed by reference so we can overwrite, to keep the + // unsafe bits of "dest" + source.window = window; + source.frame = frame; + source.buttons = buttons; + // now assign + *this = source; + } + + bool IsOk() const { return (window != NULL) ? true : false; } + bool IsFixed() const { return !HasFlag(optionResizable); } + bool IsResizable() const { return HasFlag(optionResizable); } + bool IsShown() const { return !HasFlag(optionHidden); } + bool IsFloating() const { return HasFlag(optionFloating); } + bool IsDocked() const { return !HasFlag(optionFloating); } + bool IsToolbar() const { return HasFlag(optionToolbar); } + bool IsTopDockable() const { return HasFlag(optionTopDockable); } + bool IsBottomDockable() const { return HasFlag(optionBottomDockable); } + bool IsLeftDockable() const { return HasFlag(optionLeftDockable); } + bool IsRightDockable() const { return HasFlag(optionRightDockable); } + bool IsFloatable() const { return HasFlag(optionFloatable); } + bool IsMovable() const { return HasFlag(optionMovable); } + bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); } + bool IsMaximized() const { return HasFlag(optionMaximized); } + bool HasCaption() const { return HasFlag(optionCaption); } + bool HasGripper() const { return HasFlag(optionGripper); } + bool HasBorder() const { return HasFlag(optionPaneBorder); } + bool HasCloseButton() const { return HasFlag(buttonClose); } + bool HasMaximizeButton() const { return HasFlag(buttonMaximize); } + bool HasMinimizeButton() const { return HasFlag(buttonMinimize); } + bool HasPinButton() const { return HasFlag(buttonPin); } + bool HasGripperTop() const { return HasFlag(optionGripperTop); } + +#ifdef SWIG + %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); } +#endif + wxAuiPaneInfo& Window(wxWindow* w) { window = w; return *this; } + wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; } + wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; } + wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; } + wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; } + wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; } + wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; } + wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; } + wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; } + wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; } + wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; } + wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; } + wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; } + wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; } + wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; } + wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; } + wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; } + wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; } + wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; } + wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; } + wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; } + wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; } + wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; } + wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); } + wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); } + wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); } + wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); } + wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); } + wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); } + wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); } + wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); } + wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); } + wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); } + wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); } + wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); } + wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); } + wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); } + wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); } + wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); } + wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); } + wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); } + wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); } + wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); } + wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); } + wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); } + wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); } +#if wxABI_VERSION >= 20807 + wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); } +#endif + + wxAuiPaneInfo& Dockable(bool b = true) + { + return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b); + } + + wxAuiPaneInfo& DefaultPane() + { + state |= optionTopDockable | optionBottomDockable | + optionLeftDockable | optionRightDockable | + optionFloatable | optionMovable | optionResizable | + optionCaption | optionPaneBorder | buttonClose; + return *this; + } + + wxAuiPaneInfo& CentrePane() { return CenterPane(); } + wxAuiPaneInfo& CenterPane() + { + state = 0; + return Center().PaneBorder().Resizable(); + } + + wxAuiPaneInfo& ToolbarPane() + { + DefaultPane(); + state |= (optionToolbar | optionGripper); + state &= ~(optionResizable | optionCaption); + if (dock_layer == 0) + dock_layer = 10; + return *this; + } + + wxAuiPaneInfo& SetFlag(unsigned int flag, bool option_state) + { + if (option_state) + state |= flag; + else + state &= ~flag; + return *this; + } + + bool HasFlag(unsigned int flag) const + { + return (state & flag) ? true:false; + } + +#ifdef SWIG + %typemap(out) wxAuiPaneInfo& ; +#endif + +public: + + // NOTE: You can add and subtract flags from this list, + // but do not change the values of the flags, because + // they are stored in a binary integer format in the + // perspective string. If you really need to change the + // values around, you'll have to ensure backwards-compatibility + // in the perspective loading code. + enum wxAuiPaneState + { + optionFloating = 1 << 0, + optionHidden = 1 << 1, + optionLeftDockable = 1 << 2, + optionRightDockable = 1 << 3, + optionTopDockable = 1 << 4, + optionBottomDockable = 1 << 5, + optionFloatable = 1 << 6, + optionMovable = 1 << 7, + optionResizable = 1 << 8, + optionPaneBorder = 1 << 9, + optionCaption = 1 << 10, + optionGripper = 1 << 11, + optionDestroyOnClose = 1 << 12, + optionToolbar = 1 << 13, + optionActive = 1 << 14, + optionGripperTop = 1 << 15, + optionMaximized = 1 << 16, + optionDockFixed = 1 << 17, + + buttonClose = 1 << 21, + buttonMaximize = 1 << 22, + buttonMinimize = 1 << 23, + buttonPin = 1 << 24, + + buttonCustom1 = 1 << 26, + buttonCustom2 = 1 << 27, + buttonCustom3 = 1 << 28, + + savedHiddenState = 1 << 30, // used internally + actionPane = 1 << 31 // used internally + }; + +public: + wxString name; // name of the pane + wxString caption; // caption displayed on the window + + wxWindow* window; // window that is in this pane + wxFrame* frame; // floating frame window that holds the pane + unsigned int state; // a combination of wxPaneState values + + int dock_direction; // dock direction (top, bottom, left, right, center) + int dock_layer; // layer number (0 = innermost layer) + int dock_row; // row number on the docking bar (0 = first row) + int dock_pos; // position inside the row (0 = first position) + + wxSize best_size; // size that the layout engine will prefer + wxSize min_size; // minimum size the pane window can tolerate + wxSize max_size; // maximum size the pane window can tolerate + + wxPoint floating_pos; // position while floating + wxSize floating_size; // size while floating + int dock_proportion; // proportion while docked + + wxAuiPaneButtonArray buttons; // buttons on the pane + + wxRect rect; // current rectangle (populated by wxAUI) +}; + + + +class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame; + +class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler +{ +friend class wxAuiFloatingFrame; + +public: + + wxAuiManager(wxWindow* managed_wnd = NULL, + unsigned int flags = wxAUI_MGR_DEFAULT); + virtual ~wxAuiManager(); + void UnInit(); + + void SetFlags(unsigned int flags); + unsigned int GetFlags() const; + + void SetManagedWindow(wxWindow* managed_wnd); + wxWindow* GetManagedWindow() const; + + static wxAuiManager* GetManager(wxWindow* window); + + void SetArtProvider(wxAuiDockArt* art_provider); + wxAuiDockArt* GetArtProvider() const; + + wxAuiPaneInfo& GetPane(wxWindow* window); + wxAuiPaneInfo& GetPane(const wxString& name); + wxAuiPaneInfoArray& GetAllPanes(); + + bool AddPane(wxWindow* window, + const wxAuiPaneInfo& pane_info); + + bool AddPane(wxWindow* window, + const wxAuiPaneInfo& pane_info, + const wxPoint& drop_pos); + + bool AddPane(wxWindow* window, + int direction = wxLEFT, + const wxString& caption = wxEmptyString); + + bool InsertPane(wxWindow* window, + const wxAuiPaneInfo& insert_location, + int insert_level = wxAUI_INSERT_PANE); + + bool DetachPane(wxWindow* window); + + void Update(); + + wxString SavePaneInfo(wxAuiPaneInfo& pane); + void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane); + wxString SavePerspective(); + bool LoadPerspective(const wxString& perspective, bool update = true); + + void SetDockSizeConstraint(double width_pct, double height_pct); + void GetDockSizeConstraint(double* width_pct, double* height_pct) const; + + void ClosePane(wxAuiPaneInfo& pane_info); + void MaximizePane(wxAuiPaneInfo& pane_info); + void RestorePane(wxAuiPaneInfo& pane_info); + void RestoreMaximizedPane(); + +public: + + virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p); + + void StartPaneDrag( + wxWindow* pane_window, + const wxPoint& offset); + + wxRect CalculateHintRect( + wxWindow* pane_window, + const wxPoint& pt, + const wxPoint& offset); + + void DrawHintRect( + wxWindow* pane_window, + const wxPoint& pt, + const wxPoint& offset); + + virtual void ShowHint(const wxRect& rect); + virtual void HideHint(); + +public: + + // deprecated -- please use SetManagedWindow() and + // and GetManagedWindow() instead + + wxDEPRECATED( void SetFrame(wxFrame* frame) ); + wxDEPRECATED( wxFrame* GetFrame() const ); + +protected: + + void UpdateHintWindowConfig(); + + void DoFrameLayout(); + + void LayoutAddPane(wxSizer* container, + wxAuiDockInfo& dock, + wxAuiPaneInfo& pane, + wxAuiDockUIPartArray& uiparts, + bool spacer_only); + + void LayoutAddDock(wxSizer* container, + wxAuiDockInfo& dock, + wxAuiDockUIPartArray& uiparts, + bool spacer_only); + + wxSizer* LayoutAll(wxAuiPaneInfoArray& panes, + wxAuiDockInfoArray& docks, + wxAuiDockUIPartArray& uiparts, + bool spacer_only = false); + + virtual bool ProcessDockResult(wxAuiPaneInfo& target, + const wxAuiPaneInfo& new_pos); + + bool DoDrop(wxAuiDockInfoArray& docks, + wxAuiPaneInfoArray& panes, + wxAuiPaneInfo& drop, + const wxPoint& pt, + const wxPoint& action_offset = wxPoint(0,0)); + + wxAuiDockUIPart* HitTest(int x, int y); + wxAuiDockUIPart* GetPanePart(wxWindow* pane); + int GetDockPixelOffset(wxAuiPaneInfo& test); + void OnFloatingPaneMoveStart(wxWindow* window); + void OnFloatingPaneMoving(wxWindow* window, wxDirection dir ); + void OnFloatingPaneMoved(wxWindow* window, wxDirection dir); + void OnFloatingPaneActivated(wxWindow* window); + void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt); + void OnFloatingPaneResized(wxWindow* window, const wxSize& size); + void Render(wxDC* dc); + void Repaint(wxDC* dc = NULL); + void ProcessMgrEvent(wxAuiManagerEvent& event); + void UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part, + const wxMouseEvent& event); + void GetPanePositionsAndSizes(wxAuiDockInfo& dock, + wxArrayInt& positions, + wxArrayInt& sizes); + + +public: + + // public events (which can be invoked externally) + void OnRender(wxAuiManagerEvent& evt); + void OnPaneButton(wxAuiManagerEvent& evt); + +protected: + + // protected events + void OnPaint(wxPaintEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnSetCursor(wxSetCursorEvent& evt); + void OnLeftDown(wxMouseEvent& evt); + void OnLeftUp(wxMouseEvent& evt); + void OnMotion(wxMouseEvent& evt); + void OnLeaveWindow(wxMouseEvent& evt); + void OnChildFocus(wxChildFocusEvent& evt); + void OnHintFadeTimer(wxTimerEvent& evt); + void OnFindManager(wxAuiManagerEvent& evt); + +protected: + + enum + { + actionNone = 0, + actionResize, + actionClickButton, + actionClickCaption, + actionDragToolbarPane, + actionDragFloatingPane + }; + +protected: + + wxWindow* m_frame; // the window being managed + wxAuiDockArt* m_art; // dock art object which does all drawing + unsigned int m_flags; // manager flags wxAUI_MGR_* + + wxAuiPaneInfoArray m_panes; // array of panes structures + wxAuiDockInfoArray m_docks; // array of docks structures + wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc) + + int m_action; // current mouse action + wxPoint m_action_start; // position where the action click started + wxPoint m_action_offset; // offset from upper left of the item clicked + wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to + wxWindow* m_action_window; // action frame or window (NULL if none) + wxRect m_action_hintrect; // hint rectangle for the action + wxRect m_last_rect; + wxAuiDockUIPart* m_hover_button;// button uipart being hovered over + wxRect m_last_hint; // last hint rectangle + wxPoint m_last_mouse_move; // last mouse move position (see OnMotion) + bool m_skipping; + bool m_has_maximized; + + double m_dock_constraint_x; // 0.0 .. 1.0; max pct of window width a dock can consume + double m_dock_constraint_y; // 0.0 .. 1.0; max pct of window height a dock can consume + + wxFrame* m_hint_wnd; // transparent hint window, if supported by platform + wxTimer m_hint_fadetimer; // transparent fade timer + wxByte m_hint_fadeamt; // transparent fade amount + wxByte m_hint_fademax; // maximum value of hint fade + + void* m_reserved; + +#ifndef SWIG + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxAuiManager) +#endif // SWIG +}; + + + +// event declarations/classes + +class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent +{ +public: + wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type) + { + manager = NULL; + pane = NULL; + button = 0; + veto_flag = false; + canveto_flag = true; + dc = NULL; + } +#ifndef SWIG + wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c) + { + manager = c.manager; + pane = c.pane; + button = c.button; + veto_flag = c.veto_flag; + canveto_flag = c.canveto_flag; + dc = c.dc; + } +#endif + wxEvent *Clone() const { return new wxAuiManagerEvent(*this); } + + void SetManager(wxAuiManager* mgr) { manager = mgr; } + void SetPane(wxAuiPaneInfo* p) { pane = p; } + void SetButton(int b) { button = b; } + void SetDC(wxDC* pdc) { dc = pdc; } + + wxAuiManager* GetManager() const { return manager; } + wxAuiPaneInfo* GetPane() const { return pane; } + int GetButton() const { return button; } + wxDC* GetDC() const { return dc; } + + void Veto(bool veto = true) { veto_flag = veto; } + bool GetVeto() const { return veto_flag; } + void SetCanVeto(bool can_veto) { canveto_flag = can_veto; } + bool CanVeto() const { return canveto_flag && veto_flag; } + +public: + wxAuiManager* manager; + wxAuiPaneInfo* pane; + int button; + bool veto_flag; + bool canveto_flag; + wxDC* dc; + +#ifndef SWIG +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent) +#endif +}; + + +class WXDLLIMPEXP_AUI wxAuiDockInfo +{ +public: + wxAuiDockInfo() + { + dock_direction = 0; + dock_layer = 0; + dock_row = 0; + size = 0; + min_size = 0; + resizable = true; + fixed = false; + toolbar = false; + reserved1 = false; + } + +#ifndef SWIG + wxAuiDockInfo(const wxAuiDockInfo& c) + { + dock_direction = c.dock_direction; + dock_layer = c.dock_layer; + dock_row = c.dock_row; + size = c.size; + min_size = c.min_size; + resizable = c.resizable; + fixed = c.fixed; + toolbar = c.toolbar; + panes = c.panes; + rect = c.rect; + reserved1 = c.reserved1; + } + + wxAuiDockInfo& operator=(const wxAuiDockInfo& c) + { + dock_direction = c.dock_direction; + dock_layer = c.dock_layer; + dock_row = c.dock_row; + size = c.size; + min_size = c.min_size; + resizable = c.resizable; + fixed = c.fixed; + toolbar = c.toolbar; + panes = c.panes; + rect = c.rect; + reserved1 = c.reserved1; + return *this; + } +#endif // SWIG + + bool IsOk() const { return (dock_direction != 0) ? true : false; } + bool IsHorizontal() const { return (dock_direction == wxAUI_DOCK_TOP || + dock_direction == wxAUI_DOCK_BOTTOM) ? true:false; } + bool IsVertical() const { return (dock_direction == wxAUI_DOCK_LEFT || + dock_direction == wxAUI_DOCK_RIGHT || + dock_direction == wxAUI_DOCK_CENTER) ? true:false; } +public: + wxAuiPaneInfoPtrArray panes; // array of panes + wxRect rect; // current rectangle + int dock_direction; // dock direction (top, bottom, left, right, center) + int dock_layer; // layer number (0 = innermost layer) + int dock_row; // row number on the docking bar (0 = first row) + int size; // size of the dock + int min_size; // minimum size of a dock (0 if there is no min) + bool resizable; // flag indicating whether the dock is resizable + bool toolbar; // flag indicating dock contains only toolbars + bool fixed; // flag indicating that the dock operates on + // absolute coordinates as opposed to proportional + bool reserved1; +}; + + +class WXDLLIMPEXP_AUI wxAuiDockUIPart +{ +public: + enum + { + typeCaption, + typeGripper, + typeDock, + typeDockSizer, + typePane, + typePaneSizer, + typeBackground, + typePaneBorder, + typePaneButton + }; + + int type; // ui part type (see enum above) + int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL) + wxAuiDockInfo* dock; // which dock the item is associated with + wxAuiPaneInfo* pane; // which pane the item is associated with + wxAuiPaneButton* button; // which pane button the item is associated with + wxSizer* cont_sizer; // the part's containing sizer + wxSizerItem* sizer_item; // the sizer item of the part + wxRect rect; // client coord rectangle of the part itself +}; + + +class WXDLLIMPEXP_AUI wxAuiPaneButton +{ +public: + int button_id; // id of the button (e.g. buttonClose) +}; + + + +#ifndef SWIG +// wx event machinery + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, 0) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&); + +#define wxAuiManagerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiManagerEventFunction, &func) + +#define EVT_AUI_PANE_BUTTON(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_CLOSE(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_MAXIMIZE(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_RESTORE(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_RENDER(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func)) +#define EVT_AUI_FIND_MANAGER(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func)) + +#else + +%constant wxEventType wxEVT_AUI_PANE_BUTTON; +%constant wxEventType wxEVT_AUI_PANE_CLOSE; +%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE; +%constant wxEventType wxEVT_AUI_PANE_RESTORE; +%constant wxEventType wxEVT_AUI_RENDER; +%constant wxEventType wxEVT_AUI_FIND_MANAGER; + +%pythoncode { + EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON ) + EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) + EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) + EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) + EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) + EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) +} +#endif // SWIG + +#endif // wxUSE_AUI +#endif //_WX_FRAMEMANAGER_H_ + diff --git a/Externals/wxWidgets/include/wx/aui/tabmdi.h b/Externals/wxWidgets/include/wx/aui/tabmdi.h index 58997353af..6fa7ac095a 100644 --- a/Externals/wxWidgets/include/wx/aui/tabmdi.h +++ b/Externals/wxWidgets/include/wx/aui/tabmdi.h @@ -1,269 +1,269 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/tabmdi.h -// Purpose: Generic MDI (Multiple Document Interface) classes -// Author: Hans Van Leemputten -// Modified by: Benjamin I. Williams / Kirix Corporation -// Created: 29/07/2002 -// RCS-ID: $Id: tabmdi.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Hans Van Leemputten -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_AUITABMDI_H_ -#define _WX_AUITABMDI_H_ - -#if wxUSE_AUI - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/frame.h" -#include "wx/panel.h" -#include "wx/notebook.h" -#include "wx/icon.h" -#include "wx/aui/auibook.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame; -class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow; -class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame; - -//----------------------------------------------------------------------------- -// wxAuiMDIParentFrame -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame -{ -public: - wxAuiMDIParentFrame(); - wxAuiMDIParentFrame(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr); - - ~wxAuiMDIParentFrame(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr ); - - void SetArtProvider(wxAuiTabArt* provider); - wxAuiTabArt* GetArtProvider(); - wxAuiNotebook* GetNotebook() const; - -#if wxUSE_MENUS - wxMenu* GetWindowMenu() const { return m_pWindowMenu; } - void SetWindowMenu(wxMenu* pMenu); - - virtual void SetMenuBar(wxMenuBar *pMenuBar); -#endif // wxUSE_MENUS - - void SetChildMenuBar(wxAuiMDIChildFrame *pChild); - - virtual bool ProcessEvent(wxEvent& event); - - wxAuiMDIChildFrame *GetActiveChild() const; - void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); - - wxAuiMDIClientWindow *GetClientWindow() const; - virtual wxAuiMDIClientWindow *OnCreateClient(); - - virtual void Cascade() { /* Has no effect */ } - virtual void Tile(wxOrientation orient = wxHORIZONTAL); - virtual void ArrangeIcons() { /* Has no effect */ } - virtual void ActivateNext(); - virtual void ActivatePrevious(); - -protected: - wxAuiMDIClientWindow* m_pClientWindow; - wxAuiMDIChildFrame* m_pActiveChild; - wxEvent* m_pLastEvt; - -#if wxUSE_MENUS - wxMenu *m_pWindowMenu; - wxMenuBar *m_pMyMenuBar; -#endif // wxUSE_MENUS - -protected: - void Init(); - -#if wxUSE_MENUS - void RemoveWindowMenu(wxMenuBar *pMenuBar); - void AddWindowMenu(wxMenuBar *pMenuBar); - - void DoHandleMenu(wxCommandEvent &event); -#endif // wxUSE_MENUS - - virtual void DoGetClientSize(int *width, int *height) const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame) -}; - -//----------------------------------------------------------------------------- -// wxAuiMDIChildFrame -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel -{ -public: - wxAuiMDIChildFrame(); - wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxAuiMDIChildFrame(); - bool Create(wxAuiMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - -#if wxUSE_MENUS - virtual void SetMenuBar(wxMenuBar *menu_bar); - virtual wxMenuBar *GetMenuBar() const; -#endif // wxUSE_MENUS - - virtual void SetTitle(const wxString& title); - virtual wxString GetTitle() const; - - virtual void SetIcons(const wxIconBundle& icons); - virtual const wxIconBundle& GetIcons() const; - - virtual void SetIcon(const wxIcon& icon); - virtual const wxIcon& GetIcon() const; - - virtual void Activate(); - virtual bool Destroy(); - -#if wxUSE_STATUSBAR - // no status bars - virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1, - long WXUNUSED(style) = 1, - wxWindowID WXUNUSED(winid) = 1, - const wxString& WXUNUSED(name) = wxEmptyString) - { return (wxStatusBar*)NULL; } - - virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } - virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} - virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} -#endif - - // no size hints - virtual void DoSetSizeHints(int WXUNUSED(minW), - int WXUNUSED(minH), - int WXUNUSED(maxW) = wxDefaultCoord, - int WXUNUSED(maxH) = wxDefaultCoord, - int WXUNUSED(incW) = wxDefaultCoord, - int WXUNUSED(incH) = wxDefaultCoord) {} -#if wxUSE_TOOLBAR - // no toolbar bars - virtual wxToolBar* CreateToolBar(long WXUNUSED(style), - wxWindowID WXUNUSED(winid), - const wxString& WXUNUSED(name)) - { return (wxToolBar*)NULL; } - virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } -#endif - - - // no maximize etc - virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ } - virtual void Restore() { /* Has no effect */ } - virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } - virtual bool IsMaximized() const { return true; } - virtual bool IsIconized() const { return false; } - virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } - virtual bool IsFullScreen() const { return false; } - - virtual bool IsTopLevel() const { return false; } - - void OnMenuHighlight(wxMenuEvent& evt); - void OnActivate(wxActivateEvent& evt); - void OnCloseWindow(wxCloseEvent& evt); - - void SetMDIParentFrame(wxAuiMDIParentFrame* parent); - wxAuiMDIParentFrame* GetMDIParentFrame() const; - -protected: - void Init(); - virtual bool Show(bool show = true); - virtual void DoSetSize(int x, int y, int width, int height, int size_flags); - virtual void DoMoveWindow(int x, int y, int width, int height); - -public: - // This function needs to be called when a size change is confirmed, - // we needed this function to prevent anybody from the outside - // changing the panel... it messes the UI layout when we would allow it. - void ApplyMDIChildFrameRect(); - void DoShow(bool show); - -protected: - wxAuiMDIParentFrame* m_pMDIParentFrame; - wxRect m_mdi_newrect; - wxRect m_mdi_currect; - wxString m_title; - wxIcon m_icon; - wxIconBundle m_icon_bundle; - bool m_activate_on_create; - -#if wxUSE_MENUS - wxMenuBar* m_pMenuBar; -#endif // wxUSE_MENUS - - - -private: - DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) - DECLARE_EVENT_TABLE() - - friend class wxAuiMDIClientWindow; -}; - -//----------------------------------------------------------------------------- -// wxAuiMDIClientWindow -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook -{ -public: - wxAuiMDIClientWindow(); - wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); - ~wxAuiMDIClientWindow(); - - virtual bool CreateClient(wxAuiMDIParentFrame *parent, - long style = wxVSCROLL | wxHSCROLL); - - virtual int SetSelection(size_t page); - -protected: - - void PageChanged(int old_selection, int new_selection); - void OnPageClose(wxAuiNotebookEvent& evt); - void OnPageChanged(wxAuiNotebookEvent& evt); - void OnSize(wxSizeEvent& evt); - -private: - DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) - DECLARE_EVENT_TABLE() -}; -#endif // wxUSE_AUI - -#endif // _WX_AUITABMDI_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/tabmdi.h +// Purpose: Generic MDI (Multiple Document Interface) classes +// Author: Hans Van Leemputten +// Modified by: Benjamin I. Williams / Kirix Corporation +// Created: 29/07/2002 +// RCS-ID: $Id: tabmdi.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Hans Van Leemputten +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUITABMDI_H_ +#define _WX_AUITABMDI_H_ + +#if wxUSE_AUI + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/frame.h" +#include "wx/panel.h" +#include "wx/notebook.h" +#include "wx/icon.h" +#include "wx/aui/auibook.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame; +class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow; +class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame; + +//----------------------------------------------------------------------------- +// wxAuiMDIParentFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame +{ +public: + wxAuiMDIParentFrame(); + wxAuiMDIParentFrame(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr); + + ~wxAuiMDIParentFrame(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr ); + + void SetArtProvider(wxAuiTabArt* provider); + wxAuiTabArt* GetArtProvider(); + wxAuiNotebook* GetNotebook() const; + +#if wxUSE_MENUS + wxMenu* GetWindowMenu() const { return m_pWindowMenu; } + void SetWindowMenu(wxMenu* pMenu); + + virtual void SetMenuBar(wxMenuBar *pMenuBar); +#endif // wxUSE_MENUS + + void SetChildMenuBar(wxAuiMDIChildFrame *pChild); + + virtual bool ProcessEvent(wxEvent& event); + + wxAuiMDIChildFrame *GetActiveChild() const; + void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); + + wxAuiMDIClientWindow *GetClientWindow() const; + virtual wxAuiMDIClientWindow *OnCreateClient(); + + virtual void Cascade() { /* Has no effect */ } + virtual void Tile(wxOrientation orient = wxHORIZONTAL); + virtual void ArrangeIcons() { /* Has no effect */ } + virtual void ActivateNext(); + virtual void ActivatePrevious(); + +protected: + wxAuiMDIClientWindow* m_pClientWindow; + wxAuiMDIChildFrame* m_pActiveChild; + wxEvent* m_pLastEvt; + +#if wxUSE_MENUS + wxMenu *m_pWindowMenu; + wxMenuBar *m_pMyMenuBar; +#endif // wxUSE_MENUS + +protected: + void Init(); + +#if wxUSE_MENUS + void RemoveWindowMenu(wxMenuBar *pMenuBar); + void AddWindowMenu(wxMenuBar *pMenuBar); + + void DoHandleMenu(wxCommandEvent &event); +#endif // wxUSE_MENUS + + virtual void DoGetClientSize(int *width, int *height) const; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame) +}; + +//----------------------------------------------------------------------------- +// wxAuiMDIChildFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel +{ +public: + wxAuiMDIChildFrame(); + wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxAuiMDIChildFrame(); + bool Create(wxAuiMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + +#if wxUSE_MENUS + virtual void SetMenuBar(wxMenuBar *menu_bar); + virtual wxMenuBar *GetMenuBar() const; +#endif // wxUSE_MENUS + + virtual void SetTitle(const wxString& title); + virtual wxString GetTitle() const; + + virtual void SetIcons(const wxIconBundle& icons); + virtual const wxIconBundle& GetIcons() const; + + virtual void SetIcon(const wxIcon& icon); + virtual const wxIcon& GetIcon() const; + + virtual void Activate(); + virtual bool Destroy(); + +#if wxUSE_STATUSBAR + // no status bars + virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1, + long WXUNUSED(style) = 1, + wxWindowID WXUNUSED(winid) = 1, + const wxString& WXUNUSED(name) = wxEmptyString) + { return (wxStatusBar*)NULL; } + + virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } + virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} + virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} +#endif + + // no size hints + virtual void DoSetSizeHints(int WXUNUSED(minW), + int WXUNUSED(minH), + int WXUNUSED(maxW) = wxDefaultCoord, + int WXUNUSED(maxH) = wxDefaultCoord, + int WXUNUSED(incW) = wxDefaultCoord, + int WXUNUSED(incH) = wxDefaultCoord) {} +#if wxUSE_TOOLBAR + // no toolbar bars + virtual wxToolBar* CreateToolBar(long WXUNUSED(style), + wxWindowID WXUNUSED(winid), + const wxString& WXUNUSED(name)) + { return (wxToolBar*)NULL; } + virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } +#endif + + + // no maximize etc + virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ } + virtual void Restore() { /* Has no effect */ } + virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } + virtual bool IsMaximized() const { return true; } + virtual bool IsIconized() const { return false; } + virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } + virtual bool IsFullScreen() const { return false; } + + virtual bool IsTopLevel() const { return false; } + + void OnMenuHighlight(wxMenuEvent& evt); + void OnActivate(wxActivateEvent& evt); + void OnCloseWindow(wxCloseEvent& evt); + + void SetMDIParentFrame(wxAuiMDIParentFrame* parent); + wxAuiMDIParentFrame* GetMDIParentFrame() const; + +protected: + void Init(); + virtual bool Show(bool show = true); + virtual void DoSetSize(int x, int y, int width, int height, int size_flags); + virtual void DoMoveWindow(int x, int y, int width, int height); + +public: + // This function needs to be called when a size change is confirmed, + // we needed this function to prevent anybody from the outside + // changing the panel... it messes the UI layout when we would allow it. + void ApplyMDIChildFrameRect(); + void DoShow(bool show); + +protected: + wxAuiMDIParentFrame* m_pMDIParentFrame; + wxRect m_mdi_newrect; + wxRect m_mdi_currect; + wxString m_title; + wxIcon m_icon; + wxIconBundle m_icon_bundle; + bool m_activate_on_create; + +#if wxUSE_MENUS + wxMenuBar* m_pMenuBar; +#endif // wxUSE_MENUS + + + +private: + DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) + DECLARE_EVENT_TABLE() + + friend class wxAuiMDIClientWindow; +}; + +//----------------------------------------------------------------------------- +// wxAuiMDIClientWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook +{ +public: + wxAuiMDIClientWindow(); + wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); + ~wxAuiMDIClientWindow(); + + virtual bool CreateClient(wxAuiMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL); + + virtual int SetSelection(size_t page); + +protected: + + void PageChanged(int old_selection, int new_selection); + void OnPageClose(wxAuiNotebookEvent& evt); + void OnPageChanged(wxAuiNotebookEvent& evt); + void OnSize(wxSizeEvent& evt); + +private: + DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) + DECLARE_EVENT_TABLE() +}; +#endif // wxUSE_AUI + +#endif // _WX_AUITABMDI_H_ diff --git a/Externals/wxWidgets/include/wx/beforestd.h b/Externals/wxWidgets/include/wx/beforestd.h index 09882f4308..aacfc7c41e 100644 --- a/Externals/wxWidgets/include/wx/beforestd.h +++ b/Externals/wxWidgets/include/wx/beforestd.h @@ -1,65 +1,65 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/beforestd.h -// Purpose: #include before STL headers -// Author: Vadim Zeitlin -// Modified by: -// Created: 07/07/03 -// RCS-ID: $Id: beforestd.h 42906 2006-11-01 14:16:42Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/** - Unfortunately, when compiling at maximum warning level, the standard - headers themselves may generate warnings -- and really lots of them. So - before including them, this header should be included to temporarily - suppress the warnings and after this the header afterstd.h should be - included to enable them back again. - - Note that there are intentionally no inclusion guards in this file, because - it can be included several times. - */ - -// VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which -// defines _MSC_VER as 1201) does need to be included as it's VC6-like -#if defined(__VISUALC__) && __VISUALC__ <= 1201 - // MSVC 5 does not have this - #if __VISUALC__ > 1100 - // we have to disable (and reenable in afterstd.h) this one because, - // even though it is of level 4, it is not disabled by warning(push, 1) - // below for VC7.1! - - // unreachable code - #pragma warning(disable:4702) - - #pragma warning(push, 1) - #else // VC 5 - // 'expression' : signed/unsigned mismatch - #pragma warning(disable:4018) - - // 'identifier' : unreferenced formal parameter - #pragma warning(disable:4100) - - // 'conversion' : conversion from 'type1' to 'type2', - // possible loss of data - #pragma warning(disable:4244) - - // C++ language change: to explicitly specialize class template - // 'identifier' use the following syntax - #pragma warning(disable:4663) - #endif - - // these warning have to be disabled and not just temporarily disabled - // because they will be given at the end of the compilation of the - // current source and there is absolutely nothing we can do about them - - // 'foo': unreferenced inline function has been removed - #pragma warning(disable:4514) - - // 'function' : function not inlined - #pragma warning(disable:4710) - - // 'id': identifier was truncated to 'num' characters in the debug info - #pragma warning(disable:4786) -#endif // VC++ < 7 - +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/beforestd.h +// Purpose: #include before STL headers +// Author: Vadim Zeitlin +// Modified by: +// Created: 07/07/03 +// RCS-ID: $Id: beforestd.h 42906 2006-11-01 14:16:42Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/** + Unfortunately, when compiling at maximum warning level, the standard + headers themselves may generate warnings -- and really lots of them. So + before including them, this header should be included to temporarily + suppress the warnings and after this the header afterstd.h should be + included to enable them back again. + + Note that there are intentionally no inclusion guards in this file, because + it can be included several times. + */ + +// VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which +// defines _MSC_VER as 1201) does need to be included as it's VC6-like +#if defined(__VISUALC__) && __VISUALC__ <= 1201 + // MSVC 5 does not have this + #if __VISUALC__ > 1100 + // we have to disable (and reenable in afterstd.h) this one because, + // even though it is of level 4, it is not disabled by warning(push, 1) + // below for VC7.1! + + // unreachable code + #pragma warning(disable:4702) + + #pragma warning(push, 1) + #else // VC 5 + // 'expression' : signed/unsigned mismatch + #pragma warning(disable:4018) + + // 'identifier' : unreferenced formal parameter + #pragma warning(disable:4100) + + // 'conversion' : conversion from 'type1' to 'type2', + // possible loss of data + #pragma warning(disable:4244) + + // C++ language change: to explicitly specialize class template + // 'identifier' use the following syntax + #pragma warning(disable:4663) + #endif + + // these warning have to be disabled and not just temporarily disabled + // because they will be given at the end of the compilation of the + // current source and there is absolutely nothing we can do about them + + // 'foo': unreferenced inline function has been removed + #pragma warning(disable:4514) + + // 'function' : function not inlined + #pragma warning(disable:4710) + + // 'id': identifier was truncated to 'num' characters in the debug info + #pragma warning(disable:4786) +#endif // VC++ < 7 + diff --git a/Externals/wxWidgets/include/wx/bitmap.h b/Externals/wxWidgets/include/wx/bitmap.h index bcee143739..92d4564780 100644 --- a/Externals/wxWidgets/include/wx/bitmap.h +++ b/Externals/wxWidgets/include/wx/bitmap.h @@ -1,241 +1,241 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/bitmap.h -// Purpose: wxBitmap class interface -// Author: Vaclav Slavik -// Modified by: -// Created: 22.04.01 -// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BITMAP_H_BASE_ -#define _WX_BITMAP_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/string.h" -#include "wx/gdicmn.h" // for wxBitmapType -#include "wx/colour.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxMask; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -// ---------------------------------------------------------------------------- -// wxVariant support -// ---------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT) -#endif - -// ---------------------------------------------------------------------------- -// wxMask represents the transparent area of the bitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMaskBase : public wxObject -{ -public: - // create the mask from bitmap pixels of the given colour - bool Create(const wxBitmap& bitmap, const wxColour& colour); - -#if wxUSE_PALETTE - // create the mask from bitmap pixels with the given palette index - bool Create(const wxBitmap& bitmap, int paletteIndex); -#endif // wxUSE_PALETTE - - // create the mask from the given mono bitmap - bool Create(const wxBitmap& bitmap); - -protected: - // this function is called from Create() to free the existing mask data - virtual void FreeData() = 0; - - // these functions must be overridden to implement the corresponding public - // Create() methods, they shouldn't call FreeData() as it's already called - // by the public wrappers - virtual bool InitFromColour(const wxBitmap& bitmap, - const wxColour& colour) = 0; - virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0; -}; - -#if defined(__WXMGL__) || \ - defined(__WXDFB__) || \ - defined(__WXMAC__) || \ - defined(__WXGTK__) || \ - defined(__WXCOCOA__) || \ - defined(__WXMOTIF__) || \ - defined(__WXX11__) - #define wxUSE_BITMAP_BASE 1 -#else - #define wxUSE_BITMAP_BASE 0 -#endif - -// Only used by some ports -// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes -#if wxUSE_BITMAP_BASE - -// ---------------------------------------------------------------------------- -// wxBitmapHandler: class which knows how to create/load/save bitmaps in -// different formats -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapHandlerBase : public wxObject -{ -public: - wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; } - virtual ~wxBitmapHandlerBase() { } - - virtual bool Create(wxBitmap *bitmap, const void* data, long flags, - int width, int height, int depth = 1); - virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, - int type, const wxPalette *palette = NULL); - - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(wxBitmapType type) { m_type = type; } - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - wxBitmapType GetType() const { return m_type; } - -private: - wxString m_name; - wxString m_extension; - wxBitmapType m_type; - - DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase) -}; - -class WXDLLEXPORT wxBitmapBase : public wxGDIObject -{ -public: - /* - Derived class must implement these: - - wxBitmap(); - wxBitmap(int width, int height, int depth = -1); - wxBitmap(const char bits[], int width, int height, int depth = 1); - wxBitmap(const char* const* bits); - wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); - wxBitmap(const wxImage& image, int depth = -1); - - bool Create(int width, int height, int depth = -1); - - static void InitStandardHandlers(); - */ - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - - virtual int GetHeight() const = 0; - virtual int GetWidth() const = 0; - virtual int GetDepth() const = 0; - - virtual wxImage ConvertToImage() const = 0; - - virtual wxMask *GetMask() const = 0; - virtual void SetMask(wxMask *mask) = 0; - - virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0; - - virtual bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = (wxPalette *)NULL) const = 0; - virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0; - - /* - If raw bitmap access is supported (see wx/rawbmp.h), the following - methods should be implemented: - - virtual bool GetRawData(wxRawBitmapData *data) = 0; - virtual void UngetRawData(wxRawBitmapData *data) = 0; - */ - -#if wxUSE_PALETTE - virtual wxPalette *GetPalette() const = 0; - virtual void SetPalette(const wxPalette& palette) = 0; -#endif // wxUSE_PALETTE - - // copies the contents and mask of the given (colour) icon to the bitmap - virtual bool CopyFromIcon(const wxIcon& icon) = 0; - - // implementation: - virtual void SetHeight(int height) = 0; - virtual void SetWidth(int width) = 0; - virtual void SetDepth(int depth) = 0; - - // Format handling - static inline wxList& GetHandlers() { return sm_handlers; } - static void AddHandler(wxBitmapHandlerBase *handler); - static void InsertHandler(wxBitmapHandlerBase *handler); - static bool RemoveHandler(const wxString& name); - static wxBitmapHandler *FindHandler(const wxString& name); - static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType); - static wxBitmapHandler *FindHandler(wxBitmapType bitmapType); - - //static void InitStandardHandlers(); - // (wxBitmap must implement this one) - - static void CleanUpHandlers(); - - // this method is only used by the generic implementation of wxMask - // currently but could be useful elsewhere in the future: it can be - // overridden to quantize the colour to correspond to bitmap colour depth - // if necessary; default implementation simply returns the colour as is - virtual wxColour QuantizeColour(const wxColour& colour) const - { - return colour; - } - -protected: - static wxList sm_handlers; - - DECLARE_ABSTRACT_CLASS(wxBitmapBase) -}; - -#endif // wxUSE_BITMAP_BASE - -#if defined(__WXPALMOS__) - #include "wx/palmos/bitmap.h" -#elif defined(__WXMSW__) - #include "wx/msw/bitmap.h" -#elif defined(__WXMOTIF__) - #include "wx/x11/bitmap.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/bitmap.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/bitmap.h" -#elif defined(__WXX11__) - #include "wx/x11/bitmap.h" -#elif defined(__WXMGL__) - #include "wx/mgl/bitmap.h" -#elif defined(__WXDFB__) - #include "wx/dfb/bitmap.h" -#elif defined(__WXMAC__) - #include "wx/mac/bitmap.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/bitmap.h" -#elif defined(__WXPM__) - #include "wx/os2/bitmap.h" -#endif - -// we must include generic mask.h after wxBitmap definition -#if defined(__WXMGL__) || defined(__WXDFB__) - #define wxUSE_GENERIC_MASK 1 -#else - #define wxUSE_GENERIC_MASK 0 -#endif - -#if wxUSE_GENERIC_MASK - #include "wx/generic/mask.h" -#endif - -#endif // _WX_BITMAP_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bitmap.h +// Purpose: wxBitmap class interface +// Author: Vaclav Slavik +// Modified by: +// Created: 22.04.01 +// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_BASE_ +#define _WX_BITMAP_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/string.h" +#include "wx/gdicmn.h" // for wxBitmapType +#include "wx/colour.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxMask; +class WXDLLIMPEXP_FWD_CORE wxPalette; + +// ---------------------------------------------------------------------------- +// wxVariant support +// ---------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT) +#endif + +// ---------------------------------------------------------------------------- +// wxMask represents the transparent area of the bitmap +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMaskBase : public wxObject +{ +public: + // create the mask from bitmap pixels of the given colour + bool Create(const wxBitmap& bitmap, const wxColour& colour); + +#if wxUSE_PALETTE + // create the mask from bitmap pixels with the given palette index + bool Create(const wxBitmap& bitmap, int paletteIndex); +#endif // wxUSE_PALETTE + + // create the mask from the given mono bitmap + bool Create(const wxBitmap& bitmap); + +protected: + // this function is called from Create() to free the existing mask data + virtual void FreeData() = 0; + + // these functions must be overridden to implement the corresponding public + // Create() methods, they shouldn't call FreeData() as it's already called + // by the public wrappers + virtual bool InitFromColour(const wxBitmap& bitmap, + const wxColour& colour) = 0; + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0; +}; + +#if defined(__WXMGL__) || \ + defined(__WXDFB__) || \ + defined(__WXMAC__) || \ + defined(__WXGTK__) || \ + defined(__WXCOCOA__) || \ + defined(__WXMOTIF__) || \ + defined(__WXX11__) + #define wxUSE_BITMAP_BASE 1 +#else + #define wxUSE_BITMAP_BASE 0 +#endif + +// Only used by some ports +// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes +#if wxUSE_BITMAP_BASE + +// ---------------------------------------------------------------------------- +// wxBitmapHandler: class which knows how to create/load/save bitmaps in +// different formats +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapHandlerBase : public wxObject +{ +public: + wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; } + virtual ~wxBitmapHandlerBase() { } + + virtual bool Create(wxBitmap *bitmap, const void* data, long flags, + int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, + int type, const wxPalette *palette = NULL); + + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(wxBitmapType type) { m_type = type; } + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + wxBitmapType GetType() const { return m_type; } + +private: + wxString m_name; + wxString m_extension; + wxBitmapType m_type; + + DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase) +}; + +class WXDLLEXPORT wxBitmapBase : public wxGDIObject +{ +public: + /* + Derived class must implement these: + + wxBitmap(); + wxBitmap(int width, int height, int depth = -1); + wxBitmap(const char bits[], int width, int height, int depth = 1); + wxBitmap(const char* const* bits); + wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); + wxBitmap(const wxImage& image, int depth = -1); + + bool Create(int width, int height, int depth = -1); + + static void InitStandardHandlers(); + */ + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; + + virtual int GetHeight() const = 0; + virtual int GetWidth() const = 0; + virtual int GetDepth() const = 0; + + virtual wxImage ConvertToImage() const = 0; + + virtual wxMask *GetMask() const = 0; + virtual void SetMask(wxMask *mask) = 0; + + virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0; + + virtual bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = (wxPalette *)NULL) const = 0; + virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0; + + /* + If raw bitmap access is supported (see wx/rawbmp.h), the following + methods should be implemented: + + virtual bool GetRawData(wxRawBitmapData *data) = 0; + virtual void UngetRawData(wxRawBitmapData *data) = 0; + */ + +#if wxUSE_PALETTE + virtual wxPalette *GetPalette() const = 0; + virtual void SetPalette(const wxPalette& palette) = 0; +#endif // wxUSE_PALETTE + + // copies the contents and mask of the given (colour) icon to the bitmap + virtual bool CopyFromIcon(const wxIcon& icon) = 0; + + // implementation: + virtual void SetHeight(int height) = 0; + virtual void SetWidth(int width) = 0; + virtual void SetDepth(int depth) = 0; + + // Format handling + static inline wxList& GetHandlers() { return sm_handlers; } + static void AddHandler(wxBitmapHandlerBase *handler); + static void InsertHandler(wxBitmapHandlerBase *handler); + static bool RemoveHandler(const wxString& name); + static wxBitmapHandler *FindHandler(const wxString& name); + static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType); + static wxBitmapHandler *FindHandler(wxBitmapType bitmapType); + + //static void InitStandardHandlers(); + // (wxBitmap must implement this one) + + static void CleanUpHandlers(); + + // this method is only used by the generic implementation of wxMask + // currently but could be useful elsewhere in the future: it can be + // overridden to quantize the colour to correspond to bitmap colour depth + // if necessary; default implementation simply returns the colour as is + virtual wxColour QuantizeColour(const wxColour& colour) const + { + return colour; + } + +protected: + static wxList sm_handlers; + + DECLARE_ABSTRACT_CLASS(wxBitmapBase) +}; + +#endif // wxUSE_BITMAP_BASE + +#if defined(__WXPALMOS__) + #include "wx/palmos/bitmap.h" +#elif defined(__WXMSW__) + #include "wx/msw/bitmap.h" +#elif defined(__WXMOTIF__) + #include "wx/x11/bitmap.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/bitmap.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/bitmap.h" +#elif defined(__WXX11__) + #include "wx/x11/bitmap.h" +#elif defined(__WXMGL__) + #include "wx/mgl/bitmap.h" +#elif defined(__WXDFB__) + #include "wx/dfb/bitmap.h" +#elif defined(__WXMAC__) + #include "wx/mac/bitmap.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/bitmap.h" +#elif defined(__WXPM__) + #include "wx/os2/bitmap.h" +#endif + +// we must include generic mask.h after wxBitmap definition +#if defined(__WXMGL__) || defined(__WXDFB__) + #define wxUSE_GENERIC_MASK 1 +#else + #define wxUSE_GENERIC_MASK 0 +#endif + +#if wxUSE_GENERIC_MASK + #include "wx/generic/mask.h" +#endif + +#endif // _WX_BITMAP_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/bmpbuttn.h b/Externals/wxWidgets/include/wx/bmpbuttn.h index f7b96b662d..c37d2cd7c5 100644 --- a/Externals/wxWidgets/include/wx/bmpbuttn.h +++ b/Externals/wxWidgets/include/wx/bmpbuttn.h @@ -1,122 +1,122 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/bmpbutton.h -// Purpose: wxBitmapButton class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.08.00 -// RCS-ID: $Id: bmpbuttn.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BMPBUTTON_H_BASE_ -#define _WX_BMPBUTTON_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_BMPBUTTON - -#include "wx/bitmap.h" -#include "wx/button.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; - -// ---------------------------------------------------------------------------- -// wxBitmapButton: a button which shows bitmaps instead of the usual string. -// It has different bitmaps for different states (focused/disabled/pressed) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapButtonBase : public wxButton -{ -public: - wxBitmapButtonBase() - { - m_marginX = - m_marginY = 0; - } - - // set the bitmaps - void SetBitmapLabel(const wxBitmap& bitmap) - { m_bmpNormal = bitmap; OnSetBitmap(); } - void SetBitmapSelected(const wxBitmap& sel) - { m_bmpSelected = sel; OnSetBitmap(); } - void SetBitmapFocus(const wxBitmap& focus) - { m_bmpFocus = focus; OnSetBitmap(); } - void SetBitmapDisabled(const wxBitmap& disabled) - { m_bmpDisabled = disabled; OnSetBitmap(); } - void SetBitmapHover(const wxBitmap& hover) - { m_bmpHover = hover; OnSetBitmap(); } - - // retrieve the bitmaps - const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; } - const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } - const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } - const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } - const wxBitmap& GetBitmapHover() const { return m_bmpHover; } - wxBitmap& GetBitmapLabel() { return m_bmpNormal; } - wxBitmap& GetBitmapSelected() { return m_bmpSelected; } - wxBitmap& GetBitmapFocus() { return m_bmpFocus; } - wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; } - wxBitmap& GetBitmapHover() { return m_bmpHover; } - - // set/get the margins around the button - virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } - int GetMarginX() const { return m_marginX; } - int GetMarginY() const { return m_marginY; } - - // deprecated synonym for SetBitmapLabel() -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) ); - - // prevent virtual function hiding - virtual void SetLabel(const wxString& label) - { wxWindow::SetLabel(label); } -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // function called when any of the bitmaps changes - virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); } - - // the bitmaps for various states - wxBitmap m_bmpNormal, - m_bmpSelected, - m_bmpFocus, - m_bmpDisabled, - m_bmpHover; - - // the margins around the bitmap - int m_marginX, - m_marginY; - - - DECLARE_NO_COPY_CLASS(wxBitmapButtonBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap) -{ - SetBitmapLabel(bitmap); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/bmpbuttn.h" -#elif defined(__WXMSW__) - #include "wx/msw/bmpbuttn.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/bmpbuttn.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/bmpbuttn.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/bmpbuttn.h" -#elif defined(__WXMAC__) - #include "wx/mac/bmpbuttn.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/bmpbuttn.h" -#elif defined(__WXPM__) - #include "wx/os2/bmpbuttn.h" -#endif - -#endif // wxUSE_BMPBUTTON - -#endif // _WX_BMPBUTTON_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/bmpbutton.h +// Purpose: wxBitmapButton class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// RCS-ID: $Id: bmpbuttn.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTON_H_BASE_ +#define _WX_BMPBUTTON_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_BMPBUTTON + +#include "wx/bitmap.h" +#include "wx/button.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; + +// ---------------------------------------------------------------------------- +// wxBitmapButton: a button which shows bitmaps instead of the usual string. +// It has different bitmaps for different states (focused/disabled/pressed) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapButtonBase : public wxButton +{ +public: + wxBitmapButtonBase() + { + m_marginX = + m_marginY = 0; + } + + // set the bitmaps + void SetBitmapLabel(const wxBitmap& bitmap) + { m_bmpNormal = bitmap; OnSetBitmap(); } + void SetBitmapSelected(const wxBitmap& sel) + { m_bmpSelected = sel; OnSetBitmap(); } + void SetBitmapFocus(const wxBitmap& focus) + { m_bmpFocus = focus; OnSetBitmap(); } + void SetBitmapDisabled(const wxBitmap& disabled) + { m_bmpDisabled = disabled; OnSetBitmap(); } + void SetBitmapHover(const wxBitmap& hover) + { m_bmpHover = hover; OnSetBitmap(); } + + // retrieve the bitmaps + const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; } + const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } + const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } + const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } + const wxBitmap& GetBitmapHover() const { return m_bmpHover; } + wxBitmap& GetBitmapLabel() { return m_bmpNormal; } + wxBitmap& GetBitmapSelected() { return m_bmpSelected; } + wxBitmap& GetBitmapFocus() { return m_bmpFocus; } + wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; } + wxBitmap& GetBitmapHover() { return m_bmpHover; } + + // set/get the margins around the button + virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } + int GetMarginX() const { return m_marginX; } + int GetMarginY() const { return m_marginY; } + + // deprecated synonym for SetBitmapLabel() +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) ); + + // prevent virtual function hiding + virtual void SetLabel(const wxString& label) + { wxWindow::SetLabel(label); } +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + // function called when any of the bitmaps changes + virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); } + + // the bitmaps for various states + wxBitmap m_bmpNormal, + m_bmpSelected, + m_bmpFocus, + m_bmpDisabled, + m_bmpHover; + + // the margins around the bitmap + int m_marginX, + m_marginY; + + + DECLARE_NO_COPY_CLASS(wxBitmapButtonBase) +}; + +#if WXWIN_COMPATIBILITY_2_6 +inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap) +{ + SetBitmapLabel(bitmap); +} +#endif // WXWIN_COMPATIBILITY_2_6 + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/bmpbuttn.h" +#elif defined(__WXMSW__) + #include "wx/msw/bmpbuttn.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/bmpbuttn.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/bmpbuttn.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/bmpbuttn.h" +#elif defined(__WXMAC__) + #include "wx/mac/bmpbuttn.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/bmpbuttn.h" +#elif defined(__WXPM__) + #include "wx/os2/bmpbuttn.h" +#endif + +#endif // wxUSE_BMPBUTTON + +#endif // _WX_BMPBUTTON_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/bmpcbox.h b/Externals/wxWidgets/include/wx/bmpcbox.h index aab8ce3c88..09fb32c4cb 100644 --- a/Externals/wxWidgets/include/wx/bmpcbox.h +++ b/Externals/wxWidgets/include/wx/bmpcbox.h @@ -1,49 +1,49 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/bmpcbox.h -// Purpose: wxBitmapComboBox base header -// Author: Jaakko Salli -// Modified by: -// Created: Aug-31-2006 -// Copyright: (c) Jaakko Salli -// RCS-ID: $Id: bmpcbox.h 42046 2006-10-16 09:30:01Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BMPCBOX_H_BASE_ -#define _WX_BMPCBOX_H_BASE_ - - -#include "wx/defs.h" - -#if wxUSE_BITMAPCOMBOBOX - -#include "wx/bitmap.h" - - -extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxBitmapComboBoxNameStr[]; - - -class WXDLLIMPEXP_ADV wxBitmapComboBoxBase -{ -public: - // ctors and such - wxBitmapComboBoxBase() { } - - virtual ~wxBitmapComboBoxBase() { } - - // Returns the image of the item with the given index. - virtual wxBitmap GetItemBitmap(unsigned int n) const = 0; - - // Sets the image for the given item. - virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0; - - // Returns size of the image used in list - virtual wxSize GetBitmapSize() const = 0; -}; - - -#include "wx/generic/bmpcbox.h" - -#endif // wxUSE_BITMAPCOMBOBOX - -#endif // _WX_BMPCBOX_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/bmpcbox.h +// Purpose: wxBitmapComboBox base header +// Author: Jaakko Salli +// Modified by: +// Created: Aug-31-2006 +// Copyright: (c) Jaakko Salli +// RCS-ID: $Id: bmpcbox.h 42046 2006-10-16 09:30:01Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPCBOX_H_BASE_ +#define _WX_BMPCBOX_H_BASE_ + + +#include "wx/defs.h" + +#if wxUSE_BITMAPCOMBOBOX + +#include "wx/bitmap.h" + + +extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxBitmapComboBoxNameStr[]; + + +class WXDLLIMPEXP_ADV wxBitmapComboBoxBase +{ +public: + // ctors and such + wxBitmapComboBoxBase() { } + + virtual ~wxBitmapComboBoxBase() { } + + // Returns the image of the item with the given index. + virtual wxBitmap GetItemBitmap(unsigned int n) const = 0; + + // Sets the image for the given item. + virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0; + + // Returns size of the image used in list + virtual wxSize GetBitmapSize() const = 0; +}; + + +#include "wx/generic/bmpcbox.h" + +#endif // wxUSE_BITMAPCOMBOBOX + +#endif // _WX_BMPCBOX_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/bookctrl.h b/Externals/wxWidgets/include/wx/bookctrl.h index 98a95dc6eb..ba1bdfe5bc 100644 --- a/Externals/wxWidgets/include/wx/bookctrl.h +++ b/Externals/wxWidgets/include/wx/bookctrl.h @@ -1,403 +1,403 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/bookctrl.h -// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.03 -// RCS-ID: $Id: bookctrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BOOKCTRL_H_ -#define _WX_BOOKCTRL_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_BOOKCTRL - -#include "wx/control.h" -#include "wx/dynarray.h" - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); - -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxBookCtrl hit results -enum -{ - wxBK_HITTEST_NOWHERE = 1, // not on tab - wxBK_HITTEST_ONICON = 2, // on icon - wxBK_HITTEST_ONLABEL = 4, // on label - wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL, - wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page -}; - -// wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook) -#define wxBK_DEFAULT 0x0000 -#define wxBK_TOP 0x0010 -#define wxBK_BOTTOM 0x0020 -#define wxBK_LEFT 0x0040 -#define wxBK_RIGHT 0x0080 -#define wxBK_ALIGN_MASK (wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT) - -// ---------------------------------------------------------------------------- -// wxBookCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBookCtrlBase : public wxControl -{ -public: - // construction - // ------------ - - wxBookCtrlBase() - { - Init(); - } - - wxBookCtrlBase(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, winid, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - // dtor - virtual ~wxBookCtrlBase(); - - - // accessors - // --------- - - // get number of pages in the dialog - virtual size_t GetPageCount() const { return m_pages.size(); } - - // get the panel which represents the given page - wxWindow *GetPage(size_t n) { return m_pages[n]; } - wxWindow *GetPage(size_t n) const { return m_pages[n]; } - - // get the current page or NULL if none - wxWindow *GetCurrentPage() const - { - const int n = GetSelection(); - return n == wxNOT_FOUND ? NULL : GetPage(n); - } - - // get the currently selected page or wxNOT_FOUND if none - virtual int GetSelection() const = 0; - - // set/get the title of a page - virtual bool SetPageText(size_t n, const wxString& strText) = 0; - virtual wxString GetPageText(size_t n) const = 0; - - - // image list stuff: each page may have an image associated with it (all - // images belong to the same image list) - // --------------------------------------------------------------------- - - // sets the image list to use, it is *not* deleted by the control - virtual void SetImageList(wxImageList *imageList); - - // as SetImageList() but we will delete the image list ourselves - void AssignImageList(wxImageList *imageList); - - // get pointer (may be NULL) to the associated image list - wxImageList* GetImageList() const { return m_imageList; } - - // sets/returns item's image index in the current image list - virtual int GetPageImage(size_t n) const = 0; - virtual bool SetPageImage(size_t n, int imageId) = 0; - - - // geometry - // -------- - - // resize the notebook so that all pages will have the specified size - virtual void SetPageSize(const wxSize& size); - - // calculate the size of the control from the size of its page - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0; - - // get/set size of area between book control area and page area - unsigned int GetInternalBorder() const { return m_internalBorder; } - void SetInternalBorder(unsigned int border) { m_internalBorder = border; } - - // Sets/gets the margin around the controller - void SetControlMargin(int margin) { m_controlMargin = margin; } - int GetControlMargin() const { return m_controlMargin; } - - // returns true if we have wxBK_TOP or wxBK_BOTTOM style - bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); } - - // set/get option to shrink to fit current page - void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; } - bool GetFitToCurrentPage() const { return m_fitToCurrentPage; } - - // returns the sizer containing the control, if any - wxSizer* GetControlSizer() const { return m_controlSizer; } - - // operations - // ---------- - - // remove one page from the control and delete it - virtual bool DeletePage(size_t n); - - // remove one page from the notebook, without deleting it - virtual bool RemovePage(size_t n) - { - DoInvalidateBestSize(); - return DoRemovePage(n) != NULL; - } - - // remove all pages and delete them - virtual bool DeleteAllPages() - { - DoInvalidateBestSize(); - WX_CLEAR_ARRAY(m_pages); - return true; - } - - // adds a new page to the control - virtual bool AddPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1) - { - DoInvalidateBestSize(); - return InsertPage(GetPageCount(), page, text, bSelect, imageId); - } - - // the same as AddPage(), but adds the page at the specified position - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1) = 0; - - // set the currently selected page, return the index of the previously - // selected one (or -1 on error) - // - // NB: this function will generate PAGE_CHANGING/ED events - virtual int SetSelection(size_t n) = 0; - - // acts as SetSelection but does not generate events - virtual int ChangeSelection(size_t n) = 0; - - - // cycle thru the pages - void AdvanceSelection(bool forward = true) - { - int nPage = GetNextPage(forward); - if ( nPage != -1 ) - { - // cast is safe because of the check above - SetSelection((size_t)nPage); - } - } - - // hit test: returns which page is hit and, optionally, where (icon, label) - virtual int HitTest(const wxPoint& WXUNUSED(pt), - long * WXUNUSED(flags) = NULL) const - { - return wxNOT_FOUND; - } - - - // we do have multiple pages - virtual bool HasMultiplePages() const { return true; } - - -protected: - // flags for DoSetSelection() - enum - { - SetSelection_SendEvent = 1 - }; - - // set the selection to the given page, sending the events (which can - // possibly prevent the page change from taking place) if SendEvent flag is - // included - virtual int DoSetSelection(size_t nPage, int flags = 0); - - // if the derived class uses DoSetSelection() for implementing - // [Set|Change]Selection, it must override UpdateSelectedPage(), - // CreatePageChangingEvent() and MakeChangedEvent(), but as it might not - // use it, these functions are not pure virtual - - // called to notify the control about a new current page - virtual void UpdateSelectedPage(size_t WXUNUSED(newsel)) - { wxFAIL_MSG(wxT("Override this function!")); } - - // create a new "page changing" event - virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const - { wxFAIL_MSG(wxT("Override this function!")); return NULL; } - - // modify the event created by CreatePageChangingEvent() to "page changed" - // event, usually by just calling SetEventType() on it - virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event)) - { wxFAIL_MSG(wxT("Override this function!")); } - - - // Should we accept NULL page pointers in Add/InsertPage()? - // - // Default is no but derived classes may override it if they can treat NULL - // pages in some sensible way (e.g. wxTreebook overrides this to allow - // having nodes without any associated page) - virtual bool AllowNullPage() const { return false; } - - // remove the page and return a pointer to it - virtual wxWindow *DoRemovePage(size_t page) = 0; - - // our best size is the size which fits all our pages - virtual wxSize DoGetBestSize() const; - - // helper: get the next page wrapping if we reached the end - int GetNextPage(bool forward) const; - - // Lay out controls - void DoSize(); - - // This method also invalidates the size of the controller and should be - // called instead of just InvalidateBestSize() whenever pages are added or - // removed as this also affects the controller - void DoInvalidateBestSize(); - -#if wxUSE_HELP - // Show the help for the corresponding page - void OnHelp(wxHelpEvent& event); -#endif // wxUSE_HELP - - - // the array of all pages of this control - wxArrayPages m_pages; - - // the associated image list or NULL - wxImageList *m_imageList; - - // true if we must delete m_imageList - bool m_ownsImageList; - - // get the page area - wxRect GetPageRect() const; - - // event handlers - virtual wxSize GetControllerSize() const; - void OnSize(wxSizeEvent& event); - - // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook) - wxControl *m_bookctrl; - - // Whether to shrink to fit current page - bool m_fitToCurrentPage; - - // the sizer containing the choice control - wxSizer *m_controlSizer; - - // the margin around the choice control - int m_controlMargin; - -private: - - // common part of all ctors - void Init(); - - // internal border - unsigned int m_internalBorder; - - DECLARE_ABSTRACT_CLASS(wxBookCtrlBase) - DECLARE_NO_COPY_CLASS(wxBookCtrlBase) - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// wxBookCtrlBaseEvent: page changing events generated by derived classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent -{ -public: - wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = -1, int nOldSel = -1) - : wxNotifyEvent(commandType, winid) - { - m_nSel = nSel; - m_nOldSel = nOldSel; - } - - wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event) - : wxNotifyEvent(event) - { - m_nSel = event.m_nSel; - m_nOldSel = event.m_nOldSel; - } - - // accessors - // the currently selected page (-1 if none) - int GetSelection() const { return m_nSel; } - void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (-1 if none) - int GetOldSelection() const { return m_nOldSel; } - void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page -}; - -// make a default book control for given platform -#if wxUSE_NOTEBOOK - // dedicated to majority of desktops - #include "wx/notebook.h" - #define wxBookCtrl wxNotebook - #define wxBookCtrlEvent wxNotebookEvent - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING - #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn) - #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn) - #define wxBookctrlEventHandler(func) wxNotebookEventHandler(func) -#else - // dedicated to Smartphones - #include "wx/choicebk.h" - #define wxBookCtrl wxChoicebook - #define wxBookCtrlEvent wxChoicebookEvent - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED - #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING - #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) - #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) - #define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func) -#endif - -#if WXWIN_COMPATIBILITY_2_6 - #define wxBC_TOP wxBK_TOP - #define wxBC_BOTTOM wxBK_BOTTOM - #define wxBC_LEFT wxBK_LEFT - #define wxBC_RIGHT wxBK_RIGHT - #define wxBC_DEFAULT wxBK_DEFAULT -#endif - -#endif // wxUSE_BOOKCTRL - -#endif // _WX_BOOKCTRL_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bookctrl.h +// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.03 +// RCS-ID: $Id: bookctrl.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BOOKCTRL_H_ +#define _WX_BOOKCTRL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_BOOKCTRL + +#include "wx/control.h" +#include "wx/dynarray.h" + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); + +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxBookCtrl hit results +enum +{ + wxBK_HITTEST_NOWHERE = 1, // not on tab + wxBK_HITTEST_ONICON = 2, // on icon + wxBK_HITTEST_ONLABEL = 4, // on label + wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL, + wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page +}; + +// wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook) +#define wxBK_DEFAULT 0x0000 +#define wxBK_TOP 0x0010 +#define wxBK_BOTTOM 0x0020 +#define wxBK_LEFT 0x0040 +#define wxBK_RIGHT 0x0080 +#define wxBK_ALIGN_MASK (wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT) + +// ---------------------------------------------------------------------------- +// wxBookCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBookCtrlBase : public wxControl +{ +public: + // construction + // ------------ + + wxBookCtrlBase() + { + Init(); + } + + wxBookCtrlBase(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, winid, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + // dtor + virtual ~wxBookCtrlBase(); + + + // accessors + // --------- + + // get number of pages in the dialog + virtual size_t GetPageCount() const { return m_pages.size(); } + + // get the panel which represents the given page + wxWindow *GetPage(size_t n) { return m_pages[n]; } + wxWindow *GetPage(size_t n) const { return m_pages[n]; } + + // get the current page or NULL if none + wxWindow *GetCurrentPage() const + { + const int n = GetSelection(); + return n == wxNOT_FOUND ? NULL : GetPage(n); + } + + // get the currently selected page or wxNOT_FOUND if none + virtual int GetSelection() const = 0; + + // set/get the title of a page + virtual bool SetPageText(size_t n, const wxString& strText) = 0; + virtual wxString GetPageText(size_t n) const = 0; + + + // image list stuff: each page may have an image associated with it (all + // images belong to the same image list) + // --------------------------------------------------------------------- + + // sets the image list to use, it is *not* deleted by the control + virtual void SetImageList(wxImageList *imageList); + + // as SetImageList() but we will delete the image list ourselves + void AssignImageList(wxImageList *imageList); + + // get pointer (may be NULL) to the associated image list + wxImageList* GetImageList() const { return m_imageList; } + + // sets/returns item's image index in the current image list + virtual int GetPageImage(size_t n) const = 0; + virtual bool SetPageImage(size_t n, int imageId) = 0; + + + // geometry + // -------- + + // resize the notebook so that all pages will have the specified size + virtual void SetPageSize(const wxSize& size); + + // calculate the size of the control from the size of its page + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0; + + // get/set size of area between book control area and page area + unsigned int GetInternalBorder() const { return m_internalBorder; } + void SetInternalBorder(unsigned int border) { m_internalBorder = border; } + + // Sets/gets the margin around the controller + void SetControlMargin(int margin) { m_controlMargin = margin; } + int GetControlMargin() const { return m_controlMargin; } + + // returns true if we have wxBK_TOP or wxBK_BOTTOM style + bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); } + + // set/get option to shrink to fit current page + void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; } + bool GetFitToCurrentPage() const { return m_fitToCurrentPage; } + + // returns the sizer containing the control, if any + wxSizer* GetControlSizer() const { return m_controlSizer; } + + // operations + // ---------- + + // remove one page from the control and delete it + virtual bool DeletePage(size_t n); + + // remove one page from the notebook, without deleting it + virtual bool RemovePage(size_t n) + { + DoInvalidateBestSize(); + return DoRemovePage(n) != NULL; + } + + // remove all pages and delete them + virtual bool DeleteAllPages() + { + DoInvalidateBestSize(); + WX_CLEAR_ARRAY(m_pages); + return true; + } + + // adds a new page to the control + virtual bool AddPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = -1) + { + DoInvalidateBestSize(); + return InsertPage(GetPageCount(), page, text, bSelect, imageId); + } + + // the same as AddPage(), but adds the page at the specified position + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = -1) = 0; + + // set the currently selected page, return the index of the previously + // selected one (or -1 on error) + // + // NB: this function will generate PAGE_CHANGING/ED events + virtual int SetSelection(size_t n) = 0; + + // acts as SetSelection but does not generate events + virtual int ChangeSelection(size_t n) = 0; + + + // cycle thru the pages + void AdvanceSelection(bool forward = true) + { + int nPage = GetNextPage(forward); + if ( nPage != -1 ) + { + // cast is safe because of the check above + SetSelection((size_t)nPage); + } + } + + // hit test: returns which page is hit and, optionally, where (icon, label) + virtual int HitTest(const wxPoint& WXUNUSED(pt), + long * WXUNUSED(flags) = NULL) const + { + return wxNOT_FOUND; + } + + + // we do have multiple pages + virtual bool HasMultiplePages() const { return true; } + + +protected: + // flags for DoSetSelection() + enum + { + SetSelection_SendEvent = 1 + }; + + // set the selection to the given page, sending the events (which can + // possibly prevent the page change from taking place) if SendEvent flag is + // included + virtual int DoSetSelection(size_t nPage, int flags = 0); + + // if the derived class uses DoSetSelection() for implementing + // [Set|Change]Selection, it must override UpdateSelectedPage(), + // CreatePageChangingEvent() and MakeChangedEvent(), but as it might not + // use it, these functions are not pure virtual + + // called to notify the control about a new current page + virtual void UpdateSelectedPage(size_t WXUNUSED(newsel)) + { wxFAIL_MSG(wxT("Override this function!")); } + + // create a new "page changing" event + virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const + { wxFAIL_MSG(wxT("Override this function!")); return NULL; } + + // modify the event created by CreatePageChangingEvent() to "page changed" + // event, usually by just calling SetEventType() on it + virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event)) + { wxFAIL_MSG(wxT("Override this function!")); } + + + // Should we accept NULL page pointers in Add/InsertPage()? + // + // Default is no but derived classes may override it if they can treat NULL + // pages in some sensible way (e.g. wxTreebook overrides this to allow + // having nodes without any associated page) + virtual bool AllowNullPage() const { return false; } + + // remove the page and return a pointer to it + virtual wxWindow *DoRemovePage(size_t page) = 0; + + // our best size is the size which fits all our pages + virtual wxSize DoGetBestSize() const; + + // helper: get the next page wrapping if we reached the end + int GetNextPage(bool forward) const; + + // Lay out controls + void DoSize(); + + // This method also invalidates the size of the controller and should be + // called instead of just InvalidateBestSize() whenever pages are added or + // removed as this also affects the controller + void DoInvalidateBestSize(); + +#if wxUSE_HELP + // Show the help for the corresponding page + void OnHelp(wxHelpEvent& event); +#endif // wxUSE_HELP + + + // the array of all pages of this control + wxArrayPages m_pages; + + // the associated image list or NULL + wxImageList *m_imageList; + + // true if we must delete m_imageList + bool m_ownsImageList; + + // get the page area + wxRect GetPageRect() const; + + // event handlers + virtual wxSize GetControllerSize() const; + void OnSize(wxSizeEvent& event); + + // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook) + wxControl *m_bookctrl; + + // Whether to shrink to fit current page + bool m_fitToCurrentPage; + + // the sizer containing the choice control + wxSizer *m_controlSizer; + + // the margin around the choice control + int m_controlMargin; + +private: + + // common part of all ctors + void Init(); + + // internal border + unsigned int m_internalBorder; + + DECLARE_ABSTRACT_CLASS(wxBookCtrlBase) + DECLARE_NO_COPY_CLASS(wxBookCtrlBase) + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// wxBookCtrlBaseEvent: page changing events generated by derived classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent +{ +public: + wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + int nSel = -1, int nOldSel = -1) + : wxNotifyEvent(commandType, winid) + { + m_nSel = nSel; + m_nOldSel = nOldSel; + } + + wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event) + : wxNotifyEvent(event) + { + m_nSel = event.m_nSel; + m_nOldSel = event.m_nOldSel; + } + + // accessors + // the currently selected page (-1 if none) + int GetSelection() const { return m_nSel; } + void SetSelection(int nSel) { m_nSel = nSel; } + // the page that was selected before the change (-1 if none) + int GetOldSelection() const { return m_nOldSel; } + void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } + +private: + int m_nSel, // currently selected page + m_nOldSel; // previously selected page +}; + +// make a default book control for given platform +#if wxUSE_NOTEBOOK + // dedicated to majority of desktops + #include "wx/notebook.h" + #define wxBookCtrl wxNotebook + #define wxBookCtrlEvent wxNotebookEvent + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING + #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn) + #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn) + #define wxBookctrlEventHandler(func) wxNotebookEventHandler(func) +#else + // dedicated to Smartphones + #include "wx/choicebk.h" + #define wxBookCtrl wxChoicebook + #define wxBookCtrlEvent wxChoicebookEvent + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING + #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) + #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) + #define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func) +#endif + +#if WXWIN_COMPATIBILITY_2_6 + #define wxBC_TOP wxBK_TOP + #define wxBC_BOTTOM wxBK_BOTTOM + #define wxBC_LEFT wxBK_LEFT + #define wxBC_RIGHT wxBK_RIGHT + #define wxBC_DEFAULT wxBK_DEFAULT +#endif + +#endif // wxUSE_BOOKCTRL + +#endif // _WX_BOOKCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/brush.h b/Externals/wxWidgets/include/wx/brush.h index cf963ab2df..cbf7287282 100644 --- a/Externals/wxWidgets/include/wx/brush.h +++ b/Externals/wxWidgets/include/wx/brush.h @@ -1,54 +1,54 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/brush.h -// Purpose: Includes platform-specific wxBrush file -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: brush.h 40865 2006-08-27 09:42:42Z VS $ -// Copyright: Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BRUSH_H_BASE_ -#define _WX_BRUSH_H_BASE_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/gdiobj.h" - -// wxBrushBase -class WXDLLEXPORT wxBrushBase: public wxGDIObject -{ -public: - virtual ~wxBrushBase() { } - - virtual int GetStyle() const = 0; - - virtual bool IsHatch() const - { return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); } -}; - -#if defined(__WXPALMOS__) - #include "wx/palmos/brush.h" -#elif defined(__WXMSW__) - #include "wx/msw/brush.h" -#elif defined(__WXMOTIF__) || defined(__WXX11__) - #include "wx/x11/brush.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/brush.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/brush.h" -#elif defined(__WXMGL__) - #include "wx/mgl/brush.h" -#elif defined(__WXDFB__) - #include "wx/dfb/brush.h" -#elif defined(__WXMAC__) - #include "wx/mac/brush.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/brush.h" -#elif defined(__WXPM__) - #include "wx/os2/brush.h" -#endif - -#endif - // _WX_BRUSH_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/brush.h +// Purpose: Includes platform-specific wxBrush file +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: brush.h 40865 2006-08-27 09:42:42Z VS $ +// Copyright: Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_BASE_ +#define _WX_BRUSH_H_BASE_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdiobj.h" + +// wxBrushBase +class WXDLLEXPORT wxBrushBase: public wxGDIObject +{ +public: + virtual ~wxBrushBase() { } + + virtual int GetStyle() const = 0; + + virtual bool IsHatch() const + { return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); } +}; + +#if defined(__WXPALMOS__) + #include "wx/palmos/brush.h" +#elif defined(__WXMSW__) + #include "wx/msw/brush.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) + #include "wx/x11/brush.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/brush.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/brush.h" +#elif defined(__WXMGL__) + #include "wx/mgl/brush.h" +#elif defined(__WXDFB__) + #include "wx/dfb/brush.h" +#elif defined(__WXMAC__) + #include "wx/mac/brush.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/brush.h" +#elif defined(__WXPM__) + #include "wx/os2/brush.h" +#endif + +#endif + // _WX_BRUSH_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/buffer.h b/Externals/wxWidgets/include/wx/buffer.h index cd78fc6394..605f4f19c5 100644 --- a/Externals/wxWidgets/include/wx/buffer.h +++ b/Externals/wxWidgets/include/wx/buffer.h @@ -1,314 +1,314 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/buffer.h -// Purpose: auto buffer classes: buffers which automatically free memory -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.04.99 -// RCS-ID: $Id: buffer.h 45761 2007-05-02 17:09:30Z VS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUFFER_H -#define _WX_BUFFER_H - -#include "wx/wxchar.h" - -#include // malloc() and free() - -// ---------------------------------------------------------------------------- -// Special classes for (wide) character strings: they use malloc/free instead -// of new/delete -// ---------------------------------------------------------------------------- - -#define DEFINE_BUFFER(classname, chartype, strdupfunc) \ -class WXDLLIMPEXP_BASE classname \ -{ \ -public: \ - classname(const chartype *str = NULL) \ - : m_str(str ? strdupfunc(str) : NULL) \ - { \ - } \ - \ - classname(size_t len) \ - : m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \ - { \ - m_str[len] = (chartype)0; \ - } \ - \ - /* no need to check for NULL, free() does it */ \ - ~classname() { free(m_str); } \ - \ - /* \ - WARNING: \ - \ - the copy ctor and assignment operators change the passed in object \ - even although it is declared as "const", so: \ - \ - a) it shouldn't be really const \ - b) you shouldn't use it afterwards (or know that it was reset) \ - \ - This is very ugly but is unfortunately needed to make the normal use\ - of classname buffer objects possible and is very similar to what \ - std::auto_ptr<> does (as if it were an excuse...) \ - */ \ - \ - /* \ - because of the remark above, release() is declared const even if it \ - isn't really const \ - */ \ - chartype *release() const \ - { \ - chartype *p = m_str; \ - ((classname *)this)->m_str = NULL; \ - return p; \ - } \ - \ - void reset() \ - { \ - free(m_str); \ - m_str = NULL; \ - } \ - \ - classname(const classname& src) \ - : m_str(src.release()) \ - { \ - } \ - \ - classname& operator=(const chartype *str) \ - { \ - free(m_str); \ - m_str = str ? strdupfunc(str) : NULL; \ - return *this; \ - } \ - \ - classname& operator=(const classname& src) \ - { \ - free(m_str); \ - m_str = src.release(); \ - \ - return *this; \ - } \ - \ - bool extend(size_t len) \ - { \ - chartype * \ - str = (chartype *)realloc(m_str, (len + 1)*sizeof(chartype)); \ - if ( !str ) \ - return false; \ - \ - m_str = str; \ - \ - return true; \ - } \ - \ - chartype *data() { return m_str; } \ - const chartype *data() const { return m_str; } \ - operator const chartype *() const { return m_str; } \ - chartype operator[](size_t n) const { return m_str[n]; } \ - \ -private: \ - chartype *m_str; \ -} - -#if wxABI_VERSION >= 20804 -// needed for wxString::char_str() and wchar_str() -#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \ -class WXDLLIMPEXP_BASE classname : public baseclass \ -{ \ -public: \ - classname(const baseclass& src) : baseclass(src) {} \ - classname(const chartype *str = NULL) : baseclass(str) {} \ - \ - operator chartype*() { return this->data(); } \ -} -#endif // wxABI_VERSION >= 20804 - -DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA); -#if wxABI_VERSION >= 20804 -DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char); -#endif - -#if wxUSE_WCHAR_T - -DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW); -#if wxABI_VERSION >= 20804 -DEFINE_WRITABLE_BUFFER(wxWritableWCharBuffer, wxWCharBuffer, wchar_t); -#endif - -#endif // wxUSE_WCHAR_T - -#undef DEFINE_BUFFER -#undef DEFINE_WRITABLE_BUFFER - -#if wxUSE_UNICODE - typedef wxWCharBuffer wxWxCharBuffer; - - #define wxMB2WXbuf wxWCharBuffer - #define wxWX2MBbuf wxCharBuffer - #define wxWC2WXbuf wxChar* - #define wxWX2WCbuf wxChar* -#else // ANSI - typedef wxCharBuffer wxWxCharBuffer; - - #define wxMB2WXbuf wxChar* - #define wxWX2MBbuf wxChar* - #define wxWC2WXbuf wxCharBuffer - #define wxWX2WCbuf wxWCharBuffer -#endif // Unicode/ANSI - -// ---------------------------------------------------------------------------- -// A class for holding growable data buffers (not necessarily strings) -// ---------------------------------------------------------------------------- - -// This class manages the actual data buffer pointer and is ref-counted. -class wxMemoryBufferData -{ -public: - // the initial size and also the size added by ResizeIfNeeded() - enum { DefBufSize = 1024 }; - - friend class wxMemoryBuffer; - - // everyting is private as it can only be used by wxMemoryBuffer -private: - wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize) - : m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0) - { - } - ~wxMemoryBufferData() { free(m_data); } - - - void ResizeIfNeeded(size_t newSize) - { - if (newSize > m_size) - { - void *dataOld = m_data; - m_data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); - if ( !m_data ) - { - free(dataOld); - } - - m_size = newSize + wxMemoryBufferData::DefBufSize; - } - } - - void IncRef() { m_ref += 1; } - void DecRef() - { - m_ref -= 1; - if (m_ref == 0) // are there no more references? - delete this; - } - - - // the buffer containing the data - void *m_data; - - // the size of the buffer - size_t m_size; - - // the amount of data currently in the buffer - size_t m_len; - - // the reference count - size_t m_ref; - - DECLARE_NO_COPY_CLASS(wxMemoryBufferData) -}; - - -class wxMemoryBuffer -{ -public: - // ctor and dtor - wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize) - { - m_bufdata = new wxMemoryBufferData(size); - m_bufdata->IncRef(); - } - - ~wxMemoryBuffer() { m_bufdata->DecRef(); } - - - // copy and assignment - wxMemoryBuffer(const wxMemoryBuffer& src) - : m_bufdata(src.m_bufdata) - { - m_bufdata->IncRef(); - } - - wxMemoryBuffer& operator=(const wxMemoryBuffer& src) - { - m_bufdata->DecRef(); - m_bufdata = src.m_bufdata; - m_bufdata->IncRef(); - return *this; - } - - - // Accessors - void *GetData() const { return m_bufdata->m_data; } - size_t GetBufSize() const { return m_bufdata->m_size; } - size_t GetDataLen() const { return m_bufdata->m_len; } - - void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); } - void SetDataLen(size_t len) - { - wxASSERT(len <= m_bufdata->m_size); - m_bufdata->m_len = len; - } - - // Ensure the buffer is big enough and return a pointer to it - void *GetWriteBuf(size_t sizeNeeded) - { - m_bufdata->ResizeIfNeeded(sizeNeeded); - return m_bufdata->m_data; - } - - // Update the length after the write - void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); } - - // Like the above, but appends to the buffer - void *GetAppendBuf(size_t sizeNeeded) - { - m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded); - return (char*)m_bufdata->m_data + m_bufdata->m_len; - } - - // Update the length after the append - void UngetAppendBuf(size_t sizeUsed) - { - SetDataLen(m_bufdata->m_len + sizeUsed); - } - - // Other ways to append to the buffer - void AppendByte(char data) - { - wxCHECK_RET( m_bufdata->m_data, _T("invalid wxMemoryBuffer") ); - - m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1); - *(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data; - m_bufdata->m_len += 1; - } - - void AppendData(const void *data, size_t len) - { - memcpy(GetAppendBuf(len), data, len); - UngetAppendBuf(len); - } - - operator const char *() const { return (const char*)GetData(); } - -private: - wxMemoryBufferData* m_bufdata; -}; - -// ---------------------------------------------------------------------------- -// template class for any kind of data -// ---------------------------------------------------------------------------- - -// TODO - -#endif // _WX_BUFFER_H +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/buffer.h +// Purpose: auto buffer classes: buffers which automatically free memory +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.04.99 +// RCS-ID: $Id: buffer.h 45761 2007-05-02 17:09:30Z VS $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUFFER_H +#define _WX_BUFFER_H + +#include "wx/wxchar.h" + +#include // malloc() and free() + +// ---------------------------------------------------------------------------- +// Special classes for (wide) character strings: they use malloc/free instead +// of new/delete +// ---------------------------------------------------------------------------- + +#define DEFINE_BUFFER(classname, chartype, strdupfunc) \ +class WXDLLIMPEXP_BASE classname \ +{ \ +public: \ + classname(const chartype *str = NULL) \ + : m_str(str ? strdupfunc(str) : NULL) \ + { \ + } \ + \ + classname(size_t len) \ + : m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \ + { \ + m_str[len] = (chartype)0; \ + } \ + \ + /* no need to check for NULL, free() does it */ \ + ~classname() { free(m_str); } \ + \ + /* \ + WARNING: \ + \ + the copy ctor and assignment operators change the passed in object \ + even although it is declared as "const", so: \ + \ + a) it shouldn't be really const \ + b) you shouldn't use it afterwards (or know that it was reset) \ + \ + This is very ugly but is unfortunately needed to make the normal use\ + of classname buffer objects possible and is very similar to what \ + std::auto_ptr<> does (as if it were an excuse...) \ + */ \ + \ + /* \ + because of the remark above, release() is declared const even if it \ + isn't really const \ + */ \ + chartype *release() const \ + { \ + chartype *p = m_str; \ + ((classname *)this)->m_str = NULL; \ + return p; \ + } \ + \ + void reset() \ + { \ + free(m_str); \ + m_str = NULL; \ + } \ + \ + classname(const classname& src) \ + : m_str(src.release()) \ + { \ + } \ + \ + classname& operator=(const chartype *str) \ + { \ + free(m_str); \ + m_str = str ? strdupfunc(str) : NULL; \ + return *this; \ + } \ + \ + classname& operator=(const classname& src) \ + { \ + free(m_str); \ + m_str = src.release(); \ + \ + return *this; \ + } \ + \ + bool extend(size_t len) \ + { \ + chartype * \ + str = (chartype *)realloc(m_str, (len + 1)*sizeof(chartype)); \ + if ( !str ) \ + return false; \ + \ + m_str = str; \ + \ + return true; \ + } \ + \ + chartype *data() { return m_str; } \ + const chartype *data() const { return m_str; } \ + operator const chartype *() const { return m_str; } \ + chartype operator[](size_t n) const { return m_str[n]; } \ + \ +private: \ + chartype *m_str; \ +} + +#if wxABI_VERSION >= 20804 +// needed for wxString::char_str() and wchar_str() +#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \ +class WXDLLIMPEXP_BASE classname : public baseclass \ +{ \ +public: \ + classname(const baseclass& src) : baseclass(src) {} \ + classname(const chartype *str = NULL) : baseclass(str) {} \ + \ + operator chartype*() { return this->data(); } \ +} +#endif // wxABI_VERSION >= 20804 + +DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA); +#if wxABI_VERSION >= 20804 +DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char); +#endif + +#if wxUSE_WCHAR_T + +DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW); +#if wxABI_VERSION >= 20804 +DEFINE_WRITABLE_BUFFER(wxWritableWCharBuffer, wxWCharBuffer, wchar_t); +#endif + +#endif // wxUSE_WCHAR_T + +#undef DEFINE_BUFFER +#undef DEFINE_WRITABLE_BUFFER + +#if wxUSE_UNICODE + typedef wxWCharBuffer wxWxCharBuffer; + + #define wxMB2WXbuf wxWCharBuffer + #define wxWX2MBbuf wxCharBuffer + #define wxWC2WXbuf wxChar* + #define wxWX2WCbuf wxChar* +#else // ANSI + typedef wxCharBuffer wxWxCharBuffer; + + #define wxMB2WXbuf wxChar* + #define wxWX2MBbuf wxChar* + #define wxWC2WXbuf wxCharBuffer + #define wxWX2WCbuf wxWCharBuffer +#endif // Unicode/ANSI + +// ---------------------------------------------------------------------------- +// A class for holding growable data buffers (not necessarily strings) +// ---------------------------------------------------------------------------- + +// This class manages the actual data buffer pointer and is ref-counted. +class wxMemoryBufferData +{ +public: + // the initial size and also the size added by ResizeIfNeeded() + enum { DefBufSize = 1024 }; + + friend class wxMemoryBuffer; + + // everyting is private as it can only be used by wxMemoryBuffer +private: + wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize) + : m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0) + { + } + ~wxMemoryBufferData() { free(m_data); } + + + void ResizeIfNeeded(size_t newSize) + { + if (newSize > m_size) + { + void *dataOld = m_data; + m_data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); + if ( !m_data ) + { + free(dataOld); + } + + m_size = newSize + wxMemoryBufferData::DefBufSize; + } + } + + void IncRef() { m_ref += 1; } + void DecRef() + { + m_ref -= 1; + if (m_ref == 0) // are there no more references? + delete this; + } + + + // the buffer containing the data + void *m_data; + + // the size of the buffer + size_t m_size; + + // the amount of data currently in the buffer + size_t m_len; + + // the reference count + size_t m_ref; + + DECLARE_NO_COPY_CLASS(wxMemoryBufferData) +}; + + +class wxMemoryBuffer +{ +public: + // ctor and dtor + wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize) + { + m_bufdata = new wxMemoryBufferData(size); + m_bufdata->IncRef(); + } + + ~wxMemoryBuffer() { m_bufdata->DecRef(); } + + + // copy and assignment + wxMemoryBuffer(const wxMemoryBuffer& src) + : m_bufdata(src.m_bufdata) + { + m_bufdata->IncRef(); + } + + wxMemoryBuffer& operator=(const wxMemoryBuffer& src) + { + m_bufdata->DecRef(); + m_bufdata = src.m_bufdata; + m_bufdata->IncRef(); + return *this; + } + + + // Accessors + void *GetData() const { return m_bufdata->m_data; } + size_t GetBufSize() const { return m_bufdata->m_size; } + size_t GetDataLen() const { return m_bufdata->m_len; } + + void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); } + void SetDataLen(size_t len) + { + wxASSERT(len <= m_bufdata->m_size); + m_bufdata->m_len = len; + } + + // Ensure the buffer is big enough and return a pointer to it + void *GetWriteBuf(size_t sizeNeeded) + { + m_bufdata->ResizeIfNeeded(sizeNeeded); + return m_bufdata->m_data; + } + + // Update the length after the write + void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); } + + // Like the above, but appends to the buffer + void *GetAppendBuf(size_t sizeNeeded) + { + m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded); + return (char*)m_bufdata->m_data + m_bufdata->m_len; + } + + // Update the length after the append + void UngetAppendBuf(size_t sizeUsed) + { + SetDataLen(m_bufdata->m_len + sizeUsed); + } + + // Other ways to append to the buffer + void AppendByte(char data) + { + wxCHECK_RET( m_bufdata->m_data, _T("invalid wxMemoryBuffer") ); + + m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1); + *(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data; + m_bufdata->m_len += 1; + } + + void AppendData(const void *data, size_t len) + { + memcpy(GetAppendBuf(len), data, len); + UngetAppendBuf(len); + } + + operator const char *() const { return (const char*)GetData(); } + +private: + wxMemoryBufferData* m_bufdata; +}; + +// ---------------------------------------------------------------------------- +// template class for any kind of data +// ---------------------------------------------------------------------------- + +// TODO + +#endif // _WX_BUFFER_H diff --git a/Externals/wxWidgets/include/wx/build.h b/Externals/wxWidgets/include/wx/build.h index f6f5b0e225..989d5e611a 100644 --- a/Externals/wxWidgets/include/wx/build.h +++ b/Externals/wxWidgets/include/wx/build.h @@ -1,149 +1,149 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/build.h -// Purpose: Runtime build options checking -// Author: Vadim Zeitlin, Vaclav Slavik -// Modified by: -// Created: 07.05.02 -// RCS-ID: $Id: build.h 35858 2005-10-09 15:48:42Z MBN $ -// Copyright: (c) 2002 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUILD_H_ -#define _WX_BUILD_H_ - -#include "wx/version.h" - -// NB: This file contains macros for checking binary compatibility of libraries -// in multilib buildm, plugins and user components. -// The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should -// uniquely identify binary compatible builds: i.e. if two builds of the -// library are binary compatible, their signature string should be the -// same; if two builds are binary incompatible, their signatures should -// be different. -// -// Therefore, wxUSE_XXX flags that affect binary compatibility (vtables, -// function signatures) should be accounted for here. So should compilers -// and compiler versions (but note that binary compatible compiler versions -// such as gcc-2.95.2 and gcc-2.95.3 should have same signature!). - -// ---------------------------------------------------------------------------- -// WX_BUILD_OPTIONS_SIGNATURE -// ---------------------------------------------------------------------------- - -#define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x) -#define __WX_BO_STRINGIZE0(x) #x - -#if (wxMINOR_VERSION % 2) == 0 - #define __WX_BO_VERSION(x,y,z) \ - __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) -#else - #define __WX_BO_VERSION(x,y,z) \ - __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) -#endif - -#ifdef __WXDEBUG__ - #define __WX_BO_DEBUG "debug" -#else - #define __WX_BO_DEBUG "no debug" -#endif - -#if wxUSE_UNICODE - #define __WX_BO_UNICODE "Unicode" -#else - #define __WX_BO_UNICODE "ANSI" -#endif - -// GCC and Intel C++ share same C++ ABI (and possibly others in the future), -// check if compiler versions are compatible: -#if defined(__GXX_ABI_VERSION) - #define __WX_BO_COMPILER \ - ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) -#elif defined(__INTEL_COMPILER) - #define __WX_BO_COMPILER ",Intel C++" -#elif defined(__GNUG__) - #define __WX_BO_COMPILER ",GCC " \ - __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) -#elif defined(__VISUALC__) - #define __WX_BO_COMPILER ",Visual C++" -#elif defined(__BORLANDC__) - #define __WX_BO_COMPILER ",Borland C++" -#elif defined(__DIGITALMARS__) - #define __WX_BO_COMPILER ",DigitalMars" -#elif defined(__WATCOMC__) - #define __WX_BO_COMPILER ",Watcom C++" -#else - #define __WX_BO_COMPILER -#endif - -// WXWIN_COMPATIBILITY macros affect presence of virtual functions -#if WXWIN_COMPATIBILITY_2_4 - #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4" -#else - #define __WX_BO_WXWIN_COMPAT_2_4 -#endif -#if WXWIN_COMPATIBILITY_2_6 - #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6" -#else - #define __WX_BO_WXWIN_COMPAT_2_6 -#endif - -// deriving wxWin containers from STL ones changes them completely: -#if wxUSE_STL - #define __WX_BO_STL ",STL containers" -#else - #define __WX_BO_STL ",wx containers" -#endif - -// This macro is passed as argument to wxConsoleApp::CheckBuildOptions() -#define WX_BUILD_OPTIONS_SIGNATURE \ - __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ - " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \ - __WX_BO_COMPILER \ - __WX_BO_STL \ - __WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 \ - ")" - - -// ---------------------------------------------------------------------------- -// WX_CHECK_BUILD_OPTIONS -// ---------------------------------------------------------------------------- - -// Use this macro to check build options. Adding it to a file in DLL will -// ensure that the DLL checks build options in same way IMPLEMENT_APP() does. -#define WX_CHECK_BUILD_OPTIONS(libName) \ - static struct wxBuildOptionsChecker \ - { \ - wxBuildOptionsChecker() \ - { \ - wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ - libName); \ - } \ - } gs_buildOptionsCheck; - - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// wxBuildOptions -// ---------------------------------------------------------------------------- - -// NB: Don't use this class in new code, it relies on the ctor being always -// inlined. WX_BUILD_OPTIONS_SIGNATURE always works. -class wxBuildOptions -{ -public: - // the ctor must be inline to get the compilation settings of the code - // which included this header - wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {} - -private: - const char *m_signature; - - // actually only CheckBuildOptions() should be our friend but well... - friend class wxAppConsole; -}; - -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // _WX_BUILD_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/build.h +// Purpose: Runtime build options checking +// Author: Vadim Zeitlin, Vaclav Slavik +// Modified by: +// Created: 07.05.02 +// RCS-ID: $Id: build.h 35858 2005-10-09 15:48:42Z MBN $ +// Copyright: (c) 2002 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUILD_H_ +#define _WX_BUILD_H_ + +#include "wx/version.h" + +// NB: This file contains macros for checking binary compatibility of libraries +// in multilib buildm, plugins and user components. +// The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should +// uniquely identify binary compatible builds: i.e. if two builds of the +// library are binary compatible, their signature string should be the +// same; if two builds are binary incompatible, their signatures should +// be different. +// +// Therefore, wxUSE_XXX flags that affect binary compatibility (vtables, +// function signatures) should be accounted for here. So should compilers +// and compiler versions (but note that binary compatible compiler versions +// such as gcc-2.95.2 and gcc-2.95.3 should have same signature!). + +// ---------------------------------------------------------------------------- +// WX_BUILD_OPTIONS_SIGNATURE +// ---------------------------------------------------------------------------- + +#define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x) +#define __WX_BO_STRINGIZE0(x) #x + +#if (wxMINOR_VERSION % 2) == 0 + #define __WX_BO_VERSION(x,y,z) \ + __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) +#else + #define __WX_BO_VERSION(x,y,z) \ + __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) +#endif + +#ifdef __WXDEBUG__ + #define __WX_BO_DEBUG "debug" +#else + #define __WX_BO_DEBUG "no debug" +#endif + +#if wxUSE_UNICODE + #define __WX_BO_UNICODE "Unicode" +#else + #define __WX_BO_UNICODE "ANSI" +#endif + +// GCC and Intel C++ share same C++ ABI (and possibly others in the future), +// check if compiler versions are compatible: +#if defined(__GXX_ABI_VERSION) + #define __WX_BO_COMPILER \ + ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) +#elif defined(__INTEL_COMPILER) + #define __WX_BO_COMPILER ",Intel C++" +#elif defined(__GNUG__) + #define __WX_BO_COMPILER ",GCC " \ + __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) +#elif defined(__VISUALC__) + #define __WX_BO_COMPILER ",Visual C++" +#elif defined(__BORLANDC__) + #define __WX_BO_COMPILER ",Borland C++" +#elif defined(__DIGITALMARS__) + #define __WX_BO_COMPILER ",DigitalMars" +#elif defined(__WATCOMC__) + #define __WX_BO_COMPILER ",Watcom C++" +#else + #define __WX_BO_COMPILER +#endif + +// WXWIN_COMPATIBILITY macros affect presence of virtual functions +#if WXWIN_COMPATIBILITY_2_4 + #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4" +#else + #define __WX_BO_WXWIN_COMPAT_2_4 +#endif +#if WXWIN_COMPATIBILITY_2_6 + #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6" +#else + #define __WX_BO_WXWIN_COMPAT_2_6 +#endif + +// deriving wxWin containers from STL ones changes them completely: +#if wxUSE_STL + #define __WX_BO_STL ",STL containers" +#else + #define __WX_BO_STL ",wx containers" +#endif + +// This macro is passed as argument to wxConsoleApp::CheckBuildOptions() +#define WX_BUILD_OPTIONS_SIGNATURE \ + __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ + " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \ + __WX_BO_COMPILER \ + __WX_BO_STL \ + __WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 \ + ")" + + +// ---------------------------------------------------------------------------- +// WX_CHECK_BUILD_OPTIONS +// ---------------------------------------------------------------------------- + +// Use this macro to check build options. Adding it to a file in DLL will +// ensure that the DLL checks build options in same way IMPLEMENT_APP() does. +#define WX_CHECK_BUILD_OPTIONS(libName) \ + static struct wxBuildOptionsChecker \ + { \ + wxBuildOptionsChecker() \ + { \ + wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ + libName); \ + } \ + } gs_buildOptionsCheck; + + +#if WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// wxBuildOptions +// ---------------------------------------------------------------------------- + +// NB: Don't use this class in new code, it relies on the ctor being always +// inlined. WX_BUILD_OPTIONS_SIGNATURE always works. +class wxBuildOptions +{ +public: + // the ctor must be inline to get the compilation settings of the code + // which included this header + wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {} + +private: + const char *m_signature; + + // actually only CheckBuildOptions() should be our friend but well... + friend class wxAppConsole; +}; + +#endif // WXWIN_COMPATIBILITY_2_4 + +#endif // _WX_BUILD_H_ diff --git a/Externals/wxWidgets/include/wx/busyinfo.h b/Externals/wxWidgets/include/wx/busyinfo.h index d13d3b68c1..ae63552870 100644 --- a/Externals/wxWidgets/include/wx/busyinfo.h +++ b/Externals/wxWidgets/include/wx/busyinfo.h @@ -1,21 +1,21 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/busyinfo.h -// Purpose: Information window (when app is busy) -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: busyinfo.h 37158 2006-01-26 15:40:46Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __BUSYINFO_H_BASE__ -#define __BUSYINFO_H_BASE__ - -#include "wx/defs.h" - -#if wxUSE_BUSYINFO - -#include "wx/generic/busyinfo.h" - -#endif // wxUSE_BUSYINFO - -#endif // __BUSYINFO_H_BASE__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/busyinfo.h +// Purpose: Information window (when app is busy) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// RCS-ID: $Id: busyinfo.h 37158 2006-01-26 15:40:46Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __BUSYINFO_H_BASE__ +#define __BUSYINFO_H_BASE__ + +#include "wx/defs.h" + +#if wxUSE_BUSYINFO + +#include "wx/generic/busyinfo.h" + +#endif // wxUSE_BUSYINFO + +#endif // __BUSYINFO_H_BASE__ diff --git a/Externals/wxWidgets/include/wx/button.h b/Externals/wxWidgets/include/wx/button.h index 4ca2305ae0..a4448f81f9 100644 --- a/Externals/wxWidgets/include/wx/button.h +++ b/Externals/wxWidgets/include/wx/button.h @@ -1,106 +1,106 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/button.h -// Purpose: wxButtonBase class -// Author: Vadim Zetlin -// Modified by: -// Created: 15.08.00 -// RCS-ID: $Id: button.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Vadim Zetlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUTTON_H_BASE_ -#define _WX_BUTTON_H_BASE_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxButton flags shared with other classes -// ---------------------------------------------------------------------------- - -#if wxUSE_TOGGLEBTN || wxUSE_BUTTON - -// These flags affect label alignment -#define wxBU_LEFT 0x0040 -#define wxBU_TOP 0x0080 -#define wxBU_RIGHT 0x0100 -#define wxBU_BOTTOM 0x0200 -#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) -#endif - -#if wxUSE_BUTTON - -// ---------------------------------------------------------------------------- -// wxButton specific flags -// ---------------------------------------------------------------------------- - -// These two flags are obsolete -#define wxBU_NOAUTODRAW 0x0000 -#define wxBU_AUTODRAW 0x0004 - -// by default, the buttons will be created with some (system dependent) -// minimal size to make them look nicer, giving this style will make them as -// small as possible -#define wxBU_EXACTFIT 0x0001 - -#include "wx/control.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; - -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; - -// ---------------------------------------------------------------------------- -// wxButton: a push button -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButtonBase : public wxControl -{ -public: - wxButtonBase() { } - - // show the image in the button in addition to the label - virtual void SetImageLabel(const wxBitmap& WXUNUSED(bitmap)) { } - - // set the margins around the image - virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } - - // this wxButton method is called when the button becomes the default one - // on its panel - virtual void SetDefault() { } - - // Buttons on MSW can look bad if they are not native colours, because - // then they become owner-drawn and not theme-drawn. Disable it here - // in wxButtonBase to make it consistent. - virtual bool ShouldInheritColours() const { return false; } - - // returns the default button size for this platform - static wxSize GetDefaultSize(); - -protected: - DECLARE_NO_COPY_CLASS(wxButtonBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/button.h" -#elif defined(__WXMSW__) - #include "wx/msw/button.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/button.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/button.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/button.h" -#elif defined(__WXMAC__) - #include "wx/mac/button.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/button.h" -#elif defined(__WXPM__) - #include "wx/os2/button.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/button.h" -#endif - -#endif // wxUSE_BUTTON - -#endif - // _WX_BUTTON_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/button.h +// Purpose: wxButtonBase class +// Author: Vadim Zetlin +// Modified by: +// Created: 15.08.00 +// RCS-ID: $Id: button.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Vadim Zetlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTON_H_BASE_ +#define _WX_BUTTON_H_BASE_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxButton flags shared with other classes +// ---------------------------------------------------------------------------- + +#if wxUSE_TOGGLEBTN || wxUSE_BUTTON + +// These flags affect label alignment +#define wxBU_LEFT 0x0040 +#define wxBU_TOP 0x0080 +#define wxBU_RIGHT 0x0100 +#define wxBU_BOTTOM 0x0200 +#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM ) +#endif + +#if wxUSE_BUTTON + +// ---------------------------------------------------------------------------- +// wxButton specific flags +// ---------------------------------------------------------------------------- + +// These two flags are obsolete +#define wxBU_NOAUTODRAW 0x0000 +#define wxBU_AUTODRAW 0x0004 + +// by default, the buttons will be created with some (system dependent) +// minimal size to make them look nicer, giving this style will make them as +// small as possible +#define wxBU_EXACTFIT 0x0001 + +#include "wx/control.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; + +// ---------------------------------------------------------------------------- +// wxButton: a push button +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxButtonBase : public wxControl +{ +public: + wxButtonBase() { } + + // show the image in the button in addition to the label + virtual void SetImageLabel(const wxBitmap& WXUNUSED(bitmap)) { } + + // set the margins around the image + virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } + + // this wxButton method is called when the button becomes the default one + // on its panel + virtual void SetDefault() { } + + // Buttons on MSW can look bad if they are not native colours, because + // then they become owner-drawn and not theme-drawn. Disable it here + // in wxButtonBase to make it consistent. + virtual bool ShouldInheritColours() const { return false; } + + // returns the default button size for this platform + static wxSize GetDefaultSize(); + +protected: + DECLARE_NO_COPY_CLASS(wxButtonBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/button.h" +#elif defined(__WXMSW__) + #include "wx/msw/button.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/button.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/button.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/button.h" +#elif defined(__WXMAC__) + #include "wx/mac/button.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/button.h" +#elif defined(__WXPM__) + #include "wx/os2/button.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/button.h" +#endif + +#endif // wxUSE_BUTTON + +#endif + // _WX_BUTTON_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/calctrl.h b/Externals/wxWidgets/include/wx/calctrl.h index fe02daab65..ace3b2262b 100644 --- a/Externals/wxWidgets/include/wx/calctrl.h +++ b/Externals/wxWidgets/include/wx/calctrl.h @@ -1,232 +1,232 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/calctrl.h -// Purpose: date-picker control -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.12.99 -// RCS-ID: $Id: calctrl.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - TODO - - 1. implement multiple selections for date ranges - 2. background bitmap for the calendar? - */ - -#ifndef _WX_CALCTRL_H_ -#define _WX_CALCTRL_H_ - -#include "wx/defs.h" - -#if wxUSE_CALENDARCTRL - -#include "wx/dateevt.h" -#include "wx/colour.h" -#include "wx/font.h" - -// ---------------------------------------------------------------------------- -// wxCalendarCtrl flags -// ---------------------------------------------------------------------------- - -enum -{ - // show Sunday as the first day of the week (default) - wxCAL_SUNDAY_FIRST = 0x0000, - - // show Monder as the first day of the week - wxCAL_MONDAY_FIRST = 0x0001, - - // highlight holidays - wxCAL_SHOW_HOLIDAYS = 0x0002, - - // disable the year change control, show only the month change one - wxCAL_NO_YEAR_CHANGE = 0x0004, - - // don't allow changing neither month nor year (implies - // wxCAL_NO_YEAR_CHANGE) - wxCAL_NO_MONTH_CHANGE = 0x000c, - - // use MS-style month-selection instead of combo-spin combination - wxCAL_SEQUENTIAL_MONTH_SELECTION = 0x0010, - - // show the neighbouring weeks in the previous and next month - wxCAL_SHOW_SURROUNDING_WEEKS = 0x0020 -}; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// return values for the HitTest() method -enum wxCalendarHitTestResult -{ - wxCAL_HITTEST_NOWHERE, // outside of anything - wxCAL_HITTEST_HEADER, // on the header (weekdays) - wxCAL_HITTEST_DAY, // on a day in the calendar - wxCAL_HITTEST_INCMONTH, - wxCAL_HITTEST_DECMONTH, - wxCAL_HITTEST_SURROUNDING_WEEK -}; - -// border types for a date -enum wxCalendarDateBorder -{ - wxCAL_BORDER_NONE, // no border (default) - wxCAL_BORDER_SQUARE, // a rectangular border - wxCAL_BORDER_ROUND // a round border -}; - -// ---------------------------------------------------------------------------- -// wxCalendarDateAttr: custom attributes for a calendar date -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxCalendarDateAttr -{ -#if !defined(__VISAGECPP__) -protected: - // This has to be before the use of Init(), for MSVC++ 1.5 - // But dorks up Visualage! - void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE) - { - m_border = border; - m_holiday = false; - } -#endif -public: - // ctors - wxCalendarDateAttr() { Init(); } - wxCalendarDateAttr(const wxColour& colText, - const wxColour& colBack = wxNullColour, - const wxColour& colBorder = wxNullColour, - const wxFont& font = wxNullFont, - wxCalendarDateBorder border = wxCAL_BORDER_NONE) - : m_colText(colText), m_colBack(colBack), - m_colBorder(colBorder), m_font(font) - { - Init(border); - } - wxCalendarDateAttr(wxCalendarDateBorder border, - const wxColour& colBorder = wxNullColour) - : m_colBorder(colBorder) - { - Init(border); - } - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } - void SetBorderColour(const wxColour& col) { m_colBorder = col; } - void SetFont(const wxFont& font) { m_font = font; } - void SetBorder(wxCalendarDateBorder border) { m_border = border; } - void SetHoliday(bool holiday) { m_holiday = holiday; } - - // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasBorderColour() const { return m_colBorder.Ok(); } - bool HasFont() const { return m_font.Ok(); } - bool HasBorder() const { return m_border != wxCAL_BORDER_NONE; } - - bool IsHoliday() const { return m_holiday; } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxColour& GetBorderColour() const { return m_colBorder; } - const wxFont& GetFont() const { return m_font; } - wxCalendarDateBorder GetBorder() const { return m_border; } -#if defined(__VISAGECPP__) -protected: - // This has to be here for VisualAge - void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE) - { - m_border = border; - m_holiday = false; - } -#endif -private: - wxColour m_colText, - m_colBack, - m_colBorder; - wxFont m_font; - wxCalendarDateBorder m_border; - bool m_holiday; -}; - -// ---------------------------------------------------------------------------- -// wxCalendarCtrl events -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; - -class WXDLLIMPEXP_ADV wxCalendarEvent : public wxDateEvent -{ -friend class wxCalendarCtrl; -public: - wxCalendarEvent() { Init(); } - inline wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type); - - void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; } - wxDateTime::WeekDay GetWeekDay() const { return m_wday; } - -protected: - void Init() - { - m_wday = wxDateTime::Inv_WeekDay; - } - -private: - wxDateTime::WeekDay m_wday; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCalendarEvent) -}; - -// ---------------------------------------------------------------------------- -// wxCalendarCtrl -// ---------------------------------------------------------------------------- - -// so far we only have a generic version, so keep it simple -#include "wx/generic/calctrl.h" - - -// now we can define the inline ctor using wxCalendarCtrl -inline -wxCalendarEvent::wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type) - : wxDateEvent(cal, cal->GetDate(), type) -{ -} - -// ---------------------------------------------------------------------------- -// calendar event types and macros for handling them -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_SEL_CHANGED, 950) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DAY_CHANGED, 951) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_MONTH_CHANGED, 952) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_YEAR_CHANGED, 953) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DOUBLECLICKED, 954) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_WEEKDAY_CLICKED, 955) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxCalendarEventFunction)(wxCalendarEvent&); - -#define wxCalendarEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCalendarEventFunction, &func) - -#define wx__DECLARE_CALEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_CALENDAR_ ## evt, id, wxCalendarEventHandler(fn)) - -#define EVT_CALENDAR(id, fn) wx__DECLARE_CALEVT(DOUBLECLICKED, id, fn) -#define EVT_CALENDAR_SEL_CHANGED(id, fn) wx__DECLARE_CALEVT(SEL_CHANGED, id, fn) -#define EVT_CALENDAR_DAY(id, fn) wx__DECLARE_CALEVT(DAY_CHANGED, id, fn) -#define EVT_CALENDAR_MONTH(id, fn) wx__DECLARE_CALEVT(MONTH_CHANGED, id, fn) -#define EVT_CALENDAR_YEAR(id, fn) wx__DECLARE_CALEVT(YEAR_CHANGED, id, fn) -#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEKDAY_CLICKED, id, fn) - -#endif // wxUSE_CALENDARCTRL - -#endif // _WX_CALCTRL_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/calctrl.h +// Purpose: date-picker control +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.12.99 +// RCS-ID: $Id: calctrl.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + TODO + + 1. implement multiple selections for date ranges + 2. background bitmap for the calendar? + */ + +#ifndef _WX_CALCTRL_H_ +#define _WX_CALCTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_CALENDARCTRL + +#include "wx/dateevt.h" +#include "wx/colour.h" +#include "wx/font.h" + +// ---------------------------------------------------------------------------- +// wxCalendarCtrl flags +// ---------------------------------------------------------------------------- + +enum +{ + // show Sunday as the first day of the week (default) + wxCAL_SUNDAY_FIRST = 0x0000, + + // show Monder as the first day of the week + wxCAL_MONDAY_FIRST = 0x0001, + + // highlight holidays + wxCAL_SHOW_HOLIDAYS = 0x0002, + + // disable the year change control, show only the month change one + wxCAL_NO_YEAR_CHANGE = 0x0004, + + // don't allow changing neither month nor year (implies + // wxCAL_NO_YEAR_CHANGE) + wxCAL_NO_MONTH_CHANGE = 0x000c, + + // use MS-style month-selection instead of combo-spin combination + wxCAL_SEQUENTIAL_MONTH_SELECTION = 0x0010, + + // show the neighbouring weeks in the previous and next month + wxCAL_SHOW_SURROUNDING_WEEKS = 0x0020 +}; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// return values for the HitTest() method +enum wxCalendarHitTestResult +{ + wxCAL_HITTEST_NOWHERE, // outside of anything + wxCAL_HITTEST_HEADER, // on the header (weekdays) + wxCAL_HITTEST_DAY, // on a day in the calendar + wxCAL_HITTEST_INCMONTH, + wxCAL_HITTEST_DECMONTH, + wxCAL_HITTEST_SURROUNDING_WEEK +}; + +// border types for a date +enum wxCalendarDateBorder +{ + wxCAL_BORDER_NONE, // no border (default) + wxCAL_BORDER_SQUARE, // a rectangular border + wxCAL_BORDER_ROUND // a round border +}; + +// ---------------------------------------------------------------------------- +// wxCalendarDateAttr: custom attributes for a calendar date +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxCalendarDateAttr +{ +#if !defined(__VISAGECPP__) +protected: + // This has to be before the use of Init(), for MSVC++ 1.5 + // But dorks up Visualage! + void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE) + { + m_border = border; + m_holiday = false; + } +#endif +public: + // ctors + wxCalendarDateAttr() { Init(); } + wxCalendarDateAttr(const wxColour& colText, + const wxColour& colBack = wxNullColour, + const wxColour& colBorder = wxNullColour, + const wxFont& font = wxNullFont, + wxCalendarDateBorder border = wxCAL_BORDER_NONE) + : m_colText(colText), m_colBack(colBack), + m_colBorder(colBorder), m_font(font) + { + Init(border); + } + wxCalendarDateAttr(wxCalendarDateBorder border, + const wxColour& colBorder = wxNullColour) + : m_colBorder(colBorder) + { + Init(border); + } + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } + void SetBorderColour(const wxColour& col) { m_colBorder = col; } + void SetFont(const wxFont& font) { m_font = font; } + void SetBorder(wxCalendarDateBorder border) { m_border = border; } + void SetHoliday(bool holiday) { m_holiday = holiday; } + + // accessors + bool HasTextColour() const { return m_colText.Ok(); } + bool HasBackgroundColour() const { return m_colBack.Ok(); } + bool HasBorderColour() const { return m_colBorder.Ok(); } + bool HasFont() const { return m_font.Ok(); } + bool HasBorder() const { return m_border != wxCAL_BORDER_NONE; } + + bool IsHoliday() const { return m_holiday; } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + const wxColour& GetBorderColour() const { return m_colBorder; } + const wxFont& GetFont() const { return m_font; } + wxCalendarDateBorder GetBorder() const { return m_border; } +#if defined(__VISAGECPP__) +protected: + // This has to be here for VisualAge + void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE) + { + m_border = border; + m_holiday = false; + } +#endif +private: + wxColour m_colText, + m_colBack, + m_colBorder; + wxFont m_font; + wxCalendarDateBorder m_border; + bool m_holiday; +}; + +// ---------------------------------------------------------------------------- +// wxCalendarCtrl events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; + +class WXDLLIMPEXP_ADV wxCalendarEvent : public wxDateEvent +{ +friend class wxCalendarCtrl; +public: + wxCalendarEvent() { Init(); } + inline wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type); + + void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; } + wxDateTime::WeekDay GetWeekDay() const { return m_wday; } + +protected: + void Init() + { + m_wday = wxDateTime::Inv_WeekDay; + } + +private: + wxDateTime::WeekDay m_wday; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCalendarEvent) +}; + +// ---------------------------------------------------------------------------- +// wxCalendarCtrl +// ---------------------------------------------------------------------------- + +// so far we only have a generic version, so keep it simple +#include "wx/generic/calctrl.h" + + +// now we can define the inline ctor using wxCalendarCtrl +inline +wxCalendarEvent::wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type) + : wxDateEvent(cal, cal->GetDate(), type) +{ +} + +// ---------------------------------------------------------------------------- +// calendar event types and macros for handling them +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_SEL_CHANGED, 950) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DAY_CHANGED, 951) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_MONTH_CHANGED, 952) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_YEAR_CHANGED, 953) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DOUBLECLICKED, 954) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALENDAR_WEEKDAY_CLICKED, 955) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxCalendarEventFunction)(wxCalendarEvent&); + +#define wxCalendarEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCalendarEventFunction, &func) + +#define wx__DECLARE_CALEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_CALENDAR_ ## evt, id, wxCalendarEventHandler(fn)) + +#define EVT_CALENDAR(id, fn) wx__DECLARE_CALEVT(DOUBLECLICKED, id, fn) +#define EVT_CALENDAR_SEL_CHANGED(id, fn) wx__DECLARE_CALEVT(SEL_CHANGED, id, fn) +#define EVT_CALENDAR_DAY(id, fn) wx__DECLARE_CALEVT(DAY_CHANGED, id, fn) +#define EVT_CALENDAR_MONTH(id, fn) wx__DECLARE_CALEVT(MONTH_CHANGED, id, fn) +#define EVT_CALENDAR_YEAR(id, fn) wx__DECLARE_CALEVT(YEAR_CHANGED, id, fn) +#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEKDAY_CLICKED, id, fn) + +#endif // wxUSE_CALENDARCTRL + +#endif // _WX_CALCTRL_H_ + diff --git a/Externals/wxWidgets/include/wx/caret.h b/Externals/wxWidgets/include/wx/caret.h index 848fdcf73e..25b606699c 100644 --- a/Externals/wxWidgets/include/wx/caret.h +++ b/Externals/wxWidgets/include/wx/caret.h @@ -1,252 +1,252 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/caret.h -// Purpose: wxCaretBase class - the interface of wxCaret -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.05.99 -// RCS-ID: $Id: caret.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CARET_H_BASE_ -#define _WX_CARET_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CARET - -// --------------------------------------------------------------------------- -// forward declarations -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -// ---------------------------------------------------------------------------- -// headers we have to include -// ---------------------------------------------------------------------------- - -#include "wx/gdicmn.h" // for wxPoint, wxSize - -// ---------------------------------------------------------------------------- -// A caret is a blinking cursor showing the position where the typed text will -// appear. It can be either a solid block or a custom bitmap (TODO) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCaretBase -{ -public: - // ctors - // ----- - // default - use Create - wxCaretBase() { Init(); } - // create the caret of given (in pixels) width and height and associate - // with the given window - wxCaretBase(wxWindowBase *window, int width, int height) - { - Init(); - - (void)Create(window, width, height); - } - // same as above - wxCaretBase(wxWindowBase *window, const wxSize& size) - { - Init(); - - (void)Create(window, size); - } - - // a virtual dtor has been provided since this class has virtual members - virtual ~wxCaretBase() { } - - // Create() functions - same as ctor but returns the success code - // -------------------------------------------------------------- - - // same as ctor - bool Create(wxWindowBase *window, int width, int height) - { return DoCreate(window, width, height); } - // same as ctor - bool Create(wxWindowBase *window, const wxSize& size) - { return DoCreate(window, size.x, size.y); } - - // accessors - // --------- - - // is the caret valid? - bool IsOk() const { return m_width != 0 && m_height != 0; } - - // is the caret currently shown? - bool IsVisible() const { return m_countVisible > 0; } - - // get the caret position - void GetPosition(int *x, int *y) const - { - if ( x ) *x = m_x; - if ( y ) *y = m_y; - } - wxPoint GetPosition() const { return wxPoint(m_x, m_y); } - - // get the caret size - void GetSize(int *width, int *height) const - { - if ( width ) *width = m_width; - if ( height ) *height = m_height; - } - wxSize GetSize() const { return wxSize(m_width, m_height); } - - // get the window we're associated with - wxWindow *GetWindow() const { return (wxWindow *)m_window; } - - // change the size of the caret - void SetSize(int width, int height) { - m_width = width; - m_height = height; - DoSize(); - } - void SetSize(const wxSize& size) { SetSize(size.x, size.y); } - - - // operations - // ---------- - - // move the caret to given position (in logical coords) - void Move(int x, int y) { m_x = x; m_y = y; DoMove(); } - void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); } - - // show/hide the caret (should be called by wxWindow when needed): - // Show() must be called as many times as Hide() + 1 to make the caret - // visible - virtual void Show(bool show = true) - { - if ( show ) - { - if ( m_countVisible++ == 0 ) - DoShow(); - } - else - { - if ( --m_countVisible == 0 ) - DoHide(); - } - } - virtual void Hide() { Show(false); } - - // blink time is measured in milliseconds and is the time elapsed - // between 2 inversions of the caret (blink time of the caret is common - // to all carets in the Universe, so these functions are static) - static int GetBlinkTime(); - static void SetBlinkTime(int milliseconds); - - // implementation from now on - // -------------------------- - - // these functions should be called by wxWindow when the window gets/loses - // the focus - we create/show and hide/destroy the caret here - virtual void OnSetFocus() { } - virtual void OnKillFocus() { } - -protected: - // these functions may be overriden in the derived classes, but they - // should call the base class version first - virtual bool DoCreate(wxWindowBase *window, int width, int height) - { - m_window = window; - m_width = width; - m_height = height; - - return true; - } - - // pure virtuals to implement in the derived class - virtual void DoShow() = 0; - virtual void DoHide() = 0; - virtual void DoMove() = 0; - virtual void DoSize() { } - - // the common initialization - void Init() - { - m_window = (wxWindowBase *)NULL; - m_x = m_y = 0; - m_width = m_height = 0; - m_countVisible = 0; - } - - // the size of the caret - int m_width, m_height; - - // the position of the caret - int m_x, m_y; - - // the window we're associated with - wxWindowBase *m_window; - - // visibility count: the caret is visible only if it's positive - int m_countVisible; - -private: - DECLARE_NO_COPY_CLASS(wxCaretBase) -}; - -// --------------------------------------------------------------------------- -// now include the real thing -// --------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/caret.h" -#else - #include "wx/generic/caret.h" -#endif // platform - -// ---------------------------------------------------------------------------- -// wxCaretSuspend: a simple class which hides the caret in its ctor and -// restores it in the dtor, this should be used when drawing on the screen to -// avoid overdrawing the caret -// ---------------------------------------------------------------------------- - -#ifdef wxHAS_CARET_USING_OVERLAYS - -// we don't need to hide the caret if it's rendered using overlays -class WXDLLEXPORT wxCaretSuspend -{ -public: - wxCaretSuspend(wxWindow *WXUNUSED(win)) {} - - DECLARE_NO_COPY_CLASS(wxCaretSuspend) -}; - -#else // !wxHAS_CARET_USING_OVERLAYS - -class WXDLLEXPORT wxCaretSuspend -{ -public: - wxCaretSuspend(wxWindow *win) - { - m_caret = win->GetCaret(); - m_show = false; - if ( m_caret && m_caret->IsVisible() ) - { - m_caret->Hide(); - m_show = true; - } - } - - ~wxCaretSuspend() - { - if ( m_caret && m_show ) - m_caret->Show(); - } - -private: - wxCaret *m_caret; - bool m_show; - - DECLARE_NO_COPY_CLASS(wxCaretSuspend) -}; - -#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS - -#endif // wxUSE_CARET - -#endif // _WX_CARET_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/caret.h +// Purpose: wxCaretBase class - the interface of wxCaret +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.05.99 +// RCS-ID: $Id: caret.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_BASE_ +#define _WX_CARET_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CARET + +// --------------------------------------------------------------------------- +// forward declarations +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +// ---------------------------------------------------------------------------- +// headers we have to include +// ---------------------------------------------------------------------------- + +#include "wx/gdicmn.h" // for wxPoint, wxSize + +// ---------------------------------------------------------------------------- +// A caret is a blinking cursor showing the position where the typed text will +// appear. It can be either a solid block or a custom bitmap (TODO) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCaretBase +{ +public: + // ctors + // ----- + // default - use Create + wxCaretBase() { Init(); } + // create the caret of given (in pixels) width and height and associate + // with the given window + wxCaretBase(wxWindowBase *window, int width, int height) + { + Init(); + + (void)Create(window, width, height); + } + // same as above + wxCaretBase(wxWindowBase *window, const wxSize& size) + { + Init(); + + (void)Create(window, size); + } + + // a virtual dtor has been provided since this class has virtual members + virtual ~wxCaretBase() { } + + // Create() functions - same as ctor but returns the success code + // -------------------------------------------------------------- + + // same as ctor + bool Create(wxWindowBase *window, int width, int height) + { return DoCreate(window, width, height); } + // same as ctor + bool Create(wxWindowBase *window, const wxSize& size) + { return DoCreate(window, size.x, size.y); } + + // accessors + // --------- + + // is the caret valid? + bool IsOk() const { return m_width != 0 && m_height != 0; } + + // is the caret currently shown? + bool IsVisible() const { return m_countVisible > 0; } + + // get the caret position + void GetPosition(int *x, int *y) const + { + if ( x ) *x = m_x; + if ( y ) *y = m_y; + } + wxPoint GetPosition() const { return wxPoint(m_x, m_y); } + + // get the caret size + void GetSize(int *width, int *height) const + { + if ( width ) *width = m_width; + if ( height ) *height = m_height; + } + wxSize GetSize() const { return wxSize(m_width, m_height); } + + // get the window we're associated with + wxWindow *GetWindow() const { return (wxWindow *)m_window; } + + // change the size of the caret + void SetSize(int width, int height) { + m_width = width; + m_height = height; + DoSize(); + } + void SetSize(const wxSize& size) { SetSize(size.x, size.y); } + + + // operations + // ---------- + + // move the caret to given position (in logical coords) + void Move(int x, int y) { m_x = x; m_y = y; DoMove(); } + void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); } + + // show/hide the caret (should be called by wxWindow when needed): + // Show() must be called as many times as Hide() + 1 to make the caret + // visible + virtual void Show(bool show = true) + { + if ( show ) + { + if ( m_countVisible++ == 0 ) + DoShow(); + } + else + { + if ( --m_countVisible == 0 ) + DoHide(); + } + } + virtual void Hide() { Show(false); } + + // blink time is measured in milliseconds and is the time elapsed + // between 2 inversions of the caret (blink time of the caret is common + // to all carets in the Universe, so these functions are static) + static int GetBlinkTime(); + static void SetBlinkTime(int milliseconds); + + // implementation from now on + // -------------------------- + + // these functions should be called by wxWindow when the window gets/loses + // the focus - we create/show and hide/destroy the caret here + virtual void OnSetFocus() { } + virtual void OnKillFocus() { } + +protected: + // these functions may be overriden in the derived classes, but they + // should call the base class version first + virtual bool DoCreate(wxWindowBase *window, int width, int height) + { + m_window = window; + m_width = width; + m_height = height; + + return true; + } + + // pure virtuals to implement in the derived class + virtual void DoShow() = 0; + virtual void DoHide() = 0; + virtual void DoMove() = 0; + virtual void DoSize() { } + + // the common initialization + void Init() + { + m_window = (wxWindowBase *)NULL; + m_x = m_y = 0; + m_width = m_height = 0; + m_countVisible = 0; + } + + // the size of the caret + int m_width, m_height; + + // the position of the caret + int m_x, m_y; + + // the window we're associated with + wxWindowBase *m_window; + + // visibility count: the caret is visible only if it's positive + int m_countVisible; + +private: + DECLARE_NO_COPY_CLASS(wxCaretBase) +}; + +// --------------------------------------------------------------------------- +// now include the real thing +// --------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/caret.h" +#else + #include "wx/generic/caret.h" +#endif // platform + +// ---------------------------------------------------------------------------- +// wxCaretSuspend: a simple class which hides the caret in its ctor and +// restores it in the dtor, this should be used when drawing on the screen to +// avoid overdrawing the caret +// ---------------------------------------------------------------------------- + +#ifdef wxHAS_CARET_USING_OVERLAYS + +// we don't need to hide the caret if it's rendered using overlays +class WXDLLEXPORT wxCaretSuspend +{ +public: + wxCaretSuspend(wxWindow *WXUNUSED(win)) {} + + DECLARE_NO_COPY_CLASS(wxCaretSuspend) +}; + +#else // !wxHAS_CARET_USING_OVERLAYS + +class WXDLLEXPORT wxCaretSuspend +{ +public: + wxCaretSuspend(wxWindow *win) + { + m_caret = win->GetCaret(); + m_show = false; + if ( m_caret && m_caret->IsVisible() ) + { + m_caret->Hide(); + m_show = true; + } + } + + ~wxCaretSuspend() + { + if ( m_caret && m_show ) + m_caret->Show(); + } + +private: + wxCaret *m_caret; + bool m_show; + + DECLARE_NO_COPY_CLASS(wxCaretSuspend) +}; + +#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS + +#endif // wxUSE_CARET + +#endif // _WX_CARET_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/checkbox.h b/Externals/wxWidgets/include/wx/checkbox.h index 4760475ab9..3d76b4a195 100644 --- a/Externals/wxWidgets/include/wx/checkbox.h +++ b/Externals/wxWidgets/include/wx/checkbox.h @@ -1,156 +1,156 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/checkbox.h -// Purpose: wxCheckBox class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.09.00 -// RCS-ID: $Id: checkbox.h 39901 2006-06-30 10:51:44Z VS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKBOX_H_BASE_ -#define _WX_CHECKBOX_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CHECKBOX - -#include "wx/control.h" - - -/* - * wxCheckBox style flags - * (Using wxCHK_* because wxCB_* is used by wxComboBox). - * Determine whether to use a 3-state or 2-state - * checkbox. 3-state enables to differentiate - * between 'unchecked', 'checked' and 'undetermined'. - */ -#define wxCHK_2STATE 0x0000 -#define wxCHK_3STATE 0x1000 - -/* - * If this style is set the user can set the checkbox to the - * undetermined state. If not set the undetermined set can only - * be set programmatically. - * This style can only be used with 3 state checkboxes. - */ -#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000 - -/* - * The possible states of a 3-state checkbox (Compatible - * with the 2-state checkbox). - */ -enum wxCheckBoxState -{ - wxCHK_UNCHECKED, - wxCHK_CHECKED, - wxCHK_UNDETERMINED /* 3-state checkbox only */ -}; - - -extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxCheckBox: a control which shows a label and a box which may be checked -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCheckBoxBase : public wxControl -{ -public: - wxCheckBoxBase() { } - - // set/get the checked status of the listbox - virtual void SetValue(bool value) = 0; - virtual bool GetValue() const = 0; - - bool IsChecked() const - { - wxASSERT_MSG( !Is3State(), wxT("Calling IsChecked() doesn't make sense for") - wxT(" a three state checkbox, Use Get3StateValue() instead") ); - - return GetValue(); - } - - wxCheckBoxState Get3StateValue() const - { - wxCheckBoxState state = DoGet3StateValue(); - - if ( state == wxCHK_UNDETERMINED && !Is3State() ) - { - // Undetermined state with a 2-state checkbox?? - wxFAIL_MSG( wxT("DoGet3StateValue() says the 2-state checkbox is ") - wxT("in an undetermined/third state") ); - - state = wxCHK_UNCHECKED; - } - - return state; - } - - void Set3StateValue(wxCheckBoxState state) - { - if ( state == wxCHK_UNDETERMINED && !Is3State() ) - { - wxFAIL_MSG(wxT("Setting a 2-state checkbox to undetermined state")); - state = wxCHK_UNCHECKED; - } - - DoSet3StateValue(state); - } - - bool Is3State() const { return HasFlag(wxCHK_3STATE); } - - bool Is3rdStateAllowedForUser() const - { - return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); - } - - virtual bool HasTransparentBackground() { return true; } - - // wxCheckBox-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) - { - wxControl::DoUpdateWindowUI(event); - - if ( event.GetSetChecked() ) - SetValue(event.GetChecked()); - } - -protected: - virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } - - virtual wxCheckBoxState DoGet3StateValue() const - { - wxFAIL; - return wxCHK_UNCHECKED; - } - -private: - DECLARE_NO_COPY_CLASS(wxCheckBoxBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/checkbox.h" -#elif defined(__WXMSW__) - #include "wx/msw/checkbox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/checkbox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/checkbox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/checkbox.h" -#elif defined(__WXMAC__) - #include "wx/mac/checkbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/checkbox.h" -#elif defined(__WXPM__) - #include "wx/os2/checkbox.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/checkbox.h" -#endif - -#endif // wxUSE_CHECKBOX - -#endif - // _WX_CHECKBOX_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/checkbox.h +// Purpose: wxCheckBox class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.09.00 +// RCS-ID: $Id: checkbox.h 39901 2006-06-30 10:51:44Z VS $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_BASE_ +#define _WX_CHECKBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CHECKBOX + +#include "wx/control.h" + + +/* + * wxCheckBox style flags + * (Using wxCHK_* because wxCB_* is used by wxComboBox). + * Determine whether to use a 3-state or 2-state + * checkbox. 3-state enables to differentiate + * between 'unchecked', 'checked' and 'undetermined'. + */ +#define wxCHK_2STATE 0x0000 +#define wxCHK_3STATE 0x1000 + +/* + * If this style is set the user can set the checkbox to the + * undetermined state. If not set the undetermined set can only + * be set programmatically. + * This style can only be used with 3 state checkboxes. + */ +#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000 + +/* + * The possible states of a 3-state checkbox (Compatible + * with the 2-state checkbox). + */ +enum wxCheckBoxState +{ + wxCHK_UNCHECKED, + wxCHK_CHECKED, + wxCHK_UNDETERMINED /* 3-state checkbox only */ +}; + + +extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxCheckBox: a control which shows a label and a box which may be checked +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCheckBoxBase : public wxControl +{ +public: + wxCheckBoxBase() { } + + // set/get the checked status of the listbox + virtual void SetValue(bool value) = 0; + virtual bool GetValue() const = 0; + + bool IsChecked() const + { + wxASSERT_MSG( !Is3State(), wxT("Calling IsChecked() doesn't make sense for") + wxT(" a three state checkbox, Use Get3StateValue() instead") ); + + return GetValue(); + } + + wxCheckBoxState Get3StateValue() const + { + wxCheckBoxState state = DoGet3StateValue(); + + if ( state == wxCHK_UNDETERMINED && !Is3State() ) + { + // Undetermined state with a 2-state checkbox?? + wxFAIL_MSG( wxT("DoGet3StateValue() says the 2-state checkbox is ") + wxT("in an undetermined/third state") ); + + state = wxCHK_UNCHECKED; + } + + return state; + } + + void Set3StateValue(wxCheckBoxState state) + { + if ( state == wxCHK_UNDETERMINED && !Is3State() ) + { + wxFAIL_MSG(wxT("Setting a 2-state checkbox to undetermined state")); + state = wxCHK_UNCHECKED; + } + + DoSet3StateValue(state); + } + + bool Is3State() const { return HasFlag(wxCHK_3STATE); } + + bool Is3rdStateAllowedForUser() const + { + return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); + } + + virtual bool HasTransparentBackground() { return true; } + + // wxCheckBox-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) + { + wxControl::DoUpdateWindowUI(event); + + if ( event.GetSetChecked() ) + SetValue(event.GetChecked()); + } + +protected: + virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } + + virtual wxCheckBoxState DoGet3StateValue() const + { + wxFAIL; + return wxCHK_UNCHECKED; + } + +private: + DECLARE_NO_COPY_CLASS(wxCheckBoxBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/checkbox.h" +#elif defined(__WXMSW__) + #include "wx/msw/checkbox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/checkbox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/checkbox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/checkbox.h" +#elif defined(__WXMAC__) + #include "wx/mac/checkbox.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/checkbox.h" +#elif defined(__WXPM__) + #include "wx/os2/checkbox.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/checkbox.h" +#endif + +#endif // wxUSE_CHECKBOX + +#endif + // _WX_CHECKBOX_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/checklst.h b/Externals/wxWidgets/include/wx/checklst.h index c8857fd086..b83c8536f5 100644 --- a/Externals/wxWidgets/include/wx/checklst.h +++ b/Externals/wxWidgets/include/wx/checklst.h @@ -1,64 +1,64 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/checklst.h -// Purpose: wxCheckListBox class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.09.00 -// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKLST_H_BASE_ -#define _WX_CHECKLST_H_BASE_ - -#if wxUSE_CHECKLISTBOX - -#include "wx/listbox.h" - -// ---------------------------------------------------------------------------- -// wxCheckListBox: a listbox whose items may be checked -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCheckListBoxBase : public - #ifdef __WXWINCE__ - // keep virtuals synchronised - wxListBoxBase - #else - wxListBox - #endif -{ -public: - wxCheckListBoxBase() { } - - // check list box specific methods - virtual bool IsChecked(unsigned int item) const = 0; - virtual void Check(unsigned int item, bool check = true) = 0; - - DECLARE_NO_COPY_CLASS(wxCheckListBoxBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/checklst.h" -#elif defined(__WXWINCE__) - #include "wx/msw/wince/checklst.h" -#elif defined(__WXMSW__) - #include "wx/msw/checklst.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/checklst.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/checklst.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/checklst.h" -#elif defined(__WXMAC__) - #include "wx/mac/checklst.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/checklst.h" -#elif defined(__WXPM__) - #include "wx/os2/checklst.h" -#endif - -#endif // wxUSE_CHECKLISTBOX - -#endif - // _WX_CHECKLST_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/checklst.h +// Purpose: wxCheckListBox class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.09.00 +// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKLST_H_BASE_ +#define _WX_CHECKLST_H_BASE_ + +#if wxUSE_CHECKLISTBOX + +#include "wx/listbox.h" + +// ---------------------------------------------------------------------------- +// wxCheckListBox: a listbox whose items may be checked +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCheckListBoxBase : public + #ifdef __WXWINCE__ + // keep virtuals synchronised + wxListBoxBase + #else + wxListBox + #endif +{ +public: + wxCheckListBoxBase() { } + + // check list box specific methods + virtual bool IsChecked(unsigned int item) const = 0; + virtual void Check(unsigned int item, bool check = true) = 0; + + DECLARE_NO_COPY_CLASS(wxCheckListBoxBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/checklst.h" +#elif defined(__WXWINCE__) + #include "wx/msw/wince/checklst.h" +#elif defined(__WXMSW__) + #include "wx/msw/checklst.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/checklst.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/checklst.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/checklst.h" +#elif defined(__WXMAC__) + #include "wx/mac/checklst.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/checklst.h" +#elif defined(__WXPM__) + #include "wx/os2/checklst.h" +#endif + +#endif // wxUSE_CHECKLISTBOX + +#endif + // _WX_CHECKLST_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/chkconf.h b/Externals/wxWidgets/include/wx/chkconf.h index 811e0c3041..e0717b9d58 100644 --- a/Externals/wxWidgets/include/wx/chkconf.h +++ b/Externals/wxWidgets/include/wx/chkconf.h @@ -1,1871 +1,1871 @@ -/* - * Name: wx/chkconf.h - * Purpose: check the config settings for consistency - * Author: Vadim Zeitlin - * Modified by: - * Created: 09.08.00 - * RCS-ID: $Id: chkconf.h 48113 2007-08-15 17:43:50Z DE $ - * Copyright: (c) 2000 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -/* - Platform-specific checking. - */ - -#if defined(__WXPALMOS__) -# include "wx/palmos/chkconf.h" -#elif defined(__WXWINCE__) -# include "wx/msw/wince/chkconf.h" -#elif defined(__WXMSW__) -# include "wx/msw/chkconf.h" -#elif defined(__WXMAC__) -# include "wx/mac/chkconf.h" -#elif defined(__OS2__) -# include "wx/os2/chkconf.h" -#elif defined(__WXMGL__) -# include "wx/mgl/chkconf.h" -#elif defined(__WXDFB__) -# include "wx/dfb/chkconf.h" -#elif defined(__WXMOTIF__) -# include "wx/motif/chkconf.h" -#elif defined(__WXX11__) -# include "wx/x11/chkconf.h" -#endif - -#ifdef __WXUNIVERSAL__ -# include "wx/univ/chkconf.h" -#endif - -/* - this global setting determines what should we do if the setting FOO - requires BAR and BAR is not set: we can either silently unset FOO as well - (do this if you're trying to build the smallest possible library) or give an - error and abort (default as leads to least surprizing behaviour) - */ -#define wxABORT_ON_CONFIG_ERROR - -/* - global features - */ - -/* GUI build by default */ -#if !defined(wxUSE_GUI) -# define wxUSE_GUI 1 -#endif /* !defined(wxUSE_GUI) */ - -/* Turn off wxUSE_ABI_INCOMPATIBLE_FEATURES if not specified. */ -#if !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) -# define wxUSE_ABI_INCOMPATIBLE_FEATURES 0 -#endif /* !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) */ - -/* - If we're compiling without support for threads/exceptions we have to - disable the corresponding features. - */ -#ifdef wxNO_THREADS -# undef wxUSE_THREADS -# define wxUSE_THREADS 0 -#endif /* wxNO_THREADS */ - -#ifdef wxNO_EXCEPTIONS -# undef wxUSE_EXCEPTIONS -# define wxUSE_EXCEPTIONS 0 -#endif /* wxNO_EXCEPTIONS */ - -/* we also must disable exceptions if compiler doesn't support them */ -#if defined(_MSC_VER) && !defined(_CPPUNWIND) -# undef wxUSE_EXCEPTIONS -# define wxUSE_EXCEPTIONS 0 -#endif /* VC++ without exceptions support */ - - -/* - tests for non GUI features - - please keep the options in alphabetical order! - */ - -#ifndef wxUSE_CRASHREPORT - /* this one is special: as currently it is Windows-only, don't force it - to be defined on other platforms */ -# if defined(wxABORT_ON_CONFIG_ERROR) && defined(__WXMSW__) -# error "wxUSE_CRASHREPORT must be defined." -# else -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* !defined(wxUSE_CRASHREPORT) */ - -#ifndef wxUSE_DYNLIB_CLASS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNLIB_CLASS must be defined." -# else -# define wxUSE_DYNLIB_CLASS 0 -# endif -#endif /* !defined(wxUSE_DYNLIB_CLASS) */ - -#ifndef wxUSE_EXCEPTIONS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_EXCEPTIONS must be defined." -# else -# define wxUSE_EXCEPTIONS 0 -# endif -#endif /* !defined(wxUSE_EXCEPTIONS) */ - -#ifndef wxUSE_FILESYSTEM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM must be defined." -# else -# define wxUSE_FILESYSTEM 0 -# endif -#endif /* !defined(wxUSE_FILESYSTEM) */ - -#ifndef wxUSE_FS_ARCHIVE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FS_ARCHIVE must be defined." -# else -# define wxUSE_FS_ARCHIVE 0 -# endif -#endif /* !defined(wxUSE_FS_ARCHIVE) */ - -/* don't give an error about this one yet, it's not fully implemented */ -#ifndef wxUSE_FSVOLUME -# define wxUSE_FSVOLUME 0 -#endif /* !defined(wxUSE_FSVOLUME) */ - -#ifndef wxUSE_DYNAMIC_LOADER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNAMIC_LOADER must be defined." -# else -# define wxUSE_DYNAMIC_LOADER 0 -# endif -#endif /* !defined(wxUSE_DYNAMIC_LOADER) */ - -#ifndef wxUSE_LOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG must be defined." -# else -# define wxUSE_LOG 0 -# endif -#endif /* !defined(wxUSE_LOG) */ - -#ifndef wxUSE_LONGLONG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LONGLONG must be defined." -# else -# define wxUSE_LONGLONG 0 -# endif -#endif /* !defined(wxUSE_LONGLONG) */ - -#ifndef wxUSE_MIMETYPE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MIMETYPE must be defined." -# else -# define wxUSE_MIMETYPE 0 -# endif -#endif /* !defined(wxUSE_MIMETYPE) */ - -#ifndef wxUSE_ON_FATAL_EXCEPTION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ON_FATAL_EXCEPTION must be defined." -# else -# define wxUSE_ON_FATAL_EXCEPTION 0 -# endif -#endif /* !defined(wxUSE_ON_FATAL_EXCEPTION) */ - -#ifndef wxUSE_PRINTF_POS_PARAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PRINTF_POS_PARAMS must be defined." -# else -# define wxUSE_PRINTF_POS_PARAMS 0 -# endif -#endif /* !defined(wxUSE_PRINTF_POS_PARAMS) */ - -#ifndef wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL must be defined." -# else -# define wxUSE_PROTOCOL 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL) */ - -/* we may not define wxUSE_PROTOCOL_XXX if wxUSE_PROTOCOL is set to 0 */ -#if !wxUSE_PROTOCOL -# undef wxUSE_PROTOCOL_HTTP -# undef wxUSE_PROTOCOL_FTP -# undef wxUSE_PROTOCOL_FILE -# define wxUSE_PROTOCOL_HTTP 0 -# define wxUSE_PROTOCOL_FTP 0 -# define wxUSE_PROTOCOL_FILE 0 -#endif /* wxUSE_PROTOCOL */ - -#ifndef wxUSE_PROTOCOL_HTTP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_HTTP must be defined." -# else -# define wxUSE_PROTOCOL_HTTP 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL_HTTP) */ - -#ifndef wxUSE_PROTOCOL_FTP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FTP must be defined." -# else -# define wxUSE_PROTOCOL_FTP 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL_FTP) */ - -#ifndef wxUSE_PROTOCOL_FILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FILE must be defined." -# else -# define wxUSE_PROTOCOL_FILE 0 -# endif -#endif /* !defined(wxUSE_PROTOCOL_FILE) */ - -#ifndef wxUSE_REGEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_REGEX must be defined." -# else -# define wxUSE_REGEX 0 -# endif -#endif /* !defined(wxUSE_REGEX) */ - -#ifndef wxUSE_STDPATHS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STDPATHS must be defined." -# else -# define wxUSE_STDPATHS 1 -# endif -#endif /* !defined(wxUSE_STDPATHS) */ - -#ifndef wxUSE_XML -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XML must be defined." -# else -# define wxUSE_XML 0 -# endif -#endif /* !defined(wxUSE_XML) */ - -#ifndef wxUSE_SOCKETS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOCKETS must be defined." -# else -# define wxUSE_SOCKETS 0 -# endif -#endif /* !defined(wxUSE_SOCKETS) */ - -#ifndef wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STREAMS must be defined." -# else -# define wxUSE_STREAMS 0 -# endif -#endif /* !defined(wxUSE_STREAMS) */ - -#ifndef wxUSE_STOPWATCH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STOPWATCH must be defined." -# else -# define wxUSE_STOPWATCH 0 -# endif -#endif /* !defined(wxUSE_STOPWATCH) */ - -#ifndef wxUSE_TEXTBUFFER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTBUFFER must be defined." -# else -# define wxUSE_TEXTBUFFER 0 -# endif -#endif /* !defined(wxUSE_TEXTBUFFER) */ - -#ifndef wxUSE_TEXTFILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE must be defined." -# else -# define wxUSE_TEXTFILE 0 -# endif -#endif /* !defined(wxUSE_TEXTFILE) */ - -#ifndef wxUSE_UNICODE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE must be defined." -# else -# define wxUSE_UNICODE 0 -# endif -#endif /* !defined(wxUSE_UNICODE) */ - -#ifndef wxUSE_URL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_URL must be defined." -# else -# define wxUSE_URL 0 -# endif -#endif /* !defined(wxUSE_URL) */ - -#ifndef wxUSE_VARIANT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_VARIANT must be defined." -# else -# define wxUSE_VARIANT 0 -# endif -#endif /* wxUSE_VARIANT */ - -/* - all these tests are for GUI only - - please keep the options in alphabetical order! - */ -#if wxUSE_GUI - -/* - all of the settings tested below must be defined or we'd get an error from - preprocessor about invalid integer expression - */ - -#ifndef wxUSE_ABOUTDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ABOUTDLG must be defined." -# else -# define wxUSE_ABOUTDLG 0 -# endif -#endif /* !defined(wxUSE_ABOUTDLG) */ - -#ifndef wxUSE_ACCEL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACCEL must be defined." -# else -# define wxUSE_ACCEL 0 -# endif -#endif /* !defined(wxUSE_ACCEL) */ - -#ifndef wxUSE_ANIMATIONCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ANIMATIONCTRL must be defined." -# else -# define wxUSE_ANIMATIONCTRL 0 -# endif -#endif /* !defined(wxUSE_ANIMATIONCTRL) */ - -#ifndef wxUSE_BITMAPCOMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BITMAPCOMBOBOX must be defined." -# else -# define wxUSE_BITMAPCOMBOBOX 0 -# endif -#endif /* !defined(wxUSE_BITMAPCOMBOBOX) */ - -#ifndef wxUSE_BMPBUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BMPBUTTON must be defined." -# else -# define wxUSE_BMPBUTTON 0 -# endif -#endif /* !defined(wxUSE_BMPBUTTON) */ - -#ifndef wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BUTTON must be defined." -# else -# define wxUSE_BUTTON 0 -# endif -#endif /* !defined(wxUSE_BUTTON) */ - -#ifndef wxUSE_CALENDARCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CALENDARCTRL must be defined." -# else -# define wxUSE_CALENDARCTRL 0 -# endif -#endif /* !defined(wxUSE_CALENDARCTRL) */ - -#ifndef wxUSE_CARET -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CARET must be defined." -# else -# define wxUSE_CARET 0 -# endif -#endif /* !defined(wxUSE_CARET) */ - -#ifndef wxUSE_CHECKBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHECKBOX must be defined." -# else -# define wxUSE_CHECKBOX 0 -# endif -#endif /* !defined(wxUSE_CHECKBOX) */ - -#ifndef wxUSE_CHECKLISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHECKLISTBOX must be defined." -# else -# define wxUSE_CHECKLISTBOX 0 -# endif -#endif /* !defined(wxUSE_CHECKLISTBOX) */ - -#ifndef wxUSE_CHOICE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICE must be defined." -# else -# define wxUSE_CHOICE 0 -# endif -#endif /* !defined(wxUSE_CHOICE) */ - -#ifndef wxUSE_CHOICEBOOK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICEBOOK must be defined." -# else -# define wxUSE_CHOICEBOOK 0 -# endif -#endif /* !defined(wxUSE_CHOICEBOOK) */ - -#ifndef wxUSE_CHOICEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CHOICEDLG must be defined." -# else -# define wxUSE_CHOICEDLG 0 -# endif -#endif /* !defined(wxUSE_CHOICEDLG) */ - -#ifndef wxUSE_CLIPBOARD -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CLIPBOARD must be defined." -# else -# define wxUSE_CLIPBOARD 0 -# endif -#endif /* !defined(wxUSE_CLIPBOARD) */ - -#ifndef wxUSE_COLLPANE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLLPANE must be defined." -# else -# define wxUSE_COLLPANE 0 -# endif -#endif /* !defined(wxUSE_COLLPANE) */ - -#ifndef wxUSE_COLOURDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLOURDLG must be defined." -# else -# define wxUSE_COLOURDLG 0 -# endif -#endif /* !defined(wxUSE_COLOURDLG) */ - -#ifndef wxUSE_COLOURPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLOURPICKERCTRL must be defined." -# else -# define wxUSE_COLOURPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_COLOURPICKERCTRL) */ - -#ifndef wxUSE_COMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMBOBOX must be defined." -# else -# define wxUSE_COMBOBOX 0 -# endif -#endif /* !defined(wxUSE_COMBOBOX) */ - -#ifndef wxUSE_COMBOCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COMBOCTRL must be defined." -# else -# define wxUSE_COMBOCTRL 0 -# endif -#endif /* !defined(wxUSE_COMBOCTRL) */ - -#ifndef wxUSE_DATAOBJ -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAOBJ must be defined." -# else -# define wxUSE_DATAOBJ 0 -# endif -#endif /* !defined(wxUSE_DATAOBJ) */ - -#ifndef wxUSE_DATAVIEWCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAVIEWCTRL must be defined." -# else -# define wxUSE_DATAVIEWCTRL 0 -# endif -#endif /* !defined(wxUSE_DATAVIEWCTRL) */ - -#ifndef wxUSE_DATEPICKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATEPICKCTRL must be defined." -# else -# define wxUSE_DATEPICKCTRL 0 -# endif -#endif /* !defined(wxUSE_DATEPICKCTRL) */ - -#ifndef wxUSE_DIRPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIRPICKERCTRL must be defined." -# else -# define wxUSE_DIRPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_DIRPICKERCTRL) */ - -#ifndef wxUSE_DISPLAY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DISPLAY must be defined." -# else -# define wxUSE_DISPLAY 0 -# endif -#endif /* !defined(wxUSE_DISPLAY) */ - -#ifndef wxUSE_DOC_VIEW_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined." -# else -# define wxUSE_DOC_VIEW_ARCHITECTURE 0 -# endif -#endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */ - -#ifndef wxUSE_FILEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEDLG must be defined." -# else -# define wxUSE_FILEDLG 0 -# endif -#endif /* !defined(wxUSE_FILEDLG) */ - -#ifndef wxUSE_FILEPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEPICKERCTRL must be defined." -# else -# define wxUSE_FILEPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_FILEPICKERCTRL) */ - -#ifndef wxUSE_FONTDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTDLG must be defined." -# else -# define wxUSE_FONTDLG 0 -# endif -#endif /* !defined(wxUSE_FONTDLG) */ - -#ifndef wxUSE_FONTMAP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTMAP must be defined." -# else -# define wxUSE_FONTMAP 0 -# endif -#endif /* !defined(wxUSE_FONTMAP) */ - -#ifndef wxUSE_FONTPICKERCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FONTPICKERCTRL must be defined." -# else -# define wxUSE_FONTPICKERCTRL 0 -# endif -#endif /* !defined(wxUSE_FONTPICKERCTRL) */ - -#ifndef wxUSE_GAUGE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GAUGE must be defined." -# else -# define wxUSE_GAUGE 0 -# endif -#endif /* !defined(wxUSE_GAUGE) */ - -#ifndef wxUSE_GRAPHICS_CONTEXT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRAPHICS_CONTEXT must be defined." -# else -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#endif /* !defined(wxUSE_GRAPHICS_CONTEXT) */ - - -#ifndef wxUSE_GRID -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRID must be defined." -# else -# define wxUSE_GRID 0 -# endif -#endif /* !defined(wxUSE_GRID) */ - -#ifndef wxUSE_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP must be defined." -# else -# define wxUSE_HELP 0 -# endif -#endif /* !defined(wxUSE_HELP) */ - -#ifndef wxUSE_HYPERLINKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HYPERLINKCTRL must be defined." -# else -# define wxUSE_HYPERLINKCTRL 0 -# endif -#endif /* !defined(wxUSE_HYPERLINKCTRL) */ - -#ifndef wxUSE_HTML -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HTML must be defined." -# else -# define wxUSE_HTML 0 -# endif -#endif /* !defined(wxUSE_HTML) */ - -#ifndef wxUSE_LIBMSPACK -# ifndef __UNIX__ - /* set to 0 on platforms that don't have libmspack */ -# define wxUSE_LIBMSPACK 0 -# else -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBMSPACK must be defined." -# else -# define wxUSE_LIBMSPACK 0 -# endif -# endif -#endif /* !defined(wxUSE_LIBMSPACK) */ - -#ifndef wxUSE_ICO_CUR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ICO_CUR must be defined." -# else -# define wxUSE_ICO_CUR 0 -# endif -#endif /* !defined(wxUSE_ICO_CUR) */ - -#ifndef wxUSE_IFF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IFF must be defined." -# else -# define wxUSE_IFF 0 -# endif -#endif /* !defined(wxUSE_IFF) */ - -#ifndef wxUSE_IMAGLIST -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IMAGLIST must be defined." -# else -# define wxUSE_IMAGLIST 0 -# endif -#endif /* !defined(wxUSE_IMAGLIST) */ - -#ifndef wxUSE_JOYSTICK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_JOYSTICK must be defined." -# else -# define wxUSE_JOYSTICK 0 -# endif -#endif /* !defined(wxUSE_JOYSTICK) */ - -#ifndef wxUSE_LISTBOOK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTBOOK must be defined." -# else -# define wxUSE_LISTBOOK 0 -# endif -#endif /* !defined(wxUSE_LISTBOOK) */ - -#ifndef wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTBOX must be defined." -# else -# define wxUSE_LISTBOX 0 -# endif -#endif /* !defined(wxUSE_LISTBOX) */ - -#ifndef wxUSE_LISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LISTCTRL must be defined." -# else -# define wxUSE_LISTCTRL 0 -# endif -#endif /* !defined(wxUSE_LISTCTRL) */ - -#ifndef wxUSE_LOGGUI -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGGUI must be defined." -# else -# define wxUSE_LOGGUI 0 -# endif -#endif /* !defined(wxUSE_LOGGUI) */ - -#ifndef wxUSE_LOGWINDOW -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGWINDOW must be defined." -# else -# define wxUSE_LOGWINDOW 0 -# endif -#endif /* !defined(wxUSE_LOGWINDOW) */ - -#ifndef wxUSE_LOG_DIALOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG_DIALOG must be defined." -# else -# define wxUSE_LOG_DIALOG 0 -# endif -#endif /* !defined(wxUSE_LOG_DIALOG) */ - -#ifndef wxUSE_MDI -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI must be defined." -# else -# define wxUSE_MDI 0 -# endif -#endif /* !defined(wxUSE_MDI) */ - -#ifndef wxUSE_MDI_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI_ARCHITECTURE must be defined." -# else -# define wxUSE_MDI_ARCHITECTURE 0 -# endif -#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */ - -#ifndef wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MENUS must be defined." -# else -# define wxUSE_MENUS 0 -# endif -#endif /* !defined(wxUSE_MENUS) */ - -#ifndef wxUSE_MSGDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MSGDLG must be defined." -# else -# define wxUSE_MSGDLG 0 -# endif -#endif /* !defined(wxUSE_MSGDLG) */ - -#ifndef wxUSE_NOTEBOOK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_NOTEBOOK must be defined." -# else -# define wxUSE_NOTEBOOK 0 -# endif -#endif /* !defined(wxUSE_NOTEBOOK) */ - -#ifndef wxUSE_ODCOMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ODCOMBOBOX must be defined." -# else -# define wxUSE_ODCOMBOBOX 0 -# endif -#endif /* !defined(wxUSE_ODCOMBOBOX) */ - -#ifndef wxUSE_PALETTE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PALETTE must be defined." -# else -# define wxUSE_PALETTE 0 -# endif -#endif /* !defined(wxUSE_PALETTE) */ - -#ifndef wxUSE_POPUPWIN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_POPUPWIN must be defined." -# else -# define wxUSE_POPUPWIN 0 -# endif -#endif /* !defined(wxUSE_POPUPWIN) */ - -#ifndef wxUSE_PRINTING_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PRINTING_ARCHITECTURE must be defined." -# else -# define wxUSE_PRINTING_ARCHITECTURE 0 -# endif -#endif /* !defined(wxUSE_PRINTING_ARCHITECTURE) */ - -#ifndef wxUSE_RADIOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX must be defined." -# else -# define wxUSE_RADIOBOX 0 -# endif -#endif /* !defined(wxUSE_RADIOBOX) */ - -#ifndef wxUSE_RADIOBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBTN must be defined." -# else -# define wxUSE_RADIOBTN 0 -# endif -#endif /* !defined(wxUSE_RADIOBTN) */ - -#ifndef wxUSE_SASH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SASH must be defined." -# else -# define wxUSE_SASH 0 -# endif -#endif /* !defined(wxUSE_SASH) */ - -#ifndef wxUSE_SCROLLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SCROLLBAR must be defined." -# else -# define wxUSE_SCROLLBAR 0 -# endif -#endif /* !defined(wxUSE_SCROLLBAR) */ - -#ifndef wxUSE_SLIDER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SLIDER must be defined." -# else -# define wxUSE_SLIDER 0 -# endif -#endif /* !defined(wxUSE_SLIDER) */ - -#ifndef wxUSE_SOUND -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOUND must be defined." -# else -# define wxUSE_SOUND 0 -# endif -#endif /* !defined(wxUSE_SOUND) */ - -#ifndef wxUSE_SPINBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPINBTN must be defined." -# else -# define wxUSE_SPINBTN 0 -# endif -#endif /* !defined(wxUSE_SPINBTN) */ - -#ifndef wxUSE_SPINCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPINCTRL must be defined." -# else -# define wxUSE_SPINCTRL 0 -# endif -#endif /* !defined(wxUSE_SPINCTRL) */ - -#ifndef wxUSE_SPLASH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPLASH must be defined." -# else -# define wxUSE_SPLASH 0 -# endif -#endif /* !defined(wxUSE_SPLASH) */ - -#ifndef wxUSE_SPLITTER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SPLITTER must be defined." -# else -# define wxUSE_SPLITTER 0 -# endif -#endif /* !defined(wxUSE_SPLITTER) */ - -#ifndef wxUSE_STATBMP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATBMP must be defined." -# else -# define wxUSE_STATBMP 0 -# endif -#endif /* !defined(wxUSE_STATBMP) */ - -#ifndef wxUSE_STATBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATBOX must be defined." -# else -# define wxUSE_STATBOX 0 -# endif -#endif /* !defined(wxUSE_STATBOX) */ - -#ifndef wxUSE_STATLINE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATLINE must be defined." -# else -# define wxUSE_STATLINE 0 -# endif -#endif /* !defined(wxUSE_STATLINE) */ - -#ifndef wxUSE_STATTEXT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATTEXT must be defined." -# else -# define wxUSE_STATTEXT 0 -# endif -#endif /* !defined(wxUSE_STATTEXT) */ - -#ifndef wxUSE_STATUSBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STATUSBAR must be defined." -# else -# define wxUSE_STATUSBAR 0 -# endif -#endif /* !defined(wxUSE_STATUSBAR) */ - -#ifndef wxUSE_TAB_DIALOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TAB_DIALOG must be defined." -# else -# define wxUSE_TAB_DIALOG 0 -# endif -#endif /* !defined(wxUSE_TAB_DIALOG) */ - -#ifndef wxUSE_TEXTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTCTRL must be defined." -# else -# define wxUSE_TEXTCTRL 0 -# endif -#endif /* !defined(wxUSE_TEXTCTRL) */ - -#ifndef wxUSE_TIPWINDOW -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TIPWINDOW must be defined." -# else -# define wxUSE_TIPWINDOW 0 -# endif -#endif /* !defined(wxUSE_TIPWINDOW) */ - -#ifndef wxUSE_TOOLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR must be defined." -# else -# define wxUSE_TOOLBAR 0 -# endif -#endif /* !defined(wxUSE_TOOLBAR) */ - -#ifndef wxUSE_TOOLTIPS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLTIPS must be defined." -# else -# define wxUSE_TOOLTIPS 0 -# endif -#endif /* !defined(wxUSE_TOOLTIPS) */ - -#ifndef wxUSE_TREECTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TREECTRL must be defined." -# else -# define wxUSE_TREECTRL 0 -# endif -#endif /* !defined(wxUSE_TREECTRL) */ - -#ifndef wxUSE_VALIDATORS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_VALIDATORS must be defined." -# else -# define wxUSE_VALIDATORS 0 -# endif -#endif /* !defined(wxUSE_VALIDATORS) */ - -#ifndef wxUSE_WXHTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_WXHTML_HELP must be defined." -# else -# define wxUSE_WXHTML_HELP 0 -# endif -#endif /* !defined(wxUSE_WXHTML_HELP) */ - -#ifndef wxUSE_XRC -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XRC must be defined." -# else -# define wxUSE_XRC 0 -# endif -#endif /* !defined(wxUSE_XRC) */ - -#endif /* wxUSE_GUI */ - -/* - check consistency of the settings - */ - -#if WXWIN_COMPATIBILITY_2_4 -# if !WXWIN_COMPATIBILITY_2_6 -# ifdef wxABORT_ON_CONFIG_ERROR -# error "2.4.X compatibility requires 2.6.X compatibility" -# else -# undef WXWIN_COMPATIBILITY_2_6 -# define WXWIN_COMPATIBILITY_2_6 1 -# endif -# endif -#endif /* WXWIN_COMPATIBILITY_2_4 */ - -#if wxUSE_ARCHIVE_STREAMS -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxArchive requires wxUSE_DATETIME" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 0 -# endif -# endif -#endif /* wxUSE_ARCHIVE_STREAMS */ - -#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" -# else -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* wxUSE_CRASHREPORT */ - -#if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP -# if !wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_XXX requires wxUSE_PROTOCOL" -# else -# undef wxUSE_PROTOCOL -# define wxUSE_PROTOCOL 1 -# endif -# endif -#endif /* wxUSE_PROTOCOL_XXX */ - -#if wxUSE_URL -# if !wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_URL requires wxUSE_PROTOCOL" -# else -# undef wxUSE_PROTOCOL -# define wxUSE_PROTOCOL 1 -# endif -# endif -#endif /* wxUSE_URL */ - -#if wxUSE_PROTOCOL -# if !wxUSE_SOCKETS -# if wxUSE_PROTOCOL_HTTP || wxUSE_PROTOCOL_FTP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL_FTP/HTTP requires wxUSE_SOCKETS" -# else -# undef wxUSE_SOCKETS -# define wxUSE_SOCKETS 1 -# endif -# endif -# endif - -# if !wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PROTOCOL requires wxUSE_STREAMS" -# else -# undef wxUSE_STREAMS -# define wxUSE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_PROTOCOL */ - -/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */ -#if wxUSE_HTML -# if !wxUSE_FILESYSTEM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxHTML requires wxFileSystem" -# else -# undef wxUSE_FILESYSTEM -# define wxUSE_FILESYSTEM 1 -# endif -# endif -#endif /* wxUSE_HTML */ - -#if wxUSE_FS_ARCHIVE -# if !wxUSE_FILESYSTEM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxArchiveFSHandler requires wxFileSystem" -# else -# undef wxUSE_FILESYSTEM -# define wxUSE_FILESYSTEM 1 -# endif -# endif -# if !wxUSE_ARCHIVE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxArchiveFSHandler requires wxArchive" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_FS_ARCHIVE */ - -#if wxUSE_FILESYSTEM -# if !wxUSE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM requires wxUSE_STREAMS" -# else -# undef wxUSE_STREAMS -# define wxUSE_STREAMS 1 -# endif -# endif -# if !wxUSE_FILE && !wxUSE_FFILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILESYSTEM requires either wxUSE_FILE or wxUSE_FFILE" -# else -# undef wxUSE_FILE -# define wxUSE_FILE 1 -# undef wxUSE_FFILE -# define wxUSE_FFILE 1 -# endif -# endif -#endif /* wxUSE_FILESYSTEM */ - -#if wxUSE_FS_INET -# if !wxUSE_PROTOCOL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FS_INET requires wxUSE_PROTOCOL" -# else -# undef wxUSE_PROTOCOL -# define wxUSE_PROTOCOL 1 -# endif -# endif -#endif /* wxUSE_FS_INET */ - -#if wxUSE_STOPWATCH || wxUSE_DATETIME -# if !wxUSE_LONGLONG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_STOPWATCH and wxUSE_DATETIME require wxUSE_LONGLONG" -# else -# undef wxUSE_LONGLONG -# define wxUSE_LONGLONG 1 -# endif -# endif -#endif /* wxUSE_STOPWATCH */ - -#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE" -# else -# undef wxUSE_TEXTFILE -# define wxUSE_TEXTFILE 1 -# endif -#endif /* wxUSE_MIMETYPE */ - -#if wxUSE_ODBC -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxODBC requires wxUSE_DATETIME" -# else -# undef wxUSE_ODBC -# define wxUSE_ODBC 0 -# endif -# endif -#endif /* wxUSE_ODBC */ - -#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER" -# else -# undef wxUSE_TEXTBUFFER -# define wxUSE_TEXTBUFFER 1 -# endif -#endif /* wxUSE_TEXTFILE */ - -#if wxUSE_TEXTFILE && !wxUSE_FILE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TEXTFILE requires wxUSE_FILE" -# else -# undef wxUSE_FILE -# define wxUSE_FILE 1 -# endif -#endif /* wxUSE_TEXTFILE */ - -#if wxUSE_XML && !wxUSE_WCHAR_T -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XML requires wxUSE_WCHAR_T" -# else -# undef wxUSE_XML -# define wxUSE_XML 0 -# endif -#endif /* wxUSE_XML */ - -#if !wxUSE_DYNLIB_CLASS -# if wxUSE_DYNAMIC_LOADER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DYNAMIC_LOADER requires wxUSE_DYNLIB_CLASS." -# else -# define wxUSE_DYNLIB_CLASS 1 -# endif -# endif -#endif /* wxUSE_DYNLIB_CLASS */ - -#if wxUSE_ZIPSTREAM -# if !wxUSE_ZLIB -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxZip requires wxZlib" -# else -# undef wxUSE_ZLIB -# define wxUSE_ZLIB 1 -# endif -# endif -# if !wxUSE_ARCHIVE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxZip requires wxArchive" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_ZIPSTREAM */ - -#if wxUSE_TARSTREAM - /* wxTar doesn't currently compile without wchar_t */ -# if !wxUSE_WCHAR_T -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTar requires wchar_t" -# else -# undef wxUSE_TARSTREAM -# define wxUSE_TARSTREAM 0 -# endif -# endif -#endif /* wxUSE_TARSTREAM */ - -#if wxUSE_TARSTREAM -# if !wxUSE_ARCHIVE_STREAMS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTar requires wxArchive" -# else -# undef wxUSE_ARCHIVE_STREAMS -# define wxUSE_ARCHIVE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_TARSTREAM */ - -/* the rest of the tests is for the GUI settings only */ -#if wxUSE_GUI - -#if wxUSE_BUTTON || \ - wxUSE_CALENDARCTRL || \ - wxUSE_CARET || \ - wxUSE_COMBOBOX || \ - wxUSE_BMPBUTTON || \ - wxUSE_CHECKBOX || \ - wxUSE_CHECKLISTBOX || \ - wxUSE_CHOICE || \ - wxUSE_GAUGE || \ - wxUSE_GRID || \ - wxUSE_LISTBOX || \ - wxUSE_LISTCTRL || \ - wxUSE_NOTEBOOK || \ - wxUSE_RADIOBOX || \ - wxUSE_RADIOBTN || \ - wxUSE_SCROLLBAR || \ - wxUSE_SLIDER || \ - wxUSE_SPINBTN || \ - wxUSE_SPINCTRL || \ - wxUSE_STATBMP || \ - wxUSE_STATBOX || \ - wxUSE_STATLINE || \ - wxUSE_STATTEXT || \ - wxUSE_STATUSBAR || \ - wxUSE_TEXTCTRL || \ - wxUSE_TOOLBAR || \ - wxUSE_TREECTRL -# if !wxUSE_CONTROLS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_CONTROLS unset but some controls used" -# else -# undef wxUSE_CONTROLS -# define wxUSE_CONTROLS 1 -# endif -# endif -#endif /* controls */ - -#if wxUSE_BMPBUTTON -# if !wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON" -# else -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* wxUSE_BMPBUTTON */ - -/* - wxUSE_BOOKCTRL should be only used if any of the controls deriving from it - are used - */ -#ifdef wxUSE_BOOKCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_BOOKCTRL is defined automatically, don't define it" -# else -# undef wxUSE_BOOKCTRL -# endif -#endif - -#define wxUSE_BOOKCTRL (wxUSE_NOTEBOOK || \ - wxUSE_LISTBOOK || \ - wxUSE_CHOICEBOOK || \ - wxUSE_TOOLBOOK || \ - wxUSE_TREEBOOK) - -#if wxUSE_COLLPANE -# if !wxUSE_BUTTON || !wxUSE_STATLINE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_COLLPANE requires wxUSE_BUTTON and wxUSE_STATLINE" -# else -# undef wxUSE_COLLPANE -# define wxUSE_COLLPANE 0 -# endif -# endif -#endif /* wxUSE_COLLPANE */ - -#if wxUSE_LISTBOOK -# if !wxUSE_LISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxListbook requires wxListCtrl" -# else -# undef wxUSE_LISTCTRL -# define wxUSE_LISTCTRL 1 -# endif -# endif -#endif /* wxUSE_LISTBOOK */ - -#if wxUSE_CHOICEBOOK -# if !wxUSE_CHOICE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxChoicebook requires wxChoice" -# else -# undef wxUSE_CHOICE -# define wxUSE_CHOICE 1 -# endif -# endif -#endif /* wxUSE_CHOICEBOOK */ - -#if wxUSE_TOOLBOOK -# if !wxUSE_TOOLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxToolbook requires wxToolBar" -# else -# undef wxUSE_TOOLBAR -# define wxUSE_TOOLBAR 1 -# endif -# endif -#endif /* wxUSE_TOOLBOOK */ - -#if !wxUSE_ODCOMBOBOX -# if wxUSE_BITMAPCOMBOBOX -# error "wxBitmapComboBox requires wxOwnerDrawnComboBox" -# else -# undef wxUSE_BITMAPCOMBOBOX -# define wxUSE_BITMAPCOMBOBOX 0 -# endif -#endif /* !wxUSE_ODCOMBOBOX */ - -/* don't attempt to use native status bar on the platforms not having it */ -#ifndef wxUSE_NATIVE_STATUSBAR -# define wxUSE_NATIVE_STATUSBAR 0 -#elif wxUSE_NATIVE_STATUSBAR -# if defined(__WXUNIVERSAL__) || !( defined(__WXMSW__) || \ - defined(__WXMAC__) || \ - defined(__WXPALMOS__) ) -# undef wxUSE_NATIVE_STATUSBAR -# define wxUSE_NATIVE_STATUSBAR 0 -# endif -#endif - -#if wxUSE_GRAPHICS_CONTEXT && !wxUSE_GEOMETRY -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GRAPHICS_CONTEXT requires wxUSE_GEOMETRY" -# else -# undef wxUSE_GRAPHICS_CONTEXT -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#endif /* wxUSE_GRAPHICS_CONTEXT */ - - -/* wxGTK-specific dependencies */ -#ifdef __WXGTK__ -# ifndef __WXUNIVERSAL__ -# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "MDI requires wxUSE_MENUS in wxGTK" -# else -# undef wxUSE_MENUS -# define wxUSE_MENUS 1 -# endif -# endif -# endif /* !__WXUNIVERSAL__ */ - -# if wxUSE_JOYSTICK -# if !wxUSE_THREADS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxJoystick requires threads in wxGTK" -# else -# undef wxUSE_JOYSTICK -# define wxUSE_JOYSTICK 0 -# endif -# endif -# endif -#endif /* wxGTK && !wxUniv */ - -/* Hopefully we can emulate these dialogs in due course */ -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) -# ifdef wxUSE_COLOURDLG -# undef wxUSE_COLOURDLG -# define wxUSE_COLOURDLG 0 -# endif -#endif /* __SMARTPHONE__ && __WXWINCE__ */ - - -/* generic controls dependencies */ -#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) -# if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG - /* all common controls are needed by these dialogs */ -# if !defined(wxUSE_CHOICE) || \ - !defined(wxUSE_TEXTCTRL) || \ - !defined(wxUSE_BUTTON) || \ - !defined(wxUSE_CHECKBOX) || \ - !defined(wxUSE_STATTEXT) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "These common controls are needed by common dialogs" -# else -# undef wxUSE_CHOICE -# define wxUSE_CHOICE 1 -# undef wxUSE_TEXTCTRL -# define wxUSE_TEXTCTRL 1 -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# undef wxUSE_CHECKBOX -# define wxUSE_CHECKBOX 1 -# undef wxUSE_STATTEXT -# define wxUSE_STATTEXT 1 -# endif -# endif -# endif -#endif /* !wxMSW || wxUniv */ - -/* common dependencies */ -#if wxUSE_CALENDARCTRL -# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxCalendarCtrl requires wxSpinButton and wxComboBox" -# else -# undef wxUSE_SPINBTN -# undef wxUSE_COMBOBOX -# define wxUSE_SPINBTN 1 -# define wxUSE_COMBOBOX 1 -# endif -# endif - -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxCalendarCtrl requires wxUSE_DATETIME" -# else -# undef wxUSE_DATETIME -# define wxUSE_DATETIME 1 -# endif -# endif -#endif /* wxUSE_CALENDARCTRL */ - -#if wxUSE_DATEPICKCTRL -# if !wxUSE_DATETIME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDatePickerCtrl requires wxUSE_DATETIME" -# else -# undef wxUSE_DATETIME -# define wxUSE_DATETIME 1 -# endif -# endif -#endif /* wxUSE_DATEPICKCTRL */ - -#if wxUSE_CHECKLISTBOX -# if !wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxCheckListBox requires wxListBox" -# else -# undef wxUSE_LISTBOX -# define wxUSE_LISTBOX 1 -# endif -# endif -#endif /* wxUSE_CHECKLISTBOX */ - -#if wxUSE_CHOICEDLG -# if !wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Choice dialogs requires wxListBox" -# else -# undef wxUSE_LISTBOX -# define wxUSE_LISTBOX 1 -# endif -# endif -#endif /* wxUSE_CHOICEDLG */ - -#if wxUSE_HELP -# if !wxUSE_BMPBUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP requires wxUSE_BMPBUTTON" -# else -# undef wxUSE_BMPBUTTON -# define wxUSE_BMPBUTTON 1 -# endif -# endif - -# if !wxUSE_CHOICEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_HELP requires wxUSE_CHOICEDLG" -# else -# undef wxUSE_CHOICEDLG -# define wxUSE_CHOICEDLG 1 -# endif -# endif -#endif /* wxUSE_HELP */ - -#if wxUSE_MS_HTML_HELP - /* - this doesn't make sense for platforms other than MSW but we still - define it in wx/setup_inc.h so don't complain if it happens to be - defined under another platform but just silently fix it. - */ -# ifndef __WXMSW__ -# undef wxUSE_MS_HTML_HELP -# define wxUSE_MS_HTML_HELP 0 -# endif -#endif /* wxUSE_MS_HTML_HELP */ - -#if wxUSE_WXHTML_HELP -# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Built in help controller can't be compiled" -# else -# undef wxUSE_HELP -# define wxUSE_HELP 1 -# undef wxUSE_HTML -# define wxUSE_HTML 1 -# undef wxUSE_COMBOBOX -# define wxUSE_COMBOBOX 1 -# undef wxUSE_NOTEBOOK -# define wxUSE_NOTEBOOK 1 -# undef wxUSE_SPINCTRL -# define wxUSE_SPINCTRL 1 -# endif -# endif -#endif /* wxUSE_WXHTML_HELP */ - -#if !wxUSE_IMAGE -/* - The default wxUSE_IMAGE setting is 1, so if it's set to 0 we assume the - user explicitly wants this and disable all other features that require - wxUSE_IMAGE. - */ -# if wxUSE_DRAGIMAGE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DRAGIMAGE requires wxUSE_IMAGE" -# else -# undef wxUSE_DRAGIMAGE -# define wxUSE_DRAGIMAGE 0 -# endif -# endif - -# if wxUSE_LIBPNG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBPNG requires wxUSE_IMAGE" -# else -# undef wxUSE_LIBPNG -# define wxUSE_LIBPNG 0 -# endif -# endif - -# if wxUSE_LIBJPEG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBJPEG requires wxUSE_IMAGE" -# else -# undef wxUSE_LIBJPEG -# define wxUSE_LIBJPEG 0 -# endif -# endif - -# if wxUSE_LIBTIFF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LIBTIFF requires wxUSE_IMAGE" -# else -# undef wxUSE_LIBTIFF -# define wxUSE_LIBTIFF 0 -# endif -# endif - -# if wxUSE_GIF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_GIF requires wxUSE_IMAGE" -# else -# undef wxUSE_GIF -# define wxUSE_GIF 0 -# endif -# endif - -# if wxUSE_PNM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PNM requires wxUSE_IMAGE" -# else -# undef wxUSE_PNM -# define wxUSE_PNM 0 -# endif -# endif - -# if wxUSE_PCX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_PCX requires wxUSE_IMAGE" -# else -# undef wxUSE_PCX -# define wxUSE_PCX 0 -# endif -# endif - -# if wxUSE_IFF -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_IFF requires wxUSE_IMAGE" -# else -# undef wxUSE_IFF -# define wxUSE_IFF 0 -# endif -# endif - -# if wxUSE_TOOLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR requires wxUSE_IMAGE" -# else -# undef wxUSE_TOOLBAR -# define wxUSE_TOOLBAR 0 -# endif -# endif - -# if wxUSE_XPM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XPM requires wxUSE_IMAGE" -# else -# undef wxUSE_XPM -# define wxUSE_XPM 0 -# endif -# endif - -#endif /* !wxUSE_IMAGE */ - -#if wxUSE_DOC_VIEW_ARCHITECTURE -# if !wxUSE_MENUS -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_MENUS" -# else -# undef wxUSE_MENUS -# define wxUSE_MENUS 1 -# endif -# endif - -# if !wxUSE_CHOICEDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_CHOICEDLG" -# else -# undef wxUSE_CHOICEDLG -# define wxUSE_CHOICEDLG 1 -# endif -# endif - -# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM -# ifdef wxABORT_ON_CONFIG_ERROR -# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM" -# else -# undef wxUSE_STREAMS -# define wxUSE_STREAMS 1 -# endif -# endif -#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */ - -#if wxUSE_PRINTING_ARCHITECTURE -# if !wxUSE_COMBOBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Print dialog requires wxUSE_COMBOBOX" -# else -# undef wxUSE_COMBOBOX -# define wxUSE_COMBOBOX 1 -# endif -# endif -#endif /* wxUSE_PRINTING_ARCHITECTURE */ - -#if wxUSE_MDI_ARCHITECTURE -# if !wxUSE_MDI -# ifdef wxABORT_ON_CONFIG_ERROR -# error "MDI requires wxUSE_MDI" -# else -# undef wxUSE_MDI -# define wxUSE_MDI 1 -# endif -# endif - -# if !wxUSE_DOC_VIEW_ARCHITECTURE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MDI_ARCHITECTURE requires wxUSE_DOC_VIEW_ARCHITECTURE" -# else -# undef wxUSE_DOC_VIEW_ARCHITECTURE -# define wxUSE_DOC_VIEW_ARCHITECTURE 1 -# endif -# endif -#endif /* wxUSE_MDI_ARCHITECTURE */ - -#if !wxUSE_FILEDLG -# if wxUSE_DOC_VIEW_ARCHITECTURE || wxUSE_WXHTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_FILEDLG is required by wxUSE_DOC_VIEW_ARCHITECTURE and wxUSE_WXHTML_HELP!" -# else -# undef wxUSE_FILEDLG -# define wxUSE_FILEDLG 1 -# endif -# endif -#endif /* wxUSE_FILEDLG */ - -#if !wxUSE_GAUGE || !wxUSE_BUTTON -# if wxUSE_PROGRESSDLG && !defined(__WXPALMOS__) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON" -# else -# undef wxUSE_GAUGE -# undef wxUSE_BUTTON -# define wxUSE_GAUGE 1 -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* !wxUSE_GAUGE */ - -#if !wxUSE_BUTTON -# if wxUSE_FONTDLG || \ - wxUSE_FILEDLG || \ - wxUSE_CHOICEDLG || \ - wxUSE_NUMBERDLG || \ - wxUSE_TEXTDLG || \ - wxUSE_DIRDLG || \ - wxUSE_STARTUP_TIPS || \ - wxUSE_WIZARDDLG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Common and generic dialogs require wxUSE_BUTTON" -# else -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* !wxUSE_BUTTON */ - -#if !wxUSE_TOOLBAR -# if wxUSE_TOOLBAR_NATIVE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TOOLBAR is set to 0 but wxUSE_TOOLBAR_NATIVE is set to 1" -# else -# undef wxUSE_TOOLBAR_NATIVE -# define wxUSE_TOOLBAR_NATIVE 0 -# endif -# endif -#endif - -#if !wxUSE_IMAGLIST -# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxImageList must be compiled as well" -# else -# undef wxUSE_IMAGLIST -# define wxUSE_IMAGLIST 1 -# endif -# endif -#endif /* !wxUSE_IMAGLIST */ - -#if !wxUSE_MSGDLG -# ifdef wxABORT_ON_CONFIG_ERROR - /* FIXME: should compile without it, of course, but doesn't */ -# error "wxMessageBox is always needed" -# else -# undef wxUSE_MSGDLG -# define wxUSE_MSGDLG 1 -# endif -#endif - -#if wxUSE_RADIOBOX -# if !wxUSE_RADIOBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN" -# else -# undef wxUSE_RADIOBTN -# define wxUSE_RADIOBTN 1 -# endif -# endif -# if !wxUSE_STATBOX && !defined(__WXPALMOS__) -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBOX requires wxUSE_STATBOX" -# else -# undef wxUSE_STATBOX -# define wxUSE_STATBOX 1 -# endif -# endif -#endif /* wxUSE_RADIOBOX */ - -#if wxUSE_LOGWINDOW -# if !wxUSE_TEXTCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOGWINDOW requires wxUSE_TEXTCTRL" -# else -# undef wxUSE_TEXTCTRL -# define wxUSE_TEXTCTRL 1 -# endif -# endif -#endif /* wxUSE_LOGWINDOW */ - -#if wxUSE_LOG_DIALOG -# if !wxUSE_LISTCTRL || !wxUSE_BUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON" -# else -# undef wxUSE_LISTCTRL -# define wxUSE_LISTCTRL 1 -# undef wxUSE_BUTTON -# define wxUSE_BUTTON 1 -# endif -# endif -#endif /* wxUSE_LOG_DIALOG */ - -#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxClipboard requires wxDataObject" -# else -# undef wxUSE_DATAOBJ -# define wxUSE_DATAOBJ 1 -# endif -#endif /* wxUSE_CLIPBOARD */ - -#if wxUSE_WX_RESOURCES && !wxUSE_PROLOGIO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxr resources require PrologIO" -# else -# undef wxUSE_PROLOGIO -# define wxUSE_PROLOGIO 1 -# endif -#endif /* wxUSE_WX_RESOURCES */ - -#if wxUSE_XRC && !wxUSE_XML -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_XRC requires wxUSE_XML" -# else -# undef wxUSE_XRC -# define wxUSE_XRC 0 -# endif -#endif /* wxUSE_XRC */ - -#if wxUSE_SOCKETS && !wxUSE_STOPWATCH -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_SOCKETS requires wxUSE_STOPWATCH" -# else -# undef wxUSE_SOCKETS -# define wxUSE_SOCKETS 0 -# endif -#endif /* wxUSE_SOCKETS */ - -#if !wxUSE_VARIANT -# if wxUSE_DATAVIEWCTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxDataViewCtrl requires wxVariant" -# else -# undef wxUSE_DATAVIEWCTRL -# define wxUSE_DATAVIEWCTRL 0 -# endif -# endif - -# if wxUSE_ODBC -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ODBC requires wxVariant" -# else -# undef wxUSE_ODBC -# define wxUSE_ODBC 0 -# endif -# endif -#endif /* wxUSE_VARIANT */ - -#endif /* wxUSE_GUI */ +/* + * Name: wx/chkconf.h + * Purpose: check the config settings for consistency + * Author: Vadim Zeitlin + * Modified by: + * Created: 09.08.00 + * RCS-ID: $Id: chkconf.h 48113 2007-08-15 17:43:50Z DE $ + * Copyright: (c) 2000 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +/* + Platform-specific checking. + */ + +#if defined(__WXPALMOS__) +# include "wx/palmos/chkconf.h" +#elif defined(__WXWINCE__) +# include "wx/msw/wince/chkconf.h" +#elif defined(__WXMSW__) +# include "wx/msw/chkconf.h" +#elif defined(__WXMAC__) +# include "wx/mac/chkconf.h" +#elif defined(__OS2__) +# include "wx/os2/chkconf.h" +#elif defined(__WXMGL__) +# include "wx/mgl/chkconf.h" +#elif defined(__WXDFB__) +# include "wx/dfb/chkconf.h" +#elif defined(__WXMOTIF__) +# include "wx/motif/chkconf.h" +#elif defined(__WXX11__) +# include "wx/x11/chkconf.h" +#endif + +#ifdef __WXUNIVERSAL__ +# include "wx/univ/chkconf.h" +#endif + +/* + this global setting determines what should we do if the setting FOO + requires BAR and BAR is not set: we can either silently unset FOO as well + (do this if you're trying to build the smallest possible library) or give an + error and abort (default as leads to least surprizing behaviour) + */ +#define wxABORT_ON_CONFIG_ERROR + +/* + global features + */ + +/* GUI build by default */ +#if !defined(wxUSE_GUI) +# define wxUSE_GUI 1 +#endif /* !defined(wxUSE_GUI) */ + +/* Turn off wxUSE_ABI_INCOMPATIBLE_FEATURES if not specified. */ +#if !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) +# define wxUSE_ABI_INCOMPATIBLE_FEATURES 0 +#endif /* !defined(wxUSE_ABI_INCOMPATIBLE_FEATURES) */ + +/* + If we're compiling without support for threads/exceptions we have to + disable the corresponding features. + */ +#ifdef wxNO_THREADS +# undef wxUSE_THREADS +# define wxUSE_THREADS 0 +#endif /* wxNO_THREADS */ + +#ifdef wxNO_EXCEPTIONS +# undef wxUSE_EXCEPTIONS +# define wxUSE_EXCEPTIONS 0 +#endif /* wxNO_EXCEPTIONS */ + +/* we also must disable exceptions if compiler doesn't support them */ +#if defined(_MSC_VER) && !defined(_CPPUNWIND) +# undef wxUSE_EXCEPTIONS +# define wxUSE_EXCEPTIONS 0 +#endif /* VC++ without exceptions support */ + + +/* + tests for non GUI features + + please keep the options in alphabetical order! + */ + +#ifndef wxUSE_CRASHREPORT + /* this one is special: as currently it is Windows-only, don't force it + to be defined on other platforms */ +# if defined(wxABORT_ON_CONFIG_ERROR) && defined(__WXMSW__) +# error "wxUSE_CRASHREPORT must be defined." +# else +# define wxUSE_CRASHREPORT 0 +# endif +#endif /* !defined(wxUSE_CRASHREPORT) */ + +#ifndef wxUSE_DYNLIB_CLASS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DYNLIB_CLASS must be defined." +# else +# define wxUSE_DYNLIB_CLASS 0 +# endif +#endif /* !defined(wxUSE_DYNLIB_CLASS) */ + +#ifndef wxUSE_EXCEPTIONS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_EXCEPTIONS must be defined." +# else +# define wxUSE_EXCEPTIONS 0 +# endif +#endif /* !defined(wxUSE_EXCEPTIONS) */ + +#ifndef wxUSE_FILESYSTEM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILESYSTEM must be defined." +# else +# define wxUSE_FILESYSTEM 0 +# endif +#endif /* !defined(wxUSE_FILESYSTEM) */ + +#ifndef wxUSE_FS_ARCHIVE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FS_ARCHIVE must be defined." +# else +# define wxUSE_FS_ARCHIVE 0 +# endif +#endif /* !defined(wxUSE_FS_ARCHIVE) */ + +/* don't give an error about this one yet, it's not fully implemented */ +#ifndef wxUSE_FSVOLUME +# define wxUSE_FSVOLUME 0 +#endif /* !defined(wxUSE_FSVOLUME) */ + +#ifndef wxUSE_DYNAMIC_LOADER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DYNAMIC_LOADER must be defined." +# else +# define wxUSE_DYNAMIC_LOADER 0 +# endif +#endif /* !defined(wxUSE_DYNAMIC_LOADER) */ + +#ifndef wxUSE_LOG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOG must be defined." +# else +# define wxUSE_LOG 0 +# endif +#endif /* !defined(wxUSE_LOG) */ + +#ifndef wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LONGLONG must be defined." +# else +# define wxUSE_LONGLONG 0 +# endif +#endif /* !defined(wxUSE_LONGLONG) */ + +#ifndef wxUSE_MIMETYPE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MIMETYPE must be defined." +# else +# define wxUSE_MIMETYPE 0 +# endif +#endif /* !defined(wxUSE_MIMETYPE) */ + +#ifndef wxUSE_ON_FATAL_EXCEPTION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ON_FATAL_EXCEPTION must be defined." +# else +# define wxUSE_ON_FATAL_EXCEPTION 0 +# endif +#endif /* !defined(wxUSE_ON_FATAL_EXCEPTION) */ + +#ifndef wxUSE_PRINTF_POS_PARAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PRINTF_POS_PARAMS must be defined." +# else +# define wxUSE_PRINTF_POS_PARAMS 0 +# endif +#endif /* !defined(wxUSE_PRINTF_POS_PARAMS) */ + +#ifndef wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL must be defined." +# else +# define wxUSE_PROTOCOL 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL) */ + +/* we may not define wxUSE_PROTOCOL_XXX if wxUSE_PROTOCOL is set to 0 */ +#if !wxUSE_PROTOCOL +# undef wxUSE_PROTOCOL_HTTP +# undef wxUSE_PROTOCOL_FTP +# undef wxUSE_PROTOCOL_FILE +# define wxUSE_PROTOCOL_HTTP 0 +# define wxUSE_PROTOCOL_FTP 0 +# define wxUSE_PROTOCOL_FILE 0 +#endif /* wxUSE_PROTOCOL */ + +#ifndef wxUSE_PROTOCOL_HTTP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_HTTP must be defined." +# else +# define wxUSE_PROTOCOL_HTTP 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL_HTTP) */ + +#ifndef wxUSE_PROTOCOL_FTP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_FTP must be defined." +# else +# define wxUSE_PROTOCOL_FTP 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL_FTP) */ + +#ifndef wxUSE_PROTOCOL_FILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_FILE must be defined." +# else +# define wxUSE_PROTOCOL_FILE 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL_FILE) */ + +#ifndef wxUSE_REGEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_REGEX must be defined." +# else +# define wxUSE_REGEX 0 +# endif +#endif /* !defined(wxUSE_REGEX) */ + +#ifndef wxUSE_STDPATHS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STDPATHS must be defined." +# else +# define wxUSE_STDPATHS 1 +# endif +#endif /* !defined(wxUSE_STDPATHS) */ + +#ifndef wxUSE_XML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XML must be defined." +# else +# define wxUSE_XML 0 +# endif +#endif /* !defined(wxUSE_XML) */ + +#ifndef wxUSE_SOCKETS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SOCKETS must be defined." +# else +# define wxUSE_SOCKETS 0 +# endif +#endif /* !defined(wxUSE_SOCKETS) */ + +#ifndef wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STREAMS must be defined." +# else +# define wxUSE_STREAMS 0 +# endif +#endif /* !defined(wxUSE_STREAMS) */ + +#ifndef wxUSE_STOPWATCH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STOPWATCH must be defined." +# else +# define wxUSE_STOPWATCH 0 +# endif +#endif /* !defined(wxUSE_STOPWATCH) */ + +#ifndef wxUSE_TEXTBUFFER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTBUFFER must be defined." +# else +# define wxUSE_TEXTBUFFER 0 +# endif +#endif /* !defined(wxUSE_TEXTBUFFER) */ + +#ifndef wxUSE_TEXTFILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTFILE must be defined." +# else +# define wxUSE_TEXTFILE 0 +# endif +#endif /* !defined(wxUSE_TEXTFILE) */ + +#ifndef wxUSE_UNICODE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UNICODE must be defined." +# else +# define wxUSE_UNICODE 0 +# endif +#endif /* !defined(wxUSE_UNICODE) */ + +#ifndef wxUSE_URL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_URL must be defined." +# else +# define wxUSE_URL 0 +# endif +#endif /* !defined(wxUSE_URL) */ + +#ifndef wxUSE_VARIANT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_VARIANT must be defined." +# else +# define wxUSE_VARIANT 0 +# endif +#endif /* wxUSE_VARIANT */ + +/* + all these tests are for GUI only + + please keep the options in alphabetical order! + */ +#if wxUSE_GUI + +/* + all of the settings tested below must be defined or we'd get an error from + preprocessor about invalid integer expression + */ + +#ifndef wxUSE_ABOUTDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ABOUTDLG must be defined." +# else +# define wxUSE_ABOUTDLG 0 +# endif +#endif /* !defined(wxUSE_ABOUTDLG) */ + +#ifndef wxUSE_ACCEL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACCEL must be defined." +# else +# define wxUSE_ACCEL 0 +# endif +#endif /* !defined(wxUSE_ACCEL) */ + +#ifndef wxUSE_ANIMATIONCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ANIMATIONCTRL must be defined." +# else +# define wxUSE_ANIMATIONCTRL 0 +# endif +#endif /* !defined(wxUSE_ANIMATIONCTRL) */ + +#ifndef wxUSE_BITMAPCOMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BITMAPCOMBOBOX must be defined." +# else +# define wxUSE_BITMAPCOMBOBOX 0 +# endif +#endif /* !defined(wxUSE_BITMAPCOMBOBOX) */ + +#ifndef wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BMPBUTTON must be defined." +# else +# define wxUSE_BMPBUTTON 0 +# endif +#endif /* !defined(wxUSE_BMPBUTTON) */ + +#ifndef wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BUTTON must be defined." +# else +# define wxUSE_BUTTON 0 +# endif +#endif /* !defined(wxUSE_BUTTON) */ + +#ifndef wxUSE_CALENDARCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CALENDARCTRL must be defined." +# else +# define wxUSE_CALENDARCTRL 0 +# endif +#endif /* !defined(wxUSE_CALENDARCTRL) */ + +#ifndef wxUSE_CARET +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CARET must be defined." +# else +# define wxUSE_CARET 0 +# endif +#endif /* !defined(wxUSE_CARET) */ + +#ifndef wxUSE_CHECKBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHECKBOX must be defined." +# else +# define wxUSE_CHECKBOX 0 +# endif +#endif /* !defined(wxUSE_CHECKBOX) */ + +#ifndef wxUSE_CHECKLISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHECKLISTBOX must be defined." +# else +# define wxUSE_CHECKLISTBOX 0 +# endif +#endif /* !defined(wxUSE_CHECKLISTBOX) */ + +#ifndef wxUSE_CHOICE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHOICE must be defined." +# else +# define wxUSE_CHOICE 0 +# endif +#endif /* !defined(wxUSE_CHOICE) */ + +#ifndef wxUSE_CHOICEBOOK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHOICEBOOK must be defined." +# else +# define wxUSE_CHOICEBOOK 0 +# endif +#endif /* !defined(wxUSE_CHOICEBOOK) */ + +#ifndef wxUSE_CHOICEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHOICEDLG must be defined." +# else +# define wxUSE_CHOICEDLG 0 +# endif +#endif /* !defined(wxUSE_CHOICEDLG) */ + +#ifndef wxUSE_CLIPBOARD +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CLIPBOARD must be defined." +# else +# define wxUSE_CLIPBOARD 0 +# endif +#endif /* !defined(wxUSE_CLIPBOARD) */ + +#ifndef wxUSE_COLLPANE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLLPANE must be defined." +# else +# define wxUSE_COLLPANE 0 +# endif +#endif /* !defined(wxUSE_COLLPANE) */ + +#ifndef wxUSE_COLOURDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLOURDLG must be defined." +# else +# define wxUSE_COLOURDLG 0 +# endif +#endif /* !defined(wxUSE_COLOURDLG) */ + +#ifndef wxUSE_COLOURPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLOURPICKERCTRL must be defined." +# else +# define wxUSE_COLOURPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_COLOURPICKERCTRL) */ + +#ifndef wxUSE_COMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMBOBOX must be defined." +# else +# define wxUSE_COMBOBOX 0 +# endif +#endif /* !defined(wxUSE_COMBOBOX) */ + +#ifndef wxUSE_COMBOCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMBOCTRL must be defined." +# else +# define wxUSE_COMBOCTRL 0 +# endif +#endif /* !defined(wxUSE_COMBOCTRL) */ + +#ifndef wxUSE_DATAOBJ +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATAOBJ must be defined." +# else +# define wxUSE_DATAOBJ 0 +# endif +#endif /* !defined(wxUSE_DATAOBJ) */ + +#ifndef wxUSE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATAVIEWCTRL must be defined." +# else +# define wxUSE_DATAVIEWCTRL 0 +# endif +#endif /* !defined(wxUSE_DATAVIEWCTRL) */ + +#ifndef wxUSE_DATEPICKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATEPICKCTRL must be defined." +# else +# define wxUSE_DATEPICKCTRL 0 +# endif +#endif /* !defined(wxUSE_DATEPICKCTRL) */ + +#ifndef wxUSE_DIRPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIRPICKERCTRL must be defined." +# else +# define wxUSE_DIRPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_DIRPICKERCTRL) */ + +#ifndef wxUSE_DISPLAY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DISPLAY must be defined." +# else +# define wxUSE_DISPLAY 0 +# endif +#endif /* !defined(wxUSE_DISPLAY) */ + +#ifndef wxUSE_DOC_VIEW_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined." +# else +# define wxUSE_DOC_VIEW_ARCHITECTURE 0 +# endif +#endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */ + +#ifndef wxUSE_FILEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILEDLG must be defined." +# else +# define wxUSE_FILEDLG 0 +# endif +#endif /* !defined(wxUSE_FILEDLG) */ + +#ifndef wxUSE_FILEPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILEPICKERCTRL must be defined." +# else +# define wxUSE_FILEPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_FILEPICKERCTRL) */ + +#ifndef wxUSE_FONTDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FONTDLG must be defined." +# else +# define wxUSE_FONTDLG 0 +# endif +#endif /* !defined(wxUSE_FONTDLG) */ + +#ifndef wxUSE_FONTMAP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FONTMAP must be defined." +# else +# define wxUSE_FONTMAP 0 +# endif +#endif /* !defined(wxUSE_FONTMAP) */ + +#ifndef wxUSE_FONTPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FONTPICKERCTRL must be defined." +# else +# define wxUSE_FONTPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_FONTPICKERCTRL) */ + +#ifndef wxUSE_GAUGE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GAUGE must be defined." +# else +# define wxUSE_GAUGE 0 +# endif +#endif /* !defined(wxUSE_GAUGE) */ + +#ifndef wxUSE_GRAPHICS_CONTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GRAPHICS_CONTEXT must be defined." +# else +# define wxUSE_GRAPHICS_CONTEXT 0 +# endif +#endif /* !defined(wxUSE_GRAPHICS_CONTEXT) */ + + +#ifndef wxUSE_GRID +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GRID must be defined." +# else +# define wxUSE_GRID 0 +# endif +#endif /* !defined(wxUSE_GRID) */ + +#ifndef wxUSE_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP must be defined." +# else +# define wxUSE_HELP 0 +# endif +#endif /* !defined(wxUSE_HELP) */ + +#ifndef wxUSE_HYPERLINKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HYPERLINKCTRL must be defined." +# else +# define wxUSE_HYPERLINKCTRL 0 +# endif +#endif /* !defined(wxUSE_HYPERLINKCTRL) */ + +#ifndef wxUSE_HTML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HTML must be defined." +# else +# define wxUSE_HTML 0 +# endif +#endif /* !defined(wxUSE_HTML) */ + +#ifndef wxUSE_LIBMSPACK +# ifndef __UNIX__ + /* set to 0 on platforms that don't have libmspack */ +# define wxUSE_LIBMSPACK 0 +# else +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBMSPACK must be defined." +# else +# define wxUSE_LIBMSPACK 0 +# endif +# endif +#endif /* !defined(wxUSE_LIBMSPACK) */ + +#ifndef wxUSE_ICO_CUR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ICO_CUR must be defined." +# else +# define wxUSE_ICO_CUR 0 +# endif +#endif /* !defined(wxUSE_ICO_CUR) */ + +#ifndef wxUSE_IFF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IFF must be defined." +# else +# define wxUSE_IFF 0 +# endif +#endif /* !defined(wxUSE_IFF) */ + +#ifndef wxUSE_IMAGLIST +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IMAGLIST must be defined." +# else +# define wxUSE_IMAGLIST 0 +# endif +#endif /* !defined(wxUSE_IMAGLIST) */ + +#ifndef wxUSE_JOYSTICK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_JOYSTICK must be defined." +# else +# define wxUSE_JOYSTICK 0 +# endif +#endif /* !defined(wxUSE_JOYSTICK) */ + +#ifndef wxUSE_LISTBOOK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LISTBOOK must be defined." +# else +# define wxUSE_LISTBOOK 0 +# endif +#endif /* !defined(wxUSE_LISTBOOK) */ + +#ifndef wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LISTBOX must be defined." +# else +# define wxUSE_LISTBOX 0 +# endif +#endif /* !defined(wxUSE_LISTBOX) */ + +#ifndef wxUSE_LISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LISTCTRL must be defined." +# else +# define wxUSE_LISTCTRL 0 +# endif +#endif /* !defined(wxUSE_LISTCTRL) */ + +#ifndef wxUSE_LOGGUI +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOGGUI must be defined." +# else +# define wxUSE_LOGGUI 0 +# endif +#endif /* !defined(wxUSE_LOGGUI) */ + +#ifndef wxUSE_LOGWINDOW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOGWINDOW must be defined." +# else +# define wxUSE_LOGWINDOW 0 +# endif +#endif /* !defined(wxUSE_LOGWINDOW) */ + +#ifndef wxUSE_LOG_DIALOG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOG_DIALOG must be defined." +# else +# define wxUSE_LOG_DIALOG 0 +# endif +#endif /* !defined(wxUSE_LOG_DIALOG) */ + +#ifndef wxUSE_MDI +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MDI must be defined." +# else +# define wxUSE_MDI 0 +# endif +#endif /* !defined(wxUSE_MDI) */ + +#ifndef wxUSE_MDI_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MDI_ARCHITECTURE must be defined." +# else +# define wxUSE_MDI_ARCHITECTURE 0 +# endif +#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */ + +#ifndef wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MENUS must be defined." +# else +# define wxUSE_MENUS 0 +# endif +#endif /* !defined(wxUSE_MENUS) */ + +#ifndef wxUSE_MSGDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MSGDLG must be defined." +# else +# define wxUSE_MSGDLG 0 +# endif +#endif /* !defined(wxUSE_MSGDLG) */ + +#ifndef wxUSE_NOTEBOOK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_NOTEBOOK must be defined." +# else +# define wxUSE_NOTEBOOK 0 +# endif +#endif /* !defined(wxUSE_NOTEBOOK) */ + +#ifndef wxUSE_ODCOMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ODCOMBOBOX must be defined." +# else +# define wxUSE_ODCOMBOBOX 0 +# endif +#endif /* !defined(wxUSE_ODCOMBOBOX) */ + +#ifndef wxUSE_PALETTE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PALETTE must be defined." +# else +# define wxUSE_PALETTE 0 +# endif +#endif /* !defined(wxUSE_PALETTE) */ + +#ifndef wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_POPUPWIN must be defined." +# else +# define wxUSE_POPUPWIN 0 +# endif +#endif /* !defined(wxUSE_POPUPWIN) */ + +#ifndef wxUSE_PRINTING_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PRINTING_ARCHITECTURE must be defined." +# else +# define wxUSE_PRINTING_ARCHITECTURE 0 +# endif +#endif /* !defined(wxUSE_PRINTING_ARCHITECTURE) */ + +#ifndef wxUSE_RADIOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBOX must be defined." +# else +# define wxUSE_RADIOBOX 0 +# endif +#endif /* !defined(wxUSE_RADIOBOX) */ + +#ifndef wxUSE_RADIOBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBTN must be defined." +# else +# define wxUSE_RADIOBTN 0 +# endif +#endif /* !defined(wxUSE_RADIOBTN) */ + +#ifndef wxUSE_SASH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SASH must be defined." +# else +# define wxUSE_SASH 0 +# endif +#endif /* !defined(wxUSE_SASH) */ + +#ifndef wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SCROLLBAR must be defined." +# else +# define wxUSE_SCROLLBAR 0 +# endif +#endif /* !defined(wxUSE_SCROLLBAR) */ + +#ifndef wxUSE_SLIDER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SLIDER must be defined." +# else +# define wxUSE_SLIDER 0 +# endif +#endif /* !defined(wxUSE_SLIDER) */ + +#ifndef wxUSE_SOUND +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SOUND must be defined." +# else +# define wxUSE_SOUND 0 +# endif +#endif /* !defined(wxUSE_SOUND) */ + +#ifndef wxUSE_SPINBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPINBTN must be defined." +# else +# define wxUSE_SPINBTN 0 +# endif +#endif /* !defined(wxUSE_SPINBTN) */ + +#ifndef wxUSE_SPINCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPINCTRL must be defined." +# else +# define wxUSE_SPINCTRL 0 +# endif +#endif /* !defined(wxUSE_SPINCTRL) */ + +#ifndef wxUSE_SPLASH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPLASH must be defined." +# else +# define wxUSE_SPLASH 0 +# endif +#endif /* !defined(wxUSE_SPLASH) */ + +#ifndef wxUSE_SPLITTER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPLITTER must be defined." +# else +# define wxUSE_SPLITTER 0 +# endif +#endif /* !defined(wxUSE_SPLITTER) */ + +#ifndef wxUSE_STATBMP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATBMP must be defined." +# else +# define wxUSE_STATBMP 0 +# endif +#endif /* !defined(wxUSE_STATBMP) */ + +#ifndef wxUSE_STATBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATBOX must be defined." +# else +# define wxUSE_STATBOX 0 +# endif +#endif /* !defined(wxUSE_STATBOX) */ + +#ifndef wxUSE_STATLINE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATLINE must be defined." +# else +# define wxUSE_STATLINE 0 +# endif +#endif /* !defined(wxUSE_STATLINE) */ + +#ifndef wxUSE_STATTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATTEXT must be defined." +# else +# define wxUSE_STATTEXT 0 +# endif +#endif /* !defined(wxUSE_STATTEXT) */ + +#ifndef wxUSE_STATUSBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATUSBAR must be defined." +# else +# define wxUSE_STATUSBAR 0 +# endif +#endif /* !defined(wxUSE_STATUSBAR) */ + +#ifndef wxUSE_TAB_DIALOG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TAB_DIALOG must be defined." +# else +# define wxUSE_TAB_DIALOG 0 +# endif +#endif /* !defined(wxUSE_TAB_DIALOG) */ + +#ifndef wxUSE_TEXTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTCTRL must be defined." +# else +# define wxUSE_TEXTCTRL 0 +# endif +#endif /* !defined(wxUSE_TEXTCTRL) */ + +#ifndef wxUSE_TIPWINDOW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TIPWINDOW must be defined." +# else +# define wxUSE_TIPWINDOW 0 +# endif +#endif /* !defined(wxUSE_TIPWINDOW) */ + +#ifndef wxUSE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLBAR must be defined." +# else +# define wxUSE_TOOLBAR 0 +# endif +#endif /* !defined(wxUSE_TOOLBAR) */ + +#ifndef wxUSE_TOOLTIPS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLTIPS must be defined." +# else +# define wxUSE_TOOLTIPS 0 +# endif +#endif /* !defined(wxUSE_TOOLTIPS) */ + +#ifndef wxUSE_TREECTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TREECTRL must be defined." +# else +# define wxUSE_TREECTRL 0 +# endif +#endif /* !defined(wxUSE_TREECTRL) */ + +#ifndef wxUSE_VALIDATORS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_VALIDATORS must be defined." +# else +# define wxUSE_VALIDATORS 0 +# endif +#endif /* !defined(wxUSE_VALIDATORS) */ + +#ifndef wxUSE_WXHTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WXHTML_HELP must be defined." +# else +# define wxUSE_WXHTML_HELP 0 +# endif +#endif /* !defined(wxUSE_WXHTML_HELP) */ + +#ifndef wxUSE_XRC +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XRC must be defined." +# else +# define wxUSE_XRC 0 +# endif +#endif /* !defined(wxUSE_XRC) */ + +#endif /* wxUSE_GUI */ + +/* + check consistency of the settings + */ + +#if WXWIN_COMPATIBILITY_2_4 +# if !WXWIN_COMPATIBILITY_2_6 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "2.4.X compatibility requires 2.6.X compatibility" +# else +# undef WXWIN_COMPATIBILITY_2_6 +# define WXWIN_COMPATIBILITY_2_6 1 +# endif +# endif +#endif /* WXWIN_COMPATIBILITY_2_4 */ + +#if wxUSE_ARCHIVE_STREAMS +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxArchive requires wxUSE_DATETIME" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 0 +# endif +# endif +#endif /* wxUSE_ARCHIVE_STREAMS */ + +#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" +# else +# undef wxUSE_CRASHREPORT +# define wxUSE_CRASHREPORT 0 +# endif +#endif /* wxUSE_CRASHREPORT */ + +#if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP +# if !wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_XXX requires wxUSE_PROTOCOL" +# else +# undef wxUSE_PROTOCOL +# define wxUSE_PROTOCOL 1 +# endif +# endif +#endif /* wxUSE_PROTOCOL_XXX */ + +#if wxUSE_URL +# if !wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_URL requires wxUSE_PROTOCOL" +# else +# undef wxUSE_PROTOCOL +# define wxUSE_PROTOCOL 1 +# endif +# endif +#endif /* wxUSE_URL */ + +#if wxUSE_PROTOCOL +# if !wxUSE_SOCKETS +# if wxUSE_PROTOCOL_HTTP || wxUSE_PROTOCOL_FTP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_FTP/HTTP requires wxUSE_SOCKETS" +# else +# undef wxUSE_SOCKETS +# define wxUSE_SOCKETS 1 +# endif +# endif +# endif + +# if !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL requires wxUSE_STREAMS" +# else +# undef wxUSE_STREAMS +# define wxUSE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_PROTOCOL */ + +/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */ +#if wxUSE_HTML +# if !wxUSE_FILESYSTEM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxHTML requires wxFileSystem" +# else +# undef wxUSE_FILESYSTEM +# define wxUSE_FILESYSTEM 1 +# endif +# endif +#endif /* wxUSE_HTML */ + +#if wxUSE_FS_ARCHIVE +# if !wxUSE_FILESYSTEM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxArchiveFSHandler requires wxFileSystem" +# else +# undef wxUSE_FILESYSTEM +# define wxUSE_FILESYSTEM 1 +# endif +# endif +# if !wxUSE_ARCHIVE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxArchiveFSHandler requires wxArchive" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_FS_ARCHIVE */ + +#if wxUSE_FILESYSTEM +# if !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILESYSTEM requires wxUSE_STREAMS" +# else +# undef wxUSE_STREAMS +# define wxUSE_STREAMS 1 +# endif +# endif +# if !wxUSE_FILE && !wxUSE_FFILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILESYSTEM requires either wxUSE_FILE or wxUSE_FFILE" +# else +# undef wxUSE_FILE +# define wxUSE_FILE 1 +# undef wxUSE_FFILE +# define wxUSE_FFILE 1 +# endif +# endif +#endif /* wxUSE_FILESYSTEM */ + +#if wxUSE_FS_INET +# if !wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FS_INET requires wxUSE_PROTOCOL" +# else +# undef wxUSE_PROTOCOL +# define wxUSE_PROTOCOL 1 +# endif +# endif +#endif /* wxUSE_FS_INET */ + +#if wxUSE_STOPWATCH || wxUSE_DATETIME +# if !wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STOPWATCH and wxUSE_DATETIME require wxUSE_LONGLONG" +# else +# undef wxUSE_LONGLONG +# define wxUSE_LONGLONG 1 +# endif +# endif +#endif /* wxUSE_STOPWATCH */ + +#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE" +# else +# undef wxUSE_TEXTFILE +# define wxUSE_TEXTFILE 1 +# endif +#endif /* wxUSE_MIMETYPE */ + +#if wxUSE_ODBC +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxODBC requires wxUSE_DATETIME" +# else +# undef wxUSE_ODBC +# define wxUSE_ODBC 0 +# endif +# endif +#endif /* wxUSE_ODBC */ + +#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER" +# else +# undef wxUSE_TEXTBUFFER +# define wxUSE_TEXTBUFFER 1 +# endif +#endif /* wxUSE_TEXTFILE */ + +#if wxUSE_TEXTFILE && !wxUSE_FILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTFILE requires wxUSE_FILE" +# else +# undef wxUSE_FILE +# define wxUSE_FILE 1 +# endif +#endif /* wxUSE_TEXTFILE */ + +#if wxUSE_XML && !wxUSE_WCHAR_T +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XML requires wxUSE_WCHAR_T" +# else +# undef wxUSE_XML +# define wxUSE_XML 0 +# endif +#endif /* wxUSE_XML */ + +#if !wxUSE_DYNLIB_CLASS +# if wxUSE_DYNAMIC_LOADER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DYNAMIC_LOADER requires wxUSE_DYNLIB_CLASS." +# else +# define wxUSE_DYNLIB_CLASS 1 +# endif +# endif +#endif /* wxUSE_DYNLIB_CLASS */ + +#if wxUSE_ZIPSTREAM +# if !wxUSE_ZLIB +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxZip requires wxZlib" +# else +# undef wxUSE_ZLIB +# define wxUSE_ZLIB 1 +# endif +# endif +# if !wxUSE_ARCHIVE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxZip requires wxArchive" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_ZIPSTREAM */ + +#if wxUSE_TARSTREAM + /* wxTar doesn't currently compile without wchar_t */ +# if !wxUSE_WCHAR_T +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTar requires wchar_t" +# else +# undef wxUSE_TARSTREAM +# define wxUSE_TARSTREAM 0 +# endif +# endif +#endif /* wxUSE_TARSTREAM */ + +#if wxUSE_TARSTREAM +# if !wxUSE_ARCHIVE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTar requires wxArchive" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_TARSTREAM */ + +/* the rest of the tests is for the GUI settings only */ +#if wxUSE_GUI + +#if wxUSE_BUTTON || \ + wxUSE_CALENDARCTRL || \ + wxUSE_CARET || \ + wxUSE_COMBOBOX || \ + wxUSE_BMPBUTTON || \ + wxUSE_CHECKBOX || \ + wxUSE_CHECKLISTBOX || \ + wxUSE_CHOICE || \ + wxUSE_GAUGE || \ + wxUSE_GRID || \ + wxUSE_LISTBOX || \ + wxUSE_LISTCTRL || \ + wxUSE_NOTEBOOK || \ + wxUSE_RADIOBOX || \ + wxUSE_RADIOBTN || \ + wxUSE_SCROLLBAR || \ + wxUSE_SLIDER || \ + wxUSE_SPINBTN || \ + wxUSE_SPINCTRL || \ + wxUSE_STATBMP || \ + wxUSE_STATBOX || \ + wxUSE_STATLINE || \ + wxUSE_STATTEXT || \ + wxUSE_STATUSBAR || \ + wxUSE_TEXTCTRL || \ + wxUSE_TOOLBAR || \ + wxUSE_TREECTRL +# if !wxUSE_CONTROLS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CONTROLS unset but some controls used" +# else +# undef wxUSE_CONTROLS +# define wxUSE_CONTROLS 1 +# endif +# endif +#endif /* controls */ + +#if wxUSE_BMPBUTTON +# if !wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_BMPBUTTON */ + +/* + wxUSE_BOOKCTRL should be only used if any of the controls deriving from it + are used + */ +#ifdef wxUSE_BOOKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BOOKCTRL is defined automatically, don't define it" +# else +# undef wxUSE_BOOKCTRL +# endif +#endif + +#define wxUSE_BOOKCTRL (wxUSE_NOTEBOOK || \ + wxUSE_LISTBOOK || \ + wxUSE_CHOICEBOOK || \ + wxUSE_TOOLBOOK || \ + wxUSE_TREEBOOK) + +#if wxUSE_COLLPANE +# if !wxUSE_BUTTON || !wxUSE_STATLINE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLLPANE requires wxUSE_BUTTON and wxUSE_STATLINE" +# else +# undef wxUSE_COLLPANE +# define wxUSE_COLLPANE 0 +# endif +# endif +#endif /* wxUSE_COLLPANE */ + +#if wxUSE_LISTBOOK +# if !wxUSE_LISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxListbook requires wxListCtrl" +# else +# undef wxUSE_LISTCTRL +# define wxUSE_LISTCTRL 1 +# endif +# endif +#endif /* wxUSE_LISTBOOK */ + +#if wxUSE_CHOICEBOOK +# if !wxUSE_CHOICE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxChoicebook requires wxChoice" +# else +# undef wxUSE_CHOICE +# define wxUSE_CHOICE 1 +# endif +# endif +#endif /* wxUSE_CHOICEBOOK */ + +#if wxUSE_TOOLBOOK +# if !wxUSE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxToolbook requires wxToolBar" +# else +# undef wxUSE_TOOLBAR +# define wxUSE_TOOLBAR 1 +# endif +# endif +#endif /* wxUSE_TOOLBOOK */ + +#if !wxUSE_ODCOMBOBOX +# if wxUSE_BITMAPCOMBOBOX +# error "wxBitmapComboBox requires wxOwnerDrawnComboBox" +# else +# undef wxUSE_BITMAPCOMBOBOX +# define wxUSE_BITMAPCOMBOBOX 0 +# endif +#endif /* !wxUSE_ODCOMBOBOX */ + +/* don't attempt to use native status bar on the platforms not having it */ +#ifndef wxUSE_NATIVE_STATUSBAR +# define wxUSE_NATIVE_STATUSBAR 0 +#elif wxUSE_NATIVE_STATUSBAR +# if defined(__WXUNIVERSAL__) || !( defined(__WXMSW__) || \ + defined(__WXMAC__) || \ + defined(__WXPALMOS__) ) +# undef wxUSE_NATIVE_STATUSBAR +# define wxUSE_NATIVE_STATUSBAR 0 +# endif +#endif + +#if wxUSE_GRAPHICS_CONTEXT && !wxUSE_GEOMETRY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GRAPHICS_CONTEXT requires wxUSE_GEOMETRY" +# else +# undef wxUSE_GRAPHICS_CONTEXT +# define wxUSE_GRAPHICS_CONTEXT 0 +# endif +#endif /* wxUSE_GRAPHICS_CONTEXT */ + + +/* wxGTK-specific dependencies */ +#ifdef __WXGTK__ +# ifndef __WXUNIVERSAL__ +# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "MDI requires wxUSE_MENUS in wxGTK" +# else +# undef wxUSE_MENUS +# define wxUSE_MENUS 1 +# endif +# endif +# endif /* !__WXUNIVERSAL__ */ + +# if wxUSE_JOYSTICK +# if !wxUSE_THREADS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxJoystick requires threads in wxGTK" +# else +# undef wxUSE_JOYSTICK +# define wxUSE_JOYSTICK 0 +# endif +# endif +# endif +#endif /* wxGTK && !wxUniv */ + +/* Hopefully we can emulate these dialogs in due course */ +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) +# ifdef wxUSE_COLOURDLG +# undef wxUSE_COLOURDLG +# define wxUSE_COLOURDLG 0 +# endif +#endif /* __SMARTPHONE__ && __WXWINCE__ */ + + +/* generic controls dependencies */ +#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) +# if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG + /* all common controls are needed by these dialogs */ +# if !defined(wxUSE_CHOICE) || \ + !defined(wxUSE_TEXTCTRL) || \ + !defined(wxUSE_BUTTON) || \ + !defined(wxUSE_CHECKBOX) || \ + !defined(wxUSE_STATTEXT) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "These common controls are needed by common dialogs" +# else +# undef wxUSE_CHOICE +# define wxUSE_CHOICE 1 +# undef wxUSE_TEXTCTRL +# define wxUSE_TEXTCTRL 1 +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# undef wxUSE_CHECKBOX +# define wxUSE_CHECKBOX 1 +# undef wxUSE_STATTEXT +# define wxUSE_STATTEXT 1 +# endif +# endif +# endif +#endif /* !wxMSW || wxUniv */ + +/* common dependencies */ +#if wxUSE_CALENDARCTRL +# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxCalendarCtrl requires wxSpinButton and wxComboBox" +# else +# undef wxUSE_SPINBTN +# undef wxUSE_COMBOBOX +# define wxUSE_SPINBTN 1 +# define wxUSE_COMBOBOX 1 +# endif +# endif + +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxCalendarCtrl requires wxUSE_DATETIME" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_CALENDARCTRL */ + +#if wxUSE_DATEPICKCTRL +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDatePickerCtrl requires wxUSE_DATETIME" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_DATEPICKCTRL */ + +#if wxUSE_CHECKLISTBOX +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxCheckListBox requires wxListBox" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_CHECKLISTBOX */ + +#if wxUSE_CHOICEDLG +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Choice dialogs requires wxListBox" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_CHOICEDLG */ + +#if wxUSE_HELP +# if !wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP requires wxUSE_BMPBUTTON" +# else +# undef wxUSE_BMPBUTTON +# define wxUSE_BMPBUTTON 1 +# endif +# endif + +# if !wxUSE_CHOICEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP requires wxUSE_CHOICEDLG" +# else +# undef wxUSE_CHOICEDLG +# define wxUSE_CHOICEDLG 1 +# endif +# endif +#endif /* wxUSE_HELP */ + +#if wxUSE_MS_HTML_HELP + /* + this doesn't make sense for platforms other than MSW but we still + define it in wx/setup_inc.h so don't complain if it happens to be + defined under another platform but just silently fix it. + */ +# ifndef __WXMSW__ +# undef wxUSE_MS_HTML_HELP +# define wxUSE_MS_HTML_HELP 0 +# endif +#endif /* wxUSE_MS_HTML_HELP */ + +#if wxUSE_WXHTML_HELP +# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Built in help controller can't be compiled" +# else +# undef wxUSE_HELP +# define wxUSE_HELP 1 +# undef wxUSE_HTML +# define wxUSE_HTML 1 +# undef wxUSE_COMBOBOX +# define wxUSE_COMBOBOX 1 +# undef wxUSE_NOTEBOOK +# define wxUSE_NOTEBOOK 1 +# undef wxUSE_SPINCTRL +# define wxUSE_SPINCTRL 1 +# endif +# endif +#endif /* wxUSE_WXHTML_HELP */ + +#if !wxUSE_IMAGE +/* + The default wxUSE_IMAGE setting is 1, so if it's set to 0 we assume the + user explicitly wants this and disable all other features that require + wxUSE_IMAGE. + */ +# if wxUSE_DRAGIMAGE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DRAGIMAGE requires wxUSE_IMAGE" +# else +# undef wxUSE_DRAGIMAGE +# define wxUSE_DRAGIMAGE 0 +# endif +# endif + +# if wxUSE_LIBPNG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBPNG requires wxUSE_IMAGE" +# else +# undef wxUSE_LIBPNG +# define wxUSE_LIBPNG 0 +# endif +# endif + +# if wxUSE_LIBJPEG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBJPEG requires wxUSE_IMAGE" +# else +# undef wxUSE_LIBJPEG +# define wxUSE_LIBJPEG 0 +# endif +# endif + +# if wxUSE_LIBTIFF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBTIFF requires wxUSE_IMAGE" +# else +# undef wxUSE_LIBTIFF +# define wxUSE_LIBTIFF 0 +# endif +# endif + +# if wxUSE_GIF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GIF requires wxUSE_IMAGE" +# else +# undef wxUSE_GIF +# define wxUSE_GIF 0 +# endif +# endif + +# if wxUSE_PNM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PNM requires wxUSE_IMAGE" +# else +# undef wxUSE_PNM +# define wxUSE_PNM 0 +# endif +# endif + +# if wxUSE_PCX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PCX requires wxUSE_IMAGE" +# else +# undef wxUSE_PCX +# define wxUSE_PCX 0 +# endif +# endif + +# if wxUSE_IFF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IFF requires wxUSE_IMAGE" +# else +# undef wxUSE_IFF +# define wxUSE_IFF 0 +# endif +# endif + +# if wxUSE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLBAR requires wxUSE_IMAGE" +# else +# undef wxUSE_TOOLBAR +# define wxUSE_TOOLBAR 0 +# endif +# endif + +# if wxUSE_XPM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XPM requires wxUSE_IMAGE" +# else +# undef wxUSE_XPM +# define wxUSE_XPM 0 +# endif +# endif + +#endif /* !wxUSE_IMAGE */ + +#if wxUSE_DOC_VIEW_ARCHITECTURE +# if !wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_MENUS" +# else +# undef wxUSE_MENUS +# define wxUSE_MENUS 1 +# endif +# endif + +# if !wxUSE_CHOICEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_CHOICEDLG" +# else +# undef wxUSE_CHOICEDLG +# define wxUSE_CHOICEDLG 1 +# endif +# endif + +# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM" +# else +# undef wxUSE_STREAMS +# define wxUSE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */ + +#if wxUSE_PRINTING_ARCHITECTURE +# if !wxUSE_COMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Print dialog requires wxUSE_COMBOBOX" +# else +# undef wxUSE_COMBOBOX +# define wxUSE_COMBOBOX 1 +# endif +# endif +#endif /* wxUSE_PRINTING_ARCHITECTURE */ + +#if wxUSE_MDI_ARCHITECTURE +# if !wxUSE_MDI +# ifdef wxABORT_ON_CONFIG_ERROR +# error "MDI requires wxUSE_MDI" +# else +# undef wxUSE_MDI +# define wxUSE_MDI 1 +# endif +# endif + +# if !wxUSE_DOC_VIEW_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MDI_ARCHITECTURE requires wxUSE_DOC_VIEW_ARCHITECTURE" +# else +# undef wxUSE_DOC_VIEW_ARCHITECTURE +# define wxUSE_DOC_VIEW_ARCHITECTURE 1 +# endif +# endif +#endif /* wxUSE_MDI_ARCHITECTURE */ + +#if !wxUSE_FILEDLG +# if wxUSE_DOC_VIEW_ARCHITECTURE || wxUSE_WXHTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILEDLG is required by wxUSE_DOC_VIEW_ARCHITECTURE and wxUSE_WXHTML_HELP!" +# else +# undef wxUSE_FILEDLG +# define wxUSE_FILEDLG 1 +# endif +# endif +#endif /* wxUSE_FILEDLG */ + +#if !wxUSE_GAUGE || !wxUSE_BUTTON +# if wxUSE_PROGRESSDLG && !defined(__WXPALMOS__) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON" +# else +# undef wxUSE_GAUGE +# undef wxUSE_BUTTON +# define wxUSE_GAUGE 1 +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* !wxUSE_GAUGE */ + +#if !wxUSE_BUTTON +# if wxUSE_FONTDLG || \ + wxUSE_FILEDLG || \ + wxUSE_CHOICEDLG || \ + wxUSE_NUMBERDLG || \ + wxUSE_TEXTDLG || \ + wxUSE_DIRDLG || \ + wxUSE_STARTUP_TIPS || \ + wxUSE_WIZARDDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Common and generic dialogs require wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* !wxUSE_BUTTON */ + +#if !wxUSE_TOOLBAR +# if wxUSE_TOOLBAR_NATIVE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLBAR is set to 0 but wxUSE_TOOLBAR_NATIVE is set to 1" +# else +# undef wxUSE_TOOLBAR_NATIVE +# define wxUSE_TOOLBAR_NATIVE 0 +# endif +# endif +#endif + +#if !wxUSE_IMAGLIST +# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxImageList must be compiled as well" +# else +# undef wxUSE_IMAGLIST +# define wxUSE_IMAGLIST 1 +# endif +# endif +#endif /* !wxUSE_IMAGLIST */ + +#if !wxUSE_MSGDLG +# ifdef wxABORT_ON_CONFIG_ERROR + /* FIXME: should compile without it, of course, but doesn't */ +# error "wxMessageBox is always needed" +# else +# undef wxUSE_MSGDLG +# define wxUSE_MSGDLG 1 +# endif +#endif + +#if wxUSE_RADIOBOX +# if !wxUSE_RADIOBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN" +# else +# undef wxUSE_RADIOBTN +# define wxUSE_RADIOBTN 1 +# endif +# endif +# if !wxUSE_STATBOX && !defined(__WXPALMOS__) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBOX requires wxUSE_STATBOX" +# else +# undef wxUSE_STATBOX +# define wxUSE_STATBOX 1 +# endif +# endif +#endif /* wxUSE_RADIOBOX */ + +#if wxUSE_LOGWINDOW +# if !wxUSE_TEXTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOGWINDOW requires wxUSE_TEXTCTRL" +# else +# undef wxUSE_TEXTCTRL +# define wxUSE_TEXTCTRL 1 +# endif +# endif +#endif /* wxUSE_LOGWINDOW */ + +#if wxUSE_LOG_DIALOG +# if !wxUSE_LISTCTRL || !wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON" +# else +# undef wxUSE_LISTCTRL +# define wxUSE_LISTCTRL 1 +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_LOG_DIALOG */ + +#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxClipboard requires wxDataObject" +# else +# undef wxUSE_DATAOBJ +# define wxUSE_DATAOBJ 1 +# endif +#endif /* wxUSE_CLIPBOARD */ + +#if wxUSE_WX_RESOURCES && !wxUSE_PROLOGIO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxr resources require PrologIO" +# else +# undef wxUSE_PROLOGIO +# define wxUSE_PROLOGIO 1 +# endif +#endif /* wxUSE_WX_RESOURCES */ + +#if wxUSE_XRC && !wxUSE_XML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XRC requires wxUSE_XML" +# else +# undef wxUSE_XRC +# define wxUSE_XRC 0 +# endif +#endif /* wxUSE_XRC */ + +#if wxUSE_SOCKETS && !wxUSE_STOPWATCH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SOCKETS requires wxUSE_STOPWATCH" +# else +# undef wxUSE_SOCKETS +# define wxUSE_SOCKETS 0 +# endif +#endif /* wxUSE_SOCKETS */ + +#if !wxUSE_VARIANT +# if wxUSE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDataViewCtrl requires wxVariant" +# else +# undef wxUSE_DATAVIEWCTRL +# define wxUSE_DATAVIEWCTRL 0 +# endif +# endif + +# if wxUSE_ODBC +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ODBC requires wxVariant" +# else +# undef wxUSE_ODBC +# define wxUSE_ODBC 0 +# endif +# endif +#endif /* wxUSE_VARIANT */ + +#endif /* wxUSE_GUI */ diff --git a/Externals/wxWidgets/include/wx/choicdlg.h b/Externals/wxWidgets/include/wx/choicdlg.h index 76867ec675..29cd37867d 100644 --- a/Externals/wxWidgets/include/wx/choicdlg.h +++ b/Externals/wxWidgets/include/wx/choicdlg.h @@ -1,22 +1,22 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/choicdgg.h -// Purpose: Includes generic choice dialog file -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: choicdlg.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICDLG_H_BASE_ -#define _WX_CHOICDLG_H_BASE_ - -#if wxUSE_CHOICEDLG - -#include "wx/generic/choicdgg.h" - -#endif - -#endif - // _WX_CHOICDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/choicdgg.h +// Purpose: Includes generic choice dialog file +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: choicdlg.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICDLG_H_BASE_ +#define _WX_CHOICDLG_H_BASE_ + +#if wxUSE_CHOICEDLG + +#include "wx/generic/choicdgg.h" + +#endif + +#endif + // _WX_CHOICDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/choice.h b/Externals/wxWidgets/include/wx/choice.h index fe2a9fa76a..5c4ebb0cc1 100644 --- a/Externals/wxWidgets/include/wx/choice.h +++ b/Externals/wxWidgets/include/wx/choice.h @@ -1,88 +1,88 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/choice.h -// Purpose: wxChoice class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.07.99 -// RCS-ID: $Id: choice.h 42727 2006-10-30 16:04:27Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICE_H_BASE_ -#define _WX_CHOICE_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_CHOICE - -#include "wx/ctrlsub.h" // the base class - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxChoiceNameStr[]; - -// ---------------------------------------------------------------------------- -// wxChoice allows to select one of a non-modifiable list of strings -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoiceBase : public wxControlWithItems -{ -public: - wxChoiceBase() { } - virtual ~wxChoiceBase(); - - // all generic methods are in wxControlWithItems - - // get the current selection: this can only be different from the normal - // selection if the popup items list is currently opened and the user - // selected some item in it but didn't close the list yet; otherwise (and - // currently always on platforms other than MSW) this is the same as - // GetSelection() - virtual int GetCurrentSelection() const { return GetSelection(); } - - // set/get the number of columns in the control (as they're not supported on - // most platforms, they do nothing by default) - virtual void SetColumns(int WXUNUSED(n) = 1 ) { } - virtual int GetColumns() const { return 1 ; } - - // emulate selecting the item event.GetInt() - void Command(wxCommandEvent& event); - -private: - DECLARE_NO_COPY_CLASS(wxChoiceBase) -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent class definition -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/choice.h" -#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/choicece.h" -#elif defined(__WXMSW__) - #include "wx/msw/choice.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/choice.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/choice.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/choice.h" -#elif defined(__WXMAC__) - #include "wx/mac/choice.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/choice.h" -#elif defined(__WXPM__) - #include "wx/os2/choice.h" -#endif - -#endif // wxUSE_CHOICE - -#endif // _WX_CHOICE_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/choice.h +// Purpose: wxChoice class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 26.07.99 +// RCS-ID: $Id: choice.h 42727 2006-10-30 16:04:27Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_BASE_ +#define _WX_CHOICE_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_CHOICE + +#include "wx/ctrlsub.h" // the base class + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxChoiceNameStr[]; + +// ---------------------------------------------------------------------------- +// wxChoice allows to select one of a non-modifiable list of strings +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxChoiceBase : public wxControlWithItems +{ +public: + wxChoiceBase() { } + virtual ~wxChoiceBase(); + + // all generic methods are in wxControlWithItems + + // get the current selection: this can only be different from the normal + // selection if the popup items list is currently opened and the user + // selected some item in it but didn't close the list yet; otherwise (and + // currently always on platforms other than MSW) this is the same as + // GetSelection() + virtual int GetCurrentSelection() const { return GetSelection(); } + + // set/get the number of columns in the control (as they're not supported on + // most platforms, they do nothing by default) + virtual void SetColumns(int WXUNUSED(n) = 1 ) { } + virtual int GetColumns() const { return 1 ; } + + // emulate selecting the item event.GetInt() + void Command(wxCommandEvent& event); + +private: + DECLARE_NO_COPY_CLASS(wxChoiceBase) +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent class definition +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/choice.h" +#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) + #include "wx/msw/wince/choicece.h" +#elif defined(__WXMSW__) + #include "wx/msw/choice.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/choice.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/choice.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/choice.h" +#elif defined(__WXMAC__) + #include "wx/mac/choice.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/choice.h" +#elif defined(__WXPM__) + #include "wx/os2/choice.h" +#endif + +#endif // wxUSE_CHOICE + +#endif // _WX_CHOICE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/choicebk.h b/Externals/wxWidgets/include/wx/choicebk.h index 391be77e33..d1e6be6967 100644 --- a/Externals/wxWidgets/include/wx/choicebk.h +++ b/Externals/wxWidgets/include/wx/choicebk.h @@ -1,154 +1,154 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/choicebk.h -// Purpose: wxChoicebook: wxChoice and wxNotebook combination -// Author: Vadim Zeitlin -// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h -// Created: 15.09.04 -// RCS-ID: $Id: choicebk.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICEBOOK_H_ -#define _WX_CHOICEBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_CHOICEBOOK - -#include "wx/bookctrl.h" -#include "wx/choice.h" - -class WXDLLIMPEXP_FWD_CORE wxChoice; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING; - -// wxChoicebook flags -#define wxCHB_DEFAULT wxBK_DEFAULT -#define wxCHB_TOP wxBK_TOP -#define wxCHB_BOTTOM wxBK_BOTTOM -#define wxCHB_LEFT wxBK_LEFT -#define wxCHB_RIGHT wxBK_RIGHT -#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK - -// ---------------------------------------------------------------------------- -// wxChoicebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase -{ -public: - wxChoicebook() - { - Init(); - } - - wxChoicebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1); - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual void SetImageList(wxImageList *imageList); - - virtual bool DeleteAllPages(); - - // returns the choice control - wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } - -protected: - virtual wxWindow *DoRemovePage(size_t page); - - // get the size which the choice control should have - virtual wxSize GetControllerSize() const; - - void UpdateSelectedPage(size_t newsel) - { - m_selection = newsel; - GetChoiceCtrl()->Select(newsel); - } - - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); - - // event handlers - void OnChoiceSelected(wxCommandEvent& event); - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - -private: - // common part of all constructors - void Init(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook) -}; - -// ---------------------------------------------------------------------------- -// choicebook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxChoicebookEvent(const wxChoicebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent) -}; - -typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&); - -#define wxChoicebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func) - -#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn)) - -#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn)) - -#endif // wxUSE_CHOICEBOOK - -#endif // _WX_CHOICEBOOK_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/choicebk.h +// Purpose: wxChoicebook: wxChoice and wxNotebook combination +// Author: Vadim Zeitlin +// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h +// Created: 15.09.04 +// RCS-ID: $Id: choicebk.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICEBOOK_H_ +#define _WX_CHOICEBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_CHOICEBOOK + +#include "wx/bookctrl.h" +#include "wx/choice.h" + +class WXDLLIMPEXP_FWD_CORE wxChoice; + +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING; + +// wxChoicebook flags +#define wxCHB_DEFAULT wxBK_DEFAULT +#define wxCHB_TOP wxBK_TOP +#define wxCHB_BOTTOM wxBK_BOTTOM +#define wxCHB_LEFT wxBK_LEFT +#define wxCHB_RIGHT wxBK_RIGHT +#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK + +// ---------------------------------------------------------------------------- +// wxChoicebook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase +{ +public: + wxChoicebook() + { + Init(); + } + + wxChoicebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + virtual int GetSelection() const; + virtual bool SetPageText(size_t n, const wxString& strText); + virtual wxString GetPageText(size_t n) const; + virtual int GetPageImage(size_t n) const; + virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = -1); + virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } + virtual void SetImageList(wxImageList *imageList); + + virtual bool DeleteAllPages(); + + // returns the choice control + wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } + +protected: + virtual wxWindow *DoRemovePage(size_t page); + + // get the size which the choice control should have + virtual wxSize GetControllerSize() const; + + void UpdateSelectedPage(size_t newsel) + { + m_selection = newsel; + GetChoiceCtrl()->Select(newsel); + } + + wxBookCtrlBaseEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlBaseEvent &event); + + // event handlers + void OnChoiceSelected(wxCommandEvent& event); + + // the currently selected page or wxNOT_FOUND if none + int m_selection; + +private: + // common part of all constructors + void Init(); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook) +}; + +// ---------------------------------------------------------------------------- +// choicebook event class and related stuff +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent +{ +public: + wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = -1, int nOldSel = -1) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + + wxChoicebookEvent(const wxChoicebookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent) +}; + +typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&); + +#define wxChoicebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func) + +#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn)) + +#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn)) + +#endif // wxUSE_CHOICEBOOK + +#endif // _WX_CHOICEBOOK_H_ diff --git a/Externals/wxWidgets/include/wx/clipbrd.h b/Externals/wxWidgets/include/wx/clipbrd.h index 11976bec9f..6f6ab4bf96 100644 --- a/Externals/wxWidgets/include/wx/clipbrd.h +++ b/Externals/wxWidgets/include/wx/clipbrd.h @@ -1,145 +1,145 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/clipbrd.h -// Purpose: wxClipboad class and clipboard functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.10.99 -// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLIPBRD_H_BASE_ -#define _WX_CLIPBRD_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CLIPBOARD - - -#include "wx/object.h" -#include "wx/wxchar.h" - -class WXDLLIMPEXP_FWD_CORE wxDataFormat; -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLIMPEXP_FWD_CORE wxClipboard; - -// ---------------------------------------------------------------------------- -// wxClipboard represents the system clipboard. Normally, you should use -// wxTheClipboard which is a global pointer to the (unique) clipboard. -// -// Clipboard can be used to copy data to/paste data from. It works together -// with wxDataObject. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxClipboardBase : public wxObject -{ -public: - wxClipboardBase() {} - - // open the clipboard before Add/SetData() and GetData() - virtual bool Open() = 0; - - // close the clipboard after Add/SetData() and GetData() - virtual void Close() = 0; - - // query whether the clipboard is opened - virtual bool IsOpened() const = 0; - - // add to the clipboard data - // - // NB: the clipboard owns the pointer and will delete it, so data must be - // allocated on the heap - virtual bool AddData( wxDataObject *data ) = 0; - - // set the clipboard data, this is the same as Clear() followed by - // AddData() - virtual bool SetData( wxDataObject *data ) = 0; - - // ask if data in correct format is available - virtual bool IsSupported( const wxDataFormat& format ) = 0; - - // fill data with data on the clipboard (if available) - virtual bool GetData( wxDataObject& data ) = 0; - - // clears wxTheClipboard and the system's clipboard if possible - virtual void Clear() = 0; - - // flushes the clipboard: this means that the data which is currently on - // clipboard will stay available even after the application exits (possibly - // eating memory), otherwise the clipboard will be emptied on exit - virtual bool Flush() { return false; } - - // X11 has two clipboards which get selected by this call. Empty on MSW. - virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } - - // Returns global instance (wxTheClipboard) of the object: - static wxClipboard *Get(); -}; - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -// The global clipboard object - backward compatible access macro: -#define wxTheClipboard (wxClipboard::Get()) - -// ---------------------------------------------------------------------------- -// include platform-specific class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/clipbrd.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/clipbrd.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/clipbrd.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/clipbrd.h" -#elif defined(__WXX11__) - #include "wx/x11/clipbrd.h" -#elif defined(__WXMGL__) - #include "wx/mgl/clipbrd.h" -#elif defined(__WXMAC__) - #include "wx/mac/clipbrd.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/clipbrd.h" -#elif defined(__WXPM__) - #include "wx/os2/clipbrd.h" -#endif - -// ---------------------------------------------------------------------------- -// helpful class for opening the clipboard and automatically closing it -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxClipboardLocker -{ -public: - wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL) - { - m_clipboard = clipboard ? clipboard : wxTheClipboard; - if ( m_clipboard ) - { - m_clipboard->Open(); - } - } - - bool operator!() const { return !m_clipboard->IsOpened(); } - - ~wxClipboardLocker() - { - if ( m_clipboard ) - { - m_clipboard->Close(); - } - } - -private: - wxClipboard *m_clipboard; - - DECLARE_NO_COPY_CLASS(wxClipboardLocker) -}; - -#endif // wxUSE_CLIPBOARD - -#endif // _WX_CLIPBRD_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/clipbrd.h +// Purpose: wxClipboad class and clipboard functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.10.99 +// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_BASE_ +#define _WX_CLIPBRD_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CLIPBOARD + + +#include "wx/object.h" +#include "wx/wxchar.h" + +class WXDLLIMPEXP_FWD_CORE wxDataFormat; +class WXDLLIMPEXP_FWD_CORE wxDataObject; +class WXDLLIMPEXP_FWD_CORE wxClipboard; + +// ---------------------------------------------------------------------------- +// wxClipboard represents the system clipboard. Normally, you should use +// wxTheClipboard which is a global pointer to the (unique) clipboard. +// +// Clipboard can be used to copy data to/paste data from. It works together +// with wxDataObject. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxClipboardBase : public wxObject +{ +public: + wxClipboardBase() {} + + // open the clipboard before Add/SetData() and GetData() + virtual bool Open() = 0; + + // close the clipboard after Add/SetData() and GetData() + virtual void Close() = 0; + + // query whether the clipboard is opened + virtual bool IsOpened() const = 0; + + // add to the clipboard data + // + // NB: the clipboard owns the pointer and will delete it, so data must be + // allocated on the heap + virtual bool AddData( wxDataObject *data ) = 0; + + // set the clipboard data, this is the same as Clear() followed by + // AddData() + virtual bool SetData( wxDataObject *data ) = 0; + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ) = 0; + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ) = 0; + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear() = 0; + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush() { return false; } + + // X11 has two clipboards which get selected by this call. Empty on MSW. + virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } + + // Returns global instance (wxTheClipboard) of the object: + static wxClipboard *Get(); +}; + +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- + +// The global clipboard object - backward compatible access macro: +#define wxTheClipboard (wxClipboard::Get()) + +// ---------------------------------------------------------------------------- +// include platform-specific class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/clipbrd.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/clipbrd.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/clipbrd.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/clipbrd.h" +#elif defined(__WXX11__) + #include "wx/x11/clipbrd.h" +#elif defined(__WXMGL__) + #include "wx/mgl/clipbrd.h" +#elif defined(__WXMAC__) + #include "wx/mac/clipbrd.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/clipbrd.h" +#elif defined(__WXPM__) + #include "wx/os2/clipbrd.h" +#endif + +// ---------------------------------------------------------------------------- +// helpful class for opening the clipboard and automatically closing it +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxClipboardLocker +{ +public: + wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL) + { + m_clipboard = clipboard ? clipboard : wxTheClipboard; + if ( m_clipboard ) + { + m_clipboard->Open(); + } + } + + bool operator!() const { return !m_clipboard->IsOpened(); } + + ~wxClipboardLocker() + { + if ( m_clipboard ) + { + m_clipboard->Close(); + } + } + +private: + wxClipboard *m_clipboard; + + DECLARE_NO_COPY_CLASS(wxClipboardLocker) +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_CLIPBRD_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/clntdata.h b/Externals/wxWidgets/include/wx/clntdata.h index f9704a7d0e..1707ac7648 100644 --- a/Externals/wxWidgets/include/wx/clntdata.h +++ b/Externals/wxWidgets/include/wx/clntdata.h @@ -1,273 +1,273 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/clntdata.h -// Purpose: A mixin class for holding a wxClientData or void pointer -// Author: Robin Dunn -// Modified by: -// Created: 9-Oct-2001 -// RCS-ID: $Id: clntdata.h 36973 2006-01-18 16:45:41Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLNTDATAH__ -#define _WX_CLNTDATAH__ - -#include "wx/defs.h" -#include "wx/string.h" -#include "wx/hashmap.h" - -typedef int (*wxShadowObjectMethod)(void*, void*); -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( - wxShadowObjectMethod, - wxShadowObjectMethods, - class WXDLLIMPEXP_BASE -); -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( - void *, - wxShadowObjectFields, - class WXDLLIMPEXP_BASE -); - -class WXDLLIMPEXP_BASE wxShadowObject -{ -public: - wxShadowObject() { } - - void AddMethod( const wxString &name, wxShadowObjectMethod method ) - { - wxShadowObjectMethods::iterator it = m_methods.find( name ); - if (it == m_methods.end()) - m_methods[ name ] = method; - else - it->second = method; - } - - bool InvokeMethod( const wxString &name, void* window, void* param, int* returnValue ) - { - wxShadowObjectMethods::iterator it = m_methods.find( name ); - if (it == m_methods.end()) - return false; - wxShadowObjectMethod method = it->second; - int ret = (*method)(window, param); - if (returnValue) - *returnValue = ret; - return true; - } - - void AddField( const wxString &name, void* initialValue = NULL ) - { - wxShadowObjectFields::iterator it = m_fields.find( name ); - if (it == m_fields.end()) - m_fields[ name ] = initialValue; - else - it->second = initialValue; - } - - void SetField( const wxString &name, void* value ) - { - wxShadowObjectFields::iterator it = m_fields.find( name ); - if (it == m_fields.end()) - return; - it->second = value; - } - - void* GetField( const wxString &name, void *defaultValue = NULL ) - { - wxShadowObjectFields::iterator it = m_fields.find( name ); - if (it == m_fields.end()) - return defaultValue; - return it->second; - } - -private: - wxShadowObjectMethods m_methods; - wxShadowObjectFields m_fields; -}; - - -// ---------------------------------------------------------------------------- - -// what kind of client data do we have? -enum wxClientDataType -{ - wxClientData_None, // we don't know yet because we don't have it at all - wxClientData_Object, // our client data is typed and we own it - wxClientData_Void // client data is untyped and we don't own it -}; - -class WXDLLIMPEXP_BASE wxClientData -{ -public: - wxClientData() { } - virtual ~wxClientData() { } -}; - -class WXDLLIMPEXP_BASE wxStringClientData : public wxClientData -{ -public: - wxStringClientData() : m_data() { } - wxStringClientData( const wxString &data ) : m_data(data) { } - void SetData( const wxString &data ) { m_data = data; } - const wxString& GetData() const { return m_data; } - -private: - wxString m_data; -}; - -// This class is a mixin that provides storage and management of "client -// data." The client data stored can either be a pointer to a wxClientData -// object in which case it is managed by the container (i.e. it will delete -// the data when it's destroyed) or an untyped pointer which won't be deleted -// by the container - but not both of them -// -// NOTE: This functionality is currently duplicated in wxEvtHandler in order -// to avoid having more than one vtable in that class hierarchy. - -class WXDLLIMPEXP_BASE wxClientDataContainer -{ -public: - wxClientDataContainer(); - virtual ~wxClientDataContainer(); - - void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } - wxClientData *GetClientObject() const { return DoGetClientObject(); } - - void SetClientData( void *data ) { DoSetClientData(data); } - void *GetClientData() const { return DoGetClientData(); } - -protected: - // The user data: either an object which will be deleted by the container - // when it's deleted or some raw pointer which we do nothing with. Only - // one type of data can be used with the given window, i.e. you cannot set - // the void data and then associate the container with wxClientData or vice - // versa. - union - { - wxClientData *m_clientObject; - void *m_clientData; - }; - - // client data accessors - virtual void DoSetClientObject( wxClientData *data ); - virtual wxClientData *DoGetClientObject() const; - - virtual void DoSetClientData( void *data ); - virtual void *DoGetClientData() const; - - // what kind of data do we have? - wxClientDataType m_clientDataType; - -}; - -#include "wx/vector.h" - -struct WXDLLIMPEXP_BASE wxClientDataDictionaryPair -{ - wxClientDataDictionaryPair( size_t idx ) : index( idx ), data( 0 ) { } - - size_t index; - wxClientData* data; -}; - -_WX_DECLARE_VECTOR( - wxClientDataDictionaryPair, - wxClientDataDictionaryPairVector, - WXDLLIMPEXP_BASE -); - -// this class is used internally to maintain the association between items -// of (some subclasses of) wxControlWithItems and their client data -// NOTE: this class does not keep track of whether it contains -// wxClientData or void*. The client must ensure that -// it does not contain a mix of the two, and that -// DestroyData is called if it contains wxClientData -class WXDLLIMPEXP_BASE wxClientDataDictionary -{ -public: - wxClientDataDictionary() {} - - // deletes all the data - void DestroyData() - { - for( size_t i = 0, end = m_vec.size(); i != end; ++i ) - delete m_vec[i].data; - m_vec.clear(); - } - - // if data for the given index is not present, add it, - // if it is present, delete the old data and replace it with - // the new one - void Set( size_t index, wxClientData* data, bool doDelete ) - { - size_t ptr = Find( index ); - - if( !data ) - { - if( ptr == m_vec.size() ) return; - if( doDelete ) - delete m_vec[ptr].data; - m_vec.erase( ptr ); - } - else - { - if( ptr == m_vec.size() ) - { - m_vec.push_back( wxClientDataDictionaryPair( index ) ); - ptr = m_vec.size() - 1; - } - - if( doDelete ) - delete m_vec[ptr].data; - m_vec[ptr].data = data; - } - } - - // get the data associated with the given index, - // return 0 if not found - wxClientData* Get( size_t index ) const - { - size_t it = Find( index ); - if( it == m_vec.size() ) return 0; - return (wxClientData*)m_vec[it].data; // const cast - } - - // delete the data associated with the given index - // it also decreases by one the indices of all the elements - // with an index greater than the given index - void Delete( size_t index, bool doDelete ) - { - size_t todel = m_vec.size(); - - for( size_t i = 0, end = m_vec.size(); i != end; ++i ) - { - if( m_vec[i].index == index ) - todel = i; - else if( m_vec[i].index > index ) - --(m_vec[i].index); - } - - if( todel != m_vec.size() ) - { - if( doDelete ) - delete m_vec[todel].data; - m_vec.erase( todel ); - } - } -private: - // returns MyVec.size() if not found - size_t Find( size_t index ) const - { - for( size_t i = 0, end = m_vec.size(); i != end; ++i ) - { - if( m_vec[i].index == index ) - return i; - } - - return m_vec.size(); - } - - wxClientDataDictionaryPairVector m_vec; -}; - -#endif // _WX_CLNTDATAH__ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/clntdata.h +// Purpose: A mixin class for holding a wxClientData or void pointer +// Author: Robin Dunn +// Modified by: +// Created: 9-Oct-2001 +// RCS-ID: $Id: clntdata.h 36973 2006-01-18 16:45:41Z JS $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLNTDATAH__ +#define _WX_CLNTDATAH__ + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/hashmap.h" + +typedef int (*wxShadowObjectMethod)(void*, void*); +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( + wxShadowObjectMethod, + wxShadowObjectMethods, + class WXDLLIMPEXP_BASE +); +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( + void *, + wxShadowObjectFields, + class WXDLLIMPEXP_BASE +); + +class WXDLLIMPEXP_BASE wxShadowObject +{ +public: + wxShadowObject() { } + + void AddMethod( const wxString &name, wxShadowObjectMethod method ) + { + wxShadowObjectMethods::iterator it = m_methods.find( name ); + if (it == m_methods.end()) + m_methods[ name ] = method; + else + it->second = method; + } + + bool InvokeMethod( const wxString &name, void* window, void* param, int* returnValue ) + { + wxShadowObjectMethods::iterator it = m_methods.find( name ); + if (it == m_methods.end()) + return false; + wxShadowObjectMethod method = it->second; + int ret = (*method)(window, param); + if (returnValue) + *returnValue = ret; + return true; + } + + void AddField( const wxString &name, void* initialValue = NULL ) + { + wxShadowObjectFields::iterator it = m_fields.find( name ); + if (it == m_fields.end()) + m_fields[ name ] = initialValue; + else + it->second = initialValue; + } + + void SetField( const wxString &name, void* value ) + { + wxShadowObjectFields::iterator it = m_fields.find( name ); + if (it == m_fields.end()) + return; + it->second = value; + } + + void* GetField( const wxString &name, void *defaultValue = NULL ) + { + wxShadowObjectFields::iterator it = m_fields.find( name ); + if (it == m_fields.end()) + return defaultValue; + return it->second; + } + +private: + wxShadowObjectMethods m_methods; + wxShadowObjectFields m_fields; +}; + + +// ---------------------------------------------------------------------------- + +// what kind of client data do we have? +enum wxClientDataType +{ + wxClientData_None, // we don't know yet because we don't have it at all + wxClientData_Object, // our client data is typed and we own it + wxClientData_Void // client data is untyped and we don't own it +}; + +class WXDLLIMPEXP_BASE wxClientData +{ +public: + wxClientData() { } + virtual ~wxClientData() { } +}; + +class WXDLLIMPEXP_BASE wxStringClientData : public wxClientData +{ +public: + wxStringClientData() : m_data() { } + wxStringClientData( const wxString &data ) : m_data(data) { } + void SetData( const wxString &data ) { m_data = data; } + const wxString& GetData() const { return m_data; } + +private: + wxString m_data; +}; + +// This class is a mixin that provides storage and management of "client +// data." The client data stored can either be a pointer to a wxClientData +// object in which case it is managed by the container (i.e. it will delete +// the data when it's destroyed) or an untyped pointer which won't be deleted +// by the container - but not both of them +// +// NOTE: This functionality is currently duplicated in wxEvtHandler in order +// to avoid having more than one vtable in that class hierarchy. + +class WXDLLIMPEXP_BASE wxClientDataContainer +{ +public: + wxClientDataContainer(); + virtual ~wxClientDataContainer(); + + void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } + wxClientData *GetClientObject() const { return DoGetClientObject(); } + + void SetClientData( void *data ) { DoSetClientData(data); } + void *GetClientData() const { return DoGetClientData(); } + +protected: + // The user data: either an object which will be deleted by the container + // when it's deleted or some raw pointer which we do nothing with. Only + // one type of data can be used with the given window, i.e. you cannot set + // the void data and then associate the container with wxClientData or vice + // versa. + union + { + wxClientData *m_clientObject; + void *m_clientData; + }; + + // client data accessors + virtual void DoSetClientObject( wxClientData *data ); + virtual wxClientData *DoGetClientObject() const; + + virtual void DoSetClientData( void *data ); + virtual void *DoGetClientData() const; + + // what kind of data do we have? + wxClientDataType m_clientDataType; + +}; + +#include "wx/vector.h" + +struct WXDLLIMPEXP_BASE wxClientDataDictionaryPair +{ + wxClientDataDictionaryPair( size_t idx ) : index( idx ), data( 0 ) { } + + size_t index; + wxClientData* data; +}; + +_WX_DECLARE_VECTOR( + wxClientDataDictionaryPair, + wxClientDataDictionaryPairVector, + WXDLLIMPEXP_BASE +); + +// this class is used internally to maintain the association between items +// of (some subclasses of) wxControlWithItems and their client data +// NOTE: this class does not keep track of whether it contains +// wxClientData or void*. The client must ensure that +// it does not contain a mix of the two, and that +// DestroyData is called if it contains wxClientData +class WXDLLIMPEXP_BASE wxClientDataDictionary +{ +public: + wxClientDataDictionary() {} + + // deletes all the data + void DestroyData() + { + for( size_t i = 0, end = m_vec.size(); i != end; ++i ) + delete m_vec[i].data; + m_vec.clear(); + } + + // if data for the given index is not present, add it, + // if it is present, delete the old data and replace it with + // the new one + void Set( size_t index, wxClientData* data, bool doDelete ) + { + size_t ptr = Find( index ); + + if( !data ) + { + if( ptr == m_vec.size() ) return; + if( doDelete ) + delete m_vec[ptr].data; + m_vec.erase( ptr ); + } + else + { + if( ptr == m_vec.size() ) + { + m_vec.push_back( wxClientDataDictionaryPair( index ) ); + ptr = m_vec.size() - 1; + } + + if( doDelete ) + delete m_vec[ptr].data; + m_vec[ptr].data = data; + } + } + + // get the data associated with the given index, + // return 0 if not found + wxClientData* Get( size_t index ) const + { + size_t it = Find( index ); + if( it == m_vec.size() ) return 0; + return (wxClientData*)m_vec[it].data; // const cast + } + + // delete the data associated with the given index + // it also decreases by one the indices of all the elements + // with an index greater than the given index + void Delete( size_t index, bool doDelete ) + { + size_t todel = m_vec.size(); + + for( size_t i = 0, end = m_vec.size(); i != end; ++i ) + { + if( m_vec[i].index == index ) + todel = i; + else if( m_vec[i].index > index ) + --(m_vec[i].index); + } + + if( todel != m_vec.size() ) + { + if( doDelete ) + delete m_vec[todel].data; + m_vec.erase( todel ); + } + } +private: + // returns MyVec.size() if not found + size_t Find( size_t index ) const + { + for( size_t i = 0, end = m_vec.size(); i != end; ++i ) + { + if( m_vec[i].index == index ) + return i; + } + + return m_vec.size(); + } + + wxClientDataDictionaryPairVector m_vec; +}; + +#endif // _WX_CLNTDATAH__ + diff --git a/Externals/wxWidgets/include/wx/clrpicker.h b/Externals/wxWidgets/include/wx/clrpicker.h index f6a436fc3a..1dd2c4b3d0 100644 --- a/Externals/wxWidgets/include/wx/clrpicker.h +++ b/Externals/wxWidgets/include/wx/clrpicker.h @@ -1,200 +1,200 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/clrpicker.h -// Purpose: wxColourPickerCtrl base header -// Author: Francesco Montorsi (based on Vadim Zeitlin's code) -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: clrpicker.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLRPICKER_H_BASE_ -#define _WX_CLRPICKER_H_BASE_ - -#include "wx/defs.h" - - -#if wxUSE_COLOURPICKERCTRL - -#include "wx/pickerbase.h" - - -class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent; - -extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[]; - - -// ---------------------------------------------------------------------------- -// wxColourPickerWidgetBase: a generic abstract interface which must be -// implemented by controls used by wxColourPickerCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxColourPickerWidgetBase -{ -public: - wxColourPickerWidgetBase() { m_colour = *wxBLACK; } - virtual ~wxColourPickerWidgetBase() {} - - wxColour GetColour() const - { return m_colour; } - virtual void SetColour(const wxColour &col) - { m_colour = col; UpdateColour(); } - virtual void SetColour(const wxString &col) - { m_colour.Set(col); UpdateColour(); } - -protected: - - virtual void UpdateColour() = 0; - - // the current colour (may be invalid if none) - wxColour m_colour; -}; - - -// Styles which must be supported by all controls implementing wxColourPickerWidgetBase -// NB: these styles must be defined to carefully-chosen values to -// avoid conflicts with wxButton's styles - -// show the colour in HTML form (#AABBCC) as colour button label -// (instead of no label at all) -// NOTE: this style is supported just by wxColourButtonGeneric and -// thus is not exposed in wxColourPickerCtrl -#define wxCLRP_SHOW_LABEL 0x0008 - -// map platform-dependent controls which implement the wxColourPickerWidgetBase -// under the name "wxColourPickerWidget". -// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the -// fact that all classes being mapped as wxColourPickerWidget have the -// same prototype for their contructor (and also explains why we use -// define instead of a typedef) -// since GTK > 2.4, there is GtkColorButton -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/clrpicker.h" - #define wxColourPickerWidget wxColourButton -#else - #include "wx/generic/clrpickerg.h" - #define wxColourPickerWidget wxGenericColourButton -#endif - - -// ---------------------------------------------------------------------------- -// wxColourPickerCtrl: platform-independent class which embeds a -// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is -// used, a textctrl next to it. -// ---------------------------------------------------------------------------- - -#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) -#define wxCLRP_DEFAULT_STYLE 0 - -class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase -{ -public: - wxColourPickerCtrl() : m_bIgnoreNextTextCtrlUpdate(false) {} - virtual ~wxColourPickerCtrl() {} - - - wxColourPickerCtrl(wxWindow *parent, wxWindowID id, - const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerCtrlNameStr) - : m_bIgnoreNextTextCtrlUpdate(false) - { Create(parent, id, col, pos, size, style, validator, name); } - - bool Create(wxWindow *parent, wxWindowID id, - const wxColour& col = *wxBLACK, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCLRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerCtrlNameStr); - - -public: // public API - - // get the colour chosen - wxColour GetColour() const - { return ((wxColourPickerWidget *)m_picker)->GetColour(); } - - // set currently displayed color - void SetColour(const wxColour& col); - - // set colour using RGB(r,g,b) syntax or considering given text as a colour name; - // returns true if the given text was successfully recognized. - bool SetColour(const wxString& text); - - -public: // internal functions - - // update the button colour to match the text control contents - void UpdatePickerFromTextCtrl(); - - // update the text control to match the button's colour - void UpdateTextCtrlFromPicker(); - - // event handler for our picker - void OnColourChange(wxColourPickerEvent &); - -protected: - virtual long GetPickerStyle(long style) const - { return (style & wxCLRP_SHOW_LABEL); } - - // true if the next UpdateTextCtrl() call is to ignore - bool m_bIgnoreNextTextCtrlUpdate; - -private: - DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl) -}; - - -// ---------------------------------------------------------------------------- -// wxColourPickerEvent: used by wxColourPickerCtrl only -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, 1102) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent -{ -public: - wxColourPickerEvent() {} - wxColourPickerEvent(wxObject *generator, int id, const wxColour &col) - : wxCommandEvent(wxEVT_COMMAND_COLOURPICKER_CHANGED, id), - m_colour(col) - { - SetEventObject(generator); - } - - wxColour GetColour() const { return m_colour; } - void SetColour(const wxColour &c) { m_colour = c; } - - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); } - -private: - wxColour m_colour; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&); - -#define wxColourPickerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxColourPickerEventFunction, &func) - -#define EVT_COLOURPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn)) - - -#endif // wxUSE_COLOURPICKERCTRL - -#endif // _WX_CLRPICKER_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/clrpicker.h +// Purpose: wxColourPickerCtrl base header +// Author: Francesco Montorsi (based on Vadim Zeitlin's code) +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Vadim Zeitlin, Francesco Montorsi +// RCS-ID: $Id: clrpicker.h 53135 2008-04-12 02:31:04Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLRPICKER_H_BASE_ +#define _WX_CLRPICKER_H_BASE_ + +#include "wx/defs.h" + + +#if wxUSE_COLOURPICKERCTRL + +#include "wx/pickerbase.h" + + +class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent; + +extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxColourPickerWidgetBase: a generic abstract interface which must be +// implemented by controls used by wxColourPickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColourPickerWidgetBase +{ +public: + wxColourPickerWidgetBase() { m_colour = *wxBLACK; } + virtual ~wxColourPickerWidgetBase() {} + + wxColour GetColour() const + { return m_colour; } + virtual void SetColour(const wxColour &col) + { m_colour = col; UpdateColour(); } + virtual void SetColour(const wxString &col) + { m_colour.Set(col); UpdateColour(); } + +protected: + + virtual void UpdateColour() = 0; + + // the current colour (may be invalid if none) + wxColour m_colour; +}; + + +// Styles which must be supported by all controls implementing wxColourPickerWidgetBase +// NB: these styles must be defined to carefully-chosen values to +// avoid conflicts with wxButton's styles + +// show the colour in HTML form (#AABBCC) as colour button label +// (instead of no label at all) +// NOTE: this style is supported just by wxColourButtonGeneric and +// thus is not exposed in wxColourPickerCtrl +#define wxCLRP_SHOW_LABEL 0x0008 + +// map platform-dependent controls which implement the wxColourPickerWidgetBase +// under the name "wxColourPickerWidget". +// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the +// fact that all classes being mapped as wxColourPickerWidget have the +// same prototype for their contructor (and also explains why we use +// define instead of a typedef) +// since GTK > 2.4, there is GtkColorButton +#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/clrpicker.h" + #define wxColourPickerWidget wxColourButton +#else + #include "wx/generic/clrpickerg.h" + #define wxColourPickerWidget wxGenericColourButton +#endif + + +// ---------------------------------------------------------------------------- +// wxColourPickerCtrl: platform-independent class which embeds a +// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is +// used, a textctrl next to it. +// ---------------------------------------------------------------------------- + +#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) +#define wxCLRP_DEFAULT_STYLE 0 + +class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase +{ +public: + wxColourPickerCtrl() : m_bIgnoreNextTextCtrlUpdate(false) {} + virtual ~wxColourPickerCtrl() {} + + + wxColourPickerCtrl(wxWindow *parent, wxWindowID id, + const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxColourPickerCtrlNameStr) + : m_bIgnoreNextTextCtrlUpdate(false) + { Create(parent, id, col, pos, size, style, validator, name); } + + bool Create(wxWindow *parent, wxWindowID id, + const wxColour& col = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxColourPickerCtrlNameStr); + + +public: // public API + + // get the colour chosen + wxColour GetColour() const + { return ((wxColourPickerWidget *)m_picker)->GetColour(); } + + // set currently displayed color + void SetColour(const wxColour& col); + + // set colour using RGB(r,g,b) syntax or considering given text as a colour name; + // returns true if the given text was successfully recognized. + bool SetColour(const wxString& text); + + +public: // internal functions + + // update the button colour to match the text control contents + void UpdatePickerFromTextCtrl(); + + // update the text control to match the button's colour + void UpdateTextCtrlFromPicker(); + + // event handler for our picker + void OnColourChange(wxColourPickerEvent &); + +protected: + virtual long GetPickerStyle(long style) const + { return (style & wxCLRP_SHOW_LABEL); } + + // true if the next UpdateTextCtrl() call is to ignore + bool m_bIgnoreNextTextCtrlUpdate; + +private: + DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl) +}; + + +// ---------------------------------------------------------------------------- +// wxColourPickerEvent: used by wxColourPickerCtrl only +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, 1102) +END_DECLARE_EVENT_TYPES() + +class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent +{ +public: + wxColourPickerEvent() {} + wxColourPickerEvent(wxObject *generator, int id, const wxColour &col) + : wxCommandEvent(wxEVT_COMMAND_COLOURPICKER_CHANGED, id), + m_colour(col) + { + SetEventObject(generator); + } + + wxColour GetColour() const { return m_colour; } + void SetColour(const wxColour &c) { m_colour = c; } + + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); } + +private: + wxColour m_colour; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent) +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&); + +#define wxColourPickerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxColourPickerEventFunction, &func) + +#define EVT_COLOURPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn)) + + +#endif // wxUSE_COLOURPICKERCTRL + +#endif // _WX_CLRPICKER_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/cmdline.h b/Externals/wxWidgets/include/wx/cmdline.h index 9f6e6080b7..50a17ce7a7 100644 --- a/Externals/wxWidgets/include/wx/cmdline.h +++ b/Externals/wxWidgets/include/wx/cmdline.h @@ -1,239 +1,239 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cmdline.h -// Purpose: wxCmdLineParser and related classes for parsing the command -// line options -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.01.00 -// RCS-ID: $Id: cmdline.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMDLINE_H_ -#define _WX_CMDLINE_H_ - -#include "wx/defs.h" - -#include "wx/string.h" -#include "wx/arrstr.h" - -#if wxUSE_CMDLINE_PARSER - -class WXDLLIMPEXP_FWD_BASE wxDateTime; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// by default, options are optional (sic) and each call to AddParam() allows -// one more parameter - this may be changed by giving non-default flags to it -enum -{ - wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given - wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted - wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated - wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request - wxCMD_LINE_NEEDS_SEPARATOR = 0x10 // must have sep before the value -}; - -// an option value or parameter may be a string (the most common case), a -// number or a date -enum wxCmdLineParamType -{ - wxCMD_LINE_VAL_STRING, // should be 0 (default) - wxCMD_LINE_VAL_NUMBER, - wxCMD_LINE_VAL_DATE, - wxCMD_LINE_VAL_NONE -}; - -// for constructing the cmd line description using Init() -enum wxCmdLineEntryType -{ - wxCMD_LINE_SWITCH, - wxCMD_LINE_OPTION, - wxCMD_LINE_PARAM, - wxCMD_LINE_NONE // to terminate the list -}; - -// ---------------------------------------------------------------------------- -// wxCmdLineEntryDesc is a description of one command line -// switch/option/parameter -// ---------------------------------------------------------------------------- - -struct wxCmdLineEntryDesc -{ - wxCmdLineEntryType kind; - const wxChar *shortName; - const wxChar *longName; - const wxChar *description; - wxCmdLineParamType type; - int flags; -}; - -// ---------------------------------------------------------------------------- -// wxCmdLineParser is a class for parsing command line. -// -// It has the following features: -// -// 1. distinguishes options, switches and parameters; allows option grouping -// 2. allows both short and long options -// 3. automatically generates the usage message from the cmd line description -// 4. does type checks on the options values (number, date, ...) -// -// To use it you should: -// -// 1. construct it giving it the cmd line to parse and optionally its desc -// 2. construct the cmd line description using AddXXX() if not done in (1) -// 3. call Parse() -// 4. use GetXXX() to retrieve the parsed info -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxCmdLineParser -{ -public: - // ctors and initializers - // ---------------------- - - // default ctor or ctor giving the cmd line in either Unix or Win form - wxCmdLineParser() { Init(); } - wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); } -#if wxUSE_UNICODE - wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); } -#endif // wxUSE_UNICODE - wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); } - - // the same as above, but also gives the cmd line description - otherwise, - // use AddXXX() later - wxCmdLineParser(const wxCmdLineEntryDesc *desc) - { Init(); SetDesc(desc); } - wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, char **argv) - { Init(); SetCmdLine(argc, argv); SetDesc(desc); } -#if wxUSE_UNICODE - wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv) - { Init(); SetCmdLine(argc, argv); SetDesc(desc); } -#endif // wxUSE_UNICODE - wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline) - { Init(); SetCmdLine(cmdline); SetDesc(desc); } - - // set cmd line to parse after using one of the ctors which don't do it - void SetCmdLine(int argc, char **argv); -#if wxUSE_UNICODE - void SetCmdLine(int argc, wxChar **argv); -#endif // wxUSE_UNICODE - void SetCmdLine(const wxString& cmdline); - - // not virtual, don't use this class polymorphically - ~wxCmdLineParser(); - - // set different parser options - // ---------------------------- - - // by default, '-' is switch char under Unix, '-' or '/' under Win: - // switchChars contains all characters with which an option or switch may - // start - void SetSwitchChars(const wxString& switchChars); - - // long options are not POSIX-compliant, this option allows to disable them - void EnableLongOptions(bool enable = true); - void DisableLongOptions() { EnableLongOptions(false); } - - bool AreLongOptionsEnabled(); - - // extra text may be shown by Usage() method if set by this function - void SetLogo(const wxString& logo); - - // construct the cmd line description - // ---------------------------------- - - // take the cmd line description from the wxCMD_LINE_NONE terminated table - void SetDesc(const wxCmdLineEntryDesc *desc); - - // a switch: i.e. an option without value - void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString, - const wxString& desc = wxEmptyString, - int flags = 0); - - // an option taking a value of the given type - void AddOption(const wxString& name, const wxString& lng = wxEmptyString, - const wxString& desc = wxEmptyString, - wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, - int flags = 0); - - // a parameter - void AddParam(const wxString& desc = wxEmptyString, - wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, - int flags = 0); - - // actions - // ------- - - // parse the command line, return 0 if ok, -1 if "-h" or "--help" option - // was encountered and the help message was given or a positive value if a - // syntax error occurred - // - // if showUsage is true, Usage() is called in case of syntax error or if - // help was requested - int Parse(bool showUsage = true); - - // give the usage message describing all program options - void Usage(); - - // get the command line arguments - // ------------------------------ - - // returns true if the given switch was found - bool Found(const wxString& name) const; - - // returns true if an option taking a string value was found and stores the - // value in the provided pointer - bool Found(const wxString& name, wxString *value) const; - - // returns true if an option taking an integer value was found and stores - // the value in the provided pointer - bool Found(const wxString& name, long *value) const; - -#if wxUSE_DATETIME - // returns true if an option taking a date value was found and stores the - // value in the provided pointer - bool Found(const wxString& name, wxDateTime *value) const; -#endif // wxUSE_DATETIME - - // gets the number of parameters found - size_t GetParamCount() const; - - // gets the value of Nth parameter (as string only for now) - wxString GetParam(size_t n = 0u) const; - - // Resets switches and options - void Reset(); - - // break down the command line in arguments - static wxArrayString ConvertStringToArgs(const wxChar *cmdline); - -private: - // get usage string - wxString GetUsageString(); - - // common part of all ctors - void Init(); - - struct wxCmdLineParserData *m_data; - - DECLARE_NO_COPY_CLASS(wxCmdLineParser) -}; - -#else // !wxUSE_CMDLINE_PARSER - -// this function is always available (even if !wxUSE_CMDLINE_PARSER) because it -// is used by wxWin itself under Windows -class WXDLLIMPEXP_BASE wxCmdLineParser -{ -public: - static wxArrayString ConvertStringToArgs(const wxChar *cmdline); -}; - -#endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER - -#endif // _WX_CMDLINE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/cmdline.h +// Purpose: wxCmdLineParser and related classes for parsing the command +// line options +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.01.00 +// RCS-ID: $Id: cmdline.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CMDLINE_H_ +#define _WX_CMDLINE_H_ + +#include "wx/defs.h" + +#include "wx/string.h" +#include "wx/arrstr.h" + +#if wxUSE_CMDLINE_PARSER + +class WXDLLIMPEXP_FWD_BASE wxDateTime; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// by default, options are optional (sic) and each call to AddParam() allows +// one more parameter - this may be changed by giving non-default flags to it +enum +{ + wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given + wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted + wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated + wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request + wxCMD_LINE_NEEDS_SEPARATOR = 0x10 // must have sep before the value +}; + +// an option value or parameter may be a string (the most common case), a +// number or a date +enum wxCmdLineParamType +{ + wxCMD_LINE_VAL_STRING, // should be 0 (default) + wxCMD_LINE_VAL_NUMBER, + wxCMD_LINE_VAL_DATE, + wxCMD_LINE_VAL_NONE +}; + +// for constructing the cmd line description using Init() +enum wxCmdLineEntryType +{ + wxCMD_LINE_SWITCH, + wxCMD_LINE_OPTION, + wxCMD_LINE_PARAM, + wxCMD_LINE_NONE // to terminate the list +}; + +// ---------------------------------------------------------------------------- +// wxCmdLineEntryDesc is a description of one command line +// switch/option/parameter +// ---------------------------------------------------------------------------- + +struct wxCmdLineEntryDesc +{ + wxCmdLineEntryType kind; + const wxChar *shortName; + const wxChar *longName; + const wxChar *description; + wxCmdLineParamType type; + int flags; +}; + +// ---------------------------------------------------------------------------- +// wxCmdLineParser is a class for parsing command line. +// +// It has the following features: +// +// 1. distinguishes options, switches and parameters; allows option grouping +// 2. allows both short and long options +// 3. automatically generates the usage message from the cmd line description +// 4. does type checks on the options values (number, date, ...) +// +// To use it you should: +// +// 1. construct it giving it the cmd line to parse and optionally its desc +// 2. construct the cmd line description using AddXXX() if not done in (1) +// 3. call Parse() +// 4. use GetXXX() to retrieve the parsed info +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCmdLineParser +{ +public: + // ctors and initializers + // ---------------------- + + // default ctor or ctor giving the cmd line in either Unix or Win form + wxCmdLineParser() { Init(); } + wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); } +#if wxUSE_UNICODE + wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); } +#endif // wxUSE_UNICODE + wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); } + + // the same as above, but also gives the cmd line description - otherwise, + // use AddXXX() later + wxCmdLineParser(const wxCmdLineEntryDesc *desc) + { Init(); SetDesc(desc); } + wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, char **argv) + { Init(); SetCmdLine(argc, argv); SetDesc(desc); } +#if wxUSE_UNICODE + wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv) + { Init(); SetCmdLine(argc, argv); SetDesc(desc); } +#endif // wxUSE_UNICODE + wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline) + { Init(); SetCmdLine(cmdline); SetDesc(desc); } + + // set cmd line to parse after using one of the ctors which don't do it + void SetCmdLine(int argc, char **argv); +#if wxUSE_UNICODE + void SetCmdLine(int argc, wxChar **argv); +#endif // wxUSE_UNICODE + void SetCmdLine(const wxString& cmdline); + + // not virtual, don't use this class polymorphically + ~wxCmdLineParser(); + + // set different parser options + // ---------------------------- + + // by default, '-' is switch char under Unix, '-' or '/' under Win: + // switchChars contains all characters with which an option or switch may + // start + void SetSwitchChars(const wxString& switchChars); + + // long options are not POSIX-compliant, this option allows to disable them + void EnableLongOptions(bool enable = true); + void DisableLongOptions() { EnableLongOptions(false); } + + bool AreLongOptionsEnabled(); + + // extra text may be shown by Usage() method if set by this function + void SetLogo(const wxString& logo); + + // construct the cmd line description + // ---------------------------------- + + // take the cmd line description from the wxCMD_LINE_NONE terminated table + void SetDesc(const wxCmdLineEntryDesc *desc); + + // a switch: i.e. an option without value + void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString, + const wxString& desc = wxEmptyString, + int flags = 0); + + // an option taking a value of the given type + void AddOption(const wxString& name, const wxString& lng = wxEmptyString, + const wxString& desc = wxEmptyString, + wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, + int flags = 0); + + // a parameter + void AddParam(const wxString& desc = wxEmptyString, + wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, + int flags = 0); + + // actions + // ------- + + // parse the command line, return 0 if ok, -1 if "-h" or "--help" option + // was encountered and the help message was given or a positive value if a + // syntax error occurred + // + // if showUsage is true, Usage() is called in case of syntax error or if + // help was requested + int Parse(bool showUsage = true); + + // give the usage message describing all program options + void Usage(); + + // get the command line arguments + // ------------------------------ + + // returns true if the given switch was found + bool Found(const wxString& name) const; + + // returns true if an option taking a string value was found and stores the + // value in the provided pointer + bool Found(const wxString& name, wxString *value) const; + + // returns true if an option taking an integer value was found and stores + // the value in the provided pointer + bool Found(const wxString& name, long *value) const; + +#if wxUSE_DATETIME + // returns true if an option taking a date value was found and stores the + // value in the provided pointer + bool Found(const wxString& name, wxDateTime *value) const; +#endif // wxUSE_DATETIME + + // gets the number of parameters found + size_t GetParamCount() const; + + // gets the value of Nth parameter (as string only for now) + wxString GetParam(size_t n = 0u) const; + + // Resets switches and options + void Reset(); + + // break down the command line in arguments + static wxArrayString ConvertStringToArgs(const wxChar *cmdline); + +private: + // get usage string + wxString GetUsageString(); + + // common part of all ctors + void Init(); + + struct wxCmdLineParserData *m_data; + + DECLARE_NO_COPY_CLASS(wxCmdLineParser) +}; + +#else // !wxUSE_CMDLINE_PARSER + +// this function is always available (even if !wxUSE_CMDLINE_PARSER) because it +// is used by wxWin itself under Windows +class WXDLLIMPEXP_BASE wxCmdLineParser +{ +public: + static wxArrayString ConvertStringToArgs(const wxChar *cmdline); +}; + +#endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER + +#endif // _WX_CMDLINE_H_ + diff --git a/Externals/wxWidgets/include/wx/cmdproc.h b/Externals/wxWidgets/include/wx/cmdproc.h index 930cad7534..0b101a14aa 100644 --- a/Externals/wxWidgets/include/wx/cmdproc.h +++ b/Externals/wxWidgets/include/wx/cmdproc.h @@ -1,144 +1,144 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cmdproc.h -// Purpose: undo/redo capable command processing framework -// Author: Julian Smart (extracted from docview.h by VZ) -// Modified by: -// Created: 05.11.00 -// RCS-ID: $Id: cmdproc.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMDPROC_H_ -#define _WX_CMDPROC_H_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/list.h" - -class WXDLLIMPEXP_FWD_CORE wxMenu; - -// ---------------------------------------------------------------------------- -// wxCommand: a single command capable of performing itself -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCommand : public wxObject -{ -public: - wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString); - virtual ~wxCommand(){} - - // Override this to perform a command - virtual bool Do() = 0; - - // Override this to undo a command - virtual bool Undo() = 0; - - virtual bool CanUndo() const { return m_canUndo; } - virtual wxString GetName() const { return m_commandName; } - -protected: - bool m_canUndo; - wxString m_commandName; - -private: - DECLARE_CLASS(wxCommand) -}; - -// ---------------------------------------------------------------------------- -// wxCommandProcessor: wxCommand manager -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCommandProcessor : public wxObject -{ -public: - // if max number of commands is -1, it is unlimited - wxCommandProcessor(int maxCommands = -1); - virtual ~wxCommandProcessor(); - - // Pass a command to the processor. The processor calls Do(); if - // successful, is appended to the command history unless storeIt is false. - virtual bool Submit(wxCommand *command, bool storeIt = true); - - // just store the command without executing it - virtual void Store(wxCommand *command); - - virtual bool Undo(); - virtual bool Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Initialises the current command and menu strings. - virtual void Initialize(); - - // Sets the Undo/Redo menu strings for the current menu. - virtual void SetMenuStrings(); - - // Gets the current Undo menu label. - wxString GetUndoMenuLabel() const; - - // Gets the current Undo menu label. - wxString GetRedoMenuLabel() const; - -#if wxUSE_MENUS - // Call this to manage an edit menu. - void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; } - wxMenu *GetEditMenu() const { return m_commandEditMenu; } -#endif // wxUSE_MENUS - - // command list access - wxList& GetCommands() { return m_commands; } - const wxList& GetCommands() const { return m_commands; } - wxCommand *GetCurrentCommand() const - { - return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL); - } - int GetMaxCommands() const { return m_maxNoCommands; } - virtual void ClearCommands(); - - // Has the current project been changed? - virtual bool IsDirty() const - { - return m_currentCommand && (m_lastSavedCommand != m_currentCommand); - } - - // Mark the current command as the one where the last save took place - void MarkAsSaved() - { - m_lastSavedCommand = m_currentCommand; - } - - - // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y" - const wxString& GetUndoAccelerator() const { return m_undoAccelerator; } - const wxString& GetRedoAccelerator() const { return m_redoAccelerator; } - - void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; } - void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; } - -protected: - // for further flexibility, command processor doesn't call wxCommand::Do() - // and Undo() directly but uses these functions which can be overridden in - // the derived class - virtual bool DoCommand(wxCommand& cmd); - virtual bool UndoCommand(wxCommand& cmd); - - int m_maxNoCommands; - wxList m_commands; - wxList::compatibility_iterator m_currentCommand, - m_lastSavedCommand; - -#if wxUSE_MENUS - wxMenu* m_commandEditMenu; -#endif // wxUSE_MENUS - - wxString m_undoAccelerator; - wxString m_redoAccelerator; - -private: - DECLARE_DYNAMIC_CLASS(wxCommandProcessor) - DECLARE_NO_COPY_CLASS(wxCommandProcessor) -}; - -#endif // _WX_CMDPROC_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/cmdproc.h +// Purpose: undo/redo capable command processing framework +// Author: Julian Smart (extracted from docview.h by VZ) +// Modified by: +// Created: 05.11.00 +// RCS-ID: $Id: cmdproc.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CMDPROC_H_ +#define _WX_CMDPROC_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxMenu; + +// ---------------------------------------------------------------------------- +// wxCommand: a single command capable of performing itself +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCommand : public wxObject +{ +public: + wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString); + virtual ~wxCommand(){} + + // Override this to perform a command + virtual bool Do() = 0; + + // Override this to undo a command + virtual bool Undo() = 0; + + virtual bool CanUndo() const { return m_canUndo; } + virtual wxString GetName() const { return m_commandName; } + +protected: + bool m_canUndo; + wxString m_commandName; + +private: + DECLARE_CLASS(wxCommand) +}; + +// ---------------------------------------------------------------------------- +// wxCommandProcessor: wxCommand manager +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCommandProcessor : public wxObject +{ +public: + // if max number of commands is -1, it is unlimited + wxCommandProcessor(int maxCommands = -1); + virtual ~wxCommandProcessor(); + + // Pass a command to the processor. The processor calls Do(); if + // successful, is appended to the command history unless storeIt is false. + virtual bool Submit(wxCommand *command, bool storeIt = true); + + // just store the command without executing it + virtual void Store(wxCommand *command); + + virtual bool Undo(); + virtual bool Redo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Initialises the current command and menu strings. + virtual void Initialize(); + + // Sets the Undo/Redo menu strings for the current menu. + virtual void SetMenuStrings(); + + // Gets the current Undo menu label. + wxString GetUndoMenuLabel() const; + + // Gets the current Undo menu label. + wxString GetRedoMenuLabel() const; + +#if wxUSE_MENUS + // Call this to manage an edit menu. + void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; } + wxMenu *GetEditMenu() const { return m_commandEditMenu; } +#endif // wxUSE_MENUS + + // command list access + wxList& GetCommands() { return m_commands; } + const wxList& GetCommands() const { return m_commands; } + wxCommand *GetCurrentCommand() const + { + return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL); + } + int GetMaxCommands() const { return m_maxNoCommands; } + virtual void ClearCommands(); + + // Has the current project been changed? + virtual bool IsDirty() const + { + return m_currentCommand && (m_lastSavedCommand != m_currentCommand); + } + + // Mark the current command as the one where the last save took place + void MarkAsSaved() + { + m_lastSavedCommand = m_currentCommand; + } + + + // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y" + const wxString& GetUndoAccelerator() const { return m_undoAccelerator; } + const wxString& GetRedoAccelerator() const { return m_redoAccelerator; } + + void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; } + void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; } + +protected: + // for further flexibility, command processor doesn't call wxCommand::Do() + // and Undo() directly but uses these functions which can be overridden in + // the derived class + virtual bool DoCommand(wxCommand& cmd); + virtual bool UndoCommand(wxCommand& cmd); + + int m_maxNoCommands; + wxList m_commands; + wxList::compatibility_iterator m_currentCommand, + m_lastSavedCommand; + +#if wxUSE_MENUS + wxMenu* m_commandEditMenu; +#endif // wxUSE_MENUS + + wxString m_undoAccelerator; + wxString m_redoAccelerator; + +private: + DECLARE_DYNAMIC_CLASS(wxCommandProcessor) + DECLARE_NO_COPY_CLASS(wxCommandProcessor) +}; + +#endif // _WX_CMDPROC_H_ + diff --git a/Externals/wxWidgets/include/wx/cmndata.h b/Externals/wxWidgets/include/wx/cmndata.h index a96c4ff724..30310e21c4 100644 --- a/Externals/wxWidgets/include/wx/cmndata.h +++ b/Externals/wxWidgets/include/wx/cmndata.h @@ -1,454 +1,454 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cmndata.h -// Purpose: Common GDI data classes -// Author: Julian Smart and others -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: cmndata.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CMNDATA_H_BASE_ -#define _WX_CMNDATA_H_BASE_ - -#include "wx/window.h" -#include "wx/font.h" -#include "wx/encinfo.h" -#include "wx/colour.h" -#include "wx/gdicmn.h" - -#if wxUSE_STREAMS -#include "wx/stream.h" -#endif - - -class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; - - -class WXDLLEXPORT wxColourData: public wxObject -{ -public: - wxColourData(); - wxColourData(const wxColourData& data); - virtual ~wxColourData(); - - void SetChooseFull(bool flag) { m_chooseFull = flag; } - bool GetChooseFull() const { return m_chooseFull; } - void SetColour(const wxColour& colour) { m_dataColour = colour; } - const wxColour& GetColour() const { return m_dataColour; } - wxColour& GetColour() { return m_dataColour; } - - // Array of 16 custom colours - void SetCustomColour(int i, const wxColour& colour); - wxColour GetCustomColour(int i); - - void operator=(const wxColourData& data); - -public: - wxColour m_dataColour; - wxColour m_custColours[16]; - bool m_chooseFull; - -private: - DECLARE_DYNAMIC_CLASS(wxColourData) -}; - -class WXDLLEXPORT wxFontData : public wxObject -{ -public: - wxFontData(); - virtual ~wxFontData(); - - wxFontData(const wxFontData& data) - : wxObject(), - m_fontColour(data.m_fontColour), - m_showHelp(data.m_showHelp), - m_allowSymbols(data.m_allowSymbols), - m_enableEffects(data.m_enableEffects), - m_initialFont(data.m_initialFont), - m_chosenFont(data.m_chosenFont), - m_minSize(data.m_minSize), - m_maxSize(data.m_maxSize), - m_encoding(data.m_encoding), - m_encodingInfo(data.m_encodingInfo) - { - } - - wxFontData& operator=(const wxFontData& data) - { - wxObject::operator=(data); - m_fontColour = data.m_fontColour; - m_showHelp = data.m_showHelp; - m_allowSymbols = data.m_allowSymbols; - m_enableEffects = data.m_enableEffects; - m_initialFont = data.m_initialFont; - m_chosenFont = data.m_chosenFont; - m_minSize = data.m_minSize; - m_maxSize = data.m_maxSize; - m_encoding = data.m_encoding; - m_encodingInfo = data.m_encodingInfo; - return *this; - } - - void SetAllowSymbols(bool flag) { m_allowSymbols = flag; } - bool GetAllowSymbols() const { return m_allowSymbols; } - - void SetColour(const wxColour& colour) { m_fontColour = colour; } - const wxColour& GetColour() const { return m_fontColour; } - - void SetShowHelp(bool flag) { m_showHelp = flag; } - bool GetShowHelp() const { return m_showHelp; } - - void EnableEffects(bool flag) { m_enableEffects = flag; } - bool GetEnableEffects() const { return m_enableEffects; } - - void SetInitialFont(const wxFont& font) { m_initialFont = font; } - wxFont GetInitialFont() const { return m_initialFont; } - - void SetChosenFont(const wxFont& font) { m_chosenFont = font; } - wxFont GetChosenFont() const { return m_chosenFont; } - - void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; } - - // encoding info is split into 2 parts: the logical wxWin encoding - // (wxFontEncoding) and a structure containing the native parameters for - // it (wxNativeEncodingInfo) - wxFontEncoding GetEncoding() const { return m_encoding; } - void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; } - - wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; } - - - // public for backwards compatibility only: don't use directly -public: - wxColour m_fontColour; - bool m_showHelp; - bool m_allowSymbols; - bool m_enableEffects; - wxFont m_initialFont; - wxFont m_chosenFont; - int m_minSize; - int m_maxSize; - -private: - wxFontEncoding m_encoding; - wxNativeEncodingInfo m_encodingInfo; - -private: - DECLARE_DYNAMIC_CLASS(wxFontData) -}; - -#if wxUSE_PRINTING_ARCHITECTURE -/* - * wxPrintData - * Encapsulates printer information (not printer dialog information) - */ - -enum wxPrintBin -{ - wxPRINTBIN_DEFAULT, - - wxPRINTBIN_ONLYONE, - wxPRINTBIN_LOWER, - wxPRINTBIN_MIDDLE, - wxPRINTBIN_MANUAL, - wxPRINTBIN_ENVELOPE, - wxPRINTBIN_ENVMANUAL, - wxPRINTBIN_AUTO, - wxPRINTBIN_TRACTOR, - wxPRINTBIN_SMALLFMT, - wxPRINTBIN_LARGEFMT, - wxPRINTBIN_LARGECAPACITY, - wxPRINTBIN_CASSETTE, - wxPRINTBIN_FORMSOURCE, - - wxPRINTBIN_USER -}; - -const int wxPRINTMEDIA_DEFAULT = 0; - -class WXDLLEXPORT wxPrintData: public wxObject -{ -public: - wxPrintData(); - wxPrintData(const wxPrintData& printData); - virtual ~wxPrintData(); - - int GetNoCopies() const { return m_printNoCopies; } - bool GetCollate() const { return m_printCollate; } - int GetOrientation() const { return m_printOrientation; } - bool IsOrientationReversed() const { return m_printOrientationReversed; } - - // Is this data OK for showing the print dialog? - bool Ok() const { return IsOk(); } - bool IsOk() const ; - - const wxString& GetPrinterName() const { return m_printerName; } - bool GetColour() const { return m_colour; } - wxDuplexMode GetDuplex() const { return m_duplexMode; } - wxPaperSize GetPaperId() const { return m_paperId; } - const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size - // in wxPageSetupDialogData - wxPrintQuality GetQuality() const { return m_printQuality; } - wxPrintBin GetBin() const { return m_bin; } - wxPrintMode GetPrintMode() const { return m_printMode; } - int GetMedia() const { return m_media; } - - void SetNoCopies(int v) { m_printNoCopies = v; } - void SetCollate(bool flag) { m_printCollate = flag; } - void SetOrientation(int orient) { m_printOrientation = orient; } - void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; } - - void SetPrinterName(const wxString& name) { m_printerName = name; } - void SetColour(bool colour) { m_colour = colour; } - void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; } - void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; } - void SetPaperSize(const wxSize& sz) { m_paperSize = sz; } - void SetQuality(wxPrintQuality quality) { m_printQuality = quality; } - void SetBin(wxPrintBin bin) { m_bin = bin; } - void SetMedia(int media) { m_media = media; } - void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; } - - wxString GetFilename() const { return m_filename; } - void SetFilename( const wxString &filename ) { m_filename = filename; } - - void operator=(const wxPrintData& data); - - char* GetPrivData() const { return m_privData; } - int GetPrivDataLen() const { return m_privDataLen; } - void SetPrivData( char *privData, int len ); - - -#if WXWIN_COMPATIBILITY_2_4 - // PostScript-specific data - wxString GetPrinterCommand() const; - wxString GetPrinterOptions() const; - wxString GetPreviewCommand() const; - wxString GetFontMetricPath() const; - double GetPrinterScaleX() const; - double GetPrinterScaleY() const; - long GetPrinterTranslateX() const; - long GetPrinterTranslateY() const; - - void SetPrinterCommand(const wxString& command); - void SetPrinterOptions(const wxString& options); - void SetPreviewCommand(const wxString& command); - void SetFontMetricPath(const wxString& path); - void SetPrinterScaleX(double x); - void SetPrinterScaleY(double y); - void SetPrinterScaling(double x, double y); - void SetPrinterTranslateX(long x); - void SetPrinterTranslateY(long y); - void SetPrinterTranslation(long x, long y); -#endif - - // Convert between wxPrintData and native data - void ConvertToNative(); - void ConvertFromNative(); - // Holds the native print data - wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; } - -private: - wxPrintBin m_bin; - int m_media; - wxPrintMode m_printMode; - - int m_printNoCopies; - int m_printOrientation; - bool m_printOrientationReversed; - bool m_printCollate; - - wxString m_printerName; - bool m_colour; - wxDuplexMode m_duplexMode; - wxPrintQuality m_printQuality; - wxPaperSize m_paperId; - wxSize m_paperSize; - - wxString m_filename; - - char* m_privData; - int m_privDataLen; - - wxPrintNativeDataBase *m_nativeData; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintData) -}; - -/* - * wxPrintDialogData - * Encapsulates information displayed and edited in the printer dialog box. - * Contains a wxPrintData object which is filled in according to the values retrieved - * from the dialog. - */ - -class WXDLLEXPORT wxPrintDialogData: public wxObject -{ -public: - wxPrintDialogData(); - wxPrintDialogData(const wxPrintDialogData& dialogData); - wxPrintDialogData(const wxPrintData& printData); - virtual ~wxPrintDialogData(); - - int GetFromPage() const { return m_printFromPage; } - int GetToPage() const { return m_printToPage; } - int GetMinPage() const { return m_printMinPage; } - int GetMaxPage() const { return m_printMaxPage; } - int GetNoCopies() const { return m_printNoCopies; } - bool GetAllPages() const { return m_printAllPages; } - bool GetSelection() const { return m_printSelection; } - bool GetCollate() const { return m_printCollate; } - bool GetPrintToFile() const { return m_printToFile; } -#if WXWIN_COMPATIBILITY_2_4 - bool GetSetupDialog() const { return m_printSetupDialog; } -#endif - void SetFromPage(int v) { m_printFromPage = v; } - void SetToPage(int v) { m_printToPage = v; } - void SetMinPage(int v) { m_printMinPage = v; } - void SetMaxPage(int v) { m_printMaxPage = v; } - void SetNoCopies(int v) { m_printNoCopies = v; } - void SetAllPages(bool flag) { m_printAllPages = flag; } - void SetSelection(bool flag) { m_printSelection = flag; } - void SetCollate(bool flag) { m_printCollate = flag; } - void SetPrintToFile(bool flag) { m_printToFile = flag; } -#if WXWIN_COMPATIBILITY_2_4 - void SetSetupDialog(bool flag) { m_printSetupDialog = flag; } -#endif - void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; } - void EnableSelection(bool flag) { m_printEnableSelection = flag; } - void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; } - void EnableHelp(bool flag) { m_printEnableHelp = flag; } - - bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; } - bool GetEnableSelection() const { return m_printEnableSelection; } - bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; } - bool GetEnableHelp() const { return m_printEnableHelp; } - - // Is this data OK for showing the print dialog? - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.Ok() ; } - - wxPrintData& GetPrintData() { return m_printData; } - void SetPrintData(const wxPrintData& printData) { m_printData = printData; } - - void operator=(const wxPrintDialogData& data); - void operator=(const wxPrintData& data); // Sets internal m_printData member - -private: - int m_printFromPage; - int m_printToPage; - int m_printMinPage; - int m_printMaxPage; - int m_printNoCopies; - bool m_printAllPages; - bool m_printCollate; - bool m_printToFile; - bool m_printSelection; - bool m_printEnableSelection; - bool m_printEnablePageNumbers; - bool m_printEnableHelp; - bool m_printEnablePrintToFile; -#if WXWIN_COMPATIBILITY_2_4 - bool m_printSetupDialog; -#endif - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintDialogData) -}; - -/* -* This is the data used (and returned) by the wxPageSetupDialog. -*/ - -// Compatibility with old name -#define wxPageSetupData wxPageSetupDialogData - -class WXDLLEXPORT wxPageSetupDialogData: public wxObject -{ -public: - wxPageSetupDialogData(); - wxPageSetupDialogData(const wxPageSetupDialogData& dialogData); - wxPageSetupDialogData(const wxPrintData& printData); - virtual ~wxPageSetupDialogData(); - - wxSize GetPaperSize() const { return m_paperSize; } - wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); } - wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; } - wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; } - wxPoint GetMarginTopLeft() const { return m_marginTopLeft; } - wxPoint GetMarginBottomRight() const { return m_marginBottomRight; } - - bool GetDefaultMinMargins() const { return m_defaultMinMargins; } - bool GetEnableMargins() const { return m_enableMargins; } - bool GetEnableOrientation() const { return m_enableOrientation; } - bool GetEnablePaper() const { return m_enablePaper; } - bool GetEnablePrinter() const { return m_enablePrinter; } - bool GetDefaultInfo() const { return m_getDefaultInfo; } - bool GetEnableHelp() const { return m_enableHelp; } - - // Is this data OK for showing the page setup dialog? - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_printData.Ok() ; } - - // If a corresponding paper type is found in the paper database, will set the m_printData - // paper size id member as well. - void SetPaperSize(const wxSize& sz); - - void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); } - - // Sets the wxPrintData id, plus the paper width/height if found in the paper database. - void SetPaperSize(wxPaperSize id); - - void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; } - void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; } - void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; } - void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; } - void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; } - void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; } - - void EnableMargins(bool flag) { m_enableMargins = flag; } - void EnableOrientation(bool flag) { m_enableOrientation = flag; } - void EnablePaper(bool flag) { m_enablePaper = flag; } - void EnablePrinter(bool flag) { m_enablePrinter = flag; } - void EnableHelp(bool flag) { m_enableHelp = flag; } - - // Use paper size defined in this object to set the wxPrintData - // paper id - void CalculateIdFromPaperSize(); - - // Use paper id in wxPrintData to set this object's paper size - void CalculatePaperSizeFromId(); - - wxPageSetupDialogData& operator=(const wxPageSetupData& data); - wxPageSetupDialogData& operator=(const wxPrintData& data); - - wxPrintData& GetPrintData() { return m_printData; } - const wxPrintData& GetPrintData() const { return m_printData; } - void SetPrintData(const wxPrintData& printData); - -private: - wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?) - wxPoint m_minMarginTopLeft; - wxPoint m_minMarginBottomRight; - wxPoint m_marginTopLeft; - wxPoint m_marginBottomRight; - bool m_defaultMinMargins; - bool m_enableMargins; - bool m_enableOrientation; - bool m_enablePaper; - bool m_enablePrinter; - bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT - bool m_enableHelp; - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData) -}; - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif -// _WX_CMNDATA_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cmndata.h +// Purpose: Common GDI data classes +// Author: Julian Smart and others +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: cmndata.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CMNDATA_H_BASE_ +#define _WX_CMNDATA_H_BASE_ + +#include "wx/window.h" +#include "wx/font.h" +#include "wx/encinfo.h" +#include "wx/colour.h" +#include "wx/gdicmn.h" + +#if wxUSE_STREAMS +#include "wx/stream.h" +#endif + + +class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; + + +class WXDLLEXPORT wxColourData: public wxObject +{ +public: + wxColourData(); + wxColourData(const wxColourData& data); + virtual ~wxColourData(); + + void SetChooseFull(bool flag) { m_chooseFull = flag; } + bool GetChooseFull() const { return m_chooseFull; } + void SetColour(const wxColour& colour) { m_dataColour = colour; } + const wxColour& GetColour() const { return m_dataColour; } + wxColour& GetColour() { return m_dataColour; } + + // Array of 16 custom colours + void SetCustomColour(int i, const wxColour& colour); + wxColour GetCustomColour(int i); + + void operator=(const wxColourData& data); + +public: + wxColour m_dataColour; + wxColour m_custColours[16]; + bool m_chooseFull; + +private: + DECLARE_DYNAMIC_CLASS(wxColourData) +}; + +class WXDLLEXPORT wxFontData : public wxObject +{ +public: + wxFontData(); + virtual ~wxFontData(); + + wxFontData(const wxFontData& data) + : wxObject(), + m_fontColour(data.m_fontColour), + m_showHelp(data.m_showHelp), + m_allowSymbols(data.m_allowSymbols), + m_enableEffects(data.m_enableEffects), + m_initialFont(data.m_initialFont), + m_chosenFont(data.m_chosenFont), + m_minSize(data.m_minSize), + m_maxSize(data.m_maxSize), + m_encoding(data.m_encoding), + m_encodingInfo(data.m_encodingInfo) + { + } + + wxFontData& operator=(const wxFontData& data) + { + wxObject::operator=(data); + m_fontColour = data.m_fontColour; + m_showHelp = data.m_showHelp; + m_allowSymbols = data.m_allowSymbols; + m_enableEffects = data.m_enableEffects; + m_initialFont = data.m_initialFont; + m_chosenFont = data.m_chosenFont; + m_minSize = data.m_minSize; + m_maxSize = data.m_maxSize; + m_encoding = data.m_encoding; + m_encodingInfo = data.m_encodingInfo; + return *this; + } + + void SetAllowSymbols(bool flag) { m_allowSymbols = flag; } + bool GetAllowSymbols() const { return m_allowSymbols; } + + void SetColour(const wxColour& colour) { m_fontColour = colour; } + const wxColour& GetColour() const { return m_fontColour; } + + void SetShowHelp(bool flag) { m_showHelp = flag; } + bool GetShowHelp() const { return m_showHelp; } + + void EnableEffects(bool flag) { m_enableEffects = flag; } + bool GetEnableEffects() const { return m_enableEffects; } + + void SetInitialFont(const wxFont& font) { m_initialFont = font; } + wxFont GetInitialFont() const { return m_initialFont; } + + void SetChosenFont(const wxFont& font) { m_chosenFont = font; } + wxFont GetChosenFont() const { return m_chosenFont; } + + void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; } + + // encoding info is split into 2 parts: the logical wxWin encoding + // (wxFontEncoding) and a structure containing the native parameters for + // it (wxNativeEncodingInfo) + wxFontEncoding GetEncoding() const { return m_encoding; } + void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; } + + wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; } + + + // public for backwards compatibility only: don't use directly +public: + wxColour m_fontColour; + bool m_showHelp; + bool m_allowSymbols; + bool m_enableEffects; + wxFont m_initialFont; + wxFont m_chosenFont; + int m_minSize; + int m_maxSize; + +private: + wxFontEncoding m_encoding; + wxNativeEncodingInfo m_encodingInfo; + +private: + DECLARE_DYNAMIC_CLASS(wxFontData) +}; + +#if wxUSE_PRINTING_ARCHITECTURE +/* + * wxPrintData + * Encapsulates printer information (not printer dialog information) + */ + +enum wxPrintBin +{ + wxPRINTBIN_DEFAULT, + + wxPRINTBIN_ONLYONE, + wxPRINTBIN_LOWER, + wxPRINTBIN_MIDDLE, + wxPRINTBIN_MANUAL, + wxPRINTBIN_ENVELOPE, + wxPRINTBIN_ENVMANUAL, + wxPRINTBIN_AUTO, + wxPRINTBIN_TRACTOR, + wxPRINTBIN_SMALLFMT, + wxPRINTBIN_LARGEFMT, + wxPRINTBIN_LARGECAPACITY, + wxPRINTBIN_CASSETTE, + wxPRINTBIN_FORMSOURCE, + + wxPRINTBIN_USER +}; + +const int wxPRINTMEDIA_DEFAULT = 0; + +class WXDLLEXPORT wxPrintData: public wxObject +{ +public: + wxPrintData(); + wxPrintData(const wxPrintData& printData); + virtual ~wxPrintData(); + + int GetNoCopies() const { return m_printNoCopies; } + bool GetCollate() const { return m_printCollate; } + int GetOrientation() const { return m_printOrientation; } + bool IsOrientationReversed() const { return m_printOrientationReversed; } + + // Is this data OK for showing the print dialog? + bool Ok() const { return IsOk(); } + bool IsOk() const ; + + const wxString& GetPrinterName() const { return m_printerName; } + bool GetColour() const { return m_colour; } + wxDuplexMode GetDuplex() const { return m_duplexMode; } + wxPaperSize GetPaperId() const { return m_paperId; } + const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size + // in wxPageSetupDialogData + wxPrintQuality GetQuality() const { return m_printQuality; } + wxPrintBin GetBin() const { return m_bin; } + wxPrintMode GetPrintMode() const { return m_printMode; } + int GetMedia() const { return m_media; } + + void SetNoCopies(int v) { m_printNoCopies = v; } + void SetCollate(bool flag) { m_printCollate = flag; } + void SetOrientation(int orient) { m_printOrientation = orient; } + void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; } + + void SetPrinterName(const wxString& name) { m_printerName = name; } + void SetColour(bool colour) { m_colour = colour; } + void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; } + void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; } + void SetPaperSize(const wxSize& sz) { m_paperSize = sz; } + void SetQuality(wxPrintQuality quality) { m_printQuality = quality; } + void SetBin(wxPrintBin bin) { m_bin = bin; } + void SetMedia(int media) { m_media = media; } + void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; } + + wxString GetFilename() const { return m_filename; } + void SetFilename( const wxString &filename ) { m_filename = filename; } + + void operator=(const wxPrintData& data); + + char* GetPrivData() const { return m_privData; } + int GetPrivDataLen() const { return m_privDataLen; } + void SetPrivData( char *privData, int len ); + + +#if WXWIN_COMPATIBILITY_2_4 + // PostScript-specific data + wxString GetPrinterCommand() const; + wxString GetPrinterOptions() const; + wxString GetPreviewCommand() const; + wxString GetFontMetricPath() const; + double GetPrinterScaleX() const; + double GetPrinterScaleY() const; + long GetPrinterTranslateX() const; + long GetPrinterTranslateY() const; + + void SetPrinterCommand(const wxString& command); + void SetPrinterOptions(const wxString& options); + void SetPreviewCommand(const wxString& command); + void SetFontMetricPath(const wxString& path); + void SetPrinterScaleX(double x); + void SetPrinterScaleY(double y); + void SetPrinterScaling(double x, double y); + void SetPrinterTranslateX(long x); + void SetPrinterTranslateY(long y); + void SetPrinterTranslation(long x, long y); +#endif + + // Convert between wxPrintData and native data + void ConvertToNative(); + void ConvertFromNative(); + // Holds the native print data + wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; } + +private: + wxPrintBin m_bin; + int m_media; + wxPrintMode m_printMode; + + int m_printNoCopies; + int m_printOrientation; + bool m_printOrientationReversed; + bool m_printCollate; + + wxString m_printerName; + bool m_colour; + wxDuplexMode m_duplexMode; + wxPrintQuality m_printQuality; + wxPaperSize m_paperId; + wxSize m_paperSize; + + wxString m_filename; + + char* m_privData; + int m_privDataLen; + + wxPrintNativeDataBase *m_nativeData; + +private: + DECLARE_DYNAMIC_CLASS(wxPrintData) +}; + +/* + * wxPrintDialogData + * Encapsulates information displayed and edited in the printer dialog box. + * Contains a wxPrintData object which is filled in according to the values retrieved + * from the dialog. + */ + +class WXDLLEXPORT wxPrintDialogData: public wxObject +{ +public: + wxPrintDialogData(); + wxPrintDialogData(const wxPrintDialogData& dialogData); + wxPrintDialogData(const wxPrintData& printData); + virtual ~wxPrintDialogData(); + + int GetFromPage() const { return m_printFromPage; } + int GetToPage() const { return m_printToPage; } + int GetMinPage() const { return m_printMinPage; } + int GetMaxPage() const { return m_printMaxPage; } + int GetNoCopies() const { return m_printNoCopies; } + bool GetAllPages() const { return m_printAllPages; } + bool GetSelection() const { return m_printSelection; } + bool GetCollate() const { return m_printCollate; } + bool GetPrintToFile() const { return m_printToFile; } +#if WXWIN_COMPATIBILITY_2_4 + bool GetSetupDialog() const { return m_printSetupDialog; } +#endif + void SetFromPage(int v) { m_printFromPage = v; } + void SetToPage(int v) { m_printToPage = v; } + void SetMinPage(int v) { m_printMinPage = v; } + void SetMaxPage(int v) { m_printMaxPage = v; } + void SetNoCopies(int v) { m_printNoCopies = v; } + void SetAllPages(bool flag) { m_printAllPages = flag; } + void SetSelection(bool flag) { m_printSelection = flag; } + void SetCollate(bool flag) { m_printCollate = flag; } + void SetPrintToFile(bool flag) { m_printToFile = flag; } +#if WXWIN_COMPATIBILITY_2_4 + void SetSetupDialog(bool flag) { m_printSetupDialog = flag; } +#endif + void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; } + void EnableSelection(bool flag) { m_printEnableSelection = flag; } + void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; } + void EnableHelp(bool flag) { m_printEnableHelp = flag; } + + bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; } + bool GetEnableSelection() const { return m_printEnableSelection; } + bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; } + bool GetEnableHelp() const { return m_printEnableHelp; } + + // Is this data OK for showing the print dialog? + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_printData.Ok() ; } + + wxPrintData& GetPrintData() { return m_printData; } + void SetPrintData(const wxPrintData& printData) { m_printData = printData; } + + void operator=(const wxPrintDialogData& data); + void operator=(const wxPrintData& data); // Sets internal m_printData member + +private: + int m_printFromPage; + int m_printToPage; + int m_printMinPage; + int m_printMaxPage; + int m_printNoCopies; + bool m_printAllPages; + bool m_printCollate; + bool m_printToFile; + bool m_printSelection; + bool m_printEnableSelection; + bool m_printEnablePageNumbers; + bool m_printEnableHelp; + bool m_printEnablePrintToFile; +#if WXWIN_COMPATIBILITY_2_4 + bool m_printSetupDialog; +#endif + wxPrintData m_printData; + +private: + DECLARE_DYNAMIC_CLASS(wxPrintDialogData) +}; + +/* +* This is the data used (and returned) by the wxPageSetupDialog. +*/ + +// Compatibility with old name +#define wxPageSetupData wxPageSetupDialogData + +class WXDLLEXPORT wxPageSetupDialogData: public wxObject +{ +public: + wxPageSetupDialogData(); + wxPageSetupDialogData(const wxPageSetupDialogData& dialogData); + wxPageSetupDialogData(const wxPrintData& printData); + virtual ~wxPageSetupDialogData(); + + wxSize GetPaperSize() const { return m_paperSize; } + wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); } + wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; } + wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; } + wxPoint GetMarginTopLeft() const { return m_marginTopLeft; } + wxPoint GetMarginBottomRight() const { return m_marginBottomRight; } + + bool GetDefaultMinMargins() const { return m_defaultMinMargins; } + bool GetEnableMargins() const { return m_enableMargins; } + bool GetEnableOrientation() const { return m_enableOrientation; } + bool GetEnablePaper() const { return m_enablePaper; } + bool GetEnablePrinter() const { return m_enablePrinter; } + bool GetDefaultInfo() const { return m_getDefaultInfo; } + bool GetEnableHelp() const { return m_enableHelp; } + + // Is this data OK for showing the page setup dialog? + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_printData.Ok() ; } + + // If a corresponding paper type is found in the paper database, will set the m_printData + // paper size id member as well. + void SetPaperSize(const wxSize& sz); + + void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); } + + // Sets the wxPrintData id, plus the paper width/height if found in the paper database. + void SetPaperSize(wxPaperSize id); + + void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; } + void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; } + void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; } + void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; } + void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; } + void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; } + + void EnableMargins(bool flag) { m_enableMargins = flag; } + void EnableOrientation(bool flag) { m_enableOrientation = flag; } + void EnablePaper(bool flag) { m_enablePaper = flag; } + void EnablePrinter(bool flag) { m_enablePrinter = flag; } + void EnableHelp(bool flag) { m_enableHelp = flag; } + + // Use paper size defined in this object to set the wxPrintData + // paper id + void CalculateIdFromPaperSize(); + + // Use paper id in wxPrintData to set this object's paper size + void CalculatePaperSizeFromId(); + + wxPageSetupDialogData& operator=(const wxPageSetupData& data); + wxPageSetupDialogData& operator=(const wxPrintData& data); + + wxPrintData& GetPrintData() { return m_printData; } + const wxPrintData& GetPrintData() const { return m_printData; } + void SetPrintData(const wxPrintData& printData); + +private: + wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?) + wxPoint m_minMarginTopLeft; + wxPoint m_minMarginBottomRight; + wxPoint m_marginTopLeft; + wxPoint m_marginBottomRight; + bool m_defaultMinMargins; + bool m_enableMargins; + bool m_enableOrientation; + bool m_enablePaper; + bool m_enablePrinter; + bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT + bool m_enableHelp; + wxPrintData m_printData; + +private: + DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData) +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif +// _WX_CMNDATA_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/collpane.h b/Externals/wxWidgets/include/wx/collpane.h index 483d33b264..1db6bfb540 100644 --- a/Externals/wxWidgets/include/wx/collpane.h +++ b/Externals/wxWidgets/include/wx/collpane.h @@ -1,104 +1,104 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/collpane.h -// Purpose: wxCollapsiblePane -// Author: Francesco Montorsi -// Modified by: -// Created: 8/10/2006 -// RCS-ID: $Id: collpane.h 43300 2006-11-11 07:32:08Z RD $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLLAPSABLE_PANE_H_BASE_ -#define _WX_COLLAPSABLE_PANE_H_BASE_ - -#include "wx/defs.h" - - -#if wxUSE_COLLPANE - -#include "wx/control.h" - - -// ---------------------------------------------------------------------------- -// wxCollapsiblePaneBase: interface for wxCollapsiblePane -// ---------------------------------------------------------------------------- - -#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER) -#define wxCP_NO_TLW_RESIZE (0x0002) - -class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl -{ -public: - wxCollapsiblePaneBase() {} - - virtual void Collapse(bool collapse = true) = 0; - void Expand() { Collapse(false); } - - virtual bool IsCollapsed() const = 0; - bool IsExpanded() const { return !IsCollapsed(); } - - virtual wxWindow *GetPane() const = 0; - - virtual wxString GetLabel() const = 0; - virtual void SetLabel(const wxString& label) = 0; -}; - - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent -{ -public: - wxCollapsiblePaneEvent() {} - wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed) - : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id), - m_bCollapsed(collapsed) - { - SetEventObject(generator); - } - - bool GetCollapsed() const { return m_bCollapsed; } - void SetCollapsed(bool c) { m_bCollapsed = c; } - - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); } - -private: - bool m_bCollapsed; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); - -#define wxCollapsiblePaneEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func) - -#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn)) - - -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/collpane.h" -#else - #include "wx/generic/collpaneg.h" - - // use #define and not a typedef to allow forward declaring the class - #define wxCollapsiblePane wxGenericCollapsiblePane -#endif - -#endif // wxUSE_COLLPANE - -#endif // _WX_COLLAPSABLE_PANE_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/collpane.h +// Purpose: wxCollapsiblePane +// Author: Francesco Montorsi +// Modified by: +// Created: 8/10/2006 +// RCS-ID: $Id: collpane.h 43300 2006-11-11 07:32:08Z RD $ +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSABLE_PANE_H_BASE_ +#define _WX_COLLAPSABLE_PANE_H_BASE_ + +#include "wx/defs.h" + + +#if wxUSE_COLLPANE + +#include "wx/control.h" + + +// ---------------------------------------------------------------------------- +// wxCollapsiblePaneBase: interface for wxCollapsiblePane +// ---------------------------------------------------------------------------- + +#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER) +#define wxCP_NO_TLW_RESIZE (0x0002) + +class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl +{ +public: + wxCollapsiblePaneBase() {} + + virtual void Collapse(bool collapse = true) = 0; + void Expand() { Collapse(false); } + + virtual bool IsCollapsed() const = 0; + bool IsExpanded() const { return !IsCollapsed(); } + + virtual wxWindow *GetPane() const = 0; + + virtual wxString GetLabel() const = 0; + virtual void SetLabel(const wxString& label) = 0; +}; + + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102) +END_DECLARE_EVENT_TYPES() + +class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent +{ +public: + wxCollapsiblePaneEvent() {} + wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed) + : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id), + m_bCollapsed(collapsed) + { + SetEventObject(generator); + } + + bool GetCollapsed() const { return m_bCollapsed; } + void SetCollapsed(bool c) { m_bCollapsed = c; } + + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); } + +private: + bool m_bCollapsed; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent) +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); + +#define wxCollapsiblePaneEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func) + +#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn)) + + +#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/collpane.h" +#else + #include "wx/generic/collpaneg.h" + + // use #define and not a typedef to allow forward declaring the class + #define wxCollapsiblePane wxGenericCollapsiblePane +#endif + +#endif // wxUSE_COLLPANE + +#endif // _WX_COLLAPSABLE_PANE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/colordlg.h b/Externals/wxWidgets/include/wx/colordlg.h index f171920785..83e416dcb4 100644 --- a/Externals/wxWidgets/include/wx/colordlg.h +++ b/Externals/wxWidgets/include/wx/colordlg.h @@ -1,41 +1,41 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/colrdlgg.h -// Purpose: wxColourDialog -// Author: Vadim Zeitiln -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colordlg.h 36623 2006-01-02 14:26:36Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLORDLG_H_BASE_ -#define _WX_COLORDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_COLOURDLG - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/colordlg.h" -#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) - #include "wx/mac/colordlg.h" -#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/colordlg.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/colordlg.h" -#else - #include "wx/generic/colrdlgg.h" - - #define wxColourDialog wxGenericColourDialog -#endif - -// get the colour from user and return it -wxColour WXDLLEXPORT -wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, - const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString); - -#endif // wxUSE_COLOURDLG - -#endif - // _WX_COLORDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/colrdlgg.h +// Purpose: wxColourDialog +// Author: Vadim Zeitiln +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: colordlg.h 36623 2006-01-02 14:26:36Z JS $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_BASE_ +#define _WX_COLORDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_COLOURDLG + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/colordlg.h" +#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) + #include "wx/mac/colordlg.h" +#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/colordlg.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/colordlg.h" +#else + #include "wx/generic/colrdlgg.h" + + #define wxColourDialog wxGenericColourDialog +#endif + +// get the colour from user and return it +wxColour WXDLLEXPORT +wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, + const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString); + +#endif // wxUSE_COLOURDLG + +#endif + // _WX_COLORDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/colour.h b/Externals/wxWidgets/include/wx/colour.h index 66c45e7722..bb396f0fed 100644 --- a/Externals/wxWidgets/include/wx/colour.h +++ b/Externals/wxWidgets/include/wx/colour.h @@ -1,154 +1,154 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/colour.h -// Purpose: wxColourBase definition -// Author: Julian Smart -// Modified by: Francesco Montorsi -// Created: -// RCS-ID: $Id: colour.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLOUR_H_BASE_ -#define _WX_COLOUR_H_BASE_ - -#include "wx/defs.h" -#include "wx/gdiobj.h" - - -class WXDLLIMPEXP_FWD_CORE wxColour; - -// the standard wxColour constructors; -// this macro avoids to repeat these lines across all colour.h files, since -// Set() is a virtual function and thus cannot be called by wxColourBase -// constructors -#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \ - wxColour( ChannelType red, ChannelType green, ChannelType blue, \ - ChannelType alpha = wxALPHA_OPAQUE ) \ - { Set(red, green, blue, alpha); } \ - wxColour( unsigned long colRGB ) { Set(colRGB); } \ - wxColour(const wxString &colourName) { Set(colourName); } \ - wxColour(const wxChar *colourName) { Set(colourName); } - - -// flags for wxColour -> wxString conversion (see wxColour::GetAsString) -#define wxC2S_NAME 1 // return colour name, when possible -#define wxC2S_CSS_SYNTAX 2 // return colour in rgb(r,g,b) syntax -#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax - - -const unsigned char wxALPHA_TRANSPARENT = 0; -const unsigned char wxALPHA_OPAQUE = 0xff; - -// ---------------------------------------------------------------------------- -// wxVariant support -// ---------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) -#endif - -//----------------------------------------------------------------------------- -// wxColourBase: this class has no data members, just some functions to avoid -// code redundancy in all native wxColour implementations -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxColourBase : public wxGDIObject -{ -public: - // type of a single colour component - typedef unsigned char ChannelType; - - wxColourBase() {} - virtual ~wxColourBase() {} - - - // Set() functions - // --------------- - - void Set(ChannelType red, - ChannelType green, - ChannelType blue, - ChannelType alpha = wxALPHA_OPAQUE) - { InitRGBA(red,green,blue, alpha); } - - // implemented in colourcmn.cpp - bool Set(const wxChar *str) - { return FromString(str); } - - bool Set(const wxString &str) - { return FromString(str); } - - void Set(unsigned long colRGB) - { - // we don't need to know sizeof(long) here because we assume that the three - // least significant bytes contain the R, G and B values - Set((ChannelType)(0xFF & colRGB), - (ChannelType)(0xFF & (colRGB >> 8)), - (ChannelType)(0xFF & (colRGB >> 16))); - } - - - - // accessors - // --------- - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - - virtual ChannelType Red() const = 0; - virtual ChannelType Green() const = 0; - virtual ChannelType Blue() const = 0; - virtual ChannelType Alpha() const - { return wxALPHA_OPAQUE ; } - - // implemented in colourcmn.cpp - virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const; - - - - // old, deprecated - // --------------- - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( static wxColour CreateByName(const wxString& name) ); - wxDEPRECATED( void InitFromName(const wxString& col) ); -#endif - -protected: - virtual void - InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0; - - virtual bool FromString(const wxChar *s); -}; - - - -#if defined(__WXPALMOS__) - #include "wx/generic/colour.h" -#elif defined(__WXMSW__) - #include "wx/msw/colour.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/colour.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/colour.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/colour.h" -#elif defined(__WXMGL__) - #include "wx/generic/colour.h" -#elif defined(__WXDFB__) - #include "wx/generic/colour.h" -#elif defined(__WXX11__) - #include "wx/x11/colour.h" -#elif defined(__WXMAC__) - #include "wx/mac/colour.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/colour.h" -#elif defined(__WXPM__) - #include "wx/os2/colour.h" -#endif - -#define wxColor wxColour - -#endif // _WX_COLOUR_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/colour.h +// Purpose: wxColourBase definition +// Author: Julian Smart +// Modified by: Francesco Montorsi +// Created: +// RCS-ID: $Id: colour.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_BASE_ +#define _WX_COLOUR_H_BASE_ + +#include "wx/defs.h" +#include "wx/gdiobj.h" + + +class WXDLLIMPEXP_FWD_CORE wxColour; + +// the standard wxColour constructors; +// this macro avoids to repeat these lines across all colour.h files, since +// Set() is a virtual function and thus cannot be called by wxColourBase +// constructors +#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \ + wxColour( ChannelType red, ChannelType green, ChannelType blue, \ + ChannelType alpha = wxALPHA_OPAQUE ) \ + { Set(red, green, blue, alpha); } \ + wxColour( unsigned long colRGB ) { Set(colRGB); } \ + wxColour(const wxString &colourName) { Set(colourName); } \ + wxColour(const wxChar *colourName) { Set(colourName); } + + +// flags for wxColour -> wxString conversion (see wxColour::GetAsString) +#define wxC2S_NAME 1 // return colour name, when possible +#define wxC2S_CSS_SYNTAX 2 // return colour in rgb(r,g,b) syntax +#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax + + +const unsigned char wxALPHA_TRANSPARENT = 0; +const unsigned char wxALPHA_OPAQUE = 0xff; + +// ---------------------------------------------------------------------------- +// wxVariant support +// ---------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) +#endif + +//----------------------------------------------------------------------------- +// wxColourBase: this class has no data members, just some functions to avoid +// code redundancy in all native wxColour implementations +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxColourBase : public wxGDIObject +{ +public: + // type of a single colour component + typedef unsigned char ChannelType; + + wxColourBase() {} + virtual ~wxColourBase() {} + + + // Set() functions + // --------------- + + void Set(ChannelType red, + ChannelType green, + ChannelType blue, + ChannelType alpha = wxALPHA_OPAQUE) + { InitRGBA(red,green,blue, alpha); } + + // implemented in colourcmn.cpp + bool Set(const wxChar *str) + { return FromString(str); } + + bool Set(const wxString &str) + { return FromString(str); } + + void Set(unsigned long colRGB) + { + // we don't need to know sizeof(long) here because we assume that the three + // least significant bytes contain the R, G and B values + Set((ChannelType)(0xFF & colRGB), + (ChannelType)(0xFF & (colRGB >> 8)), + (ChannelType)(0xFF & (colRGB >> 16))); + } + + + + // accessors + // --------- + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; + + virtual ChannelType Red() const = 0; + virtual ChannelType Green() const = 0; + virtual ChannelType Blue() const = 0; + virtual ChannelType Alpha() const + { return wxALPHA_OPAQUE ; } + + // implemented in colourcmn.cpp + virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const; + + + + // old, deprecated + // --------------- + +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( static wxColour CreateByName(const wxString& name) ); + wxDEPRECATED( void InitFromName(const wxString& col) ); +#endif + +protected: + virtual void + InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0; + + virtual bool FromString(const wxChar *s); +}; + + + +#if defined(__WXPALMOS__) + #include "wx/generic/colour.h" +#elif defined(__WXMSW__) + #include "wx/msw/colour.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/colour.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/colour.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/colour.h" +#elif defined(__WXMGL__) + #include "wx/generic/colour.h" +#elif defined(__WXDFB__) + #include "wx/generic/colour.h" +#elif defined(__WXX11__) + #include "wx/x11/colour.h" +#elif defined(__WXMAC__) + #include "wx/mac/colour.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/colour.h" +#elif defined(__WXPM__) + #include "wx/os2/colour.h" +#endif + +#define wxColor wxColour + +#endif // _WX_COLOUR_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/combo.h b/Externals/wxWidgets/include/wx/combo.h index 64d0d0888b..52c8af4fbd 100644 --- a/Externals/wxWidgets/include/wx/combo.h +++ b/Externals/wxWidgets/include/wx/combo.h @@ -1,746 +1,746 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/combo.h -// Purpose: wxComboCtrl declaration -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOCONTROL_H_BASE_ -#define _WX_COMBOCONTROL_H_BASE_ - - -/* - A few words about all the classes defined in this file are probably in - order: why do we need extra wxComboCtrl and wxComboPopup classes? - - This is because a traditional combobox is a combination of a text control - (with a button allowing to open the pop down list) with a listbox and - wxComboBox class is exactly such control, however we want to also have other - combinations - in fact, we want to allow anything at all to be used as pop - down list, not just a wxListBox. - - So we define a base wxComboCtrl which can use any control as pop down - list and wxComboBox deriving from it which implements the standard wxWidgets - combobox API. wxComboCtrl needs to be told somehow which control to use - and this is done by SetPopupControl(). However, we need something more than - just a wxControl in this method as, for example, we need to call - SetSelection("initial text value") and wxControl doesn't have such method. - So we also need a wxComboPopup which is just a very simple interface which - must be implemented by a control to be usable as a popup. - - We couldn't derive wxComboPopup from wxControl as this would make it - impossible to have a class deriving from both wxListBx and from it, so - instead it is just a mix-in. - */ - - -#include "wx/defs.h" - -#if wxUSE_COMBOCTRL - -#include "wx/control.h" -#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags -#include "wx/bitmap.h" // wxBitmap used by-value - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxComboPopup; - -// -// New window styles for wxComboCtrlBase -// -enum -{ - // Double-clicking a read-only combo triggers call to popup's OnComboPopup. - // In wxOwnerDrawnComboBox, for instance, it cycles item. - wxCC_SPECIAL_DCLICK = 0x0100, - - // Dropbutton acts like standard push button. - wxCC_STD_BUTTON = 0x0200 -}; - - -// wxComboCtrl internal flags -enum -{ - // First those that can be passed to Customize. - // It is Windows style for all flags to be clear. - - // Button is preferred outside the border (GTK style) - wxCC_BUTTON_OUTSIDE_BORDER = 0x0001, - // Show popup on mouse up instead of mouse down (which is the Windows style) - wxCC_POPUP_ON_MOUSE_UP = 0x0002, - // All text is not automatically selected on click - wxCC_NO_TEXT_AUTO_SELECT = 0x0004, - - // Internal use: signals creation is complete - wxCC_IFLAG_CREATED = 0x0100, - // Internal use: really put button outside - wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, - // Internal use: SetTextIndent has been called - wxCC_IFLAG_INDENT_SET = 0x0400, - // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed - wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800, - // Internal use: Secondary popup window type should be used (if available). - wxCC_IFLAG_USE_ALT_POPUP = 0x1000, - // Internal use: Skip popup animation. - wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000 -}; - - -// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent -enum -{ - wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area - wxCC_MF_ON_CLICK_AREA = 0x0002 // cursor is on dropbutton or other area - // that can be clicked to show the popup. -}; - - -// Namespace for wxComboCtrl feature flags -struct wxComboCtrlFeatures -{ - enum - { - MovableButton = 0x0001, // Button can be on either side of control - BitmapButton = 0x0002, // Button may be replaced with bitmap - ButtonSpacing = 0x0004, // Button can have spacing from the edge - // of the control - TextIndent = 0x0008, // SetTextIndent can be used - PaintControl = 0x0010, // Combo control itself can be custom painted - PaintWritable = 0x0020, // A variable-width area in front of writable - // combo control's textctrl can be custom - // painted - Borderless = 0x0040, // wxNO_BORDER window style works - - // There are no feature flags for... - // PushButtonBitmapBackground - if its in wxRendererNative, then it should be - // not an issue to have it automatically under the bitmap. - - All = MovableButton|BitmapButton| - ButtonSpacing|TextIndent| - PaintControl|PaintWritable| - Borderless - }; -}; - - -class WXDLLEXPORT wxComboCtrlBase : public wxControl -{ - friend class wxComboPopup; -public: - // ctors and such - wxComboCtrlBase() : wxControl() { Init(); } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - - virtual ~wxComboCtrlBase(); - - // show/hide popup window - virtual void ShowPopup(); - virtual void HidePopup(); - - // Override for totally custom combo action - virtual void OnButtonClick(); - - // return true if the popup is currently shown - bool IsPopupShown() const { return m_popupWinState == Visible; } - - // set interface class instance derived from wxComboPopup - // NULL popup can be used to indicate default in a derived class - void SetPopupControl( wxComboPopup* popup ) - { - DoSetPopupControl(popup); - } - - // get interface class instance derived from wxComboPopup - wxComboPopup* GetPopupControl() - { - EnsurePopupControl(); - return m_popupInterface; - } - - // get the popup window containing the popup control - wxWindow *GetPopupWindow() const { return m_winPopup; } - - // Get the text control which is part of the combobox. - wxTextCtrl *GetTextCtrl() const { return m_text; } - - // get the dropdown button which is part of the combobox - // note: its not necessarily a wxButton or wxBitmapButton - wxWindow *GetButton() const { return m_btn; } - - // forward these methods to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - virtual bool SetFont(const wxFont& font); -#if wxUSE_VALIDATORS - virtual void SetValidator(const wxValidator &validator); - virtual wxValidator *GetValidator(); -#endif // wxUSE_VALIDATORS - - // wxTextCtrl methods - for readonly combo they should return - // without errors. - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(long from, long to); - virtual void Undo(); - - // This method sets the text without affecting list selection - // (ie. wxComboPopup::SetStringValue doesn't get called). - void SetText(const wxString& value); - - // This method sets value and also optionally sends EVT_TEXT - // (needed by combo popups) - void SetValueWithEvent(const wxString& value, bool withEvent = true); - - // - // Popup customization methods - // - - // Sets minimum width of the popup. If wider than combo control, it will extend to the left. - // Remarks: - // * Value -1 indicates the default. - // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). - void SetPopupMinWidth( int width ) - { - m_widthMinPopup = width; - } - - // Sets preferred maximum height of the popup. - // Remarks: - // * Value -1 indicates the default. - // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). - void SetPopupMaxHeight( int height ) - { - m_heightPopup = height; - } - - // Extends popup size horizontally, relative to the edges of the combo control. - // Remarks: - // * Popup minimum width may override extLeft (ie. it has higher precedence). - // * Values 0 indicate default. - // * Custom popup may not take this fully into account (wxOwnerDrawnComboBox takes). - void SetPopupExtents( int extLeft, int extRight ) - { - m_extLeft = extLeft; - m_extRight = extRight; - } - - // Set width, in pixels, of custom paint area in writable combo. - // In read-only, used to indicate area that is not covered by the - // focus rectangle (which may or may not be drawn, depending on the - // popup type). - void SetCustomPaintWidth( int width ); - int GetCustomPaintWidth() const { return m_widthCustomPaint; } - - // Set side of the control to which the popup will align itself. - // Valid values are wxLEFT, wxRIGHT and 0. The default value 0 wmeans - // that the side of the button will be used. - void SetPopupAnchor( int anchorSide ) - { - m_anchorSide = anchorSide; - } - - // Set position of dropdown button. - // width: button width. <= 0 for default. - // height: button height. <= 0 for default. - // side: wxLEFT or wxRIGHT, indicates on which side the button will be placed. - // spacingX: empty space on sides of the button. Default is 0. - // Remarks: - // There is no spacingY - the button will be centered vertically. - void SetButtonPosition( int width = -1, - int height = -1, - int side = wxRIGHT, - int spacingX = 0 ); - - // Returns current size of the dropdown button. - wxSize GetButtonSize(); - - // - // Sets dropbutton to be drawn with custom bitmaps. - // - // bmpNormal: drawn when cursor is not on button - // pushButtonBg: Draw push button background below the image. - // NOTE! This is usually only properly supported on platforms with appropriate - // method in wxRendererNative. - // bmpPressed: drawn when button is depressed - // bmpHover: drawn when cursor hovers on button. This is ignored on platforms - // that do not generally display hover differently. - // bmpDisabled: drawn when combobox is disabled. - void SetButtonBitmaps( const wxBitmap& bmpNormal, - bool pushButtonBg = false, - const wxBitmap& bmpPressed = wxNullBitmap, - const wxBitmap& bmpHover = wxNullBitmap, - const wxBitmap& bmpDisabled = wxNullBitmap ); - - // - // This will set the space in pixels between left edge of the control and the - // text, regardless whether control is read-only (ie. no wxTextCtrl) or not. - // Platform-specific default can be set with value-1. - // Remarks - // * This method may do nothing on some native implementations. - void SetTextIndent( int indent ); - - // Returns actual indentation in pixels. - wxCoord GetTextIndent() const - { - return m_absIndent; - } - - // Returns area covered by the text field. - const wxRect& GetTextRect() const - { - return m_tcArea; - } - - // Call with enable as true to use a type of popup window that guarantees ability - // to focus the popup control, and normal function of common native controls. - // This alternative popup window is usually a wxDialog, and as such it's parent - // frame will appear as if the focus has been lost from it. - void UseAltPopupWindow( bool enable = true ) - { - wxASSERT_MSG( !m_winPopup, - wxT("call this only before SetPopupControl") ); - - if ( enable ) - m_iFlags |= wxCC_IFLAG_USE_ALT_POPUP; - else - m_iFlags &= ~wxCC_IFLAG_USE_ALT_POPUP; - } - - // Call with false to disable popup animation, if any. - void EnablePopupAnimation( bool enable = true ) - { - if ( enable ) - m_iFlags &= ~wxCC_IFLAG_DISABLE_POPUP_ANIM; - else - m_iFlags |= wxCC_IFLAG_DISABLE_POPUP_ANIM; - } - - // - // Utilies needed by the popups or native implementations - // - - // Returns true if given key combination should toggle the popup. - // NB: This is a separate from other keyboard handling because: - // 1) Replaceability. - // 2) Centralized code (otherwise it'd be split up between - // wxComboCtrl key handler and wxVListBoxComboPopup's - // key handler). - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0; - - // Prepare background of combo control or an item in a dropdown list - // in a way typical on platform. This includes painting the focus/disabled - // background and setting the clipping region. - // Unless you plan to paint your own focus indicator, you should always call this - // in your wxComboPopup::PaintComboControl implementation. - // In addition, it sets pen and text colour to what looks good and proper - // against the background. - // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control - // wxCONTROL_SELECTED: list item is selected - // wxCONTROL_DISABLED: control/item is disabled - virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; - - // Returns true if focus indicator should be drawn in the control. - bool ShouldDrawFocus() const - { - const wxWindow* curFocus = FindFocus(); - return ( !IsPopupShown() && - (curFocus == this || (m_btn && curFocus == m_btn)) && - (m_windowStyle & wxCB_READONLY) ); - } - - // These methods return references to appropriate dropbutton bitmaps - const wxBitmap& GetBitmapNormal() const { return m_bmpNormal; } - const wxBitmap& GetBitmapPressed() const { return m_bmpPressed; } - const wxBitmap& GetBitmapHover() const { return m_bmpHover; } - const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } - - // Return internal flags - wxUint32 GetInternalFlags() const { return m_iFlags; } - - // Return true if Create has finished - bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; } - - // common code to be called on popup hide/dismiss - void OnPopupDismiss(); - - // PopupShown states - enum - { - Hidden = 0, - //Closing = 1, - Animating = 2, - Visible = 3 - }; - - bool IsPopupWindowState( int state ) const { return (state == m_popupWinState) ? true : false; } - - wxByte GetPopupWindowState() const { return m_popupWinState; } - - // Set value returned by GetMainWindowOfCompositeControl - void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; } - -protected: - - // - // Override these for customization purposes - // - - // called from wxSizeEvent handler - virtual void OnResize() = 0; - - // Return native text identation (for pure text, not textctrl) - virtual wxCoord GetNativeTextIndent() const; - - // Called in syscolourchanged handler and base create - virtual void OnThemeChange(); - - // Creates wxTextCtrl. - // extraStyle: Extra style parameters - void CreateTextCtrl( int extraStyle, const wxValidator& validator ); - - // Installs standard input handler to combo (and optionally to the textctrl) - void InstallInputHandlers(); - - // flags for DrawButton() - enum - { - Draw_PaintBg = 1 - }; - - // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. - void DrawButton( wxDC& dc, const wxRect& rect, int flags = Draw_PaintBg ); - - // Call if cursor is on button area or mouse is captured for the button. - //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside ); - bool HandleButtonMouseEvent( wxMouseEvent& event, int flags ); - - // returns true if event was consumed or filtered (event type is also set to 0 in this case) - bool PreprocessMouseEvent( wxMouseEvent& event, int flags ); - - // - // This will handle left_down and left_dclick events outside button in a Windows-like manner. - // If you need alternate behaviour, it is recommended you manipulate and filter events to it - // instead of building your own handling routine (for reference, on wxEVT_LEFT_DOWN it will - // toggle popup and on wxEVT_LEFT_DCLICK it will do the same or run the popup's dclick method, - // if defined - you should pass events of other types of it for common processing). - void HandleNormalMouseEvent( wxMouseEvent& event ); - - // Creates popup window, calls interface->Create(), etc - void CreatePopup(); - - // Destroy popup window and all related constructs - void DestroyPopup(); - - // override the base class virtuals involved in geometry calculations - virtual wxSize DoGetBestSize() const; - - // NULL popup can be used to indicate default in a derived class - virtual void DoSetPopupControl(wxComboPopup* popup); - - // ensures there is atleast the default popup - void EnsurePopupControl(); - - // Recalculates button and textctrl areas. Called when size or button setup change. - // btnWidth: default/calculated width of the dropbutton. 0 means unchanged, - // just recalculate. - void CalculateAreas( int btnWidth = 0 ); - - // Standard textctrl positioning routine. Just give it platform-dependant - // textctrl coordinate adjustment. - void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); - - // event handlers - void OnSizeEvent( wxSizeEvent& event ); - void OnFocusEvent(wxFocusEvent& event); - void OnIdleEvent(wxIdleEvent& event); - void OnTextCtrlEvent(wxCommandEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnKeyEvent(wxKeyEvent& event); - - // Set customization flags (directs how wxComboCtrlBase helpers behave) - void Customize( wxUint32 flags ) { m_iFlags |= flags; } - - // Dispatches size event and refreshes - void RecalcAndRefresh(); - - // Flags for DoShowPopup and AnimateShow - enum - { - ShowBelow = 0x0000, // Showing popup below the control - ShowAbove = 0x0001, // Showing popup above the control - CanDeferShow = 0x0002 // Can only return true from AnimateShow if this is set - }; - - // Shows and positions the popup. - virtual void DoShowPopup( const wxRect& rect, int flags ); - - // Implement in derived class to create a drop-down animation. - // Return true if finished immediately. Otherwise popup is only - // shown when the derived class call DoShowPopup. - // Flags are same as for DoShowPopup. - virtual bool AnimateShow( const wxRect& rect, int flags ); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif - - virtual wxWindow *GetMainWindowOfCompositeControl() - { return m_mainCtrlWnd; } - - // This is used when m_text is hidden (readonly). - wxString m_valueString; - - // the text control and button we show all the time - wxTextCtrl* m_text; - wxWindow* m_btn; - - // wxPopupWindow or similar containing the window managed by the interface. - wxWindow* m_winPopup; - - // the popup control/panel - wxWindow* m_popup; - - // popup interface - wxComboPopup* m_popupInterface; - - // this is input etc. handler for the text control - wxEvtHandler* m_textEvtHandler; - - // this is for the top level window - wxEvtHandler* m_toplevEvtHandler; - - // this is for the control in popup - wxEvtHandler* m_popupExtraHandler; - - // this is for the popup window - wxEvtHandler* m_popupWinEvtHandler; - - // main (ie. topmost) window of a composite control (default = this) - wxWindow* m_mainCtrlWnd; - - // used to prevent immediate re-popupping incase closed popup - // by clicking on the combo control (needed because of inconsistent - // transient implementation across platforms). - wxLongLong m_timeCanAcceptClick; - - // how much popup should expand to the left/right of the control - wxCoord m_extLeft; - wxCoord m_extRight; - - // minimum popup width - wxCoord m_widthMinPopup; - - // preferred popup height - wxCoord m_heightPopup; - - // how much of writable combo is custom-paint by callback? - // also used to indicate area that is not covered by "blue" - // selection indicator. - wxCoord m_widthCustomPaint; - - // absolute text indentation, in pixels - wxCoord m_absIndent; - - // side on which the popup is aligned - int m_anchorSide; - - // Width of the "fake" border - wxCoord m_widthCustomBorder; - - // The button and textctrl click/paint areas - wxRect m_tcArea; - wxRect m_btnArea; - - // current button state (uses renderer flags) - int m_btnState; - - // button position - int m_btnWid; - int m_btnHei; - int m_btnSide; - int m_btnSpacingX; - - // last default button width - int m_btnWidDefault; - - // custom dropbutton bitmaps - wxBitmap m_bmpNormal; - wxBitmap m_bmpPressed; - wxBitmap m_bmpHover; - wxBitmap m_bmpDisabled; - - // area used by the button - wxSize m_btnSize; - - // platform-dependant customization and other flags - wxUint32 m_iFlags; - - // draw blank button background under bitmap? - bool m_blankButtonBg; - - // is the popup window currenty shown? - wxByte m_popupWinState; - - // should the focus be reset to the textctrl in idle time? - bool m_resetFocus; - -private: - void Init(); - - wxByte m_ignoreEvtText; // Number of next EVT_TEXTs to ignore - - // Is popup window wxPopupTransientWindow, wxPopupWindow or wxDialog? - wxByte m_popupWinType; - - DECLARE_EVENT_TABLE() - - DECLARE_ABSTRACT_CLASS(wxComboCtrlBase) -}; - - -// ---------------------------------------------------------------------------- -// wxComboPopup is the interface which must be implemented by a control to be -// used as a popup by wxComboCtrl -// ---------------------------------------------------------------------------- - - -// wxComboPopup internal flags -enum -{ - wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called -}; - - -class WXDLLEXPORT wxComboPopup -{ - friend class wxComboCtrlBase; -public: - wxComboPopup() - { - m_combo = (wxComboCtrlBase*) NULL; - m_iFlags = 0; - } - - // This is called immediately after construction finishes. m_combo member - // variable has been initialized before the call. - // NOTE: It is not in constructor so the derived class doesn't need to redefine - // a default constructor of its own. - virtual void Init() { } - - virtual ~wxComboPopup(); - - // Create the popup child control. - // Return true for success. - virtual bool Create(wxWindow* parent) = 0; - - // We must have an associated control which is subclassed by the combobox. - virtual wxWindow *GetControl() = 0; - - // Called immediately after the popup is shown - virtual void OnPopup(); - - // Called when popup is dismissed - virtual void OnDismiss(); - - // Called just prior to displaying popup. - // Default implementation does nothing. - virtual void SetStringValue( const wxString& value ); - - // Gets displayed string representation of the value. - virtual wxString GetStringValue() const = 0; - - // This is called to custom paint in the combo control itself (ie. not the popup). - // Default implementation draws value as string. - virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); - - // Receives key events from the parent wxComboCtrl. - // Events not handled should be skipped, as usual. - virtual void OnComboKeyEvent( wxKeyEvent& event ); - - // Implement if you need to support special action when user - // double-clicks on the parent wxComboCtrl. - virtual void OnComboDoubleClick(); - - // Return final size of popup. Called on every popup, just prior to OnShow. - // minWidth = preferred minimum width for window - // prefHeight = preferred height. Only applies if > 0, - // maxHeight = max height for window, as limited by screen size - // and should only be rounded down, if necessary. - virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); - - // Return true if you want delay call to Create until the popup is shown - // for the first time. It is more efficient, but note that it is often - // more convenient to have the control created immediately. - // Default returns false. - virtual bool LazyCreate(); - - // - // Utilies - // - - // Hides the popup - void Dismiss(); - - // Returns true if Create has been called. - bool IsCreated() const - { - return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false; - } - - // Default PaintComboControl behaviour - static void DefaultPaintComboControl( wxComboCtrlBase* combo, - wxDC& dc, - const wxRect& rect ); - -protected: - wxComboCtrlBase* m_combo; - wxUint32 m_iFlags; - -private: - // Called in wxComboCtrlBase::SetPopupControl - void InitBase(wxComboCtrlBase *combo) - { - m_combo = combo; - } -}; - - -// ---------------------------------------------------------------------------- -// include the platform-dependent header defining the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - // No native universal (but it must still be first in the list) -#elif defined(__WXMSW__) - #include "wx/msw/combo.h" -#endif - -// Any ports may need generic as an alternative -#include "wx/generic/combo.h" - -#endif // wxUSE_COMBOCTRL - -#endif - // _WX_COMBOCONTROL_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/combo.h +// Purpose: wxComboCtrl declaration +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id: combo.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOCONTROL_H_BASE_ +#define _WX_COMBOCONTROL_H_BASE_ + + +/* + A few words about all the classes defined in this file are probably in + order: why do we need extra wxComboCtrl and wxComboPopup classes? + + This is because a traditional combobox is a combination of a text control + (with a button allowing to open the pop down list) with a listbox and + wxComboBox class is exactly such control, however we want to also have other + combinations - in fact, we want to allow anything at all to be used as pop + down list, not just a wxListBox. + + So we define a base wxComboCtrl which can use any control as pop down + list and wxComboBox deriving from it which implements the standard wxWidgets + combobox API. wxComboCtrl needs to be told somehow which control to use + and this is done by SetPopupControl(). However, we need something more than + just a wxControl in this method as, for example, we need to call + SetSelection("initial text value") and wxControl doesn't have such method. + So we also need a wxComboPopup which is just a very simple interface which + must be implemented by a control to be usable as a popup. + + We couldn't derive wxComboPopup from wxControl as this would make it + impossible to have a class deriving from both wxListBx and from it, so + instead it is just a mix-in. + */ + + +#include "wx/defs.h" + +#if wxUSE_COMBOCTRL + +#include "wx/control.h" +#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags +#include "wx/bitmap.h" // wxBitmap used by-value + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxComboPopup; + +// +// New window styles for wxComboCtrlBase +// +enum +{ + // Double-clicking a read-only combo triggers call to popup's OnComboPopup. + // In wxOwnerDrawnComboBox, for instance, it cycles item. + wxCC_SPECIAL_DCLICK = 0x0100, + + // Dropbutton acts like standard push button. + wxCC_STD_BUTTON = 0x0200 +}; + + +// wxComboCtrl internal flags +enum +{ + // First those that can be passed to Customize. + // It is Windows style for all flags to be clear. + + // Button is preferred outside the border (GTK style) + wxCC_BUTTON_OUTSIDE_BORDER = 0x0001, + // Show popup on mouse up instead of mouse down (which is the Windows style) + wxCC_POPUP_ON_MOUSE_UP = 0x0002, + // All text is not automatically selected on click + wxCC_NO_TEXT_AUTO_SELECT = 0x0004, + + // Internal use: signals creation is complete + wxCC_IFLAG_CREATED = 0x0100, + // Internal use: really put button outside + wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, + // Internal use: SetTextIndent has been called + wxCC_IFLAG_INDENT_SET = 0x0400, + // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed + wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800, + // Internal use: Secondary popup window type should be used (if available). + wxCC_IFLAG_USE_ALT_POPUP = 0x1000, + // Internal use: Skip popup animation. + wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000 +}; + + +// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent +enum +{ + wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area + wxCC_MF_ON_CLICK_AREA = 0x0002 // cursor is on dropbutton or other area + // that can be clicked to show the popup. +}; + + +// Namespace for wxComboCtrl feature flags +struct wxComboCtrlFeatures +{ + enum + { + MovableButton = 0x0001, // Button can be on either side of control + BitmapButton = 0x0002, // Button may be replaced with bitmap + ButtonSpacing = 0x0004, // Button can have spacing from the edge + // of the control + TextIndent = 0x0008, // SetTextIndent can be used + PaintControl = 0x0010, // Combo control itself can be custom painted + PaintWritable = 0x0020, // A variable-width area in front of writable + // combo control's textctrl can be custom + // painted + Borderless = 0x0040, // wxNO_BORDER window style works + + // There are no feature flags for... + // PushButtonBitmapBackground - if its in wxRendererNative, then it should be + // not an issue to have it automatically under the bitmap. + + All = MovableButton|BitmapButton| + ButtonSpacing|TextIndent| + PaintControl|PaintWritable| + Borderless + }; +}; + + +class WXDLLEXPORT wxComboCtrlBase : public wxControl +{ + friend class wxComboPopup; +public: + // ctors and such + wxComboCtrlBase() : wxControl() { Init(); } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + + virtual ~wxComboCtrlBase(); + + // show/hide popup window + virtual void ShowPopup(); + virtual void HidePopup(); + + // Override for totally custom combo action + virtual void OnButtonClick(); + + // return true if the popup is currently shown + bool IsPopupShown() const { return m_popupWinState == Visible; } + + // set interface class instance derived from wxComboPopup + // NULL popup can be used to indicate default in a derived class + void SetPopupControl( wxComboPopup* popup ) + { + DoSetPopupControl(popup); + } + + // get interface class instance derived from wxComboPopup + wxComboPopup* GetPopupControl() + { + EnsurePopupControl(); + return m_popupInterface; + } + + // get the popup window containing the popup control + wxWindow *GetPopupWindow() const { return m_winPopup; } + + // Get the text control which is part of the combobox. + wxTextCtrl *GetTextCtrl() const { return m_text; } + + // get the dropdown button which is part of the combobox + // note: its not necessarily a wxButton or wxBitmapButton + wxWindow *GetButton() const { return m_btn; } + + // forward these methods to all subcontrols + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + virtual bool SetFont(const wxFont& font); +#if wxUSE_VALIDATORS + virtual void SetValidator(const wxValidator &validator); + virtual wxValidator *GetValidator(); +#endif // wxUSE_VALIDATORS + + // wxTextCtrl methods - for readonly combo they should return + // without errors. + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(long from, long to); + virtual void Undo(); + + // This method sets the text without affecting list selection + // (ie. wxComboPopup::SetStringValue doesn't get called). + void SetText(const wxString& value); + + // This method sets value and also optionally sends EVT_TEXT + // (needed by combo popups) + void SetValueWithEvent(const wxString& value, bool withEvent = true); + + // + // Popup customization methods + // + + // Sets minimum width of the popup. If wider than combo control, it will extend to the left. + // Remarks: + // * Value -1 indicates the default. + // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). + void SetPopupMinWidth( int width ) + { + m_widthMinPopup = width; + } + + // Sets preferred maximum height of the popup. + // Remarks: + // * Value -1 indicates the default. + // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). + void SetPopupMaxHeight( int height ) + { + m_heightPopup = height; + } + + // Extends popup size horizontally, relative to the edges of the combo control. + // Remarks: + // * Popup minimum width may override extLeft (ie. it has higher precedence). + // * Values 0 indicate default. + // * Custom popup may not take this fully into account (wxOwnerDrawnComboBox takes). + void SetPopupExtents( int extLeft, int extRight ) + { + m_extLeft = extLeft; + m_extRight = extRight; + } + + // Set width, in pixels, of custom paint area in writable combo. + // In read-only, used to indicate area that is not covered by the + // focus rectangle (which may or may not be drawn, depending on the + // popup type). + void SetCustomPaintWidth( int width ); + int GetCustomPaintWidth() const { return m_widthCustomPaint; } + + // Set side of the control to which the popup will align itself. + // Valid values are wxLEFT, wxRIGHT and 0. The default value 0 wmeans + // that the side of the button will be used. + void SetPopupAnchor( int anchorSide ) + { + m_anchorSide = anchorSide; + } + + // Set position of dropdown button. + // width: button width. <= 0 for default. + // height: button height. <= 0 for default. + // side: wxLEFT or wxRIGHT, indicates on which side the button will be placed. + // spacingX: empty space on sides of the button. Default is 0. + // Remarks: + // There is no spacingY - the button will be centered vertically. + void SetButtonPosition( int width = -1, + int height = -1, + int side = wxRIGHT, + int spacingX = 0 ); + + // Returns current size of the dropdown button. + wxSize GetButtonSize(); + + // + // Sets dropbutton to be drawn with custom bitmaps. + // + // bmpNormal: drawn when cursor is not on button + // pushButtonBg: Draw push button background below the image. + // NOTE! This is usually only properly supported on platforms with appropriate + // method in wxRendererNative. + // bmpPressed: drawn when button is depressed + // bmpHover: drawn when cursor hovers on button. This is ignored on platforms + // that do not generally display hover differently. + // bmpDisabled: drawn when combobox is disabled. + void SetButtonBitmaps( const wxBitmap& bmpNormal, + bool pushButtonBg = false, + const wxBitmap& bmpPressed = wxNullBitmap, + const wxBitmap& bmpHover = wxNullBitmap, + const wxBitmap& bmpDisabled = wxNullBitmap ); + + // + // This will set the space in pixels between left edge of the control and the + // text, regardless whether control is read-only (ie. no wxTextCtrl) or not. + // Platform-specific default can be set with value-1. + // Remarks + // * This method may do nothing on some native implementations. + void SetTextIndent( int indent ); + + // Returns actual indentation in pixels. + wxCoord GetTextIndent() const + { + return m_absIndent; + } + + // Returns area covered by the text field. + const wxRect& GetTextRect() const + { + return m_tcArea; + } + + // Call with enable as true to use a type of popup window that guarantees ability + // to focus the popup control, and normal function of common native controls. + // This alternative popup window is usually a wxDialog, and as such it's parent + // frame will appear as if the focus has been lost from it. + void UseAltPopupWindow( bool enable = true ) + { + wxASSERT_MSG( !m_winPopup, + wxT("call this only before SetPopupControl") ); + + if ( enable ) + m_iFlags |= wxCC_IFLAG_USE_ALT_POPUP; + else + m_iFlags &= ~wxCC_IFLAG_USE_ALT_POPUP; + } + + // Call with false to disable popup animation, if any. + void EnablePopupAnimation( bool enable = true ) + { + if ( enable ) + m_iFlags &= ~wxCC_IFLAG_DISABLE_POPUP_ANIM; + else + m_iFlags |= wxCC_IFLAG_DISABLE_POPUP_ANIM; + } + + // + // Utilies needed by the popups or native implementations + // + + // Returns true if given key combination should toggle the popup. + // NB: This is a separate from other keyboard handling because: + // 1) Replaceability. + // 2) Centralized code (otherwise it'd be split up between + // wxComboCtrl key handler and wxVListBoxComboPopup's + // key handler). + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0; + + // Prepare background of combo control or an item in a dropdown list + // in a way typical on platform. This includes painting the focus/disabled + // background and setting the clipping region. + // Unless you plan to paint your own focus indicator, you should always call this + // in your wxComboPopup::PaintComboControl implementation. + // In addition, it sets pen and text colour to what looks good and proper + // against the background. + // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control + // wxCONTROL_SELECTED: list item is selected + // wxCONTROL_DISABLED: control/item is disabled + virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; + + // Returns true if focus indicator should be drawn in the control. + bool ShouldDrawFocus() const + { + const wxWindow* curFocus = FindFocus(); + return ( !IsPopupShown() && + (curFocus == this || (m_btn && curFocus == m_btn)) && + (m_windowStyle & wxCB_READONLY) ); + } + + // These methods return references to appropriate dropbutton bitmaps + const wxBitmap& GetBitmapNormal() const { return m_bmpNormal; } + const wxBitmap& GetBitmapPressed() const { return m_bmpPressed; } + const wxBitmap& GetBitmapHover() const { return m_bmpHover; } + const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } + + // Return internal flags + wxUint32 GetInternalFlags() const { return m_iFlags; } + + // Return true if Create has finished + bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; } + + // common code to be called on popup hide/dismiss + void OnPopupDismiss(); + + // PopupShown states + enum + { + Hidden = 0, + //Closing = 1, + Animating = 2, + Visible = 3 + }; + + bool IsPopupWindowState( int state ) const { return (state == m_popupWinState) ? true : false; } + + wxByte GetPopupWindowState() const { return m_popupWinState; } + + // Set value returned by GetMainWindowOfCompositeControl + void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; } + +protected: + + // + // Override these for customization purposes + // + + // called from wxSizeEvent handler + virtual void OnResize() = 0; + + // Return native text identation (for pure text, not textctrl) + virtual wxCoord GetNativeTextIndent() const; + + // Called in syscolourchanged handler and base create + virtual void OnThemeChange(); + + // Creates wxTextCtrl. + // extraStyle: Extra style parameters + void CreateTextCtrl( int extraStyle, const wxValidator& validator ); + + // Installs standard input handler to combo (and optionally to the textctrl) + void InstallInputHandlers(); + + // flags for DrawButton() + enum + { + Draw_PaintBg = 1 + }; + + // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. + void DrawButton( wxDC& dc, const wxRect& rect, int flags = Draw_PaintBg ); + + // Call if cursor is on button area or mouse is captured for the button. + //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside ); + bool HandleButtonMouseEvent( wxMouseEvent& event, int flags ); + + // returns true if event was consumed or filtered (event type is also set to 0 in this case) + bool PreprocessMouseEvent( wxMouseEvent& event, int flags ); + + // + // This will handle left_down and left_dclick events outside button in a Windows-like manner. + // If you need alternate behaviour, it is recommended you manipulate and filter events to it + // instead of building your own handling routine (for reference, on wxEVT_LEFT_DOWN it will + // toggle popup and on wxEVT_LEFT_DCLICK it will do the same or run the popup's dclick method, + // if defined - you should pass events of other types of it for common processing). + void HandleNormalMouseEvent( wxMouseEvent& event ); + + // Creates popup window, calls interface->Create(), etc + void CreatePopup(); + + // Destroy popup window and all related constructs + void DestroyPopup(); + + // override the base class virtuals involved in geometry calculations + virtual wxSize DoGetBestSize() const; + + // NULL popup can be used to indicate default in a derived class + virtual void DoSetPopupControl(wxComboPopup* popup); + + // ensures there is atleast the default popup + void EnsurePopupControl(); + + // Recalculates button and textctrl areas. Called when size or button setup change. + // btnWidth: default/calculated width of the dropbutton. 0 means unchanged, + // just recalculate. + void CalculateAreas( int btnWidth = 0 ); + + // Standard textctrl positioning routine. Just give it platform-dependant + // textctrl coordinate adjustment. + void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); + + // event handlers + void OnSizeEvent( wxSizeEvent& event ); + void OnFocusEvent(wxFocusEvent& event); + void OnIdleEvent(wxIdleEvent& event); + void OnTextCtrlEvent(wxCommandEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnKeyEvent(wxKeyEvent& event); + + // Set customization flags (directs how wxComboCtrlBase helpers behave) + void Customize( wxUint32 flags ) { m_iFlags |= flags; } + + // Dispatches size event and refreshes + void RecalcAndRefresh(); + + // Flags for DoShowPopup and AnimateShow + enum + { + ShowBelow = 0x0000, // Showing popup below the control + ShowAbove = 0x0001, // Showing popup above the control + CanDeferShow = 0x0002 // Can only return true from AnimateShow if this is set + }; + + // Shows and positions the popup. + virtual void DoShowPopup( const wxRect& rect, int flags ); + + // Implement in derived class to create a drop-down animation. + // Return true if finished immediately. Otherwise popup is only + // shown when the derived class call DoShowPopup. + // Flags are same as for DoShowPopup. + virtual bool AnimateShow( const wxRect& rect, int flags ); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif + + virtual wxWindow *GetMainWindowOfCompositeControl() + { return m_mainCtrlWnd; } + + // This is used when m_text is hidden (readonly). + wxString m_valueString; + + // the text control and button we show all the time + wxTextCtrl* m_text; + wxWindow* m_btn; + + // wxPopupWindow or similar containing the window managed by the interface. + wxWindow* m_winPopup; + + // the popup control/panel + wxWindow* m_popup; + + // popup interface + wxComboPopup* m_popupInterface; + + // this is input etc. handler for the text control + wxEvtHandler* m_textEvtHandler; + + // this is for the top level window + wxEvtHandler* m_toplevEvtHandler; + + // this is for the control in popup + wxEvtHandler* m_popupExtraHandler; + + // this is for the popup window + wxEvtHandler* m_popupWinEvtHandler; + + // main (ie. topmost) window of a composite control (default = this) + wxWindow* m_mainCtrlWnd; + + // used to prevent immediate re-popupping incase closed popup + // by clicking on the combo control (needed because of inconsistent + // transient implementation across platforms). + wxLongLong m_timeCanAcceptClick; + + // how much popup should expand to the left/right of the control + wxCoord m_extLeft; + wxCoord m_extRight; + + // minimum popup width + wxCoord m_widthMinPopup; + + // preferred popup height + wxCoord m_heightPopup; + + // how much of writable combo is custom-paint by callback? + // also used to indicate area that is not covered by "blue" + // selection indicator. + wxCoord m_widthCustomPaint; + + // absolute text indentation, in pixels + wxCoord m_absIndent; + + // side on which the popup is aligned + int m_anchorSide; + + // Width of the "fake" border + wxCoord m_widthCustomBorder; + + // The button and textctrl click/paint areas + wxRect m_tcArea; + wxRect m_btnArea; + + // current button state (uses renderer flags) + int m_btnState; + + // button position + int m_btnWid; + int m_btnHei; + int m_btnSide; + int m_btnSpacingX; + + // last default button width + int m_btnWidDefault; + + // custom dropbutton bitmaps + wxBitmap m_bmpNormal; + wxBitmap m_bmpPressed; + wxBitmap m_bmpHover; + wxBitmap m_bmpDisabled; + + // area used by the button + wxSize m_btnSize; + + // platform-dependant customization and other flags + wxUint32 m_iFlags; + + // draw blank button background under bitmap? + bool m_blankButtonBg; + + // is the popup window currenty shown? + wxByte m_popupWinState; + + // should the focus be reset to the textctrl in idle time? + bool m_resetFocus; + +private: + void Init(); + + wxByte m_ignoreEvtText; // Number of next EVT_TEXTs to ignore + + // Is popup window wxPopupTransientWindow, wxPopupWindow or wxDialog? + wxByte m_popupWinType; + + DECLARE_EVENT_TABLE() + + DECLARE_ABSTRACT_CLASS(wxComboCtrlBase) +}; + + +// ---------------------------------------------------------------------------- +// wxComboPopup is the interface which must be implemented by a control to be +// used as a popup by wxComboCtrl +// ---------------------------------------------------------------------------- + + +// wxComboPopup internal flags +enum +{ + wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called +}; + + +class WXDLLEXPORT wxComboPopup +{ + friend class wxComboCtrlBase; +public: + wxComboPopup() + { + m_combo = (wxComboCtrlBase*) NULL; + m_iFlags = 0; + } + + // This is called immediately after construction finishes. m_combo member + // variable has been initialized before the call. + // NOTE: It is not in constructor so the derived class doesn't need to redefine + // a default constructor of its own. + virtual void Init() { } + + virtual ~wxComboPopup(); + + // Create the popup child control. + // Return true for success. + virtual bool Create(wxWindow* parent) = 0; + + // We must have an associated control which is subclassed by the combobox. + virtual wxWindow *GetControl() = 0; + + // Called immediately after the popup is shown + virtual void OnPopup(); + + // Called when popup is dismissed + virtual void OnDismiss(); + + // Called just prior to displaying popup. + // Default implementation does nothing. + virtual void SetStringValue( const wxString& value ); + + // Gets displayed string representation of the value. + virtual wxString GetStringValue() const = 0; + + // This is called to custom paint in the combo control itself (ie. not the popup). + // Default implementation draws value as string. + virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); + + // Receives key events from the parent wxComboCtrl. + // Events not handled should be skipped, as usual. + virtual void OnComboKeyEvent( wxKeyEvent& event ); + + // Implement if you need to support special action when user + // double-clicks on the parent wxComboCtrl. + virtual void OnComboDoubleClick(); + + // Return final size of popup. Called on every popup, just prior to OnShow. + // minWidth = preferred minimum width for window + // prefHeight = preferred height. Only applies if > 0, + // maxHeight = max height for window, as limited by screen size + // and should only be rounded down, if necessary. + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); + + // Return true if you want delay call to Create until the popup is shown + // for the first time. It is more efficient, but note that it is often + // more convenient to have the control created immediately. + // Default returns false. + virtual bool LazyCreate(); + + // + // Utilies + // + + // Hides the popup + void Dismiss(); + + // Returns true if Create has been called. + bool IsCreated() const + { + return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false; + } + + // Default PaintComboControl behaviour + static void DefaultPaintComboControl( wxComboCtrlBase* combo, + wxDC& dc, + const wxRect& rect ); + +protected: + wxComboCtrlBase* m_combo; + wxUint32 m_iFlags; + +private: + // Called in wxComboCtrlBase::SetPopupControl + void InitBase(wxComboCtrlBase *combo) + { + m_combo = combo; + } +}; + + +// ---------------------------------------------------------------------------- +// include the platform-dependent header defining the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + // No native universal (but it must still be first in the list) +#elif defined(__WXMSW__) + #include "wx/msw/combo.h" +#endif + +// Any ports may need generic as an alternative +#include "wx/generic/combo.h" + +#endif // wxUSE_COMBOCTRL + +#endif + // _WX_COMBOCONTROL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/combobox.h b/Externals/wxWidgets/include/wx/combobox.h index af84fb668a..1b31705675 100644 --- a/Externals/wxWidgets/include/wx/combobox.h +++ b/Externals/wxWidgets/include/wx/combobox.h @@ -1,97 +1,97 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/combobox.h -// Purpose: wxComboBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 24.12.00 -// RCS-ID: $Id: combobox.h 42727 2006-10-30 16:04:27Z VZ $ -// Copyright: (c) 1996-2000 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOBOX_H_BASE_ -#define _WX_COMBOBOX_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_COMBOBOX - -extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxComboBoxBase: this interface defines the methods wxComboBox must implement -// ---------------------------------------------------------------------------- - -#include "wx/textctrl.h" -#include "wx/ctrlsub.h" - -class WXDLLEXPORT wxComboBoxBase : public wxItemContainer -{ -public: - // wxTextCtrl-like methods wxComboBox must implement - virtual wxString GetValue() const = 0; - virtual void SetValue(const wxString& value) = 0; - - virtual void Copy() = 0; - virtual void Cut() = 0; - virtual void Paste() = 0; - virtual void SetInsertionPoint(long pos) = 0; - virtual long GetInsertionPoint() const = 0; - virtual wxTextPos GetLastPosition() const = 0; - virtual void Replace(long from, long to, const wxString& value) = 0; - virtual void SetSelection(long from, long to) = 0; - virtual void SetEditable(bool editable) = 0; - - virtual void SetInsertionPointEnd() - { SetInsertionPoint(GetLastPosition()); } - virtual void Remove(long from, long to) - { Replace(from, to, wxEmptyString); } - - virtual bool IsEditable() const = 0; - - virtual void Undo() = 0; - virtual void Redo() = 0; - virtual void SelectAll() = 0; - - virtual bool CanCopy() const = 0; - virtual bool CanCut() const = 0; - virtual bool CanPaste() const = 0; - virtual bool CanUndo() const = 0; - virtual bool CanRedo() const = 0; - - // may return value different from GetSelection() when the combobox - // dropdown is shown and the user selected, but not yet accepted, a value - // different from the old one in it - virtual int GetCurrentSelection() const { return GetSelection(); } - - // redeclare inherited SetSelection() overload here as well to avoid - // virtual function hiding - virtual void SetSelection(int n) = 0; -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent header defining the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/combobox.h" -#elif defined(__WXMSW__) - #include "wx/msw/combobox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/combobox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/combobox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/combobox.h" -#elif defined(__WXMAC__) - #include "wx/mac/combobox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/combobox.h" -#elif defined(__WXPM__) - #include "wx/os2/combobox.h" -#endif - -#endif // wxUSE_COMBOBOX - -#endif - // _WX_COMBOBOX_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/combobox.h +// Purpose: wxComboBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 24.12.00 +// RCS-ID: $Id: combobox.h 42727 2006-10-30 16:04:27Z VZ $ +// Copyright: (c) 1996-2000 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_BASE_ +#define _WX_COMBOBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_COMBOBOX + +extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxComboBoxBase: this interface defines the methods wxComboBox must implement +// ---------------------------------------------------------------------------- + +#include "wx/textctrl.h" +#include "wx/ctrlsub.h" + +class WXDLLEXPORT wxComboBoxBase : public wxItemContainer +{ +public: + // wxTextCtrl-like methods wxComboBox must implement + virtual wxString GetValue() const = 0; + virtual void SetValue(const wxString& value) = 0; + + virtual void Copy() = 0; + virtual void Cut() = 0; + virtual void Paste() = 0; + virtual void SetInsertionPoint(long pos) = 0; + virtual long GetInsertionPoint() const = 0; + virtual wxTextPos GetLastPosition() const = 0; + virtual void Replace(long from, long to, const wxString& value) = 0; + virtual void SetSelection(long from, long to) = 0; + virtual void SetEditable(bool editable) = 0; + + virtual void SetInsertionPointEnd() + { SetInsertionPoint(GetLastPosition()); } + virtual void Remove(long from, long to) + { Replace(from, to, wxEmptyString); } + + virtual bool IsEditable() const = 0; + + virtual void Undo() = 0; + virtual void Redo() = 0; + virtual void SelectAll() = 0; + + virtual bool CanCopy() const = 0; + virtual bool CanCut() const = 0; + virtual bool CanPaste() const = 0; + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; + + // may return value different from GetSelection() when the combobox + // dropdown is shown and the user selected, but not yet accepted, a value + // different from the old one in it + virtual int GetCurrentSelection() const { return GetSelection(); } + + // redeclare inherited SetSelection() overload here as well to avoid + // virtual function hiding + virtual void SetSelection(int n) = 0; +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent header defining the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/combobox.h" +#elif defined(__WXMSW__) + #include "wx/msw/combobox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/combobox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/combobox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/combobox.h" +#elif defined(__WXMAC__) + #include "wx/mac/combobox.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/combobox.h" +#elif defined(__WXPM__) + #include "wx/os2/combobox.h" +#endif + +#endif // wxUSE_COMBOBOX + +#endif + // _WX_COMBOBOX_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/confbase.h b/Externals/wxWidgets/include/wx/confbase.h index c17e84caf7..9e0cf54b51 100644 --- a/Externals/wxWidgets/include/wx/confbase.h +++ b/Externals/wxWidgets/include/wx/confbase.h @@ -1,359 +1,359 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: confbase.h -// Purpose: declaration of the base class of all config implementations -// (see also: fileconf.h and msw/regconf.h and iniconf.h) -// Author: Karsten Ballueder & Vadim Zeitlin -// Modified by: -// Created: 07.04.98 (adapted from appconf.h) -// RCS-ID: $Id: confbase.h 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net -// Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONFBASE_H_ -#define _WX_CONFBASE_H_ - -#include "wx/defs.h" -#include "wx/string.h" - -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -/// shall we be case sensitive in parsing variable names? -#ifndef wxCONFIG_CASE_SENSITIVE - #define wxCONFIG_CASE_SENSITIVE 0 -#endif - -/// separates group and entry names (probably shouldn't be changed) -#ifndef wxCONFIG_PATH_SEPARATOR - #define wxCONFIG_PATH_SEPARATOR _T('/') -#endif - -/// introduces immutable entries -// (i.e. the ones which can't be changed from the local config file) -#ifndef wxCONFIG_IMMUTABLE_PREFIX - #define wxCONFIG_IMMUTABLE_PREFIX _T('!') -#endif - -#if wxUSE_CONFIG - -#include "wx/string.h" - -/// should we use registry instead of configuration files under Windows? -// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's -// false) or wxRegConfig (if it's true and we're under Win32)) -#ifndef wxUSE_CONFIG_NATIVE - #define wxUSE_CONFIG_NATIVE 1 -#endif - -// Style flags for constructor style parameter -enum -{ - wxCONFIG_USE_LOCAL_FILE = 1, - wxCONFIG_USE_GLOBAL_FILE = 2, - wxCONFIG_USE_RELATIVE_PATH = 4, - wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8, - wxCONFIG_USE_SUBDIR = 16 -}; - -// ---------------------------------------------------------------------------- -// abstract base class wxConfigBase which defines the interface for derived -// classes -// -// wxConfig organizes the items in a tree-like structure (modeled after the -// Unix/Dos filesystem). There are groups (directories) and keys (files). -// There is always one current group given by the current path. -// -// Keys are pairs "key_name = value" where value may be of string or integer -// (long) type (TODO doubles and other types such as wxDate coming soon). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConfigBase -{ -public: - // constants - // the type of an entry - enum EntryType - { - Type_Unknown, - Type_String, - Type_Boolean, - Type_Integer, // use Read(long *) - Type_Float // use Read(double *) - }; - - // static functions - // sets the config object, returns the previous pointer - static wxConfigBase *Set(wxConfigBase *pConfig); - // get the config object, creates it on demand unless DontCreateOnDemand - // was called - static wxConfigBase *Get(bool createOnDemand = true) - { if ( createOnDemand && (!ms_pConfig) ) Create(); return ms_pConfig; } - // create a new config object: this function will create the "best" - // implementation of wxConfig available for the current platform, see - // comments near definition wxUSE_CONFIG_NATIVE for details. It returns - // the created object and also sets it as ms_pConfig. - static wxConfigBase *Create(); - // should Get() try to create a new log object if the current one is NULL? - static void DontCreateOnDemand() { ms_bAutoCreate = false; } - - // ctor & virtual dtor - // ctor (can be used as default ctor too) - // - // Not all args will always be used by derived classes, but including - // them all in each class ensures compatibility. If appName is empty, - // uses wxApp name - wxConfigBase(const wxString& appName = wxEmptyString, - const wxString& vendorName = wxEmptyString, - const wxString& localFilename = wxEmptyString, - const wxString& globalFilename = wxEmptyString, - long style = 0); - - // empty but ensures that dtor of all derived classes is virtual - virtual ~wxConfigBase(); - - // path management - // set current path: if the first character is '/', it's the absolute path, - // otherwise it's a relative path. '..' is supported. If the strPath - // doesn't exist it is created. - virtual void SetPath(const wxString& strPath) = 0; - // retrieve the current path (always as absolute path) - virtual const wxString& GetPath() const = 0; - - // enumeration: all functions here return false when there are no more items. - // you must pass the same lIndex to GetNext and GetFirst (don't modify it) - // enumerate subgroups - virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0; - virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0; - // enumerate entries - virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0; - virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0; - // get number of entries/subgroups in the current group, with or without - // it's subgroups - virtual size_t GetNumberOfEntries(bool bRecursive = false) const = 0; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const = 0; - - // tests of existence - // returns true if the group by this name exists - virtual bool HasGroup(const wxString& strName) const = 0; - // same as above, but for an entry - virtual bool HasEntry(const wxString& strName) const = 0; - // returns true if either a group or an entry with a given name exist - bool Exists(const wxString& strName) const - { return HasGroup(strName) || HasEntry(strName); } - - // get the entry type - virtual EntryType GetEntryType(const wxString& name) const - { - // by default all entries are strings - return HasEntry(name) ? Type_String : Type_Unknown; - } - - // key access: returns true if value was really read, false if default used - // (and if the key is not found the default value is returned.) - - // read a string from the key - bool Read(const wxString& key, wxString *pStr) const; - bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const; - - // read a number (long) - bool Read(const wxString& key, long *pl) const; - bool Read(const wxString& key, long *pl, long defVal) const; - - // read an int - bool Read(const wxString& key, int *pi) const; - bool Read(const wxString& key, int *pi, int defVal) const; - - // read a double - bool Read(const wxString& key, double* val) const; - bool Read(const wxString& key, double* val, double defVal) const; - - // read a bool - bool Read(const wxString& key, bool* val) const; - bool Read(const wxString& key, bool* val, bool defVal) const; - - // convenience functions returning directly the value (we don't have them for - // int/double/bool as there would be ambiguities with the long one then) - wxString Read(const wxString& key, - const wxString& defVal = wxEmptyString) const - { wxString s; (void)Read(key, &s, defVal); return s; } - - long Read(const wxString& key, long defVal) const - { long l; (void)Read(key, &l, defVal); return l; } - - // write the value (return true on success) - bool Write(const wxString& key, const wxString& value) - { return DoWriteString(key, value); } - - bool Write(const wxString& key, long value) - { return DoWriteLong(key, value); } - - bool Write(const wxString& key, int value) - { return DoWriteInt(key, value); } - - bool Write(const wxString& key, double value) - { return DoWriteDouble(key, value); } - - bool Write(const wxString& key, bool value) - { return DoWriteBool(key, value); } - - // we have to provide a separate version for C strings as otherwise they - // would be converted to bool and not to wxString as expected! - bool Write(const wxString& key, const wxChar *value) - { return Write(key, wxString(value)); } - - // permanently writes all changes - virtual bool Flush(bool bCurrentOnly = false) = 0; - - // renaming, all functions return false on failure (probably because the new - // name is already taken by an existing entry) - // rename an entry - virtual bool RenameEntry(const wxString& oldName, - const wxString& newName) = 0; - // rename a group - virtual bool RenameGroup(const wxString& oldName, - const wxString& newName) = 0; - - // delete entries/groups - // deletes the specified entry and the group it belongs to if - // it was the last key in it and the second parameter is true - virtual bool DeleteEntry(const wxString& key, - bool bDeleteGroupIfEmpty = true) = 0; - // delete the group (with all subgroups) - virtual bool DeleteGroup(const wxString& key) = 0; - // delete the whole underlying object (disk file, registry key, ...) - // primarily for use by uninstallation routine. - virtual bool DeleteAll() = 0; - - // options - // we can automatically expand environment variables in the config entries - // (this option is on by default, you can turn it on/off at any time) - bool IsExpandingEnvVars() const { return m_bExpandEnvVars; } - void SetExpandEnvVars(bool bDoIt = true) { m_bExpandEnvVars = bDoIt; } - // recording of default values - void SetRecordDefaults(bool bDoIt = true) { m_bRecordDefaults = bDoIt; } - bool IsRecordingDefaults() const { return m_bRecordDefaults; } - // does expansion only if needed - wxString ExpandEnvVars(const wxString& str) const; - - // misc accessors - wxString GetAppName() const { return m_appName; } - wxString GetVendorName() const { return m_vendorName; } - - // Used wxIniConfig to set members in constructor - void SetAppName(const wxString& appName) { m_appName = appName; } - void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } - - void SetStyle(long style) { m_style = style; } - long GetStyle() const { return m_style; } - -protected: - static bool IsImmutable(const wxString& key) - { return !key.IsEmpty() && key[0] == wxCONFIG_IMMUTABLE_PREFIX; } - - // return the path without trailing separator, if any: this should be called - // to sanitize paths referring to the group names before passing them to - // wxConfigPathChanger as "/foo/bar/" should be the same as "/foo/bar" and it - // isn't interpreted in the same way by it (and this can't be changed there - // as it's not the same for the entries names) - static wxString RemoveTrailingSeparator(const wxString& key); - - // do read/write the values of different types - virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0; - virtual bool DoReadLong(const wxString& key, long *pl) const = 0; - virtual bool DoReadInt(const wxString& key, int *pi) const; - virtual bool DoReadDouble(const wxString& key, double* val) const; - virtual bool DoReadBool(const wxString& key, bool* val) const; - - virtual bool DoWriteString(const wxString& key, const wxString& value) = 0; - virtual bool DoWriteLong(const wxString& key, long value) = 0; - virtual bool DoWriteInt(const wxString& key, int value); - virtual bool DoWriteDouble(const wxString& key, double value); - virtual bool DoWriteBool(const wxString& key, bool value); - -private: - // are we doing automatic environment variable expansion? - bool m_bExpandEnvVars; - // do we record default values? - bool m_bRecordDefaults; - - // static variables - static wxConfigBase *ms_pConfig; - static bool ms_bAutoCreate; - - // Application name and organisation name - wxString m_appName; - wxString m_vendorName; - - // Style flag - long m_style; -}; - -// a handy little class which changes current path to the path of given entry -// and restores it in dtor: so if you declare a local variable of this type, -// you work in the entry directory and the path is automatically restored -// when the function returns -// Taken out of wxConfig since not all compilers can cope with nested classes. -class WXDLLIMPEXP_BASE wxConfigPathChanger -{ -public: - // ctor/dtor do path changing/restoring of the path - wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry); - ~wxConfigPathChanger(); - - // get the key name - const wxString& Name() const { return m_strName; } - - // this method must be called if the original path (i.e. the current path at - // the moment of creation of this object) could have been deleted to prevent - // us from restoring the not existing (any more) path - // - // if the original path doesn't exist any more, the path will be restored to - // the deepest still existing component of the old path - void UpdateIfDeleted(); - -private: - wxConfigBase *m_pContainer; // object we live in - wxString m_strName, // name of entry (i.e. name only) - m_strOldPath; // saved path - bool m_bChanged; // was the path changed? - - DECLARE_NO_COPY_CLASS(wxConfigPathChanger) -}; - - -// ---------------------------------------------------------------------------- -// the native wxConfigBase implementation -// ---------------------------------------------------------------------------- - -// under Windows we prefer to use the native implementation -// wxIniConfig isn't native anywhere after droping win16 in wxWidgets 2.6 -#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE - #define wxConfig wxRegConfig -#else // either we're under Unix or wish to use files even under Windows - #define wxConfig wxFileConfig -#endif - -#endif // wxUSE_CONFIG - -/* - Replace environment variables ($SOMETHING) with their values. The format is - $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and - '_' only. '$' must be escaped ('\$') in order to be taken literally. -*/ - -WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz); - -/* - Split path into parts removing '..' in progress - */ -WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxChar *sz); - - -#endif - // _WX_CONFIG_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: confbase.h +// Purpose: declaration of the base class of all config implementations +// (see also: fileconf.h and msw/regconf.h and iniconf.h) +// Author: Karsten Ballueder & Vadim Zeitlin +// Modified by: +// Created: 07.04.98 (adapted from appconf.h) +// RCS-ID: $Id: confbase.h 50711 2007-12-15 02:57:58Z VZ $ +// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net +// Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONFBASE_H_ +#define _WX_CONFBASE_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +/// shall we be case sensitive in parsing variable names? +#ifndef wxCONFIG_CASE_SENSITIVE + #define wxCONFIG_CASE_SENSITIVE 0 +#endif + +/// separates group and entry names (probably shouldn't be changed) +#ifndef wxCONFIG_PATH_SEPARATOR + #define wxCONFIG_PATH_SEPARATOR _T('/') +#endif + +/// introduces immutable entries +// (i.e. the ones which can't be changed from the local config file) +#ifndef wxCONFIG_IMMUTABLE_PREFIX + #define wxCONFIG_IMMUTABLE_PREFIX _T('!') +#endif + +#if wxUSE_CONFIG + +#include "wx/string.h" + +/// should we use registry instead of configuration files under Windows? +// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's +// false) or wxRegConfig (if it's true and we're under Win32)) +#ifndef wxUSE_CONFIG_NATIVE + #define wxUSE_CONFIG_NATIVE 1 +#endif + +// Style flags for constructor style parameter +enum +{ + wxCONFIG_USE_LOCAL_FILE = 1, + wxCONFIG_USE_GLOBAL_FILE = 2, + wxCONFIG_USE_RELATIVE_PATH = 4, + wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8, + wxCONFIG_USE_SUBDIR = 16 +}; + +// ---------------------------------------------------------------------------- +// abstract base class wxConfigBase which defines the interface for derived +// classes +// +// wxConfig organizes the items in a tree-like structure (modeled after the +// Unix/Dos filesystem). There are groups (directories) and keys (files). +// There is always one current group given by the current path. +// +// Keys are pairs "key_name = value" where value may be of string or integer +// (long) type (TODO doubles and other types such as wxDate coming soon). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConfigBase +{ +public: + // constants + // the type of an entry + enum EntryType + { + Type_Unknown, + Type_String, + Type_Boolean, + Type_Integer, // use Read(long *) + Type_Float // use Read(double *) + }; + + // static functions + // sets the config object, returns the previous pointer + static wxConfigBase *Set(wxConfigBase *pConfig); + // get the config object, creates it on demand unless DontCreateOnDemand + // was called + static wxConfigBase *Get(bool createOnDemand = true) + { if ( createOnDemand && (!ms_pConfig) ) Create(); return ms_pConfig; } + // create a new config object: this function will create the "best" + // implementation of wxConfig available for the current platform, see + // comments near definition wxUSE_CONFIG_NATIVE for details. It returns + // the created object and also sets it as ms_pConfig. + static wxConfigBase *Create(); + // should Get() try to create a new log object if the current one is NULL? + static void DontCreateOnDemand() { ms_bAutoCreate = false; } + + // ctor & virtual dtor + // ctor (can be used as default ctor too) + // + // Not all args will always be used by derived classes, but including + // them all in each class ensures compatibility. If appName is empty, + // uses wxApp name + wxConfigBase(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = 0); + + // empty but ensures that dtor of all derived classes is virtual + virtual ~wxConfigBase(); + + // path management + // set current path: if the first character is '/', it's the absolute path, + // otherwise it's a relative path. '..' is supported. If the strPath + // doesn't exist it is created. + virtual void SetPath(const wxString& strPath) = 0; + // retrieve the current path (always as absolute path) + virtual const wxString& GetPath() const = 0; + + // enumeration: all functions here return false when there are no more items. + // you must pass the same lIndex to GetNext and GetFirst (don't modify it) + // enumerate subgroups + virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0; + virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0; + // enumerate entries + virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0; + virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0; + // get number of entries/subgroups in the current group, with or without + // it's subgroups + virtual size_t GetNumberOfEntries(bool bRecursive = false) const = 0; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const = 0; + + // tests of existence + // returns true if the group by this name exists + virtual bool HasGroup(const wxString& strName) const = 0; + // same as above, but for an entry + virtual bool HasEntry(const wxString& strName) const = 0; + // returns true if either a group or an entry with a given name exist + bool Exists(const wxString& strName) const + { return HasGroup(strName) || HasEntry(strName); } + + // get the entry type + virtual EntryType GetEntryType(const wxString& name) const + { + // by default all entries are strings + return HasEntry(name) ? Type_String : Type_Unknown; + } + + // key access: returns true if value was really read, false if default used + // (and if the key is not found the default value is returned.) + + // read a string from the key + bool Read(const wxString& key, wxString *pStr) const; + bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const; + + // read a number (long) + bool Read(const wxString& key, long *pl) const; + bool Read(const wxString& key, long *pl, long defVal) const; + + // read an int + bool Read(const wxString& key, int *pi) const; + bool Read(const wxString& key, int *pi, int defVal) const; + + // read a double + bool Read(const wxString& key, double* val) const; + bool Read(const wxString& key, double* val, double defVal) const; + + // read a bool + bool Read(const wxString& key, bool* val) const; + bool Read(const wxString& key, bool* val, bool defVal) const; + + // convenience functions returning directly the value (we don't have them for + // int/double/bool as there would be ambiguities with the long one then) + wxString Read(const wxString& key, + const wxString& defVal = wxEmptyString) const + { wxString s; (void)Read(key, &s, defVal); return s; } + + long Read(const wxString& key, long defVal) const + { long l; (void)Read(key, &l, defVal); return l; } + + // write the value (return true on success) + bool Write(const wxString& key, const wxString& value) + { return DoWriteString(key, value); } + + bool Write(const wxString& key, long value) + { return DoWriteLong(key, value); } + + bool Write(const wxString& key, int value) + { return DoWriteInt(key, value); } + + bool Write(const wxString& key, double value) + { return DoWriteDouble(key, value); } + + bool Write(const wxString& key, bool value) + { return DoWriteBool(key, value); } + + // we have to provide a separate version for C strings as otherwise they + // would be converted to bool and not to wxString as expected! + bool Write(const wxString& key, const wxChar *value) + { return Write(key, wxString(value)); } + + // permanently writes all changes + virtual bool Flush(bool bCurrentOnly = false) = 0; + + // renaming, all functions return false on failure (probably because the new + // name is already taken by an existing entry) + // rename an entry + virtual bool RenameEntry(const wxString& oldName, + const wxString& newName) = 0; + // rename a group + virtual bool RenameGroup(const wxString& oldName, + const wxString& newName) = 0; + + // delete entries/groups + // deletes the specified entry and the group it belongs to if + // it was the last key in it and the second parameter is true + virtual bool DeleteEntry(const wxString& key, + bool bDeleteGroupIfEmpty = true) = 0; + // delete the group (with all subgroups) + virtual bool DeleteGroup(const wxString& key) = 0; + // delete the whole underlying object (disk file, registry key, ...) + // primarily for use by uninstallation routine. + virtual bool DeleteAll() = 0; + + // options + // we can automatically expand environment variables in the config entries + // (this option is on by default, you can turn it on/off at any time) + bool IsExpandingEnvVars() const { return m_bExpandEnvVars; } + void SetExpandEnvVars(bool bDoIt = true) { m_bExpandEnvVars = bDoIt; } + // recording of default values + void SetRecordDefaults(bool bDoIt = true) { m_bRecordDefaults = bDoIt; } + bool IsRecordingDefaults() const { return m_bRecordDefaults; } + // does expansion only if needed + wxString ExpandEnvVars(const wxString& str) const; + + // misc accessors + wxString GetAppName() const { return m_appName; } + wxString GetVendorName() const { return m_vendorName; } + + // Used wxIniConfig to set members in constructor + void SetAppName(const wxString& appName) { m_appName = appName; } + void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } + + void SetStyle(long style) { m_style = style; } + long GetStyle() const { return m_style; } + +protected: + static bool IsImmutable(const wxString& key) + { return !key.IsEmpty() && key[0] == wxCONFIG_IMMUTABLE_PREFIX; } + + // return the path without trailing separator, if any: this should be called + // to sanitize paths referring to the group names before passing them to + // wxConfigPathChanger as "/foo/bar/" should be the same as "/foo/bar" and it + // isn't interpreted in the same way by it (and this can't be changed there + // as it's not the same for the entries names) + static wxString RemoveTrailingSeparator(const wxString& key); + + // do read/write the values of different types + virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0; + virtual bool DoReadLong(const wxString& key, long *pl) const = 0; + virtual bool DoReadInt(const wxString& key, int *pi) const; + virtual bool DoReadDouble(const wxString& key, double* val) const; + virtual bool DoReadBool(const wxString& key, bool* val) const; + + virtual bool DoWriteString(const wxString& key, const wxString& value) = 0; + virtual bool DoWriteLong(const wxString& key, long value) = 0; + virtual bool DoWriteInt(const wxString& key, int value); + virtual bool DoWriteDouble(const wxString& key, double value); + virtual bool DoWriteBool(const wxString& key, bool value); + +private: + // are we doing automatic environment variable expansion? + bool m_bExpandEnvVars; + // do we record default values? + bool m_bRecordDefaults; + + // static variables + static wxConfigBase *ms_pConfig; + static bool ms_bAutoCreate; + + // Application name and organisation name + wxString m_appName; + wxString m_vendorName; + + // Style flag + long m_style; +}; + +// a handy little class which changes current path to the path of given entry +// and restores it in dtor: so if you declare a local variable of this type, +// you work in the entry directory and the path is automatically restored +// when the function returns +// Taken out of wxConfig since not all compilers can cope with nested classes. +class WXDLLIMPEXP_BASE wxConfigPathChanger +{ +public: + // ctor/dtor do path changing/restoring of the path + wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry); + ~wxConfigPathChanger(); + + // get the key name + const wxString& Name() const { return m_strName; } + + // this method must be called if the original path (i.e. the current path at + // the moment of creation of this object) could have been deleted to prevent + // us from restoring the not existing (any more) path + // + // if the original path doesn't exist any more, the path will be restored to + // the deepest still existing component of the old path + void UpdateIfDeleted(); + +private: + wxConfigBase *m_pContainer; // object we live in + wxString m_strName, // name of entry (i.e. name only) + m_strOldPath; // saved path + bool m_bChanged; // was the path changed? + + DECLARE_NO_COPY_CLASS(wxConfigPathChanger) +}; + + +// ---------------------------------------------------------------------------- +// the native wxConfigBase implementation +// ---------------------------------------------------------------------------- + +// under Windows we prefer to use the native implementation +// wxIniConfig isn't native anywhere after droping win16 in wxWidgets 2.6 +#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE + #define wxConfig wxRegConfig +#else // either we're under Unix or wish to use files even under Windows + #define wxConfig wxFileConfig +#endif + +#endif // wxUSE_CONFIG + +/* + Replace environment variables ($SOMETHING) with their values. The format is + $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and + '_' only. '$' must be escaped ('\$') in order to be taken literally. +*/ + +WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz); + +/* + Split path into parts removing '..' in progress + */ +WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxChar *sz); + + +#endif + // _WX_CONFIG_H_ + diff --git a/Externals/wxWidgets/include/wx/config.h b/Externals/wxWidgets/include/wx/config.h index 41ce1cf8e9..2ef3efcab3 100644 --- a/Externals/wxWidgets/include/wx/config.h +++ b/Externals/wxWidgets/include/wx/config.h @@ -1,31 +1,31 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: config.h -// Purpose: wxConfig base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: config.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONFIG_H_BASE_ -#define _WX_CONFIG_H_BASE_ - -#include "wx/defs.h" -#include "wx/confbase.h" - -#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE -# ifdef __WIN32__ -# include "wx/msw/regconf.h" -# else -# include "wx/msw/iniconf.h" -# endif -#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE -# include "wx/palmos/prefconf.h" -#else -# include "wx/fileconf.h" -#endif - -#endif - // _WX_CONFIG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: config.h +// Purpose: wxConfig base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: config.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONFIG_H_BASE_ +#define _WX_CONFIG_H_BASE_ + +#include "wx/defs.h" +#include "wx/confbase.h" + +#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE +# ifdef __WIN32__ +# include "wx/msw/regconf.h" +# else +# include "wx/msw/iniconf.h" +# endif +#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE +# include "wx/palmos/prefconf.h" +#else +# include "wx/fileconf.h" +#endif + +#endif + // _WX_CONFIG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/containr.h b/Externals/wxWidgets/include/wx/containr.h index 0cf322c2e0..79eb4f4b8e 100644 --- a/Externals/wxWidgets/include/wx/containr.h +++ b/Externals/wxWidgets/include/wx/containr.h @@ -1,142 +1,142 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/containr.h -// Purpose: wxControlContainer class declration: a "mix-in" class which -// implements the TAB navigation between the controls -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.01 -// RCS-ID: $Id: containr.h 50863 2007-12-20 18:32:55Z VS $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONTAINR_H_ -#define _WX_CONTAINR_H_ - -class WXDLLIMPEXP_FWD_CORE wxFocusEvent; -class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -/* - Implementation note: wxControlContainer is not a real mix-in but rather - a class meant to be agregated with (and not inherited from). Although - logically it should be a mix-in, doing it like this has no advantage from - the point of view of the existing code but does have some problems (we'd - need to play tricks with event handlers which may be difficult to do - safely). The price we pay for this simplicity is the ugly macros below. - */ - -// ---------------------------------------------------------------------------- -// wxControlContainer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlContainer -{ -public: - // ctors and such - wxControlContainer(wxWindow *winParent = NULL); - void SetContainerWindow(wxWindow *winParent) { m_winParent = winParent; } - - // the methods to be called from the window event handlers - void HandleOnNavigationKey(wxNavigationKeyEvent& event); - void HandleOnFocus(wxFocusEvent& event); - void HandleOnWindowDestroy(wxWindowBase *child); - - // should be called from SetFocus(), returns false if we did nothing with - // the focus and the default processing should take place - bool DoSetFocus(); - - // can our child get the focus? - bool AcceptsFocus() const; - - // called from OnChildFocus() handler, i.e. when one of our (grand) - // children gets the focus - void SetLastFocus(wxWindow *win); - -protected: - // set the focus to the child which had it the last time - bool SetFocusToChild(); - - // the parent window we manage the children for - wxWindow *m_winParent; - - // the child which had the focus last time this panel was activated - wxWindow *m_winLastFocused; - - // a guard against infinite recursion - bool m_inSetFocus; - - DECLARE_NO_COPY_CLASS(wxControlContainer) -}; - -// this function is for wxWidgets internal use only -extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); - -// ---------------------------------------------------------------------------- -// macros which may be used by the classes wishing to implement TAB navigation -// among their children -// ---------------------------------------------------------------------------- - -// declare the methods to be forwarded -#define WX_DECLARE_CONTROL_CONTAINER() \ -public: \ - void OnNavigationKey(wxNavigationKeyEvent& event); \ - void OnFocus(wxFocusEvent& event); \ - virtual void OnChildFocus(wxChildFocusEvent& event); \ - virtual void SetFocus(); \ - virtual void SetFocusIgnoringChildren(); \ - virtual void RemoveChild(wxWindowBase *child); \ - virtual bool AcceptsFocus() const; \ -\ -protected: \ - wxControlContainer m_container - -// implement the event table entries for wxControlContainer -#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \ - EVT_SET_FOCUS(classname::OnFocus) \ - EVT_CHILD_FOCUS(classname::OnChildFocus) \ - EVT_NAVIGATION_KEY(classname::OnNavigationKey) - -// implement the methods forwarding to the wxControlContainer -#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ -void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \ -{ \ - m_container.HandleOnNavigationKey(event); \ -} \ - \ -void classname::RemoveChild(wxWindowBase *child) \ -{ \ - m_container.HandleOnWindowDestroy(child); \ - \ - basename::RemoveChild(child); \ -} \ - \ -void classname::SetFocus() \ -{ \ - if ( !m_container.DoSetFocus() ) \ - basename::SetFocus(); \ -} \ - \ -void classname::SetFocusIgnoringChildren() \ -{ \ - basename::SetFocus(); \ -} \ - \ -void classname::OnChildFocus(wxChildFocusEvent& event) \ -{ \ - m_container.SetLastFocus(event.GetWindow()); \ - event.Skip(); \ -} \ - \ -void classname::OnFocus(wxFocusEvent& event) \ -{ \ - m_container.HandleOnFocus(event); \ -} \ -bool classname::AcceptsFocus() const \ -{ \ - return m_container.AcceptsFocus(); \ -} - - -#endif // _WX_CONTAINR_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/containr.h +// Purpose: wxControlContainer class declration: a "mix-in" class which +// implements the TAB navigation between the controls +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.01 +// RCS-ID: $Id: containr.h 50863 2007-12-20 18:32:55Z VS $ +// Copyright: (c) 2001 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTAINR_H_ +#define _WX_CONTAINR_H_ + +class WXDLLIMPEXP_FWD_CORE wxFocusEvent; +class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +/* + Implementation note: wxControlContainer is not a real mix-in but rather + a class meant to be agregated with (and not inherited from). Although + logically it should be a mix-in, doing it like this has no advantage from + the point of view of the existing code but does have some problems (we'd + need to play tricks with event handlers which may be difficult to do + safely). The price we pay for this simplicity is the ugly macros below. + */ + +// ---------------------------------------------------------------------------- +// wxControlContainer +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlContainer +{ +public: + // ctors and such + wxControlContainer(wxWindow *winParent = NULL); + void SetContainerWindow(wxWindow *winParent) { m_winParent = winParent; } + + // the methods to be called from the window event handlers + void HandleOnNavigationKey(wxNavigationKeyEvent& event); + void HandleOnFocus(wxFocusEvent& event); + void HandleOnWindowDestroy(wxWindowBase *child); + + // should be called from SetFocus(), returns false if we did nothing with + // the focus and the default processing should take place + bool DoSetFocus(); + + // can our child get the focus? + bool AcceptsFocus() const; + + // called from OnChildFocus() handler, i.e. when one of our (grand) + // children gets the focus + void SetLastFocus(wxWindow *win); + +protected: + // set the focus to the child which had it the last time + bool SetFocusToChild(); + + // the parent window we manage the children for + wxWindow *m_winParent; + + // the child which had the focus last time this panel was activated + wxWindow *m_winLastFocused; + + // a guard against infinite recursion + bool m_inSetFocus; + + DECLARE_NO_COPY_CLASS(wxControlContainer) +}; + +// this function is for wxWidgets internal use only +extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); + +// ---------------------------------------------------------------------------- +// macros which may be used by the classes wishing to implement TAB navigation +// among their children +// ---------------------------------------------------------------------------- + +// declare the methods to be forwarded +#define WX_DECLARE_CONTROL_CONTAINER() \ +public: \ + void OnNavigationKey(wxNavigationKeyEvent& event); \ + void OnFocus(wxFocusEvent& event); \ + virtual void OnChildFocus(wxChildFocusEvent& event); \ + virtual void SetFocus(); \ + virtual void SetFocusIgnoringChildren(); \ + virtual void RemoveChild(wxWindowBase *child); \ + virtual bool AcceptsFocus() const; \ +\ +protected: \ + wxControlContainer m_container + +// implement the event table entries for wxControlContainer +#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \ + EVT_SET_FOCUS(classname::OnFocus) \ + EVT_CHILD_FOCUS(classname::OnChildFocus) \ + EVT_NAVIGATION_KEY(classname::OnNavigationKey) + +// implement the methods forwarding to the wxControlContainer +#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ +void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \ +{ \ + m_container.HandleOnNavigationKey(event); \ +} \ + \ +void classname::RemoveChild(wxWindowBase *child) \ +{ \ + m_container.HandleOnWindowDestroy(child); \ + \ + basename::RemoveChild(child); \ +} \ + \ +void classname::SetFocus() \ +{ \ + if ( !m_container.DoSetFocus() ) \ + basename::SetFocus(); \ +} \ + \ +void classname::SetFocusIgnoringChildren() \ +{ \ + basename::SetFocus(); \ +} \ + \ +void classname::OnChildFocus(wxChildFocusEvent& event) \ +{ \ + m_container.SetLastFocus(event.GetWindow()); \ + event.Skip(); \ +} \ + \ +void classname::OnFocus(wxFocusEvent& event) \ +{ \ + m_container.HandleOnFocus(event); \ +} \ +bool classname::AcceptsFocus() const \ +{ \ + return m_container.AcceptsFocus(); \ +} + + +#endif // _WX_CONTAINR_H_ diff --git a/Externals/wxWidgets/include/wx/control.h b/Externals/wxWidgets/include/wx/control.h index ff11a93cf6..b5208d07d5 100644 --- a/Externals/wxWidgets/include/wx/control.h +++ b/Externals/wxWidgets/include/wx/control.h @@ -1,117 +1,117 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/control.h -// Purpose: wxControl common interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.07.99 -// RCS-ID: $Id: control.h 42816 2006-10-31 08:50:17Z RD $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONTROL_H_BASE_ -#define _WX_CONTROL_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_CONTROLS - -#include "wx/window.h" // base class - -extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[]; - -// ---------------------------------------------------------------------------- -// wxControl is the base class for all controls -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlBase : public wxWindow -{ -public: - wxControlBase() { } - - virtual ~wxControlBase(); - - // Create() function adds the validator parameter - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr); - - // get the control alignment (left/right/centre, top/bottom/centre) - int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } - - // get the string without mnemonic characters ('&') - static wxString GetLabelText(const wxString& label); - - // get just the text of the label, without mnemonic characters ('&') - wxString GetLabelText() const { return GetLabelText(GetLabel()); } - - // controls by default inherit the colours of their parents, if a - // particular control class doesn't want to do it, it can override - // ShouldInheritColours() to return false - virtual bool ShouldInheritColours() const { return true; } - - - // WARNING: this doesn't work for all controls nor all platforms! - // - // simulates the event of given type (i.e. wxButton::Command() is just as - // if the button was clicked) - virtual void Command(wxCommandEvent &event); - - virtual void SetLabel( const wxString &label ); - virtual bool SetFont(const wxFont& font); - - // wxControl-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - -protected: - // creates the control (calls wxWindowBase::CreateBase inside) and adds it - // to the list of parents children - bool CreateControl(wxWindowBase *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - - // initialize the common fields of wxCommandEvent - void InitCommandEvent(wxCommandEvent& event) const; - - DECLARE_NO_COPY_CLASS(wxControlBase) -}; - -// ---------------------------------------------------------------------------- -// include platform-dependent wxControl declarations -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/control.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/control.h" -#elif defined(__WXMSW__) - #include "wx/msw/control.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/control.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/control.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/control.h" -#elif defined(__WXMAC__) - #include "wx/mac/control.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/control.h" -#elif defined(__WXPM__) - #include "wx/os2/control.h" -#endif - -#endif // wxUSE_CONTROLS - -#endif - // _WX_CONTROL_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/control.h +// Purpose: wxControl common interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 26.07.99 +// RCS-ID: $Id: control.h 42816 2006-10-31 08:50:17Z RD $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_BASE_ +#define _WX_CONTROL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_CONTROLS + +#include "wx/window.h" // base class + +extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxControl is the base class for all controls +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlBase : public wxWindow +{ +public: + wxControlBase() { } + + virtual ~wxControlBase(); + + // Create() function adds the validator parameter + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr); + + // get the control alignment (left/right/centre, top/bottom/centre) + int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } + + // get the string without mnemonic characters ('&') + static wxString GetLabelText(const wxString& label); + + // get just the text of the label, without mnemonic characters ('&') + wxString GetLabelText() const { return GetLabelText(GetLabel()); } + + // controls by default inherit the colours of their parents, if a + // particular control class doesn't want to do it, it can override + // ShouldInheritColours() to return false + virtual bool ShouldInheritColours() const { return true; } + + + // WARNING: this doesn't work for all controls nor all platforms! + // + // simulates the event of given type (i.e. wxButton::Command() is just as + // if the button was clicked) + virtual void Command(wxCommandEvent &event); + + virtual void SetLabel( const wxString &label ); + virtual bool SetFont(const wxFont& font); + + // wxControl-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + +protected: + // creates the control (calls wxWindowBase::CreateBase inside) and adds it + // to the list of parents children + bool CreateControl(wxWindowBase *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + + // initialize the common fields of wxCommandEvent + void InitCommandEvent(wxCommandEvent& event) const; + + DECLARE_NO_COPY_CLASS(wxControlBase) +}; + +// ---------------------------------------------------------------------------- +// include platform-dependent wxControl declarations +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/control.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/control.h" +#elif defined(__WXMSW__) + #include "wx/msw/control.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/control.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/control.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/control.h" +#elif defined(__WXMAC__) + #include "wx/mac/control.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/control.h" +#elif defined(__WXPM__) + #include "wx/os2/control.h" +#endif + +#endif // wxUSE_CONTROLS + +#endif + // _WX_CONTROL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/convauto.h b/Externals/wxWidgets/include/wx/convauto.h index ced911950a..8d96afa557 100644 --- a/Externals/wxWidgets/include/wx/convauto.h +++ b/Externals/wxWidgets/include/wx/convauto.h @@ -1,108 +1,108 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/convauto.h -// Purpose: wxConvAuto class declaration -// Author: Vadim Zeitlin -// Created: 2006-04-03 -// RCS-ID: $Id: convauto.h 45893 2007-05-08 20:05:16Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONVAUTO_H_ -#define _WX_CONVAUTO_H_ - -#include "wx/strconv.h" - -#if wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// wxConvAuto: uses BOM to automatically detect input encoding -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv -{ -public: - // default ctor, the real conversion will be created on demand - wxConvAuto() { m_conv = NULL; /* the rest will be initialized later */ } - - // copy ctor doesn't initialize anything neither as conversion can only be - // deduced on first use - wxConvAuto(const wxConvAuto& WXUNUSED(other)) : wxMBConv() { m_conv = NULL; } - - virtual ~wxConvAuto() { if ( m_conv && m_ownsConv ) delete m_conv; } - - // override the base class virtual function(s) to use our m_conv - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - - virtual size_t GetMBNulLen() const { return m_conv->GetMBNulLen(); } - - virtual wxMBConv *Clone() const { return new wxConvAuto(*this); } - -private: - // all currently recognized BOM values - enum BOMType - { - BOM_None, - BOM_UTF32BE, - BOM_UTF32LE, - BOM_UTF16BE, - BOM_UTF16LE, - BOM_UTF8 - }; - - // return the BOM type of this buffer - static BOMType DetectBOM(const char *src, size_t srcLen); - - // initialize m_conv with the conversion to use by default (UTF-8) - void InitWithDefault() - { - m_conv = &wxConvUTF8; - m_ownsConv = false; - } - - // create the correct conversion object for the given BOM type - void InitFromBOM(BOMType bomType); - - // create the correct conversion object for the BOM present in the - // beginning of the buffer; adjust the buffer to skip the BOM if found - void InitFromInput(const char **src, size_t *len); - - // adjust src and len to skip over the BOM (identified by m_bomType) at the - // start of the buffer - void SkipBOM(const char **src, size_t *len) const; - - - // conversion object which we really use, NULL until the first call to - // either ToWChar() or FromWChar() - wxMBConv *m_conv; - - // our BOM type - BOMType m_bomType; - - // true if we allocated m_conv ourselves, false if we just use an existing - // global conversion - bool m_ownsConv; - - // true if we already skipped BOM when converting (and not just calculating - // the size) - bool m_consumedBOM; - - - DECLARE_NO_ASSIGN_CLASS(wxConvAuto) -}; - -#else // !wxUSE_WCHAR_T - -// it doesn't matter how we define it in this case as it's unused anyhow, but -// do define it to allow the code using wxConvAuto() as default argument (this -// is done in many places) to compile -typedef wxMBConv wxConvAuto; - -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T - -#endif // _WX_CONVAUTO_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/convauto.h +// Purpose: wxConvAuto class declaration +// Author: Vadim Zeitlin +// Created: 2006-04-03 +// RCS-ID: $Id: convauto.h 45893 2007-05-08 20:05:16Z VZ $ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONVAUTO_H_ +#define _WX_CONVAUTO_H_ + +#include "wx/strconv.h" + +#if wxUSE_WCHAR_T + +// ---------------------------------------------------------------------------- +// wxConvAuto: uses BOM to automatically detect input encoding +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv +{ +public: + // default ctor, the real conversion will be created on demand + wxConvAuto() { m_conv = NULL; /* the rest will be initialized later */ } + + // copy ctor doesn't initialize anything neither as conversion can only be + // deduced on first use + wxConvAuto(const wxConvAuto& WXUNUSED(other)) : wxMBConv() { m_conv = NULL; } + + virtual ~wxConvAuto() { if ( m_conv && m_ownsConv ) delete m_conv; } + + // override the base class virtual function(s) to use our m_conv + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + + virtual size_t GetMBNulLen() const { return m_conv->GetMBNulLen(); } + + virtual wxMBConv *Clone() const { return new wxConvAuto(*this); } + +private: + // all currently recognized BOM values + enum BOMType + { + BOM_None, + BOM_UTF32BE, + BOM_UTF32LE, + BOM_UTF16BE, + BOM_UTF16LE, + BOM_UTF8 + }; + + // return the BOM type of this buffer + static BOMType DetectBOM(const char *src, size_t srcLen); + + // initialize m_conv with the conversion to use by default (UTF-8) + void InitWithDefault() + { + m_conv = &wxConvUTF8; + m_ownsConv = false; + } + + // create the correct conversion object for the given BOM type + void InitFromBOM(BOMType bomType); + + // create the correct conversion object for the BOM present in the + // beginning of the buffer; adjust the buffer to skip the BOM if found + void InitFromInput(const char **src, size_t *len); + + // adjust src and len to skip over the BOM (identified by m_bomType) at the + // start of the buffer + void SkipBOM(const char **src, size_t *len) const; + + + // conversion object which we really use, NULL until the first call to + // either ToWChar() or FromWChar() + wxMBConv *m_conv; + + // our BOM type + BOMType m_bomType; + + // true if we allocated m_conv ourselves, false if we just use an existing + // global conversion + bool m_ownsConv; + + // true if we already skipped BOM when converting (and not just calculating + // the size) + bool m_consumedBOM; + + + DECLARE_NO_ASSIGN_CLASS(wxConvAuto) +}; + +#else // !wxUSE_WCHAR_T + +// it doesn't matter how we define it in this case as it's unused anyhow, but +// do define it to allow the code using wxConvAuto() as default argument (this +// is done in many places) to compile +typedef wxMBConv wxConvAuto; + +#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T + +#endif // _WX_CONVAUTO_H_ + diff --git a/Externals/wxWidgets/include/wx/cpp.h b/Externals/wxWidgets/include/wx/cpp.h index 8d7a646d7b..3e23273acd 100644 --- a/Externals/wxWidgets/include/wx/cpp.h +++ b/Externals/wxWidgets/include/wx/cpp.h @@ -1,57 +1,57 @@ -/* - * Name: wx/cpp.h - * Purpose: Various preprocessor helpers - * Author: Vadim Zeitlin - * Created: 2006-09-30 - * RCS-ID: $Id: cpp.h 42993 2006-11-03 21:06:57Z VZ $ - * Copyright: (c) 2006 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_CPP_H_ -#define _WX_CPP_H_ - -/* wxCONCAT works like preprocessor ## operator but also works with macros */ -#define wxCONCAT_HELPER(text, line) text ## line -#define wxCONCAT(text, line) wxCONCAT_HELPER(text, line) - -/* wxSTRINGIZE works as the preprocessor # operator but also works with macros */ -#define wxSTRINGIZE_HELPER(x) #x -#define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x) - -/* a Unicode-friendly version of wxSTRINGIZE_T */ -#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x)) - -/* - Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the - current line number to the given identifier to reduce the probability of the - conflict (it may still happen if this is used in the headers, hence you - should avoid doing it or provide unique prefixes then) but we have to do it - differently for VC++ - */ -#if defined(__VISUALC__) && (__VISUALC__ >= 1300) - /* - __LINE__ handling is completely broken in VC++ when using "Edit and - Continue" (/ZI option) and results in preprocessor errors if we use it - inside the macros. Luckily VC7 has another standard macro which can be - used like this and is even better than __LINE__ because it is globally - unique. - */ -# define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__) -#else /* normal compilers */ -# define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__) -#endif - -/* Create a "unique" name with the given prefix */ -#define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text) - -/* - This macro can be passed as argument to another macro when you don't have - anything to pass in fact. - */ -#define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */ - -#endif // _WX_CPP_H_ - +/* + * Name: wx/cpp.h + * Purpose: Various preprocessor helpers + * Author: Vadim Zeitlin + * Created: 2006-09-30 + * RCS-ID: $Id: cpp.h 42993 2006-11-03 21:06:57Z VZ $ + * Copyright: (c) 2006 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_CPP_H_ +#define _WX_CPP_H_ + +/* wxCONCAT works like preprocessor ## operator but also works with macros */ +#define wxCONCAT_HELPER(text, line) text ## line +#define wxCONCAT(text, line) wxCONCAT_HELPER(text, line) + +/* wxSTRINGIZE works as the preprocessor # operator but also works with macros */ +#define wxSTRINGIZE_HELPER(x) #x +#define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x) + +/* a Unicode-friendly version of wxSTRINGIZE_T */ +#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x)) + +/* + Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the + current line number to the given identifier to reduce the probability of the + conflict (it may still happen if this is used in the headers, hence you + should avoid doing it or provide unique prefixes then) but we have to do it + differently for VC++ + */ +#if defined(__VISUALC__) && (__VISUALC__ >= 1300) + /* + __LINE__ handling is completely broken in VC++ when using "Edit and + Continue" (/ZI option) and results in preprocessor errors if we use it + inside the macros. Luckily VC7 has another standard macro which can be + used like this and is even better than __LINE__ because it is globally + unique. + */ +# define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__) +#else /* normal compilers */ +# define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__) +#endif + +/* Create a "unique" name with the given prefix */ +#define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text) + +/* + This macro can be passed as argument to another macro when you don't have + anything to pass in fact. + */ +#define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */ + +#endif // _WX_CPP_H_ + diff --git a/Externals/wxWidgets/include/wx/cppunit.h b/Externals/wxWidgets/include/wx/cppunit.h index c6057a02f2..c70cfbd805 100644 --- a/Externals/wxWidgets/include/wx/cppunit.h +++ b/Externals/wxWidgets/include/wx/cppunit.h @@ -1,129 +1,129 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cppunit.h -// Purpose: wrapper header for CppUnit headers -// Author: Vadim Zeitlin -// Created: 15.02.04 -// RCS-ID: $Id: cppunit.h 53917 2008-06-01 20:32:26Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CPPUNIT_H_ -#define _WX_CPPUNIT_H_ - -/////////////////////////////////////////////////////////////////////////////// -// using CPPUNIT_TEST() macro results in this warning, disable it as there is -// no other way to get rid of it and it's not very useful anyhow -#ifdef __VISUALC__ - // typedef-name 'foo' used as synonym for class-name 'bar' - #pragma warning(disable:4097) - - // unreachable code: we don't care about warnings in CppUnit headers - #pragma warning(disable:4702) - - // 'id': identifier was truncated to 'num' characters in the debug info - #pragma warning(disable:4786) -#endif // __VISUALC__ - -#ifdef __BORLANDC__ - #pragma warn -8022 -#endif - -#ifndef CPPUNIT_STD_NEED_ALLOCATOR - #define CPPUNIT_STD_NEED_ALLOCATOR 0 -#endif - -/////////////////////////////////////////////////////////////////////////////// -// Set the default format for the errors, which can be used by an IDE to jump -// to the error location. This default gets overridden by the cppunit headers -// for some compilers (e.g. VC++). - -#ifndef CPPUNIT_COMPILER_LOCATION_FORMAT - #define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l:" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Include all needed cppunit headers. -// - -#include "wx/beforestd.h" -#include -#include -#include -#include -#include -#include "wx/afterstd.h" - - -/////////////////////////////////////////////////////////////////////////////// -// Set of helpful test macros. -// - -// Base macro for wrapping CPPUNIT_TEST macros and so making them conditional -// tests, meaning that the test only get registered and thus run when a given -// runtime condition is true. -// In case the condition is evaluated as false a skip message is logged -// (the message will only be shown in verbose mode). -#define WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, anyTest) \ - if (Condition) \ - { anyTest; } \ - else \ - wxLogInfo(wxString::Format(_T("skipping: %s.%s\n reason: %s equals false\n"), \ - wxString(suiteName, wxConvUTF8).c_str(), \ - wxString(#testMethod, wxConvUTF8).c_str(), \ - wxString(#Condition, wxConvUTF8).c_str())) - -// Conditional CPPUNIT_TEST macro. -#define WXTEST_WITH_CONDITION(suiteName, Condition, testMethod) \ - WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST(testMethod)) -// Conditional CPPUNIT_TEST_FAIL macro. -#define WXTEST_FAIL_WITH_CONDITION(suiteName, Condition, testMethod) \ - WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST_FAIL(testMethod)) - -// Use this macro to compare a wxString with a literal string. -#define WX_ASSERT_STR_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(wxString(p), s) - -// Use this macro to compare a size_t with a literal integer -#define WX_ASSERT_SIZET_EQUAL(n, m) CPPUNIT_ASSERT_EQUAL(((size_t)n), m) - -// Use this macro to compare the expected time_t value with the result of not -// necessarily time_t type -#define WX_ASSERT_TIME_T_EQUAL(t, n) CPPUNIT_ASSERT_EQUAL((t), (time_t)(n)) - - -/////////////////////////////////////////////////////////////////////////////// -// stream inserter for wxString -// - -#include "wx/string.h" - -inline std::ostream& operator<<(std::ostream& o, const wxString& s) -{ - return o << s.mb_str(); -} - - -/////////////////////////////////////////////////////////////////////////////// -// Some more compiler warning tweaking and auto linking. -// - -#ifdef __BORLANDC__ - #pragma warn .8022 -#endif - -#ifdef _MSC_VER - #pragma warning(default:4702) -#endif // _MSC_VER - -// for VC++ automatically link in cppunit library -#ifdef __VISUALC__ - #ifdef NDEBUG - #pragma comment(lib, "cppunit.lib") - #else // Debug - #pragma comment(lib, "cppunitd.lib") - #endif // Release/Debug -#endif - -#endif // _WX_CPPUNIT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cppunit.h +// Purpose: wrapper header for CppUnit headers +// Author: Vadim Zeitlin +// Created: 15.02.04 +// RCS-ID: $Id: cppunit.h 53917 2008-06-01 20:32:26Z VZ $ +// Copyright: (c) 2004 Vadim Zeitlin +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CPPUNIT_H_ +#define _WX_CPPUNIT_H_ + +/////////////////////////////////////////////////////////////////////////////// +// using CPPUNIT_TEST() macro results in this warning, disable it as there is +// no other way to get rid of it and it's not very useful anyhow +#ifdef __VISUALC__ + // typedef-name 'foo' used as synonym for class-name 'bar' + #pragma warning(disable:4097) + + // unreachable code: we don't care about warnings in CppUnit headers + #pragma warning(disable:4702) + + // 'id': identifier was truncated to 'num' characters in the debug info + #pragma warning(disable:4786) +#endif // __VISUALC__ + +#ifdef __BORLANDC__ + #pragma warn -8022 +#endif + +#ifndef CPPUNIT_STD_NEED_ALLOCATOR + #define CPPUNIT_STD_NEED_ALLOCATOR 0 +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Set the default format for the errors, which can be used by an IDE to jump +// to the error location. This default gets overridden by the cppunit headers +// for some compilers (e.g. VC++). + +#ifndef CPPUNIT_COMPILER_LOCATION_FORMAT + #define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l:" +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// Include all needed cppunit headers. +// + +#include "wx/beforestd.h" +#include +#include +#include +#include +#include +#include "wx/afterstd.h" + + +/////////////////////////////////////////////////////////////////////////////// +// Set of helpful test macros. +// + +// Base macro for wrapping CPPUNIT_TEST macros and so making them conditional +// tests, meaning that the test only get registered and thus run when a given +// runtime condition is true. +// In case the condition is evaluated as false a skip message is logged +// (the message will only be shown in verbose mode). +#define WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, anyTest) \ + if (Condition) \ + { anyTest; } \ + else \ + wxLogInfo(wxString::Format(_T("skipping: %s.%s\n reason: %s equals false\n"), \ + wxString(suiteName, wxConvUTF8).c_str(), \ + wxString(#testMethod, wxConvUTF8).c_str(), \ + wxString(#Condition, wxConvUTF8).c_str())) + +// Conditional CPPUNIT_TEST macro. +#define WXTEST_WITH_CONDITION(suiteName, Condition, testMethod) \ + WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST(testMethod)) +// Conditional CPPUNIT_TEST_FAIL macro. +#define WXTEST_FAIL_WITH_CONDITION(suiteName, Condition, testMethod) \ + WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST_FAIL(testMethod)) + +// Use this macro to compare a wxString with a literal string. +#define WX_ASSERT_STR_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(wxString(p), s) + +// Use this macro to compare a size_t with a literal integer +#define WX_ASSERT_SIZET_EQUAL(n, m) CPPUNIT_ASSERT_EQUAL(((size_t)n), m) + +// Use this macro to compare the expected time_t value with the result of not +// necessarily time_t type +#define WX_ASSERT_TIME_T_EQUAL(t, n) CPPUNIT_ASSERT_EQUAL((t), (time_t)(n)) + + +/////////////////////////////////////////////////////////////////////////////// +// stream inserter for wxString +// + +#include "wx/string.h" + +inline std::ostream& operator<<(std::ostream& o, const wxString& s) +{ + return o << s.mb_str(); +} + + +/////////////////////////////////////////////////////////////////////////////// +// Some more compiler warning tweaking and auto linking. +// + +#ifdef __BORLANDC__ + #pragma warn .8022 +#endif + +#ifdef _MSC_VER + #pragma warning(default:4702) +#endif // _MSC_VER + +// for VC++ automatically link in cppunit library +#ifdef __VISUALC__ + #ifdef NDEBUG + #pragma comment(lib, "cppunit.lib") + #else // Debug + #pragma comment(lib, "cppunitd.lib") + #endif // Release/Debug +#endif + +#endif // _WX_CPPUNIT_H_ + diff --git a/Externals/wxWidgets/include/wx/cshelp.h b/Externals/wxWidgets/include/wx/cshelp.h index 8b3d8adcc6..f77ac4f67e 100644 --- a/Externals/wxWidgets/include/wx/cshelp.h +++ b/Externals/wxWidgets/include/wx/cshelp.h @@ -1,244 +1,244 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cshelp.h -// Purpose: Context-sensitive help support classes -// Author: Julian Smart, Vadim Zeitlin -// Modified by: -// Created: 08/09/2000 -// RCS-ID: $Id: cshelp.h 39675 2006-06-11 21:10:32Z VZ $ -// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CSHELP_H_ -#define _WX_CSHELP_H_ - -#include "wx/defs.h" - -#if wxUSE_HELP - -#include "wx/help.h" - -#include "wx/hashmap.h" -#if wxUSE_BMPBUTTON -#include "wx/bmpbuttn.h" -#endif - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// classes used to implement context help UI -// ---------------------------------------------------------------------------- - -/* - * wxContextHelp - * Invokes context-sensitive help. When the user - * clicks on a window, a wxEVT_HELP event will be sent to that - * window for the application to display help for. - */ - -class WXDLLEXPORT wxContextHelp : public wxObject -{ -public: - wxContextHelp(wxWindow* win = NULL, bool beginHelp = true); - virtual ~wxContextHelp(); - - bool BeginContextHelp(wxWindow* win); - bool EndContextHelp(); - - bool EventLoop(); - bool DispatchEvent(wxWindow* win, const wxPoint& pt); - - void SetStatus(bool status) { m_status = status; } - -protected: - bool m_inHelp; - bool m_status; // true if the user left-clicked - -private: - DECLARE_DYNAMIC_CLASS(wxContextHelp) -}; - -#if wxUSE_BMPBUTTON -/* - * wxContextHelpButton - * You can add this to your dialogs (especially on non-Windows platforms) - * to put the application into context help mode. - */ - -class WXDLLEXPORT wxContextHelpButton : public wxBitmapButton -{ -public: - wxContextHelpButton(wxWindow* parent, - wxWindowID id = wxID_CONTEXT_HELP, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW); - - void OnContextHelp(wxCommandEvent& event); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton) - DECLARE_EVENT_TABLE() -}; - -#endif - -// ---------------------------------------------------------------------------- -// classes used to implement context help support -// ---------------------------------------------------------------------------- - -// wxHelpProvider is an abstract class used by the program implementing context help to -// show the help text (or whatever: it may be HTML page or anything else) for -// the given window. -// -// The current help provider must be explicitly set by the application using -// wxHelpProvider::Set(). -// -// Special note about ShowHelpAtPoint() and ShowHelp(): we want to be able to -// override ShowHelpAtPoint() when we need to use different help messages for -// different parts of the window, but it should also be possible to override -// just ShowHelp() both for backwards compatibility and just because most -// often the help does not, in fact, depend on the position and so -// implementing just ShowHelp() is simpler and more natural, so by default -// ShowHelpAtPoint() forwards to ShowHelp(). But this means that -// wxSimpleHelpProvider has to override ShowHelp() and not ShowHelpAtPoint() -// for backwards compatibility as otherwise the existing code deriving from it -// and overriding ShowHelp() but calling the base class version wouldn't work -// any more, which forces us to use a rather ugly hack and pass the extra -// parameters of ShowHelpAtPoint() to ShowHelp() via member variables. -class WXDLLEXPORT wxHelpProvider -{ -public: - // get/set the current (application-global) help provider (Set() returns - // the previous one) - static wxHelpProvider *Set(wxHelpProvider *helpProvider) - { - wxHelpProvider *helpProviderOld = ms_helpProvider; - ms_helpProvider = helpProvider; - return helpProviderOld; - } - - // unlike some other class, the help provider is not created on demand, - // this must be explicitly done by the application - static wxHelpProvider *Get() { return ms_helpProvider; } - - // get the help string (whose interpretation is help provider dependent - // except that empty string always means that no help is associated with - // the window) for this window - virtual wxString GetHelp(const wxWindowBase *window) = 0; - - // do show help for the given window (uses window->GetHelpAtPoint() - // internally if applicable), return true if it was done or false - // if no help available for this window - virtual bool ShowHelpAtPoint(wxWindowBase *window, - const wxPoint& pt, - wxHelpEvent::Origin origin) - { - wxCHECK_MSG( window, false, _T("window must not be NULL") ); - - m_helptextAtPoint = pt; - m_helptextOrigin = origin; - - return ShowHelp(window); - } - - // show help for the given window, see ShowHelpAtPoint() above - virtual bool ShowHelp(wxWindowBase * WXUNUSED(window)) { return false; } - - // associate the text with the given window or id: although all help - // providers have these functions to allow making wxWindow::SetHelpText() - // work, not all of them implement them - virtual void AddHelp(wxWindowBase *window, const wxString& text); - - // this version associates the given text with all window with this id - // (may be used to set the same help string for all [Cancel] buttons in - // the application, for example) - virtual void AddHelp(wxWindowID id, const wxString& text); - - // removes the association - virtual void RemoveHelp(wxWindowBase* window); - - // virtual dtor for any base class - virtual ~wxHelpProvider(); - -protected: - wxHelpProvider() - : m_helptextAtPoint(wxDefaultPosition), - m_helptextOrigin(wxHelpEvent::Origin_Unknown) - { - } - - // helper method used by ShowHelp(): returns the help string to use by - // using m_helptextAtPoint/m_helptextOrigin if they're set or just GetHelp - // otherwise - wxString GetHelpTextMaybeAtPoint(wxWindowBase *window); - - - // parameters of the last ShowHelpAtPoint() call, used by ShowHelp() - wxPoint m_helptextAtPoint; - wxHelpEvent::Origin m_helptextOrigin; - -private: - static wxHelpProvider *ms_helpProvider; -}; - -WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash, - wxIntegerEqual, wxSimpleHelpProviderHashMap ); - -// wxSimpleHelpProvider is an implementation of wxHelpProvider which supports -// only plain text help strings and shows the string associated with the -// control (if any) in a tooltip -class WXDLLEXPORT wxSimpleHelpProvider : public wxHelpProvider -{ -public: - // implement wxHelpProvider methods - virtual wxString GetHelp(const wxWindowBase *window); - - // override ShowHelp() and not ShowHelpAtPoint() as explained above - virtual bool ShowHelp(wxWindowBase *window); - - virtual void AddHelp(wxWindowBase *window, const wxString& text); - virtual void AddHelp(wxWindowID id, const wxString& text); - virtual void RemoveHelp(wxWindowBase* window); - -protected: - // we use 2 hashes for storing the help strings associated with windows - // and the ids - wxSimpleHelpProviderHashMap m_hashWindows, - m_hashIds; -}; - -// wxHelpControllerHelpProvider is an implementation of wxHelpProvider which supports -// both context identifiers and plain text help strings. If the help text is an integer, -// it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string -// in a tooltip as per wxSimpleHelpProvider. -class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider -{ -public: - // Note that it doesn't own the help controller. The help controller - // should be deleted separately. - wxHelpControllerHelpProvider(wxHelpControllerBase* hc = (wxHelpControllerBase*) NULL); - - // implement wxHelpProvider methods - - // again (see above): this should be ShowHelpAtPoint() but we need to - // override ShowHelp() to avoid breaking existing code - virtual bool ShowHelp(wxWindowBase *window); - - // Other accessors - void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; } - wxHelpControllerBase* GetHelpController() const { return m_helpController; } - -protected: - wxHelpControllerBase* m_helpController; - - DECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider) -}; - -// Convenience function for turning context id into wxString -WXDLLEXPORT wxString wxContextId(int id); - -#endif // wxUSE_HELP - -#endif // _WX_CSHELP_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cshelp.h +// Purpose: Context-sensitive help support classes +// Author: Julian Smart, Vadim Zeitlin +// Modified by: +// Created: 08/09/2000 +// RCS-ID: $Id: cshelp.h 39675 2006-06-11 21:10:32Z VZ $ +// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CSHELP_H_ +#define _WX_CSHELP_H_ + +#include "wx/defs.h" + +#if wxUSE_HELP + +#include "wx/help.h" + +#include "wx/hashmap.h" +#if wxUSE_BMPBUTTON +#include "wx/bmpbuttn.h" +#endif + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// classes used to implement context help UI +// ---------------------------------------------------------------------------- + +/* + * wxContextHelp + * Invokes context-sensitive help. When the user + * clicks on a window, a wxEVT_HELP event will be sent to that + * window for the application to display help for. + */ + +class WXDLLEXPORT wxContextHelp : public wxObject +{ +public: + wxContextHelp(wxWindow* win = NULL, bool beginHelp = true); + virtual ~wxContextHelp(); + + bool BeginContextHelp(wxWindow* win); + bool EndContextHelp(); + + bool EventLoop(); + bool DispatchEvent(wxWindow* win, const wxPoint& pt); + + void SetStatus(bool status) { m_status = status; } + +protected: + bool m_inHelp; + bool m_status; // true if the user left-clicked + +private: + DECLARE_DYNAMIC_CLASS(wxContextHelp) +}; + +#if wxUSE_BMPBUTTON +/* + * wxContextHelpButton + * You can add this to your dialogs (especially on non-Windows platforms) + * to put the application into context help mode. + */ + +class WXDLLEXPORT wxContextHelpButton : public wxBitmapButton +{ +public: + wxContextHelpButton(wxWindow* parent, + wxWindowID id = wxID_CONTEXT_HELP, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBU_AUTODRAW); + + void OnContextHelp(wxCommandEvent& event); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton) + DECLARE_EVENT_TABLE() +}; + +#endif + +// ---------------------------------------------------------------------------- +// classes used to implement context help support +// ---------------------------------------------------------------------------- + +// wxHelpProvider is an abstract class used by the program implementing context help to +// show the help text (or whatever: it may be HTML page or anything else) for +// the given window. +// +// The current help provider must be explicitly set by the application using +// wxHelpProvider::Set(). +// +// Special note about ShowHelpAtPoint() and ShowHelp(): we want to be able to +// override ShowHelpAtPoint() when we need to use different help messages for +// different parts of the window, but it should also be possible to override +// just ShowHelp() both for backwards compatibility and just because most +// often the help does not, in fact, depend on the position and so +// implementing just ShowHelp() is simpler and more natural, so by default +// ShowHelpAtPoint() forwards to ShowHelp(). But this means that +// wxSimpleHelpProvider has to override ShowHelp() and not ShowHelpAtPoint() +// for backwards compatibility as otherwise the existing code deriving from it +// and overriding ShowHelp() but calling the base class version wouldn't work +// any more, which forces us to use a rather ugly hack and pass the extra +// parameters of ShowHelpAtPoint() to ShowHelp() via member variables. +class WXDLLEXPORT wxHelpProvider +{ +public: + // get/set the current (application-global) help provider (Set() returns + // the previous one) + static wxHelpProvider *Set(wxHelpProvider *helpProvider) + { + wxHelpProvider *helpProviderOld = ms_helpProvider; + ms_helpProvider = helpProvider; + return helpProviderOld; + } + + // unlike some other class, the help provider is not created on demand, + // this must be explicitly done by the application + static wxHelpProvider *Get() { return ms_helpProvider; } + + // get the help string (whose interpretation is help provider dependent + // except that empty string always means that no help is associated with + // the window) for this window + virtual wxString GetHelp(const wxWindowBase *window) = 0; + + // do show help for the given window (uses window->GetHelpAtPoint() + // internally if applicable), return true if it was done or false + // if no help available for this window + virtual bool ShowHelpAtPoint(wxWindowBase *window, + const wxPoint& pt, + wxHelpEvent::Origin origin) + { + wxCHECK_MSG( window, false, _T("window must not be NULL") ); + + m_helptextAtPoint = pt; + m_helptextOrigin = origin; + + return ShowHelp(window); + } + + // show help for the given window, see ShowHelpAtPoint() above + virtual bool ShowHelp(wxWindowBase * WXUNUSED(window)) { return false; } + + // associate the text with the given window or id: although all help + // providers have these functions to allow making wxWindow::SetHelpText() + // work, not all of them implement them + virtual void AddHelp(wxWindowBase *window, const wxString& text); + + // this version associates the given text with all window with this id + // (may be used to set the same help string for all [Cancel] buttons in + // the application, for example) + virtual void AddHelp(wxWindowID id, const wxString& text); + + // removes the association + virtual void RemoveHelp(wxWindowBase* window); + + // virtual dtor for any base class + virtual ~wxHelpProvider(); + +protected: + wxHelpProvider() + : m_helptextAtPoint(wxDefaultPosition), + m_helptextOrigin(wxHelpEvent::Origin_Unknown) + { + } + + // helper method used by ShowHelp(): returns the help string to use by + // using m_helptextAtPoint/m_helptextOrigin if they're set or just GetHelp + // otherwise + wxString GetHelpTextMaybeAtPoint(wxWindowBase *window); + + + // parameters of the last ShowHelpAtPoint() call, used by ShowHelp() + wxPoint m_helptextAtPoint; + wxHelpEvent::Origin m_helptextOrigin; + +private: + static wxHelpProvider *ms_helpProvider; +}; + +WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash, + wxIntegerEqual, wxSimpleHelpProviderHashMap ); + +// wxSimpleHelpProvider is an implementation of wxHelpProvider which supports +// only plain text help strings and shows the string associated with the +// control (if any) in a tooltip +class WXDLLEXPORT wxSimpleHelpProvider : public wxHelpProvider +{ +public: + // implement wxHelpProvider methods + virtual wxString GetHelp(const wxWindowBase *window); + + // override ShowHelp() and not ShowHelpAtPoint() as explained above + virtual bool ShowHelp(wxWindowBase *window); + + virtual void AddHelp(wxWindowBase *window, const wxString& text); + virtual void AddHelp(wxWindowID id, const wxString& text); + virtual void RemoveHelp(wxWindowBase* window); + +protected: + // we use 2 hashes for storing the help strings associated with windows + // and the ids + wxSimpleHelpProviderHashMap m_hashWindows, + m_hashIds; +}; + +// wxHelpControllerHelpProvider is an implementation of wxHelpProvider which supports +// both context identifiers and plain text help strings. If the help text is an integer, +// it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string +// in a tooltip as per wxSimpleHelpProvider. +class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider +{ +public: + // Note that it doesn't own the help controller. The help controller + // should be deleted separately. + wxHelpControllerHelpProvider(wxHelpControllerBase* hc = (wxHelpControllerBase*) NULL); + + // implement wxHelpProvider methods + + // again (see above): this should be ShowHelpAtPoint() but we need to + // override ShowHelp() to avoid breaking existing code + virtual bool ShowHelp(wxWindowBase *window); + + // Other accessors + void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; } + wxHelpControllerBase* GetHelpController() const { return m_helpController; } + +protected: + wxHelpControllerBase* m_helpController; + + DECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider) +}; + +// Convenience function for turning context id into wxString +WXDLLEXPORT wxString wxContextId(int id); + +#endif // wxUSE_HELP + +#endif // _WX_CSHELP_H_ + diff --git a/Externals/wxWidgets/include/wx/ctrlsub.h b/Externals/wxWidgets/include/wx/ctrlsub.h index dc29fe63ff..6697bb6b32 100644 --- a/Externals/wxWidgets/include/wx/ctrlsub.h +++ b/Externals/wxWidgets/include/wx/ctrlsub.h @@ -1,210 +1,210 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems") -// Purpose: wxControlWithItems interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.10.99 -// RCS-ID: $Id: ctrlsub.h 42816 2006-10-31 08:50:17Z RD $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CTRLSUB_H_BASE_ -#define _WX_CTRLSUB_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_CONTROLS - -#include "wx/control.h" // base class - -// ---------------------------------------------------------------------------- -// wxItemContainer defines an interface which is implemented by all controls -// which have string subitems each of which may be selected. -// -// It is decomposed in wxItemContainerImmutable which omits all methods -// adding/removing items and is used by wxRadioBox and wxItemContainer itself. -// -// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which -// implements an extended interface deriving from this one) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxItemContainerImmutable -{ -public: - wxItemContainerImmutable() { } - virtual ~wxItemContainerImmutable(); - - // accessing strings - // ----------------- - - virtual unsigned int GetCount() const = 0; - bool IsEmpty() const { return GetCount() == 0; } - - virtual wxString GetString(unsigned int n) const = 0; - wxArrayString GetStrings() const; - virtual void SetString(unsigned int n, const wxString& s) = 0; - - // finding string natively is either case sensitive or insensitive - // but never both so fall back to this base version for not - // supported search type - virtual int FindString(const wxString& s, bool bCase = false) const - { - unsigned int count = GetCount(); - - for ( unsigned int i = 0; i < count ; ++i ) - { - if (GetString(i).IsSameAs( s , bCase )) - return (int)i; - } - - return wxNOT_FOUND; - } - - - // selection - // --------- - - virtual void SetSelection(int n) = 0; - virtual int GetSelection() const = 0; - - // set selection to the specified string, return false if not found - bool SetStringSelection(const wxString& s); - - // return the selected string or empty string if none - wxString GetStringSelection() const; - - // this is the same as SetSelection( for single-selection controls but - // reads better for multi-selection ones - void Select(int n) { SetSelection(n); } - - -protected: - - // check that the index is valid - inline bool IsValid(unsigned int n) const { return n < GetCount(); } - inline bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } -}; - -class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable -{ -public: - wxItemContainer() { m_clientDataItemsType = wxClientData_None; } - virtual ~wxItemContainer(); - - // adding items - // ------------ - - int Append(const wxString& item) - { return DoAppend(item); } - int Append(const wxString& item, void *clientData) - { int n = DoAppend(item); SetClientData(n, clientData); return n; } - int Append(const wxString& item, wxClientData *clientData) - { int n = DoAppend(item); SetClientObject(n, clientData); return n; } - - // only for rtti needs (separate name) - void AppendString( const wxString& item) - { Append( item ); } - - // append several items at once to the control - void Append(const wxArrayString& strings); - - int Insert(const wxString& item, unsigned int pos) - { return DoInsert(item, pos); } - int Insert(const wxString& item, unsigned int pos, void *clientData); - int Insert(const wxString& item, unsigned int pos, wxClientData *clientData); - - // deleting items - // -------------- - - virtual void Clear() = 0; - virtual void Delete(unsigned int n) = 0; - - // misc - // ---- - - // client data stuff - void SetClientData(unsigned int n, void* clientData); - void* GetClientData(unsigned int n) const; - - void SetClientObject(unsigned int n, wxClientData* clientData); - wxClientData* GetClientObject(unsigned int n) const; - - bool HasClientObjectData() const - { return m_clientDataItemsType == wxClientData_Object; } - bool HasClientUntypedData() const - { return m_clientDataItemsType == wxClientData_Void; } - -protected: - virtual int DoAppend(const wxString& item) = 0; - virtual int DoInsert(const wxString& item, unsigned int pos) = 0; - - virtual void DoSetItemClientData(unsigned int n, void* clientData) = 0; - virtual void* DoGetItemClientData(unsigned int n) const = 0; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData) = 0; - virtual wxClientData* DoGetItemClientObject(unsigned int n) const = 0; - - - // the type of the client data for the items - wxClientDataType m_clientDataItemsType; -}; - -// this macro must (unfortunately) be used in any class deriving from both -// wxItemContainer and wxControl because otherwise there is ambiguity when -// calling GetClientXXX() functions -- the compiler can't choose between the -// two versions -#define wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST \ - void SetClientData(void *data) \ - { wxEvtHandler::SetClientData(data); } \ - void *GetClientData() const \ - { return wxEvtHandler::GetClientData(); } \ - void SetClientObject(wxClientData *data) \ - { wxEvtHandler::SetClientObject(data); } \ - wxClientData *GetClientObject() const \ - { return wxEvtHandler::GetClientObject(); } \ - void SetClientData(unsigned int n, void* clientData) \ - { wxItemContainer::SetClientData(n, clientData); } \ - void* GetClientData(unsigned int n) const \ - { return wxItemContainer::GetClientData(n); } \ - void SetClientObject(unsigned int n, wxClientData* clientData) \ - { wxItemContainer::SetClientObject(n, clientData); } \ - wxClientData* GetClientObject(unsigned int n) const \ - { return wxItemContainer::GetClientObject(n); } - -class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer -{ -public: - wxControlWithItems() { } - virtual ~wxControlWithItems(); - - // we have to redefine these functions here to avoid ambiguities in classes - // deriving from us which would arise otherwise because both base classses - // have the methods with the same names - hopefully, a smart compiler can - // optimize away these simple inline wrappers so we don't suffer much from - // this - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - - // usually the controls like list/combo boxes have their own background - // colour - virtual bool ShouldInheritColours() const { return false; } - -protected: - // fill in the client object or data field of the event as appropriate - // - // calls InitCommandEvent() and, if n != wxNOT_FOUND, also sets the per - // item client data - void InitCommandEventWithItems(wxCommandEvent& event, int n); - -private: - DECLARE_ABSTRACT_CLASS(wxControlWithItems) - DECLARE_NO_COPY_CLASS(wxControlWithItems) -}; - - -// ---------------------------------------------------------------------------- -// inline functions -// ---------------------------------------------------------------------------- - -#endif // wxUSE_CONTROLS - -#endif // _WX_CTRLSUB_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems") +// Purpose: wxControlWithItems interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.10.99 +// RCS-ID: $Id: ctrlsub.h 42816 2006-10-31 08:50:17Z RD $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CTRLSUB_H_BASE_ +#define _WX_CTRLSUB_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CONTROLS + +#include "wx/control.h" // base class + +// ---------------------------------------------------------------------------- +// wxItemContainer defines an interface which is implemented by all controls +// which have string subitems each of which may be selected. +// +// It is decomposed in wxItemContainerImmutable which omits all methods +// adding/removing items and is used by wxRadioBox and wxItemContainer itself. +// +// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which +// implements an extended interface deriving from this one) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxItemContainerImmutable +{ +public: + wxItemContainerImmutable() { } + virtual ~wxItemContainerImmutable(); + + // accessing strings + // ----------------- + + virtual unsigned int GetCount() const = 0; + bool IsEmpty() const { return GetCount() == 0; } + + virtual wxString GetString(unsigned int n) const = 0; + wxArrayString GetStrings() const; + virtual void SetString(unsigned int n, const wxString& s) = 0; + + // finding string natively is either case sensitive or insensitive + // but never both so fall back to this base version for not + // supported search type + virtual int FindString(const wxString& s, bool bCase = false) const + { + unsigned int count = GetCount(); + + for ( unsigned int i = 0; i < count ; ++i ) + { + if (GetString(i).IsSameAs( s , bCase )) + return (int)i; + } + + return wxNOT_FOUND; + } + + + // selection + // --------- + + virtual void SetSelection(int n) = 0; + virtual int GetSelection() const = 0; + + // set selection to the specified string, return false if not found + bool SetStringSelection(const wxString& s); + + // return the selected string or empty string if none + wxString GetStringSelection() const; + + // this is the same as SetSelection( for single-selection controls but + // reads better for multi-selection ones + void Select(int n) { SetSelection(n); } + + +protected: + + // check that the index is valid + inline bool IsValid(unsigned int n) const { return n < GetCount(); } + inline bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } +}; + +class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable +{ +public: + wxItemContainer() { m_clientDataItemsType = wxClientData_None; } + virtual ~wxItemContainer(); + + // adding items + // ------------ + + int Append(const wxString& item) + { return DoAppend(item); } + int Append(const wxString& item, void *clientData) + { int n = DoAppend(item); SetClientData(n, clientData); return n; } + int Append(const wxString& item, wxClientData *clientData) + { int n = DoAppend(item); SetClientObject(n, clientData); return n; } + + // only for rtti needs (separate name) + void AppendString( const wxString& item) + { Append( item ); } + + // append several items at once to the control + void Append(const wxArrayString& strings); + + int Insert(const wxString& item, unsigned int pos) + { return DoInsert(item, pos); } + int Insert(const wxString& item, unsigned int pos, void *clientData); + int Insert(const wxString& item, unsigned int pos, wxClientData *clientData); + + // deleting items + // -------------- + + virtual void Clear() = 0; + virtual void Delete(unsigned int n) = 0; + + // misc + // ---- + + // client data stuff + void SetClientData(unsigned int n, void* clientData); + void* GetClientData(unsigned int n) const; + + void SetClientObject(unsigned int n, wxClientData* clientData); + wxClientData* GetClientObject(unsigned int n) const; + + bool HasClientObjectData() const + { return m_clientDataItemsType == wxClientData_Object; } + bool HasClientUntypedData() const + { return m_clientDataItemsType == wxClientData_Void; } + +protected: + virtual int DoAppend(const wxString& item) = 0; + virtual int DoInsert(const wxString& item, unsigned int pos) = 0; + + virtual void DoSetItemClientData(unsigned int n, void* clientData) = 0; + virtual void* DoGetItemClientData(unsigned int n) const = 0; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData) = 0; + virtual wxClientData* DoGetItemClientObject(unsigned int n) const = 0; + + + // the type of the client data for the items + wxClientDataType m_clientDataItemsType; +}; + +// this macro must (unfortunately) be used in any class deriving from both +// wxItemContainer and wxControl because otherwise there is ambiguity when +// calling GetClientXXX() functions -- the compiler can't choose between the +// two versions +#define wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST \ + void SetClientData(void *data) \ + { wxEvtHandler::SetClientData(data); } \ + void *GetClientData() const \ + { return wxEvtHandler::GetClientData(); } \ + void SetClientObject(wxClientData *data) \ + { wxEvtHandler::SetClientObject(data); } \ + wxClientData *GetClientObject() const \ + { return wxEvtHandler::GetClientObject(); } \ + void SetClientData(unsigned int n, void* clientData) \ + { wxItemContainer::SetClientData(n, clientData); } \ + void* GetClientData(unsigned int n) const \ + { return wxItemContainer::GetClientData(n); } \ + void SetClientObject(unsigned int n, wxClientData* clientData) \ + { wxItemContainer::SetClientObject(n, clientData); } \ + wxClientData* GetClientObject(unsigned int n) const \ + { return wxItemContainer::GetClientObject(n); } + +class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer +{ +public: + wxControlWithItems() { } + virtual ~wxControlWithItems(); + + // we have to redefine these functions here to avoid ambiguities in classes + // deriving from us which would arise otherwise because both base classses + // have the methods with the same names - hopefully, a smart compiler can + // optimize away these simple inline wrappers so we don't suffer much from + // this + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + + // usually the controls like list/combo boxes have their own background + // colour + virtual bool ShouldInheritColours() const { return false; } + +protected: + // fill in the client object or data field of the event as appropriate + // + // calls InitCommandEvent() and, if n != wxNOT_FOUND, also sets the per + // item client data + void InitCommandEventWithItems(wxCommandEvent& event, int n); + +private: + DECLARE_ABSTRACT_CLASS(wxControlWithItems) + DECLARE_NO_COPY_CLASS(wxControlWithItems) +}; + + +// ---------------------------------------------------------------------------- +// inline functions +// ---------------------------------------------------------------------------- + +#endif // wxUSE_CONTROLS + +#endif // _WX_CTRLSUB_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/cursor.h b/Externals/wxWidgets/include/wx/cursor.h index d072ff56a7..39b4e21940 100644 --- a/Externals/wxWidgets/include/wx/cursor.h +++ b/Externals/wxWidgets/include/wx/cursor.h @@ -1,79 +1,79 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cursor.h -// Purpose: wxCursor base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: cursor.h 40865 2006-08-27 09:42:42Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CURSOR_H_BASE_ -#define _WX_CURSOR_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) - #include "wx/palmos/cursor.h" -#elif defined(__WXMSW__) - #include "wx/msw/cursor.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/cursor.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/cursor.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/cursor.h" -#elif defined(__WXX11__) - #include "wx/x11/cursor.h" -#elif defined(__WXMGL__) - #include "wx/mgl/cursor.h" -#elif defined(__WXDFB__) - #include "wx/dfb/cursor.h" -#elif defined(__WXMAC__) - #include "wx/mac/cursor.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/cursor.h" -#elif defined(__WXPM__) - #include "wx/os2/cursor.h" -#endif - -#include "wx/utils.h" - -/* This is a small class which can be used by all ports - to temporarily suspend the busy cursor. Useful in modal - dialogs. - - Actually that is not (any longer) quite true.. currently it is - only used in wxGTK Dialog::ShowModal() and now uses static - wxBusyCursor methods that are only implemented for wxGTK so far. - The BusyCursor handling code should probably be implemented in - common code somewhere instead of the separate implementations we - currently have. Also the name BusyCursorSuspender is a little - misleading since it doesn't actually suspend the BusyCursor, just - masks one that is already showing. - If another call to wxBeginBusyCursor is made while this is active - the Busy Cursor will again be shown. But at least now it doesn't - interfere with the state of wxIsBusy() -- RL - -*/ -class wxBusyCursorSuspender -{ -public: - wxBusyCursorSuspender() - { - if( wxIsBusy() ) - { - wxSetCursor( wxBusyCursor::GetStoredCursor() ); - } - } - ~wxBusyCursorSuspender() - { - if( wxIsBusy() ) - { - wxSetCursor( wxBusyCursor::GetBusyCursor() ); - } - } -}; -#endif - // _WX_CURSOR_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cursor.h +// Purpose: wxCursor base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: cursor.h 40865 2006-08-27 09:42:42Z VS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_BASE_ +#define _WX_CURSOR_H_BASE_ + +#include "wx/defs.h" + +#if defined(__WXPALMOS__) + #include "wx/palmos/cursor.h" +#elif defined(__WXMSW__) + #include "wx/msw/cursor.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/cursor.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/cursor.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/cursor.h" +#elif defined(__WXX11__) + #include "wx/x11/cursor.h" +#elif defined(__WXMGL__) + #include "wx/mgl/cursor.h" +#elif defined(__WXDFB__) + #include "wx/dfb/cursor.h" +#elif defined(__WXMAC__) + #include "wx/mac/cursor.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/cursor.h" +#elif defined(__WXPM__) + #include "wx/os2/cursor.h" +#endif + +#include "wx/utils.h" + +/* This is a small class which can be used by all ports + to temporarily suspend the busy cursor. Useful in modal + dialogs. + + Actually that is not (any longer) quite true.. currently it is + only used in wxGTK Dialog::ShowModal() and now uses static + wxBusyCursor methods that are only implemented for wxGTK so far. + The BusyCursor handling code should probably be implemented in + common code somewhere instead of the separate implementations we + currently have. Also the name BusyCursorSuspender is a little + misleading since it doesn't actually suspend the BusyCursor, just + masks one that is already showing. + If another call to wxBeginBusyCursor is made while this is active + the Busy Cursor will again be shown. But at least now it doesn't + interfere with the state of wxIsBusy() -- RL + +*/ +class wxBusyCursorSuspender +{ +public: + wxBusyCursorSuspender() + { + if( wxIsBusy() ) + { + wxSetCursor( wxBusyCursor::GetStoredCursor() ); + } + } + ~wxBusyCursorSuspender() + { + if( wxIsBusy() ) + { + wxSetCursor( wxBusyCursor::GetBusyCursor() ); + } + } +}; +#endif + // _WX_CURSOR_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dataobj.h b/Externals/wxWidgets/include/wx/dataobj.h index 31a756e235..4c290dc340 100644 --- a/Externals/wxWidgets/include/wx/dataobj.h +++ b/Externals/wxWidgets/include/wx/dataobj.h @@ -1,540 +1,540 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dataobj.h -// Purpose: common data object classes -// Author: Vadim Zeitlin, Robert Roebling -// Modified by: -// Created: 26.05.99 -// RCS-ID: $Id: dataobj.h 40772 2006-08-23 13:38:45Z VZ $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATAOBJ_H_BASE_ -#define _WX_DATAOBJ_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- -#include "wx/defs.h" - -#if wxUSE_DATAOBJ - -#include "wx/string.h" -#include "wx/bitmap.h" -#include "wx/list.h" -#include "wx/arrstr.h" - -// ============================================================================ -/* - Generic data transfer related classes. The class hierarchy is as follows: - - - wxDataObject- - / \ - / \ - wxDataObjectSimple wxDataObjectComposite - / | \ - / | \ - wxTextDataObject | wxBitmapDataObject - | - wxCustomDataObject - -*/ -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxDataFormat class is declared in platform-specific headers: it represents -// a format for data which may be either one of the standard ones (text, -// bitmap, ...) or a custom one which is then identified by a unique string. -// ---------------------------------------------------------------------------- - -/* the class interface looks like this (pseudo code): - -class wxDataFormat -{ -public: - typedef NativeFormat; - - wxDataFormat(NativeFormat format = wxDF_INVALID); - wxDataFormat(const wxChar *format); - - wxDataFormat& operator=(NativeFormat format); - wxDataFormat& operator=(const wxDataFormat& format); - - bool operator==(NativeFormat format) const; - bool operator!=(NativeFormat format) const; - - void SetType(NativeFormat format); - NativeFormat GetType() const; - - wxString GetId() const; - void SetId(const wxChar *format); -}; - -*/ - -#if defined(__WXMSW__) - #include "wx/msw/ole/dataform.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dataform.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dataform.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dataform.h" -#elif defined(__WXX11__) - #include "wx/x11/dataform.h" -#elif defined(__WXMAC__) - #include "wx/mac/dataform.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dataform.h" -#elif defined(__WXPM__) - #include "wx/os2/dataform.h" -#endif - -// the value for default argument to some functions (corresponds to -// wxDF_INVALID) -extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid; - -// ---------------------------------------------------------------------------- -// wxDataObject represents a piece of data which knows which formats it -// supports and knows how to render itself in each of them - GetDataHere(), -// and how to restore data from the buffer (SetData()). -// -// Although this class may be used directly (i.e. custom classes may be -// derived from it), in many cases it might be simpler to use either -// wxDataObjectSimple or wxDataObjectComposite classes. -// -// A data object may be "read only", i.e. support only GetData() functions or -// "read-write", i.e. support both GetData() and SetData() (in principle, it -// might be "write only" too, but this is rare). Moreover, it doesn't have to -// support the same formats in Get() and Set() directions: for example, a data -// object containing JPEG image might accept BMPs in GetData() because JPEG -// image may be easily transformed into BMP but not in SetData(). Accordingly, -// all methods dealing with formats take an additional "direction" argument -// which is either SET or GET and which tells the function if the format needs -// to be supported by SetData() or GetDataHere(). -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataObjectBase -{ -public: - enum Direction - { - Get = 0x01, // format is supported by GetDataHere() - Set = 0x02, // format is supported by SetData() - Both = 0x03 // format is supported by both (unused currently) - }; - - // this class is polymorphic, hence it needs a virtual dtor - virtual ~wxDataObjectBase(); - - // get the best suited format for rendering our data - virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0; - - // get the number of formats we support - virtual size_t GetFormatCount(Direction dir = Get) const = 0; - - // return all formats in the provided array (of size GetFormatCount()) - virtual void GetAllFormats(wxDataFormat *formats, - Direction dir = Get) const = 0; - - // get the (total) size of data for the given format - virtual size_t GetDataSize(const wxDataFormat& format) const = 0; - - // copy raw data (in the specified format) to the provided buffer, return - // true if data copied successfully, false otherwise - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0; - - // get data from the buffer of specified length (in the given format), - // return true if the data was read successfully, false otherwise - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t WXUNUSED(len), const void * WXUNUSED(buf)) - { - return false; - } - - // returns true if this format is supported - bool IsSupported(const wxDataFormat& format, Direction dir = Get) const; -}; - -// ---------------------------------------------------------------------------- -// include the platform-specific declarations of wxDataObject -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/dataobj.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dataobj.h" -#elif defined(__WXX11__) - #include "wx/x11/dataobj.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dataobj.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dataobj.h" -#elif defined(__WXMAC__) - #include "wx/mac/dataobj.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dataobj.h" -#elif defined(__WXPM__) - #include "wx/os2/dataobj.h" -#endif - -// ---------------------------------------------------------------------------- -// wxDataObjectSimple is a wxDataObject which only supports one format (in -// both Get and Set directions, but you may return false from GetDataHere() or -// SetData() if one of them is not supported). This is the simplest possible -// wxDataObject implementation. -// -// This is still an "abstract base class" (although it doesn't have any pure -// virtual functions), to use it you should derive from it and implement -// GetDataSize(), GetDataHere() and SetData() functions because the base class -// versions don't do anything - they just return "not implemented". -// -// This class should be used when you provide data in only one format (no -// conversion to/from other formats), either a standard or a custom one. -// Otherwise, you should use wxDataObjectComposite or wxDataObject directly. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataObjectSimple : public wxDataObject -{ -public: - // ctor takes the format we support, but it can also be set later with - // SetFormat() - wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid) - : m_format(format) - { - } - - // get/set the format we support - const wxDataFormat& GetFormat() const { return m_format; } - void SetFormat(const wxDataFormat& format) { m_format = format; } - - // virtual functions to override in derived class (the base class versions - // just return "not implemented") - // ----------------------------------------------------------------------- - - // get the size of our data - virtual size_t GetDataSize() const - { return 0; } - - // copy our data to the buffer - virtual bool GetDataHere(void *WXUNUSED(buf)) const - { return false; } - - // copy data from buffer to our data - virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf)) - { return false; } - - // implement base class pure virtuals - // ---------------------------------- - virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const - { return m_format; } - virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const - { return 1; } - virtual void GetAllFormats(wxDataFormat *formats, - wxDataObjectBase::Direction WXUNUSED(dir) = Get) const - { *formats = m_format; } - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - // the one and only format we support - wxDataFormat m_format; - - DECLARE_NO_COPY_CLASS(wxDataObjectSimple) -}; - -// ---------------------------------------------------------------------------- -// wxDataObjectComposite is the simplest way to implement wxDataObject -// supporting multiple formats. It contains several wxDataObjectSimple and -// supports all formats supported by any of them. -// -// This class shouldn't be (normally) derived from, but may be used directly. -// If you need more flexibility than what it provides, you should probably use -// wxDataObject directly. -// ---------------------------------------------------------------------------- - -WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList); - -class WXDLLEXPORT wxDataObjectComposite : public wxDataObject -{ -public: - // ctor - wxDataObjectComposite(); - virtual ~wxDataObjectComposite(); - - // add data object (it will be deleted by wxDataObjectComposite, hence it - // must be allocated on the heap) whose format will become the preferred - // one if preferred == true - void Add(wxDataObjectSimple *dataObject, bool preferred = false); - - // Report the format passed to the SetData method. This should be the - // format of the data object within the composite that recieved data from - // the clipboard or the DnD operation. You can use this method to find - // out what kind of data object was recieved. - wxDataFormat GetReceivedFormat() const; - - // implement base class pure virtuals - // ---------------------------------- - virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const; - virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const; - virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const; - virtual size_t GetDataSize(const wxDataFormat& format) const; - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; - virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf); -#if defined(__WXMSW__) - virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, - const wxDataFormat& format ); - virtual void* SetSizeInBuffer( void* buffer, size_t size, - const wxDataFormat& format ); - virtual size_t GetBufferOffset( const wxDataFormat& format ); -#endif - -protected: - // returns the pointer to the object which supports this format or NULL - wxDataObjectSimple *GetObject(const wxDataFormat& format) const; - -private: - // the list of all (simple) data objects whose formats we support - wxSimpleDataObjectList m_dataObjects; - - // the index of the preferred one (0 initially, so by default the first - // one is the preferred) - size_t m_preferred; - - wxDataFormat m_receivedFormat; - - DECLARE_NO_COPY_CLASS(wxDataObjectComposite) -}; - -// ============================================================================ -// Standard implementations of wxDataObjectSimple which can be used directly -// (i.e. without having to derive from them) for standard data type transfers. -// -// Note that although all of them can work with provided data, you can also -// override their virtual GetXXX() functions to only provide data on demand. -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxTextDataObject contains text data -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextDataObject : public wxDataObjectSimple -{ -public: - // ctor: you can specify the text here or in SetText(), or override - // GetText() - wxTextDataObject(const wxString& text = wxEmptyString) - : wxDataObjectSimple( -#if wxUSE_UNICODE - wxDF_UNICODETEXT -#else - wxDF_TEXT -#endif - ), - m_text(text) - { - } - - // virtual functions which you may override if you want to provide text on - // demand only - otherwise, the trivial default versions will be used - virtual size_t GetTextLength() const { return m_text.Len() + 1; } - virtual wxString GetText() const { return m_text; } - virtual void SetText(const wxString& text) { m_text = text; } - - // implement base class pure virtuals - // ---------------------------------- - - // some platforms have 2 and not 1 format for text data -#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__)) - virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } - virtual void GetAllFormats(wxDataFormat *formats, - wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; - - virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); } - virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); } - virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); } - - size_t GetDataSize(const wxDataFormat& format) const; - bool GetDataHere(const wxDataFormat& format, void *pBuf) const; - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); -#else - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } -#endif - -private: - wxString m_text; - - DECLARE_NO_COPY_CLASS(wxTextDataObject) -}; - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject contains a bitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapDataObjectBase : public wxDataObjectSimple -{ -public: - // ctor: you can specify the bitmap here or in SetBitmap(), or override - // GetBitmap() - wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap) - : wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap) - { - } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual wxBitmap GetBitmap() const { return m_bitmap; } - virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } - -protected: - wxBitmap m_bitmap; - - DECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase) -}; - -// ---------------------------------------------------------------------------- -// wxFileDataObject contains a list of filenames -// -// NB: notice that this is a "write only" object, it can only be filled with -// data from drag and drop operation. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDataObjectBase : public wxDataObjectSimple -{ -public: - // ctor: use AddFile() later to fill the array - wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { } - - // get a reference to our array - const wxArrayString& GetFilenames() const { return m_filenames; } - -protected: - wxArrayString m_filenames; - - DECLARE_NO_COPY_CLASS(wxFileDataObjectBase) -}; - -// ---------------------------------------------------------------------------- -// wxCustomDataObject contains arbitrary untyped user data. -// -// It is understood that this data can be copied bitwise. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCustomDataObject : public wxDataObjectSimple -{ -public: - // if you don't specify the format in the ctor, you can still use - // SetFormat() later - wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid); - - // the dtor calls Free() - virtual ~wxCustomDataObject(); - - // you can call SetData() to set m_data: it will make a copy of the data - // you pass - or you can use TakeData() which won't copy anything, but - // will take ownership of data (i.e. will call Free() on it later) - void TakeData(size_t size, void *data); - - // this function is called to allocate "size" bytes of memory from - // SetData(). The default version uses operator new[]. - virtual void *Alloc(size_t size); - - // this function is called when the data is freed, you may override it to - // anything you want (or may be nothing at all). The default version calls - // operator delete[] on m_data - virtual void Free(); - - // get data: you may override these functions if you wish to provide data - // only when it's requested - virtual size_t GetSize() const { return m_size; } - virtual void *GetData() const { return m_data; } - - // implement base class pure virtuals - // ---------------------------------- - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t size, const void *buf); - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } - -private: - size_t m_size; - void *m_data; - - DECLARE_NO_COPY_CLASS(wxCustomDataObject) -}; - -// ---------------------------------------------------------------------------- -// include platform-specific declarations of wxXXXBase classes -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/dataobj2.h" - - // wxURLDataObject defined in msw/ole/dataobj2.h -#else // !__WXMSW__ - #if defined(__WXGTK20__) - #include "wx/gtk/dataobj2.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/dataobj2.h" - #elif defined(__WXX11__) - #include "wx/x11/dataobj2.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/dataobj2.h" - #elif defined(__WXMAC__) - #include "wx/mac/dataobj2.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/dataobj2.h" - #elif defined(__WXPM__) - #include "wx/os2/dataobj2.h" - #endif - - // wxURLDataObject is simply wxTextDataObject with a different name - class WXDLLEXPORT wxURLDataObject : public wxTextDataObject - { - public: - wxURLDataObject(const wxString& url = wxEmptyString) - : wxTextDataObject(url) - { - } - - wxString GetURL() const { return GetText(); } - void SetURL(const wxString& url) { SetText(url); } - }; -#endif // __WXMSW__/!__WXMSW__ - -#endif // wxUSE_DATAOBJ - -#endif // _WX_DATAOBJ_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dataobj.h +// Purpose: common data object classes +// Author: Vadim Zeitlin, Robert Roebling +// Modified by: +// Created: 26.05.99 +// RCS-ID: $Id: dataobj.h 40772 2006-08-23 13:38:45Z VZ $ +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAOBJ_H_BASE_ +#define _WX_DATAOBJ_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/defs.h" + +#if wxUSE_DATAOBJ + +#include "wx/string.h" +#include "wx/bitmap.h" +#include "wx/list.h" +#include "wx/arrstr.h" + +// ============================================================================ +/* + Generic data transfer related classes. The class hierarchy is as follows: + + - wxDataObject- + / \ + / \ + wxDataObjectSimple wxDataObjectComposite + / | \ + / | \ + wxTextDataObject | wxBitmapDataObject + | + wxCustomDataObject + +*/ +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDataFormat class is declared in platform-specific headers: it represents +// a format for data which may be either one of the standard ones (text, +// bitmap, ...) or a custom one which is then identified by a unique string. +// ---------------------------------------------------------------------------- + +/* the class interface looks like this (pseudo code): + +class wxDataFormat +{ +public: + typedef NativeFormat; + + wxDataFormat(NativeFormat format = wxDF_INVALID); + wxDataFormat(const wxChar *format); + + wxDataFormat& operator=(NativeFormat format); + wxDataFormat& operator=(const wxDataFormat& format); + + bool operator==(NativeFormat format) const; + bool operator!=(NativeFormat format) const; + + void SetType(NativeFormat format); + NativeFormat GetType() const; + + wxString GetId() const; + void SetId(const wxChar *format); +}; + +*/ + +#if defined(__WXMSW__) + #include "wx/msw/ole/dataform.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dataform.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dataform.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dataform.h" +#elif defined(__WXX11__) + #include "wx/x11/dataform.h" +#elif defined(__WXMAC__) + #include "wx/mac/dataform.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/dataform.h" +#elif defined(__WXPM__) + #include "wx/os2/dataform.h" +#endif + +// the value for default argument to some functions (corresponds to +// wxDF_INVALID) +extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid; + +// ---------------------------------------------------------------------------- +// wxDataObject represents a piece of data which knows which formats it +// supports and knows how to render itself in each of them - GetDataHere(), +// and how to restore data from the buffer (SetData()). +// +// Although this class may be used directly (i.e. custom classes may be +// derived from it), in many cases it might be simpler to use either +// wxDataObjectSimple or wxDataObjectComposite classes. +// +// A data object may be "read only", i.e. support only GetData() functions or +// "read-write", i.e. support both GetData() and SetData() (in principle, it +// might be "write only" too, but this is rare). Moreover, it doesn't have to +// support the same formats in Get() and Set() directions: for example, a data +// object containing JPEG image might accept BMPs in GetData() because JPEG +// image may be easily transformed into BMP but not in SetData(). Accordingly, +// all methods dealing with formats take an additional "direction" argument +// which is either SET or GET and which tells the function if the format needs +// to be supported by SetData() or GetDataHere(). +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataObjectBase +{ +public: + enum Direction + { + Get = 0x01, // format is supported by GetDataHere() + Set = 0x02, // format is supported by SetData() + Both = 0x03 // format is supported by both (unused currently) + }; + + // this class is polymorphic, hence it needs a virtual dtor + virtual ~wxDataObjectBase(); + + // get the best suited format for rendering our data + virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0; + + // get the number of formats we support + virtual size_t GetFormatCount(Direction dir = Get) const = 0; + + // return all formats in the provided array (of size GetFormatCount()) + virtual void GetAllFormats(wxDataFormat *formats, + Direction dir = Get) const = 0; + + // get the (total) size of data for the given format + virtual size_t GetDataSize(const wxDataFormat& format) const = 0; + + // copy raw data (in the specified format) to the provided buffer, return + // true if data copied successfully, false otherwise + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0; + + // get data from the buffer of specified length (in the given format), + // return true if the data was read successfully, false otherwise + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t WXUNUSED(len), const void * WXUNUSED(buf)) + { + return false; + } + + // returns true if this format is supported + bool IsSupported(const wxDataFormat& format, Direction dir = Get) const; +}; + +// ---------------------------------------------------------------------------- +// include the platform-specific declarations of wxDataObject +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/dataobj.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dataobj.h" +#elif defined(__WXX11__) + #include "wx/x11/dataobj.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dataobj.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dataobj.h" +#elif defined(__WXMAC__) + #include "wx/mac/dataobj.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/dataobj.h" +#elif defined(__WXPM__) + #include "wx/os2/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxDataObjectSimple is a wxDataObject which only supports one format (in +// both Get and Set directions, but you may return false from GetDataHere() or +// SetData() if one of them is not supported). This is the simplest possible +// wxDataObject implementation. +// +// This is still an "abstract base class" (although it doesn't have any pure +// virtual functions), to use it you should derive from it and implement +// GetDataSize(), GetDataHere() and SetData() functions because the base class +// versions don't do anything - they just return "not implemented". +// +// This class should be used when you provide data in only one format (no +// conversion to/from other formats), either a standard or a custom one. +// Otherwise, you should use wxDataObjectComposite or wxDataObject directly. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataObjectSimple : public wxDataObject +{ +public: + // ctor takes the format we support, but it can also be set later with + // SetFormat() + wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid) + : m_format(format) + { + } + + // get/set the format we support + const wxDataFormat& GetFormat() const { return m_format; } + void SetFormat(const wxDataFormat& format) { m_format = format; } + + // virtual functions to override in derived class (the base class versions + // just return "not implemented") + // ----------------------------------------------------------------------- + + // get the size of our data + virtual size_t GetDataSize() const + { return 0; } + + // copy our data to the buffer + virtual bool GetDataHere(void *WXUNUSED(buf)) const + { return false; } + + // copy data from buffer to our data + virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf)) + { return false; } + + // implement base class pure virtuals + // ---------------------------------- + virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const + { return m_format; } + virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const + { return 1; } + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const + { *formats = m_format; } + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } + +private: + // the one and only format we support + wxDataFormat m_format; + + DECLARE_NO_COPY_CLASS(wxDataObjectSimple) +}; + +// ---------------------------------------------------------------------------- +// wxDataObjectComposite is the simplest way to implement wxDataObject +// supporting multiple formats. It contains several wxDataObjectSimple and +// supports all formats supported by any of them. +// +// This class shouldn't be (normally) derived from, but may be used directly. +// If you need more flexibility than what it provides, you should probably use +// wxDataObject directly. +// ---------------------------------------------------------------------------- + +WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList); + +class WXDLLEXPORT wxDataObjectComposite : public wxDataObject +{ +public: + // ctor + wxDataObjectComposite(); + virtual ~wxDataObjectComposite(); + + // add data object (it will be deleted by wxDataObjectComposite, hence it + // must be allocated on the heap) whose format will become the preferred + // one if preferred == true + void Add(wxDataObjectSimple *dataObject, bool preferred = false); + + // Report the format passed to the SetData method. This should be the + // format of the data object within the composite that recieved data from + // the clipboard or the DnD operation. You can use this method to find + // out what kind of data object was recieved. + wxDataFormat GetReceivedFormat() const; + + // implement base class pure virtuals + // ---------------------------------- + virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const; + virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const; + virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const; + virtual size_t GetDataSize(const wxDataFormat& format) const; + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; + virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf); +#if defined(__WXMSW__) + virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, + const wxDataFormat& format ); + virtual void* SetSizeInBuffer( void* buffer, size_t size, + const wxDataFormat& format ); + virtual size_t GetBufferOffset( const wxDataFormat& format ); +#endif + +protected: + // returns the pointer to the object which supports this format or NULL + wxDataObjectSimple *GetObject(const wxDataFormat& format) const; + +private: + // the list of all (simple) data objects whose formats we support + wxSimpleDataObjectList m_dataObjects; + + // the index of the preferred one (0 initially, so by default the first + // one is the preferred) + size_t m_preferred; + + wxDataFormat m_receivedFormat; + + DECLARE_NO_COPY_CLASS(wxDataObjectComposite) +}; + +// ============================================================================ +// Standard implementations of wxDataObjectSimple which can be used directly +// (i.e. without having to derive from them) for standard data type transfers. +// +// Note that although all of them can work with provided data, you can also +// override their virtual GetXXX() functions to only provide data on demand. +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTextDataObject contains text data +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTextDataObject : public wxDataObjectSimple +{ +public: + // ctor: you can specify the text here or in SetText(), or override + // GetText() + wxTextDataObject(const wxString& text = wxEmptyString) + : wxDataObjectSimple( +#if wxUSE_UNICODE + wxDF_UNICODETEXT +#else + wxDF_TEXT +#endif + ), + m_text(text) + { + } + + // virtual functions which you may override if you want to provide text on + // demand only - otherwise, the trivial default versions will be used + virtual size_t GetTextLength() const { return m_text.Len() + 1; } + virtual wxString GetText() const { return m_text; } + virtual void SetText(const wxString& text) { m_text = text; } + + // implement base class pure virtuals + // ---------------------------------- + + // some platforms have 2 and not 1 format for text data +#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__)) + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; + + virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); } + virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); } + virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); } + + size_t GetDataSize(const wxDataFormat& format) const; + bool GetDataHere(const wxDataFormat& format, void *pBuf) const; + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); +#else + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + { + return SetData(len, buf); + } +#endif + +private: + wxString m_text; + + DECLARE_NO_COPY_CLASS(wxTextDataObject) +}; + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject contains a bitmap +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapDataObjectBase : public wxDataObjectSimple +{ +public: + // ctor: you can specify the bitmap here or in SetBitmap(), or override + // GetBitmap() + wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap) + : wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap) + { + } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual wxBitmap GetBitmap() const { return m_bitmap; } + virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + +protected: + wxBitmap m_bitmap; + + DECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase) +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject contains a list of filenames +// +// NB: notice that this is a "write only" object, it can only be filled with +// data from drag and drop operation. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDataObjectBase : public wxDataObjectSimple +{ +public: + // ctor: use AddFile() later to fill the array + wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { } + + // get a reference to our array + const wxArrayString& GetFilenames() const { return m_filenames; } + +protected: + wxArrayString m_filenames; + + DECLARE_NO_COPY_CLASS(wxFileDataObjectBase) +}; + +// ---------------------------------------------------------------------------- +// wxCustomDataObject contains arbitrary untyped user data. +// +// It is understood that this data can be copied bitwise. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCustomDataObject : public wxDataObjectSimple +{ +public: + // if you don't specify the format in the ctor, you can still use + // SetFormat() later + wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid); + + // the dtor calls Free() + virtual ~wxCustomDataObject(); + + // you can call SetData() to set m_data: it will make a copy of the data + // you pass - or you can use TakeData() which won't copy anything, but + // will take ownership of data (i.e. will call Free() on it later) + void TakeData(size_t size, void *data); + + // this function is called to allocate "size" bytes of memory from + // SetData(). The default version uses operator new[]. + virtual void *Alloc(size_t size); + + // this function is called when the data is freed, you may override it to + // anything you want (or may be nothing at all). The default version calls + // operator delete[] on m_data + virtual void Free(); + + // get data: you may override these functions if you wish to provide data + // only when it's requested + virtual size_t GetSize() const { return m_size; } + virtual void *GetData() const { return m_data; } + + // implement base class pure virtuals + // ---------------------------------- + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t size, const void *buf); + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + { + return SetData(len, buf); + } + +private: + size_t m_size; + void *m_data; + + DECLARE_NO_COPY_CLASS(wxCustomDataObject) +}; + +// ---------------------------------------------------------------------------- +// include platform-specific declarations of wxXXXBase classes +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/dataobj2.h" + + // wxURLDataObject defined in msw/ole/dataobj2.h +#else // !__WXMSW__ + #if defined(__WXGTK20__) + #include "wx/gtk/dataobj2.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/dataobj2.h" + #elif defined(__WXX11__) + #include "wx/x11/dataobj2.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/dataobj2.h" + #elif defined(__WXMAC__) + #include "wx/mac/dataobj2.h" + #elif defined(__WXCOCOA__) + #include "wx/cocoa/dataobj2.h" + #elif defined(__WXPM__) + #include "wx/os2/dataobj2.h" + #endif + + // wxURLDataObject is simply wxTextDataObject with a different name + class WXDLLEXPORT wxURLDataObject : public wxTextDataObject + { + public: + wxURLDataObject(const wxString& url = wxEmptyString) + : wxTextDataObject(url) + { + } + + wxString GetURL() const { return GetText(); } + void SetURL(const wxString& url) { SetText(url); } + }; +#endif // __WXMSW__/!__WXMSW__ + +#endif // wxUSE_DATAOBJ + +#endif // _WX_DATAOBJ_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dataview.h b/Externals/wxWidgets/include/wx/dataview.h index 37f61e3d88..249eff71df 100644 --- a/Externals/wxWidgets/include/wx/dataview.h +++ b/Externals/wxWidgets/include/wx/dataview.h @@ -1,462 +1,462 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dataview.h -// Purpose: wxDataViewCtrl base classes -// Author: Robert Roebling -// Modified by: -// Created: 08.01.06 -// RCS-ID: $Id: dataview.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATAVIEW_H_BASE_ -#define _WX_DATAVIEW_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_DATAVIEWCTRL - -#include "wx/control.h" -#include "wx/textctrl.h" -#include "wx/bitmap.h" -#include "wx/variant.h" - - -#if defined(__WXGTK20__) - // for testing - // #define wxUSE_GENERICDATAVIEWCTRL 1 -#elif defined(__WXMAC__) - #define wxUSE_GENERICDATAVIEWCTRL 1 -#else - #define wxUSE_GENERICDATAVIEWCTRL 1 -#endif - -// ---------------------------------------------------------------------------- -// wxDataViewCtrl flags -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// wxDataViewCtrl globals -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_ADV wxDataViewModel; -class WXDLLIMPEXP_FWD_ADV wxDataViewListModel; -class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; -class WXDLLIMPEXP_FWD_ADV wxDataViewColumn; -class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer; - -extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxDataViewCtrlNameStr[]; - -// --------------------------------------------------------- -// wxDataViewModel -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewModel: public wxObject -{ -public: - wxDataViewModel() { } - virtual ~wxDataViewModel() { } - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel) -}; - -// --------------------------------------------------------- -// wxDataViewListModelNotifier -// --------------------------------------------------------- - - -class WXDLLIMPEXP_ADV wxDataViewListModelNotifier: public wxObject -{ -public: - wxDataViewListModelNotifier() { } - virtual ~wxDataViewListModelNotifier() { } - - virtual bool RowAppended() = 0; - virtual bool RowPrepended() = 0; - virtual bool RowInserted( unsigned int before ) = 0; - virtual bool RowDeleted( unsigned int row ) = 0; - virtual bool RowChanged( unsigned int row ) = 0; - virtual bool ValueChanged( unsigned int col, unsigned int row ) = 0; - virtual bool RowsReordered( unsigned int *new_order ) = 0; - virtual bool Cleared() = 0; - - void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; } - wxDataViewListModel *GetOwner() { return m_owner; } - -private: - wxDataViewListModel *m_owner; -}; - -// --------------------------------------------------------- -// wxDataViewListModel -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewViewingColumn: public wxObject -{ -public: - wxDataViewViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ) - { - m_viewColumn = view_column; - m_modelColumn = model_column; - } - - wxDataViewColumn *m_viewColumn; - unsigned int m_modelColumn; -}; - -class WXDLLIMPEXP_ADV wxDataViewListModel: public wxDataViewModel -{ -public: - wxDataViewListModel(); - virtual ~wxDataViewListModel(); - - virtual unsigned int GetNumberOfRows() = 0; - virtual unsigned int GetNumberOfCols() = 0; - // return type as reported by wxVariant - virtual wxString GetColType( unsigned int col ) = 0; - // get value into a wxVariant - virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0; - // set value, call ValueChanged() afterwards! - virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0; - - // delegated notifiers - virtual bool RowAppended(); - virtual bool RowPrepended(); - virtual bool RowInserted( unsigned int before ); - virtual bool RowDeleted( unsigned int row ); - virtual bool RowChanged( unsigned int row ); - virtual bool ValueChanged( unsigned int col, unsigned int row ); - virtual bool RowsReordered( unsigned int *new_order ); - virtual bool Cleared(); - - // Used internally - void AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ); - void RemoveViewingColumn( wxDataViewColumn *column ); - - void AddNotifier( wxDataViewListModelNotifier *notifier ); - void RemoveNotifier( wxDataViewListModelNotifier *notifier ); - - wxList m_notifiers; - wxList m_viewingColumns; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel) -}; - -// --------------------------------------------------------- -// wxDataViewSortedListModel -// --------------------------------------------------------- - -typedef int (wxCALLBACK *wxDataViewListModelCompare) - (unsigned int row1, unsigned int row2, unsigned int col, wxDataViewListModel* model ); - -WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(unsigned int, wxDataViewSortedIndexArray, WXDLLIMPEXP_ADV); - -class WXDLLIMPEXP_ADV wxDataViewSortedListModel: public wxDataViewListModel -{ -public: - wxDataViewSortedListModel( wxDataViewListModel *child ); - virtual ~wxDataViewSortedListModel(); - - void SetAscending( bool ascending ) { m_ascending = ascending; } - bool GetAscending() { return m_ascending; } - - virtual unsigned int GetNumberOfRows(); - virtual unsigned int GetNumberOfCols(); - // return type as reported by wxVariant - virtual wxString GetColType( unsigned int col ); - // get value into a wxVariant - virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ); - // set value, call ValueChanged() afterwards! - virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ); - - // called from user - virtual bool RowAppended(); - virtual bool RowPrepended(); - virtual bool RowInserted( unsigned int before ); - virtual bool RowDeleted( unsigned int row ); - virtual bool RowChanged( unsigned int row ); - virtual bool ValueChanged( unsigned int col, unsigned int row ); - virtual bool RowsReordered( unsigned int *new_order ); - virtual bool Cleared(); - - // called if child's notifiers are called - bool ChildRowAppended(); - bool ChildRowPrepended(); - bool ChildRowInserted( unsigned int before ); - bool ChildRowDeleted( unsigned int row ); - bool ChildRowChanged( unsigned int row ); - bool ChildValueChanged( unsigned int col, unsigned int row ); - bool ChildRowsReordered( unsigned int *new_order ); - bool ChildCleared(); - - virtual void Resort(); - -private: - bool m_ascending; - wxDataViewListModel *m_child; - wxDataViewSortedIndexArray m_array; - wxDataViewListModelNotifier *m_notifierOnChild; - - void InitStatics(); // BAD - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewSortedListModel) -}; - -// --------------------------------------------------------- -// wxDataViewRendererBase -// --------------------------------------------------------- - -enum wxDataViewCellMode -{ - wxDATAVIEW_CELL_INERT, - wxDATAVIEW_CELL_ACTIVATABLE, - wxDATAVIEW_CELL_EDITABLE -}; - -enum wxDataViewCellRenderState -{ - wxDATAVIEW_CELL_SELECTED = 1, - wxDATAVIEW_CELL_PRELIT = 2, - wxDATAVIEW_CELL_INSENSITIVE = 4, - wxDATAVIEW_CELL_FOCUSED = 8 -}; - -class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject -{ -public: - wxDataViewRendererBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - - virtual bool SetValue( const wxVariant& WXUNUSED(value) ) { return true; } - virtual bool GetValue( wxVariant& WXUNUSED(value) ) { return true; } - virtual bool Validate( wxVariant& WXUNUSED(value) ) { return true; } - - wxString GetVariantType() { return m_variantType; } - wxDataViewCellMode GetMode() { return m_mode; } - - void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } - wxDataViewColumn* GetOwner() { return m_owner; } - -protected: - wxDataViewCellMode m_mode; - wxString m_variantType; - wxDataViewColumn *m_owner; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase) -}; - -// --------------------------------------------------------- -// wxDataViewColumnBase -// --------------------------------------------------------- - -enum wxDataViewColumnFlags -{ - wxDATAVIEW_COL_RESIZABLE = 1, - wxDATAVIEW_COL_SORTABLE = 2, - wxDATAVIEW_COL_HIDDEN = 4 -}; - -class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject -{ -public: - wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer, unsigned int model_column, - int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); - wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer, unsigned int model_column, - int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); - virtual ~wxDataViewColumnBase(); - - virtual void SetTitle( const wxString &title ); - virtual wxString GetTitle(); - - virtual void SetBitmap( const wxBitmap &bitmap ); - virtual const wxBitmap &GetBitmap(); - - virtual void SetAlignment( wxAlignment align ) = 0; - - virtual void SetSortable( bool sortable ) = 0; - virtual bool GetSortable() = 0; - virtual void SetSortOrder( bool ascending ) = 0; - virtual bool IsSortOrderAscending() = 0; - - wxDataViewRenderer* GetRenderer() { return m_renderer; } - - unsigned int GetModelColumn() { return m_model_column; } - - virtual void SetOwner( wxDataViewCtrl *owner ) { m_owner = owner; } - wxDataViewCtrl *GetOwner() { return m_owner; } - - virtual int GetWidth() = 0; - -private: - wxDataViewCtrl *m_ctrl; - wxDataViewRenderer *m_renderer; - int m_model_column; - int m_flags; - wxString m_title; - wxBitmap m_bitmap; - wxDataViewCtrl *m_owner; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase) -}; - -// --------------------------------------------------------- -// wxDataViewCtrlBase -// --------------------------------------------------------- - -#define wxDV_SINGLE 0x0000 // for convenience -#define wxDV_MULTIPLE 0x0020 // can select multiple items - -class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl -{ -public: - wxDataViewCtrlBase(); - virtual ~wxDataViewCtrlBase(); - - virtual bool AssociateModel( wxDataViewListModel *model ); - wxDataViewListModel* GetModel(); - - // short cuts - bool AppendTextColumn( const wxString &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); - bool AppendToggleColumn( const wxString &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30 ); - bool AppendProgressColumn( const wxString &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80 ); - bool AppendDateColumn( const wxString &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1 ); - bool AppendBitmapColumn( const wxString &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); - bool AppendTextColumn( const wxBitmap &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); - bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30 ); - bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80 ); - bool AppendDateColumn( const wxBitmap &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1 ); - bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); - - virtual bool AppendColumn( wxDataViewColumn *col ); - virtual unsigned int GetNumberOfColumns(); - virtual bool DeleteColumn( unsigned int pos ); - virtual bool ClearColumns(); - virtual wxDataViewColumn* GetColumn( unsigned int pos ); - - virtual void SetSelection( int row ) = 0; // -1 for unselect - inline void ClearSelection() { SetSelection( -1 ); } - virtual void Unselect( unsigned int row ) = 0; - virtual void SetSelectionRange( unsigned int from, unsigned int to ) = 0; - virtual void SetSelections( const wxArrayInt& aSelections) = 0; - - virtual bool IsSelected( unsigned int row ) const = 0; - virtual int GetSelection() const = 0; - virtual int GetSelections(wxArrayInt& aSelections) const = 0; - -private: - wxDataViewListModel *m_model; - wxList m_cols; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase) -}; - - -// ---------------------------------------------------------------------------- -// wxDataViewEvent - the event class for the wxDataViewCtrl notifications -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent -{ -public: - wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid), - m_col(-1), - m_row(-1), - m_model(NULL), - m_value(wxNullVariant), - m_editCancelled(false), - m_column(NULL) - { } - - wxDataViewEvent(const wxDataViewEvent& event) - : wxNotifyEvent(event), - m_col(event.m_col), - m_row(event.m_col), - m_model(event.m_model), - m_value(event.m_value), - m_editCancelled(event.m_editCancelled), - m_column(event.m_column) - { } - - int GetColumn() const { return m_col; } - void SetColumn( int col ) { m_col = col; } - int GetRow() const { return m_row; } - void SetRow( int row ) { m_row = row; } - wxDataViewModel* GetModel() const { return m_model; } - void SetModel( wxDataViewModel *model ) { m_model = model; } - const wxVariant &GetValue() const { return m_value; } - void SetValue( const wxVariant &value ) { m_value = value; } - - // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only - void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } - wxDataViewColumn *GetDataViewColumn() { return m_column; } - - // was label editing canceled? (for wxEVT_COMMAND_DATVIEW_END_LABEL_EDIT only) - bool IsEditCancelled() const { return m_editCancelled; } - void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } - - virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); } - -protected: - int m_col; - int m_row; - wxDataViewModel *m_model; - wxVariant m_value; - bool m_editCancelled; - wxDataViewColumn *m_column; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent) -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ROW_SELECTED, -1) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED, -1) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); - -#define wxDataViewEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func) - -#define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn)) - -#define EVT_DATAVIEW_ROW_SELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_SELECTED, id, fn) -#define EVT_DATAVIEW_ROW_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_ACTIVATED, id, fn) -#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn) -#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn) - - -#if defined(wxUSE_GENERICDATAVIEWCTRL) - #include "wx/generic/dataview.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dataview.h" -#elif defined(__WXMAC__) - // TODO - // #include "wx/mac/dataview.h" -#else - #include "wx/generic/dataview.h" -#endif - -#endif // wxUSE_DATAVIEWCTRL - -#endif - // _WX_DATAVIEW_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dataview.h +// Purpose: wxDataViewCtrl base classes +// Author: Robert Roebling +// Modified by: +// Created: 08.01.06 +// RCS-ID: $Id: dataview.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAVIEW_H_BASE_ +#define _WX_DATAVIEW_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_DATAVIEWCTRL + +#include "wx/control.h" +#include "wx/textctrl.h" +#include "wx/bitmap.h" +#include "wx/variant.h" + + +#if defined(__WXGTK20__) + // for testing + // #define wxUSE_GENERICDATAVIEWCTRL 1 +#elif defined(__WXMAC__) + #define wxUSE_GENERICDATAVIEWCTRL 1 +#else + #define wxUSE_GENERICDATAVIEWCTRL 1 +#endif + +// ---------------------------------------------------------------------------- +// wxDataViewCtrl flags +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxDataViewCtrl globals +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_ADV wxDataViewModel; +class WXDLLIMPEXP_FWD_ADV wxDataViewListModel; +class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; +class WXDLLIMPEXP_FWD_ADV wxDataViewColumn; +class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer; + +extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxDataViewCtrlNameStr[]; + +// --------------------------------------------------------- +// wxDataViewModel +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewModel: public wxObject +{ +public: + wxDataViewModel() { } + virtual ~wxDataViewModel() { } + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel) +}; + +// --------------------------------------------------------- +// wxDataViewListModelNotifier +// --------------------------------------------------------- + + +class WXDLLIMPEXP_ADV wxDataViewListModelNotifier: public wxObject +{ +public: + wxDataViewListModelNotifier() { } + virtual ~wxDataViewListModelNotifier() { } + + virtual bool RowAppended() = 0; + virtual bool RowPrepended() = 0; + virtual bool RowInserted( unsigned int before ) = 0; + virtual bool RowDeleted( unsigned int row ) = 0; + virtual bool RowChanged( unsigned int row ) = 0; + virtual bool ValueChanged( unsigned int col, unsigned int row ) = 0; + virtual bool RowsReordered( unsigned int *new_order ) = 0; + virtual bool Cleared() = 0; + + void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; } + wxDataViewListModel *GetOwner() { return m_owner; } + +private: + wxDataViewListModel *m_owner; +}; + +// --------------------------------------------------------- +// wxDataViewListModel +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewViewingColumn: public wxObject +{ +public: + wxDataViewViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ) + { + m_viewColumn = view_column; + m_modelColumn = model_column; + } + + wxDataViewColumn *m_viewColumn; + unsigned int m_modelColumn; +}; + +class WXDLLIMPEXP_ADV wxDataViewListModel: public wxDataViewModel +{ +public: + wxDataViewListModel(); + virtual ~wxDataViewListModel(); + + virtual unsigned int GetNumberOfRows() = 0; + virtual unsigned int GetNumberOfCols() = 0; + // return type as reported by wxVariant + virtual wxString GetColType( unsigned int col ) = 0; + // get value into a wxVariant + virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0; + // set value, call ValueChanged() afterwards! + virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0; + + // delegated notifiers + virtual bool RowAppended(); + virtual bool RowPrepended(); + virtual bool RowInserted( unsigned int before ); + virtual bool RowDeleted( unsigned int row ); + virtual bool RowChanged( unsigned int row ); + virtual bool ValueChanged( unsigned int col, unsigned int row ); + virtual bool RowsReordered( unsigned int *new_order ); + virtual bool Cleared(); + + // Used internally + void AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ); + void RemoveViewingColumn( wxDataViewColumn *column ); + + void AddNotifier( wxDataViewListModelNotifier *notifier ); + void RemoveNotifier( wxDataViewListModelNotifier *notifier ); + + wxList m_notifiers; + wxList m_viewingColumns; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel) +}; + +// --------------------------------------------------------- +// wxDataViewSortedListModel +// --------------------------------------------------------- + +typedef int (wxCALLBACK *wxDataViewListModelCompare) + (unsigned int row1, unsigned int row2, unsigned int col, wxDataViewListModel* model ); + +WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(unsigned int, wxDataViewSortedIndexArray, WXDLLIMPEXP_ADV); + +class WXDLLIMPEXP_ADV wxDataViewSortedListModel: public wxDataViewListModel +{ +public: + wxDataViewSortedListModel( wxDataViewListModel *child ); + virtual ~wxDataViewSortedListModel(); + + void SetAscending( bool ascending ) { m_ascending = ascending; } + bool GetAscending() { return m_ascending; } + + virtual unsigned int GetNumberOfRows(); + virtual unsigned int GetNumberOfCols(); + // return type as reported by wxVariant + virtual wxString GetColType( unsigned int col ); + // get value into a wxVariant + virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ); + // set value, call ValueChanged() afterwards! + virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ); + + // called from user + virtual bool RowAppended(); + virtual bool RowPrepended(); + virtual bool RowInserted( unsigned int before ); + virtual bool RowDeleted( unsigned int row ); + virtual bool RowChanged( unsigned int row ); + virtual bool ValueChanged( unsigned int col, unsigned int row ); + virtual bool RowsReordered( unsigned int *new_order ); + virtual bool Cleared(); + + // called if child's notifiers are called + bool ChildRowAppended(); + bool ChildRowPrepended(); + bool ChildRowInserted( unsigned int before ); + bool ChildRowDeleted( unsigned int row ); + bool ChildRowChanged( unsigned int row ); + bool ChildValueChanged( unsigned int col, unsigned int row ); + bool ChildRowsReordered( unsigned int *new_order ); + bool ChildCleared(); + + virtual void Resort(); + +private: + bool m_ascending; + wxDataViewListModel *m_child; + wxDataViewSortedIndexArray m_array; + wxDataViewListModelNotifier *m_notifierOnChild; + + void InitStatics(); // BAD + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewSortedListModel) +}; + +// --------------------------------------------------------- +// wxDataViewRendererBase +// --------------------------------------------------------- + +enum wxDataViewCellMode +{ + wxDATAVIEW_CELL_INERT, + wxDATAVIEW_CELL_ACTIVATABLE, + wxDATAVIEW_CELL_EDITABLE +}; + +enum wxDataViewCellRenderState +{ + wxDATAVIEW_CELL_SELECTED = 1, + wxDATAVIEW_CELL_PRELIT = 2, + wxDATAVIEW_CELL_INSENSITIVE = 4, + wxDATAVIEW_CELL_FOCUSED = 8 +}; + +class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject +{ +public: + wxDataViewRendererBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + + virtual bool SetValue( const wxVariant& WXUNUSED(value) ) { return true; } + virtual bool GetValue( wxVariant& WXUNUSED(value) ) { return true; } + virtual bool Validate( wxVariant& WXUNUSED(value) ) { return true; } + + wxString GetVariantType() { return m_variantType; } + wxDataViewCellMode GetMode() { return m_mode; } + + void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } + wxDataViewColumn* GetOwner() { return m_owner; } + +protected: + wxDataViewCellMode m_mode; + wxString m_variantType; + wxDataViewColumn *m_owner; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase) +}; + +// --------------------------------------------------------- +// wxDataViewColumnBase +// --------------------------------------------------------- + +enum wxDataViewColumnFlags +{ + wxDATAVIEW_COL_RESIZABLE = 1, + wxDATAVIEW_COL_SORTABLE = 2, + wxDATAVIEW_COL_HIDDEN = 4 +}; + +class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject +{ +public: + wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer, unsigned int model_column, + int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer, unsigned int model_column, + int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); + virtual ~wxDataViewColumnBase(); + + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle(); + + virtual void SetBitmap( const wxBitmap &bitmap ); + virtual const wxBitmap &GetBitmap(); + + virtual void SetAlignment( wxAlignment align ) = 0; + + virtual void SetSortable( bool sortable ) = 0; + virtual bool GetSortable() = 0; + virtual void SetSortOrder( bool ascending ) = 0; + virtual bool IsSortOrderAscending() = 0; + + wxDataViewRenderer* GetRenderer() { return m_renderer; } + + unsigned int GetModelColumn() { return m_model_column; } + + virtual void SetOwner( wxDataViewCtrl *owner ) { m_owner = owner; } + wxDataViewCtrl *GetOwner() { return m_owner; } + + virtual int GetWidth() = 0; + +private: + wxDataViewCtrl *m_ctrl; + wxDataViewRenderer *m_renderer; + int m_model_column; + int m_flags; + wxString m_title; + wxBitmap m_bitmap; + wxDataViewCtrl *m_owner; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase) +}; + +// --------------------------------------------------------- +// wxDataViewCtrlBase +// --------------------------------------------------------- + +#define wxDV_SINGLE 0x0000 // for convenience +#define wxDV_MULTIPLE 0x0020 // can select multiple items + +class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl +{ +public: + wxDataViewCtrlBase(); + virtual ~wxDataViewCtrlBase(); + + virtual bool AssociateModel( wxDataViewListModel *model ); + wxDataViewListModel* GetModel(); + + // short cuts + bool AppendTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + bool AppendToggleColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30 ); + bool AppendProgressColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80 ); + bool AppendDateColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1 ); + bool AppendBitmapColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + bool AppendTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30 ); + bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80 ); + bool AppendDateColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1 ); + bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + + virtual bool AppendColumn( wxDataViewColumn *col ); + virtual unsigned int GetNumberOfColumns(); + virtual bool DeleteColumn( unsigned int pos ); + virtual bool ClearColumns(); + virtual wxDataViewColumn* GetColumn( unsigned int pos ); + + virtual void SetSelection( int row ) = 0; // -1 for unselect + inline void ClearSelection() { SetSelection( -1 ); } + virtual void Unselect( unsigned int row ) = 0; + virtual void SetSelectionRange( unsigned int from, unsigned int to ) = 0; + virtual void SetSelections( const wxArrayInt& aSelections) = 0; + + virtual bool IsSelected( unsigned int row ) const = 0; + virtual int GetSelection() const = 0; + virtual int GetSelections(wxArrayInt& aSelections) const = 0; + +private: + wxDataViewListModel *m_model; + wxList m_cols; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase) +}; + + +// ---------------------------------------------------------------------------- +// wxDataViewEvent - the event class for the wxDataViewCtrl notifications +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent +{ +public: + wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid), + m_col(-1), + m_row(-1), + m_model(NULL), + m_value(wxNullVariant), + m_editCancelled(false), + m_column(NULL) + { } + + wxDataViewEvent(const wxDataViewEvent& event) + : wxNotifyEvent(event), + m_col(event.m_col), + m_row(event.m_col), + m_model(event.m_model), + m_value(event.m_value), + m_editCancelled(event.m_editCancelled), + m_column(event.m_column) + { } + + int GetColumn() const { return m_col; } + void SetColumn( int col ) { m_col = col; } + int GetRow() const { return m_row; } + void SetRow( int row ) { m_row = row; } + wxDataViewModel* GetModel() const { return m_model; } + void SetModel( wxDataViewModel *model ) { m_model = model; } + const wxVariant &GetValue() const { return m_value; } + void SetValue( const wxVariant &value ) { m_value = value; } + + // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only + void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } + wxDataViewColumn *GetDataViewColumn() { return m_column; } + + // was label editing canceled? (for wxEVT_COMMAND_DATVIEW_END_LABEL_EDIT only) + bool IsEditCancelled() const { return m_editCancelled; } + void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } + + virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); } + +protected: + int m_col; + int m_row; + wxDataViewModel *m_model; + wxVariant m_value; + bool m_editCancelled; + wxDataViewColumn *m_column; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent) +}; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ROW_SELECTED, -1) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED, -1) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); + +#define wxDataViewEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func) + +#define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn)) + +#define EVT_DATAVIEW_ROW_SELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_SELECTED, id, fn) +#define EVT_DATAVIEW_ROW_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_ACTIVATED, id, fn) +#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn) +#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn) + + +#if defined(wxUSE_GENERICDATAVIEWCTRL) + #include "wx/generic/dataview.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dataview.h" +#elif defined(__WXMAC__) + // TODO + // #include "wx/mac/dataview.h" +#else + #include "wx/generic/dataview.h" +#endif + +#endif // wxUSE_DATAVIEWCTRL + +#endif + // _WX_DATAVIEW_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/datectrl.h b/Externals/wxWidgets/include/wx/datectrl.h index bb3aa3f6c5..0da12775b5 100644 --- a/Externals/wxWidgets/include/wx/datectrl.h +++ b/Externals/wxWidgets/include/wx/datectrl.h @@ -1,112 +1,112 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/datectrl.h -// Purpose: implements wxDatePickerCtrl -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-09 -// RCS-ID: $Id: datectrl.h 37663 2006-02-21 22:14:31Z MR $ -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATECTRL_H_ -#define _WX_DATECTRL_H_ - -#include "wx/defs.h" - -#if wxUSE_DATEPICKCTRL - -#include "wx/control.h" // the base class -#include "wx/datetime.h" - -#define wxDatePickerCtrlNameStr _T("datectrl") - -// wxDatePickerCtrl styles -enum -{ - // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN - wxDP_DEFAULT = 0, - - // a spin control-like date picker (not supported in generic version) - wxDP_SPIN = 1, - - // a combobox-like date picker (not supported in mac version) - wxDP_DROPDOWN = 2, - - // always show century in the default date display (otherwise it depends on - // the system date format which may include the century or not) - wxDP_SHOWCENTURY = 4, - - // allow not having any valid date in the control (by default it always has - // some date, today initially if no valid date specified in ctor) - wxDP_ALLOWNONE = 8 -}; - -// ---------------------------------------------------------------------------- -// wxDatePickerCtrl: allow the user to enter the date -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxControl -{ -public: - /* - The derived classes should implement ctor and Create() method with the - following signature: - - bool Create(wxWindow *parent, - wxWindowID id, - const wxDateTime& dt = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDatePickerCtrlNameStr); - */ - - // set/get the date - virtual void SetValue(const wxDateTime& dt) = 0; - virtual wxDateTime GetValue() const = 0; - - // set/get the allowed valid range for the dates, if either/both of them - // are invalid, there is no corresponding limit and if neither is set - // GetRange() returns false - virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; - virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; -}; - -#if defined(__WXPALMOS__) - #include "wx/palmos/datectrl.h" - - #define wxHAS_NATIVE_DATEPICKCTRL -#elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/datectrl.h" - - #define wxHAS_NATIVE_DATEPICKCTRL -#else - #include "wx/generic/datectrl.h" - - class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric - { - public: - wxDatePickerCtrl() { } - wxDatePickerCtrl(wxWindow *parent, - wxWindowID id, - const wxDateTime& date = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDatePickerCtrlNameStr) - : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) - { - } - - private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) - }; -#endif - -#endif // wxUSE_DATEPICKCTRL - -#endif // _WX_DATECTRL_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/datectrl.h +// Purpose: implements wxDatePickerCtrl +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-09 +// RCS-ID: $Id: datectrl.h 37663 2006-02-21 22:14:31Z MR $ +// Copyright: (c) 2005 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATECTRL_H_ +#define _WX_DATECTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_DATEPICKCTRL + +#include "wx/control.h" // the base class +#include "wx/datetime.h" + +#define wxDatePickerCtrlNameStr _T("datectrl") + +// wxDatePickerCtrl styles +enum +{ + // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN + wxDP_DEFAULT = 0, + + // a spin control-like date picker (not supported in generic version) + wxDP_SPIN = 1, + + // a combobox-like date picker (not supported in mac version) + wxDP_DROPDOWN = 2, + + // always show century in the default date display (otherwise it depends on + // the system date format which may include the century or not) + wxDP_SHOWCENTURY = 4, + + // allow not having any valid date in the control (by default it always has + // some date, today initially if no valid date specified in ctor) + wxDP_ALLOWNONE = 8 +}; + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl: allow the user to enter the date +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxControl +{ +public: + /* + The derived classes should implement ctor and Create() method with the + following signature: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr); + */ + + // set/get the date + virtual void SetValue(const wxDateTime& dt) = 0; + virtual wxDateTime GetValue() const = 0; + + // set/get the allowed valid range for the dates, if either/both of them + // are invalid, there is no corresponding limit and if neither is set + // GetRange() returns false + virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; + virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; +}; + +#if defined(__WXPALMOS__) + #include "wx/palmos/datectrl.h" + + #define wxHAS_NATIVE_DATEPICKCTRL +#elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/datectrl.h" + + #define wxHAS_NATIVE_DATEPICKCTRL +#else + #include "wx/generic/datectrl.h" + + class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric + { + public: + wxDatePickerCtrl() { } + wxDatePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr) + : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) + { + } + + private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) + }; +#endif + +#endif // wxUSE_DATEPICKCTRL + +#endif // _WX_DATECTRL_H_ + diff --git a/Externals/wxWidgets/include/wx/dateevt.h b/Externals/wxWidgets/include/wx/dateevt.h index a3458f7af6..ba62954406 100644 --- a/Externals/wxWidgets/include/wx/dateevt.h +++ b/Externals/wxWidgets/include/wx/dateevt.h @@ -1,69 +1,69 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dateevt.h -// Purpose: declares wxDateEvent class -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-10 -// RCS-ID: $Id: dateevt.h 39637 2006-06-08 18:27:44Z RD $ -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATEEVT_H_ -#define _WX_DATEEVT_H_ - -#include "wx/event.h" -#include "wx/datetime.h" -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxDateEvent: used by wxCalendarCtrl and wxDatePickerCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent -{ -public: - wxDateEvent() { } - wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type) - : wxCommandEvent(type, win->GetId()), - m_date(dt) - { - SetEventObject(win); - } - - const wxDateTime& GetDate() const { return m_date; } - void SetDate(const wxDateTime &date) { m_date = date; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxDateEvent(*this); } - -private: - wxDateTime m_date; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros for handling them -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, 1101) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&); - -#define wxDateEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDateEventFunction, &func) - -#define EVT_DATE_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn)) - -#ifdef _WX_DEFINE_DATE_EVENTS_ - DEFINE_EVENT_TYPE(wxEVT_DATE_CHANGED) - - IMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent) -#endif - -#endif // _WX_DATEEVT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dateevt.h +// Purpose: declares wxDateEvent class +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-10 +// RCS-ID: $Id: dateevt.h 39637 2006-06-08 18:27:44Z RD $ +// Copyright: (c) 2005 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATEEVT_H_ +#define _WX_DATEEVT_H_ + +#include "wx/event.h" +#include "wx/datetime.h" +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxDateEvent: used by wxCalendarCtrl and wxDatePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent +{ +public: + wxDateEvent() { } + wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type) + : wxCommandEvent(type, win->GetId()), + m_date(dt) + { + SetEventObject(win); + } + + const wxDateTime& GetDate() const { return m_date; } + void SetDate(const wxDateTime &date) { m_date = date; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxDateEvent(*this); } + +private: + wxDateTime m_date; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent) +}; + +// ---------------------------------------------------------------------------- +// event types and macros for handling them +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, 1101) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&); + +#define wxDateEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDateEventFunction, &func) + +#define EVT_DATE_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn)) + +#ifdef _WX_DEFINE_DATE_EVENTS_ + DEFINE_EVENT_TYPE(wxEVT_DATE_CHANGED) + + IMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent) +#endif + +#endif // _WX_DATEEVT_H_ + diff --git a/Externals/wxWidgets/include/wx/datetime.h b/Externals/wxWidgets/include/wx/datetime.h index 53aea2a473..186cb28775 100644 --- a/Externals/wxWidgets/include/wx/datetime.h +++ b/Externals/wxWidgets/include/wx/datetime.h @@ -1,2142 +1,2142 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/datetime.h -// Purpose: declarations of time/date related classes (wxDateTime, -// wxTimeSpan) -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.02.99 -// RCS-ID: $Id: datetime.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATETIME_H -#define _WX_DATETIME_H - -#include "wx/defs.h" - -#if wxUSE_DATETIME - -#ifndef __WXWINCE__ -#include -#else -#include "wx/msw/wince/time.h" -#endif - -#include // for INT_MIN - -#include "wx/longlong.h" - -class WXDLLIMPEXP_FWD_BASE wxDateTime; -class WXDLLIMPEXP_FWD_BASE wxTimeSpan; -class WXDLLIMPEXP_FWD_BASE wxDateSpan; - -#include "wx/dynarray.h" - -// not all c-runtimes are based on 1/1/1970 being (time_t) 0 -// set this to the corresponding value in seconds 1/1/1970 has on your -// systems c-runtime - -#if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000 - #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L ) -#else - #define WX_TIME_BASE_OFFSET 0 -#endif -/* - * TODO - * - * + 1. Time zones with minutes (make TimeZone a class) - * ? 2. getdate() function like under Solaris - * + 3. text conversion for wxDateSpan - * + 4. pluggable modules for the workdays calculations - * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts - */ - -/* Two wrapper functions for thread safety */ -#ifdef HAVE_LOCALTIME_R -#define wxLocaltime_r localtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, localtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r -#endif -#endif - -#ifdef HAVE_GMTIME_R -#define wxGmtime_r gmtime_r -#else -WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) - // On Windows, gmtime _is_ threadsafe! -#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r -#endif -#endif - -/* - The three (main) classes declared in this header represent: - - 1. An absolute moment in the time (wxDateTime) - 2. A difference between two moments in the time, positive or negative - (wxTimeSpan) - 3. A logical difference between two dates expressed in - years/months/weeks/days (wxDateSpan) - - The following arithmetic operations are permitted (all others are not): - - addition - -------- - - wxDateTime + wxTimeSpan = wxDateTime - wxDateTime + wxDateSpan = wxDateTime - wxTimeSpan + wxTimeSpan = wxTimeSpan - wxDateSpan + wxDateSpan = wxDateSpan - - subtraction - ------------ - wxDateTime - wxDateTime = wxTimeSpan - wxDateTime - wxTimeSpan = wxDateTime - wxDateTime - wxDateSpan = wxDateTime - wxTimeSpan - wxTimeSpan = wxTimeSpan - wxDateSpan - wxDateSpan = wxDateSpan - - multiplication - -------------- - wxTimeSpan * number = wxTimeSpan - number * wxTimeSpan = wxTimeSpan - wxDateSpan * number = wxDateSpan - number * wxDateSpan = wxDateSpan - - unitary minus - ------------- - -wxTimeSpan = wxTimeSpan - -wxDateSpan = wxDateSpan - - For each binary operation OP (+, -, *) we have the following operatorOP=() as - a method and the method with a symbolic name OPER (Add, Subtract, Multiply) - as a synonym for it and another const method with the same name which returns - the changed copy of the object and operatorOP() as a global function which is - implemented in terms of the const version of OPEN. For the unary - we have - operator-() as a method, Neg() as synonym for it and Negate() which returns - the copy of the object with the changed sign. -*/ - -// an invalid/default date time object which may be used as the default -// argument for arguments of type wxDateTime; it is also returned by all -// functions returning wxDateTime on failure (this is why it is also called -// wxInvalidDateTime) -class WXDLLIMPEXP_FWD_BASE wxDateTime; - -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultDateTimeFormat; -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultTimeSpanFormat; -extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; - -#define wxInvalidDateTime wxDefaultDateTime - -// ---------------------------------------------------------------------------- -// wxDateTime represents an absolute moment in the time -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDateTime -{ -public: - // types - // ------------------------------------------------------------------------ - - // a small unsigned integer type for storing things like minutes, - // seconds &c. It should be at least short (i.e. not char) to contain - // the number of milliseconds - it may also be 'int' because there is - // no size penalty associated with it in our code, we don't store any - // data in this format - typedef unsigned short wxDateTime_t; - - // constants - // ------------------------------------------------------------------------ - - // the timezones - enum TZ - { - // the time in the current time zone - Local, - - // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be - // consequent numbers, so writing something like `GMT0 + offset' is - // safe if abs(offset) <= 12 - - // underscore stands for minus - GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7, - GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1, - GMT0, - GMT1, GMT2, GMT3, GMT4, GMT5, GMT6, - GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13, - // Note that GMT12 and GMT_12 are not the same: there is a difference - // of exactly one day between them - - // some symbolic names for TZ - - // Europe - WET = GMT0, // Western Europe Time - WEST = GMT1, // Western Europe Summer Time - CET = GMT1, // Central Europe Time - CEST = GMT2, // Central Europe Summer Time - EET = GMT2, // Eastern Europe Time - EEST = GMT3, // Eastern Europe Summer Time - MSK = GMT3, // Moscow Time - MSD = GMT4, // Moscow Summer Time - - // US and Canada - AST = GMT_4, // Atlantic Standard Time - ADT = GMT_3, // Atlantic Daylight Time - EST = GMT_5, // Eastern Standard Time - EDT = GMT_4, // Eastern Daylight Saving Time - CST = GMT_6, // Central Standard Time - CDT = GMT_5, // Central Daylight Saving Time - MST = GMT_7, // Mountain Standard Time - MDT = GMT_6, // Mountain Daylight Saving Time - PST = GMT_8, // Pacific Standard Time - PDT = GMT_7, // Pacific Daylight Saving Time - HST = GMT_10, // Hawaiian Standard Time - AKST = GMT_9, // Alaska Standard Time - AKDT = GMT_8, // Alaska Daylight Saving Time - - // Australia - - A_WST = GMT8, // Western Standard Time - A_CST = GMT13 + 1, // Central Standard Time (+9.5) - A_EST = GMT10, // Eastern Standard Time - A_ESST = GMT11, // Eastern Summer Time - - // New Zealand - NZST = GMT12, // Standard Time - NZDT = GMT13, // Daylight Saving Time - - // TODO add more symbolic timezone names here - - // Universal Coordinated Time = the new and politically correct name - // for GMT - UTC = GMT0 - }; - - // the calendar systems we know about: notice that it's valid (for - // this classes purpose anyhow) to work with any of these calendars - // even with the dates before the historical appearance of the - // calendar - enum Calendar - { - Gregorian, // current calendar - Julian // calendar in use since -45 until the 1582 (or later) - - // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?) - }; - - // these values only are used to identify the different dates of - // adoption of the Gregorian calendar (see IsGregorian()) - // - // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)" - // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html - // except for the comments "we take". - // - // Symbol "->" should be read as "was followed by" in the comments - // which follow. - enum GregorianAdoption - { - Gr_Unknown, // no data for this country or it's too uncertain to use - Gr_Standard, // on the day 0 of Gregorian calendar: 15 Oct 1582 - - Gr_Alaska, // Oct 1867 when Alaska became part of the USA - Gr_Albania, // Dec 1912 - - Gr_Austria = Gr_Unknown, // Different regions on different dates - Gr_Austria_Brixen, // 5 Oct 1583 -> 16 Oct 1583 - Gr_Austria_Salzburg = Gr_Austria_Brixen, - Gr_Austria_Tyrol = Gr_Austria_Brixen, - Gr_Austria_Carinthia, // 14 Dec 1583 -> 25 Dec 1583 - Gr_Austria_Styria = Gr_Austria_Carinthia, - - Gr_Belgium, // Then part of the Netherlands - - Gr_Bulgaria = Gr_Unknown, // Unknown precisely (from 1915 to 1920) - Gr_Bulgaria_1, // 18 Mar 1916 -> 1 Apr 1916 - Gr_Bulgaria_2, // 31 Mar 1916 -> 14 Apr 1916 - Gr_Bulgaria_3, // 3 Sep 1920 -> 17 Sep 1920 - - Gr_Canada = Gr_Unknown, // Different regions followed the changes in - // Great Britain or France - - Gr_China = Gr_Unknown, // Different authorities say: - Gr_China_1, // 18 Dec 1911 -> 1 Jan 1912 - Gr_China_2, // 18 Dec 1928 -> 1 Jan 1929 - - Gr_Czechoslovakia, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584 - Gr_Denmark, // (including Norway) 18 Feb 1700 -> 1 Mar 1700 - Gr_Egypt, // 1875 - Gr_Estonia, // 1918 - Gr_Finland, // Then part of Sweden - - Gr_France, // 9 Dec 1582 -> 20 Dec 1582 - Gr_France_Alsace, // 4 Feb 1682 -> 16 Feb 1682 - Gr_France_Lorraine, // 16 Feb 1760 -> 28 Feb 1760 - Gr_France_Strasbourg, // February 1682 - - Gr_Germany = Gr_Unknown, // Different states on different dates: - Gr_Germany_Catholic, // 1583-1585 (we take 1584) - Gr_Germany_Prussia, // 22 Aug 1610 -> 2 Sep 1610 - Gr_Germany_Protestant, // 18 Feb 1700 -> 1 Mar 1700 - - Gr_GreatBritain, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)') - - Gr_Greece, // 9 Mar 1924 -> 23 Mar 1924 - Gr_Hungary, // 21 Oct 1587 -> 1 Nov 1587 - Gr_Ireland = Gr_GreatBritain, - Gr_Italy = Gr_Standard, - - Gr_Japan = Gr_Unknown, // Different authorities say: - Gr_Japan_1, // 19 Dec 1872 -> 1 Jan 1873 - Gr_Japan_2, // 19 Dec 1892 -> 1 Jan 1893 - Gr_Japan_3, // 18 Dec 1918 -> 1 Jan 1919 - - Gr_Latvia, // 1915-1918 (we take 1915) - Gr_Lithuania, // 1915 - Gr_Luxemburg, // 14 Dec 1582 -> 25 Dec 1582 - Gr_Netherlands = Gr_Belgium, // (including Belgium) 1 Jan 1583 - - // this is too weird to take into account: the Gregorian calendar was - // introduced twice in Groningen, first time 28 Feb 1583 was followed - // by 11 Mar 1583, then it has gone back to Julian in the summer of - // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is - // the date we take here - Gr_Netherlands_Groningen, // 13 Dec 1700 -> 12 Jan 1701 - Gr_Netherlands_Gelderland, // 30 Jun 1700 -> 12 Jul 1700 - Gr_Netherlands_Utrecht, // (and Overijssel) 30 Nov 1700->12 Dec 1700 - Gr_Netherlands_Friesland, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701 - - Gr_Norway = Gr_Denmark, // Then part of Denmark - Gr_Poland = Gr_Standard, - Gr_Portugal = Gr_Standard, - Gr_Romania, // 31 Mar 1919 -> 14 Apr 1919 - Gr_Russia, // 31 Jan 1918 -> 14 Feb 1918 - Gr_Scotland = Gr_GreatBritain, - Gr_Spain = Gr_Standard, - - // Sweden has a curious history. Sweden decided to make a gradual - // change from the Julian to the Gregorian calendar. By dropping every - // leap year from 1700 through 1740 the eleven superfluous days would - // be omitted and from 1 Mar 1740 they would be in sync with the - // Gregorian calendar. (But in the meantime they would be in sync with - // nobody!) - // - // So 1700 (which should have been a leap year in the Julian calendar) - // was not a leap year in Sweden. However, by mistake 1704 and 1708 - // became leap years. This left Sweden out of synchronisation with - // both the Julian and the Gregorian world, so they decided to go back - // to the Julian calendar. In order to do this, they inserted an extra - // day in 1712, making that year a double leap year! So in 1712, - // February had 30 days in Sweden. - // - // Later, in 1753, Sweden changed to the Gregorian calendar by - // dropping 11 days like everyone else. - Gr_Sweden = Gr_Finland, // 17 Feb 1753 -> 1 Mar 1753 - - Gr_Switzerland = Gr_Unknown,// Different cantons used different dates - Gr_Switzerland_Catholic, // 1583, 1584 or 1597 (we take 1584) - Gr_Switzerland_Protestant, // 31 Dec 1700 -> 12 Jan 1701 - - Gr_Turkey, // 1 Jan 1927 - Gr_USA = Gr_GreatBritain, - Gr_Wales = Gr_GreatBritain, - Gr_Yugoslavia // 1919 - }; - - // the country parameter is used so far for calculating the start and - // the end of DST period and for deciding whether the date is a work - // day or not - // - // TODO move this to intl.h - -// Required for WinCE -#ifdef USA -#undef USA -#endif - - enum Country - { - Country_Unknown, // no special information for this country - Country_Default, // set the default country with SetCountry() method - // or use the default country with any other - - // TODO add more countries (for this we must know about DST and/or - // holidays for this country) - - // Western European countries: we assume that they all follow the same - // DST rules (true or false?) - Country_WesternEurope_Start, - Country_EEC = Country_WesternEurope_Start, - France, - Germany, - UK, - Country_WesternEurope_End = UK, - - Russia, - USA - }; - // symbolic names for the months - enum Month - { - Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month - }; - - // symbolic names for the weekdays - enum WeekDay - { - Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay - }; - - // invalid value for the year - enum Year - { - Inv_Year = SHRT_MIN // should hold in wxDateTime_t - }; - - // flags for GetWeekDayName and GetMonthName - enum NameFlags - { - Name_Full = 0x01, // return full name - Name_Abbr = 0x02 // return abbreviated name - }; - - // flags for GetWeekOfYear and GetWeekOfMonth - enum WeekFlags - { - Default_First, // Sunday_First for US, Monday_First for the rest - Monday_First, // week starts with a Monday - Sunday_First // week starts with a Sunday - }; - - // helper classes - // ------------------------------------------------------------------------ - - // a class representing a time zone: basicly, this is just an offset - // (in seconds) from GMT - class WXDLLIMPEXP_BASE TimeZone - { - public: - TimeZone(TZ tz); - - // don't use this ctor, it doesn't work for negative offsets (but can't - // be removed or changed to avoid breaking ABI in 2.8) - TimeZone(wxDateTime_t offset = 0) { m_offset = offset; } - -#if wxABI_VERSION >= 20808 - // create time zone object with the given offset - static TimeZone Make(long offset) - { - TimeZone tz; - tz.m_offset = offset; - return tz; - } -#endif // wxABI 2.8.8+ - - long GetOffset() const { return m_offset; } - - private: - // offset for this timezone from GMT in seconds - long m_offset; - }; - - // standard struct tm is limited to the years from 1900 (because - // tm_year field is the offset from 1900), so we use our own struct - // instead to represent broken down time - // - // NB: this struct should always be kept normalized (i.e. mon should - // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays() - // instead of modifying the member fields directly! - struct WXDLLIMPEXP_BASE Tm - { - wxDateTime_t msec, sec, min, hour, mday; - Month mon; - int year; - - // default ctor inits the object to an invalid value - Tm(); - - // ctor from struct tm and the timezone - Tm(const struct tm& tm, const TimeZone& tz); - - // check that the given date/time is valid (in Gregorian calendar) - bool IsValid() const; - - // get the week day - WeekDay GetWeekDay() // not const because wday may be changed - { - if ( wday == Inv_WeekDay ) - ComputeWeekDay(); - - return (WeekDay)wday; - } - - // add the given number of months to the date keeping it normalized - void AddMonths(int monDiff); - - // add the given number of months to the date keeping it normalized - void AddDays(int dayDiff); - - private: - // compute the weekday from other fields - void ComputeWeekDay(); - - // the timezone we correspond to - TimeZone m_tz; - - // these values can't be accessed directly because they're not always - // computed and we calculate them on demand - wxDateTime_t wday, yday; - }; - - // static methods - // ------------------------------------------------------------------------ - - // set the current country - static void SetCountry(Country country); - // get the current country - static Country GetCountry(); - - // return true if the country is a West European one (in practice, - // this means that the same DST rules as for EEC apply) - static bool IsWestEuropeanCountry(Country country = Country_Default); - - // return the current year - static int GetCurrentYear(Calendar cal = Gregorian); - - // convert the year as returned by wxDateTime::GetYear() to a year - // suitable for BC/AD notation. The difference is that BC year 1 - // corresponds to the year 0 (while BC year 0 didn't exist) and AD - // year N is just year N. - static int ConvertYearToBC(int year); - - // return the current month - static Month GetCurrentMonth(Calendar cal = Gregorian); - - // returns true if the given year is a leap year in the given calendar - static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian); - - // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC) - static int GetCentury(int year); - - // returns the number of days in this year (356 or 355 for Gregorian - // calendar usually :-) - static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian); - - // get the number of the days in the given month (default value for - // the year means the current one) - static wxDateTime_t GetNumberOfDays(Month month, - int year = Inv_Year, - Calendar cal = Gregorian); - - // get the full (default) or abbreviated month name in the current - // locale, returns empty string on error - static wxString GetMonthName(Month month, - NameFlags flags = Name_Full); - - // get the full (default) or abbreviated weekday name in the current - // locale, returns empty string on error - static wxString GetWeekDayName(WeekDay weekday, - NameFlags flags = Name_Full); - - // get the AM and PM strings in the current locale (may be empty) - static void GetAmPmStrings(wxString *am, wxString *pm); - - // return true if the given country uses DST for this year - static bool IsDSTApplicable(int year = Inv_Year, - Country country = Country_Default); - - // get the beginning of DST for this year, will return invalid object - // if no DST applicable in this year. The default value of the - // parameter means to take the current year. - static wxDateTime GetBeginDST(int year = Inv_Year, - Country country = Country_Default); - // get the end of DST for this year, will return invalid object - // if no DST applicable in this year. The default value of the - // parameter means to take the current year. - static wxDateTime GetEndDST(int year = Inv_Year, - Country country = Country_Default); - - // return the wxDateTime object for the current time - static inline wxDateTime Now(); - - // return the wxDateTime object for the current time with millisecond - // precision (if available on this platform) - static wxDateTime UNow(); - - // return the wxDateTime object for today midnight: i.e. as Now() but - // with time set to 0 - static inline wxDateTime Today(); - - // constructors: you should test whether the constructor succeeded with - // IsValid() function. The values Inv_Month and Inv_Year for the - // parameters mean take current month and/or year values. - // ------------------------------------------------------------------------ - - // default ctor does not initialize the object, use Set()! - wxDateTime() { m_time = wxLongLong((long)ULONG_MAX, ULONG_MAX); } - - // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration - inline wxDateTime(time_t timet); -#endif - // from broken down time/date (only for standard Unix range) - inline wxDateTime(const struct tm& tm); - // from broken down time/date (any range) - inline wxDateTime(const Tm& tm); - - // from JDN (beware of rounding errors) - inline wxDateTime(double jdn); - - // from separate values for each component, date set to today - inline wxDateTime(wxDateTime_t hour, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - // from separate values for each component with explicit date - inline wxDateTime(wxDateTime_t day, // day of the month - Month month, - int year = Inv_Year, // 1999, not 99 please! - wxDateTime_t hour = 0, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - - // default copy ctor ok - - // no dtor - - // assignment operators and Set() functions: all non const methods return - // the reference to this object. IsValid() should be used to test whether - // the function succeeded. - // ------------------------------------------------------------------------ - - // set to the current time - inline wxDateTime& SetToCurrent(); - -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration - // set to given time_t value - inline wxDateTime& Set(time_t timet); -#endif - - // set to given broken down time/date - wxDateTime& Set(const struct tm& tm); - - // set to given broken down time/date - inline wxDateTime& Set(const Tm& tm); - - // set to given JDN (beware of rounding errors) - wxDateTime& Set(double jdn); - - // set to given time, date = today - wxDateTime& Set(wxDateTime_t hour, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - - // from separate values for each component with explicit date - // (defaults for month and year are the current values) - wxDateTime& Set(wxDateTime_t day, - Month month, - int year = Inv_Year, // 1999, not 99 please! - wxDateTime_t hour = 0, - wxDateTime_t minute = 0, - wxDateTime_t second = 0, - wxDateTime_t millisec = 0); - - // resets time to 00:00:00, doesn't change the date - wxDateTime& ResetTime(); - -#if wxABI_VERSION >= 20802 - // get the date part of this object only, i.e. the object which has the - // same date as this one but time of 00:00:00 - wxDateTime GetDateOnly() const; -#endif // wxABI 2.8.1+ - - // the following functions don't change the values of the other - // fields, i.e. SetMinute() won't change either hour or seconds value - - // set the year - wxDateTime& SetYear(int year); - // set the month - wxDateTime& SetMonth(Month month); - // set the day of the month - wxDateTime& SetDay(wxDateTime_t day); - // set hour - wxDateTime& SetHour(wxDateTime_t hour); - // set minute - wxDateTime& SetMinute(wxDateTime_t minute); - // set second - wxDateTime& SetSecond(wxDateTime_t second); - // set millisecond - wxDateTime& SetMillisecond(wxDateTime_t millisecond); - - // assignment operator from time_t - wxDateTime& operator=(time_t timet) { return Set(timet); } - - // assignment operator from broken down time/date - wxDateTime& operator=(const struct tm& tm) { return Set(tm); } - - // assignment operator from broken down time/date - wxDateTime& operator=(const Tm& tm) { return Set(tm); } - - // default assignment operator is ok - - // calendar calculations (functions which set the date only leave the time - // unchanged, e.g. don't explictly zero it): SetXXX() functions modify the - // object itself, GetXXX() ones return a new object. - // ------------------------------------------------------------------------ - - // set to the given week day in the same week as this one - wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, - WeekFlags flags = Monday_First); - inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday, - WeekFlags flags = Monday_First) const; - - // set to the next week day following this one - wxDateTime& SetToNextWeekDay(WeekDay weekday); - inline wxDateTime GetNextWeekDay(WeekDay weekday) const; - - // set to the previous week day before this one - wxDateTime& SetToPrevWeekDay(WeekDay weekday); - inline wxDateTime GetPrevWeekDay(WeekDay weekday) const; - - // set to Nth occurence of given weekday in the given month of the - // given year (time is set to 0), return true on success and false on - // failure. n may be positive (1..5) or negative to count from the end - // of the month (see helper function SetToLastWeekDay()) - bool SetToWeekDay(WeekDay weekday, - int n = 1, - Month month = Inv_Month, - int year = Inv_Year); - inline wxDateTime GetWeekDay(WeekDay weekday, - int n = 1, - Month month = Inv_Month, - int year = Inv_Year) const; - - // sets to the last weekday in the given month, year - inline bool SetToLastWeekDay(WeekDay weekday, - Month month = Inv_Month, - int year = Inv_Year); - inline wxDateTime GetLastWeekDay(WeekDay weekday, - Month month = Inv_Month, - int year = Inv_Year); - -#if WXWIN_COMPATIBILITY_2_6 - // sets the date to the given day of the given week in the year, - // returns true on success and false if given date doesn't exist (e.g. - // numWeek is > 53) - // - // these functions are badly defined as they're not the reverse of - // GetWeekOfYear(), use SetToTheWeekOfYear() instead - wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek, - WeekDay weekday = Mon, - WeekFlags flags = Monday_First) ); - wxDEPRECATED( wxDateTime GetWeek(wxDateTime_t numWeek, - WeekDay weekday = Mon, - WeekFlags flags = Monday_First) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // returns the date corresponding to the given week day of the given - // week (in ISO notation) of the specified year - static wxDateTime SetToWeekOfYear(int year, - wxDateTime_t numWeek, - WeekDay weekday = Mon); - - // sets the date to the last day of the given (or current) month or the - // given (or current) year - wxDateTime& SetToLastMonthDay(Month month = Inv_Month, - int year = Inv_Year); - inline wxDateTime GetLastMonthDay(Month month = Inv_Month, - int year = Inv_Year) const; - - // sets to the given year day (1..365 or 366) - wxDateTime& SetToYearDay(wxDateTime_t yday); - inline wxDateTime GetYearDay(wxDateTime_t yday) const; - - // The definitions below were taken verbatim from - // - // http://www.capecod.net/~pbaum/date/date0.htm - // - // (Peter Baum's home page) - // - // definition: The Julian Day Number, Julian Day, or JD of a - // particular instant of time is the number of days and fractions of a - // day since 12 hours Universal Time (Greenwich mean noon) on January - // 1 of the year -4712, where the year is given in the Julian - // proleptic calendar. The idea of using this reference date was - // originally proposed by Joseph Scalizer in 1582 to count years but - // it was modified by 19th century astronomers to count days. One - // could have equivalently defined the reference time to be noon of - // November 24, -4713 if were understood that Gregorian calendar rules - // were applied. Julian days are Julian Day Numbers and are not to be - // confused with Julian dates. - // - // definition: The Rata Die number is a date specified as the number - // of days relative to a base date of December 31 of the year 0. Thus - // January 1 of the year 1 is Rata Die day 1. - - // get the Julian Day number (the fractional part specifies the time of - // the day, related to noon - beware of rounding errors!) - double GetJulianDayNumber() const; - double GetJDN() const { return GetJulianDayNumber(); } - - // get the Modified Julian Day number: it is equal to JDN - 2400000.5 - // and so integral MJDs correspond to the midnights (and not noons). - // MJD 0 is Nov 17, 1858 - double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; } - double GetMJD() const { return GetModifiedJulianDayNumber(); } - - // get the Rata Die number - double GetRataDie() const; - - // TODO algorithms for calculating some important dates, such as - // religious holidays (Easter...) or moon/solar eclipses? Some - // algorithms can be found in the calendar FAQ - - - // Timezone stuff: a wxDateTime object constructed using given - // day/month/year/hour/min/sec values is interpreted as this moment in - // local time. Using the functions below, it may be converted to another - // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()). - // - // These functions try to handle DST internally, but there is no magical - // way to know all rules for it in all countries in the world, so if the - // program can handle it itself (or doesn't want to handle it at all for - // whatever reason), the DST handling can be disabled with noDST. - // ------------------------------------------------------------------------ - - // transform to any given timezone - inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const; - wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false); - - // interpret current value as being in another timezone and transform - // it to local one - inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const; - wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false); - - // transform to/from GMT/UTC - wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); } - wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); } - - wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); } - wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); } - - wxDateTime FromUTC(bool noDST = false) const - { return FromTimezone(UTC, noDST); } - wxDateTime& MakeFromUTC(bool noDST = false) - { return MakeFromTimezone(UTC, noDST); } - - // is daylight savings time in effect at this moment according to the - // rules of the specified country? - // - // Return value is > 0 if DST is in effect, 0 if it is not and -1 if - // the information is not available (this is compatible with ANSI C) - int IsDST(Country country = Country_Default) const; - - - // accessors: many of them take the timezone parameter which indicates the - // timezone for which to make the calculations and the default value means - // to do it for the current timezone of this machine (even if the function - // only operates with the date it's necessary because a date may wrap as - // result of timezone shift) - // ------------------------------------------------------------------------ - - // is the date valid? - inline bool IsValid() const { return m_time != wxInvalidDateTime.m_time; } - - // get the broken down date/time representation in the given timezone - // - // If you wish to get several time components (day, month and year), - // consider getting the whole Tm strcuture first and retrieving the - // value from it - this is much more efficient - Tm GetTm(const TimeZone& tz = Local) const; - - // get the number of seconds since the Unix epoch - returns (time_t)-1 - // if the value is out of range - inline time_t GetTicks() const; - - // get the century, same as GetCentury(GetYear()) - int GetCentury(const TimeZone& tz = Local) const - { return GetCentury(GetYear(tz)); } - // get the year (returns Inv_Year if date is invalid) - int GetYear(const TimeZone& tz = Local) const - { return GetTm(tz).year; } - // get the month (Inv_Month if date is invalid) - Month GetMonth(const TimeZone& tz = Local) const - { return (Month)GetTm(tz).mon; } - // get the month day (in 1..31 range, 0 if date is invalid) - wxDateTime_t GetDay(const TimeZone& tz = Local) const - { return GetTm(tz).mday; } - // get the day of the week (Inv_WeekDay if date is invalid) - WeekDay GetWeekDay(const TimeZone& tz = Local) const - { return GetTm(tz).GetWeekDay(); } - // get the hour of the day - wxDateTime_t GetHour(const TimeZone& tz = Local) const - { return GetTm(tz).hour; } - // get the minute - wxDateTime_t GetMinute(const TimeZone& tz = Local) const - { return GetTm(tz).min; } - // get the second - wxDateTime_t GetSecond(const TimeZone& tz = Local) const - { return GetTm(tz).sec; } - // get milliseconds - wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const - { return GetTm(tz).msec; } - - // get the day since the year start (1..366, 0 if date is invalid) - wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const; - // get the week number since the year start (1..52 or 53, 0 if date is - // invalid) - wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First, - const TimeZone& tz = Local) const; - // get the week number since the month start (1..5, 0 if date is - // invalid) - wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First, - const TimeZone& tz = Local) const; - - // is this date a work day? This depends on a country, of course, - // because the holidays are different in different countries - bool IsWorkDay(Country country = Country_Default) const; - - // is this date later than Gregorian calendar introduction for the - // given country (see enum GregorianAdoption)? - // - // NB: this function shouldn't be considered as absolute authority in - // the matter. Besides, for some countries the exact date of - // adoption of the Gregorian calendar is simply unknown. - bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const; - - // dos date and time format - // ------------------------------------------------------------------------ - - // set from the DOS packed format - wxDateTime& SetFromDOS(unsigned long ddt); - - // pack the date in DOS format - unsigned long GetAsDOS() const; - - // comparison (see also functions below for operator versions) - // ------------------------------------------------------------------------ - - // returns true if the two moments are strictly identical - inline bool IsEqualTo(const wxDateTime& datetime) const; - - // returns true if the date is strictly earlier than the given one - inline bool IsEarlierThan(const wxDateTime& datetime) const; - - // returns true if the date is strictly later than the given one - inline bool IsLaterThan(const wxDateTime& datetime) const; - - // returns true if the date is strictly in the given range - inline bool IsStrictlyBetween(const wxDateTime& t1, - const wxDateTime& t2) const; - - // returns true if the date is in the given range - inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const; - - // do these two objects refer to the same date? - inline bool IsSameDate(const wxDateTime& dt) const; - - // do these two objects have the same time? - inline bool IsSameTime(const wxDateTime& dt) const; - - // are these two objects equal up to given timespan? - inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const; - - inline bool operator<(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); - return GetValue() < dt.GetValue(); - } - - inline bool operator<=(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); - return GetValue() <= dt.GetValue(); - } - - inline bool operator>(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); - return GetValue() > dt.GetValue(); - } - - inline bool operator>=(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); - return GetValue() >= dt.GetValue(); - } - - inline bool operator==(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); - return GetValue() == dt.GetValue(); - } - - inline bool operator!=(const wxDateTime& dt) const - { - wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); - return GetValue() != dt.GetValue(); - } - - // arithmetics with dates (see also below for more operators) - // ------------------------------------------------------------------------ - - // return the sum of the date with a time span (positive or negative) - inline wxDateTime Add(const wxTimeSpan& diff) const; - // add a time span (positive or negative) - inline wxDateTime& Add(const wxTimeSpan& diff); - // add a time span (positive or negative) - inline wxDateTime& operator+=(const wxTimeSpan& diff); - inline wxDateTime operator+(const wxTimeSpan& ts) const - { - wxDateTime dt(*this); - dt.Add(ts); - return dt; - } - - // return the difference of the date with a time span - inline wxDateTime Subtract(const wxTimeSpan& diff) const; - // subtract a time span (positive or negative) - inline wxDateTime& Subtract(const wxTimeSpan& diff); - // subtract a time span (positive or negative) - inline wxDateTime& operator-=(const wxTimeSpan& diff); - inline wxDateTime operator-(const wxTimeSpan& ts) const - { - wxDateTime dt(*this); - dt.Subtract(ts); - return dt; - } - - // return the sum of the date with a date span - inline wxDateTime Add(const wxDateSpan& diff) const; - // add a date span (positive or negative) - wxDateTime& Add(const wxDateSpan& diff); - // add a date span (positive or negative) - inline wxDateTime& operator+=(const wxDateSpan& diff); - inline wxDateTime operator+(const wxDateSpan& ds) const - { - wxDateTime dt(*this); - dt.Add(ds); - return dt; - } - - // return the difference of the date with a date span - inline wxDateTime Subtract(const wxDateSpan& diff) const; - // subtract a date span (positive or negative) - inline wxDateTime& Subtract(const wxDateSpan& diff); - // subtract a date span (positive or negative) - inline wxDateTime& operator-=(const wxDateSpan& diff); - inline wxDateTime operator-(const wxDateSpan& ds) const - { - wxDateTime dt(*this); - dt.Subtract(ds); - return dt; - } - - // return the difference between two dates - inline wxTimeSpan Subtract(const wxDateTime& dt) const; - inline wxTimeSpan operator-(const wxDateTime& dt2) const; - - // conversion to/from text: all conversions from text return the pointer to - // the next character following the date specification (i.e. the one where - // the scan had to stop) or NULL on failure. - // ------------------------------------------------------------------------ - - // parse a string in RFC 822 format (found e.g. in mail headers and - // having the form "Wed, 10 Feb 1999 19:07:07 +0100") - const wxChar *ParseRfc822Date(const wxChar* date); - // parse a date/time in the given format (see strptime(3)), fill in - // the missing (in the string) fields with the values of dateDef (by - // default, they will not change if they had valid values or will - // default to Today() otherwise) - const wxChar *ParseFormat(const wxChar *date, - const wxChar *format = wxDefaultDateTimeFormat, - const wxDateTime& dateDef = wxDefaultDateTime); - // parse a string containing the date/time in "free" format, this - // function will try to make an educated guess at the string contents - const wxChar *ParseDateTime(const wxChar *datetime); - // parse a string containing the date only in "free" format (less - // flexible than ParseDateTime) - const wxChar *ParseDate(const wxChar *date); - // parse a string containing the time only in "free" format - const wxChar *ParseTime(const wxChar *time); - - // this function accepts strftime()-like format string (default - // argument corresponds to the preferred date and time representation - // for the current locale) and returns the string containing the - // resulting text representation - wxString Format(const wxChar *format = wxDefaultDateTimeFormat, - const TimeZone& tz = Local) const; - // preferred date representation for the current locale - wxString FormatDate() const { return Format(_T("%x")); } - // preferred time representation for the current locale - wxString FormatTime() const { return Format(_T("%X")); } - // returns the string representing the date in ISO 8601 format - // (YYYY-MM-DD) - wxString FormatISODate() const { return Format(_T("%Y-%m-%d")); } - // returns the string representing the time in ISO 8601 format - // (HH:MM:SS) - wxString FormatISOTime() const { return Format(_T("%H:%M:%S")); } - - // implementation - // ------------------------------------------------------------------------ - - // construct from internal representation - wxDateTime(const wxLongLong& time) { m_time = time; } - - // get the internal representation - inline wxLongLong GetValue() const; - - // a helper function to get the current time_t - static time_t GetTimeNow() { return time((time_t *)NULL); } - - // another one to get the current time broken down - static struct tm *GetTmNow() - { -#ifdef __WXWINCE__ - static struct tm l_CurrentTime; - return GetTmNow(&l_CurrentTime); -#else - time_t t = GetTimeNow(); - return localtime(&t); -#endif - } - - // get current time using thread-safe function - static struct tm *GetTmNow(struct tm *tmstruct); - -private: - // the current country - as it's the same for all program objects (unless - // it runs on a _really_ big cluster system :-), this is a static member: - // see SetCountry() and GetCountry() - static Country ms_country; - - // this constant is used to transform a time_t value to the internal - // representation, as time_t is in seconds and we use milliseconds it's - // fixed to 1000 - static const long TIME_T_FACTOR; - - // returns true if we fall in range in which we can use standard ANSI C - // functions - inline bool IsInStdRange() const; - - // the internal representation of the time is the amount of milliseconds - // elapsed since the origin which is set by convention to the UNIX/C epoch - // value: the midnight of January 1, 1970 (UTC) - wxLongLong m_time; -}; - -// ---------------------------------------------------------------------------- -// This class contains a difference between 2 wxDateTime values, so it makes -// sense to add it to wxDateTime and it is the result of subtraction of 2 -// objects of that class. See also wxDateSpan. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTimeSpan -{ -public: - // constructors - // ------------------------------------------------------------------------ - - // return the timespan for the given number of milliseconds - static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); } - static wxTimeSpan Millisecond() { return Milliseconds(1); } - - // return the timespan for the given number of seconds - static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); } - static wxTimeSpan Second() { return Seconds(1); } - - // return the timespan for the given number of minutes - static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); } - static wxTimeSpan Minute() { return Minutes(1); } - - // return the timespan for the given number of hours - static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); } - static wxTimeSpan Hour() { return Hours(1); } - - // return the timespan for the given number of days - static wxTimeSpan Days(long days) { return Hours(24 * days); } - static wxTimeSpan Day() { return Days(1); } - - // return the timespan for the given number of weeks - static wxTimeSpan Weeks(long days) { return Days(7 * days); } - static wxTimeSpan Week() { return Weeks(1); } - - // default ctor constructs the 0 time span - wxTimeSpan() { } - - // from separate values for each component, date set to 0 (hours are - // not restricted to 0..24 range, neither are minutes, seconds or - // milliseconds) - inline wxTimeSpan(long hours, - long minutes = 0, - wxLongLong seconds = 0, - wxLongLong milliseconds = 0); - - // default copy ctor is ok - - // no dtor - - // arithmetics with time spans (see also below for more operators) - // ------------------------------------------------------------------------ - - // return the sum of two timespans - inline wxTimeSpan Add(const wxTimeSpan& diff) const; - // add two timespans together - inline wxTimeSpan& Add(const wxTimeSpan& diff); - // add two timespans together - wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); } - inline wxTimeSpan operator+(const wxTimeSpan& ts) const - { - return wxTimeSpan(GetValue() + ts.GetValue()); - } - - // return the difference of two timespans - inline wxTimeSpan Subtract(const wxTimeSpan& diff) const; - // subtract another timespan - inline wxTimeSpan& Subtract(const wxTimeSpan& diff); - // subtract another timespan - wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); } - inline wxTimeSpan operator-(const wxTimeSpan& ts) - { - return wxTimeSpan(GetValue() - ts.GetValue()); - } - - // multiply timespan by a scalar - inline wxTimeSpan Multiply(int n) const; - // multiply timespan by a scalar - inline wxTimeSpan& Multiply(int n); - // multiply timespan by a scalar - wxTimeSpan& operator*=(int n) { return Multiply(n); } - inline wxTimeSpan operator*(int n) const - { - return wxTimeSpan(*this).Multiply(n); - } - - // return this timespan with opposite sign - wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); } - // negate the value of the timespan - wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; } - // negate the value of the timespan - wxTimeSpan& operator-() { return Neg(); } - - // return the absolute value of the timespan: does _not_ modify the - // object - inline wxTimeSpan Abs() const; - - // there is intentionally no division because we don't want to - // introduce rounding errors in time calculations - - // comparaison (see also operator versions below) - // ------------------------------------------------------------------------ - - // is the timespan null? - bool IsNull() const { return m_diff == 0l; } - // returns true if the timespan is null - bool operator!() const { return !IsNull(); } - - // is the timespan positive? - bool IsPositive() const { return m_diff > 0l; } - - // is the timespan negative? - bool IsNegative() const { return m_diff < 0l; } - - // are two timespans equal? - inline bool IsEqualTo(const wxTimeSpan& ts) const; - // compare two timestamps: works with the absolute values, i.e. -2 - // hours is longer than 1 hour. Also, it will return false if the - // timespans are equal in absolute value. - inline bool IsLongerThan(const wxTimeSpan& ts) const; - // compare two timestamps: works with the absolute values, i.e. 1 - // hour is shorter than -2 hours. Also, it will return false if the - // timespans are equal in absolute value. - bool IsShorterThan(const wxTimeSpan& t) const { return !IsLongerThan(t); } - - inline bool operator<(const wxTimeSpan &ts) const - { - return GetValue() < ts.GetValue(); - } - - inline bool operator<=(const wxTimeSpan &ts) const - { - return GetValue() <= ts.GetValue(); - } - - inline bool operator>(const wxTimeSpan &ts) const - { - return GetValue() > ts.GetValue(); - } - - inline bool operator>=(const wxTimeSpan &ts) const - { - return GetValue() >= ts.GetValue(); - } - - inline bool operator==(const wxTimeSpan &ts) const - { - return GetValue() == ts.GetValue(); - } - - inline bool operator!=(const wxTimeSpan &ts) const - { - return GetValue() != ts.GetValue(); - } - - // breaking into days, hours, minutes and seconds - // ------------------------------------------------------------------------ - - // get the max number of weeks in this timespan - inline int GetWeeks() const; - // get the max number of days in this timespan - inline int GetDays() const; - // get the max number of hours in this timespan - inline int GetHours() const; - // get the max number of minutes in this timespan - inline int GetMinutes() const; - // get the max number of seconds in this timespan - inline wxLongLong GetSeconds() const; - // get the number of milliseconds in this timespan - wxLongLong GetMilliseconds() const { return m_diff; } - - // conversion to text - // ------------------------------------------------------------------------ - - // this function accepts strftime()-like format string (default - // argument corresponds to the preferred date and time representation - // for the current locale) and returns the string containing the - // resulting text representation. Notice that only some of format - // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, - // minutes and seconds make sense, but not "PM/AM" string for example. - wxString Format(const wxChar *format = wxDefaultTimeSpanFormat) const; - - // implementation - // ------------------------------------------------------------------------ - - // construct from internal representation - wxTimeSpan(const wxLongLong& diff) { m_diff = diff; } - - // get the internal representation - wxLongLong GetValue() const { return m_diff; } - -private: - // the (signed) time span in milliseconds - wxLongLong m_diff; -}; - -// ---------------------------------------------------------------------------- -// This class is a "logical time span" and is useful for implementing program -// logic for such things as "add one month to the date" which, in general, -// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date -// the next month (to understand that this is indeed different consider adding -// one month to Feb, 15 - we want to get Mar, 15, of course). -// -// When adding a month to the date, all lesser components (days, hours, ...) -// won't be changed unless the resulting date would be invalid: for example, -// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31. -// -// Because of this feature, adding and subtracting back again the same -// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1 -// month will be Jan 28, not Jan 31! -// -// wxDateSpan can be either positive or negative. They may be -// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1 -// month and 1 day) is 2 months and 2 days. They can be added together and -// with wxDateTime or wxTimeSpan, but the type of result is different for each -// case. -// -// Beware about weeks: if you specify both weeks and days, the total number of -// days added will be 7*weeks + days! See also GetTotalDays() function. -// -// Equality operators are defined for wxDateSpans. Two datespans are equal if -// they both give the same target date when added to *every* source date. -// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because -// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is -// equal to wxDateSpan::Weeks(2) -// -// Finally, notice that for adding hours, minutes &c you don't need this -// class: wxTimeSpan will do the job because there are no subtleties -// associated with those. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDateSpan -{ -public: - // constructors - // ------------------------------------------------------------------------ - - // this many years/months/weeks/days - wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0) - { - m_years = years; - m_months = months; - m_weeks = weeks; - m_days = days; - } - - // get an object for the given number of days - static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); } - static wxDateSpan Day() { return Days(1); } - - // get an object for the given number of weeks - static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); } - static wxDateSpan Week() { return Weeks(1); } - - // get an object for the given number of months - static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); } - static wxDateSpan Month() { return Months(1); } - - // get an object for the given number of years - static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); } - static wxDateSpan Year() { return Years(1); } - - // default copy ctor is ok - - // no dtor - - // accessors (all SetXXX() return the (modified) wxDateSpan object) - // ------------------------------------------------------------------------ - - // set number of years - wxDateSpan& SetYears(int n) { m_years = n; return *this; } - // set number of months - wxDateSpan& SetMonths(int n) { m_months = n; return *this; } - // set number of weeks - wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; } - // set number of days - wxDateSpan& SetDays(int n) { m_days = n; return *this; } - - // get number of years - int GetYears() const { return m_years; } - // get number of months - int GetMonths() const { return m_months; } - // get number of weeks - int GetWeeks() const { return m_weeks; } - // get number of days - int GetDays() const { return m_days; } - // returns 7*GetWeeks() + GetDays() - int GetTotalDays() const { return 7*m_weeks + m_days; } - - // arithmetics with date spans (see also below for more operators) - // ------------------------------------------------------------------------ - - // return sum of two date spans - inline wxDateSpan Add(const wxDateSpan& other) const; - // add another wxDateSpan to us - inline wxDateSpan& Add(const wxDateSpan& other); - // add another wxDateSpan to us - inline wxDateSpan& operator+=(const wxDateSpan& other); - inline wxDateSpan operator+(const wxDateSpan& ds) const - { - return wxDateSpan(GetYears() + ds.GetYears(), - GetMonths() + ds.GetMonths(), - GetWeeks() + ds.GetWeeks(), - GetDays() + ds.GetDays()); - } - - // return difference of two date spans - inline wxDateSpan Subtract(const wxDateSpan& other) const; - // subtract another wxDateSpan from us - inline wxDateSpan& Subtract(const wxDateSpan& other); - // subtract another wxDateSpan from us - inline wxDateSpan& operator-=(const wxDateSpan& other); - inline wxDateSpan operator-(const wxDateSpan& ds) const - { - return wxDateSpan(GetYears() - ds.GetYears(), - GetMonths() - ds.GetMonths(), - GetWeeks() - ds.GetWeeks(), - GetDays() - ds.GetDays()); - } - - // return a copy of this time span with changed sign - inline wxDateSpan Negate() const; - // inverse the sign of this timespan - inline wxDateSpan& Neg(); - // inverse the sign of this timespan - wxDateSpan& operator-() { return Neg(); } - - // return the date span proportional to this one with given factor - inline wxDateSpan Multiply(int factor) const; - // multiply all components by a (signed) number - inline wxDateSpan& Multiply(int factor); - // multiply all components by a (signed) number - inline wxDateSpan& operator*=(int factor) { return Multiply(factor); } - inline wxDateSpan operator*(int n) const - { - return wxDateSpan(*this).Multiply(n); - } - - // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 - inline bool operator==(const wxDateSpan& ds) const - { - return GetYears() == ds.GetYears() && - GetMonths() == ds.GetMonths() && - GetTotalDays() == ds.GetTotalDays(); - } - - inline bool operator!=(const wxDateSpan& ds) const - { - return !(*this == ds); - } - -private: - int m_years, - m_months, - m_weeks, - m_days; -}; - -// ---------------------------------------------------------------------------- -// wxDateTimeArray: array of dates. -// ---------------------------------------------------------------------------- - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// wxDateTimeHolidayAuthority: an object of this class will decide whether a -// given date is a holiday and is used by all functions working with "work -// days". -// -// NB: the base class is an ABC, derived classes must implement the pure -// virtual methods to work with the holidays they correspond to. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority; -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *, - wxHolidayAuthoritiesArray, - class WXDLLIMPEXP_BASE); - -class wxDateTimeHolidaysModule; -class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority -{ -friend class wxDateTimeHolidaysModule; -public: - // returns true if the given date is a holiday - static bool IsHoliday(const wxDateTime& dt); - - // fills the provided array with all holidays in the given range, returns - // the number of them - static size_t GetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays); - - // clear the list of holiday authorities - static void ClearAllAuthorities(); - - // add a new holiday authority (the pointer will be deleted by - // wxDateTimeHolidayAuthority) - static void AddAuthority(wxDateTimeHolidayAuthority *auth); - - // the base class must have a virtual dtor - virtual ~wxDateTimeHolidayAuthority(); - -protected: - // this function is called to determine whether a given day is a holiday - virtual bool DoIsHoliday(const wxDateTime& dt) const = 0; - - // this function should fill the array with all holidays between the two - // given dates - it is implemented in the base class, but in a very - // inefficient way (it just iterates over all days and uses IsHoliday() for - // each of them), so it must be overridden in the derived class where the - // base class version may be explicitly used if needed - // - // returns the number of holidays in the given range and fills holidays - // array - virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays) const = 0; - -private: - // all holiday authorities - static wxHolidayAuthoritiesArray ms_authorities; -}; - -// the holidays for this class are all Saturdays and Sundays -class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority -{ -protected: - virtual bool DoIsHoliday(const wxDateTime& dt) const; - virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, - const wxDateTime& dtEnd, - wxDateTimeArray& holidays) const; -}; - -// ============================================================================ -// inline functions implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// private macros -// ---------------------------------------------------------------------------- - -#define MILLISECONDS_PER_DAY 86400000l - -// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but -// using a temp variable always might prevent other compilers from optimising -// it away - hence use of this ugly macro -#ifndef __HPUX__ - #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op -#else - #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt -#endif - -// ---------------------------------------------------------------------------- -// wxDateTime construction -// ---------------------------------------------------------------------------- - -inline bool wxDateTime::IsInStdRange() const -{ - return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; -} - -/* static */ -inline wxDateTime wxDateTime::Now() -{ - struct tm tmstruct; - return wxDateTime(*GetTmNow(&tmstruct)); -} - -/* static */ -inline wxDateTime wxDateTime::Today() -{ - wxDateTime dt(Now()); - dt.ResetTime(); - - return dt; -} - -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -inline wxDateTime& wxDateTime::Set(time_t timet) -{ - // assign first to avoid long multiplication overflow! - m_time = timet - WX_TIME_BASE_OFFSET ; - m_time *= TIME_T_FACTOR; - - return *this; -} -#endif - -inline wxDateTime& wxDateTime::SetToCurrent() -{ - *this = Now(); - return *this; -} - -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -inline wxDateTime::wxDateTime(time_t timet) -{ - Set(timet); -} -#endif - -inline wxDateTime::wxDateTime(const struct tm& tm) -{ - Set(tm); -} - -inline wxDateTime::wxDateTime(const Tm& tm) -{ - Set(tm); -} - -inline wxDateTime::wxDateTime(double jdn) -{ - Set(jdn); -} - -inline wxDateTime& wxDateTime::Set(const Tm& tm) -{ - wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") ); - - return Set(tm.mday, (Month)tm.mon, tm.year, - tm.hour, tm.min, tm.sec, tm.msec); -} - -inline wxDateTime::wxDateTime(wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) -{ - Set(hour, minute, second, millisec); -} - -inline wxDateTime::wxDateTime(wxDateTime_t day, - Month month, - int year, - wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) -{ - Set(day, month, year, hour, minute, second, millisec); -} - -// ---------------------------------------------------------------------------- -// wxDateTime accessors -// ---------------------------------------------------------------------------- - -inline wxLongLong wxDateTime::GetValue() const -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); - - return m_time; -} - -inline time_t wxDateTime::GetTicks() const -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); - if ( !IsInStdRange() ) - { - return (time_t)-1; - } - - return (time_t)((m_time / (long)TIME_T_FACTOR).ToLong()) + WX_TIME_BASE_OFFSET; -} - -inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, - Month month, - int year) -{ - return SetToWeekDay(weekday, -1, month, year); -} - -inline wxDateTime -wxDateTime::GetWeekDayInSameWeek(WeekDay weekday, - WeekFlags WXUNUSED(flags)) const -{ - MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); -} - -inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const -{ - MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); -} - -inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const -{ - MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); -} - -inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, - int n, - Month month, - int year) const -{ - wxDateTime dt(*this); - - return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; -} - -inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, - Month month, - int year) -{ - wxDateTime dt(*this); - - return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; -} - -inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const -{ - MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); -} - -inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const -{ - MODIFY_AND_RETURN( SetToYearDay(yday) ); -} - -// ---------------------------------------------------------------------------- -// wxDateTime comparison -// ---------------------------------------------------------------------------- - -inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); - - return m_time == datetime.m_time; -} - -inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); - - return m_time < datetime.m_time; -} - -inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); - - return m_time > datetime.m_time; -} - -inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, - const wxDateTime& t2) const -{ - // no need for assert, will be checked by the functions we call - return IsLaterThan(t1) && IsEarlierThan(t2); -} - -inline bool wxDateTime::IsBetween(const wxDateTime& t1, - const wxDateTime& t2) const -{ - // no need for assert, will be checked by the functions we call - return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); -} - -inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const -{ - Tm tm1 = GetTm(), - tm2 = dt.GetTm(); - - return tm1.year == tm2.year && - tm1.mon == tm2.mon && - tm1.mday == tm2.mday; -} - -inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const -{ - // notice that we can't do something like this: - // - // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY - // - // because we have also to deal with (possibly) different DST settings! - Tm tm1 = GetTm(), - tm2 = dt.GetTm(); - - return tm1.hour == tm2.hour && - tm1.min == tm2.min && - tm1.sec == tm2.sec && - tm1.msec == tm2.msec; -} - -inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, - const wxTimeSpan& ts) const -{ - return IsBetween(dt.Subtract(ts), dt.Add(ts)); -} - -// ---------------------------------------------------------------------------- -// wxDateTime arithmetics -// ---------------------------------------------------------------------------- - -inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); - - return wxDateTime(m_time + diff.GetValue()); -} - -inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); - - m_time += diff.GetValue(); - - return *this; -} - -inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) -{ - return Add(diff); -} - -inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); - - return wxDateTime(m_time - diff.GetValue()); -} - -inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) -{ - wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); - - m_time -= diff.GetValue(); - - return *this; -} - -inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) -{ - return Subtract(diff); -} - -inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const -{ - wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); - - return wxTimeSpan(GetValue() - datetime.GetValue()); -} - -inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const -{ - return this->Subtract(dt2); -} - -inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const -{ - return wxDateTime(*this).Add(diff); -} - -inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) -{ - return Add(diff.Negate()); -} - -inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const -{ - return wxDateTime(*this).Subtract(diff); -} - -inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) -{ - return Subtract(diff); -} - -inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) -{ - return Add(diff); -} - -// ---------------------------------------------------------------------------- -// wxDateTime and timezones -// ---------------------------------------------------------------------------- - -inline wxDateTime -wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const -{ - MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); -} - -inline wxDateTime -wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const -{ - MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) ); -} - -// ---------------------------------------------------------------------------- -// wxTimeSpan construction -// ---------------------------------------------------------------------------- - -inline wxTimeSpan::wxTimeSpan(long hours, - long minutes, - wxLongLong seconds, - wxLongLong milliseconds) -{ - // assign first to avoid precision loss - m_diff = hours; - m_diff *= 60l; - m_diff += minutes; - m_diff *= 60l; - m_diff += seconds; - m_diff *= 1000l; - m_diff += milliseconds; -} - -// ---------------------------------------------------------------------------- -// wxTimeSpan accessors -// ---------------------------------------------------------------------------- - -inline wxLongLong wxTimeSpan::GetSeconds() const -{ - return m_diff / 1000l; -} - -inline int wxTimeSpan::GetMinutes() const -{ - // explicit cast to int suppresses a warning with CodeWarrior and possibly - // others (changing the return type to long from int is impossible in 2.8) - return (int)((GetSeconds() / 60l).GetLo()); -} - -inline int wxTimeSpan::GetHours() const -{ - return GetMinutes() / 60; -} - -inline int wxTimeSpan::GetDays() const -{ - return GetHours() / 24; -} - -inline int wxTimeSpan::GetWeeks() const -{ - return GetDays() / 7; -} - -// ---------------------------------------------------------------------------- -// wxTimeSpan arithmetics -// ---------------------------------------------------------------------------- - -inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const -{ - return wxTimeSpan(m_diff + diff.GetValue()); -} - -inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) -{ - m_diff += diff.GetValue(); - - return *this; -} - -inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const -{ - return wxTimeSpan(m_diff - diff.GetValue()); -} - -inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) -{ - m_diff -= diff.GetValue(); - - return *this; -} - -inline wxTimeSpan& wxTimeSpan::Multiply(int n) -{ - m_diff *= (long)n; - - return *this; -} - -inline wxTimeSpan wxTimeSpan::Multiply(int n) const -{ - return wxTimeSpan(m_diff * (long)n); -} - -inline wxTimeSpan wxTimeSpan::Abs() const -{ - return wxTimeSpan(GetValue().Abs()); -} - -inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const -{ - return GetValue() == ts.GetValue(); -} - -inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const -{ - return GetValue().Abs() > ts.GetValue().Abs(); -} - -// ---------------------------------------------------------------------------- -// wxDateSpan -// ---------------------------------------------------------------------------- - -inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) -{ - m_years += other.m_years; - m_months += other.m_months; - m_weeks += other.m_weeks; - m_days += other.m_days; - - return *this; -} - -inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) -{ - return *this += other; -} - -inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const -{ - wxDateSpan ds(*this); - ds.Add(other); - return ds; -} - -inline wxDateSpan& wxDateSpan::Multiply(int factor) -{ - m_years *= factor; - m_months *= factor; - m_weeks *= factor; - m_days *= factor; - - return *this; -} - -inline wxDateSpan wxDateSpan::Multiply(int factor) const -{ - wxDateSpan ds(*this); - ds.Multiply(factor); - return ds; -} - -inline wxDateSpan wxDateSpan::Negate() const -{ - return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); -} - -inline wxDateSpan& wxDateSpan::Neg() -{ - m_years = -m_years; - m_months = -m_months; - m_weeks = -m_weeks; - m_days = -m_days; - - return *this; -} - -inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) -{ - return *this += other.Negate(); -} - -inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) -{ - return *this -= other; -} - -inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const -{ - wxDateSpan ds(*this); - ds.Subtract(other); - return ds; -} - -#undef MILLISECONDS_PER_DAY - -#undef MODIFY_AND_RETURN - -// ============================================================================ -// binary operators -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxTimeSpan operators -// ---------------------------------------------------------------------------- - -wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts); - -// ---------------------------------------------------------------------------- -// wxDateSpan -// ---------------------------------------------------------------------------- - -wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds); - -// ============================================================================ -// other helper functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// iteration helpers: can be used to write a for loop over enum variable like -// this: -// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) -// ---------------------------------------------------------------------------- - -WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m); -WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m); -WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd); -WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd); - -#endif // wxUSE_DATETIME - -#endif // _WX_DATETIME_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/datetime.h +// Purpose: declarations of time/date related classes (wxDateTime, +// wxTimeSpan) +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.02.99 +// RCS-ID: $Id: datetime.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATETIME_H +#define _WX_DATETIME_H + +#include "wx/defs.h" + +#if wxUSE_DATETIME + +#ifndef __WXWINCE__ +#include +#else +#include "wx/msw/wince/time.h" +#endif + +#include // for INT_MIN + +#include "wx/longlong.h" + +class WXDLLIMPEXP_FWD_BASE wxDateTime; +class WXDLLIMPEXP_FWD_BASE wxTimeSpan; +class WXDLLIMPEXP_FWD_BASE wxDateSpan; + +#include "wx/dynarray.h" + +// not all c-runtimes are based on 1/1/1970 being (time_t) 0 +// set this to the corresponding value in seconds 1/1/1970 has on your +// systems c-runtime + +#if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000 + #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L ) +#else + #define WX_TIME_BASE_OFFSET 0 +#endif +/* + * TODO + * + * + 1. Time zones with minutes (make TimeZone a class) + * ? 2. getdate() function like under Solaris + * + 3. text conversion for wxDateSpan + * + 4. pluggable modules for the workdays calculations + * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts + */ + +/* Two wrapper functions for thread safety */ +#ifdef HAVE_LOCALTIME_R +#define wxLocaltime_r localtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, localtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r +#endif +#endif + +#ifdef HAVE_GMTIME_R +#define wxGmtime_r gmtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, gmtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r +#endif +#endif + +/* + The three (main) classes declared in this header represent: + + 1. An absolute moment in the time (wxDateTime) + 2. A difference between two moments in the time, positive or negative + (wxTimeSpan) + 3. A logical difference between two dates expressed in + years/months/weeks/days (wxDateSpan) + + The following arithmetic operations are permitted (all others are not): + + addition + -------- + + wxDateTime + wxTimeSpan = wxDateTime + wxDateTime + wxDateSpan = wxDateTime + wxTimeSpan + wxTimeSpan = wxTimeSpan + wxDateSpan + wxDateSpan = wxDateSpan + + subtraction + ------------ + wxDateTime - wxDateTime = wxTimeSpan + wxDateTime - wxTimeSpan = wxDateTime + wxDateTime - wxDateSpan = wxDateTime + wxTimeSpan - wxTimeSpan = wxTimeSpan + wxDateSpan - wxDateSpan = wxDateSpan + + multiplication + -------------- + wxTimeSpan * number = wxTimeSpan + number * wxTimeSpan = wxTimeSpan + wxDateSpan * number = wxDateSpan + number * wxDateSpan = wxDateSpan + + unitary minus + ------------- + -wxTimeSpan = wxTimeSpan + -wxDateSpan = wxDateSpan + + For each binary operation OP (+, -, *) we have the following operatorOP=() as + a method and the method with a symbolic name OPER (Add, Subtract, Multiply) + as a synonym for it and another const method with the same name which returns + the changed copy of the object and operatorOP() as a global function which is + implemented in terms of the const version of OPEN. For the unary - we have + operator-() as a method, Neg() as synonym for it and Negate() which returns + the copy of the object with the changed sign. +*/ + +// an invalid/default date time object which may be used as the default +// argument for arguments of type wxDateTime; it is also returned by all +// functions returning wxDateTime on failure (this is why it is also called +// wxInvalidDateTime) +class WXDLLIMPEXP_FWD_BASE wxDateTime; + +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultDateTimeFormat; +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDefaultTimeSpanFormat; +extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; + +#define wxInvalidDateTime wxDefaultDateTime + +// ---------------------------------------------------------------------------- +// wxDateTime represents an absolute moment in the time +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDateTime +{ +public: + // types + // ------------------------------------------------------------------------ + + // a small unsigned integer type for storing things like minutes, + // seconds &c. It should be at least short (i.e. not char) to contain + // the number of milliseconds - it may also be 'int' because there is + // no size penalty associated with it in our code, we don't store any + // data in this format + typedef unsigned short wxDateTime_t; + + // constants + // ------------------------------------------------------------------------ + + // the timezones + enum TZ + { + // the time in the current time zone + Local, + + // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be + // consequent numbers, so writing something like `GMT0 + offset' is + // safe if abs(offset) <= 12 + + // underscore stands for minus + GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7, + GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1, + GMT0, + GMT1, GMT2, GMT3, GMT4, GMT5, GMT6, + GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13, + // Note that GMT12 and GMT_12 are not the same: there is a difference + // of exactly one day between them + + // some symbolic names for TZ + + // Europe + WET = GMT0, // Western Europe Time + WEST = GMT1, // Western Europe Summer Time + CET = GMT1, // Central Europe Time + CEST = GMT2, // Central Europe Summer Time + EET = GMT2, // Eastern Europe Time + EEST = GMT3, // Eastern Europe Summer Time + MSK = GMT3, // Moscow Time + MSD = GMT4, // Moscow Summer Time + + // US and Canada + AST = GMT_4, // Atlantic Standard Time + ADT = GMT_3, // Atlantic Daylight Time + EST = GMT_5, // Eastern Standard Time + EDT = GMT_4, // Eastern Daylight Saving Time + CST = GMT_6, // Central Standard Time + CDT = GMT_5, // Central Daylight Saving Time + MST = GMT_7, // Mountain Standard Time + MDT = GMT_6, // Mountain Daylight Saving Time + PST = GMT_8, // Pacific Standard Time + PDT = GMT_7, // Pacific Daylight Saving Time + HST = GMT_10, // Hawaiian Standard Time + AKST = GMT_9, // Alaska Standard Time + AKDT = GMT_8, // Alaska Daylight Saving Time + + // Australia + + A_WST = GMT8, // Western Standard Time + A_CST = GMT13 + 1, // Central Standard Time (+9.5) + A_EST = GMT10, // Eastern Standard Time + A_ESST = GMT11, // Eastern Summer Time + + // New Zealand + NZST = GMT12, // Standard Time + NZDT = GMT13, // Daylight Saving Time + + // TODO add more symbolic timezone names here + + // Universal Coordinated Time = the new and politically correct name + // for GMT + UTC = GMT0 + }; + + // the calendar systems we know about: notice that it's valid (for + // this classes purpose anyhow) to work with any of these calendars + // even with the dates before the historical appearance of the + // calendar + enum Calendar + { + Gregorian, // current calendar + Julian // calendar in use since -45 until the 1582 (or later) + + // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?) + }; + + // these values only are used to identify the different dates of + // adoption of the Gregorian calendar (see IsGregorian()) + // + // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)" + // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html + // except for the comments "we take". + // + // Symbol "->" should be read as "was followed by" in the comments + // which follow. + enum GregorianAdoption + { + Gr_Unknown, // no data for this country or it's too uncertain to use + Gr_Standard, // on the day 0 of Gregorian calendar: 15 Oct 1582 + + Gr_Alaska, // Oct 1867 when Alaska became part of the USA + Gr_Albania, // Dec 1912 + + Gr_Austria = Gr_Unknown, // Different regions on different dates + Gr_Austria_Brixen, // 5 Oct 1583 -> 16 Oct 1583 + Gr_Austria_Salzburg = Gr_Austria_Brixen, + Gr_Austria_Tyrol = Gr_Austria_Brixen, + Gr_Austria_Carinthia, // 14 Dec 1583 -> 25 Dec 1583 + Gr_Austria_Styria = Gr_Austria_Carinthia, + + Gr_Belgium, // Then part of the Netherlands + + Gr_Bulgaria = Gr_Unknown, // Unknown precisely (from 1915 to 1920) + Gr_Bulgaria_1, // 18 Mar 1916 -> 1 Apr 1916 + Gr_Bulgaria_2, // 31 Mar 1916 -> 14 Apr 1916 + Gr_Bulgaria_3, // 3 Sep 1920 -> 17 Sep 1920 + + Gr_Canada = Gr_Unknown, // Different regions followed the changes in + // Great Britain or France + + Gr_China = Gr_Unknown, // Different authorities say: + Gr_China_1, // 18 Dec 1911 -> 1 Jan 1912 + Gr_China_2, // 18 Dec 1928 -> 1 Jan 1929 + + Gr_Czechoslovakia, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584 + Gr_Denmark, // (including Norway) 18 Feb 1700 -> 1 Mar 1700 + Gr_Egypt, // 1875 + Gr_Estonia, // 1918 + Gr_Finland, // Then part of Sweden + + Gr_France, // 9 Dec 1582 -> 20 Dec 1582 + Gr_France_Alsace, // 4 Feb 1682 -> 16 Feb 1682 + Gr_France_Lorraine, // 16 Feb 1760 -> 28 Feb 1760 + Gr_France_Strasbourg, // February 1682 + + Gr_Germany = Gr_Unknown, // Different states on different dates: + Gr_Germany_Catholic, // 1583-1585 (we take 1584) + Gr_Germany_Prussia, // 22 Aug 1610 -> 2 Sep 1610 + Gr_Germany_Protestant, // 18 Feb 1700 -> 1 Mar 1700 + + Gr_GreatBritain, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)') + + Gr_Greece, // 9 Mar 1924 -> 23 Mar 1924 + Gr_Hungary, // 21 Oct 1587 -> 1 Nov 1587 + Gr_Ireland = Gr_GreatBritain, + Gr_Italy = Gr_Standard, + + Gr_Japan = Gr_Unknown, // Different authorities say: + Gr_Japan_1, // 19 Dec 1872 -> 1 Jan 1873 + Gr_Japan_2, // 19 Dec 1892 -> 1 Jan 1893 + Gr_Japan_3, // 18 Dec 1918 -> 1 Jan 1919 + + Gr_Latvia, // 1915-1918 (we take 1915) + Gr_Lithuania, // 1915 + Gr_Luxemburg, // 14 Dec 1582 -> 25 Dec 1582 + Gr_Netherlands = Gr_Belgium, // (including Belgium) 1 Jan 1583 + + // this is too weird to take into account: the Gregorian calendar was + // introduced twice in Groningen, first time 28 Feb 1583 was followed + // by 11 Mar 1583, then it has gone back to Julian in the summer of + // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is + // the date we take here + Gr_Netherlands_Groningen, // 13 Dec 1700 -> 12 Jan 1701 + Gr_Netherlands_Gelderland, // 30 Jun 1700 -> 12 Jul 1700 + Gr_Netherlands_Utrecht, // (and Overijssel) 30 Nov 1700->12 Dec 1700 + Gr_Netherlands_Friesland, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701 + + Gr_Norway = Gr_Denmark, // Then part of Denmark + Gr_Poland = Gr_Standard, + Gr_Portugal = Gr_Standard, + Gr_Romania, // 31 Mar 1919 -> 14 Apr 1919 + Gr_Russia, // 31 Jan 1918 -> 14 Feb 1918 + Gr_Scotland = Gr_GreatBritain, + Gr_Spain = Gr_Standard, + + // Sweden has a curious history. Sweden decided to make a gradual + // change from the Julian to the Gregorian calendar. By dropping every + // leap year from 1700 through 1740 the eleven superfluous days would + // be omitted and from 1 Mar 1740 they would be in sync with the + // Gregorian calendar. (But in the meantime they would be in sync with + // nobody!) + // + // So 1700 (which should have been a leap year in the Julian calendar) + // was not a leap year in Sweden. However, by mistake 1704 and 1708 + // became leap years. This left Sweden out of synchronisation with + // both the Julian and the Gregorian world, so they decided to go back + // to the Julian calendar. In order to do this, they inserted an extra + // day in 1712, making that year a double leap year! So in 1712, + // February had 30 days in Sweden. + // + // Later, in 1753, Sweden changed to the Gregorian calendar by + // dropping 11 days like everyone else. + Gr_Sweden = Gr_Finland, // 17 Feb 1753 -> 1 Mar 1753 + + Gr_Switzerland = Gr_Unknown,// Different cantons used different dates + Gr_Switzerland_Catholic, // 1583, 1584 or 1597 (we take 1584) + Gr_Switzerland_Protestant, // 31 Dec 1700 -> 12 Jan 1701 + + Gr_Turkey, // 1 Jan 1927 + Gr_USA = Gr_GreatBritain, + Gr_Wales = Gr_GreatBritain, + Gr_Yugoslavia // 1919 + }; + + // the country parameter is used so far for calculating the start and + // the end of DST period and for deciding whether the date is a work + // day or not + // + // TODO move this to intl.h + +// Required for WinCE +#ifdef USA +#undef USA +#endif + + enum Country + { + Country_Unknown, // no special information for this country + Country_Default, // set the default country with SetCountry() method + // or use the default country with any other + + // TODO add more countries (for this we must know about DST and/or + // holidays for this country) + + // Western European countries: we assume that they all follow the same + // DST rules (true or false?) + Country_WesternEurope_Start, + Country_EEC = Country_WesternEurope_Start, + France, + Germany, + UK, + Country_WesternEurope_End = UK, + + Russia, + USA + }; + // symbolic names for the months + enum Month + { + Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month + }; + + // symbolic names for the weekdays + enum WeekDay + { + Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay + }; + + // invalid value for the year + enum Year + { + Inv_Year = SHRT_MIN // should hold in wxDateTime_t + }; + + // flags for GetWeekDayName and GetMonthName + enum NameFlags + { + Name_Full = 0x01, // return full name + Name_Abbr = 0x02 // return abbreviated name + }; + + // flags for GetWeekOfYear and GetWeekOfMonth + enum WeekFlags + { + Default_First, // Sunday_First for US, Monday_First for the rest + Monday_First, // week starts with a Monday + Sunday_First // week starts with a Sunday + }; + + // helper classes + // ------------------------------------------------------------------------ + + // a class representing a time zone: basicly, this is just an offset + // (in seconds) from GMT + class WXDLLIMPEXP_BASE TimeZone + { + public: + TimeZone(TZ tz); + + // don't use this ctor, it doesn't work for negative offsets (but can't + // be removed or changed to avoid breaking ABI in 2.8) + TimeZone(wxDateTime_t offset = 0) { m_offset = offset; } + +#if wxABI_VERSION >= 20808 + // create time zone object with the given offset + static TimeZone Make(long offset) + { + TimeZone tz; + tz.m_offset = offset; + return tz; + } +#endif // wxABI 2.8.8+ + + long GetOffset() const { return m_offset; } + + private: + // offset for this timezone from GMT in seconds + long m_offset; + }; + + // standard struct tm is limited to the years from 1900 (because + // tm_year field is the offset from 1900), so we use our own struct + // instead to represent broken down time + // + // NB: this struct should always be kept normalized (i.e. mon should + // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays() + // instead of modifying the member fields directly! + struct WXDLLIMPEXP_BASE Tm + { + wxDateTime_t msec, sec, min, hour, mday; + Month mon; + int year; + + // default ctor inits the object to an invalid value + Tm(); + + // ctor from struct tm and the timezone + Tm(const struct tm& tm, const TimeZone& tz); + + // check that the given date/time is valid (in Gregorian calendar) + bool IsValid() const; + + // get the week day + WeekDay GetWeekDay() // not const because wday may be changed + { + if ( wday == Inv_WeekDay ) + ComputeWeekDay(); + + return (WeekDay)wday; + } + + // add the given number of months to the date keeping it normalized + void AddMonths(int monDiff); + + // add the given number of months to the date keeping it normalized + void AddDays(int dayDiff); + + private: + // compute the weekday from other fields + void ComputeWeekDay(); + + // the timezone we correspond to + TimeZone m_tz; + + // these values can't be accessed directly because they're not always + // computed and we calculate them on demand + wxDateTime_t wday, yday; + }; + + // static methods + // ------------------------------------------------------------------------ + + // set the current country + static void SetCountry(Country country); + // get the current country + static Country GetCountry(); + + // return true if the country is a West European one (in practice, + // this means that the same DST rules as for EEC apply) + static bool IsWestEuropeanCountry(Country country = Country_Default); + + // return the current year + static int GetCurrentYear(Calendar cal = Gregorian); + + // convert the year as returned by wxDateTime::GetYear() to a year + // suitable for BC/AD notation. The difference is that BC year 1 + // corresponds to the year 0 (while BC year 0 didn't exist) and AD + // year N is just year N. + static int ConvertYearToBC(int year); + + // return the current month + static Month GetCurrentMonth(Calendar cal = Gregorian); + + // returns true if the given year is a leap year in the given calendar + static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian); + + // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC) + static int GetCentury(int year); + + // returns the number of days in this year (356 or 355 for Gregorian + // calendar usually :-) + static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian); + + // get the number of the days in the given month (default value for + // the year means the current one) + static wxDateTime_t GetNumberOfDays(Month month, + int year = Inv_Year, + Calendar cal = Gregorian); + + // get the full (default) or abbreviated month name in the current + // locale, returns empty string on error + static wxString GetMonthName(Month month, + NameFlags flags = Name_Full); + + // get the full (default) or abbreviated weekday name in the current + // locale, returns empty string on error + static wxString GetWeekDayName(WeekDay weekday, + NameFlags flags = Name_Full); + + // get the AM and PM strings in the current locale (may be empty) + static void GetAmPmStrings(wxString *am, wxString *pm); + + // return true if the given country uses DST for this year + static bool IsDSTApplicable(int year = Inv_Year, + Country country = Country_Default); + + // get the beginning of DST for this year, will return invalid object + // if no DST applicable in this year. The default value of the + // parameter means to take the current year. + static wxDateTime GetBeginDST(int year = Inv_Year, + Country country = Country_Default); + // get the end of DST for this year, will return invalid object + // if no DST applicable in this year. The default value of the + // parameter means to take the current year. + static wxDateTime GetEndDST(int year = Inv_Year, + Country country = Country_Default); + + // return the wxDateTime object for the current time + static inline wxDateTime Now(); + + // return the wxDateTime object for the current time with millisecond + // precision (if available on this platform) + static wxDateTime UNow(); + + // return the wxDateTime object for today midnight: i.e. as Now() but + // with time set to 0 + static inline wxDateTime Today(); + + // constructors: you should test whether the constructor succeeded with + // IsValid() function. The values Inv_Month and Inv_Year for the + // parameters mean take current month and/or year values. + // ------------------------------------------------------------------------ + + // default ctor does not initialize the object, use Set()! + wxDateTime() { m_time = wxLongLong((long)ULONG_MAX, ULONG_MAX); } + + // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) +#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) +// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration + inline wxDateTime(time_t timet); +#endif + // from broken down time/date (only for standard Unix range) + inline wxDateTime(const struct tm& tm); + // from broken down time/date (any range) + inline wxDateTime(const Tm& tm); + + // from JDN (beware of rounding errors) + inline wxDateTime(double jdn); + + // from separate values for each component, date set to today + inline wxDateTime(wxDateTime_t hour, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + // from separate values for each component with explicit date + inline wxDateTime(wxDateTime_t day, // day of the month + Month month, + int year = Inv_Year, // 1999, not 99 please! + wxDateTime_t hour = 0, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + + // default copy ctor ok + + // no dtor + + // assignment operators and Set() functions: all non const methods return + // the reference to this object. IsValid() should be used to test whether + // the function succeeded. + // ------------------------------------------------------------------------ + + // set to the current time + inline wxDateTime& SetToCurrent(); + +#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) +// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration + // set to given time_t value + inline wxDateTime& Set(time_t timet); +#endif + + // set to given broken down time/date + wxDateTime& Set(const struct tm& tm); + + // set to given broken down time/date + inline wxDateTime& Set(const Tm& tm); + + // set to given JDN (beware of rounding errors) + wxDateTime& Set(double jdn); + + // set to given time, date = today + wxDateTime& Set(wxDateTime_t hour, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + + // from separate values for each component with explicit date + // (defaults for month and year are the current values) + wxDateTime& Set(wxDateTime_t day, + Month month, + int year = Inv_Year, // 1999, not 99 please! + wxDateTime_t hour = 0, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + + // resets time to 00:00:00, doesn't change the date + wxDateTime& ResetTime(); + +#if wxABI_VERSION >= 20802 + // get the date part of this object only, i.e. the object which has the + // same date as this one but time of 00:00:00 + wxDateTime GetDateOnly() const; +#endif // wxABI 2.8.1+ + + // the following functions don't change the values of the other + // fields, i.e. SetMinute() won't change either hour or seconds value + + // set the year + wxDateTime& SetYear(int year); + // set the month + wxDateTime& SetMonth(Month month); + // set the day of the month + wxDateTime& SetDay(wxDateTime_t day); + // set hour + wxDateTime& SetHour(wxDateTime_t hour); + // set minute + wxDateTime& SetMinute(wxDateTime_t minute); + // set second + wxDateTime& SetSecond(wxDateTime_t second); + // set millisecond + wxDateTime& SetMillisecond(wxDateTime_t millisecond); + + // assignment operator from time_t + wxDateTime& operator=(time_t timet) { return Set(timet); } + + // assignment operator from broken down time/date + wxDateTime& operator=(const struct tm& tm) { return Set(tm); } + + // assignment operator from broken down time/date + wxDateTime& operator=(const Tm& tm) { return Set(tm); } + + // default assignment operator is ok + + // calendar calculations (functions which set the date only leave the time + // unchanged, e.g. don't explictly zero it): SetXXX() functions modify the + // object itself, GetXXX() ones return a new object. + // ------------------------------------------------------------------------ + + // set to the given week day in the same week as this one + wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags = Monday_First); + inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags = Monday_First) const; + + // set to the next week day following this one + wxDateTime& SetToNextWeekDay(WeekDay weekday); + inline wxDateTime GetNextWeekDay(WeekDay weekday) const; + + // set to the previous week day before this one + wxDateTime& SetToPrevWeekDay(WeekDay weekday); + inline wxDateTime GetPrevWeekDay(WeekDay weekday) const; + + // set to Nth occurence of given weekday in the given month of the + // given year (time is set to 0), return true on success and false on + // failure. n may be positive (1..5) or negative to count from the end + // of the month (see helper function SetToLastWeekDay()) + bool SetToWeekDay(WeekDay weekday, + int n = 1, + Month month = Inv_Month, + int year = Inv_Year); + inline wxDateTime GetWeekDay(WeekDay weekday, + int n = 1, + Month month = Inv_Month, + int year = Inv_Year) const; + + // sets to the last weekday in the given month, year + inline bool SetToLastWeekDay(WeekDay weekday, + Month month = Inv_Month, + int year = Inv_Year); + inline wxDateTime GetLastWeekDay(WeekDay weekday, + Month month = Inv_Month, + int year = Inv_Year); + +#if WXWIN_COMPATIBILITY_2_6 + // sets the date to the given day of the given week in the year, + // returns true on success and false if given date doesn't exist (e.g. + // numWeek is > 53) + // + // these functions are badly defined as they're not the reverse of + // GetWeekOfYear(), use SetToTheWeekOfYear() instead + wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek, + WeekDay weekday = Mon, + WeekFlags flags = Monday_First) ); + wxDEPRECATED( wxDateTime GetWeek(wxDateTime_t numWeek, + WeekDay weekday = Mon, + WeekFlags flags = Monday_First) const ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // returns the date corresponding to the given week day of the given + // week (in ISO notation) of the specified year + static wxDateTime SetToWeekOfYear(int year, + wxDateTime_t numWeek, + WeekDay weekday = Mon); + + // sets the date to the last day of the given (or current) month or the + // given (or current) year + wxDateTime& SetToLastMonthDay(Month month = Inv_Month, + int year = Inv_Year); + inline wxDateTime GetLastMonthDay(Month month = Inv_Month, + int year = Inv_Year) const; + + // sets to the given year day (1..365 or 366) + wxDateTime& SetToYearDay(wxDateTime_t yday); + inline wxDateTime GetYearDay(wxDateTime_t yday) const; + + // The definitions below were taken verbatim from + // + // http://www.capecod.net/~pbaum/date/date0.htm + // + // (Peter Baum's home page) + // + // definition: The Julian Day Number, Julian Day, or JD of a + // particular instant of time is the number of days and fractions of a + // day since 12 hours Universal Time (Greenwich mean noon) on January + // 1 of the year -4712, where the year is given in the Julian + // proleptic calendar. The idea of using this reference date was + // originally proposed by Joseph Scalizer in 1582 to count years but + // it was modified by 19th century astronomers to count days. One + // could have equivalently defined the reference time to be noon of + // November 24, -4713 if were understood that Gregorian calendar rules + // were applied. Julian days are Julian Day Numbers and are not to be + // confused with Julian dates. + // + // definition: The Rata Die number is a date specified as the number + // of days relative to a base date of December 31 of the year 0. Thus + // January 1 of the year 1 is Rata Die day 1. + + // get the Julian Day number (the fractional part specifies the time of + // the day, related to noon - beware of rounding errors!) + double GetJulianDayNumber() const; + double GetJDN() const { return GetJulianDayNumber(); } + + // get the Modified Julian Day number: it is equal to JDN - 2400000.5 + // and so integral MJDs correspond to the midnights (and not noons). + // MJD 0 is Nov 17, 1858 + double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; } + double GetMJD() const { return GetModifiedJulianDayNumber(); } + + // get the Rata Die number + double GetRataDie() const; + + // TODO algorithms for calculating some important dates, such as + // religious holidays (Easter...) or moon/solar eclipses? Some + // algorithms can be found in the calendar FAQ + + + // Timezone stuff: a wxDateTime object constructed using given + // day/month/year/hour/min/sec values is interpreted as this moment in + // local time. Using the functions below, it may be converted to another + // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()). + // + // These functions try to handle DST internally, but there is no magical + // way to know all rules for it in all countries in the world, so if the + // program can handle it itself (or doesn't want to handle it at all for + // whatever reason), the DST handling can be disabled with noDST. + // ------------------------------------------------------------------------ + + // transform to any given timezone + inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const; + wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false); + + // interpret current value as being in another timezone and transform + // it to local one + inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const; + wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false); + + // transform to/from GMT/UTC + wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); } + wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); } + + wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); } + wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); } + + wxDateTime FromUTC(bool noDST = false) const + { return FromTimezone(UTC, noDST); } + wxDateTime& MakeFromUTC(bool noDST = false) + { return MakeFromTimezone(UTC, noDST); } + + // is daylight savings time in effect at this moment according to the + // rules of the specified country? + // + // Return value is > 0 if DST is in effect, 0 if it is not and -1 if + // the information is not available (this is compatible with ANSI C) + int IsDST(Country country = Country_Default) const; + + + // accessors: many of them take the timezone parameter which indicates the + // timezone for which to make the calculations and the default value means + // to do it for the current timezone of this machine (even if the function + // only operates with the date it's necessary because a date may wrap as + // result of timezone shift) + // ------------------------------------------------------------------------ + + // is the date valid? + inline bool IsValid() const { return m_time != wxInvalidDateTime.m_time; } + + // get the broken down date/time representation in the given timezone + // + // If you wish to get several time components (day, month and year), + // consider getting the whole Tm strcuture first and retrieving the + // value from it - this is much more efficient + Tm GetTm(const TimeZone& tz = Local) const; + + // get the number of seconds since the Unix epoch - returns (time_t)-1 + // if the value is out of range + inline time_t GetTicks() const; + + // get the century, same as GetCentury(GetYear()) + int GetCentury(const TimeZone& tz = Local) const + { return GetCentury(GetYear(tz)); } + // get the year (returns Inv_Year if date is invalid) + int GetYear(const TimeZone& tz = Local) const + { return GetTm(tz).year; } + // get the month (Inv_Month if date is invalid) + Month GetMonth(const TimeZone& tz = Local) const + { return (Month)GetTm(tz).mon; } + // get the month day (in 1..31 range, 0 if date is invalid) + wxDateTime_t GetDay(const TimeZone& tz = Local) const + { return GetTm(tz).mday; } + // get the day of the week (Inv_WeekDay if date is invalid) + WeekDay GetWeekDay(const TimeZone& tz = Local) const + { return GetTm(tz).GetWeekDay(); } + // get the hour of the day + wxDateTime_t GetHour(const TimeZone& tz = Local) const + { return GetTm(tz).hour; } + // get the minute + wxDateTime_t GetMinute(const TimeZone& tz = Local) const + { return GetTm(tz).min; } + // get the second + wxDateTime_t GetSecond(const TimeZone& tz = Local) const + { return GetTm(tz).sec; } + // get milliseconds + wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const + { return GetTm(tz).msec; } + + // get the day since the year start (1..366, 0 if date is invalid) + wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const; + // get the week number since the year start (1..52 or 53, 0 if date is + // invalid) + wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First, + const TimeZone& tz = Local) const; + // get the week number since the month start (1..5, 0 if date is + // invalid) + wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First, + const TimeZone& tz = Local) const; + + // is this date a work day? This depends on a country, of course, + // because the holidays are different in different countries + bool IsWorkDay(Country country = Country_Default) const; + + // is this date later than Gregorian calendar introduction for the + // given country (see enum GregorianAdoption)? + // + // NB: this function shouldn't be considered as absolute authority in + // the matter. Besides, for some countries the exact date of + // adoption of the Gregorian calendar is simply unknown. + bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const; + + // dos date and time format + // ------------------------------------------------------------------------ + + // set from the DOS packed format + wxDateTime& SetFromDOS(unsigned long ddt); + + // pack the date in DOS format + unsigned long GetAsDOS() const; + + // comparison (see also functions below for operator versions) + // ------------------------------------------------------------------------ + + // returns true if the two moments are strictly identical + inline bool IsEqualTo(const wxDateTime& datetime) const; + + // returns true if the date is strictly earlier than the given one + inline bool IsEarlierThan(const wxDateTime& datetime) const; + + // returns true if the date is strictly later than the given one + inline bool IsLaterThan(const wxDateTime& datetime) const; + + // returns true if the date is strictly in the given range + inline bool IsStrictlyBetween(const wxDateTime& t1, + const wxDateTime& t2) const; + + // returns true if the date is in the given range + inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const; + + // do these two objects refer to the same date? + inline bool IsSameDate(const wxDateTime& dt) const; + + // do these two objects have the same time? + inline bool IsSameTime(const wxDateTime& dt) const; + + // are these two objects equal up to given timespan? + inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const; + + inline bool operator<(const wxDateTime& dt) const + { + wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); + return GetValue() < dt.GetValue(); + } + + inline bool operator<=(const wxDateTime& dt) const + { + wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); + return GetValue() <= dt.GetValue(); + } + + inline bool operator>(const wxDateTime& dt) const + { + wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); + return GetValue() > dt.GetValue(); + } + + inline bool operator>=(const wxDateTime& dt) const + { + wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); + return GetValue() >= dt.GetValue(); + } + + inline bool operator==(const wxDateTime& dt) const + { + wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); + return GetValue() == dt.GetValue(); + } + + inline bool operator!=(const wxDateTime& dt) const + { + wxASSERT_MSG( IsValid() && dt.IsValid(), _T("invalid wxDateTime") ); + return GetValue() != dt.GetValue(); + } + + // arithmetics with dates (see also below for more operators) + // ------------------------------------------------------------------------ + + // return the sum of the date with a time span (positive or negative) + inline wxDateTime Add(const wxTimeSpan& diff) const; + // add a time span (positive or negative) + inline wxDateTime& Add(const wxTimeSpan& diff); + // add a time span (positive or negative) + inline wxDateTime& operator+=(const wxTimeSpan& diff); + inline wxDateTime operator+(const wxTimeSpan& ts) const + { + wxDateTime dt(*this); + dt.Add(ts); + return dt; + } + + // return the difference of the date with a time span + inline wxDateTime Subtract(const wxTimeSpan& diff) const; + // subtract a time span (positive or negative) + inline wxDateTime& Subtract(const wxTimeSpan& diff); + // subtract a time span (positive or negative) + inline wxDateTime& operator-=(const wxTimeSpan& diff); + inline wxDateTime operator-(const wxTimeSpan& ts) const + { + wxDateTime dt(*this); + dt.Subtract(ts); + return dt; + } + + // return the sum of the date with a date span + inline wxDateTime Add(const wxDateSpan& diff) const; + // add a date span (positive or negative) + wxDateTime& Add(const wxDateSpan& diff); + // add a date span (positive or negative) + inline wxDateTime& operator+=(const wxDateSpan& diff); + inline wxDateTime operator+(const wxDateSpan& ds) const + { + wxDateTime dt(*this); + dt.Add(ds); + return dt; + } + + // return the difference of the date with a date span + inline wxDateTime Subtract(const wxDateSpan& diff) const; + // subtract a date span (positive or negative) + inline wxDateTime& Subtract(const wxDateSpan& diff); + // subtract a date span (positive or negative) + inline wxDateTime& operator-=(const wxDateSpan& diff); + inline wxDateTime operator-(const wxDateSpan& ds) const + { + wxDateTime dt(*this); + dt.Subtract(ds); + return dt; + } + + // return the difference between two dates + inline wxTimeSpan Subtract(const wxDateTime& dt) const; + inline wxTimeSpan operator-(const wxDateTime& dt2) const; + + // conversion to/from text: all conversions from text return the pointer to + // the next character following the date specification (i.e. the one where + // the scan had to stop) or NULL on failure. + // ------------------------------------------------------------------------ + + // parse a string in RFC 822 format (found e.g. in mail headers and + // having the form "Wed, 10 Feb 1999 19:07:07 +0100") + const wxChar *ParseRfc822Date(const wxChar* date); + // parse a date/time in the given format (see strptime(3)), fill in + // the missing (in the string) fields with the values of dateDef (by + // default, they will not change if they had valid values or will + // default to Today() otherwise) + const wxChar *ParseFormat(const wxChar *date, + const wxChar *format = wxDefaultDateTimeFormat, + const wxDateTime& dateDef = wxDefaultDateTime); + // parse a string containing the date/time in "free" format, this + // function will try to make an educated guess at the string contents + const wxChar *ParseDateTime(const wxChar *datetime); + // parse a string containing the date only in "free" format (less + // flexible than ParseDateTime) + const wxChar *ParseDate(const wxChar *date); + // parse a string containing the time only in "free" format + const wxChar *ParseTime(const wxChar *time); + + // this function accepts strftime()-like format string (default + // argument corresponds to the preferred date and time representation + // for the current locale) and returns the string containing the + // resulting text representation + wxString Format(const wxChar *format = wxDefaultDateTimeFormat, + const TimeZone& tz = Local) const; + // preferred date representation for the current locale + wxString FormatDate() const { return Format(_T("%x")); } + // preferred time representation for the current locale + wxString FormatTime() const { return Format(_T("%X")); } + // returns the string representing the date in ISO 8601 format + // (YYYY-MM-DD) + wxString FormatISODate() const { return Format(_T("%Y-%m-%d")); } + // returns the string representing the time in ISO 8601 format + // (HH:MM:SS) + wxString FormatISOTime() const { return Format(_T("%H:%M:%S")); } + + // implementation + // ------------------------------------------------------------------------ + + // construct from internal representation + wxDateTime(const wxLongLong& time) { m_time = time; } + + // get the internal representation + inline wxLongLong GetValue() const; + + // a helper function to get the current time_t + static time_t GetTimeNow() { return time((time_t *)NULL); } + + // another one to get the current time broken down + static struct tm *GetTmNow() + { +#ifdef __WXWINCE__ + static struct tm l_CurrentTime; + return GetTmNow(&l_CurrentTime); +#else + time_t t = GetTimeNow(); + return localtime(&t); +#endif + } + + // get current time using thread-safe function + static struct tm *GetTmNow(struct tm *tmstruct); + +private: + // the current country - as it's the same for all program objects (unless + // it runs on a _really_ big cluster system :-), this is a static member: + // see SetCountry() and GetCountry() + static Country ms_country; + + // this constant is used to transform a time_t value to the internal + // representation, as time_t is in seconds and we use milliseconds it's + // fixed to 1000 + static const long TIME_T_FACTOR; + + // returns true if we fall in range in which we can use standard ANSI C + // functions + inline bool IsInStdRange() const; + + // the internal representation of the time is the amount of milliseconds + // elapsed since the origin which is set by convention to the UNIX/C epoch + // value: the midnight of January 1, 1970 (UTC) + wxLongLong m_time; +}; + +// ---------------------------------------------------------------------------- +// This class contains a difference between 2 wxDateTime values, so it makes +// sense to add it to wxDateTime and it is the result of subtraction of 2 +// objects of that class. See also wxDateSpan. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTimeSpan +{ +public: + // constructors + // ------------------------------------------------------------------------ + + // return the timespan for the given number of milliseconds + static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); } + static wxTimeSpan Millisecond() { return Milliseconds(1); } + + // return the timespan for the given number of seconds + static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); } + static wxTimeSpan Second() { return Seconds(1); } + + // return the timespan for the given number of minutes + static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); } + static wxTimeSpan Minute() { return Minutes(1); } + + // return the timespan for the given number of hours + static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); } + static wxTimeSpan Hour() { return Hours(1); } + + // return the timespan for the given number of days + static wxTimeSpan Days(long days) { return Hours(24 * days); } + static wxTimeSpan Day() { return Days(1); } + + // return the timespan for the given number of weeks + static wxTimeSpan Weeks(long days) { return Days(7 * days); } + static wxTimeSpan Week() { return Weeks(1); } + + // default ctor constructs the 0 time span + wxTimeSpan() { } + + // from separate values for each component, date set to 0 (hours are + // not restricted to 0..24 range, neither are minutes, seconds or + // milliseconds) + inline wxTimeSpan(long hours, + long minutes = 0, + wxLongLong seconds = 0, + wxLongLong milliseconds = 0); + + // default copy ctor is ok + + // no dtor + + // arithmetics with time spans (see also below for more operators) + // ------------------------------------------------------------------------ + + // return the sum of two timespans + inline wxTimeSpan Add(const wxTimeSpan& diff) const; + // add two timespans together + inline wxTimeSpan& Add(const wxTimeSpan& diff); + // add two timespans together + wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); } + inline wxTimeSpan operator+(const wxTimeSpan& ts) const + { + return wxTimeSpan(GetValue() + ts.GetValue()); + } + + // return the difference of two timespans + inline wxTimeSpan Subtract(const wxTimeSpan& diff) const; + // subtract another timespan + inline wxTimeSpan& Subtract(const wxTimeSpan& diff); + // subtract another timespan + wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); } + inline wxTimeSpan operator-(const wxTimeSpan& ts) + { + return wxTimeSpan(GetValue() - ts.GetValue()); + } + + // multiply timespan by a scalar + inline wxTimeSpan Multiply(int n) const; + // multiply timespan by a scalar + inline wxTimeSpan& Multiply(int n); + // multiply timespan by a scalar + wxTimeSpan& operator*=(int n) { return Multiply(n); } + inline wxTimeSpan operator*(int n) const + { + return wxTimeSpan(*this).Multiply(n); + } + + // return this timespan with opposite sign + wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); } + // negate the value of the timespan + wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; } + // negate the value of the timespan + wxTimeSpan& operator-() { return Neg(); } + + // return the absolute value of the timespan: does _not_ modify the + // object + inline wxTimeSpan Abs() const; + + // there is intentionally no division because we don't want to + // introduce rounding errors in time calculations + + // comparaison (see also operator versions below) + // ------------------------------------------------------------------------ + + // is the timespan null? + bool IsNull() const { return m_diff == 0l; } + // returns true if the timespan is null + bool operator!() const { return !IsNull(); } + + // is the timespan positive? + bool IsPositive() const { return m_diff > 0l; } + + // is the timespan negative? + bool IsNegative() const { return m_diff < 0l; } + + // are two timespans equal? + inline bool IsEqualTo(const wxTimeSpan& ts) const; + // compare two timestamps: works with the absolute values, i.e. -2 + // hours is longer than 1 hour. Also, it will return false if the + // timespans are equal in absolute value. + inline bool IsLongerThan(const wxTimeSpan& ts) const; + // compare two timestamps: works with the absolute values, i.e. 1 + // hour is shorter than -2 hours. Also, it will return false if the + // timespans are equal in absolute value. + bool IsShorterThan(const wxTimeSpan& t) const { return !IsLongerThan(t); } + + inline bool operator<(const wxTimeSpan &ts) const + { + return GetValue() < ts.GetValue(); + } + + inline bool operator<=(const wxTimeSpan &ts) const + { + return GetValue() <= ts.GetValue(); + } + + inline bool operator>(const wxTimeSpan &ts) const + { + return GetValue() > ts.GetValue(); + } + + inline bool operator>=(const wxTimeSpan &ts) const + { + return GetValue() >= ts.GetValue(); + } + + inline bool operator==(const wxTimeSpan &ts) const + { + return GetValue() == ts.GetValue(); + } + + inline bool operator!=(const wxTimeSpan &ts) const + { + return GetValue() != ts.GetValue(); + } + + // breaking into days, hours, minutes and seconds + // ------------------------------------------------------------------------ + + // get the max number of weeks in this timespan + inline int GetWeeks() const; + // get the max number of days in this timespan + inline int GetDays() const; + // get the max number of hours in this timespan + inline int GetHours() const; + // get the max number of minutes in this timespan + inline int GetMinutes() const; + // get the max number of seconds in this timespan + inline wxLongLong GetSeconds() const; + // get the number of milliseconds in this timespan + wxLongLong GetMilliseconds() const { return m_diff; } + + // conversion to text + // ------------------------------------------------------------------------ + + // this function accepts strftime()-like format string (default + // argument corresponds to the preferred date and time representation + // for the current locale) and returns the string containing the + // resulting text representation. Notice that only some of format + // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, + // minutes and seconds make sense, but not "PM/AM" string for example. + wxString Format(const wxChar *format = wxDefaultTimeSpanFormat) const; + + // implementation + // ------------------------------------------------------------------------ + + // construct from internal representation + wxTimeSpan(const wxLongLong& diff) { m_diff = diff; } + + // get the internal representation + wxLongLong GetValue() const { return m_diff; } + +private: + // the (signed) time span in milliseconds + wxLongLong m_diff; +}; + +// ---------------------------------------------------------------------------- +// This class is a "logical time span" and is useful for implementing program +// logic for such things as "add one month to the date" which, in general, +// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date +// the next month (to understand that this is indeed different consider adding +// one month to Feb, 15 - we want to get Mar, 15, of course). +// +// When adding a month to the date, all lesser components (days, hours, ...) +// won't be changed unless the resulting date would be invalid: for example, +// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31. +// +// Because of this feature, adding and subtracting back again the same +// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1 +// month will be Jan 28, not Jan 31! +// +// wxDateSpan can be either positive or negative. They may be +// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1 +// month and 1 day) is 2 months and 2 days. They can be added together and +// with wxDateTime or wxTimeSpan, but the type of result is different for each +// case. +// +// Beware about weeks: if you specify both weeks and days, the total number of +// days added will be 7*weeks + days! See also GetTotalDays() function. +// +// Equality operators are defined for wxDateSpans. Two datespans are equal if +// they both give the same target date when added to *every* source date. +// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because +// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is +// equal to wxDateSpan::Weeks(2) +// +// Finally, notice that for adding hours, minutes &c you don't need this +// class: wxTimeSpan will do the job because there are no subtleties +// associated with those. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDateSpan +{ +public: + // constructors + // ------------------------------------------------------------------------ + + // this many years/months/weeks/days + wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0) + { + m_years = years; + m_months = months; + m_weeks = weeks; + m_days = days; + } + + // get an object for the given number of days + static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); } + static wxDateSpan Day() { return Days(1); } + + // get an object for the given number of weeks + static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); } + static wxDateSpan Week() { return Weeks(1); } + + // get an object for the given number of months + static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); } + static wxDateSpan Month() { return Months(1); } + + // get an object for the given number of years + static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); } + static wxDateSpan Year() { return Years(1); } + + // default copy ctor is ok + + // no dtor + + // accessors (all SetXXX() return the (modified) wxDateSpan object) + // ------------------------------------------------------------------------ + + // set number of years + wxDateSpan& SetYears(int n) { m_years = n; return *this; } + // set number of months + wxDateSpan& SetMonths(int n) { m_months = n; return *this; } + // set number of weeks + wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; } + // set number of days + wxDateSpan& SetDays(int n) { m_days = n; return *this; } + + // get number of years + int GetYears() const { return m_years; } + // get number of months + int GetMonths() const { return m_months; } + // get number of weeks + int GetWeeks() const { return m_weeks; } + // get number of days + int GetDays() const { return m_days; } + // returns 7*GetWeeks() + GetDays() + int GetTotalDays() const { return 7*m_weeks + m_days; } + + // arithmetics with date spans (see also below for more operators) + // ------------------------------------------------------------------------ + + // return sum of two date spans + inline wxDateSpan Add(const wxDateSpan& other) const; + // add another wxDateSpan to us + inline wxDateSpan& Add(const wxDateSpan& other); + // add another wxDateSpan to us + inline wxDateSpan& operator+=(const wxDateSpan& other); + inline wxDateSpan operator+(const wxDateSpan& ds) const + { + return wxDateSpan(GetYears() + ds.GetYears(), + GetMonths() + ds.GetMonths(), + GetWeeks() + ds.GetWeeks(), + GetDays() + ds.GetDays()); + } + + // return difference of two date spans + inline wxDateSpan Subtract(const wxDateSpan& other) const; + // subtract another wxDateSpan from us + inline wxDateSpan& Subtract(const wxDateSpan& other); + // subtract another wxDateSpan from us + inline wxDateSpan& operator-=(const wxDateSpan& other); + inline wxDateSpan operator-(const wxDateSpan& ds) const + { + return wxDateSpan(GetYears() - ds.GetYears(), + GetMonths() - ds.GetMonths(), + GetWeeks() - ds.GetWeeks(), + GetDays() - ds.GetDays()); + } + + // return a copy of this time span with changed sign + inline wxDateSpan Negate() const; + // inverse the sign of this timespan + inline wxDateSpan& Neg(); + // inverse the sign of this timespan + wxDateSpan& operator-() { return Neg(); } + + // return the date span proportional to this one with given factor + inline wxDateSpan Multiply(int factor) const; + // multiply all components by a (signed) number + inline wxDateSpan& Multiply(int factor); + // multiply all components by a (signed) number + inline wxDateSpan& operator*=(int factor) { return Multiply(factor); } + inline wxDateSpan operator*(int n) const + { + return wxDateSpan(*this).Multiply(n); + } + + // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 + inline bool operator==(const wxDateSpan& ds) const + { + return GetYears() == ds.GetYears() && + GetMonths() == ds.GetMonths() && + GetTotalDays() == ds.GetTotalDays(); + } + + inline bool operator!=(const wxDateSpan& ds) const + { + return !(*this == ds); + } + +private: + int m_years, + m_months, + m_weeks, + m_days; +}; + +// ---------------------------------------------------------------------------- +// wxDateTimeArray: array of dates. +// ---------------------------------------------------------------------------- + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// wxDateTimeHolidayAuthority: an object of this class will decide whether a +// given date is a holiday and is used by all functions working with "work +// days". +// +// NB: the base class is an ABC, derived classes must implement the pure +// virtual methods to work with the holidays they correspond to. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority; +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *, + wxHolidayAuthoritiesArray, + class WXDLLIMPEXP_BASE); + +class wxDateTimeHolidaysModule; +class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority +{ +friend class wxDateTimeHolidaysModule; +public: + // returns true if the given date is a holiday + static bool IsHoliday(const wxDateTime& dt); + + // fills the provided array with all holidays in the given range, returns + // the number of them + static size_t GetHolidaysInRange(const wxDateTime& dtStart, + const wxDateTime& dtEnd, + wxDateTimeArray& holidays); + + // clear the list of holiday authorities + static void ClearAllAuthorities(); + + // add a new holiday authority (the pointer will be deleted by + // wxDateTimeHolidayAuthority) + static void AddAuthority(wxDateTimeHolidayAuthority *auth); + + // the base class must have a virtual dtor + virtual ~wxDateTimeHolidayAuthority(); + +protected: + // this function is called to determine whether a given day is a holiday + virtual bool DoIsHoliday(const wxDateTime& dt) const = 0; + + // this function should fill the array with all holidays between the two + // given dates - it is implemented in the base class, but in a very + // inefficient way (it just iterates over all days and uses IsHoliday() for + // each of them), so it must be overridden in the derived class where the + // base class version may be explicitly used if needed + // + // returns the number of holidays in the given range and fills holidays + // array + virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, + const wxDateTime& dtEnd, + wxDateTimeArray& holidays) const = 0; + +private: + // all holiday authorities + static wxHolidayAuthoritiesArray ms_authorities; +}; + +// the holidays for this class are all Saturdays and Sundays +class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority +{ +protected: + virtual bool DoIsHoliday(const wxDateTime& dt) const; + virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, + const wxDateTime& dtEnd, + wxDateTimeArray& holidays) const; +}; + +// ============================================================================ +// inline functions implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// private macros +// ---------------------------------------------------------------------------- + +#define MILLISECONDS_PER_DAY 86400000l + +// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but +// using a temp variable always might prevent other compilers from optimising +// it away - hence use of this ugly macro +#ifndef __HPUX__ + #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op +#else + #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt +#endif + +// ---------------------------------------------------------------------------- +// wxDateTime construction +// ---------------------------------------------------------------------------- + +inline bool wxDateTime::IsInStdRange() const +{ + return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; +} + +/* static */ +inline wxDateTime wxDateTime::Now() +{ + struct tm tmstruct; + return wxDateTime(*GetTmNow(&tmstruct)); +} + +/* static */ +inline wxDateTime wxDateTime::Today() +{ + wxDateTime dt(Now()); + dt.ResetTime(); + + return dt; +} + +#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) +inline wxDateTime& wxDateTime::Set(time_t timet) +{ + // assign first to avoid long multiplication overflow! + m_time = timet - WX_TIME_BASE_OFFSET ; + m_time *= TIME_T_FACTOR; + + return *this; +} +#endif + +inline wxDateTime& wxDateTime::SetToCurrent() +{ + *this = Now(); + return *this; +} + +#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) +inline wxDateTime::wxDateTime(time_t timet) +{ + Set(timet); +} +#endif + +inline wxDateTime::wxDateTime(const struct tm& tm) +{ + Set(tm); +} + +inline wxDateTime::wxDateTime(const Tm& tm) +{ + Set(tm); +} + +inline wxDateTime::wxDateTime(double jdn) +{ + Set(jdn); +} + +inline wxDateTime& wxDateTime::Set(const Tm& tm) +{ + wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") ); + + return Set(tm.mday, (Month)tm.mon, tm.year, + tm.hour, tm.min, tm.sec, tm.msec); +} + +inline wxDateTime::wxDateTime(wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) +{ + Set(hour, minute, second, millisec); +} + +inline wxDateTime::wxDateTime(wxDateTime_t day, + Month month, + int year, + wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) +{ + Set(day, month, year, hour, minute, second, millisec); +} + +// ---------------------------------------------------------------------------- +// wxDateTime accessors +// ---------------------------------------------------------------------------- + +inline wxLongLong wxDateTime::GetValue() const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + return m_time; +} + +inline time_t wxDateTime::GetTicks() const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + if ( !IsInStdRange() ) + { + return (time_t)-1; + } + + return (time_t)((m_time / (long)TIME_T_FACTOR).ToLong()) + WX_TIME_BASE_OFFSET; +} + +inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, + Month month, + int year) +{ + return SetToWeekDay(weekday, -1, month, year); +} + +inline wxDateTime +wxDateTime::GetWeekDayInSameWeek(WeekDay weekday, + WeekFlags WXUNUSED(flags)) const +{ + MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); +} + +inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const +{ + MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); +} + +inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const +{ + MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); +} + +inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, + int n, + Month month, + int year) const +{ + wxDateTime dt(*this); + + return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, + Month month, + int year) +{ + wxDateTime dt(*this); + + return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const +{ + MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); +} + +inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const +{ + MODIFY_AND_RETURN( SetToYearDay(yday) ); +} + +// ---------------------------------------------------------------------------- +// wxDateTime comparison +// ---------------------------------------------------------------------------- + +inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return m_time == datetime.m_time; +} + +inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return m_time < datetime.m_time; +} + +inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return m_time > datetime.m_time; +} + +inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, + const wxDateTime& t2) const +{ + // no need for assert, will be checked by the functions we call + return IsLaterThan(t1) && IsEarlierThan(t2); +} + +inline bool wxDateTime::IsBetween(const wxDateTime& t1, + const wxDateTime& t2) const +{ + // no need for assert, will be checked by the functions we call + return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); +} + +inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const +{ + Tm tm1 = GetTm(), + tm2 = dt.GetTm(); + + return tm1.year == tm2.year && + tm1.mon == tm2.mon && + tm1.mday == tm2.mday; +} + +inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const +{ + // notice that we can't do something like this: + // + // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY + // + // because we have also to deal with (possibly) different DST settings! + Tm tm1 = GetTm(), + tm2 = dt.GetTm(); + + return tm1.hour == tm2.hour && + tm1.min == tm2.min && + tm1.sec == tm2.sec && + tm1.msec == tm2.msec; +} + +inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, + const wxTimeSpan& ts) const +{ + return IsBetween(dt.Subtract(ts), dt.Add(ts)); +} + +// ---------------------------------------------------------------------------- +// wxDateTime arithmetics +// ---------------------------------------------------------------------------- + +inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + return wxDateTime(m_time + diff.GetValue()); +} + +inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + m_time += diff.GetValue(); + + return *this; +} + +inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) +{ + return Add(diff); +} + +inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + return wxDateTime(m_time - diff.GetValue()); +} + +inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + m_time -= diff.GetValue(); + + return *this; +} + +inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) +{ + return Subtract(diff); +} + +inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return wxTimeSpan(GetValue() - datetime.GetValue()); +} + +inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const +{ + return this->Subtract(dt2); +} + +inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const +{ + return wxDateTime(*this).Add(diff); +} + +inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) +{ + return Add(diff.Negate()); +} + +inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const +{ + return wxDateTime(*this).Subtract(diff); +} + +inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) +{ + return Subtract(diff); +} + +inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) +{ + return Add(diff); +} + +// ---------------------------------------------------------------------------- +// wxDateTime and timezones +// ---------------------------------------------------------------------------- + +inline wxDateTime +wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const +{ + MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); +} + +inline wxDateTime +wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const +{ + MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) ); +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan construction +// ---------------------------------------------------------------------------- + +inline wxTimeSpan::wxTimeSpan(long hours, + long minutes, + wxLongLong seconds, + wxLongLong milliseconds) +{ + // assign first to avoid precision loss + m_diff = hours; + m_diff *= 60l; + m_diff += minutes; + m_diff *= 60l; + m_diff += seconds; + m_diff *= 1000l; + m_diff += milliseconds; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan accessors +// ---------------------------------------------------------------------------- + +inline wxLongLong wxTimeSpan::GetSeconds() const +{ + return m_diff / 1000l; +} + +inline int wxTimeSpan::GetMinutes() const +{ + // explicit cast to int suppresses a warning with CodeWarrior and possibly + // others (changing the return type to long from int is impossible in 2.8) + return (int)((GetSeconds() / 60l).GetLo()); +} + +inline int wxTimeSpan::GetHours() const +{ + return GetMinutes() / 60; +} + +inline int wxTimeSpan::GetDays() const +{ + return GetHours() / 24; +} + +inline int wxTimeSpan::GetWeeks() const +{ + return GetDays() / 7; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan arithmetics +// ---------------------------------------------------------------------------- + +inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const +{ + return wxTimeSpan(m_diff + diff.GetValue()); +} + +inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) +{ + m_diff += diff.GetValue(); + + return *this; +} + +inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const +{ + return wxTimeSpan(m_diff - diff.GetValue()); +} + +inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) +{ + m_diff -= diff.GetValue(); + + return *this; +} + +inline wxTimeSpan& wxTimeSpan::Multiply(int n) +{ + m_diff *= (long)n; + + return *this; +} + +inline wxTimeSpan wxTimeSpan::Multiply(int n) const +{ + return wxTimeSpan(m_diff * (long)n); +} + +inline wxTimeSpan wxTimeSpan::Abs() const +{ + return wxTimeSpan(GetValue().Abs()); +} + +inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const +{ + return GetValue() == ts.GetValue(); +} + +inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const +{ + return GetValue().Abs() > ts.GetValue().Abs(); +} + +// ---------------------------------------------------------------------------- +// wxDateSpan +// ---------------------------------------------------------------------------- + +inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) +{ + m_years += other.m_years; + m_months += other.m_months; + m_weeks += other.m_weeks; + m_days += other.m_days; + + return *this; +} + +inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) +{ + return *this += other; +} + +inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Add(other); + return ds; +} + +inline wxDateSpan& wxDateSpan::Multiply(int factor) +{ + m_years *= factor; + m_months *= factor; + m_weeks *= factor; + m_days *= factor; + + return *this; +} + +inline wxDateSpan wxDateSpan::Multiply(int factor) const +{ + wxDateSpan ds(*this); + ds.Multiply(factor); + return ds; +} + +inline wxDateSpan wxDateSpan::Negate() const +{ + return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); +} + +inline wxDateSpan& wxDateSpan::Neg() +{ + m_years = -m_years; + m_months = -m_months; + m_weeks = -m_weeks; + m_days = -m_days; + + return *this; +} + +inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) +{ + return *this += other.Negate(); +} + +inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) +{ + return *this -= other; +} + +inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Subtract(other); + return ds; +} + +#undef MILLISECONDS_PER_DAY + +#undef MODIFY_AND_RETURN + +// ============================================================================ +// binary operators +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTimeSpan operators +// ---------------------------------------------------------------------------- + +wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts); + +// ---------------------------------------------------------------------------- +// wxDateSpan +// ---------------------------------------------------------------------------- + +wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds); + +// ============================================================================ +// other helper functions +// ============================================================================ + +// ---------------------------------------------------------------------------- +// iteration helpers: can be used to write a for loop over enum variable like +// this: +// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) +// ---------------------------------------------------------------------------- + +WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m); +WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m); +WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd); +WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd); + +#endif // wxUSE_DATETIME + +#endif // _WX_DATETIME_H diff --git a/Externals/wxWidgets/include/wx/datstrm.h b/Externals/wxWidgets/include/wx/datstrm.h index b6d00e43e5..709e1007ba 100644 --- a/Externals/wxWidgets/include/wx/datstrm.h +++ b/Externals/wxWidgets/include/wx/datstrm.h @@ -1,170 +1,170 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: datstrm.h -// Purpose: Data stream classes -// Author: Guilhem Lavaux -// Modified by: Mickael Gilabert -// Created: 28/06/1998 -// RCS-ID: $Id: datstrm.h 38576 2006-04-05 16:10:08Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATSTREAM_H_ -#define _WX_DATSTREAM_H_ - -#include "wx/stream.h" -#include "wx/longlong.h" -#include "wx/convauto.h" - -#if wxUSE_STREAMS - -class WXDLLIMPEXP_BASE wxDataInputStream -{ -public: -#if wxUSE_UNICODE - wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto()); -#else - wxDataInputStream(wxInputStream& s); -#endif - ~wxDataInputStream(); - - bool IsOk() { return m_input->IsOk(); } - -#if wxHAS_INT64 - wxUint64 Read64(); -#endif -#if wxUSE_LONGLONG - wxLongLong ReadLL(); -#endif - wxUint32 Read32(); - wxUint16 Read16(); - wxUint8 Read8(); - double ReadDouble(); - wxString ReadString(); - -#if wxHAS_INT64 - void Read64(wxUint64 *buffer, size_t size); - void Read64(wxInt64 *buffer, size_t size); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - void Read64(wxULongLong *buffer, size_t size); - void Read64(wxLongLong *buffer, size_t size); -#endif -#if wxUSE_LONGLONG - void ReadLL(wxULongLong *buffer, size_t size); - void ReadLL(wxLongLong *buffer, size_t size); -#endif - void Read32(wxUint32 *buffer, size_t size); - void Read16(wxUint16 *buffer, size_t size); - void Read8(wxUint8 *buffer, size_t size); - void ReadDouble(double *buffer, size_t size); - - wxDataInputStream& operator>>(wxString& s); - wxDataInputStream& operator>>(wxInt8& c); - wxDataInputStream& operator>>(wxInt16& i); - wxDataInputStream& operator>>(wxInt32& i); - wxDataInputStream& operator>>(wxUint8& c); - wxDataInputStream& operator>>(wxUint16& i); - wxDataInputStream& operator>>(wxUint32& i); -#if wxHAS_INT64 - wxDataInputStream& operator>>(wxUint64& i); - wxDataInputStream& operator>>(wxInt64& i); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - wxDataInputStream& operator>>(wxULongLong& i); - wxDataInputStream& operator>>(wxLongLong& i); -#endif - wxDataInputStream& operator>>(double& i); - wxDataInputStream& operator>>(float& f); - - void BigEndianOrdered(bool be_order) { m_be_order = be_order; } - -protected: - wxInputStream *m_input; - bool m_be_order; -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxDataInputStream) -}; - -class WXDLLIMPEXP_BASE wxDataOutputStream -{ -public: -#if wxUSE_UNICODE - wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto()); -#else - wxDataOutputStream(wxOutputStream& s); -#endif - ~wxDataOutputStream(); - - bool IsOk() { return m_output->IsOk(); } - -#if wxHAS_INT64 - void Write64(wxUint64 i); - void Write64(wxInt64 i); -#endif -#if wxUSE_LONGLONG - void WriteLL(const wxLongLong &ll); - void WriteLL(const wxULongLong &ll); -#endif - void Write32(wxUint32 i); - void Write16(wxUint16 i); - void Write8(wxUint8 i); - void WriteDouble(double d); - void WriteString(const wxString& string); - -#if wxHAS_INT64 - void Write64(const wxUint64 *buffer, size_t size); - void Write64(const wxInt64 *buffer, size_t size); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - void Write64(const wxULongLong *buffer, size_t size); - void Write64(const wxLongLong *buffer, size_t size); -#endif -#if wxUSE_LONGLONG - void WriteLL(const wxULongLong *buffer, size_t size); - void WriteLL(const wxLongLong *buffer, size_t size); -#endif - void Write32(const wxUint32 *buffer, size_t size); - void Write16(const wxUint16 *buffer, size_t size); - void Write8(const wxUint8 *buffer, size_t size); - void WriteDouble(const double *buffer, size_t size); - - wxDataOutputStream& operator<<(const wxChar *string); - wxDataOutputStream& operator<<(const wxString& string); - wxDataOutputStream& operator<<(wxInt8 c); - wxDataOutputStream& operator<<(wxInt16 i); - wxDataOutputStream& operator<<(wxInt32 i); - wxDataOutputStream& operator<<(wxUint8 c); - wxDataOutputStream& operator<<(wxUint16 i); - wxDataOutputStream& operator<<(wxUint32 i); -#if wxHAS_INT64 - wxDataOutputStream& operator<<(wxUint64 i); - wxDataOutputStream& operator<<(wxInt64 i); -#endif -#if defined(wxLongLong_t) && wxUSE_LONGLONG - wxDataOutputStream& operator<<(const wxULongLong &i); - wxDataOutputStream& operator<<(const wxLongLong &i); -#endif - wxDataOutputStream& operator<<(double f); - wxDataOutputStream& operator<<(float f); - - void BigEndianOrdered(bool be_order) { m_be_order = be_order; } - -protected: - wxOutputStream *m_output; - bool m_be_order; -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxDataOutputStream) -}; - -#endif - // wxUSE_STREAMS - -#endif - // _WX_DATSTREAM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: datstrm.h +// Purpose: Data stream classes +// Author: Guilhem Lavaux +// Modified by: Mickael Gilabert +// Created: 28/06/1998 +// RCS-ID: $Id: datstrm.h 38576 2006-04-05 16:10:08Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATSTREAM_H_ +#define _WX_DATSTREAM_H_ + +#include "wx/stream.h" +#include "wx/longlong.h" +#include "wx/convauto.h" + +#if wxUSE_STREAMS + +class WXDLLIMPEXP_BASE wxDataInputStream +{ +public: +#if wxUSE_UNICODE + wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto()); +#else + wxDataInputStream(wxInputStream& s); +#endif + ~wxDataInputStream(); + + bool IsOk() { return m_input->IsOk(); } + +#if wxHAS_INT64 + wxUint64 Read64(); +#endif +#if wxUSE_LONGLONG + wxLongLong ReadLL(); +#endif + wxUint32 Read32(); + wxUint16 Read16(); + wxUint8 Read8(); + double ReadDouble(); + wxString ReadString(); + +#if wxHAS_INT64 + void Read64(wxUint64 *buffer, size_t size); + void Read64(wxInt64 *buffer, size_t size); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + void Read64(wxULongLong *buffer, size_t size); + void Read64(wxLongLong *buffer, size_t size); +#endif +#if wxUSE_LONGLONG + void ReadLL(wxULongLong *buffer, size_t size); + void ReadLL(wxLongLong *buffer, size_t size); +#endif + void Read32(wxUint32 *buffer, size_t size); + void Read16(wxUint16 *buffer, size_t size); + void Read8(wxUint8 *buffer, size_t size); + void ReadDouble(double *buffer, size_t size); + + wxDataInputStream& operator>>(wxString& s); + wxDataInputStream& operator>>(wxInt8& c); + wxDataInputStream& operator>>(wxInt16& i); + wxDataInputStream& operator>>(wxInt32& i); + wxDataInputStream& operator>>(wxUint8& c); + wxDataInputStream& operator>>(wxUint16& i); + wxDataInputStream& operator>>(wxUint32& i); +#if wxHAS_INT64 + wxDataInputStream& operator>>(wxUint64& i); + wxDataInputStream& operator>>(wxInt64& i); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + wxDataInputStream& operator>>(wxULongLong& i); + wxDataInputStream& operator>>(wxLongLong& i); +#endif + wxDataInputStream& operator>>(double& i); + wxDataInputStream& operator>>(float& f); + + void BigEndianOrdered(bool be_order) { m_be_order = be_order; } + +protected: + wxInputStream *m_input; + bool m_be_order; +#if wxUSE_UNICODE + wxMBConv *m_conv; +#endif + + DECLARE_NO_COPY_CLASS(wxDataInputStream) +}; + +class WXDLLIMPEXP_BASE wxDataOutputStream +{ +public: +#if wxUSE_UNICODE + wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto()); +#else + wxDataOutputStream(wxOutputStream& s); +#endif + ~wxDataOutputStream(); + + bool IsOk() { return m_output->IsOk(); } + +#if wxHAS_INT64 + void Write64(wxUint64 i); + void Write64(wxInt64 i); +#endif +#if wxUSE_LONGLONG + void WriteLL(const wxLongLong &ll); + void WriteLL(const wxULongLong &ll); +#endif + void Write32(wxUint32 i); + void Write16(wxUint16 i); + void Write8(wxUint8 i); + void WriteDouble(double d); + void WriteString(const wxString& string); + +#if wxHAS_INT64 + void Write64(const wxUint64 *buffer, size_t size); + void Write64(const wxInt64 *buffer, size_t size); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + void Write64(const wxULongLong *buffer, size_t size); + void Write64(const wxLongLong *buffer, size_t size); +#endif +#if wxUSE_LONGLONG + void WriteLL(const wxULongLong *buffer, size_t size); + void WriteLL(const wxLongLong *buffer, size_t size); +#endif + void Write32(const wxUint32 *buffer, size_t size); + void Write16(const wxUint16 *buffer, size_t size); + void Write8(const wxUint8 *buffer, size_t size); + void WriteDouble(const double *buffer, size_t size); + + wxDataOutputStream& operator<<(const wxChar *string); + wxDataOutputStream& operator<<(const wxString& string); + wxDataOutputStream& operator<<(wxInt8 c); + wxDataOutputStream& operator<<(wxInt16 i); + wxDataOutputStream& operator<<(wxInt32 i); + wxDataOutputStream& operator<<(wxUint8 c); + wxDataOutputStream& operator<<(wxUint16 i); + wxDataOutputStream& operator<<(wxUint32 i); +#if wxHAS_INT64 + wxDataOutputStream& operator<<(wxUint64 i); + wxDataOutputStream& operator<<(wxInt64 i); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + wxDataOutputStream& operator<<(const wxULongLong &i); + wxDataOutputStream& operator<<(const wxLongLong &i); +#endif + wxDataOutputStream& operator<<(double f); + wxDataOutputStream& operator<<(float f); + + void BigEndianOrdered(bool be_order) { m_be_order = be_order; } + +protected: + wxOutputStream *m_output; + bool m_be_order; +#if wxUSE_UNICODE + wxMBConv *m_conv; +#endif + + DECLARE_NO_COPY_CLASS(wxDataOutputStream) +}; + +#endif + // wxUSE_STREAMS + +#endif + // _WX_DATSTREAM_H_ diff --git a/Externals/wxWidgets/include/wx/db.h b/Externals/wxWidgets/include/wx/db.h index 211f56dc47..bcf99059d6 100644 --- a/Externals/wxWidgets/include/wx/db.h +++ b/Externals/wxWidgets/include/wx/db.h @@ -1,848 +1,848 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/db.h -// Purpose: Header file wxDb class. The wxDb class represents a connection -// to an ODBC data source. The wxDb class allows operations on the data -// source such as opening and closing the data source. -// Author: Doug Card -// Modified by: George Tasker -// Bart Jourquin -// Mark Johnson, wxWindows@mj10777.de -// Mods: Dec, 1998: -// -Added support for SQL statement logging and database cataloging -// April, 1999 -// -Added QUERY_ONLY mode support to reduce default number of cursors -// -Added additional SQL logging code -// -Added DEBUG-ONLY tracking of Ctable objects to detect orphaned DB connections -// -Set ODBC option to only read committed writes to the DB so all -// databases operate the same in that respect -// -// Created: 9.96 -// RCS-ID: $Id: db.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 1996 Remstar International, Inc. -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DB_H_ -#define _WX_DB_H_ - - -// BJO 20000503: introduce new GetColumns members which are more database independent and -// return columns in the order they were created -#define OLD_GETCOLUMNS 1 -#define EXPERIMENTAL_WXDB_FUNCTIONS 1 - -#include "wx/defs.h" -#include "wx/string.h" - -#if defined(__VISUALC__) - // we need to include standard Windows headers but we can't include - // directly when using MFC because it includes it itself in a - // different manner - #if wxUSE_MFC - #include - #else // !wxUSE_MFC - #include "wx/msw/wrapwin.h" - #endif // wxUSE_MFC/!wxUSE_MFC - - // If you use the wxDbCreateDataSource() function with MSW/VC6, - // you cannot use the iODBC headers, you must use the VC headers, - // plus the odbcinst.h header - gt Nov 2 2000 - // - // Must add "odbccp32.lib" in \wx2\wxWidgets\src\makevc.env to the WINLIBS= line - // - #include "sql.h" - #include "sqlext.h" - //#if wxUSE_UNICODE - // #include - //#endif - #include "odbcinst.h" -#else - #if defined(__WINDOWS__) && ( defined(HAVE_W32API_H) || defined(__BORLANDC__) || defined (__DMC__)) - #include "wx/msw/wrapwin.h" - #endif - extern "C" { - #if defined(wxUSE_BUILTIN_IODBC) && wxUSE_BUILTIN_IODBC - // Use the ones from the library - #include "wx/isql.h" - #include "wx/isqlext.h" - // Not available in v2.x of iODBC - #ifndef __WXMSW__ - #if wxUSE_UNICODE - typedef wxChar SQLTCHAR; - #else - typedef UCHAR SQLTCHAR; - #endif - #endif - #else // !wxUSE_BUILTIN_IODBC - // SQL headers define BOOL if it's not defined yet but BOOL is also - // defined in many other places on other systems (Motif, at least on - // OpenVMS; Cocoa and X11) so prevent the problem by defining it before - // including these headers - #define BOOL int - #include - #include - #undef BOOL - #endif // wxUSE_BUILTIN_IODBC/!wxUSE_BUILTIN_IODBC - } -#endif - -#if wxUSE_UNICODE -#define SQL_C_WXCHAR SQL_C_WCHAR -#else -#define SQL_C_WXCHAR SQL_C_CHAR -#endif - -#ifdef __DIGITALMARS__ -#if wxUSE_UNICODE -typedef wxChar SQLTCHAR; -#else -typedef UCHAR SQLTCHAR; -#endif -#endif - -typedef float SFLOAT; -typedef double SDOUBLE; -typedef unsigned int UINT; -#define ULONG UDWORD - -#ifndef wxODBC_FWD_ONLY_CURSORS -#define wxODBC_FWD_ONLY_CURSORS 1 -#endif - -enum enumDummy {enumDum1}; - -#ifndef SQL_C_BOOLEAN - #define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG)) -#endif - -#ifndef SQL_C_ENUM - #define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG) -#endif - -// NOTE: If SQL_C_BLOB is defined, and it is not SQL_C_BINARY, iODBC 2.x -// may not function correctly. Likely best to use SQL_C_BINARY direct -#ifndef SQL_C_BLOB - #ifdef SQL_C_BINARY - #define SQL_C_BLOB SQL_C_BINARY - #endif -#endif - -#ifndef _WIN64 -#ifndef SQLLEN -#define SQLLEN SQLINTEGER -#endif -#ifndef SQLULEN -#define SQLULEN SQLUINTEGER -#endif -#endif - -const int wxDB_PATH_MAX = 254; - -extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_LOG_FILENAME; -extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_CATALOG_FILENAME; - -// Database Globals -const int DB_TYPE_NAME_LEN = 40; -const int DB_MAX_STATEMENT_LEN = 4096; -const int DB_MAX_WHERE_CLAUSE_LEN = 2048; -const int DB_MAX_ERROR_MSG_LEN = 512; -const int DB_MAX_ERROR_HISTORY = 5; -const int DB_MAX_TABLE_NAME_LEN = 128; -const int DB_MAX_COLUMN_NAME_LEN = 128; - -const int DB_DATA_TYPE_VARCHAR = 1; -const int DB_DATA_TYPE_INTEGER = 2; -const int DB_DATA_TYPE_FLOAT = 3; -const int DB_DATA_TYPE_DATE = 4; -const int DB_DATA_TYPE_BLOB = 5; -const int DB_DATA_TYPE_MEMO = 6; - -const int DB_SELECT_KEYFIELDS = 1; -const int DB_SELECT_WHERE = 2; -const int DB_SELECT_MATCHING = 3; -const int DB_SELECT_STATEMENT = 4; - -const int DB_UPD_KEYFIELDS = 1; -const int DB_UPD_WHERE = 2; - -const int DB_DEL_KEYFIELDS = 1; -const int DB_DEL_WHERE = 2; -const int DB_DEL_MATCHING = 3; - -const int DB_WHERE_KEYFIELDS = 1; -const int DB_WHERE_MATCHING = 2; - -const int DB_GRANT_SELECT = 1; -const int DB_GRANT_INSERT = 2; -const int DB_GRANT_UPDATE = 4; -const int DB_GRANT_DELETE = 8; -const int DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE; - -// ODBC Error codes (derived from ODBC SqlState codes) -enum wxODBC_ERRORS -{ - DB_FAILURE = 0, - DB_SUCCESS = 1, - DB_ERR_NOT_IN_USE, - DB_ERR_GENERAL_WARNING, // SqlState = '01000' - DB_ERR_DISCONNECT_ERROR, // SqlState = '01002' - DB_ERR_DATA_TRUNCATED, // SqlState = '01004' - DB_ERR_PRIV_NOT_REVOKED, // SqlState = '01006' - DB_ERR_INVALID_CONN_STR_ATTR, // SqlState = '01S00' - DB_ERR_ERROR_IN_ROW, // SqlState = '01S01' - DB_ERR_OPTION_VALUE_CHANGED, // SqlState = '01S02' - DB_ERR_NO_ROWS_UPD_OR_DEL, // SqlState = '01S03' - DB_ERR_MULTI_ROWS_UPD_OR_DEL, // SqlState = '01S04' - DB_ERR_WRONG_NO_OF_PARAMS, // SqlState = '07001' - DB_ERR_DATA_TYPE_ATTR_VIOL, // SqlState = '07006' - DB_ERR_UNABLE_TO_CONNECT, // SqlState = '08001' - DB_ERR_CONNECTION_IN_USE, // SqlState = '08002' - DB_ERR_CONNECTION_NOT_OPEN, // SqlState = '08003' - DB_ERR_REJECTED_CONNECTION, // SqlState = '08004' - DB_ERR_CONN_FAIL_IN_TRANS, // SqlState = '08007' - DB_ERR_COMM_LINK_FAILURE, // SqlState = '08S01' - DB_ERR_INSERT_VALUE_LIST_MISMATCH, // SqlState = '21S01' - DB_ERR_DERIVED_TABLE_MISMATCH, // SqlState = '21S02' - DB_ERR_STRING_RIGHT_TRUNC, // SqlState = '22001' - DB_ERR_NUMERIC_VALUE_OUT_OF_RNG, // SqlState = '22003' - DB_ERR_ERROR_IN_ASSIGNMENT, // SqlState = '22005' - DB_ERR_DATETIME_FLD_OVERFLOW, // SqlState = '22008' - DB_ERR_DIVIDE_BY_ZERO, // SqlState = '22012' - DB_ERR_STR_DATA_LENGTH_MISMATCH, // SqlState = '22026' - DB_ERR_INTEGRITY_CONSTRAINT_VIOL, // SqlState = '23000' - DB_ERR_INVALID_CURSOR_STATE, // SqlState = '24000' - DB_ERR_INVALID_TRANS_STATE, // SqlState = '25000' - DB_ERR_INVALID_AUTH_SPEC, // SqlState = '28000' - DB_ERR_INVALID_CURSOR_NAME, // SqlState = '34000' - DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL, // SqlState = '37000' - DB_ERR_DUPLICATE_CURSOR_NAME, // SqlState = '3C000' - DB_ERR_SERIALIZATION_FAILURE, // SqlState = '40001' - DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2, // SqlState = '42000' - DB_ERR_OPERATION_ABORTED, // SqlState = '70100' - DB_ERR_UNSUPPORTED_FUNCTION, // SqlState = 'IM001' - DB_ERR_NO_DATA_SOURCE, // SqlState = 'IM002' - DB_ERR_DRIVER_LOAD_ERROR, // SqlState = 'IM003' - DB_ERR_SQLALLOCENV_FAILED, // SqlState = 'IM004' - DB_ERR_SQLALLOCCONNECT_FAILED, // SqlState = 'IM005' - DB_ERR_SQLSETCONNECTOPTION_FAILED, // SqlState = 'IM006' - DB_ERR_NO_DATA_SOURCE_DLG_PROHIB, // SqlState = 'IM007' - DB_ERR_DIALOG_FAILED, // SqlState = 'IM008' - DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL, // SqlState = 'IM009' - DB_ERR_DATA_SOURCE_NAME_TOO_LONG, // SqlState = 'IM010' - DB_ERR_DRIVER_NAME_TOO_LONG, // SqlState = 'IM011' - DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR, // SqlState = 'IM012' - DB_ERR_TRACE_FILE_ERROR, // SqlState = 'IM013' - DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS, // SqlState = 'S0001' - DB_ERR_TABLE_NOT_FOUND, // SqlState = 'S0002' - DB_ERR_INDEX_ALREADY_EXISTS, // SqlState = 'S0011' - DB_ERR_INDEX_NOT_FOUND, // SqlState = 'S0012' - DB_ERR_COLUMN_ALREADY_EXISTS, // SqlState = 'S0021' - DB_ERR_COLUMN_NOT_FOUND, // SqlState = 'S0022' - DB_ERR_NO_DEFAULT_FOR_COLUMN, // SqlState = 'S0023' - DB_ERR_GENERAL_ERROR, // SqlState = 'S1000' - DB_ERR_MEMORY_ALLOCATION_FAILURE, // SqlState = 'S1001' - DB_ERR_INVALID_COLUMN_NUMBER, // SqlState = 'S1002' - DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE, // SqlState = 'S1003' - DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE, // SqlState = 'S1004' - DB_ERR_OPERATION_CANCELLED, // SqlState = 'S1008' - DB_ERR_INVALID_ARGUMENT_VALUE, // SqlState = 'S1009' - DB_ERR_FUNCTION_SEQUENCE_ERROR, // SqlState = 'S1010' - DB_ERR_OPERATION_INVALID_AT_THIS_TIME, // SqlState = 'S1011' - DB_ERR_INVALID_TRANS_OPERATION_CODE, // SqlState = 'S1012' - DB_ERR_NO_CURSOR_NAME_AVAIL, // SqlState = 'S1015' - DB_ERR_INVALID_STR_OR_BUF_LEN, // SqlState = 'S1090' - DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE, // SqlState = 'S1091' - DB_ERR_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1092' - DB_ERR_INVALID_PARAM_NO, // SqlState = 'S1093' - DB_ERR_INVALID_SCALE_VALUE, // SqlState = 'S1094' - DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1095' - DB_ERR_INF_TYPE_OUT_OF_RANGE, // SqlState = 'S1096' - DB_ERR_COLUMN_TYPE_OUT_OF_RANGE, // SqlState = 'S1097' - DB_ERR_SCOPE_TYPE_OUT_OF_RANGE, // SqlState = 'S1098' - DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE, // SqlState = 'S1099' - DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1100' - DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1101' - DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE, // SqlState = 'S1103' - DB_ERR_INVALID_PRECISION_VALUE, // SqlState = 'S1104' - DB_ERR_INVALID_PARAM_TYPE, // SqlState = 'S1105' - DB_ERR_FETCH_TYPE_OUT_OF_RANGE, // SqlState = 'S1106' - DB_ERR_ROW_VALUE_OUT_OF_RANGE, // SqlState = 'S1107' - DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE, // SqlState = 'S1108' - DB_ERR_INVALID_CURSOR_POSITION, // SqlState = 'S1109' - DB_ERR_INVALID_DRIVER_COMPLETION, // SqlState = 'S1110' - DB_ERR_INVALID_BOOKMARK_VALUE, // SqlState = 'S1111' - DB_ERR_DRIVER_NOT_CAPABLE, // SqlState = 'S1C00' - DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00' -}; - -#ifndef MAXNAME - #define MAXNAME 31 -#endif - -#ifndef SQL_MAX_AUTHSTR_LEN - // There does not seem to be a standard for this, so I am - // defaulting to the value that MS uses - #define SQL_MAX_AUTHSTR_LEN MAXNAME -#endif - -#ifndef SQL_MAX_CONNECTSTR_LEN - // There does not seem to be a standard for this, so I am - // defaulting to the value that MS recommends - #define SQL_MAX_CONNECTSTR_LEN 1024 -#endif - - -class WXDLLIMPEXP_ODBC wxDbConnectInf -{ - private: - bool freeHenvOnDestroy; - bool useConnectionStr; - - public: - HENV Henv; - wxChar Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name - wxChar Uid[SQL_MAX_USER_NAME_LEN+1]; // User ID - wxChar AuthStr[SQL_MAX_AUTHSTR_LEN+1]; // Authorization string (password) - wxChar ConnectionStr[SQL_MAX_CONNECTSTR_LEN+1]; // Connection string (password) - - wxString Description; // Not sure what the max length is - wxString FileType; // Not sure what the max length is - - // Optionals needed for some databases like dBase - wxString DefaultDir; // Directory that db file resides in - - public: - - wxDbConnectInf(); - wxDbConnectInf(HENV henv, const wxString &dsn, const wxString &userID=wxEmptyString, - const wxString &password=wxEmptyString, const wxString &defaultDir=wxEmptyString, - const wxString &description=wxEmptyString, const wxString &fileType=wxEmptyString); - - ~wxDbConnectInf(); - - bool Initialize(); - - bool AllocHenv(); - void FreeHenv(); - - // Accessors - const HENV &GetHenv() { return Henv; } - - const wxChar *GetDsn() { return Dsn; } - - const wxChar *GetUid() { return Uid; } - const wxChar *GetUserID() { return Uid; } - - const wxChar *GetAuthStr() { return AuthStr; } - const wxChar *GetPassword() { return AuthStr; } - - const wxChar *GetConnectionStr() { return ConnectionStr; } - bool UseConnectionStr() { return useConnectionStr; } - - const wxChar *GetDescription() { return Description; } - const wxChar *GetFileType() { return FileType; } - const wxChar *GetDefaultDir() { return DefaultDir; } - - void SetHenv(const HENV henv) { Henv = henv; } - - void SetDsn(const wxString &dsn); - - void SetUserID(const wxString &userID); - void SetUid(const wxString &uid) { SetUserID(uid); } - - void SetPassword(const wxString &password); - void SetAuthStr(const wxString &authstr) { SetPassword(authstr); } - - void SetConnectionStr(const wxString &connectStr); - - void SetDescription(const wxString &desc) { Description = desc; } - void SetFileType(const wxString &fileType) { FileType = fileType; } - void SetDefaultDir(const wxString &defDir) { DefaultDir = defDir; } -}; // class wxDbConnectInf - - -struct WXDLLIMPEXP_ODBC wxDbSqlTypeInfo -{ - wxString TypeName; - SWORD FsqlType; - long Precision; - short CaseSensitive; - short MaximumScale; -}; - - -class WXDLLIMPEXP_ODBC wxDbColFor -{ -public: - wxString s_Field; // Formatted String for Output - wxString s_Format[7]; // Formatted Objects - TIMESTAMP has the biggest (7) - wxString s_Amount[7]; // Formatted Objects - amount of things that can be formatted - int i_Amount[7]; // Formatted Objects - TT MM YYYY HH MM SS m - int i_Nation; // 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US - int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes - SWORD i_sqlDataType; - - wxDbColFor(); - ~wxDbColFor(){} - - void Initialize(); - int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnLength, short decimalDigits); -}; - - -class WXDLLIMPEXP_ODBC wxDbColInf -{ -public: - wxChar catalog[128+1]; - wxChar schema[128+1]; - wxChar tableName[DB_MAX_TABLE_NAME_LEN+1]; - wxChar colName[DB_MAX_COLUMN_NAME_LEN+1]; - SWORD sqlDataType; - wxChar typeName[128+1]; - SWORD columnLength; - SWORD bufferSize; - short decimalDigits; - short numPrecRadix; - short nullable; - wxChar remarks[254+1]; - int dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes - // mj10777.19991224 : new - int PkCol; // Primary key column 0=No; 1= First Key, 2 = Second Key etc. - wxChar PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey - int FkCol; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc. - wxChar FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name - wxDbColFor *pColFor; // How should this columns be formatted - - wxDbColInf(); - ~wxDbColInf(); - - bool Initialize(); -}; - - -class WXDLLIMPEXP_ODBC wxDbTableInf // Description of a Table -{ -public: - wxChar tableName[DB_MAX_TABLE_NAME_LEN+1]; - wxChar tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc. - wxChar tableRemarks[254+1]; - UWORD numCols; // How many Columns does this Table have: GetColumnCount(..); - wxDbColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..); - - wxDbTableInf(); - ~wxDbTableInf(); - - bool Initialize(); -}; - - -class WXDLLIMPEXP_ODBC wxDbInf // Description of a Database -{ -public: - wxChar catalog[128+1]; - wxChar schema[128+1]; - int numTables; // How many tables does this database have - wxDbTableInf *pTableInf; // pTableInf = new wxDbTableInf[numTables]; - - wxDbInf(); - ~wxDbInf(); - - bool Initialize(); -}; - - -enum wxDbSqlLogState -{ - sqlLogOFF, - sqlLogON -}; - -// These are the databases currently tested and working with these classes -// See the comments in wxDb::Dbms() for exceptions/issues with -// each of these database engines -enum wxDBMS -{ - dbmsUNIDENTIFIED, - dbmsORACLE, - dbmsSYBASE_ASA, // Adaptive Server Anywhere - dbmsSYBASE_ASE, // Adaptive Server Enterprise - dbmsMS_SQL_SERVER, - dbmsMY_SQL, - dbmsPOSTGRES, - dbmsACCESS, - dbmsDBASE, - dbmsINFORMIX, - dbmsVIRTUOSO, - dbmsDB2, - dbmsINTERBASE, - dbmsPERVASIVE_SQL, - dbmsXBASE_SEQUITER, - dbmsFIREBIRD, - dbmsMAXDB, - dbmsFuture1, - dbmsFuture2, - dbmsFuture3, - dbmsFuture4, - dbmsFuture5, - dbmsFuture6, - dbmsFuture7, - dbmsFuture8, - dbmsFuture9, - dbmsFuture10 -}; - - -// The wxDb::errorList is copied to this variable when the wxDb object -// is closed. This way, the error list is still available after the -// database object is closed. This is necessary if the database -// connection fails so the calling application can show the operator -// why the connection failed. Note: as each wxDb object is closed, it -// will overwrite the errors of the previously destroyed wxDb object in -// this variable. - -extern WXDLLIMPEXP_DATA_ODBC(wxChar) - DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN+1]; - - -class WXDLLIMPEXP_ODBC wxDb -{ -private: - bool dbIsOpen; - bool dbIsCached; // Was connection created by caching functions - bool dbOpenedWithConnectionString; // Was the database connection opened with a connection string - wxString dsn; // Data source name - wxString uid; // User ID - wxString authStr; // Authorization string (password) - wxString inConnectionStr; // Connection string used to connect to the database - wxString outConnectionStr;// Connection string returned by the database when a connection is successfully opened - FILE *fpSqlLog; // Sql Log file pointer - wxDbSqlLogState sqlLogState; // On or Off - bool fwdOnlyCursors; - wxDBMS dbmsType; // Type of datasource - i.e. Oracle, dBase, SQLServer, etc - - // Private member functions - bool getDbInfo(bool failOnDataTypeUnsupported=true); - bool getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo); - bool setConnectionOptions(void); - void logError(const wxString &errMsg, const wxString &SQLState); - const wxChar *convertUserID(const wxChar *userID, wxString &UserID); - bool determineDataTypes(bool failOnDataTypeUnsupported); - void initialize(); - bool open(bool failOnDataTypeUnsupported=true); - -#if !wxODBC_BACKWARD_COMPATABILITY - // ODBC handles - HENV henv; // ODBC Environment handle - HDBC hdbc; // ODBC DB Connection handle - HSTMT hstmt; // ODBC Statement handle - - //Error reporting mode - bool silent; - - // Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!! - unsigned int nTables; - - // Information about logical data types VARCHAR, INTEGER, FLOAT and DATE. - // - // This information is obtained from the ODBC driver by use of the - // SQLGetTypeInfo() function. The key piece of information is the - // type name the data source uses for each logical data type. - // e.g. VARCHAR; Oracle calls it VARCHAR2. - wxDbSqlTypeInfo typeInfVarchar; - wxDbSqlTypeInfo typeInfInteger; - wxDbSqlTypeInfo typeInfFloat; - wxDbSqlTypeInfo typeInfDate; - wxDbSqlTypeInfo typeInfBlob; - wxDbSqlTypeInfo typeInfMemo; -#endif - -public: - - void setCached(bool cached) { dbIsCached = cached; } // This function must only be called by wxDbGetConnection() and wxDbCloseConnections!!! - bool IsCached() { return dbIsCached; } - - bool GetDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo) - { return getDataTypeInfo(fSqlType, structSQLTypeInfo); } - -#if wxODBC_BACKWARD_COMPATABILITY - // ODBC handles - HENV henv; // ODBC Environment handle - HDBC hdbc; // ODBC DB Connection handle - HSTMT hstmt; // ODBC Statement handle - - //Error reporting mode - bool silent; - - // Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!! - unsigned int nTables; -#endif - - // The following structure contains database information gathered from the - // datasource when the datasource is first opened. - struct - { - wxChar dbmsName[40]; // Name of the dbms product - wxChar dbmsVer[64]; // Version # of the dbms product - wxChar driverName[40]; // Driver name - wxChar odbcVer[60]; // ODBC version of the driver - wxChar drvMgrOdbcVer[60]; // ODBC version of the driver manager - wxChar driverVer[60]; // Driver version - wxChar serverName[80]; // Server Name, typically a connect string - wxChar databaseName[128]; // Database filename - wxChar outerJoins[2]; // Indicates whether the data source supports outer joins - wxChar procedureSupport[2]; // Indicates whether the data source supports stored procedures - wxChar accessibleTables[2]; // Indicates whether the data source only reports accessible tables in SQLTables. - UWORD maxConnections; // Maximum # of connections the data source supports - UWORD maxStmts; // Maximum # of HSTMTs per HDBC - UWORD apiConfLvl; // ODBC API conformance level - UWORD cliConfLvl; // Indicates whether the data source is SAG compliant - UWORD sqlConfLvl; // SQL conformance level - UWORD cursorCommitBehavior; // Indicates how cursors are affected by a db commit - UWORD cursorRollbackBehavior; // Indicates how cursors are affected by a db rollback - UWORD supportNotNullClause; // Indicates if data source supports NOT NULL clause - wxChar supportIEF[2]; // Integrity Enhancement Facility (Referential Integrity) - UDWORD txnIsolation; // Default transaction isolation level supported by the driver - UDWORD txnIsolationOptions; // Transaction isolation level options available - UDWORD fetchDirections; // Fetch directions supported - UDWORD lockTypes; // Lock types supported in SQLSetPos - UDWORD posOperations; // Position operations supported in SQLSetPos - UDWORD posStmts; // Position statements supported - UDWORD scrollConcurrency; // Concurrency control options supported for scrollable cursors - UDWORD scrollOptions; // Scroll Options supported for scrollable cursors - UDWORD staticSensitivity; // Indicates if additions, deletions and updates can be detected - UWORD txnCapable; // Indicates if the data source supports transactions - UDWORD loginTimeout; // Number seconds to wait for a login request - } dbInf; - - // ODBC Error Inf. - SWORD cbErrorMsg; - int DB_STATUS; -#ifdef __VMS - // The DECC compiler chokes when in db.cpp the array is accessed outside - // its bounds. Maybe this change should also applied for other platforms. - wxChar errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN+1]; -#else - wxChar errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]; -#endif - wxChar errorMsg[SQL_MAX_MESSAGE_LENGTH]; - SQLINTEGER nativeError; - wxChar sqlState[20]; - -#if wxODBC_BACKWARD_COMPATABILITY - // Information about logical data types VARCHAR, INTEGER, FLOAT and DATE. - // - // This information is obtained from the ODBC driver by use of the - // SQLGetTypeInfo() function. The key piece of information is the - // type name the data source uses for each logical data type. - // e.g. VARCHAR; Oracle calls it VARCHAR2. - wxDbSqlTypeInfo typeInfVarchar; - wxDbSqlTypeInfo typeInfInteger; - wxDbSqlTypeInfo typeInfFloat; - wxDbSqlTypeInfo typeInfDate; - wxDbSqlTypeInfo typeInfBlob; -#endif - - // Public member functions - wxDb(const HENV &aHenv, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); - ~wxDb(); - - // Data Source Name, User ID, Password and whether open should fail on data type not supported - bool Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported=true); - ///This version of Open will open the odbc source selection dialog. Cast a wxWindow::GetHandle() to SQLHWND to use. - bool Open(const wxString& inConnectStr, SQLHWND parentWnd, bool failOnDataTypeUnsupported=true); - bool Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthStr, bool failOnDataTypeUnsupported=true); - bool Open(wxDbConnectInf *dbConnectInf, bool failOnDataTypeUnsupported=true); - bool Open(wxDb *copyDb); // pointer to a wxDb whose connection info should be copied rather than re-queried - void Close(void); - bool CommitTrans(void); - bool RollbackTrans(void); - bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT); - bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT); - void DispNextError(void); - bool CreateView(const wxString &viewName, const wxString &colList, const wxString &pSqlStmt, bool attemptDrop=true); - bool DropView(const wxString &viewName); - bool ExecSql(const wxString &pSqlStmt); - bool ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols); - bool GetNext(void); - bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SQLLEN FAR *cbReturned); - bool Grant(int privileges, const wxString &tableName, const wxString &userList = wxT("PUBLIC")); - int TranslateSqlState(const wxString &SQLState); - wxDbInf *GetCatalog(const wxChar *userID=NULL); - bool Catalog(const wxChar *userID=NULL, const wxString &fileName=SQL_CATALOG_FILENAME); - int GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCols); - - wxDbColInf *GetColumns(wxChar *tableName[], const wxChar *userID=NULL); - wxDbColInf *GetColumns(const wxString &tableName, UWORD *numCols, const wxChar *userID=NULL); - - int GetColumnCount(const wxString &tableName, const wxChar *userID=NULL); - const wxChar *GetDatabaseName(void) {return dbInf.dbmsName;} - const wxString &GetDataSource(void) {return dsn;} - const wxString &GetDatasourceName(void){return dsn;} - const wxString &GetUsername(void) {return uid;} - const wxString &GetPassword(void) {return authStr;} - const wxString &GetConnectionInStr(void) {return inConnectionStr;} - const wxString &GetConnectionOutStr(void) {return outConnectionStr;} - bool IsOpen(void) {return dbIsOpen;} - bool OpenedWithConnectionString(void) {return dbOpenedWithConnectionString;} - HENV GetHENV(void) {return henv;} - HDBC GetHDBC(void) {return hdbc;} - HSTMT GetHSTMT(void) {return hstmt;} - int GetTableCount() {return nTables;} // number of tables using this connection - wxDbSqlTypeInfo GetTypeInfVarchar() {return typeInfVarchar;} - wxDbSqlTypeInfo GetTypeInfInteger() {return typeInfInteger;} - wxDbSqlTypeInfo GetTypeInfFloat() {return typeInfFloat;} - wxDbSqlTypeInfo GetTypeInfDate() {return typeInfDate;} - wxDbSqlTypeInfo GetTypeInfBlob() {return typeInfBlob;} - wxDbSqlTypeInfo GetTypeInfMemo() {return typeInfMemo;} - - // tableName can refer to a table, view, alias or synonym - bool TableExists(const wxString &tableName, const wxChar *userID=NULL, - const wxString &tablePath=wxEmptyString); - bool TablePrivileges(const wxString &tableName, const wxString &priv, - const wxChar *userID=NULL, const wxChar *schema=NULL, - const wxString &path=wxEmptyString); - - // These two functions return the table name or column name in a form ready - // for use in SQL statements. For example, if the datasource allows spaces - // in the table name or column name, the returned string will have the - // correct enclosing marks around the name to allow it to be properly - // included in a SQL statement - const wxString SQLTableName(const wxChar *tableName); - const wxString SQLColumnName(const wxChar *colName); - - void LogError(const wxString &errMsg, const wxString &SQLState = wxEmptyString) - { logError(errMsg, SQLState); } - void SetDebugErrorMessages(bool state) { silent = !state; } - bool SetSqlLogging(wxDbSqlLogState state, const wxString &filename = SQL_LOG_FILENAME, - bool append = false); - bool WriteSqlLog(const wxString &logMsg); - - wxDBMS Dbms(void); - bool ModifyColumn(const wxString &tableName, const wxString &columnName, - int dataType, ULONG columnLength=0, - const wxString &optionalParam=wxEmptyString); - - bool FwdOnlyCursors(void) {return fwdOnlyCursors;} - - // return the string with all special SQL characters escaped - wxString EscapeSqlChars(const wxString& value); - - // These two functions are provided strictly for use by wxDbTable. - // DO NOT USE THESE FUNCTIONS, OR MEMORY LEAKS MAY OCCUR - void incrementTableCount() { nTables++; return; } - void decrementTableCount() { nTables--; return; } - -}; // wxDb - - -// This structure forms a node in a linked list. The linked list of "DbList" objects -// keeps track of allocated database connections. This allows the application to -// open more than one database connection through ODBC for multiple transaction support -// or for multiple database support. -struct wxDbList -{ - wxDbList *PtrPrev; // Pointer to previous item in the list - wxString Dsn; // Data Source Name - wxString Uid; // User ID - wxString AuthStr; // Authorization string (password) - wxString ConnectionStr; // Connection string used instead of DSN - wxDb *PtrDb; // Pointer to the wxDb object - bool Free; // Is item free or in use? - wxDbList *PtrNext; // Pointer to next item in the list -}; - - -#ifdef __WXDEBUG__ -#include "wx/object.h" -class wxTablesInUse : public wxObject -{ - public: - const wxChar *tableName; - ULONG tableID; - class wxDb *pDb; -}; // wxTablesInUse -#endif - - -// The following routines allow a user to get new database connections, free them -// for other code segments to use, or close all of them when the application has -// completed. -wxDb WXDLLIMPEXP_ODBC *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); -bool WXDLLIMPEXP_ODBC wxDbFreeConnection(wxDb *pDb); -void WXDLLIMPEXP_ODBC wxDbCloseConnections(void); -int WXDLLIMPEXP_ODBC wxDbConnectionsInUse(void); - - -// Writes a message to the wxLog window (stdout usually) when an internal error -// situation occurs. This function only works in DEBUG builds -const wxChar WXDLLIMPEXP_ODBC * -wxDbLogExtendedErrorMsg(const wxChar *userText, - wxDb *pDb, - const wxChar *ErrFile, - int ErrLine); - - -// This function sets the sql log state for all open wxDb objects -bool WXDLLIMPEXP_ODBC -wxDbSqlLog(wxDbSqlLogState state, const wxString &filename = SQL_LOG_FILENAME); - - -#if 0 -// MSW/VC6 ONLY!!! Experimental -int WXDLLEXPORT wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const wxString &description=wxEmptyString, - bool sysDSN=false, const wxString &defDir=wxEmptyString, wxWindow *parent=NULL); -#endif - -// This routine allows you to query a driver manager -// for a list of available datasources. Call this routine -// the first time using SQL_FETCH_FIRST. Continue to call it -// using SQL_FETCH_NEXT until you've exhausted the list. -bool WXDLLIMPEXP_ODBC -wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMaxLength, wxChar *DsDesc, - SWORD DsDescMaxLength, UWORD direction = SQL_FETCH_NEXT); - - -// Change this to 0 to remove use of all deprecated functions -#if wxODBC_BACKWARD_COMPATABILITY -//################################################################################# -//############### DEPRECATED functions for backward compatibility ################# -//################################################################################# - -// Backward compability structures/classes. This will eventually go away -const int DB_PATH_MAX = wxDB_PATH_MAX; - -typedef wxDb wxDB; -typedef wxDbTableInf wxTableInf; -typedef wxDbColInf wxColInf; -typedef wxDbColInf CcolInf; -typedef wxDbColFor wxColFor; -typedef wxDbSqlTypeInfo SqlTypeInfo; -typedef wxDbSqlTypeInfo wxSqlTypeInfo; -typedef enum wxDbSqlLogState sqlLog; -typedef enum wxDbSqlLogState wxSqlLogState; -typedef enum wxDBMS dbms; -typedef enum wxDBMS DBMS; -typedef wxODBC_ERRORS ODBC_ERRORS; -typedef wxDbConnectInf DbStuff; -typedef wxDbList DbList; -#ifdef __WXDEBUG__ -typedef wxTablesInUse CstructTablesInUse; -#endif - -// Deprecated function names that are replaced by the function names listed above -wxDB WXDLLIMPEXP_ODBC -*GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); -bool WXDLLIMPEXP_ODBC FreeDbConnection(wxDB *pDb); -void WXDLLIMPEXP_ODBC CloseDbConnections(void); -int WXDLLIMPEXP_ODBC NumberDbConnectionsInUse(void); - -bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME); - -bool WXDLLIMPEXP_ODBC -GetDataSource(HENV henv, char *Dsn, SWORD DsnMaxLength, char *DsDesc, SWORD DsDescMaxLength, - UWORD direction = SQL_FETCH_NEXT); - -#endif // Deprecated structures/classes/functions - -#endif // _WX_DB_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/db.h +// Purpose: Header file wxDb class. The wxDb class represents a connection +// to an ODBC data source. The wxDb class allows operations on the data +// source such as opening and closing the data source. +// Author: Doug Card +// Modified by: George Tasker +// Bart Jourquin +// Mark Johnson, wxWindows@mj10777.de +// Mods: Dec, 1998: +// -Added support for SQL statement logging and database cataloging +// April, 1999 +// -Added QUERY_ONLY mode support to reduce default number of cursors +// -Added additional SQL logging code +// -Added DEBUG-ONLY tracking of Ctable objects to detect orphaned DB connections +// -Set ODBC option to only read committed writes to the DB so all +// databases operate the same in that respect +// +// Created: 9.96 +// RCS-ID: $Id: db.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) 1996 Remstar International, Inc. +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DB_H_ +#define _WX_DB_H_ + + +// BJO 20000503: introduce new GetColumns members which are more database independent and +// return columns in the order they were created +#define OLD_GETCOLUMNS 1 +#define EXPERIMENTAL_WXDB_FUNCTIONS 1 + +#include "wx/defs.h" +#include "wx/string.h" + +#if defined(__VISUALC__) + // we need to include standard Windows headers but we can't include + // directly when using MFC because it includes it itself in a + // different manner + #if wxUSE_MFC + #include + #else // !wxUSE_MFC + #include "wx/msw/wrapwin.h" + #endif // wxUSE_MFC/!wxUSE_MFC + + // If you use the wxDbCreateDataSource() function with MSW/VC6, + // you cannot use the iODBC headers, you must use the VC headers, + // plus the odbcinst.h header - gt Nov 2 2000 + // + // Must add "odbccp32.lib" in \wx2\wxWidgets\src\makevc.env to the WINLIBS= line + // + #include "sql.h" + #include "sqlext.h" + //#if wxUSE_UNICODE + // #include + //#endif + #include "odbcinst.h" +#else + #if defined(__WINDOWS__) && ( defined(HAVE_W32API_H) || defined(__BORLANDC__) || defined (__DMC__)) + #include "wx/msw/wrapwin.h" + #endif + extern "C" { + #if defined(wxUSE_BUILTIN_IODBC) && wxUSE_BUILTIN_IODBC + // Use the ones from the library + #include "wx/isql.h" + #include "wx/isqlext.h" + // Not available in v2.x of iODBC + #ifndef __WXMSW__ + #if wxUSE_UNICODE + typedef wxChar SQLTCHAR; + #else + typedef UCHAR SQLTCHAR; + #endif + #endif + #else // !wxUSE_BUILTIN_IODBC + // SQL headers define BOOL if it's not defined yet but BOOL is also + // defined in many other places on other systems (Motif, at least on + // OpenVMS; Cocoa and X11) so prevent the problem by defining it before + // including these headers + #define BOOL int + #include + #include + #undef BOOL + #endif // wxUSE_BUILTIN_IODBC/!wxUSE_BUILTIN_IODBC + } +#endif + +#if wxUSE_UNICODE +#define SQL_C_WXCHAR SQL_C_WCHAR +#else +#define SQL_C_WXCHAR SQL_C_CHAR +#endif + +#ifdef __DIGITALMARS__ +#if wxUSE_UNICODE +typedef wxChar SQLTCHAR; +#else +typedef UCHAR SQLTCHAR; +#endif +#endif + +typedef float SFLOAT; +typedef double SDOUBLE; +typedef unsigned int UINT; +#define ULONG UDWORD + +#ifndef wxODBC_FWD_ONLY_CURSORS +#define wxODBC_FWD_ONLY_CURSORS 1 +#endif + +enum enumDummy {enumDum1}; + +#ifndef SQL_C_BOOLEAN + #define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG)) +#endif + +#ifndef SQL_C_ENUM + #define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG) +#endif + +// NOTE: If SQL_C_BLOB is defined, and it is not SQL_C_BINARY, iODBC 2.x +// may not function correctly. Likely best to use SQL_C_BINARY direct +#ifndef SQL_C_BLOB + #ifdef SQL_C_BINARY + #define SQL_C_BLOB SQL_C_BINARY + #endif +#endif + +#ifndef _WIN64 +#ifndef SQLLEN +#define SQLLEN SQLINTEGER +#endif +#ifndef SQLULEN +#define SQLULEN SQLUINTEGER +#endif +#endif + +const int wxDB_PATH_MAX = 254; + +extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_LOG_FILENAME; +extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_CATALOG_FILENAME; + +// Database Globals +const int DB_TYPE_NAME_LEN = 40; +const int DB_MAX_STATEMENT_LEN = 4096; +const int DB_MAX_WHERE_CLAUSE_LEN = 2048; +const int DB_MAX_ERROR_MSG_LEN = 512; +const int DB_MAX_ERROR_HISTORY = 5; +const int DB_MAX_TABLE_NAME_LEN = 128; +const int DB_MAX_COLUMN_NAME_LEN = 128; + +const int DB_DATA_TYPE_VARCHAR = 1; +const int DB_DATA_TYPE_INTEGER = 2; +const int DB_DATA_TYPE_FLOAT = 3; +const int DB_DATA_TYPE_DATE = 4; +const int DB_DATA_TYPE_BLOB = 5; +const int DB_DATA_TYPE_MEMO = 6; + +const int DB_SELECT_KEYFIELDS = 1; +const int DB_SELECT_WHERE = 2; +const int DB_SELECT_MATCHING = 3; +const int DB_SELECT_STATEMENT = 4; + +const int DB_UPD_KEYFIELDS = 1; +const int DB_UPD_WHERE = 2; + +const int DB_DEL_KEYFIELDS = 1; +const int DB_DEL_WHERE = 2; +const int DB_DEL_MATCHING = 3; + +const int DB_WHERE_KEYFIELDS = 1; +const int DB_WHERE_MATCHING = 2; + +const int DB_GRANT_SELECT = 1; +const int DB_GRANT_INSERT = 2; +const int DB_GRANT_UPDATE = 4; +const int DB_GRANT_DELETE = 8; +const int DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE; + +// ODBC Error codes (derived from ODBC SqlState codes) +enum wxODBC_ERRORS +{ + DB_FAILURE = 0, + DB_SUCCESS = 1, + DB_ERR_NOT_IN_USE, + DB_ERR_GENERAL_WARNING, // SqlState = '01000' + DB_ERR_DISCONNECT_ERROR, // SqlState = '01002' + DB_ERR_DATA_TRUNCATED, // SqlState = '01004' + DB_ERR_PRIV_NOT_REVOKED, // SqlState = '01006' + DB_ERR_INVALID_CONN_STR_ATTR, // SqlState = '01S00' + DB_ERR_ERROR_IN_ROW, // SqlState = '01S01' + DB_ERR_OPTION_VALUE_CHANGED, // SqlState = '01S02' + DB_ERR_NO_ROWS_UPD_OR_DEL, // SqlState = '01S03' + DB_ERR_MULTI_ROWS_UPD_OR_DEL, // SqlState = '01S04' + DB_ERR_WRONG_NO_OF_PARAMS, // SqlState = '07001' + DB_ERR_DATA_TYPE_ATTR_VIOL, // SqlState = '07006' + DB_ERR_UNABLE_TO_CONNECT, // SqlState = '08001' + DB_ERR_CONNECTION_IN_USE, // SqlState = '08002' + DB_ERR_CONNECTION_NOT_OPEN, // SqlState = '08003' + DB_ERR_REJECTED_CONNECTION, // SqlState = '08004' + DB_ERR_CONN_FAIL_IN_TRANS, // SqlState = '08007' + DB_ERR_COMM_LINK_FAILURE, // SqlState = '08S01' + DB_ERR_INSERT_VALUE_LIST_MISMATCH, // SqlState = '21S01' + DB_ERR_DERIVED_TABLE_MISMATCH, // SqlState = '21S02' + DB_ERR_STRING_RIGHT_TRUNC, // SqlState = '22001' + DB_ERR_NUMERIC_VALUE_OUT_OF_RNG, // SqlState = '22003' + DB_ERR_ERROR_IN_ASSIGNMENT, // SqlState = '22005' + DB_ERR_DATETIME_FLD_OVERFLOW, // SqlState = '22008' + DB_ERR_DIVIDE_BY_ZERO, // SqlState = '22012' + DB_ERR_STR_DATA_LENGTH_MISMATCH, // SqlState = '22026' + DB_ERR_INTEGRITY_CONSTRAINT_VIOL, // SqlState = '23000' + DB_ERR_INVALID_CURSOR_STATE, // SqlState = '24000' + DB_ERR_INVALID_TRANS_STATE, // SqlState = '25000' + DB_ERR_INVALID_AUTH_SPEC, // SqlState = '28000' + DB_ERR_INVALID_CURSOR_NAME, // SqlState = '34000' + DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL, // SqlState = '37000' + DB_ERR_DUPLICATE_CURSOR_NAME, // SqlState = '3C000' + DB_ERR_SERIALIZATION_FAILURE, // SqlState = '40001' + DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2, // SqlState = '42000' + DB_ERR_OPERATION_ABORTED, // SqlState = '70100' + DB_ERR_UNSUPPORTED_FUNCTION, // SqlState = 'IM001' + DB_ERR_NO_DATA_SOURCE, // SqlState = 'IM002' + DB_ERR_DRIVER_LOAD_ERROR, // SqlState = 'IM003' + DB_ERR_SQLALLOCENV_FAILED, // SqlState = 'IM004' + DB_ERR_SQLALLOCCONNECT_FAILED, // SqlState = 'IM005' + DB_ERR_SQLSETCONNECTOPTION_FAILED, // SqlState = 'IM006' + DB_ERR_NO_DATA_SOURCE_DLG_PROHIB, // SqlState = 'IM007' + DB_ERR_DIALOG_FAILED, // SqlState = 'IM008' + DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL, // SqlState = 'IM009' + DB_ERR_DATA_SOURCE_NAME_TOO_LONG, // SqlState = 'IM010' + DB_ERR_DRIVER_NAME_TOO_LONG, // SqlState = 'IM011' + DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR, // SqlState = 'IM012' + DB_ERR_TRACE_FILE_ERROR, // SqlState = 'IM013' + DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS, // SqlState = 'S0001' + DB_ERR_TABLE_NOT_FOUND, // SqlState = 'S0002' + DB_ERR_INDEX_ALREADY_EXISTS, // SqlState = 'S0011' + DB_ERR_INDEX_NOT_FOUND, // SqlState = 'S0012' + DB_ERR_COLUMN_ALREADY_EXISTS, // SqlState = 'S0021' + DB_ERR_COLUMN_NOT_FOUND, // SqlState = 'S0022' + DB_ERR_NO_DEFAULT_FOR_COLUMN, // SqlState = 'S0023' + DB_ERR_GENERAL_ERROR, // SqlState = 'S1000' + DB_ERR_MEMORY_ALLOCATION_FAILURE, // SqlState = 'S1001' + DB_ERR_INVALID_COLUMN_NUMBER, // SqlState = 'S1002' + DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE, // SqlState = 'S1003' + DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE, // SqlState = 'S1004' + DB_ERR_OPERATION_CANCELLED, // SqlState = 'S1008' + DB_ERR_INVALID_ARGUMENT_VALUE, // SqlState = 'S1009' + DB_ERR_FUNCTION_SEQUENCE_ERROR, // SqlState = 'S1010' + DB_ERR_OPERATION_INVALID_AT_THIS_TIME, // SqlState = 'S1011' + DB_ERR_INVALID_TRANS_OPERATION_CODE, // SqlState = 'S1012' + DB_ERR_NO_CURSOR_NAME_AVAIL, // SqlState = 'S1015' + DB_ERR_INVALID_STR_OR_BUF_LEN, // SqlState = 'S1090' + DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE, // SqlState = 'S1091' + DB_ERR_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1092' + DB_ERR_INVALID_PARAM_NO, // SqlState = 'S1093' + DB_ERR_INVALID_SCALE_VALUE, // SqlState = 'S1094' + DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1095' + DB_ERR_INF_TYPE_OUT_OF_RANGE, // SqlState = 'S1096' + DB_ERR_COLUMN_TYPE_OUT_OF_RANGE, // SqlState = 'S1097' + DB_ERR_SCOPE_TYPE_OUT_OF_RANGE, // SqlState = 'S1098' + DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE, // SqlState = 'S1099' + DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1100' + DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1101' + DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE, // SqlState = 'S1103' + DB_ERR_INVALID_PRECISION_VALUE, // SqlState = 'S1104' + DB_ERR_INVALID_PARAM_TYPE, // SqlState = 'S1105' + DB_ERR_FETCH_TYPE_OUT_OF_RANGE, // SqlState = 'S1106' + DB_ERR_ROW_VALUE_OUT_OF_RANGE, // SqlState = 'S1107' + DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE, // SqlState = 'S1108' + DB_ERR_INVALID_CURSOR_POSITION, // SqlState = 'S1109' + DB_ERR_INVALID_DRIVER_COMPLETION, // SqlState = 'S1110' + DB_ERR_INVALID_BOOKMARK_VALUE, // SqlState = 'S1111' + DB_ERR_DRIVER_NOT_CAPABLE, // SqlState = 'S1C00' + DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00' +}; + +#ifndef MAXNAME + #define MAXNAME 31 +#endif + +#ifndef SQL_MAX_AUTHSTR_LEN + // There does not seem to be a standard for this, so I am + // defaulting to the value that MS uses + #define SQL_MAX_AUTHSTR_LEN MAXNAME +#endif + +#ifndef SQL_MAX_CONNECTSTR_LEN + // There does not seem to be a standard for this, so I am + // defaulting to the value that MS recommends + #define SQL_MAX_CONNECTSTR_LEN 1024 +#endif + + +class WXDLLIMPEXP_ODBC wxDbConnectInf +{ + private: + bool freeHenvOnDestroy; + bool useConnectionStr; + + public: + HENV Henv; + wxChar Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name + wxChar Uid[SQL_MAX_USER_NAME_LEN+1]; // User ID + wxChar AuthStr[SQL_MAX_AUTHSTR_LEN+1]; // Authorization string (password) + wxChar ConnectionStr[SQL_MAX_CONNECTSTR_LEN+1]; // Connection string (password) + + wxString Description; // Not sure what the max length is + wxString FileType; // Not sure what the max length is + + // Optionals needed for some databases like dBase + wxString DefaultDir; // Directory that db file resides in + + public: + + wxDbConnectInf(); + wxDbConnectInf(HENV henv, const wxString &dsn, const wxString &userID=wxEmptyString, + const wxString &password=wxEmptyString, const wxString &defaultDir=wxEmptyString, + const wxString &description=wxEmptyString, const wxString &fileType=wxEmptyString); + + ~wxDbConnectInf(); + + bool Initialize(); + + bool AllocHenv(); + void FreeHenv(); + + // Accessors + const HENV &GetHenv() { return Henv; } + + const wxChar *GetDsn() { return Dsn; } + + const wxChar *GetUid() { return Uid; } + const wxChar *GetUserID() { return Uid; } + + const wxChar *GetAuthStr() { return AuthStr; } + const wxChar *GetPassword() { return AuthStr; } + + const wxChar *GetConnectionStr() { return ConnectionStr; } + bool UseConnectionStr() { return useConnectionStr; } + + const wxChar *GetDescription() { return Description; } + const wxChar *GetFileType() { return FileType; } + const wxChar *GetDefaultDir() { return DefaultDir; } + + void SetHenv(const HENV henv) { Henv = henv; } + + void SetDsn(const wxString &dsn); + + void SetUserID(const wxString &userID); + void SetUid(const wxString &uid) { SetUserID(uid); } + + void SetPassword(const wxString &password); + void SetAuthStr(const wxString &authstr) { SetPassword(authstr); } + + void SetConnectionStr(const wxString &connectStr); + + void SetDescription(const wxString &desc) { Description = desc; } + void SetFileType(const wxString &fileType) { FileType = fileType; } + void SetDefaultDir(const wxString &defDir) { DefaultDir = defDir; } +}; // class wxDbConnectInf + + +struct WXDLLIMPEXP_ODBC wxDbSqlTypeInfo +{ + wxString TypeName; + SWORD FsqlType; + long Precision; + short CaseSensitive; + short MaximumScale; +}; + + +class WXDLLIMPEXP_ODBC wxDbColFor +{ +public: + wxString s_Field; // Formatted String for Output + wxString s_Format[7]; // Formatted Objects - TIMESTAMP has the biggest (7) + wxString s_Amount[7]; // Formatted Objects - amount of things that can be formatted + int i_Amount[7]; // Formatted Objects - TT MM YYYY HH MM SS m + int i_Nation; // 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US + int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes + SWORD i_sqlDataType; + + wxDbColFor(); + ~wxDbColFor(){} + + void Initialize(); + int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnLength, short decimalDigits); +}; + + +class WXDLLIMPEXP_ODBC wxDbColInf +{ +public: + wxChar catalog[128+1]; + wxChar schema[128+1]; + wxChar tableName[DB_MAX_TABLE_NAME_LEN+1]; + wxChar colName[DB_MAX_COLUMN_NAME_LEN+1]; + SWORD sqlDataType; + wxChar typeName[128+1]; + SWORD columnLength; + SWORD bufferSize; + short decimalDigits; + short numPrecRadix; + short nullable; + wxChar remarks[254+1]; + int dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes + // mj10777.19991224 : new + int PkCol; // Primary key column 0=No; 1= First Key, 2 = Second Key etc. + wxChar PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey + int FkCol; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc. + wxChar FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name + wxDbColFor *pColFor; // How should this columns be formatted + + wxDbColInf(); + ~wxDbColInf(); + + bool Initialize(); +}; + + +class WXDLLIMPEXP_ODBC wxDbTableInf // Description of a Table +{ +public: + wxChar tableName[DB_MAX_TABLE_NAME_LEN+1]; + wxChar tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc. + wxChar tableRemarks[254+1]; + UWORD numCols; // How many Columns does this Table have: GetColumnCount(..); + wxDbColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..); + + wxDbTableInf(); + ~wxDbTableInf(); + + bool Initialize(); +}; + + +class WXDLLIMPEXP_ODBC wxDbInf // Description of a Database +{ +public: + wxChar catalog[128+1]; + wxChar schema[128+1]; + int numTables; // How many tables does this database have + wxDbTableInf *pTableInf; // pTableInf = new wxDbTableInf[numTables]; + + wxDbInf(); + ~wxDbInf(); + + bool Initialize(); +}; + + +enum wxDbSqlLogState +{ + sqlLogOFF, + sqlLogON +}; + +// These are the databases currently tested and working with these classes +// See the comments in wxDb::Dbms() for exceptions/issues with +// each of these database engines +enum wxDBMS +{ + dbmsUNIDENTIFIED, + dbmsORACLE, + dbmsSYBASE_ASA, // Adaptive Server Anywhere + dbmsSYBASE_ASE, // Adaptive Server Enterprise + dbmsMS_SQL_SERVER, + dbmsMY_SQL, + dbmsPOSTGRES, + dbmsACCESS, + dbmsDBASE, + dbmsINFORMIX, + dbmsVIRTUOSO, + dbmsDB2, + dbmsINTERBASE, + dbmsPERVASIVE_SQL, + dbmsXBASE_SEQUITER, + dbmsFIREBIRD, + dbmsMAXDB, + dbmsFuture1, + dbmsFuture2, + dbmsFuture3, + dbmsFuture4, + dbmsFuture5, + dbmsFuture6, + dbmsFuture7, + dbmsFuture8, + dbmsFuture9, + dbmsFuture10 +}; + + +// The wxDb::errorList is copied to this variable when the wxDb object +// is closed. This way, the error list is still available after the +// database object is closed. This is necessary if the database +// connection fails so the calling application can show the operator +// why the connection failed. Note: as each wxDb object is closed, it +// will overwrite the errors of the previously destroyed wxDb object in +// this variable. + +extern WXDLLIMPEXP_DATA_ODBC(wxChar) + DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN+1]; + + +class WXDLLIMPEXP_ODBC wxDb +{ +private: + bool dbIsOpen; + bool dbIsCached; // Was connection created by caching functions + bool dbOpenedWithConnectionString; // Was the database connection opened with a connection string + wxString dsn; // Data source name + wxString uid; // User ID + wxString authStr; // Authorization string (password) + wxString inConnectionStr; // Connection string used to connect to the database + wxString outConnectionStr;// Connection string returned by the database when a connection is successfully opened + FILE *fpSqlLog; // Sql Log file pointer + wxDbSqlLogState sqlLogState; // On or Off + bool fwdOnlyCursors; + wxDBMS dbmsType; // Type of datasource - i.e. Oracle, dBase, SQLServer, etc + + // Private member functions + bool getDbInfo(bool failOnDataTypeUnsupported=true); + bool getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo); + bool setConnectionOptions(void); + void logError(const wxString &errMsg, const wxString &SQLState); + const wxChar *convertUserID(const wxChar *userID, wxString &UserID); + bool determineDataTypes(bool failOnDataTypeUnsupported); + void initialize(); + bool open(bool failOnDataTypeUnsupported=true); + +#if !wxODBC_BACKWARD_COMPATABILITY + // ODBC handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + + //Error reporting mode + bool silent; + + // Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!! + unsigned int nTables; + + // Information about logical data types VARCHAR, INTEGER, FLOAT and DATE. + // + // This information is obtained from the ODBC driver by use of the + // SQLGetTypeInfo() function. The key piece of information is the + // type name the data source uses for each logical data type. + // e.g. VARCHAR; Oracle calls it VARCHAR2. + wxDbSqlTypeInfo typeInfVarchar; + wxDbSqlTypeInfo typeInfInteger; + wxDbSqlTypeInfo typeInfFloat; + wxDbSqlTypeInfo typeInfDate; + wxDbSqlTypeInfo typeInfBlob; + wxDbSqlTypeInfo typeInfMemo; +#endif + +public: + + void setCached(bool cached) { dbIsCached = cached; } // This function must only be called by wxDbGetConnection() and wxDbCloseConnections!!! + bool IsCached() { return dbIsCached; } + + bool GetDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo) + { return getDataTypeInfo(fSqlType, structSQLTypeInfo); } + +#if wxODBC_BACKWARD_COMPATABILITY + // ODBC handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + + //Error reporting mode + bool silent; + + // Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!! + unsigned int nTables; +#endif + + // The following structure contains database information gathered from the + // datasource when the datasource is first opened. + struct + { + wxChar dbmsName[40]; // Name of the dbms product + wxChar dbmsVer[64]; // Version # of the dbms product + wxChar driverName[40]; // Driver name + wxChar odbcVer[60]; // ODBC version of the driver + wxChar drvMgrOdbcVer[60]; // ODBC version of the driver manager + wxChar driverVer[60]; // Driver version + wxChar serverName[80]; // Server Name, typically a connect string + wxChar databaseName[128]; // Database filename + wxChar outerJoins[2]; // Indicates whether the data source supports outer joins + wxChar procedureSupport[2]; // Indicates whether the data source supports stored procedures + wxChar accessibleTables[2]; // Indicates whether the data source only reports accessible tables in SQLTables. + UWORD maxConnections; // Maximum # of connections the data source supports + UWORD maxStmts; // Maximum # of HSTMTs per HDBC + UWORD apiConfLvl; // ODBC API conformance level + UWORD cliConfLvl; // Indicates whether the data source is SAG compliant + UWORD sqlConfLvl; // SQL conformance level + UWORD cursorCommitBehavior; // Indicates how cursors are affected by a db commit + UWORD cursorRollbackBehavior; // Indicates how cursors are affected by a db rollback + UWORD supportNotNullClause; // Indicates if data source supports NOT NULL clause + wxChar supportIEF[2]; // Integrity Enhancement Facility (Referential Integrity) + UDWORD txnIsolation; // Default transaction isolation level supported by the driver + UDWORD txnIsolationOptions; // Transaction isolation level options available + UDWORD fetchDirections; // Fetch directions supported + UDWORD lockTypes; // Lock types supported in SQLSetPos + UDWORD posOperations; // Position operations supported in SQLSetPos + UDWORD posStmts; // Position statements supported + UDWORD scrollConcurrency; // Concurrency control options supported for scrollable cursors + UDWORD scrollOptions; // Scroll Options supported for scrollable cursors + UDWORD staticSensitivity; // Indicates if additions, deletions and updates can be detected + UWORD txnCapable; // Indicates if the data source supports transactions + UDWORD loginTimeout; // Number seconds to wait for a login request + } dbInf; + + // ODBC Error Inf. + SWORD cbErrorMsg; + int DB_STATUS; +#ifdef __VMS + // The DECC compiler chokes when in db.cpp the array is accessed outside + // its bounds. Maybe this change should also applied for other platforms. + wxChar errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN+1]; +#else + wxChar errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]; +#endif + wxChar errorMsg[SQL_MAX_MESSAGE_LENGTH]; + SQLINTEGER nativeError; + wxChar sqlState[20]; + +#if wxODBC_BACKWARD_COMPATABILITY + // Information about logical data types VARCHAR, INTEGER, FLOAT and DATE. + // + // This information is obtained from the ODBC driver by use of the + // SQLGetTypeInfo() function. The key piece of information is the + // type name the data source uses for each logical data type. + // e.g. VARCHAR; Oracle calls it VARCHAR2. + wxDbSqlTypeInfo typeInfVarchar; + wxDbSqlTypeInfo typeInfInteger; + wxDbSqlTypeInfo typeInfFloat; + wxDbSqlTypeInfo typeInfDate; + wxDbSqlTypeInfo typeInfBlob; +#endif + + // Public member functions + wxDb(const HENV &aHenv, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); + ~wxDb(); + + // Data Source Name, User ID, Password and whether open should fail on data type not supported + bool Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported=true); + ///This version of Open will open the odbc source selection dialog. Cast a wxWindow::GetHandle() to SQLHWND to use. + bool Open(const wxString& inConnectStr, SQLHWND parentWnd, bool failOnDataTypeUnsupported=true); + bool Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthStr, bool failOnDataTypeUnsupported=true); + bool Open(wxDbConnectInf *dbConnectInf, bool failOnDataTypeUnsupported=true); + bool Open(wxDb *copyDb); // pointer to a wxDb whose connection info should be copied rather than re-queried + void Close(void); + bool CommitTrans(void); + bool RollbackTrans(void); + bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT); + bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT); + void DispNextError(void); + bool CreateView(const wxString &viewName, const wxString &colList, const wxString &pSqlStmt, bool attemptDrop=true); + bool DropView(const wxString &viewName); + bool ExecSql(const wxString &pSqlStmt); + bool ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols); + bool GetNext(void); + bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SQLLEN FAR *cbReturned); + bool Grant(int privileges, const wxString &tableName, const wxString &userList = wxT("PUBLIC")); + int TranslateSqlState(const wxString &SQLState); + wxDbInf *GetCatalog(const wxChar *userID=NULL); + bool Catalog(const wxChar *userID=NULL, const wxString &fileName=SQL_CATALOG_FILENAME); + int GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCols); + + wxDbColInf *GetColumns(wxChar *tableName[], const wxChar *userID=NULL); + wxDbColInf *GetColumns(const wxString &tableName, UWORD *numCols, const wxChar *userID=NULL); + + int GetColumnCount(const wxString &tableName, const wxChar *userID=NULL); + const wxChar *GetDatabaseName(void) {return dbInf.dbmsName;} + const wxString &GetDataSource(void) {return dsn;} + const wxString &GetDatasourceName(void){return dsn;} + const wxString &GetUsername(void) {return uid;} + const wxString &GetPassword(void) {return authStr;} + const wxString &GetConnectionInStr(void) {return inConnectionStr;} + const wxString &GetConnectionOutStr(void) {return outConnectionStr;} + bool IsOpen(void) {return dbIsOpen;} + bool OpenedWithConnectionString(void) {return dbOpenedWithConnectionString;} + HENV GetHENV(void) {return henv;} + HDBC GetHDBC(void) {return hdbc;} + HSTMT GetHSTMT(void) {return hstmt;} + int GetTableCount() {return nTables;} // number of tables using this connection + wxDbSqlTypeInfo GetTypeInfVarchar() {return typeInfVarchar;} + wxDbSqlTypeInfo GetTypeInfInteger() {return typeInfInteger;} + wxDbSqlTypeInfo GetTypeInfFloat() {return typeInfFloat;} + wxDbSqlTypeInfo GetTypeInfDate() {return typeInfDate;} + wxDbSqlTypeInfo GetTypeInfBlob() {return typeInfBlob;} + wxDbSqlTypeInfo GetTypeInfMemo() {return typeInfMemo;} + + // tableName can refer to a table, view, alias or synonym + bool TableExists(const wxString &tableName, const wxChar *userID=NULL, + const wxString &tablePath=wxEmptyString); + bool TablePrivileges(const wxString &tableName, const wxString &priv, + const wxChar *userID=NULL, const wxChar *schema=NULL, + const wxString &path=wxEmptyString); + + // These two functions return the table name or column name in a form ready + // for use in SQL statements. For example, if the datasource allows spaces + // in the table name or column name, the returned string will have the + // correct enclosing marks around the name to allow it to be properly + // included in a SQL statement + const wxString SQLTableName(const wxChar *tableName); + const wxString SQLColumnName(const wxChar *colName); + + void LogError(const wxString &errMsg, const wxString &SQLState = wxEmptyString) + { logError(errMsg, SQLState); } + void SetDebugErrorMessages(bool state) { silent = !state; } + bool SetSqlLogging(wxDbSqlLogState state, const wxString &filename = SQL_LOG_FILENAME, + bool append = false); + bool WriteSqlLog(const wxString &logMsg); + + wxDBMS Dbms(void); + bool ModifyColumn(const wxString &tableName, const wxString &columnName, + int dataType, ULONG columnLength=0, + const wxString &optionalParam=wxEmptyString); + + bool FwdOnlyCursors(void) {return fwdOnlyCursors;} + + // return the string with all special SQL characters escaped + wxString EscapeSqlChars(const wxString& value); + + // These two functions are provided strictly for use by wxDbTable. + // DO NOT USE THESE FUNCTIONS, OR MEMORY LEAKS MAY OCCUR + void incrementTableCount() { nTables++; return; } + void decrementTableCount() { nTables--; return; } + +}; // wxDb + + +// This structure forms a node in a linked list. The linked list of "DbList" objects +// keeps track of allocated database connections. This allows the application to +// open more than one database connection through ODBC for multiple transaction support +// or for multiple database support. +struct wxDbList +{ + wxDbList *PtrPrev; // Pointer to previous item in the list + wxString Dsn; // Data Source Name + wxString Uid; // User ID + wxString AuthStr; // Authorization string (password) + wxString ConnectionStr; // Connection string used instead of DSN + wxDb *PtrDb; // Pointer to the wxDb object + bool Free; // Is item free or in use? + wxDbList *PtrNext; // Pointer to next item in the list +}; + + +#ifdef __WXDEBUG__ +#include "wx/object.h" +class wxTablesInUse : public wxObject +{ + public: + const wxChar *tableName; + ULONG tableID; + class wxDb *pDb; +}; // wxTablesInUse +#endif + + +// The following routines allow a user to get new database connections, free them +// for other code segments to use, or close all of them when the application has +// completed. +wxDb WXDLLIMPEXP_ODBC *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); +bool WXDLLIMPEXP_ODBC wxDbFreeConnection(wxDb *pDb); +void WXDLLIMPEXP_ODBC wxDbCloseConnections(void); +int WXDLLIMPEXP_ODBC wxDbConnectionsInUse(void); + + +// Writes a message to the wxLog window (stdout usually) when an internal error +// situation occurs. This function only works in DEBUG builds +const wxChar WXDLLIMPEXP_ODBC * +wxDbLogExtendedErrorMsg(const wxChar *userText, + wxDb *pDb, + const wxChar *ErrFile, + int ErrLine); + + +// This function sets the sql log state for all open wxDb objects +bool WXDLLIMPEXP_ODBC +wxDbSqlLog(wxDbSqlLogState state, const wxString &filename = SQL_LOG_FILENAME); + + +#if 0 +// MSW/VC6 ONLY!!! Experimental +int WXDLLEXPORT wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const wxString &description=wxEmptyString, + bool sysDSN=false, const wxString &defDir=wxEmptyString, wxWindow *parent=NULL); +#endif + +// This routine allows you to query a driver manager +// for a list of available datasources. Call this routine +// the first time using SQL_FETCH_FIRST. Continue to call it +// using SQL_FETCH_NEXT until you've exhausted the list. +bool WXDLLIMPEXP_ODBC +wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMaxLength, wxChar *DsDesc, + SWORD DsDescMaxLength, UWORD direction = SQL_FETCH_NEXT); + + +// Change this to 0 to remove use of all deprecated functions +#if wxODBC_BACKWARD_COMPATABILITY +//################################################################################# +//############### DEPRECATED functions for backward compatibility ################# +//################################################################################# + +// Backward compability structures/classes. This will eventually go away +const int DB_PATH_MAX = wxDB_PATH_MAX; + +typedef wxDb wxDB; +typedef wxDbTableInf wxTableInf; +typedef wxDbColInf wxColInf; +typedef wxDbColInf CcolInf; +typedef wxDbColFor wxColFor; +typedef wxDbSqlTypeInfo SqlTypeInfo; +typedef wxDbSqlTypeInfo wxSqlTypeInfo; +typedef enum wxDbSqlLogState sqlLog; +typedef enum wxDbSqlLogState wxSqlLogState; +typedef enum wxDBMS dbms; +typedef enum wxDBMS DBMS; +typedef wxODBC_ERRORS ODBC_ERRORS; +typedef wxDbConnectInf DbStuff; +typedef wxDbList DbList; +#ifdef __WXDEBUG__ +typedef wxTablesInUse CstructTablesInUse; +#endif + +// Deprecated function names that are replaced by the function names listed above +wxDB WXDLLIMPEXP_ODBC +*GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); +bool WXDLLIMPEXP_ODBC FreeDbConnection(wxDB *pDb); +void WXDLLIMPEXP_ODBC CloseDbConnections(void); +int WXDLLIMPEXP_ODBC NumberDbConnectionsInUse(void); + +bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME); + +bool WXDLLIMPEXP_ODBC +GetDataSource(HENV henv, char *Dsn, SWORD DsnMaxLength, char *DsDesc, SWORD DsDescMaxLength, + UWORD direction = SQL_FETCH_NEXT); + +#endif // Deprecated structures/classes/functions + +#endif // _WX_DB_H_ + diff --git a/Externals/wxWidgets/include/wx/dbgrid.h b/Externals/wxWidgets/include/wx/dbgrid.h index d9bcaae693..4e8655cbe1 100644 --- a/Externals/wxWidgets/include/wx/dbgrid.h +++ b/Externals/wxWidgets/include/wx/dbgrid.h @@ -1,177 +1,177 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: dbgrid.h -// Purpose: Displays a wxDbTable in a wxGrid. -// Author: Roger Gammans, Paul Gammans -// Modified by: -// Created: -// RCS-ID: $Id: dbgrid.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 1999 The Computer Surgery (roger@computer-surgery.co.uk) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// -// Branched From : dbgrid.h,v 1.19 2001/03/28 11:16:01 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_DBGRID_H_ -#define _WX_GENERIC_DBGRID_H_ - -#if wxUSE_ODBC -#if wxUSE_GRID - -#include "wx/log.h" -#include "wx/dbtable.h" -#include "wx/dynarray.h" -#include "wx/grid.h" -#include "wx/dbkeyg.h" - -#define wxGRID_VALUE_DBAUTO _T("dbauto") - -WX_DECLARE_USER_EXPORTED_OBJARRAY(GenericKey,keyarray,WXDLLIMPEXP_DBGRID); - -static const int wxUSE_QUERY = -1; - -class WXDLLIMPEXP_DBGRID wxDbGridColInfoBase -{ -public: - //Default ctor - wxDbGridColInfoBase() { } - wxDbGridColInfoBase(int colNo, - wxString type, wxString title) : - DbCol(colNo), - wxtypename(type), - Title(title) - { } - //Copy Ctor - wxDbGridColInfoBase(const wxDbGridColInfoBase& ref) - { - DbCol = ref.DbCol; - wxtypename = ref.wxtypename; - Title = ref.Title; - } - //Empty destructor for member obj's - ~wxDbGridColInfoBase() {} - - int DbCol; - wxString wxtypename; - wxString Title; -}; - - -class WXDLLIMPEXP_DBGRID wxDbGridColInfo -{ -public: - wxDbGridColInfo(int colNo, - wxString type, - wxString title, - wxDbGridColInfo *next) : - m_data(colNo,type,title) - { - m_next=next; - } - - //Empty List - ~wxDbGridColInfo() { delete m_next; } - - //Recurse to find length. - int Length() { return (m_next ? m_next->Length() +1 : 1); } - - // Adds a new column info (2 step creation) - void AddColInfo (int colNo, - wxString type, - wxString title) - { - GetLast()->m_next = new wxDbGridColInfo (colNo, type, title, NULL); - } - - // Searches last - wxDbGridColInfo *GetLast() { return (m_next ? m_next->GetLast() : this); } - - - protected: - wxDbGridColInfoBase m_data; - wxDbGridColInfo *m_next; - - friend class wxDbGridTableBase; -}; - - -class WXDLLIMPEXP_DBGRID wxDbGridCellAttrProvider : public wxGridCellAttrProvider -{ -public: - wxDbGridCellAttrProvider(); - wxDbGridCellAttrProvider(wxDbTable *tab, wxDbGridColInfoBase* ColInfo); - virtual ~wxDbGridCellAttrProvider(); - - virtual wxGridCellAttr *GetAttr(int row, int col, - wxGridCellAttr::wxAttrKind kind) const; - virtual void AssignDbTable(wxDbTable *tab); -private: - wxDbTable *m_data; - wxDbGridColInfoBase *m_ColInfo; -}; - - -class WXDLLIMPEXP_DBGRID wxDbGridTableBase : public wxGridTableBase -{ -public: - wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo *ColInfo, - int count = wxUSE_QUERY, bool takeOwnership = true); - virtual ~wxDbGridTableBase(); - - virtual int GetNumberRows() - { - wxLogDebug(_T(" GetNumberRows() = %i"),m_rowtotal); - return m_rowtotal; - } - virtual int GetNumberCols() - { - wxLogDebug(_T(" GetNumberCols() = %i"),m_nocols); - return m_nocols; - } - virtual bool IsEmptyCell(int row, int col) ; - virtual wxString GetValue(int row, int col) ; - virtual void SetValue(int row, int col, const wxString& value); - virtual bool CanHaveAttributes(); - virtual wxString GetTypeName(int row, int col); - virtual bool CanGetValueAs(int row, int col, const wxString& typeName); - virtual bool CanSetValueAs(int row, int col, const wxString& typeName); - virtual long GetValueAsLong(int row, int col); - virtual double GetValueAsDouble(int row, int col); - virtual bool GetValueAsBool(int row, int col); - virtual void SetValueAsLong(int row, int col, long value); - virtual void SetValueAsDouble(int row, int col, double value); - virtual void SetValueAsBool(int row, int col, bool value); - virtual void *GetValueAsCustom(int row, int col, const wxString& typeName); - virtual void SetValueAsCustom(int row, int col, const wxString& typeName, void* value); - - - virtual wxString GetColLabelValue(int col); - - virtual bool AssignDbTable(wxDbTable *tab, int count = wxUSE_QUERY, bool takeOwnership=true); - virtual void ValidateRow(int row); - virtual bool UpdateRow(int row) const - { - if (m_row != row) - return true; - else - return Writeback(); - } - -private: - //Operates on the current row - bool Writeback() const; - - typedef wxGridTableBase inherited; - keyarray m_keys; - wxDbTable *m_data; - bool m_dbowner; - int m_rowtotal; - int m_nocols; - int m_row; - wxDbGridColInfoBase *m_ColInfo; - bool m_rowmodified; -}; - -#endif // #if wxUSE_GRID -#endif // #if wxUSE_ODBC - -#endif // _WX_GENERIC_DBGRID_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: dbgrid.h +// Purpose: Displays a wxDbTable in a wxGrid. +// Author: Roger Gammans, Paul Gammans +// Modified by: +// Created: +// RCS-ID: $Id: dbgrid.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) 1999 The Computer Surgery (roger@computer-surgery.co.uk) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// +// Branched From : dbgrid.h,v 1.19 2001/03/28 11:16:01 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_DBGRID_H_ +#define _WX_GENERIC_DBGRID_H_ + +#if wxUSE_ODBC +#if wxUSE_GRID + +#include "wx/log.h" +#include "wx/dbtable.h" +#include "wx/dynarray.h" +#include "wx/grid.h" +#include "wx/dbkeyg.h" + +#define wxGRID_VALUE_DBAUTO _T("dbauto") + +WX_DECLARE_USER_EXPORTED_OBJARRAY(GenericKey,keyarray,WXDLLIMPEXP_DBGRID); + +static const int wxUSE_QUERY = -1; + +class WXDLLIMPEXP_DBGRID wxDbGridColInfoBase +{ +public: + //Default ctor + wxDbGridColInfoBase() { } + wxDbGridColInfoBase(int colNo, + wxString type, wxString title) : + DbCol(colNo), + wxtypename(type), + Title(title) + { } + //Copy Ctor + wxDbGridColInfoBase(const wxDbGridColInfoBase& ref) + { + DbCol = ref.DbCol; + wxtypename = ref.wxtypename; + Title = ref.Title; + } + //Empty destructor for member obj's + ~wxDbGridColInfoBase() {} + + int DbCol; + wxString wxtypename; + wxString Title; +}; + + +class WXDLLIMPEXP_DBGRID wxDbGridColInfo +{ +public: + wxDbGridColInfo(int colNo, + wxString type, + wxString title, + wxDbGridColInfo *next) : + m_data(colNo,type,title) + { + m_next=next; + } + + //Empty List + ~wxDbGridColInfo() { delete m_next; } + + //Recurse to find length. + int Length() { return (m_next ? m_next->Length() +1 : 1); } + + // Adds a new column info (2 step creation) + void AddColInfo (int colNo, + wxString type, + wxString title) + { + GetLast()->m_next = new wxDbGridColInfo (colNo, type, title, NULL); + } + + // Searches last + wxDbGridColInfo *GetLast() { return (m_next ? m_next->GetLast() : this); } + + + protected: + wxDbGridColInfoBase m_data; + wxDbGridColInfo *m_next; + + friend class wxDbGridTableBase; +}; + + +class WXDLLIMPEXP_DBGRID wxDbGridCellAttrProvider : public wxGridCellAttrProvider +{ +public: + wxDbGridCellAttrProvider(); + wxDbGridCellAttrProvider(wxDbTable *tab, wxDbGridColInfoBase* ColInfo); + virtual ~wxDbGridCellAttrProvider(); + + virtual wxGridCellAttr *GetAttr(int row, int col, + wxGridCellAttr::wxAttrKind kind) const; + virtual void AssignDbTable(wxDbTable *tab); +private: + wxDbTable *m_data; + wxDbGridColInfoBase *m_ColInfo; +}; + + +class WXDLLIMPEXP_DBGRID wxDbGridTableBase : public wxGridTableBase +{ +public: + wxDbGridTableBase(wxDbTable *tab, wxDbGridColInfo *ColInfo, + int count = wxUSE_QUERY, bool takeOwnership = true); + virtual ~wxDbGridTableBase(); + + virtual int GetNumberRows() + { + wxLogDebug(_T(" GetNumberRows() = %i"),m_rowtotal); + return m_rowtotal; + } + virtual int GetNumberCols() + { + wxLogDebug(_T(" GetNumberCols() = %i"),m_nocols); + return m_nocols; + } + virtual bool IsEmptyCell(int row, int col) ; + virtual wxString GetValue(int row, int col) ; + virtual void SetValue(int row, int col, const wxString& value); + virtual bool CanHaveAttributes(); + virtual wxString GetTypeName(int row, int col); + virtual bool CanGetValueAs(int row, int col, const wxString& typeName); + virtual bool CanSetValueAs(int row, int col, const wxString& typeName); + virtual long GetValueAsLong(int row, int col); + virtual double GetValueAsDouble(int row, int col); + virtual bool GetValueAsBool(int row, int col); + virtual void SetValueAsLong(int row, int col, long value); + virtual void SetValueAsDouble(int row, int col, double value); + virtual void SetValueAsBool(int row, int col, bool value); + virtual void *GetValueAsCustom(int row, int col, const wxString& typeName); + virtual void SetValueAsCustom(int row, int col, const wxString& typeName, void* value); + + + virtual wxString GetColLabelValue(int col); + + virtual bool AssignDbTable(wxDbTable *tab, int count = wxUSE_QUERY, bool takeOwnership=true); + virtual void ValidateRow(int row); + virtual bool UpdateRow(int row) const + { + if (m_row != row) + return true; + else + return Writeback(); + } + +private: + //Operates on the current row + bool Writeback() const; + + typedef wxGridTableBase inherited; + keyarray m_keys; + wxDbTable *m_data; + bool m_dbowner; + int m_rowtotal; + int m_nocols; + int m_row; + wxDbGridColInfoBase *m_ColInfo; + bool m_rowmodified; +}; + +#endif // #if wxUSE_GRID +#endif // #if wxUSE_ODBC + +#endif // _WX_GENERIC_DBGRID_H_ diff --git a/Externals/wxWidgets/include/wx/dbkeyg.h b/Externals/wxWidgets/include/wx/dbkeyg.h index 49efb9912c..eb91f1ce16 100644 --- a/Externals/wxWidgets/include/wx/dbkeyg.h +++ b/Externals/wxWidgets/include/wx/dbkeyg.h @@ -1,41 +1,41 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: dbkeyg.h -// Purpose: Generic key support for wxDbTable -// Author: Roger Gammans -// Modified by: -// Created: -// RCS-ID: $Id: dbkeyg.h 29077 2004-09-10 12:56:07Z ABX $ -// Copyright: (c) 1999 The Computer Surgery (roger@computer-surgery.co.uk) -// Licence: wxWindows licence -// -// NOTE : There is no CPP file to go along with this -// -/////////////////////////////////////////////////////////////////////////////// -// Branched From : gkey.h,v 1.3 2001/06/01 10:31:41 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DBGKEY_H_ -#define _WX_DBGKEY_H_ - -class GenericKey -{ -public: - GenericKey(void *blk, size_t sz) { clone(blk,sz); } - GenericKey(const GenericKey &ref) { clone(ref.m_data,ref.m_sz); } - ~GenericKey() { free(m_data); } - - void *GetBlk(void) const { return m_data; } - -private: - void clone(void *blk, size_t sz) - { - m_data = malloc(sz); - memcpy(m_data,blk,sz); - m_sz = sz; - } - - void *m_data; - size_t m_sz; -}; - -#endif // _WX_DBGKEY_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: dbkeyg.h +// Purpose: Generic key support for wxDbTable +// Author: Roger Gammans +// Modified by: +// Created: +// RCS-ID: $Id: dbkeyg.h 29077 2004-09-10 12:56:07Z ABX $ +// Copyright: (c) 1999 The Computer Surgery (roger@computer-surgery.co.uk) +// Licence: wxWindows licence +// +// NOTE : There is no CPP file to go along with this +// +/////////////////////////////////////////////////////////////////////////////// +// Branched From : gkey.h,v 1.3 2001/06/01 10:31:41 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DBGKEY_H_ +#define _WX_DBGKEY_H_ + +class GenericKey +{ +public: + GenericKey(void *blk, size_t sz) { clone(blk,sz); } + GenericKey(const GenericKey &ref) { clone(ref.m_data,ref.m_sz); } + ~GenericKey() { free(m_data); } + + void *GetBlk(void) const { return m_data; } + +private: + void clone(void *blk, size_t sz) + { + m_data = malloc(sz); + memcpy(m_data,blk,sz); + m_sz = sz; + } + + void *m_data; + size_t m_sz; +}; + +#endif // _WX_DBGKEY_H_ diff --git a/Externals/wxWidgets/include/wx/dbtable.h b/Externals/wxWidgets/include/wx/dbtable.h index b3e1f7d8c1..1bbef54d76 100644 --- a/Externals/wxWidgets/include/wx/dbtable.h +++ b/Externals/wxWidgets/include/wx/dbtable.h @@ -1,377 +1,377 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: dbtable.h -// Purpose: Declaration of the wxDbTable class. -// Author: Doug Card -// Modified by: George Tasker -// Bart Jourquin -// Mark Johnson -// Created: 9.96 -// RCS-ID: $Id: dbtable.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1996 Remstar International, Inc. -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* -// SYNOPSIS START -// SYNOPSIS STOP -*/ - -#ifndef DBTABLE_DOT_H -#define DBTABLE_DOT_H - -#include "wx/defs.h" - -#include "wx/db.h" - -#include "wx/variant.h" -#include "wx/dbkeyg.h" - -const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger -const int wxDB_DEFAULT_CURSOR = 0; -const bool wxDB_QUERY_ONLY = true; -const bool wxDB_DISABLE_VIEW = true; - -// Used to indicate end of a variable length list of -// column numbers passed to member functions -const int wxDB_NO_MORE_COLUMN_NUMBERS = -1; - -// The following class is used to define a column of a table. -// The wxDbTable constructor will dynamically allocate as many of -// these as there are columns in the table. The class derived -// from wxDbTable must initialize these column definitions in it's -// constructor. These column definitions provide inf. to the -// wxDbTable class which allows it to create a table in the data -// source, exchange data between the data source and the C++ -// object, and so on. -class WXDLLIMPEXP_ODBC wxDbColDef -{ -public: - wxChar ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name - int DbDataType; // Logical Data Type; e.g. DB_DATA_TYPE_INTEGER - SWORD SqlCtype; // C data type; e.g. SQL_C_LONG - void *PtrDataObj; // Address of the data object - int SzDataObj; // Size, in bytes, of the data object - bool KeyField; // true if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields. - bool Updateable; // Specifies whether this column is updateable - bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement - bool DerivedCol; // Specifies whether this column is a derived value - SQLLEN CbValue; // Internal use only!!! - bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates - - wxDbColDef(); - - bool Initialize(); -}; // wxDbColDef - - -class WXDLLIMPEXP_ODBC wxDbColDataPtr -{ -public: - void *PtrDataObj; - int SzDataObj; - SWORD SqlCtype; -}; // wxDbColDataPtr - - -// This structure is used when creating secondary indexes. -class WXDLLIMPEXP_ODBC wxDbIdxDef -{ -public: - wxChar ColName[DB_MAX_COLUMN_NAME_LEN+1]; - bool Ascending; -}; // wxDbIdxDef - - -class WXDLLIMPEXP_ODBC wxDbTable -{ -private: - ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors - - // Private member variables - UDWORD cursorType; - bool insertable; - - // Private member functions - bool initialize(wxDb *pwxDb, const wxString &tblName, const UWORD numColumns, - const wxString &qryTblName, bool qryOnly, const wxString &tblPath); - void cleanup(); - - void setCbValueForColumn(int columnIndex); - bool bindParams(bool forUpdate); // called by the other 'bind' functions - bool bindInsertParams(void); - bool bindUpdateParams(void); - - bool bindCols(HSTMT cursor); - bool getRec(UWORD fetchType); - bool execDelete(const wxString &pSqlStmt); - bool execUpdate(const wxString &pSqlStmt); - bool query(int queryType, bool forUpdate, bool distinct, const wxString &pSqlStmt=wxEmptyString); - -#if !wxODBC_BACKWARD_COMPATABILITY -// these were public - // Where, Order By and From clauses - wxString where; // Standard SQL where clause, minus the word WHERE - wxString orderBy; // Standard SQL order by clause, minus the ORDER BY - wxString from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..." - - // ODBC Handles - HENV henv; // ODBC Environment handle - HDBC hdbc; // ODBC DB Connection handle - HSTMT hstmt; // ODBC Statement handle - HSTMT *hstmtDefault; // Default cursor - HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts - HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes - HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates - HSTMT hstmtInternal; // ODBC Statement handle used internally only - HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) - - // Flags - bool selectForUpdate; - - // Pointer to the database object this table belongs to - wxDb *pDb; - - // Table Inf. - wxString tablePath; // needed for dBase tables - wxString tableName; // Table name - wxString queryTableName; // Query Table Name - UWORD m_numCols; // # of columns in the table - bool queryOnly; // Query Only, no inserts, updates or deletes - - // Column Definitions - wxDbColDef *colDefs; // Array of wxDbColDef structures -#endif -public: -#if wxODBC_BACKWARD_COMPATABILITY - // Where, Order By and From clauses - char *where; // Standard SQL where clause, minus the word WHERE - char *orderBy; // Standard SQL order by clause, minus the ORDER BY - char *from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..." - - // ODBC Handles - HENV henv; // ODBC Environment handle - HDBC hdbc; // ODBC DB Connection handle - HSTMT hstmt; // ODBC Statement handle - HSTMT *hstmtDefault; // Default cursor - HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts - HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes - HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates - HSTMT hstmtInternal; // ODBC Statement handle used internally only - HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) - - // Flags - bool selectForUpdate; - - // Pointer to the database object this table belongs to - wxDb *pDb; - - // Table Inf. - char tablePath[wxDB_PATH_MAX]; // needed for dBase tables - char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name - char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name - UWORD m_numCols; // # of columns in the table - bool queryOnly; // Query Only, no inserts, updates or deletes - - // Column Definitions - wxDbColDef *colDefs; // Array of wxDbColDef structures -#endif - // Public member functions - wxDbTable(wxDb *pwxDb, const wxString &tblName, const UWORD numColumns, - const wxString &qryTblName=wxEmptyString, bool qryOnly = !wxDB_QUERY_ONLY, - const wxString &tblPath=wxEmptyString); - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( - wxDbTable(wxDb *pwxDb, const wxString &tblName, const UWORD numColumns, - const wxChar *qryTblName, bool qryOnly, - const wxString &tblPath) - ); -#endif // WXWIN_COMPATIBILITY_2_4 - - virtual ~wxDbTable(); - - bool Open(bool checkPrivileges=false, bool checkTableExists=true); - bool CreateTable(bool attemptDrop=true); - bool DropTable(void); - bool CreateIndex(const wxString &indexName, bool unique, UWORD numIndexColumns, - wxDbIdxDef *pIndexDefs, bool attemptDrop=true); - bool DropIndex(const wxString &indexName); - - // Accessors - - // The member variables returned by these accessors are all - // set when the wxDbTable instance is created and cannot be - // changed, hence there is no corresponding SetXxxx function - wxDb *GetDb() { return pDb; } - const wxString &GetTableName() { return tableName; } - const wxString &GetQueryTableName() { return queryTableName; } - const wxString &GetTablePath() { return tablePath; } - - UWORD GetNumberOfColumns() { return m_numCols; } // number of "defined" columns for this wxDbTable instance - - const wxString &GetFromClause() { return from; } - const wxString &GetOrderByClause() { return orderBy; } - const wxString &GetWhereClause() { return where; } - - bool IsQueryOnly() { return queryOnly; } -#if wxODBC_BACKWARD_COMPATABILITY - void SetFromClause(const char *From) { from = (char *)From; } - void SetOrderByClause(const char *OrderBy) { orderBy = (char *)OrderBy; } - void SetWhereClause(const char *Where) { where = (char *)Where; } -#else - void SetFromClause(const wxString &From) { from = From; } - void SetOrderByClause(const wxString &OrderBy) { orderBy = OrderBy; } - bool SetOrderByColNums(UWORD first, ...); - void SetWhereClause(const wxString &Where) { where = Where; } - void From(const wxString &From) { from = From; } - void OrderBy(const wxString &OrderBy) { orderBy = OrderBy; } - void Where(const wxString &Where) { where = Where; } - const wxString &Where() { return where; } - const wxString &OrderBy() { return orderBy; } - const wxString &From() { return from; } -#endif - int Insert(void); - bool Update(void); - bool Update(const wxString &pSqlStmt); - bool UpdateWhere(const wxString &pWhereClause); - bool Delete(void); - bool DeleteWhere(const wxString &pWhereClause); - bool DeleteMatching(void); - virtual bool Query(bool forUpdate = false, bool distinct = false); - bool QueryBySqlStmt(const wxString &pSqlStmt); - bool QueryMatching(bool forUpdate = false, bool distinct = false); - bool QueryOnKeyFields(bool forUpdate = false, bool distinct = false); - bool Refresh(void); - bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); } - bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); } - - /***** These four functions only work with wxDb instances that are defined ***** - ***** as not being FwdOnlyCursors *****/ - bool GetPrev(void); - bool operator--(int); - bool GetFirst(void); - bool GetLast(void); - - bool IsCursorClosedOnCommit(void); - UWORD GetRowNum(void); - - void BuildSelectStmt(wxString &pSqlStmt, int typeOfSelect, bool distinct); - void BuildSelectStmt(wxChar *pSqlStmt, int typeOfSelect, bool distinct); - - void BuildDeleteStmt(wxString &pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString); - void BuildDeleteStmt(wxChar *pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString); - - void BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpdate, const wxString &pWhereClause=wxEmptyString); - void BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpdate, const wxString &pWhereClause=wxEmptyString); - - void BuildWhereClause(wxString &pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false); - void BuildWhereClause(wxChar *pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false); - -#if wxODBC_BACKWARD_COMPATABILITY -// The following member functions are deprecated. You should use the BuildXxxxxStmt functions (above) - void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) - { BuildSelectStmt(pSqlStmt,typeOfSelect,distinct); } - void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = NULL) - { BuildDeleteStmt(pSqlStmt,typeOfDel,pWhereClause); } - void GetUpdateStmt(char *pSqlStmt, int typeOfUpdate, const char *pWhereClause = NULL) - { BuildUpdateStmt(pSqlStmt,typeOfUpdate,pWhereClause); } - void GetWhereClause(char *pWhereClause, int typeOfWhere, - const char *qualTableName = NULL, bool useLikeComparison=false) - { BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); } -#endif - bool CanSelectForUpdate(void); -#if wxODBC_BACKWARD_COMPATABILITY - bool CanUpdByROWID(void) { return CanUpdateByRowID(); }; -#endif - bool CanUpdateByROWID(void); - void ClearMemberVar(UWORD colNumber, bool setToNull=false); - void ClearMemberVars(bool setToNull=false); - bool SetQueryTimeout(UDWORD nSeconds); - - wxDbColDef *GetColDefs() { return colDefs; } - bool SetColDefs(UWORD index, const wxString &fieldName, int dataType, - void *pData, SWORD cType, - int size, bool keyField = false, bool updateable = true, - bool insertAllowed = true, bool derivedColumn = false); - wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, UWORD numCols); - - bool CloseCursor(HSTMT cursor); - bool DeleteCursor(HSTMT *hstmtDel); - void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR); - HSTMT GetCursor(void) { return(hstmt); } - HSTMT *GetNewCursor(bool setCursor = false, bool bindColumns = true); -#if wxODBC_BACKWARD_COMPATABILITY -// The following member function is deprecated. You should use the GetNewCursor - HSTMT *NewCursor(bool setCursor = false, bool bindColumns = true) { return GetNewCursor(setCursor,bindColumns); } -#endif - - ULONG Count(const wxString &args=_T("*")); - int DB_STATUS(void) { return(pDb->DB_STATUS); } - - bool IsColNull(UWORD colNumber) const; - bool SetColNull(UWORD colNumber, bool set=true); - bool SetColNull(const wxString &colName, bool set=true); -#if wxODBC_BACKWARD_COMPATABILITY -// The following member functions are deprecated. You should use the SetColNull() - bool SetNull(int colNumber, bool set=true) { return (SetNull(colNumber,set)); } - bool SetNull(const char *colName, bool set=true) { return (SetNull(colName,set)); } -#endif -#ifdef __WXDEBUG__ - ULONG GetTableID() { return tableID; } -#endif - -//TODO: Need to Document - typedef enum { WX_ROW_MODE_QUERY , WX_ROW_MODE_INDIVIDUAL } rowmode_t; - virtual void SetRowMode(const rowmode_t rowmode); -#if wxODBC_BACKWARD_COMPATABILITY - virtual wxVariant GetCol(const int colNumber) const { return GetColumn(colNumber); }; - virtual void SetCol(const int colNumber, const wxVariant value) { return SetColumn(colNumber, value); }; -#endif - virtual wxVariant GetColumn(const int colNumber) const ; - virtual void SetColumn(const int colNumber, const wxVariant value); - virtual GenericKey GetKey(void); - virtual void SetKey(const GenericKey &key); - - private: - HSTMT *m_hstmtGridQuery; - rowmode_t m_rowmode; - size_t m_keysize; - -// typedef enum {unmodified=0, UpdatePending, InsertPending } recStatus; - -// recStatus get_ModifiedStatus() { return m_recstatus; } - -// void modify() { -// if (m_recstatus==unmodified) -// m_recstatus=UpdatePending; -// } -// protected: -// void insertify() {m_recstatus=InsertPending; } -// void unmodify() {m_recstatus=unmodified; } -// recStatus m_recstatus; -//TODO: Need to Document -}; // wxDbTable - - -// Change this to 0 to remove use of all deprecated functions -#if wxODBC_BACKWARD_COMPATABILITY -//################################################################################# -//############### DEPRECATED functions for backward compatibility ################# -//################################################################################# - -// Backward compability. These will eventually go away -typedef wxDbTable wxTable; -typedef wxDbIdxDef wxIdxDef; -typedef wxDbIdxDef CidxDef; -typedef wxDbColDef wxColDef; -typedef wxDbColDef CcolDef; -typedef wxDbColDataPtr wxColDataPtr; -typedef wxDbColDataPtr CcolDataPtr; - -const int ROWID = wxDB_ROWID_LEN; -const int DEFAULT_CURSOR = wxDB_DEFAULT_CURSOR; -const bool QUERY_ONLY = wxDB_QUERY_ONLY; -const bool DISABLE_VIEW = wxDB_DISABLE_VIEW; -#endif - -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: dbtable.h +// Purpose: Declaration of the wxDbTable class. +// Author: Doug Card +// Modified by: George Tasker +// Bart Jourquin +// Mark Johnson +// Created: 9.96 +// RCS-ID: $Id: dbtable.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1996 Remstar International, Inc. +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* +// SYNOPSIS START +// SYNOPSIS STOP +*/ + +#ifndef DBTABLE_DOT_H +#define DBTABLE_DOT_H + +#include "wx/defs.h" + +#include "wx/db.h" + +#include "wx/variant.h" +#include "wx/dbkeyg.h" + +const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger +const int wxDB_DEFAULT_CURSOR = 0; +const bool wxDB_QUERY_ONLY = true; +const bool wxDB_DISABLE_VIEW = true; + +// Used to indicate end of a variable length list of +// column numbers passed to member functions +const int wxDB_NO_MORE_COLUMN_NUMBERS = -1; + +// The following class is used to define a column of a table. +// The wxDbTable constructor will dynamically allocate as many of +// these as there are columns in the table. The class derived +// from wxDbTable must initialize these column definitions in it's +// constructor. These column definitions provide inf. to the +// wxDbTable class which allows it to create a table in the data +// source, exchange data between the data source and the C++ +// object, and so on. +class WXDLLIMPEXP_ODBC wxDbColDef +{ +public: + wxChar ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name + int DbDataType; // Logical Data Type; e.g. DB_DATA_TYPE_INTEGER + SWORD SqlCtype; // C data type; e.g. SQL_C_LONG + void *PtrDataObj; // Address of the data object + int SzDataObj; // Size, in bytes, of the data object + bool KeyField; // true if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields. + bool Updateable; // Specifies whether this column is updateable + bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement + bool DerivedCol; // Specifies whether this column is a derived value + SQLLEN CbValue; // Internal use only!!! + bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates + + wxDbColDef(); + + bool Initialize(); +}; // wxDbColDef + + +class WXDLLIMPEXP_ODBC wxDbColDataPtr +{ +public: + void *PtrDataObj; + int SzDataObj; + SWORD SqlCtype; +}; // wxDbColDataPtr + + +// This structure is used when creating secondary indexes. +class WXDLLIMPEXP_ODBC wxDbIdxDef +{ +public: + wxChar ColName[DB_MAX_COLUMN_NAME_LEN+1]; + bool Ascending; +}; // wxDbIdxDef + + +class WXDLLIMPEXP_ODBC wxDbTable +{ +private: + ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors + + // Private member variables + UDWORD cursorType; + bool insertable; + + // Private member functions + bool initialize(wxDb *pwxDb, const wxString &tblName, const UWORD numColumns, + const wxString &qryTblName, bool qryOnly, const wxString &tblPath); + void cleanup(); + + void setCbValueForColumn(int columnIndex); + bool bindParams(bool forUpdate); // called by the other 'bind' functions + bool bindInsertParams(void); + bool bindUpdateParams(void); + + bool bindCols(HSTMT cursor); + bool getRec(UWORD fetchType); + bool execDelete(const wxString &pSqlStmt); + bool execUpdate(const wxString &pSqlStmt); + bool query(int queryType, bool forUpdate, bool distinct, const wxString &pSqlStmt=wxEmptyString); + +#if !wxODBC_BACKWARD_COMPATABILITY +// these were public + // Where, Order By and From clauses + wxString where; // Standard SQL where clause, minus the word WHERE + wxString orderBy; // Standard SQL order by clause, minus the ORDER BY + wxString from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..." + + // ODBC Handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + HSTMT *hstmtDefault; // Default cursor + HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts + HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes + HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates + HSTMT hstmtInternal; // ODBC Statement handle used internally only + HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) + + // Flags + bool selectForUpdate; + + // Pointer to the database object this table belongs to + wxDb *pDb; + + // Table Inf. + wxString tablePath; // needed for dBase tables + wxString tableName; // Table name + wxString queryTableName; // Query Table Name + UWORD m_numCols; // # of columns in the table + bool queryOnly; // Query Only, no inserts, updates or deletes + + // Column Definitions + wxDbColDef *colDefs; // Array of wxDbColDef structures +#endif +public: +#if wxODBC_BACKWARD_COMPATABILITY + // Where, Order By and From clauses + char *where; // Standard SQL where clause, minus the word WHERE + char *orderBy; // Standard SQL order by clause, minus the ORDER BY + char *from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..." + + // ODBC Handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + HSTMT *hstmtDefault; // Default cursor + HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts + HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes + HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates + HSTMT hstmtInternal; // ODBC Statement handle used internally only + HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) + + // Flags + bool selectForUpdate; + + // Pointer to the database object this table belongs to + wxDb *pDb; + + // Table Inf. + char tablePath[wxDB_PATH_MAX]; // needed for dBase tables + char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name + char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name + UWORD m_numCols; // # of columns in the table + bool queryOnly; // Query Only, no inserts, updates or deletes + + // Column Definitions + wxDbColDef *colDefs; // Array of wxDbColDef structures +#endif + // Public member functions + wxDbTable(wxDb *pwxDb, const wxString &tblName, const UWORD numColumns, + const wxString &qryTblName=wxEmptyString, bool qryOnly = !wxDB_QUERY_ONLY, + const wxString &tblPath=wxEmptyString); + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( + wxDbTable(wxDb *pwxDb, const wxString &tblName, const UWORD numColumns, + const wxChar *qryTblName, bool qryOnly, + const wxString &tblPath) + ); +#endif // WXWIN_COMPATIBILITY_2_4 + + virtual ~wxDbTable(); + + bool Open(bool checkPrivileges=false, bool checkTableExists=true); + bool CreateTable(bool attemptDrop=true); + bool DropTable(void); + bool CreateIndex(const wxString &indexName, bool unique, UWORD numIndexColumns, + wxDbIdxDef *pIndexDefs, bool attemptDrop=true); + bool DropIndex(const wxString &indexName); + + // Accessors + + // The member variables returned by these accessors are all + // set when the wxDbTable instance is created and cannot be + // changed, hence there is no corresponding SetXxxx function + wxDb *GetDb() { return pDb; } + const wxString &GetTableName() { return tableName; } + const wxString &GetQueryTableName() { return queryTableName; } + const wxString &GetTablePath() { return tablePath; } + + UWORD GetNumberOfColumns() { return m_numCols; } // number of "defined" columns for this wxDbTable instance + + const wxString &GetFromClause() { return from; } + const wxString &GetOrderByClause() { return orderBy; } + const wxString &GetWhereClause() { return where; } + + bool IsQueryOnly() { return queryOnly; } +#if wxODBC_BACKWARD_COMPATABILITY + void SetFromClause(const char *From) { from = (char *)From; } + void SetOrderByClause(const char *OrderBy) { orderBy = (char *)OrderBy; } + void SetWhereClause(const char *Where) { where = (char *)Where; } +#else + void SetFromClause(const wxString &From) { from = From; } + void SetOrderByClause(const wxString &OrderBy) { orderBy = OrderBy; } + bool SetOrderByColNums(UWORD first, ...); + void SetWhereClause(const wxString &Where) { where = Where; } + void From(const wxString &From) { from = From; } + void OrderBy(const wxString &OrderBy) { orderBy = OrderBy; } + void Where(const wxString &Where) { where = Where; } + const wxString &Where() { return where; } + const wxString &OrderBy() { return orderBy; } + const wxString &From() { return from; } +#endif + int Insert(void); + bool Update(void); + bool Update(const wxString &pSqlStmt); + bool UpdateWhere(const wxString &pWhereClause); + bool Delete(void); + bool DeleteWhere(const wxString &pWhereClause); + bool DeleteMatching(void); + virtual bool Query(bool forUpdate = false, bool distinct = false); + bool QueryBySqlStmt(const wxString &pSqlStmt); + bool QueryMatching(bool forUpdate = false, bool distinct = false); + bool QueryOnKeyFields(bool forUpdate = false, bool distinct = false); + bool Refresh(void); + bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); } + bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); } + + /***** These four functions only work with wxDb instances that are defined ***** + ***** as not being FwdOnlyCursors *****/ + bool GetPrev(void); + bool operator--(int); + bool GetFirst(void); + bool GetLast(void); + + bool IsCursorClosedOnCommit(void); + UWORD GetRowNum(void); + + void BuildSelectStmt(wxString &pSqlStmt, int typeOfSelect, bool distinct); + void BuildSelectStmt(wxChar *pSqlStmt, int typeOfSelect, bool distinct); + + void BuildDeleteStmt(wxString &pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString); + void BuildDeleteStmt(wxChar *pSqlStmt, int typeOfDel, const wxString &pWhereClause=wxEmptyString); + + void BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpdate, const wxString &pWhereClause=wxEmptyString); + void BuildUpdateStmt(wxChar *pSqlStmt, int typeOfUpdate, const wxString &pWhereClause=wxEmptyString); + + void BuildWhereClause(wxString &pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false); + void BuildWhereClause(wxChar *pWhereClause, int typeOfWhere, const wxString &qualTableName=wxEmptyString, bool useLikeComparison=false); + +#if wxODBC_BACKWARD_COMPATABILITY +// The following member functions are deprecated. You should use the BuildXxxxxStmt functions (above) + void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) + { BuildSelectStmt(pSqlStmt,typeOfSelect,distinct); } + void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = NULL) + { BuildDeleteStmt(pSqlStmt,typeOfDel,pWhereClause); } + void GetUpdateStmt(char *pSqlStmt, int typeOfUpdate, const char *pWhereClause = NULL) + { BuildUpdateStmt(pSqlStmt,typeOfUpdate,pWhereClause); } + void GetWhereClause(char *pWhereClause, int typeOfWhere, + const char *qualTableName = NULL, bool useLikeComparison=false) + { BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); } +#endif + bool CanSelectForUpdate(void); +#if wxODBC_BACKWARD_COMPATABILITY + bool CanUpdByROWID(void) { return CanUpdateByRowID(); }; +#endif + bool CanUpdateByROWID(void); + void ClearMemberVar(UWORD colNumber, bool setToNull=false); + void ClearMemberVars(bool setToNull=false); + bool SetQueryTimeout(UDWORD nSeconds); + + wxDbColDef *GetColDefs() { return colDefs; } + bool SetColDefs(UWORD index, const wxString &fieldName, int dataType, + void *pData, SWORD cType, + int size, bool keyField = false, bool updateable = true, + bool insertAllowed = true, bool derivedColumn = false); + wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, UWORD numCols); + + bool CloseCursor(HSTMT cursor); + bool DeleteCursor(HSTMT *hstmtDel); + void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR); + HSTMT GetCursor(void) { return(hstmt); } + HSTMT *GetNewCursor(bool setCursor = false, bool bindColumns = true); +#if wxODBC_BACKWARD_COMPATABILITY +// The following member function is deprecated. You should use the GetNewCursor + HSTMT *NewCursor(bool setCursor = false, bool bindColumns = true) { return GetNewCursor(setCursor,bindColumns); } +#endif + + ULONG Count(const wxString &args=_T("*")); + int DB_STATUS(void) { return(pDb->DB_STATUS); } + + bool IsColNull(UWORD colNumber) const; + bool SetColNull(UWORD colNumber, bool set=true); + bool SetColNull(const wxString &colName, bool set=true); +#if wxODBC_BACKWARD_COMPATABILITY +// The following member functions are deprecated. You should use the SetColNull() + bool SetNull(int colNumber, bool set=true) { return (SetNull(colNumber,set)); } + bool SetNull(const char *colName, bool set=true) { return (SetNull(colName,set)); } +#endif +#ifdef __WXDEBUG__ + ULONG GetTableID() { return tableID; } +#endif + +//TODO: Need to Document + typedef enum { WX_ROW_MODE_QUERY , WX_ROW_MODE_INDIVIDUAL } rowmode_t; + virtual void SetRowMode(const rowmode_t rowmode); +#if wxODBC_BACKWARD_COMPATABILITY + virtual wxVariant GetCol(const int colNumber) const { return GetColumn(colNumber); }; + virtual void SetCol(const int colNumber, const wxVariant value) { return SetColumn(colNumber, value); }; +#endif + virtual wxVariant GetColumn(const int colNumber) const ; + virtual void SetColumn(const int colNumber, const wxVariant value); + virtual GenericKey GetKey(void); + virtual void SetKey(const GenericKey &key); + + private: + HSTMT *m_hstmtGridQuery; + rowmode_t m_rowmode; + size_t m_keysize; + +// typedef enum {unmodified=0, UpdatePending, InsertPending } recStatus; + +// recStatus get_ModifiedStatus() { return m_recstatus; } + +// void modify() { +// if (m_recstatus==unmodified) +// m_recstatus=UpdatePending; +// } +// protected: +// void insertify() {m_recstatus=InsertPending; } +// void unmodify() {m_recstatus=unmodified; } +// recStatus m_recstatus; +//TODO: Need to Document +}; // wxDbTable + + +// Change this to 0 to remove use of all deprecated functions +#if wxODBC_BACKWARD_COMPATABILITY +//################################################################################# +//############### DEPRECATED functions for backward compatibility ################# +//################################################################################# + +// Backward compability. These will eventually go away +typedef wxDbTable wxTable; +typedef wxDbIdxDef wxIdxDef; +typedef wxDbIdxDef CidxDef; +typedef wxDbColDef wxColDef; +typedef wxDbColDef CcolDef; +typedef wxDbColDataPtr wxColDataPtr; +typedef wxDbColDataPtr CcolDataPtr; + +const int ROWID = wxDB_ROWID_LEN; +const int DEFAULT_CURSOR = wxDB_DEFAULT_CURSOR; +const bool QUERY_ONLY = wxDB_QUERY_ONLY; +const bool DISABLE_VIEW = wxDB_DISABLE_VIEW; +#endif + +#endif diff --git a/Externals/wxWidgets/include/wx/dc.h b/Externals/wxWidgets/include/wx/dc.h index cfcfa54018..937d782338 100644 --- a/Externals/wxWidgets/include/wx/dc.h +++ b/Externals/wxWidgets/include/wx/dc.h @@ -1,997 +1,997 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dc.h -// Purpose: wxDC class -// Author: Vadim Zeitlin -// Modified by: -// Created: 05/25/99 -// RCS-ID: $Id: dc.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DC_H_BASE_ -#define _WX_DC_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers which we must include here -// ---------------------------------------------------------------------------- - -#include "wx/object.h" // the base class - -#include "wx/intl.h" // for wxLayoutDirection -#include "wx/cursor.h" // we have member variables of these classes -#include "wx/font.h" // so we can't do without them -#include "wx/colour.h" -#include "wx/bitmap.h" // for wxNullBitmap -#include "wx/brush.h" -#include "wx/pen.h" -#include "wx/palette.h" -#include "wx/list.h" // we use wxList in inline functions -#include "wx/dynarray.h" -#include "wx/math.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxDCBase; - -class WXDLLEXPORT wxDrawObject -{ -public: - - wxDrawObject() - : m_isBBoxValid(false) - , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) - { } - - virtual ~wxDrawObject() { } - - virtual void Draw(wxDCBase&) const { } - - virtual void CalcBoundingBox(wxCoord x, wxCoord y) - { - if ( m_isBBoxValid ) - { - if ( x < m_minX ) m_minX = x; - if ( y < m_minY ) m_minY = y; - if ( x > m_maxX ) m_maxX = x; - if ( y > m_maxY ) m_maxY = y; - } - else - { - m_isBBoxValid = true; - - m_minX = x; - m_minY = y; - m_maxX = x; - m_maxY = y; - } - } - - void ResetBoundingBox() - { - m_isBBoxValid = false; - - m_minX = m_maxX = m_minY = m_maxY = 0; - } - - // Get the final bounding box of the PostScript or Metafile picture. - - wxCoord MinX() const { return m_minX; } - wxCoord MaxX() const { return m_maxX; } - wxCoord MinY() const { return m_minY; } - wxCoord MaxY() const { return m_maxY; } - - //to define the type of object for derived objects - virtual int GetType()=0; - -protected: - //for boundingbox calculation - bool m_isBBoxValid:1; - //for boundingbox calculation - wxCoord m_minX, m_minY, m_maxX, m_maxY; -}; - -// --------------------------------------------------------------------------- -// global variables -// --------------------------------------------------------------------------- - -// --------------------------------------------------------------------------- -// wxDC is the device context - object on which any drawing is done -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCBase : public wxObject -{ -public: - wxDCBase() - : m_colour(wxColourDisplay()) - , m_ok(true) - , m_clipping(false) - , m_isInteractive(0) - , m_isBBoxValid(false) - , m_logicalOriginX(0), m_logicalOriginY(0) - , m_deviceOriginX(0), m_deviceOriginY(0) - , m_logicalScaleX(1.0), m_logicalScaleY(1.0) - , m_userScaleX(1.0), m_userScaleY(1.0) - , m_scaleX(1.0), m_scaleY(1.0) - , m_signX(1), m_signY(1) - , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) - , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0) - , m_logicalFunction(wxCOPY) - , m_backgroundMode(wxTRANSPARENT) - , m_mappingMode(wxMM_TEXT) - , m_pen() - , m_brush() - , m_backgroundBrush(*wxTRANSPARENT_BRUSH) - , m_textForegroundColour(*wxBLACK) - , m_textBackgroundColour(*wxWHITE) - , m_font() -#if wxUSE_PALETTE - , m_palette() - , m_hasCustomPalette(false) -#endif // wxUSE_PALETTE - { - ResetBoundingBox(); - ResetClipping(); - } - - virtual ~wxDCBase() { } - - // graphic primitives - // ------------------ - - virtual void DrawObject(wxDrawObject* drawobject) - { - drawobject->Draw(*this); - CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); - CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); - } - - bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE) - { return DoFloodFill(x, y, col, style); } - bool FloodFill(const wxPoint& pt, const wxColour& col, - int style = wxFLOOD_SURFACE) - { return DoFloodFill(pt.x, pt.y, col, style); } - - // fill the area specified by rect with a radial gradient, starting from - // initialColour in the centre of the cercle and fading to destColour. - void GradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour) - { GradientFillConcentric(rect, initialColour, destColour, - wxPoint(rect.GetWidth() / 2, - rect.GetHeight() / 2)); } - - void GradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter) - { DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } - - // fill the area specified by rect with a linear gradient - void GradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST) - { DoGradientFillLinear(rect, initialColour, destColour, nDirection); } - - bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const - { return DoGetPixel(x, y, col); } - bool GetPixel(const wxPoint& pt, wxColour *col) const - { return DoGetPixel(pt.x, pt.y, col); } - - void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) - { DoDrawLine(x1, y1, x2, y2); } - void DrawLine(const wxPoint& pt1, const wxPoint& pt2) - { DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } - - void CrossHair(wxCoord x, wxCoord y) - { DoCrossHair(x, y); } - void CrossHair(const wxPoint& pt) - { DoCrossHair(pt.x, pt.y); } - - void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) - { DoDrawArc(x1, y1, x2, y2, xc, yc); } - void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) - { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } - - void DrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) - { DoDrawCheckMark(x, y, width, height); } - void DrawCheckMark(const wxRect& rect) - { DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } - - void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) - { DoDrawEllipticArc(x, y, w, h, sa, ea); } - void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, - double sa, double ea) - { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } - - void DrawPoint(wxCoord x, wxCoord y) - { DoDrawPoint(x, y); } - void DrawPoint(const wxPoint& pt) - { DoDrawPoint(pt.x, pt.y); } - - void DrawLines(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0) - { DoDrawLines(n, points, xoffset, yoffset); } - void DrawLines(const wxList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0); - - void DrawPolygon(int n, wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0, - int fillStyle = wxODDEVEN_RULE) - { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } - - void DrawPolygon(const wxList *list, - wxCoord xoffset = 0, wxCoord yoffset = 0, - int fillStyle = wxODDEVEN_RULE); - - void DrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0, - int fillStyle = wxODDEVEN_RULE) - { DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } - - void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { DoDrawRectangle(x, y, width, height); } - void DrawRectangle(const wxPoint& pt, const wxSize& sz) - { DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } - void DrawRectangle(const wxRect& rect) - { DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } - - void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, - double radius) - { DoDrawRoundedRectangle(x, y, width, height, radius); } - void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, - double radius) - { DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } - void DrawRoundedRectangle(const wxRect& r, double radius) - { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } - - void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) - { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } - void DrawCircle(const wxPoint& pt, wxCoord radius) - { DrawCircle(pt.x, pt.y, radius); } - - void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { DoDrawEllipse(x, y, width, height); } - void DrawEllipse(const wxPoint& pt, const wxSize& sz) - { DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } - void DrawEllipse(const wxRect& rect) - { DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } - - void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) - { DoDrawIcon(icon, x, y); } - void DrawIcon(const wxIcon& icon, const wxPoint& pt) - { DoDrawIcon(icon, pt.x, pt.y); } - - void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) - { DoDrawBitmap(bmp, x, y, useMask); } - void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, - bool useMask = false) - { DoDrawBitmap(bmp, pt.x, pt.y, useMask); } - - void DrawText(const wxString& text, wxCoord x, wxCoord y) - { DoDrawText(text, x, y); } - void DrawText(const wxString& text, const wxPoint& pt) - { DoDrawText(text, pt.x, pt.y); } - - void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) - { DoDrawRotatedText(text, x, y, angle); } - void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) - { DoDrawRotatedText(text, pt.x, pt.y, angle); } - - // this version puts both optional bitmap and the text into the given - // rectangle and aligns is as specified by alignment parameter; it also - // will emphasize the character with the given index if it is != -1 and - // return the bounding rectangle if required - virtual void DrawLabel(const wxString& text, - const wxBitmap& image, - const wxRect& rect, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounding = NULL); - - void DrawLabel(const wxString& text, const wxRect& rect, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1) - { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } - - bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) - { - return DoBlit(xdest, ydest, width, height, - source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); - } - bool Blit(const wxPoint& destPt, const wxSize& sz, - wxDC *source, const wxPoint& srcPt, - int rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition) - { - return DoBlit(destPt.x, destPt.y, sz.x, sz.y, - source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); - } - - wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const - { - return DoGetAsBitmap(subrect); - } - -#if wxUSE_SPLINES - // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) - void DrawSpline(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord x3, wxCoord y3); - void DrawSpline(int n, wxPoint points[]); - - void DrawSpline(wxList *points) { DoDrawSpline(points); } -#endif // wxUSE_SPLINES - - // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE -#ifdef __WXWINCE__ - //! Generic method to draw ellipses, circles and arcs with current pen and brush. - /*! \param x Upper left corner of bounding box. - * \param y Upper left corner of bounding box. - * \param w Width of bounding box. - * \param h Height of bounding box. - * \param sa Starting angle of arc - * (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param ea Ending angle of arc. - * \param angle Rotation angle, the Arc will be rotated after - * calculating begin and end. - */ - void DrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxPoint& pt, - const wxSize& sz, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxRect& rect, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); } - - virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double sa = 0, double ea = 0, double angle = 0 ); - - //! Rotates points around center. - /*! This is a quite straight method, it calculates in pixels - * and so it produces rounding errors. - * \param points The points inside will be rotated. - * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param center Center of rotation. - */ - void Rotate( wxList* points, double angle, wxPoint center = wxPoint(0,0) ); - - // used by DrawEllipticArcRot - // Careful: wxList gets filled with points you have to delete later. - void CalculateEllipticPoints( wxList* points, - wxCoord xStart, wxCoord yStart, - wxCoord w, wxCoord h, - double sa, double ea ); -#endif - - // global DC operations - // -------------------- - - virtual void Clear() = 0; - - virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; } - virtual void EndDoc() { } - - virtual void StartPage() { } - virtual void EndPage() { } - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void BeginDrawing() ); - wxDEPRECATED( void EndDrawing() ); -#endif // WXWIN_COMPATIBILITY_2_6 - - - // set objects to use for drawing - // ------------------------------ - - virtual void SetFont(const wxFont& font) = 0; - virtual void SetPen(const wxPen& pen) = 0; - virtual void SetBrush(const wxBrush& brush) = 0; - virtual void SetBackground(const wxBrush& brush) = 0; - virtual void SetBackgroundMode(int mode) = 0; -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette) = 0; -#endif // wxUSE_PALETTE - - // clipping region - // --------------- - - void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) - { DoSetClippingRegion(x, y, width, height); } - void SetClippingRegion(const wxPoint& pt, const wxSize& sz) - { DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } - void SetClippingRegion(const wxRect& rect) - { DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } - void SetClippingRegion(const wxRegion& region) - { DoSetClippingRegionAsRegion(region); } - - virtual void DestroyClippingRegion() { ResetClipping(); } - - void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const - { DoGetClippingBox(x, y, w, h); } - void GetClippingBox(wxRect& rect) const - { - DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); - } - - // text extent - // ----------- - - virtual wxCoord GetCharHeight() const = 0; - virtual wxCoord GetCharWidth() const = 0; - - // only works for single line strings - void GetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const - { DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } - - wxSize GetTextExtent(const wxString& string) const - { - wxCoord w, h; - DoGetTextExtent(string, &w, &h); - return wxSize(w, h); - } - - // works for single as well as multi-line strings - virtual void GetMultiLineTextExtent(const wxString& string, - wxCoord *width, - wxCoord *height, - wxCoord *heightLine = NULL, - wxFont *font = NULL) const; - - wxSize GetMultiLineTextExtent(const wxString& string) const - { - wxCoord w, h; - GetMultiLineTextExtent(string, &w, &h); - return wxSize(w, h); - } - - // Measure cumulative width of text after each character - bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const - { return DoGetPartialTextExtents(text, widths); } - - - // size and resolution - // ------------------- - - // in device units - void GetSize(int *width, int *height) const - { DoGetSize(width, height); } - wxSize GetSize() const - { - int w, h; - DoGetSize(&w, &h); - - return wxSize(w, h); - } - - // in mm - void GetSizeMM(int* width, int* height) const - { DoGetSizeMM(width, height); } - wxSize GetSizeMM() const - { - int w, h; - DoGetSizeMM(&w, &h); - - return wxSize(w, h); - } - - // coordinates conversions - // ----------------------- - - // This group of functions does actual conversion of the input, as you'd - // expect. - wxCoord DeviceToLogicalX(wxCoord x) const; - wxCoord DeviceToLogicalY(wxCoord y) const; - wxCoord DeviceToLogicalXRel(wxCoord x) const; - wxCoord DeviceToLogicalYRel(wxCoord y) const; - wxCoord LogicalToDeviceX(wxCoord x) const; - wxCoord LogicalToDeviceY(wxCoord y) const; - wxCoord LogicalToDeviceXRel(wxCoord x) const; - wxCoord LogicalToDeviceYRel(wxCoord y) const; - - // query DC capabilities - // --------------------- - - virtual bool CanDrawBitmap() const = 0; - virtual bool CanGetTextExtent() const = 0; - - // colour depth - virtual int GetDepth() const = 0; - - // Resolution in Pixels per inch - virtual wxSize GetPPI() const = 0; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return m_ok; } - - // accessors and setters - // --------------------- - - virtual int GetBackgroundMode() const { return m_backgroundMode; } - virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } - virtual const wxBrush& GetBrush() const { return m_brush; } - virtual const wxFont& GetFont() const { return m_font; } - virtual const wxPen& GetPen() const { return m_pen; } - - virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; } - virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; } - virtual void SetTextForeground(const wxColour& colour) - { m_textForegroundColour = colour; } - virtual void SetTextBackground(const wxColour& colour) - { m_textBackgroundColour = colour; } - - virtual int GetMapMode() const { return m_mappingMode; } - virtual void SetMapMode(int mode) = 0; - - virtual void GetUserScale(double *x, double *y) const - { - if ( x ) *x = m_userScaleX; - if ( y ) *y = m_userScaleY; - } - virtual void SetUserScale(double x, double y) = 0; - - virtual void GetLogicalScale(double *x, double *y) - { - if ( x ) *x = m_logicalScaleX; - if ( y ) *y = m_logicalScaleY; - } - virtual void SetLogicalScale(double x, double y) - { - m_logicalScaleX = x; - m_logicalScaleY = y; - } - - void GetLogicalOrigin(wxCoord *x, wxCoord *y) const - { DoGetLogicalOrigin(x, y); } - wxPoint GetLogicalOrigin() const - { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } - virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0; - - void GetDeviceOrigin(wxCoord *x, wxCoord *y) const - { DoGetDeviceOrigin(x, y); } - wxPoint GetDeviceOrigin() const - { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } - virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0; - - virtual void ComputeScaleAndOrigin() {} - - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0; - - virtual int GetLogicalFunction() const { return m_logicalFunction; } - virtual void SetLogicalFunction(int function) = 0; - -#if WXWIN_COMPATIBILITY_2_4 - virtual void SetOptimization(bool WXUNUSED(opt)) { } - virtual bool GetOptimization() { return false; } -#endif - - // bounding box - // ------------ - - virtual void CalcBoundingBox(wxCoord x, wxCoord y) - { - if ( m_isBBoxValid ) - { - if ( x < m_minX ) m_minX = x; - if ( y < m_minY ) m_minY = y; - if ( x > m_maxX ) m_maxX = x; - if ( y > m_maxY ) m_maxY = y; - } - else - { - m_isBBoxValid = true; - - m_minX = x; - m_minY = y; - m_maxX = x; - m_maxY = y; - } - } - - void ResetBoundingBox() - { - m_isBBoxValid = false; - - m_minX = m_maxX = m_minY = m_maxY = 0; - } - - // Get the final bounding box of the PostScript or Metafile picture. - wxCoord MinX() const { return m_minX; } - wxCoord MaxX() const { return m_maxX; } - wxCoord MinY() const { return m_minY; } - wxCoord MaxY() const { return m_maxY; } - - // misc old functions - // ------------------ - - // for compatibility with the old code when wxCoord was long everywhere - void GetTextExtent(const wxString& string, - long *x, long *y, - long *descent = NULL, - long *externalLeading = NULL, - wxFont *theFont = NULL) const - { - wxCoord x2, y2, descent2, externalLeading2; - DoGetTextExtent(string, &x2, &y2, - &descent2, &externalLeading2, - theFont); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - if ( descent ) - *descent = descent2; - if ( externalLeading ) - *externalLeading = externalLeading2; - } - - void GetLogicalOrigin(long *x, long *y) const - { - wxCoord x2, y2; - DoGetLogicalOrigin(&x2, &y2); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - } - - void GetDeviceOrigin(long *x, long *y) const - { - wxCoord x2, y2; - DoGetDeviceOrigin(&x2, &y2); - if ( x ) - *x = x2; - if ( y ) - *y = y2; - } - void GetClippingBox(long *x, long *y, long *w, long *h) const - { - wxCoord xx,yy,ww,hh; - DoGetClippingBox(&xx, &yy, &ww, &hh); - if (x) *x = xx; - if (y) *y = yy; - if (w) *w = ww; - if (h) *h = hh; - } - - // RTL related functions - // --------------------- - - // get or change the layout direction (LTR or RTL) for this dc, - // wxLayout_Default is returned if layout direction is not supported - virtual wxLayoutDirection GetLayoutDirection() const - { return wxLayout_Default; } - virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) - { } - -protected: - // the pure virtual functions which should be implemented by wxDC - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE) = 0; - - virtual void DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST); - - virtual void DoGradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0; - - virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0; - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0; - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) = 0; - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) = 0; - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius) = 0; - virtual void DoDrawEllipse(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) = 0; - - virtual void DoCrossHair(wxCoord x, wxCoord y) = 0; - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0; - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) = 0; - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0; - virtual void DoDrawRotatedText(const wxString& text, - wxCoord x, wxCoord y, double angle) = 0; - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) = 0; - - virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const { return wxNullBitmap; } - - virtual void DoGetSize(int *width, int *height) const = 0; - virtual void DoGetSizeMM(int* width, int* height) const = 0; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset) = 0; - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE) = 0; - virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle); - - virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0; - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height) = 0; - -#if WXWIN_COMPATIBILITY_2_4 - // this was only for confusing people, use DoGetClippingBox only - virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) - { DoGetClippingBox(x, y, w, h); } -#endif - - virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) const - { - if ( x ) - *x = m_clipX1; - if ( y ) - *y = m_clipY1; - if ( w ) - *w = m_clipX2 - m_clipX1; - if ( h ) - *h = m_clipY2 - m_clipY1; - } - - virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const - { - if ( x ) *x = m_logicalOriginX; - if ( y ) *y = m_logicalOriginY; - } - - virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const - { - if ( x ) *x = m_deviceOriginX; - if ( y ) *y = m_deviceOriginY; - } - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const = 0; - - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif - -protected: - // unset clipping variables (after clipping region was destroyed) - void ResetClipping() - { - m_clipping = false; - - m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; - } - - // flags - bool m_colour:1; - bool m_ok:1; - bool m_clipping:1; - bool m_isInteractive:1; - bool m_isBBoxValid:1; - - // coordinate system variables - - // TODO short descriptions of what exactly they are would be nice... - - wxCoord m_logicalOriginX, m_logicalOriginY; - wxCoord m_deviceOriginX, m_deviceOriginY; - - double m_logicalScaleX, m_logicalScaleY; - double m_userScaleX, m_userScaleY; - double m_scaleX, m_scaleY; - - // Used by SetAxisOrientation() to invert the axes - int m_signX, m_signY; - - // bounding and clipping boxes - wxCoord m_minX, m_minY, m_maxX, m_maxY; - wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; - - int m_logicalFunction; - int m_backgroundMode; - int m_mappingMode; - - // GDI objects - wxPen m_pen; - wxBrush m_brush; - wxBrush m_backgroundBrush; - wxColour m_textForegroundColour; - wxColour m_textBackgroundColour; - wxFont m_font; - -#if wxUSE_PALETTE - wxPalette m_palette; - bool m_hasCustomPalette; -#endif // wxUSE_PALETTE - -private: - DECLARE_NO_COPY_CLASS(wxDCBase) - DECLARE_ABSTRACT_CLASS(wxDCBase) -}; - -// ---------------------------------------------------------------------------- -// now include the declaration of wxDC class -// ---------------------------------------------------------------------------- - -#if defined(__WXPALMOS__) - #include "wx/palmos/dc.h" -#elif defined(__WXMSW__) - #include "wx/msw/dc.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dc.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dc.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dc.h" -#elif defined(__WXX11__) - #include "wx/x11/dc.h" -#elif defined(__WXMGL__) - #include "wx/mgl/dc.h" -#elif defined(__WXDFB__) - #include "wx/dfb/dc.h" -#elif defined(__WXMAC__) - #include "wx/mac/dc.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dc.h" -#elif defined(__WXPM__) - #include "wx/os2/dc.h" -#endif - -#if wxUSE_GRAPHICS_CONTEXT - #include "wx/dcgraph.h" -#endif - -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC text colour and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCTextColourChanger -{ -public: - wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } - - wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) - { - Set(col); - } - - ~wxDCTextColourChanger() - { - if ( m_colFgOld.Ok() ) - m_dc.SetTextForeground(m_colFgOld); - } - - void Set(const wxColour& col) - { - if ( !m_colFgOld.Ok() ) - m_colFgOld = m_dc.GetTextForeground(); - m_dc.SetTextForeground(col); - } - -private: - wxDC& m_dc; - - wxColour m_colFgOld; - - DECLARE_NO_COPY_CLASS(wxDCTextColourChanger) -}; - -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC pen and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCPenChanger -{ -public: - wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen()) - { - m_dc.SetPen(pen); - } - - ~wxDCPenChanger() - { - if ( m_penOld.Ok() ) - m_dc.SetPen(m_penOld); - } - -private: - wxDC& m_dc; - - wxPen m_penOld; - - DECLARE_NO_COPY_CLASS(wxDCPenChanger) -}; - -// ---------------------------------------------------------------------------- -// helper class: you can use it to temporarily change the DC brush and -// restore it automatically when the object goes out of scope -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCBrushChanger -{ -public: - wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush()) - { - m_dc.SetBrush(brush); - } - - ~wxDCBrushChanger() - { - if ( m_brushOld.Ok() ) - m_dc.SetBrush(m_brushOld); - } - -private: - wxDC& m_dc; - - wxBrush m_brushOld; - - DECLARE_NO_COPY_CLASS(wxDCBrushChanger) -}; - -// ---------------------------------------------------------------------------- -// another small helper class: sets the clipping region in its ctor and -// destroys it in the dtor -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCClipper -{ -public: - wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc) - { dc.SetClippingRegion(r); } - wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) - { dc.SetClippingRegion(r.x, r.y, r.width, r.height); } - wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) - { dc.SetClippingRegion(x, y, w, h); } - - ~wxDCClipper() { m_dc.DestroyClippingRegion(); } - -private: - wxDC& m_dc; - - DECLARE_NO_COPY_CLASS(wxDCClipper) -}; - -#endif // _WX_DC_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dc.h +// Purpose: wxDC class +// Author: Vadim Zeitlin +// Modified by: +// Created: 05/25/99 +// RCS-ID: $Id: dc.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_BASE_ +#define _WX_DC_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers which we must include here +// ---------------------------------------------------------------------------- + +#include "wx/object.h" // the base class + +#include "wx/intl.h" // for wxLayoutDirection +#include "wx/cursor.h" // we have member variables of these classes +#include "wx/font.h" // so we can't do without them +#include "wx/colour.h" +#include "wx/bitmap.h" // for wxNullBitmap +#include "wx/brush.h" +#include "wx/pen.h" +#include "wx/palette.h" +#include "wx/list.h" // we use wxList in inline functions +#include "wx/dynarray.h" +#include "wx/math.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxDCBase; + +class WXDLLEXPORT wxDrawObject +{ +public: + + wxDrawObject() + : m_isBBoxValid(false) + , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) + { } + + virtual ~wxDrawObject() { } + + virtual void Draw(wxDCBase&) const { } + + virtual void CalcBoundingBox(wxCoord x, wxCoord y) + { + if ( m_isBBoxValid ) + { + if ( x < m_minX ) m_minX = x; + if ( y < m_minY ) m_minY = y; + if ( x > m_maxX ) m_maxX = x; + if ( y > m_maxY ) m_maxY = y; + } + else + { + m_isBBoxValid = true; + + m_minX = x; + m_minY = y; + m_maxX = x; + m_maxY = y; + } + } + + void ResetBoundingBox() + { + m_isBBoxValid = false; + + m_minX = m_maxX = m_minY = m_maxY = 0; + } + + // Get the final bounding box of the PostScript or Metafile picture. + + wxCoord MinX() const { return m_minX; } + wxCoord MaxX() const { return m_maxX; } + wxCoord MinY() const { return m_minY; } + wxCoord MaxY() const { return m_maxY; } + + //to define the type of object for derived objects + virtual int GetType()=0; + +protected: + //for boundingbox calculation + bool m_isBBoxValid:1; + //for boundingbox calculation + wxCoord m_minX, m_minY, m_maxX, m_maxY; +}; + +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// wxDC is the device context - object on which any drawing is done +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCBase : public wxObject +{ +public: + wxDCBase() + : m_colour(wxColourDisplay()) + , m_ok(true) + , m_clipping(false) + , m_isInteractive(0) + , m_isBBoxValid(false) + , m_logicalOriginX(0), m_logicalOriginY(0) + , m_deviceOriginX(0), m_deviceOriginY(0) + , m_logicalScaleX(1.0), m_logicalScaleY(1.0) + , m_userScaleX(1.0), m_userScaleY(1.0) + , m_scaleX(1.0), m_scaleY(1.0) + , m_signX(1), m_signY(1) + , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) + , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0) + , m_logicalFunction(wxCOPY) + , m_backgroundMode(wxTRANSPARENT) + , m_mappingMode(wxMM_TEXT) + , m_pen() + , m_brush() + , m_backgroundBrush(*wxTRANSPARENT_BRUSH) + , m_textForegroundColour(*wxBLACK) + , m_textBackgroundColour(*wxWHITE) + , m_font() +#if wxUSE_PALETTE + , m_palette() + , m_hasCustomPalette(false) +#endif // wxUSE_PALETTE + { + ResetBoundingBox(); + ResetClipping(); + } + + virtual ~wxDCBase() { } + + // graphic primitives + // ------------------ + + virtual void DrawObject(wxDrawObject* drawobject) + { + drawobject->Draw(*this); + CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); + CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); + } + + bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE) + { return DoFloodFill(x, y, col, style); } + bool FloodFill(const wxPoint& pt, const wxColour& col, + int style = wxFLOOD_SURFACE) + { return DoFloodFill(pt.x, pt.y, col, style); } + + // fill the area specified by rect with a radial gradient, starting from + // initialColour in the centre of the cercle and fading to destColour. + void GradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour) + { GradientFillConcentric(rect, initialColour, destColour, + wxPoint(rect.GetWidth() / 2, + rect.GetHeight() / 2)); } + + void GradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter) + { DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } + + // fill the area specified by rect with a linear gradient + void GradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST) + { DoGradientFillLinear(rect, initialColour, destColour, nDirection); } + + bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const + { return DoGetPixel(x, y, col); } + bool GetPixel(const wxPoint& pt, wxColour *col) const + { return DoGetPixel(pt.x, pt.y, col); } + + void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + { DoDrawLine(x1, y1, x2, y2); } + void DrawLine(const wxPoint& pt1, const wxPoint& pt2) + { DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } + + void CrossHair(wxCoord x, wxCoord y) + { DoCrossHair(x, y); } + void CrossHair(const wxPoint& pt) + { DoCrossHair(pt.x, pt.y); } + + void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) + { DoDrawArc(x1, y1, x2, y2, xc, yc); } + void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) + { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } + + void DrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) + { DoDrawCheckMark(x, y, width, height); } + void DrawCheckMark(const wxRect& rect) + { DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } + + void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) + { DoDrawEllipticArc(x, y, w, h, sa, ea); } + void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, + double sa, double ea) + { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } + + void DrawPoint(wxCoord x, wxCoord y) + { DoDrawPoint(x, y); } + void DrawPoint(const wxPoint& pt) + { DoDrawPoint(pt.x, pt.y); } + + void DrawLines(int n, wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0) + { DoDrawLines(n, points, xoffset, yoffset); } + void DrawLines(const wxList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0); + + void DrawPolygon(int n, wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fillStyle = wxODDEVEN_RULE) + { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } + + void DrawPolygon(const wxList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fillStyle = wxODDEVEN_RULE); + + void DrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fillStyle = wxODDEVEN_RULE) + { DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } + + void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { DoDrawRectangle(x, y, width, height); } + void DrawRectangle(const wxPoint& pt, const wxSize& sz) + { DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } + void DrawRectangle(const wxRect& rect) + { DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } + + void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, + double radius) + { DoDrawRoundedRectangle(x, y, width, height, radius); } + void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, + double radius) + { DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } + void DrawRoundedRectangle(const wxRect& r, double radius) + { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } + + void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) + { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } + void DrawCircle(const wxPoint& pt, wxCoord radius) + { DrawCircle(pt.x, pt.y, radius); } + + void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { DoDrawEllipse(x, y, width, height); } + void DrawEllipse(const wxPoint& pt, const wxSize& sz) + { DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } + void DrawEllipse(const wxRect& rect) + { DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } + + void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) + { DoDrawIcon(icon, x, y); } + void DrawIcon(const wxIcon& icon, const wxPoint& pt) + { DoDrawIcon(icon, pt.x, pt.y); } + + void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) + { DoDrawBitmap(bmp, x, y, useMask); } + void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, + bool useMask = false) + { DoDrawBitmap(bmp, pt.x, pt.y, useMask); } + + void DrawText(const wxString& text, wxCoord x, wxCoord y) + { DoDrawText(text, x, y); } + void DrawText(const wxString& text, const wxPoint& pt) + { DoDrawText(text, pt.x, pt.y); } + + void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) + { DoDrawRotatedText(text, x, y, angle); } + void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) + { DoDrawRotatedText(text, pt.x, pt.y, angle); } + + // this version puts both optional bitmap and the text into the given + // rectangle and aligns is as specified by alignment parameter; it also + // will emphasize the character with the given index if it is != -1 and + // return the bounding rectangle if required + virtual void DrawLabel(const wxString& text, + const wxBitmap& image, + const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounding = NULL); + + void DrawLabel(const wxString& text, const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1) + { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } + + bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) + { + return DoBlit(xdest, ydest, width, height, + source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); + } + bool Blit(const wxPoint& destPt, const wxSize& sz, + wxDC *source, const wxPoint& srcPt, + int rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition) + { + return DoBlit(destPt.x, destPt.y, sz.x, sz.y, + source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); + } + + wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const + { + return DoGetAsBitmap(subrect); + } + +#if wxUSE_SPLINES + // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) + void DrawSpline(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord x3, wxCoord y3); + void DrawSpline(int n, wxPoint points[]); + + void DrawSpline(wxList *points) { DoDrawSpline(points); } +#endif // wxUSE_SPLINES + + // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE +#ifdef __WXWINCE__ + //! Generic method to draw ellipses, circles and arcs with current pen and brush. + /*! \param x Upper left corner of bounding box. + * \param y Upper left corner of bounding box. + * \param w Width of bounding box. + * \param h Height of bounding box. + * \param sa Starting angle of arc + * (counterclockwise, start at 3 o'clock, 360 is full circle). + * \param ea Ending angle of arc. + * \param angle Rotation angle, the Arc will be rotated after + * calculating begin and end. + */ + void DrawEllipticArcRot( wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double sa = 0, double ea = 0, double angle = 0 ) + { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); } + + void DrawEllipticArcRot( const wxPoint& pt, + const wxSize& sz, + double sa = 0, double ea = 0, double angle = 0 ) + { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); } + + void DrawEllipticArcRot( const wxRect& rect, + double sa = 0, double ea = 0, double angle = 0 ) + { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); } + + virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y, + wxCoord w, wxCoord h, + double sa = 0, double ea = 0, double angle = 0 ); + + //! Rotates points around center. + /*! This is a quite straight method, it calculates in pixels + * and so it produces rounding errors. + * \param points The points inside will be rotated. + * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). + * \param center Center of rotation. + */ + void Rotate( wxList* points, double angle, wxPoint center = wxPoint(0,0) ); + + // used by DrawEllipticArcRot + // Careful: wxList gets filled with points you have to delete later. + void CalculateEllipticPoints( wxList* points, + wxCoord xStart, wxCoord yStart, + wxCoord w, wxCoord h, + double sa, double ea ); +#endif + + // global DC operations + // -------------------- + + virtual void Clear() = 0; + + virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; } + virtual void EndDoc() { } + + virtual void StartPage() { } + virtual void EndPage() { } + +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void BeginDrawing() ); + wxDEPRECATED( void EndDrawing() ); +#endif // WXWIN_COMPATIBILITY_2_6 + + + // set objects to use for drawing + // ------------------------------ + + virtual void SetFont(const wxFont& font) = 0; + virtual void SetPen(const wxPen& pen) = 0; + virtual void SetBrush(const wxBrush& brush) = 0; + virtual void SetBackground(const wxBrush& brush) = 0; + virtual void SetBackgroundMode(int mode) = 0; +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) = 0; +#endif // wxUSE_PALETTE + + // clipping region + // --------------- + + void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { DoSetClippingRegion(x, y, width, height); } + void SetClippingRegion(const wxPoint& pt, const wxSize& sz) + { DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } + void SetClippingRegion(const wxRect& rect) + { DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } + void SetClippingRegion(const wxRegion& region) + { DoSetClippingRegionAsRegion(region); } + + virtual void DestroyClippingRegion() { ResetClipping(); } + + void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const + { DoGetClippingBox(x, y, w, h); } + void GetClippingBox(wxRect& rect) const + { + DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); + } + + // text extent + // ----------- + + virtual wxCoord GetCharHeight() const = 0; + virtual wxCoord GetCharWidth() const = 0; + + // only works for single line strings + void GetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const + { DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } + + wxSize GetTextExtent(const wxString& string) const + { + wxCoord w, h; + DoGetTextExtent(string, &w, &h); + return wxSize(w, h); + } + + // works for single as well as multi-line strings + virtual void GetMultiLineTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *heightLine = NULL, + wxFont *font = NULL) const; + + wxSize GetMultiLineTextExtent(const wxString& string) const + { + wxCoord w, h; + GetMultiLineTextExtent(string, &w, &h); + return wxSize(w, h); + } + + // Measure cumulative width of text after each character + bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const + { return DoGetPartialTextExtents(text, widths); } + + + // size and resolution + // ------------------- + + // in device units + void GetSize(int *width, int *height) const + { DoGetSize(width, height); } + wxSize GetSize() const + { + int w, h; + DoGetSize(&w, &h); + + return wxSize(w, h); + } + + // in mm + void GetSizeMM(int* width, int* height) const + { DoGetSizeMM(width, height); } + wxSize GetSizeMM() const + { + int w, h; + DoGetSizeMM(&w, &h); + + return wxSize(w, h); + } + + // coordinates conversions + // ----------------------- + + // This group of functions does actual conversion of the input, as you'd + // expect. + wxCoord DeviceToLogicalX(wxCoord x) const; + wxCoord DeviceToLogicalY(wxCoord y) const; + wxCoord DeviceToLogicalXRel(wxCoord x) const; + wxCoord DeviceToLogicalYRel(wxCoord y) const; + wxCoord LogicalToDeviceX(wxCoord x) const; + wxCoord LogicalToDeviceY(wxCoord y) const; + wxCoord LogicalToDeviceXRel(wxCoord x) const; + wxCoord LogicalToDeviceYRel(wxCoord y) const; + + // query DC capabilities + // --------------------- + + virtual bool CanDrawBitmap() const = 0; + virtual bool CanGetTextExtent() const = 0; + + // colour depth + virtual int GetDepth() const = 0; + + // Resolution in Pixels per inch + virtual wxSize GetPPI() const = 0; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return m_ok; } + + // accessors and setters + // --------------------- + + virtual int GetBackgroundMode() const { return m_backgroundMode; } + virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } + virtual const wxBrush& GetBrush() const { return m_brush; } + virtual const wxFont& GetFont() const { return m_font; } + virtual const wxPen& GetPen() const { return m_pen; } + + virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; } + virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; } + virtual void SetTextForeground(const wxColour& colour) + { m_textForegroundColour = colour; } + virtual void SetTextBackground(const wxColour& colour) + { m_textBackgroundColour = colour; } + + virtual int GetMapMode() const { return m_mappingMode; } + virtual void SetMapMode(int mode) = 0; + + virtual void GetUserScale(double *x, double *y) const + { + if ( x ) *x = m_userScaleX; + if ( y ) *y = m_userScaleY; + } + virtual void SetUserScale(double x, double y) = 0; + + virtual void GetLogicalScale(double *x, double *y) + { + if ( x ) *x = m_logicalScaleX; + if ( y ) *y = m_logicalScaleY; + } + virtual void SetLogicalScale(double x, double y) + { + m_logicalScaleX = x; + m_logicalScaleY = y; + } + + void GetLogicalOrigin(wxCoord *x, wxCoord *y) const + { DoGetLogicalOrigin(x, y); } + wxPoint GetLogicalOrigin() const + { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } + virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0; + + void GetDeviceOrigin(wxCoord *x, wxCoord *y) const + { DoGetDeviceOrigin(x, y); } + wxPoint GetDeviceOrigin() const + { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } + virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0; + + virtual void ComputeScaleAndOrigin() {} + + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0; + + virtual int GetLogicalFunction() const { return m_logicalFunction; } + virtual void SetLogicalFunction(int function) = 0; + +#if WXWIN_COMPATIBILITY_2_4 + virtual void SetOptimization(bool WXUNUSED(opt)) { } + virtual bool GetOptimization() { return false; } +#endif + + // bounding box + // ------------ + + virtual void CalcBoundingBox(wxCoord x, wxCoord y) + { + if ( m_isBBoxValid ) + { + if ( x < m_minX ) m_minX = x; + if ( y < m_minY ) m_minY = y; + if ( x > m_maxX ) m_maxX = x; + if ( y > m_maxY ) m_maxY = y; + } + else + { + m_isBBoxValid = true; + + m_minX = x; + m_minY = y; + m_maxX = x; + m_maxY = y; + } + } + + void ResetBoundingBox() + { + m_isBBoxValid = false; + + m_minX = m_maxX = m_minY = m_maxY = 0; + } + + // Get the final bounding box of the PostScript or Metafile picture. + wxCoord MinX() const { return m_minX; } + wxCoord MaxX() const { return m_maxX; } + wxCoord MinY() const { return m_minY; } + wxCoord MaxY() const { return m_maxY; } + + // misc old functions + // ------------------ + + // for compatibility with the old code when wxCoord was long everywhere + void GetTextExtent(const wxString& string, + long *x, long *y, + long *descent = NULL, + long *externalLeading = NULL, + wxFont *theFont = NULL) const + { + wxCoord x2, y2, descent2, externalLeading2; + DoGetTextExtent(string, &x2, &y2, + &descent2, &externalLeading2, + theFont); + if ( x ) + *x = x2; + if ( y ) + *y = y2; + if ( descent ) + *descent = descent2; + if ( externalLeading ) + *externalLeading = externalLeading2; + } + + void GetLogicalOrigin(long *x, long *y) const + { + wxCoord x2, y2; + DoGetLogicalOrigin(&x2, &y2); + if ( x ) + *x = x2; + if ( y ) + *y = y2; + } + + void GetDeviceOrigin(long *x, long *y) const + { + wxCoord x2, y2; + DoGetDeviceOrigin(&x2, &y2); + if ( x ) + *x = x2; + if ( y ) + *y = y2; + } + void GetClippingBox(long *x, long *y, long *w, long *h) const + { + wxCoord xx,yy,ww,hh; + DoGetClippingBox(&xx, &yy, &ww, &hh); + if (x) *x = xx; + if (y) *y = yy; + if (w) *w = ww; + if (h) *h = hh; + } + + // RTL related functions + // --------------------- + + // get or change the layout direction (LTR or RTL) for this dc, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const + { return wxLayout_Default; } + virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) + { } + +protected: + // the pure virtual functions which should be implemented by wxDC + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE) = 0; + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST); + + virtual void DoGradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0; + + virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0; + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0; + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) = 0; + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) = 0; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) = 0; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) = 0; + + virtual void DoCrossHair(wxCoord x, wxCoord y) = 0; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0; + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) = 0; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0; + virtual void DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, double angle) = 0; + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) = 0; + + virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const { return wxNullBitmap; } + + virtual void DoGetSize(int *width, int *height) const = 0; + virtual void DoGetSizeMM(int* width, int* height) const = 0; + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset) = 0; + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE) = 0; + virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle); + + virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0; + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) = 0; + +#if WXWIN_COMPATIBILITY_2_4 + // this was only for confusing people, use DoGetClippingBox only + virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) + { DoGetClippingBox(x, y, w, h); } +#endif + + virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) const + { + if ( x ) + *x = m_clipX1; + if ( y ) + *y = m_clipY1; + if ( w ) + *w = m_clipX2 - m_clipX1; + if ( h ) + *h = m_clipY2 - m_clipY1; + } + + virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const + { + if ( x ) *x = m_logicalOriginX; + if ( y ) *y = m_logicalOriginY; + } + + virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const + { + if ( x ) *x = m_deviceOriginX; + if ( y ) *y = m_deviceOriginY; + } + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const = 0; + + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + +#if wxUSE_SPLINES + virtual void DoDrawSpline(wxList *points); +#endif + +protected: + // unset clipping variables (after clipping region was destroyed) + void ResetClipping() + { + m_clipping = false; + + m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; + } + + // flags + bool m_colour:1; + bool m_ok:1; + bool m_clipping:1; + bool m_isInteractive:1; + bool m_isBBoxValid:1; + + // coordinate system variables + + // TODO short descriptions of what exactly they are would be nice... + + wxCoord m_logicalOriginX, m_logicalOriginY; + wxCoord m_deviceOriginX, m_deviceOriginY; + + double m_logicalScaleX, m_logicalScaleY; + double m_userScaleX, m_userScaleY; + double m_scaleX, m_scaleY; + + // Used by SetAxisOrientation() to invert the axes + int m_signX, m_signY; + + // bounding and clipping boxes + wxCoord m_minX, m_minY, m_maxX, m_maxY; + wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; + + int m_logicalFunction; + int m_backgroundMode; + int m_mappingMode; + + // GDI objects + wxPen m_pen; + wxBrush m_brush; + wxBrush m_backgroundBrush; + wxColour m_textForegroundColour; + wxColour m_textBackgroundColour; + wxFont m_font; + +#if wxUSE_PALETTE + wxPalette m_palette; + bool m_hasCustomPalette; +#endif // wxUSE_PALETTE + +private: + DECLARE_NO_COPY_CLASS(wxDCBase) + DECLARE_ABSTRACT_CLASS(wxDCBase) +}; + +// ---------------------------------------------------------------------------- +// now include the declaration of wxDC class +// ---------------------------------------------------------------------------- + +#if defined(__WXPALMOS__) + #include "wx/palmos/dc.h" +#elif defined(__WXMSW__) + #include "wx/msw/dc.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dc.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dc.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dc.h" +#elif defined(__WXX11__) + #include "wx/x11/dc.h" +#elif defined(__WXMGL__) + #include "wx/mgl/dc.h" +#elif defined(__WXDFB__) + #include "wx/dfb/dc.h" +#elif defined(__WXMAC__) + #include "wx/mac/dc.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/dc.h" +#elif defined(__WXPM__) + #include "wx/os2/dc.h" +#endif + +#if wxUSE_GRAPHICS_CONTEXT + #include "wx/dcgraph.h" +#endif + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC text colour and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCTextColourChanger +{ +public: + wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } + + wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) + { + Set(col); + } + + ~wxDCTextColourChanger() + { + if ( m_colFgOld.Ok() ) + m_dc.SetTextForeground(m_colFgOld); + } + + void Set(const wxColour& col) + { + if ( !m_colFgOld.Ok() ) + m_colFgOld = m_dc.GetTextForeground(); + m_dc.SetTextForeground(col); + } + +private: + wxDC& m_dc; + + wxColour m_colFgOld; + + DECLARE_NO_COPY_CLASS(wxDCTextColourChanger) +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC pen and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCPenChanger +{ +public: + wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen()) + { + m_dc.SetPen(pen); + } + + ~wxDCPenChanger() + { + if ( m_penOld.Ok() ) + m_dc.SetPen(m_penOld); + } + +private: + wxDC& m_dc; + + wxPen m_penOld; + + DECLARE_NO_COPY_CLASS(wxDCPenChanger) +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC brush and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCBrushChanger +{ +public: + wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush()) + { + m_dc.SetBrush(brush); + } + + ~wxDCBrushChanger() + { + if ( m_brushOld.Ok() ) + m_dc.SetBrush(m_brushOld); + } + +private: + wxDC& m_dc; + + wxBrush m_brushOld; + + DECLARE_NO_COPY_CLASS(wxDCBrushChanger) +}; + +// ---------------------------------------------------------------------------- +// another small helper class: sets the clipping region in its ctor and +// destroys it in the dtor +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCClipper +{ +public: + wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc) + { dc.SetClippingRegion(r); } + wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) + { dc.SetClippingRegion(r.x, r.y, r.width, r.height); } + wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) + { dc.SetClippingRegion(x, y, w, h); } + + ~wxDCClipper() { m_dc.DestroyClippingRegion(); } + +private: + wxDC& m_dc; + + DECLARE_NO_COPY_CLASS(wxDCClipper) +}; + +#endif // _WX_DC_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dcbuffer.h b/Externals/wxWidgets/include/wx/dcbuffer.h index 0e27ab8c76..46c28ba536 100644 --- a/Externals/wxWidgets/include/wx/dcbuffer.h +++ b/Externals/wxWidgets/include/wx/dcbuffer.h @@ -1,276 +1,276 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcbuffer.h -// Purpose: wxBufferedDC class -// Author: Ron Lee -// Modified by: Vadim Zeitlin (refactored, added bg preservation) -// Created: 16/03/02 -// RCS-ID: $Id: dcbuffer.h 44609 2007-03-05 08:58:09Z VZ $ -// Copyright: (c) Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCBUFFER_H_ -#define _WX_DCBUFFER_H_ - -#include "wx/dcmemory.h" -#include "wx/dcclient.h" -#include "wx/window.h" - -// Split platforms into two groups - those which have well-working -// double-buffering by default, and those which do not. -#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) - #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1 -#else - #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0 -#endif - - -// ---------------------------------------------------------------------------- -// Double buffering helper. -// ---------------------------------------------------------------------------- - -// Assumes the buffer bitmap covers the entire scrolled window, -// and prepares the window DC accordingly -#define wxBUFFER_VIRTUAL_AREA 0x01 - -// Assumes the buffer bitmap only covers the client area; -// does not prepare the window DC -#define wxBUFFER_CLIENT_AREA 0x02 - -class WXDLLEXPORT wxBufferedDC : public wxMemoryDC -{ -public: - // Default ctor, must subsequently call Init for two stage construction. - wxBufferedDC() - : m_dc(NULL), - m_buffer(NULL), - m_style(0) - { - } - - // Construct a wxBufferedDC using a user supplied buffer. - wxBufferedDC(wxDC *dc, - wxBitmap& buffer = wxNullBitmap, - int style = wxBUFFER_CLIENT_AREA) - : m_dc(NULL), m_buffer(NULL) - { - Init(dc, buffer, style); - } - - // Construct a wxBufferedDC with an internal buffer of 'area' - // (where area is usually something like the size of the window - // being buffered) - wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA) - : m_dc(NULL), m_buffer(NULL) - { - Init(dc, area, style); - } - - // The usually desired action in the dtor is to blit the buffer. - virtual ~wxBufferedDC() - { - if ( m_dc ) - UnMask(); - } - - // These reimplement the actions of the ctors for two stage creation - void Init(wxDC *dc, - wxBitmap& buffer = wxNullBitmap, - int style = wxBUFFER_CLIENT_AREA) - { - InitCommon(dc, style); - - m_buffer = &buffer; - - UseBuffer(); - } - - void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA) - { - InitCommon(dc, style); - - UseBuffer(area.x, area.y); - } - - // Blits the buffer to the dc, and detaches the dc from the buffer (so it - // can be effectively used once only). - // - // Usually called in the dtor or by the dtor of derived classes if the - // BufferedDC must blit before the derived class (which may own the dc it's - // blitting to) is destroyed. - void UnMask() - { - wxCHECK_RET( m_dc, _T("no underlying wxDC?") ); - wxASSERT_MSG( m_buffer && m_buffer->IsOk(), _T("invalid backing store") ); - - wxCoord x = 0, - y = 0; - - if ( m_style & wxBUFFER_CLIENT_AREA ) - GetDeviceOrigin(&x, &y); - - m_dc->Blit(0, 0, m_buffer->GetWidth(), m_buffer->GetHeight(), - this, -x, -y ); - m_dc = NULL; - } - - // Set and get the style - void SetStyle(int style) { m_style = style; } - int GetStyle() const { return m_style; } - -private: - // common part of Init()s - void InitCommon(wxDC *dc, int style) - { - wxASSERT_MSG( !m_dc, _T("wxBufferedDC already initialised") ); - - m_dc = dc; - m_style = style; - - // inherit the same layout direction as the original DC - if (dc && dc->IsOk()) - SetLayoutDirection(dc->GetLayoutDirection()); - } - - // check that the bitmap is valid and use it - void UseBuffer(wxCoord w = -1, wxCoord h = -1); - - // the underlying DC to which we copy everything drawn on this one in - // UnMask() - // - // NB: Without the existence of a wxNullDC, this must be a pointer, else it - // could probably be a reference. - wxDC *m_dc; - - // the buffer (selected in this DC), initially invalid - wxBitmap *m_buffer; - - // the buffering style - int m_style; - - DECLARE_DYNAMIC_CLASS(wxBufferedDC) - DECLARE_NO_COPY_CLASS(wxBufferedDC) -}; - - -// ---------------------------------------------------------------------------- -// Double buffered PaintDC. -// ---------------------------------------------------------------------------- - -// Creates a double buffered wxPaintDC, optionally allowing the -// user to specify their own buffer to use. -class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC -{ -public: - // If no bitmap is supplied by the user, a temporary one will be created. - wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA) - : m_paintdc(window) - { - // If we're buffering the virtual window, scale the paint DC as well - if (style & wxBUFFER_VIRTUAL_AREA) - window->PrepareDC( m_paintdc ); - - if( buffer.IsOk() ) - Init(&m_paintdc, buffer, style); - else - Init(&m_paintdc, GetBufferedSize(window, style), style); - } - - // If no bitmap is supplied by the user, a temporary one will be created. - wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA) - : m_paintdc(window) - { - // If we're using the virtual window, scale the paint DC as well - if (style & wxBUFFER_VIRTUAL_AREA) - window->PrepareDC( m_paintdc ); - - Init(&m_paintdc, GetBufferedSize(window, style), style); - } - - // default copy ctor ok. - - virtual ~wxBufferedPaintDC() - { - // We must UnMask here, else by the time the base class - // does it, the PaintDC will have already been destroyed. - UnMask(); - } - -protected: - // return the size needed by the buffer: this depends on whether we're - // buffering just the currently shown part or the total (scrolled) window - static wxSize GetBufferedSize(wxWindow *window, int style) - { - return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize() - : window->GetClientSize(); - } - -private: - wxPaintDC m_paintdc; - - DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC) - DECLARE_NO_COPY_CLASS(wxBufferedPaintDC) -}; - - - -// -// wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double- -// buffering by default. Otherwise it is a wxBufferedPaintDC. Thus, -// you can only expect it work with a simple constructor that -// accepts single wxWindow* argument. -// -#if wxALWAYS_NATIVE_DOUBLE_BUFFER - #define wxAutoBufferedPaintDCBase wxPaintDC -#else - #define wxAutoBufferedPaintDCBase wxBufferedPaintDC -#endif - - -#ifdef __WXDEBUG__ - -class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase -{ -public: - - wxAutoBufferedPaintDC(wxWindow* win) - : wxAutoBufferedPaintDCBase(win) - { - TestWinStyle(win); - } - - virtual ~wxAutoBufferedPaintDC() { } - -private: - - void TestWinStyle(wxWindow* win) - { - // Help the user to get the double-buffering working properly. - wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_CUSTOM, - wxT("In constructor, you need to call SetBackgroundStyle(wxBG_STYLE_CUSTOM), ") - wxT("and also, if needed, paint the background manually in the paint event handler.")); - } - - DECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC) -}; - -#else // !__WXDEBUG__ - -// In release builds, just use typedef -typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC; - -#endif - - -// Check if the window is natively double buffered and will return a wxPaintDC -// if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility -// to delete the wxDC pointer when finished with it. -inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window) -{ - if ( window->IsDoubleBuffered() ) - return new wxPaintDC(window); - else - return new wxBufferedPaintDC(window); -} - -#endif // _WX_DCBUFFER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcbuffer.h +// Purpose: wxBufferedDC class +// Author: Ron Lee +// Modified by: Vadim Zeitlin (refactored, added bg preservation) +// Created: 16/03/02 +// RCS-ID: $Id: dcbuffer.h 44609 2007-03-05 08:58:09Z VZ $ +// Copyright: (c) Ron Lee +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCBUFFER_H_ +#define _WX_DCBUFFER_H_ + +#include "wx/dcmemory.h" +#include "wx/dcclient.h" +#include "wx/window.h" + +// Split platforms into two groups - those which have well-working +// double-buffering by default, and those which do not. +#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) + #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1 +#else + #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0 +#endif + + +// ---------------------------------------------------------------------------- +// Double buffering helper. +// ---------------------------------------------------------------------------- + +// Assumes the buffer bitmap covers the entire scrolled window, +// and prepares the window DC accordingly +#define wxBUFFER_VIRTUAL_AREA 0x01 + +// Assumes the buffer bitmap only covers the client area; +// does not prepare the window DC +#define wxBUFFER_CLIENT_AREA 0x02 + +class WXDLLEXPORT wxBufferedDC : public wxMemoryDC +{ +public: + // Default ctor, must subsequently call Init for two stage construction. + wxBufferedDC() + : m_dc(NULL), + m_buffer(NULL), + m_style(0) + { + } + + // Construct a wxBufferedDC using a user supplied buffer. + wxBufferedDC(wxDC *dc, + wxBitmap& buffer = wxNullBitmap, + int style = wxBUFFER_CLIENT_AREA) + : m_dc(NULL), m_buffer(NULL) + { + Init(dc, buffer, style); + } + + // Construct a wxBufferedDC with an internal buffer of 'area' + // (where area is usually something like the size of the window + // being buffered) + wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA) + : m_dc(NULL), m_buffer(NULL) + { + Init(dc, area, style); + } + + // The usually desired action in the dtor is to blit the buffer. + virtual ~wxBufferedDC() + { + if ( m_dc ) + UnMask(); + } + + // These reimplement the actions of the ctors for two stage creation + void Init(wxDC *dc, + wxBitmap& buffer = wxNullBitmap, + int style = wxBUFFER_CLIENT_AREA) + { + InitCommon(dc, style); + + m_buffer = &buffer; + + UseBuffer(); + } + + void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA) + { + InitCommon(dc, style); + + UseBuffer(area.x, area.y); + } + + // Blits the buffer to the dc, and detaches the dc from the buffer (so it + // can be effectively used once only). + // + // Usually called in the dtor or by the dtor of derived classes if the + // BufferedDC must blit before the derived class (which may own the dc it's + // blitting to) is destroyed. + void UnMask() + { + wxCHECK_RET( m_dc, _T("no underlying wxDC?") ); + wxASSERT_MSG( m_buffer && m_buffer->IsOk(), _T("invalid backing store") ); + + wxCoord x = 0, + y = 0; + + if ( m_style & wxBUFFER_CLIENT_AREA ) + GetDeviceOrigin(&x, &y); + + m_dc->Blit(0, 0, m_buffer->GetWidth(), m_buffer->GetHeight(), + this, -x, -y ); + m_dc = NULL; + } + + // Set and get the style + void SetStyle(int style) { m_style = style; } + int GetStyle() const { return m_style; } + +private: + // common part of Init()s + void InitCommon(wxDC *dc, int style) + { + wxASSERT_MSG( !m_dc, _T("wxBufferedDC already initialised") ); + + m_dc = dc; + m_style = style; + + // inherit the same layout direction as the original DC + if (dc && dc->IsOk()) + SetLayoutDirection(dc->GetLayoutDirection()); + } + + // check that the bitmap is valid and use it + void UseBuffer(wxCoord w = -1, wxCoord h = -1); + + // the underlying DC to which we copy everything drawn on this one in + // UnMask() + // + // NB: Without the existence of a wxNullDC, this must be a pointer, else it + // could probably be a reference. + wxDC *m_dc; + + // the buffer (selected in this DC), initially invalid + wxBitmap *m_buffer; + + // the buffering style + int m_style; + + DECLARE_DYNAMIC_CLASS(wxBufferedDC) + DECLARE_NO_COPY_CLASS(wxBufferedDC) +}; + + +// ---------------------------------------------------------------------------- +// Double buffered PaintDC. +// ---------------------------------------------------------------------------- + +// Creates a double buffered wxPaintDC, optionally allowing the +// user to specify their own buffer to use. +class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC +{ +public: + // If no bitmap is supplied by the user, a temporary one will be created. + wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA) + : m_paintdc(window) + { + // If we're buffering the virtual window, scale the paint DC as well + if (style & wxBUFFER_VIRTUAL_AREA) + window->PrepareDC( m_paintdc ); + + if( buffer.IsOk() ) + Init(&m_paintdc, buffer, style); + else + Init(&m_paintdc, GetBufferedSize(window, style), style); + } + + // If no bitmap is supplied by the user, a temporary one will be created. + wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA) + : m_paintdc(window) + { + // If we're using the virtual window, scale the paint DC as well + if (style & wxBUFFER_VIRTUAL_AREA) + window->PrepareDC( m_paintdc ); + + Init(&m_paintdc, GetBufferedSize(window, style), style); + } + + // default copy ctor ok. + + virtual ~wxBufferedPaintDC() + { + // We must UnMask here, else by the time the base class + // does it, the PaintDC will have already been destroyed. + UnMask(); + } + +protected: + // return the size needed by the buffer: this depends on whether we're + // buffering just the currently shown part or the total (scrolled) window + static wxSize GetBufferedSize(wxWindow *window, int style) + { + return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize() + : window->GetClientSize(); + } + +private: + wxPaintDC m_paintdc; + + DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC) + DECLARE_NO_COPY_CLASS(wxBufferedPaintDC) +}; + + + +// +// wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double- +// buffering by default. Otherwise it is a wxBufferedPaintDC. Thus, +// you can only expect it work with a simple constructor that +// accepts single wxWindow* argument. +// +#if wxALWAYS_NATIVE_DOUBLE_BUFFER + #define wxAutoBufferedPaintDCBase wxPaintDC +#else + #define wxAutoBufferedPaintDCBase wxBufferedPaintDC +#endif + + +#ifdef __WXDEBUG__ + +class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase +{ +public: + + wxAutoBufferedPaintDC(wxWindow* win) + : wxAutoBufferedPaintDCBase(win) + { + TestWinStyle(win); + } + + virtual ~wxAutoBufferedPaintDC() { } + +private: + + void TestWinStyle(wxWindow* win) + { + // Help the user to get the double-buffering working properly. + wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_CUSTOM, + wxT("In constructor, you need to call SetBackgroundStyle(wxBG_STYLE_CUSTOM), ") + wxT("and also, if needed, paint the background manually in the paint event handler.")); + } + + DECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC) +}; + +#else // !__WXDEBUG__ + +// In release builds, just use typedef +typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC; + +#endif + + +// Check if the window is natively double buffered and will return a wxPaintDC +// if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility +// to delete the wxDC pointer when finished with it. +inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window) +{ + if ( window->IsDoubleBuffered() ) + return new wxPaintDC(window); + else + return new wxBufferedPaintDC(window); +} + +#endif // _WX_DCBUFFER_H_ diff --git a/Externals/wxWidgets/include/wx/dcclient.h b/Externals/wxWidgets/include/wx/dcclient.h index c770f6a2f7..c8bc31a151 100644 --- a/Externals/wxWidgets/include/wx/dcclient.h +++ b/Externals/wxWidgets/include/wx/dcclient.h @@ -1,42 +1,42 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcclient.h -// Purpose: wxClientDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcclient.h 40865 2006-08-27 09:42:42Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCCLIENT_H_BASE_ -#define _WX_DCCLIENT_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcclient.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcclient.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/dcclient.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/dcclient.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/dcclient.h" -#elif defined(__WXX11__) -#include "wx/x11/dcclient.h" -#elif defined(__WXMGL__) -#include "wx/mgl/dcclient.h" -#elif defined(__WXDFB__) -#include "wx/dfb/dcclient.h" -#elif defined(__WXMAC__) -#include "wx/mac/dcclient.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/dcclient.h" -#elif defined(__WXPM__) -#include "wx/os2/dcclient.h" -#endif - -#endif - // _WX_DCCLIENT_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcclient.h +// Purpose: wxClientDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dcclient.h 40865 2006-08-27 09:42:42Z VS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_BASE_ +#define _WX_DCCLIENT_H_BASE_ + +#include "wx/defs.h" + +#if defined(__WXPALMOS__) +#include "wx/palmos/dcclient.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcclient.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/dcclient.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/dcclient.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/dcclient.h" +#elif defined(__WXX11__) +#include "wx/x11/dcclient.h" +#elif defined(__WXMGL__) +#include "wx/mgl/dcclient.h" +#elif defined(__WXDFB__) +#include "wx/dfb/dcclient.h" +#elif defined(__WXMAC__) +#include "wx/mac/dcclient.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/dcclient.h" +#elif defined(__WXPM__) +#include "wx/os2/dcclient.h" +#endif + +#endif + // _WX_DCCLIENT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dcgraph.h b/Externals/wxWidgets/include/wx/dcgraph.h index 8245f8145e..e94996657f 100644 --- a/Externals/wxWidgets/include/wx/dcgraph.h +++ b/Externals/wxWidgets/include/wx/dcgraph.h @@ -1,190 +1,190 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/graphdc.h -// Purpose: graphics context device bridge header -// Author: Stefan Csomor -// Modified by: -// Created: -// Copyright: (c) Stefan Csomor -// RCS-ID: $Id: dcgraph.h 53390 2008-04-28 04:19:15Z KO $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GRAPHICS_DC_H_ -#define _WX_GRAPHICS_DC_H_ - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/geometry.h" -#include "wx/dynarray.h" -#include "wx/graphics.h" - -class WXDLLEXPORT wxWindowDC; - -#ifdef __WXMAC__ -#define wxGCDC wxDC -#endif - -class WXDLLEXPORT wxGCDC: -#ifdef __WXMAC__ - public wxDCBase -#else - public wxDC -#endif -{ - DECLARE_DYNAMIC_CLASS(wxGCDC) - DECLARE_NO_COPY_CLASS(wxGCDC) - -public: - wxGCDC(const wxWindowDC& dc); -#ifdef __WXMSW__ - wxGCDC( const wxMemoryDC& dc); -#endif - wxGCDC(); - virtual ~wxGCDC(); - - void Init(); - - - // implement base class pure virtuals - // ---------------------------------- - - virtual void Clear(); - - virtual bool StartDoc( const wxString& message ); - virtual void EndDoc(); - - virtual void StartPage(); - virtual void EndPage(); - - // to be virtualized on next major - // flushing the content of this dc immediately onto screen - void Flush(); - - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode); - virtual void SetPalette(const wxPalette& palette); - - virtual void DestroyClippingRegion(); - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(int mode); - virtual void SetUserScale(double x, double y); - - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); - - virtual void SetTextForeground(const wxColour& colour); - virtual void SetTextBackground(const wxColour& colour); - - virtual void ComputeScaleAndOrigin(); - - wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; } - virtual void SetGraphicsContext( wxGraphicsContext* ctx ); - -protected: - // the true implementations - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE); - - virtual void DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST); - - virtual void DoGradientFillConcentric(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - const wxPoint& circleCenter); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - - virtual void DoDrawPoint(wxCoord x, wxCoord y); - -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif - - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); - - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - - virtual void DoCrossHair(wxCoord x, wxCoord y); - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); - - virtual void DoGetSize(int *,int *) const; - virtual void DoGetSizeMM(int* width, int* height) const; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset); - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); - virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle); - - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; - - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - -protected: - // scaling variables - bool m_logicalFunctionSupported; - double m_mm_to_pix_x, m_mm_to_pix_y; - wxGraphicsMatrix m_matrixOriginal; - wxGraphicsMatrix m_matrixCurrent; - - double m_formerScaleX, m_formerScaleY; - - wxGraphicsContext* m_graphicContext; -}; - -#endif - -#endif // _WX_GRAPHICS_DC_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/graphdc.h +// Purpose: graphics context device bridge header +// Author: Stefan Csomor +// Modified by: +// Created: +// Copyright: (c) Stefan Csomor +// RCS-ID: $Id: dcgraph.h 53390 2008-04-28 04:19:15Z KO $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRAPHICS_DC_H_ +#define _WX_GRAPHICS_DC_H_ + +#if wxUSE_GRAPHICS_CONTEXT + +#include "wx/geometry.h" +#include "wx/dynarray.h" +#include "wx/graphics.h" + +class WXDLLEXPORT wxWindowDC; + +#ifdef __WXMAC__ +#define wxGCDC wxDC +#endif + +class WXDLLEXPORT wxGCDC: +#ifdef __WXMAC__ + public wxDCBase +#else + public wxDC +#endif +{ + DECLARE_DYNAMIC_CLASS(wxGCDC) + DECLARE_NO_COPY_CLASS(wxGCDC) + +public: + wxGCDC(const wxWindowDC& dc); +#ifdef __WXMSW__ + wxGCDC( const wxMemoryDC& dc); +#endif + wxGCDC(); + virtual ~wxGCDC(); + + void Init(); + + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual bool StartDoc( const wxString& message ); + virtual void EndDoc(); + + virtual void StartPage(); + virtual void EndPage(); + + // to be virtualized on next major + // flushing the content of this dc immediately onto screen + void Flush(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); + virtual void SetPalette(const wxPalette& palette); + + virtual void DestroyClippingRegion(); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + + virtual bool CanDrawBitmap() const; + virtual bool CanGetTextExtent() const; + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void SetMapMode(int mode); + virtual void SetUserScale(double x, double y); + + virtual void SetLogicalScale(double x, double y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + virtual void SetLogicalFunction(int function); + + virtual void SetTextForeground(const wxColour& colour); + virtual void SetTextBackground(const wxColour& colour); + + virtual void ComputeScaleAndOrigin(); + + wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; } + virtual void SetGraphicsContext( wxGraphicsContext* ctx ); + +protected: + // the true implementations + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE); + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST); + + virtual void DoGradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + +#if wxUSE_SPLINES + virtual void DoDrawSpline(wxList *points); +#endif + + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + virtual void DoGetSize(int *,int *) const; + virtual void DoGetSizeMM(int* width, int* height) const; + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle); + + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; + + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + +protected: + // scaling variables + bool m_logicalFunctionSupported; + double m_mm_to_pix_x, m_mm_to_pix_y; + wxGraphicsMatrix m_matrixOriginal; + wxGraphicsMatrix m_matrixCurrent; + + double m_formerScaleX, m_formerScaleY; + + wxGraphicsContext* m_graphicContext; +}; + +#endif + +#endif // _WX_GRAPHICS_DC_H_ diff --git a/Externals/wxWidgets/include/wx/dcmemory.h b/Externals/wxWidgets/include/wx/dcmemory.h index cd7bb0c9d9..68d4355ac9 100644 --- a/Externals/wxWidgets/include/wx/dcmemory.h +++ b/Externals/wxWidgets/include/wx/dcmemory.h @@ -1,76 +1,76 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcmemory.h -// Purpose: wxMemoryDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcmemory.h 43843 2006-12-07 05:44:44Z PC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCMEMORY_H_BASE_ -#define _WX_DCMEMORY_H_BASE_ - -#include "wx/bitmap.h" - -// NOTE: different native implementations of wxMemoryDC will derive from -// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that -// we cannot derive wxMemoryDCBase from wxDC and then use it as the -// only base class for native impl of wxMemoryDC... -class WXDLLEXPORT wxMemoryDCBase -{ -public: - wxMemoryDCBase() { } - - // avoid warnings about having virtual functions but non virtual dtor - virtual ~wxMemoryDCBase() { } - - // select the given bitmap to draw on it - void SelectObject(wxBitmap& bmp) - { - // make sure that the given wxBitmap is not sharing its data with other - // wxBitmap instances as its contents will be modified by any drawing - // operation done on this DC - if (bmp.IsOk()) - bmp.UnShare(); - - DoSelect(bmp); - } - - // select the given bitmap for read-only - virtual void SelectObjectAsSource(const wxBitmap& bmp) - { - DoSelect(bmp); - } - -protected: - virtual void DoSelect(const wxBitmap& bmp) = 0; -}; - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcmemory.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcmemory.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/dcmemory.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/dcmemory.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/dcmemory.h" -#elif defined(__WXX11__) -#include "wx/x11/dcmemory.h" -#elif defined(__WXMGL__) -#include "wx/mgl/dcmemory.h" -#elif defined(__WXDFB__) -#include "wx/dfb/dcmemory.h" -#elif defined(__WXMAC__) -#include "wx/mac/dcmemory.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/dcmemory.h" -#elif defined(__WXPM__) -#include "wx/os2/dcmemory.h" -#endif - -#endif - // _WX_DCMEMORY_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcmemory.h +// Purpose: wxMemoryDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dcmemory.h 43843 2006-12-07 05:44:44Z PC $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_BASE_ +#define _WX_DCMEMORY_H_BASE_ + +#include "wx/bitmap.h" + +// NOTE: different native implementations of wxMemoryDC will derive from +// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that +// we cannot derive wxMemoryDCBase from wxDC and then use it as the +// only base class for native impl of wxMemoryDC... +class WXDLLEXPORT wxMemoryDCBase +{ +public: + wxMemoryDCBase() { } + + // avoid warnings about having virtual functions but non virtual dtor + virtual ~wxMemoryDCBase() { } + + // select the given bitmap to draw on it + void SelectObject(wxBitmap& bmp) + { + // make sure that the given wxBitmap is not sharing its data with other + // wxBitmap instances as its contents will be modified by any drawing + // operation done on this DC + if (bmp.IsOk()) + bmp.UnShare(); + + DoSelect(bmp); + } + + // select the given bitmap for read-only + virtual void SelectObjectAsSource(const wxBitmap& bmp) + { + DoSelect(bmp); + } + +protected: + virtual void DoSelect(const wxBitmap& bmp) = 0; +}; + +#if defined(__WXPALMOS__) +#include "wx/palmos/dcmemory.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcmemory.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/dcmemory.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/dcmemory.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/dcmemory.h" +#elif defined(__WXX11__) +#include "wx/x11/dcmemory.h" +#elif defined(__WXMGL__) +#include "wx/mgl/dcmemory.h" +#elif defined(__WXDFB__) +#include "wx/dfb/dcmemory.h" +#elif defined(__WXMAC__) +#include "wx/mac/dcmemory.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/dcmemory.h" +#elif defined(__WXPM__) +#include "wx/os2/dcmemory.h" +#endif + +#endif + // _WX_DCMEMORY_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dcmirror.h b/Externals/wxWidgets/include/wx/dcmirror.h index 0faad6680f..bc15a398e4 100644 --- a/Externals/wxWidgets/include/wx/dcmirror.h +++ b/Externals/wxWidgets/include/wx/dcmirror.h @@ -1,287 +1,287 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dcmirror.h -// Purpose: wxMirrorDC class -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.07.2003 -// RCS-ID: $Id: dcmirror.h 41751 2006-10-08 21:56:55Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCMIRROR_H_ -#define _WX_DCMIRROR_H_ - -#include "wx/dc.h" - -// ---------------------------------------------------------------------------- -// wxMirrorDC allows to write the same code for horz/vertical layout -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMirrorDC : public wxDC -{ -public: - // constructs a mirror DC associated with the given real DC - // - // if mirror parameter is true, all vertical and horizontal coordinates are - // exchanged, otherwise this class behaves in exactly the same way as a - // plain DC - // - // the cast to wxMirrorDC is a dirty hack done to allow us to call the - // protected methods of wxDCBase directly in our code below, without it it - // would be impossible (this is correct from C++ point of view but doesn't - // make any sense in this particular situation) - wxMirrorDC(wxDC& dc, bool mirror) : m_dc((wxMirrorDC&)dc) - { m_mirror = mirror; } - - // wxDCBase operations - virtual void Clear() { m_dc.Clear(); } - virtual void SetFont(const wxFont& font) { m_dc.SetFont(font); } - virtual void SetPen(const wxPen& pen) { m_dc.SetPen(pen); } - virtual void SetBrush(const wxBrush& brush) { m_dc.SetBrush(brush); } - virtual void SetBackground(const wxBrush& brush) - { m_dc.SetBackground(brush); } - virtual void SetBackgroundMode(int mode) { m_dc.SetBackgroundMode(mode); } -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette) - { m_dc.SetPalette(palette); } -#endif // wxUSE_PALETTE - virtual void DestroyClippingRegion() { m_dc.DestroyClippingRegion(); } - virtual wxCoord GetCharHeight() const { return m_dc.GetCharHeight(); } - virtual wxCoord GetCharWidth() const { return m_dc.GetCharWidth(); } - virtual bool CanDrawBitmap() const { return m_dc.CanDrawBitmap(); } - virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); } - virtual int GetDepth() const { return m_dc.GetDepth(); } - virtual wxSize GetPPI() const { return m_dc.GetPPI(); } - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return m_dc.Ok(); } - virtual void SetMapMode(int mode) { m_dc.SetMapMode(mode); } - virtual void SetUserScale(double x, double y) - { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } - virtual void SetLogicalOrigin(wxCoord x, wxCoord y) - { m_dc.SetLogicalOrigin(GetX(x, y), GetY(x, y)); } - virtual void SetDeviceOrigin(wxCoord x, wxCoord y) - { m_dc.SetDeviceOrigin(GetX(x, y), GetY(x, y)); } - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) - { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp), - GetY(xLeftRight, yBottomUp)); } - virtual void SetLogicalFunction(int function) - { m_dc.SetLogicalFunction(function); } - - // helper functions which may be useful for the users of this class - wxSize Reflect(const wxSize& sizeOrig) - { - return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig; - } - -protected: - // returns x and y if not mirroring or y and x if mirroring - wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; } - wxCoord GetY(wxCoord x, wxCoord y) const { return m_mirror ? x : y; } - double GetX(double x, double y) const { return m_mirror ? y : x; } - double GetY(double x, double y) const { return m_mirror ? x : y; } - bool GetX(bool x, bool y) const { return m_mirror ? y : x; } - bool GetY(bool x, bool y) const { return m_mirror ? x : y; } - - // same thing but for pointers - wxCoord *GetX(wxCoord *x, wxCoord *y) const { return m_mirror ? y : x; } - wxCoord *GetY(wxCoord *x, wxCoord *y) const { return m_mirror ? x : y; } - - // exchange x and y unconditionally - static void Swap(wxCoord& x, wxCoord& y) - { - wxCoord t = x; - x = y; - y = t; - } - - // exchange x and y components of all points in the array if necessary - void Mirror(int n, wxPoint points[]) const - { - if ( m_mirror ) - { - for ( int i = 0; i < n; i++ ) - { - Swap(points[i].x, points[i].y); - } - } - } - - - // wxDCBase functions - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE) - { - return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style); - } - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const - { - return m_dc.DoGetPixel(GetX(x, y), GetY(x, y), col); - } - - - virtual void DoDrawPoint(wxCoord x, wxCoord y) - { - m_dc.DoDrawPoint(GetX(x, y), GetY(x, y)); - } - - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) - { - m_dc.DoDrawLine(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2)); - } - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) - { - wxFAIL_MSG( _T("this is probably wrong") ); - - m_dc.DoDrawArc(GetX(x1, y1), GetY(x1, y1), - GetX(x2, y2), GetY(x2, y2), - xc, yc); - } - - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord w, wxCoord h) - { - m_dc.DoDrawCheckMark(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h)); - } - - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) - { - wxFAIL_MSG( _T("this is probably wrong") ); - - m_dc.DoDrawEllipticArc(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h), - sa, ea); - } - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { - m_dc.DoDrawRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); - } - - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double radius) - { - m_dc.DoDrawRoundedRectangle(GetX(x, y), GetY(x, y), - GetX(w, h), GetY(w, h), - radius); - } - - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { - m_dc.DoDrawEllipse(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); - } - - virtual void DoCrossHair(wxCoord x, wxCoord y) - { - m_dc.DoCrossHair(GetX(x, y), GetY(x, y)); - } - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) - { - m_dc.DoDrawIcon(icon, GetX(x, y), GetY(x, y)); - } - - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) - { - m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask); - } - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) - { - // this is never mirrored - m_dc.DoDrawText(text, x, y); - } - - virtual void DoDrawRotatedText(const wxString& text, - wxCoord x, wxCoord y, double angle) - { - // this is never mirrored - m_dc.DoDrawRotatedText(text, x, y, angle); - } - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, - wxCoord w, wxCoord h, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) - { - return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), - GetX(w, h), GetY(w, h), - source, GetX(xsrc, ysrc), GetY(xsrc, ysrc), - rop, useMask, - GetX(xsrcMask, ysrcMask), GetX(xsrcMask, ysrcMask)); - } - - virtual void DoGetSize(int *w, int *h) const - { - m_dc.DoGetSize(GetX(w, h), GetY(w, h)); - } - - virtual void DoGetSizeMM(int *w, int *h) const - { - m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h)); - } - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset) - { - Mirror(n, points); - - m_dc.DoDrawLines(n, points, - GetX(xoffset, yoffset), GetY(xoffset, yoffset)); - - Mirror(n, points); - } - - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE) - { - Mirror(n, points); - - m_dc.DoDrawPolygon(n, points, - GetX(xoffset, yoffset), GetY(xoffset, yoffset), - fillStyle); - - Mirror(n, points); - } - - virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region)) - { - wxFAIL_MSG( _T("not implemented") ); - } - - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord w, wxCoord h) - { - m_dc.DoSetClippingRegion(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); - } - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const - { - // never mirrored - m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); - } - -private: - wxMirrorDC& m_dc; - - bool m_mirror; - - DECLARE_NO_COPY_CLASS(wxMirrorDC) -}; - -#endif // _WX_DCMIRROR_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dcmirror.h +// Purpose: wxMirrorDC class +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.07.2003 +// RCS-ID: $Id: dcmirror.h 41751 2006-10-08 21:56:55Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMIRROR_H_ +#define _WX_DCMIRROR_H_ + +#include "wx/dc.h" + +// ---------------------------------------------------------------------------- +// wxMirrorDC allows to write the same code for horz/vertical layout +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMirrorDC : public wxDC +{ +public: + // constructs a mirror DC associated with the given real DC + // + // if mirror parameter is true, all vertical and horizontal coordinates are + // exchanged, otherwise this class behaves in exactly the same way as a + // plain DC + // + // the cast to wxMirrorDC is a dirty hack done to allow us to call the + // protected methods of wxDCBase directly in our code below, without it it + // would be impossible (this is correct from C++ point of view but doesn't + // make any sense in this particular situation) + wxMirrorDC(wxDC& dc, bool mirror) : m_dc((wxMirrorDC&)dc) + { m_mirror = mirror; } + + // wxDCBase operations + virtual void Clear() { m_dc.Clear(); } + virtual void SetFont(const wxFont& font) { m_dc.SetFont(font); } + virtual void SetPen(const wxPen& pen) { m_dc.SetPen(pen); } + virtual void SetBrush(const wxBrush& brush) { m_dc.SetBrush(brush); } + virtual void SetBackground(const wxBrush& brush) + { m_dc.SetBackground(brush); } + virtual void SetBackgroundMode(int mode) { m_dc.SetBackgroundMode(mode); } +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) + { m_dc.SetPalette(palette); } +#endif // wxUSE_PALETTE + virtual void DestroyClippingRegion() { m_dc.DestroyClippingRegion(); } + virtual wxCoord GetCharHeight() const { return m_dc.GetCharHeight(); } + virtual wxCoord GetCharWidth() const { return m_dc.GetCharWidth(); } + virtual bool CanDrawBitmap() const { return m_dc.CanDrawBitmap(); } + virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); } + virtual int GetDepth() const { return m_dc.GetDepth(); } + virtual wxSize GetPPI() const { return m_dc.GetPPI(); } + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return m_dc.Ok(); } + virtual void SetMapMode(int mode) { m_dc.SetMapMode(mode); } + virtual void SetUserScale(double x, double y) + { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } + virtual void SetLogicalOrigin(wxCoord x, wxCoord y) + { m_dc.SetLogicalOrigin(GetX(x, y), GetY(x, y)); } + virtual void SetDeviceOrigin(wxCoord x, wxCoord y) + { m_dc.SetDeviceOrigin(GetX(x, y), GetY(x, y)); } + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) + { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp), + GetY(xLeftRight, yBottomUp)); } + virtual void SetLogicalFunction(int function) + { m_dc.SetLogicalFunction(function); } + + // helper functions which may be useful for the users of this class + wxSize Reflect(const wxSize& sizeOrig) + { + return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig; + } + +protected: + // returns x and y if not mirroring or y and x if mirroring + wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; } + wxCoord GetY(wxCoord x, wxCoord y) const { return m_mirror ? x : y; } + double GetX(double x, double y) const { return m_mirror ? y : x; } + double GetY(double x, double y) const { return m_mirror ? x : y; } + bool GetX(bool x, bool y) const { return m_mirror ? y : x; } + bool GetY(bool x, bool y) const { return m_mirror ? x : y; } + + // same thing but for pointers + wxCoord *GetX(wxCoord *x, wxCoord *y) const { return m_mirror ? y : x; } + wxCoord *GetY(wxCoord *x, wxCoord *y) const { return m_mirror ? x : y; } + + // exchange x and y unconditionally + static void Swap(wxCoord& x, wxCoord& y) + { + wxCoord t = x; + x = y; + y = t; + } + + // exchange x and y components of all points in the array if necessary + void Mirror(int n, wxPoint points[]) const + { + if ( m_mirror ) + { + for ( int i = 0; i < n; i++ ) + { + Swap(points[i].x, points[i].y); + } + } + } + + + // wxDCBase functions + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE) + { + return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style); + } + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const + { + return m_dc.DoGetPixel(GetX(x, y), GetY(x, y), col); + } + + + virtual void DoDrawPoint(wxCoord x, wxCoord y) + { + m_dc.DoDrawPoint(GetX(x, y), GetY(x, y)); + } + + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + { + m_dc.DoDrawLine(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2)); + } + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) + { + wxFAIL_MSG( _T("this is probably wrong") ); + + m_dc.DoDrawArc(GetX(x1, y1), GetY(x1, y1), + GetX(x2, y2), GetY(x2, y2), + xc, yc); + } + + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) + { + m_dc.DoDrawCheckMark(GetX(x, y), GetY(x, y), + GetX(w, h), GetY(w, h)); + } + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) + { + wxFAIL_MSG( _T("this is probably wrong") ); + + m_dc.DoDrawEllipticArc(GetX(x, y), GetY(x, y), + GetX(w, h), GetY(w, h), + sa, ea); + } + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) + { + m_dc.DoDrawRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); + } + + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord w, wxCoord h, + double radius) + { + m_dc.DoDrawRoundedRectangle(GetX(x, y), GetY(x, y), + GetX(w, h), GetY(w, h), + radius); + } + + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) + { + m_dc.DoDrawEllipse(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); + } + + virtual void DoCrossHair(wxCoord x, wxCoord y) + { + m_dc.DoCrossHair(GetX(x, y), GetY(x, y)); + } + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) + { + m_dc.DoDrawIcon(icon, GetX(x, y), GetY(x, y)); + } + + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) + { + m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask); + } + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) + { + // this is never mirrored + m_dc.DoDrawText(text, x, y); + } + + virtual void DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, double angle) + { + // this is never mirrored + m_dc.DoDrawRotatedText(text, x, y, angle); + } + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord w, wxCoord h, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) + { + return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), + GetX(w, h), GetY(w, h), + source, GetX(xsrc, ysrc), GetY(xsrc, ysrc), + rop, useMask, + GetX(xsrcMask, ysrcMask), GetX(xsrcMask, ysrcMask)); + } + + virtual void DoGetSize(int *w, int *h) const + { + m_dc.DoGetSize(GetX(w, h), GetY(w, h)); + } + + virtual void DoGetSizeMM(int *w, int *h) const + { + m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h)); + } + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset) + { + Mirror(n, points); + + m_dc.DoDrawLines(n, points, + GetX(xoffset, yoffset), GetY(xoffset, yoffset)); + + Mirror(n, points); + } + + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE) + { + Mirror(n, points); + + m_dc.DoDrawPolygon(n, points, + GetX(xoffset, yoffset), GetY(xoffset, yoffset), + fillStyle); + + Mirror(n, points); + } + + virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region)) + { + wxFAIL_MSG( _T("not implemented") ); + } + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) + { + m_dc.DoSetClippingRegion(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); + } + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const + { + // never mirrored + m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); + } + +private: + wxMirrorDC& m_dc; + + bool m_mirror; + + DECLARE_NO_COPY_CLASS(wxMirrorDC) +}; + +#endif // _WX_DCMIRROR_H_ + diff --git a/Externals/wxWidgets/include/wx/dcprint.h b/Externals/wxWidgets/include/wx/dcprint.h index b22394b089..5a40911d18 100644 --- a/Externals/wxWidgets/include/wx/dcprint.h +++ b/Externals/wxWidgets/include/wx/dcprint.h @@ -1,33 +1,33 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcprint.h -// Purpose: wxPrinterDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcprint.h 41240 2006-09-15 16:45:48Z PC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCPRINT_H_BASE_ -#define _WX_DCPRINT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcprint.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcprint.h" -#endif -#if defined(__WXPM__) -#include "wx/os2/dcprint.h" -#endif -#if defined(__WXMAC__) -#include "wx/mac/dcprint.h" -#endif - -#endif // wxUSE_PRINTING_ARCHITECTURE -#endif - // _WX_DCPRINT_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcprint.h +// Purpose: wxPrinterDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dcprint.h 41240 2006-09-15 16:45:48Z PC $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_BASE_ +#define _WX_DCPRINT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#if defined(__WXPALMOS__) +#include "wx/palmos/dcprint.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcprint.h" +#endif +#if defined(__WXPM__) +#include "wx/os2/dcprint.h" +#endif +#if defined(__WXMAC__) +#include "wx/mac/dcprint.h" +#endif + +#endif // wxUSE_PRINTING_ARCHITECTURE +#endif + // _WX_DCPRINT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dcps.h b/Externals/wxWidgets/include/wx/dcps.h index 0adffb7e49..2615d33243 100644 --- a/Externals/wxWidgets/include/wx/dcps.h +++ b/Externals/wxWidgets/include/wx/dcps.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcps.h -// Purpose: wxPostScriptDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcps.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCPS_H_BASE_ -#define _WX_DCPS_H_BASE_ - -#include "wx/generic/dcpsg.h" - -#endif - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcps.h +// Purpose: wxPostScriptDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dcps.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPS_H_BASE_ +#define _WX_DCPS_H_BASE_ + +#include "wx/generic/dcpsg.h" + +#endif + diff --git a/Externals/wxWidgets/include/wx/dcscreen.h b/Externals/wxWidgets/include/wx/dcscreen.h index 8b52dd9594..7e59787efa 100644 --- a/Externals/wxWidgets/include/wx/dcscreen.h +++ b/Externals/wxWidgets/include/wx/dcscreen.h @@ -1,42 +1,42 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dcscreen.h -// Purpose: wxScreenDC base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dcscreen.h 40865 2006-08-27 09:42:42Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCSCREEN_H_BASE_ -#define _WX_DCSCREEN_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) -#include "wx/palmos/dcscreen.h" -#elif defined(__WXMSW__) -#include "wx/msw/dcscreen.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/dcscreen.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/dcscreen.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/dcscreen.h" -#elif defined(__WXX11__) -#include "wx/x11/dcscreen.h" -#elif defined(__WXMGL__) -#include "wx/mgl/dcscreen.h" -#elif defined(__WXDFB__) -#include "wx/dfb/dcscreen.h" -#elif defined(__WXMAC__) -#include "wx/mac/dcscreen.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/dcscreen.h" -#elif defined(__WXPM__) -#include "wx/os2/dcscreen.h" -#endif - -#endif - // _WX_DCSCREEN_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcscreen.h +// Purpose: wxScreenDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dcscreen.h 40865 2006-08-27 09:42:42Z VS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_BASE_ +#define _WX_DCSCREEN_H_BASE_ + +#include "wx/defs.h" + +#if defined(__WXPALMOS__) +#include "wx/palmos/dcscreen.h" +#elif defined(__WXMSW__) +#include "wx/msw/dcscreen.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/dcscreen.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/dcscreen.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/dcscreen.h" +#elif defined(__WXX11__) +#include "wx/x11/dcscreen.h" +#elif defined(__WXMGL__) +#include "wx/mgl/dcscreen.h" +#elif defined(__WXDFB__) +#include "wx/dfb/dcscreen.h" +#elif defined(__WXMAC__) +#include "wx/mac/dcscreen.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/dcscreen.h" +#elif defined(__WXPM__) +#include "wx/os2/dcscreen.h" +#endif + +#endif + // _WX_DCSCREEN_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dde.h b/Externals/wxWidgets/include/wx/dde.h index 495e9e27a3..402a6ec70d 100644 --- a/Externals/wxWidgets/include/wx/dde.h +++ b/Externals/wxWidgets/include/wx/dde.h @@ -1,32 +1,32 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dde.h -// Purpose: DDE base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DDE_H_BASE_ -#define _WX_DDE_H_BASE_ - -#include "wx/list.h" - -class WXDLLIMPEXP_FWD_BASE wxDDEClient; -class WXDLLIMPEXP_FWD_BASE wxDDEServer; -class WXDLLIMPEXP_FWD_BASE wxDDEConnection; - -WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE); - -#if defined(__WXMSW__) - #include "wx/msw/dde.h" -#else - #error DDE is only supported on MSW -#endif - -#endif - // _WX_DDE_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dde.h +// Purpose: DDE base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DDE_H_BASE_ +#define _WX_DDE_H_BASE_ + +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_BASE wxDDEClient; +class WXDLLIMPEXP_FWD_BASE wxDDEServer; +class WXDLLIMPEXP_FWD_BASE wxDDEConnection; + +WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE); + +#if defined(__WXMSW__) + #include "wx/msw/dde.h" +#else + #error DDE is only supported on MSW +#endif + +#endif + // _WX_DDE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/debug.h b/Externals/wxWidgets/include/wx/debug.h index 61cd93875c..2fa1542336 100644 --- a/Externals/wxWidgets/include/wx/debug.h +++ b/Externals/wxWidgets/include/wx/debug.h @@ -1,308 +1,308 @@ -/** -* Name: wx/debug.h -* Purpose: Misc debug functions and macros -* Author: Vadim Zeitlin -* Modified by: Ryan Norton (Converted to C) -* Created: 29/01/98 -* RCS-ID: $Id: debug.h 53711 2008-05-22 22:58:28Z SN $ -* Copyright: (c) 1998 Vadim Zeitlin -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_DEBUG_H_ -#define _WX_DEBUG_H_ - -#ifndef __WXWINCE__ -#include -#endif -#include /* for CHAR_BIT used below */ - -#include "wx/wxchar.h" /* for __TFILE__ and wxChar */ - -/* ---------------------------------------------------------------------------- */ -/* Defines controlling the debugging macros */ -/* ---------------------------------------------------------------------------- */ - -/* if _DEBUG is defined (MS VC++ and others use it in debug builds), define */ -/* __WXDEBUG__ too */ -#ifdef _DEBUG - #ifndef __WXDEBUG__ - #define __WXDEBUG__ - #endif /* !__WXDEBUG__ */ -#endif /* _DEBUG */ - -/* if NDEBUG is defined ( uses it), undef __WXDEBUG__ and WXDEBUG */ -#ifdef NDEBUG - #undef __WXDEBUG__ - #undef WXDEBUG -#endif /* NDEBUG */ - -/* if __WXDEBUG__ is defined, make sure that WXDEBUG is defined and >= 1 */ -#ifdef __WXDEBUG__ - #if !defined(WXDEBUG) || !WXDEBUG - #undef WXDEBUG - #define WXDEBUG 1 - #endif /* !WXDEBUG */ -#endif /* __WXDEBUG__ */ - -#ifndef __WXFUNCTION__ - /* TODO: add more compilers supporting __FUNCTION__ */ - #if defined(__DMC__) - /* - __FUNCTION__ happens to be not defined within class members - http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485 - */ - #define __WXFUNCTION__ (NULL) - #elif defined(__GNUC__) || \ - (defined(_MSC_VER) && _MSC_VER >= 1300) || \ - defined(__FUNCTION__) - #define __WXFUNCTION__ __FUNCTION__ - #else - /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */ - #define __WXFUNCTION__ (NULL) - #endif -#endif /* __WXFUNCTION__ already defined */ - -/* ---------------------------------------------------------------------------- */ -/* Debugging macros */ -/* */ -/* All debugging macros rely on ASSERT() which in turn calls the user-defined */ -/* OnAssert() function. To keep things simple, it's called even when the */ -/* expression is true (i.e. everything is ok) and by default does nothing: just */ -/* returns the same value back. But if you redefine it to do something more sexy */ -/* (popping up a message box in your favourite GUI, sending you e-mail or */ -/* whatever) it will affect all ASSERTs, FAILs and CHECKs in your code. */ -/* */ -/* Warning: if you don't like advice on programming style, don't read */ -/* further! ;-) */ -/* */ -/* Extensive use of these macros is recommended! Remember that ASSERTs are */ -/* disabled in final build (without __WXDEBUG__ defined), so they add strictly */ -/* nothing to your program's code. On the other hand, CHECK macros do stay */ -/* even in release builds, but in general are not much of a burden, while */ -/* a judicious use of them might increase your program's stability. */ -/* ---------------------------------------------------------------------------- */ - -/* Macros which are completely disabled in 'release' mode */ -/* */ -/* NB: these functions are implemented in src/common/appcmn.cpp */ -#if defined(__cplusplus) && defined(__WXDEBUG__) - /* - This function is called whenever one of debugging macros fails (i.e. - condition is false in an assertion). To customize its behaviour, override - wxApp::OnAssert(). - - Parameters: - szFile and nLine - file name and line number of the ASSERT - szFunc - function name of the ASSERT, may be NULL (NB: ASCII) - szCond - text form of the condition which failed - szMsg - optional message explaining the reason - */ - extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile, - int nLine, - const char *szFunc, - const wxChar *szCond, - const wxChar *szMsg = NULL); - - /* call this function to break into the debugger unconditionally (assuming */ - /* the program is running under debugger, of course) */ - extern void WXDLLIMPEXP_BASE wxTrap(); - - /* generic assert macro */ - #define wxASSERT(cond) wxASSERT_MSG(cond, NULL) - - - /* assert with additional message explaining its cause */ - - /* compilers can give a warning (such as "possible unwanted ;") when using */ - /* the default definition of wxASSERT_MSG so we provide an alternative */ - #if defined(__MWERKS__) - #define wxASSERT_MSG(cond, msg) \ - if ( cond ) \ - {} \ - else \ - wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg) - #else - #define wxASSERT_MSG(cond, msg) \ - if ( cond ) \ - ; \ - else \ - wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg) - #endif - - /* special form of assert: always triggers it (in debug mode) */ - #define wxFAIL wxFAIL_MSG(NULL) - - /* FAIL with some message */ - #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("wxAssertFailure", msg) - - /* FAIL with some message and a condition */ - #define wxFAIL_COND_MSG(cond, msg) \ - wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(cond), msg) - - /* An assert helper used to avoid warning when testing constant expressions, */ - /* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */ - /* expression being always true, but not using */ - /* wxASSERT( wxAssertIsEqual(sizeof(int), 4) ) */ - /* */ - /* NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no */ - /* longer be used. */ - extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y); -#else - #define wxTrap() - - /* nothing to do in release mode (hopefully at this moment there are */ - /* no more bugs ;-) */ - #define wxASSERT(cond) - #define wxASSERT_MSG(cond, msg) - #define wxFAIL - #define wxFAIL_MSG(msg) - #define wxFAIL_COND_MSG(cond, msg) -#endif /* __WXDEBUG__ */ - -#ifdef __cplusplus - /* Use of wxFalse instead of false suppresses compiler warnings about testing */ - /* constant expression */ - extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse; -#endif - -#define wxAssertFailure wxFalse - -/* NB: the following macros also work in release mode! */ - -/* - These macros must be used only in invalid situation: for example, an - invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of - dereferencing it and causing core dump the function might try using - CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") ) -*/ - -/* check that expression is true, "return" if not (also FAILs in debug mode) */ -#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, NULL) - -/* as wxCHECK but with a message explaining why we fail */ -#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg) - -/* check that expression is true, perform op if not */ -#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, NULL) - -/* as wxCHECK2 but with a message explaining why we fail */ - -/* see comment near the definition of wxASSERT_MSG for the # if/else reason */ -#if defined(__MWERKS__) - #define wxCHECK2_MSG(cond, op, msg) \ - if ( cond ) \ - {} \ - else \ - { \ - wxFAIL_COND_MSG(#cond, msg); \ - op; \ - } \ - struct wxDummyCheckStruct /* just to force a semicolon */ -#else - #define wxCHECK2_MSG(cond, op, msg) \ - if ( cond ) \ - ; \ - else \ - { \ - wxFAIL_COND_MSG(#cond, msg); \ - op; \ - } \ - typedef int wxDummyCheckInt /* just to force a semicolon */ - /* NB: old gcc versions (e.g. 2.8) give an internal compiler error */ - /* on a simple forward declaration, when used in a template */ - /* function, so rather use a dummy typedef which does work... */ -#endif - -/* special form of wxCHECK2: as wxCHECK, but for use in void functions */ -/* */ -/* NB: there is only one form (with msg parameter) and it's intentional: */ -/* there is no other way to tell the caller what exactly went wrong */ -/* from the void function (of course, the function shouldn't be void */ -/* to begin with...) */ -#define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg) - -/* ---------------------------------------------------------------------------- */ -/* Compile time asserts */ -/* */ -/* Unlike the normal assert and related macros above which are checked during */ -/* the program tun-time the macros below will result in a compilation error if */ -/* the condition they check is false. This is usually used to check the */ -/* expressions containing sizeof()s which cannot be tested with the */ -/* preprocessor. If you can use the #if's, do use them as you can give a more */ -/* detailed error message then. */ -/* ---------------------------------------------------------------------------- */ - -/* - How this works (you don't have to understand it to be able to use the - macros): we rely on the fact that it is invalid to define a named bit field - in a struct of width 0. All the rest are just the hacks to minimize the - possibility of the compiler warnings when compiling this macro: in - particular, this is why we define a struct and not an object (which would - result in a warning about unused variable) and a named struct (otherwise we'd - get a warning about an unnamed struct not used to define an object!). - */ - -#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_UNIQUE_NAME(wxAssert_) - -/* - The second argument of this macro must be a valid C++ identifier and not a - string. I.e. you should use it like this: - - wxCOMPILE_TIME_ASSERT( sizeof(int) >= 2, YourIntsAreTooSmall ); - - It may be used both within a function and in the global scope. -*/ -#if defined(__WATCOMC__) && defined(__cplusplus) - /* avoid "unused symbol" warning */ - #define wxCOMPILE_TIME_ASSERT(expr, msg) \ - class wxMAKE_UNIQUE_ASSERT_NAME { \ - unsigned int msg: expr; \ - wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \ - } -#else - #define wxCOMPILE_TIME_ASSERT(expr, msg) \ - struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; } -#endif - -/* - When using VC++ 6 with "Edit and Continue" on, the compiler completely - mishandles __LINE__ and so wxCOMPILE_TIME_ASSERT() doesn't work, provide a - way to make "unique" assert names by specifying a unique prefix explicitly - */ -#define wxMAKE_UNIQUE_ASSERT_NAME2(text) wxCONCAT(wxAssert_, text) - -#define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \ - struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; } - -/* helpers for wxCOMPILE_TIME_ASSERT below, for private use only */ -#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits - -/* a special case of compile time assert: check that the size of the given type */ -/* is at least the given number of bits */ -#define wxASSERT_MIN_BITSIZE(type, size) \ - wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \ - wxMAKE_BITSIZE_MSG(type, size)) - -/* ---------------------------------------------------------------------------- */ -/* other miscellaneous debugger-related functions */ -/* ---------------------------------------------------------------------------- */ - -/* - Return true if we're running under debugger. - - Currently this only really works under Win32 and Mac in CodeWarrior builds, - it always returns false in other cases. - */ -#ifdef __cplusplus - /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ - #if defined(__WXMAC__) || defined(__WIN32__) - extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning(); - #else /* !Mac */ - inline bool wxIsDebuggerRunning() { return false; } - #endif /* Mac/!Mac */ -#endif /* __cplusplus */ - -#endif /* _WX_DEBUG_H_ */ +/** +* Name: wx/debug.h +* Purpose: Misc debug functions and macros +* Author: Vadim Zeitlin +* Modified by: Ryan Norton (Converted to C) +* Created: 29/01/98 +* RCS-ID: $Id: debug.h 53711 2008-05-22 22:58:28Z SN $ +* Copyright: (c) 1998 Vadim Zeitlin +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_DEBUG_H_ +#define _WX_DEBUG_H_ + +#ifndef __WXWINCE__ +#include +#endif +#include /* for CHAR_BIT used below */ + +#include "wx/wxchar.h" /* for __TFILE__ and wxChar */ + +/* ---------------------------------------------------------------------------- */ +/* Defines controlling the debugging macros */ +/* ---------------------------------------------------------------------------- */ + +/* if _DEBUG is defined (MS VC++ and others use it in debug builds), define */ +/* __WXDEBUG__ too */ +#ifdef _DEBUG + #ifndef __WXDEBUG__ + #define __WXDEBUG__ + #endif /* !__WXDEBUG__ */ +#endif /* _DEBUG */ + +/* if NDEBUG is defined ( uses it), undef __WXDEBUG__ and WXDEBUG */ +#ifdef NDEBUG + #undef __WXDEBUG__ + #undef WXDEBUG +#endif /* NDEBUG */ + +/* if __WXDEBUG__ is defined, make sure that WXDEBUG is defined and >= 1 */ +#ifdef __WXDEBUG__ + #if !defined(WXDEBUG) || !WXDEBUG + #undef WXDEBUG + #define WXDEBUG 1 + #endif /* !WXDEBUG */ +#endif /* __WXDEBUG__ */ + +#ifndef __WXFUNCTION__ + /* TODO: add more compilers supporting __FUNCTION__ */ + #if defined(__DMC__) + /* + __FUNCTION__ happens to be not defined within class members + http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485 + */ + #define __WXFUNCTION__ (NULL) + #elif defined(__GNUC__) || \ + (defined(_MSC_VER) && _MSC_VER >= 1300) || \ + defined(__FUNCTION__) + #define __WXFUNCTION__ __FUNCTION__ + #else + /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */ + #define __WXFUNCTION__ (NULL) + #endif +#endif /* __WXFUNCTION__ already defined */ + +/* ---------------------------------------------------------------------------- */ +/* Debugging macros */ +/* */ +/* All debugging macros rely on ASSERT() which in turn calls the user-defined */ +/* OnAssert() function. To keep things simple, it's called even when the */ +/* expression is true (i.e. everything is ok) and by default does nothing: just */ +/* returns the same value back. But if you redefine it to do something more sexy */ +/* (popping up a message box in your favourite GUI, sending you e-mail or */ +/* whatever) it will affect all ASSERTs, FAILs and CHECKs in your code. */ +/* */ +/* Warning: if you don't like advice on programming style, don't read */ +/* further! ;-) */ +/* */ +/* Extensive use of these macros is recommended! Remember that ASSERTs are */ +/* disabled in final build (without __WXDEBUG__ defined), so they add strictly */ +/* nothing to your program's code. On the other hand, CHECK macros do stay */ +/* even in release builds, but in general are not much of a burden, while */ +/* a judicious use of them might increase your program's stability. */ +/* ---------------------------------------------------------------------------- */ + +/* Macros which are completely disabled in 'release' mode */ +/* */ +/* NB: these functions are implemented in src/common/appcmn.cpp */ +#if defined(__cplusplus) && defined(__WXDEBUG__) + /* + This function is called whenever one of debugging macros fails (i.e. + condition is false in an assertion). To customize its behaviour, override + wxApp::OnAssert(). + + Parameters: + szFile and nLine - file name and line number of the ASSERT + szFunc - function name of the ASSERT, may be NULL (NB: ASCII) + szCond - text form of the condition which failed + szMsg - optional message explaining the reason + */ + extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile, + int nLine, + const char *szFunc, + const wxChar *szCond, + const wxChar *szMsg = NULL); + + /* call this function to break into the debugger unconditionally (assuming */ + /* the program is running under debugger, of course) */ + extern void WXDLLIMPEXP_BASE wxTrap(); + + /* generic assert macro */ + #define wxASSERT(cond) wxASSERT_MSG(cond, NULL) + + + /* assert with additional message explaining its cause */ + + /* compilers can give a warning (such as "possible unwanted ;") when using */ + /* the default definition of wxASSERT_MSG so we provide an alternative */ + #if defined(__MWERKS__) + #define wxASSERT_MSG(cond, msg) \ + if ( cond ) \ + {} \ + else \ + wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg) + #else + #define wxASSERT_MSG(cond, msg) \ + if ( cond ) \ + ; \ + else \ + wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg) + #endif + + /* special form of assert: always triggers it (in debug mode) */ + #define wxFAIL wxFAIL_MSG(NULL) + + /* FAIL with some message */ + #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("wxAssertFailure", msg) + + /* FAIL with some message and a condition */ + #define wxFAIL_COND_MSG(cond, msg) \ + wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(cond), msg) + + /* An assert helper used to avoid warning when testing constant expressions, */ + /* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */ + /* expression being always true, but not using */ + /* wxASSERT( wxAssertIsEqual(sizeof(int), 4) ) */ + /* */ + /* NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no */ + /* longer be used. */ + extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y); +#else + #define wxTrap() + + /* nothing to do in release mode (hopefully at this moment there are */ + /* no more bugs ;-) */ + #define wxASSERT(cond) + #define wxASSERT_MSG(cond, msg) + #define wxFAIL + #define wxFAIL_MSG(msg) + #define wxFAIL_COND_MSG(cond, msg) +#endif /* __WXDEBUG__ */ + +#ifdef __cplusplus + /* Use of wxFalse instead of false suppresses compiler warnings about testing */ + /* constant expression */ + extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse; +#endif + +#define wxAssertFailure wxFalse + +/* NB: the following macros also work in release mode! */ + +/* + These macros must be used only in invalid situation: for example, an + invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of + dereferencing it and causing core dump the function might try using + CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") ) +*/ + +/* check that expression is true, "return" if not (also FAILs in debug mode) */ +#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, NULL) + +/* as wxCHECK but with a message explaining why we fail */ +#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg) + +/* check that expression is true, perform op if not */ +#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, NULL) + +/* as wxCHECK2 but with a message explaining why we fail */ + +/* see comment near the definition of wxASSERT_MSG for the # if/else reason */ +#if defined(__MWERKS__) + #define wxCHECK2_MSG(cond, op, msg) \ + if ( cond ) \ + {} \ + else \ + { \ + wxFAIL_COND_MSG(#cond, msg); \ + op; \ + } \ + struct wxDummyCheckStruct /* just to force a semicolon */ +#else + #define wxCHECK2_MSG(cond, op, msg) \ + if ( cond ) \ + ; \ + else \ + { \ + wxFAIL_COND_MSG(#cond, msg); \ + op; \ + } \ + typedef int wxDummyCheckInt /* just to force a semicolon */ + /* NB: old gcc versions (e.g. 2.8) give an internal compiler error */ + /* on a simple forward declaration, when used in a template */ + /* function, so rather use a dummy typedef which does work... */ +#endif + +/* special form of wxCHECK2: as wxCHECK, but for use in void functions */ +/* */ +/* NB: there is only one form (with msg parameter) and it's intentional: */ +/* there is no other way to tell the caller what exactly went wrong */ +/* from the void function (of course, the function shouldn't be void */ +/* to begin with...) */ +#define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg) + +/* ---------------------------------------------------------------------------- */ +/* Compile time asserts */ +/* */ +/* Unlike the normal assert and related macros above which are checked during */ +/* the program tun-time the macros below will result in a compilation error if */ +/* the condition they check is false. This is usually used to check the */ +/* expressions containing sizeof()s which cannot be tested with the */ +/* preprocessor. If you can use the #if's, do use them as you can give a more */ +/* detailed error message then. */ +/* ---------------------------------------------------------------------------- */ + +/* + How this works (you don't have to understand it to be able to use the + macros): we rely on the fact that it is invalid to define a named bit field + in a struct of width 0. All the rest are just the hacks to minimize the + possibility of the compiler warnings when compiling this macro: in + particular, this is why we define a struct and not an object (which would + result in a warning about unused variable) and a named struct (otherwise we'd + get a warning about an unnamed struct not used to define an object!). + */ + +#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_UNIQUE_NAME(wxAssert_) + +/* + The second argument of this macro must be a valid C++ identifier and not a + string. I.e. you should use it like this: + + wxCOMPILE_TIME_ASSERT( sizeof(int) >= 2, YourIntsAreTooSmall ); + + It may be used both within a function and in the global scope. +*/ +#if defined(__WATCOMC__) && defined(__cplusplus) + /* avoid "unused symbol" warning */ + #define wxCOMPILE_TIME_ASSERT(expr, msg) \ + class wxMAKE_UNIQUE_ASSERT_NAME { \ + unsigned int msg: expr; \ + wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \ + } +#else + #define wxCOMPILE_TIME_ASSERT(expr, msg) \ + struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; } +#endif + +/* + When using VC++ 6 with "Edit and Continue" on, the compiler completely + mishandles __LINE__ and so wxCOMPILE_TIME_ASSERT() doesn't work, provide a + way to make "unique" assert names by specifying a unique prefix explicitly + */ +#define wxMAKE_UNIQUE_ASSERT_NAME2(text) wxCONCAT(wxAssert_, text) + +#define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \ + struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; } + +/* helpers for wxCOMPILE_TIME_ASSERT below, for private use only */ +#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits + +/* a special case of compile time assert: check that the size of the given type */ +/* is at least the given number of bits */ +#define wxASSERT_MIN_BITSIZE(type, size) \ + wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \ + wxMAKE_BITSIZE_MSG(type, size)) + +/* ---------------------------------------------------------------------------- */ +/* other miscellaneous debugger-related functions */ +/* ---------------------------------------------------------------------------- */ + +/* + Return true if we're running under debugger. + + Currently this only really works under Win32 and Mac in CodeWarrior builds, + it always returns false in other cases. + */ +#ifdef __cplusplus + /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ + #if defined(__WXMAC__) || defined(__WIN32__) + extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning(); + #else /* !Mac */ + inline bool wxIsDebuggerRunning() { return false; } + #endif /* Mac/!Mac */ +#endif /* __cplusplus */ + +#endif /* _WX_DEBUG_H_ */ diff --git a/Externals/wxWidgets/include/wx/debugrpt.h b/Externals/wxWidgets/include/wx/debugrpt.h index faa4b068a4..a50f1cbd08 100644 --- a/Externals/wxWidgets/include/wx/debugrpt.h +++ b/Externals/wxWidgets/include/wx/debugrpt.h @@ -1,235 +1,235 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/debugrpt.h -// Purpose: declaration of wxDebugReport class -// Author: Vadim Zeitlin -// Created: 2005-01-17 -// RCS-ID: $Id: debugrpt.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DEBUGRPT_H_ -#define _WX_DEBUGRPT_H_ - -#include "wx/defs.h" - -#if wxUSE_DEBUGREPORT && wxUSE_XML - -#include "wx/string.h" -#include "wx/arrstr.h" - -class WXDLLIMPEXP_FWD_XML wxXmlNode; - -// ---------------------------------------------------------------------------- -// wxDebugReport: generate a debug report, processing is done in derived class -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_QA wxDebugReport -{ -public: - // this is used for the functions which may report either the current state - // or the state during the last (fatal) exception - enum Context { Context_Current, Context_Exception }; - - - // ctor creates a temporary directory where we create the files which will - // be included in the report, use IsOk() to check for errors - wxDebugReport(); - - // dtor normally destroys the temporary directory created in the ctor (with - // all the files it contains), call Reset() to prevent this from happening - virtual ~wxDebugReport(); - - // return the name of the directory used for this report - const wxString& GetDirectory() const { return m_dir; } - - // return true if the object was successfully initialized - bool IsOk() const { return !GetDirectory().empty(); } - - // reset the directory name we use, the object can't be used any more after - // this as it becomes invalid/uninitialized - void Reset() { m_dir.clear(); } - - - // add another file to the report: the file must already exist, its name - // can be either absolute in which case it is copied to the debug report - // directory or relative to GetDirectory() - // - // description is shown to the user in the report summary - virtual void AddFile(const wxString& filename, const wxString& description); - - // convenience function: write the given text to a file with the given name - // and then add it to the report (the difference with AddFile() is that the - // file will be created by this function and doesn't have to already exist) - bool AddText(const wxString& filename, - const wxString& text, - const wxString& description); - -#if wxUSE_STACKWALKER - // add an XML file containing the current or exception context and the - // stack trace - bool AddCurrentContext() { return AddContext(Context_Current); } - bool AddExceptionContext() { return AddContext(Context_Exception); } - virtual bool AddContext(Context ctx); -#endif - -#if wxUSE_CRASHREPORT - // add a file with crash report - bool AddCurrentDump() { return AddDump(Context_Current); } - bool AddExceptionDump() { return AddDump(Context_Exception); } - virtual bool AddDump(Context ctx); -#endif // wxUSE_CRASHREPORT - - // add all available information to the report - void AddAll(Context context = Context_Exception); - - - // process this report: the base class simply notifies the user that the - // report has been generated, this is usually not enough -- instead you - // should override this method to do something more useful to you - bool Process(); - - // get the name used as base name for various files, by default - // wxApp::GetName() - virtual wxString GetReportName() const; - - // get the files in this report - size_t GetFilesCount() const { return m_files.GetCount(); } - bool GetFile(size_t n, wxString *name, wxString *desc) const; - - // remove the file from report: this is used by wxDebugReportPreview to - // allow the user to remove files potentially containing private - // information from the report - void RemoveFile(const wxString& name); - -protected: -#if wxUSE_STACKWALKER - // used by AddContext() - virtual bool DoAddSystemInfo(wxXmlNode *nodeSystemInfo); - virtual bool DoAddLoadedModules(wxXmlNode *nodeModules); - virtual bool DoAddExceptionInfo(wxXmlNode *nodeContext); - virtual void DoAddCustomContext(wxXmlNode * WXUNUSED(nodeRoot)) { } -#endif - - // used by Process() - virtual bool DoProcess(); - -private: - // name of the report directory - wxString m_dir; - - // the arrays of files in this report and their descriptions - wxArrayString m_files, - m_descriptions; -}; - -#if wxUSE_ZIPSTREAM - -// ---------------------------------------------------------------------------- -// wxDebugReportCompress: compress all files of this debug report in a .ZIP -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_QA wxDebugReportCompress : public wxDebugReport -{ -public: - wxDebugReportCompress() { } - - // returns the full path of the compressed file (empty if creation failed) - const wxString& GetCompressedFileName() const { return m_zipfile; } - -protected: - virtual bool DoProcess(); - -private: - // full path to the ZIP file we created - wxString m_zipfile; -}; - -// ---------------------------------------------------------------------------- -// wxDebugReportUploader: uploads compressed file using HTTP POST request -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_QA wxDebugReportUpload : public wxDebugReportCompress -{ -public: - // this class will upload the compressed file created by its base class to - // an HTML multipart/form-data form at the specified address - // - // the URL is the base address, input is the name of the "type=file" - // control on the form used for the file name and action is the value of - // the form action field - wxDebugReportUpload(const wxString& url, - const wxString& input, - const wxString& action, - const wxString& curl = _T("curl")); - -protected: - virtual bool DoProcess(); - - // this function may be overridden in a derived class to show the output - // from curl: this may be an HTML page or anything else that the server - // returned - // - // return value becomes the return value of Process() - virtual bool OnServerReply(const wxArrayString& WXUNUSED(reply)) - { - return true; - } - -private: - // the full URL to use with HTTP POST request - wxString m_uploadURL; - - // the name of the input field containing the file name in the form at - // above URL - wxString m_inputField; - - // the curl command (by default it is just "curl" but could be full path to - // curl or a wrapper script with curl-compatible syntax) - wxString m_curlCmd; -}; - -#endif // wxUSE_ZIPSTREAM - - -// ---------------------------------------------------------------------------- -// wxDebugReportPreview: presents the debug report to the user and allows him -// to veto report entirely or remove some parts of it -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_QA wxDebugReportPreview -{ -public: - // ctor is trivial - wxDebugReportPreview() { } - - // present the report to the user and allow him to modify it by removing - // some or all of the files and, potentially, adding some notes - // - // return true if the report should be processed or false if the user chose - // to cancel report generation or removed all files from it - virtual bool Show(wxDebugReport& dbgrpt) const = 0; - - // dtor is trivial as well but should be virtual for a base class - virtual ~wxDebugReportPreview() { } -}; - -#if wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxDebugReportPreviewStd: standard debug report preview window -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview -{ -public: - wxDebugReportPreviewStd() { } - - virtual bool Show(wxDebugReport& dbgrpt) const; -}; - -#endif // wxUSE_GUI - -#endif // wxUSE_DEBUGREPORT && wxUSE_XML - -#endif // _WX_DEBUGRPT_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/debugrpt.h +// Purpose: declaration of wxDebugReport class +// Author: Vadim Zeitlin +// Created: 2005-01-17 +// RCS-ID: $Id: debugrpt.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2005 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DEBUGRPT_H_ +#define _WX_DEBUGRPT_H_ + +#include "wx/defs.h" + +#if wxUSE_DEBUGREPORT && wxUSE_XML + +#include "wx/string.h" +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_XML wxXmlNode; + +// ---------------------------------------------------------------------------- +// wxDebugReport: generate a debug report, processing is done in derived class +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_QA wxDebugReport +{ +public: + // this is used for the functions which may report either the current state + // or the state during the last (fatal) exception + enum Context { Context_Current, Context_Exception }; + + + // ctor creates a temporary directory where we create the files which will + // be included in the report, use IsOk() to check for errors + wxDebugReport(); + + // dtor normally destroys the temporary directory created in the ctor (with + // all the files it contains), call Reset() to prevent this from happening + virtual ~wxDebugReport(); + + // return the name of the directory used for this report + const wxString& GetDirectory() const { return m_dir; } + + // return true if the object was successfully initialized + bool IsOk() const { return !GetDirectory().empty(); } + + // reset the directory name we use, the object can't be used any more after + // this as it becomes invalid/uninitialized + void Reset() { m_dir.clear(); } + + + // add another file to the report: the file must already exist, its name + // can be either absolute in which case it is copied to the debug report + // directory or relative to GetDirectory() + // + // description is shown to the user in the report summary + virtual void AddFile(const wxString& filename, const wxString& description); + + // convenience function: write the given text to a file with the given name + // and then add it to the report (the difference with AddFile() is that the + // file will be created by this function and doesn't have to already exist) + bool AddText(const wxString& filename, + const wxString& text, + const wxString& description); + +#if wxUSE_STACKWALKER + // add an XML file containing the current or exception context and the + // stack trace + bool AddCurrentContext() { return AddContext(Context_Current); } + bool AddExceptionContext() { return AddContext(Context_Exception); } + virtual bool AddContext(Context ctx); +#endif + +#if wxUSE_CRASHREPORT + // add a file with crash report + bool AddCurrentDump() { return AddDump(Context_Current); } + bool AddExceptionDump() { return AddDump(Context_Exception); } + virtual bool AddDump(Context ctx); +#endif // wxUSE_CRASHREPORT + + // add all available information to the report + void AddAll(Context context = Context_Exception); + + + // process this report: the base class simply notifies the user that the + // report has been generated, this is usually not enough -- instead you + // should override this method to do something more useful to you + bool Process(); + + // get the name used as base name for various files, by default + // wxApp::GetName() + virtual wxString GetReportName() const; + + // get the files in this report + size_t GetFilesCount() const { return m_files.GetCount(); } + bool GetFile(size_t n, wxString *name, wxString *desc) const; + + // remove the file from report: this is used by wxDebugReportPreview to + // allow the user to remove files potentially containing private + // information from the report + void RemoveFile(const wxString& name); + +protected: +#if wxUSE_STACKWALKER + // used by AddContext() + virtual bool DoAddSystemInfo(wxXmlNode *nodeSystemInfo); + virtual bool DoAddLoadedModules(wxXmlNode *nodeModules); + virtual bool DoAddExceptionInfo(wxXmlNode *nodeContext); + virtual void DoAddCustomContext(wxXmlNode * WXUNUSED(nodeRoot)) { } +#endif + + // used by Process() + virtual bool DoProcess(); + +private: + // name of the report directory + wxString m_dir; + + // the arrays of files in this report and their descriptions + wxArrayString m_files, + m_descriptions; +}; + +#if wxUSE_ZIPSTREAM + +// ---------------------------------------------------------------------------- +// wxDebugReportCompress: compress all files of this debug report in a .ZIP +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_QA wxDebugReportCompress : public wxDebugReport +{ +public: + wxDebugReportCompress() { } + + // returns the full path of the compressed file (empty if creation failed) + const wxString& GetCompressedFileName() const { return m_zipfile; } + +protected: + virtual bool DoProcess(); + +private: + // full path to the ZIP file we created + wxString m_zipfile; +}; + +// ---------------------------------------------------------------------------- +// wxDebugReportUploader: uploads compressed file using HTTP POST request +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_QA wxDebugReportUpload : public wxDebugReportCompress +{ +public: + // this class will upload the compressed file created by its base class to + // an HTML multipart/form-data form at the specified address + // + // the URL is the base address, input is the name of the "type=file" + // control on the form used for the file name and action is the value of + // the form action field + wxDebugReportUpload(const wxString& url, + const wxString& input, + const wxString& action, + const wxString& curl = _T("curl")); + +protected: + virtual bool DoProcess(); + + // this function may be overridden in a derived class to show the output + // from curl: this may be an HTML page or anything else that the server + // returned + // + // return value becomes the return value of Process() + virtual bool OnServerReply(const wxArrayString& WXUNUSED(reply)) + { + return true; + } + +private: + // the full URL to use with HTTP POST request + wxString m_uploadURL; + + // the name of the input field containing the file name in the form at + // above URL + wxString m_inputField; + + // the curl command (by default it is just "curl" but could be full path to + // curl or a wrapper script with curl-compatible syntax) + wxString m_curlCmd; +}; + +#endif // wxUSE_ZIPSTREAM + + +// ---------------------------------------------------------------------------- +// wxDebugReportPreview: presents the debug report to the user and allows him +// to veto report entirely or remove some parts of it +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_QA wxDebugReportPreview +{ +public: + // ctor is trivial + wxDebugReportPreview() { } + + // present the report to the user and allow him to modify it by removing + // some or all of the files and, potentially, adding some notes + // + // return true if the report should be processed or false if the user chose + // to cancel report generation or removed all files from it + virtual bool Show(wxDebugReport& dbgrpt) const = 0; + + // dtor is trivial as well but should be virtual for a base class + virtual ~wxDebugReportPreview() { } +}; + +#if wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxDebugReportPreviewStd: standard debug report preview window +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview +{ +public: + wxDebugReportPreviewStd() { } + + virtual bool Show(wxDebugReport& dbgrpt) const; +}; + +#endif // wxUSE_GUI + +#endif // wxUSE_DEBUGREPORT && wxUSE_XML + +#endif // _WX_DEBUGRPT_H_ diff --git a/Externals/wxWidgets/include/wx/defs.h b/Externals/wxWidgets/include/wx/defs.h index 4814dc8ced..0e2ca0c5d4 100644 --- a/Externals/wxWidgets/include/wx/defs.h +++ b/Externals/wxWidgets/include/wx/defs.h @@ -1,2900 +1,2900 @@ -/* - * Name: wx/defs.h - * Purpose: Declarations/definitions common to all wx source files - * Author: Julian Smart and others - * Modified by: Ryan Norton (Converted to C) - * Created: 01/02/97 - * RCS-ID: $Id: defs.h 53370 2008-04-26 05:43:41Z KO $ - * Copyright: (c) Julian Smart - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_DEFS_H_ -#define _WX_DEFS_H_ - -/* ---------------------------------------------------------------------------- */ -/* compiler and OS identification */ -/* ---------------------------------------------------------------------------- */ - -#include "wx/platform.h" - -#ifdef __cplusplus -/* Make sure the environment is set correctly */ -# if defined(__WXMSW__) && defined(__X__) -# error "Target can't be both X and Windows" -# elif defined(__WXMSW__) && defined(__PALMOS__) -# error "Target can't be both PalmOS and Windows" -# elif !defined(__WXMOTIF__) && \ - !defined(__WXMSW__) && \ - !defined(__WXPALMOS__)&& \ - !defined(__WXGTK__) && \ - !defined(__WXPM__) && \ - !defined(__WXMAC__) && \ - !defined(__WXCOCOA__) && \ - !defined(__X__) && \ - !defined(__WXMGL__) && \ - !defined(__WXDFB__) && \ - !defined(__WXX11__) && \ - wxUSE_GUI -# ifdef __UNIX__ -# error "No Target! You should use wx-config program for compilation flags!" -# else /* !Unix */ -# error "No Target! You should use supplied makefiles for compilation!" -# endif /* Unix/!Unix */ -# endif -#endif /*__cplusplus*/ - -#ifndef __WXWINDOWS__ - #define __WXWINDOWS__ 1 -#endif - -#ifndef wxUSE_BASE - /* by default consider that this is a monolithic build */ - #define wxUSE_BASE 1 -#endif - -#if !wxUSE_GUI && !defined(__WXBASE__) - #define __WXBASE__ -#endif - -/* include the feature test macros */ -#include "wx/features.h" - -/* suppress some Visual C++ warnings */ -#ifdef __VISUALC__ - /* the only "real" warning here is 4244 but there are just too many of them */ - /* in our code... one day someone should go and fix them but until then... */ -# pragma warning(disable:4097) /* typedef used as class */ -# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */ -# pragma warning(disable:4244) /* conversion from double to float */ -# pragma warning(disable:4355) /* 'this' used in base member initializer list */ -# pragma warning(disable:4511) /* copy ctor couldn't be generated */ -# pragma warning(disable:4512) /* operator=() couldn't be generated */ -# pragma warning(disable:4710) /* function not inlined */ - - /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ - /* is buggy, and occurs for code that does actually get executed */ -# if !defined __WXDEBUG__ && __VISUALC__ <= 1100 -# pragma warning(disable:4702) /* unreachable code */ -# endif - /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro' - * is incompatible with the wxWidgets headers since it is given when - * parameters are empty but not missing. */ -# if __VISUALC__ <= 1100 -# pragma warning(disable:4003) /* not enough actual parameters for macro */ -# endif - - /* - VC++ 8 gives a warning when using standard functions such as sprintf, - localtime, ... -- stop this madness, unless the user had already done it - */ - #if __VISUALC__ >= 1400 - #ifndef _CRT_SECURE_NO_DEPRECATE - #define _CRT_SECURE_NO_DEPRECATE 1 - #endif - #ifndef _CRT_NON_CONFORMING_SWPRINTFS - #define _CRT_NON_CONFORMING_SWPRINTFS 1 - #endif - #endif /* VC++ 8 */ -#endif /* __VISUALC__ */ - -/* suppress some Salford C++ warnings */ -#ifdef __SALFORDC__ -# pragma suppress 353 /* Possible nested comments */ -# pragma suppress 593 /* Define not used */ -# pragma suppress 61 /* enum has no name (doesn't suppress!) */ -# pragma suppress 106 /* unnamed, unused parameter */ -# pragma suppress 571 /* Virtual function hiding */ -#endif /* __SALFORDC__ */ - -/* suppress some Borland C++ warnings */ -#ifdef __BORLANDC__ -# pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */ -#endif /* __BORLANDC__ */ - -/* - g++ gives a warning when a class has private dtor if it has no friends but - this is a perfectly valid situation for a ref-counted class which destroys - itself when its ref count drops to 0, so provide a macro to suppress this - warning - */ -#ifdef __GNUG__ -# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \ - friend class wxDummyFriendFor ## name; -#else /* !g++ */ -# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) -#endif - -/* ---------------------------------------------------------------------------- */ -/* wxWidgets version and compatibility defines */ -/* ---------------------------------------------------------------------------- */ - -#include "wx/version.h" - -/* ============================================================================ */ -/* non portable C++ features */ -/* ============================================================================ */ - -/* ---------------------------------------------------------------------------- */ -/* compiler defects workarounds */ -/* ---------------------------------------------------------------------------- */ - -/* - Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files, - so define it ourselves (newer versions do it for all files, though, and - don't allow it to be redefined) - */ -#if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus) -#define __cplusplus -#endif /* __DECCXX */ - -/* Resolves linking problems under HP-UX when compiling with gcc/g++ */ -#if defined(__HPUX__) && defined(__GNUG__) -#define va_list __gnuc_va_list -#endif /* HP-UX */ - -/* ---------------------------------------------------------------------------- */ -/* check for native bool type and TRUE/FALSE constants */ -/* ---------------------------------------------------------------------------- */ - -/* Add more tests here for Windows compilers that already define bool */ -/* (under Unix, configure tests for this) */ -#ifndef HAVE_BOOL - #if defined( __MWERKS__ ) - #if (__MWERKS__ >= 0x1000) && __option(bool) - #define HAVE_BOOL - #endif - #elif defined(__APPLE__) && defined(__APPLE_CC__) - /* Apple bundled gcc supports bool */ - #define HAVE_BOOL - #elif defined(__VISUALC__) && (__VISUALC__ == 1020) - /* in VC++ 4.2 the bool keyword is reserved (hence can't be typedefed) */ - /* but not implemented, so we must #define it */ - #define bool unsigned int - #elif defined(__VISUALC__) && (__VISUALC__ == 1010) - /* For VisualC++ 4.1, we need to define */ - /* bool as something between 4.0 & 5.0... */ - typedef unsigned int wxbool; - #define bool wxbool - #define HAVE_BOOL - #elif defined(__VISUALC__) && (__VISUALC__ > 1020) - /* VC++ supports bool since 4.2 */ - #define HAVE_BOOL - #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x500) - /* Borland 5.0+ supports bool */ - #define HAVE_BOOL - #elif wxCHECK_WATCOM_VERSION(1,0) - /* Watcom 11+ supports bool */ - #define HAVE_BOOL - #elif defined(__DIGITALMARS__) - /* DigitalMars supports bool */ - #define HAVE_BOOL - #elif defined(__GNUWIN32__) || defined(__MINGW32__) || defined(__CYGWIN__) - /* Cygwin supports bool */ - #define HAVE_BOOL - #elif defined(__VISAGECPP__) - #if __IBMCPP__ < 400 - typedef unsigned long bool; - #define true ((bool)1) - #define false ((bool)0) - #endif - #define HAVE_BOOL - #endif /* compilers */ -#endif /* HAVE_BOOL */ - -#if !defined(__MWERKS__) || !defined(true) -#if !defined(HAVE_BOOL) && !defined(bool) && !defined(VMS) - /* NB: of course, this doesn't replace the standard type, because, for */ - /* example, overloading based on bool/int parameter doesn't work and */ - /* so should be avoided in portable programs */ - typedef unsigned int bool; -#endif /* bool */ - -/* deal with TRUE/true stuff: we assume that if the compiler supports bool, it */ -/* supports true/false as well and that, OTOH, if it does _not_ support bool, */ -/* it doesn't support these keywords (this is less sure, in particular VC++ */ -/* 4.x could be a problem here) */ -#ifndef HAVE_BOOL - #define true ((bool)1) - #define false ((bool)0) -#endif -#endif - -/* for backwards compatibility, also define TRUE and FALSE */ -/* */ -/* note that these definitions should work both in C++ and C code, so don't */ -/* use true/false below */ -#ifndef TRUE - #define TRUE 1 -#endif - -#ifndef FALSE - #define FALSE 0 -#endif - -typedef short int WXTYPE; - -/* special care should be taken with this type under Windows where the real */ -/* window id is unsigned, so we must always do the cast before comparing them */ -/* (or else they would be always different!). Using wxGetWindowId() which does */ -/* the cast itself is recommended. Note that this type can't be unsigned */ -/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ -typedef int wxWindowID; - -/* ---------------------------------------------------------------------------- */ -/* other feature tests */ -/* ---------------------------------------------------------------------------- */ - -/* Every ride down a slippery slope begins with a single step.. */ -/* */ -/* Yes, using nested classes is indeed against our coding standards in */ -/* general, but there are places where you can use them to advantage */ -/* without totally breaking ports that cannot use them. If you do, then */ -/* wrap it in this guard, but such cases should still be relatively rare. */ -#define wxUSE_NESTED_CLASSES 1 - -/* check for explicit keyword support */ -#ifndef HAVE_EXPLICIT - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have explicit (what about earlier versions?) */ - #define HAVE_EXPLICIT - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(2, 95) - /* GCC 2.95 has explicit, what about earlier versions? */ - #define HAVE_EXPLICIT - #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520) - /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */ - #define HAVE_EXPLICIT - #elif defined(__MWERKS__) && (__MWERKS__ >= 0x2400) - /* Metrowerks CW6 or higher has explicit */ - #define HAVE_EXPLICIT - #elif defined(__DIGITALMARS__) - #define HAVE_EXPLICIT - #endif -#endif /* !HAVE_EXPLICIT */ - -#ifdef HAVE_EXPLICIT - #define wxEXPLICIT explicit -#else /* !HAVE_EXPLICIT */ - #define wxEXPLICIT -#endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */ - -/* check for static/const_cast<>() (we don't use the other ones for now) */ -#ifndef HAVE_CXX_CASTS - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have C++ casts (what about earlier versions?) */ - #define HAVE_CXX_CASTS - #elif defined(__MINGW32__) || defined(__CYGWIN32__) - #if wxCHECK_GCC_VERSION(2, 95) - /* GCC 2.95 has C++ casts, what about earlier versions? */ - #define HAVE_CXX_CASTS - #endif - #endif -#endif /* !HAVE_CXX_CASTS */ - -#ifdef HAVE_CXX_CASTS - #ifndef HAVE_CONST_CAST - #define HAVE_CONST_CAST - #endif - #ifndef HAVE_REINTERPRET_CAST - #define HAVE_REINTERPRET_CAST - #endif - #ifndef HAVE_STATIC_CAST - #define HAVE_STATIC_CAST - #endif - #ifndef HAVE_DYNAMIC_CAST - #define HAVE_DYNAMIC_CAST - #endif -#endif /* HAVE_CXX_CASTS */ - -#ifdef HAVE_STATIC_CAST - #define wx_static_cast(t, x) static_cast(x) -#else - #define wx_static_cast(t, x) ((t)(x)) -#endif - -#ifdef HAVE_CONST_CAST - #define wx_const_cast(t, x) const_cast(x) -#else - #define wx_const_cast(t, x) ((t)(x)) -#endif - -#ifdef HAVE_REINTERPRET_CAST - #define wx_reinterpret_cast(t, x) reinterpret_cast(x) -#else - #define wx_reinterpret_cast(t, x) ((t)(x)) -#endif - -/* - This one is a wx invention: like static cast but used when we intentionally - truncate from a larger to smaller type, static_cast<> can't be used for it - as it results in warnings when using some compilers (SGI mipspro for example) - */ -#if defined(__INTELC__) && defined(__cplusplus) - template - inline T wx_truncate_cast_impl(X x) - { - #pragma warning(push) - /* implicit conversion of a 64-bit integral type to a smaller integral type */ - #pragma warning(disable: 1682) - /* conversion from "X" to "T" may lose significant bits */ - #pragma warning(disable: 810) - - return x; - - #pragma warning(pop) - } - - #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) - -#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310 - template - inline T wx_truncate_cast_impl(X x) - { - #pragma warning(push) - /* conversion from 'X' to 'T', possible loss of data */ - #pragma warning(disable: 4267) - - return x; - - #pragma warning(pop) - } - - #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) -#else - #define wx_truncate_cast(t, x) ((t)(x)) -#endif - -/* for consistency with wxStatic/DynamicCast defined in wx/object.h */ -#define wxConstCast(obj, className) wx_const_cast(className *, obj) - -#ifndef HAVE_STD_WSTRING - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */ - #define HAVE_STD_WSTRING - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(3, 3) - /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */ - #define HAVE_STD_WSTRING - #endif -#endif - -#ifndef HAVE_STD_STRING_COMPARE - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have std::string::compare */ - /* (what about earlier versions?) */ - #define HAVE_STD_STRING_COMPARE - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(3, 1) - /* GCC 3.1 has std::string::compare; */ - /* 3.0 never was in MinGW, 2.95 hasn't it */ - #define HAVE_STD_STRING_COMPARE - #endif -#endif - -/* provide replacement for C99 va_copy() if the compiler doesn't have it */ - -/* could be already defined by configure or the user */ -#ifndef wxVaCopy - /* if va_copy is a macro or configure detected that we have it, use it */ - #if defined(va_copy) || defined(HAVE_VA_COPY) - #define wxVaCopy va_copy - #else /* no va_copy, try to provide a replacement */ - /* - configure tries to determine whether va_list is an array or struct - type, but it may not be used under Windows, so deal with a few - special cases. - */ - - #ifdef __WATCOMC__ - /* Watcom uses array type for va_list except for PPC and Alpha */ - #if !defined(__PPC__) && !defined(__AXP__) - #define VA_LIST_IS_ARRAY - #endif - #endif /* __WATCOMC__ */ - - #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32)) - /* - PPC using SysV ABI and NT/PPC are special in that they use an - extra level of indirection. - */ - #define VA_LIST_IS_POINTER - #endif /* SysV or Win32 on __PPC__ */ - - /* - note that we use memmove(), not memcpy(), in case anybody tries - to do wxVaCopy(ap, ap) - */ - #if defined(VA_LIST_IS_POINTER) - #define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list)) - #elif defined(VA_LIST_IS_ARRAY) - #define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list)) - #else /* we can only hope that va_lists are simple lvalues */ - #define wxVaCopy(d, s) ((d) = (s)) - #endif - #endif /* va_copy/!va_copy */ -#endif /* wxVaCopy */ - - -/* ---------------------------------------------------------------------------- */ -/* portable calling conventions macros */ -/* ---------------------------------------------------------------------------- */ - -/* stdcall is used for all functions called by Windows under Windows */ -#if defined(__WINDOWS__) - #if defined(__GNUWIN32__) - #define wxSTDCALL __attribute__((stdcall)) - #else - /* both VC++ and Borland understand this */ - #define wxSTDCALL _stdcall - #endif - -#else /* Win */ - /* no such stupidness under Unix */ - #define wxSTDCALL -#endif /* platform */ - -/* LINKAGEMODE mode is empty for everyting except OS/2 */ -#ifndef LINKAGEMODE - #define LINKAGEMODE -#endif /* LINKAGEMODE */ - -/* wxCALLBACK should be used for the functions which are called back by */ -/* Windows (such as compare function for wxListCtrl) */ -#if defined(__WIN32__) && !defined(__WXMICROWIN__) - #define wxCALLBACK wxSTDCALL -#else - /* no stdcall under Unix nor Win16 */ - #define wxCALLBACK -#endif /* platform */ - -/* generic calling convention for the extern "C" functions */ - -#if defined(__VISUALC__) - #define wxC_CALLING_CONV _cdecl -#elif defined(__VISAGECPP__) - #define wxC_CALLING_CONV _Optlink -#else /* !Visual C++ */ - #define wxC_CALLING_CONV -#endif /* compiler */ - -/* callling convention for the qsort(3) callback */ -#define wxCMPFUNC_CONV wxC_CALLING_CONV - -/* compatibility :-( */ -#define CMPFUNC_CONV wxCMPFUNC_CONV - -/* DLL import/export declarations */ -#include "wx/dlimpexp.h" - -/* ---------------------------------------------------------------------------- */ -/* Very common macros */ -/* ---------------------------------------------------------------------------- */ - -/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */ -#ifndef ATTRIBUTE_PRINTF -# if defined(__GNUC__) && !wxUSE_UNICODE -# define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) -# else -# define ATTRIBUTE_PRINTF(m, n) -# endif - -# define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) -# define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) -# define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) -# define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) -# define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) -#endif /* !defined(ATTRIBUTE_PRINTF) */ - -/* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */ -#if wxCHECK_GCC_VERSION(3, 1) - #define wxDEPRECATED(x) x __attribute__ ((deprecated)) -#elif defined(__VISUALC__) && (__VISUALC__ >= 1300) - #define wxDEPRECATED(x) __declspec(deprecated) x -#else - #define wxDEPRECATED(x) x -#endif - -/* everybody gets the assert and other debug macros */ -#include "wx/debug.h" - -/* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ -/* it must not be defined as "(void *)0" which is standard for C but completely */ -/* breaks C++ code) */ -#ifndef __HANDHELDPC__ -#include -#endif - -/* delete pointer if it is not NULL and NULL it afterwards */ -/* (checking that it's !NULL before passing it to delete is just a */ -/* a question of style, because delete will do it itself anyhow, but it might */ -/* be considered as an error by some overzealous debugging implementations of */ -/* the library, so we do it ourselves) */ -#define wxDELETE(p) if ( (p) != NULL ) { delete p; p = NULL; } - -/* delete an array and NULL it (see comments above) */ -#define wxDELETEA(p) if ( (p) ) { delete [] (p); p = NULL; } - -/* size of statically declared array */ -#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) - -/* symbolic constant used by all Find()-like functions returning positive */ -/* integer on success as failure indicator */ -#define wxNOT_FOUND (-1) - -/* ---------------------------------------------------------------------------- */ -/* macros to avoid compiler warnings */ -/* ---------------------------------------------------------------------------- */ - -/* Macro to cut down on compiler warnings. */ -#if 1 /* there should be no more any compilers needing the "#else" version */ - #define WXUNUSED(identifier) /* identifier */ -#else /* stupid, broken compiler */ - #define WXUNUSED(identifier) identifier -#endif - -/* some arguments are only used in debug mode, but unused in release one */ -#ifdef __WXDEBUG__ - #define WXUNUSED_UNLESS_DEBUG(param) param -#else - #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) -#endif - -/* some arguments are not used in unicode mode */ -#if wxUSE_UNICODE - #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param) -#else - #define WXUNUSED_IN_UNICODE(param) param -#endif - -/* some arguments are not used in WinCE build */ -#ifdef __WXWINCE__ - #define WXUNUSED_IN_WINCE(param) WXUNUSED(param) -#else - #define WXUNUSED_IN_WINCE(param) param -#endif - -/* unused parameters in non stream builds */ -#if wxUSE_STREAMS - #define WXUNUSED_UNLESS_STREAMS(param) param -#else - #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param) -#endif - -/* some compilers give warning about a possibly unused variable if it is */ -/* initialized in both branches of if/else and shut up if it is initialized */ -/* when declared, but other compilers then give warnings about unused variable */ -/* value -- this should satisfy both of them */ -#if defined(__VISUALC__) - #define wxDUMMY_INITIALIZE(val) = val -#else - #define wxDUMMY_INITIALIZE(val) -#endif - -/* sometimes the value of a variable is *really* not used, to suppress the */ -/* resulting warning you may pass it to this function */ -#ifdef __cplusplus -# ifdef __BORLANDC__ -# define wxUnusedVar(identifier) identifier -# else - template - inline void wxUnusedVar(const T& WXUNUSED(t)) { } -# endif -#endif - -/* ---------------------------------------------------------------------------- */ -/* compiler specific settings */ -/* ---------------------------------------------------------------------------- */ - -/* to allow compiling with warning level 4 under Microsoft Visual C++ some */ -/* warnings just must be disabled */ -#ifdef __VISUALC__ - #pragma warning(disable: 4514) /* unreferenced inline func has been removed */ -/* - you might be tempted to disable this one also: triggered by CHECK and FAIL - macros in debug.h, but it's, overall, a rather useful one, so I leave it and - will try to find some way to disable this warning just for CHECK/FAIL. Anyone? -*/ - #pragma warning(disable: 4127) /* conditional expression is constant */ -#endif /* VC++ */ - -#if defined(__MWERKS__) - #undef try - #undef except - #undef finally - #define except(x) catch(...) -#endif /* Metrowerks */ - -#if wxONLY_WATCOM_EARLIER_THAN(1,4) - typedef short mode_t; -#endif - -/* where should i put this? we need to make sure of this as it breaks */ -/* the code. */ -#if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) -# ifndef __MWERKS__ -/* #undef __WXDEBUG__ */ -# ifdef wxUSE_DEBUG_NEW_ALWAYS -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -# endif -# endif -#endif - -/* ---------------------------------------------------------------------------- */ -/* standard wxWidgets types */ -/* ---------------------------------------------------------------------------- */ - -/* the type for screen and DC coordinates */ -typedef int wxCoord; - -enum { wxDefaultCoord = -1 }; - -/* ---------------------------------------------------------------------------- */ -/* define fixed length types */ -/* ---------------------------------------------------------------------------- */ - -#if defined(__WXPALMOS__) || defined(__MINGW32__) - #include -#endif - -/* chars are always one byte (by definition), shorts are always two (in */ -/* practice) */ - -/* 8bit */ -#ifndef SIZEOF_CHAR - #define SIZEOF_CHAR 1 -#endif -typedef signed char wxInt8; -typedef unsigned char wxUint8; -typedef wxUint8 wxByte; - - -/* 16bit */ -#ifdef SIZEOF_SHORT - #if SIZEOF_SHORT != 2 - #error "wxWidgets assumes sizeof(short) == 2, please fix the code" - #endif -#else - #define SIZEOF_SHORT 2 -#endif - -typedef signed short wxInt16; -typedef unsigned short wxUint16; - -typedef wxUint16 wxWord; - -/* - things are getting more interesting with ints, longs and pointers - - there are several different standard data models described by this table: - - +-----------+----------------------------+ - |type\model | LP64 ILP64 LLP64 ILP32 LP32| - +-----------+----------------------------+ - |char | 8 8 8 8 8 | - |short | 16 16 16 16 16 | - |int | 32 64 32 32 16 | - |long | 64 64 32 32 32 | - |long long | 64 | - |void * | 64 64 64 32 32 | - +-----------+----------------------------+ - - Win16 used LP32 (but we don't support it any longer), Win32 obviously used - ILP32 and Win64 uses LLP64 (a.k.a. P64) - - Under Unix LP64 is the most widely used (the only I've ever seen, in fact) - */ - -/* 32bit */ -#ifdef __PALMOS__ - typedef int wxInt32; - typedef unsigned int wxUint32; - #define SIZEOF_INT 4 - #define SIZEOF_LONG 4 - #define SIZEOF_WCHAR_T 2 - #define SIZEOF_SIZE_T 4 - #define wxSIZE_T_IS_UINT - #define SIZEOF_VOID_P 4 - #define SIZEOF_SIZE_T 4 -#elif defined(__WINDOWS__) - /* Win64 uses LLP64 model and so ints and longs have the same size as in */ - /* Win32 */ - #if defined(__WIN32__) - typedef int wxInt32; - typedef unsigned int wxUint32; - - /* Assume that if SIZEOF_INT is defined that all the other ones except - SIZEOF_SIZE_T, are too. See next #if below. */ - #ifndef SIZEOF_INT - #define SIZEOF_INT 4 - #define SIZEOF_LONG 4 - #define SIZEOF_WCHAR_T 2 - - /* - under Win64 sizeof(size_t) == 8 and so it is neither unsigned - int nor unsigned long! - */ - #ifdef __WIN64__ - #define SIZEOF_SIZE_T 8 - - #undef wxSIZE_T_IS_UINT - #else /* Win32 */ - #define SIZEOF_SIZE_T 4 - - #define wxSIZE_T_IS_UINT - #endif - #undef wxSIZE_T_IS_ULONG - - #ifdef __WIN64__ - #define SIZEOF_VOID_P 8 - #else /* Win32 */ - #define SIZEOF_VOID_P 4 - #endif /* Win64/32 */ - #endif /* !defined(SIZEOF_INT) */ - - /* - If Python.h was included first, it defines all of the SIZEOF's above - except for SIZEOF_SIZE_T, so we need to do it here to avoid - triggering the #error in the ssize_t typedefs below... - */ - #ifndef SIZEOF_SIZE_T - #ifdef __WIN64__ - #define SIZEOF_SIZE_T 8 - #else /* Win32 */ - #define SIZEOF_SIZE_T 4 - #endif - #endif - #else - #error "Unsupported Windows version" - #endif -#else /* !Windows */ - /* SIZEOF_XXX are normally defined by configure */ - #ifdef SIZEOF_INT - #if SIZEOF_INT == 8 - /* must be ILP64 data model, there is normally a special 32 bit */ - /* type in it but we don't know what it is... */ - #error "No 32bit int type on this platform" - #elif SIZEOF_INT == 4 - typedef int wxInt32; - typedef unsigned int wxUint32; - #elif SIZEOF_INT == 2 - /* must be LP32 */ - #if SIZEOF_LONG != 4 - #error "No 32bit int type on this platform" - #endif - - typedef long wxInt32; - typedef unsigned long wxUint32; - #else - /* wxWidgets is not ready for 128bit systems yet... */ - #error "Unknown sizeof(int) value, what are you compiling for?" - #endif - #else /* !defined(SIZEOF_INT) */ - /* assume default 32bit machine -- what else can we do? */ - wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes); - wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes); - wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes); - - #define SIZEOF_INT 4 - #define SIZEOF_SIZE_T 4 - #define SIZEOF_VOID_P 4 - - typedef int wxInt32; - typedef unsigned int wxUint32; - - #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T) - #define SIZEOF_WCHAR_T 4 - #endif - #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T) - /* also assume that sizeof(wchar_t) == 2 (under Unix the most */ - /* common case is 4 but there configure would have defined */ - /* SIZEOF_WCHAR_T for us) */ - /* the most common case */ - wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2, - Wchar_tMustBeExactly2Bytes); - - #define SIZEOF_WCHAR_T 2 - #endif /* wxUSE_WCHAR_T */ - #endif -#endif /* Win/!Win */ - -typedef wxUint32 wxDword; - -/* - Define an integral type big enough to contain all of long, size_t and void *. - */ -#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T - /* normal case */ - typedef unsigned long wxUIntPtr; -#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P - /* Win64 case */ - typedef size_t wxUIntPtr; -#else - /* - This should never happen for the current architectures but if you're - using one where it does, please contact wx-dev@lists.wxwidgets.org. - */ - #error "Pointers can't be stored inside integer types." -#endif - -#ifdef __cplusplus -/* And also define a couple of simple functions to cast pointer to/from it. */ -inline wxUIntPtr wxPtrToUInt(const void *p) -{ - /* - VC++ 7.1 gives warnings about casts such as below even when they're - explicit with /Wp64 option, suppress them as we really know what we're - doing here. Same thing with icc with -Wall. - */ -#ifdef __VISUALC__ - #if __VISUALC__ >= 1200 - #pragma warning(push) - #endif - /* pointer truncation from '' to '' */ - #pragma warning(disable: 4311) -#elif defined(__INTELC__) - #pragma warning(push) - /* conversion from pointer to same-sized integral type */ - #pragma warning(disable: 1684) -#endif - - return wx_reinterpret_cast(wxUIntPtr, p); - -#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) - #pragma warning(pop) -#endif -} - -inline void *wxUIntToPtr(wxUIntPtr p) -{ -#ifdef __VISUALC__ - #if __VISUALC__ >= 1200 - #pragma warning(push) - #endif - /* conversion to type of greater size */ - #pragma warning(disable: 4312) -#elif defined(__INTELC__) - #pragma warning(push) - /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */ - #pragma warning(disable: 171) -#endif - - return wx_reinterpret_cast(void *, p); - -#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) - #pragma warning(pop) -#endif -} -#endif /*__cplusplus*/ - - -/* 64 bit */ - -/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */ -/* wxLongLong_t" in wx/longlong.h */ - -/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */ - -/* to avoid compilation problems on 64bit machines with ambiguous method calls */ -/* we will need to define this */ -#undef wxLongLongIsLong - -/* - First check for specific compilers which have known 64 bit integer types, - this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for - e.g. MSVC builds (Python.h defines it as 8 even for MSVC). - - Also notice that we check for "long long" before checking for 64 bit long as - we still want to use "long long" and not "long" for wxLongLong_t on 64 bit - architectures to be able to pass wxLongLong_t to the standard functions - prototyped as taking "long long" such as strtoll(). - */ -#if (defined(__VISUALC__) && defined(__WIN32__)) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec _T("I64") -#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec _T("L") -#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__))) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec _T("L") -#elif defined(__DIGITALMARS__) - #define wxLongLong_t __int64 - #define wxLongLongSuffix LL - #define wxLongLongFmtSpec _T("ll") -#elif defined(__MINGW32__) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec _T("I64") -#elif defined(__MWERKS__) - #if __option(longlong) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec _T("ll") - #else - #error "The 64 bit integer support in CodeWarrior has been disabled." - #error "See the documentation on the 'longlong' pragma." - #endif -#elif defined(__WXPALMOS__) - #define wxLongLong_t int64_t - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec _T("ll") -#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 - #define wxLongLong_t long long -#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ - defined(__GNUC__) || \ - defined(__CYGWIN__) || \ - defined(__WXMICROWIN__) || \ - (defined(__DJGPP__) && __DJGPP__ >= 2) - #define wxLongLong_t long long - #define wxLongLongSuffix ll - #define wxLongLongFmtSpec _T("ll") -#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) - #define wxLongLong_t long - #define wxLongLongSuffix l - #define wxLongLongFmtSpec _T("l") - #define wxLongLongIsLong -#endif - - -#ifdef wxLongLong_t - - #ifdef __WXPALMOS__ - #define wxULongLong_t uint64_t - #else - #define wxULongLong_t unsigned wxLongLong_t - #endif - - /* these macros allow to define 64 bit constants in a portable way */ - #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) - #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) - - typedef wxLongLong_t wxInt64; - typedef wxULongLong_t wxUint64; - - #define wxHAS_INT64 1 - -#elif wxUSE_LONGLONG - /* these macros allow to define 64 bit constants in a portable way */ - #define wxLL(x) wxLongLong(x) - #define wxULL(x) wxULongLong(x) - - #define wxInt64 wxLongLong - #define wxUint64 wxULongLong - - #define wxHAS_INT64 1 - -#else /* !wxUSE_LONGLONG */ - - #define wxHAS_INT64 0 - -#endif - - -/* Make sure ssize_t is defined (a signed type the same size as size_t) */ -/* HAVE_SSIZE_T should be defined for compiliers that already have it */ -#ifdef __MINGW32__ - #if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T) - #define HAVE_SSIZE_T - #endif -#endif -#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T) - #define HAVE_SSIZE_T -#endif -#if wxCHECK_WATCOM_VERSION(1,4) - #define HAVE_SSIZE_T -#endif -#ifndef HAVE_SSIZE_T - #if SIZEOF_SIZE_T == 4 - typedef wxInt32 ssize_t; - #elif SIZEOF_SIZE_T == 8 - typedef wxInt64 ssize_t; - #else - #error "error defining ssize_t, size_t is not 4 or 8 bytes" - #endif -#endif - - -/* base floating point types */ -/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */ -/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */ -/* wxDouble: native fastest representation that has at least wxFloat64 */ -/* precision, so use the IEEE types for storage, and this for */ -/* calculations */ - -typedef float wxFloat32; -#if (defined( __WXMAC__ ) || defined(__WXCOCOA__)) && defined (__MWERKS__) - typedef short double wxFloat64; -#else - typedef double wxFloat64; -#endif - -typedef double wxDouble; - -/* - Some (non standard) compilers typedef wchar_t as an existing type instead - of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 - for them and to 1 for all the others. - */ -#if wxUSE_WCHAR_T - /* - VC++ typedefs wchar_t as unsigned short by default, that is unless - /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED is - defined. - */ -# if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) -# define wxWCHAR_T_IS_REAL_TYPE 0 -# else /* compiler having standard-conforming wchar_t */ -# define wxWCHAR_T_IS_REAL_TYPE 1 -# endif -#endif /* wxUSE_WCHAR_T */ - -/* ---------------------------------------------------------------------------- */ -/* byte ordering related definition and macros */ -/* ---------------------------------------------------------------------------- */ - -/* byte sex */ - -#define wxBIG_ENDIAN 4321 -#define wxLITTLE_ENDIAN 1234 -#define wxPDP_ENDIAN 3412 - -#ifdef WORDS_BIGENDIAN -#define wxBYTE_ORDER wxBIG_ENDIAN -#else -#define wxBYTE_ORDER wxLITTLE_ENDIAN -#endif - -/* byte swapping */ - -#if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh ) -/* assembler versions for these */ -#ifdef __POWERPC__ - inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i ) - {return (__lhbrx( &i , 0 ) );} - inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i ) - {return (__lhbrx( &i , 0 ) );} - inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i ) - {return (__lwbrx( &i , 0 ) );} - inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i ) - {return (__lwbrx( &i , 0 ) );} -#else - #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0) - pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value) - = { 0xE158 }; - - #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) - pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value) - = { 0xE158 }; - - #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) - pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value) - = { 0xE158, 0x4840, 0xE158 }; - - #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) - pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value) - = { 0xE158, 0x4840, 0xE158 }; - -#endif -#else /* !MWERKS */ -#define wxUINT16_SWAP_ALWAYS(val) \ - ((wxUint16) ( \ - (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ - (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) - -#define wxINT16_SWAP_ALWAYS(val) \ - ((wxInt16) ( \ - (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ - (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) - -#define wxUINT32_SWAP_ALWAYS(val) \ - ((wxUint32) ( \ - (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ - (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ - (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ - (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) - -#define wxINT32_SWAP_ALWAYS(val) \ - ((wxInt32) ( \ - (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ - (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ - (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ - (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) -#endif -/* machine specific byte swapping */ - -#ifdef wxLongLong_t - #define wxUINT64_SWAP_ALWAYS(val) \ - ((wxUint64) ( \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) - - #define wxINT64_SWAP_ALWAYS(val) \ - ((wxInt64) ( \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ - (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) -#elif wxUSE_LONGLONG /* !wxLongLong_t */ - #define wxUINT64_SWAP_ALWAYS(val) \ - ((wxUint64) ( \ - ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \ - ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \ - ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \ - ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \ - ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \ - ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \ - ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \ - ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56))) - - #define wxINT64_SWAP_ALWAYS(val) \ - ((wxInt64) ( \ - ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \ - ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \ - ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \ - ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \ - ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \ - ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \ - ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \ - ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56))) -#endif /* wxLongLong_t/!wxLongLong_t */ - -#ifdef WORDS_BIGENDIAN - #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val) - #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val) - #define wxUINT16_SWAP_ON_LE(val) (val) - #define wxINT16_SWAP_ON_LE(val) (val) - #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val) - #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val) - #define wxUINT32_SWAP_ON_LE(val) (val) - #define wxINT32_SWAP_ON_LE(val) (val) - #if wxHAS_INT64 - #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val) - #define wxUINT64_SWAP_ON_LE(val) (val) - #endif -#else - #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) - #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val) - #define wxUINT16_SWAP_ON_BE(val) (val) - #define wxINT16_SWAP_ON_BE(val) (val) - #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val) - #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val) - #define wxUINT32_SWAP_ON_BE(val) (val) - #define wxINT32_SWAP_ON_BE(val) (val) - #if wxHAS_INT64 - #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val) - #define wxUINT64_SWAP_ON_BE(val) (val) - #endif -#endif - -/* ---------------------------------------------------------------------------- */ -/* Geometric flags */ -/* ---------------------------------------------------------------------------- */ - -enum wxGeometryCentre -{ - wxCENTRE = 0x0001, - wxCENTER = wxCENTRE -}; - -/* centering into frame rather than screen (obsolete) */ -#define wxCENTER_FRAME 0x0000 -/* centre on screen rather than parent */ -#define wxCENTRE_ON_SCREEN 0x0002 -#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN - -enum wxOrientation -{ - /* don't change the values of these elements, they are used elsewhere */ - wxHORIZONTAL = 0x0004, - wxVERTICAL = 0x0008, - - wxBOTH = wxVERTICAL | wxHORIZONTAL -}; - -enum wxDirection -{ - wxLEFT = 0x0010, - wxRIGHT = 0x0020, - wxUP = 0x0040, - wxDOWN = 0x0080, - - wxTOP = wxUP, - wxBOTTOM = wxDOWN, - - wxNORTH = wxUP, - wxSOUTH = wxDOWN, - wxWEST = wxLEFT, - wxEAST = wxRIGHT, - - wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT) -}; - -enum wxAlignment -{ - wxALIGN_NOT = 0x0000, - wxALIGN_CENTER_HORIZONTAL = 0x0100, - wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL, - wxALIGN_LEFT = wxALIGN_NOT, - wxALIGN_TOP = wxALIGN_NOT, - wxALIGN_RIGHT = 0x0200, - wxALIGN_BOTTOM = 0x0400, - wxALIGN_CENTER_VERTICAL = 0x0800, - wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL, - - wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL), - wxALIGN_CENTRE = wxALIGN_CENTER, - - /* a mask to extract alignment from the combination of flags */ - wxALIGN_MASK = 0x0f00 -}; - -enum wxStretch -{ - wxSTRETCH_NOT = 0x0000, - wxSHRINK = 0x1000, - wxGROW = 0x2000, - wxEXPAND = wxGROW, - wxSHAPED = 0x4000, - wxFIXED_MINSIZE = 0x8000, -#if wxABI_VERSION >= 20808 - wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002, -#endif - wxTILE = 0xc000, - - /* for compatibility only, default now, don't use explicitly any more */ -#if WXWIN_COMPATIBILITY_2_4 - wxADJUST_MINSIZE = 0x00100000 -#else - wxADJUST_MINSIZE = 0 -#endif -}; - -/* border flags: the values are chosen for backwards compatibility */ -enum wxBorder -{ - /* this is different from wxBORDER_NONE as by default the controls do have */ - /* border */ - wxBORDER_DEFAULT = 0, - - wxBORDER_NONE = 0x00200000, - wxBORDER_STATIC = 0x01000000, - wxBORDER_SIMPLE = 0x02000000, - wxBORDER_RAISED = 0x04000000, - wxBORDER_SUNKEN = 0x08000000, - wxBORDER_DOUBLE = 0x10000000, /* deprecated */ - wxBORDER_THEME = 0x10000000, - - /* a mask to extract border style from the combination of flags */ - wxBORDER_MASK = 0x1f200000 -}; - -/* This makes it easier to specify a 'normal' border for a control */ -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -#define wxDEFAULT_CONTROL_BORDER wxBORDER_SIMPLE -#else -#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN -#endif - -/* ---------------------------------------------------------------------------- */ -/* Window style flags */ -/* ---------------------------------------------------------------------------- */ - -/* - * Values are chosen so they can be |'ed in a bit list. - * Some styles are used across more than one group, - * so the values mustn't clash with others in the group. - * Otherwise, numbers can be reused across groups. - * - * From version 1.66: - * Window (cross-group) styles now take up the first half - * of the flag, and control-specific styles the - * second half. - * - */ - -/* - * Window (Frame/dialog/subwindow/panel item) style flags - */ -#define wxVSCROLL 0x80000000 -#define wxHSCROLL 0x40000000 -#define wxCAPTION 0x20000000 - -/* New styles (border styles are now in their own enum) */ -#define wxDOUBLE_BORDER wxBORDER_DOUBLE -#define wxSUNKEN_BORDER wxBORDER_SUNKEN -#define wxRAISED_BORDER wxBORDER_RAISED -#define wxBORDER wxBORDER_SIMPLE -#define wxSIMPLE_BORDER wxBORDER_SIMPLE -#define wxSTATIC_BORDER wxBORDER_STATIC -#define wxNO_BORDER wxBORDER_NONE - -/* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */ -/* disable it - but still show (see also wxLB_ALWAYS_SB style) */ -/* */ -/* NB: as this style is only supported by wxUniversal and wxMSW so far */ -#define wxALWAYS_SHOW_SB 0x00800000 - -/* Clip children when painting, which reduces flicker in e.g. frames and */ -/* splitter windows, but can't be used in a panel where a static box must be */ -/* 'transparent' (panel paints the background for it) */ -#define wxCLIP_CHILDREN 0x00400000 - -/* Note we're reusing the wxCAPTION style because we won't need captions */ -/* for subwindows/controls */ -#define wxCLIP_SIBLINGS 0x20000000 - -#define wxTRANSPARENT_WINDOW 0x00100000 - -/* Add this style to a panel to get tab traversal working outside of dialogs */ -/* (on by default for wxPanel, wxDialog, wxScrolledWindow) */ -#define wxTAB_TRAVERSAL 0x00080000 - -/* Add this style if the control wants to get all keyboard messages (under */ -/* Windows, it won't normally get the dialog navigation key events) */ -#define wxWANTS_CHARS 0x00040000 - -/* Make window retained (Motif only, see src/generic/scrolwing.cpp) - * This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW - * on other platforms - */ - -#ifdef __WXMOTIF__ -#define wxRETAINED 0x00020000 -#else -#define wxRETAINED 0x00000000 -#endif -#define wxBACKINGSTORE wxRETAINED - -/* set this flag to create a special popup window: it will be always shown on */ -/* top of other windows, will capture the mouse and will be dismissed when the */ -/* mouse is clicked outside of it or if it loses focus in any other way */ -#define wxPOPUP_WINDOW 0x00020000 - -/* force a full repaint when the window is resized (instead of repainting just */ -/* the invalidated area) */ -#define wxFULL_REPAINT_ON_RESIZE 0x00010000 - -/* obsolete: now this is the default behaviour */ -/* */ -/* don't invalidate the whole window (resulting in a PAINT event) when the */ -/* window is resized (currently, makes sense for wxMSW only) */ -#define wxNO_FULL_REPAINT_ON_RESIZE 0 - -/* A mask which can be used to filter (out) all wxWindow-specific styles. - */ -#define wxWINDOW_STYLE_MASK \ - (wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \ - wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \ - wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE) - -/* - * Extra window style flags (use wxWS_EX prefix to make it clear that they - * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle()) - */ - -/* by default, TransferDataTo/FromWindow() only work on direct children of the */ -/* window (compatible behaviour), set this flag to make them recursively */ -/* descend into all subwindows */ -#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001 - -/* wxCommandEvents and the objects of the derived classes are forwarded to the */ -/* parent window and so on recursively by default. Using this flag for the */ -/* given window allows to block this propagation at this window, i.e. prevent */ -/* the events from being propagated further upwards. The dialogs have this */ -/* flag on by default. */ -#define wxWS_EX_BLOCK_EVENTS 0x00000002 - -/* don't use this window as an implicit parent for the other windows: this must */ -/* be used with transient windows as otherwise there is the risk of creating a */ -/* dialog/frame with this window as a parent which would lead to a crash if the */ -/* parent is destroyed before the child */ -#define wxWS_EX_TRANSIENT 0x00000004 - -/* don't paint the window background, we'll assume it will */ -/* be done by a theming engine. This is not yet used but could */ -/* possibly be made to work in the future, at least on Windows */ -#define wxWS_EX_THEMED_BACKGROUND 0x00000008 - -/* this window should always process idle events */ -#define wxWS_EX_PROCESS_IDLE 0x00000010 - -/* this window should always process UI update events */ -#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020 - -/* Draw the window in a metal theme on Mac */ -#define wxFRAME_EX_METAL 0x00000040 -#define wxDIALOG_EX_METAL 0x00000040 - -/* Use this style to add a context-sensitive help to the window (currently for */ -/* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */ -#define wxWS_EX_CONTEXTHELP 0x00000080 - -/* synonyms for wxWS_EX_CONTEXTHELP for compatibility */ -#define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP -#define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP - -/* Create a window which is attachable to another top level window */ -#define wxFRAME_DRAWER 0x0020 - -/* - * MDI parent frame style flags - * Can overlap with some of the above. - */ - -#define wxFRAME_NO_WINDOW_MENU 0x0100 - -/* - * wxMenuBar style flags - */ -/* use native docking */ -#define wxMB_DOCKABLE 0x0001 - -/* - * wxMenu style flags - */ -#define wxMENU_TEAROFF 0x0001 - -/* - * Apply to all panel items - */ -#define wxCOLOURED 0x0800 -#define wxFIXED_LENGTH 0x0400 - -/* - * Styles for wxListBox - */ -#define wxLB_SORT 0x0010 -#define wxLB_SINGLE 0x0020 -#define wxLB_MULTIPLE 0x0040 -#define wxLB_EXTENDED 0x0080 -/* wxLB_OWNERDRAW is Windows-only */ -#define wxLB_OWNERDRAW 0x0100 -#define wxLB_NEEDED_SB 0x0200 -#define wxLB_ALWAYS_SB 0x0400 -#define wxLB_HSCROLL wxHSCROLL -/* always show an entire number of rows */ -#define wxLB_INT_HEIGHT 0x0800 - -#if WXWIN_COMPATIBILITY_2_6 - /* deprecated synonyms */ - #define wxPROCESS_ENTER 0x0400 /* wxTE_PROCESS_ENTER */ - #define wxPASSWORD 0x0800 /* wxTE_PASSWORD */ -#endif - -/* - * wxComboBox style flags - */ -#define wxCB_SIMPLE 0x0004 -#define wxCB_SORT 0x0008 -#define wxCB_READONLY 0x0010 -#define wxCB_DROPDOWN 0x0020 - -/* - * wxRadioBox style flags - */ -/* should we number the items from left to right or from top to bottom in a 2d */ -/* radiobox? */ -#define wxRA_LEFTTORIGHT 0x0001 -#define wxRA_TOPTOBOTTOM 0x0002 - -/* New, more intuitive names to specify majorDim argument */ -#define wxRA_SPECIFY_COLS wxHORIZONTAL -#define wxRA_SPECIFY_ROWS wxVERTICAL - -/* Old names for compatibility */ -#define wxRA_HORIZONTAL wxHORIZONTAL -#define wxRA_VERTICAL wxVERTICAL -#define wxRA_USE_CHECKBOX 0x0010 /* alternative native subcontrols (wxPalmOS) */ - -/* - * wxRadioButton style flag - */ -#define wxRB_GROUP 0x0004 -#define wxRB_SINGLE 0x0008 -#define wxRB_USE_CHECKBOX 0x0010 /* alternative native control (wxPalmOS) */ - -/* - * wxScrollBar flags - */ -#define wxSB_HORIZONTAL wxHORIZONTAL -#define wxSB_VERTICAL wxVERTICAL - -/* - * wxSpinButton flags. - * Note that a wxSpinCtrl is sometimes defined as - * a wxTextCtrl, and so the flags must be different - * from wxTextCtrl's. - */ -#define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */ -#define wxSP_VERTICAL wxVERTICAL /* 8 */ -#define wxSP_ARROW_KEYS 0x1000 -#define wxSP_WRAP 0x2000 - -/* - * wxTabCtrl flags - */ -#define wxTC_RIGHTJUSTIFY 0x0010 -#define wxTC_FIXEDWIDTH 0x0020 -#define wxTC_TOP 0x0000 /* default */ -#define wxTC_LEFT 0x0020 -#define wxTC_RIGHT 0x0040 -#define wxTC_BOTTOM 0x0080 -#define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */ -#define wxTC_OWNERDRAW 0x0400 - -/* - * wxStatusBar95 flags - */ -#define wxST_SIZEGRIP 0x0010 - -/* - * wxStaticText flags - */ -#define wxST_NO_AUTORESIZE 0x0001 -#define wxST_DOTS_MIDDLE 0x0002 -#define wxST_DOTS_END 0x0004 - -/* - * wxStaticBitmap flags - */ -#define wxBI_EXPAND wxEXPAND - -/* - * wxStaticLine flags - */ -#define wxLI_HORIZONTAL wxHORIZONTAL -#define wxLI_VERTICAL wxVERTICAL - - -/* - * extended dialog specifiers. these values are stored in a different - * flag and thus do not overlap with other style flags. note that these - * values do not correspond to the return values of the dialogs (for - * those values, look at the wxID_XXX defines). - */ - -/* wxCENTRE already defined as 0x00000001 */ -#define wxYES 0x00000002 -#define wxOK 0x00000004 -#define wxNO 0x00000008 -#define wxYES_NO (wxYES | wxNO) -#define wxCANCEL 0x00000010 - -#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ -#define wxNO_DEFAULT 0x00000080 - -#define wxICON_EXCLAMATION 0x00000100 -#define wxICON_HAND 0x00000200 -#define wxICON_WARNING wxICON_EXCLAMATION -#define wxICON_ERROR wxICON_HAND -#define wxICON_QUESTION 0x00000400 -#define wxICON_INFORMATION 0x00000800 -#define wxICON_STOP wxICON_HAND -#define wxICON_ASTERISK wxICON_INFORMATION -#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) - -#define wxFORWARD 0x00001000 -#define wxBACKWARD 0x00002000 -#define wxRESET 0x00004000 -#define wxHELP 0x00008000 -#define wxMORE 0x00010000 -#define wxSETUP 0x00020000 - -/* - * Background styles. See wxWindow::SetBackgroundStyle - */ - -enum wxBackgroundStyle -{ - wxBG_STYLE_SYSTEM, - wxBG_STYLE_COLOUR, - wxBG_STYLE_CUSTOM -}; - -/* ---------------------------------------------------------------------------- */ -/* standard IDs */ -/* ---------------------------------------------------------------------------- */ - -/* Standard menu IDs */ -enum -{ - /* no id matches this one when compared to it */ - wxID_NONE = -3, - - /* id for a separator line in the menu (invalid for normal item) */ - wxID_SEPARATOR = -2, - - /* any id: means that we don't care about the id, whether when installing - * an event handler or when creating a new window */ - wxID_ANY = -1, - - - /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */ - wxID_LOWEST = 4999, - - wxID_OPEN, - wxID_CLOSE, - wxID_NEW, - wxID_SAVE, - wxID_SAVEAS, - wxID_REVERT, - wxID_EXIT, - wxID_UNDO, - wxID_REDO, - wxID_HELP, - wxID_PRINT, - wxID_PRINT_SETUP, - wxID_PAGE_SETUP, - wxID_PREVIEW, - wxID_ABOUT, - wxID_HELP_CONTENTS, - wxID_HELP_INDEX, - wxID_HELP_SEARCH, - wxID_HELP_COMMANDS, - wxID_HELP_PROCEDURES, - wxID_HELP_CONTEXT, - wxID_CLOSE_ALL, - wxID_PREFERENCES, - - wxID_EDIT = 5030, - wxID_CUT, - wxID_COPY, - wxID_PASTE, - wxID_CLEAR, - wxID_FIND, - wxID_DUPLICATE, - wxID_SELECTALL, - wxID_DELETE, - wxID_REPLACE, - wxID_REPLACE_ALL, - wxID_PROPERTIES, - - wxID_VIEW_DETAILS, - wxID_VIEW_LARGEICONS, - wxID_VIEW_SMALLICONS, - wxID_VIEW_LIST, - wxID_VIEW_SORTDATE, - wxID_VIEW_SORTNAME, - wxID_VIEW_SORTSIZE, - wxID_VIEW_SORTTYPE, - - wxID_FILE = 5050, - wxID_FILE1, - wxID_FILE2, - wxID_FILE3, - wxID_FILE4, - wxID_FILE5, - wxID_FILE6, - wxID_FILE7, - wxID_FILE8, - wxID_FILE9, - - /* Standard button and menu IDs */ - wxID_OK = 5100, - wxID_CANCEL, - wxID_APPLY, - wxID_YES, - wxID_NO, - wxID_STATIC, - wxID_FORWARD, - wxID_BACKWARD, - wxID_DEFAULT, - wxID_MORE, - wxID_SETUP, - wxID_RESET, - wxID_CONTEXT_HELP, - wxID_YESTOALL, - wxID_NOTOALL, - wxID_ABORT, - wxID_RETRY, - wxID_IGNORE, - wxID_ADD, - wxID_REMOVE, - - wxID_UP, - wxID_DOWN, - wxID_HOME, - wxID_REFRESH, - wxID_STOP, - wxID_INDEX, - - wxID_BOLD, - wxID_ITALIC, - wxID_JUSTIFY_CENTER, - wxID_JUSTIFY_FILL, - wxID_JUSTIFY_RIGHT, - wxID_JUSTIFY_LEFT, - wxID_UNDERLINE, - wxID_INDENT, - wxID_UNINDENT, - wxID_ZOOM_100, - wxID_ZOOM_FIT, - wxID_ZOOM_IN, - wxID_ZOOM_OUT, - wxID_UNDELETE, - wxID_REVERT_TO_SAVED, - - /* System menu IDs (used by wxUniv): */ - wxID_SYSTEM_MENU = 5200, - wxID_CLOSE_FRAME, - wxID_MOVE_FRAME, - wxID_RESIZE_FRAME, - wxID_MAXIMIZE_FRAME, - wxID_ICONIZE_FRAME, - wxID_RESTORE_FRAME, - - /* IDs used by generic file dialog (13 consecutive starting from this value) */ - wxID_FILEDLGG = 5900, - - wxID_HIGHEST = 5999 -}; - -/* ---------------------------------------------------------------------------- */ -/* other constants */ -/* ---------------------------------------------------------------------------- */ - -/* menu and toolbar item kinds */ -enum wxItemKind -{ - wxITEM_SEPARATOR = -1, - wxITEM_NORMAL, - wxITEM_CHECK, - wxITEM_RADIO, - wxITEM_MAX -}; - -/* hit test results */ -enum wxHitTest -{ - wxHT_NOWHERE, - - /* scrollbar */ - wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE, - wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */ - wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */ - wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */ - wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */ - wxHT_SCROLLBAR_THUMB, /* on the thumb */ - wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */ - wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */ - wxHT_SCROLLBAR_LAST, - - /* window */ - wxHT_WINDOW_OUTSIDE, /* not in this window at all */ - wxHT_WINDOW_INSIDE, /* in the client area */ - wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */ - wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */ - wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */ - - wxHT_MAX -}; - -/* ---------------------------------------------------------------------------- */ -/* Possible SetSize flags */ -/* ---------------------------------------------------------------------------- */ - -/* Use internally-calculated width if -1 */ -#define wxSIZE_AUTO_WIDTH 0x0001 -/* Use internally-calculated height if -1 */ -#define wxSIZE_AUTO_HEIGHT 0x0002 -/* Use internally-calculated width and height if each is -1 */ -#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT) -/* Ignore missing (-1) dimensions (use existing). */ -/* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */ -#define wxSIZE_USE_EXISTING 0x0000 -/* Allow -1 as a valid position */ -#define wxSIZE_ALLOW_MINUS_ONE 0x0004 -/* Don't do parent client adjustments (for implementation only) */ -#define wxSIZE_NO_ADJUSTMENTS 0x0008 -/* Change the window position even if it seems to be already correct */ -#define wxSIZE_FORCE 0x0010 - -/* ---------------------------------------------------------------------------- */ -/* GDI descriptions */ -/* ---------------------------------------------------------------------------- */ - -enum -{ - /* Text font families */ - wxDEFAULT = 70, - wxDECORATIVE, - wxROMAN, - wxSCRIPT, - wxSWISS, - wxMODERN, - wxTELETYPE, /* @@@@ */ - - /* Proportional or Fixed width fonts (not yet used) */ - wxVARIABLE = 80, - wxFIXED, - - wxNORMAL = 90, - wxLIGHT, - wxBOLD, - /* Also wxNORMAL for normal (non-italic text) */ - wxITALIC, - wxSLANT, - - /* Pen styles */ - wxSOLID = 100, - wxDOT, - wxLONG_DASH, - wxSHORT_DASH, - wxDOT_DASH, - wxUSER_DASH, - - wxTRANSPARENT, - - /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ - /* Note also that stippling a Pen IS meaningfull, because a Line is */ - wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ - wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ - /* drawn with a Pen, and without any Brush -- and it can be stippled. */ - wxSTIPPLE = 110, - - wxBDIAGONAL_HATCH, /* In wxWidgets < 2.6 use WX_HATCH macro */ - wxCROSSDIAG_HATCH, /* to verify these wx*_HATCH are in style */ - wxFDIAGONAL_HATCH, /* of wxBrush. In wxWidgets >= 2.6 use */ - wxCROSS_HATCH, /* wxBrush::IsHatch() instead. */ - wxHORIZONTAL_HATCH, - wxVERTICAL_HATCH, - wxFIRST_HATCH = wxBDIAGONAL_HATCH, - wxLAST_HATCH = wxVERTICAL_HATCH, - - wxJOIN_BEVEL = 120, - wxJOIN_MITER, - wxJOIN_ROUND, - - wxCAP_ROUND = 130, - wxCAP_PROJECTING, - wxCAP_BUTT -}; - -#if WXWIN_COMPATIBILITY_2_4 - #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) -#else - /* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */ -#endif - -/* Logical ops */ -typedef enum -{ - wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, /* 0 */ - wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, /* src XOR dst */ - wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, /* NOT dst */ - wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, /* src OR (NOT dst) */ - wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, /* src AND (NOT dst) */ - wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, /* src */ - wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, /* src AND dst */ - wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, /* (NOT src) AND dst */ - wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, /* dst */ - wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, /* (NOT src) AND (NOT dst) */ - wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, /* (NOT src) XOR dst */ - wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, /* (NOT src) */ - wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, /* (NOT src) OR dst */ - wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, /* (NOT src) OR (NOT dst) */ - wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, /* src OR dst */ - wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET /* 1 */ -} form_ops_t; - -/* Flood styles */ -enum -{ - wxFLOOD_SURFACE = 1, - wxFLOOD_BORDER -}; - -/* Polygon filling mode */ -enum -{ - wxODDEVEN_RULE = 1, - wxWINDING_RULE -}; - -/* ToolPanel in wxFrame (VZ: unused?) */ -enum -{ - wxTOOL_TOP = 1, - wxTOOL_BOTTOM, - wxTOOL_LEFT, - wxTOOL_RIGHT -}; - -/* the values of the format constants should be the same as corresponding */ -/* CF_XXX constants in Windows API */ -enum wxDataFormatId -{ - wxDF_INVALID = 0, - wxDF_TEXT = 1, /* CF_TEXT */ - wxDF_BITMAP = 2, /* CF_BITMAP */ - wxDF_METAFILE = 3, /* CF_METAFILEPICT */ - wxDF_SYLK = 4, - wxDF_DIF = 5, - wxDF_TIFF = 6, - wxDF_OEMTEXT = 7, /* CF_OEMTEXT */ - wxDF_DIB = 8, /* CF_DIB */ - wxDF_PALETTE = 9, - wxDF_PENDATA = 10, - wxDF_RIFF = 11, - wxDF_WAVE = 12, - wxDF_UNICODETEXT = 13, - wxDF_ENHMETAFILE = 14, - wxDF_FILENAME = 15, /* CF_HDROP */ - wxDF_LOCALE = 16, - wxDF_PRIVATE = 20, - wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */ - wxDF_MAX -}; - -/* Virtual keycodes */ -enum wxKeyCode -{ - WXK_BACK = 8, - WXK_TAB = 9, - WXK_RETURN = 13, - WXK_ESCAPE = 27, - WXK_SPACE = 32, - WXK_DELETE = 127, - - /* These are, by design, not compatible with unicode characters. - If you want to get a unicode character from a key event, use - wxKeyEvent::GetUnicodeKey instead. */ - WXK_START = 300, - WXK_LBUTTON, - WXK_RBUTTON, - WXK_CANCEL, - WXK_MBUTTON, - WXK_CLEAR, - WXK_SHIFT, - WXK_ALT, - WXK_CONTROL, - WXK_MENU, - WXK_PAUSE, - WXK_CAPITAL, - WXK_END, - WXK_HOME, - WXK_LEFT, - WXK_UP, - WXK_RIGHT, - WXK_DOWN, - WXK_SELECT, - WXK_PRINT, - WXK_EXECUTE, - WXK_SNAPSHOT, - WXK_INSERT, - WXK_HELP, - WXK_NUMPAD0, - WXK_NUMPAD1, - WXK_NUMPAD2, - WXK_NUMPAD3, - WXK_NUMPAD4, - WXK_NUMPAD5, - WXK_NUMPAD6, - WXK_NUMPAD7, - WXK_NUMPAD8, - WXK_NUMPAD9, - WXK_MULTIPLY, - WXK_ADD, - WXK_SEPARATOR, - WXK_SUBTRACT, - WXK_DECIMAL, - WXK_DIVIDE, - WXK_F1, - WXK_F2, - WXK_F3, - WXK_F4, - WXK_F5, - WXK_F6, - WXK_F7, - WXK_F8, - WXK_F9, - WXK_F10, - WXK_F11, - WXK_F12, - WXK_F13, - WXK_F14, - WXK_F15, - WXK_F16, - WXK_F17, - WXK_F18, - WXK_F19, - WXK_F20, - WXK_F21, - WXK_F22, - WXK_F23, - WXK_F24, - WXK_NUMLOCK, - WXK_SCROLL, - WXK_PAGEUP, - WXK_PAGEDOWN, -#if WXWIN_COMPATIBILITY_2_6 - WXK_PRIOR = WXK_PAGEUP, - WXK_NEXT = WXK_PAGEDOWN, -#endif - - WXK_NUMPAD_SPACE, - WXK_NUMPAD_TAB, - WXK_NUMPAD_ENTER, - WXK_NUMPAD_F1, - WXK_NUMPAD_F2, - WXK_NUMPAD_F3, - WXK_NUMPAD_F4, - WXK_NUMPAD_HOME, - WXK_NUMPAD_LEFT, - WXK_NUMPAD_UP, - WXK_NUMPAD_RIGHT, - WXK_NUMPAD_DOWN, - WXK_NUMPAD_PAGEUP, - WXK_NUMPAD_PAGEDOWN, -#if WXWIN_COMPATIBILITY_2_6 - WXK_NUMPAD_PRIOR = WXK_NUMPAD_PAGEUP, - WXK_NUMPAD_NEXT = WXK_NUMPAD_PAGEDOWN, -#endif - WXK_NUMPAD_END, - WXK_NUMPAD_BEGIN, - WXK_NUMPAD_INSERT, - WXK_NUMPAD_DELETE, - WXK_NUMPAD_EQUAL, - WXK_NUMPAD_MULTIPLY, - WXK_NUMPAD_ADD, - WXK_NUMPAD_SEPARATOR, - WXK_NUMPAD_SUBTRACT, - WXK_NUMPAD_DECIMAL, - WXK_NUMPAD_DIVIDE, - - WXK_WINDOWS_LEFT, - WXK_WINDOWS_RIGHT, - WXK_WINDOWS_MENU , - WXK_COMMAND, - - /* Hardware-specific buttons */ - WXK_SPECIAL1 = 193, - WXK_SPECIAL2, - WXK_SPECIAL3, - WXK_SPECIAL4, - WXK_SPECIAL5, - WXK_SPECIAL6, - WXK_SPECIAL7, - WXK_SPECIAL8, - WXK_SPECIAL9, - WXK_SPECIAL10, - WXK_SPECIAL11, - WXK_SPECIAL12, - WXK_SPECIAL13, - WXK_SPECIAL14, - WXK_SPECIAL15, - WXK_SPECIAL16, - WXK_SPECIAL17, - WXK_SPECIAL18, - WXK_SPECIAL19, - WXK_SPECIAL20 -}; - -/* This enum contains bit mask constants used in wxKeyEvent */ -enum wxKeyModifier -{ - wxMOD_NONE = 0x0000, - wxMOD_ALT = 0x0001, - wxMOD_CONTROL = 0x0002, - wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL, - wxMOD_SHIFT = 0x0004, - wxMOD_META = 0x0008, - wxMOD_WIN = wxMOD_META, -#if defined(__WXMAC__) || defined(__WXCOCOA__) - wxMOD_CMD = wxMOD_META, -#else - wxMOD_CMD = wxMOD_CONTROL, -#endif - wxMOD_ALL = 0xffff -}; - -/* Mapping modes (same values as used by Windows, don't change) */ -enum -{ - wxMM_TEXT = 1, - wxMM_LOMETRIC, - wxMM_HIMETRIC, - wxMM_LOENGLISH, - wxMM_HIENGLISH, - wxMM_TWIPS, - wxMM_ISOTROPIC, - wxMM_ANISOTROPIC, - wxMM_POINTS, - wxMM_METRIC -}; - -/* Shortcut for easier dialog-unit-to-pixel conversion */ -#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) - -/* Paper types */ -typedef enum -{ - wxPAPER_NONE, /* Use specific dimensions */ - wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */ - wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */ - wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */ - wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */ - wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */ - wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */ - wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */ - wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */ - wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */ - wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */ - wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */ - wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */ - wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */ - wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */ - wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */ - wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */ - wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */ - wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */ - wxPAPER_10X14, /* 10-by-14-inch sheet */ - wxPAPER_11X17, /* 11-by-17-inch sheet */ - wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */ - wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */ - wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */ - wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */ - wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */ - wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */ - wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */ - wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */ - wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */ - wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */ - wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */ - wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */ - wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */ - wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */ - wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */ - wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */ - wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */ - wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */ - wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */ - wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */ - wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */ - - wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */ - wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */ - wxPAPER_9X11, /* 9 x 11 in */ - wxPAPER_10X11, /* 10 x 11 in */ - wxPAPER_15X11, /* 15 x 11 in */ - wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */ - wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */ - wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */ - wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */ - wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */ - wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */ - wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */ - wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */ - wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */ - wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */ - wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */ - wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */ - wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */ - wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */ - wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */ - wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */ - wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */ - wxPAPER_A2, /* A2 420 x 594 mm */ - wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */ - wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */ - - wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */ - wxPAPER_A6, /* A6 105 x 148 mm */ - wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */ - wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */ - wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */ - wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */ - wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */ - wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */ - wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */ - wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */ - wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */ - wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */ - wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */ - wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */ - wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */ - wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */ - wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */ - wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */ - wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */ - wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */ - wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */ - wxPAPER_12X11, /* 12 x 11 in */ - wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */ - wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */ - wxPAPER_P16K, /* PRC 16K 146 x 215 mm */ - wxPAPER_P32K, /* PRC 32K 97 x 151 mm */ - wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */ - wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */ - wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */ - wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */ - wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */ - wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */ - wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */ - wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */ - wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */ - wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */ - wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */ - wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */ - wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */ - wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */ - wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */ - wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */ - wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */ - wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */ - wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */ - wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */ - wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */ - wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */ - wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */ - wxPAPER_PENV_10_ROTATED /* PRC Envelope #10 Rotated 458 x 324 m */ -} wxPaperSize; - -/* Printing orientation */ -#ifndef wxPORTRAIT -#define wxPORTRAIT 1 -#define wxLANDSCAPE 2 -#endif - -/* Duplex printing modes - */ - -enum wxDuplexMode -{ - wxDUPLEX_SIMPLEX, /* Non-duplex */ - wxDUPLEX_HORIZONTAL, - wxDUPLEX_VERTICAL -}; - -/* Print quality. - */ - -#define wxPRINT_QUALITY_HIGH -1 -#define wxPRINT_QUALITY_MEDIUM -2 -#define wxPRINT_QUALITY_LOW -3 -#define wxPRINT_QUALITY_DRAFT -4 - -typedef int wxPrintQuality; - -/* Print mode (currently PostScript only) - */ - -enum wxPrintMode -{ - wxPRINT_MODE_NONE = 0, - wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */ - wxPRINT_MODE_FILE = 2, /* Print to file */ - wxPRINT_MODE_PRINTER = 3, /* Send to printer */ - wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */ -}; - -/* ---------------------------------------------------------------------------- */ -/* UpdateWindowUI flags */ -/* ---------------------------------------------------------------------------- */ - -enum wxUpdateUI -{ - wxUPDATE_UI_NONE = 0x0000, - wxUPDATE_UI_RECURSE = 0x0001, - wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */ -}; - -/* ---------------------------------------------------------------------------- */ -/* Notification Event flags - used for dock icon bouncing, etc. */ -/* ---------------------------------------------------------------------------- */ - -enum wxNotificationOptions -{ - wxNOTIFY_NONE = 0x0000, - wxNOTIFY_ONCE = 0x0001, - wxNOTIFY_REPEAT = 0x0002 -}; - -/* ---------------------------------------------------------------------------- */ -/* miscellaneous */ -/* ---------------------------------------------------------------------------- */ - -/* define this macro if font handling is done using the X font names */ -#if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__) - #define _WX_X_FONTLIKE -#endif - -/* macro to specify "All Files" on different platforms */ -#if defined(__WXMSW__) || defined(__WXPM__) -# define wxALL_FILES_PATTERN wxT("*.*") -# define wxALL_FILES gettext_noop("All files (*.*)|*.*") -#else -# define wxALL_FILES_PATTERN wxT("*") -# define wxALL_FILES gettext_noop("All files (*)|*") -#endif - -#if defined(__CYGWIN__) && defined(__WXMSW__) -# if wxUSE_STL || defined(wxUSE_STD_STRING) - /* - NASTY HACK because the gethostname in sys/unistd.h which the gnu - stl includes and wx builds with by default clash with each other - (windows version 2nd param is int, sys/unistd.h version is unsigned - int). - */ -# define gethostname gethostnameHACK -# include -# undef gethostname -# endif -#endif - -/* --------------------------------------------------------------------------- */ -/* macros that enable wxWidgets apps to be compiled in absence of the */ -/* sytem headers, although some platform specific types are used in the */ -/* platform specific (implementation) parts of the headers */ -/* --------------------------------------------------------------------------- */ - -#ifdef __WXMAC__ - -#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name - -typedef unsigned char WXCOLORREF[6]; -typedef void* WXCGIMAGEREF; -typedef void* WXHBITMAP; -typedef void* WXHCURSOR; -typedef void* WXHRGN; -typedef void* WXRECTPTR; -typedef void* WXPOINTPTR; -typedef void* WXHWND; -typedef void* WXEVENTREF; -typedef void* WXEVENTHANDLERREF; -typedef void* WXEVENTHANDLERCALLREF; -typedef void* WXAPPLEEVENTREF; -typedef void* WXHDC; -typedef void* WXHMENU; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef WX_OPAQUE_TYPE(CIconHandle ) * WXHICON ; -typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; - - -/* typedef void* WXWidget; */ -/* typedef void* WXWindow; */ -typedef WX_OPAQUE_TYPE(ControlRef ) * WXWidget ; -typedef WX_OPAQUE_TYPE(WindowRef) * WXWindow ; -typedef void* WXDisplay; - -/* typedef WindowPtr WXHWND; */ -/* typedef Handle WXHANDLE; */ -/* typedef CIconHandle WXHICON; */ -/* typedef unsigned long WXHFONT; */ -/* typedef MenuHandle WXHMENU; */ -/* typedef unsigned long WXHPEN; */ -/* typedef unsigned long WXHBRUSH; */ -/* typedef unsigned long WXHPALETTE; */ -/* typedef CursHandle WXHCURSOR; */ -/* typedef RgnHandle WXHRGN; */ -/* typedef unsigned long WXHACCEL; */ -/* typedef unsigned long WXHINSTANCE; */ -/* typedef unsigned long WXHIMAGELIST; */ -/* typedef unsigned long WXHGLOBAL; */ -/* typedef GrafPtr WXHDC; */ -/* typedef unsigned int WXWPARAM; */ -/* typedef long WXLPARAM; */ -/* typedef void * WXRGNDATA; */ -/* typedef void * WXMSG; */ -/* typedef unsigned long WXHCONV; */ -/* typedef unsigned long WXHKEY; */ -/* typedef void * WXDRAWITEMSTRUCT; */ -/* typedef void * WXMEASUREITEMSTRUCT; */ -/* typedef void * WXLPCREATESTRUCT; */ -/* typedef int (*WXFARPROC)(); */ - -/* typedef WindowPtr WXWindow; */ -/* typedef ControlHandle WXWidget; */ - -#endif - -#if defined( __WXCOCOA__ ) || ( defined(__WXMAC__) && defined(__DARWIN__) ) - -/* Definitions of 32-bit/64-bit types - * These are typedef'd exactly the same way in newer OS X headers so - * redefinition when real headers are included should not be a problem. If - * it is, the types are being defined wrongly here. - * The purpose of these types is so they can be used from public wx headers. - * and also because the older (pre-Leopard) headers don't define them. - */ - -/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros - * since they are unlikely to be needed in a public header. - */ -#if defined(__LP64__) && __LP64__ - typedef double CGFloat; -#else - typedef float CGFloat; -#endif - -#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64) -typedef long NSInteger; -typedef unsigned long NSUInteger; -#else -typedef int NSInteger; -typedef unsigned int NSUInteger; -#endif - -/* Objective-C type declarations. - * These are to be used in public headers in lieu of NSSomething* because - * Objective-C class names are not available in C/C++ code. - */ - -/* NOTE: This ought to work with other compilers too, but I'm being cautious */ -#if (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) -/* It's desirable to have type safety for Objective-C(++) code as it does -at least catch typos of method names among other things. However, it -is not possible to declare an Objective-C class from plain old C or C++ -code. Furthermore, because of C++ name mangling, the type name must -be the same for both C++ and Objective-C++ code. Therefore, we define -what should be a pointer to an Objective-C class as a pointer to a plain -old C struct with the same name. Unfortunately, because the compiler -does not see a struct as an Objective-C class we cannot declare it -as a struct in Objective-C(++) mode. -*/ -#if defined(__OBJC__) -#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ -@class klass; \ -typedef klass *WX_##klass -#else /* not defined(__OBJC__) */ -#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ -typedef struct klass *WX_##klass -#endif /* defined(__OBJC__) */ - -#else /* not Apple's GNU or CodeWarrior */ -#warning "Objective-C types will not be checked by the compiler." -/* NOTE: typedef struct objc_object *id; */ -/* IOW, we're declaring these using the id type without using that name, */ -/* since "id" is used extensively not only within wxWidgets itself, but */ -/* also in wxWidgets application code. The following works fine when */ -/* compiling C(++) code, and works without typesafety for Obj-C(++) code */ -#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ -typedef struct objc_object *WX_##klass - -#endif /* (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) */ - -DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); -DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); -DECLARE_WXCOCOA_OBJC_CLASS(NSBox); -DECLARE_WXCOCOA_OBJC_CLASS(NSButton); -DECLARE_WXCOCOA_OBJC_CLASS(NSColor); -DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSControl); -DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); -DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); -DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSImage); -DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); -DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); -DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); -DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); -DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); -DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); -DECLARE_WXCOCOA_OBJC_CLASS(NSObject); -DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); -DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView); -DECLARE_WXCOCOA_OBJC_CLASS(NSSound); -DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem); -DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn); -DECLARE_WXCOCOA_OBJC_CLASS(NSTableView); -DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer); -DECLARE_WXCOCOA_OBJC_CLASS(NSTextField); -DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); -DECLARE_WXCOCOA_OBJC_CLASS(NSThread); -DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); -DECLARE_WXCOCOA_OBJC_CLASS(NSView); -#ifdef __WXMAC__ -// things added for __WXMAC__ -DECLARE_WXCOCOA_OBJC_CLASS(NSString); -#else -// things only for __WXCOCOA__ -typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ -#endif -#endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/ - -#if defined(__WXPALMOS__) - -typedef void * WXHWND; -typedef void * WXHANDLE; -typedef void * WXHICON; -typedef void * WXHFONT; -typedef void * WXHMENU; -typedef void * WXHPEN; -typedef void * WXHBRUSH; -typedef void * WXHPALETTE; -typedef void * WXHCURSOR; -typedef void * WXHRGN; -typedef void * WXHACCEL; -typedef void * WXHINSTANCE; -typedef void * WXHBITMAP; -typedef void * WXHIMAGELIST; -typedef void * WXHGLOBAL; -typedef void * WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef struct tagMSG WXMSG; - -typedef WXHWND WXWINHANDLE; /* WinHandle of PalmOS */ -typedef WXWINHANDLE WXWidget; - -typedef void * WXFORMPTR; -typedef void * WXEVENTPTR; -typedef void * WXRECTANGLEPTR; - -#endif /* __WXPALMOS__ */ - - -/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ -#if defined(__WIN32__) - -/* the keywords needed for WinMain() declaration */ -#ifndef WXFAR -# define WXFAR -#endif - -/* Stand-ins for Windows types to avoid #including all of windows.h */ -typedef void * WXHWND; -typedef void * WXHANDLE; -typedef void * WXHICON; -typedef void * WXHFONT; -typedef void * WXHMENU; -typedef void * WXHPEN; -typedef void * WXHBRUSH; -typedef void * WXHPALETTE; -typedef void * WXHCURSOR; -typedef void * WXHRGN; -typedef void * WXRECTPTR; -typedef void * WXHACCEL; -typedef void WXFAR * WXHINSTANCE; -typedef void * WXHBITMAP; -typedef void * WXHIMAGELIST; -typedef void * WXHGLOBAL; -typedef void * WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef void * WXRGNDATA; -typedef struct tagMSG WXMSG; -typedef void * WXHCONV; -typedef void * WXHKEY; -typedef void * WXHTREEITEM; - -typedef void * WXDRAWITEMSTRUCT; -typedef void * WXMEASUREITEMSTRUCT; -typedef void * WXLPCREATESTRUCT; - -typedef WXHWND WXWidget; - -#ifdef __WIN64__ -typedef unsigned __int64 WXWPARAM; -typedef __int64 WXLPARAM; -typedef __int64 WXLRESULT; -#else -typedef unsigned int WXWPARAM; -typedef long WXLPARAM; -typedef long WXLRESULT; -#endif - -#if defined(__GNUWIN32__) || defined(__WXMICROWIN__) -typedef int (*WXFARPROC)(); -#else -typedef int (__stdcall *WXFARPROC)(); -#endif -#endif /* __WIN32__ */ - - -#if defined(__OS2__) -typedef unsigned long DWORD; -typedef unsigned short WORD; -#endif - -#if defined(__WXPM__) || defined(__EMX__) -#ifdef __WXPM__ -/* Stand-ins for OS/2 types, to avoid #including all of os2.h */ -typedef unsigned long WXHWND; -typedef unsigned long WXHANDLE; -typedef unsigned long WXHICON; -typedef unsigned long WXHFONT; -typedef unsigned long WXHMENU; -typedef unsigned long WXHPEN; -typedef unsigned long WXHBRUSH; -typedef unsigned long WXHPALETTE; -typedef unsigned long WXHCURSOR; -typedef unsigned long WXHRGN; -typedef unsigned long WXHACCEL; -typedef unsigned long WXHBITMAP; -typedef unsigned long WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef void * WXMSG; -typedef unsigned long WXHTREEITEM; - -typedef void * WXDRAWITEMSTRUCT; -typedef void * WXMEASUREITEMSTRUCT; -typedef void * WXLPCREATESTRUCT; - -typedef WXHWND WXWidget; -#endif -#ifdef __EMX__ -/* Need a well-known type for WXFARPROC - below. MPARAM is typedef'ed too late. */ -#define WXWPARAM void * -#define WXLPARAM void * -#else -#define WXWPARAM MPARAM -#define WXLPARAM MPARAM -#endif -#define RECT RECTL -#define LOGFONT FATTRS -#define LOWORD SHORT1FROMMP -#define HIWORD SHORT2FROMMP - -typedef unsigned long WXMPARAM; -typedef unsigned long WXMSGID; -typedef void* WXRESULT; -/* typedef int (*WXFARPROC)(); */ -/* some windows handles not defined by PM */ -typedef unsigned long HANDLE; -typedef unsigned long HICON; -typedef unsigned long HFONT; -typedef unsigned long HMENU; -typedef unsigned long HPEN; -typedef unsigned long HBRUSH; -typedef unsigned long HPALETTE; -typedef unsigned long HCURSOR; -typedef unsigned long HINSTANCE; -typedef unsigned long HIMAGELIST; -typedef unsigned long HGLOBAL; -#endif /* WXPM || EMX */ - -#if defined (__WXPM__) -/* WIN32 graphics types for OS/2 GPI */ - -/* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */ -#define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16)) - -typedef unsigned long COLORREF; -#define GetRValue(rgb) ((unsigned char)((rgb) >> 16)) -#define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8)) -#define GetBValue(rgb) ((unsigned char)(rgb)) -#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) -#define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b)) -/* OS2's RGB/RGB2 is backwards from this */ -typedef struct tagPALETTEENTRY -{ - char bRed; - char bGreen; - char bBlue; - char bFlags; -} PALETTEENTRY; -typedef struct tagLOGPALETTE -{ - WORD palVersion; - WORD palNumentries; - WORD PALETTEENTRY[1]; -} LOGPALETTE; - -#if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__) - /* VA 3.0 for some reason needs base data types when typedefing a proc proto??? */ -typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*); -#else -#if defined(__EMX__) && !defined(_System) -#define _System -#endif -typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM); -#endif - -#endif /* __WXPM__ */ - - -#if defined(__WXMOTIF__) || defined(__WXX11__) -/* Stand-ins for X/Xt/Motif types */ -typedef void* WXWindow; -typedef void* WXWidget; -typedef void* WXAppContext; -typedef void* WXColormap; -typedef void* WXColor; -typedef void WXDisplay; -typedef void WXEvent; -typedef void* WXCursor; -typedef void* WXPixmap; -typedef void* WXFontStructPtr; -typedef void* WXGC; -typedef void* WXRegion; -typedef void* WXFont; -typedef void* WXImage; -typedef void* WXFontList; -typedef void* WXFontSet; -typedef void* WXRendition; -typedef void* WXRenderTable; -typedef void* WXFontType; /* either a XmFontList or XmRenderTable */ -typedef void* WXString; - -typedef unsigned long Atom; /* this might fail on a few architectures */ -typedef long WXPixel; /* safety catch in src/motif/colour.cpp */ - -#endif /* Motif */ - -#ifdef __WXGTK__ - -/* Stand-ins for GLIB types */ -typedef char gchar; -typedef signed char gint8; -typedef int gint; -typedef unsigned guint; -typedef unsigned long gulong; -typedef void* gpointer; -typedef struct _GSList GSList; - -/* Stand-ins for GDK types */ -typedef struct _GdkColor GdkColor; -typedef struct _GdkColormap GdkColormap; -typedef struct _GdkFont GdkFont; -typedef struct _GdkGC GdkGC; -typedef struct _GdkVisual GdkVisual; - -#ifdef __WXGTK20__ -typedef struct _GdkAtom *GdkAtom; -typedef struct _GdkDrawable GdkWindow; -typedef struct _GdkDrawable GdkBitmap; -typedef struct _GdkDrawable GdkPixmap; -#else /* GTK+ 1.2 */ -typedef gulong GdkAtom; -typedef struct _GdkWindow GdkWindow; -typedef struct _GdkWindow GdkBitmap; -typedef struct _GdkWindow GdkPixmap; -#endif /* GTK+ 1.2/2.0 */ - -typedef struct _GdkCursor GdkCursor; -typedef struct _GdkRegion GdkRegion; -typedef struct _GdkDragContext GdkDragContext; - -#ifdef HAVE_XIM -typedef struct _GdkIC GdkIC; -typedef struct _GdkICAttr GdkICAttr; -#endif - -/* Stand-ins for GTK types */ -typedef struct _GtkWidget GtkWidget; -typedef struct _GtkRcStyle GtkRcStyle; -typedef struct _GtkAdjustment GtkAdjustment; -typedef struct _GtkList GtkList; -typedef struct _GtkToolbar GtkToolbar; -typedef struct _GtkTooltips GtkTooltips; -typedef struct _GtkNotebook GtkNotebook; -typedef struct _GtkNotebookPage GtkNotebookPage; -typedef struct _GtkAccelGroup GtkAccelGroup; -typedef struct _GtkItemFactory GtkItemFactory; -typedef struct _GtkSelectionData GtkSelectionData; -typedef struct _GtkTextBuffer GtkTextBuffer; -typedef struct _GtkRange GtkRange; - -typedef GtkWidget *WXWidget; - -#ifndef __WXGTK20__ -#define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass) -#define GTK_CLASS_TYPE(klass) ((klass)->type) -#endif - -#endif /* __WXGTK__ */ - -#if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE) -#define wxUSE_PANGO 1 -#else -#define wxUSE_PANGO 0 -#endif - -#if wxUSE_PANGO -/* Stand-ins for Pango types */ -typedef struct _PangoContext PangoContext; -typedef struct _PangoLayout PangoLayout; -typedef struct _PangoFontDescription PangoFontDescription; -#endif - -#ifdef __WXMGL__ -typedef struct window_t *WXWidget; -#endif /* MGL */ - -#ifdef __WXDFB__ -/* DirectFB doesn't have the concept of non-TLW window, so use - something arbitrary */ -typedef const void* WXWidget; -#endif /* DFB */ - -/* This is required because of clashing macros in windows.h, which may be */ -/* included before or after wxWidgets classes, and therefore must be */ -/* disabled here before any significant wxWidgets headers are included. */ -#ifdef __WXMSW__ -#include "wx/msw/winundef.h" -#endif /* __WXMSW__ */ - -/* --------------------------------------------------------------------------- */ -/* macro to define a class without copy ctor nor assignment operator */ -/* --------------------------------------------------------------------------- */ - -#define DECLARE_NO_COPY_CLASS(classname) \ - private: \ - classname(const classname&); \ - classname& operator=(const classname&); - -#define DECLARE_NO_ASSIGN_CLASS(classname) \ - private: \ - classname& operator=(const classname&); - -/* --------------------------------------------------------------------------- */ -/* If a manifest is being automatically generated, add common controls 6 to it */ -/* --------------------------------------------------------------------------- */ - -#if (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \ - ( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 ) - -#define WX_CC_MANIFEST(cpu) \ - "/manifestdependency:\"type='win32' \ - name='Microsoft.Windows.Common-Controls' \ - version='6.0.0.0' \ - processorArchitecture='"cpu"' \ - publicKeyToken='6595b64144ccf1df' \ - language='*'\"" - -#if defined _M_IX86 - #pragma comment(linker, WX_CC_MANIFEST("x86")) -#elif defined _M_X64 - #pragma comment(linker, WX_CC_MANIFEST("amd64")) -#elif defined _M_IA64 - #pragma comment(linker, WX_CC_MANIFEST("ia64")) -#else - #pragma comment(linker, WX_CC_MANIFEST("*")) -#endif - -#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */ - -#endif - /* _WX_DEFS_H_ */ +/* + * Name: wx/defs.h + * Purpose: Declarations/definitions common to all wx source files + * Author: Julian Smart and others + * Modified by: Ryan Norton (Converted to C) + * Created: 01/02/97 + * RCS-ID: $Id: defs.h 53370 2008-04-26 05:43:41Z KO $ + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_DEFS_H_ +#define _WX_DEFS_H_ + +/* ---------------------------------------------------------------------------- */ +/* compiler and OS identification */ +/* ---------------------------------------------------------------------------- */ + +#include "wx/platform.h" + +#ifdef __cplusplus +/* Make sure the environment is set correctly */ +# if defined(__WXMSW__) && defined(__X__) +# error "Target can't be both X and Windows" +# elif defined(__WXMSW__) && defined(__PALMOS__) +# error "Target can't be both PalmOS and Windows" +# elif !defined(__WXMOTIF__) && \ + !defined(__WXMSW__) && \ + !defined(__WXPALMOS__)&& \ + !defined(__WXGTK__) && \ + !defined(__WXPM__) && \ + !defined(__WXMAC__) && \ + !defined(__WXCOCOA__) && \ + !defined(__X__) && \ + !defined(__WXMGL__) && \ + !defined(__WXDFB__) && \ + !defined(__WXX11__) && \ + wxUSE_GUI +# ifdef __UNIX__ +# error "No Target! You should use wx-config program for compilation flags!" +# else /* !Unix */ +# error "No Target! You should use supplied makefiles for compilation!" +# endif /* Unix/!Unix */ +# endif +#endif /*__cplusplus*/ + +#ifndef __WXWINDOWS__ + #define __WXWINDOWS__ 1 +#endif + +#ifndef wxUSE_BASE + /* by default consider that this is a monolithic build */ + #define wxUSE_BASE 1 +#endif + +#if !wxUSE_GUI && !defined(__WXBASE__) + #define __WXBASE__ +#endif + +/* include the feature test macros */ +#include "wx/features.h" + +/* suppress some Visual C++ warnings */ +#ifdef __VISUALC__ + /* the only "real" warning here is 4244 but there are just too many of them */ + /* in our code... one day someone should go and fix them but until then... */ +# pragma warning(disable:4097) /* typedef used as class */ +# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */ +# pragma warning(disable:4244) /* conversion from double to float */ +# pragma warning(disable:4355) /* 'this' used in base member initializer list */ +# pragma warning(disable:4511) /* copy ctor couldn't be generated */ +# pragma warning(disable:4512) /* operator=() couldn't be generated */ +# pragma warning(disable:4710) /* function not inlined */ + + /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ + /* is buggy, and occurs for code that does actually get executed */ +# if !defined __WXDEBUG__ && __VISUALC__ <= 1100 +# pragma warning(disable:4702) /* unreachable code */ +# endif + /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro' + * is incompatible with the wxWidgets headers since it is given when + * parameters are empty but not missing. */ +# if __VISUALC__ <= 1100 +# pragma warning(disable:4003) /* not enough actual parameters for macro */ +# endif + + /* + VC++ 8 gives a warning when using standard functions such as sprintf, + localtime, ... -- stop this madness, unless the user had already done it + */ + #if __VISUALC__ >= 1400 + #ifndef _CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE 1 + #endif + #ifndef _CRT_NON_CONFORMING_SWPRINTFS + #define _CRT_NON_CONFORMING_SWPRINTFS 1 + #endif + #endif /* VC++ 8 */ +#endif /* __VISUALC__ */ + +/* suppress some Salford C++ warnings */ +#ifdef __SALFORDC__ +# pragma suppress 353 /* Possible nested comments */ +# pragma suppress 593 /* Define not used */ +# pragma suppress 61 /* enum has no name (doesn't suppress!) */ +# pragma suppress 106 /* unnamed, unused parameter */ +# pragma suppress 571 /* Virtual function hiding */ +#endif /* __SALFORDC__ */ + +/* suppress some Borland C++ warnings */ +#ifdef __BORLANDC__ +# pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */ +#endif /* __BORLANDC__ */ + +/* + g++ gives a warning when a class has private dtor if it has no friends but + this is a perfectly valid situation for a ref-counted class which destroys + itself when its ref count drops to 0, so provide a macro to suppress this + warning + */ +#ifdef __GNUG__ +# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \ + friend class wxDummyFriendFor ## name; +#else /* !g++ */ +# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) +#endif + +/* ---------------------------------------------------------------------------- */ +/* wxWidgets version and compatibility defines */ +/* ---------------------------------------------------------------------------- */ + +#include "wx/version.h" + +/* ============================================================================ */ +/* non portable C++ features */ +/* ============================================================================ */ + +/* ---------------------------------------------------------------------------- */ +/* compiler defects workarounds */ +/* ---------------------------------------------------------------------------- */ + +/* + Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files, + so define it ourselves (newer versions do it for all files, though, and + don't allow it to be redefined) + */ +#if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus) +#define __cplusplus +#endif /* __DECCXX */ + +/* Resolves linking problems under HP-UX when compiling with gcc/g++ */ +#if defined(__HPUX__) && defined(__GNUG__) +#define va_list __gnuc_va_list +#endif /* HP-UX */ + +/* ---------------------------------------------------------------------------- */ +/* check for native bool type and TRUE/FALSE constants */ +/* ---------------------------------------------------------------------------- */ + +/* Add more tests here for Windows compilers that already define bool */ +/* (under Unix, configure tests for this) */ +#ifndef HAVE_BOOL + #if defined( __MWERKS__ ) + #if (__MWERKS__ >= 0x1000) && __option(bool) + #define HAVE_BOOL + #endif + #elif defined(__APPLE__) && defined(__APPLE_CC__) + /* Apple bundled gcc supports bool */ + #define HAVE_BOOL + #elif defined(__VISUALC__) && (__VISUALC__ == 1020) + /* in VC++ 4.2 the bool keyword is reserved (hence can't be typedefed) */ + /* but not implemented, so we must #define it */ + #define bool unsigned int + #elif defined(__VISUALC__) && (__VISUALC__ == 1010) + /* For VisualC++ 4.1, we need to define */ + /* bool as something between 4.0 & 5.0... */ + typedef unsigned int wxbool; + #define bool wxbool + #define HAVE_BOOL + #elif defined(__VISUALC__) && (__VISUALC__ > 1020) + /* VC++ supports bool since 4.2 */ + #define HAVE_BOOL + #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x500) + /* Borland 5.0+ supports bool */ + #define HAVE_BOOL + #elif wxCHECK_WATCOM_VERSION(1,0) + /* Watcom 11+ supports bool */ + #define HAVE_BOOL + #elif defined(__DIGITALMARS__) + /* DigitalMars supports bool */ + #define HAVE_BOOL + #elif defined(__GNUWIN32__) || defined(__MINGW32__) || defined(__CYGWIN__) + /* Cygwin supports bool */ + #define HAVE_BOOL + #elif defined(__VISAGECPP__) + #if __IBMCPP__ < 400 + typedef unsigned long bool; + #define true ((bool)1) + #define false ((bool)0) + #endif + #define HAVE_BOOL + #endif /* compilers */ +#endif /* HAVE_BOOL */ + +#if !defined(__MWERKS__) || !defined(true) +#if !defined(HAVE_BOOL) && !defined(bool) && !defined(VMS) + /* NB: of course, this doesn't replace the standard type, because, for */ + /* example, overloading based on bool/int parameter doesn't work and */ + /* so should be avoided in portable programs */ + typedef unsigned int bool; +#endif /* bool */ + +/* deal with TRUE/true stuff: we assume that if the compiler supports bool, it */ +/* supports true/false as well and that, OTOH, if it does _not_ support bool, */ +/* it doesn't support these keywords (this is less sure, in particular VC++ */ +/* 4.x could be a problem here) */ +#ifndef HAVE_BOOL + #define true ((bool)1) + #define false ((bool)0) +#endif +#endif + +/* for backwards compatibility, also define TRUE and FALSE */ +/* */ +/* note that these definitions should work both in C++ and C code, so don't */ +/* use true/false below */ +#ifndef TRUE + #define TRUE 1 +#endif + +#ifndef FALSE + #define FALSE 0 +#endif + +typedef short int WXTYPE; + +/* special care should be taken with this type under Windows where the real */ +/* window id is unsigned, so we must always do the cast before comparing them */ +/* (or else they would be always different!). Using wxGetWindowId() which does */ +/* the cast itself is recommended. Note that this type can't be unsigned */ +/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ +typedef int wxWindowID; + +/* ---------------------------------------------------------------------------- */ +/* other feature tests */ +/* ---------------------------------------------------------------------------- */ + +/* Every ride down a slippery slope begins with a single step.. */ +/* */ +/* Yes, using nested classes is indeed against our coding standards in */ +/* general, but there are places where you can use them to advantage */ +/* without totally breaking ports that cannot use them. If you do, then */ +/* wrap it in this guard, but such cases should still be relatively rare. */ +#define wxUSE_NESTED_CLASSES 1 + +/* check for explicit keyword support */ +#ifndef HAVE_EXPLICIT + #if defined(__VISUALC__) && (__VISUALC__ >= 1100) + /* VC++ 6.0 and 5.0 have explicit (what about earlier versions?) */ + #define HAVE_EXPLICIT + #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ + && wxCHECK_GCC_VERSION(2, 95) + /* GCC 2.95 has explicit, what about earlier versions? */ + #define HAVE_EXPLICIT + #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520) + /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */ + #define HAVE_EXPLICIT + #elif defined(__MWERKS__) && (__MWERKS__ >= 0x2400) + /* Metrowerks CW6 or higher has explicit */ + #define HAVE_EXPLICIT + #elif defined(__DIGITALMARS__) + #define HAVE_EXPLICIT + #endif +#endif /* !HAVE_EXPLICIT */ + +#ifdef HAVE_EXPLICIT + #define wxEXPLICIT explicit +#else /* !HAVE_EXPLICIT */ + #define wxEXPLICIT +#endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */ + +/* check for static/const_cast<>() (we don't use the other ones for now) */ +#ifndef HAVE_CXX_CASTS + #if defined(__VISUALC__) && (__VISUALC__ >= 1100) + /* VC++ 6.0 and 5.0 have C++ casts (what about earlier versions?) */ + #define HAVE_CXX_CASTS + #elif defined(__MINGW32__) || defined(__CYGWIN32__) + #if wxCHECK_GCC_VERSION(2, 95) + /* GCC 2.95 has C++ casts, what about earlier versions? */ + #define HAVE_CXX_CASTS + #endif + #endif +#endif /* !HAVE_CXX_CASTS */ + +#ifdef HAVE_CXX_CASTS + #ifndef HAVE_CONST_CAST + #define HAVE_CONST_CAST + #endif + #ifndef HAVE_REINTERPRET_CAST + #define HAVE_REINTERPRET_CAST + #endif + #ifndef HAVE_STATIC_CAST + #define HAVE_STATIC_CAST + #endif + #ifndef HAVE_DYNAMIC_CAST + #define HAVE_DYNAMIC_CAST + #endif +#endif /* HAVE_CXX_CASTS */ + +#ifdef HAVE_STATIC_CAST + #define wx_static_cast(t, x) static_cast(x) +#else + #define wx_static_cast(t, x) ((t)(x)) +#endif + +#ifdef HAVE_CONST_CAST + #define wx_const_cast(t, x) const_cast(x) +#else + #define wx_const_cast(t, x) ((t)(x)) +#endif + +#ifdef HAVE_REINTERPRET_CAST + #define wx_reinterpret_cast(t, x) reinterpret_cast(x) +#else + #define wx_reinterpret_cast(t, x) ((t)(x)) +#endif + +/* + This one is a wx invention: like static cast but used when we intentionally + truncate from a larger to smaller type, static_cast<> can't be used for it + as it results in warnings when using some compilers (SGI mipspro for example) + */ +#if defined(__INTELC__) && defined(__cplusplus) + template + inline T wx_truncate_cast_impl(X x) + { + #pragma warning(push) + /* implicit conversion of a 64-bit integral type to a smaller integral type */ + #pragma warning(disable: 1682) + /* conversion from "X" to "T" may lose significant bits */ + #pragma warning(disable: 810) + + return x; + + #pragma warning(pop) + } + + #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) + +#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310 + template + inline T wx_truncate_cast_impl(X x) + { + #pragma warning(push) + /* conversion from 'X' to 'T', possible loss of data */ + #pragma warning(disable: 4267) + + return x; + + #pragma warning(pop) + } + + #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) +#else + #define wx_truncate_cast(t, x) ((t)(x)) +#endif + +/* for consistency with wxStatic/DynamicCast defined in wx/object.h */ +#define wxConstCast(obj, className) wx_const_cast(className *, obj) + +#ifndef HAVE_STD_WSTRING + #if defined(__VISUALC__) && (__VISUALC__ >= 1100) + /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */ + #define HAVE_STD_WSTRING + #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ + && wxCHECK_GCC_VERSION(3, 3) + /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */ + #define HAVE_STD_WSTRING + #endif +#endif + +#ifndef HAVE_STD_STRING_COMPARE + #if defined(__VISUALC__) && (__VISUALC__ >= 1100) + /* VC++ 6.0 and 5.0 have std::string::compare */ + /* (what about earlier versions?) */ + #define HAVE_STD_STRING_COMPARE + #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ + && wxCHECK_GCC_VERSION(3, 1) + /* GCC 3.1 has std::string::compare; */ + /* 3.0 never was in MinGW, 2.95 hasn't it */ + #define HAVE_STD_STRING_COMPARE + #endif +#endif + +/* provide replacement for C99 va_copy() if the compiler doesn't have it */ + +/* could be already defined by configure or the user */ +#ifndef wxVaCopy + /* if va_copy is a macro or configure detected that we have it, use it */ + #if defined(va_copy) || defined(HAVE_VA_COPY) + #define wxVaCopy va_copy + #else /* no va_copy, try to provide a replacement */ + /* + configure tries to determine whether va_list is an array or struct + type, but it may not be used under Windows, so deal with a few + special cases. + */ + + #ifdef __WATCOMC__ + /* Watcom uses array type for va_list except for PPC and Alpha */ + #if !defined(__PPC__) && !defined(__AXP__) + #define VA_LIST_IS_ARRAY + #endif + #endif /* __WATCOMC__ */ + + #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32)) + /* + PPC using SysV ABI and NT/PPC are special in that they use an + extra level of indirection. + */ + #define VA_LIST_IS_POINTER + #endif /* SysV or Win32 on __PPC__ */ + + /* + note that we use memmove(), not memcpy(), in case anybody tries + to do wxVaCopy(ap, ap) + */ + #if defined(VA_LIST_IS_POINTER) + #define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list)) + #elif defined(VA_LIST_IS_ARRAY) + #define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list)) + #else /* we can only hope that va_lists are simple lvalues */ + #define wxVaCopy(d, s) ((d) = (s)) + #endif + #endif /* va_copy/!va_copy */ +#endif /* wxVaCopy */ + + +/* ---------------------------------------------------------------------------- */ +/* portable calling conventions macros */ +/* ---------------------------------------------------------------------------- */ + +/* stdcall is used for all functions called by Windows under Windows */ +#if defined(__WINDOWS__) + #if defined(__GNUWIN32__) + #define wxSTDCALL __attribute__((stdcall)) + #else + /* both VC++ and Borland understand this */ + #define wxSTDCALL _stdcall + #endif + +#else /* Win */ + /* no such stupidness under Unix */ + #define wxSTDCALL +#endif /* platform */ + +/* LINKAGEMODE mode is empty for everyting except OS/2 */ +#ifndef LINKAGEMODE + #define LINKAGEMODE +#endif /* LINKAGEMODE */ + +/* wxCALLBACK should be used for the functions which are called back by */ +/* Windows (such as compare function for wxListCtrl) */ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) + #define wxCALLBACK wxSTDCALL +#else + /* no stdcall under Unix nor Win16 */ + #define wxCALLBACK +#endif /* platform */ + +/* generic calling convention for the extern "C" functions */ + +#if defined(__VISUALC__) + #define wxC_CALLING_CONV _cdecl +#elif defined(__VISAGECPP__) + #define wxC_CALLING_CONV _Optlink +#else /* !Visual C++ */ + #define wxC_CALLING_CONV +#endif /* compiler */ + +/* callling convention for the qsort(3) callback */ +#define wxCMPFUNC_CONV wxC_CALLING_CONV + +/* compatibility :-( */ +#define CMPFUNC_CONV wxCMPFUNC_CONV + +/* DLL import/export declarations */ +#include "wx/dlimpexp.h" + +/* ---------------------------------------------------------------------------- */ +/* Very common macros */ +/* ---------------------------------------------------------------------------- */ + +/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */ +#ifndef ATTRIBUTE_PRINTF +# if defined(__GNUC__) && !wxUSE_UNICODE +# define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# else +# define ATTRIBUTE_PRINTF(m, n) +# endif + +# define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) +# define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) +# define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) +# define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) +# define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) +#endif /* !defined(ATTRIBUTE_PRINTF) */ + +/* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */ +#if wxCHECK_GCC_VERSION(3, 1) + #define wxDEPRECATED(x) x __attribute__ ((deprecated)) +#elif defined(__VISUALC__) && (__VISUALC__ >= 1300) + #define wxDEPRECATED(x) __declspec(deprecated) x +#else + #define wxDEPRECATED(x) x +#endif + +/* everybody gets the assert and other debug macros */ +#include "wx/debug.h" + +/* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ +/* it must not be defined as "(void *)0" which is standard for C but completely */ +/* breaks C++ code) */ +#ifndef __HANDHELDPC__ +#include +#endif + +/* delete pointer if it is not NULL and NULL it afterwards */ +/* (checking that it's !NULL before passing it to delete is just a */ +/* a question of style, because delete will do it itself anyhow, but it might */ +/* be considered as an error by some overzealous debugging implementations of */ +/* the library, so we do it ourselves) */ +#define wxDELETE(p) if ( (p) != NULL ) { delete p; p = NULL; } + +/* delete an array and NULL it (see comments above) */ +#define wxDELETEA(p) if ( (p) ) { delete [] (p); p = NULL; } + +/* size of statically declared array */ +#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) + +/* symbolic constant used by all Find()-like functions returning positive */ +/* integer on success as failure indicator */ +#define wxNOT_FOUND (-1) + +/* ---------------------------------------------------------------------------- */ +/* macros to avoid compiler warnings */ +/* ---------------------------------------------------------------------------- */ + +/* Macro to cut down on compiler warnings. */ +#if 1 /* there should be no more any compilers needing the "#else" version */ + #define WXUNUSED(identifier) /* identifier */ +#else /* stupid, broken compiler */ + #define WXUNUSED(identifier) identifier +#endif + +/* some arguments are only used in debug mode, but unused in release one */ +#ifdef __WXDEBUG__ + #define WXUNUSED_UNLESS_DEBUG(param) param +#else + #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) +#endif + +/* some arguments are not used in unicode mode */ +#if wxUSE_UNICODE + #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param) +#else + #define WXUNUSED_IN_UNICODE(param) param +#endif + +/* some arguments are not used in WinCE build */ +#ifdef __WXWINCE__ + #define WXUNUSED_IN_WINCE(param) WXUNUSED(param) +#else + #define WXUNUSED_IN_WINCE(param) param +#endif + +/* unused parameters in non stream builds */ +#if wxUSE_STREAMS + #define WXUNUSED_UNLESS_STREAMS(param) param +#else + #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param) +#endif + +/* some compilers give warning about a possibly unused variable if it is */ +/* initialized in both branches of if/else and shut up if it is initialized */ +/* when declared, but other compilers then give warnings about unused variable */ +/* value -- this should satisfy both of them */ +#if defined(__VISUALC__) + #define wxDUMMY_INITIALIZE(val) = val +#else + #define wxDUMMY_INITIALIZE(val) +#endif + +/* sometimes the value of a variable is *really* not used, to suppress the */ +/* resulting warning you may pass it to this function */ +#ifdef __cplusplus +# ifdef __BORLANDC__ +# define wxUnusedVar(identifier) identifier +# else + template + inline void wxUnusedVar(const T& WXUNUSED(t)) { } +# endif +#endif + +/* ---------------------------------------------------------------------------- */ +/* compiler specific settings */ +/* ---------------------------------------------------------------------------- */ + +/* to allow compiling with warning level 4 under Microsoft Visual C++ some */ +/* warnings just must be disabled */ +#ifdef __VISUALC__ + #pragma warning(disable: 4514) /* unreferenced inline func has been removed */ +/* + you might be tempted to disable this one also: triggered by CHECK and FAIL + macros in debug.h, but it's, overall, a rather useful one, so I leave it and + will try to find some way to disable this warning just for CHECK/FAIL. Anyone? +*/ + #pragma warning(disable: 4127) /* conditional expression is constant */ +#endif /* VC++ */ + +#if defined(__MWERKS__) + #undef try + #undef except + #undef finally + #define except(x) catch(...) +#endif /* Metrowerks */ + +#if wxONLY_WATCOM_EARLIER_THAN(1,4) + typedef short mode_t; +#endif + +/* where should i put this? we need to make sure of this as it breaks */ +/* the code. */ +#if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) +# ifndef __MWERKS__ +/* #undef __WXDEBUG__ */ +# ifdef wxUSE_DEBUG_NEW_ALWAYS +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +# endif +# endif +#endif + +/* ---------------------------------------------------------------------------- */ +/* standard wxWidgets types */ +/* ---------------------------------------------------------------------------- */ + +/* the type for screen and DC coordinates */ +typedef int wxCoord; + +enum { wxDefaultCoord = -1 }; + +/* ---------------------------------------------------------------------------- */ +/* define fixed length types */ +/* ---------------------------------------------------------------------------- */ + +#if defined(__WXPALMOS__) || defined(__MINGW32__) + #include +#endif + +/* chars are always one byte (by definition), shorts are always two (in */ +/* practice) */ + +/* 8bit */ +#ifndef SIZEOF_CHAR + #define SIZEOF_CHAR 1 +#endif +typedef signed char wxInt8; +typedef unsigned char wxUint8; +typedef wxUint8 wxByte; + + +/* 16bit */ +#ifdef SIZEOF_SHORT + #if SIZEOF_SHORT != 2 + #error "wxWidgets assumes sizeof(short) == 2, please fix the code" + #endif +#else + #define SIZEOF_SHORT 2 +#endif + +typedef signed short wxInt16; +typedef unsigned short wxUint16; + +typedef wxUint16 wxWord; + +/* + things are getting more interesting with ints, longs and pointers + + there are several different standard data models described by this table: + + +-----------+----------------------------+ + |type\model | LP64 ILP64 LLP64 ILP32 LP32| + +-----------+----------------------------+ + |char | 8 8 8 8 8 | + |short | 16 16 16 16 16 | + |int | 32 64 32 32 16 | + |long | 64 64 32 32 32 | + |long long | 64 | + |void * | 64 64 64 32 32 | + +-----------+----------------------------+ + + Win16 used LP32 (but we don't support it any longer), Win32 obviously used + ILP32 and Win64 uses LLP64 (a.k.a. P64) + + Under Unix LP64 is the most widely used (the only I've ever seen, in fact) + */ + +/* 32bit */ +#ifdef __PALMOS__ + typedef int wxInt32; + typedef unsigned int wxUint32; + #define SIZEOF_INT 4 + #define SIZEOF_LONG 4 + #define SIZEOF_WCHAR_T 2 + #define SIZEOF_SIZE_T 4 + #define wxSIZE_T_IS_UINT + #define SIZEOF_VOID_P 4 + #define SIZEOF_SIZE_T 4 +#elif defined(__WINDOWS__) + /* Win64 uses LLP64 model and so ints and longs have the same size as in */ + /* Win32 */ + #if defined(__WIN32__) + typedef int wxInt32; + typedef unsigned int wxUint32; + + /* Assume that if SIZEOF_INT is defined that all the other ones except + SIZEOF_SIZE_T, are too. See next #if below. */ + #ifndef SIZEOF_INT + #define SIZEOF_INT 4 + #define SIZEOF_LONG 4 + #define SIZEOF_WCHAR_T 2 + + /* + under Win64 sizeof(size_t) == 8 and so it is neither unsigned + int nor unsigned long! + */ + #ifdef __WIN64__ + #define SIZEOF_SIZE_T 8 + + #undef wxSIZE_T_IS_UINT + #else /* Win32 */ + #define SIZEOF_SIZE_T 4 + + #define wxSIZE_T_IS_UINT + #endif + #undef wxSIZE_T_IS_ULONG + + #ifdef __WIN64__ + #define SIZEOF_VOID_P 8 + #else /* Win32 */ + #define SIZEOF_VOID_P 4 + #endif /* Win64/32 */ + #endif /* !defined(SIZEOF_INT) */ + + /* + If Python.h was included first, it defines all of the SIZEOF's above + except for SIZEOF_SIZE_T, so we need to do it here to avoid + triggering the #error in the ssize_t typedefs below... + */ + #ifndef SIZEOF_SIZE_T + #ifdef __WIN64__ + #define SIZEOF_SIZE_T 8 + #else /* Win32 */ + #define SIZEOF_SIZE_T 4 + #endif + #endif + #else + #error "Unsupported Windows version" + #endif +#else /* !Windows */ + /* SIZEOF_XXX are normally defined by configure */ + #ifdef SIZEOF_INT + #if SIZEOF_INT == 8 + /* must be ILP64 data model, there is normally a special 32 bit */ + /* type in it but we don't know what it is... */ + #error "No 32bit int type on this platform" + #elif SIZEOF_INT == 4 + typedef int wxInt32; + typedef unsigned int wxUint32; + #elif SIZEOF_INT == 2 + /* must be LP32 */ + #if SIZEOF_LONG != 4 + #error "No 32bit int type on this platform" + #endif + + typedef long wxInt32; + typedef unsigned long wxUint32; + #else + /* wxWidgets is not ready for 128bit systems yet... */ + #error "Unknown sizeof(int) value, what are you compiling for?" + #endif + #else /* !defined(SIZEOF_INT) */ + /* assume default 32bit machine -- what else can we do? */ + wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes); + wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes); + wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes); + + #define SIZEOF_INT 4 + #define SIZEOF_SIZE_T 4 + #define SIZEOF_VOID_P 4 + + typedef int wxInt32; + typedef unsigned int wxUint32; + + #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T) + #define SIZEOF_WCHAR_T 4 + #endif + #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T) + /* also assume that sizeof(wchar_t) == 2 (under Unix the most */ + /* common case is 4 but there configure would have defined */ + /* SIZEOF_WCHAR_T for us) */ + /* the most common case */ + wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2, + Wchar_tMustBeExactly2Bytes); + + #define SIZEOF_WCHAR_T 2 + #endif /* wxUSE_WCHAR_T */ + #endif +#endif /* Win/!Win */ + +typedef wxUint32 wxDword; + +/* + Define an integral type big enough to contain all of long, size_t and void *. + */ +#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T + /* normal case */ + typedef unsigned long wxUIntPtr; +#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P + /* Win64 case */ + typedef size_t wxUIntPtr; +#else + /* + This should never happen for the current architectures but if you're + using one where it does, please contact wx-dev@lists.wxwidgets.org. + */ + #error "Pointers can't be stored inside integer types." +#endif + +#ifdef __cplusplus +/* And also define a couple of simple functions to cast pointer to/from it. */ +inline wxUIntPtr wxPtrToUInt(const void *p) +{ + /* + VC++ 7.1 gives warnings about casts such as below even when they're + explicit with /Wp64 option, suppress them as we really know what we're + doing here. Same thing with icc with -Wall. + */ +#ifdef __VISUALC__ + #if __VISUALC__ >= 1200 + #pragma warning(push) + #endif + /* pointer truncation from '' to '' */ + #pragma warning(disable: 4311) +#elif defined(__INTELC__) + #pragma warning(push) + /* conversion from pointer to same-sized integral type */ + #pragma warning(disable: 1684) +#endif + + return wx_reinterpret_cast(wxUIntPtr, p); + +#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) + #pragma warning(pop) +#endif +} + +inline void *wxUIntToPtr(wxUIntPtr p) +{ +#ifdef __VISUALC__ + #if __VISUALC__ >= 1200 + #pragma warning(push) + #endif + /* conversion to type of greater size */ + #pragma warning(disable: 4312) +#elif defined(__INTELC__) + #pragma warning(push) + /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */ + #pragma warning(disable: 171) +#endif + + return wx_reinterpret_cast(void *, p); + +#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) + #pragma warning(pop) +#endif +} +#endif /*__cplusplus*/ + + +/* 64 bit */ + +/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */ +/* wxLongLong_t" in wx/longlong.h */ + +/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */ + +/* to avoid compilation problems on 64bit machines with ambiguous method calls */ +/* we will need to define this */ +#undef wxLongLongIsLong + +/* + First check for specific compilers which have known 64 bit integer types, + this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for + e.g. MSVC builds (Python.h defines it as 8 even for MSVC). + + Also notice that we check for "long long" before checking for 64 bit long as + we still want to use "long long" and not "long" for wxLongLong_t on 64 bit + architectures to be able to pass wxLongLong_t to the standard functions + prototyped as taking "long long" such as strtoll(). + */ +#if (defined(__VISUALC__) && defined(__WIN32__)) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec _T("I64") +#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec _T("L") +#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__))) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec _T("L") +#elif defined(__DIGITALMARS__) + #define wxLongLong_t __int64 + #define wxLongLongSuffix LL + #define wxLongLongFmtSpec _T("ll") +#elif defined(__MINGW32__) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec _T("I64") +#elif defined(__MWERKS__) + #if __option(longlong) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec _T("ll") + #else + #error "The 64 bit integer support in CodeWarrior has been disabled." + #error "See the documentation on the 'longlong' pragma." + #endif +#elif defined(__WXPALMOS__) + #define wxLongLong_t int64_t + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec _T("ll") +#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 + #define wxLongLong_t long long +#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ + defined(__GNUC__) || \ + defined(__CYGWIN__) || \ + defined(__WXMICROWIN__) || \ + (defined(__DJGPP__) && __DJGPP__ >= 2) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec _T("ll") +#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) + #define wxLongLong_t long + #define wxLongLongSuffix l + #define wxLongLongFmtSpec _T("l") + #define wxLongLongIsLong +#endif + + +#ifdef wxLongLong_t + + #ifdef __WXPALMOS__ + #define wxULongLong_t uint64_t + #else + #define wxULongLong_t unsigned wxLongLong_t + #endif + + /* these macros allow to define 64 bit constants in a portable way */ + #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) + #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) + + typedef wxLongLong_t wxInt64; + typedef wxULongLong_t wxUint64; + + #define wxHAS_INT64 1 + +#elif wxUSE_LONGLONG + /* these macros allow to define 64 bit constants in a portable way */ + #define wxLL(x) wxLongLong(x) + #define wxULL(x) wxULongLong(x) + + #define wxInt64 wxLongLong + #define wxUint64 wxULongLong + + #define wxHAS_INT64 1 + +#else /* !wxUSE_LONGLONG */ + + #define wxHAS_INT64 0 + +#endif + + +/* Make sure ssize_t is defined (a signed type the same size as size_t) */ +/* HAVE_SSIZE_T should be defined for compiliers that already have it */ +#ifdef __MINGW32__ + #if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T) + #define HAVE_SSIZE_T + #endif +#endif +#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T) + #define HAVE_SSIZE_T +#endif +#if wxCHECK_WATCOM_VERSION(1,4) + #define HAVE_SSIZE_T +#endif +#ifndef HAVE_SSIZE_T + #if SIZEOF_SIZE_T == 4 + typedef wxInt32 ssize_t; + #elif SIZEOF_SIZE_T == 8 + typedef wxInt64 ssize_t; + #else + #error "error defining ssize_t, size_t is not 4 or 8 bytes" + #endif +#endif + + +/* base floating point types */ +/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */ +/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */ +/* wxDouble: native fastest representation that has at least wxFloat64 */ +/* precision, so use the IEEE types for storage, and this for */ +/* calculations */ + +typedef float wxFloat32; +#if (defined( __WXMAC__ ) || defined(__WXCOCOA__)) && defined (__MWERKS__) + typedef short double wxFloat64; +#else + typedef double wxFloat64; +#endif + +typedef double wxDouble; + +/* + Some (non standard) compilers typedef wchar_t as an existing type instead + of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 + for them and to 1 for all the others. + */ +#if wxUSE_WCHAR_T + /* + VC++ typedefs wchar_t as unsigned short by default, that is unless + /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED is + defined. + */ +# if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) +# define wxWCHAR_T_IS_REAL_TYPE 0 +# else /* compiler having standard-conforming wchar_t */ +# define wxWCHAR_T_IS_REAL_TYPE 1 +# endif +#endif /* wxUSE_WCHAR_T */ + +/* ---------------------------------------------------------------------------- */ +/* byte ordering related definition and macros */ +/* ---------------------------------------------------------------------------- */ + +/* byte sex */ + +#define wxBIG_ENDIAN 4321 +#define wxLITTLE_ENDIAN 1234 +#define wxPDP_ENDIAN 3412 + +#ifdef WORDS_BIGENDIAN +#define wxBYTE_ORDER wxBIG_ENDIAN +#else +#define wxBYTE_ORDER wxLITTLE_ENDIAN +#endif + +/* byte swapping */ + +#if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh ) +/* assembler versions for these */ +#ifdef __POWERPC__ + inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i ) + {return (__lhbrx( &i , 0 ) );} + inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i ) + {return (__lhbrx( &i , 0 ) );} + inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i ) + {return (__lwbrx( &i , 0 ) );} + inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i ) + {return (__lwbrx( &i , 0 ) );} +#else + #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0) + pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value) + = { 0xE158 }; + + #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) + pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value) + = { 0xE158 }; + + #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) + pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value) + = { 0xE158, 0x4840, 0xE158 }; + + #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) + pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value) + = { 0xE158, 0x4840, 0xE158 }; + +#endif +#else /* !MWERKS */ +#define wxUINT16_SWAP_ALWAYS(val) \ + ((wxUint16) ( \ + (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ + (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) + +#define wxINT16_SWAP_ALWAYS(val) \ + ((wxInt16) ( \ + (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ + (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) + +#define wxUINT32_SWAP_ALWAYS(val) \ + ((wxUint32) ( \ + (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ + (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ + (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ + (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) + +#define wxINT32_SWAP_ALWAYS(val) \ + ((wxInt32) ( \ + (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ + (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ + (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ + (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) +#endif +/* machine specific byte swapping */ + +#ifdef wxLongLong_t + #define wxUINT64_SWAP_ALWAYS(val) \ + ((wxUint64) ( \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) + + #define wxINT64_SWAP_ALWAYS(val) \ + ((wxInt64) ( \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) +#elif wxUSE_LONGLONG /* !wxLongLong_t */ + #define wxUINT64_SWAP_ALWAYS(val) \ + ((wxUint64) ( \ + ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \ + ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \ + ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \ + ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \ + ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \ + ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \ + ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \ + ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56))) + + #define wxINT64_SWAP_ALWAYS(val) \ + ((wxInt64) ( \ + ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \ + ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \ + ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \ + ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \ + ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \ + ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \ + ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \ + ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56))) +#endif /* wxLongLong_t/!wxLongLong_t */ + +#ifdef WORDS_BIGENDIAN + #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val) + #define wxUINT16_SWAP_ON_LE(val) (val) + #define wxINT16_SWAP_ON_LE(val) (val) + #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_LE(val) (val) + #define wxINT32_SWAP_ON_LE(val) (val) + #if wxHAS_INT64 + #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val) + #define wxUINT64_SWAP_ON_LE(val) (val) + #endif +#else + #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val) + #define wxUINT16_SWAP_ON_BE(val) (val) + #define wxINT16_SWAP_ON_BE(val) (val) + #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_BE(val) (val) + #define wxINT32_SWAP_ON_BE(val) (val) + #if wxHAS_INT64 + #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val) + #define wxUINT64_SWAP_ON_BE(val) (val) + #endif +#endif + +/* ---------------------------------------------------------------------------- */ +/* Geometric flags */ +/* ---------------------------------------------------------------------------- */ + +enum wxGeometryCentre +{ + wxCENTRE = 0x0001, + wxCENTER = wxCENTRE +}; + +/* centering into frame rather than screen (obsolete) */ +#define wxCENTER_FRAME 0x0000 +/* centre on screen rather than parent */ +#define wxCENTRE_ON_SCREEN 0x0002 +#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN + +enum wxOrientation +{ + /* don't change the values of these elements, they are used elsewhere */ + wxHORIZONTAL = 0x0004, + wxVERTICAL = 0x0008, + + wxBOTH = wxVERTICAL | wxHORIZONTAL +}; + +enum wxDirection +{ + wxLEFT = 0x0010, + wxRIGHT = 0x0020, + wxUP = 0x0040, + wxDOWN = 0x0080, + + wxTOP = wxUP, + wxBOTTOM = wxDOWN, + + wxNORTH = wxUP, + wxSOUTH = wxDOWN, + wxWEST = wxLEFT, + wxEAST = wxRIGHT, + + wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT) +}; + +enum wxAlignment +{ + wxALIGN_NOT = 0x0000, + wxALIGN_CENTER_HORIZONTAL = 0x0100, + wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL, + wxALIGN_LEFT = wxALIGN_NOT, + wxALIGN_TOP = wxALIGN_NOT, + wxALIGN_RIGHT = 0x0200, + wxALIGN_BOTTOM = 0x0400, + wxALIGN_CENTER_VERTICAL = 0x0800, + wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL, + + wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL), + wxALIGN_CENTRE = wxALIGN_CENTER, + + /* a mask to extract alignment from the combination of flags */ + wxALIGN_MASK = 0x0f00 +}; + +enum wxStretch +{ + wxSTRETCH_NOT = 0x0000, + wxSHRINK = 0x1000, + wxGROW = 0x2000, + wxEXPAND = wxGROW, + wxSHAPED = 0x4000, + wxFIXED_MINSIZE = 0x8000, +#if wxABI_VERSION >= 20808 + wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002, +#endif + wxTILE = 0xc000, + + /* for compatibility only, default now, don't use explicitly any more */ +#if WXWIN_COMPATIBILITY_2_4 + wxADJUST_MINSIZE = 0x00100000 +#else + wxADJUST_MINSIZE = 0 +#endif +}; + +/* border flags: the values are chosen for backwards compatibility */ +enum wxBorder +{ + /* this is different from wxBORDER_NONE as by default the controls do have */ + /* border */ + wxBORDER_DEFAULT = 0, + + wxBORDER_NONE = 0x00200000, + wxBORDER_STATIC = 0x01000000, + wxBORDER_SIMPLE = 0x02000000, + wxBORDER_RAISED = 0x04000000, + wxBORDER_SUNKEN = 0x08000000, + wxBORDER_DOUBLE = 0x10000000, /* deprecated */ + wxBORDER_THEME = 0x10000000, + + /* a mask to extract border style from the combination of flags */ + wxBORDER_MASK = 0x1f200000 +}; + +/* This makes it easier to specify a 'normal' border for a control */ +#if defined(__SMARTPHONE__) || defined(__POCKETPC__) +#define wxDEFAULT_CONTROL_BORDER wxBORDER_SIMPLE +#else +#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN +#endif + +/* ---------------------------------------------------------------------------- */ +/* Window style flags */ +/* ---------------------------------------------------------------------------- */ + +/* + * Values are chosen so they can be |'ed in a bit list. + * Some styles are used across more than one group, + * so the values mustn't clash with others in the group. + * Otherwise, numbers can be reused across groups. + * + * From version 1.66: + * Window (cross-group) styles now take up the first half + * of the flag, and control-specific styles the + * second half. + * + */ + +/* + * Window (Frame/dialog/subwindow/panel item) style flags + */ +#define wxVSCROLL 0x80000000 +#define wxHSCROLL 0x40000000 +#define wxCAPTION 0x20000000 + +/* New styles (border styles are now in their own enum) */ +#define wxDOUBLE_BORDER wxBORDER_DOUBLE +#define wxSUNKEN_BORDER wxBORDER_SUNKEN +#define wxRAISED_BORDER wxBORDER_RAISED +#define wxBORDER wxBORDER_SIMPLE +#define wxSIMPLE_BORDER wxBORDER_SIMPLE +#define wxSTATIC_BORDER wxBORDER_STATIC +#define wxNO_BORDER wxBORDER_NONE + +/* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */ +/* disable it - but still show (see also wxLB_ALWAYS_SB style) */ +/* */ +/* NB: as this style is only supported by wxUniversal and wxMSW so far */ +#define wxALWAYS_SHOW_SB 0x00800000 + +/* Clip children when painting, which reduces flicker in e.g. frames and */ +/* splitter windows, but can't be used in a panel where a static box must be */ +/* 'transparent' (panel paints the background for it) */ +#define wxCLIP_CHILDREN 0x00400000 + +/* Note we're reusing the wxCAPTION style because we won't need captions */ +/* for subwindows/controls */ +#define wxCLIP_SIBLINGS 0x20000000 + +#define wxTRANSPARENT_WINDOW 0x00100000 + +/* Add this style to a panel to get tab traversal working outside of dialogs */ +/* (on by default for wxPanel, wxDialog, wxScrolledWindow) */ +#define wxTAB_TRAVERSAL 0x00080000 + +/* Add this style if the control wants to get all keyboard messages (under */ +/* Windows, it won't normally get the dialog navigation key events) */ +#define wxWANTS_CHARS 0x00040000 + +/* Make window retained (Motif only, see src/generic/scrolwing.cpp) + * This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW + * on other platforms + */ + +#ifdef __WXMOTIF__ +#define wxRETAINED 0x00020000 +#else +#define wxRETAINED 0x00000000 +#endif +#define wxBACKINGSTORE wxRETAINED + +/* set this flag to create a special popup window: it will be always shown on */ +/* top of other windows, will capture the mouse and will be dismissed when the */ +/* mouse is clicked outside of it or if it loses focus in any other way */ +#define wxPOPUP_WINDOW 0x00020000 + +/* force a full repaint when the window is resized (instead of repainting just */ +/* the invalidated area) */ +#define wxFULL_REPAINT_ON_RESIZE 0x00010000 + +/* obsolete: now this is the default behaviour */ +/* */ +/* don't invalidate the whole window (resulting in a PAINT event) when the */ +/* window is resized (currently, makes sense for wxMSW only) */ +#define wxNO_FULL_REPAINT_ON_RESIZE 0 + +/* A mask which can be used to filter (out) all wxWindow-specific styles. + */ +#define wxWINDOW_STYLE_MASK \ + (wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \ + wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \ + wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE) + +/* + * Extra window style flags (use wxWS_EX prefix to make it clear that they + * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle()) + */ + +/* by default, TransferDataTo/FromWindow() only work on direct children of the */ +/* window (compatible behaviour), set this flag to make them recursively */ +/* descend into all subwindows */ +#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001 + +/* wxCommandEvents and the objects of the derived classes are forwarded to the */ +/* parent window and so on recursively by default. Using this flag for the */ +/* given window allows to block this propagation at this window, i.e. prevent */ +/* the events from being propagated further upwards. The dialogs have this */ +/* flag on by default. */ +#define wxWS_EX_BLOCK_EVENTS 0x00000002 + +/* don't use this window as an implicit parent for the other windows: this must */ +/* be used with transient windows as otherwise there is the risk of creating a */ +/* dialog/frame with this window as a parent which would lead to a crash if the */ +/* parent is destroyed before the child */ +#define wxWS_EX_TRANSIENT 0x00000004 + +/* don't paint the window background, we'll assume it will */ +/* be done by a theming engine. This is not yet used but could */ +/* possibly be made to work in the future, at least on Windows */ +#define wxWS_EX_THEMED_BACKGROUND 0x00000008 + +/* this window should always process idle events */ +#define wxWS_EX_PROCESS_IDLE 0x00000010 + +/* this window should always process UI update events */ +#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020 + +/* Draw the window in a metal theme on Mac */ +#define wxFRAME_EX_METAL 0x00000040 +#define wxDIALOG_EX_METAL 0x00000040 + +/* Use this style to add a context-sensitive help to the window (currently for */ +/* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */ +#define wxWS_EX_CONTEXTHELP 0x00000080 + +/* synonyms for wxWS_EX_CONTEXTHELP for compatibility */ +#define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP +#define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP + +/* Create a window which is attachable to another top level window */ +#define wxFRAME_DRAWER 0x0020 + +/* + * MDI parent frame style flags + * Can overlap with some of the above. + */ + +#define wxFRAME_NO_WINDOW_MENU 0x0100 + +/* + * wxMenuBar style flags + */ +/* use native docking */ +#define wxMB_DOCKABLE 0x0001 + +/* + * wxMenu style flags + */ +#define wxMENU_TEAROFF 0x0001 + +/* + * Apply to all panel items + */ +#define wxCOLOURED 0x0800 +#define wxFIXED_LENGTH 0x0400 + +/* + * Styles for wxListBox + */ +#define wxLB_SORT 0x0010 +#define wxLB_SINGLE 0x0020 +#define wxLB_MULTIPLE 0x0040 +#define wxLB_EXTENDED 0x0080 +/* wxLB_OWNERDRAW is Windows-only */ +#define wxLB_OWNERDRAW 0x0100 +#define wxLB_NEEDED_SB 0x0200 +#define wxLB_ALWAYS_SB 0x0400 +#define wxLB_HSCROLL wxHSCROLL +/* always show an entire number of rows */ +#define wxLB_INT_HEIGHT 0x0800 + +#if WXWIN_COMPATIBILITY_2_6 + /* deprecated synonyms */ + #define wxPROCESS_ENTER 0x0400 /* wxTE_PROCESS_ENTER */ + #define wxPASSWORD 0x0800 /* wxTE_PASSWORD */ +#endif + +/* + * wxComboBox style flags + */ +#define wxCB_SIMPLE 0x0004 +#define wxCB_SORT 0x0008 +#define wxCB_READONLY 0x0010 +#define wxCB_DROPDOWN 0x0020 + +/* + * wxRadioBox style flags + */ +/* should we number the items from left to right or from top to bottom in a 2d */ +/* radiobox? */ +#define wxRA_LEFTTORIGHT 0x0001 +#define wxRA_TOPTOBOTTOM 0x0002 + +/* New, more intuitive names to specify majorDim argument */ +#define wxRA_SPECIFY_COLS wxHORIZONTAL +#define wxRA_SPECIFY_ROWS wxVERTICAL + +/* Old names for compatibility */ +#define wxRA_HORIZONTAL wxHORIZONTAL +#define wxRA_VERTICAL wxVERTICAL +#define wxRA_USE_CHECKBOX 0x0010 /* alternative native subcontrols (wxPalmOS) */ + +/* + * wxRadioButton style flag + */ +#define wxRB_GROUP 0x0004 +#define wxRB_SINGLE 0x0008 +#define wxRB_USE_CHECKBOX 0x0010 /* alternative native control (wxPalmOS) */ + +/* + * wxScrollBar flags + */ +#define wxSB_HORIZONTAL wxHORIZONTAL +#define wxSB_VERTICAL wxVERTICAL + +/* + * wxSpinButton flags. + * Note that a wxSpinCtrl is sometimes defined as + * a wxTextCtrl, and so the flags must be different + * from wxTextCtrl's. + */ +#define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */ +#define wxSP_VERTICAL wxVERTICAL /* 8 */ +#define wxSP_ARROW_KEYS 0x1000 +#define wxSP_WRAP 0x2000 + +/* + * wxTabCtrl flags + */ +#define wxTC_RIGHTJUSTIFY 0x0010 +#define wxTC_FIXEDWIDTH 0x0020 +#define wxTC_TOP 0x0000 /* default */ +#define wxTC_LEFT 0x0020 +#define wxTC_RIGHT 0x0040 +#define wxTC_BOTTOM 0x0080 +#define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */ +#define wxTC_OWNERDRAW 0x0400 + +/* + * wxStatusBar95 flags + */ +#define wxST_SIZEGRIP 0x0010 + +/* + * wxStaticText flags + */ +#define wxST_NO_AUTORESIZE 0x0001 +#define wxST_DOTS_MIDDLE 0x0002 +#define wxST_DOTS_END 0x0004 + +/* + * wxStaticBitmap flags + */ +#define wxBI_EXPAND wxEXPAND + +/* + * wxStaticLine flags + */ +#define wxLI_HORIZONTAL wxHORIZONTAL +#define wxLI_VERTICAL wxVERTICAL + + +/* + * extended dialog specifiers. these values are stored in a different + * flag and thus do not overlap with other style flags. note that these + * values do not correspond to the return values of the dialogs (for + * those values, look at the wxID_XXX defines). + */ + +/* wxCENTRE already defined as 0x00000001 */ +#define wxYES 0x00000002 +#define wxOK 0x00000004 +#define wxNO 0x00000008 +#define wxYES_NO (wxYES | wxNO) +#define wxCANCEL 0x00000010 + +#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ +#define wxNO_DEFAULT 0x00000080 + +#define wxICON_EXCLAMATION 0x00000100 +#define wxICON_HAND 0x00000200 +#define wxICON_WARNING wxICON_EXCLAMATION +#define wxICON_ERROR wxICON_HAND +#define wxICON_QUESTION 0x00000400 +#define wxICON_INFORMATION 0x00000800 +#define wxICON_STOP wxICON_HAND +#define wxICON_ASTERISK wxICON_INFORMATION +#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) + +#define wxFORWARD 0x00001000 +#define wxBACKWARD 0x00002000 +#define wxRESET 0x00004000 +#define wxHELP 0x00008000 +#define wxMORE 0x00010000 +#define wxSETUP 0x00020000 + +/* + * Background styles. See wxWindow::SetBackgroundStyle + */ + +enum wxBackgroundStyle +{ + wxBG_STYLE_SYSTEM, + wxBG_STYLE_COLOUR, + wxBG_STYLE_CUSTOM +}; + +/* ---------------------------------------------------------------------------- */ +/* standard IDs */ +/* ---------------------------------------------------------------------------- */ + +/* Standard menu IDs */ +enum +{ + /* no id matches this one when compared to it */ + wxID_NONE = -3, + + /* id for a separator line in the menu (invalid for normal item) */ + wxID_SEPARATOR = -2, + + /* any id: means that we don't care about the id, whether when installing + * an event handler or when creating a new window */ + wxID_ANY = -1, + + + /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */ + wxID_LOWEST = 4999, + + wxID_OPEN, + wxID_CLOSE, + wxID_NEW, + wxID_SAVE, + wxID_SAVEAS, + wxID_REVERT, + wxID_EXIT, + wxID_UNDO, + wxID_REDO, + wxID_HELP, + wxID_PRINT, + wxID_PRINT_SETUP, + wxID_PAGE_SETUP, + wxID_PREVIEW, + wxID_ABOUT, + wxID_HELP_CONTENTS, + wxID_HELP_INDEX, + wxID_HELP_SEARCH, + wxID_HELP_COMMANDS, + wxID_HELP_PROCEDURES, + wxID_HELP_CONTEXT, + wxID_CLOSE_ALL, + wxID_PREFERENCES, + + wxID_EDIT = 5030, + wxID_CUT, + wxID_COPY, + wxID_PASTE, + wxID_CLEAR, + wxID_FIND, + wxID_DUPLICATE, + wxID_SELECTALL, + wxID_DELETE, + wxID_REPLACE, + wxID_REPLACE_ALL, + wxID_PROPERTIES, + + wxID_VIEW_DETAILS, + wxID_VIEW_LARGEICONS, + wxID_VIEW_SMALLICONS, + wxID_VIEW_LIST, + wxID_VIEW_SORTDATE, + wxID_VIEW_SORTNAME, + wxID_VIEW_SORTSIZE, + wxID_VIEW_SORTTYPE, + + wxID_FILE = 5050, + wxID_FILE1, + wxID_FILE2, + wxID_FILE3, + wxID_FILE4, + wxID_FILE5, + wxID_FILE6, + wxID_FILE7, + wxID_FILE8, + wxID_FILE9, + + /* Standard button and menu IDs */ + wxID_OK = 5100, + wxID_CANCEL, + wxID_APPLY, + wxID_YES, + wxID_NO, + wxID_STATIC, + wxID_FORWARD, + wxID_BACKWARD, + wxID_DEFAULT, + wxID_MORE, + wxID_SETUP, + wxID_RESET, + wxID_CONTEXT_HELP, + wxID_YESTOALL, + wxID_NOTOALL, + wxID_ABORT, + wxID_RETRY, + wxID_IGNORE, + wxID_ADD, + wxID_REMOVE, + + wxID_UP, + wxID_DOWN, + wxID_HOME, + wxID_REFRESH, + wxID_STOP, + wxID_INDEX, + + wxID_BOLD, + wxID_ITALIC, + wxID_JUSTIFY_CENTER, + wxID_JUSTIFY_FILL, + wxID_JUSTIFY_RIGHT, + wxID_JUSTIFY_LEFT, + wxID_UNDERLINE, + wxID_INDENT, + wxID_UNINDENT, + wxID_ZOOM_100, + wxID_ZOOM_FIT, + wxID_ZOOM_IN, + wxID_ZOOM_OUT, + wxID_UNDELETE, + wxID_REVERT_TO_SAVED, + + /* System menu IDs (used by wxUniv): */ + wxID_SYSTEM_MENU = 5200, + wxID_CLOSE_FRAME, + wxID_MOVE_FRAME, + wxID_RESIZE_FRAME, + wxID_MAXIMIZE_FRAME, + wxID_ICONIZE_FRAME, + wxID_RESTORE_FRAME, + + /* IDs used by generic file dialog (13 consecutive starting from this value) */ + wxID_FILEDLGG = 5900, + + wxID_HIGHEST = 5999 +}; + +/* ---------------------------------------------------------------------------- */ +/* other constants */ +/* ---------------------------------------------------------------------------- */ + +/* menu and toolbar item kinds */ +enum wxItemKind +{ + wxITEM_SEPARATOR = -1, + wxITEM_NORMAL, + wxITEM_CHECK, + wxITEM_RADIO, + wxITEM_MAX +}; + +/* hit test results */ +enum wxHitTest +{ + wxHT_NOWHERE, + + /* scrollbar */ + wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE, + wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */ + wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */ + wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */ + wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */ + wxHT_SCROLLBAR_THUMB, /* on the thumb */ + wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */ + wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */ + wxHT_SCROLLBAR_LAST, + + /* window */ + wxHT_WINDOW_OUTSIDE, /* not in this window at all */ + wxHT_WINDOW_INSIDE, /* in the client area */ + wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */ + wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */ + wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */ + + wxHT_MAX +}; + +/* ---------------------------------------------------------------------------- */ +/* Possible SetSize flags */ +/* ---------------------------------------------------------------------------- */ + +/* Use internally-calculated width if -1 */ +#define wxSIZE_AUTO_WIDTH 0x0001 +/* Use internally-calculated height if -1 */ +#define wxSIZE_AUTO_HEIGHT 0x0002 +/* Use internally-calculated width and height if each is -1 */ +#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT) +/* Ignore missing (-1) dimensions (use existing). */ +/* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */ +#define wxSIZE_USE_EXISTING 0x0000 +/* Allow -1 as a valid position */ +#define wxSIZE_ALLOW_MINUS_ONE 0x0004 +/* Don't do parent client adjustments (for implementation only) */ +#define wxSIZE_NO_ADJUSTMENTS 0x0008 +/* Change the window position even if it seems to be already correct */ +#define wxSIZE_FORCE 0x0010 + +/* ---------------------------------------------------------------------------- */ +/* GDI descriptions */ +/* ---------------------------------------------------------------------------- */ + +enum +{ + /* Text font families */ + wxDEFAULT = 70, + wxDECORATIVE, + wxROMAN, + wxSCRIPT, + wxSWISS, + wxMODERN, + wxTELETYPE, /* @@@@ */ + + /* Proportional or Fixed width fonts (not yet used) */ + wxVARIABLE = 80, + wxFIXED, + + wxNORMAL = 90, + wxLIGHT, + wxBOLD, + /* Also wxNORMAL for normal (non-italic text) */ + wxITALIC, + wxSLANT, + + /* Pen styles */ + wxSOLID = 100, + wxDOT, + wxLONG_DASH, + wxSHORT_DASH, + wxDOT_DASH, + wxUSER_DASH, + + wxTRANSPARENT, + + /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ + /* Note also that stippling a Pen IS meaningfull, because a Line is */ + wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ + wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ + /* drawn with a Pen, and without any Brush -- and it can be stippled. */ + wxSTIPPLE = 110, + + wxBDIAGONAL_HATCH, /* In wxWidgets < 2.6 use WX_HATCH macro */ + wxCROSSDIAG_HATCH, /* to verify these wx*_HATCH are in style */ + wxFDIAGONAL_HATCH, /* of wxBrush. In wxWidgets >= 2.6 use */ + wxCROSS_HATCH, /* wxBrush::IsHatch() instead. */ + wxHORIZONTAL_HATCH, + wxVERTICAL_HATCH, + wxFIRST_HATCH = wxBDIAGONAL_HATCH, + wxLAST_HATCH = wxVERTICAL_HATCH, + + wxJOIN_BEVEL = 120, + wxJOIN_MITER, + wxJOIN_ROUND, + + wxCAP_ROUND = 130, + wxCAP_PROJECTING, + wxCAP_BUTT +}; + +#if WXWIN_COMPATIBILITY_2_4 + #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) +#else + /* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */ +#endif + +/* Logical ops */ +typedef enum +{ + wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, /* 0 */ + wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, /* src XOR dst */ + wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, /* NOT dst */ + wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, /* src OR (NOT dst) */ + wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, /* src AND (NOT dst) */ + wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, /* src */ + wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, /* src AND dst */ + wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, /* (NOT src) AND dst */ + wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, /* dst */ + wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, /* (NOT src) AND (NOT dst) */ + wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, /* (NOT src) XOR dst */ + wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, /* (NOT src) */ + wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, /* (NOT src) OR dst */ + wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, /* (NOT src) OR (NOT dst) */ + wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, /* src OR dst */ + wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET /* 1 */ +} form_ops_t; + +/* Flood styles */ +enum +{ + wxFLOOD_SURFACE = 1, + wxFLOOD_BORDER +}; + +/* Polygon filling mode */ +enum +{ + wxODDEVEN_RULE = 1, + wxWINDING_RULE +}; + +/* ToolPanel in wxFrame (VZ: unused?) */ +enum +{ + wxTOOL_TOP = 1, + wxTOOL_BOTTOM, + wxTOOL_LEFT, + wxTOOL_RIGHT +}; + +/* the values of the format constants should be the same as corresponding */ +/* CF_XXX constants in Windows API */ +enum wxDataFormatId +{ + wxDF_INVALID = 0, + wxDF_TEXT = 1, /* CF_TEXT */ + wxDF_BITMAP = 2, /* CF_BITMAP */ + wxDF_METAFILE = 3, /* CF_METAFILEPICT */ + wxDF_SYLK = 4, + wxDF_DIF = 5, + wxDF_TIFF = 6, + wxDF_OEMTEXT = 7, /* CF_OEMTEXT */ + wxDF_DIB = 8, /* CF_DIB */ + wxDF_PALETTE = 9, + wxDF_PENDATA = 10, + wxDF_RIFF = 11, + wxDF_WAVE = 12, + wxDF_UNICODETEXT = 13, + wxDF_ENHMETAFILE = 14, + wxDF_FILENAME = 15, /* CF_HDROP */ + wxDF_LOCALE = 16, + wxDF_PRIVATE = 20, + wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */ + wxDF_MAX +}; + +/* Virtual keycodes */ +enum wxKeyCode +{ + WXK_BACK = 8, + WXK_TAB = 9, + WXK_RETURN = 13, + WXK_ESCAPE = 27, + WXK_SPACE = 32, + WXK_DELETE = 127, + + /* These are, by design, not compatible with unicode characters. + If you want to get a unicode character from a key event, use + wxKeyEvent::GetUnicodeKey instead. */ + WXK_START = 300, + WXK_LBUTTON, + WXK_RBUTTON, + WXK_CANCEL, + WXK_MBUTTON, + WXK_CLEAR, + WXK_SHIFT, + WXK_ALT, + WXK_CONTROL, + WXK_MENU, + WXK_PAUSE, + WXK_CAPITAL, + WXK_END, + WXK_HOME, + WXK_LEFT, + WXK_UP, + WXK_RIGHT, + WXK_DOWN, + WXK_SELECT, + WXK_PRINT, + WXK_EXECUTE, + WXK_SNAPSHOT, + WXK_INSERT, + WXK_HELP, + WXK_NUMPAD0, + WXK_NUMPAD1, + WXK_NUMPAD2, + WXK_NUMPAD3, + WXK_NUMPAD4, + WXK_NUMPAD5, + WXK_NUMPAD6, + WXK_NUMPAD7, + WXK_NUMPAD8, + WXK_NUMPAD9, + WXK_MULTIPLY, + WXK_ADD, + WXK_SEPARATOR, + WXK_SUBTRACT, + WXK_DECIMAL, + WXK_DIVIDE, + WXK_F1, + WXK_F2, + WXK_F3, + WXK_F4, + WXK_F5, + WXK_F6, + WXK_F7, + WXK_F8, + WXK_F9, + WXK_F10, + WXK_F11, + WXK_F12, + WXK_F13, + WXK_F14, + WXK_F15, + WXK_F16, + WXK_F17, + WXK_F18, + WXK_F19, + WXK_F20, + WXK_F21, + WXK_F22, + WXK_F23, + WXK_F24, + WXK_NUMLOCK, + WXK_SCROLL, + WXK_PAGEUP, + WXK_PAGEDOWN, +#if WXWIN_COMPATIBILITY_2_6 + WXK_PRIOR = WXK_PAGEUP, + WXK_NEXT = WXK_PAGEDOWN, +#endif + + WXK_NUMPAD_SPACE, + WXK_NUMPAD_TAB, + WXK_NUMPAD_ENTER, + WXK_NUMPAD_F1, + WXK_NUMPAD_F2, + WXK_NUMPAD_F3, + WXK_NUMPAD_F4, + WXK_NUMPAD_HOME, + WXK_NUMPAD_LEFT, + WXK_NUMPAD_UP, + WXK_NUMPAD_RIGHT, + WXK_NUMPAD_DOWN, + WXK_NUMPAD_PAGEUP, + WXK_NUMPAD_PAGEDOWN, +#if WXWIN_COMPATIBILITY_2_6 + WXK_NUMPAD_PRIOR = WXK_NUMPAD_PAGEUP, + WXK_NUMPAD_NEXT = WXK_NUMPAD_PAGEDOWN, +#endif + WXK_NUMPAD_END, + WXK_NUMPAD_BEGIN, + WXK_NUMPAD_INSERT, + WXK_NUMPAD_DELETE, + WXK_NUMPAD_EQUAL, + WXK_NUMPAD_MULTIPLY, + WXK_NUMPAD_ADD, + WXK_NUMPAD_SEPARATOR, + WXK_NUMPAD_SUBTRACT, + WXK_NUMPAD_DECIMAL, + WXK_NUMPAD_DIVIDE, + + WXK_WINDOWS_LEFT, + WXK_WINDOWS_RIGHT, + WXK_WINDOWS_MENU , + WXK_COMMAND, + + /* Hardware-specific buttons */ + WXK_SPECIAL1 = 193, + WXK_SPECIAL2, + WXK_SPECIAL3, + WXK_SPECIAL4, + WXK_SPECIAL5, + WXK_SPECIAL6, + WXK_SPECIAL7, + WXK_SPECIAL8, + WXK_SPECIAL9, + WXK_SPECIAL10, + WXK_SPECIAL11, + WXK_SPECIAL12, + WXK_SPECIAL13, + WXK_SPECIAL14, + WXK_SPECIAL15, + WXK_SPECIAL16, + WXK_SPECIAL17, + WXK_SPECIAL18, + WXK_SPECIAL19, + WXK_SPECIAL20 +}; + +/* This enum contains bit mask constants used in wxKeyEvent */ +enum wxKeyModifier +{ + wxMOD_NONE = 0x0000, + wxMOD_ALT = 0x0001, + wxMOD_CONTROL = 0x0002, + wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL, + wxMOD_SHIFT = 0x0004, + wxMOD_META = 0x0008, + wxMOD_WIN = wxMOD_META, +#if defined(__WXMAC__) || defined(__WXCOCOA__) + wxMOD_CMD = wxMOD_META, +#else + wxMOD_CMD = wxMOD_CONTROL, +#endif + wxMOD_ALL = 0xffff +}; + +/* Mapping modes (same values as used by Windows, don't change) */ +enum +{ + wxMM_TEXT = 1, + wxMM_LOMETRIC, + wxMM_HIMETRIC, + wxMM_LOENGLISH, + wxMM_HIENGLISH, + wxMM_TWIPS, + wxMM_ISOTROPIC, + wxMM_ANISOTROPIC, + wxMM_POINTS, + wxMM_METRIC +}; + +/* Shortcut for easier dialog-unit-to-pixel conversion */ +#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) + +/* Paper types */ +typedef enum +{ + wxPAPER_NONE, /* Use specific dimensions */ + wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */ + wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */ + wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */ + wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */ + wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */ + wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */ + wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */ + wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */ + wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */ + wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */ + wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */ + wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */ + wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */ + wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */ + wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */ + wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */ + wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */ + wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */ + wxPAPER_10X14, /* 10-by-14-inch sheet */ + wxPAPER_11X17, /* 11-by-17-inch sheet */ + wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */ + wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */ + wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */ + wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */ + wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */ + wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */ + wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */ + wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */ + wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */ + wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */ + wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */ + wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */ + wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */ + wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */ + wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */ + wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */ + wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */ + wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */ + wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */ + wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */ + wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */ + + wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */ + wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */ + wxPAPER_9X11, /* 9 x 11 in */ + wxPAPER_10X11, /* 10 x 11 in */ + wxPAPER_15X11, /* 15 x 11 in */ + wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */ + wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */ + wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */ + wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */ + wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */ + wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */ + wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */ + wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */ + wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */ + wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */ + wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */ + wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */ + wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */ + wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */ + wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */ + wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */ + wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */ + wxPAPER_A2, /* A2 420 x 594 mm */ + wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */ + wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */ + + wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */ + wxPAPER_A6, /* A6 105 x 148 mm */ + wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */ + wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */ + wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */ + wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */ + wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */ + wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */ + wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */ + wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */ + wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */ + wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */ + wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */ + wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */ + wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */ + wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */ + wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */ + wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */ + wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */ + wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */ + wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */ + wxPAPER_12X11, /* 12 x 11 in */ + wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */ + wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */ + wxPAPER_P16K, /* PRC 16K 146 x 215 mm */ + wxPAPER_P32K, /* PRC 32K 97 x 151 mm */ + wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */ + wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */ + wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */ + wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */ + wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */ + wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */ + wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */ + wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */ + wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */ + wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */ + wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */ + wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */ + wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */ + wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */ + wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */ + wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */ + wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */ + wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */ + wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */ + wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */ + wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */ + wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */ + wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */ + wxPAPER_PENV_10_ROTATED /* PRC Envelope #10 Rotated 458 x 324 m */ +} wxPaperSize; + +/* Printing orientation */ +#ifndef wxPORTRAIT +#define wxPORTRAIT 1 +#define wxLANDSCAPE 2 +#endif + +/* Duplex printing modes + */ + +enum wxDuplexMode +{ + wxDUPLEX_SIMPLEX, /* Non-duplex */ + wxDUPLEX_HORIZONTAL, + wxDUPLEX_VERTICAL +}; + +/* Print quality. + */ + +#define wxPRINT_QUALITY_HIGH -1 +#define wxPRINT_QUALITY_MEDIUM -2 +#define wxPRINT_QUALITY_LOW -3 +#define wxPRINT_QUALITY_DRAFT -4 + +typedef int wxPrintQuality; + +/* Print mode (currently PostScript only) + */ + +enum wxPrintMode +{ + wxPRINT_MODE_NONE = 0, + wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */ + wxPRINT_MODE_FILE = 2, /* Print to file */ + wxPRINT_MODE_PRINTER = 3, /* Send to printer */ + wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */ +}; + +/* ---------------------------------------------------------------------------- */ +/* UpdateWindowUI flags */ +/* ---------------------------------------------------------------------------- */ + +enum wxUpdateUI +{ + wxUPDATE_UI_NONE = 0x0000, + wxUPDATE_UI_RECURSE = 0x0001, + wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */ +}; + +/* ---------------------------------------------------------------------------- */ +/* Notification Event flags - used for dock icon bouncing, etc. */ +/* ---------------------------------------------------------------------------- */ + +enum wxNotificationOptions +{ + wxNOTIFY_NONE = 0x0000, + wxNOTIFY_ONCE = 0x0001, + wxNOTIFY_REPEAT = 0x0002 +}; + +/* ---------------------------------------------------------------------------- */ +/* miscellaneous */ +/* ---------------------------------------------------------------------------- */ + +/* define this macro if font handling is done using the X font names */ +#if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__) + #define _WX_X_FONTLIKE +#endif + +/* macro to specify "All Files" on different platforms */ +#if defined(__WXMSW__) || defined(__WXPM__) +# define wxALL_FILES_PATTERN wxT("*.*") +# define wxALL_FILES gettext_noop("All files (*.*)|*.*") +#else +# define wxALL_FILES_PATTERN wxT("*") +# define wxALL_FILES gettext_noop("All files (*)|*") +#endif + +#if defined(__CYGWIN__) && defined(__WXMSW__) +# if wxUSE_STL || defined(wxUSE_STD_STRING) + /* + NASTY HACK because the gethostname in sys/unistd.h which the gnu + stl includes and wx builds with by default clash with each other + (windows version 2nd param is int, sys/unistd.h version is unsigned + int). + */ +# define gethostname gethostnameHACK +# include +# undef gethostname +# endif +#endif + +/* --------------------------------------------------------------------------- */ +/* macros that enable wxWidgets apps to be compiled in absence of the */ +/* sytem headers, although some platform specific types are used in the */ +/* platform specific (implementation) parts of the headers */ +/* --------------------------------------------------------------------------- */ + +#ifdef __WXMAC__ + +#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name + +typedef unsigned char WXCOLORREF[6]; +typedef void* WXCGIMAGEREF; +typedef void* WXHBITMAP; +typedef void* WXHCURSOR; +typedef void* WXHRGN; +typedef void* WXRECTPTR; +typedef void* WXPOINTPTR; +typedef void* WXHWND; +typedef void* WXEVENTREF; +typedef void* WXEVENTHANDLERREF; +typedef void* WXEVENTHANDLERCALLREF; +typedef void* WXAPPLEEVENTREF; +typedef void* WXHDC; +typedef void* WXHMENU; +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef WX_OPAQUE_TYPE(CIconHandle ) * WXHICON ; +typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; + + +/* typedef void* WXWidget; */ +/* typedef void* WXWindow; */ +typedef WX_OPAQUE_TYPE(ControlRef ) * WXWidget ; +typedef WX_OPAQUE_TYPE(WindowRef) * WXWindow ; +typedef void* WXDisplay; + +/* typedef WindowPtr WXHWND; */ +/* typedef Handle WXHANDLE; */ +/* typedef CIconHandle WXHICON; */ +/* typedef unsigned long WXHFONT; */ +/* typedef MenuHandle WXHMENU; */ +/* typedef unsigned long WXHPEN; */ +/* typedef unsigned long WXHBRUSH; */ +/* typedef unsigned long WXHPALETTE; */ +/* typedef CursHandle WXHCURSOR; */ +/* typedef RgnHandle WXHRGN; */ +/* typedef unsigned long WXHACCEL; */ +/* typedef unsigned long WXHINSTANCE; */ +/* typedef unsigned long WXHIMAGELIST; */ +/* typedef unsigned long WXHGLOBAL; */ +/* typedef GrafPtr WXHDC; */ +/* typedef unsigned int WXWPARAM; */ +/* typedef long WXLPARAM; */ +/* typedef void * WXRGNDATA; */ +/* typedef void * WXMSG; */ +/* typedef unsigned long WXHCONV; */ +/* typedef unsigned long WXHKEY; */ +/* typedef void * WXDRAWITEMSTRUCT; */ +/* typedef void * WXMEASUREITEMSTRUCT; */ +/* typedef void * WXLPCREATESTRUCT; */ +/* typedef int (*WXFARPROC)(); */ + +/* typedef WindowPtr WXWindow; */ +/* typedef ControlHandle WXWidget; */ + +#endif + +#if defined( __WXCOCOA__ ) || ( defined(__WXMAC__) && defined(__DARWIN__) ) + +/* Definitions of 32-bit/64-bit types + * These are typedef'd exactly the same way in newer OS X headers so + * redefinition when real headers are included should not be a problem. If + * it is, the types are being defined wrongly here. + * The purpose of these types is so they can be used from public wx headers. + * and also because the older (pre-Leopard) headers don't define them. + */ + +/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros + * since they are unlikely to be needed in a public header. + */ +#if defined(__LP64__) && __LP64__ + typedef double CGFloat; +#else + typedef float CGFloat; +#endif + +#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64) +typedef long NSInteger; +typedef unsigned long NSUInteger; +#else +typedef int NSInteger; +typedef unsigned int NSUInteger; +#endif + +/* Objective-C type declarations. + * These are to be used in public headers in lieu of NSSomething* because + * Objective-C class names are not available in C/C++ code. + */ + +/* NOTE: This ought to work with other compilers too, but I'm being cautious */ +#if (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) +/* It's desirable to have type safety for Objective-C(++) code as it does +at least catch typos of method names among other things. However, it +is not possible to declare an Objective-C class from plain old C or C++ +code. Furthermore, because of C++ name mangling, the type name must +be the same for both C++ and Objective-C++ code. Therefore, we define +what should be a pointer to an Objective-C class as a pointer to a plain +old C struct with the same name. Unfortunately, because the compiler +does not see a struct as an Objective-C class we cannot declare it +as a struct in Objective-C(++) mode. +*/ +#if defined(__OBJC__) +#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ +@class klass; \ +typedef klass *WX_##klass +#else /* not defined(__OBJC__) */ +#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ +typedef struct klass *WX_##klass +#endif /* defined(__OBJC__) */ + +#else /* not Apple's GNU or CodeWarrior */ +#warning "Objective-C types will not be checked by the compiler." +/* NOTE: typedef struct objc_object *id; */ +/* IOW, we're declaring these using the id type without using that name, */ +/* since "id" is used extensively not only within wxWidgets itself, but */ +/* also in wxWidgets application code. The following works fine when */ +/* compiling C(++) code, and works without typesafety for Obj-C(++) code */ +#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ +typedef struct objc_object *WX_##klass + +#endif /* (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) */ + +DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); +DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); +DECLARE_WXCOCOA_OBJC_CLASS(NSBox); +DECLARE_WXCOCOA_OBJC_CLASS(NSButton); +DECLARE_WXCOCOA_OBJC_CLASS(NSColor); +DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); +DECLARE_WXCOCOA_OBJC_CLASS(NSControl); +DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); +DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); +DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); +DECLARE_WXCOCOA_OBJC_CLASS(NSImage); +DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); +DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); +DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); +DECLARE_WXCOCOA_OBJC_CLASS(NSObject); +DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); +DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView); +DECLARE_WXCOCOA_OBJC_CLASS(NSSound); +DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem); +DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn); +DECLARE_WXCOCOA_OBJC_CLASS(NSTableView); +DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer); +DECLARE_WXCOCOA_OBJC_CLASS(NSTextField); +DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); +DECLARE_WXCOCOA_OBJC_CLASS(NSThread); +DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); +DECLARE_WXCOCOA_OBJC_CLASS(NSView); +#ifdef __WXMAC__ +// things added for __WXMAC__ +DECLARE_WXCOCOA_OBJC_CLASS(NSString); +#else +// things only for __WXCOCOA__ +typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ +#endif +#endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/ + +#if defined(__WXPALMOS__) + +typedef void * WXHWND; +typedef void * WXHANDLE; +typedef void * WXHICON; +typedef void * WXHFONT; +typedef void * WXHMENU; +typedef void * WXHPEN; +typedef void * WXHBRUSH; +typedef void * WXHPALETTE; +typedef void * WXHCURSOR; +typedef void * WXHRGN; +typedef void * WXHACCEL; +typedef void * WXHINSTANCE; +typedef void * WXHBITMAP; +typedef void * WXHIMAGELIST; +typedef void * WXHGLOBAL; +typedef void * WXHDC; +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef unsigned long WXCOLORREF; +typedef struct tagMSG WXMSG; + +typedef WXHWND WXWINHANDLE; /* WinHandle of PalmOS */ +typedef WXWINHANDLE WXWidget; + +typedef void * WXFORMPTR; +typedef void * WXEVENTPTR; +typedef void * WXRECTANGLEPTR; + +#endif /* __WXPALMOS__ */ + + +/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ +#if defined(__WIN32__) + +/* the keywords needed for WinMain() declaration */ +#ifndef WXFAR +# define WXFAR +#endif + +/* Stand-ins for Windows types to avoid #including all of windows.h */ +typedef void * WXHWND; +typedef void * WXHANDLE; +typedef void * WXHICON; +typedef void * WXHFONT; +typedef void * WXHMENU; +typedef void * WXHPEN; +typedef void * WXHBRUSH; +typedef void * WXHPALETTE; +typedef void * WXHCURSOR; +typedef void * WXHRGN; +typedef void * WXRECTPTR; +typedef void * WXHACCEL; +typedef void WXFAR * WXHINSTANCE; +typedef void * WXHBITMAP; +typedef void * WXHIMAGELIST; +typedef void * WXHGLOBAL; +typedef void * WXHDC; +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef unsigned long WXCOLORREF; +typedef void * WXRGNDATA; +typedef struct tagMSG WXMSG; +typedef void * WXHCONV; +typedef void * WXHKEY; +typedef void * WXHTREEITEM; + +typedef void * WXDRAWITEMSTRUCT; +typedef void * WXMEASUREITEMSTRUCT; +typedef void * WXLPCREATESTRUCT; + +typedef WXHWND WXWidget; + +#ifdef __WIN64__ +typedef unsigned __int64 WXWPARAM; +typedef __int64 WXLPARAM; +typedef __int64 WXLRESULT; +#else +typedef unsigned int WXWPARAM; +typedef long WXLPARAM; +typedef long WXLRESULT; +#endif + +#if defined(__GNUWIN32__) || defined(__WXMICROWIN__) +typedef int (*WXFARPROC)(); +#else +typedef int (__stdcall *WXFARPROC)(); +#endif +#endif /* __WIN32__ */ + + +#if defined(__OS2__) +typedef unsigned long DWORD; +typedef unsigned short WORD; +#endif + +#if defined(__WXPM__) || defined(__EMX__) +#ifdef __WXPM__ +/* Stand-ins for OS/2 types, to avoid #including all of os2.h */ +typedef unsigned long WXHWND; +typedef unsigned long WXHANDLE; +typedef unsigned long WXHICON; +typedef unsigned long WXHFONT; +typedef unsigned long WXHMENU; +typedef unsigned long WXHPEN; +typedef unsigned long WXHBRUSH; +typedef unsigned long WXHPALETTE; +typedef unsigned long WXHCURSOR; +typedef unsigned long WXHRGN; +typedef unsigned long WXHACCEL; +typedef unsigned long WXHBITMAP; +typedef unsigned long WXHDC; +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef unsigned long WXCOLORREF; +typedef void * WXMSG; +typedef unsigned long WXHTREEITEM; + +typedef void * WXDRAWITEMSTRUCT; +typedef void * WXMEASUREITEMSTRUCT; +typedef void * WXLPCREATESTRUCT; + +typedef WXHWND WXWidget; +#endif +#ifdef __EMX__ +/* Need a well-known type for WXFARPROC + below. MPARAM is typedef'ed too late. */ +#define WXWPARAM void * +#define WXLPARAM void * +#else +#define WXWPARAM MPARAM +#define WXLPARAM MPARAM +#endif +#define RECT RECTL +#define LOGFONT FATTRS +#define LOWORD SHORT1FROMMP +#define HIWORD SHORT2FROMMP + +typedef unsigned long WXMPARAM; +typedef unsigned long WXMSGID; +typedef void* WXRESULT; +/* typedef int (*WXFARPROC)(); */ +/* some windows handles not defined by PM */ +typedef unsigned long HANDLE; +typedef unsigned long HICON; +typedef unsigned long HFONT; +typedef unsigned long HMENU; +typedef unsigned long HPEN; +typedef unsigned long HBRUSH; +typedef unsigned long HPALETTE; +typedef unsigned long HCURSOR; +typedef unsigned long HINSTANCE; +typedef unsigned long HIMAGELIST; +typedef unsigned long HGLOBAL; +#endif /* WXPM || EMX */ + +#if defined (__WXPM__) +/* WIN32 graphics types for OS/2 GPI */ + +/* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */ +#define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16)) + +typedef unsigned long COLORREF; +#define GetRValue(rgb) ((unsigned char)((rgb) >> 16)) +#define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8)) +#define GetBValue(rgb) ((unsigned char)(rgb)) +#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) +#define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b)) +/* OS2's RGB/RGB2 is backwards from this */ +typedef struct tagPALETTEENTRY +{ + char bRed; + char bGreen; + char bBlue; + char bFlags; +} PALETTEENTRY; +typedef struct tagLOGPALETTE +{ + WORD palVersion; + WORD palNumentries; + WORD PALETTEENTRY[1]; +} LOGPALETTE; + +#if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__) + /* VA 3.0 for some reason needs base data types when typedefing a proc proto??? */ +typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*); +#else +#if defined(__EMX__) && !defined(_System) +#define _System +#endif +typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM); +#endif + +#endif /* __WXPM__ */ + + +#if defined(__WXMOTIF__) || defined(__WXX11__) +/* Stand-ins for X/Xt/Motif types */ +typedef void* WXWindow; +typedef void* WXWidget; +typedef void* WXAppContext; +typedef void* WXColormap; +typedef void* WXColor; +typedef void WXDisplay; +typedef void WXEvent; +typedef void* WXCursor; +typedef void* WXPixmap; +typedef void* WXFontStructPtr; +typedef void* WXGC; +typedef void* WXRegion; +typedef void* WXFont; +typedef void* WXImage; +typedef void* WXFontList; +typedef void* WXFontSet; +typedef void* WXRendition; +typedef void* WXRenderTable; +typedef void* WXFontType; /* either a XmFontList or XmRenderTable */ +typedef void* WXString; + +typedef unsigned long Atom; /* this might fail on a few architectures */ +typedef long WXPixel; /* safety catch in src/motif/colour.cpp */ + +#endif /* Motif */ + +#ifdef __WXGTK__ + +/* Stand-ins for GLIB types */ +typedef char gchar; +typedef signed char gint8; +typedef int gint; +typedef unsigned guint; +typedef unsigned long gulong; +typedef void* gpointer; +typedef struct _GSList GSList; + +/* Stand-ins for GDK types */ +typedef struct _GdkColor GdkColor; +typedef struct _GdkColormap GdkColormap; +typedef struct _GdkFont GdkFont; +typedef struct _GdkGC GdkGC; +typedef struct _GdkVisual GdkVisual; + +#ifdef __WXGTK20__ +typedef struct _GdkAtom *GdkAtom; +typedef struct _GdkDrawable GdkWindow; +typedef struct _GdkDrawable GdkBitmap; +typedef struct _GdkDrawable GdkPixmap; +#else /* GTK+ 1.2 */ +typedef gulong GdkAtom; +typedef struct _GdkWindow GdkWindow; +typedef struct _GdkWindow GdkBitmap; +typedef struct _GdkWindow GdkPixmap; +#endif /* GTK+ 1.2/2.0 */ + +typedef struct _GdkCursor GdkCursor; +typedef struct _GdkRegion GdkRegion; +typedef struct _GdkDragContext GdkDragContext; + +#ifdef HAVE_XIM +typedef struct _GdkIC GdkIC; +typedef struct _GdkICAttr GdkICAttr; +#endif + +/* Stand-ins for GTK types */ +typedef struct _GtkWidget GtkWidget; +typedef struct _GtkRcStyle GtkRcStyle; +typedef struct _GtkAdjustment GtkAdjustment; +typedef struct _GtkList GtkList; +typedef struct _GtkToolbar GtkToolbar; +typedef struct _GtkTooltips GtkTooltips; +typedef struct _GtkNotebook GtkNotebook; +typedef struct _GtkNotebookPage GtkNotebookPage; +typedef struct _GtkAccelGroup GtkAccelGroup; +typedef struct _GtkItemFactory GtkItemFactory; +typedef struct _GtkSelectionData GtkSelectionData; +typedef struct _GtkTextBuffer GtkTextBuffer; +typedef struct _GtkRange GtkRange; + +typedef GtkWidget *WXWidget; + +#ifndef __WXGTK20__ +#define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass) +#define GTK_CLASS_TYPE(klass) ((klass)->type) +#endif + +#endif /* __WXGTK__ */ + +#if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE) +#define wxUSE_PANGO 1 +#else +#define wxUSE_PANGO 0 +#endif + +#if wxUSE_PANGO +/* Stand-ins for Pango types */ +typedef struct _PangoContext PangoContext; +typedef struct _PangoLayout PangoLayout; +typedef struct _PangoFontDescription PangoFontDescription; +#endif + +#ifdef __WXMGL__ +typedef struct window_t *WXWidget; +#endif /* MGL */ + +#ifdef __WXDFB__ +/* DirectFB doesn't have the concept of non-TLW window, so use + something arbitrary */ +typedef const void* WXWidget; +#endif /* DFB */ + +/* This is required because of clashing macros in windows.h, which may be */ +/* included before or after wxWidgets classes, and therefore must be */ +/* disabled here before any significant wxWidgets headers are included. */ +#ifdef __WXMSW__ +#include "wx/msw/winundef.h" +#endif /* __WXMSW__ */ + +/* --------------------------------------------------------------------------- */ +/* macro to define a class without copy ctor nor assignment operator */ +/* --------------------------------------------------------------------------- */ + +#define DECLARE_NO_COPY_CLASS(classname) \ + private: \ + classname(const classname&); \ + classname& operator=(const classname&); + +#define DECLARE_NO_ASSIGN_CLASS(classname) \ + private: \ + classname& operator=(const classname&); + +/* --------------------------------------------------------------------------- */ +/* If a manifest is being automatically generated, add common controls 6 to it */ +/* --------------------------------------------------------------------------- */ + +#if (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \ + ( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 ) + +#define WX_CC_MANIFEST(cpu) \ + "/manifestdependency:\"type='win32' \ + name='Microsoft.Windows.Common-Controls' \ + version='6.0.0.0' \ + processorArchitecture='"cpu"' \ + publicKeyToken='6595b64144ccf1df' \ + language='*'\"" + +#if defined _M_IX86 + #pragma comment(linker, WX_CC_MANIFEST("x86")) +#elif defined _M_X64 + #pragma comment(linker, WX_CC_MANIFEST("amd64")) +#elif defined _M_IA64 + #pragma comment(linker, WX_CC_MANIFEST("ia64")) +#else + #pragma comment(linker, WX_CC_MANIFEST("*")) +#endif + +#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */ + +#endif + /* _WX_DEFS_H_ */ diff --git a/Externals/wxWidgets/include/wx/dialog.h b/Externals/wxWidgets/include/wx/dialog.h index cf9dbf6c97..ffb69db186 100644 --- a/Externals/wxWidgets/include/wx/dialog.h +++ b/Externals/wxWidgets/include/wx/dialog.h @@ -1,167 +1,167 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dialog.h -// Purpose: wxDialogBase class -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.06.99 -// RCS-ID: $Id: dialog.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIALOG_H_BASE_ -#define _WX_DIALOG_H_BASE_ - -#include "wx/defs.h" -#include "wx/containr.h" -#include "wx/toplevel.h" - -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer; - -#define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window - -#ifdef __WXWINCE__ -#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER) -#else -#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) -#endif - -extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; - -class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow -{ -public: - enum - { - // all flags allowed in wxDialogBase::CreateButtonSizer() - ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT - }; - - wxDialogBase() { Init(); } - virtual ~wxDialogBase() { } - - // define public wxDialog methods to be implemented by the derived classes - virtual int ShowModal() = 0; - virtual void EndModal(int retCode) = 0; - virtual bool IsModal() const = 0; - - - // Modal dialogs have a return code - usually the id of the last - // pressed button - void SetReturnCode(int returnCode) { m_returnCode = returnCode; } - int GetReturnCode() const { return m_returnCode; } - - // Set the identifier for the affirmative button: this button will close - // the dialog after validating data and calling TransferDataFromWindow() - void SetAffirmativeId(int affirmativeId); - int GetAffirmativeId() const { return m_affirmativeId; } - - // Set identifier for Esc key translation: the button with this id will - // close the dialog without doing anything else; special value wxID_NONE - // means to not handle Esc at all while wxID_ANY means to map Esc to - // wxID_CANCEL if present and GetAffirmativeId() otherwise - void SetEscapeId(int escapeId); - int GetEscapeId() const { return m_escapeId; } - -#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL - // splits text up at newlines and places the - // lines into a vertical wxBoxSizer - wxSizer *CreateTextSizer( const wxString &message ); -#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL - - // returns a horizontal wxBoxSizer containing the given buttons - // - // notice that the returned sizer can be NULL if no buttons are put in the - // sizer (this mostly happens under smart phones and other atypical - // platforms which have hardware buttons replacing OK/Cancel and such) - wxSizer *CreateButtonSizer(long flags); - - // returns the sizer containing CreateButtonSizer() below a separating - // static line for the platforms which use static lines for items - // separation (i.e. not Mac) - wxSizer *CreateSeparatedButtonSizer(long flags); - -#if wxUSE_BUTTON - wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags ); -#endif // wxUSE_BUTTON - -protected: - // emulate click of a button with the given id if it's present in the dialog - // - // return true if button was "clicked" or false if we don't have it - bool EmulateButtonClickIfPresent(int id); - - // this function is used by OnCharHook() to decide whether the given key - // should close the dialog - // - // for most platforms the default implementation (which just checks for - // Esc) is sufficient, but Mac port also adds Cmd-. here and other ports - // could do something different if needed - virtual bool IsEscapeKey(const wxKeyEvent& event); - - // end either modal or modeless dialog, for the modal dialog rc is used as - // the dialog return code - void EndDialog(int rc); - - // call Validate() and TransferDataFromWindow() and close dialog with - // wxID_OK return code - void AcceptAndClose(); - - - // The return code from modal dialog - int m_returnCode; - - // The identifier for the affirmative button (usually wxID_OK) - int m_affirmativeId; - - // The identifier for cancel button (usually wxID_CANCEL) - int m_escapeId; - -private: - // common part of all ctors - void Init(); - - // handle Esc key presses - void OnCharHook(wxKeyEvent& event); - - // handle closing the dialog window - void OnCloseWindow(wxCloseEvent& event); - - // handle the standard buttons - void OnButton(wxCommandEvent& event); - - // update the background colour - void OnSysColourChanged(wxSysColourChangedEvent& event); - - - DECLARE_NO_COPY_CLASS(wxDialogBase) - DECLARE_EVENT_TABLE() - WX_DECLARE_CONTROL_CONTAINER(); -}; - - -#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) - #include "wx/univ/dialog.h" -#else - #if defined(__WXPALMOS__) - #include "wx/palmos/dialog.h" - #elif defined(__WXMSW__) - #include "wx/msw/dialog.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/dialog.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/dialog.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/dialog.h" - #elif defined(__WXMAC__) - #include "wx/mac/dialog.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/dialog.h" - #elif defined(__WXPM__) - #include "wx/os2/dialog.h" - #endif -#endif - -#endif - // _WX_DIALOG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dialog.h +// Purpose: wxDialogBase class +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.06.99 +// RCS-ID: $Id: dialog.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_BASE_ +#define _WX_DIALOG_H_BASE_ + +#include "wx/defs.h" +#include "wx/containr.h" +#include "wx/toplevel.h" + +class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer; + +#define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window + +#ifdef __WXWINCE__ +#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER) +#else +#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) +#endif + +extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; + +class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow +{ +public: + enum + { + // all flags allowed in wxDialogBase::CreateButtonSizer() + ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT + }; + + wxDialogBase() { Init(); } + virtual ~wxDialogBase() { } + + // define public wxDialog methods to be implemented by the derived classes + virtual int ShowModal() = 0; + virtual void EndModal(int retCode) = 0; + virtual bool IsModal() const = 0; + + + // Modal dialogs have a return code - usually the id of the last + // pressed button + void SetReturnCode(int returnCode) { m_returnCode = returnCode; } + int GetReturnCode() const { return m_returnCode; } + + // Set the identifier for the affirmative button: this button will close + // the dialog after validating data and calling TransferDataFromWindow() + void SetAffirmativeId(int affirmativeId); + int GetAffirmativeId() const { return m_affirmativeId; } + + // Set identifier for Esc key translation: the button with this id will + // close the dialog without doing anything else; special value wxID_NONE + // means to not handle Esc at all while wxID_ANY means to map Esc to + // wxID_CANCEL if present and GetAffirmativeId() otherwise + void SetEscapeId(int escapeId); + int GetEscapeId() const { return m_escapeId; } + +#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL + // splits text up at newlines and places the + // lines into a vertical wxBoxSizer + wxSizer *CreateTextSizer( const wxString &message ); +#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL + + // returns a horizontal wxBoxSizer containing the given buttons + // + // notice that the returned sizer can be NULL if no buttons are put in the + // sizer (this mostly happens under smart phones and other atypical + // platforms which have hardware buttons replacing OK/Cancel and such) + wxSizer *CreateButtonSizer(long flags); + + // returns the sizer containing CreateButtonSizer() below a separating + // static line for the platforms which use static lines for items + // separation (i.e. not Mac) + wxSizer *CreateSeparatedButtonSizer(long flags); + +#if wxUSE_BUTTON + wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags ); +#endif // wxUSE_BUTTON + +protected: + // emulate click of a button with the given id if it's present in the dialog + // + // return true if button was "clicked" or false if we don't have it + bool EmulateButtonClickIfPresent(int id); + + // this function is used by OnCharHook() to decide whether the given key + // should close the dialog + // + // for most platforms the default implementation (which just checks for + // Esc) is sufficient, but Mac port also adds Cmd-. here and other ports + // could do something different if needed + virtual bool IsEscapeKey(const wxKeyEvent& event); + + // end either modal or modeless dialog, for the modal dialog rc is used as + // the dialog return code + void EndDialog(int rc); + + // call Validate() and TransferDataFromWindow() and close dialog with + // wxID_OK return code + void AcceptAndClose(); + + + // The return code from modal dialog + int m_returnCode; + + // The identifier for the affirmative button (usually wxID_OK) + int m_affirmativeId; + + // The identifier for cancel button (usually wxID_CANCEL) + int m_escapeId; + +private: + // common part of all ctors + void Init(); + + // handle Esc key presses + void OnCharHook(wxKeyEvent& event); + + // handle closing the dialog window + void OnCloseWindow(wxCloseEvent& event); + + // handle the standard buttons + void OnButton(wxCommandEvent& event); + + // update the background colour + void OnSysColourChanged(wxSysColourChangedEvent& event); + + + DECLARE_NO_COPY_CLASS(wxDialogBase) + DECLARE_EVENT_TABLE() + WX_DECLARE_CONTROL_CONTAINER(); +}; + + +#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) + #include "wx/univ/dialog.h" +#else + #if defined(__WXPALMOS__) + #include "wx/palmos/dialog.h" + #elif defined(__WXMSW__) + #include "wx/msw/dialog.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/dialog.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/dialog.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/dialog.h" + #elif defined(__WXMAC__) + #include "wx/mac/dialog.h" + #elif defined(__WXCOCOA__) + #include "wx/cocoa/dialog.h" + #elif defined(__WXPM__) + #include "wx/os2/dialog.h" + #endif +#endif + +#endif + // _WX_DIALOG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dialup.h b/Externals/wxWidgets/include/wx/dialup.h index b86e70cba8..c2dd296def 100644 --- a/Externals/wxWidgets/include/wx/dialup.h +++ b/Externals/wxWidgets/include/wx/dialup.h @@ -1,201 +1,201 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dialup.h -// Purpose: Network related wxWidgets classes and functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.07.99 -// RCS-ID: $Id: dialup.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIALUP_H -#define _WX_DIALUP_H - -#if wxUSE_DIALUP_MANAGER - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// misc -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com") - -// ---------------------------------------------------------------------------- -// A class which groups functions dealing with connecting to the network from a -// workstation using dial-up access to the net. There is at most one instance -// of this class in the program accessed via GetDialUpManager(). -// ---------------------------------------------------------------------------- - -/* TODO - * - * 1. more configurability for Unix: i.e. how to initiate the connection, how - * to check for online status, &c. - * 2. a function to enumerate all connections (ISPs) and show a dialog in - * Dial() allowing to choose between them if no ISP given - * 3. add an async version of dialing functions which notify the caller about - * the progress (or may be even start another thread to monitor it) - * 4. the static creation/accessor functions are not MT-safe - but is this - * really crucial? I think we may suppose they're always called from the - * main thread? - */ - -class WXDLLEXPORT wxDialUpManager -{ -public: - // this function should create and return the object of the - // platform-specific class derived from wxDialUpManager. It's implemented - // in the platform-specific source files. - static wxDialUpManager *Create(); - - // could the dialup manager be initialized correctly? If this function - // returns false, no other functions will work neither, so it's a good idea - // to call this function and check its result before calling any other - // wxDialUpManager methods - virtual bool IsOk() const = 0; - - // virtual dtor for any base class - virtual ~wxDialUpManager() { } - - // operations - // ---------- - - // fills the array with the names of all possible values for the first - // parameter to Dial() on this machine and returns their number (may be 0) - virtual size_t GetISPNames(wxArrayString& names) const = 0; - - // dial the given ISP, use username and password to authentificate - // - // if no nameOfISP is given, the function will select the default one - // - // if no username/password are given, the function will try to do without - // them, but will ask the user if really needed - // - // if async parameter is false, the function waits until the end of dialing - // and returns true upon successful completion. - // if async is true, the function only initiates the connection and returns - // immediately - the result is reported via events (an event is sent - // anyhow, but if dialing failed it will be a DISCONNECTED one) - virtual bool Dial(const wxString& nameOfISP = wxEmptyString, - const wxString& username = wxEmptyString, - const wxString& password = wxEmptyString, - bool async = true) = 0; - - // returns true if (async) dialing is in progress - virtual bool IsDialing() const = 0; - - // cancel dialing the number initiated with Dial(async = true) - // NB: this won't result in DISCONNECTED event being sent - virtual bool CancelDialing() = 0; - - // hang up the currently active dial up connection - virtual bool HangUp() = 0; - - // online status - // ------------- - - // returns true if the computer has a permanent network connection (i.e. is - // on a LAN) and so there is no need to use Dial() function to go online - // - // NB: this functions tries to guess the result and it is not always - // guaranteed to be correct, so it's better to ask user for - // confirmation or give him a possibility to override it - virtual bool IsAlwaysOnline() const = 0; - - // returns true if the computer is connected to the network: under Windows, - // this just means that a RAS connection exists, under Unix we check that - // the "well-known host" (as specified by SetWellKnownHost) is reachable - virtual bool IsOnline() const = 0; - - // sometimes the built-in logic for determining the online status may fail, - // so, in general, the user should be allowed to override it. This function - // allows to forcefully set the online status - whatever our internal - // algorithm may think about it. - virtual void SetOnlineStatus(bool isOnline = true) = 0; - - // set misc wxDialUpManager options - // -------------------------------- - - // enable automatical checks for the connection status and sending of - // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval - // parameter is only for Unix where we do the check manually: under - // Windows, the notification about the change of connection status is - // instantenous. - // - // Returns false if couldn't set up automatic check for online status. - virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0; - - // disable automatic check for connection status change - notice that the - // wxEVT_DIALUP_XXX events won't be sent any more neither. - virtual void DisableAutoCheckOnlineStatus() = 0; - - // additional Unix-only configuration - // ---------------------------------- - - // under Unix, the value of well-known host is used to check whether we're - // connected to the internet. It's unused under Windows, but this function - // is always safe to call. The default value is www.yahoo.com. - virtual void SetWellKnownHost(const wxString& hostname, - int portno = 80) = 0; - - // Sets the commands to start up the network and to hang up again. Used by - // the Unix implementations only. - virtual void - SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"), - const wxString& commandHangup = wxT("/usr/bin/poff")) = 0; -}; - -// ---------------------------------------------------------------------------- -// wxDialUpManager events -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED, 450) - DECLARE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED, 451) -END_DECLARE_EVENT_TYPES() - -// the event class for the dialup events -class WXDLLEXPORT wxDialUpEvent : public wxEvent -{ -public: - wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent) - { - SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED - : wxEVT_DIALUP_DISCONNECTED); - } - - // is this a CONNECTED or DISCONNECTED event? - bool IsConnectedEvent() const - { return GetEventType() == wxEVT_DIALUP_CONNECTED; } - - // does this event come from wxDialUpManager::Dial() or from some extrenal - // process (i.e. does it result from our own attempt to establish the - // connection)? - bool IsOwnEvent() const { return m_id != 0; } - - // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxDialUpEvent(*this); } - -private: - DECLARE_NO_ASSIGN_CLASS(wxDialUpEvent) -}; - -// the type of dialup event handler function -typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&); - -#define wxDialUpEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDialUpEventFunction, &func) - -// macros to catch dialup events -#define EVT_DIALUP_CONNECTED(func) \ - wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func)) -#define EVT_DIALUP_DISCONNECTED(func) \ - wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func)) - - -#endif // wxUSE_DIALUP_MANAGER - -#endif // _WX_DIALUP_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dialup.h +// Purpose: Network related wxWidgets classes and functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.07.99 +// RCS-ID: $Id: dialup.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALUP_H +#define _WX_DIALUP_H + +#if wxUSE_DIALUP_MANAGER + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// misc +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com") + +// ---------------------------------------------------------------------------- +// A class which groups functions dealing with connecting to the network from a +// workstation using dial-up access to the net. There is at most one instance +// of this class in the program accessed via GetDialUpManager(). +// ---------------------------------------------------------------------------- + +/* TODO + * + * 1. more configurability for Unix: i.e. how to initiate the connection, how + * to check for online status, &c. + * 2. a function to enumerate all connections (ISPs) and show a dialog in + * Dial() allowing to choose between them if no ISP given + * 3. add an async version of dialing functions which notify the caller about + * the progress (or may be even start another thread to monitor it) + * 4. the static creation/accessor functions are not MT-safe - but is this + * really crucial? I think we may suppose they're always called from the + * main thread? + */ + +class WXDLLEXPORT wxDialUpManager +{ +public: + // this function should create and return the object of the + // platform-specific class derived from wxDialUpManager. It's implemented + // in the platform-specific source files. + static wxDialUpManager *Create(); + + // could the dialup manager be initialized correctly? If this function + // returns false, no other functions will work neither, so it's a good idea + // to call this function and check its result before calling any other + // wxDialUpManager methods + virtual bool IsOk() const = 0; + + // virtual dtor for any base class + virtual ~wxDialUpManager() { } + + // operations + // ---------- + + // fills the array with the names of all possible values for the first + // parameter to Dial() on this machine and returns their number (may be 0) + virtual size_t GetISPNames(wxArrayString& names) const = 0; + + // dial the given ISP, use username and password to authentificate + // + // if no nameOfISP is given, the function will select the default one + // + // if no username/password are given, the function will try to do without + // them, but will ask the user if really needed + // + // if async parameter is false, the function waits until the end of dialing + // and returns true upon successful completion. + // if async is true, the function only initiates the connection and returns + // immediately - the result is reported via events (an event is sent + // anyhow, but if dialing failed it will be a DISCONNECTED one) + virtual bool Dial(const wxString& nameOfISP = wxEmptyString, + const wxString& username = wxEmptyString, + const wxString& password = wxEmptyString, + bool async = true) = 0; + + // returns true if (async) dialing is in progress + virtual bool IsDialing() const = 0; + + // cancel dialing the number initiated with Dial(async = true) + // NB: this won't result in DISCONNECTED event being sent + virtual bool CancelDialing() = 0; + + // hang up the currently active dial up connection + virtual bool HangUp() = 0; + + // online status + // ------------- + + // returns true if the computer has a permanent network connection (i.e. is + // on a LAN) and so there is no need to use Dial() function to go online + // + // NB: this functions tries to guess the result and it is not always + // guaranteed to be correct, so it's better to ask user for + // confirmation or give him a possibility to override it + virtual bool IsAlwaysOnline() const = 0; + + // returns true if the computer is connected to the network: under Windows, + // this just means that a RAS connection exists, under Unix we check that + // the "well-known host" (as specified by SetWellKnownHost) is reachable + virtual bool IsOnline() const = 0; + + // sometimes the built-in logic for determining the online status may fail, + // so, in general, the user should be allowed to override it. This function + // allows to forcefully set the online status - whatever our internal + // algorithm may think about it. + virtual void SetOnlineStatus(bool isOnline = true) = 0; + + // set misc wxDialUpManager options + // -------------------------------- + + // enable automatical checks for the connection status and sending of + // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval + // parameter is only for Unix where we do the check manually: under + // Windows, the notification about the change of connection status is + // instantenous. + // + // Returns false if couldn't set up automatic check for online status. + virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0; + + // disable automatic check for connection status change - notice that the + // wxEVT_DIALUP_XXX events won't be sent any more neither. + virtual void DisableAutoCheckOnlineStatus() = 0; + + // additional Unix-only configuration + // ---------------------------------- + + // under Unix, the value of well-known host is used to check whether we're + // connected to the internet. It's unused under Windows, but this function + // is always safe to call. The default value is www.yahoo.com. + virtual void SetWellKnownHost(const wxString& hostname, + int portno = 80) = 0; + + // Sets the commands to start up the network and to hang up again. Used by + // the Unix implementations only. + virtual void + SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"), + const wxString& commandHangup = wxT("/usr/bin/poff")) = 0; +}; + +// ---------------------------------------------------------------------------- +// wxDialUpManager events +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED, 450) + DECLARE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED, 451) +END_DECLARE_EVENT_TYPES() + +// the event class for the dialup events +class WXDLLEXPORT wxDialUpEvent : public wxEvent +{ +public: + wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent) + { + SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED + : wxEVT_DIALUP_DISCONNECTED); + } + + // is this a CONNECTED or DISCONNECTED event? + bool IsConnectedEvent() const + { return GetEventType() == wxEVT_DIALUP_CONNECTED; } + + // does this event come from wxDialUpManager::Dial() or from some extrenal + // process (i.e. does it result from our own attempt to establish the + // connection)? + bool IsOwnEvent() const { return m_id != 0; } + + // implement the base class pure virtual + virtual wxEvent *Clone() const { return new wxDialUpEvent(*this); } + +private: + DECLARE_NO_ASSIGN_CLASS(wxDialUpEvent) +}; + +// the type of dialup event handler function +typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&); + +#define wxDialUpEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDialUpEventFunction, &func) + +// macros to catch dialup events +#define EVT_DIALUP_CONNECTED(func) \ + wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func)) +#define EVT_DIALUP_DISCONNECTED(func) \ + wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func)) + + +#endif // wxUSE_DIALUP_MANAGER + +#endif // _WX_DIALUP_H diff --git a/Externals/wxWidgets/include/wx/dir.h b/Externals/wxWidgets/include/wx/dir.h index 90cee0225e..0a5b2cffea 100644 --- a/Externals/wxWidgets/include/wx/dir.h +++ b/Externals/wxWidgets/include/wx/dir.h @@ -1,161 +1,161 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dir.h -// Purpose: wxDir is a class for enumerating the files in a directory -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.12.99 -// RCS-ID: $Id: dir.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIR_H_ -#define _WX_DIR_H_ - -#include "wx/longlong.h" -#include "wx/string.h" - -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// these flags define what kind of filenames is included in the list of files -// enumerated by GetFirst/GetNext -enum -{ - wxDIR_FILES = 0x0001, // include files - wxDIR_DIRS = 0x0002, // include directories - wxDIR_HIDDEN = 0x0004, // include hidden files - wxDIR_DOTDOT = 0x0008, // include '.' and '..' - - // by default, enumerate everything except '.' and '..' - wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN -}; - -// these constants are possible return value of wxDirTraverser::OnDir() -enum wxDirTraverseResult -{ - wxDIR_IGNORE = -1, // ignore this directory but continue with others - wxDIR_STOP, // stop traversing - wxDIR_CONTINUE // continue into this directory -}; - -// ---------------------------------------------------------------------------- -// wxDirTraverser: helper class for wxDir::Traverse() -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDirTraverser -{ -public: - /// a virtual dtor has been provided since this class has virtual members - virtual ~wxDirTraverser() { } - // called for each file found by wxDir::Traverse() - // - // return wxDIR_STOP or wxDIR_CONTINUE from here (wxDIR_IGNORE doesn't - // make sense) - virtual wxDirTraverseResult OnFile(const wxString& filename) = 0; - - // called for each directory found by wxDir::Traverse() - // - // return one of the enum elements defined above - virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0; - - // called for each directory which we couldn't open during our traversal - // of the directory tyree - // - // this method can also return either wxDIR_STOP, wxDIR_IGNORE or - // wxDIR_CONTINUE but the latter is treated specially: it means to retry - // opening the directory and so may lead to infinite loop if it is - // returned unconditionally, be careful with this! - // - // the base class version always returns wxDIR_IGNORE - virtual wxDirTraverseResult OnOpenError(const wxString& dirname); -}; - -// ---------------------------------------------------------------------------- -// wxDir: portable equivalent of {open/read/close}dir functions -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxDirData; - -class WXDLLIMPEXP_BASE wxDir -{ -public: - // test for existence of a directory with the given name - static bool Exists(const wxString& dir); - - // ctors - // ----- - - // default, use Open() - wxDir() { m_data = NULL; } - - // opens the directory for enumeration, use IsOpened() to test success - wxDir(const wxString& dir); - - // dtor cleans up the associated ressources - ~wxDir(); - - // open the directory for enumerating - bool Open(const wxString& dir); - - // returns true if the directory was successfully opened - bool IsOpened() const; - - // get the full name of the directory (without '/' at the end) - wxString GetName() const; - - // file enumeration routines - // ------------------------- - - // start enumerating all files matching filespec (or all files if it is - // empty) and flags, return true on success - bool GetFirst(wxString *filename, - const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT) const; - - // get next file in the enumeration started with GetFirst() - bool GetNext(wxString *filename) const; - - // return true if this directory has any files in it - bool HasFiles(const wxString& spec = wxEmptyString); - - // return true if this directory has any subdirectories - bool HasSubDirs(const wxString& spec = wxEmptyString); - - // enumerate all files in this directory and its subdirectories - // - // return the number of files found - size_t Traverse(wxDirTraverser& sink, - const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT) const; - - // simplest version of Traverse(): get the names of all files under this - // directory into filenames array, return the number of files - static size_t GetAllFiles(const wxString& dirname, - wxArrayString *files, - const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT); - - // check if there any files matching the given filespec under the given - // directory (i.e. searches recursively), return the file path if found or - // empty string otherwise - static wxString FindFirst(const wxString& dirname, - const wxString& filespec, - int flags = wxDIR_DEFAULT); - - // returns the size of all directories recursively found in given path - static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL); - -private: - friend class wxDirData; - - wxDirData *m_data; - - DECLARE_NO_COPY_CLASS(wxDir) -}; - -#endif // _WX_DIR_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dir.h +// Purpose: wxDir is a class for enumerating the files in a directory +// Author: Vadim Zeitlin +// Modified by: +// Created: 08.12.99 +// RCS-ID: $Id: dir.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIR_H_ +#define _WX_DIR_H_ + +#include "wx/longlong.h" +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// these flags define what kind of filenames is included in the list of files +// enumerated by GetFirst/GetNext +enum +{ + wxDIR_FILES = 0x0001, // include files + wxDIR_DIRS = 0x0002, // include directories + wxDIR_HIDDEN = 0x0004, // include hidden files + wxDIR_DOTDOT = 0x0008, // include '.' and '..' + + // by default, enumerate everything except '.' and '..' + wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN +}; + +// these constants are possible return value of wxDirTraverser::OnDir() +enum wxDirTraverseResult +{ + wxDIR_IGNORE = -1, // ignore this directory but continue with others + wxDIR_STOP, // stop traversing + wxDIR_CONTINUE // continue into this directory +}; + +// ---------------------------------------------------------------------------- +// wxDirTraverser: helper class for wxDir::Traverse() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDirTraverser +{ +public: + /// a virtual dtor has been provided since this class has virtual members + virtual ~wxDirTraverser() { } + // called for each file found by wxDir::Traverse() + // + // return wxDIR_STOP or wxDIR_CONTINUE from here (wxDIR_IGNORE doesn't + // make sense) + virtual wxDirTraverseResult OnFile(const wxString& filename) = 0; + + // called for each directory found by wxDir::Traverse() + // + // return one of the enum elements defined above + virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0; + + // called for each directory which we couldn't open during our traversal + // of the directory tyree + // + // this method can also return either wxDIR_STOP, wxDIR_IGNORE or + // wxDIR_CONTINUE but the latter is treated specially: it means to retry + // opening the directory and so may lead to infinite loop if it is + // returned unconditionally, be careful with this! + // + // the base class version always returns wxDIR_IGNORE + virtual wxDirTraverseResult OnOpenError(const wxString& dirname); +}; + +// ---------------------------------------------------------------------------- +// wxDir: portable equivalent of {open/read/close}dir functions +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxDirData; + +class WXDLLIMPEXP_BASE wxDir +{ +public: + // test for existence of a directory with the given name + static bool Exists(const wxString& dir); + + // ctors + // ----- + + // default, use Open() + wxDir() { m_data = NULL; } + + // opens the directory for enumeration, use IsOpened() to test success + wxDir(const wxString& dir); + + // dtor cleans up the associated ressources + ~wxDir(); + + // open the directory for enumerating + bool Open(const wxString& dir); + + // returns true if the directory was successfully opened + bool IsOpened() const; + + // get the full name of the directory (without '/' at the end) + wxString GetName() const; + + // file enumeration routines + // ------------------------- + + // start enumerating all files matching filespec (or all files if it is + // empty) and flags, return true on success + bool GetFirst(wxString *filename, + const wxString& filespec = wxEmptyString, + int flags = wxDIR_DEFAULT) const; + + // get next file in the enumeration started with GetFirst() + bool GetNext(wxString *filename) const; + + // return true if this directory has any files in it + bool HasFiles(const wxString& spec = wxEmptyString); + + // return true if this directory has any subdirectories + bool HasSubDirs(const wxString& spec = wxEmptyString); + + // enumerate all files in this directory and its subdirectories + // + // return the number of files found + size_t Traverse(wxDirTraverser& sink, + const wxString& filespec = wxEmptyString, + int flags = wxDIR_DEFAULT) const; + + // simplest version of Traverse(): get the names of all files under this + // directory into filenames array, return the number of files + static size_t GetAllFiles(const wxString& dirname, + wxArrayString *files, + const wxString& filespec = wxEmptyString, + int flags = wxDIR_DEFAULT); + + // check if there any files matching the given filespec under the given + // directory (i.e. searches recursively), return the file path if found or + // empty string otherwise + static wxString FindFirst(const wxString& dirname, + const wxString& filespec, + int flags = wxDIR_DEFAULT); + + // returns the size of all directories recursively found in given path + static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL); + +private: + friend class wxDirData; + + wxDirData *m_data; + + DECLARE_NO_COPY_CLASS(wxDir) +}; + +#endif // _WX_DIR_H_ + diff --git a/Externals/wxWidgets/include/wx/dirctrl.h b/Externals/wxWidgets/include/wx/dirctrl.h index 90a3694ba1..704f8bb768 100644 --- a/Externals/wxWidgets/include/wx/dirctrl.h +++ b/Externals/wxWidgets/include/wx/dirctrl.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dirctrl.h -// Purpose: Directory control base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dirctrl.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRCTRL_H_BASE_ -#define _WX_DIRCTRL_H_BASE_ - -#include "wx/generic/dirctrlg.h" - -#endif - // _WX_DIRCTRL_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dirctrl.h +// Purpose: Directory control base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dirctrl.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRCTRL_H_BASE_ +#define _WX_DIRCTRL_H_BASE_ + +#include "wx/generic/dirctrlg.h" + +#endif + // _WX_DIRCTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dirdlg.h b/Externals/wxWidgets/include/wx/dirdlg.h index 8c6d2f8fec..22ae354714 100644 --- a/Externals/wxWidgets/include/wx/dirdlg.h +++ b/Externals/wxWidgets/include/wx/dirdlg.h @@ -1,141 +1,141 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dirdlg.h -// Purpose: wxDirDialog base class -// Author: Robert Roebling -// Modified by: -// Created: -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: dirdlg.h 44027 2006-12-21 19:26:48Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRDLG_H_BASE_ -#define _WX_DIRDLG_H_BASE_ - -#if wxUSE_DIRDLG - -#include "wx/dialog.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; - -#define wxDD_CHANGE_DIR 0x0100 -#define wxDD_DIR_MUST_EXIST 0x0200 - -// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it -#define wxDD_NEW_DIR_BUTTON 0 - -#ifdef __WXWINCE__ - #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE -#else - #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) -#endif - -//------------------------------------------------------------------------- -// wxDirDialogBase -//------------------------------------------------------------------------- - -class WXDLLEXPORT wxDirDialogBase : public wxDialog -{ -public: - wxDirDialogBase() {} - wxDirDialogBase(wxWindow *parent, - const wxString& title = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxDirDialogNameStr) - { - Create(parent, title, defaultPath, style, pos, sz, name); - } - - virtual ~wxDirDialogBase() {} - - - bool Create(wxWindow *parent, - const wxString& title = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxDirDialogNameStr) - { - if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name)) - return false; - m_path = defaultPath; - m_message = title; - return true; - } - -#if WXWIN_COMPATIBILITY_2_6 - - wxDEPRECATED( long GetStyle() const ); - wxDEPRECATED( void SetStyle(long style) ); - -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual void SetMessage(const wxString& message) { m_message = message; } - virtual void SetPath(const wxString& path) { m_path = path; } - - virtual wxString GetMessage() const { return m_message; } - virtual wxString GetPath() const { return m_path; } - -protected: - wxString m_message; - wxString m_path; -}; - - -// Universal and non-port related switches with need for generic implementation -#if defined(__WXUNIVERSAL__) - #include "wx/generic/dirdlgg.h" - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \ - !wxUSE_OLE || \ - (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) - #include "wx/generic/dirdlgg.h" - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__) - #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) - #include "wx/msw/dirdlg.h" // Native MSW -#elif defined(__WXGTK24__) - #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4 -#elif defined(__WXGTK__) - #include "wx/generic/dirdlgg.h" - #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMAC__) - #include "wx/mac/dirdlg.h" // Native Mac -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dirdlg.h" // Native Cocoa -#elif defined(__WXMOTIF__) || \ - defined(__WXX11__) || \ - defined(__WXMGL__) || \ - defined(__WXCOCOA__) || \ - defined(__WXPM__) - #include "wx/generic/dirdlgg.h" // Other ports use generic implementation - #define wxDirDialog wxGenericDirDialog -#endif - -// ---------------------------------------------------------------------------- -// common ::wxDirSelector() function -// ---------------------------------------------------------------------------- - -WXDLLEXPORT wxString -wxDirSelector(const wxString& message = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - wxWindow *parent = NULL); - -#endif // wxUSE_DIRDLG - -#endif - // _WX_DIRDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dirdlg.h +// Purpose: wxDirDialog base class +// Author: Robert Roebling +// Modified by: +// Created: +// Copyright: (c) Robert Roebling +// RCS-ID: $Id: dirdlg.h 44027 2006-12-21 19:26:48Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_BASE_ +#define _WX_DIRDLG_H_BASE_ + +#if wxUSE_DIRDLG + +#include "wx/dialog.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; + +#define wxDD_CHANGE_DIR 0x0100 +#define wxDD_DIR_MUST_EXIST 0x0200 + +// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it +#define wxDD_NEW_DIR_BUTTON 0 + +#ifdef __WXWINCE__ + #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE +#else + #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) +#endif + +//------------------------------------------------------------------------- +// wxDirDialogBase +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxDirDialogBase : public wxDialog +{ +public: + wxDirDialogBase() {} + wxDirDialogBase(wxWindow *parent, + const wxString& title = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxDirDialogNameStr) + { + Create(parent, title, defaultPath, style, pos, sz, name); + } + + virtual ~wxDirDialogBase() {} + + + bool Create(wxWindow *parent, + const wxString& title = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxDirDialogNameStr) + { + if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name)) + return false; + m_path = defaultPath; + m_message = title; + return true; + } + +#if WXWIN_COMPATIBILITY_2_6 + + wxDEPRECATED( long GetStyle() const ); + wxDEPRECATED( void SetStyle(long style) ); + +#endif // WXWIN_COMPATIBILITY_2_6 + + virtual void SetMessage(const wxString& message) { m_message = message; } + virtual void SetPath(const wxString& path) { m_path = path; } + + virtual wxString GetMessage() const { return m_message; } + virtual wxString GetPath() const { return m_path; } + +protected: + wxString m_message; + wxString m_path; +}; + + +// Universal and non-port related switches with need for generic implementation +#if defined(__WXUNIVERSAL__) + #include "wx/generic/dirdlgg.h" + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \ + !wxUSE_OLE || \ + (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) + #include "wx/generic/dirdlgg.h" + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__) + #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXMSW__) + #include "wx/msw/dirdlg.h" // Native MSW +#elif defined(__WXGTK24__) + #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4 +#elif defined(__WXGTK__) + #include "wx/generic/dirdlgg.h" + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXMAC__) + #include "wx/mac/dirdlg.h" // Native Mac +#elif defined(__WXCOCOA__) + #include "wx/cocoa/dirdlg.h" // Native Cocoa +#elif defined(__WXMOTIF__) || \ + defined(__WXX11__) || \ + defined(__WXMGL__) || \ + defined(__WXCOCOA__) || \ + defined(__WXPM__) + #include "wx/generic/dirdlgg.h" // Other ports use generic implementation + #define wxDirDialog wxGenericDirDialog +#endif + +// ---------------------------------------------------------------------------- +// common ::wxDirSelector() function +// ---------------------------------------------------------------------------- + +WXDLLEXPORT wxString +wxDirSelector(const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + wxWindow *parent = NULL); + +#endif // wxUSE_DIRDLG + +#endif + // _WX_DIRDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/display.h b/Externals/wxWidgets/include/wx/display.h index 98a52ec305..81f812c601 100644 --- a/Externals/wxWidgets/include/wx/display.h +++ b/Externals/wxWidgets/include/wx/display.h @@ -1,128 +1,128 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/display.h -// Purpose: wxDisplay class -// Author: Royce Mitchell III, Vadim Zeitlin -// Created: 06/21/02 -// RCS-ID: $Id: display.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2002-2006 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DISPLAY_H_BASE_ -#define _WX_DISPLAY_H_BASE_ - -// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but -// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0 -// it becomes just a trivial wrapper around the old wxDisplayXXX() functions - -#if wxUSE_DISPLAY - #include "wx/dynarray.h" - #include "wx/vidmode.h" - - WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); - - // default, uninitialized, video mode object - extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode; -#endif // wxUSE_DISPLAY - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxPoint; -class WXDLLIMPEXP_FWD_CORE wxRect; -class WXDLLIMPEXP_FWD_BASE wxString; - -class WXDLLIMPEXP_FWD_CORE wxDisplayFactory; -class WXDLLIMPEXP_FWD_CORE wxDisplayImpl; - -// ---------------------------------------------------------------------------- -// wxDisplay: represents a display/monitor attached to the system -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplay -{ -public: - // initialize the object containing all information about the given - // display - // - // the displays are numbered from 0 to GetCount() - 1, 0 is always the - // primary display and the only one which is always supported - wxDisplay(unsigned n = 0); - - // dtor is not virtual as this is a concrete class not meant to be derived - // from - ~wxDisplay(); - - - // return the number of available displays, valid parameters to - // wxDisplay ctor are from 0 up to this number - static unsigned GetCount(); - - // find the display where the given point lies, return wxNOT_FOUND if - // it doesn't belong to any display - static int GetFromPoint(const wxPoint& pt); - - // find the display where the given window lies, return wxNOT_FOUND if it - // is not shown at all - static int GetFromWindow(wxWindow *window); - - - // return true if the object was initialized successfully - bool IsOk() const { return m_impl != NULL; } - - // get the full display size - wxRect GetGeometry() const; - - // get the client area of the display, i.e. without taskbars and such - wxRect GetClientArea() const; - - // name may be empty - wxString GetName() const; - - // display 0 is usually the primary display - bool IsPrimary() const; - - -#if wxUSE_DISPLAY - // enumerate all video modes supported by this display matching the given - // one (in the sense of wxVideoMode::Match()) - // - // as any mode matches the default value of the argument and there is - // always at least one video mode supported by display, the returned array - // is only empty for the default value of the argument if this function is - // not supported at all on this platform - wxArrayVideoModes - GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; - - // get current video mode - wxVideoMode GetCurrentMode() const; - - // change current mode, return true if succeeded, false otherwise - // - // for the default value of the argument restores the video mode to default - bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode); - - // restore the default video mode (just a more readable synonym) - void ResetMode() { (void)ChangeMode(); } -#endif // wxUSE_DISPLAY - -private: - // returns the factory used to implement our static methods and create new - // displays - static wxDisplayFactory& Factory(); - - // creates the factory object, called by Factory() when it is called for - // the first time and should return a pointer allocated with new (the - // caller will delete it) - // - // this method must be implemented in platform-specific code if - // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code) - static wxDisplayFactory *CreateFactory(); - - - // the real implementation - wxDisplayImpl *m_impl; - - - DECLARE_NO_COPY_CLASS(wxDisplay) -}; - -#endif // _WX_DISPLAY_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/display.h +// Purpose: wxDisplay class +// Author: Royce Mitchell III, Vadim Zeitlin +// Created: 06/21/02 +// RCS-ID: $Id: display.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2002-2006 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DISPLAY_H_BASE_ +#define _WX_DISPLAY_H_BASE_ + +// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but +// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0 +// it becomes just a trivial wrapper around the old wxDisplayXXX() functions + +#if wxUSE_DISPLAY + #include "wx/dynarray.h" + #include "wx/vidmode.h" + + WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); + + // default, uninitialized, video mode object + extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode; +#endif // wxUSE_DISPLAY + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxPoint; +class WXDLLIMPEXP_FWD_CORE wxRect; +class WXDLLIMPEXP_FWD_BASE wxString; + +class WXDLLIMPEXP_FWD_CORE wxDisplayFactory; +class WXDLLIMPEXP_FWD_CORE wxDisplayImpl; + +// ---------------------------------------------------------------------------- +// wxDisplay: represents a display/monitor attached to the system +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDisplay +{ +public: + // initialize the object containing all information about the given + // display + // + // the displays are numbered from 0 to GetCount() - 1, 0 is always the + // primary display and the only one which is always supported + wxDisplay(unsigned n = 0); + + // dtor is not virtual as this is a concrete class not meant to be derived + // from + ~wxDisplay(); + + + // return the number of available displays, valid parameters to + // wxDisplay ctor are from 0 up to this number + static unsigned GetCount(); + + // find the display where the given point lies, return wxNOT_FOUND if + // it doesn't belong to any display + static int GetFromPoint(const wxPoint& pt); + + // find the display where the given window lies, return wxNOT_FOUND if it + // is not shown at all + static int GetFromWindow(wxWindow *window); + + + // return true if the object was initialized successfully + bool IsOk() const { return m_impl != NULL; } + + // get the full display size + wxRect GetGeometry() const; + + // get the client area of the display, i.e. without taskbars and such + wxRect GetClientArea() const; + + // name may be empty + wxString GetName() const; + + // display 0 is usually the primary display + bool IsPrimary() const; + + +#if wxUSE_DISPLAY + // enumerate all video modes supported by this display matching the given + // one (in the sense of wxVideoMode::Match()) + // + // as any mode matches the default value of the argument and there is + // always at least one video mode supported by display, the returned array + // is only empty for the default value of the argument if this function is + // not supported at all on this platform + wxArrayVideoModes + GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; + + // get current video mode + wxVideoMode GetCurrentMode() const; + + // change current mode, return true if succeeded, false otherwise + // + // for the default value of the argument restores the video mode to default + bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode); + + // restore the default video mode (just a more readable synonym) + void ResetMode() { (void)ChangeMode(); } +#endif // wxUSE_DISPLAY + +private: + // returns the factory used to implement our static methods and create new + // displays + static wxDisplayFactory& Factory(); + + // creates the factory object, called by Factory() when it is called for + // the first time and should return a pointer allocated with new (the + // caller will delete it) + // + // this method must be implemented in platform-specific code if + // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code) + static wxDisplayFactory *CreateFactory(); + + + // the real implementation + wxDisplayImpl *m_impl; + + + DECLARE_NO_COPY_CLASS(wxDisplay) +}; + +#endif // _WX_DISPLAY_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/display_impl.h b/Externals/wxWidgets/include/wx/display_impl.h index 8c38f6522a..f79766e030 100644 --- a/Externals/wxWidgets/include/wx/display_impl.h +++ b/Externals/wxWidgets/include/wx/display_impl.h @@ -1,110 +1,110 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/display_impl.h -// Purpose: wxDisplayImpl class declaration -// Author: Vadim Zeitlin -// Created: 2006-03-15 -// RCS-ID: $Id: display_impl.h 41548 2006-10-02 05:38:05Z PC $ -// Copyright: (c) 2002-2006 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DISPLAY_IMPL_H_BASE_ -#define _WX_DISPLAY_IMPL_H_BASE_ - -#include "wx/gdicmn.h" // for wxRect - -// ---------------------------------------------------------------------------- -// wxDisplayFactory: allows to create wxDisplay objects -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplayFactory -{ -public: - wxDisplayFactory() { } - virtual ~wxDisplayFactory() { } - - // create a new display object - // - // it can return a NULL pointer if the display creation failed - virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; - - // get the total number of displays - virtual unsigned GetCount() = 0; - - // return the display for the given point or wxNOT_FOUND - virtual int GetFromPoint(const wxPoint& pt) = 0; - - // return the display for the given window or wxNOT_FOUND - // - // the window pointer must not be NULL (i.e. caller should check it) - virtual int GetFromWindow(wxWindow *window); -}; - -// ---------------------------------------------------------------------------- -// wxDisplayImpl: base class for all wxDisplay implementations -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplayImpl -{ -public: - // virtual dtor for this base class - virtual ~wxDisplayImpl() { } - - - // return the full area of this display - virtual wxRect GetGeometry() const = 0; - - // return the area of the display available for normal windows - virtual wxRect GetClientArea() const { return GetGeometry(); } - - // return the name (may be empty) - virtual wxString GetName() const = 0; - - // return the index of this display - unsigned GetIndex() const { return m_index; } - - // return true if this is the primary monitor (usually one with index 0) - virtual bool IsPrimary() const { return GetIndex() == 0; } - - -#if wxUSE_DISPLAY - // implements wxDisplay::GetModes() - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const = 0; - - // get current video mode - virtual wxVideoMode GetCurrentMode() const = 0; - - // change current mode, return true if succeeded, false otherwise - virtual bool ChangeMode(const wxVideoMode& mode) = 0; -#endif // wxUSE_DISPLAY - -protected: - // create the object providing access to the display with the given index - wxDisplayImpl(unsigned n) : m_index(n) { } - - - // the index of this display (0 is always the primary one) - const unsigned m_index; - - - friend class wxDisplayFactory; - - DECLARE_NO_COPY_CLASS(wxDisplayImpl) -}; - -// ---------------------------------------------------------------------------- -// wxDisplayFactorySingle -// ---------------------------------------------------------------------------- - -// this is a stub implementation using single/main display only, it is -// available even if wxUSE_DISPLAY == 0 -class WXDLLEXPORT wxDisplayFactorySingle : public wxDisplayFactory -{ -public: - virtual wxDisplayImpl *CreateDisplay(unsigned n); - virtual unsigned GetCount() { return 1; } - virtual int GetFromPoint(const wxPoint& pt); -}; - -#endif // _WX_DISPLAY_IMPL_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/display_impl.h +// Purpose: wxDisplayImpl class declaration +// Author: Vadim Zeitlin +// Created: 2006-03-15 +// RCS-ID: $Id: display_impl.h 41548 2006-10-02 05:38:05Z PC $ +// Copyright: (c) 2002-2006 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DISPLAY_IMPL_H_BASE_ +#define _WX_DISPLAY_IMPL_H_BASE_ + +#include "wx/gdicmn.h" // for wxRect + +// ---------------------------------------------------------------------------- +// wxDisplayFactory: allows to create wxDisplay objects +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDisplayFactory +{ +public: + wxDisplayFactory() { } + virtual ~wxDisplayFactory() { } + + // create a new display object + // + // it can return a NULL pointer if the display creation failed + virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; + + // get the total number of displays + virtual unsigned GetCount() = 0; + + // return the display for the given point or wxNOT_FOUND + virtual int GetFromPoint(const wxPoint& pt) = 0; + + // return the display for the given window or wxNOT_FOUND + // + // the window pointer must not be NULL (i.e. caller should check it) + virtual int GetFromWindow(wxWindow *window); +}; + +// ---------------------------------------------------------------------------- +// wxDisplayImpl: base class for all wxDisplay implementations +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDisplayImpl +{ +public: + // virtual dtor for this base class + virtual ~wxDisplayImpl() { } + + + // return the full area of this display + virtual wxRect GetGeometry() const = 0; + + // return the area of the display available for normal windows + virtual wxRect GetClientArea() const { return GetGeometry(); } + + // return the name (may be empty) + virtual wxString GetName() const = 0; + + // return the index of this display + unsigned GetIndex() const { return m_index; } + + // return true if this is the primary monitor (usually one with index 0) + virtual bool IsPrimary() const { return GetIndex() == 0; } + + +#if wxUSE_DISPLAY + // implements wxDisplay::GetModes() + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const = 0; + + // get current video mode + virtual wxVideoMode GetCurrentMode() const = 0; + + // change current mode, return true if succeeded, false otherwise + virtual bool ChangeMode(const wxVideoMode& mode) = 0; +#endif // wxUSE_DISPLAY + +protected: + // create the object providing access to the display with the given index + wxDisplayImpl(unsigned n) : m_index(n) { } + + + // the index of this display (0 is always the primary one) + const unsigned m_index; + + + friend class wxDisplayFactory; + + DECLARE_NO_COPY_CLASS(wxDisplayImpl) +}; + +// ---------------------------------------------------------------------------- +// wxDisplayFactorySingle +// ---------------------------------------------------------------------------- + +// this is a stub implementation using single/main display only, it is +// available even if wxUSE_DISPLAY == 0 +class WXDLLEXPORT wxDisplayFactorySingle : public wxDisplayFactory +{ +public: + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount() { return 1; } + virtual int GetFromPoint(const wxPoint& pt); +}; + +#endif // _WX_DISPLAY_IMPL_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/dlimpexp.h b/Externals/wxWidgets/include/wx/dlimpexp.h index 743785e04a..c6fc095cee 100644 --- a/Externals/wxWidgets/include/wx/dlimpexp.h +++ b/Externals/wxWidgets/include/wx/dlimpexp.h @@ -1,275 +1,275 @@ -/* - * Name: wx/dlimpexp.h - * Purpose: Macros for declaring DLL-imported/exported functions - * Author: Vadim Zeitlin - * Modified by: - * Created: 16.10.2003 (extracted from wx/defs.h) - * RCS-ID: $Id: dlimpexp.h 49563 2007-10-31 20:46:21Z VZ $ - * Copyright: (c) 2003 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* - This is a C file, not C++ one, do not use C++ comments here! - */ - -#ifndef _WX_DLIMPEXP_H_ -#define _WX_DLIMPEXP_H_ - -#if defined(__WXMSW__) - /* - __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well - as VC++ and gcc - */ -# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) -# define WXEXPORT __declspec(dllexport) -# define WXIMPORT __declspec(dllimport) -# else /* compiler doesn't support __declspec() */ -# define WXEXPORT -# define WXIMPORT -# endif -#elif defined(__WXPM__) -# if defined (__WATCOMC__) -# define WXEXPORT __declspec(dllexport) - /* - __declspec(dllimport) prepends __imp to imported symbols. We do NOT - want that! - */ -# define WXIMPORT -# elif defined(__EMX__) -# define WXEXPORT -# define WXIMPORT -# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) -# define WXEXPORT _Export -# define WXIMPORT _Export -# endif -#elif defined(__WXMAC__) || defined(__WXCOCOA__) -# ifdef __MWERKS__ -# define WXEXPORT __declspec(export) -# define WXIMPORT __declspec(import) -# endif -#elif defined(__CYGWIN__) -# define WXEXPORT __declspec(dllexport) -# define WXIMPORT __declspec(dllimport) -#endif - -/* for other platforms/compilers we don't anything */ -#ifndef WXEXPORT -# define WXEXPORT -# define WXIMPORT -#endif - -/* - We support building wxWidgets as a set of several libraries but we don't - support arbitrary combinations of libs/DLLs: either we build all of them as - DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). - - However we have a problem because we need separate WXDLLEXPORT versions for - different libraries as, for example, wxString class should be dllexported - when compiled in wxBase and dllimported otherwise, so we do define separate - WXMAKING/USINGDLL_XYZ constants for each component XYZ. - */ -#ifdef WXMAKINGDLL -# if wxUSE_BASE -# define WXMAKINGDLL_BASE -# endif - -# define WXMAKINGDLL_NET -# define WXMAKINGDLL_CORE -# define WXMAKINGDLL_ADV -# define WXMAKINGDLL_QA -# define WXMAKINGDLL_ODBC -# define WXMAKINGDLL_DBGRID -# define WXMAKINGDLL_HTML -# define WXMAKINGDLL_GL -# define WXMAKINGDLL_XML -# define WXMAKINGDLL_XRC -# define WXMAKINGDLL_AUI -# define WXMAKINGDLL_RICHTEXT -# define WXMAKINGDLL_MEDIA -#endif /* WXMAKINGDLL */ - -/* - WXDLLEXPORT maps to export declaration when building the DLL, to import - declaration if using it or to nothing at all if we don't use wxWin as DLL - */ -#ifdef WXMAKINGDLL_BASE -# define WXDLLIMPEXP_BASE WXEXPORT -# define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_BASE WXIMPORT -# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_BASE -# define WXDLLIMPEXP_DATA_BASE(type) type -#endif - -#ifdef WXMAKINGDLL_NET -# define WXDLLIMPEXP_NET WXEXPORT -# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_NET WXIMPORT -# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_NET -# define WXDLLIMPEXP_DATA_NET(type) type -#endif - -#ifdef WXMAKINGDLL_CORE -# define WXDLLIMPEXP_CORE WXEXPORT -# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_CORE WXIMPORT -# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_CORE -# define WXDLLIMPEXP_DATA_CORE(type) type -#endif - -#ifdef WXMAKINGDLL_ADV -# define WXDLLIMPEXP_ADV WXEXPORT -# define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_ADV WXIMPORT -# define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_ADV -# define WXDLLIMPEXP_DATA_ADV(type) type -#endif - -#ifdef WXMAKINGDLL_ODBC -# define WXDLLIMPEXP_ODBC WXEXPORT -# define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_ODBC WXIMPORT -# define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_ODBC -# define WXDLLIMPEXP_DATA_ODBC(type) type -#endif - -#ifdef WXMAKINGDLL_QA -# define WXDLLIMPEXP_QA WXEXPORT -# define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_QA WXIMPORT -# define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_QA -# define WXDLLIMPEXP_DATA_QA(type) type -#endif - -#ifdef WXMAKINGDLL_DBGRID -# define WXDLLIMPEXP_DBGRID WXEXPORT -# define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_DBGRID WXIMPORT -# define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_DBGRID -# define WXDLLIMPEXP_DATA_DBGRID(type) type -#endif - -#ifdef WXMAKINGDLL_HTML -# define WXDLLIMPEXP_HTML WXEXPORT -# define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_HTML WXIMPORT -# define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_HTML -# define WXDLLIMPEXP_DATA_HTML(type) type -#endif - -#ifdef WXMAKINGDLL_GL -# define WXDLLIMPEXP_GL WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_GL WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_GL -#endif - -#ifdef WXMAKINGDLL_XML -# define WXDLLIMPEXP_XML WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_XML WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_XML -#endif - -#ifdef WXMAKINGDLL_XRC -# define WXDLLIMPEXP_XRC WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_XRC WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_XRC -#endif - -#ifdef WXMAKINGDLL_AUI -# define WXDLLIMPEXP_AUI WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_AUI WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_AUI -#endif - -#ifdef WXMAKINGDLL_RICHTEXT -# define WXDLLIMPEXP_RICHTEXT WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_RICHTEXT WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_RICHTEXT -#endif - -#ifdef WXMAKINGDLL_MEDIA -# define WXDLLIMPEXP_MEDIA WXEXPORT -#elif defined(WXUSINGDLL) -# define WXDLLIMPEXP_MEDIA WXIMPORT -#else /* not making nor using DLL */ -# define WXDLLIMPEXP_MEDIA -#endif - -/* for backwards compatibility, define suffix-less versions too */ -#define WXDLLEXPORT WXDLLIMPEXP_CORE -#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE - -/* wx-2.9 introduces new macros for forward declarations, include them - * here for forward compatibility: - - GCC warns about using __attribute__ (and also __declspec in mingw32 case) on - forward declarations while MSVC complains about forward declarations without - __declspec for the classes later declared with it, so we need a separate set - of macros for forward declarations to hide this difference: - */ -#if defined(__WINDOWS__) && defined(__GNUC__) - #define WXDLLIMPEXP_FWD_BASE - #define WXDLLIMPEXP_FWD_NET - #define WXDLLIMPEXP_FWD_CORE - #define WXDLLIMPEXP_FWD_ADV - #define WXDLLIMPEXP_FWD_QA - #define WXDLLIMPEXP_FWD_HTML - #define WXDLLIMPEXP_FWD_GL - #define WXDLLIMPEXP_FWD_XML - #define WXDLLIMPEXP_FWD_XRC - #define WXDLLIMPEXP_FWD_AUI - #define WXDLLIMPEXP_FWD_RICHTEXT - #define WXDLLIMPEXP_FWD_MEDIA - #define WXDLLIMPEXP_FWD_STC -#else - #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE - #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET - #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE - #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV - #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA - #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML - #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL - #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML - #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC - #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI - #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT - #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA - #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC -#endif - -#endif /* _WX_DLIMPEXP_H_ */ - +/* + * Name: wx/dlimpexp.h + * Purpose: Macros for declaring DLL-imported/exported functions + * Author: Vadim Zeitlin + * Modified by: + * Created: 16.10.2003 (extracted from wx/defs.h) + * RCS-ID: $Id: dlimpexp.h 49563 2007-10-31 20:46:21Z VZ $ + * Copyright: (c) 2003 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* + This is a C file, not C++ one, do not use C++ comments here! + */ + +#ifndef _WX_DLIMPEXP_H_ +#define _WX_DLIMPEXP_H_ + +#if defined(__WXMSW__) + /* + __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well + as VC++ and gcc + */ +# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) +# define WXEXPORT __declspec(dllexport) +# define WXIMPORT __declspec(dllimport) +# else /* compiler doesn't support __declspec() */ +# define WXEXPORT +# define WXIMPORT +# endif +#elif defined(__WXPM__) +# if defined (__WATCOMC__) +# define WXEXPORT __declspec(dllexport) + /* + __declspec(dllimport) prepends __imp to imported symbols. We do NOT + want that! + */ +# define WXIMPORT +# elif defined(__EMX__) +# define WXEXPORT +# define WXIMPORT +# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) +# define WXEXPORT _Export +# define WXIMPORT _Export +# endif +#elif defined(__WXMAC__) || defined(__WXCOCOA__) +# ifdef __MWERKS__ +# define WXEXPORT __declspec(export) +# define WXIMPORT __declspec(import) +# endif +#elif defined(__CYGWIN__) +# define WXEXPORT __declspec(dllexport) +# define WXIMPORT __declspec(dllimport) +#endif + +/* for other platforms/compilers we don't anything */ +#ifndef WXEXPORT +# define WXEXPORT +# define WXIMPORT +#endif + +/* + We support building wxWidgets as a set of several libraries but we don't + support arbitrary combinations of libs/DLLs: either we build all of them as + DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). + + However we have a problem because we need separate WXDLLEXPORT versions for + different libraries as, for example, wxString class should be dllexported + when compiled in wxBase and dllimported otherwise, so we do define separate + WXMAKING/USINGDLL_XYZ constants for each component XYZ. + */ +#ifdef WXMAKINGDLL +# if wxUSE_BASE +# define WXMAKINGDLL_BASE +# endif + +# define WXMAKINGDLL_NET +# define WXMAKINGDLL_CORE +# define WXMAKINGDLL_ADV +# define WXMAKINGDLL_QA +# define WXMAKINGDLL_ODBC +# define WXMAKINGDLL_DBGRID +# define WXMAKINGDLL_HTML +# define WXMAKINGDLL_GL +# define WXMAKINGDLL_XML +# define WXMAKINGDLL_XRC +# define WXMAKINGDLL_AUI +# define WXMAKINGDLL_RICHTEXT +# define WXMAKINGDLL_MEDIA +#endif /* WXMAKINGDLL */ + +/* + WXDLLEXPORT maps to export declaration when building the DLL, to import + declaration if using it or to nothing at all if we don't use wxWin as DLL + */ +#ifdef WXMAKINGDLL_BASE +# define WXDLLIMPEXP_BASE WXEXPORT +# define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_BASE WXIMPORT +# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_BASE +# define WXDLLIMPEXP_DATA_BASE(type) type +#endif + +#ifdef WXMAKINGDLL_NET +# define WXDLLIMPEXP_NET WXEXPORT +# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_NET WXIMPORT +# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_NET +# define WXDLLIMPEXP_DATA_NET(type) type +#endif + +#ifdef WXMAKINGDLL_CORE +# define WXDLLIMPEXP_CORE WXEXPORT +# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_CORE WXIMPORT +# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_CORE +# define WXDLLIMPEXP_DATA_CORE(type) type +#endif + +#ifdef WXMAKINGDLL_ADV +# define WXDLLIMPEXP_ADV WXEXPORT +# define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_ADV WXIMPORT +# define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_ADV +# define WXDLLIMPEXP_DATA_ADV(type) type +#endif + +#ifdef WXMAKINGDLL_ODBC +# define WXDLLIMPEXP_ODBC WXEXPORT +# define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_ODBC WXIMPORT +# define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_ODBC +# define WXDLLIMPEXP_DATA_ODBC(type) type +#endif + +#ifdef WXMAKINGDLL_QA +# define WXDLLIMPEXP_QA WXEXPORT +# define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_QA WXIMPORT +# define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_QA +# define WXDLLIMPEXP_DATA_QA(type) type +#endif + +#ifdef WXMAKINGDLL_DBGRID +# define WXDLLIMPEXP_DBGRID WXEXPORT +# define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_DBGRID WXIMPORT +# define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_DBGRID +# define WXDLLIMPEXP_DATA_DBGRID(type) type +#endif + +#ifdef WXMAKINGDLL_HTML +# define WXDLLIMPEXP_HTML WXEXPORT +# define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_HTML WXIMPORT +# define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_HTML +# define WXDLLIMPEXP_DATA_HTML(type) type +#endif + +#ifdef WXMAKINGDLL_GL +# define WXDLLIMPEXP_GL WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_GL WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_GL +#endif + +#ifdef WXMAKINGDLL_XML +# define WXDLLIMPEXP_XML WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_XML WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_XML +#endif + +#ifdef WXMAKINGDLL_XRC +# define WXDLLIMPEXP_XRC WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_XRC WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_XRC +#endif + +#ifdef WXMAKINGDLL_AUI +# define WXDLLIMPEXP_AUI WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_AUI WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_AUI +#endif + +#ifdef WXMAKINGDLL_RICHTEXT +# define WXDLLIMPEXP_RICHTEXT WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_RICHTEXT WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_RICHTEXT +#endif + +#ifdef WXMAKINGDLL_MEDIA +# define WXDLLIMPEXP_MEDIA WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_MEDIA WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_MEDIA +#endif + +/* for backwards compatibility, define suffix-less versions too */ +#define WXDLLEXPORT WXDLLIMPEXP_CORE +#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE + +/* wx-2.9 introduces new macros for forward declarations, include them + * here for forward compatibility: + + GCC warns about using __attribute__ (and also __declspec in mingw32 case) on + forward declarations while MSVC complains about forward declarations without + __declspec for the classes later declared with it, so we need a separate set + of macros for forward declarations to hide this difference: + */ +#if defined(__WINDOWS__) && defined(__GNUC__) + #define WXDLLIMPEXP_FWD_BASE + #define WXDLLIMPEXP_FWD_NET + #define WXDLLIMPEXP_FWD_CORE + #define WXDLLIMPEXP_FWD_ADV + #define WXDLLIMPEXP_FWD_QA + #define WXDLLIMPEXP_FWD_HTML + #define WXDLLIMPEXP_FWD_GL + #define WXDLLIMPEXP_FWD_XML + #define WXDLLIMPEXP_FWD_XRC + #define WXDLLIMPEXP_FWD_AUI + #define WXDLLIMPEXP_FWD_RICHTEXT + #define WXDLLIMPEXP_FWD_MEDIA + #define WXDLLIMPEXP_FWD_STC +#else + #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE + #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET + #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE + #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV + #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA + #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML + #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL + #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML + #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC + #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI + #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT + #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA + #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC +#endif + +#endif /* _WX_DLIMPEXP_H_ */ + diff --git a/Externals/wxWidgets/include/wx/dnd.h b/Externals/wxWidgets/include/wx/dnd.h index 62dbac1179..2eab71e654 100644 --- a/Externals/wxWidgets/include/wx/dnd.h +++ b/Externals/wxWidgets/include/wx/dnd.h @@ -1,267 +1,267 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dnd.h -// Purpose: Drag and drop classes declarations -// Author: Vadim Zeitlin, Robert Roebling -// Modified by: -// Created: 26.05.99 -// RCS-ID: $Id: dnd.h 43636 2006-11-25 14:08:27Z VZ $ -// Copyright: (c) wxWidgets Team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DND_H_BASE_ -#define _WX_DND_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_DRAG_AND_DROP - -#include "wx/dataobj.h" -#include "wx/cursor.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// flags for wxDropSource::DoDragDrop() -// -// NB: wxDrag_CopyOnly must be 0 (== FALSE) and wxDrag_AllowMove must be 1 -// (== TRUE) for compatibility with the old DoDragDrop(bool) method! -enum -{ - wxDrag_CopyOnly = 0, // allow only copying - wxDrag_AllowMove = 1, // allow moving (copying is always allowed) - wxDrag_DefaultMove = 3 // the default operation is move, not copy -}; - -// result of wxDropSource::DoDragDrop() call -enum wxDragResult -{ - wxDragError, // error prevented the d&d operation from completing - wxDragNone, // drag target didn't accept the data - wxDragCopy, // the data was successfully copied - wxDragMove, // the data was successfully moved (MSW only) - wxDragLink, // operation is a drag-link - wxDragCancel // the operation was cancelled by user (not an error) -}; - -// return true if res indicates that something was done during a dnd operation, -// i.e. is neither error nor none nor cancel -WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res); - -// ---------------------------------------------------------------------------- -// wxDropSource is the object you need to create (and call DoDragDrop on it) -// to initiate a drag-and-drop operation -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropSourceBase -{ -public: - wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor, - const wxCursor &cursorMove = wxNullCursor, - const wxCursor &cursorStop = wxNullCursor) - : m_cursorCopy(cursorCopy), - m_cursorMove(cursorMove), - m_cursorStop(cursorStop) - { m_data = (wxDataObject *)NULL; } - virtual ~wxDropSourceBase() { } - - // set the data which is transfered by drag and drop - void SetData(wxDataObject& data) - { m_data = &data; } - - wxDataObject *GetDataObject() - { return m_data; } - - // set the icon corresponding to given drag result - void SetCursor(wxDragResult res, const wxCursor& cursor) - { - if ( res == wxDragCopy ) - m_cursorCopy = cursor; - else if ( res == wxDragMove ) - m_cursorMove = cursor; - else - m_cursorStop = cursor; - } - - // start drag action, see enum wxDragResult for return value description - // - // if flags contains wxDrag_AllowMove, moving (and only copying) data is - // allowed, if it contains wxDrag_DefaultMove (which includes the previous - // flag), it is even the default operation - virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) = 0; - - // override to give feedback depending on the current operation result - // "effect" and return true if you did something, false to let the library - // give the default feedback - virtual bool GiveFeedback(wxDragResult WXUNUSED(effect)) { return false; } - -protected: - const wxCursor& GetCursor(wxDragResult res) const - { - if ( res == wxDragCopy ) - return m_cursorCopy; - else if ( res == wxDragMove ) - return m_cursorMove; - else - return m_cursorStop; - } - - // the data we're dragging - wxDataObject *m_data; - - // the cursors to use for feedback - wxCursor m_cursorCopy, - m_cursorMove, - m_cursorStop; - - DECLARE_NO_COPY_CLASS(wxDropSourceBase) -}; - -// ---------------------------------------------------------------------------- -// wxDropTarget should be associated with a window if it wants to be able to -// receive data via drag and drop. -// -// To use this class, you should derive from wxDropTarget and implement -// OnData() pure virtual method. You may also wish to override OnDrop() if you -// want to accept the data only inside some region of the window (this may -// avoid having to copy the data to this application which happens only when -// OnData() is called) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropTargetBase -{ -public: - // ctor takes a pointer to heap-allocated wxDataObject which will be owned - // by wxDropTarget and deleted by it automatically. If you don't give it - // here, you can use SetDataObject() later. - wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL) - { m_dataObject = dataObject; m_defaultAction = wxDragNone; } - // dtor deletes our data object - virtual ~wxDropTargetBase() - { delete m_dataObject; } - - // get/set the associated wxDataObject - wxDataObject *GetDataObject() const - { return m_dataObject; } - void SetDataObject(wxDataObject *dataObject) - { if (m_dataObject) delete m_dataObject; - m_dataObject = dataObject; } - - // these functions are called when data is moved over position (x, y) and - // may return either wxDragCopy, wxDragMove or wxDragNone depending on - // what would happen if the data were dropped here. - // - // the last parameter is what would happen by default and is determined by - // the platform-specific logic (for example, under Windows it's wxDragCopy - // if Ctrl key is pressed and wxDragMove otherwise) except that it will - // always be wxDragNone if the carried data is in an unsupported format. - - // called when the mouse enters the window (only once until OnLeave()) - virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) - { return OnDragOver(x, y, def); } - - // called when the mouse moves in the window - shouldn't take long to - // execute or otherwise mouse movement would be too slow - virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), - wxDragResult def) - { return def; } - - // called when mouse leaves the window: might be used to remove the - // feedback which was given in OnEnter() - virtual void OnLeave() { } - - // this function is called when data is dropped at position (x, y) - if it - // returns true, OnData() will be called immediately afterwards which will - // allow to retrieve the data dropped. - virtual bool OnDrop(wxCoord x, wxCoord y) = 0; - - // called after OnDrop() returns TRUE: you will usually just call - // GetData() from here and, probably, also refresh something to update the - // new data and, finally, return the code indicating how did the operation - // complete (returning default value in case of success and wxDragError on - // failure is usually ok) - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0; - - // may be called *only* from inside OnData() and will fill m_dataObject - // with the data from the drop source if it returns true - virtual bool GetData() = 0; - - // sets the default action for drag and drop: - // use wxDragMove or wxDragCopy to set deafult action to move or copy - // and use wxDragNone (default) to set default action specified by - // initialization of draging (see wxDropSourceBase::DoDragDrop()) - void SetDefaultAction(wxDragResult action) - { m_defaultAction = action; } - - // returns default action for drag and drop or - // wxDragNone if this not specified - wxDragResult GetDefaultAction() - { return m_defaultAction; } - -protected: - wxDataObject *m_dataObject; - wxDragResult m_defaultAction; - - DECLARE_NO_COPY_CLASS(wxDropTargetBase) -}; - -// ---------------------------------------------------------------------------- -// include platform dependent class declarations -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/ole/dropsrc.h" - #include "wx/msw/ole/droptgt.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/dnd.h" -#elif defined(__WXX11__) - #include "wx/x11/dnd.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/dnd.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/dnd.h" -#elif defined(__WXMAC__) - #include "wx/mac/dnd.h" -#elif defined(__WXPM__) - #include "wx/os2/dnd.h" -#endif - -// ---------------------------------------------------------------------------- -// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp) -// ---------------------------------------------------------------------------- - -// A simple wxDropTarget derived class for text data: you only need to -// override OnDropText() to get something working -class WXDLLEXPORT wxTextDropTarget : public wxDropTarget -{ -public: - wxTextDropTarget(); - - virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; - - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); - -private: - DECLARE_NO_COPY_CLASS(wxTextDropTarget) -}; - -// A drop target which accepts files (dragged from File Manager or Explorer) -class WXDLLEXPORT wxFileDropTarget : public wxDropTarget -{ -public: - wxFileDropTarget(); - - // parameters are the number of files and the array of file names - virtual bool OnDropFiles(wxCoord x, wxCoord y, - const wxArrayString& filenames) = 0; - - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); - -private: - DECLARE_NO_COPY_CLASS(wxFileDropTarget) -}; - -#endif // wxUSE_DRAG_AND_DROP - -#endif // _WX_DND_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dnd.h +// Purpose: Drag and drop classes declarations +// Author: Vadim Zeitlin, Robert Roebling +// Modified by: +// Created: 26.05.99 +// RCS-ID: $Id: dnd.h 43636 2006-11-25 14:08:27Z VZ $ +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_BASE_ +#define _WX_DND_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_DRAG_AND_DROP + +#include "wx/dataobj.h" +#include "wx/cursor.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// flags for wxDropSource::DoDragDrop() +// +// NB: wxDrag_CopyOnly must be 0 (== FALSE) and wxDrag_AllowMove must be 1 +// (== TRUE) for compatibility with the old DoDragDrop(bool) method! +enum +{ + wxDrag_CopyOnly = 0, // allow only copying + wxDrag_AllowMove = 1, // allow moving (copying is always allowed) + wxDrag_DefaultMove = 3 // the default operation is move, not copy +}; + +// result of wxDropSource::DoDragDrop() call +enum wxDragResult +{ + wxDragError, // error prevented the d&d operation from completing + wxDragNone, // drag target didn't accept the data + wxDragCopy, // the data was successfully copied + wxDragMove, // the data was successfully moved (MSW only) + wxDragLink, // operation is a drag-link + wxDragCancel // the operation was cancelled by user (not an error) +}; + +// return true if res indicates that something was done during a dnd operation, +// i.e. is neither error nor none nor cancel +WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res); + +// ---------------------------------------------------------------------------- +// wxDropSource is the object you need to create (and call DoDragDrop on it) +// to initiate a drag-and-drop operation +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDropSourceBase +{ +public: + wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor) + : m_cursorCopy(cursorCopy), + m_cursorMove(cursorMove), + m_cursorStop(cursorStop) + { m_data = (wxDataObject *)NULL; } + virtual ~wxDropSourceBase() { } + + // set the data which is transfered by drag and drop + void SetData(wxDataObject& data) + { m_data = &data; } + + wxDataObject *GetDataObject() + { return m_data; } + + // set the icon corresponding to given drag result + void SetCursor(wxDragResult res, const wxCursor& cursor) + { + if ( res == wxDragCopy ) + m_cursorCopy = cursor; + else if ( res == wxDragMove ) + m_cursorMove = cursor; + else + m_cursorStop = cursor; + } + + // start drag action, see enum wxDragResult for return value description + // + // if flags contains wxDrag_AllowMove, moving (and only copying) data is + // allowed, if it contains wxDrag_DefaultMove (which includes the previous + // flag), it is even the default operation + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) = 0; + + // override to give feedback depending on the current operation result + // "effect" and return true if you did something, false to let the library + // give the default feedback + virtual bool GiveFeedback(wxDragResult WXUNUSED(effect)) { return false; } + +protected: + const wxCursor& GetCursor(wxDragResult res) const + { + if ( res == wxDragCopy ) + return m_cursorCopy; + else if ( res == wxDragMove ) + return m_cursorMove; + else + return m_cursorStop; + } + + // the data we're dragging + wxDataObject *m_data; + + // the cursors to use for feedback + wxCursor m_cursorCopy, + m_cursorMove, + m_cursorStop; + + DECLARE_NO_COPY_CLASS(wxDropSourceBase) +}; + +// ---------------------------------------------------------------------------- +// wxDropTarget should be associated with a window if it wants to be able to +// receive data via drag and drop. +// +// To use this class, you should derive from wxDropTarget and implement +// OnData() pure virtual method. You may also wish to override OnDrop() if you +// want to accept the data only inside some region of the window (this may +// avoid having to copy the data to this application which happens only when +// OnData() is called) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDropTargetBase +{ +public: + // ctor takes a pointer to heap-allocated wxDataObject which will be owned + // by wxDropTarget and deleted by it automatically. If you don't give it + // here, you can use SetDataObject() later. + wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL) + { m_dataObject = dataObject; m_defaultAction = wxDragNone; } + // dtor deletes our data object + virtual ~wxDropTargetBase() + { delete m_dataObject; } + + // get/set the associated wxDataObject + wxDataObject *GetDataObject() const + { return m_dataObject; } + void SetDataObject(wxDataObject *dataObject) + { if (m_dataObject) delete m_dataObject; + m_dataObject = dataObject; } + + // these functions are called when data is moved over position (x, y) and + // may return either wxDragCopy, wxDragMove or wxDragNone depending on + // what would happen if the data were dropped here. + // + // the last parameter is what would happen by default and is determined by + // the platform-specific logic (for example, under Windows it's wxDragCopy + // if Ctrl key is pressed and wxDragMove otherwise) except that it will + // always be wxDragNone if the carried data is in an unsupported format. + + // called when the mouse enters the window (only once until OnLeave()) + virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) + { return OnDragOver(x, y, def); } + + // called when the mouse moves in the window - shouldn't take long to + // execute or otherwise mouse movement would be too slow + virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), + wxDragResult def) + { return def; } + + // called when mouse leaves the window: might be used to remove the + // feedback which was given in OnEnter() + virtual void OnLeave() { } + + // this function is called when data is dropped at position (x, y) - if it + // returns true, OnData() will be called immediately afterwards which will + // allow to retrieve the data dropped. + virtual bool OnDrop(wxCoord x, wxCoord y) = 0; + + // called after OnDrop() returns TRUE: you will usually just call + // GetData() from here and, probably, also refresh something to update the + // new data and, finally, return the code indicating how did the operation + // complete (returning default value in case of success and wxDragError on + // failure is usually ok) + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0; + + // may be called *only* from inside OnData() and will fill m_dataObject + // with the data from the drop source if it returns true + virtual bool GetData() = 0; + + // sets the default action for drag and drop: + // use wxDragMove or wxDragCopy to set deafult action to move or copy + // and use wxDragNone (default) to set default action specified by + // initialization of draging (see wxDropSourceBase::DoDragDrop()) + void SetDefaultAction(wxDragResult action) + { m_defaultAction = action; } + + // returns default action for drag and drop or + // wxDragNone if this not specified + wxDragResult GetDefaultAction() + { return m_defaultAction; } + +protected: + wxDataObject *m_dataObject; + wxDragResult m_defaultAction; + + DECLARE_NO_COPY_CLASS(wxDropTargetBase) +}; + +// ---------------------------------------------------------------------------- +// include platform dependent class declarations +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/dropsrc.h" + #include "wx/msw/ole/droptgt.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dnd.h" +#elif defined(__WXX11__) + #include "wx/x11/dnd.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dnd.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dnd.h" +#elif defined(__WXMAC__) + #include "wx/mac/dnd.h" +#elif defined(__WXPM__) + #include "wx/os2/dnd.h" +#endif + +// ---------------------------------------------------------------------------- +// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp) +// ---------------------------------------------------------------------------- + +// A simple wxDropTarget derived class for text data: you only need to +// override OnDropText() to get something working +class WXDLLEXPORT wxTextDropTarget : public wxDropTarget +{ +public: + wxTextDropTarget(); + + virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; + + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + +private: + DECLARE_NO_COPY_CLASS(wxTextDropTarget) +}; + +// A drop target which accepts files (dragged from File Manager or Explorer) +class WXDLLEXPORT wxFileDropTarget : public wxDropTarget +{ +public: + wxFileDropTarget(); + + // parameters are the number of files and the array of file names + virtual bool OnDropFiles(wxCoord x, wxCoord y, + const wxArrayString& filenames) = 0; + + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + +private: + DECLARE_NO_COPY_CLASS(wxFileDropTarget) +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif // _WX_DND_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/docmdi.h b/Externals/wxWidgets/include/wx/docmdi.h index d4d7fcfed1..c8ab803c12 100644 --- a/Externals/wxWidgets/include/wx/docmdi.h +++ b/Externals/wxWidgets/include/wx/docmdi.h @@ -1,107 +1,107 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: docmdi.h -// Purpose: Frame classes for MDI document/view applications -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: docmdi.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DOCMDI_H_ -#define _WX_DOCMDI_H_ - -#include "wx/defs.h" - -#if wxUSE_MDI_ARCHITECTURE - -#include "wx/docview.h" -#include "wx/mdi.h" - -/* - * Use this instead of wxMDIParentFrame - */ - -class WXDLLEXPORT wxDocMDIParentFrame: public wxMDIParentFrame -{ -public: - wxDocMDIParentFrame(); - wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, - const wxString& title, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - - bool Create(wxDocManager *manager, wxFrame *parent, wxWindowID id, - const wxString& title, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - - // Extend event processing to search the document manager's event table - virtual bool ProcessEvent(wxEvent& event); - - wxDocManager *GetDocumentManager(void) const { return m_docManager; } - - void OnExit(wxCommandEvent& event); - void OnMRUFile(wxCommandEvent& event); - void OnCloseWindow(wxCloseEvent& event); - -protected: - void Init(); - wxDocManager *m_docManager; - -private: - DECLARE_CLASS(wxDocMDIParentFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDocMDIParentFrame) -}; - -/* - * Use this instead of wxMDIChildFrame - */ - -class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame -{ -public: - wxDocMDIChildFrame(); - wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, - const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long type = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); - virtual ~wxDocMDIChildFrame(); - - bool Create(wxDocument *doc, - wxView *view, - wxMDIParentFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long type = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - void OnActivate(wxActivateEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - inline wxDocument *GetDocument() const { return m_childDocument; } - inline wxView *GetView(void) const { return m_childView; } - inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } - inline void SetView(wxView *view) { m_childView = view; } - bool Destroy() { m_childView = (wxView *)NULL; return wxMDIChildFrame::Destroy(); } - -protected: - void Init(); - wxDocument* m_childDocument; - wxView* m_childView; - -private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxDocMDIChildFrame) - DECLARE_NO_COPY_CLASS(wxDocMDIChildFrame) -}; - -#endif - // wxUSE_MDI_ARCHITECTURE - -#endif - // _WX_DOCMDI_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: docmdi.h +// Purpose: Frame classes for MDI document/view applications +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: docmdi.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DOCMDI_H_ +#define _WX_DOCMDI_H_ + +#include "wx/defs.h" + +#if wxUSE_MDI_ARCHITECTURE + +#include "wx/docview.h" +#include "wx/mdi.h" + +/* + * Use this instead of wxMDIParentFrame + */ + +class WXDLLEXPORT wxDocMDIParentFrame: public wxMDIParentFrame +{ +public: + wxDocMDIParentFrame(); + wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); + + bool Create(wxDocManager *manager, wxFrame *parent, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); + + // Extend event processing to search the document manager's event table + virtual bool ProcessEvent(wxEvent& event); + + wxDocManager *GetDocumentManager(void) const { return m_docManager; } + + void OnExit(wxCommandEvent& event); + void OnMRUFile(wxCommandEvent& event); + void OnCloseWindow(wxCloseEvent& event); + +protected: + void Init(); + wxDocManager *m_docManager; + +private: + DECLARE_CLASS(wxDocMDIParentFrame) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDocMDIParentFrame) +}; + +/* + * Use this instead of wxMDIChildFrame + */ + +class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame +{ +public: + wxDocMDIChildFrame(); + wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long type = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame")); + virtual ~wxDocMDIChildFrame(); + + bool Create(wxDocument *doc, + wxView *view, + wxMDIParentFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long type = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + + void OnActivate(wxActivateEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + inline wxDocument *GetDocument() const { return m_childDocument; } + inline wxView *GetView(void) const { return m_childView; } + inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } + inline void SetView(wxView *view) { m_childView = view; } + bool Destroy() { m_childView = (wxView *)NULL; return wxMDIChildFrame::Destroy(); } + +protected: + void Init(); + wxDocument* m_childDocument; + wxView* m_childView; + +private: + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxDocMDIChildFrame) + DECLARE_NO_COPY_CLASS(wxDocMDIChildFrame) +}; + +#endif + // wxUSE_MDI_ARCHITECTURE + +#endif + // _WX_DOCMDI_H_ diff --git a/Externals/wxWidgets/include/wx/docview.h b/Externals/wxWidgets/include/wx/docview.h index c19bae19df..60ed159071 100644 --- a/Externals/wxWidgets/include/wx/docview.h +++ b/Externals/wxWidgets/include/wx/docview.h @@ -1,675 +1,675 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/docview.h -// Purpose: Doc/View classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: docview.h 53546 2008-05-10 21:02:36Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DOCH__ -#define _WX_DOCH__ - -#include "wx/defs.h" - -#if wxUSE_DOC_VIEW_ARCHITECTURE - -#include "wx/list.h" -#include "wx/string.h" -#include "wx/frame.h" - -#if wxUSE_PRINTING_ARCHITECTURE - #include "wx/print.h" -#endif - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxDocument; -class WXDLLIMPEXP_FWD_CORE wxView; -class WXDLLIMPEXP_FWD_CORE wxDocTemplate; -class WXDLLIMPEXP_FWD_CORE wxDocManager; -class WXDLLIMPEXP_FWD_CORE wxPrintInfo; -class WXDLLIMPEXP_FWD_CORE wxCommandProcessor; -class WXDLLIMPEXP_FWD_CORE wxFileHistory; -class WXDLLIMPEXP_FWD_BASE wxConfigBase; - -#if wxUSE_STD_IOSTREAM - #include "wx/iosfwrap.h" -#else - #include "wx/stream.h" -#endif - -// Document manager flags -enum -{ - wxDOC_SDI = 1, - wxDOC_MDI, - wxDOC_NEW, - wxDOC_SILENT, - wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI -}; - -// Document template flags -enum -{ - wxTEMPLATE_VISIBLE = 1, - wxTEMPLATE_INVISIBLE, - wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE -}; - -#define wxMAX_FILE_HISTORY 9 - -class WXDLLEXPORT wxDocument : public wxEvtHandler -{ -public: - wxDocument(wxDocument *parent = (wxDocument *) NULL); - virtual ~wxDocument(); - - // accessors - void SetFilename(const wxString& filename, bool notifyViews = false); - wxString GetFilename() const { return m_documentFile; } - - void SetTitle(const wxString& title) { m_documentTitle = title; } - wxString GetTitle() const { return m_documentTitle; } - - void SetDocumentName(const wxString& name) { m_documentTypeName = name; } - wxString GetDocumentName() const { return m_documentTypeName; } - - bool GetDocumentSaved() const { return m_savedYet; } - void SetDocumentSaved(bool saved = true) { m_savedYet = saved; } - - virtual bool Close(); - virtual bool Save(); - virtual bool SaveAs(); - virtual bool Revert(); - -#if wxUSE_STD_IOSTREAM - virtual wxSTD ostream& SaveObject(wxSTD ostream& stream); - virtual wxSTD istream& LoadObject(wxSTD istream& stream); -#else - virtual wxOutputStream& SaveObject(wxOutputStream& stream); - virtual wxInputStream& LoadObject(wxInputStream& stream); -#endif - - // Called by wxWidgets - virtual bool OnSaveDocument(const wxString& filename); - virtual bool OnOpenDocument(const wxString& filename); - virtual bool OnNewDocument(); - virtual bool OnCloseDocument(); - - // Prompts for saving if about to close a modified document. Returns true - // if ok to close the document (may have saved in the meantime, or set - // modified to false) - virtual bool OnSaveModified(); - - // Called by framework if created automatically by the default document - // manager: gives document a chance to initialise and (usually) create a - // view - virtual bool OnCreate(const wxString& path, long flags); - - // By default, creates a base wxCommandProcessor. - virtual wxCommandProcessor *OnCreateCommandProcessor(); - virtual wxCommandProcessor *GetCommandProcessor() const { return m_commandProcessor; } - virtual void SetCommandProcessor(wxCommandProcessor *proc) { m_commandProcessor = proc; } - - // Called after a view is added or removed. The default implementation - // deletes the document if this is there are no more views. - virtual void OnChangedViewList(); - - virtual bool DeleteContents(); - - virtual bool Draw(wxDC&); - virtual bool IsModified() const { return m_documentModified; } - virtual void Modify(bool mod) { m_documentModified = mod; } - - virtual bool AddView(wxView *view); - virtual bool RemoveView(wxView *view); - wxList& GetViews() { return m_documentViews; } - const wxList& GetViews() const { return m_documentViews; } - wxView *GetFirstView() const; - - virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL); - virtual void NotifyClosing(); - - // Remove all views (because we're closing the document) - virtual bool DeleteAllViews(); - - // Other stuff - virtual wxDocManager *GetDocumentManager() const; - virtual wxDocTemplate *GetDocumentTemplate() const { return m_documentTemplate; } - virtual void SetDocumentTemplate(wxDocTemplate *temp) { m_documentTemplate = temp; } - - // Get title, or filename if no title, else [unnamed] - // - // NB: this method will be deprecated in wxWidgets 3.0, you still need to - // override it if you need to modify the existing behaviour in this - // version but use GetUserReadableName() below if you just need to call - // it - virtual bool GetPrintableName(wxString& buf) const; - -#if wxABI_VERSION >= 20805 - wxString GetUserReadableName() const - { - wxString s; - GetPrintableName(s); - return s; - } -#endif // wxABI 2.8.5+ - - // Returns a window that can be used as a parent for document-related - // dialogs. Override if necessary. - virtual wxWindow *GetDocumentWindow() const; - -protected: - wxList m_documentViews; - wxString m_documentFile; - wxString m_documentTitle; - wxString m_documentTypeName; - wxDocTemplate* m_documentTemplate; - bool m_documentModified; - wxDocument* m_documentParent; - wxCommandProcessor* m_commandProcessor; - bool m_savedYet; - - // Called by OnSaveDocument and OnOpenDocument to implement standard - // Save/Load behavior. Re-implement in derived class for custom - // behavior. - virtual bool DoSaveDocument(const wxString& file); - virtual bool DoOpenDocument(const wxString& file); - -private: - DECLARE_ABSTRACT_CLASS(wxDocument) - DECLARE_NO_COPY_CLASS(wxDocument) -}; - -class WXDLLEXPORT wxView: public wxEvtHandler -{ -public: - // wxView(wxDocument *doc = (wxDocument *) NULL); - wxView(); - virtual ~wxView(); - - wxDocument *GetDocument() const { return m_viewDocument; } - virtual void SetDocument(wxDocument *doc); - - wxString GetViewName() const { return m_viewTypeName; } - void SetViewName(const wxString& name) { m_viewTypeName = name; } - - wxWindow *GetFrame() const { return m_viewFrame ; } - void SetFrame(wxWindow *frame) { m_viewFrame = frame; } - - virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); - virtual void OnDraw(wxDC *dc) = 0; - virtual void OnPrint(wxDC *dc, wxObject *info); - virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); - virtual void OnClosingDocument() {} - virtual void OnChangeFilename(); - - // Called by framework if created automatically by the default document - // manager class: gives view a chance to initialise - virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) { return true; } - - // Checks if the view is the last one for the document; if so, asks user - // to confirm save data (if modified). If ok, deletes itself and returns - // true. - virtual bool Close(bool deleteWindow = true); - - // Override to do cleanup/veto close - virtual bool OnClose(bool deleteWindow); - - // Extend event processing to search the document's event table - virtual bool ProcessEvent(wxEvent& event); - - // A view's window can call this to notify the view it is (in)active. - // The function then notifies the document manager. - virtual void Activate(bool activate); - - wxDocManager *GetDocumentManager() const - { return m_viewDocument->GetDocumentManager(); } - -#if wxUSE_PRINTING_ARCHITECTURE - virtual wxPrintout *OnCreatePrintout(); -#endif - -protected: - wxDocument* m_viewDocument; - wxString m_viewTypeName; - wxWindow* m_viewFrame; - -private: - DECLARE_ABSTRACT_CLASS(wxView) - DECLARE_NO_COPY_CLASS(wxView) -}; - -// Represents user interface (and other) properties of documents and views -class WXDLLEXPORT wxDocTemplate: public wxObject -{ - -friend class WXDLLIMPEXP_FWD_CORE wxDocManager; - -public: - // Associate document and view types. They're for identifying what view is - // associated with what template/document type - wxDocTemplate(wxDocManager *manager, - const wxString& descr, - const wxString& filter, - const wxString& dir, - const wxString& ext, - const wxString& docTypeName, - const wxString& viewTypeName, - wxClassInfo *docClassInfo = (wxClassInfo *) NULL, - wxClassInfo *viewClassInfo = (wxClassInfo *)NULL, - long flags = wxDEFAULT_TEMPLATE_FLAGS); - - virtual ~wxDocTemplate(); - - // By default, these two member functions dynamically creates document and - // view using dynamic instance construction. Override these if you need a - // different method of construction. - virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); - virtual wxView *CreateView(wxDocument *doc, long flags = 0); - - // Helper method for CreateDocument; also allows you to do your own document - // creation - virtual bool InitDocument(wxDocument* doc, const wxString& path, long flags = 0); - - wxString GetDefaultExtension() const { return m_defaultExt; } - wxString GetDescription() const { return m_description; } - wxString GetDirectory() const { return m_directory; } - wxDocManager *GetDocumentManager() const { return m_documentManager; } - void SetDocumentManager(wxDocManager *manager) { m_documentManager = manager; } - wxString GetFileFilter() const { return m_fileFilter; } - long GetFlags() const { return m_flags; } - virtual wxString GetViewName() const { return m_viewTypeName; } - virtual wxString GetDocumentName() const { return m_docTypeName; } - - void SetFileFilter(const wxString& filter) { m_fileFilter = filter; } - void SetDirectory(const wxString& dir) { m_directory = dir; } - void SetDescription(const wxString& descr) { m_description = descr; } - void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; } - void SetFlags(long flags) { m_flags = flags; } - - bool IsVisible() const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); } - - wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } - wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } - - virtual bool FileMatchesTemplate(const wxString& path); - -protected: - long m_flags; - wxString m_fileFilter; - wxString m_directory; - wxString m_description; - wxString m_defaultExt; - wxString m_docTypeName; - wxString m_viewTypeName; - wxDocManager* m_documentManager; - - // For dynamic creation of appropriate instances. - wxClassInfo* m_docClassInfo; - wxClassInfo* m_viewClassInfo; - - // Called by CreateDocument and CreateView to create the actual document/view object. - // By default uses the ClassInfo provided to the constructor. Override these functions - // to provide a different method of creation. - virtual wxDocument *DoCreateDocument(); - virtual wxView *DoCreateView(); - -private: - DECLARE_CLASS(wxDocTemplate) - DECLARE_NO_COPY_CLASS(wxDocTemplate) -}; - -// One object of this class may be created in an application, to manage all -// the templates and documents. -class WXDLLEXPORT wxDocManager: public wxEvtHandler -{ -public: - wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = true); - virtual ~wxDocManager(); - - virtual bool Initialize(); - - // Handlers for common user commands - void OnFileClose(wxCommandEvent& event); - void OnFileCloseAll(wxCommandEvent& event); - void OnFileNew(wxCommandEvent& event); - void OnFileOpen(wxCommandEvent& event); - void OnFileRevert(wxCommandEvent& event); - void OnFileSave(wxCommandEvent& event); - void OnFileSaveAs(wxCommandEvent& event); - void OnPrint(wxCommandEvent& event); - void OnPreview(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - - // Handlers for UI update commands - void OnUpdateFileOpen(wxUpdateUIEvent& event); - void OnUpdateFileClose(wxUpdateUIEvent& event); - void OnUpdateFileRevert(wxUpdateUIEvent& event); - void OnUpdateFileNew(wxUpdateUIEvent& event); - void OnUpdateFileSave(wxUpdateUIEvent& event); - void OnUpdateFileSaveAs(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - - void OnUpdatePrint(wxUpdateUIEvent& event); - void OnUpdatePreview(wxUpdateUIEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - // called when file format detection didn't work, can be overridden to do - // something in this case - virtual void OnOpenFileFailure() { } - - virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); - virtual wxView *CreateView(wxDocument *doc, long flags = 0); - virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); - virtual bool FlushDoc(wxDocument *doc); - virtual wxDocTemplate *MatchTemplate(const wxString& path); - virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates, - int noTemplates, wxString& path, long flags, bool save = false); - virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates, - int noTemplates, bool sort = false); - virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates, - int noTemplates, bool sort = false); - virtual wxDocTemplate *FindTemplateForPath(const wxString& path); - - void AssociateTemplate(wxDocTemplate *temp); - void DisassociateTemplate(wxDocTemplate *temp); - - wxDocument *GetCurrentDocument() const; - - void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; } - int GetMaxDocsOpen() const { return m_maxDocsOpen; } - - // Add and remove a document from the manager's list - void AddDocument(wxDocument *doc); - void RemoveDocument(wxDocument *doc); - - // closes all currently open documents - bool CloseDocuments(bool force = true); - - // closes the specified document - bool CloseDocument(wxDocument* doc, bool force = false); - - // Clear remaining documents and templates - bool Clear(bool force = true); - - // Views or windows should inform the document manager - // when a view is going in or out of focus - virtual void ActivateView(wxView *view, bool activate = true); - virtual wxView *GetCurrentView() const; - - wxList& GetDocuments() { return m_docs; } - wxList& GetTemplates() { return m_templates; } - - // Make a default document name - // - // NB: this method is renamed to MakeNewDocumentName() in wx 3.0, you still - // need to override it if your code needs to customize the default name - // generation but if you just use it from your code, prefer the version - // below which is forward-compatible with wx 3.0 - virtual bool MakeDefaultName(wxString& buf); - -#if wxABI_VERSION >= 20808 - wxString MakeNewDocumentName() const - { - wxString s; - wx_const_cast(wxDocManager *, this)->MakeDefaultName(s); - return s; - } -#endif // wx ABI >= 2.8.8 - - // Make a frame title (override this to do something different) - virtual wxString MakeFrameTitle(wxDocument* doc); - - virtual wxFileHistory *OnCreateFileHistory(); - virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; } - - // File history management - virtual void AddFileToHistory(const wxString& file); - virtual void RemoveFileFromHistory(size_t i); - virtual size_t GetHistoryFilesCount() const; - virtual wxString GetHistoryFile(size_t i) const; - virtual void FileHistoryUseMenu(wxMenu *menu); - virtual void FileHistoryRemoveMenu(wxMenu *menu); -#if wxUSE_CONFIG - virtual void FileHistoryLoad(wxConfigBase& config); - virtual void FileHistorySave(wxConfigBase& config); -#endif // wxUSE_CONFIG - - virtual void FileHistoryAddFilesToMenu(); - virtual void FileHistoryAddFilesToMenu(wxMenu* menu); - - wxString GetLastDirectory() const { return m_lastDirectory; } - void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; } - - // Get the current document manager - static wxDocManager* GetDocumentManager() { return sm_docManager; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetHistoryFilesCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - long m_flags; - int m_defaultDocumentNameCounter; - int m_maxDocsOpen; - wxList m_docs; - wxList m_templates; - wxView* m_currentView; - wxFileHistory* m_fileHistory; - wxString m_lastDirectory; - static wxDocManager* sm_docManager; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxDocManager) - DECLARE_NO_COPY_CLASS(wxDocManager) -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxDocManager::GetNoHistoryFiles() const -{ - return GetHistoryFilesCount(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// A default child frame -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDocChildFrame : public wxFrame -{ -public: - wxDocChildFrame(wxDocument *doc, - wxView *view, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long type = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxT("frame")); - virtual ~wxDocChildFrame(){} - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - void OnActivate(wxActivateEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - wxDocument *GetDocument() const { return m_childDocument; } - wxView *GetView() const { return m_childView; } - void SetDocument(wxDocument *doc) { m_childDocument = doc; } - void SetView(wxView *view) { m_childView = view; } - bool Destroy() { m_childView = (wxView *)NULL; return wxFrame::Destroy(); } - -protected: - wxDocument* m_childDocument; - wxView* m_childView; - -private: - DECLARE_CLASS(wxDocChildFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDocChildFrame) -}; - -// ---------------------------------------------------------------------------- -// A default parent frame -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDocParentFrame : public wxFrame -{ -public: - wxDocParentFrame(); - wxDocParentFrame(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - bool Create(wxDocManager *manager, - wxFrame *frame, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // Extend event processing to search the document manager's event table - virtual bool ProcessEvent(wxEvent& event); - - wxDocManager *GetDocumentManager() const { return m_docManager; } - - void OnExit(wxCommandEvent& event); - void OnMRUFile(wxCommandEvent& event); - void OnCloseWindow(wxCloseEvent& event); - -protected: - wxDocManager *m_docManager; - -private: - typedef wxFrame base_type; - DECLARE_CLASS(wxDocParentFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDocParentFrame) -}; - -// ---------------------------------------------------------------------------- -// Provide simple default printing facilities -// ---------------------------------------------------------------------------- - -#if wxUSE_PRINTING_ARCHITECTURE -class WXDLLEXPORT wxDocPrintout : public wxPrintout -{ -public: - wxDocPrintout(wxView *view = (wxView *) NULL, const wxString& title = wxT("Printout")); - bool OnPrintPage(int page); - bool HasPage(int page); - bool OnBeginDocument(int startPage, int endPage); - void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); - - virtual wxView *GetView() { return m_printoutView; } - -protected: - wxView* m_printoutView; - -private: - DECLARE_DYNAMIC_CLASS(wxDocPrintout) - DECLARE_NO_COPY_CLASS(wxDocPrintout) -}; -#endif // wxUSE_PRINTING_ARCHITECTURE - -// ---------------------------------------------------------------------------- -// File history management -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileHistory : public wxObject -{ -public: - wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1); - virtual ~wxFileHistory(); - - // Operations - virtual void AddFileToHistory(const wxString& file); - virtual void RemoveFileFromHistory(size_t i); - virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; } - virtual void UseMenu(wxMenu *menu); - - // Remove menu from the list (MDI child may be closing) - virtual void RemoveMenu(wxMenu *menu); - -#if wxUSE_CONFIG - virtual void Load(wxConfigBase& config); - virtual void Save(wxConfigBase& config); -#endif // wxUSE_CONFIG - - virtual void AddFilesToMenu(); - virtual void AddFilesToMenu(wxMenu* menu); // Single menu - - // Accessors - virtual wxString GetHistoryFile(size_t i) const; - virtual size_t GetCount() const { return m_fileHistoryN; } - - const wxList& GetMenus() const { return m_fileMenus; } - -#if wxABI_VERSION >= 20802 - // Set/get base id - void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } - wxWindowID GetBaseId() const { return m_idBase; } -#endif // wxABI 2.8.2+ - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // Last n files - wxChar** m_fileHistory; - // Number of files saved - size_t m_fileHistoryN; - // Menus to maintain (may need several for an MDI app) - wxList m_fileMenus; - // Max files to maintain - size_t m_fileMaxFiles; - -private: - // The ID of the first history menu item (Doesn't have to be wxID_FILE1) - wxWindowID m_idBase; - - DECLARE_DYNAMIC_CLASS(wxFileHistory) - DECLARE_NO_COPY_CLASS(wxFileHistory) -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxFileHistory::GetNoHistoryFiles() const -{ - return m_fileHistoryN; -} -#endif // WXWIN_COMPATIBILITY_2_6 - -#if wxUSE_STD_IOSTREAM -// For compatibility with existing file formats: -// converts from/to a stream to/from a temporary file. -bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); -bool WXDLLEXPORT wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); -#else -// For compatibility with existing file formats: -// converts from/to a stream to/from a temporary file. -bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); -bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); -#endif // wxUSE_STD_IOSTREAM - -#endif // wxUSE_DOC_VIEW_ARCHITECTURE - -#endif // _WX_DOCH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/docview.h +// Purpose: Doc/View classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: docview.h 53546 2008-05-10 21:02:36Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DOCH__ +#define _WX_DOCH__ + +#include "wx/defs.h" + +#if wxUSE_DOC_VIEW_ARCHITECTURE + +#include "wx/list.h" +#include "wx/string.h" +#include "wx/frame.h" + +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/print.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxDocument; +class WXDLLIMPEXP_FWD_CORE wxView; +class WXDLLIMPEXP_FWD_CORE wxDocTemplate; +class WXDLLIMPEXP_FWD_CORE wxDocManager; +class WXDLLIMPEXP_FWD_CORE wxPrintInfo; +class WXDLLIMPEXP_FWD_CORE wxCommandProcessor; +class WXDLLIMPEXP_FWD_CORE wxFileHistory; +class WXDLLIMPEXP_FWD_BASE wxConfigBase; + +#if wxUSE_STD_IOSTREAM + #include "wx/iosfwrap.h" +#else + #include "wx/stream.h" +#endif + +// Document manager flags +enum +{ + wxDOC_SDI = 1, + wxDOC_MDI, + wxDOC_NEW, + wxDOC_SILENT, + wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI +}; + +// Document template flags +enum +{ + wxTEMPLATE_VISIBLE = 1, + wxTEMPLATE_INVISIBLE, + wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE +}; + +#define wxMAX_FILE_HISTORY 9 + +class WXDLLEXPORT wxDocument : public wxEvtHandler +{ +public: + wxDocument(wxDocument *parent = (wxDocument *) NULL); + virtual ~wxDocument(); + + // accessors + void SetFilename(const wxString& filename, bool notifyViews = false); + wxString GetFilename() const { return m_documentFile; } + + void SetTitle(const wxString& title) { m_documentTitle = title; } + wxString GetTitle() const { return m_documentTitle; } + + void SetDocumentName(const wxString& name) { m_documentTypeName = name; } + wxString GetDocumentName() const { return m_documentTypeName; } + + bool GetDocumentSaved() const { return m_savedYet; } + void SetDocumentSaved(bool saved = true) { m_savedYet = saved; } + + virtual bool Close(); + virtual bool Save(); + virtual bool SaveAs(); + virtual bool Revert(); + +#if wxUSE_STD_IOSTREAM + virtual wxSTD ostream& SaveObject(wxSTD ostream& stream); + virtual wxSTD istream& LoadObject(wxSTD istream& stream); +#else + virtual wxOutputStream& SaveObject(wxOutputStream& stream); + virtual wxInputStream& LoadObject(wxInputStream& stream); +#endif + + // Called by wxWidgets + virtual bool OnSaveDocument(const wxString& filename); + virtual bool OnOpenDocument(const wxString& filename); + virtual bool OnNewDocument(); + virtual bool OnCloseDocument(); + + // Prompts for saving if about to close a modified document. Returns true + // if ok to close the document (may have saved in the meantime, or set + // modified to false) + virtual bool OnSaveModified(); + + // Called by framework if created automatically by the default document + // manager: gives document a chance to initialise and (usually) create a + // view + virtual bool OnCreate(const wxString& path, long flags); + + // By default, creates a base wxCommandProcessor. + virtual wxCommandProcessor *OnCreateCommandProcessor(); + virtual wxCommandProcessor *GetCommandProcessor() const { return m_commandProcessor; } + virtual void SetCommandProcessor(wxCommandProcessor *proc) { m_commandProcessor = proc; } + + // Called after a view is added or removed. The default implementation + // deletes the document if this is there are no more views. + virtual void OnChangedViewList(); + + virtual bool DeleteContents(); + + virtual bool Draw(wxDC&); + virtual bool IsModified() const { return m_documentModified; } + virtual void Modify(bool mod) { m_documentModified = mod; } + + virtual bool AddView(wxView *view); + virtual bool RemoveView(wxView *view); + wxList& GetViews() { return m_documentViews; } + const wxList& GetViews() const { return m_documentViews; } + wxView *GetFirstView() const; + + virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL); + virtual void NotifyClosing(); + + // Remove all views (because we're closing the document) + virtual bool DeleteAllViews(); + + // Other stuff + virtual wxDocManager *GetDocumentManager() const; + virtual wxDocTemplate *GetDocumentTemplate() const { return m_documentTemplate; } + virtual void SetDocumentTemplate(wxDocTemplate *temp) { m_documentTemplate = temp; } + + // Get title, or filename if no title, else [unnamed] + // + // NB: this method will be deprecated in wxWidgets 3.0, you still need to + // override it if you need to modify the existing behaviour in this + // version but use GetUserReadableName() below if you just need to call + // it + virtual bool GetPrintableName(wxString& buf) const; + +#if wxABI_VERSION >= 20805 + wxString GetUserReadableName() const + { + wxString s; + GetPrintableName(s); + return s; + } +#endif // wxABI 2.8.5+ + + // Returns a window that can be used as a parent for document-related + // dialogs. Override if necessary. + virtual wxWindow *GetDocumentWindow() const; + +protected: + wxList m_documentViews; + wxString m_documentFile; + wxString m_documentTitle; + wxString m_documentTypeName; + wxDocTemplate* m_documentTemplate; + bool m_documentModified; + wxDocument* m_documentParent; + wxCommandProcessor* m_commandProcessor; + bool m_savedYet; + + // Called by OnSaveDocument and OnOpenDocument to implement standard + // Save/Load behavior. Re-implement in derived class for custom + // behavior. + virtual bool DoSaveDocument(const wxString& file); + virtual bool DoOpenDocument(const wxString& file); + +private: + DECLARE_ABSTRACT_CLASS(wxDocument) + DECLARE_NO_COPY_CLASS(wxDocument) +}; + +class WXDLLEXPORT wxView: public wxEvtHandler +{ +public: + // wxView(wxDocument *doc = (wxDocument *) NULL); + wxView(); + virtual ~wxView(); + + wxDocument *GetDocument() const { return m_viewDocument; } + virtual void SetDocument(wxDocument *doc); + + wxString GetViewName() const { return m_viewTypeName; } + void SetViewName(const wxString& name) { m_viewTypeName = name; } + + wxWindow *GetFrame() const { return m_viewFrame ; } + void SetFrame(wxWindow *frame) { m_viewFrame = frame; } + + virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); + virtual void OnDraw(wxDC *dc) = 0; + virtual void OnPrint(wxDC *dc, wxObject *info); + virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); + virtual void OnClosingDocument() {} + virtual void OnChangeFilename(); + + // Called by framework if created automatically by the default document + // manager class: gives view a chance to initialise + virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) { return true; } + + // Checks if the view is the last one for the document; if so, asks user + // to confirm save data (if modified). If ok, deletes itself and returns + // true. + virtual bool Close(bool deleteWindow = true); + + // Override to do cleanup/veto close + virtual bool OnClose(bool deleteWindow); + + // Extend event processing to search the document's event table + virtual bool ProcessEvent(wxEvent& event); + + // A view's window can call this to notify the view it is (in)active. + // The function then notifies the document manager. + virtual void Activate(bool activate); + + wxDocManager *GetDocumentManager() const + { return m_viewDocument->GetDocumentManager(); } + +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxPrintout *OnCreatePrintout(); +#endif + +protected: + wxDocument* m_viewDocument; + wxString m_viewTypeName; + wxWindow* m_viewFrame; + +private: + DECLARE_ABSTRACT_CLASS(wxView) + DECLARE_NO_COPY_CLASS(wxView) +}; + +// Represents user interface (and other) properties of documents and views +class WXDLLEXPORT wxDocTemplate: public wxObject +{ + +friend class WXDLLIMPEXP_FWD_CORE wxDocManager; + +public: + // Associate document and view types. They're for identifying what view is + // associated with what template/document type + wxDocTemplate(wxDocManager *manager, + const wxString& descr, + const wxString& filter, + const wxString& dir, + const wxString& ext, + const wxString& docTypeName, + const wxString& viewTypeName, + wxClassInfo *docClassInfo = (wxClassInfo *) NULL, + wxClassInfo *viewClassInfo = (wxClassInfo *)NULL, + long flags = wxDEFAULT_TEMPLATE_FLAGS); + + virtual ~wxDocTemplate(); + + // By default, these two member functions dynamically creates document and + // view using dynamic instance construction. Override these if you need a + // different method of construction. + virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); + virtual wxView *CreateView(wxDocument *doc, long flags = 0); + + // Helper method for CreateDocument; also allows you to do your own document + // creation + virtual bool InitDocument(wxDocument* doc, const wxString& path, long flags = 0); + + wxString GetDefaultExtension() const { return m_defaultExt; } + wxString GetDescription() const { return m_description; } + wxString GetDirectory() const { return m_directory; } + wxDocManager *GetDocumentManager() const { return m_documentManager; } + void SetDocumentManager(wxDocManager *manager) { m_documentManager = manager; } + wxString GetFileFilter() const { return m_fileFilter; } + long GetFlags() const { return m_flags; } + virtual wxString GetViewName() const { return m_viewTypeName; } + virtual wxString GetDocumentName() const { return m_docTypeName; } + + void SetFileFilter(const wxString& filter) { m_fileFilter = filter; } + void SetDirectory(const wxString& dir) { m_directory = dir; } + void SetDescription(const wxString& descr) { m_description = descr; } + void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; } + void SetFlags(long flags) { m_flags = flags; } + + bool IsVisible() const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); } + + wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } + wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } + + virtual bool FileMatchesTemplate(const wxString& path); + +protected: + long m_flags; + wxString m_fileFilter; + wxString m_directory; + wxString m_description; + wxString m_defaultExt; + wxString m_docTypeName; + wxString m_viewTypeName; + wxDocManager* m_documentManager; + + // For dynamic creation of appropriate instances. + wxClassInfo* m_docClassInfo; + wxClassInfo* m_viewClassInfo; + + // Called by CreateDocument and CreateView to create the actual document/view object. + // By default uses the ClassInfo provided to the constructor. Override these functions + // to provide a different method of creation. + virtual wxDocument *DoCreateDocument(); + virtual wxView *DoCreateView(); + +private: + DECLARE_CLASS(wxDocTemplate) + DECLARE_NO_COPY_CLASS(wxDocTemplate) +}; + +// One object of this class may be created in an application, to manage all +// the templates and documents. +class WXDLLEXPORT wxDocManager: public wxEvtHandler +{ +public: + wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = true); + virtual ~wxDocManager(); + + virtual bool Initialize(); + + // Handlers for common user commands + void OnFileClose(wxCommandEvent& event); + void OnFileCloseAll(wxCommandEvent& event); + void OnFileNew(wxCommandEvent& event); + void OnFileOpen(wxCommandEvent& event); + void OnFileRevert(wxCommandEvent& event); + void OnFileSave(wxCommandEvent& event); + void OnFileSaveAs(wxCommandEvent& event); + void OnPrint(wxCommandEvent& event); + void OnPreview(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + // Handlers for UI update commands + void OnUpdateFileOpen(wxUpdateUIEvent& event); + void OnUpdateFileClose(wxUpdateUIEvent& event); + void OnUpdateFileRevert(wxUpdateUIEvent& event); + void OnUpdateFileNew(wxUpdateUIEvent& event); + void OnUpdateFileSave(wxUpdateUIEvent& event); + void OnUpdateFileSaveAs(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + void OnUpdatePrint(wxUpdateUIEvent& event); + void OnUpdatePreview(wxUpdateUIEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + + // called when file format detection didn't work, can be overridden to do + // something in this case + virtual void OnOpenFileFailure() { } + + virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); + virtual wxView *CreateView(wxDocument *doc, long flags = 0); + virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); + virtual bool FlushDoc(wxDocument *doc); + virtual wxDocTemplate *MatchTemplate(const wxString& path); + virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates, + int noTemplates, wxString& path, long flags, bool save = false); + virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates, + int noTemplates, bool sort = false); + virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates, + int noTemplates, bool sort = false); + virtual wxDocTemplate *FindTemplateForPath(const wxString& path); + + void AssociateTemplate(wxDocTemplate *temp); + void DisassociateTemplate(wxDocTemplate *temp); + + wxDocument *GetCurrentDocument() const; + + void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; } + int GetMaxDocsOpen() const { return m_maxDocsOpen; } + + // Add and remove a document from the manager's list + void AddDocument(wxDocument *doc); + void RemoveDocument(wxDocument *doc); + + // closes all currently open documents + bool CloseDocuments(bool force = true); + + // closes the specified document + bool CloseDocument(wxDocument* doc, bool force = false); + + // Clear remaining documents and templates + bool Clear(bool force = true); + + // Views or windows should inform the document manager + // when a view is going in or out of focus + virtual void ActivateView(wxView *view, bool activate = true); + virtual wxView *GetCurrentView() const; + + wxList& GetDocuments() { return m_docs; } + wxList& GetTemplates() { return m_templates; } + + // Make a default document name + // + // NB: this method is renamed to MakeNewDocumentName() in wx 3.0, you still + // need to override it if your code needs to customize the default name + // generation but if you just use it from your code, prefer the version + // below which is forward-compatible with wx 3.0 + virtual bool MakeDefaultName(wxString& buf); + +#if wxABI_VERSION >= 20808 + wxString MakeNewDocumentName() const + { + wxString s; + wx_const_cast(wxDocManager *, this)->MakeDefaultName(s); + return s; + } +#endif // wx ABI >= 2.8.8 + + // Make a frame title (override this to do something different) + virtual wxString MakeFrameTitle(wxDocument* doc); + + virtual wxFileHistory *OnCreateFileHistory(); + virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; } + + // File history management + virtual void AddFileToHistory(const wxString& file); + virtual void RemoveFileFromHistory(size_t i); + virtual size_t GetHistoryFilesCount() const; + virtual wxString GetHistoryFile(size_t i) const; + virtual void FileHistoryUseMenu(wxMenu *menu); + virtual void FileHistoryRemoveMenu(wxMenu *menu); +#if wxUSE_CONFIG + virtual void FileHistoryLoad(wxConfigBase& config); + virtual void FileHistorySave(wxConfigBase& config); +#endif // wxUSE_CONFIG + + virtual void FileHistoryAddFilesToMenu(); + virtual void FileHistoryAddFilesToMenu(wxMenu* menu); + + wxString GetLastDirectory() const { return m_lastDirectory; } + void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; } + + // Get the current document manager + static wxDocManager* GetDocumentManager() { return sm_docManager; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, use GetHistoryFilesCount() instead + wxDEPRECATED( size_t GetNoHistoryFiles() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + long m_flags; + int m_defaultDocumentNameCounter; + int m_maxDocsOpen; + wxList m_docs; + wxList m_templates; + wxView* m_currentView; + wxFileHistory* m_fileHistory; + wxString m_lastDirectory; + static wxDocManager* sm_docManager; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxDocManager) + DECLARE_NO_COPY_CLASS(wxDocManager) +}; + +#if WXWIN_COMPATIBILITY_2_6 +inline size_t wxDocManager::GetNoHistoryFiles() const +{ + return GetHistoryFilesCount(); +} +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// A default child frame +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDocChildFrame : public wxFrame +{ +public: + wxDocChildFrame(wxDocument *doc, + wxView *view, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long type = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxT("frame")); + virtual ~wxDocChildFrame(){} + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + + void OnActivate(wxActivateEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + wxDocument *GetDocument() const { return m_childDocument; } + wxView *GetView() const { return m_childView; } + void SetDocument(wxDocument *doc) { m_childDocument = doc; } + void SetView(wxView *view) { m_childView = view; } + bool Destroy() { m_childView = (wxView *)NULL; return wxFrame::Destroy(); } + +protected: + wxDocument* m_childDocument; + wxView* m_childView; + +private: + DECLARE_CLASS(wxDocChildFrame) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDocChildFrame) +}; + +// ---------------------------------------------------------------------------- +// A default parent frame +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDocParentFrame : public wxFrame +{ +public: + wxDocParentFrame(); + wxDocParentFrame(wxDocManager *manager, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + bool Create(wxDocManager *manager, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // Extend event processing to search the document manager's event table + virtual bool ProcessEvent(wxEvent& event); + + wxDocManager *GetDocumentManager() const { return m_docManager; } + + void OnExit(wxCommandEvent& event); + void OnMRUFile(wxCommandEvent& event); + void OnCloseWindow(wxCloseEvent& event); + +protected: + wxDocManager *m_docManager; + +private: + typedef wxFrame base_type; + DECLARE_CLASS(wxDocParentFrame) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDocParentFrame) +}; + +// ---------------------------------------------------------------------------- +// Provide simple default printing facilities +// ---------------------------------------------------------------------------- + +#if wxUSE_PRINTING_ARCHITECTURE +class WXDLLEXPORT wxDocPrintout : public wxPrintout +{ +public: + wxDocPrintout(wxView *view = (wxView *) NULL, const wxString& title = wxT("Printout")); + bool OnPrintPage(int page); + bool HasPage(int page); + bool OnBeginDocument(int startPage, int endPage); + void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); + + virtual wxView *GetView() { return m_printoutView; } + +protected: + wxView* m_printoutView; + +private: + DECLARE_DYNAMIC_CLASS(wxDocPrintout) + DECLARE_NO_COPY_CLASS(wxDocPrintout) +}; +#endif // wxUSE_PRINTING_ARCHITECTURE + +// ---------------------------------------------------------------------------- +// File history management +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileHistory : public wxObject +{ +public: + wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1); + virtual ~wxFileHistory(); + + // Operations + virtual void AddFileToHistory(const wxString& file); + virtual void RemoveFileFromHistory(size_t i); + virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; } + virtual void UseMenu(wxMenu *menu); + + // Remove menu from the list (MDI child may be closing) + virtual void RemoveMenu(wxMenu *menu); + +#if wxUSE_CONFIG + virtual void Load(wxConfigBase& config); + virtual void Save(wxConfigBase& config); +#endif // wxUSE_CONFIG + + virtual void AddFilesToMenu(); + virtual void AddFilesToMenu(wxMenu* menu); // Single menu + + // Accessors + virtual wxString GetHistoryFile(size_t i) const; + virtual size_t GetCount() const { return m_fileHistoryN; } + + const wxList& GetMenus() const { return m_fileMenus; } + +#if wxABI_VERSION >= 20802 + // Set/get base id + void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } + wxWindowID GetBaseId() const { return m_idBase; } +#endif // wxABI 2.8.2+ + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, use GetCount() instead + wxDEPRECATED( size_t GetNoHistoryFiles() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + // Last n files + wxChar** m_fileHistory; + // Number of files saved + size_t m_fileHistoryN; + // Menus to maintain (may need several for an MDI app) + wxList m_fileMenus; + // Max files to maintain + size_t m_fileMaxFiles; + +private: + // The ID of the first history menu item (Doesn't have to be wxID_FILE1) + wxWindowID m_idBase; + + DECLARE_DYNAMIC_CLASS(wxFileHistory) + DECLARE_NO_COPY_CLASS(wxFileHistory) +}; + +#if WXWIN_COMPATIBILITY_2_6 +inline size_t wxFileHistory::GetNoHistoryFiles() const +{ + return m_fileHistoryN; +} +#endif // WXWIN_COMPATIBILITY_2_6 + +#if wxUSE_STD_IOSTREAM +// For compatibility with existing file formats: +// converts from/to a stream to/from a temporary file. +bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); +bool WXDLLEXPORT wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); +#else +// For compatibility with existing file formats: +// converts from/to a stream to/from a temporary file. +bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); +bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); +#endif // wxUSE_STD_IOSTREAM + +#endif // wxUSE_DOC_VIEW_ARCHITECTURE + +#endif // _WX_DOCH__ diff --git a/Externals/wxWidgets/include/wx/dragimag.h b/Externals/wxWidgets/include/wx/dragimag.h index 6076abc3b2..279cd56837 100644 --- a/Externals/wxWidgets/include/wx/dragimag.h +++ b/Externals/wxWidgets/include/wx/dragimag.h @@ -1,54 +1,54 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dragimag.h -// Purpose: wxDragImage base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: dragimag.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DRAGIMAG_H_BASE_ -#define _WX_DRAGIMAG_H_BASE_ - -#if wxUSE_DRAGIMAGE - -class WXDLLEXPORT wxRect; -class WXDLLEXPORT wxMemoryDC; -class WXDLLEXPORT wxDC; - -#if defined(__WXMSW__) -# if defined(__WXUNIVERSAL__) -# include "wx/generic/dragimgg.h" -# define wxDragImage wxGenericDragImage -# else -# include "wx/msw/dragimag.h" -# endif - -#elif defined(__WXMOTIF__) -# include "wx/generic/dragimgg.h" -# define wxDragImage wxGenericDragImage - -#elif defined(__WXGTK__) -# include "wx/generic/dragimgg.h" -# define wxDragImage wxGenericDragImage - -#elif defined(__WXX11__) -# include "wx/generic/dragimgg.h" -# define wxDragImage wxGenericDragImage - -#elif defined(__WXMAC__) -# include "wx/generic/dragimgg.h" -# define wxDragImage wxGenericDragImage - -#elif defined(__WXPM__) -# include "wx/generic/dragimgg.h" -# define wxDragImage wxGenericDragImage - -#endif - -#endif // wxUSE_DRAGIMAGE - -#endif - // _WX_DRAGIMAG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dragimag.h +// Purpose: wxDragImage base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: dragimag.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMAG_H_BASE_ +#define _WX_DRAGIMAG_H_BASE_ + +#if wxUSE_DRAGIMAGE + +class WXDLLEXPORT wxRect; +class WXDLLEXPORT wxMemoryDC; +class WXDLLEXPORT wxDC; + +#if defined(__WXMSW__) +# if defined(__WXUNIVERSAL__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage +# else +# include "wx/msw/dragimag.h" +# endif + +#elif defined(__WXMOTIF__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXGTK__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXX11__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXMAC__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXPM__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#endif + +#endif // wxUSE_DRAGIMAGE + +#endif + // _WX_DRAGIMAG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/dynarray.h b/Externals/wxWidgets/include/wx/dynarray.h index 3cde91ae7a..5dfb8bf269 100644 --- a/Externals/wxWidgets/include/wx/dynarray.h +++ b/Externals/wxWidgets/include/wx/dynarray.h @@ -1,1044 +1,1044 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/dynarray.h -// Purpose: auto-resizable (i.e. dynamic) array support -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.09.97 -// RCS-ID: $Id: dynarray.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _DYNARRAY_H -#define _DYNARRAY_H - -#include "wx/defs.h" - -#if wxUSE_STL - #include "wx/beforestd.h" - #include - #include - #include "wx/afterstd.h" -#endif - -/* - This header defines the dynamic arrays and object arrays (i.e. arrays which - own their elements). Dynamic means that the arrays grow automatically as - needed. - - These macros are ugly (especially if you look in the sources ;-), but they - allow us to define "template" classes without actually using templates and so - this works with all compilers (and may be also much faster to compile even - with a compiler which does support templates). The arrays defined with these - macros are type-safe. - - Range checking is performed in debug build for both arrays and objarrays but - not in release build - so using an invalid index will just lead to a crash - then. - - Note about memory usage: arrays never shrink automatically (although you may - use Shrink() function explicitly), they only grow, so loading 10 millions in - an array only to delete them 2 lines below might be a bad idea if the array - object is not going to be destroyed soon. However, as it does free memory - when destroyed, it is ok if the array is a local variable. - */ - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -/* - The initial size by which an array grows when an element is added default - value avoids allocate one or two bytes when the array is created which is - rather inefficient -*/ -#define WX_ARRAY_DEFAULT_INITIAL_SIZE (16) - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -/* - Callback compare function for quick sort. - - It must return negative value, 0 or positive value if the first item is - less than, equal to or greater than the second one. - */ -extern "C" -{ -typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); -} - -// ---------------------------------------------------------------------------- -// Base class managing data having size of type 'long' (not used directly) -// -// NB: for efficiency this often used class has no virtual functions (hence no -// virtual table), even dtor is *not* virtual. If used as expected it -// won't create any problems because ARRAYs from DEFINE_ARRAY have no dtor -// at all, so it's not too important if it's not called (this happens when -// you cast "SomeArray *" as "BaseArray *" and then delete it) -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -template -class WXDLLIMPEXP_BASE wxArray_SortFunction -{ -public: - typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2); - - wxArray_SortFunction(CMPFUNC f) : m_f(f) { } - bool operator()(const T& i1, const T& i2) - { return m_f((T*)&i1, (T*)&i2) < 0; } -private: - CMPFUNC m_f; -}; - -template -class WXDLLIMPEXP_BASE wxSortedArray_SortFunction -{ -public: - typedef F CMPFUNC; - - wxSortedArray_SortFunction(CMPFUNC f) : m_f(f) { } - bool operator()(const T& i1, const T& i2) - { return m_f(i1, i2) < 0; } -private: - CMPFUNC m_f; -}; - -#define _WX_DECLARE_BASEARRAY(T, name, classexp) \ - typedef int (wxCMPFUNC_CONV *CMPFUN##name)(T pItem1, T pItem2); \ - typedef wxSortedArray_SortFunction name##_Predicate; \ - _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp) - -#define _WX_DECLARE_BASEARRAY_2(T, name, predicate, classexp) \ -classexp name : public std::vector \ -{ \ - typedef predicate Predicate; \ - typedef predicate::CMPFUNC SCMPFUNC; \ -public: \ - typedef wxArray_SortFunction::CMPFUNC CMPFUNC; \ -public: \ - void Empty() { clear(); } \ - void Clear() { clear(); } \ - void Alloc(size_t uiSize) { reserve(uiSize); } \ - void Shrink(); \ - \ - size_t GetCount() const { return size(); } \ - void SetCount(size_t n, T v = T()) { resize(n, v); } \ - bool IsEmpty() const { return empty(); } \ - size_t Count() const { return size(); } \ - \ - typedef T base_type; \ - \ -protected: \ - T& Item(size_t uiIndex) const \ - { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); } \ - \ - int Index(T e, bool bFromEnd = false) const; \ - int Index(T lItem, CMPFUNC fnCompare) const; \ - size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ - void Add(T lItem, size_t nInsert = 1) \ - { insert(end(), nInsert, lItem); } \ - size_t Add(T lItem, CMPFUNC fnCompare); \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ - { insert(begin() + uiIndex, nInsert, lItem); } \ - void Remove(T lItem); \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ - \ - void Sort(CMPFUNC fCmp) \ - { \ - wxArray_SortFunction p(fCmp); \ - std::sort(begin(), end(), p); \ - } \ -} - -#else // if !wxUSE_STL - -#define _WX_DECLARE_BASEARRAY(T, name, classexp) \ -classexp name \ -{ \ - typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STL */ \ -public: \ - name(); \ - name(const name& array); \ - name& operator=(const name& src); \ - ~name(); \ - \ - void Empty() { m_nCount = 0; } \ - void Clear(); \ - void Alloc(size_t n) { if ( n > m_nSize ) Realloc(n); } \ - void Shrink(); \ - \ - size_t GetCount() const { return m_nCount; } \ - void SetCount(size_t n, T defval = T()); \ - bool IsEmpty() const { return m_nCount == 0; } \ - size_t Count() const { return m_nCount; } \ - \ - typedef T base_type; \ - \ -protected: \ - T& Item(size_t uiIndex) const \ - { wxASSERT( uiIndex < m_nCount ); return m_pItems[uiIndex]; } \ - T& operator[](size_t uiIndex) const { return Item(uiIndex); } \ - \ - int Index(T lItem, bool bFromEnd = false) const; \ - int Index(T lItem, CMPFUNC fnCompare) const; \ - size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ - void Add(T lItem, size_t nInsert = 1); \ - size_t Add(T lItem, CMPFUNC fnCompare); \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1); \ - void Remove(T lItem); \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1); \ - \ - void Sort(CMPFUNC fnCompare); \ - \ - /* *minimal* STL-ish interface, for derived classes */ \ - typedef T value_type; \ - typedef value_type* iterator; \ - typedef const value_type* const_iterator; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - typedef int difference_type; \ - typedef size_t size_type; \ - \ - void assign(const_iterator first, const_iterator last); \ - void assign(size_type n, const_reference v); \ - size_type capacity() const { return m_nSize; } \ - iterator erase(iterator first, iterator last) \ - { \ - size_type idx = first - begin(); \ - RemoveAt(idx, last - first); \ - return begin() + idx; \ - } \ - iterator erase(iterator it) { return erase(it, it + 1); } \ - void insert(iterator it, size_type n, const value_type& v) \ - { Insert(v, it - begin(), n); } \ - iterator insert(iterator it, const value_type& v = value_type()) \ - { \ - size_type idx = it - begin(); \ - Insert(v, idx); \ - return begin() + idx; \ - } \ - void insert(iterator it, const_iterator first, const_iterator last);\ - void pop_back() { RemoveAt(size() - 1); } \ - void push_back(const value_type& v) { Add(v); } \ - void reserve(size_type n) { Alloc(n); } \ - void resize(size_type n, value_type v = value_type()) \ - { SetCount(n, v); } \ - \ - iterator begin() { return m_pItems; } \ - iterator end() { return m_pItems + m_nCount; } \ - const_iterator begin() const { return m_pItems; } \ - const_iterator end() const { return m_pItems + m_nCount; } \ - \ - /* the following functions may be made directly public because */ \ - /* they don't use the type of the elements at all */ \ -public: \ - void clear() { Clear(); } \ - bool empty() const { return IsEmpty(); } \ - size_type max_size() const { return INT_MAX; } \ - size_type size() const { return GetCount(); } \ - \ -private: \ - void Grow(size_t nIncrement = 0); \ - bool Realloc(size_t nSize); \ - \ - size_t m_nSize, \ - m_nCount; \ - \ - T *m_pItems; \ -} - -#endif // !wxUSE_STL - -// ============================================================================ -// The private helper macros containing the core of the array classes -// ============================================================================ - -// Implementation notes: -// -// JACS: Salford C++ doesn't like 'var->operator=' syntax, as in: -// { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); -// so using a temporary variable instead. -// -// The classes need a (even trivial) ~name() to link under Mac X -// -// _WX_ERROR_REMOVE is needed to resolve the name conflict between the wxT() -// macro and T typedef: we can't use wxT() inside WX_DEFINE_ARRAY! - -#define _WX_ERROR_REMOVE wxT("removing inexisting element in wxArray::Remove") - -// ---------------------------------------------------------------------------- -// _WX_DEFINE_TYPEARRAY: array for simple types -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ -typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ -classexp name : public base \ -{ \ -public: \ - T& operator[](size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Item(size_t uiIndex) const \ - { return (T&)/*const cast*/base::operator[](uiIndex); } \ - T& Last() const \ - { return Item(Count() - 1); } \ - \ - int Index(T e, bool bFromEnd = false) const \ - { return base::Index(e, bFromEnd); } \ - \ - void Add(T lItem, size_t nInsert = 1) \ - { insert(end(), nInsert, lItem); } \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ - { insert(begin() + uiIndex, nInsert, lItem); } \ - \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { base::RemoveAt(uiIndex, nRemove); } \ - void Remove(T lItem) \ - { int iIndex = Index(lItem); \ - wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ - _WX_ERROR_REMOVE); \ - RemoveAt((size_t)iIndex); } \ - \ - void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ -} - -#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ - _WX_DEFINE_TYPEARRAY(T, name, base, classexp) - -#else // if !wxUSE_STL - -// common declaration used by both _WX_DEFINE_TYPEARRAY and -// _WX_DEFINE_TYPEARRAY_PTR -#define _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, ptrop) \ -wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \ - TypeTooBigToBeStoredIn##base, \ - name); \ -typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ -classexp name : public base \ -{ \ -public: \ - name() { } \ - ~name() { } \ - \ - name& operator=(const name& src) \ - { base* temp = (base*) this; \ - (*temp) = ((const base&)src); \ - return *this; } \ - \ - T& operator[](size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Item(size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Last() const \ - { return (T&)(base::operator[](Count() - 1)); } \ - \ - int Index(T lItem, bool bFromEnd = false) const \ - { return base::Index((base_type)lItem, bFromEnd); } \ - \ - void Add(T lItem, size_t nInsert = 1) \ - { base::Add((base_type)lItem, nInsert); } \ - void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ - { base::Insert((base_type)lItem, uiIndex, nInsert) ; } \ - \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { base::RemoveAt(uiIndex, nRemove); } \ - void Remove(T lItem) \ - { int iIndex = Index(lItem); \ - wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ - _WX_ERROR_REMOVE); \ - base::RemoveAt((size_t)iIndex); } \ - \ - void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ - \ - /* STL-like interface */ \ -private: \ - typedef base::iterator biterator; \ - typedef base::const_iterator bconst_iterator; \ - typedef base::value_type bvalue_type; \ - typedef base::const_reference bconst_reference; \ -public: \ - typedef T value_type; \ - typedef value_type* pointer; \ - typedef const value_type* const_pointer; \ - typedef value_type* iterator; \ - typedef const value_type* const_iterator; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - typedef base::difference_type difference_type; \ - typedef base::size_type size_type; \ - \ - class reverse_iterator \ - { \ - typedef T value_type; \ - typedef value_type& reference; \ - typedef value_type* pointer; \ - typedef reverse_iterator itor; \ - friend inline itor operator+(int o, const itor& it) \ - { return it.m_ptr - o; } \ - friend inline itor operator+(const itor& it, int o) \ - { return it.m_ptr - o; } \ - friend inline itor operator-(const itor& it, int o) \ - { return it.m_ptr + o; } \ - friend inline difference_type operator-(const itor& i1, \ - const itor& i2) \ - { return i1.m_ptr - i2.m_ptr; } \ - \ - public: \ - pointer m_ptr; \ - reverse_iterator() : m_ptr(NULL) { } \ - reverse_iterator(pointer ptr) : m_ptr(ptr) { } \ - reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \ - reference operator*() const { return *m_ptr; } \ - ptrop \ - itor& operator++() { --m_ptr; return *this; } \ - const itor operator++(int) \ - { reverse_iterator tmp = *this; --m_ptr; return tmp; } \ - itor& operator--() { ++m_ptr; return *this; } \ - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\ - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\ - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ - }; \ - \ - class const_reverse_iterator \ - { \ - typedef T value_type; \ - typedef const value_type& reference; \ - typedef const value_type* pointer; \ - typedef const_reverse_iterator itor; \ - friend inline itor operator+(int o, const itor& it) \ - { return it.m_ptr - o; } \ - friend inline itor operator+(const itor& it, int o) \ - { return it.m_ptr - o; } \ - friend inline itor operator-(const itor& it, int o) \ - { return it.m_ptr + o; } \ - friend inline difference_type operator-(const itor& i1, \ - const itor& i2) \ - { return i1.m_ptr - i2.m_ptr; } \ - \ - public: \ - pointer m_ptr; \ - const_reverse_iterator() : m_ptr(NULL) { } \ - const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } \ - const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \ - const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }\ - reference operator*() const { return *m_ptr; } \ - ptrop \ - itor& operator++() { --m_ptr; return *this; } \ - const itor operator++(int) \ - { itor tmp = *this; --m_ptr; return tmp; } \ - itor& operator--() { ++m_ptr; return *this; } \ - const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\ - bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\ - bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ - }; \ - \ - name(size_type n, const_reference v) { assign(n, v); } \ - name(const_iterator first, const_iterator last) \ - { assign(first, last); } \ - void assign(const_iterator first, const_iterator last) \ - { base::assign((bconst_iterator)first, (bconst_iterator)last); } \ - void assign(size_type n, const_reference v) \ - { base::assign(n, (bconst_reference)v); } \ - reference back() { return *(end() - 1); } \ - const_reference back() const { return *(end() - 1); } \ - iterator begin() { return (iterator)base::begin(); } \ - const_iterator begin() const { return (const_iterator)base::begin(); }\ - size_type capacity() const { return base::capacity(); } \ - iterator end() { return (iterator)base::end(); } \ - const_iterator end() const { return (const_iterator)base::end(); } \ - iterator erase(iterator first, iterator last) \ - { return (iterator)base::erase((biterator)first, (biterator)last); }\ - iterator erase(iterator it) \ - { return (iterator)base::erase((biterator)it); } \ - reference front() { return *begin(); } \ - const_reference front() const { return *begin(); } \ - void insert(iterator it, size_type n, const_reference v) \ - { base::insert((biterator)it, n, (bconst_reference)v); } \ - iterator insert(iterator it, const_reference v = value_type()) \ - { return (iterator)base::insert((biterator)it, (bconst_reference)v); }\ - void insert(iterator it, const_iterator first, const_iterator last) \ - { base::insert((biterator)it, (bconst_iterator)first, \ - (bconst_iterator)last); } \ - void pop_back() { base::pop_back(); } \ - void push_back(const_reference v) \ - { base::push_back((bconst_reference)v); } \ - reverse_iterator rbegin() { return reverse_iterator(end() - 1); } \ - const_reverse_iterator rbegin() const; \ - reverse_iterator rend() { return reverse_iterator(begin() - 1); } \ - const_reverse_iterator rend() const; \ - void reserve(size_type n) { base::reserve(n); } \ - void resize(size_type n, value_type v = value_type()) \ - { base::resize(n, v); } \ -} - -#define _WX_PTROP pointer operator->() const { return m_ptr; } -#define _WX_PTROP_NONE - -#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ - _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP) -#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ - _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP_NONE) - -#endif // !wxUSE_STL - -// ---------------------------------------------------------------------------- -// _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types -// cannot handle types with size greater than pointer because of sorting -// ---------------------------------------------------------------------------- - -#define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classexp, comptype)\ -wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \ - TypeTooBigToBeStoredInSorted##base, \ - name); \ -classexp name : public base \ -{ \ - typedef comptype SCMPFUNC; \ -public: \ - name(comptype fn defcomp) { m_fnCompare = fn; } \ - \ - name& operator=(const name& src) \ - { base* temp = (base*) this; \ - (*temp) = ((const base&)src); \ - m_fnCompare = src.m_fnCompare; \ - return *this; } \ - \ - T& operator[](size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Item(size_t uiIndex) const \ - { return (T&)(base::operator[](uiIndex)); } \ - T& Last() const \ - { return (T&)(base::operator[](size() - 1)); } \ - \ - int Index(T lItem) const \ - { return base::Index(lItem, (CMPFUNC)m_fnCompare); } \ - \ - size_t IndexForInsert(T lItem) const \ - { return base::IndexForInsert(lItem, (CMPFUNC)m_fnCompare); } \ - \ - void AddAt(T item, size_t index) \ - { base::insert(begin() + index, item); } \ - \ - size_t Add(T lItem) \ - { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \ - \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ - { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ - void Remove(T lItem) \ - { int iIndex = Index(lItem); \ - wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ - _WX_ERROR_REMOVE ); \ - base::erase(begin() + iIndex); } \ - \ -private: \ - comptype m_fnCompare; \ -} - - -// ---------------------------------------------------------------------------- -// _WX_DECLARE_OBJARRAY: an array for pointers to type T with owning semantics -// ---------------------------------------------------------------------------- - -#define _WX_DECLARE_OBJARRAY(T, name, base, classexp) \ -typedef int (CMPFUNC_CONV *CMPFUNC##T)(T **pItem1, T **pItem2); \ -classexp name : protected base \ -{ \ -typedef int (CMPFUNC_CONV *CMPFUNC##base)(void **pItem1, void **pItem2); \ -typedef base base_array; \ -public: \ - name() { } \ - name(const name& src); \ - name& operator=(const name& src); \ - \ - ~name(); \ - \ - void Alloc(size_t count) { reserve(count); } \ - size_t GetCount() const { return base_array::size(); } \ - size_t size() const { return base_array::size(); } \ - bool IsEmpty() const { return base_array::empty(); } \ - bool empty() const { return base_array::empty(); } \ - size_t Count() const { return base_array::size(); } \ - void Shrink() { base::Shrink(); } \ - \ - T& operator[](size_t uiIndex) const \ - { return *(T*)base::operator[](uiIndex); } \ - T& Item(size_t uiIndex) const \ - { return *(T*)base::operator[](uiIndex); } \ - T& Last() const \ - { return *(T*)(base::operator[](size() - 1)); } \ - \ - int Index(const T& lItem, bool bFromEnd = false) const; \ - \ - void Add(const T& lItem, size_t nInsert = 1); \ - void Add(const T* pItem) \ - { base::push_back((T*)pItem); } \ - void push_back(const T* pItem) \ - { base::push_back((T*)pItem); } \ - void push_back(const T& lItem) \ - { Add(lItem); } \ - \ - void Insert(const T& lItem, size_t uiIndex, size_t nInsert = 1); \ - void Insert(const T* pItem, size_t uiIndex) \ - { base::insert(begin() + uiIndex, (T*)pItem); } \ - \ - void Empty() { DoEmpty(); base::clear(); } \ - void Clear() { DoEmpty(); base::clear(); } \ - \ - T* Detach(size_t uiIndex) \ - { T* p = (T*)base::operator[](uiIndex); \ - base::erase(begin() + uiIndex); return p; } \ - void RemoveAt(size_t uiIndex, size_t nRemove = 1); \ - \ - void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC##base)fCmp); } \ - \ -private: \ - void DoEmpty(); \ - void DoCopy(const name& src); \ -} - -// ============================================================================ -// The public macros for declaration and definition of the dynamic arrays -// ============================================================================ - -// Please note that for each macro WX_FOO_ARRAY we also have -// WX_FOO_EXPORTED_ARRAY and WX_FOO_USER_EXPORTED_ARRAY which are exactly the -// same except that they use an additional __declspec(dllexport) or equivalent -// under Windows if needed. -// -// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL -// and so must be used used inside the library. The second kind (USER_EXPORTED) -// allow the user code to do it when it wants. This is needed if you have a dll -// that wants to export a wxArray daubed with your own import/export goo. -// -// Finally, you can define the macro below as something special to modify the -// arrays defined by a simple WX_FOO_ARRAY as well. By default is is empty. -#define wxARRAY_DEFAULT_EXPORT - -// ---------------------------------------------------------------------------- -// WX_DECLARE_BASEARRAY(T, name) declare an array class named "name" containing -// the elements of type T -// ---------------------------------------------------------------------------- - -#define WX_DECLARE_BASEARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, wxARRAY_DEFAULT_EXPORT) - -#define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, WXDLLEXPORT) - -#define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \ - typedef T _wxArray##name; \ - _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode) - -// ---------------------------------------------------------------------------- -// WX_DEFINE_TYPEARRAY(T, name, base) define an array class named "name" deriving -// from class "base" containing the elements of type T -// -// Note that the class defined has only inline function and doesn't take any -// space at all so there is no size penalty for defining multiple array classes -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_TYPEARRAY(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_TYPEARRAY_PTR(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLEXPORT) - -#define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLEXPORT) - -#define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl) - -#define WX_DEFINE_USER_EXPORTED_TYPEARRAY_PTR(T, name, base, expdecl) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class expdecl) - -#define WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) \ - typedef T _wxArray##name; \ - _WX_DEFINE_TYPEARRAY(_wxArray##name, name, base, classdecl) - -#define WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, classdecl) \ - typedef T _wxArray##name; \ - _WX_DEFINE_TYPEARRAY_PTR(_wxArray##name, name, base, classdecl) - -// ---------------------------------------------------------------------------- -// WX_DEFINE_SORTED_TYPEARRAY: this is the same as the previous macro, but it -// defines a sorted array. -// -// Differences: -// 1) it must be given a COMPARE function in ctor which takes 2 items of type -// T* and should return -1, 0 or +1 if the first one is less/greater -// than/equal to the second one. -// 2) the Add() method inserts the item in such was that the array is always -// sorted (it uses the COMPARE function) -// 3) it has no Sort() method because it's always sorted -// 4) Index() method is much faster (the sorted arrays use binary search -// instead of linear one), but Add() is slower. -// 5) there is no Insert() method because you can't insert an item into the -// given position in a sorted array but there is IndexForInsert()/AddAt() -// pair which may be used to optimize a common operation of "insert only if -// not found" -// -// Note that you have to specify the comparison function when creating the -// objects of this array type. If, as in 99% of cases, the comparison function -// is the same for all objects of a class, WX_DEFINE_SORTED_TYPEARRAY_CMP below -// is more convenient. -// -// Summary: use this class when the speed of Index() function is important, use -// the normal arrays otherwise. -// ---------------------------------------------------------------------------- - -// we need a macro which expands to nothing to pass correct number of -// parameters to a nested macro invocation even when we don't have anything to -// pass it -#define wxARRAY_EMPTY - -#define WX_DEFINE_SORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, \ - wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLEXPORT) - -#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \ - typedef T _wxArray##name; \ - typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \ - _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, \ - wxARRAY_EMPTY, class expmode, SCMPFUNC##name) - -// ---------------------------------------------------------------------------- -// WX_DEFINE_SORTED_TYPEARRAY_CMP: exactly the same as above but the comparison -// function is provided by this macro and the objects of this class have a -// default constructor which just uses it. -// -// The arguments are: the element type, the comparison function and the array -// name -// -// NB: this is, of course, how WX_DEFINE_SORTED_TYPEARRAY() should have worked -// from the very beginning - unfortunately I didn't think about this earlier -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - wxARRAY_DEFAULT_EXPORT) - -#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - WXDLLEXPORT) - -#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ - expmode) \ - typedef T _wxArray##name; \ - typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \ - _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, = cmpfunc, \ - class expmode, SCMPFUNC##name) - -// ---------------------------------------------------------------------------- -// WX_DECLARE_OBJARRAY(T, name): this macro generates a new array class -// named "name" which owns the objects of type T it contains, i.e. it will -// delete them when it is destroyed. -// -// An element is of type T*, but arguments of type T& are taken (see below!) -// and T& is returned. -// -// Don't use this for simple types such as "int" or "long"! -// -// Note on Add/Insert functions: -// 1) function(T*) gives the object to the array, i.e. it will delete the -// object when it's removed or in the array's dtor -// 2) function(T&) will create a copy of the object and work with it -// -// Also: -// 1) Remove() will delete the object after removing it from the array -// 2) Detach() just removes the object from the array (returning pointer to it) -// -// NB1: Base type T should have an accessible copy ctor if Add(T&) is used -// NB2: Never ever cast a array to it's base type: as dtor is not virtual -// and so you risk having at least the memory leaks and probably worse -// -// Some functions of this class are not inline, so it takes some space to -// define new class from this template even if you don't use it - which is not -// the case for the simple (non-object) array classes -// -// To use an objarray class you must -// #include "dynarray.h" -// WX_DECLARE_OBJARRAY(element_type, list_class_name) -// #include "arrimpl.cpp" -// WX_DEFINE_OBJARRAY(list_class_name) // name must be the same as above! -// -// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the -// element_type must be fully defined (i.e. forward declaration is not -// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of -// two allows to break cicrcular dependencies with classes which have member -// variables of objarray type. -// ---------------------------------------------------------------------------- - -#define WX_DECLARE_OBJARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT) - -#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \ - WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLEXPORT) - -#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, decl) \ - typedef T _wxObjArray##name; \ - _WX_DECLARE_OBJARRAY(_wxObjArray##name, name, wxArrayPtrVoid, decl) - -#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \ - WX_DECLARE_OBJARRAY_WITH_DECL(T, name, class expmode) - -// WX_DEFINE_OBJARRAY is going to be redefined when arrimpl.cpp is included, -// try to provoke a human-understandable error if it used incorrectly. -// -// there is no real need for 3 different macros in the DEFINE case but do it -// anyhow for consistency -#define WX_DEFINE_OBJARRAY(name) DidYouIncludeArrimplCpp -#define WX_DEFINE_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) -#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) - -// ---------------------------------------------------------------------------- -// Some commonly used predefined base arrays -// ---------------------------------------------------------------------------- - -WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid, - WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE); -WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// Convenience macros to define arrays from base arrays -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_ARRAY(T, name) \ - WX_DEFINE_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_ARRAY_PTR(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_EXPORTED_ARRAY(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_EXPORTED_ARRAY_PTR(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_ARRAY_WITH_DECL_PTR(T, name, decl) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, decl) -#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) -#define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_CHAR(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar) -#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar) -#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_SHORT(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort) -#define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayShort) -#define WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_INT(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayInt) -#define WX_DEFINE_EXPORTED_ARRAY_INT(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayInt) -#define WX_DEFINE_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayInt, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_LONG(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayLong) -#define WX_DEFINE_EXPORTED_ARRAY_LONG(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayLong) -#define WX_DEFINE_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayLong, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) -#define WX_DEFINE_EXPORTED_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) -#define WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_ARRAY_DOUBLE(T, name) \ - WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) -#define WX_DEFINE_EXPORTED_ARRAY_DOUBLE(T, name) \ - WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) -#define WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(T, name, expmode) \ - WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayDouble, wxARRAY_EMPTY expmode) - -// ---------------------------------------------------------------------------- -// Convenience macros to define sorted arrays from base arrays -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_SORTED_ARRAY(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_SHORT(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_INT(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_INT(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt, expmode) - -#define WX_DEFINE_SORTED_ARRAY_LONG(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong, expmode) - -#define WX_DEFINE_SORTED_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SIZE_T(T, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) - -// ---------------------------------------------------------------------------- -// Convenience macros to define sorted arrays from base arrays -// ---------------------------------------------------------------------------- - -#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayPtrVoid, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayChar, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayShort, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayInt, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArrayLong, \ - wxARRAY_EMPTY expmode) - -#define WX_DEFINE_SORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ - WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ - WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) -#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, \ - name, expmode) \ - WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ - wxBaseArraySizeT, \ - wxARRAY_EMPTY expmode) - -// ---------------------------------------------------------------------------- -// Some commonly used predefined arrays -// ---------------------------------------------------------------------------- - -WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(short, wxArrayShort, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_INT(int, wxArrayInt, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxArrayDouble, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_LONG(long, wxArrayLong, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE); - -// ----------------------------------------------------------------------------- -// convenience macros -// ----------------------------------------------------------------------------- - -// prepend all element of one array to another one; e.g. if first array contains -// elements X,Y,Z and the second contains A,B,C (in those orders), then the -// first array will be result as A,B,C,X,Y,Z -#define WX_PREPEND_ARRAY(array, other) \ - { \ - size_t wxAAcnt = (other).size(); \ - (array).Alloc(wxAAcnt); \ - for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ - { \ - (array).Insert((other)[wxAAn], wxAAn); \ - } \ - } - -// append all element of one array to another one -#define WX_APPEND_ARRAY(array, other) \ - { \ - size_t wxAAcnt = (other).size(); \ - (array).Alloc(wxAAcnt); \ - for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ - { \ - (array).push_back((other)[wxAAn]); \ - } \ - } - -// delete all array elements -// -// NB: the class declaration of the array elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_ARRAY(array) \ - { \ - size_t wxAAcnt = (array).size(); \ - for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ - { \ - delete (array)[wxAAn]; \ - } \ - \ - (array).clear(); \ - } - -#endif // _DYNARRAY_H +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dynarray.h +// Purpose: auto-resizable (i.e. dynamic) array support +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.09.97 +// RCS-ID: $Id: dynarray.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _DYNARRAY_H +#define _DYNARRAY_H + +#include "wx/defs.h" + +#if wxUSE_STL + #include "wx/beforestd.h" + #include + #include + #include "wx/afterstd.h" +#endif + +/* + This header defines the dynamic arrays and object arrays (i.e. arrays which + own their elements). Dynamic means that the arrays grow automatically as + needed. + + These macros are ugly (especially if you look in the sources ;-), but they + allow us to define "template" classes without actually using templates and so + this works with all compilers (and may be also much faster to compile even + with a compiler which does support templates). The arrays defined with these + macros are type-safe. + + Range checking is performed in debug build for both arrays and objarrays but + not in release build - so using an invalid index will just lead to a crash + then. + + Note about memory usage: arrays never shrink automatically (although you may + use Shrink() function explicitly), they only grow, so loading 10 millions in + an array only to delete them 2 lines below might be a bad idea if the array + object is not going to be destroyed soon. However, as it does free memory + when destroyed, it is ok if the array is a local variable. + */ + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +/* + The initial size by which an array grows when an element is added default + value avoids allocate one or two bytes when the array is created which is + rather inefficient +*/ +#define WX_ARRAY_DEFAULT_INITIAL_SIZE (16) + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +/* + Callback compare function for quick sort. + + It must return negative value, 0 or positive value if the first item is + less than, equal to or greater than the second one. + */ +extern "C" +{ +typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); +} + +// ---------------------------------------------------------------------------- +// Base class managing data having size of type 'long' (not used directly) +// +// NB: for efficiency this often used class has no virtual functions (hence no +// virtual table), even dtor is *not* virtual. If used as expected it +// won't create any problems because ARRAYs from DEFINE_ARRAY have no dtor +// at all, so it's not too important if it's not called (this happens when +// you cast "SomeArray *" as "BaseArray *" and then delete it) +// ---------------------------------------------------------------------------- + +#if wxUSE_STL + +template +class WXDLLIMPEXP_BASE wxArray_SortFunction +{ +public: + typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2); + + wxArray_SortFunction(CMPFUNC f) : m_f(f) { } + bool operator()(const T& i1, const T& i2) + { return m_f((T*)&i1, (T*)&i2) < 0; } +private: + CMPFUNC m_f; +}; + +template +class WXDLLIMPEXP_BASE wxSortedArray_SortFunction +{ +public: + typedef F CMPFUNC; + + wxSortedArray_SortFunction(CMPFUNC f) : m_f(f) { } + bool operator()(const T& i1, const T& i2) + { return m_f(i1, i2) < 0; } +private: + CMPFUNC m_f; +}; + +#define _WX_DECLARE_BASEARRAY(T, name, classexp) \ + typedef int (wxCMPFUNC_CONV *CMPFUN##name)(T pItem1, T pItem2); \ + typedef wxSortedArray_SortFunction name##_Predicate; \ + _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp) + +#define _WX_DECLARE_BASEARRAY_2(T, name, predicate, classexp) \ +classexp name : public std::vector \ +{ \ + typedef predicate Predicate; \ + typedef predicate::CMPFUNC SCMPFUNC; \ +public: \ + typedef wxArray_SortFunction::CMPFUNC CMPFUNC; \ +public: \ + void Empty() { clear(); } \ + void Clear() { clear(); } \ + void Alloc(size_t uiSize) { reserve(uiSize); } \ + void Shrink(); \ + \ + size_t GetCount() const { return size(); } \ + void SetCount(size_t n, T v = T()) { resize(n, v); } \ + bool IsEmpty() const { return empty(); } \ + size_t Count() const { return size(); } \ + \ + typedef T base_type; \ + \ +protected: \ + T& Item(size_t uiIndex) const \ + { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); } \ + \ + int Index(T e, bool bFromEnd = false) const; \ + int Index(T lItem, CMPFUNC fnCompare) const; \ + size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ + void Add(T lItem, size_t nInsert = 1) \ + { insert(end(), nInsert, lItem); } \ + size_t Add(T lItem, CMPFUNC fnCompare); \ + void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ + { insert(begin() + uiIndex, nInsert, lItem); } \ + void Remove(T lItem); \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ + { erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ + \ + void Sort(CMPFUNC fCmp) \ + { \ + wxArray_SortFunction p(fCmp); \ + std::sort(begin(), end(), p); \ + } \ +} + +#else // if !wxUSE_STL + +#define _WX_DECLARE_BASEARRAY(T, name, classexp) \ +classexp name \ +{ \ + typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STL */ \ +public: \ + name(); \ + name(const name& array); \ + name& operator=(const name& src); \ + ~name(); \ + \ + void Empty() { m_nCount = 0; } \ + void Clear(); \ + void Alloc(size_t n) { if ( n > m_nSize ) Realloc(n); } \ + void Shrink(); \ + \ + size_t GetCount() const { return m_nCount; } \ + void SetCount(size_t n, T defval = T()); \ + bool IsEmpty() const { return m_nCount == 0; } \ + size_t Count() const { return m_nCount; } \ + \ + typedef T base_type; \ + \ +protected: \ + T& Item(size_t uiIndex) const \ + { wxASSERT( uiIndex < m_nCount ); return m_pItems[uiIndex]; } \ + T& operator[](size_t uiIndex) const { return Item(uiIndex); } \ + \ + int Index(T lItem, bool bFromEnd = false) const; \ + int Index(T lItem, CMPFUNC fnCompare) const; \ + size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \ + void Add(T lItem, size_t nInsert = 1); \ + size_t Add(T lItem, CMPFUNC fnCompare); \ + void Insert(T lItem, size_t uiIndex, size_t nInsert = 1); \ + void Remove(T lItem); \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1); \ + \ + void Sort(CMPFUNC fnCompare); \ + \ + /* *minimal* STL-ish interface, for derived classes */ \ + typedef T value_type; \ + typedef value_type* iterator; \ + typedef const value_type* const_iterator; \ + typedef value_type& reference; \ + typedef const value_type& const_reference; \ + typedef int difference_type; \ + typedef size_t size_type; \ + \ + void assign(const_iterator first, const_iterator last); \ + void assign(size_type n, const_reference v); \ + size_type capacity() const { return m_nSize; } \ + iterator erase(iterator first, iterator last) \ + { \ + size_type idx = first - begin(); \ + RemoveAt(idx, last - first); \ + return begin() + idx; \ + } \ + iterator erase(iterator it) { return erase(it, it + 1); } \ + void insert(iterator it, size_type n, const value_type& v) \ + { Insert(v, it - begin(), n); } \ + iterator insert(iterator it, const value_type& v = value_type()) \ + { \ + size_type idx = it - begin(); \ + Insert(v, idx); \ + return begin() + idx; \ + } \ + void insert(iterator it, const_iterator first, const_iterator last);\ + void pop_back() { RemoveAt(size() - 1); } \ + void push_back(const value_type& v) { Add(v); } \ + void reserve(size_type n) { Alloc(n); } \ + void resize(size_type n, value_type v = value_type()) \ + { SetCount(n, v); } \ + \ + iterator begin() { return m_pItems; } \ + iterator end() { return m_pItems + m_nCount; } \ + const_iterator begin() const { return m_pItems; } \ + const_iterator end() const { return m_pItems + m_nCount; } \ + \ + /* the following functions may be made directly public because */ \ + /* they don't use the type of the elements at all */ \ +public: \ + void clear() { Clear(); } \ + bool empty() const { return IsEmpty(); } \ + size_type max_size() const { return INT_MAX; } \ + size_type size() const { return GetCount(); } \ + \ +private: \ + void Grow(size_t nIncrement = 0); \ + bool Realloc(size_t nSize); \ + \ + size_t m_nSize, \ + m_nCount; \ + \ + T *m_pItems; \ +} + +#endif // !wxUSE_STL + +// ============================================================================ +// The private helper macros containing the core of the array classes +// ============================================================================ + +// Implementation notes: +// +// JACS: Salford C++ doesn't like 'var->operator=' syntax, as in: +// { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); +// so using a temporary variable instead. +// +// The classes need a (even trivial) ~name() to link under Mac X +// +// _WX_ERROR_REMOVE is needed to resolve the name conflict between the wxT() +// macro and T typedef: we can't use wxT() inside WX_DEFINE_ARRAY! + +#define _WX_ERROR_REMOVE wxT("removing inexisting element in wxArray::Remove") + +// ---------------------------------------------------------------------------- +// _WX_DEFINE_TYPEARRAY: array for simple types +// ---------------------------------------------------------------------------- + +#if wxUSE_STL + +#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ +typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ +classexp name : public base \ +{ \ +public: \ + T& operator[](size_t uiIndex) const \ + { return (T&)(base::operator[](uiIndex)); } \ + T& Item(size_t uiIndex) const \ + { return (T&)/*const cast*/base::operator[](uiIndex); } \ + T& Last() const \ + { return Item(Count() - 1); } \ + \ + int Index(T e, bool bFromEnd = false) const \ + { return base::Index(e, bFromEnd); } \ + \ + void Add(T lItem, size_t nInsert = 1) \ + { insert(end(), nInsert, lItem); } \ + void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ + { insert(begin() + uiIndex, nInsert, lItem); } \ + \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ + { base::RemoveAt(uiIndex, nRemove); } \ + void Remove(T lItem) \ + { int iIndex = Index(lItem); \ + wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ + _WX_ERROR_REMOVE); \ + RemoveAt((size_t)iIndex); } \ + \ + void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ +} + +#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ + _WX_DEFINE_TYPEARRAY(T, name, base, classexp) + +#else // if !wxUSE_STL + +// common declaration used by both _WX_DEFINE_TYPEARRAY and +// _WX_DEFINE_TYPEARRAY_PTR +#define _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, ptrop) \ +wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \ + TypeTooBigToBeStoredIn##base, \ + name); \ +typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ +classexp name : public base \ +{ \ +public: \ + name() { } \ + ~name() { } \ + \ + name& operator=(const name& src) \ + { base* temp = (base*) this; \ + (*temp) = ((const base&)src); \ + return *this; } \ + \ + T& operator[](size_t uiIndex) const \ + { return (T&)(base::operator[](uiIndex)); } \ + T& Item(size_t uiIndex) const \ + { return (T&)(base::operator[](uiIndex)); } \ + T& Last() const \ + { return (T&)(base::operator[](Count() - 1)); } \ + \ + int Index(T lItem, bool bFromEnd = false) const \ + { return base::Index((base_type)lItem, bFromEnd); } \ + \ + void Add(T lItem, size_t nInsert = 1) \ + { base::Add((base_type)lItem, nInsert); } \ + void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \ + { base::Insert((base_type)lItem, uiIndex, nInsert) ; } \ + \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ + { base::RemoveAt(uiIndex, nRemove); } \ + void Remove(T lItem) \ + { int iIndex = Index(lItem); \ + wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ + _WX_ERROR_REMOVE); \ + base::RemoveAt((size_t)iIndex); } \ + \ + void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \ + \ + /* STL-like interface */ \ +private: \ + typedef base::iterator biterator; \ + typedef base::const_iterator bconst_iterator; \ + typedef base::value_type bvalue_type; \ + typedef base::const_reference bconst_reference; \ +public: \ + typedef T value_type; \ + typedef value_type* pointer; \ + typedef const value_type* const_pointer; \ + typedef value_type* iterator; \ + typedef const value_type* const_iterator; \ + typedef value_type& reference; \ + typedef const value_type& const_reference; \ + typedef base::difference_type difference_type; \ + typedef base::size_type size_type; \ + \ + class reverse_iterator \ + { \ + typedef T value_type; \ + typedef value_type& reference; \ + typedef value_type* pointer; \ + typedef reverse_iterator itor; \ + friend inline itor operator+(int o, const itor& it) \ + { return it.m_ptr - o; } \ + friend inline itor operator+(const itor& it, int o) \ + { return it.m_ptr - o; } \ + friend inline itor operator-(const itor& it, int o) \ + { return it.m_ptr + o; } \ + friend inline difference_type operator-(const itor& i1, \ + const itor& i2) \ + { return i1.m_ptr - i2.m_ptr; } \ + \ + public: \ + pointer m_ptr; \ + reverse_iterator() : m_ptr(NULL) { } \ + reverse_iterator(pointer ptr) : m_ptr(ptr) { } \ + reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \ + reference operator*() const { return *m_ptr; } \ + ptrop \ + itor& operator++() { --m_ptr; return *this; } \ + const itor operator++(int) \ + { reverse_iterator tmp = *this; --m_ptr; return tmp; } \ + itor& operator--() { ++m_ptr; return *this; } \ + const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\ + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\ + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ + }; \ + \ + class const_reverse_iterator \ + { \ + typedef T value_type; \ + typedef const value_type& reference; \ + typedef const value_type* pointer; \ + typedef const_reverse_iterator itor; \ + friend inline itor operator+(int o, const itor& it) \ + { return it.m_ptr - o; } \ + friend inline itor operator+(const itor& it, int o) \ + { return it.m_ptr - o; } \ + friend inline itor operator-(const itor& it, int o) \ + { return it.m_ptr + o; } \ + friend inline difference_type operator-(const itor& i1, \ + const itor& i2) \ + { return i1.m_ptr - i2.m_ptr; } \ + \ + public: \ + pointer m_ptr; \ + const_reverse_iterator() : m_ptr(NULL) { } \ + const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } \ + const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \ + const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }\ + reference operator*() const { return *m_ptr; } \ + ptrop \ + itor& operator++() { --m_ptr; return *this; } \ + const itor operator++(int) \ + { itor tmp = *this; --m_ptr; return tmp; } \ + itor& operator--() { ++m_ptr; return *this; } \ + const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\ + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\ + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ + }; \ + \ + name(size_type n, const_reference v) { assign(n, v); } \ + name(const_iterator first, const_iterator last) \ + { assign(first, last); } \ + void assign(const_iterator first, const_iterator last) \ + { base::assign((bconst_iterator)first, (bconst_iterator)last); } \ + void assign(size_type n, const_reference v) \ + { base::assign(n, (bconst_reference)v); } \ + reference back() { return *(end() - 1); } \ + const_reference back() const { return *(end() - 1); } \ + iterator begin() { return (iterator)base::begin(); } \ + const_iterator begin() const { return (const_iterator)base::begin(); }\ + size_type capacity() const { return base::capacity(); } \ + iterator end() { return (iterator)base::end(); } \ + const_iterator end() const { return (const_iterator)base::end(); } \ + iterator erase(iterator first, iterator last) \ + { return (iterator)base::erase((biterator)first, (biterator)last); }\ + iterator erase(iterator it) \ + { return (iterator)base::erase((biterator)it); } \ + reference front() { return *begin(); } \ + const_reference front() const { return *begin(); } \ + void insert(iterator it, size_type n, const_reference v) \ + { base::insert((biterator)it, n, (bconst_reference)v); } \ + iterator insert(iterator it, const_reference v = value_type()) \ + { return (iterator)base::insert((biterator)it, (bconst_reference)v); }\ + void insert(iterator it, const_iterator first, const_iterator last) \ + { base::insert((biterator)it, (bconst_iterator)first, \ + (bconst_iterator)last); } \ + void pop_back() { base::pop_back(); } \ + void push_back(const_reference v) \ + { base::push_back((bconst_reference)v); } \ + reverse_iterator rbegin() { return reverse_iterator(end() - 1); } \ + const_reverse_iterator rbegin() const; \ + reverse_iterator rend() { return reverse_iterator(begin() - 1); } \ + const_reverse_iterator rend() const; \ + void reserve(size_type n) { base::reserve(n); } \ + void resize(size_type n, value_type v = value_type()) \ + { base::resize(n, v); } \ +} + +#define _WX_PTROP pointer operator->() const { return m_ptr; } +#define _WX_PTROP_NONE + +#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \ + _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP) +#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \ + _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP_NONE) + +#endif // !wxUSE_STL + +// ---------------------------------------------------------------------------- +// _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types +// cannot handle types with size greater than pointer because of sorting +// ---------------------------------------------------------------------------- + +#define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classexp, comptype)\ +wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \ + TypeTooBigToBeStoredInSorted##base, \ + name); \ +classexp name : public base \ +{ \ + typedef comptype SCMPFUNC; \ +public: \ + name(comptype fn defcomp) { m_fnCompare = fn; } \ + \ + name& operator=(const name& src) \ + { base* temp = (base*) this; \ + (*temp) = ((const base&)src); \ + m_fnCompare = src.m_fnCompare; \ + return *this; } \ + \ + T& operator[](size_t uiIndex) const \ + { return (T&)(base::operator[](uiIndex)); } \ + T& Item(size_t uiIndex) const \ + { return (T&)(base::operator[](uiIndex)); } \ + T& Last() const \ + { return (T&)(base::operator[](size() - 1)); } \ + \ + int Index(T lItem) const \ + { return base::Index(lItem, (CMPFUNC)m_fnCompare); } \ + \ + size_t IndexForInsert(T lItem) const \ + { return base::IndexForInsert(lItem, (CMPFUNC)m_fnCompare); } \ + \ + void AddAt(T item, size_t index) \ + { base::insert(begin() + index, item); } \ + \ + size_t Add(T lItem) \ + { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \ + \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ + { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ + void Remove(T lItem) \ + { int iIndex = Index(lItem); \ + wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \ + _WX_ERROR_REMOVE ); \ + base::erase(begin() + iIndex); } \ + \ +private: \ + comptype m_fnCompare; \ +} + + +// ---------------------------------------------------------------------------- +// _WX_DECLARE_OBJARRAY: an array for pointers to type T with owning semantics +// ---------------------------------------------------------------------------- + +#define _WX_DECLARE_OBJARRAY(T, name, base, classexp) \ +typedef int (CMPFUNC_CONV *CMPFUNC##T)(T **pItem1, T **pItem2); \ +classexp name : protected base \ +{ \ +typedef int (CMPFUNC_CONV *CMPFUNC##base)(void **pItem1, void **pItem2); \ +typedef base base_array; \ +public: \ + name() { } \ + name(const name& src); \ + name& operator=(const name& src); \ + \ + ~name(); \ + \ + void Alloc(size_t count) { reserve(count); } \ + size_t GetCount() const { return base_array::size(); } \ + size_t size() const { return base_array::size(); } \ + bool IsEmpty() const { return base_array::empty(); } \ + bool empty() const { return base_array::empty(); } \ + size_t Count() const { return base_array::size(); } \ + void Shrink() { base::Shrink(); } \ + \ + T& operator[](size_t uiIndex) const \ + { return *(T*)base::operator[](uiIndex); } \ + T& Item(size_t uiIndex) const \ + { return *(T*)base::operator[](uiIndex); } \ + T& Last() const \ + { return *(T*)(base::operator[](size() - 1)); } \ + \ + int Index(const T& lItem, bool bFromEnd = false) const; \ + \ + void Add(const T& lItem, size_t nInsert = 1); \ + void Add(const T* pItem) \ + { base::push_back((T*)pItem); } \ + void push_back(const T* pItem) \ + { base::push_back((T*)pItem); } \ + void push_back(const T& lItem) \ + { Add(lItem); } \ + \ + void Insert(const T& lItem, size_t uiIndex, size_t nInsert = 1); \ + void Insert(const T* pItem, size_t uiIndex) \ + { base::insert(begin() + uiIndex, (T*)pItem); } \ + \ + void Empty() { DoEmpty(); base::clear(); } \ + void Clear() { DoEmpty(); base::clear(); } \ + \ + T* Detach(size_t uiIndex) \ + { T* p = (T*)base::operator[](uiIndex); \ + base::erase(begin() + uiIndex); return p; } \ + void RemoveAt(size_t uiIndex, size_t nRemove = 1); \ + \ + void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC##base)fCmp); } \ + \ +private: \ + void DoEmpty(); \ + void DoCopy(const name& src); \ +} + +// ============================================================================ +// The public macros for declaration and definition of the dynamic arrays +// ============================================================================ + +// Please note that for each macro WX_FOO_ARRAY we also have +// WX_FOO_EXPORTED_ARRAY and WX_FOO_USER_EXPORTED_ARRAY which are exactly the +// same except that they use an additional __declspec(dllexport) or equivalent +// under Windows if needed. +// +// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL +// and so must be used used inside the library. The second kind (USER_EXPORTED) +// allow the user code to do it when it wants. This is needed if you have a dll +// that wants to export a wxArray daubed with your own import/export goo. +// +// Finally, you can define the macro below as something special to modify the +// arrays defined by a simple WX_FOO_ARRAY as well. By default is is empty. +#define wxARRAY_DEFAULT_EXPORT + +// ---------------------------------------------------------------------------- +// WX_DECLARE_BASEARRAY(T, name) declare an array class named "name" containing +// the elements of type T +// ---------------------------------------------------------------------------- + +#define WX_DECLARE_BASEARRAY(T, name) \ + WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, wxARRAY_DEFAULT_EXPORT) + +#define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \ + WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, WXDLLEXPORT) + +#define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \ + typedef T _wxArray##name; \ + _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_TYPEARRAY(T, name, base) define an array class named "name" deriving +// from class "base" containing the elements of type T +// +// Note that the class defined has only inline function and doesn't take any +// space at all so there is no size penalty for defining multiple array classes +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_TYPEARRAY(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_TYPEARRAY_PTR(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLEXPORT) + +#define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLEXPORT) + +#define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl) + +#define WX_DEFINE_USER_EXPORTED_TYPEARRAY_PTR(T, name, base, expdecl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class expdecl) + +#define WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) \ + typedef T _wxArray##name; \ + _WX_DEFINE_TYPEARRAY(_wxArray##name, name, base, classdecl) + +#define WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, classdecl) \ + typedef T _wxArray##name; \ + _WX_DEFINE_TYPEARRAY_PTR(_wxArray##name, name, base, classdecl) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_SORTED_TYPEARRAY: this is the same as the previous macro, but it +// defines a sorted array. +// +// Differences: +// 1) it must be given a COMPARE function in ctor which takes 2 items of type +// T* and should return -1, 0 or +1 if the first one is less/greater +// than/equal to the second one. +// 2) the Add() method inserts the item in such was that the array is always +// sorted (it uses the COMPARE function) +// 3) it has no Sort() method because it's always sorted +// 4) Index() method is much faster (the sorted arrays use binary search +// instead of linear one), but Add() is slower. +// 5) there is no Insert() method because you can't insert an item into the +// given position in a sorted array but there is IndexForInsert()/AddAt() +// pair which may be used to optimize a common operation of "insert only if +// not found" +// +// Note that you have to specify the comparison function when creating the +// objects of this array type. If, as in 99% of cases, the comparison function +// is the same for all objects of a class, WX_DEFINE_SORTED_TYPEARRAY_CMP below +// is more convenient. +// +// Summary: use this class when the speed of Index() function is important, use +// the normal arrays otherwise. +// ---------------------------------------------------------------------------- + +// we need a macro which expands to nothing to pass correct number of +// parameters to a nested macro invocation even when we don't have anything to +// pass it +#define wxARRAY_EMPTY + +#define WX_DEFINE_SORTED_TYPEARRAY(T, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, \ + wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLEXPORT) + +#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \ + typedef T _wxArray##name; \ + typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \ + _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, \ + wxARRAY_EMPTY, class expmode, SCMPFUNC##name) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_SORTED_TYPEARRAY_CMP: exactly the same as above but the comparison +// function is provided by this macro and the objects of this class have a +// default constructor which just uses it. +// +// The arguments are: the element type, the comparison function and the array +// name +// +// NB: this is, of course, how WX_DEFINE_SORTED_TYPEARRAY() should have worked +// from the very beginning - unfortunately I didn't think about this earlier +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ + wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ + WXDLLEXPORT) + +#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ + expmode) \ + typedef T _wxArray##name; \ + typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \ + _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, = cmpfunc, \ + class expmode, SCMPFUNC##name) + +// ---------------------------------------------------------------------------- +// WX_DECLARE_OBJARRAY(T, name): this macro generates a new array class +// named "name" which owns the objects of type T it contains, i.e. it will +// delete them when it is destroyed. +// +// An element is of type T*, but arguments of type T& are taken (see below!) +// and T& is returned. +// +// Don't use this for simple types such as "int" or "long"! +// +// Note on Add/Insert functions: +// 1) function(T*) gives the object to the array, i.e. it will delete the +// object when it's removed or in the array's dtor +// 2) function(T&) will create a copy of the object and work with it +// +// Also: +// 1) Remove() will delete the object after removing it from the array +// 2) Detach() just removes the object from the array (returning pointer to it) +// +// NB1: Base type T should have an accessible copy ctor if Add(T&) is used +// NB2: Never ever cast a array to it's base type: as dtor is not virtual +// and so you risk having at least the memory leaks and probably worse +// +// Some functions of this class are not inline, so it takes some space to +// define new class from this template even if you don't use it - which is not +// the case for the simple (non-object) array classes +// +// To use an objarray class you must +// #include "dynarray.h" +// WX_DECLARE_OBJARRAY(element_type, list_class_name) +// #include "arrimpl.cpp" +// WX_DEFINE_OBJARRAY(list_class_name) // name must be the same as above! +// +// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the +// element_type must be fully defined (i.e. forward declaration is not +// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of +// two allows to break cicrcular dependencies with classes which have member +// variables of objarray type. +// ---------------------------------------------------------------------------- + +#define WX_DECLARE_OBJARRAY(T, name) \ + WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT) + +#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \ + WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLEXPORT) + +#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, decl) \ + typedef T _wxObjArray##name; \ + _WX_DECLARE_OBJARRAY(_wxObjArray##name, name, wxArrayPtrVoid, decl) + +#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \ + WX_DECLARE_OBJARRAY_WITH_DECL(T, name, class expmode) + +// WX_DEFINE_OBJARRAY is going to be redefined when arrimpl.cpp is included, +// try to provoke a human-understandable error if it used incorrectly. +// +// there is no real need for 3 different macros in the DEFINE case but do it +// anyhow for consistency +#define WX_DEFINE_OBJARRAY(name) DidYouIncludeArrimplCpp +#define WX_DEFINE_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) +#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) + +// ---------------------------------------------------------------------------- +// Some commonly used predefined base arrays +// ---------------------------------------------------------------------------- + +WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid, + WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// Convenience macros to define arrays from base arrays +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_ARRAY(T, name) \ + WX_DEFINE_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_ARRAY_PTR(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_EXPORTED_ARRAY(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_EXPORTED_ARRAY_PTR(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_ARRAY_WITH_DECL_PTR(T, name, decl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, decl) +#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) +#define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_CHAR(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar) +#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar) +#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_SHORT(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort) +#define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayShort) +#define WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_INT(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayInt) +#define WX_DEFINE_EXPORTED_ARRAY_INT(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayInt) +#define WX_DEFINE_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayInt, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_LONG(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayLong) +#define WX_DEFINE_EXPORTED_ARRAY_LONG(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayLong) +#define WX_DEFINE_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayLong, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) +#define WX_DEFINE_EXPORTED_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) +#define WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_DOUBLE(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) +#define WX_DEFINE_EXPORTED_ARRAY_DOUBLE(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) +#define WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayDouble, wxARRAY_EMPTY expmode) + +// ---------------------------------------------------------------------------- +// Convenience macros to define sorted arrays from base arrays +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_SORTED_ARRAY(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_SHORT(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_INT(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_INT(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt, expmode) + +#define WX_DEFINE_SORTED_ARRAY_LONG(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong, expmode) + +#define WX_DEFINE_SORTED_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) + +// ---------------------------------------------------------------------------- +// Convenience macros to define sorted arrays from base arrays +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayPtrVoid, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayChar, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayShort, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayInt, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayLong, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArraySizeT, \ + wxARRAY_EMPTY expmode) + +// ---------------------------------------------------------------------------- +// Some commonly used predefined arrays +// ---------------------------------------------------------------------------- + +WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(short, wxArrayShort, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_INT(int, wxArrayInt, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxArrayDouble, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_LONG(long, wxArrayLong, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE); + +// ----------------------------------------------------------------------------- +// convenience macros +// ----------------------------------------------------------------------------- + +// prepend all element of one array to another one; e.g. if first array contains +// elements X,Y,Z and the second contains A,B,C (in those orders), then the +// first array will be result as A,B,C,X,Y,Z +#define WX_PREPEND_ARRAY(array, other) \ + { \ + size_t wxAAcnt = (other).size(); \ + (array).Alloc(wxAAcnt); \ + for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ + { \ + (array).Insert((other)[wxAAn], wxAAn); \ + } \ + } + +// append all element of one array to another one +#define WX_APPEND_ARRAY(array, other) \ + { \ + size_t wxAAcnt = (other).size(); \ + (array).Alloc(wxAAcnt); \ + for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ + { \ + (array).push_back((other)[wxAAn]); \ + } \ + } + +// delete all array elements +// +// NB: the class declaration of the array elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_ARRAY(array) \ + { \ + size_t wxAAcnt = (array).size(); \ + for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ + { \ + delete (array)[wxAAn]; \ + } \ + \ + (array).clear(); \ + } + +#endif // _DYNARRAY_H diff --git a/Externals/wxWidgets/include/wx/dynlib.h b/Externals/wxWidgets/include/wx/dynlib.h index c48f3c8801..bb58b10267 100644 --- a/Externals/wxWidgets/include/wx/dynlib.h +++ b/Externals/wxWidgets/include/wx/dynlib.h @@ -1,325 +1,325 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/dynlib.h -// Purpose: Dynamic library loading classes -// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik -// Modified by: -// Created: 20/07/98 -// RCS-ID: $Id: dynlib.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DYNLIB_H__ -#define _WX_DYNLIB_H__ - -#include "wx/defs.h" - -#if wxUSE_DYNLIB_CLASS - -#include "wx/string.h" -#include "wx/dynarray.h" - -#if defined(__OS2__) || defined(__EMX__) -#include "wx/os2/private.h" -#endif - -#ifdef __WXMSW__ -#include "wx/msw/private.h" -#endif - -// note that we have our own dlerror() implementation under Darwin -#if (defined(HAVE_DLERROR) && !defined(__EMX__)) || defined(__DARWIN__) - #define wxHAVE_DYNLIB_ERROR -#endif - -class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator; - -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -// Note: __OS2__/EMX has to be tested first, since we want to use -// native version, even if configure detected presence of DLOPEN. -#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__) - typedef HMODULE wxDllType; -#elif defined(__DARWIN__) - // Don't include dlfcn.h on Darwin, we may be using our own replacements. - typedef void *wxDllType; -#elif defined(HAVE_DLOPEN) - #include - typedef void *wxDllType; -#elif defined(HAVE_SHL_LOAD) - #include - typedef shl_t wxDllType; -#elif defined(__WXMAC__) - #include - typedef CFragConnectionID wxDllType; -#else - #error "Dynamic Loading classes can't be compiled on this platform, sorry." -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum wxDLFlags -{ - wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use - // (only works on some Unix versions) - wxDL_NOW = 0x00000002, // resolve undefined symbols on load - // (default, always the case under Win32) - wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently - // loaded libs. - wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library - // name without appending the usual dll - // filename extension. - wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded - // (only for wxPluginManager) - - wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32 -}; - -enum wxDynamicLibraryCategory -{ - wxDL_LIBRARY, // standard library - wxDL_MODULE // loadable module/plugin -}; - -enum wxPluginCategory -{ - wxDL_PLUGIN_GUI, // plugin that uses GUI classes - wxDL_PLUGIN_BASE // wxBase-only plugin -}; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// when loading a function from a DLL you always have to cast the returned -// "void *" pointer to the correct type and, even more annoyingly, you have to -// repeat this type twice if you want to declare and define a function pointer -// all in one line -// -// this macro makes this slightly less painful by allowing you to specify the -// type only once, as the first parameter, and creating a variable of this type -// called "pfn" initialized with the "name" from the "dynlib" -#define wxDYNLIB_FUNCTION(type, name, dynlib) \ - type pfn ## name = (type)(dynlib).GetSymbol(_T(#name)) - -// ---------------------------------------------------------------------------- -// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDynamicLibraryDetails -{ -public: - // ctor, normally never used as these objects are only created by - // wxDynamicLibrary::ListLoaded() - wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; } - - // get the (base) name - wxString GetName() const { return m_name; } - - // get the full path of this object - wxString GetPath() const { return m_path; } - - // get the load address and the extent, return true if this information is - // available - bool GetAddress(void **addr, size_t *len) const - { - if ( !m_address ) - return false; - - if ( addr ) - *addr = m_address; - if ( len ) - *len = m_length; - - return true; - } - - // return the version of the DLL (may be empty if no version info) - wxString GetVersion() const - { - return m_version; - } - -private: - wxString m_name, - m_path, - m_version; - - void *m_address; - size_t m_length; - - friend class wxDynamicLibraryDetailsCreator; -}; - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails, - wxDynamicLibraryDetailsArray, - WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// wxDynamicLibrary: represents a handle to a DLL/shared object -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxDynamicLibrary -{ -public: - // return a valid handle for the main program itself or NULL if back - // linking is not supported by the current platform (e.g. Win32) - static wxDllType GetProgramHandle(); - - // return the platform standard DLL extension (with leading dot) - static const wxChar *GetDllExt() { return ms_dllext; } - - wxDynamicLibrary() : m_handle(0) { } - wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) - : m_handle(0) - { - Load(libname, flags); - } - - // NOTE: this class is (deliberately) not virtual, do not attempt - // to use it polymorphically. - ~wxDynamicLibrary() { Unload(); } - - // return true if the library was loaded successfully - bool IsLoaded() const { return m_handle != 0; } - - // load the library with the given name (full or not), return true if ok - bool Load(const wxString& libname, int flags = wxDL_DEFAULT); - - // raw function for loading dynamic libs: always behaves as if - // wxDL_VERBATIM were specified and doesn't log error message if the - // library couldn't be loaded but simply returns NULL - static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT); - - // detach the library object from its handle, i.e. prevent the object from - // unloading the library in its dtor -- the caller is now responsible for - // doing this - wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; } - - // unload the given library handle (presumably returned by Detach() before) - static void Unload(wxDllType handle); - - // unload the library, also done automatically in dtor - void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } } - - // Return the raw handle from dlopen and friends. - wxDllType GetLibHandle() const { return m_handle; } - - // check if the given symbol is present in the library, useful to verify if - // a loadable module is our plugin, for example, without provoking error - // messages from GetSymbol() - bool HasSymbol(const wxString& name) const - { - bool ok; - DoGetSymbol(name, &ok); - return ok; - } - - // resolve a symbol in a loaded DLL, such as a variable or function name. - // 'name' is the (possibly mangled) name of the symbol. (use extern "C" to - // export unmangled names) - // - // Since it is perfectly valid for the returned symbol to actually be NULL, - // that is not always indication of an error. Pass and test the parameter - // 'success' for a true indication of success or failure to load the - // symbol. - // - // Returns a pointer to the symbol on success, or NULL if an error occurred - // or the symbol wasn't found. - void *GetSymbol(const wxString& name, bool *success = NULL) const; - - // low-level version of GetSymbol() - static void *RawGetSymbol(wxDllType handle, const wxString& name); - void *RawGetSymbol(const wxString& name) const - { -#if defined (__WXPM__) || defined(__EMX__) - return GetSymbol(name); -#else - return RawGetSymbol(m_handle, name); -#endif - } - -#ifdef __WXMSW__ - // this function is useful for loading functions from the standard Windows - // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or - // wide character build) suffix if they take string parameters - static void *RawGetSymbolAorW(wxDllType handle, const wxString& name) - { - return RawGetSymbol - ( - handle, - name + -#if wxUSE_UNICODE - L'W' -#else - 'A' -#endif - ); - } - - void *GetSymbolAorW(const wxString& name) const - { - return RawGetSymbolAorW(m_handle, name); - } -#endif // __WXMSW__ - - // return all modules/shared libraries in the address space of this process - // - // returns an empty array if not implemented or an error occurred - static wxDynamicLibraryDetailsArray ListLoaded(); - - // return platform-specific name of dynamic library with proper extension - // and prefix (e.g. "foo.dll" on Windows or "libfoo.so" on Linux) - static wxString CanonicalizeName(const wxString& name, - wxDynamicLibraryCategory cat = wxDL_LIBRARY); - - // return name of wxWidgets plugin (adds compiler and version info - // to the filename): - static wxString - CanonicalizePluginName(const wxString& name, - wxPluginCategory cat = wxDL_PLUGIN_GUI); - - // return plugin directory on platforms where it makes sense and empty - // string on others: - static wxString GetPluginsDirectory(); - - -protected: - // common part of GetSymbol() and HasSymbol() - void *DoGetSymbol(const wxString& name, bool *success = 0) const; - -#ifdef wxHAVE_DYNLIB_ERROR - // log the error after a dlxxx() function failure - static void Error(); -#endif // wxHAVE_DYNLIB_ERROR - - - // platform specific shared lib suffix. - static const wxChar *ms_dllext; - - // the handle to DLL or NULL - wxDllType m_handle; - - // no copy ctor/assignment operators (or we'd try to unload the library - // twice) - DECLARE_NO_COPY_CLASS(wxDynamicLibrary) -}; - - -// ---------------------------------------------------------------------------- -// Interesting defines -// ---------------------------------------------------------------------------- - -#define WXDLL_ENTRY_FUNCTION() \ -extern "C" WXEXPORT const wxClassInfo *wxGetClassFirst(); \ -const wxClassInfo *wxGetClassFirst() { \ - return wxClassInfo::GetFirst(); \ -} - -#endif // wxUSE_DYNLIB_CLASS - -#endif // _WX_DYNLIB_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dynlib.h +// Purpose: Dynamic library loading classes +// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik +// Modified by: +// Created: 20/07/98 +// RCS-ID: $Id: dynlib.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DYNLIB_H__ +#define _WX_DYNLIB_H__ + +#include "wx/defs.h" + +#if wxUSE_DYNLIB_CLASS + +#include "wx/string.h" +#include "wx/dynarray.h" + +#if defined(__OS2__) || defined(__EMX__) +#include "wx/os2/private.h" +#endif + +#ifdef __WXMSW__ +#include "wx/msw/private.h" +#endif + +// note that we have our own dlerror() implementation under Darwin +#if (defined(HAVE_DLERROR) && !defined(__EMX__)) || defined(__DARWIN__) + #define wxHAVE_DYNLIB_ERROR +#endif + +class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator; + +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +// Note: __OS2__/EMX has to be tested first, since we want to use +// native version, even if configure detected presence of DLOPEN. +#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__) + typedef HMODULE wxDllType; +#elif defined(__DARWIN__) + // Don't include dlfcn.h on Darwin, we may be using our own replacements. + typedef void *wxDllType; +#elif defined(HAVE_DLOPEN) + #include + typedef void *wxDllType; +#elif defined(HAVE_SHL_LOAD) + #include + typedef shl_t wxDllType; +#elif defined(__WXMAC__) + #include + typedef CFragConnectionID wxDllType; +#else + #error "Dynamic Loading classes can't be compiled on this platform, sorry." +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxDLFlags +{ + wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use + // (only works on some Unix versions) + wxDL_NOW = 0x00000002, // resolve undefined symbols on load + // (default, always the case under Win32) + wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently + // loaded libs. + wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library + // name without appending the usual dll + // filename extension. + wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded + // (only for wxPluginManager) + + wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32 +}; + +enum wxDynamicLibraryCategory +{ + wxDL_LIBRARY, // standard library + wxDL_MODULE // loadable module/plugin +}; + +enum wxPluginCategory +{ + wxDL_PLUGIN_GUI, // plugin that uses GUI classes + wxDL_PLUGIN_BASE // wxBase-only plugin +}; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// when loading a function from a DLL you always have to cast the returned +// "void *" pointer to the correct type and, even more annoyingly, you have to +// repeat this type twice if you want to declare and define a function pointer +// all in one line +// +// this macro makes this slightly less painful by allowing you to specify the +// type only once, as the first parameter, and creating a variable of this type +// called "pfn" initialized with the "name" from the "dynlib" +#define wxDYNLIB_FUNCTION(type, name, dynlib) \ + type pfn ## name = (type)(dynlib).GetSymbol(_T(#name)) + +// ---------------------------------------------------------------------------- +// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDynamicLibraryDetails +{ +public: + // ctor, normally never used as these objects are only created by + // wxDynamicLibrary::ListLoaded() + wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; } + + // get the (base) name + wxString GetName() const { return m_name; } + + // get the full path of this object + wxString GetPath() const { return m_path; } + + // get the load address and the extent, return true if this information is + // available + bool GetAddress(void **addr, size_t *len) const + { + if ( !m_address ) + return false; + + if ( addr ) + *addr = m_address; + if ( len ) + *len = m_length; + + return true; + } + + // return the version of the DLL (may be empty if no version info) + wxString GetVersion() const + { + return m_version; + } + +private: + wxString m_name, + m_path, + m_version; + + void *m_address; + size_t m_length; + + friend class wxDynamicLibraryDetailsCreator; +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails, + wxDynamicLibraryDetailsArray, + WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// wxDynamicLibrary: represents a handle to a DLL/shared object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDynamicLibrary +{ +public: + // return a valid handle for the main program itself or NULL if back + // linking is not supported by the current platform (e.g. Win32) + static wxDllType GetProgramHandle(); + + // return the platform standard DLL extension (with leading dot) + static const wxChar *GetDllExt() { return ms_dllext; } + + wxDynamicLibrary() : m_handle(0) { } + wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) + : m_handle(0) + { + Load(libname, flags); + } + + // NOTE: this class is (deliberately) not virtual, do not attempt + // to use it polymorphically. + ~wxDynamicLibrary() { Unload(); } + + // return true if the library was loaded successfully + bool IsLoaded() const { return m_handle != 0; } + + // load the library with the given name (full or not), return true if ok + bool Load(const wxString& libname, int flags = wxDL_DEFAULT); + + // raw function for loading dynamic libs: always behaves as if + // wxDL_VERBATIM were specified and doesn't log error message if the + // library couldn't be loaded but simply returns NULL + static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT); + + // detach the library object from its handle, i.e. prevent the object from + // unloading the library in its dtor -- the caller is now responsible for + // doing this + wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; } + + // unload the given library handle (presumably returned by Detach() before) + static void Unload(wxDllType handle); + + // unload the library, also done automatically in dtor + void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } } + + // Return the raw handle from dlopen and friends. + wxDllType GetLibHandle() const { return m_handle; } + + // check if the given symbol is present in the library, useful to verify if + // a loadable module is our plugin, for example, without provoking error + // messages from GetSymbol() + bool HasSymbol(const wxString& name) const + { + bool ok; + DoGetSymbol(name, &ok); + return ok; + } + + // resolve a symbol in a loaded DLL, such as a variable or function name. + // 'name' is the (possibly mangled) name of the symbol. (use extern "C" to + // export unmangled names) + // + // Since it is perfectly valid for the returned symbol to actually be NULL, + // that is not always indication of an error. Pass and test the parameter + // 'success' for a true indication of success or failure to load the + // symbol. + // + // Returns a pointer to the symbol on success, or NULL if an error occurred + // or the symbol wasn't found. + void *GetSymbol(const wxString& name, bool *success = NULL) const; + + // low-level version of GetSymbol() + static void *RawGetSymbol(wxDllType handle, const wxString& name); + void *RawGetSymbol(const wxString& name) const + { +#if defined (__WXPM__) || defined(__EMX__) + return GetSymbol(name); +#else + return RawGetSymbol(m_handle, name); +#endif + } + +#ifdef __WXMSW__ + // this function is useful for loading functions from the standard Windows + // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or + // wide character build) suffix if they take string parameters + static void *RawGetSymbolAorW(wxDllType handle, const wxString& name) + { + return RawGetSymbol + ( + handle, + name + +#if wxUSE_UNICODE + L'W' +#else + 'A' +#endif + ); + } + + void *GetSymbolAorW(const wxString& name) const + { + return RawGetSymbolAorW(m_handle, name); + } +#endif // __WXMSW__ + + // return all modules/shared libraries in the address space of this process + // + // returns an empty array if not implemented or an error occurred + static wxDynamicLibraryDetailsArray ListLoaded(); + + // return platform-specific name of dynamic library with proper extension + // and prefix (e.g. "foo.dll" on Windows or "libfoo.so" on Linux) + static wxString CanonicalizeName(const wxString& name, + wxDynamicLibraryCategory cat = wxDL_LIBRARY); + + // return name of wxWidgets plugin (adds compiler and version info + // to the filename): + static wxString + CanonicalizePluginName(const wxString& name, + wxPluginCategory cat = wxDL_PLUGIN_GUI); + + // return plugin directory on platforms where it makes sense and empty + // string on others: + static wxString GetPluginsDirectory(); + + +protected: + // common part of GetSymbol() and HasSymbol() + void *DoGetSymbol(const wxString& name, bool *success = 0) const; + +#ifdef wxHAVE_DYNLIB_ERROR + // log the error after a dlxxx() function failure + static void Error(); +#endif // wxHAVE_DYNLIB_ERROR + + + // platform specific shared lib suffix. + static const wxChar *ms_dllext; + + // the handle to DLL or NULL + wxDllType m_handle; + + // no copy ctor/assignment operators (or we'd try to unload the library + // twice) + DECLARE_NO_COPY_CLASS(wxDynamicLibrary) +}; + + +// ---------------------------------------------------------------------------- +// Interesting defines +// ---------------------------------------------------------------------------- + +#define WXDLL_ENTRY_FUNCTION() \ +extern "C" WXEXPORT const wxClassInfo *wxGetClassFirst(); \ +const wxClassInfo *wxGetClassFirst() { \ + return wxClassInfo::GetFirst(); \ +} + +#endif // wxUSE_DYNLIB_CLASS + +#endif // _WX_DYNLIB_H__ diff --git a/Externals/wxWidgets/include/wx/dynload.h b/Externals/wxWidgets/include/wx/dynload.h index 8f3805f10e..68c63c1eb8 100644 --- a/Externals/wxWidgets/include/wx/dynload.h +++ b/Externals/wxWidgets/include/wx/dynload.h @@ -1,153 +1,153 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dynload.h -// Purpose: Dynamic loading framework -// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's -// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux) -// Modified by: -// Created: 03/12/01 -// RCS-ID: $Id: dynload.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2001 Ron Lee -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DYNAMICLOADER_H__ -#define _WX_DYNAMICLOADER_H__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_DYNAMIC_LOADER - -#include "wx/dynlib.h" -#include "wx/hashmap.h" -#include "wx/module.h" - -class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; - - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest, - class WXDLLIMPEXP_BASE); -typedef wxDLManifest wxDLImports; - -// --------------------------------------------------------------------------- -// wxPluginLibrary -// --------------------------------------------------------------------------- - -// NOTE: Do not attempt to use a base class pointer to this class. -// wxDL is not virtual and we deliberately hide some of it's -// methods here. -// -// Unless you know exacty why you need to, you probably shouldn't -// instantiate this class directly anyway, use wxPluginManager -// instead. - -class WXDLLIMPEXP_BASE wxPluginLibrary : public wxDynamicLibrary -{ -public: - - static wxDLImports* ms_classes; // Static hash of all imported classes. - - wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT ); - ~wxPluginLibrary(); - - wxPluginLibrary *RefLib(); - bool UnrefLib(); - - // These two are called by the PluginSentinel on (PLUGGABLE) object - // creation/destruction. There is usually no reason for the user to - // call them directly. We have to separate this from the link count, - // since the two are not interchangeable. - - // FIXME: for even better debugging PluginSentinel should register - // the name of the class created too, then we can state - // exactly which object was not destroyed which may be - // difficult to find otherwise. Also this code should - // probably only be active in DEBUG mode, but let's just - // get it right first. - - void RefObj() { ++m_objcount; } - void UnrefObj() - { - wxASSERT_MSG( m_objcount > 0, _T("Too many objects deleted??") ); - --m_objcount; - } - - // Override/hide some base class methods - - bool IsLoaded() const { return m_linkcount > 0; } - void Unload() { UnrefLib(); } - -private: - - wxClassInfo *m_before; // sm_first before loading this lib - wxClassInfo *m_after; // ..and after. - - size_t m_linkcount; // Ref count of library link calls - size_t m_objcount; // ..and (pluggable) object instantiations. - wxModuleList m_wxmodules; // any wxModules that we initialised. - - void UpdateClasses(); // Update ms_classes - void RestoreClasses(); // Removes this library from ms_classes - void RegisterModules(); // Init any wxModules in the lib. - void UnregisterModules(); // Cleanup any wxModules we installed. - - DECLARE_NO_COPY_CLASS(wxPluginLibrary) -}; - - -class WXDLLIMPEXP_BASE wxPluginManager -{ -public: - - // Static accessors. - - static wxPluginLibrary *LoadLibrary( const wxString &libname, - int flags = wxDL_DEFAULT ); - static bool UnloadLibrary(const wxString &libname); - - // Instance methods. - - wxPluginManager() : m_entry(NULL) {} - wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT) - { - Load(libname, flags); - } - ~wxPluginManager() { if ( IsLoaded() ) Unload(); } - - bool Load(const wxString &libname, int flags = wxDL_DEFAULT); - void Unload(); - - bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); } - void *GetSymbol(const wxString &symbol, bool *success = 0) - { - return m_entry->GetSymbol( symbol, success ); - } - - static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); } - static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; } - -private: - // return the pointer to the entry for the library with given name in - // ms_manifest or NULL if none - static wxPluginLibrary *FindByName(const wxString& name) - { - const wxDLManifest::iterator i = ms_manifest->find(name); - - return i == ms_manifest->end() ? NULL : i->second; - } - - static wxDLManifest* ms_manifest; // Static hash of loaded libs. - wxPluginLibrary* m_entry; // Cache our entry in the manifest. - - // We could allow this class to be copied if we really - // wanted to, but not without modification. - DECLARE_NO_COPY_CLASS(wxPluginManager) -}; - - -#endif // wxUSE_DYNAMIC_LOADER -#endif // _WX_DYNAMICLOADER_H__ - +///////////////////////////////////////////////////////////////////////////// +// Name: dynload.h +// Purpose: Dynamic loading framework +// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's +// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux) +// Modified by: +// Created: 03/12/01 +// RCS-ID: $Id: dynload.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2001 Ron Lee +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DYNAMICLOADER_H__ +#define _WX_DYNAMICLOADER_H__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_DYNAMIC_LOADER + +#include "wx/dynlib.h" +#include "wx/hashmap.h" +#include "wx/module.h" + +class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; + + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest, + class WXDLLIMPEXP_BASE); +typedef wxDLManifest wxDLImports; + +// --------------------------------------------------------------------------- +// wxPluginLibrary +// --------------------------------------------------------------------------- + +// NOTE: Do not attempt to use a base class pointer to this class. +// wxDL is not virtual and we deliberately hide some of it's +// methods here. +// +// Unless you know exacty why you need to, you probably shouldn't +// instantiate this class directly anyway, use wxPluginManager +// instead. + +class WXDLLIMPEXP_BASE wxPluginLibrary : public wxDynamicLibrary +{ +public: + + static wxDLImports* ms_classes; // Static hash of all imported classes. + + wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT ); + ~wxPluginLibrary(); + + wxPluginLibrary *RefLib(); + bool UnrefLib(); + + // These two are called by the PluginSentinel on (PLUGGABLE) object + // creation/destruction. There is usually no reason for the user to + // call them directly. We have to separate this from the link count, + // since the two are not interchangeable. + + // FIXME: for even better debugging PluginSentinel should register + // the name of the class created too, then we can state + // exactly which object was not destroyed which may be + // difficult to find otherwise. Also this code should + // probably only be active in DEBUG mode, but let's just + // get it right first. + + void RefObj() { ++m_objcount; } + void UnrefObj() + { + wxASSERT_MSG( m_objcount > 0, _T("Too many objects deleted??") ); + --m_objcount; + } + + // Override/hide some base class methods + + bool IsLoaded() const { return m_linkcount > 0; } + void Unload() { UnrefLib(); } + +private: + + wxClassInfo *m_before; // sm_first before loading this lib + wxClassInfo *m_after; // ..and after. + + size_t m_linkcount; // Ref count of library link calls + size_t m_objcount; // ..and (pluggable) object instantiations. + wxModuleList m_wxmodules; // any wxModules that we initialised. + + void UpdateClasses(); // Update ms_classes + void RestoreClasses(); // Removes this library from ms_classes + void RegisterModules(); // Init any wxModules in the lib. + void UnregisterModules(); // Cleanup any wxModules we installed. + + DECLARE_NO_COPY_CLASS(wxPluginLibrary) +}; + + +class WXDLLIMPEXP_BASE wxPluginManager +{ +public: + + // Static accessors. + + static wxPluginLibrary *LoadLibrary( const wxString &libname, + int flags = wxDL_DEFAULT ); + static bool UnloadLibrary(const wxString &libname); + + // Instance methods. + + wxPluginManager() : m_entry(NULL) {} + wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT) + { + Load(libname, flags); + } + ~wxPluginManager() { if ( IsLoaded() ) Unload(); } + + bool Load(const wxString &libname, int flags = wxDL_DEFAULT); + void Unload(); + + bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); } + void *GetSymbol(const wxString &symbol, bool *success = 0) + { + return m_entry->GetSymbol( symbol, success ); + } + + static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); } + static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; } + +private: + // return the pointer to the entry for the library with given name in + // ms_manifest or NULL if none + static wxPluginLibrary *FindByName(const wxString& name) + { + const wxDLManifest::iterator i = ms_manifest->find(name); + + return i == ms_manifest->end() ? NULL : i->second; + } + + static wxDLManifest* ms_manifest; // Static hash of loaded libs. + wxPluginLibrary* m_entry; // Cache our entry in the manifest. + + // We could allow this class to be copied if we really + // wanted to, but not without modification. + DECLARE_NO_COPY_CLASS(wxPluginManager) +}; + + +#endif // wxUSE_DYNAMIC_LOADER +#endif // _WX_DYNAMICLOADER_H__ + diff --git a/Externals/wxWidgets/include/wx/effects.h b/Externals/wxWidgets/include/wx/effects.h index 987ddf51af..b04a3ba635 100644 --- a/Externals/wxWidgets/include/wx/effects.h +++ b/Externals/wxWidgets/include/wx/effects.h @@ -1,75 +1,75 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/effects.h -// Purpose: wxEffects class -// Draws 3D effects. -// Author: Julian Smart et al -// Modified by: -// Created: 25/4/2000 -// RCS-ID: $Id: effects.h 39109 2006-05-08 11:31:03Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EFFECTS_H_ -#define _WX_EFFECTS_H_ - -/* - * wxEffects: various 3D effects - */ - -#include "wx/object.h" -#include "wx/colour.h" -#include "wx/gdicmn.h" -#include "wx/dc.h" - -class WXDLLEXPORT wxEffects: public wxObject -{ -DECLARE_CLASS(wxEffects) - -public: - // Assume system colours - wxEffects() ; - // Going from lightest to darkest - wxEffects(const wxColour& highlightColour, const wxColour& lightShadow, - const wxColour& faceColour, const wxColour& mediumShadow, - const wxColour& darkShadow) ; - - // Accessors - wxColour GetHighlightColour() const { return m_highlightColour; } - wxColour GetLightShadow() const { return m_lightShadow; } - wxColour GetFaceColour() const { return m_faceColour; } - wxColour GetMediumShadow() const { return m_mediumShadow; } - wxColour GetDarkShadow() const { return m_darkShadow; } - - void SetHighlightColour(const wxColour& c) { m_highlightColour = c; } - void SetLightShadow(const wxColour& c) { m_lightShadow = c; } - void SetFaceColour(const wxColour& c) { m_faceColour = c; } - void SetMediumShadow(const wxColour& c) { m_mediumShadow = c; } - void SetDarkShadow(const wxColour& c) { m_darkShadow = c; } - - void Set(const wxColour& highlightColour, const wxColour& lightShadow, - const wxColour& faceColour, const wxColour& mediumShadow, - const wxColour& darkShadow) - { - SetHighlightColour(highlightColour); - SetLightShadow(lightShadow); - SetFaceColour(faceColour); - SetMediumShadow(mediumShadow); - SetDarkShadow(darkShadow); - } - - // Draw a sunken edge - void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1); - - // Tile a bitmap - bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); - -protected: - wxColour m_highlightColour; // Usually white - wxColour m_lightShadow; // Usually light grey - wxColour m_faceColour; // Usually grey - wxColour m_mediumShadow; // Usually dark grey - wxColour m_darkShadow; // Usually black -}; - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/effects.h +// Purpose: wxEffects class +// Draws 3D effects. +// Author: Julian Smart et al +// Modified by: +// Created: 25/4/2000 +// RCS-ID: $Id: effects.h 39109 2006-05-08 11:31:03Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EFFECTS_H_ +#define _WX_EFFECTS_H_ + +/* + * wxEffects: various 3D effects + */ + +#include "wx/object.h" +#include "wx/colour.h" +#include "wx/gdicmn.h" +#include "wx/dc.h" + +class WXDLLEXPORT wxEffects: public wxObject +{ +DECLARE_CLASS(wxEffects) + +public: + // Assume system colours + wxEffects() ; + // Going from lightest to darkest + wxEffects(const wxColour& highlightColour, const wxColour& lightShadow, + const wxColour& faceColour, const wxColour& mediumShadow, + const wxColour& darkShadow) ; + + // Accessors + wxColour GetHighlightColour() const { return m_highlightColour; } + wxColour GetLightShadow() const { return m_lightShadow; } + wxColour GetFaceColour() const { return m_faceColour; } + wxColour GetMediumShadow() const { return m_mediumShadow; } + wxColour GetDarkShadow() const { return m_darkShadow; } + + void SetHighlightColour(const wxColour& c) { m_highlightColour = c; } + void SetLightShadow(const wxColour& c) { m_lightShadow = c; } + void SetFaceColour(const wxColour& c) { m_faceColour = c; } + void SetMediumShadow(const wxColour& c) { m_mediumShadow = c; } + void SetDarkShadow(const wxColour& c) { m_darkShadow = c; } + + void Set(const wxColour& highlightColour, const wxColour& lightShadow, + const wxColour& faceColour, const wxColour& mediumShadow, + const wxColour& darkShadow) + { + SetHighlightColour(highlightColour); + SetLightShadow(lightShadow); + SetFaceColour(faceColour); + SetMediumShadow(mediumShadow); + SetDarkShadow(darkShadow); + } + + // Draw a sunken edge + void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1); + + // Tile a bitmap + bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); + +protected: + wxColour m_highlightColour; // Usually white + wxColour m_lightShadow; // Usually light grey + wxColour m_faceColour; // Usually grey + wxColour m_mediumShadow; // Usually dark grey + wxColour m_darkShadow; // Usually black +}; + +#endif diff --git a/Externals/wxWidgets/include/wx/encconv.h b/Externals/wxWidgets/include/wx/encconv.h index f57d8ea9d8..6a54439eeb 100644 --- a/Externals/wxWidgets/include/wx/encconv.h +++ b/Externals/wxWidgets/include/wx/encconv.h @@ -1,159 +1,159 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/encconv.h -// Purpose: wxEncodingConverter class for converting between different -// font encodings -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ENCCONV_H_ -#define _WX_ENCCONV_H_ - -#include "wx/defs.h" - -#include "wx/object.h" -#include "wx/fontenc.h" -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum -{ - wxCONVERT_STRICT, - wxCONVERT_SUBSTITUTE -}; - - -enum -{ - wxPLATFORM_CURRENT = -1, - - wxPLATFORM_UNIX = 0, - wxPLATFORM_WINDOWS, - wxPLATFORM_OS2, - wxPLATFORM_MAC -}; - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray); - -//-------------------------------------------------------------------------------- -// wxEncodingConverter -// This class is capable of converting strings between any two -// 8bit encodings/charsets. It can also convert from/to Unicode -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject -{ - public: - - wxEncodingConverter(); - virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } - - // Initialize conversion. Both output or input encoding may - // be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1. - // - // All subsequent calls to Convert() will interpret it's argument - // as a string in input_enc encoding and will output string in - // output_enc encoding. - // - // You must call this method before calling Convert. You may call - // it more than once in order to switch to another conversion - // - // Method affects behaviour of Convert() in case input character - // cannot be converted because it does not exist in output encoding: - // wxCONVERT_STRICT -- - // follow behaviour of GNU Recode - just copy unconvertable - // characters to output and don't change them (it's integer - // value will stay the same) - // wxCONVERT_SUBSTITUTE -- - // try some (lossy) substitutions - e.g. replace - // unconvertable latin capitals with acute by ordinary - // capitals, replace en-dash or em-dash by '-' etc. - // both modes gurantee that output string will have same length - // as input string - // - // Returns false if given conversion is impossible, true otherwise - // (conversion may be impossible either if you try to convert - // to Unicode with non-Unicode build of wxWidgets or if input - // or output encoding is not supported.) - bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT); - - // Convert input string according to settings passed to Init. - // Note that you must call Init before using Convert! - bool Convert(const char* input, char* output) const; - bool Convert(char* str) const { return Convert(str, str); } - wxString Convert(const wxString& input) const; - -#if wxUSE_WCHAR_T - bool Convert(const char* input, wchar_t* output) const; - bool Convert(const wchar_t* input, char* output) const; - bool Convert(const wchar_t* input, wchar_t* output) const; - bool Convert(wchar_t* str) const { return Convert(str, str); } -#endif - // Return equivalent(s) for given font that are used - // under given platform. wxPLATFORM_CURRENT means the plaform - // this binary was compiled for - // - // Examples: - // current platform enc returned value - // ----------------------------------------------------- - // unix CP1250 {ISO8859_2} - // unix ISO8859_2 {} - // windows ISO8859_2 {CP1250} - // - // Equivalence is defined in terms of convertibility: - // 2 encodings are equivalent if you can convert text between - // then without loosing information (it may - and will - happen - // that you loose special chars like quotation marks or em-dashes - // but you shouldn't loose any diacritics and language-specific - // characters when converting between equivalent encodings). - // - // Convert() method is not limited to converting between - // equivalent encodings, it can convert between arbitrary - // two encodings! - // - // Remember that this function does _NOT_ check for presence of - // fonts in system. It only tells you what are most suitable - // encodings. (It usually returns only one encoding) - // - // Note that argument enc itself may be present in returned array! - // (so that you can -- as a side effect -- detect whether the - // encoding is native for this platform or not) - static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT); - - // Similar to GetPlatformEquivalent, but this one will return ALL - // equivalent encodings, regardless the platform, including itself. - static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc); - - // Return true if [any text in] one multibyte encoding can be - // converted to another one losslessly. - // - // Do not call this with wxFONTENCODING_UNICODE, it doesn't make - // sense (always works in one sense and always depends on the text - // to convert in the other) - static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut) - { - return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND; - } - - private: - -#if wxUSE_WCHAR_T - wchar_t *m_Table; -#else - char *m_Table; -#endif - bool m_UnicodeInput, m_UnicodeOutput; - bool m_JustCopy; - - DECLARE_NO_COPY_CLASS(wxEncodingConverter) -}; - -#endif // _WX_ENCCONV_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/encconv.h +// Purpose: wxEncodingConverter class for converting between different +// font encodings +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ENCCONV_H_ +#define _WX_ENCCONV_H_ + +#include "wx/defs.h" + +#include "wx/object.h" +#include "wx/fontenc.h" +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum +{ + wxCONVERT_STRICT, + wxCONVERT_SUBSTITUTE +}; + + +enum +{ + wxPLATFORM_CURRENT = -1, + + wxPLATFORM_UNIX = 0, + wxPLATFORM_WINDOWS, + wxPLATFORM_OS2, + wxPLATFORM_MAC +}; + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray); + +//-------------------------------------------------------------------------------- +// wxEncodingConverter +// This class is capable of converting strings between any two +// 8bit encodings/charsets. It can also convert from/to Unicode +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject +{ + public: + + wxEncodingConverter(); + virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } + + // Initialize conversion. Both output or input encoding may + // be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1. + // + // All subsequent calls to Convert() will interpret it's argument + // as a string in input_enc encoding and will output string in + // output_enc encoding. + // + // You must call this method before calling Convert. You may call + // it more than once in order to switch to another conversion + // + // Method affects behaviour of Convert() in case input character + // cannot be converted because it does not exist in output encoding: + // wxCONVERT_STRICT -- + // follow behaviour of GNU Recode - just copy unconvertable + // characters to output and don't change them (it's integer + // value will stay the same) + // wxCONVERT_SUBSTITUTE -- + // try some (lossy) substitutions - e.g. replace + // unconvertable latin capitals with acute by ordinary + // capitals, replace en-dash or em-dash by '-' etc. + // both modes gurantee that output string will have same length + // as input string + // + // Returns false if given conversion is impossible, true otherwise + // (conversion may be impossible either if you try to convert + // to Unicode with non-Unicode build of wxWidgets or if input + // or output encoding is not supported.) + bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT); + + // Convert input string according to settings passed to Init. + // Note that you must call Init before using Convert! + bool Convert(const char* input, char* output) const; + bool Convert(char* str) const { return Convert(str, str); } + wxString Convert(const wxString& input) const; + +#if wxUSE_WCHAR_T + bool Convert(const char* input, wchar_t* output) const; + bool Convert(const wchar_t* input, char* output) const; + bool Convert(const wchar_t* input, wchar_t* output) const; + bool Convert(wchar_t* str) const { return Convert(str, str); } +#endif + // Return equivalent(s) for given font that are used + // under given platform. wxPLATFORM_CURRENT means the plaform + // this binary was compiled for + // + // Examples: + // current platform enc returned value + // ----------------------------------------------------- + // unix CP1250 {ISO8859_2} + // unix ISO8859_2 {} + // windows ISO8859_2 {CP1250} + // + // Equivalence is defined in terms of convertibility: + // 2 encodings are equivalent if you can convert text between + // then without loosing information (it may - and will - happen + // that you loose special chars like quotation marks or em-dashes + // but you shouldn't loose any diacritics and language-specific + // characters when converting between equivalent encodings). + // + // Convert() method is not limited to converting between + // equivalent encodings, it can convert between arbitrary + // two encodings! + // + // Remember that this function does _NOT_ check for presence of + // fonts in system. It only tells you what are most suitable + // encodings. (It usually returns only one encoding) + // + // Note that argument enc itself may be present in returned array! + // (so that you can -- as a side effect -- detect whether the + // encoding is native for this platform or not) + static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT); + + // Similar to GetPlatformEquivalent, but this one will return ALL + // equivalent encodings, regardless the platform, including itself. + static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc); + + // Return true if [any text in] one multibyte encoding can be + // converted to another one losslessly. + // + // Do not call this with wxFONTENCODING_UNICODE, it doesn't make + // sense (always works in one sense and always depends on the text + // to convert in the other) + static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut) + { + return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND; + } + + private: + +#if wxUSE_WCHAR_T + wchar_t *m_Table; +#else + char *m_Table; +#endif + bool m_UnicodeInput, m_UnicodeOutput; + bool m_JustCopy; + + DECLARE_NO_COPY_CLASS(wxEncodingConverter) +}; + +#endif // _WX_ENCCONV_H_ diff --git a/Externals/wxWidgets/include/wx/encinfo.h b/Externals/wxWidgets/include/wx/encinfo.h index fb3d9214f2..99dbddb81d 100644 --- a/Externals/wxWidgets/include/wx/encinfo.h +++ b/Externals/wxWidgets/include/wx/encinfo.h @@ -1,74 +1,74 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/encinfo.h -// Purpose: declares wxNativeEncodingInfo struct -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.09.2003 (extracted from wx/fontenc.h) -// RCS-ID: $Id: encinfo.h 40865 2006-08-27 09:42:42Z VS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ENCINFO_H_ -#define _WX_ENCINFO_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxNativeEncodingInfo contains all encoding parameters for this platform -// ---------------------------------------------------------------------------- - -// This private structure specifies all the parameters needed to create a font -// with the given encoding on this platform. -// -// Under X, it contains the last 2 elements of the font specifications -// (registry and encoding). -// -// Under Windows, it contains a number which is one of predefined CHARSET_XXX -// values. -// -// Under all platforms it also contains a facename string which should be -// used, if not empty, to create fonts in this encoding (this is the only way -// to create a font of non-standard encoding (like KOI8) under Windows - the -// facename specifies the encoding then) - -struct WXDLLEXPORT wxNativeEncodingInfo -{ - wxString facename; // may be empty meaning "any" -#ifndef __WXPALMOS__ - wxFontEncoding encoding; // so that we know what this struct represents - -#if defined(__WXMSW__) || \ - defined(__WXPM__) || \ - defined(__WXMAC__) || \ - defined(__WXCOCOA__) // FIXME: __WXCOCOA__ - - wxNativeEncodingInfo() - : facename() - , encoding(wxFONTENCODING_SYSTEM) - , charset(0) /* ANSI_CHARSET */ - { } - - int charset; -#elif defined(_WX_X_FONTLIKE) - wxString xregistry, - xencoding; -#elif defined(__WXGTK20__) - // No way to specify this in Pango as this - // seems to be handled internally. -#elif defined(__WXMGL__) - int mglEncoding; -#elif defined(__WXDFB__) - // DirectFB uses UTF-8 internally, doesn't use font encodings -#else - #error "Unsupported toolkit" -#endif -#endif // !__WXPALMOS__ - // this struct is saved in config by wxFontMapper, so it should know to - // serialise itself (implemented in platform-specific code) - bool FromString(const wxString& s); - wxString ToString() const; -}; - -#endif // _WX_ENCINFO_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/encinfo.h +// Purpose: declares wxNativeEncodingInfo struct +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.09.2003 (extracted from wx/fontenc.h) +// RCS-ID: $Id: encinfo.h 40865 2006-08-27 09:42:42Z VS $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ENCINFO_H_ +#define _WX_ENCINFO_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxNativeEncodingInfo contains all encoding parameters for this platform +// ---------------------------------------------------------------------------- + +// This private structure specifies all the parameters needed to create a font +// with the given encoding on this platform. +// +// Under X, it contains the last 2 elements of the font specifications +// (registry and encoding). +// +// Under Windows, it contains a number which is one of predefined CHARSET_XXX +// values. +// +// Under all platforms it also contains a facename string which should be +// used, if not empty, to create fonts in this encoding (this is the only way +// to create a font of non-standard encoding (like KOI8) under Windows - the +// facename specifies the encoding then) + +struct WXDLLEXPORT wxNativeEncodingInfo +{ + wxString facename; // may be empty meaning "any" +#ifndef __WXPALMOS__ + wxFontEncoding encoding; // so that we know what this struct represents + +#if defined(__WXMSW__) || \ + defined(__WXPM__) || \ + defined(__WXMAC__) || \ + defined(__WXCOCOA__) // FIXME: __WXCOCOA__ + + wxNativeEncodingInfo() + : facename() + , encoding(wxFONTENCODING_SYSTEM) + , charset(0) /* ANSI_CHARSET */ + { } + + int charset; +#elif defined(_WX_X_FONTLIKE) + wxString xregistry, + xencoding; +#elif defined(__WXGTK20__) + // No way to specify this in Pango as this + // seems to be handled internally. +#elif defined(__WXMGL__) + int mglEncoding; +#elif defined(__WXDFB__) + // DirectFB uses UTF-8 internally, doesn't use font encodings +#else + #error "Unsupported toolkit" +#endif +#endif // !__WXPALMOS__ + // this struct is saved in config by wxFontMapper, so it should know to + // serialise itself (implemented in platform-specific code) + bool FromString(const wxString& s); + wxString ToString() const; +}; + +#endif // _WX_ENCINFO_H_ + diff --git a/Externals/wxWidgets/include/wx/event.h b/Externals/wxWidgets/include/wx/event.h index 0d0889b49e..26fab62c9f 100644 --- a/Externals/wxWidgets/include/wx/event.h +++ b/Externals/wxWidgets/include/wx/event.h @@ -1,3116 +1,3116 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/event.h -// Purpose: Event classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: event.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EVENT_H__ -#define _WX_EVENT_H__ - -#include "wx/defs.h" -#include "wx/cpp.h" -#include "wx/object.h" -#include "wx/clntdata.h" - -#if wxUSE_GUI - #include "wx/gdicmn.h" - #include "wx/cursor.h" -#endif - -#include "wx/thread.h" - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxList; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxDC; - class WXDLLIMPEXP_FWD_CORE wxMenu; - class WXDLLIMPEXP_FWD_CORE wxWindow; - class WXDLLIMPEXP_FWD_CORE wxWindowBase; -#endif // wxUSE_GUI - -class WXDLLIMPEXP_FWD_BASE wxEvtHandler; - -// ---------------------------------------------------------------------------- -// Event types -// ---------------------------------------------------------------------------- - -typedef int wxEventType; - -// this is used to make the event table entry type safe, so that for an event -// handler only a function with proper parameter list can be given. -#define wxStaticCastEvent(type, val) wx_static_cast(type, val) - -// in previous versions of wxWidgets the event types used to be constants -// which created difficulties with custom/user event types definition -// -// starting from wxWidgets 2.4 the event types are now dynamically assigned -// using wxNewEventType() which solves this problem, however at price of -// several incompatibilities: -// -// a) event table macros declaration changed, it now uses wxEventTableEntry -// ctor instead of initialisation from an agregate - the macro -// DECLARE_EVENT_TABLE_ENTRY may be used to write code which can compile -// with all versions of wxWidgets -// -// b) event types can't be used as switch() cases as they're not really -// constant any more - there is no magic solution here, you just have to -// change the switch()es to if()s -// -// if these are real problems for you, define WXWIN_COMPATIBILITY_EVENT_TYPES -// as 1 to get 100% old behaviour, however you won't be able to use the -// libraries using the new dynamic event type allocation in such case, so avoid -// it if possible. -#ifndef WXWIN_COMPATIBILITY_EVENT_TYPES - #define WXWIN_COMPATIBILITY_EVENT_TYPES 0 -#endif - -#if WXWIN_COMPATIBILITY_EVENT_TYPES - -#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ - { type, winid, idLast, fn, obj } - -#define BEGIN_DECLARE_EVENT_TYPES() enum { -#define END_DECLARE_EVENT_TYPES() }; -#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value, -#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_USER_FIRST + value, -#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ - DECLARE_LOCAL_EVENT_TYPE(name, value) -#define DEFINE_EVENT_TYPE(name) -#define DEFINE_LOCAL_EVENT_TYPE(name) - - -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - -#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ - wxEventTableEntry(type, winid, idLast, fn, obj) - -#define BEGIN_DECLARE_EVENT_TYPES() -#define END_DECLARE_EVENT_TYPES() -#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ - extern expdecl const wxEventType name; -#define DECLARE_EVENT_TYPE(name, value) \ - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value) -#define DECLARE_LOCAL_EVENT_TYPE(name, value) \ - DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value) -#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType(); -#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name) - -// generate a new unique event type -extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); - -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - -BEGIN_DECLARE_EVENT_TYPES() - -#if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEVT_NULL = 0, - wxEVT_FIRST = 10000, - wxEVT_USER_FIRST = wxEVT_FIRST + 2000, -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - // it is important to still have these as constants to avoid - // initialization order related problems - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_NULL, 0) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_FIRST, 10000) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_USER_FIRST, wxEVT_FIRST + 2000) -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - - DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6) - // now they are in wx/textctrl.h -#if WXWIN_COMPATIBILITY_EVENT_TYPES - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) -#endif // WXWIN_COMPATIBILITY_EVENT_TYPES - DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12) - - // wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use - // wxEVT_SCROLL... events - - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18) - - // Sockets and timers send events, too - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50) - DECLARE_EVENT_TYPE(wxEVT_TIMER , 80) - - // Mouse event types - DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100) - DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101) - DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102) - DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103) - DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104) - DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105) - DECLARE_EVENT_TYPE(wxEVT_MOTION, 106) - DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107) - DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108) - DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109) - DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110) - DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111) - DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112) - DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113) - DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114) - DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115) - - // Non-client mouse events - DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200) - DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201) - DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202) - DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203) - DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204) - DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205) - DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206) - DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207) - DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208) - DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209) - DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210) - DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211) - - // Character input event type - DECLARE_EVENT_TYPE(wxEVT_CHAR, 212) - DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213) - DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214) - DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215) - DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216) -#if wxUSE_HOTKEY - DECLARE_EVENT_TYPE(wxEVT_HOTKEY, 217) -#endif - // Set cursor event - DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230) - - // wxScrollBar and wxSlider event identifiers - DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307) - DECLARE_EVENT_TYPE(wxEVT_SCROLL_CHANGED, 308) - - // Scroll events from wxWindow - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326) - DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327) - - // System events - DECLARE_EVENT_TYPE(wxEVT_SIZE, 400) - DECLARE_EVENT_TYPE(wxEVT_MOVE, 401) - DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402) - DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403) - DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404) - DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405) - // 406..408 are power events - DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409) - DECLARE_EVENT_TYPE(wxEVT_CREATE, 410) - DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411) - DECLARE_EVENT_TYPE(wxEVT_SHOW, 412) - DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413) - DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414) - DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415) - DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST, 416) - DECLARE_EVENT_TYPE(wxEVT_PAINT, 417) - DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 418) - DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 419) - DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 420) - DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 421) - DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 422) - DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 423) - DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424) - DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425) - DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426) - DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427) - DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428) - DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429) - DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430) - DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431) - DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432) - DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433) - DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434) - DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435) - DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436) - DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437) - DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_IDLE, 439) - DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) - DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) - DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) - DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443) - // more power events follow -- see wx/power.h - - // Clipboard events - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446) - - // Generic command events - // Note: a click is a higher-level event than button down/up - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506) - - // Help events - DECLARE_EVENT_TYPE(wxEVT_HELP, 1050) - DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051) - -END_DECLARE_EVENT_TYPES() - -// these 2 events are the same -#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED - -// ---------------------------------------------------------------------------- -// Compatibility -// ---------------------------------------------------------------------------- - -// this event is also used by wxComboBox and wxSpinCtrl which don't include -// wx/textctrl.h in all ports [yet], so declare it here as well -// -// still, any new code using it should include wx/textctrl.h explicitly -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - extern const wxEventType WXDLLIMPEXP_CORE wxEVT_COMMAND_TEXT_UPDATED; -#endif - -// the predefined constants for the number of times we propagate event -// upwards window child-parent chain -enum Propagation_state -{ - // don't propagate it at all - wxEVENT_PROPAGATE_NONE = 0, - - // propagate it until it is processed - wxEVENT_PROPAGATE_MAX = INT_MAX -}; - -/* - * wxWidgets events, covering all interesting things that might happen - * (button clicking, resizing, setting text in widgets, etc.). - * - * For each completely new event type, derive a new event class. - * An event CLASS represents a C++ class defining a range of similar event TYPES; - * examples are canvas events, panel item command events. - * An event TYPE is a unique identifier for a particular system event, - * such as a button press or a listbox deselection. - * - */ - -class WXDLLIMPEXP_BASE wxEvent : public wxObject -{ -private: - wxEvent& operator=(const wxEvent&); - -protected: - wxEvent(const wxEvent&); // for implementing Clone() - -public: - wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL ); - - void SetEventType(wxEventType typ) { m_eventType = typ; } - wxEventType GetEventType() const { return m_eventType; } - wxObject *GetEventObject() const { return m_eventObject; } - void SetEventObject(wxObject *obj) { m_eventObject = obj; } - long GetTimestamp() const { return m_timeStamp; } - void SetTimestamp(long ts = 0) { m_timeStamp = ts; } - int GetId() const { return m_id; } - void SetId(int Id) { m_id = Id; } - - // Can instruct event processor that we wish to ignore this event - // (treat as if the event table entry had not been found): this must be done - // to allow the event processing by the base classes (calling event.Skip() - // is the analog of calling the base class version of a virtual function) - void Skip(bool skip = true) { m_skipped = skip; } - bool GetSkipped() const { return m_skipped; } - - // this function is used to create a copy of the event polymorphically and - // all derived classes must implement it because otherwise wxPostEvent() - // for them wouldn't work (it needs to do a copy of the event) - virtual wxEvent *Clone() const = 0; - - // Implementation only: this test is explicitly anti OO and this function - // exists only for optimization purposes. - bool IsCommandEvent() const { return m_isCommandEvent; } - - // Determine if this event should be propagating to the parent window. - bool ShouldPropagate() const - { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; } - - // Stop an event from propagating to its parent window, returns the old - // propagation level value - int StopPropagation() - { - int propagationLevel = m_propagationLevel; - m_propagationLevel = wxEVENT_PROPAGATE_NONE; - return propagationLevel; - } - - // Resume the event propagation by restoring the propagation level - // (returned by StopPropagation()) - void ResumePropagation(int propagationLevel) - { - m_propagationLevel = propagationLevel; - } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxObject* m_eventObject; - wxEventType m_eventType; - long m_timeStamp; - int m_id; - -public: - // m_callbackUserData is for internal usage only - wxObject* m_callbackUserData; - -protected: - // the propagation level: while it is positive, we propagate the event to - // the parent window (if any) - // - // this one doesn't have to be public, we don't have to worry about - // backwards compatibility as it is new - int m_propagationLevel; - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - bool m_skipped; - bool m_isCommandEvent; - -private: - // it needs to access our m_propagationLevel - friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce; - - DECLARE_ABSTRACT_CLASS(wxEvent) -}; - -/* - * Helper class to temporarily change an event not to propagate. - */ -class WXDLLIMPEXP_BASE wxPropagationDisabler -{ -public: - wxPropagationDisabler(wxEvent& event) : m_event(event) - { - m_propagationLevelOld = m_event.StopPropagation(); - } - - ~wxPropagationDisabler() - { - m_event.ResumePropagation(m_propagationLevelOld); - } - -private: - wxEvent& m_event; - int m_propagationLevelOld; - - DECLARE_NO_COPY_CLASS(wxPropagationDisabler) -}; - -/* - * Another one to temporarily lower propagation level. - */ -class WXDLLIMPEXP_BASE wxPropagateOnce -{ -public: - wxPropagateOnce(wxEvent& event) : m_event(event) - { - wxASSERT_MSG( m_event.m_propagationLevel > 0, - _T("shouldn't be used unless ShouldPropagate()!") ); - - m_event.m_propagationLevel--; - } - - ~wxPropagateOnce() - { - m_event.m_propagationLevel++; - } - -private: - wxEvent& m_event; - - DECLARE_NO_COPY_CLASS(wxPropagateOnce) -}; - -#if wxUSE_GUI - - -// Item or menu event class -/* - wxEVT_COMMAND_BUTTON_CLICKED - wxEVT_COMMAND_CHECKBOX_CLICKED - wxEVT_COMMAND_CHOICE_SELECTED - wxEVT_COMMAND_LISTBOX_SELECTED - wxEVT_COMMAND_LISTBOX_DOUBLECLICKED - wxEVT_COMMAND_TEXT_UPDATED - wxEVT_COMMAND_TEXT_ENTER - wxEVT_COMMAND_MENU_SELECTED - wxEVT_COMMAND_SLIDER_UPDATED - wxEVT_COMMAND_RADIOBOX_SELECTED - wxEVT_COMMAND_RADIOBUTTON_SELECTED - wxEVT_COMMAND_SCROLLBAR_UPDATED - wxEVT_COMMAND_VLBOX_SELECTED - wxEVT_COMMAND_COMBOBOX_SELECTED - wxEVT_COMMAND_TOGGLEBUTTON_CLICKED -*/ - -#if WXWIN_COMPATIBILITY_2_4 -// Backwards compatibility for wxCommandEvent::m_commandString, will lead to compilation errors in some cases of usage -class WXDLLIMPEXP_CORE wxCommandEvent; - -class WXDLLIMPEXP_CORE wxCommandEventStringHelper -{ -public: - wxCommandEventStringHelper(wxCommandEvent * evt) - : m_evt(evt) - { } - - void operator=(const wxString &str); - operator wxString(); - const wxChar* c_str() const; - -private: - wxCommandEvent* m_evt; -}; -#endif - -class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent -{ -public: - wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); - - wxCommandEvent(const wxCommandEvent& event) - : wxEvent(event), -#if WXWIN_COMPATIBILITY_2_4 - m_commandString(this), -#endif - m_cmdString(event.m_cmdString), - m_commandInt(event.m_commandInt), - m_extraLong(event.m_extraLong), - m_clientData(event.m_clientData), - m_clientObject(event.m_clientObject) - { } - - // Set/Get client data from controls - void SetClientData(void* clientData) { m_clientData = clientData; } - void *GetClientData() const { return m_clientData; } - - // Set/Get client object from controls - void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } - wxClientData *GetClientObject() const { return m_clientObject; } - - // Get listbox selection if single-choice - int GetSelection() const { return m_commandInt; } - - // Set/Get listbox/choice selection string - void SetString(const wxString& s) { m_cmdString = s; } - wxString GetString() const; - - // Get checkbox value - bool IsChecked() const { return m_commandInt != 0; } - - // true if the listbox event was a selection. - bool IsSelection() const { return (m_extraLong != 0); } - - void SetExtraLong(long extraLong) { m_extraLong = extraLong; } - long GetExtraLong() const { return m_extraLong; } - - void SetInt(int i) { m_commandInt = i; } - int GetInt() const { return m_commandInt; } - - virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: - wxCommandEventStringHelper m_commandString; -#else -protected: -#endif - wxString m_cmdString; // String event argument - int m_commandInt; - long m_extraLong; // Additional information (e.g. select/deselect) - void* m_clientData; // Arbitrary client data - wxClientData* m_clientObject; // Arbitrary client object - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) -}; - -#if WXWIN_COMPATIBILITY_2_4 -inline void wxCommandEventStringHelper::operator=(const wxString &str) -{ - m_evt->SetString(str); -} - -inline wxCommandEventStringHelper::operator wxString() -{ - return m_evt->GetString(); -} - -inline const wxChar* wxCommandEventStringHelper::c_str() const -{ - return m_evt->GetString().c_str(); -} -#endif - -// this class adds a possibility to react (from the user) code to a control -// notification: allow or veto the operation being reported. -class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent -{ -public: - wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxCommandEvent(commandType, winid) - { m_bAllow = true; } - - wxNotifyEvent(const wxNotifyEvent& event) - : wxCommandEvent(event) - { m_bAllow = event.m_bAllow; } - - // veto the operation (usually it's allowed by default) - void Veto() { m_bAllow = false; } - - // allow the operation if it was disabled by default - void Allow() { m_bAllow = true; } - - // for implementation code only: is the operation allowed? - bool IsAllowed() const { return m_bAllow; } - - virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); } - -private: - bool m_bAllow; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent) -}; - -// Scroll event class, derived form wxCommandEvent. wxScrollEvents are -// sent by wxSlider and wxScrollBar. -/* - wxEVT_SCROLL_TOP - wxEVT_SCROLL_BOTTOM - wxEVT_SCROLL_LINEUP - wxEVT_SCROLL_LINEDOWN - wxEVT_SCROLL_PAGEUP - wxEVT_SCROLL_PAGEDOWN - wxEVT_SCROLL_THUMBTRACK - wxEVT_SCROLL_THUMBRELEASE - wxEVT_SCROLL_CHANGED -*/ - -class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent -{ -public: - wxScrollEvent(wxEventType commandType = wxEVT_NULL, - int winid = 0, int pos = 0, int orient = 0); - - int GetOrientation() const { return (int) m_extraLong; } - int GetPosition() const { return m_commandInt; } - void SetOrientation(int orient) { m_extraLong = (long) orient; } - void SetPosition(int pos) { m_commandInt = pos; } - - virtual wxEvent *Clone() const { return new wxScrollEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent) -}; - -// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents -// are sent by wxWindow. -/* - wxEVT_SCROLLWIN_TOP - wxEVT_SCROLLWIN_BOTTOM - wxEVT_SCROLLWIN_LINEUP - wxEVT_SCROLLWIN_LINEDOWN - wxEVT_SCROLLWIN_PAGEUP - wxEVT_SCROLLWIN_PAGEDOWN - wxEVT_SCROLLWIN_THUMBTRACK - wxEVT_SCROLLWIN_THUMBRELEASE -*/ - -class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent -{ -public: - wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, - int pos = 0, int orient = 0); - wxScrollWinEvent(const wxScrollWinEvent & event) : wxEvent(event) - { m_commandInt = event.m_commandInt; - m_extraLong = event.m_extraLong; } - - int GetOrientation() const { return (int) m_extraLong; } - int GetPosition() const { return m_commandInt; } - void SetOrientation(int orient) { m_extraLong = (long) orient; } - void SetPosition(int pos) { m_commandInt = pos; } - - virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - int m_commandInt; - long m_extraLong; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent) -}; - -// Mouse event class - -/* - wxEVT_LEFT_DOWN - wxEVT_LEFT_UP - wxEVT_MIDDLE_DOWN - wxEVT_MIDDLE_UP - wxEVT_RIGHT_DOWN - wxEVT_RIGHT_UP - wxEVT_MOTION - wxEVT_ENTER_WINDOW - wxEVT_LEAVE_WINDOW - wxEVT_LEFT_DCLICK - wxEVT_MIDDLE_DCLICK - wxEVT_RIGHT_DCLICK - wxEVT_NC_LEFT_DOWN - wxEVT_NC_LEFT_UP, - wxEVT_NC_MIDDLE_DOWN, - wxEVT_NC_MIDDLE_UP, - wxEVT_NC_RIGHT_DOWN, - wxEVT_NC_RIGHT_UP, - wxEVT_NC_MOTION, - wxEVT_NC_ENTER_WINDOW, - wxEVT_NC_LEAVE_WINDOW, - wxEVT_NC_LEFT_DCLICK, - wxEVT_NC_MIDDLE_DCLICK, - wxEVT_NC_RIGHT_DCLICK, -*/ - -// the symbolic names for the mouse buttons -enum -{ - wxMOUSE_BTN_ANY = -1, - wxMOUSE_BTN_NONE = 0, - wxMOUSE_BTN_LEFT = 1, - wxMOUSE_BTN_MIDDLE = 2, - wxMOUSE_BTN_RIGHT = 3 -}; - -class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent -{ -public: - wxMouseEvent(wxEventType mouseType = wxEVT_NULL); - wxMouseEvent(const wxMouseEvent& event) : wxEvent(event) - { Assign(event); } - - // Was it a button event? (*doesn't* mean: is any button *down*?) - bool IsButton() const { return Button(wxMOUSE_BTN_ANY); } - - // Was it a down event from this (or any) button? - bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; - - // Was it a dclick event from this (or any) button? - bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; - - // Was it a up event from this (or any) button? - bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; - - // Was the given button? - bool Button(int but) const; - - // Was the given button in Down state? - bool ButtonIsDown(int but) const; - - // Get the button which is changing state (wxMOUSE_BTN_NONE if none) - int GetButton() const; - - // Find state of shift/control keys - bool ControlDown() const { return m_controlDown; } - bool MetaDown() const { return m_metaDown; } - bool AltDown() const { return m_altDown; } - bool ShiftDown() const { return m_shiftDown; } - bool CmdDown() const - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - // Find which event was just generated - bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); } - bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); } - bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); } - - bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); } - bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); } - bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); } - - bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } - bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } - bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } - - // Find the current state of the mouse buttons (regardless - // of current event type) - bool LeftIsDown() const { return m_leftDown; } - bool MiddleIsDown() const { return m_middleDown; } - bool RightIsDown() const { return m_rightDown; } - - // True if a button is down and the mouse is moving - bool Dragging() const - { - return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY); - } - - // True if the mouse is moving, and no button is down - bool Moving() const - { - return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY); - } - - // True if the mouse is just entering the window - bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); } - - // True if the mouse is just leaving the window - bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } - - // Find the position of the event - void GetPosition(wxCoord *xpos, wxCoord *ypos) const - { - if (xpos) - *xpos = m_x; - if (ypos) - *ypos = m_y; - } - - void GetPosition(long *xpos, long *ypos) const - { - if (xpos) - *xpos = (long)m_x; - if (ypos) - *ypos = (long)m_y; - } - - // Find the position of the event - wxPoint GetPosition() const { return wxPoint(m_x, m_y); } - - // Find the logical position of the event given the DC - wxPoint GetLogicalPosition(const wxDC& dc) const; - - // Get X position - wxCoord GetX() const { return m_x; } - - // Get Y position - wxCoord GetY() const { return m_y; } - - // Get wheel rotation, positive or negative indicates direction of - // rotation. Current devices all send an event when rotation is equal to - // +/-WheelDelta, but this allows for finer resolution devices to be - // created in the future. Because of this you shouldn't assume that one - // event is equal to 1 line or whatever, but you should be able to either - // do partial line scrolling or wait until +/-WheelDelta rotation values - // have been accumulated before scrolling. - int GetWheelRotation() const { return m_wheelRotation; } - - // Get wheel delta, normally 120. This is the threshold for action to be - // taken, and one such action (for example, scrolling one increment) - // should occur for each delta. - int GetWheelDelta() const { return m_wheelDelta; } - - // Returns the configured number of lines (or whatever) to be scrolled per - // wheel action. Defaults to one. - int GetLinesPerAction() const { return m_linesPerAction; } - - // Is the system set to do page scrolling? - bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } - - virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } - - wxMouseEvent& operator=(const wxMouseEvent& event) { Assign(event); return *this; } - -public: - wxCoord m_x, m_y; - - bool m_leftDown; - bool m_middleDown; - bool m_rightDown; - - bool m_controlDown; - bool m_shiftDown; - bool m_altDown; - bool m_metaDown; - - int m_wheelRotation; - int m_wheelDelta; - int m_linesPerAction; - -protected: - void Assign(const wxMouseEvent& evt); - -private: - DECLARE_DYNAMIC_CLASS(wxMouseEvent) -}; - -// Cursor set event - -/* - wxEVT_SET_CURSOR - */ - -class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent -{ -public: - wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0) - : wxEvent(0, wxEVT_SET_CURSOR), - m_x(x), m_y(y), m_cursor() - { } - - wxSetCursorEvent(const wxSetCursorEvent & event) - : wxEvent(event), - m_x(event.m_x), - m_y(event.m_y), - m_cursor(event.m_cursor) - { } - - wxCoord GetX() const { return m_x; } - wxCoord GetY() const { return m_y; } - - void SetCursor(const wxCursor& cursor) { m_cursor = cursor; } - const wxCursor& GetCursor() const { return m_cursor; } - bool HasCursor() const { return m_cursor.Ok(); } - - virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } - -private: - wxCoord m_x, m_y; - wxCursor m_cursor; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent) -}; - -// Keyboard input event class - -/* - wxEVT_CHAR - wxEVT_CHAR_HOOK - wxEVT_KEY_DOWN - wxEVT_KEY_UP - wxEVT_HOTKEY - */ - -class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent -{ -public: - wxKeyEvent(wxEventType keyType = wxEVT_NULL); - wxKeyEvent(const wxKeyEvent& evt); - - // can be used check if the key event has exactly the given modifiers: - // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() - // && !MetaDown() && !AltDown() && !ShiftDown()" - int GetModifiers() const - { - return (m_controlDown ? wxMOD_CONTROL : 0) | - (m_shiftDown ? wxMOD_SHIFT : 0) | - (m_metaDown ? wxMOD_META : 0) | - (m_altDown ? wxMOD_ALT : 0); - } - - // Find state of shift/control keys - bool ControlDown() const { return m_controlDown; } - bool ShiftDown() const { return m_shiftDown; } - bool MetaDown() const { return m_metaDown; } - bool AltDown() const { return m_altDown; } - - // "Cmd" is a pseudo key which is Control for PC and Unix platforms but - // Apple ("Command") key under Macs: it makes often sense to use it instead - // of, say, ControlDown() because Cmd key is used for the same thing under - // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this - // purpose under Mac) - bool CmdDown() const - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - // exclude MetaDown() from HasModifiers() because NumLock under X is often - // configured as mod2 modifier, yet the key events even when it is pressed - // should be processed normally, not like Ctrl- or Alt-key - bool HasModifiers() const { return ControlDown() || AltDown(); } - - // get the key code: an ASCII7 char or an element of wxKeyCode enum - int GetKeyCode() const { return (int)m_keyCode; } - -#if wxUSE_UNICODE - // get the Unicode character corresponding to this key - wxChar GetUnicodeKey() const { return m_uniChar; } -#endif // wxUSE_UNICODE - - // get the raw key code (platform-dependent) - wxUint32 GetRawKeyCode() const { return m_rawCode; } - - // get the raw key flags (platform-dependent) - wxUint32 GetRawKeyFlags() const { return m_rawFlags; } - - // Find the position of the event - void GetPosition(wxCoord *xpos, wxCoord *ypos) const - { - if (xpos) *xpos = m_x; - if (ypos) *ypos = m_y; - } - - void GetPosition(long *xpos, long *ypos) const - { - if (xpos) *xpos = (long)m_x; - if (ypos) *ypos = (long)m_y; - } - - wxPoint GetPosition() const - { return wxPoint(m_x, m_y); } - - // Get X position - wxCoord GetX() const { return m_x; } - - // Get Y position - wxCoord GetY() const { return m_y; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, Use GetKeyCode instead. - wxDEPRECATED( long KeyCode() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } - - // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for - // example) - wxKeyEvent& operator=(const wxKeyEvent& evt) - { - m_x = evt.m_x; - m_y = evt.m_y; - - m_keyCode = evt.m_keyCode; - - m_controlDown = evt.m_controlDown; - m_shiftDown = evt.m_shiftDown; - m_altDown = evt.m_altDown; - m_metaDown = evt.m_metaDown; - m_scanCode = evt.m_scanCode; - m_rawCode = evt.m_rawCode; - m_rawFlags = evt.m_rawFlags; -#if wxUSE_UNICODE - m_uniChar = evt.m_uniChar; -#endif - - return *this; - } - -public: - wxCoord m_x, m_y; - - long m_keyCode; - - // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX? - bool m_controlDown; - bool m_shiftDown; - bool m_altDown; - bool m_metaDown; - - // FIXME: what is this for? relation to m_rawXXX? - bool m_scanCode; - -#if wxUSE_UNICODE - // This contains the full Unicode character - // in a character events in Unicode mode - wxChar m_uniChar; -#endif - - // these fields contain the platform-specific information about - // key that was pressed - wxUint32 m_rawCode; - wxUint32 m_rawFlags; - -private: - DECLARE_DYNAMIC_CLASS(wxKeyEvent) -}; - -// Size event class -/* - wxEVT_SIZE - */ - -class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent -{ -public: - wxSizeEvent() : wxEvent(0, wxEVT_SIZE) - { } - wxSizeEvent(const wxSize& sz, int winid = 0) - : wxEvent(winid, wxEVT_SIZE), - m_size(sz) - { } - wxSizeEvent(const wxSizeEvent & event) - : wxEvent(event), - m_size(event.m_size), m_rect(event.m_rect) - { } - wxSizeEvent(const wxRect& rect, int id = 0) - : m_size(rect.GetSize()), m_rect(rect) - { m_eventType = wxEVT_SIZING; m_id = id; } - - wxSize GetSize() const { return m_size; } - wxRect GetRect() const { return m_rect; } - void SetRect(const wxRect& rect) { m_rect = rect; } - - virtual wxEvent *Clone() const { return new wxSizeEvent(*this); } - -public: - // For internal usage only. Will be converted to protected members. - wxSize m_size; - wxRect m_rect; // Used for wxEVT_SIZING - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent) -}; - -// Move event class - -/* - wxEVT_MOVE - */ - -class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent -{ -public: - wxMoveEvent() - : wxEvent(0, wxEVT_MOVE) - { } - wxMoveEvent(const wxPoint& pos, int winid = 0) - : wxEvent(winid, wxEVT_MOVE), - m_pos(pos) - { } - wxMoveEvent(const wxMoveEvent& event) - : wxEvent(event), - m_pos(event.m_pos) - { } - wxMoveEvent(const wxRect& rect, int id = 0) - : m_pos(rect.GetPosition()), m_rect(rect) - { m_eventType = wxEVT_MOVING; m_id = id; } - - wxPoint GetPosition() const { return m_pos; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - wxRect GetRect() const { return m_rect; } - void SetRect(const wxRect& rect) { m_rect = rect; } - - virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxPoint m_pos; - wxRect m_rect; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent) -}; - -// Paint event class -/* - wxEVT_PAINT - wxEVT_NC_PAINT - wxEVT_PAINT_ICON - */ - -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined - extern WXDLLIMPEXP_CORE int g_isPainting; -#endif // debug - -class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent -{ -public: - wxPaintEvent(int Id = 0) - : wxEvent(Id, wxEVT_PAINT) - { -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - // set the internal flag for the duration of processing of WM_PAINT - g_isPainting++; -#endif // debug - } - - // default copy ctor and dtor are normally fine, we only need them to keep - // g_isPainting updated in debug build -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - wxPaintEvent(const wxPaintEvent& event) - : wxEvent(event) - { - g_isPainting++; - } - - virtual ~wxPaintEvent() - { - g_isPainting--; - } -#endif // debug - - virtual wxEvent *Clone() const { return new wxPaintEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent) -}; - -class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent -{ -public: - wxNcPaintEvent(int winid = 0) - : wxEvent(winid, wxEVT_NC_PAINT) - { } - - virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent) -}; - -// Erase background event class -/* - wxEVT_ERASE_BACKGROUND - */ - -class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent -{ -public: - wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) - : wxEvent(Id, wxEVT_ERASE_BACKGROUND), - m_dc(dc) - { } - - wxEraseEvent(const wxEraseEvent& event) - : wxEvent(event), - m_dc(event.m_dc) - { } - - wxDC *GetDC() const { return m_dc; } - - virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } - -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxDC *m_dc; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent) -}; - -// Focus event class -/* - wxEVT_SET_FOCUS - wxEVT_KILL_FOCUS - */ - -class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent -{ -public: - wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0) - : wxEvent(winid, type) - { m_win = NULL; } - - wxFocusEvent(const wxFocusEvent& event) - : wxEvent(event) - { m_win = event.m_win; } - - // The window associated with this event is the window which had focus - // before for SET event and the window which will have focus for the KILL - // one. NB: it may be NULL in both cases! - wxWindow *GetWindow() const { return m_win; } - void SetWindow(wxWindow *win) { m_win = win; } - - virtual wxEvent *Clone() const { return new wxFocusEvent(*this); } - -private: - wxWindow *m_win; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent) -}; - -// wxChildFocusEvent notifies the parent that a child has got the focus: unlike -// wxFocusEvent it is propagated upwards the window chain -class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent -{ -public: - wxChildFocusEvent(wxWindow *win = NULL); - - wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - - virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent) -}; - -// Activate event class -/* - wxEVT_ACTIVATE - wxEVT_ACTIVATE_APP - wxEVT_HIBERNATE - */ - -class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent -{ -public: - wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0) - : wxEvent(Id, type) - { m_active = active; } - wxActivateEvent(const wxActivateEvent& event) - : wxEvent(event) - { m_active = event.m_active; } - - bool GetActive() const { return m_active; } - - virtual wxEvent *Clone() const { return new wxActivateEvent(*this); } - -private: - bool m_active; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent) -}; - -// InitDialog event class -/* - wxEVT_INIT_DIALOG - */ - -class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent -{ -public: - wxInitDialogEvent(int Id = 0) - : wxEvent(Id, wxEVT_INIT_DIALOG) - { } - - virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent) -}; - -// Miscellaneous menu event class -/* - wxEVT_MENU_OPEN, - wxEVT_MENU_CLOSE, - wxEVT_MENU_HIGHLIGHT, -*/ - -class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent -{ -public: - wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL) - : wxEvent(winid, type) - { m_menuId = winid; m_menu = menu; } - wxMenuEvent(const wxMenuEvent & event) - : wxEvent(event) - { m_menuId = event.m_menuId; m_menu = event.m_menu; } - - // only for wxEVT_MENU_HIGHLIGHT - int GetMenuId() const { return m_menuId; } - - // only for wxEVT_MENU_OPEN/CLOSE - bool IsPopup() const { return m_menuId == wxID_ANY; } - - // only for wxEVT_MENU_OPEN/CLOSE - wxMenu* GetMenu() const { return m_menu; } - - virtual wxEvent *Clone() const { return new wxMenuEvent(*this); } - -private: - int m_menuId; - wxMenu* m_menu; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent) -}; - -// Window close or session close event class -/* - wxEVT_CLOSE_WINDOW, - wxEVT_END_SESSION, - wxEVT_QUERY_END_SESSION - */ - -class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent -{ -public: - wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0) - : wxEvent(winid, type), - m_loggingOff(true), - m_veto(false), // should be false by default - m_canVeto(true) {} - - wxCloseEvent(const wxCloseEvent & event) - : wxEvent(event), - m_loggingOff(event.m_loggingOff), - m_veto(event.m_veto), - m_canVeto(event.m_canVeto) {} - - void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } - bool GetLoggingOff() const - { - // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it - // doesn't make sense for wxEVT_CLOSE_WINDOW - wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW, - _T("this flag is for end session events only") ); - - return m_loggingOff; - } - - void Veto(bool veto = true) - { - // GetVeto() will return false anyhow... - wxCHECK_RET( m_canVeto, - wxT("call to Veto() ignored (can't veto this event)") ); - - m_veto = veto; - } - void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } - bool CanVeto() const { return m_canVeto; } - bool GetVeto() const { return m_canVeto && m_veto; } - - virtual wxEvent *Clone() const { return new wxCloseEvent(*this); } - -protected: - bool m_loggingOff, - m_veto, - m_canVeto; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent) -}; - -/* - wxEVT_SHOW - */ - -class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent -{ -public: - wxShowEvent(int winid = 0, bool show = false) - : wxEvent(winid, wxEVT_SHOW) - { m_show = show; } - wxShowEvent(const wxShowEvent & event) - : wxEvent(event) - { m_show = event.m_show; } - - void SetShow(bool show) { m_show = show; } - bool GetShow() const { return m_show; } - - virtual wxEvent *Clone() const { return new wxShowEvent(*this); } - -protected: - bool m_show; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent) -}; - -/* - wxEVT_ICONIZE - */ - -class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent -{ -public: - wxIconizeEvent(int winid = 0, bool iconized = true) - : wxEvent(winid, wxEVT_ICONIZE) - { m_iconized = iconized; } - wxIconizeEvent(const wxIconizeEvent & event) - : wxEvent(event) - { m_iconized = event.m_iconized; } - - // return true if the frame was iconized, false if restored - bool Iconized() const { return m_iconized; } - - virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); } - -protected: - bool m_iconized; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent) -}; -/* - wxEVT_MAXIMIZE - */ - -class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent -{ -public: - wxMaximizeEvent(int winid = 0) - : wxEvent(winid, wxEVT_MAXIMIZE) - { } - - virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent) -}; - -// Joystick event class -/* - wxEVT_JOY_BUTTON_DOWN, - wxEVT_JOY_BUTTON_UP, - wxEVT_JOY_MOVE, - wxEVT_JOY_ZMOVE -*/ - -// Which joystick? Same as Windows ids so no conversion necessary. -enum -{ - wxJOYSTICK1, - wxJOYSTICK2 -}; - -// Which button is down? -enum -{ - wxJOY_BUTTON_ANY = -1, - wxJOY_BUTTON1 = 1, - wxJOY_BUTTON2 = 2, - wxJOY_BUTTON3 = 4, - wxJOY_BUTTON4 = 8 -}; - -class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent -{ -#if WXWIN_COMPATIBILITY_2_4 -public: -#else -protected: -#endif - wxPoint m_pos; - int m_zPosition; - int m_buttonChange; // Which button changed? - int m_buttonState; // Which buttons are down? - int m_joyStick; // Which joystick? - -public: - wxJoystickEvent(wxEventType type = wxEVT_NULL, - int state = 0, - int joystick = wxJOYSTICK1, - int change = 0) - : wxEvent(0, type), - m_pos(), - m_zPosition(0), - m_buttonChange(change), - m_buttonState(state), - m_joyStick(joystick) - { - } - wxJoystickEvent(const wxJoystickEvent & event) - : wxEvent(event), - m_pos(event.m_pos), - m_zPosition(event.m_zPosition), - m_buttonChange(event.m_buttonChange), - m_buttonState(event.m_buttonState), - m_joyStick(event.m_joyStick) - { } - - wxPoint GetPosition() const { return m_pos; } - int GetZPosition() const { return m_zPosition; } - int GetButtonState() const { return m_buttonState; } - int GetButtonChange() const { return m_buttonChange; } - int GetJoystick() const { return m_joyStick; } - - void SetJoystick(int stick) { m_joyStick = stick; } - void SetButtonState(int state) { m_buttonState = state; } - void SetButtonChange(int change) { m_buttonChange = change; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - void SetZPosition(int zPos) { m_zPosition = zPos; } - - // Was it a button event? (*doesn't* mean: is any button *down*?) - bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) || - (GetEventType() == wxEVT_JOY_BUTTON_UP)); } - - // Was it a move event? - bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); } - - // Was it a zmove event? - bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); } - - // Was it a down event from button 1, 2, 3, 4 or any? - bool ButtonDown(int but = wxJOY_BUTTON_ANY) const - { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) && - ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } - - // Was it a up event from button 1, 2, 3 or any? - bool ButtonUp(int but = wxJOY_BUTTON_ANY) const - { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) && - ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } - - // Was the given button 1,2,3,4 or any in Down state? - bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const - { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || - ((m_buttonState & but) == but)); } - - virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent) -}; - -// Drop files event class -/* - wxEVT_DROP_FILES - */ - -class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent -{ -public: - int m_noFiles; - wxPoint m_pos; - wxString* m_files; - - wxDropFilesEvent(wxEventType type = wxEVT_NULL, - int noFiles = 0, - wxString *files = (wxString *) NULL) - : wxEvent(0, type), - m_noFiles(noFiles), - m_pos(), - m_files(files) - { } - - // we need a copy ctor to avoid deleting m_files pointer twice - wxDropFilesEvent(const wxDropFilesEvent& other) - : wxEvent(other), - m_noFiles(other.m_noFiles), - m_pos(other.m_pos), - m_files(NULL) - { - m_files = new wxString[m_noFiles]; - for ( int n = 0; n < m_noFiles; n++ ) - { - m_files[n] = other.m_files[n]; - } - } - - virtual ~wxDropFilesEvent() - { - delete [] m_files; - } - - wxPoint GetPosition() const { return m_pos; } - int GetNumberOfFiles() const { return m_noFiles; } - wxString *GetFiles() const { return m_files; } - - virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent) -}; - -// Update UI event -/* - wxEVT_UPDATE_UI - */ - -// Whether to always send update events to windows, or -// to only send update events to those with the -// wxWS_EX_PROCESS_UI_UPDATES style. - -enum wxUpdateUIMode -{ - // Send UI update events to all windows - wxUPDATE_UI_PROCESS_ALL, - - // Send UI update events to windows that have - // the wxWS_EX_PROCESS_UI_UPDATES flag specified - wxUPDATE_UI_PROCESS_SPECIFIED -}; - -class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent -{ -public: - wxUpdateUIEvent(wxWindowID commandId = 0) - : wxCommandEvent(wxEVT_UPDATE_UI, commandId) - { - m_checked = - m_enabled = - m_shown = - m_setEnabled = - m_setShown = - m_setText = - m_setChecked = false; - } - wxUpdateUIEvent(const wxUpdateUIEvent & event) - : wxCommandEvent(event), - m_checked(event.m_checked), - m_enabled(event.m_enabled), - m_shown(event.m_shown), - m_setEnabled(event.m_setEnabled), - m_setShown(event.m_setShown), - m_setText(event.m_setText), - m_setChecked(event.m_setChecked), - m_text(event.m_text) - { } - - bool GetChecked() const { return m_checked; } - bool GetEnabled() const { return m_enabled; } - bool GetShown() const { return m_shown; } - wxString GetText() const { return m_text; } - bool GetSetText() const { return m_setText; } - bool GetSetChecked() const { return m_setChecked; } - bool GetSetEnabled() const { return m_setEnabled; } - bool GetSetShown() const { return m_setShown; } - - void Check(bool check) { m_checked = check; m_setChecked = true; } - void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; } - void Show(bool show) { m_shown = show; m_setShown = true; } - void SetText(const wxString& text) { m_text = text; m_setText = true; } - - // Sets the interval between updates in milliseconds. - // Set to -1 to disable updates, or to 0 to update as frequently as possible. - static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; } - - // Returns the current interval between updates in milliseconds - static long GetUpdateInterval() { return sm_updateInterval; } - - // Can we update this window? - static bool CanUpdate(wxWindowBase *win); - - // Reset the update time to provide a delay until the next - // time we should update - static void ResetUpdateTime(); - - // Specify how wxWidgets will send update events: to - // all windows, or only to those which specify that they - // will process the events. - static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; } - - // Returns the UI update mode - static wxUpdateUIMode GetMode() { return sm_updateMode; } - - virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); } - -protected: - bool m_checked; - bool m_enabled; - bool m_shown; - bool m_setEnabled; - bool m_setShown; - bool m_setText; - bool m_setChecked; - wxString m_text; -#if wxUSE_LONGLONG - static wxLongLong sm_lastUpdate; -#endif - static long sm_updateInterval; - static wxUpdateUIMode sm_updateMode; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent) -}; - -/* - wxEVT_SYS_COLOUR_CHANGED - */ - -// TODO: shouldn't all events record the window ID? -class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent -{ -public: - wxSysColourChangedEvent() - : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED) - { } - - virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent) -}; - -/* - wxEVT_MOUSE_CAPTURE_CHANGED - The window losing the capture receives this message - (even if it released the capture itself). - */ - -class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent -{ -public: - wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL) - : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED), - m_gainedCapture(gainedCapture) - { } - - wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event) - : wxEvent(event), - m_gainedCapture(event.m_gainedCapture) - { } - - virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); } - - wxWindow* GetCapturedWindow() const { return m_gainedCapture; } - -private: - wxWindow* m_gainedCapture; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent) -}; - -/* - wxEVT_MOUSE_CAPTURE_LOST - The window losing the capture receives this message, unless it released it - it itself or unless wxWindow::CaptureMouse was called on another window - (and so capture will be restored when the new capturer releases it). - */ - -class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent -{ -public: - wxMouseCaptureLostEvent(wxWindowID winid = 0) - : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST) - {} - - wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event) - : wxEvent(event) - {} - - virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); } - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent) -}; - -/* - wxEVT_DISPLAY_CHANGED - */ -class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent -{ -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent) - -public: - wxDisplayChangedEvent() - : wxEvent(0, wxEVT_DISPLAY_CHANGED) - { } - - virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); } -}; - -/* - wxEVT_PALETTE_CHANGED - */ - -class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent -{ -public: - wxPaletteChangedEvent(wxWindowID winid = 0) - : wxEvent(winid, wxEVT_PALETTE_CHANGED), - m_changedWindow((wxWindow *) NULL) - { } - - wxPaletteChangedEvent(const wxPaletteChangedEvent& event) - : wxEvent(event), - m_changedWindow(event.m_changedWindow) - { } - - void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } - wxWindow* GetChangedWindow() const { return m_changedWindow; } - - virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); } - -protected: - wxWindow* m_changedWindow; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent) -}; - -/* - wxEVT_QUERY_NEW_PALETTE - Indicates the window is getting keyboard focus and should re-do its palette. - */ - -class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent -{ -public: - wxQueryNewPaletteEvent(wxWindowID winid = 0) - : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE), - m_paletteRealized(false) - { } - wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event) - : wxEvent(event), - m_paletteRealized(event.m_paletteRealized) - { } - - // App sets this if it changes the palette. - void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } - bool GetPaletteRealized() const { return m_paletteRealized; } - - virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); } - -protected: - bool m_paletteRealized; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent) -}; - -/* - Event generated by dialog navigation keys - wxEVT_NAVIGATION_KEY - */ -// NB: don't derive from command event to avoid being propagated to the parent -class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent -{ -public: - wxNavigationKeyEvent() - : wxEvent(0, wxEVT_NAVIGATION_KEY), - m_flags(IsForward | FromTab), // defaults are for TAB - m_focus((wxWindow *)NULL) - { - m_propagationLevel = wxEVENT_PROPAGATE_NONE; - } - - wxNavigationKeyEvent(const wxNavigationKeyEvent& event) - : wxEvent(event), - m_flags(event.m_flags), - m_focus(event.m_focus) - { } - - // direction: forward (true) or backward (false) - bool GetDirection() const - { return (m_flags & IsForward) != 0; } - void SetDirection(bool bForward) - { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; } - - // it may be a window change event (MDI, notebook pages...) or a control - // change event - bool IsWindowChange() const - { return (m_flags & WinChange) != 0; } - void SetWindowChange(bool bIs) - { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } - - // Set to true under MSW if the event was generated using the tab key. - // This is required for proper navogation over radio buttons - bool IsFromTab() const - { return (m_flags & FromTab) != 0; } - void SetFromTab(bool bIs) - { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; } - - // the child which has the focus currently (may be NULL - use - // wxWindow::FindFocus then) - wxWindow* GetCurrentFocus() const { return m_focus; } - void SetCurrentFocus(wxWindow *win) { m_focus = win; } - - // Set flags - void SetFlags(long flags) { m_flags = flags; } - - virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); } - - enum - { - IsBackward = 0x0000, - IsForward = 0x0001, - WinChange = 0x0002, - FromTab = 0x0004 - }; - - long m_flags; - wxWindow *m_focus; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent) -}; - -// Window creation/destruction events: the first is sent as soon as window is -// created (i.e. the underlying GUI object exists), but when the C++ object is -// fully initialized (so virtual functions may be called). The second, -// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's -// still safe to call virtual functions at this moment -/* - wxEVT_CREATE - wxEVT_DESTROY - */ - -class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent -{ -public: - wxWindowCreateEvent(wxWindow *win = NULL); - - wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - - virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent) -}; - -class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent -{ -public: - wxWindowDestroyEvent(wxWindow *win = NULL); - - wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - - virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent) -}; - -// A help event is sent when the user clicks on a window in context-help mode. -/* - wxEVT_HELP - wxEVT_DETAILED_HELP -*/ - -class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent -{ -public: - // how was this help event generated? - enum Origin - { - Origin_Unknown, // unrecognized event source - Origin_Keyboard, // event generated from F1 key press - Origin_HelpButton // event from [?] button on the title bar (Windows) - }; - - wxHelpEvent(wxEventType type = wxEVT_NULL, - wxWindowID winid = 0, - const wxPoint& pt = wxDefaultPosition, - Origin origin = Origin_Unknown) - : wxCommandEvent(type, winid), - m_pos(pt), - m_origin(GuessOrigin(origin)) - { } - wxHelpEvent(const wxHelpEvent & event) - : wxCommandEvent(event), - m_pos(event.m_pos), - m_target(event.m_target), - m_link(event.m_link), - m_origin(event.m_origin) - { } - - // Position of event (in screen coordinates) - const wxPoint& GetPosition() const { return m_pos; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - - // Optional link to further help - const wxString& GetLink() const { return m_link; } - void SetLink(const wxString& link) { m_link = link; } - - // Optional target to display help in. E.g. a window specification - const wxString& GetTarget() const { return m_target; } - void SetTarget(const wxString& target) { m_target = target; } - - virtual wxEvent *Clone() const { return new wxHelpEvent(*this); } - - // optional indication of the event source - Origin GetOrigin() const { return m_origin; } - void SetOrigin(Origin origin) { m_origin = origin; } - -protected: - wxPoint m_pos; - wxString m_target; - wxString m_link; - Origin m_origin; - - // we can try to guess the event origin ourselves, even if none is - // specified in the ctor - static Origin GuessOrigin(Origin origin); - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent) -}; - -// A Clipboard Text event is sent when a window intercepts text copy/cut/paste -// message, i.e. the user has cut/copied/pasted data from/into a text control -// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc. -// NOTE : under windows these events are *NOT* generated automatically -// for a Rich Edit text control. -/* -wxEVT_COMMAND_TEXT_COPY -wxEVT_COMMAND_TEXT_CUT -wxEVT_COMMAND_TEXT_PASTE -*/ - -class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent -{ -public: - wxClipboardTextEvent(wxEventType type = wxEVT_NULL, - wxWindowID winid = 0) - : wxCommandEvent(type, winid) - { } - wxClipboardTextEvent(const wxClipboardTextEvent & event) - : wxCommandEvent(event) - { } - - virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent) -}; - -// A Context event is sent when the user right clicks on a window or -// presses Shift-F10 -// NOTE : Under windows this is a repackaged WM_CONTETXMENU message -// Under other systems it may have to be generated from a right click event -/* - wxEVT_CONTEXT_MENU -*/ - -class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent -{ -public: - wxContextMenuEvent(wxEventType type = wxEVT_NULL, - wxWindowID winid = 0, - const wxPoint& pt = wxDefaultPosition) - : wxCommandEvent(type, winid), - m_pos(pt) - { } - wxContextMenuEvent(const wxContextMenuEvent & event) - : wxCommandEvent(event), - m_pos(event.m_pos) - { } - - // Position of event (in screen coordinates) - const wxPoint& GetPosition() const { return m_pos; } - void SetPosition(const wxPoint& pos) { m_pos = pos; } - - virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); } - -protected: - wxPoint m_pos; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) -}; - -// Idle event -/* - wxEVT_IDLE - */ - -// Whether to always send idle events to windows, or -// to only send update events to those with the -// wxWS_EX_PROCESS_IDLE style. - -enum wxIdleMode -{ - // Send idle events to all windows - wxIDLE_PROCESS_ALL, - - // Send idle events to windows that have - // the wxWS_EX_PROCESS_IDLE flag specified - wxIDLE_PROCESS_SPECIFIED -}; - -class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent -{ -public: - wxIdleEvent() - : wxEvent(0, wxEVT_IDLE), - m_requestMore(false) - { } - wxIdleEvent(const wxIdleEvent & event) - : wxEvent(event), - m_requestMore(event.m_requestMore) - { } - - void RequestMore(bool needMore = true) { m_requestMore = needMore; } - bool MoreRequested() const { return m_requestMore; } - - virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } - - // Specify how wxWidgets will send idle events: to - // all windows, or only to those which specify that they - // will process the events. - static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } - - // Returns the idle event mode - static wxIdleMode GetMode() { return sm_idleMode; } - - // Can we send an idle event? - static bool CanSend(wxWindow* win); - -protected: - bool m_requestMore; - static wxIdleMode sm_idleMode; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) -}; - -#endif // wxUSE_GUI - -/* TODO - wxEVT_MOUSE_CAPTURE_CHANGED, - wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) -// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate - // wxEVT_FONT_CHANGED to all other windows (maybe). - wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific. - wxEVT_MEASURE_ITEM, - wxEVT_COMPARE_ITEM -*/ - - -// ============================================================================ -// event handler and related classes -// ============================================================================ - -// for backwards compatibility and to prevent eVC 4 for ARM from crashing with -// internal compiler error when compiling wx, we define wxObjectEventFunction -// as a wxObject method even though it can only be a wxEvtHandler one -typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); - -// we can't have ctors nor base struct in backwards compatibility mode or -// otherwise we won't be able to initialize the objects with an agregate, so -// we have to keep both versions -#if WXWIN_COMPATIBILITY_EVENT_TYPES - -struct WXDLLIMPEXP_BASE wxEventTableEntry -{ - // For some reason, this can't be wxEventType, or VC++ complains. - int m_eventType; // main event type - int m_id; // control/menu/toolbar id - int m_lastId; // used for ranges of ids - wxObjectEventFunction m_fn; // function to call: not wxEventFunction, - // because of dependency problems - - wxObject* m_callbackUserData; -}; - -#else // !WXWIN_COMPATIBILITY_EVENT_TYPES - -// struct containing the members common to static and dynamic event tables -// entries -struct WXDLLIMPEXP_BASE wxEventTableEntryBase -{ -private: - wxEventTableEntryBase& operator=(const wxEventTableEntryBase& event); - -public: - wxEventTableEntryBase(int winid, int idLast, - wxObjectEventFunction fn, wxObject *data) - : m_id(winid), - m_lastId(idLast), - m_fn(fn), - m_callbackUserData(data) - { } - - wxEventTableEntryBase(const wxEventTableEntryBase& event) - : m_id(event.m_id), - m_lastId(event.m_lastId), - m_fn(event.m_fn), - m_callbackUserData(event.m_callbackUserData) - { } - - // the range of ids for this entry: if m_lastId == wxID_ANY, the range - // consists only of m_id, otherwise it is m_id..m_lastId inclusive - int m_id, - m_lastId; - - // function to call: not wxEventFunction, because of dependency problems - wxObjectEventFunction m_fn; - - // arbitrary user data asosciated with the callback - wxObject* m_callbackUserData; -}; - -// an entry from a static event table -struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase -{ - wxEventTableEntry(const int& evType, int winid, int idLast, - wxObjectEventFunction fn, wxObject *data) - : wxEventTableEntryBase(winid, idLast, fn, data), - m_eventType(evType) - { } - - // the reference to event type: this allows us to not care about the - // (undefined) order in which the event table entries and the event types - // are initialized: initially the value of this reference might be - // invalid, but by the time it is used for the first time, all global - // objects will have been initialized (including the event type constants) - // and so it will have the correct value when it is needed - const int& m_eventType; - -private: - wxEventTableEntry& operator=(const wxEventTableEntry&); -}; - -// an entry used in dynamic event table managed by wxEvtHandler::Connect() -struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase -{ - wxDynamicEventTableEntry(int evType, int winid, int idLast, - wxObjectEventFunction fn, wxObject *data, wxEvtHandler* eventSink) - : wxEventTableEntryBase(winid, idLast, fn, data), - m_eventType(evType), - m_eventSink(eventSink) - { } - - // not a reference here as we can't keep a reference to a temporary int - // created to wrap the constant value typically passed to Connect() - nor - // do we need it - int m_eventType; - - // Pointer to object whose function is fn - so we don't assume the - // EventFunction is always a member of the EventHandler receiving the - // message - wxEvtHandler* m_eventSink; - - DECLARE_NO_COPY_CLASS(wxDynamicEventTableEntry) -}; - -#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES - -// ---------------------------------------------------------------------------- -// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0} -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxEventTable -{ - const wxEventTable *baseTable; // base event table (next in chain) - const wxEventTableEntry *entries; // bottom of entry array -}; - -// ---------------------------------------------------------------------------- -// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups. -// ---------------------------------------------------------------------------- - -WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray); - -class WXDLLIMPEXP_BASE wxEventHashTable -{ -private: - // Internal data structs - struct EventTypeTable - { - wxEventType eventType; - wxEventTableEntryPointerArray eventEntryTable; - }; - typedef EventTypeTable* EventTypeTablePointer; - -public: - // Constructor, needs the event table it needs to hash later on. - // Note: hashing of the event table is not done in the constructor as it - // can be that the event table is not yet full initialize, the hash - // will gets initialized when handling the first event look-up request. - wxEventHashTable(const wxEventTable &table); - // Destructor. - ~wxEventHashTable(); - - // Handle the given event, in other words search the event table hash - // and call self->ProcessEvent() if a match was found. - bool HandleEvent(wxEvent &event, wxEvtHandler *self); - - // Clear table - void Clear(); - - // Clear all tables - static void ClearAll(); - // Rebuild all tables - static void ReconstructAll(); - -protected: - // Init the hash table with the entries of the static event table. - void InitHashTable(); - // Helper funtion of InitHashTable() to insert 1 entry into the hash table. - void AddEntry(const wxEventTableEntry &entry); - // Allocate and init with null pointers the base hash table. - void AllocEventTypeTable(size_t size); - // Grow the hash table in size and transfer all items currently - // in the table to the correct location in the new table. - void GrowEventTypeTable(); - -protected: - const wxEventTable &m_table; - bool m_rebuildHash; - - size_t m_size; - EventTypeTablePointer *m_eventTypeTable; - - static wxEventHashTable* sm_first; - wxEventHashTable* m_previous; - wxEventHashTable* m_next; - - DECLARE_NO_COPY_CLASS(wxEventHashTable) -}; - -// ---------------------------------------------------------------------------- -// wxEvtHandler: the base class for all objects handling wxWidgets events -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject -{ -public: - wxEvtHandler(); - virtual ~wxEvtHandler(); - - wxEvtHandler *GetNextHandler() const { return m_nextHandler; } - wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; } - void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } - void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } - - void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; } - bool GetEvtHandlerEnabled() const { return m_enabled; } - - // process an event right now - virtual bool ProcessEvent(wxEvent& event); - - // add an event to be processed later - void AddPendingEvent(wxEvent& event); - - void ProcessPendingEvents(); - -#if wxUSE_THREADS - bool ProcessThreadEvent(wxEvent& event); -#endif - - // Dynamic association of a member function handler with the event handler, - // winid and event type - void Connect(int winid, - int lastId, - int eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL); - - // Convenience function: take just one id - void Connect(int winid, - int eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); } - - // Even more convenient: without id (same as using id of wxID_ANY) - void Connect(int eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } - - bool Disconnect(int winid, - int lastId, - wxEventType eventType, - wxObjectEventFunction func = NULL, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL); - - bool Disconnect(int winid = wxID_ANY, - wxEventType eventType = wxEVT_NULL, - wxObjectEventFunction func = NULL, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } - - bool Disconnect(wxEventType eventType, - wxObjectEventFunction func, - wxObject *userData = (wxObject *) NULL, - wxEvtHandler *eventSink = (wxEvtHandler *) NULL) - { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } - - wxList* GetDynamicEventTable() const { return m_dynamicEvents ; } - - // User data can be associated with each wxEvtHandler - void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } - wxClientData *GetClientObject() const { return DoGetClientObject(); } - - void SetClientData( void *data ) { DoSetClientData(data); } - void *GetClientData() const { return DoGetClientData(); } - - // check if the given event table entry matches this event and call the - // handler if it does - // - // return true if the event was processed, false otherwise (no match or the - // handler decided to skip the event) - static bool ProcessEventIfMatches(const wxEventTableEntryBase& tableEntry, - wxEvtHandler *handler, - wxEvent& event); - - // implementation from now on - virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); - bool SearchDynamicEventTable( wxEvent& event ); - -#if wxUSE_THREADS - void ClearEventLocker(); -#endif // wxUSE_THREADS - - // Avoid problems at exit by cleaning up static hash table gracefully - void ClearEventHashTable() { GetEventHashTable().Clear(); } - -private: - static const wxEventTableEntry sm_eventTableEntries[]; - -protected: - // hooks for wxWindow used by ProcessEvent() - // ----------------------------------------- - - // This one is called before trying our own event table to allow plugging - // in the validators. - // - // NB: This method is intentionally *not* inside wxUSE_VALIDATORS! - // It is part of wxBase which doesn't use validators and the code - // is compiled out when building wxBase w/o GUI classes, which affects - // binary compatibility and wxBase library can't be used by GUI - // ports. - virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; } - - // this one is called after failing to find the event handle in our own - // table to give a chance to the other windows to process it - // - // base class implementation passes the event to wxTheApp - virtual bool TryParent(wxEvent& event); - - - static const wxEventTable sm_eventTable; - virtual const wxEventTable *GetEventTable() const; - - static wxEventHashTable sm_eventHashTable; - virtual wxEventHashTable& GetEventHashTable() const; - - wxEvtHandler* m_nextHandler; - wxEvtHandler* m_previousHandler; - wxList* m_dynamicEvents; - wxList* m_pendingEvents; - -#if wxUSE_THREADS -#if defined (__VISAGECPP__) - const wxCriticalSection& Lock() const { return m_eventsLocker; } - wxCriticalSection& Lock() { return m_eventsLocker; } - - wxCriticalSection m_eventsLocker; -# else - const wxCriticalSection& Lock() const { return *m_eventsLocker; } - wxCriticalSection& Lock() { return *m_eventsLocker; } - - wxCriticalSection* m_eventsLocker; -# endif -#endif - - // Is event handler enabled? - bool m_enabled; - - - // The user data: either an object which will be deleted by the container - // when it's deleted or some raw pointer which we do nothing with - only - // one type of data can be used with the given window (i.e. you cannot set - // the void data and then associate the container with wxClientData or vice - // versa) - union - { - wxClientData *m_clientObject; - void *m_clientData; - }; - - // what kind of data do we have? - wxClientDataType m_clientDataType; - - // client data accessors - virtual void DoSetClientObject( wxClientData *data ); - virtual wxClientData *DoGetClientObject() const; - - virtual void DoSetClientData( void *data ); - virtual void *DoGetClientData() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler) -}; - -// Post a message to the given eventhandler which will be processed during the -// next event loop iteration -inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event) -{ - wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") ); - - dest->AddPendingEvent(event); -} - -typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); - -#define wxEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func) - -#if wxUSE_GUI - -typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); -typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); -typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); -typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&); -typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&); -typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&); -typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&); -typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&); -typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&); -typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&); -typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&); -typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&); -typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&); -typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&); -typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&); -typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&); -typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&); -typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&); -typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&); -typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); -typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); -typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); -typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); -typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&); -typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&); -typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); -typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); -typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); -typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&); -typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&); -typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&); -typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&); -typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); -typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&); -typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&); -typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&); -typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&); - -// these typedefs don't have the same name structure as the others, keep for -// backwards compatibility only -#if WXWIN_COMPATIBILITY_2_4 - typedef wxSysColourChangedEventFunction wxSysColourChangedFunction; - typedef wxDisplayChangedEventFunction wxDisplayChangedFunction; -#endif // WXWIN_COMPATIBILITY_2_4 - - -#define wxCommandEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) -#define wxScrollEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func) -#define wxScrollWinEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func) -#define wxSizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func) -#define wxMoveEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func) -#define wxPaintEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func) -#define wxNcPaintEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func) -#define wxEraseEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func) -#define wxMouseEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func) -#define wxCharEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func) -#define wxKeyEventHandler(func) wxCharEventHandler(func) -#define wxFocusEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func) -#define wxChildFocusEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func) -#define wxActivateEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func) -#define wxMenuEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func) -#define wxJoystickEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func) -#define wxDropFilesEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func) -#define wxInitDialogEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func) -#define wxSysColourChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func) -#define wxDisplayChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func) -#define wxUpdateUIEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func) -#define wxIdleEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func) -#define wxCloseEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func) -#define wxShowEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func) -#define wxIconizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func) -#define wxMaximizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func) -#define wxNavigationKeyEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func) -#define wxPaletteChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func) -#define wxQueryNewPaletteEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func) -#define wxWindowCreateEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func) -#define wxWindowDestroyEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func) -#define wxSetCursorEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func) -#define wxNotifyEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func) -#define wxHelpEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func) -#define wxContextMenuEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func) -#define wxMouseCaptureChangedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func) -#define wxMouseCaptureLostEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureLostEventFunction, &func) -#define wxClipboardTextEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func) - -#endif // wxUSE_GUI - -// N.B. In GNU-WIN32, you *have* to take the address of a member function -// (use &) or the compiler crashes... - -#define DECLARE_EVENT_TABLE() \ - private: \ - static const wxEventTableEntry sm_eventTableEntries[]; \ - protected: \ - static const wxEventTable sm_eventTable; \ - virtual const wxEventTable* GetEventTable() const; \ - static wxEventHashTable sm_eventHashTable; \ - virtual wxEventHashTable& GetEventHashTable() const; - -// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize -// sm_eventTable before using it in GetEventTable() or the compiler gives -// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews) - -#define BEGIN_EVENT_TABLE(theClass, baseClass) \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ - template \ - const wxEventTable theClass::sm_eventTable = \ - { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ - template \ - const wxEventTable *theClass::GetEventTable() const \ - { return &theClass::sm_eventTable; } \ - template \ - wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ - template \ - wxEventHashTable &theClass::GetEventHashTable() const \ - { return theClass::sm_eventHashTable; } \ - template \ - const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ - -#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) }; - -/* - * Event table macros - */ - -// helpers for writing shorter code below: declare an event macro taking 2, 1 -// or none ids (the missing ids default to wxID_ANY) -// -// macro arguments: -// - evt one of wxEVT_XXX constants -// - id1, id2 ids of the first/last id -// - fn the function (should be cast to the right type) -#define wx__DECLARE_EVT2(evt, id1, id2, fn) \ - DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), -#define wx__DECLARE_EVT1(evt, id, fn) \ - wx__DECLARE_EVT2(evt, id, wxID_ANY, fn) -#define wx__DECLARE_EVT0(evt, fn) \ - wx__DECLARE_EVT1(evt, wxID_ANY, fn) - - -// Generic events -#define EVT_CUSTOM(event, winid, func) \ - wx__DECLARE_EVT1(event, winid, wxEventHandler(func)) -#define EVT_CUSTOM_RANGE(event, id1, id2, func) \ - wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func)) - -// EVT_COMMAND -#define EVT_COMMAND(winid, event, func) \ - wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RANGE(id1, id2, event, func) \ - wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func)) - -#define EVT_NOTIFY(event, winid, func) \ - wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func)) -#define EVT_NOTIFY_RANGE(event, id1, id2, func) \ - wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func)) - -// Miscellaneous -#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func)) -#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func)) -#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func)) -#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func)) -#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func)) -#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) -#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) -#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func)) -#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func)) -#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func)) -#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func)) -#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func)) -#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func)) -#if wxUSE_HOTKEY -#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func)) -#endif -#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func)) -#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func)) -#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func)) -#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func)) -#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func)) -#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func)) -#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func)) -#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func)) -#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func)) -#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func)) -#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func)) -#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) -#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) -#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func)) -#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func)) -#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func)) -#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func)) -#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func)) -#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func)) -#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func)) -#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func)) -#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func)) -#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func)) -#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func)) -#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func)) -#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func)) -#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func)) -#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func)) - -// Mouse events -#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func)) -#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func)) -#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func)) -#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func)) -#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func)) -#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func)) -#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func)) -#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func)) -#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func)) -#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func)) -#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func)) -#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func)) -#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func)) - -// All mouse events -#define EVT_MOUSE_EVENTS(func) \ - EVT_LEFT_DOWN(func) \ - EVT_LEFT_UP(func) \ - EVT_MIDDLE_DOWN(func) \ - EVT_MIDDLE_UP(func) \ - EVT_RIGHT_DOWN(func) \ - EVT_RIGHT_UP(func) \ - EVT_MOTION(func) \ - EVT_LEFT_DCLICK(func) \ - EVT_MIDDLE_DCLICK(func) \ - EVT_RIGHT_DCLICK(func) \ - EVT_LEAVE_WINDOW(func) \ - EVT_ENTER_WINDOW(func) \ - EVT_MOUSEWHEEL(func) - -// Scrolling from wxWindow (sent to wxScrolledWindow) -#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func)) -#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func)) - -#define EVT_SCROLLWIN(func) \ - EVT_SCROLLWIN_TOP(func) \ - EVT_SCROLLWIN_BOTTOM(func) \ - EVT_SCROLLWIN_LINEUP(func) \ - EVT_SCROLLWIN_LINEDOWN(func) \ - EVT_SCROLLWIN_PAGEUP(func) \ - EVT_SCROLLWIN_PAGEDOWN(func) \ - EVT_SCROLLWIN_THUMBTRACK(func) \ - EVT_SCROLLWIN_THUMBRELEASE(func) - -// Scrolling from wxSlider and wxScrollBar -#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func)) -#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func)) -#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func)) -#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func)) -#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func)) -#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func)) -#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func)) -#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func)) -#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func)) - -#define EVT_SCROLL(func) \ - EVT_SCROLL_TOP(func) \ - EVT_SCROLL_BOTTOM(func) \ - EVT_SCROLL_LINEUP(func) \ - EVT_SCROLL_LINEDOWN(func) \ - EVT_SCROLL_PAGEUP(func) \ - EVT_SCROLL_PAGEDOWN(func) \ - EVT_SCROLL_THUMBTRACK(func) \ - EVT_SCROLL_THUMBRELEASE(func) \ - EVT_SCROLL_CHANGED(func) - -// Scrolling from wxSlider and wxScrollBar, with an id -#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func)) -#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func)) - -#define EVT_COMMAND_SCROLL(winid, func) \ - EVT_COMMAND_SCROLL_TOP(winid, func) \ - EVT_COMMAND_SCROLL_BOTTOM(winid, func) \ - EVT_COMMAND_SCROLL_LINEUP(winid, func) \ - EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \ - EVT_COMMAND_SCROLL_PAGEUP(winid, func) \ - EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \ - EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \ - EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \ - EVT_COMMAND_SCROLL_CHANGED(winid, func) - -#if WXWIN_COMPATIBILITY_2_6 - // compatibility macros for the old name, deprecated in 2.8 - #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED - #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED - #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED -#endif // WXWIN_COMPATIBILITY_2_6 - -// Convenience macros for commonly-used commands -#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func)) -#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICE_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, winid, wxCommandEventHandler(func)) -#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_MENU_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_MENU_SELECTED, id1, id2, wxCommandEventHandler(func)) -#if defined(__SMARTPHONE__) -# define EVT_BUTTON(winid, func) EVT_MENU(winid, func) -#else -# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_BUTTON_CLICKED, winid, wxCommandEventHandler(func)) -#endif -#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SLIDER_UPDATED, winid, wxCommandEventHandler(func)) -#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBUTTON_SELECTED, winid, wxCommandEventHandler(func)) -// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events -#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SCROLLBAR_UPDATED, winid, wxCommandEventHandler(func)) -#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func)) -#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func)) -#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) -#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func)) -#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func)) - -// Generic command events -#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func)) -#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func)) - -// Joystick events - -#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func)) -#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func)) -#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func)) -#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func)) - -// These are obsolete, see _BUTTON_ events -#if WXWIN_COMPATIBILITY_2_4 - #define EVT_JOY_DOWN(func) EVT_JOY_BUTTON_DOWN(func) - #define EVT_JOY_UP(func) EVT_JOY_BUTTON_UP(func) -#endif // WXWIN_COMPATIBILITY_2_4 - -// All joystick events -#define EVT_JOYSTICK_EVENTS(func) \ - EVT_JOY_BUTTON_DOWN(func) \ - EVT_JOY_BUTTON_UP(func) \ - EVT_JOY_MOVE(func) \ - EVT_JOY_ZMOVE(func) - -// Idle event -#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func)) - -// Update UI event -#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func)) -#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func)) - -// Help events -#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func)) -#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func)) -#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func)) -#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func)) - -// Context Menu Events -#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func)) -#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func)) - -// Clipboard text Events -#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func)) -#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func)) -#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func)) - -// ---------------------------------------------------------------------------- -// Global data -// ---------------------------------------------------------------------------- - -// for pending event processing - notice that there is intentionally no -// WXDLLEXPORT here -extern WXDLLIMPEXP_BASE wxList *wxPendingEvents; -#if wxUSE_THREADS - extern WXDLLIMPEXP_BASE wxCriticalSection *wxPendingEventsLocker; -#endif - -// ---------------------------------------------------------------------------- -// Helper functions -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -// Find a window with the focus, that is also a descendant of the given window. -// This is used to determine the window to initially send commands to. -WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); - -#endif // wxUSE_GUI - -#endif // _WX_EVENT_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/event.h +// Purpose: Event classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: event.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVENT_H__ +#define _WX_EVENT_H__ + +#include "wx/defs.h" +#include "wx/cpp.h" +#include "wx/object.h" +#include "wx/clntdata.h" + +#if wxUSE_GUI + #include "wx/gdicmn.h" + #include "wx/cursor.h" +#endif + +#include "wx/thread.h" + +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxList; + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxDC; + class WXDLLIMPEXP_FWD_CORE wxMenu; + class WXDLLIMPEXP_FWD_CORE wxWindow; + class WXDLLIMPEXP_FWD_CORE wxWindowBase; +#endif // wxUSE_GUI + +class WXDLLIMPEXP_FWD_BASE wxEvtHandler; + +// ---------------------------------------------------------------------------- +// Event types +// ---------------------------------------------------------------------------- + +typedef int wxEventType; + +// this is used to make the event table entry type safe, so that for an event +// handler only a function with proper parameter list can be given. +#define wxStaticCastEvent(type, val) wx_static_cast(type, val) + +// in previous versions of wxWidgets the event types used to be constants +// which created difficulties with custom/user event types definition +// +// starting from wxWidgets 2.4 the event types are now dynamically assigned +// using wxNewEventType() which solves this problem, however at price of +// several incompatibilities: +// +// a) event table macros declaration changed, it now uses wxEventTableEntry +// ctor instead of initialisation from an agregate - the macro +// DECLARE_EVENT_TABLE_ENTRY may be used to write code which can compile +// with all versions of wxWidgets +// +// b) event types can't be used as switch() cases as they're not really +// constant any more - there is no magic solution here, you just have to +// change the switch()es to if()s +// +// if these are real problems for you, define WXWIN_COMPATIBILITY_EVENT_TYPES +// as 1 to get 100% old behaviour, however you won't be able to use the +// libraries using the new dynamic event type allocation in such case, so avoid +// it if possible. +#ifndef WXWIN_COMPATIBILITY_EVENT_TYPES + #define WXWIN_COMPATIBILITY_EVENT_TYPES 0 +#endif + +#if WXWIN_COMPATIBILITY_EVENT_TYPES + +#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ + { type, winid, idLast, fn, obj } + +#define BEGIN_DECLARE_EVENT_TYPES() enum { +#define END_DECLARE_EVENT_TYPES() }; +#define DECLARE_EVENT_TYPE(name, value) name = wxEVT_FIRST + value, +#define DECLARE_LOCAL_EVENT_TYPE(name, value) name = wxEVT_USER_FIRST + value, +#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ + DECLARE_LOCAL_EVENT_TYPE(name, value) +#define DEFINE_EVENT_TYPE(name) +#define DEFINE_LOCAL_EVENT_TYPE(name) + + +#else // !WXWIN_COMPATIBILITY_EVENT_TYPES + +#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ + wxEventTableEntry(type, winid, idLast, fn, obj) + +#define BEGIN_DECLARE_EVENT_TYPES() +#define END_DECLARE_EVENT_TYPES() +#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ + extern expdecl const wxEventType name; +#define DECLARE_EVENT_TYPE(name, value) \ + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value) +#define DECLARE_LOCAL_EVENT_TYPE(name, value) \ + DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value) +#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType(); +#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name) + +// generate a new unique event type +extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); + +#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES + +BEGIN_DECLARE_EVENT_TYPES() + +#if WXWIN_COMPATIBILITY_EVENT_TYPES + wxEVT_NULL = 0, + wxEVT_FIRST = 10000, + wxEVT_USER_FIRST = wxEVT_FIRST + 2000, +#else // !WXWIN_COMPATIBILITY_EVENT_TYPES + // it is important to still have these as constants to avoid + // initialization order related problems + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_NULL, 0) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_FIRST, 10000) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_USER_FIRST, wxEVT_FIRST + 2000) +#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES + + DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6) + // now they are in wx/textctrl.h +#if WXWIN_COMPATIBILITY_EVENT_TYPES + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) +#endif // WXWIN_COMPATIBILITY_EVENT_TYPES + DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12) + + // wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use + // wxEVT_SCROLL... events + + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18) + + // Sockets and timers send events, too + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50) + DECLARE_EVENT_TYPE(wxEVT_TIMER , 80) + + // Mouse event types + DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100) + DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101) + DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102) + DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103) + DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104) + DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105) + DECLARE_EVENT_TYPE(wxEVT_MOTION, 106) + DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107) + DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108) + DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109) + DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110) + DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111) + DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112) + DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113) + DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114) + DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115) + + // Non-client mouse events + DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200) + DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201) + DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202) + DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203) + DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204) + DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205) + DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206) + DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207) + DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208) + DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209) + DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210) + DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211) + + // Character input event type + DECLARE_EVENT_TYPE(wxEVT_CHAR, 212) + DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213) + DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214) + DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215) + DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216) +#if wxUSE_HOTKEY + DECLARE_EVENT_TYPE(wxEVT_HOTKEY, 217) +#endif + // Set cursor event + DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230) + + // wxScrollBar and wxSlider event identifiers + DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307) + DECLARE_EVENT_TYPE(wxEVT_SCROLL_CHANGED, 308) + + // Scroll events from wxWindow + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326) + DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327) + + // System events + DECLARE_EVENT_TYPE(wxEVT_SIZE, 400) + DECLARE_EVENT_TYPE(wxEVT_MOVE, 401) + DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402) + DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403) + DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404) + DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405) + // 406..408 are power events + DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409) + DECLARE_EVENT_TYPE(wxEVT_CREATE, 410) + DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411) + DECLARE_EVENT_TYPE(wxEVT_SHOW, 412) + DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413) + DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414) + DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415) + DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST, 416) + DECLARE_EVENT_TYPE(wxEVT_PAINT, 417) + DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 418) + DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 419) + DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 420) + DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 421) + DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 422) + DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 423) + DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424) + DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425) + DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426) + DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427) + DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428) + DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429) + DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430) + DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431) + DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432) + DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433) + DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434) + DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435) + DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436) + DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437) + DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_IDLE, 439) + DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) + DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) + DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) + DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443) + // more power events follow -- see wx/power.h + + // Clipboard events + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446) + + // Generic command events + // Note: a click is a higher-level event than button down/up + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506) + + // Help events + DECLARE_EVENT_TYPE(wxEVT_HELP, 1050) + DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051) + +END_DECLARE_EVENT_TYPES() + +// these 2 events are the same +#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED + +// ---------------------------------------------------------------------------- +// Compatibility +// ---------------------------------------------------------------------------- + +// this event is also used by wxComboBox and wxSpinCtrl which don't include +// wx/textctrl.h in all ports [yet], so declare it here as well +// +// still, any new code using it should include wx/textctrl.h explicitly +#if !WXWIN_COMPATIBILITY_EVENT_TYPES + extern const wxEventType WXDLLIMPEXP_CORE wxEVT_COMMAND_TEXT_UPDATED; +#endif + +// the predefined constants for the number of times we propagate event +// upwards window child-parent chain +enum Propagation_state +{ + // don't propagate it at all + wxEVENT_PROPAGATE_NONE = 0, + + // propagate it until it is processed + wxEVENT_PROPAGATE_MAX = INT_MAX +}; + +/* + * wxWidgets events, covering all interesting things that might happen + * (button clicking, resizing, setting text in widgets, etc.). + * + * For each completely new event type, derive a new event class. + * An event CLASS represents a C++ class defining a range of similar event TYPES; + * examples are canvas events, panel item command events. + * An event TYPE is a unique identifier for a particular system event, + * such as a button press or a listbox deselection. + * + */ + +class WXDLLIMPEXP_BASE wxEvent : public wxObject +{ +private: + wxEvent& operator=(const wxEvent&); + +protected: + wxEvent(const wxEvent&); // for implementing Clone() + +public: + wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL ); + + void SetEventType(wxEventType typ) { m_eventType = typ; } + wxEventType GetEventType() const { return m_eventType; } + wxObject *GetEventObject() const { return m_eventObject; } + void SetEventObject(wxObject *obj) { m_eventObject = obj; } + long GetTimestamp() const { return m_timeStamp; } + void SetTimestamp(long ts = 0) { m_timeStamp = ts; } + int GetId() const { return m_id; } + void SetId(int Id) { m_id = Id; } + + // Can instruct event processor that we wish to ignore this event + // (treat as if the event table entry had not been found): this must be done + // to allow the event processing by the base classes (calling event.Skip() + // is the analog of calling the base class version of a virtual function) + void Skip(bool skip = true) { m_skipped = skip; } + bool GetSkipped() const { return m_skipped; } + + // this function is used to create a copy of the event polymorphically and + // all derived classes must implement it because otherwise wxPostEvent() + // for them wouldn't work (it needs to do a copy of the event) + virtual wxEvent *Clone() const = 0; + + // Implementation only: this test is explicitly anti OO and this function + // exists only for optimization purposes. + bool IsCommandEvent() const { return m_isCommandEvent; } + + // Determine if this event should be propagating to the parent window. + bool ShouldPropagate() const + { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; } + + // Stop an event from propagating to its parent window, returns the old + // propagation level value + int StopPropagation() + { + int propagationLevel = m_propagationLevel; + m_propagationLevel = wxEVENT_PROPAGATE_NONE; + return propagationLevel; + } + + // Resume the event propagation by restoring the propagation level + // (returned by StopPropagation()) + void ResumePropagation(int propagationLevel) + { + m_propagationLevel = propagationLevel; + } + +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif + wxObject* m_eventObject; + wxEventType m_eventType; + long m_timeStamp; + int m_id; + +public: + // m_callbackUserData is for internal usage only + wxObject* m_callbackUserData; + +protected: + // the propagation level: while it is positive, we propagate the event to + // the parent window (if any) + // + // this one doesn't have to be public, we don't have to worry about + // backwards compatibility as it is new + int m_propagationLevel; + +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif + bool m_skipped; + bool m_isCommandEvent; + +private: + // it needs to access our m_propagationLevel + friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce; + + DECLARE_ABSTRACT_CLASS(wxEvent) +}; + +/* + * Helper class to temporarily change an event not to propagate. + */ +class WXDLLIMPEXP_BASE wxPropagationDisabler +{ +public: + wxPropagationDisabler(wxEvent& event) : m_event(event) + { + m_propagationLevelOld = m_event.StopPropagation(); + } + + ~wxPropagationDisabler() + { + m_event.ResumePropagation(m_propagationLevelOld); + } + +private: + wxEvent& m_event; + int m_propagationLevelOld; + + DECLARE_NO_COPY_CLASS(wxPropagationDisabler) +}; + +/* + * Another one to temporarily lower propagation level. + */ +class WXDLLIMPEXP_BASE wxPropagateOnce +{ +public: + wxPropagateOnce(wxEvent& event) : m_event(event) + { + wxASSERT_MSG( m_event.m_propagationLevel > 0, + _T("shouldn't be used unless ShouldPropagate()!") ); + + m_event.m_propagationLevel--; + } + + ~wxPropagateOnce() + { + m_event.m_propagationLevel++; + } + +private: + wxEvent& m_event; + + DECLARE_NO_COPY_CLASS(wxPropagateOnce) +}; + +#if wxUSE_GUI + + +// Item or menu event class +/* + wxEVT_COMMAND_BUTTON_CLICKED + wxEVT_COMMAND_CHECKBOX_CLICKED + wxEVT_COMMAND_CHOICE_SELECTED + wxEVT_COMMAND_LISTBOX_SELECTED + wxEVT_COMMAND_LISTBOX_DOUBLECLICKED + wxEVT_COMMAND_TEXT_UPDATED + wxEVT_COMMAND_TEXT_ENTER + wxEVT_COMMAND_MENU_SELECTED + wxEVT_COMMAND_SLIDER_UPDATED + wxEVT_COMMAND_RADIOBOX_SELECTED + wxEVT_COMMAND_RADIOBUTTON_SELECTED + wxEVT_COMMAND_SCROLLBAR_UPDATED + wxEVT_COMMAND_VLBOX_SELECTED + wxEVT_COMMAND_COMBOBOX_SELECTED + wxEVT_COMMAND_TOGGLEBUTTON_CLICKED +*/ + +#if WXWIN_COMPATIBILITY_2_4 +// Backwards compatibility for wxCommandEvent::m_commandString, will lead to compilation errors in some cases of usage +class WXDLLIMPEXP_CORE wxCommandEvent; + +class WXDLLIMPEXP_CORE wxCommandEventStringHelper +{ +public: + wxCommandEventStringHelper(wxCommandEvent * evt) + : m_evt(evt) + { } + + void operator=(const wxString &str); + operator wxString(); + const wxChar* c_str() const; + +private: + wxCommandEvent* m_evt; +}; +#endif + +class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent +{ +public: + wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); + + wxCommandEvent(const wxCommandEvent& event) + : wxEvent(event), +#if WXWIN_COMPATIBILITY_2_4 + m_commandString(this), +#endif + m_cmdString(event.m_cmdString), + m_commandInt(event.m_commandInt), + m_extraLong(event.m_extraLong), + m_clientData(event.m_clientData), + m_clientObject(event.m_clientObject) + { } + + // Set/Get client data from controls + void SetClientData(void* clientData) { m_clientData = clientData; } + void *GetClientData() const { return m_clientData; } + + // Set/Get client object from controls + void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } + wxClientData *GetClientObject() const { return m_clientObject; } + + // Get listbox selection if single-choice + int GetSelection() const { return m_commandInt; } + + // Set/Get listbox/choice selection string + void SetString(const wxString& s) { m_cmdString = s; } + wxString GetString() const; + + // Get checkbox value + bool IsChecked() const { return m_commandInt != 0; } + + // true if the listbox event was a selection. + bool IsSelection() const { return (m_extraLong != 0); } + + void SetExtraLong(long extraLong) { m_extraLong = extraLong; } + long GetExtraLong() const { return m_extraLong; } + + void SetInt(int i) { m_commandInt = i; } + int GetInt() const { return m_commandInt; } + + virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } + +#if WXWIN_COMPATIBILITY_2_4 +public: + wxCommandEventStringHelper m_commandString; +#else +protected: +#endif + wxString m_cmdString; // String event argument + int m_commandInt; + long m_extraLong; // Additional information (e.g. select/deselect) + void* m_clientData; // Arbitrary client data + wxClientData* m_clientObject; // Arbitrary client object + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) +}; + +#if WXWIN_COMPATIBILITY_2_4 +inline void wxCommandEventStringHelper::operator=(const wxString &str) +{ + m_evt->SetString(str); +} + +inline wxCommandEventStringHelper::operator wxString() +{ + return m_evt->GetString(); +} + +inline const wxChar* wxCommandEventStringHelper::c_str() const +{ + return m_evt->GetString().c_str(); +} +#endif + +// this class adds a possibility to react (from the user) code to a control +// notification: allow or veto the operation being reported. +class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent +{ +public: + wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxCommandEvent(commandType, winid) + { m_bAllow = true; } + + wxNotifyEvent(const wxNotifyEvent& event) + : wxCommandEvent(event) + { m_bAllow = event.m_bAllow; } + + // veto the operation (usually it's allowed by default) + void Veto() { m_bAllow = false; } + + // allow the operation if it was disabled by default + void Allow() { m_bAllow = true; } + + // for implementation code only: is the operation allowed? + bool IsAllowed() const { return m_bAllow; } + + virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); } + +private: + bool m_bAllow; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent) +}; + +// Scroll event class, derived form wxCommandEvent. wxScrollEvents are +// sent by wxSlider and wxScrollBar. +/* + wxEVT_SCROLL_TOP + wxEVT_SCROLL_BOTTOM + wxEVT_SCROLL_LINEUP + wxEVT_SCROLL_LINEDOWN + wxEVT_SCROLL_PAGEUP + wxEVT_SCROLL_PAGEDOWN + wxEVT_SCROLL_THUMBTRACK + wxEVT_SCROLL_THUMBRELEASE + wxEVT_SCROLL_CHANGED +*/ + +class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent +{ +public: + wxScrollEvent(wxEventType commandType = wxEVT_NULL, + int winid = 0, int pos = 0, int orient = 0); + + int GetOrientation() const { return (int) m_extraLong; } + int GetPosition() const { return m_commandInt; } + void SetOrientation(int orient) { m_extraLong = (long) orient; } + void SetPosition(int pos) { m_commandInt = pos; } + + virtual wxEvent *Clone() const { return new wxScrollEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent) +}; + +// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents +// are sent by wxWindow. +/* + wxEVT_SCROLLWIN_TOP + wxEVT_SCROLLWIN_BOTTOM + wxEVT_SCROLLWIN_LINEUP + wxEVT_SCROLLWIN_LINEDOWN + wxEVT_SCROLLWIN_PAGEUP + wxEVT_SCROLLWIN_PAGEDOWN + wxEVT_SCROLLWIN_THUMBTRACK + wxEVT_SCROLLWIN_THUMBRELEASE +*/ + +class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent +{ +public: + wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, + int pos = 0, int orient = 0); + wxScrollWinEvent(const wxScrollWinEvent & event) : wxEvent(event) + { m_commandInt = event.m_commandInt; + m_extraLong = event.m_extraLong; } + + int GetOrientation() const { return (int) m_extraLong; } + int GetPosition() const { return m_commandInt; } + void SetOrientation(int orient) { m_extraLong = (long) orient; } + void SetPosition(int pos) { m_commandInt = pos; } + + virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); } + +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif + int m_commandInt; + long m_extraLong; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent) +}; + +// Mouse event class + +/* + wxEVT_LEFT_DOWN + wxEVT_LEFT_UP + wxEVT_MIDDLE_DOWN + wxEVT_MIDDLE_UP + wxEVT_RIGHT_DOWN + wxEVT_RIGHT_UP + wxEVT_MOTION + wxEVT_ENTER_WINDOW + wxEVT_LEAVE_WINDOW + wxEVT_LEFT_DCLICK + wxEVT_MIDDLE_DCLICK + wxEVT_RIGHT_DCLICK + wxEVT_NC_LEFT_DOWN + wxEVT_NC_LEFT_UP, + wxEVT_NC_MIDDLE_DOWN, + wxEVT_NC_MIDDLE_UP, + wxEVT_NC_RIGHT_DOWN, + wxEVT_NC_RIGHT_UP, + wxEVT_NC_MOTION, + wxEVT_NC_ENTER_WINDOW, + wxEVT_NC_LEAVE_WINDOW, + wxEVT_NC_LEFT_DCLICK, + wxEVT_NC_MIDDLE_DCLICK, + wxEVT_NC_RIGHT_DCLICK, +*/ + +// the symbolic names for the mouse buttons +enum +{ + wxMOUSE_BTN_ANY = -1, + wxMOUSE_BTN_NONE = 0, + wxMOUSE_BTN_LEFT = 1, + wxMOUSE_BTN_MIDDLE = 2, + wxMOUSE_BTN_RIGHT = 3 +}; + +class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent +{ +public: + wxMouseEvent(wxEventType mouseType = wxEVT_NULL); + wxMouseEvent(const wxMouseEvent& event) : wxEvent(event) + { Assign(event); } + + // Was it a button event? (*doesn't* mean: is any button *down*?) + bool IsButton() const { return Button(wxMOUSE_BTN_ANY); } + + // Was it a down event from this (or any) button? + bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; + + // Was it a dclick event from this (or any) button? + bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; + + // Was it a up event from this (or any) button? + bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; + + // Was the given button? + bool Button(int but) const; + + // Was the given button in Down state? + bool ButtonIsDown(int but) const; + + // Get the button which is changing state (wxMOUSE_BTN_NONE if none) + int GetButton() const; + + // Find state of shift/control keys + bool ControlDown() const { return m_controlDown; } + bool MetaDown() const { return m_metaDown; } + bool AltDown() const { return m_altDown; } + bool ShiftDown() const { return m_shiftDown; } + bool CmdDown() const + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + // Find which event was just generated + bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); } + bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); } + bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); } + + bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); } + bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); } + bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); } + + bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } + bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } + bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } + + // Find the current state of the mouse buttons (regardless + // of current event type) + bool LeftIsDown() const { return m_leftDown; } + bool MiddleIsDown() const { return m_middleDown; } + bool RightIsDown() const { return m_rightDown; } + + // True if a button is down and the mouse is moving + bool Dragging() const + { + return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY); + } + + // True if the mouse is moving, and no button is down + bool Moving() const + { + return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY); + } + + // True if the mouse is just entering the window + bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); } + + // True if the mouse is just leaving the window + bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } + + // Find the position of the event + void GetPosition(wxCoord *xpos, wxCoord *ypos) const + { + if (xpos) + *xpos = m_x; + if (ypos) + *ypos = m_y; + } + + void GetPosition(long *xpos, long *ypos) const + { + if (xpos) + *xpos = (long)m_x; + if (ypos) + *ypos = (long)m_y; + } + + // Find the position of the event + wxPoint GetPosition() const { return wxPoint(m_x, m_y); } + + // Find the logical position of the event given the DC + wxPoint GetLogicalPosition(const wxDC& dc) const; + + // Get X position + wxCoord GetX() const { return m_x; } + + // Get Y position + wxCoord GetY() const { return m_y; } + + // Get wheel rotation, positive or negative indicates direction of + // rotation. Current devices all send an event when rotation is equal to + // +/-WheelDelta, but this allows for finer resolution devices to be + // created in the future. Because of this you shouldn't assume that one + // event is equal to 1 line or whatever, but you should be able to either + // do partial line scrolling or wait until +/-WheelDelta rotation values + // have been accumulated before scrolling. + int GetWheelRotation() const { return m_wheelRotation; } + + // Get wheel delta, normally 120. This is the threshold for action to be + // taken, and one such action (for example, scrolling one increment) + // should occur for each delta. + int GetWheelDelta() const { return m_wheelDelta; } + + // Returns the configured number of lines (or whatever) to be scrolled per + // wheel action. Defaults to one. + int GetLinesPerAction() const { return m_linesPerAction; } + + // Is the system set to do page scrolling? + bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } + + virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } + + wxMouseEvent& operator=(const wxMouseEvent& event) { Assign(event); return *this; } + +public: + wxCoord m_x, m_y; + + bool m_leftDown; + bool m_middleDown; + bool m_rightDown; + + bool m_controlDown; + bool m_shiftDown; + bool m_altDown; + bool m_metaDown; + + int m_wheelRotation; + int m_wheelDelta; + int m_linesPerAction; + +protected: + void Assign(const wxMouseEvent& evt); + +private: + DECLARE_DYNAMIC_CLASS(wxMouseEvent) +}; + +// Cursor set event + +/* + wxEVT_SET_CURSOR + */ + +class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent +{ +public: + wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0) + : wxEvent(0, wxEVT_SET_CURSOR), + m_x(x), m_y(y), m_cursor() + { } + + wxSetCursorEvent(const wxSetCursorEvent & event) + : wxEvent(event), + m_x(event.m_x), + m_y(event.m_y), + m_cursor(event.m_cursor) + { } + + wxCoord GetX() const { return m_x; } + wxCoord GetY() const { return m_y; } + + void SetCursor(const wxCursor& cursor) { m_cursor = cursor; } + const wxCursor& GetCursor() const { return m_cursor; } + bool HasCursor() const { return m_cursor.Ok(); } + + virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } + +private: + wxCoord m_x, m_y; + wxCursor m_cursor; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent) +}; + +// Keyboard input event class + +/* + wxEVT_CHAR + wxEVT_CHAR_HOOK + wxEVT_KEY_DOWN + wxEVT_KEY_UP + wxEVT_HOTKEY + */ + +class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent +{ +public: + wxKeyEvent(wxEventType keyType = wxEVT_NULL); + wxKeyEvent(const wxKeyEvent& evt); + + // can be used check if the key event has exactly the given modifiers: + // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() + // && !MetaDown() && !AltDown() && !ShiftDown()" + int GetModifiers() const + { + return (m_controlDown ? wxMOD_CONTROL : 0) | + (m_shiftDown ? wxMOD_SHIFT : 0) | + (m_metaDown ? wxMOD_META : 0) | + (m_altDown ? wxMOD_ALT : 0); + } + + // Find state of shift/control keys + bool ControlDown() const { return m_controlDown; } + bool ShiftDown() const { return m_shiftDown; } + bool MetaDown() const { return m_metaDown; } + bool AltDown() const { return m_altDown; } + + // "Cmd" is a pseudo key which is Control for PC and Unix platforms but + // Apple ("Command") key under Macs: it makes often sense to use it instead + // of, say, ControlDown() because Cmd key is used for the same thing under + // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this + // purpose under Mac) + bool CmdDown() const + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + // exclude MetaDown() from HasModifiers() because NumLock under X is often + // configured as mod2 modifier, yet the key events even when it is pressed + // should be processed normally, not like Ctrl- or Alt-key + bool HasModifiers() const { return ControlDown() || AltDown(); } + + // get the key code: an ASCII7 char or an element of wxKeyCode enum + int GetKeyCode() const { return (int)m_keyCode; } + +#if wxUSE_UNICODE + // get the Unicode character corresponding to this key + wxChar GetUnicodeKey() const { return m_uniChar; } +#endif // wxUSE_UNICODE + + // get the raw key code (platform-dependent) + wxUint32 GetRawKeyCode() const { return m_rawCode; } + + // get the raw key flags (platform-dependent) + wxUint32 GetRawKeyFlags() const { return m_rawFlags; } + + // Find the position of the event + void GetPosition(wxCoord *xpos, wxCoord *ypos) const + { + if (xpos) *xpos = m_x; + if (ypos) *ypos = m_y; + } + + void GetPosition(long *xpos, long *ypos) const + { + if (xpos) *xpos = (long)m_x; + if (ypos) *ypos = (long)m_y; + } + + wxPoint GetPosition() const + { return wxPoint(m_x, m_y); } + + // Get X position + wxCoord GetX() const { return m_x; } + + // Get Y position + wxCoord GetY() const { return m_y; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, Use GetKeyCode instead. + wxDEPRECATED( long KeyCode() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + + virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } + + // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for + // example) + wxKeyEvent& operator=(const wxKeyEvent& evt) + { + m_x = evt.m_x; + m_y = evt.m_y; + + m_keyCode = evt.m_keyCode; + + m_controlDown = evt.m_controlDown; + m_shiftDown = evt.m_shiftDown; + m_altDown = evt.m_altDown; + m_metaDown = evt.m_metaDown; + m_scanCode = evt.m_scanCode; + m_rawCode = evt.m_rawCode; + m_rawFlags = evt.m_rawFlags; +#if wxUSE_UNICODE + m_uniChar = evt.m_uniChar; +#endif + + return *this; + } + +public: + wxCoord m_x, m_y; + + long m_keyCode; + + // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX? + bool m_controlDown; + bool m_shiftDown; + bool m_altDown; + bool m_metaDown; + + // FIXME: what is this for? relation to m_rawXXX? + bool m_scanCode; + +#if wxUSE_UNICODE + // This contains the full Unicode character + // in a character events in Unicode mode + wxChar m_uniChar; +#endif + + // these fields contain the platform-specific information about + // key that was pressed + wxUint32 m_rawCode; + wxUint32 m_rawFlags; + +private: + DECLARE_DYNAMIC_CLASS(wxKeyEvent) +}; + +// Size event class +/* + wxEVT_SIZE + */ + +class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent +{ +public: + wxSizeEvent() : wxEvent(0, wxEVT_SIZE) + { } + wxSizeEvent(const wxSize& sz, int winid = 0) + : wxEvent(winid, wxEVT_SIZE), + m_size(sz) + { } + wxSizeEvent(const wxSizeEvent & event) + : wxEvent(event), + m_size(event.m_size), m_rect(event.m_rect) + { } + wxSizeEvent(const wxRect& rect, int id = 0) + : m_size(rect.GetSize()), m_rect(rect) + { m_eventType = wxEVT_SIZING; m_id = id; } + + wxSize GetSize() const { return m_size; } + wxRect GetRect() const { return m_rect; } + void SetRect(const wxRect& rect) { m_rect = rect; } + + virtual wxEvent *Clone() const { return new wxSizeEvent(*this); } + +public: + // For internal usage only. Will be converted to protected members. + wxSize m_size; + wxRect m_rect; // Used for wxEVT_SIZING + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent) +}; + +// Move event class + +/* + wxEVT_MOVE + */ + +class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent +{ +public: + wxMoveEvent() + : wxEvent(0, wxEVT_MOVE) + { } + wxMoveEvent(const wxPoint& pos, int winid = 0) + : wxEvent(winid, wxEVT_MOVE), + m_pos(pos) + { } + wxMoveEvent(const wxMoveEvent& event) + : wxEvent(event), + m_pos(event.m_pos) + { } + wxMoveEvent(const wxRect& rect, int id = 0) + : m_pos(rect.GetPosition()), m_rect(rect) + { m_eventType = wxEVT_MOVING; m_id = id; } + + wxPoint GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + wxRect GetRect() const { return m_rect; } + void SetRect(const wxRect& rect) { m_rect = rect; } + + virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } + +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif + wxPoint m_pos; + wxRect m_rect; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent) +}; + +// Paint event class +/* + wxEVT_PAINT + wxEVT_NC_PAINT + wxEVT_PAINT_ICON + */ + +#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) + // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined + extern WXDLLIMPEXP_CORE int g_isPainting; +#endif // debug + +class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent +{ +public: + wxPaintEvent(int Id = 0) + : wxEvent(Id, wxEVT_PAINT) + { +#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) + // set the internal flag for the duration of processing of WM_PAINT + g_isPainting++; +#endif // debug + } + + // default copy ctor and dtor are normally fine, we only need them to keep + // g_isPainting updated in debug build +#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) + wxPaintEvent(const wxPaintEvent& event) + : wxEvent(event) + { + g_isPainting++; + } + + virtual ~wxPaintEvent() + { + g_isPainting--; + } +#endif // debug + + virtual wxEvent *Clone() const { return new wxPaintEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent) +}; + +class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent +{ +public: + wxNcPaintEvent(int winid = 0) + : wxEvent(winid, wxEVT_NC_PAINT) + { } + + virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent) +}; + +// Erase background event class +/* + wxEVT_ERASE_BACKGROUND + */ + +class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent +{ +public: + wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) + : wxEvent(Id, wxEVT_ERASE_BACKGROUND), + m_dc(dc) + { } + + wxEraseEvent(const wxEraseEvent& event) + : wxEvent(event), + m_dc(event.m_dc) + { } + + wxDC *GetDC() const { return m_dc; } + + virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } + +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif + wxDC *m_dc; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent) +}; + +// Focus event class +/* + wxEVT_SET_FOCUS + wxEVT_KILL_FOCUS + */ + +class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent +{ +public: + wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0) + : wxEvent(winid, type) + { m_win = NULL; } + + wxFocusEvent(const wxFocusEvent& event) + : wxEvent(event) + { m_win = event.m_win; } + + // The window associated with this event is the window which had focus + // before for SET event and the window which will have focus for the KILL + // one. NB: it may be NULL in both cases! + wxWindow *GetWindow() const { return m_win; } + void SetWindow(wxWindow *win) { m_win = win; } + + virtual wxEvent *Clone() const { return new wxFocusEvent(*this); } + +private: + wxWindow *m_win; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent) +}; + +// wxChildFocusEvent notifies the parent that a child has got the focus: unlike +// wxFocusEvent it is propagated upwards the window chain +class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent +{ +public: + wxChildFocusEvent(wxWindow *win = NULL); + + wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } + + virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent) +}; + +// Activate event class +/* + wxEVT_ACTIVATE + wxEVT_ACTIVATE_APP + wxEVT_HIBERNATE + */ + +class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent +{ +public: + wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0) + : wxEvent(Id, type) + { m_active = active; } + wxActivateEvent(const wxActivateEvent& event) + : wxEvent(event) + { m_active = event.m_active; } + + bool GetActive() const { return m_active; } + + virtual wxEvent *Clone() const { return new wxActivateEvent(*this); } + +private: + bool m_active; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent) +}; + +// InitDialog event class +/* + wxEVT_INIT_DIALOG + */ + +class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent +{ +public: + wxInitDialogEvent(int Id = 0) + : wxEvent(Id, wxEVT_INIT_DIALOG) + { } + + virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent) +}; + +// Miscellaneous menu event class +/* + wxEVT_MENU_OPEN, + wxEVT_MENU_CLOSE, + wxEVT_MENU_HIGHLIGHT, +*/ + +class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent +{ +public: + wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL) + : wxEvent(winid, type) + { m_menuId = winid; m_menu = menu; } + wxMenuEvent(const wxMenuEvent & event) + : wxEvent(event) + { m_menuId = event.m_menuId; m_menu = event.m_menu; } + + // only for wxEVT_MENU_HIGHLIGHT + int GetMenuId() const { return m_menuId; } + + // only for wxEVT_MENU_OPEN/CLOSE + bool IsPopup() const { return m_menuId == wxID_ANY; } + + // only for wxEVT_MENU_OPEN/CLOSE + wxMenu* GetMenu() const { return m_menu; } + + virtual wxEvent *Clone() const { return new wxMenuEvent(*this); } + +private: + int m_menuId; + wxMenu* m_menu; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent) +}; + +// Window close or session close event class +/* + wxEVT_CLOSE_WINDOW, + wxEVT_END_SESSION, + wxEVT_QUERY_END_SESSION + */ + +class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent +{ +public: + wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0) + : wxEvent(winid, type), + m_loggingOff(true), + m_veto(false), // should be false by default + m_canVeto(true) {} + + wxCloseEvent(const wxCloseEvent & event) + : wxEvent(event), + m_loggingOff(event.m_loggingOff), + m_veto(event.m_veto), + m_canVeto(event.m_canVeto) {} + + void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } + bool GetLoggingOff() const + { + // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it + // doesn't make sense for wxEVT_CLOSE_WINDOW + wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW, + _T("this flag is for end session events only") ); + + return m_loggingOff; + } + + void Veto(bool veto = true) + { + // GetVeto() will return false anyhow... + wxCHECK_RET( m_canVeto, + wxT("call to Veto() ignored (can't veto this event)") ); + + m_veto = veto; + } + void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } + bool CanVeto() const { return m_canVeto; } + bool GetVeto() const { return m_canVeto && m_veto; } + + virtual wxEvent *Clone() const { return new wxCloseEvent(*this); } + +protected: + bool m_loggingOff, + m_veto, + m_canVeto; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent) +}; + +/* + wxEVT_SHOW + */ + +class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent +{ +public: + wxShowEvent(int winid = 0, bool show = false) + : wxEvent(winid, wxEVT_SHOW) + { m_show = show; } + wxShowEvent(const wxShowEvent & event) + : wxEvent(event) + { m_show = event.m_show; } + + void SetShow(bool show) { m_show = show; } + bool GetShow() const { return m_show; } + + virtual wxEvent *Clone() const { return new wxShowEvent(*this); } + +protected: + bool m_show; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent) +}; + +/* + wxEVT_ICONIZE + */ + +class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent +{ +public: + wxIconizeEvent(int winid = 0, bool iconized = true) + : wxEvent(winid, wxEVT_ICONIZE) + { m_iconized = iconized; } + wxIconizeEvent(const wxIconizeEvent & event) + : wxEvent(event) + { m_iconized = event.m_iconized; } + + // return true if the frame was iconized, false if restored + bool Iconized() const { return m_iconized; } + + virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); } + +protected: + bool m_iconized; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent) +}; +/* + wxEVT_MAXIMIZE + */ + +class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent +{ +public: + wxMaximizeEvent(int winid = 0) + : wxEvent(winid, wxEVT_MAXIMIZE) + { } + + virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent) +}; + +// Joystick event class +/* + wxEVT_JOY_BUTTON_DOWN, + wxEVT_JOY_BUTTON_UP, + wxEVT_JOY_MOVE, + wxEVT_JOY_ZMOVE +*/ + +// Which joystick? Same as Windows ids so no conversion necessary. +enum +{ + wxJOYSTICK1, + wxJOYSTICK2 +}; + +// Which button is down? +enum +{ + wxJOY_BUTTON_ANY = -1, + wxJOY_BUTTON1 = 1, + wxJOY_BUTTON2 = 2, + wxJOY_BUTTON3 = 4, + wxJOY_BUTTON4 = 8 +}; + +class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent +{ +#if WXWIN_COMPATIBILITY_2_4 +public: +#else +protected: +#endif + wxPoint m_pos; + int m_zPosition; + int m_buttonChange; // Which button changed? + int m_buttonState; // Which buttons are down? + int m_joyStick; // Which joystick? + +public: + wxJoystickEvent(wxEventType type = wxEVT_NULL, + int state = 0, + int joystick = wxJOYSTICK1, + int change = 0) + : wxEvent(0, type), + m_pos(), + m_zPosition(0), + m_buttonChange(change), + m_buttonState(state), + m_joyStick(joystick) + { + } + wxJoystickEvent(const wxJoystickEvent & event) + : wxEvent(event), + m_pos(event.m_pos), + m_zPosition(event.m_zPosition), + m_buttonChange(event.m_buttonChange), + m_buttonState(event.m_buttonState), + m_joyStick(event.m_joyStick) + { } + + wxPoint GetPosition() const { return m_pos; } + int GetZPosition() const { return m_zPosition; } + int GetButtonState() const { return m_buttonState; } + int GetButtonChange() const { return m_buttonChange; } + int GetJoystick() const { return m_joyStick; } + + void SetJoystick(int stick) { m_joyStick = stick; } + void SetButtonState(int state) { m_buttonState = state; } + void SetButtonChange(int change) { m_buttonChange = change; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + void SetZPosition(int zPos) { m_zPosition = zPos; } + + // Was it a button event? (*doesn't* mean: is any button *down*?) + bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) || + (GetEventType() == wxEVT_JOY_BUTTON_UP)); } + + // Was it a move event? + bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); } + + // Was it a zmove event? + bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); } + + // Was it a down event from button 1, 2, 3, 4 or any? + bool ButtonDown(int but = wxJOY_BUTTON_ANY) const + { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) && + ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } + + // Was it a up event from button 1, 2, 3 or any? + bool ButtonUp(int but = wxJOY_BUTTON_ANY) const + { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) && + ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } + + // Was the given button 1,2,3,4 or any in Down state? + bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const + { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || + ((m_buttonState & but) == but)); } + + virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent) +}; + +// Drop files event class +/* + wxEVT_DROP_FILES + */ + +class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent +{ +public: + int m_noFiles; + wxPoint m_pos; + wxString* m_files; + + wxDropFilesEvent(wxEventType type = wxEVT_NULL, + int noFiles = 0, + wxString *files = (wxString *) NULL) + : wxEvent(0, type), + m_noFiles(noFiles), + m_pos(), + m_files(files) + { } + + // we need a copy ctor to avoid deleting m_files pointer twice + wxDropFilesEvent(const wxDropFilesEvent& other) + : wxEvent(other), + m_noFiles(other.m_noFiles), + m_pos(other.m_pos), + m_files(NULL) + { + m_files = new wxString[m_noFiles]; + for ( int n = 0; n < m_noFiles; n++ ) + { + m_files[n] = other.m_files[n]; + } + } + + virtual ~wxDropFilesEvent() + { + delete [] m_files; + } + + wxPoint GetPosition() const { return m_pos; } + int GetNumberOfFiles() const { return m_noFiles; } + wxString *GetFiles() const { return m_files; } + + virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent) +}; + +// Update UI event +/* + wxEVT_UPDATE_UI + */ + +// Whether to always send update events to windows, or +// to only send update events to those with the +// wxWS_EX_PROCESS_UI_UPDATES style. + +enum wxUpdateUIMode +{ + // Send UI update events to all windows + wxUPDATE_UI_PROCESS_ALL, + + // Send UI update events to windows that have + // the wxWS_EX_PROCESS_UI_UPDATES flag specified + wxUPDATE_UI_PROCESS_SPECIFIED +}; + +class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent +{ +public: + wxUpdateUIEvent(wxWindowID commandId = 0) + : wxCommandEvent(wxEVT_UPDATE_UI, commandId) + { + m_checked = + m_enabled = + m_shown = + m_setEnabled = + m_setShown = + m_setText = + m_setChecked = false; + } + wxUpdateUIEvent(const wxUpdateUIEvent & event) + : wxCommandEvent(event), + m_checked(event.m_checked), + m_enabled(event.m_enabled), + m_shown(event.m_shown), + m_setEnabled(event.m_setEnabled), + m_setShown(event.m_setShown), + m_setText(event.m_setText), + m_setChecked(event.m_setChecked), + m_text(event.m_text) + { } + + bool GetChecked() const { return m_checked; } + bool GetEnabled() const { return m_enabled; } + bool GetShown() const { return m_shown; } + wxString GetText() const { return m_text; } + bool GetSetText() const { return m_setText; } + bool GetSetChecked() const { return m_setChecked; } + bool GetSetEnabled() const { return m_setEnabled; } + bool GetSetShown() const { return m_setShown; } + + void Check(bool check) { m_checked = check; m_setChecked = true; } + void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; } + void Show(bool show) { m_shown = show; m_setShown = true; } + void SetText(const wxString& text) { m_text = text; m_setText = true; } + + // Sets the interval between updates in milliseconds. + // Set to -1 to disable updates, or to 0 to update as frequently as possible. + static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; } + + // Returns the current interval between updates in milliseconds + static long GetUpdateInterval() { return sm_updateInterval; } + + // Can we update this window? + static bool CanUpdate(wxWindowBase *win); + + // Reset the update time to provide a delay until the next + // time we should update + static void ResetUpdateTime(); + + // Specify how wxWidgets will send update events: to + // all windows, or only to those which specify that they + // will process the events. + static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; } + + // Returns the UI update mode + static wxUpdateUIMode GetMode() { return sm_updateMode; } + + virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); } + +protected: + bool m_checked; + bool m_enabled; + bool m_shown; + bool m_setEnabled; + bool m_setShown; + bool m_setText; + bool m_setChecked; + wxString m_text; +#if wxUSE_LONGLONG + static wxLongLong sm_lastUpdate; +#endif + static long sm_updateInterval; + static wxUpdateUIMode sm_updateMode; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent) +}; + +/* + wxEVT_SYS_COLOUR_CHANGED + */ + +// TODO: shouldn't all events record the window ID? +class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent +{ +public: + wxSysColourChangedEvent() + : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED) + { } + + virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent) +}; + +/* + wxEVT_MOUSE_CAPTURE_CHANGED + The window losing the capture receives this message + (even if it released the capture itself). + */ + +class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent +{ +public: + wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL) + : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED), + m_gainedCapture(gainedCapture) + { } + + wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event) + : wxEvent(event), + m_gainedCapture(event.m_gainedCapture) + { } + + virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); } + + wxWindow* GetCapturedWindow() const { return m_gainedCapture; } + +private: + wxWindow* m_gainedCapture; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent) +}; + +/* + wxEVT_MOUSE_CAPTURE_LOST + The window losing the capture receives this message, unless it released it + it itself or unless wxWindow::CaptureMouse was called on another window + (and so capture will be restored when the new capturer releases it). + */ + +class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent +{ +public: + wxMouseCaptureLostEvent(wxWindowID winid = 0) + : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST) + {} + + wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event) + : wxEvent(event) + {} + + virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); } + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent) +}; + +/* + wxEVT_DISPLAY_CHANGED + */ +class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent +{ +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent) + +public: + wxDisplayChangedEvent() + : wxEvent(0, wxEVT_DISPLAY_CHANGED) + { } + + virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); } +}; + +/* + wxEVT_PALETTE_CHANGED + */ + +class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent +{ +public: + wxPaletteChangedEvent(wxWindowID winid = 0) + : wxEvent(winid, wxEVT_PALETTE_CHANGED), + m_changedWindow((wxWindow *) NULL) + { } + + wxPaletteChangedEvent(const wxPaletteChangedEvent& event) + : wxEvent(event), + m_changedWindow(event.m_changedWindow) + { } + + void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } + wxWindow* GetChangedWindow() const { return m_changedWindow; } + + virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); } + +protected: + wxWindow* m_changedWindow; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent) +}; + +/* + wxEVT_QUERY_NEW_PALETTE + Indicates the window is getting keyboard focus and should re-do its palette. + */ + +class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent +{ +public: + wxQueryNewPaletteEvent(wxWindowID winid = 0) + : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE), + m_paletteRealized(false) + { } + wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event) + : wxEvent(event), + m_paletteRealized(event.m_paletteRealized) + { } + + // App sets this if it changes the palette. + void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } + bool GetPaletteRealized() const { return m_paletteRealized; } + + virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); } + +protected: + bool m_paletteRealized; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent) +}; + +/* + Event generated by dialog navigation keys + wxEVT_NAVIGATION_KEY + */ +// NB: don't derive from command event to avoid being propagated to the parent +class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent +{ +public: + wxNavigationKeyEvent() + : wxEvent(0, wxEVT_NAVIGATION_KEY), + m_flags(IsForward | FromTab), // defaults are for TAB + m_focus((wxWindow *)NULL) + { + m_propagationLevel = wxEVENT_PROPAGATE_NONE; + } + + wxNavigationKeyEvent(const wxNavigationKeyEvent& event) + : wxEvent(event), + m_flags(event.m_flags), + m_focus(event.m_focus) + { } + + // direction: forward (true) or backward (false) + bool GetDirection() const + { return (m_flags & IsForward) != 0; } + void SetDirection(bool bForward) + { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; } + + // it may be a window change event (MDI, notebook pages...) or a control + // change event + bool IsWindowChange() const + { return (m_flags & WinChange) != 0; } + void SetWindowChange(bool bIs) + { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } + + // Set to true under MSW if the event was generated using the tab key. + // This is required for proper navogation over radio buttons + bool IsFromTab() const + { return (m_flags & FromTab) != 0; } + void SetFromTab(bool bIs) + { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; } + + // the child which has the focus currently (may be NULL - use + // wxWindow::FindFocus then) + wxWindow* GetCurrentFocus() const { return m_focus; } + void SetCurrentFocus(wxWindow *win) { m_focus = win; } + + // Set flags + void SetFlags(long flags) { m_flags = flags; } + + virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); } + + enum + { + IsBackward = 0x0000, + IsForward = 0x0001, + WinChange = 0x0002, + FromTab = 0x0004 + }; + + long m_flags; + wxWindow *m_focus; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent) +}; + +// Window creation/destruction events: the first is sent as soon as window is +// created (i.e. the underlying GUI object exists), but when the C++ object is +// fully initialized (so virtual functions may be called). The second, +// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's +// still safe to call virtual functions at this moment +/* + wxEVT_CREATE + wxEVT_DESTROY + */ + +class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent +{ +public: + wxWindowCreateEvent(wxWindow *win = NULL); + + wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } + + virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent) +}; + +class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent +{ +public: + wxWindowDestroyEvent(wxWindow *win = NULL); + + wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } + + virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent) +}; + +// A help event is sent when the user clicks on a window in context-help mode. +/* + wxEVT_HELP + wxEVT_DETAILED_HELP +*/ + +class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent +{ +public: + // how was this help event generated? + enum Origin + { + Origin_Unknown, // unrecognized event source + Origin_Keyboard, // event generated from F1 key press + Origin_HelpButton // event from [?] button on the title bar (Windows) + }; + + wxHelpEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0, + const wxPoint& pt = wxDefaultPosition, + Origin origin = Origin_Unknown) + : wxCommandEvent(type, winid), + m_pos(pt), + m_origin(GuessOrigin(origin)) + { } + wxHelpEvent(const wxHelpEvent & event) + : wxCommandEvent(event), + m_pos(event.m_pos), + m_target(event.m_target), + m_link(event.m_link), + m_origin(event.m_origin) + { } + + // Position of event (in screen coordinates) + const wxPoint& GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + + // Optional link to further help + const wxString& GetLink() const { return m_link; } + void SetLink(const wxString& link) { m_link = link; } + + // Optional target to display help in. E.g. a window specification + const wxString& GetTarget() const { return m_target; } + void SetTarget(const wxString& target) { m_target = target; } + + virtual wxEvent *Clone() const { return new wxHelpEvent(*this); } + + // optional indication of the event source + Origin GetOrigin() const { return m_origin; } + void SetOrigin(Origin origin) { m_origin = origin; } + +protected: + wxPoint m_pos; + wxString m_target; + wxString m_link; + Origin m_origin; + + // we can try to guess the event origin ourselves, even if none is + // specified in the ctor + static Origin GuessOrigin(Origin origin); + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent) +}; + +// A Clipboard Text event is sent when a window intercepts text copy/cut/paste +// message, i.e. the user has cut/copied/pasted data from/into a text control +// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc. +// NOTE : under windows these events are *NOT* generated automatically +// for a Rich Edit text control. +/* +wxEVT_COMMAND_TEXT_COPY +wxEVT_COMMAND_TEXT_CUT +wxEVT_COMMAND_TEXT_PASTE +*/ + +class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent +{ +public: + wxClipboardTextEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0) + : wxCommandEvent(type, winid) + { } + wxClipboardTextEvent(const wxClipboardTextEvent & event) + : wxCommandEvent(event) + { } + + virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent) +}; + +// A Context event is sent when the user right clicks on a window or +// presses Shift-F10 +// NOTE : Under windows this is a repackaged WM_CONTETXMENU message +// Under other systems it may have to be generated from a right click event +/* + wxEVT_CONTEXT_MENU +*/ + +class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent +{ +public: + wxContextMenuEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0, + const wxPoint& pt = wxDefaultPosition) + : wxCommandEvent(type, winid), + m_pos(pt) + { } + wxContextMenuEvent(const wxContextMenuEvent & event) + : wxCommandEvent(event), + m_pos(event.m_pos) + { } + + // Position of event (in screen coordinates) + const wxPoint& GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + + virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); } + +protected: + wxPoint m_pos; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) +}; + +// Idle event +/* + wxEVT_IDLE + */ + +// Whether to always send idle events to windows, or +// to only send update events to those with the +// wxWS_EX_PROCESS_IDLE style. + +enum wxIdleMode +{ + // Send idle events to all windows + wxIDLE_PROCESS_ALL, + + // Send idle events to windows that have + // the wxWS_EX_PROCESS_IDLE flag specified + wxIDLE_PROCESS_SPECIFIED +}; + +class WXDLLIMPEXP_CORE wxIdleEvent : public wxEvent +{ +public: + wxIdleEvent() + : wxEvent(0, wxEVT_IDLE), + m_requestMore(false) + { } + wxIdleEvent(const wxIdleEvent & event) + : wxEvent(event), + m_requestMore(event.m_requestMore) + { } + + void RequestMore(bool needMore = true) { m_requestMore = needMore; } + bool MoreRequested() const { return m_requestMore; } + + virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } + + // Specify how wxWidgets will send idle events: to + // all windows, or only to those which specify that they + // will process the events. + static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } + + // Returns the idle event mode + static wxIdleMode GetMode() { return sm_idleMode; } + + // Can we send an idle event? + static bool CanSend(wxWindow* win); + +protected: + bool m_requestMore; + static wxIdleMode sm_idleMode; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) +}; + +#endif // wxUSE_GUI + +/* TODO + wxEVT_MOUSE_CAPTURE_CHANGED, + wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) +// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate + // wxEVT_FONT_CHANGED to all other windows (maybe). + wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific. + wxEVT_MEASURE_ITEM, + wxEVT_COMPARE_ITEM +*/ + + +// ============================================================================ +// event handler and related classes +// ============================================================================ + +// for backwards compatibility and to prevent eVC 4 for ARM from crashing with +// internal compiler error when compiling wx, we define wxObjectEventFunction +// as a wxObject method even though it can only be a wxEvtHandler one +typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); + +// we can't have ctors nor base struct in backwards compatibility mode or +// otherwise we won't be able to initialize the objects with an agregate, so +// we have to keep both versions +#if WXWIN_COMPATIBILITY_EVENT_TYPES + +struct WXDLLIMPEXP_BASE wxEventTableEntry +{ + // For some reason, this can't be wxEventType, or VC++ complains. + int m_eventType; // main event type + int m_id; // control/menu/toolbar id + int m_lastId; // used for ranges of ids + wxObjectEventFunction m_fn; // function to call: not wxEventFunction, + // because of dependency problems + + wxObject* m_callbackUserData; +}; + +#else // !WXWIN_COMPATIBILITY_EVENT_TYPES + +// struct containing the members common to static and dynamic event tables +// entries +struct WXDLLIMPEXP_BASE wxEventTableEntryBase +{ +private: + wxEventTableEntryBase& operator=(const wxEventTableEntryBase& event); + +public: + wxEventTableEntryBase(int winid, int idLast, + wxObjectEventFunction fn, wxObject *data) + : m_id(winid), + m_lastId(idLast), + m_fn(fn), + m_callbackUserData(data) + { } + + wxEventTableEntryBase(const wxEventTableEntryBase& event) + : m_id(event.m_id), + m_lastId(event.m_lastId), + m_fn(event.m_fn), + m_callbackUserData(event.m_callbackUserData) + { } + + // the range of ids for this entry: if m_lastId == wxID_ANY, the range + // consists only of m_id, otherwise it is m_id..m_lastId inclusive + int m_id, + m_lastId; + + // function to call: not wxEventFunction, because of dependency problems + wxObjectEventFunction m_fn; + + // arbitrary user data asosciated with the callback + wxObject* m_callbackUserData; +}; + +// an entry from a static event table +struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase +{ + wxEventTableEntry(const int& evType, int winid, int idLast, + wxObjectEventFunction fn, wxObject *data) + : wxEventTableEntryBase(winid, idLast, fn, data), + m_eventType(evType) + { } + + // the reference to event type: this allows us to not care about the + // (undefined) order in which the event table entries and the event types + // are initialized: initially the value of this reference might be + // invalid, but by the time it is used for the first time, all global + // objects will have been initialized (including the event type constants) + // and so it will have the correct value when it is needed + const int& m_eventType; + +private: + wxEventTableEntry& operator=(const wxEventTableEntry&); +}; + +// an entry used in dynamic event table managed by wxEvtHandler::Connect() +struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase +{ + wxDynamicEventTableEntry(int evType, int winid, int idLast, + wxObjectEventFunction fn, wxObject *data, wxEvtHandler* eventSink) + : wxEventTableEntryBase(winid, idLast, fn, data), + m_eventType(evType), + m_eventSink(eventSink) + { } + + // not a reference here as we can't keep a reference to a temporary int + // created to wrap the constant value typically passed to Connect() - nor + // do we need it + int m_eventType; + + // Pointer to object whose function is fn - so we don't assume the + // EventFunction is always a member of the EventHandler receiving the + // message + wxEvtHandler* m_eventSink; + + DECLARE_NO_COPY_CLASS(wxDynamicEventTableEntry) +}; + +#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES + +// ---------------------------------------------------------------------------- +// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0} +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxEventTable +{ + const wxEventTable *baseTable; // base event table (next in chain) + const wxEventTableEntry *entries; // bottom of entry array +}; + +// ---------------------------------------------------------------------------- +// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups. +// ---------------------------------------------------------------------------- + +WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray); + +class WXDLLIMPEXP_BASE wxEventHashTable +{ +private: + // Internal data structs + struct EventTypeTable + { + wxEventType eventType; + wxEventTableEntryPointerArray eventEntryTable; + }; + typedef EventTypeTable* EventTypeTablePointer; + +public: + // Constructor, needs the event table it needs to hash later on. + // Note: hashing of the event table is not done in the constructor as it + // can be that the event table is not yet full initialize, the hash + // will gets initialized when handling the first event look-up request. + wxEventHashTable(const wxEventTable &table); + // Destructor. + ~wxEventHashTable(); + + // Handle the given event, in other words search the event table hash + // and call self->ProcessEvent() if a match was found. + bool HandleEvent(wxEvent &event, wxEvtHandler *self); + + // Clear table + void Clear(); + + // Clear all tables + static void ClearAll(); + // Rebuild all tables + static void ReconstructAll(); + +protected: + // Init the hash table with the entries of the static event table. + void InitHashTable(); + // Helper funtion of InitHashTable() to insert 1 entry into the hash table. + void AddEntry(const wxEventTableEntry &entry); + // Allocate and init with null pointers the base hash table. + void AllocEventTypeTable(size_t size); + // Grow the hash table in size and transfer all items currently + // in the table to the correct location in the new table. + void GrowEventTypeTable(); + +protected: + const wxEventTable &m_table; + bool m_rebuildHash; + + size_t m_size; + EventTypeTablePointer *m_eventTypeTable; + + static wxEventHashTable* sm_first; + wxEventHashTable* m_previous; + wxEventHashTable* m_next; + + DECLARE_NO_COPY_CLASS(wxEventHashTable) +}; + +// ---------------------------------------------------------------------------- +// wxEvtHandler: the base class for all objects handling wxWidgets events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject +{ +public: + wxEvtHandler(); + virtual ~wxEvtHandler(); + + wxEvtHandler *GetNextHandler() const { return m_nextHandler; } + wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; } + void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } + void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } + + void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; } + bool GetEvtHandlerEnabled() const { return m_enabled; } + + // process an event right now + virtual bool ProcessEvent(wxEvent& event); + + // add an event to be processed later + void AddPendingEvent(wxEvent& event); + + void ProcessPendingEvents(); + +#if wxUSE_THREADS + bool ProcessThreadEvent(wxEvent& event); +#endif + + // Dynamic association of a member function handler with the event handler, + // winid and event type + void Connect(int winid, + int lastId, + int eventType, + wxObjectEventFunction func, + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL); + + // Convenience function: take just one id + void Connect(int winid, + int eventType, + wxObjectEventFunction func, + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) + { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); } + + // Even more convenient: without id (same as using id of wxID_ANY) + void Connect(int eventType, + wxObjectEventFunction func, + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) + { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } + + bool Disconnect(int winid, + int lastId, + wxEventType eventType, + wxObjectEventFunction func = NULL, + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL); + + bool Disconnect(int winid = wxID_ANY, + wxEventType eventType = wxEVT_NULL, + wxObjectEventFunction func = NULL, + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) + { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } + + bool Disconnect(wxEventType eventType, + wxObjectEventFunction func, + wxObject *userData = (wxObject *) NULL, + wxEvtHandler *eventSink = (wxEvtHandler *) NULL) + { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } + + wxList* GetDynamicEventTable() const { return m_dynamicEvents ; } + + // User data can be associated with each wxEvtHandler + void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } + wxClientData *GetClientObject() const { return DoGetClientObject(); } + + void SetClientData( void *data ) { DoSetClientData(data); } + void *GetClientData() const { return DoGetClientData(); } + + // check if the given event table entry matches this event and call the + // handler if it does + // + // return true if the event was processed, false otherwise (no match or the + // handler decided to skip the event) + static bool ProcessEventIfMatches(const wxEventTableEntryBase& tableEntry, + wxEvtHandler *handler, + wxEvent& event); + + // implementation from now on + virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); + bool SearchDynamicEventTable( wxEvent& event ); + +#if wxUSE_THREADS + void ClearEventLocker(); +#endif // wxUSE_THREADS + + // Avoid problems at exit by cleaning up static hash table gracefully + void ClearEventHashTable() { GetEventHashTable().Clear(); } + +private: + static const wxEventTableEntry sm_eventTableEntries[]; + +protected: + // hooks for wxWindow used by ProcessEvent() + // ----------------------------------------- + + // This one is called before trying our own event table to allow plugging + // in the validators. + // + // NB: This method is intentionally *not* inside wxUSE_VALIDATORS! + // It is part of wxBase which doesn't use validators and the code + // is compiled out when building wxBase w/o GUI classes, which affects + // binary compatibility and wxBase library can't be used by GUI + // ports. + virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; } + + // this one is called after failing to find the event handle in our own + // table to give a chance to the other windows to process it + // + // base class implementation passes the event to wxTheApp + virtual bool TryParent(wxEvent& event); + + + static const wxEventTable sm_eventTable; + virtual const wxEventTable *GetEventTable() const; + + static wxEventHashTable sm_eventHashTable; + virtual wxEventHashTable& GetEventHashTable() const; + + wxEvtHandler* m_nextHandler; + wxEvtHandler* m_previousHandler; + wxList* m_dynamicEvents; + wxList* m_pendingEvents; + +#if wxUSE_THREADS +#if defined (__VISAGECPP__) + const wxCriticalSection& Lock() const { return m_eventsLocker; } + wxCriticalSection& Lock() { return m_eventsLocker; } + + wxCriticalSection m_eventsLocker; +# else + const wxCriticalSection& Lock() const { return *m_eventsLocker; } + wxCriticalSection& Lock() { return *m_eventsLocker; } + + wxCriticalSection* m_eventsLocker; +# endif +#endif + + // Is event handler enabled? + bool m_enabled; + + + // The user data: either an object which will be deleted by the container + // when it's deleted or some raw pointer which we do nothing with - only + // one type of data can be used with the given window (i.e. you cannot set + // the void data and then associate the container with wxClientData or vice + // versa) + union + { + wxClientData *m_clientObject; + void *m_clientData; + }; + + // what kind of data do we have? + wxClientDataType m_clientDataType; + + // client data accessors + virtual void DoSetClientObject( wxClientData *data ); + virtual wxClientData *DoGetClientObject() const; + + virtual void DoSetClientData( void *data ); + virtual void *DoGetClientData() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler) +}; + +// Post a message to the given eventhandler which will be processed during the +// next event loop iteration +inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event) +{ + wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") ); + + dest->AddPendingEvent(event); +} + +typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); + +#define wxEventHandler(func) \ + (wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func) + +#if wxUSE_GUI + +typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); +typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); +typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); +typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&); +typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&); +typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&); +typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&); +typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&); +typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&); +typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&); +typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&); +typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&); +typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&); +typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&); +typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&); +typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&); +typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&); +typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&); +typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&); +typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); +typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); +typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); +typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); +typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&); +typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&); +typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); +typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); +typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); +typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&); +typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&); +typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&); +typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&); +typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); +typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&); +typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&); +typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&); +typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&); + +// these typedefs don't have the same name structure as the others, keep for +// backwards compatibility only +#if WXWIN_COMPATIBILITY_2_4 + typedef wxSysColourChangedEventFunction wxSysColourChangedFunction; + typedef wxDisplayChangedEventFunction wxDisplayChangedFunction; +#endif // WXWIN_COMPATIBILITY_2_4 + + +#define wxCommandEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func) +#define wxScrollEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func) +#define wxScrollWinEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func) +#define wxSizeEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func) +#define wxMoveEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func) +#define wxPaintEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func) +#define wxNcPaintEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func) +#define wxEraseEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func) +#define wxMouseEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func) +#define wxCharEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func) +#define wxKeyEventHandler(func) wxCharEventHandler(func) +#define wxFocusEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func) +#define wxChildFocusEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func) +#define wxActivateEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func) +#define wxMenuEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func) +#define wxJoystickEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func) +#define wxDropFilesEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func) +#define wxInitDialogEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func) +#define wxSysColourChangedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func) +#define wxDisplayChangedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func) +#define wxUpdateUIEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func) +#define wxIdleEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func) +#define wxCloseEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func) +#define wxShowEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func) +#define wxIconizeEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func) +#define wxMaximizeEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func) +#define wxNavigationKeyEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func) +#define wxPaletteChangedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func) +#define wxQueryNewPaletteEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func) +#define wxWindowCreateEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func) +#define wxWindowDestroyEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func) +#define wxSetCursorEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func) +#define wxNotifyEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func) +#define wxHelpEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func) +#define wxContextMenuEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func) +#define wxMouseCaptureChangedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func) +#define wxMouseCaptureLostEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureLostEventFunction, &func) +#define wxClipboardTextEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func) + +#endif // wxUSE_GUI + +// N.B. In GNU-WIN32, you *have* to take the address of a member function +// (use &) or the compiler crashes... + +#define DECLARE_EVENT_TABLE() \ + private: \ + static const wxEventTableEntry sm_eventTableEntries[]; \ + protected: \ + static const wxEventTable sm_eventTable; \ + virtual const wxEventTable* GetEventTable() const; \ + static wxEventHashTable sm_eventHashTable; \ + virtual wxEventHashTable& GetEventHashTable() const; + +// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize +// sm_eventTable before using it in GetEventTable() or the compiler gives +// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews) + +#define BEGIN_EVENT_TABLE(theClass, baseClass) \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) }; + +/* + * Event table macros + */ + +// helpers for writing shorter code below: declare an event macro taking 2, 1 +// or none ids (the missing ids default to wxID_ANY) +// +// macro arguments: +// - evt one of wxEVT_XXX constants +// - id1, id2 ids of the first/last id +// - fn the function (should be cast to the right type) +#define wx__DECLARE_EVT2(evt, id1, id2, fn) \ + DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), +#define wx__DECLARE_EVT1(evt, id, fn) \ + wx__DECLARE_EVT2(evt, id, wxID_ANY, fn) +#define wx__DECLARE_EVT0(evt, fn) \ + wx__DECLARE_EVT1(evt, wxID_ANY, fn) + + +// Generic events +#define EVT_CUSTOM(event, winid, func) \ + wx__DECLARE_EVT1(event, winid, wxEventHandler(func)) +#define EVT_CUSTOM_RANGE(event, id1, id2, func) \ + wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func)) + +// EVT_COMMAND +#define EVT_COMMAND(winid, event, func) \ + wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_RANGE(id1, id2, event, func) \ + wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func)) + +#define EVT_NOTIFY(event, winid, func) \ + wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func)) +#define EVT_NOTIFY_RANGE(event, id1, id2, func) \ + wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func)) + +// Miscellaneous +#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func)) +#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func)) +#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func)) +#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func)) +#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func)) +#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) +#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) +#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func)) +#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func)) +#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func)) +#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func)) +#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func)) +#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func)) +#if wxUSE_HOTKEY +#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func)) +#endif +#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func)) +#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func)) +#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func)) +#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func)) +#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func)) +#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func)) +#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func)) +#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func)) +#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func)) +#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func)) +#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func)) +#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) +#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) +#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func)) +#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func)) +#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func)) +#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func)) +#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func)) +#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func)) +#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func)) +#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func)) +#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func)) +#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func)) +#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func)) +#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func)) +#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func)) +#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func)) +#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func)) + +// Mouse events +#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func)) +#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func)) +#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func)) +#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func)) +#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func)) +#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func)) +#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func)) +#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func)) +#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func)) +#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func)) +#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func)) +#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func)) +#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func)) + +// All mouse events +#define EVT_MOUSE_EVENTS(func) \ + EVT_LEFT_DOWN(func) \ + EVT_LEFT_UP(func) \ + EVT_MIDDLE_DOWN(func) \ + EVT_MIDDLE_UP(func) \ + EVT_RIGHT_DOWN(func) \ + EVT_RIGHT_UP(func) \ + EVT_MOTION(func) \ + EVT_LEFT_DCLICK(func) \ + EVT_MIDDLE_DCLICK(func) \ + EVT_RIGHT_DCLICK(func) \ + EVT_LEAVE_WINDOW(func) \ + EVT_ENTER_WINDOW(func) \ + EVT_MOUSEWHEEL(func) + +// Scrolling from wxWindow (sent to wxScrolledWindow) +#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func)) + +#define EVT_SCROLLWIN(func) \ + EVT_SCROLLWIN_TOP(func) \ + EVT_SCROLLWIN_BOTTOM(func) \ + EVT_SCROLLWIN_LINEUP(func) \ + EVT_SCROLLWIN_LINEDOWN(func) \ + EVT_SCROLLWIN_PAGEUP(func) \ + EVT_SCROLLWIN_PAGEDOWN(func) \ + EVT_SCROLLWIN_THUMBTRACK(func) \ + EVT_SCROLLWIN_THUMBRELEASE(func) + +// Scrolling from wxSlider and wxScrollBar +#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func)) +#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func)) +#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func)) +#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func)) +#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func)) +#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func)) +#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func)) +#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func)) +#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func)) + +#define EVT_SCROLL(func) \ + EVT_SCROLL_TOP(func) \ + EVT_SCROLL_BOTTOM(func) \ + EVT_SCROLL_LINEUP(func) \ + EVT_SCROLL_LINEDOWN(func) \ + EVT_SCROLL_PAGEUP(func) \ + EVT_SCROLL_PAGEDOWN(func) \ + EVT_SCROLL_THUMBTRACK(func) \ + EVT_SCROLL_THUMBRELEASE(func) \ + EVT_SCROLL_CHANGED(func) + +// Scrolling from wxSlider and wxScrollBar, with an id +#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func)) + +#define EVT_COMMAND_SCROLL(winid, func) \ + EVT_COMMAND_SCROLL_TOP(winid, func) \ + EVT_COMMAND_SCROLL_BOTTOM(winid, func) \ + EVT_COMMAND_SCROLL_LINEUP(winid, func) \ + EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \ + EVT_COMMAND_SCROLL_PAGEUP(winid, func) \ + EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \ + EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \ + EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \ + EVT_COMMAND_SCROLL_CHANGED(winid, func) + +#if WXWIN_COMPATIBILITY_2_6 + // compatibility macros for the old name, deprecated in 2.8 + #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED + #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED + #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED +#endif // WXWIN_COMPATIBILITY_2_6 + +// Convenience macros for commonly-used commands +#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func)) +#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICE_SELECTED, winid, wxCommandEventHandler(func)) +#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_SELECTED, winid, wxCommandEventHandler(func)) +#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, winid, wxCommandEventHandler(func)) +#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_MENU_SELECTED, winid, wxCommandEventHandler(func)) +#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_MENU_SELECTED, id1, id2, wxCommandEventHandler(func)) +#if defined(__SMARTPHONE__) +# define EVT_BUTTON(winid, func) EVT_MENU(winid, func) +#else +# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_BUTTON_CLICKED, winid, wxCommandEventHandler(func)) +#endif +#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SLIDER_UPDATED, winid, wxCommandEventHandler(func)) +#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBOX_SELECTED, winid, wxCommandEventHandler(func)) +#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBUTTON_SELECTED, winid, wxCommandEventHandler(func)) +// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events +#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SCROLLBAR_UPDATED, winid, wxCommandEventHandler(func)) +#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func)) +#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func)) +#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func)) +#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func)) +#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func)) +#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) +#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func)) +#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func)) + +// Generic command events +#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func)) + +// Joystick events + +#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func)) +#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func)) +#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func)) +#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func)) + +// These are obsolete, see _BUTTON_ events +#if WXWIN_COMPATIBILITY_2_4 + #define EVT_JOY_DOWN(func) EVT_JOY_BUTTON_DOWN(func) + #define EVT_JOY_UP(func) EVT_JOY_BUTTON_UP(func) +#endif // WXWIN_COMPATIBILITY_2_4 + +// All joystick events +#define EVT_JOYSTICK_EVENTS(func) \ + EVT_JOY_BUTTON_DOWN(func) \ + EVT_JOY_BUTTON_UP(func) \ + EVT_JOY_MOVE(func) \ + EVT_JOY_ZMOVE(func) + +// Idle event +#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func)) + +// Update UI event +#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func)) +#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func)) + +// Help events +#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func)) +#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func)) +#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func)) +#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func)) + +// Context Menu Events +#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func)) +#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func)) + +// Clipboard text Events +#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func)) +#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func)) +#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func)) + +// ---------------------------------------------------------------------------- +// Global data +// ---------------------------------------------------------------------------- + +// for pending event processing - notice that there is intentionally no +// WXDLLEXPORT here +extern WXDLLIMPEXP_BASE wxList *wxPendingEvents; +#if wxUSE_THREADS + extern WXDLLIMPEXP_BASE wxCriticalSection *wxPendingEventsLocker; +#endif + +// ---------------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +// Find a window with the focus, that is also a descendant of the given window. +// This is used to determine the window to initially send commands to. +WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); + +#endif // wxUSE_GUI + +#endif // _WX_EVENT_H__ diff --git a/Externals/wxWidgets/include/wx/evtloop.h b/Externals/wxWidgets/include/wx/evtloop.h index 3f44e8688a..51b58eb55e 100644 --- a/Externals/wxWidgets/include/wx/evtloop.h +++ b/Externals/wxWidgets/include/wx/evtloop.h @@ -1,229 +1,229 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/evtloop.h -// Purpose: declares wxEventLoop class -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.06.01 -// RCS-ID: $Id: evtloop.h 53607 2008-05-16 15:21:40Z SN $ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EVTLOOP_H_ -#define _WX_EVTLOOP_H_ - -#include "wx/utils.h" - -class WXDLLIMPEXP_FWD_CORE wxEventLoop; - -// ---------------------------------------------------------------------------- -// wxEventLoop: a GUI event loop -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEventLoopBase -{ -public: - // trivial, but needed (because of wxEventLoopBase) ctor - wxEventLoopBase() { } - - // dtor - virtual ~wxEventLoopBase() { } - - // start the event loop, return the exit code when it is finished - virtual int Run() = 0; - - // exit from the loop with the given exit code - virtual void Exit(int rc = 0) = 0; - - // return true if any events are available - virtual bool Pending() const = 0; - - // dispatch a single event, return false if we should exit from the loop - virtual bool Dispatch() = 0; - - // return currently active (running) event loop, may be NULL - static wxEventLoop *GetActive() { return ms_activeLoop; } - - // set currently active (running) event loop - static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; } - - // is this event loop running now? - // - // notice that even if this event loop hasn't terminated yet but has just - // spawned a nested (e.g. modal) event loop, this would return false - bool IsRunning() const; - -protected: - // this function should be called before the event loop terminates, whether - // this happens normally (because of Exit() call) or abnormally (because of - // an exception thrown from inside the loop) - virtual void OnExit() { } - - - // the pointer to currently active loop - static wxEventLoop *ms_activeLoop; - - DECLARE_NO_COPY_CLASS(wxEventLoopBase) -}; - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) - -// this class can be used to implement a standard event loop logic using -// Pending() and Dispatch() -// -// it also handles idle processing automatically -class WXDLLEXPORT wxEventLoopManual : public wxEventLoopBase -{ -public: - wxEventLoopManual(); - - // enters a loop calling OnNextIteration(), Pending() and Dispatch() and - // terminating when Exit() is called - virtual int Run(); - - // sets the "should exit" flag and wakes up the loop so that it terminates - // soon - virtual void Exit(int rc = 0); - -protected: - // implement this to wake up the loop: usually done by posting a dummy event - // to it (called from Exit()) - virtual void WakeUp() = 0; - - // may be overridden to perform some action at the start of each new event - // loop iteration - virtual void OnNextIteration() { } - - - // the loop exit code - int m_exitcode; - - // should we exit the loop? - bool m_shouldExit; -}; - -#endif // platforms using "manual" loop - -// we're moving away from old m_impl wxEventLoop model as otherwise the user -// code doesn't have access to platform-specific wxEventLoop methods and this -// can sometimes be very useful (e.g. under MSW this is necessary for -// integration with MFC) but currently this is done for MSW only, other ports -// should follow a.s.a.p. -#if defined(__WXPALMOS__) - #include "wx/palmos/evtloop.h" -#elif defined(__WXMSW__) - #include "wx/msw/evtloop.h" -#elif defined(__WXMAC__) - #include "wx/mac/evtloop.h" -#elif defined(__WXDFB__) - #include "wx/dfb/evtloop.h" -#else // other platform - -class WXDLLEXPORT wxEventLoopImpl; - -class WXDLLEXPORT wxEventLoop : public wxEventLoopBase -{ -public: - wxEventLoop() { m_impl = NULL; } - virtual ~wxEventLoop(); - - virtual int Run(); - virtual void Exit(int rc = 0); - virtual bool Pending() const; - virtual bool Dispatch(); - -protected: - // the pointer to the port specific implementation class - wxEventLoopImpl *m_impl; - - DECLARE_NO_COPY_CLASS(wxEventLoop) -}; - -#endif // platforms - -inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; } - -// ---------------------------------------------------------------------------- -// wxModalEventLoop -// ---------------------------------------------------------------------------- - -// this is a naive generic implementation which uses wxWindowDisabler to -// implement modality, we will surely need platform-specific implementations -// too, this generic implementation is here only temporarily to see how it -// works -class WXDLLEXPORT wxModalEventLoop : public wxEventLoop -{ -public: - wxModalEventLoop(wxWindow *winModal) - { - m_windowDisabler = new wxWindowDisabler(winModal); - } - -protected: - virtual void OnExit() - { - delete m_windowDisabler; - m_windowDisabler = NULL; - - wxEventLoop::OnExit(); - } - -private: - wxWindowDisabler *m_windowDisabler; -}; - -// ---------------------------------------------------------------------------- -// wxEventLoopActivator: helper class for wxEventLoop implementations -// ---------------------------------------------------------------------------- - -// this object sets the wxEventLoop given to the ctor as the currently active -// one and unsets it in its dtor, this is especially useful in presence of -// exceptions but is more tidy even when we don't use them -class wxEventLoopActivator -{ -public: - wxEventLoopActivator(wxEventLoop *evtLoop) - { - m_evtLoopOld = wxEventLoop::GetActive(); - wxEventLoop::SetActive(evtLoop); - } - - ~wxEventLoopActivator() - { - // restore the previously active event loop - wxEventLoop::SetActive(m_evtLoopOld); - } - -private: - wxEventLoop *m_evtLoopOld; -}; - -#if wxABI_VERSION >= 20808 -class wxEventLoopGuarantor -{ -public: - wxEventLoopGuarantor() - { - m_evtLoopNew = NULL; - if (!wxEventLoop::GetActive()) - { - m_evtLoopNew = new wxEventLoop; - wxEventLoop::SetActive(m_evtLoopNew); - } - } - - ~wxEventLoopGuarantor() - { - if (m_evtLoopNew) - { - wxEventLoop::SetActive(NULL); - delete m_evtLoopNew; - } - } - -private: - wxEventLoop *m_evtLoopNew; -}; -#endif // wxABI_VERSION >= 20805 - -#endif // _WX_EVTLOOP_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/evtloop.h +// Purpose: declares wxEventLoop class +// Author: Vadim Zeitlin +// Modified by: +// Created: 01.06.01 +// RCS-ID: $Id: evtloop.h 53607 2008-05-16 15:21:40Z SN $ +// Copyright: (c) 2001 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVTLOOP_H_ +#define _WX_EVTLOOP_H_ + +#include "wx/utils.h" + +class WXDLLIMPEXP_FWD_CORE wxEventLoop; + +// ---------------------------------------------------------------------------- +// wxEventLoop: a GUI event loop +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEventLoopBase +{ +public: + // trivial, but needed (because of wxEventLoopBase) ctor + wxEventLoopBase() { } + + // dtor + virtual ~wxEventLoopBase() { } + + // start the event loop, return the exit code when it is finished + virtual int Run() = 0; + + // exit from the loop with the given exit code + virtual void Exit(int rc = 0) = 0; + + // return true if any events are available + virtual bool Pending() const = 0; + + // dispatch a single event, return false if we should exit from the loop + virtual bool Dispatch() = 0; + + // return currently active (running) event loop, may be NULL + static wxEventLoop *GetActive() { return ms_activeLoop; } + + // set currently active (running) event loop + static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; } + + // is this event loop running now? + // + // notice that even if this event loop hasn't terminated yet but has just + // spawned a nested (e.g. modal) event loop, this would return false + bool IsRunning() const; + +protected: + // this function should be called before the event loop terminates, whether + // this happens normally (because of Exit() call) or abnormally (because of + // an exception thrown from inside the loop) + virtual void OnExit() { } + + + // the pointer to currently active loop + static wxEventLoop *ms_activeLoop; + + DECLARE_NO_COPY_CLASS(wxEventLoopBase) +}; + +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) + +// this class can be used to implement a standard event loop logic using +// Pending() and Dispatch() +// +// it also handles idle processing automatically +class WXDLLEXPORT wxEventLoopManual : public wxEventLoopBase +{ +public: + wxEventLoopManual(); + + // enters a loop calling OnNextIteration(), Pending() and Dispatch() and + // terminating when Exit() is called + virtual int Run(); + + // sets the "should exit" flag and wakes up the loop so that it terminates + // soon + virtual void Exit(int rc = 0); + +protected: + // implement this to wake up the loop: usually done by posting a dummy event + // to it (called from Exit()) + virtual void WakeUp() = 0; + + // may be overridden to perform some action at the start of each new event + // loop iteration + virtual void OnNextIteration() { } + + + // the loop exit code + int m_exitcode; + + // should we exit the loop? + bool m_shouldExit; +}; + +#endif // platforms using "manual" loop + +// we're moving away from old m_impl wxEventLoop model as otherwise the user +// code doesn't have access to platform-specific wxEventLoop methods and this +// can sometimes be very useful (e.g. under MSW this is necessary for +// integration with MFC) but currently this is done for MSW only, other ports +// should follow a.s.a.p. +#if defined(__WXPALMOS__) + #include "wx/palmos/evtloop.h" +#elif defined(__WXMSW__) + #include "wx/msw/evtloop.h" +#elif defined(__WXMAC__) + #include "wx/mac/evtloop.h" +#elif defined(__WXDFB__) + #include "wx/dfb/evtloop.h" +#else // other platform + +class WXDLLEXPORT wxEventLoopImpl; + +class WXDLLEXPORT wxEventLoop : public wxEventLoopBase +{ +public: + wxEventLoop() { m_impl = NULL; } + virtual ~wxEventLoop(); + + virtual int Run(); + virtual void Exit(int rc = 0); + virtual bool Pending() const; + virtual bool Dispatch(); + +protected: + // the pointer to the port specific implementation class + wxEventLoopImpl *m_impl; + + DECLARE_NO_COPY_CLASS(wxEventLoop) +}; + +#endif // platforms + +inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; } + +// ---------------------------------------------------------------------------- +// wxModalEventLoop +// ---------------------------------------------------------------------------- + +// this is a naive generic implementation which uses wxWindowDisabler to +// implement modality, we will surely need platform-specific implementations +// too, this generic implementation is here only temporarily to see how it +// works +class WXDLLEXPORT wxModalEventLoop : public wxEventLoop +{ +public: + wxModalEventLoop(wxWindow *winModal) + { + m_windowDisabler = new wxWindowDisabler(winModal); + } + +protected: + virtual void OnExit() + { + delete m_windowDisabler; + m_windowDisabler = NULL; + + wxEventLoop::OnExit(); + } + +private: + wxWindowDisabler *m_windowDisabler; +}; + +// ---------------------------------------------------------------------------- +// wxEventLoopActivator: helper class for wxEventLoop implementations +// ---------------------------------------------------------------------------- + +// this object sets the wxEventLoop given to the ctor as the currently active +// one and unsets it in its dtor, this is especially useful in presence of +// exceptions but is more tidy even when we don't use them +class wxEventLoopActivator +{ +public: + wxEventLoopActivator(wxEventLoop *evtLoop) + { + m_evtLoopOld = wxEventLoop::GetActive(); + wxEventLoop::SetActive(evtLoop); + } + + ~wxEventLoopActivator() + { + // restore the previously active event loop + wxEventLoop::SetActive(m_evtLoopOld); + } + +private: + wxEventLoop *m_evtLoopOld; +}; + +#if wxABI_VERSION >= 20808 +class wxEventLoopGuarantor +{ +public: + wxEventLoopGuarantor() + { + m_evtLoopNew = NULL; + if (!wxEventLoop::GetActive()) + { + m_evtLoopNew = new wxEventLoop; + wxEventLoop::SetActive(m_evtLoopNew); + } + } + + ~wxEventLoopGuarantor() + { + if (m_evtLoopNew) + { + wxEventLoop::SetActive(NULL); + delete m_evtLoopNew; + } + } + +private: + wxEventLoop *m_evtLoopNew; +}; +#endif // wxABI_VERSION >= 20805 + +#endif // _WX_EVTLOOP_H_ diff --git a/Externals/wxWidgets/include/wx/except.h b/Externals/wxWidgets/include/wx/except.h index f6310a57f5..9276db65ba 100644 --- a/Externals/wxWidgets/include/wx/except.h +++ b/Externals/wxWidgets/include/wx/except.h @@ -1,30 +1,30 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/except.h -// Purpose: C++ exception related stuff -// Author: Vadim Zeitlin -// Modified by: -// Created: 17.09.2003 -// RCS-ID: $Id: except.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_EXCEPT_H_ -#define _WX_EXCEPT_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// macros working whether wxUSE_EXCEPTIONS is 0 or 1 -// ---------------------------------------------------------------------------- - -#if wxUSE_EXCEPTIONS - #define wxTRY try - #define wxCATCH_ALL(code) catch ( ... ) { code } -#else // !wxUSE_EXCEPTIONS - #define wxTRY - #define wxCATCH_ALL(code) -#endif // wxUSE_EXCEPTIONS/!wxUSE_EXCEPTIONS - -#endif // _WX_EXCEPT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/except.h +// Purpose: C++ exception related stuff +// Author: Vadim Zeitlin +// Modified by: +// Created: 17.09.2003 +// RCS-ID: $Id: except.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EXCEPT_H_ +#define _WX_EXCEPT_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// macros working whether wxUSE_EXCEPTIONS is 0 or 1 +// ---------------------------------------------------------------------------- + +#if wxUSE_EXCEPTIONS + #define wxTRY try + #define wxCATCH_ALL(code) catch ( ... ) { code } +#else // !wxUSE_EXCEPTIONS + #define wxTRY + #define wxCATCH_ALL(code) +#endif // wxUSE_EXCEPTIONS/!wxUSE_EXCEPTIONS + +#endif // _WX_EXCEPT_H_ + diff --git a/Externals/wxWidgets/include/wx/fdrepdlg.h b/Externals/wxWidgets/include/wx/fdrepdlg.h index 87d1544970..43e8c4cef4 100644 --- a/Externals/wxWidgets/include/wx/fdrepdlg.h +++ b/Externals/wxWidgets/include/wx/fdrepdlg.h @@ -1,195 +1,195 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fdrepdlg.h -// Purpose: wxFindReplaceDialog class -// Author: Markus Greither and Vadim Zeitlin -// Modified by: -// Created: 23/03/2001 -// RCS-ID: -// Copyright: (c) Markus Greither -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FINDREPLACEDLG_H_ -#define _WX_FINDREPLACEDLG_H_ - -#include "wx/defs.h" - -#if wxUSE_FINDREPLDLG - -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxFindDialogEvent; -class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialog; -class WXDLLIMPEXP_FWD_CORE wxFindReplaceData; -class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl; - -// ---------------------------------------------------------------------------- -// Flags for wxFindReplaceData.Flags -// ---------------------------------------------------------------------------- - -// flages used by wxFindDialogEvent::GetFlags() -enum wxFindReplaceFlags -{ - // downward search/replace selected (otherwise - upwards) - wxFR_DOWN = 1, - - // whole word search/replace selected - wxFR_WHOLEWORD = 2, - - // case sensitive search/replace selected (otherwise - case insensitive) - wxFR_MATCHCASE = 4 -}; - -// these flags can be specified in wxFindReplaceDialog ctor or Create() -enum wxFindReplaceDialogStyles -{ - // replace dialog (otherwise find dialog) - wxFR_REPLACEDIALOG = 1, - - // don't allow changing the search direction - wxFR_NOUPDOWN = 2, - - // don't allow case sensitive searching - wxFR_NOMATCHCASE = 4, - - // don't allow whole word searching - wxFR_NOWHOLEWORD = 8 -}; - -// ---------------------------------------------------------------------------- -// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindReplaceData : public wxObject -{ -public: - wxFindReplaceData() { Init(); } - wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); } - - // accessors - const wxString& GetFindString() { return m_FindWhat; } - const wxString& GetReplaceString() { return m_ReplaceWith; } - - int GetFlags() const { return m_Flags; } - - // setters: may only be called before showing the dialog, no effect later - void SetFlags(wxUint32 flags) { m_Flags = flags; } - - void SetFindString(const wxString& str) { m_FindWhat = str; } - void SetReplaceString(const wxString& str) { m_ReplaceWith = str; } - -protected: - void Init(); - -private: - wxUint32 m_Flags; - wxString m_FindWhat, - m_ReplaceWith; - - friend class wxFindReplaceDialogBase; -}; - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialogBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindReplaceDialogBase : public wxDialog -{ -public: - // ctors and such - wxFindReplaceDialogBase() { m_FindReplaceData = NULL; } - wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent), - wxFindReplaceData *data, - const wxString& WXUNUSED(title), - int WXUNUSED(style) = 0) - { - m_FindReplaceData = data; - } - - virtual ~wxFindReplaceDialogBase(); - - // find dialog data access - const wxFindReplaceData *GetData() const { return m_FindReplaceData; } - void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; } - - // implementation only, don't use - void Send(wxFindDialogEvent& event); - -protected: - wxFindReplaceData *m_FindReplaceData; - - // the last string we searched for - wxString m_lastSearch; - - DECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase) -}; - -// include wxFindReplaceDialog declaration -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__) - #include "wx/msw/fdrepdlg.h" -#else - #define wxGenericFindReplaceDialog wxFindReplaceDialog - - #include "wx/generic/fdrepdlg.h" -#endif - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialog events -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindDialogEvent : public wxCommandEvent -{ -public: - wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0) - : wxCommandEvent(commandType, id) { } - - int GetFlags() const { return GetInt(); } - wxString GetFindString() const { return GetString(); } - const wxString& GetReplaceString() const { return m_strReplace; } - - wxFindReplaceDialog *GetDialog() const - { return wxStaticCast(GetEventObject(), wxFindReplaceDialog); } - - // implementation only - void SetFlags(int flags) { SetInt(flags); } - void SetFindString(const wxString& str) { SetString(str); } - void SetReplaceString(const wxString& str) { m_strReplace = str; } - -private: - wxString m_strReplace; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFindDialogEvent) -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND, 510) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT, 511) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE, 512) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL, 513) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE, 514) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); - -#define wxFindDialogEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFindDialogEventFunction, &func) - -#define EVT_FIND(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_NEXT(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_NEXT, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_REPLACE(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_REPLACE, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_REPLACE_ALL(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_REPLACE_ALL, id, wxFindDialogEventHandler(fn)) - -#define EVT_FIND_CLOSE(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_CLOSE, id, wxFindDialogEventHandler(fn)) - -#endif // wxUSE_FINDREPLDLG - -#endif - // _WX_FDREPDLG_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fdrepdlg.h +// Purpose: wxFindReplaceDialog class +// Author: Markus Greither and Vadim Zeitlin +// Modified by: +// Created: 23/03/2001 +// RCS-ID: +// Copyright: (c) Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FINDREPLACEDLG_H_ +#define _WX_FINDREPLACEDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_FINDREPLDLG + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxFindDialogEvent; +class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialog; +class WXDLLIMPEXP_FWD_CORE wxFindReplaceData; +class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl; + +// ---------------------------------------------------------------------------- +// Flags for wxFindReplaceData.Flags +// ---------------------------------------------------------------------------- + +// flages used by wxFindDialogEvent::GetFlags() +enum wxFindReplaceFlags +{ + // downward search/replace selected (otherwise - upwards) + wxFR_DOWN = 1, + + // whole word search/replace selected + wxFR_WHOLEWORD = 2, + + // case sensitive search/replace selected (otherwise - case insensitive) + wxFR_MATCHCASE = 4 +}; + +// these flags can be specified in wxFindReplaceDialog ctor or Create() +enum wxFindReplaceDialogStyles +{ + // replace dialog (otherwise find dialog) + wxFR_REPLACEDIALOG = 1, + + // don't allow changing the search direction + wxFR_NOUPDOWN = 2, + + // don't allow case sensitive searching + wxFR_NOMATCHCASE = 4, + + // don't allow whole word searching + wxFR_NOWHOLEWORD = 8 +}; + +// ---------------------------------------------------------------------------- +// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFindReplaceData : public wxObject +{ +public: + wxFindReplaceData() { Init(); } + wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); } + + // accessors + const wxString& GetFindString() { return m_FindWhat; } + const wxString& GetReplaceString() { return m_ReplaceWith; } + + int GetFlags() const { return m_Flags; } + + // setters: may only be called before showing the dialog, no effect later + void SetFlags(wxUint32 flags) { m_Flags = flags; } + + void SetFindString(const wxString& str) { m_FindWhat = str; } + void SetReplaceString(const wxString& str) { m_ReplaceWith = str; } + +protected: + void Init(); + +private: + wxUint32 m_Flags; + wxString m_FindWhat, + m_ReplaceWith; + + friend class wxFindReplaceDialogBase; +}; + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialogBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFindReplaceDialogBase : public wxDialog +{ +public: + // ctors and such + wxFindReplaceDialogBase() { m_FindReplaceData = NULL; } + wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent), + wxFindReplaceData *data, + const wxString& WXUNUSED(title), + int WXUNUSED(style) = 0) + { + m_FindReplaceData = data; + } + + virtual ~wxFindReplaceDialogBase(); + + // find dialog data access + const wxFindReplaceData *GetData() const { return m_FindReplaceData; } + void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; } + + // implementation only, don't use + void Send(wxFindDialogEvent& event); + +protected: + wxFindReplaceData *m_FindReplaceData; + + // the last string we searched for + wxString m_lastSearch; + + DECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase) +}; + +// include wxFindReplaceDialog declaration +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__) + #include "wx/msw/fdrepdlg.h" +#else + #define wxGenericFindReplaceDialog wxFindReplaceDialog + + #include "wx/generic/fdrepdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog events +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFindDialogEvent : public wxCommandEvent +{ +public: + wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0) + : wxCommandEvent(commandType, id) { } + + int GetFlags() const { return GetInt(); } + wxString GetFindString() const { return GetString(); } + const wxString& GetReplaceString() const { return m_strReplace; } + + wxFindReplaceDialog *GetDialog() const + { return wxStaticCast(GetEventObject(), wxFindReplaceDialog); } + + // implementation only + void SetFlags(int flags) { SetInt(flags); } + void SetFindString(const wxString& str) { SetString(str); } + void SetReplaceString(const wxString& str) { m_strReplace = str; } + +private: + wxString m_strReplace; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFindDialogEvent) +}; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND, 510) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT, 511) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE, 512) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL, 513) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE, 514) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); + +#define wxFindDialogEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFindDialogEventFunction, &func) + +#define EVT_FIND(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FIND, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_NEXT(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_NEXT, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_REPLACE(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_REPLACE, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_REPLACE_ALL(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_REPLACE_ALL, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_CLOSE(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FIND_CLOSE, id, wxFindDialogEventHandler(fn)) + +#endif // wxUSE_FINDREPLDLG + +#endif + // _WX_FDREPDLG_H diff --git a/Externals/wxWidgets/include/wx/features.h b/Externals/wxWidgets/include/wx/features.h index 953940a873..e9c0554955 100644 --- a/Externals/wxWidgets/include/wx/features.h +++ b/Externals/wxWidgets/include/wx/features.h @@ -1,64 +1,64 @@ -/** -* Name: wx/features.h -* Purpose: test macros for the features which might be available in some -* wxWidgets ports but not others -* Author: Vadim Zeitlin -* Modified by: Ryan Norton (Converted to C) -* Created: 18.03.02 -* RCS-ID: $Id: features.h 40865 2006-08-27 09:42:42Z VS $ -* Copyright: (c) 2002 Vadim Zeitlin -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_FEATURES_H_ -#define _WX_FEATURES_H_ - -/* radio menu items are currently not implemented in wxMotif, use this - symbol (kept for compatibility from the time when they were not implemented - under other platforms as well) to test for this */ -#if !defined(__WXMOTIF__) - #define wxHAS_RADIO_MENU_ITEMS -#else - #undef wxHAS_RADIO_MENU_ITEMS -#endif - -/* the raw keyboard codes are generated under wxGTK and wxMSW only */ -#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) \ - || defined(__WXDFB__) - #define wxHAS_RAW_KEY_CODES -#else - #undef wxHAS_RAW_KEY_CODES -#endif - -/* taskbar is implemented in the major ports */ -#if defined(__WXMSW__) || defined(__WXCOCOA__) \ - || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \ - || defined(__WXMAC_OSX__) || defined(__WXCOCOA__) - #define wxHAS_TASK_BAR_ICON -#else - #undef wxHAS_TASK_BAR_ICON -#endif - -/* wxIconLocation appeared in the middle of 2.5.0 so it's handy to have a */ -/* separate define for it */ -#define wxHAS_ICON_LOCATION - -/* same for wxCrashReport */ -#ifdef __WXMSW__ - #define wxHAS_CRASH_REPORT -#else - #undef wxHAS_CRASH_REPORT -#endif - -/* wxRE_ADVANCED is not always available, depending on regex library used - * (it's unavailable only if compiling via configure against system library) */ -#ifndef WX_NO_REGEX_ADVANCED - #define wxHAS_REGEX_ADVANCED -#else - #undef wxHAS_REGEX_ADVANCED -#endif - -#endif /* _WX_FEATURES_H_ */ - +/** +* Name: wx/features.h +* Purpose: test macros for the features which might be available in some +* wxWidgets ports but not others +* Author: Vadim Zeitlin +* Modified by: Ryan Norton (Converted to C) +* Created: 18.03.02 +* RCS-ID: $Id: features.h 40865 2006-08-27 09:42:42Z VS $ +* Copyright: (c) 2002 Vadim Zeitlin +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_FEATURES_H_ +#define _WX_FEATURES_H_ + +/* radio menu items are currently not implemented in wxMotif, use this + symbol (kept for compatibility from the time when they were not implemented + under other platforms as well) to test for this */ +#if !defined(__WXMOTIF__) + #define wxHAS_RADIO_MENU_ITEMS +#else + #undef wxHAS_RADIO_MENU_ITEMS +#endif + +/* the raw keyboard codes are generated under wxGTK and wxMSW only */ +#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) \ + || defined(__WXDFB__) + #define wxHAS_RAW_KEY_CODES +#else + #undef wxHAS_RAW_KEY_CODES +#endif + +/* taskbar is implemented in the major ports */ +#if defined(__WXMSW__) || defined(__WXCOCOA__) \ + || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \ + || defined(__WXMAC_OSX__) || defined(__WXCOCOA__) + #define wxHAS_TASK_BAR_ICON +#else + #undef wxHAS_TASK_BAR_ICON +#endif + +/* wxIconLocation appeared in the middle of 2.5.0 so it's handy to have a */ +/* separate define for it */ +#define wxHAS_ICON_LOCATION + +/* same for wxCrashReport */ +#ifdef __WXMSW__ + #define wxHAS_CRASH_REPORT +#else + #undef wxHAS_CRASH_REPORT +#endif + +/* wxRE_ADVANCED is not always available, depending on regex library used + * (it's unavailable only if compiling via configure against system library) */ +#ifndef WX_NO_REGEX_ADVANCED + #define wxHAS_REGEX_ADVANCED +#else + #undef wxHAS_REGEX_ADVANCED +#endif + +#endif /* _WX_FEATURES_H_ */ + diff --git a/Externals/wxWidgets/include/wx/ffile.h b/Externals/wxWidgets/include/wx/ffile.h index 5a2d3e5bcd..c3dda75d4e 100644 --- a/Externals/wxWidgets/include/wx/ffile.h +++ b/Externals/wxWidgets/include/wx/ffile.h @@ -1,115 +1,115 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/ffile.h -// Purpose: wxFFile - encapsulates "FILE *" stream -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.07.99 -// RCS-ID: $Id: ffile.h 38570 2006-04-05 14:37:47Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FFILE_H_ -#define _WX_FFILE_H_ - -#include "wx/defs.h" // for wxUSE_FFILE - -#if wxUSE_FFILE - -#include "wx/string.h" -#include "wx/filefn.h" -#include "wx/convauto.h" - -#include - -// ---------------------------------------------------------------------------- -// class wxFFile: standard C stream library IO -// -// NB: for space efficiency this class has no virtual functions, including -// dtor which is _not_ virtual, so it shouldn't be used as a base class. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFFile -{ -public: - // ctors - // ----- - // def ctor - wxFFile() { m_fp = NULL; } - // open specified file (may fail, use IsOpened()) - wxFFile(const wxChar *filename, const wxChar *mode = _T("r")); - // attach to (already opened) file - wxFFile(FILE *lfp) { m_fp = lfp; } - - // open/close - // open a file (existing or not - the mode controls what happens) - bool Open(const wxChar *filename, const wxChar *mode = _T("r")); - // closes the opened file (this is a NOP if not opened) - bool Close(); - - // assign an existing file descriptor and get it back from wxFFile object - void Attach(FILE *lfp, const wxString& name = wxEmptyString) - { Close(); m_fp = lfp; m_name = name; } - void Detach() { m_fp = NULL; } - FILE *fp() const { return m_fp; } - - // read/write (unbuffered) - // read all data from the file into a string (useful for text files) - bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto()); - // returns number of bytes read - use Eof() and Error() to see if an error - // occurred or not - size_t Read(void *pBuf, size_t nCount); - // returns the number of bytes written - size_t Write(const void *pBuf, size_t nCount); - // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()) - { - const wxWX2MBbuf buf = s.mb_str(conv); - size_t size = strlen(buf); - return Write((const char *)buf, size) == size; - } - // flush data not yet written - bool Flush(); - - // file pointer operations (return ofsInvalid on failure) - // move ptr ofs bytes related to start/current pos/end of file - bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); - // move ptr to ofs bytes before the end - bool SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } - // get current position in the file - wxFileOffset Tell() const; - // get current file length - wxFileOffset Length() const; - - // simple accessors: note that Eof() and Error() may only be called if - // IsOpened()! - // is file opened? - bool IsOpened() const { return m_fp != NULL; } - // is end of file reached? - bool Eof() const { return feof(m_fp) != 0; } - // has an error occurred? - bool Error() const { return ferror(m_fp) != 0; } - // get the file name - const wxString& GetName() const { return m_name; } - // type such as disk or pipe - wxFileKind GetKind() const { return wxGetFileKind(m_fp); } - - // dtor closes the file if opened - ~wxFFile() { Close(); } - -private: - // copy ctor and assignment operator are private because it doesn't make - // sense to copy files this way: attempt to do it will provoke a compile-time - // error. - wxFFile(const wxFFile&); - wxFFile& operator=(const wxFFile&); - - FILE *m_fp; // IO stream or NULL if not opened - - wxString m_name; // the name of the file (for diagnostic messages) -}; - -#endif // wxUSE_FFILE - -#endif // _WX_FFILE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/ffile.h +// Purpose: wxFFile - encapsulates "FILE *" stream +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.07.99 +// RCS-ID: $Id: ffile.h 38570 2006-04-05 14:37:47Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FFILE_H_ +#define _WX_FFILE_H_ + +#include "wx/defs.h" // for wxUSE_FFILE + +#if wxUSE_FFILE + +#include "wx/string.h" +#include "wx/filefn.h" +#include "wx/convauto.h" + +#include + +// ---------------------------------------------------------------------------- +// class wxFFile: standard C stream library IO +// +// NB: for space efficiency this class has no virtual functions, including +// dtor which is _not_ virtual, so it shouldn't be used as a base class. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFFile +{ +public: + // ctors + // ----- + // def ctor + wxFFile() { m_fp = NULL; } + // open specified file (may fail, use IsOpened()) + wxFFile(const wxChar *filename, const wxChar *mode = _T("r")); + // attach to (already opened) file + wxFFile(FILE *lfp) { m_fp = lfp; } + + // open/close + // open a file (existing or not - the mode controls what happens) + bool Open(const wxChar *filename, const wxChar *mode = _T("r")); + // closes the opened file (this is a NOP if not opened) + bool Close(); + + // assign an existing file descriptor and get it back from wxFFile object + void Attach(FILE *lfp, const wxString& name = wxEmptyString) + { Close(); m_fp = lfp; m_name = name; } + void Detach() { m_fp = NULL; } + FILE *fp() const { return m_fp; } + + // read/write (unbuffered) + // read all data from the file into a string (useful for text files) + bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto()); + // returns number of bytes read - use Eof() and Error() to see if an error + // occurred or not + size_t Read(void *pBuf, size_t nCount); + // returns the number of bytes written + size_t Write(const void *pBuf, size_t nCount); + // returns true on success + bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()) + { + const wxWX2MBbuf buf = s.mb_str(conv); + size_t size = strlen(buf); + return Write((const char *)buf, size) == size; + } + // flush data not yet written + bool Flush(); + + // file pointer operations (return ofsInvalid on failure) + // move ptr ofs bytes related to start/current pos/end of file + bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); + // move ptr to ofs bytes before the end + bool SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } + // get current position in the file + wxFileOffset Tell() const; + // get current file length + wxFileOffset Length() const; + + // simple accessors: note that Eof() and Error() may only be called if + // IsOpened()! + // is file opened? + bool IsOpened() const { return m_fp != NULL; } + // is end of file reached? + bool Eof() const { return feof(m_fp) != 0; } + // has an error occurred? + bool Error() const { return ferror(m_fp) != 0; } + // get the file name + const wxString& GetName() const { return m_name; } + // type such as disk or pipe + wxFileKind GetKind() const { return wxGetFileKind(m_fp); } + + // dtor closes the file if opened + ~wxFFile() { Close(); } + +private: + // copy ctor and assignment operator are private because it doesn't make + // sense to copy files this way: attempt to do it will provoke a compile-time + // error. + wxFFile(const wxFFile&); + wxFFile& operator=(const wxFFile&); + + FILE *m_fp; // IO stream or NULL if not opened + + wxString m_name; // the name of the file (for diagnostic messages) +}; + +#endif // wxUSE_FFILE + +#endif // _WX_FFILE_H_ + diff --git a/Externals/wxWidgets/include/wx/file.h b/Externals/wxWidgets/include/wx/file.h index a2ccd4223d..1691dc0c4d 100644 --- a/Externals/wxWidgets/include/wx/file.h +++ b/Externals/wxWidgets/include/wx/file.h @@ -1,201 +1,201 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: file.h -// Purpose: wxFile - encapsulates low-level "file descriptor" -// wxTempFile - safely replace the old file -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: file.h 46331 2007-06-05 13:16:11Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEH__ -#define _WX_FILEH__ - -#include "wx/defs.h" - -#if wxUSE_FILE - -#include "wx/string.h" -#include "wx/filefn.h" -#include "wx/strconv.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// we redefine these constants here because S_IREAD &c are _not_ standard -// however, we do assume that the values correspond to the Unix umask bits -#define wxS_IRUSR 00400 -#define wxS_IWUSR 00200 -#define wxS_IXUSR 00100 - -#define wxS_IRGRP 00040 -#define wxS_IWGRP 00020 -#define wxS_IXGRP 00010 - -#define wxS_IROTH 00004 -#define wxS_IWOTH 00002 -#define wxS_IXOTH 00001 - -// default mode for the new files: corresponds to umask 022 -#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP |\ - wxS_IROTH | wxS_IWOTH) - -// ---------------------------------------------------------------------------- -// class wxFile: raw file IO -// -// NB: for space efficiency this class has no virtual functions, including -// dtor which is _not_ virtual, so it shouldn't be used as a base class. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFile -{ -public: - // more file constants - // ------------------- - // opening mode - enum OpenMode { read, write, read_write, write_append, write_excl }; - // standard values for file descriptor - enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr }; - - // static functions - // ---------------- - // check whether a regular file by this name exists - static bool Exists(const wxChar *name); - // check whether we can access the given file in given mode - // (only read and write make sense here) - static bool Access(const wxChar *name, OpenMode mode); - - // ctors - // ----- - // def ctor - wxFile() { m_fd = fd_invalid; m_error = false; } - // open specified file (may fail, use IsOpened()) - wxFile(const wxChar *szFileName, OpenMode mode = read); - // attach to (already opened) file - wxFile(int lfd) { m_fd = lfd; m_error = false; } - - // open/close - // create a new file (with the default value of bOverwrite, it will fail if - // the file already exists, otherwise it will overwrite it and succeed) - bool Create(const wxChar *szFileName, bool bOverwrite = false, - int access = wxS_DEFAULT); - bool Open(const wxChar *szFileName, OpenMode mode = read, - int access = wxS_DEFAULT); - bool Close(); // Close is a NOP if not opened - - // assign an existing file descriptor and get it back from wxFile object - void Attach(int lfd) { Close(); m_fd = lfd; m_error = false; } - void Detach() { m_fd = fd_invalid; } - int fd() const { return m_fd; } - - // read/write (unbuffered) - // returns number of bytes read or wxInvalidOffset on error - ssize_t Read(void *pBuf, size_t nCount); - // returns the number of bytes written - size_t Write(const void *pBuf, size_t nCount); - // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8) - { - const wxWX2MBbuf buf = s.mb_str(conv); - if (!buf) - return false; - size_t size = strlen(buf); - return Write((const char *) buf, size) == size; - } - // flush data not yet written - bool Flush(); - - // file pointer operations (return wxInvalidOffset on failure) - // move ptr ofs bytes related to start/current offset/end of file - wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); - // move ptr to ofs bytes before the end - wxFileOffset SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } - // get current offset - wxFileOffset Tell() const; - // get current file length - wxFileOffset Length() const; - - // simple accessors - // is file opened? - bool IsOpened() const { return m_fd != fd_invalid; } - // is end of file reached? - bool Eof() const; - // has an error occurred? - bool Error() const { return m_error; } - // type such as disk or pipe - wxFileKind GetKind() const { return wxGetFileKind(m_fd); } - - // dtor closes the file if opened - ~wxFile() { Close(); } - -private: - // copy ctor and assignment operator are private because - // it doesn't make sense to copy files this way: - // attempt to do it will provoke a compile-time error. - wxFile(const wxFile&); - wxFile& operator=(const wxFile&); - - int m_fd; // file descriptor or INVALID_FD if not opened - bool m_error; // error memory -}; - -// ---------------------------------------------------------------------------- -// class wxTempFile: if you want to replace another file, create an instance -// of wxTempFile passing the name of the file to be replaced to the ctor. Then -// you can write to wxTempFile and call Commit() function to replace the old -// file (and close this one) or call Discard() to cancel the modification. If -// you call neither of them, dtor will call Discard(). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTempFile -{ -public: - // ctors - // default - wxTempFile() { } - // associates the temp file with the file to be replaced and opens it - wxTempFile(const wxString& strName); - - // open the temp file (strName is the name of file to be replaced) - bool Open(const wxString& strName); - - // is the file opened? - bool IsOpened() const { return m_file.IsOpened(); } - // get current file length - wxFileOffset Length() const { return m_file.Length(); } - // move ptr ofs bytes related to start/current offset/end of file - wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart) - { return m_file.Seek(ofs, mode); } - // get current offset - wxFileOffset Tell() const { return m_file.Tell(); } - - // I/O (both functions return true on success, false on failure) - bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; } - bool Write(const wxString& str, const wxMBConv& conv = wxConvUTF8) - { return m_file.Write(str, conv); } - - // different ways to close the file - // validate changes and delete the old file of name m_strName - bool Commit(); - // discard changes - void Discard(); - - // dtor calls Discard() if file is still opened - ~wxTempFile(); - -private: - // no copy ctor/assignment operator - wxTempFile(const wxTempFile&); - wxTempFile& operator=(const wxTempFile&); - - wxString m_strName, // name of the file to replace in Commit() - m_strTemp; // temporary file name - wxFile m_file; // the temporary file -}; - -#endif // wxUSE_FILE - -#endif // _WX_FILEH__ +///////////////////////////////////////////////////////////////////////////// +// Name: file.h +// Purpose: wxFile - encapsulates low-level "file descriptor" +// wxTempFile - safely replace the old file +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: file.h 46331 2007-06-05 13:16:11Z JS $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEH__ +#define _WX_FILEH__ + +#include "wx/defs.h" + +#if wxUSE_FILE + +#include "wx/string.h" +#include "wx/filefn.h" +#include "wx/strconv.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// we redefine these constants here because S_IREAD &c are _not_ standard +// however, we do assume that the values correspond to the Unix umask bits +#define wxS_IRUSR 00400 +#define wxS_IWUSR 00200 +#define wxS_IXUSR 00100 + +#define wxS_IRGRP 00040 +#define wxS_IWGRP 00020 +#define wxS_IXGRP 00010 + +#define wxS_IROTH 00004 +#define wxS_IWOTH 00002 +#define wxS_IXOTH 00001 + +// default mode for the new files: corresponds to umask 022 +#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP |\ + wxS_IROTH | wxS_IWOTH) + +// ---------------------------------------------------------------------------- +// class wxFile: raw file IO +// +// NB: for space efficiency this class has no virtual functions, including +// dtor which is _not_ virtual, so it shouldn't be used as a base class. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFile +{ +public: + // more file constants + // ------------------- + // opening mode + enum OpenMode { read, write, read_write, write_append, write_excl }; + // standard values for file descriptor + enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr }; + + // static functions + // ---------------- + // check whether a regular file by this name exists + static bool Exists(const wxChar *name); + // check whether we can access the given file in given mode + // (only read and write make sense here) + static bool Access(const wxChar *name, OpenMode mode); + + // ctors + // ----- + // def ctor + wxFile() { m_fd = fd_invalid; m_error = false; } + // open specified file (may fail, use IsOpened()) + wxFile(const wxChar *szFileName, OpenMode mode = read); + // attach to (already opened) file + wxFile(int lfd) { m_fd = lfd; m_error = false; } + + // open/close + // create a new file (with the default value of bOverwrite, it will fail if + // the file already exists, otherwise it will overwrite it and succeed) + bool Create(const wxChar *szFileName, bool bOverwrite = false, + int access = wxS_DEFAULT); + bool Open(const wxChar *szFileName, OpenMode mode = read, + int access = wxS_DEFAULT); + bool Close(); // Close is a NOP if not opened + + // assign an existing file descriptor and get it back from wxFile object + void Attach(int lfd) { Close(); m_fd = lfd; m_error = false; } + void Detach() { m_fd = fd_invalid; } + int fd() const { return m_fd; } + + // read/write (unbuffered) + // returns number of bytes read or wxInvalidOffset on error + ssize_t Read(void *pBuf, size_t nCount); + // returns the number of bytes written + size_t Write(const void *pBuf, size_t nCount); + // returns true on success + bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8) + { + const wxWX2MBbuf buf = s.mb_str(conv); + if (!buf) + return false; + size_t size = strlen(buf); + return Write((const char *) buf, size) == size; + } + // flush data not yet written + bool Flush(); + + // file pointer operations (return wxInvalidOffset on failure) + // move ptr ofs bytes related to start/current offset/end of file + wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); + // move ptr to ofs bytes before the end + wxFileOffset SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } + // get current offset + wxFileOffset Tell() const; + // get current file length + wxFileOffset Length() const; + + // simple accessors + // is file opened? + bool IsOpened() const { return m_fd != fd_invalid; } + // is end of file reached? + bool Eof() const; + // has an error occurred? + bool Error() const { return m_error; } + // type such as disk or pipe + wxFileKind GetKind() const { return wxGetFileKind(m_fd); } + + // dtor closes the file if opened + ~wxFile() { Close(); } + +private: + // copy ctor and assignment operator are private because + // it doesn't make sense to copy files this way: + // attempt to do it will provoke a compile-time error. + wxFile(const wxFile&); + wxFile& operator=(const wxFile&); + + int m_fd; // file descriptor or INVALID_FD if not opened + bool m_error; // error memory +}; + +// ---------------------------------------------------------------------------- +// class wxTempFile: if you want to replace another file, create an instance +// of wxTempFile passing the name of the file to be replaced to the ctor. Then +// you can write to wxTempFile and call Commit() function to replace the old +// file (and close this one) or call Discard() to cancel the modification. If +// you call neither of them, dtor will call Discard(). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTempFile +{ +public: + // ctors + // default + wxTempFile() { } + // associates the temp file with the file to be replaced and opens it + wxTempFile(const wxString& strName); + + // open the temp file (strName is the name of file to be replaced) + bool Open(const wxString& strName); + + // is the file opened? + bool IsOpened() const { return m_file.IsOpened(); } + // get current file length + wxFileOffset Length() const { return m_file.Length(); } + // move ptr ofs bytes related to start/current offset/end of file + wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart) + { return m_file.Seek(ofs, mode); } + // get current offset + wxFileOffset Tell() const { return m_file.Tell(); } + + // I/O (both functions return true on success, false on failure) + bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; } + bool Write(const wxString& str, const wxMBConv& conv = wxConvUTF8) + { return m_file.Write(str, conv); } + + // different ways to close the file + // validate changes and delete the old file of name m_strName + bool Commit(); + // discard changes + void Discard(); + + // dtor calls Discard() if file is still opened + ~wxTempFile(); + +private: + // no copy ctor/assignment operator + wxTempFile(const wxTempFile&); + wxTempFile& operator=(const wxTempFile&); + + wxString m_strName, // name of the file to replace in Commit() + m_strTemp; // temporary file name + wxFile m_file; // the temporary file +}; + +#endif // wxUSE_FILE + +#endif // _WX_FILEH__ diff --git a/Externals/wxWidgets/include/wx/fileconf.h b/Externals/wxWidgets/include/wx/fileconf.h index 47c483f269..0a76ab4c8a 100644 --- a/Externals/wxWidgets/include/wx/fileconf.h +++ b/Externals/wxWidgets/include/wx/fileconf.h @@ -1,246 +1,246 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/fileconf.h -// Purpose: wxFileConfig derivation of wxConfigBase -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.04.98 (adapted from appconf.cpp) -// RCS-ID: $Id: fileconf.h 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin -// Ballueder@usa.net -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _FILECONF_H -#define _FILECONF_H - -#include "wx/defs.h" - -#if wxUSE_CONFIG - -#include "wx/textfile.h" -#include "wx/string.h" -#include "wx/confbase.h" - -// ---------------------------------------------------------------------------- -// wxFileConfig -// ---------------------------------------------------------------------------- - -/* - wxFileConfig derives from base Config and implements file based config class, - i.e. it uses ASCII disk files to store the information. These files are - alternatively called INI, .conf or .rc in the documentation. They are - organized in groups or sections, which can nest (i.e. a group contains - subgroups, which contain their own subgroups &c). Each group has some - number of entries, which are "key = value" pairs. More precisely, the format - is: - - # comments are allowed after either ';' or '#' (Win/UNIX standard) - - # blank lines (as above) are ignored - - # global entries are members of special (no name) top group - written_for = Windows - platform = Linux - - # the start of the group 'Foo' - [Foo] # may put comments like this also - # following 3 lines are entries - key = value - another_key = " strings with spaces in the beginning should be quoted, \ - otherwise the spaces are lost" - last_key = but you don't have to put " normally (nor quote them, like here) - - # subgroup of the group 'Foo' - # (order is not important, only the name is: separator is '/', as in paths) - [Foo/Bar] - # entries prefixed with "!" are immutable, i.e. can't be changed if they are - # set in the system-wide config file - !special_key = value - bar_entry = whatever - - [Foo/Bar/Fubar] # depth is (theoretically :-) unlimited - # may have the same name as key in another section - bar_entry = whatever not - - You have {read/write/delete}Entry functions (guess what they do) and also - setCurrentPath to select current group. enum{Subgroups/Entries} allow you - to get all entries in the config file (in the current group). Finally, - flush() writes immediately all changed entries to disk (otherwise it would - be done automatically in dtor) - - wxFileConfig manages not less than 2 config files for each program: global - and local (or system and user if you prefer). Entries are read from both of - them and the local entries override the global ones unless the latter is - immutable (prefixed with '!') in which case a warning message is generated - and local value is ignored. Of course, the changes are always written to local - file only. - - The names of these files can be specified in a number of ways. First of all, - you can use the standard convention: using the ctor which takes 'strAppName' - parameter will probably be sufficient for 90% of cases. If, for whatever - reason you wish to use the files with some other names, you can always use the - second ctor. - - wxFileConfig also may automatically expand the values of environment variables - in the entries it reads: for example, if you have an entry - score_file = $HOME/.score - a call to Read(&str, "score_file") will return a complete path to .score file - unless the expansion was previously disabled with SetExpandEnvVars(false) call - (it's on by default, the current status can be retrieved with - IsExpandingEnvVars function). -*/ -class WXDLLIMPEXP_FWD_BASE wxFileConfigGroup; -class WXDLLIMPEXP_FWD_BASE wxFileConfigEntry; -class WXDLLIMPEXP_FWD_BASE wxFileConfigLineList; - -#if wxUSE_STREAMS -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_BASE wxOutputStream; -#endif // wxUSE_STREAMS - -class WXDLLIMPEXP_BASE wxFileConfig : public wxConfigBase -{ -public: - // construct the "standard" full name for global (system-wide) and - // local (user-specific) config files from the base file name. - // - // the following are the filenames returned by this functions: - // global local - // Unix /etc/file.ext ~/.file - // Win %windir%\file.ext %USERPROFILE%\file.ext - // - // where file is the basename of szFile, ext is its extension - // or .conf (Unix) or .ini (Win) if it has none - static wxString GetGlobalFileName(const wxChar *szFile); - static wxString GetLocalFileName(const wxChar *szFile); - - // ctor & dtor - // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or - // wxCONFIG_USE_GLOBAL_FILE to say which files should be used. - wxFileConfig(const wxString& appName = wxEmptyString, - const wxString& vendorName = wxEmptyString, - const wxString& localFilename = wxEmptyString, - const wxString& globalFilename = wxEmptyString, - long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE, - const wxMBConv& conv = wxConvAuto()); - -#if wxUSE_STREAMS - // ctor that takes an input stream. - wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto()); -#endif // wxUSE_STREAMS - - // dtor will save unsaved data - virtual ~wxFileConfig(); - - // under Unix, set the umask to be used for the file creation, do nothing - // under other systems -#ifdef __UNIX__ - void SetUmask(int mode) { m_umask = mode; } -#else // !__UNIX__ - void SetUmask(int WXUNUSED(mode)) { } -#endif // __UNIX__/!__UNIX__ - - // implement inherited pure virtual functions - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const { return m_strPath; } - - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; - - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; - - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; - - virtual bool Flush(bool bCurrentOnly = false); - - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - - virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& szKey); - virtual bool DeleteAll(); - - // additional, wxFileConfig-specific, functionality -#if wxUSE_STREAMS - // save the entire config file text to the given stream, note that the text - // won't be saved again in dtor when Flush() is called if you use this method - // as it won't be "changed" any more - virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto()); -#endif // wxUSE_STREAMS - -public: - // functions to work with this list - wxFileConfigLineList *LineListAppend(const wxString& str); - wxFileConfigLineList *LineListInsert(const wxString& str, - wxFileConfigLineList *pLine); // NULL => Prepend() - void LineListRemove(wxFileConfigLineList *pLine); - bool LineListIsEmpty(); - -protected: - virtual bool DoReadString(const wxString& key, wxString *pStr) const; - virtual bool DoReadLong(const wxString& key, long *pl) const; - - virtual bool DoWriteString(const wxString& key, const wxString& szValue); - virtual bool DoWriteLong(const wxString& key, long lValue); - -private: - // GetXXXFileName helpers: return ('/' terminated) directory names - static wxString GetGlobalDir(); - static wxString GetLocalDir(); - - // common part of all ctors (assumes that m_str{Local|Global}File are already - // initialized - void Init(); - - // common part of from dtor and DeleteAll - void CleanUp(); - - // parse the whole file - void Parse(const wxTextBuffer& buffer, bool bLocal); - - // the same as SetPath("/") - void SetRootPath(); - - // real SetPath() implementation, returns true if path could be set or false - // if path doesn't exist and createMissingComponents == false - bool DoSetPath(const wxString& strPath, bool createMissingComponents); - - // set/test the dirty flag - void SetDirty() { m_isDirty = true; } - void ResetDirty() { m_isDirty = false; } - bool IsDirty() const { return m_isDirty; } - - - // member variables - // ---------------- - wxFileConfigLineList *m_linesHead, // head of the linked list - *m_linesTail; // tail - - wxString m_strLocalFile, // local file name passed to ctor - m_strGlobalFile; // global - wxString m_strPath; // current path (not '/' terminated) - - wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group - *m_pCurrentGroup; // the current group - - wxMBConv *m_conv; - -#ifdef __UNIX__ - int m_umask; // the umask to use for file creation -#endif // __UNIX__ - - bool m_isDirty; // if true, we have unsaved changes - - DECLARE_NO_COPY_CLASS(wxFileConfig) -}; - -#endif - // wxUSE_CONFIG - -#endif - //_FILECONF_H - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/fileconf.h +// Purpose: wxFileConfig derivation of wxConfigBase +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.04.98 (adapted from appconf.cpp) +// RCS-ID: $Id: fileconf.h 50711 2007-12-15 02:57:58Z VZ $ +// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin +// Ballueder@usa.net +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _FILECONF_H +#define _FILECONF_H + +#include "wx/defs.h" + +#if wxUSE_CONFIG + +#include "wx/textfile.h" +#include "wx/string.h" +#include "wx/confbase.h" + +// ---------------------------------------------------------------------------- +// wxFileConfig +// ---------------------------------------------------------------------------- + +/* + wxFileConfig derives from base Config and implements file based config class, + i.e. it uses ASCII disk files to store the information. These files are + alternatively called INI, .conf or .rc in the documentation. They are + organized in groups or sections, which can nest (i.e. a group contains + subgroups, which contain their own subgroups &c). Each group has some + number of entries, which are "key = value" pairs. More precisely, the format + is: + + # comments are allowed after either ';' or '#' (Win/UNIX standard) + + # blank lines (as above) are ignored + + # global entries are members of special (no name) top group + written_for = Windows + platform = Linux + + # the start of the group 'Foo' + [Foo] # may put comments like this also + # following 3 lines are entries + key = value + another_key = " strings with spaces in the beginning should be quoted, \ + otherwise the spaces are lost" + last_key = but you don't have to put " normally (nor quote them, like here) + + # subgroup of the group 'Foo' + # (order is not important, only the name is: separator is '/', as in paths) + [Foo/Bar] + # entries prefixed with "!" are immutable, i.e. can't be changed if they are + # set in the system-wide config file + !special_key = value + bar_entry = whatever + + [Foo/Bar/Fubar] # depth is (theoretically :-) unlimited + # may have the same name as key in another section + bar_entry = whatever not + + You have {read/write/delete}Entry functions (guess what they do) and also + setCurrentPath to select current group. enum{Subgroups/Entries} allow you + to get all entries in the config file (in the current group). Finally, + flush() writes immediately all changed entries to disk (otherwise it would + be done automatically in dtor) + + wxFileConfig manages not less than 2 config files for each program: global + and local (or system and user if you prefer). Entries are read from both of + them and the local entries override the global ones unless the latter is + immutable (prefixed with '!') in which case a warning message is generated + and local value is ignored. Of course, the changes are always written to local + file only. + + The names of these files can be specified in a number of ways. First of all, + you can use the standard convention: using the ctor which takes 'strAppName' + parameter will probably be sufficient for 90% of cases. If, for whatever + reason you wish to use the files with some other names, you can always use the + second ctor. + + wxFileConfig also may automatically expand the values of environment variables + in the entries it reads: for example, if you have an entry + score_file = $HOME/.score + a call to Read(&str, "score_file") will return a complete path to .score file + unless the expansion was previously disabled with SetExpandEnvVars(false) call + (it's on by default, the current status can be retrieved with + IsExpandingEnvVars function). +*/ +class WXDLLIMPEXP_FWD_BASE wxFileConfigGroup; +class WXDLLIMPEXP_FWD_BASE wxFileConfigEntry; +class WXDLLIMPEXP_FWD_BASE wxFileConfigLineList; + +#if wxUSE_STREAMS +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_BASE wxOutputStream; +#endif // wxUSE_STREAMS + +class WXDLLIMPEXP_BASE wxFileConfig : public wxConfigBase +{ +public: + // construct the "standard" full name for global (system-wide) and + // local (user-specific) config files from the base file name. + // + // the following are the filenames returned by this functions: + // global local + // Unix /etc/file.ext ~/.file + // Win %windir%\file.ext %USERPROFILE%\file.ext + // + // where file is the basename of szFile, ext is its extension + // or .conf (Unix) or .ini (Win) if it has none + static wxString GetGlobalFileName(const wxChar *szFile); + static wxString GetLocalFileName(const wxChar *szFile); + + // ctor & dtor + // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or + // wxCONFIG_USE_GLOBAL_FILE to say which files should be used. + wxFileConfig(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE, + const wxMBConv& conv = wxConvAuto()); + +#if wxUSE_STREAMS + // ctor that takes an input stream. + wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto()); +#endif // wxUSE_STREAMS + + // dtor will save unsaved data + virtual ~wxFileConfig(); + + // under Unix, set the umask to be used for the file creation, do nothing + // under other systems +#ifdef __UNIX__ + void SetUmask(int mode) { m_umask = mode; } +#else // !__UNIX__ + void SetUmask(int WXUNUSED(mode)) { } +#endif // __UNIX__/!__UNIX__ + + // implement inherited pure virtual functions + virtual void SetPath(const wxString& strPath); + virtual const wxString& GetPath() const { return m_strPath; } + + virtual bool GetFirstGroup(wxString& str, long& lIndex) const; + virtual bool GetNextGroup (wxString& str, long& lIndex) const; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const; + virtual bool GetNextEntry (wxString& str, long& lIndex) const; + + virtual size_t GetNumberOfEntries(bool bRecursive = false) const; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const; + + virtual bool HasGroup(const wxString& strName) const; + virtual bool HasEntry(const wxString& strName) const; + + virtual bool Flush(bool bCurrentOnly = false); + + virtual bool RenameEntry(const wxString& oldName, const wxString& newName); + virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); + virtual bool DeleteGroup(const wxString& szKey); + virtual bool DeleteAll(); + + // additional, wxFileConfig-specific, functionality +#if wxUSE_STREAMS + // save the entire config file text to the given stream, note that the text + // won't be saved again in dtor when Flush() is called if you use this method + // as it won't be "changed" any more + virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto()); +#endif // wxUSE_STREAMS + +public: + // functions to work with this list + wxFileConfigLineList *LineListAppend(const wxString& str); + wxFileConfigLineList *LineListInsert(const wxString& str, + wxFileConfigLineList *pLine); // NULL => Prepend() + void LineListRemove(wxFileConfigLineList *pLine); + bool LineListIsEmpty(); + +protected: + virtual bool DoReadString(const wxString& key, wxString *pStr) const; + virtual bool DoReadLong(const wxString& key, long *pl) const; + + virtual bool DoWriteString(const wxString& key, const wxString& szValue); + virtual bool DoWriteLong(const wxString& key, long lValue); + +private: + // GetXXXFileName helpers: return ('/' terminated) directory names + static wxString GetGlobalDir(); + static wxString GetLocalDir(); + + // common part of all ctors (assumes that m_str{Local|Global}File are already + // initialized + void Init(); + + // common part of from dtor and DeleteAll + void CleanUp(); + + // parse the whole file + void Parse(const wxTextBuffer& buffer, bool bLocal); + + // the same as SetPath("/") + void SetRootPath(); + + // real SetPath() implementation, returns true if path could be set or false + // if path doesn't exist and createMissingComponents == false + bool DoSetPath(const wxString& strPath, bool createMissingComponents); + + // set/test the dirty flag + void SetDirty() { m_isDirty = true; } + void ResetDirty() { m_isDirty = false; } + bool IsDirty() const { return m_isDirty; } + + + // member variables + // ---------------- + wxFileConfigLineList *m_linesHead, // head of the linked list + *m_linesTail; // tail + + wxString m_strLocalFile, // local file name passed to ctor + m_strGlobalFile; // global + wxString m_strPath; // current path (not '/' terminated) + + wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group + *m_pCurrentGroup; // the current group + + wxMBConv *m_conv; + +#ifdef __UNIX__ + int m_umask; // the umask to use for file creation +#endif // __UNIX__ + + bool m_isDirty; // if true, we have unsaved changes + + DECLARE_NO_COPY_CLASS(wxFileConfig) +}; + +#endif + // wxUSE_CONFIG + +#endif + //_FILECONF_H + diff --git a/Externals/wxWidgets/include/wx/filedlg.h b/Externals/wxWidgets/include/wx/filedlg.h index 0e247b358f..8f3fc48d59 100644 --- a/Externals/wxWidgets/include/wx/filedlg.h +++ b/Externals/wxWidgets/include/wx/filedlg.h @@ -1,226 +1,226 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filedlg.h -// Purpose: wxFileDialog base header -// Author: Robert Roebling -// Modified by: -// Created: 8/17/99 -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: filedlg.h 44027 2006-12-21 19:26:48Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDLG_H_BASE_ -#define _WX_FILEDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_FILEDLG - -#include "wx/dialog.h" -#include "wx/arrstr.h" - -//---------------------------------------------------------------------------- -// wxFileDialog data -//---------------------------------------------------------------------------- - -/* - The flags below must coexist with the following flags in m_windowStyle - #define wxCAPTION 0x20000000 - #define wxMAXIMIZE 0x00002000 - #define wxCLOSE_BOX 0x00001000 - #define wxSYSTEM_MENU 0x00000800 - wxBORDER_NONE = 0x00200000 - #define wxRESIZE_BORDER 0x00000040 -*/ - -enum -{ - wxFD_OPEN = 0x0001, - wxFD_SAVE = 0x0002, - wxFD_OVERWRITE_PROMPT = 0x0004, - wxFD_FILE_MUST_EXIST = 0x0010, - wxFD_MULTIPLE = 0x0020, - wxFD_CHANGE_DIR = 0x0080, - wxFD_PREVIEW = 0x0100 -}; - -#if WXWIN_COMPATIBILITY_2_6 -enum -{ - wxOPEN = wxFD_OPEN, - wxSAVE = wxFD_SAVE, - wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT, -#if WXWIN_COMPATIBILITY_2_4 - wxHIDE_READONLY = 0x0008, -#endif - wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST, - wxMULTIPLE = wxFD_MULTIPLE, - wxCHANGE_DIR = wxFD_CHANGE_DIR -}; -#endif - -#define wxFD_DEFAULT_STYLE wxFD_OPEN - -extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[]; - -//---------------------------------------------------------------------------- -// wxFileDialogBase -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDialogBase: public wxDialog -{ -public: - wxFileDialogBase () { Init(); } - - wxFileDialogBase(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr) - { - Init(); - Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name); - } - - bool Create(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr); - - bool HasFdFlag(int flag) const { return HasFlag(flag); } - - virtual void SetMessage(const wxString& message) { m_message = message; } - virtual void SetPath(const wxString& path) { m_path = path; } - virtual void SetDirectory(const wxString& dir) { m_dir = dir; } - virtual void SetFilename(const wxString& name) { m_fileName = name; } - virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } - virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } - - virtual wxString GetMessage() const { return m_message; } - virtual wxString GetPath() const { return m_path; } - virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); } - virtual wxString GetDirectory() const { return m_dir; } - virtual wxString GetFilename() const { return m_fileName; } - virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); } - virtual wxString GetWildcard() const { return m_wildCard; } - virtual int GetFilterIndex() const { return m_filterIndex; } - - // Utility functions - -#if WXWIN_COMPATIBILITY_2_4 - // Parses the wildCard, returning the number of filters. - // Returns 0 if none or if there's a problem, - // The arrays will contain an equal number of items found before the error. - // wildCard is in the form: - // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" - wxDEPRECATED( static int ParseWildcard(const wxString& wildCard, - wxArrayString& descriptions, - wxArrayString& filters) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -#if WXWIN_COMPATIBILITY_2_6 - - wxDEPRECATED( long GetStyle() const ); - wxDEPRECATED( void SetStyle(long style) ); - -#endif // WXWIN_COMPATIBILITY_2_6 - - - // Append first extension to filePath from a ';' separated extensionList - // if filePath = "path/foo.bar" just return it as is - // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" - // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath - static wxString AppendExtension(const wxString &filePath, - const wxString &extensionList); - -protected: - wxString m_message; - wxString m_dir; - wxString m_path; // Full path - wxString m_fileName; - wxString m_wildCard; - int m_filterIndex; - -private: - void Init(); - DECLARE_DYNAMIC_CLASS(wxFileDialogBase) - DECLARE_NO_COPY_CLASS(wxFileDialogBase) -}; - -//---------------------------------------------------------------------------- -// wxFileDialog convenience functions -//---------------------------------------------------------------------------- - -// File selector - backward compatibility -WXDLLEXPORT wxString -wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, - const wxChar *default_path = NULL, - const wxChar *default_filename = NULL, - const wxChar *default_extension = NULL, - const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, - int flags = 0, - wxWindow *parent = NULL, - int x = wxDefaultCoord, int y = wxDefaultCoord); - -// An extended version of wxFileSelector -WXDLLEXPORT wxString -wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, - const wxChar *default_path = NULL, - const wxChar *default_filename = NULL, - int *indexDefaultExtension = NULL, - const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, - int flags = 0, - wxWindow *parent = NULL, - int x = wxDefaultCoord, int y = wxDefaultCoord); - -// Ask for filename to load -WXDLLEXPORT wxString -wxLoadFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name = (const wxChar *)NULL, - wxWindow *parent = (wxWindow *) NULL); - -// Ask for filename to save -WXDLLEXPORT wxString -wxSaveFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name = (const wxChar *) NULL, - wxWindow *parent = (wxWindow *) NULL); - - -#if defined (__WXUNIVERSAL__) -#define wxUSE_GENERIC_FILEDIALOG -#include "wx/generic/filedlgg.h" -#elif defined(__WXMSW__) -#include "wx/msw/filedlg.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/filedlg.h" -#elif defined(__WXGTK24__) -#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version -#elif defined(__WXGTK20__) -#define wxUSE_GENERIC_FILEDIALOG -#include "wx/generic/filedlgg.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/filedlg.h" -#elif defined(__WXMAC__) -#include "wx/mac/filedlg.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/filedlg.h" -#elif defined(__WXPM__) -#include "wx/os2/filedlg.h" -#endif - -#endif // wxUSE_FILEDLG - -#endif // _WX_FILEDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filedlg.h +// Purpose: wxFileDialog base header +// Author: Robert Roebling +// Modified by: +// Created: 8/17/99 +// Copyright: (c) Robert Roebling +// RCS-ID: $Id: filedlg.h 44027 2006-12-21 19:26:48Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_BASE_ +#define _WX_FILEDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_FILEDLG + +#include "wx/dialog.h" +#include "wx/arrstr.h" + +//---------------------------------------------------------------------------- +// wxFileDialog data +//---------------------------------------------------------------------------- + +/* + The flags below must coexist with the following flags in m_windowStyle + #define wxCAPTION 0x20000000 + #define wxMAXIMIZE 0x00002000 + #define wxCLOSE_BOX 0x00001000 + #define wxSYSTEM_MENU 0x00000800 + wxBORDER_NONE = 0x00200000 + #define wxRESIZE_BORDER 0x00000040 +*/ + +enum +{ + wxFD_OPEN = 0x0001, + wxFD_SAVE = 0x0002, + wxFD_OVERWRITE_PROMPT = 0x0004, + wxFD_FILE_MUST_EXIST = 0x0010, + wxFD_MULTIPLE = 0x0020, + wxFD_CHANGE_DIR = 0x0080, + wxFD_PREVIEW = 0x0100 +}; + +#if WXWIN_COMPATIBILITY_2_6 +enum +{ + wxOPEN = wxFD_OPEN, + wxSAVE = wxFD_SAVE, + wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT, +#if WXWIN_COMPATIBILITY_2_4 + wxHIDE_READONLY = 0x0008, +#endif + wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST, + wxMULTIPLE = wxFD_MULTIPLE, + wxCHANGE_DIR = wxFD_CHANGE_DIR +}; +#endif + +#define wxFD_DEFAULT_STYLE wxFD_OPEN + +extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[]; + +//---------------------------------------------------------------------------- +// wxFileDialogBase +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDialogBase: public wxDialog +{ +public: + wxFileDialogBase () { Init(); } + + wxFileDialogBase(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr) + { + Init(); + Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name); + } + + bool Create(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr); + + bool HasFdFlag(int flag) const { return HasFlag(flag); } + + virtual void SetMessage(const wxString& message) { m_message = message; } + virtual void SetPath(const wxString& path) { m_path = path; } + virtual void SetDirectory(const wxString& dir) { m_dir = dir; } + virtual void SetFilename(const wxString& name) { m_fileName = name; } + virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } + virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } + + virtual wxString GetMessage() const { return m_message; } + virtual wxString GetPath() const { return m_path; } + virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); } + virtual wxString GetDirectory() const { return m_dir; } + virtual wxString GetFilename() const { return m_fileName; } + virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); } + virtual wxString GetWildcard() const { return m_wildCard; } + virtual int GetFilterIndex() const { return m_filterIndex; } + + // Utility functions + +#if WXWIN_COMPATIBILITY_2_4 + // Parses the wildCard, returning the number of filters. + // Returns 0 if none or if there's a problem, + // The arrays will contain an equal number of items found before the error. + // wildCard is in the form: + // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" + wxDEPRECATED( static int ParseWildcard(const wxString& wildCard, + wxArrayString& descriptions, + wxArrayString& filters) ); +#endif // WXWIN_COMPATIBILITY_2_4 + +#if WXWIN_COMPATIBILITY_2_6 + + wxDEPRECATED( long GetStyle() const ); + wxDEPRECATED( void SetStyle(long style) ); + +#endif // WXWIN_COMPATIBILITY_2_6 + + + // Append first extension to filePath from a ';' separated extensionList + // if filePath = "path/foo.bar" just return it as is + // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" + // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath + static wxString AppendExtension(const wxString &filePath, + const wxString &extensionList); + +protected: + wxString m_message; + wxString m_dir; + wxString m_path; // Full path + wxString m_fileName; + wxString m_wildCard; + int m_filterIndex; + +private: + void Init(); + DECLARE_DYNAMIC_CLASS(wxFileDialogBase) + DECLARE_NO_COPY_CLASS(wxFileDialogBase) +}; + +//---------------------------------------------------------------------------- +// wxFileDialog convenience functions +//---------------------------------------------------------------------------- + +// File selector - backward compatibility +WXDLLEXPORT wxString +wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, + const wxChar *default_path = NULL, + const wxChar *default_filename = NULL, + const wxChar *default_extension = NULL, + const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, + int flags = 0, + wxWindow *parent = NULL, + int x = wxDefaultCoord, int y = wxDefaultCoord); + +// An extended version of wxFileSelector +WXDLLEXPORT wxString +wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, + const wxChar *default_path = NULL, + const wxChar *default_filename = NULL, + int *indexDefaultExtension = NULL, + const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, + int flags = 0, + wxWindow *parent = NULL, + int x = wxDefaultCoord, int y = wxDefaultCoord); + +// Ask for filename to load +WXDLLEXPORT wxString +wxLoadFileSelector(const wxChar *what, + const wxChar *extension, + const wxChar *default_name = (const wxChar *)NULL, + wxWindow *parent = (wxWindow *) NULL); + +// Ask for filename to save +WXDLLEXPORT wxString +wxSaveFileSelector(const wxChar *what, + const wxChar *extension, + const wxChar *default_name = (const wxChar *) NULL, + wxWindow *parent = (wxWindow *) NULL); + + +#if defined (__WXUNIVERSAL__) +#define wxUSE_GENERIC_FILEDIALOG +#include "wx/generic/filedlgg.h" +#elif defined(__WXMSW__) +#include "wx/msw/filedlg.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/filedlg.h" +#elif defined(__WXGTK24__) +#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version +#elif defined(__WXGTK20__) +#define wxUSE_GENERIC_FILEDIALOG +#include "wx/generic/filedlgg.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/filedlg.h" +#elif defined(__WXMAC__) +#include "wx/mac/filedlg.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/filedlg.h" +#elif defined(__WXPM__) +#include "wx/os2/filedlg.h" +#endif + +#endif // wxUSE_FILEDLG + +#endif // _WX_FILEDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/filefn.h b/Externals/wxWidgets/include/wx/filefn.h index e2ceee3c87..56c01c7bc4 100644 --- a/Externals/wxWidgets/include/wx/filefn.h +++ b/Externals/wxWidgets/include/wx/filefn.h @@ -1,741 +1,741 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filefn.h -// Purpose: File- and directory-related functions -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: filefn.h 53877 2008-05-31 12:43:44Z SN $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _FILEFN_H_ -#define _FILEFN_H_ - -#include "wx/list.h" -#include "wx/arrstr.h" - -#ifdef __WXWINCE__ - #include "wx/msw/wince/time.h" - #include "wx/msw/private.h" -#else - #include -#endif - -#ifdef __WXWINCE__ -// Nothing -#elif !defined(__MWERKS__) - #include - #include -#else - #ifdef __MACH__ - #include - #include - #include - #include - #else - #include - #include - #include - #endif -#endif - -#ifdef __OS2__ -// need to check for __OS2__ first since currently both -// __OS2__ and __UNIX__ are defined. - #include - #include "wx/os2/private.h" - #ifdef __WATCOMC__ - #include - #endif - #include - #ifdef __EMX__ - #include - #endif -#elif defined(__UNIX__) - #include - #include -#endif - -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) -#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__) - #include - #include - #include -#endif // __WINDOWS__ -#endif // native Win compiler - -#if defined(__DOS__) - #ifdef __WATCOMC__ - #include - #include - #include - #endif - #ifdef __DJGPP__ - #include - #include - #endif -#endif - -#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs - // this (3.1 I believe) and how to test for it. - // If this works for Borland 4.0 as well, then no worries. - #include -#endif - -#ifdef __SALFORDC__ - #include - #include -#endif - -#ifndef __WXWINCE__ - #include // O_RDONLY &c -#endif -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#ifdef __WXWINCE__ - typedef long off_t; -#else - // define off_t - #if !defined(__WXMAC__) || defined(__UNIX__) || defined(__MACH__) - #include - #else - typedef long off_t; - #endif -#endif - -#if (defined(__VISUALC__) && !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) ) - typedef _off_t off_t; -#elif defined(__SYMANTEC__) - typedef long off_t; -#elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__) - typedef long off_t; -#endif - -enum wxSeekMode -{ - wxFromStart, - wxFromCurrent, - wxFromEnd -}; - -enum wxFileKind -{ - wxFILE_KIND_UNKNOWN, - wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets - wxFILE_KIND_TERMINAL, // a tty - wxFILE_KIND_PIPE // a pipe -}; - -// ---------------------------------------------------------------------------- -// declare our versions of low level file functions: some compilers prepend -// underscores to the usual names, some also have Unicode versions of them -// ---------------------------------------------------------------------------- - -// Wrappers around Win32 api functions like CreateFile, ReadFile and such -// Implemented in filefnwce.cpp -#if defined( __WXWINCE__) - typedef __int64 wxFileOffset; - #define wxFileOffsetFmtSpec _("I64") - int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode)); - int wxAccess(const wxChar *name, int WXUNUSED(how)); - int wxClose(int fd); - int wxFsync(int WXUNUSED(fd)); - int wxRead(int fd, void *buf, unsigned int count); - int wxWrite(int fd, const void *buf, unsigned int count); - int wxEof(int fd); - wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); - #define wxLSeek wxSeek - wxFileOffset wxTell(int fd); - - // always Unicode under WinCE - #define wxMkDir _wmkdir - #define wxRmDir _wrmdir - #define wxStat _wstat - #define wxStructStat struct _stat -#elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \ - ( \ - defined(__VISUALC__) || \ - (defined(__MINGW32__) && !defined(__WINE__) && \ - wxCHECK_W32API_VERSION(0, 5)) || \ - defined(__MWERKS__) || \ - defined(__DMC__) || \ - defined(__WATCOMC__) || \ - defined(__BORLANDC__) \ - ) - - #undef wxHAS_HUGE_FILES - - // detect compilers which have support for huge files - #if defined(__VISUALC__) - #define wxHAS_HUGE_FILES 1 - #elif defined(__MINGW32__) - #define wxHAS_HUGE_FILES 1 - #elif defined(_LARGE_FILES) - #define wxHAS_HUGE_FILES 1 - #endif - - // other Windows compilers (DMC, Watcom, Metrowerks and Borland) don't have - // huge file support (or at least not all functions needed for it by wx) - // currently - - #ifdef wxHAS_HUGE_FILES - typedef wxLongLong_t wxFileOffset; - #define wxFileOffsetFmtSpec wxLongLongFmtSpec - #else - typedef off_t wxFileOffset; - #endif - - - // functions - - // MSVC and compatible compilers prepend underscores to the POSIX function - // names, other compilers don't and even if their later versions usually do - // define the versions with underscores for MSVC compatibility, it's better - // to avoid using them as they're not present in earlier versions and - // always using the native functions spelling is easier than testing for - // the versions - #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__) - #define wxPOSIX_IDENT(func) ::func - #else // by default assume MSVC-compatible names - #define wxPOSIX_IDENT(func) _ ## func - #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS - #endif - - // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope - // resolution operator present in wxPOSIX_IDENT for it - #ifdef __BORLANDC__ - #define wxPOSIX_STRUCT(s) struct s - #else - #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) - #endif - - // first functions not working with strings, i.e. without ANSI/Unicode - // complications - #define wxClose wxPOSIX_IDENT(close) - - #if defined(__MWERKS__) - #if __MSL__ >= 0x6000 - #define wxRead(fd, buf, nCount) _read(fd, (void *)buf, nCount) - #define wxWrite(fd, buf, nCount) _write(fd, (void *)buf, nCount) - #else - #define wxRead(fd, buf, nCount)\ - _read(fd, (const char *)buf, nCount) - #define wxWrite(fd, buf, nCount)\ - _write(fd, (const char *)buf, nCount) - #endif - #else // __MWERKS__ - #define wxRead wxPOSIX_IDENT(read) - #define wxWrite wxPOSIX_IDENT(write) - #endif - - #ifdef wxHAS_HUGE_FILES - #ifndef __MINGW64__ - #define wxSeek wxPOSIX_IDENT(lseeki64) - #define wxLseek wxPOSIX_IDENT(lseeki64) - #define wxTell wxPOSIX_IDENT(telli64) - #else - // unfortunately, mingw-W64 is somewhat inconsistent... - #define wxSeek _lseeki64 - #define wxLseek _lseeki64 - #define wxTell _telli64 - #endif - #else // !wxHAS_HUGE_FILES - #define wxSeek wxPOSIX_IDENT(lseek) - #define wxLseek wxPOSIX_IDENT(lseek) - #define wxTell wxPOSIX_IDENT(tell) - #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES - - #ifndef __WATCOMC__ - #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) - // NB: this one is not POSIX and always has the underscore - #define wxFsync _commit - - // could be already defined by configure (Cygwin) - #ifndef HAVE_FSYNC - #define HAVE_FSYNC - #endif - #endif // BORLANDC - #endif - - #define wxEof wxPOSIX_IDENT(eof) - - // then the functions taking strings - #if wxUSE_UNICODE - #if wxUSE_UNICODE_MSLU - // implement the missing file functions in Win9x ourselves - #if defined( __VISUALC__ ) \ - || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ - || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ - || ( defined(__BORLANDC__) && (__BORLANDC__ > 0x460) ) \ - || defined(__DMC__) - - WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, - int flags, int mode); - WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, - int mode); - WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); - WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); - - WXDLLIMPEXP_BASE int - wxMSLU__wstat(const wxChar *name, wxPOSIX_STRUCT(stat) *buffer); - WXDLLIMPEXP_BASE int - wxMSLU__wstati64(const wxChar *name, - wxPOSIX_STRUCT(stati64) *buffer); - #endif // Windows compilers with MSLU support - - #define wxOpen wxMSLU__wopen - - #define wxAccess wxMSLU__waccess - #define wxMkDir wxMSLU__wmkdir - #define wxRmDir wxMSLU__wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxStat wxMSLU__wstati64 - #else - #define wxStat wxMSLU__wstat - #endif - #else // !wxUSE_UNICODE_MSLU - #ifdef __BORLANDC__ - #if __BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551 - WXDLLIMPEXP_BASE int wxOpen(const wxChar *pathname, - int flags, mode_t mode); - #else - #define wxOpen _wopen - #endif - #define wxAccess _waccess - #define wxMkDir _wmkdir - #define wxRmDir _wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxStat _wstati64 - #else - #define wxStat _wstat - #endif - #else - #define wxOpen _wopen - #define wxAccess _waccess - #define wxMkDir _wmkdir - #define wxRmDir _wrmdir - #ifdef wxHAS_HUGE_FILES - #define wxStat _wstati64 - #else - #define wxStat _wstat - #endif - #endif - #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU - #else // !wxUSE_UNICODE - #define wxOpen wxPOSIX_IDENT(open) - #define wxAccess wxPOSIX_IDENT(access) - #define wxMkDir wxPOSIX_IDENT(mkdir) - #define wxRmDir wxPOSIX_IDENT(rmdir) - #ifdef wxHAS_HUGE_FILES - #define wxStat wxPOSIX_IDENT(stati64) - #else - // Unfortunately Watcom is not consistent, so:- - #if defined(__OS2__) && defined(__WATCOMC__) - #define wxStat _stat - #else - #if defined (__BORLANDC__) - #define wxStat _stat //wxPOSIX_IDENT(stat) - #else - #define wxStat wxPOSIX_IDENT(stat) - #endif // !borland - #endif // !watcom - #endif - #endif // wxUSE_UNICODE/!wxUSE_UNICODE - - // Types: Notice that Watcom is the only compiler to have a wide char - // version of struct stat as well as a wide char stat function variant. - // This was droped since OW 1.4 "for consistency across platforms". - #ifdef wxHAS_HUGE_FILES - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstati64 - #else - #define wxStructStat struct _stati64 - #endif - #else - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstat - #else - #define wxStructStat struct _stat - #endif - #endif - - // constants (unless already defined by the user code) - #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS - #ifndef O_RDONLY - #define O_RDONLY _O_RDONLY - #define O_WRONLY _O_WRONLY - #define O_RDWR _O_RDWR - #define O_EXCL _O_EXCL - #define O_CREAT _O_CREAT - #define O_BINARY _O_BINARY - #endif - - #ifndef S_IFMT - #define S_IFMT _S_IFMT - #define S_IFDIR _S_IFDIR - #define S_IFREG _S_IFREG - #endif - #endif // wxHAS_UNDERSCORES_IN_POSIX_IDENTS - - #ifdef wxHAS_HUGE_FILES - // wxFile is present and supports large files. Currently wxFFile - // doesn't have large file support with any Windows compiler (even - // Win64 ones). - #if wxUSE_FILE - #define wxHAS_LARGE_FILES - #endif - #endif - - // it's a private define, undefine it so that nobody gets tempted to use it - #undef wxHAS_HUGE_FILES -#else // Unix or Windows using unknown compiler, assume POSIX supported - typedef off_t wxFileOffset; - #ifdef _LARGE_FILES - #define wxFileOffsetFmtSpec wxLongLongFmtSpec - wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), - BadFileSizeType ); - // wxFile is present and supports large files - #ifdef wxUSE_FILE - #define wxHAS_LARGE_FILES - #endif - // wxFFile is present and supports large files - #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO - #define wxHAS_LARGE_FFILES - #endif - #else - #define wxFileOffsetFmtSpec _T("") - #endif - // functions - #define wxClose close - #define wxRead ::read - #define wxWrite ::write - #define wxLseek lseek - #define wxSeek lseek - #define wxFsync fsync - #define wxEof eof - - #define wxMkDir mkdir - #define wxRmDir rmdir - - #define wxTell(fd) lseek(fd, 0, SEEK_CUR) - - #define wxStructStat struct stat - - #if wxUSE_UNICODE - #define wxNEED_WX_UNISTD_H - #if defined(__DMC__) - typedef unsigned long mode_t; - #endif - WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf ); - WXDLLIMPEXP_BASE int wxLstat( const wxChar *file_name, wxStructStat *buf ); - WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode ); - WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); - #else - #define wxOpen open - #define wxStat stat - #define wxLstat lstat - #define wxAccess access - #endif - - #define wxHAS_NATIVE_LSTAT -#endif // platforms - -#ifdef O_BINARY - #define wxO_BINARY O_BINARY -#else - #define wxO_BINARY 0 -#endif - -// if the platform doesn't have symlinks, define wxLstat to be the same as -// wxStat to avoid #ifdefs in the code using it -#ifndef wxHAS_NATIVE_LSTAT - #define wxLstat wxStat -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -// -// VisualAge C++ V4.0 cannot have any external linkage const decs -// in headers included by more than one primary source -// -extern const int wxInvalidOffset; -#else -const int wxInvalidOffset = -1; -#endif - -// ---------------------------------------------------------------------------- -// functions -// ---------------------------------------------------------------------------- -WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); - -// does the path exist? (may have or not '/' or '\\' at the end) -WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); - -WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); - -// Get filename -WXDLLIMPEXP_BASE wxChar* wxFileNameFromPath(wxChar *path); -WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); - -// Get directory -WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); - -// wxString version -WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path); - -WXDLLIMPEXP_BASE void wxDos2UnixFilename(wxChar *s); - -WXDLLIMPEXP_BASE void wxUnix2DosFilename(wxChar *s); - -// Strip the extension, in situ -WXDLLIMPEXP_BASE void wxStripExtension(wxChar *buffer); -WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer); - -// Get a temporary filename -WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL); -WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf); - -// Expand file name (~/ and ${OPENWINHOME}/ stuff) -WXDLLIMPEXP_BASE wxChar* wxExpandPath(wxChar *dest, const wxChar *path); -WXDLLIMPEXP_BASE bool wxExpandPath(wxString& dest, const wxChar *path); - -// Contract w.r.t environment ( -> ${OPENWINHOME}/lib) -// and make (if under the home tree) relative to home -// [caller must copy-- volatile] -WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, - const wxString& envname = wxEmptyString, - const wxString& user = wxEmptyString); - -// Destructive removal of /./ and /../ stuff -WXDLLIMPEXP_BASE wxChar* wxRealPath(wxChar *path); - -// Allocate a copy of the full absolute path -WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path); - -// Get first file name matching given wild card. -// Flags are reserved for future use. -#define wxFILE 1 -#define wxDIR 2 -WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxChar *spec, int flags = wxFILE); -WXDLLIMPEXP_BASE wxString wxFindNextFile(); - -// Does the pattern contain wildcards? -WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); - -// Does the pattern match the text (usually a filename)? -// If dot_special is true, doesn't match * against . (eliminating -// `hidden' dot files) -WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); - -// Concatenate two files to form third -WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3); - -// Copy file1 to file2 -WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, - bool overwrite = true); - -// Remove file -WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); - -// Rename file -WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true); - -// Get current working directory. -#if WXWIN_COMPATIBILITY_2_6 -// If buf is NULL, allocates space using new, else -// copies into buf. -// IMPORTANT NOTE getcwd is know not to work under some releases -// of Win32s 1.3, according to MS release notes! -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000) ); -// new and preferred version of wxGetWorkingDirectory -// NB: can't have the same name because of overloading ambiguity -#endif // WXWIN_COMPATIBILITY_2_6 -WXDLLIMPEXP_BASE wxString wxGetCwd(); - -// Set working directory -WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); - -// Make directory -WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777); - -// Remove directory. Flags reserved for future use. -WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); - -// Return the type of an open file -WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); -WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); - -#if WXWIN_COMPATIBILITY_2_6 -// compatibility defines, don't use in new code -wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); -inline bool wxPathExists(const wxChar *pszPathName) -{ - return wxDirExists(pszPathName); -} -#endif //WXWIN_COMPATIBILITY_2_6 - -// permissions; these functions work both on files and directories: -WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path); -WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path); -WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); - -// ---------------------------------------------------------------------------- -// separators in file names -// ---------------------------------------------------------------------------- - -// between file name and extension -#define wxFILE_SEP_EXT wxT('.') - -// between drive/volume name and the path -#define wxFILE_SEP_DSK wxT(':') - -// between the path components -#define wxFILE_SEP_PATH_DOS wxT('\\') -#define wxFILE_SEP_PATH_UNIX wxT('/') -#define wxFILE_SEP_PATH_MAC wxT(':') -#define wxFILE_SEP_PATH_VMS wxT('.') // VMS also uses '[' and ']' - -// separator in the path list (as in PATH environment variable) -// there is no PATH variable in Classic Mac OS so just use the -// semicolon (it must be different from the file name separator) -// NB: these are strings and not characters on purpose! -#define wxPATH_SEP_DOS wxT(";") -#define wxPATH_SEP_UNIX wxT(":") -#define wxPATH_SEP_MAC wxT(";") - -// platform independent versions -#if defined(__UNIX__) && !defined(__OS2__) - // CYGWIN also uses UNIX settings - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX - #define wxPATH_SEP wxPATH_SEP_UNIX -#elif defined(__MAC__) - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC - #define wxPATH_SEP wxPATH_SEP_MAC -#else // Windows and OS/2 - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS - #define wxPATH_SEP wxPATH_SEP_DOS -#endif // Unix/Windows - -// this is useful for wxString::IsSameAs(): to compare two file names use -// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) -#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) - #define wxARE_FILENAMES_CASE_SENSITIVE true -#else // Windows, Mac OS and OS/2 - #define wxARE_FILENAMES_CASE_SENSITIVE false -#endif // Unix/Windows - -// is the char a path separator? -inline bool wxIsPathSeparator(wxChar c) -{ - // under DOS/Windows we should understand both Unix and DOS file separators -#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) - return c == wxFILE_SEP_PATH; -#else - return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; -#endif -} - -// does the string ends with path separator? -WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxChar *pszFileName); - -// split the full path into path (including drive for DOS), name and extension -// (understands both '/' and '\\') -WXDLLIMPEXP_BASE void wxSplitPath(const wxChar *pszFileName, - wxString *pstrPath, - wxString *pstrName, - wxString *pstrExt); - -// find a file in a list of directories, returns false if not found -WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile); - -// Get the OS directory if appropriate (such as the Windows directory). -// On non-Windows platform, probably just return the empty string. -WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); - -#if wxUSE_DATETIME - -// Get file modification time -WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); - -#endif // wxUSE_DATETIME - -// Parses the wildCard, returning the number of filters. -// Returns 0 if none or if there's a problem, -// The arrays will contain an equal number of items found before the error. -// wildCard is in the form: -// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" -WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); - -// ---------------------------------------------------------------------------- -// classes -// ---------------------------------------------------------------------------- - -#ifdef __UNIX__ - -// set umask to the given value in ctor and reset it to the old one in dtor -class WXDLLIMPEXP_BASE wxUmaskChanger -{ -public: - // change the umask to the given one if it is not -1: this allows to write - // the same code whether you really want to change umask or not, as is in - // wxFileConfig::Flush() for example - wxUmaskChanger(int umaskNew) - { - m_umaskOld = umaskNew == -1 ? -1 : (int)umask((mode_t)umaskNew); - } - - ~wxUmaskChanger() - { - if ( m_umaskOld != -1 ) - umask((mode_t)m_umaskOld); - } - -private: - int m_umaskOld; -}; - -// this macro expands to an "anonymous" wxUmaskChanger object under Unix and -// nothing elsewhere -#define wxCHANGE_UMASK(m) wxUmaskChanger wxMAKE_UNIQUE_NAME(umaskChanger_)(m) - -#else // !__UNIX__ - -#define wxCHANGE_UMASK(m) - -#endif // __UNIX__/!__UNIX__ - - -// Path searching -class WXDLLIMPEXP_BASE wxPathList : public wxArrayString -{ -public: - wxPathList() {} - wxPathList(const wxArrayString &arr) - { Add(arr); } - - // Adds all paths in environment variable - void AddEnvList(const wxString& envVariable); - - // Adds given path to this list - bool Add(const wxString& path); - void Add(const wxArrayString &paths); - - // Find the first full path for which the file exists - wxString FindValidPath(const wxString& filename) const; - - // Find the first full path for which the file exists; ensure it's an - // absolute path that gets returned. - wxString FindAbsoluteValidPath(const wxString& filename) const; - - // Given full path and filename, add path to list - bool EnsureFileAccessible(const wxString& path); - -#if WXWIN_COMPATIBILITY_2_6 - // Returns true if the path is in the list - wxDEPRECATED( bool Member(const wxString& path) const ); -#endif -}; - -#endif // _WX_FILEFN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filefn.h +// Purpose: File- and directory-related functions +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: filefn.h 53877 2008-05-31 12:43:44Z SN $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _FILEFN_H_ +#define _FILEFN_H_ + +#include "wx/list.h" +#include "wx/arrstr.h" + +#ifdef __WXWINCE__ + #include "wx/msw/wince/time.h" + #include "wx/msw/private.h" +#else + #include +#endif + +#ifdef __WXWINCE__ +// Nothing +#elif !defined(__MWERKS__) + #include + #include +#else + #ifdef __MACH__ + #include + #include + #include + #include + #else + #include + #include + #include + #endif +#endif + +#ifdef __OS2__ +// need to check for __OS2__ first since currently both +// __OS2__ and __UNIX__ are defined. + #include + #include "wx/os2/private.h" + #ifdef __WATCOMC__ + #include + #endif + #include + #ifdef __EMX__ + #include + #endif +#elif defined(__UNIX__) + #include + #include +#endif + +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__) + #include + #include + #include +#endif // __WINDOWS__ +#endif // native Win compiler + +#if defined(__DOS__) + #ifdef __WATCOMC__ + #include + #include + #include + #endif + #ifdef __DJGPP__ + #include + #include + #endif +#endif + +#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs + // this (3.1 I believe) and how to test for it. + // If this works for Borland 4.0 as well, then no worries. + #include +#endif + +#ifdef __SALFORDC__ + #include + #include +#endif + +#ifndef __WXWINCE__ + #include // O_RDONLY &c +#endif +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#ifdef __WXWINCE__ + typedef long off_t; +#else + // define off_t + #if !defined(__WXMAC__) || defined(__UNIX__) || defined(__MACH__) + #include + #else + typedef long off_t; + #endif +#endif + +#if (defined(__VISUALC__) && !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) ) + typedef _off_t off_t; +#elif defined(__SYMANTEC__) + typedef long off_t; +#elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__) + typedef long off_t; +#endif + +enum wxSeekMode +{ + wxFromStart, + wxFromCurrent, + wxFromEnd +}; + +enum wxFileKind +{ + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe +}; + +// ---------------------------------------------------------------------------- +// declare our versions of low level file functions: some compilers prepend +// underscores to the usual names, some also have Unicode versions of them +// ---------------------------------------------------------------------------- + +// Wrappers around Win32 api functions like CreateFile, ReadFile and such +// Implemented in filefnwce.cpp +#if defined( __WXWINCE__) + typedef __int64 wxFileOffset; + #define wxFileOffsetFmtSpec _("I64") + int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode)); + int wxAccess(const wxChar *name, int WXUNUSED(how)); + int wxClose(int fd); + int wxFsync(int WXUNUSED(fd)); + int wxRead(int fd, void *buf, unsigned int count); + int wxWrite(int fd, const void *buf, unsigned int count); + int wxEof(int fd); + wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); + #define wxLSeek wxSeek + wxFileOffset wxTell(int fd); + + // always Unicode under WinCE + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + #define wxStat _wstat + #define wxStructStat struct _stat +#elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \ + ( \ + defined(__VISUALC__) || \ + (defined(__MINGW32__) && !defined(__WINE__) && \ + wxCHECK_W32API_VERSION(0, 5)) || \ + defined(__MWERKS__) || \ + defined(__DMC__) || \ + defined(__WATCOMC__) || \ + defined(__BORLANDC__) \ + ) + + #undef wxHAS_HUGE_FILES + + // detect compilers which have support for huge files + #if defined(__VISUALC__) + #define wxHAS_HUGE_FILES 1 + #elif defined(__MINGW32__) + #define wxHAS_HUGE_FILES 1 + #elif defined(_LARGE_FILES) + #define wxHAS_HUGE_FILES 1 + #endif + + // other Windows compilers (DMC, Watcom, Metrowerks and Borland) don't have + // huge file support (or at least not all functions needed for it by wx) + // currently + + #ifdef wxHAS_HUGE_FILES + typedef wxLongLong_t wxFileOffset; + #define wxFileOffsetFmtSpec wxLongLongFmtSpec + #else + typedef off_t wxFileOffset; + #endif + + + // functions + + // MSVC and compatible compilers prepend underscores to the POSIX function + // names, other compilers don't and even if their later versions usually do + // define the versions with underscores for MSVC compatibility, it's better + // to avoid using them as they're not present in earlier versions and + // always using the native functions spelling is easier than testing for + // the versions + #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__) + #define wxPOSIX_IDENT(func) ::func + #else // by default assume MSVC-compatible names + #define wxPOSIX_IDENT(func) _ ## func + #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS + #endif + + // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope + // resolution operator present in wxPOSIX_IDENT for it + #ifdef __BORLANDC__ + #define wxPOSIX_STRUCT(s) struct s + #else + #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) + #endif + + // first functions not working with strings, i.e. without ANSI/Unicode + // complications + #define wxClose wxPOSIX_IDENT(close) + + #if defined(__MWERKS__) + #if __MSL__ >= 0x6000 + #define wxRead(fd, buf, nCount) _read(fd, (void *)buf, nCount) + #define wxWrite(fd, buf, nCount) _write(fd, (void *)buf, nCount) + #else + #define wxRead(fd, buf, nCount)\ + _read(fd, (const char *)buf, nCount) + #define wxWrite(fd, buf, nCount)\ + _write(fd, (const char *)buf, nCount) + #endif + #else // __MWERKS__ + #define wxRead wxPOSIX_IDENT(read) + #define wxWrite wxPOSIX_IDENT(write) + #endif + + #ifdef wxHAS_HUGE_FILES + #ifndef __MINGW64__ + #define wxSeek wxPOSIX_IDENT(lseeki64) + #define wxLseek wxPOSIX_IDENT(lseeki64) + #define wxTell wxPOSIX_IDENT(telli64) + #else + // unfortunately, mingw-W64 is somewhat inconsistent... + #define wxSeek _lseeki64 + #define wxLseek _lseeki64 + #define wxTell _telli64 + #endif + #else // !wxHAS_HUGE_FILES + #define wxSeek wxPOSIX_IDENT(lseek) + #define wxLseek wxPOSIX_IDENT(lseek) + #define wxTell wxPOSIX_IDENT(tell) + #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES + + #ifndef __WATCOMC__ + #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) + // NB: this one is not POSIX and always has the underscore + #define wxFsync _commit + + // could be already defined by configure (Cygwin) + #ifndef HAVE_FSYNC + #define HAVE_FSYNC + #endif + #endif // BORLANDC + #endif + + #define wxEof wxPOSIX_IDENT(eof) + + // then the functions taking strings + #if wxUSE_UNICODE + #if wxUSE_UNICODE_MSLU + // implement the missing file functions in Win9x ourselves + #if defined( __VISUALC__ ) \ + || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ + || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ + || ( defined(__BORLANDC__) && (__BORLANDC__ > 0x460) ) \ + || defined(__DMC__) + + WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, + int flags, int mode); + WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, + int mode); + WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); + WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); + + WXDLLIMPEXP_BASE int + wxMSLU__wstat(const wxChar *name, wxPOSIX_STRUCT(stat) *buffer); + WXDLLIMPEXP_BASE int + wxMSLU__wstati64(const wxChar *name, + wxPOSIX_STRUCT(stati64) *buffer); + #endif // Windows compilers with MSLU support + + #define wxOpen wxMSLU__wopen + + #define wxAccess wxMSLU__waccess + #define wxMkDir wxMSLU__wmkdir + #define wxRmDir wxMSLU__wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxStat wxMSLU__wstati64 + #else + #define wxStat wxMSLU__wstat + #endif + #else // !wxUSE_UNICODE_MSLU + #ifdef __BORLANDC__ + #if __BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551 + WXDLLIMPEXP_BASE int wxOpen(const wxChar *pathname, + int flags, mode_t mode); + #else + #define wxOpen _wopen + #endif + #define wxAccess _waccess + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxStat _wstati64 + #else + #define wxStat _wstat + #endif + #else + #define wxOpen _wopen + #define wxAccess _waccess + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxStat _wstati64 + #else + #define wxStat _wstat + #endif + #endif + #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU + #else // !wxUSE_UNICODE + #define wxOpen wxPOSIX_IDENT(open) + #define wxAccess wxPOSIX_IDENT(access) + #define wxMkDir wxPOSIX_IDENT(mkdir) + #define wxRmDir wxPOSIX_IDENT(rmdir) + #ifdef wxHAS_HUGE_FILES + #define wxStat wxPOSIX_IDENT(stati64) + #else + // Unfortunately Watcom is not consistent, so:- + #if defined(__OS2__) && defined(__WATCOMC__) + #define wxStat _stat + #else + #if defined (__BORLANDC__) + #define wxStat _stat //wxPOSIX_IDENT(stat) + #else + #define wxStat wxPOSIX_IDENT(stat) + #endif // !borland + #endif // !watcom + #endif + #endif // wxUSE_UNICODE/!wxUSE_UNICODE + + // Types: Notice that Watcom is the only compiler to have a wide char + // version of struct stat as well as a wide char stat function variant. + // This was droped since OW 1.4 "for consistency across platforms". + #ifdef wxHAS_HUGE_FILES + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) + #define wxStructStat struct _wstati64 + #else + #define wxStructStat struct _stati64 + #endif + #else + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) + #define wxStructStat struct _wstat + #else + #define wxStructStat struct _stat + #endif + #endif + + // constants (unless already defined by the user code) + #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS + #ifndef O_RDONLY + #define O_RDONLY _O_RDONLY + #define O_WRONLY _O_WRONLY + #define O_RDWR _O_RDWR + #define O_EXCL _O_EXCL + #define O_CREAT _O_CREAT + #define O_BINARY _O_BINARY + #endif + + #ifndef S_IFMT + #define S_IFMT _S_IFMT + #define S_IFDIR _S_IFDIR + #define S_IFREG _S_IFREG + #endif + #endif // wxHAS_UNDERSCORES_IN_POSIX_IDENTS + + #ifdef wxHAS_HUGE_FILES + // wxFile is present and supports large files. Currently wxFFile + // doesn't have large file support with any Windows compiler (even + // Win64 ones). + #if wxUSE_FILE + #define wxHAS_LARGE_FILES + #endif + #endif + + // it's a private define, undefine it so that nobody gets tempted to use it + #undef wxHAS_HUGE_FILES +#else // Unix or Windows using unknown compiler, assume POSIX supported + typedef off_t wxFileOffset; + #ifdef _LARGE_FILES + #define wxFileOffsetFmtSpec wxLongLongFmtSpec + wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), + BadFileSizeType ); + // wxFile is present and supports large files + #ifdef wxUSE_FILE + #define wxHAS_LARGE_FILES + #endif + // wxFFile is present and supports large files + #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO + #define wxHAS_LARGE_FFILES + #endif + #else + #define wxFileOffsetFmtSpec _T("") + #endif + // functions + #define wxClose close + #define wxRead ::read + #define wxWrite ::write + #define wxLseek lseek + #define wxSeek lseek + #define wxFsync fsync + #define wxEof eof + + #define wxMkDir mkdir + #define wxRmDir rmdir + + #define wxTell(fd) lseek(fd, 0, SEEK_CUR) + + #define wxStructStat struct stat + + #if wxUSE_UNICODE + #define wxNEED_WX_UNISTD_H + #if defined(__DMC__) + typedef unsigned long mode_t; + #endif + WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf ); + WXDLLIMPEXP_BASE int wxLstat( const wxChar *file_name, wxStructStat *buf ); + WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode ); + WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); + #else + #define wxOpen open + #define wxStat stat + #define wxLstat lstat + #define wxAccess access + #endif + + #define wxHAS_NATIVE_LSTAT +#endif // platforms + +#ifdef O_BINARY + #define wxO_BINARY O_BINARY +#else + #define wxO_BINARY 0 +#endif + +// if the platform doesn't have symlinks, define wxLstat to be the same as +// wxStat to avoid #ifdefs in the code using it +#ifndef wxHAS_NATIVE_LSTAT + #define wxLstat wxStat +#endif + +#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 +// +// VisualAge C++ V4.0 cannot have any external linkage const decs +// in headers included by more than one primary source +// +extern const int wxInvalidOffset; +#else +const int wxInvalidOffset = -1; +#endif + +// ---------------------------------------------------------------------------- +// functions +// ---------------------------------------------------------------------------- +WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); + +// does the path exist? (may have or not '/' or '\\' at the end) +WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); + +WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); + +// Get filename +WXDLLIMPEXP_BASE wxChar* wxFileNameFromPath(wxChar *path); +WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); + +// Get directory +WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); + +// wxString version +WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path); + +WXDLLIMPEXP_BASE void wxDos2UnixFilename(wxChar *s); + +WXDLLIMPEXP_BASE void wxUnix2DosFilename(wxChar *s); + +// Strip the extension, in situ +WXDLLIMPEXP_BASE void wxStripExtension(wxChar *buffer); +WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer); + +// Get a temporary filename +WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL); +WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf); + +// Expand file name (~/ and ${OPENWINHOME}/ stuff) +WXDLLIMPEXP_BASE wxChar* wxExpandPath(wxChar *dest, const wxChar *path); +WXDLLIMPEXP_BASE bool wxExpandPath(wxString& dest, const wxChar *path); + +// Contract w.r.t environment ( -> ${OPENWINHOME}/lib) +// and make (if under the home tree) relative to home +// [caller must copy-- volatile] +WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, + const wxString& envname = wxEmptyString, + const wxString& user = wxEmptyString); + +// Destructive removal of /./ and /../ stuff +WXDLLIMPEXP_BASE wxChar* wxRealPath(wxChar *path); + +// Allocate a copy of the full absolute path +WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path); + +// Get first file name matching given wild card. +// Flags are reserved for future use. +#define wxFILE 1 +#define wxDIR 2 +WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxChar *spec, int flags = wxFILE); +WXDLLIMPEXP_BASE wxString wxFindNextFile(); + +// Does the pattern contain wildcards? +WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); + +// Does the pattern match the text (usually a filename)? +// If dot_special is true, doesn't match * against . (eliminating +// `hidden' dot files) +WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); + +// Concatenate two files to form third +WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3); + +// Copy file1 to file2 +WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, + bool overwrite = true); + +// Remove file +WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); + +// Rename file +WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true); + +// Get current working directory. +#if WXWIN_COMPATIBILITY_2_6 +// If buf is NULL, allocates space using new, else +// copies into buf. +// IMPORTANT NOTE getcwd is know not to work under some releases +// of Win32s 1.3, according to MS release notes! +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000) ); +// new and preferred version of wxGetWorkingDirectory +// NB: can't have the same name because of overloading ambiguity +#endif // WXWIN_COMPATIBILITY_2_6 +WXDLLIMPEXP_BASE wxString wxGetCwd(); + +// Set working directory +WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); + +// Make directory +WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777); + +// Remove directory. Flags reserved for future use. +WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); + +// Return the type of an open file +WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); +WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); + +#if WXWIN_COMPATIBILITY_2_6 +// compatibility defines, don't use in new code +wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); +inline bool wxPathExists(const wxChar *pszPathName) +{ + return wxDirExists(pszPathName); +} +#endif //WXWIN_COMPATIBILITY_2_6 + +// permissions; these functions work both on files and directories: +WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path); +WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path); +WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); + +// ---------------------------------------------------------------------------- +// separators in file names +// ---------------------------------------------------------------------------- + +// between file name and extension +#define wxFILE_SEP_EXT wxT('.') + +// between drive/volume name and the path +#define wxFILE_SEP_DSK wxT(':') + +// between the path components +#define wxFILE_SEP_PATH_DOS wxT('\\') +#define wxFILE_SEP_PATH_UNIX wxT('/') +#define wxFILE_SEP_PATH_MAC wxT(':') +#define wxFILE_SEP_PATH_VMS wxT('.') // VMS also uses '[' and ']' + +// separator in the path list (as in PATH environment variable) +// there is no PATH variable in Classic Mac OS so just use the +// semicolon (it must be different from the file name separator) +// NB: these are strings and not characters on purpose! +#define wxPATH_SEP_DOS wxT(";") +#define wxPATH_SEP_UNIX wxT(":") +#define wxPATH_SEP_MAC wxT(";") + +// platform independent versions +#if defined(__UNIX__) && !defined(__OS2__) + // CYGWIN also uses UNIX settings + #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX + #define wxPATH_SEP wxPATH_SEP_UNIX +#elif defined(__MAC__) + #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC + #define wxPATH_SEP wxPATH_SEP_MAC +#else // Windows and OS/2 + #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS + #define wxPATH_SEP wxPATH_SEP_DOS +#endif // Unix/Windows + +// this is useful for wxString::IsSameAs(): to compare two file names use +// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) +#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) + #define wxARE_FILENAMES_CASE_SENSITIVE true +#else // Windows, Mac OS and OS/2 + #define wxARE_FILENAMES_CASE_SENSITIVE false +#endif // Unix/Windows + +// is the char a path separator? +inline bool wxIsPathSeparator(wxChar c) +{ + // under DOS/Windows we should understand both Unix and DOS file separators +#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) + return c == wxFILE_SEP_PATH; +#else + return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; +#endif +} + +// does the string ends with path separator? +WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxChar *pszFileName); + +// split the full path into path (including drive for DOS), name and extension +// (understands both '/' and '\\') +WXDLLIMPEXP_BASE void wxSplitPath(const wxChar *pszFileName, + wxString *pstrPath, + wxString *pstrName, + wxString *pstrExt); + +// find a file in a list of directories, returns false if not found +WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile); + +// Get the OS directory if appropriate (such as the Windows directory). +// On non-Windows platform, probably just return the empty string. +WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); + +#if wxUSE_DATETIME + +// Get file modification time +WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); + +#endif // wxUSE_DATETIME + +// Parses the wildCard, returning the number of filters. +// Returns 0 if none or if there's a problem, +// The arrays will contain an equal number of items found before the error. +// wildCard is in the form: +// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" +WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); + +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + +#ifdef __UNIX__ + +// set umask to the given value in ctor and reset it to the old one in dtor +class WXDLLIMPEXP_BASE wxUmaskChanger +{ +public: + // change the umask to the given one if it is not -1: this allows to write + // the same code whether you really want to change umask or not, as is in + // wxFileConfig::Flush() for example + wxUmaskChanger(int umaskNew) + { + m_umaskOld = umaskNew == -1 ? -1 : (int)umask((mode_t)umaskNew); + } + + ~wxUmaskChanger() + { + if ( m_umaskOld != -1 ) + umask((mode_t)m_umaskOld); + } + +private: + int m_umaskOld; +}; + +// this macro expands to an "anonymous" wxUmaskChanger object under Unix and +// nothing elsewhere +#define wxCHANGE_UMASK(m) wxUmaskChanger wxMAKE_UNIQUE_NAME(umaskChanger_)(m) + +#else // !__UNIX__ + +#define wxCHANGE_UMASK(m) + +#endif // __UNIX__/!__UNIX__ + + +// Path searching +class WXDLLIMPEXP_BASE wxPathList : public wxArrayString +{ +public: + wxPathList() {} + wxPathList(const wxArrayString &arr) + { Add(arr); } + + // Adds all paths in environment variable + void AddEnvList(const wxString& envVariable); + + // Adds given path to this list + bool Add(const wxString& path); + void Add(const wxArrayString &paths); + + // Find the first full path for which the file exists + wxString FindValidPath(const wxString& filename) const; + + // Find the first full path for which the file exists; ensure it's an + // absolute path that gets returned. + wxString FindAbsoluteValidPath(const wxString& filename) const; + + // Given full path and filename, add path to list + bool EnsureFileAccessible(const wxString& path); + +#if WXWIN_COMPATIBILITY_2_6 + // Returns true if the path is in the list + wxDEPRECATED( bool Member(const wxString& path) const ); +#endif +}; + +#endif // _WX_FILEFN_H_ diff --git a/Externals/wxWidgets/include/wx/filename.h b/Externals/wxWidgets/include/wx/filename.h index 878f1e4363..0a3abb58fb 100644 --- a/Externals/wxWidgets/include/wx/filename.h +++ b/Externals/wxWidgets/include/wx/filename.h @@ -1,541 +1,541 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filename.h -// Purpose: wxFileName - encapsulates a file path -// Author: Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 28.12.00 -// RCS-ID: $Id: filename.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2000 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILENAME_H_ -#define _WX_FILENAME_H_ - -/* - TODO: - - 1. support for drives under Windows - 2. more file operations: - a) chmod() - b) [acm]time() - get and set - c) rename()? - 3. SameFileAs() function to compare inodes under Unix - */ - -#include "wx/arrstr.h" -#include "wx/filefn.h" -#include "wx/datetime.h" -#include "wx/intl.h" - -#if wxUSE_FILE -class WXDLLIMPEXP_FWD_BASE wxFile; -#endif - -#if wxUSE_FFILE -class WXDLLIMPEXP_FWD_BASE wxFFile; -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the various values for the path format: this mainly affects the path -// separator but also whether or not the path has the drive part (as under -// Windows) -enum wxPathFormat -{ - wxPATH_NATIVE = 0, // the path format for the current platform - wxPATH_UNIX, - wxPATH_BEOS = wxPATH_UNIX, - wxPATH_MAC, - wxPATH_DOS, - wxPATH_WIN = wxPATH_DOS, - wxPATH_OS2 = wxPATH_DOS, - wxPATH_VMS, - - wxPATH_MAX // Not a valid value for specifying path format -}; - -// the kind of normalization to do with the file name: these values can be -// or'd together to perform several operations at once -enum wxPathNormalize -{ - wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values - wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd - wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user - wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower - wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute - wxPATH_NORM_LONG = 0x0020, // make the path the long form - wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut - wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE -}; - -// what exactly should GetPath() return? -enum -{ - wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable - wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator -}; - -// MkDir flags -enum -{ - wxPATH_MKDIR_FULL = 0x0001 // create directories recursively -}; - -// error code of wxFileName::GetSize() -extern WXDLLIMPEXP_DATA_BASE(wxULongLong) wxInvalidSize; - - - -// ---------------------------------------------------------------------------- -// wxFileName: encapsulates a file path -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileName -{ -public: - // constructors and assignment - - // the usual stuff - wxFileName() { Clear(); } - wxFileName(const wxFileName& filepath) { Assign(filepath); } - - // from a full filename: if it terminates with a '/', a directory path - // is contructed (the name will be empty), otherwise a file name and - // extension are extracted from it - wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE ) - { Assign( fullpath, format ); } - - // from a directory name and a file name - wxFileName(const wxString& path, - const wxString& name, - wxPathFormat format = wxPATH_NATIVE) - { Assign(path, name, format); } - - // from a volume, directory name, file base name and extension - wxFileName(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE) - { Assign(volume, path, name, ext, format); } - - // from a directory name, file base name and extension - wxFileName(const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE) - { Assign(path, name, ext, format); } - - // the same for delayed initialization - - void Assign(const wxFileName& filepath); - - void Assign(const wxString& fullpath, - wxPathFormat format = wxPATH_NATIVE); - - void Assign(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - bool hasExt, - wxPathFormat format = wxPATH_NATIVE); - - void Assign(const wxString& volume, - const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE) - { Assign(volume, path, name, ext, !ext.empty(), format); } - - void Assign(const wxString& path, - const wxString& name, - wxPathFormat format = wxPATH_NATIVE); - - void Assign(const wxString& path, - const wxString& name, - const wxString& ext, - wxPathFormat format = wxPATH_NATIVE); - - void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE); - - // assorted assignment operators - - wxFileName& operator=(const wxFileName& filename) - { Assign(filename); return *this; } - - wxFileName& operator=(const wxString& filename) - { Assign(filename); return *this; } - - // reset all components to default, uninitialized state - void Clear(); - - // static pseudo constructors - static wxFileName FileName(const wxString& file, - wxPathFormat format = wxPATH_NATIVE); - static wxFileName DirName(const wxString& dir, - wxPathFormat format = wxPATH_NATIVE); - - // file tests - - // is the filename valid at all? - bool IsOk() const - { - // we're fine if we have the path or the name or if we're a root dir - return m_dirs.size() != 0 || !m_name.empty() || !m_relative || - !m_ext.empty() || m_hasExt; - } - - // does the file with this name exists? - bool FileExists() const; - static bool FileExists( const wxString &file ); - - // does the directory with this name exists? - bool DirExists() const; - static bool DirExists( const wxString &dir ); - - // checks on most common flags for files/directories; - // more platform-specific features (like e.g. Unix permissions) are not - // available in wxFileName - - bool IsDirWritable() const { return wxIsWritable(GetPath()); } - static bool IsDirWritable(const wxString &path) { return wxDirExists(path) && wxIsWritable(path); } - - bool IsDirReadable() const { return wxIsReadable(GetPath()); } - static bool IsDirReadable(const wxString &path) { return wxDirExists(path) && wxIsReadable(path); } - - // NOTE: IsDirExecutable() is not present because the meaning of "executable" - // directory is very platform-dependent and also not so useful - - bool IsFileWritable() const { return wxIsWritable(GetFullPath()); } - static bool IsFileWritable(const wxString &path) { return wxFileExists(path) && wxIsWritable(path); } - - bool IsFileReadable() const { return wxIsReadable(GetFullPath()); } - static bool IsFileReadable(const wxString &path) { return wxFileExists(path) && wxIsReadable(path); } - - bool IsFileExecutable() const { return wxIsExecutable(GetFullPath()); } - static bool IsFileExecutable(const wxString &path) { return wxFileExists(path) && wxIsExecutable(path); } - - - // time functions -#if wxUSE_DATETIME - // set the file last access/mod and creation times - // (any of the pointers may be NULL) - bool SetTimes(const wxDateTime *dtAccess, - const wxDateTime *dtMod, - const wxDateTime *dtCreate); - - // set the access and modification times to the current moment - bool Touch(); - - // return the last access, last modification and create times - // (any of the pointers may be NULL) - bool GetTimes(wxDateTime *dtAccess, - wxDateTime *dtMod, - wxDateTime *dtCreate) const; - - // convenience wrapper: get just the last mod time of the file - wxDateTime GetModificationTime() const - { - wxDateTime dtMod; - (void)GetTimes(NULL, &dtMod, NULL); - return dtMod; - } -#endif // wxUSE_DATETIME - -#ifdef __WXMAC__ - bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ; - bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) ; - // gets the 'common' type and creator for a certain extension - static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ; - // registers application defined extensions and their default type and creator - static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ; - // looks up the appropriate type and creator from the registration and then sets - bool MacSetDefaultTypeAndCreator() ; -#endif - - // various file/dir operations - - // retrieve the value of the current working directory - void AssignCwd(const wxString& volume = wxEmptyString); - static wxString GetCwd(const wxString& volume = wxEmptyString); - - // change the current working directory - bool SetCwd(); - static bool SetCwd( const wxString &cwd ); - - // get the value of user home (Unix only mainly) - void AssignHomeDir(); - static wxString GetHomeDir(); - - // get the system temporary directory - static wxString GetTempDir(); - -#if wxUSE_FILE || wxUSE_FFILE - // get a temp file name starting with the specified prefix - void AssignTempFileName(const wxString& prefix); - static wxString CreateTempFileName(const wxString& prefix); -#endif // wxUSE_FILE - -#if wxUSE_FILE - // get a temp file name starting with the specified prefix and open the - // file passed to us using this name for writing (atomically if - // possible) - void AssignTempFileName(const wxString& prefix, wxFile *fileTemp); - static wxString CreateTempFileName(const wxString& prefix, - wxFile *fileTemp); -#endif // wxUSE_FILE - -#if wxUSE_FFILE - // get a temp file name starting with the specified prefix and open the - // file passed to us using this name for writing (atomically if - // possible) - void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp); - static wxString CreateTempFileName(const wxString& prefix, - wxFFile *fileTemp); -#endif // wxUSE_FFILE - - // directory creation and removal. - bool Mkdir( int perm = 0777, int flags = 0); - static bool Mkdir( const wxString &dir, int perm = 0777, int flags = 0 ); - - bool Rmdir(); - static bool Rmdir( const wxString &dir ); - - // operations on the path - - // normalize the path: with the default flags value, the path will be - // made absolute, without any ".." and "." and all environment - // variables will be expanded in it - // - // this may be done using another (than current) value of cwd - bool Normalize(int flags = wxPATH_NORM_ALL, - const wxString& cwd = wxEmptyString, - wxPathFormat format = wxPATH_NATIVE); - - // get a path path relative to the given base directory, i.e. opposite - // of Normalize - // - // pass an empty string to get a path relative to the working directory - // - // returns true if the file name was modified, false if we failed to do - // anything with it (happens when the file is on a different volume, - // for example) - bool MakeRelativeTo(const wxString& pathBase = wxEmptyString, - wxPathFormat format = wxPATH_NATIVE); - - // make the path absolute - // - // this may be done using another (than current) value of cwd - bool MakeAbsolute(const wxString& cwd = wxEmptyString, - wxPathFormat format = wxPATH_NATIVE) - { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | - wxPATH_NORM_TILDE, cwd, format); } - -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE - // if the path is a shortcut, return the target and optionally, - // the arguments - bool GetShortcutTarget(const wxString& shortcutPath, - wxString& targetFilename, - wxString* arguments = NULL); -#endif - - // Comparison - - // compares with the rules of the given platforms format - bool SameAs(const wxFileName& filepath, - wxPathFormat format = wxPATH_NATIVE) const; - - // compare with another filename object - bool operator==(const wxFileName& filename) const - { return SameAs(filename); } - bool operator!=(const wxFileName& filename) const - { return !SameAs(filename); } - - // compare with a filename string interpreted as a native file name - bool operator==(const wxString& filename) const - { return SameAs(wxFileName(filename)); } - bool operator!=(const wxString& filename) const - { return !SameAs(wxFileName(filename)); } - - // are the file names of this type cases sensitive? - static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); - - // is this filename absolute? - bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; - - // is this filename relative? - bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const - { return !IsAbsolute(format); } - - // Returns the characters that aren't allowed in filenames - // on the specified platform. - static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE); - - // Information about path format - - // get the string separating the volume from the path for this format, - // return an empty string if this format doesn't support the notion of - // volumes at all - static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); - - // get the string of path separators for this format - static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); - - // get the string of path terminators, i.e. characters which terminate the - // path - static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); - - // get the canonical path separator for this format - static wxChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) - { return GetPathSeparators(format)[0u]; } - - // is the char a path separator for this format? - static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); - - // Dir accessors - size_t GetDirCount() const { return m_dirs.size(); } - void AppendDir(const wxString& dir); - void PrependDir(const wxString& dir); - void InsertDir(size_t before, const wxString& dir); - void RemoveDir(size_t pos); - void RemoveLastDir() { RemoveDir(GetDirCount() - 1); } - - // Other accessors - void SetExt( const wxString &ext ) { m_ext = ext; m_hasExt = !m_ext.empty(); } - void ClearExt() { m_ext = wxEmptyString; m_hasExt = false; } - void SetEmptyExt() { m_ext = wxT(""); m_hasExt = true; } - wxString GetExt() const { return m_ext; } - bool HasExt() const { return m_hasExt; } - - void SetName( const wxString &name ) { m_name = name; } - wxString GetName() const { return m_name; } - bool HasName() const { return !m_name.empty(); } - - void SetVolume( const wxString &volume ) { m_volume = volume; } - wxString GetVolume() const { return m_volume; } - bool HasVolume() const { return !m_volume.empty(); } - - // full name is the file name + extension (but without the path) - void SetFullName(const wxString& fullname); - wxString GetFullName() const; - - const wxArrayString& GetDirs() const { return m_dirs; } - - // flags are combination of wxPATH_GET_XXX flags - wxString GetPath(int flags = wxPATH_GET_VOLUME, - wxPathFormat format = wxPATH_NATIVE) const; - - // Replace current path with this one - void SetPath( const wxString &path, wxPathFormat format = wxPATH_NATIVE ); - - // Construct full path with name and ext - wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const; - - // Return the short form of the path (returns identity on non-Windows platforms) - wxString GetShortPath() const; - - // Return the long form of the path (returns identity on non-Windows platforms) - wxString GetLongPath() const; - - // Is this a file or directory (not necessarily an existing one) - bool IsDir() const { return m_name.empty() && m_ext.empty(); } - - // various helpers - - // get the canonical path format for this platform - static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE ); - - // split a fullpath into the volume, path, (base) name and extension - // (all of the pointers can be NULL) - static void SplitPath(const wxString& fullpath, - wxString *volume, - wxString *path, - wxString *name, - wxString *ext, - bool *hasExt = NULL, - wxPathFormat format = wxPATH_NATIVE); - - static void SplitPath(const wxString& fullpath, - wxString *volume, - wxString *path, - wxString *name, - wxString *ext, - wxPathFormat format) - { - SplitPath(fullpath, volume, path, name, ext, NULL, format); - } - - // compatibility version: volume is part of path - static void SplitPath(const wxString& fullpath, - wxString *path, - wxString *name, - wxString *ext, - wxPathFormat format = wxPATH_NATIVE); - - // split a path into volume and pure path part - static void SplitVolume(const wxString& fullpathWithVolume, - wxString *volume, - wxString *path, - wxPathFormat format = wxPATH_NATIVE); - - // Filesize - - // returns the size of the given filename - wxULongLong GetSize() const; - static wxULongLong GetSize(const wxString &file); - - // returns the size in a human readable form - wxString GetHumanReadableSize(const wxString &nullsize = wxGetTranslation(_T("Not available")), - int precision = 1) const; - static wxString GetHumanReadableSize(const wxULongLong &sz, - const wxString &nullsize = wxGetTranslation(_T("Not available")), - int precision = 1); - - - // deprecated methods, don't use any more - // -------------------------------------- - -#ifndef __DIGITALMARS__ - wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const - { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } -#endif - wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const - { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } - -private: - // check whether this dir is valid for Append/Prepend/InsertDir() - static bool IsValidDirComponent(const wxString& dir); - - // the drive/volume/device specification (always empty for Unix) - wxString m_volume; - - // the path components of the file - wxArrayString m_dirs; - - // the file name and extension (empty for directories) - wxString m_name, - m_ext; - - // when m_dirs is empty it may mean either that we have no path at all or - // that our path is '/', i.e. the root directory - // - // we use m_relative to distinguish between these two cases, it will be - // true in the former and false in the latter - // - // NB: the path is not absolute just because m_relative is false, it still - // needs the drive (i.e. volume) in some formats (Windows) - bool m_relative; - - // when m_ext is empty, it may be because we don't have any extension or - // because we have an empty extension - // - // the difference is important as file with name "foo" and without - // extension has full name "foo" while with empty extension it is "foo." - bool m_hasExt; -}; - -#endif // _WX_FILENAME_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filename.h +// Purpose: wxFileName - encapsulates a file path +// Author: Robert Roebling, Vadim Zeitlin +// Modified by: +// Created: 28.12.00 +// RCS-ID: $Id: filename.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2000 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILENAME_H_ +#define _WX_FILENAME_H_ + +/* + TODO: + + 1. support for drives under Windows + 2. more file operations: + a) chmod() + b) [acm]time() - get and set + c) rename()? + 3. SameFileAs() function to compare inodes under Unix + */ + +#include "wx/arrstr.h" +#include "wx/filefn.h" +#include "wx/datetime.h" +#include "wx/intl.h" + +#if wxUSE_FILE +class WXDLLIMPEXP_FWD_BASE wxFile; +#endif + +#if wxUSE_FFILE +class WXDLLIMPEXP_FWD_BASE wxFFile; +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the various values for the path format: this mainly affects the path +// separator but also whether or not the path has the drive part (as under +// Windows) +enum wxPathFormat +{ + wxPATH_NATIVE = 0, // the path format for the current platform + wxPATH_UNIX, + wxPATH_BEOS = wxPATH_UNIX, + wxPATH_MAC, + wxPATH_DOS, + wxPATH_WIN = wxPATH_DOS, + wxPATH_OS2 = wxPATH_DOS, + wxPATH_VMS, + + wxPATH_MAX // Not a valid value for specifying path format +}; + +// the kind of normalization to do with the file name: these values can be +// or'd together to perform several operations at once +enum wxPathNormalize +{ + wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values + wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd + wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user + wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower + wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute + wxPATH_NORM_LONG = 0x0020, // make the path the long form + wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut + wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE +}; + +// what exactly should GetPath() return? +enum +{ + wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable + wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator +}; + +// MkDir flags +enum +{ + wxPATH_MKDIR_FULL = 0x0001 // create directories recursively +}; + +// error code of wxFileName::GetSize() +extern WXDLLIMPEXP_DATA_BASE(wxULongLong) wxInvalidSize; + + + +// ---------------------------------------------------------------------------- +// wxFileName: encapsulates a file path +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileName +{ +public: + // constructors and assignment + + // the usual stuff + wxFileName() { Clear(); } + wxFileName(const wxFileName& filepath) { Assign(filepath); } + + // from a full filename: if it terminates with a '/', a directory path + // is contructed (the name will be empty), otherwise a file name and + // extension are extracted from it + wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE ) + { Assign( fullpath, format ); } + + // from a directory name and a file name + wxFileName(const wxString& path, + const wxString& name, + wxPathFormat format = wxPATH_NATIVE) + { Assign(path, name, format); } + + // from a volume, directory name, file base name and extension + wxFileName(const wxString& volume, + const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE) + { Assign(volume, path, name, ext, format); } + + // from a directory name, file base name and extension + wxFileName(const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE) + { Assign(path, name, ext, format); } + + // the same for delayed initialization + + void Assign(const wxFileName& filepath); + + void Assign(const wxString& fullpath, + wxPathFormat format = wxPATH_NATIVE); + + void Assign(const wxString& volume, + const wxString& path, + const wxString& name, + const wxString& ext, + bool hasExt, + wxPathFormat format = wxPATH_NATIVE); + + void Assign(const wxString& volume, + const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE) + { Assign(volume, path, name, ext, !ext.empty(), format); } + + void Assign(const wxString& path, + const wxString& name, + wxPathFormat format = wxPATH_NATIVE); + + void Assign(const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE); + + void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE); + + // assorted assignment operators + + wxFileName& operator=(const wxFileName& filename) + { Assign(filename); return *this; } + + wxFileName& operator=(const wxString& filename) + { Assign(filename); return *this; } + + // reset all components to default, uninitialized state + void Clear(); + + // static pseudo constructors + static wxFileName FileName(const wxString& file, + wxPathFormat format = wxPATH_NATIVE); + static wxFileName DirName(const wxString& dir, + wxPathFormat format = wxPATH_NATIVE); + + // file tests + + // is the filename valid at all? + bool IsOk() const + { + // we're fine if we have the path or the name or if we're a root dir + return m_dirs.size() != 0 || !m_name.empty() || !m_relative || + !m_ext.empty() || m_hasExt; + } + + // does the file with this name exists? + bool FileExists() const; + static bool FileExists( const wxString &file ); + + // does the directory with this name exists? + bool DirExists() const; + static bool DirExists( const wxString &dir ); + + // checks on most common flags for files/directories; + // more platform-specific features (like e.g. Unix permissions) are not + // available in wxFileName + + bool IsDirWritable() const { return wxIsWritable(GetPath()); } + static bool IsDirWritable(const wxString &path) { return wxDirExists(path) && wxIsWritable(path); } + + bool IsDirReadable() const { return wxIsReadable(GetPath()); } + static bool IsDirReadable(const wxString &path) { return wxDirExists(path) && wxIsReadable(path); } + + // NOTE: IsDirExecutable() is not present because the meaning of "executable" + // directory is very platform-dependent and also not so useful + + bool IsFileWritable() const { return wxIsWritable(GetFullPath()); } + static bool IsFileWritable(const wxString &path) { return wxFileExists(path) && wxIsWritable(path); } + + bool IsFileReadable() const { return wxIsReadable(GetFullPath()); } + static bool IsFileReadable(const wxString &path) { return wxFileExists(path) && wxIsReadable(path); } + + bool IsFileExecutable() const { return wxIsExecutable(GetFullPath()); } + static bool IsFileExecutable(const wxString &path) { return wxFileExists(path) && wxIsExecutable(path); } + + + // time functions +#if wxUSE_DATETIME + // set the file last access/mod and creation times + // (any of the pointers may be NULL) + bool SetTimes(const wxDateTime *dtAccess, + const wxDateTime *dtMod, + const wxDateTime *dtCreate); + + // set the access and modification times to the current moment + bool Touch(); + + // return the last access, last modification and create times + // (any of the pointers may be NULL) + bool GetTimes(wxDateTime *dtAccess, + wxDateTime *dtMod, + wxDateTime *dtCreate) const; + + // convenience wrapper: get just the last mod time of the file + wxDateTime GetModificationTime() const + { + wxDateTime dtMod; + (void)GetTimes(NULL, &dtMod, NULL); + return dtMod; + } +#endif // wxUSE_DATETIME + +#ifdef __WXMAC__ + bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ; + bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) ; + // gets the 'common' type and creator for a certain extension + static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ; + // registers application defined extensions and their default type and creator + static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ; + // looks up the appropriate type and creator from the registration and then sets + bool MacSetDefaultTypeAndCreator() ; +#endif + + // various file/dir operations + + // retrieve the value of the current working directory + void AssignCwd(const wxString& volume = wxEmptyString); + static wxString GetCwd(const wxString& volume = wxEmptyString); + + // change the current working directory + bool SetCwd(); + static bool SetCwd( const wxString &cwd ); + + // get the value of user home (Unix only mainly) + void AssignHomeDir(); + static wxString GetHomeDir(); + + // get the system temporary directory + static wxString GetTempDir(); + +#if wxUSE_FILE || wxUSE_FFILE + // get a temp file name starting with the specified prefix + void AssignTempFileName(const wxString& prefix); + static wxString CreateTempFileName(const wxString& prefix); +#endif // wxUSE_FILE + +#if wxUSE_FILE + // get a temp file name starting with the specified prefix and open the + // file passed to us using this name for writing (atomically if + // possible) + void AssignTempFileName(const wxString& prefix, wxFile *fileTemp); + static wxString CreateTempFileName(const wxString& prefix, + wxFile *fileTemp); +#endif // wxUSE_FILE + +#if wxUSE_FFILE + // get a temp file name starting with the specified prefix and open the + // file passed to us using this name for writing (atomically if + // possible) + void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp); + static wxString CreateTempFileName(const wxString& prefix, + wxFFile *fileTemp); +#endif // wxUSE_FFILE + + // directory creation and removal. + bool Mkdir( int perm = 0777, int flags = 0); + static bool Mkdir( const wxString &dir, int perm = 0777, int flags = 0 ); + + bool Rmdir(); + static bool Rmdir( const wxString &dir ); + + // operations on the path + + // normalize the path: with the default flags value, the path will be + // made absolute, without any ".." and "." and all environment + // variables will be expanded in it + // + // this may be done using another (than current) value of cwd + bool Normalize(int flags = wxPATH_NORM_ALL, + const wxString& cwd = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE); + + // get a path path relative to the given base directory, i.e. opposite + // of Normalize + // + // pass an empty string to get a path relative to the working directory + // + // returns true if the file name was modified, false if we failed to do + // anything with it (happens when the file is on a different volume, + // for example) + bool MakeRelativeTo(const wxString& pathBase = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE); + + // make the path absolute + // + // this may be done using another (than current) value of cwd + bool MakeAbsolute(const wxString& cwd = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE) + { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | + wxPATH_NORM_TILDE, cwd, format); } + +#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE + // if the path is a shortcut, return the target and optionally, + // the arguments + bool GetShortcutTarget(const wxString& shortcutPath, + wxString& targetFilename, + wxString* arguments = NULL); +#endif + + // Comparison + + // compares with the rules of the given platforms format + bool SameAs(const wxFileName& filepath, + wxPathFormat format = wxPATH_NATIVE) const; + + // compare with another filename object + bool operator==(const wxFileName& filename) const + { return SameAs(filename); } + bool operator!=(const wxFileName& filename) const + { return !SameAs(filename); } + + // compare with a filename string interpreted as a native file name + bool operator==(const wxString& filename) const + { return SameAs(wxFileName(filename)); } + bool operator!=(const wxString& filename) const + { return !SameAs(wxFileName(filename)); } + + // are the file names of this type cases sensitive? + static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); + + // is this filename absolute? + bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; + + // is this filename relative? + bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const + { return !IsAbsolute(format); } + + // Returns the characters that aren't allowed in filenames + // on the specified platform. + static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE); + + // Information about path format + + // get the string separating the volume from the path for this format, + // return an empty string if this format doesn't support the notion of + // volumes at all + static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); + + // get the string of path separators for this format + static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); + + // get the string of path terminators, i.e. characters which terminate the + // path + static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); + + // get the canonical path separator for this format + static wxChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) + { return GetPathSeparators(format)[0u]; } + + // is the char a path separator for this format? + static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); + + // Dir accessors + size_t GetDirCount() const { return m_dirs.size(); } + void AppendDir(const wxString& dir); + void PrependDir(const wxString& dir); + void InsertDir(size_t before, const wxString& dir); + void RemoveDir(size_t pos); + void RemoveLastDir() { RemoveDir(GetDirCount() - 1); } + + // Other accessors + void SetExt( const wxString &ext ) { m_ext = ext; m_hasExt = !m_ext.empty(); } + void ClearExt() { m_ext = wxEmptyString; m_hasExt = false; } + void SetEmptyExt() { m_ext = wxT(""); m_hasExt = true; } + wxString GetExt() const { return m_ext; } + bool HasExt() const { return m_hasExt; } + + void SetName( const wxString &name ) { m_name = name; } + wxString GetName() const { return m_name; } + bool HasName() const { return !m_name.empty(); } + + void SetVolume( const wxString &volume ) { m_volume = volume; } + wxString GetVolume() const { return m_volume; } + bool HasVolume() const { return !m_volume.empty(); } + + // full name is the file name + extension (but without the path) + void SetFullName(const wxString& fullname); + wxString GetFullName() const; + + const wxArrayString& GetDirs() const { return m_dirs; } + + // flags are combination of wxPATH_GET_XXX flags + wxString GetPath(int flags = wxPATH_GET_VOLUME, + wxPathFormat format = wxPATH_NATIVE) const; + + // Replace current path with this one + void SetPath( const wxString &path, wxPathFormat format = wxPATH_NATIVE ); + + // Construct full path with name and ext + wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const; + + // Return the short form of the path (returns identity on non-Windows platforms) + wxString GetShortPath() const; + + // Return the long form of the path (returns identity on non-Windows platforms) + wxString GetLongPath() const; + + // Is this a file or directory (not necessarily an existing one) + bool IsDir() const { return m_name.empty() && m_ext.empty(); } + + // various helpers + + // get the canonical path format for this platform + static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE ); + + // split a fullpath into the volume, path, (base) name and extension + // (all of the pointers can be NULL) + static void SplitPath(const wxString& fullpath, + wxString *volume, + wxString *path, + wxString *name, + wxString *ext, + bool *hasExt = NULL, + wxPathFormat format = wxPATH_NATIVE); + + static void SplitPath(const wxString& fullpath, + wxString *volume, + wxString *path, + wxString *name, + wxString *ext, + wxPathFormat format) + { + SplitPath(fullpath, volume, path, name, ext, NULL, format); + } + + // compatibility version: volume is part of path + static void SplitPath(const wxString& fullpath, + wxString *path, + wxString *name, + wxString *ext, + wxPathFormat format = wxPATH_NATIVE); + + // split a path into volume and pure path part + static void SplitVolume(const wxString& fullpathWithVolume, + wxString *volume, + wxString *path, + wxPathFormat format = wxPATH_NATIVE); + + // Filesize + + // returns the size of the given filename + wxULongLong GetSize() const; + static wxULongLong GetSize(const wxString &file); + + // returns the size in a human readable form + wxString GetHumanReadableSize(const wxString &nullsize = wxGetTranslation(_T("Not available")), + int precision = 1) const; + static wxString GetHumanReadableSize(const wxULongLong &sz, + const wxString &nullsize = wxGetTranslation(_T("Not available")), + int precision = 1); + + + // deprecated methods, don't use any more + // -------------------------------------- + +#ifndef __DIGITALMARS__ + wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const + { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } +#endif + wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const + { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } + +private: + // check whether this dir is valid for Append/Prepend/InsertDir() + static bool IsValidDirComponent(const wxString& dir); + + // the drive/volume/device specification (always empty for Unix) + wxString m_volume; + + // the path components of the file + wxArrayString m_dirs; + + // the file name and extension (empty for directories) + wxString m_name, + m_ext; + + // when m_dirs is empty it may mean either that we have no path at all or + // that our path is '/', i.e. the root directory + // + // we use m_relative to distinguish between these two cases, it will be + // true in the former and false in the latter + // + // NB: the path is not absolute just because m_relative is false, it still + // needs the drive (i.e. volume) in some formats (Windows) + bool m_relative; + + // when m_ext is empty, it may be because we don't have any extension or + // because we have an empty extension + // + // the difference is important as file with name "foo" and without + // extension has full name "foo" while with empty extension it is "foo." + bool m_hasExt; +}; + +#endif // _WX_FILENAME_H_ + diff --git a/Externals/wxWidgets/include/wx/filepicker.h b/Externals/wxWidgets/include/wx/filepicker.h index ce08f8569a..aad2a4f652 100644 --- a/Externals/wxWidgets/include/wx/filepicker.h +++ b/Externals/wxWidgets/include/wx/filepicker.h @@ -1,398 +1,398 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filepicker.h -// Purpose: wxFilePickerCtrl, wxDirPickerCtrl base header -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepicker.h 49804 2007-11-10 01:09:42Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDIRPICKER_H_BASE_ -#define _WX_FILEDIRPICKER_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -#include "wx/pickerbase.h" - -class WXDLLIMPEXP_FWD_CORE wxDialog; -class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent; - -extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetLabel[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerCtrlNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; - -extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetLabel[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerCtrlNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; - - -// ---------------------------------------------------------------------------- -// wxFileDirPickerWidgetBase: a generic abstract interface which must be -// implemented by controls used by wxFileDirPickerCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileDirPickerWidgetBase -{ -public: - wxFileDirPickerWidgetBase() { } - virtual ~wxFileDirPickerWidgetBase() { } - - wxString GetPath() const { return m_path; } - virtual void SetPath(const wxString &str) { m_path=str; } - - // returns the picker widget cast to wxControl - virtual wxControl *AsControl() = 0; - -protected: - virtual void UpdateDialogPath(wxDialog *) = 0; - virtual void UpdatePathFromDialog(wxDialog *) = 0; - - wxString m_path; -}; - -// Styles which must be supported by all controls implementing wxFileDirPickerWidgetBase -// NB: these styles must be defined to carefully-chosen values to -// avoid conflicts with wxButton's styles - -#define wxFLP_OPEN 0x0400 -#define wxFLP_SAVE 0x0800 -#define wxFLP_OVERWRITE_PROMPT 0x1000 -#define wxFLP_FILE_MUST_EXIST 0x2000 -#define wxFLP_CHANGE_DIR 0x4000 - -// NOTE: wxMULTIPLE is not supported ! - - -#define wxDIRP_DIR_MUST_EXIST 0x0008 -#define wxDIRP_CHANGE_DIR 0x0010 - - -// map platform-dependent controls which implement the wxFileDirPickerWidgetBase -// under the name "wxFilePickerWidget" and "wxDirPickerWidget". -// NOTE: wxFileDirPickerCtrlBase will allocate a wx{File|Dir}PickerWidget and this -// requires that all classes being mapped as wx{File|Dir}PickerWidget have the -// same prototype for the contructor... -// since GTK >= 2.6, there is GtkFileButton -#if defined(__WXGTK26__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/filepicker.h" - #define wxFilePickerWidget wxFileButton - #define wxDirPickerWidget wxDirButton -#else - #include "wx/generic/filepickerg.h" - #define wxFilePickerWidget wxGenericFileButton - #define wxDirPickerWidget wxGenericDirButton -#endif - - - -// ---------------------------------------------------------------------------- -// wxFileDirPickerCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase -{ -public: - wxFileDirPickerCtrlBase() : m_bIgnoreNextTextCtrlUpdate(false) {} - -protected: - // NB: no default values since this function will never be used - // directly by the user and derived classes wouldn't use them - bool CreateBase(wxWindow *parent, - wxWindowID id, - const wxString& path, - const wxString &message, - const wxString &wildcard, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - -public: // public API - - wxString GetPath() const; - void SetPath(const wxString &str); - -public: // internal functions - - void UpdatePickerFromTextCtrl(); - void UpdateTextCtrlFromPicker(); - - // event handler for our picker - void OnFileDirChange(wxFileDirPickerEvent &); - - // Returns TRUE if the current path is a valid one - // (i.e. a valid file for a wxFilePickerWidget or a valid - // folder for a wxDirPickerWidget). - virtual bool CheckPath(const wxString &str) const = 0; - - // TRUE if any textctrl change should update the current working directory - virtual bool IsCwdToUpdate() const = 0; - - // Returns the event type sent by this picker - virtual wxEventType GetEventType() const = 0; - - // Returns the filtered value currently placed in the text control (if present). - virtual wxString GetTextCtrlValue() const = 0; - -protected: - // creates the picker control - virtual - wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, - const wxString& path, - const wxString& message, - const wxString& wildcard) = 0; - -protected: - - // true if the next UpdateTextCtrl() call is to ignore - bool m_bIgnoreNextTextCtrlUpdate; - - // m_picker object as wxFileDirPickerWidgetBase interface - wxFileDirPickerWidgetBase *m_pickerIface; -}; - -#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - - -#if wxUSE_FILEPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxFilePickerCtrl: platform-independent class which embeds the -// platform-dependent wxFilePickerWidget and, if wxFLP_USE_TEXTCTRL style is -// used, a textctrl next to it. -// ---------------------------------------------------------------------------- - -#define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) - -#ifdef __WXGTK__ - // GTK apps usually don't have a textctrl next to the picker - #define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) -#else - #define wxFLP_DEFAULT_STYLE (wxFLP_USE_TEXTCTRL|wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) -#endif - -class WXDLLIMPEXP_CORE wxFilePickerCtrl : public wxFileDirPickerCtrlBase -{ -public: - wxFilePickerCtrl() {} - - wxFilePickerCtrl(wxWindow *parent, - wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxFileSelectorPromptStr, - const wxString& wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFLP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerCtrlNameStr) - { - Create(parent, id, path, message, wildcard, pos, size, style, - validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxFileSelectorPromptStr, - const wxString& wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFLP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerCtrlNameStr) - { - return wxFileDirPickerCtrlBase::CreateBase(parent, id, path, - message, wildcard, - pos, size, style, - validator, name); - } - - -public: // overrides - - // return true if the given path is valid for this control - bool CheckPath(const wxString& path) const; - - // return the text control value in canonical form - wxString GetTextCtrlValue() const; - - bool IsCwdToUpdate() const - { return HasFlag(wxFLP_CHANGE_DIR); } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_FILEPICKER_CHANGED; } - -protected: - wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, - const wxString& path, - const wxString& message, - const wxString& wildcard) - { - return new wxFilePickerWidget(parent, wxID_ANY, - wxFilePickerWidgetLabel, - path, message, wildcard, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle(GetWindowStyle())); - } - - // extracts the style for our picker from wxFileDirPickerCtrlBase's style - long GetPickerStyle(long style) const - { - return (style & (wxFLP_OPEN|wxFLP_SAVE|wxFLP_OVERWRITE_PROMPT| - wxFLP_FILE_MUST_EXIST|wxFLP_CHANGE_DIR)); - } - -private: - DECLARE_DYNAMIC_CLASS(wxFilePickerCtrl) -}; - -#endif // wxUSE_FILEPICKERCTRL - - -#if wxUSE_DIRPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxDirPickerCtrl: platform-independent class which embeds the -// platform-dependent wxDirPickerWidget and eventually a textctrl -// (see wxDIRP_USE_TEXTCTRL) next to it. -// ---------------------------------------------------------------------------- - -#define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) - -#ifdef __WXGTK__ - // GTK apps usually don't have a textctrl next to the picker - #define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST) -#else - #define wxDIRP_DEFAULT_STYLE (wxDIRP_USE_TEXTCTRL|wxDIRP_DIR_MUST_EXIST) -#endif - -class WXDLLIMPEXP_CORE wxDirPickerCtrl : public wxFileDirPickerCtrlBase -{ -public: - wxDirPickerCtrl() {} - - wxDirPickerCtrl(wxWindow *parent, wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr) - { - Create(parent, id, path, message, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& path = wxEmptyString, - const wxString& message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerCtrlNameStr) - { - return wxFileDirPickerCtrlBase::CreateBase - ( - parent, id, path, message, wxEmptyString, - pos, size, style, validator, name - ); - } - - -public: // overrides - - bool CheckPath(const wxString &path) const; - - wxString GetTextCtrlValue() const; - - bool IsCwdToUpdate() const - { return HasFlag(wxDIRP_CHANGE_DIR); } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_DIRPICKER_CHANGED; } - -protected: - wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, - const wxString& path, - const wxString& message, - const wxString& WXUNUSED(wildcard)) - { - return new wxDirPickerWidget(parent, wxID_ANY, wxDirPickerWidgetLabel, - path, message, - wxDefaultPosition, wxDefaultSize, - GetPickerStyle(GetWindowStyle())); - } - - // extracts the style for our picker from wxFileDirPickerCtrlBase's style - long GetPickerStyle(long style) const - { return (style & (wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR)); } - -private: - DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl) -}; - -#endif // wxUSE_DIRPICKERCTRL - - -#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -// ---------------------------------------------------------------------------- -// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, 1102) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, 1103) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent -{ -public: - wxFileDirPickerEvent() {} - wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) - : wxCommandEvent(type, id), - m_path(path) - { - SetEventObject(generator); - } - - wxString GetPath() const { return m_path; } - void SetPath(const wxString &p) { m_path = p; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); } - -private: - wxString m_path; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); - -#define wxFileDirPickerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFileDirPickerEventFunction, &func) - -#define EVT_FILEPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) -#define EVT_DIRPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) - - -#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL - -#endif // _WX_FILEDIRPICKER_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filepicker.h +// Purpose: wxFilePickerCtrl, wxDirPickerCtrl base header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// RCS-ID: $Id: filepicker.h 49804 2007-11-10 01:09:42Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDIRPICKER_H_BASE_ +#define _WX_FILEDIRPICKER_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + +#include "wx/pickerbase.h" + +class WXDLLIMPEXP_FWD_CORE wxDialog; +class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent; + +extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetLabel[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFilePickerCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[]; + +extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetLabel[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirPickerCtrlNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; + + +// ---------------------------------------------------------------------------- +// wxFileDirPickerWidgetBase: a generic abstract interface which must be +// implemented by controls used by wxFileDirPickerCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDirPickerWidgetBase +{ +public: + wxFileDirPickerWidgetBase() { } + virtual ~wxFileDirPickerWidgetBase() { } + + wxString GetPath() const { return m_path; } + virtual void SetPath(const wxString &str) { m_path=str; } + + // returns the picker widget cast to wxControl + virtual wxControl *AsControl() = 0; + +protected: + virtual void UpdateDialogPath(wxDialog *) = 0; + virtual void UpdatePathFromDialog(wxDialog *) = 0; + + wxString m_path; +}; + +// Styles which must be supported by all controls implementing wxFileDirPickerWidgetBase +// NB: these styles must be defined to carefully-chosen values to +// avoid conflicts with wxButton's styles + +#define wxFLP_OPEN 0x0400 +#define wxFLP_SAVE 0x0800 +#define wxFLP_OVERWRITE_PROMPT 0x1000 +#define wxFLP_FILE_MUST_EXIST 0x2000 +#define wxFLP_CHANGE_DIR 0x4000 + +// NOTE: wxMULTIPLE is not supported ! + + +#define wxDIRP_DIR_MUST_EXIST 0x0008 +#define wxDIRP_CHANGE_DIR 0x0010 + + +// map platform-dependent controls which implement the wxFileDirPickerWidgetBase +// under the name "wxFilePickerWidget" and "wxDirPickerWidget". +// NOTE: wxFileDirPickerCtrlBase will allocate a wx{File|Dir}PickerWidget and this +// requires that all classes being mapped as wx{File|Dir}PickerWidget have the +// same prototype for the contructor... +// since GTK >= 2.6, there is GtkFileButton +#if defined(__WXGTK26__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/filepicker.h" + #define wxFilePickerWidget wxFileButton + #define wxDirPickerWidget wxDirButton +#else + #include "wx/generic/filepickerg.h" + #define wxFilePickerWidget wxGenericFileButton + #define wxDirPickerWidget wxGenericDirButton +#endif + + + +// ---------------------------------------------------------------------------- +// wxFileDirPickerCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase +{ +public: + wxFileDirPickerCtrlBase() : m_bIgnoreNextTextCtrlUpdate(false) {} + +protected: + // NB: no default values since this function will never be used + // directly by the user and derived classes wouldn't use them + bool CreateBase(wxWindow *parent, + wxWindowID id, + const wxString& path, + const wxString &message, + const wxString &wildcard, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + +public: // public API + + wxString GetPath() const; + void SetPath(const wxString &str); + +public: // internal functions + + void UpdatePickerFromTextCtrl(); + void UpdateTextCtrlFromPicker(); + + // event handler for our picker + void OnFileDirChange(wxFileDirPickerEvent &); + + // Returns TRUE if the current path is a valid one + // (i.e. a valid file for a wxFilePickerWidget or a valid + // folder for a wxDirPickerWidget). + virtual bool CheckPath(const wxString &str) const = 0; + + // TRUE if any textctrl change should update the current working directory + virtual bool IsCwdToUpdate() const = 0; + + // Returns the event type sent by this picker + virtual wxEventType GetEventType() const = 0; + + // Returns the filtered value currently placed in the text control (if present). + virtual wxString GetTextCtrlValue() const = 0; + +protected: + // creates the picker control + virtual + wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, + const wxString& path, + const wxString& message, + const wxString& wildcard) = 0; + +protected: + + // true if the next UpdateTextCtrl() call is to ignore + bool m_bIgnoreNextTextCtrlUpdate; + + // m_picker object as wxFileDirPickerWidgetBase interface + wxFileDirPickerWidgetBase *m_pickerIface; +}; + +#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + + +#if wxUSE_FILEPICKERCTRL + +// ---------------------------------------------------------------------------- +// wxFilePickerCtrl: platform-independent class which embeds the +// platform-dependent wxFilePickerWidget and, if wxFLP_USE_TEXTCTRL style is +// used, a textctrl next to it. +// ---------------------------------------------------------------------------- + +#define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) + +#ifdef __WXGTK__ + // GTK apps usually don't have a textctrl next to the picker + #define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) +#else + #define wxFLP_DEFAULT_STYLE (wxFLP_USE_TEXTCTRL|wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) +#endif + +class WXDLLIMPEXP_CORE wxFilePickerCtrl : public wxFileDirPickerCtrlBase +{ +public: + wxFilePickerCtrl() {} + + wxFilePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxFileSelectorPromptStr, + const wxString& wildcard = wxFileSelectorDefaultWildcardStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFLP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFilePickerCtrlNameStr) + { + Create(parent, id, path, message, wildcard, pos, size, style, + validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxFileSelectorPromptStr, + const wxString& wildcard = wxFileSelectorDefaultWildcardStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFLP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFilePickerCtrlNameStr) + { + return wxFileDirPickerCtrlBase::CreateBase(parent, id, path, + message, wildcard, + pos, size, style, + validator, name); + } + + +public: // overrides + + // return true if the given path is valid for this control + bool CheckPath(const wxString& path) const; + + // return the text control value in canonical form + wxString GetTextCtrlValue() const; + + bool IsCwdToUpdate() const + { return HasFlag(wxFLP_CHANGE_DIR); } + + wxEventType GetEventType() const + { return wxEVT_COMMAND_FILEPICKER_CHANGED; } + +protected: + wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, + const wxString& path, + const wxString& message, + const wxString& wildcard) + { + return new wxFilePickerWidget(parent, wxID_ANY, + wxFilePickerWidgetLabel, + path, message, wildcard, + wxDefaultPosition, wxDefaultSize, + GetPickerStyle(GetWindowStyle())); + } + + // extracts the style for our picker from wxFileDirPickerCtrlBase's style + long GetPickerStyle(long style) const + { + return (style & (wxFLP_OPEN|wxFLP_SAVE|wxFLP_OVERWRITE_PROMPT| + wxFLP_FILE_MUST_EXIST|wxFLP_CHANGE_DIR)); + } + +private: + DECLARE_DYNAMIC_CLASS(wxFilePickerCtrl) +}; + +#endif // wxUSE_FILEPICKERCTRL + + +#if wxUSE_DIRPICKERCTRL + +// ---------------------------------------------------------------------------- +// wxDirPickerCtrl: platform-independent class which embeds the +// platform-dependent wxDirPickerWidget and eventually a textctrl +// (see wxDIRP_USE_TEXTCTRL) next to it. +// ---------------------------------------------------------------------------- + +#define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) + +#ifdef __WXGTK__ + // GTK apps usually don't have a textctrl next to the picker + #define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST) +#else + #define wxDIRP_DEFAULT_STYLE (wxDIRP_USE_TEXTCTRL|wxDIRP_DIR_MUST_EXIST) +#endif + +class WXDLLIMPEXP_CORE wxDirPickerCtrl : public wxFileDirPickerCtrlBase +{ +public: + wxDirPickerCtrl() {} + + wxDirPickerCtrl(wxWindow *parent, wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxDirSelectorPromptStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDirPickerCtrlNameStr) + { + Create(parent, id, path, message, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxDirSelectorPromptStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDirPickerCtrlNameStr) + { + return wxFileDirPickerCtrlBase::CreateBase + ( + parent, id, path, message, wxEmptyString, + pos, size, style, validator, name + ); + } + + +public: // overrides + + bool CheckPath(const wxString &path) const; + + wxString GetTextCtrlValue() const; + + bool IsCwdToUpdate() const + { return HasFlag(wxDIRP_CHANGE_DIR); } + + wxEventType GetEventType() const + { return wxEVT_COMMAND_DIRPICKER_CHANGED; } + +protected: + wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, + const wxString& path, + const wxString& message, + const wxString& WXUNUSED(wildcard)) + { + return new wxDirPickerWidget(parent, wxID_ANY, wxDirPickerWidgetLabel, + path, message, + wxDefaultPosition, wxDefaultSize, + GetPickerStyle(GetWindowStyle())); + } + + // extracts the style for our picker from wxFileDirPickerCtrlBase's style + long GetPickerStyle(long style) const + { return (style & (wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR)); } + +private: + DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl) +}; + +#endif // wxUSE_DIRPICKERCTRL + + +#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + +// ---------------------------------------------------------------------------- +// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, 1102) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, 1103) +END_DECLARE_EVENT_TYPES() + +class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent +{ +public: + wxFileDirPickerEvent() {} + wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) + : wxCommandEvent(type, id), + m_path(path) + { + SetEventObject(generator); + } + + wxString GetPath() const { return m_path; } + void SetPath(const wxString &p) { m_path = p; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); } + +private: + wxString m_path; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent) +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); + +#define wxFileDirPickerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFileDirPickerEventFunction, &func) + +#define EVT_FILEPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) +#define EVT_DIRPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) + + +#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + +#endif // _WX_FILEDIRPICKER_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/filesys.h b/Externals/wxWidgets/include/wx/filesys.h index 3d40f11048..7d1ad27e82 100644 --- a/Externals/wxWidgets/include/wx/filesys.h +++ b/Externals/wxWidgets/include/wx/filesys.h @@ -1,300 +1,300 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/filesys.h -// Purpose: class for opening files - virtual file system -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: filesys.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __FILESYS_H__ -#define __FILESYS_H__ - -#include "wx/defs.h" - -#if !wxUSE_STREAMS -#error You cannot compile virtual file systems without wxUSE_STREAMS -#endif - -#if wxUSE_HTML && !wxUSE_FILESYSTEM -#error You cannot compile wxHTML without virtual file systems -#endif - -#if wxUSE_FILESYSTEM - -#include "wx/stream.h" -#include "wx/datetime.h" -#include "wx/filename.h" -#include "wx/hashmap.h" - -class WXDLLIMPEXP_FWD_BASE wxFSFile; -class WXDLLIMPEXP_FWD_BASE wxFileSystemHandler; -class WXDLLIMPEXP_FWD_BASE wxFileSystem; - -//-------------------------------------------------------------------------------- -// wxFSFile -// This class is a file opened using wxFileSystem. It consists of -// input stream, location, mime type & optional anchor -// (in 'index.htm#chapter2', 'chapter2' is anchor) -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFSFile : public wxObject -{ -public: - wxFSFile(wxInputStream *stream, const wxString& loc, - const wxString& mimetype, const wxString& anchor -#if wxUSE_DATETIME - , wxDateTime modif -#endif // wxUSE_DATETIME - ) - { - m_Stream = stream; - m_Location = loc; - m_MimeType = mimetype; m_MimeType.MakeLower(); - m_Anchor = anchor; -#if wxUSE_DATETIME - m_Modif = modif; -#endif // wxUSE_DATETIME - } - - virtual ~wxFSFile() { delete m_Stream; } - - // returns stream. This doesn't give away ownership of the stream object. - wxInputStream *GetStream() const { return m_Stream; } - - // gives away the ownership of the current stream. - wxInputStream *DetachStream() - { - wxInputStream *stream = m_Stream; - m_Stream = NULL; - return stream; - } - - // deletes the current stream and takes ownership of another. - void SetStream(wxInputStream *stream) - { - delete m_Stream; - m_Stream = stream; - } - - // returns file's mime type - const wxString& GetMimeType() const { return m_MimeType; } - - // returns the original location (aka filename) of the file - const wxString& GetLocation() const { return m_Location; } - - const wxString& GetAnchor() const { return m_Anchor; } - -#if wxUSE_DATETIME - wxDateTime GetModificationTime() const { return m_Modif; } -#endif // wxUSE_DATETIME - -private: - wxInputStream *m_Stream; - wxString m_Location; - wxString m_MimeType; - wxString m_Anchor; -#if wxUSE_DATETIME - wxDateTime m_Modif; -#endif // wxUSE_DATETIME - - DECLARE_ABSTRACT_CLASS(wxFSFile) - DECLARE_NO_COPY_CLASS(wxFSFile) -}; - - - - - -//-------------------------------------------------------------------------------- -// wxFileSystemHandler -// This class is FS handler for wxFileSystem. It provides -// interface to access certain -// kinds of files (HTPP, FTP, local, tar.gz etc..) -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject -{ -public: - wxFileSystemHandler() : wxObject() {} - - // returns true if this handler is able to open given location - virtual bool CanOpen(const wxString& location) = 0; - - // opens given file and returns pointer to input stream. - // Returns NULL if opening failed. - // The location is always absolute path. - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0; - - // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting - // the query to directories or wxFILE for files only or 0 for either. - // Returns filename or empty string if no more matching file exists - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - -protected: - // returns protocol ("file", "http", "tar" etc.) The last (most right) - // protocol is used: - // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"} - wxString GetProtocol(const wxString& location) const; - - // returns left part of address: - // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"} - wxString GetLeftLocation(const wxString& location) const; - - // returns anchor part of address: - // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"} - // NOTE: anchor is NOT a part of GetLeftLocation()'s return value - wxString GetAnchor(const wxString& location) const; - - // returns right part of address: - // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"} - wxString GetRightLocation(const wxString& location) const; - - // Returns MIME type of the file - w/o need to open it - // (default behaviour is that it returns type based on extension) - wxString GetMimeTypeFromExt(const wxString& location); - - DECLARE_ABSTRACT_CLASS(wxFileSystemHandler) -}; - - - - -//-------------------------------------------------------------------------------- -// wxFileSystem -// This class provides simple interface for opening various -// kinds of files (HTPP, FTP, local, tar.gz etc..) -//-------------------------------------------------------------------------------- - -// Open Bit Flags -enum { - wxFS_READ = 1, // Open for reading - wxFS_SEEKABLE = 4 // Returned stream will be seekable -}; - -WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxFileSystem : public wxObject -{ -public: - wxFileSystem() : wxObject() { m_FindFileHandler = NULL;} - virtual ~wxFileSystem(); - - // sets the current location. Every call to OpenFile is - // relative to this location. - // NOTE !! - // unless is_dir = true 'location' is *not* the directory but - // file contained in this directory - // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/") - void ChangePathTo(const wxString& location, bool is_dir = false); - - wxString GetPath() const {return m_Path;} - - // opens given file and returns pointer to input stream. - // Returns NULL if opening failed. - // It first tries to open the file in relative scope - // (based on ChangePathTo()'s value) and then as an absolute - // path. - wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ); - - // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting - // the query to directories or wxFILE for files only or 0 for either. - // Returns filename or empty string if no more matching file exists - wxString FindFirst(const wxString& spec, int flags = 0); - wxString FindNext(); - - // find a file in a list of directories, returns false if not found - bool FindFileInPath(wxString *pStr, const wxChar *path, const wxChar *file); - - // Adds FS handler. - // In fact, this class is only front-end to the FS handlers :-) - static void AddHandler(wxFileSystemHandler *handler); - - // Removes FS handler - static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler); - - // Returns true if there is a handler which can open the given location. - static bool HasHandlerForPath(const wxString& location); - - // remove all items from the m_Handlers list - static void CleanUpHandlers(); - - // Returns the native path for a file URL - static wxFileName URLToFileName(const wxString& url); - - // Returns the file URL for a native path - static wxString FileNameToURL(const wxFileName& filename); - - -protected: - wxFileSystemHandler *MakeLocal(wxFileSystemHandler *h); - - wxString m_Path; - // the path (location) we are currently in - // this is path, not file! - // (so if you opened test/demo.htm, it is - // "test/", not "test/demo.htm") - wxString m_LastName; - // name of last opened file (full path) - static wxList m_Handlers; - // list of FS handlers - wxFileSystemHandler *m_FindFileHandler; - // handler that succeed in FindFirst query - wxFSHandlerHash m_LocalHandlers; - // Handlers local to this instance - - DECLARE_DYNAMIC_CLASS(wxFileSystem) - DECLARE_NO_COPY_CLASS(wxFileSystem) -}; - - -/* - -'location' syntax: - -To determine FS type, we're using standard KDE notation: -file:/absolute/path/file.htm -file:relative_path/xxxxx.html -/some/path/x.file ('file:' is default) -http://www.gnome.org -file:subdir/archive.tar.gz#tar:/README.txt - -special characters : - ':' - FS identificator is before this char - '#' - separator. It can be either HTML anchor ("index.html#news") - (in case there is no ':' in the string to the right from it) - or FS separator - (example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h" - this would access tgz archive stored on web) - '/' - directory (path) separator. It is used to determine upper-level path. - HEY! Don't use \ even if you're on Windows! - -*/ - - -class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler -{ -public: - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - - // wxLocalFSHandler will prefix all filenames with 'root' before accessing - // files on disk. This effectively makes 'root' the top-level directory - // and prevents access to files outside this directory. - // (This is similar to Unix command 'chroot'.) - static void Chroot(const wxString& root) { ms_root = root; } - -protected: - static wxString ms_root; -}; - - - -#endif - // wxUSE_FILESYSTEM - -#endif - // __FILESYS_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filesys.h +// Purpose: class for opening files - virtual file system +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// RCS-ID: $Id: filesys.h 53135 2008-04-12 02:31:04Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __FILESYS_H__ +#define __FILESYS_H__ + +#include "wx/defs.h" + +#if !wxUSE_STREAMS +#error You cannot compile virtual file systems without wxUSE_STREAMS +#endif + +#if wxUSE_HTML && !wxUSE_FILESYSTEM +#error You cannot compile wxHTML without virtual file systems +#endif + +#if wxUSE_FILESYSTEM + +#include "wx/stream.h" +#include "wx/datetime.h" +#include "wx/filename.h" +#include "wx/hashmap.h" + +class WXDLLIMPEXP_FWD_BASE wxFSFile; +class WXDLLIMPEXP_FWD_BASE wxFileSystemHandler; +class WXDLLIMPEXP_FWD_BASE wxFileSystem; + +//-------------------------------------------------------------------------------- +// wxFSFile +// This class is a file opened using wxFileSystem. It consists of +// input stream, location, mime type & optional anchor +// (in 'index.htm#chapter2', 'chapter2' is anchor) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFSFile : public wxObject +{ +public: + wxFSFile(wxInputStream *stream, const wxString& loc, + const wxString& mimetype, const wxString& anchor +#if wxUSE_DATETIME + , wxDateTime modif +#endif // wxUSE_DATETIME + ) + { + m_Stream = stream; + m_Location = loc; + m_MimeType = mimetype; m_MimeType.MakeLower(); + m_Anchor = anchor; +#if wxUSE_DATETIME + m_Modif = modif; +#endif // wxUSE_DATETIME + } + + virtual ~wxFSFile() { delete m_Stream; } + + // returns stream. This doesn't give away ownership of the stream object. + wxInputStream *GetStream() const { return m_Stream; } + + // gives away the ownership of the current stream. + wxInputStream *DetachStream() + { + wxInputStream *stream = m_Stream; + m_Stream = NULL; + return stream; + } + + // deletes the current stream and takes ownership of another. + void SetStream(wxInputStream *stream) + { + delete m_Stream; + m_Stream = stream; + } + + // returns file's mime type + const wxString& GetMimeType() const { return m_MimeType; } + + // returns the original location (aka filename) of the file + const wxString& GetLocation() const { return m_Location; } + + const wxString& GetAnchor() const { return m_Anchor; } + +#if wxUSE_DATETIME + wxDateTime GetModificationTime() const { return m_Modif; } +#endif // wxUSE_DATETIME + +private: + wxInputStream *m_Stream; + wxString m_Location; + wxString m_MimeType; + wxString m_Anchor; +#if wxUSE_DATETIME + wxDateTime m_Modif; +#endif // wxUSE_DATETIME + + DECLARE_ABSTRACT_CLASS(wxFSFile) + DECLARE_NO_COPY_CLASS(wxFSFile) +}; + + + + + +//-------------------------------------------------------------------------------- +// wxFileSystemHandler +// This class is FS handler for wxFileSystem. It provides +// interface to access certain +// kinds of files (HTPP, FTP, local, tar.gz etc..) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject +{ +public: + wxFileSystemHandler() : wxObject() {} + + // returns true if this handler is able to open given location + virtual bool CanOpen(const wxString& location) = 0; + + // opens given file and returns pointer to input stream. + // Returns NULL if opening failed. + // The location is always absolute path. + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0; + + // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting + // the query to directories or wxFILE for files only or 0 for either. + // Returns filename or empty string if no more matching file exists + virtual wxString FindFirst(const wxString& spec, int flags = 0); + virtual wxString FindNext(); + +protected: + // returns protocol ("file", "http", "tar" etc.) The last (most right) + // protocol is used: + // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"} + wxString GetProtocol(const wxString& location) const; + + // returns left part of address: + // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"} + wxString GetLeftLocation(const wxString& location) const; + + // returns anchor part of address: + // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"} + // NOTE: anchor is NOT a part of GetLeftLocation()'s return value + wxString GetAnchor(const wxString& location) const; + + // returns right part of address: + // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"} + wxString GetRightLocation(const wxString& location) const; + + // Returns MIME type of the file - w/o need to open it + // (default behaviour is that it returns type based on extension) + wxString GetMimeTypeFromExt(const wxString& location); + + DECLARE_ABSTRACT_CLASS(wxFileSystemHandler) +}; + + + + +//-------------------------------------------------------------------------------- +// wxFileSystem +// This class provides simple interface for opening various +// kinds of files (HTPP, FTP, local, tar.gz etc..) +//-------------------------------------------------------------------------------- + +// Open Bit Flags +enum { + wxFS_READ = 1, // Open for reading + wxFS_SEEKABLE = 4 // Returned stream will be seekable +}; + +WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxFileSystem : public wxObject +{ +public: + wxFileSystem() : wxObject() { m_FindFileHandler = NULL;} + virtual ~wxFileSystem(); + + // sets the current location. Every call to OpenFile is + // relative to this location. + // NOTE !! + // unless is_dir = true 'location' is *not* the directory but + // file contained in this directory + // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/") + void ChangePathTo(const wxString& location, bool is_dir = false); + + wxString GetPath() const {return m_Path;} + + // opens given file and returns pointer to input stream. + // Returns NULL if opening failed. + // It first tries to open the file in relative scope + // (based on ChangePathTo()'s value) and then as an absolute + // path. + wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ); + + // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting + // the query to directories or wxFILE for files only or 0 for either. + // Returns filename or empty string if no more matching file exists + wxString FindFirst(const wxString& spec, int flags = 0); + wxString FindNext(); + + // find a file in a list of directories, returns false if not found + bool FindFileInPath(wxString *pStr, const wxChar *path, const wxChar *file); + + // Adds FS handler. + // In fact, this class is only front-end to the FS handlers :-) + static void AddHandler(wxFileSystemHandler *handler); + + // Removes FS handler + static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler); + + // Returns true if there is a handler which can open the given location. + static bool HasHandlerForPath(const wxString& location); + + // remove all items from the m_Handlers list + static void CleanUpHandlers(); + + // Returns the native path for a file URL + static wxFileName URLToFileName(const wxString& url); + + // Returns the file URL for a native path + static wxString FileNameToURL(const wxFileName& filename); + + +protected: + wxFileSystemHandler *MakeLocal(wxFileSystemHandler *h); + + wxString m_Path; + // the path (location) we are currently in + // this is path, not file! + // (so if you opened test/demo.htm, it is + // "test/", not "test/demo.htm") + wxString m_LastName; + // name of last opened file (full path) + static wxList m_Handlers; + // list of FS handlers + wxFileSystemHandler *m_FindFileHandler; + // handler that succeed in FindFirst query + wxFSHandlerHash m_LocalHandlers; + // Handlers local to this instance + + DECLARE_DYNAMIC_CLASS(wxFileSystem) + DECLARE_NO_COPY_CLASS(wxFileSystem) +}; + + +/* + +'location' syntax: + +To determine FS type, we're using standard KDE notation: +file:/absolute/path/file.htm +file:relative_path/xxxxx.html +/some/path/x.file ('file:' is default) +http://www.gnome.org +file:subdir/archive.tar.gz#tar:/README.txt + +special characters : + ':' - FS identificator is before this char + '#' - separator. It can be either HTML anchor ("index.html#news") + (in case there is no ':' in the string to the right from it) + or FS separator + (example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h" + this would access tgz archive stored on web) + '/' - directory (path) separator. It is used to determine upper-level path. + HEY! Don't use \ even if you're on Windows! + +*/ + + +class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler +{ +public: + virtual bool CanOpen(const wxString& location); + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + virtual wxString FindFirst(const wxString& spec, int flags = 0); + virtual wxString FindNext(); + + // wxLocalFSHandler will prefix all filenames with 'root' before accessing + // files on disk. This effectively makes 'root' the top-level directory + // and prevents access to files outside this directory. + // (This is similar to Unix command 'chroot'.) + static void Chroot(const wxString& root) { ms_root = root; } + +protected: + static wxString ms_root; +}; + + + +#endif + // wxUSE_FILESYSTEM + +#endif + // __FILESYS_H__ diff --git a/Externals/wxWidgets/include/wx/flags.h b/Externals/wxWidgets/include/wx/flags.h index 803205fdf1..a266e4dde3 100644 --- a/Externals/wxWidgets/include/wx/flags.h +++ b/Externals/wxWidgets/include/wx/flags.h @@ -1,165 +1,165 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/flags.h -// Purpose: a bitset suited for replacing the current style flags -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: flags.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETH__ -#define _WX_SETH__ - -// wxBitset should be applied to an enum, then this can be used like -// bitwise operators but keeps the type safety and information, the -// enums must be in a sequence , their value determines the bit position -// that they represent -// The api is made as close as possible to - -template class wxBitset -{ - friend class wxEnumData ; -public: - // creates a wxBitset<> object with all flags initialized to 0 - wxBitset() { m_data = 0; } - - // created a wxBitset<> object initialized according to the bits of the - // integral value val - wxBitset(unsigned long val) { m_data = val ; } - - // copies the content in the new wxBitset<> object from another one - wxBitset(const wxBitset &src) { m_data = src.m_data; } - - // creates a wxBitset<> object that has the specific flag set - wxBitset(const T el) { m_data |= 1 << el; } - - // returns the integral value that the bits of this object represent - unsigned long to_ulong() const { return m_data ; } - - // assignment - wxBitset &operator =(const wxBitset &rhs) - { - m_data = rhs.m_data; - return *this; - } - - // bitwise or operator, sets all bits that are in rhs and leaves - // the rest unchanged - wxBitset &operator |=(const wxBitset &rhs) - { - m_data |= rhs.m_data; - return *this; - } - - // bitwsie exclusive-or operator, toggles the value of all bits - // that are set in bits and leaves all others unchanged - wxBitset &operator ^=(const wxBitset &rhs) // difference - { - m_data ^= rhs.m_data; - return *this; - } - - // bitwise and operator, resets all bits that are not in rhs and leaves - // all others unchanged - wxBitset &operator &=(const wxBitset &rhs) // intersection - { - m_data &= rhs.m_data; - return *this; - } - - // bitwise or operator, returns a new bitset that has all bits set that set are in - // bitset2 or in this bitset - wxBitset operator |(const wxBitset &bitset2) const // union - { - wxBitset s; - s.m_data = m_data | bitset2.m_data; - return s; - } - - // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in - // bitset2 or in this bitset but not in both - wxBitset operator ^(const wxBitset &bitset2) const // difference - { - wxBitset s; - s.m_data = m_data ^ bitset2.m_data; - return s; - } - - // bitwise and operator, returns a new bitset that has all bits set that are set both in - // bitset2 and in this bitset - wxBitset operator &(const wxBitset &bitset2) const // intersection - { - wxBitset s; - s.m_data = m_data & bitset2.m_data; - return s; - } - - // sets appropriate the bit to true - wxBitset& set(const T el) //Add element - { - m_data |= 1 << el; - return *this; - } - - // clears the appropriate flag to false - wxBitset& reset(const T el) //remove element - { - m_data &= ~(1 << el); - return *this; - } - - // clear all flags - wxBitset& reset() - { - m_data = 0; - return *this; - } - - // true if this flag is set - bool test(const T el) const - { - return (m_data & (1 << el)) ? true : false; - } - - // true if no flag is set - bool none() const - { - return m_data == 0; - } - - // true if any flag is set - bool any() const - { - return m_data != 0; - } - - // true if both have the same flags - bool operator ==(const wxBitset &rhs) const - { - return m_data == rhs.m_data; - } - - // true if both differ in their flags set - bool operator !=(const wxBitset &rhs) const - { - return !operator==(rhs); - } - - bool operator[] (const T el) const { return test(el) ; } - -private : - unsigned long m_data; -}; - -#define WX_DEFINE_FLAGS( flags ) \ - class WXDLLEXPORT flags \ - {\ - public : \ - flags(long data=0) :m_data(data) {} \ - long m_data ;\ - bool operator ==(const flags &rhs) const { return m_data == rhs.m_data; }\ - } ; - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/flags.h +// Purpose: a bitset suited for replacing the current style flags +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// RCS-ID: $Id: flags.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETH__ +#define _WX_SETH__ + +// wxBitset should be applied to an enum, then this can be used like +// bitwise operators but keeps the type safety and information, the +// enums must be in a sequence , their value determines the bit position +// that they represent +// The api is made as close as possible to + +template class wxBitset +{ + friend class wxEnumData ; +public: + // creates a wxBitset<> object with all flags initialized to 0 + wxBitset() { m_data = 0; } + + // created a wxBitset<> object initialized according to the bits of the + // integral value val + wxBitset(unsigned long val) { m_data = val ; } + + // copies the content in the new wxBitset<> object from another one + wxBitset(const wxBitset &src) { m_data = src.m_data; } + + // creates a wxBitset<> object that has the specific flag set + wxBitset(const T el) { m_data |= 1 << el; } + + // returns the integral value that the bits of this object represent + unsigned long to_ulong() const { return m_data ; } + + // assignment + wxBitset &operator =(const wxBitset &rhs) + { + m_data = rhs.m_data; + return *this; + } + + // bitwise or operator, sets all bits that are in rhs and leaves + // the rest unchanged + wxBitset &operator |=(const wxBitset &rhs) + { + m_data |= rhs.m_data; + return *this; + } + + // bitwsie exclusive-or operator, toggles the value of all bits + // that are set in bits and leaves all others unchanged + wxBitset &operator ^=(const wxBitset &rhs) // difference + { + m_data ^= rhs.m_data; + return *this; + } + + // bitwise and operator, resets all bits that are not in rhs and leaves + // all others unchanged + wxBitset &operator &=(const wxBitset &rhs) // intersection + { + m_data &= rhs.m_data; + return *this; + } + + // bitwise or operator, returns a new bitset that has all bits set that set are in + // bitset2 or in this bitset + wxBitset operator |(const wxBitset &bitset2) const // union + { + wxBitset s; + s.m_data = m_data | bitset2.m_data; + return s; + } + + // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in + // bitset2 or in this bitset but not in both + wxBitset operator ^(const wxBitset &bitset2) const // difference + { + wxBitset s; + s.m_data = m_data ^ bitset2.m_data; + return s; + } + + // bitwise and operator, returns a new bitset that has all bits set that are set both in + // bitset2 and in this bitset + wxBitset operator &(const wxBitset &bitset2) const // intersection + { + wxBitset s; + s.m_data = m_data & bitset2.m_data; + return s; + } + + // sets appropriate the bit to true + wxBitset& set(const T el) //Add element + { + m_data |= 1 << el; + return *this; + } + + // clears the appropriate flag to false + wxBitset& reset(const T el) //remove element + { + m_data &= ~(1 << el); + return *this; + } + + // clear all flags + wxBitset& reset() + { + m_data = 0; + return *this; + } + + // true if this flag is set + bool test(const T el) const + { + return (m_data & (1 << el)) ? true : false; + } + + // true if no flag is set + bool none() const + { + return m_data == 0; + } + + // true if any flag is set + bool any() const + { + return m_data != 0; + } + + // true if both have the same flags + bool operator ==(const wxBitset &rhs) const + { + return m_data == rhs.m_data; + } + + // true if both differ in their flags set + bool operator !=(const wxBitset &rhs) const + { + return !operator==(rhs); + } + + bool operator[] (const T el) const { return test(el) ; } + +private : + unsigned long m_data; +}; + +#define WX_DEFINE_FLAGS( flags ) \ + class WXDLLEXPORT flags \ + {\ + public : \ + flags(long data=0) :m_data(data) {} \ + long m_data ;\ + bool operator ==(const flags &rhs) const { return m_data == rhs.m_data; }\ + } ; + +#endif diff --git a/Externals/wxWidgets/include/wx/fmappriv.h b/Externals/wxWidgets/include/wx/fmappriv.h index 95df28c907..06cf2cdb2c 100644 --- a/Externals/wxWidgets/include/wx/fmappriv.h +++ b/Externals/wxWidgets/include/wx/fmappriv.h @@ -1,74 +1,74 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/fmappriv.h -// Purpose: private wxFontMapper stuff, not to be used by the library users -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 (extracted from common/fontmap.cpp) -// RCS-ID: $Id: fmappriv.h 27454 2004-05-26 10:49:43Z JS $ -// Copyright: (c) 1999-2003 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FMAPPRIV_H_ -#define _WX_FMAPPRIV_H_ - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// a special pseudo encoding which means "don't ask me about this charset -// any more" -- we need it to avoid driving the user crazy with asking him -// time after time about the same charset which he [presumably] doesn't -// have the fonts for -enum { wxFONTENCODING_UNKNOWN = -2 }; - -// the config paths we use -#if wxUSE_CONFIG - -#define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper") -#define FONTMAPPER_CHARSET_PATH wxT("Charsets") -#define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases") - -#endif // wxUSE_CONFIG - -// ---------------------------------------------------------------------------- -// wxFontMapperPathChanger: change the config path during our lifetime -// ---------------------------------------------------------------------------- - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - -class wxFontMapperPathChanger -{ -public: - wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path) - { - m_fontMapper = fontMapper; - m_ok = m_fontMapper->ChangePath(path, &m_pathOld); - } - - bool IsOk() const { return m_ok; } - - ~wxFontMapperPathChanger() - { - if ( IsOk() ) - m_fontMapper->RestorePath(m_pathOld); - } - -private: - // the fontmapper object we're working with - wxFontMapperBase *m_fontMapper; - - // the old path to be restored if m_ok - wxString m_pathOld; - - // have we changed the path successfully? - bool m_ok; - - - DECLARE_NO_COPY_CLASS(wxFontMapperPathChanger) -}; - -#endif // wxUSE_CONFIG - -#endif // _WX_FMAPPRIV_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/fmappriv.h +// Purpose: private wxFontMapper stuff, not to be used by the library users +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.06.2003 (extracted from common/fontmap.cpp) +// RCS-ID: $Id: fmappriv.h 27454 2004-05-26 10:49:43Z JS $ +// Copyright: (c) 1999-2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FMAPPRIV_H_ +#define _WX_FMAPPRIV_H_ + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// a special pseudo encoding which means "don't ask me about this charset +// any more" -- we need it to avoid driving the user crazy with asking him +// time after time about the same charset which he [presumably] doesn't +// have the fonts for +enum { wxFONTENCODING_UNKNOWN = -2 }; + +// the config paths we use +#if wxUSE_CONFIG + +#define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper") +#define FONTMAPPER_CHARSET_PATH wxT("Charsets") +#define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases") + +#endif // wxUSE_CONFIG + +// ---------------------------------------------------------------------------- +// wxFontMapperPathChanger: change the config path during our lifetime +// ---------------------------------------------------------------------------- + +#if wxUSE_CONFIG && wxUSE_FILECONFIG + +class wxFontMapperPathChanger +{ +public: + wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path) + { + m_fontMapper = fontMapper; + m_ok = m_fontMapper->ChangePath(path, &m_pathOld); + } + + bool IsOk() const { return m_ok; } + + ~wxFontMapperPathChanger() + { + if ( IsOk() ) + m_fontMapper->RestorePath(m_pathOld); + } + +private: + // the fontmapper object we're working with + wxFontMapperBase *m_fontMapper; + + // the old path to be restored if m_ok + wxString m_pathOld; + + // have we changed the path successfully? + bool m_ok; + + + DECLARE_NO_COPY_CLASS(wxFontMapperPathChanger) +}; + +#endif // wxUSE_CONFIG + +#endif // _WX_FMAPPRIV_H_ + diff --git a/Externals/wxWidgets/include/wx/font.h b/Externals/wxWidgets/include/wx/font.h index 7512626265..2fd044c990 100644 --- a/Externals/wxWidgets/include/wx/font.h +++ b/Externals/wxWidgets/include/wx/font.h @@ -1,251 +1,251 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/font.h -// Purpose: wxFontBase class: the interface of wxFont -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.09.99 -// RCS-ID: $Id: font.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONT_H_BASE_ -#define _WX_FONT_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" // for wxDEFAULT &c -#include "wx/fontenc.h" // the font encoding constants -#include "wx/gdiobj.h" // the base class - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxFontData; -class WXDLLIMPEXP_FWD_CORE wxFontBase; -class WXDLLIMPEXP_FWD_CORE wxFont; -class WXDLLIMPEXP_FWD_CORE wxSize; - -// ---------------------------------------------------------------------------- -// font constants -// ---------------------------------------------------------------------------- - -// standard font families: these may be used only for the font creation, it -// doesn't make sense to query an existing font for its font family as, -// especially if the font had been created from a native font description, it -// may be unknown -enum wxFontFamily -{ - wxFONTFAMILY_DEFAULT = wxDEFAULT, - wxFONTFAMILY_DECORATIVE = wxDECORATIVE, - wxFONTFAMILY_ROMAN = wxROMAN, - wxFONTFAMILY_SCRIPT = wxSCRIPT, - wxFONTFAMILY_SWISS = wxSWISS, - wxFONTFAMILY_MODERN = wxMODERN, - wxFONTFAMILY_TELETYPE = wxTELETYPE, - wxFONTFAMILY_MAX, - wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX -}; - -// font styles -enum wxFontStyle -{ - wxFONTSTYLE_NORMAL = wxNORMAL, - wxFONTSTYLE_ITALIC = wxITALIC, - wxFONTSTYLE_SLANT = wxSLANT, - wxFONTSTYLE_MAX -}; - -// font weights -enum wxFontWeight -{ - wxFONTWEIGHT_NORMAL = wxNORMAL, - wxFONTWEIGHT_LIGHT = wxLIGHT, - wxFONTWEIGHT_BOLD = wxBOLD, - wxFONTWEIGHT_MAX -}; - -// the font flag bits for the new font ctor accepting one combined flags word -enum -{ - // no special flags: font with default weight/slant/anti-aliasing - wxFONTFLAG_DEFAULT = 0, - - // slant flags (default: no slant) - wxFONTFLAG_ITALIC = 1 << 0, - wxFONTFLAG_SLANT = 1 << 1, - - // weight flags (default: medium) - wxFONTFLAG_LIGHT = 1 << 2, - wxFONTFLAG_BOLD = 1 << 3, - - // anti-aliasing flag: force on or off (default: the current system default) - wxFONTFLAG_ANTIALIASED = 1 << 4, - wxFONTFLAG_NOT_ANTIALIASED = 1 << 5, - - // underlined/strikethrough flags (default: no lines) - wxFONTFLAG_UNDERLINED = 1 << 6, - wxFONTFLAG_STRIKETHROUGH = 1 << 7, - - // the mask of all currently used flags - wxFONTFLAG_MASK = wxFONTFLAG_ITALIC | - wxFONTFLAG_SLANT | - wxFONTFLAG_LIGHT | - wxFONTFLAG_BOLD | - wxFONTFLAG_ANTIALIASED | - wxFONTFLAG_NOT_ANTIALIASED | - wxFONTFLAG_UNDERLINED | - wxFONTFLAG_STRIKETHROUGH -}; - -// ---------------------------------------------------------------------------- -// wxFontBase represents a font object -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxNativeFontInfo; - -class WXDLLEXPORT wxFontBase : public wxGDIObject -{ -public: - // creator function - virtual ~wxFontBase(); - - // from the font components - static wxFont *New( - int pointSize, // size of the font in points - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... - - // from the font components but using the font flags instead of separate - // parameters for each flag - static wxFont *New(int pointSize, - wxFontFamily family, - int flags = wxFONTFLAG_DEFAULT, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - // from the font components - static wxFont *New( - const wxSize& pixelSize, // size of the font in pixels - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... - - // from the font components but using the font flags instead of separate - // parameters for each flag - static wxFont *New(const wxSize& pixelSize, - wxFontFamily family, - int flags = wxFONTFLAG_DEFAULT, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - // from the (opaque) native font description object - static wxFont *New(const wxNativeFontInfo& nativeFontDesc); - - // from the string representation of wxNativeFontInfo - static wxFont *New(const wxString& strNativeFontDesc); - - // was the font successfully created? - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_refData != NULL; } - - // comparison - bool operator == (const wxFont& font) const; - bool operator != (const wxFont& font) const; - - // accessors: get the font characteristics - virtual int GetPointSize() const = 0; - virtual wxSize GetPixelSize() const; - virtual bool IsUsingSizeInPixels() const; - virtual int GetFamily() const = 0; - virtual int GetStyle() const = 0; - virtual int GetWeight() const = 0; - virtual bool GetUnderlined() const = 0; - virtual wxString GetFaceName() const = 0; - virtual wxFontEncoding GetEncoding() const = 0; - virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0; - - virtual bool IsFixedWidth() const; - - wxString GetNativeFontInfoDesc() const; - wxString GetNativeFontInfoUserDesc() const; - - // change the font characteristics - virtual void SetPointSize( int pointSize ) = 0; - virtual void SetPixelSize( const wxSize& pixelSize ); - virtual void SetFamily( int family ) = 0; - virtual void SetStyle( int style ) = 0; - virtual void SetWeight( int weight ) = 0; - virtual void SetUnderlined( bool underlined ) = 0; - virtual void SetEncoding(wxFontEncoding encoding) = 0; - virtual bool SetFaceName( const wxString& faceName ); - void SetNativeFontInfo(const wxNativeFontInfo& info) - { DoSetNativeFontInfo(info); } - - bool SetNativeFontInfo(const wxString& info); - bool SetNativeFontInfoUserDesc(const wxString& info); - - // translate the fonts into human-readable string (i.e. GetStyleString() - // will return "wxITALIC" for an italic font, ...) - wxString GetFamilyString() const; - wxString GetStyleString() const; - wxString GetWeightString() const; - - // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { } - virtual bool GetNoAntiAliasing() const { return false; } - - // the default encoding is used for creating all fonts with default - // encoding parameter - static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } - static void SetDefaultEncoding(wxFontEncoding encoding); - -protected: - // the function called by both overloads of SetNativeFontInfo() - virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); - -private: - // the currently default encoding: by default, it's the default system - // encoding, but may be changed by the application using - // SetDefaultEncoding() to make all subsequent fonts created without - // specifying encoding parameter using this encoding - static wxFontEncoding ms_encodingDefault; -}; - -// include the real class declaration -#if defined(__WXPALMOS__) - #include "wx/palmos/font.h" -#elif defined(__WXMSW__) - #include "wx/msw/font.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/font.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/font.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/font.h" -#elif defined(__WXX11__) - #include "wx/x11/font.h" -#elif defined(__WXMGL__) - #include "wx/mgl/font.h" -#elif defined(__WXDFB__) - #include "wx/dfb/font.h" -#elif defined(__WXMAC__) - #include "wx/mac/font.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/font.h" -#elif defined(__WXPM__) - #include "wx/os2/font.h" -#endif - -#endif - // _WX_FONT_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/font.h +// Purpose: wxFontBase class: the interface of wxFont +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.09.99 +// RCS-ID: $Id: font.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_BASE_ +#define _WX_FONT_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" // for wxDEFAULT &c +#include "wx/fontenc.h" // the font encoding constants +#include "wx/gdiobj.h" // the base class + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxFontData; +class WXDLLIMPEXP_FWD_CORE wxFontBase; +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxSize; + +// ---------------------------------------------------------------------------- +// font constants +// ---------------------------------------------------------------------------- + +// standard font families: these may be used only for the font creation, it +// doesn't make sense to query an existing font for its font family as, +// especially if the font had been created from a native font description, it +// may be unknown +enum wxFontFamily +{ + wxFONTFAMILY_DEFAULT = wxDEFAULT, + wxFONTFAMILY_DECORATIVE = wxDECORATIVE, + wxFONTFAMILY_ROMAN = wxROMAN, + wxFONTFAMILY_SCRIPT = wxSCRIPT, + wxFONTFAMILY_SWISS = wxSWISS, + wxFONTFAMILY_MODERN = wxMODERN, + wxFONTFAMILY_TELETYPE = wxTELETYPE, + wxFONTFAMILY_MAX, + wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX +}; + +// font styles +enum wxFontStyle +{ + wxFONTSTYLE_NORMAL = wxNORMAL, + wxFONTSTYLE_ITALIC = wxITALIC, + wxFONTSTYLE_SLANT = wxSLANT, + wxFONTSTYLE_MAX +}; + +// font weights +enum wxFontWeight +{ + wxFONTWEIGHT_NORMAL = wxNORMAL, + wxFONTWEIGHT_LIGHT = wxLIGHT, + wxFONTWEIGHT_BOLD = wxBOLD, + wxFONTWEIGHT_MAX +}; + +// the font flag bits for the new font ctor accepting one combined flags word +enum +{ + // no special flags: font with default weight/slant/anti-aliasing + wxFONTFLAG_DEFAULT = 0, + + // slant flags (default: no slant) + wxFONTFLAG_ITALIC = 1 << 0, + wxFONTFLAG_SLANT = 1 << 1, + + // weight flags (default: medium) + wxFONTFLAG_LIGHT = 1 << 2, + wxFONTFLAG_BOLD = 1 << 3, + + // anti-aliasing flag: force on or off (default: the current system default) + wxFONTFLAG_ANTIALIASED = 1 << 4, + wxFONTFLAG_NOT_ANTIALIASED = 1 << 5, + + // underlined/strikethrough flags (default: no lines) + wxFONTFLAG_UNDERLINED = 1 << 6, + wxFONTFLAG_STRIKETHROUGH = 1 << 7, + + // the mask of all currently used flags + wxFONTFLAG_MASK = wxFONTFLAG_ITALIC | + wxFONTFLAG_SLANT | + wxFONTFLAG_LIGHT | + wxFONTFLAG_BOLD | + wxFONTFLAG_ANTIALIASED | + wxFONTFLAG_NOT_ANTIALIASED | + wxFONTFLAG_UNDERLINED | + wxFONTFLAG_STRIKETHROUGH +}; + +// ---------------------------------------------------------------------------- +// wxFontBase represents a font object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxNativeFontInfo; + +class WXDLLEXPORT wxFontBase : public wxGDIObject +{ +public: + // creator function + virtual ~wxFontBase(); + + // from the font components + static wxFont *New( + int pointSize, // size of the font in points + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... + + // from the font components but using the font flags instead of separate + // parameters for each flag + static wxFont *New(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // from the font components + static wxFont *New( + const wxSize& pixelSize, // size of the font in pixels + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... + + // from the font components but using the font flags instead of separate + // parameters for each flag + static wxFont *New(const wxSize& pixelSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // from the (opaque) native font description object + static wxFont *New(const wxNativeFontInfo& nativeFontDesc); + + // from the string representation of wxNativeFontInfo + static wxFont *New(const wxString& strNativeFontDesc); + + // was the font successfully created? + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } + + // comparison + bool operator == (const wxFont& font) const; + bool operator != (const wxFont& font) const; + + // accessors: get the font characteristics + virtual int GetPointSize() const = 0; + virtual wxSize GetPixelSize() const; + virtual bool IsUsingSizeInPixels() const; + virtual int GetFamily() const = 0; + virtual int GetStyle() const = 0; + virtual int GetWeight() const = 0; + virtual bool GetUnderlined() const = 0; + virtual wxString GetFaceName() const = 0; + virtual wxFontEncoding GetEncoding() const = 0; + virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0; + + virtual bool IsFixedWidth() const; + + wxString GetNativeFontInfoDesc() const; + wxString GetNativeFontInfoUserDesc() const; + + // change the font characteristics + virtual void SetPointSize( int pointSize ) = 0; + virtual void SetPixelSize( const wxSize& pixelSize ); + virtual void SetFamily( int family ) = 0; + virtual void SetStyle( int style ) = 0; + virtual void SetWeight( int weight ) = 0; + virtual void SetUnderlined( bool underlined ) = 0; + virtual void SetEncoding(wxFontEncoding encoding) = 0; + virtual bool SetFaceName( const wxString& faceName ); + void SetNativeFontInfo(const wxNativeFontInfo& info) + { DoSetNativeFontInfo(info); } + + bool SetNativeFontInfo(const wxString& info); + bool SetNativeFontInfoUserDesc(const wxString& info); + + // translate the fonts into human-readable string (i.e. GetStyleString() + // will return "wxITALIC" for an italic font, ...) + wxString GetFamilyString() const; + wxString GetStyleString() const; + wxString GetWeightString() const; + + // Unofficial API, don't use + virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { } + virtual bool GetNoAntiAliasing() const { return false; } + + // the default encoding is used for creating all fonts with default + // encoding parameter + static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } + static void SetDefaultEncoding(wxFontEncoding encoding); + +protected: + // the function called by both overloads of SetNativeFontInfo() + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); + +private: + // the currently default encoding: by default, it's the default system + // encoding, but may be changed by the application using + // SetDefaultEncoding() to make all subsequent fonts created without + // specifying encoding parameter using this encoding + static wxFontEncoding ms_encodingDefault; +}; + +// include the real class declaration +#if defined(__WXPALMOS__) + #include "wx/palmos/font.h" +#elif defined(__WXMSW__) + #include "wx/msw/font.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/font.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/font.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/font.h" +#elif defined(__WXX11__) + #include "wx/x11/font.h" +#elif defined(__WXMGL__) + #include "wx/mgl/font.h" +#elif defined(__WXDFB__) + #include "wx/dfb/font.h" +#elif defined(__WXMAC__) + #include "wx/mac/font.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/font.h" +#elif defined(__WXPM__) + #include "wx/os2/font.h" +#endif + +#endif + // _WX_FONT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/fontdlg.h b/Externals/wxWidgets/include/wx/fontdlg.h index f93bba49ef..280a567bb7 100644 --- a/Externals/wxWidgets/include/wx/fontdlg.h +++ b/Externals/wxWidgets/include/wx/fontdlg.h @@ -1,118 +1,118 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/fontdlg.h -// Purpose: common interface for different wxFontDialog classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.05.02 -// RCS-ID: $Id: fontdlg.h 41846 2006-10-09 22:56:48Z VZ $ -// Copyright: (c) 1997-2002 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTDLG_H_BASE_ -#define _WX_FONTDLG_H_BASE_ - -#include "wx/defs.h" // for wxUSE_FONTDLG - -#if wxUSE_FONTDLG - -#include "wx/dialog.h" // the base class -#include "wx/cmndata.h" // wxFontData - -// ---------------------------------------------------------------------------- -// wxFontDialog interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFontDialogBase : public wxDialog -{ -public: - // create the font dialog - wxFontDialogBase() { } - wxFontDialogBase(wxWindow *parent) { m_parent = parent; } - wxFontDialogBase(wxWindow *parent, const wxFontData& data) - { m_parent = parent; InitFontData(&data); } - - bool Create(wxWindow *parent) - { return DoCreate(parent); } - bool Create(wxWindow *parent, const wxFontData& data) - { InitFontData(&data); return Create(parent); } - - virtual ~wxFontDialogBase(); - - // retrieve the font data - const wxFontData& GetFontData() const { return m_fontData; } - wxFontData& GetFontData() { return m_fontData; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, for compatibility only, don't use - wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) ); - - wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } - - void InitFontData(const wxFontData *data = NULL) - { if ( data ) m_fontData = *data; } - - wxFontData m_fontData; - - DECLARE_NO_COPY_CLASS(wxFontDialogBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, for compatibility only, don't use -inline wxFontDialogBase::wxFontDialogBase(wxWindow *parent, const wxFontData *data) -{ m_parent = parent; InitFontData(data); } - -inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) -{ InitFontData(data); return Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// platform-specific wxFontDialog implementation -// ---------------------------------------------------------------------------- - -#if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) -//set to 1 to use native mac font and color dialogs -#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1 -#else -//not supported on these platforms, leave 0 -#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 -#endif - -#if defined(__WXUNIVERSAL__) || \ - defined(__WXMOTIF__) || \ - defined(__WXCOCOA__) || \ - defined(__WXWINCE__) || \ - defined(__WXGPE__) - - #include "wx/generic/fontdlgg.h" - #define wxFontDialog wxGenericFontDialog -#elif defined(__WXMSW__) - #include "wx/msw/fontdlg.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/fontdlg.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/fontdlg.h" -#elif defined(__WXPM__) - #include "wx/os2/fontdlg.h" -#elif defined(__WXMAC__) - #include "wx/mac/fontdlg.h" -#endif - -// ---------------------------------------------------------------------------- -// global public functions -// ---------------------------------------------------------------------------- - -// get the font from user and return it, returns wxNullFont if the dialog was -// cancelled -wxFont WXDLLEXPORT -wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL, - const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString); - -#endif // wxUSE_FONTDLG - -#endif - // _WX_FONTDLG_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/fontdlg.h +// Purpose: common interface for different wxFontDialog classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.05.02 +// RCS-ID: $Id: fontdlg.h 41846 2006-10-09 22:56:48Z VZ $ +// Copyright: (c) 1997-2002 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTDLG_H_BASE_ +#define _WX_FONTDLG_H_BASE_ + +#include "wx/defs.h" // for wxUSE_FONTDLG + +#if wxUSE_FONTDLG + +#include "wx/dialog.h" // the base class +#include "wx/cmndata.h" // wxFontData + +// ---------------------------------------------------------------------------- +// wxFontDialog interface +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFontDialogBase : public wxDialog +{ +public: + // create the font dialog + wxFontDialogBase() { } + wxFontDialogBase(wxWindow *parent) { m_parent = parent; } + wxFontDialogBase(wxWindow *parent, const wxFontData& data) + { m_parent = parent; InitFontData(&data); } + + bool Create(wxWindow *parent) + { return DoCreate(parent); } + bool Create(wxWindow *parent, const wxFontData& data) + { InitFontData(&data); return Create(parent); } + + virtual ~wxFontDialogBase(); + + // retrieve the font data + const wxFontData& GetFontData() const { return m_fontData; } + wxFontData& GetFontData() { return m_fontData; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated interface, for compatibility only, don't use + wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) ); + + wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } + + void InitFontData(const wxFontData *data = NULL) + { if ( data ) m_fontData = *data; } + + wxFontData m_fontData; + + DECLARE_NO_COPY_CLASS(wxFontDialogBase) +}; + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated interface, for compatibility only, don't use +inline wxFontDialogBase::wxFontDialogBase(wxWindow *parent, const wxFontData *data) +{ m_parent = parent; InitFontData(data); } + +inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) +{ InitFontData(data); return Create(parent); } +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// platform-specific wxFontDialog implementation +// ---------------------------------------------------------------------------- + +#if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) +//set to 1 to use native mac font and color dialogs +#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1 +#else +//not supported on these platforms, leave 0 +#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 +#endif + +#if defined(__WXUNIVERSAL__) || \ + defined(__WXMOTIF__) || \ + defined(__WXCOCOA__) || \ + defined(__WXWINCE__) || \ + defined(__WXGPE__) + + #include "wx/generic/fontdlgg.h" + #define wxFontDialog wxGenericFontDialog +#elif defined(__WXMSW__) + #include "wx/msw/fontdlg.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/fontdlg.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/fontdlg.h" +#elif defined(__WXPM__) + #include "wx/os2/fontdlg.h" +#elif defined(__WXMAC__) + #include "wx/mac/fontdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// global public functions +// ---------------------------------------------------------------------------- + +// get the font from user and return it, returns wxNullFont if the dialog was +// cancelled +wxFont WXDLLEXPORT +wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL, + const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString); + +#endif // wxUSE_FONTDLG + +#endif + // _WX_FONTDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/fontenc.h b/Externals/wxWidgets/include/wx/fontenc.h index b80acafffd..7ac0d63a3e 100644 --- a/Externals/wxWidgets/include/wx/fontenc.h +++ b/Externals/wxWidgets/include/wx/fontenc.h @@ -1,151 +1,151 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontenc.h -// Purpose: wxFontEncoding constants -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.03.00 -// RCS-ID: $Id: fontenc.h 29139 2004-09-14 12:08:28Z ABX $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTENC_H_ -#define _WX_FONTENC_H_ - -// font encodings -enum wxFontEncoding -{ - wxFONTENCODING_SYSTEM = -1, // system default - wxFONTENCODING_DEFAULT, // current default encoding - - // ISO8859 standard defines a number of single-byte charsets - wxFONTENCODING_ISO8859_1, // West European (Latin1) - wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) - wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) - wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) - wxFONTENCODING_ISO8859_5, // Cyrillic - wxFONTENCODING_ISO8859_6, // Arabic - wxFONTENCODING_ISO8859_7, // Greek - wxFONTENCODING_ISO8859_8, // Hebrew - wxFONTENCODING_ISO8859_9, // Turkish (Latin5) - wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) - wxFONTENCODING_ISO8859_11, // Thai - wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it - // here anyhow to make all ISO8859 - // consecutive numbers - wxFONTENCODING_ISO8859_13, // Baltic (Latin7) - wxFONTENCODING_ISO8859_14, // Latin8 - wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) - wxFONTENCODING_ISO8859_MAX, - - // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) - wxFONTENCODING_KOI8, // KOI8 Russian - wxFONTENCODING_KOI8_U, // KOI8 Ukrainian - wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 - wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria - - // what would we do without Microsoft? They have their own encodings - // for DOS - wxFONTENCODING_CP437, // original MS-DOS codepage - wxFONTENCODING_CP850, // CP437 merged with Latin1 - wxFONTENCODING_CP852, // CP437 merged with Latin2 - wxFONTENCODING_CP855, // another cyrillic encoding - wxFONTENCODING_CP866, // and another one - // and for Windows - wxFONTENCODING_CP874, // WinThai - wxFONTENCODING_CP932, // Japanese (shift-JIS) - wxFONTENCODING_CP936, // Chinese simplified (GB) - wxFONTENCODING_CP949, // Korean (Hangul charset) - wxFONTENCODING_CP950, // Chinese (traditional - Big5) - wxFONTENCODING_CP1250, // WinLatin2 - wxFONTENCODING_CP1251, // WinCyrillic - wxFONTENCODING_CP1252, // WinLatin1 - wxFONTENCODING_CP1253, // WinGreek (8859-7) - wxFONTENCODING_CP1254, // WinTurkish - wxFONTENCODING_CP1255, // WinHebrew - wxFONTENCODING_CP1256, // WinArabic - wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) - wxFONTENCODING_CP12_MAX, - - wxFONTENCODING_UTF7, // UTF-7 Unicode encoding - wxFONTENCODING_UTF8, // UTF-8 Unicode encoding - wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese - wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding - wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding - wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding - wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding - - wxFONTENCODING_MACROMAN, // the standard mac encodings - wxFONTENCODING_MACJAPANESE, - wxFONTENCODING_MACCHINESETRAD, - wxFONTENCODING_MACKOREAN, - wxFONTENCODING_MACARABIC, - wxFONTENCODING_MACHEBREW, - wxFONTENCODING_MACGREEK, - wxFONTENCODING_MACCYRILLIC, - wxFONTENCODING_MACDEVANAGARI, - wxFONTENCODING_MACGURMUKHI, - wxFONTENCODING_MACGUJARATI, - wxFONTENCODING_MACORIYA, - wxFONTENCODING_MACBENGALI, - wxFONTENCODING_MACTAMIL, - wxFONTENCODING_MACTELUGU, - wxFONTENCODING_MACKANNADA, - wxFONTENCODING_MACMALAJALAM, - wxFONTENCODING_MACSINHALESE, - wxFONTENCODING_MACBURMESE, - wxFONTENCODING_MACKHMER, - wxFONTENCODING_MACTHAI, - wxFONTENCODING_MACLAOTIAN, - wxFONTENCODING_MACGEORGIAN, - wxFONTENCODING_MACARMENIAN, - wxFONTENCODING_MACCHINESESIMP, - wxFONTENCODING_MACTIBETAN, - wxFONTENCODING_MACMONGOLIAN, - wxFONTENCODING_MACETHIOPIC, - wxFONTENCODING_MACCENTRALEUR, - wxFONTENCODING_MACVIATNAMESE, - wxFONTENCODING_MACARABICEXT, - wxFONTENCODING_MACSYMBOL, - wxFONTENCODING_MACDINGBATS, - wxFONTENCODING_MACTURKISH, - wxFONTENCODING_MACCROATIAN, - wxFONTENCODING_MACICELANDIC, - wxFONTENCODING_MACROMANIAN, - wxFONTENCODING_MACCELTIC, - wxFONTENCODING_MACGAELIC, - wxFONTENCODING_MACKEYBOARD, - - wxFONTENCODING_MAX, // highest enumerated encoding value - - wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , - wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , - - // aliases for endian-dependent UTF encodings -#ifdef WORDS_BIGENDIAN - wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16 - wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32BE, // native UTF-32 -#else // WORDS_BIGENDIAN - wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16LE, // native UTF-16 - wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32LE, // native UTF-32 -#endif // WORDS_BIGENDIAN - - // alias for the native Unicode encoding on this platform - // (this is used by wxEncodingConverter and wxUTFFile only for now) -#if SIZEOF_WCHAR_T == 2 - wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16, -#else // SIZEOF_WCHAR_T == 4 - wxFONTENCODING_UNICODE = wxFONTENCODING_UTF32, -#endif - - // alternative names for Far Eastern encodings - // Chinese - wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese - wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese - - // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html) - wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932 // Shift JIS -}; - -#endif // _WX_FONTENC_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontenc.h +// Purpose: wxFontEncoding constants +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.03.00 +// RCS-ID: $Id: fontenc.h 29139 2004-09-14 12:08:28Z ABX $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENC_H_ +#define _WX_FONTENC_H_ + +// font encodings +enum wxFontEncoding +{ + wxFONTENCODING_SYSTEM = -1, // system default + wxFONTENCODING_DEFAULT, // current default encoding + + // ISO8859 standard defines a number of single-byte charsets + wxFONTENCODING_ISO8859_1, // West European (Latin1) + wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) + wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) + wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) + wxFONTENCODING_ISO8859_5, // Cyrillic + wxFONTENCODING_ISO8859_6, // Arabic + wxFONTENCODING_ISO8859_7, // Greek + wxFONTENCODING_ISO8859_8, // Hebrew + wxFONTENCODING_ISO8859_9, // Turkish (Latin5) + wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) + wxFONTENCODING_ISO8859_11, // Thai + wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it + // here anyhow to make all ISO8859 + // consecutive numbers + wxFONTENCODING_ISO8859_13, // Baltic (Latin7) + wxFONTENCODING_ISO8859_14, // Latin8 + wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) + wxFONTENCODING_ISO8859_MAX, + + // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) + wxFONTENCODING_KOI8, // KOI8 Russian + wxFONTENCODING_KOI8_U, // KOI8 Ukrainian + wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 + wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria + + // what would we do without Microsoft? They have their own encodings + // for DOS + wxFONTENCODING_CP437, // original MS-DOS codepage + wxFONTENCODING_CP850, // CP437 merged with Latin1 + wxFONTENCODING_CP852, // CP437 merged with Latin2 + wxFONTENCODING_CP855, // another cyrillic encoding + wxFONTENCODING_CP866, // and another one + // and for Windows + wxFONTENCODING_CP874, // WinThai + wxFONTENCODING_CP932, // Japanese (shift-JIS) + wxFONTENCODING_CP936, // Chinese simplified (GB) + wxFONTENCODING_CP949, // Korean (Hangul charset) + wxFONTENCODING_CP950, // Chinese (traditional - Big5) + wxFONTENCODING_CP1250, // WinLatin2 + wxFONTENCODING_CP1251, // WinCyrillic + wxFONTENCODING_CP1252, // WinLatin1 + wxFONTENCODING_CP1253, // WinGreek (8859-7) + wxFONTENCODING_CP1254, // WinTurkish + wxFONTENCODING_CP1255, // WinHebrew + wxFONTENCODING_CP1256, // WinArabic + wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) + wxFONTENCODING_CP12_MAX, + + wxFONTENCODING_UTF7, // UTF-7 Unicode encoding + wxFONTENCODING_UTF8, // UTF-8 Unicode encoding + wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese + wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding + wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding + wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding + wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding + + wxFONTENCODING_MACROMAN, // the standard mac encodings + wxFONTENCODING_MACJAPANESE, + wxFONTENCODING_MACCHINESETRAD, + wxFONTENCODING_MACKOREAN, + wxFONTENCODING_MACARABIC, + wxFONTENCODING_MACHEBREW, + wxFONTENCODING_MACGREEK, + wxFONTENCODING_MACCYRILLIC, + wxFONTENCODING_MACDEVANAGARI, + wxFONTENCODING_MACGURMUKHI, + wxFONTENCODING_MACGUJARATI, + wxFONTENCODING_MACORIYA, + wxFONTENCODING_MACBENGALI, + wxFONTENCODING_MACTAMIL, + wxFONTENCODING_MACTELUGU, + wxFONTENCODING_MACKANNADA, + wxFONTENCODING_MACMALAJALAM, + wxFONTENCODING_MACSINHALESE, + wxFONTENCODING_MACBURMESE, + wxFONTENCODING_MACKHMER, + wxFONTENCODING_MACTHAI, + wxFONTENCODING_MACLAOTIAN, + wxFONTENCODING_MACGEORGIAN, + wxFONTENCODING_MACARMENIAN, + wxFONTENCODING_MACCHINESESIMP, + wxFONTENCODING_MACTIBETAN, + wxFONTENCODING_MACMONGOLIAN, + wxFONTENCODING_MACETHIOPIC, + wxFONTENCODING_MACCENTRALEUR, + wxFONTENCODING_MACVIATNAMESE, + wxFONTENCODING_MACARABICEXT, + wxFONTENCODING_MACSYMBOL, + wxFONTENCODING_MACDINGBATS, + wxFONTENCODING_MACTURKISH, + wxFONTENCODING_MACCROATIAN, + wxFONTENCODING_MACICELANDIC, + wxFONTENCODING_MACROMANIAN, + wxFONTENCODING_MACCELTIC, + wxFONTENCODING_MACGAELIC, + wxFONTENCODING_MACKEYBOARD, + + wxFONTENCODING_MAX, // highest enumerated encoding value + + wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , + wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , + + // aliases for endian-dependent UTF encodings +#ifdef WORDS_BIGENDIAN + wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16 + wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32BE, // native UTF-32 +#else // WORDS_BIGENDIAN + wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16LE, // native UTF-16 + wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32LE, // native UTF-32 +#endif // WORDS_BIGENDIAN + + // alias for the native Unicode encoding on this platform + // (this is used by wxEncodingConverter and wxUTFFile only for now) +#if SIZEOF_WCHAR_T == 2 + wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16, +#else // SIZEOF_WCHAR_T == 4 + wxFONTENCODING_UNICODE = wxFONTENCODING_UTF32, +#endif + + // alternative names for Far Eastern encodings + // Chinese + wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese + wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese + + // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html) + wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932 // Shift JIS +}; + +#endif // _WX_FONTENC_H_ + diff --git a/Externals/wxWidgets/include/wx/fontenum.h b/Externals/wxWidgets/include/wx/fontenum.h index 8ea5a23c9d..c4f8d98819 100644 --- a/Externals/wxWidgets/include/wx/fontenum.h +++ b/Externals/wxWidgets/include/wx/fontenum.h @@ -1,88 +1,88 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontenum.h -// Purpose: wxFontEnumerator class for getting available fonts -// Author: Julian Smart, Vadim Zeitlin -// Modified by: extended to enumerate more than just font facenames and works -// not only on Windows now (VZ) -// Created: 04/01/98 -// RCS-ID: $Id: fontenum.h 43727 2006-12-01 10:14:28Z VS $ -// Copyright: (c) Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTENUM_H_ -#define _WX_FONTENUM_H_ - -#include "wx/fontenc.h" -#include "wx/arrstr.h" - -#if wxUSE_PANGO || defined(__WXDFB__) - // defined if the port uses only UTF-8 font encodings internally - #define wxHAS_UTF8_FONTS -#endif - -// ---------------------------------------------------------------------------- -// wxFontEnumerator enumerates all available fonts on the system or only the -// fonts with given attributes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFontEnumerator -{ -public: - wxFontEnumerator() {} - - // virtual dtor for the base class - virtual ~wxFontEnumerator() {} - - // start enumerating font facenames (either all of them or those which - // support the given encoding) - will result in OnFacename() being - // called for each available facename (until they are exhausted or - // OnFacename returns false) - virtual bool EnumerateFacenames - ( - wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = false - ); - - // enumerate the different encodings either for given font facename or for - // all facenames - will result in OnFontEncoding() being called for each - // available (facename, encoding) couple - virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString); - - // callbacks which are called after one of EnumerateXXX() functions from - // above is invoked - all of them may return false to stop enumeration or - // true to continue with it - - // called by EnumerateFacenames - virtual bool OnFacename(const wxString& WXUNUSED(facename)) - { return true; } - - // called by EnumerateEncodings - virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), - const wxString& WXUNUSED(encoding)) - { return true; } - - - - // convenience function that returns array of facenames. - static wxArrayString - GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = false); - - // convenience function that returns array of all available encodings. - static wxArrayString GetEncodings(const wxString& facename = wxEmptyString); - - // convenience function that returns true if the given face name exist - // in the user's system - static bool IsValidFacename(const wxString &str); - -private: -#ifdef wxHAS_UTF8_FONTS - // helper for ports that only use UTF-8 encoding natively - bool EnumerateEncodingsUTF8(const wxString& facename); -#endif - - DECLARE_NO_COPY_CLASS(wxFontEnumerator) -}; - -#endif // _WX_FONTENUM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontenum.h +// Purpose: wxFontEnumerator class for getting available fonts +// Author: Julian Smart, Vadim Zeitlin +// Modified by: extended to enumerate more than just font facenames and works +// not only on Windows now (VZ) +// Created: 04/01/98 +// RCS-ID: $Id: fontenum.h 43727 2006-12-01 10:14:28Z VS $ +// Copyright: (c) Julian Smart, Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENUM_H_ +#define _WX_FONTENUM_H_ + +#include "wx/fontenc.h" +#include "wx/arrstr.h" + +#if wxUSE_PANGO || defined(__WXDFB__) + // defined if the port uses only UTF-8 font encodings internally + #define wxHAS_UTF8_FONTS +#endif + +// ---------------------------------------------------------------------------- +// wxFontEnumerator enumerates all available fonts on the system or only the +// fonts with given attributes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFontEnumerator +{ +public: + wxFontEnumerator() {} + + // virtual dtor for the base class + virtual ~wxFontEnumerator() {} + + // start enumerating font facenames (either all of them or those which + // support the given encoding) - will result in OnFacename() being + // called for each available facename (until they are exhausted or + // OnFacename returns false) + virtual bool EnumerateFacenames + ( + wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all + bool fixedWidthOnly = false + ); + + // enumerate the different encodings either for given font facename or for + // all facenames - will result in OnFontEncoding() being called for each + // available (facename, encoding) couple + virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString); + + // callbacks which are called after one of EnumerateXXX() functions from + // above is invoked - all of them may return false to stop enumeration or + // true to continue with it + + // called by EnumerateFacenames + virtual bool OnFacename(const wxString& WXUNUSED(facename)) + { return true; } + + // called by EnumerateEncodings + virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), + const wxString& WXUNUSED(encoding)) + { return true; } + + + + // convenience function that returns array of facenames. + static wxArrayString + GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all + bool fixedWidthOnly = false); + + // convenience function that returns array of all available encodings. + static wxArrayString GetEncodings(const wxString& facename = wxEmptyString); + + // convenience function that returns true if the given face name exist + // in the user's system + static bool IsValidFacename(const wxString &str); + +private: +#ifdef wxHAS_UTF8_FONTS + // helper for ports that only use UTF-8 encoding natively + bool EnumerateEncodingsUTF8(const wxString& facename); +#endif + + DECLARE_NO_COPY_CLASS(wxFontEnumerator) +}; + +#endif // _WX_FONTENUM_H_ diff --git a/Externals/wxWidgets/include/wx/fontmap.h b/Externals/wxWidgets/include/wx/fontmap.h index c305113289..ff6684fa6e 100644 --- a/Externals/wxWidgets/include/wx/fontmap.h +++ b/Externals/wxWidgets/include/wx/fontmap.h @@ -1,290 +1,290 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontmap.h -// Purpose: wxFontMapper class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.11.99 -// RCS-ID: $Id: fontmap.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTMAPPER_H_ -#define _WX_FONTMAPPER_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_FONTMAP - -#include "wx/fontenc.h" // for wxFontEncoding - -#if wxUSE_GUI - #include "wx/fontutil.h" // for wxNativeEncodingInfo -#endif // wxUSE_GUI - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - class WXDLLIMPEXP_FWD_BASE wxConfigBase; -#endif // wxUSE_CONFIG - -class WXDLLIMPEXP_FWD_CORE wxFontMapper; - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxWindow; -#endif // wxUSE_GUI - -// ============================================================================ -// wxFontMapper manages user-definable correspondence between wxWidgets font -// encodings and the fonts present on the machine. -// -// This is a singleton class, font mapper objects can only be accessed using -// wxFontMapper::Get(). -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxFontMapperBase: this is a non-interactive class which just uses its built -// in knowledge of the encodings equivalence -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFontMapperBase -{ -public: - // constructtor and such - // --------------------- - - // default ctor - wxFontMapperBase(); - - // virtual dtor for any base class - virtual ~wxFontMapperBase(); - - // return instance of the wxFontMapper singleton - // wxBase code only cares that it's a wxFontMapperBase - // In wxBase, wxFontMapper is only forward declared - // so one cannot implicitly cast from it to wxFontMapperBase. - static wxFontMapperBase *Get(); - - // set the singleton to 'mapper' instance and return previous one - static wxFontMapper *Set(wxFontMapper *mapper); - - // delete the existing font mapper if any - static void Reset(); - - - // translates charset strings to encoding - // -------------------------------------- - - // returns the encoding for the given charset (in the form of RFC 2046) or - // wxFONTENCODING_SYSTEM if couldn't decode it - // - // interactive parameter is ignored in the base class, we behave as if it - // were always false - virtual wxFontEncoding CharsetToEncoding(const wxString& charset, - bool interactive = true); - - // information about supported encodings - // ------------------------------------- - - // get the number of font encodings we know about - static size_t GetSupportedEncodingsCount(); - - // get the n-th supported encoding - static wxFontEncoding GetEncoding(size_t n); - - // return canonical name of this encoding (this is a short string, - // GetEncodingDescription() returns a longer one) - static wxString GetEncodingName(wxFontEncoding encoding); - - // return a list of all names of this encoding (see GetEncodingName) - static const wxChar** GetAllEncodingNames(wxFontEncoding encoding); - - // return user-readable string describing the given encoding - // - // NB: hard-coded now, but might change later (read it from config?) - static wxString GetEncodingDescription(wxFontEncoding encoding); - - // find the encoding corresponding to the given name, inverse of - // GetEncodingName() and less general than CharsetToEncoding() - // - // returns wxFONTENCODING_MAX if the name is not a supported encoding - static wxFontEncoding GetEncodingFromName(const wxString& name); - - - // functions which allow to configure the config object used: by default, - // the global one (from wxConfigBase::Get() will be used) and the default - // root path for the config settings is the string returned by - // GetDefaultConfigPath() - // ---------------------------------------------------------------------- - -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // set the root config path to use (should be an absolute path) - void SetConfigPath(const wxString& prefix); - - // return default config path - static const wxChar *GetDefaultConfigPath(); -#endif // wxUSE_CONFIG - - - // returns true for the base class and false for a "real" font mapper object - // (implementation-only) - virtual bool IsDummy() { return true; } - -protected: -#if wxUSE_CONFIG && wxUSE_FILECONFIG - // get the config object we're using -- either the global config object - // or a wxMemoryConfig object created by this class otherwise - wxConfigBase *GetConfig(); - - // gets the root path for our settings -- if it wasn't set explicitly, use - // GetDefaultConfigPath() - const wxString& GetConfigPath(); - - // change to the given (relative) path in the config, return true if ok - // (then GetConfig() will return something !NULL), false if no config - // object - // - // caller should provide a pointer to the string variable which should be - // later passed to RestorePath() - bool ChangePath(const wxString& pathNew, wxString *pathOld); - - // restore the config path after use - void RestorePath(const wxString& pathOld); - - // config object and path (in it) to use - wxConfigBase *m_configDummy; - - wxString m_configRootPath; -#endif // wxUSE_CONFIG - - // the real implementation of the base class version of CharsetToEncoding() - // - // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't - // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we - // should/could ask the user - int NonInteractiveCharsetToEncoding(const wxString& charset); - -private: - // the global fontmapper object or NULL - static wxFontMapper *sm_instance; - - friend class wxFontMapperPathChanger; - - DECLARE_NO_COPY_CLASS(wxFontMapperBase) -}; - -// ---------------------------------------------------------------------------- -// wxFontMapper: interactive extension of wxFontMapperBase -// -// The default implementations of all functions will ask the user if they are -// not capable of finding the answer themselves and store the answer in a -// config file (configurable via SetConfigXXX functions). This behaviour may -// be disabled by giving the value of false to "interactive" parameter. -// However, the functions will always consult the config file to allow the -// user-defined values override the default logic and there is no way to -// disable this -- which shouldn't be ever needed because if "interactive" was -// never true, the config file is never created anyhow. -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxFontMapper : public wxFontMapperBase -{ -public: - // default ctor - wxFontMapper(); - - // virtual dtor for a base class - virtual ~wxFontMapper(); - - // working with the encodings - // -------------------------- - - // returns the encoding for the given charset (in the form of RFC 2046) or - // wxFONTENCODING_SYSTEM if couldn't decode it - virtual wxFontEncoding CharsetToEncoding(const wxString& charset, - bool interactive = true); - - // find an alternative for the given encoding (which is supposed to not be - // available on this system). If successful, return true and fill info - // structure with the parameters required to create the font, otherwise - // return false - virtual bool GetAltForEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info, - const wxString& facename = wxEmptyString, - bool interactive = true); - - // version better suitable for 'public' use. Returns wxFontEcoding - // that can be used it wxFont ctor - bool GetAltForEncoding(wxFontEncoding encoding, - wxFontEncoding *alt_encoding, - const wxString& facename = wxEmptyString, - bool interactive = true); - - // checks whether given encoding is available in given face or not. - // - // if no facename is given (default), return true if it's available in any - // facename at alll. - virtual bool IsEncodingAvailable(wxFontEncoding encoding, - const wxString& facename = wxEmptyString); - - - // configure the appearance of the dialogs we may popup - // ---------------------------------------------------- - - // the parent window for modal dialogs - void SetDialogParent(wxWindow *parent) { m_windowParent = parent; } - - // the title for the dialogs (note that default is quite reasonable) - void SetDialogTitle(const wxString& title) { m_titleDialog = title; } - - // GUI code needs to know it's a wxFontMapper because there - // are additional methods in the subclass. - static wxFontMapper *Get(); - - // pseudo-RTTI since we aren't a wxObject. - virtual bool IsDummy() { return false; } - -protected: - // GetAltForEncoding() helper: tests for the existence of the given - // encoding and saves the result in config if ok - this results in the - // following (desired) behaviour: when an unknown/unavailable encoding is - // requested for the first time, the user is asked about a replacement, - // but if he doesn't choose any and the default logic finds one, it will - // be saved in the config so that the user won't be asked about it any - // more - bool TestAltEncoding(const wxString& configEntry, - wxFontEncoding encReplacement, - wxNativeEncodingInfo *info); - - // the title for our dialogs - wxString m_titleDialog; - - // the parent window for our dialogs - wxWindow *m_windowParent; - -private: - DECLARE_NO_COPY_CLASS(wxFontMapper) -}; - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the default font mapper for wxWidgets programs do NOT use! This is for -// backward compatibility, use wxFontMapper::Get() instead -#define wxTheFontMapper (wxFontMapper::Get()) - -#else // !wxUSE_FONTMAP - -#if wxUSE_GUI - // wxEncodingToCodepage (utils.cpp) needs wxGetNativeFontEncoding - #include "wx/fontutil.h" -#endif - -#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP - -#endif // _WX_FONTMAPPER_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontmap.h +// Purpose: wxFontMapper class +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.11.99 +// RCS-ID: $Id: fontmap.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTMAPPER_H_ +#define _WX_FONTMAPPER_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_FONTMAP + +#include "wx/fontenc.h" // for wxFontEncoding + +#if wxUSE_GUI + #include "wx/fontutil.h" // for wxNativeEncodingInfo +#endif // wxUSE_GUI + +#if wxUSE_CONFIG && wxUSE_FILECONFIG + class WXDLLIMPEXP_FWD_BASE wxConfigBase; +#endif // wxUSE_CONFIG + +class WXDLLIMPEXP_FWD_CORE wxFontMapper; + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxWindow; +#endif // wxUSE_GUI + +// ============================================================================ +// wxFontMapper manages user-definable correspondence between wxWidgets font +// encodings and the fonts present on the machine. +// +// This is a singleton class, font mapper objects can only be accessed using +// wxFontMapper::Get(). +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFontMapperBase: this is a non-interactive class which just uses its built +// in knowledge of the encodings equivalence +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFontMapperBase +{ +public: + // constructtor and such + // --------------------- + + // default ctor + wxFontMapperBase(); + + // virtual dtor for any base class + virtual ~wxFontMapperBase(); + + // return instance of the wxFontMapper singleton + // wxBase code only cares that it's a wxFontMapperBase + // In wxBase, wxFontMapper is only forward declared + // so one cannot implicitly cast from it to wxFontMapperBase. + static wxFontMapperBase *Get(); + + // set the singleton to 'mapper' instance and return previous one + static wxFontMapper *Set(wxFontMapper *mapper); + + // delete the existing font mapper if any + static void Reset(); + + + // translates charset strings to encoding + // -------------------------------------- + + // returns the encoding for the given charset (in the form of RFC 2046) or + // wxFONTENCODING_SYSTEM if couldn't decode it + // + // interactive parameter is ignored in the base class, we behave as if it + // were always false + virtual wxFontEncoding CharsetToEncoding(const wxString& charset, + bool interactive = true); + + // information about supported encodings + // ------------------------------------- + + // get the number of font encodings we know about + static size_t GetSupportedEncodingsCount(); + + // get the n-th supported encoding + static wxFontEncoding GetEncoding(size_t n); + + // return canonical name of this encoding (this is a short string, + // GetEncodingDescription() returns a longer one) + static wxString GetEncodingName(wxFontEncoding encoding); + + // return a list of all names of this encoding (see GetEncodingName) + static const wxChar** GetAllEncodingNames(wxFontEncoding encoding); + + // return user-readable string describing the given encoding + // + // NB: hard-coded now, but might change later (read it from config?) + static wxString GetEncodingDescription(wxFontEncoding encoding); + + // find the encoding corresponding to the given name, inverse of + // GetEncodingName() and less general than CharsetToEncoding() + // + // returns wxFONTENCODING_MAX if the name is not a supported encoding + static wxFontEncoding GetEncodingFromName(const wxString& name); + + + // functions which allow to configure the config object used: by default, + // the global one (from wxConfigBase::Get() will be used) and the default + // root path for the config settings is the string returned by + // GetDefaultConfigPath() + // ---------------------------------------------------------------------- + +#if wxUSE_CONFIG && wxUSE_FILECONFIG + // set the root config path to use (should be an absolute path) + void SetConfigPath(const wxString& prefix); + + // return default config path + static const wxChar *GetDefaultConfigPath(); +#endif // wxUSE_CONFIG + + + // returns true for the base class and false for a "real" font mapper object + // (implementation-only) + virtual bool IsDummy() { return true; } + +protected: +#if wxUSE_CONFIG && wxUSE_FILECONFIG + // get the config object we're using -- either the global config object + // or a wxMemoryConfig object created by this class otherwise + wxConfigBase *GetConfig(); + + // gets the root path for our settings -- if it wasn't set explicitly, use + // GetDefaultConfigPath() + const wxString& GetConfigPath(); + + // change to the given (relative) path in the config, return true if ok + // (then GetConfig() will return something !NULL), false if no config + // object + // + // caller should provide a pointer to the string variable which should be + // later passed to RestorePath() + bool ChangePath(const wxString& pathNew, wxString *pathOld); + + // restore the config path after use + void RestorePath(const wxString& pathOld); + + // config object and path (in it) to use + wxConfigBase *m_configDummy; + + wxString m_configRootPath; +#endif // wxUSE_CONFIG + + // the real implementation of the base class version of CharsetToEncoding() + // + // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't + // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we + // should/could ask the user + int NonInteractiveCharsetToEncoding(const wxString& charset); + +private: + // the global fontmapper object or NULL + static wxFontMapper *sm_instance; + + friend class wxFontMapperPathChanger; + + DECLARE_NO_COPY_CLASS(wxFontMapperBase) +}; + +// ---------------------------------------------------------------------------- +// wxFontMapper: interactive extension of wxFontMapperBase +// +// The default implementations of all functions will ask the user if they are +// not capable of finding the answer themselves and store the answer in a +// config file (configurable via SetConfigXXX functions). This behaviour may +// be disabled by giving the value of false to "interactive" parameter. +// However, the functions will always consult the config file to allow the +// user-defined values override the default logic and there is no way to +// disable this -- which shouldn't be ever needed because if "interactive" was +// never true, the config file is never created anyhow. +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxFontMapper : public wxFontMapperBase +{ +public: + // default ctor + wxFontMapper(); + + // virtual dtor for a base class + virtual ~wxFontMapper(); + + // working with the encodings + // -------------------------- + + // returns the encoding for the given charset (in the form of RFC 2046) or + // wxFONTENCODING_SYSTEM if couldn't decode it + virtual wxFontEncoding CharsetToEncoding(const wxString& charset, + bool interactive = true); + + // find an alternative for the given encoding (which is supposed to not be + // available on this system). If successful, return true and fill info + // structure with the parameters required to create the font, otherwise + // return false + virtual bool GetAltForEncoding(wxFontEncoding encoding, + wxNativeEncodingInfo *info, + const wxString& facename = wxEmptyString, + bool interactive = true); + + // version better suitable for 'public' use. Returns wxFontEcoding + // that can be used it wxFont ctor + bool GetAltForEncoding(wxFontEncoding encoding, + wxFontEncoding *alt_encoding, + const wxString& facename = wxEmptyString, + bool interactive = true); + + // checks whether given encoding is available in given face or not. + // + // if no facename is given (default), return true if it's available in any + // facename at alll. + virtual bool IsEncodingAvailable(wxFontEncoding encoding, + const wxString& facename = wxEmptyString); + + + // configure the appearance of the dialogs we may popup + // ---------------------------------------------------- + + // the parent window for modal dialogs + void SetDialogParent(wxWindow *parent) { m_windowParent = parent; } + + // the title for the dialogs (note that default is quite reasonable) + void SetDialogTitle(const wxString& title) { m_titleDialog = title; } + + // GUI code needs to know it's a wxFontMapper because there + // are additional methods in the subclass. + static wxFontMapper *Get(); + + // pseudo-RTTI since we aren't a wxObject. + virtual bool IsDummy() { return false; } + +protected: + // GetAltForEncoding() helper: tests for the existence of the given + // encoding and saves the result in config if ok - this results in the + // following (desired) behaviour: when an unknown/unavailable encoding is + // requested for the first time, the user is asked about a replacement, + // but if he doesn't choose any and the default logic finds one, it will + // be saved in the config so that the user won't be asked about it any + // more + bool TestAltEncoding(const wxString& configEntry, + wxFontEncoding encReplacement, + wxNativeEncodingInfo *info); + + // the title for our dialogs + wxString m_titleDialog; + + // the parent window for our dialogs + wxWindow *m_windowParent; + +private: + DECLARE_NO_COPY_CLASS(wxFontMapper) +}; + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default font mapper for wxWidgets programs do NOT use! This is for +// backward compatibility, use wxFontMapper::Get() instead +#define wxTheFontMapper (wxFontMapper::Get()) + +#else // !wxUSE_FONTMAP + +#if wxUSE_GUI + // wxEncodingToCodepage (utils.cpp) needs wxGetNativeFontEncoding + #include "wx/fontutil.h" +#endif + +#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP + +#endif // _WX_FONTMAPPER_H_ + diff --git a/Externals/wxWidgets/include/wx/fontpicker.h b/Externals/wxWidgets/include/wx/fontpicker.h index d13d0b22fc..ff02eddd5c 100644 --- a/Externals/wxWidgets/include/wx/fontpicker.h +++ b/Externals/wxWidgets/include/wx/fontpicker.h @@ -1,223 +1,223 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontpicker.h -// Purpose: wxFontPickerCtrl base header -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: fontpicker.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTPICKER_H_BASE_ -#define _WX_FONTPICKER_H_BASE_ - -#include "wx/defs.h" - - -#if wxUSE_FONTPICKERCTRL - -#include "wx/pickerbase.h" - - -class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent; - -extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerWidgetNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerCtrlNameStr[]; - - -// ---------------------------------------------------------------------------- -// wxFontPickerWidgetBase: a generic abstract interface which must be -// implemented by controls used by wxFontPickerCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFontPickerWidgetBase -{ -public: - wxFontPickerWidgetBase() { m_selectedFont = *wxNORMAL_FONT; } - virtual ~wxFontPickerWidgetBase() {} - - wxFont GetSelectedFont() const - { return m_selectedFont; } - virtual void SetSelectedFont(const wxFont &f) - { m_selectedFont = f; UpdateFont(); } - -protected: - - virtual void UpdateFont() = 0; - - // the current font (may be invalid if none) - // NOTE: don't call this m_font as wxWindow::m_font already exists - wxFont m_selectedFont; -}; - -// Styles which must be supported by all controls implementing wxFontPickerWidgetBase -// NB: these styles must be defined to carefully-chosen values to -// avoid conflicts with wxButton's styles - - -// keeps the label of the button updated with the fontface name + font size -// E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, -// updates the wxFontButtonGeneric's label (overwriting any previous label) -// with the "Times New Roman, 10" text (only fontface + fontsize is displayed -// to avoid extralong labels). -#define wxFNTP_FONTDESC_AS_LABEL 0x0008 - -// uses the currently selected font to draw the label of the button -#define wxFNTP_USEFONT_FOR_LABEL 0x0010 - -// since GTK > 2.4, there is GtkFontButton -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/fontpicker.h" - #define wxFontPickerWidget wxFontButton -#else - #include "wx/generic/fontpickerg.h" - #define wxFontPickerWidget wxGenericFontButton -#endif - - -// ---------------------------------------------------------------------------- -// wxFontPickerCtrl specific flags -// ---------------------------------------------------------------------------- - -#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) -#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL) - -// not a style but rather the default value of the maximum pointsize allowed -#define wxFNTP_MAXPOINT_SIZE 100 - - -// ---------------------------------------------------------------------------- -// wxFontPickerCtrl: platform-independent class which embeds the -// platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is -// used, a textctrl next to it. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase -{ -public: - wxFontPickerCtrl() - : m_bIgnoreNextTextCtrlUpdate(false), - m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) - { - } - - virtual ~wxFontPickerCtrl() {} - - - wxFontPickerCtrl(wxWindow *parent, - wxWindowID id, - const wxFont& initial = wxNullFont, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFNTP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerCtrlNameStr) - : m_bIgnoreNextTextCtrlUpdate(false), - m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) - { - Create(parent, id, initial, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxFont& initial = wxNullFont, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFNTP_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerCtrlNameStr); - - -public: // public API - - // get the font chosen - wxFont GetSelectedFont() const - { return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); } - - // sets currently displayed font - void SetSelectedFont(const wxFont& f); - - // set/get the max pointsize - void SetMaxPointSize(unsigned int max) - { m_nMaxPointSize=max; } - unsigned int GetMaxPointSize() const - { return m_nMaxPointSize; } - -public: // internal functions - - void UpdatePickerFromTextCtrl(); - void UpdateTextCtrlFromPicker(); - - // event handler for our picker - void OnFontChange(wxFontPickerEvent &); - - // used to convert wxString <-> wxFont - virtual wxString Font2String(const wxFont &font); - virtual wxFont String2Font(const wxString &font); - -protected: - - // extracts the style for our picker from wxFontPickerCtrl's style - long GetPickerStyle(long style) const - { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); } - - // true if the next UpdateTextCtrl() call is to ignore - bool m_bIgnoreNextTextCtrlUpdate; - - // the maximum pointsize allowed to the user - unsigned int m_nMaxPointSize; - -private: - DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl) -}; - - -// ---------------------------------------------------------------------------- -// wxFontPickerEvent: used by wxFontPickerCtrl only -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FONTPICKER_CHANGED, 1102) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent -{ -public: - wxFontPickerEvent() {} - wxFontPickerEvent(wxObject *generator, int id, const wxFont &f) - : wxCommandEvent(wxEVT_COMMAND_FONTPICKER_CHANGED, id), - m_font(f) - { - SetEventObject(generator); - } - - wxFont GetFont() const { return m_font; } - void SetFont(const wxFont &c) { m_font = c; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFontPickerEvent(*this); } - -private: - wxFont m_font; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent) -}; - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&); - -#define wxFontPickerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFontPickerEventFunction, &func) - -#define EVT_FONTPICKER_CHANGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn)) - - -#endif // wxUSE_FONTPICKERCTRL - -#endif - // _WX_FONTPICKER_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontpicker.h +// Purpose: wxFontPickerCtrl base header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// RCS-ID: $Id: fontpicker.h 53135 2008-04-12 02:31:04Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTPICKER_H_BASE_ +#define _WX_FONTPICKER_H_BASE_ + +#include "wx/defs.h" + + +#if wxUSE_FONTPICKERCTRL + +#include "wx/pickerbase.h" + + +class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent; + +extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerWidgetNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxFontPickerCtrlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxFontPickerWidgetBase: a generic abstract interface which must be +// implemented by controls used by wxFontPickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontPickerWidgetBase +{ +public: + wxFontPickerWidgetBase() { m_selectedFont = *wxNORMAL_FONT; } + virtual ~wxFontPickerWidgetBase() {} + + wxFont GetSelectedFont() const + { return m_selectedFont; } + virtual void SetSelectedFont(const wxFont &f) + { m_selectedFont = f; UpdateFont(); } + +protected: + + virtual void UpdateFont() = 0; + + // the current font (may be invalid if none) + // NOTE: don't call this m_font as wxWindow::m_font already exists + wxFont m_selectedFont; +}; + +// Styles which must be supported by all controls implementing wxFontPickerWidgetBase +// NB: these styles must be defined to carefully-chosen values to +// avoid conflicts with wxButton's styles + + +// keeps the label of the button updated with the fontface name + font size +// E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, +// updates the wxFontButtonGeneric's label (overwriting any previous label) +// with the "Times New Roman, 10" text (only fontface + fontsize is displayed +// to avoid extralong labels). +#define wxFNTP_FONTDESC_AS_LABEL 0x0008 + +// uses the currently selected font to draw the label of the button +#define wxFNTP_USEFONT_FOR_LABEL 0x0010 + +// since GTK > 2.4, there is GtkFontButton +#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/fontpicker.h" + #define wxFontPickerWidget wxFontButton +#else + #include "wx/generic/fontpickerg.h" + #define wxFontPickerWidget wxGenericFontButton +#endif + + +// ---------------------------------------------------------------------------- +// wxFontPickerCtrl specific flags +// ---------------------------------------------------------------------------- + +#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) +#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL) + +// not a style but rather the default value of the maximum pointsize allowed +#define wxFNTP_MAXPOINT_SIZE 100 + + +// ---------------------------------------------------------------------------- +// wxFontPickerCtrl: platform-independent class which embeds the +// platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is +// used, a textctrl next to it. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase +{ +public: + wxFontPickerCtrl() + : m_bIgnoreNextTextCtrlUpdate(false), + m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) + { + } + + virtual ~wxFontPickerCtrl() {} + + + wxFontPickerCtrl(wxWindow *parent, + wxWindowID id, + const wxFont& initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFNTP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFontPickerCtrlNameStr) + : m_bIgnoreNextTextCtrlUpdate(false), + m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) + { + Create(parent, id, initial, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxFont& initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFNTP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFontPickerCtrlNameStr); + + +public: // public API + + // get the font chosen + wxFont GetSelectedFont() const + { return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); } + + // sets currently displayed font + void SetSelectedFont(const wxFont& f); + + // set/get the max pointsize + void SetMaxPointSize(unsigned int max) + { m_nMaxPointSize=max; } + unsigned int GetMaxPointSize() const + { return m_nMaxPointSize; } + +public: // internal functions + + void UpdatePickerFromTextCtrl(); + void UpdateTextCtrlFromPicker(); + + // event handler for our picker + void OnFontChange(wxFontPickerEvent &); + + // used to convert wxString <-> wxFont + virtual wxString Font2String(const wxFont &font); + virtual wxFont String2Font(const wxString &font); + +protected: + + // extracts the style for our picker from wxFontPickerCtrl's style + long GetPickerStyle(long style) const + { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); } + + // true if the next UpdateTextCtrl() call is to ignore + bool m_bIgnoreNextTextCtrlUpdate; + + // the maximum pointsize allowed to the user + unsigned int m_nMaxPointSize; + +private: + DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl) +}; + + +// ---------------------------------------------------------------------------- +// wxFontPickerEvent: used by wxFontPickerCtrl only +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_FONTPICKER_CHANGED, 1102) +END_DECLARE_EVENT_TYPES() + +class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent +{ +public: + wxFontPickerEvent() {} + wxFontPickerEvent(wxObject *generator, int id, const wxFont &f) + : wxCommandEvent(wxEVT_COMMAND_FONTPICKER_CHANGED, id), + m_font(f) + { + SetEventObject(generator); + } + + wxFont GetFont() const { return m_font; } + void SetFont(const wxFont &c) { m_font = c; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxFontPickerEvent(*this); } + +private: + wxFont m_font; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent) +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&); + +#define wxFontPickerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFontPickerEventFunction, &func) + +#define EVT_FONTPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn)) + + +#endif // wxUSE_FONTPICKERCTRL + +#endif + // _WX_FONTPICKER_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/fontutil.h b/Externals/wxWidgets/include/wx/fontutil.h index c0c46e4581..a2a1124098 100644 --- a/Externals/wxWidgets/include/wx/fontutil.h +++ b/Externals/wxWidgets/include/wx/fontutil.h @@ -1,242 +1,242 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fontutil.h -// Purpose: font-related helper functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.11.99 -// RCS-ID: $Id: fontutil.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// General note: this header is private to wxWidgets and is not supposed to be -// included by user code. The functions declared here are implemented in -// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c. - -#ifndef _WX_FONTUTIL_H_ -#define _WX_FONTUTIL_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/font.h" // for wxFont and wxFontEncoding - -#if defined(__WXMSW__) - #include "wx/msw/wrapwin.h" -#endif - -class WXDLLIMPEXP_FWD_BASE wxArrayString; -struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo; - -#if defined(_WX_X_FONTLIKE) - -// the symbolic names for the XLFD fields (with examples for their value) -// -// NB: we suppose that the font always starts with the empty token (font name -// registry field) as we never use nor generate it anyhow -enum wxXLFDField -{ - wxXLFD_FOUNDRY, // adobe - wxXLFD_FAMILY, // courier, times, ... - wxXLFD_WEIGHT, // black, bold, demibold, medium, regular, light - wxXLFD_SLANT, // r/i/o (roman/italique/oblique) - wxXLFD_SETWIDTH, // condensed, expanded, ... - wxXLFD_ADDSTYLE, // whatever - usually nothing - wxXLFD_PIXELSIZE, // size in pixels - wxXLFD_POINTSIZE, // size in points - wxXLFD_RESX, // 72, 75, 100, ... - wxXLFD_RESY, - wxXLFD_SPACING, // m/p/c (monospaced/proportional/character cell) - wxXLFD_AVGWIDTH, // average width in 1/10 pixels - wxXLFD_REGISTRY, // iso8859, rawin, koi8, ... - wxXLFD_ENCODING, // 1, r, r, ... - wxXLFD_MAX -}; - -#endif // _WX_X_FONTLIKE - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// wxNativeFontInfo is platform-specific font representation: this struct -// should be considered as opaque font description only used by the native -// functions, the user code can only get the objects of this type from -// somewhere and pass it somewhere else (possibly save them somewhere using -// ToString() and restore them using FromString()) -class WXDLLEXPORT wxNativeFontInfo -{ -public: -#if wxUSE_PANGO - PangoFontDescription *description; -#elif defined(_WX_X_FONTLIKE) - // the members can't be accessed directly as we only parse the - // xFontName on demand -private: - // the components of the XLFD - wxString fontElements[wxXLFD_MAX]; - - // the full XLFD - wxString xFontName; - - // true until SetXFontName() is called - bool m_isDefault; - - // return true if we have already initialized fontElements - inline bool HasElements() const; - -public: - // init the elements from an XLFD, return true if ok - bool FromXFontName(const wxString& xFontName); - - // return false if we were never initialized with a valid XLFD - bool IsDefault() const { return m_isDefault; } - - // return the XLFD (using the fontElements if necessary) - wxString GetXFontName() const; - - // get the given XFLD component - wxString GetXFontComponent(wxXLFDField field) const; - - // change the font component - void SetXFontComponent(wxXLFDField field, const wxString& value); - - // set the XFLD - void SetXFontName(const wxString& xFontName); -#elif defined(__WXMSW__) - LOGFONT lf; -#elif defined(__WXPM__) - // OS/2 native structures that define a font - FATTRS fa; - FONTMETRICS fm; - FACENAMEDESC fn; -#else // other platforms - // - // This is a generic implementation that should work on all ports - // without specific support by the port. - // - #define wxNO_NATIVE_FONTINFO - - int pointSize; - wxFontFamily family; - wxFontStyle style; - wxFontWeight weight; - bool underlined; - wxString faceName; - wxFontEncoding encoding; -#endif // platforms - - // default ctor (default copy ctor is ok) - wxNativeFontInfo() { Init(); } - -#if wxUSE_PANGO -private: - void Init(const wxNativeFontInfo& info); - void Free(); - -public: - wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } - ~wxNativeFontInfo() { Free(); } - - wxNativeFontInfo& operator=(const wxNativeFontInfo& info) - { - Free(); - Init(info); - return *this; - } -#endif // wxUSE_PANGO - - // reset to the default state - void Init(); - - // init with the parameters of the given font - void InitFromFont(const wxFont& font) - { - // translate all font parameters - SetStyle((wxFontStyle)font.GetStyle()); - SetWeight((wxFontWeight)font.GetWeight()); - SetUnderlined(font.GetUnderlined()); -#if defined(__WXMSW__) - if ( font.IsUsingSizeInPixels() ) - SetPixelSize(font.GetPixelSize()); - else - SetPointSize(font.GetPointSize()); -#else - SetPointSize(font.GetPointSize()); -#endif - - // set the family/facename - SetFamily((wxFontFamily)font.GetFamily()); - const wxString& facename = font.GetFaceName(); - if ( !facename.empty() ) - { - SetFaceName(facename); - } - - // deal with encoding now (it may override the font family and facename - // so do it after setting them) - SetEncoding(font.GetEncoding()); - } - - // accessors and modifiers for the font elements - int GetPointSize() const; - wxSize GetPixelSize() const; - wxFontStyle GetStyle() const; - wxFontWeight GetWeight() const; - bool GetUnderlined() const; - wxString GetFaceName() const; - wxFontFamily GetFamily() const; - wxFontEncoding GetEncoding() const; - - void SetPointSize(int pointsize); - void SetPixelSize(const wxSize& pixelSize); - void SetStyle(wxFontStyle style); - void SetWeight(wxFontWeight weight); - void SetUnderlined(bool underlined); - bool SetFaceName(const wxString& facename); - void SetFamily(wxFontFamily family); - void SetEncoding(wxFontEncoding encoding); - - // sets the first facename in the given array which is found - // to be valid. If no valid facename is given, sets the - // first valid facename returned by wxFontEnumerator::GetFacenames(). - // Does not return a bool since it cannot fail. - void SetFaceName(const wxArrayString &facenames); - - - // it is important to be able to serialize wxNativeFontInfo objects to be - // able to store them (in config file, for example) - bool FromString(const wxString& s); - wxString ToString() const; - - // we also want to present the native font descriptions to the user in some - // human-readable form (it is not platform independent neither, but can - // hopefully be understood by the user) - bool FromUserString(const wxString& s); - wxString ToUserString() const; -}; - -// ---------------------------------------------------------------------------- -// font-related functions (common) -// ---------------------------------------------------------------------------- - -// translate a wxFontEncoding into native encoding parameter (defined above), -// returning true if an (exact) macth could be found, false otherwise (without -// attempting any substitutions) -extern bool wxGetNativeFontEncoding(wxFontEncoding encoding, - wxNativeEncodingInfo *info); - -// test for the existence of the font described by this facename/encoding, -// return true if such font(s) exist, false otherwise -extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info); - -// ---------------------------------------------------------------------------- -// font-related functions (X and GTK) -// ---------------------------------------------------------------------------- - -#ifdef _WX_X_FONTLIKE - #include "wx/unix/fontutil.h" -#endif // X || GDK - -#endif // _WX_FONTUTIL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontutil.h +// Purpose: font-related helper functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.11.99 +// RCS-ID: $Id: fontutil.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// General note: this header is private to wxWidgets and is not supposed to be +// included by user code. The functions declared here are implemented in +// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c. + +#ifndef _WX_FONTUTIL_H_ +#define _WX_FONTUTIL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/font.h" // for wxFont and wxFontEncoding + +#if defined(__WXMSW__) + #include "wx/msw/wrapwin.h" +#endif + +class WXDLLIMPEXP_FWD_BASE wxArrayString; +struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo; + +#if defined(_WX_X_FONTLIKE) + +// the symbolic names for the XLFD fields (with examples for their value) +// +// NB: we suppose that the font always starts with the empty token (font name +// registry field) as we never use nor generate it anyhow +enum wxXLFDField +{ + wxXLFD_FOUNDRY, // adobe + wxXLFD_FAMILY, // courier, times, ... + wxXLFD_WEIGHT, // black, bold, demibold, medium, regular, light + wxXLFD_SLANT, // r/i/o (roman/italique/oblique) + wxXLFD_SETWIDTH, // condensed, expanded, ... + wxXLFD_ADDSTYLE, // whatever - usually nothing + wxXLFD_PIXELSIZE, // size in pixels + wxXLFD_POINTSIZE, // size in points + wxXLFD_RESX, // 72, 75, 100, ... + wxXLFD_RESY, + wxXLFD_SPACING, // m/p/c (monospaced/proportional/character cell) + wxXLFD_AVGWIDTH, // average width in 1/10 pixels + wxXLFD_REGISTRY, // iso8859, rawin, koi8, ... + wxXLFD_ENCODING, // 1, r, r, ... + wxXLFD_MAX +}; + +#endif // _WX_X_FONTLIKE + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// wxNativeFontInfo is platform-specific font representation: this struct +// should be considered as opaque font description only used by the native +// functions, the user code can only get the objects of this type from +// somewhere and pass it somewhere else (possibly save them somewhere using +// ToString() and restore them using FromString()) +class WXDLLEXPORT wxNativeFontInfo +{ +public: +#if wxUSE_PANGO + PangoFontDescription *description; +#elif defined(_WX_X_FONTLIKE) + // the members can't be accessed directly as we only parse the + // xFontName on demand +private: + // the components of the XLFD + wxString fontElements[wxXLFD_MAX]; + + // the full XLFD + wxString xFontName; + + // true until SetXFontName() is called + bool m_isDefault; + + // return true if we have already initialized fontElements + inline bool HasElements() const; + +public: + // init the elements from an XLFD, return true if ok + bool FromXFontName(const wxString& xFontName); + + // return false if we were never initialized with a valid XLFD + bool IsDefault() const { return m_isDefault; } + + // return the XLFD (using the fontElements if necessary) + wxString GetXFontName() const; + + // get the given XFLD component + wxString GetXFontComponent(wxXLFDField field) const; + + // change the font component + void SetXFontComponent(wxXLFDField field, const wxString& value); + + // set the XFLD + void SetXFontName(const wxString& xFontName); +#elif defined(__WXMSW__) + LOGFONT lf; +#elif defined(__WXPM__) + // OS/2 native structures that define a font + FATTRS fa; + FONTMETRICS fm; + FACENAMEDESC fn; +#else // other platforms + // + // This is a generic implementation that should work on all ports + // without specific support by the port. + // + #define wxNO_NATIVE_FONTINFO + + int pointSize; + wxFontFamily family; + wxFontStyle style; + wxFontWeight weight; + bool underlined; + wxString faceName; + wxFontEncoding encoding; +#endif // platforms + + // default ctor (default copy ctor is ok) + wxNativeFontInfo() { Init(); } + +#if wxUSE_PANGO +private: + void Init(const wxNativeFontInfo& info); + void Free(); + +public: + wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } + ~wxNativeFontInfo() { Free(); } + + wxNativeFontInfo& operator=(const wxNativeFontInfo& info) + { + Free(); + Init(info); + return *this; + } +#endif // wxUSE_PANGO + + // reset to the default state + void Init(); + + // init with the parameters of the given font + void InitFromFont(const wxFont& font) + { + // translate all font parameters + SetStyle((wxFontStyle)font.GetStyle()); + SetWeight((wxFontWeight)font.GetWeight()); + SetUnderlined(font.GetUnderlined()); +#if defined(__WXMSW__) + if ( font.IsUsingSizeInPixels() ) + SetPixelSize(font.GetPixelSize()); + else + SetPointSize(font.GetPointSize()); +#else + SetPointSize(font.GetPointSize()); +#endif + + // set the family/facename + SetFamily((wxFontFamily)font.GetFamily()); + const wxString& facename = font.GetFaceName(); + if ( !facename.empty() ) + { + SetFaceName(facename); + } + + // deal with encoding now (it may override the font family and facename + // so do it after setting them) + SetEncoding(font.GetEncoding()); + } + + // accessors and modifiers for the font elements + int GetPointSize() const; + wxSize GetPixelSize() const; + wxFontStyle GetStyle() const; + wxFontWeight GetWeight() const; + bool GetUnderlined() const; + wxString GetFaceName() const; + wxFontFamily GetFamily() const; + wxFontEncoding GetEncoding() const; + + void SetPointSize(int pointsize); + void SetPixelSize(const wxSize& pixelSize); + void SetStyle(wxFontStyle style); + void SetWeight(wxFontWeight weight); + void SetUnderlined(bool underlined); + bool SetFaceName(const wxString& facename); + void SetFamily(wxFontFamily family); + void SetEncoding(wxFontEncoding encoding); + + // sets the first facename in the given array which is found + // to be valid. If no valid facename is given, sets the + // first valid facename returned by wxFontEnumerator::GetFacenames(). + // Does not return a bool since it cannot fail. + void SetFaceName(const wxArrayString &facenames); + + + // it is important to be able to serialize wxNativeFontInfo objects to be + // able to store them (in config file, for example) + bool FromString(const wxString& s); + wxString ToString() const; + + // we also want to present the native font descriptions to the user in some + // human-readable form (it is not platform independent neither, but can + // hopefully be understood by the user) + bool FromUserString(const wxString& s); + wxString ToUserString() const; +}; + +// ---------------------------------------------------------------------------- +// font-related functions (common) +// ---------------------------------------------------------------------------- + +// translate a wxFontEncoding into native encoding parameter (defined above), +// returning true if an (exact) macth could be found, false otherwise (without +// attempting any substitutions) +extern bool wxGetNativeFontEncoding(wxFontEncoding encoding, + wxNativeEncodingInfo *info); + +// test for the existence of the font described by this facename/encoding, +// return true if such font(s) exist, false otherwise +extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info); + +// ---------------------------------------------------------------------------- +// font-related functions (X and GTK) +// ---------------------------------------------------------------------------- + +#ifdef _WX_X_FONTLIKE + #include "wx/unix/fontutil.h" +#endif // X || GDK + +#endif // _WX_FONTUTIL_H_ diff --git a/Externals/wxWidgets/include/wx/frame.h b/Externals/wxWidgets/include/wx/frame.h index a1a8036fcc..cecbf1b5d4 100644 --- a/Externals/wxWidgets/include/wx/frame.h +++ b/Externals/wxWidgets/include/wx/frame.h @@ -1,262 +1,262 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/frame.h -// Purpose: wxFrame class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 15.11.99 -// RCS-ID: $Id: frame.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FRAME_H_BASE_ -#define _WX_FRAME_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/toplevel.h" // the base class - -// the default names for various classs -extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxStatusBar; -class WXDLLIMPEXP_FWD_CORE wxToolBar; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxFrame-specific (i.e. not for wxDialog) styles -#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) -#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu -#define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent -#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped - -// ---------------------------------------------------------------------------- -// wxFrame is a top-level window with optional menubar, statusbar and toolbar -// -// For each of *bars, a frame may have several of them, but only one is -// managed by the frame, i.e. resized/moved when the frame is and whose size -// is accounted for in client size calculations - all others should be taken -// care of manually. The CreateXXXBar() functions create this, main, XXXBar, -// but the actual creation is done in OnCreateXXXBar() functions which may be -// overridden to create custom objects instead of standard ones when -// CreateXXXBar() is called. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow -{ -public: - // construction - wxFrameBase(); - virtual ~wxFrameBase(); - - wxFrame *New(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // frame state - // ----------- - - // get the origin of the client area (which may be different from (0, 0) - // if the frame has a toolbar) in client coordinates - virtual wxPoint GetClientAreaOrigin() const; - - // sends a size event to the window using its current size -- this has an - // effect of refreshing the window layout - virtual void SendSizeEvent(); - - // menu bar functions - // ------------------ - -#if wxUSE_MENUS - virtual void SetMenuBar(wxMenuBar *menubar); - virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } -#endif // wxUSE_MENUS - - // process menu command: returns true if processed - bool ProcessCommand(int winid); - - // status bar functions - // -------------------- -#if wxUSE_STATUSBAR - // create the main status bar by calling OnCreateStatusBar() - virtual wxStatusBar* CreateStatusBar(int number = 1, - long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE, - wxWindowID winid = 0, - const wxString& name = - wxStatusLineNameStr); - // return a new status bar - virtual wxStatusBar *OnCreateStatusBar(int number, - long style, - wxWindowID winid, - const wxString& name); - // get the main status bar - virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } - - // sets the main status bar - virtual void SetStatusBar(wxStatusBar *statBar); - - // forward these to status bar - virtual void SetStatusText(const wxString &text, int number = 0); - virtual void SetStatusWidths(int n, const int widths_field[]); - void PushStatusText(const wxString &text, int number = 0); - void PopStatusText(int number = 0); - - // set the status bar pane the help will be shown in - void SetStatusBarPane(int n) { m_statusBarPane = n; } - int GetStatusBarPane() const { return m_statusBarPane; } -#endif // wxUSE_STATUSBAR - - // toolbar functions - // ----------------- - -#if wxUSE_TOOLBAR - // create main toolbar bycalling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = wxID_ANY, - const wxString& name = wxToolBarNameStr); - // return a new toolbar - virtual wxToolBar *OnCreateToolBar(long style, - wxWindowID winid, - const wxString& name ); - - // get/set the main toolbar - virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } - virtual void SetToolBar(wxToolBar *toolbar); -#endif // wxUSE_TOOLBAR - - // implementation only from now on - // ------------------------------- - - // event handlers -#if wxUSE_MENUS -#if wxUSE_STATUSBAR - void OnMenuOpen(wxMenuEvent& event); - void OnMenuClose(wxMenuEvent& event); - void OnMenuHighlight(wxMenuEvent& event); -#endif // wxUSE_STATUSBAR - - // send wxUpdateUIEvents for all menu items in the menubar, - // or just for menu if non-NULL - virtual void DoMenuUpdates(wxMenu* menu = NULL); -#endif // wxUSE_MENUS - - // do the UI update processing for this window - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); - - // Implement internal behaviour (menu updating on some platforms) - virtual void OnInternalIdle(); - - // if there is no real wxTopLevelWindow on this platform we have to define - // some wxTopLevelWindowBase pure virtual functions here to avoid breaking - // old ports (wxMotif) which don't define them in wxFrame -#ifndef wxTopLevelWindowNative - virtual bool ShowFullScreen(bool WXUNUSED(show), - long WXUNUSED(style) = wxFULLSCREEN_ALL) - { return false; } - virtual bool IsFullScreen() const - { return false; } -#endif // no wxTopLevelWindowNative - -#if wxUSE_MENUS || wxUSE_TOOLBAR - // show help text (typically in the statusbar); show is false - // if you are hiding the help, true otherwise - virtual void DoGiveHelp(const wxString& text, bool show); -#endif - -protected: - // the frame main menu/status/tool bars - // ------------------------------------ - - // this (non virtual!) function should be called from dtor to delete the - // main menubar, statusbar and toolbar (if any) - void DeleteAllBars(); - - // test whether this window makes part of the frame - virtual bool IsOneOfBars(const wxWindow *win) const; - -#if wxUSE_MENUS - // override to update menu bar position when the frame size changes - virtual void PositionMenuBar() { } - - // override to do something special when the menu bar is being removed - // from the frame - virtual void DetachMenuBar(); - - // override to do something special when the menu bar is attached to the - // frame - virtual void AttachMenuBar(wxMenuBar *menubar); - - wxMenuBar *m_frameMenuBar; -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR) - // the saved status bar text overwritten by DoGiveHelp() - wxString m_oldStatusText; -#endif - -#if wxUSE_STATUSBAR - // override to update status bar position (or anything else) when - // something changes - virtual void PositionStatusBar() { } - - // show the help string for this menu item in the given status bar: the - // status bar pointer can be NULL; return true if help was shown - bool ShowMenuHelp(wxStatusBar *statbar, int helpid); - - wxStatusBar *m_frameStatusBar; -#endif // wxUSE_STATUSBAR - - - int m_statusBarPane; - -#if wxUSE_TOOLBAR - // override to update status bar position (or anything else) when - // something changes - virtual void PositionToolBar() { } - - wxToolBar *m_frameToolBar; -#endif // wxUSE_TOOLBAR - -#if wxUSE_MENUS && wxUSE_STATUSBAR - DECLARE_EVENT_TABLE() -#endif // wxUSE_MENUS && wxUSE_STATUSBAR - - DECLARE_NO_COPY_CLASS(wxFrameBase) -}; - -// include the real class declaration -#if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) - #include "wx/univ/frame.h" -#else // !__WXUNIVERSAL__ - #if defined(__WXPALMOS__) - #include "wx/palmos/frame.h" - #elif defined(__WXMSW__) - #include "wx/msw/frame.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/frame.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/frame.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/frame.h" - #elif defined(__WXMAC__) - #include "wx/mac/frame.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/frame.h" - #elif defined(__WXPM__) - #include "wx/os2/frame.h" - #endif -#endif - -#endif - // _WX_FRAME_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/frame.h +// Purpose: wxFrame class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.11.99 +// RCS-ID: $Id: frame.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_BASE_ +#define _WX_FRAME_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/toplevel.h" // the base class + +// the default names for various classs +extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxStatusBar; +class WXDLLIMPEXP_FWD_CORE wxToolBar; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxFrame-specific (i.e. not for wxDialog) styles +#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) +#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu +#define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent +#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped + +// ---------------------------------------------------------------------------- +// wxFrame is a top-level window with optional menubar, statusbar and toolbar +// +// For each of *bars, a frame may have several of them, but only one is +// managed by the frame, i.e. resized/moved when the frame is and whose size +// is accounted for in client size calculations - all others should be taken +// care of manually. The CreateXXXBar() functions create this, main, XXXBar, +// but the actual creation is done in OnCreateXXXBar() functions which may be +// overridden to create custom objects instead of standard ones when +// CreateXXXBar() is called. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow +{ +public: + // construction + wxFrameBase(); + virtual ~wxFrameBase(); + + wxFrame *New(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // frame state + // ----------- + + // get the origin of the client area (which may be different from (0, 0) + // if the frame has a toolbar) in client coordinates + virtual wxPoint GetClientAreaOrigin() const; + + // sends a size event to the window using its current size -- this has an + // effect of refreshing the window layout + virtual void SendSizeEvent(); + + // menu bar functions + // ------------------ + +#if wxUSE_MENUS + virtual void SetMenuBar(wxMenuBar *menubar); + virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } +#endif // wxUSE_MENUS + + // process menu command: returns true if processed + bool ProcessCommand(int winid); + + // status bar functions + // -------------------- +#if wxUSE_STATUSBAR + // create the main status bar by calling OnCreateStatusBar() + virtual wxStatusBar* CreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE, + wxWindowID winid = 0, + const wxString& name = + wxStatusLineNameStr); + // return a new status bar + virtual wxStatusBar *OnCreateStatusBar(int number, + long style, + wxWindowID winid, + const wxString& name); + // get the main status bar + virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } + + // sets the main status bar + virtual void SetStatusBar(wxStatusBar *statBar); + + // forward these to status bar + virtual void SetStatusText(const wxString &text, int number = 0); + virtual void SetStatusWidths(int n, const int widths_field[]); + void PushStatusText(const wxString &text, int number = 0); + void PopStatusText(int number = 0); + + // set the status bar pane the help will be shown in + void SetStatusBarPane(int n) { m_statusBarPane = n; } + int GetStatusBarPane() const { return m_statusBarPane; } +#endif // wxUSE_STATUSBAR + + // toolbar functions + // ----------------- + +#if wxUSE_TOOLBAR + // create main toolbar bycalling OnCreateToolBar() + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID winid = wxID_ANY, + const wxString& name = wxToolBarNameStr); + // return a new toolbar + virtual wxToolBar *OnCreateToolBar(long style, + wxWindowID winid, + const wxString& name ); + + // get/set the main toolbar + virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } + virtual void SetToolBar(wxToolBar *toolbar); +#endif // wxUSE_TOOLBAR + + // implementation only from now on + // ------------------------------- + + // event handlers +#if wxUSE_MENUS +#if wxUSE_STATUSBAR + void OnMenuOpen(wxMenuEvent& event); + void OnMenuClose(wxMenuEvent& event); + void OnMenuHighlight(wxMenuEvent& event); +#endif // wxUSE_STATUSBAR + + // send wxUpdateUIEvents for all menu items in the menubar, + // or just for menu if non-NULL + virtual void DoMenuUpdates(wxMenu* menu = NULL); +#endif // wxUSE_MENUS + + // do the UI update processing for this window + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); + + // Implement internal behaviour (menu updating on some platforms) + virtual void OnInternalIdle(); + + // if there is no real wxTopLevelWindow on this platform we have to define + // some wxTopLevelWindowBase pure virtual functions here to avoid breaking + // old ports (wxMotif) which don't define them in wxFrame +#ifndef wxTopLevelWindowNative + virtual bool ShowFullScreen(bool WXUNUSED(show), + long WXUNUSED(style) = wxFULLSCREEN_ALL) + { return false; } + virtual bool IsFullScreen() const + { return false; } +#endif // no wxTopLevelWindowNative + +#if wxUSE_MENUS || wxUSE_TOOLBAR + // show help text (typically in the statusbar); show is false + // if you are hiding the help, true otherwise + virtual void DoGiveHelp(const wxString& text, bool show); +#endif + +protected: + // the frame main menu/status/tool bars + // ------------------------------------ + + // this (non virtual!) function should be called from dtor to delete the + // main menubar, statusbar and toolbar (if any) + void DeleteAllBars(); + + // test whether this window makes part of the frame + virtual bool IsOneOfBars(const wxWindow *win) const; + +#if wxUSE_MENUS + // override to update menu bar position when the frame size changes + virtual void PositionMenuBar() { } + + // override to do something special when the menu bar is being removed + // from the frame + virtual void DetachMenuBar(); + + // override to do something special when the menu bar is attached to the + // frame + virtual void AttachMenuBar(wxMenuBar *menubar); + + wxMenuBar *m_frameMenuBar; +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR) + // the saved status bar text overwritten by DoGiveHelp() + wxString m_oldStatusText; +#endif + +#if wxUSE_STATUSBAR + // override to update status bar position (or anything else) when + // something changes + virtual void PositionStatusBar() { } + + // show the help string for this menu item in the given status bar: the + // status bar pointer can be NULL; return true if help was shown + bool ShowMenuHelp(wxStatusBar *statbar, int helpid); + + wxStatusBar *m_frameStatusBar; +#endif // wxUSE_STATUSBAR + + + int m_statusBarPane; + +#if wxUSE_TOOLBAR + // override to update status bar position (or anything else) when + // something changes + virtual void PositionToolBar() { } + + wxToolBar *m_frameToolBar; +#endif // wxUSE_TOOLBAR + +#if wxUSE_MENUS && wxUSE_STATUSBAR + DECLARE_EVENT_TABLE() +#endif // wxUSE_MENUS && wxUSE_STATUSBAR + + DECLARE_NO_COPY_CLASS(wxFrameBase) +}; + +// include the real class declaration +#if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) + #include "wx/univ/frame.h" +#else // !__WXUNIVERSAL__ + #if defined(__WXPALMOS__) + #include "wx/palmos/frame.h" + #elif defined(__WXMSW__) + #include "wx/msw/frame.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/frame.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/frame.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/frame.h" + #elif defined(__WXMAC__) + #include "wx/mac/frame.h" + #elif defined(__WXCOCOA__) + #include "wx/cocoa/frame.h" + #elif defined(__WXPM__) + #include "wx/os2/frame.h" + #endif +#endif + +#endif + // _WX_FRAME_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/fs_arc.h b/Externals/wxWidgets/include/wx/fs_arc.h index 02afd07465..c66f14b207 100644 --- a/Externals/wxWidgets/include/wx/fs_arc.h +++ b/Externals/wxWidgets/include/wx/fs_arc.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fs_arc.h -// Purpose: Archive file system -// Author: Vaclav Slavik, Mike Wetherell -// Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_arc.h 42713 2006-10-30 11:56:12Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_ARC_H_ -#define _WX_FS_ARC_H_ - -#include "wx/defs.h" - -#if wxUSE_FS_ARCHIVE - -#include "wx/filesys.h" -#include "wx/hashmap.h" - -WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap); - -//--------------------------------------------------------------------------- -// wxArchiveFSHandler -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler -{ -public: - wxArchiveFSHandler(); - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - void Cleanup(); - virtual ~wxArchiveFSHandler(); - -private: - class wxArchiveFSCache *m_cache; - wxFileSystem m_fs; - - // these vars are used by FindFirst/Next: - class wxArchiveFSCacheData *m_Archive; - struct wxArchiveFSEntry *m_FindEntry; - wxString m_Pattern, m_BaseDir, m_ZipFile; - bool m_AllowDirs, m_AllowFiles; - wxArchiveFilenameHashMap *m_DirsFound; - - wxString DoFind(); - - DECLARE_NO_COPY_CLASS(wxArchiveFSHandler) - DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler) -}; - -#endif // wxUSE_FS_ARCHIVE - -#endif // _WX_FS_ARC_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_arc.h +// Purpose: Archive file system +// Author: Vaclav Slavik, Mike Wetherell +// Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell +// CVS-ID: $Id: fs_arc.h 42713 2006-10-30 11:56:12Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_ARC_H_ +#define _WX_FS_ARC_H_ + +#include "wx/defs.h" + +#if wxUSE_FS_ARCHIVE + +#include "wx/filesys.h" +#include "wx/hashmap.h" + +WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap); + +//--------------------------------------------------------------------------- +// wxArchiveFSHandler +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler +{ +public: + wxArchiveFSHandler(); + virtual bool CanOpen(const wxString& location); + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + virtual wxString FindFirst(const wxString& spec, int flags = 0); + virtual wxString FindNext(); + void Cleanup(); + virtual ~wxArchiveFSHandler(); + +private: + class wxArchiveFSCache *m_cache; + wxFileSystem m_fs; + + // these vars are used by FindFirst/Next: + class wxArchiveFSCacheData *m_Archive; + struct wxArchiveFSEntry *m_FindEntry; + wxString m_Pattern, m_BaseDir, m_ZipFile; + bool m_AllowDirs, m_AllowFiles; + wxArchiveFilenameHashMap *m_DirsFound; + + wxString DoFind(); + + DECLARE_NO_COPY_CLASS(wxArchiveFSHandler) + DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler) +}; + +#endif // wxUSE_FS_ARCHIVE + +#endif // _WX_FS_ARC_H_ diff --git a/Externals/wxWidgets/include/wx/fs_filter.h b/Externals/wxWidgets/include/wx/fs_filter.h index 1eb0145100..f4e7e13870 100644 --- a/Externals/wxWidgets/include/wx/fs_filter.h +++ b/Externals/wxWidgets/include/wx/fs_filter.h @@ -1,41 +1,41 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fs_filter.h -// Purpose: Filter file system handler -// Author: Mike Wetherell -// Copyright: (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_filter.h 42713 2006-10-30 11:56:12Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_FILTER_H_ -#define _WX_FS_FILTER_H_ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM - -#include "wx/filesys.h" - -//--------------------------------------------------------------------------- -// wxFilterFSHandler -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFilterFSHandler : public wxFileSystemHandler -{ -public: - wxFilterFSHandler() : wxFileSystemHandler() { } - virtual ~wxFilterFSHandler() { } - - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - -private: - DECLARE_NO_COPY_CLASS(wxFilterFSHandler) -}; - -#endif // wxUSE_FILESYSTEM - -#endif // _WX_FS_FILTER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_filter.h +// Purpose: Filter file system handler +// Author: Mike Wetherell +// Copyright: (c) 2006 Mike Wetherell +// CVS-ID: $Id: fs_filter.h 42713 2006-10-30 11:56:12Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_FILTER_H_ +#define _WX_FS_FILTER_H_ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/filesys.h" + +//--------------------------------------------------------------------------- +// wxFilterFSHandler +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFilterFSHandler : public wxFileSystemHandler +{ +public: + wxFilterFSHandler() : wxFileSystemHandler() { } + virtual ~wxFilterFSHandler() { } + + virtual bool CanOpen(const wxString& location); + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + + virtual wxString FindFirst(const wxString& spec, int flags = 0); + virtual wxString FindNext(); + +private: + DECLARE_NO_COPY_CLASS(wxFilterFSHandler) +}; + +#endif // wxUSE_FILESYSTEM + +#endif // _WX_FS_FILTER_H_ diff --git a/Externals/wxWidgets/include/wx/fs_inet.h b/Externals/wxWidgets/include/wx/fs_inet.h index f66872dee0..3e29572b05 100644 --- a/Externals/wxWidgets/include/wx/fs_inet.h +++ b/Externals/wxWidgets/include/wx/fs_inet.h @@ -1,33 +1,33 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: fs_inet.h -// Purpose: HTTP and FTP file system -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_INET_H_ -#define _WX_FS_INET_H_ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS - -#include "wx/filesys.h" - -// ---------------------------------------------------------------------------- -// wxInternetFSHandler -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_NET wxInternetFSHandler : public wxFileSystemHandler -{ - public: - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); -}; - -#endif - // wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS - -#endif // _WX_FS_INET_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: fs_inet.h +// Purpose: HTTP and FTP file system +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_INET_H_ +#define _WX_FS_INET_H_ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS + +#include "wx/filesys.h" + +// ---------------------------------------------------------------------------- +// wxInternetFSHandler +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxInternetFSHandler : public wxFileSystemHandler +{ + public: + virtual bool CanOpen(const wxString& location); + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); +}; + +#endif + // wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS + +#endif // _WX_FS_INET_H_ + diff --git a/Externals/wxWidgets/include/wx/fs_mem.h b/Externals/wxWidgets/include/wx/fs_mem.h index e4d6737d74..5c93134854 100644 --- a/Externals/wxWidgets/include/wx/fs_mem.h +++ b/Externals/wxWidgets/include/wx/fs_mem.h @@ -1,127 +1,127 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: fs_mem.h -// Purpose: in-memory file system -// Author: Vaclav Slavik -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_MEM_H_ -#define _WX_FS_MEM_H_ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM - -#include "wx/filesys.h" - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxBitmap; - class WXDLLIMPEXP_FWD_CORE wxImage; -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxMemoryFSHandlerBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler -{ -public: - wxMemoryFSHandlerBase(); - virtual ~wxMemoryFSHandlerBase(); - - // Add file to list of files stored in memory. Stored data (bitmap, text or - // raw data) will be copied into private memory stream and available under - // name "memory:" + filename - static void AddFile(const wxString& filename, const wxString& textdata); - static void AddFile(const wxString& filename, const void *binarydata, size_t size); -#if wxABI_VERSION >= 20805 - static void AddFileWithMimeType(const wxString& filename, - const wxString& textdata, - const wxString& mimetype); - static void AddFileWithMimeType(const wxString& filename, - const void *binarydata, size_t size, - const wxString& mimetype); -#endif // wxABI_VERSION >= 20805 - - // Remove file from memory FS and free occupied memory - static void RemoveFile(const wxString& filename); - - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); - -protected: - static bool CheckHash(const wxString& filename); - static wxHashTable *m_Hash; -}; - -// ---------------------------------------------------------------------------- -// wxMemoryFSHandler -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -// add GUI-only operations to the base class -class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase -{ -public: - // bring the base class versions into the scope, otherwise they would be - // inaccessible in wxMemoryFSHandler - // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...) - static void AddFile(const wxString& filename, const wxString& textdata) - { - wxMemoryFSHandlerBase::AddFile(filename, textdata); - } - - static void AddFile(const wxString& filename, - const void *binarydata, - size_t size) - { - wxMemoryFSHandlerBase::AddFile(filename, binarydata, size); - } -#if wxABI_VERSION >= 20805 - static void AddFileWithMimeType(const wxString& filename, - const wxString& textdata, - const wxString& mimetype) - { - wxMemoryFSHandlerBase::AddFileWithMimeType(filename, - textdata, - mimetype); - } - static void AddFileWithMimeType(const wxString& filename, - const void *binarydata, size_t size, - const wxString& mimetype) - { - wxMemoryFSHandlerBase::AddFileWithMimeType(filename, - binarydata, size, - mimetype); - } -#endif // wxABI_VERSION >= 20805 - -#if wxUSE_IMAGE - static void AddFile(const wxString& filename, - const wxImage& image, - long type); - - static void AddFile(const wxString& filename, - const wxBitmap& bitmap, - long type); -#endif // wxUSE_IMAGE - -}; - -#else // !wxUSE_GUI - -// just the same thing as the base class in wxBase -class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase -{ -}; - -#endif // wxUSE_GUI/!wxUSE_GUI - -#endif // wxUSE_FILESYSTEM - -#endif // _WX_FS_MEM_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: fs_mem.h +// Purpose: in-memory file system +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_MEM_H_ +#define _WX_FS_MEM_H_ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/filesys.h" + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxBitmap; + class WXDLLIMPEXP_FWD_CORE wxImage; +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxMemoryFSHandlerBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler +{ +public: + wxMemoryFSHandlerBase(); + virtual ~wxMemoryFSHandlerBase(); + + // Add file to list of files stored in memory. Stored data (bitmap, text or + // raw data) will be copied into private memory stream and available under + // name "memory:" + filename + static void AddFile(const wxString& filename, const wxString& textdata); + static void AddFile(const wxString& filename, const void *binarydata, size_t size); +#if wxABI_VERSION >= 20805 + static void AddFileWithMimeType(const wxString& filename, + const wxString& textdata, + const wxString& mimetype); + static void AddFileWithMimeType(const wxString& filename, + const void *binarydata, size_t size, + const wxString& mimetype); +#endif // wxABI_VERSION >= 20805 + + // Remove file from memory FS and free occupied memory + static void RemoveFile(const wxString& filename); + + virtual bool CanOpen(const wxString& location); + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + virtual wxString FindFirst(const wxString& spec, int flags = 0); + virtual wxString FindNext(); + +protected: + static bool CheckHash(const wxString& filename); + static wxHashTable *m_Hash; +}; + +// ---------------------------------------------------------------------------- +// wxMemoryFSHandler +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +// add GUI-only operations to the base class +class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase +{ +public: + // bring the base class versions into the scope, otherwise they would be + // inaccessible in wxMemoryFSHandler + // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...) + static void AddFile(const wxString& filename, const wxString& textdata) + { + wxMemoryFSHandlerBase::AddFile(filename, textdata); + } + + static void AddFile(const wxString& filename, + const void *binarydata, + size_t size) + { + wxMemoryFSHandlerBase::AddFile(filename, binarydata, size); + } +#if wxABI_VERSION >= 20805 + static void AddFileWithMimeType(const wxString& filename, + const wxString& textdata, + const wxString& mimetype) + { + wxMemoryFSHandlerBase::AddFileWithMimeType(filename, + textdata, + mimetype); + } + static void AddFileWithMimeType(const wxString& filename, + const void *binarydata, size_t size, + const wxString& mimetype) + { + wxMemoryFSHandlerBase::AddFileWithMimeType(filename, + binarydata, size, + mimetype); + } +#endif // wxABI_VERSION >= 20805 + +#if wxUSE_IMAGE + static void AddFile(const wxString& filename, + const wxImage& image, + long type); + + static void AddFile(const wxString& filename, + const wxBitmap& bitmap, + long type); +#endif // wxUSE_IMAGE + +}; + +#else // !wxUSE_GUI + +// just the same thing as the base class in wxBase +class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase +{ +}; + +#endif // wxUSE_GUI/!wxUSE_GUI + +#endif // wxUSE_FILESYSTEM + +#endif // _WX_FS_MEM_H_ + diff --git a/Externals/wxWidgets/include/wx/fs_zip.h b/Externals/wxWidgets/include/wx/fs_zip.h index e33a0674da..8d39e9fc4d 100644 --- a/Externals/wxWidgets/include/wx/fs_zip.h +++ b/Externals/wxWidgets/include/wx/fs_zip.h @@ -1,23 +1,23 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/fs_zip.h -// Purpose: wxZipFSHandler typedef for compatibility -// Author: Mike Wetherell -// Copyright: (c) 2006 Mike Wetherell -// CVS-ID: $Id: fs_zip.h 42713 2006-10-30 11:56:12Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FS_ZIP_H_ -#define _WX_FS_ZIP_H_ - -#include "wx/defs.h" - -#if wxUSE_FS_ZIP - -#include "wx/fs_arc.h" - -typedef wxArchiveFSHandler wxZipFSHandler; - -#endif // wxUSE_FS_ZIP - -#endif // _WX_FS_ZIP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_zip.h +// Purpose: wxZipFSHandler typedef for compatibility +// Author: Mike Wetherell +// Copyright: (c) 2006 Mike Wetherell +// CVS-ID: $Id: fs_zip.h 42713 2006-10-30 11:56:12Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_ZIP_H_ +#define _WX_FS_ZIP_H_ + +#include "wx/defs.h" + +#if wxUSE_FS_ZIP + +#include "wx/fs_arc.h" + +typedef wxArchiveFSHandler wxZipFSHandler; + +#endif // wxUSE_FS_ZIP + +#endif // _WX_FS_ZIP_H_ diff --git a/Externals/wxWidgets/include/wx/gauge.h b/Externals/wxWidgets/include/wx/gauge.h index a6246ca42d..a8accc082a 100644 --- a/Externals/wxWidgets/include/wx/gauge.h +++ b/Externals/wxWidgets/include/wx/gauge.h @@ -1,126 +1,126 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/gauge.h -// Purpose: wxGauge interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.02.01 -// RCS-ID: $Id: gauge.h 41089 2006-09-09 13:36:54Z RR $ -// Copyright: (c) 1996-2001 wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GAUGE_H_BASE_ -#define _WX_GAUGE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_GAUGE - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxGauge style flags -// ---------------------------------------------------------------------------- - -#define wxGA_HORIZONTAL wxHORIZONTAL -#define wxGA_VERTICAL wxVERTICAL - -// Win32 only, is default (and only) on some other platforms -#define wxGA_SMOOTH 0x0020 - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete style - #define wxGA_PROGRESSBAR 0 -#endif // WXWIN_COMPATIBILITY_2_6 - -// GTK and Mac always have native implementation of the indeterminate mode -// wxMSW has native implementation only if comctl32.dll >= 6.00 -#if !defined(__WXGTK20__) && !defined(__WXMAC__) && !defined(__WXCOCOA__) - #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1 -#else - #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 -#endif - -extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; - -// ---------------------------------------------------------------------------- -// wxGauge: a progress bar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGaugeBase : public wxControl -{ -public: - wxGaugeBase() { m_rangeMax = m_gaugePos = 0; } - virtual ~wxGaugeBase(); - - bool Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - // determinate mode API - - // set/get the control range - virtual void SetRange(int range); - virtual int GetRange() const; - - virtual void SetValue(int pos); - virtual int GetValue() const; - - // indeterminate mode API - virtual void Pulse(); - - // simple accessors - bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } - - // appearance params (not implemented for most ports) - virtual void SetShadowWidth(int w); - virtual int GetShadowWidth() const; - - virtual void SetBezelFace(int w); - virtual int GetBezelFace() const; - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - -protected: - // the max position - int m_rangeMax; - - // the current position - int m_gaugePos; - -#if wxGAUGE_EMULATE_INDETERMINATE_MODE - int m_nDirection; // can be wxRIGHT or wxLEFT -#endif - - DECLARE_NO_COPY_CLASS(wxGaugeBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/gauge.h" -#elif defined(__WXMSW__) - #include "wx/msw/gauge95.h" - #define wxGauge wxGauge95 -#elif defined(__WXMOTIF__) - #include "wx/motif/gauge.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/gauge.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/gauge.h" -#elif defined(__WXMAC__) - #include "wx/mac/gauge.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/gauge.h" -#elif defined(__WXPM__) - #include "wx/os2/gauge.h" -#endif - -#endif // wxUSE_GAUGE - -#endif - // _WX_GAUGE_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gauge.h +// Purpose: wxGauge interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.02.01 +// RCS-ID: $Id: gauge.h 41089 2006-09-09 13:36:54Z RR $ +// Copyright: (c) 1996-2001 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GAUGE_H_BASE_ +#define _WX_GAUGE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_GAUGE + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxGauge style flags +// ---------------------------------------------------------------------------- + +#define wxGA_HORIZONTAL wxHORIZONTAL +#define wxGA_VERTICAL wxVERTICAL + +// Win32 only, is default (and only) on some other platforms +#define wxGA_SMOOTH 0x0020 + +#if WXWIN_COMPATIBILITY_2_6 + // obsolete style + #define wxGA_PROGRESSBAR 0 +#endif // WXWIN_COMPATIBILITY_2_6 + +// GTK and Mac always have native implementation of the indeterminate mode +// wxMSW has native implementation only if comctl32.dll >= 6.00 +#if !defined(__WXGTK20__) && !defined(__WXMAC__) && !defined(__WXCOCOA__) + #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1 +#else + #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 +#endif + +extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; + +// ---------------------------------------------------------------------------- +// wxGauge: a progress bar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGaugeBase : public wxControl +{ +public: + wxGaugeBase() { m_rangeMax = m_gaugePos = 0; } + virtual ~wxGaugeBase(); + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + // determinate mode API + + // set/get the control range + virtual void SetRange(int range); + virtual int GetRange() const; + + virtual void SetValue(int pos); + virtual int GetValue() const; + + // indeterminate mode API + virtual void Pulse(); + + // simple accessors + bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } + + // appearance params (not implemented for most ports) + virtual void SetShadowWidth(int w); + virtual int GetShadowWidth() const; + + virtual void SetBezelFace(int w); + virtual int GetBezelFace() const; + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return false; } + +protected: + // the max position + int m_rangeMax; + + // the current position + int m_gaugePos; + +#if wxGAUGE_EMULATE_INDETERMINATE_MODE + int m_nDirection; // can be wxRIGHT or wxLEFT +#endif + + DECLARE_NO_COPY_CLASS(wxGaugeBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/gauge.h" +#elif defined(__WXMSW__) + #include "wx/msw/gauge95.h" + #define wxGauge wxGauge95 +#elif defined(__WXMOTIF__) + #include "wx/motif/gauge.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/gauge.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/gauge.h" +#elif defined(__WXMAC__) + #include "wx/mac/gauge.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/gauge.h" +#elif defined(__WXPM__) + #include "wx/os2/gauge.h" +#endif + +#endif // wxUSE_GAUGE + +#endif + // _WX_GAUGE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/gbsizer.h b/Externals/wxWidgets/include/wx/gbsizer.h index dd2f31bec7..9ea8b9e91e 100644 --- a/Externals/wxWidgets/include/wx/gbsizer.h +++ b/Externals/wxWidgets/include/wx/gbsizer.h @@ -1,303 +1,303 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: gbsizer.h -// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, -// with items at specified cells, and with the option of row -// and/or column spanning -// -// Author: Robin Dunn -// Created: 03-Nov-2003 -// RCS-ID: $Id: gbsizer.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Robin Dunn -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXGBSIZER_H__ -#define __WXGBSIZER_H__ - -#include "wx/sizer.h" - - -//--------------------------------------------------------------------------- -// Classes to represent a position in the grid and a size of an item in the -// grid, IOW, the number of rows and columns it occupies. I chose to use these -// instead of wxPoint and wxSize because they are (x,y) and usually pixel -// oriented while grids and tables are usually thought of as (row,col) so some -// confusion would definitely result in using wxPoint... -// -// NOTE: This should probably be refactored to a common RowCol data type which -// is used for this and also for wxGridCellCoords. -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxGBPosition -{ -public: - wxGBPosition() : m_row(0), m_col(0) {} - wxGBPosition(int row, int col) : m_row(row), m_col(col) {} - - // default copy ctor and assignment operator are okay. - - int GetRow() const { return m_row; } - int GetCol() const { return m_col; } - void SetRow(int row) { m_row = row; } - void SetCol(int col) { m_col = col; } - - bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; } - bool operator!=(const wxGBPosition& p) const { return !(*this == p); } - -private: - int m_row; - int m_col; -}; - - -class WXDLLEXPORT wxGBSpan -{ -public: - wxGBSpan() : m_rowspan(1), m_colspan(1) {} - wxGBSpan(int rowspan, int colspan) : m_rowspan(rowspan), m_colspan(colspan) {} - - // default copy ctor and assignment operator are okay. - - int GetRowspan() const { return m_rowspan; } - int GetColspan() const { return m_colspan; } - void SetRowspan(int rowspan) { m_rowspan = rowspan; } - void SetColspan(int colspan) { m_colspan = colspan; } - - bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } - bool operator!=(const wxGBSpan& o) const { return !(*this == o); } - -private: - int m_rowspan; - int m_colspan; -}; - - -extern WXDLLEXPORT_DATA(const wxGBSpan) wxDefaultSpan; - - -//--------------------------------------------------------------------------- -// wxGBSizerItem -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; - - -class WXDLLEXPORT wxGBSizerItem : public wxSizerItem -{ -public: - // spacer - wxGBSizerItem( int width, - int height, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData); - - // window - wxGBSizerItem( wxWindow *window, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ); - - // subsizer - wxGBSizerItem( wxSizer *sizer, - const wxGBPosition& pos, - const wxGBSpan& span, - int flag, - int border, - wxObject* userData ); - - // default ctor - wxGBSizerItem(); - - - // Get the grid position of the item - wxGBPosition GetPos() const { return m_pos; } - void GetPos(int& row, int& col) const; - - // Get the row and column spanning of the item - wxGBSpan GetSpan() const { return m_span; } - void GetSpan(int& rowspan, int& colspan) const; - - // If the item is already a member of a sizer then first ensure that there - // is no other item that would intersect with this one at the new - // position, then set the new position. Returns true if the change is - // successful and after the next Layout the item will be moved. - bool SetPos( const wxGBPosition& pos ); - - // If the item is already a member of a sizer then first ensure that there - // is no other item that would intersect with this one with its new - // spanning size, then set the new spanning. Returns true if the change - // is successful and after the next Layout the item will be resized. - bool SetSpan( const wxGBSpan& span ); - - // Returns true if this item and the other item instersect - bool Intersects(const wxGBSizerItem& other); - - // Returns true if the given pos/span would intersect with this item. - bool Intersects(const wxGBPosition& pos, const wxGBSpan& span); - - // Get the row and column of the endpoint of this item - void GetEndPos(int& row, int& col); - - - wxGridBagSizer* GetGBSizer() const { return m_gbsizer; } - void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; } - - -protected: - wxGBPosition m_pos; - wxGBSpan m_span; - wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects - - -private: - DECLARE_DYNAMIC_CLASS(wxGBSizerItem) - DECLARE_NO_COPY_CLASS(wxGBSizerItem) -}; - - -//--------------------------------------------------------------------------- -// wxGridBagSizer -//--------------------------------------------------------------------------- - - -class WXDLLEXPORT wxGridBagSizer : public wxFlexGridSizer -{ -public: - wxGridBagSizer(int vgap = 0, int hgap = 0 ); - - // The Add methods return true if the item was successfully placed at the - // given position, false if something was already there. - wxSizerItem* Add( wxWindow *window, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - wxSizerItem* Add( wxSizer *sizer, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - wxSizerItem* Add( int width, - int height, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - wxSizerItem* Add( wxGBSizerItem *item ); - - - // Get/Set the size used for cells in the grid with no item. - wxSize GetEmptyCellSize() const { return m_emptyCellSize; } - void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; } - - // Get the size of the specified cell, including hgap and vgap. Only - // valid after a Layout. - wxSize GetCellSize(int row, int col) const; - - // Get the grid position of the specified item (non-recursive) - wxGBPosition GetItemPosition(wxWindow *window); - wxGBPosition GetItemPosition(wxSizer *sizer); - wxGBPosition GetItemPosition(size_t index); - - // Set the grid position of the specified item. Returns true on success. - // If the move is not allowed (because an item is already there) then - // false is returned. (non-recursive) - bool SetItemPosition(wxWindow *window, const wxGBPosition& pos); - bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos); - bool SetItemPosition(size_t index, const wxGBPosition& pos); - - // Get the row/col spanning of the specified item (non-recursive) - wxGBSpan GetItemSpan(wxWindow *window); - wxGBSpan GetItemSpan(wxSizer *sizer); - wxGBSpan GetItemSpan(size_t index); - - // Set the row/col spanning of the specified item. Returns true on - // success. If the move is not allowed (because an item is already there) - // then false is returned. (non-recursive) - bool SetItemSpan(wxWindow *window, const wxGBSpan& span); - bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); - bool SetItemSpan(size_t index, const wxGBSpan& span); - - - // Find the sizer item for the given window or subsizer, returns NULL if - // not found. (non-recursive) - wxGBSizerItem* FindItem(wxWindow* window); - wxGBSizerItem* FindItem(wxSizer* sizer); - - - // Return the sizer item for the given grid cell, or NULL if there is no - // item at that position. (non-recursive) - wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); - - - // Return the sizer item located at the point given in pt, or NULL if - // there is no item at that point. The (x,y) coordinates in pt correspond - // to the client coordinates of the window using the sizer for - // layout. (non-recursive) - wxGBSizerItem* FindItemAtPoint(const wxPoint& pt); - - - // Return the sizer item that has a matching user data (it only compares - // pointer values) or NULL if not found. (non-recursive) - wxGBSizerItem* FindItemWithData(const wxObject* userData); - - - // These are what make the sizer do size calculations and layout - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - - - // Look at all items and see if any intersect (or would overlap) the given - // item. Returns true if so, false if there would be no overlap. If an - // excludeItem is given then it will not be checked for intersection, for - // example it may be the item we are checking the position of. - bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); - bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); - - - // The Add base class virtuals should not be used with this class, but - // we'll try to make them automatically select a location for the item - // anyway. - virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - - // The Insert and Prepend base class virtuals that are not appropriate for - // this class and should not be used. Their implementation in this class - // simply fails. - virtual wxSizerItem* Add( wxSizerItem *item ); - virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ); - virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Prepend( wxSizerItem *item ); - - -protected: - wxGBPosition FindEmptyCell(); -#if wxABI_VERSION >= 20808 - void AdjustForOverflow(); -#endif - - wxSize m_emptyCellSize; - - -private: - - DECLARE_CLASS(wxGridBagSizer) - DECLARE_NO_COPY_CLASS(wxGridBagSizer) -}; - -//--------------------------------------------------------------------------- -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: gbsizer.h +// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, +// with items at specified cells, and with the option of row +// and/or column spanning +// +// Author: Robin Dunn +// Created: 03-Nov-2003 +// RCS-ID: $Id: gbsizer.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Robin Dunn +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WXGBSIZER_H__ +#define __WXGBSIZER_H__ + +#include "wx/sizer.h" + + +//--------------------------------------------------------------------------- +// Classes to represent a position in the grid and a size of an item in the +// grid, IOW, the number of rows and columns it occupies. I chose to use these +// instead of wxPoint and wxSize because they are (x,y) and usually pixel +// oriented while grids and tables are usually thought of as (row,col) so some +// confusion would definitely result in using wxPoint... +// +// NOTE: This should probably be refactored to a common RowCol data type which +// is used for this and also for wxGridCellCoords. +//--------------------------------------------------------------------------- + +class WXDLLEXPORT wxGBPosition +{ +public: + wxGBPosition() : m_row(0), m_col(0) {} + wxGBPosition(int row, int col) : m_row(row), m_col(col) {} + + // default copy ctor and assignment operator are okay. + + int GetRow() const { return m_row; } + int GetCol() const { return m_col; } + void SetRow(int row) { m_row = row; } + void SetCol(int col) { m_col = col; } + + bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; } + bool operator!=(const wxGBPosition& p) const { return !(*this == p); } + +private: + int m_row; + int m_col; +}; + + +class WXDLLEXPORT wxGBSpan +{ +public: + wxGBSpan() : m_rowspan(1), m_colspan(1) {} + wxGBSpan(int rowspan, int colspan) : m_rowspan(rowspan), m_colspan(colspan) {} + + // default copy ctor and assignment operator are okay. + + int GetRowspan() const { return m_rowspan; } + int GetColspan() const { return m_colspan; } + void SetRowspan(int rowspan) { m_rowspan = rowspan; } + void SetColspan(int colspan) { m_colspan = colspan; } + + bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } + bool operator!=(const wxGBSpan& o) const { return !(*this == o); } + +private: + int m_rowspan; + int m_colspan; +}; + + +extern WXDLLEXPORT_DATA(const wxGBSpan) wxDefaultSpan; + + +//--------------------------------------------------------------------------- +// wxGBSizerItem +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; + + +class WXDLLEXPORT wxGBSizerItem : public wxSizerItem +{ +public: + // spacer + wxGBSizerItem( int width, + int height, + const wxGBPosition& pos, + const wxGBSpan& span, + int flag, + int border, + wxObject* userData); + + // window + wxGBSizerItem( wxWindow *window, + const wxGBPosition& pos, + const wxGBSpan& span, + int flag, + int border, + wxObject* userData ); + + // subsizer + wxGBSizerItem( wxSizer *sizer, + const wxGBPosition& pos, + const wxGBSpan& span, + int flag, + int border, + wxObject* userData ); + + // default ctor + wxGBSizerItem(); + + + // Get the grid position of the item + wxGBPosition GetPos() const { return m_pos; } + void GetPos(int& row, int& col) const; + + // Get the row and column spanning of the item + wxGBSpan GetSpan() const { return m_span; } + void GetSpan(int& rowspan, int& colspan) const; + + // If the item is already a member of a sizer then first ensure that there + // is no other item that would intersect with this one at the new + // position, then set the new position. Returns true if the change is + // successful and after the next Layout the item will be moved. + bool SetPos( const wxGBPosition& pos ); + + // If the item is already a member of a sizer then first ensure that there + // is no other item that would intersect with this one with its new + // spanning size, then set the new spanning. Returns true if the change + // is successful and after the next Layout the item will be resized. + bool SetSpan( const wxGBSpan& span ); + + // Returns true if this item and the other item instersect + bool Intersects(const wxGBSizerItem& other); + + // Returns true if the given pos/span would intersect with this item. + bool Intersects(const wxGBPosition& pos, const wxGBSpan& span); + + // Get the row and column of the endpoint of this item + void GetEndPos(int& row, int& col); + + + wxGridBagSizer* GetGBSizer() const { return m_gbsizer; } + void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; } + + +protected: + wxGBPosition m_pos; + wxGBSpan m_span; + wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects + + +private: + DECLARE_DYNAMIC_CLASS(wxGBSizerItem) + DECLARE_NO_COPY_CLASS(wxGBSizerItem) +}; + + +//--------------------------------------------------------------------------- +// wxGridBagSizer +//--------------------------------------------------------------------------- + + +class WXDLLEXPORT wxGridBagSizer : public wxFlexGridSizer +{ +public: + wxGridBagSizer(int vgap = 0, int hgap = 0 ); + + // The Add methods return true if the item was successfully placed at the + // given position, false if something was already there. + wxSizerItem* Add( wxWindow *window, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( wxSizer *sizer, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( int width, + int height, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( wxGBSizerItem *item ); + + + // Get/Set the size used for cells in the grid with no item. + wxSize GetEmptyCellSize() const { return m_emptyCellSize; } + void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; } + + // Get the size of the specified cell, including hgap and vgap. Only + // valid after a Layout. + wxSize GetCellSize(int row, int col) const; + + // Get the grid position of the specified item (non-recursive) + wxGBPosition GetItemPosition(wxWindow *window); + wxGBPosition GetItemPosition(wxSizer *sizer); + wxGBPosition GetItemPosition(size_t index); + + // Set the grid position of the specified item. Returns true on success. + // If the move is not allowed (because an item is already there) then + // false is returned. (non-recursive) + bool SetItemPosition(wxWindow *window, const wxGBPosition& pos); + bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos); + bool SetItemPosition(size_t index, const wxGBPosition& pos); + + // Get the row/col spanning of the specified item (non-recursive) + wxGBSpan GetItemSpan(wxWindow *window); + wxGBSpan GetItemSpan(wxSizer *sizer); + wxGBSpan GetItemSpan(size_t index); + + // Set the row/col spanning of the specified item. Returns true on + // success. If the move is not allowed (because an item is already there) + // then false is returned. (non-recursive) + bool SetItemSpan(wxWindow *window, const wxGBSpan& span); + bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); + bool SetItemSpan(size_t index, const wxGBSpan& span); + + + // Find the sizer item for the given window or subsizer, returns NULL if + // not found. (non-recursive) + wxGBSizerItem* FindItem(wxWindow* window); + wxGBSizerItem* FindItem(wxSizer* sizer); + + + // Return the sizer item for the given grid cell, or NULL if there is no + // item at that position. (non-recursive) + wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); + + + // Return the sizer item located at the point given in pt, or NULL if + // there is no item at that point. The (x,y) coordinates in pt correspond + // to the client coordinates of the window using the sizer for + // layout. (non-recursive) + wxGBSizerItem* FindItemAtPoint(const wxPoint& pt); + + + // Return the sizer item that has a matching user data (it only compares + // pointer values) or NULL if not found. (non-recursive) + wxGBSizerItem* FindItemWithData(const wxObject* userData); + + + // These are what make the sizer do size calculations and layout + virtual void RecalcSizes(); + virtual wxSize CalcMin(); + + + // Look at all items and see if any intersect (or would overlap) the given + // item. Returns true if so, false if there would be no overlap. If an + // excludeItem is given then it will not be checked for intersection, for + // example it may be the item we are checking the position of. + bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); + bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); + + + // The Add base class virtuals should not be used with this class, but + // we'll try to make them automatically select a location for the item + // anyway. + virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + + // The Insert and Prepend base class virtuals that are not appropriate for + // this class and should not be used. Their implementation in this class + // simply fails. + virtual wxSizerItem* Add( wxSizerItem *item ); + virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ); + virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( wxSizerItem *item ); + + +protected: + wxGBPosition FindEmptyCell(); +#if wxABI_VERSION >= 20808 + void AdjustForOverflow(); +#endif + + wxSize m_emptyCellSize; + + +private: + + DECLARE_CLASS(wxGridBagSizer) + DECLARE_NO_COPY_CLASS(wxGridBagSizer) +}; + +//--------------------------------------------------------------------------- +#endif diff --git a/Externals/wxWidgets/include/wx/gdicmn.h b/Externals/wxWidgets/include/wx/gdicmn.h index 2b9e71b053..3ec1f6ac63 100644 --- a/Externals/wxWidgets/include/wx/gdicmn.h +++ b/Externals/wxWidgets/include/wx/gdicmn.h @@ -1,755 +1,755 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/gdicmn.h -// Purpose: Common GDI classes, types and declarations -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: gdicmn.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GDICMNH__ -#define _WX_GDICMNH__ - -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/list.h" -#include "wx/string.h" -#include "wx/fontenc.h" -#include "wx/hashmap.h" -#include "wx/math.h" - -// --------------------------------------------------------------------------- -// forward declarations -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxBrush; -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxFont; -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxPalette; -class WXDLLIMPEXP_FWD_CORE wxPen; -class WXDLLIMPEXP_FWD_CORE wxRegion; -class WXDLLIMPEXP_FWD_BASE wxString; - -// --------------------------------------------------------------------------- -// constants -// --------------------------------------------------------------------------- - -// Bitmap flags -enum wxBitmapType -{ - wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! - wxBITMAP_TYPE_BMP, - wxBITMAP_TYPE_BMP_RESOURCE, - wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, - wxBITMAP_TYPE_ICO, - wxBITMAP_TYPE_ICO_RESOURCE, - wxBITMAP_TYPE_CUR, - wxBITMAP_TYPE_CUR_RESOURCE, - wxBITMAP_TYPE_XBM, - wxBITMAP_TYPE_XBM_DATA, - wxBITMAP_TYPE_XPM, - wxBITMAP_TYPE_XPM_DATA, - wxBITMAP_TYPE_TIF, - wxBITMAP_TYPE_TIF_RESOURCE, - wxBITMAP_TYPE_GIF, - wxBITMAP_TYPE_GIF_RESOURCE, - wxBITMAP_TYPE_PNG, - wxBITMAP_TYPE_PNG_RESOURCE, - wxBITMAP_TYPE_JPEG, - wxBITMAP_TYPE_JPEG_RESOURCE, - wxBITMAP_TYPE_PNM, - wxBITMAP_TYPE_PNM_RESOURCE, - wxBITMAP_TYPE_PCX, - wxBITMAP_TYPE_PCX_RESOURCE, - wxBITMAP_TYPE_PICT, - wxBITMAP_TYPE_PICT_RESOURCE, - wxBITMAP_TYPE_ICON, - wxBITMAP_TYPE_ICON_RESOURCE, - wxBITMAP_TYPE_ANI, - wxBITMAP_TYPE_IFF, - wxBITMAP_TYPE_TGA, - wxBITMAP_TYPE_MACCURSOR, - wxBITMAP_TYPE_MACCURSOR_RESOURCE, - wxBITMAP_TYPE_ANY = 50 -}; - -// Standard cursors -enum wxStockCursor -{ - wxCURSOR_NONE, // should be 0 - wxCURSOR_ARROW, - wxCURSOR_RIGHT_ARROW, - wxCURSOR_BULLSEYE, - wxCURSOR_CHAR, - wxCURSOR_CROSS, - wxCURSOR_HAND, - wxCURSOR_IBEAM, - wxCURSOR_LEFT_BUTTON, - wxCURSOR_MAGNIFIER, - wxCURSOR_MIDDLE_BUTTON, - wxCURSOR_NO_ENTRY, - wxCURSOR_PAINT_BRUSH, - wxCURSOR_PENCIL, - wxCURSOR_POINT_LEFT, - wxCURSOR_POINT_RIGHT, - wxCURSOR_QUESTION_ARROW, - wxCURSOR_RIGHT_BUTTON, - wxCURSOR_SIZENESW, - wxCURSOR_SIZENS, - wxCURSOR_SIZENWSE, - wxCURSOR_SIZEWE, - wxCURSOR_SIZING, - wxCURSOR_SPRAYCAN, - wxCURSOR_WAIT, - wxCURSOR_WATCH, - wxCURSOR_BLANK, -#ifdef __WXGTK__ - wxCURSOR_DEFAULT, // standard X11 cursor -#endif -#ifdef __WXMAC__ - wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow -#endif -#ifdef __X__ - // Not yet implemented for Windows - wxCURSOR_CROSS_REVERSE, - wxCURSOR_DOUBLE_ARROW, - wxCURSOR_BASED_ARROW_UP, - wxCURSOR_BASED_ARROW_DOWN, -#endif // X11 - - wxCURSOR_ARROWWAIT, - - wxCURSOR_MAX -}; - -#ifndef __WXGTK__ - #define wxCURSOR_DEFAULT wxCURSOR_ARROW -#endif - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -/* Useful macro for creating icons portably, for example: - - wxIcon *icon = new wxICON(mondrian); - - expands into: - - wxIcon *icon = new wxIcon("mondrian"); // On wxMSW - wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK - */ - -#ifdef __WXMSW__ - // Load from a resource - #define wxICON(X) wxIcon(wxT(#X)) -#elif defined(__WXPM__) - // Load from a resource - #define wxICON(X) wxIcon(wxT(#X)) -#elif defined(__WXMGL__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXDFB__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXGTK__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXMAC__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( (const char**) X##_xpm ) -#elif defined(__WXMOTIF__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) -#elif defined(__WXX11__) - // Initialize from an included XPM - #define wxICON(X) wxIcon( X##_xpm ) -#else - // This will usually mean something on any platform - #define wxICON(X) wxIcon(wxT(#X)) -#endif // platform - -/* Another macro: this one is for portable creation of bitmaps. We assume that - under Unix bitmaps live in XPMs and under Windows they're in ressources. - */ - -#if defined(__WXMSW__) || defined(__WXPM__) - #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) -#elif defined(__WXGTK__) || \ - defined(__WXMOTIF__) || \ - defined(__WXX11__) || \ - defined(__WXMAC__) || \ - defined(__WXMGL__) || \ - defined(__WXDFB__) || \ - defined(__WXCOCOA__) - // Initialize from an included XPM - #define wxBITMAP(name) wxBitmap( (const char**) name##_xpm ) -#else // other platforms - #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) -#endif // platform - -// =========================================================================== -// classes -// =========================================================================== - -// --------------------------------------------------------------------------- -// wxSize -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxSize -{ -public: - // members are public for compatibility, don't use them directly. - int x, y; - - // constructors - wxSize() : x(0), y(0) { } - wxSize(int xx, int yy) : x(xx), y(yy) { } - - // no copy ctor or assignment operator - the defaults are ok - - bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } - bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } - - wxSize operator+(const wxSize& sz) const { return wxSize(x + sz.x, y + sz.y); } - wxSize operator-(const wxSize& sz) const { return wxSize(x - sz.x, y - sz.y); } - wxSize operator/(int i) const { return wxSize(x / i, y / i); } - wxSize operator*(int i) const { return wxSize(x * i, y * i); } - - wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } - wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } - wxSize& operator/=(const int i) { x /= i; y /= i; return *this; } - wxSize& operator*=(const int i) { x *= i; y *= i; return *this; } - - void IncTo(const wxSize& sz) - { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } - void DecTo(const wxSize& sz) - { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } - - void IncBy(int dx, int dy) { x += dx; y += dy; } - void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } - void IncBy(int d) { IncBy(d, d); } - - void DecBy(int dx, int dy) { IncBy(-dx, -dy); } - void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } - void DecBy(int d) { DecBy(d, d); } - - - wxSize& Scale(float xscale, float yscale) - { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } - - // accessors - void Set(int xx, int yy) { x = xx; y = yy; } - void SetWidth(int w) { x = w; } - void SetHeight(int h) { y = h; } - - int GetWidth() const { return x; } - int GetHeight() const { return y; } - - bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } - - // combine this size with the other one replacing the default (i.e. equal - // to wxDefaultCoord) components of this object with those of the other - void SetDefaults(const wxSize& size) - { - if ( x == wxDefaultCoord ) - x = size.x; - if ( y == wxDefaultCoord ) - y = size.y; - } - - // compatibility - int GetX() const { return x; } - int GetY() const { return y; } -}; - -// --------------------------------------------------------------------------- -// Point classes: with real or integer coordinates -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxRealPoint -{ -public: - double x; - double y; - - wxRealPoint() : x(0.0), y(0.0) { } - wxRealPoint(double xx, double yy) : x(xx), y(yy) { } - - wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } - wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } - - bool operator==(const wxRealPoint& pt) const - { - return wxIsSameDouble(x, pt.x) && wxIsSameDouble(y, pt.y); - } - bool operator!=(const wxRealPoint& pt) const { return !(*this == pt); } -}; - - -class WXDLLEXPORT wxPoint -{ -public: - int x, y; - - wxPoint() : x(0), y(0) { } - wxPoint(int xx, int yy) : x(xx), y(yy) { } - - // no copy ctor or assignment operator - the defaults are ok - - // comparison - bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } - bool operator!=(const wxPoint& p) const { return !(*this == p); } - - // arithmetic operations (component wise) - wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } - wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } - - wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } - wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } - - wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } - wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } - - wxPoint operator+(const wxSize& s) const { return wxPoint(x + s.GetWidth(), y + s.GetHeight()); } - wxPoint operator-(const wxSize& s) const { return wxPoint(x - s.GetWidth(), y - s.GetHeight()); } - - wxPoint operator-() const { return wxPoint(-x, -y); } -}; - -// --------------------------------------------------------------------------- -// wxRect -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxRect -{ -public: - wxRect() - : x(0), y(0), width(0), height(0) - { } - wxRect(int xx, int yy, int ww, int hh) - : x(xx), y(yy), width(ww), height(hh) - { } - wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRect(const wxPoint& pt, const wxSize& size) - : x(pt.x), y(pt.y), width(size.x), height(size.y) - { } - wxRect(const wxSize& size) - : x(0), y(0), width(size.x), height(size.y) - { } - - // default copy ctor and assignment operators ok - - int GetX() const { return x; } - void SetX(int xx) { x = xx; } - - int GetY() const { return y; } - void SetY(int yy) { y = yy; } - - int GetWidth() const { return width; } - void SetWidth(int w) { width = w; } - - int GetHeight() const { return height; } - void SetHeight(int h) { height = h; } - - wxPoint GetPosition() const { return wxPoint(x, y); } - void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } - - wxSize GetSize() const { return wxSize(width, height); } - void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } - - bool IsEmpty() const { return (width <= 0) || (height <= 0); } - - int GetLeft() const { return x; } - int GetTop() const { return y; } - int GetBottom() const { return y + height - 1; } - int GetRight() const { return x + width - 1; } - - void SetLeft(int left) { x = left; } - void SetRight(int right) { width = right - x + 1; } - void SetTop(int top) { y = top; } - void SetBottom(int bottom) { height = bottom - y + 1; } - - wxPoint GetTopLeft() const { return GetPosition(); } - wxPoint GetLeftTop() const { return GetTopLeft(); } - void SetTopLeft(const wxPoint &p) { SetPosition(p); } - void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } - - wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } - wxPoint GetRightBottom() const { return GetBottomRight(); } - void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } - void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } - - wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } - wxPoint GetRightTop() const { return GetTopRight(); } - void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } - void SetRightTop(const wxPoint &p) { SetTopLeft(p); } - - wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } - wxPoint GetLeftBottom() const { return GetBottomLeft(); } - void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } - void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } - - // operations with rect - wxRect& Inflate(wxCoord dx, wxCoord dy); - wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } - wxRect& Inflate(wxCoord d) { return Inflate(d, d); } - wxRect Inflate(wxCoord dx, wxCoord dy) const - { - wxRect r = *this; - r.Inflate(dx, dy); - return r; - } - - wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } - wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } - wxRect& Deflate(wxCoord d) { return Inflate(-d); } - wxRect Deflate(wxCoord dx, wxCoord dy) const - { - wxRect r = *this; - r.Deflate(dx, dy); - return r; - } - - void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } - void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } - - wxRect& Intersect(const wxRect& rect); - wxRect Intersect(const wxRect& rect) const - { - wxRect r = *this; - r.Intersect(rect); - return r; - } - - wxRect& Union(const wxRect& rect); - wxRect Union(const wxRect& rect) const - { - wxRect r = *this; - r.Union(rect); - return r; - } - - // compare rectangles - bool operator==(const wxRect& rect) const; - bool operator!=(const wxRect& rect) const { return !(*this == rect); } - - // return true if the point is (not strcitly) inside the rect - bool Contains(int x, int y) const; - bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } - // return true if the rectangle is (not strcitly) inside the rect - bool Contains(const wxRect& rect) const; - -#if WXWIN_COMPATIBILITY_2_6 - // use Contains() instead - wxDEPRECATED( bool Inside(int x, int y) const ); - wxDEPRECATED( bool Inside(const wxPoint& pt) const ); - wxDEPRECATED( bool Inside(const wxRect& rect) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // return true if the rectangles have a non empty intersection - bool Intersects(const wxRect& rect) const; - - - // these are like Union() but don't ignore empty rectangles - wxRect operator+(const wxRect& rect) const; - wxRect& operator+=(const wxRect& rect) - { - *this = *this + rect; - return *this; - } - - - // centre this rectangle in the given (usually, but not necessarily, - // larger) one - wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const - { - return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, - dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, - width, height); - } - - wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const - { - return CentreIn(r, dir); - } - -public: - int x, y, width, height; -}; - -#if WXWIN_COMPATIBILITY_2_6 -inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } -inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } -inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } -#endif // WXWIN_COMPATIBILITY_2_6 - - -// --------------------------------------------------------------------------- -// Management of pens, brushes and fonts -// --------------------------------------------------------------------------- - -typedef wxInt8 wxDash; - -class WXDLLIMPEXP_CORE wxGDIObjListBase { -public: - wxGDIObjListBase(); - ~wxGDIObjListBase(); - -protected: - wxList list; -}; - -class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase -{ -public: - wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddPen(wxPen*) ); - wxDEPRECATED( void RemovePen(wxPen*) ); -#endif -}; - -class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase -{ -public: - wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddBrush(wxBrush*) ); - wxDEPRECATED( void RemoveBrush(wxBrush*) ); -#endif -}; - -class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase -{ -public: - wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, - bool underline = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddFont(wxFont*) ); - wxDEPRECATED( void RemoveFont(wxFont*) ); -#endif -}; - -WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); - -class WXDLLEXPORT wxColourDatabase -{ -public: - wxColourDatabase(); - ~wxColourDatabase(); - - // find colour by name or name for the given colour - wxColour Find(const wxString& name) const; - wxString FindName(const wxColour& colour) const; - - // add a new colour to the database - void AddColour(const wxString& name, const wxColour& colour); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use Find() instead - wxDEPRECATED( wxColour *FindColour(const wxString& name) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - -#ifdef __WXPM__ - // PM keeps its own type of colour table - long* m_palTable; - size_t m_nSize; -#endif - -private: - // load the database with the built in colour values when called for the - // first time, do nothing after this - void Initialize(); - - wxStringToColourHashMap *m_map; -}; - -class WXDLLEXPORT wxResourceCache: public wxList -{ -public: - wxResourceCache() { } -#if !wxUSE_STL - wxResourceCache(const unsigned int keyType) : wxList(keyType) { } -#endif - virtual ~wxResourceCache(); -}; - -// --------------------------------------------------------------------------- -// global variables -// --------------------------------------------------------------------------- - -// Lists of GDI objects -extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList; -extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList; -extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList; - -/* Stock objects - - wxStockGDI creates the stock GDI objects on demand. Pointers to the - created objects are stored in the ms_stockObject array, which is indexed - by the Item enum values. Platorm-specific fonts can be created by - implementing a derived class with an override for the GetFont function. - wxStockGDI operates as a singleton, accessed through the ms_instance - pointer. By default this pointer is set to an instance of wxStockGDI. - A derived class must arrange to set this pointer to an instance of itself. -*/ -class WXDLLIMPEXP_CORE wxStockGDI -{ -public: - enum Item { - BRUSH_BLACK, - BRUSH_BLUE, - BRUSH_CYAN, - BRUSH_GREEN, - BRUSH_GREY, - BRUSH_LIGHTGREY, - BRUSH_MEDIUMGREY, - BRUSH_RED, - BRUSH_TRANSPARENT, - BRUSH_WHITE, - COLOUR_BLACK, - COLOUR_BLUE, - COLOUR_CYAN, - COLOUR_GREEN, - COLOUR_LIGHTGREY, - COLOUR_RED, - COLOUR_WHITE, - CURSOR_CROSS, - CURSOR_HOURGLASS, - CURSOR_STANDARD, - FONT_ITALIC, - FONT_NORMAL, - FONT_SMALL, - FONT_SWISS, - PEN_BLACK, - PEN_BLACKDASHED, - PEN_CYAN, - PEN_GREEN, - PEN_GREY, - PEN_LIGHTGREY, - PEN_MEDIUMGREY, - PEN_RED, - PEN_TRANSPARENT, - PEN_WHITE, - ITEMCOUNT - }; - - wxStockGDI(); - virtual ~wxStockGDI(); - static void DeleteAll(); - - static wxStockGDI& instance() { return *ms_instance; } - - static const wxBrush* GetBrush(Item item); - static const wxColour* GetColour(Item item); - static const wxCursor* GetCursor(Item item); - // Can be overridden by platform-specific derived classes - virtual const wxFont* GetFont(Item item); - static const wxPen* GetPen(Item item); - -protected: - static wxStockGDI* ms_instance; - - static wxObject* ms_stockObject[ITEMCOUNT]; - - DECLARE_NO_COPY_CLASS(wxStockGDI) -}; - -#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) -#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) -#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) -#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) - -#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) -#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) -#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) -#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) -#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) -#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) -#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) -#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) -#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) -#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) - -#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) -#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) -#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) -#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) -#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) -#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) -#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) -#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) -#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) -#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) - -#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) -#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) -#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) -#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) -#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) -#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) -#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) - -#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) -#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) -#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) - -// 'Null' objects -extern WXDLLEXPORT_DATA(wxBitmap) wxNullBitmap; -extern WXDLLEXPORT_DATA(wxIcon) wxNullIcon; -extern WXDLLEXPORT_DATA(wxCursor) wxNullCursor; -extern WXDLLEXPORT_DATA(wxPen) wxNullPen; -extern WXDLLEXPORT_DATA(wxBrush) wxNullBrush; -extern WXDLLEXPORT_DATA(wxPalette) wxNullPalette; -extern WXDLLEXPORT_DATA(wxFont) wxNullFont; -extern WXDLLEXPORT_DATA(wxColour) wxNullColour; - -extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase; - -extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; - -extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; -extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -// resource management -extern void WXDLLEXPORT wxInitializeStockLists(); -extern void WXDLLEXPORT wxDeleteStockLists(); - -// is the display colour (or monochrome)? -extern bool WXDLLEXPORT wxColourDisplay(); - -// Returns depth of screen -extern int WXDLLEXPORT wxDisplayDepth(); -#define wxGetDisplayDepth wxDisplayDepth - -// get the display size -extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); -extern wxSize WXDLLEXPORT wxGetDisplaySize(); -extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); -extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); - -// Get position and size of the display workarea -extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height); -extern wxRect WXDLLEXPORT wxGetClientDisplayRect(); - -// set global cursor -extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); - -#endif - // _WX_GDICMNH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gdicmn.h +// Purpose: Common GDI classes, types and declarations +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: gdicmn.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GDICMNH__ +#define _WX_GDICMNH__ + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/list.h" +#include "wx/string.h" +#include "wx/fontenc.h" +#include "wx/hashmap.h" +#include "wx/math.h" + +// --------------------------------------------------------------------------- +// forward declarations +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxBrush; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxCursor; +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxPalette; +class WXDLLIMPEXP_FWD_CORE wxPen; +class WXDLLIMPEXP_FWD_CORE wxRegion; +class WXDLLIMPEXP_FWD_BASE wxString; + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +// Bitmap flags +enum wxBitmapType +{ + wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! + wxBITMAP_TYPE_BMP, + wxBITMAP_TYPE_BMP_RESOURCE, + wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, + wxBITMAP_TYPE_ICO, + wxBITMAP_TYPE_ICO_RESOURCE, + wxBITMAP_TYPE_CUR, + wxBITMAP_TYPE_CUR_RESOURCE, + wxBITMAP_TYPE_XBM, + wxBITMAP_TYPE_XBM_DATA, + wxBITMAP_TYPE_XPM, + wxBITMAP_TYPE_XPM_DATA, + wxBITMAP_TYPE_TIF, + wxBITMAP_TYPE_TIF_RESOURCE, + wxBITMAP_TYPE_GIF, + wxBITMAP_TYPE_GIF_RESOURCE, + wxBITMAP_TYPE_PNG, + wxBITMAP_TYPE_PNG_RESOURCE, + wxBITMAP_TYPE_JPEG, + wxBITMAP_TYPE_JPEG_RESOURCE, + wxBITMAP_TYPE_PNM, + wxBITMAP_TYPE_PNM_RESOURCE, + wxBITMAP_TYPE_PCX, + wxBITMAP_TYPE_PCX_RESOURCE, + wxBITMAP_TYPE_PICT, + wxBITMAP_TYPE_PICT_RESOURCE, + wxBITMAP_TYPE_ICON, + wxBITMAP_TYPE_ICON_RESOURCE, + wxBITMAP_TYPE_ANI, + wxBITMAP_TYPE_IFF, + wxBITMAP_TYPE_TGA, + wxBITMAP_TYPE_MACCURSOR, + wxBITMAP_TYPE_MACCURSOR_RESOURCE, + wxBITMAP_TYPE_ANY = 50 +}; + +// Standard cursors +enum wxStockCursor +{ + wxCURSOR_NONE, // should be 0 + wxCURSOR_ARROW, + wxCURSOR_RIGHT_ARROW, + wxCURSOR_BULLSEYE, + wxCURSOR_CHAR, + wxCURSOR_CROSS, + wxCURSOR_HAND, + wxCURSOR_IBEAM, + wxCURSOR_LEFT_BUTTON, + wxCURSOR_MAGNIFIER, + wxCURSOR_MIDDLE_BUTTON, + wxCURSOR_NO_ENTRY, + wxCURSOR_PAINT_BRUSH, + wxCURSOR_PENCIL, + wxCURSOR_POINT_LEFT, + wxCURSOR_POINT_RIGHT, + wxCURSOR_QUESTION_ARROW, + wxCURSOR_RIGHT_BUTTON, + wxCURSOR_SIZENESW, + wxCURSOR_SIZENS, + wxCURSOR_SIZENWSE, + wxCURSOR_SIZEWE, + wxCURSOR_SIZING, + wxCURSOR_SPRAYCAN, + wxCURSOR_WAIT, + wxCURSOR_WATCH, + wxCURSOR_BLANK, +#ifdef __WXGTK__ + wxCURSOR_DEFAULT, // standard X11 cursor +#endif +#ifdef __WXMAC__ + wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow +#endif +#ifdef __X__ + // Not yet implemented for Windows + wxCURSOR_CROSS_REVERSE, + wxCURSOR_DOUBLE_ARROW, + wxCURSOR_BASED_ARROW_UP, + wxCURSOR_BASED_ARROW_DOWN, +#endif // X11 + + wxCURSOR_ARROWWAIT, + + wxCURSOR_MAX +}; + +#ifndef __WXGTK__ + #define wxCURSOR_DEFAULT wxCURSOR_ARROW +#endif + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +/* Useful macro for creating icons portably, for example: + + wxIcon *icon = new wxICON(mondrian); + + expands into: + + wxIcon *icon = new wxIcon("mondrian"); // On wxMSW + wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK + */ + +#ifdef __WXMSW__ + // Load from a resource + #define wxICON(X) wxIcon(wxT(#X)) +#elif defined(__WXPM__) + // Load from a resource + #define wxICON(X) wxIcon(wxT(#X)) +#elif defined(__WXMGL__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( (const char**) X##_xpm ) +#elif defined(__WXDFB__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( (const char**) X##_xpm ) +#elif defined(__WXGTK__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( (const char**) X##_xpm ) +#elif defined(__WXMAC__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( (const char**) X##_xpm ) +#elif defined(__WXMOTIF__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXX11__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#else + // This will usually mean something on any platform + #define wxICON(X) wxIcon(wxT(#X)) +#endif // platform + +/* Another macro: this one is for portable creation of bitmaps. We assume that + under Unix bitmaps live in XPMs and under Windows they're in ressources. + */ + +#if defined(__WXMSW__) || defined(__WXPM__) + #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) +#elif defined(__WXGTK__) || \ + defined(__WXMOTIF__) || \ + defined(__WXX11__) || \ + defined(__WXMAC__) || \ + defined(__WXMGL__) || \ + defined(__WXDFB__) || \ + defined(__WXCOCOA__) + // Initialize from an included XPM + #define wxBITMAP(name) wxBitmap( (const char**) name##_xpm ) +#else // other platforms + #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) +#endif // platform + +// =========================================================================== +// classes +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxSize +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxSize +{ +public: + // members are public for compatibility, don't use them directly. + int x, y; + + // constructors + wxSize() : x(0), y(0) { } + wxSize(int xx, int yy) : x(xx), y(yy) { } + + // no copy ctor or assignment operator - the defaults are ok + + bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } + bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } + + wxSize operator+(const wxSize& sz) const { return wxSize(x + sz.x, y + sz.y); } + wxSize operator-(const wxSize& sz) const { return wxSize(x - sz.x, y - sz.y); } + wxSize operator/(int i) const { return wxSize(x / i, y / i); } + wxSize operator*(int i) const { return wxSize(x * i, y * i); } + + wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } + wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } + wxSize& operator/=(const int i) { x /= i; y /= i; return *this; } + wxSize& operator*=(const int i) { x *= i; y *= i; return *this; } + + void IncTo(const wxSize& sz) + { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } + void DecTo(const wxSize& sz) + { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } + + void IncBy(int dx, int dy) { x += dx; y += dy; } + void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } + void IncBy(int d) { IncBy(d, d); } + + void DecBy(int dx, int dy) { IncBy(-dx, -dy); } + void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } + void DecBy(int d) { DecBy(d, d); } + + + wxSize& Scale(float xscale, float yscale) + { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } + + // accessors + void Set(int xx, int yy) { x = xx; y = yy; } + void SetWidth(int w) { x = w; } + void SetHeight(int h) { y = h; } + + int GetWidth() const { return x; } + int GetHeight() const { return y; } + + bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } + + // combine this size with the other one replacing the default (i.e. equal + // to wxDefaultCoord) components of this object with those of the other + void SetDefaults(const wxSize& size) + { + if ( x == wxDefaultCoord ) + x = size.x; + if ( y == wxDefaultCoord ) + y = size.y; + } + + // compatibility + int GetX() const { return x; } + int GetY() const { return y; } +}; + +// --------------------------------------------------------------------------- +// Point classes: with real or integer coordinates +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxRealPoint +{ +public: + double x; + double y; + + wxRealPoint() : x(0.0), y(0.0) { } + wxRealPoint(double xx, double yy) : x(xx), y(yy) { } + + wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } + wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } + + bool operator==(const wxRealPoint& pt) const + { + return wxIsSameDouble(x, pt.x) && wxIsSameDouble(y, pt.y); + } + bool operator!=(const wxRealPoint& pt) const { return !(*this == pt); } +}; + + +class WXDLLEXPORT wxPoint +{ +public: + int x, y; + + wxPoint() : x(0), y(0) { } + wxPoint(int xx, int yy) : x(xx), y(yy) { } + + // no copy ctor or assignment operator - the defaults are ok + + // comparison + bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } + bool operator!=(const wxPoint& p) const { return !(*this == p); } + + // arithmetic operations (component wise) + wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } + wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } + + wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } + wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } + + wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } + wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } + + wxPoint operator+(const wxSize& s) const { return wxPoint(x + s.GetWidth(), y + s.GetHeight()); } + wxPoint operator-(const wxSize& s) const { return wxPoint(x - s.GetWidth(), y - s.GetHeight()); } + + wxPoint operator-() const { return wxPoint(-x, -y); } +}; + +// --------------------------------------------------------------------------- +// wxRect +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxRect +{ +public: + wxRect() + : x(0), y(0), width(0), height(0) + { } + wxRect(int xx, int yy, int ww, int hh) + : x(xx), y(yy), width(ww), height(hh) + { } + wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRect(const wxPoint& pt, const wxSize& size) + : x(pt.x), y(pt.y), width(size.x), height(size.y) + { } + wxRect(const wxSize& size) + : x(0), y(0), width(size.x), height(size.y) + { } + + // default copy ctor and assignment operators ok + + int GetX() const { return x; } + void SetX(int xx) { x = xx; } + + int GetY() const { return y; } + void SetY(int yy) { y = yy; } + + int GetWidth() const { return width; } + void SetWidth(int w) { width = w; } + + int GetHeight() const { return height; } + void SetHeight(int h) { height = h; } + + wxPoint GetPosition() const { return wxPoint(x, y); } + void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } + + wxSize GetSize() const { return wxSize(width, height); } + void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } + + bool IsEmpty() const { return (width <= 0) || (height <= 0); } + + int GetLeft() const { return x; } + int GetTop() const { return y; } + int GetBottom() const { return y + height - 1; } + int GetRight() const { return x + width - 1; } + + void SetLeft(int left) { x = left; } + void SetRight(int right) { width = right - x + 1; } + void SetTop(int top) { y = top; } + void SetBottom(int bottom) { height = bottom - y + 1; } + + wxPoint GetTopLeft() const { return GetPosition(); } + wxPoint GetLeftTop() const { return GetTopLeft(); } + void SetTopLeft(const wxPoint &p) { SetPosition(p); } + void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } + + wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } + wxPoint GetRightBottom() const { return GetBottomRight(); } + void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } + void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } + + wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } + wxPoint GetRightTop() const { return GetTopRight(); } + void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } + void SetRightTop(const wxPoint &p) { SetTopLeft(p); } + + wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } + wxPoint GetLeftBottom() const { return GetBottomLeft(); } + void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } + void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } + + // operations with rect + wxRect& Inflate(wxCoord dx, wxCoord dy); + wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } + wxRect& Inflate(wxCoord d) { return Inflate(d, d); } + wxRect Inflate(wxCoord dx, wxCoord dy) const + { + wxRect r = *this; + r.Inflate(dx, dy); + return r; + } + + wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } + wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } + wxRect& Deflate(wxCoord d) { return Inflate(-d); } + wxRect Deflate(wxCoord dx, wxCoord dy) const + { + wxRect r = *this; + r.Deflate(dx, dy); + return r; + } + + void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } + void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } + + wxRect& Intersect(const wxRect& rect); + wxRect Intersect(const wxRect& rect) const + { + wxRect r = *this; + r.Intersect(rect); + return r; + } + + wxRect& Union(const wxRect& rect); + wxRect Union(const wxRect& rect) const + { + wxRect r = *this; + r.Union(rect); + return r; + } + + // compare rectangles + bool operator==(const wxRect& rect) const; + bool operator!=(const wxRect& rect) const { return !(*this == rect); } + + // return true if the point is (not strcitly) inside the rect + bool Contains(int x, int y) const; + bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } + // return true if the rectangle is (not strcitly) inside the rect + bool Contains(const wxRect& rect) const; + +#if WXWIN_COMPATIBILITY_2_6 + // use Contains() instead + wxDEPRECATED( bool Inside(int x, int y) const ); + wxDEPRECATED( bool Inside(const wxPoint& pt) const ); + wxDEPRECATED( bool Inside(const wxRect& rect) const ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // return true if the rectangles have a non empty intersection + bool Intersects(const wxRect& rect) const; + + + // these are like Union() but don't ignore empty rectangles + wxRect operator+(const wxRect& rect) const; + wxRect& operator+=(const wxRect& rect) + { + *this = *this + rect; + return *this; + } + + + // centre this rectangle in the given (usually, but not necessarily, + // larger) one + wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const + { + return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, + dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, + width, height); + } + + wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const + { + return CentreIn(r, dir); + } + +public: + int x, y, width, height; +}; + +#if WXWIN_COMPATIBILITY_2_6 +inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } +inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } +inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } +#endif // WXWIN_COMPATIBILITY_2_6 + + +// --------------------------------------------------------------------------- +// Management of pens, brushes and fonts +// --------------------------------------------------------------------------- + +typedef wxInt8 wxDash; + +class WXDLLIMPEXP_CORE wxGDIObjListBase { +public: + wxGDIObjListBase(); + ~wxGDIObjListBase(); + +protected: + wxList list; +}; + +class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase +{ +public: + wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void AddPen(wxPen*) ); + wxDEPRECATED( void RemovePen(wxPen*) ); +#endif +}; + +class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase +{ +public: + wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID); +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void AddBrush(wxBrush*) ); + wxDEPRECATED( void RemoveBrush(wxBrush*) ); +#endif +}; + +class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase +{ +public: + wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, + bool underline = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( void AddFont(wxFont*) ); + wxDEPRECATED( void RemoveFont(wxFont*) ); +#endif +}; + +WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); + +class WXDLLEXPORT wxColourDatabase +{ +public: + wxColourDatabase(); + ~wxColourDatabase(); + + // find colour by name or name for the given colour + wxColour Find(const wxString& name) const; + wxString FindName(const wxColour& colour) const; + + // add a new colour to the database + void AddColour(const wxString& name, const wxColour& colour); + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, use Find() instead + wxDEPRECATED( wxColour *FindColour(const wxString& name) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + +#ifdef __WXPM__ + // PM keeps its own type of colour table + long* m_palTable; + size_t m_nSize; +#endif + +private: + // load the database with the built in colour values when called for the + // first time, do nothing after this + void Initialize(); + + wxStringToColourHashMap *m_map; +}; + +class WXDLLEXPORT wxResourceCache: public wxList +{ +public: + wxResourceCache() { } +#if !wxUSE_STL + wxResourceCache(const unsigned int keyType) : wxList(keyType) { } +#endif + virtual ~wxResourceCache(); +}; + +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- + +// Lists of GDI objects +extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList; +extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList; +extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList; + +/* Stock objects + + wxStockGDI creates the stock GDI objects on demand. Pointers to the + created objects are stored in the ms_stockObject array, which is indexed + by the Item enum values. Platorm-specific fonts can be created by + implementing a derived class with an override for the GetFont function. + wxStockGDI operates as a singleton, accessed through the ms_instance + pointer. By default this pointer is set to an instance of wxStockGDI. + A derived class must arrange to set this pointer to an instance of itself. +*/ +class WXDLLIMPEXP_CORE wxStockGDI +{ +public: + enum Item { + BRUSH_BLACK, + BRUSH_BLUE, + BRUSH_CYAN, + BRUSH_GREEN, + BRUSH_GREY, + BRUSH_LIGHTGREY, + BRUSH_MEDIUMGREY, + BRUSH_RED, + BRUSH_TRANSPARENT, + BRUSH_WHITE, + COLOUR_BLACK, + COLOUR_BLUE, + COLOUR_CYAN, + COLOUR_GREEN, + COLOUR_LIGHTGREY, + COLOUR_RED, + COLOUR_WHITE, + CURSOR_CROSS, + CURSOR_HOURGLASS, + CURSOR_STANDARD, + FONT_ITALIC, + FONT_NORMAL, + FONT_SMALL, + FONT_SWISS, + PEN_BLACK, + PEN_BLACKDASHED, + PEN_CYAN, + PEN_GREEN, + PEN_GREY, + PEN_LIGHTGREY, + PEN_MEDIUMGREY, + PEN_RED, + PEN_TRANSPARENT, + PEN_WHITE, + ITEMCOUNT + }; + + wxStockGDI(); + virtual ~wxStockGDI(); + static void DeleteAll(); + + static wxStockGDI& instance() { return *ms_instance; } + + static const wxBrush* GetBrush(Item item); + static const wxColour* GetColour(Item item); + static const wxCursor* GetCursor(Item item); + // Can be overridden by platform-specific derived classes + virtual const wxFont* GetFont(Item item); + static const wxPen* GetPen(Item item); + +protected: + static wxStockGDI* ms_instance; + + static wxObject* ms_stockObject[ITEMCOUNT]; + + DECLARE_NO_COPY_CLASS(wxStockGDI) +}; + +#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) +#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) +#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) +#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) + +#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) +#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) +#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) +#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) +#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) +#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) +#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) +#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) +#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) +#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) + +#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) +#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) +#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) +#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) +#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) +#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) +#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) +#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) +#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) +#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) + +#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) +#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) +#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) +#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) +#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) +#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) +#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) + +#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) +#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) +#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) + +// 'Null' objects +extern WXDLLEXPORT_DATA(wxBitmap) wxNullBitmap; +extern WXDLLEXPORT_DATA(wxIcon) wxNullIcon; +extern WXDLLEXPORT_DATA(wxCursor) wxNullCursor; +extern WXDLLEXPORT_DATA(wxPen) wxNullPen; +extern WXDLLEXPORT_DATA(wxBrush) wxNullBrush; +extern WXDLLEXPORT_DATA(wxPalette) wxNullPalette; +extern WXDLLEXPORT_DATA(wxFont) wxNullFont; +extern WXDLLEXPORT_DATA(wxColour) wxNullColour; + +extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase; + +extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; + +extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; +extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// resource management +extern void WXDLLEXPORT wxInitializeStockLists(); +extern void WXDLLEXPORT wxDeleteStockLists(); + +// is the display colour (or monochrome)? +extern bool WXDLLEXPORT wxColourDisplay(); + +// Returns depth of screen +extern int WXDLLEXPORT wxDisplayDepth(); +#define wxGetDisplayDepth wxDisplayDepth + +// get the display size +extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); +extern wxSize WXDLLEXPORT wxGetDisplaySize(); +extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); +extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); + +// Get position and size of the display workarea +extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height); +extern wxRect WXDLLEXPORT wxGetClientDisplayRect(); + +// set global cursor +extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); + +#endif + // _WX_GDICMNH__ diff --git a/Externals/wxWidgets/include/wx/gdiobj.h b/Externals/wxWidgets/include/wx/gdiobj.h index b4dab27741..55e722bf61 100644 --- a/Externals/wxWidgets/include/wx/gdiobj.h +++ b/Externals/wxWidgets/include/wx/gdiobj.h @@ -1,51 +1,51 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/gdiobj.h -// Purpose: wxGDIObject base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: gdiobj.h 42211 2006-10-21 17:19:11Z SN $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GDIOBJ_H_BASE_ -#define _WX_GDIOBJ_H_BASE_ - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// wxGDIRefData is the base class for wxXXXData structures which contain the -// real data for the GDI object and are shared among all wxWin objects sharing -// the same native GDI object -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGDIRefData: public wxObjectRefData { }; - -// ---------------------------------------------------------------------------- -// wxGDIObject -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGDIObject: public wxObject -{ -public: - bool IsNull() const { return m_refData == NULL; } - -#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXPALMOS__) - // Creates the resource - virtual bool RealizeResource() { return false; } - - // Frees the resource - virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; } - - virtual bool IsFree() const { return false; } - - // Returns handle. - virtual WXHANDLE GetResourceHandle() const { return 0; } -#endif // defined(__WXMSW__) || defined(__WXPM__) - - DECLARE_DYNAMIC_CLASS(wxGDIObject) -}; - -#endif - // _WX_GDIOBJ_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gdiobj.h +// Purpose: wxGDIObject base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: gdiobj.h 42211 2006-10-21 17:19:11Z SN $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GDIOBJ_H_BASE_ +#define _WX_GDIOBJ_H_BASE_ + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxGDIRefData is the base class for wxXXXData structures which contain the +// real data for the GDI object and are shared among all wxWin objects sharing +// the same native GDI object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIRefData: public wxObjectRefData { }; + +// ---------------------------------------------------------------------------- +// wxGDIObject +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIObject: public wxObject +{ +public: + bool IsNull() const { return m_refData == NULL; } + +#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXPALMOS__) + // Creates the resource + virtual bool RealizeResource() { return false; } + + // Frees the resource + virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; } + + virtual bool IsFree() const { return false; } + + // Returns handle. + virtual WXHANDLE GetResourceHandle() const { return 0; } +#endif // defined(__WXMSW__) || defined(__WXPM__) + + DECLARE_DYNAMIC_CLASS(wxGDIObject) +}; + +#endif + // _WX_GDIOBJ_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/generic/aboutdlgg.h b/Externals/wxWidgets/include/wx/generic/aboutdlgg.h index a20e4acf0c..ce524a5c91 100644 --- a/Externals/wxWidgets/include/wx/generic/aboutdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/aboutdlgg.h @@ -1,87 +1,87 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/aboutdlgg.h -// Purpose: generic wxAboutBox() implementation -// Author: Vadim Zeitlin -// Created: 2006-10-07 -// RCS-ID: $Id: aboutdlgg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_ABOUTDLGG_H_ -#define _WX_GENERIC_ABOUTDLGG_H_ - -#include "wx/defs.h" - -#if wxUSE_ABOUTDLG - -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_ADV wxAboutDialogInfo; -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxSizerFlags; - -// ---------------------------------------------------------------------------- -// wxGenericAboutDialog: generic "About" dialog implementation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGenericAboutDialog : public wxDialog -{ -public: - // constructors and Create() method - // -------------------------------- - - // default ctor, you must use Create() to really initialize the dialog - wxGenericAboutDialog() { Init(); } - - // ctor which fully initializes the object - wxGenericAboutDialog(const wxAboutDialogInfo& info) - { - Init(); - - (void)Create(info); - } - - // this method must be called if and only if the default ctor was used - bool Create(const wxAboutDialogInfo& info); - -protected: - // this virtual method may be overridden to add some more controls to the - // dialog - // - // notice that for this to work you must call Create() from the derived - // class ctor and not use the base class ctor directly as otherwise the - // virtual function of the derived class wouldn't be called - virtual void DoAddCustomControls() { } - - // add arbitrary control to the text sizer contents with the specified - // flags - void AddControl(wxWindow *win, const wxSizerFlags& flags); - - // add arbitrary control to the text sizer contents and center it - void AddControl(wxWindow *win); - - // add the text, if it's not empty, to the text sizer contents - void AddText(const wxString& text); - -#if wxUSE_COLLPANE - // add a wxCollapsiblePane containing the given text - void AddCollapsiblePane(const wxString& title, const wxString& text); -#endif // wxUSE_COLLPANE - -private: - // common part of all ctors - void Init() { m_sizerText = NULL; } - - - wxSizer *m_sizerText; -}; - -// unlike wxAboutBox which can show either the native or generic about dialog, -// this function always shows the generic one -WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info); - -#endif // wxUSE_ABOUTDLG - -#endif // _WX_GENERIC_ABOUTDLGG_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/aboutdlgg.h +// Purpose: generic wxAboutBox() implementation +// Author: Vadim Zeitlin +// Created: 2006-10-07 +// RCS-ID: $Id: aboutdlgg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ABOUTDLGG_H_ +#define _WX_GENERIC_ABOUTDLGG_H_ + +#include "wx/defs.h" + +#if wxUSE_ABOUTDLG + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_ADV wxAboutDialogInfo; +class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxSizerFlags; + +// ---------------------------------------------------------------------------- +// wxGenericAboutDialog: generic "About" dialog implementation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGenericAboutDialog : public wxDialog +{ +public: + // constructors and Create() method + // -------------------------------- + + // default ctor, you must use Create() to really initialize the dialog + wxGenericAboutDialog() { Init(); } + + // ctor which fully initializes the object + wxGenericAboutDialog(const wxAboutDialogInfo& info) + { + Init(); + + (void)Create(info); + } + + // this method must be called if and only if the default ctor was used + bool Create(const wxAboutDialogInfo& info); + +protected: + // this virtual method may be overridden to add some more controls to the + // dialog + // + // notice that for this to work you must call Create() from the derived + // class ctor and not use the base class ctor directly as otherwise the + // virtual function of the derived class wouldn't be called + virtual void DoAddCustomControls() { } + + // add arbitrary control to the text sizer contents with the specified + // flags + void AddControl(wxWindow *win, const wxSizerFlags& flags); + + // add arbitrary control to the text sizer contents and center it + void AddControl(wxWindow *win); + + // add the text, if it's not empty, to the text sizer contents + void AddText(const wxString& text); + +#if wxUSE_COLLPANE + // add a wxCollapsiblePane containing the given text + void AddCollapsiblePane(const wxString& title, const wxString& text); +#endif // wxUSE_COLLPANE + +private: + // common part of all ctors + void Init() { m_sizerText = NULL; } + + + wxSizer *m_sizerText; +}; + +// unlike wxAboutBox which can show either the native or generic about dialog, +// this function always shows the generic one +WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info); + +#endif // wxUSE_ABOUTDLG + +#endif // _WX_GENERIC_ABOUTDLGG_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/accel.h b/Externals/wxWidgets/include/wx/generic/accel.h index 2b8a8dde9a..c22e08643e 100644 --- a/Externals/wxWidgets/include/wx/generic/accel.h +++ b/Externals/wxWidgets/include/wx/generic/accel.h @@ -1,50 +1,50 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/accel.h -// Purpose: wxAcceleratorTable class -// Author: Robert Roebling -// RCS-ID: $Id: accel.h 42752 2006-10-30 19:26:48Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_ACCEL_H_ -#define _WX_GENERIC_ACCEL_H_ - -class WXDLLEXPORT wxKeyEvent; - -// ---------------------------------------------------------------------------- -// wxAcceleratorTable -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAcceleratorTable : public wxObject -{ -public: - wxAcceleratorTable(); - wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); - virtual ~wxAcceleratorTable(); - - bool Ok() const { return IsOk(); } - bool IsOk() const; - - void Add(const wxAcceleratorEntry& entry); - void Remove(const wxAcceleratorEntry& entry); - - // implementation - // -------------- - - wxMenuItem *GetMenuItem(const wxKeyEvent& event) const; - int GetCommand(const wxKeyEvent& event) const; - - const wxAcceleratorEntry *GetEntry(const wxKeyEvent& event) const; - -protected: - // ref counting code - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - -private: - DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) -}; - -#endif // _WX_GENERIC_ACCEL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/accel.h +// Purpose: wxAcceleratorTable class +// Author: Robert Roebling +// RCS-ID: $Id: accel.h 42752 2006-10-30 19:26:48Z VZ $ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ACCEL_H_ +#define _WX_GENERIC_ACCEL_H_ + +class WXDLLEXPORT wxKeyEvent; + +// ---------------------------------------------------------------------------- +// wxAcceleratorTable +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAcceleratorTable : public wxObject +{ +public: + wxAcceleratorTable(); + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); + virtual ~wxAcceleratorTable(); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + + void Add(const wxAcceleratorEntry& entry); + void Remove(const wxAcceleratorEntry& entry); + + // implementation + // -------------- + + wxMenuItem *GetMenuItem(const wxKeyEvent& event) const; + int GetCommand(const wxKeyEvent& event) const; + + const wxAcceleratorEntry *GetEntry(const wxKeyEvent& event) const; + +protected: + // ref counting code + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + +private: + DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) +}; + +#endif // _WX_GENERIC_ACCEL_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/animate.h b/Externals/wxWidgets/include/wx/generic/animate.h index 5e1d2f8d23..30584831fd 100644 --- a/Externals/wxWidgets/include/wx/generic/animate.h +++ b/Externals/wxWidgets/include/wx/generic/animate.h @@ -1,173 +1,173 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/animate.h -// Purpose: wxAnimation and wxAnimationCtrl -// Author: Julian Smart and Guillermo Rodriguez Garcia -// Modified by: Francesco Montorsi -// Created: 13/8/99 -// RCS-ID: $Id: animate.h 43898 2006-12-10 14:18:37Z VZ $ -// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_ANIMATEH__ -#define _WX_GENERIC_ANIMATEH__ - -#include "wx/bitmap.h" - -// ---------------------------------------------------------------------------- -// wxAnimation -// ---------------------------------------------------------------------------- - -WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV); - -class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase -{ -public: - virtual bool IsOk() const - { return m_refData != NULL; } - - virtual unsigned int GetFrameCount() const; - virtual int GetDelay(unsigned int i) const; - virtual wxImage GetFrame(unsigned int i) const; - virtual wxSize GetSize() const; - - virtual bool LoadFile(const wxString& filename, - wxAnimationType type = wxANIMATION_TYPE_ANY); - virtual bool Load(wxInputStream& stream, - wxAnimationType type = wxANIMATION_TYPE_ANY); - - // extended interface used by the generic implementation of wxAnimationCtrl - wxPoint GetFramePosition(unsigned int frame) const; - wxSize GetFrameSize(unsigned int frame) const; - wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - wxColour GetTransparentColour(unsigned int frame) const; - wxColour GetBackgroundColour() const; - -protected: - static wxAnimationDecoderList sm_handlers; - -public: - static inline wxAnimationDecoderList& GetHandlers() { return sm_handlers; } - static void AddHandler(wxAnimationDecoder *handler); - static void InsertHandler(wxAnimationDecoder *handler); - static const wxAnimationDecoder *FindHandler( wxAnimationType animType ); - - static void CleanUpHandlers(); - static void InitStandardHandlers(); - - DECLARE_DYNAMIC_CLASS(wxAnimation) -}; - - -// ---------------------------------------------------------------------------- -// wxAnimationCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase -{ -public: - wxAnimationCtrl() { Init(); } - wxAnimationCtrl(wxWindow *parent, - wxWindowID id, - const wxAnimation& anim = wxNullAnimation, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxAC_DEFAULT_STYLE, - const wxString& name = wxAnimationCtrlNameStr) - { - Init(); - - Create(parent, id, anim, pos, size, style, name); - } - - void Init(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxAnimation& anim = wxNullAnimation, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxAC_DEFAULT_STYLE, - const wxString& name = wxAnimationCtrlNameStr); - - ~wxAnimationCtrl(); - -public: - virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY); - - virtual void Stop(); - virtual bool Play() - { return Play(true /* looped */); } - virtual bool IsPlaying() const - { return m_isPlaying; } - - void SetAnimation(const wxAnimation &animation); - wxAnimation GetAnimation() const - { return m_animation; } - - virtual void SetInactiveBitmap(const wxBitmap &bmp); - - // override base class method - virtual bool SetBackgroundColour(const wxColour& col); - -public: // event handlers - - void OnPaint(wxPaintEvent& event); - void OnTimer(wxTimerEvent& event); - void OnSize(wxSizeEvent& event); - -public: // extended API specific to this implementation of wxAnimateCtrl - - // Specify whether the animation's background colour is to be shown (the default), - // or whether the window background should show through - void SetUseWindowBackgroundColour(bool useWinBackground = true) - { m_useWinBackgroundColour = useWinBackground; } - bool IsUsingWindowBackgroundColour() const - { return m_useWinBackgroundColour; } - - // This overload of Play() lets you specify if the animation must loop or not - bool Play(bool looped); - - // Draw the current frame of the animation into given DC. - // This is fast as current frame is always cached. - void DrawCurrentFrame(wxDC& dc); - - // Returns a wxBitmap with the current frame drawn in it - wxBitmap& GetBackingStore() - { return m_backingStore; } - -protected: // internal utilities - - // resize this control to fit m_animation - void FitToAnimation(); - - // Draw the background; use this when e.g. previous frame had wxANIM_TOBACKGROUND disposal. - void DisposeToBackground(); - void DisposeToBackground(wxDC& dc); - void DisposeToBackground(wxDC& dc, const wxPoint &pos, const wxSize &sz); - - void IncrementalUpdateBackingStore(); - bool RebuildBackingStoreUpToFrame(unsigned int); - void DrawFrame(wxDC &dc, unsigned int); - - virtual void DisplayStaticImage(); - virtual wxSize DoGetBestSize() const; - -protected: - unsigned int m_currentFrame; // Current frame - bool m_looped; // Looped, or not - wxTimer m_timer; // The timer - wxAnimation m_animation; // The animation - - bool m_isPlaying; // Is the animation playing? - bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour? - - wxBitmap m_backingStore; // The frames are drawn here and then blitted - // on the screen - -private: - typedef wxAnimationCtrlBase base_type; - DECLARE_DYNAMIC_CLASS(wxAnimationCtrl) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_GENERIC_ANIMATEH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/animate.h +// Purpose: wxAnimation and wxAnimationCtrl +// Author: Julian Smart and Guillermo Rodriguez Garcia +// Modified by: Francesco Montorsi +// Created: 13/8/99 +// RCS-ID: $Id: animate.h 43898 2006-12-10 14:18:37Z VZ $ +// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ANIMATEH__ +#define _WX_GENERIC_ANIMATEH__ + +#include "wx/bitmap.h" + +// ---------------------------------------------------------------------------- +// wxAnimation +// ---------------------------------------------------------------------------- + +WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV); + +class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase +{ +public: + virtual bool IsOk() const + { return m_refData != NULL; } + + virtual unsigned int GetFrameCount() const; + virtual int GetDelay(unsigned int i) const; + virtual wxImage GetFrame(unsigned int i) const; + virtual wxSize GetSize() const; + + virtual bool LoadFile(const wxString& filename, + wxAnimationType type = wxANIMATION_TYPE_ANY); + virtual bool Load(wxInputStream& stream, + wxAnimationType type = wxANIMATION_TYPE_ANY); + + // extended interface used by the generic implementation of wxAnimationCtrl + wxPoint GetFramePosition(unsigned int frame) const; + wxSize GetFrameSize(unsigned int frame) const; + wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; + wxColour GetTransparentColour(unsigned int frame) const; + wxColour GetBackgroundColour() const; + +protected: + static wxAnimationDecoderList sm_handlers; + +public: + static inline wxAnimationDecoderList& GetHandlers() { return sm_handlers; } + static void AddHandler(wxAnimationDecoder *handler); + static void InsertHandler(wxAnimationDecoder *handler); + static const wxAnimationDecoder *FindHandler( wxAnimationType animType ); + + static void CleanUpHandlers(); + static void InitStandardHandlers(); + + DECLARE_DYNAMIC_CLASS(wxAnimation) +}; + + +// ---------------------------------------------------------------------------- +// wxAnimationCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase +{ +public: + wxAnimationCtrl() { Init(); } + wxAnimationCtrl(wxWindow *parent, + wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxAnimationCtrlNameStr) + { + Init(); + + Create(parent, id, anim, pos, size, style, name); + } + + void Init(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxAnimationCtrlNameStr); + + ~wxAnimationCtrl(); + +public: + virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY); + + virtual void Stop(); + virtual bool Play() + { return Play(true /* looped */); } + virtual bool IsPlaying() const + { return m_isPlaying; } + + void SetAnimation(const wxAnimation &animation); + wxAnimation GetAnimation() const + { return m_animation; } + + virtual void SetInactiveBitmap(const wxBitmap &bmp); + + // override base class method + virtual bool SetBackgroundColour(const wxColour& col); + +public: // event handlers + + void OnPaint(wxPaintEvent& event); + void OnTimer(wxTimerEvent& event); + void OnSize(wxSizeEvent& event); + +public: // extended API specific to this implementation of wxAnimateCtrl + + // Specify whether the animation's background colour is to be shown (the default), + // or whether the window background should show through + void SetUseWindowBackgroundColour(bool useWinBackground = true) + { m_useWinBackgroundColour = useWinBackground; } + bool IsUsingWindowBackgroundColour() const + { return m_useWinBackgroundColour; } + + // This overload of Play() lets you specify if the animation must loop or not + bool Play(bool looped); + + // Draw the current frame of the animation into given DC. + // This is fast as current frame is always cached. + void DrawCurrentFrame(wxDC& dc); + + // Returns a wxBitmap with the current frame drawn in it + wxBitmap& GetBackingStore() + { return m_backingStore; } + +protected: // internal utilities + + // resize this control to fit m_animation + void FitToAnimation(); + + // Draw the background; use this when e.g. previous frame had wxANIM_TOBACKGROUND disposal. + void DisposeToBackground(); + void DisposeToBackground(wxDC& dc); + void DisposeToBackground(wxDC& dc, const wxPoint &pos, const wxSize &sz); + + void IncrementalUpdateBackingStore(); + bool RebuildBackingStoreUpToFrame(unsigned int); + void DrawFrame(wxDC &dc, unsigned int); + + virtual void DisplayStaticImage(); + virtual wxSize DoGetBestSize() const; + +protected: + unsigned int m_currentFrame; // Current frame + bool m_looped; // Looped, or not + wxTimer m_timer; // The timer + wxAnimation m_animation; // The animation + + bool m_isPlaying; // Is the animation playing? + bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour? + + wxBitmap m_backingStore; // The frames are drawn here and then blitted + // on the screen + +private: + typedef wxAnimationCtrlBase base_type; + DECLARE_DYNAMIC_CLASS(wxAnimationCtrl) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_GENERIC_ANIMATEH__ diff --git a/Externals/wxWidgets/include/wx/generic/bmpcbox.h b/Externals/wxWidgets/include/wx/generic/bmpcbox.h index 31f8b2e55d..e91e0afdd5 100644 --- a/Externals/wxWidgets/include/wx/generic/bmpcbox.h +++ b/Externals/wxWidgets/include/wx/generic/bmpcbox.h @@ -1,170 +1,170 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/bmpcbox.h -// Purpose: wxBitmapComboBox -// Author: Jaakko Salli -// Modified by: -// Created: Aug-30-2006 -// RCS-ID: $Id: bmpcbox.h 42046 2006-10-16 09:30:01Z ABX $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_BMPCBOX_H_ -#define _WX_GENERIC_BMPCBOX_H_ - - -#define wxGENERIC_BITMAPCOMBOBOX 1 - -#include "wx/odcombo.h" - -// ---------------------------------------------------------------------------- -// wxBitmapComboBox: a wxComboBox that allows images to be shown -// in front of string items. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxOwnerDrawnComboBox, - public wxBitmapComboBoxBase -{ -public: - - // ctors and such - wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase() - { - Init(); - } - - wxBitmapComboBox(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxBitmapComboBoxNameStr) - : wxOwnerDrawnComboBox(), - wxBitmapComboBoxBase() - { - Init(); - - (void)Create(parent, id, value, pos, size, n, - choices, style, validator, name); - } - - wxBitmapComboBox(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxBitmapComboBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - int n, - const wxString choices[], - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxBitmapComboBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxBitmapComboBoxNameStr); - - virtual ~wxBitmapComboBox(); - - // Adds item with image to the end of the combo box. - int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap) - { return DoAppendWithImage(item, bitmap); } - - int Append(const wxString& item, const wxBitmap& bitmap, void *clientData) - { int n = DoAppendWithImage(item, bitmap); SetClientData(n, clientData); return n; } - int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData) - { int n = DoAppendWithImage(item, bitmap); SetClientObject(n, clientData); return n; } - - // Returns size of image used in list. - virtual wxSize GetBitmapSize() const - { - return m_usedImgSize; - } - - // Returns the image of the item with the given index. - virtual wxBitmap GetItemBitmap(unsigned int n) const; - - // Inserts item with image into the list before pos. Not valid for wxCB_SORT or wxCB_SORT - // styles, use Append instead. - int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos) - { return DoInsertWithImage(item, bitmap, pos); } - - int Insert(const wxString& item, const wxBitmap& bitmap, - unsigned int pos, void *clientData); - int Insert(const wxString& item, const wxBitmap& bitmap, - unsigned int pos, wxClientData *clientData); - - // Sets the image for the given item. - virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap); - - virtual void Clear(); - virtual void Delete(unsigned int n); - -protected: - - virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const; - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const; - virtual wxCoord OnMeasureItem(size_t item) const; - virtual wxCoord OnMeasureItemWidth(size_t item) const; - - virtual int DoAppendWithImage(const wxString& item, const wxBitmap& bitmap); - virtual int DoInsertWithImage(const wxString& item, const wxBitmap& bitmap, - unsigned int pos); - - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - - virtual bool SetFont(const wxFont& font); - - virtual wxSize DoGetBestSize() const; - - // Event handlers - void OnSize(wxSizeEvent& event); - - // Recalculates amount of empty space needed in front of - // text in control itself. - void DetermineIndent(); - - bool OnAddBitmap(const wxBitmap& bitmap); - - // Adds image to position - called in Append/Insert before - // string is added. - bool DoInsertBitmap(const wxBitmap& image, unsigned int pos); - - - wxArrayPtrVoid m_bitmaps; // Images associated with items - wxSize m_usedImgSize; // Size of bitmaps - -private: - int m_imgAreaWidth; // Width and height of area next to text field - int m_fontHeight; - bool m_inResize; - - void Init(); - void PostCreate(); - - DECLARE_EVENT_TABLE() - - DECLARE_DYNAMIC_CLASS(wxBitmapComboBox) -}; - -#endif // _WX_GENERIC_BMPCBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/bmpcbox.h +// Purpose: wxBitmapComboBox +// Author: Jaakko Salli +// Modified by: +// Created: Aug-30-2006 +// RCS-ID: $Id: bmpcbox.h 42046 2006-10-16 09:30:01Z ABX $ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_BMPCBOX_H_ +#define _WX_GENERIC_BMPCBOX_H_ + + +#define wxGENERIC_BITMAPCOMBOBOX 1 + +#include "wx/odcombo.h" + +// ---------------------------------------------------------------------------- +// wxBitmapComboBox: a wxComboBox that allows images to be shown +// in front of string items. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxOwnerDrawnComboBox, + public wxBitmapComboBoxBase +{ +public: + + // ctors and such + wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase() + { + Init(); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapComboBoxNameStr) + : wxOwnerDrawnComboBox(), + wxBitmapComboBoxBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapComboBoxNameStr); + + virtual ~wxBitmapComboBox(); + + // Adds item with image to the end of the combo box. + int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap) + { return DoAppendWithImage(item, bitmap); } + + int Append(const wxString& item, const wxBitmap& bitmap, void *clientData) + { int n = DoAppendWithImage(item, bitmap); SetClientData(n, clientData); return n; } + int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData) + { int n = DoAppendWithImage(item, bitmap); SetClientObject(n, clientData); return n; } + + // Returns size of image used in list. + virtual wxSize GetBitmapSize() const + { + return m_usedImgSize; + } + + // Returns the image of the item with the given index. + virtual wxBitmap GetItemBitmap(unsigned int n) const; + + // Inserts item with image into the list before pos. Not valid for wxCB_SORT or wxCB_SORT + // styles, use Append instead. + int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos) + { return DoInsertWithImage(item, bitmap, pos); } + + int Insert(const wxString& item, const wxBitmap& bitmap, + unsigned int pos, void *clientData); + int Insert(const wxString& item, const wxBitmap& bitmap, + unsigned int pos, wxClientData *clientData); + + // Sets the image for the given item. + virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap); + + virtual void Clear(); + virtual void Delete(unsigned int n); + +protected: + + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const; + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const; + virtual wxCoord OnMeasureItem(size_t item) const; + virtual wxCoord OnMeasureItemWidth(size_t item) const; + + virtual int DoAppendWithImage(const wxString& item, const wxBitmap& bitmap); + virtual int DoInsertWithImage(const wxString& item, const wxBitmap& bitmap, + unsigned int pos); + + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + + virtual bool SetFont(const wxFont& font); + + virtual wxSize DoGetBestSize() const; + + // Event handlers + void OnSize(wxSizeEvent& event); + + // Recalculates amount of empty space needed in front of + // text in control itself. + void DetermineIndent(); + + bool OnAddBitmap(const wxBitmap& bitmap); + + // Adds image to position - called in Append/Insert before + // string is added. + bool DoInsertBitmap(const wxBitmap& image, unsigned int pos); + + + wxArrayPtrVoid m_bitmaps; // Images associated with items + wxSize m_usedImgSize; // Size of bitmaps + +private: + int m_imgAreaWidth; // Width and height of area next to text field + int m_fontHeight; + bool m_inResize; + + void Init(); + void PostCreate(); + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxBitmapComboBox) +}; + +#endif // _WX_GENERIC_BMPCBOX_H_ diff --git a/Externals/wxWidgets/include/wx/generic/busyinfo.h b/Externals/wxWidgets/include/wx/generic/busyinfo.h index b8fdd48663..c29a0f96d5 100644 --- a/Externals/wxWidgets/include/wx/generic/busyinfo.h +++ b/Externals/wxWidgets/include/wx/generic/busyinfo.h @@ -1,42 +1,42 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/busyinfo.h -// Purpose: Information window (when app is busy) -// Author: Vaclav Slavik -// Copyright: (c) 1999 Vaclav Slavik -// RCS-ID: $Id: busyinfo.h 49804 2007-11-10 01:09:42Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __BUSYINFO_H__ -#define __BUSYINFO_H__ - -#include "wx/defs.h" - -#if wxUSE_BUSYINFO - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -//-------------------------------------------------------------------------------- -// wxBusyInfo -// Displays progress information -// Can be used in exactly same way as wxBusyCursor -//-------------------------------------------------------------------------------- - -class WXDLLEXPORT wxBusyInfo : public wxObject -{ -public: - wxBusyInfo(const wxString& message, wxWindow *parent = NULL); - - virtual ~wxBusyInfo(); - -private: - wxFrame *m_InfoFrame; - - DECLARE_NO_COPY_CLASS(wxBusyInfo) -}; - - -#endif // wxUSE_BUSYINFO - -#endif // __BUSYINFO_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/busyinfo.h +// Purpose: Information window (when app is busy) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// RCS-ID: $Id: busyinfo.h 49804 2007-11-10 01:09:42Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __BUSYINFO_H__ +#define __BUSYINFO_H__ + +#include "wx/defs.h" + +#if wxUSE_BUSYINFO + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//-------------------------------------------------------------------------------- +// wxBusyInfo +// Displays progress information +// Can be used in exactly same way as wxBusyCursor +//-------------------------------------------------------------------------------- + +class WXDLLEXPORT wxBusyInfo : public wxObject +{ +public: + wxBusyInfo(const wxString& message, wxWindow *parent = NULL); + + virtual ~wxBusyInfo(); + +private: + wxFrame *m_InfoFrame; + + DECLARE_NO_COPY_CLASS(wxBusyInfo) +}; + + +#endif // wxUSE_BUSYINFO + +#endif // __BUSYINFO_H__ diff --git a/Externals/wxWidgets/include/wx/generic/buttonbar.h b/Externals/wxWidgets/include/wx/generic/buttonbar.h index 33741fc50e..6fa2c702a0 100644 --- a/Externals/wxWidgets/include/wx/generic/buttonbar.h +++ b/Externals/wxWidgets/include/wx/generic/buttonbar.h @@ -1,123 +1,123 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/buttonbar.h -// Purpose: wxButtonToolBar declaration -// Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech -// Modified by: -// Created: 2006-04-13 -// Id: $Id: buttonbar.h 38714 2006-04-14 15:49:57Z JS $ -// Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, -// SciTech Software, Inc. -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUTTONBAR_H_ -#define _WX_BUTTONBAR_H_ - -#include "wx/bmpbuttn.h" -#include "wx/toolbar.h" - -class WXDLLEXPORT wxButtonToolBarTool; - -// ---------------------------------------------------------------------------- -// wxButtonToolBar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButtonToolBar : public wxToolBarBase -{ -public: - // construction/destruction - wxButtonToolBar() { Init(); } - wxButtonToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxToolBarNameStr) - { - Init(); - - Create(parent, id, pos, size, style, name); - } - - bool Create( wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxToolBarNameStr ); - - virtual ~wxButtonToolBar(); - - virtual bool Realize(); - - virtual void SetToolShortHelp(int id, const wxString& helpString); - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - -protected: - // common part of all ctors - void Init(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); - - virtual wxSize DoGetBestClientSize() const; - - // calculate layout - void DoLayout(); - - // get the bounding rect for the given tool - wxRect GetToolRect(wxToolBarToolBase *tool) const; - - // get the rect limits depending on the orientation: top/bottom for a - // vertical toolbar, left/right for a horizontal one - void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; - - // receives button commands - void OnCommand(wxCommandEvent& event); - - // paints a border - void OnPaint(wxPaintEvent& event); - - // detects mouse clicks outside buttons - void OnLeftUp(wxMouseEvent& event); - -private: - // have we calculated the positions of our tools? - bool m_needsLayout; - - // the width of a separator - wxCoord m_widthSeparator; - - // the total size of all toolbar elements - wxCoord m_maxWidth, - m_maxHeight; - - // the height of a label - int m_labelHeight; - - // the space above the label - int m_labelMargin; - -private: - DECLARE_DYNAMIC_CLASS(wxButtonToolBar) - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_BUTTONBAR_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/buttonbar.h +// Purpose: wxButtonToolBar declaration +// Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech +// Modified by: +// Created: 2006-04-13 +// Id: $Id: buttonbar.h 38714 2006-04-14 15:49:57Z JS $ +// Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, +// SciTech Software, Inc. +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTONBAR_H_ +#define _WX_BUTTONBAR_H_ + +#include "wx/bmpbuttn.h" +#include "wx/toolbar.h" + +class WXDLLEXPORT wxButtonToolBarTool; + +// ---------------------------------------------------------------------------- +// wxButtonToolBar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxButtonToolBar : public wxToolBarBase +{ +public: + // construction/destruction + wxButtonToolBar() { Init(); } + wxButtonToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxToolBarNameStr) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxToolBarNameStr ); + + virtual ~wxButtonToolBar(); + + virtual bool Realize(); + + virtual void SetToolShortHelp(int id, const wxString& helpString); + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + +protected: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + virtual wxSize DoGetBestClientSize() const; + + // calculate layout + void DoLayout(); + + // get the bounding rect for the given tool + wxRect GetToolRect(wxToolBarToolBase *tool) const; + + // get the rect limits depending on the orientation: top/bottom for a + // vertical toolbar, left/right for a horizontal one + void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; + + // receives button commands + void OnCommand(wxCommandEvent& event); + + // paints a border + void OnPaint(wxPaintEvent& event); + + // detects mouse clicks outside buttons + void OnLeftUp(wxMouseEvent& event); + +private: + // have we calculated the positions of our tools? + bool m_needsLayout; + + // the width of a separator + wxCoord m_widthSeparator; + + // the total size of all toolbar elements + wxCoord m_maxWidth, + m_maxHeight; + + // the height of a label + int m_labelHeight; + + // the space above the label + int m_labelMargin; + +private: + DECLARE_DYNAMIC_CLASS(wxButtonToolBar) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_BUTTONBAR_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/calctrl.h b/Externals/wxWidgets/include/wx/generic/calctrl.h index 2b5e3aa58d..43b854c64a 100644 --- a/Externals/wxWidgets/include/wx/generic/calctrl.h +++ b/Externals/wxWidgets/include/wx/generic/calctrl.h @@ -1,324 +1,324 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: generic/calctrl.h -// Purpose: generic implementation of date-picker control -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.12.99 -// RCS-ID: $Id: calctrl.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_CALCTRL_H -#define _WX_GENERIC_CALCTRL_H - -#include "wx/control.h" // the base class -#include "wx/dcclient.h" // for wxPaintDC - -class WXDLLIMPEXP_FWD_CORE wxComboBox; -class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; - -#define wxCalendarNameStr _T("CalendarCtrl") - -// ---------------------------------------------------------------------------- -// wxCalendarCtrl: a control allowing the user to pick a date interactively -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxControl -{ -public: - // construction - wxCalendarCtrl() { Init(); } - wxCalendarCtrl(wxWindow *parent, - wxWindowID id, - const wxDateTime& date = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, - const wxString& name = wxCalendarNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxDateTime& date = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, - const wxString& name = wxCalendarNameStr); - - virtual ~wxCalendarCtrl(); - - virtual bool Destroy(); - - // set/get the current date - // ------------------------ - - bool SetDate(const wxDateTime& date); // we need to be able to control if the event should be sent in SetDateAndNotify(...) - const wxDateTime& GetDate() const { return m_date; } - - // set/get the range in which selection can occur - // --------------------------------------------- - - bool SetLowerDateLimit(const wxDateTime& date = wxDefaultDateTime); - const wxDateTime& GetLowerDateLimit() const { return m_lowdate; } - bool SetUpperDateLimit(const wxDateTime& date = wxDefaultDateTime); - const wxDateTime& GetUpperDateLimit() const { return m_highdate; } - - bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, const wxDateTime& upperdate = wxDefaultDateTime); - - // calendar mode - // ------------- - - // some calendar styles can't be changed after the control creation by - // just using SetWindowStyle() and Refresh() and the functions below - // should be used instead for them - - // corresponds to wxCAL_NO_YEAR_CHANGE bit - void EnableYearChange(bool enable = true); - - // corresponds to wxCAL_NO_MONTH_CHANGE bit - void EnableMonthChange(bool enable = true); - - // corresponds to wxCAL_SHOW_HOLIDAYS bit - void EnableHolidayDisplay(bool display = true); - - // customization - // ------------- - - // header colours are used for painting the weekdays at the top - void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) - { - m_colHeaderFg = colFg; - m_colHeaderBg = colBg; - } - - const wxColour& GetHeaderColourFg() const { return m_colHeaderFg; } - const wxColour& GetHeaderColourBg() const { return m_colHeaderBg; } - - // highlight colour is used for the currently selected date - void SetHighlightColours(const wxColour& colFg, const wxColour& colBg) - { - m_colHighlightFg = colFg; - m_colHighlightBg = colBg; - } - - const wxColour& GetHighlightColourFg() const { return m_colHighlightFg; } - const wxColour& GetHighlightColourBg() const { return m_colHighlightBg; } - - // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS) - void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) - { - m_colHolidayFg = colFg; - m_colHolidayBg = colBg; - } - - const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; } - const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; } - - // an item without custom attributes is drawn with the default colours and - // font and without border, setting custom attributes allows to modify this - // - // the day parameter should be in 1..31 range, for days 29, 30, 31 the - // corresponding attribute is just unused if there is no such day in the - // current month - - wxCalendarDateAttr *GetAttr(size_t day) const - { - wxCHECK_MSG( day > 0 && day < 32, NULL, _T("invalid day") ); - - return m_attrs[day - 1]; - } - - void SetAttr(size_t day, wxCalendarDateAttr *attr) - { - wxCHECK_RET( day > 0 && day < 32, _T("invalid day") ); - - delete m_attrs[day - 1]; - m_attrs[day - 1] = attr; - } - - void SetHoliday(size_t day); - - void ResetAttr(size_t day) { SetAttr(day, (wxCalendarDateAttr *)NULL); } - - // returns one of wxCAL_HITTEST_XXX constants and fills either date or wd - // with the corresponding value (none for NOWHERE, the date for DAY and wd - // for HEADER) - wxCalendarHitTestResult HitTest(const wxPoint& pos, - wxDateTime *date = NULL, - wxDateTime::WeekDay *wd = NULL); - - // implementation only from now on - // ------------------------------- - - // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - - virtual void SetWindowStyleFlag(long style); - - virtual wxVisualAttributes GetDefaultAttributes() const - { return GetClassDefaultAttributes(GetWindowVariant()); } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - void OnSysColourChanged(wxSysColourChangedEvent& event); - -protected: - // override some base class virtuals - virtual wxSize DoGetBestSize() const; - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); - virtual void DoMoveWindow(int x, int y, int width, int height); - -private: - // common part of all ctors - void Init(); - - // startup colours and reinitialization after colour changes in system - void InitColours(); - - // event handlers - void OnPaint(wxPaintEvent& event); - void OnClick(wxMouseEvent& event); - void OnDClick(wxMouseEvent& event); - void OnChar(wxKeyEvent& event); - void OnMonthChange(wxCommandEvent& event); - void OnYearChange(wxCommandEvent& event); - void OnYearTextChange(wxCommandEvent& event); - - // (re)calc m_widthCol and m_heightRow - void RecalcGeometry(); - - // set the date and send the notification - void SetDateAndNotify(const wxDateTime& date); - - // get the week (row, in range 1..6) for the given date - size_t GetWeek(const wxDateTime& date) const; - - // get the date from which we start drawing days - wxDateTime GetStartDate() const; - - // is this date shown? - bool IsDateShown(const wxDateTime& date) const; - - // is this date in the given range? - bool IsDateInRange(const wxDateTime& date) const; - - // range helpers - bool ChangeYear(wxDateTime* target) const; - bool ChangeMonth(wxDateTime* target) const; - - // redraw the given date - void RefreshDate(const wxDateTime& date); - - // change the date inside the same month/year - void ChangeDay(const wxDateTime& date); - - // set the attributes for the holidays if needed - void SetHolidayAttrs(); - - // reset all holidays - void ResetHolidayAttrs(); - - // generate the given calendar event(s) - void GenerateEvent(wxEventType type) - { - wxCalendarEvent event(this, type); - (void)GetEventHandler()->ProcessEvent(event); - } - - void GenerateEvents(wxEventType type1, wxEventType type2) - { - GenerateEvent(type1); - GenerateEvent(type2); - } - - // do we allow changing the month/year? - bool AllowMonthChange() const - { - return (GetWindowStyle() & wxCAL_NO_MONTH_CHANGE) - != wxCAL_NO_MONTH_CHANGE; - } - bool AllowYearChange() const - { - return !(GetWindowStyle() & wxCAL_NO_YEAR_CHANGE); - } - - // show the correct controls - void ShowCurrentControls(); - - // create the month combo and year spin controls - void CreateMonthComboBox(); - void CreateYearSpinCtrl(); - -public: - // get the currently shown control for month/year - wxControl *GetMonthControl() const; - wxControl *GetYearControl() const; - -private: - // OnPaint helper-methods - - // Highlight the [fromdate : todate] range using pen and brush - void HighlightRange(wxPaintDC* dc, const wxDateTime& fromdate, const wxDateTime& todate, const wxPen* pen, const wxBrush* brush); - - // Get the "coordinates" for the date relative to the month currently displayed. - // using (day, week): upper left coord is (1, 1), lower right coord is (7, 6) - // if the date isn't visible (-1, -1) is put in (day, week) and false is returned - bool GetDateCoord(const wxDateTime& date, int *day, int *week) const; - - // Set the flag for SetDate(): otherwise it would overwrite the year - // typed in by the user - void SetUserChangedYear() { m_userChangedYear = true; } - - // the subcontrols - wxStaticText *m_staticMonth; - wxComboBox *m_comboMonth; - - wxStaticText *m_staticYear; - wxSpinCtrl *m_spinYear; - - // the current selection - wxDateTime m_date; - - // the date-range - wxDateTime m_lowdate; - wxDateTime m_highdate; - - // default attributes - wxColour m_colHighlightFg, - m_colHighlightBg, - m_colHolidayFg, - m_colHolidayBg, - m_colHeaderFg, - m_colHeaderBg, - m_colBackground, - m_colSorrounding; - - // the attributes for each of the month days - wxCalendarDateAttr *m_attrs[31]; - - // the width and height of one column/row in the calendar - wxCoord m_widthCol, - m_heightRow, - m_rowOffset; - - wxRect m_leftArrowRect, - m_rightArrowRect; - - // the week day names - wxString m_weekdays[7]; - - // true if SetDate() is being called as the result of changing the year in - // the year control - bool m_userChangedYear; - - DECLARE_DYNAMIC_CLASS(wxCalendarCtrl) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxCalendarCtrl) -}; - -#endif // _WX_GENERIC_CALCTRL_H +/////////////////////////////////////////////////////////////////////////////// +// Name: generic/calctrl.h +// Purpose: generic implementation of date-picker control +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.12.99 +// RCS-ID: $Id: calctrl.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CALCTRL_H +#define _WX_GENERIC_CALCTRL_H + +#include "wx/control.h" // the base class +#include "wx/dcclient.h" // for wxPaintDC + +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; + +#define wxCalendarNameStr _T("CalendarCtrl") + +// ---------------------------------------------------------------------------- +// wxCalendarCtrl: a control allowing the user to pick a date interactively +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxControl +{ +public: + // construction + wxCalendarCtrl() { Init(); } + wxCalendarCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, + const wxString& name = wxCalendarNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, + const wxString& name = wxCalendarNameStr); + + virtual ~wxCalendarCtrl(); + + virtual bool Destroy(); + + // set/get the current date + // ------------------------ + + bool SetDate(const wxDateTime& date); // we need to be able to control if the event should be sent in SetDateAndNotify(...) + const wxDateTime& GetDate() const { return m_date; } + + // set/get the range in which selection can occur + // --------------------------------------------- + + bool SetLowerDateLimit(const wxDateTime& date = wxDefaultDateTime); + const wxDateTime& GetLowerDateLimit() const { return m_lowdate; } + bool SetUpperDateLimit(const wxDateTime& date = wxDefaultDateTime); + const wxDateTime& GetUpperDateLimit() const { return m_highdate; } + + bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, const wxDateTime& upperdate = wxDefaultDateTime); + + // calendar mode + // ------------- + + // some calendar styles can't be changed after the control creation by + // just using SetWindowStyle() and Refresh() and the functions below + // should be used instead for them + + // corresponds to wxCAL_NO_YEAR_CHANGE bit + void EnableYearChange(bool enable = true); + + // corresponds to wxCAL_NO_MONTH_CHANGE bit + void EnableMonthChange(bool enable = true); + + // corresponds to wxCAL_SHOW_HOLIDAYS bit + void EnableHolidayDisplay(bool display = true); + + // customization + // ------------- + + // header colours are used for painting the weekdays at the top + void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) + { + m_colHeaderFg = colFg; + m_colHeaderBg = colBg; + } + + const wxColour& GetHeaderColourFg() const { return m_colHeaderFg; } + const wxColour& GetHeaderColourBg() const { return m_colHeaderBg; } + + // highlight colour is used for the currently selected date + void SetHighlightColours(const wxColour& colFg, const wxColour& colBg) + { + m_colHighlightFg = colFg; + m_colHighlightBg = colBg; + } + + const wxColour& GetHighlightColourFg() const { return m_colHighlightFg; } + const wxColour& GetHighlightColourBg() const { return m_colHighlightBg; } + + // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS) + void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) + { + m_colHolidayFg = colFg; + m_colHolidayBg = colBg; + } + + const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; } + const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; } + + // an item without custom attributes is drawn with the default colours and + // font and without border, setting custom attributes allows to modify this + // + // the day parameter should be in 1..31 range, for days 29, 30, 31 the + // corresponding attribute is just unused if there is no such day in the + // current month + + wxCalendarDateAttr *GetAttr(size_t day) const + { + wxCHECK_MSG( day > 0 && day < 32, NULL, _T("invalid day") ); + + return m_attrs[day - 1]; + } + + void SetAttr(size_t day, wxCalendarDateAttr *attr) + { + wxCHECK_RET( day > 0 && day < 32, _T("invalid day") ); + + delete m_attrs[day - 1]; + m_attrs[day - 1] = attr; + } + + void SetHoliday(size_t day); + + void ResetAttr(size_t day) { SetAttr(day, (wxCalendarDateAttr *)NULL); } + + // returns one of wxCAL_HITTEST_XXX constants and fills either date or wd + // with the corresponding value (none for NOWHERE, the date for DAY and wd + // for HEADER) + wxCalendarHitTestResult HitTest(const wxPoint& pos, + wxDateTime *date = NULL, + wxDateTime::WeekDay *wd = NULL); + + // implementation only from now on + // ------------------------------- + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + + virtual void SetWindowStyleFlag(long style); + + virtual wxVisualAttributes GetDefaultAttributes() const + { return GetClassDefaultAttributes(GetWindowVariant()); } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + // override some base class virtuals + virtual wxSize DoGetBestSize() const; + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); + virtual void DoMoveWindow(int x, int y, int width, int height); + +private: + // common part of all ctors + void Init(); + + // startup colours and reinitialization after colour changes in system + void InitColours(); + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnClick(wxMouseEvent& event); + void OnDClick(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); + void OnMonthChange(wxCommandEvent& event); + void OnYearChange(wxCommandEvent& event); + void OnYearTextChange(wxCommandEvent& event); + + // (re)calc m_widthCol and m_heightRow + void RecalcGeometry(); + + // set the date and send the notification + void SetDateAndNotify(const wxDateTime& date); + + // get the week (row, in range 1..6) for the given date + size_t GetWeek(const wxDateTime& date) const; + + // get the date from which we start drawing days + wxDateTime GetStartDate() const; + + // is this date shown? + bool IsDateShown(const wxDateTime& date) const; + + // is this date in the given range? + bool IsDateInRange(const wxDateTime& date) const; + + // range helpers + bool ChangeYear(wxDateTime* target) const; + bool ChangeMonth(wxDateTime* target) const; + + // redraw the given date + void RefreshDate(const wxDateTime& date); + + // change the date inside the same month/year + void ChangeDay(const wxDateTime& date); + + // set the attributes for the holidays if needed + void SetHolidayAttrs(); + + // reset all holidays + void ResetHolidayAttrs(); + + // generate the given calendar event(s) + void GenerateEvent(wxEventType type) + { + wxCalendarEvent event(this, type); + (void)GetEventHandler()->ProcessEvent(event); + } + + void GenerateEvents(wxEventType type1, wxEventType type2) + { + GenerateEvent(type1); + GenerateEvent(type2); + } + + // do we allow changing the month/year? + bool AllowMonthChange() const + { + return (GetWindowStyle() & wxCAL_NO_MONTH_CHANGE) + != wxCAL_NO_MONTH_CHANGE; + } + bool AllowYearChange() const + { + return !(GetWindowStyle() & wxCAL_NO_YEAR_CHANGE); + } + + // show the correct controls + void ShowCurrentControls(); + + // create the month combo and year spin controls + void CreateMonthComboBox(); + void CreateYearSpinCtrl(); + +public: + // get the currently shown control for month/year + wxControl *GetMonthControl() const; + wxControl *GetYearControl() const; + +private: + // OnPaint helper-methods + + // Highlight the [fromdate : todate] range using pen and brush + void HighlightRange(wxPaintDC* dc, const wxDateTime& fromdate, const wxDateTime& todate, const wxPen* pen, const wxBrush* brush); + + // Get the "coordinates" for the date relative to the month currently displayed. + // using (day, week): upper left coord is (1, 1), lower right coord is (7, 6) + // if the date isn't visible (-1, -1) is put in (day, week) and false is returned + bool GetDateCoord(const wxDateTime& date, int *day, int *week) const; + + // Set the flag for SetDate(): otherwise it would overwrite the year + // typed in by the user + void SetUserChangedYear() { m_userChangedYear = true; } + + // the subcontrols + wxStaticText *m_staticMonth; + wxComboBox *m_comboMonth; + + wxStaticText *m_staticYear; + wxSpinCtrl *m_spinYear; + + // the current selection + wxDateTime m_date; + + // the date-range + wxDateTime m_lowdate; + wxDateTime m_highdate; + + // default attributes + wxColour m_colHighlightFg, + m_colHighlightBg, + m_colHolidayFg, + m_colHolidayBg, + m_colHeaderFg, + m_colHeaderBg, + m_colBackground, + m_colSorrounding; + + // the attributes for each of the month days + wxCalendarDateAttr *m_attrs[31]; + + // the width and height of one column/row in the calendar + wxCoord m_widthCol, + m_heightRow, + m_rowOffset; + + wxRect m_leftArrowRect, + m_rightArrowRect; + + // the week day names + wxString m_weekdays[7]; + + // true if SetDate() is being called as the result of changing the year in + // the year control + bool m_userChangedYear; + + DECLARE_DYNAMIC_CLASS(wxCalendarCtrl) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxCalendarCtrl) +}; + +#endif // _WX_GENERIC_CALCTRL_H diff --git a/Externals/wxWidgets/include/wx/generic/caret.h b/Externals/wxWidgets/include/wx/generic/caret.h index 926f9d02a3..5b8de00ed8 100644 --- a/Externals/wxWidgets/include/wx/generic/caret.h +++ b/Externals/wxWidgets/include/wx/generic/caret.h @@ -1,95 +1,95 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: generic/caret.h -// Purpose: generic wxCaret class -// Author: Vadim Zeitlin (original code by Robert Roebling) -// Modified by: -// Created: 25.05.99 -// RCS-ID: $Id: caret.h 42397 2006-10-25 12:12:56Z VS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CARET_H_ -#define _WX_CARET_H_ - -#include "wx/timer.h" -#include "wx/dc.h" -#include "wx/overlay.h" - -#ifdef wxHAS_NATIVE_OVERLAY - #define wxHAS_CARET_USING_OVERLAYS -#endif - -class WXDLLIMPEXP_CORE wxCaret; - -class WXDLLEXPORT wxCaretTimer : public wxTimer -{ -public: - wxCaretTimer(wxCaret *caret); - virtual void Notify(); - -private: - wxCaret *m_caret; -}; - -class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase -{ -public: - // ctors - // ----- - // default - use Create() - wxCaret() : m_timer(this) { InitGeneric(); } - // creates a block caret associated with the given window - wxCaret(wxWindowBase *window, int width, int height) - : wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); } - wxCaret(wxWindowBase *window, const wxSize& size) - : wxCaretBase(window, size), m_timer(this) { InitGeneric(); } - - virtual ~wxCaret(); - - // implementation - // -------------- - - // called by wxWindow (not using the event tables) - virtual void OnSetFocus(); - virtual void OnKillFocus(); - - // called by wxCaretTimer - void OnTimer(); - -protected: - virtual void DoShow(); - virtual void DoHide(); - virtual void DoMove(); - virtual void DoSize(); - - // blink the caret once - void Blink(); - - // refresh the caret - void Refresh(); - - // draw the caret on the given DC - void DoDraw(wxDC *dc); - -private: - // GTK specific initialization - void InitGeneric(); - -#ifdef wxHAS_CARET_USING_OVERLAYS - // the overlay for displaying the caret - wxOverlay m_overlay; -#else - // the bitmap holding the part of window hidden by the caret when it was - // at (m_xOld, m_yOld) - wxBitmap m_bmpUnderCaret; - int m_xOld, - m_yOld; -#endif - - wxCaretTimer m_timer; - bool m_blinkedOut, // true => caret hidden right now - m_hasFocus; // true => our window has focus -}; - -#endif // _WX_CARET_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: generic/caret.h +// Purpose: generic wxCaret class +// Author: Vadim Zeitlin (original code by Robert Roebling) +// Modified by: +// Created: 25.05.99 +// RCS-ID: $Id: caret.h 42397 2006-10-25 12:12:56Z VS $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_ +#define _WX_CARET_H_ + +#include "wx/timer.h" +#include "wx/dc.h" +#include "wx/overlay.h" + +#ifdef wxHAS_NATIVE_OVERLAY + #define wxHAS_CARET_USING_OVERLAYS +#endif + +class WXDLLIMPEXP_CORE wxCaret; + +class WXDLLEXPORT wxCaretTimer : public wxTimer +{ +public: + wxCaretTimer(wxCaret *caret); + virtual void Notify(); + +private: + wxCaret *m_caret; +}; + +class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase +{ +public: + // ctors + // ----- + // default - use Create() + wxCaret() : m_timer(this) { InitGeneric(); } + // creates a block caret associated with the given window + wxCaret(wxWindowBase *window, int width, int height) + : wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); } + wxCaret(wxWindowBase *window, const wxSize& size) + : wxCaretBase(window, size), m_timer(this) { InitGeneric(); } + + virtual ~wxCaret(); + + // implementation + // -------------- + + // called by wxWindow (not using the event tables) + virtual void OnSetFocus(); + virtual void OnKillFocus(); + + // called by wxCaretTimer + void OnTimer(); + +protected: + virtual void DoShow(); + virtual void DoHide(); + virtual void DoMove(); + virtual void DoSize(); + + // blink the caret once + void Blink(); + + // refresh the caret + void Refresh(); + + // draw the caret on the given DC + void DoDraw(wxDC *dc); + +private: + // GTK specific initialization + void InitGeneric(); + +#ifdef wxHAS_CARET_USING_OVERLAYS + // the overlay for displaying the caret + wxOverlay m_overlay; +#else + // the bitmap holding the part of window hidden by the caret when it was + // at (m_xOld, m_yOld) + wxBitmap m_bmpUnderCaret; + int m_xOld, + m_yOld; +#endif + + wxCaretTimer m_timer; + bool m_blinkedOut, // true => caret hidden right now + m_hasFocus; // true => our window has focus +}; + +#endif // _WX_CARET_H_ diff --git a/Externals/wxWidgets/include/wx/generic/choicdgg.h b/Externals/wxWidgets/include/wx/generic/choicdgg.h index ebefcd81b8..79bc395d35 100644 --- a/Externals/wxWidgets/include/wx/generic/choicdgg.h +++ b/Externals/wxWidgets/include/wx/generic/choicdgg.h @@ -1,320 +1,320 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/choicdgg.h -// Purpose: Generic choice dialogs -// Author: Julian Smart -// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions -// Created: 01/02/97 -// RCS-ID: $Id: choicdgg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_CHOICDGG_H_ -#define _WX_GENERIC_CHOICDGG_H_ - -#include "wx/dynarray.h" -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxListBoxBase; - -// ---------------------------------------------------------------------------- -// some (ugly...) constants -// ---------------------------------------------------------------------------- - -#define wxCHOICE_HEIGHT 150 -#define wxCHOICE_WIDTH 200 - -#ifdef __WXWINCE__ -#define wxCHOICEDLG_STYLE \ - (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE) -#else -#define wxCHOICEDLG_STYLE \ - (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) -#endif - -// ---------------------------------------------------------------------------- -// wxAnyChoiceDialog: a base class for dialogs containing a listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAnyChoiceDialog : public wxDialog -{ -public: - wxAnyChoiceDialog() { } - - wxAnyChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB) - { - (void)Create(parent, message, caption, n, choices, - styleDlg, pos, styleLbox); - } - wxAnyChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB) - { - (void)Create(parent, message, caption, choices, - styleDlg, pos, styleLbox); - } - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB); - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long styleDlg = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition, - long styleLbox = wxLB_ALWAYS_SB); - -protected: - wxListBoxBase *m_listbox; - - virtual wxListBoxBase *CreateList(int n, - const wxString *choices, - long styleLbox); - - DECLARE_NO_COPY_CLASS(wxAnyChoiceDialog) -}; - -// ---------------------------------------------------------------------------- -// wxSingleChoiceDialog: a dialog with single selection listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSingleChoiceDialog : public wxAnyChoiceDialog -{ -public: - wxSingleChoiceDialog() - { - m_selection = -1; - } - - wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - wxSingleChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - char **clientData = (char **)NULL, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - - void SetSelection(int sel); - int GetSelection() const { return m_selection; } - wxString GetStringSelection() const { return m_stringSelection; } - - // obsolete function (NB: no need to make it return wxChar, it's untyped) - char *GetSelectionClientData() const { return (char *)m_clientData; } - - // implementation from now on - void OnOK(wxCommandEvent& event); -#ifndef __SMARTPHONE__ - void OnListBoxDClick(wxCommandEvent& event); -#endif -#ifdef __WXWINCE__ - void OnJoystickButtonDown(wxJoystickEvent& event); -#endif - -protected: - int m_selection; - wxString m_stringSelection; - - void DoChoice(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog) - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// wxMultiChoiceDialog: a dialog with multi selection listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMultiChoiceDialog : public wxAnyChoiceDialog -{ -public: - wxMultiChoiceDialog() { } - - wxMultiChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - { - (void)Create(parent, message, caption, n, choices, style, pos); - } - wxMultiChoiceDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition) - { - (void)Create(parent, message, caption, choices, style, pos); - } - - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - int n, - const wxString *choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - bool Create(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - long style = wxCHOICEDLG_STYLE, - const wxPoint& pos = wxDefaultPosition); - - void SetSelections(const wxArrayInt& selections); - wxArrayInt GetSelections() const { return m_selections; } - - // implementation from now on - virtual bool TransferDataFromWindow(); - -protected: -#if wxUSE_CHECKLISTBOX - virtual wxListBoxBase *CreateList(int n, - const wxString *choices, - long styleLbox); -#endif // wxUSE_CHECKLISTBOX - - wxArrayInt m_selections; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog) -}; - -// ---------------------------------------------------------------------------- -// wrapper functions which can be used to get selection(s) from the user -// ---------------------------------------------------------------------------- - -// get the user selection as a string -WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -// Same as above but gets position in list of strings, instead of string, -// or -1 if no selection -WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -// Return client data instead or NULL if cancelled -WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, - const wxString& caption, - const wxArrayString& choices, - void **client_data, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, - const wxString& caption, - int n, const wxString *choices, - void **client_data, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -// fill the array with the indices of the chosen items, it will be empty -// if no items were selected or Cancel was pressed - return the number of -// selections -WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - const wxArrayString& choices, - wxWindow *parent = NULL, - int x = wxDefaultCoord, - int y = wxDefaultCoord, - bool centre = true, - int width = wxCHOICE_WIDTH, - int height = wxCHOICE_HEIGHT); - -#endif // _WX_GENERIC_CHOICDGG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/choicdgg.h +// Purpose: Generic choice dialogs +// Author: Julian Smart +// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions +// Created: 01/02/97 +// RCS-ID: $Id: choicdgg.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CHOICDGG_H_ +#define _WX_GENERIC_CHOICDGG_H_ + +#include "wx/dynarray.h" +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxListBoxBase; + +// ---------------------------------------------------------------------------- +// some (ugly...) constants +// ---------------------------------------------------------------------------- + +#define wxCHOICE_HEIGHT 150 +#define wxCHOICE_WIDTH 200 + +#ifdef __WXWINCE__ +#define wxCHOICEDLG_STYLE \ + (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE) +#else +#define wxCHOICEDLG_STYLE \ + (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) +#endif + +// ---------------------------------------------------------------------------- +// wxAnyChoiceDialog: a base class for dialogs containing a listbox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAnyChoiceDialog : public wxDialog +{ +public: + wxAnyChoiceDialog() { } + + wxAnyChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB) + { + (void)Create(parent, message, caption, n, choices, + styleDlg, pos, styleLbox); + } + wxAnyChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB) + { + (void)Create(parent, message, caption, choices, + styleDlg, pos, styleLbox); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB); + +protected: + wxListBoxBase *m_listbox; + + virtual wxListBoxBase *CreateList(int n, + const wxString *choices, + long styleLbox); + + DECLARE_NO_COPY_CLASS(wxAnyChoiceDialog) +}; + +// ---------------------------------------------------------------------------- +// wxSingleChoiceDialog: a dialog with single selection listbox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSingleChoiceDialog : public wxAnyChoiceDialog +{ +public: + wxSingleChoiceDialog() + { + m_selection = -1; + } + + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData = (char **)NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData = (char **)NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData = (char **)NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData = (char **)NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + + void SetSelection(int sel); + int GetSelection() const { return m_selection; } + wxString GetStringSelection() const { return m_stringSelection; } + + // obsolete function (NB: no need to make it return wxChar, it's untyped) + char *GetSelectionClientData() const { return (char *)m_clientData; } + + // implementation from now on + void OnOK(wxCommandEvent& event); +#ifndef __SMARTPHONE__ + void OnListBoxDClick(wxCommandEvent& event); +#endif +#ifdef __WXWINCE__ + void OnJoystickButtonDown(wxJoystickEvent& event); +#endif + +protected: + int m_selection; + wxString m_stringSelection; + + void DoChoice(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog) + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// wxMultiChoiceDialog: a dialog with multi selection listbox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMultiChoiceDialog : public wxAnyChoiceDialog +{ +public: + wxMultiChoiceDialog() { } + + wxMultiChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + (void)Create(parent, message, caption, n, choices, style, pos); + } + wxMultiChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + (void)Create(parent, message, caption, choices, style, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + + void SetSelections(const wxArrayInt& selections); + wxArrayInt GetSelections() const { return m_selections; } + + // implementation from now on + virtual bool TransferDataFromWindow(); + +protected: +#if wxUSE_CHECKLISTBOX + virtual wxListBoxBase *CreateList(int n, + const wxString *choices, + long styleLbox); +#endif // wxUSE_CHECKLISTBOX + + wxArrayInt m_selections; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog) +}; + +// ---------------------------------------------------------------------------- +// wrapper functions which can be used to get selection(s) from the user +// ---------------------------------------------------------------------------- + +// get the user selection as a string +WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +// Same as above but gets position in list of strings, instead of string, +// or -1 if no selection +WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +// Return client data instead or NULL if cancelled +WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + void **client_data, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + void **client_data, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +// fill the array with the indices of the chosen items, it will be empty +// if no items were selected or Cancel was pressed - return the number of +// selections +WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +#endif // _WX_GENERIC_CHOICDGG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/clrpickerg.h b/Externals/wxWidgets/include/wx/generic/clrpickerg.h index 36f05d51a4..b7be525e70 100644 --- a/Externals/wxWidgets/include/wx/generic/clrpickerg.h +++ b/Externals/wxWidgets/include/wx/generic/clrpickerg.h @@ -1,88 +1,88 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/clrpickerg.h -// Purpose: wxGenericColourButton header -// Author: Francesco Montorsi (based on Vadim Zeitlin's code) -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: clrpickerg.h 40322 2006-07-25 11:41:53Z ABX $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLRPICKER_H_ -#define _WX_CLRPICKER_H_ - -#include "wx/button.h" -#include "wx/cmndata.h" - -//----------------------------------------------------------------------------- -// wxGenericColourButton: a button which brings up a wxColourDialog -//----------------------------------------------------------------------------- - -// show the colour in HTML form (#AABBCC) as colour button label -#define wxCLRBTN_SHOW_LABEL 100 - -// the default style -#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL) - - -class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton, - public wxColourPickerWidgetBase -{ -public: - wxGenericColourButton() {} - wxGenericColourButton(wxWindow *parent, - wxWindowID id, - const wxColour& col = *wxBLACK, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCLRBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerWidgetNameStr) - { - Create(parent, id, col, pos, size, style, validator, name); - } - - virtual ~wxGenericColourButton() {} - - -public: // API extensions specific for wxGenericColourButton - - // user can override this to init colour data in a different way - virtual void InitColourData(); - - // returns the colour data shown in wxColourDialog - wxColourData *GetColourData() { return &ms_data; } - - -public: - - bool Create(wxWindow *parent, - wxWindowID id, - const wxColour& col = *wxBLACK, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCLRBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxColourPickerWidgetNameStr); - - void OnButtonClick(wxCommandEvent &); - - -protected: - - wxSize DoGetBestSize() const; - - void UpdateColour(); - - // the colour data shown in wxColourPickerCtrlGeneric - // controls. This member is static so that all colour pickers - // in the program share the same set of custom colours. - static wxColourData ms_data; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericColourButton) -}; - - -#endif // _WX_CLRPICKER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/clrpickerg.h +// Purpose: wxGenericColourButton header +// Author: Francesco Montorsi (based on Vadim Zeitlin's code) +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Vadim Zeitlin, Francesco Montorsi +// RCS-ID: $Id: clrpickerg.h 40322 2006-07-25 11:41:53Z ABX $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLRPICKER_H_ +#define _WX_CLRPICKER_H_ + +#include "wx/button.h" +#include "wx/cmndata.h" + +//----------------------------------------------------------------------------- +// wxGenericColourButton: a button which brings up a wxColourDialog +//----------------------------------------------------------------------------- + +// show the colour in HTML form (#AABBCC) as colour button label +#define wxCLRBTN_SHOW_LABEL 100 + +// the default style +#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL) + + +class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton, + public wxColourPickerWidgetBase +{ +public: + wxGenericColourButton() {} + wxGenericColourButton(wxWindow *parent, + wxWindowID id, + const wxColour& col = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxColourPickerWidgetNameStr) + { + Create(parent, id, col, pos, size, style, validator, name); + } + + virtual ~wxGenericColourButton() {} + + +public: // API extensions specific for wxGenericColourButton + + // user can override this to init colour data in a different way + virtual void InitColourData(); + + // returns the colour data shown in wxColourDialog + wxColourData *GetColourData() { return &ms_data; } + + +public: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxColour& col = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxColourPickerWidgetNameStr); + + void OnButtonClick(wxCommandEvent &); + + +protected: + + wxSize DoGetBestSize() const; + + void UpdateColour(); + + // the colour data shown in wxColourPickerCtrlGeneric + // controls. This member is static so that all colour pickers + // in the program share the same set of custom colours. + static wxColourData ms_data; + +private: + DECLARE_DYNAMIC_CLASS(wxGenericColourButton) +}; + + +#endif // _WX_CLRPICKER_H_ diff --git a/Externals/wxWidgets/include/wx/generic/collpaneg.h b/Externals/wxWidgets/include/wx/generic/collpaneg.h index b16b65948c..412c679803 100644 --- a/Externals/wxWidgets/include/wx/generic/collpaneg.h +++ b/Externals/wxWidgets/include/wx/generic/collpaneg.h @@ -1,105 +1,105 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/collpaneg.h -// Purpose: wxGenericCollapsiblePane -// Author: Francesco Montorsi -// Modified by: -// Created: 8/10/2006 -// RCS-ID: $Id: collpaneg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLLAPSABLE_PANE_H_GENERIC_ -#define _WX_COLLAPSABLE_PANE_H_GENERIC_ - -// forward declared -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxStaticLine; - -// class name -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[]; - -// ---------------------------------------------------------------------------- -// wxGenericCollapsiblePane -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase -{ -public: - wxGenericCollapsiblePane() { Init(); } - - wxGenericCollapsiblePane(wxWindow *parent, - wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCP_DEFAULT_STYLE, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxCollapsiblePaneNameStr) - { - Init(); - - Create(parent, winid, label, pos, size, style, val, name); - } - - void Init() - { - m_pButton = NULL; - m_pPane = NULL; - m_pStaticLine = NULL; - m_sz = NULL; - } - - ~wxGenericCollapsiblePane(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCP_DEFAULT_STYLE, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxCollapsiblePaneNameStr); - - // public wxCollapsiblePane API - virtual void Collapse(bool collapse = true); - virtual void SetLabel(const wxString &label); - - virtual bool IsCollapsed() const - { return m_pPane==NULL || !m_pPane->IsShown(); } - virtual wxWindow *GetPane() const - { return m_pPane; } - virtual wxString GetLabel() const - { return m_strLabel; } - - virtual bool Layout(); - - // implementation only, don't use - void OnStateChange(const wxSize& sizeNew); - -protected: - // overridden methods - virtual wxSize DoGetBestSize() const; - - wxString GetBtnLabel() const; - int GetBorder() const; - - // child controls - wxButton *m_pButton; - wxStaticLine *m_pStaticLine; - wxWindow *m_pPane; - wxSizer *m_sz; - - // the button label without ">>" or "<<" - wxString m_strLabel; - -private: - // event handlers - void OnButton(wxCommandEvent &ev); - void OnSize(wxSizeEvent &ev); - - DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/collpaneg.h +// Purpose: wxGenericCollapsiblePane +// Author: Francesco Montorsi +// Modified by: +// Created: 8/10/2006 +// RCS-ID: $Id: collpaneg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSABLE_PANE_H_GENERIC_ +#define _WX_COLLAPSABLE_PANE_H_GENERIC_ + +// forward declared +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxStaticLine; + +// class name +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[]; + +// ---------------------------------------------------------------------------- +// wxGenericCollapsiblePane +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase +{ +public: + wxGenericCollapsiblePane() { Init(); } + + wxGenericCollapsiblePane(wxWindow *parent, + wxWindowID winid, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCP_DEFAULT_STYLE, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxCollapsiblePaneNameStr) + { + Init(); + + Create(parent, winid, label, pos, size, style, val, name); + } + + void Init() + { + m_pButton = NULL; + m_pPane = NULL; + m_pStaticLine = NULL; + m_sz = NULL; + } + + ~wxGenericCollapsiblePane(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCP_DEFAULT_STYLE, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxCollapsiblePaneNameStr); + + // public wxCollapsiblePane API + virtual void Collapse(bool collapse = true); + virtual void SetLabel(const wxString &label); + + virtual bool IsCollapsed() const + { return m_pPane==NULL || !m_pPane->IsShown(); } + virtual wxWindow *GetPane() const + { return m_pPane; } + virtual wxString GetLabel() const + { return m_strLabel; } + + virtual bool Layout(); + + // implementation only, don't use + void OnStateChange(const wxSize& sizeNew); + +protected: + // overridden methods + virtual wxSize DoGetBestSize() const; + + wxString GetBtnLabel() const; + int GetBorder() const; + + // child controls + wxButton *m_pButton; + wxStaticLine *m_pStaticLine; + wxWindow *m_pPane; + wxSizer *m_sz; + + // the button label without ">>" or "<<" + wxString m_strLabel; + +private: + // event handlers + void OnButton(wxCommandEvent &ev); + void OnSize(wxSizeEvent &ev); + + DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ diff --git a/Externals/wxWidgets/include/wx/generic/colour.h b/Externals/wxWidgets/include/wx/generic/colour.h index 3ac7a8f430..826e2c363c 100644 --- a/Externals/wxWidgets/include/wx/generic/colour.h +++ b/Externals/wxWidgets/include/wx/generic/colour.h @@ -1,75 +1,75 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/colour.h -// Purpose: wxColour class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colour.h 41751 2006-10-08 21:56:55Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_COLOUR_H_ -#define _WX_GENERIC_COLOUR_H_ - -#include "wx/object.h" - -// Colour -class WXDLLEXPORT wxColour: public wxColourBase -{ -public: - // constructors - // ------------ - - // default - wxColour(); - DEFINE_STD_WXCOLOUR_CONSTRUCTORS - - // copy ctors and assignment operators - wxColour(const wxColour& col); - wxColour& operator=(const wxColour& col); - - // dtor - virtual ~wxColour(); - - // accessors - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_isInit; } - - unsigned char Red() const { return m_red; } - unsigned char Green() const { return m_green; } - unsigned char Blue() const { return m_blue; } - unsigned char Alpha() const { return m_alpha; } - - // comparison - bool operator==(const wxColour& colour) const - { - return (m_red == colour.m_red && - m_green == colour.m_green && - m_blue == colour.m_blue && - m_alpha == colour.m_alpha && - m_isInit == colour.m_isInit); - } - - bool operator!=(const wxColour& colour) const { return !(*this == colour); } - -protected: - - // Helper function - void Init(); - - virtual void - InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); - -private: - bool m_isInit; - unsigned char m_red; - unsigned char m_blue; - unsigned char m_green; - unsigned char m_alpha; - -private: - DECLARE_DYNAMIC_CLASS(wxColour) -}; - -#endif // _WX_GENERIC_COLOUR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/colour.h +// Purpose: wxColour class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: colour.h 41751 2006-10-08 21:56:55Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COLOUR_H_ +#define _WX_GENERIC_COLOUR_H_ + +#include "wx/object.h" + +// Colour +class WXDLLEXPORT wxColour: public wxColourBase +{ +public: + // constructors + // ------------ + + // default + wxColour(); + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + // copy ctors and assignment operators + wxColour(const wxColour& col); + wxColour& operator=(const wxColour& col); + + // dtor + virtual ~wxColour(); + + // accessors + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_isInit; } + + unsigned char Red() const { return m_red; } + unsigned char Green() const { return m_green; } + unsigned char Blue() const { return m_blue; } + unsigned char Alpha() const { return m_alpha; } + + // comparison + bool operator==(const wxColour& colour) const + { + return (m_red == colour.m_red && + m_green == colour.m_green && + m_blue == colour.m_blue && + m_alpha == colour.m_alpha && + m_isInit == colour.m_isInit); + } + + bool operator!=(const wxColour& colour) const { return !(*this == colour); } + +protected: + + // Helper function + void Init(); + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + unsigned char m_alpha; + +private: + DECLARE_DYNAMIC_CLASS(wxColour) +}; + +#endif // _WX_GENERIC_COLOUR_H_ diff --git a/Externals/wxWidgets/include/wx/generic/colrdlgg.h b/Externals/wxWidgets/include/wx/generic/colrdlgg.h index 5ae55b2c12..77a3d6e3d9 100644 --- a/Externals/wxWidgets/include/wx/generic/colrdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/colrdlgg.h @@ -1,120 +1,120 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/colrdlgg.h -// Purpose: wxGenericColourDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colrdlgg.h 37164 2006-01-26 17:20:50Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __COLORDLGH_G__ -#define __COLORDLGH_G__ - -#include "wx/defs.h" -#include "wx/gdicmn.h" -#include "wx/dialog.h" -#include "wx/cmndata.h" - -#define wxID_ADD_CUSTOM 3000 - -#if wxUSE_SLIDER - - #define wxID_RED_SLIDER 3001 - #define wxID_GREEN_SLIDER 3002 - #define wxID_BLUE_SLIDER 3003 - - class WXDLLEXPORT wxSlider; - -#endif // wxUSE_SLIDER - -class WXDLLEXPORT wxGenericColourDialog : public wxDialog -{ -public: - wxGenericColourDialog(); - wxGenericColourDialog(wxWindow *parent, - wxColourData *data = (wxColourData *) NULL); - virtual ~wxGenericColourDialog(); - - bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); - - wxColourData &GetColourData() { return colourData; } - - virtual int ShowModal(); - - // Internal functions - void OnMouseEvent(wxMouseEvent& event); - void OnPaint(wxPaintEvent& event); - - virtual void CalculateMeasurements(); - virtual void CreateWidgets(); - virtual void InitializeColours(); - - virtual void PaintBasicColours(wxDC& dc); - virtual void PaintCustomColours(wxDC& dc); - virtual void PaintCustomColour(wxDC& dc); - virtual void PaintHighlight(wxDC& dc, bool draw); - - virtual void OnBasicColourClick(int which); - virtual void OnCustomColourClick(int which); - - void OnAddCustom(wxCommandEvent& event); - -#if wxUSE_SLIDER - void OnRedSlider(wxCommandEvent& event); - void OnGreenSlider(wxCommandEvent& event); - void OnBlueSlider(wxCommandEvent& event); -#endif // wxUSE_SLIDER - - void OnCloseWindow(wxCloseEvent& event); - -protected: - wxColourData colourData; - wxWindow *dialogParent; - - // Area reserved for grids of colours - wxRect standardColoursRect; - wxRect customColoursRect; - wxRect singleCustomColourRect; - - // Size of each colour rectangle - wxPoint smallRectangleSize; - - // For single customizable colour - wxPoint customRectangleSize; - - // Grid spacing (between rectangles) - int gridSpacing; - - // Section spacing (between left and right halves of dialog box) - int sectionSpacing; - - // 48 'standard' colours - wxColour standardColours[48]; - - // 16 'custom' colours - wxColour customColours[16]; - - // Which colour is selected? An index into one of the two areas. - int colourSelection; - int whichKind; // 1 for standard colours, 2 for custom colours, - -#if wxUSE_SLIDER - wxSlider *redSlider; - wxSlider *greenSlider; - wxSlider *blueSlider; -#endif // wxUSE_SLIDER - - int buttonY; - - int okButtonX; - int customButtonX; - - // static bool colourDialogCancelled; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) -}; - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/colrdlgg.h +// Purpose: wxGenericColourDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: colrdlgg.h 37164 2006-01-26 17:20:50Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __COLORDLGH_G__ +#define __COLORDLGH_G__ + +#include "wx/defs.h" +#include "wx/gdicmn.h" +#include "wx/dialog.h" +#include "wx/cmndata.h" + +#define wxID_ADD_CUSTOM 3000 + +#if wxUSE_SLIDER + + #define wxID_RED_SLIDER 3001 + #define wxID_GREEN_SLIDER 3002 + #define wxID_BLUE_SLIDER 3003 + + class WXDLLEXPORT wxSlider; + +#endif // wxUSE_SLIDER + +class WXDLLEXPORT wxGenericColourDialog : public wxDialog +{ +public: + wxGenericColourDialog(); + wxGenericColourDialog(wxWindow *parent, + wxColourData *data = (wxColourData *) NULL); + virtual ~wxGenericColourDialog(); + + bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); + + wxColourData &GetColourData() { return colourData; } + + virtual int ShowModal(); + + // Internal functions + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + + virtual void CalculateMeasurements(); + virtual void CreateWidgets(); + virtual void InitializeColours(); + + virtual void PaintBasicColours(wxDC& dc); + virtual void PaintCustomColours(wxDC& dc); + virtual void PaintCustomColour(wxDC& dc); + virtual void PaintHighlight(wxDC& dc, bool draw); + + virtual void OnBasicColourClick(int which); + virtual void OnCustomColourClick(int which); + + void OnAddCustom(wxCommandEvent& event); + +#if wxUSE_SLIDER + void OnRedSlider(wxCommandEvent& event); + void OnGreenSlider(wxCommandEvent& event); + void OnBlueSlider(wxCommandEvent& event); +#endif // wxUSE_SLIDER + + void OnCloseWindow(wxCloseEvent& event); + +protected: + wxColourData colourData; + wxWindow *dialogParent; + + // Area reserved for grids of colours + wxRect standardColoursRect; + wxRect customColoursRect; + wxRect singleCustomColourRect; + + // Size of each colour rectangle + wxPoint smallRectangleSize; + + // For single customizable colour + wxPoint customRectangleSize; + + // Grid spacing (between rectangles) + int gridSpacing; + + // Section spacing (between left and right halves of dialog box) + int sectionSpacing; + + // 48 'standard' colours + wxColour standardColours[48]; + + // 16 'custom' colours + wxColour customColours[16]; + + // Which colour is selected? An index into one of the two areas. + int colourSelection; + int whichKind; // 1 for standard colours, 2 for custom colours, + +#if wxUSE_SLIDER + wxSlider *redSlider; + wxSlider *greenSlider; + wxSlider *blueSlider; +#endif // wxUSE_SLIDER + + int buttonY; + + int okButtonX; + int customButtonX; + + // static bool colourDialogCancelled; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) +}; + +#endif diff --git a/Externals/wxWidgets/include/wx/generic/combo.h b/Externals/wxWidgets/include/wx/generic/combo.h index 27df371408..1b2518539e 100644 --- a/Externals/wxWidgets/include/wx/generic/combo.h +++ b/Externals/wxWidgets/include/wx/generic/combo.h @@ -1,140 +1,140 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/combo.h -// Purpose: Generic wxComboCtrl -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 41835 2006-10-09 20:12:19Z RR $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_COMBOCTRL_H_ -#define _WX_GENERIC_COMBOCTRL_H_ - -#if wxUSE_COMBOCTRL - -// Only define generic if native doesn't have all the features -#if !defined(wxCOMBOCONTROL_FULLY_FEATURED) - -// ---------------------------------------------------------------------------- -// Generic wxComboCtrl -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - -// all actions of single line text controls are supported - -// popup/dismiss the choice window -#define wxACTION_COMBOBOX_POPUP _T("popup") -#define wxACTION_COMBOBOX_DISMISS _T("dismiss") - -#endif - -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; - -class WXDLLEXPORT wxGenericComboCtrl : public wxComboCtrlBase -{ -public: - // ctors and such - wxGenericComboCtrl() : wxComboCtrlBase() { Init(); } - - wxGenericComboCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxComboCtrlBase() - { - Init(); - - (void)Create(parent, id, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - virtual ~wxGenericComboCtrl(); - - void SetCustomPaintWidth( int width ); - - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; - - static int GetFeatures() { return wxComboCtrlFeatures::All; } - -#if defined(__WXUNIVERSAL__) - // we have our own input handler and our own actions - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0l, - const wxString& strArg = wxEmptyString); -#endif - -protected: - - // Mandatory virtuals - virtual void OnResize(); - - // Event handlers - void OnPaintEvent( wxPaintEvent& event ); - void OnMouseEvent( wxMouseEvent& event ); - -private: - void Init(); - - DECLARE_EVENT_TABLE() - - DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl) -}; - - -#ifndef _WX_COMBOCONTROL_H_ - -// If native wxComboCtrl was not defined, then prepare a simple -// front-end so that wxRTTI works as expected. - -class WXDLLEXPORT wxComboCtrl : public wxGenericComboCtrl -{ -public: - wxComboCtrl() : wxGenericComboCtrl() {} - - wxComboCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxGenericComboCtrl() - { - (void)Create(parent, id, value, pos, size, style, validator, name); - } - - virtual ~wxComboCtrl() {} - -protected: - -private: - DECLARE_DYNAMIC_CLASS(wxComboCtrl) -}; - -#endif // _WX_COMBOCONTROL_H_ - -#else - -#define wxGenericComboCtrl wxComboCtrl - -#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) - -#endif // wxUSE_COMBOCTRL -#endif - // _WX_GENERIC_COMBOCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/combo.h +// Purpose: Generic wxComboCtrl +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id: combo.h 41835 2006-10-09 20:12:19Z RR $ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COMBOCTRL_H_ +#define _WX_GENERIC_COMBOCTRL_H_ + +#if wxUSE_COMBOCTRL + +// Only define generic if native doesn't have all the features +#if !defined(wxCOMBOCONTROL_FULLY_FEATURED) + +// ---------------------------------------------------------------------------- +// Generic wxComboCtrl +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + +// all actions of single line text controls are supported + +// popup/dismiss the choice window +#define wxACTION_COMBOBOX_POPUP _T("popup") +#define wxACTION_COMBOBOX_DISMISS _T("dismiss") + +#endif + +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; + +class WXDLLEXPORT wxGenericComboCtrl : public wxComboCtrlBase +{ +public: + // ctors and such + wxGenericComboCtrl() : wxComboCtrlBase() { Init(); } + + wxGenericComboCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboCtrlBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxGenericComboCtrl(); + + void SetCustomPaintWidth( int width ); + + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; + + static int GetFeatures() { return wxComboCtrlFeatures::All; } + +#if defined(__WXUNIVERSAL__) + // we have our own input handler and our own actions + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); +#endif + +protected: + + // Mandatory virtuals + virtual void OnResize(); + + // Event handlers + void OnPaintEvent( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + +private: + void Init(); + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl) +}; + + +#ifndef _WX_COMBOCONTROL_H_ + +// If native wxComboCtrl was not defined, then prepare a simple +// front-end so that wxRTTI works as expected. + +class WXDLLEXPORT wxComboCtrl : public wxGenericComboCtrl +{ +public: + wxComboCtrl() : wxGenericComboCtrl() {} + + wxComboCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxGenericComboCtrl() + { + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + virtual ~wxComboCtrl() {} + +protected: + +private: + DECLARE_DYNAMIC_CLASS(wxComboCtrl) +}; + +#endif // _WX_COMBOCONTROL_H_ + +#else + +#define wxGenericComboCtrl wxComboCtrl + +#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) + +#endif // wxUSE_COMBOCTRL +#endif + // _WX_GENERIC_COMBOCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/generic/dataview.h b/Externals/wxWidgets/include/wx/generic/dataview.h index 7369063e92..e6222abc68 100644 --- a/Externals/wxWidgets/include/wx/generic/dataview.h +++ b/Externals/wxWidgets/include/wx/generic/dataview.h @@ -1,311 +1,311 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/dataview.h -// Purpose: wxDataViewCtrl generic implementation header -// Author: Robert Roebling -// Id: $Id: dataview.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __GENERICDATAVIEWCTRLH__ -#define __GENERICDATAVIEWCTRLH__ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/list.h" -#include "wx/control.h" -#include "wx/scrolwin.h" -#include "wx/icon.h" - -// --------------------------------------------------------- -// classes -// --------------------------------------------------------- - -class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; -class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow; -class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow; - -// --------------------------------------------------------- -// wxDataViewRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase -{ -public: - wxDataViewRenderer( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - virtual ~wxDataViewRenderer(); - - virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; - virtual wxSize GetSize() = 0; - - virtual bool Activate( wxRect WXUNUSED(cell), - wxDataViewListModel *WXUNUSED(model), - unsigned int WXUNUSED(col), - unsigned int WXUNUSED(row) ) - { return false; } - - virtual bool LeftClick( wxPoint WXUNUSED(cursor), - wxRect WXUNUSED(cell), - wxDataViewListModel *WXUNUSED(model), - unsigned int WXUNUSED(col), - unsigned int WXUNUSED(row) ) - { return false; } - virtual bool RightClick( wxPoint WXUNUSED(cursor), - wxRect WXUNUSED(cell), - wxDataViewListModel *WXUNUSED(model), - unsigned int WXUNUSED(col), - unsigned int WXUNUSED(row) ) - { return false; } - virtual bool StartDrag( wxPoint WXUNUSED(cursor), - wxRect WXUNUSED(cell), - wxDataViewListModel *WXUNUSED(model), - unsigned int WXUNUSED(col), - unsigned int WXUNUSED(row) ) - { return false; } - - // Create DC on request - virtual wxDC *GetDC(); - -private: - wxDC *m_dc; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewCustomRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer -{ -public: - wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewTextRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewCustomRenderer -{ -public: - wxDataViewTextRenderer( const wxString &varianttype = wxT("string"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ); - - bool Render( wxRect cell, wxDC *dc, int state ); - wxSize GetSize(); - -private: - wxString m_text; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewBitmapRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewCustomRenderer -{ -public: - wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ); - - bool Render( wxRect cell, wxDC *dc, int state ); - wxSize GetSize(); - -private: - wxIcon m_icon; - wxBitmap m_bitmap; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewToggleRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewCustomRenderer -{ -public: - wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ); - - bool Render( wxRect cell, wxDC *dc, int state ); - bool Activate( wxRect cell, wxDataViewListModel *model, unsigned int col, unsigned int row ); - wxSize GetSize(); - -private: - bool m_toggle; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewProgressRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer -{ -public: - wxDataViewProgressRenderer( const wxString &label = wxEmptyString, - const wxString &varianttype = wxT("long"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); - virtual ~wxDataViewProgressRenderer(); - - bool SetValue( const wxVariant &value ); - - virtual bool Render( wxRect cell, wxDC *dc, int state ); - virtual wxSize GetSize(); - -private: - wxString m_label; - int m_value; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewDateRenderer -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer -{ -public: - wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE ); - - bool SetValue( const wxVariant &value ); - - virtual bool Render( wxRect cell, wxDC *dc, int state ); - virtual wxSize GetSize(); - virtual bool Activate( wxRect cell, - wxDataViewListModel *model, unsigned int col, unsigned int row ); - -private: - wxDateTime m_date; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) -}; - -// --------------------------------------------------------- -// wxDataViewColumn -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase -{ -public: - wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer, unsigned int model_column, - int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); - wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer, unsigned int model_column, - int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); - virtual ~wxDataViewColumn(); - - virtual void SetTitle( const wxString &title ); - virtual void SetBitmap( const wxBitmap &bitmap ); - - virtual void SetAlignment( wxAlignment align ); - - virtual void SetSortable( bool sortable ); - virtual bool GetSortable(); - virtual void SetSortOrder( bool ascending ); - virtual bool IsSortOrderAscending(); - - virtual int GetWidth(); - -private: - int m_width; - int m_fixedWidth; - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) -}; - -// --------------------------------------------------------- -// wxDataViewCtrl -// --------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase, - public wxScrollHelperNative -{ -public: - wxDataViewCtrl() : wxScrollHelperNative(this) - { - Init(); - } - - wxDataViewCtrl( wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator ) - : wxScrollHelperNative(this) - { - Create(parent, id, pos, size, style, validator ); - } - - virtual ~wxDataViewCtrl(); - - void Init(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator ); - - virtual bool AssociateModel( wxDataViewListModel *model ); - virtual bool AppendColumn( wxDataViewColumn *col ); - - virtual void SetSelection( int row ); // -1 for unselect - virtual void SetSelectionRange( unsigned int from, unsigned int to ); - virtual void SetSelections( const wxArrayInt& aSelections); - virtual void Unselect( unsigned int row ); - - virtual bool IsSelected( unsigned int row ) const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - -private: - friend class wxDataViewMainWindow; - friend class wxDataViewHeaderWindow; - wxDataViewListModelNotifier *m_notifier; - wxDataViewMainWindow *m_clientArea; - wxDataViewHeaderWindow *m_headerArea; - -private: - void OnSize( wxSizeEvent &event ); - - // we need to return a special WM_GETDLGCODE value to process just the - // arrows but let the other navigation characters through -#ifdef __WXMSW__ - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); -#endif // __WXMSW__ - - WX_FORWARD_TO_SCROLL_HELPER() - -private: - DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) - DECLARE_NO_COPY_CLASS(wxDataViewCtrl) - DECLARE_EVENT_TABLE() -}; - - -#endif // __GENERICDATAVIEWCTRLH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dataview.h +// Purpose: wxDataViewCtrl generic implementation header +// Author: Robert Roebling +// Id: $Id: dataview.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GENERICDATAVIEWCTRLH__ +#define __GENERICDATAVIEWCTRLH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" +#include "wx/scrolwin.h" +#include "wx/icon.h" + +// --------------------------------------------------------- +// classes +// --------------------------------------------------------- + +class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; +class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow; +class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow; + +// --------------------------------------------------------- +// wxDataViewRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase +{ +public: + wxDataViewRenderer( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + virtual ~wxDataViewRenderer(); + + virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; + virtual wxSize GetSize() = 0; + + virtual bool Activate( wxRect WXUNUSED(cell), + wxDataViewListModel *WXUNUSED(model), + unsigned int WXUNUSED(col), + unsigned int WXUNUSED(row) ) + { return false; } + + virtual bool LeftClick( wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewListModel *WXUNUSED(model), + unsigned int WXUNUSED(col), + unsigned int WXUNUSED(row) ) + { return false; } + virtual bool RightClick( wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewListModel *WXUNUSED(model), + unsigned int WXUNUSED(col), + unsigned int WXUNUSED(row) ) + { return false; } + virtual bool StartDrag( wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewListModel *WXUNUSED(model), + unsigned int WXUNUSED(col), + unsigned int WXUNUSED(row) ) + { return false; } + + // Create DC on request + virtual wxDC *GetDC(); + +private: + wxDC *m_dc; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewCustomRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer +{ +public: + wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewTextRenderer( const wxString &varianttype = wxT("string"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ); + + bool Render( wxRect cell, wxDC *dc, int state ); + wxSize GetSize(); + +private: + wxString m_text; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewBitmapRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ); + + bool Render( wxRect cell, wxDC *dc, int state ); + wxSize GetSize(); + +private: + wxIcon m_icon; + wxBitmap m_bitmap; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ); + + bool Render( wxRect cell, wxDC *dc, int state ); + bool Activate( wxRect cell, wxDataViewListModel *model, unsigned int col, unsigned int row ); + wxSize GetSize(); + +private: + bool m_toggle; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewProgressRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewProgressRenderer( const wxString &label = wxEmptyString, + const wxString &varianttype = wxT("long"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); + virtual ~wxDataViewProgressRenderer(); + + bool SetValue( const wxVariant &value ); + + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize(); + +private: + wxString m_label; + int m_value; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewDateRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE ); + + bool SetValue( const wxVariant &value ); + + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize(); + virtual bool Activate( wxRect cell, + wxDataViewListModel *model, unsigned int col, unsigned int row ); + +private: + wxDateTime m_date; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewColumn +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase +{ +public: + wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer, unsigned int model_column, + int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer, unsigned int model_column, + int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); + virtual ~wxDataViewColumn(); + + virtual void SetTitle( const wxString &title ); + virtual void SetBitmap( const wxBitmap &bitmap ); + + virtual void SetAlignment( wxAlignment align ); + + virtual void SetSortable( bool sortable ); + virtual bool GetSortable(); + virtual void SetSortOrder( bool ascending ); + virtual bool IsSortOrderAscending(); + + virtual int GetWidth(); + +private: + int m_width; + int m_fixedWidth; + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) +}; + +// --------------------------------------------------------- +// wxDataViewCtrl +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase, + public wxScrollHelperNative +{ +public: + wxDataViewCtrl() : wxScrollHelperNative(this) + { + Init(); + } + + wxDataViewCtrl( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator ) + : wxScrollHelperNative(this) + { + Create(parent, id, pos, size, style, validator ); + } + + virtual ~wxDataViewCtrl(); + + void Init(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator ); + + virtual bool AssociateModel( wxDataViewListModel *model ); + virtual bool AppendColumn( wxDataViewColumn *col ); + + virtual void SetSelection( int row ); // -1 for unselect + virtual void SetSelectionRange( unsigned int from, unsigned int to ); + virtual void SetSelections( const wxArrayInt& aSelections); + virtual void Unselect( unsigned int row ); + + virtual bool IsSelected( unsigned int row ) const; + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + +private: + friend class wxDataViewMainWindow; + friend class wxDataViewHeaderWindow; + wxDataViewListModelNotifier *m_notifier; + wxDataViewMainWindow *m_clientArea; + wxDataViewHeaderWindow *m_headerArea; + +private: + void OnSize( wxSizeEvent &event ); + + // we need to return a special WM_GETDLGCODE value to process just the + // arrows but let the other navigation characters through +#ifdef __WXMSW__ + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); +#endif // __WXMSW__ + + WX_FORWARD_TO_SCROLL_HELPER() + +private: + DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) + DECLARE_NO_COPY_CLASS(wxDataViewCtrl) + DECLARE_EVENT_TABLE() +}; + + +#endif // __GENERICDATAVIEWCTRLH__ diff --git a/Externals/wxWidgets/include/wx/generic/datectrl.h b/Externals/wxWidgets/include/wx/generic/datectrl.h index 6fd107b19c..bb3f01efcc 100644 --- a/Externals/wxWidgets/include/wx/generic/datectrl.h +++ b/Externals/wxWidgets/include/wx/generic/datectrl.h @@ -1,91 +1,91 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: generic/datectrl.h -// Purpose: generic wxDatePickerCtrl implementation -// Author: Andreas Pflug -// Modified by: -// Created: 2005-01-19 -// RCS-ID: $Id: datectrl.h 42539 2006-10-27 18:02:21Z RR $ -// Copyright: (c) 2005 Andreas Pflug -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_DATECTRL_H_ -#define _WX_GENERIC_DATECTRL_H_ - -class WXDLLIMPEXP_ADV wxCalendarDateAttr; -class WXDLLIMPEXP_ADV wxCalendarCtrl; -class WXDLLIMPEXP_ADV wxCalendarEvent; -class WXDLLIMPEXP_ADV wxComboCtrl; -class WXDLLIMPEXP_ADV wxCalendarComboPopup; - -class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase -{ -public: - // creating the control - wxDatePickerCtrlGeneric() { Init(); } - virtual ~wxDatePickerCtrlGeneric(); - wxDatePickerCtrlGeneric(wxWindow *parent, - wxWindowID id, - const wxDateTime& date = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDatePickerCtrlNameStr) - { - Init(); - - (void)Create(parent, id, date, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxDateTime& date = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDatePickerCtrlNameStr); - - // wxDatePickerCtrl methods - void SetValue(const wxDateTime& date); - wxDateTime GetValue() const; - - bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; - void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); - - bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, - const wxDateTime& upperdate = wxDefaultDateTime); - - // extra methods available only in this (generic) implementation - bool SetFormat(const wxChar *fmt); - wxCalendarCtrl *GetCalendar() const { return m_cal; } - - - // implementation only from now on - // ------------------------------- - - // overridden base class methods - virtual bool Destroy(); - -protected: - virtual wxSize DoGetBestSize() const; - -private: - void Init(); - - void OnText(wxCommandEvent &event); - void OnSize(wxSizeEvent& event); - void OnFocus(wxFocusEvent& event); - - wxCalendarCtrl *m_cal; - wxComboCtrl* m_combo; - wxCalendarComboPopup* m_popup; - - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) -}; - -#endif // _WX_GENERIC_DATECTRL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: generic/datectrl.h +// Purpose: generic wxDatePickerCtrl implementation +// Author: Andreas Pflug +// Modified by: +// Created: 2005-01-19 +// RCS-ID: $Id: datectrl.h 42539 2006-10-27 18:02:21Z RR $ +// Copyright: (c) 2005 Andreas Pflug +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_DATECTRL_H_ +#define _WX_GENERIC_DATECTRL_H_ + +class WXDLLIMPEXP_ADV wxCalendarDateAttr; +class WXDLLIMPEXP_ADV wxCalendarCtrl; +class WXDLLIMPEXP_ADV wxCalendarEvent; +class WXDLLIMPEXP_ADV wxComboCtrl; +class WXDLLIMPEXP_ADV wxCalendarComboPopup; + +class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase +{ +public: + // creating the control + wxDatePickerCtrlGeneric() { Init(); } + virtual ~wxDatePickerCtrlGeneric(); + wxDatePickerCtrlGeneric(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr) + { + Init(); + + (void)Create(parent, id, date, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr); + + // wxDatePickerCtrl methods + void SetValue(const wxDateTime& date); + wxDateTime GetValue() const; + + bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; + void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); + + bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime); + + // extra methods available only in this (generic) implementation + bool SetFormat(const wxChar *fmt); + wxCalendarCtrl *GetCalendar() const { return m_cal; } + + + // implementation only from now on + // ------------------------------- + + // overridden base class methods + virtual bool Destroy(); + +protected: + virtual wxSize DoGetBestSize() const; + +private: + void Init(); + + void OnText(wxCommandEvent &event); + void OnSize(wxSizeEvent& event); + void OnFocus(wxFocusEvent& event); + + wxCalendarCtrl *m_cal; + wxComboCtrl* m_combo; + wxCalendarComboPopup* m_popup; + + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) +}; + +#endif // _WX_GENERIC_DATECTRL_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/dcpsg.h b/Externals/wxWidgets/include/wx/generic/dcpsg.h index 21e1b74910..5477bb961d 100644 --- a/Externals/wxWidgets/include/wx/generic/dcpsg.h +++ b/Externals/wxWidgets/include/wx/generic/dcpsg.h @@ -1,154 +1,154 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/dcps.h -// Purpose: wxPostScriptDC class -// Author: Julian Smart and others -// Modified by: -// RCS-ID: $Id: dcpsg.h 41751 2006-10-08 21:56:55Z VZ $ -// Copyright: (c) Julian Smart and Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCPSG_H_ -#define _WX_DCPSG_H_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#if wxUSE_POSTSCRIPT - -#include "wx/dc.h" -#include "wx/dialog.h" -#include "wx/module.h" -#include "wx/cmndata.h" - -extern WXDLLIMPEXP_DATA_CORE(int) wxPageNumber; - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class wxPostScriptDC; - -//----------------------------------------------------------------------------- -// wxPostScriptDC -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxPostScriptDC: public wxDC -{ -public: - wxPostScriptDC(); - - // Recommended constructor - wxPostScriptDC(const wxPrintData& printData); - - // Recommended destructor :-) - virtual ~wxPostScriptDC(); - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - - bool CanDrawBitmap() const { return true; } - - void Clear(); - void SetFont( const wxFont& font ); - void SetPen( const wxPen& pen ); - void SetBrush( const wxBrush& brush ); - void SetLogicalFunction( int function ); - void SetBackground( const wxBrush& brush ); - - void DestroyClippingRegion(); - - bool StartDoc(const wxString& message); - void EndDoc(); - void StartPage(); - void EndPage(); - - wxCoord GetCharHeight() const; - wxCoord GetCharWidth() const; - bool CanGetTextExtent() const { return true; } - - // Resolution in pixels per logical inch - wxSize GetPPI() const; - - void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); - void SetDeviceOrigin( wxCoord x, wxCoord y ); - - void SetBackgroundMode(int WXUNUSED(mode)) { } - void SetPalette(const wxPalette& WXUNUSED(palette)) { } - - wxPrintData& GetPrintData() { return m_printData; } - void SetPrintData(const wxPrintData& data) { m_printData = data; } - - virtual int GetDepth() const { return 24; } - - static void SetResolution(int ppi); - static int GetResolution(); - - void PsPrintf( const wxChar* fmt, ... ); - void PsPrint( const char* psdata ); - void PsPrint( int ch ); - -#if wxUSE_UNICODE - void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); } -#endif - -private: - static float ms_PSScaleFactor; - -protected: - bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); - bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; - void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - void DoCrossHair(wxCoord x, wxCoord y) ; - void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); - void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); - void DoDrawPoint(wxCoord x, wxCoord y); - void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); - void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); - void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); - void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); - void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); -#if wxUSE_SPLINES - void DoDrawSpline(wxList *points); -#endif // wxUSE_SPLINES - bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); - void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); - void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { } - void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; - void DoGetSize(int* width, int* height) const; - void DoGetSizeMM(int *width, int *height) const; - - FILE* m_pstream; // PostScript output stream - wxString m_title; - unsigned char m_currentRed; - unsigned char m_currentGreen; - unsigned char m_currentBlue; - int m_pageNumber; - bool m_clipping; - double m_underlinePosition; - double m_underlineThickness; - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS(wxPostScriptDC) -}; - -#endif - // wxUSE_POSTSCRIPT - -#endif - // wxUSE_PRINTING_ARCHITECTURE - -#endif - // _WX_DCPSG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dcps.h +// Purpose: wxPostScriptDC class +// Author: Julian Smart and others +// Modified by: +// RCS-ID: $Id: dcpsg.h 41751 2006-10-08 21:56:55Z VZ $ +// Copyright: (c) Julian Smart and Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPSG_H_ +#define _WX_DCPSG_H_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#if wxUSE_POSTSCRIPT + +#include "wx/dc.h" +#include "wx/dialog.h" +#include "wx/module.h" +#include "wx/cmndata.h" + +extern WXDLLIMPEXP_DATA_CORE(int) wxPageNumber; + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxPostScriptDC; + +//----------------------------------------------------------------------------- +// wxPostScriptDC +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxPostScriptDC: public wxDC +{ +public: + wxPostScriptDC(); + + // Recommended constructor + wxPostScriptDC(const wxPrintData& printData); + + // Recommended destructor :-) + virtual ~wxPostScriptDC(); + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + + bool CanDrawBitmap() const { return true; } + + void Clear(); + void SetFont( const wxFont& font ); + void SetPen( const wxPen& pen ); + void SetBrush( const wxBrush& brush ); + void SetLogicalFunction( int function ); + void SetBackground( const wxBrush& brush ); + + void DestroyClippingRegion(); + + bool StartDoc(const wxString& message); + void EndDoc(); + void StartPage(); + void EndPage(); + + wxCoord GetCharHeight() const; + wxCoord GetCharWidth() const; + bool CanGetTextExtent() const { return true; } + + // Resolution in pixels per logical inch + wxSize GetPPI() const; + + void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); + void SetDeviceOrigin( wxCoord x, wxCoord y ); + + void SetBackgroundMode(int WXUNUSED(mode)) { } + void SetPalette(const wxPalette& WXUNUSED(palette)) { } + + wxPrintData& GetPrintData() { return m_printData; } + void SetPrintData(const wxPrintData& data) { m_printData = data; } + + virtual int GetDepth() const { return 24; } + + static void SetResolution(int ppi); + static int GetResolution(); + + void PsPrintf( const wxChar* fmt, ... ); + void PsPrint( const char* psdata ); + void PsPrint( int ch ); + +#if wxUSE_UNICODE + void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); } +#endif + +private: + static float ms_PSScaleFactor; + +protected: + bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); + bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; + void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + void DoCrossHair(wxCoord x, wxCoord y) ; + void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); + void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); + void DoDrawPoint(wxCoord x, wxCoord y); + void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); + void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); + void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); + void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); + void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); +#if wxUSE_SPLINES + void DoDrawSpline(wxList *points); +#endif // wxUSE_SPLINES + bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); + void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); + void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { } + void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; + void DoGetSize(int* width, int* height) const; + void DoGetSizeMM(int *width, int *height) const; + + FILE* m_pstream; // PostScript output stream + wxString m_title; + unsigned char m_currentRed; + unsigned char m_currentGreen; + unsigned char m_currentBlue; + int m_pageNumber; + bool m_clipping; + double m_underlinePosition; + double m_underlineThickness; + wxPrintData m_printData; + +private: + DECLARE_DYNAMIC_CLASS(wxPostScriptDC) +}; + +#endif + // wxUSE_POSTSCRIPT + +#endif + // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_DCPSG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/dirctrlg.h b/Externals/wxWidgets/include/wx/generic/dirctrlg.h index b4cea43b5f..190850ce9f 100644 --- a/Externals/wxWidgets/include/wx/generic/dirctrlg.h +++ b/Externals/wxWidgets/include/wx/generic/dirctrlg.h @@ -1,295 +1,295 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dirctrlg.h -// Purpose: wxGenericDirCtrl class -// Builds on wxDirCtrl class written by Robert Roebling for the -// wxFile application, modified by Harm van der Heijden. -// Further modified for Windows. -// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al -// Modified by: -// Created: 21/3/2000 -// RCS-ID: $Id: dirctrlg.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRCTRL_H_ -#define _WX_DIRCTRL_H_ - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - #include "wx/imaglist.h" -#endif - -#if wxUSE_DIRDLG - -#include "wx/treectrl.h" -#include "wx/dialog.h" -#include "wx/dirdlg.h" -#include "wx/choice.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_BASE wxHashTable; - -//----------------------------------------------------------------------------- -// Extra styles for wxGenericDirCtrl -//----------------------------------------------------------------------------- - -enum -{ - // Only allow directory viewing/selection, no files - wxDIRCTRL_DIR_ONLY = 0x0010, - // When setting the default path, select the first file in the directory - wxDIRCTRL_SELECT_FIRST = 0x0020, - // Show the filter list - wxDIRCTRL_SHOW_FILTERS = 0x0040, - // Use 3D borders on internal controls - wxDIRCTRL_3D_INTERNAL = 0x0080, - // Editable labels - wxDIRCTRL_EDIT_LABELS = 0x0100 -}; - -//----------------------------------------------------------------------------- -// wxDirItemData -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxDirItemData : public wxTreeItemData -{ -public: - wxDirItemData(const wxString& path, const wxString& name, bool isDir); - virtual ~wxDirItemData(){} - void SetNewDirName(const wxString& path); - - bool HasSubDirs() const; - bool HasFiles(const wxString& spec = wxEmptyString) const; - - wxString m_path, m_name; - bool m_isHidden; - bool m_isExpanded; - bool m_isDir; -}; - -//----------------------------------------------------------------------------- -// wxDirCtrl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxDirFilterListCtrl; - -class WXDLLEXPORT wxGenericDirCtrl: public wxControl -{ -public: - wxGenericDirCtrl(); - wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = wxID_ANY, - const wxString &dir = wxDirDialogDefaultFolderStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, - const wxString& filter = wxEmptyString, - int defaultFilter = 0, - const wxString& name = wxTreeCtrlNameStr ) - { - Init(); - Create(parent, id, dir, pos, size, style, filter, defaultFilter, name); - } - - bool Create(wxWindow *parent, const wxWindowID id = wxID_ANY, - const wxString &dir = wxDirDialogDefaultFolderStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, - const wxString& filter = wxEmptyString, - int defaultFilter = 0, - const wxString& name = wxTreeCtrlNameStr ); - - virtual void Init(); - - virtual ~wxGenericDirCtrl(); - - void OnExpandItem(wxTreeEvent &event ); - void OnCollapseItem(wxTreeEvent &event ); - void OnBeginEditItem(wxTreeEvent &event ); - void OnEndEditItem(wxTreeEvent &event ); - void OnSize(wxSizeEvent &event ); - - // Try to expand as much of the given path as possible. - virtual bool ExpandPath(const wxString& path); - // collapse the path - virtual bool CollapsePath(const wxString& path); - - // Accessors - - virtual inline wxString GetDefaultPath() const { return m_defaultPath; } - virtual void SetDefaultPath(const wxString& path) { m_defaultPath = path; } - - // Get dir or filename - virtual wxString GetPath() const; - - // Get selected filename path only (else empty string). - // I.e. don't count a directory as a selection - virtual wxString GetFilePath() const; - virtual void SetPath(const wxString& path); - - virtual void ShowHidden( bool show ); - virtual bool GetShowHidden() { return m_showHidden; } - - virtual wxString GetFilter() const { return m_filter; } - virtual void SetFilter(const wxString& filter); - - virtual int GetFilterIndex() const { return m_currentFilter; } - virtual void SetFilterIndex(int n); - - virtual wxTreeItemId GetRootId() { return m_rootId; } - - virtual wxTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; } - virtual wxDirFilterListCtrl* GetFilterListCtrl() const { return m_filterListCtrl; } - - // Helper - virtual void SetupSections(); - -#if WXWIN_COMPATIBILITY_2_4 - // Parse the filter into an array of filters and an array of descriptions - virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions); -#endif // WXWIN_COMPATIBILITY_2_4 - - // Find the child that matches the first part of 'path'. - // E.g. if a child path is "/usr" and 'path' is "/usr/include" - // then the child for /usr is returned. - // If the path string has been used (we're at the leaf), done is set to true - virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done); - - // Resize the components of the control - virtual void DoResize(); - - // Collapse & expand the tree, thus re-creating it from scratch: - virtual void ReCreateTree(); - - // Collapse the entire tree - virtual void CollapseTree(); - -protected: - virtual void ExpandRoot(); - virtual void ExpandDir(wxTreeItemId parentId); - virtual void CollapseDir(wxTreeItemId parentId); - virtual const wxTreeItemId AddSection(const wxString& path, const wxString& name, int imageId = 0); - virtual wxTreeItemId AppendItem (const wxTreeItemId & parent, - const wxString & text, - int image = -1, int selectedImage = -1, - wxTreeItemData * data = NULL); - //void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames); - virtual wxTreeCtrl* CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle); - - // Extract description and actual filter from overall filter string - bool ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description); - -private: - bool m_showHidden; - wxTreeItemId m_rootId; - wxString m_defaultPath; // Starting path - long m_styleEx; // Extended style - wxString m_filter; // Wildcards in same format as per wxFileDialog - int m_currentFilter; // The current filter index - wxString m_currentFilterStr; // Current filter string - wxTreeCtrl* m_treeCtrl; - wxDirFilterListCtrl* m_filterListCtrl; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericDirCtrl) - DECLARE_NO_COPY_CLASS(wxGenericDirCtrl) -}; - -//----------------------------------------------------------------------------- -// wxDirFilterListCtrl -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxDirFilterListCtrl: public wxChoice -{ -public: - wxDirFilterListCtrl() { Init(); } - wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0) - { - Init(); - Create(parent, id, pos, size, style); - } - - bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0); - - void Init(); - - virtual ~wxDirFilterListCtrl() {} - - //// Operations - void FillFilterList(const wxString& filter, int defaultFilter); - - //// Events - void OnSelFilter(wxCommandEvent& event); - -protected: - wxGenericDirCtrl* m_dirCtrl; - - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxDirFilterListCtrl) - DECLARE_NO_COPY_CLASS(wxDirFilterListCtrl) -}; - -#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__) - #define wxDirCtrl wxGenericDirCtrl -#endif - -// Symbols for accessing individual controls -#define wxID_TREECTRL 7000 -#define wxID_FILTERLISTCTRL 7001 - -#endif // wxUSE_DIRDLG - -//------------------------------------------------------------------------- -// wxFileIconsTable - use wxTheFileIconsTable which is created as necessary -//------------------------------------------------------------------------- - -#if wxUSE_DIRDLG || wxUSE_FILEDLG - -class WXDLLEXPORT wxFileIconsTable -{ -public: - wxFileIconsTable(); - ~wxFileIconsTable(); - - enum iconId_Type - { - folder, - folder_open, - computer, - drive, - cdrom, - floppy, - removeable, - file, - executable - }; - - int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString); - wxImageList *GetSmallImageList(); - -protected: - void Create(); // create on first use - - wxImageList *m_smallImageList; - wxHashTable *m_HashTable; -}; - -// The global fileicons table -extern WXDLLEXPORT_DATA(wxFileIconsTable *) wxTheFileIconsTable; - -#endif // wxUSE_DIRDLG || wxUSE_FILEDLG - -#endif - // _WX_DIRCTRLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: dirctrlg.h +// Purpose: wxGenericDirCtrl class +// Builds on wxDirCtrl class written by Robert Roebling for the +// wxFile application, modified by Harm van der Heijden. +// Further modified for Windows. +// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al +// Modified by: +// Created: 21/3/2000 +// RCS-ID: $Id: dirctrlg.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRCTRL_H_ +#define _WX_DIRCTRL_H_ + +#if wxUSE_DIRDLG || wxUSE_FILEDLG + #include "wx/imaglist.h" +#endif + +#if wxUSE_DIRDLG + +#include "wx/treectrl.h" +#include "wx/dialog.h" +#include "wx/dirdlg.h" +#include "wx/choice.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_BASE wxHashTable; + +//----------------------------------------------------------------------------- +// Extra styles for wxGenericDirCtrl +//----------------------------------------------------------------------------- + +enum +{ + // Only allow directory viewing/selection, no files + wxDIRCTRL_DIR_ONLY = 0x0010, + // When setting the default path, select the first file in the directory + wxDIRCTRL_SELECT_FIRST = 0x0020, + // Show the filter list + wxDIRCTRL_SHOW_FILTERS = 0x0040, + // Use 3D borders on internal controls + wxDIRCTRL_3D_INTERNAL = 0x0080, + // Editable labels + wxDIRCTRL_EDIT_LABELS = 0x0100 +}; + +//----------------------------------------------------------------------------- +// wxDirItemData +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxDirItemData : public wxTreeItemData +{ +public: + wxDirItemData(const wxString& path, const wxString& name, bool isDir); + virtual ~wxDirItemData(){} + void SetNewDirName(const wxString& path); + + bool HasSubDirs() const; + bool HasFiles(const wxString& spec = wxEmptyString) const; + + wxString m_path, m_name; + bool m_isHidden; + bool m_isExpanded; + bool m_isDir; +}; + +//----------------------------------------------------------------------------- +// wxDirCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDirFilterListCtrl; + +class WXDLLEXPORT wxGenericDirCtrl: public wxControl +{ +public: + wxGenericDirCtrl(); + wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = wxID_ANY, + const wxString &dir = wxDirDialogDefaultFolderStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, + const wxString& filter = wxEmptyString, + int defaultFilter = 0, + const wxString& name = wxTreeCtrlNameStr ) + { + Init(); + Create(parent, id, dir, pos, size, style, filter, defaultFilter, name); + } + + bool Create(wxWindow *parent, const wxWindowID id = wxID_ANY, + const wxString &dir = wxDirDialogDefaultFolderStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, + const wxString& filter = wxEmptyString, + int defaultFilter = 0, + const wxString& name = wxTreeCtrlNameStr ); + + virtual void Init(); + + virtual ~wxGenericDirCtrl(); + + void OnExpandItem(wxTreeEvent &event ); + void OnCollapseItem(wxTreeEvent &event ); + void OnBeginEditItem(wxTreeEvent &event ); + void OnEndEditItem(wxTreeEvent &event ); + void OnSize(wxSizeEvent &event ); + + // Try to expand as much of the given path as possible. + virtual bool ExpandPath(const wxString& path); + // collapse the path + virtual bool CollapsePath(const wxString& path); + + // Accessors + + virtual inline wxString GetDefaultPath() const { return m_defaultPath; } + virtual void SetDefaultPath(const wxString& path) { m_defaultPath = path; } + + // Get dir or filename + virtual wxString GetPath() const; + + // Get selected filename path only (else empty string). + // I.e. don't count a directory as a selection + virtual wxString GetFilePath() const; + virtual void SetPath(const wxString& path); + + virtual void ShowHidden( bool show ); + virtual bool GetShowHidden() { return m_showHidden; } + + virtual wxString GetFilter() const { return m_filter; } + virtual void SetFilter(const wxString& filter); + + virtual int GetFilterIndex() const { return m_currentFilter; } + virtual void SetFilterIndex(int n); + + virtual wxTreeItemId GetRootId() { return m_rootId; } + + virtual wxTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; } + virtual wxDirFilterListCtrl* GetFilterListCtrl() const { return m_filterListCtrl; } + + // Helper + virtual void SetupSections(); + +#if WXWIN_COMPATIBILITY_2_4 + // Parse the filter into an array of filters and an array of descriptions + virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions); +#endif // WXWIN_COMPATIBILITY_2_4 + + // Find the child that matches the first part of 'path'. + // E.g. if a child path is "/usr" and 'path' is "/usr/include" + // then the child for /usr is returned. + // If the path string has been used (we're at the leaf), done is set to true + virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done); + + // Resize the components of the control + virtual void DoResize(); + + // Collapse & expand the tree, thus re-creating it from scratch: + virtual void ReCreateTree(); + + // Collapse the entire tree + virtual void CollapseTree(); + +protected: + virtual void ExpandRoot(); + virtual void ExpandDir(wxTreeItemId parentId); + virtual void CollapseDir(wxTreeItemId parentId); + virtual const wxTreeItemId AddSection(const wxString& path, const wxString& name, int imageId = 0); + virtual wxTreeItemId AppendItem (const wxTreeItemId & parent, + const wxString & text, + int image = -1, int selectedImage = -1, + wxTreeItemData * data = NULL); + //void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames); + virtual wxTreeCtrl* CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle); + + // Extract description and actual filter from overall filter string + bool ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description); + +private: + bool m_showHidden; + wxTreeItemId m_rootId; + wxString m_defaultPath; // Starting path + long m_styleEx; // Extended style + wxString m_filter; // Wildcards in same format as per wxFileDialog + int m_currentFilter; // The current filter index + wxString m_currentFilterStr; // Current filter string + wxTreeCtrl* m_treeCtrl; + wxDirFilterListCtrl* m_filterListCtrl; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericDirCtrl) + DECLARE_NO_COPY_CLASS(wxGenericDirCtrl) +}; + +//----------------------------------------------------------------------------- +// wxDirFilterListCtrl +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxDirFilterListCtrl: public wxChoice +{ +public: + wxDirFilterListCtrl() { Init(); } + wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0) + { + Init(); + Create(parent, id, pos, size, style); + } + + bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + void Init(); + + virtual ~wxDirFilterListCtrl() {} + + //// Operations + void FillFilterList(const wxString& filter, int defaultFilter); + + //// Events + void OnSelFilter(wxCommandEvent& event); + +protected: + wxGenericDirCtrl* m_dirCtrl; + + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxDirFilterListCtrl) + DECLARE_NO_COPY_CLASS(wxDirFilterListCtrl) +}; + +#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__) + #define wxDirCtrl wxGenericDirCtrl +#endif + +// Symbols for accessing individual controls +#define wxID_TREECTRL 7000 +#define wxID_FILTERLISTCTRL 7001 + +#endif // wxUSE_DIRDLG + +//------------------------------------------------------------------------- +// wxFileIconsTable - use wxTheFileIconsTable which is created as necessary +//------------------------------------------------------------------------- + +#if wxUSE_DIRDLG || wxUSE_FILEDLG + +class WXDLLEXPORT wxFileIconsTable +{ +public: + wxFileIconsTable(); + ~wxFileIconsTable(); + + enum iconId_Type + { + folder, + folder_open, + computer, + drive, + cdrom, + floppy, + removeable, + file, + executable + }; + + int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString); + wxImageList *GetSmallImageList(); + +protected: + void Create(); // create on first use + + wxImageList *m_smallImageList; + wxHashTable *m_HashTable; +}; + +// The global fileicons table +extern WXDLLEXPORT_DATA(wxFileIconsTable *) wxTheFileIconsTable; + +#endif // wxUSE_DIRDLG || wxUSE_FILEDLG + +#endif + // _WX_DIRCTRLG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/dirdlgg.h b/Externals/wxWidgets/include/wx/generic/dirdlgg.h index 6fb6a58739..73b61b5297 100644 --- a/Externals/wxWidgets/include/wx/generic/dirdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/dirdlgg.h @@ -1,89 +1,89 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/dirdlgg.h -// Purpose: wxGenericDirCtrl class -// Builds on wxDirCtrl class written by Robert Roebling for the -// wxFile application, modified by Harm van der Heijden. -// Further modified for Windows. -// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al -// Modified by: -// Created: 21/3/2000 -// RCS-ID: $Id: dirdlgg.h 39402 2006-05-28 23:32:12Z VZ $ -// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRDLGG_H_ -#define _WX_DIRDLGG_H_ - -class WXDLLEXPORT wxGenericDirCtrl; -class WXDLLEXPORT wxTextCtrl; -class WXDLLEXPORT wxTreeEvent; - -// we may be included directly as well as from wx/dirdlg.h (FIXME) -extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; - -#ifndef wxDD_DEFAULT_STYLE -#ifdef __WXWINCE__ - #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE -#else - #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) -#endif -#endif - -#include "wx/dialog.h" - -//----------------------------------------------------------------------------- -// wxGenericDirDialog -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericDirDialog : public wxDirDialogBase -{ -public: - wxGenericDirDialog() : wxDirDialogBase() { } - - wxGenericDirDialog(wxWindow* parent, - const wxString& title = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize,//Size(450, 550), - const wxString& name = wxDirDialogNameStr); - - bool Create(wxWindow* parent, - const wxString& title = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize,//Size(450, 550), - const wxString& name = wxDirDialogNameStr); - - //// Accessors - void SetPath(const wxString& path); - wxString GetPath() const; - - //// Overrides - virtual int ShowModal(); - virtual void EndModal(int retCode); - - // this one is specific to wxGenericDirDialog - wxTextCtrl* GetInputCtrl() const { return m_input; } - -protected: - //// Event handlers - void OnCloseWindow(wxCloseEvent& event); - void OnOK(wxCommandEvent& event); - void OnTreeSelected(wxTreeEvent &event); - void OnTreeKeyDown(wxTreeEvent &event); - void OnNew(wxCommandEvent& event); - void OnGoHome(wxCommandEvent& event); - void OnShowHidden(wxCommandEvent& event); - - wxGenericDirCtrl* m_dirCtrl; - wxTextCtrl* m_input; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericDirDialog) -}; - -#endif // _WX_DIRDLGG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dirdlgg.h +// Purpose: wxGenericDirCtrl class +// Builds on wxDirCtrl class written by Robert Roebling for the +// wxFile application, modified by Harm van der Heijden. +// Further modified for Windows. +// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al +// Modified by: +// Created: 21/3/2000 +// RCS-ID: $Id: dirdlgg.h 39402 2006-05-28 23:32:12Z VZ $ +// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLGG_H_ +#define _WX_DIRDLGG_H_ + +class WXDLLEXPORT wxGenericDirCtrl; +class WXDLLEXPORT wxTextCtrl; +class WXDLLEXPORT wxTreeEvent; + +// we may be included directly as well as from wx/dirdlg.h (FIXME) +extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; + +#ifndef wxDD_DEFAULT_STYLE +#ifdef __WXWINCE__ + #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE +#else + #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) +#endif +#endif + +#include "wx/dialog.h" + +//----------------------------------------------------------------------------- +// wxGenericDirDialog +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericDirDialog : public wxDirDialogBase +{ +public: + wxGenericDirDialog() : wxDirDialogBase() { } + + wxGenericDirDialog(wxWindow* parent, + const wxString& title = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize,//Size(450, 550), + const wxString& name = wxDirDialogNameStr); + + bool Create(wxWindow* parent, + const wxString& title = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize,//Size(450, 550), + const wxString& name = wxDirDialogNameStr); + + //// Accessors + void SetPath(const wxString& path); + wxString GetPath() const; + + //// Overrides + virtual int ShowModal(); + virtual void EndModal(int retCode); + + // this one is specific to wxGenericDirDialog + wxTextCtrl* GetInputCtrl() const { return m_input; } + +protected: + //// Event handlers + void OnCloseWindow(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); + void OnTreeSelected(wxTreeEvent &event); + void OnTreeKeyDown(wxTreeEvent &event); + void OnNew(wxCommandEvent& event); + void OnGoHome(wxCommandEvent& event); + void OnShowHidden(wxCommandEvent& event); + + wxGenericDirCtrl* m_dirCtrl; + wxTextCtrl* m_input; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericDirDialog) +}; + +#endif // _WX_DIRDLGG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/dragimgg.h b/Externals/wxWidgets/include/wx/generic/dragimgg.h index 79f2785ba1..f5cdd447f4 100644 --- a/Externals/wxWidgets/include/wx/generic/dragimgg.h +++ b/Externals/wxWidgets/include/wx/generic/dragimgg.h @@ -1,271 +1,271 @@ -////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/dragimgg.h -// Purpose: wxDragImage class: a kind of a cursor, that can cope -// with more sophisticated images -// Author: Julian Smart -// Modified by: -// Created: 29/2/2000 -// RCS-ID: $Id: dragimgg.h 42397 2006-10-25 12:12:56Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DRAGIMGG_H_ -#define _WX_DRAGIMGG_H_ - -#include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/treectrl.h" -#include "wx/listctrl.h" -#include "wx/log.h" -#include "wx/overlay.h" - -/* - To use this class, create a wxDragImage when you start dragging, for example: - - void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) - { -#ifdef __WXMSW__ - ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets -#endif - - CaptureMouse(); - - m_dragImage = new wxDragImage(* this, itemId); - m_dragImage->BeginDrag(wxPoint(0, 0), this); - m_dragImage->Move(pt, this); - m_dragImage->Show(this); - ... - } - - In your OnMouseMove function, hide the image, do any display updating required, - then move and show the image again: - - void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) - { - if (m_dragMode == MY_TREE_DRAG_NONE) - { - event.Skip(); - return; - } - - // Prevent screen corruption by hiding the image - if (m_dragImage) - m_dragImage->Hide(this); - - // Do some updating of the window, such as highlighting the drop target - ... - -#ifdef __WXMSW__ - if (updateWindow) - ::UpdateWindow((HWND) GetHWND()); -#endif - - // Move and show the image again - m_dragImage->Move(event.GetPosition(), this); - m_dragImage->Show(this); - } - - Eventually we end the drag and delete the drag image. - - void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) - { - ... - - // End the drag and delete the drag image - if (m_dragImage) - { - m_dragImage->EndDrag(this); - delete m_dragImage; - m_dragImage = NULL; - } - ReleaseMouse(); - } -*/ - -/* - * wxGenericDragImage - */ - -class WXDLLEXPORT wxGenericDragImage: public wxObject -{ -public: - - // Ctors & dtor - //////////////////////////////////////////////////////////////////////////// - - wxGenericDragImage(const wxCursor& cursor = wxNullCursor) - { - Init(); - Create(cursor); - } - - wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - wxGenericDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - wxGenericDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(str, cursor); - } - -#if WXWIN_COMPATIBILITY_2_6 - // don't use in new code, use versions without hot spot parameter - wxDEPRECATED( wxGenericDragImage(const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -#if wxUSE_TREECTRL - wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) - { - Init(); - - Create(treeCtrl, id); - } -#endif - -#if wxUSE_LISTCTRL - wxGenericDragImage(const wxListCtrl& listCtrl, long id) - { - Init(); - - Create(listCtrl, id); - } -#endif - - virtual ~wxGenericDragImage(); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // For efficiency, tell wxGenericDragImage to use a bitmap that's already - // created (e.g. from last drag) - void SetBackingBitmap(wxBitmap* bitmap) { -#ifndef wxHAS_NATIVE_OVERLAY - m_pBackingBitmap = bitmap; -#endif - } - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) - bool Create(const wxCursor& cursor = wxNullCursor); - - // Create a drag image from a bitmap and optional cursor - bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); - - // Create a drag image from an icon and optional cursor - bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); - - // Create a drag image from a string and optional cursor - bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); - -#if wxUSE_TREECTRL - // Create a drag image for the given tree control item - bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); -#endif - -#if wxUSE_LISTCTRL - // Create a drag image for the given list control item - bool Create(const wxListCtrl& listCtrl, long id); -#endif - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. This is full screen only. fullScreenRect gives the - // position of the window on the screen, to restrict the drag to. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); - - // End drag - bool EndDrag(); - - // Move the image: call from OnMouseMove. Pt is in window client coordinates if window - // is non-NULL, or in screen coordinates if NULL. - bool Move(const wxPoint& pt); - - // Show the image - bool Show(); - - // Hide the image - bool Hide(); - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - void Init(); - - // Override this if you are using a virtual image (drawing your own image) - virtual wxRect GetImageRect(const wxPoint& pos) const; - - // Override this if you are using a virtual image (drawing your own image) - virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const; - - // Override this if you wish to draw the window contents to the backing bitmap - // yourself. This can be desirable if you wish to avoid flicker by not having to - // redraw the window itself before dragging in order to be graphic-minus-dragged-objects. - // Instead, paint the drag image's backing bitmap to be correct, and leave the window - // to be updated only when dragging the objects away (thus giving a smoother appearance). - virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, - const wxRect& sourceRect, const wxRect& destRect) const; - - // Erase and redraw simultaneously if possible - virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); - -protected: - wxBitmap m_bitmap; - wxIcon m_icon; - wxCursor m_cursor; - wxCursor m_oldCursor; -// wxPoint m_hotspot; - wxPoint m_offset; // The hostpot value passed to BeginDrag - wxPoint m_position; - bool m_isDirty; - bool m_isShown; - wxWindow* m_window; - wxDC* m_windowDC; - -#ifdef wxHAS_NATIVE_OVERLAY - wxOverlay m_overlay; - wxDCOverlay* m_dcOverlay; -#else - // Stores the window contents while we're dragging the image around - wxBitmap m_backingBitmap; - wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap - // (pass to wxGenericDragImage as an efficiency measure) - // A temporary bitmap for repairing/redrawing - wxBitmap m_repairBitmap; -#endif // !wxHAS_NATIVE_OVERLAY - - wxRect m_boundingRect; - bool m_fullScreen; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericDragImage) - DECLARE_NO_COPY_CLASS(wxGenericDragImage) -}; - -#endif - // _WX_DRAGIMGG_H_ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dragimgg.h +// Purpose: wxDragImage class: a kind of a cursor, that can cope +// with more sophisticated images +// Author: Julian Smart +// Modified by: +// Created: 29/2/2000 +// RCS-ID: $Id: dragimgg.h 42397 2006-10-25 12:12:56Z VS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMGG_H_ +#define _WX_DRAGIMGG_H_ + +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/treectrl.h" +#include "wx/listctrl.h" +#include "wx/log.h" +#include "wx/overlay.h" + +/* + To use this class, create a wxDragImage when you start dragging, for example: + + void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) + { +#ifdef __WXMSW__ + ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets +#endif + + CaptureMouse(); + + m_dragImage = new wxDragImage(* this, itemId); + m_dragImage->BeginDrag(wxPoint(0, 0), this); + m_dragImage->Move(pt, this); + m_dragImage->Show(this); + ... + } + + In your OnMouseMove function, hide the image, do any display updating required, + then move and show the image again: + + void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) + { + if (m_dragMode == MY_TREE_DRAG_NONE) + { + event.Skip(); + return; + } + + // Prevent screen corruption by hiding the image + if (m_dragImage) + m_dragImage->Hide(this); + + // Do some updating of the window, such as highlighting the drop target + ... + +#ifdef __WXMSW__ + if (updateWindow) + ::UpdateWindow((HWND) GetHWND()); +#endif + + // Move and show the image again + m_dragImage->Move(event.GetPosition(), this); + m_dragImage->Show(this); + } + + Eventually we end the drag and delete the drag image. + + void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) + { + ... + + // End the drag and delete the drag image + if (m_dragImage) + { + m_dragImage->EndDrag(this); + delete m_dragImage; + m_dragImage = NULL; + } + ReleaseMouse(); + } +*/ + +/* + * wxGenericDragImage + */ + +class WXDLLEXPORT wxGenericDragImage: public wxObject +{ +public: + + // Ctors & dtor + //////////////////////////////////////////////////////////////////////////// + + wxGenericDragImage(const wxCursor& cursor = wxNullCursor) + { + Init(); + Create(cursor); + } + + wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + wxGenericDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + wxGenericDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(str, cursor); + } + +#if WXWIN_COMPATIBILITY_2_6 + // don't use in new code, use versions without hot spot parameter + wxDEPRECATED( wxGenericDragImage(const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); +#endif // WXWIN_COMPATIBILITY_2_6 + +#if wxUSE_TREECTRL + wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) + { + Init(); + + Create(treeCtrl, id); + } +#endif + +#if wxUSE_LISTCTRL + wxGenericDragImage(const wxListCtrl& listCtrl, long id) + { + Init(); + + Create(listCtrl, id); + } +#endif + + virtual ~wxGenericDragImage(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // For efficiency, tell wxGenericDragImage to use a bitmap that's already + // created (e.g. from last drag) + void SetBackingBitmap(wxBitmap* bitmap) { +#ifndef wxHAS_NATIVE_OVERLAY + m_pBackingBitmap = bitmap; +#endif + } + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) + bool Create(const wxCursor& cursor = wxNullCursor); + + // Create a drag image from a bitmap and optional cursor + bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); + + // Create a drag image from an icon and optional cursor + bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); + + // Create a drag image from a string and optional cursor + bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); + +#if wxUSE_TREECTRL + // Create a drag image for the given tree control item + bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); +#endif + +#if wxUSE_LISTCTRL + // Create a drag image for the given list control item + bool Create(const wxListCtrl& listCtrl, long id); +#endif + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. This is full screen only. fullScreenRect gives the + // position of the window on the screen, to restrict the drag to. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); + + // End drag + bool EndDrag(); + + // Move the image: call from OnMouseMove. Pt is in window client coordinates if window + // is non-NULL, or in screen coordinates if NULL. + bool Move(const wxPoint& pt); + + // Show the image + bool Show(); + + // Hide the image + bool Hide(); + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + void Init(); + + // Override this if you are using a virtual image (drawing your own image) + virtual wxRect GetImageRect(const wxPoint& pos) const; + + // Override this if you are using a virtual image (drawing your own image) + virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const; + + // Override this if you wish to draw the window contents to the backing bitmap + // yourself. This can be desirable if you wish to avoid flicker by not having to + // redraw the window itself before dragging in order to be graphic-minus-dragged-objects. + // Instead, paint the drag image's backing bitmap to be correct, and leave the window + // to be updated only when dragging the objects away (thus giving a smoother appearance). + virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, + const wxRect& sourceRect, const wxRect& destRect) const; + + // Erase and redraw simultaneously if possible + virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); + +protected: + wxBitmap m_bitmap; + wxIcon m_icon; + wxCursor m_cursor; + wxCursor m_oldCursor; +// wxPoint m_hotspot; + wxPoint m_offset; // The hostpot value passed to BeginDrag + wxPoint m_position; + bool m_isDirty; + bool m_isShown; + wxWindow* m_window; + wxDC* m_windowDC; + +#ifdef wxHAS_NATIVE_OVERLAY + wxOverlay m_overlay; + wxDCOverlay* m_dcOverlay; +#else + // Stores the window contents while we're dragging the image around + wxBitmap m_backingBitmap; + wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap + // (pass to wxGenericDragImage as an efficiency measure) + // A temporary bitmap for repairing/redrawing + wxBitmap m_repairBitmap; +#endif // !wxHAS_NATIVE_OVERLAY + + wxRect m_boundingRect; + bool m_fullScreen; + +private: + DECLARE_DYNAMIC_CLASS(wxGenericDragImage) + DECLARE_NO_COPY_CLASS(wxGenericDragImage) +}; + +#endif + // _WX_DRAGIMGG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/fdrepdlg.h b/Externals/wxWidgets/include/wx/generic/fdrepdlg.h index e1bddf33c9..c287322134 100644 --- a/Externals/wxWidgets/include/wx/generic/fdrepdlg.h +++ b/Externals/wxWidgets/include/wx/generic/fdrepdlg.h @@ -1,71 +1,71 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fdrepdlg.h -// Purpose: wxGenericFindReplaceDialog class -// Author: Markus Greither -// Modified by: -// Created: 25/05/2001 -// RCS-ID: -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_FDREPDLG_H_ -#define _WX_GENERIC_FDREPDLG_H_ - -class WXDLLEXPORT wxCheckBox; -class WXDLLEXPORT wxRadioBox; -class WXDLLEXPORT wxTextCtrl; - -// ---------------------------------------------------------------------------- -// wxGenericFindReplaceDialog: dialog for searching / replacing text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericFindReplaceDialog : public wxFindReplaceDialogBase -{ -public: - wxGenericFindReplaceDialog() { Init(); } - - wxGenericFindReplaceDialog(wxWindow *parent, - wxFindReplaceData *data, - const wxString& title, - int style = 0) - { - Init(); - - (void)Create(parent, data, title, style); - } - - bool Create(wxWindow *parent, - wxFindReplaceData *data, - const wxString& title, - int style = 0); - -protected: - void Init(); - - void SendEvent(const wxEventType& evtType); - - void OnFind(wxCommandEvent& event); - void OnReplace(wxCommandEvent& event); - void OnReplaceAll(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - - void OnUpdateFindUI(wxUpdateUIEvent& event); - - void OnCloseWindow(wxCloseEvent& event); - - wxCheckBox *m_chkCase, - *m_chkWord; - - wxRadioBox *m_radioDir; - - wxTextCtrl *m_textFind, - *m_textRepl; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericFindReplaceDialog) - - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_GENERIC_FDREPDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fdrepdlg.h +// Purpose: wxGenericFindReplaceDialog class +// Author: Markus Greither +// Modified by: +// Created: 25/05/2001 +// RCS-ID: +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_FDREPDLG_H_ +#define _WX_GENERIC_FDREPDLG_H_ + +class WXDLLEXPORT wxCheckBox; +class WXDLLEXPORT wxRadioBox; +class WXDLLEXPORT wxTextCtrl; + +// ---------------------------------------------------------------------------- +// wxGenericFindReplaceDialog: dialog for searching / replacing text +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericFindReplaceDialog : public wxFindReplaceDialogBase +{ +public: + wxGenericFindReplaceDialog() { Init(); } + + wxGenericFindReplaceDialog(wxWindow *parent, + wxFindReplaceData *data, + const wxString& title, + int style = 0) + { + Init(); + + (void)Create(parent, data, title, style); + } + + bool Create(wxWindow *parent, + wxFindReplaceData *data, + const wxString& title, + int style = 0); + +protected: + void Init(); + + void SendEvent(const wxEventType& evtType); + + void OnFind(wxCommandEvent& event); + void OnReplace(wxCommandEvent& event); + void OnReplaceAll(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + void OnUpdateFindUI(wxUpdateUIEvent& event); + + void OnCloseWindow(wxCloseEvent& event); + + wxCheckBox *m_chkCase, + *m_chkWord; + + wxRadioBox *m_radioDir; + + wxTextCtrl *m_textFind, + *m_textRepl; + +private: + DECLARE_DYNAMIC_CLASS(wxGenericFindReplaceDialog) + + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_GENERIC_FDREPDLG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/filedlgg.h b/Externals/wxWidgets/include/wx/generic/filedlgg.h index eaf680b018..70da48c382 100644 --- a/Externals/wxWidgets/include/wx/generic/filedlgg.h +++ b/Externals/wxWidgets/include/wx/generic/filedlgg.h @@ -1,307 +1,307 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/filedlgg.h -// Purpose: wxGenericFileDialog -// Author: Robert Roebling -// Modified by: -// Created: 8/17/99 -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: filedlgg.h 39631 2006-06-08 10:05:42Z RR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDLGG_H_ -#define _WX_FILEDLGG_H_ - -#include "wx/listctrl.h" -#include "wx/datetime.h" -#include "wx/filefn.h" -#include "wx/filedlg.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapButton; -class WXDLLEXPORT wxCheckBox; -class WXDLLEXPORT wxChoice; -class WXDLLEXPORT wxFileData; -class WXDLLEXPORT wxFileCtrl; -class WXDLLEXPORT wxGenericFileDialog; -class WXDLLEXPORT wxListEvent; -class WXDLLEXPORT wxListItem; -class WXDLLEXPORT wxStaticText; -class WXDLLEXPORT wxTextCtrl; - -//------------------------------------------------------------------------- -// wxGenericFileDialog -//------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase -{ -public: - wxGenericFileDialog() : wxFileDialogBase() { Init(); } - - wxGenericFileDialog(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr, - bool bypassGenericImpl = false ); - - bool Create( wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr, - bool bypassGenericImpl = false ); - - virtual ~wxGenericFileDialog(); - - virtual void SetMessage(const wxString& message) { SetTitle(message); } - virtual void SetPath(const wxString& path); - virtual void SetFilterIndex(int filterIndex); - virtual void SetWildcard(const wxString& wildCard); - - // for multiple file selection - virtual void GetPaths(wxArrayString& paths) const; - virtual void GetFilenames(wxArrayString& files) const; - - // implementation only from now on - // ------------------------------- - - virtual int ShowModal(); - virtual bool Show( bool show = true ); - - void OnSelected( wxListEvent &event ); - void OnActivated( wxListEvent &event ); - void OnList( wxCommandEvent &event ); - void OnReport( wxCommandEvent &event ); - void OnUp( wxCommandEvent &event ); - void OnHome( wxCommandEvent &event ); - void OnListOk( wxCommandEvent &event ); - void OnNew( wxCommandEvent &event ); - void OnChoiceFilter( wxCommandEvent &event ); - void OnTextEnter( wxCommandEvent &event ); - void OnTextChange( wxCommandEvent &event ); - void OnCheck( wxCommandEvent &event ); - - virtual void HandleAction( const wxString &fn ); - - virtual void UpdateControls(); - -private: - // Don't use this implementation at all :-) - bool m_bypassGenericImpl; - -protected: - // use the filter with the given index - void DoSetFilterIndex(int filterindex); - - wxString m_filterExtension; - wxChoice *m_choice; - wxTextCtrl *m_text; - wxFileCtrl *m_list; - wxCheckBox *m_check; - wxStaticText *m_static; - wxBitmapButton *m_upDirButton; - wxBitmapButton *m_newDirButton; - -private: - void Init(); - DECLARE_DYNAMIC_CLASS(wxGenericFileDialog) - DECLARE_EVENT_TABLE() - - // these variables are preserved between wxGenericFileDialog calls - static long ms_lastViewStyle; // list or report? - static bool ms_lastShowHidden; // did we show hidden files? -}; - -#ifdef wxUSE_GENERIC_FILEDIALOG - -class WXDLLEXPORT wxFileDialog: public wxGenericFileDialog -{ -public: - wxFileDialog() {} - - wxFileDialog(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = 0, - const wxPoint& pos = wxDefaultPosition) - :wxGenericFileDialog(parent, message, defaultDir, defaultFile, wildCard, style, pos) - { - } - -private: - DECLARE_DYNAMIC_CLASS(wxFileDialog) -}; - -#endif // wxUSE_GENERIC_FILEDIALOG - -//----------------------------------------------------------------------------- -// wxFileData - a class to hold the file info for the wxFileCtrl -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileData -{ -public: - enum fileType - { - is_file = 0x0000, - is_dir = 0x0001, - is_link = 0x0002, - is_exe = 0x0004, - is_drive = 0x0008 - }; - - wxFileData() { Init(); } - // Full copy constructor - wxFileData( const wxFileData& fileData ) { Copy(fileData); } - // Create a filedata from this information - wxFileData( const wxString &filePath, const wxString &fileName, - fileType type, int image_id ); - - // make a full copy of the other wxFileData - void Copy( const wxFileData &other ); - - // (re)read the extra data about the file from the system - void ReadData(); - - // get the name of the file, dir, drive - wxString GetFileName() const { return m_fileName; } - // get the full path + name of the file, dir, path - wxString GetFilePath() const { return m_filePath; } - // Set the path + name and name of the item - void SetNewName( const wxString &filePath, const wxString &fileName ); - - // Get the size of the file in bytes - wxFileOffset GetSize() const { return m_size; } - // Get the type of file, either file extension or , , - wxString GetFileType() const; - // get the last modification time - wxDateTime GetDateTime() const { return m_dateTime; } - // Get the time as a formatted string - wxString GetModificationTime() const; - // in UNIX get rwx for file, in MSW get attributes ARHS - wxString GetPermissions() const { return m_permissions; } - // Get the id of the image used in a wxImageList - int GetImageId() const { return m_image; } - - bool IsFile() const { return !IsDir() && !IsLink() && !IsDrive(); } - bool IsDir() const { return (m_type & is_dir ) != 0; } - bool IsLink() const { return (m_type & is_link ) != 0; } - bool IsExe() const { return (m_type & is_exe ) != 0; } - bool IsDrive() const { return (m_type & is_drive) != 0; } - - // Get/Set the type of file, file/dir/drive/link - int GetType() const { return m_type; } - - // the wxFileCtrl fields in report view - enum fileListFieldType - { - FileList_Name, - FileList_Size, - FileList_Type, - FileList_Time, -#if defined(__UNIX__) || defined(__WIN32__) - FileList_Perm, -#endif // defined(__UNIX__) || defined(__WIN32__) - FileList_Max - }; - - // Get the entry for report view of wxFileCtrl - wxString GetEntry( fileListFieldType num ) const; - - // Get a string representation of the file info - wxString GetHint() const; - // initialize a wxListItem attributes - void MakeItem( wxListItem &item ); - - // operators - wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; } - -protected: - wxString m_fileName; - wxString m_filePath; - wxFileOffset m_size; - wxDateTime m_dateTime; - wxString m_permissions; - int m_type; - int m_image; - -private: - void Init(); -}; - -//----------------------------------------------------------------------------- -// wxFileCtrl -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileCtrl : public wxListCtrl -{ -public: - wxFileCtrl(); - wxFileCtrl( wxWindow *win, - wxWindowID id, - const wxString &wild, - bool showHidden, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLC_LIST, - const wxValidator &validator = wxDefaultValidator, - const wxString &name = wxT("filelist") ); - virtual ~wxFileCtrl(); - - virtual void ChangeToListMode(); - virtual void ChangeToReportMode(); - virtual void ChangeToSmallIconMode(); - virtual void ShowHidden( bool show = true ); - bool GetShowHidden() const { return m_showHidden; } - - virtual long Add( wxFileData *fd, wxListItem &item ); - virtual void UpdateItem(const wxListItem &item); - virtual void UpdateFiles(); - virtual void MakeDir(); - virtual void GoToParentDir(); - virtual void GoToHomeDir(); - virtual void GoToDir( const wxString &dir ); - virtual void SetWild( const wxString &wild ); - wxString GetWild() const { return m_wild; } - wxString GetDir() const { return m_dirName; } - - void OnListDeleteItem( wxListEvent &event ); - void OnListDeleteAllItems( wxListEvent &event ); - void OnListEndLabelEdit( wxListEvent &event ); - void OnListColClick( wxListEvent &event ); - - virtual void SortItems(wxFileData::fileListFieldType field, bool foward); - bool GetSortDirection() const { return m_sort_foward; } - wxFileData::fileListFieldType GetSortField() const { return m_sort_field; } - -protected: - void FreeItemData(wxListItem& item); - void FreeAllItemsData(); - - wxString m_dirName; - bool m_showHidden; - wxString m_wild; - - bool m_sort_foward; - wxFileData::fileListFieldType m_sort_field; - -private: - DECLARE_DYNAMIC_CLASS(wxFileCtrl) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_FILEDLGG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/filedlgg.h +// Purpose: wxGenericFileDialog +// Author: Robert Roebling +// Modified by: +// Created: 8/17/99 +// Copyright: (c) Robert Roebling +// RCS-ID: $Id: filedlgg.h 39631 2006-06-08 10:05:42Z RR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLGG_H_ +#define _WX_FILEDLGG_H_ + +#include "wx/listctrl.h" +#include "wx/datetime.h" +#include "wx/filefn.h" +#include "wx/filedlg.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapButton; +class WXDLLEXPORT wxCheckBox; +class WXDLLEXPORT wxChoice; +class WXDLLEXPORT wxFileData; +class WXDLLEXPORT wxFileCtrl; +class WXDLLEXPORT wxGenericFileDialog; +class WXDLLEXPORT wxListEvent; +class WXDLLEXPORT wxListItem; +class WXDLLEXPORT wxStaticText; +class WXDLLEXPORT wxTextCtrl; + +//------------------------------------------------------------------------- +// wxGenericFileDialog +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase +{ +public: + wxGenericFileDialog() : wxFileDialogBase() { Init(); } + + wxGenericFileDialog(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr, + bool bypassGenericImpl = false ); + + bool Create( wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr, + bool bypassGenericImpl = false ); + + virtual ~wxGenericFileDialog(); + + virtual void SetMessage(const wxString& message) { SetTitle(message); } + virtual void SetPath(const wxString& path); + virtual void SetFilterIndex(int filterIndex); + virtual void SetWildcard(const wxString& wildCard); + + // for multiple file selection + virtual void GetPaths(wxArrayString& paths) const; + virtual void GetFilenames(wxArrayString& files) const; + + // implementation only from now on + // ------------------------------- + + virtual int ShowModal(); + virtual bool Show( bool show = true ); + + void OnSelected( wxListEvent &event ); + void OnActivated( wxListEvent &event ); + void OnList( wxCommandEvent &event ); + void OnReport( wxCommandEvent &event ); + void OnUp( wxCommandEvent &event ); + void OnHome( wxCommandEvent &event ); + void OnListOk( wxCommandEvent &event ); + void OnNew( wxCommandEvent &event ); + void OnChoiceFilter( wxCommandEvent &event ); + void OnTextEnter( wxCommandEvent &event ); + void OnTextChange( wxCommandEvent &event ); + void OnCheck( wxCommandEvent &event ); + + virtual void HandleAction( const wxString &fn ); + + virtual void UpdateControls(); + +private: + // Don't use this implementation at all :-) + bool m_bypassGenericImpl; + +protected: + // use the filter with the given index + void DoSetFilterIndex(int filterindex); + + wxString m_filterExtension; + wxChoice *m_choice; + wxTextCtrl *m_text; + wxFileCtrl *m_list; + wxCheckBox *m_check; + wxStaticText *m_static; + wxBitmapButton *m_upDirButton; + wxBitmapButton *m_newDirButton; + +private: + void Init(); + DECLARE_DYNAMIC_CLASS(wxGenericFileDialog) + DECLARE_EVENT_TABLE() + + // these variables are preserved between wxGenericFileDialog calls + static long ms_lastViewStyle; // list or report? + static bool ms_lastShowHidden; // did we show hidden files? +}; + +#ifdef wxUSE_GENERIC_FILEDIALOG + +class WXDLLEXPORT wxFileDialog: public wxGenericFileDialog +{ +public: + wxFileDialog() {} + + wxFileDialog(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = 0, + const wxPoint& pos = wxDefaultPosition) + :wxGenericFileDialog(parent, message, defaultDir, defaultFile, wildCard, style, pos) + { + } + +private: + DECLARE_DYNAMIC_CLASS(wxFileDialog) +}; + +#endif // wxUSE_GENERIC_FILEDIALOG + +//----------------------------------------------------------------------------- +// wxFileData - a class to hold the file info for the wxFileCtrl +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileData +{ +public: + enum fileType + { + is_file = 0x0000, + is_dir = 0x0001, + is_link = 0x0002, + is_exe = 0x0004, + is_drive = 0x0008 + }; + + wxFileData() { Init(); } + // Full copy constructor + wxFileData( const wxFileData& fileData ) { Copy(fileData); } + // Create a filedata from this information + wxFileData( const wxString &filePath, const wxString &fileName, + fileType type, int image_id ); + + // make a full copy of the other wxFileData + void Copy( const wxFileData &other ); + + // (re)read the extra data about the file from the system + void ReadData(); + + // get the name of the file, dir, drive + wxString GetFileName() const { return m_fileName; } + // get the full path + name of the file, dir, path + wxString GetFilePath() const { return m_filePath; } + // Set the path + name and name of the item + void SetNewName( const wxString &filePath, const wxString &fileName ); + + // Get the size of the file in bytes + wxFileOffset GetSize() const { return m_size; } + // Get the type of file, either file extension or , , + wxString GetFileType() const; + // get the last modification time + wxDateTime GetDateTime() const { return m_dateTime; } + // Get the time as a formatted string + wxString GetModificationTime() const; + // in UNIX get rwx for file, in MSW get attributes ARHS + wxString GetPermissions() const { return m_permissions; } + // Get the id of the image used in a wxImageList + int GetImageId() const { return m_image; } + + bool IsFile() const { return !IsDir() && !IsLink() && !IsDrive(); } + bool IsDir() const { return (m_type & is_dir ) != 0; } + bool IsLink() const { return (m_type & is_link ) != 0; } + bool IsExe() const { return (m_type & is_exe ) != 0; } + bool IsDrive() const { return (m_type & is_drive) != 0; } + + // Get/Set the type of file, file/dir/drive/link + int GetType() const { return m_type; } + + // the wxFileCtrl fields in report view + enum fileListFieldType + { + FileList_Name, + FileList_Size, + FileList_Type, + FileList_Time, +#if defined(__UNIX__) || defined(__WIN32__) + FileList_Perm, +#endif // defined(__UNIX__) || defined(__WIN32__) + FileList_Max + }; + + // Get the entry for report view of wxFileCtrl + wxString GetEntry( fileListFieldType num ) const; + + // Get a string representation of the file info + wxString GetHint() const; + // initialize a wxListItem attributes + void MakeItem( wxListItem &item ); + + // operators + wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; } + +protected: + wxString m_fileName; + wxString m_filePath; + wxFileOffset m_size; + wxDateTime m_dateTime; + wxString m_permissions; + int m_type; + int m_image; + +private: + void Init(); +}; + +//----------------------------------------------------------------------------- +// wxFileCtrl +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileCtrl : public wxListCtrl +{ +public: + wxFileCtrl(); + wxFileCtrl( wxWindow *win, + wxWindowID id, + const wxString &wild, + bool showHidden, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_LIST, + const wxValidator &validator = wxDefaultValidator, + const wxString &name = wxT("filelist") ); + virtual ~wxFileCtrl(); + + virtual void ChangeToListMode(); + virtual void ChangeToReportMode(); + virtual void ChangeToSmallIconMode(); + virtual void ShowHidden( bool show = true ); + bool GetShowHidden() const { return m_showHidden; } + + virtual long Add( wxFileData *fd, wxListItem &item ); + virtual void UpdateItem(const wxListItem &item); + virtual void UpdateFiles(); + virtual void MakeDir(); + virtual void GoToParentDir(); + virtual void GoToHomeDir(); + virtual void GoToDir( const wxString &dir ); + virtual void SetWild( const wxString &wild ); + wxString GetWild() const { return m_wild; } + wxString GetDir() const { return m_dirName; } + + void OnListDeleteItem( wxListEvent &event ); + void OnListDeleteAllItems( wxListEvent &event ); + void OnListEndLabelEdit( wxListEvent &event ); + void OnListColClick( wxListEvent &event ); + + virtual void SortItems(wxFileData::fileListFieldType field, bool foward); + bool GetSortDirection() const { return m_sort_foward; } + wxFileData::fileListFieldType GetSortField() const { return m_sort_field; } + +protected: + void FreeItemData(wxListItem& item); + void FreeAllItemsData(); + + wxString m_dirName; + bool m_showHidden; + wxString m_wild; + + bool m_sort_foward; + wxFileData::fileListFieldType m_sort_field; + +private: + DECLARE_DYNAMIC_CLASS(wxFileCtrl) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_FILEDLGG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/filepickerg.h b/Externals/wxWidgets/include/wx/generic/filepickerg.h index 769d20b4aa..502587bea6 100644 --- a/Externals/wxWidgets/include/wx/generic/filepickerg.h +++ b/Externals/wxWidgets/include/wx/generic/filepickerg.h @@ -1,213 +1,213 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/filepickerg.h -// Purpose: wxGenericFileDirButton, wxGenericFileButton, wxGenericDirButton -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: filepickerg.h 40100 2006-07-15 15:13:04Z VS $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDIRPICKER_H_ -#define _WX_FILEDIRPICKER_H_ - -#include "wx/button.h" -#include "wx/filedlg.h" -#include "wx/dirdlg.h" - - -extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_DIRPICKER_CHANGED; -extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_FILEPICKER_CHANGED; - - -//----------------------------------------------------------------------------- -// wxGenericFileDirButton: a button which brings up a wx{File|Dir}Dialog -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton, - public wxFileDirPickerWidgetBase -{ -public: - wxGenericFileDirButton() { } - wxGenericFileDirButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxFilePickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxFileSelectorPromptStr, - const wxString &wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerWidgetNameStr) - { - Create(parent, id, label, path, message, wildcard, - pos, size, style, validator, name); - } - - virtual ~wxGenericFileDirButton() {} - - virtual wxControl *AsControl() { return this; } - -public: // overrideable - - virtual wxDialog *CreateDialog() = 0; - - virtual wxWindow *GetDialogParent() - { return GetParent(); } - - virtual wxEventType GetEventType() const = 0; - -public: - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& label = wxFilePickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxFileSelectorPromptStr, - const wxString &wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerWidgetNameStr); - - // event handler for the click - void OnButtonClick(wxCommandEvent &); - -protected: - wxString m_message, m_wildcard; -}; - - -//----------------------------------------------------------------------------- -// wxGenericFileButton: a button which brings up a wxFileDialog -//----------------------------------------------------------------------------- - -#define wxFILEBTN_DEFAULT_STYLE (wxFLP_OPEN) - -class WXDLLIMPEXP_CORE wxGenericFileButton : public wxGenericFileDirButton -{ -public: - wxGenericFileButton() {} - wxGenericFileButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxFilePickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxFileSelectorPromptStr, - const wxString &wildcard = wxFileSelectorDefaultWildcardStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFILEBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFilePickerWidgetNameStr) - { - Create(parent, id, label, path, message, wildcard, - pos, size, style, validator, name); - } - -public: // overrideable - - virtual long GetDialogStyle() const - { - long filedlgstyle = 0; - - if (this->HasFlag(wxFLP_OPEN)) - filedlgstyle |= wxFD_OPEN; - if (this->HasFlag(wxFLP_SAVE)) - filedlgstyle |= wxFD_SAVE; - if (this->HasFlag(wxFLP_OVERWRITE_PROMPT)) - filedlgstyle |= wxFD_OVERWRITE_PROMPT; - if (this->HasFlag(wxFLP_FILE_MUST_EXIST)) - filedlgstyle |= wxFD_FILE_MUST_EXIST; - if (this->HasFlag(wxFLP_CHANGE_DIR)) - filedlgstyle |= wxFD_CHANGE_DIR; - - return filedlgstyle; - } - - virtual wxDialog *CreateDialog() - { - wxFileDialog *p = new wxFileDialog(GetDialogParent(), m_message, - wxEmptyString, wxEmptyString, - m_wildcard, GetDialogStyle()); - - // this sets both the default folder and the default file of the dialog - p->SetPath(m_path); - return p; - } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_FILEPICKER_CHANGED; } - -protected: - void UpdateDialogPath(wxDialog *p) - { wxStaticCast(p, wxFileDialog)->SetPath(m_path); } - void UpdatePathFromDialog(wxDialog *p) - { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } - -private: - DECLARE_DYNAMIC_CLASS(wxGenericFileButton) -}; - - -//----------------------------------------------------------------------------- -// wxGenericDirButton: a button which brings up a wxDirDialog -//----------------------------------------------------------------------------- - -#define wxDIRBTN_DEFAULT_STYLE 0 - -class WXDLLIMPEXP_CORE wxGenericDirButton : public wxGenericFileDirButton -{ -public: - wxGenericDirButton() {} - wxGenericDirButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxDirPickerWidgetLabel, - const wxString& path = wxEmptyString, - const wxString &message = wxDirSelectorPromptStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDIRBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDirPickerWidgetNameStr) - { - Create(parent, id, label, path, message, wxEmptyString, - pos, size, style, validator, name); - } - -public: // overrideable - - virtual long GetDialogStyle() const - { - long dirdlgstyle = wxDD_DEFAULT_STYLE; - - if (this->HasFlag(wxDIRP_DIR_MUST_EXIST)) - dirdlgstyle |= wxDD_DIR_MUST_EXIST; - if (this->HasFlag(wxDIRP_CHANGE_DIR)) - dirdlgstyle |= wxDD_CHANGE_DIR; - - return dirdlgstyle; - } - - virtual wxDialog *CreateDialog() - { - return new wxDirDialog(GetDialogParent(), m_message, m_path, - GetDialogStyle()); - } - - wxEventType GetEventType() const - { return wxEVT_COMMAND_DIRPICKER_CHANGED; } - -protected: - void UpdateDialogPath(wxDialog *p) - { wxStaticCast(p, wxDirDialog)->SetPath(m_path); } - void UpdatePathFromDialog(wxDialog *p) - { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); } - -private: - DECLARE_DYNAMIC_CLASS(wxGenericDirButton) -}; - - -#endif // _WX_FILEDIRPICKER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/filepickerg.h +// Purpose: wxGenericFileDirButton, wxGenericFileButton, wxGenericDirButton +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// RCS-ID: $Id: filepickerg.h 40100 2006-07-15 15:13:04Z VS $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDIRPICKER_H_ +#define _WX_FILEDIRPICKER_H_ + +#include "wx/button.h" +#include "wx/filedlg.h" +#include "wx/dirdlg.h" + + +extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_DIRPICKER_CHANGED; +extern WXDLLEXPORT_DATA(const wxEventType) wxEVT_COMMAND_FILEPICKER_CHANGED; + + +//----------------------------------------------------------------------------- +// wxGenericFileDirButton: a button which brings up a wx{File|Dir}Dialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton, + public wxFileDirPickerWidgetBase +{ +public: + wxGenericFileDirButton() { } + wxGenericFileDirButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxFilePickerWidgetLabel, + const wxString& path = wxEmptyString, + const wxString &message = wxFileSelectorPromptStr, + const wxString &wildcard = wxFileSelectorDefaultWildcardStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFilePickerWidgetNameStr) + { + Create(parent, id, label, path, message, wildcard, + pos, size, style, validator, name); + } + + virtual ~wxGenericFileDirButton() {} + + virtual wxControl *AsControl() { return this; } + +public: // overrideable + + virtual wxDialog *CreateDialog() = 0; + + virtual wxWindow *GetDialogParent() + { return GetParent(); } + + virtual wxEventType GetEventType() const = 0; + +public: + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label = wxFilePickerWidgetLabel, + const wxString& path = wxEmptyString, + const wxString &message = wxFileSelectorPromptStr, + const wxString &wildcard = wxFileSelectorDefaultWildcardStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFilePickerWidgetNameStr); + + // event handler for the click + void OnButtonClick(wxCommandEvent &); + +protected: + wxString m_message, m_wildcard; +}; + + +//----------------------------------------------------------------------------- +// wxGenericFileButton: a button which brings up a wxFileDialog +//----------------------------------------------------------------------------- + +#define wxFILEBTN_DEFAULT_STYLE (wxFLP_OPEN) + +class WXDLLIMPEXP_CORE wxGenericFileButton : public wxGenericFileDirButton +{ +public: + wxGenericFileButton() {} + wxGenericFileButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxFilePickerWidgetLabel, + const wxString& path = wxEmptyString, + const wxString &message = wxFileSelectorPromptStr, + const wxString &wildcard = wxFileSelectorDefaultWildcardStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFILEBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFilePickerWidgetNameStr) + { + Create(parent, id, label, path, message, wildcard, + pos, size, style, validator, name); + } + +public: // overrideable + + virtual long GetDialogStyle() const + { + long filedlgstyle = 0; + + if (this->HasFlag(wxFLP_OPEN)) + filedlgstyle |= wxFD_OPEN; + if (this->HasFlag(wxFLP_SAVE)) + filedlgstyle |= wxFD_SAVE; + if (this->HasFlag(wxFLP_OVERWRITE_PROMPT)) + filedlgstyle |= wxFD_OVERWRITE_PROMPT; + if (this->HasFlag(wxFLP_FILE_MUST_EXIST)) + filedlgstyle |= wxFD_FILE_MUST_EXIST; + if (this->HasFlag(wxFLP_CHANGE_DIR)) + filedlgstyle |= wxFD_CHANGE_DIR; + + return filedlgstyle; + } + + virtual wxDialog *CreateDialog() + { + wxFileDialog *p = new wxFileDialog(GetDialogParent(), m_message, + wxEmptyString, wxEmptyString, + m_wildcard, GetDialogStyle()); + + // this sets both the default folder and the default file of the dialog + p->SetPath(m_path); + return p; + } + + wxEventType GetEventType() const + { return wxEVT_COMMAND_FILEPICKER_CHANGED; } + +protected: + void UpdateDialogPath(wxDialog *p) + { wxStaticCast(p, wxFileDialog)->SetPath(m_path); } + void UpdatePathFromDialog(wxDialog *p) + { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } + +private: + DECLARE_DYNAMIC_CLASS(wxGenericFileButton) +}; + + +//----------------------------------------------------------------------------- +// wxGenericDirButton: a button which brings up a wxDirDialog +//----------------------------------------------------------------------------- + +#define wxDIRBTN_DEFAULT_STYLE 0 + +class WXDLLIMPEXP_CORE wxGenericDirButton : public wxGenericFileDirButton +{ +public: + wxGenericDirButton() {} + wxGenericDirButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxDirPickerWidgetLabel, + const wxString& path = wxEmptyString, + const wxString &message = wxDirSelectorPromptStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDirPickerWidgetNameStr) + { + Create(parent, id, label, path, message, wxEmptyString, + pos, size, style, validator, name); + } + +public: // overrideable + + virtual long GetDialogStyle() const + { + long dirdlgstyle = wxDD_DEFAULT_STYLE; + + if (this->HasFlag(wxDIRP_DIR_MUST_EXIST)) + dirdlgstyle |= wxDD_DIR_MUST_EXIST; + if (this->HasFlag(wxDIRP_CHANGE_DIR)) + dirdlgstyle |= wxDD_CHANGE_DIR; + + return dirdlgstyle; + } + + virtual wxDialog *CreateDialog() + { + return new wxDirDialog(GetDialogParent(), m_message, m_path, + GetDialogStyle()); + } + + wxEventType GetEventType() const + { return wxEVT_COMMAND_DIRPICKER_CHANGED; } + +protected: + void UpdateDialogPath(wxDialog *p) + { wxStaticCast(p, wxDirDialog)->SetPath(m_path); } + void UpdatePathFromDialog(wxDialog *p) + { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); } + +private: + DECLARE_DYNAMIC_CLASS(wxGenericDirButton) +}; + + +#endif // _WX_FILEDIRPICKER_H_ diff --git a/Externals/wxWidgets/include/wx/generic/fontdlgg.h b/Externals/wxWidgets/include/wx/generic/fontdlgg.h index cd13b85322..6a4b80b291 100644 --- a/Externals/wxWidgets/include/wx/generic/fontdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/fontdlgg.h @@ -1,120 +1,120 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/fontdlgg.h -// Purpose: wxGenericFontDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: fontdlgg.h 39286 2006-05-23 11:16:47Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_FONTDLGG_H -#define _WX_GENERIC_FONTDLGG_H - -#include "wx/defs.h" -#include "wx/gdicmn.h" -#include "wx/font.h" -#include "wx/dialog.h" -#include "wx/cmndata.h" - -#ifdef __WXWINCE__ -#define USE_SPINCTRL_FOR_POINT_SIZE 1 -class WXDLLEXPORT wxSpinEvent; -#else -#define USE_SPINCTRL_FOR_POINT_SIZE 0 -#endif - -/* - * FONT DIALOG - */ - -class WXDLLEXPORT wxChoice; -class WXDLLEXPORT wxText; -class WXDLLEXPORT wxCheckBox; -class WXDLLEXPORT wxFontPreviewer; - -enum -{ - wxID_FONT_UNDERLINE = 3000, - wxID_FONT_STYLE, - wxID_FONT_WEIGHT, - wxID_FONT_FAMILY, - wxID_FONT_COLOUR, - wxID_FONT_SIZE -}; - -class WXDLLEXPORT wxGenericFontDialog : public wxFontDialogBase -{ -public: - wxGenericFontDialog() { Init(); } - wxGenericFontDialog(wxWindow *parent) - : wxFontDialogBase(parent) { Init(); } - wxGenericFontDialog(wxWindow *parent, const wxFontData& data) - : wxFontDialogBase(parent, data) { Init(); } - virtual ~wxGenericFontDialog(); - - virtual int ShowModal(); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for backwards compatibility only - wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // Internal functions - void OnCloseWindow(wxCloseEvent& event); - - virtual void CreateWidgets(); - virtual void InitializeFont(); - - void OnChangeFont(wxCommandEvent& event); - -#if USE_SPINCTRL_FOR_POINT_SIZE - void OnChangeSize(wxSpinEvent& event); -#endif - -protected: - - virtual bool DoCreate(wxWindow *parent); - -private: - - // common part of all ctors - void Init(); - - void DoChangeFont(); - - wxFont m_dialogFont; - - wxChoice *m_familyChoice; - wxChoice *m_styleChoice; - wxChoice *m_weightChoice; - wxChoice *m_colourChoice; - wxCheckBox *m_underLineCheckBox; - -#if !USE_SPINCTRL_FOR_POINT_SIZE - wxChoice *m_pointSizeChoice; -#endif - - wxFontPreviewer *m_previewer; - bool m_useEvents; - - // static bool fontDialogCancelled; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericFontDialog) -}; - -WXDLLEXPORT const wxChar *wxFontFamilyIntToString(int family); -WXDLLEXPORT const wxChar *wxFontWeightIntToString(int weight); -WXDLLEXPORT const wxChar *wxFontStyleIntToString(int style); -WXDLLEXPORT int wxFontFamilyStringToInt(wxChar *family); -WXDLLEXPORT int wxFontWeightStringToInt(wxChar *weight); -WXDLLEXPORT int wxFontStyleStringToInt(wxChar *style); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for backwards compatibility only -inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data) - :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // _WX_GENERIC_FONTDLGG_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/fontdlgg.h +// Purpose: wxGenericFontDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: fontdlgg.h 39286 2006-05-23 11:16:47Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_FONTDLGG_H +#define _WX_GENERIC_FONTDLGG_H + +#include "wx/defs.h" +#include "wx/gdicmn.h" +#include "wx/font.h" +#include "wx/dialog.h" +#include "wx/cmndata.h" + +#ifdef __WXWINCE__ +#define USE_SPINCTRL_FOR_POINT_SIZE 1 +class WXDLLEXPORT wxSpinEvent; +#else +#define USE_SPINCTRL_FOR_POINT_SIZE 0 +#endif + +/* + * FONT DIALOG + */ + +class WXDLLEXPORT wxChoice; +class WXDLLEXPORT wxText; +class WXDLLEXPORT wxCheckBox; +class WXDLLEXPORT wxFontPreviewer; + +enum +{ + wxID_FONT_UNDERLINE = 3000, + wxID_FONT_STYLE, + wxID_FONT_WEIGHT, + wxID_FONT_FAMILY, + wxID_FONT_COLOUR, + wxID_FONT_SIZE +}; + +class WXDLLEXPORT wxGenericFontDialog : public wxFontDialogBase +{ +public: + wxGenericFontDialog() { Init(); } + wxGenericFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Init(); } + wxGenericFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Init(); } + virtual ~wxGenericFontDialog(); + + virtual int ShowModal(); + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, for backwards compatibility only + wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // Internal functions + void OnCloseWindow(wxCloseEvent& event); + + virtual void CreateWidgets(); + virtual void InitializeFont(); + + void OnChangeFont(wxCommandEvent& event); + +#if USE_SPINCTRL_FOR_POINT_SIZE + void OnChangeSize(wxSpinEvent& event); +#endif + +protected: + + virtual bool DoCreate(wxWindow *parent); + +private: + + // common part of all ctors + void Init(); + + void DoChangeFont(); + + wxFont m_dialogFont; + + wxChoice *m_familyChoice; + wxChoice *m_styleChoice; + wxChoice *m_weightChoice; + wxChoice *m_colourChoice; + wxCheckBox *m_underLineCheckBox; + +#if !USE_SPINCTRL_FOR_POINT_SIZE + wxChoice *m_pointSizeChoice; +#endif + + wxFontPreviewer *m_previewer; + bool m_useEvents; + + // static bool fontDialogCancelled; + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericFontDialog) +}; + +WXDLLEXPORT const wxChar *wxFontFamilyIntToString(int family); +WXDLLEXPORT const wxChar *wxFontWeightIntToString(int weight); +WXDLLEXPORT const wxChar *wxFontStyleIntToString(int style); +WXDLLEXPORT int wxFontFamilyStringToInt(wxChar *family); +WXDLLEXPORT int wxFontWeightStringToInt(wxChar *weight); +WXDLLEXPORT int wxFontStyleStringToInt(wxChar *style); + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, for backwards compatibility only +inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data) + :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); } +#endif // WXWIN_COMPATIBILITY_2_6 + +#endif // _WX_GENERIC_FONTDLGG_H diff --git a/Externals/wxWidgets/include/wx/generic/fontpickerg.h b/Externals/wxWidgets/include/wx/generic/fontpickerg.h index cfa612aa97..ead7645139 100644 --- a/Externals/wxWidgets/include/wx/generic/fontpickerg.h +++ b/Externals/wxWidgets/include/wx/generic/fontpickerg.h @@ -1,82 +1,82 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/fontpickerg.h -// Purpose: wxGenericFontButton header -// Author: Francesco Montorsi -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Francesco Montorsi -// RCS-ID: $Id: fontpickerg.h 42999 2006-11-03 21:54:13Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTPICKER_H_ -#define _WX_FONTPICKER_H_ - -#include "wx/button.h" -#include "wx/cmndata.h" - -//----------------------------------------------------------------------------- -// wxGenericFontButton: a button which brings up a wxColourDialog -//----------------------------------------------------------------------------- - -#define wxFONTBTN_DEFAULT_STYLE \ - (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) - -class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, - public wxFontPickerWidgetBase -{ -public: - wxGenericFontButton() {} - wxGenericFontButton(wxWindow *parent, - wxWindowID id, - const wxFont &initial = wxNullFont, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFONTBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerWidgetNameStr) - { - Create(parent, id, initial, pos, size, style, validator, name); - } - - virtual ~wxGenericFontButton() {} - - -public: // API extensions specific for wxGenericFontButton - - // user can override this to init font data in a different way - virtual void InitFontData(); - - // returns the font data shown in wxColourDialog - wxFontData *GetFontData() { return &ms_data; } - - -public: - - bool Create(wxWindow *parent, - wxWindowID id, - const wxFont &initial = *wxNORMAL_FONT, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxFONTBTN_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxFontPickerWidgetNameStr); - - void OnButtonClick(wxCommandEvent &); - - -protected: - - void UpdateFont(); - - // the colour data shown in wxColourPickerCtrlGeneric - // controls. This member is static so that all colour pickers - // in the program share the same set of custom colours. - static wxFontData ms_data; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericFontButton) -}; - - -#endif // _WX_FONTPICKER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/fontpickerg.h +// Purpose: wxGenericFontButton header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// RCS-ID: $Id: fontpickerg.h 42999 2006-11-03 21:54:13Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTPICKER_H_ +#define _WX_FONTPICKER_H_ + +#include "wx/button.h" +#include "wx/cmndata.h" + +//----------------------------------------------------------------------------- +// wxGenericFontButton: a button which brings up a wxColourDialog +//----------------------------------------------------------------------------- + +#define wxFONTBTN_DEFAULT_STYLE \ + (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) + +class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, + public wxFontPickerWidgetBase +{ +public: + wxGenericFontButton() {} + wxGenericFontButton(wxWindow *parent, + wxWindowID id, + const wxFont &initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFONTBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFontPickerWidgetNameStr) + { + Create(parent, id, initial, pos, size, style, validator, name); + } + + virtual ~wxGenericFontButton() {} + + +public: // API extensions specific for wxGenericFontButton + + // user can override this to init font data in a different way + virtual void InitFontData(); + + // returns the font data shown in wxColourDialog + wxFontData *GetFontData() { return &ms_data; } + + +public: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxFont &initial = *wxNORMAL_FONT, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFONTBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxFontPickerWidgetNameStr); + + void OnButtonClick(wxCommandEvent &); + + +protected: + + void UpdateFont(); + + // the colour data shown in wxColourPickerCtrlGeneric + // controls. This member is static so that all colour pickers + // in the program share the same set of custom colours. + static wxFontData ms_data; + +private: + DECLARE_DYNAMIC_CLASS(wxGenericFontButton) +}; + + +#endif // _WX_FONTPICKER_H_ diff --git a/Externals/wxWidgets/include/wx/generic/grid.h b/Externals/wxWidgets/include/wx/generic/grid.h index 024e4ee6ba..858f2ae0ff 100644 --- a/Externals/wxWidgets/include/wx/generic/grid.h +++ b/Externals/wxWidgets/include/wx/generic/grid.h @@ -1,2302 +1,2302 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/grid.h -// Purpose: wxGrid and related classes -// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) -// Modified by: Santiago Palacios -// Created: 1/08/1999 -// RCS-ID: $Id: grid.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Michael Bedward -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_GRID_H_ -#define _WX_GENERIC_GRID_H_ - -#include "wx/defs.h" - -#if wxUSE_GRID - -#include "wx/scrolwin.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxGridNameStr[]; - -// Default parameters for wxGrid -// -#define WXGRID_DEFAULT_NUMBER_ROWS 10 -#define WXGRID_DEFAULT_NUMBER_COLS 10 -#if defined(__WXMSW__) || defined(__WXGTK20__) -#define WXGRID_DEFAULT_ROW_HEIGHT 25 -#else -#define WXGRID_DEFAULT_ROW_HEIGHT 30 -#endif // __WXMSW__ -#define WXGRID_DEFAULT_COL_WIDTH 80 -#define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32 -#define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82 -#define WXGRID_LABEL_EDGE_ZONE 2 -#define WXGRID_MIN_ROW_HEIGHT 15 -#define WXGRID_MIN_COL_WIDTH 15 -#define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16 - -// type names for grid table values -#define wxGRID_VALUE_STRING _T("string") -#define wxGRID_VALUE_BOOL _T("bool") -#define wxGRID_VALUE_NUMBER _T("long") -#define wxGRID_VALUE_FLOAT _T("double") -#define wxGRID_VALUE_CHOICE _T("choice") - -#define wxGRID_VALUE_TEXT wxGRID_VALUE_STRING -#define wxGRID_VALUE_LONG wxGRID_VALUE_NUMBER - -#if wxABI_VERSION >= 20808 - // magic constant which tells (to some functions) to automatically - // calculate the appropriate size - #define wxGRID_AUTOSIZE (-1) -#endif // wxABI_VERSION >= 20808 - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_ADV wxGrid; -class WXDLLIMPEXP_FWD_ADV wxGridCellAttr; -class WXDLLIMPEXP_FWD_ADV wxGridCellAttrProviderData; -class WXDLLIMPEXP_FWD_ADV wxGridColLabelWindow; -class WXDLLIMPEXP_FWD_ADV wxGridCornerLabelWindow; -class WXDLLIMPEXP_FWD_ADV wxGridRowLabelWindow; -class WXDLLIMPEXP_FWD_ADV wxGridWindow; -class WXDLLIMPEXP_FWD_ADV wxGridTypeRegistry; -class WXDLLIMPEXP_FWD_ADV wxGridSelection; - -class WXDLLIMPEXP_FWD_CORE wxCheckBox; -class WXDLLIMPEXP_FWD_CORE wxComboBox; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -#if wxUSE_SPINCTRL -class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; -#endif - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -#define wxSafeIncRef(p) if ( p ) (p)->IncRef() -#define wxSafeDecRef(p) if ( p ) (p)->DecRef() - -// ---------------------------------------------------------------------------- -// wxGridCellWorker: common base class for wxGridCellRenderer and -// wxGridCellEditor -// -// NB: this is more an implementation convenience than a design issue, so this -// class is not documented and is not public at all -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer -{ -public: - wxGridCellWorker() { m_nRef = 1; } - - // this class is ref counted: it is created with ref count of 1, so - // calling DecRef() once will delete it. Calling IncRef() allows to lock - // it until the matching DecRef() is called - void IncRef() { m_nRef++; } - void DecRef() { if ( --m_nRef == 0 ) delete this; } - - // interpret renderer parameters: arbitrary string whose interpretatin is - // left to the derived classes - virtual void SetParameters(const wxString& params); - -protected: - // virtual dtor for any base class - private because only DecRef() can - // delete us - virtual ~wxGridCellWorker(); - -private: - size_t m_nRef; - - // suppress the stupid gcc warning about the class having private dtor and - // no friends - friend class wxGridCellWorkerDummyFriend; -}; - -// ---------------------------------------------------------------------------- -// wxGridCellRenderer: this class is responsible for actually drawing the cell -// in the grid. You may pass it to the wxGridCellAttr (below) to change the -// format of one given cell or to wxGrid::SetDefaultRenderer() to change the -// view of all cells. This is an ABC, you will normally use one of the -// predefined derived classes or derive your own class from it. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGridCellRenderer : public wxGridCellWorker -{ -public: - // draw the given cell on the provided DC inside the given rectangle - // using the style specified by the attribute and the default or selected - // state corresponding to the isSelected value. - // - // this pure virtual function has a default implementation which will - // prepare the DC using the given attribute: it will draw the rectangle - // with the bg colour from attr and set the text colour and font - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected) = 0; - - // get the preferred size of the cell for its contents - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col) = 0; - - // create a new object which is the copy of this one - virtual wxGridCellRenderer *Clone() const = 0; -}; - -// the default renderer for the cells containing string data -class WXDLLIMPEXP_ADV wxGridCellStringRenderer : public wxGridCellRenderer -{ -public: - // draw the string - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - // return the string extent - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - virtual wxGridCellRenderer *Clone() const - { return new wxGridCellStringRenderer; } - -protected: - // set the text colours before drawing - void SetTextColoursAndFont(const wxGrid& grid, - const wxGridCellAttr& attr, - wxDC& dc, - bool isSelected); - - // calc the string extent for given string/font - wxSize DoGetBestSize(const wxGridCellAttr& attr, - wxDC& dc, - const wxString& text); -}; - -// the default renderer for the cells containing numeric (long) data -class WXDLLIMPEXP_ADV wxGridCellNumberRenderer : public wxGridCellStringRenderer -{ -public: - // draw the string right aligned - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - virtual wxGridCellRenderer *Clone() const - { return new wxGridCellNumberRenderer; } - -protected: - wxString GetString(const wxGrid& grid, int row, int col); -}; - -class WXDLLIMPEXP_ADV wxGridCellFloatRenderer : public wxGridCellStringRenderer -{ -public: - wxGridCellFloatRenderer(int width = -1, int precision = -1); - - // get/change formatting parameters - int GetWidth() const { return m_width; } - void SetWidth(int width) { m_width = width; m_format.clear(); } - int GetPrecision() const { return m_precision; } - void SetPrecision(int precision) { m_precision = precision; m_format.clear(); } - - // draw the string right aligned with given width/precision - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - // parameters string format is "width[,precision]" - virtual void SetParameters(const wxString& params); - - virtual wxGridCellRenderer *Clone() const; - -protected: - wxString GetString(const wxGrid& grid, int row, int col); - -private: - // formatting parameters - int m_width, - m_precision; - - wxString m_format; -}; - -// renderer for boolean fields -class WXDLLIMPEXP_ADV wxGridCellBoolRenderer : public wxGridCellRenderer -{ -public: - // draw a check mark or nothing - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - // return the checkmark size - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - virtual wxGridCellRenderer *Clone() const - { return new wxGridCellBoolRenderer; } - -private: - static wxSize ms_sizeCheckMark; -}; - -// ---------------------------------------------------------------------------- -// wxGridCellEditor: This class is responsible for providing and manipulating -// the in-place edit controls for the grid. Instances of wxGridCellEditor -// (actually, instances of derived classes since it is an ABC) can be -// associated with the cell attributes for individual cells, rows, columns, or -// even for the entire grid. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGridCellEditor : public wxGridCellWorker -{ -public: - wxGridCellEditor(); - - bool IsCreated() { return m_control != NULL; } - wxControl* GetControl() { return m_control; } - void SetControl(wxControl* control) { m_control = control; } - - wxGridCellAttr* GetCellAttr() { return m_attr; } - void SetCellAttr(wxGridCellAttr* attr) { m_attr = attr; } - - // Creates the actual edit control - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler) = 0; - - // Size and position the edit control - virtual void SetSize(const wxRect& rect); - - // Show or hide the edit control, use the specified attributes to set - // colours/fonts for it - virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL); - - // Draws the part of the cell not occupied by the control: the base class - // version just fills it with background colour from the attribute - virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); - - // Fetch the value from the table and prepare the edit control - // to begin editing. Set the focus to the edit control. - virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; - - // Complete the editing of the current cell. Returns true if the value has - // changed. If necessary, the control may be destroyed. - virtual bool EndEdit(int row, int col, wxGrid* grid) = 0; - - // Reset the value in the control back to its starting value - virtual void Reset() = 0; - - // return true to allow the given key to start editing: the base class - // version only checks that the event has no modifiers. The derived - // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in - // their IsAcceptedKey() implementation, although, of course, it is not a - // mandatory requirment. - // - // NB: if the key is F2 (special), editing will always start and this - // method will not be called at all (but StartingKey() will) - virtual bool IsAcceptedKey(wxKeyEvent& event); - - // If the editor is enabled by pressing keys on the grid, this will be - // called to let the editor do something about that first key if desired - virtual void StartingKey(wxKeyEvent& event); - - // if the editor is enabled by clicking on the cell, this method will be - // called - virtual void StartingClick(); - - // Some types of controls on some platforms may need some help - // with the Return key. - virtual void HandleReturn(wxKeyEvent& event); - - // Final cleanup - virtual void Destroy(); - - // create a new object which is the copy of this one - virtual wxGridCellEditor *Clone() const = 0; - - // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const = 0; - -protected: - // the dtor is private because only DecRef() can delete us - virtual ~wxGridCellEditor(); - - // the control we show on screen - wxControl* m_control; - - // a temporary pointer to the attribute being edited - wxGridCellAttr* m_attr; - - // if we change the colours/font of the control from the default ones, we - // must restore the default later and we save them here between calls to - // Show(true) and Show(false) - wxColour m_colFgOld, - m_colBgOld; - wxFont m_fontOld; - - // suppress the stupid gcc warning about the class having private dtor and - // no friends - friend class wxGridCellEditorDummyFriend; - - DECLARE_NO_COPY_CLASS(wxGridCellEditor) -}; - -#if wxUSE_TEXTCTRL - -// the editor for string/text data -class WXDLLIMPEXP_ADV wxGridCellTextEditor : public wxGridCellEditor -{ -public: - wxGridCellTextEditor(); - - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler); - virtual void SetSize(const wxRect& rect); - - virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); - - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, wxGrid* grid); - - virtual void Reset(); - virtual void StartingKey(wxKeyEvent& event); - virtual void HandleReturn(wxKeyEvent& event); - - // parameters string format is "max_width" - virtual void SetParameters(const wxString& params); - - virtual wxGridCellEditor *Clone() const - { return new wxGridCellTextEditor; } - - // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const; - -protected: - wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; } - - // parts of our virtual functions reused by the derived classes - void DoBeginEdit(const wxString& startValue); - void DoReset(const wxString& startValue); - -private: - size_t m_maxChars; // max number of chars allowed - wxString m_startValue; - - DECLARE_NO_COPY_CLASS(wxGridCellTextEditor) -}; - -// the editor for numeric (long) data -class WXDLLIMPEXP_ADV wxGridCellNumberEditor : public wxGridCellTextEditor -{ -public: - // allows to specify the range - if min == max == -1, no range checking is - // done - wxGridCellNumberEditor(int min = -1, int max = -1); - - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler); - - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, wxGrid* grid); - - virtual void Reset(); - virtual void StartingKey(wxKeyEvent& event); - - // parameters string format is "min,max" - virtual void SetParameters(const wxString& params); - - virtual wxGridCellEditor *Clone() const - { return new wxGridCellNumberEditor(m_min, m_max); } - - // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const; - -protected: -#if wxUSE_SPINCTRL - wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; } -#endif - - // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl - bool HasRange() const - { -#if wxUSE_SPINCTRL - return m_min != m_max; -#else - return false; -#endif - } - - // string representation of m_valueOld - wxString GetString() const - { return wxString::Format(_T("%ld"), m_valueOld); } - -private: - int m_min, - m_max; - - long m_valueOld; - - DECLARE_NO_COPY_CLASS(wxGridCellNumberEditor) -}; - -// the editor for floating point numbers (double) data -class WXDLLIMPEXP_ADV wxGridCellFloatEditor : public wxGridCellTextEditor -{ -public: - wxGridCellFloatEditor(int width = -1, int precision = -1); - - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler); - - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, wxGrid* grid); - - virtual void Reset(); - virtual void StartingKey(wxKeyEvent& event); - - virtual wxGridCellEditor *Clone() const - { return new wxGridCellFloatEditor(m_width, m_precision); } - - // parameters string format is "width,precision" - virtual void SetParameters(const wxString& params); - -protected: - // string representation of m_valueOld - wxString GetString() const; - -private: - int m_width, - m_precision; - double m_valueOld; - - DECLARE_NO_COPY_CLASS(wxGridCellFloatEditor) -}; - -#endif // wxUSE_TEXTCTRL - -#if wxUSE_CHECKBOX - -// the editor for boolean data -class WXDLLIMPEXP_ADV wxGridCellBoolEditor : public wxGridCellEditor -{ -public: - wxGridCellBoolEditor() { } - - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler); - - virtual void SetSize(const wxRect& rect); - virtual void Show(bool show, wxGridCellAttr *attr = NULL); - - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, wxGrid* grid); - - virtual void Reset(); - virtual void StartingClick(); - virtual void StartingKey(wxKeyEvent& event); - - virtual wxGridCellEditor *Clone() const - { return new wxGridCellBoolEditor; } - - // added GetValue so we can get the value which is in the control, see - // also UseStringValues() - virtual wxString GetValue() const; - - // set the string values returned by GetValue() for the true and false - // states, respectively - static void UseStringValues(const wxString& valueTrue = _T("1"), - const wxString& valueFalse = wxEmptyString); - - // return true if the given string is equal to the string representation of - // true value which we currently use - static bool IsTrueValue(const wxString& value); - -protected: - wxCheckBox *CBox() const { return (wxCheckBox *)m_control; } - -private: - bool m_startValue; - - static wxString ms_stringValues[2]; - - DECLARE_NO_COPY_CLASS(wxGridCellBoolEditor) -}; - -#endif // wxUSE_CHECKBOX - -#if wxUSE_COMBOBOX - -// the editor for string data allowing to choose from the list of strings -class WXDLLIMPEXP_ADV wxGridCellChoiceEditor : public wxGridCellEditor -{ -public: - // if !allowOthers, user can't type a string not in choices array - wxGridCellChoiceEditor(size_t count = 0, - const wxString choices[] = NULL, - bool allowOthers = false); - wxGridCellChoiceEditor(const wxArrayString& choices, - bool allowOthers = false); - - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler); - - virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); - - virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, wxGrid* grid); - - virtual void Reset(); - - // parameters string format is "item1[,item2[...,itemN]]" - virtual void SetParameters(const wxString& params); - - virtual wxGridCellEditor *Clone() const; - - // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const; - -protected: - wxComboBox *Combo() const { return (wxComboBox *)m_control; } - -// DJC - (MAPTEK) you at least need access to m_choices if you -// wish to override this class -protected: - wxString m_startValue; - wxArrayString m_choices; - bool m_allowOthers; - - DECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor) -}; - -#endif // wxUSE_COMBOBOX - -// ---------------------------------------------------------------------------- -// wxGridCellAttr: this class can be used to alter the cells appearance in -// the grid by changing their colour/font/... from default. An object of this -// class may be returned by wxGridTable::GetAttr(). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGridCellAttr : public wxClientDataContainer -{ -public: - enum wxAttrKind - { - Any, - Default, - Cell, - Row, - Col, - Merged - }; - - // ctors - wxGridCellAttr(wxGridCellAttr *attrDefault = NULL) - { - Init(attrDefault); - - // MB: args used to be 0,0 here but wxALIGN_LEFT is 0 - SetAlignment(-1, -1); - } - - // VZ: considering the number of members wxGridCellAttr has now, this ctor - // seems to be pretty useless... may be we should just remove it? - wxGridCellAttr(const wxColour& colText, - const wxColour& colBack, - const wxFont& font, - int hAlign, - int vAlign) - : m_colText(colText), m_colBack(colBack), m_font(font) - { - Init(); - SetAlignment(hAlign, vAlign); - } - - // creates a new copy of this object - wxGridCellAttr *Clone() const; - void MergeWith(wxGridCellAttr *mergefrom); - - // this class is ref counted: it is created with ref count of 1, so - // calling DecRef() once will delete it. Calling IncRef() allows to lock - // it until the matching DecRef() is called - void IncRef() { m_nRef++; } - void DecRef() { if ( --m_nRef == 0 ) delete this; } - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } - void SetFont(const wxFont& font) { m_font = font; } - void SetAlignment(int hAlign, int vAlign) - { - m_hAlign = hAlign; - m_vAlign = vAlign; - } - void SetSize(int num_rows, int num_cols); - void SetOverflow(bool allow = true) - { m_overflow = allow ? Overflow : SingleCell; } - void SetReadOnly(bool isReadOnly = true) - { m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; } - - // takes ownership of the pointer - void SetRenderer(wxGridCellRenderer *renderer) - { wxSafeDecRef(m_renderer); m_renderer = renderer; } - void SetEditor(wxGridCellEditor* editor) - { wxSafeDecRef(m_editor); m_editor = editor; } - - void SetKind(wxAttrKind kind) { m_attrkind = kind; } - - // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } - bool HasAlignment() const { return (m_hAlign != -1 || m_vAlign != -1); } - bool HasRenderer() const { return m_renderer != NULL; } - bool HasEditor() const { return m_editor != NULL; } - bool HasReadWriteMode() const { return m_isReadOnly != Unset; } - bool HasOverflowMode() const { return m_overflow != UnsetOverflow; } - bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; } - - const wxColour& GetTextColour() const; - const wxColour& GetBackgroundColour() const; - const wxFont& GetFont() const; - void GetAlignment(int *hAlign, int *vAlign) const; - void GetSize(int *num_rows, int *num_cols) const; - bool GetOverflow() const - { return m_overflow != SingleCell; } - wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; - wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; - - bool IsReadOnly() const { return m_isReadOnly == wxGridCellAttr::ReadOnly; } - - wxAttrKind GetKind() { return m_attrkind; } - - void SetDefAttr(wxGridCellAttr* defAttr) { m_defGridAttr = defAttr; } - -protected: - // the dtor is private because only DecRef() can delete us - virtual ~wxGridCellAttr() - { - wxSafeDecRef(m_renderer); - wxSafeDecRef(m_editor); - } - -private: - enum wxAttrReadMode - { - Unset = -1, - ReadWrite, - ReadOnly - }; - - enum wxAttrOverflowMode - { - UnsetOverflow = -1, - Overflow, - SingleCell - }; - - // the common part of all ctors - void Init(wxGridCellAttr *attrDefault = NULL); - - - // the ref count - when it goes to 0, we die - size_t m_nRef; - - wxColour m_colText, - m_colBack; - wxFont m_font; - int m_hAlign, - m_vAlign; - int m_sizeRows, - m_sizeCols; - - wxAttrOverflowMode m_overflow; - - wxGridCellRenderer* m_renderer; - wxGridCellEditor* m_editor; - wxGridCellAttr* m_defGridAttr; - - wxAttrReadMode m_isReadOnly; - - wxAttrKind m_attrkind; - - // use Clone() instead - DECLARE_NO_COPY_CLASS(wxGridCellAttr) - - // suppress the stupid gcc warning about the class having private dtor and - // no friends - friend class wxGridCellAttrDummyFriend; -}; - -// ---------------------------------------------------------------------------- -// wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the -// cell attributes. -// ---------------------------------------------------------------------------- - -// implementation note: we separate it from wxGridTableBase because we wish to -// avoid deriving a new table class if possible, and sometimes it will be -// enough to just derive another wxGridCellAttrProvider instead -// -// the default implementation is reasonably efficient for the generic case, -// but you might still wish to implement your own for some specific situations -// if you have performance problems with the stock one -class WXDLLIMPEXP_ADV wxGridCellAttrProvider : public wxClientDataContainer -{ -public: - wxGridCellAttrProvider(); - virtual ~wxGridCellAttrProvider(); - - // DecRef() must be called on the returned pointer - virtual wxGridCellAttr *GetAttr(int row, int col, - wxGridCellAttr::wxAttrKind kind ) const; - - // all these functions take ownership of the pointer, don't call DecRef() - // on it - virtual void SetAttr(wxGridCellAttr *attr, int row, int col); - virtual void SetRowAttr(wxGridCellAttr *attr, int row); - virtual void SetColAttr(wxGridCellAttr *attr, int col); - - // these functions must be called whenever some rows/cols are deleted - // because the internal data must be updated then - void UpdateAttrRows( size_t pos, int numRows ); - void UpdateAttrCols( size_t pos, int numCols ); - -private: - void InitData(); - - wxGridCellAttrProviderData *m_data; - - DECLARE_NO_COPY_CLASS(wxGridCellAttrProvider) -}; - -////////////////////////////////////////////////////////////////////// -// -// Grid table classes -// -////////////////////////////////////////////////////////////////////// - - -class WXDLLIMPEXP_ADV wxGridTableBase : public wxObject, public wxClientDataContainer -{ -public: - wxGridTableBase(); - virtual ~wxGridTableBase(); - - // You must override these functions in a derived table class - // - virtual int GetNumberRows() = 0; - virtual int GetNumberCols() = 0; - virtual bool IsEmptyCell( int row, int col ) = 0; - virtual wxString GetValue( int row, int col ) = 0; - virtual void SetValue( int row, int col, const wxString& value ) = 0; - - // Data type determination and value access - virtual wxString GetTypeName( int row, int col ); - virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); - virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); - - virtual long GetValueAsLong( int row, int col ); - virtual double GetValueAsDouble( int row, int col ); - virtual bool GetValueAsBool( int row, int col ); - - virtual void SetValueAsLong( int row, int col, long value ); - virtual void SetValueAsDouble( int row, int col, double value ); - virtual void SetValueAsBool( int row, int col, bool value ); - - // For user defined types - virtual void* GetValueAsCustom( int row, int col, const wxString& typeName ); - virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); - - - // Overriding these is optional - // - virtual void SetView( wxGrid *grid ) { m_view = grid; } - virtual wxGrid * GetView() const { return m_view; } - - virtual void Clear() {} - virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 ); - virtual bool AppendRows( size_t numRows = 1 ); - virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); - virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 ); - virtual bool AppendCols( size_t numCols = 1 ); - virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); - - virtual wxString GetRowLabelValue( int row ); - virtual wxString GetColLabelValue( int col ); - virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {} - virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {} - - // Attribute handling - // - - // give us the attr provider to use - we take ownership of the pointer - void SetAttrProvider(wxGridCellAttrProvider *attrProvider); - - // get the currently used attr provider (may be NULL) - wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; } - - // Does this table allow attributes? Default implementation creates - // a wxGridCellAttrProvider if necessary. - virtual bool CanHaveAttributes(); - - // by default forwarded to wxGridCellAttrProvider if any. May be - // overridden to handle attributes directly in the table. - virtual wxGridCellAttr *GetAttr( int row, int col, - wxGridCellAttr::wxAttrKind kind ); - - - // these functions take ownership of the pointer - virtual void SetAttr(wxGridCellAttr* attr, int row, int col); - virtual void SetRowAttr(wxGridCellAttr *attr, int row); - virtual void SetColAttr(wxGridCellAttr *attr, int col); - -private: - wxGrid * m_view; - wxGridCellAttrProvider *m_attrProvider; - - DECLARE_ABSTRACT_CLASS(wxGridTableBase) - DECLARE_NO_COPY_CLASS(wxGridTableBase) -}; - - -// ---------------------------------------------------------------------------- -// wxGridTableMessage -// ---------------------------------------------------------------------------- - -// IDs for messages sent from grid table to view -// -enum wxGridTableRequest -{ - wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, - wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, - wxGRIDTABLE_NOTIFY_ROWS_INSERTED, - wxGRIDTABLE_NOTIFY_ROWS_APPENDED, - wxGRIDTABLE_NOTIFY_ROWS_DELETED, - wxGRIDTABLE_NOTIFY_COLS_INSERTED, - wxGRIDTABLE_NOTIFY_COLS_APPENDED, - wxGRIDTABLE_NOTIFY_COLS_DELETED -}; - -class WXDLLIMPEXP_ADV wxGridTableMessage -{ -public: - wxGridTableMessage(); - wxGridTableMessage( wxGridTableBase *table, int id, - int comInt1 = -1, - int comInt2 = -1 ); - - void SetTableObject( wxGridTableBase *table ) { m_table = table; } - wxGridTableBase * GetTableObject() const { return m_table; } - void SetId( int id ) { m_id = id; } - int GetId() { return m_id; } - void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; } - int GetCommandInt() { return m_comInt1; } - void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; } - int GetCommandInt2() { return m_comInt2; } - -private: - wxGridTableBase *m_table; - int m_id; - int m_comInt1; - int m_comInt2; - - DECLARE_NO_COPY_CLASS(wxGridTableMessage) -}; - - - -// ------ wxGridStringArray -// A 2-dimensional array of strings for data values -// - -WX_DECLARE_OBJARRAY_WITH_DECL(wxArrayString, wxGridStringArray, - class WXDLLIMPEXP_ADV); - - - -// ------ wxGridStringTable -// -// Simplest type of data table for a grid for small tables of strings -// that are stored in memory -// - -class WXDLLIMPEXP_ADV wxGridStringTable : public wxGridTableBase -{ -public: - wxGridStringTable(); - wxGridStringTable( int numRows, int numCols ); - virtual ~wxGridStringTable(); - - // these are pure virtual in wxGridTableBase - // - int GetNumberRows(); - int GetNumberCols(); - wxString GetValue( int row, int col ); - void SetValue( int row, int col, const wxString& s ); - bool IsEmptyCell( int row, int col ); - - // overridden functions from wxGridTableBase - // - void Clear(); - bool InsertRows( size_t pos = 0, size_t numRows = 1 ); - bool AppendRows( size_t numRows = 1 ); - bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); - bool InsertCols( size_t pos = 0, size_t numCols = 1 ); - bool AppendCols( size_t numCols = 1 ); - bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); - - void SetRowLabelValue( int row, const wxString& ); - void SetColLabelValue( int col, const wxString& ); - wxString GetRowLabelValue( int row ); - wxString GetColLabelValue( int col ); - -private: - wxGridStringArray m_data; - - // These only get used if you set your own labels, otherwise the - // GetRow/ColLabelValue functions return wxGridTableBase defaults - // - wxArrayString m_rowLabels; - wxArrayString m_colLabels; - - DECLARE_DYNAMIC_CLASS_NO_COPY( wxGridStringTable ) -}; - - - -// ============================================================================ -// Grid view classes -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxGridCellCoords: location of a cell in the grid -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGridCellCoords -{ -public: - wxGridCellCoords() { m_row = m_col = -1; } - wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; } - - // default copy ctor is ok - - int GetRow() const { return m_row; } - void SetRow( int n ) { m_row = n; } - int GetCol() const { return m_col; } - void SetCol( int n ) { m_col = n; } - void Set( int row, int col ) { m_row = row; m_col = col; } - - wxGridCellCoords& operator=( const wxGridCellCoords& other ) - { - if ( &other != this ) - { - m_row=other.m_row; - m_col=other.m_col; - } - return *this; - } - - bool operator==( const wxGridCellCoords& other ) const - { - return (m_row == other.m_row && m_col == other.m_col); - } - - bool operator!=( const wxGridCellCoords& other ) const - { - return (m_row != other.m_row || m_col != other.m_col); - } - - bool operator!() const - { - return (m_row == -1 && m_col == -1 ); - } - -private: - int m_row; - int m_col; -}; - - -// For comparisons... -// -extern WXDLLIMPEXP_ADV wxGridCellCoords wxGridNoCellCoords; -extern WXDLLIMPEXP_ADV wxRect wxGridNoCellRect; - -// An array of cell coords... -// -WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellCoords, wxGridCellCoordsArray, - class WXDLLIMPEXP_ADV); - -// ---------------------------------------------------------------------------- -// wxGrid -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGrid : public wxScrolledWindow -{ -public: - wxGrid() ; - - wxGrid( wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxWANTS_CHARS, - const wxString& name = wxGridNameStr ); - - bool Create( wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxWANTS_CHARS, - const wxString& name = wxGridNameStr ); - - virtual ~wxGrid(); - - enum wxGridSelectionModes {wxGridSelectCells, - wxGridSelectRows, - wxGridSelectColumns}; - - bool CreateGrid( int numRows, int numCols, - wxGrid::wxGridSelectionModes selmode = - wxGrid::wxGridSelectCells ); - - void SetSelectionMode(wxGrid::wxGridSelectionModes selmode); - wxGrid::wxGridSelectionModes GetSelectionMode() const; - - // ------ grid dimensions - // - int GetNumberRows() { return m_numRows; } - int GetNumberCols() { return m_numCols; } - - - // ------ display update functions - // - wxArrayInt CalcRowLabelsExposed( const wxRegion& reg ); - - wxArrayInt CalcColLabelsExposed( const wxRegion& reg ); - wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg ); - - - // ------ event handlers - // - void ProcessRowLabelMouseEvent( wxMouseEvent& event ); - void ProcessColLabelMouseEvent( wxMouseEvent& event ); - void ProcessCornerLabelMouseEvent( wxMouseEvent& event ); - void ProcessGridCellMouseEvent( wxMouseEvent& event ); - bool ProcessTableMessage( wxGridTableMessage& ); - - void DoEndDragResizeRow(); - void DoEndDragResizeCol(); - void DoEndDragMoveCol(); - - wxGridTableBase * GetTable() const { return m_table; } - bool SetTable( wxGridTableBase *table, bool takeOwnership = false, - wxGrid::wxGridSelectionModes selmode = - wxGrid::wxGridSelectCells ); - - void ClearGrid(); - bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels = true ); - bool AppendRows( int numRows = 1, bool updateLabels = true ); - bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels = true ); - bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels = true ); - bool AppendCols( int numCols = 1, bool updateLabels = true ); - bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels = true ); - - void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells ); - void DrawGridSpace( wxDC& dc ); - void DrawCellBorder( wxDC& dc, const wxGridCellCoords& ); - void DrawAllGridLines( wxDC& dc, const wxRegion & reg ); - void DrawCell( wxDC& dc, const wxGridCellCoords& ); - void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells); - - // this function is called when the current cell highlight must be redrawn - // and may be overridden by the user - virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ); - - virtual void DrawRowLabels( wxDC& dc, const wxArrayInt& rows ); - virtual void DrawRowLabel( wxDC& dc, int row ); - - virtual void DrawColLabels( wxDC& dc, const wxArrayInt& cols ); - virtual void DrawColLabel( wxDC& dc, int col ); - - - // ------ Cell text drawing functions - // - void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&, - int horizontalAlignment = wxALIGN_LEFT, - int verticalAlignment = wxALIGN_TOP, - int textOrientation = wxHORIZONTAL ); - - void DrawTextRectangle( wxDC& dc, const wxArrayString& lines, const wxRect&, - int horizontalAlignment = wxALIGN_LEFT, - int verticalAlignment = wxALIGN_TOP, - int textOrientation = wxHORIZONTAL ); - - - // Split a string containing newline chararcters into an array of - // strings and return the number of lines - // - void StringToLines( const wxString& value, wxArrayString& lines ); - - void GetTextBoxSize( const wxDC& dc, - const wxArrayString& lines, - long *width, long *height ); - - - // ------ - // Code that does a lot of grid modification can be enclosed - // between BeginBatch() and EndBatch() calls to avoid screen - // flicker - // - void BeginBatch() { m_batchCount++; } - void EndBatch(); - - int GetBatchCount() { return m_batchCount; } - - virtual void Refresh(bool eraseb = true, - const wxRect* rect = (const wxRect *) NULL); - - // Use this, rather than wxWindow::Refresh(), to force an - // immediate repainting of the grid. Has no effect if you are - // already inside a BeginBatch / EndBatch block. - // - // This function is necessary because wxGrid has a minimal OnPaint() - // handler to reduce screen flicker. - // - void ForceRefresh(); - - - // ------ edit control functions - // - bool IsEditable() const { return m_editable; } - void EnableEditing( bool edit ); - - void EnableCellEditControl( bool enable = true ); - void DisableCellEditControl() { EnableCellEditControl(false); } - bool CanEnableCellControl() const; - bool IsCellEditControlEnabled() const; - bool IsCellEditControlShown() const; - - bool IsCurrentCellReadOnly() const; - - void ShowCellEditControl(); - void HideCellEditControl(); - void SaveEditControlValue(); - - - // ------ grid location functions - // Note that all of these functions work with the logical coordinates of - // grid cells and labels so you will need to convert from device - // coordinates for mouse events etc. - // - void XYToCell( int x, int y, wxGridCellCoords& ); - int YToRow( int y ); - int XToCol( int x, bool clipToMinMax = false ); - - int YToEdgeOfRow( int y ); - int XToEdgeOfCol( int x ); - - wxRect CellToRect( int row, int col ); - wxRect CellToRect( const wxGridCellCoords& coords ) - { return CellToRect( coords.GetRow(), coords.GetCol() ); } - - int GetGridCursorRow() { return m_currentCellCoords.GetRow(); } - int GetGridCursorCol() { return m_currentCellCoords.GetCol(); } - - // check to see if a cell is either wholly visible (the default arg) or - // at least partially visible in the grid window - // - bool IsVisible( int row, int col, bool wholeCellVisible = true ); - bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true ) - { return IsVisible( coords.GetRow(), coords.GetCol(), wholeCellVisible ); } - void MakeCellVisible( int row, int col ); - void MakeCellVisible( const wxGridCellCoords& coords ) - { MakeCellVisible( coords.GetRow(), coords.GetCol() ); } - - - // ------ grid cursor movement functions - // - void SetGridCursor( int row, int col ) - { SetCurrentCell( wxGridCellCoords(row, col) ); } - - bool MoveCursorUp( bool expandSelection ); - bool MoveCursorDown( bool expandSelection ); - bool MoveCursorLeft( bool expandSelection ); - bool MoveCursorRight( bool expandSelection ); - bool MovePageDown(); - bool MovePageUp(); - bool MoveCursorUpBlock( bool expandSelection ); - bool MoveCursorDownBlock( bool expandSelection ); - bool MoveCursorLeftBlock( bool expandSelection ); - bool MoveCursorRightBlock( bool expandSelection ); - - - // ------ label and gridline formatting - // - int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH; } - int GetRowLabelSize() { return m_rowLabelWidth; } - int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT; } - int GetColLabelSize() { return m_colLabelHeight; } - wxColour GetLabelBackgroundColour() { return m_labelBackgroundColour; } - wxColour GetLabelTextColour() { return m_labelTextColour; } - wxFont GetLabelFont() { return m_labelFont; } - void GetRowLabelAlignment( int *horiz, int *vert ); - void GetColLabelAlignment( int *horiz, int *vert ); - int GetColLabelTextOrientation(); - wxString GetRowLabelValue( int row ); - wxString GetColLabelValue( int col ); - wxColour GetGridLineColour() { return m_gridLineColour; } - - // these methods may be overridden to customize individual grid lines - // appearance - virtual wxPen GetDefaultGridLinePen(); - virtual wxPen GetRowGridLinePen(int row); - virtual wxPen GetColGridLinePen(int col); - wxColour GetCellHighlightColour() { return m_cellHighlightColour; } - int GetCellHighlightPenWidth() { return m_cellHighlightPenWidth; } - int GetCellHighlightROPenWidth() { return m_cellHighlightROPenWidth; } - - void SetRowLabelSize( int width ); - void SetColLabelSize( int height ); - void SetLabelBackgroundColour( const wxColour& ); - void SetLabelTextColour( const wxColour& ); - void SetLabelFont( const wxFont& ); - void SetRowLabelAlignment( int horiz, int vert ); - void SetColLabelAlignment( int horiz, int vert ); - void SetColLabelTextOrientation( int textOrientation ); - void SetRowLabelValue( int row, const wxString& ); - void SetColLabelValue( int col, const wxString& ); - void SetGridLineColour( const wxColour& ); - void SetCellHighlightColour( const wxColour& ); - void SetCellHighlightPenWidth(int width); - void SetCellHighlightROPenWidth(int width); - - void EnableDragRowSize( bool enable = true ); - void DisableDragRowSize() { EnableDragRowSize( false ); } - bool CanDragRowSize() { return m_canDragRowSize; } - void EnableDragColSize( bool enable = true ); - void DisableDragColSize() { EnableDragColSize( false ); } - bool CanDragColSize() { return m_canDragColSize; } - void EnableDragColMove( bool enable = true ); - void DisableDragColMove() { EnableDragColMove( false ); } - bool CanDragColMove() { return m_canDragColMove; } - void EnableDragGridSize(bool enable = true); - void DisableDragGridSize() { EnableDragGridSize(false); } - bool CanDragGridSize() { return m_canDragGridSize; } - - void EnableDragCell( bool enable = true ); - void DisableDragCell() { EnableDragCell( false ); } - bool CanDragCell() { return m_canDragCell; } - - // this sets the specified attribute for this cell or in this row/col - void SetAttr(int row, int col, wxGridCellAttr *attr); - void SetRowAttr(int row, wxGridCellAttr *attr); - void SetColAttr(int col, wxGridCellAttr *attr); - - // returns the attribute we may modify in place: a new one if this cell - // doesn't have any yet or the existing one if it does - // - // DecRef() must be called on the returned pointer, as usual - wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; - - - // shortcuts for setting the column parameters - - // set the format for the data in the column: default is string - void SetColFormatBool(int col); - void SetColFormatNumber(int col); - void SetColFormatFloat(int col, int width = -1, int precision = -1); - void SetColFormatCustom(int col, const wxString& typeName); - - void EnableGridLines( bool enable = true ); - bool GridLinesEnabled() { return m_gridLinesEnabled; } - - // ------ row and col formatting - // - int GetDefaultRowSize(); - int GetRowSize( int row ); - int GetDefaultColSize(); - int GetColSize( int col ); - wxColour GetDefaultCellBackgroundColour(); - wxColour GetCellBackgroundColour( int row, int col ); - wxColour GetDefaultCellTextColour(); - wxColour GetCellTextColour( int row, int col ); - wxFont GetDefaultCellFont(); - wxFont GetCellFont( int row, int col ); - void GetDefaultCellAlignment( int *horiz, int *vert ); - void GetCellAlignment( int row, int col, int *horiz, int *vert ); - bool GetDefaultCellOverflow(); - bool GetCellOverflow( int row, int col ); - void GetCellSize( int row, int col, int *num_rows, int *num_cols ); - - void SetDefaultRowSize( int height, bool resizeExistingRows = false ); - void SetRowSize( int row, int height ); - void SetDefaultColSize( int width, bool resizeExistingCols = false ); - - void SetColSize( int col, int width ); - - //Column positions - int GetColAt( int colPos ) const - { - if ( m_colAt.IsEmpty() ) - return colPos; - else - return m_colAt[colPos]; - } - - void SetColPos( int colID, int newPos ); - - int GetColPos( int colID ) const - { - if ( m_colAt.IsEmpty() ) - return colID; - else - { - for ( int i = 0; i < m_numCols; i++ ) - { - if ( m_colAt[i] == colID ) - return i; - } - } - - return -1; - } - - // automatically size the column or row to fit to its contents, if - // setAsMin is true, this optimal width will also be set as minimal width - // for this column - void AutoSizeColumn( int col, bool setAsMin = true ) - { AutoSizeColOrRow(col, setAsMin, true); } - void AutoSizeRow( int row, bool setAsMin = true ) - { AutoSizeColOrRow(row, setAsMin, false); } - - // auto size all columns (very ineffective for big grids!) - void AutoSizeColumns( bool setAsMin = true ) - { (void)SetOrCalcColumnSizes(false, setAsMin); } - - void AutoSizeRows( bool setAsMin = true ) - { (void)SetOrCalcRowSizes(false, setAsMin); } - - // auto size the grid, that is make the columns/rows of the "right" size - // and also set the grid size to just fit its contents - void AutoSize(); - - // autosize row height depending on label text - void AutoSizeRowLabelSize( int row ); - - // autosize column width depending on label text - void AutoSizeColLabelSize( int col ); - - // column won't be resized to be lesser width - this must be called during - // the grid creation because it won't resize the column if it's already - // narrower than the minimal width - void SetColMinimalWidth( int col, int width ); - void SetRowMinimalHeight( int row, int width ); - - /* These members can be used to query and modify the minimal - * acceptable size of grid rows and columns. Call this function in - * your code which creates the grid if you want to display cells - * with a size smaller than the default acceptable minimum size. - * Like the members SetColMinimalWidth and SetRowMinimalWidth, - * the existing rows or columns will not be checked/resized. - */ - void SetColMinimalAcceptableWidth( int width ); - void SetRowMinimalAcceptableHeight( int width ); - int GetColMinimalAcceptableWidth() const; - int GetRowMinimalAcceptableHeight() const; - - void SetDefaultCellBackgroundColour( const wxColour& ); - void SetCellBackgroundColour( int row, int col, const wxColour& ); - void SetDefaultCellTextColour( const wxColour& ); - - void SetCellTextColour( int row, int col, const wxColour& ); - void SetDefaultCellFont( const wxFont& ); - void SetCellFont( int row, int col, const wxFont& ); - void SetDefaultCellAlignment( int horiz, int vert ); - void SetCellAlignment( int row, int col, int horiz, int vert ); - void SetDefaultCellOverflow( bool allow ); - void SetCellOverflow( int row, int col, bool allow ); - void SetCellSize( int row, int col, int num_rows, int num_cols ); - - // takes ownership of the pointer - void SetDefaultRenderer(wxGridCellRenderer *renderer); - void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer); - wxGridCellRenderer *GetDefaultRenderer() const; - wxGridCellRenderer* GetCellRenderer(int row, int col); - - // takes ownership of the pointer - void SetDefaultEditor(wxGridCellEditor *editor); - void SetCellEditor(int row, int col, wxGridCellEditor *editor); - wxGridCellEditor *GetDefaultEditor() const; - wxGridCellEditor* GetCellEditor(int row, int col); - - - - // ------ cell value accessors - // - wxString GetCellValue( int row, int col ) - { - if ( m_table ) - { - return m_table->GetValue( row, col ); - } - else - { - return wxEmptyString; - } - } - - wxString GetCellValue( const wxGridCellCoords& coords ) - { return GetCellValue( coords.GetRow(), coords.GetCol() ); } - - void SetCellValue( int row, int col, const wxString& s ); - void SetCellValue( const wxGridCellCoords& coords, const wxString& s ) - { SetCellValue( coords.GetRow(), coords.GetCol(), s ); } - - // returns true if the cell can't be edited - bool IsReadOnly(int row, int col) const; - - // make the cell editable/readonly - void SetReadOnly(int row, int col, bool isReadOnly = true); - - // ------ select blocks of cells - // - void SelectRow( int row, bool addToSelected = false ); - void SelectCol( int col, bool addToSelected = false ); - - void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol, - bool addToSelected = false ); - - void SelectBlock( const wxGridCellCoords& topLeft, - const wxGridCellCoords& bottomRight, - bool addToSelected = false ) - { SelectBlock( topLeft.GetRow(), topLeft.GetCol(), - bottomRight.GetRow(), bottomRight.GetCol(), - addToSelected ); } - - void SelectAll(); - - bool IsSelection(); - - // ------ deselect blocks or cells - // - void DeselectRow( int row ); - void DeselectCol( int col ); - void DeselectCell( int row, int col ); - - void ClearSelection(); - - bool IsInSelection( int row, int col ) const; - - bool IsInSelection( const wxGridCellCoords& coords ) const - { return IsInSelection( coords.GetRow(), coords.GetCol() ); } - - wxGridCellCoordsArray GetSelectedCells() const; - wxGridCellCoordsArray GetSelectionBlockTopLeft() const; - wxGridCellCoordsArray GetSelectionBlockBottomRight() const; - wxArrayInt GetSelectedRows() const; - wxArrayInt GetSelectedCols() const; - - // This function returns the rectangle that encloses the block of cells - // limited by TopLeft and BottomRight cell in device coords and clipped - // to the client size of the grid window. - // - wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, - const wxGridCellCoords & bottomRight ); - - // Access or update the selection fore/back colours - wxColour GetSelectionBackground() const - { return m_selectionBackground; } - wxColour GetSelectionForeground() const - { return m_selectionForeground; } - - void SetSelectionBackground(const wxColour& c) { m_selectionBackground = c; } - void SetSelectionForeground(const wxColour& c) { m_selectionForeground = c; } - - - // Methods for a registry for mapping data types to Renderers/Editors - void RegisterDataType(const wxString& typeName, - wxGridCellRenderer* renderer, - wxGridCellEditor* editor); - // DJC MAPTEK - virtual wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; - wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const - { return GetDefaultEditorForCell(c.GetRow(), c.GetCol()); } - virtual wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; - virtual wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; - virtual wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; - - // grid may occupy more space than needed for its rows/columns, this - // function allows to set how big this extra space is - void SetMargins(int extraWidth, int extraHeight) - { - m_extraWidth = extraWidth; - m_extraHeight = extraHeight; - - CalcDimensions(); - } - - // Accessors for component windows - wxWindow* GetGridWindow() { return (wxWindow*)m_gridWin; } - wxWindow* GetGridRowLabelWindow() { return (wxWindow*)m_rowLabelWin; } - wxWindow* GetGridColLabelWindow() { return (wxWindow*)m_colLabelWin; } - wxWindow* GetGridCornerLabelWindow() { return (wxWindow*)m_cornerLabelWin; } - - // Allow adjustment of scroll increment. The default is (15, 15). - void SetScrollLineX(int x) { m_scrollLineX = x; } - void SetScrollLineY(int y) { m_scrollLineY = y; } - int GetScrollLineX() const { return m_scrollLineX; } - int GetScrollLineY() const { return m_scrollLineY; } - - // Implementation - int GetScrollX(int x) const - { - return (x + GetScrollLineX() - 1) / GetScrollLineX(); - } - - int GetScrollY(int y) const - { - return (y + GetScrollLineY() - 1) / GetScrollLineY(); - } - - - // override some base class functions - virtual bool Enable(bool enable = true); - - - // ------ For compatibility with previous wxGrid only... - // - // ************************************************ - // ** Don't use these in new code because they ** - // ** are liable to disappear in a future ** - // ** revision ** - // ************************************************ - // - - wxGrid( wxWindow *parent, - int x, int y, int w = wxDefaultCoord, int h = wxDefaultCoord, - long style = wxWANTS_CHARS, - const wxString& name = wxPanelNameStr ) - : wxScrolledWindow( parent, wxID_ANY, wxPoint(x,y), wxSize(w,h), - (style|wxWANTS_CHARS), name ) - { - Create(); - } - - void SetCellValue( const wxString& val, int row, int col ) - { SetCellValue( row, col, val ); } - - void UpdateDimensions() - { CalcDimensions(); } - - int GetRows() { return GetNumberRows(); } - int GetCols() { return GetNumberCols(); } - int GetCursorRow() { return GetGridCursorRow(); } - int GetCursorColumn() { return GetGridCursorCol(); } - - int GetScrollPosX() { return 0; } - int GetScrollPosY() { return 0; } - - void SetScrollX( int WXUNUSED(x) ) { } - void SetScrollY( int WXUNUSED(y) ) { } - - void SetColumnWidth( int col, int width ) - { SetColSize( col, width ); } - - int GetColumnWidth( int col ) - { return GetColSize( col ); } - - void SetRowHeight( int row, int height ) - { SetRowSize( row, height ); } - - // GetRowHeight() is below - - int GetViewHeight() // returned num whole rows visible - { return 0; } - - int GetViewWidth() // returned num whole cols visible - { return 0; } - - void SetLabelSize( int orientation, int sz ) - { - if ( orientation == wxHORIZONTAL ) - SetColLabelSize( sz ); - else - SetRowLabelSize( sz ); - } - - int GetLabelSize( int orientation ) - { - if ( orientation == wxHORIZONTAL ) - return GetColLabelSize(); - else - return GetRowLabelSize(); - } - - void SetLabelAlignment( int orientation, int align ) - { - if ( orientation == wxHORIZONTAL ) - SetColLabelAlignment( align, -1 ); - else - SetRowLabelAlignment( align, -1 ); - } - - int GetLabelAlignment( int orientation, int WXUNUSED(align) ) - { - int h, v; - if ( orientation == wxHORIZONTAL ) - { - GetColLabelAlignment( &h, &v ); - return h; - } - else - { - GetRowLabelAlignment( &h, &v ); - return h; - } - } - - void SetLabelValue( int orientation, const wxString& val, int pos ) - { - if ( orientation == wxHORIZONTAL ) - SetColLabelValue( pos, val ); - else - SetRowLabelValue( pos, val ); - } - - wxString GetLabelValue( int orientation, int pos) - { - if ( orientation == wxHORIZONTAL ) - return GetColLabelValue( pos ); - else - return GetRowLabelValue( pos ); - } - - wxFont GetCellTextFont() const - { return m_defaultCellAttr->GetFont(); } - - wxFont GetCellTextFont(int WXUNUSED(row), int WXUNUSED(col)) const - { return m_defaultCellAttr->GetFont(); } - - void SetCellTextFont(const wxFont& fnt) - { SetDefaultCellFont( fnt ); } - - void SetCellTextFont(const wxFont& fnt, int row, int col) - { SetCellFont( row, col, fnt ); } - - void SetCellTextColour(const wxColour& val, int row, int col) - { SetCellTextColour( row, col, val ); } - - void SetCellTextColour(const wxColour& col) - { SetDefaultCellTextColour( col ); } - - void SetCellBackgroundColour(const wxColour& col) - { SetDefaultCellBackgroundColour( col ); } - - void SetCellBackgroundColour(const wxColour& colour, int row, int col) - { SetCellBackgroundColour( row, col, colour ); } - - bool GetEditable() { return IsEditable(); } - void SetEditable( bool edit = true ) { EnableEditing( edit ); } - bool GetEditInPlace() { return IsCellEditControlEnabled(); } - - void SetEditInPlace(bool WXUNUSED(edit) = true) { } - - void SetCellAlignment( int align, int row, int col) - { SetCellAlignment(row, col, align, wxALIGN_CENTER); } - void SetCellAlignment( int WXUNUSED(align) ) {} - void SetCellBitmap(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(row), int WXUNUSED(col)) - { } - void SetDividerPen(const wxPen& WXUNUSED(pen)) { } - wxPen& GetDividerPen() const; - void OnActivate(bool WXUNUSED(active)) {} - - // ******** End of compatibility functions ********** - - - - // ------ control IDs - enum { wxGRID_CELLCTRL = 2000, - wxGRID_TOPCTRL }; - - // ------ control types - enum { wxGRID_TEXTCTRL = 2100, - wxGRID_CHECKBOX, - wxGRID_CHOICE, - wxGRID_COMBOBOX }; - - // overridden wxWindow methods - virtual void Fit(); - -protected: - virtual wxSize DoGetBestSize() const; - - bool m_created; - - wxGridWindow *m_gridWin; - wxGridRowLabelWindow *m_rowLabelWin; - wxGridColLabelWindow *m_colLabelWin; - wxGridCornerLabelWindow *m_cornerLabelWin; - - wxGridTableBase *m_table; - bool m_ownTable; - - int m_numRows; - int m_numCols; - - wxGridCellCoords m_currentCellCoords; - - wxGridCellCoords m_selectingTopLeft; - wxGridCellCoords m_selectingBottomRight; - wxGridCellCoords m_selectingKeyboard; - wxGridSelection *m_selection; - wxColour m_selectionBackground; - wxColour m_selectionForeground; - - // NB: *never* access m_row/col arrays directly because they are created - // on demand, *always* use accessor functions instead! - - // init the m_rowHeights/Bottoms arrays with default values - void InitRowHeights(); - - int m_defaultRowHeight; - int m_minAcceptableRowHeight; - wxArrayInt m_rowHeights; - wxArrayInt m_rowBottoms; - - // init the m_colWidths/Rights arrays - void InitColWidths(); - - int m_defaultColWidth; - int m_minAcceptableColWidth; - wxArrayInt m_colWidths; - wxArrayInt m_colRights; - - // get the col/row coords - int GetColWidth(int col) const; - int GetColLeft(int col) const; - int GetColRight(int col) const; - - // this function must be public for compatibility... -public: - int GetRowHeight(int row) const; -protected: - - int GetRowTop(int row) const; - int GetRowBottom(int row) const; - - int m_rowLabelWidth; - int m_colLabelHeight; - - // the size of the margin left to the right and bottom of the cell area - int m_extraWidth, - m_extraHeight; - - wxColour m_labelBackgroundColour; - wxColour m_labelTextColour; - wxFont m_labelFont; - - int m_rowLabelHorizAlign; - int m_rowLabelVertAlign; - int m_colLabelHorizAlign; - int m_colLabelVertAlign; - int m_colLabelTextOrientation; - - bool m_defaultRowLabelValues; - bool m_defaultColLabelValues; - - wxColour m_gridLineColour; - bool m_gridLinesEnabled; - wxColour m_cellHighlightColour; - int m_cellHighlightPenWidth; - int m_cellHighlightROPenWidth; - - - // common part of AutoSizeColumn/Row() and GetBestSize() - int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = true); - int SetOrCalcRowSizes(bool calcOnly, bool setAsMin = true); - - // common part of AutoSizeColumn/Row() - void AutoSizeColOrRow(int n, bool setAsMin, bool column /* or row? */); - - // if a column has a minimal width, it will be the value for it in this - // hash table - wxLongToLongHashMap m_colMinWidths, - m_rowMinHeights; - - // get the minimal width of the given column/row - int GetColMinimalWidth(int col) const; - int GetRowMinimalHeight(int col) const; - - // do we have some place to store attributes in? - bool CanHaveAttributes(); - - // cell attribute cache (currently we only cache 1, may be will do - // more/better later) - struct CachedAttr - { - int row, col; - wxGridCellAttr *attr; - } m_attrCache; - - // invalidates the attribute cache - void ClearAttrCache(); - - // adds an attribute to cache - void CacheAttr(int row, int col, wxGridCellAttr *attr) const; - - // looks for an attr in cache, returns true if found - bool LookupAttr(int row, int col, wxGridCellAttr **attr) const; - - // looks for the attr in cache, if not found asks the table and caches the - // result - wxGridCellAttr *GetCellAttr(int row, int col) const; - wxGridCellAttr *GetCellAttr(const wxGridCellCoords& coords ) - { return GetCellAttr( coords.GetRow(), coords.GetCol() ); } - - // the default cell attr object for cells that don't have their own - wxGridCellAttr* m_defaultCellAttr; - - - bool m_inOnKeyDown; - int m_batchCount; - - - wxGridTypeRegistry* m_typeRegistry; - - enum CursorMode - { - WXGRID_CURSOR_SELECT_CELL, - WXGRID_CURSOR_RESIZE_ROW, - WXGRID_CURSOR_RESIZE_COL, - WXGRID_CURSOR_SELECT_ROW, - WXGRID_CURSOR_SELECT_COL, - WXGRID_CURSOR_MOVE_COL - }; - - // this method not only sets m_cursorMode but also sets the correct cursor - // for the given mode and, if captureMouse is not false releases the mouse - // if it was captured and captures it if it must be captured - // - // for this to work, you should always use it and not set m_cursorMode - // directly! - void ChangeCursorMode(CursorMode mode, - wxWindow *win = (wxWindow *)NULL, - bool captureMouse = true); - - wxWindow *m_winCapture; // the window which captured the mouse - CursorMode m_cursorMode; - - //Column positions - wxArrayInt m_colAt; - int m_moveToCol; - - bool m_canDragRowSize; - bool m_canDragColSize; - bool m_canDragColMove; - bool m_canDragGridSize; - bool m_canDragCell; - int m_dragLastPos; - int m_dragRowOrCol; - bool m_isDragging; - wxPoint m_startDragPos; - - bool m_waitForSlowClick; - - wxGridCellCoords m_selectionStart; - - wxCursor m_rowResizeCursor; - wxCursor m_colResizeCursor; - - bool m_editable; // applies to whole grid - bool m_cellEditCtrlEnabled; // is in-place edit currently shown? - - int m_scrollLineX; // X scroll increment - int m_scrollLineY; // Y scroll increment - - void Create(); - void Init(); - void CalcDimensions(); - void CalcWindowSizes(); - bool Redimension( wxGridTableMessage& ); - - - int SendEvent( const wxEventType, int row, int col, wxMouseEvent& ); - int SendEvent( const wxEventType, int row, int col ); - int SendEvent( const wxEventType type) - { - return SendEvent(type, - m_currentCellCoords.GetRow(), - m_currentCellCoords.GetCol()); - } - - void OnPaint( wxPaintEvent& ); - void OnSize( wxSizeEvent& ); - void OnKeyDown( wxKeyEvent& ); - void OnKeyUp( wxKeyEvent& ); - void OnChar( wxKeyEvent& ); - void OnEraseBackground( wxEraseEvent& ); - - - void SetCurrentCell( const wxGridCellCoords& coords ); - void SetCurrentCell( int row, int col ) - { SetCurrentCell( wxGridCellCoords(row, col) ); } - - void HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCol ); - - void HighlightBlock( const wxGridCellCoords& topLeft, - const wxGridCellCoords& bottomRight ) - { HighlightBlock( topLeft.GetRow(), topLeft.GetCol(), - bottomRight.GetRow(), bottomRight.GetCol() ); } - - // ------ functions to get/send data (see also public functions) - // - bool GetModelValues(); - bool SetModelValues(); - -private: - // Calculate the minimum acceptable size for labels area - wxCoord CalcColOrRowLabelAreaMinSize(bool column /* or row? */); - - friend class WXDLLIMPEXP_FWD_ADV wxGridSelection; - - DECLARE_DYNAMIC_CLASS( wxGrid ) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxGrid) -}; - - -// ---------------------------------------------------------------------------- -// Grid event class and event types -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxGridEvent : public wxNotifyEvent -{ -public: - wxGridEvent() - : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1), - m_selecting(0), m_control(0), m_meta(0), m_shift(0), m_alt(0) - { - } - - wxGridEvent(int id, wxEventType type, wxObject* obj, - int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true, - bool control = false, bool shift = false, bool alt = false, bool meta = false); - - virtual int GetRow() { return m_row; } - virtual int GetCol() { return m_col; } - wxPoint GetPosition() { return wxPoint( m_x, m_y ); } - bool Selecting() { return m_selecting; } - bool ControlDown() { return m_control; } - bool MetaDown() { return m_meta; } - bool ShiftDown() { return m_shift; } - bool AltDown() { return m_alt; } - bool CmdDown() - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - virtual wxEvent *Clone() const { return new wxGridEvent(*this); } - -protected: - int m_row; - int m_col; - int m_x; - int m_y; - bool m_selecting; - bool m_control; - bool m_meta; - bool m_shift; - bool m_alt; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEvent) -}; - -class WXDLLIMPEXP_ADV wxGridSizeEvent : public wxNotifyEvent -{ -public: - wxGridSizeEvent() - : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1), - m_control(0), m_meta(0), m_shift(0), m_alt(0) - { - } - - wxGridSizeEvent(int id, wxEventType type, wxObject* obj, - int rowOrCol=-1, int x=-1, int y=-1, - bool control = false, bool shift = false, bool alt = false, bool meta = false); - - int GetRowOrCol() { return m_rowOrCol; } - wxPoint GetPosition() { return wxPoint( m_x, m_y ); } - bool ControlDown() { return m_control; } - bool MetaDown() { return m_meta; } - bool ShiftDown() { return m_shift; } - bool AltDown() { return m_alt; } - bool CmdDown() - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - virtual wxEvent *Clone() const { return new wxGridSizeEvent(*this); } - -protected: - int m_rowOrCol; - int m_x; - int m_y; - bool m_control; - bool m_meta; - bool m_shift; - bool m_alt; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridSizeEvent) -}; - - -class WXDLLIMPEXP_ADV wxGridRangeSelectEvent : public wxNotifyEvent -{ -public: - wxGridRangeSelectEvent() - : wxNotifyEvent() - { - m_topLeft = wxGridNoCellCoords; - m_bottomRight = wxGridNoCellCoords; - m_selecting = false; - m_control = false; - m_meta = false; - m_shift = false; - m_alt = false; - } - - wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj, - const wxGridCellCoords& topLeft, - const wxGridCellCoords& bottomRight, - bool sel = true, - bool control = false, bool shift = false, - bool alt = false, bool meta = false); - - wxGridCellCoords GetTopLeftCoords() { return m_topLeft; } - wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; } - int GetTopRow() { return m_topLeft.GetRow(); } - int GetBottomRow() { return m_bottomRight.GetRow(); } - int GetLeftCol() { return m_topLeft.GetCol(); } - int GetRightCol() { return m_bottomRight.GetCol(); } - bool Selecting() { return m_selecting; } - bool ControlDown() { return m_control; } - bool MetaDown() { return m_meta; } - bool ShiftDown() { return m_shift; } - bool AltDown() { return m_alt; } - bool CmdDown() - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - virtual wxEvent *Clone() const { return new wxGridRangeSelectEvent(*this); } - -protected: - wxGridCellCoords m_topLeft; - wxGridCellCoords m_bottomRight; - bool m_selecting; - bool m_control; - bool m_meta; - bool m_shift; - bool m_alt; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridRangeSelectEvent) -}; - - -class WXDLLIMPEXP_ADV wxGridEditorCreatedEvent : public wxCommandEvent { -public: - wxGridEditorCreatedEvent() - : wxCommandEvent() - { - m_row = 0; - m_col = 0; - m_ctrl = NULL; - } - - wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, - int row, int col, wxControl* ctrl); - - int GetRow() { return m_row; } - int GetCol() { return m_col; } - wxControl* GetControl() { return m_ctrl; } - void SetRow(int row) { m_row = row; } - void SetCol(int col) { m_col = col; } - void SetControl(wxControl* ctrl) { m_ctrl = ctrl; } - - virtual wxEvent *Clone() const { return new wxGridEditorCreatedEvent(*this); } - -private: - int m_row; - int m_col; - wxControl* m_ctrl; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEditorCreatedEvent) -}; - - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_CLICK, 1580) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_CLICK, 1581) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_DCLICK, 1582) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_DCLICK, 1583) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_CLICK, 1584) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_CLICK, 1585) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_DCLICK, 1586) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_DCLICK, 1587) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_ROW_SIZE, 1588) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_COL_SIZE, 1589) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_RANGE_SELECT, 1590) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_CHANGE, 1591) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_SELECT_CELL, 1592) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_SHOWN, 1593) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_HIDDEN, 1594) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_CREATED, 1595) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_BEGIN_DRAG, 1596) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_COL_MOVE, 1597) -END_DECLARE_EVENT_TYPES() - - -typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&); -typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&); -typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&); -typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&); - -#define wxGridEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridEventFunction, &func) - -#define wxGridSizeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridSizeEventFunction, &func) - -#define wxGridRangeSelectEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridRangeSelectEventFunction, &func) - -#define wxGridEditorCreatedEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridEditorCreatedEventFunction, &func) - -#define wx__DECLARE_GRIDEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEventHandler(fn)) - -#define wx__DECLARE_GRIDSIZEEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridSizeEventHandler(fn)) - -#define wx__DECLARE_GRIDRANGESELEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridRangeSelectEventHandler(fn)) - -#define wx__DECLARE_GRIDEDITOREVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEditorCreatedEventHandler(fn)) - -#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_CLICK, id, fn) -#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_CLICK, id, fn) -#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_DCLICK, id, fn) -#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_DCLICK, id, fn) -#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_CLICK, id, fn) -#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_CLICK, id, fn) -#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_DCLICK, id, fn) -#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_DCLICK, id, fn) -#define EVT_GRID_CMD_ROW_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(ROW_SIZE, id, fn) -#define EVT_GRID_CMD_COL_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_SIZE, id, fn) -#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_MOVE, id, fn) -#define EVT_GRID_CMD_RANGE_SELECT(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECT, id, fn) -#define EVT_GRID_CMD_CELL_CHANGE(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGE, id, fn) -#define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn) -#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_SHOWN, id, fn) -#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_HIDDEN, id, fn) -#define EVT_GRID_CMD_EDITOR_CREATED(id, fn) wx__DECLARE_GRIDEDITOREVT(EDITOR_CREATED, id, fn) -#define EVT_GRID_CMD_CELL_BEGIN_DRAG(id, fn) wx__DECLARE_GRIDEVT(CELL_BEGIN_DRAG, id, fn) - -// same as above but for any id (exists mainly for backwards compatibility but -// then it's also true that you rarely have multiple grid in the same window) -#define EVT_GRID_CELL_LEFT_CLICK(fn) EVT_GRID_CMD_CELL_LEFT_CLICK(wxID_ANY, fn) -#define EVT_GRID_CELL_RIGHT_CLICK(fn) EVT_GRID_CMD_CELL_RIGHT_CLICK(wxID_ANY, fn) -#define EVT_GRID_CELL_LEFT_DCLICK(fn) EVT_GRID_CMD_CELL_LEFT_DCLICK(wxID_ANY, fn) -#define EVT_GRID_CELL_RIGHT_DCLICK(fn) EVT_GRID_CMD_CELL_RIGHT_DCLICK(wxID_ANY, fn) -#define EVT_GRID_LABEL_LEFT_CLICK(fn) EVT_GRID_CMD_LABEL_LEFT_CLICK(wxID_ANY, fn) -#define EVT_GRID_LABEL_RIGHT_CLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_CLICK(wxID_ANY, fn) -#define EVT_GRID_LABEL_LEFT_DCLICK(fn) EVT_GRID_CMD_LABEL_LEFT_DCLICK(wxID_ANY, fn) -#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_DCLICK(wxID_ANY, fn) -#define EVT_GRID_ROW_SIZE(fn) EVT_GRID_CMD_ROW_SIZE(wxID_ANY, fn) -#define EVT_GRID_COL_SIZE(fn) EVT_GRID_CMD_COL_SIZE(wxID_ANY, fn) -#define EVT_GRID_COL_MOVE(fn) EVT_GRID_CMD_COL_MOVE(wxID_ANY, fn) -#define EVT_GRID_RANGE_SELECT(fn) EVT_GRID_CMD_RANGE_SELECT(wxID_ANY, fn) -#define EVT_GRID_CELL_CHANGE(fn) EVT_GRID_CMD_CELL_CHANGE(wxID_ANY, fn) -#define EVT_GRID_SELECT_CELL(fn) EVT_GRID_CMD_SELECT_CELL(wxID_ANY, fn) -#define EVT_GRID_EDITOR_SHOWN(fn) EVT_GRID_CMD_EDITOR_SHOWN(wxID_ANY, fn) -#define EVT_GRID_EDITOR_HIDDEN(fn) EVT_GRID_CMD_EDITOR_HIDDEN(wxID_ANY, fn) -#define EVT_GRID_EDITOR_CREATED(fn) EVT_GRID_CMD_EDITOR_CREATED(wxID_ANY, fn) -#define EVT_GRID_CELL_BEGIN_DRAG(fn) EVT_GRID_CMD_CELL_BEGIN_DRAG(wxID_ANY, fn) - -#if 0 // TODO: implement these ? others ? - -extern const int wxEVT_GRID_CREATE_CELL; -extern const int wxEVT_GRID_CHANGE_LABELS; -extern const int wxEVT_GRID_CHANGE_SEL_LABEL; - -#define EVT_GRID_CREATE_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), -#define EVT_GRID_CHANGE_LABELS(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), -#define EVT_GRID_CHANGE_SEL_LABEL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), - -#endif - -#endif // wxUSE_GRID -#endif // _WX_GENERIC_GRID_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/grid.h +// Purpose: wxGrid and related classes +// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) +// Modified by: Santiago Palacios +// Created: 1/08/1999 +// RCS-ID: $Id: grid.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Michael Bedward +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRID_H_ +#define _WX_GENERIC_GRID_H_ + +#include "wx/defs.h" + +#if wxUSE_GRID + +#include "wx/scrolwin.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxGridNameStr[]; + +// Default parameters for wxGrid +// +#define WXGRID_DEFAULT_NUMBER_ROWS 10 +#define WXGRID_DEFAULT_NUMBER_COLS 10 +#if defined(__WXMSW__) || defined(__WXGTK20__) +#define WXGRID_DEFAULT_ROW_HEIGHT 25 +#else +#define WXGRID_DEFAULT_ROW_HEIGHT 30 +#endif // __WXMSW__ +#define WXGRID_DEFAULT_COL_WIDTH 80 +#define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32 +#define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82 +#define WXGRID_LABEL_EDGE_ZONE 2 +#define WXGRID_MIN_ROW_HEIGHT 15 +#define WXGRID_MIN_COL_WIDTH 15 +#define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16 + +// type names for grid table values +#define wxGRID_VALUE_STRING _T("string") +#define wxGRID_VALUE_BOOL _T("bool") +#define wxGRID_VALUE_NUMBER _T("long") +#define wxGRID_VALUE_FLOAT _T("double") +#define wxGRID_VALUE_CHOICE _T("choice") + +#define wxGRID_VALUE_TEXT wxGRID_VALUE_STRING +#define wxGRID_VALUE_LONG wxGRID_VALUE_NUMBER + +#if wxABI_VERSION >= 20808 + // magic constant which tells (to some functions) to automatically + // calculate the appropriate size + #define wxGRID_AUTOSIZE (-1) +#endif // wxABI_VERSION >= 20808 + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_ADV wxGrid; +class WXDLLIMPEXP_FWD_ADV wxGridCellAttr; +class WXDLLIMPEXP_FWD_ADV wxGridCellAttrProviderData; +class WXDLLIMPEXP_FWD_ADV wxGridColLabelWindow; +class WXDLLIMPEXP_FWD_ADV wxGridCornerLabelWindow; +class WXDLLIMPEXP_FWD_ADV wxGridRowLabelWindow; +class WXDLLIMPEXP_FWD_ADV wxGridWindow; +class WXDLLIMPEXP_FWD_ADV wxGridTypeRegistry; +class WXDLLIMPEXP_FWD_ADV wxGridSelection; + +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +#if wxUSE_SPINCTRL +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +#endif + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#define wxSafeIncRef(p) if ( p ) (p)->IncRef() +#define wxSafeDecRef(p) if ( p ) (p)->DecRef() + +// ---------------------------------------------------------------------------- +// wxGridCellWorker: common base class for wxGridCellRenderer and +// wxGridCellEditor +// +// NB: this is more an implementation convenience than a design issue, so this +// class is not documented and is not public at all +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer +{ +public: + wxGridCellWorker() { m_nRef = 1; } + + // this class is ref counted: it is created with ref count of 1, so + // calling DecRef() once will delete it. Calling IncRef() allows to lock + // it until the matching DecRef() is called + void IncRef() { m_nRef++; } + void DecRef() { if ( --m_nRef == 0 ) delete this; } + + // interpret renderer parameters: arbitrary string whose interpretatin is + // left to the derived classes + virtual void SetParameters(const wxString& params); + +protected: + // virtual dtor for any base class - private because only DecRef() can + // delete us + virtual ~wxGridCellWorker(); + +private: + size_t m_nRef; + + // suppress the stupid gcc warning about the class having private dtor and + // no friends + friend class wxGridCellWorkerDummyFriend; +}; + +// ---------------------------------------------------------------------------- +// wxGridCellRenderer: this class is responsible for actually drawing the cell +// in the grid. You may pass it to the wxGridCellAttr (below) to change the +// format of one given cell or to wxGrid::SetDefaultRenderer() to change the +// view of all cells. This is an ABC, you will normally use one of the +// predefined derived classes or derive your own class from it. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGridCellRenderer : public wxGridCellWorker +{ +public: + // draw the given cell on the provided DC inside the given rectangle + // using the style specified by the attribute and the default or selected + // state corresponding to the isSelected value. + // + // this pure virtual function has a default implementation which will + // prepare the DC using the given attribute: it will draw the rectangle + // with the bg colour from attr and set the text colour and font + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) = 0; + + // get the preferred size of the cell for its contents + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) = 0; + + // create a new object which is the copy of this one + virtual wxGridCellRenderer *Clone() const = 0; +}; + +// the default renderer for the cells containing string data +class WXDLLIMPEXP_ADV wxGridCellStringRenderer : public wxGridCellRenderer +{ +public: + // draw the string + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + // return the string extent + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + virtual wxGridCellRenderer *Clone() const + { return new wxGridCellStringRenderer; } + +protected: + // set the text colours before drawing + void SetTextColoursAndFont(const wxGrid& grid, + const wxGridCellAttr& attr, + wxDC& dc, + bool isSelected); + + // calc the string extent for given string/font + wxSize DoGetBestSize(const wxGridCellAttr& attr, + wxDC& dc, + const wxString& text); +}; + +// the default renderer for the cells containing numeric (long) data +class WXDLLIMPEXP_ADV wxGridCellNumberRenderer : public wxGridCellStringRenderer +{ +public: + // draw the string right aligned + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + virtual wxGridCellRenderer *Clone() const + { return new wxGridCellNumberRenderer; } + +protected: + wxString GetString(const wxGrid& grid, int row, int col); +}; + +class WXDLLIMPEXP_ADV wxGridCellFloatRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellFloatRenderer(int width = -1, int precision = -1); + + // get/change formatting parameters + int GetWidth() const { return m_width; } + void SetWidth(int width) { m_width = width; m_format.clear(); } + int GetPrecision() const { return m_precision; } + void SetPrecision(int precision) { m_precision = precision; m_format.clear(); } + + // draw the string right aligned with given width/precision + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + // parameters string format is "width[,precision]" + virtual void SetParameters(const wxString& params); + + virtual wxGridCellRenderer *Clone() const; + +protected: + wxString GetString(const wxGrid& grid, int row, int col); + +private: + // formatting parameters + int m_width, + m_precision; + + wxString m_format; +}; + +// renderer for boolean fields +class WXDLLIMPEXP_ADV wxGridCellBoolRenderer : public wxGridCellRenderer +{ +public: + // draw a check mark or nothing + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + // return the checkmark size + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + virtual wxGridCellRenderer *Clone() const + { return new wxGridCellBoolRenderer; } + +private: + static wxSize ms_sizeCheckMark; +}; + +// ---------------------------------------------------------------------------- +// wxGridCellEditor: This class is responsible for providing and manipulating +// the in-place edit controls for the grid. Instances of wxGridCellEditor +// (actually, instances of derived classes since it is an ABC) can be +// associated with the cell attributes for individual cells, rows, columns, or +// even for the entire grid. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGridCellEditor : public wxGridCellWorker +{ +public: + wxGridCellEditor(); + + bool IsCreated() { return m_control != NULL; } + wxControl* GetControl() { return m_control; } + void SetControl(wxControl* control) { m_control = control; } + + wxGridCellAttr* GetCellAttr() { return m_attr; } + void SetCellAttr(wxGridCellAttr* attr) { m_attr = attr; } + + // Creates the actual edit control + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) = 0; + + // Size and position the edit control + virtual void SetSize(const wxRect& rect); + + // Show or hide the edit control, use the specified attributes to set + // colours/fonts for it + virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL); + + // Draws the part of the cell not occupied by the control: the base class + // version just fills it with background colour from the attribute + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + + // Fetch the value from the table and prepare the edit control + // to begin editing. Set the focus to the edit control. + virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; + + // Complete the editing of the current cell. Returns true if the value has + // changed. If necessary, the control may be destroyed. + virtual bool EndEdit(int row, int col, wxGrid* grid) = 0; + + // Reset the value in the control back to its starting value + virtual void Reset() = 0; + + // return true to allow the given key to start editing: the base class + // version only checks that the event has no modifiers. The derived + // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in + // their IsAcceptedKey() implementation, although, of course, it is not a + // mandatory requirment. + // + // NB: if the key is F2 (special), editing will always start and this + // method will not be called at all (but StartingKey() will) + virtual bool IsAcceptedKey(wxKeyEvent& event); + + // If the editor is enabled by pressing keys on the grid, this will be + // called to let the editor do something about that first key if desired + virtual void StartingKey(wxKeyEvent& event); + + // if the editor is enabled by clicking on the cell, this method will be + // called + virtual void StartingClick(); + + // Some types of controls on some platforms may need some help + // with the Return key. + virtual void HandleReturn(wxKeyEvent& event); + + // Final cleanup + virtual void Destroy(); + + // create a new object which is the copy of this one + virtual wxGridCellEditor *Clone() const = 0; + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const = 0; + +protected: + // the dtor is private because only DecRef() can delete us + virtual ~wxGridCellEditor(); + + // the control we show on screen + wxControl* m_control; + + // a temporary pointer to the attribute being edited + wxGridCellAttr* m_attr; + + // if we change the colours/font of the control from the default ones, we + // must restore the default later and we save them here between calls to + // Show(true) and Show(false) + wxColour m_colFgOld, + m_colBgOld; + wxFont m_fontOld; + + // suppress the stupid gcc warning about the class having private dtor and + // no friends + friend class wxGridCellEditorDummyFriend; + + DECLARE_NO_COPY_CLASS(wxGridCellEditor) +}; + +#if wxUSE_TEXTCTRL + +// the editor for string/text data +class WXDLLIMPEXP_ADV wxGridCellTextEditor : public wxGridCellEditor +{ +public: + wxGridCellTextEditor(); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + virtual void SetSize(const wxRect& rect); + + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + + virtual bool IsAcceptedKey(wxKeyEvent& event); + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + virtual void StartingKey(wxKeyEvent& event); + virtual void HandleReturn(wxKeyEvent& event); + + // parameters string format is "max_width" + virtual void SetParameters(const wxString& params); + + virtual wxGridCellEditor *Clone() const + { return new wxGridCellTextEditor; } + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const; + +protected: + wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; } + + // parts of our virtual functions reused by the derived classes + void DoBeginEdit(const wxString& startValue); + void DoReset(const wxString& startValue); + +private: + size_t m_maxChars; // max number of chars allowed + wxString m_startValue; + + DECLARE_NO_COPY_CLASS(wxGridCellTextEditor) +}; + +// the editor for numeric (long) data +class WXDLLIMPEXP_ADV wxGridCellNumberEditor : public wxGridCellTextEditor +{ +public: + // allows to specify the range - if min == max == -1, no range checking is + // done + wxGridCellNumberEditor(int min = -1, int max = -1); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + + virtual bool IsAcceptedKey(wxKeyEvent& event); + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + virtual void StartingKey(wxKeyEvent& event); + + // parameters string format is "min,max" + virtual void SetParameters(const wxString& params); + + virtual wxGridCellEditor *Clone() const + { return new wxGridCellNumberEditor(m_min, m_max); } + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const; + +protected: +#if wxUSE_SPINCTRL + wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; } +#endif + + // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl + bool HasRange() const + { +#if wxUSE_SPINCTRL + return m_min != m_max; +#else + return false; +#endif + } + + // string representation of m_valueOld + wxString GetString() const + { return wxString::Format(_T("%ld"), m_valueOld); } + +private: + int m_min, + m_max; + + long m_valueOld; + + DECLARE_NO_COPY_CLASS(wxGridCellNumberEditor) +}; + +// the editor for floating point numbers (double) data +class WXDLLIMPEXP_ADV wxGridCellFloatEditor : public wxGridCellTextEditor +{ +public: + wxGridCellFloatEditor(int width = -1, int precision = -1); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + + virtual bool IsAcceptedKey(wxKeyEvent& event); + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + virtual void StartingKey(wxKeyEvent& event); + + virtual wxGridCellEditor *Clone() const + { return new wxGridCellFloatEditor(m_width, m_precision); } + + // parameters string format is "width,precision" + virtual void SetParameters(const wxString& params); + +protected: + // string representation of m_valueOld + wxString GetString() const; + +private: + int m_width, + m_precision; + double m_valueOld; + + DECLARE_NO_COPY_CLASS(wxGridCellFloatEditor) +}; + +#endif // wxUSE_TEXTCTRL + +#if wxUSE_CHECKBOX + +// the editor for boolean data +class WXDLLIMPEXP_ADV wxGridCellBoolEditor : public wxGridCellEditor +{ +public: + wxGridCellBoolEditor() { } + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + + virtual void SetSize(const wxRect& rect); + virtual void Show(bool show, wxGridCellAttr *attr = NULL); + + virtual bool IsAcceptedKey(wxKeyEvent& event); + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + virtual void StartingClick(); + virtual void StartingKey(wxKeyEvent& event); + + virtual wxGridCellEditor *Clone() const + { return new wxGridCellBoolEditor; } + + // added GetValue so we can get the value which is in the control, see + // also UseStringValues() + virtual wxString GetValue() const; + + // set the string values returned by GetValue() for the true and false + // states, respectively + static void UseStringValues(const wxString& valueTrue = _T("1"), + const wxString& valueFalse = wxEmptyString); + + // return true if the given string is equal to the string representation of + // true value which we currently use + static bool IsTrueValue(const wxString& value); + +protected: + wxCheckBox *CBox() const { return (wxCheckBox *)m_control; } + +private: + bool m_startValue; + + static wxString ms_stringValues[2]; + + DECLARE_NO_COPY_CLASS(wxGridCellBoolEditor) +}; + +#endif // wxUSE_CHECKBOX + +#if wxUSE_COMBOBOX + +// the editor for string data allowing to choose from the list of strings +class WXDLLIMPEXP_ADV wxGridCellChoiceEditor : public wxGridCellEditor +{ +public: + // if !allowOthers, user can't type a string not in choices array + wxGridCellChoiceEditor(size_t count = 0, + const wxString choices[] = NULL, + bool allowOthers = false); + wxGridCellChoiceEditor(const wxArrayString& choices, + bool allowOthers = false); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + + // parameters string format is "item1[,item2[...,itemN]]" + virtual void SetParameters(const wxString& params); + + virtual wxGridCellEditor *Clone() const; + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const; + +protected: + wxComboBox *Combo() const { return (wxComboBox *)m_control; } + +// DJC - (MAPTEK) you at least need access to m_choices if you +// wish to override this class +protected: + wxString m_startValue; + wxArrayString m_choices; + bool m_allowOthers; + + DECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor) +}; + +#endif // wxUSE_COMBOBOX + +// ---------------------------------------------------------------------------- +// wxGridCellAttr: this class can be used to alter the cells appearance in +// the grid by changing their colour/font/... from default. An object of this +// class may be returned by wxGridTable::GetAttr(). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGridCellAttr : public wxClientDataContainer +{ +public: + enum wxAttrKind + { + Any, + Default, + Cell, + Row, + Col, + Merged + }; + + // ctors + wxGridCellAttr(wxGridCellAttr *attrDefault = NULL) + { + Init(attrDefault); + + // MB: args used to be 0,0 here but wxALIGN_LEFT is 0 + SetAlignment(-1, -1); + } + + // VZ: considering the number of members wxGridCellAttr has now, this ctor + // seems to be pretty useless... may be we should just remove it? + wxGridCellAttr(const wxColour& colText, + const wxColour& colBack, + const wxFont& font, + int hAlign, + int vAlign) + : m_colText(colText), m_colBack(colBack), m_font(font) + { + Init(); + SetAlignment(hAlign, vAlign); + } + + // creates a new copy of this object + wxGridCellAttr *Clone() const; + void MergeWith(wxGridCellAttr *mergefrom); + + // this class is ref counted: it is created with ref count of 1, so + // calling DecRef() once will delete it. Calling IncRef() allows to lock + // it until the matching DecRef() is called + void IncRef() { m_nRef++; } + void DecRef() { if ( --m_nRef == 0 ) delete this; } + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } + void SetFont(const wxFont& font) { m_font = font; } + void SetAlignment(int hAlign, int vAlign) + { + m_hAlign = hAlign; + m_vAlign = vAlign; + } + void SetSize(int num_rows, int num_cols); + void SetOverflow(bool allow = true) + { m_overflow = allow ? Overflow : SingleCell; } + void SetReadOnly(bool isReadOnly = true) + { m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; } + + // takes ownership of the pointer + void SetRenderer(wxGridCellRenderer *renderer) + { wxSafeDecRef(m_renderer); m_renderer = renderer; } + void SetEditor(wxGridCellEditor* editor) + { wxSafeDecRef(m_editor); m_editor = editor; } + + void SetKind(wxAttrKind kind) { m_attrkind = kind; } + + // accessors + bool HasTextColour() const { return m_colText.Ok(); } + bool HasBackgroundColour() const { return m_colBack.Ok(); } + bool HasFont() const { return m_font.Ok(); } + bool HasAlignment() const { return (m_hAlign != -1 || m_vAlign != -1); } + bool HasRenderer() const { return m_renderer != NULL; } + bool HasEditor() const { return m_editor != NULL; } + bool HasReadWriteMode() const { return m_isReadOnly != Unset; } + bool HasOverflowMode() const { return m_overflow != UnsetOverflow; } + bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; } + + const wxColour& GetTextColour() const; + const wxColour& GetBackgroundColour() const; + const wxFont& GetFont() const; + void GetAlignment(int *hAlign, int *vAlign) const; + void GetSize(int *num_rows, int *num_cols) const; + bool GetOverflow() const + { return m_overflow != SingleCell; } + wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; + wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; + + bool IsReadOnly() const { return m_isReadOnly == wxGridCellAttr::ReadOnly; } + + wxAttrKind GetKind() { return m_attrkind; } + + void SetDefAttr(wxGridCellAttr* defAttr) { m_defGridAttr = defAttr; } + +protected: + // the dtor is private because only DecRef() can delete us + virtual ~wxGridCellAttr() + { + wxSafeDecRef(m_renderer); + wxSafeDecRef(m_editor); + } + +private: + enum wxAttrReadMode + { + Unset = -1, + ReadWrite, + ReadOnly + }; + + enum wxAttrOverflowMode + { + UnsetOverflow = -1, + Overflow, + SingleCell + }; + + // the common part of all ctors + void Init(wxGridCellAttr *attrDefault = NULL); + + + // the ref count - when it goes to 0, we die + size_t m_nRef; + + wxColour m_colText, + m_colBack; + wxFont m_font; + int m_hAlign, + m_vAlign; + int m_sizeRows, + m_sizeCols; + + wxAttrOverflowMode m_overflow; + + wxGridCellRenderer* m_renderer; + wxGridCellEditor* m_editor; + wxGridCellAttr* m_defGridAttr; + + wxAttrReadMode m_isReadOnly; + + wxAttrKind m_attrkind; + + // use Clone() instead + DECLARE_NO_COPY_CLASS(wxGridCellAttr) + + // suppress the stupid gcc warning about the class having private dtor and + // no friends + friend class wxGridCellAttrDummyFriend; +}; + +// ---------------------------------------------------------------------------- +// wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the +// cell attributes. +// ---------------------------------------------------------------------------- + +// implementation note: we separate it from wxGridTableBase because we wish to +// avoid deriving a new table class if possible, and sometimes it will be +// enough to just derive another wxGridCellAttrProvider instead +// +// the default implementation is reasonably efficient for the generic case, +// but you might still wish to implement your own for some specific situations +// if you have performance problems with the stock one +class WXDLLIMPEXP_ADV wxGridCellAttrProvider : public wxClientDataContainer +{ +public: + wxGridCellAttrProvider(); + virtual ~wxGridCellAttrProvider(); + + // DecRef() must be called on the returned pointer + virtual wxGridCellAttr *GetAttr(int row, int col, + wxGridCellAttr::wxAttrKind kind ) const; + + // all these functions take ownership of the pointer, don't call DecRef() + // on it + virtual void SetAttr(wxGridCellAttr *attr, int row, int col); + virtual void SetRowAttr(wxGridCellAttr *attr, int row); + virtual void SetColAttr(wxGridCellAttr *attr, int col); + + // these functions must be called whenever some rows/cols are deleted + // because the internal data must be updated then + void UpdateAttrRows( size_t pos, int numRows ); + void UpdateAttrCols( size_t pos, int numCols ); + +private: + void InitData(); + + wxGridCellAttrProviderData *m_data; + + DECLARE_NO_COPY_CLASS(wxGridCellAttrProvider) +}; + +////////////////////////////////////////////////////////////////////// +// +// Grid table classes +// +////////////////////////////////////////////////////////////////////// + + +class WXDLLIMPEXP_ADV wxGridTableBase : public wxObject, public wxClientDataContainer +{ +public: + wxGridTableBase(); + virtual ~wxGridTableBase(); + + // You must override these functions in a derived table class + // + virtual int GetNumberRows() = 0; + virtual int GetNumberCols() = 0; + virtual bool IsEmptyCell( int row, int col ) = 0; + virtual wxString GetValue( int row, int col ) = 0; + virtual void SetValue( int row, int col, const wxString& value ) = 0; + + // Data type determination and value access + virtual wxString GetTypeName( int row, int col ); + virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); + virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); + + virtual long GetValueAsLong( int row, int col ); + virtual double GetValueAsDouble( int row, int col ); + virtual bool GetValueAsBool( int row, int col ); + + virtual void SetValueAsLong( int row, int col, long value ); + virtual void SetValueAsDouble( int row, int col, double value ); + virtual void SetValueAsBool( int row, int col, bool value ); + + // For user defined types + virtual void* GetValueAsCustom( int row, int col, const wxString& typeName ); + virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); + + + // Overriding these is optional + // + virtual void SetView( wxGrid *grid ) { m_view = grid; } + virtual wxGrid * GetView() const { return m_view; } + + virtual void Clear() {} + virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool AppendRows( size_t numRows = 1 ); + virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + virtual bool AppendCols( size_t numCols = 1 ); + virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + + virtual wxString GetRowLabelValue( int row ); + virtual wxString GetColLabelValue( int col ); + virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {} + virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {} + + // Attribute handling + // + + // give us the attr provider to use - we take ownership of the pointer + void SetAttrProvider(wxGridCellAttrProvider *attrProvider); + + // get the currently used attr provider (may be NULL) + wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; } + + // Does this table allow attributes? Default implementation creates + // a wxGridCellAttrProvider if necessary. + virtual bool CanHaveAttributes(); + + // by default forwarded to wxGridCellAttrProvider if any. May be + // overridden to handle attributes directly in the table. + virtual wxGridCellAttr *GetAttr( int row, int col, + wxGridCellAttr::wxAttrKind kind ); + + + // these functions take ownership of the pointer + virtual void SetAttr(wxGridCellAttr* attr, int row, int col); + virtual void SetRowAttr(wxGridCellAttr *attr, int row); + virtual void SetColAttr(wxGridCellAttr *attr, int col); + +private: + wxGrid * m_view; + wxGridCellAttrProvider *m_attrProvider; + + DECLARE_ABSTRACT_CLASS(wxGridTableBase) + DECLARE_NO_COPY_CLASS(wxGridTableBase) +}; + + +// ---------------------------------------------------------------------------- +// wxGridTableMessage +// ---------------------------------------------------------------------------- + +// IDs for messages sent from grid table to view +// +enum wxGridTableRequest +{ + wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, + wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, + wxGRIDTABLE_NOTIFY_ROWS_INSERTED, + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, + wxGRIDTABLE_NOTIFY_ROWS_DELETED, + wxGRIDTABLE_NOTIFY_COLS_INSERTED, + wxGRIDTABLE_NOTIFY_COLS_APPENDED, + wxGRIDTABLE_NOTIFY_COLS_DELETED +}; + +class WXDLLIMPEXP_ADV wxGridTableMessage +{ +public: + wxGridTableMessage(); + wxGridTableMessage( wxGridTableBase *table, int id, + int comInt1 = -1, + int comInt2 = -1 ); + + void SetTableObject( wxGridTableBase *table ) { m_table = table; } + wxGridTableBase * GetTableObject() const { return m_table; } + void SetId( int id ) { m_id = id; } + int GetId() { return m_id; } + void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; } + int GetCommandInt() { return m_comInt1; } + void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; } + int GetCommandInt2() { return m_comInt2; } + +private: + wxGridTableBase *m_table; + int m_id; + int m_comInt1; + int m_comInt2; + + DECLARE_NO_COPY_CLASS(wxGridTableMessage) +}; + + + +// ------ wxGridStringArray +// A 2-dimensional array of strings for data values +// + +WX_DECLARE_OBJARRAY_WITH_DECL(wxArrayString, wxGridStringArray, + class WXDLLIMPEXP_ADV); + + + +// ------ wxGridStringTable +// +// Simplest type of data table for a grid for small tables of strings +// that are stored in memory +// + +class WXDLLIMPEXP_ADV wxGridStringTable : public wxGridTableBase +{ +public: + wxGridStringTable(); + wxGridStringTable( int numRows, int numCols ); + virtual ~wxGridStringTable(); + + // these are pure virtual in wxGridTableBase + // + int GetNumberRows(); + int GetNumberCols(); + wxString GetValue( int row, int col ); + void SetValue( int row, int col, const wxString& s ); + bool IsEmptyCell( int row, int col ); + + // overridden functions from wxGridTableBase + // + void Clear(); + bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + bool AppendRows( size_t numRows = 1 ); + bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + bool AppendCols( size_t numCols = 1 ); + bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + + void SetRowLabelValue( int row, const wxString& ); + void SetColLabelValue( int col, const wxString& ); + wxString GetRowLabelValue( int row ); + wxString GetColLabelValue( int col ); + +private: + wxGridStringArray m_data; + + // These only get used if you set your own labels, otherwise the + // GetRow/ColLabelValue functions return wxGridTableBase defaults + // + wxArrayString m_rowLabels; + wxArrayString m_colLabels; + + DECLARE_DYNAMIC_CLASS_NO_COPY( wxGridStringTable ) +}; + + + +// ============================================================================ +// Grid view classes +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxGridCellCoords: location of a cell in the grid +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGridCellCoords +{ +public: + wxGridCellCoords() { m_row = m_col = -1; } + wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; } + + // default copy ctor is ok + + int GetRow() const { return m_row; } + void SetRow( int n ) { m_row = n; } + int GetCol() const { return m_col; } + void SetCol( int n ) { m_col = n; } + void Set( int row, int col ) { m_row = row; m_col = col; } + + wxGridCellCoords& operator=( const wxGridCellCoords& other ) + { + if ( &other != this ) + { + m_row=other.m_row; + m_col=other.m_col; + } + return *this; + } + + bool operator==( const wxGridCellCoords& other ) const + { + return (m_row == other.m_row && m_col == other.m_col); + } + + bool operator!=( const wxGridCellCoords& other ) const + { + return (m_row != other.m_row || m_col != other.m_col); + } + + bool operator!() const + { + return (m_row == -1 && m_col == -1 ); + } + +private: + int m_row; + int m_col; +}; + + +// For comparisons... +// +extern WXDLLIMPEXP_ADV wxGridCellCoords wxGridNoCellCoords; +extern WXDLLIMPEXP_ADV wxRect wxGridNoCellRect; + +// An array of cell coords... +// +WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellCoords, wxGridCellCoordsArray, + class WXDLLIMPEXP_ADV); + +// ---------------------------------------------------------------------------- +// wxGrid +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGrid : public wxScrolledWindow +{ +public: + wxGrid() ; + + wxGrid( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const wxString& name = wxGridNameStr ); + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const wxString& name = wxGridNameStr ); + + virtual ~wxGrid(); + + enum wxGridSelectionModes {wxGridSelectCells, + wxGridSelectRows, + wxGridSelectColumns}; + + bool CreateGrid( int numRows, int numCols, + wxGrid::wxGridSelectionModes selmode = + wxGrid::wxGridSelectCells ); + + void SetSelectionMode(wxGrid::wxGridSelectionModes selmode); + wxGrid::wxGridSelectionModes GetSelectionMode() const; + + // ------ grid dimensions + // + int GetNumberRows() { return m_numRows; } + int GetNumberCols() { return m_numCols; } + + + // ------ display update functions + // + wxArrayInt CalcRowLabelsExposed( const wxRegion& reg ); + + wxArrayInt CalcColLabelsExposed( const wxRegion& reg ); + wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg ); + + + // ------ event handlers + // + void ProcessRowLabelMouseEvent( wxMouseEvent& event ); + void ProcessColLabelMouseEvent( wxMouseEvent& event ); + void ProcessCornerLabelMouseEvent( wxMouseEvent& event ); + void ProcessGridCellMouseEvent( wxMouseEvent& event ); + bool ProcessTableMessage( wxGridTableMessage& ); + + void DoEndDragResizeRow(); + void DoEndDragResizeCol(); + void DoEndDragMoveCol(); + + wxGridTableBase * GetTable() const { return m_table; } + bool SetTable( wxGridTableBase *table, bool takeOwnership = false, + wxGrid::wxGridSelectionModes selmode = + wxGrid::wxGridSelectCells ); + + void ClearGrid(); + bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels = true ); + bool AppendRows( int numRows = 1, bool updateLabels = true ); + bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels = true ); + bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels = true ); + bool AppendCols( int numCols = 1, bool updateLabels = true ); + bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels = true ); + + void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells ); + void DrawGridSpace( wxDC& dc ); + void DrawCellBorder( wxDC& dc, const wxGridCellCoords& ); + void DrawAllGridLines( wxDC& dc, const wxRegion & reg ); + void DrawCell( wxDC& dc, const wxGridCellCoords& ); + void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells); + + // this function is called when the current cell highlight must be redrawn + // and may be overridden by the user + virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ); + + virtual void DrawRowLabels( wxDC& dc, const wxArrayInt& rows ); + virtual void DrawRowLabel( wxDC& dc, int row ); + + virtual void DrawColLabels( wxDC& dc, const wxArrayInt& cols ); + virtual void DrawColLabel( wxDC& dc, int col ); + + + // ------ Cell text drawing functions + // + void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&, + int horizontalAlignment = wxALIGN_LEFT, + int verticalAlignment = wxALIGN_TOP, + int textOrientation = wxHORIZONTAL ); + + void DrawTextRectangle( wxDC& dc, const wxArrayString& lines, const wxRect&, + int horizontalAlignment = wxALIGN_LEFT, + int verticalAlignment = wxALIGN_TOP, + int textOrientation = wxHORIZONTAL ); + + + // Split a string containing newline chararcters into an array of + // strings and return the number of lines + // + void StringToLines( const wxString& value, wxArrayString& lines ); + + void GetTextBoxSize( const wxDC& dc, + const wxArrayString& lines, + long *width, long *height ); + + + // ------ + // Code that does a lot of grid modification can be enclosed + // between BeginBatch() and EndBatch() calls to avoid screen + // flicker + // + void BeginBatch() { m_batchCount++; } + void EndBatch(); + + int GetBatchCount() { return m_batchCount; } + + virtual void Refresh(bool eraseb = true, + const wxRect* rect = (const wxRect *) NULL); + + // Use this, rather than wxWindow::Refresh(), to force an + // immediate repainting of the grid. Has no effect if you are + // already inside a BeginBatch / EndBatch block. + // + // This function is necessary because wxGrid has a minimal OnPaint() + // handler to reduce screen flicker. + // + void ForceRefresh(); + + + // ------ edit control functions + // + bool IsEditable() const { return m_editable; } + void EnableEditing( bool edit ); + + void EnableCellEditControl( bool enable = true ); + void DisableCellEditControl() { EnableCellEditControl(false); } + bool CanEnableCellControl() const; + bool IsCellEditControlEnabled() const; + bool IsCellEditControlShown() const; + + bool IsCurrentCellReadOnly() const; + + void ShowCellEditControl(); + void HideCellEditControl(); + void SaveEditControlValue(); + + + // ------ grid location functions + // Note that all of these functions work with the logical coordinates of + // grid cells and labels so you will need to convert from device + // coordinates for mouse events etc. + // + void XYToCell( int x, int y, wxGridCellCoords& ); + int YToRow( int y ); + int XToCol( int x, bool clipToMinMax = false ); + + int YToEdgeOfRow( int y ); + int XToEdgeOfCol( int x ); + + wxRect CellToRect( int row, int col ); + wxRect CellToRect( const wxGridCellCoords& coords ) + { return CellToRect( coords.GetRow(), coords.GetCol() ); } + + int GetGridCursorRow() { return m_currentCellCoords.GetRow(); } + int GetGridCursorCol() { return m_currentCellCoords.GetCol(); } + + // check to see if a cell is either wholly visible (the default arg) or + // at least partially visible in the grid window + // + bool IsVisible( int row, int col, bool wholeCellVisible = true ); + bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true ) + { return IsVisible( coords.GetRow(), coords.GetCol(), wholeCellVisible ); } + void MakeCellVisible( int row, int col ); + void MakeCellVisible( const wxGridCellCoords& coords ) + { MakeCellVisible( coords.GetRow(), coords.GetCol() ); } + + + // ------ grid cursor movement functions + // + void SetGridCursor( int row, int col ) + { SetCurrentCell( wxGridCellCoords(row, col) ); } + + bool MoveCursorUp( bool expandSelection ); + bool MoveCursorDown( bool expandSelection ); + bool MoveCursorLeft( bool expandSelection ); + bool MoveCursorRight( bool expandSelection ); + bool MovePageDown(); + bool MovePageUp(); + bool MoveCursorUpBlock( bool expandSelection ); + bool MoveCursorDownBlock( bool expandSelection ); + bool MoveCursorLeftBlock( bool expandSelection ); + bool MoveCursorRightBlock( bool expandSelection ); + + + // ------ label and gridline formatting + // + int GetDefaultRowLabelSize() { return WXGRID_DEFAULT_ROW_LABEL_WIDTH; } + int GetRowLabelSize() { return m_rowLabelWidth; } + int GetDefaultColLabelSize() { return WXGRID_DEFAULT_COL_LABEL_HEIGHT; } + int GetColLabelSize() { return m_colLabelHeight; } + wxColour GetLabelBackgroundColour() { return m_labelBackgroundColour; } + wxColour GetLabelTextColour() { return m_labelTextColour; } + wxFont GetLabelFont() { return m_labelFont; } + void GetRowLabelAlignment( int *horiz, int *vert ); + void GetColLabelAlignment( int *horiz, int *vert ); + int GetColLabelTextOrientation(); + wxString GetRowLabelValue( int row ); + wxString GetColLabelValue( int col ); + wxColour GetGridLineColour() { return m_gridLineColour; } + + // these methods may be overridden to customize individual grid lines + // appearance + virtual wxPen GetDefaultGridLinePen(); + virtual wxPen GetRowGridLinePen(int row); + virtual wxPen GetColGridLinePen(int col); + wxColour GetCellHighlightColour() { return m_cellHighlightColour; } + int GetCellHighlightPenWidth() { return m_cellHighlightPenWidth; } + int GetCellHighlightROPenWidth() { return m_cellHighlightROPenWidth; } + + void SetRowLabelSize( int width ); + void SetColLabelSize( int height ); + void SetLabelBackgroundColour( const wxColour& ); + void SetLabelTextColour( const wxColour& ); + void SetLabelFont( const wxFont& ); + void SetRowLabelAlignment( int horiz, int vert ); + void SetColLabelAlignment( int horiz, int vert ); + void SetColLabelTextOrientation( int textOrientation ); + void SetRowLabelValue( int row, const wxString& ); + void SetColLabelValue( int col, const wxString& ); + void SetGridLineColour( const wxColour& ); + void SetCellHighlightColour( const wxColour& ); + void SetCellHighlightPenWidth(int width); + void SetCellHighlightROPenWidth(int width); + + void EnableDragRowSize( bool enable = true ); + void DisableDragRowSize() { EnableDragRowSize( false ); } + bool CanDragRowSize() { return m_canDragRowSize; } + void EnableDragColSize( bool enable = true ); + void DisableDragColSize() { EnableDragColSize( false ); } + bool CanDragColSize() { return m_canDragColSize; } + void EnableDragColMove( bool enable = true ); + void DisableDragColMove() { EnableDragColMove( false ); } + bool CanDragColMove() { return m_canDragColMove; } + void EnableDragGridSize(bool enable = true); + void DisableDragGridSize() { EnableDragGridSize(false); } + bool CanDragGridSize() { return m_canDragGridSize; } + + void EnableDragCell( bool enable = true ); + void DisableDragCell() { EnableDragCell( false ); } + bool CanDragCell() { return m_canDragCell; } + + // this sets the specified attribute for this cell or in this row/col + void SetAttr(int row, int col, wxGridCellAttr *attr); + void SetRowAttr(int row, wxGridCellAttr *attr); + void SetColAttr(int col, wxGridCellAttr *attr); + + // returns the attribute we may modify in place: a new one if this cell + // doesn't have any yet or the existing one if it does + // + // DecRef() must be called on the returned pointer, as usual + wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; + + + // shortcuts for setting the column parameters + + // set the format for the data in the column: default is string + void SetColFormatBool(int col); + void SetColFormatNumber(int col); + void SetColFormatFloat(int col, int width = -1, int precision = -1); + void SetColFormatCustom(int col, const wxString& typeName); + + void EnableGridLines( bool enable = true ); + bool GridLinesEnabled() { return m_gridLinesEnabled; } + + // ------ row and col formatting + // + int GetDefaultRowSize(); + int GetRowSize( int row ); + int GetDefaultColSize(); + int GetColSize( int col ); + wxColour GetDefaultCellBackgroundColour(); + wxColour GetCellBackgroundColour( int row, int col ); + wxColour GetDefaultCellTextColour(); + wxColour GetCellTextColour( int row, int col ); + wxFont GetDefaultCellFont(); + wxFont GetCellFont( int row, int col ); + void GetDefaultCellAlignment( int *horiz, int *vert ); + void GetCellAlignment( int row, int col, int *horiz, int *vert ); + bool GetDefaultCellOverflow(); + bool GetCellOverflow( int row, int col ); + void GetCellSize( int row, int col, int *num_rows, int *num_cols ); + + void SetDefaultRowSize( int height, bool resizeExistingRows = false ); + void SetRowSize( int row, int height ); + void SetDefaultColSize( int width, bool resizeExistingCols = false ); + + void SetColSize( int col, int width ); + + //Column positions + int GetColAt( int colPos ) const + { + if ( m_colAt.IsEmpty() ) + return colPos; + else + return m_colAt[colPos]; + } + + void SetColPos( int colID, int newPos ); + + int GetColPos( int colID ) const + { + if ( m_colAt.IsEmpty() ) + return colID; + else + { + for ( int i = 0; i < m_numCols; i++ ) + { + if ( m_colAt[i] == colID ) + return i; + } + } + + return -1; + } + + // automatically size the column or row to fit to its contents, if + // setAsMin is true, this optimal width will also be set as minimal width + // for this column + void AutoSizeColumn( int col, bool setAsMin = true ) + { AutoSizeColOrRow(col, setAsMin, true); } + void AutoSizeRow( int row, bool setAsMin = true ) + { AutoSizeColOrRow(row, setAsMin, false); } + + // auto size all columns (very ineffective for big grids!) + void AutoSizeColumns( bool setAsMin = true ) + { (void)SetOrCalcColumnSizes(false, setAsMin); } + + void AutoSizeRows( bool setAsMin = true ) + { (void)SetOrCalcRowSizes(false, setAsMin); } + + // auto size the grid, that is make the columns/rows of the "right" size + // and also set the grid size to just fit its contents + void AutoSize(); + + // autosize row height depending on label text + void AutoSizeRowLabelSize( int row ); + + // autosize column width depending on label text + void AutoSizeColLabelSize( int col ); + + // column won't be resized to be lesser width - this must be called during + // the grid creation because it won't resize the column if it's already + // narrower than the minimal width + void SetColMinimalWidth( int col, int width ); + void SetRowMinimalHeight( int row, int width ); + + /* These members can be used to query and modify the minimal + * acceptable size of grid rows and columns. Call this function in + * your code which creates the grid if you want to display cells + * with a size smaller than the default acceptable minimum size. + * Like the members SetColMinimalWidth and SetRowMinimalWidth, + * the existing rows or columns will not be checked/resized. + */ + void SetColMinimalAcceptableWidth( int width ); + void SetRowMinimalAcceptableHeight( int width ); + int GetColMinimalAcceptableWidth() const; + int GetRowMinimalAcceptableHeight() const; + + void SetDefaultCellBackgroundColour( const wxColour& ); + void SetCellBackgroundColour( int row, int col, const wxColour& ); + void SetDefaultCellTextColour( const wxColour& ); + + void SetCellTextColour( int row, int col, const wxColour& ); + void SetDefaultCellFont( const wxFont& ); + void SetCellFont( int row, int col, const wxFont& ); + void SetDefaultCellAlignment( int horiz, int vert ); + void SetCellAlignment( int row, int col, int horiz, int vert ); + void SetDefaultCellOverflow( bool allow ); + void SetCellOverflow( int row, int col, bool allow ); + void SetCellSize( int row, int col, int num_rows, int num_cols ); + + // takes ownership of the pointer + void SetDefaultRenderer(wxGridCellRenderer *renderer); + void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer); + wxGridCellRenderer *GetDefaultRenderer() const; + wxGridCellRenderer* GetCellRenderer(int row, int col); + + // takes ownership of the pointer + void SetDefaultEditor(wxGridCellEditor *editor); + void SetCellEditor(int row, int col, wxGridCellEditor *editor); + wxGridCellEditor *GetDefaultEditor() const; + wxGridCellEditor* GetCellEditor(int row, int col); + + + + // ------ cell value accessors + // + wxString GetCellValue( int row, int col ) + { + if ( m_table ) + { + return m_table->GetValue( row, col ); + } + else + { + return wxEmptyString; + } + } + + wxString GetCellValue( const wxGridCellCoords& coords ) + { return GetCellValue( coords.GetRow(), coords.GetCol() ); } + + void SetCellValue( int row, int col, const wxString& s ); + void SetCellValue( const wxGridCellCoords& coords, const wxString& s ) + { SetCellValue( coords.GetRow(), coords.GetCol(), s ); } + + // returns true if the cell can't be edited + bool IsReadOnly(int row, int col) const; + + // make the cell editable/readonly + void SetReadOnly(int row, int col, bool isReadOnly = true); + + // ------ select blocks of cells + // + void SelectRow( int row, bool addToSelected = false ); + void SelectCol( int col, bool addToSelected = false ); + + void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol, + bool addToSelected = false ); + + void SelectBlock( const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool addToSelected = false ) + { SelectBlock( topLeft.GetRow(), topLeft.GetCol(), + bottomRight.GetRow(), bottomRight.GetCol(), + addToSelected ); } + + void SelectAll(); + + bool IsSelection(); + + // ------ deselect blocks or cells + // + void DeselectRow( int row ); + void DeselectCol( int col ); + void DeselectCell( int row, int col ); + + void ClearSelection(); + + bool IsInSelection( int row, int col ) const; + + bool IsInSelection( const wxGridCellCoords& coords ) const + { return IsInSelection( coords.GetRow(), coords.GetCol() ); } + + wxGridCellCoordsArray GetSelectedCells() const; + wxGridCellCoordsArray GetSelectionBlockTopLeft() const; + wxGridCellCoordsArray GetSelectionBlockBottomRight() const; + wxArrayInt GetSelectedRows() const; + wxArrayInt GetSelectedCols() const; + + // This function returns the rectangle that encloses the block of cells + // limited by TopLeft and BottomRight cell in device coords and clipped + // to the client size of the grid window. + // + wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, + const wxGridCellCoords & bottomRight ); + + // Access or update the selection fore/back colours + wxColour GetSelectionBackground() const + { return m_selectionBackground; } + wxColour GetSelectionForeground() const + { return m_selectionForeground; } + + void SetSelectionBackground(const wxColour& c) { m_selectionBackground = c; } + void SetSelectionForeground(const wxColour& c) { m_selectionForeground = c; } + + + // Methods for a registry for mapping data types to Renderers/Editors + void RegisterDataType(const wxString& typeName, + wxGridCellRenderer* renderer, + wxGridCellEditor* editor); + // DJC MAPTEK + virtual wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; + wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const + { return GetDefaultEditorForCell(c.GetRow(), c.GetCol()); } + virtual wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; + virtual wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; + virtual wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; + + // grid may occupy more space than needed for its rows/columns, this + // function allows to set how big this extra space is + void SetMargins(int extraWidth, int extraHeight) + { + m_extraWidth = extraWidth; + m_extraHeight = extraHeight; + + CalcDimensions(); + } + + // Accessors for component windows + wxWindow* GetGridWindow() { return (wxWindow*)m_gridWin; } + wxWindow* GetGridRowLabelWindow() { return (wxWindow*)m_rowLabelWin; } + wxWindow* GetGridColLabelWindow() { return (wxWindow*)m_colLabelWin; } + wxWindow* GetGridCornerLabelWindow() { return (wxWindow*)m_cornerLabelWin; } + + // Allow adjustment of scroll increment. The default is (15, 15). + void SetScrollLineX(int x) { m_scrollLineX = x; } + void SetScrollLineY(int y) { m_scrollLineY = y; } + int GetScrollLineX() const { return m_scrollLineX; } + int GetScrollLineY() const { return m_scrollLineY; } + + // Implementation + int GetScrollX(int x) const + { + return (x + GetScrollLineX() - 1) / GetScrollLineX(); + } + + int GetScrollY(int y) const + { + return (y + GetScrollLineY() - 1) / GetScrollLineY(); + } + + + // override some base class functions + virtual bool Enable(bool enable = true); + + + // ------ For compatibility with previous wxGrid only... + // + // ************************************************ + // ** Don't use these in new code because they ** + // ** are liable to disappear in a future ** + // ** revision ** + // ************************************************ + // + + wxGrid( wxWindow *parent, + int x, int y, int w = wxDefaultCoord, int h = wxDefaultCoord, + long style = wxWANTS_CHARS, + const wxString& name = wxPanelNameStr ) + : wxScrolledWindow( parent, wxID_ANY, wxPoint(x,y), wxSize(w,h), + (style|wxWANTS_CHARS), name ) + { + Create(); + } + + void SetCellValue( const wxString& val, int row, int col ) + { SetCellValue( row, col, val ); } + + void UpdateDimensions() + { CalcDimensions(); } + + int GetRows() { return GetNumberRows(); } + int GetCols() { return GetNumberCols(); } + int GetCursorRow() { return GetGridCursorRow(); } + int GetCursorColumn() { return GetGridCursorCol(); } + + int GetScrollPosX() { return 0; } + int GetScrollPosY() { return 0; } + + void SetScrollX( int WXUNUSED(x) ) { } + void SetScrollY( int WXUNUSED(y) ) { } + + void SetColumnWidth( int col, int width ) + { SetColSize( col, width ); } + + int GetColumnWidth( int col ) + { return GetColSize( col ); } + + void SetRowHeight( int row, int height ) + { SetRowSize( row, height ); } + + // GetRowHeight() is below + + int GetViewHeight() // returned num whole rows visible + { return 0; } + + int GetViewWidth() // returned num whole cols visible + { return 0; } + + void SetLabelSize( int orientation, int sz ) + { + if ( orientation == wxHORIZONTAL ) + SetColLabelSize( sz ); + else + SetRowLabelSize( sz ); + } + + int GetLabelSize( int orientation ) + { + if ( orientation == wxHORIZONTAL ) + return GetColLabelSize(); + else + return GetRowLabelSize(); + } + + void SetLabelAlignment( int orientation, int align ) + { + if ( orientation == wxHORIZONTAL ) + SetColLabelAlignment( align, -1 ); + else + SetRowLabelAlignment( align, -1 ); + } + + int GetLabelAlignment( int orientation, int WXUNUSED(align) ) + { + int h, v; + if ( orientation == wxHORIZONTAL ) + { + GetColLabelAlignment( &h, &v ); + return h; + } + else + { + GetRowLabelAlignment( &h, &v ); + return h; + } + } + + void SetLabelValue( int orientation, const wxString& val, int pos ) + { + if ( orientation == wxHORIZONTAL ) + SetColLabelValue( pos, val ); + else + SetRowLabelValue( pos, val ); + } + + wxString GetLabelValue( int orientation, int pos) + { + if ( orientation == wxHORIZONTAL ) + return GetColLabelValue( pos ); + else + return GetRowLabelValue( pos ); + } + + wxFont GetCellTextFont() const + { return m_defaultCellAttr->GetFont(); } + + wxFont GetCellTextFont(int WXUNUSED(row), int WXUNUSED(col)) const + { return m_defaultCellAttr->GetFont(); } + + void SetCellTextFont(const wxFont& fnt) + { SetDefaultCellFont( fnt ); } + + void SetCellTextFont(const wxFont& fnt, int row, int col) + { SetCellFont( row, col, fnt ); } + + void SetCellTextColour(const wxColour& val, int row, int col) + { SetCellTextColour( row, col, val ); } + + void SetCellTextColour(const wxColour& col) + { SetDefaultCellTextColour( col ); } + + void SetCellBackgroundColour(const wxColour& col) + { SetDefaultCellBackgroundColour( col ); } + + void SetCellBackgroundColour(const wxColour& colour, int row, int col) + { SetCellBackgroundColour( row, col, colour ); } + + bool GetEditable() { return IsEditable(); } + void SetEditable( bool edit = true ) { EnableEditing( edit ); } + bool GetEditInPlace() { return IsCellEditControlEnabled(); } + + void SetEditInPlace(bool WXUNUSED(edit) = true) { } + + void SetCellAlignment( int align, int row, int col) + { SetCellAlignment(row, col, align, wxALIGN_CENTER); } + void SetCellAlignment( int WXUNUSED(align) ) {} + void SetCellBitmap(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(row), int WXUNUSED(col)) + { } + void SetDividerPen(const wxPen& WXUNUSED(pen)) { } + wxPen& GetDividerPen() const; + void OnActivate(bool WXUNUSED(active)) {} + + // ******** End of compatibility functions ********** + + + + // ------ control IDs + enum { wxGRID_CELLCTRL = 2000, + wxGRID_TOPCTRL }; + + // ------ control types + enum { wxGRID_TEXTCTRL = 2100, + wxGRID_CHECKBOX, + wxGRID_CHOICE, + wxGRID_COMBOBOX }; + + // overridden wxWindow methods + virtual void Fit(); + +protected: + virtual wxSize DoGetBestSize() const; + + bool m_created; + + wxGridWindow *m_gridWin; + wxGridRowLabelWindow *m_rowLabelWin; + wxGridColLabelWindow *m_colLabelWin; + wxGridCornerLabelWindow *m_cornerLabelWin; + + wxGridTableBase *m_table; + bool m_ownTable; + + int m_numRows; + int m_numCols; + + wxGridCellCoords m_currentCellCoords; + + wxGridCellCoords m_selectingTopLeft; + wxGridCellCoords m_selectingBottomRight; + wxGridCellCoords m_selectingKeyboard; + wxGridSelection *m_selection; + wxColour m_selectionBackground; + wxColour m_selectionForeground; + + // NB: *never* access m_row/col arrays directly because they are created + // on demand, *always* use accessor functions instead! + + // init the m_rowHeights/Bottoms arrays with default values + void InitRowHeights(); + + int m_defaultRowHeight; + int m_minAcceptableRowHeight; + wxArrayInt m_rowHeights; + wxArrayInt m_rowBottoms; + + // init the m_colWidths/Rights arrays + void InitColWidths(); + + int m_defaultColWidth; + int m_minAcceptableColWidth; + wxArrayInt m_colWidths; + wxArrayInt m_colRights; + + // get the col/row coords + int GetColWidth(int col) const; + int GetColLeft(int col) const; + int GetColRight(int col) const; + + // this function must be public for compatibility... +public: + int GetRowHeight(int row) const; +protected: + + int GetRowTop(int row) const; + int GetRowBottom(int row) const; + + int m_rowLabelWidth; + int m_colLabelHeight; + + // the size of the margin left to the right and bottom of the cell area + int m_extraWidth, + m_extraHeight; + + wxColour m_labelBackgroundColour; + wxColour m_labelTextColour; + wxFont m_labelFont; + + int m_rowLabelHorizAlign; + int m_rowLabelVertAlign; + int m_colLabelHorizAlign; + int m_colLabelVertAlign; + int m_colLabelTextOrientation; + + bool m_defaultRowLabelValues; + bool m_defaultColLabelValues; + + wxColour m_gridLineColour; + bool m_gridLinesEnabled; + wxColour m_cellHighlightColour; + int m_cellHighlightPenWidth; + int m_cellHighlightROPenWidth; + + + // common part of AutoSizeColumn/Row() and GetBestSize() + int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = true); + int SetOrCalcRowSizes(bool calcOnly, bool setAsMin = true); + + // common part of AutoSizeColumn/Row() + void AutoSizeColOrRow(int n, bool setAsMin, bool column /* or row? */); + + // if a column has a minimal width, it will be the value for it in this + // hash table + wxLongToLongHashMap m_colMinWidths, + m_rowMinHeights; + + // get the minimal width of the given column/row + int GetColMinimalWidth(int col) const; + int GetRowMinimalHeight(int col) const; + + // do we have some place to store attributes in? + bool CanHaveAttributes(); + + // cell attribute cache (currently we only cache 1, may be will do + // more/better later) + struct CachedAttr + { + int row, col; + wxGridCellAttr *attr; + } m_attrCache; + + // invalidates the attribute cache + void ClearAttrCache(); + + // adds an attribute to cache + void CacheAttr(int row, int col, wxGridCellAttr *attr) const; + + // looks for an attr in cache, returns true if found + bool LookupAttr(int row, int col, wxGridCellAttr **attr) const; + + // looks for the attr in cache, if not found asks the table and caches the + // result + wxGridCellAttr *GetCellAttr(int row, int col) const; + wxGridCellAttr *GetCellAttr(const wxGridCellCoords& coords ) + { return GetCellAttr( coords.GetRow(), coords.GetCol() ); } + + // the default cell attr object for cells that don't have their own + wxGridCellAttr* m_defaultCellAttr; + + + bool m_inOnKeyDown; + int m_batchCount; + + + wxGridTypeRegistry* m_typeRegistry; + + enum CursorMode + { + WXGRID_CURSOR_SELECT_CELL, + WXGRID_CURSOR_RESIZE_ROW, + WXGRID_CURSOR_RESIZE_COL, + WXGRID_CURSOR_SELECT_ROW, + WXGRID_CURSOR_SELECT_COL, + WXGRID_CURSOR_MOVE_COL + }; + + // this method not only sets m_cursorMode but also sets the correct cursor + // for the given mode and, if captureMouse is not false releases the mouse + // if it was captured and captures it if it must be captured + // + // for this to work, you should always use it and not set m_cursorMode + // directly! + void ChangeCursorMode(CursorMode mode, + wxWindow *win = (wxWindow *)NULL, + bool captureMouse = true); + + wxWindow *m_winCapture; // the window which captured the mouse + CursorMode m_cursorMode; + + //Column positions + wxArrayInt m_colAt; + int m_moveToCol; + + bool m_canDragRowSize; + bool m_canDragColSize; + bool m_canDragColMove; + bool m_canDragGridSize; + bool m_canDragCell; + int m_dragLastPos; + int m_dragRowOrCol; + bool m_isDragging; + wxPoint m_startDragPos; + + bool m_waitForSlowClick; + + wxGridCellCoords m_selectionStart; + + wxCursor m_rowResizeCursor; + wxCursor m_colResizeCursor; + + bool m_editable; // applies to whole grid + bool m_cellEditCtrlEnabled; // is in-place edit currently shown? + + int m_scrollLineX; // X scroll increment + int m_scrollLineY; // Y scroll increment + + void Create(); + void Init(); + void CalcDimensions(); + void CalcWindowSizes(); + bool Redimension( wxGridTableMessage& ); + + + int SendEvent( const wxEventType, int row, int col, wxMouseEvent& ); + int SendEvent( const wxEventType, int row, int col ); + int SendEvent( const wxEventType type) + { + return SendEvent(type, + m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol()); + } + + void OnPaint( wxPaintEvent& ); + void OnSize( wxSizeEvent& ); + void OnKeyDown( wxKeyEvent& ); + void OnKeyUp( wxKeyEvent& ); + void OnChar( wxKeyEvent& ); + void OnEraseBackground( wxEraseEvent& ); + + + void SetCurrentCell( const wxGridCellCoords& coords ); + void SetCurrentCell( int row, int col ) + { SetCurrentCell( wxGridCellCoords(row, col) ); } + + void HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCol ); + + void HighlightBlock( const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight ) + { HighlightBlock( topLeft.GetRow(), topLeft.GetCol(), + bottomRight.GetRow(), bottomRight.GetCol() ); } + + // ------ functions to get/send data (see also public functions) + // + bool GetModelValues(); + bool SetModelValues(); + +private: + // Calculate the minimum acceptable size for labels area + wxCoord CalcColOrRowLabelAreaMinSize(bool column /* or row? */); + + friend class WXDLLIMPEXP_FWD_ADV wxGridSelection; + + DECLARE_DYNAMIC_CLASS( wxGrid ) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxGrid) +}; + + +// ---------------------------------------------------------------------------- +// Grid event class and event types +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGridEvent : public wxNotifyEvent +{ +public: + wxGridEvent() + : wxNotifyEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1), + m_selecting(0), m_control(0), m_meta(0), m_shift(0), m_alt(0) + { + } + + wxGridEvent(int id, wxEventType type, wxObject* obj, + int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true, + bool control = false, bool shift = false, bool alt = false, bool meta = false); + + virtual int GetRow() { return m_row; } + virtual int GetCol() { return m_col; } + wxPoint GetPosition() { return wxPoint( m_x, m_y ); } + bool Selecting() { return m_selecting; } + bool ControlDown() { return m_control; } + bool MetaDown() { return m_meta; } + bool ShiftDown() { return m_shift; } + bool AltDown() { return m_alt; } + bool CmdDown() + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + virtual wxEvent *Clone() const { return new wxGridEvent(*this); } + +protected: + int m_row; + int m_col; + int m_x; + int m_y; + bool m_selecting; + bool m_control; + bool m_meta; + bool m_shift; + bool m_alt; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEvent) +}; + +class WXDLLIMPEXP_ADV wxGridSizeEvent : public wxNotifyEvent +{ +public: + wxGridSizeEvent() + : wxNotifyEvent(), m_rowOrCol(-1), m_x(-1), m_y(-1), + m_control(0), m_meta(0), m_shift(0), m_alt(0) + { + } + + wxGridSizeEvent(int id, wxEventType type, wxObject* obj, + int rowOrCol=-1, int x=-1, int y=-1, + bool control = false, bool shift = false, bool alt = false, bool meta = false); + + int GetRowOrCol() { return m_rowOrCol; } + wxPoint GetPosition() { return wxPoint( m_x, m_y ); } + bool ControlDown() { return m_control; } + bool MetaDown() { return m_meta; } + bool ShiftDown() { return m_shift; } + bool AltDown() { return m_alt; } + bool CmdDown() + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + virtual wxEvent *Clone() const { return new wxGridSizeEvent(*this); } + +protected: + int m_rowOrCol; + int m_x; + int m_y; + bool m_control; + bool m_meta; + bool m_shift; + bool m_alt; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridSizeEvent) +}; + + +class WXDLLIMPEXP_ADV wxGridRangeSelectEvent : public wxNotifyEvent +{ +public: + wxGridRangeSelectEvent() + : wxNotifyEvent() + { + m_topLeft = wxGridNoCellCoords; + m_bottomRight = wxGridNoCellCoords; + m_selecting = false; + m_control = false; + m_meta = false; + m_shift = false; + m_alt = false; + } + + wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool sel = true, + bool control = false, bool shift = false, + bool alt = false, bool meta = false); + + wxGridCellCoords GetTopLeftCoords() { return m_topLeft; } + wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; } + int GetTopRow() { return m_topLeft.GetRow(); } + int GetBottomRow() { return m_bottomRight.GetRow(); } + int GetLeftCol() { return m_topLeft.GetCol(); } + int GetRightCol() { return m_bottomRight.GetCol(); } + bool Selecting() { return m_selecting; } + bool ControlDown() { return m_control; } + bool MetaDown() { return m_meta; } + bool ShiftDown() { return m_shift; } + bool AltDown() { return m_alt; } + bool CmdDown() + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + virtual wxEvent *Clone() const { return new wxGridRangeSelectEvent(*this); } + +protected: + wxGridCellCoords m_topLeft; + wxGridCellCoords m_bottomRight; + bool m_selecting; + bool m_control; + bool m_meta; + bool m_shift; + bool m_alt; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridRangeSelectEvent) +}; + + +class WXDLLIMPEXP_ADV wxGridEditorCreatedEvent : public wxCommandEvent { +public: + wxGridEditorCreatedEvent() + : wxCommandEvent() + { + m_row = 0; + m_col = 0; + m_ctrl = NULL; + } + + wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, + int row, int col, wxControl* ctrl); + + int GetRow() { return m_row; } + int GetCol() { return m_col; } + wxControl* GetControl() { return m_ctrl; } + void SetRow(int row) { m_row = row; } + void SetCol(int col) { m_col = col; } + void SetControl(wxControl* ctrl) { m_ctrl = ctrl; } + + virtual wxEvent *Clone() const { return new wxGridEditorCreatedEvent(*this); } + +private: + int m_row; + int m_col; + wxControl* m_ctrl; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEditorCreatedEvent) +}; + + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_CLICK, 1580) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_CLICK, 1581) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_DCLICK, 1582) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_DCLICK, 1583) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_CLICK, 1584) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_CLICK, 1585) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_DCLICK, 1586) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_DCLICK, 1587) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_ROW_SIZE, 1588) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_COL_SIZE, 1589) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_RANGE_SELECT, 1590) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_CHANGE, 1591) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_SELECT_CELL, 1592) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_SHOWN, 1593) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_HIDDEN, 1594) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_CREATED, 1595) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_BEGIN_DRAG, 1596) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_COL_MOVE, 1597) +END_DECLARE_EVENT_TYPES() + + +typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&); +typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&); +typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&); +typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&); + +#define wxGridEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridEventFunction, &func) + +#define wxGridSizeEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridSizeEventFunction, &func) + +#define wxGridRangeSelectEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridRangeSelectEventFunction, &func) + +#define wxGridEditorCreatedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxGridEditorCreatedEventFunction, &func) + +#define wx__DECLARE_GRIDEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEventHandler(fn)) + +#define wx__DECLARE_GRIDSIZEEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridSizeEventHandler(fn)) + +#define wx__DECLARE_GRIDRANGESELEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridRangeSelectEventHandler(fn)) + +#define wx__DECLARE_GRIDEDITOREVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEditorCreatedEventHandler(fn)) + +#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_CLICK, id, fn) +#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_CLICK, id, fn) +#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_DCLICK, id, fn) +#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_DCLICK, id, fn) +#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_CLICK, id, fn) +#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_CLICK, id, fn) +#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_DCLICK, id, fn) +#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_DCLICK, id, fn) +#define EVT_GRID_CMD_ROW_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(ROW_SIZE, id, fn) +#define EVT_GRID_CMD_COL_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_SIZE, id, fn) +#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_MOVE, id, fn) +#define EVT_GRID_CMD_RANGE_SELECT(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECT, id, fn) +#define EVT_GRID_CMD_CELL_CHANGE(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGE, id, fn) +#define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn) +#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_SHOWN, id, fn) +#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_HIDDEN, id, fn) +#define EVT_GRID_CMD_EDITOR_CREATED(id, fn) wx__DECLARE_GRIDEDITOREVT(EDITOR_CREATED, id, fn) +#define EVT_GRID_CMD_CELL_BEGIN_DRAG(id, fn) wx__DECLARE_GRIDEVT(CELL_BEGIN_DRAG, id, fn) + +// same as above but for any id (exists mainly for backwards compatibility but +// then it's also true that you rarely have multiple grid in the same window) +#define EVT_GRID_CELL_LEFT_CLICK(fn) EVT_GRID_CMD_CELL_LEFT_CLICK(wxID_ANY, fn) +#define EVT_GRID_CELL_RIGHT_CLICK(fn) EVT_GRID_CMD_CELL_RIGHT_CLICK(wxID_ANY, fn) +#define EVT_GRID_CELL_LEFT_DCLICK(fn) EVT_GRID_CMD_CELL_LEFT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_CELL_RIGHT_DCLICK(fn) EVT_GRID_CMD_CELL_RIGHT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_LEFT_CLICK(fn) EVT_GRID_CMD_LABEL_LEFT_CLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_RIGHT_CLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_CLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_LEFT_DCLICK(fn) EVT_GRID_CMD_LABEL_LEFT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_ROW_SIZE(fn) EVT_GRID_CMD_ROW_SIZE(wxID_ANY, fn) +#define EVT_GRID_COL_SIZE(fn) EVT_GRID_CMD_COL_SIZE(wxID_ANY, fn) +#define EVT_GRID_COL_MOVE(fn) EVT_GRID_CMD_COL_MOVE(wxID_ANY, fn) +#define EVT_GRID_RANGE_SELECT(fn) EVT_GRID_CMD_RANGE_SELECT(wxID_ANY, fn) +#define EVT_GRID_CELL_CHANGE(fn) EVT_GRID_CMD_CELL_CHANGE(wxID_ANY, fn) +#define EVT_GRID_SELECT_CELL(fn) EVT_GRID_CMD_SELECT_CELL(wxID_ANY, fn) +#define EVT_GRID_EDITOR_SHOWN(fn) EVT_GRID_CMD_EDITOR_SHOWN(wxID_ANY, fn) +#define EVT_GRID_EDITOR_HIDDEN(fn) EVT_GRID_CMD_EDITOR_HIDDEN(wxID_ANY, fn) +#define EVT_GRID_EDITOR_CREATED(fn) EVT_GRID_CMD_EDITOR_CREATED(wxID_ANY, fn) +#define EVT_GRID_CELL_BEGIN_DRAG(fn) EVT_GRID_CMD_CELL_BEGIN_DRAG(wxID_ANY, fn) + +#if 0 // TODO: implement these ? others ? + +extern const int wxEVT_GRID_CREATE_CELL; +extern const int wxEVT_GRID_CHANGE_LABELS; +extern const int wxEVT_GRID_CHANGE_SEL_LABEL; + +#define EVT_GRID_CREATE_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), +#define EVT_GRID_CHANGE_LABELS(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), +#define EVT_GRID_CHANGE_SEL_LABEL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), + +#endif + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRID_H_ diff --git a/Externals/wxWidgets/include/wx/generic/gridctrl.h b/Externals/wxWidgets/include/wx/generic/gridctrl.h index 3f810a9ffe..2581fd288f 100644 --- a/Externals/wxWidgets/include/wx/generic/gridctrl.h +++ b/Externals/wxWidgets/include/wx/generic/gridctrl.h @@ -1,158 +1,158 @@ -/////////////////////////////////////////////////////////////////////////// -// Name: generic/gridctrl.h -// Purpose: wxGrid controls -// Author: Paul Gammans, Roger Gammans -// Modified by: -// Created: 11/04/2001 -// RCS-ID: $Id: gridctrl.h 48089 2007-08-15 11:46:57Z VZ $ -// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_GRIDCTRL_H_ -#define _WX_GENERIC_GRIDCTRL_H_ - -#include "wx/grid.h" - -#if wxUSE_GRID - -#define wxGRID_VALUE_CHOICEINT _T("choiceint") -#define wxGRID_VALUE_DATETIME _T("datetime") - -#if wxUSE_DATETIME - -#include "wx/datetime.h" - -// the default renderer for the cells containing Time and dates.. -class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer -{ -public: - wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat, - const wxString& informat = wxDefaultDateTimeFormat); - - // draw the string right aligned - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - virtual wxGridCellRenderer *Clone() const; - - // parameters string format is "width[,precision]" - virtual void SetParameters(const wxString& params); - -protected: - wxString GetString(const wxGrid& grid, int row, int col); - - wxString m_iformat; - wxString m_oformat; - wxDateTime m_dateDef; - wxDateTime::TimeZone m_tz; -}; - -#endif // wxUSE_DATETIME - -// the default renderer for the cells containing Time and dates.. -class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer -{ -public: - wxGridCellEnumRenderer( const wxString& choices = wxEmptyString ); - - // draw the string right aligned - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - virtual wxGridCellRenderer *Clone() const; - - // parameters string format is "item1[,item2[...,itemN]]" - virtual void SetParameters(const wxString& params); - -protected: - wxString GetString(const wxGrid& grid, int row, int col); - - wxArrayString m_choices; -}; - - -#if wxUSE_COMBOBOX - -class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor -{ -public: - wxGridCellEnumEditor( const wxString& choices = wxEmptyString ); - virtual ~wxGridCellEnumEditor() {} - - virtual wxGridCellEditor* Clone() const; - - virtual bool EndEdit(int row, int col, wxGrid* grid); - virtual void BeginEdit(int row, int col, wxGrid* grid); - -private: - long int m_startint; - - DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor) -}; - -#endif // wxUSE_COMBOBOX - -class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor -{ -public: - wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { } - virtual void Create(wxWindow* parent, - wxWindowID id, - wxEvtHandler* evtHandler); - - virtual wxGridCellEditor *Clone() const - { return new wxGridCellAutoWrapStringEditor; } - - DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor) -}; - -class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer -{ -public: - wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { } - - virtual void Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int row, int col, - bool isSelected); - - virtual wxSize GetBestSize(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - int row, int col); - - virtual wxGridCellRenderer *Clone() const - { return new wxGridCellAutoWrapStringRenderer; } - -private: - wxArrayString GetTextLines( wxGrid& grid, - wxDC& dc, - const wxGridCellAttr& attr, - const wxRect& rect, - int row, int col); - -}; - -#endif // wxUSE_GRID -#endif // _WX_GENERIC_GRIDCTRL_H_ +/////////////////////////////////////////////////////////////////////////// +// Name: generic/gridctrl.h +// Purpose: wxGrid controls +// Author: Paul Gammans, Roger Gammans +// Modified by: +// Created: 11/04/2001 +// RCS-ID: $Id: gridctrl.h 48089 2007-08-15 11:46:57Z VZ $ +// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRIDCTRL_H_ +#define _WX_GENERIC_GRIDCTRL_H_ + +#include "wx/grid.h" + +#if wxUSE_GRID + +#define wxGRID_VALUE_CHOICEINT _T("choiceint") +#define wxGRID_VALUE_DATETIME _T("datetime") + +#if wxUSE_DATETIME + +#include "wx/datetime.h" + +// the default renderer for the cells containing Time and dates.. +class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat, + const wxString& informat = wxDefaultDateTimeFormat); + + // draw the string right aligned + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + virtual wxGridCellRenderer *Clone() const; + + // parameters string format is "width[,precision]" + virtual void SetParameters(const wxString& params); + +protected: + wxString GetString(const wxGrid& grid, int row, int col); + + wxString m_iformat; + wxString m_oformat; + wxDateTime m_dateDef; + wxDateTime::TimeZone m_tz; +}; + +#endif // wxUSE_DATETIME + +// the default renderer for the cells containing Time and dates.. +class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellEnumRenderer( const wxString& choices = wxEmptyString ); + + // draw the string right aligned + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + virtual wxGridCellRenderer *Clone() const; + + // parameters string format is "item1[,item2[...,itemN]]" + virtual void SetParameters(const wxString& params); + +protected: + wxString GetString(const wxGrid& grid, int row, int col); + + wxArrayString m_choices; +}; + + +#if wxUSE_COMBOBOX + +class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor +{ +public: + wxGridCellEnumEditor( const wxString& choices = wxEmptyString ); + virtual ~wxGridCellEnumEditor() {} + + virtual wxGridCellEditor* Clone() const; + + virtual bool EndEdit(int row, int col, wxGrid* grid); + virtual void BeginEdit(int row, int col, wxGrid* grid); + +private: + long int m_startint; + + DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor) +}; + +#endif // wxUSE_COMBOBOX + +class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor +{ +public: + wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { } + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + + virtual wxGridCellEditor *Clone() const + { return new wxGridCellAutoWrapStringEditor; } + + DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor) +}; + +class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { } + + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected); + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col); + + virtual wxGridCellRenderer *Clone() const + { return new wxGridCellAutoWrapStringRenderer; } + +private: + wxArrayString GetTextLines( wxGrid& grid, + wxDC& dc, + const wxGridCellAttr& attr, + const wxRect& rect, + int row, int col); + +}; + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRIDCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/generic/gridsel.h b/Externals/wxWidgets/include/wx/generic/gridsel.h index 9f6d9b29cd..fff21a3684 100644 --- a/Externals/wxWidgets/include/wx/generic/gridsel.h +++ b/Externals/wxWidgets/include/wx/generic/gridsel.h @@ -1,88 +1,88 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/gridsel.h -// Purpose: wxGridSelection -// Author: Stefan Neis -// Modified by: -// Created: 20/02/2000 -// RCS-ID: $$ -// Copyright: (c) Stefan Neis -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_GRIDSEL_H_ -#define _WX_GENERIC_GRIDSEL_H_ - -#include "wx/defs.h" - -#if wxUSE_GRID - -#include "wx/grid.h" - -class WXDLLIMPEXP_ADV wxGridSelection -{ -public: - wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel = - wxGrid::wxGridSelectCells ); - bool IsSelection(); - bool IsInSelection ( int row, int col ); - void SetSelectionMode(wxGrid::wxGridSelectionModes selmode); - wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; } - void SelectRow( int row, - bool ControlDown = false, bool ShiftDown = false, - bool AltDown = false, bool MetaDown = false ); - void SelectCol( int col, - bool ControlDown = false, bool ShiftDown = false, - bool AltDown = false, bool MetaDown = false ); - void SelectBlock( int topRow, int leftCol, - int bottomRow, int rightCol, - bool ControlDown = false, bool ShiftDown = false, - bool AltDown = false, bool MetaDown = false, - bool sendEvent = true ); - void SelectCell( int row, int col, - bool ControlDown = false, bool ShiftDown = false, - bool AltDown = false, bool MetaDown = false, - bool sendEvent = true ); - void ToggleCellSelection( int row, int col, - bool ControlDown = false, - bool ShiftDown = false, - bool AltDown = false, bool MetaDown = false ); - void ClearSelection(); - - void UpdateRows( size_t pos, int numRows ); - void UpdateCols( size_t pos, int numCols ); - -private: - int BlockContain( int topRow1, int leftCol1, - int bottomRow1, int rightCol1, - int topRow2, int leftCol2, - int bottomRow2, int rightCol2 ); - // returns 1, if Block1 contains Block2, - // -1, if Block2 contains Block1, - // 0, otherwise - - int BlockContainsCell( int topRow, int leftCol, - int bottomRow, int rightCol, - int row, int col ) - // returns 1, if Block contains Cell, - // 0, otherwise - { - return ( topRow <= row && row <= bottomRow && - leftCol <= col && col <= rightCol ); - } - - wxGridCellCoordsArray m_cellSelection; - wxGridCellCoordsArray m_blockSelectionTopLeft; - wxGridCellCoordsArray m_blockSelectionBottomRight; - wxArrayInt m_rowSelection; - wxArrayInt m_colSelection; - - wxGrid *m_grid; - wxGrid::wxGridSelectionModes m_selectionMode; - - friend class WXDLLIMPEXP_FWD_ADV wxGrid; - - DECLARE_NO_COPY_CLASS(wxGridSelection) -}; - -#endif // wxUSE_GRID -#endif // _WX_GENERIC_GRIDSEL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/gridsel.h +// Purpose: wxGridSelection +// Author: Stefan Neis +// Modified by: +// Created: 20/02/2000 +// RCS-ID: $$ +// Copyright: (c) Stefan Neis +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRIDSEL_H_ +#define _WX_GENERIC_GRIDSEL_H_ + +#include "wx/defs.h" + +#if wxUSE_GRID + +#include "wx/grid.h" + +class WXDLLIMPEXP_ADV wxGridSelection +{ +public: + wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel = + wxGrid::wxGridSelectCells ); + bool IsSelection(); + bool IsInSelection ( int row, int col ); + void SetSelectionMode(wxGrid::wxGridSelectionModes selmode); + wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; } + void SelectRow( int row, + bool ControlDown = false, bool ShiftDown = false, + bool AltDown = false, bool MetaDown = false ); + void SelectCol( int col, + bool ControlDown = false, bool ShiftDown = false, + bool AltDown = false, bool MetaDown = false ); + void SelectBlock( int topRow, int leftCol, + int bottomRow, int rightCol, + bool ControlDown = false, bool ShiftDown = false, + bool AltDown = false, bool MetaDown = false, + bool sendEvent = true ); + void SelectCell( int row, int col, + bool ControlDown = false, bool ShiftDown = false, + bool AltDown = false, bool MetaDown = false, + bool sendEvent = true ); + void ToggleCellSelection( int row, int col, + bool ControlDown = false, + bool ShiftDown = false, + bool AltDown = false, bool MetaDown = false ); + void ClearSelection(); + + void UpdateRows( size_t pos, int numRows ); + void UpdateCols( size_t pos, int numCols ); + +private: + int BlockContain( int topRow1, int leftCol1, + int bottomRow1, int rightCol1, + int topRow2, int leftCol2, + int bottomRow2, int rightCol2 ); + // returns 1, if Block1 contains Block2, + // -1, if Block2 contains Block1, + // 0, otherwise + + int BlockContainsCell( int topRow, int leftCol, + int bottomRow, int rightCol, + int row, int col ) + // returns 1, if Block contains Cell, + // 0, otherwise + { + return ( topRow <= row && row <= bottomRow && + leftCol <= col && col <= rightCol ); + } + + wxGridCellCoordsArray m_cellSelection; + wxGridCellCoordsArray m_blockSelectionTopLeft; + wxGridCellCoordsArray m_blockSelectionBottomRight; + wxArrayInt m_rowSelection; + wxArrayInt m_colSelection; + + wxGrid *m_grid; + wxGrid::wxGridSelectionModes m_selectionMode; + + friend class WXDLLIMPEXP_FWD_ADV wxGrid; + + DECLARE_NO_COPY_CLASS(wxGridSelection) +}; + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRIDSEL_H_ diff --git a/Externals/wxWidgets/include/wx/generic/helpext.h b/Externals/wxWidgets/include/wx/generic/helpext.h index f5ba978d1f..62d5c67482 100644 --- a/Externals/wxWidgets/include/wx/generic/helpext.h +++ b/Externals/wxWidgets/include/wx/generic/helpext.h @@ -1,166 +1,166 @@ -/*-*- c++ -*-******************************************************** - * helpext.h - an external help controller for wxWidgets * - * * - * (C) 1998 by Karsten Ballueder (Ballueder@usa.net) * - * License: wxWindows licence * - * * - * $Id: helpext.h 50711 2007-12-15 02:57:58Z VZ $ - *******************************************************************/ - -#ifndef __WX_HELPEXT_H_ -#define __WX_HELPEXT_H_ - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -/** - This class implements help via an external browser. - It requires the name of a directory containing the documentation - and a file mapping numerical Section numbers to relative URLS. - - The map file contains two or three fields per line: - numeric_id relative_URL [; comment/documentation] - - The numeric_id is the id used to look up the entry in - DisplaySection()/DisplayBlock(). The relative_URL is a filename of - an html file, relative to the help directory. The optional - comment/documentation field (after a ';') is used for keyword - searches, so some meaningful text here does not hurt. - If the documentation itself contains a ';', only the part before - that will be displayed in the listbox, but all of it used for search. - - Lines starting with ';' will be ignored. -*/ - -class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase -{ -public: - wxExtHelpController(wxWindow* parentWindow = NULL); - virtual ~wxExtHelpController(); - - /** Tell it which browser to use. - The Netscape support will check whether Netscape is already - running (by looking at the .netscape/lock file in the user's - home directory) and tell it to load the page into the existing - window. - @param browsername The command to call a browser/html viewer. - @param isNetscape Set this to true if the browser is some variant of Netscape. - */ - void SetBrowser(const wxString& browsername = wxEmptyString, - bool isNetscape = false); - - // Set viewer: new name for SetBrowser - virtual void SetViewer(const wxString& viewer = wxEmptyString, - long flags = wxHELP_NETSCAPE); - - /** This must be called to tell the controller where to find the - documentation. - If a locale is set, look in file/localename, i.e. - If passed "/usr/local/myapp/help" and the current wxLocale is - set to be "de", then look in "/usr/local/myapp/help/de/" - first and fall back to "/usr/local/myapp/help" if that - doesn't exist. - - @param file - NOT a filename, but a directory name. - @return true on success - */ - virtual bool Initialize(const wxString& dir, int WXUNUSED(server)) - { return Initialize(dir); } - - /** This must be called to tell the controller where to find the - documentation. - If a locale is set, look in file/localename, i.e. - If passed "/usr/local/myapp/help" and the current wxLocale is - set to be "de", then look in "/usr/local/myapp/help/de/" - first and fall back to "/usr/local/myapp/help" if that - doesn't exist. - @param dir - directory name where to fine the help files - @return true on success - */ - virtual bool Initialize(const wxString& dir); - - /** If file is "", reloads file given in Initialize. - @file Name of help directory. - @return true on success - */ - virtual bool LoadFile(const wxString& file = wxEmptyString); - - /** Display list of all help entries. - @return true on success - */ - virtual bool DisplayContents(void); - /** Display help for id sectionNo. - @return true on success - */ - virtual bool DisplaySection(int sectionNo); - /** Display help for id sectionNo -- identical with DisplaySection(). - @return true on success - */ - virtual bool DisplaySection(const wxString& section); - /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch) - @return true on success - */ - virtual bool DisplayBlock(long blockNo); - /** Search comment/documentation fields in map file and present a - list to chose from. - @key k string to search for, empty string will list all entries - @return true on success - */ - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - - /// does nothing - virtual bool Quit(void); - /// does nothing - virtual void OnQuit(void); - - /// Call the browser using a relative URL. - virtual bool DisplayHelp(const wxString &) ; - - /// Allows one to override the default settings for the help frame. - virtual void SetFrameParameters(const wxString& WXUNUSED(title), - const wxSize& WXUNUSED(size), - const wxPoint& WXUNUSED(pos) = wxDefaultPosition, - bool WXUNUSED(newFrameEachTime) = false) - { - // does nothing by default - } - /// Obtains the latest settings used by the help frame and the help - /// frame. - virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, - wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) - { - return (wxFrame*) NULL;// does nothing by default - } - -protected: - /// Filename of currently active map file. - wxString m_helpDir; - /// How many entries do we have in the map file? - int m_NumOfEntries; - /// A list containing all id,url,documentation triples. - wxList *m_MapList; - -private: - // parse a single line of the map file (called by LoadFile()) - // - // return true if the line was valid or false otherwise - bool ParseMapFileLine(const wxString& line); - - /// Deletes the list and all objects. - void DeleteList(void); - - - /// How to call the html viewer. - wxString m_BrowserName; - /// Is the viewer a variant of netscape? - bool m_BrowserIsNetscape; - - DECLARE_CLASS(wxExtHelpController) -}; - -#endif // wxUSE_HELP - -#endif // __WX_HELPEXT_H_ +/*-*- c++ -*-******************************************************** + * helpext.h - an external help controller for wxWidgets * + * * + * (C) 1998 by Karsten Ballueder (Ballueder@usa.net) * + * License: wxWindows licence * + * * + * $Id: helpext.h 50711 2007-12-15 02:57:58Z VZ $ + *******************************************************************/ + +#ifndef __WX_HELPEXT_H_ +#define __WX_HELPEXT_H_ + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +/** + This class implements help via an external browser. + It requires the name of a directory containing the documentation + and a file mapping numerical Section numbers to relative URLS. + + The map file contains two or three fields per line: + numeric_id relative_URL [; comment/documentation] + + The numeric_id is the id used to look up the entry in + DisplaySection()/DisplayBlock(). The relative_URL is a filename of + an html file, relative to the help directory. The optional + comment/documentation field (after a ';') is used for keyword + searches, so some meaningful text here does not hurt. + If the documentation itself contains a ';', only the part before + that will be displayed in the listbox, but all of it used for search. + + Lines starting with ';' will be ignored. +*/ + +class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase +{ +public: + wxExtHelpController(wxWindow* parentWindow = NULL); + virtual ~wxExtHelpController(); + + /** Tell it which browser to use. + The Netscape support will check whether Netscape is already + running (by looking at the .netscape/lock file in the user's + home directory) and tell it to load the page into the existing + window. + @param browsername The command to call a browser/html viewer. + @param isNetscape Set this to true if the browser is some variant of Netscape. + */ + void SetBrowser(const wxString& browsername = wxEmptyString, + bool isNetscape = false); + + // Set viewer: new name for SetBrowser + virtual void SetViewer(const wxString& viewer = wxEmptyString, + long flags = wxHELP_NETSCAPE); + + /** This must be called to tell the controller where to find the + documentation. + If a locale is set, look in file/localename, i.e. + If passed "/usr/local/myapp/help" and the current wxLocale is + set to be "de", then look in "/usr/local/myapp/help/de/" + first and fall back to "/usr/local/myapp/help" if that + doesn't exist. + + @param file - NOT a filename, but a directory name. + @return true on success + */ + virtual bool Initialize(const wxString& dir, int WXUNUSED(server)) + { return Initialize(dir); } + + /** This must be called to tell the controller where to find the + documentation. + If a locale is set, look in file/localename, i.e. + If passed "/usr/local/myapp/help" and the current wxLocale is + set to be "de", then look in "/usr/local/myapp/help/de/" + first and fall back to "/usr/local/myapp/help" if that + doesn't exist. + @param dir - directory name where to fine the help files + @return true on success + */ + virtual bool Initialize(const wxString& dir); + + /** If file is "", reloads file given in Initialize. + @file Name of help directory. + @return true on success + */ + virtual bool LoadFile(const wxString& file = wxEmptyString); + + /** Display list of all help entries. + @return true on success + */ + virtual bool DisplayContents(void); + /** Display help for id sectionNo. + @return true on success + */ + virtual bool DisplaySection(int sectionNo); + /** Display help for id sectionNo -- identical with DisplaySection(). + @return true on success + */ + virtual bool DisplaySection(const wxString& section); + /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch) + @return true on success + */ + virtual bool DisplayBlock(long blockNo); + /** Search comment/documentation fields in map file and present a + list to chose from. + @key k string to search for, empty string will list all entries + @return true on success + */ + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + + /// does nothing + virtual bool Quit(void); + /// does nothing + virtual void OnQuit(void); + + /// Call the browser using a relative URL. + virtual bool DisplayHelp(const wxString &) ; + + /// Allows one to override the default settings for the help frame. + virtual void SetFrameParameters(const wxString& WXUNUSED(title), + const wxSize& WXUNUSED(size), + const wxPoint& WXUNUSED(pos) = wxDefaultPosition, + bool WXUNUSED(newFrameEachTime) = false) + { + // does nothing by default + } + /// Obtains the latest settings used by the help frame and the help + /// frame. + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, + wxPoint *WXUNUSED(pos) = NULL, + bool *WXUNUSED(newFrameEachTime) = NULL) + { + return (wxFrame*) NULL;// does nothing by default + } + +protected: + /// Filename of currently active map file. + wxString m_helpDir; + /// How many entries do we have in the map file? + int m_NumOfEntries; + /// A list containing all id,url,documentation triples. + wxList *m_MapList; + +private: + // parse a single line of the map file (called by LoadFile()) + // + // return true if the line was valid or false otherwise + bool ParseMapFileLine(const wxString& line); + + /// Deletes the list and all objects. + void DeleteList(void); + + + /// How to call the html viewer. + wxString m_BrowserName; + /// Is the viewer a variant of netscape? + bool m_BrowserIsNetscape; + + DECLARE_CLASS(wxExtHelpController) +}; + +#endif // wxUSE_HELP + +#endif // __WX_HELPEXT_H_ diff --git a/Externals/wxWidgets/include/wx/generic/icon.h b/Externals/wxWidgets/include/wx/generic/icon.h index ae8e5f9513..de7d23834a 100644 --- a/Externals/wxWidgets/include/wx/generic/icon.h +++ b/Externals/wxWidgets/include/wx/generic/icon.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/icon.h -// Purpose: wxIcon implementation for ports where it's same as wxBitmap -// Author: Julian Smart -// Modified by: -// Created: 17/09/98 -// RCS-ID: $Id: icon.h 42752 2006-10-30 19:26:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_ICON_H_ -#define _WX_GENERIC_ICON_H_ - -#include "wx/bitmap.h" - -//----------------------------------------------------------------------------- -// wxIcon -//----------------------------------------------------------------------------- - -#ifndef wxICON_DEFAULT_BITMAP_TYPE -#define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_XPM -#endif - -class WXDLLIMPEXP_CORE wxIcon: public wxBitmap -{ -public: - wxIcon(); - - wxIcon( const char **bits, int width=-1, int height=-1 ); - wxIcon( char **bits, int width=-1, int height=-1 ); - - // For compatibility with wxMSW where desired size is sometimes required to - // distinguish between multiple icons in a resource. - wxIcon( const wxString& filename, - wxBitmapType type = wxICON_DEFAULT_BITMAP_TYPE, - int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : - wxBitmap(filename, type) - { - } - - wxIcon(const wxIconLocation& loc) - : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_ANY) - { - } - - // create from bitmap (which should have a mask unless it's monochrome): - // there shouldn't be any implicit bitmap -> icon conversion (i.e. no - // ctors, assignment operators...), but it's ok to have such function - void CopyFromBitmap(const wxBitmap& bmp); - -private: - DECLARE_DYNAMIC_CLASS(wxIcon) -}; - -#endif // _WX_GENERIC_ICON_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/icon.h +// Purpose: wxIcon implementation for ports where it's same as wxBitmap +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// RCS-ID: $Id: icon.h 42752 2006-10-30 19:26:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ICON_H_ +#define _WX_GENERIC_ICON_H_ + +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// wxIcon +//----------------------------------------------------------------------------- + +#ifndef wxICON_DEFAULT_BITMAP_TYPE +#define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_XPM +#endif + +class WXDLLIMPEXP_CORE wxIcon: public wxBitmap +{ +public: + wxIcon(); + + wxIcon( const char **bits, int width=-1, int height=-1 ); + wxIcon( char **bits, int width=-1, int height=-1 ); + + // For compatibility with wxMSW where desired size is sometimes required to + // distinguish between multiple icons in a resource. + wxIcon( const wxString& filename, + wxBitmapType type = wxICON_DEFAULT_BITMAP_TYPE, + int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : + wxBitmap(filename, type) + { + } + + wxIcon(const wxIconLocation& loc) + : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_ANY) + { + } + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); + +private: + DECLARE_DYNAMIC_CLASS(wxIcon) +}; + +#endif // _WX_GENERIC_ICON_H_ diff --git a/Externals/wxWidgets/include/wx/generic/imaglist.h b/Externals/wxWidgets/include/wx/generic/imaglist.h index 3b422dbf08..92db6dc872 100644 --- a/Externals/wxWidgets/include/wx/generic/imaglist.h +++ b/Externals/wxWidgets/include/wx/generic/imaglist.h @@ -1,82 +1,82 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/imaglist.h -// Purpose: -// Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __IMAGELISTH_G__ -#define __IMAGELISTH_G__ - -#include "wx/defs.h" -#include "wx/list.h" -#include "wx/icon.h" - -class WXDLLEXPORT wxDC; -class WXDLLEXPORT wxBitmap; -class WXDLLEXPORT wxColour; - - -class WXDLLEXPORT wxGenericImageList: public wxObject -{ -public: - wxGenericImageList() { m_width = m_height = 0; } - wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); - virtual ~wxGenericImageList(); - bool Create( int width, int height, bool mask = true, int initialCount = 1 ); - bool Create(); - - virtual int GetImageCount() const; - virtual bool GetSize( int index, int &width, int &height ) const; - - int Add( const wxBitmap& bitmap ); - int Add( const wxBitmap& bitmap, const wxBitmap& mask ); - int Add( const wxBitmap& bitmap, const wxColour& maskColour ); - wxBitmap GetBitmap(int index) const; - wxIcon GetIcon(int index) const; - bool Replace( int index, const wxBitmap &bitmap ); - bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask ); - bool Remove( int index ); - bool RemoveAll(); - - virtual bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, - bool solidBackground = false); - - // Internal use only - const wxBitmap *GetBitmapPtr(int index) const; -private: - wxList m_images; - - int m_width; - int m_height; - - DECLARE_DYNAMIC_CLASS(wxGenericImageList) -}; - -#ifndef wxHAS_NATIVE_IMAGELIST - -/* - * wxImageList has to be a real class or we have problems with - * the run-time information. - */ - -class WXDLLEXPORT wxImageList: public wxGenericImageList -{ - DECLARE_DYNAMIC_CLASS(wxImageList) - -public: - wxImageList() {} - - wxImageList( int width, int height, bool mask = true, int initialCount = 1 ) - : wxGenericImageList(width, height, mask, initialCount) - { - } -}; -#endif // !wxHAS_NATIVE_IMAGELIST - -#endif // __IMAGELISTH_G__ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/imaglist.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __IMAGELISTH_G__ +#define __IMAGELISTH_G__ + +#include "wx/defs.h" +#include "wx/list.h" +#include "wx/icon.h" + +class WXDLLEXPORT wxDC; +class WXDLLEXPORT wxBitmap; +class WXDLLEXPORT wxColour; + + +class WXDLLEXPORT wxGenericImageList: public wxObject +{ +public: + wxGenericImageList() { m_width = m_height = 0; } + wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); + virtual ~wxGenericImageList(); + bool Create( int width, int height, bool mask = true, int initialCount = 1 ); + bool Create(); + + virtual int GetImageCount() const; + virtual bool GetSize( int index, int &width, int &height ) const; + + int Add( const wxBitmap& bitmap ); + int Add( const wxBitmap& bitmap, const wxBitmap& mask ); + int Add( const wxBitmap& bitmap, const wxColour& maskColour ); + wxBitmap GetBitmap(int index) const; + wxIcon GetIcon(int index) const; + bool Replace( int index, const wxBitmap &bitmap ); + bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask ); + bool Remove( int index ); + bool RemoveAll(); + + virtual bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = false); + + // Internal use only + const wxBitmap *GetBitmapPtr(int index) const; +private: + wxList m_images; + + int m_width; + int m_height; + + DECLARE_DYNAMIC_CLASS(wxGenericImageList) +}; + +#ifndef wxHAS_NATIVE_IMAGELIST + +/* + * wxImageList has to be a real class or we have problems with + * the run-time information. + */ + +class WXDLLEXPORT wxImageList: public wxGenericImageList +{ + DECLARE_DYNAMIC_CLASS(wxImageList) + +public: + wxImageList() {} + + wxImageList( int width, int height, bool mask = true, int initialCount = 1 ) + : wxGenericImageList(width, height, mask, initialCount) + { + } +}; +#endif // !wxHAS_NATIVE_IMAGELIST + +#endif // __IMAGELISTH_G__ + diff --git a/Externals/wxWidgets/include/wx/generic/laywin.h b/Externals/wxWidgets/include/wx/generic/laywin.h index 9031174384..ffb1f1a8d1 100644 --- a/Externals/wxWidgets/include/wx/generic/laywin.h +++ b/Externals/wxWidgets/include/wx/generic/laywin.h @@ -1,222 +1,222 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: laywin.h -// Purpose: Implements a simple layout algorithm, plus -// wxSashLayoutWindow which is an example of a window with -// layout-awareness (via event handlers). This is suited to -// IDE-style window layout. -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: laywin.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LAYWIN_H_G_ -#define _WX_LAYWIN_H_G_ - -#if wxUSE_SASH - #include "wx/sashwin.h" -#endif // wxUSE_SASH - -#include "wx/event.h" - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_QUERY_LAYOUT_INFO, 1500) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALCULATE_LAYOUT, 1501) -END_DECLARE_EVENT_TYPES() - -enum wxLayoutOrientation -{ - wxLAYOUT_HORIZONTAL, - wxLAYOUT_VERTICAL -}; - -enum wxLayoutAlignment -{ - wxLAYOUT_NONE, - wxLAYOUT_TOP, - wxLAYOUT_LEFT, - wxLAYOUT_RIGHT, - wxLAYOUT_BOTTOM -}; - -// Not sure this is necessary -// Tell window which dimension we're sizing on -#define wxLAYOUT_LENGTH_Y 0x0008 -#define wxLAYOUT_LENGTH_X 0x0000 - -// Use most recently used length -#define wxLAYOUT_MRU_LENGTH 0x0010 - -// Only a query, so don't actually move it. -#define wxLAYOUT_QUERY 0x0100 - -/* - * This event is used to get information about window alignment, - * orientation and size. - */ - -class WXDLLIMPEXP_ADV wxQueryLayoutInfoEvent: public wxEvent -{ -public: - wxQueryLayoutInfoEvent(wxWindowID id = 0) - { - SetEventType(wxEVT_QUERY_LAYOUT_INFO); - m_requestedLength = 0; - m_flags = 0; - m_id = id; - m_alignment = wxLAYOUT_TOP; - m_orientation = wxLAYOUT_HORIZONTAL; - } - - // Read by the app - void SetRequestedLength(int length) { m_requestedLength = length; } - int GetRequestedLength() const { return m_requestedLength; } - - void SetFlags(int flags) { m_flags = flags; } - int GetFlags() const { return m_flags; } - - // Set by the app - void SetSize(const wxSize& size) { m_size = size; } - wxSize GetSize() const { return m_size; } - - void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } - wxLayoutOrientation GetOrientation() const { return m_orientation; } - - void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } - wxLayoutAlignment GetAlignment() const { return m_alignment; } - - virtual wxEvent *Clone() const { return new wxQueryLayoutInfoEvent(*this); } - -protected: - int m_flags; - int m_requestedLength; - wxSize m_size; - wxLayoutOrientation m_orientation; - wxLayoutAlignment m_alignment; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryLayoutInfoEvent) -}; - -typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&); - -#define EVT_QUERY_LAYOUT_INFO(func) \ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxQueryLayoutInfoEventFunction, & func ), NULL ), - -/* - * This event is used to take a bite out of the available client area. - */ - -class WXDLLIMPEXP_ADV wxCalculateLayoutEvent: public wxEvent -{ -public: - wxCalculateLayoutEvent(wxWindowID id = 0) - { - SetEventType(wxEVT_CALCULATE_LAYOUT); - m_flags = 0; - m_id = id; - } - - // Read by the app - void SetFlags(int flags) { m_flags = flags; } - int GetFlags() const { return m_flags; } - - // Set by the app - void SetRect(const wxRect& rect) { m_rect = rect; } - wxRect GetRect() const { return m_rect; } - - virtual wxEvent *Clone() const { return new wxCalculateLayoutEvent(*this); } - -protected: - int m_flags; - wxRect m_rect; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalculateLayoutEvent) -}; - -typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&); - -#define EVT_CALCULATE_LAYOUT(func) \ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCalculateLayoutEventFunction, & func ), NULL ), - -#if wxUSE_SASH - -// This is window that can remember alignment/orientation, does its own layout, -// and can provide sashes too. Useful for implementing docked windows with sashes in -// an IDE-style interface. -class WXDLLIMPEXP_ADV wxSashLayoutWindow: public wxSashWindow -{ -public: - wxSashLayoutWindow() - { - Init(); - } - - wxSashLayoutWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow")) - { - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow")); - -// Accessors - inline wxLayoutAlignment GetAlignment() const { return m_alignment; } - inline wxLayoutOrientation GetOrientation() const { return m_orientation; } - - inline void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } - inline void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } - - // Give the window default dimensions - inline void SetDefaultSize(const wxSize& size) { m_defaultSize = size; } - -// Event handlers - // Called by layout algorithm to allow window to take a bit out of the - // client rectangle, and size itself if not in wxLAYOUT_QUERY mode. - void OnCalculateLayout(wxCalculateLayoutEvent& event); - - // Called by layout algorithm to retrieve information about the window. - void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event); - -private: - void Init(); - - wxLayoutAlignment m_alignment; - wxLayoutOrientation m_orientation; - wxSize m_defaultSize; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSashLayoutWindow) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_SASH - -class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; -class WXDLLIMPEXP_FWD_CORE wxFrame; - -// This class implements the layout algorithm -class WXDLLIMPEXP_ADV wxLayoutAlgorithm: public wxObject -{ -public: - wxLayoutAlgorithm() {} - -#if wxUSE_MDI_ARCHITECTURE - // The MDI client window is sized to whatever's left over. - bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = (wxRect*) NULL); -#endif // wxUSE_MDI_ARCHITECTURE - - // mainWindow is sized to whatever's left over. This function for backward - // compatibility; use LayoutWindow. - bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL); - - // mainWindow is sized to whatever's left over. - bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL); -}; - -#endif - // _WX_LAYWIN_H_G_ +///////////////////////////////////////////////////////////////////////////// +// Name: laywin.h +// Purpose: Implements a simple layout algorithm, plus +// wxSashLayoutWindow which is an example of a window with +// layout-awareness (via event handlers). This is suited to +// IDE-style window layout. +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id: laywin.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LAYWIN_H_G_ +#define _WX_LAYWIN_H_G_ + +#if wxUSE_SASH + #include "wx/sashwin.h" +#endif // wxUSE_SASH + +#include "wx/event.h" + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_QUERY_LAYOUT_INFO, 1500) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_CALCULATE_LAYOUT, 1501) +END_DECLARE_EVENT_TYPES() + +enum wxLayoutOrientation +{ + wxLAYOUT_HORIZONTAL, + wxLAYOUT_VERTICAL +}; + +enum wxLayoutAlignment +{ + wxLAYOUT_NONE, + wxLAYOUT_TOP, + wxLAYOUT_LEFT, + wxLAYOUT_RIGHT, + wxLAYOUT_BOTTOM +}; + +// Not sure this is necessary +// Tell window which dimension we're sizing on +#define wxLAYOUT_LENGTH_Y 0x0008 +#define wxLAYOUT_LENGTH_X 0x0000 + +// Use most recently used length +#define wxLAYOUT_MRU_LENGTH 0x0010 + +// Only a query, so don't actually move it. +#define wxLAYOUT_QUERY 0x0100 + +/* + * This event is used to get information about window alignment, + * orientation and size. + */ + +class WXDLLIMPEXP_ADV wxQueryLayoutInfoEvent: public wxEvent +{ +public: + wxQueryLayoutInfoEvent(wxWindowID id = 0) + { + SetEventType(wxEVT_QUERY_LAYOUT_INFO); + m_requestedLength = 0; + m_flags = 0; + m_id = id; + m_alignment = wxLAYOUT_TOP; + m_orientation = wxLAYOUT_HORIZONTAL; + } + + // Read by the app + void SetRequestedLength(int length) { m_requestedLength = length; } + int GetRequestedLength() const { return m_requestedLength; } + + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + // Set by the app + void SetSize(const wxSize& size) { m_size = size; } + wxSize GetSize() const { return m_size; } + + void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } + wxLayoutOrientation GetOrientation() const { return m_orientation; } + + void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } + wxLayoutAlignment GetAlignment() const { return m_alignment; } + + virtual wxEvent *Clone() const { return new wxQueryLayoutInfoEvent(*this); } + +protected: + int m_flags; + int m_requestedLength; + wxSize m_size; + wxLayoutOrientation m_orientation; + wxLayoutAlignment m_alignment; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryLayoutInfoEvent) +}; + +typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&); + +#define EVT_QUERY_LAYOUT_INFO(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxQueryLayoutInfoEventFunction, & func ), NULL ), + +/* + * This event is used to take a bite out of the available client area. + */ + +class WXDLLIMPEXP_ADV wxCalculateLayoutEvent: public wxEvent +{ +public: + wxCalculateLayoutEvent(wxWindowID id = 0) + { + SetEventType(wxEVT_CALCULATE_LAYOUT); + m_flags = 0; + m_id = id; + } + + // Read by the app + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + // Set by the app + void SetRect(const wxRect& rect) { m_rect = rect; } + wxRect GetRect() const { return m_rect; } + + virtual wxEvent *Clone() const { return new wxCalculateLayoutEvent(*this); } + +protected: + int m_flags; + wxRect m_rect; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalculateLayoutEvent) +}; + +typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&); + +#define EVT_CALCULATE_LAYOUT(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCalculateLayoutEventFunction, & func ), NULL ), + +#if wxUSE_SASH + +// This is window that can remember alignment/orientation, does its own layout, +// and can provide sashes too. Useful for implementing docked windows with sashes in +// an IDE-style interface. +class WXDLLIMPEXP_ADV wxSashLayoutWindow: public wxSashWindow +{ +public: + wxSashLayoutWindow() + { + Init(); + } + + wxSashLayoutWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow")) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow")); + +// Accessors + inline wxLayoutAlignment GetAlignment() const { return m_alignment; } + inline wxLayoutOrientation GetOrientation() const { return m_orientation; } + + inline void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } + inline void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } + + // Give the window default dimensions + inline void SetDefaultSize(const wxSize& size) { m_defaultSize = size; } + +// Event handlers + // Called by layout algorithm to allow window to take a bit out of the + // client rectangle, and size itself if not in wxLAYOUT_QUERY mode. + void OnCalculateLayout(wxCalculateLayoutEvent& event); + + // Called by layout algorithm to retrieve information about the window. + void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event); + +private: + void Init(); + + wxLayoutAlignment m_alignment; + wxLayoutOrientation m_orientation; + wxSize m_defaultSize; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSashLayoutWindow) + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_SASH + +class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; +class WXDLLIMPEXP_FWD_CORE wxFrame; + +// This class implements the layout algorithm +class WXDLLIMPEXP_ADV wxLayoutAlgorithm: public wxObject +{ +public: + wxLayoutAlgorithm() {} + +#if wxUSE_MDI_ARCHITECTURE + // The MDI client window is sized to whatever's left over. + bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = (wxRect*) NULL); +#endif // wxUSE_MDI_ARCHITECTURE + + // mainWindow is sized to whatever's left over. This function for backward + // compatibility; use LayoutWindow. + bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL); + + // mainWindow is sized to whatever's left over. + bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL); +}; + +#endif + // _WX_LAYWIN_H_G_ diff --git a/Externals/wxWidgets/include/wx/generic/listctrl.h b/Externals/wxWidgets/include/wx/generic/listctrl.h index bb80211d26..410964925b 100644 --- a/Externals/wxWidgets/include/wx/generic/listctrl.h +++ b/Externals/wxWidgets/include/wx/generic/listctrl.h @@ -1,281 +1,281 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/listctrl.h -// Purpose: Generic list control -// Author: Robert Roebling -// Created: 01/02/97 -// RCS-ID: $Id: listctrl.h 46432 2007-06-13 03:46:20Z SC $ -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_LISTCTRL_H_ -#define _WX_GENERIC_LISTCTRL_H_ - -#include "wx/textctrl.h" - -class WXDLLIMPEXP_CORE wxImageList; - -#if wxUSE_DRAG_AND_DROP -class WXDLLEXPORT wxDropTarget; -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - - -//----------------------------------------------------------------------------- -// internal classes -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxListHeaderWindow; -class WXDLLEXPORT wxListMainWindow; - -//----------------------------------------------------------------------------- -// wxListCtrl -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericListCtrl: public wxControl -{ -public: - - wxGenericListCtrl(); - wxGenericListCtrl( wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString &name = wxListCtrlNameStr) - { - Create(parent, winid, pos, size, style, validator, name); - } - virtual ~wxGenericListCtrl(); - - bool Create( wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString &name = wxListCtrlNameStr); - - bool GetColumn( int col, wxListItem& item ) const; - bool SetColumn( int col, wxListItem& item ); - int GetColumnWidth( int col ) const; - bool SetColumnWidth( int col, int width); - int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think - wxRect GetViewRect() const; - - bool GetItem( wxListItem& info ) const; - bool SetItem( wxListItem& info ) ; - long SetItem( long index, int col, const wxString& label, int imageId = -1 ); - int GetItemState( long item, long stateMask ) const; - bool SetItemState( long item, long state, long stateMask); - bool SetItemImage( long item, int image, int selImage = -1 ); - bool SetItemColumnImage( long item, long column, int image ); - wxString GetItemText( long item ) const; - void SetItemText( long item, const wxString& str ); - wxUIntPtr GetItemData( long item ) const; -#if wxABI_VERSION >= 20804 - bool SetItemPtrData(long item, wxUIntPtr data); -#endif // wxABI 2.8.4+ - bool SetItemData(long item, long data); - bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const; - bool GetItemPosition( long item, wxPoint& pos ) const; - bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC - int GetItemCount() const; - int GetColumnCount() const; - void SetItemSpacing( int spacing, bool isSmall = false ); - wxSize GetItemSpacing() const; - void SetItemTextColour( long item, const wxColour& col); - wxColour GetItemTextColour( long item ) const; - void SetItemBackgroundColour( long item, const wxColour &col); - wxColour GetItemBackgroundColour( long item ) const; - void SetItemFont( long item, const wxFont &f); - wxFont GetItemFont( long item ) const; - int GetSelectedItemCount() const; - wxColour GetTextColour() const; - void SetTextColour(const wxColour& col); - long GetTopItem() const; - - void SetSingleStyle( long style, bool add = true ) ; - void SetWindowStyleFlag( long style ); - void RecreateWindow() {} - long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const; - wxImageList *GetImageList( int which ) const; - void SetImageList( wxImageList *imageList, int which ); - void AssignImageList( wxImageList *imageList, int which ); - bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC - - void ClearAll(); - bool DeleteItem( long item ); - bool DeleteAllItems(); - bool DeleteAllColumns(); - bool DeleteColumn( int col ); - - void SetItemCount(long count); - - wxTextCtrl *EditLabel(long item, - wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); - wxTextCtrl* GetEditControl() const; - void Edit( long item ) { EditLabel(item); } - - bool EnsureVisible( long item ); - long FindItem( long start, const wxString& str, bool partial = false ); - long FindItem( long start, wxUIntPtr data ); - long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC - long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ) const; - long InsertItem(wxListItem& info); - long InsertItem( long index, const wxString& label ); - long InsertItem( long index, int imageIndex ); - long InsertItem( long index, const wxString& label, int imageIndex ); - long InsertColumn( long col, wxListItem& info ); - long InsertColumn( long col, const wxString& heading, - int format = wxLIST_FORMAT_LEFT, int width = -1 ); - bool ScrollList( int dx, int dy ); - bool SortItems( wxListCtrlCompare fn, long data ); - bool Update( long item ); - // Must provide overload to avoid hiding it (and warnings about it) - virtual void Update() { wxControl::Update(); } - - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - // are we in virtual report mode? - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - - // do we have a header window? - bool HasHeader() const - { return InReportView() && !HasFlag(wxLC_NO_HEADER); } - - // refresh items selectively (only useful for virtual list controls) - void RefreshItem(long item); - void RefreshItems(long itemFrom, long itemTo); - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete, don't use - wxDEPRECATED( int GetItemSpacing( bool isSmall ) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // implementation only from now on - // ------------------------------- - - void OnInternalIdle( ); - void OnSize( wxSizeEvent &event ); - - // We have to hand down a few functions - virtual void Refresh(bool eraseBackground = true, - const wxRect *rect = NULL); - - virtual void Freeze(); - virtual void Thaw(); - - virtual bool SetBackgroundColour( const wxColour &colour ); - virtual bool SetForegroundColour( const wxColour &colour ); - virtual wxColour GetBackgroundColour() const; - virtual wxColour GetForegroundColour() const; - virtual bool SetFont( const wxFont &font ); - virtual bool SetCursor( const wxCursor &cursor ); - - virtual int GetScrollPos(int orient) const; - virtual void SetScrollPos(int orient, int pos, bool refresh = true); - -#if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); - virtual wxDropTarget *GetDropTarget() const; -#endif - - virtual bool ShouldInheritColours() const { return false; } - virtual void SetFocus(); - - // implementation - // -------------- - - wxImageList *m_imageListNormal; - wxImageList *m_imageListSmall; - wxImageList *m_imageListState; // what's that ? - bool m_ownsImageListNormal, - m_ownsImageListSmall, - m_ownsImageListState; - wxListHeaderWindow *m_headerWin; - wxListMainWindow *m_mainWin; - wxCoord m_headerHeight; - -protected: - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); - - // take into account the coordinates difference between the container - // window and the list control window itself here - virtual void DoClientToScreen( int *x, int *y ) const; - virtual void DoScreenToClient( int *x, int *y ) const; - - virtual wxSize DoGetBestSize() const; - - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - - // return the attribute for the item (may return NULL if none) - virtual wxListItemAttr *OnGetItemAttr(long item) const; - - // it calls our OnGetXXX() functions - friend class WXDLLEXPORT wxListMainWindow; - -private: - // create the header window - void CreateHeaderWindow(); - - // calculate and set height of the header - void CalculateAndSetHeaderHeight(); - - // reposition the header and the main window in the report view depending - // on whether it should be shown or not - void ResizeReportView(bool showHeader); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericListCtrl) -}; - -#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && (!defined(__WXMAC__) || defined(__WXUNIVERSAL__)) -/* - * wxListCtrl has to be a real class or we have problems with - * the run-time information. - */ - -class WXDLLEXPORT wxListCtrl: public wxGenericListCtrl -{ - DECLARE_DYNAMIC_CLASS(wxListCtrl) - -public: - wxListCtrl() {} - - wxListCtrl(wxWindow *parent, wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator &validator = wxDefaultValidator, - const wxString &name = wxListCtrlNameStr) - : wxGenericListCtrl(parent, winid, pos, size, style, validator, name) - { - } - -}; -#endif // !__WXMSW__ || __WXUNIVERSAL__ - -#endif // _WX_GENERIC_LISTCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/listctrl.h +// Purpose: Generic list control +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id: listctrl.h 46432 2007-06-13 03:46:20Z SC $ +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_LISTCTRL_H_ +#define _WX_GENERIC_LISTCTRL_H_ + +#include "wx/textctrl.h" + +class WXDLLIMPEXP_CORE wxImageList; + +#if wxUSE_DRAG_AND_DROP +class WXDLLEXPORT wxDropTarget; +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +// internal classes +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxListHeaderWindow; +class WXDLLEXPORT wxListMainWindow; + +//----------------------------------------------------------------------------- +// wxListCtrl +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericListCtrl: public wxControl +{ +public: + + wxGenericListCtrl(); + wxGenericListCtrl( wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxListCtrlNameStr) + { + Create(parent, winid, pos, size, style, validator, name); + } + virtual ~wxGenericListCtrl(); + + bool Create( wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxListCtrlNameStr); + + bool GetColumn( int col, wxListItem& item ) const; + bool SetColumn( int col, wxListItem& item ); + int GetColumnWidth( int col ) const; + bool SetColumnWidth( int col, int width); + int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think + wxRect GetViewRect() const; + + bool GetItem( wxListItem& info ) const; + bool SetItem( wxListItem& info ) ; + long SetItem( long index, int col, const wxString& label, int imageId = -1 ); + int GetItemState( long item, long stateMask ) const; + bool SetItemState( long item, long state, long stateMask); + bool SetItemImage( long item, int image, int selImage = -1 ); + bool SetItemColumnImage( long item, long column, int image ); + wxString GetItemText( long item ) const; + void SetItemText( long item, const wxString& str ); + wxUIntPtr GetItemData( long item ) const; +#if wxABI_VERSION >= 20804 + bool SetItemPtrData(long item, wxUIntPtr data); +#endif // wxABI 2.8.4+ + bool SetItemData(long item, long data); + bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const; + bool GetItemPosition( long item, wxPoint& pos ) const; + bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC + int GetItemCount() const; + int GetColumnCount() const; + void SetItemSpacing( int spacing, bool isSmall = false ); + wxSize GetItemSpacing() const; + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; + int GetSelectedItemCount() const; + wxColour GetTextColour() const; + void SetTextColour(const wxColour& col); + long GetTopItem() const; + + void SetSingleStyle( long style, bool add = true ) ; + void SetWindowStyleFlag( long style ); + void RecreateWindow() {} + long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const; + wxImageList *GetImageList( int which ) const; + void SetImageList( wxImageList *imageList, int which ); + void AssignImageList( wxImageList *imageList, int which ); + bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC + + void ClearAll(); + bool DeleteItem( long item ); + bool DeleteAllItems(); + bool DeleteAllColumns(); + bool DeleteColumn( int col ); + + void SetItemCount(long count); + + wxTextCtrl *EditLabel(long item, + wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxTextCtrl* GetEditControl() const; + void Edit( long item ) { EditLabel(item); } + + bool EnsureVisible( long item ); + long FindItem( long start, const wxString& str, bool partial = false ); + long FindItem( long start, wxUIntPtr data ); + long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC + long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ) const; + long InsertItem(wxListItem& info); + long InsertItem( long index, const wxString& label ); + long InsertItem( long index, int imageIndex ); + long InsertItem( long index, const wxString& label, int imageIndex ); + long InsertColumn( long col, wxListItem& info ); + long InsertColumn( long col, const wxString& heading, + int format = wxLIST_FORMAT_LEFT, int width = -1 ); + bool ScrollList( int dx, int dy ); + bool SortItems( wxListCtrlCompare fn, long data ); + bool Update( long item ); + // Must provide overload to avoid hiding it (and warnings about it) + virtual void Update() { wxControl::Update(); } + + // are we in report mode? + bool InReportView() const { return HasFlag(wxLC_REPORT); } + + // are we in virtual report mode? + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + + // do we have a header window? + bool HasHeader() const + { return InReportView() && !HasFlag(wxLC_NO_HEADER); } + + // refresh items selectively (only useful for virtual list controls) + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + +#if WXWIN_COMPATIBILITY_2_6 + // obsolete, don't use + wxDEPRECATED( int GetItemSpacing( bool isSmall ) const ); +#endif // WXWIN_COMPATIBILITY_2_6 + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation only from now on + // ------------------------------- + + void OnInternalIdle( ); + void OnSize( wxSizeEvent &event ); + + // We have to hand down a few functions + virtual void Refresh(bool eraseBackground = true, + const wxRect *rect = NULL); + + virtual void Freeze(); + virtual void Thaw(); + + virtual bool SetBackgroundColour( const wxColour &colour ); + virtual bool SetForegroundColour( const wxColour &colour ); + virtual wxColour GetBackgroundColour() const; + virtual wxColour GetForegroundColour() const; + virtual bool SetFont( const wxFont &font ); + virtual bool SetCursor( const wxCursor &cursor ); + + virtual int GetScrollPos(int orient) const; + virtual void SetScrollPos(int orient, int pos, bool refresh = true); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual wxDropTarget *GetDropTarget() const; +#endif + + virtual bool ShouldInheritColours() const { return false; } + virtual void SetFocus(); + + // implementation + // -------------- + + wxImageList *m_imageListNormal; + wxImageList *m_imageListSmall; + wxImageList *m_imageListState; // what's that ? + bool m_ownsImageListNormal, + m_ownsImageListSmall, + m_ownsImageListState; + wxListHeaderWindow *m_headerWin; + wxListMainWindow *m_mainWin; + wxCoord m_headerHeight; + +protected: + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + + // take into account the coordinates difference between the container + // window and the list control window itself here + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + + virtual wxSize DoGetBestSize() const; + + // return the text for the given column of the given item + virtual wxString OnGetItemText(long item, long column) const; + + // return the icon for the given item. In report view, OnGetItemImage will + // only be called for the first column. See OnGetItemColumnImage for + // details. + virtual int OnGetItemImage(long item) const; + + // return the icon for the given item and column. + virtual int OnGetItemColumnImage(long item, long column) const; + + // return the attribute for the item (may return NULL if none) + virtual wxListItemAttr *OnGetItemAttr(long item) const; + + // it calls our OnGetXXX() functions + friend class WXDLLEXPORT wxListMainWindow; + +private: + // create the header window + void CreateHeaderWindow(); + + // calculate and set height of the header + void CalculateAndSetHeaderHeight(); + + // reposition the header and the main window in the report view depending + // on whether it should be shown or not + void ResizeReportView(bool showHeader); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericListCtrl) +}; + +#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && (!defined(__WXMAC__) || defined(__WXUNIVERSAL__)) +/* + * wxListCtrl has to be a real class or we have problems with + * the run-time information. + */ + +class WXDLLEXPORT wxListCtrl: public wxGenericListCtrl +{ + DECLARE_DYNAMIC_CLASS(wxListCtrl) + +public: + wxListCtrl() {} + + wxListCtrl(wxWindow *parent, wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator &validator = wxDefaultValidator, + const wxString &name = wxListCtrlNameStr) + : wxGenericListCtrl(parent, winid, pos, size, style, validator, name) + { + } + +}; +#endif // !__WXMSW__ || __WXUNIVERSAL__ + +#endif // _WX_GENERIC_LISTCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/generic/logg.h b/Externals/wxWidgets/include/wx/generic/logg.h index 240b30fbde..855c0c2f34 100644 --- a/Externals/wxWidgets/include/wx/generic/logg.h +++ b/Externals/wxWidgets/include/wx/generic/logg.h @@ -1,129 +1,129 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/logg.h -// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: logg.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LOGG_H_ -#define _WX_LOGG_H_ - -#if wxUSE_GUI - -// ---------------------------------------------------------------------------- -// the following log targets are only compiled in if the we're compiling the -// GUI part (andnot just the base one) of the library, they're implemented in -// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest) -// ---------------------------------------------------------------------------- - -#if wxUSE_TEXTCTRL - -// log everything to a text window (GUI only of course) -class WXDLLEXPORT wxLogTextCtrl : public wxLog -{ -public: - wxLogTextCtrl(wxTextCtrl *pTextCtrl); - -protected: - // implement sink function - virtual void DoLogString(const wxChar *szString, time_t t); - -private: - // the control we use - wxTextCtrl *m_pTextCtrl; - - DECLARE_NO_COPY_CLASS(wxLogTextCtrl) -}; - -#endif // wxUSE_TEXTCTRL - -// ---------------------------------------------------------------------------- -// GUI log target, the default one for wxWidgets programs -// ---------------------------------------------------------------------------- - -#if wxUSE_LOGGUI - -class WXDLLEXPORT wxLogGui : public wxLog -{ -public: - // ctor - wxLogGui(); - - // show all messages that were logged since the last Flush() - virtual void Flush(); - -protected: - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - - // empty everything - void Clear(); - - wxArrayString m_aMessages; // the log message texts - wxArrayInt m_aSeverity; // one of wxLOG_XXX values - wxArrayLong m_aTimes; // the time of each message - bool m_bErrors, // do we have any errors? - m_bWarnings, // any warnings? - m_bHasMessages; // any messages at all? - -}; - -#endif // wxUSE_LOGGUI - -// ---------------------------------------------------------------------------- -// (background) log window: this class forwards all log messages to the log -// target which was active when it was instantiated, but also collects them -// to the log window. This window has it's own menu which allows the user to -// close it, clear the log contents or save it to the file. -// ---------------------------------------------------------------------------- - -#if wxUSE_LOGWINDOW - -class WXDLLEXPORT wxLogWindow : public wxLogPassThrough -{ -public: - wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) - const wxChar *szTitle, // the title of the frame - bool bShow = true, // show window immediately? - bool bPassToOld = true); // pass messages to the old target? - - virtual ~wxLogWindow(); - - // window operations - // show/hide the log window - void Show(bool bShow = true); - // retrieve the pointer to the frame - wxFrame *GetFrame() const; - - // overridables - // called immediately after the log frame creation allowing for - // any extra initializations - virtual void OnFrameCreate(wxFrame *frame); - // called if the user closes the window interactively, will not be - // called if it is destroyed for another reason (such as when program - // exits) - return true from here to allow the frame to close, false - // to prevent this from happening - virtual bool OnFrameClose(wxFrame *frame); - // called right before the log frame is going to be deleted: will - // always be called unlike OnFrameClose() - virtual void OnFrameDelete(wxFrame *frame); - -protected: - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - virtual void DoLogString(const wxChar *szString, time_t t); - -private: - wxLogFrame *m_pLogFrame; // the log frame - - DECLARE_NO_COPY_CLASS(wxLogWindow) -}; - -#endif // wxUSE_LOGWINDOW - -#endif // wxUSE_GUI - -#endif // _WX_LOGG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/logg.h +// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: logg.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LOGG_H_ +#define _WX_LOGG_H_ + +#if wxUSE_GUI + +// ---------------------------------------------------------------------------- +// the following log targets are only compiled in if the we're compiling the +// GUI part (andnot just the base one) of the library, they're implemented in +// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest) +// ---------------------------------------------------------------------------- + +#if wxUSE_TEXTCTRL + +// log everything to a text window (GUI only of course) +class WXDLLEXPORT wxLogTextCtrl : public wxLog +{ +public: + wxLogTextCtrl(wxTextCtrl *pTextCtrl); + +protected: + // implement sink function + virtual void DoLogString(const wxChar *szString, time_t t); + +private: + // the control we use + wxTextCtrl *m_pTextCtrl; + + DECLARE_NO_COPY_CLASS(wxLogTextCtrl) +}; + +#endif // wxUSE_TEXTCTRL + +// ---------------------------------------------------------------------------- +// GUI log target, the default one for wxWidgets programs +// ---------------------------------------------------------------------------- + +#if wxUSE_LOGGUI + +class WXDLLEXPORT wxLogGui : public wxLog +{ +public: + // ctor + wxLogGui(); + + // show all messages that were logged since the last Flush() + virtual void Flush(); + +protected: + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + + // empty everything + void Clear(); + + wxArrayString m_aMessages; // the log message texts + wxArrayInt m_aSeverity; // one of wxLOG_XXX values + wxArrayLong m_aTimes; // the time of each message + bool m_bErrors, // do we have any errors? + m_bWarnings, // any warnings? + m_bHasMessages; // any messages at all? + +}; + +#endif // wxUSE_LOGGUI + +// ---------------------------------------------------------------------------- +// (background) log window: this class forwards all log messages to the log +// target which was active when it was instantiated, but also collects them +// to the log window. This window has it's own menu which allows the user to +// close it, clear the log contents or save it to the file. +// ---------------------------------------------------------------------------- + +#if wxUSE_LOGWINDOW + +class WXDLLEXPORT wxLogWindow : public wxLogPassThrough +{ +public: + wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) + const wxChar *szTitle, // the title of the frame + bool bShow = true, // show window immediately? + bool bPassToOld = true); // pass messages to the old target? + + virtual ~wxLogWindow(); + + // window operations + // show/hide the log window + void Show(bool bShow = true); + // retrieve the pointer to the frame + wxFrame *GetFrame() const; + + // overridables + // called immediately after the log frame creation allowing for + // any extra initializations + virtual void OnFrameCreate(wxFrame *frame); + // called if the user closes the window interactively, will not be + // called if it is destroyed for another reason (such as when program + // exits) - return true from here to allow the frame to close, false + // to prevent this from happening + virtual bool OnFrameClose(wxFrame *frame); + // called right before the log frame is going to be deleted: will + // always be called unlike OnFrameClose() + virtual void OnFrameDelete(wxFrame *frame); + +protected: + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + virtual void DoLogString(const wxChar *szString, time_t t); + +private: + wxLogFrame *m_pLogFrame; // the log frame + + DECLARE_NO_COPY_CLASS(wxLogWindow) +}; + +#endif // wxUSE_LOGWINDOW + +#endif // wxUSE_GUI + +#endif // _WX_LOGG_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/mask.h b/Externals/wxWidgets/include/wx/generic/mask.h index aaf96f952f..41c85e3c42 100644 --- a/Externals/wxWidgets/include/wx/generic/mask.h +++ b/Externals/wxWidgets/include/wx/generic/mask.h @@ -1,54 +1,54 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/mask.h -// Purpose: generic implementation of wxMask -// Author: Vadim Zeitlin -// Created: 2006-09-28 -// RCS-ID: $Id: mask.h 41495 2006-09-28 23:02:39Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_MASKG_H_ -#define _WX_GENERIC_MASKG_H_ - -// ---------------------------------------------------------------------------- -// generic wxMask implementation -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMask : public wxMaskBase -{ -public: - wxMask() { } - wxMask(const wxBitmap& bitmap, const wxColour& colour) - { - InitFromColour(bitmap, colour); - } - -#if wxUSE_PALETTE - wxMask(const wxBitmap& bitmap, int paletteIndex) - { - Create(bitmap, paletteIndex); - } -#endif // wxUSE_PALETTE - - wxMask(const wxBitmap& bitmap) - { - InitFromMonoBitmap(bitmap); - } - - // implementation-only from now on - wxBitmap GetBitmap() const { return m_bitmap; } - -private: - // implement wxMaskBase pure virtuals - virtual void FreeData(); - virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour); - virtual bool InitFromMonoBitmap(const wxBitmap& bitmap); - - wxBitmap m_bitmap; - - DECLARE_DYNAMIC_CLASS(wxMask) -}; - -#endif // _WX_GENERIC_MASKG_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/mask.h +// Purpose: generic implementation of wxMask +// Author: Vadim Zeitlin +// Created: 2006-09-28 +// RCS-ID: $Id: mask.h 41495 2006-09-28 23:02:39Z VZ $ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_MASKG_H_ +#define _WX_GENERIC_MASKG_H_ + +// ---------------------------------------------------------------------------- +// generic wxMask implementation +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMask : public wxMaskBase +{ +public: + wxMask() { } + wxMask(const wxBitmap& bitmap, const wxColour& colour) + { + InitFromColour(bitmap, colour); + } + +#if wxUSE_PALETTE + wxMask(const wxBitmap& bitmap, int paletteIndex) + { + Create(bitmap, paletteIndex); + } +#endif // wxUSE_PALETTE + + wxMask(const wxBitmap& bitmap) + { + InitFromMonoBitmap(bitmap); + } + + // implementation-only from now on + wxBitmap GetBitmap() const { return m_bitmap; } + +private: + // implement wxMaskBase pure virtuals + virtual void FreeData(); + virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour); + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap); + + wxBitmap m_bitmap; + + DECLARE_DYNAMIC_CLASS(wxMask) +}; + +#endif // _WX_GENERIC_MASKG_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/mdig.h b/Externals/wxWidgets/include/wx/generic/mdig.h index 77fb1cba80..99d9243995 100644 --- a/Externals/wxWidgets/include/wx/generic/mdig.h +++ b/Externals/wxWidgets/include/wx/generic/mdig.h @@ -1,335 +1,335 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/mdig.h -// Purpose: Generic MDI (Multiple Document Interface) classes -// Author: Hans Van Leemputten -// Modified by: -// Created: 29/07/2002 -// RCS-ID: $Id: mdig.h 41223 2006-09-14 17:36:18Z PC $ -// Copyright: (c) Hans Van Leemputten -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MDIG_H_ -#define _WX_MDIG_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/frame.h" -#include "wx/panel.h" -#include "wx/notebook.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; - - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericMDIParentFrame; -class WXDLLEXPORT wxGenericMDIClientWindow; -class WXDLLEXPORT wxGenericMDIChildFrame; - -//----------------------------------------------------------------------------- -// wxGenericMDIParentFrame -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericMDIParentFrame: public wxFrame -{ -public: - wxGenericMDIParentFrame(); - wxGenericMDIParentFrame(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr); - - virtual ~wxGenericMDIParentFrame(); - bool Create( wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr ); - -#if wxUSE_MENUS - wxMenu* GetWindowMenu() const { return m_pWindowMenu; }; - void SetWindowMenu(wxMenu* pMenu); - - virtual void SetMenuBar(wxMenuBar *pMenuBar); -#endif // wxUSE_MENUS - - void SetChildMenuBar(wxGenericMDIChildFrame *pChild); - - virtual bool ProcessEvent(wxEvent& event); - - wxGenericMDIChildFrame *GetActiveChild() const; - inline void SetActiveChild(wxGenericMDIChildFrame* pChildFrame); - - wxGenericMDIClientWindow *GetClientWindow() const; - virtual wxGenericMDIClientWindow *OnCreateClient(); - - virtual void Cascade() { /* Has no effect */ } - virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { } - virtual void ArrangeIcons() { /* Has no effect */ } - virtual void ActivateNext(); - virtual void ActivatePrevious(); - -protected: - wxGenericMDIClientWindow *m_pClientWindow; - wxGenericMDIChildFrame *m_pActiveChild; -#if wxUSE_MENUS - wxMenu *m_pWindowMenu; - wxMenuBar *m_pMyMenuBar; -#endif // wxUSE_MENUS - -protected: - void Init(); - -#if wxUSE_MENUS - void RemoveWindowMenu(wxMenuBar *pMenuBar); - void AddWindowMenu(wxMenuBar *pMenuBar); - - void DoHandleMenu(wxCommandEvent &event); -#endif // wxUSE_MENUS - - virtual void DoGetClientSize(int *width, int *height) const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame) -}; - -//----------------------------------------------------------------------------- -// wxGenericMDIChildFrame -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericMDIChildFrame: public wxPanel -{ -public: - wxGenericMDIChildFrame(); - wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr ); - - virtual ~wxGenericMDIChildFrame(); - bool Create( wxGenericMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr ); - -#if wxUSE_MENUS - virtual void SetMenuBar( wxMenuBar *menu_bar ); - virtual wxMenuBar *GetMenuBar() const; -#endif // wxUSE_MENUS - - virtual void SetTitle(const wxString& title); - virtual wxString GetTitle() const; - - virtual void Activate(); - -#if wxUSE_STATUSBAR - // no status bars - virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1, - long WXUNUSED(style) = 1, - wxWindowID WXUNUSED(winid) = 1, - const wxString& WXUNUSED(name) = wxEmptyString) - { return (wxStatusBar*)NULL; } - - virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } - virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} - virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} -#endif - - // no size hints - virtual void DoSetSizeHints( int WXUNUSED(minW), - int WXUNUSED(minH), - int WXUNUSED(maxW) = wxDefaultCoord, - int WXUNUSED(maxH) = wxDefaultCoord, - int WXUNUSED(incW) = wxDefaultCoord, - int WXUNUSED(incH) = wxDefaultCoord) {} - -#if wxUSE_TOOLBAR - // no toolbar bars - virtual wxToolBar* CreateToolBar( long WXUNUSED(style), - wxWindowID WXUNUSED(winid), - const wxString& WXUNUSED(name) ) - { return (wxToolBar*)NULL; } - virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } -#endif - - // no icon - void SetIcon( const wxIcon& WXUNUSED(icon) ) { } - void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { } - - // no maximize etc - virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ } - virtual void Restore() { /* Has no effect */ } - virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } - virtual bool IsMaximized() const { return true; } - virtual bool IsIconized() const { return false; } - virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } - virtual bool IsFullScreen() const { return false; } - - virtual bool IsTopLevel() const { return false; } - - void OnMenuHighlight(wxMenuEvent& event); - void OnActivate(wxActivateEvent& event); - - // The next 2 are copied from top level... - void OnCloseWindow(wxCloseEvent& event); - void OnSize(wxSizeEvent& event); - - void SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame); - wxGenericMDIParentFrame* GetMDIParentFrame() const; - -protected: - wxGenericMDIParentFrame *m_pMDIParentFrame; - wxRect m_MDIRect; - wxString m_Title; - -#if wxUSE_MENUS - wxMenuBar *m_pMenuBar; -#endif // wxUSE_MENUS - -protected: - void Init(); - - virtual void DoMoveWindow(int x, int y, int width, int height); - - // This function needs to be called when a size change is confirmed, - // we needed this function to prevent any body from the outside - // changing the panel... it messes the UI layout when we would allow it. - void ApplyMDIChildFrameRect(); - -private: - DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame) - DECLARE_EVENT_TABLE() - - friend class wxGenericMDIClientWindow; -}; - -//----------------------------------------------------------------------------- -// wxGenericMDIClientWindow -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericMDIClientWindow: public wxNotebook -{ -public: - wxGenericMDIClientWindow(); - wxGenericMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 ); - virtual ~wxGenericMDIClientWindow(); - virtual bool CreateClient( wxGenericMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL ); - - virtual int SetSelection(size_t nPage); - -protected: - void PageChanged(int OldSelection, int newSelection); - - void OnPageChanged(wxNotebookEvent& event); - void OnSize(wxSizeEvent& event); - -private: - DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow) - DECLARE_EVENT_TABLE() -}; - - -/* - * Define normal wxMDI classes based on wxGenericMDI - */ - -#ifndef wxUSE_GENERIC_MDI_AS_NATIVE -#if defined(__WXUNIVERSAL__) || defined(__WXPM__) || defined(__WXCOCOA__) -#define wxUSE_GENERIC_MDI_AS_NATIVE 1 -#else -#define wxUSE_GENERIC_MDI_AS_NATIVE 0 -#endif -#endif // wxUSE_GENERIC_MDI_AS_NATIVE - -#if wxUSE_GENERIC_MDI_AS_NATIVE - -class wxMDIChildFrame ; - -//----------------------------------------------------------------------------- -// wxMDIParentFrame -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIParentFrame: public wxGenericMDIParentFrame -{ -public: - wxMDIParentFrame() {} - wxMDIParentFrame(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr) - :wxGenericMDIParentFrame(parent, winid, title, pos, size, style, name) - { - } - - wxMDIChildFrame * GetActiveChild() const ; - - -private: - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) -}; - -//----------------------------------------------------------------------------- -// wxMDIChildFrame -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIChildFrame: public wxGenericMDIChildFrame -{ -public: - wxMDIChildFrame() {} - - wxMDIChildFrame( wxGenericMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr ) - :wxGenericMDIChildFrame(parent, winid, title, pos, size, style, name) - { - } -private: - DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) -}; - -//----------------------------------------------------------------------------- -// wxMDIClientWindow -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIClientWindow: public wxGenericMDIClientWindow -{ -public: - wxMDIClientWindow() {} - - wxMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 ) - :wxGenericMDIClientWindow(parent, style) - { - } - -private: - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) -}; - -#endif - -#endif - // _WX_MDIG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/mdig.h +// Purpose: Generic MDI (Multiple Document Interface) classes +// Author: Hans Van Leemputten +// Modified by: +// Created: 29/07/2002 +// RCS-ID: $Id: mdig.h 41223 2006-09-14 17:36:18Z PC $ +// Copyright: (c) Hans Van Leemputten +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDIG_H_ +#define _WX_MDIG_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/frame.h" +#include "wx/panel.h" +#include "wx/notebook.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; + + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericMDIParentFrame; +class WXDLLEXPORT wxGenericMDIClientWindow; +class WXDLLEXPORT wxGenericMDIChildFrame; + +//----------------------------------------------------------------------------- +// wxGenericMDIParentFrame +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericMDIParentFrame: public wxFrame +{ +public: + wxGenericMDIParentFrame(); + wxGenericMDIParentFrame(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr); + + virtual ~wxGenericMDIParentFrame(); + bool Create( wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr ); + +#if wxUSE_MENUS + wxMenu* GetWindowMenu() const { return m_pWindowMenu; }; + void SetWindowMenu(wxMenu* pMenu); + + virtual void SetMenuBar(wxMenuBar *pMenuBar); +#endif // wxUSE_MENUS + + void SetChildMenuBar(wxGenericMDIChildFrame *pChild); + + virtual bool ProcessEvent(wxEvent& event); + + wxGenericMDIChildFrame *GetActiveChild() const; + inline void SetActiveChild(wxGenericMDIChildFrame* pChildFrame); + + wxGenericMDIClientWindow *GetClientWindow() const; + virtual wxGenericMDIClientWindow *OnCreateClient(); + + virtual void Cascade() { /* Has no effect */ } + virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { } + virtual void ArrangeIcons() { /* Has no effect */ } + virtual void ActivateNext(); + virtual void ActivatePrevious(); + +protected: + wxGenericMDIClientWindow *m_pClientWindow; + wxGenericMDIChildFrame *m_pActiveChild; +#if wxUSE_MENUS + wxMenu *m_pWindowMenu; + wxMenuBar *m_pMyMenuBar; +#endif // wxUSE_MENUS + +protected: + void Init(); + +#if wxUSE_MENUS + void RemoveWindowMenu(wxMenuBar *pMenuBar); + void AddWindowMenu(wxMenuBar *pMenuBar); + + void DoHandleMenu(wxCommandEvent &event); +#endif // wxUSE_MENUS + + virtual void DoGetClientSize(int *width, int *height) const; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame) +}; + +//----------------------------------------------------------------------------- +// wxGenericMDIChildFrame +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericMDIChildFrame: public wxPanel +{ +public: + wxGenericMDIChildFrame(); + wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr ); + + virtual ~wxGenericMDIChildFrame(); + bool Create( wxGenericMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr ); + +#if wxUSE_MENUS + virtual void SetMenuBar( wxMenuBar *menu_bar ); + virtual wxMenuBar *GetMenuBar() const; +#endif // wxUSE_MENUS + + virtual void SetTitle(const wxString& title); + virtual wxString GetTitle() const; + + virtual void Activate(); + +#if wxUSE_STATUSBAR + // no status bars + virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1, + long WXUNUSED(style) = 1, + wxWindowID WXUNUSED(winid) = 1, + const wxString& WXUNUSED(name) = wxEmptyString) + { return (wxStatusBar*)NULL; } + + virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } + virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} + virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} +#endif + + // no size hints + virtual void DoSetSizeHints( int WXUNUSED(minW), + int WXUNUSED(minH), + int WXUNUSED(maxW) = wxDefaultCoord, + int WXUNUSED(maxH) = wxDefaultCoord, + int WXUNUSED(incW) = wxDefaultCoord, + int WXUNUSED(incH) = wxDefaultCoord) {} + +#if wxUSE_TOOLBAR + // no toolbar bars + virtual wxToolBar* CreateToolBar( long WXUNUSED(style), + wxWindowID WXUNUSED(winid), + const wxString& WXUNUSED(name) ) + { return (wxToolBar*)NULL; } + virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } +#endif + + // no icon + void SetIcon( const wxIcon& WXUNUSED(icon) ) { } + void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { } + + // no maximize etc + virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ } + virtual void Restore() { /* Has no effect */ } + virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } + virtual bool IsMaximized() const { return true; } + virtual bool IsIconized() const { return false; } + virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } + virtual bool IsFullScreen() const { return false; } + + virtual bool IsTopLevel() const { return false; } + + void OnMenuHighlight(wxMenuEvent& event); + void OnActivate(wxActivateEvent& event); + + // The next 2 are copied from top level... + void OnCloseWindow(wxCloseEvent& event); + void OnSize(wxSizeEvent& event); + + void SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame); + wxGenericMDIParentFrame* GetMDIParentFrame() const; + +protected: + wxGenericMDIParentFrame *m_pMDIParentFrame; + wxRect m_MDIRect; + wxString m_Title; + +#if wxUSE_MENUS + wxMenuBar *m_pMenuBar; +#endif // wxUSE_MENUS + +protected: + void Init(); + + virtual void DoMoveWindow(int x, int y, int width, int height); + + // This function needs to be called when a size change is confirmed, + // we needed this function to prevent any body from the outside + // changing the panel... it messes the UI layout when we would allow it. + void ApplyMDIChildFrameRect(); + +private: + DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame) + DECLARE_EVENT_TABLE() + + friend class wxGenericMDIClientWindow; +}; + +//----------------------------------------------------------------------------- +// wxGenericMDIClientWindow +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericMDIClientWindow: public wxNotebook +{ +public: + wxGenericMDIClientWindow(); + wxGenericMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 ); + virtual ~wxGenericMDIClientWindow(); + virtual bool CreateClient( wxGenericMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL ); + + virtual int SetSelection(size_t nPage); + +protected: + void PageChanged(int OldSelection, int newSelection); + + void OnPageChanged(wxNotebookEvent& event); + void OnSize(wxSizeEvent& event); + +private: + DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow) + DECLARE_EVENT_TABLE() +}; + + +/* + * Define normal wxMDI classes based on wxGenericMDI + */ + +#ifndef wxUSE_GENERIC_MDI_AS_NATIVE +#if defined(__WXUNIVERSAL__) || defined(__WXPM__) || defined(__WXCOCOA__) +#define wxUSE_GENERIC_MDI_AS_NATIVE 1 +#else +#define wxUSE_GENERIC_MDI_AS_NATIVE 0 +#endif +#endif // wxUSE_GENERIC_MDI_AS_NATIVE + +#if wxUSE_GENERIC_MDI_AS_NATIVE + +class wxMDIChildFrame ; + +//----------------------------------------------------------------------------- +// wxMDIParentFrame +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIParentFrame: public wxGenericMDIParentFrame +{ +public: + wxMDIParentFrame() {} + wxMDIParentFrame(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr) + :wxGenericMDIParentFrame(parent, winid, title, pos, size, style, name) + { + } + + wxMDIChildFrame * GetActiveChild() const ; + + +private: + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) +}; + +//----------------------------------------------------------------------------- +// wxMDIChildFrame +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIChildFrame: public wxGenericMDIChildFrame +{ +public: + wxMDIChildFrame() {} + + wxMDIChildFrame( wxGenericMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr ) + :wxGenericMDIChildFrame(parent, winid, title, pos, size, style, name) + { + } +private: + DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) +}; + +//----------------------------------------------------------------------------- +// wxMDIClientWindow +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIClientWindow: public wxGenericMDIClientWindow +{ +public: + wxMDIClientWindow() {} + + wxMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 ) + :wxGenericMDIClientWindow(parent, style) + { + } + +private: + DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) +}; + +#endif + +#endif + // _WX_MDIG_H_ diff --git a/Externals/wxWidgets/include/wx/generic/msgdlgg.h b/Externals/wxWidgets/include/wx/generic/msgdlgg.h index 4776b106aa..46c5d599e7 100644 --- a/Externals/wxWidgets/include/wx/generic/msgdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/msgdlgg.h @@ -1,44 +1,44 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/msgdlgg.h -// Purpose: Generic wxMessageDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: msgdlgg.h 49765 2007-11-09 18:32:38Z DE $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __MSGDLGH_G__ -#define __MSGDLGH_G__ - -#include "wx/defs.h" -#include "wx/dialog.h" - -// type is an 'or' (|) of wxOK, wxCANCEL, wxYES_NO -// Returns wxYES/NO/OK/CANCEL - -extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; - -class WXDLLEXPORT wxGenericMessageDialog: public wxDialog, public wxMessageDialogBase -{ -DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog) - -public: - wxGenericMessageDialog(wxWindow *parent, const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - - void OnYes(wxCommandEvent& event); - void OnNo(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - -private: - DECLARE_EVENT_TABLE() -}; - -#if (!defined( __WXMSW__ ) && !defined( __WXMAC__) && !defined(__WXPM__) && !defined(__WXCOCOA__)) || defined(__WXUNIVERSAL__) -#define wxMessageDialog wxGenericMessageDialog -#endif - -#endif // __MSGDLGH_G__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/msgdlgg.h +// Purpose: Generic wxMessageDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: msgdlgg.h 49765 2007-11-09 18:32:38Z DE $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __MSGDLGH_G__ +#define __MSGDLGH_G__ + +#include "wx/defs.h" +#include "wx/dialog.h" + +// type is an 'or' (|) of wxOK, wxCANCEL, wxYES_NO +// Returns wxYES/NO/OK/CANCEL + +extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; + +class WXDLLEXPORT wxGenericMessageDialog: public wxDialog, public wxMessageDialogBase +{ +DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog) + +public: + wxGenericMessageDialog(wxWindow *parent, const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); + + void OnYes(wxCommandEvent& event); + void OnNo(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + +private: + DECLARE_EVENT_TABLE() +}; + +#if (!defined( __WXMSW__ ) && !defined( __WXMAC__) && !defined(__WXPM__) && !defined(__WXCOCOA__)) || defined(__WXUNIVERSAL__) +#define wxMessageDialog wxGenericMessageDialog +#endif + +#endif // __MSGDLGH_G__ diff --git a/Externals/wxWidgets/include/wx/generic/notebook.h b/Externals/wxWidgets/include/wx/generic/notebook.h index 5b96a204bb..2b9e109e27 100644 --- a/Externals/wxWidgets/include/wx/generic/notebook.h +++ b/Externals/wxWidgets/include/wx/generic/notebook.h @@ -1,160 +1,160 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: notebook.h -// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) -// Author: Julian Smart -// Modified by: -// RCS-ID: $Id: notebook.h 41738 2006-10-08 17:37:23Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NOTEBOOK_H_ -#define _WX_NOTEBOOK_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- -#include "wx/event.h" -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// fwd declarations -class WXDLLEXPORT wxImageList; -class WXDLLEXPORT wxWindow; -class WXDLLEXPORT wxTabView; - -// ---------------------------------------------------------------------------- -// wxNotebook -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase -{ -public: - // ctors - // ----- - // default for dynamic class - wxNotebook(); - // the same arguments as for wxControl (@@@ any special styles?) - wxNotebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // Create() function - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // dtor - virtual ~wxNotebook(); - - // accessors - // --------- - // Find the position of the wxNotebookPage, -1 if not found. - int FindPagePosition(wxNotebookPage* page) const; - - // set the currently selected page, return the index of the previously - // selected one (or -1 on error) - // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events - int SetSelection(size_t nPage); - // cycle thru the tabs - // void AdvanceSelection(bool bForward = true); - // get the currently selected page - int GetSelection() const { return m_nSelection; } - - // changes selected page without sending events - int ChangeSelection(size_t nPage); - - // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; - - // get the number of rows for a control with wxNB_MULTILINE style (not all - // versions support it - they will always return 1 then) - virtual int GetRowCount() const ; - - // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); - - // control the appearance of the notebook pages - // set the size (the same for all pages) - void SetPageSize(const wxSize& size); - // set the padding between tabs (in pixels) - void SetPadding(const wxSize& padding); - - // Sets the size of the tabs (assumes all tabs are the same size) - void SetTabSize(const wxSize& sz); - - // operations - // ---------- - // remove one page from the notebook, and delete the page. - bool DeletePage(size_t nPage); - bool DeletePage(wxNotebookPage* page); - // remove one page from the notebook, without deleting the page. - bool RemovePage(size_t nPage); - bool RemovePage(wxNotebookPage* page); - virtual wxWindow* DoRemovePage(size_t nPage); - - // remove all pages - bool DeleteAllPages(); - // the same as AddPage(), but adds it at the specified position - bool InsertPage(size_t nPage, - wxNotebookPage *pPage, - const wxString& strText, - bool bSelect = false, - int imageId = -1); - - // callbacks - // --------- - void OnSize(wxSizeEvent& event); - void OnInternalIdle(); - void OnSelChange(wxNotebookEvent& event); - void OnSetFocus(wxFocusEvent& event); - void OnNavigationKey(wxNavigationKeyEvent& event); - - // base class virtuals - // ------------------- - virtual void Command(wxCommandEvent& event); - virtual void SetConstraintSizes(bool recurse = true); - virtual bool DoPhase(int nPhase); - - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - // Implementation - - // wxNotebook on Motif uses a generic wxTabView to implement itself. - wxTabView *GetTabView() const { return m_tabView; } - void SetTabView(wxTabView *v) { m_tabView = v; } - - void OnMouseEvent(wxMouseEvent& event); - void OnPaint(wxPaintEvent& event); - - virtual wxRect GetAvailableClientSize(); - - // Implementation: calculate the layout of the view rect - // and resize the children if required - bool RefreshLayout(bool force = true); - -protected: - // common part of all ctors - void Init(); - - // helper functions - void ChangePage(int nOldSel, int nSel); // change pages - - int m_nSelection; // the current selection (-1 if none) - - wxTabView* m_tabView; - - DECLARE_DYNAMIC_CLASS(wxNotebook) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_NOTEBOOK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: notebook.h +// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) +// Author: Julian Smart +// Modified by: +// RCS-ID: $Id: notebook.h 41738 2006-10-08 17:37:23Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTEBOOK_H_ +#define _WX_NOTEBOOK_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/event.h" +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// fwd declarations +class WXDLLEXPORT wxImageList; +class WXDLLEXPORT wxWindow; +class WXDLLEXPORT wxTabView; + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // ctors + // ----- + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl (@@@ any special styles?) + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr); + // dtor + virtual ~wxNotebook(); + + // accessors + // --------- + // Find the position of the wxNotebookPage, -1 if not found. + int FindPagePosition(wxNotebookPage* page) const; + + // set the currently selected page, return the index of the previously + // selected one (or -1 on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage); + // cycle thru the tabs + // void AdvanceSelection(bool bForward = true); + // get the currently selected page + int GetSelection() const { return m_nSelection; } + + // changes selected page without sending events + int ChangeSelection(size_t nPage); + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText); + wxString GetPageText(size_t nPage) const; + + // get the number of rows for a control with wxNB_MULTILINE style (not all + // versions support it - they will always return 1 then) + virtual int GetRowCount() const ; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const; + bool SetPageImage(size_t nPage, int nImage); + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + + // Sets the size of the tabs (assumes all tabs are the same size) + void SetTabSize(const wxSize& sz); + + // operations + // ---------- + // remove one page from the notebook, and delete the page. + bool DeletePage(size_t nPage); + bool DeletePage(wxNotebookPage* page); + // remove one page from the notebook, without deleting the page. + bool RemovePage(size_t nPage); + bool RemovePage(wxNotebookPage* page); + virtual wxWindow* DoRemovePage(size_t nPage); + + // remove all pages + bool DeleteAllPages(); + // the same as AddPage(), but adds it at the specified position + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = -1); + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnInternalIdle(); + void OnSelChange(wxNotebookEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + + // base class virtuals + // ------------------- + virtual void Command(wxCommandEvent& event); + virtual void SetConstraintSizes(bool recurse = true); + virtual bool DoPhase(int nPhase); + + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + // Implementation + + // wxNotebook on Motif uses a generic wxTabView to implement itself. + wxTabView *GetTabView() const { return m_tabView; } + void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + + virtual wxRect GetAvailableClientSize(); + + // Implementation: calculate the layout of the view rect + // and resize the children if required + bool RefreshLayout(bool force = true); + +protected: + // common part of all ctors + void Init(); + + // helper functions + void ChangePage(int nOldSel, int nSel); // change pages + + int m_nSelection; // the current selection (-1 if none) + + wxTabView* m_tabView; + + DECLARE_DYNAMIC_CLASS(wxNotebook) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_NOTEBOOK_H_ diff --git a/Externals/wxWidgets/include/wx/generic/numdlgg.h b/Externals/wxWidgets/include/wx/generic/numdlgg.h index cbebd0918d..06c0d2f017 100644 --- a/Externals/wxWidgets/include/wx/generic/numdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/numdlgg.h @@ -1,79 +1,79 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/numdlgg.h -// Purpose: wxNumberEntryDialog class -// Author: John Labenski -// Modified by: -// Created: 07.02.04 (extracted from textdlgg.cpp) -// RCS-ID: $Id: numdlgg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __NUMDLGH_G__ -#define __NUMDLGH_G__ - -#include "wx/defs.h" - -#if wxUSE_NUMBERDLG - -#include "wx/dialog.h" - -#if wxUSE_SPINCTRL - class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; -#else - class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -#endif // wxUSE_SPINCTRL - -// ---------------------------------------------------------------------------- -// wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNumberEntryDialog : public wxDialog -{ -public: - wxNumberEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& prompt, - const wxString& caption, - long value, long min, long max, - const wxPoint& pos = wxDefaultPosition); - - long GetValue() const { return m_value; } - - // implementation only - void OnOK(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - -protected: - -#if wxUSE_SPINCTRL - wxSpinCtrl *m_spinctrl; -#else - wxTextCtrl *m_spinctrl; -#endif // wxUSE_SPINCTRL - - long m_value, m_min, m_max; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog) - DECLARE_NO_COPY_CLASS(wxNumberEntryDialog) -}; - -// ---------------------------------------------------------------------------- -// function to get a number from user -// ---------------------------------------------------------------------------- - -long WXDLLEXPORT -wxGetNumberFromUser(const wxString& message, - const wxString& prompt, - const wxString& caption, - long value = 0, - long min = 0, - long max = 100, - wxWindow *parent = (wxWindow *)NULL, - const wxPoint& pos = wxDefaultPosition); - -#endif // wxUSE_NUMBERDLG - -#endif // __NUMDLGH_G__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/numdlgg.h +// Purpose: wxNumberEntryDialog class +// Author: John Labenski +// Modified by: +// Created: 07.02.04 (extracted from textdlgg.cpp) +// RCS-ID: $Id: numdlgg.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __NUMDLGH_G__ +#define __NUMDLGH_G__ + +#include "wx/defs.h" + +#if wxUSE_NUMBERDLG + +#include "wx/dialog.h" + +#if wxUSE_SPINCTRL + class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +#else + class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +#endif // wxUSE_SPINCTRL + +// ---------------------------------------------------------------------------- +// wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNumberEntryDialog : public wxDialog +{ +public: + wxNumberEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& prompt, + const wxString& caption, + long value, long min, long max, + const wxPoint& pos = wxDefaultPosition); + + long GetValue() const { return m_value; } + + // implementation only + void OnOK(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + +protected: + +#if wxUSE_SPINCTRL + wxSpinCtrl *m_spinctrl; +#else + wxTextCtrl *m_spinctrl; +#endif // wxUSE_SPINCTRL + + long m_value, m_min, m_max; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog) + DECLARE_NO_COPY_CLASS(wxNumberEntryDialog) +}; + +// ---------------------------------------------------------------------------- +// function to get a number from user +// ---------------------------------------------------------------------------- + +long WXDLLEXPORT +wxGetNumberFromUser(const wxString& message, + const wxString& prompt, + const wxString& caption, + long value = 0, + long min = 0, + long max = 100, + wxWindow *parent = (wxWindow *)NULL, + const wxPoint& pos = wxDefaultPosition); + +#endif // wxUSE_NUMBERDLG + +#endif // __NUMDLGH_G__ diff --git a/Externals/wxWidgets/include/wx/generic/paletteg.h b/Externals/wxWidgets/include/wx/generic/paletteg.h index 6dee36f75f..52fa95bc13 100644 --- a/Externals/wxWidgets/include/wx/generic/paletteg.h +++ b/Externals/wxWidgets/include/wx/generic/paletteg.h @@ -1,49 +1,49 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/paletteg.h -// Purpose: -// Author: Robert Roebling -// Created: 01/02/97 -// RCS-ID: $Id: paletteg.h 42752 2006-10-30 19:26:48Z VZ $ -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef __WX_PALETTEG_H__ -#define __WX_PALETTEG_H__ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPalette; - -//----------------------------------------------------------------------------- -// wxPalette -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase -{ -public: - wxPalette(); - wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); - virtual ~wxPalette(); - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - - bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const; - bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; - - virtual int GetColoursCount() const; - -private: - DECLARE_DYNAMIC_CLASS(wxPalette) -}; - -#endif // __WX_PALETTEG_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/paletteg.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id: paletteg.h 42752 2006-10-30 19:26:48Z VZ $ +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_PALETTEG_H__ +#define __WX_PALETTEG_H__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPalette; + +//----------------------------------------------------------------------------- +// wxPalette +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase +{ +public: + wxPalette(); + wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); + virtual ~wxPalette(); + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + + bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const; + bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; + + virtual int GetColoursCount() const; + +private: + DECLARE_DYNAMIC_CLASS(wxPalette) +}; + +#endif // __WX_PALETTEG_H__ diff --git a/Externals/wxWidgets/include/wx/generic/panelg.h b/Externals/wxWidgets/include/wx/generic/panelg.h index 264cfc61f1..f211a995cc 100644 --- a/Externals/wxWidgets/include/wx/generic/panelg.h +++ b/Externals/wxWidgets/include/wx/generic/panelg.h @@ -1,95 +1,95 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/panelg.h -// Purpose: wxPanel: a container for child controls -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: panelg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_PANEL_H_ -#define _WX_GENERIC_PANEL_H_ - -// ---------------------------------------------------------------------------- -// headers and forward declarations -// ---------------------------------------------------------------------------- - -#include "wx/window.h" -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxControlContainer; - -extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; - -// ---------------------------------------------------------------------------- -// wxPanel contains other controls and implements TAB traversal between them -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPanel : public wxWindow -{ -public: - wxPanel() { Init(); } - - // Old-style constructor (no default values for coordinates to avoid - // ambiguity with the new one) - wxPanel(wxWindow *parent, - int x, int y, int width, int height, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Init(); - - Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); - } - - // Constructor - wxPanel(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Init(); - - Create(parent, winid, pos, size, style, name); - } - - // Pseudo ctor - bool Create(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr); - - virtual ~wxPanel(); - - // implementation from now on - // -------------------------- - - // calls layout for layout constraints and sizers - void OnSize(wxSizeEvent& event); - - virtual void InitDialog(); - -#ifdef __WXUNIVERSAL__ - virtual bool IsCanvasWindow() const { return true; } -#endif - - - WX_DECLARE_CONTROL_CONTAINER(); - -protected: - // common part of all ctors - void Init(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel) - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_GENERIC_PANEL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/panelg.h +// Purpose: wxPanel: a container for child controls +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: panelg.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PANEL_H_ +#define _WX_GENERIC_PANEL_H_ + +// ---------------------------------------------------------------------------- +// headers and forward declarations +// ---------------------------------------------------------------------------- + +#include "wx/window.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxControlContainer; + +extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; + +// ---------------------------------------------------------------------------- +// wxPanel contains other controls and implements TAB traversal between them +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPanel : public wxWindow +{ +public: + wxPanel() { Init(); } + + // Old-style constructor (no default values for coordinates to avoid + // ambiguity with the new one) + wxPanel(wxWindow *parent, + int x, int y, int width, int height, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr) + { + Init(); + + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); + } + + // Constructor + wxPanel(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + // Pseudo ctor + bool Create(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr); + + virtual ~wxPanel(); + + // implementation from now on + // -------------------------- + + // calls layout for layout constraints and sizers + void OnSize(wxSizeEvent& event); + + virtual void InitDialog(); + +#ifdef __WXUNIVERSAL__ + virtual bool IsCanvasWindow() const { return true; } +#endif + + + WX_DECLARE_CONTROL_CONTAINER(); + +protected: + // common part of all ctors + void Init(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_GENERIC_PANEL_H_ diff --git a/Externals/wxWidgets/include/wx/generic/printps.h b/Externals/wxWidgets/include/wx/generic/printps.h index 49cdda526e..107a2a29be 100644 --- a/Externals/wxWidgets/include/wx/generic/printps.h +++ b/Externals/wxWidgets/include/wx/generic/printps.h @@ -1,68 +1,68 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: printps.h -// Purpose: wxPostScriptPrinter, wxPostScriptPrintPreview -// wxGenericPageSetupDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: printps.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __PRINTPSH__ -#define __PRINTPSH__ - -#include "wx/prntbase.h" - -#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT - -// ---------------------------------------------------------------------------- -// Represents the printer: manages printing a wxPrintout object -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPostScriptPrinter : public wxPrinterBase -{ -public: - wxPostScriptPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); - virtual ~wxPostScriptPrinter(); - - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); - virtual wxDC* PrintDialog(wxWindow *parent); - virtual bool Setup(wxWindow *parent); - -private: - DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter) -}; - -// ---------------------------------------------------------------------------- -// wxPrintPreview: programmer creates an object of this class to preview a -// wxPrintout. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPostScriptPrintPreview : public wxPrintPreviewBase -{ -public: - wxPostScriptPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = (wxPrintout *) NULL, - wxPrintDialogData *data = (wxPrintDialogData *) NULL); - wxPostScriptPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - - virtual ~wxPostScriptPrintPreview(); - - virtual bool Print(bool interactive); - virtual void DetermineScaling(); - -private: - void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); - -private: - DECLARE_CLASS(wxPostScriptPrintPreview) -}; - -#endif - -#endif -// __PRINTPSH__ +///////////////////////////////////////////////////////////////////////////// +// Name: printps.h +// Purpose: wxPostScriptPrinter, wxPostScriptPrintPreview +// wxGenericPageSetupDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: printps.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __PRINTPSH__ +#define __PRINTPSH__ + +#include "wx/prntbase.h" + +#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT + +// ---------------------------------------------------------------------------- +// Represents the printer: manages printing a wxPrintout object +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPostScriptPrinter : public wxPrinterBase +{ +public: + wxPostScriptPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); + virtual ~wxPostScriptPrinter(); + + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); + virtual wxDC* PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); + +private: + DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter) +}; + +// ---------------------------------------------------------------------------- +// wxPrintPreview: programmer creates an object of this class to preview a +// wxPrintout. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPostScriptPrintPreview : public wxPrintPreviewBase +{ +public: + wxPostScriptPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = (wxPrintout *) NULL, + wxPrintDialogData *data = (wxPrintDialogData *) NULL); + wxPostScriptPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + + virtual ~wxPostScriptPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); + +private: + void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); + +private: + DECLARE_CLASS(wxPostScriptPrintPreview) +}; + +#endif + +#endif +// __PRINTPSH__ diff --git a/Externals/wxWidgets/include/wx/generic/prntdlgg.h b/Externals/wxWidgets/include/wx/generic/prntdlgg.h index ef57d47cc4..2215e1066e 100644 --- a/Externals/wxWidgets/include/wx/generic/prntdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/prntdlgg.h @@ -1,256 +1,256 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: prntdlgg.h -// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog, -// wxGenericPageSetupDialog -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: prntdlgg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __PRINTDLGH_G_ -#define __PRINTDLGH_G_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/dialog.h" -#include "wx/cmndata.h" -#include "wx/prntbase.h" -#include "wx/printdlg.h" -#include "wx/listctrl.h" - -#if wxUSE_POSTSCRIPT - #include "wx/dcps.h" -#endif - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxCheckBox; -class WXDLLIMPEXP_FWD_CORE wxComboBox; -class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxRadioBox; -class WXDLLIMPEXP_FWD_CORE wxPageSetupData; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// This is not clear why all these enums start with 10 or 30 but do not change it -// without good reason to avoid some subtle backwards compatibility breakage - -enum -{ - wxPRINTID_STATIC = 10, - wxPRINTID_RANGE, - wxPRINTID_FROM, - wxPRINTID_TO, - wxPRINTID_COPIES, - wxPRINTID_PRINTTOFILE, - wxPRINTID_SETUP -}; - -enum -{ - wxPRINTID_LEFTMARGIN = 30, - wxPRINTID_RIGHTMARGIN, - wxPRINTID_TOPMARGIN, - wxPRINTID_BOTTOMMARGIN -}; - -enum -{ - wxPRINTID_PRINTCOLOUR = 10, - wxPRINTID_ORIENTATION, - wxPRINTID_COMMAND, - wxPRINTID_OPTIONS, - wxPRINTID_PAPERSIZE, - wxPRINTID_PRINTER -}; - -#if wxUSE_POSTSCRIPT - -//---------------------------------------------------------------------------- -// wxPostScriptNativeData -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase -{ -public: - wxPostScriptPrintNativeData(); - virtual ~wxPostScriptPrintNativeData(); - - virtual bool TransferTo( wxPrintData &data ); - virtual bool TransferFrom( const wxPrintData &data ); - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return true; } - - const wxString& GetPrinterCommand() const { return m_printerCommand; } - const wxString& GetPrinterOptions() const { return m_printerOptions; } - const wxString& GetPreviewCommand() const { return m_previewCommand; } - const wxString& GetFontMetricPath() const { return m_afmPath; } - double GetPrinterScaleX() const { return m_printerScaleX; } - double GetPrinterScaleY() const { return m_printerScaleY; } - long GetPrinterTranslateX() const { return m_printerTranslateX; } - long GetPrinterTranslateY() const { return m_printerTranslateY; } - - void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } - void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } - void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } - void SetFontMetricPath(const wxString& path) { m_afmPath = path; } - void SetPrinterScaleX(double x) { m_printerScaleX = x; } - void SetPrinterScaleY(double y) { m_printerScaleY = y; } - void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } - void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } - void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } - void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } - -#if wxUSE_STREAMS - wxOutputStream *GetOutputStream() { return m_outputStream; } - void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; } -#endif - -private: - wxString m_printerCommand; - wxString m_previewCommand; - wxString m_printerOptions; - wxString m_afmPath; - double m_printerScaleX; - double m_printerScaleY; - long m_printerTranslateX; - long m_printerTranslateY; -#if wxUSE_STREAMS - wxOutputStream *m_outputStream; -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) -}; - -// ---------------------------------------------------------------------------- -// Simulated Print and Print Setup dialogs for non-Windows platforms (and -// Windows using PostScript print/preview) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase -{ -public: - wxGenericPrintDialog(wxWindow *parent, - wxPrintDialogData* data = (wxPrintDialogData*)NULL); - wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); - - virtual ~wxGenericPrintDialog(); - - void OnSetup(wxCommandEvent& event); - void OnRange(wxCommandEvent& event); - void OnOK(wxCommandEvent& event); - - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - virtual int ShowModal(); - - wxPrintData& GetPrintData() - { return m_printDialogData.GetPrintData(); } - - wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } - wxDC *GetPrintDC(); - -public: -// wxStaticText* m_printerMessage; - wxButton* m_setupButton; -// wxButton* m_helpButton; - wxRadioBox* m_rangeRadioBox; - wxTextCtrl* m_fromText; - wxTextCtrl* m_toText; - wxTextCtrl* m_noCopiesText; - wxCheckBox* m_printToFileCheckBox; -// wxCheckBox* m_collateCopiesCheckBox; - - wxPrintDialogData m_printDialogData; - -protected: - void Init(wxWindow *parent); - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) -}; - -class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog -{ -public: - // There are no configuration options for the dialog, so we - // just pass the wxPrintData object (no wxPrintSetupDialogData class needed) - wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data); - virtual ~wxGenericPrintSetupDialog(); - - void Init(wxPrintData* data); - - void OnPrinter(wxListEvent& event); - - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - virtual wxComboBox *CreatePaperTypeChoice(); - -public: - wxListCtrl* m_printerListCtrl; - wxRadioBox* m_orientationRadioBox; - wxTextCtrl* m_printerCommandText; - wxTextCtrl* m_printerOptionsText; - wxCheckBox* m_colourCheckBox; - wxComboBox* m_paperTypeChoice; - - wxPrintData m_printData; - wxPrintData& GetPrintData() { return m_printData; } - - // After pressing OK, write data here. - wxPrintData* m_targetData; - -private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGenericPrintSetupDialog) -}; -#endif - // wxUSE_POSTSCRIPT - -class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase -{ -public: - wxGenericPageSetupDialog(wxWindow *parent = NULL, - wxPageSetupDialogData* data = NULL); - virtual ~wxGenericPageSetupDialog(); - - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - virtual wxPageSetupDialogData& GetPageSetupDialogData(); - - void OnPrinter(wxCommandEvent& event); - wxComboBox *CreatePaperTypeChoice(int* x, int* y); - -public: - wxButton* m_printerButton; - wxRadioBox* m_orientationRadioBox; - wxTextCtrl* m_marginLeftText; - wxTextCtrl* m_marginTopText; - wxTextCtrl* m_marginRightText; - wxTextCtrl* m_marginBottomText; - wxComboBox* m_paperTypeChoice; - - wxPageSetupDialogData m_pageData; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) -}; - -#endif - -#endif -// __PRINTDLGH_G_ +///////////////////////////////////////////////////////////////////////////// +// Name: prntdlgg.h +// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog, +// wxGenericPageSetupDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: prntdlgg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __PRINTDLGH_G_ +#define __PRINTDLGH_G_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dialog.h" +#include "wx/cmndata.h" +#include "wx/prntbase.h" +#include "wx/printdlg.h" +#include "wx/listctrl.h" + +#if wxUSE_POSTSCRIPT + #include "wx/dcps.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxRadioBox; +class WXDLLIMPEXP_FWD_CORE wxPageSetupData; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// This is not clear why all these enums start with 10 or 30 but do not change it +// without good reason to avoid some subtle backwards compatibility breakage + +enum +{ + wxPRINTID_STATIC = 10, + wxPRINTID_RANGE, + wxPRINTID_FROM, + wxPRINTID_TO, + wxPRINTID_COPIES, + wxPRINTID_PRINTTOFILE, + wxPRINTID_SETUP +}; + +enum +{ + wxPRINTID_LEFTMARGIN = 30, + wxPRINTID_RIGHTMARGIN, + wxPRINTID_TOPMARGIN, + wxPRINTID_BOTTOMMARGIN +}; + +enum +{ + wxPRINTID_PRINTCOLOUR = 10, + wxPRINTID_ORIENTATION, + wxPRINTID_COMMAND, + wxPRINTID_OPTIONS, + wxPRINTID_PAPERSIZE, + wxPRINTID_PRINTER +}; + +#if wxUSE_POSTSCRIPT + +//---------------------------------------------------------------------------- +// wxPostScriptNativeData +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase +{ +public: + wxPostScriptPrintNativeData(); + virtual ~wxPostScriptPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ); + virtual bool TransferFrom( const wxPrintData &data ); + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return true; } + + const wxString& GetPrinterCommand() const { return m_printerCommand; } + const wxString& GetPrinterOptions() const { return m_printerOptions; } + const wxString& GetPreviewCommand() const { return m_previewCommand; } + const wxString& GetFontMetricPath() const { return m_afmPath; } + double GetPrinterScaleX() const { return m_printerScaleX; } + double GetPrinterScaleY() const { return m_printerScaleY; } + long GetPrinterTranslateX() const { return m_printerTranslateX; } + long GetPrinterTranslateY() const { return m_printerTranslateY; } + + void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } + void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } + void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } + void SetFontMetricPath(const wxString& path) { m_afmPath = path; } + void SetPrinterScaleX(double x) { m_printerScaleX = x; } + void SetPrinterScaleY(double y) { m_printerScaleY = y; } + void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } + void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } + void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } + void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } + +#if wxUSE_STREAMS + wxOutputStream *GetOutputStream() { return m_outputStream; } + void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; } +#endif + +private: + wxString m_printerCommand; + wxString m_previewCommand; + wxString m_printerOptions; + wxString m_afmPath; + double m_printerScaleX; + double m_printerScaleY; + long m_printerTranslateX; + long m_printerTranslateY; +#if wxUSE_STREAMS + wxOutputStream *m_outputStream; +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) +}; + +// ---------------------------------------------------------------------------- +// Simulated Print and Print Setup dialogs for non-Windows platforms (and +// Windows using PostScript print/preview) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase +{ +public: + wxGenericPrintDialog(wxWindow *parent, + wxPrintDialogData* data = (wxPrintDialogData*)NULL); + wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); + + virtual ~wxGenericPrintDialog(); + + void OnSetup(wxCommandEvent& event); + void OnRange(wxCommandEvent& event); + void OnOK(wxCommandEvent& event); + + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + virtual int ShowModal(); + + wxPrintData& GetPrintData() + { return m_printDialogData.GetPrintData(); } + + wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + wxDC *GetPrintDC(); + +public: +// wxStaticText* m_printerMessage; + wxButton* m_setupButton; +// wxButton* m_helpButton; + wxRadioBox* m_rangeRadioBox; + wxTextCtrl* m_fromText; + wxTextCtrl* m_toText; + wxTextCtrl* m_noCopiesText; + wxCheckBox* m_printToFileCheckBox; +// wxCheckBox* m_collateCopiesCheckBox; + + wxPrintDialogData m_printDialogData; + +protected: + void Init(wxWindow *parent); + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) +}; + +class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog +{ +public: + // There are no configuration options for the dialog, so we + // just pass the wxPrintData object (no wxPrintSetupDialogData class needed) + wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxGenericPrintSetupDialog(); + + void Init(wxPrintData* data); + + void OnPrinter(wxListEvent& event); + + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + virtual wxComboBox *CreatePaperTypeChoice(); + +public: + wxListCtrl* m_printerListCtrl; + wxRadioBox* m_orientationRadioBox; + wxTextCtrl* m_printerCommandText; + wxTextCtrl* m_printerOptionsText; + wxCheckBox* m_colourCheckBox; + wxComboBox* m_paperTypeChoice; + + wxPrintData m_printData; + wxPrintData& GetPrintData() { return m_printData; } + + // After pressing OK, write data here. + wxPrintData* m_targetData; + +private: + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxGenericPrintSetupDialog) +}; +#endif + // wxUSE_POSTSCRIPT + +class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase +{ +public: + wxGenericPageSetupDialog(wxWindow *parent = NULL, + wxPageSetupDialogData* data = NULL); + virtual ~wxGenericPageSetupDialog(); + + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + virtual wxPageSetupDialogData& GetPageSetupDialogData(); + + void OnPrinter(wxCommandEvent& event); + wxComboBox *CreatePaperTypeChoice(int* x, int* y); + +public: + wxButton* m_printerButton; + wxRadioBox* m_orientationRadioBox; + wxTextCtrl* m_marginLeftText; + wxTextCtrl* m_marginTopText; + wxTextCtrl* m_marginRightText; + wxTextCtrl* m_marginBottomText; + wxComboBox* m_paperTypeChoice; + + wxPageSetupDialogData m_pageData; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) +}; + +#endif + +#endif +// __PRINTDLGH_G_ diff --git a/Externals/wxWidgets/include/wx/generic/progdlgg.h b/Externals/wxWidgets/include/wx/generic/progdlgg.h index 6382d1fc8b..02210b3cad 100644 --- a/Externals/wxWidgets/include/wx/generic/progdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/progdlgg.h @@ -1,172 +1,172 @@ -//////////////////////////////////////////////////// -// Name: progdlgg.h -// Purpose: wxProgressDialog class -// Author: Karsten Ballueder -// Modified by: -// Created: 09.05.1999 -// RCS-ID: $Id: progdlgg.h 50711 2007-12-15 02:57:58Z VZ $ -// Copyright: (c) Karsten Ballueder -// Licence: wxWindows licence -//////////////////////////////////////////////////// - -#ifndef __PROGDLGH_G__ -#define __PROGDLGH_G__ - -#include "wx/defs.h" -#include "wx/progdlg.h" - -#if wxUSE_PROGRESSDLG - -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxGauge; -class WXDLLIMPEXP_FWD_CORE wxStaticText; - -/* Progress dialog which shows a moving progress bar. - Taken from the Mahogany project.*/ - -class WXDLLEXPORT wxProgressDialog : public wxDialog -{ -DECLARE_DYNAMIC_CLASS(wxProgressDialog) -public: - /* Creates and displays dialog, disables event handling for other - frames or parent frame to avoid recursion problems. - @param title title for window - @param message message to display in window - @param maximum value for status bar, if <= 0, no bar is shown - @param parent window or NULL - @param style is the bit mask of wxPD_XXX constants from wx/defs.h - */ - wxProgressDialog(const wxString &title, wxString const &message, - int maximum = 100, - wxWindow *parent = NULL, - int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); - /* Destructor. - Re-enables event handling for other windows. - */ - virtual ~wxProgressDialog(); - - /* Update the status bar to the new value. - @param value new value - @param newmsg if used, new message to display - @returns true if ABORT button has not been pressed - */ - virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); - - /* Switches the dialog to use a gauge in indeterminate mode and calls - wxGauge::Pulse() to show to the user a bit of progress */ - virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); - - // Must provide overload to avoid hiding it (and warnings about it) - virtual void Update() { wxDialog::Update(); } - - /* Can be called to continue after the cancel button has been pressed, but - the program decided to continue the operation (e.g., user didn't - confirm it) - */ - void Resume(); - - virtual bool Show( bool show = true ); - -protected: - // callback for optional abort button - void OnCancel(wxCommandEvent& event); - - // callback for optional skip button - void OnSkip(wxCommandEvent& event); - - // callback to disable "hard" window closing - void OnClose(wxCloseEvent& event); - - // must be called to reenable the other windows temporarily disabled while - // the dialog was shown - void ReenableOtherWindows(); - -private: - // create the label with given text and another one to show the time nearby - // as the next windows in the sizer, returns the created control - wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer); - - // updates the label message - void UpdateMessage(const wxString &newmsg); - - // common part of Update() and Pulse(), returns true if not cancelled - bool DoAfterUpdate(bool *skip); - - // shortcuts for enabling buttons - void EnableClose(); - void EnableSkip(bool enable=true); - void EnableAbort(bool enable=true); - inline void DisableSkip() { EnableSkip(false); } - inline void DisableAbort() { EnableAbort(false); } - - // the status bar - wxGauge *m_gauge; - // the message displayed - wxStaticText *m_msg; - // displayed elapsed, estimated, remaining time - class wxStaticText *m_elapsed, - *m_estimated, - *m_remaining; - // time when the dialog was created - unsigned long m_timeStart; - // time when the dialog was closed or cancelled - unsigned long m_timeStop; - // time between the moment the dialog was closed/cancelled and resume - unsigned long m_break; - - // parent top level window (may be NULL) - wxWindow *m_parentTop; - - // continue processing or not (return value for Update()) - enum - { - Uncancelable = -1, // dialog can't be canceled - Canceled, // can be cancelled and, in fact, was - Continue, // can be cancelled but wasn't - Finished // finished, waiting to be removed from screen - } m_state; - - // skip some portion - bool m_skip; - -#if !defined(__SMARTPHONE__) - // the abort and skip buttons (or NULL if none) - wxButton *m_btnAbort; - wxButton *m_btnSkip; -#endif - - // the maximum value - int m_maximum; - - // saves the time when elapsed time was updated so there is only one - // update per second - unsigned long m_last_timeupdate; - // tells how often a change of the estimated time has to be confirmed - // before it is actually displayed - this reduces the frequence of updates - // of estimated and remaining time - const int m_delay; - // counts the confirmations - int m_ctdelay; - unsigned long m_display_estimated; - - bool m_hasAbortButton, - m_hasSkipButton; - -#if defined(__WXMSW__ ) || defined(__WXPM__) - // the factor we use to always keep the value in 16 bit range as the native - // control only supports ranges from 0 to 65,535 - size_t m_factor; -#endif // __WXMSW__ - - // for wxPD_APP_MODAL case - class WXDLLIMPEXP_FWD_CORE wxWindowDisabler *m_winDisabler; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxProgressDialog) -}; - -#endif // wxUSE_PROGRESSDLG - -#endif // __PROGDLGH_G__ +//////////////////////////////////////////////////// +// Name: progdlgg.h +// Purpose: wxProgressDialog class +// Author: Karsten Ballueder +// Modified by: +// Created: 09.05.1999 +// RCS-ID: $Id: progdlgg.h 50711 2007-12-15 02:57:58Z VZ $ +// Copyright: (c) Karsten Ballueder +// Licence: wxWindows licence +//////////////////////////////////////////////////// + +#ifndef __PROGDLGH_G__ +#define __PROGDLGH_G__ + +#include "wx/defs.h" +#include "wx/progdlg.h" + +#if wxUSE_PROGRESSDLG + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxGauge; +class WXDLLIMPEXP_FWD_CORE wxStaticText; + +/* Progress dialog which shows a moving progress bar. + Taken from the Mahogany project.*/ + +class WXDLLEXPORT wxProgressDialog : public wxDialog +{ +DECLARE_DYNAMIC_CLASS(wxProgressDialog) +public: + /* Creates and displays dialog, disables event handling for other + frames or parent frame to avoid recursion problems. + @param title title for window + @param message message to display in window + @param maximum value for status bar, if <= 0, no bar is shown + @param parent window or NULL + @param style is the bit mask of wxPD_XXX constants from wx/defs.h + */ + wxProgressDialog(const wxString &title, wxString const &message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + /* Destructor. + Re-enables event handling for other windows. + */ + virtual ~wxProgressDialog(); + + /* Update the status bar to the new value. + @param value new value + @param newmsg if used, new message to display + @returns true if ABORT button has not been pressed + */ + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); + + /* Switches the dialog to use a gauge in indeterminate mode and calls + wxGauge::Pulse() to show to the user a bit of progress */ + virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); + + // Must provide overload to avoid hiding it (and warnings about it) + virtual void Update() { wxDialog::Update(); } + + /* Can be called to continue after the cancel button has been pressed, but + the program decided to continue the operation (e.g., user didn't + confirm it) + */ + void Resume(); + + virtual bool Show( bool show = true ); + +protected: + // callback for optional abort button + void OnCancel(wxCommandEvent& event); + + // callback for optional skip button + void OnSkip(wxCommandEvent& event); + + // callback to disable "hard" window closing + void OnClose(wxCloseEvent& event); + + // must be called to reenable the other windows temporarily disabled while + // the dialog was shown + void ReenableOtherWindows(); + +private: + // create the label with given text and another one to show the time nearby + // as the next windows in the sizer, returns the created control + wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer); + + // updates the label message + void UpdateMessage(const wxString &newmsg); + + // common part of Update() and Pulse(), returns true if not cancelled + bool DoAfterUpdate(bool *skip); + + // shortcuts for enabling buttons + void EnableClose(); + void EnableSkip(bool enable=true); + void EnableAbort(bool enable=true); + inline void DisableSkip() { EnableSkip(false); } + inline void DisableAbort() { EnableAbort(false); } + + // the status bar + wxGauge *m_gauge; + // the message displayed + wxStaticText *m_msg; + // displayed elapsed, estimated, remaining time + class wxStaticText *m_elapsed, + *m_estimated, + *m_remaining; + // time when the dialog was created + unsigned long m_timeStart; + // time when the dialog was closed or cancelled + unsigned long m_timeStop; + // time between the moment the dialog was closed/cancelled and resume + unsigned long m_break; + + // parent top level window (may be NULL) + wxWindow *m_parentTop; + + // continue processing or not (return value for Update()) + enum + { + Uncancelable = -1, // dialog can't be canceled + Canceled, // can be cancelled and, in fact, was + Continue, // can be cancelled but wasn't + Finished // finished, waiting to be removed from screen + } m_state; + + // skip some portion + bool m_skip; + +#if !defined(__SMARTPHONE__) + // the abort and skip buttons (or NULL if none) + wxButton *m_btnAbort; + wxButton *m_btnSkip; +#endif + + // the maximum value + int m_maximum; + + // saves the time when elapsed time was updated so there is only one + // update per second + unsigned long m_last_timeupdate; + // tells how often a change of the estimated time has to be confirmed + // before it is actually displayed - this reduces the frequence of updates + // of estimated and remaining time + const int m_delay; + // counts the confirmations + int m_ctdelay; + unsigned long m_display_estimated; + + bool m_hasAbortButton, + m_hasSkipButton; + +#if defined(__WXMSW__ ) || defined(__WXPM__) + // the factor we use to always keep the value in 16 bit range as the native + // control only supports ranges from 0 to 65,535 + size_t m_factor; +#endif // __WXMSW__ + + // for wxPD_APP_MODAL case + class WXDLLIMPEXP_FWD_CORE wxWindowDisabler *m_winDisabler; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxProgressDialog) +}; + +#endif // wxUSE_PROGRESSDLG + +#endif // __PROGDLGH_G__ diff --git a/Externals/wxWidgets/include/wx/generic/propdlg.h b/Externals/wxWidgets/include/wx/generic/propdlg.h index 1e8e6a9be5..8c21991164 100644 --- a/Externals/wxWidgets/include/wx/generic/propdlg.h +++ b/Externals/wxWidgets/include/wx/generic/propdlg.h @@ -1,163 +1,163 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/propdlg.h -// Purpose: wxPropertySheetDialog -// Author: Julian Smart -// Modified by: -// Created: 2005-03-12 -// RCS-ID: $Id: propdlg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROPDLG_H_ -#define _WX_PROPDLG_H_ - -#include "wx/defs.h" - -#if wxUSE_BOOKCTRL - -#include "wx/dialog.h" - -class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; - -//----------------------------------------------------------------------------- -// wxPropertySheetDialog -// A platform-independent properties dialog. -// -// * on PocketPC, a flat-look 'property sheet' notebook will be used, with -// no OK/Cancel/Help buttons -// * on other platforms, a normal notebook will be used, with standard buttons -// -// To use this class, call Create from your derived class. -// Then create pages and add to the book control. Finally call CreateButtons and -// LayoutDialog. -// -// For example: -// -// MyPropertySheetDialog::Create(...) -// { -// wxPropertySheetDialog::Create(...); -// -// // Add page -// wxPanel* panel = new wxPanel(GetBookCtrl(), ...); -// GetBookCtrl()->AddPage(panel, wxT("General")); -// -// CreateButtons(); -// LayoutDialog(); -// } -// -// Override CreateBookCtrl and AddBookCtrl to create and add a different -// kind of book control. -//----------------------------------------------------------------------------- - -// Use the platform default -#define wxPROPSHEET_DEFAULT 0x0001 - -// Use a notebook -#define wxPROPSHEET_NOTEBOOK 0x0002 - -// Use a toolbook -#define wxPROPSHEET_TOOLBOOK 0x0004 - -// Use a choicebook -#define wxPROPSHEET_CHOICEBOOK 0x0008 - -// Use a listbook -#define wxPROPSHEET_LISTBOOK 0x0010 - -// Use a wxButtonToolBar toolbook -#define wxPROPSHEET_BUTTONTOOLBOOK 0x0020 - -// Use a treebook -#define wxPROPSHEET_TREEBOOK 0x0040 - -// Shrink dialog to fit current page -#define wxPROPSHEET_SHRINKTOFIT 0x0100 - -class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog -{ -public: - wxPropertySheetDialog() : wxDialog() { Init(); } - - wxPropertySheetDialog(wxWindow* parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Init(); - Create(parent, id, title, pos, sz, style, name); - } - - bool Create(wxWindow* parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - -//// Accessors - - // Set and get the notebook - void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } - wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } - - // Set and get the inner sizer - void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } - wxSizer* GetInnerSizer() const { return m_innerSizer ; } - - // Set and get the book style - void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; } - long GetSheetStyle() const { return m_sheetStyle ; } - - // Set and get the border around the whole dialog - void SetSheetOuterBorder(int border) { m_sheetOuterBorder = border; } - int GetSheetOuterBorder() const { return m_sheetOuterBorder ; } - - // Set and get the border around the book control only - void SetSheetInnerBorder(int border) { m_sheetInnerBorder = border; } - int GetSheetInnerBorder() const { return m_sheetInnerBorder ; } - -/// Operations - - // Creates the buttons (none on PocketPC) - virtual void CreateButtons(int flags = wxOK|wxCANCEL); - - // Lay out the dialog, to be called after pages have been created - virtual void LayoutDialog(int centreFlags = wxBOTH); - -/// Implementation - - // Creates the book control. If you want to use a different kind of - // control, override. - virtual wxBookCtrlBase* CreateBookCtrl(); - - // Adds the book control to the inner sizer. - virtual void AddBookCtrl(wxSizer* sizer); - - // Set the focus - void OnActivate(wxActivateEvent& event); - - // Resize dialog if necessary - void OnIdle(wxIdleEvent& event); - -private: - void Init(); - -protected: - wxBookCtrlBase* m_bookCtrl; - wxSizer* m_innerSizer; // sizer for extra space - long m_sheetStyle; - int m_sheetOuterBorder; - int m_sheetInnerBorder; - int m_selectedPage; - - DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_BOOKCTRL - -#endif // _WX_PROPDLG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/propdlg.h +// Purpose: wxPropertySheetDialog +// Author: Julian Smart +// Modified by: +// Created: 2005-03-12 +// RCS-ID: $Id: propdlg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPDLG_H_ +#define _WX_PROPDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_BOOKCTRL + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; + +//----------------------------------------------------------------------------- +// wxPropertySheetDialog +// A platform-independent properties dialog. +// +// * on PocketPC, a flat-look 'property sheet' notebook will be used, with +// no OK/Cancel/Help buttons +// * on other platforms, a normal notebook will be used, with standard buttons +// +// To use this class, call Create from your derived class. +// Then create pages and add to the book control. Finally call CreateButtons and +// LayoutDialog. +// +// For example: +// +// MyPropertySheetDialog::Create(...) +// { +// wxPropertySheetDialog::Create(...); +// +// // Add page +// wxPanel* panel = new wxPanel(GetBookCtrl(), ...); +// GetBookCtrl()->AddPage(panel, wxT("General")); +// +// CreateButtons(); +// LayoutDialog(); +// } +// +// Override CreateBookCtrl and AddBookCtrl to create and add a different +// kind of book control. +//----------------------------------------------------------------------------- + +// Use the platform default +#define wxPROPSHEET_DEFAULT 0x0001 + +// Use a notebook +#define wxPROPSHEET_NOTEBOOK 0x0002 + +// Use a toolbook +#define wxPROPSHEET_TOOLBOOK 0x0004 + +// Use a choicebook +#define wxPROPSHEET_CHOICEBOOK 0x0008 + +// Use a listbook +#define wxPROPSHEET_LISTBOOK 0x0010 + +// Use a wxButtonToolBar toolbook +#define wxPROPSHEET_BUTTONTOOLBOOK 0x0020 + +// Use a treebook +#define wxPROPSHEET_TREEBOOK 0x0040 + +// Shrink dialog to fit current page +#define wxPROPSHEET_SHRINKTOFIT 0x0100 + +class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog +{ +public: + wxPropertySheetDialog() : wxDialog() { Init(); } + + wxPropertySheetDialog(wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + Init(); + Create(parent, id, title, pos, sz, style, name); + } + + bool Create(wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + +//// Accessors + + // Set and get the notebook + void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } + wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } + + // Set and get the inner sizer + void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } + wxSizer* GetInnerSizer() const { return m_innerSizer ; } + + // Set and get the book style + void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; } + long GetSheetStyle() const { return m_sheetStyle ; } + + // Set and get the border around the whole dialog + void SetSheetOuterBorder(int border) { m_sheetOuterBorder = border; } + int GetSheetOuterBorder() const { return m_sheetOuterBorder ; } + + // Set and get the border around the book control only + void SetSheetInnerBorder(int border) { m_sheetInnerBorder = border; } + int GetSheetInnerBorder() const { return m_sheetInnerBorder ; } + +/// Operations + + // Creates the buttons (none on PocketPC) + virtual void CreateButtons(int flags = wxOK|wxCANCEL); + + // Lay out the dialog, to be called after pages have been created + virtual void LayoutDialog(int centreFlags = wxBOTH); + +/// Implementation + + // Creates the book control. If you want to use a different kind of + // control, override. + virtual wxBookCtrlBase* CreateBookCtrl(); + + // Adds the book control to the inner sizer. + virtual void AddBookCtrl(wxSizer* sizer); + + // Set the focus + void OnActivate(wxActivateEvent& event); + + // Resize dialog if necessary + void OnIdle(wxIdleEvent& event); + +private: + void Init(); + +protected: + wxBookCtrlBase* m_bookCtrl; + wxSizer* m_innerSizer; // sizer for extra space + long m_sheetStyle; + int m_sheetOuterBorder; + int m_sheetInnerBorder; + int m_selectedPage; + + DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_BOOKCTRL + +#endif // _WX_PROPDLG_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/region.h b/Externals/wxWidgets/include/wx/generic/region.h index 9c2a43eb37..1a27f289f5 100644 --- a/Externals/wxWidgets/include/wx/generic/region.h +++ b/Externals/wxWidgets/include/wx/generic/region.h @@ -1,79 +1,79 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/region.h -// Purpose: generic wxRegion class -// Author: David Elliott -// Modified by: -// Created: 2004/04/12 -// RCS-ID: $Id: region.h 41429 2006-09-25 11:47:23Z VZ $ -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_REGION_H__ -#define _WX_GENERIC_REGION_H__ - -class WXDLLEXPORT wxRegionGeneric : public wxRegionBase -{ -public: - wxRegionGeneric(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - wxRegionGeneric(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRegionGeneric(const wxRect& rect); - wxRegionGeneric(); - virtual ~wxRegionGeneric(); - - // wxRegionBase pure virtuals - virtual void Clear(); - virtual bool IsEmpty() const; - -protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - // wxRegionBase pure virtuals - virtual bool DoIsEqual(const wxRegion& region) const; - virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; - virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; - virtual wxRegionContain DoContainsRect(const wxRect& rect) const; - - virtual bool DoOffset(wxCoord x, wxCoord y); - virtual bool DoUnionWithRect(const wxRect& rect); - virtual bool DoUnionWithRegion(const wxRegion& region); - virtual bool DoIntersect(const wxRegion& region); - virtual bool DoSubtract(const wxRegion& region); - virtual bool DoXor(const wxRegion& region); - - friend class WXDLLEXPORT wxRegionIteratorGeneric; -}; - -class WXDLLEXPORT wxRegionIteratorGeneric : public wxObject -{ -public: - wxRegionIteratorGeneric(); - wxRegionIteratorGeneric(const wxRegionGeneric& region); - wxRegionIteratorGeneric(const wxRegionIteratorGeneric& iterator); - virtual ~wxRegionIteratorGeneric(); - - wxRegionIteratorGeneric& operator=(const wxRegionIteratorGeneric& iterator); - - void Reset() { m_current = 0; } - void Reset(const wxRegionGeneric& region); - - operator bool () const { return HaveRects(); } - bool HaveRects() const; - - wxRegionIteratorGeneric& operator++(); - wxRegionIteratorGeneric operator++(int); - - long GetX() const; - long GetY() const; - long GetW() const; - long GetWidth() const { return GetW(); } - long GetH() const; - long GetHeight() const { return GetH(); } - wxRect GetRect() const; -private: - long m_current; - wxRegionGeneric m_region; -}; - -#endif // _WX_GENERIC_REGION_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/region.h +// Purpose: generic wxRegion class +// Author: David Elliott +// Modified by: +// Created: 2004/04/12 +// RCS-ID: $Id: region.h 41429 2006-09-25 11:47:23Z VZ $ +// Copyright: (c) 2004 David Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_REGION_H__ +#define _WX_GENERIC_REGION_H__ + +class WXDLLEXPORT wxRegionGeneric : public wxRegionBase +{ +public: + wxRegionGeneric(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegionGeneric(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegionGeneric(const wxRect& rect); + wxRegionGeneric(); + virtual ~wxRegionGeneric(); + + // wxRegionBase pure virtuals + virtual void Clear(); + virtual bool IsEmpty() const; + +protected: + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); + + friend class WXDLLEXPORT wxRegionIteratorGeneric; +}; + +class WXDLLEXPORT wxRegionIteratorGeneric : public wxObject +{ +public: + wxRegionIteratorGeneric(); + wxRegionIteratorGeneric(const wxRegionGeneric& region); + wxRegionIteratorGeneric(const wxRegionIteratorGeneric& iterator); + virtual ~wxRegionIteratorGeneric(); + + wxRegionIteratorGeneric& operator=(const wxRegionIteratorGeneric& iterator); + + void Reset() { m_current = 0; } + void Reset(const wxRegionGeneric& region); + + operator bool () const { return HaveRects(); } + bool HaveRects() const; + + wxRegionIteratorGeneric& operator++(); + wxRegionIteratorGeneric operator++(int); + + long GetX() const; + long GetY() const; + long GetW() const; + long GetWidth() const { return GetW(); } + long GetH() const; + long GetHeight() const { return GetH(); } + wxRect GetRect() const; +private: + long m_current; + wxRegionGeneric m_region; +}; + +#endif // _WX_GENERIC_REGION_H__ diff --git a/Externals/wxWidgets/include/wx/generic/sashwin.h b/Externals/wxWidgets/include/wx/generic/sashwin.h index fa16a118db..457a4a7292 100644 --- a/Externals/wxWidgets/include/wx/generic/sashwin.h +++ b/Externals/wxWidgets/include/wx/generic/sashwin.h @@ -1,261 +1,261 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sashwin.h -// Purpose: wxSashWindow implementation. A sash window has an optional -// sash on each edge, allowing it to be dragged. An event -// is generated when the sash is released. -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: sashwin.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SASHWIN_H_G_ -#define _WX_SASHWIN_H_G_ - -#if wxUSE_SASH - -#include "wx/defs.h" -#include "wx/window.h" -#include "wx/string.h" - -#define wxSASH_DRAG_NONE 0 -#define wxSASH_DRAG_DRAGGING 1 -#define wxSASH_DRAG_LEFT_DOWN 2 - -enum wxSashEdgePosition { - wxSASH_TOP = 0, - wxSASH_RIGHT, - wxSASH_BOTTOM, - wxSASH_LEFT, - wxSASH_NONE = 100 -}; - -/* - * wxSashEdge represents one of the four edges of a window. - */ - -class WXDLLIMPEXP_ADV wxSashEdge -{ -public: - wxSashEdge() - { m_show = false; -#if WXWIN_COMPATIBILITY_2_6 - m_border = false; -#endif - m_margin = 0; } - - bool m_show; // Is the sash showing? -#if WXWIN_COMPATIBILITY_2_6 - bool m_border; // Do we draw a border? -#endif - int m_margin; // The margin size -}; - -/* - * wxSashWindow flags - */ - -#define wxSW_NOBORDER 0x0000 -//#define wxSW_3D 0x0010 -#define wxSW_BORDER 0x0020 -#define wxSW_3DSASH 0x0040 -#define wxSW_3DBORDER 0x0080 -#define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER) - -/* - * wxSashWindow allows any of its edges to have a sash which can be dragged - * to resize the window. The actual content window will be created as a child - * of wxSashWindow. - */ - -class WXDLLIMPEXP_ADV wxSashWindow: public wxWindow -{ -public: - // Default constructor - wxSashWindow() - { - Init(); - } - - // Normal constructor - wxSashWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow")) - { - Init(); - Create(parent, id, pos, size, style, name); - } - - virtual ~wxSashWindow(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow")); - - // Set whether there's a sash in this position - void SetSashVisible(wxSashEdgePosition edge, bool sash); - - // Get whether there's a sash in this position - bool GetSashVisible(wxSashEdgePosition edge) const { return m_sashes[edge].m_show; } - -#if WXWIN_COMPATIBILITY_2_6 - // Set whether there's a border in this position - // This value is unused in wxSashWindow. - void SetSashBorder(wxSashEdgePosition edge, bool border) { m_sashes[edge].m_border = border; } - - // Get whether there's a border in this position - // This value is unused in wxSashWindow. - bool HasBorder(wxSashEdgePosition edge) const { return m_sashes[edge].m_border; } -#endif - - // Get border size - int GetEdgeMargin(wxSashEdgePosition edge) const { return m_sashes[edge].m_margin; } - - // Sets the default sash border size - void SetDefaultBorderSize(int width) { m_borderSize = width; } - - // Gets the default sash border size - int GetDefaultBorderSize() const { return m_borderSize; } - - // Sets the addition border size between child and sash window - void SetExtraBorderSize(int width) { m_extraBorderSize = width; } - - // Gets the addition border size between child and sash window - int GetExtraBorderSize() const { return m_extraBorderSize; } - - virtual void SetMinimumSizeX(int min) { m_minimumPaneSizeX = min; } - virtual void SetMinimumSizeY(int min) { m_minimumPaneSizeY = min; } - virtual int GetMinimumSizeX() const { return m_minimumPaneSizeX; } - virtual int GetMinimumSizeY() const { return m_minimumPaneSizeY; } - - virtual void SetMaximumSizeX(int max) { m_maximumPaneSizeX = max; } - virtual void SetMaximumSizeY(int max) { m_maximumPaneSizeY = max; } - virtual int GetMaximumSizeX() const { return m_maximumPaneSizeX; } - virtual int GetMaximumSizeY() const { return m_maximumPaneSizeY; } - -//////////////////////////////////////////////////////////////////////////// -// Implementation - - // Paints the border and sash - void OnPaint(wxPaintEvent& event); - - // Handles mouse events - void OnMouseEvent(wxMouseEvent& ev); - - // Adjusts the panes - void OnSize(wxSizeEvent& event); - -#if defined(__WXMSW__) || defined(__WXMAC__) - // Handle cursor correctly - void OnSetCursor(wxSetCursorEvent& event); -#endif // wxMSW - - // Draws borders - void DrawBorders(wxDC& dc); - - // Draws the sashes - void DrawSash(wxSashEdgePosition edge, wxDC& dc); - - // Draws the sashes - void DrawSashes(wxDC& dc); - - // Draws the sash tracker (for whilst moving the sash) - void DrawSashTracker(wxSashEdgePosition edge, int x, int y); - - // Tests for x, y over sash - wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2); - - // Resizes subwindows - void SizeWindows(); - - // Initialize colours - void InitColours(); - -private: - void Init(); - - wxSashEdge m_sashes[4]; - int m_dragMode; - wxSashEdgePosition m_draggingEdge; - int m_oldX; - int m_oldY; - int m_borderSize; - int m_extraBorderSize; - int m_firstX; - int m_firstY; - int m_minimumPaneSizeX; - int m_minimumPaneSizeY; - int m_maximumPaneSizeX; - int m_maximumPaneSizeY; - wxCursor* m_sashCursorWE; - wxCursor* m_sashCursorNS; - wxColour m_lightShadowColour; - wxColour m_mediumShadowColour; - wxColour m_darkShadowColour; - wxColour m_hilightColour; - wxColour m_faceColour; - bool m_mouseCaptured; - wxCursor* m_currentCursor; - -private: - DECLARE_DYNAMIC_CLASS(wxSashWindow) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSashWindow) -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, - wxEVT_SASH_DRAGGED, wxEVT_FIRST + 1200) -END_DECLARE_EVENT_TYPES() - -enum wxSashDragStatus -{ - wxSASH_STATUS_OK, - wxSASH_STATUS_OUT_OF_RANGE -}; - -class WXDLLIMPEXP_ADV wxSashEvent: public wxCommandEvent -{ -public: - wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE) - { - m_eventType = (wxEventType) wxEVT_SASH_DRAGGED; - m_id = id; - m_edge = edge; - } - - void SetEdge(wxSashEdgePosition edge) { m_edge = edge; } - wxSashEdgePosition GetEdge() const { return m_edge; } - - //// The rectangle formed by the drag operation - void SetDragRect(const wxRect& rect) { m_dragRect = rect; } - wxRect GetDragRect() const { return m_dragRect; } - - //// Whether the drag caused the rectangle to be reversed (e.g. - //// dragging the top below the bottom) - void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; } - wxSashDragStatus GetDragStatus() const { return m_dragStatus; } - -private: - wxSashEdgePosition m_edge; - wxRect m_dragRect; - wxSashDragStatus m_dragStatus; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSashEvent) -}; - -typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&); - -#define wxSashEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSashEventFunction, &func) - -#define EVT_SASH_DRAGGED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_SASH_DRAGGED, id, wxSashEventHandler(fn)) -#define EVT_SASH_DRAGGED_RANGE(id1, id2, fn) \ - wx__DECLARE_EVT2(wxEVT_SASH_DRAGGED, id1, id2, wxSashEventHandler(fn)) - -#endif // wxUSE_SASH - -#endif - // _WX_SASHWIN_H_G_ +///////////////////////////////////////////////////////////////////////////// +// Name: sashwin.h +// Purpose: wxSashWindow implementation. A sash window has an optional +// sash on each edge, allowing it to be dragged. An event +// is generated when the sash is released. +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: sashwin.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SASHWIN_H_G_ +#define _WX_SASHWIN_H_G_ + +#if wxUSE_SASH + +#include "wx/defs.h" +#include "wx/window.h" +#include "wx/string.h" + +#define wxSASH_DRAG_NONE 0 +#define wxSASH_DRAG_DRAGGING 1 +#define wxSASH_DRAG_LEFT_DOWN 2 + +enum wxSashEdgePosition { + wxSASH_TOP = 0, + wxSASH_RIGHT, + wxSASH_BOTTOM, + wxSASH_LEFT, + wxSASH_NONE = 100 +}; + +/* + * wxSashEdge represents one of the four edges of a window. + */ + +class WXDLLIMPEXP_ADV wxSashEdge +{ +public: + wxSashEdge() + { m_show = false; +#if WXWIN_COMPATIBILITY_2_6 + m_border = false; +#endif + m_margin = 0; } + + bool m_show; // Is the sash showing? +#if WXWIN_COMPATIBILITY_2_6 + bool m_border; // Do we draw a border? +#endif + int m_margin; // The margin size +}; + +/* + * wxSashWindow flags + */ + +#define wxSW_NOBORDER 0x0000 +//#define wxSW_3D 0x0010 +#define wxSW_BORDER 0x0020 +#define wxSW_3DSASH 0x0040 +#define wxSW_3DBORDER 0x0080 +#define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER) + +/* + * wxSashWindow allows any of its edges to have a sash which can be dragged + * to resize the window. The actual content window will be created as a child + * of wxSashWindow. + */ + +class WXDLLIMPEXP_ADV wxSashWindow: public wxWindow +{ +public: + // Default constructor + wxSashWindow() + { + Init(); + } + + // Normal constructor + wxSashWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow")) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSashWindow(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow")); + + // Set whether there's a sash in this position + void SetSashVisible(wxSashEdgePosition edge, bool sash); + + // Get whether there's a sash in this position + bool GetSashVisible(wxSashEdgePosition edge) const { return m_sashes[edge].m_show; } + +#if WXWIN_COMPATIBILITY_2_6 + // Set whether there's a border in this position + // This value is unused in wxSashWindow. + void SetSashBorder(wxSashEdgePosition edge, bool border) { m_sashes[edge].m_border = border; } + + // Get whether there's a border in this position + // This value is unused in wxSashWindow. + bool HasBorder(wxSashEdgePosition edge) const { return m_sashes[edge].m_border; } +#endif + + // Get border size + int GetEdgeMargin(wxSashEdgePosition edge) const { return m_sashes[edge].m_margin; } + + // Sets the default sash border size + void SetDefaultBorderSize(int width) { m_borderSize = width; } + + // Gets the default sash border size + int GetDefaultBorderSize() const { return m_borderSize; } + + // Sets the addition border size between child and sash window + void SetExtraBorderSize(int width) { m_extraBorderSize = width; } + + // Gets the addition border size between child and sash window + int GetExtraBorderSize() const { return m_extraBorderSize; } + + virtual void SetMinimumSizeX(int min) { m_minimumPaneSizeX = min; } + virtual void SetMinimumSizeY(int min) { m_minimumPaneSizeY = min; } + virtual int GetMinimumSizeX() const { return m_minimumPaneSizeX; } + virtual int GetMinimumSizeY() const { return m_minimumPaneSizeY; } + + virtual void SetMaximumSizeX(int max) { m_maximumPaneSizeX = max; } + virtual void SetMaximumSizeY(int max) { m_maximumPaneSizeY = max; } + virtual int GetMaximumSizeX() const { return m_maximumPaneSizeX; } + virtual int GetMaximumSizeY() const { return m_maximumPaneSizeY; } + +//////////////////////////////////////////////////////////////////////////// +// Implementation + + // Paints the border and sash + void OnPaint(wxPaintEvent& event); + + // Handles mouse events + void OnMouseEvent(wxMouseEvent& ev); + + // Adjusts the panes + void OnSize(wxSizeEvent& event); + +#if defined(__WXMSW__) || defined(__WXMAC__) + // Handle cursor correctly + void OnSetCursor(wxSetCursorEvent& event); +#endif // wxMSW + + // Draws borders + void DrawBorders(wxDC& dc); + + // Draws the sashes + void DrawSash(wxSashEdgePosition edge, wxDC& dc); + + // Draws the sashes + void DrawSashes(wxDC& dc); + + // Draws the sash tracker (for whilst moving the sash) + void DrawSashTracker(wxSashEdgePosition edge, int x, int y); + + // Tests for x, y over sash + wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2); + + // Resizes subwindows + void SizeWindows(); + + // Initialize colours + void InitColours(); + +private: + void Init(); + + wxSashEdge m_sashes[4]; + int m_dragMode; + wxSashEdgePosition m_draggingEdge; + int m_oldX; + int m_oldY; + int m_borderSize; + int m_extraBorderSize; + int m_firstX; + int m_firstY; + int m_minimumPaneSizeX; + int m_minimumPaneSizeY; + int m_maximumPaneSizeX; + int m_maximumPaneSizeY; + wxCursor* m_sashCursorWE; + wxCursor* m_sashCursorNS; + wxColour m_lightShadowColour; + wxColour m_mediumShadowColour; + wxColour m_darkShadowColour; + wxColour m_hilightColour; + wxColour m_faceColour; + bool m_mouseCaptured; + wxCursor* m_currentCursor; + +private: + DECLARE_DYNAMIC_CLASS(wxSashWindow) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSashWindow) +}; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, + wxEVT_SASH_DRAGGED, wxEVT_FIRST + 1200) +END_DECLARE_EVENT_TYPES() + +enum wxSashDragStatus +{ + wxSASH_STATUS_OK, + wxSASH_STATUS_OUT_OF_RANGE +}; + +class WXDLLIMPEXP_ADV wxSashEvent: public wxCommandEvent +{ +public: + wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE) + { + m_eventType = (wxEventType) wxEVT_SASH_DRAGGED; + m_id = id; + m_edge = edge; + } + + void SetEdge(wxSashEdgePosition edge) { m_edge = edge; } + wxSashEdgePosition GetEdge() const { return m_edge; } + + //// The rectangle formed by the drag operation + void SetDragRect(const wxRect& rect) { m_dragRect = rect; } + wxRect GetDragRect() const { return m_dragRect; } + + //// Whether the drag caused the rectangle to be reversed (e.g. + //// dragging the top below the bottom) + void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; } + wxSashDragStatus GetDragStatus() const { return m_dragStatus; } + +private: + wxSashEdgePosition m_edge; + wxRect m_dragRect; + wxSashDragStatus m_dragStatus; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSashEvent) +}; + +typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&); + +#define wxSashEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSashEventFunction, &func) + +#define EVT_SASH_DRAGGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_SASH_DRAGGED, id, wxSashEventHandler(fn)) +#define EVT_SASH_DRAGGED_RANGE(id1, id2, fn) \ + wx__DECLARE_EVT2(wxEVT_SASH_DRAGGED, id1, id2, wxSashEventHandler(fn)) + +#endif // wxUSE_SASH + +#endif + // _WX_SASHWIN_H_G_ diff --git a/Externals/wxWidgets/include/wx/generic/scrolwin.h b/Externals/wxWidgets/include/wx/generic/scrolwin.h index b1cea5de76..1677315fc8 100644 --- a/Externals/wxWidgets/include/wx/generic/scrolwin.h +++ b/Externals/wxWidgets/include/wx/generic/scrolwin.h @@ -1,27 +1,27 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/scrolwin.h -// Purpose: wxGenericScrolledWindow class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: scrolwin.h 35875 2005-10-10 18:24:27Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SCROLLWIN_H_ -#define _WX_GENERIC_SCROLLWIN_H_ - -// ---------------------------------------------------------------------------- -// headers and constants -// ---------------------------------------------------------------------------- - -#include "wx/window.h" -#include "wx/panel.h" - -// ---------------------------------------------------------------------------- -// wxGenericScrolledWindow -// ---------------------------------------------------------------------------- - -#endif // _WX_GENERIC_SCROLLWIN_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/scrolwin.h +// Purpose: wxGenericScrolledWindow class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: scrolwin.h 35875 2005-10-10 18:24:27Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SCROLLWIN_H_ +#define _WX_GENERIC_SCROLLWIN_H_ + +// ---------------------------------------------------------------------------- +// headers and constants +// ---------------------------------------------------------------------------- + +#include "wx/window.h" +#include "wx/panel.h" + +// ---------------------------------------------------------------------------- +// wxGenericScrolledWindow +// ---------------------------------------------------------------------------- + +#endif // _WX_GENERIC_SCROLLWIN_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/spinctlg.h b/Externals/wxWidgets/include/wx/generic/spinctlg.h index 386c881c2c..7874e441fb 100644 --- a/Externals/wxWidgets/include/wx/generic/spinctlg.h +++ b/Externals/wxWidgets/include/wx/generic/spinctlg.h @@ -1,183 +1,183 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/spinctlg.h -// Purpose: generic wxSpinCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 28.10.99 -// RCS-ID: $Id: spinctlg.h 52582 2008-03-17 13:46:31Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SPINCTRL_H_ -#define _WX_GENERIC_SPINCTRL_H_ - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if -// wxSpinButton is available, this is what we do - but if it isn't, we still -// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but -// the different interface. This allows to write programs using wxSpinCtrl -// without tons of #ifdefs. -// ---------------------------------------------------------------------------- - -#if wxUSE_SPINBTN - -class WXDLLEXPORT wxSpinButton; -class WXDLLEXPORT wxTextCtrl; - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinCtrl : public wxControl -{ -public: - wxSpinCtrl() { Init(); } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")) - { - Init(); - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")); - - virtual ~wxSpinCtrl(); - - // operations - void SetValue(int val); - void SetValue(const wxString& text); - void SetRange(int min, int max); - void SetSelection(long from, long to); - - // accessors - int GetValue() const; - int GetMin() const; - int GetMax() const; - - // implementation from now on - - // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - virtual bool Reparent(wxWindow *newParent); - - // get the subcontrols - wxTextCtrl *GetText() const { return m_text; } - wxSpinButton *GetSpinButton() const { return m_btn; } - - // set the value of the text (only) - void SetTextValue(int val); - - // put the numeric value of the string in the text ctrl into val and return - // true or return false if the text ctrl doesn't contain a number or if the - // number is out of range - bool GetTextValue(int *val) const; - -protected: - // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - - // common part of all ctors - void Init(); - -private: - // the subcontrols - wxTextCtrl *m_text; - wxSpinButton *m_btn; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#else // !wxUSE_SPINBTN - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is just a text control -// ---------------------------------------------------------------------------- - -#include "wx/textctrl.h" - -class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl -{ -public: - wxSpinCtrl() { Init(); } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")) - { - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")) - { - SetRange(min, max); - - bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, - wxDefaultValidator, name); - SetValue(initial); - - return ok; - } - - // accessors - int GetValue(int WXUNUSED(dummy) = 1) const - { - int n; - if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) ) - n = INT_MIN; - - return n; - } - - int GetMin() const { return m_min; } - int GetMax() const { return m_max; } - - // operations - void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); } - void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); } - void SetRange(int min, int max) { m_min = min; m_max = max; } - -protected: - // initialize m_min/max with the default values - void Init() { SetRange(0, 100); } - - int m_min; - int m_max; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN - -#endif // _WX_GENERIC_SPINCTRL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/spinctlg.h +// Purpose: generic wxSpinCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 28.10.99 +// RCS-ID: $Id: spinctlg.h 52582 2008-03-17 13:46:31Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SPINCTRL_H_ +#define _WX_GENERIC_SPINCTRL_H_ + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if +// wxSpinButton is available, this is what we do - but if it isn't, we still +// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but +// the different interface. This allows to write programs using wxSpinCtrl +// without tons of #ifdefs. +// ---------------------------------------------------------------------------- + +#if wxUSE_SPINBTN + +class WXDLLEXPORT wxSpinButton; +class WXDLLEXPORT wxTextCtrl; + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSpinCtrl : public wxControl +{ +public: + wxSpinCtrl() { Init(); } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + Init(); + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")); + + virtual ~wxSpinCtrl(); + + // operations + void SetValue(int val); + void SetValue(const wxString& text); + void SetRange(int min, int max); + void SetSelection(long from, long to); + + // accessors + int GetValue() const; + int GetMin() const; + int GetMax() const; + + // implementation from now on + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + virtual bool Reparent(wxWindow *newParent); + + // get the subcontrols + wxTextCtrl *GetText() const { return m_text; } + wxSpinButton *GetSpinButton() const { return m_btn; } + + // set the value of the text (only) + void SetTextValue(int val); + + // put the numeric value of the string in the text ctrl into val and return + // true or return false if the text ctrl doesn't contain a number or if the + // number is out of range + bool GetTextValue(int *val) const; + +protected: + // override the base class virtuals involved into geometry calculations + virtual wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); + + // common part of all ctors + void Init(); + +private: + // the subcontrols + wxTextCtrl *m_text; + wxSpinButton *m_btn; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) +}; + +#else // !wxUSE_SPINBTN + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is just a text control +// ---------------------------------------------------------------------------- + +#include "wx/textctrl.h" + +class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl +{ +public: + wxSpinCtrl() { Init(); } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + SetRange(min, max); + + bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, + wxDefaultValidator, name); + SetValue(initial); + + return ok; + } + + // accessors + int GetValue(int WXUNUSED(dummy) = 1) const + { + int n; + if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) ) + n = INT_MIN; + + return n; + } + + int GetMin() const { return m_min; } + int GetMax() const { return m_max; } + + // operations + void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); } + void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); } + void SetRange(int min, int max) { m_min = min; m_max = max; } + +protected: + // initialize m_min/max with the default values + void Init() { SetRange(0, 100); } + + int m_min; + int m_max; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) +}; + +#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN + +#endif // _WX_GENERIC_SPINCTRL_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/splash.h b/Externals/wxWidgets/include/wx/generic/splash.h index cd0062d6c4..ff49d630d5 100644 --- a/Externals/wxWidgets/include/wx/generic/splash.h +++ b/Externals/wxWidgets/include/wx/generic/splash.h @@ -1,92 +1,92 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: splash.h -// Purpose: Splash screen class -// Author: Julian Smart -// Modified by: -// Created: 28/6/2000 -// RCS-ID: $Id: splash.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPLASH_H_ -#define _WX_SPLASH_H_ - -#include "wx/bitmap.h" -#include "wx/timer.h" -#include "wx/frame.h" - - -/* - * A window for displaying a splash screen - */ - -#define wxSPLASH_CENTRE_ON_PARENT 0x01 -#define wxSPLASH_CENTRE_ON_SCREEN 0x02 -#define wxSPLASH_NO_CENTRE 0x00 -#define wxSPLASH_TIMEOUT 0x04 -#define wxSPLASH_NO_TIMEOUT 0x00 - -class WXDLLIMPEXP_FWD_ADV wxSplashScreenWindow; - -/* - * wxSplashScreen - */ - -class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame -{ -public: - // for RTTI macros only - wxSplashScreen() {} - wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, - wxWindow* parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); - virtual ~wxSplashScreen(); - - void OnCloseWindow(wxCloseEvent& event); - void OnNotify(wxTimerEvent& event); - - long GetSplashStyle() const { return m_splashStyle; } - wxSplashScreenWindow* GetSplashWindow() const { return m_window; } - int GetTimeout() const { return m_milliseconds; } - -protected: - wxSplashScreenWindow* m_window; - long m_splashStyle; - int m_milliseconds; - wxTimer m_timer; - - DECLARE_DYNAMIC_CLASS(wxSplashScreen) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSplashScreen) -}; - -/* - * wxSplashScreenWindow - */ - -class WXDLLIMPEXP_ADV wxSplashScreenWindow: public wxWindow -{ -public: - wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER); - - void OnPaint(wxPaintEvent& event); - void OnEraseBackground(wxEraseEvent& event); - void OnMouseEvent(wxMouseEvent& event); - void OnChar(wxKeyEvent& event); - - void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } - wxBitmap& GetBitmap() { return m_bitmap; } - -protected: - wxBitmap m_bitmap; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSplashScreenWindow) -}; - - -#endif - // _WX_SPLASH_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: splash.h +// Purpose: Splash screen class +// Author: Julian Smart +// Modified by: +// Created: 28/6/2000 +// RCS-ID: $Id: splash.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPLASH_H_ +#define _WX_SPLASH_H_ + +#include "wx/bitmap.h" +#include "wx/timer.h" +#include "wx/frame.h" + + +/* + * A window for displaying a splash screen + */ + +#define wxSPLASH_CENTRE_ON_PARENT 0x01 +#define wxSPLASH_CENTRE_ON_SCREEN 0x02 +#define wxSPLASH_NO_CENTRE 0x00 +#define wxSPLASH_TIMEOUT 0x04 +#define wxSPLASH_NO_TIMEOUT 0x00 + +class WXDLLIMPEXP_FWD_ADV wxSplashScreenWindow; + +/* + * wxSplashScreen + */ + +class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame +{ +public: + // for RTTI macros only + wxSplashScreen() {} + wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, + wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); + virtual ~wxSplashScreen(); + + void OnCloseWindow(wxCloseEvent& event); + void OnNotify(wxTimerEvent& event); + + long GetSplashStyle() const { return m_splashStyle; } + wxSplashScreenWindow* GetSplashWindow() const { return m_window; } + int GetTimeout() const { return m_milliseconds; } + +protected: + wxSplashScreenWindow* m_window; + long m_splashStyle; + int m_milliseconds; + wxTimer m_timer; + + DECLARE_DYNAMIC_CLASS(wxSplashScreen) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSplashScreen) +}; + +/* + * wxSplashScreenWindow + */ + +class WXDLLIMPEXP_ADV wxSplashScreenWindow: public wxWindow +{ +public: + wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER); + + void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); + void OnMouseEvent(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); + + void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + wxBitmap& GetBitmap() { return m_bitmap; } + +protected: + wxBitmap m_bitmap; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSplashScreenWindow) +}; + + +#endif + // _WX_SPLASH_H_ diff --git a/Externals/wxWidgets/include/wx/generic/splitter.h b/Externals/wxWidgets/include/wx/generic/splitter.h index 3ea6b1147d..ac651f2699 100644 --- a/Externals/wxWidgets/include/wx/generic/splitter.h +++ b/Externals/wxWidgets/include/wx/generic/splitter.h @@ -1,406 +1,406 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/splitter.h -// Purpose: wxSplitterWindow class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: splitter.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SPLITTER_H_ -#define _WX_GENERIC_SPLITTER_H_ - -#include "wx/window.h" // base class declaration -#include "wx/containr.h" // wxControlContainer - -class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; - -// --------------------------------------------------------------------------- -// splitter constants -// --------------------------------------------------------------------------- - -enum wxSplitMode -{ - wxSPLIT_HORIZONTAL = 1, - wxSPLIT_VERTICAL -}; - -enum -{ - wxSPLIT_DRAG_NONE, - wxSPLIT_DRAG_DRAGGING, - wxSPLIT_DRAG_LEFT_DOWN -}; - -// --------------------------------------------------------------------------- -// wxSplitterWindow maintains one or two panes, with -// an optional vertical or horizontal split which -// can be used with the mouse or programmatically. -// --------------------------------------------------------------------------- - -// TODO: -// 1) Perhaps make the borders sensitive to dragging in order to create a split. -// The MFC splitter window manages scrollbars as well so is able to -// put sash buttons on the scrollbars, but we probably don't want to go down -// this path. -// 2) for wxWidgets 2.0, we must find a way to set the WS_CLIPCHILDREN style -// to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be -// standard). - -class WXDLLEXPORT wxSplitterWindow: public wxWindow -{ -public: - -//////////////////////////////////////////////////////////////////////////// -// Public API - - // Default constructor - wxSplitterWindow() - { - Init(); - } - - // Normal constructor - wxSplitterWindow(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_3D, - const wxString& name = wxT("splitter")) - { - Init(); - Create(parent, id, pos, size, style, name); - } - - virtual ~wxSplitterWindow(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_3D, - const wxString& name = wxT("splitter")); - - // Gets the only or left/top pane - wxWindow *GetWindow1() const { return m_windowOne; } - - // Gets the right/bottom pane - wxWindow *GetWindow2() const { return m_windowTwo; } - - // Sets the split mode - void SetSplitMode(int mode) - { - wxASSERT_MSG( mode == wxSPLIT_VERTICAL || mode == wxSPLIT_HORIZONTAL, - _T("invalid split mode") ); - - m_splitMode = (wxSplitMode)mode; - } - - // Gets the split mode - wxSplitMode GetSplitMode() const { return m_splitMode; } - - // Initialize with one window - void Initialize(wxWindow *window); - - // Associates the given window with window 2, drawing the appropriate sash - // and changing the split mode. - // Does nothing and returns false if the window is already split. - // A sashPosition of 0 means choose a default sash position, - // negative sashPosition specifies the size of right/lower pane as it's - // absolute value rather than the size of left/upper pane. - virtual bool SplitVertically(wxWindow *window1, - wxWindow *window2, - int sashPosition = 0) - { return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition); } - virtual bool SplitHorizontally(wxWindow *window1, - wxWindow *window2, - int sashPosition = 0) - { return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition); } - - // Removes the specified (or second) window from the view - // Doesn't actually delete the window. - bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL); - - // Replaces one of the windows with another one (neither old nor new - // parameter should be NULL) - bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); - - // Make sure the child window sizes are updated. This is useful - // for reducing flicker by updating the sizes before a - // window is shown, if you know the overall size is correct. - void UpdateSize(); - - // Is the window split? - bool IsSplit() const { return (m_windowTwo != NULL); } - - // Sets the sash size - void SetSashSize(int width) { m_sashSize = width; } - - // Sets the border size - void SetBorderSize(int WXUNUSED(width)) { } - - // Gets the sash size - int GetSashSize() const; - - // Gets the border size - int GetBorderSize() const; - - // Set the sash position - void SetSashPosition(int position, bool redraw = true); - - // Gets the sash position - int GetSashPosition() const { return m_sashPosition; } - - // Set the sash gravity - void SetSashGravity(double gravity); - - // Gets the sash gravity - double GetSashGravity() const { return m_sashGravity; } - - // If this is zero, we can remove panes by dragging the sash. - void SetMinimumPaneSize(int min); - int GetMinimumPaneSize() const { return m_minimumPaneSize; } - - // NB: the OnXXX() functions below are for backwards compatibility only, - // don't use them in new code but handle the events instead! - - // called when the sash position is about to change, may return a new value - // for the sash or -1 to prevent the change from happening at all - virtual int OnSashPositionChanging(int newSashPosition); - - // Called when the sash position is about to be changed, return - // false from here to prevent the change from taking place. - // Repositions sash to minimum position if pane would be too small. - // newSashPosition here is always positive or zero. - virtual bool OnSashPositionChange(int newSashPosition); - - // If the sash is moved to an extreme position, a subwindow - // is removed from the splitter window, and the app is - // notified. The app should delete or hide the window. - virtual void OnUnsplit(wxWindow *removed); - - // Called when the sash is double-clicked. - // The default behaviour is to remove the sash if the - // minimum pane size is zero. - virtual void OnDoubleClickSash(int x, int y); - -//////////////////////////////////////////////////////////////////////////// -// Implementation - - // Paints the border and sash - void OnPaint(wxPaintEvent& event); - - // Handles mouse events - void OnMouseEvent(wxMouseEvent& ev); - - // Adjusts the panes - void OnSize(wxSizeEvent& event); - - // In live mode, resize child windows in idle time - void OnInternalIdle(); - - // Draws the sash - virtual void DrawSash(wxDC& dc); - - // Draws the sash tracker (for whilst moving the sash) - virtual void DrawSashTracker(int x, int y); - - // Tests for x, y over sash - virtual bool SashHitTest(int x, int y, int tolerance = 5); - - // Resizes subwindows - virtual void SizeWindows(); - - void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } - bool GetNeedUpdating() const { return m_needUpdating ; } - -#ifdef __WXMAC__ - virtual bool MacClipGrandChildren() const { return true ; } -#endif - -protected: - // event handlers -#if defined(__WXMSW__) || defined(__WXMAC__) - void OnSetCursor(wxSetCursorEvent& event); -#endif // wxMSW - - // send the given event, return false if the event was processed and vetoed - // by the user code - bool DoSendEvent(wxSplitterEvent& event); - - // common part of all ctors - void Init(); - - // common part of SplitVertically() and SplitHorizontally() - bool DoSplit(wxSplitMode mode, - wxWindow *window1, wxWindow *window2, - int sashPosition); - - // adjusts sash position with respect to min. pane and window sizes - int AdjustSashPosition(int sashPos) const; - - // get either width or height depending on the split mode - int GetWindowSize() const; - - // convert the user specified sash position which may be > 0 (as is), < 0 - // (specifying the size of the right pane) or 0 (use default) to the real - // position to be passed to DoSetSashPosition() - int ConvertSashPosition(int sashPos) const; - - // set the real sash position, sashPos here must be positive - // - // returns true if the sash position has been changed, false otherwise - bool DoSetSashPosition(int sashPos); - - // set the sash position and send an event about it having been changed - void SetSashPositionAndNotify(int sashPos); - - // callbacks executed when we detect that the mouse has entered or left - // the sash - virtual void OnEnterSash(); - virtual void OnLeaveSash(); - - // set the cursor appropriate for the current split mode - void SetResizeCursor(); - - // redraw the splitter if its "hotness" changed if necessary - void RedrawIfHotSensitive(bool isHot); - - // return the best size of the splitter equal to best sizes of its - // subwindows - virtual wxSize DoGetBestSize() const; - - - wxSplitMode m_splitMode; - wxWindow* m_windowOne; - wxWindow* m_windowTwo; - int m_dragMode; - int m_oldX; - int m_oldY; - int m_sashPosition; // Number of pixels from left or top - double m_sashGravity; - int m_sashSize; - wxSize m_lastSize; - int m_requestedSashPosition; - int m_sashPositionCurrent; // while dragging - int m_firstX; - int m_firstY; - int m_minimumPaneSize; - wxCursor m_sashCursorWE; - wxCursor m_sashCursorNS; - wxPen *m_sashTrackerPen; - - // when in live mode, set this to true to resize children in idle - bool m_needUpdating:1; - bool m_permitUnsplitAlways:1; - bool m_isHot:1; - bool m_checkRequestedSashPosition:1; - -private: - WX_DECLARE_CONTROL_CONTAINER(); - - DECLARE_DYNAMIC_CLASS(wxSplitterWindow) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSplitterWindow) -}; - -// ---------------------------------------------------------------------------- -// event class and macros -// ---------------------------------------------------------------------------- - -// we reuse the same class for all splitter event types because this is the -// usual wxWin convention, but the three event types have different kind of -// data associated with them, so the accessors can be only used if the real -// event type matches with the one for which the accessors make sense -class WXDLLEXPORT wxSplitterEvent : public wxNotifyEvent -{ -public: - wxSplitterEvent(wxEventType type = wxEVT_NULL, - wxSplitterWindow *splitter = (wxSplitterWindow *)NULL) - : wxNotifyEvent(type) - { - SetEventObject(splitter); - if (splitter) m_id = splitter->GetId(); - } - - // SASH_POS_CHANGED methods - - // setting the sash position to -1 prevents the change from taking place at - // all - void SetSashPosition(int pos) - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED - || GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING); - - m_data.pos = pos; - } - - int GetSashPosition() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED - || GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING); - - return m_data.pos; - } - - // UNSPLIT event methods - wxWindow *GetWindowBeingRemoved() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_UNSPLIT ); - - return m_data.win; - } - - // DCLICK event methods - int GetX() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED ); - - return m_data.pt.x; - } - - int GetY() const - { - wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED ); - - return m_data.pt.y; - } - -private: - friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow; - - // data for the different types of event - union - { - int pos; // position for SASH_POS_CHANGED event - wxWindow *win; // window being removed for UNSPLIT event - struct - { - int x, y; - } pt; // position of double click for DCLICK event - } m_data; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSplitterEvent) -}; - -typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&); - -#define wxSplitterEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSplitterEventFunction, &func) - -#define wx__DECLARE_SPLITTEREVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SPLITTER_ ## evt, id, wxSplitterEventHandler(fn)) - -#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \ - wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGED, id, fn) - -#define EVT_SPLITTER_SASH_POS_CHANGING(id, fn) \ - wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGING, id, fn) - -#define EVT_SPLITTER_DCLICK(id, fn) \ - wx__DECLARE_SPLITTEREVT(DOUBLECLICKED, id, fn) - -#define EVT_SPLITTER_UNSPLIT(id, fn) \ - wx__DECLARE_SPLITTEREVT(UNSPLIT, id, fn) - -#endif // _WX_GENERIC_SPLITTER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/splitter.h +// Purpose: wxSplitterWindow class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: splitter.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SPLITTER_H_ +#define _WX_GENERIC_SPLITTER_H_ + +#include "wx/window.h" // base class declaration +#include "wx/containr.h" // wxControlContainer + +class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; + +// --------------------------------------------------------------------------- +// splitter constants +// --------------------------------------------------------------------------- + +enum wxSplitMode +{ + wxSPLIT_HORIZONTAL = 1, + wxSPLIT_VERTICAL +}; + +enum +{ + wxSPLIT_DRAG_NONE, + wxSPLIT_DRAG_DRAGGING, + wxSPLIT_DRAG_LEFT_DOWN +}; + +// --------------------------------------------------------------------------- +// wxSplitterWindow maintains one or two panes, with +// an optional vertical or horizontal split which +// can be used with the mouse or programmatically. +// --------------------------------------------------------------------------- + +// TODO: +// 1) Perhaps make the borders sensitive to dragging in order to create a split. +// The MFC splitter window manages scrollbars as well so is able to +// put sash buttons on the scrollbars, but we probably don't want to go down +// this path. +// 2) for wxWidgets 2.0, we must find a way to set the WS_CLIPCHILDREN style +// to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be +// standard). + +class WXDLLEXPORT wxSplitterWindow: public wxWindow +{ +public: + +//////////////////////////////////////////////////////////////////////////// +// Public API + + // Default constructor + wxSplitterWindow() + { + Init(); + } + + // Normal constructor + wxSplitterWindow(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_3D, + const wxString& name = wxT("splitter")) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSplitterWindow(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_3D, + const wxString& name = wxT("splitter")); + + // Gets the only or left/top pane + wxWindow *GetWindow1() const { return m_windowOne; } + + // Gets the right/bottom pane + wxWindow *GetWindow2() const { return m_windowTwo; } + + // Sets the split mode + void SetSplitMode(int mode) + { + wxASSERT_MSG( mode == wxSPLIT_VERTICAL || mode == wxSPLIT_HORIZONTAL, + _T("invalid split mode") ); + + m_splitMode = (wxSplitMode)mode; + } + + // Gets the split mode + wxSplitMode GetSplitMode() const { return m_splitMode; } + + // Initialize with one window + void Initialize(wxWindow *window); + + // Associates the given window with window 2, drawing the appropriate sash + // and changing the split mode. + // Does nothing and returns false if the window is already split. + // A sashPosition of 0 means choose a default sash position, + // negative sashPosition specifies the size of right/lower pane as it's + // absolute value rather than the size of left/upper pane. + virtual bool SplitVertically(wxWindow *window1, + wxWindow *window2, + int sashPosition = 0) + { return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition); } + virtual bool SplitHorizontally(wxWindow *window1, + wxWindow *window2, + int sashPosition = 0) + { return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition); } + + // Removes the specified (or second) window from the view + // Doesn't actually delete the window. + bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL); + + // Replaces one of the windows with another one (neither old nor new + // parameter should be NULL) + bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); + + // Make sure the child window sizes are updated. This is useful + // for reducing flicker by updating the sizes before a + // window is shown, if you know the overall size is correct. + void UpdateSize(); + + // Is the window split? + bool IsSplit() const { return (m_windowTwo != NULL); } + + // Sets the sash size + void SetSashSize(int width) { m_sashSize = width; } + + // Sets the border size + void SetBorderSize(int WXUNUSED(width)) { } + + // Gets the sash size + int GetSashSize() const; + + // Gets the border size + int GetBorderSize() const; + + // Set the sash position + void SetSashPosition(int position, bool redraw = true); + + // Gets the sash position + int GetSashPosition() const { return m_sashPosition; } + + // Set the sash gravity + void SetSashGravity(double gravity); + + // Gets the sash gravity + double GetSashGravity() const { return m_sashGravity; } + + // If this is zero, we can remove panes by dragging the sash. + void SetMinimumPaneSize(int min); + int GetMinimumPaneSize() const { return m_minimumPaneSize; } + + // NB: the OnXXX() functions below are for backwards compatibility only, + // don't use them in new code but handle the events instead! + + // called when the sash position is about to change, may return a new value + // for the sash or -1 to prevent the change from happening at all + virtual int OnSashPositionChanging(int newSashPosition); + + // Called when the sash position is about to be changed, return + // false from here to prevent the change from taking place. + // Repositions sash to minimum position if pane would be too small. + // newSashPosition here is always positive or zero. + virtual bool OnSashPositionChange(int newSashPosition); + + // If the sash is moved to an extreme position, a subwindow + // is removed from the splitter window, and the app is + // notified. The app should delete or hide the window. + virtual void OnUnsplit(wxWindow *removed); + + // Called when the sash is double-clicked. + // The default behaviour is to remove the sash if the + // minimum pane size is zero. + virtual void OnDoubleClickSash(int x, int y); + +//////////////////////////////////////////////////////////////////////////// +// Implementation + + // Paints the border and sash + void OnPaint(wxPaintEvent& event); + + // Handles mouse events + void OnMouseEvent(wxMouseEvent& ev); + + // Adjusts the panes + void OnSize(wxSizeEvent& event); + + // In live mode, resize child windows in idle time + void OnInternalIdle(); + + // Draws the sash + virtual void DrawSash(wxDC& dc); + + // Draws the sash tracker (for whilst moving the sash) + virtual void DrawSashTracker(int x, int y); + + // Tests for x, y over sash + virtual bool SashHitTest(int x, int y, int tolerance = 5); + + // Resizes subwindows + virtual void SizeWindows(); + + void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } + bool GetNeedUpdating() const { return m_needUpdating ; } + +#ifdef __WXMAC__ + virtual bool MacClipGrandChildren() const { return true ; } +#endif + +protected: + // event handlers +#if defined(__WXMSW__) || defined(__WXMAC__) + void OnSetCursor(wxSetCursorEvent& event); +#endif // wxMSW + + // send the given event, return false if the event was processed and vetoed + // by the user code + bool DoSendEvent(wxSplitterEvent& event); + + // common part of all ctors + void Init(); + + // common part of SplitVertically() and SplitHorizontally() + bool DoSplit(wxSplitMode mode, + wxWindow *window1, wxWindow *window2, + int sashPosition); + + // adjusts sash position with respect to min. pane and window sizes + int AdjustSashPosition(int sashPos) const; + + // get either width or height depending on the split mode + int GetWindowSize() const; + + // convert the user specified sash position which may be > 0 (as is), < 0 + // (specifying the size of the right pane) or 0 (use default) to the real + // position to be passed to DoSetSashPosition() + int ConvertSashPosition(int sashPos) const; + + // set the real sash position, sashPos here must be positive + // + // returns true if the sash position has been changed, false otherwise + bool DoSetSashPosition(int sashPos); + + // set the sash position and send an event about it having been changed + void SetSashPositionAndNotify(int sashPos); + + // callbacks executed when we detect that the mouse has entered or left + // the sash + virtual void OnEnterSash(); + virtual void OnLeaveSash(); + + // set the cursor appropriate for the current split mode + void SetResizeCursor(); + + // redraw the splitter if its "hotness" changed if necessary + void RedrawIfHotSensitive(bool isHot); + + // return the best size of the splitter equal to best sizes of its + // subwindows + virtual wxSize DoGetBestSize() const; + + + wxSplitMode m_splitMode; + wxWindow* m_windowOne; + wxWindow* m_windowTwo; + int m_dragMode; + int m_oldX; + int m_oldY; + int m_sashPosition; // Number of pixels from left or top + double m_sashGravity; + int m_sashSize; + wxSize m_lastSize; + int m_requestedSashPosition; + int m_sashPositionCurrent; // while dragging + int m_firstX; + int m_firstY; + int m_minimumPaneSize; + wxCursor m_sashCursorWE; + wxCursor m_sashCursorNS; + wxPen *m_sashTrackerPen; + + // when in live mode, set this to true to resize children in idle + bool m_needUpdating:1; + bool m_permitUnsplitAlways:1; + bool m_isHot:1; + bool m_checkRequestedSashPosition:1; + +private: + WX_DECLARE_CONTROL_CONTAINER(); + + DECLARE_DYNAMIC_CLASS(wxSplitterWindow) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSplitterWindow) +}; + +// ---------------------------------------------------------------------------- +// event class and macros +// ---------------------------------------------------------------------------- + +// we reuse the same class for all splitter event types because this is the +// usual wxWin convention, but the three event types have different kind of +// data associated with them, so the accessors can be only used if the real +// event type matches with the one for which the accessors make sense +class WXDLLEXPORT wxSplitterEvent : public wxNotifyEvent +{ +public: + wxSplitterEvent(wxEventType type = wxEVT_NULL, + wxSplitterWindow *splitter = (wxSplitterWindow *)NULL) + : wxNotifyEvent(type) + { + SetEventObject(splitter); + if (splitter) m_id = splitter->GetId(); + } + + // SASH_POS_CHANGED methods + + // setting the sash position to -1 prevents the change from taking place at + // all + void SetSashPosition(int pos) + { + wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED + || GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING); + + m_data.pos = pos; + } + + int GetSashPosition() const + { + wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED + || GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING); + + return m_data.pos; + } + + // UNSPLIT event methods + wxWindow *GetWindowBeingRemoved() const + { + wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_UNSPLIT ); + + return m_data.win; + } + + // DCLICK event methods + int GetX() const + { + wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED ); + + return m_data.pt.x; + } + + int GetY() const + { + wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED ); + + return m_data.pt.y; + } + +private: + friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow; + + // data for the different types of event + union + { + int pos; // position for SASH_POS_CHANGED event + wxWindow *win; // window being removed for UNSPLIT event + struct + { + int x, y; + } pt; // position of double click for DCLICK event + } m_data; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSplitterEvent) +}; + +typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&); + +#define wxSplitterEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSplitterEventFunction, &func) + +#define wx__DECLARE_SPLITTEREVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_SPLITTER_ ## evt, id, wxSplitterEventHandler(fn)) + +#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \ + wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGED, id, fn) + +#define EVT_SPLITTER_SASH_POS_CHANGING(id, fn) \ + wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGING, id, fn) + +#define EVT_SPLITTER_DCLICK(id, fn) \ + wx__DECLARE_SPLITTEREVT(DOUBLECLICKED, id, fn) + +#define EVT_SPLITTER_UNSPLIT(id, fn) \ + wx__DECLARE_SPLITTEREVT(UNSPLIT, id, fn) + +#endif // _WX_GENERIC_SPLITTER_H_ diff --git a/Externals/wxWidgets/include/wx/generic/srchctlg.h b/Externals/wxWidgets/include/wx/generic/srchctlg.h index 8f7a42e52e..d28856c568 100644 --- a/Externals/wxWidgets/include/wx/generic/srchctlg.h +++ b/Externals/wxWidgets/include/wx/generic/srchctlg.h @@ -1,275 +1,275 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/srchctlg.h -// Purpose: generic wxSearchCtrl class -// Author: Vince Harron -// Created: 2006-02-19 -// RCS-ID: $Id: srchctlg.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: Vince Harron -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_SEARCHCTRL_H_ -#define _WX_GENERIC_SEARCHCTRL_H_ - -#if wxUSE_SEARCHCTRL - -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxSearchButton; -class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl; - -// ---------------------------------------------------------------------------- -// wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase -{ -public: - // creation - // -------- - - wxSearchCtrl(); - wxSearchCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSearchCtrlNameStr); - - virtual ~wxSearchCtrl(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSearchCtrlNameStr); - -#if wxUSE_MENUS - // get/set search button menu - // -------------------------- - virtual void SetMenu( wxMenu* menu ); - virtual wxMenu* GetMenu(); -#endif // wxUSE_MENUS - - // get/set search options - // ---------------------- - virtual void ShowSearchButton( bool show ); - virtual bool IsSearchButtonVisible() const; - - virtual void ShowCancelButton( bool show ); - virtual bool IsCancelButtonVisible() const; - -#if wxABI_VERSION >= 20802 - // TODO: In 2.9 these should probably be virtual, and declared in the base class... - void SetDescriptiveText(const wxString& text); - wxString GetDescriptiveText() const; -#endif - - // accessors - // --------- - - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - // more readable flag testing methods - virtual bool IsSingleLine() const; - virtual bool IsMultiLine() const; - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const; - - virtual wxString GetStringSelection() const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load/save the controls contents from/to the file - virtual bool LoadFile(const wxString& file); - virtual bool SaveFile(const wxString& file = wxEmptyString); - - // sets/clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - // set the max number of characters which may be entered in a single line - // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // insert the character which would have resulted from this key event, - // return true if anything has been inserted - virtual bool EmulateKeyPress(const wxKeyEvent& event); - - // text control under some platforms supports the text styles: these - // methods allow to apply the given text style to the given selection or to - // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual const wxTextAttr& GetDefaultStyle() const; - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - - // find the character at position given in pixels - // - // NB: pt is in device coords (not adjusted for the client area origin nor - // scrolling) - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const; - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SelectAll(); - virtual void SetEditable(bool editable); - -#if 0 - - // override streambuf method -#if wxHAS_TEXT_WINDOW_STREAM - int overflow(int i); -#endif // wxHAS_TEXT_WINDOW_STREAM - - // stream-like insertion operators: these are always available, whether we - // were, or not, compiled with streambuf support - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const wxChar c); -#endif - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - - virtual bool ShouldInheritColours() const; - - // wxWindow overrides - virtual bool SetFont(const wxFont& font); - - // search control generic only - void SetSearchBitmap( const wxBitmap& bitmap ); - void SetCancelBitmap( const wxBitmap& bitmap ); -#if wxUSE_MENUS - void SetSearchMenuBitmap( const wxBitmap& bitmap ); -#endif // wxUSE_MENUS - -protected: - virtual void DoSetValue(const wxString& value, int flags = 0); - - // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void LayoutControls(int x, int y, int width, int height); - - virtual void RecalcBitmaps(); - - void Init(); - - virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop ); - virtual wxBitmap RenderCancelBitmap( int x, int y ); - - virtual void OnSearchButton( wxCommandEvent& event ); - - void OnSetFocus( wxFocusEvent& event ); - void OnSize( wxSizeEvent& event ); - - bool HasMenu() const - { -#if wxUSE_MENUS - return m_menu != NULL; -#else // !wxUSE_MENUS - return false; -#endif // wxUSE_MENUS/!wxUSE_MENUS - } - -private: - friend class wxSearchButton; - -#if wxUSE_MENUS - void PopupSearchMenu(); -#endif // wxUSE_MENUS - - // the subcontrols - wxSearchTextCtrl *m_text; - wxSearchButton *m_searchButton; - wxSearchButton *m_cancelButton; -#if wxUSE_MENUS - wxMenu *m_menu; -#endif // wxUSE_MENUS - - bool m_searchButtonVisible; - bool m_cancelButtonVisible; - - bool m_searchBitmapUser; - bool m_cancelBitmapUser; -#if wxUSE_MENUS - bool m_searchMenuBitmapUser; -#endif // wxUSE_MENUS - - wxBitmap m_searchBitmap; - wxBitmap m_cancelBitmap; -#if wxUSE_MENUS - wxBitmap m_searchMenuBitmap; -#endif // wxUSE_MENUS - -private: - DECLARE_DYNAMIC_CLASS(wxSearchCtrl) - - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_SEARCHCTRL - -#endif // _WX_GENERIC_SEARCHCTRL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/srchctlg.h +// Purpose: generic wxSearchCtrl class +// Author: Vince Harron +// Created: 2006-02-19 +// RCS-ID: $Id: srchctlg.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: Vince Harron +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SEARCHCTRL_H_ +#define _WX_GENERIC_SEARCHCTRL_H_ + +#if wxUSE_SEARCHCTRL + +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxSearchButton; +class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl; + +// ---------------------------------------------------------------------------- +// wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase +{ +public: + // creation + // -------- + + wxSearchCtrl(); + wxSearchCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSearchCtrlNameStr); + + virtual ~wxSearchCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSearchCtrlNameStr); + +#if wxUSE_MENUS + // get/set search button menu + // -------------------------- + virtual void SetMenu( wxMenu* menu ); + virtual wxMenu* GetMenu(); +#endif // wxUSE_MENUS + + // get/set search options + // ---------------------- + virtual void ShowSearchButton( bool show ); + virtual bool IsSearchButtonVisible() const; + + virtual void ShowCancelButton( bool show ); + virtual bool IsCancelButtonVisible() const; + +#if wxABI_VERSION >= 20802 + // TODO: In 2.9 these should probably be virtual, and declared in the base class... + void SetDescriptiveText(const wxString& text); + wxString GetDescriptiveText() const; +#endif + + // accessors + // --------- + + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + + virtual wxString GetRange(long from, long to) const; + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // more readable flag testing methods + virtual bool IsSingleLine() const; + virtual bool IsMultiLine() const; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + + virtual wxString GetStringSelection() const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load/save the controls contents from/to the file + virtual bool LoadFile(const wxString& file); + virtual bool SaveFile(const wxString& file = wxEmptyString); + + // sets/clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long WXUNUSED(len)); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // insert the character which would have resulted from this key event, + // return true if anything has been inserted + virtual bool EmulateKeyPress(const wxKeyEvent& event); + + // text control under some platforms supports the text styles: these + // methods allow to apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool GetStyle(long position, wxTextAttr& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual const wxTextAttr& GetDefaultStyle() const; + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + + // find the character at position given in pixels + // + // NB: pt is in device coords (not adjusted for the client area origin nor + // scrolling) + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const; + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SelectAll(); + virtual void SetEditable(bool editable); + +#if 0 + + // override streambuf method +#if wxHAS_TEXT_WINDOW_STREAM + int overflow(int i); +#endif // wxHAS_TEXT_WINDOW_STREAM + + // stream-like insertion operators: these are always available, whether we + // were, or not, compiled with streambuf support + wxTextCtrl& operator<<(const wxString& s); + wxTextCtrl& operator<<(int i); + wxTextCtrl& operator<<(long i); + wxTextCtrl& operator<<(float f); + wxTextCtrl& operator<<(double d); + wxTextCtrl& operator<<(const wxChar c); +#endif + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + + virtual bool ShouldInheritColours() const; + + // wxWindow overrides + virtual bool SetFont(const wxFont& font); + + // search control generic only + void SetSearchBitmap( const wxBitmap& bitmap ); + void SetCancelBitmap( const wxBitmap& bitmap ); +#if wxUSE_MENUS + void SetSearchMenuBitmap( const wxBitmap& bitmap ); +#endif // wxUSE_MENUS + +protected: + virtual void DoSetValue(const wxString& value, int flags = 0); + + // override the base class virtuals involved into geometry calculations + virtual wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void LayoutControls(int x, int y, int width, int height); + + virtual void RecalcBitmaps(); + + void Init(); + + virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop ); + virtual wxBitmap RenderCancelBitmap( int x, int y ); + + virtual void OnSearchButton( wxCommandEvent& event ); + + void OnSetFocus( wxFocusEvent& event ); + void OnSize( wxSizeEvent& event ); + + bool HasMenu() const + { +#if wxUSE_MENUS + return m_menu != NULL; +#else // !wxUSE_MENUS + return false; +#endif // wxUSE_MENUS/!wxUSE_MENUS + } + +private: + friend class wxSearchButton; + +#if wxUSE_MENUS + void PopupSearchMenu(); +#endif // wxUSE_MENUS + + // the subcontrols + wxSearchTextCtrl *m_text; + wxSearchButton *m_searchButton; + wxSearchButton *m_cancelButton; +#if wxUSE_MENUS + wxMenu *m_menu; +#endif // wxUSE_MENUS + + bool m_searchButtonVisible; + bool m_cancelButtonVisible; + + bool m_searchBitmapUser; + bool m_cancelBitmapUser; +#if wxUSE_MENUS + bool m_searchMenuBitmapUser; +#endif // wxUSE_MENUS + + wxBitmap m_searchBitmap; + wxBitmap m_cancelBitmap; +#if wxUSE_MENUS + wxBitmap m_searchMenuBitmap; +#endif // wxUSE_MENUS + +private: + DECLARE_DYNAMIC_CLASS(wxSearchCtrl) + + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_GENERIC_SEARCHCTRL_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/statline.h b/Externals/wxWidgets/include/wx/generic/statline.h index 4ad6f17fd8..114ec35929 100644 --- a/Externals/wxWidgets/include/wx/generic/statline.h +++ b/Externals/wxWidgets/include/wx/generic/statline.h @@ -1,62 +1,62 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: generic/statline.h -// Purpose: a generic wxStaticLine class -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_STATLINE_H_ -#define _WX_GENERIC_STATLINE_H_ - -class wxStaticBox; - -// ---------------------------------------------------------------------------- -// wxStaticLine -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticLine : public wxStaticLineBase -{ - DECLARE_DYNAMIC_CLASS(wxStaticLine) - -public: - // constructors and pseudo-constructors - wxStaticLine() { m_statbox = NULL; } - - wxStaticLine( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ) - { - Create(parent, id, pos, size, style, name); - } - - virtual ~wxStaticLine(); - - bool Create( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ); - - // it's necessary to override this wxWindow function because we - // will want to return the main widget for m_statbox - // - WXWidget GetMainWidget() const; - - // override wxWindow methods to make things work - virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoMoveWindow(int x, int y, int width, int height); -protected: - // we implement the static line using a static box - wxStaticBox *m_statbox; -}; - -#endif // _WX_GENERIC_STATLINE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: generic/statline.h +// Purpose: a generic wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATLINE_H_ +#define _WX_GENERIC_STATLINE_H_ + +class wxStaticBox; + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticLine) + +public: + // constructors and pseudo-constructors + wxStaticLine() { m_statbox = NULL; } + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ) + { + Create(parent, id, pos, size, style, name); + } + + virtual ~wxStaticLine(); + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ); + + // it's necessary to override this wxWindow function because we + // will want to return the main widget for m_statbox + // + WXWidget GetMainWidget() const; + + // override wxWindow methods to make things work + virtual void DoSetSize(int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoMoveWindow(int x, int y, int width, int height); +protected: + // we implement the static line using a static box + wxStaticBox *m_statbox; +}; + +#endif // _WX_GENERIC_STATLINE_H_ + diff --git a/Externals/wxWidgets/include/wx/generic/statusbr.h b/Externals/wxWidgets/include/wx/generic/statusbr.h index 5934a94720..4852acde57 100644 --- a/Externals/wxWidgets/include/wx/generic/statusbr.h +++ b/Externals/wxWidgets/include/wx/generic/statusbr.h @@ -1,107 +1,107 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/statusbr.h -// Purpose: wxStatusBarGeneric class -// Author: Julian Smart -// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase -// Created: 01/02/97 -// RCS-ID: $Id: statusbr.h 41200 2006-09-13 19:10:31Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_STATUSBR_H_ -#define _WX_GENERIC_STATUSBR_H_ - -#include "wx/defs.h" - -#if wxUSE_STATUSBAR - -#include "wx/pen.h" -#include "wx/arrstr.h" - -class WXDLLEXPORT wxStatusBarGeneric : public wxStatusBarBase -{ -public: - wxStatusBarGeneric() { Init(); } - wxStatusBarGeneric(wxWindow *parent, - wxWindowID winid = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr) - { - Init(); - - Create(parent, winid, style, name); - } - - virtual ~wxStatusBarGeneric(); - - bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr); - - // Create status line - virtual void SetFieldsCount(int number = 1, - const int *widths = (const int *) NULL); - - // Set status line text - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; - - // Set status line widths - virtual void SetStatusWidths(int n, const int widths_field[]); - - // Get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const; - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height); - - virtual int GetBorderX() const { return m_borderX; } - virtual int GetBorderY() const { return m_borderY; } - - //////////////////////////////////////////////////////////////////////// - // Implementation - - virtual void DrawFieldText(wxDC& dc, int i); - virtual void DrawField(wxDC& dc, int i); - - void SetBorderX(int x); - void SetBorderY(int y); - - void OnPaint(wxPaintEvent& event); - - void OnLeftDown(wxMouseEvent& event); - void OnRightDown(wxMouseEvent& event); - - virtual void InitColours(); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -protected: - // common part of all ctors - void Init(); - - wxArrayString m_statusStrings; - - // the last known width of the client rect (used to rebuild cache) - int m_lastClientWidth; - // the widths of the status bar panes in pixels - wxArrayInt m_widthsAbs; - - int m_borderX; - int m_borderY; - wxPen m_mediumShadowPen; - wxPen m_hilightPen; - - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric) -}; - -#endif // wxUSE_STATUSBAR - -#endif - // _WX_GENERIC_STATUSBR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/statusbr.h +// Purpose: wxStatusBarGeneric class +// Author: Julian Smart +// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase +// Created: 01/02/97 +// RCS-ID: $Id: statusbr.h 41200 2006-09-13 19:10:31Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATUSBR_H_ +#define _WX_GENERIC_STATUSBR_H_ + +#include "wx/defs.h" + +#if wxUSE_STATUSBAR + +#include "wx/pen.h" +#include "wx/arrstr.h" + +class WXDLLEXPORT wxStatusBarGeneric : public wxStatusBarBase +{ +public: + wxStatusBarGeneric() { Init(); } + wxStatusBarGeneric(wxWindow *parent, + wxWindowID winid = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr) + { + Init(); + + Create(parent, winid, style, name); + } + + virtual ~wxStatusBarGeneric(); + + bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr); + + // Create status line + virtual void SetFieldsCount(int number = 1, + const int *widths = (const int *) NULL); + + // Set status line text + virtual void SetStatusText(const wxString& text, int number = 0); + virtual wxString GetStatusText(int number = 0) const; + + // Set status line widths + virtual void SetStatusWidths(int n, const int widths_field[]); + + // Get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const; + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height); + + virtual int GetBorderX() const { return m_borderX; } + virtual int GetBorderY() const { return m_borderY; } + + //////////////////////////////////////////////////////////////////////// + // Implementation + + virtual void DrawFieldText(wxDC& dc, int i); + virtual void DrawField(wxDC& dc, int i); + + void SetBorderX(int x); + void SetBorderY(int y); + + void OnPaint(wxPaintEvent& event); + + void OnLeftDown(wxMouseEvent& event); + void OnRightDown(wxMouseEvent& event); + + virtual void InitColours(); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + // common part of all ctors + void Init(); + + wxArrayString m_statusStrings; + + // the last known width of the client rect (used to rebuild cache) + int m_lastClientWidth; + // the widths of the status bar panes in pixels + wxArrayInt m_widthsAbs; + + int m_borderX; + int m_borderY; + wxPen m_mediumShadowPen; + wxPen m_hilightPen; + + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric) +}; + +#endif // wxUSE_STATUSBAR + +#endif + // _WX_GENERIC_STATUSBR_H_ diff --git a/Externals/wxWidgets/include/wx/generic/tabg.h b/Externals/wxWidgets/include/wx/generic/tabg.h index c9e2f34dfe..bdac54166a 100644 --- a/Externals/wxWidgets/include/wx/generic/tabg.h +++ b/Externals/wxWidgets/include/wx/generic/tabg.h @@ -1,363 +1,363 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tabg.h -// Purpose: Generic tabbed dialogs -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: tabg.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __TABGH_G__ -#define __TABGH_G__ - -#define WXTAB_VERSION 1.1 - -#include "wx/hashmap.h" -#include "wx/string.h" -#include "wx/dialog.h" -#include "wx/panel.h" -#include "wx/list.h" - -class WXDLLEXPORT wxTabView; - -/* - * A wxTabControl is the internal and visual representation - * of the tab. - */ - -class WXDLLEXPORT wxTabControl: public wxObject -{ -DECLARE_DYNAMIC_CLASS(wxTabControl) -public: - wxTabControl(wxTabView *v = (wxTabView *) NULL); - virtual ~wxTabControl(void); - - virtual void OnDraw(wxDC& dc, bool lastInRow); - void SetLabel(const wxString& str) { m_controlLabel = str; } - wxString GetLabel(void) const { return m_controlLabel; } - - void SetFont(const wxFont& f) { m_labelFont = f; } - wxFont *GetFont(void) const { return (wxFont*) & m_labelFont; } - - void SetSelected(bool sel) { m_isSelected = sel; } - bool IsSelected(void) const { return m_isSelected; } - - void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } - void SetSize(int x, int y) { m_width = x; m_height = y; } - - void SetRowPosition(int r) { m_rowPosition = r; } - int GetRowPosition() const { return m_rowPosition; } - void SetColPosition(int c) { m_colPosition = c; } - int GetColPosition() const { return m_colPosition; } - - int GetX(void) const { return m_offsetX; } - int GetY(void) const { return m_offsetY; } - int GetWidth(void) const { return m_width; } - int GetHeight(void) const { return m_height; } - - int GetId(void) const { return m_id; } - void SetId(int i) { m_id = i; } - - virtual bool HitTest(int x, int y) const ; - -protected: - wxTabView* m_view; - wxString m_controlLabel; - bool m_isSelected; - wxFont m_labelFont; - int m_offsetX; // Offsets from top-left of tab view area (the area below the tabs) - int m_offsetY; - int m_width; - int m_height; - int m_id; - int m_rowPosition; // Position in row from 0 - int m_colPosition; // Position in col from 0 -}; - -/* - * Each wxTabLayer is a list of tabs. E.g. there - * are 3 layers in the MS Word Options dialog. - */ - -class WXDLLEXPORT wxTabLayer: public wxList -{ -}; - -/* - * The wxTabView controls and draws the tabbed object - */ - -WX_DECLARE_LIST(wxTabLayer, wxTabLayerList); - -#define wxTAB_STYLE_DRAW_BOX 1 // Draws 3D boxes round tab layers -#define wxTAB_STYLE_COLOUR_INTERIOR 2 // Colours interior of tabs, otherwise draws outline - -class WXDLLEXPORT wxTabView: public wxObject -{ -DECLARE_DYNAMIC_CLASS(wxTabView) -public: - wxTabView(long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); - virtual ~wxTabView(); - - inline int GetNumberOfLayers() const { return m_layers.GetCount(); } -#if WXWIN_COMPATIBILITY_2_4 - inline wxList& GetLayers() { return *(wxList *)&m_layers; } -#else - inline wxTabLayerList& GetLayers() { return m_layers; } -#endif - - inline void SetWindow(wxWindow* wnd) { m_window = wnd; } - inline wxWindow* GetWindow(void) const { return m_window; } - - // Automatically positions tabs - wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = (wxTabControl *) NULL); - - // Remove the tab without deleting the window - bool RemoveTab(int id); - - void ClearTabs(bool deleteTabs = true); - - bool SetTabText(int id, const wxString& label); - wxString GetTabText(int id) const; - - // Layout tabs (optional, e.g. if resizing window) - void LayoutTabs(); - - // Draw all tabs - virtual void Draw(wxDC& dc); - - // Process mouse event, return false if we didn't process it - virtual bool OnEvent(wxMouseEvent& event); - - // Called when a tab is activated - virtual void OnTabActivate(int activateId, int deactivateId); - // Allows vetoing - virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return true; }; - - // Allows use of application-supplied wxTabControl classes. - virtual wxTabControl *OnCreateTabControl(void) { return new wxTabControl(this); } - - void SetHighlightColour(const wxColour& col); - void SetShadowColour(const wxColour& col); - void SetBackgroundColour(const wxColour& col); - inline void SetTextColour(const wxColour& col) { m_textColour = col; } - - inline wxColour GetHighlightColour(void) const { return m_highlightColour; } - inline wxColour GetShadowColour(void) const { return m_shadowColour; } - inline wxColour GetBackgroundColour(void) const { return m_backgroundColour; } - inline wxColour GetTextColour(void) const { return m_textColour; } - inline const wxPen *GetHighlightPen(void) const { return m_highlightPen; } - inline const wxPen *GetShadowPen(void) const { return m_shadowPen; } - inline const wxPen *GetBackgroundPen(void) const { return m_backgroundPen; } - inline const wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; } - - inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; } - inline wxRect GetViewRect(void) const { return m_tabViewRect; } - - // Calculate tab width to fit to view, and optionally adjust the view - // to fit the tabs exactly. - int CalculateTabWidth(int noTabs, bool adjustView = false); - - inline void SetTabStyle(long style) { m_tabStyle = style; } - inline long GetTabStyle(void) const { return m_tabStyle; } - - inline void SetTabSize(int w, int h) { m_tabWidth = w; m_tabHeight = h; } - inline int GetTabWidth(void) const { return m_tabWidth; } - inline int GetTabHeight(void) const { return m_tabHeight; } - inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; } - inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; } - - // Returns the total height of the tabs component -- this may be several - // times the height of a tab, if there are several tab layers (rows). - int GetTotalTabHeight(); - - inline int GetTopMargin(void) const { return m_topMargin; } - inline void SetTopMargin(int margin) { m_topMargin = margin; } - - void SetTabSelection(int sel, bool activateTool = true); - inline int GetTabSelection() const { return m_tabSelection; } - - // Find tab control for id - wxTabControl *FindTabControlForId(int id) const ; - - // Find tab control for layer, position (starting from zero) - wxTabControl *FindTabControlForPosition(int layer, int position) const ; - - inline int GetHorizontalTabOffset() const { return m_tabHorizontalOffset; } - inline int GetHorizontalTabSpacing() const { return m_tabHorizontalSpacing; } - inline void SetHorizontalTabOffset(int sp) { m_tabHorizontalOffset = sp; } - inline void SetHorizontalTabSpacing(int sp) { m_tabHorizontalSpacing = sp; } - - inline void SetVerticalTabTextSpacing(int s) { m_tabVerticalTextSpacing = s; } - inline int GetVerticalTabTextSpacing() const { return m_tabVerticalTextSpacing; } - - inline wxFont *GetTabFont() const { return (wxFont*) & m_tabFont; } - inline void SetTabFont(const wxFont& f) { m_tabFont = f; } - - inline wxFont *GetSelectedTabFont() const { return (wxFont*) & m_tabSelectedFont; } - inline void SetSelectedTabFont(const wxFont& f) { m_tabSelectedFont = f; } - // Find the node and the column at which this control is positioned. - wxList::compatibility_iterator FindTabNodeAndColumn(wxTabControl *control, int *col) const ; - - // Do the necessary to change to this tab - virtual bool ChangeTab(wxTabControl *control); - - // Move the selected tab to the bottom layer, if necessary, - // without calling app activation code - bool MoveSelectionTab(wxTabControl *control); - - inline int GetNumberOfTabs() const { return m_noTabs; } - -protected: - // List of layers, from front to back. - wxTabLayerList m_layers; - - // Selected tab - int m_tabSelection; - - // Usual tab height - int m_tabHeight; - - // The height of the selected tab - int m_tabSelectionHeight; - - // Usual tab width - int m_tabWidth; - - // Space between tabs - int m_tabHorizontalSpacing; - - // Space between top of normal tab and text - int m_tabVerticalTextSpacing; - - // Horizontal offset of each tab row above the first - int m_tabHorizontalOffset; - - // The distance between the bottom of the first tab row - // and the top of the client area (i.e. the margin) - int m_topMargin; - - // The position and size of the view above which the tabs are placed. - // I.e., the internal client area of the sheet. - wxRect m_tabViewRect; - - // Bitlist of styles - long m_tabStyle; - - // Colours - wxColour m_highlightColour; - wxColour m_shadowColour; - wxColour m_backgroundColour; - wxColour m_textColour; - - // Pen and brush cache - const wxPen* m_highlightPen; - const wxPen* m_shadowPen; - const wxPen* m_backgroundPen; - const wxBrush* m_backgroundBrush; - - wxFont m_tabFont; - wxFont m_tabSelectedFont; - - int m_noTabs; - - wxWindow* m_window; -}; - -/* - * A dialog box class that is tab-friendly - */ - -class WXDLLEXPORT wxTabbedDialog : public wxDialog -{ - DECLARE_DYNAMIC_CLASS(wxTabbedDialog) - -public: - wxTabbedDialog(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long windowStyle = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - virtual ~wxTabbedDialog(); - - wxTabView *GetTabView() const { return m_tabView; } - void SetTabView(wxTabView *v) { m_tabView = v; } - - void OnCloseWindow(wxCloseEvent& event); - void OnMouseEvent(wxMouseEvent& event); - void OnPaint(wxPaintEvent& event); - -protected: - wxTabView* m_tabView; - -private: - DECLARE_EVENT_TABLE() -}; - -/* - * A panel class that is tab-friendly - */ - -class WXDLLEXPORT wxTabbedPanel : public wxPanel -{ - DECLARE_DYNAMIC_CLASS(wxTabbedPanel) - -public: - wxTabbedPanel(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long windowStyle = 0, - const wxString& name = wxPanelNameStr); - virtual ~wxTabbedPanel(); - - wxTabView *GetTabView() const { return m_tabView; } - void SetTabView(wxTabView *v) { m_tabView = v; } - - void OnMouseEvent(wxMouseEvent& event); - void OnPaint(wxPaintEvent& event); - -protected: - wxTabView* m_tabView; - -private: - DECLARE_EVENT_TABLE() -}; - -WX_DECLARE_HASH_MAP(int, wxWindow*, wxIntegerHash, wxIntegerEqual, - wxIntToWindowHashMap); - -class WXDLLEXPORT wxPanelTabView : public wxTabView -{ - DECLARE_DYNAMIC_CLASS(wxPanelTabView) - -public: - wxPanelTabView(wxPanel *pan, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); - virtual ~wxPanelTabView(void); - - // Called when a tab is activated - virtual void OnTabActivate(int activateId, int deactivateId); - - // Specific to this class - void AddTabWindow(int id, wxWindow *window); - wxWindow *GetTabWindow(int id) const ; - void ClearWindows(bool deleteWindows = true); - wxWindow *GetCurrentWindow() const { return m_currentWindow; } - - void ShowWindowForTab(int id); - // wxList& GetWindows() const { return (wxList&) m_tabWindows; } - -protected: - // List of panels, one for each tab. Indexed - // by tab ID. - wxIntToWindowHashMap m_tabWindows; - wxWindow* m_currentWindow; - wxPanel* m_panel; -}; - -#endif - +///////////////////////////////////////////////////////////////////////////// +// Name: tabg.h +// Purpose: Generic tabbed dialogs +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: tabg.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __TABGH_G__ +#define __TABGH_G__ + +#define WXTAB_VERSION 1.1 + +#include "wx/hashmap.h" +#include "wx/string.h" +#include "wx/dialog.h" +#include "wx/panel.h" +#include "wx/list.h" + +class WXDLLEXPORT wxTabView; + +/* + * A wxTabControl is the internal and visual representation + * of the tab. + */ + +class WXDLLEXPORT wxTabControl: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxTabControl) +public: + wxTabControl(wxTabView *v = (wxTabView *) NULL); + virtual ~wxTabControl(void); + + virtual void OnDraw(wxDC& dc, bool lastInRow); + void SetLabel(const wxString& str) { m_controlLabel = str; } + wxString GetLabel(void) const { return m_controlLabel; } + + void SetFont(const wxFont& f) { m_labelFont = f; } + wxFont *GetFont(void) const { return (wxFont*) & m_labelFont; } + + void SetSelected(bool sel) { m_isSelected = sel; } + bool IsSelected(void) const { return m_isSelected; } + + void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } + void SetSize(int x, int y) { m_width = x; m_height = y; } + + void SetRowPosition(int r) { m_rowPosition = r; } + int GetRowPosition() const { return m_rowPosition; } + void SetColPosition(int c) { m_colPosition = c; } + int GetColPosition() const { return m_colPosition; } + + int GetX(void) const { return m_offsetX; } + int GetY(void) const { return m_offsetY; } + int GetWidth(void) const { return m_width; } + int GetHeight(void) const { return m_height; } + + int GetId(void) const { return m_id; } + void SetId(int i) { m_id = i; } + + virtual bool HitTest(int x, int y) const ; + +protected: + wxTabView* m_view; + wxString m_controlLabel; + bool m_isSelected; + wxFont m_labelFont; + int m_offsetX; // Offsets from top-left of tab view area (the area below the tabs) + int m_offsetY; + int m_width; + int m_height; + int m_id; + int m_rowPosition; // Position in row from 0 + int m_colPosition; // Position in col from 0 +}; + +/* + * Each wxTabLayer is a list of tabs. E.g. there + * are 3 layers in the MS Word Options dialog. + */ + +class WXDLLEXPORT wxTabLayer: public wxList +{ +}; + +/* + * The wxTabView controls and draws the tabbed object + */ + +WX_DECLARE_LIST(wxTabLayer, wxTabLayerList); + +#define wxTAB_STYLE_DRAW_BOX 1 // Draws 3D boxes round tab layers +#define wxTAB_STYLE_COLOUR_INTERIOR 2 // Colours interior of tabs, otherwise draws outline + +class WXDLLEXPORT wxTabView: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxTabView) +public: + wxTabView(long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); + virtual ~wxTabView(); + + inline int GetNumberOfLayers() const { return m_layers.GetCount(); } +#if WXWIN_COMPATIBILITY_2_4 + inline wxList& GetLayers() { return *(wxList *)&m_layers; } +#else + inline wxTabLayerList& GetLayers() { return m_layers; } +#endif + + inline void SetWindow(wxWindow* wnd) { m_window = wnd; } + inline wxWindow* GetWindow(void) const { return m_window; } + + // Automatically positions tabs + wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = (wxTabControl *) NULL); + + // Remove the tab without deleting the window + bool RemoveTab(int id); + + void ClearTabs(bool deleteTabs = true); + + bool SetTabText(int id, const wxString& label); + wxString GetTabText(int id) const; + + // Layout tabs (optional, e.g. if resizing window) + void LayoutTabs(); + + // Draw all tabs + virtual void Draw(wxDC& dc); + + // Process mouse event, return false if we didn't process it + virtual bool OnEvent(wxMouseEvent& event); + + // Called when a tab is activated + virtual void OnTabActivate(int activateId, int deactivateId); + // Allows vetoing + virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return true; }; + + // Allows use of application-supplied wxTabControl classes. + virtual wxTabControl *OnCreateTabControl(void) { return new wxTabControl(this); } + + void SetHighlightColour(const wxColour& col); + void SetShadowColour(const wxColour& col); + void SetBackgroundColour(const wxColour& col); + inline void SetTextColour(const wxColour& col) { m_textColour = col; } + + inline wxColour GetHighlightColour(void) const { return m_highlightColour; } + inline wxColour GetShadowColour(void) const { return m_shadowColour; } + inline wxColour GetBackgroundColour(void) const { return m_backgroundColour; } + inline wxColour GetTextColour(void) const { return m_textColour; } + inline const wxPen *GetHighlightPen(void) const { return m_highlightPen; } + inline const wxPen *GetShadowPen(void) const { return m_shadowPen; } + inline const wxPen *GetBackgroundPen(void) const { return m_backgroundPen; } + inline const wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; } + + inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; } + inline wxRect GetViewRect(void) const { return m_tabViewRect; } + + // Calculate tab width to fit to view, and optionally adjust the view + // to fit the tabs exactly. + int CalculateTabWidth(int noTabs, bool adjustView = false); + + inline void SetTabStyle(long style) { m_tabStyle = style; } + inline long GetTabStyle(void) const { return m_tabStyle; } + + inline void SetTabSize(int w, int h) { m_tabWidth = w; m_tabHeight = h; } + inline int GetTabWidth(void) const { return m_tabWidth; } + inline int GetTabHeight(void) const { return m_tabHeight; } + inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; } + inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; } + + // Returns the total height of the tabs component -- this may be several + // times the height of a tab, if there are several tab layers (rows). + int GetTotalTabHeight(); + + inline int GetTopMargin(void) const { return m_topMargin; } + inline void SetTopMargin(int margin) { m_topMargin = margin; } + + void SetTabSelection(int sel, bool activateTool = true); + inline int GetTabSelection() const { return m_tabSelection; } + + // Find tab control for id + wxTabControl *FindTabControlForId(int id) const ; + + // Find tab control for layer, position (starting from zero) + wxTabControl *FindTabControlForPosition(int layer, int position) const ; + + inline int GetHorizontalTabOffset() const { return m_tabHorizontalOffset; } + inline int GetHorizontalTabSpacing() const { return m_tabHorizontalSpacing; } + inline void SetHorizontalTabOffset(int sp) { m_tabHorizontalOffset = sp; } + inline void SetHorizontalTabSpacing(int sp) { m_tabHorizontalSpacing = sp; } + + inline void SetVerticalTabTextSpacing(int s) { m_tabVerticalTextSpacing = s; } + inline int GetVerticalTabTextSpacing() const { return m_tabVerticalTextSpacing; } + + inline wxFont *GetTabFont() const { return (wxFont*) & m_tabFont; } + inline void SetTabFont(const wxFont& f) { m_tabFont = f; } + + inline wxFont *GetSelectedTabFont() const { return (wxFont*) & m_tabSelectedFont; } + inline void SetSelectedTabFont(const wxFont& f) { m_tabSelectedFont = f; } + // Find the node and the column at which this control is positioned. + wxList::compatibility_iterator FindTabNodeAndColumn(wxTabControl *control, int *col) const ; + + // Do the necessary to change to this tab + virtual bool ChangeTab(wxTabControl *control); + + // Move the selected tab to the bottom layer, if necessary, + // without calling app activation code + bool MoveSelectionTab(wxTabControl *control); + + inline int GetNumberOfTabs() const { return m_noTabs; } + +protected: + // List of layers, from front to back. + wxTabLayerList m_layers; + + // Selected tab + int m_tabSelection; + + // Usual tab height + int m_tabHeight; + + // The height of the selected tab + int m_tabSelectionHeight; + + // Usual tab width + int m_tabWidth; + + // Space between tabs + int m_tabHorizontalSpacing; + + // Space between top of normal tab and text + int m_tabVerticalTextSpacing; + + // Horizontal offset of each tab row above the first + int m_tabHorizontalOffset; + + // The distance between the bottom of the first tab row + // and the top of the client area (i.e. the margin) + int m_topMargin; + + // The position and size of the view above which the tabs are placed. + // I.e., the internal client area of the sheet. + wxRect m_tabViewRect; + + // Bitlist of styles + long m_tabStyle; + + // Colours + wxColour m_highlightColour; + wxColour m_shadowColour; + wxColour m_backgroundColour; + wxColour m_textColour; + + // Pen and brush cache + const wxPen* m_highlightPen; + const wxPen* m_shadowPen; + const wxPen* m_backgroundPen; + const wxBrush* m_backgroundBrush; + + wxFont m_tabFont; + wxFont m_tabSelectedFont; + + int m_noTabs; + + wxWindow* m_window; +}; + +/* + * A dialog box class that is tab-friendly + */ + +class WXDLLEXPORT wxTabbedDialog : public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxTabbedDialog) + +public: + wxTabbedDialog(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long windowStyle = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + virtual ~wxTabbedDialog(); + + wxTabView *GetTabView() const { return m_tabView; } + void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnCloseWindow(wxCloseEvent& event); + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + +protected: + wxTabView* m_tabView; + +private: + DECLARE_EVENT_TABLE() +}; + +/* + * A panel class that is tab-friendly + */ + +class WXDLLEXPORT wxTabbedPanel : public wxPanel +{ + DECLARE_DYNAMIC_CLASS(wxTabbedPanel) + +public: + wxTabbedPanel(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long windowStyle = 0, + const wxString& name = wxPanelNameStr); + virtual ~wxTabbedPanel(); + + wxTabView *GetTabView() const { return m_tabView; } + void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + +protected: + wxTabView* m_tabView; + +private: + DECLARE_EVENT_TABLE() +}; + +WX_DECLARE_HASH_MAP(int, wxWindow*, wxIntegerHash, wxIntegerEqual, + wxIntToWindowHashMap); + +class WXDLLEXPORT wxPanelTabView : public wxTabView +{ + DECLARE_DYNAMIC_CLASS(wxPanelTabView) + +public: + wxPanelTabView(wxPanel *pan, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); + virtual ~wxPanelTabView(void); + + // Called when a tab is activated + virtual void OnTabActivate(int activateId, int deactivateId); + + // Specific to this class + void AddTabWindow(int id, wxWindow *window); + wxWindow *GetTabWindow(int id) const ; + void ClearWindows(bool deleteWindows = true); + wxWindow *GetCurrentWindow() const { return m_currentWindow; } + + void ShowWindowForTab(int id); + // wxList& GetWindows() const { return (wxList&) m_tabWindows; } + +protected: + // List of panels, one for each tab. Indexed + // by tab ID. + wxIntToWindowHashMap m_tabWindows; + wxWindow* m_currentWindow; + wxPanel* m_panel; +}; + +#endif + diff --git a/Externals/wxWidgets/include/wx/generic/textdlgg.h b/Externals/wxWidgets/include/wx/generic/textdlgg.h index fab9a10120..f7809e58dd 100644 --- a/Externals/wxWidgets/include/wx/generic/textdlgg.h +++ b/Externals/wxWidgets/include/wx/generic/textdlgg.h @@ -1,113 +1,113 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: textdlgg.h -// Purpose: wxTextEntryDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: textdlgg.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __TEXTDLGH_G__ -#define __TEXTDLGH_G__ - -#include "wx/defs.h" - -#if wxUSE_TEXTDLG - -#include "wx/dialog.h" - -#if wxUSE_VALIDATORS -#include "wx/valtext.h" -#endif - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[]; -extern WXDLLEXPORT_DATA(const wxChar) wxGetPasswordFromUserPromptStr[]; - -#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) - -// ---------------------------------------------------------------------------- -// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextEntryDialog : public wxDialog -{ -public: - wxTextEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& value = wxEmptyString, - long style = wxTextEntryDialogStyle, - const wxPoint& pos = wxDefaultPosition); - - void SetValue(const wxString& val); - wxString GetValue() const { return m_value; } - -#if wxUSE_VALIDATORS - void SetTextValidator( const wxTextValidator& validator ); - void SetTextValidator( long style = wxFILTER_NONE ); - wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } -#endif - // wxUSE_VALIDATORS - - // implementation only - void OnOK(wxCommandEvent& event); - -protected: - wxTextCtrl *m_textctrl; - wxString m_value; - long m_dialogStyle; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) - DECLARE_NO_COPY_CLASS(wxTextEntryDialog) -}; - -// ---------------------------------------------------------------------------- -// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog -{ -public: - wxPasswordEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxGetPasswordFromUserPromptStr, - const wxString& value = wxEmptyString, - long style = wxTextEntryDialogStyle, - const wxPoint& pos = wxDefaultPosition); -private: - DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) - DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) -}; - -// ---------------------------------------------------------------------------- -// function to get a string from user -// ---------------------------------------------------------------------------- - -wxString WXDLLEXPORT -wxGetTextFromUser(const wxString& message, - const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& default_value = wxEmptyString, - wxWindow *parent = (wxWindow *) NULL, - wxCoord x = wxDefaultCoord, - wxCoord y = wxDefaultCoord, - bool centre = true); - -wxString WXDLLEXPORT -wxGetPasswordFromUser(const wxString& message, - const wxString& caption = wxGetPasswordFromUserPromptStr, - const wxString& default_value = wxEmptyString, - wxWindow *parent = (wxWindow *) NULL, - wxCoord x = wxDefaultCoord, - wxCoord y = wxDefaultCoord, - bool centre = true); - -#endif - // wxUSE_TEXTDLG -#endif - // __TEXTDLGH_G__ +///////////////////////////////////////////////////////////////////////////// +// Name: textdlgg.h +// Purpose: wxTextEntryDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: textdlgg.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __TEXTDLGH_G__ +#define __TEXTDLGH_G__ + +#include "wx/defs.h" + +#if wxUSE_TEXTDLG + +#include "wx/dialog.h" + +#if wxUSE_VALIDATORS +#include "wx/valtext.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[]; +extern WXDLLEXPORT_DATA(const wxChar) wxGetPasswordFromUserPromptStr[]; + +#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) + +// ---------------------------------------------------------------------------- +// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTextEntryDialog : public wxDialog +{ +public: + wxTextEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxGetTextFromUserPromptStr, + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition); + + void SetValue(const wxString& val); + wxString GetValue() const { return m_value; } + +#if wxUSE_VALIDATORS + void SetTextValidator( const wxTextValidator& validator ); + void SetTextValidator( long style = wxFILTER_NONE ); + wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } +#endif + // wxUSE_VALIDATORS + + // implementation only + void OnOK(wxCommandEvent& event); + +protected: + wxTextCtrl *m_textctrl; + wxString m_value; + long m_dialogStyle; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) + DECLARE_NO_COPY_CLASS(wxTextEntryDialog) +}; + +// ---------------------------------------------------------------------------- +// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog +{ +public: + wxPasswordEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxGetPasswordFromUserPromptStr, + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition); +private: + DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) + DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) +}; + +// ---------------------------------------------------------------------------- +// function to get a string from user +// ---------------------------------------------------------------------------- + +wxString WXDLLEXPORT +wxGetTextFromUser(const wxString& message, + const wxString& caption = wxGetTextFromUserPromptStr, + const wxString& default_value = wxEmptyString, + wxWindow *parent = (wxWindow *) NULL, + wxCoord x = wxDefaultCoord, + wxCoord y = wxDefaultCoord, + bool centre = true); + +wxString WXDLLEXPORT +wxGetPasswordFromUser(const wxString& message, + const wxString& caption = wxGetPasswordFromUserPromptStr, + const wxString& default_value = wxEmptyString, + wxWindow *parent = (wxWindow *) NULL, + wxCoord x = wxDefaultCoord, + wxCoord y = wxDefaultCoord, + bool centre = true); + +#endif + // wxUSE_TEXTDLG +#endif + // __TEXTDLGH_G__ diff --git a/Externals/wxWidgets/include/wx/generic/timer.h b/Externals/wxWidgets/include/wx/generic/timer.h index 949b5af9ad..0f52c1b4a1 100644 --- a/Externals/wxWidgets/include/wx/generic/timer.h +++ b/Externals/wxWidgets/include/wx/generic/timer.h @@ -1,45 +1,45 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: timer.h -// Purpose: Generic implementation of wxTimer class -// Author: Vaclav Slavik -// Id: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef __WX_TIMER_H__ -#define __WX_TIMER_H__ - -//----------------------------------------------------------------------------- -// wxTimer -//----------------------------------------------------------------------------- - -class wxTimerDesc; - -class WXDLLEXPORT wxTimer : public wxTimerBase -{ -public: - wxTimer() { Init(); } - wxTimer(wxEvtHandler *owner, int timerid = -1) : wxTimerBase(owner, timerid) - { Init(); } - virtual ~wxTimer(); - - virtual bool Start(int millisecs = -1, bool oneShot = false); - virtual void Stop(); - - virtual bool IsRunning() const; - - // implementation - static void NotifyTimers(); - -protected: - void Init(); - -private: - wxTimerDesc *m_desc; - - DECLARE_ABSTRACT_CLASS(wxTimer) -}; - -#endif // __WX_TIMER_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: Generic implementation of wxTimer class +// Author: Vaclav Slavik +// Id: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_TIMER_H__ +#define __WX_TIMER_H__ + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class wxTimerDesc; + +class WXDLLEXPORT wxTimer : public wxTimerBase +{ +public: + wxTimer() { Init(); } + wxTimer(wxEvtHandler *owner, int timerid = -1) : wxTimerBase(owner, timerid) + { Init(); } + virtual ~wxTimer(); + + virtual bool Start(int millisecs = -1, bool oneShot = false); + virtual void Stop(); + + virtual bool IsRunning() const; + + // implementation + static void NotifyTimers(); + +protected: + void Init(); + +private: + wxTimerDesc *m_desc; + + DECLARE_ABSTRACT_CLASS(wxTimer) +}; + +#endif // __WX_TIMER_H__ diff --git a/Externals/wxWidgets/include/wx/generic/treectlg.h b/Externals/wxWidgets/include/wx/generic/treectlg.h index 818c8a31c5..a555716f63 100644 --- a/Externals/wxWidgets/include/wx/generic/treectlg.h +++ b/Externals/wxWidgets/include/wx/generic/treectlg.h @@ -1,383 +1,383 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/treectlg.h -// Purpose: wxTreeCtrl class -// Author: Robert Roebling -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: treectlg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1997,1998 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _GENERIC_TREECTRL_H_ -#define _GENERIC_TREECTRL_H_ - -#if wxUSE_TREECTRL - -#include "wx/scrolwin.h" -#include "wx/pen.h" - -// ----------------------------------------------------------------------------- -// forward declaration -// ----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem; - -class WXDLLIMPEXP_FWD_CORE wxTreeItemData; - -class WXDLLIMPEXP_FWD_CORE wxTreeRenameTimer; -class WXDLLIMPEXP_FWD_CORE wxTreeFindTimer; -class WXDLLIMPEXP_FWD_CORE wxTreeTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -// ----------------------------------------------------------------------------- -// wxGenericTreeCtrl - the tree control -// ----------------------------------------------------------------------------- - -class WXDLLEXPORT wxGenericTreeCtrl : public wxTreeCtrlBase, - public wxScrollHelper -{ -public: - // creation - // -------- - - wxGenericTreeCtrl() : wxTreeCtrlBase(), wxScrollHelper(this) { Init(); } - - wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_DEFAULT_STYLE, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr) - : wxTreeCtrlBase(), - wxScrollHelper(this) - { - Init(); - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxGenericTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_DEFAULT_STYLE, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr); - - - // implement base class pure virtuals - // ---------------------------------- - - virtual unsigned int GetCount() const; - - virtual unsigned int GetIndent() const { return m_indent; } - virtual void SetIndent(unsigned int indent); - - - virtual void SetImageList(wxImageList *imageList); - virtual void SetStateImageList(wxImageList *imageList); - - virtual wxString GetItemText(const wxTreeItemId& item) const; - virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const; - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; - virtual wxFont GetItemFont(const wxTreeItemId& item) const; - - virtual void SetItemText(const wxTreeItemId& item, const wxString& text); - virtual void SetItemImage(const wxTreeItemId& item, - int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal); - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); - - virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); - virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true); - virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); - virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); - virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); - - virtual bool IsVisible(const wxTreeItemId& item) const; - virtual bool ItemHasChildren(const wxTreeItemId& item) const; - virtual bool IsExpanded(const wxTreeItemId& item) const; - virtual bool IsSelected(const wxTreeItemId& item) const; - virtual bool IsBold(const wxTreeItemId& item) const; - - virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const; - - // navigation - // ---------- - - virtual wxTreeItemId GetRootItem() const { return m_anchor; } - virtual wxTreeItemId GetSelection() const { return m_current; } - virtual size_t GetSelections(wxArrayTreeItemIds&) const; - - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; - virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; - - virtual wxTreeItemId GetFirstVisibleItem() const; - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; - - - // operations - // ---------- - - virtual wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - virtual void Delete(const wxTreeItemId& item); - virtual void DeleteChildren(const wxTreeItemId& item); - virtual void DeleteAllItems(); - - virtual void Expand(const wxTreeItemId& item); - virtual void Collapse(const wxTreeItemId& item); - virtual void CollapseAndReset(const wxTreeItemId& item); - virtual void Toggle(const wxTreeItemId& item); - - virtual void Unselect(); - virtual void UnselectAll(); - virtual void SelectItem(const wxTreeItemId& item, bool select = true); - - virtual void EnsureVisible(const wxTreeItemId& item); - virtual void ScrollTo(const wxTreeItemId& item); - - virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); - virtual wxTextCtrl *GetEditControl() const; - virtual void EndEditLabel(const wxTreeItemId& item, - bool discardChanges = false); - - virtual void SortChildren(const wxTreeItemId& item); - - // items geometry - // -------------- - - virtual bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = false) const; - - - // this version specific methods - // ----------------------------- - - wxImageList *GetButtonsImageList() const { return m_imageListButtons; } - void SetButtonsImageList(wxImageList *imageList); - void AssignButtonsImageList(wxImageList *imageList); - - void SetDropEffectAboveItem( bool above = false ) { m_dropEffectAboveItem = above; } - bool GetDropEffectAboveItem() const { return m_dropEffectAboveItem; } - - wxTreeItemId GetNext(const wxTreeItemId& item) const; - -#if WXWIN_COMPATIBILITY_2_6 - // use EditLabel() instead - void Edit( const wxTreeItemId& item ) { EditLabel(item); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#if WXWIN_COMPATIBILITY_2_4 - // deprecated functions: use Set/GetItemImage directly - wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); - wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); - - // use the versions taking wxTreeItemIdValue cookies (note that - // GetNextChild() is not inside wxDEPRECATED on purpose, as otherwise we - // get twice as many warnings without any added benefit: it is always used - // with GetFirstChild() anyhow) - wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, - long& cookie) const ); - wxTreeItemId GetNextChild(const wxTreeItemId& item, - long& cookie) const; -#endif // WXWIN_COMPATIBILITY_2_4 - - // implementation only from now on - - // overridden base class virtuals - virtual bool SetBackgroundColour(const wxColour& colour); - virtual bool SetForegroundColour(const wxColour& colour); - - virtual void Freeze(); - virtual void Thaw(); - virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL); - - virtual bool SetFont( const wxFont &font ); - virtual void SetWindowStyle(const long styles); - - // callbacks - void OnPaint( wxPaintEvent &event ); - void OnSetFocus( wxFocusEvent &event ); - void OnKillFocus( wxFocusEvent &event ); - void OnChar( wxKeyEvent &event ); - void OnMouse( wxMouseEvent &event ); - void OnGetToolTip( wxTreeEvent &event ); - void OnSize( wxSizeEvent &event ); - void OnInternalIdle( ); - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // implementation helpers - void AdjustMyScrollbars(); - - WX_FORWARD_TO_SCROLL_HELPER() - -protected: - friend class wxGenericTreeItem; - friend class wxTreeRenameTimer; - friend class wxTreeFindTimer; - friend class wxTreeTextCtrl; - - wxFont m_normalFont; - wxFont m_boldFont; - - wxGenericTreeItem *m_anchor; - wxGenericTreeItem *m_current, - *m_key_current, - // A hint to select a parent item after deleting a child - *m_select_me; - unsigned short m_indent; - int m_lineHeight; - wxPen m_dottedPen; - wxBrush *m_hilightBrush, - *m_hilightUnfocusedBrush; - bool m_hasFocus; - bool m_dirty; - bool m_ownsImageListButtons; - bool m_isDragging; // true between BEGIN/END drag events - bool m_lastOnSame; // last click on the same item as prev - wxImageList *m_imageListButtons; - - int m_freezeCount; - int m_dragCount; - wxPoint m_dragStart; - wxGenericTreeItem *m_dropTarget; - wxCursor m_oldCursor; // cursor is changed while dragging - wxGenericTreeItem *m_oldSelection; - wxGenericTreeItem *m_underMouse; // for visual effects - wxTreeTextCtrl *m_textCtrl; - - wxTimer *m_renameTimer; - - // incremental search data - wxString m_findPrefix; - wxTimer *m_findTimer; - - bool m_dropEffectAboveItem; - - // the common part of all ctors - void Init(); - - // misc helpers - void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted); - - void DrawBorder(const wxTreeItemId& item); - void DrawLine(const wxTreeItemId& item, bool below); - void DrawDropEffect(wxGenericTreeItem *item); - - void DoSelectItem(const wxTreeItemId& id, - bool unselect_others = true, - bool extended_select = false); - - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - size_t previous, - const wxString& text, - int image, - int selectedImage, - wxTreeItemData *data); - virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; - - // called by wxTextTreeCtrl when it marks itself for deletion - void ResetTextControl(); - - // find the first item starting with the given prefix after the given item - wxTreeItemId FindItem(const wxTreeItemId& id, const wxString& prefix) const; - - bool HasButtons() const { return HasFlag(wxTR_HAS_BUTTONS); } - - void CalculateLineHeight(); - int GetLineHeight(wxGenericTreeItem *item) const; - void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y ); - void PaintItem( wxGenericTreeItem *item, wxDC& dc); - - void CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ); - void CalculatePositions(); - void CalculateSize( wxGenericTreeItem *item, wxDC &dc ); - - void RefreshSubtree( wxGenericTreeItem *item ); - void RefreshLine( wxGenericTreeItem *item ); - - // redraw all selected items - void RefreshSelected(); - - // RefreshSelected() recursive helper - void RefreshSelectedUnder(wxGenericTreeItem *item); - - void OnRenameTimer(); - bool OnRenameAccept(wxGenericTreeItem *item, const wxString& value); - void OnRenameCancelled(wxGenericTreeItem *item); - - void FillArray(wxGenericTreeItem*, wxArrayTreeItemIds&) const; - void SelectItemRange( wxGenericTreeItem *item1, wxGenericTreeItem *item2 ); - bool TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); - bool TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); - void UnselectAllChildren( wxGenericTreeItem *item ); - void ChildrenClosing(wxGenericTreeItem* item); - - void DoDirtyProcessing(); - - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl) - DECLARE_NO_COPY_CLASS(wxGenericTreeCtrl) -}; - -#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) -/* - * wxTreeCtrl has to be a real class or we have problems with - * the run-time information. - */ - -class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl -{ - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) - -public: - wxTreeCtrl() {} - - wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_DEFAULT_STYLE, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr) - : wxGenericTreeCtrl(parent, id, pos, size, style, validator, name) - { - } -}; -#endif // !__WXMSW__ || __WXUNIVERSAL__ - -#endif // wxUSE_TREECTRL - -#endif // _GENERIC_TREECTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/treectlg.h +// Purpose: wxTreeCtrl class +// Author: Robert Roebling +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: treectlg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 1997,1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _GENERIC_TREECTRL_H_ +#define _GENERIC_TREECTRL_H_ + +#if wxUSE_TREECTRL + +#include "wx/scrolwin.h" +#include "wx/pen.h" + +// ----------------------------------------------------------------------------- +// forward declaration +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem; + +class WXDLLIMPEXP_FWD_CORE wxTreeItemData; + +class WXDLLIMPEXP_FWD_CORE wxTreeRenameTimer; +class WXDLLIMPEXP_FWD_CORE wxTreeFindTimer; +class WXDLLIMPEXP_FWD_CORE wxTreeTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +// ----------------------------------------------------------------------------- +// wxGenericTreeCtrl - the tree control +// ----------------------------------------------------------------------------- + +class WXDLLEXPORT wxGenericTreeCtrl : public wxTreeCtrlBase, + public wxScrollHelper +{ +public: + // creation + // -------- + + wxGenericTreeCtrl() : wxTreeCtrlBase(), wxScrollHelper(this) { Init(); } + + wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr) + : wxTreeCtrlBase(), + wxScrollHelper(this) + { + Init(); + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxGenericTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr); + + + // implement base class pure virtuals + // ---------------------------------- + + virtual unsigned int GetCount() const; + + virtual unsigned int GetIndent() const { return m_indent; } + virtual void SetIndent(unsigned int indent); + + + virtual void SetImageList(wxImageList *imageList); + virtual void SetStateImageList(wxImageList *imageList); + + virtual wxString GetItemText(const wxTreeItemId& item) const; + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const; + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; + virtual wxFont GetItemFont(const wxTreeItemId& item) const; + + virtual void SetItemText(const wxTreeItemId& item, const wxString& text); + virtual void SetItemImage(const wxTreeItemId& item, + int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + + virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); + virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true); + virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); + virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); + virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); + + virtual bool IsVisible(const wxTreeItemId& item) const; + virtual bool ItemHasChildren(const wxTreeItemId& item) const; + virtual bool IsExpanded(const wxTreeItemId& item) const; + virtual bool IsSelected(const wxTreeItemId& item) const; + virtual bool IsBold(const wxTreeItemId& item) const; + + virtual size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = true) const; + + // navigation + // ---------- + + virtual wxTreeItemId GetRootItem() const { return m_anchor; } + virtual wxTreeItemId GetSelection() const { return m_current; } + virtual size_t GetSelections(wxArrayTreeItemIds&) const; + + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const; + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const; + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + virtual wxTreeItemId GetFirstVisibleItem() const; + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + + // operations + // ---------- + + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + virtual void Delete(const wxTreeItemId& item); + virtual void DeleteChildren(const wxTreeItemId& item); + virtual void DeleteAllItems(); + + virtual void Expand(const wxTreeItemId& item); + virtual void Collapse(const wxTreeItemId& item); + virtual void CollapseAndReset(const wxTreeItemId& item); + virtual void Toggle(const wxTreeItemId& item); + + virtual void Unselect(); + virtual void UnselectAll(); + virtual void SelectItem(const wxTreeItemId& item, bool select = true); + + virtual void EnsureVisible(const wxTreeItemId& item); + virtual void ScrollTo(const wxTreeItemId& item); + + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + virtual wxTextCtrl *GetEditControl() const; + virtual void EndEditLabel(const wxTreeItemId& item, + bool discardChanges = false); + + virtual void SortChildren(const wxTreeItemId& item); + + // items geometry + // -------------- + + virtual bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = false) const; + + + // this version specific methods + // ----------------------------- + + wxImageList *GetButtonsImageList() const { return m_imageListButtons; } + void SetButtonsImageList(wxImageList *imageList); + void AssignButtonsImageList(wxImageList *imageList); + + void SetDropEffectAboveItem( bool above = false ) { m_dropEffectAboveItem = above; } + bool GetDropEffectAboveItem() const { return m_dropEffectAboveItem; } + + wxTreeItemId GetNext(const wxTreeItemId& item) const; + +#if WXWIN_COMPATIBILITY_2_6 + // use EditLabel() instead + void Edit( const wxTreeItemId& item ) { EditLabel(item); } +#endif // WXWIN_COMPATIBILITY_2_6 + +#if WXWIN_COMPATIBILITY_2_4 + // deprecated functions: use Set/GetItemImage directly + wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); + wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); + + // use the versions taking wxTreeItemIdValue cookies (note that + // GetNextChild() is not inside wxDEPRECATED on purpose, as otherwise we + // get twice as many warnings without any added benefit: it is always used + // with GetFirstChild() anyhow) + wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, + long& cookie) const ); + wxTreeItemId GetNextChild(const wxTreeItemId& item, + long& cookie) const; +#endif // WXWIN_COMPATIBILITY_2_4 + + // implementation only from now on + + // overridden base class virtuals + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); + + virtual void Freeze(); + virtual void Thaw(); + virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL); + + virtual bool SetFont( const wxFont &font ); + virtual void SetWindowStyle(const long styles); + + // callbacks + void OnPaint( wxPaintEvent &event ); + void OnSetFocus( wxFocusEvent &event ); + void OnKillFocus( wxFocusEvent &event ); + void OnChar( wxKeyEvent &event ); + void OnMouse( wxMouseEvent &event ); + void OnGetToolTip( wxTreeEvent &event ); + void OnSize( wxSizeEvent &event ); + void OnInternalIdle( ); + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation helpers + void AdjustMyScrollbars(); + + WX_FORWARD_TO_SCROLL_HELPER() + +protected: + friend class wxGenericTreeItem; + friend class wxTreeRenameTimer; + friend class wxTreeFindTimer; + friend class wxTreeTextCtrl; + + wxFont m_normalFont; + wxFont m_boldFont; + + wxGenericTreeItem *m_anchor; + wxGenericTreeItem *m_current, + *m_key_current, + // A hint to select a parent item after deleting a child + *m_select_me; + unsigned short m_indent; + int m_lineHeight; + wxPen m_dottedPen; + wxBrush *m_hilightBrush, + *m_hilightUnfocusedBrush; + bool m_hasFocus; + bool m_dirty; + bool m_ownsImageListButtons; + bool m_isDragging; // true between BEGIN/END drag events + bool m_lastOnSame; // last click on the same item as prev + wxImageList *m_imageListButtons; + + int m_freezeCount; + int m_dragCount; + wxPoint m_dragStart; + wxGenericTreeItem *m_dropTarget; + wxCursor m_oldCursor; // cursor is changed while dragging + wxGenericTreeItem *m_oldSelection; + wxGenericTreeItem *m_underMouse; // for visual effects + wxTreeTextCtrl *m_textCtrl; + + wxTimer *m_renameTimer; + + // incremental search data + wxString m_findPrefix; + wxTimer *m_findTimer; + + bool m_dropEffectAboveItem; + + // the common part of all ctors + void Init(); + + // misc helpers + void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted); + + void DrawBorder(const wxTreeItemId& item); + void DrawLine(const wxTreeItemId& item, bool below); + void DrawDropEffect(wxGenericTreeItem *item); + + void DoSelectItem(const wxTreeItemId& id, + bool unselect_others = true, + bool extended_select = false); + + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t previous, + const wxString& text, + int image, + int selectedImage, + wxTreeItemData *data); + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL); + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; + + // called by wxTextTreeCtrl when it marks itself for deletion + void ResetTextControl(); + + // find the first item starting with the given prefix after the given item + wxTreeItemId FindItem(const wxTreeItemId& id, const wxString& prefix) const; + + bool HasButtons() const { return HasFlag(wxTR_HAS_BUTTONS); } + + void CalculateLineHeight(); + int GetLineHeight(wxGenericTreeItem *item) const; + void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y ); + void PaintItem( wxGenericTreeItem *item, wxDC& dc); + + void CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ); + void CalculatePositions(); + void CalculateSize( wxGenericTreeItem *item, wxDC &dc ); + + void RefreshSubtree( wxGenericTreeItem *item ); + void RefreshLine( wxGenericTreeItem *item ); + + // redraw all selected items + void RefreshSelected(); + + // RefreshSelected() recursive helper + void RefreshSelectedUnder(wxGenericTreeItem *item); + + void OnRenameTimer(); + bool OnRenameAccept(wxGenericTreeItem *item, const wxString& value); + void OnRenameCancelled(wxGenericTreeItem *item); + + void FillArray(wxGenericTreeItem*, wxArrayTreeItemIds&) const; + void SelectItemRange( wxGenericTreeItem *item1, wxGenericTreeItem *item2 ); + bool TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); + bool TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); + void UnselectAllChildren( wxGenericTreeItem *item ); + void ChildrenClosing(wxGenericTreeItem* item); + + void DoDirtyProcessing(); + + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl) + DECLARE_NO_COPY_CLASS(wxGenericTreeCtrl) +}; + +#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) +/* + * wxTreeCtrl has to be a real class or we have problems with + * the run-time information. + */ + +class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl +{ + DECLARE_DYNAMIC_CLASS(wxTreeCtrl) + +public: + wxTreeCtrl() {} + + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr) + : wxGenericTreeCtrl(parent, id, pos, size, style, validator, name) + { + } +}; +#endif // !__WXMSW__ || __WXUNIVERSAL__ + +#endif // wxUSE_TREECTRL + +#endif // _GENERIC_TREECTRL_H_ diff --git a/Externals/wxWidgets/include/wx/generic/wizard.h b/Externals/wxWidgets/include/wx/generic/wizard.h index 69e1f8050e..5d4d9bd60c 100644 --- a/Externals/wxWidgets/include/wx/generic/wizard.h +++ b/Externals/wxWidgets/include/wx/generic/wizard.h @@ -1,142 +1,142 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/generic/wizard.h -// Purpose: declaration of generic wxWizard class -// Author: Vadim Zeitlin -// Modified by: Robert Vazan (sizers) -// Created: 28.09.99 -// RCS-ID: $Id: wizard.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GENERIC_WIZARD_H_ -#define _WX_GENERIC_WIZARD_H_ - -// ---------------------------------------------------------------------------- -// wxWizard -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; -class WXDLLIMPEXP_FWD_ADV wxWizardEvent; -class WXDLLIMPEXP_FWD_CORE wxBoxSizer; -class WXDLLIMPEXP_FWD_ADV wxWizardSizer; - -class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase -{ -public: - // ctor - wxWizard() { Init(); } - wxWizard(wxWindow *parent, - int id = wxID_ANY, - const wxString& title = wxEmptyString, - const wxBitmap& bitmap = wxNullBitmap, - const wxPoint& pos = wxDefaultPosition, - long style = wxDEFAULT_DIALOG_STYLE) - { - Init(); - Create(parent, id, title, bitmap, pos, style); - } - bool Create(wxWindow *parent, - int id = wxID_ANY, - const wxString& title = wxEmptyString, - const wxBitmap& bitmap = wxNullBitmap, - const wxPoint& pos = wxDefaultPosition, - long style = wxDEFAULT_DIALOG_STYLE); - void Init(); - -#if wxABI_VERSION >= 20804 - virtual ~wxWizard(); -#endif - - // implement base class pure virtuals - virtual bool RunWizard(wxWizardPage *firstPage); - virtual wxWizardPage *GetCurrentPage() const; - virtual void SetPageSize(const wxSize& size); - virtual wxSize GetPageSize() const; - virtual void FitToPage(const wxWizardPage *firstPage); - virtual wxSizer *GetPageAreaSizer() const; - virtual void SetBorder(int border); - - /// set/get bitmap -#if wxABI_VERSION >= 20805 - const wxBitmap& GetBitmap() const { return m_bitmap; } - void SetBitmap(const wxBitmap& bitmap); -#endif - - // implementation only from now on - // ------------------------------- - - // is the wizard running? - bool IsRunning() const { return m_page != NULL; } - - // show the prev/next page, but call TransferDataFromWindow on the current - // page first and return false without changing the page if - // TransferDataFromWindow() returns false - otherwise, returns true - bool ShowPage(wxWizardPage *page, bool goingForward = true); - - // do fill the dialog with controls - // this is app-overridable to, for example, set help and tooltip text - virtual void DoCreateControls(); - -protected: - // for compatibility only, doesn't do anything any more - void FinishLayout() { } - -private: - // was the dialog really created? - bool WasCreated() const { return m_btnPrev != NULL; } - - // event handlers - void OnCancel(wxCommandEvent& event); - void OnBackOrNext(wxCommandEvent& event); - void OnHelp(wxCommandEvent& event); - - void OnWizEvent(wxWizardEvent& event); - - void AddBitmapRow(wxBoxSizer *mainColumn); - void AddStaticLine(wxBoxSizer *mainColumn); - void AddBackNextPair(wxBoxSizer *buttonRow); - void AddButtonRow(wxBoxSizer *mainColumn); - - // the page size requested by user - wxSize m_sizePage; - - // the dialog position from the ctor - wxPoint m_posWizard; - - // wizard state - wxWizardPage *m_page; // the current page or NULL - wxBitmap m_bitmap; // the default bitmap to show - - // wizard controls - wxButton *m_btnPrev, // the "" or "Finish" button - wxStaticBitmap *m_statbmp; // the control for the bitmap - - // Border around page area sizer requested using SetBorder() - int m_border; - - // Whether RunWizard() was called - bool m_started; - - // Whether was modal (modeless has to be destroyed on finish or cancel) - bool m_wasModal; - - // True if pages are laid out using the sizer - bool m_usingSizer; - - // Page area sizer will be inserted here with padding - wxBoxSizer *m_sizerBmpAndPage; - - // Actual position and size of pages - wxWizardSizer *m_sizerPage; - - friend class wxWizardSizer; - - DECLARE_DYNAMIC_CLASS(wxWizard) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxWizard) -}; - -#endif // _WX_GENERIC_WIZARD_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/wizard.h +// Purpose: declaration of generic wxWizard class +// Author: Vadim Zeitlin +// Modified by: Robert Vazan (sizers) +// Created: 28.09.99 +// RCS-ID: $Id: wizard.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_WIZARD_H_ +#define _WX_GENERIC_WIZARD_H_ + +// ---------------------------------------------------------------------------- +// wxWizard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; +class WXDLLIMPEXP_FWD_ADV wxWizardEvent; +class WXDLLIMPEXP_FWD_CORE wxBoxSizer; +class WXDLLIMPEXP_FWD_ADV wxWizardSizer; + +class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase +{ +public: + // ctor + wxWizard() { Init(); } + wxWizard(wxWindow *parent, + int id = wxID_ANY, + const wxString& title = wxEmptyString, + const wxBitmap& bitmap = wxNullBitmap, + const wxPoint& pos = wxDefaultPosition, + long style = wxDEFAULT_DIALOG_STYLE) + { + Init(); + Create(parent, id, title, bitmap, pos, style); + } + bool Create(wxWindow *parent, + int id = wxID_ANY, + const wxString& title = wxEmptyString, + const wxBitmap& bitmap = wxNullBitmap, + const wxPoint& pos = wxDefaultPosition, + long style = wxDEFAULT_DIALOG_STYLE); + void Init(); + +#if wxABI_VERSION >= 20804 + virtual ~wxWizard(); +#endif + + // implement base class pure virtuals + virtual bool RunWizard(wxWizardPage *firstPage); + virtual wxWizardPage *GetCurrentPage() const; + virtual void SetPageSize(const wxSize& size); + virtual wxSize GetPageSize() const; + virtual void FitToPage(const wxWizardPage *firstPage); + virtual wxSizer *GetPageAreaSizer() const; + virtual void SetBorder(int border); + + /// set/get bitmap +#if wxABI_VERSION >= 20805 + const wxBitmap& GetBitmap() const { return m_bitmap; } + void SetBitmap(const wxBitmap& bitmap); +#endif + + // implementation only from now on + // ------------------------------- + + // is the wizard running? + bool IsRunning() const { return m_page != NULL; } + + // show the prev/next page, but call TransferDataFromWindow on the current + // page first and return false without changing the page if + // TransferDataFromWindow() returns false - otherwise, returns true + bool ShowPage(wxWizardPage *page, bool goingForward = true); + + // do fill the dialog with controls + // this is app-overridable to, for example, set help and tooltip text + virtual void DoCreateControls(); + +protected: + // for compatibility only, doesn't do anything any more + void FinishLayout() { } + +private: + // was the dialog really created? + bool WasCreated() const { return m_btnPrev != NULL; } + + // event handlers + void OnCancel(wxCommandEvent& event); + void OnBackOrNext(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); + + void OnWizEvent(wxWizardEvent& event); + + void AddBitmapRow(wxBoxSizer *mainColumn); + void AddStaticLine(wxBoxSizer *mainColumn); + void AddBackNextPair(wxBoxSizer *buttonRow); + void AddButtonRow(wxBoxSizer *mainColumn); + + // the page size requested by user + wxSize m_sizePage; + + // the dialog position from the ctor + wxPoint m_posWizard; + + // wizard state + wxWizardPage *m_page; // the current page or NULL + wxBitmap m_bitmap; // the default bitmap to show + + // wizard controls + wxButton *m_btnPrev, // the "" or "Finish" button + wxStaticBitmap *m_statbmp; // the control for the bitmap + + // Border around page area sizer requested using SetBorder() + int m_border; + + // Whether RunWizard() was called + bool m_started; + + // Whether was modal (modeless has to be destroyed on finish or cancel) + bool m_wasModal; + + // True if pages are laid out using the sizer + bool m_usingSizer; + + // Page area sizer will be inserted here with padding + wxBoxSizer *m_sizerBmpAndPage; + + // Actual position and size of pages + wxWizardSizer *m_sizerPage; + + friend class wxWizardSizer; + + DECLARE_DYNAMIC_CLASS(wxWizard) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxWizard) +}; + +#endif // _WX_GENERIC_WIZARD_H_ diff --git a/Externals/wxWidgets/include/wx/geometry.h b/Externals/wxWidgets/include/wx/geometry.h index c4e67817f0..385f36e98b 100644 --- a/Externals/wxWidgets/include/wx/geometry.h +++ b/Externals/wxWidgets/include/wx/geometry.h @@ -1,814 +1,814 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/geometry.h -// Purpose: Common Geometry Classes -// Author: Stefan Csomor -// Modified by: -// Created: 08/05/99 -// RCS-ID: $Id: geometry.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GEOMETRY_H_ -#define _WX_GEOMETRY_H_ - -#include "wx/defs.h" - -#if wxUSE_GEOMETRY - -#include "wx/utils.h" -#include "wx/gdicmn.h" -#include "wx/math.h" - -class WXDLLIMPEXP_FWD_BASE wxDataInputStream; -class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; - -// clipping from Cohen-Sutherland - -enum wxOutCode -{ - wxInside = 0x00 , - wxOutLeft = 0x01 , - wxOutRight = 0x02 , - wxOutTop = 0x08 , - wxOutBottom = 0x04 -}; - -class WXDLLEXPORT wxPoint2DInt -{ -public : - inline wxPoint2DInt(); - inline wxPoint2DInt( wxInt32 x , wxInt32 y ); - inline wxPoint2DInt( const wxPoint2DInt &pt ); - inline wxPoint2DInt( const wxPoint &pt ); - - // noops for this class, just return the coords - inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; - inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; - - inline wxDouble GetVectorLength() const; - wxDouble GetVectorAngle() const; - inline void SetVectorLength( wxDouble length ); - void SetVectorAngle( wxDouble degrees ); - void SetPolarCoordinates( wxInt32 angle , wxInt32 length ); - // set the vector length to 1.0, preserving the angle - inline void Normalize(); - - inline wxDouble GetDistance( const wxPoint2DInt &pt ) const; - inline wxDouble GetDistanceSquare( const wxPoint2DInt &pt ) const; - inline wxInt32 GetDotProduct( const wxPoint2DInt &vec ) const; - inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; - - // the reflection of this point - inline wxPoint2DInt operator-(); - - inline wxPoint2DInt& operator=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator*=(wxDouble n); - inline wxPoint2DInt& operator*=(wxInt32 n); - inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt); - inline wxPoint2DInt& operator/=(wxDouble n); - inline wxPoint2DInt& operator/=(wxInt32 n); - inline operator wxPoint() const; - inline bool operator==(const wxPoint2DInt& pt) const; - inline bool operator!=(const wxPoint2DInt& pt) const; - -#if wxUSE_STREAMS - void WriteTo( wxDataOutputStream &stream ) const; - void ReadFrom( wxDataInputStream &stream ); -#endif // wxUSE_STREAMS - - wxInt32 m_x; - wxInt32 m_y; -}; - -inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); - -inline wxPoint2DInt::wxPoint2DInt() -{ - m_x = 0; - m_y = 0; -} - -inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y ) -{ - m_x = x; - m_y = y; -} - -inline wxPoint2DInt::wxPoint2DInt( const wxPoint2DInt &pt ) -{ - m_x = pt.m_x; - m_y = pt.m_y; -} - -inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt ) -{ - m_x = pt.x; - m_y = pt.y; -} - -inline void wxPoint2DInt::GetFloor( wxInt32 *x , wxInt32 *y ) const -{ - if ( x ) - *x = m_x; - if ( y ) - *y = m_y; -} - -inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const -{ - GetFloor(x, y); -} - -inline wxDouble wxPoint2DInt::GetVectorLength() const -{ - // cast needed MIPSpro compiler under SGI - return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) ); -} - -inline void wxPoint2DInt::SetVectorLength( wxDouble length ) -{ - wxDouble before = GetVectorLength(); - m_x = (wxInt32)(m_x * length / before); - m_y = (wxInt32)(m_y * length / before); -} - -inline void wxPoint2DInt::Normalize() -{ - SetVectorLength( 1 ); -} - -inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const -{ - return sqrt( GetDistanceSquare( pt ) ); -} - -inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const -{ - return ( (wxDouble)(pt.m_x-m_x)*(pt.m_x-m_x) + (wxDouble)(pt.m_y-m_y)*(pt.m_y-m_y) ); -} - -inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const -{ - return ( m_x * vec.m_x + m_y * vec.m_y ); -} - -inline wxInt32 wxPoint2DInt::GetCrossProduct( const wxPoint2DInt &vec ) const -{ - return ( m_x * vec.m_y - vec.m_x * m_y ); -} - -inline wxPoint2DInt::operator wxPoint() const -{ - return wxPoint( m_x, m_y); -} - -inline wxPoint2DInt wxPoint2DInt::operator-() -{ - return wxPoint2DInt( -m_x, -m_y); -} - -inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) -{ - m_x = pt.m_x; - m_y = pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt) -{ - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt) -{ - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt) -{ - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; - return *this; -} - -inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt) -{ - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; - return *this; -} - -inline bool wxPoint2DInt::operator==(const wxPoint2DInt& pt) const -{ - return m_x == pt.m_x && m_y == pt.m_y; -} - -inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const -{ - return m_x != pt.m_x || m_y != pt.m_y; -} - -inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); -} - -inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); -} - - -inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); -} - -inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt) -{ - return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt) -{ - return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); -} - -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) -{ - return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n) -{ - return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); -} - -inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) -{ - return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); -} - -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n) -{ - return wxPoint2DInt( pt.m_x / n , pt.m_y / n ); -} - -inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) -{ - return wxPoint2DInt( (int) (pt.m_x / n) , (int) (pt.m_y / n) ); -} - -// wxPoint2Ds represent a point or a vector in a 2d coordinate system - -class WXDLLEXPORT wxPoint2DDouble -{ -public : - inline wxPoint2DDouble(); - inline wxPoint2DDouble( wxDouble x , wxDouble y ); - inline wxPoint2DDouble( const wxPoint2DDouble &pt ); - wxPoint2DDouble( const wxPoint2DInt &pt ) - { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; } - wxPoint2DDouble( const wxPoint &pt ) - { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; } - - // two different conversions to integers, floor and rounding - inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; - inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; - - inline wxDouble GetVectorLength() const; - wxDouble GetVectorAngle() const ; - void SetVectorLength( wxDouble length ); - void SetVectorAngle( wxDouble degrees ); - void SetPolarCoordinates( wxDouble angle , wxDouble length ); - // set the vector length to 1.0, preserving the angle - void Normalize(); - - inline wxDouble GetDistance( const wxPoint2DDouble &pt ) const; - inline wxDouble GetDistanceSquare( const wxPoint2DDouble &pt ) const; - inline wxDouble GetDotProduct( const wxPoint2DDouble &vec ) const; - inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; - - // the reflection of this point - inline wxPoint2DDouble operator-(); - - inline wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator*=(wxDouble n); - inline wxPoint2DDouble& operator*=(wxInt32 n); - inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt); - inline wxPoint2DDouble& operator/=(wxDouble n); - inline wxPoint2DDouble& operator/=(wxInt32 n); - - inline bool operator==(const wxPoint2DDouble& pt) const; - inline bool operator!=(const wxPoint2DDouble& pt) const; - - wxDouble m_x; - wxDouble m_y; -}; - -inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt); -inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt); -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n); -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n); -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n); -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n); - -inline wxPoint2DDouble::wxPoint2DDouble() -{ - m_x = 0.0; - m_y = 0.0; -} - -inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y ) -{ - m_x = x; - m_y = y; -} - -inline wxPoint2DDouble::wxPoint2DDouble( const wxPoint2DDouble &pt ) -{ - m_x = pt.m_x; - m_y = pt.m_y; -} - -inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const -{ - *x = (wxInt32) floor( m_x ); - *y = (wxInt32) floor( m_y ); -} - -inline void wxPoint2DDouble::GetRounded( wxInt32 *x , wxInt32 *y ) const -{ - *x = (wxInt32) floor( m_x + 0.5 ); - *y = (wxInt32) floor( m_y + 0.5); -} - -inline wxDouble wxPoint2DDouble::GetVectorLength() const -{ - return sqrt( (m_x)*(m_x) + (m_y)*(m_y) ) ; -} - -inline void wxPoint2DDouble::SetVectorLength( wxDouble length ) -{ - wxDouble before = GetVectorLength() ; - m_x = (m_x * length / before) ; - m_y = (m_y * length / before) ; -} - -inline void wxPoint2DDouble::Normalize() -{ - SetVectorLength( 1 ); -} - -inline wxDouble wxPoint2DDouble::GetDistance( const wxPoint2DDouble &pt ) const -{ - return sqrt( GetDistanceSquare( pt ) ); -} - -inline wxDouble wxPoint2DDouble::GetDistanceSquare( const wxPoint2DDouble &pt ) const -{ - return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); -} - -inline wxDouble wxPoint2DDouble::GetDotProduct( const wxPoint2DDouble &vec ) const -{ - return ( m_x * vec.m_x + m_y * vec.m_y ); -} - -inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) const -{ - return ( m_x * vec.m_y - vec.m_x * m_y ); -} - -inline wxPoint2DDouble wxPoint2DDouble::operator-() -{ - return wxPoint2DDouble( -m_x, -m_y); -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) -{ - m_x = pt.m_x; - m_y = pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt) -{ - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt) -{ - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt) -{ - m_x = m_x * pt.m_x; - m_y = m_y * pt.m_y; - return *this; -} - -inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt) -{ - m_x = m_x / pt.m_x; - m_y = m_y / pt.m_y; - return *this; -} - -inline bool wxPoint2DDouble::operator==(const wxPoint2DDouble& pt) const -{ - return wxIsSameDouble(m_x, pt.m_x) && wxIsSameDouble(m_y, pt.m_y); -} - -inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const -{ - return !(*this == pt); -} - -inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); -} - -inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); -} - - -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); -} - -inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n) -{ - return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); -} - -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) -{ - return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); -} - -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n) -{ - return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); -} - -inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n) -{ - return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); -} - -// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the -// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if -// left <= x < right and top <= m_y < bottom , thus it is a half open interval. - -class WXDLLEXPORT wxRect2DDouble -{ -public: - wxRect2DDouble() - { m_x = m_y = m_width = m_height = 0; } - wxRect2DDouble(wxDouble x, wxDouble y, wxDouble w, wxDouble h) - { m_x = x; m_y = y; m_width = w; m_height = h; } -/* - wxRect2DDouble(const wxPoint2DDouble& topLeft, const wxPoint2DDouble& bottomRight); - wxRect2DDouble(const wxPoint2DDouble& pos, const wxSize& size); - wxRect2DDouble(const wxRect2DDouble& rect); -*/ - // single attribute accessors - - inline wxPoint2DDouble GetPosition() - { return wxPoint2DDouble(m_x, m_y); } - inline wxSize GetSize() - { return wxSize((int) m_width, (int) m_height); } - - // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately - - inline wxDouble GetLeft() const { return m_x; } - inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } - inline void MoveLeftTo( wxDouble n ) { m_x = n; } - inline wxDouble GetTop() const { return m_y; } - inline void SetTop( wxDouble n ) { m_height += m_y - n; m_y = n; } - inline void MoveTopTo( wxDouble n ) { m_y = n; } - inline wxDouble GetBottom() const { return m_y + m_height; } - inline void SetBottom( wxDouble n ) { m_height += n - (m_y+m_height);} - inline void MoveBottomTo( wxDouble n ) { m_y = n - m_height; } - inline wxDouble GetRight() const { return m_x + m_width; } - inline void SetRight( wxDouble n ) { m_width += n - (m_x+m_width) ; } - inline void MoveRightTo( wxDouble n ) { m_x = n - m_width; } - - inline wxPoint2DDouble GetLeftTop() const - { return wxPoint2DDouble( m_x , m_y ); } - inline void SetLeftTop( const wxPoint2DDouble &pt ) - { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } - inline void MoveLeftTopTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x; m_y = pt.m_y; } - inline wxPoint2DDouble GetLeftBottom() const - { return wxPoint2DDouble( m_x , m_y + m_height ); } - inline void SetLeftBottom( const wxPoint2DDouble &pt ) - { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } - inline void MoveLeftBottomTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x; m_y = pt.m_y - m_height; } - inline wxPoint2DDouble GetRightTop() const - { return wxPoint2DDouble( m_x+m_width , m_y ); } - inline void SetRightTop( const wxPoint2DDouble &pt ) - { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } - inline void MoveRightTopTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x - m_width; m_y = pt.m_y; } - inline wxPoint2DDouble GetRightBottom() const - { return wxPoint2DDouble( m_x+m_width , m_y + m_height ); } - inline void SetRightBottom( const wxPoint2DDouble &pt ) - { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} - inline void MoveRightBottomTo( const wxPoint2DDouble &pt ) - { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } - inline wxPoint2DDouble GetCentre() const - { return wxPoint2DDouble( m_x+m_width/2 , m_y+m_height/2 ); } - inline void SetCentre( const wxPoint2DDouble &pt ) - { MoveCentreTo( pt ); } // since this is impossible without moving... - inline void MoveCentreTo( const wxPoint2DDouble &pt ) - { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); } - inline wxOutCode GetOutCode( const wxPoint2DDouble &pt ) const - { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + - ( ( pt.m_x > m_x + m_width ) ? wxOutRight : 0 ) + - ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + - ( ( pt.m_y > m_y + m_height ) ? wxOutBottom : 0 )); } - inline wxOutCode GetOutcode(const wxPoint2DDouble &pt) const - { return GetOutCode(pt) ; } - inline bool Contains( const wxPoint2DDouble &pt ) const - { return GetOutCode( pt ) == wxInside; } - inline bool Contains( const wxRect2DDouble &rect ) const - { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && - ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } - inline bool IsEmpty() const - { return m_width <= 0 || m_height <= 0; } - inline bool HaveEqualSize( const wxRect2DDouble &rect ) const - { return wxIsSameDouble(rect.m_width, m_width) && wxIsSameDouble(rect.m_height, m_height); } - - inline void Inset( wxDouble x , wxDouble y ) - { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } - inline void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom ) - { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} - inline void Offset( const wxPoint2DDouble &pt ) - { m_x += pt.m_x; m_y += pt.m_y; } - - void ConstrainTo( const wxRect2DDouble &rect ); - - inline wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) - { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } - - static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); - inline void Intersect( const wxRect2DDouble &otherRect ) - { Intersect( *this , otherRect , this ); } - inline wxRect2DDouble CreateIntersection( const wxRect2DDouble &otherRect ) const - { wxRect2DDouble result; Intersect( *this , otherRect , &result); return result; } - bool Intersects( const wxRect2DDouble &rect ) const; - - static void Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); - void Union( const wxRect2DDouble &otherRect ) - { Union( *this , otherRect , this ); } - void Union( const wxPoint2DDouble &pt ); - inline wxRect2DDouble CreateUnion( const wxRect2DDouble &otherRect ) const - { wxRect2DDouble result; Union( *this , otherRect , &result); return result; } - - inline void Scale( wxDouble f ) - { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} - inline void Scale( wxInt32 num , wxInt32 denum ) - { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum); - m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);} - - wxRect2DDouble& operator = (const wxRect2DDouble& rect); - inline bool operator == (const wxRect2DDouble& rect) const - { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); } - inline bool operator != (const wxRect2DDouble& rect) const - { return !(*this == rect); } - - wxDouble m_x; - wxDouble m_y; - wxDouble m_width; - wxDouble m_height; -}; - - -// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the -// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if -// left <= x < right and top <= m_y < bottom , thus it is a half open interval. - -class WXDLLEXPORT wxRect2DInt -{ -public: - wxRect2DInt() { m_x = m_y = m_width = m_height = 0; } - wxRect2DInt( const wxRect& r ) { m_x = r.x ; m_y = r.y ; m_width = r.width ; m_height = r.height ; } - wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; } - wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight); - inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size); - inline wxRect2DInt(const wxRect2DInt& rect); - - // single attribute accessors - - inline wxPoint2DInt GetPosition() { return wxPoint2DInt(m_x, m_y); } - inline wxSize GetSize() { return wxSize(m_width, m_height); } - - // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their - // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately - - inline wxInt32 GetLeft() const { return m_x; } - inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } - inline void MoveLeftTo( wxInt32 n ) { m_x = n; } - inline wxInt32 GetTop() const { return m_y; } - inline void SetTop( wxInt32 n ) { m_height += m_y - n; m_y = n; } - inline void MoveTopTo( wxInt32 n ) { m_y = n; } - inline wxInt32 GetBottom() const { return m_y + m_height; } - inline void SetBottom( wxInt32 n ) { m_height += n - (m_y+m_height);} - inline void MoveBottomTo( wxInt32 n ) { m_y = n - m_height; } - inline wxInt32 GetRight() const { return m_x + m_width; } - inline void SetRight( wxInt32 n ) { m_width += n - (m_x+m_width) ; } - inline void MoveRightTo( wxInt32 n ) { m_x = n - m_width; } - - inline wxPoint2DInt GetLeftTop() const { return wxPoint2DInt( m_x , m_y ); } - inline void SetLeftTop( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } - inline void MoveLeftTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; } - inline wxPoint2DInt GetLeftBottom() const { return wxPoint2DInt( m_x , m_y + m_height ); } - inline void SetLeftBottom( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } - inline void MoveLeftBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; } - inline wxPoint2DInt GetRightTop() const { return wxPoint2DInt( m_x+m_width , m_y ); } - inline void SetRightTop( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } - inline void MoveRightTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; } - inline wxPoint2DInt GetRightBottom() const { return wxPoint2DInt( m_x+m_width , m_y + m_height ); } - inline void SetRightBottom( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} - inline void MoveRightBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } - inline wxPoint2DInt GetCentre() const { return wxPoint2DInt( m_x+m_width/2 , m_y+m_height/2 ); } - inline void SetCentre( const wxPoint2DInt &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving... - inline void MoveCentreTo( const wxPoint2DInt &pt ) { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); } - inline wxOutCode GetOutCode( const wxPoint2DInt &pt ) const - { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + - ( ( pt.m_x >= m_x + m_width ) ? wxOutRight : 0 ) + - ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + - ( ( pt.m_y >= m_y + m_height ) ? wxOutBottom : 0 )); } - inline wxOutCode GetOutcode( const wxPoint2DInt &pt ) const - { return GetOutCode( pt ) ; } - inline bool Contains( const wxPoint2DInt &pt ) const - { return GetOutCode( pt ) == wxInside; } - inline bool Contains( const wxRect2DInt &rect ) const - { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && - ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } - inline bool IsEmpty() const - { return ( m_width <= 0 || m_height <= 0 ); } - inline bool HaveEqualSize( const wxRect2DInt &rect ) const - { return ( rect.m_width == m_width && rect.m_height == m_height ); } - - inline void Inset( wxInt32 x , wxInt32 y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } - inline void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ) - { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} - inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } - void ConstrainTo( const wxRect2DInt &rect ); - inline wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DInt( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } - - static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); - inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } - inline wxRect2DInt CreateIntersection( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Intersect( *this , otherRect , &result); return result; } - bool Intersects( const wxRect2DInt &rect ) const; - - static void Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); - void Union( const wxRect2DInt &otherRect ) { Union( *this , otherRect , this ); } - void Union( const wxPoint2DInt &pt ); - inline wxRect2DInt CreateUnion( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Union( *this , otherRect , &result); return result; } - - inline void Scale( wxInt32 f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} - inline void Scale( wxInt32 num , wxInt32 denum ) - { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum); - m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);} - - wxRect2DInt& operator = (const wxRect2DInt& rect); - bool operator == (const wxRect2DInt& rect) const; - bool operator != (const wxRect2DInt& rect) const; - -#if wxUSE_STREAMS - void WriteTo( wxDataOutputStream &stream ) const; - void ReadFrom( wxDataInputStream &stream ); -#endif // wxUSE_STREAMS - - wxInt32 m_x; - wxInt32 m_y; - wxInt32 m_width; - wxInt32 m_height; -}; - -inline wxRect2DInt::wxRect2DInt( const wxRect2DInt &r ) -{ - m_x = r.m_x; - m_y = r.m_y; - m_width = r.m_width; - m_height = r.m_height; -} - -inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b) -{ - m_x = wxMin( a.m_x , b.m_x ); - m_y = wxMin( a.m_y , b.m_y ); - m_width = abs( a.m_x - b.m_x ); - m_height = abs( a.m_y - b.m_y ); -} - -inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt& pos, const wxSize& size) -{ - m_x = pos.m_x; - m_y = pos.m_y; - m_width = size.x; - m_height = size.y; -} - -inline bool wxRect2DInt::operator == (const wxRect2DInt& rect) const -{ - return (m_x==rect.m_x && m_y==rect.m_y && - m_width==rect.m_width && m_height==rect.m_height); -} - -inline bool wxRect2DInt::operator != (const wxRect2DInt& rect) const -{ - return !(*this == rect); -} - -class wxTransform2D -{ -public : - virtual ~wxTransform2D() { } - virtual void Transform( wxPoint2DInt* pt )const = 0; - virtual void Transform( wxRect2DInt* r ) const; - virtual wxPoint2DInt Transform( const wxPoint2DInt &pt ) const; - virtual wxRect2DInt Transform( const wxRect2DInt &r ) const ; - - virtual void InverseTransform( wxPoint2DInt* pt ) const = 0; - virtual void InverseTransform( wxRect2DInt* r ) const ; - virtual wxPoint2DInt InverseTransform( const wxPoint2DInt &pt ) const ; - virtual wxRect2DInt InverseTransform( const wxRect2DInt &r ) const ; -}; - -inline void wxTransform2D::Transform( wxRect2DInt* r ) const - { wxPoint2DInt a = r->GetLeftTop() , b = r->GetRightBottom(); Transform( &a ); Transform( &b ); *r = wxRect2DInt( a , b ); } - -inline wxPoint2DInt wxTransform2D::Transform( const wxPoint2DInt &pt ) const - { wxPoint2DInt res = pt; Transform( &res ); return res; } - -inline wxRect2DInt wxTransform2D::Transform( const wxRect2DInt &r ) const - { wxRect2DInt res = r; Transform( &res ); return res; } - -inline void wxTransform2D::InverseTransform( wxRect2DInt* r ) const - { wxPoint2DInt a = r->GetLeftTop() , b = r->GetRightBottom(); InverseTransform( &a ); InverseTransform( &b ); *r = wxRect2DInt( a , b ); } - -inline wxPoint2DInt wxTransform2D::InverseTransform( const wxPoint2DInt &pt ) const - { wxPoint2DInt res = pt; InverseTransform( &res ); return res; } - -inline wxRect2DInt wxTransform2D::InverseTransform( const wxRect2DInt &r ) const - { wxRect2DInt res = r; InverseTransform( &res ); return res; } - - -#endif // wxUSE_GEOMETRY - -#endif // _WX_GEOMETRY_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/geometry.h +// Purpose: Common Geometry Classes +// Author: Stefan Csomor +// Modified by: +// Created: 08/05/99 +// RCS-ID: $Id: geometry.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GEOMETRY_H_ +#define _WX_GEOMETRY_H_ + +#include "wx/defs.h" + +#if wxUSE_GEOMETRY + +#include "wx/utils.h" +#include "wx/gdicmn.h" +#include "wx/math.h" + +class WXDLLIMPEXP_FWD_BASE wxDataInputStream; +class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; + +// clipping from Cohen-Sutherland + +enum wxOutCode +{ + wxInside = 0x00 , + wxOutLeft = 0x01 , + wxOutRight = 0x02 , + wxOutTop = 0x08 , + wxOutBottom = 0x04 +}; + +class WXDLLEXPORT wxPoint2DInt +{ +public : + inline wxPoint2DInt(); + inline wxPoint2DInt( wxInt32 x , wxInt32 y ); + inline wxPoint2DInt( const wxPoint2DInt &pt ); + inline wxPoint2DInt( const wxPoint &pt ); + + // noops for this class, just return the coords + inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; + inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; + + inline wxDouble GetVectorLength() const; + wxDouble GetVectorAngle() const; + inline void SetVectorLength( wxDouble length ); + void SetVectorAngle( wxDouble degrees ); + void SetPolarCoordinates( wxInt32 angle , wxInt32 length ); + // set the vector length to 1.0, preserving the angle + inline void Normalize(); + + inline wxDouble GetDistance( const wxPoint2DInt &pt ) const; + inline wxDouble GetDistanceSquare( const wxPoint2DInt &pt ) const; + inline wxInt32 GetDotProduct( const wxPoint2DInt &vec ) const; + inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; + + // the reflection of this point + inline wxPoint2DInt operator-(); + + inline wxPoint2DInt& operator=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator*=(wxDouble n); + inline wxPoint2DInt& operator*=(wxInt32 n); + inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator/=(wxDouble n); + inline wxPoint2DInt& operator/=(wxInt32 n); + inline operator wxPoint() const; + inline bool operator==(const wxPoint2DInt& pt) const; + inline bool operator!=(const wxPoint2DInt& pt) const; + +#if wxUSE_STREAMS + void WriteTo( wxDataOutputStream &stream ) const; + void ReadFrom( wxDataInputStream &stream ); +#endif // wxUSE_STREAMS + + wxInt32 m_x; + wxInt32 m_y; +}; + +inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); + +inline wxPoint2DInt::wxPoint2DInt() +{ + m_x = 0; + m_y = 0; +} + +inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y ) +{ + m_x = x; + m_y = y; +} + +inline wxPoint2DInt::wxPoint2DInt( const wxPoint2DInt &pt ) +{ + m_x = pt.m_x; + m_y = pt.m_y; +} + +inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt ) +{ + m_x = pt.x; + m_y = pt.y; +} + +inline void wxPoint2DInt::GetFloor( wxInt32 *x , wxInt32 *y ) const +{ + if ( x ) + *x = m_x; + if ( y ) + *y = m_y; +} + +inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const +{ + GetFloor(x, y); +} + +inline wxDouble wxPoint2DInt::GetVectorLength() const +{ + // cast needed MIPSpro compiler under SGI + return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) ); +} + +inline void wxPoint2DInt::SetVectorLength( wxDouble length ) +{ + wxDouble before = GetVectorLength(); + m_x = (wxInt32)(m_x * length / before); + m_y = (wxInt32)(m_y * length / before); +} + +inline void wxPoint2DInt::Normalize() +{ + SetVectorLength( 1 ); +} + +inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const +{ + return sqrt( GetDistanceSquare( pt ) ); +} + +inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const +{ + return ( (wxDouble)(pt.m_x-m_x)*(pt.m_x-m_x) + (wxDouble)(pt.m_y-m_y)*(pt.m_y-m_y) ); +} + +inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const +{ + return ( m_x * vec.m_x + m_y * vec.m_y ); +} + +inline wxInt32 wxPoint2DInt::GetCrossProduct( const wxPoint2DInt &vec ) const +{ + return ( m_x * vec.m_y - vec.m_x * m_y ); +} + +inline wxPoint2DInt::operator wxPoint() const +{ + return wxPoint( m_x, m_y); +} + +inline wxPoint2DInt wxPoint2DInt::operator-() +{ + return wxPoint2DInt( -m_x, -m_y); +} + +inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) +{ + m_x = pt.m_x; + m_y = pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt) +{ + m_x = m_x + pt.m_x; + m_y = m_y + pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt) +{ + m_x = m_x - pt.m_x; + m_y = m_y - pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt) +{ + m_x = m_x + pt.m_x; + m_y = m_y + pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt) +{ + m_x = m_x - pt.m_x; + m_y = m_y - pt.m_y; + return *this; +} + +inline bool wxPoint2DInt::operator==(const wxPoint2DInt& pt) const +{ + return m_x == pt.m_x && m_y == pt.m_y; +} + +inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const +{ + return m_x != pt.m_x || m_y != pt.m_y; +} + +inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); +} + +inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); +} + + +inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); +} + +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt) +{ + return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt) +{ + return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); +} + +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) +{ + return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n) +{ + return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); +} + +inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); +} + +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n) +{ + return wxPoint2DInt( pt.m_x / n , pt.m_y / n ); +} + +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) +{ + return wxPoint2DInt( (int) (pt.m_x / n) , (int) (pt.m_y / n) ); +} + +// wxPoint2Ds represent a point or a vector in a 2d coordinate system + +class WXDLLEXPORT wxPoint2DDouble +{ +public : + inline wxPoint2DDouble(); + inline wxPoint2DDouble( wxDouble x , wxDouble y ); + inline wxPoint2DDouble( const wxPoint2DDouble &pt ); + wxPoint2DDouble( const wxPoint2DInt &pt ) + { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; } + wxPoint2DDouble( const wxPoint &pt ) + { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; } + + // two different conversions to integers, floor and rounding + inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; + inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; + + inline wxDouble GetVectorLength() const; + wxDouble GetVectorAngle() const ; + void SetVectorLength( wxDouble length ); + void SetVectorAngle( wxDouble degrees ); + void SetPolarCoordinates( wxDouble angle , wxDouble length ); + // set the vector length to 1.0, preserving the angle + void Normalize(); + + inline wxDouble GetDistance( const wxPoint2DDouble &pt ) const; + inline wxDouble GetDistanceSquare( const wxPoint2DDouble &pt ) const; + inline wxDouble GetDotProduct( const wxPoint2DDouble &vec ) const; + inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; + + // the reflection of this point + inline wxPoint2DDouble operator-(); + + inline wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator*=(wxDouble n); + inline wxPoint2DDouble& operator*=(wxInt32 n); + inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator/=(wxDouble n); + inline wxPoint2DDouble& operator/=(wxInt32 n); + + inline bool operator==(const wxPoint2DDouble& pt) const; + inline bool operator!=(const wxPoint2DDouble& pt) const; + + wxDouble m_x; + wxDouble m_y; +}; + +inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt); +inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt); +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n); +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n); +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n); +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n); + +inline wxPoint2DDouble::wxPoint2DDouble() +{ + m_x = 0.0; + m_y = 0.0; +} + +inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y ) +{ + m_x = x; + m_y = y; +} + +inline wxPoint2DDouble::wxPoint2DDouble( const wxPoint2DDouble &pt ) +{ + m_x = pt.m_x; + m_y = pt.m_y; +} + +inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const +{ + *x = (wxInt32) floor( m_x ); + *y = (wxInt32) floor( m_y ); +} + +inline void wxPoint2DDouble::GetRounded( wxInt32 *x , wxInt32 *y ) const +{ + *x = (wxInt32) floor( m_x + 0.5 ); + *y = (wxInt32) floor( m_y + 0.5); +} + +inline wxDouble wxPoint2DDouble::GetVectorLength() const +{ + return sqrt( (m_x)*(m_x) + (m_y)*(m_y) ) ; +} + +inline void wxPoint2DDouble::SetVectorLength( wxDouble length ) +{ + wxDouble before = GetVectorLength() ; + m_x = (m_x * length / before) ; + m_y = (m_y * length / before) ; +} + +inline void wxPoint2DDouble::Normalize() +{ + SetVectorLength( 1 ); +} + +inline wxDouble wxPoint2DDouble::GetDistance( const wxPoint2DDouble &pt ) const +{ + return sqrt( GetDistanceSquare( pt ) ); +} + +inline wxDouble wxPoint2DDouble::GetDistanceSquare( const wxPoint2DDouble &pt ) const +{ + return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); +} + +inline wxDouble wxPoint2DDouble::GetDotProduct( const wxPoint2DDouble &vec ) const +{ + return ( m_x * vec.m_x + m_y * vec.m_y ); +} + +inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) const +{ + return ( m_x * vec.m_y - vec.m_x * m_y ); +} + +inline wxPoint2DDouble wxPoint2DDouble::operator-() +{ + return wxPoint2DDouble( -m_x, -m_y); +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) +{ + m_x = pt.m_x; + m_y = pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt) +{ + m_x = m_x + pt.m_x; + m_y = m_y + pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt) +{ + m_x = m_x - pt.m_x; + m_y = m_y - pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt) +{ + m_x = m_x * pt.m_x; + m_y = m_y * pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt) +{ + m_x = m_x / pt.m_x; + m_y = m_y / pt.m_y; + return *this; +} + +inline bool wxPoint2DDouble::operator==(const wxPoint2DDouble& pt) const +{ + return wxIsSameDouble(m_x, pt.m_x) && wxIsSameDouble(m_y, pt.m_y); +} + +inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const +{ + return !(*this == pt); +} + +inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); +} + +inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); +} + + +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); +} + +inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); +} + +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n) +{ + return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); +} + +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n) +{ + return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); +} + +// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the +// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if +// left <= x < right and top <= m_y < bottom , thus it is a half open interval. + +class WXDLLEXPORT wxRect2DDouble +{ +public: + wxRect2DDouble() + { m_x = m_y = m_width = m_height = 0; } + wxRect2DDouble(wxDouble x, wxDouble y, wxDouble w, wxDouble h) + { m_x = x; m_y = y; m_width = w; m_height = h; } +/* + wxRect2DDouble(const wxPoint2DDouble& topLeft, const wxPoint2DDouble& bottomRight); + wxRect2DDouble(const wxPoint2DDouble& pos, const wxSize& size); + wxRect2DDouble(const wxRect2DDouble& rect); +*/ + // single attribute accessors + + inline wxPoint2DDouble GetPosition() + { return wxPoint2DDouble(m_x, m_y); } + inline wxSize GetSize() + { return wxSize((int) m_width, (int) m_height); } + + // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately + + inline wxDouble GetLeft() const { return m_x; } + inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } + inline void MoveLeftTo( wxDouble n ) { m_x = n; } + inline wxDouble GetTop() const { return m_y; } + inline void SetTop( wxDouble n ) { m_height += m_y - n; m_y = n; } + inline void MoveTopTo( wxDouble n ) { m_y = n; } + inline wxDouble GetBottom() const { return m_y + m_height; } + inline void SetBottom( wxDouble n ) { m_height += n - (m_y+m_height);} + inline void MoveBottomTo( wxDouble n ) { m_y = n - m_height; } + inline wxDouble GetRight() const { return m_x + m_width; } + inline void SetRight( wxDouble n ) { m_width += n - (m_x+m_width) ; } + inline void MoveRightTo( wxDouble n ) { m_x = n - m_width; } + + inline wxPoint2DDouble GetLeftTop() const + { return wxPoint2DDouble( m_x , m_y ); } + inline void SetLeftTop( const wxPoint2DDouble &pt ) + { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } + inline void MoveLeftTopTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x; m_y = pt.m_y; } + inline wxPoint2DDouble GetLeftBottom() const + { return wxPoint2DDouble( m_x , m_y + m_height ); } + inline void SetLeftBottom( const wxPoint2DDouble &pt ) + { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } + inline void MoveLeftBottomTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x; m_y = pt.m_y - m_height; } + inline wxPoint2DDouble GetRightTop() const + { return wxPoint2DDouble( m_x+m_width , m_y ); } + inline void SetRightTop( const wxPoint2DDouble &pt ) + { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } + inline void MoveRightTopTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x - m_width; m_y = pt.m_y; } + inline wxPoint2DDouble GetRightBottom() const + { return wxPoint2DDouble( m_x+m_width , m_y + m_height ); } + inline void SetRightBottom( const wxPoint2DDouble &pt ) + { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} + inline void MoveRightBottomTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } + inline wxPoint2DDouble GetCentre() const + { return wxPoint2DDouble( m_x+m_width/2 , m_y+m_height/2 ); } + inline void SetCentre( const wxPoint2DDouble &pt ) + { MoveCentreTo( pt ); } // since this is impossible without moving... + inline void MoveCentreTo( const wxPoint2DDouble &pt ) + { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); } + inline wxOutCode GetOutCode( const wxPoint2DDouble &pt ) const + { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + + ( ( pt.m_x > m_x + m_width ) ? wxOutRight : 0 ) + + ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + + ( ( pt.m_y > m_y + m_height ) ? wxOutBottom : 0 )); } + inline wxOutCode GetOutcode(const wxPoint2DDouble &pt) const + { return GetOutCode(pt) ; } + inline bool Contains( const wxPoint2DDouble &pt ) const + { return GetOutCode( pt ) == wxInside; } + inline bool Contains( const wxRect2DDouble &rect ) const + { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && + ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } + inline bool IsEmpty() const + { return m_width <= 0 || m_height <= 0; } + inline bool HaveEqualSize( const wxRect2DDouble &rect ) const + { return wxIsSameDouble(rect.m_width, m_width) && wxIsSameDouble(rect.m_height, m_height); } + + inline void Inset( wxDouble x , wxDouble y ) + { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } + inline void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom ) + { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} + inline void Offset( const wxPoint2DDouble &pt ) + { m_x += pt.m_x; m_y += pt.m_y; } + + void ConstrainTo( const wxRect2DDouble &rect ); + + inline wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) + { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } + + static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); + inline void Intersect( const wxRect2DDouble &otherRect ) + { Intersect( *this , otherRect , this ); } + inline wxRect2DDouble CreateIntersection( const wxRect2DDouble &otherRect ) const + { wxRect2DDouble result; Intersect( *this , otherRect , &result); return result; } + bool Intersects( const wxRect2DDouble &rect ) const; + + static void Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); + void Union( const wxRect2DDouble &otherRect ) + { Union( *this , otherRect , this ); } + void Union( const wxPoint2DDouble &pt ); + inline wxRect2DDouble CreateUnion( const wxRect2DDouble &otherRect ) const + { wxRect2DDouble result; Union( *this , otherRect , &result); return result; } + + inline void Scale( wxDouble f ) + { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} + inline void Scale( wxInt32 num , wxInt32 denum ) + { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum); + m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);} + + wxRect2DDouble& operator = (const wxRect2DDouble& rect); + inline bool operator == (const wxRect2DDouble& rect) const + { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); } + inline bool operator != (const wxRect2DDouble& rect) const + { return !(*this == rect); } + + wxDouble m_x; + wxDouble m_y; + wxDouble m_width; + wxDouble m_height; +}; + + +// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the +// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if +// left <= x < right and top <= m_y < bottom , thus it is a half open interval. + +class WXDLLEXPORT wxRect2DInt +{ +public: + wxRect2DInt() { m_x = m_y = m_width = m_height = 0; } + wxRect2DInt( const wxRect& r ) { m_x = r.x ; m_y = r.y ; m_width = r.width ; m_height = r.height ; } + wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; } + wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight); + inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size); + inline wxRect2DInt(const wxRect2DInt& rect); + + // single attribute accessors + + inline wxPoint2DInt GetPosition() { return wxPoint2DInt(m_x, m_y); } + inline wxSize GetSize() { return wxSize(m_width, m_height); } + + // for the edge and corner accessors there are two setters conterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners apropriately + + inline wxInt32 GetLeft() const { return m_x; } + inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } + inline void MoveLeftTo( wxInt32 n ) { m_x = n; } + inline wxInt32 GetTop() const { return m_y; } + inline void SetTop( wxInt32 n ) { m_height += m_y - n; m_y = n; } + inline void MoveTopTo( wxInt32 n ) { m_y = n; } + inline wxInt32 GetBottom() const { return m_y + m_height; } + inline void SetBottom( wxInt32 n ) { m_height += n - (m_y+m_height);} + inline void MoveBottomTo( wxInt32 n ) { m_y = n - m_height; } + inline wxInt32 GetRight() const { return m_x + m_width; } + inline void SetRight( wxInt32 n ) { m_width += n - (m_x+m_width) ; } + inline void MoveRightTo( wxInt32 n ) { m_x = n - m_width; } + + inline wxPoint2DInt GetLeftTop() const { return wxPoint2DInt( m_x , m_y ); } + inline void SetLeftTop( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } + inline void MoveLeftTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; } + inline wxPoint2DInt GetLeftBottom() const { return wxPoint2DInt( m_x , m_y + m_height ); } + inline void SetLeftBottom( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } + inline void MoveLeftBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; } + inline wxPoint2DInt GetRightTop() const { return wxPoint2DInt( m_x+m_width , m_y ); } + inline void SetRightTop( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } + inline void MoveRightTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; } + inline wxPoint2DInt GetRightBottom() const { return wxPoint2DInt( m_x+m_width , m_y + m_height ); } + inline void SetRightBottom( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} + inline void MoveRightBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } + inline wxPoint2DInt GetCentre() const { return wxPoint2DInt( m_x+m_width/2 , m_y+m_height/2 ); } + inline void SetCentre( const wxPoint2DInt &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving... + inline void MoveCentreTo( const wxPoint2DInt &pt ) { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); } + inline wxOutCode GetOutCode( const wxPoint2DInt &pt ) const + { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + + ( ( pt.m_x >= m_x + m_width ) ? wxOutRight : 0 ) + + ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + + ( ( pt.m_y >= m_y + m_height ) ? wxOutBottom : 0 )); } + inline wxOutCode GetOutcode( const wxPoint2DInt &pt ) const + { return GetOutCode( pt ) ; } + inline bool Contains( const wxPoint2DInt &pt ) const + { return GetOutCode( pt ) == wxInside; } + inline bool Contains( const wxRect2DInt &rect ) const + { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && + ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } + inline bool IsEmpty() const + { return ( m_width <= 0 || m_height <= 0 ); } + inline bool HaveEqualSize( const wxRect2DInt &rect ) const + { return ( rect.m_width == m_width && rect.m_height == m_height ); } + + inline void Inset( wxInt32 x , wxInt32 y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } + inline void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ) + { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} + inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } + void ConstrainTo( const wxRect2DInt &rect ); + inline wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DInt( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } + + static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); + inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } + inline wxRect2DInt CreateIntersection( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Intersect( *this , otherRect , &result); return result; } + bool Intersects( const wxRect2DInt &rect ) const; + + static void Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); + void Union( const wxRect2DInt &otherRect ) { Union( *this , otherRect , this ); } + void Union( const wxPoint2DInt &pt ); + inline wxRect2DInt CreateUnion( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Union( *this , otherRect , &result); return result; } + + inline void Scale( wxInt32 f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} + inline void Scale( wxInt32 num , wxInt32 denum ) + { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum); + m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);} + + wxRect2DInt& operator = (const wxRect2DInt& rect); + bool operator == (const wxRect2DInt& rect) const; + bool operator != (const wxRect2DInt& rect) const; + +#if wxUSE_STREAMS + void WriteTo( wxDataOutputStream &stream ) const; + void ReadFrom( wxDataInputStream &stream ); +#endif // wxUSE_STREAMS + + wxInt32 m_x; + wxInt32 m_y; + wxInt32 m_width; + wxInt32 m_height; +}; + +inline wxRect2DInt::wxRect2DInt( const wxRect2DInt &r ) +{ + m_x = r.m_x; + m_y = r.m_y; + m_width = r.m_width; + m_height = r.m_height; +} + +inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b) +{ + m_x = wxMin( a.m_x , b.m_x ); + m_y = wxMin( a.m_y , b.m_y ); + m_width = abs( a.m_x - b.m_x ); + m_height = abs( a.m_y - b.m_y ); +} + +inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt& pos, const wxSize& size) +{ + m_x = pos.m_x; + m_y = pos.m_y; + m_width = size.x; + m_height = size.y; +} + +inline bool wxRect2DInt::operator == (const wxRect2DInt& rect) const +{ + return (m_x==rect.m_x && m_y==rect.m_y && + m_width==rect.m_width && m_height==rect.m_height); +} + +inline bool wxRect2DInt::operator != (const wxRect2DInt& rect) const +{ + return !(*this == rect); +} + +class wxTransform2D +{ +public : + virtual ~wxTransform2D() { } + virtual void Transform( wxPoint2DInt* pt )const = 0; + virtual void Transform( wxRect2DInt* r ) const; + virtual wxPoint2DInt Transform( const wxPoint2DInt &pt ) const; + virtual wxRect2DInt Transform( const wxRect2DInt &r ) const ; + + virtual void InverseTransform( wxPoint2DInt* pt ) const = 0; + virtual void InverseTransform( wxRect2DInt* r ) const ; + virtual wxPoint2DInt InverseTransform( const wxPoint2DInt &pt ) const ; + virtual wxRect2DInt InverseTransform( const wxRect2DInt &r ) const ; +}; + +inline void wxTransform2D::Transform( wxRect2DInt* r ) const + { wxPoint2DInt a = r->GetLeftTop() , b = r->GetRightBottom(); Transform( &a ); Transform( &b ); *r = wxRect2DInt( a , b ); } + +inline wxPoint2DInt wxTransform2D::Transform( const wxPoint2DInt &pt ) const + { wxPoint2DInt res = pt; Transform( &res ); return res; } + +inline wxRect2DInt wxTransform2D::Transform( const wxRect2DInt &r ) const + { wxRect2DInt res = r; Transform( &res ); return res; } + +inline void wxTransform2D::InverseTransform( wxRect2DInt* r ) const + { wxPoint2DInt a = r->GetLeftTop() , b = r->GetRightBottom(); InverseTransform( &a ); InverseTransform( &b ); *r = wxRect2DInt( a , b ); } + +inline wxPoint2DInt wxTransform2D::InverseTransform( const wxPoint2DInt &pt ) const + { wxPoint2DInt res = pt; InverseTransform( &res ); return res; } + +inline wxRect2DInt wxTransform2D::InverseTransform( const wxRect2DInt &r ) const + { wxRect2DInt res = r; InverseTransform( &res ); return res; } + + +#endif // wxUSE_GEOMETRY + +#endif // _WX_GEOMETRY_H_ diff --git a/Externals/wxWidgets/include/wx/gifdecod.h b/Externals/wxWidgets/include/wx/gifdecod.h index 3ada1a19d8..7760d4759d 100644 --- a/Externals/wxWidgets/include/wx/gifdecod.h +++ b/Externals/wxWidgets/include/wx/gifdecod.h @@ -1,110 +1,110 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/gifdecod.h -// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation -// Author: Guillermo Rodriguez Garcia -// Version: 3.02 -// CVS-ID: $Id: gifdecod.h 45563 2007-04-21 18:17:50Z VZ $ -// Copyright: (c) 1999 Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GIFDECOD_H_ -#define _WX_GIFDECOD_H_ - -#include "wx/defs.h" - -#if wxUSE_STREAMS && wxUSE_GIF - -#include "wx/stream.h" -#include "wx/image.h" -#include "wx/animdecod.h" -#include "wx/dynarray.h" - -// internal utility used to store a frame in 8bit-per-pixel format -class GIFImage; - - -// -------------------------------------------------------------------------- -// Constants -// -------------------------------------------------------------------------- - -// Error codes: -// Note that the error code wxGIF_TRUNCATED means that the image itself -// is most probably OK, but the decoder didn't reach the end of the data -// stream; this means that if it was not reading directly from file, -// the stream will not be correctly positioned. -// -enum wxGIFErrorCode -{ - wxGIF_OK = 0, // everything was OK - wxGIF_INVFORMAT, // error in GIF header - wxGIF_MEMERR, // error allocating memory - wxGIF_TRUNCATED // file appears to be truncated -}; - -// -------------------------------------------------------------------------- -// wxGIFDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxGIFDecoder : public wxAnimationDecoder -{ -public: - // constructor, destructor, etc. - wxGIFDecoder(); - ~wxGIFDecoder(); - - // get data of current frame - unsigned char* GetData(unsigned int frame) const; - unsigned char* GetPalette(unsigned int frame) const; - unsigned int GetNcolours(unsigned int frame) const; - int GetTransparentColourIndex(unsigned int frame) const; - wxColour GetTransparentColour(unsigned int frame) const; - - virtual wxSize GetFrameSize(unsigned int frame) const; - virtual wxPoint GetFramePosition(unsigned int frame) const; - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - virtual long GetDelay(unsigned int frame) const; - - // GIFs can contain both static images and animations - bool IsAnimation() const - { return m_nFrames > 1; } - - // load function which returns more info than just Load(): - wxGIFErrorCode LoadGIF( wxInputStream& stream ); - - // free all internal frames - void Destroy(); - - // implementation of wxAnimationDecoder's pure virtuals - virtual bool CanRead( wxInputStream& stream ) const; - virtual bool Load( wxInputStream& stream ) - { return LoadGIF(stream) == wxGIF_OK; } - - bool ConvertToImage(unsigned int frame, wxImage *image) const; - - wxAnimationDecoder *Clone() const - { return new wxGIFDecoder; } - wxAnimationType GetType() const - { return wxANIMATION_TYPE_GIF; } - -private: - // array of all frames - wxArrayPtrVoid m_frames; - - // decoder state vars - int m_restbits; // remaining valid bits - unsigned int m_restbyte; // remaining bytes in this block - unsigned int m_lastbyte; // last byte read - unsigned char m_buffer[256]; // buffer for reading - unsigned char *m_bufp; // pointer to next byte in buffer - - int getcode(wxInputStream& stream, int bits, int abfin); - wxGIFErrorCode dgif(wxInputStream& stream, - GIFImage *img, int interl, int bits); - - DECLARE_NO_COPY_CLASS(wxGIFDecoder) -}; - -#endif // wxUSE_STREAM && wxUSE_GIF - -#endif // _WX_GIFDECOD_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gifdecod.h +// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation +// Author: Guillermo Rodriguez Garcia +// Version: 3.02 +// CVS-ID: $Id: gifdecod.h 45563 2007-04-21 18:17:50Z VZ $ +// Copyright: (c) 1999 Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GIFDECOD_H_ +#define _WX_GIFDECOD_H_ + +#include "wx/defs.h" + +#if wxUSE_STREAMS && wxUSE_GIF + +#include "wx/stream.h" +#include "wx/image.h" +#include "wx/animdecod.h" +#include "wx/dynarray.h" + +// internal utility used to store a frame in 8bit-per-pixel format +class GIFImage; + + +// -------------------------------------------------------------------------- +// Constants +// -------------------------------------------------------------------------- + +// Error codes: +// Note that the error code wxGIF_TRUNCATED means that the image itself +// is most probably OK, but the decoder didn't reach the end of the data +// stream; this means that if it was not reading directly from file, +// the stream will not be correctly positioned. +// +enum wxGIFErrorCode +{ + wxGIF_OK = 0, // everything was OK + wxGIF_INVFORMAT, // error in GIF header + wxGIF_MEMERR, // error allocating memory + wxGIF_TRUNCATED // file appears to be truncated +}; + +// -------------------------------------------------------------------------- +// wxGIFDecoder class +// -------------------------------------------------------------------------- + +class WXDLLEXPORT wxGIFDecoder : public wxAnimationDecoder +{ +public: + // constructor, destructor, etc. + wxGIFDecoder(); + ~wxGIFDecoder(); + + // get data of current frame + unsigned char* GetData(unsigned int frame) const; + unsigned char* GetPalette(unsigned int frame) const; + unsigned int GetNcolours(unsigned int frame) const; + int GetTransparentColourIndex(unsigned int frame) const; + wxColour GetTransparentColour(unsigned int frame) const; + + virtual wxSize GetFrameSize(unsigned int frame) const; + virtual wxPoint GetFramePosition(unsigned int frame) const; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; + virtual long GetDelay(unsigned int frame) const; + + // GIFs can contain both static images and animations + bool IsAnimation() const + { return m_nFrames > 1; } + + // load function which returns more info than just Load(): + wxGIFErrorCode LoadGIF( wxInputStream& stream ); + + // free all internal frames + void Destroy(); + + // implementation of wxAnimationDecoder's pure virtuals + virtual bool CanRead( wxInputStream& stream ) const; + virtual bool Load( wxInputStream& stream ) + { return LoadGIF(stream) == wxGIF_OK; } + + bool ConvertToImage(unsigned int frame, wxImage *image) const; + + wxAnimationDecoder *Clone() const + { return new wxGIFDecoder; } + wxAnimationType GetType() const + { return wxANIMATION_TYPE_GIF; } + +private: + // array of all frames + wxArrayPtrVoid m_frames; + + // decoder state vars + int m_restbits; // remaining valid bits + unsigned int m_restbyte; // remaining bytes in this block + unsigned int m_lastbyte; // last byte read + unsigned char m_buffer[256]; // buffer for reading + unsigned char *m_bufp; // pointer to next byte in buffer + + int getcode(wxInputStream& stream, int bits, int abfin); + wxGIFErrorCode dgif(wxInputStream& stream, + GIFImage *img, int interl, int bits); + + DECLARE_NO_COPY_CLASS(wxGIFDecoder) +}; + +#endif // wxUSE_STREAM && wxUSE_GIF + +#endif // _WX_GIFDECOD_H_ diff --git a/Externals/wxWidgets/include/wx/glcanvas.h b/Externals/wxWidgets/include/wx/glcanvas.h index 29d9074423..25e2eac0b5 100644 --- a/Externals/wxWidgets/include/wx/glcanvas.h +++ b/Externals/wxWidgets/include/wx/glcanvas.h @@ -1,86 +1,86 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/glcanvas.h -// Purpose: wxGLCanvas base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: glcanvas.h 43623 2006-11-24 10:30:42Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GLCANVAS_H_BASE_ -#define _WX_GLCANVAS_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_GLCANVAS - -//--------------------------------------------------------------------------- -// Constants for attriblist -//--------------------------------------------------------------------------- - -// The generic GL implementation doesn't support most of these options, -// such as stereo, auxiliary buffers, alpha channel, and accum buffer. -// Other implementations may actually support them. - -enum -{ - WX_GL_RGBA=1, /* use true color palette */ - WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */ - WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */ - WX_GL_DOUBLEBUFFER, /* use doublebuffer */ - WX_GL_STEREO, /* use stereoscopic display */ - WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */ - WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */ - WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */ - WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */ - WX_GL_MIN_ALPHA, /* use alpha buffer with most bits (> MIN_ALPHA bits) */ - WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */ - WX_GL_STENCIL_SIZE, /* bits for stencil buffer */ - WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */ - WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */ - WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */ - WX_GL_MIN_ACCUM_ALPHA /* use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits) */ -}; - -#define wxGLCanvasName _T("GLCanvas") - -#if defined(__WXMSW__) -#include "wx/msw/glcanvas.h" -#elif defined(__WXMOTIF__) -#include "wx/x11/glcanvas.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/glcanvas.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/glcanvas.h" -#elif defined(__WXX11__) -#include "wx/x11/glcanvas.h" -#elif defined(__WXMAC__) -#include "wx/mac/glcanvas.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/glcanvas.h" -#else -#error "wxGLCanvas not supported in this wxWidgets port" -#endif - -#include "wx/app.h" -class WXDLLIMPEXP_GL wxGLApp : public wxApp -{ -public: - wxGLApp() : wxApp() { } - virtual ~wxGLApp(); - - // use this in the constructor of the user-derived wxGLApp class to - // determine if an OpenGL rendering context with these attributes - // is available - returns true if so, false if not. - bool InitGLVisual(int *attribList); - -private: - DECLARE_DYNAMIC_CLASS(wxGLApp) -}; - -#endif - // wxUSE_GLCANVAS -#endif - // _WX_GLCANVAS_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/glcanvas.h +// Purpose: wxGLCanvas base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: glcanvas.h 43623 2006-11-24 10:30:42Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_BASE_ +#define _WX_GLCANVAS_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_GLCANVAS + +//--------------------------------------------------------------------------- +// Constants for attriblist +//--------------------------------------------------------------------------- + +// The generic GL implementation doesn't support most of these options, +// such as stereo, auxiliary buffers, alpha channel, and accum buffer. +// Other implementations may actually support them. + +enum +{ + WX_GL_RGBA=1, /* use true color palette */ + WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */ + WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */ + WX_GL_DOUBLEBUFFER, /* use doublebuffer */ + WX_GL_STEREO, /* use stereoscopic display */ + WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */ + WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */ + WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */ + WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */ + WX_GL_MIN_ALPHA, /* use alpha buffer with most bits (> MIN_ALPHA bits) */ + WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */ + WX_GL_STENCIL_SIZE, /* bits for stencil buffer */ + WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */ + WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */ + WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */ + WX_GL_MIN_ACCUM_ALPHA /* use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits) */ +}; + +#define wxGLCanvasName _T("GLCanvas") + +#if defined(__WXMSW__) +#include "wx/msw/glcanvas.h" +#elif defined(__WXMOTIF__) +#include "wx/x11/glcanvas.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/glcanvas.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/glcanvas.h" +#elif defined(__WXX11__) +#include "wx/x11/glcanvas.h" +#elif defined(__WXMAC__) +#include "wx/mac/glcanvas.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/glcanvas.h" +#else +#error "wxGLCanvas not supported in this wxWidgets port" +#endif + +#include "wx/app.h" +class WXDLLIMPEXP_GL wxGLApp : public wxApp +{ +public: + wxGLApp() : wxApp() { } + virtual ~wxGLApp(); + + // use this in the constructor of the user-derived wxGLApp class to + // determine if an OpenGL rendering context with these attributes + // is available - returns true if so, false if not. + bool InitGLVisual(int *attribList); + +private: + DECLARE_DYNAMIC_CLASS(wxGLApp) +}; + +#endif + // wxUSE_GLCANVAS +#endif + // _WX_GLCANVAS_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/graphics.h b/Externals/wxWidgets/include/wx/graphics.h index 0b445cb2e3..832a2123fe 100644 --- a/Externals/wxWidgets/include/wx/graphics.h +++ b/Externals/wxWidgets/include/wx/graphics.h @@ -1,676 +1,676 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/graphics.h -// Purpose: graphics context header -// Author: Stefan Csomor -// Modified by: -// Created: -// Copyright: (c) Stefan Csomor -// RCS-ID: $Id: graphics.h 50671 2007-12-12 20:19:36Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GRAPHICS_H_ -#define _WX_GRAPHICS_H_ - -#include "wx/defs.h" - -#if wxUSE_GRAPHICS_CONTEXT - -#include "wx/geometry.h" -#include "wx/dynarray.h" - -class WXDLLIMPEXP_CORE wxWindowDC; -class WXDLLIMPEXP_CORE wxMemoryDC; -class WXDLLIMPEXP_CORE wxGraphicsContext; -class WXDLLIMPEXP_CORE wxGraphicsPath; -class WXDLLIMPEXP_CORE wxGraphicsMatrix; -class WXDLLIMPEXP_CORE wxGraphicsFigure; -class WXDLLIMPEXP_CORE wxGraphicsRenderer; -class WXDLLIMPEXP_CORE wxGraphicsPen; -class WXDLLIMPEXP_CORE wxGraphicsBrush; -class WXDLLIMPEXP_CORE wxGraphicsFont; - -/* - * notes about the graphics context apis - * - * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being - * in direction of positive y axis. - */ - -// Base class of all objects used for drawing in the new graphics API, the always point back to their -// originating rendering engine, there is no dynamic unloading of a renderer currently allowed, -// these references are not counted - -// -// The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive -// duplication. Any operation on a shared instance that results in a modified state, uncouples this -// instance from the other instances that were shared - using copy on write semantics -// - -class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData -{ -public : - wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); - wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); - wxGraphicsRenderer* GetRenderer() const ; - virtual wxGraphicsObjectRefData* Clone() const ; - -protected : - wxGraphicsRenderer* m_renderer; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject -{ -public : - wxGraphicsObject() ; - wxGraphicsObject( wxGraphicsRenderer* renderer ) ; - virtual ~wxGraphicsObject() ; - - bool IsNull() const ; - - // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet - wxGraphicsRenderer* GetRenderer() const ; - wxGraphicsObjectRefData* GetGraphicsData() const ; -protected : - virtual wxObjectRefData* CreateRefData() const; - virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; - - DECLARE_DYNAMIC_CLASS(wxGraphicsObject) -} ; - -class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject -{ -public : - wxGraphicsPen() {} - virtual ~wxGraphicsPen() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsPen) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsPen) wxNullGraphicsPen; - -class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject -{ -public : - wxGraphicsBrush() {} - virtual ~wxGraphicsBrush() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsBrush) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsBrush) wxNullGraphicsBrush; - -class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject -{ -public : - wxGraphicsFont() {} - virtual ~wxGraphicsFont() {} -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsFont) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsFont) wxNullGraphicsFont; - - -class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : - wxGraphicsObjectRefData(renderer) {} - - virtual ~wxGraphicsMatrixData() {} - - // concatenates the matrix - virtual void Concat( const wxGraphicsMatrixData *t ) = 0; - - // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) = 0; - - // gets the component valuess of the matrix - virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; - - // makes this the inverse matrix - virtual void Invert() = 0; - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; - - // return true if this is the identity matrix - virtual bool IsIdentity() const = 0; - - // - // transformation - // - - // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ) = 0; - - // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; - - // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ) = 0; - - // - // apply the transforms - // - - // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; - - // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; - - // returns the native representation - virtual void * GetNativeMatrix() const = 0; -} ; - -class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject -{ -public : - wxGraphicsMatrix() {} - - virtual ~wxGraphicsMatrix() {} - - // concatenates the matrix - virtual void Concat( const wxGraphicsMatrix *t ); - void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); } - - // sets the matrix to the respective values - virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); - - // gets the component valuess of the matrix - virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; - - // makes this the inverse matrix - virtual void Invert(); - - // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrix* t) const; - bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); } - - // return true if this is the identity matrix - virtual bool IsIdentity() const; - - // - // transformation - // - - // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ); - - // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ); - - // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ); - - // - // apply the transforms - // - - // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; - - // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; - - // returns the native representation - virtual void * GetNativeMatrix() const; - - const wxGraphicsMatrixData* GetMatrixData() const - { return (const wxGraphicsMatrixData*) GetRefData(); } - wxGraphicsMatrixData* GetMatrixData() - { return (wxGraphicsMatrixData*) GetRefData(); } - -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsMatrix) wxNullGraphicsMatrix; - -class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData -{ -public : - wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} - virtual ~wxGraphicsPathData() {} - - // - // These are the path primitives from which everything else can be constructed - // - - // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; - - // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; - - // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; - - // adds another path - virtual void AddPath( const wxGraphicsPathData* path ) =0; - - // closes the current sub-path - virtual void CloseSubpath() = 0; - - // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; - - // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; - - // - // These are convenience functions which - if not available natively will be assembled - // using the primitives from above - // - - // adds a quadratic Bezier curve from the current point, using a control point and an end point - virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); - - // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - - // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); - - // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; - - // appends an ellipse - virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // appends a rounded rectangle - virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // returns the native path - virtual void * GetNativePath() const = 0; - - // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p) const= 0; - - // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; - - // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; - - virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const=0; -}; - -class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject -{ -public : - wxGraphicsPath() {} - virtual ~wxGraphicsPath() {} - - // - // These are the path primitives from which everything else can be constructed - // - - // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ); - void MoveToPoint( const wxPoint2DDouble& p); - - // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ); - void AddLineToPoint( const wxPoint2DDouble& p); - - // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) ; - void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e); - - // adds another path - virtual void AddPath( const wxGraphicsPath& path ); - - // closes the current sub-path - virtual void CloseSubpath() ; - - // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; - wxPoint2DDouble GetCurrentPoint() const; - - // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) ; - void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); - - // - // These are convenience functions which - if not available natively will be assembled - // using the primitives from above - // - - // adds a quadratic Bezier curve from the current point, using a control point and an end point - virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); - - // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - - // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); - - // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; - - // appends an ellipse - virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // appends a rounded rectangle - virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // returns the native path - virtual void * GetNativePath() const; - - // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p)const; - - // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrix& matrix ); - - // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const; - wxRect2DDouble GetBox()const; - - virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE)const; - bool Contains( const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE)const; - - const wxGraphicsPathData* GetPathData() const - { return (const wxGraphicsPathData*) GetRefData(); } - wxGraphicsPathData* GetPathData() - { return (wxGraphicsPathData*) GetRefData(); } - -private : - DECLARE_DYNAMIC_CLASS(wxGraphicsPath) -} ; - -extern WXDLLEXPORT_DATA(wxGraphicsPath) wxNullGraphicsPath; - - -class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject -{ -public: - wxGraphicsContext(wxGraphicsRenderer* renderer); - - virtual ~wxGraphicsContext(); - - static wxGraphicsContext* Create( const wxWindowDC& dc) ; - -#ifdef __WXMSW__ - static wxGraphicsContext * Create( const wxMemoryDC& dc) ; -#endif - - static wxGraphicsContext* CreateFromNative( void * context ) ; - - static wxGraphicsContext* CreateFromNativeWindow( void * window ) ; - - static wxGraphicsContext* Create( wxWindow* window ) ; - - // create a context that can be used for measuring texts only, no drawing allowed - static wxGraphicsContext * Create(); - - wxGraphicsPath CreatePath() const; - - virtual wxGraphicsPen CreatePen(const wxPen& pen) const; - - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const; - - // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 - virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) const; - - // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) - // with radius r and color cColor - virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) const; - - // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const; - - // create a 'native' matrix corresponding to these values - virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) const; - - // push the current state of the context, ie the transformation matrix on a stack - virtual void PushState() = 0; - - // pops a stored state from the stack - virtual void PopState() = 0; - - // clips drawings to the region intersected with the current clipping region - virtual void Clip( const wxRegion ®ion ) = 0; - - // clips drawings to the rect intersected with the current clipping region - virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - - // resets the clipping to original extent - virtual void ResetClip() = 0 ; - - // returns the native context - virtual void * GetNativeContext() = 0; - - // returns the current logical function - virtual int GetLogicalFunction() const { return m_logicalFunction; } - - // sets the current logical function, returns true if it supported - virtual bool SetLogicalFunction(int function) ; - - // - // transformation : changes the current transformation matrix CTM of the context - // - - // translate - virtual void Translate( wxDouble dx , wxDouble dy ) = 0; - - // scale - virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; - - // rotate (radians) - virtual void Rotate( wxDouble angle ) = 0; - - // concatenates this transform with the current transform of this context - virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) = 0; - - // sets the transform of this context - virtual void SetTransform( const wxGraphicsMatrix& matrix ) = 0; - - // gets the matrix of this context - virtual wxGraphicsMatrix GetTransform() const = 0; - // - // setting the paint - // - - // sets the pen - virtual void SetPen( const wxGraphicsPen& pen ); - - void SetPen( const wxPen& pen ); - - // sets the brush for filling - virtual void SetBrush( const wxGraphicsBrush& brush ); - - void SetBrush( const wxBrush& brush ); - - // sets the font - virtual void SetFont( const wxGraphicsFont& font ); - - void SetFont( const wxFont& font, const wxColour& colour ); - - - // strokes along a path with the current pen - virtual void StrokePath( const wxGraphicsPath& path ) = 0; - - // fills a path with the current brush - virtual void FillPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ) = 0; - - // draws a path by first filling and then stroking - virtual void DrawPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ); - - // - // text - // - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y ) = 0; - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ); - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush ) ; - - virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ); - - virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, - wxDouble *descent, wxDouble *externalLeading ) const = 0; - - virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; - - // - // image support - // - - virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - - virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; - - // - // convenience methods - // - - // strokes a single line - virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2); - - // stroke lines connecting each of the points - virtual void StrokeLines( size_t n, const wxPoint2DDouble *points); - - // stroke disconnected lines from begin to end points - virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints); - - // draws a polygon - virtual void DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle = wxODDEVEN_RULE ); - - // draws a polygon - virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // draws an ellipse - virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); - - // draws a rounded rectangle - virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); - - // wrappers using wxPoint2DDouble TODO - - // helper to determine if a 0.5 offset should be applied for the drawing operation - virtual bool ShouldOffset() const { return false; } - -protected : - - wxGraphicsPen m_pen; - wxGraphicsBrush m_brush; - wxGraphicsFont m_font; - int m_logicalFunction; - -private : - DECLARE_NO_COPY_CLASS(wxGraphicsContext) - DECLARE_ABSTRACT_CLASS(wxGraphicsContext) -}; - -#if 0 - -// -// A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements -// - -class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject -{ -public : - wxGraphicsFigure(wxGraphicsRenderer* renderer) ; - - virtual ~wxGraphicsFigure() ; - - void SetPath( wxGraphicsMatrix* matrix ); - - void SetMatrix( wxGraphicsPath* path); - - // draws this object on the context - virtual void Draw( wxGraphicsContext* cg ); - - // returns the path of this object - wxGraphicsPath* GetPath() { return m_path; } - - // returns the transformation matrix of this object, may be null if there is no transformation necessary - wxGraphicsMatrix* GetMatrix() { return m_matrix; } - -private : - wxGraphicsMatrix* m_matrix; - wxGraphicsPath* m_path; - - DECLARE_DYNAMIC_CLASS(wxGraphicsFigure) -} ; - -#endif - -// -// The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer -// instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional -// paths at any point from a given matrix etc. -// - -class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject -{ -public : - wxGraphicsRenderer() {} - - virtual ~wxGraphicsRenderer() {} - - static wxGraphicsRenderer* GetDefaultRenderer(); - - // Context - - virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ; -#ifdef __WXMSW__ - virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0 ; -#endif - virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; - - virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0; - - virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; - - // create a context that can be used for measuring texts only, no drawing allowed - virtual wxGraphicsContext * CreateMeasuringContext() = 0; - - // Path - - virtual wxGraphicsPath CreatePath() = 0; - - // Matrix - - virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0) = 0; - - // Paints - - virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0 ; - - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0 ; - - // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 - virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxColour&c1, const wxColour&c2) = 0; - - // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) - // with radius r and color cColor - virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) = 0; - - // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; - -private : - DECLARE_NO_COPY_CLASS(wxGraphicsRenderer) - DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) -} ; - -#endif - -#endif // _WX_GRAPHICS_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/graphics.h +// Purpose: graphics context header +// Author: Stefan Csomor +// Modified by: +// Created: +// Copyright: (c) Stefan Csomor +// RCS-ID: $Id: graphics.h 50671 2007-12-12 20:19:36Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRAPHICS_H_ +#define _WX_GRAPHICS_H_ + +#include "wx/defs.h" + +#if wxUSE_GRAPHICS_CONTEXT + +#include "wx/geometry.h" +#include "wx/dynarray.h" + +class WXDLLIMPEXP_CORE wxWindowDC; +class WXDLLIMPEXP_CORE wxMemoryDC; +class WXDLLIMPEXP_CORE wxGraphicsContext; +class WXDLLIMPEXP_CORE wxGraphicsPath; +class WXDLLIMPEXP_CORE wxGraphicsMatrix; +class WXDLLIMPEXP_CORE wxGraphicsFigure; +class WXDLLIMPEXP_CORE wxGraphicsRenderer; +class WXDLLIMPEXP_CORE wxGraphicsPen; +class WXDLLIMPEXP_CORE wxGraphicsBrush; +class WXDLLIMPEXP_CORE wxGraphicsFont; + +/* + * notes about the graphics context apis + * + * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being + * in direction of positive y axis. + */ + +// Base class of all objects used for drawing in the new graphics API, the always point back to their +// originating rendering engine, there is no dynamic unloading of a renderer currently allowed, +// these references are not counted + +// +// The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive +// duplication. Any operation on a shared instance that results in a modified state, uncouples this +// instance from the other instances that were shared - using copy on write semantics +// + +class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData +{ +public : + wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); + wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); + wxGraphicsRenderer* GetRenderer() const ; + virtual wxGraphicsObjectRefData* Clone() const ; + +protected : + wxGraphicsRenderer* m_renderer; +} ; + +class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject +{ +public : + wxGraphicsObject() ; + wxGraphicsObject( wxGraphicsRenderer* renderer ) ; + virtual ~wxGraphicsObject() ; + + bool IsNull() const ; + + // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet + wxGraphicsRenderer* GetRenderer() const ; + wxGraphicsObjectRefData* GetGraphicsData() const ; +protected : + virtual wxObjectRefData* CreateRefData() const; + virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; + + DECLARE_DYNAMIC_CLASS(wxGraphicsObject) +} ; + +class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject +{ +public : + wxGraphicsPen() {} + virtual ~wxGraphicsPen() {} +private : + DECLARE_DYNAMIC_CLASS(wxGraphicsPen) +} ; + +extern WXDLLEXPORT_DATA(wxGraphicsPen) wxNullGraphicsPen; + +class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject +{ +public : + wxGraphicsBrush() {} + virtual ~wxGraphicsBrush() {} +private : + DECLARE_DYNAMIC_CLASS(wxGraphicsBrush) +} ; + +extern WXDLLEXPORT_DATA(wxGraphicsBrush) wxNullGraphicsBrush; + +class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject +{ +public : + wxGraphicsFont() {} + virtual ~wxGraphicsFont() {} +private : + DECLARE_DYNAMIC_CLASS(wxGraphicsFont) +} ; + +extern WXDLLEXPORT_DATA(wxGraphicsFont) wxNullGraphicsFont; + + +class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : + wxGraphicsObjectRefData(renderer) {} + + virtual ~wxGraphicsMatrixData() {} + + // concatenates the matrix + virtual void Concat( const wxGraphicsMatrixData *t ) = 0; + + // sets the matrix to the respective values + virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) = 0; + + // gets the component valuess of the matrix + virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; + + // makes this the inverse matrix + virtual void Invert() = 0; + + // returns true if the elements of the transformation matrix are equal ? + virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; + + // return true if this is the identity matrix + virtual bool IsIdentity() const = 0; + + // + // transformation + // + + // add the translation to this matrix + virtual void Translate( wxDouble dx , wxDouble dy ) = 0; + + // add the scale to this matrix + virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; + + // add the rotation to this matrix (radians) + virtual void Rotate( wxDouble angle ) = 0; + + // + // apply the transforms + // + + // applies that matrix to the point + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; + + // applies the matrix except for translations + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; + + // returns the native representation + virtual void * GetNativeMatrix() const = 0; +} ; + +class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject +{ +public : + wxGraphicsMatrix() {} + + virtual ~wxGraphicsMatrix() {} + + // concatenates the matrix + virtual void Concat( const wxGraphicsMatrix *t ); + void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); } + + // sets the matrix to the respective values + virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0); + + // gets the component valuess of the matrix + virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; + + // makes this the inverse matrix + virtual void Invert(); + + // returns true if the elements of the transformation matrix are equal ? + virtual bool IsEqual( const wxGraphicsMatrix* t) const; + bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); } + + // return true if this is the identity matrix + virtual bool IsIdentity() const; + + // + // transformation + // + + // add the translation to this matrix + virtual void Translate( wxDouble dx , wxDouble dy ); + + // add the scale to this matrix + virtual void Scale( wxDouble xScale , wxDouble yScale ); + + // add the rotation to this matrix (radians) + virtual void Rotate( wxDouble angle ); + + // + // apply the transforms + // + + // applies that matrix to the point + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; + + // applies the matrix except for translations + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; + + // returns the native representation + virtual void * GetNativeMatrix() const; + + const wxGraphicsMatrixData* GetMatrixData() const + { return (const wxGraphicsMatrixData*) GetRefData(); } + wxGraphicsMatrixData* GetMatrixData() + { return (wxGraphicsMatrixData*) GetRefData(); } + +private : + DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix) +} ; + +extern WXDLLEXPORT_DATA(wxGraphicsMatrix) wxNullGraphicsMatrix; + +class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} + virtual ~wxGraphicsPathData() {} + + // + // These are the path primitives from which everything else can be constructed + // + + // begins a new subpath at (x,y) + virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; + + // adds a straight line from the current point to (x,y) + virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; + + // adds a cubic Bezier curve from the current point, using two control points and an end point + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; + + // adds another path + virtual void AddPath( const wxGraphicsPathData* path ) =0; + + // closes the current sub-path + virtual void CloseSubpath() = 0; + + // gets the last point of the current path, (0,0) if not yet set + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; + + // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; + + // + // These are convenience functions which - if not available natively will be assembled + // using the primitives from above + // + + // adds a quadratic Bezier curve from the current point, using a control point and an end point + virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); + + // appends a rectangle as a new closed subpath + virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + + // appends an ellipsis as a new closed subpath fitting the passed rectangle + virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); + + // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; + + // appends an ellipse + virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // appends a rounded rectangle + virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // returns the native path + virtual void * GetNativePath() const = 0; + + // give the native path returned by GetNativePath() back (there might be some deallocations necessary) + virtual void UnGetNativePath(void *p) const= 0; + + // transforms each point of this path by the matrix + virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; + + // gets the bounding box enclosing all points (possibly including control points) + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; + + virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const=0; +}; + +class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject +{ +public : + wxGraphicsPath() {} + virtual ~wxGraphicsPath() {} + + // + // These are the path primitives from which everything else can be constructed + // + + // begins a new subpath at (x,y) + virtual void MoveToPoint( wxDouble x, wxDouble y ); + void MoveToPoint( const wxPoint2DDouble& p); + + // adds a straight line from the current point to (x,y) + virtual void AddLineToPoint( wxDouble x, wxDouble y ); + void AddLineToPoint( const wxPoint2DDouble& p); + + // adds a cubic Bezier curve from the current point, using two control points and an end point + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) ; + void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e); + + // adds another path + virtual void AddPath( const wxGraphicsPath& path ); + + // closes the current sub-path + virtual void CloseSubpath() ; + + // gets the last point of the current path, (0,0) if not yet set + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; + wxPoint2DDouble GetCurrentPoint() const; + + // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) ; + void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); + + // + // These are convenience functions which - if not available natively will be assembled + // using the primitives from above + // + + // adds a quadratic Bezier curve from the current point, using a control point and an end point + virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); + + // appends a rectangle as a new closed subpath + virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + + // appends an ellipsis as a new closed subpath fitting the passed rectangle + virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); + + // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; + + // appends an ellipse + virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // appends a rounded rectangle + virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // returns the native path + virtual void * GetNativePath() const; + + // give the native path returned by GetNativePath() back (there might be some deallocations necessary) + virtual void UnGetNativePath(void *p)const; + + // transforms each point of this path by the matrix + virtual void Transform( const wxGraphicsMatrix& matrix ); + + // gets the bounding box enclosing all points (possibly including control points) + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const; + wxRect2DDouble GetBox()const; + + virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE)const; + bool Contains( const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE)const; + + const wxGraphicsPathData* GetPathData() const + { return (const wxGraphicsPathData*) GetRefData(); } + wxGraphicsPathData* GetPathData() + { return (wxGraphicsPathData*) GetRefData(); } + +private : + DECLARE_DYNAMIC_CLASS(wxGraphicsPath) +} ; + +extern WXDLLEXPORT_DATA(wxGraphicsPath) wxNullGraphicsPath; + + +class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject +{ +public: + wxGraphicsContext(wxGraphicsRenderer* renderer); + + virtual ~wxGraphicsContext(); + + static wxGraphicsContext* Create( const wxWindowDC& dc) ; + +#ifdef __WXMSW__ + static wxGraphicsContext * Create( const wxMemoryDC& dc) ; +#endif + + static wxGraphicsContext* CreateFromNative( void * context ) ; + + static wxGraphicsContext* CreateFromNativeWindow( void * window ) ; + + static wxGraphicsContext* Create( wxWindow* window ) ; + + // create a context that can be used for measuring texts only, no drawing allowed + static wxGraphicsContext * Create(); + + wxGraphicsPath CreatePath() const; + + virtual wxGraphicsPen CreatePen(const wxPen& pen) const; + + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const; + + // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 + virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2) const; + + // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) + // with radius r and color cColor + virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor) const; + + // sets the font + virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const; + + // create a 'native' matrix corresponding to these values + virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) const; + + // push the current state of the context, ie the transformation matrix on a stack + virtual void PushState() = 0; + + // pops a stored state from the stack + virtual void PopState() = 0; + + // clips drawings to the region intersected with the current clipping region + virtual void Clip( const wxRegion ®ion ) = 0; + + // clips drawings to the rect intersected with the current clipping region + virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + // resets the clipping to original extent + virtual void ResetClip() = 0 ; + + // returns the native context + virtual void * GetNativeContext() = 0; + + // returns the current logical function + virtual int GetLogicalFunction() const { return m_logicalFunction; } + + // sets the current logical function, returns true if it supported + virtual bool SetLogicalFunction(int function) ; + + // + // transformation : changes the current transformation matrix CTM of the context + // + + // translate + virtual void Translate( wxDouble dx , wxDouble dy ) = 0; + + // scale + virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; + + // rotate (radians) + virtual void Rotate( wxDouble angle ) = 0; + + // concatenates this transform with the current transform of this context + virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) = 0; + + // sets the transform of this context + virtual void SetTransform( const wxGraphicsMatrix& matrix ) = 0; + + // gets the matrix of this context + virtual wxGraphicsMatrix GetTransform() const = 0; + // + // setting the paint + // + + // sets the pen + virtual void SetPen( const wxGraphicsPen& pen ); + + void SetPen( const wxPen& pen ); + + // sets the brush for filling + virtual void SetBrush( const wxGraphicsBrush& brush ); + + void SetBrush( const wxBrush& brush ); + + // sets the font + virtual void SetFont( const wxGraphicsFont& font ); + + void SetFont( const wxFont& font, const wxColour& colour ); + + + // strokes along a path with the current pen + virtual void StrokePath( const wxGraphicsPath& path ) = 0; + + // fills a path with the current brush + virtual void FillPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ) = 0; + + // draws a path by first filling and then stroking + virtual void DrawPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ); + + // + // text + // + + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y ) = 0; + + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ); + + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush ) ; + + virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ); + + virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, + wxDouble *descent, wxDouble *externalLeading ) const = 0; + + virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; + + // + // image support + // + + virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + // + // convenience methods + // + + // strokes a single line + virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2); + + // stroke lines connecting each of the points + virtual void StrokeLines( size_t n, const wxPoint2DDouble *points); + + // stroke disconnected lines from begin to end points + virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints); + + // draws a polygon + virtual void DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle = wxODDEVEN_RULE ); + + // draws a polygon + virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // draws an ellipse + virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // draws a rounded rectangle + virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // wrappers using wxPoint2DDouble TODO + + // helper to determine if a 0.5 offset should be applied for the drawing operation + virtual bool ShouldOffset() const { return false; } + +protected : + + wxGraphicsPen m_pen; + wxGraphicsBrush m_brush; + wxGraphicsFont m_font; + int m_logicalFunction; + +private : + DECLARE_NO_COPY_CLASS(wxGraphicsContext) + DECLARE_ABSTRACT_CLASS(wxGraphicsContext) +}; + +#if 0 + +// +// A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements +// + +class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject +{ +public : + wxGraphicsFigure(wxGraphicsRenderer* renderer) ; + + virtual ~wxGraphicsFigure() ; + + void SetPath( wxGraphicsMatrix* matrix ); + + void SetMatrix( wxGraphicsPath* path); + + // draws this object on the context + virtual void Draw( wxGraphicsContext* cg ); + + // returns the path of this object + wxGraphicsPath* GetPath() { return m_path; } + + // returns the transformation matrix of this object, may be null if there is no transformation necessary + wxGraphicsMatrix* GetMatrix() { return m_matrix; } + +private : + wxGraphicsMatrix* m_matrix; + wxGraphicsPath* m_path; + + DECLARE_DYNAMIC_CLASS(wxGraphicsFigure) +} ; + +#endif + +// +// The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer +// instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional +// paths at any point from a given matrix etc. +// + +class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject +{ +public : + wxGraphicsRenderer() {} + + virtual ~wxGraphicsRenderer() {} + + static wxGraphicsRenderer* GetDefaultRenderer(); + + // Context + + virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ; +#ifdef __WXMSW__ + virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0 ; +#endif + virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; + + virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0; + + virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; + + // create a context that can be used for measuring texts only, no drawing allowed + virtual wxGraphicsContext * CreateMeasuringContext() = 0; + + // Path + + virtual wxGraphicsPath CreatePath() = 0; + + // Matrix + + virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) = 0; + + // Paints + + virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0 ; + + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0 ; + + // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 + virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour&c1, const wxColour&c2) = 0; + + // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) + // with radius r and color cColor + virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, + const wxColour &oColor, const wxColour &cColor) = 0; + + // sets the font + virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; + +private : + DECLARE_NO_COPY_CLASS(wxGraphicsRenderer) + DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) +} ; + +#endif + +#endif // _WX_GRAPHICS_H_ diff --git a/Externals/wxWidgets/include/wx/grid.h b/Externals/wxWidgets/include/wx/grid.h index 0a4ab11cd3..6c50126291 100644 --- a/Externals/wxWidgets/include/wx/grid.h +++ b/Externals/wxWidgets/include/wx/grid.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/grid.h -// Purpose: wxGrid base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: grid.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GRID_H_BASE_ -#define _WX_GRID_H_BASE_ - -#include "wx/generic/grid.h" - -#endif - // _WX_GRID_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/grid.h +// Purpose: wxGrid base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: grid.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRID_H_BASE_ +#define _WX_GRID_H_BASE_ + +#include "wx/generic/grid.h" + +#endif + // _WX_GRID_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/gsocket.h b/Externals/wxWidgets/include/wx/gsocket.h index bd44b86e62..83d8ee49b6 100644 --- a/Externals/wxWidgets/include/wx/gsocket.h +++ b/Externals/wxWidgets/include/wx/gsocket.h @@ -1,184 +1,184 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) - * Name: gsocket.h - * Author: Guilhem Lavaux - * Guillermo Rodriguez Garcia (maintainer) - * Copyright: (c) Guilhem Lavaux - * Licence: wxWindows Licence - * Purpose: GSocket include file (system independent) - * CVSID: $Id: gsocket.h 33948 2005-05-04 18:57:50Z JS $ - * ------------------------------------------------------------------------- - */ - -#ifndef __GSOCKET_H -#define __GSOCKET_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/defs.h" - -#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */ - -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#include - -/* - Including sys/types.h under cygwin results in the warnings about "fd_set - having been defined in sys/types.h" when winsock.h is included later and - doesn't seem to be necessary anyhow. It's not needed under Mac neither. - */ -#if !defined(__WXMAC__) && !defined(__CYGWIN__) && !defined(__WXWINCE__) -#include -#endif - -#ifdef __WXWINCE__ -#include -#endif - -class GSocket; - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _GAddress GAddress; - -typedef enum { - GSOCK_NOFAMILY = 0, - GSOCK_INET, - GSOCK_INET6, - GSOCK_UNIX -} GAddressType; - -typedef enum { - GSOCK_STREAMED, - GSOCK_UNSTREAMED -} GSocketStream; - -typedef enum { - GSOCK_NOERROR = 0, - GSOCK_INVOP, - GSOCK_IOERR, - GSOCK_INVADDR, - GSOCK_INVSOCK, - GSOCK_NOHOST, - GSOCK_INVPORT, - GSOCK_WOULDBLOCK, - GSOCK_TIMEDOUT, - GSOCK_MEMERR, - GSOCK_OPTERR -} GSocketError; - -/* See below for an explanation on how events work. - */ -typedef enum { - GSOCK_INPUT = 0, - GSOCK_OUTPUT = 1, - GSOCK_CONNECTION = 2, - GSOCK_LOST = 3, - GSOCK_MAX_EVENT = 4 -} GSocketEvent; - -enum { - GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT, - GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT, - GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION, - GSOCK_LOST_FLAG = 1 << GSOCK_LOST -}; - -typedef int GSocketEventFlags; - -typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event, - char *cdata); - - -/* Functions tables for internal use by GSocket code: */ - -/* Actually this is a misnomer now, but reusing this name means I don't - have to ifdef app traits or common socket code */ -class GSocketGUIFunctionsTable -{ -public: - // needed since this class declares virtual members - virtual ~GSocketGUIFunctionsTable() { } - virtual bool OnInit() = 0; - virtual void OnExit() = 0; - virtual bool CanUseEventLoop() = 0; - virtual bool Init_Socket(GSocket *socket) = 0; - virtual void Destroy_Socket(GSocket *socket) = 0; -#ifndef __WINDOWS__ - virtual void Install_Callback(GSocket *socket, GSocketEvent event) = 0; - virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) = 0; -#endif - virtual void Enable_Events(GSocket *socket) = 0; - virtual void Disable_Events(GSocket *socket) = 0; -}; - - -/* Global initializers */ - -/* Sets GUI functions callbacks. Must be called *before* GSocket_Init - if the app uses async sockets. */ -void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc); - -/* GSocket_Init() must be called at the beginning */ -int GSocket_Init(void); - -/* GSocket_Cleanup() must be called at the end */ -void GSocket_Cleanup(void); - - -/* Constructors / Destructors */ - -GSocket *GSocket_new(void); - - -/* GAddress */ - -GAddress *GAddress_new(void); -GAddress *GAddress_copy(GAddress *address); -void GAddress_destroy(GAddress *address); - -void GAddress_SetFamily(GAddress *address, GAddressType type); -GAddressType GAddress_GetFamily(GAddress *address); - -/* The use of any of the next functions will set the address family to - * the specific one. For example if you use GAddress_INET_SetHostName, - * address family will be implicitly set to AF_INET. - */ - -GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname); -GSocketError GAddress_INET_SetAnyAddress(GAddress *address); -GSocketError GAddress_INET_SetHostAddress(GAddress *address, - unsigned long hostaddr); -GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, - const char *protocol); -GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port); - -GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, - size_t sbuf); -unsigned long GAddress_INET_GetHostAddress(GAddress *address); -unsigned short GAddress_INET_GetPort(GAddress *address); - -/* TODO: Define specific parts (INET6, UNIX) */ - -GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path); -GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -# if defined(__WINDOWS__) -# include "wx/msw/gsockmsw.h" -# elif defined(__WXMAC__) && !defined(__DARWIN__) -# include "wx/mac/gsockmac.h" -# else -# include "wx/unix/gsockunx.h" -# endif - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -#endif /* __GSOCKET_H */ +/* ------------------------------------------------------------------------- + * Project: GSocket (Generic Socket) + * Name: gsocket.h + * Author: Guilhem Lavaux + * Guillermo Rodriguez Garcia (maintainer) + * Copyright: (c) Guilhem Lavaux + * Licence: wxWindows Licence + * Purpose: GSocket include file (system independent) + * CVSID: $Id: gsocket.h 33948 2005-05-04 18:57:50Z JS $ + * ------------------------------------------------------------------------- + */ + +#ifndef __GSOCKET_H +#define __GSOCKET_H + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/defs.h" + +#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */ + +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + +#include + +/* + Including sys/types.h under cygwin results in the warnings about "fd_set + having been defined in sys/types.h" when winsock.h is included later and + doesn't seem to be necessary anyhow. It's not needed under Mac neither. + */ +#if !defined(__WXMAC__) && !defined(__CYGWIN__) && !defined(__WXWINCE__) +#include +#endif + +#ifdef __WXWINCE__ +#include +#endif + +class GSocket; + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _GAddress GAddress; + +typedef enum { + GSOCK_NOFAMILY = 0, + GSOCK_INET, + GSOCK_INET6, + GSOCK_UNIX +} GAddressType; + +typedef enum { + GSOCK_STREAMED, + GSOCK_UNSTREAMED +} GSocketStream; + +typedef enum { + GSOCK_NOERROR = 0, + GSOCK_INVOP, + GSOCK_IOERR, + GSOCK_INVADDR, + GSOCK_INVSOCK, + GSOCK_NOHOST, + GSOCK_INVPORT, + GSOCK_WOULDBLOCK, + GSOCK_TIMEDOUT, + GSOCK_MEMERR, + GSOCK_OPTERR +} GSocketError; + +/* See below for an explanation on how events work. + */ +typedef enum { + GSOCK_INPUT = 0, + GSOCK_OUTPUT = 1, + GSOCK_CONNECTION = 2, + GSOCK_LOST = 3, + GSOCK_MAX_EVENT = 4 +} GSocketEvent; + +enum { + GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT, + GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT, + GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION, + GSOCK_LOST_FLAG = 1 << GSOCK_LOST +}; + +typedef int GSocketEventFlags; + +typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event, + char *cdata); + + +/* Functions tables for internal use by GSocket code: */ + +/* Actually this is a misnomer now, but reusing this name means I don't + have to ifdef app traits or common socket code */ +class GSocketGUIFunctionsTable +{ +public: + // needed since this class declares virtual members + virtual ~GSocketGUIFunctionsTable() { } + virtual bool OnInit() = 0; + virtual void OnExit() = 0; + virtual bool CanUseEventLoop() = 0; + virtual bool Init_Socket(GSocket *socket) = 0; + virtual void Destroy_Socket(GSocket *socket) = 0; +#ifndef __WINDOWS__ + virtual void Install_Callback(GSocket *socket, GSocketEvent event) = 0; + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) = 0; +#endif + virtual void Enable_Events(GSocket *socket) = 0; + virtual void Disable_Events(GSocket *socket) = 0; +}; + + +/* Global initializers */ + +/* Sets GUI functions callbacks. Must be called *before* GSocket_Init + if the app uses async sockets. */ +void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc); + +/* GSocket_Init() must be called at the beginning */ +int GSocket_Init(void); + +/* GSocket_Cleanup() must be called at the end */ +void GSocket_Cleanup(void); + + +/* Constructors / Destructors */ + +GSocket *GSocket_new(void); + + +/* GAddress */ + +GAddress *GAddress_new(void); +GAddress *GAddress_copy(GAddress *address); +void GAddress_destroy(GAddress *address); + +void GAddress_SetFamily(GAddress *address, GAddressType type); +GAddressType GAddress_GetFamily(GAddress *address); + +/* The use of any of the next functions will set the address family to + * the specific one. For example if you use GAddress_INET_SetHostName, + * address family will be implicitly set to AF_INET. + */ + +GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname); +GSocketError GAddress_INET_SetAnyAddress(GAddress *address); +GSocketError GAddress_INET_SetHostAddress(GAddress *address, + unsigned long hostaddr); +GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, + const char *protocol); +GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port); + +GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, + size_t sbuf); +unsigned long GAddress_INET_GetHostAddress(GAddress *address); +unsigned short GAddress_INET_GetPort(GAddress *address); + +/* TODO: Define specific parts (INET6, UNIX) */ + +GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path); +GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +# if defined(__WINDOWS__) +# include "wx/msw/gsockmsw.h" +# elif defined(__WXMAC__) && !defined(__DARWIN__) +# include "wx/mac/gsockmac.h" +# else +# include "wx/unix/gsockunx.h" +# endif + +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + +#endif /* __GSOCKET_H */ diff --git a/Externals/wxWidgets/include/wx/hash.h b/Externals/wxWidgets/include/wx/hash.h index 9937bbe4e4..69cc9ad53e 100644 --- a/Externals/wxWidgets/include/wx/hash.h +++ b/Externals/wxWidgets/include/wx/hash.h @@ -1,630 +1,630 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hash.h -// Purpose: wxHashTable class -// Author: Julian Smart -// Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() -// Created: 01/02/97 -// RCS-ID: $Id: hash.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HASH_H__ -#define _WX_HASH_H__ - -#include "wx/defs.h" - -#if !wxUSE_STL && WXWIN_COMPATIBILITY_2_4 - #define wxUSE_OLD_HASH_TABLE 1 -#else - #define wxUSE_OLD_HASH_TABLE 0 -#endif - -#if !wxUSE_STL - #include "wx/object.h" -#else - class WXDLLIMPEXP_BASE wxObject; -#endif -#if wxUSE_OLD_HASH_TABLE - #include "wx/list.h" -#endif -#if WXWIN_COMPATIBILITY_2_4 - #include "wx/dynarray.h" -#endif - -// the default size of the hash -#define wxHASH_SIZE_DEFAULT (1000) - -/* - * A hash table is an array of user-definable size with lists - * of data items hanging off the array positions. Usually there'll - * be a hit, so no search is required; otherwise we'll have to run down - * the list to find the desired item. -*/ - -// ---------------------------------------------------------------------------- -// this is the base class for object hashes: hash tables which contain -// pointers to objects -// ---------------------------------------------------------------------------- - -#if wxUSE_OLD_HASH_TABLE - -class WXDLLIMPEXP_BASE wxHashTableBase : public wxObject -{ -public: - wxHashTableBase(); - - void Create(wxKeyType keyType = wxKEY_INTEGER, - size_t size = wxHASH_SIZE_DEFAULT); - void Destroy(); - - size_t GetSize() const { return m_hashSize; } - size_t GetCount() const { return m_count; } - - void DeleteContents(bool flag); - -protected: - // find the node for (key, value) - wxNodeBase *GetNode(long key, long value) const; - - // the array of lists in which we store the values for given key hash - wxListBase **m_hashTable; - - // the size of m_lists array - size_t m_hashSize; - - // the type of indexing we use - wxKeyType m_keyType; - - // the total number of elements in the hash - size_t m_count; - - // should we delete our data? - bool m_deleteContents; - -private: - // no copy ctor/assignment operator (yet) - DECLARE_NO_COPY_CLASS(wxHashTableBase) -}; - -#else // if !wxUSE_OLD_HASH_TABLE - -#if !defined(wxENUM_KEY_TYPE_DEFINED) -#define wxENUM_KEY_TYPE_DEFINED - -enum wxKeyType -{ - wxKEY_NONE, - wxKEY_INTEGER, - wxKEY_STRING -}; - -#endif - -union wxHashKeyValue -{ - long integer; - wxChar *string; -}; - -// for some compilers (AIX xlC), defining it as friend inside the class is not -// enough, so provide a real forward declaration -class WXDLLIMPEXP_FWD_BASE wxHashTableBase; - -class WXDLLIMPEXP_BASE wxHashTableBase_Node -{ - friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase; - typedef class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node _Node; -public: - wxHashTableBase_Node( long key, void* value, - wxHashTableBase* table ); - wxHashTableBase_Node( const wxChar* key, void* value, - wxHashTableBase* table ); - ~wxHashTableBase_Node(); - - long GetKeyInteger() const { return m_key.integer; } - const wxChar* GetKeyString() const { return m_key.string; } - - void* GetData() const { return m_value; } - void SetData( void* data ) { m_value = data; } - -protected: - _Node* GetNext() const { return m_next; } - -protected: - // next node in the chain - wxHashTableBase_Node* m_next; - - // key - wxHashKeyValue m_key; - - // value - void* m_value; - - // pointer to the hash containing the node, used to remove the - // node from the hash when the user deletes the node iterating - // through it - // TODO: move it to wxHashTable_Node (only wxHashTable supports - // iteration) - wxHashTableBase* m_hashPtr; -}; - -class WXDLLIMPEXP_BASE wxHashTableBase -#if !wxUSE_STL - : public wxObject -#endif -{ - friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node; -public: - typedef wxHashTableBase_Node Node; - - wxHashTableBase(); - virtual ~wxHashTableBase() { } - - void Create( wxKeyType keyType = wxKEY_INTEGER, - size_t size = wxHASH_SIZE_DEFAULT ); - void Clear(); - void Destroy(); - - size_t GetSize() const { return m_size; } - size_t GetCount() const { return m_count; } - - void DeleteContents( bool flag ) { m_deleteContents = flag; } - - static long MakeKey(const wxChar *string); - -protected: - void DoPut( long key, long hash, void* data ); - void DoPut( const wxChar* key, long hash, void* data ); - void* DoGet( long key, long hash ) const; - void* DoGet( const wxChar* key, long hash ) const; - void* DoDelete( long key, long hash ); - void* DoDelete( const wxChar* key, long hash ); - -private: - // Remove the node from the hash, *only called from - // ~wxHashTable*_Node destructor - void DoRemoveNode( wxHashTableBase_Node* node ); - - // destroys data contained in the node if appropriate: - // deletes the key if it is a string and destrys - // the value if m_deleteContents is true - void DoDestroyNode( wxHashTableBase_Node* node ); - - // inserts a node in the table (at the end of the chain) - void DoInsertNode( size_t bucket, wxHashTableBase_Node* node ); - - // removes a node from the table (fiven a pointer to the previous - // but does not delete it (only deletes its contents) - void DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, - wxHashTableBase_Node* prev ); - - // unconditionally deletes node value (invoking the - // correct destructor) - virtual void DoDeleteContents( wxHashTableBase_Node* node ) = 0; - -protected: - // number of buckets - size_t m_size; - - // number of nodes (key/value pairs) - size_t m_count; - - // table - Node** m_table; - - // key typ (INTEGER/STRING) - wxKeyType m_keyType; - - // delete contents when hash is cleared - bool m_deleteContents; - -private: - DECLARE_NO_COPY_CLASS(wxHashTableBase) -}; - -#endif // wxUSE_OLD_HASH_TABLE - -#if !wxUSE_STL - -#if WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// a hash table which stores longs -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxHashTableLong : public wxObject -{ -public: - wxHashTableLong(size_t size = wxHASH_SIZE_DEFAULT) - { Init(size); } - virtual ~wxHashTableLong(); - - void Create(size_t size = wxHASH_SIZE_DEFAULT); - void Destroy(); - - size_t GetSize() const { return m_hashSize; } - size_t GetCount() const { return m_count; } - - void Put(long key, long value); - long Get(long key) const; - long Delete(long key); - -protected: - void Init(size_t size); - -private: - wxArrayLong **m_values, - **m_keys; - - // the size of array above - size_t m_hashSize; - - // the total number of elements in the hash - size_t m_count; - - // not implemented yet - DECLARE_NO_COPY_CLASS(wxHashTableLong) -}; - -// ---------------------------------------------------------------------------- -// wxStringHashTable: a hash table which indexes strings with longs -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringHashTable : public wxObject -{ -public: - wxStringHashTable(size_t sizeTable = wxHASH_SIZE_DEFAULT); - virtual ~wxStringHashTable(); - - // add a string associated with this key to the table - void Put(long key, const wxString& value); - - // get the string from the key: if not found, an empty string is returned - // and the wasFound is set to false if not NULL - wxString Get(long key, bool *wasFound = NULL) const; - - // remove the item, returning true if the item was found and deleted - bool Delete(long key) const; - - // clean up - void Destroy(); - -private: - wxArrayLong **m_keys; - wxArrayString **m_values; - - // the size of array above - size_t m_hashSize; - - DECLARE_NO_COPY_CLASS(wxStringHashTable) -}; - -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // !wxUSE_STL - -// ---------------------------------------------------------------------------- -// for compatibility only -// ---------------------------------------------------------------------------- - -#if !wxUSE_OLD_HASH_TABLE - -class WXDLLIMPEXP_BASE wxHashTable_Node : public wxHashTableBase_Node -{ - friend class WXDLLIMPEXP_FWD_BASE wxHashTable; -public: - wxHashTable_Node( long key, void* value, - wxHashTableBase* table ) - : wxHashTableBase_Node( key, value, table ) { } - wxHashTable_Node( const wxChar* key, void* value, - wxHashTableBase* table ) - : wxHashTableBase_Node( key, value, table ) { } - - wxObject* GetData() const - { return (wxObject*)wxHashTableBase_Node::GetData(); } - void SetData( wxObject* data ) - { wxHashTableBase_Node::SetData( data ); } - - wxHashTable_Node* GetNext() const - { return (wxHashTable_Node*)wxHashTableBase_Node::GetNext(); } -}; - -// should inherit protectedly, but it is public for compatibility in -// order to publicly inherit from wxObject -class WXDLLIMPEXP_BASE wxHashTable : public wxHashTableBase -{ - typedef wxHashTableBase hash; -public: - typedef wxHashTable_Node Node; - typedef wxHashTable_Node* compatibility_iterator; -public: - wxHashTable( wxKeyType keyType = wxKEY_INTEGER, - size_t size = wxHASH_SIZE_DEFAULT ) - : wxHashTableBase() { Create( keyType, size ); BeginFind(); } - wxHashTable( const wxHashTable& table ); - - virtual ~wxHashTable() { Destroy(); } - - const wxHashTable& operator=( const wxHashTable& ); - - // key and value are the same - void Put(long value, wxObject *object) - { DoPut( value, value, object ); } - void Put(long lhash, long value, wxObject *object) - { DoPut( value, lhash, object ); } - void Put(const wxChar *value, wxObject *object) - { DoPut( value, MakeKey( value ), object ); } - void Put(long lhash, const wxChar *value, wxObject *object) - { DoPut( value, lhash, object ); } - - // key and value are the same - wxObject *Get(long value) const - { return (wxObject*)DoGet( value, value ); } - wxObject *Get(long lhash, long value) const - { return (wxObject*)DoGet( value, lhash ); } - wxObject *Get(const wxChar *value) const - { return (wxObject*)DoGet( value, MakeKey( value ) ); } - wxObject *Get(long lhash, const wxChar *value) const - { return (wxObject*)DoGet( value, lhash ); } - - // Deletes entry and returns data if found - wxObject *Delete(long key) - { return (wxObject*)DoDelete( key, key ); } - wxObject *Delete(long lhash, long key) - { return (wxObject*)DoDelete( key, lhash ); } - wxObject *Delete(const wxChar *key) - { return (wxObject*)DoDelete( key, MakeKey( key ) ); } - wxObject *Delete(long lhash, const wxChar *key) - { return (wxObject*)DoDelete( key, lhash ); } - - // Construct your own integer key from a string, e.g. in case - // you need to combine it with something - long MakeKey(const wxChar *string) const - { return wxHashTableBase::MakeKey(string); } - - // Way of iterating through whole hash table (e.g. to delete everything) - // Not necessary, of course, if you're only storing pointers to - // objects maintained separately - void BeginFind() { m_curr = NULL; m_currBucket = 0; } - Node* Next(); - - void Clear() { wxHashTableBase::Clear(); } - - size_t GetCount() const { return wxHashTableBase::GetCount(); } -protected: - // copy helper - void DoCopy( const wxHashTable& copy ); - - // searches the next node starting from bucket bucketStart and sets - // m_curr to it and m_currBucket to its bucket - void GetNextNode( size_t bucketStart ); -private: - virtual void DoDeleteContents( wxHashTableBase_Node* node ); - - // current node - Node* m_curr; - - // bucket the current node belongs to - size_t m_currBucket; -}; - -#else // if wxUSE_OLD_HASH_TABLE - -class WXDLLIMPEXP_BASE wxHashTable : public wxObject -{ -public: - typedef wxNode Node; - typedef wxNode* compatibility_iterator; - - int n; - int current_position; - wxNode *current_node; - - unsigned int key_type; - wxList **hash_table; - - wxHashTable(int the_key_type = wxKEY_INTEGER, - int size = wxHASH_SIZE_DEFAULT); - virtual ~wxHashTable(); - - // copy ctor and assignment operator - wxHashTable(const wxHashTable& table) : wxObject() - { DoCopy(table); } - wxHashTable& operator=(const wxHashTable& table) - { Clear(); DoCopy(table); return *this; } - - void DoCopy(const wxHashTable& table); - - void Destroy(); - - bool Create(int the_key_type = wxKEY_INTEGER, - int size = wxHASH_SIZE_DEFAULT); - - // Note that there are 2 forms of Put, Get. - // With a key and a value, the *value* will be checked - // when a collision is detected. Otherwise, if there are - // 2 items with a different value but the same key, - // we'll retrieve the WRONG ONE. So where possible, - // supply the required value along with the key. - // In fact, the value-only versions make a key, and still store - // the value. The use of an explicit key might be required - // e.g. when combining several values into one key. - // When doing that, it's highly likely we'll get a collision, - // e.g. 1 + 2 = 3, 2 + 1 = 3. - - // key and value are NOT necessarily the same - void Put(long key, long value, wxObject *object); - void Put(long key, const wxChar *value, wxObject *object); - - // key and value are the same - void Put(long value, wxObject *object); - void Put(const wxChar *value, wxObject *object); - - // key and value not the same - wxObject *Get(long key, long value) const; - wxObject *Get(long key, const wxChar *value) const; - - // key and value are the same - wxObject *Get(long value) const; - wxObject *Get(const wxChar *value) const; - - // Deletes entry and returns data if found - wxObject *Delete(long key); - wxObject *Delete(const wxChar *key); - - wxObject *Delete(long key, int value); - wxObject *Delete(long key, const wxChar *value); - - // Construct your own integer key from a string, e.g. in case - // you need to combine it with something - long MakeKey(const wxChar *string) const; - - // Way of iterating through whole hash table (e.g. to delete everything) - // Not necessary, of course, if you're only storing pointers to - // objects maintained separately - - void BeginFind(); - Node* Next(); - - void DeleteContents(bool flag); - void Clear(); - - // Returns number of nodes - size_t GetCount() const { return m_count; } - -private: - size_t m_count; // number of elements in the hashtable - bool m_deleteContents; - - DECLARE_DYNAMIC_CLASS(wxHashTable) -}; - -#endif // wxUSE_OLD_HASH_TABLE - -#if !wxUSE_OLD_HASH_TABLE - -// defines a new type safe hash table which stores the elements of type eltype -// in lists of class listclass -#define _WX_DECLARE_HASH(eltype, dummy, hashclass, classexp) \ - classexp hashclass : public wxHashTableBase \ - { \ - public: \ - hashclass(wxKeyType keyType = wxKEY_INTEGER, \ - size_t size = wxHASH_SIZE_DEFAULT) \ - : wxHashTableBase() { Create(keyType, size); } \ - \ - virtual ~hashclass() { Destroy(); } \ - \ - void Put(long key, eltype *data) { DoPut(key, key, (void*)data); } \ - void Put(long lhash, long key, eltype *data) \ - { DoPut(key, lhash, (void*)data); } \ - eltype *Get(long key) const { return (eltype*)DoGet(key, key); } \ - eltype *Get(long lhash, long key) const \ - { return (eltype*)DoGet(key, lhash); } \ - eltype *Delete(long key) { return (eltype*)DoDelete(key, key); } \ - eltype *Delete(long lhash, long key) \ - { return (eltype*)DoDelete(key, lhash); } \ - private: \ - virtual void DoDeleteContents( wxHashTableBase_Node* node ) \ - { delete (eltype*)node->GetData(); } \ - \ - DECLARE_NO_COPY_CLASS(hashclass) \ - } - -#else // if wxUSE_OLD_HASH_TABLE - -#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \ - classexp hashclass : public wxHashTableBase \ - { \ - public: \ - hashclass(wxKeyType keyType = wxKEY_INTEGER, \ - size_t size = wxHASH_SIZE_DEFAULT) \ - { Create(keyType, size); } \ - \ - virtual ~hashclass() { Destroy(); } \ - \ - void Put(long key, long val, eltype *data) { DoPut(key, val, data); } \ - void Put(long key, eltype *data) { DoPut(key, key, data); } \ - \ - eltype *Get(long key, long value) const \ - { \ - wxNodeBase *node = GetNode(key, value); \ - return node ? ((listclass::Node *)node)->GetData() : (eltype *)0; \ - } \ - eltype *Get(long key) const { return Get(key, key); } \ - \ - eltype *Delete(long key, long value) \ - { \ - eltype *data; \ - \ - wxNodeBase *node = GetNode(key, value); \ - if ( node ) \ - { \ - data = ((listclass::Node *)node)->GetData(); \ - \ - delete node; \ - m_count--; \ - } \ - else \ - { \ - data = (eltype *)0; \ - } \ - \ - return data; \ - } \ - eltype *Delete(long key) { return Delete(key, key); } \ - \ - protected: \ - void DoPut(long key, long value, eltype *data) \ - { \ - size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); \ - \ - if ( !m_hashTable[slot] ) \ - { \ - m_hashTable[slot] = new listclass(m_keyType); \ - if ( m_deleteContents ) \ - m_hashTable[slot]->DeleteContents(true); \ - } \ - \ - ((listclass *)m_hashTable[slot])->Append(value, data); \ - m_count++; \ - } \ - \ - DECLARE_NO_COPY_CLASS(hashclass) \ - } - -#endif // wxUSE_OLD_HASH_TABLE - -// this macro is to be used in the user code -#define WX_DECLARE_HASH(el, list, hash) \ - _WX_DECLARE_HASH(el, list, hash, class) - -// and this one does exactly the same thing but should be used inside the -// library -#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \ - _WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT) - -#define WX_DECLARE_USER_EXPORTED_HASH(el, list, hash, usergoo) \ - _WX_DECLARE_HASH(el, list, hash, class usergoo) - -// delete all hash elements -// -// NB: the class declaration of the hash elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_HASH_TABLE(hash) \ - { \ - (hash).BeginFind(); \ - wxHashTable::compatibility_iterator it = (hash).Next(); \ - while( it ) \ - { \ - delete it->GetData(); \ - it = (hash).Next(); \ - } \ - (hash).Clear(); \ - } - -#endif - // _WX_HASH_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hash.h +// Purpose: wxHashTable class +// Author: Julian Smart +// Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() +// Created: 01/02/97 +// RCS-ID: $Id: hash.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HASH_H__ +#define _WX_HASH_H__ + +#include "wx/defs.h" + +#if !wxUSE_STL && WXWIN_COMPATIBILITY_2_4 + #define wxUSE_OLD_HASH_TABLE 1 +#else + #define wxUSE_OLD_HASH_TABLE 0 +#endif + +#if !wxUSE_STL + #include "wx/object.h" +#else + class WXDLLIMPEXP_BASE wxObject; +#endif +#if wxUSE_OLD_HASH_TABLE + #include "wx/list.h" +#endif +#if WXWIN_COMPATIBILITY_2_4 + #include "wx/dynarray.h" +#endif + +// the default size of the hash +#define wxHASH_SIZE_DEFAULT (1000) + +/* + * A hash table is an array of user-definable size with lists + * of data items hanging off the array positions. Usually there'll + * be a hit, so no search is required; otherwise we'll have to run down + * the list to find the desired item. +*/ + +// ---------------------------------------------------------------------------- +// this is the base class for object hashes: hash tables which contain +// pointers to objects +// ---------------------------------------------------------------------------- + +#if wxUSE_OLD_HASH_TABLE + +class WXDLLIMPEXP_BASE wxHashTableBase : public wxObject +{ +public: + wxHashTableBase(); + + void Create(wxKeyType keyType = wxKEY_INTEGER, + size_t size = wxHASH_SIZE_DEFAULT); + void Destroy(); + + size_t GetSize() const { return m_hashSize; } + size_t GetCount() const { return m_count; } + + void DeleteContents(bool flag); + +protected: + // find the node for (key, value) + wxNodeBase *GetNode(long key, long value) const; + + // the array of lists in which we store the values for given key hash + wxListBase **m_hashTable; + + // the size of m_lists array + size_t m_hashSize; + + // the type of indexing we use + wxKeyType m_keyType; + + // the total number of elements in the hash + size_t m_count; + + // should we delete our data? + bool m_deleteContents; + +private: + // no copy ctor/assignment operator (yet) + DECLARE_NO_COPY_CLASS(wxHashTableBase) +}; + +#else // if !wxUSE_OLD_HASH_TABLE + +#if !defined(wxENUM_KEY_TYPE_DEFINED) +#define wxENUM_KEY_TYPE_DEFINED + +enum wxKeyType +{ + wxKEY_NONE, + wxKEY_INTEGER, + wxKEY_STRING +}; + +#endif + +union wxHashKeyValue +{ + long integer; + wxChar *string; +}; + +// for some compilers (AIX xlC), defining it as friend inside the class is not +// enough, so provide a real forward declaration +class WXDLLIMPEXP_FWD_BASE wxHashTableBase; + +class WXDLLIMPEXP_BASE wxHashTableBase_Node +{ + friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase; + typedef class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node _Node; +public: + wxHashTableBase_Node( long key, void* value, + wxHashTableBase* table ); + wxHashTableBase_Node( const wxChar* key, void* value, + wxHashTableBase* table ); + ~wxHashTableBase_Node(); + + long GetKeyInteger() const { return m_key.integer; } + const wxChar* GetKeyString() const { return m_key.string; } + + void* GetData() const { return m_value; } + void SetData( void* data ) { m_value = data; } + +protected: + _Node* GetNext() const { return m_next; } + +protected: + // next node in the chain + wxHashTableBase_Node* m_next; + + // key + wxHashKeyValue m_key; + + // value + void* m_value; + + // pointer to the hash containing the node, used to remove the + // node from the hash when the user deletes the node iterating + // through it + // TODO: move it to wxHashTable_Node (only wxHashTable supports + // iteration) + wxHashTableBase* m_hashPtr; +}; + +class WXDLLIMPEXP_BASE wxHashTableBase +#if !wxUSE_STL + : public wxObject +#endif +{ + friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node; +public: + typedef wxHashTableBase_Node Node; + + wxHashTableBase(); + virtual ~wxHashTableBase() { } + + void Create( wxKeyType keyType = wxKEY_INTEGER, + size_t size = wxHASH_SIZE_DEFAULT ); + void Clear(); + void Destroy(); + + size_t GetSize() const { return m_size; } + size_t GetCount() const { return m_count; } + + void DeleteContents( bool flag ) { m_deleteContents = flag; } + + static long MakeKey(const wxChar *string); + +protected: + void DoPut( long key, long hash, void* data ); + void DoPut( const wxChar* key, long hash, void* data ); + void* DoGet( long key, long hash ) const; + void* DoGet( const wxChar* key, long hash ) const; + void* DoDelete( long key, long hash ); + void* DoDelete( const wxChar* key, long hash ); + +private: + // Remove the node from the hash, *only called from + // ~wxHashTable*_Node destructor + void DoRemoveNode( wxHashTableBase_Node* node ); + + // destroys data contained in the node if appropriate: + // deletes the key if it is a string and destrys + // the value if m_deleteContents is true + void DoDestroyNode( wxHashTableBase_Node* node ); + + // inserts a node in the table (at the end of the chain) + void DoInsertNode( size_t bucket, wxHashTableBase_Node* node ); + + // removes a node from the table (fiven a pointer to the previous + // but does not delete it (only deletes its contents) + void DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, + wxHashTableBase_Node* prev ); + + // unconditionally deletes node value (invoking the + // correct destructor) + virtual void DoDeleteContents( wxHashTableBase_Node* node ) = 0; + +protected: + // number of buckets + size_t m_size; + + // number of nodes (key/value pairs) + size_t m_count; + + // table + Node** m_table; + + // key typ (INTEGER/STRING) + wxKeyType m_keyType; + + // delete contents when hash is cleared + bool m_deleteContents; + +private: + DECLARE_NO_COPY_CLASS(wxHashTableBase) +}; + +#endif // wxUSE_OLD_HASH_TABLE + +#if !wxUSE_STL + +#if WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// a hash table which stores longs +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxHashTableLong : public wxObject +{ +public: + wxHashTableLong(size_t size = wxHASH_SIZE_DEFAULT) + { Init(size); } + virtual ~wxHashTableLong(); + + void Create(size_t size = wxHASH_SIZE_DEFAULT); + void Destroy(); + + size_t GetSize() const { return m_hashSize; } + size_t GetCount() const { return m_count; } + + void Put(long key, long value); + long Get(long key) const; + long Delete(long key); + +protected: + void Init(size_t size); + +private: + wxArrayLong **m_values, + **m_keys; + + // the size of array above + size_t m_hashSize; + + // the total number of elements in the hash + size_t m_count; + + // not implemented yet + DECLARE_NO_COPY_CLASS(wxHashTableLong) +}; + +// ---------------------------------------------------------------------------- +// wxStringHashTable: a hash table which indexes strings with longs +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringHashTable : public wxObject +{ +public: + wxStringHashTable(size_t sizeTable = wxHASH_SIZE_DEFAULT); + virtual ~wxStringHashTable(); + + // add a string associated with this key to the table + void Put(long key, const wxString& value); + + // get the string from the key: if not found, an empty string is returned + // and the wasFound is set to false if not NULL + wxString Get(long key, bool *wasFound = NULL) const; + + // remove the item, returning true if the item was found and deleted + bool Delete(long key) const; + + // clean up + void Destroy(); + +private: + wxArrayLong **m_keys; + wxArrayString **m_values; + + // the size of array above + size_t m_hashSize; + + DECLARE_NO_COPY_CLASS(wxStringHashTable) +}; + +#endif // WXWIN_COMPATIBILITY_2_4 + +#endif // !wxUSE_STL + +// ---------------------------------------------------------------------------- +// for compatibility only +// ---------------------------------------------------------------------------- + +#if !wxUSE_OLD_HASH_TABLE + +class WXDLLIMPEXP_BASE wxHashTable_Node : public wxHashTableBase_Node +{ + friend class WXDLLIMPEXP_FWD_BASE wxHashTable; +public: + wxHashTable_Node( long key, void* value, + wxHashTableBase* table ) + : wxHashTableBase_Node( key, value, table ) { } + wxHashTable_Node( const wxChar* key, void* value, + wxHashTableBase* table ) + : wxHashTableBase_Node( key, value, table ) { } + + wxObject* GetData() const + { return (wxObject*)wxHashTableBase_Node::GetData(); } + void SetData( wxObject* data ) + { wxHashTableBase_Node::SetData( data ); } + + wxHashTable_Node* GetNext() const + { return (wxHashTable_Node*)wxHashTableBase_Node::GetNext(); } +}; + +// should inherit protectedly, but it is public for compatibility in +// order to publicly inherit from wxObject +class WXDLLIMPEXP_BASE wxHashTable : public wxHashTableBase +{ + typedef wxHashTableBase hash; +public: + typedef wxHashTable_Node Node; + typedef wxHashTable_Node* compatibility_iterator; +public: + wxHashTable( wxKeyType keyType = wxKEY_INTEGER, + size_t size = wxHASH_SIZE_DEFAULT ) + : wxHashTableBase() { Create( keyType, size ); BeginFind(); } + wxHashTable( const wxHashTable& table ); + + virtual ~wxHashTable() { Destroy(); } + + const wxHashTable& operator=( const wxHashTable& ); + + // key and value are the same + void Put(long value, wxObject *object) + { DoPut( value, value, object ); } + void Put(long lhash, long value, wxObject *object) + { DoPut( value, lhash, object ); } + void Put(const wxChar *value, wxObject *object) + { DoPut( value, MakeKey( value ), object ); } + void Put(long lhash, const wxChar *value, wxObject *object) + { DoPut( value, lhash, object ); } + + // key and value are the same + wxObject *Get(long value) const + { return (wxObject*)DoGet( value, value ); } + wxObject *Get(long lhash, long value) const + { return (wxObject*)DoGet( value, lhash ); } + wxObject *Get(const wxChar *value) const + { return (wxObject*)DoGet( value, MakeKey( value ) ); } + wxObject *Get(long lhash, const wxChar *value) const + { return (wxObject*)DoGet( value, lhash ); } + + // Deletes entry and returns data if found + wxObject *Delete(long key) + { return (wxObject*)DoDelete( key, key ); } + wxObject *Delete(long lhash, long key) + { return (wxObject*)DoDelete( key, lhash ); } + wxObject *Delete(const wxChar *key) + { return (wxObject*)DoDelete( key, MakeKey( key ) ); } + wxObject *Delete(long lhash, const wxChar *key) + { return (wxObject*)DoDelete( key, lhash ); } + + // Construct your own integer key from a string, e.g. in case + // you need to combine it with something + long MakeKey(const wxChar *string) const + { return wxHashTableBase::MakeKey(string); } + + // Way of iterating through whole hash table (e.g. to delete everything) + // Not necessary, of course, if you're only storing pointers to + // objects maintained separately + void BeginFind() { m_curr = NULL; m_currBucket = 0; } + Node* Next(); + + void Clear() { wxHashTableBase::Clear(); } + + size_t GetCount() const { return wxHashTableBase::GetCount(); } +protected: + // copy helper + void DoCopy( const wxHashTable& copy ); + + // searches the next node starting from bucket bucketStart and sets + // m_curr to it and m_currBucket to its bucket + void GetNextNode( size_t bucketStart ); +private: + virtual void DoDeleteContents( wxHashTableBase_Node* node ); + + // current node + Node* m_curr; + + // bucket the current node belongs to + size_t m_currBucket; +}; + +#else // if wxUSE_OLD_HASH_TABLE + +class WXDLLIMPEXP_BASE wxHashTable : public wxObject +{ +public: + typedef wxNode Node; + typedef wxNode* compatibility_iterator; + + int n; + int current_position; + wxNode *current_node; + + unsigned int key_type; + wxList **hash_table; + + wxHashTable(int the_key_type = wxKEY_INTEGER, + int size = wxHASH_SIZE_DEFAULT); + virtual ~wxHashTable(); + + // copy ctor and assignment operator + wxHashTable(const wxHashTable& table) : wxObject() + { DoCopy(table); } + wxHashTable& operator=(const wxHashTable& table) + { Clear(); DoCopy(table); return *this; } + + void DoCopy(const wxHashTable& table); + + void Destroy(); + + bool Create(int the_key_type = wxKEY_INTEGER, + int size = wxHASH_SIZE_DEFAULT); + + // Note that there are 2 forms of Put, Get. + // With a key and a value, the *value* will be checked + // when a collision is detected. Otherwise, if there are + // 2 items with a different value but the same key, + // we'll retrieve the WRONG ONE. So where possible, + // supply the required value along with the key. + // In fact, the value-only versions make a key, and still store + // the value. The use of an explicit key might be required + // e.g. when combining several values into one key. + // When doing that, it's highly likely we'll get a collision, + // e.g. 1 + 2 = 3, 2 + 1 = 3. + + // key and value are NOT necessarily the same + void Put(long key, long value, wxObject *object); + void Put(long key, const wxChar *value, wxObject *object); + + // key and value are the same + void Put(long value, wxObject *object); + void Put(const wxChar *value, wxObject *object); + + // key and value not the same + wxObject *Get(long key, long value) const; + wxObject *Get(long key, const wxChar *value) const; + + // key and value are the same + wxObject *Get(long value) const; + wxObject *Get(const wxChar *value) const; + + // Deletes entry and returns data if found + wxObject *Delete(long key); + wxObject *Delete(const wxChar *key); + + wxObject *Delete(long key, int value); + wxObject *Delete(long key, const wxChar *value); + + // Construct your own integer key from a string, e.g. in case + // you need to combine it with something + long MakeKey(const wxChar *string) const; + + // Way of iterating through whole hash table (e.g. to delete everything) + // Not necessary, of course, if you're only storing pointers to + // objects maintained separately + + void BeginFind(); + Node* Next(); + + void DeleteContents(bool flag); + void Clear(); + + // Returns number of nodes + size_t GetCount() const { return m_count; } + +private: + size_t m_count; // number of elements in the hashtable + bool m_deleteContents; + + DECLARE_DYNAMIC_CLASS(wxHashTable) +}; + +#endif // wxUSE_OLD_HASH_TABLE + +#if !wxUSE_OLD_HASH_TABLE + +// defines a new type safe hash table which stores the elements of type eltype +// in lists of class listclass +#define _WX_DECLARE_HASH(eltype, dummy, hashclass, classexp) \ + classexp hashclass : public wxHashTableBase \ + { \ + public: \ + hashclass(wxKeyType keyType = wxKEY_INTEGER, \ + size_t size = wxHASH_SIZE_DEFAULT) \ + : wxHashTableBase() { Create(keyType, size); } \ + \ + virtual ~hashclass() { Destroy(); } \ + \ + void Put(long key, eltype *data) { DoPut(key, key, (void*)data); } \ + void Put(long lhash, long key, eltype *data) \ + { DoPut(key, lhash, (void*)data); } \ + eltype *Get(long key) const { return (eltype*)DoGet(key, key); } \ + eltype *Get(long lhash, long key) const \ + { return (eltype*)DoGet(key, lhash); } \ + eltype *Delete(long key) { return (eltype*)DoDelete(key, key); } \ + eltype *Delete(long lhash, long key) \ + { return (eltype*)DoDelete(key, lhash); } \ + private: \ + virtual void DoDeleteContents( wxHashTableBase_Node* node ) \ + { delete (eltype*)node->GetData(); } \ + \ + DECLARE_NO_COPY_CLASS(hashclass) \ + } + +#else // if wxUSE_OLD_HASH_TABLE + +#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \ + classexp hashclass : public wxHashTableBase \ + { \ + public: \ + hashclass(wxKeyType keyType = wxKEY_INTEGER, \ + size_t size = wxHASH_SIZE_DEFAULT) \ + { Create(keyType, size); } \ + \ + virtual ~hashclass() { Destroy(); } \ + \ + void Put(long key, long val, eltype *data) { DoPut(key, val, data); } \ + void Put(long key, eltype *data) { DoPut(key, key, data); } \ + \ + eltype *Get(long key, long value) const \ + { \ + wxNodeBase *node = GetNode(key, value); \ + return node ? ((listclass::Node *)node)->GetData() : (eltype *)0; \ + } \ + eltype *Get(long key) const { return Get(key, key); } \ + \ + eltype *Delete(long key, long value) \ + { \ + eltype *data; \ + \ + wxNodeBase *node = GetNode(key, value); \ + if ( node ) \ + { \ + data = ((listclass::Node *)node)->GetData(); \ + \ + delete node; \ + m_count--; \ + } \ + else \ + { \ + data = (eltype *)0; \ + } \ + \ + return data; \ + } \ + eltype *Delete(long key) { return Delete(key, key); } \ + \ + protected: \ + void DoPut(long key, long value, eltype *data) \ + { \ + size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); \ + \ + if ( !m_hashTable[slot] ) \ + { \ + m_hashTable[slot] = new listclass(m_keyType); \ + if ( m_deleteContents ) \ + m_hashTable[slot]->DeleteContents(true); \ + } \ + \ + ((listclass *)m_hashTable[slot])->Append(value, data); \ + m_count++; \ + } \ + \ + DECLARE_NO_COPY_CLASS(hashclass) \ + } + +#endif // wxUSE_OLD_HASH_TABLE + +// this macro is to be used in the user code +#define WX_DECLARE_HASH(el, list, hash) \ + _WX_DECLARE_HASH(el, list, hash, class) + +// and this one does exactly the same thing but should be used inside the +// library +#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \ + _WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT) + +#define WX_DECLARE_USER_EXPORTED_HASH(el, list, hash, usergoo) \ + _WX_DECLARE_HASH(el, list, hash, class usergoo) + +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_TABLE(hash) \ + { \ + (hash).BeginFind(); \ + wxHashTable::compatibility_iterator it = (hash).Next(); \ + while( it ) \ + { \ + delete it->GetData(); \ + it = (hash).Next(); \ + } \ + (hash).Clear(); \ + } + +#endif + // _WX_HASH_H__ diff --git a/Externals/wxWidgets/include/wx/hashmap.h b/Externals/wxWidgets/include/wx/hashmap.h index 0ac76c5658..11fca62306 100644 --- a/Externals/wxWidgets/include/wx/hashmap.h +++ b/Externals/wxWidgets/include/wx/hashmap.h @@ -1,718 +1,718 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hashmap.h -// Purpose: wxHashMap class -// Author: Mattia Barbon -// Modified by: -// Created: 29/01/2002 -// RCS-ID: $Id: hashmap.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HASHMAP_H_ -#define _WX_HASHMAP_H_ - -#include "wx/string.h" - -#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \ - && (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP)) - #define HAVE_STL_HASH_MAP -#endif - -#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) - -#if defined(HAVE_EXT_HASH_MAP) - #include -#elif defined(HAVE_HASH_MAP) - #include -#endif - -#if defined(HAVE_GNU_CXX_HASH_MAP) - #define WX_HASH_MAP_NAMESPACE __gnu_cxx -#elif defined(HAVE_STD_HASH_MAP) - #define WX_HASH_MAP_NAMESPACE std -#endif - -#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ - typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME - -#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - - -#ifdef __WXWINCE__ -typedef int ptrdiff_t; -#else -#include // for ptrdiff_t -#endif - -// private -struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase -{ - _wxHashTable_NodeBase() : m_nxt(0) {} - - _wxHashTable_NodeBase* m_nxt; - -// Cannot do this: -// DECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase) -// without rewriting the macros, which require a public copy constructor. -}; - -// private -class WXDLLIMPEXP_BASE _wxHashTableBase2 -{ -public: - typedef void (*NodeDtor)(_wxHashTable_NodeBase*); - typedef unsigned long (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*); - typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*); -protected: - static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node); - static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table, - NodeDtor dtor ); - static _wxHashTable_NodeBase* GetFirstNode( size_t buckets, - _wxHashTable_NodeBase** table ) - { - for( size_t i = 0; i < buckets; ++i ) - if( table[i] ) - return table[i]; - return 0; - } - - // as static const unsigned prime_count = 31 but works with all compilers - enum { prime_count = 31 }; - static const unsigned long ms_primes[prime_count]; - - // returns the first prime in ms_primes greater than n - static unsigned long GetNextPrime( unsigned long n ); - - // returns the first prime in ms_primes smaller than n - // ( or ms_primes[0] if n is very small ) - static unsigned long GetPreviousPrime( unsigned long n ); - - static void CopyHashTable( _wxHashTable_NodeBase** srcTable, - size_t srcBuckets, _wxHashTableBase2* dst, - _wxHashTable_NodeBase** dstTable, - BucketFromNode func, ProcessNode proc ); - - static void** AllocTable( size_t sz ) - { - return (void **)calloc(sz, sizeof(void*)); - } - static void FreeTable(void *table) - { - free(table); - } -}; - -#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T, CLASSNAME, CLASSEXP, SHOULD_GROW, SHOULD_SHRINK ) \ -CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ -{ \ -public: \ - typedef KEY_T key_type; \ - typedef VALUE_T value_type; \ - typedef HASH_T hasher; \ - typedef KEY_EQ_T key_equal; \ - \ - typedef size_t size_type; \ - typedef ptrdiff_t difference_type; \ - typedef value_type* pointer; \ - typedef const value_type* const_pointer; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - /* should these be protected? */ \ - typedef const KEY_T const_key_type; \ - typedef const VALUE_T const_mapped_type; \ -public: \ - struct Node; \ - typedef KEY_EX_T key_extractor; \ - typedef CLASSNAME Self; \ -protected: \ - Node** m_table; \ - size_t m_tableBuckets; \ - size_t m_items; \ - hasher m_hasher; \ - key_equal m_equals; \ - key_extractor m_getKey; \ -public: \ - struct Node:public _wxHashTable_NodeBase \ - { \ - public: \ - Node( const value_type& value ) \ - : m_value( value ) {} \ - Node* m_next() { return (Node*)this->m_nxt; } \ - \ - value_type m_value; \ - }; \ - \ - CLASSEXP Iterator; \ - friend CLASSEXP Iterator; \ -protected: \ - static void DeleteNode( _wxHashTable_NodeBase* node ) \ - { \ - delete (Node*)node; \ - } \ -public: \ - /* */ \ - /* forward iterator */ \ - /* */ \ - CLASSEXP Iterator \ - { \ - public: \ - Node* m_node; \ - Self* m_ht; \ - \ - Iterator() : m_node(0), m_ht(0) {} \ - Iterator( Node* node, const Self* ht ) \ - : m_node(node), m_ht((Self*)ht) {} \ - bool operator ==( const Iterator& it ) const \ - { return m_node == it.m_node; } \ - bool operator !=( const Iterator& it ) const \ - { return m_node != it.m_node; } \ - protected: \ - Node* GetNextNode() \ - { \ - size_type bucket = GetBucketForNode(m_ht,m_node); \ - for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \ - { \ - if( m_ht->m_table[i] ) \ - return m_ht->m_table[i]; \ - } \ - return 0; \ - } \ - \ - void PlusPlus() \ - { \ - Node* next = m_node->m_next(); \ - m_node = next ? next : GetNextNode(); \ - } \ - }; \ - \ -public: \ - CLASSEXP iterator : public Iterator \ - { \ - public: \ - iterator() : Iterator() {} \ - iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \ - iterator& operator++() { PlusPlus(); return *this; } \ - iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ - reference operator *() const { return m_node->m_value; } \ - pointer operator ->() const { return &(m_node->m_value); } \ - }; \ - \ - CLASSEXP const_iterator : public Iterator \ - { \ - public: \ - const_iterator() : Iterator() {} \ - const_iterator(iterator i) : Iterator(i) {} \ - const_iterator( Node* node, const Self* ht ) \ - : Iterator( node, (Self*)ht ) {} \ - const_iterator& operator++() { PlusPlus();return *this; } \ - const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ - const_reference operator *() const { return m_node->m_value; } \ - const_pointer operator ->() const { return &(m_node->m_value); } \ - }; \ - \ - CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ - const key_equal& k_eq = key_equal(), \ - const key_extractor& k_ex = key_extractor() ) \ - : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ - m_items( 0 ), \ - m_hasher( hfun ), \ - m_equals( k_eq ), \ - m_getKey( k_ex ) \ - { \ - m_table = (Node**)AllocTable( m_tableBuckets ); \ - } \ - \ - CLASSNAME( const Self& ht ) \ - : m_table( 0 ), \ - m_tableBuckets( 0 ), \ - m_items( ht.m_items ), \ - m_hasher( ht.m_hasher ), \ - m_equals( ht.m_equals ), \ - m_getKey( ht.m_getKey ) \ - { \ - HashCopy( ht ); \ - } \ - \ - const Self& operator=( const Self& ht ) \ - { \ - clear(); \ - m_hasher = ht.m_hasher; \ - m_equals = ht.m_equals; \ - m_getKey = ht.m_getKey; \ - m_items = ht.m_items; \ - HashCopy( ht ); \ - return *this; \ - } \ - \ - ~CLASSNAME() \ - { \ - clear(); \ - \ - FreeTable(m_table); \ - } \ - \ - hasher hash_funct() { return m_hasher; } \ - key_equal key_eq() { return m_equals; } \ - \ - /* removes all elements from the hash table, but does not */ \ - /* shrink it ( perhaps it should ) */ \ - void clear() \ - { \ - DeleteNodes( m_tableBuckets, (_wxHashTable_NodeBase**)m_table, \ - DeleteNode ); \ - m_items = 0; \ - } \ - \ - size_type size() const { return m_items; } \ - size_type max_size() const { return size_type(-1); } \ - bool empty() const { return size() == 0; } \ - \ - const_iterator end() const { return const_iterator( 0, this ); } \ - iterator end() { return iterator( 0, this ); } \ - const_iterator begin() const \ - { return const_iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ - iterator begin() \ - { return iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ - \ - size_type erase( const const_key_type& key ) \ - { \ - Node** node = GetNodePtr( key ); \ - \ - if( !node ) \ - return 0; \ - \ - --m_items; \ - Node* temp = (*node)->m_next(); \ - delete *node; \ - (*node) = temp; \ - if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ - ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ - return 1; \ - } \ - \ -protected: \ - static size_type GetBucketForNode( Self* ht, Node* node ) \ - { \ - return ht->m_hasher( ht->m_getKey( node->m_value ) ) \ - % ht->m_tableBuckets; \ - } \ - static Node* CopyNode( Node* node ) { return new Node( *node ); } \ - \ - Node* GetOrCreateNode( const value_type& value, bool& created ) \ - { \ - const const_key_type& key = m_getKey( value ); \ - size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node* node = m_table[bucket]; \ - \ - while( node ) \ - { \ - if( m_equals( m_getKey( node->m_value ), key ) ) \ - { \ - created = false; \ - return node; \ - } \ - node = node->m_next(); \ - } \ - created = true; \ - return CreateNode( value, bucket); \ - }\ - Node * CreateNode( const value_type& value, size_t bucket ) \ - {\ - Node* node = new Node( value ); \ - node->m_nxt = m_table[bucket]; \ - m_table[bucket] = node; \ - \ - /* must be after the node is inserted */ \ - ++m_items; \ - if( SHOULD_GROW( m_tableBuckets, m_items ) ) \ - ResizeTable( m_tableBuckets ); \ - \ - return node; \ - } \ - void CreateNode( const value_type& value ) \ - {\ - CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \ - }\ - \ - /* returns NULL if not found */ \ - Node** GetNodePtr( const const_key_type& key ) const \ - { \ - size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node** node = &m_table[bucket]; \ - \ - while( *node ) \ - { \ - if( m_equals( m_getKey( (*node)->m_value ), key ) ) \ - return node; \ - /* Tell the compiler to not do any strict-aliasing assumptions with a void cast? Can we make such a runtime guarantee? */ \ - node = (Node**)&(*node)->m_nxt; \ - } \ - \ - return NULL; \ - } \ - \ - /* returns NULL if not found */ \ - /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ - Node* GetNode( const const_key_type& key ) const \ - { \ - size_t bucket = m_hasher( key ) % m_tableBuckets; \ - Node* node = m_table[bucket]; \ - \ - while( node ) \ - { \ - if( m_equals( m_getKey( node->m_value ), key ) ) \ - return node; \ - node = node->m_next(); \ - } \ - \ - return 0; \ - } \ - \ - void ResizeTable( size_t newSize ) \ - { \ - newSize = GetNextPrime( (unsigned long)newSize ); \ - Node** srcTable = m_table; \ - size_t srcBuckets = m_tableBuckets; \ - m_table = (Node**)AllocTable( newSize ); \ - m_tableBuckets = newSize; \ - \ - CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \ - this, (_wxHashTable_NodeBase**)m_table, \ - (BucketFromNode)GetBucketForNode,\ - (ProcessNode)&DummyProcessNode ); \ - FreeTable(srcTable); \ - } \ - \ - /* this must be called _after_ m_table has been cleaned */ \ - void HashCopy( const Self& ht ) \ - { \ - ResizeTable( ht.size() ); \ - CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\ - (_wxHashTableBase2*)this, \ - (_wxHashTable_NodeBase**)m_table, \ - (BucketFromNode)GetBucketForNode, \ - (ProcessNode)CopyNode ); \ - } \ -}; - -// defines an STL-like pair class CLASSNAME storing two fields: first of type -// KEY_T and second of type VALUE_T -#define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ -{ \ -public: \ - typedef KEY_T t1; \ - typedef VALUE_T t2; \ - typedef const KEY_T const_t1; \ - typedef const VALUE_T const_t2; \ - \ - CLASSNAME( const const_t1& f, const const_t2& s ):first(t1(f)),second(t2(s)) {} \ - \ - t1 first; \ - t2 second; \ -}; - -// defines the class CLASSNAME returning the key part (of type KEY_T) from a -// pair of type PAIR_T -#define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ -{ \ - typedef KEY_T key_type; \ - typedef PAIR_T pair_type; \ - typedef const key_type const_key_type; \ - typedef const pair_type const_pair_type; \ - typedef const_key_type& const_key_reference; \ - typedef const_pair_type& const_pair_reference; \ -public: \ - CLASSNAME() { } \ - const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\ - \ - /* the dummy assignment operator is needed to suppress compiler */ \ - /* warnings from hash table class' operator=(): gcc complains about */ \ - /* "statement with no effect" without it */ \ - CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ -}; - -// grow/shrink predicates -inline bool never_grow( size_t, size_t ) { return false; } -inline bool never_shrink( size_t, size_t ) { return false; } -inline bool grow_lf70( size_t buckets, size_t items ) -{ - return float(items)/float(buckets) >= 0.85; -} - -#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// ---------------------------------------------------------------------------- -// hashing and comparison functors -// ---------------------------------------------------------------------------- - -// NB: implementation detail: all of these classes must have dummy assignment -// operators to suppress warnings about "statement with no effect" from gcc -// in the hash table class assignment operator (where they're assigned) - -#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) - -// integer types -class WXDLLIMPEXP_BASE wxIntegerHash -{ - WX_HASH_MAP_NAMESPACE::hash longHash; - WX_HASH_MAP_NAMESPACE::hash ulongHash; - WX_HASH_MAP_NAMESPACE::hash intHash; - WX_HASH_MAP_NAMESPACE::hash uintHash; - WX_HASH_MAP_NAMESPACE::hash shortHash; - WX_HASH_MAP_NAMESPACE::hash ushortHash; - -#if defined wxLongLong_t && !defined wxLongLongIsLong - // hash ought to work but doesn't on some compilers - #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \ - || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2) - size_t longlongHash( wxLongLong_t x ) const - { - return longHash( wx_truncate_cast(long, x) ) ^ - longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) ); - } - #elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG - WX_HASH_MAP_NAMESPACE::hash longlongHash; - #else - WX_HASH_MAP_NAMESPACE::hash longlongHash; - #endif -#endif - -public: - wxIntegerHash() { } - size_t operator()( long x ) const { return longHash( x ); } - size_t operator()( unsigned long x ) const { return ulongHash( x ); } - size_t operator()( int x ) const { return intHash( x ); } - size_t operator()( unsigned int x ) const { return uintHash( x ); } - size_t operator()( short x ) const { return shortHash( x ); } - size_t operator()( unsigned short x ) const { return ushortHash( x ); } -#if defined wxLongLong_t && !defined wxLongLongIsLong - size_t operator()( wxLongLong_t x ) const { return longlongHash(x); } - size_t operator()( wxULongLong_t x ) const { return longlongHash(x); } -#endif - - wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } -}; - -#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// integer types -class WXDLLIMPEXP_BASE wxIntegerHash -{ -public: - wxIntegerHash() { } - unsigned long operator()( long x ) const { return (unsigned long)x; } - unsigned long operator()( unsigned long x ) const { return x; } - unsigned long operator()( int x ) const { return (unsigned long)x; } - unsigned long operator()( unsigned int x ) const { return x; } - unsigned long operator()( short x ) const { return (unsigned long)x; } - unsigned long operator()( unsigned short x ) const { return x; } -#if defined wxLongLong_t && !defined wxLongLongIsLong - wxULongLong_t operator()( wxLongLong_t x ) const { return wx_static_cast(wxULongLong_t, x); } - wxULongLong_t operator()( wxULongLong_t x ) const { return x; } -#endif - - wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } -}; - -#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -class WXDLLIMPEXP_BASE wxIntegerEqual -{ -public: - wxIntegerEqual() { } - bool operator()( long a, long b ) const { return a == b; } - bool operator()( unsigned long a, unsigned long b ) const { return a == b; } - bool operator()( int a, int b ) const { return a == b; } - bool operator()( unsigned int a, unsigned int b ) const { return a == b; } - bool operator()( short a, short b ) const { return a == b; } - bool operator()( unsigned short a, unsigned short b ) const { return a == b; } -#if defined wxLongLong_t && !defined wxLongLongIsLong - bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; } - bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; } -#endif - - wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; } -}; - -// pointers -class WXDLLIMPEXP_BASE wxPointerHash -{ -public: - wxPointerHash() { } - -#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) - size_t operator()( const void* k ) const { return (size_t)k; } -#else - wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } -#endif - - wxPointerHash& operator=(const wxPointerHash&) { return *this; } -}; - -class WXDLLIMPEXP_BASE wxPointerEqual -{ -public: - wxPointerEqual() { } - bool operator()( const void* a, const void* b ) const { return a == b; } - - wxPointerEqual& operator=(const wxPointerEqual&) { return *this; } -}; - -// wxString, char*, wxChar* -class WXDLLIMPEXP_BASE wxStringHash -{ -public: - wxStringHash() {} - unsigned long operator()( const wxString& x ) const - { return wxCharStringHash( x.c_str() ); } - unsigned long operator()( const wxChar* x ) const - { return wxCharStringHash( x ); } - static unsigned long wxCharStringHash( const wxChar* ); -#if wxUSE_UNICODE - unsigned long operator()( const char* x ) const - { return charStringHash( x ); } - static unsigned long charStringHash( const char* ); -#endif // wxUSE_UNICODE - - wxStringHash& operator=(const wxStringHash&) { return *this; } -}; - -class WXDLLIMPEXP_BASE wxStringEqual -{ -public: - wxStringEqual() {} - bool operator()( const wxString& a, const wxString& b ) const - { return a == b; } - bool operator()( const wxChar* a, const wxChar* b ) const - { return wxStrcmp( a, b ) == 0; } -#if wxUSE_UNICODE - bool operator()( const char* a, const char* b ) const - { return strcmp( a, b ) == 0; } -#endif // wxUSE_UNICODE - - wxStringEqual& operator=(const wxStringEqual&) { return *this; } -}; - -#if !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ -_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ -_WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ -CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ -{ \ -public: \ - typedef VALUE_T mapped_type; \ - _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ - \ - wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ - key_equal eq = key_equal() ) \ - : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ - CLASSNAME##_wxImplementation_KeyEx() ) {} \ - \ - mapped_type& operator[]( const const_key_type& key ) \ - { \ - bool created; \ - return GetOrCreateNode( \ - CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \ - created)->m_value.second; \ - } \ - \ - const_iterator find( const const_key_type& key ) const \ - { \ - return const_iterator( GetNode( key ), this ); \ - } \ - \ - iterator find( const const_key_type& key ) \ - { \ - return iterator( GetNode( key ), this ); \ - } \ - \ - Insert_Result insert( const value_type& v ) \ - { \ - bool created; \ - Node *node = GetOrCreateNode( \ - CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \ - created); \ - if ( !created ) \ - node->m_value.second = v.second; \ - return Insert_Result(iterator(node, this), created); \ - } \ - \ - size_type erase( const key_type& k ) \ - { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ - void erase( const iterator& it ) { erase( it->first ); } \ - void erase( const const_iterator& it ) { erase( it->first ); } \ - \ - /* count() == 0 | 1 */ \ - size_type count( const const_key_type& key ) \ - { \ - /* explicit cast needed to suppress CodeWarrior warnings */ \ - return (size_type)(GetNode( key ) ? 1 : 0); \ - } \ -} - -#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// these macros are to be used in the user code -#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) - -#define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ - _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ - CLASSNAME, class ) - -#define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ - _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ - CLASSNAME, class ) - -// and these do exactly the same thing but should be used inside the -// library -#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \ - CLASSNAME, class WXDLLEXPORT ) - -#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ - _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ - CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ - WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ - class WXDLLEXPORT ) - -#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ - _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ - CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ - WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ - class WXDLLEXPORT ) - -// delete all hash elements -// -// NB: the class declaration of the hash elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_HASH_MAP(type, hashmap) \ - { \ - type::iterator it, en; \ - for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \ - delete it->second; \ - (hashmap).clear(); \ - } - -//--------------------------------------------------------------------------- -// Declarations of common hashmap classes - -WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, - wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); - - -#endif // _WX_HASHMAP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hashmap.h +// Purpose: wxHashMap class +// Author: Mattia Barbon +// Modified by: +// Created: 29/01/2002 +// RCS-ID: $Id: hashmap.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HASHMAP_H_ +#define _WX_HASHMAP_H_ + +#include "wx/string.h" + +#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \ + && (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP)) + #define HAVE_STL_HASH_MAP +#endif + +#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) + +#if defined(HAVE_EXT_HASH_MAP) + #include +#elif defined(HAVE_HASH_MAP) + #include +#endif + +#if defined(HAVE_GNU_CXX_HASH_MAP) + #define WX_HASH_MAP_NAMESPACE __gnu_cxx +#elif defined(HAVE_STD_HASH_MAP) + #define WX_HASH_MAP_NAMESPACE std +#endif + +#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ + typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME + +#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + + +#ifdef __WXWINCE__ +typedef int ptrdiff_t; +#else +#include // for ptrdiff_t +#endif + +// private +struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase +{ + _wxHashTable_NodeBase() : m_nxt(0) {} + + _wxHashTable_NodeBase* m_nxt; + +// Cannot do this: +// DECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase) +// without rewriting the macros, which require a public copy constructor. +}; + +// private +class WXDLLIMPEXP_BASE _wxHashTableBase2 +{ +public: + typedef void (*NodeDtor)(_wxHashTable_NodeBase*); + typedef unsigned long (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*); + typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*); +protected: + static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node); + static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table, + NodeDtor dtor ); + static _wxHashTable_NodeBase* GetFirstNode( size_t buckets, + _wxHashTable_NodeBase** table ) + { + for( size_t i = 0; i < buckets; ++i ) + if( table[i] ) + return table[i]; + return 0; + } + + // as static const unsigned prime_count = 31 but works with all compilers + enum { prime_count = 31 }; + static const unsigned long ms_primes[prime_count]; + + // returns the first prime in ms_primes greater than n + static unsigned long GetNextPrime( unsigned long n ); + + // returns the first prime in ms_primes smaller than n + // ( or ms_primes[0] if n is very small ) + static unsigned long GetPreviousPrime( unsigned long n ); + + static void CopyHashTable( _wxHashTable_NodeBase** srcTable, + size_t srcBuckets, _wxHashTableBase2* dst, + _wxHashTable_NodeBase** dstTable, + BucketFromNode func, ProcessNode proc ); + + static void** AllocTable( size_t sz ) + { + return (void **)calloc(sz, sizeof(void*)); + } + static void FreeTable(void *table) + { + free(table); + } +}; + +#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T, CLASSNAME, CLASSEXP, SHOULD_GROW, SHOULD_SHRINK ) \ +CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ +{ \ +public: \ + typedef KEY_T key_type; \ + typedef VALUE_T value_type; \ + typedef HASH_T hasher; \ + typedef KEY_EQ_T key_equal; \ + \ + typedef size_t size_type; \ + typedef ptrdiff_t difference_type; \ + typedef value_type* pointer; \ + typedef const value_type* const_pointer; \ + typedef value_type& reference; \ + typedef const value_type& const_reference; \ + /* should these be protected? */ \ + typedef const KEY_T const_key_type; \ + typedef const VALUE_T const_mapped_type; \ +public: \ + struct Node; \ + typedef KEY_EX_T key_extractor; \ + typedef CLASSNAME Self; \ +protected: \ + Node** m_table; \ + size_t m_tableBuckets; \ + size_t m_items; \ + hasher m_hasher; \ + key_equal m_equals; \ + key_extractor m_getKey; \ +public: \ + struct Node:public _wxHashTable_NodeBase \ + { \ + public: \ + Node( const value_type& value ) \ + : m_value( value ) {} \ + Node* m_next() { return (Node*)this->m_nxt; } \ + \ + value_type m_value; \ + }; \ + \ + CLASSEXP Iterator; \ + friend CLASSEXP Iterator; \ +protected: \ + static void DeleteNode( _wxHashTable_NodeBase* node ) \ + { \ + delete (Node*)node; \ + } \ +public: \ + /* */ \ + /* forward iterator */ \ + /* */ \ + CLASSEXP Iterator \ + { \ + public: \ + Node* m_node; \ + Self* m_ht; \ + \ + Iterator() : m_node(0), m_ht(0) {} \ + Iterator( Node* node, const Self* ht ) \ + : m_node(node), m_ht((Self*)ht) {} \ + bool operator ==( const Iterator& it ) const \ + { return m_node == it.m_node; } \ + bool operator !=( const Iterator& it ) const \ + { return m_node != it.m_node; } \ + protected: \ + Node* GetNextNode() \ + { \ + size_type bucket = GetBucketForNode(m_ht,m_node); \ + for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \ + { \ + if( m_ht->m_table[i] ) \ + return m_ht->m_table[i]; \ + } \ + return 0; \ + } \ + \ + void PlusPlus() \ + { \ + Node* next = m_node->m_next(); \ + m_node = next ? next : GetNextNode(); \ + } \ + }; \ + \ +public: \ + CLASSEXP iterator : public Iterator \ + { \ + public: \ + iterator() : Iterator() {} \ + iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \ + iterator& operator++() { PlusPlus(); return *this; } \ + iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ + reference operator *() const { return m_node->m_value; } \ + pointer operator ->() const { return &(m_node->m_value); } \ + }; \ + \ + CLASSEXP const_iterator : public Iterator \ + { \ + public: \ + const_iterator() : Iterator() {} \ + const_iterator(iterator i) : Iterator(i) {} \ + const_iterator( Node* node, const Self* ht ) \ + : Iterator( node, (Self*)ht ) {} \ + const_iterator& operator++() { PlusPlus();return *this; } \ + const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ + const_reference operator *() const { return m_node->m_value; } \ + const_pointer operator ->() const { return &(m_node->m_value); } \ + }; \ + \ + CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ + const key_equal& k_eq = key_equal(), \ + const key_extractor& k_ex = key_extractor() ) \ + : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ + m_items( 0 ), \ + m_hasher( hfun ), \ + m_equals( k_eq ), \ + m_getKey( k_ex ) \ + { \ + m_table = (Node**)AllocTable( m_tableBuckets ); \ + } \ + \ + CLASSNAME( const Self& ht ) \ + : m_table( 0 ), \ + m_tableBuckets( 0 ), \ + m_items( ht.m_items ), \ + m_hasher( ht.m_hasher ), \ + m_equals( ht.m_equals ), \ + m_getKey( ht.m_getKey ) \ + { \ + HashCopy( ht ); \ + } \ + \ + const Self& operator=( const Self& ht ) \ + { \ + clear(); \ + m_hasher = ht.m_hasher; \ + m_equals = ht.m_equals; \ + m_getKey = ht.m_getKey; \ + m_items = ht.m_items; \ + HashCopy( ht ); \ + return *this; \ + } \ + \ + ~CLASSNAME() \ + { \ + clear(); \ + \ + FreeTable(m_table); \ + } \ + \ + hasher hash_funct() { return m_hasher; } \ + key_equal key_eq() { return m_equals; } \ + \ + /* removes all elements from the hash table, but does not */ \ + /* shrink it ( perhaps it should ) */ \ + void clear() \ + { \ + DeleteNodes( m_tableBuckets, (_wxHashTable_NodeBase**)m_table, \ + DeleteNode ); \ + m_items = 0; \ + } \ + \ + size_type size() const { return m_items; } \ + size_type max_size() const { return size_type(-1); } \ + bool empty() const { return size() == 0; } \ + \ + const_iterator end() const { return const_iterator( 0, this ); } \ + iterator end() { return iterator( 0, this ); } \ + const_iterator begin() const \ + { return const_iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ + iterator begin() \ + { return iterator( (Node*)GetFirstNode( m_tableBuckets, (_wxHashTable_NodeBase**)m_table ), this ); } \ + \ + size_type erase( const const_key_type& key ) \ + { \ + Node** node = GetNodePtr( key ); \ + \ + if( !node ) \ + return 0; \ + \ + --m_items; \ + Node* temp = (*node)->m_next(); \ + delete *node; \ + (*node) = temp; \ + if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ + ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ + return 1; \ + } \ + \ +protected: \ + static size_type GetBucketForNode( Self* ht, Node* node ) \ + { \ + return ht->m_hasher( ht->m_getKey( node->m_value ) ) \ + % ht->m_tableBuckets; \ + } \ + static Node* CopyNode( Node* node ) { return new Node( *node ); } \ + \ + Node* GetOrCreateNode( const value_type& value, bool& created ) \ + { \ + const const_key_type& key = m_getKey( value ); \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node* node = m_table[bucket]; \ + \ + while( node ) \ + { \ + if( m_equals( m_getKey( node->m_value ), key ) ) \ + { \ + created = false; \ + return node; \ + } \ + node = node->m_next(); \ + } \ + created = true; \ + return CreateNode( value, bucket); \ + }\ + Node * CreateNode( const value_type& value, size_t bucket ) \ + {\ + Node* node = new Node( value ); \ + node->m_nxt = m_table[bucket]; \ + m_table[bucket] = node; \ + \ + /* must be after the node is inserted */ \ + ++m_items; \ + if( SHOULD_GROW( m_tableBuckets, m_items ) ) \ + ResizeTable( m_tableBuckets ); \ + \ + return node; \ + } \ + void CreateNode( const value_type& value ) \ + {\ + CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \ + }\ + \ + /* returns NULL if not found */ \ + Node** GetNodePtr( const const_key_type& key ) const \ + { \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node** node = &m_table[bucket]; \ + \ + while( *node ) \ + { \ + if( m_equals( m_getKey( (*node)->m_value ), key ) ) \ + return node; \ + /* Tell the compiler to not do any strict-aliasing assumptions with a void cast? Can we make such a runtime guarantee? */ \ + node = (Node**)&(*node)->m_nxt; \ + } \ + \ + return NULL; \ + } \ + \ + /* returns NULL if not found */ \ + /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ + Node* GetNode( const const_key_type& key ) const \ + { \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node* node = m_table[bucket]; \ + \ + while( node ) \ + { \ + if( m_equals( m_getKey( node->m_value ), key ) ) \ + return node; \ + node = node->m_next(); \ + } \ + \ + return 0; \ + } \ + \ + void ResizeTable( size_t newSize ) \ + { \ + newSize = GetNextPrime( (unsigned long)newSize ); \ + Node** srcTable = m_table; \ + size_t srcBuckets = m_tableBuckets; \ + m_table = (Node**)AllocTable( newSize ); \ + m_tableBuckets = newSize; \ + \ + CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \ + this, (_wxHashTable_NodeBase**)m_table, \ + (BucketFromNode)GetBucketForNode,\ + (ProcessNode)&DummyProcessNode ); \ + FreeTable(srcTable); \ + } \ + \ + /* this must be called _after_ m_table has been cleaned */ \ + void HashCopy( const Self& ht ) \ + { \ + ResizeTable( ht.size() ); \ + CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\ + (_wxHashTableBase2*)this, \ + (_wxHashTable_NodeBase**)m_table, \ + (BucketFromNode)GetBucketForNode, \ + (ProcessNode)CopyNode ); \ + } \ +}; + +// defines an STL-like pair class CLASSNAME storing two fields: first of type +// KEY_T and second of type VALUE_T +#define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ +{ \ +public: \ + typedef KEY_T t1; \ + typedef VALUE_T t2; \ + typedef const KEY_T const_t1; \ + typedef const VALUE_T const_t2; \ + \ + CLASSNAME( const const_t1& f, const const_t2& s ):first(t1(f)),second(t2(s)) {} \ + \ + t1 first; \ + t2 second; \ +}; + +// defines the class CLASSNAME returning the key part (of type KEY_T) from a +// pair of type PAIR_T +#define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ +{ \ + typedef KEY_T key_type; \ + typedef PAIR_T pair_type; \ + typedef const key_type const_key_type; \ + typedef const pair_type const_pair_type; \ + typedef const_key_type& const_key_reference; \ + typedef const_pair_type& const_pair_reference; \ +public: \ + CLASSNAME() { } \ + const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\ + \ + /* the dummy assignment operator is needed to suppress compiler */ \ + /* warnings from hash table class' operator=(): gcc complains about */ \ + /* "statement with no effect" without it */ \ + CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ +}; + +// grow/shrink predicates +inline bool never_grow( size_t, size_t ) { return false; } +inline bool never_shrink( size_t, size_t ) { return false; } +inline bool grow_lf70( size_t buckets, size_t items ) +{ + return float(items)/float(buckets) >= 0.85; +} + +#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +// ---------------------------------------------------------------------------- +// hashing and comparison functors +// ---------------------------------------------------------------------------- + +// NB: implementation detail: all of these classes must have dummy assignment +// operators to suppress warnings about "statement with no effect" from gcc +// in the hash table class assignment operator (where they're assigned) + +#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) + +// integer types +class WXDLLIMPEXP_BASE wxIntegerHash +{ + WX_HASH_MAP_NAMESPACE::hash longHash; + WX_HASH_MAP_NAMESPACE::hash ulongHash; + WX_HASH_MAP_NAMESPACE::hash intHash; + WX_HASH_MAP_NAMESPACE::hash uintHash; + WX_HASH_MAP_NAMESPACE::hash shortHash; + WX_HASH_MAP_NAMESPACE::hash ushortHash; + +#if defined wxLongLong_t && !defined wxLongLongIsLong + // hash ought to work but doesn't on some compilers + #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \ + || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2) + size_t longlongHash( wxLongLong_t x ) const + { + return longHash( wx_truncate_cast(long, x) ) ^ + longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) ); + } + #elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG + WX_HASH_MAP_NAMESPACE::hash longlongHash; + #else + WX_HASH_MAP_NAMESPACE::hash longlongHash; + #endif +#endif + +public: + wxIntegerHash() { } + size_t operator()( long x ) const { return longHash( x ); } + size_t operator()( unsigned long x ) const { return ulongHash( x ); } + size_t operator()( int x ) const { return intHash( x ); } + size_t operator()( unsigned int x ) const { return uintHash( x ); } + size_t operator()( short x ) const { return shortHash( x ); } + size_t operator()( unsigned short x ) const { return ushortHash( x ); } +#if defined wxLongLong_t && !defined wxLongLongIsLong + size_t operator()( wxLongLong_t x ) const { return longlongHash(x); } + size_t operator()( wxULongLong_t x ) const { return longlongHash(x); } +#endif + + wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } +}; + +#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +// integer types +class WXDLLIMPEXP_BASE wxIntegerHash +{ +public: + wxIntegerHash() { } + unsigned long operator()( long x ) const { return (unsigned long)x; } + unsigned long operator()( unsigned long x ) const { return x; } + unsigned long operator()( int x ) const { return (unsigned long)x; } + unsigned long operator()( unsigned int x ) const { return x; } + unsigned long operator()( short x ) const { return (unsigned long)x; } + unsigned long operator()( unsigned short x ) const { return x; } +#if defined wxLongLong_t && !defined wxLongLongIsLong + wxULongLong_t operator()( wxLongLong_t x ) const { return wx_static_cast(wxULongLong_t, x); } + wxULongLong_t operator()( wxULongLong_t x ) const { return x; } +#endif + + wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } +}; + +#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +class WXDLLIMPEXP_BASE wxIntegerEqual +{ +public: + wxIntegerEqual() { } + bool operator()( long a, long b ) const { return a == b; } + bool operator()( unsigned long a, unsigned long b ) const { return a == b; } + bool operator()( int a, int b ) const { return a == b; } + bool operator()( unsigned int a, unsigned int b ) const { return a == b; } + bool operator()( short a, short b ) const { return a == b; } + bool operator()( unsigned short a, unsigned short b ) const { return a == b; } +#if defined wxLongLong_t && !defined wxLongLongIsLong + bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; } + bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; } +#endif + + wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; } +}; + +// pointers +class WXDLLIMPEXP_BASE wxPointerHash +{ +public: + wxPointerHash() { } + +#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) + size_t operator()( const void* k ) const { return (size_t)k; } +#else + wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } +#endif + + wxPointerHash& operator=(const wxPointerHash&) { return *this; } +}; + +class WXDLLIMPEXP_BASE wxPointerEqual +{ +public: + wxPointerEqual() { } + bool operator()( const void* a, const void* b ) const { return a == b; } + + wxPointerEqual& operator=(const wxPointerEqual&) { return *this; } +}; + +// wxString, char*, wxChar* +class WXDLLIMPEXP_BASE wxStringHash +{ +public: + wxStringHash() {} + unsigned long operator()( const wxString& x ) const + { return wxCharStringHash( x.c_str() ); } + unsigned long operator()( const wxChar* x ) const + { return wxCharStringHash( x ); } + static unsigned long wxCharStringHash( const wxChar* ); +#if wxUSE_UNICODE + unsigned long operator()( const char* x ) const + { return charStringHash( x ); } + static unsigned long charStringHash( const char* ); +#endif // wxUSE_UNICODE + + wxStringHash& operator=(const wxStringHash&) { return *this; } +}; + +class WXDLLIMPEXP_BASE wxStringEqual +{ +public: + wxStringEqual() {} + bool operator()( const wxString& a, const wxString& b ) const + { return a == b; } + bool operator()( const wxChar* a, const wxChar* b ) const + { return wxStrcmp( a, b ) == 0; } +#if wxUSE_UNICODE + bool operator()( const char* a, const char* b ) const + { return strcmp( a, b ) == 0; } +#endif // wxUSE_UNICODE + + wxStringEqual& operator=(const wxStringEqual&) { return *this; } +}; + +#if !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ +_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ +_WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ +_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ +{ \ +public: \ + typedef VALUE_T mapped_type; \ + _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ + \ + wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ + key_equal eq = key_equal() ) \ + : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ + CLASSNAME##_wxImplementation_KeyEx() ) {} \ + \ + mapped_type& operator[]( const const_key_type& key ) \ + { \ + bool created; \ + return GetOrCreateNode( \ + CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \ + created)->m_value.second; \ + } \ + \ + const_iterator find( const const_key_type& key ) const \ + { \ + return const_iterator( GetNode( key ), this ); \ + } \ + \ + iterator find( const const_key_type& key ) \ + { \ + return iterator( GetNode( key ), this ); \ + } \ + \ + Insert_Result insert( const value_type& v ) \ + { \ + bool created; \ + Node *node = GetOrCreateNode( \ + CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \ + created); \ + if ( !created ) \ + node->m_value.second = v.second; \ + return Insert_Result(iterator(node, this), created); \ + } \ + \ + size_type erase( const key_type& k ) \ + { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ + void erase( const iterator& it ) { erase( it->first ); } \ + void erase( const const_iterator& it ) { erase( it->first ); } \ + \ + /* count() == 0 | 1 */ \ + size_type count( const const_key_type& key ) \ + { \ + /* explicit cast needed to suppress CodeWarrior warnings */ \ + return (size_type)(GetNode( key ) ? 1 : 0); \ + } \ +} + +#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +// these macros are to be used in the user code +#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) + +#define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ + _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ + CLASSNAME, class ) + +#define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ + _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ + CLASSNAME, class ) + +// and these do exactly the same thing but should be used inside the +// library +#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ + _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) + +#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \ + CLASSNAME, class WXDLLEXPORT ) + +#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ + _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ + CLASSNAME, DECL ) + +#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ + WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ + class WXDLLEXPORT ) + +#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ + _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ + CLASSNAME, DECL ) + +#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ + WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ + class WXDLLEXPORT ) + +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_MAP(type, hashmap) \ + { \ + type::iterator it, en; \ + for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \ + delete it->second; \ + (hashmap).clear(); \ + } + +//--------------------------------------------------------------------------- +// Declarations of common hashmap classes + +WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, + wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); + + +#endif // _WX_HASHMAP_H_ diff --git a/Externals/wxWidgets/include/wx/hashset.h b/Externals/wxWidgets/include/wx/hashset.h index 9fba4c947c..b506fb08fc 100644 --- a/Externals/wxWidgets/include/wx/hashset.h +++ b/Externals/wxWidgets/include/wx/hashset.h @@ -1,117 +1,117 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hashset.h -// Purpose: wxHashSet class -// Author: Mattia Barbon -// Modified by: -// Created: 11/08/2003 -// RCS-ID: $Id: hashset.h 49056 2007-10-05 22:42:35Z VS $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HASHSET_H_ -#define _WX_HASHSET_H_ - -#include "wx/hashmap.h" - -#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) - -#if defined(HAVE_EXT_HASH_MAP) - #include -#elif defined(HAVE_HASH_MAP) - #include -#endif - -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ - typedef WX_HASH_MAP_NAMESPACE::hash_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME - -#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// this is a complex way of defining an easily inlineable identity function... -#define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \ -CLASSEXP CLASSNAME \ -{ \ - typedef KEY_T key_type; \ - typedef const key_type const_key_type; \ - typedef const_key_type& const_key_reference; \ -public: \ - CLASSNAME() { } \ - const_key_reference operator()( const_key_reference key ) const \ - { return key; } \ - \ - /* the dummy assignment operator is needed to suppress compiler */ \ - /* warnings from hash table class' operator=(): gcc complains about */ \ - /* "statement with no effect" without it */ \ - CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ -}; - -#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ -_WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ -_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ -CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ -{ \ -public: \ - _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ - \ - wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ - key_equal eq = key_equal() ) \ - : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ - CLASSNAME##_wxImplementation_KeyEx() ) {} \ - \ - Insert_Result insert( const key_type& key ) \ - { \ - bool created; \ - Node *node = GetOrCreateNode( key, created ); \ - return Insert_Result( iterator( node, this ), created ); \ - } \ - \ - const_iterator find( const const_key_type& key ) const \ - { \ - return const_iterator( GetNode( key ), this ); \ - } \ - \ - iterator find( const const_key_type& key ) \ - { \ - return iterator( GetNode( key ), this ); \ - } \ - \ - size_type erase( const key_type& k ) \ - { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ - void erase( const iterator& it ) { erase( *it ); } \ - void erase( const const_iterator& it ) { erase( *it ); } \ - \ - /* count() == 0 | 1 */ \ - size_type count( const const_key_type& key ) \ - { return GetNode( key ) ? 1 : 0; } \ -} - -#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) - -// these macros are to be used in the user code -#define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) - -// and these do exactly the same thing but should be used inside the -// library -#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ - _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) - -#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ - WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \ - CLASSNAME, class WXDLLEXPORT ) - -// delete all hash elements -// -// NB: the class declaration of the hash elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_HASH_SET(type, hashset) \ - { \ - type::iterator it, en; \ - for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it ) \ - delete *it; \ - (hashset).clear(); \ - } - -#endif // _WX_HASHSET_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hashset.h +// Purpose: wxHashSet class +// Author: Mattia Barbon +// Modified by: +// Created: 11/08/2003 +// RCS-ID: $Id: hashset.h 49056 2007-10-05 22:42:35Z VS $ +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HASHSET_H_ +#define _WX_HASHSET_H_ + +#include "wx/hashmap.h" + +#if wxUSE_STL && defined(HAVE_STL_HASH_MAP) + +#if defined(HAVE_EXT_HASH_MAP) + #include +#elif defined(HAVE_HASH_MAP) + #include +#endif + +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ + typedef WX_HASH_MAP_NAMESPACE::hash_set< KEY_T, HASH_T, KEY_EQ_T > CLASSNAME + +#else // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +// this is a complex way of defining an easily inlineable identity function... +#define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ +{ \ + typedef KEY_T key_type; \ + typedef const key_type const_key_type; \ + typedef const_key_type& const_key_reference; \ +public: \ + CLASSNAME() { } \ + const_key_reference operator()( const_key_reference key ) const \ + { return key; } \ + \ + /* the dummy assignment operator is needed to suppress compiler */ \ + /* warnings from hash table class' operator=(): gcc complains about */ \ + /* "statement with no effect" without it */ \ + CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ +}; + +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP )\ +_WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ +_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ +{ \ +public: \ + _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ + \ + wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ + key_equal eq = key_equal() ) \ + : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ + CLASSNAME##_wxImplementation_KeyEx() ) {} \ + \ + Insert_Result insert( const key_type& key ) \ + { \ + bool created; \ + Node *node = GetOrCreateNode( key, created ); \ + return Insert_Result( iterator( node, this ), created ); \ + } \ + \ + const_iterator find( const const_key_type& key ) const \ + { \ + return const_iterator( GetNode( key ), this ); \ + } \ + \ + iterator find( const const_key_type& key ) \ + { \ + return iterator( GetNode( key ), this ); \ + } \ + \ + size_type erase( const key_type& k ) \ + { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ + void erase( const iterator& it ) { erase( *it ); } \ + void erase( const const_iterator& it ) { erase( *it ); } \ + \ + /* count() == 0 | 1 */ \ + size_type count( const const_key_type& key ) \ + { return GetNode( key ) ? 1 : 0; } \ +} + +#endif // !wxUSE_STL || !defined(HAVE_STL_HASH_MAP) + +// these macros are to be used in the user code +#define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) + +// and these do exactly the same thing but should be used inside the +// library +#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) + +#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \ + CLASSNAME, class WXDLLEXPORT ) + +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_SET(type, hashset) \ + { \ + type::iterator it, en; \ + for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it ) \ + delete *it; \ + (hashset).clear(); \ + } + +#endif // _WX_HASHSET_H_ diff --git a/Externals/wxWidgets/include/wx/help.h b/Externals/wxWidgets/include/wx/help.h index 1cc09d42c1..f233307982 100644 --- a/Externals/wxWidgets/include/wx/help.h +++ b/Externals/wxWidgets/include/wx/help.h @@ -1,48 +1,48 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: help.h -// Purpose: wxHelpController base header -// Author: wxWidgets Team -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: help.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELP_H_BASE_ -#define _WX_HELP_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -#ifdef __WXWINCE__ - #include "wx/msw/wince/helpwce.h" - - #define wxHelpController wxWinceHelpController -#elif defined(__WXPALMOS__) - #include "wx/palmos/help.h" - - #define wxHelpController wxPalmHelpController -#elif defined(__WXMSW__) - #include "wx/msw/helpchm.h" - - #define wxHelpController wxCHMHelpController -#else // !MSW - -#if wxUSE_WXHTML_HELP - #include "wx/html/helpctrl.h" - #define wxHelpController wxHtmlHelpController -#else - #include "wx/generic/helpext.h" - #define wxHelpController wxExtHelpController -#endif - -#endif // MSW/!MSW - -#endif // wxUSE_HELP - -#endif - // _WX_HELP_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: help.h +// Purpose: wxHelpController base header +// Author: wxWidgets Team +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: help.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELP_H_BASE_ +#define _WX_HELP_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +#ifdef __WXWINCE__ + #include "wx/msw/wince/helpwce.h" + + #define wxHelpController wxWinceHelpController +#elif defined(__WXPALMOS__) + #include "wx/palmos/help.h" + + #define wxHelpController wxPalmHelpController +#elif defined(__WXMSW__) + #include "wx/msw/helpchm.h" + + #define wxHelpController wxCHMHelpController +#else // !MSW + +#if wxUSE_WXHTML_HELP + #include "wx/html/helpctrl.h" + #define wxHelpController wxHtmlHelpController +#else + #include "wx/generic/helpext.h" + #define wxHelpController wxExtHelpController +#endif + +#endif // MSW/!MSW + +#endif // wxUSE_HELP + +#endif + // _WX_HELP_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/helpbase.h b/Externals/wxWidgets/include/wx/helpbase.h index 0ab778205a..cc77ef1028 100644 --- a/Externals/wxWidgets/include/wx/helpbase.h +++ b/Externals/wxWidgets/include/wx/helpbase.h @@ -1,106 +1,106 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpbase.h -// Purpose: Help system base classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: helpbase.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPBASEH__ -#define _WX_HELPBASEH__ - -#include "wx/defs.h" - -#if wxUSE_HELP - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/gdicmn.h" -#include "wx/frame.h" - -// Flags for SetViewer -#define wxHELP_NETSCAPE 1 - -// Search modes: -enum wxHelpSearchMode -{ - wxHELP_SEARCH_INDEX, - wxHELP_SEARCH_ALL -}; - -// Defines the API for help controllers -class WXDLLEXPORT wxHelpControllerBase: public wxObject -{ -public: - inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } - inline ~wxHelpControllerBase() {} - - // Must call this to set the filename and server name. - // server is only required when implementing TCP/IP-based - // help controllers. - virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } - virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } - - // Set viewer: only relevant to some kinds of controller - virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; - - // Displays the contents - virtual bool DisplayContents(void) = 0; - - // Display the given section - virtual bool DisplaySection(int sectionNo) = 0; - - // Display the section using a context id - virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; } - - // Display the text in a popup, if possible - virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } - - // By default, uses KeywordSection to display a topic. Implementations - // may override this for more specific behaviour. - virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } - virtual bool DisplayBlock(long blockNo) = 0; - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; - /// Allows one to override the default settings for the help frame. - virtual void SetFrameParameters(const wxString& WXUNUSED(title), - const wxSize& WXUNUSED(size), - const wxPoint& WXUNUSED(pos) = wxDefaultPosition, - bool WXUNUSED(newFrameEachTime) = false) - { - // does nothing by default - } - /// Obtains the latest settings used by the help frame and the help - /// frame. - virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, - wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) - { - return (wxFrame*) NULL; // does nothing by default - } - - virtual bool Quit() = 0; - virtual void OnQuit() {} - - /// Set the window that can optionally be used for the help window's parent. - virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; } - - /// Get the window that can optionally be used for the help window's parent. - virtual wxWindow* GetParentWindow() const { return m_parentWindow; } - -protected: - wxWindow* m_parentWindow; -private: - DECLARE_CLASS(wxHelpControllerBase) -}; - -#endif // wxUSE_HELP - -#endif -// _WX_HELPBASEH__ +///////////////////////////////////////////////////////////////////////////// +// Name: helpbase.h +// Purpose: Help system base classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id: helpbase.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPBASEH__ +#define _WX_HELPBASEH__ + +#include "wx/defs.h" + +#if wxUSE_HELP + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdicmn.h" +#include "wx/frame.h" + +// Flags for SetViewer +#define wxHELP_NETSCAPE 1 + +// Search modes: +enum wxHelpSearchMode +{ + wxHELP_SEARCH_INDEX, + wxHELP_SEARCH_ALL +}; + +// Defines the API for help controllers +class WXDLLEXPORT wxHelpControllerBase: public wxObject +{ +public: + inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } + inline ~wxHelpControllerBase() {} + + // Must call this to set the filename and server name. + // server is only required when implementing TCP/IP-based + // help controllers. + virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } + virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } + + // Set viewer: only relevant to some kinds of controller + virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; + + // Displays the contents + virtual bool DisplayContents(void) = 0; + + // Display the given section + virtual bool DisplaySection(int sectionNo) = 0; + + // Display the section using a context id + virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; } + + // Display the text in a popup, if possible + virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } + + // By default, uses KeywordSection to display a topic. Implementations + // may override this for more specific behaviour. + virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } + virtual bool DisplayBlock(long blockNo) = 0; + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; + /// Allows one to override the default settings for the help frame. + virtual void SetFrameParameters(const wxString& WXUNUSED(title), + const wxSize& WXUNUSED(size), + const wxPoint& WXUNUSED(pos) = wxDefaultPosition, + bool WXUNUSED(newFrameEachTime) = false) + { + // does nothing by default + } + /// Obtains the latest settings used by the help frame and the help + /// frame. + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, + wxPoint *WXUNUSED(pos) = NULL, + bool *WXUNUSED(newFrameEachTime) = NULL) + { + return (wxFrame*) NULL; // does nothing by default + } + + virtual bool Quit() = 0; + virtual void OnQuit() {} + + /// Set the window that can optionally be used for the help window's parent. + virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; } + + /// Get the window that can optionally be used for the help window's parent. + virtual wxWindow* GetParentWindow() const { return m_parentWindow; } + +protected: + wxWindow* m_parentWindow; +private: + DECLARE_CLASS(wxHelpControllerBase) +}; + +#endif // wxUSE_HELP + +#endif +// _WX_HELPBASEH__ diff --git a/Externals/wxWidgets/include/wx/helphtml.h b/Externals/wxWidgets/include/wx/helphtml.h index 8eb6c45f4c..4ed3d98948 100644 --- a/Externals/wxWidgets/include/wx/helphtml.h +++ b/Externals/wxWidgets/include/wx/helphtml.h @@ -1,20 +1,20 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helphtml.h -// Purpose: Includes wx/html/helpctrl.h, for wxHtmlHelpController. -// Author: Julian Smart -// Modified by: -// Created: 2003-05-24 -// RCS-ID: $Id: helphtml.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_HELPHTML_H_ -#define __WX_HELPHTML_H_ - -#if wxUSE_WXHTML_HELP -#include "wx/html/helpctrl.h" -#endif - -#endif // __WX_HELPHTML_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: helphtml.h +// Purpose: Includes wx/html/helpctrl.h, for wxHtmlHelpController. +// Author: Julian Smart +// Modified by: +// Created: 2003-05-24 +// RCS-ID: $Id: helphtml.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_HELPHTML_H_ +#define __WX_HELPHTML_H_ + +#if wxUSE_WXHTML_HELP +#include "wx/html/helpctrl.h" +#endif + +#endif // __WX_HELPHTML_H_ + diff --git a/Externals/wxWidgets/include/wx/helpwin.h b/Externals/wxWidgets/include/wx/helpwin.h index c211eb9b1b..b15b245ec0 100644 --- a/Externals/wxWidgets/include/wx/helpwin.h +++ b/Externals/wxWidgets/include/wx/helpwin.h @@ -1,22 +1,22 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpwin.h -// Purpose: Includes Windows or OS/2 help -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: helpwin.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPWIN_H_BASE_ -#define _WX_HELPWIN_H_BASE_ - -#if defined(__WXMSW__) -#include "wx/msw/helpwin.h" -#elif defined(__WXPM__) -#include "wx/os2/helpwin.h" -#endif - -#endif - // _WX_HELPWIN_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: helpwin.h +// Purpose: Includes Windows or OS/2 help +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: helpwin.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWIN_H_BASE_ +#define _WX_HELPWIN_H_BASE_ + +#if defined(__WXMSW__) +#include "wx/msw/helpwin.h" +#elif defined(__WXPM__) +#include "wx/os2/helpwin.h" +#endif + +#endif + // _WX_HELPWIN_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/html/forcelnk.h b/Externals/wxWidgets/include/wx/html/forcelnk.h index 7358268294..f54ad839d5 100644 --- a/Externals/wxWidgets/include/wx/html/forcelnk.h +++ b/Externals/wxWidgets/include/wx/html/forcelnk.h @@ -1,62 +1,62 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: forcelnk.h -// Purpose: see bellow -// Author: Vaclav Slavik -// RCS-ID: $Id: forcelnk.h 35686 2005-09-25 18:46:14Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - -DESCRPITON: - -mod_*.cpp files contain handlers for tags. These files are modules - they contain -one wxTagModule class and it's OnInit() method is called from wxApp's init method. -The module is called even if you only link it into the executable, so everything -seems wonderful. - -The problem is that we have these modules in LIBRARY and mod_*.cpp files contain -no method nor class which is known out of the module. So the linker won't -link these .o/.obj files into executable because it detected that it is not used -by the program. - -To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These -macros are generic and are not limited to mod_*.cpp files. You may find them quite -useful somewhere else... - -How to use them: -let's suppose you want to always link file foo.cpp and that you have module -always.cpp that is certainly always linked (e.g. the one with main() function -or htmlwin.cpp in wxHtml library). - -Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere -in always.cpp -See mod_*.cpp and htmlwin.cpp for example :-) - -*/ - - -#ifndef _WX_FORCELNK_H_ -#define _WX_FORCELNK_H_ - -#include "wx/link.h" - -// compatibility defines -#define FORCE_LINK wxFORCE_LINK_MODULE -#define FORCE_LINK_ME wxFORCE_LINK_THIS_MODULE - -#define FORCE_WXHTML_MODULES() \ - FORCE_LINK(m_layout) \ - FORCE_LINK(m_fonts) \ - FORCE_LINK(m_image) \ - FORCE_LINK(m_list) \ - FORCE_LINK(m_dflist) \ - FORCE_LINK(m_pre) \ - FORCE_LINK(m_hline) \ - FORCE_LINK(m_links) \ - FORCE_LINK(m_tables) \ - FORCE_LINK(m_style) - - -#endif // _WX_FORCELNK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: forcelnk.h +// Purpose: see bellow +// Author: Vaclav Slavik +// RCS-ID: $Id: forcelnk.h 35686 2005-09-25 18:46:14Z VZ $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + +DESCRPITON: + +mod_*.cpp files contain handlers for tags. These files are modules - they contain +one wxTagModule class and it's OnInit() method is called from wxApp's init method. +The module is called even if you only link it into the executable, so everything +seems wonderful. + +The problem is that we have these modules in LIBRARY and mod_*.cpp files contain +no method nor class which is known out of the module. So the linker won't +link these .o/.obj files into executable because it detected that it is not used +by the program. + +To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These +macros are generic and are not limited to mod_*.cpp files. You may find them quite +useful somewhere else... + +How to use them: +let's suppose you want to always link file foo.cpp and that you have module +always.cpp that is certainly always linked (e.g. the one with main() function +or htmlwin.cpp in wxHtml library). + +Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere +in always.cpp +See mod_*.cpp and htmlwin.cpp for example :-) + +*/ + + +#ifndef _WX_FORCELNK_H_ +#define _WX_FORCELNK_H_ + +#include "wx/link.h" + +// compatibility defines +#define FORCE_LINK wxFORCE_LINK_MODULE +#define FORCE_LINK_ME wxFORCE_LINK_THIS_MODULE + +#define FORCE_WXHTML_MODULES() \ + FORCE_LINK(m_layout) \ + FORCE_LINK(m_fonts) \ + FORCE_LINK(m_image) \ + FORCE_LINK(m_list) \ + FORCE_LINK(m_dflist) \ + FORCE_LINK(m_pre) \ + FORCE_LINK(m_hline) \ + FORCE_LINK(m_links) \ + FORCE_LINK(m_tables) \ + FORCE_LINK(m_style) + + +#endif // _WX_FORCELNK_H_ diff --git a/Externals/wxWidgets/include/wx/html/helpctrl.h b/Externals/wxWidgets/include/wx/html/helpctrl.h index 59ba39ed26..bf0bd05740 100644 --- a/Externals/wxWidgets/include/wx/html/helpctrl.h +++ b/Externals/wxWidgets/include/wx/html/helpctrl.h @@ -1,153 +1,153 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpctrl.h -// Purpose: wxHtmlHelpController -// Notes: Based on htmlhelp.cpp, implementing a monolithic -// HTML Help controller class, by Vaclav Slavik -// Author: Harm van der Heijden and Vaclav Slavik -// RCS-ID: $Id: helpctrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Harm van der Heijden and Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPCTRL_H_ -#define _WX_HELPCTRL_H_ - -#include "wx/defs.h" - -#if wxUSE_WXHTML_HELP - -#include "wx/helpbase.h" -#include "wx/html/helpfrm.h" - -#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1) - -// This style indicates that the window is -// embedded in the application and must not be -// destroyed by the help controller. -#define wxHF_EMBEDDED 0x00008000 - -// Create a dialog for the help window. -#define wxHF_DIALOG 0x00010000 - -// Create a frame for the help window. -#define wxHF_FRAME 0x00020000 - -// Make the dialog modal when displaying help. -#define wxHF_MODAL 0x00040000 - -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog; - -class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler -{ - DECLARE_DYNAMIC_CLASS(wxHtmlHelpController) - -public: - wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL); - virtual ~wxHtmlHelpController(); - - void SetTitleFormat(const wxString& format); - void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); } - bool AddBook(const wxString& book_url, bool show_wait_msg = false); - bool AddBook(const wxFileName& book_file, bool show_wait_msg = false); - - bool Display(const wxString& x); - bool Display(int id); - bool DisplayContents(); - bool DisplayIndex(); - bool KeywordSearch(const wxString& keyword, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - - wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; } - void SetHelpWindow(wxHtmlHelpWindow* helpWindow); - - wxHtmlHelpFrame* GetFrame() { return m_helpFrame; } - wxHtmlHelpDialog* GetDialog() { return m_helpDialog; } - - void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); - - // Assigns config object to the Ctrl. This config is then - // used in subsequent calls to Read/WriteCustomization of both help - // Ctrl and it's wxHtmlWindow - virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); - virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); - - //// Backward compatibility with wxHelpController API - - virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); } - virtual bool Initialize(const wxString& file); - virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} - virtual bool LoadFile(const wxString& file = wxT("")); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section) { return Display(section); } - virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); } - virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); - - virtual void SetFrameParameters(const wxString& title, - const wxSize& size, - const wxPoint& pos = wxDefaultPosition, - bool newFrameEachTime = false); - /// Obtains the latest settings used by the help frame and the help - /// frame. - virtual wxFrame *GetFrameParameters(wxSize *size = NULL, - wxPoint *pos = NULL, - bool *newFrameEachTime = NULL); - - // Get direct access to help data: - wxHtmlHelpData *GetHelpData() { return &m_helpData; } - - virtual bool Quit() ; - virtual void OnQuit() {} - - void OnCloseFrame(wxCloseEvent& evt); - - // Make the help controller's frame 'modal' if - // needed - void MakeModalIfNeeded(); - - // Find the top-most parent window - wxWindow* FindTopLevelWindow(); - -protected: - virtual wxWindow* CreateHelpWindow(); - virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data); - virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data); - virtual void DestroyHelpWindow(); - - wxHtmlHelpData m_helpData; - wxHtmlHelpWindow* m_helpWindow; - wxConfigBase * m_Config; - wxString m_ConfigRoot; - wxString m_titleFormat; - int m_FrameStyle; - wxHtmlHelpFrame* m_helpFrame; - wxHtmlHelpDialog* m_helpDialog; - - DECLARE_NO_COPY_CLASS(wxHtmlHelpController) -}; - -/* - * wxHtmlModalHelp - * A convenience class particularly for use on wxMac, - * where you can only show modal dialogs from a modal - * dialog. - * - * Use like this: - * - * wxHtmlModalHelp help(parent, filename, topic); - * - * If topic is empty, the help contents is displayed. - */ - -class WXDLLIMPEXP_HTML wxHtmlModalHelp -{ -public: - wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString, - int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL); -}; - -#endif // wxUSE_WXHTML_HELP - -#endif // _WX_HELPCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: helpctrl.h +// Purpose: wxHtmlHelpController +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// RCS-ID: $Id: helpctrl.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPCTRL_H_ +#define _WX_HELPCTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/helpbase.h" +#include "wx/html/helpfrm.h" + +#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1) + +// This style indicates that the window is +// embedded in the application and must not be +// destroyed by the help controller. +#define wxHF_EMBEDDED 0x00008000 + +// Create a dialog for the help window. +#define wxHF_DIALOG 0x00010000 + +// Create a frame for the help window. +#define wxHF_FRAME 0x00020000 + +// Make the dialog modal when displaying help. +#define wxHF_MODAL 0x00040000 + +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog; + +class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler +{ + DECLARE_DYNAMIC_CLASS(wxHtmlHelpController) + +public: + wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL); + virtual ~wxHtmlHelpController(); + + void SetTitleFormat(const wxString& format); + void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); } + bool AddBook(const wxString& book_url, bool show_wait_msg = false); + bool AddBook(const wxFileName& book_file, bool show_wait_msg = false); + + bool Display(const wxString& x); + bool Display(int id); + bool DisplayContents(); + bool DisplayIndex(); + bool KeywordSearch(const wxString& keyword, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + + wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; } + void SetHelpWindow(wxHtmlHelpWindow* helpWindow); + + wxHtmlHelpFrame* GetFrame() { return m_helpFrame; } + wxHtmlHelpDialog* GetDialog() { return m_helpDialog; } + + void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); + + // Assigns config object to the Ctrl. This config is then + // used in subsequent calls to Read/WriteCustomization of both help + // Ctrl and it's wxHtmlWindow + virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); + virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); + + //// Backward compatibility with wxHelpController API + + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); } + virtual bool Initialize(const wxString& file); + virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} + virtual bool LoadFile(const wxString& file = wxT("")); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section) { return Display(section); } + virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); } + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); + + virtual void SetFrameParameters(const wxString& title, + const wxSize& size, + const wxPoint& pos = wxDefaultPosition, + bool newFrameEachTime = false); + /// Obtains the latest settings used by the help frame and the help + /// frame. + virtual wxFrame *GetFrameParameters(wxSize *size = NULL, + wxPoint *pos = NULL, + bool *newFrameEachTime = NULL); + + // Get direct access to help data: + wxHtmlHelpData *GetHelpData() { return &m_helpData; } + + virtual bool Quit() ; + virtual void OnQuit() {} + + void OnCloseFrame(wxCloseEvent& evt); + + // Make the help controller's frame 'modal' if + // needed + void MakeModalIfNeeded(); + + // Find the top-most parent window + wxWindow* FindTopLevelWindow(); + +protected: + virtual wxWindow* CreateHelpWindow(); + virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data); + virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data); + virtual void DestroyHelpWindow(); + + wxHtmlHelpData m_helpData; + wxHtmlHelpWindow* m_helpWindow; + wxConfigBase * m_Config; + wxString m_ConfigRoot; + wxString m_titleFormat; + int m_FrameStyle; + wxHtmlHelpFrame* m_helpFrame; + wxHtmlHelpDialog* m_helpDialog; + + DECLARE_NO_COPY_CLASS(wxHtmlHelpController) +}; + +/* + * wxHtmlModalHelp + * A convenience class particularly for use on wxMac, + * where you can only show modal dialogs from a modal + * dialog. + * + * Use like this: + * + * wxHtmlModalHelp help(parent, filename, topic); + * + * If topic is empty, the help contents is displayed. + */ + +class WXDLLIMPEXP_HTML wxHtmlModalHelp +{ +public: + wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString, + int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL); +}; + +#endif // wxUSE_WXHTML_HELP + +#endif // _WX_HELPCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/html/helpdata.h b/Externals/wxWidgets/include/wx/html/helpdata.h index 20175732e2..fcd54d7801 100644 --- a/Externals/wxWidgets/include/wx/html/helpdata.h +++ b/Externals/wxWidgets/include/wx/html/helpdata.h @@ -1,266 +1,266 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpdata.h -// Purpose: wxHtmlHelpData -// Notes: Based on htmlhelp.cpp, implementing a monolithic -// HTML Help controller class, by Vaclav Slavik -// Author: Harm van der Heijden and Vaclav Slavik -// RCS-ID: $Id: helpdata.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Harm van der Heijden and Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPDATA_H_ -#define _WX_HELPDATA_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/filesys.h" -#include "wx/dynarray.h" -#include "wx/font.h" - -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpData; - -//-------------------------------------------------------------------------------- -// helper classes & structs -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlBookRecord -{ -public: - wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath, - const wxString& title, const wxString& start) - { - m_BookFile = bookfile; - m_BasePath = basepath; - m_Title = title; - m_Start = start; - // for debugging, give the contents index obvious default values - m_ContentsStart = m_ContentsEnd = -1; - } - wxString GetBookFile() const { return m_BookFile; } - wxString GetTitle() const { return m_Title; } - wxString GetStart() const { return m_Start; } - wxString GetBasePath() const { return m_BasePath; } - /* SetContentsRange: store in the bookrecord where in the index/contents lists the - * book's records are stored. This to facilitate searching in a specific book. - * This code will have to be revised when loading/removing books becomes dynamic. - * (as opposed to appending only) - * Note that storing index range is pointless, because the index is alphab. sorted. */ - void SetContentsRange(int start, int end) { m_ContentsStart = start; m_ContentsEnd = end; } - int GetContentsStart() const { return m_ContentsStart; } - int GetContentsEnd() const { return m_ContentsEnd; } - - void SetTitle(const wxString& title) { m_Title = title; } - void SetBasePath(const wxString& path) { m_BasePath = path; } - void SetStart(const wxString& start) { m_Start = start; } - - // returns full filename of page (which is part of the book), - // i.e. with book's basePath prepended. If page is already absolute - // path, basePath is _not_ prepended. - wxString GetFullPath(const wxString &page) const; - -protected: - wxString m_BookFile; - wxString m_BasePath; - wxString m_Title; - wxString m_Start; - int m_ContentsStart; - int m_ContentsEnd; -}; - - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray, - WXDLLIMPEXP_HTML); - -struct WXDLLIMPEXP_HTML wxHtmlHelpDataItem -{ - wxHtmlHelpDataItem() : level(0), parent(NULL), id(wxID_ANY), book(NULL) {} - - int level; - wxHtmlHelpDataItem *parent; - int id; - wxString name; - wxString page; - wxHtmlBookRecord *book; - - // returns full filename of m_Page, i.e. with book's basePath prepended - wxString GetFullPath() const { return book->GetFullPath(page); } - - // returns item indented with spaces if it has level>1: - wxString GetIndentedName() const; -}; - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlHelpDataItem, wxHtmlHelpDataItems, - WXDLLIMPEXP_HTML); - -#if WXWIN_COMPATIBILITY_2_4 -// old interface to contents and index: -struct wxHtmlContentsItem -{ - wxHtmlContentsItem(); - wxHtmlContentsItem(const wxHtmlHelpDataItem& d); - wxHtmlContentsItem& operator=(const wxHtmlContentsItem& d); - ~wxHtmlContentsItem(); - - int m_Level; - int m_ID; - wxChar *m_Name; - wxChar *m_Page; - wxHtmlBookRecord *m_Book; - - // returns full filename of m_Page, i.e. with book's basePath prepended - wxString GetFullPath() const { return m_Book->GetFullPath(m_Page); } - -private: - bool m_autofree; -}; -#endif - - -//------------------------------------------------------------------------------ -// wxHtmlSearchEngine -// This class takes input streams and scans them for occurence -// of keyword(s) -//------------------------------------------------------------------------------ - -class WXDLLIMPEXP_HTML wxHtmlSearchEngine : public wxObject -{ -public: - wxHtmlSearchEngine() : wxObject() {} - virtual ~wxHtmlSearchEngine() {} - - // Sets the keyword we will be searching for - virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only); - - // Scans the stream for the keyword. - // Returns true if the stream contains keyword, fALSE otherwise - virtual bool Scan(const wxFSFile& file); - -private: - wxString m_Keyword; - bool m_CaseSensitive; - bool m_WholeWords; - - DECLARE_NO_COPY_CLASS(wxHtmlSearchEngine) -}; - - -// State information of a search action. I'd have preferred to make this a -// nested class inside wxHtmlHelpData, but that's against coding standards :-( -// Never construct this class yourself, obtain a copy from -// wxHtmlHelpData::PrepareKeywordSearch(const wxString& key) -class WXDLLIMPEXP_HTML wxHtmlSearchStatus -{ -public: - // constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the - // title of the book to search. By default, all books are searched. - wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword, - bool case_sensitive, bool whole_words_only, - const wxString& book = wxEmptyString); - bool Search(); // do the next iteration - bool IsActive() { return m_Active; } - int GetCurIndex() { return m_CurIndex; } - int GetMaxIndex() { return m_MaxIndex; } - const wxString& GetName() { return m_Name; } - - const wxHtmlHelpDataItem *GetCurItem() const { return m_CurItem; } -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( wxHtmlContentsItem* GetContentsItem() ); -#endif - -private: - wxHtmlHelpData* m_Data; - wxHtmlSearchEngine m_Engine; - wxString m_Keyword, m_Name; - wxString m_LastPage; - wxHtmlHelpDataItem* m_CurItem; - bool m_Active; // search is not finished - int m_CurIndex; // where we are now - int m_MaxIndex; // number of files we search - // For progress bar: 100*curindex/maxindex = % complete - - DECLARE_NO_COPY_CLASS(wxHtmlSearchStatus) -}; - -class WXDLLIMPEXP_HTML wxHtmlHelpData : public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxHtmlHelpData) - friend class wxHtmlSearchStatus; - -public: - wxHtmlHelpData(); - virtual ~wxHtmlHelpData(); - - // Sets directory where temporary files are stored. - // These temp files are index & contents file in binary (much faster to read) - // form. These files are NOT deleted on program's exit. - void SetTempDir(const wxString& path); - - // Adds new book. 'book' is location of .htb file (stands for "html book"). - // See documentation for details on its format. - // Returns success. - bool AddBook(const wxString& book); - bool AddBookParam(const wxFSFile& bookfile, - wxFontEncoding encoding, - const wxString& title, const wxString& contfile, - const wxString& indexfile = wxEmptyString, - const wxString& deftopic = wxEmptyString, - const wxString& path = wxEmptyString); - - // Some accessing stuff: - - // returns URL of page on basis of (file)name - wxString FindPageByName(const wxString& page); - // returns URL of page on basis of MS id - wxString FindPageById(int id); - - const wxHtmlBookRecArray& GetBookRecArray() const { return m_bookRecords; } - - const wxHtmlHelpDataItems& GetContentsArray() const { return m_contents; } - const wxHtmlHelpDataItems& GetIndexArray() const { return m_index; } - -#if WXWIN_COMPATIBILITY_2_4 - // deprecated interface, new interface is arrays-based (see above) - wxDEPRECATED( wxHtmlContentsItem* GetContents() ); - wxDEPRECATED( int GetContentsCnt() ); - wxDEPRECATED( wxHtmlContentsItem* GetIndex() ); - wxDEPRECATED( int GetIndexCnt() ); -#endif - -protected: - wxString m_tempPath; - - // each book has one record in this array: - wxHtmlBookRecArray m_bookRecords; - - wxHtmlHelpDataItems m_contents; // list of all available books and pages - wxHtmlHelpDataItems m_index; // list of index itesm - -#if WXWIN_COMPATIBILITY_2_4 - // deprecated data structures, set only if GetContents(), GetIndex() - // called - wxHtmlContentsItem* m_cacheContents; - wxHtmlContentsItem* m_cacheIndex; -private: - void CleanCompatibilityData(); -#endif - -protected: - // Imports .hhp files (MS HTML Help Workshop) - bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, - const wxString& indexfile, const wxString& contentsfile); - // Reads binary book - bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f); - // Writes binary book - bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f); - - DECLARE_NO_COPY_CLASS(wxHtmlHelpData) -}; - -#endif - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: helpdata.h +// Purpose: wxHtmlHelpData +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// RCS-ID: $Id: helpdata.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPDATA_H_ +#define _WX_HELPDATA_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/filesys.h" +#include "wx/dynarray.h" +#include "wx/font.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpData; + +//-------------------------------------------------------------------------------- +// helper classes & structs +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlBookRecord +{ +public: + wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath, + const wxString& title, const wxString& start) + { + m_BookFile = bookfile; + m_BasePath = basepath; + m_Title = title; + m_Start = start; + // for debugging, give the contents index obvious default values + m_ContentsStart = m_ContentsEnd = -1; + } + wxString GetBookFile() const { return m_BookFile; } + wxString GetTitle() const { return m_Title; } + wxString GetStart() const { return m_Start; } + wxString GetBasePath() const { return m_BasePath; } + /* SetContentsRange: store in the bookrecord where in the index/contents lists the + * book's records are stored. This to facilitate searching in a specific book. + * This code will have to be revised when loading/removing books becomes dynamic. + * (as opposed to appending only) + * Note that storing index range is pointless, because the index is alphab. sorted. */ + void SetContentsRange(int start, int end) { m_ContentsStart = start; m_ContentsEnd = end; } + int GetContentsStart() const { return m_ContentsStart; } + int GetContentsEnd() const { return m_ContentsEnd; } + + void SetTitle(const wxString& title) { m_Title = title; } + void SetBasePath(const wxString& path) { m_BasePath = path; } + void SetStart(const wxString& start) { m_Start = start; } + + // returns full filename of page (which is part of the book), + // i.e. with book's basePath prepended. If page is already absolute + // path, basePath is _not_ prepended. + wxString GetFullPath(const wxString &page) const; + +protected: + wxString m_BookFile; + wxString m_BasePath; + wxString m_Title; + wxString m_Start; + int m_ContentsStart; + int m_ContentsEnd; +}; + + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray, + WXDLLIMPEXP_HTML); + +struct WXDLLIMPEXP_HTML wxHtmlHelpDataItem +{ + wxHtmlHelpDataItem() : level(0), parent(NULL), id(wxID_ANY), book(NULL) {} + + int level; + wxHtmlHelpDataItem *parent; + int id; + wxString name; + wxString page; + wxHtmlBookRecord *book; + + // returns full filename of m_Page, i.e. with book's basePath prepended + wxString GetFullPath() const { return book->GetFullPath(page); } + + // returns item indented with spaces if it has level>1: + wxString GetIndentedName() const; +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlHelpDataItem, wxHtmlHelpDataItems, + WXDLLIMPEXP_HTML); + +#if WXWIN_COMPATIBILITY_2_4 +// old interface to contents and index: +struct wxHtmlContentsItem +{ + wxHtmlContentsItem(); + wxHtmlContentsItem(const wxHtmlHelpDataItem& d); + wxHtmlContentsItem& operator=(const wxHtmlContentsItem& d); + ~wxHtmlContentsItem(); + + int m_Level; + int m_ID; + wxChar *m_Name; + wxChar *m_Page; + wxHtmlBookRecord *m_Book; + + // returns full filename of m_Page, i.e. with book's basePath prepended + wxString GetFullPath() const { return m_Book->GetFullPath(m_Page); } + +private: + bool m_autofree; +}; +#endif + + +//------------------------------------------------------------------------------ +// wxHtmlSearchEngine +// This class takes input streams and scans them for occurence +// of keyword(s) +//------------------------------------------------------------------------------ + +class WXDLLIMPEXP_HTML wxHtmlSearchEngine : public wxObject +{ +public: + wxHtmlSearchEngine() : wxObject() {} + virtual ~wxHtmlSearchEngine() {} + + // Sets the keyword we will be searching for + virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only); + + // Scans the stream for the keyword. + // Returns true if the stream contains keyword, fALSE otherwise + virtual bool Scan(const wxFSFile& file); + +private: + wxString m_Keyword; + bool m_CaseSensitive; + bool m_WholeWords; + + DECLARE_NO_COPY_CLASS(wxHtmlSearchEngine) +}; + + +// State information of a search action. I'd have preferred to make this a +// nested class inside wxHtmlHelpData, but that's against coding standards :-( +// Never construct this class yourself, obtain a copy from +// wxHtmlHelpData::PrepareKeywordSearch(const wxString& key) +class WXDLLIMPEXP_HTML wxHtmlSearchStatus +{ +public: + // constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the + // title of the book to search. By default, all books are searched. + wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword, + bool case_sensitive, bool whole_words_only, + const wxString& book = wxEmptyString); + bool Search(); // do the next iteration + bool IsActive() { return m_Active; } + int GetCurIndex() { return m_CurIndex; } + int GetMaxIndex() { return m_MaxIndex; } + const wxString& GetName() { return m_Name; } + + const wxHtmlHelpDataItem *GetCurItem() const { return m_CurItem; } +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( wxHtmlContentsItem* GetContentsItem() ); +#endif + +private: + wxHtmlHelpData* m_Data; + wxHtmlSearchEngine m_Engine; + wxString m_Keyword, m_Name; + wxString m_LastPage; + wxHtmlHelpDataItem* m_CurItem; + bool m_Active; // search is not finished + int m_CurIndex; // where we are now + int m_MaxIndex; // number of files we search + // For progress bar: 100*curindex/maxindex = % complete + + DECLARE_NO_COPY_CLASS(wxHtmlSearchStatus) +}; + +class WXDLLIMPEXP_HTML wxHtmlHelpData : public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxHtmlHelpData) + friend class wxHtmlSearchStatus; + +public: + wxHtmlHelpData(); + virtual ~wxHtmlHelpData(); + + // Sets directory where temporary files are stored. + // These temp files are index & contents file in binary (much faster to read) + // form. These files are NOT deleted on program's exit. + void SetTempDir(const wxString& path); + + // Adds new book. 'book' is location of .htb file (stands for "html book"). + // See documentation for details on its format. + // Returns success. + bool AddBook(const wxString& book); + bool AddBookParam(const wxFSFile& bookfile, + wxFontEncoding encoding, + const wxString& title, const wxString& contfile, + const wxString& indexfile = wxEmptyString, + const wxString& deftopic = wxEmptyString, + const wxString& path = wxEmptyString); + + // Some accessing stuff: + + // returns URL of page on basis of (file)name + wxString FindPageByName(const wxString& page); + // returns URL of page on basis of MS id + wxString FindPageById(int id); + + const wxHtmlBookRecArray& GetBookRecArray() const { return m_bookRecords; } + + const wxHtmlHelpDataItems& GetContentsArray() const { return m_contents; } + const wxHtmlHelpDataItems& GetIndexArray() const { return m_index; } + +#if WXWIN_COMPATIBILITY_2_4 + // deprecated interface, new interface is arrays-based (see above) + wxDEPRECATED( wxHtmlContentsItem* GetContents() ); + wxDEPRECATED( int GetContentsCnt() ); + wxDEPRECATED( wxHtmlContentsItem* GetIndex() ); + wxDEPRECATED( int GetIndexCnt() ); +#endif + +protected: + wxString m_tempPath; + + // each book has one record in this array: + wxHtmlBookRecArray m_bookRecords; + + wxHtmlHelpDataItems m_contents; // list of all available books and pages + wxHtmlHelpDataItems m_index; // list of index itesm + +#if WXWIN_COMPATIBILITY_2_4 + // deprecated data structures, set only if GetContents(), GetIndex() + // called + wxHtmlContentsItem* m_cacheContents; + wxHtmlContentsItem* m_cacheIndex; +private: + void CleanCompatibilityData(); +#endif + +protected: + // Imports .hhp files (MS HTML Help Workshop) + bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, + const wxString& indexfile, const wxString& contentsfile); + // Reads binary book + bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f); + // Writes binary book + bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f); + + DECLARE_NO_COPY_CLASS(wxHtmlHelpData) +}; + +#endif + +#endif diff --git a/Externals/wxWidgets/include/wx/html/helpdlg.h b/Externals/wxWidgets/include/wx/html/helpdlg.h index d63d31d1cc..9f10c6a4d7 100644 --- a/Externals/wxWidgets/include/wx/html/helpdlg.h +++ b/Externals/wxWidgets/include/wx/html/helpdlg.h @@ -1,90 +1,90 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/html/helpdlg.h -// Purpose: wxHtmlHelpDialog -// Notes: Based on htmlhelp.cpp, implementing a monolithic -// HTML Help controller class, by Vaclav Slavik -// Author: Harm van der Heijden, Vaclav Slavik, Julian Smart -// RCS-ID: $Id: helpdlg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Harm van der Heijden, Vaclav Slavik, Julian Smart -// Licence: wxWidgets licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPDLG_H_ -#define _WX_HELPDLG_H_ - -#include "wx/defs.h" - -#if wxUSE_WXHTML_HELP - -#include "wx/html/helpdata.h" -#include "wx/window.h" -#include "wx/dialog.h" -#include "wx/frame.h" -#include "wx/config.h" -#include "wx/splitter.h" -#include "wx/notebook.h" -#include "wx/listbox.h" -#include "wx/choice.h" -#include "wx/combobox.h" -#include "wx/checkbox.h" -#include "wx/stattext.h" -#include "wx/html/htmlwin.h" -#include "wx/html/helpwnd.h" -#include "wx/html/htmprint.h" - -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; - -class WXDLLIMPEXP_HTML wxHtmlHelpDialog : public wxDialog -{ - DECLARE_DYNAMIC_CLASS(wxHtmlHelpDialog) - -public: - wxHtmlHelpDialog(wxHtmlHelpData* data = NULL) { Init(data); } - wxHtmlHelpDialog(wxWindow* parent, wxWindowID wxWindowID, - const wxString& title = wxEmptyString, - int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL); - virtual ~wxHtmlHelpDialog(); - - bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, - int style = wxHF_DEFAULT_STYLE); - - /// Returns the data associated with this dialog. - wxHtmlHelpData* GetData() { return m_Data; } - - /// Returns the controller that created this dialog. - wxHtmlHelpController* GetController() const { return m_helpController; } - - /// Sets the controller associated with this dialog. - void SetController(wxHtmlHelpController* controller) { m_helpController = controller; } - - /// Returns the help window. - wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } - - // Sets format of title of the frame. Must contain exactly one "%s" - // (for title of displayed HTML page) - void SetTitleFormat(const wxString& format); - - // Override to add custom buttons to the toolbar - virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} - -protected: - void Init(wxHtmlHelpData* data = NULL); - - void OnCloseWindow(wxCloseEvent& event); - -protected: - // Temporary pointer to pass to window - wxHtmlHelpData* m_Data; - wxString m_TitleFormat; // title of the help frame - wxHtmlHelpWindow *m_HtmlHelpWin; - wxHtmlHelpController* m_helpController; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxHtmlHelpDialog) -}; - -#endif - // wxUSE_WXHTML_HELP - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpdlg.h +// Purpose: wxHtmlHelpDialog +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden, Vaclav Slavik, Julian Smart +// RCS-ID: $Id: helpdlg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Harm van der Heijden, Vaclav Slavik, Julian Smart +// Licence: wxWidgets licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPDLG_H_ +#define _WX_HELPDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/html/helpdata.h" +#include "wx/window.h" +#include "wx/dialog.h" +#include "wx/frame.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listbox.h" +#include "wx/choice.h" +#include "wx/combobox.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" +#include "wx/html/htmlwin.h" +#include "wx/html/helpwnd.h" +#include "wx/html/htmprint.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; + +class WXDLLIMPEXP_HTML wxHtmlHelpDialog : public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxHtmlHelpDialog) + +public: + wxHtmlHelpDialog(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpDialog(wxWindow* parent, wxWindowID wxWindowID, + const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL); + virtual ~wxHtmlHelpDialog(); + + bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE); + + /// Returns the data associated with this dialog. + wxHtmlHelpData* GetData() { return m_Data; } + + /// Returns the controller that created this dialog. + wxHtmlHelpController* GetController() const { return m_helpController; } + + /// Sets the controller associated with this dialog. + void SetController(wxHtmlHelpController* controller) { m_helpController = controller; } + + /// Returns the help window. + wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } + + // Sets format of title of the frame. Must contain exactly one "%s" + // (for title of displayed HTML page) + void SetTitleFormat(const wxString& format); + + // Override to add custom buttons to the toolbar + virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} + +protected: + void Init(wxHtmlHelpData* data = NULL); + + void OnCloseWindow(wxCloseEvent& event); + +protected: + // Temporary pointer to pass to window + wxHtmlHelpData* m_Data; + wxString m_TitleFormat; // title of the help frame + wxHtmlHelpWindow *m_HtmlHelpWin; + wxHtmlHelpController* m_helpController; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxHtmlHelpDialog) +}; + +#endif + // wxUSE_WXHTML_HELP + +#endif diff --git a/Externals/wxWidgets/include/wx/html/helpfrm.h b/Externals/wxWidgets/include/wx/html/helpfrm.h index 26ee3fdd78..3a9b3e12b9 100644 --- a/Externals/wxWidgets/include/wx/html/helpfrm.h +++ b/Externals/wxWidgets/include/wx/html/helpfrm.h @@ -1,147 +1,147 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpfrm.h -// Purpose: wxHtmlHelpFrame -// Notes: Based on htmlhelp.cpp, implementing a monolithic -// HTML Help controller class, by Vaclav Slavik -// Author: Harm van der Heijden and Vaclav Slavik -// RCS-ID: $Id: helpfrm.h 50202 2007-11-23 21:29:29Z VZ $ -// Copyright: (c) Harm van der Heijden and Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPFRM_H_ -#define _WX_HELPFRM_H_ - -#include "wx/defs.h" - -#if wxUSE_WXHTML_HELP - -#include "wx/helpbase.h" -#include "wx/html/helpdata.h" -#include "wx/window.h" -#include "wx/frame.h" -#include "wx/config.h" -#include "wx/splitter.h" -#include "wx/notebook.h" -#include "wx/listbox.h" -#include "wx/choice.h" -#include "wx/combobox.h" -#include "wx/checkbox.h" -#include "wx/stattext.h" -#include "wx/html/htmlwin.h" -#include "wx/html/helpwnd.h" -#include "wx/html/htmprint.h" - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxTreeEvent; -class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; - - -// style flags for the Help Frame -#define wxHF_TOOLBAR 0x0001 -#define wxHF_CONTENTS 0x0002 -#define wxHF_INDEX 0x0004 -#define wxHF_SEARCH 0x0008 -#define wxHF_BOOKMARKS 0x0010 -#define wxHF_OPEN_FILES 0x0020 -#define wxHF_PRINT 0x0040 -#define wxHF_FLAT_TOOLBAR 0x0080 -#define wxHF_MERGE_BOOKS 0x0100 -#define wxHF_ICONS_BOOK 0x0200 -#define wxHF_ICONS_BOOK_CHAPTER 0x0400 -#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default -#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ - wxHF_INDEX | wxHF_SEARCH | \ - wxHF_BOOKMARKS | wxHF_PRINT) -//compatibility: -#define wxHF_OPENFILES wxHF_OPEN_FILES -#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR -#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE - -struct wxHtmlHelpMergedIndexItem; -class wxHtmlHelpMergedIndex; - -class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; - -class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame -{ - DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame) - -public: - wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); } - wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID, - const wxString& title = wxEmptyString, - int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL, - wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString); - bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, - int style = wxHF_DEFAULT_STYLE, - wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString); - virtual ~wxHtmlHelpFrame(); - - /// Returns the data associated with the window. - wxHtmlHelpData* GetData() { return m_Data; } - - /// Returns the help controller associated with the window. - wxHtmlHelpController* GetController() const { return m_helpController; } - - /// Sets the help controller associated with the window. - void SetController(wxHtmlHelpController* controller) { m_helpController = controller; } - - /// Returns the help window. - wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } - - // Sets format of title of the frame. Must contain exactly one "%s" - // (for title of displayed HTML page) - void SetTitleFormat(const wxString& format); - - // For compatibility - void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); - - // Make the help controller's frame 'modal' if - // needed - void AddGrabIfNeeded(); - - // Override to add custom buttons to the toolbar - virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} - - // we don't want to prevent the app from closing just because a help window - // remains opened - virtual bool ShouldPreventAppExit() const { return false; } - -protected: - void Init(wxHtmlHelpData* data = NULL); - - void OnCloseWindow(wxCloseEvent& event); - void OnActivate(wxActivateEvent& event); - -#ifdef __WXMAC__ - void OnClose(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); -#endif - - // Images: - enum { - IMG_Book = 0, - IMG_Folder, - IMG_Page - }; - -protected: - wxHtmlHelpData* m_Data; - bool m_DataCreated; // m_Data created by frame, or supplied? - wxString m_TitleFormat; // title of the help frame - wxHtmlHelpWindow *m_HtmlHelpWin; - wxHtmlHelpController* m_helpController; - -private: - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxHtmlHelpFrame) -}; - -#endif // wxUSE_WXHTML_HELP - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: helpfrm.h +// Purpose: wxHtmlHelpFrame +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// RCS-ID: $Id: helpfrm.h 50202 2007-11-23 21:29:29Z VZ $ +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPFRM_H_ +#define _WX_HELPFRM_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/helpbase.h" +#include "wx/html/helpdata.h" +#include "wx/window.h" +#include "wx/frame.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listbox.h" +#include "wx/choice.h" +#include "wx/combobox.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" +#include "wx/html/htmlwin.h" +#include "wx/html/helpwnd.h" +#include "wx/html/htmprint.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; +class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; + + +// style flags for the Help Frame +#define wxHF_TOOLBAR 0x0001 +#define wxHF_CONTENTS 0x0002 +#define wxHF_INDEX 0x0004 +#define wxHF_SEARCH 0x0008 +#define wxHF_BOOKMARKS 0x0010 +#define wxHF_OPEN_FILES 0x0020 +#define wxHF_PRINT 0x0040 +#define wxHF_FLAT_TOOLBAR 0x0080 +#define wxHF_MERGE_BOOKS 0x0100 +#define wxHF_ICONS_BOOK 0x0200 +#define wxHF_ICONS_BOOK_CHAPTER 0x0400 +#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default +#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ + wxHF_INDEX | wxHF_SEARCH | \ + wxHF_BOOKMARKS | wxHF_PRINT) +//compatibility: +#define wxHF_OPENFILES wxHF_OPEN_FILES +#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR +#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE + +struct wxHtmlHelpMergedIndexItem; +class wxHtmlHelpMergedIndex; + +class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; + +class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame +{ + DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame) + +public: + wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID, + const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL, + wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString); + bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE, + wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString); + virtual ~wxHtmlHelpFrame(); + + /// Returns the data associated with the window. + wxHtmlHelpData* GetData() { return m_Data; } + + /// Returns the help controller associated with the window. + wxHtmlHelpController* GetController() const { return m_helpController; } + + /// Sets the help controller associated with the window. + void SetController(wxHtmlHelpController* controller) { m_helpController = controller; } + + /// Returns the help window. + wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } + + // Sets format of title of the frame. Must contain exactly one "%s" + // (for title of displayed HTML page) + void SetTitleFormat(const wxString& format); + + // For compatibility + void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); + + // Make the help controller's frame 'modal' if + // needed + void AddGrabIfNeeded(); + + // Override to add custom buttons to the toolbar + virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} + + // we don't want to prevent the app from closing just because a help window + // remains opened + virtual bool ShouldPreventAppExit() const { return false; } + +protected: + void Init(wxHtmlHelpData* data = NULL); + + void OnCloseWindow(wxCloseEvent& event); + void OnActivate(wxActivateEvent& event); + +#ifdef __WXMAC__ + void OnClose(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); +#endif + + // Images: + enum { + IMG_Book = 0, + IMG_Folder, + IMG_Page + }; + +protected: + wxHtmlHelpData* m_Data; + bool m_DataCreated; // m_Data created by frame, or supplied? + wxString m_TitleFormat; // title of the help frame + wxHtmlHelpWindow *m_HtmlHelpWin; + wxHtmlHelpController* m_helpController; + +private: + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxHtmlHelpFrame) +}; + +#endif // wxUSE_WXHTML_HELP + +#endif diff --git a/Externals/wxWidgets/include/wx/html/helpwnd.h b/Externals/wxWidgets/include/wx/html/helpwnd.h index d0b017920f..e0541092c0 100644 --- a/Externals/wxWidgets/include/wx/html/helpwnd.h +++ b/Externals/wxWidgets/include/wx/html/helpwnd.h @@ -1,300 +1,300 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/html/helpwnd.h -// Purpose: wxHtmlHelpWindow -// Notes: Based on htmlhelp.cpp, implementing a monolithic -// HTML Help controller class, by Vaclav Slavik -// Author: Harm van der Heijden and Vaclav Slavik -// RCS-ID: $Id: helpwnd.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Harm van der Heijden and Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPWND_H_ -#define _WX_HELPWND_H_ - -#include "wx/defs.h" - -#if wxUSE_WXHTML_HELP - -#include "wx/helpbase.h" -#include "wx/html/helpdata.h" -#include "wx/window.h" -#include "wx/frame.h" -#include "wx/config.h" -#include "wx/splitter.h" -#include "wx/notebook.h" -#include "wx/listbox.h" -#include "wx/choice.h" -#include "wx/combobox.h" -#include "wx/checkbox.h" -#include "wx/stattext.h" -#include "wx/html/htmlwin.h" -#include "wx/html/htmprint.h" - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxTreeEvent; -class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; - -// style flags for the Help Frame -#define wxHF_TOOLBAR 0x0001 -#define wxHF_CONTENTS 0x0002 -#define wxHF_INDEX 0x0004 -#define wxHF_SEARCH 0x0008 -#define wxHF_BOOKMARKS 0x0010 -#define wxHF_OPEN_FILES 0x0020 -#define wxHF_PRINT 0x0040 -#define wxHF_FLAT_TOOLBAR 0x0080 -#define wxHF_MERGE_BOOKS 0x0100 -#define wxHF_ICONS_BOOK 0x0200 -#define wxHF_ICONS_BOOK_CHAPTER 0x0400 -#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default -#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ - wxHF_INDEX | wxHF_SEARCH | \ - wxHF_BOOKMARKS | wxHF_PRINT) -//compatibility: -#define wxHF_OPENFILES wxHF_OPEN_FILES -#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR -#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE - -struct wxHtmlHelpFrameCfg -{ - int x, y, w, h; - long sashpos; - bool navig_on; -}; - -struct wxHtmlHelpMergedIndexItem; -class wxHtmlHelpMergedIndex; - -class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; -class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; - -/*! - * Help window - */ - -class WXDLLIMPEXP_HTML wxHtmlHelpWindow : public wxWindow -{ - DECLARE_DYNAMIC_CLASS(wxHtmlHelpWindow) - -public: - wxHtmlHelpWindow(wxHtmlHelpData* data = NULL) { Init(data); } - wxHtmlHelpWindow(wxWindow* parent, wxWindowID wxWindowID, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int style = wxTAB_TRAVERSAL|wxNO_BORDER, - int helpStyle = wxHF_DEFAULT_STYLE, - wxHtmlHelpData* data = NULL); - bool Create(wxWindow* parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int style = wxTAB_TRAVERSAL|wxNO_BORDER, - int helpStyle = wxHF_DEFAULT_STYLE); - virtual ~wxHtmlHelpWindow(); - - wxHtmlHelpData* GetData() { return m_Data; } - wxHtmlHelpController* GetController() const { return m_helpController; } - void SetController(wxHtmlHelpController* controller); - - // Displays page x. If not found it will offect the user a choice of - // searching books. - // Looking for the page runs in these steps: - // 1. try to locate file named x (if x is for example "doc/howto.htm") - // 2. try to open starting page of book x - // 3. try to find x in contents (if x is for example "How To ...") - // 4. try to find x in index (if x is for example "How To ...") - bool Display(const wxString& x); - - // Alternative version that works with numeric ID. - // (uses extension to MS format, , see docs) - bool Display(const int id); - - // Displays help window and focuses contents. - bool DisplayContents(); - - // Displays help window and focuses index. - bool DisplayIndex(); - - // Searches for keyword. Returns true and display page if found, return - // false otherwise - // Syntax of keyword is Altavista-like: - // * words are separated by spaces - // (but "\"hello world\"" is only one world "hello world") - // * word may be pretended by + or - - // (+ : page must contain the word ; - : page can't contain the word) - // * if there is no + or - before the word, + is default - bool KeywordSearch(const wxString& keyword, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - - void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) - { - m_Config = config; - m_ConfigRoot = rootpath; - ReadCustomization(config, rootpath); - } - - // Saves custom settings into cfg config. it will use the path 'path' - // if given, otherwise it will save info into currently selected path. - // saved values : things set by SetFonts, SetBorders. - void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); - void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); - - // call this to let wxHtmlHelpWindow know page changed - void NotifyPageChanged(); - - // Refreshes Contents and Index tabs - void RefreshLists(); - - // Gets the HTML window - wxHtmlWindow* GetHtmlWindow() const { return m_HtmlWin; } - - // Gets the splitter window - wxSplitterWindow* GetSplitterWindow() const { return m_Splitter; } - - // Gets the toolbar - wxToolBar* GetToolBar() const { return m_toolBar; } - - // Gets the configuration data - wxHtmlHelpFrameCfg& GetCfgData() { return m_Cfg; } - - // Gets the tree control - wxTreeCtrl *GetTreeCtrl() const { return m_ContentsBox; } - -protected: - void Init(wxHtmlHelpData* data = NULL); - - // Adds items to m_Contents tree control - void CreateContents(); - - // Adds items to m_IndexList - void CreateIndex(); - - // Add books to search choice panel - void CreateSearch(); - - // Updates "merged index" structure that combines indexes of all books - // into better searchable structure - void UpdateMergedIndex(); - - // Add custom buttons to toolbar - virtual void AddToolbarButtons(wxToolBar *toolBar, int style); - - // Displays options dialog (fonts etc.) - virtual void OptionsDialog(); - - void OnToolbar(wxCommandEvent& event); - void OnContentsSel(wxTreeEvent& event); - void OnIndexSel(wxCommandEvent& event); - void OnIndexFind(wxCommandEvent& event); - void OnIndexAll(wxCommandEvent& event); - void OnSearchSel(wxCommandEvent& event); - void OnSearch(wxCommandEvent& event); - void OnBookmarksSel(wxCommandEvent& event); - void OnSize(wxSizeEvent& event); - - // Images: - enum { - IMG_Book = 0, - IMG_Folder, - IMG_Page - }; - -protected: - wxHtmlHelpData* m_Data; - bool m_DataCreated; // m_Data created by frame, or supplied? - wxString m_TitleFormat; // title of the help frame - // below are various pointers to GUI components - wxHtmlWindow *m_HtmlWin; - wxSplitterWindow *m_Splitter; - wxPanel *m_NavigPan; - wxNotebook *m_NavigNotebook; - wxTreeCtrl *m_ContentsBox; - wxTextCtrl *m_IndexText; - wxButton *m_IndexButton; - wxButton *m_IndexButtonAll; - wxListBox *m_IndexList; - wxTextCtrl *m_SearchText; - wxButton *m_SearchButton; - wxListBox *m_SearchList; - wxChoice *m_SearchChoice; - wxStaticText *m_IndexCountInfo; - wxCheckBox *m_SearchCaseSensitive; - wxCheckBox *m_SearchWholeWords; - wxToolBar* m_toolBar; - - wxComboBox *m_Bookmarks; - wxArrayString m_BookmarksNames, m_BookmarksPages; - - wxHtmlHelpFrameCfg m_Cfg; - - wxConfigBase *m_Config; - wxString m_ConfigRoot; - - // pagenumbers of controls in notebook (usually 0,1,2) - int m_ContentsPage; - int m_IndexPage; - int m_SearchPage; - - // lists of available fonts (used in options dialog) - wxArrayString *m_NormalFonts, *m_FixedFonts; - int m_FontSize; // 0,1,2 = small,medium,big - wxString m_NormalFace, m_FixedFace; - - bool m_UpdateContents; - -#if wxUSE_PRINTING_ARCHITECTURE - wxHtmlEasyPrinting *m_Printer; -#endif - wxHashTable *m_PagesHash; - wxHtmlHelpController* m_helpController; - - int m_hfStyle; - -private: - void DoIndexFind(); - void DoIndexAll(); - void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it); - wxHtmlHelpMergedIndex *m_mergedIndex; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxHtmlHelpWindow) -}; - -/*! - * Command IDs - */ - -enum -{ - //wxID_HTML_HELPFRAME = wxID_HIGHEST + 1, - wxID_HTML_PANEL = wxID_HIGHEST + 2, - wxID_HTML_BACK, - wxID_HTML_FORWARD, - wxID_HTML_UPNODE, - wxID_HTML_UP, - wxID_HTML_DOWN, - wxID_HTML_PRINT, - wxID_HTML_OPENFILE, - wxID_HTML_OPTIONS, - wxID_HTML_BOOKMARKSLIST, - wxID_HTML_BOOKMARKSADD, - wxID_HTML_BOOKMARKSREMOVE, - wxID_HTML_TREECTRL, - wxID_HTML_INDEXPAGE, - wxID_HTML_INDEXLIST, - wxID_HTML_INDEXTEXT, - wxID_HTML_INDEXBUTTON, - wxID_HTML_INDEXBUTTONALL, - wxID_HTML_NOTEBOOK, - wxID_HTML_SEARCHPAGE, - wxID_HTML_SEARCHTEXT, - wxID_HTML_SEARCHLIST, - wxID_HTML_SEARCHBUTTON, - wxID_HTML_SEARCHCHOICE, - wxID_HTML_COUNTINFO -}; - -#endif // wxUSE_WXHTML_HELP - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpwnd.h +// Purpose: wxHtmlHelpWindow +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// RCS-ID: $Id: helpwnd.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWND_H_ +#define _WX_HELPWND_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/helpbase.h" +#include "wx/html/helpdata.h" +#include "wx/window.h" +#include "wx/frame.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listbox.h" +#include "wx/choice.h" +#include "wx/combobox.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" +#include "wx/html/htmlwin.h" +#include "wx/html/htmprint.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; +class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; + +// style flags for the Help Frame +#define wxHF_TOOLBAR 0x0001 +#define wxHF_CONTENTS 0x0002 +#define wxHF_INDEX 0x0004 +#define wxHF_SEARCH 0x0008 +#define wxHF_BOOKMARKS 0x0010 +#define wxHF_OPEN_FILES 0x0020 +#define wxHF_PRINT 0x0040 +#define wxHF_FLAT_TOOLBAR 0x0080 +#define wxHF_MERGE_BOOKS 0x0100 +#define wxHF_ICONS_BOOK 0x0200 +#define wxHF_ICONS_BOOK_CHAPTER 0x0400 +#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default +#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ + wxHF_INDEX | wxHF_SEARCH | \ + wxHF_BOOKMARKS | wxHF_PRINT) +//compatibility: +#define wxHF_OPENFILES wxHF_OPEN_FILES +#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR +#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE + +struct wxHtmlHelpFrameCfg +{ + int x, y, w, h; + long sashpos; + bool navig_on; +}; + +struct wxHtmlHelpMergedIndexItem; +class wxHtmlHelpMergedIndex; + +class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; + +/*! + * Help window + */ + +class WXDLLIMPEXP_HTML wxHtmlHelpWindow : public wxWindow +{ + DECLARE_DYNAMIC_CLASS(wxHtmlHelpWindow) + +public: + wxHtmlHelpWindow(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpWindow(wxWindow* parent, wxWindowID wxWindowID, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int style = wxTAB_TRAVERSAL|wxNO_BORDER, + int helpStyle = wxHF_DEFAULT_STYLE, + wxHtmlHelpData* data = NULL); + bool Create(wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int style = wxTAB_TRAVERSAL|wxNO_BORDER, + int helpStyle = wxHF_DEFAULT_STYLE); + virtual ~wxHtmlHelpWindow(); + + wxHtmlHelpData* GetData() { return m_Data; } + wxHtmlHelpController* GetController() const { return m_helpController; } + void SetController(wxHtmlHelpController* controller); + + // Displays page x. If not found it will offect the user a choice of + // searching books. + // Looking for the page runs in these steps: + // 1. try to locate file named x (if x is for example "doc/howto.htm") + // 2. try to open starting page of book x + // 3. try to find x in contents (if x is for example "How To ...") + // 4. try to find x in index (if x is for example "How To ...") + bool Display(const wxString& x); + + // Alternative version that works with numeric ID. + // (uses extension to MS format, , see docs) + bool Display(const int id); + + // Displays help window and focuses contents. + bool DisplayContents(); + + // Displays help window and focuses index. + bool DisplayIndex(); + + // Searches for keyword. Returns true and display page if found, return + // false otherwise + // Syntax of keyword is Altavista-like: + // * words are separated by spaces + // (but "\"hello world\"" is only one world "hello world") + // * word may be pretended by + or - + // (+ : page must contain the word ; - : page can't contain the word) + // * if there is no + or - before the word, + is default + bool KeywordSearch(const wxString& keyword, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + + void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) + { + m_Config = config; + m_ConfigRoot = rootpath; + ReadCustomization(config, rootpath); + } + + // Saves custom settings into cfg config. it will use the path 'path' + // if given, otherwise it will save info into currently selected path. + // saved values : things set by SetFonts, SetBorders. + void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); + void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); + + // call this to let wxHtmlHelpWindow know page changed + void NotifyPageChanged(); + + // Refreshes Contents and Index tabs + void RefreshLists(); + + // Gets the HTML window + wxHtmlWindow* GetHtmlWindow() const { return m_HtmlWin; } + + // Gets the splitter window + wxSplitterWindow* GetSplitterWindow() const { return m_Splitter; } + + // Gets the toolbar + wxToolBar* GetToolBar() const { return m_toolBar; } + + // Gets the configuration data + wxHtmlHelpFrameCfg& GetCfgData() { return m_Cfg; } + + // Gets the tree control + wxTreeCtrl *GetTreeCtrl() const { return m_ContentsBox; } + +protected: + void Init(wxHtmlHelpData* data = NULL); + + // Adds items to m_Contents tree control + void CreateContents(); + + // Adds items to m_IndexList + void CreateIndex(); + + // Add books to search choice panel + void CreateSearch(); + + // Updates "merged index" structure that combines indexes of all books + // into better searchable structure + void UpdateMergedIndex(); + + // Add custom buttons to toolbar + virtual void AddToolbarButtons(wxToolBar *toolBar, int style); + + // Displays options dialog (fonts etc.) + virtual void OptionsDialog(); + + void OnToolbar(wxCommandEvent& event); + void OnContentsSel(wxTreeEvent& event); + void OnIndexSel(wxCommandEvent& event); + void OnIndexFind(wxCommandEvent& event); + void OnIndexAll(wxCommandEvent& event); + void OnSearchSel(wxCommandEvent& event); + void OnSearch(wxCommandEvent& event); + void OnBookmarksSel(wxCommandEvent& event); + void OnSize(wxSizeEvent& event); + + // Images: + enum { + IMG_Book = 0, + IMG_Folder, + IMG_Page + }; + +protected: + wxHtmlHelpData* m_Data; + bool m_DataCreated; // m_Data created by frame, or supplied? + wxString m_TitleFormat; // title of the help frame + // below are various pointers to GUI components + wxHtmlWindow *m_HtmlWin; + wxSplitterWindow *m_Splitter; + wxPanel *m_NavigPan; + wxNotebook *m_NavigNotebook; + wxTreeCtrl *m_ContentsBox; + wxTextCtrl *m_IndexText; + wxButton *m_IndexButton; + wxButton *m_IndexButtonAll; + wxListBox *m_IndexList; + wxTextCtrl *m_SearchText; + wxButton *m_SearchButton; + wxListBox *m_SearchList; + wxChoice *m_SearchChoice; + wxStaticText *m_IndexCountInfo; + wxCheckBox *m_SearchCaseSensitive; + wxCheckBox *m_SearchWholeWords; + wxToolBar* m_toolBar; + + wxComboBox *m_Bookmarks; + wxArrayString m_BookmarksNames, m_BookmarksPages; + + wxHtmlHelpFrameCfg m_Cfg; + + wxConfigBase *m_Config; + wxString m_ConfigRoot; + + // pagenumbers of controls in notebook (usually 0,1,2) + int m_ContentsPage; + int m_IndexPage; + int m_SearchPage; + + // lists of available fonts (used in options dialog) + wxArrayString *m_NormalFonts, *m_FixedFonts; + int m_FontSize; // 0,1,2 = small,medium,big + wxString m_NormalFace, m_FixedFace; + + bool m_UpdateContents; + +#if wxUSE_PRINTING_ARCHITECTURE + wxHtmlEasyPrinting *m_Printer; +#endif + wxHashTable *m_PagesHash; + wxHtmlHelpController* m_helpController; + + int m_hfStyle; + +private: + void DoIndexFind(); + void DoIndexAll(); + void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it); + wxHtmlHelpMergedIndex *m_mergedIndex; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxHtmlHelpWindow) +}; + +/*! + * Command IDs + */ + +enum +{ + //wxID_HTML_HELPFRAME = wxID_HIGHEST + 1, + wxID_HTML_PANEL = wxID_HIGHEST + 2, + wxID_HTML_BACK, + wxID_HTML_FORWARD, + wxID_HTML_UPNODE, + wxID_HTML_UP, + wxID_HTML_DOWN, + wxID_HTML_PRINT, + wxID_HTML_OPENFILE, + wxID_HTML_OPTIONS, + wxID_HTML_BOOKMARKSLIST, + wxID_HTML_BOOKMARKSADD, + wxID_HTML_BOOKMARKSREMOVE, + wxID_HTML_TREECTRL, + wxID_HTML_INDEXPAGE, + wxID_HTML_INDEXLIST, + wxID_HTML_INDEXTEXT, + wxID_HTML_INDEXBUTTON, + wxID_HTML_INDEXBUTTONALL, + wxID_HTML_NOTEBOOK, + wxID_HTML_SEARCHPAGE, + wxID_HTML_SEARCHTEXT, + wxID_HTML_SEARCHLIST, + wxID_HTML_SEARCHBUTTON, + wxID_HTML_SEARCHCHOICE, + wxID_HTML_COUNTINFO +}; + +#endif // wxUSE_WXHTML_HELP + +#endif diff --git a/Externals/wxWidgets/include/wx/html/htmlcell.h b/Externals/wxWidgets/include/wx/html/htmlcell.h index 70113d1f7e..adb194dcc4 100644 --- a/Externals/wxWidgets/include/wx/html/htmlcell.h +++ b/Externals/wxWidgets/include/wx/html/htmlcell.h @@ -1,673 +1,673 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmlcell.h -// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser -// as a basic visual element of HTML page -// Author: Vaclav Slavik -// RCS-ID: $Id: htmlcell.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999-2003 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLCELL_H_ -#define _WX_HTMLCELL_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -#include "wx/html/htmltag.h" -#include "wx/html/htmldefs.h" -#include "wx/window.h" - - -class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface; -class WXDLLIMPEXP_FWD_HTML wxHtmlLinkInfo; -class WXDLLIMPEXP_FWD_HTML wxHtmlCell; -class WXDLLIMPEXP_FWD_HTML wxHtmlContainerCell; - - -// wxHtmlSelection is data holder with information about text selection. -// Selection is defined by two positions (beginning and end of the selection) -// and two leaf(!) cells at these positions. -class WXDLLIMPEXP_HTML wxHtmlSelection -{ -public: - wxHtmlSelection() - : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition), - m_fromPrivPos(wxDefaultPosition), m_toPrivPos(wxDefaultPosition), - m_fromCell(NULL), m_toCell(NULL) {} - - void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell, - const wxPoint& toPos, const wxHtmlCell *toCell); - void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell); - - const wxHtmlCell *GetFromCell() const { return m_fromCell; } - const wxHtmlCell *GetToCell() const { return m_toCell; } - - // these values are in absolute coordinates: - const wxPoint& GetFromPos() const { return m_fromPos; } - const wxPoint& GetToPos() const { return m_toPos; } - - // these are From/ToCell's private data - const wxPoint& GetFromPrivPos() const { return m_fromPrivPos; } - const wxPoint& GetToPrivPos() const { return m_toPrivPos; } - void SetFromPrivPos(const wxPoint& pos) { m_fromPrivPos = pos; } - void SetToPrivPos(const wxPoint& pos) { m_toPrivPos = pos; } - void ClearPrivPos() { m_toPrivPos = m_fromPrivPos = wxDefaultPosition; } - - bool IsEmpty() const - { return m_fromPos == wxDefaultPosition && - m_toPos == wxDefaultPosition; } - -private: - wxPoint m_fromPos, m_toPos; - wxPoint m_fromPrivPos, m_toPrivPos; - const wxHtmlCell *m_fromCell, *m_toCell; -}; - - - -enum wxHtmlSelectionState -{ - wxHTML_SEL_OUT, // currently rendered cell is outside the selection - wxHTML_SEL_IN, // ... is inside selection - wxHTML_SEL_CHANGING // ... is the cell on which selection state changes -}; - -// Selection state is passed to wxHtmlCell::Draw so that it can render itself -// differently e.g. when inside text selection or outside it. -class WXDLLIMPEXP_HTML wxHtmlRenderingState -{ -public: - wxHtmlRenderingState() : m_selState(wxHTML_SEL_OUT) {} - - void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; } - wxHtmlSelectionState GetSelectionState() const { return m_selState; } - - void SetFgColour(const wxColour& c) { m_fgColour = c; } - const wxColour& GetFgColour() const { return m_fgColour; } - void SetBgColour(const wxColour& c) { m_bgColour = c; } - const wxColour& GetBgColour() const { return m_bgColour; } - -private: - wxHtmlSelectionState m_selState; - wxColour m_fgColour, m_bgColour; -}; - - -// HTML rendering customization. This class is used when rendering wxHtmlCells -// as a callback: -class WXDLLIMPEXP_HTML wxHtmlRenderingStyle -{ -public: - virtual ~wxHtmlRenderingStyle() {} - virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0; - virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0; -}; - -// Standard style: -class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle -{ -public: - virtual wxColour GetSelectedTextColour(const wxColour& clr); - virtual wxColour GetSelectedTextBgColour(const wxColour& clr); -}; - - -// Information given to cells when drawing them. Contains rendering state, -// selection information and rendering style object that can be used to -// customize the output. -class WXDLLIMPEXP_HTML wxHtmlRenderingInfo -{ -public: - wxHtmlRenderingInfo() : m_selection(NULL), m_style(NULL) {} - - void SetSelection(wxHtmlSelection *s) { m_selection = s; } - wxHtmlSelection *GetSelection() const { return m_selection; } - - void SetStyle(wxHtmlRenderingStyle *style) { m_style = style; } - wxHtmlRenderingStyle& GetStyle() { return *m_style; } - - wxHtmlRenderingState& GetState() { return m_state; } - -protected: - wxHtmlSelection *m_selection; - wxHtmlRenderingStyle *m_style; - wxHtmlRenderingState m_state; -}; - - -// Flags for wxHtmlCell::FindCellByPos -enum -{ - wxHTML_FIND_EXACT = 1, - wxHTML_FIND_NEAREST_BEFORE = 2, - wxHTML_FIND_NEAREST_AFTER = 4 -}; - - -// Superscript/subscript/normal script mode of a cell -enum wxHtmlScriptMode -{ - wxHTML_SCRIPT_NORMAL, - wxHTML_SCRIPT_SUB, - wxHTML_SCRIPT_SUP -}; - - -// --------------------------------------------------------------------------- -// wxHtmlCell -// Internal data structure. It represents fragments of parsed -// HTML page - a word, picture, table, horizontal line and so -// on. It is used by wxHtmlWindow to represent HTML page in -// memory. -// --------------------------------------------------------------------------- - - -class WXDLLIMPEXP_HTML wxHtmlCell : public wxObject -{ -public: - wxHtmlCell(); - virtual ~wxHtmlCell(); - - void SetParent(wxHtmlContainerCell *p) {m_Parent = p;} - wxHtmlContainerCell *GetParent() const {return m_Parent;} - - int GetPosX() const {return m_PosX;} - int GetPosY() const {return m_PosY;} - int GetWidth() const {return m_Width;} - - // Returns the maximum possible length of the cell. - // Call Layout at least once before using GetMaxTotalWidth() - virtual int GetMaxTotalWidth() const { return m_Width; } - - int GetHeight() const {return m_Height;} - int GetDescent() const {return m_Descent;} - - void SetScriptMode(wxHtmlScriptMode mode, long previousBase); - wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } - long GetScriptBaseline() { return m_ScriptBaseline; } - - // Formatting cells are not visible on the screen, they only alter - // renderer's state. - bool IsFormattingCell() const { return m_Width == 0 && m_Height == 0; } - - const wxString& GetId() const { return m_id; } - void SetId(const wxString& id) { m_id = id; } - - // returns the link associated with this cell. The position is position - // within the cell so it varies from 0 to m_Width, from 0 to m_Height - virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, - int WXUNUSED(y) = 0) const - { return m_Link; } - - // Returns cursor to be used when mouse is over the cell: - virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const; - -#if WXWIN_COMPATIBILITY_2_6 - // this was replaced by GetMouseCursor, don't use in new code! - virtual wxCursor GetCursor() const; -#endif - - // return next cell among parent's cells - wxHtmlCell *GetNext() const {return m_Next;} - // returns first child cell (if there are any, i.e. if this is container): - virtual wxHtmlCell* GetFirstChild() const { return NULL; } - - // members writing methods - virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;} - void SetLink(const wxHtmlLinkInfo& link); - void SetNext(wxHtmlCell *cell) {m_Next = cell;} - - // 1. adjust cell's width according to the fact that maximal possible width - // is w. (this has sense when working with horizontal lines, tables - // etc.) - // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) - // members) = place items to fit window, according to the width w - virtual void Layout(int w); - - // renders the cell - virtual void Draw(wxDC& WXUNUSED(dc), - int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(view_y1), int WXUNUSED(view_y2), - wxHtmlRenderingInfo& WXUNUSED(info)) {} - - // proceed drawing actions in case the cell is not visible (scrolled out of - // screen). This is needed to change fonts, colors and so on. - virtual void DrawInvisible(wxDC& WXUNUSED(dc), - int WXUNUSED(x), int WXUNUSED(y), - wxHtmlRenderingInfo& WXUNUSED(info)) {} - - // This method returns pointer to the FIRST cell for that - // the condition - // is true. It first checks if the condition is true for this - // cell and then calls m_Next->Find(). (Note: it checks - // all subcells if the cell is container) - // Condition is unique condition identifier (see htmldefs.h) - // (user-defined condition IDs should start from 10000) - // and param is optional parameter - // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news"); - // returns pointer to anchor news - virtual const wxHtmlCell* Find(int condition, const void* param) const; - - - // This function is called when mouse button is clicked over the cell. - // Returns true if a link is clicked, false otherwise. - // - // 'window' is pointer to wxHtmlWindowInterface of the window which - // generated the event. - // HINT: if this handling is not enough for you you should use - // wxHtmlWidgetCell - virtual bool ProcessMouseClick(wxHtmlWindowInterface *window, - const wxPoint& pos, - const wxMouseEvent& event); - -#if WXWIN_COMPATIBILITY_2_6 - // this was replaced by ProcessMouseClick, don't use in new code! - virtual void OnMouseClick(wxWindow *window, - int x, int y, const wxMouseEvent& event); -#endif - - // This method used to adjust pagebreak position. The parameter is variable - // that contains y-coordinate of page break (= horizontal line that should - // not be crossed by words, images etc.). If this cell cannot be divided - // into two pieces (each one on another page) then it moves the pagebreak - // few pixels up. - // - // Returned value : true if pagebreak was modified, false otherwise - // Usage : while (container->AdjustPagebreak(&p)) {} - virtual bool AdjustPagebreak(int *pagebreak, - wxArrayInt& known_pagebreaks) const; - - // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default - // is true - the cell can be split on two pages - void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; } - - // Can the line be broken before this cell? - virtual bool IsLinebreakAllowed() const - { return !IsFormattingCell(); } - - // Returns true for simple == terminal cells, i.e. not composite ones. - // This if for internal usage only and may disappear in future versions! - virtual bool IsTerminalCell() const { return true; } - - // Find a cell inside this cell positioned at the given coordinates - // (relative to this's positions). Returns NULL if no such cell exists. - // The flag can be used to specify whether to look for terminal or - // nonterminal cells or both. In either case, returned cell is deepest - // cell in cells tree that contains [x,y]. - virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, - unsigned flags = wxHTML_FIND_EXACT) const; - - // Returns absolute position of the cell on HTML canvas. - // If rootCell is provided, then it's considered to be the root of the - // hierarchy and the returned value is relative to it. - wxPoint GetAbsPos(wxHtmlCell *rootCell = NULL) const; - - // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that - // doesn't have a parent itself) - wxHtmlCell *GetRootCell() const; - - // Returns first (last) terminal cell inside this cell. It may return NULL, - // but it is rare -- only if there are no terminals in the tree. - virtual wxHtmlCell *GetFirstTerminal() const - { return wxConstCast(this, wxHtmlCell); } - virtual wxHtmlCell *GetLastTerminal() const - { return wxConstCast(this, wxHtmlCell); } - - // Returns cell's depth, i.e. how far under the root cell it is - // (if it is the root, depth is 0) - unsigned GetDepth() const; - - // Returns true if the cell appears before 'cell' in natural order of - // cells (= as they are read). If cell A is (grand)parent of cell B, - // then both A.IsBefore(B) and B.IsBefore(A) always return true. - bool IsBefore(wxHtmlCell *cell) const; - - // Converts the cell into text representation. If sel != NULL then - // only part of the cell inside the selection is converted. - virtual wxString ConvertToText(wxHtmlSelection *WXUNUSED(sel)) const - { return wxEmptyString; } - -protected: - // pointer to the next cell - wxHtmlCell *m_Next; - // pointer to parent cell - wxHtmlContainerCell *m_Parent; - - // dimensions of fragment (m_Descent is used to position text & images) - long m_Width, m_Height, m_Descent; - // position where the fragment is drawn: - long m_PosX, m_PosY; - - // superscript/subscript/normal: - wxHtmlScriptMode m_ScriptMode; - long m_ScriptBaseline; - - // destination address if this fragment is hypertext link, NULL otherwise - wxHtmlLinkInfo *m_Link; - // true if this cell can be placed on pagebreak, false otherwise - bool m_CanLiveOnPagebreak; - // unique identifier of the cell, generated from "id" property of tags - wxString m_id; - - DECLARE_ABSTRACT_CLASS(wxHtmlCell) - DECLARE_NO_COPY_CLASS(wxHtmlCell) -}; - - - - -// ---------------------------------------------------------------------------- -// Inherited cells: -// ---------------------------------------------------------------------------- - - -// ---------------------------------------------------------------------------- -// wxHtmlWordCell -// Single word in input stream. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlWordCell : public wxHtmlCell -{ -public: - wxHtmlWordCell(const wxString& word, const wxDC& dc); - void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, - wxHtmlRenderingInfo& info); - virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const; - wxString ConvertToText(wxHtmlSelection *sel) const; - bool IsLinebreakAllowed() const { return m_allowLinebreak; } - - void SetPreviousWord(wxHtmlWordCell *cell); - -protected: - void SetSelectionPrivPos(const wxDC& dc, wxHtmlSelection *s) const; - void Split(const wxDC& dc, - const wxPoint& selFrom, const wxPoint& selTo, - unsigned& pos1, unsigned& pos2) const; - - wxString m_Word; - bool m_allowLinebreak; - - DECLARE_ABSTRACT_CLASS(wxHtmlWordCell) - DECLARE_NO_COPY_CLASS(wxHtmlWordCell) -}; - - - - - -// Container contains other cells, thus forming tree structure of rendering -// elements. Basic code of layout algorithm is contained in this class. -class WXDLLIMPEXP_HTML wxHtmlContainerCell : public wxHtmlCell -{ -public: - wxHtmlContainerCell(wxHtmlContainerCell *parent); - virtual ~wxHtmlContainerCell(); - - virtual void Layout(int w); - virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, - wxHtmlRenderingInfo& info); - virtual void DrawInvisible(wxDC& dc, int x, int y, - wxHtmlRenderingInfo& info); -/* virtual bool AdjustPagebreak(int *pagebreak, int *known_pagebreaks = NULL, int number_of_pages = 0) const;*/ - virtual bool AdjustPagebreak(int *pagebreak, wxArrayInt& known_pagebreaks) const; - - // insert cell at the end of m_Cells list - void InsertCell(wxHtmlCell *cell); - - // sets horizontal/vertical alignment - void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;} - int GetAlignHor() const {return m_AlignHor;} - void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;} - int GetAlignVer() const {return m_AlignVer;} - - // sets left-border indentation. units is one of wxHTML_UNITS_* constants - // what is combination of wxHTML_INDENT_* - void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS); - // returns the indentation. ind is one of wxHTML_INDENT_* constants - int GetIndent(int ind) const; - // returns type of value returned by GetIndent(ind) - int GetIndentUnits(int ind) const; - - // sets alignment info based on given tag's params - void SetAlign(const wxHtmlTag& tag); - // sets floating width adjustment - // (examples : 32 percent of parent container, - // -15 pixels percent (this means 100 % - 15 pixels) - void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;} - void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0); - // sets minimal height of this container. - void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} - - void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = true; m_BkColour = clr;} - // returns background colour (of wxNullColour if none set), so that widgets can - // adapt to it: - wxColour GetBackgroundColour(); - void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = true; m_BorderColour1 = clr1, m_BorderColour2 = clr2;} - virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; - virtual const wxHtmlCell* Find(int condition, const void* param) const; - -#if WXWIN_COMPATIBILITY_2_6 - // this was replaced by ProcessMouseClick, don't use in new code! - virtual void OnMouseClick(wxWindow *window, - int x, int y, const wxMouseEvent& event); -#endif - virtual bool ProcessMouseClick(wxHtmlWindowInterface *window, - const wxPoint& pos, - const wxMouseEvent& event); - - virtual wxHtmlCell* GetFirstChild() const { return m_Cells; } -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( wxHtmlCell* GetFirstCell() const ); -#endif - // returns last child cell: - wxHtmlCell* GetLastChild() const { return m_LastCell; } - - // see comment in wxHtmlCell about this method - virtual bool IsTerminalCell() const { return false; } - - virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, - unsigned flags = wxHTML_FIND_EXACT) const; - - virtual wxHtmlCell *GetFirstTerminal() const; - virtual wxHtmlCell *GetLastTerminal() const; - - - // Removes indentation on top or bottom of the container (i.e. above or - // below first/last terminal cell). For internal use only. - virtual void RemoveExtraSpacing(bool top, bool bottom); - - // Returns the maximum possible length of the container. - // Call Layout at least once before using GetMaxTotalWidth() - virtual int GetMaxTotalWidth() const { return m_MaxTotalWidth; } - -protected: - void UpdateRenderingStatePre(wxHtmlRenderingInfo& info, - wxHtmlCell *cell) const; - void UpdateRenderingStatePost(wxHtmlRenderingInfo& info, - wxHtmlCell *cell) const; - -protected: - int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom; - // indentation of subcells. There is always m_Indent pixels - // big space between given border of the container and the subcells - // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels - int m_MinHeight, m_MinHeightAlign; - // minimal height. - wxHtmlCell *m_Cells, *m_LastCell; - // internal cells, m_Cells points to the first of them, m_LastCell to the last one. - // (LastCell is needed only to speed-up InsertCell) - int m_AlignHor, m_AlignVer; - // alignment horizontal and vertical (left, center, right) - int m_WidthFloat, m_WidthFloatUnits; - // width float is used in adjustWidth - bool m_UseBkColour; - wxColour m_BkColour; - // background color of this container - bool m_UseBorder; - wxColour m_BorderColour1, m_BorderColour2; - // borders color of this container - int m_LastLayout; - // if != -1 then call to Layout may be no-op - // if previous call to Layout has same argument - int m_MaxTotalWidth; - // Maximum possible length if ignoring line wrap - - - DECLARE_ABSTRACT_CLASS(wxHtmlContainerCell) - DECLARE_NO_COPY_CLASS(wxHtmlContainerCell) -}; - -#if WXWIN_COMPATIBILITY_2_4 -inline wxHtmlCell* wxHtmlContainerCell::GetFirstCell() const - { return GetFirstChild(); } -#endif - - - - -// --------------------------------------------------------------------------- -// wxHtmlColourCell -// Color changer. -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlColourCell : public wxHtmlCell -{ -public: - wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;} - virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, - wxHtmlRenderingInfo& info); - virtual void DrawInvisible(wxDC& dc, int x, int y, - wxHtmlRenderingInfo& info); - -protected: - wxColour m_Colour; - unsigned m_Flags; - - DECLARE_ABSTRACT_CLASS(wxHtmlColourCell) - DECLARE_NO_COPY_CLASS(wxHtmlColourCell) -}; - - - - -//-------------------------------------------------------------------------------- -// wxHtmlFontCell -// Sets actual font used for text rendering -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlFontCell : public wxHtmlCell -{ -public: - wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); } - virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, - wxHtmlRenderingInfo& info); - virtual void DrawInvisible(wxDC& dc, int x, int y, - wxHtmlRenderingInfo& info); - -protected: - wxFont m_Font; - - DECLARE_ABSTRACT_CLASS(wxHtmlFontCell) - DECLARE_NO_COPY_CLASS(wxHtmlFontCell) -}; - - - - - - -//-------------------------------------------------------------------------------- -// wxHtmlwidgetCell -// This cell is connected with wxWindow object -// You can use it to insert windows into HTML page -// (buttons, input boxes etc.) -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlWidgetCell : public wxHtmlCell -{ -public: - // !!! wnd must have correct parent! - // if w != 0 then the m_Wnd has 'floating' width - it adjust - // it's width according to parent container's width - // (w is percent of parent's width) - wxHtmlWidgetCell(wxWindow *wnd, int w = 0); - virtual ~wxHtmlWidgetCell() { m_Wnd->Destroy(); } - virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, - wxHtmlRenderingInfo& info); - virtual void DrawInvisible(wxDC& dc, int x, int y, - wxHtmlRenderingInfo& info); - virtual void Layout(int w); - -protected: - wxWindow* m_Wnd; - int m_WidthFloat; - // width float is used in adjustWidth (it is in percents) - - DECLARE_ABSTRACT_CLASS(wxHtmlWidgetCell) - DECLARE_NO_COPY_CLASS(wxHtmlWidgetCell) -}; - - - -//-------------------------------------------------------------------------------- -// wxHtmlLinkInfo -// Internal data structure. It represents hypertext link -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlLinkInfo : public wxObject -{ -public: - wxHtmlLinkInfo() : wxObject() - { m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; } - wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject() - { m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; } - wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject() - { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event; - m_Cell = l.m_Cell; } - wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l) - { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event; - m_Cell = l.m_Cell; return *this; } - - void SetEvent(const wxMouseEvent *e) { m_Event = e; } - void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; } - - wxString GetHref() const { return m_Href; } - wxString GetTarget() const { return m_Target; } - const wxMouseEvent* GetEvent() const { return m_Event; } - const wxHtmlCell* GetHtmlCell() const { return m_Cell; } - -private: - wxString m_Href, m_Target; - const wxMouseEvent *m_Event; - const wxHtmlCell *m_Cell; -}; - - - -// ---------------------------------------------------------------------------- -// wxHtmlTerminalCellsInterator -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlTerminalCellsInterator -{ -public: - wxHtmlTerminalCellsInterator(const wxHtmlCell *from, const wxHtmlCell *to) - : m_to(to), m_pos(from) {} - - operator bool() const { return m_pos != NULL; } - const wxHtmlCell* operator++(); - const wxHtmlCell* operator->() const { return m_pos; } - const wxHtmlCell* operator*() const { return m_pos; } - -private: - const wxHtmlCell *m_to, *m_pos; -}; - - - -#endif // wxUSE_HTML - -#endif // _WX_HTMLCELL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: htmlcell.h +// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser +// as a basic visual element of HTML page +// Author: Vaclav Slavik +// RCS-ID: $Id: htmlcell.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999-2003 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLCELL_H_ +#define _WX_HTMLCELL_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/html/htmltag.h" +#include "wx/html/htmldefs.h" +#include "wx/window.h" + + +class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface; +class WXDLLIMPEXP_FWD_HTML wxHtmlLinkInfo; +class WXDLLIMPEXP_FWD_HTML wxHtmlCell; +class WXDLLIMPEXP_FWD_HTML wxHtmlContainerCell; + + +// wxHtmlSelection is data holder with information about text selection. +// Selection is defined by two positions (beginning and end of the selection) +// and two leaf(!) cells at these positions. +class WXDLLIMPEXP_HTML wxHtmlSelection +{ +public: + wxHtmlSelection() + : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition), + m_fromPrivPos(wxDefaultPosition), m_toPrivPos(wxDefaultPosition), + m_fromCell(NULL), m_toCell(NULL) {} + + void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell, + const wxPoint& toPos, const wxHtmlCell *toCell); + void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell); + + const wxHtmlCell *GetFromCell() const { return m_fromCell; } + const wxHtmlCell *GetToCell() const { return m_toCell; } + + // these values are in absolute coordinates: + const wxPoint& GetFromPos() const { return m_fromPos; } + const wxPoint& GetToPos() const { return m_toPos; } + + // these are From/ToCell's private data + const wxPoint& GetFromPrivPos() const { return m_fromPrivPos; } + const wxPoint& GetToPrivPos() const { return m_toPrivPos; } + void SetFromPrivPos(const wxPoint& pos) { m_fromPrivPos = pos; } + void SetToPrivPos(const wxPoint& pos) { m_toPrivPos = pos; } + void ClearPrivPos() { m_toPrivPos = m_fromPrivPos = wxDefaultPosition; } + + bool IsEmpty() const + { return m_fromPos == wxDefaultPosition && + m_toPos == wxDefaultPosition; } + +private: + wxPoint m_fromPos, m_toPos; + wxPoint m_fromPrivPos, m_toPrivPos; + const wxHtmlCell *m_fromCell, *m_toCell; +}; + + + +enum wxHtmlSelectionState +{ + wxHTML_SEL_OUT, // currently rendered cell is outside the selection + wxHTML_SEL_IN, // ... is inside selection + wxHTML_SEL_CHANGING // ... is the cell on which selection state changes +}; + +// Selection state is passed to wxHtmlCell::Draw so that it can render itself +// differently e.g. when inside text selection or outside it. +class WXDLLIMPEXP_HTML wxHtmlRenderingState +{ +public: + wxHtmlRenderingState() : m_selState(wxHTML_SEL_OUT) {} + + void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; } + wxHtmlSelectionState GetSelectionState() const { return m_selState; } + + void SetFgColour(const wxColour& c) { m_fgColour = c; } + const wxColour& GetFgColour() const { return m_fgColour; } + void SetBgColour(const wxColour& c) { m_bgColour = c; } + const wxColour& GetBgColour() const { return m_bgColour; } + +private: + wxHtmlSelectionState m_selState; + wxColour m_fgColour, m_bgColour; +}; + + +// HTML rendering customization. This class is used when rendering wxHtmlCells +// as a callback: +class WXDLLIMPEXP_HTML wxHtmlRenderingStyle +{ +public: + virtual ~wxHtmlRenderingStyle() {} + virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0; + virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0; +}; + +// Standard style: +class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle +{ +public: + virtual wxColour GetSelectedTextColour(const wxColour& clr); + virtual wxColour GetSelectedTextBgColour(const wxColour& clr); +}; + + +// Information given to cells when drawing them. Contains rendering state, +// selection information and rendering style object that can be used to +// customize the output. +class WXDLLIMPEXP_HTML wxHtmlRenderingInfo +{ +public: + wxHtmlRenderingInfo() : m_selection(NULL), m_style(NULL) {} + + void SetSelection(wxHtmlSelection *s) { m_selection = s; } + wxHtmlSelection *GetSelection() const { return m_selection; } + + void SetStyle(wxHtmlRenderingStyle *style) { m_style = style; } + wxHtmlRenderingStyle& GetStyle() { return *m_style; } + + wxHtmlRenderingState& GetState() { return m_state; } + +protected: + wxHtmlSelection *m_selection; + wxHtmlRenderingStyle *m_style; + wxHtmlRenderingState m_state; +}; + + +// Flags for wxHtmlCell::FindCellByPos +enum +{ + wxHTML_FIND_EXACT = 1, + wxHTML_FIND_NEAREST_BEFORE = 2, + wxHTML_FIND_NEAREST_AFTER = 4 +}; + + +// Superscript/subscript/normal script mode of a cell +enum wxHtmlScriptMode +{ + wxHTML_SCRIPT_NORMAL, + wxHTML_SCRIPT_SUB, + wxHTML_SCRIPT_SUP +}; + + +// --------------------------------------------------------------------------- +// wxHtmlCell +// Internal data structure. It represents fragments of parsed +// HTML page - a word, picture, table, horizontal line and so +// on. It is used by wxHtmlWindow to represent HTML page in +// memory. +// --------------------------------------------------------------------------- + + +class WXDLLIMPEXP_HTML wxHtmlCell : public wxObject +{ +public: + wxHtmlCell(); + virtual ~wxHtmlCell(); + + void SetParent(wxHtmlContainerCell *p) {m_Parent = p;} + wxHtmlContainerCell *GetParent() const {return m_Parent;} + + int GetPosX() const {return m_PosX;} + int GetPosY() const {return m_PosY;} + int GetWidth() const {return m_Width;} + + // Returns the maximum possible length of the cell. + // Call Layout at least once before using GetMaxTotalWidth() + virtual int GetMaxTotalWidth() const { return m_Width; } + + int GetHeight() const {return m_Height;} + int GetDescent() const {return m_Descent;} + + void SetScriptMode(wxHtmlScriptMode mode, long previousBase); + wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } + long GetScriptBaseline() { return m_ScriptBaseline; } + + // Formatting cells are not visible on the screen, they only alter + // renderer's state. + bool IsFormattingCell() const { return m_Width == 0 && m_Height == 0; } + + const wxString& GetId() const { return m_id; } + void SetId(const wxString& id) { m_id = id; } + + // returns the link associated with this cell. The position is position + // within the cell so it varies from 0 to m_Width, from 0 to m_Height + virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, + int WXUNUSED(y) = 0) const + { return m_Link; } + + // Returns cursor to be used when mouse is over the cell: + virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const; + +#if WXWIN_COMPATIBILITY_2_6 + // this was replaced by GetMouseCursor, don't use in new code! + virtual wxCursor GetCursor() const; +#endif + + // return next cell among parent's cells + wxHtmlCell *GetNext() const {return m_Next;} + // returns first child cell (if there are any, i.e. if this is container): + virtual wxHtmlCell* GetFirstChild() const { return NULL; } + + // members writing methods + virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;} + void SetLink(const wxHtmlLinkInfo& link); + void SetNext(wxHtmlCell *cell) {m_Next = cell;} + + // 1. adjust cell's width according to the fact that maximal possible width + // is w. (this has sense when working with horizontal lines, tables + // etc.) + // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) + // members) = place items to fit window, according to the width w + virtual void Layout(int w); + + // renders the cell + virtual void Draw(wxDC& WXUNUSED(dc), + int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(view_y1), int WXUNUSED(view_y2), + wxHtmlRenderingInfo& WXUNUSED(info)) {} + + // proceed drawing actions in case the cell is not visible (scrolled out of + // screen). This is needed to change fonts, colors and so on. + virtual void DrawInvisible(wxDC& WXUNUSED(dc), + int WXUNUSED(x), int WXUNUSED(y), + wxHtmlRenderingInfo& WXUNUSED(info)) {} + + // This method returns pointer to the FIRST cell for that + // the condition + // is true. It first checks if the condition is true for this + // cell and then calls m_Next->Find(). (Note: it checks + // all subcells if the cell is container) + // Condition is unique condition identifier (see htmldefs.h) + // (user-defined condition IDs should start from 10000) + // and param is optional parameter + // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news"); + // returns pointer to anchor news + virtual const wxHtmlCell* Find(int condition, const void* param) const; + + + // This function is called when mouse button is clicked over the cell. + // Returns true if a link is clicked, false otherwise. + // + // 'window' is pointer to wxHtmlWindowInterface of the window which + // generated the event. + // HINT: if this handling is not enough for you you should use + // wxHtmlWidgetCell + virtual bool ProcessMouseClick(wxHtmlWindowInterface *window, + const wxPoint& pos, + const wxMouseEvent& event); + +#if WXWIN_COMPATIBILITY_2_6 + // this was replaced by ProcessMouseClick, don't use in new code! + virtual void OnMouseClick(wxWindow *window, + int x, int y, const wxMouseEvent& event); +#endif + + // This method used to adjust pagebreak position. The parameter is variable + // that contains y-coordinate of page break (= horizontal line that should + // not be crossed by words, images etc.). If this cell cannot be divided + // into two pieces (each one on another page) then it moves the pagebreak + // few pixels up. + // + // Returned value : true if pagebreak was modified, false otherwise + // Usage : while (container->AdjustPagebreak(&p)) {} + virtual bool AdjustPagebreak(int *pagebreak, + wxArrayInt& known_pagebreaks) const; + + // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default + // is true - the cell can be split on two pages + void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; } + + // Can the line be broken before this cell? + virtual bool IsLinebreakAllowed() const + { return !IsFormattingCell(); } + + // Returns true for simple == terminal cells, i.e. not composite ones. + // This if for internal usage only and may disappear in future versions! + virtual bool IsTerminalCell() const { return true; } + + // Find a cell inside this cell positioned at the given coordinates + // (relative to this's positions). Returns NULL if no such cell exists. + // The flag can be used to specify whether to look for terminal or + // nonterminal cells or both. In either case, returned cell is deepest + // cell in cells tree that contains [x,y]. + virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, + unsigned flags = wxHTML_FIND_EXACT) const; + + // Returns absolute position of the cell on HTML canvas. + // If rootCell is provided, then it's considered to be the root of the + // hierarchy and the returned value is relative to it. + wxPoint GetAbsPos(wxHtmlCell *rootCell = NULL) const; + + // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that + // doesn't have a parent itself) + wxHtmlCell *GetRootCell() const; + + // Returns first (last) terminal cell inside this cell. It may return NULL, + // but it is rare -- only if there are no terminals in the tree. + virtual wxHtmlCell *GetFirstTerminal() const + { return wxConstCast(this, wxHtmlCell); } + virtual wxHtmlCell *GetLastTerminal() const + { return wxConstCast(this, wxHtmlCell); } + + // Returns cell's depth, i.e. how far under the root cell it is + // (if it is the root, depth is 0) + unsigned GetDepth() const; + + // Returns true if the cell appears before 'cell' in natural order of + // cells (= as they are read). If cell A is (grand)parent of cell B, + // then both A.IsBefore(B) and B.IsBefore(A) always return true. + bool IsBefore(wxHtmlCell *cell) const; + + // Converts the cell into text representation. If sel != NULL then + // only part of the cell inside the selection is converted. + virtual wxString ConvertToText(wxHtmlSelection *WXUNUSED(sel)) const + { return wxEmptyString; } + +protected: + // pointer to the next cell + wxHtmlCell *m_Next; + // pointer to parent cell + wxHtmlContainerCell *m_Parent; + + // dimensions of fragment (m_Descent is used to position text & images) + long m_Width, m_Height, m_Descent; + // position where the fragment is drawn: + long m_PosX, m_PosY; + + // superscript/subscript/normal: + wxHtmlScriptMode m_ScriptMode; + long m_ScriptBaseline; + + // destination address if this fragment is hypertext link, NULL otherwise + wxHtmlLinkInfo *m_Link; + // true if this cell can be placed on pagebreak, false otherwise + bool m_CanLiveOnPagebreak; + // unique identifier of the cell, generated from "id" property of tags + wxString m_id; + + DECLARE_ABSTRACT_CLASS(wxHtmlCell) + DECLARE_NO_COPY_CLASS(wxHtmlCell) +}; + + + + +// ---------------------------------------------------------------------------- +// Inherited cells: +// ---------------------------------------------------------------------------- + + +// ---------------------------------------------------------------------------- +// wxHtmlWordCell +// Single word in input stream. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWordCell : public wxHtmlCell +{ +public: + wxHtmlWordCell(const wxString& word, const wxDC& dc); + void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info); + virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const; + wxString ConvertToText(wxHtmlSelection *sel) const; + bool IsLinebreakAllowed() const { return m_allowLinebreak; } + + void SetPreviousWord(wxHtmlWordCell *cell); + +protected: + void SetSelectionPrivPos(const wxDC& dc, wxHtmlSelection *s) const; + void Split(const wxDC& dc, + const wxPoint& selFrom, const wxPoint& selTo, + unsigned& pos1, unsigned& pos2) const; + + wxString m_Word; + bool m_allowLinebreak; + + DECLARE_ABSTRACT_CLASS(wxHtmlWordCell) + DECLARE_NO_COPY_CLASS(wxHtmlWordCell) +}; + + + + + +// Container contains other cells, thus forming tree structure of rendering +// elements. Basic code of layout algorithm is contained in this class. +class WXDLLIMPEXP_HTML wxHtmlContainerCell : public wxHtmlCell +{ +public: + wxHtmlContainerCell(wxHtmlContainerCell *parent); + virtual ~wxHtmlContainerCell(); + + virtual void Layout(int w); + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info); + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info); +/* virtual bool AdjustPagebreak(int *pagebreak, int *known_pagebreaks = NULL, int number_of_pages = 0) const;*/ + virtual bool AdjustPagebreak(int *pagebreak, wxArrayInt& known_pagebreaks) const; + + // insert cell at the end of m_Cells list + void InsertCell(wxHtmlCell *cell); + + // sets horizontal/vertical alignment + void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;} + int GetAlignHor() const {return m_AlignHor;} + void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;} + int GetAlignVer() const {return m_AlignVer;} + + // sets left-border indentation. units is one of wxHTML_UNITS_* constants + // what is combination of wxHTML_INDENT_* + void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS); + // returns the indentation. ind is one of wxHTML_INDENT_* constants + int GetIndent(int ind) const; + // returns type of value returned by GetIndent(ind) + int GetIndentUnits(int ind) const; + + // sets alignment info based on given tag's params + void SetAlign(const wxHtmlTag& tag); + // sets floating width adjustment + // (examples : 32 percent of parent container, + // -15 pixels percent (this means 100 % - 15 pixels) + void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;} + void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0); + // sets minimal height of this container. + void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} + + void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = true; m_BkColour = clr;} + // returns background colour (of wxNullColour if none set), so that widgets can + // adapt to it: + wxColour GetBackgroundColour(); + void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = true; m_BorderColour1 = clr1, m_BorderColour2 = clr2;} + virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; + virtual const wxHtmlCell* Find(int condition, const void* param) const; + +#if WXWIN_COMPATIBILITY_2_6 + // this was replaced by ProcessMouseClick, don't use in new code! + virtual void OnMouseClick(wxWindow *window, + int x, int y, const wxMouseEvent& event); +#endif + virtual bool ProcessMouseClick(wxHtmlWindowInterface *window, + const wxPoint& pos, + const wxMouseEvent& event); + + virtual wxHtmlCell* GetFirstChild() const { return m_Cells; } +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( wxHtmlCell* GetFirstCell() const ); +#endif + // returns last child cell: + wxHtmlCell* GetLastChild() const { return m_LastCell; } + + // see comment in wxHtmlCell about this method + virtual bool IsTerminalCell() const { return false; } + + virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, + unsigned flags = wxHTML_FIND_EXACT) const; + + virtual wxHtmlCell *GetFirstTerminal() const; + virtual wxHtmlCell *GetLastTerminal() const; + + + // Removes indentation on top or bottom of the container (i.e. above or + // below first/last terminal cell). For internal use only. + virtual void RemoveExtraSpacing(bool top, bool bottom); + + // Returns the maximum possible length of the container. + // Call Layout at least once before using GetMaxTotalWidth() + virtual int GetMaxTotalWidth() const { return m_MaxTotalWidth; } + +protected: + void UpdateRenderingStatePre(wxHtmlRenderingInfo& info, + wxHtmlCell *cell) const; + void UpdateRenderingStatePost(wxHtmlRenderingInfo& info, + wxHtmlCell *cell) const; + +protected: + int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom; + // indentation of subcells. There is always m_Indent pixels + // big space between given border of the container and the subcells + // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels + int m_MinHeight, m_MinHeightAlign; + // minimal height. + wxHtmlCell *m_Cells, *m_LastCell; + // internal cells, m_Cells points to the first of them, m_LastCell to the last one. + // (LastCell is needed only to speed-up InsertCell) + int m_AlignHor, m_AlignVer; + // alignment horizontal and vertical (left, center, right) + int m_WidthFloat, m_WidthFloatUnits; + // width float is used in adjustWidth + bool m_UseBkColour; + wxColour m_BkColour; + // background color of this container + bool m_UseBorder; + wxColour m_BorderColour1, m_BorderColour2; + // borders color of this container + int m_LastLayout; + // if != -1 then call to Layout may be no-op + // if previous call to Layout has same argument + int m_MaxTotalWidth; + // Maximum possible length if ignoring line wrap + + + DECLARE_ABSTRACT_CLASS(wxHtmlContainerCell) + DECLARE_NO_COPY_CLASS(wxHtmlContainerCell) +}; + +#if WXWIN_COMPATIBILITY_2_4 +inline wxHtmlCell* wxHtmlContainerCell::GetFirstCell() const + { return GetFirstChild(); } +#endif + + + + +// --------------------------------------------------------------------------- +// wxHtmlColourCell +// Color changer. +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlColourCell : public wxHtmlCell +{ +public: + wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;} + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info); + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info); + +protected: + wxColour m_Colour; + unsigned m_Flags; + + DECLARE_ABSTRACT_CLASS(wxHtmlColourCell) + DECLARE_NO_COPY_CLASS(wxHtmlColourCell) +}; + + + + +//-------------------------------------------------------------------------------- +// wxHtmlFontCell +// Sets actual font used for text rendering +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlFontCell : public wxHtmlCell +{ +public: + wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); } + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info); + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info); + +protected: + wxFont m_Font; + + DECLARE_ABSTRACT_CLASS(wxHtmlFontCell) + DECLARE_NO_COPY_CLASS(wxHtmlFontCell) +}; + + + + + + +//-------------------------------------------------------------------------------- +// wxHtmlwidgetCell +// This cell is connected with wxWindow object +// You can use it to insert windows into HTML page +// (buttons, input boxes etc.) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWidgetCell : public wxHtmlCell +{ +public: + // !!! wnd must have correct parent! + // if w != 0 then the m_Wnd has 'floating' width - it adjust + // it's width according to parent container's width + // (w is percent of parent's width) + wxHtmlWidgetCell(wxWindow *wnd, int w = 0); + virtual ~wxHtmlWidgetCell() { m_Wnd->Destroy(); } + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info); + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info); + virtual void Layout(int w); + +protected: + wxWindow* m_Wnd; + int m_WidthFloat; + // width float is used in adjustWidth (it is in percents) + + DECLARE_ABSTRACT_CLASS(wxHtmlWidgetCell) + DECLARE_NO_COPY_CLASS(wxHtmlWidgetCell) +}; + + + +//-------------------------------------------------------------------------------- +// wxHtmlLinkInfo +// Internal data structure. It represents hypertext link +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlLinkInfo : public wxObject +{ +public: + wxHtmlLinkInfo() : wxObject() + { m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; } + wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject() + { m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; } + wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject() + { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event; + m_Cell = l.m_Cell; } + wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l) + { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event; + m_Cell = l.m_Cell; return *this; } + + void SetEvent(const wxMouseEvent *e) { m_Event = e; } + void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; } + + wxString GetHref() const { return m_Href; } + wxString GetTarget() const { return m_Target; } + const wxMouseEvent* GetEvent() const { return m_Event; } + const wxHtmlCell* GetHtmlCell() const { return m_Cell; } + +private: + wxString m_Href, m_Target; + const wxMouseEvent *m_Event; + const wxHtmlCell *m_Cell; +}; + + + +// ---------------------------------------------------------------------------- +// wxHtmlTerminalCellsInterator +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlTerminalCellsInterator +{ +public: + wxHtmlTerminalCellsInterator(const wxHtmlCell *from, const wxHtmlCell *to) + : m_to(to), m_pos(from) {} + + operator bool() const { return m_pos != NULL; } + const wxHtmlCell* operator++(); + const wxHtmlCell* operator->() const { return m_pos; } + const wxHtmlCell* operator*() const { return m_pos; } + +private: + const wxHtmlCell *m_to, *m_pos; +}; + + + +#endif // wxUSE_HTML + +#endif // _WX_HTMLCELL_H_ + diff --git a/Externals/wxWidgets/include/wx/html/htmldefs.h b/Externals/wxWidgets/include/wx/html/htmldefs.h index 68a06074cd..d000e616f4 100644 --- a/Externals/wxWidgets/include/wx/html/htmldefs.h +++ b/Externals/wxWidgets/include/wx/html/htmldefs.h @@ -1,104 +1,104 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmldefs.h -// Purpose: constants for wxhtml library -// Author: Vaclav Slavik -// RCS-ID: $Id: htmldefs.h 40823 2006-08-25 16:52:58Z VZ $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef _WX_HTMLDEFS_H_ -#define _WX_HTMLDEFS_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -//-------------------------------------------------------------------------------- -// ALIGNMENTS -// Describes alignment of text etc. in containers -//-------------------------------------------------------------------------------- - -#define wxHTML_ALIGN_LEFT 0x0000 -#define wxHTML_ALIGN_RIGHT 0x0002 -#define wxHTML_ALIGN_JUSTIFY 0x0010 - -#define wxHTML_ALIGN_TOP 0x0004 -#define wxHTML_ALIGN_BOTTOM 0x0008 - -#define wxHTML_ALIGN_CENTER 0x0001 - - - -//-------------------------------------------------------------------------------- -// COLOR MODES -// Used by wxHtmlColourCell to determine clr of what is changing -//-------------------------------------------------------------------------------- - -#define wxHTML_CLR_FOREGROUND 0x0001 -#define wxHTML_CLR_BACKGROUND 0x0002 - - - -//-------------------------------------------------------------------------------- -// UNITS -// Used to specify units -//-------------------------------------------------------------------------------- - -#define wxHTML_UNITS_PIXELS 0x0001 -#define wxHTML_UNITS_PERCENT 0x0002 - - - -//-------------------------------------------------------------------------------- -// INDENTS -// Used to specify indetation relatives -//-------------------------------------------------------------------------------- - -#define wxHTML_INDENT_LEFT 0x0010 -#define wxHTML_INDENT_RIGHT 0x0020 -#define wxHTML_INDENT_TOP 0x0040 -#define wxHTML_INDENT_BOTTOM 0x0080 - -#define wxHTML_INDENT_HORIZONTAL (wxHTML_INDENT_LEFT | wxHTML_INDENT_RIGHT) -#define wxHTML_INDENT_VERTICAL (wxHTML_INDENT_TOP | wxHTML_INDENT_BOTTOM) -#define wxHTML_INDENT_ALL (wxHTML_INDENT_VERTICAL | wxHTML_INDENT_HORIZONTAL) - - - - -//-------------------------------------------------------------------------------- -// FIND CONDITIONS -// Identifiers of wxHtmlCell's Find() conditions -//-------------------------------------------------------------------------------- - -#define wxHTML_COND_ISANCHOR 1 - // Finds the anchor of 'param' name (pointer to wxString). - -#define wxHTML_COND_ISIMAGEMAP 2 - // Finds imagemap of 'param' name (pointer to wxString). - // (used exclusively by m_image.cpp) - -#define wxHTML_COND_USER 10000 - // User-defined conditions should start from this number - - -//-------------------------------------------------------------------------------- -// INTERNALS -// wxHTML internal constants -//-------------------------------------------------------------------------------- - - /* size of one scroll step of wxHtmlWindow in pixels */ -#define wxHTML_SCROLL_STEP 16 - - /* size of temporary buffer used during parsing */ -#define wxHTML_BUFLEN 1024 - - /* maximum number of pages printable via html printing */ -#define wxHTML_PRINT_MAX_PAGES 999 - -#endif // wxUSE_HTML - -#endif // _WX_HTMLDEFS_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: htmldefs.h +// Purpose: constants for wxhtml library +// Author: Vaclav Slavik +// RCS-ID: $Id: htmldefs.h 40823 2006-08-25 16:52:58Z VZ $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_HTMLDEFS_H_ +#define _WX_HTMLDEFS_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +//-------------------------------------------------------------------------------- +// ALIGNMENTS +// Describes alignment of text etc. in containers +//-------------------------------------------------------------------------------- + +#define wxHTML_ALIGN_LEFT 0x0000 +#define wxHTML_ALIGN_RIGHT 0x0002 +#define wxHTML_ALIGN_JUSTIFY 0x0010 + +#define wxHTML_ALIGN_TOP 0x0004 +#define wxHTML_ALIGN_BOTTOM 0x0008 + +#define wxHTML_ALIGN_CENTER 0x0001 + + + +//-------------------------------------------------------------------------------- +// COLOR MODES +// Used by wxHtmlColourCell to determine clr of what is changing +//-------------------------------------------------------------------------------- + +#define wxHTML_CLR_FOREGROUND 0x0001 +#define wxHTML_CLR_BACKGROUND 0x0002 + + + +//-------------------------------------------------------------------------------- +// UNITS +// Used to specify units +//-------------------------------------------------------------------------------- + +#define wxHTML_UNITS_PIXELS 0x0001 +#define wxHTML_UNITS_PERCENT 0x0002 + + + +//-------------------------------------------------------------------------------- +// INDENTS +// Used to specify indetation relatives +//-------------------------------------------------------------------------------- + +#define wxHTML_INDENT_LEFT 0x0010 +#define wxHTML_INDENT_RIGHT 0x0020 +#define wxHTML_INDENT_TOP 0x0040 +#define wxHTML_INDENT_BOTTOM 0x0080 + +#define wxHTML_INDENT_HORIZONTAL (wxHTML_INDENT_LEFT | wxHTML_INDENT_RIGHT) +#define wxHTML_INDENT_VERTICAL (wxHTML_INDENT_TOP | wxHTML_INDENT_BOTTOM) +#define wxHTML_INDENT_ALL (wxHTML_INDENT_VERTICAL | wxHTML_INDENT_HORIZONTAL) + + + + +//-------------------------------------------------------------------------------- +// FIND CONDITIONS +// Identifiers of wxHtmlCell's Find() conditions +//-------------------------------------------------------------------------------- + +#define wxHTML_COND_ISANCHOR 1 + // Finds the anchor of 'param' name (pointer to wxString). + +#define wxHTML_COND_ISIMAGEMAP 2 + // Finds imagemap of 'param' name (pointer to wxString). + // (used exclusively by m_image.cpp) + +#define wxHTML_COND_USER 10000 + // User-defined conditions should start from this number + + +//-------------------------------------------------------------------------------- +// INTERNALS +// wxHTML internal constants +//-------------------------------------------------------------------------------- + + /* size of one scroll step of wxHtmlWindow in pixels */ +#define wxHTML_SCROLL_STEP 16 + + /* size of temporary buffer used during parsing */ +#define wxHTML_BUFLEN 1024 + + /* maximum number of pages printable via html printing */ +#define wxHTML_PRINT_MAX_PAGES 999 + +#endif // wxUSE_HTML + +#endif // _WX_HTMLDEFS_H_ + diff --git a/Externals/wxWidgets/include/wx/html/htmlfilt.h b/Externals/wxWidgets/include/wx/html/htmlfilt.h index b3eda9275f..38b5ab3444 100644 --- a/Externals/wxWidgets/include/wx/html/htmlfilt.h +++ b/Externals/wxWidgets/include/wx/html/htmlfilt.h @@ -1,82 +1,82 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmlfilt.h -// Purpose: filters -// Author: Vaclav Slavik -// RCS-ID: $Id: htmlfilt.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLFILT_H_ -#define _WX_HTMLFILT_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -#include "wx/filesys.h" - - -//-------------------------------------------------------------------------------- -// wxHtmlFilter -// This class is input filter. It can "translate" files -// in non-HTML format to HTML format -// interface to access certain -// kinds of files (HTPP, FTP, local, tar.gz etc..) -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject -{ - DECLARE_ABSTRACT_CLASS(wxHtmlFilter) - -public: - wxHtmlFilter() : wxObject() {} - virtual ~wxHtmlFilter() {} - - // returns true if this filter is able to open&read given file - virtual bool CanRead(const wxFSFile& file) const = 0; - - // Reads given file and returns HTML document. - // Returns empty string if opening failed - virtual wxString ReadFile(const wxFSFile& file) const = 0; -}; - - - -//-------------------------------------------------------------------------------- -// wxHtmlFilterPlainText -// This filter is used as default filter if no other can -// be used (= uknown type of file). It is used by -// wxHtmlWindow itself. -//-------------------------------------------------------------------------------- - - -class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter -{ - DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText) - -public: - virtual bool CanRead(const wxFSFile& file) const; - virtual wxString ReadFile(const wxFSFile& file) const; -}; - -//-------------------------------------------------------------------------------- -// wxHtmlFilterHTML -// filter for text/html -//-------------------------------------------------------------------------------- - -class wxHtmlFilterHTML : public wxHtmlFilter -{ - DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML) - - public: - virtual bool CanRead(const wxFSFile& file) const; - virtual wxString ReadFile(const wxFSFile& file) const; -}; - - - -#endif // wxUSE_HTML - -#endif // _WX_HTMLFILT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: htmlfilt.h +// Purpose: filters +// Author: Vaclav Slavik +// RCS-ID: $Id: htmlfilt.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLFILT_H_ +#define _WX_HTMLFILT_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/filesys.h" + + +//-------------------------------------------------------------------------------- +// wxHtmlFilter +// This class is input filter. It can "translate" files +// in non-HTML format to HTML format +// interface to access certain +// kinds of files (HTPP, FTP, local, tar.gz etc..) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxHtmlFilter) + +public: + wxHtmlFilter() : wxObject() {} + virtual ~wxHtmlFilter() {} + + // returns true if this filter is able to open&read given file + virtual bool CanRead(const wxFSFile& file) const = 0; + + // Reads given file and returns HTML document. + // Returns empty string if opening failed + virtual wxString ReadFile(const wxFSFile& file) const = 0; +}; + + + +//-------------------------------------------------------------------------------- +// wxHtmlFilterPlainText +// This filter is used as default filter if no other can +// be used (= uknown type of file). It is used by +// wxHtmlWindow itself. +//-------------------------------------------------------------------------------- + + +class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter +{ + DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText) + +public: + virtual bool CanRead(const wxFSFile& file) const; + virtual wxString ReadFile(const wxFSFile& file) const; +}; + +//-------------------------------------------------------------------------------- +// wxHtmlFilterHTML +// filter for text/html +//-------------------------------------------------------------------------------- + +class wxHtmlFilterHTML : public wxHtmlFilter +{ + DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML) + + public: + virtual bool CanRead(const wxFSFile& file) const; + virtual wxString ReadFile(const wxFSFile& file) const; +}; + + + +#endif // wxUSE_HTML + +#endif // _WX_HTMLFILT_H_ + diff --git a/Externals/wxWidgets/include/wx/html/htmlpars.h b/Externals/wxWidgets/include/wx/html/htmlpars.h index ea71ffe06b..b1080863bb 100644 --- a/Externals/wxWidgets/include/wx/html/htmlpars.h +++ b/Externals/wxWidgets/include/wx/html/htmlpars.h @@ -1,283 +1,283 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmlpars.h -// Purpose: wxHtmlParser class (generic parser) -// Author: Vaclav Slavik -// RCS-ID: $Id: htmlpars.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLPARS_H_ -#define _WX_HTMLPARS_H_ - -#include "wx/defs.h" -#if wxUSE_HTML - -#include "wx/html/htmltag.h" -#include "wx/filesys.h" -#include "wx/hash.h" -#include "wx/fontenc.h" - -class WXDLLIMPEXP_FWD_BASE wxMBConv; -class WXDLLIMPEXP_FWD_HTML wxHtmlParser; -class WXDLLIMPEXP_FWD_HTML wxHtmlTagHandler; -class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser; - -class wxHtmlTextPieces; -class wxHtmlParserState; - - -enum wxHtmlURLType -{ - wxHTML_URL_PAGE, - wxHTML_URL_IMAGE, - wxHTML_URL_OTHER -}; - -// This class handles generic parsing of HTML document : it scans -// the document and divides it into blocks of tags (where one block -// consists of starting and ending tag and of text between these -// 2 tags. -class WXDLLIMPEXP_HTML wxHtmlParser : public wxObject -{ - DECLARE_ABSTRACT_CLASS(wxHtmlParser) - -public: - wxHtmlParser(); - virtual ~wxHtmlParser(); - - // Sets the class which will be used for opening files - void SetFS(wxFileSystem *fs) { m_FS = fs; } - - wxFileSystem* GetFS() const { return m_FS; } - - // Opens file if the parser is allowed to open given URL (may be forbidden - // for security reasons) - virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const; - - // You can simply call this method when you need parsed output. - // This method does these things: - // 1. call InitParser(source); - // 2. call DoParsing(); - // 3. call GetProduct(); (its return value is then returned) - // 4. call DoneParser(); - wxObject* Parse(const wxString& source); - - // Sets the source. This must be called before running Parse() method. - virtual void InitParser(const wxString& source); - // This must be called after Parse(). - virtual void DoneParser(); - - // May be called during parsing to immediately return from Parse(). - virtual void StopParsing() { m_stopParsing = true; } - - // Parses the m_Source from begin_pos to end_pos-1. - // (in noparams version it parses whole m_Source) - void DoParsing(int begin_pos, int end_pos); - void DoParsing(); - - // Returns pointer to the tag at parser's current position - wxHtmlTag *GetCurrentTag() const { return m_CurTag; } - - // Returns product of parsing - // Returned value is result of parsing of the part. The type of this result - // depends on internal representation in derived parser - // (see wxHtmlWinParser for details). - virtual wxObject* GetProduct() = 0; - - // adds handler to the list & hash table of handlers. - virtual void AddTagHandler(wxHtmlTagHandler *handler); - - // Forces the handler to handle additional tags (not returned by GetSupportedTags). - // The handler should already be in use by this parser. - // Example: you want to parse following pseudo-html structure: - // - // - // - // - // This last it has different meaning, we don't want it to be parsed by myitems handler! - // handler can handle only 'myitems' (e.g. its GetSupportedTags returns "MYITEMS") - // you can call PushTagHandler(handler, "IT") when you find - // and call PopTagHandler() when you find - void PushTagHandler(wxHtmlTagHandler *handler, const wxString& tags); - - // Restores state before last call to PushTagHandler - void PopTagHandler(); - - wxString* GetSource() {return &m_Source;} - void SetSource(const wxString& src); - - // Sets HTML source and remembers current parser's state so that it can - // later be restored. This is useful for on-line modifications of - // HTML source (for example,
 handler replaces spaces with  
-    // and newlines with 
) - virtual void SetSourceAndSaveState(const wxString& src); - // Restores parser's state from stack or returns false if the stack is - // empty - virtual bool RestoreState(); - - // Returns HTML source inside the element (i.e. between the starting - // and ending tag) - wxString GetInnerSource(const wxHtmlTag& tag); - - // Parses HTML string 'markup' and extracts charset info from tag - // if present. Returns empty string if the tag is missing. - // For wxHTML's internal use. - static wxString ExtractCharsetInformation(const wxString& markup); - - // Returns entity parser object, used to substitute HTML &entities; - wxHtmlEntitiesParser *GetEntitiesParser() const { return m_entitiesParser; } - -protected: - // DOM structure - void CreateDOMTree(); - void DestroyDOMTree(); - void CreateDOMSubTree(wxHtmlTag *cur, - int begin_pos, int end_pos, - wxHtmlTagsCache *cache); - - // Adds text to the output. - // This is called from Parse() and must be overriden in derived classes. - // txt is not guaranteed to be only one word. It is largest continuous part of text - // (= not broken by tags) - // NOTE : using char* because of speed improvements - virtual void AddText(const wxChar* txt) = 0; - - // Adds tag and proceeds it. Parse() may (and usually is) called from this method. - // This is called from Parse() and may be overriden. - // Default behavior is that it looks for proper handler in m_Handlers. The tag is - // ignored if no hander is found. - // Derived class is *responsible* for filling in m_Handlers table. - virtual void AddTag(const wxHtmlTag& tag); - -protected: - // DOM tree: - wxHtmlTag *m_CurTag; - wxHtmlTag *m_Tags; - wxHtmlTextPieces *m_TextPieces; - size_t m_CurTextPiece; - - wxString m_Source; - - wxHtmlParserState *m_SavedStates; - - // handlers that handle particular tags. The table is accessed by - // key = tag's name. - // This attribute MUST be filled by derived class otherwise it would - // be empty and no tags would be recognized - // (see wxHtmlWinParser for details about filling it) - // m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.) - // it may (and often does) contain more references to one object - // m_HandlersList is list of all handlers and it is guaranteed to contain - // only one reference to each handler instance. - wxList m_HandlersList; - wxHashTable m_HandlersHash; - - DECLARE_NO_COPY_CLASS(wxHtmlParser) - - // class for opening files (file system) - wxFileSystem *m_FS; - // handlers stack used by PushTagHandler and PopTagHandler - wxList *m_HandlersStack; - - // entity parse - wxHtmlEntitiesParser *m_entitiesParser; - - // flag indicating that the parser should stop - bool m_stopParsing; -}; - - - -// This class (and derived classes) cooperates with wxHtmlParser. -// Each recognized tag is passed to handler which is capable -// of handling it. Each tag is handled in 3 steps: -// 1. Handler will modifies state of parser -// (using its public methods) -// 2. Parser parses source between starting and ending tag -// 3. Handler restores original state of the parser -class WXDLLIMPEXP_HTML wxHtmlTagHandler : public wxObject -{ - DECLARE_ABSTRACT_CLASS(wxHtmlTagHandler) - -public: - wxHtmlTagHandler() : wxObject () { m_Parser = NULL; } - - // Sets the parser. - // NOTE : each _instance_ of handler is guaranteed to be called - // only by one parser. This means you don't have to care about - // reentrancy. - virtual void SetParser(wxHtmlParser *parser) - { m_Parser = parser; } - - // Returns list of supported tags. The list is in uppercase and - // tags are delimited by ','. - // Example : "I,B,FONT,P" - // is capable of handling italic, bold, font and paragraph tags - virtual wxString GetSupportedTags() = 0; - - // This is hadling core method. It does all the Steps 1-3. - // To process step 2, you can call ParseInner() - // returned value : true if it called ParseInner(), - // false etherwise - virtual bool HandleTag(const wxHtmlTag& tag) = 0; - -protected: - // parses input between beginning and ending tag. - // m_Parser must be set. - void ParseInner(const wxHtmlTag& tag) - { m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); } - - // Parses given source as if it was tag's inner code (see - // wxHtmlParser::GetInnerSource). Unlike ParseInner(), this method lets - // you specify the source code to parse. This is useful when you need to - // modify the inner text before parsing. - void ParseInnerSource(const wxString& source); - - wxHtmlParser *m_Parser; - - DECLARE_NO_COPY_CLASS(wxHtmlTagHandler) -}; - - -// This class is used to parse HTML entities in strings. It can handle -// both named entities and &#xxxx entries where xxxx is Unicode code. -class WXDLLIMPEXP_HTML wxHtmlEntitiesParser : public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxHtmlEntitiesParser) - -public: - wxHtmlEntitiesParser(); - virtual ~wxHtmlEntitiesParser(); - - // Sets encoding of output string. - // Has no effect if wxUSE_WCHAR_T==0 or wxUSE_UNICODE==1 - void SetEncoding(wxFontEncoding encoding); - - // Parses entities in input and replaces them with respective characters - // (with respect to output encoding) - wxString Parse(const wxString& input); - - // Returns character for given entity or 0 if the enity is unknown - wxChar GetEntityChar(const wxString& entity); - - // Returns character that represents given Unicode code -#if wxUSE_UNICODE - wxChar GetCharForCode(unsigned code) { return (wxChar)code; } -#else - wxChar GetCharForCode(unsigned code); -#endif - -protected: -#if wxUSE_WCHAR_T && !wxUSE_UNICODE - wxMBConv *m_conv; - wxFontEncoding m_encoding; -#endif - - DECLARE_NO_COPY_CLASS(wxHtmlEntitiesParser) -}; - - -#endif - -#endif // _WX_HTMLPARS_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: htmlpars.h +// Purpose: wxHtmlParser class (generic parser) +// Author: Vaclav Slavik +// RCS-ID: $Id: htmlpars.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLPARS_H_ +#define _WX_HTMLPARS_H_ + +#include "wx/defs.h" +#if wxUSE_HTML + +#include "wx/html/htmltag.h" +#include "wx/filesys.h" +#include "wx/hash.h" +#include "wx/fontenc.h" + +class WXDLLIMPEXP_FWD_BASE wxMBConv; +class WXDLLIMPEXP_FWD_HTML wxHtmlParser; +class WXDLLIMPEXP_FWD_HTML wxHtmlTagHandler; +class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser; + +class wxHtmlTextPieces; +class wxHtmlParserState; + + +enum wxHtmlURLType +{ + wxHTML_URL_PAGE, + wxHTML_URL_IMAGE, + wxHTML_URL_OTHER +}; + +// This class handles generic parsing of HTML document : it scans +// the document and divides it into blocks of tags (where one block +// consists of starting and ending tag and of text between these +// 2 tags. +class WXDLLIMPEXP_HTML wxHtmlParser : public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxHtmlParser) + +public: + wxHtmlParser(); + virtual ~wxHtmlParser(); + + // Sets the class which will be used for opening files + void SetFS(wxFileSystem *fs) { m_FS = fs; } + + wxFileSystem* GetFS() const { return m_FS; } + + // Opens file if the parser is allowed to open given URL (may be forbidden + // for security reasons) + virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const; + + // You can simply call this method when you need parsed output. + // This method does these things: + // 1. call InitParser(source); + // 2. call DoParsing(); + // 3. call GetProduct(); (its return value is then returned) + // 4. call DoneParser(); + wxObject* Parse(const wxString& source); + + // Sets the source. This must be called before running Parse() method. + virtual void InitParser(const wxString& source); + // This must be called after Parse(). + virtual void DoneParser(); + + // May be called during parsing to immediately return from Parse(). + virtual void StopParsing() { m_stopParsing = true; } + + // Parses the m_Source from begin_pos to end_pos-1. + // (in noparams version it parses whole m_Source) + void DoParsing(int begin_pos, int end_pos); + void DoParsing(); + + // Returns pointer to the tag at parser's current position + wxHtmlTag *GetCurrentTag() const { return m_CurTag; } + + // Returns product of parsing + // Returned value is result of parsing of the part. The type of this result + // depends on internal representation in derived parser + // (see wxHtmlWinParser for details). + virtual wxObject* GetProduct() = 0; + + // adds handler to the list & hash table of handlers. + virtual void AddTagHandler(wxHtmlTagHandler *handler); + + // Forces the handler to handle additional tags (not returned by GetSupportedTags). + // The handler should already be in use by this parser. + // Example: you want to parse following pseudo-html structure: + // + // + // + // + // This last it has different meaning, we don't want it to be parsed by myitems handler! + // handler can handle only 'myitems' (e.g. its GetSupportedTags returns "MYITEMS") + // you can call PushTagHandler(handler, "IT") when you find + // and call PopTagHandler() when you find + void PushTagHandler(wxHtmlTagHandler *handler, const wxString& tags); + + // Restores state before last call to PushTagHandler + void PopTagHandler(); + + wxString* GetSource() {return &m_Source;} + void SetSource(const wxString& src); + + // Sets HTML source and remembers current parser's state so that it can + // later be restored. This is useful for on-line modifications of + // HTML source (for example,
 handler replaces spaces with  
+    // and newlines with 
) + virtual void SetSourceAndSaveState(const wxString& src); + // Restores parser's state from stack or returns false if the stack is + // empty + virtual bool RestoreState(); + + // Returns HTML source inside the element (i.e. between the starting + // and ending tag) + wxString GetInnerSource(const wxHtmlTag& tag); + + // Parses HTML string 'markup' and extracts charset info from tag + // if present. Returns empty string if the tag is missing. + // For wxHTML's internal use. + static wxString ExtractCharsetInformation(const wxString& markup); + + // Returns entity parser object, used to substitute HTML &entities; + wxHtmlEntitiesParser *GetEntitiesParser() const { return m_entitiesParser; } + +protected: + // DOM structure + void CreateDOMTree(); + void DestroyDOMTree(); + void CreateDOMSubTree(wxHtmlTag *cur, + int begin_pos, int end_pos, + wxHtmlTagsCache *cache); + + // Adds text to the output. + // This is called from Parse() and must be overriden in derived classes. + // txt is not guaranteed to be only one word. It is largest continuous part of text + // (= not broken by tags) + // NOTE : using char* because of speed improvements + virtual void AddText(const wxChar* txt) = 0; + + // Adds tag and proceeds it. Parse() may (and usually is) called from this method. + // This is called from Parse() and may be overriden. + // Default behavior is that it looks for proper handler in m_Handlers. The tag is + // ignored if no hander is found. + // Derived class is *responsible* for filling in m_Handlers table. + virtual void AddTag(const wxHtmlTag& tag); + +protected: + // DOM tree: + wxHtmlTag *m_CurTag; + wxHtmlTag *m_Tags; + wxHtmlTextPieces *m_TextPieces; + size_t m_CurTextPiece; + + wxString m_Source; + + wxHtmlParserState *m_SavedStates; + + // handlers that handle particular tags. The table is accessed by + // key = tag's name. + // This attribute MUST be filled by derived class otherwise it would + // be empty and no tags would be recognized + // (see wxHtmlWinParser for details about filling it) + // m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.) + // it may (and often does) contain more references to one object + // m_HandlersList is list of all handlers and it is guaranteed to contain + // only one reference to each handler instance. + wxList m_HandlersList; + wxHashTable m_HandlersHash; + + DECLARE_NO_COPY_CLASS(wxHtmlParser) + + // class for opening files (file system) + wxFileSystem *m_FS; + // handlers stack used by PushTagHandler and PopTagHandler + wxList *m_HandlersStack; + + // entity parse + wxHtmlEntitiesParser *m_entitiesParser; + + // flag indicating that the parser should stop + bool m_stopParsing; +}; + + + +// This class (and derived classes) cooperates with wxHtmlParser. +// Each recognized tag is passed to handler which is capable +// of handling it. Each tag is handled in 3 steps: +// 1. Handler will modifies state of parser +// (using its public methods) +// 2. Parser parses source between starting and ending tag +// 3. Handler restores original state of the parser +class WXDLLIMPEXP_HTML wxHtmlTagHandler : public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxHtmlTagHandler) + +public: + wxHtmlTagHandler() : wxObject () { m_Parser = NULL; } + + // Sets the parser. + // NOTE : each _instance_ of handler is guaranteed to be called + // only by one parser. This means you don't have to care about + // reentrancy. + virtual void SetParser(wxHtmlParser *parser) + { m_Parser = parser; } + + // Returns list of supported tags. The list is in uppercase and + // tags are delimited by ','. + // Example : "I,B,FONT,P" + // is capable of handling italic, bold, font and paragraph tags + virtual wxString GetSupportedTags() = 0; + + // This is hadling core method. It does all the Steps 1-3. + // To process step 2, you can call ParseInner() + // returned value : true if it called ParseInner(), + // false etherwise + virtual bool HandleTag(const wxHtmlTag& tag) = 0; + +protected: + // parses input between beginning and ending tag. + // m_Parser must be set. + void ParseInner(const wxHtmlTag& tag) + { m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); } + + // Parses given source as if it was tag's inner code (see + // wxHtmlParser::GetInnerSource). Unlike ParseInner(), this method lets + // you specify the source code to parse. This is useful when you need to + // modify the inner text before parsing. + void ParseInnerSource(const wxString& source); + + wxHtmlParser *m_Parser; + + DECLARE_NO_COPY_CLASS(wxHtmlTagHandler) +}; + + +// This class is used to parse HTML entities in strings. It can handle +// both named entities and &#xxxx entries where xxxx is Unicode code. +class WXDLLIMPEXP_HTML wxHtmlEntitiesParser : public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxHtmlEntitiesParser) + +public: + wxHtmlEntitiesParser(); + virtual ~wxHtmlEntitiesParser(); + + // Sets encoding of output string. + // Has no effect if wxUSE_WCHAR_T==0 or wxUSE_UNICODE==1 + void SetEncoding(wxFontEncoding encoding); + + // Parses entities in input and replaces them with respective characters + // (with respect to output encoding) + wxString Parse(const wxString& input); + + // Returns character for given entity or 0 if the enity is unknown + wxChar GetEntityChar(const wxString& entity); + + // Returns character that represents given Unicode code +#if wxUSE_UNICODE + wxChar GetCharForCode(unsigned code) { return (wxChar)code; } +#else + wxChar GetCharForCode(unsigned code); +#endif + +protected: +#if wxUSE_WCHAR_T && !wxUSE_UNICODE + wxMBConv *m_conv; + wxFontEncoding m_encoding; +#endif + + DECLARE_NO_COPY_CLASS(wxHtmlEntitiesParser) +}; + + +#endif + +#endif // _WX_HTMLPARS_H_ diff --git a/Externals/wxWidgets/include/wx/html/htmlproc.h b/Externals/wxWidgets/include/wx/html/htmlproc.h index 006830d580..eda556b49d 100644 --- a/Externals/wxWidgets/include/wx/html/htmlproc.h +++ b/Externals/wxWidgets/include/wx/html/htmlproc.h @@ -1,58 +1,58 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmlprep.h -// Purpose: HTML processor -// Author: Vaclav Slavik -// RCS-ID: $Id: htmlproc.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2001 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLPREP_H_ -#define _WX_HTMLPREP_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -#include "wx/string.h" - -// Priority of preprocessor in the chain. The higher, the earlier it is used -enum -{ - wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this - // priority - wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals -}; - -// Classes derived from this class serve as simple text processors for -// wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered -// processors before displaying it, thus allowing for on-the-fly -// modifications of the markup. - -class WXDLLIMPEXP_HTML wxHtmlProcessor : public wxObject -{ - DECLARE_ABSTRACT_CLASS(wxHtmlProcessor) - -public: - wxHtmlProcessor() : wxObject(), m_enabled(true) {} - virtual ~wxHtmlProcessor() {} - - // Process input text and return processed result - virtual wxString Process(const wxString& text) const = 0; - - // Return priority value of this processor. The higher, the sooner - // is the processor applied to the text. - virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; } - - // Enable/disable the processor. wxHtmlWindow won't use a disabled - // processor even if it is in its processors queue. - virtual void Enable(bool enable = true) { m_enabled = enable; } - bool IsEnabled() const { return m_enabled; } - -protected: - bool m_enabled; -}; - -#endif // wxUSE_HTML - -#endif // _WX_HTMLPROC_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: htmlprep.h +// Purpose: HTML processor +// Author: Vaclav Slavik +// RCS-ID: $Id: htmlproc.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2001 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLPREP_H_ +#define _WX_HTMLPREP_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/string.h" + +// Priority of preprocessor in the chain. The higher, the earlier it is used +enum +{ + wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this + // priority + wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals +}; + +// Classes derived from this class serve as simple text processors for +// wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered +// processors before displaying it, thus allowing for on-the-fly +// modifications of the markup. + +class WXDLLIMPEXP_HTML wxHtmlProcessor : public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxHtmlProcessor) + +public: + wxHtmlProcessor() : wxObject(), m_enabled(true) {} + virtual ~wxHtmlProcessor() {} + + // Process input text and return processed result + virtual wxString Process(const wxString& text) const = 0; + + // Return priority value of this processor. The higher, the sooner + // is the processor applied to the text. + virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; } + + // Enable/disable the processor. wxHtmlWindow won't use a disabled + // processor even if it is in its processors queue. + virtual void Enable(bool enable = true) { m_enabled = enable; } + bool IsEnabled() const { return m_enabled; } + +protected: + bool m_enabled; +}; + +#endif // wxUSE_HTML + +#endif // _WX_HTMLPROC_H_ diff --git a/Externals/wxWidgets/include/wx/html/htmltag.h b/Externals/wxWidgets/include/wx/html/htmltag.h index 7700c379ff..6596111922 100644 --- a/Externals/wxWidgets/include/wx/html/htmltag.h +++ b/Externals/wxWidgets/include/wx/html/htmltag.h @@ -1,148 +1,148 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmltag.h -// Purpose: wxHtmlTag class (represents single tag) -// Author: Vaclav Slavik -// RCS-ID: $Id: htmltag.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLTAG_H_ -#define _WX_HTMLTAG_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -#include "wx/object.h" -#include "wx/arrstr.h" - -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser; - -//----------------------------------------------------------------------------- -// wxHtmlTagsCache -// - internal wxHTML class, do not use! -//----------------------------------------------------------------------------- - -struct wxHtmlCacheItem; - -class WXDLLIMPEXP_HTML wxHtmlTagsCache : public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache) - -private: - wxHtmlCacheItem *m_Cache; - int m_CacheSize; - int m_CachePos; - -public: - wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;} - wxHtmlTagsCache(const wxString& source); - virtual ~wxHtmlTagsCache() {free(m_Cache);} - - // Finds parameters for tag starting at at and fills the variables - void QueryTag(int at, int* end1, int* end2); - - DECLARE_NO_COPY_CLASS(wxHtmlTagsCache) -}; - - -//-------------------------------------------------------------------------------- -// wxHtmlTag -// This represents single tag. It is used as internal structure -// by wxHtmlParser. -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlTag : public wxObject -{ - DECLARE_CLASS(wxHtmlTag) - -protected: - // constructs wxHtmlTag object based on HTML tag. - // The tag begins (with '<' character) at position pos in source - // end_pos is position where parsing ends (usually end of document) - wxHtmlTag(wxHtmlTag *parent, - const wxString& source, int pos, int end_pos, - wxHtmlTagsCache *cache, - wxHtmlEntitiesParser *entParser); - friend class wxHtmlParser; -public: - virtual ~wxHtmlTag(); - - wxHtmlTag *GetParent() const {return m_Parent;} - wxHtmlTag *GetFirstSibling() const; - wxHtmlTag *GetLastSibling() const; - wxHtmlTag *GetChildren() const { return m_FirstChild; } - wxHtmlTag *GetPreviousSibling() const { return m_Prev; } - wxHtmlTag *GetNextSibling() const {return m_Next; } - // Return next tag, as if tree had been flattened - wxHtmlTag *GetNextTag() const; - - // Returns tag's name in uppercase. - inline wxString GetName() const {return m_Name;} - - // Returns true if the tag has given parameter. Parameter - // should always be in uppercase. - // Example : HasParam("SRC") returns true - bool HasParam(const wxString& par) const; - - // Returns value of the param. Value is in uppercase unless it is - // enclosed with " - // Example :

GetParam("ALIGN") returns (RIGHT) - //

GetParam("SRC") returns (WhaT.jpg) - // (or ("WhaT.jpg") if with_commas == true) - wxString GetParam(const wxString& par, bool with_commas = false) const; - - // Convenience functions: - bool GetParamAsColour(const wxString& par, wxColour *clr) const; - bool GetParamAsInt(const wxString& par, int *clr) const; - - // Scans param like scanf() functions family does. - // Example : ScanParam("COLOR", "\"#%X\"", &clr); - // This is always with with_commas=false - // Returns number of scanned values - // (like sscanf() does) - // NOTE: unlike scanf family, this function only accepts - // *one* parameter ! - int ScanParam(const wxString& par, const wxChar *format, void *param) const; - - // Returns string containing all params. - wxString GetAllParams() const; - - // return true if this there is matching ending tag - inline bool HasEnding() const {return m_End1 >= 0;} - - // returns beginning position of _internal_ block of text - // See explanation (returned value is marked with *): - // bla bla bla * bla bla intenal text bla bla - inline int GetBeginPos() const {return m_Begin;} - // returns ending position of _internal_ block of text. - // bla bla bla bla bla intenal text* bla bla - inline int GetEndPos1() const {return m_End1;} - // returns end position 2 : - // bla bla bla bla bla internal text* bla bla - inline int GetEndPos2() const {return m_End2;} - -private: - wxString m_Name; - int m_Begin, m_End1, m_End2; - wxArrayString m_ParamNames, m_ParamValues; - - // DOM tree relations: - wxHtmlTag *m_Next; - wxHtmlTag *m_Prev; - wxHtmlTag *m_FirstChild, *m_LastChild; - wxHtmlTag *m_Parent; - - DECLARE_NO_COPY_CLASS(wxHtmlTag) -}; - - - - - -#endif - -#endif // _WX_HTMLTAG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: htmltag.h +// Purpose: wxHtmlTag class (represents single tag) +// Author: Vaclav Slavik +// RCS-ID: $Id: htmltag.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLTAG_H_ +#define _WX_HTMLTAG_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/object.h" +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser; + +//----------------------------------------------------------------------------- +// wxHtmlTagsCache +// - internal wxHTML class, do not use! +//----------------------------------------------------------------------------- + +struct wxHtmlCacheItem; + +class WXDLLIMPEXP_HTML wxHtmlTagsCache : public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache) + +private: + wxHtmlCacheItem *m_Cache; + int m_CacheSize; + int m_CachePos; + +public: + wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;} + wxHtmlTagsCache(const wxString& source); + virtual ~wxHtmlTagsCache() {free(m_Cache);} + + // Finds parameters for tag starting at at and fills the variables + void QueryTag(int at, int* end1, int* end2); + + DECLARE_NO_COPY_CLASS(wxHtmlTagsCache) +}; + + +//-------------------------------------------------------------------------------- +// wxHtmlTag +// This represents single tag. It is used as internal structure +// by wxHtmlParser. +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlTag : public wxObject +{ + DECLARE_CLASS(wxHtmlTag) + +protected: + // constructs wxHtmlTag object based on HTML tag. + // The tag begins (with '<' character) at position pos in source + // end_pos is position where parsing ends (usually end of document) + wxHtmlTag(wxHtmlTag *parent, + const wxString& source, int pos, int end_pos, + wxHtmlTagsCache *cache, + wxHtmlEntitiesParser *entParser); + friend class wxHtmlParser; +public: + virtual ~wxHtmlTag(); + + wxHtmlTag *GetParent() const {return m_Parent;} + wxHtmlTag *GetFirstSibling() const; + wxHtmlTag *GetLastSibling() const; + wxHtmlTag *GetChildren() const { return m_FirstChild; } + wxHtmlTag *GetPreviousSibling() const { return m_Prev; } + wxHtmlTag *GetNextSibling() const {return m_Next; } + // Return next tag, as if tree had been flattened + wxHtmlTag *GetNextTag() const; + + // Returns tag's name in uppercase. + inline wxString GetName() const {return m_Name;} + + // Returns true if the tag has given parameter. Parameter + // should always be in uppercase. + // Example : HasParam("SRC") returns true + bool HasParam(const wxString& par) const; + + // Returns value of the param. Value is in uppercase unless it is + // enclosed with " + // Example :

GetParam("ALIGN") returns (RIGHT) + //

GetParam("SRC") returns (WhaT.jpg) + // (or ("WhaT.jpg") if with_commas == true) + wxString GetParam(const wxString& par, bool with_commas = false) const; + + // Convenience functions: + bool GetParamAsColour(const wxString& par, wxColour *clr) const; + bool GetParamAsInt(const wxString& par, int *clr) const; + + // Scans param like scanf() functions family does. + // Example : ScanParam("COLOR", "\"#%X\"", &clr); + // This is always with with_commas=false + // Returns number of scanned values + // (like sscanf() does) + // NOTE: unlike scanf family, this function only accepts + // *one* parameter ! + int ScanParam(const wxString& par, const wxChar *format, void *param) const; + + // Returns string containing all params. + wxString GetAllParams() const; + + // return true if this there is matching ending tag + inline bool HasEnding() const {return m_End1 >= 0;} + + // returns beginning position of _internal_ block of text + // See explanation (returned value is marked with *): + // bla bla bla * bla bla intenal text bla bla + inline int GetBeginPos() const {return m_Begin;} + // returns ending position of _internal_ block of text. + // bla bla bla bla bla intenal text* bla bla + inline int GetEndPos1() const {return m_End1;} + // returns end position 2 : + // bla bla bla bla bla internal text* bla bla + inline int GetEndPos2() const {return m_End2;} + +private: + wxString m_Name; + int m_Begin, m_End1, m_End2; + wxArrayString m_ParamNames, m_ParamValues; + + // DOM tree relations: + wxHtmlTag *m_Next; + wxHtmlTag *m_Prev; + wxHtmlTag *m_FirstChild, *m_LastChild; + wxHtmlTag *m_Parent; + + DECLARE_NO_COPY_CLASS(wxHtmlTag) +}; + + + + + +#endif + +#endif // _WX_HTMLTAG_H_ + diff --git a/Externals/wxWidgets/include/wx/html/htmlwin.h b/Externals/wxWidgets/include/wx/html/htmlwin.h index 923e84ddec..847fe72370 100644 --- a/Externals/wxWidgets/include/wx/html/htmlwin.h +++ b/Externals/wxWidgets/include/wx/html/htmlwin.h @@ -1,651 +1,651 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmlwin.h -// Purpose: wxHtmlWindow class for parsing & displaying HTML -// Author: Vaclav Slavik -// RCS-ID: $Id: htmlwin.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLWIN_H_ -#define _WX_HTMLWIN_H_ - -#include "wx/defs.h" -#if wxUSE_HTML - -#include "wx/window.h" -#include "wx/scrolwin.h" -#include "wx/config.h" -#include "wx/stopwatch.h" -#include "wx/html/winpars.h" -#include "wx/html/htmlcell.h" -#include "wx/filesys.h" -#include "wx/html/htmlfilt.h" -#include "wx/filename.h" -#include "wx/bitmap.h" - -class wxHtmlProcessor; -class wxHtmlWinModule; -class wxHtmlHistoryArray; -class wxHtmlProcessorList; -class WXDLLIMPEXP_FWD_HTML wxHtmlWinAutoScrollTimer; -class WXDLLIMPEXP_FWD_HTML wxHtmlCellEvent; -class WXDLLIMPEXP_FWD_HTML wxHtmlLinkEvent; - - -// wxHtmlWindow flags: -#define wxHW_SCROLLBAR_NEVER 0x0002 -#define wxHW_SCROLLBAR_AUTO 0x0004 -#define wxHW_NO_SELECTION 0x0008 - -#define wxHW_DEFAULT_STYLE wxHW_SCROLLBAR_AUTO - -/// Enum for wxHtmlWindow::OnOpeningURL and wxHtmlWindowInterface::OnOpeningURL -enum wxHtmlOpeningStatus -{ - /// Open the requested URL - wxHTML_OPEN, - /// Do not open the URL - wxHTML_BLOCK, - /// Redirect to another URL (returned from OnOpeningURL) - wxHTML_REDIRECT -}; - -/** - Abstract interface to a HTML rendering window (such as wxHtmlWindow or - wxHtmlListBox) that is passed to wxHtmlWinParser. It encapsulates all - communication from the parser to the window. - */ -class WXDLLIMPEXP_HTML wxHtmlWindowInterface -{ -public: - /// Ctor - wxHtmlWindowInterface() {} - virtual ~wxHtmlWindowInterface() {} - - /** - Called by the parser to set window's title to given text. - */ - virtual void SetHTMLWindowTitle(const wxString& title) = 0; - - /** - Called when a link is clicked. - - @param link information about the clicked link - */ - virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0; - - /** - Called when the parser needs to open another URL (e.g. an image). - - @param type Type of the URL request (e.g. image) - @param url URL the parser wants to open - @param redirect If the return value is wxHTML_REDIRECT, then the - URL to redirect to will be stored in this variable - (the pointer must never be NULL) - - @return indicator of how to treat the request - */ - virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, - const wxString& url, - wxString *redirect) const = 0; - - /** - Converts coordinates @a pos relative to given @a cell to - physical coordinates in the window. - */ - virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, - const wxPoint& pos) const = 0; - - /// Returns the window used for rendering (may be NULL). - virtual wxWindow* GetHTMLWindow() = 0; - - /// Returns background colour to use by default. - virtual wxColour GetHTMLBackgroundColour() const = 0; - - /// Sets window's background to colour @a clr. - virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0; - - /// Sets window's background to given bitmap. - virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0; - - /// Sets status bar text. - virtual void SetHTMLStatusText(const wxString& text) = 0; - - /// Type of mouse cursor - enum HTMLCursor - { - /// Standard mouse cursor (typically an arrow) - HTMLCursor_Default, - /// Cursor shown over links - HTMLCursor_Link, - /// Cursor shown over selectable text - HTMLCursor_Text - }; - - /** - Returns mouse cursor of given @a type. - */ - virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0; -}; - -/** - Helper class that implements part of mouse handling for wxHtmlWindow and - wxHtmlListBox. Cursor changes and clicking on links are handled, text - selection is not. - */ -class WXDLLIMPEXP_HTML wxHtmlWindowMouseHelper -{ -protected: - /** - Ctor. - - @param iface Interface to the owner window. - */ - wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface); - - /** - Virtual dtor. - - It is not really needed in this case but at leats it prevents gcc from - complaining about its absence. - */ - virtual ~wxHtmlWindowMouseHelper() { } - - /// Returns true if the mouse moved since the last call to HandleIdle - bool DidMouseMove() const { return m_tmpMouseMoved; } - - /// Call this from EVT_MOTION event handler - void HandleMouseMoved(); - - /** - Call this from EVT_LEFT_UP handler (or, alternatively, EVT_LEFT_DOWN). - - @param rootCell HTML cell inside which the click occured. This doesn't - have to be the leaf cell, it can be e.g. toplevel - container, but the mouse must be inside the container's - area, otherwise the event would be ignored. - @param pos Mouse position in coordinates relative to @a cell - @param event The event that triggered the call - */ - bool HandleMouseClick(wxHtmlCell *rootCell, - const wxPoint& pos, const wxMouseEvent& event); - - /** - Call this from OnInternalIdle of the HTML displaying window. Handles - mouse movements and must be used together with HandleMouseMoved. - - @param rootCell HTML cell inside which the click occured. This doesn't - have to be the leaf cell, it can be e.g. toplevel - container, but the mouse must be inside the container's - area, otherwise the event would be ignored. - @param pos Current mouse position in coordinates relative to - @a cell - */ - void HandleIdle(wxHtmlCell *rootCell, const wxPoint& pos); - - /** - Called by HandleIdle when the mouse hovers over a cell. Default - behaviour is to do nothing. - - @param cell the cell the mouse is over - @param x, y coordinates of mouse relative to the cell - */ - virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); - - /** - Called by HandleMouseClick when the user clicks on a cell. - Default behavior is to call wxHtmlWindowInterface::OnLinkClicked() - if this cell corresponds to a hypertext link. - - @param cell the cell the mouse is over - @param x, y coordinates of mouse relative to the cell - @param event The event that triggered the call - - - @return true if a link was clicked, false otherwise. - */ - virtual bool OnCellClicked(wxHtmlCell *cell, - wxCoord x, wxCoord y, - const wxMouseEvent& event); - -protected: - // this flag indicates if the mouse moved (used by HandleIdle) - bool m_tmpMouseMoved; - // contains last link name - wxHtmlLinkInfo *m_tmpLastLink; - // contains the last (terminal) cell which contained the mouse - wxHtmlCell *m_tmpLastCell; - -private: - wxHtmlWindowInterface *m_interface; -}; - -// ---------------------------------------------------------------------------- -// wxHtmlWindow -// (This is probably the only class you will directly use.) -// Purpose of this class is to display HTML page (either local -// file or downloaded via HTTP protocol) in a window. Width of -// window is constant - given in constructor - virtual height -// is changed dynamicly depending on page size. Once the -// window is created you can set it's content by calling -// SetPage(text) or LoadPage(filename). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlWindow : public wxScrolledWindow, - public wxHtmlWindowInterface, - public wxHtmlWindowMouseHelper -{ - DECLARE_DYNAMIC_CLASS(wxHtmlWindow) - friend class wxHtmlWinModule; - -public: - wxHtmlWindow() : wxHtmlWindowMouseHelper(this) { Init(); } - wxHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHW_DEFAULT_STYLE, - const wxString& name = wxT("htmlWindow")) - : wxHtmlWindowMouseHelper(this) - { - Init(); - Create(parent, id, pos, size, style, name); - } - virtual ~wxHtmlWindow(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHW_SCROLLBAR_AUTO, - const wxString& name = wxT("htmlWindow")); - - // Set HTML page and display it. !! source is HTML document itself, - // it is NOT address/filename of HTML document. If you want to - // specify document location, use LoadPage() istead - // Return value : false if an error occurred, true otherwise - virtual bool SetPage(const wxString& source); - - // Append to current page - bool AppendToPage(const wxString& source); - - // Load HTML page from given location. Location can be either - // a) /usr/wxGTK2/docs/html/wx.htm - // b) http://www.somewhere.uk/document.htm - // c) ftp://ftp.somesite.cz/pub/something.htm - // In case there is no prefix (http:,ftp:), the method - // will try to find it itself (1. local file, then http or ftp) - // After the page is loaded, the method calls SetPage() to display it. - // Note : you can also use path relative to previously loaded page - // Return value : same as SetPage - virtual bool LoadPage(const wxString& location); - - // Loads HTML page from file - bool LoadFile(const wxFileName& filename); - - // Returns full location of opened page - wxString GetOpenedPage() const {return m_OpenedPage;} - // Returns anchor within opened page - wxString GetOpenedAnchor() const {return m_OpenedAnchor;} - // Returns of opened page or empty string otherwise - wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;} - - // Sets frame in which page title will be displayed. Format is format of - // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s - void SetRelatedFrame(wxFrame* frame, const wxString& format); - wxFrame* GetRelatedFrame() const {return m_RelatedFrame;} - -#if wxUSE_STATUSBAR - // After(!) calling SetRelatedFrame, this sets statusbar slot where messages - // will be displayed. Default is -1 = no messages. - void SetRelatedStatusBar(int bar); -#endif // wxUSE_STATUSBAR - - // Sets fonts to be used when displaying HTML page. - void SetFonts(const wxString& normal_face, const wxString& fixed_face, - const int *sizes = NULL); - - // Sets font sizes to be relative to the given size or the system - // default size; use either specified or default font - void SetStandardFonts(int size = -1, - const wxString& normal_face = wxEmptyString, - const wxString& fixed_face = wxEmptyString); - - // Sets space between text and window borders. - void SetBorders(int b) {m_Borders = b;} - - // Sets the bitmap to use for background (currnetly it will be tiled, - // when/if we have CSS support we could add other possibilities...) - void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; } - - // Saves custom settings into cfg config. it will use the path 'path' - // if given, otherwise it will save info into currently selected path. - // saved values : things set by SetFonts, SetBorders. - virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); - // ... - virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); - - // Goes to previous/next page (in browsing history) - // Returns true if successful, false otherwise - bool HistoryBack(); - bool HistoryForward(); - bool HistoryCanBack(); - bool HistoryCanForward(); - // Resets history - void HistoryClear(); - - // Returns pointer to conteiners/cells structure. - // It should be used ONLY when printing - wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;} - - // Adds input filter - static void AddFilter(wxHtmlFilter *filter); - - // Returns a pointer to the parser. - wxHtmlWinParser *GetParser() const { return m_Parser; } - - // Adds HTML processor to this instance of wxHtmlWindow: - void AddProcessor(wxHtmlProcessor *processor); - // Adds HTML processor to wxHtmlWindow class as whole: - static void AddGlobalProcessor(wxHtmlProcessor *processor); - - - // -- Callbacks -- - - // Sets the title of the window - // (depending on the information passed to SetRelatedFrame() method) - virtual void OnSetTitle(const wxString& title); - - // Called when user clicked on hypertext link. Default behavior is to - // call LoadPage(loc) - virtual void OnLinkClicked(const wxHtmlLinkInfo& link); - - // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when - // loading a page or loading an image). The data are downloaded if and only if - // OnOpeningURL returns true. If OnOpeningURL returns wxHTML_REDIRECT, - // it must set *redirect to the new URL - virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type), - const wxString& WXUNUSED(url), - wxString *WXUNUSED(redirect)) const - { return wxHTML_OPEN; } - -#if wxUSE_CLIPBOARD - // Helper functions to select parts of page: - void SelectWord(const wxPoint& pos); - void SelectLine(const wxPoint& pos); - void SelectAll(); - - // Convert selection to text: - wxString SelectionToText() { return DoSelectionToText(m_selection); } - - // Converts current page to text: - wxString ToText(); -#endif // wxUSE_CLIPBOARD - - virtual void OnInternalIdle(); - - /// Returns standard HTML cursor as used by wxHtmlWindow - static wxCursor GetDefaultHTMLCursor(HTMLCursor type); - -protected: - void Init(); - - // Scrolls to anchor of this name. (Anchor is #news - // or #features etc. it is part of address sometimes: - // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news) - // Return value : true if anchor exists, false otherwise - bool ScrollToAnchor(const wxString& anchor); - - // Prepares layout (= fill m_PosX, m_PosY for fragments) based on - // actual size of window. This method also setup scrollbars - void CreateLayout(); - - void OnEraseBackground(wxEraseEvent& event); - void OnPaint(wxPaintEvent& event); - void OnSize(wxSizeEvent& event); - void OnMouseMove(wxMouseEvent& event); - void OnMouseDown(wxMouseEvent& event); - void OnMouseUp(wxMouseEvent& event); -#if wxUSE_CLIPBOARD - void OnKeyUp(wxKeyEvent& event); - void OnDoubleClick(wxMouseEvent& event); - void OnCopy(wxCommandEvent& event); - void OnClipboardEvent(wxClipboardTextEvent& event); - void OnMouseEnter(wxMouseEvent& event); - void OnMouseLeave(wxMouseEvent& event); - void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); -#endif // wxUSE_CLIPBOARD - - // Returns new filter (will be stored into m_DefaultFilter variable) - virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;} - - // cleans static variables - static void CleanUpStatics(); - - // Returns true if text selection is enabled (wxClipboard must be available - // and wxHW_NO_SELECTION not used) - bool IsSelectionEnabled() const; - - enum ClipboardType - { - Primary, - Secondary - }; - - // Copies selection to clipboard if the clipboard support is available - // - // returns true if anything was copied to clipboard, false otherwise - bool CopySelection(ClipboardType t = Secondary); - -#if wxUSE_CLIPBOARD - // Automatic scrolling during selection: - void StopAutoScrolling(); -#endif // wxUSE_CLIPBOARD - - wxString DoSelectionToText(wxHtmlSelection *sel); - -public: - // wxHtmlWindowInterface methods: - virtual void SetHTMLWindowTitle(const wxString& title); - virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); - virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, - const wxString& url, - wxString *redirect) const; - virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, - const wxPoint& pos) const; - virtual wxWindow* GetHTMLWindow(); - virtual wxColour GetHTMLBackgroundColour() const; - virtual void SetHTMLBackgroundColour(const wxColour& clr); - virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); - virtual void SetHTMLStatusText(const wxString& text); - virtual wxCursor GetHTMLCursor(HTMLCursor type) const; - - // implementation of SetPage() - bool DoSetPage(const wxString& source); - -protected: - // This is pointer to the first cell in parsed data. (Note: the first cell - // is usually top one = all other cells are sub-cells of this one) - wxHtmlContainerCell *m_Cell; - // parser which is used to parse HTML input. - // Each wxHtmlWindow has it's own parser because sharing one global - // parser would be problematic (because of reentrancy) - wxHtmlWinParser *m_Parser; - // contains name of actualy opened page or empty string if no page opened - wxString m_OpenedPage; - // contains name of current anchor within m_OpenedPage - wxString m_OpenedAnchor; - // contains title of actualy opened page or empty string if no <TITLE> tag - wxString m_OpenedPageTitle; - // class for opening files (file system) - wxFileSystem* m_FS; - - wxFrame *m_RelatedFrame; - wxString m_TitleFormat; -#if wxUSE_STATUSBAR - // frame in which page title should be displayed & number of it's statusbar - // reserved for usage with this html window - int m_RelatedStatusBar; -#endif // wxUSE_STATUSBAR - - // borders (free space between text and window borders) - // defaults to 10 pixels. - int m_Borders; - - // current text selection or NULL - wxHtmlSelection *m_selection; - - // true if the user is dragging mouse to select text - bool m_makingSelection; - -#if wxUSE_CLIPBOARD - // time of the last doubleclick event, used to detect tripleclicks - // (tripleclicks are used to select whole line): - wxMilliClock_t m_lastDoubleClick; - - // helper class to automatically scroll the window if the user is selecting - // text and the mouse leaves wxHtmlWindow: - wxHtmlWinAutoScrollTimer *m_timerAutoScroll; -#endif // wxUSE_CLIPBOARD - -private: - // window content for double buffered rendering: - wxBitmap *m_backBuffer; - - // background image, may be invalid - wxBitmap m_bmpBg; - - // variables used when user is selecting text - wxPoint m_tmpSelFromPos; - wxHtmlCell *m_tmpSelFromCell; - - // if >0 contents of the window is not redrawn - // (in order to avoid ugly blinking) - int m_tmpCanDrawLocks; - - // list of HTML filters - static wxList m_Filters; - // this filter is used when no filter is able to read some file - static wxHtmlFilter *m_DefaultFilter; - - // html processors array: - wxHtmlProcessorList *m_Processors; - static wxHtmlProcessorList *m_GlobalProcessors; - - // browser history - wxHtmlHistoryArray *m_History; - int m_HistoryPos; - // if this FLAG is false, items are not added to history - bool m_HistoryOn; - - // a flag set if we need to erase background in OnPaint() (otherwise this - // is supposed to have been done in OnEraseBackground()) - bool m_eraseBgInOnPaint; - - // standard mouse cursors - static wxCursor *ms_cursorLink; - static wxCursor *ms_cursorText; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxHtmlWindow) -}; - - - - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_HTML, - wxEVT_COMMAND_HTML_CELL_CLICKED, 1000) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_HTML, - wxEVT_COMMAND_HTML_CELL_HOVER, 1001) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_HTML, - wxEVT_COMMAND_HTML_LINK_CLICKED, 1002) -END_DECLARE_EVENT_TYPES() - - -/*! - * Html cell window event - */ - -class WXDLLIMPEXP_HTML wxHtmlCellEvent : public wxCommandEvent -{ -public: - wxHtmlCellEvent() {} - wxHtmlCellEvent(wxEventType commandType, int id, - wxHtmlCell *cell, const wxPoint &pt, - const wxMouseEvent &ev) - : wxCommandEvent(commandType, id) - { - m_cell = cell; - m_pt = pt; - m_mouseEvent = ev; - m_bLinkWasClicked = false; - } - - wxHtmlCell* GetCell() const { return m_cell; } - wxPoint GetPoint() const { return m_pt; } - wxMouseEvent GetMouseEvent() const { return m_mouseEvent; } - - void SetLinkClicked(bool linkclicked) { m_bLinkWasClicked=linkclicked; } - bool GetLinkClicked() const { return m_bLinkWasClicked; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxHtmlCellEvent(*this); } - -private: - wxHtmlCell *m_cell; - wxMouseEvent m_mouseEvent; - wxPoint m_pt; - - bool m_bLinkWasClicked; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHtmlCellEvent) -}; - - - -/*! - * Html link event - */ - -class WXDLLIMPEXP_HTML wxHtmlLinkEvent : public wxCommandEvent -{ -public: - wxHtmlLinkEvent() {} - wxHtmlLinkEvent(int id, const wxHtmlLinkInfo &linkinfo) - : wxCommandEvent(wxEVT_COMMAND_HTML_LINK_CLICKED, id) - { - m_linkInfo = linkinfo; - } - - const wxHtmlLinkInfo &GetLinkInfo() const { return m_linkInfo; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxHtmlLinkEvent(*this); } - -private: - wxHtmlLinkInfo m_linkInfo; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHtmlLinkEvent) -}; - - -typedef void (wxEvtHandler::*wxHtmlCellEventFunction)(wxHtmlCellEvent&); -typedef void (wxEvtHandler::*wxHtmlLinkEventFunction)(wxHtmlLinkEvent&); - -#define wxHtmlCellEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHtmlCellEventFunction, &func) -#define wxHtmlLinkEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHtmlLinkEventFunction, &func) - -#define EVT_HTML_CELL_CLICKED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_HTML_CELL_CLICKED, id, wxHtmlCellEventHandler(fn)) -#define EVT_HTML_CELL_HOVER(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_HTML_CELL_HOVER, id, wxHtmlCellEventHandler(fn)) -#define EVT_HTML_LINK_CLICKED(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_HTML_LINK_CLICKED, id, wxHtmlLinkEventHandler(fn)) - - -#endif // wxUSE_HTML - -#endif // _WX_HTMLWIN_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: htmlwin.h +// Purpose: wxHtmlWindow class for parsing & displaying HTML +// Author: Vaclav Slavik +// RCS-ID: $Id: htmlwin.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLWIN_H_ +#define _WX_HTMLWIN_H_ + +#include "wx/defs.h" +#if wxUSE_HTML + +#include "wx/window.h" +#include "wx/scrolwin.h" +#include "wx/config.h" +#include "wx/stopwatch.h" +#include "wx/html/winpars.h" +#include "wx/html/htmlcell.h" +#include "wx/filesys.h" +#include "wx/html/htmlfilt.h" +#include "wx/filename.h" +#include "wx/bitmap.h" + +class wxHtmlProcessor; +class wxHtmlWinModule; +class wxHtmlHistoryArray; +class wxHtmlProcessorList; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinAutoScrollTimer; +class WXDLLIMPEXP_FWD_HTML wxHtmlCellEvent; +class WXDLLIMPEXP_FWD_HTML wxHtmlLinkEvent; + + +// wxHtmlWindow flags: +#define wxHW_SCROLLBAR_NEVER 0x0002 +#define wxHW_SCROLLBAR_AUTO 0x0004 +#define wxHW_NO_SELECTION 0x0008 + +#define wxHW_DEFAULT_STYLE wxHW_SCROLLBAR_AUTO + +/// Enum for wxHtmlWindow::OnOpeningURL and wxHtmlWindowInterface::OnOpeningURL +enum wxHtmlOpeningStatus +{ + /// Open the requested URL + wxHTML_OPEN, + /// Do not open the URL + wxHTML_BLOCK, + /// Redirect to another URL (returned from OnOpeningURL) + wxHTML_REDIRECT +}; + +/** + Abstract interface to a HTML rendering window (such as wxHtmlWindow or + wxHtmlListBox) that is passed to wxHtmlWinParser. It encapsulates all + communication from the parser to the window. + */ +class WXDLLIMPEXP_HTML wxHtmlWindowInterface +{ +public: + /// Ctor + wxHtmlWindowInterface() {} + virtual ~wxHtmlWindowInterface() {} + + /** + Called by the parser to set window's title to given text. + */ + virtual void SetHTMLWindowTitle(const wxString& title) = 0; + + /** + Called when a link is clicked. + + @param link information about the clicked link + */ + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0; + + /** + Called when the parser needs to open another URL (e.g. an image). + + @param type Type of the URL request (e.g. image) + @param url URL the parser wants to open + @param redirect If the return value is wxHTML_REDIRECT, then the + URL to redirect to will be stored in this variable + (the pointer must never be NULL) + + @return indicator of how to treat the request + */ + virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, + const wxString& url, + wxString *redirect) const = 0; + + /** + Converts coordinates @a pos relative to given @a cell to + physical coordinates in the window. + */ + virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, + const wxPoint& pos) const = 0; + + /// Returns the window used for rendering (may be NULL). + virtual wxWindow* GetHTMLWindow() = 0; + + /// Returns background colour to use by default. + virtual wxColour GetHTMLBackgroundColour() const = 0; + + /// Sets window's background to colour @a clr. + virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0; + + /// Sets window's background to given bitmap. + virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0; + + /// Sets status bar text. + virtual void SetHTMLStatusText(const wxString& text) = 0; + + /// Type of mouse cursor + enum HTMLCursor + { + /// Standard mouse cursor (typically an arrow) + HTMLCursor_Default, + /// Cursor shown over links + HTMLCursor_Link, + /// Cursor shown over selectable text + HTMLCursor_Text + }; + + /** + Returns mouse cursor of given @a type. + */ + virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0; +}; + +/** + Helper class that implements part of mouse handling for wxHtmlWindow and + wxHtmlListBox. Cursor changes and clicking on links are handled, text + selection is not. + */ +class WXDLLIMPEXP_HTML wxHtmlWindowMouseHelper +{ +protected: + /** + Ctor. + + @param iface Interface to the owner window. + */ + wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface); + + /** + Virtual dtor. + + It is not really needed in this case but at leats it prevents gcc from + complaining about its absence. + */ + virtual ~wxHtmlWindowMouseHelper() { } + + /// Returns true if the mouse moved since the last call to HandleIdle + bool DidMouseMove() const { return m_tmpMouseMoved; } + + /// Call this from EVT_MOTION event handler + void HandleMouseMoved(); + + /** + Call this from EVT_LEFT_UP handler (or, alternatively, EVT_LEFT_DOWN). + + @param rootCell HTML cell inside which the click occured. This doesn't + have to be the leaf cell, it can be e.g. toplevel + container, but the mouse must be inside the container's + area, otherwise the event would be ignored. + @param pos Mouse position in coordinates relative to @a cell + @param event The event that triggered the call + */ + bool HandleMouseClick(wxHtmlCell *rootCell, + const wxPoint& pos, const wxMouseEvent& event); + + /** + Call this from OnInternalIdle of the HTML displaying window. Handles + mouse movements and must be used together with HandleMouseMoved. + + @param rootCell HTML cell inside which the click occured. This doesn't + have to be the leaf cell, it can be e.g. toplevel + container, but the mouse must be inside the container's + area, otherwise the event would be ignored. + @param pos Current mouse position in coordinates relative to + @a cell + */ + void HandleIdle(wxHtmlCell *rootCell, const wxPoint& pos); + + /** + Called by HandleIdle when the mouse hovers over a cell. Default + behaviour is to do nothing. + + @param cell the cell the mouse is over + @param x, y coordinates of mouse relative to the cell + */ + virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); + + /** + Called by HandleMouseClick when the user clicks on a cell. + Default behavior is to call wxHtmlWindowInterface::OnLinkClicked() + if this cell corresponds to a hypertext link. + + @param cell the cell the mouse is over + @param x, y coordinates of mouse relative to the cell + @param event The event that triggered the call + + + @return true if a link was clicked, false otherwise. + */ + virtual bool OnCellClicked(wxHtmlCell *cell, + wxCoord x, wxCoord y, + const wxMouseEvent& event); + +protected: + // this flag indicates if the mouse moved (used by HandleIdle) + bool m_tmpMouseMoved; + // contains last link name + wxHtmlLinkInfo *m_tmpLastLink; + // contains the last (terminal) cell which contained the mouse + wxHtmlCell *m_tmpLastCell; + +private: + wxHtmlWindowInterface *m_interface; +}; + +// ---------------------------------------------------------------------------- +// wxHtmlWindow +// (This is probably the only class you will directly use.) +// Purpose of this class is to display HTML page (either local +// file or downloaded via HTTP protocol) in a window. Width of +// window is constant - given in constructor - virtual height +// is changed dynamicly depending on page size. Once the +// window is created you can set it's content by calling +// SetPage(text) or LoadPage(filename). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWindow : public wxScrolledWindow, + public wxHtmlWindowInterface, + public wxHtmlWindowMouseHelper +{ + DECLARE_DYNAMIC_CLASS(wxHtmlWindow) + friend class wxHtmlWinModule; + +public: + wxHtmlWindow() : wxHtmlWindowMouseHelper(this) { Init(); } + wxHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHW_DEFAULT_STYLE, + const wxString& name = wxT("htmlWindow")) + : wxHtmlWindowMouseHelper(this) + { + Init(); + Create(parent, id, pos, size, style, name); + } + virtual ~wxHtmlWindow(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHW_SCROLLBAR_AUTO, + const wxString& name = wxT("htmlWindow")); + + // Set HTML page and display it. !! source is HTML document itself, + // it is NOT address/filename of HTML document. If you want to + // specify document location, use LoadPage() istead + // Return value : false if an error occurred, true otherwise + virtual bool SetPage(const wxString& source); + + // Append to current page + bool AppendToPage(const wxString& source); + + // Load HTML page from given location. Location can be either + // a) /usr/wxGTK2/docs/html/wx.htm + // b) http://www.somewhere.uk/document.htm + // c) ftp://ftp.somesite.cz/pub/something.htm + // In case there is no prefix (http:,ftp:), the method + // will try to find it itself (1. local file, then http or ftp) + // After the page is loaded, the method calls SetPage() to display it. + // Note : you can also use path relative to previously loaded page + // Return value : same as SetPage + virtual bool LoadPage(const wxString& location); + + // Loads HTML page from file + bool LoadFile(const wxFileName& filename); + + // Returns full location of opened page + wxString GetOpenedPage() const {return m_OpenedPage;} + // Returns anchor within opened page + wxString GetOpenedAnchor() const {return m_OpenedAnchor;} + // Returns <TITLE> of opened page or empty string otherwise + wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;} + + // Sets frame in which page title will be displayed. Format is format of + // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s + void SetRelatedFrame(wxFrame* frame, const wxString& format); + wxFrame* GetRelatedFrame() const {return m_RelatedFrame;} + +#if wxUSE_STATUSBAR + // After(!) calling SetRelatedFrame, this sets statusbar slot where messages + // will be displayed. Default is -1 = no messages. + void SetRelatedStatusBar(int bar); +#endif // wxUSE_STATUSBAR + + // Sets fonts to be used when displaying HTML page. + void SetFonts(const wxString& normal_face, const wxString& fixed_face, + const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + // Sets space between text and window borders. + void SetBorders(int b) {m_Borders = b;} + + // Sets the bitmap to use for background (currnetly it will be tiled, + // when/if we have CSS support we could add other possibilities...) + void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; } + + // Saves custom settings into cfg config. it will use the path 'path' + // if given, otherwise it will save info into currently selected path. + // saved values : things set by SetFonts, SetBorders. + virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); + // ... + virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); + + // Goes to previous/next page (in browsing history) + // Returns true if successful, false otherwise + bool HistoryBack(); + bool HistoryForward(); + bool HistoryCanBack(); + bool HistoryCanForward(); + // Resets history + void HistoryClear(); + + // Returns pointer to conteiners/cells structure. + // It should be used ONLY when printing + wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;} + + // Adds input filter + static void AddFilter(wxHtmlFilter *filter); + + // Returns a pointer to the parser. + wxHtmlWinParser *GetParser() const { return m_Parser; } + + // Adds HTML processor to this instance of wxHtmlWindow: + void AddProcessor(wxHtmlProcessor *processor); + // Adds HTML processor to wxHtmlWindow class as whole: + static void AddGlobalProcessor(wxHtmlProcessor *processor); + + + // -- Callbacks -- + + // Sets the title of the window + // (depending on the information passed to SetRelatedFrame() method) + virtual void OnSetTitle(const wxString& title); + + // Called when user clicked on hypertext link. Default behavior is to + // call LoadPage(loc) + virtual void OnLinkClicked(const wxHtmlLinkInfo& link); + + // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when + // loading a page or loading an image). The data are downloaded if and only if + // OnOpeningURL returns true. If OnOpeningURL returns wxHTML_REDIRECT, + // it must set *redirect to the new URL + virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type), + const wxString& WXUNUSED(url), + wxString *WXUNUSED(redirect)) const + { return wxHTML_OPEN; } + +#if wxUSE_CLIPBOARD + // Helper functions to select parts of page: + void SelectWord(const wxPoint& pos); + void SelectLine(const wxPoint& pos); + void SelectAll(); + + // Convert selection to text: + wxString SelectionToText() { return DoSelectionToText(m_selection); } + + // Converts current page to text: + wxString ToText(); +#endif // wxUSE_CLIPBOARD + + virtual void OnInternalIdle(); + + /// Returns standard HTML cursor as used by wxHtmlWindow + static wxCursor GetDefaultHTMLCursor(HTMLCursor type); + +protected: + void Init(); + + // Scrolls to anchor of this name. (Anchor is #news + // or #features etc. it is part of address sometimes: + // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news) + // Return value : true if anchor exists, false otherwise + bool ScrollToAnchor(const wxString& anchor); + + // Prepares layout (= fill m_PosX, m_PosY for fragments) based on + // actual size of window. This method also setup scrollbars + void CreateLayout(); + + void OnEraseBackground(wxEraseEvent& event); + void OnPaint(wxPaintEvent& event); + void OnSize(wxSizeEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnMouseDown(wxMouseEvent& event); + void OnMouseUp(wxMouseEvent& event); +#if wxUSE_CLIPBOARD + void OnKeyUp(wxKeyEvent& event); + void OnDoubleClick(wxMouseEvent& event); + void OnCopy(wxCommandEvent& event); + void OnClipboardEvent(wxClipboardTextEvent& event); + void OnMouseEnter(wxMouseEvent& event); + void OnMouseLeave(wxMouseEvent& event); + void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); +#endif // wxUSE_CLIPBOARD + + // Returns new filter (will be stored into m_DefaultFilter variable) + virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;} + + // cleans static variables + static void CleanUpStatics(); + + // Returns true if text selection is enabled (wxClipboard must be available + // and wxHW_NO_SELECTION not used) + bool IsSelectionEnabled() const; + + enum ClipboardType + { + Primary, + Secondary + }; + + // Copies selection to clipboard if the clipboard support is available + // + // returns true if anything was copied to clipboard, false otherwise + bool CopySelection(ClipboardType t = Secondary); + +#if wxUSE_CLIPBOARD + // Automatic scrolling during selection: + void StopAutoScrolling(); +#endif // wxUSE_CLIPBOARD + + wxString DoSelectionToText(wxHtmlSelection *sel); + +public: + // wxHtmlWindowInterface methods: + virtual void SetHTMLWindowTitle(const wxString& title); + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); + virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, + const wxString& url, + wxString *redirect) const; + virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, + const wxPoint& pos) const; + virtual wxWindow* GetHTMLWindow(); + virtual wxColour GetHTMLBackgroundColour() const; + virtual void SetHTMLBackgroundColour(const wxColour& clr); + virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); + virtual void SetHTMLStatusText(const wxString& text); + virtual wxCursor GetHTMLCursor(HTMLCursor type) const; + + // implementation of SetPage() + bool DoSetPage(const wxString& source); + +protected: + // This is pointer to the first cell in parsed data. (Note: the first cell + // is usually top one = all other cells are sub-cells of this one) + wxHtmlContainerCell *m_Cell; + // parser which is used to parse HTML input. + // Each wxHtmlWindow has it's own parser because sharing one global + // parser would be problematic (because of reentrancy) + wxHtmlWinParser *m_Parser; + // contains name of actualy opened page or empty string if no page opened + wxString m_OpenedPage; + // contains name of current anchor within m_OpenedPage + wxString m_OpenedAnchor; + // contains title of actualy opened page or empty string if no <TITLE> tag + wxString m_OpenedPageTitle; + // class for opening files (file system) + wxFileSystem* m_FS; + + wxFrame *m_RelatedFrame; + wxString m_TitleFormat; +#if wxUSE_STATUSBAR + // frame in which page title should be displayed & number of it's statusbar + // reserved for usage with this html window + int m_RelatedStatusBar; +#endif // wxUSE_STATUSBAR + + // borders (free space between text and window borders) + // defaults to 10 pixels. + int m_Borders; + + // current text selection or NULL + wxHtmlSelection *m_selection; + + // true if the user is dragging mouse to select text + bool m_makingSelection; + +#if wxUSE_CLIPBOARD + // time of the last doubleclick event, used to detect tripleclicks + // (tripleclicks are used to select whole line): + wxMilliClock_t m_lastDoubleClick; + + // helper class to automatically scroll the window if the user is selecting + // text and the mouse leaves wxHtmlWindow: + wxHtmlWinAutoScrollTimer *m_timerAutoScroll; +#endif // wxUSE_CLIPBOARD + +private: + // window content for double buffered rendering: + wxBitmap *m_backBuffer; + + // background image, may be invalid + wxBitmap m_bmpBg; + + // variables used when user is selecting text + wxPoint m_tmpSelFromPos; + wxHtmlCell *m_tmpSelFromCell; + + // if >0 contents of the window is not redrawn + // (in order to avoid ugly blinking) + int m_tmpCanDrawLocks; + + // list of HTML filters + static wxList m_Filters; + // this filter is used when no filter is able to read some file + static wxHtmlFilter *m_DefaultFilter; + + // html processors array: + wxHtmlProcessorList *m_Processors; + static wxHtmlProcessorList *m_GlobalProcessors; + + // browser history + wxHtmlHistoryArray *m_History; + int m_HistoryPos; + // if this FLAG is false, items are not added to history + bool m_HistoryOn; + + // a flag set if we need to erase background in OnPaint() (otherwise this + // is supposed to have been done in OnEraseBackground()) + bool m_eraseBgInOnPaint; + + // standard mouse cursors + static wxCursor *ms_cursorLink; + static wxCursor *ms_cursorText; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxHtmlWindow) +}; + + + + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_HTML, + wxEVT_COMMAND_HTML_CELL_CLICKED, 1000) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_HTML, + wxEVT_COMMAND_HTML_CELL_HOVER, 1001) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_HTML, + wxEVT_COMMAND_HTML_LINK_CLICKED, 1002) +END_DECLARE_EVENT_TYPES() + + +/*! + * Html cell window event + */ + +class WXDLLIMPEXP_HTML wxHtmlCellEvent : public wxCommandEvent +{ +public: + wxHtmlCellEvent() {} + wxHtmlCellEvent(wxEventType commandType, int id, + wxHtmlCell *cell, const wxPoint &pt, + const wxMouseEvent &ev) + : wxCommandEvent(commandType, id) + { + m_cell = cell; + m_pt = pt; + m_mouseEvent = ev; + m_bLinkWasClicked = false; + } + + wxHtmlCell* GetCell() const { return m_cell; } + wxPoint GetPoint() const { return m_pt; } + wxMouseEvent GetMouseEvent() const { return m_mouseEvent; } + + void SetLinkClicked(bool linkclicked) { m_bLinkWasClicked=linkclicked; } + bool GetLinkClicked() const { return m_bLinkWasClicked; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxHtmlCellEvent(*this); } + +private: + wxHtmlCell *m_cell; + wxMouseEvent m_mouseEvent; + wxPoint m_pt; + + bool m_bLinkWasClicked; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHtmlCellEvent) +}; + + + +/*! + * Html link event + */ + +class WXDLLIMPEXP_HTML wxHtmlLinkEvent : public wxCommandEvent +{ +public: + wxHtmlLinkEvent() {} + wxHtmlLinkEvent(int id, const wxHtmlLinkInfo &linkinfo) + : wxCommandEvent(wxEVT_COMMAND_HTML_LINK_CLICKED, id) + { + m_linkInfo = linkinfo; + } + + const wxHtmlLinkInfo &GetLinkInfo() const { return m_linkInfo; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxHtmlLinkEvent(*this); } + +private: + wxHtmlLinkInfo m_linkInfo; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHtmlLinkEvent) +}; + + +typedef void (wxEvtHandler::*wxHtmlCellEventFunction)(wxHtmlCellEvent&); +typedef void (wxEvtHandler::*wxHtmlLinkEventFunction)(wxHtmlLinkEvent&); + +#define wxHtmlCellEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHtmlCellEventFunction, &func) +#define wxHtmlLinkEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHtmlLinkEventFunction, &func) + +#define EVT_HTML_CELL_CLICKED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_HTML_CELL_CLICKED, id, wxHtmlCellEventHandler(fn)) +#define EVT_HTML_CELL_HOVER(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_HTML_CELL_HOVER, id, wxHtmlCellEventHandler(fn)) +#define EVT_HTML_LINK_CLICKED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_HTML_LINK_CLICKED, id, wxHtmlLinkEventHandler(fn)) + + +#endif // wxUSE_HTML + +#endif // _WX_HTMLWIN_H_ + diff --git a/Externals/wxWidgets/include/wx/html/htmprint.h b/Externals/wxWidgets/include/wx/html/htmprint.h index ceb3fd9736..ecc93e66e2 100644 --- a/Externals/wxWidgets/include/wx/html/htmprint.h +++ b/Externals/wxWidgets/include/wx/html/htmprint.h @@ -1,298 +1,298 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: htmprint.h -// Purpose: html printing classes -// Author: Vaclav Slavik -// Created: 25/09/99 -// RCS-ID: $Id: htmprint.h 47862 2007-08-03 08:50:49Z JS $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMPRINT_H_ -#define _WX_HTMPRINT_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE - -#include "wx/html/htmlcell.h" -#include "wx/html/winpars.h" -#include "wx/html/htmlfilt.h" - -#include "wx/print.h" -#include "wx/printdlg.h" - -#include <limits.h> // INT_MAX - -//-------------------------------------------------------------------------------- -// wxHtmlDCRenderer -// This class is capable of rendering HTML into specified -// portion of DC -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlDCRenderer : public wxObject -{ -public: - wxHtmlDCRenderer(); - virtual ~wxHtmlDCRenderer(); - - // Following 3 methods *must* be called before any call to Render: - - // Assign DC to this render - void SetDC(wxDC *dc, double pixel_scale = 1.0); - - // Sets size of output rectangle, in pixels. Note that you *can't* change - // width of the rectangle between calls to Render! (You can freely change height.) - void SetSize(int width, int height); - - // Sets the text to be displayed. - // Basepath is base directory (html string would be stored there if it was in - // file). It is used to determine path for loading images, for example. - // isdir is false if basepath is filename, true if it is directory name - // (see wxFileSystem for detailed explanation) - void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = true); - - // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); - - // Sets font sizes to be relative to the given size or the system - // default size; use either specified or default font - void SetStandardFonts(int size = -1, - const wxString& normal_face = wxEmptyString, - const wxString& fixed_face = wxEmptyString); - - // [x,y] is position of upper-left corner of printing rectangle (see SetSize) - // from is y-coordinate of the very first visible cell - // to is y-coordinate of the next following page break, if any - // Returned value is y coordinate of first cell than didn't fit onto page. - // Use this value as 'from' in next call to Render in order to print multiple pages - // document - // If dont_render is TRUE then nothing is rendered into DC and it only counts - // pixels and return y coord of the next page - // - // known_pagebreaks and number_of_pages are used only when counting pages; - // otherwise, their default values should be used. Their purpose is to - // support pagebreaks using a subset of CSS2's <DIV>. The <DIV> handler - // needs to know what pagebreaks have already been set so that it doesn't - // set the same pagebreak twice. - // - // CAUTION! Render() changes DC's user scale and does NOT restore it! - int Render(int x, int y, wxArrayInt& known_pagebreaks, int from = 0, - int dont_render = FALSE, int to = INT_MAX); - - // returns total height of the html document - // (compare Render's return value with this) - int GetTotalHeight(); - -private: - wxDC *m_DC; - wxHtmlWinParser *m_Parser; - wxFileSystem *m_FS; - wxHtmlContainerCell *m_Cells; - int m_MaxWidth, m_Width, m_Height; - - DECLARE_NO_COPY_CLASS(wxHtmlDCRenderer) -}; - - - - - -enum { - wxPAGE_ODD, - wxPAGE_EVEN, - wxPAGE_ALL -}; - - - -//-------------------------------------------------------------------------------- -// wxHtmlPrintout -// This class is derived from standard wxWidgets printout class -// and is used to print HTML documents. -//-------------------------------------------------------------------------------- - - -class WXDLLIMPEXP_HTML wxHtmlPrintout : public wxPrintout -{ -public: - wxHtmlPrintout(const wxString& title = wxT("Printout")); - virtual ~wxHtmlPrintout(); - - void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = true); - // prepares the class for printing this html document. - // Must be called before using the class, in fact just after constructor - // - // basepath is base directory (html string would be stored there if it was in - // file). It is used to determine path for loading images, for example. - // isdir is false if basepath is filename, true if it is directory name - // (see wxFileSystem for detailed explanation) - - void SetHtmlFile(const wxString &htmlfile); - // same as SetHtmlText except that it takes regular file as the parameter - - void SetHeader(const wxString& header, int pg = wxPAGE_ALL); - void SetFooter(const wxString& footer, int pg = wxPAGE_ALL); - // sets header/footer for the document. The argument is interpreted as HTML document. - // You can use macros in it: - // @PAGENUM@ is replaced by page number - // @PAGESCNT@ is replaced by total number of pages - // - // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. - // You can set different header/footer for odd and even pages - - // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); - - // Sets font sizes to be relative to the given size or the system - // default size; use either specified or default font - void SetStandardFonts(int size = -1, - const wxString& normal_face = wxEmptyString, - const wxString& fixed_face = wxEmptyString); - - void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2, - float spaces = 5); - // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space - // between text and header and/or footer - - // wxPrintout stuff: - bool OnPrintPage(int page); - bool HasPage(int page); - void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); - bool OnBeginDocument(int startPage, int endPage); - void OnPreparePrinting(); - - // Adds input filter - static void AddFilter(wxHtmlFilter *filter); - - // Cleanup - static void CleanUpStatics(); - -private: - - void RenderPage(wxDC *dc, int page); - // renders one page into dc - wxString TranslateHeader(const wxString& instr, int page); - // substitute @PAGENUM@ and @PAGESCNT@ by real values - void CountPages(); - // counts pages and fills m_NumPages and m_PageBreaks - - -private: - int m_NumPages; - //int m_PageBreaks[wxHTML_PRINT_MAX_PAGES]; - wxArrayInt m_PageBreaks; - - wxString m_Document, m_BasePath; - bool m_BasePathIsDir; - wxString m_Headers[2], m_Footers[2]; - - int m_HeaderHeight, m_FooterHeight; - wxHtmlDCRenderer *m_Renderer, *m_RendererHdr; - float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace; - - // list of HTML filters - static wxList m_Filters; - - DECLARE_NO_COPY_CLASS(wxHtmlPrintout) -}; - - - - - -//-------------------------------------------------------------------------------- -// wxHtmlEasyPrinting -// This class provides very simple interface to printing -// architecture. It allows you to print HTML documents only -// with very few commands. -// -// Note : do not create this class on stack only. -// You should create an instance on app startup and -// use this instance for all printing. Why? The class -// stores page&printer settings in it. -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlEasyPrinting : public wxObject -{ -public: - wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); - virtual ~wxHtmlEasyPrinting(); - - bool PreviewFile(const wxString &htmlfile); - bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); - // Preview file / html-text for printing - // (and offers printing) - // basepath is base directory for opening subsequent files (e.g. from <img> tag) - - bool PrintFile(const wxString &htmlfile); - bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString); - // Print file / html-text w/o preview - - void PageSetup(); - // pop up printer or page setup dialog - - void SetHeader(const wxString& header, int pg = wxPAGE_ALL); - void SetFooter(const wxString& footer, int pg = wxPAGE_ALL); - // sets header/footer for the document. The argument is interpreted as HTML document. - // You can use macros in it: - // @PAGENUM@ is replaced by page number - // @PAGESCNT@ is replaced by total number of pages - // - // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. - // You can set different header/footer for odd and even pages - - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = 0); - // Sets fonts to be used when displaying HTML page. (if size null then default sizes used) - - // Sets font sizes to be relative to the given size or the system - // default size; use either specified or default font - void SetStandardFonts(int size = -1, - const wxString& normal_face = wxEmptyString, - const wxString& fixed_face = wxEmptyString); - - wxPrintData *GetPrintData(); - wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;} - // return page setting data objects. - // (You can set their parameters.) - -#if wxABI_VERSION >= 20805 - wxWindow* GetParentWindow() const { return m_ParentWindow; } - // get the parent window - void SetParentWindow(wxWindow* window) { m_ParentWindow = window; } - // set the parent window -#endif - -protected: - virtual wxHtmlPrintout *CreatePrintout(); - virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); - virtual bool DoPrint(wxHtmlPrintout *printout); - -private: - wxPrintData *m_PrintData; - wxPageSetupDialogData *m_PageSetupData; - wxString m_Name; - int m_FontsSizesArr[7]; - int *m_FontsSizes; - wxString m_FontFaceFixed, m_FontFaceNormal; - - enum FontMode - { - FontMode_Explicit, - FontMode_Standard - }; - FontMode m_fontMode; - - wxString m_Headers[2], m_Footers[2]; - wxWindow *m_ParentWindow; - - DECLARE_NO_COPY_CLASS(wxHtmlEasyPrinting) -}; - - - - -#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE - -#endif // _WX_HTMPRINT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: htmprint.h +// Purpose: html printing classes +// Author: Vaclav Slavik +// Created: 25/09/99 +// RCS-ID: $Id: htmprint.h 47862 2007-08-03 08:50:49Z JS $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMPRINT_H_ +#define _WX_HTMPRINT_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE + +#include "wx/html/htmlcell.h" +#include "wx/html/winpars.h" +#include "wx/html/htmlfilt.h" + +#include "wx/print.h" +#include "wx/printdlg.h" + +#include <limits.h> // INT_MAX + +//-------------------------------------------------------------------------------- +// wxHtmlDCRenderer +// This class is capable of rendering HTML into specified +// portion of DC +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlDCRenderer : public wxObject +{ +public: + wxHtmlDCRenderer(); + virtual ~wxHtmlDCRenderer(); + + // Following 3 methods *must* be called before any call to Render: + + // Assign DC to this render + void SetDC(wxDC *dc, double pixel_scale = 1.0); + + // Sets size of output rectangle, in pixels. Note that you *can't* change + // width of the rectangle between calls to Render! (You can freely change height.) + void SetSize(int width, int height); + + // Sets the text to be displayed. + // Basepath is base directory (html string would be stored there if it was in + // file). It is used to determine path for loading images, for example. + // isdir is false if basepath is filename, true if it is directory name + // (see wxFileSystem for detailed explanation) + void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = true); + + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + // [x,y] is position of upper-left corner of printing rectangle (see SetSize) + // from is y-coordinate of the very first visible cell + // to is y-coordinate of the next following page break, if any + // Returned value is y coordinate of first cell than didn't fit onto page. + // Use this value as 'from' in next call to Render in order to print multiple pages + // document + // If dont_render is TRUE then nothing is rendered into DC and it only counts + // pixels and return y coord of the next page + // + // known_pagebreaks and number_of_pages are used only when counting pages; + // otherwise, their default values should be used. Their purpose is to + // support pagebreaks using a subset of CSS2's <DIV>. The <DIV> handler + // needs to know what pagebreaks have already been set so that it doesn't + // set the same pagebreak twice. + // + // CAUTION! Render() changes DC's user scale and does NOT restore it! + int Render(int x, int y, wxArrayInt& known_pagebreaks, int from = 0, + int dont_render = FALSE, int to = INT_MAX); + + // returns total height of the html document + // (compare Render's return value with this) + int GetTotalHeight(); + +private: + wxDC *m_DC; + wxHtmlWinParser *m_Parser; + wxFileSystem *m_FS; + wxHtmlContainerCell *m_Cells; + int m_MaxWidth, m_Width, m_Height; + + DECLARE_NO_COPY_CLASS(wxHtmlDCRenderer) +}; + + + + + +enum { + wxPAGE_ODD, + wxPAGE_EVEN, + wxPAGE_ALL +}; + + + +//-------------------------------------------------------------------------------- +// wxHtmlPrintout +// This class is derived from standard wxWidgets printout class +// and is used to print HTML documents. +//-------------------------------------------------------------------------------- + + +class WXDLLIMPEXP_HTML wxHtmlPrintout : public wxPrintout +{ +public: + wxHtmlPrintout(const wxString& title = wxT("Printout")); + virtual ~wxHtmlPrintout(); + + void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = true); + // prepares the class for printing this html document. + // Must be called before using the class, in fact just after constructor + // + // basepath is base directory (html string would be stored there if it was in + // file). It is used to determine path for loading images, for example. + // isdir is false if basepath is filename, true if it is directory name + // (see wxFileSystem for detailed explanation) + + void SetHtmlFile(const wxString &htmlfile); + // same as SetHtmlText except that it takes regular file as the parameter + + void SetHeader(const wxString& header, int pg = wxPAGE_ALL); + void SetFooter(const wxString& footer, int pg = wxPAGE_ALL); + // sets header/footer for the document. The argument is interpreted as HTML document. + // You can use macros in it: + // @PAGENUM@ is replaced by page number + // @PAGESCNT@ is replaced by total number of pages + // + // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. + // You can set different header/footer for odd and even pages + + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2, + float spaces = 5); + // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space + // between text and header and/or footer + + // wxPrintout stuff: + bool OnPrintPage(int page); + bool HasPage(int page); + void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); + bool OnBeginDocument(int startPage, int endPage); + void OnPreparePrinting(); + + // Adds input filter + static void AddFilter(wxHtmlFilter *filter); + + // Cleanup + static void CleanUpStatics(); + +private: + + void RenderPage(wxDC *dc, int page); + // renders one page into dc + wxString TranslateHeader(const wxString& instr, int page); + // substitute @PAGENUM@ and @PAGESCNT@ by real values + void CountPages(); + // counts pages and fills m_NumPages and m_PageBreaks + + +private: + int m_NumPages; + //int m_PageBreaks[wxHTML_PRINT_MAX_PAGES]; + wxArrayInt m_PageBreaks; + + wxString m_Document, m_BasePath; + bool m_BasePathIsDir; + wxString m_Headers[2], m_Footers[2]; + + int m_HeaderHeight, m_FooterHeight; + wxHtmlDCRenderer *m_Renderer, *m_RendererHdr; + float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace; + + // list of HTML filters + static wxList m_Filters; + + DECLARE_NO_COPY_CLASS(wxHtmlPrintout) +}; + + + + + +//-------------------------------------------------------------------------------- +// wxHtmlEasyPrinting +// This class provides very simple interface to printing +// architecture. It allows you to print HTML documents only +// with very few commands. +// +// Note : do not create this class on stack only. +// You should create an instance on app startup and +// use this instance for all printing. Why? The class +// stores page&printer settings in it. +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlEasyPrinting : public wxObject +{ +public: + wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); + virtual ~wxHtmlEasyPrinting(); + + bool PreviewFile(const wxString &htmlfile); + bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + // Preview file / html-text for printing + // (and offers printing) + // basepath is base directory for opening subsequent files (e.g. from <img> tag) + + bool PrintFile(const wxString &htmlfile); + bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + // Print file / html-text w/o preview + + void PageSetup(); + // pop up printer or page setup dialog + + void SetHeader(const wxString& header, int pg = wxPAGE_ALL); + void SetFooter(const wxString& footer, int pg = wxPAGE_ALL); + // sets header/footer for the document. The argument is interpreted as HTML document. + // You can use macros in it: + // @PAGENUM@ is replaced by page number + // @PAGESCNT@ is replaced by total number of pages + // + // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. + // You can set different header/footer for odd and even pages + + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = 0); + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used) + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + wxPrintData *GetPrintData(); + wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;} + // return page setting data objects. + // (You can set their parameters.) + +#if wxABI_VERSION >= 20805 + wxWindow* GetParentWindow() const { return m_ParentWindow; } + // get the parent window + void SetParentWindow(wxWindow* window) { m_ParentWindow = window; } + // set the parent window +#endif + +protected: + virtual wxHtmlPrintout *CreatePrintout(); + virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); + virtual bool DoPrint(wxHtmlPrintout *printout); + +private: + wxPrintData *m_PrintData; + wxPageSetupDialogData *m_PageSetupData; + wxString m_Name; + int m_FontsSizesArr[7]; + int *m_FontsSizes; + wxString m_FontFaceFixed, m_FontFaceNormal; + + enum FontMode + { + FontMode_Explicit, + FontMode_Standard + }; + FontMode m_fontMode; + + wxString m_Headers[2], m_Footers[2]; + wxWindow *m_ParentWindow; + + DECLARE_NO_COPY_CLASS(wxHtmlEasyPrinting) +}; + + + + +#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_HTMPRINT_H_ + diff --git a/Externals/wxWidgets/include/wx/html/m_templ.h b/Externals/wxWidgets/include/wx/html/m_templ.h index 9f5e616c84..d75346c65c 100644 --- a/Externals/wxWidgets/include/wx/html/m_templ.h +++ b/Externals/wxWidgets/include/wx/html/m_templ.h @@ -1,84 +1,84 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: m_templ.h -// Purpose: Modules template file -// Author: Vaclav Slavik -// RCS-ID: $Id: m_templ.h 30098 2004-10-26 10:32:38Z VS $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - -DESCRIPTION: -This is set of macros for easier writing of tag handlers. How to use it? -See mod_fonts.cpp for example... - -Attention! This is quite strange C++ bastard. Before using it, -I STRONGLY recommend reading and understanding these macros!! - -*/ - - -#ifndef _WX_M_TEMPL_H_ -#define _WX_M_TEMPL_H_ - -#include "wx/defs.h" - -#if wxUSE_HTML - -#include "wx/html/winpars.h" - -#define TAG_HANDLER_BEGIN(name,tags) \ - class wxHTML_Handler_##name : public wxHtmlWinTagHandler \ - { \ - public: \ - wxString GetSupportedTags() {return wxT(tags);} - - - -#define TAG_HANDLER_VARS \ - private: - -#define TAG_HANDLER_CONSTR(name) \ - public: \ - wxHTML_Handler_##name () : wxHtmlWinTagHandler() - - -#define TAG_HANDLER_PROC(varib) \ - public: \ - bool HandleTag(const wxHtmlTag& varib) - - - -#define TAG_HANDLER_END(name) \ - }; - - - - -#define TAGS_MODULE_BEGIN(name) \ - class wxHTML_Module##name : public wxHtmlTagsModule \ - { \ - DECLARE_DYNAMIC_CLASS(wxHTML_Module##name ) \ - public: \ - void FillHandlersTable(wxHtmlWinParser *parser) \ - { - - - - -#define TAGS_MODULE_ADD(handler) \ - parser->AddTagHandler(new wxHTML_Handler_##handler); - - - - -#define TAGS_MODULE_END(name) \ - } \ - }; \ - IMPLEMENT_DYNAMIC_CLASS(wxHTML_Module##name , wxHtmlTagsModule) - - - -#endif -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: m_templ.h +// Purpose: Modules template file +// Author: Vaclav Slavik +// RCS-ID: $Id: m_templ.h 30098 2004-10-26 10:32:38Z VS $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + +DESCRIPTION: +This is set of macros for easier writing of tag handlers. How to use it? +See mod_fonts.cpp for example... + +Attention! This is quite strange C++ bastard. Before using it, +I STRONGLY recommend reading and understanding these macros!! + +*/ + + +#ifndef _WX_M_TEMPL_H_ +#define _WX_M_TEMPL_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/html/winpars.h" + +#define TAG_HANDLER_BEGIN(name,tags) \ + class wxHTML_Handler_##name : public wxHtmlWinTagHandler \ + { \ + public: \ + wxString GetSupportedTags() {return wxT(tags);} + + + +#define TAG_HANDLER_VARS \ + private: + +#define TAG_HANDLER_CONSTR(name) \ + public: \ + wxHTML_Handler_##name () : wxHtmlWinTagHandler() + + +#define TAG_HANDLER_PROC(varib) \ + public: \ + bool HandleTag(const wxHtmlTag& varib) + + + +#define TAG_HANDLER_END(name) \ + }; + + + + +#define TAGS_MODULE_BEGIN(name) \ + class wxHTML_Module##name : public wxHtmlTagsModule \ + { \ + DECLARE_DYNAMIC_CLASS(wxHTML_Module##name ) \ + public: \ + void FillHandlersTable(wxHtmlWinParser *parser) \ + { + + + + +#define TAGS_MODULE_ADD(handler) \ + parser->AddTagHandler(new wxHTML_Handler_##handler); + + + + +#define TAGS_MODULE_END(name) \ + } \ + }; \ + IMPLEMENT_DYNAMIC_CLASS(wxHTML_Module##name , wxHtmlTagsModule) + + + +#endif +#endif diff --git a/Externals/wxWidgets/include/wx/html/webkit.h b/Externals/wxWidgets/include/wx/html/webkit.h index 28586e0208..16bd4fdf0e 100644 --- a/Externals/wxWidgets/include/wx/html/webkit.h +++ b/Externals/wxWidgets/include/wx/html/webkit.h @@ -1,231 +1,231 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/html/webkit.h -// Purpose: wxWebKitCtrl - embeddable web kit control -// Author: Jethro Grassie / Kevin Ollivier -// Modified by: -// Created: 2004-4-16 -// RCS-ID: $Id: webkit.h 53798 2008-05-28 06:12:34Z RD $ -// Copyright: (c) Jethro Grassie / Kevin Ollivier -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WEBKIT_H -#define _WX_WEBKIT_H - -#if wxUSE_WEBKIT - -#if !defined(__WXMAC__) && !defined(__WXCOCOA__) -#error "wxWebKitCtrl not implemented for this platform" -#endif - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// Web Kit Control -// ---------------------------------------------------------------------------- - -class wxWebKitCtrl : public wxControl -{ -public: - DECLARE_DYNAMIC_CLASS(wxWebKitCtrl) - - wxWebKitCtrl() {}; - wxWebKitCtrl(wxWindow *parent, - wxWindowID winID, - const wxString& strURL, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("webkitctrl")) - { - Create(parent, winID, strURL, pos, size, style, validator, name); - }; - bool Create(wxWindow *parent, - wxWindowID winID, - const wxString& strURL, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("webkitctrl")); - virtual ~wxWebKitCtrl(); - - void LoadURL(const wxString &url); - - bool CanGoBack(); - bool CanGoForward(); - bool GoBack(); - bool GoForward(); - void Reload(); - void Stop(); - bool CanGetPageSource(); - wxString GetPageSource(); - void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString); - wxString GetPageURL(){ return m_currentURL; } - void SetPageTitle(const wxString& title) { m_pageTitle = title; } - wxString GetPageTitle(){ return m_pageTitle; } - - // since these worked in 2.6, add wrappers - void SetTitle(const wxString& title) { SetPageTitle(title); } - wxString GetTitle() { return GetPageTitle(); } - - wxString GetSelection(); - - bool CanIncreaseTextSize(); - void IncreaseTextSize(); - bool CanDecreaseTextSize(); - void DecreaseTextSize(); - - void Print(bool showPrompt=FALSE); - - void MakeEditable(bool enable=TRUE); - bool IsEditable(); - - wxString RunScript(const wxString& javascript); - - void SetScrollPos(int pos); - int GetScrollPos(); - - //we need to resize the webview when the control size changes - void OnSize(wxSizeEvent &event); - void OnMove(wxMoveEvent &event); - void OnMouseEvents(wxMouseEvent &event); -protected: - DECLARE_EVENT_TABLE() - void MacVisibilityChanged(); - -private: - wxWindow *m_parent; - wxWindowID m_windowID; - wxString m_currentURL; - wxString m_pageTitle; - - struct objc_object *m_webView; - - // we may use this later to setup our own mouse events, - // so leave it in for now. - void* m_webKitCtrlEventHandler; - //It should be WebView*, but WebView is an Objective-C class - //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this. -}; - -// ---------------------------------------------------------------------------- -// Web Kit Events -// ---------------------------------------------------------------------------- - -enum { - wxWEBKIT_STATE_START = 1, - wxWEBKIT_STATE_NEGOTIATING = 2, - wxWEBKIT_STATE_REDIRECTING = 4, - wxWEBKIT_STATE_TRANSFERRING = 8, - wxWEBKIT_STATE_STOP = 16, - wxWEBKIT_STATE_FAILED = 32 -}; - -enum { - wxWEBKIT_NAV_LINK_CLICKED = 1, - wxWEBKIT_NAV_BACK_NEXT = 2, - wxWEBKIT_NAV_FORM_SUBMITTED = 4, - wxWEBKIT_NAV_RELOAD = 8, - wxWEBKIT_NAV_FORM_RESUBMITTED = 16, - wxWEBKIT_NAV_OTHER = 32 - -}; - - - -class wxWebKitBeforeLoadEvent : public wxCommandEvent -{ - DECLARE_DYNAMIC_CLASS( wxWebKitBeforeLoadEvent ) - -public: - bool IsCancelled() { return m_cancelled; } - void Cancel(bool cancel = true) { m_cancelled = cancel; } - wxString GetURL() { return m_url; } - void SetURL(const wxString& url) { m_url = url; } - void SetNavigationType(int navType) { m_navType = navType; } - int GetNavigationType() { return m_navType; } - - wxWebKitBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ); - wxEvent *Clone(void) const { return new wxWebKitBeforeLoadEvent(*this); } - -protected: - bool m_cancelled; - wxString m_url; - int m_navType; -}; - -class wxWebKitStateChangedEvent : public wxCommandEvent -{ - DECLARE_DYNAMIC_CLASS( wxWebKitStateChangedEvent ) - -public: - int GetState() { return m_state; } - void SetState(const int state) { m_state = state; } - wxString GetURL() { return m_url; } - void SetURL(const wxString& url) { m_url = url; } - - wxWebKitStateChangedEvent( wxWindow* win = (wxWindow*) NULL ); - wxEvent *Clone(void) const { return new wxWebKitStateChangedEvent(*this); } - -protected: - int m_state; - wxString m_url; -}; - - -#if wxABI_VERSION >= 20808 -class wxWebKitNewWindowEvent : public wxCommandEvent -{ - DECLARE_DYNAMIC_CLASS( wxWebViewNewWindowEvent ) -public: - wxString GetURL() const { return m_url; } - void SetURL(const wxString& url) { m_url = url; } - wxString GetTargetName() const { return m_targetName; } - void SetTargetName(const wxString& name) { m_targetName = name; } - - wxWebKitNewWindowEvent( wxWindow* win = (wxWindow*)(NULL)); - wxEvent *Clone(void) const { return new wxWebKitNewWindowEvent(*this); } - -private: - wxString m_url; - wxString m_targetName; -}; -#endif - -typedef void (wxEvtHandler::*wxWebKitStateChangedEventFunction)(wxWebKitStateChangedEvent&); -typedef void (wxEvtHandler::*wxWebKitBeforeLoadEventFunction)(wxWebKitBeforeLoadEvent&); -typedef void (wxEvtHandler::*wxWebKitNewWindowEventFunction)(wxWebKitNewWindowEvent&); - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_BEFORE_LOAD, wxID_ANY) - DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_STATE_CHANGED, wxID_ANY) - DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_NEW_WINDOW, wxID_ANY) -END_DECLARE_EVENT_TYPES() - -#define EVT_WEBKIT_STATE_CHANGED(func) \ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_STATE_CHANGED, \ - wxID_ANY, \ - wxID_ANY, \ - (wxObjectEventFunction) \ - (wxWebKitStateChangedEventFunction) & func, \ - (wxObject *) NULL ), - -#define EVT_WEBKIT_BEFORE_LOAD(func) \ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_BEFORE_LOAD, \ - wxID_ANY, \ - wxID_ANY, \ - (wxObjectEventFunction) \ - (wxWebKitBeforeLoadEventFunction) & func, \ - (wxObject *) NULL ), - -#define EVT_WEBKIT_NEW_WINDOW(func) \ - DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_NEW_WINDOW, \ - wxID_ANY, \ - wxID_ANY, \ - (wxObjectEventFunction) \ - (wxWebKitNewWindowEventFunction) & func, \ - (wxObject *) NULL ), -#endif // wxUSE_WEBKIT - -#endif - // _WX_WEBKIT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/webkit.h +// Purpose: wxWebKitCtrl - embeddable web kit control +// Author: Jethro Grassie / Kevin Ollivier +// Modified by: +// Created: 2004-4-16 +// RCS-ID: $Id: webkit.h 53798 2008-05-28 06:12:34Z RD $ +// Copyright: (c) Jethro Grassie / Kevin Ollivier +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBKIT_H +#define _WX_WEBKIT_H + +#if wxUSE_WEBKIT + +#if !defined(__WXMAC__) && !defined(__WXCOCOA__) +#error "wxWebKitCtrl not implemented for this platform" +#endif + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// Web Kit Control +// ---------------------------------------------------------------------------- + +class wxWebKitCtrl : public wxControl +{ +public: + DECLARE_DYNAMIC_CLASS(wxWebKitCtrl) + + wxWebKitCtrl() {}; + wxWebKitCtrl(wxWindow *parent, + wxWindowID winID, + const wxString& strURL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("webkitctrl")) + { + Create(parent, winID, strURL, pos, size, style, validator, name); + }; + bool Create(wxWindow *parent, + wxWindowID winID, + const wxString& strURL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("webkitctrl")); + virtual ~wxWebKitCtrl(); + + void LoadURL(const wxString &url); + + bool CanGoBack(); + bool CanGoForward(); + bool GoBack(); + bool GoForward(); + void Reload(); + void Stop(); + bool CanGetPageSource(); + wxString GetPageSource(); + void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString); + wxString GetPageURL(){ return m_currentURL; } + void SetPageTitle(const wxString& title) { m_pageTitle = title; } + wxString GetPageTitle(){ return m_pageTitle; } + + // since these worked in 2.6, add wrappers + void SetTitle(const wxString& title) { SetPageTitle(title); } + wxString GetTitle() { return GetPageTitle(); } + + wxString GetSelection(); + + bool CanIncreaseTextSize(); + void IncreaseTextSize(); + bool CanDecreaseTextSize(); + void DecreaseTextSize(); + + void Print(bool showPrompt=FALSE); + + void MakeEditable(bool enable=TRUE); + bool IsEditable(); + + wxString RunScript(const wxString& javascript); + + void SetScrollPos(int pos); + int GetScrollPos(); + + //we need to resize the webview when the control size changes + void OnSize(wxSizeEvent &event); + void OnMove(wxMoveEvent &event); + void OnMouseEvents(wxMouseEvent &event); +protected: + DECLARE_EVENT_TABLE() + void MacVisibilityChanged(); + +private: + wxWindow *m_parent; + wxWindowID m_windowID; + wxString m_currentURL; + wxString m_pageTitle; + + struct objc_object *m_webView; + + // we may use this later to setup our own mouse events, + // so leave it in for now. + void* m_webKitCtrlEventHandler; + //It should be WebView*, but WebView is an Objective-C class + //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this. +}; + +// ---------------------------------------------------------------------------- +// Web Kit Events +// ---------------------------------------------------------------------------- + +enum { + wxWEBKIT_STATE_START = 1, + wxWEBKIT_STATE_NEGOTIATING = 2, + wxWEBKIT_STATE_REDIRECTING = 4, + wxWEBKIT_STATE_TRANSFERRING = 8, + wxWEBKIT_STATE_STOP = 16, + wxWEBKIT_STATE_FAILED = 32 +}; + +enum { + wxWEBKIT_NAV_LINK_CLICKED = 1, + wxWEBKIT_NAV_BACK_NEXT = 2, + wxWEBKIT_NAV_FORM_SUBMITTED = 4, + wxWEBKIT_NAV_RELOAD = 8, + wxWEBKIT_NAV_FORM_RESUBMITTED = 16, + wxWEBKIT_NAV_OTHER = 32 + +}; + + + +class wxWebKitBeforeLoadEvent : public wxCommandEvent +{ + DECLARE_DYNAMIC_CLASS( wxWebKitBeforeLoadEvent ) + +public: + bool IsCancelled() { return m_cancelled; } + void Cancel(bool cancel = true) { m_cancelled = cancel; } + wxString GetURL() { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + void SetNavigationType(int navType) { m_navType = navType; } + int GetNavigationType() { return m_navType; } + + wxWebKitBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebKitBeforeLoadEvent(*this); } + +protected: + bool m_cancelled; + wxString m_url; + int m_navType; +}; + +class wxWebKitStateChangedEvent : public wxCommandEvent +{ + DECLARE_DYNAMIC_CLASS( wxWebKitStateChangedEvent ) + +public: + int GetState() { return m_state; } + void SetState(const int state) { m_state = state; } + wxString GetURL() { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + + wxWebKitStateChangedEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebKitStateChangedEvent(*this); } + +protected: + int m_state; + wxString m_url; +}; + + +#if wxABI_VERSION >= 20808 +class wxWebKitNewWindowEvent : public wxCommandEvent +{ + DECLARE_DYNAMIC_CLASS( wxWebViewNewWindowEvent ) +public: + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + wxString GetTargetName() const { return m_targetName; } + void SetTargetName(const wxString& name) { m_targetName = name; } + + wxWebKitNewWindowEvent( wxWindow* win = (wxWindow*)(NULL)); + wxEvent *Clone(void) const { return new wxWebKitNewWindowEvent(*this); } + +private: + wxString m_url; + wxString m_targetName; +}; +#endif + +typedef void (wxEvtHandler::*wxWebKitStateChangedEventFunction)(wxWebKitStateChangedEvent&); +typedef void (wxEvtHandler::*wxWebKitBeforeLoadEventFunction)(wxWebKitBeforeLoadEvent&); +typedef void (wxEvtHandler::*wxWebKitNewWindowEventFunction)(wxWebKitNewWindowEvent&); + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_BEFORE_LOAD, wxID_ANY) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_STATE_CHANGED, wxID_ANY) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_NEW_WINDOW, wxID_ANY) +END_DECLARE_EVENT_TYPES() + +#define EVT_WEBKIT_STATE_CHANGED(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_STATE_CHANGED, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebKitStateChangedEventFunction) & func, \ + (wxObject *) NULL ), + +#define EVT_WEBKIT_BEFORE_LOAD(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_BEFORE_LOAD, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebKitBeforeLoadEventFunction) & func, \ + (wxObject *) NULL ), + +#define EVT_WEBKIT_NEW_WINDOW(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_NEW_WINDOW, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebKitNewWindowEventFunction) & func, \ + (wxObject *) NULL ), +#endif // wxUSE_WEBKIT + +#endif + // _WX_WEBKIT_H_ diff --git a/Externals/wxWidgets/include/wx/html/winpars.h b/Externals/wxWidgets/include/wx/html/winpars.h index def2614e93..14d5d05628 100644 --- a/Externals/wxWidgets/include/wx/html/winpars.h +++ b/Externals/wxWidgets/include/wx/html/winpars.h @@ -1,303 +1,303 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: winpars.h -// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow) -// Author: Vaclav Slavik -// RCS-ID: $Id: winpars.h 53457 2008-05-05 10:53:58Z VS $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WINPARS_H_ -#define _WX_WINPARS_H_ - -#include "wx/defs.h" -#if wxUSE_HTML - -#include "wx/module.h" -#include "wx/font.h" -#include "wx/html/htmlpars.h" -#include "wx/html/htmlcell.h" -#include "wx/encconv.h" - -class WXDLLIMPEXP_FWD_HTML wxHtmlWindow; -class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface; -class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; -class WXDLLIMPEXP_FWD_HTML wxHtmlWinTagHandler; -class WXDLLIMPEXP_FWD_HTML wxHtmlTagsModule; - - -//-------------------------------------------------------------------------------- -// wxHtmlWinParser -// This class is derived from wxHtmlParser and its mail goal -// is to parse HTML input so that it can be displayed in -// wxHtmlWindow. It uses special wxHtmlWinTagHandler. -//-------------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlWinParser : public wxHtmlParser -{ - DECLARE_ABSTRACT_CLASS(wxHtmlWinParser) - friend class wxHtmlWindow; - -public: - wxHtmlWinParser(wxHtmlWindowInterface *wndIface = NULL); - - virtual ~wxHtmlWinParser(); - - virtual void InitParser(const wxString& source); - virtual void DoneParser(); - virtual wxObject* GetProduct(); - - virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const; - - // Set's the DC used for parsing. If SetDC() is not called, - // parsing won't proceed - virtual void SetDC(wxDC *dc, double pixel_scale = 1.0) - { m_DC = dc; m_PixelScale = pixel_scale; } - - wxDC *GetDC() {return m_DC;} - double GetPixelScale() {return m_PixelScale;} - int GetCharHeight() const {return m_CharHeight;} - int GetCharWidth() const {return m_CharWidth;} - - // NOTE : these functions do _not_ return _actual_ - // height/width. They return h/w of default font - // for this DC. If you want actual values, call - // GetDC()->GetChar...() - - // returns interface to the rendering window - wxHtmlWindowInterface *GetWindowInterface() {return m_windowInterface;} -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetWindowInterface()->GetHTMLWindow() instead - wxDEPRECATED( wxHtmlWindow *GetWindow() ); -#endif - - // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); - - // Sets font sizes to be relative to the given size or the system - // default size; use either specified or default font - void SetStandardFonts(int size = -1, - const wxString& normal_face = wxEmptyString, - const wxString& fixed_face = wxEmptyString); - - // Adds tags module. see wxHtmlTagsModule for details. - static void AddModule(wxHtmlTagsModule *module); - - static void RemoveModule(wxHtmlTagsModule *module); - - // parsing-related methods. These methods are called by tag handlers: - - // Returns pointer to actual container. Common use in tag handler is : - // m_WParser->GetContainer()->InsertCell(new ...); - wxHtmlContainerCell *GetContainer() const {return m_Container;} - - // opens new container. This container is sub-container of opened - // container. Sets GetContainer to newly created container - // and returns it. - wxHtmlContainerCell *OpenContainer(); - - // works like OpenContainer except that new container is not created - // but c is used. You can use this to directly set actual container - wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c); - - // closes the container and sets actual Container to upper-level - // container - wxHtmlContainerCell *CloseContainer(); - - int GetFontSize() const {return m_FontSize;} - void SetFontSize(int s); - int GetFontBold() const {return m_FontBold;} - void SetFontBold(int x) {m_FontBold = x;} - int GetFontItalic() const {return m_FontItalic;} - void SetFontItalic(int x) {m_FontItalic = x;} - int GetFontUnderlined() const {return m_FontUnderlined;} - void SetFontUnderlined(int x) {m_FontUnderlined = x;} - int GetFontFixed() const {return m_FontFixed;} - void SetFontFixed(int x) {m_FontFixed = x;} - wxString GetFontFace() const {return GetFontFixed() ? m_FontFaceFixed : m_FontFaceNormal;} - void SetFontFace(const wxString& face); - - int GetAlign() const {return m_Align;} - void SetAlign(int a) {m_Align = a;} - - wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } - void SetScriptMode(wxHtmlScriptMode mode) { m_ScriptMode = mode; } - long GetScriptBaseline() const { return m_ScriptBaseline; } - void SetScriptBaseline(long base) { m_ScriptBaseline = base; } - - const wxColour& GetLinkColor() const { return m_LinkColor; } - void SetLinkColor(const wxColour& clr) { m_LinkColor = clr; } - const wxColour& GetActualColor() const { return m_ActualColor; } - void SetActualColor(const wxColour& clr) { m_ActualColor = clr ;} - const wxHtmlLinkInfo& GetLink() const { return m_Link; } - void SetLink(const wxHtmlLinkInfo& link); - - // applies current parser state (link, sub/supscript, ...) to given cell - void ApplyStateToCell(wxHtmlCell *cell); - -#if !wxUSE_UNICODE - void SetInputEncoding(wxFontEncoding enc); - wxFontEncoding GetInputEncoding() const { return m_InputEnc; } - wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; } - wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; } -#endif - - // creates font depending on m_Font* members. - virtual wxFont* CreateCurrentFont(); - -#if wxABI_VERSION >= 20808 - enum WhitespaceMode - { - Whitespace_Normal, // normal mode, collapse whitespace - Whitespace_Pre // inside <pre>, keep whitespace as-is - }; - - // change the current whitespace handling mode - void SetWhitespaceMode(WhitespaceMode mode); - WhitespaceMode GetWhitespaceMode() const; -#endif // wxABI_VERSION >= 20808 - -protected: - virtual void AddText(const wxChar* txt); - -private: - void FlushWordBuf(wxChar *temp, int& templen, wxChar nbsp); - void AddWord(wxHtmlWordCell *c); - void AddWord(const wxString& word); - void AddPreBlock(const wxString& text); - - bool m_tmpLastWasSpace; - wxChar *m_tmpStrBuf; - size_t m_tmpStrBufSize; - // temporary variables used by AddText - wxHtmlWindowInterface *m_windowInterface; - // window we're parsing for - double m_PixelScale; - wxDC *m_DC; - // Device Context we're parsing for - static wxList m_Modules; - // list of tags modules (see wxHtmlTagsModule for details) - // This list is used to initialize m_Handlers member. - - wxHtmlContainerCell *m_Container; - // current container. See Open/CloseContainer for details. - - int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not true,false but 1,0, we need it for indexing - int m_FontSize; /* -2 to +4, 0 is default */ - wxColour m_LinkColor; - wxColour m_ActualColor; - // basic font parameters. - wxHtmlLinkInfo m_Link; - // actual hypertext link or empty string - bool m_UseLink; - // true if m_Link is not empty - long m_CharHeight, m_CharWidth; - // average height of normal-sized text - int m_Align; - // actual alignment - wxHtmlScriptMode m_ScriptMode; - // current script mode (sub/sup/normal) - long m_ScriptBaseline; - // current sub/supscript base - - wxFont* m_FontsTable[2][2][2][2][7]; - wxString m_FontsFacesTable[2][2][2][2][7]; -#if !wxUSE_UNICODE - wxFontEncoding m_FontsEncTable[2][2][2][2][7]; -#endif - // table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off - // state of these flags (from left to right): - // [bold][italic][underlined][fixed_size] - // last index is font size : from 0 to 6 (remapped from html sizes 1 to 7) - // Note : this table covers all possible combinations of fonts, but not - // all of them are used, so many items in table are usually NULL. - int m_FontsSizes[7]; - wxString m_FontFaceFixed, m_FontFaceNormal; - // html font sizes and faces of fixed and proportional fonts - -#if !wxUSE_UNICODE - wxFontEncoding m_InputEnc, m_OutputEnc; - // I/O font encodings - wxEncodingConverter *m_EncConv; -#endif - - struct TextParsingState - { - // current whitespace handling mode - WhitespaceMode m_whitespaceMode; - - wxHtmlWordCell *m_lastWordCell; - - // current position on line, in num. of characters; used to properly - // expand TABs; only updated while inside <pre> - int m_posColumn; - }; - - // NB: this pointer replaces m_lastWordCell pointer in wx<=2.8.7; this - // way, wxHtmlWinParser remains ABI compatible with older versions - // despite addition of two fields in TextParsingState - TextParsingState *m_textParsingState; - - DECLARE_NO_COPY_CLASS(wxHtmlWinParser) -}; - - - - - - -//----------------------------------------------------------------------------- -// wxHtmlWinTagHandler -// This is basicly wxHtmlTagHandler except -// it is extended with protected member m_Parser pointing to -// the wxHtmlWinParser object -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlWinTagHandler : public wxHtmlTagHandler -{ - DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler) - -public: - wxHtmlWinTagHandler() : wxHtmlTagHandler() {} - - virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;} - -protected: - wxHtmlWinParser *m_WParser; // same as m_Parser, but overcasted - - DECLARE_NO_COPY_CLASS(wxHtmlWinTagHandler) -}; - - - - - - -//---------------------------------------------------------------------------- -// wxHtmlTagsModule -// This is basic of dynamic tag handlers binding. -// The class provides methods for filling parser's handlers -// hash table. -// (See documentation for details) -//---------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlTagsModule : public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule) - -public: - wxHtmlTagsModule() : wxModule() {} - - virtual bool OnInit(); - virtual void OnExit(); - - // This is called by wxHtmlWinParser. - // The method must simply call parser->AddTagHandler(new - // <handler_class_name>); for each handler - virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { } -}; - - -#endif - -#endif // _WX_WINPARS_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: winpars.h +// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow) +// Author: Vaclav Slavik +// RCS-ID: $Id: winpars.h 53457 2008-05-05 10:53:58Z VS $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINPARS_H_ +#define _WX_WINPARS_H_ + +#include "wx/defs.h" +#if wxUSE_HTML + +#include "wx/module.h" +#include "wx/font.h" +#include "wx/html/htmlpars.h" +#include "wx/html/htmlcell.h" +#include "wx/encconv.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlWindow; +class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinTagHandler; +class WXDLLIMPEXP_FWD_HTML wxHtmlTagsModule; + + +//-------------------------------------------------------------------------------- +// wxHtmlWinParser +// This class is derived from wxHtmlParser and its mail goal +// is to parse HTML input so that it can be displayed in +// wxHtmlWindow. It uses special wxHtmlWinTagHandler. +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWinParser : public wxHtmlParser +{ + DECLARE_ABSTRACT_CLASS(wxHtmlWinParser) + friend class wxHtmlWindow; + +public: + wxHtmlWinParser(wxHtmlWindowInterface *wndIface = NULL); + + virtual ~wxHtmlWinParser(); + + virtual void InitParser(const wxString& source); + virtual void DoneParser(); + virtual wxObject* GetProduct(); + + virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const; + + // Set's the DC used for parsing. If SetDC() is not called, + // parsing won't proceed + virtual void SetDC(wxDC *dc, double pixel_scale = 1.0) + { m_DC = dc; m_PixelScale = pixel_scale; } + + wxDC *GetDC() {return m_DC;} + double GetPixelScale() {return m_PixelScale;} + int GetCharHeight() const {return m_CharHeight;} + int GetCharWidth() const {return m_CharWidth;} + + // NOTE : these functions do _not_ return _actual_ + // height/width. They return h/w of default font + // for this DC. If you want actual values, call + // GetDC()->GetChar...() + + // returns interface to the rendering window + wxHtmlWindowInterface *GetWindowInterface() {return m_windowInterface;} +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, use GetWindowInterface()->GetHTMLWindow() instead + wxDEPRECATED( wxHtmlWindow *GetWindow() ); +#endif + + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + // Adds tags module. see wxHtmlTagsModule for details. + static void AddModule(wxHtmlTagsModule *module); + + static void RemoveModule(wxHtmlTagsModule *module); + + // parsing-related methods. These methods are called by tag handlers: + + // Returns pointer to actual container. Common use in tag handler is : + // m_WParser->GetContainer()->InsertCell(new ...); + wxHtmlContainerCell *GetContainer() const {return m_Container;} + + // opens new container. This container is sub-container of opened + // container. Sets GetContainer to newly created container + // and returns it. + wxHtmlContainerCell *OpenContainer(); + + // works like OpenContainer except that new container is not created + // but c is used. You can use this to directly set actual container + wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c); + + // closes the container and sets actual Container to upper-level + // container + wxHtmlContainerCell *CloseContainer(); + + int GetFontSize() const {return m_FontSize;} + void SetFontSize(int s); + int GetFontBold() const {return m_FontBold;} + void SetFontBold(int x) {m_FontBold = x;} + int GetFontItalic() const {return m_FontItalic;} + void SetFontItalic(int x) {m_FontItalic = x;} + int GetFontUnderlined() const {return m_FontUnderlined;} + void SetFontUnderlined(int x) {m_FontUnderlined = x;} + int GetFontFixed() const {return m_FontFixed;} + void SetFontFixed(int x) {m_FontFixed = x;} + wxString GetFontFace() const {return GetFontFixed() ? m_FontFaceFixed : m_FontFaceNormal;} + void SetFontFace(const wxString& face); + + int GetAlign() const {return m_Align;} + void SetAlign(int a) {m_Align = a;} + + wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } + void SetScriptMode(wxHtmlScriptMode mode) { m_ScriptMode = mode; } + long GetScriptBaseline() const { return m_ScriptBaseline; } + void SetScriptBaseline(long base) { m_ScriptBaseline = base; } + + const wxColour& GetLinkColor() const { return m_LinkColor; } + void SetLinkColor(const wxColour& clr) { m_LinkColor = clr; } + const wxColour& GetActualColor() const { return m_ActualColor; } + void SetActualColor(const wxColour& clr) { m_ActualColor = clr ;} + const wxHtmlLinkInfo& GetLink() const { return m_Link; } + void SetLink(const wxHtmlLinkInfo& link); + + // applies current parser state (link, sub/supscript, ...) to given cell + void ApplyStateToCell(wxHtmlCell *cell); + +#if !wxUSE_UNICODE + void SetInputEncoding(wxFontEncoding enc); + wxFontEncoding GetInputEncoding() const { return m_InputEnc; } + wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; } + wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; } +#endif + + // creates font depending on m_Font* members. + virtual wxFont* CreateCurrentFont(); + +#if wxABI_VERSION >= 20808 + enum WhitespaceMode + { + Whitespace_Normal, // normal mode, collapse whitespace + Whitespace_Pre // inside <pre>, keep whitespace as-is + }; + + // change the current whitespace handling mode + void SetWhitespaceMode(WhitespaceMode mode); + WhitespaceMode GetWhitespaceMode() const; +#endif // wxABI_VERSION >= 20808 + +protected: + virtual void AddText(const wxChar* txt); + +private: + void FlushWordBuf(wxChar *temp, int& templen, wxChar nbsp); + void AddWord(wxHtmlWordCell *c); + void AddWord(const wxString& word); + void AddPreBlock(const wxString& text); + + bool m_tmpLastWasSpace; + wxChar *m_tmpStrBuf; + size_t m_tmpStrBufSize; + // temporary variables used by AddText + wxHtmlWindowInterface *m_windowInterface; + // window we're parsing for + double m_PixelScale; + wxDC *m_DC; + // Device Context we're parsing for + static wxList m_Modules; + // list of tags modules (see wxHtmlTagsModule for details) + // This list is used to initialize m_Handlers member. + + wxHtmlContainerCell *m_Container; + // current container. See Open/CloseContainer for details. + + int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not true,false but 1,0, we need it for indexing + int m_FontSize; /* -2 to +4, 0 is default */ + wxColour m_LinkColor; + wxColour m_ActualColor; + // basic font parameters. + wxHtmlLinkInfo m_Link; + // actual hypertext link or empty string + bool m_UseLink; + // true if m_Link is not empty + long m_CharHeight, m_CharWidth; + // average height of normal-sized text + int m_Align; + // actual alignment + wxHtmlScriptMode m_ScriptMode; + // current script mode (sub/sup/normal) + long m_ScriptBaseline; + // current sub/supscript base + + wxFont* m_FontsTable[2][2][2][2][7]; + wxString m_FontsFacesTable[2][2][2][2][7]; +#if !wxUSE_UNICODE + wxFontEncoding m_FontsEncTable[2][2][2][2][7]; +#endif + // table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off + // state of these flags (from left to right): + // [bold][italic][underlined][fixed_size] + // last index is font size : from 0 to 6 (remapped from html sizes 1 to 7) + // Note : this table covers all possible combinations of fonts, but not + // all of them are used, so many items in table are usually NULL. + int m_FontsSizes[7]; + wxString m_FontFaceFixed, m_FontFaceNormal; + // html font sizes and faces of fixed and proportional fonts + +#if !wxUSE_UNICODE + wxFontEncoding m_InputEnc, m_OutputEnc; + // I/O font encodings + wxEncodingConverter *m_EncConv; +#endif + + struct TextParsingState + { + // current whitespace handling mode + WhitespaceMode m_whitespaceMode; + + wxHtmlWordCell *m_lastWordCell; + + // current position on line, in num. of characters; used to properly + // expand TABs; only updated while inside <pre> + int m_posColumn; + }; + + // NB: this pointer replaces m_lastWordCell pointer in wx<=2.8.7; this + // way, wxHtmlWinParser remains ABI compatible with older versions + // despite addition of two fields in TextParsingState + TextParsingState *m_textParsingState; + + DECLARE_NO_COPY_CLASS(wxHtmlWinParser) +}; + + + + + + +//----------------------------------------------------------------------------- +// wxHtmlWinTagHandler +// This is basicly wxHtmlTagHandler except +// it is extended with protected member m_Parser pointing to +// the wxHtmlWinParser object +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWinTagHandler : public wxHtmlTagHandler +{ + DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler) + +public: + wxHtmlWinTagHandler() : wxHtmlTagHandler() {} + + virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;} + +protected: + wxHtmlWinParser *m_WParser; // same as m_Parser, but overcasted + + DECLARE_NO_COPY_CLASS(wxHtmlWinTagHandler) +}; + + + + + + +//---------------------------------------------------------------------------- +// wxHtmlTagsModule +// This is basic of dynamic tag handlers binding. +// The class provides methods for filling parser's handlers +// hash table. +// (See documentation for details) +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlTagsModule : public wxModule +{ + DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule) + +public: + wxHtmlTagsModule() : wxModule() {} + + virtual bool OnInit(); + virtual void OnExit(); + + // This is called by wxHtmlWinParser. + // The method must simply call parser->AddTagHandler(new + // <handler_class_name>); for each handler + virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { } +}; + + +#endif + +#endif // _WX_WINPARS_H_ diff --git a/Externals/wxWidgets/include/wx/htmllbox.h b/Externals/wxWidgets/include/wx/htmllbox.h index aba0565561..533b79171b 100644 --- a/Externals/wxWidgets/include/wx/htmllbox.h +++ b/Externals/wxWidgets/include/wx/htmllbox.h @@ -1,325 +1,325 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/htmllbox.h -// Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.05.03 -// RCS-ID: $Id: htmllbox.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTMLLBOX_H_ -#define _WX_HTMLLBOX_H_ - -#include "wx/vlbox.h" // base class -#include "wx/html/htmlwin.h" -#include "wx/ctrlsub.h" - -#if wxUSE_FILESYSTEM - #include "wx/filesys.h" -#endif // wxUSE_FILESYSTEM - -class WXDLLIMPEXP_FWD_HTML wxHtmlCell; -class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; -class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxCache; -class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxStyle; - -extern WXDLLIMPEXP_DATA_HTML(const wxChar) wxHtmlListBoxNameStr[]; -extern WXDLLIMPEXP_DATA_HTML(const wxChar) wxSimpleHtmlListBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxHtmlListBox -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox, - public wxHtmlWindowInterface, - public wxHtmlWindowMouseHelper -{ - DECLARE_ABSTRACT_CLASS(wxHtmlListBox) -public: - // constructors and such - // --------------------- - - // default constructor, you must call Create() later - wxHtmlListBox(); - - // normal constructor which calls Create() internally - wxHtmlListBox(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxHtmlListBoxNameStr); - - // really creates the control and sets the initial number of items in it - // (which may be changed later with SetItemCount()) - // - // the only special style which may be specified here is wxLB_MULTIPLE - // - // returns true on success or false if the control couldn't be created - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxHtmlListBoxNameStr); - - // destructor cleans up whatever resources we use - virtual ~wxHtmlListBox(); - - // override some base class virtuals - virtual void RefreshLine(size_t line); - virtual void RefreshLines(size_t from, size_t to); - virtual void RefreshAll(); - virtual void SetItemCount(size_t count); - -#if wxUSE_FILESYSTEM - // retrieve the file system used by the wxHtmlWinParser: if you use - // relative paths in your HTML, you should use its ChangePathTo() method - wxFileSystem& GetFileSystem() { return m_filesystem; } - const wxFileSystem& GetFileSystem() const { return m_filesystem; } -#endif // wxUSE_FILESYSTEM - - virtual void OnInternalIdle(); - -protected: - // this method must be implemented in the derived class and should return - // the body (i.e. without <html>) of the HTML for the given item - virtual wxString OnGetItem(size_t n) const = 0; - - // this function may be overridden to decorate HTML returned by OnGetItem() - virtual wxString OnGetItemMarkup(size_t n) const; - - - // this method allows to customize the selection appearance: it may be used - // to specify the colour of the text which normally has the given colour - // colFg when it is inside the selection - // - // by default, the original colour is not used at all and all text has the - // same (default for this system) colour inside selection - virtual wxColour GetSelectedTextColour(const wxColour& colFg) const; - - // this is the same as GetSelectedTextColour() but allows to customize the - // background colour -- this is even more rarely used as you can change it - // globally using SetSelectionBackground() - virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const; - - - // we implement both of these functions in terms of OnGetItem(), they are - // not supposed to be overridden by our descendants - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; - virtual wxCoord OnMeasureItem(size_t n) const; - - // This method may be overriden to handle clicking on a link in - // the listbox. By default, clicking links is ignored. - virtual void OnLinkClicked(size_t n, const wxHtmlLinkInfo& link); - - // event handlers - void OnSize(wxSizeEvent& event); - void OnMouseMove(wxMouseEvent& event); - void OnLeftDown(wxMouseEvent& event); - - - // common part of all ctors - void Init(); - - // ensure that the given item is cached - void CacheItem(size_t n) const; - -private: - // wxHtmlWindowInterface methods: - virtual void SetHTMLWindowTitle(const wxString& title); - virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); - virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, - const wxString& url, - wxString *redirect) const; - virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, - const wxPoint& pos) const; - virtual wxWindow* GetHTMLWindow(); - virtual wxColour GetHTMLBackgroundColour() const; - virtual void SetHTMLBackgroundColour(const wxColour& clr); - virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); - virtual void SetHTMLStatusText(const wxString& text); - virtual wxCursor GetHTMLCursor(HTMLCursor type) const; - - // returns index of item that contains given HTML cell - size_t GetItemForCell(const wxHtmlCell *cell) const; - - // return physical coordinates of root wxHtmlCell of n-th item - wxPoint GetRootCellCoords(size_t n) const; - - // Converts physical coordinates stored in @a pos into coordinates - // relative to the root cell of the item under mouse cursor, if any. If no - // cell is found under the cursor, returns false. Otherwise stores the new - // coordinates back into @a pos and pointer to the cell under cursor into - // @a cell and returns true. - bool PhysicalCoordsToCell(wxPoint& pos, wxHtmlCell*& cell) const; - - // The opposite of PhysicalCoordsToCell: converts coordinates relative to - // given cell to physical coordinates in the window - wxPoint CellCoordsToPhysical(const wxPoint& pos, wxHtmlCell *cell) const; - -private: - // this class caches the pre-parsed HTML to speed up display - wxHtmlListBoxCache *m_cache; - - // HTML parser we use - wxHtmlWinParser *m_htmlParser; - -#if wxUSE_FILESYSTEM - // file system used by m_htmlParser - wxFileSystem m_filesystem; -#endif // wxUSE_FILESYSTEM - - // rendering style for the parser which allows us to customize our colours - wxHtmlListBoxStyle *m_htmlRendStyle; - - - // it calls our GetSelectedTextColour() and GetSelectedTextBgColour() - friend class wxHtmlListBoxStyle; - friend class wxHtmlListBoxWinInterface; - - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxHtmlListBox) -}; - - -// ---------------------------------------------------------------------------- -// wxSimpleHtmlListBox -// ---------------------------------------------------------------------------- - -#define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN -#define wxHLB_MULTIPLE wxLB_MULTIPLE - -class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : public wxHtmlListBox, - public wxItemContainer -{ -public: - // wxListbox-compatible constructors - // --------------------------------- - - wxSimpleHtmlListBox() { } - - wxSimpleHtmlListBox(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = wxHLB_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSimpleHtmlListBoxNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - wxSimpleHtmlListBox(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = wxHLB_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSimpleHtmlListBoxNameStr) - { - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = wxHLB_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSimpleHtmlListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = wxHLB_DEFAULT_STYLE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSimpleHtmlListBoxNameStr); - - virtual ~wxSimpleHtmlListBox(); - - // these must be overloaded otherwise the compiler will complain - // about wxItemContainerImmutable::[G|S]etSelection being pure virtuals... - void SetSelection(int n) - { wxVListBox::SetSelection(n); } - int GetSelection() const - { return wxVListBox::GetSelection(); } - - // see ctrlsub.h for more info about this: - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - - - // accessing strings - // ----------------- - - virtual unsigned int GetCount() const - { return m_items.GetCount(); } - - virtual wxString GetString(unsigned int n) const; - - // override default unoptimized wxItemContainer::GetStrings() function - wxArrayString GetStrings() const - { return m_items; } - - virtual void SetString(unsigned int n, const wxString& s); - - virtual void Clear(); - virtual void Delete(unsigned int n); - - // override default unoptimized wxItemContainer::Append() function - void Append(const wxArrayString& strings); - - // since we override one Append() overload, we need to overload all others too - int Append(const wxString& item) - { return wxItemContainer::Append(item); } - int Append(const wxString& item, void *clientData) - { return wxItemContainer::Append(item, clientData); } - int Append(const wxString& item, wxClientData *clientData) - { return wxItemContainer::Append(item, clientData); } - - -protected: - - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - - virtual void DoSetItemClientData(unsigned int n, void *clientData) - { m_HTMLclientData[n] = clientData; } - - virtual void *DoGetItemClientData(unsigned int n) const - { return m_HTMLclientData[n]; } - virtual void DoSetItemClientObject(unsigned int n, wxClientData *clientData) - { m_HTMLclientData[n] = (void *)clientData; } - virtual wxClientData *DoGetItemClientObject(unsigned int n) const - { return (wxClientData *)m_HTMLclientData[n]; } - - // calls wxHtmlListBox::SetItemCount() and RefreshAll() - void UpdateCount(); - - // overload these functions just to change their visibility: users of - // wxSimpleHtmlListBox shouldn't be allowed to call them directly! - virtual void SetItemCount(size_t count) - { wxHtmlListBox::SetItemCount(count); } - virtual void SetLineCount(size_t count) - { wxHtmlListBox::SetLineCount(count); } - - virtual wxString OnGetItem(size_t n) const - { return m_items[n]; } - - wxArrayString m_items; - wxArrayPtrVoid m_HTMLclientData; - - // Note: For the benefit of old compilers (like gcc-2.8) this should - // not be named m_clientdata as that clashes with the name of an - // anonymous struct member in wxEvtHandler, which we derive from. - - DECLARE_NO_COPY_CLASS(wxSimpleHtmlListBox) -}; - -#endif // _WX_HTMLLBOX_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/htmllbox.h +// Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.05.03 +// RCS-ID: $Id: htmllbox.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLLBOX_H_ +#define _WX_HTMLLBOX_H_ + +#include "wx/vlbox.h" // base class +#include "wx/html/htmlwin.h" +#include "wx/ctrlsub.h" + +#if wxUSE_FILESYSTEM + #include "wx/filesys.h" +#endif // wxUSE_FILESYSTEM + +class WXDLLIMPEXP_FWD_HTML wxHtmlCell; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; +class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxCache; +class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxStyle; + +extern WXDLLIMPEXP_DATA_HTML(const wxChar) wxHtmlListBoxNameStr[]; +extern WXDLLIMPEXP_DATA_HTML(const wxChar) wxSimpleHtmlListBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxHtmlListBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox, + public wxHtmlWindowInterface, + public wxHtmlWindowMouseHelper +{ + DECLARE_ABSTRACT_CLASS(wxHtmlListBox) +public: + // constructors and such + // --------------------- + + // default constructor, you must call Create() later + wxHtmlListBox(); + + // normal constructor which calls Create() internally + wxHtmlListBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxHtmlListBoxNameStr); + + // really creates the control and sets the initial number of items in it + // (which may be changed later with SetItemCount()) + // + // the only special style which may be specified here is wxLB_MULTIPLE + // + // returns true on success or false if the control couldn't be created + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxHtmlListBoxNameStr); + + // destructor cleans up whatever resources we use + virtual ~wxHtmlListBox(); + + // override some base class virtuals + virtual void RefreshLine(size_t line); + virtual void RefreshLines(size_t from, size_t to); + virtual void RefreshAll(); + virtual void SetItemCount(size_t count); + +#if wxUSE_FILESYSTEM + // retrieve the file system used by the wxHtmlWinParser: if you use + // relative paths in your HTML, you should use its ChangePathTo() method + wxFileSystem& GetFileSystem() { return m_filesystem; } + const wxFileSystem& GetFileSystem() const { return m_filesystem; } +#endif // wxUSE_FILESYSTEM + + virtual void OnInternalIdle(); + +protected: + // this method must be implemented in the derived class and should return + // the body (i.e. without <html>) of the HTML for the given item + virtual wxString OnGetItem(size_t n) const = 0; + + // this function may be overridden to decorate HTML returned by OnGetItem() + virtual wxString OnGetItemMarkup(size_t n) const; + + + // this method allows to customize the selection appearance: it may be used + // to specify the colour of the text which normally has the given colour + // colFg when it is inside the selection + // + // by default, the original colour is not used at all and all text has the + // same (default for this system) colour inside selection + virtual wxColour GetSelectedTextColour(const wxColour& colFg) const; + + // this is the same as GetSelectedTextColour() but allows to customize the + // background colour -- this is even more rarely used as you can change it + // globally using SetSelectionBackground() + virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const; + + + // we implement both of these functions in terms of OnGetItem(), they are + // not supposed to be overridden by our descendants + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; + virtual wxCoord OnMeasureItem(size_t n) const; + + // This method may be overriden to handle clicking on a link in + // the listbox. By default, clicking links is ignored. + virtual void OnLinkClicked(size_t n, const wxHtmlLinkInfo& link); + + // event handlers + void OnSize(wxSizeEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnLeftDown(wxMouseEvent& event); + + + // common part of all ctors + void Init(); + + // ensure that the given item is cached + void CacheItem(size_t n) const; + +private: + // wxHtmlWindowInterface methods: + virtual void SetHTMLWindowTitle(const wxString& title); + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); + virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, + const wxString& url, + wxString *redirect) const; + virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, + const wxPoint& pos) const; + virtual wxWindow* GetHTMLWindow(); + virtual wxColour GetHTMLBackgroundColour() const; + virtual void SetHTMLBackgroundColour(const wxColour& clr); + virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); + virtual void SetHTMLStatusText(const wxString& text); + virtual wxCursor GetHTMLCursor(HTMLCursor type) const; + + // returns index of item that contains given HTML cell + size_t GetItemForCell(const wxHtmlCell *cell) const; + + // return physical coordinates of root wxHtmlCell of n-th item + wxPoint GetRootCellCoords(size_t n) const; + + // Converts physical coordinates stored in @a pos into coordinates + // relative to the root cell of the item under mouse cursor, if any. If no + // cell is found under the cursor, returns false. Otherwise stores the new + // coordinates back into @a pos and pointer to the cell under cursor into + // @a cell and returns true. + bool PhysicalCoordsToCell(wxPoint& pos, wxHtmlCell*& cell) const; + + // The opposite of PhysicalCoordsToCell: converts coordinates relative to + // given cell to physical coordinates in the window + wxPoint CellCoordsToPhysical(const wxPoint& pos, wxHtmlCell *cell) const; + +private: + // this class caches the pre-parsed HTML to speed up display + wxHtmlListBoxCache *m_cache; + + // HTML parser we use + wxHtmlWinParser *m_htmlParser; + +#if wxUSE_FILESYSTEM + // file system used by m_htmlParser + wxFileSystem m_filesystem; +#endif // wxUSE_FILESYSTEM + + // rendering style for the parser which allows us to customize our colours + wxHtmlListBoxStyle *m_htmlRendStyle; + + + // it calls our GetSelectedTextColour() and GetSelectedTextBgColour() + friend class wxHtmlListBoxStyle; + friend class wxHtmlListBoxWinInterface; + + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxHtmlListBox) +}; + + +// ---------------------------------------------------------------------------- +// wxSimpleHtmlListBox +// ---------------------------------------------------------------------------- + +#define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN +#define wxHLB_MULTIPLE wxLB_MULTIPLE + +class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : public wxHtmlListBox, + public wxItemContainer +{ +public: + // wxListbox-compatible constructors + // --------------------------------- + + wxSimpleHtmlListBox() { } + + wxSimpleHtmlListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSimpleHtmlListBoxNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + wxSimpleHtmlListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSimpleHtmlListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSimpleHtmlListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSimpleHtmlListBoxNameStr); + + virtual ~wxSimpleHtmlListBox(); + + // these must be overloaded otherwise the compiler will complain + // about wxItemContainerImmutable::[G|S]etSelection being pure virtuals... + void SetSelection(int n) + { wxVListBox::SetSelection(n); } + int GetSelection() const + { return wxVListBox::GetSelection(); } + + // see ctrlsub.h for more info about this: + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + + + // accessing strings + // ----------------- + + virtual unsigned int GetCount() const + { return m_items.GetCount(); } + + virtual wxString GetString(unsigned int n) const; + + // override default unoptimized wxItemContainer::GetStrings() function + wxArrayString GetStrings() const + { return m_items; } + + virtual void SetString(unsigned int n, const wxString& s); + + virtual void Clear(); + virtual void Delete(unsigned int n); + + // override default unoptimized wxItemContainer::Append() function + void Append(const wxArrayString& strings); + + // since we override one Append() overload, we need to overload all others too + int Append(const wxString& item) + { return wxItemContainer::Append(item); } + int Append(const wxString& item, void *clientData) + { return wxItemContainer::Append(item, clientData); } + int Append(const wxString& item, wxClientData *clientData) + { return wxItemContainer::Append(item, clientData); } + + +protected: + + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + + virtual void DoSetItemClientData(unsigned int n, void *clientData) + { m_HTMLclientData[n] = clientData; } + + virtual void *DoGetItemClientData(unsigned int n) const + { return m_HTMLclientData[n]; } + virtual void DoSetItemClientObject(unsigned int n, wxClientData *clientData) + { m_HTMLclientData[n] = (void *)clientData; } + virtual wxClientData *DoGetItemClientObject(unsigned int n) const + { return (wxClientData *)m_HTMLclientData[n]; } + + // calls wxHtmlListBox::SetItemCount() and RefreshAll() + void UpdateCount(); + + // overload these functions just to change their visibility: users of + // wxSimpleHtmlListBox shouldn't be allowed to call them directly! + virtual void SetItemCount(size_t count) + { wxHtmlListBox::SetItemCount(count); } + virtual void SetLineCount(size_t count) + { wxHtmlListBox::SetLineCount(count); } + + virtual wxString OnGetItem(size_t n) const + { return m_items[n]; } + + wxArrayString m_items; + wxArrayPtrVoid m_HTMLclientData; + + // Note: For the benefit of old compilers (like gcc-2.8) this should + // not be named m_clientdata as that clashes with the name of an + // anonymous struct member in wxEvtHandler, which we derive from. + + DECLARE_NO_COPY_CLASS(wxSimpleHtmlListBox) +}; + +#endif // _WX_HTMLLBOX_H_ + diff --git a/Externals/wxWidgets/include/wx/hyperlink.h b/Externals/wxWidgets/include/wx/hyperlink.h index a293c8ed87..8618466b8a 100644 --- a/Externals/wxWidgets/include/wx/hyperlink.h +++ b/Externals/wxWidgets/include/wx/hyperlink.h @@ -1,231 +1,231 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/hyperlink.h -// Purpose: Hyperlink control -// Author: David Norris <danorris@gmail.com>, Otto Wyss -// Modified by: Ryan Norton, Francesco Montorsi -// Created: 04/02/2005 -// RCS-ID: $Id: hyperlink.h 42409 2006-10-25 20:23:06Z RD $ -// Copyright: (c) 2005 David Norris -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HYPERLINK_H__ -#define _WX_HYPERLINK_H__ - -#include "wx/defs.h" - -#if wxUSE_HYPERLINKCTRL - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#define wxHL_CONTEXTMENU 0x0001 -#define wxHL_ALIGN_LEFT 0x0002 -#define wxHL_ALIGN_RIGHT 0x0004 -#define wxHL_ALIGN_CENTRE 0x0008 -#define wxHL_DEFAULT_STYLE (wxHL_CONTEXTMENU|wxNO_BORDER|wxHL_ALIGN_CENTRE) - -extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxHyperlinkCtrlNameStr[]; - - -// ---------------------------------------------------------------------------- -// wxHyperlinkCtrl -// ---------------------------------------------------------------------------- - -// A static text control that emulates a hyperlink. The link is displayed -// in an appropriate text style, derived from the control's normal font. -// When the mouse rolls over the link, the cursor changes to a hand and the -// link's color changes to the active color. -// -// Clicking on the link does not launch a web browser; instead, a -// HyperlinkEvent is fired. The event propagates upward until it is caught, -// just like a wxCommandEvent. -// -// Use the EVT_HYPERLINK() to catch link events. -class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxControl -{ -public: - // Default constructor (for two-step construction). - wxHyperlinkCtrl() { } - - // Constructor. - wxHyperlinkCtrl(wxWindow *parent, - wxWindowID id, - const wxString& label, const wxString& url, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHL_DEFAULT_STYLE, - const wxString& name = wxHyperlinkCtrlNameStr) - { - (void)Create(parent, id, label, url, pos, size, style, name); - } - - // Creation function (for two-step construction). - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, const wxString& url, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxHL_DEFAULT_STYLE, - const wxString& name = wxHyperlinkCtrlNameStr); - - - // get/set - wxColour GetHoverColour() const { return m_hoverColour; } - void SetHoverColour(const wxColour &colour) { m_hoverColour = colour; } - - wxColour GetNormalColour() const { return m_normalColour; } - void SetNormalColour(const wxColour &colour); - - wxColour GetVisitedColour() const { return m_visitedColour; } - void SetVisitedColour(const wxColour &colour); - - wxString GetURL() const { return m_url; } - void SetURL (const wxString &url) { m_url=url; } - - void SetVisited(bool visited = true) { m_visited=visited; } - bool GetVisited() const { return m_visited; } - - // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour, - // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important ! - - -protected: - // event handlers - - // Renders the hyperlink. - void OnPaint(wxPaintEvent& event); - - // Returns the wxRect of the label of this hyperlink. - // This is different from the clientsize's rectangle when - // clientsize != bestsize and this rectangle is influenced - // by the alignment of the label (wxHL_ALIGN_*). - wxRect GetLabelRect() const; - - // If the click originates inside the bounding box of the label, - // a flag is set so that an event will be fired when the left - // button is released. - void OnLeftDown(wxMouseEvent& event); - - // If the click both originated and finished inside the bounding box - // of the label, a HyperlinkEvent is fired. - void OnLeftUp(wxMouseEvent& event); - void OnRightUp(wxMouseEvent& event); - - // Changes the cursor to a hand, if the mouse is inside the label's - // bounding box. - void OnMotion(wxMouseEvent& event); - - // Changes the cursor back to the default, if necessary. - void OnLeaveWindow(wxMouseEvent& event); - - // handles "Copy URL" menuitem - void OnPopUpCopy(wxCommandEvent& event); - - // Refreshes the control to update label's position if necessary - void OnSize(wxSizeEvent& event); - - - // overridden base class virtuals - - // Returns the best size for the window, which is the size needed - // to display the text label. - virtual wxSize DoGetBestSize() const; - - // creates a context menu with "Copy URL" menuitem - virtual void DoContextMenu(const wxPoint &); - -private: - // URL associated with the link. This is transmitted inside - // the HyperlinkEvent fired when the user clicks on the label. - wxString m_url; - - // Foreground colours for various link types. - // NOTE: wxWindow::m_backgroundColour is used for background, - // wxWindow::m_foregroundColour is used to render non-visited links - wxColour m_hoverColour; - wxColour m_normalColour; - wxColour m_visitedColour; - - // True if the mouse cursor is inside the label's bounding box. - bool m_rollover; - - // True if the link has been clicked before. - bool m_visited; - - // True if a click is in progress (left button down) and the click - // originated inside the label's bounding box. - bool m_clicking; - -private: - DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl) - DECLARE_EVENT_TABLE() -}; - - -// ---------------------------------------------------------------------------- -// wxHyperlinkEvent -// ---------------------------------------------------------------------------- - -// Declare an event identifier. -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_HYPERLINK, 3700) -END_DECLARE_EVENT_TYPES() - -// -// An event fired when the user clicks on the label in a hyperlink control. -// See HyperlinkControl for details. -// -class WXDLLIMPEXP_ADV wxHyperlinkEvent : public wxCommandEvent -{ -public: - wxHyperlinkEvent() {} - wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url) - : wxCommandEvent(wxEVT_COMMAND_HYPERLINK, id), - m_url(url) - { - SetEventObject(generator); - } - - // Returns the URL associated with the hyperlink control - // that the user clicked on. - wxString GetURL() const { return m_url; } - void SetURL(const wxString &url) { m_url=url; } - - // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxHyperlinkEvent(*this); } - -private: - - // URL associated with the hyperlink control that the used clicked on. - wxString m_url; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHyperlinkEvent) -}; - - -// ---------------------------------------------------------------------------- -// event types and macros -// ---------------------------------------------------------------------------- - -typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&); - -#define wxHyperlinkEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHyperlinkEventFunction, &func) - -#define EVT_HYPERLINK(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_HYPERLINK, id, wxHyperlinkEventHandler(fn)) - -#ifdef _WX_DEFINE_DATE_EVENTS_ - DEFINE_EVENT_TYPE(wxEVT_COMMAND_HYPERLINK) - - IMPLEMENT_DYNAMIC_CLASS(wxHyperlinkEvent, wxCommandEvent) -#endif - - -#endif // wxUSE_HYPERLINKCTRL - -#endif // _WX_HYPERLINK_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hyperlink.h +// Purpose: Hyperlink control +// Author: David Norris <danorris@gmail.com>, Otto Wyss +// Modified by: Ryan Norton, Francesco Montorsi +// Created: 04/02/2005 +// RCS-ID: $Id: hyperlink.h 42409 2006-10-25 20:23:06Z RD $ +// Copyright: (c) 2005 David Norris +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HYPERLINK_H__ +#define _WX_HYPERLINK_H__ + +#include "wx/defs.h" + +#if wxUSE_HYPERLINKCTRL + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#define wxHL_CONTEXTMENU 0x0001 +#define wxHL_ALIGN_LEFT 0x0002 +#define wxHL_ALIGN_RIGHT 0x0004 +#define wxHL_ALIGN_CENTRE 0x0008 +#define wxHL_DEFAULT_STYLE (wxHL_CONTEXTMENU|wxNO_BORDER|wxHL_ALIGN_CENTRE) + +extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxHyperlinkCtrlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxHyperlinkCtrl +// ---------------------------------------------------------------------------- + +// A static text control that emulates a hyperlink. The link is displayed +// in an appropriate text style, derived from the control's normal font. +// When the mouse rolls over the link, the cursor changes to a hand and the +// link's color changes to the active color. +// +// Clicking on the link does not launch a web browser; instead, a +// HyperlinkEvent is fired. The event propagates upward until it is caught, +// just like a wxCommandEvent. +// +// Use the EVT_HYPERLINK() to catch link events. +class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxControl +{ +public: + // Default constructor (for two-step construction). + wxHyperlinkCtrl() { } + + // Constructor. + wxHyperlinkCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxHyperlinkCtrlNameStr) + { + (void)Create(parent, id, label, url, pos, size, style, name); + } + + // Creation function (for two-step construction). + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxHyperlinkCtrlNameStr); + + + // get/set + wxColour GetHoverColour() const { return m_hoverColour; } + void SetHoverColour(const wxColour &colour) { m_hoverColour = colour; } + + wxColour GetNormalColour() const { return m_normalColour; } + void SetNormalColour(const wxColour &colour); + + wxColour GetVisitedColour() const { return m_visitedColour; } + void SetVisitedColour(const wxColour &colour); + + wxString GetURL() const { return m_url; } + void SetURL (const wxString &url) { m_url=url; } + + void SetVisited(bool visited = true) { m_visited=visited; } + bool GetVisited() const { return m_visited; } + + // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour, + // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important ! + + +protected: + // event handlers + + // Renders the hyperlink. + void OnPaint(wxPaintEvent& event); + + // Returns the wxRect of the label of this hyperlink. + // This is different from the clientsize's rectangle when + // clientsize != bestsize and this rectangle is influenced + // by the alignment of the label (wxHL_ALIGN_*). + wxRect GetLabelRect() const; + + // If the click originates inside the bounding box of the label, + // a flag is set so that an event will be fired when the left + // button is released. + void OnLeftDown(wxMouseEvent& event); + + // If the click both originated and finished inside the bounding box + // of the label, a HyperlinkEvent is fired. + void OnLeftUp(wxMouseEvent& event); + void OnRightUp(wxMouseEvent& event); + + // Changes the cursor to a hand, if the mouse is inside the label's + // bounding box. + void OnMotion(wxMouseEvent& event); + + // Changes the cursor back to the default, if necessary. + void OnLeaveWindow(wxMouseEvent& event); + + // handles "Copy URL" menuitem + void OnPopUpCopy(wxCommandEvent& event); + + // Refreshes the control to update label's position if necessary + void OnSize(wxSizeEvent& event); + + + // overridden base class virtuals + + // Returns the best size for the window, which is the size needed + // to display the text label. + virtual wxSize DoGetBestSize() const; + + // creates a context menu with "Copy URL" menuitem + virtual void DoContextMenu(const wxPoint &); + +private: + // URL associated with the link. This is transmitted inside + // the HyperlinkEvent fired when the user clicks on the label. + wxString m_url; + + // Foreground colours for various link types. + // NOTE: wxWindow::m_backgroundColour is used for background, + // wxWindow::m_foregroundColour is used to render non-visited links + wxColour m_hoverColour; + wxColour m_normalColour; + wxColour m_visitedColour; + + // True if the mouse cursor is inside the label's bounding box. + bool m_rollover; + + // True if the link has been clicked before. + bool m_visited; + + // True if a click is in progress (left button down) and the click + // originated inside the label's bounding box. + bool m_clicking; + +private: + DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl) + DECLARE_EVENT_TABLE() +}; + + +// ---------------------------------------------------------------------------- +// wxHyperlinkEvent +// ---------------------------------------------------------------------------- + +// Declare an event identifier. +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_HYPERLINK, 3700) +END_DECLARE_EVENT_TYPES() + +// +// An event fired when the user clicks on the label in a hyperlink control. +// See HyperlinkControl for details. +// +class WXDLLIMPEXP_ADV wxHyperlinkEvent : public wxCommandEvent +{ +public: + wxHyperlinkEvent() {} + wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url) + : wxCommandEvent(wxEVT_COMMAND_HYPERLINK, id), + m_url(url) + { + SetEventObject(generator); + } + + // Returns the URL associated with the hyperlink control + // that the user clicked on. + wxString GetURL() const { return m_url; } + void SetURL(const wxString &url) { m_url=url; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const { return new wxHyperlinkEvent(*this); } + +private: + + // URL associated with the hyperlink control that the used clicked on. + wxString m_url; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHyperlinkEvent) +}; + + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&); + +#define wxHyperlinkEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHyperlinkEventFunction, &func) + +#define EVT_HYPERLINK(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_HYPERLINK, id, wxHyperlinkEventHandler(fn)) + +#ifdef _WX_DEFINE_DATE_EVENTS_ + DEFINE_EVENT_TYPE(wxEVT_COMMAND_HYPERLINK) + + IMPLEMENT_DYNAMIC_CLASS(wxHyperlinkEvent, wxCommandEvent) +#endif + + +#endif // wxUSE_HYPERLINKCTRL + +#endif // _WX_HYPERLINK_H__ diff --git a/Externals/wxWidgets/include/wx/icon.h b/Externals/wxWidgets/include/wx/icon.h index 8a73884ca7..fac90f555b 100644 --- a/Externals/wxWidgets/include/wx/icon.h +++ b/Externals/wxWidgets/include/wx/icon.h @@ -1,53 +1,53 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/icon.h -// Purpose: wxIcon base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: icon.h 41538 2006-09-30 20:45:15Z RR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICON_H_BASE_ -#define _WX_ICON_H_BASE_ - -#include "wx/iconloc.h" - -#if defined(__WXPALMOS__) - #include "wx/generic/icon.h" -#elif defined(__WXMSW__) - #include "wx/msw/icon.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/icon.h" -#elif defined(__WXGTK20__) - #include "wx/generic/icon.h" -#elif defined(__WXGTK__) - #include "wx/generic/icon.h" -#elif defined(__WXX11__) - #include "wx/generic/icon.h" -#elif defined(__WXMGL__) - #define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_ICO_RESOURCE - #include "wx/generic/icon.h" -#elif defined(__WXDFB__) - #include "wx/generic/icon.h" -#elif defined(__WXMAC__) - #include "wx/mac/icon.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/icon.h" -#elif defined(__WXPM__) - #include "wx/os2/icon.h" -#endif - -//----------------------------------------------------------------------------- -// wxVariant support -//----------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT) -#endif - - -#endif - // _WX_ICON_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/icon.h +// Purpose: wxIcon base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: icon.h 41538 2006-09-30 20:45:15Z RR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_BASE_ +#define _WX_ICON_H_BASE_ + +#include "wx/iconloc.h" + +#if defined(__WXPALMOS__) + #include "wx/generic/icon.h" +#elif defined(__WXMSW__) + #include "wx/msw/icon.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/icon.h" +#elif defined(__WXGTK20__) + #include "wx/generic/icon.h" +#elif defined(__WXGTK__) + #include "wx/generic/icon.h" +#elif defined(__WXX11__) + #include "wx/generic/icon.h" +#elif defined(__WXMGL__) + #define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_ICO_RESOURCE + #include "wx/generic/icon.h" +#elif defined(__WXDFB__) + #include "wx/generic/icon.h" +#elif defined(__WXMAC__) + #include "wx/mac/icon.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/icon.h" +#elif defined(__WXPM__) + #include "wx/os2/icon.h" +#endif + +//----------------------------------------------------------------------------- +// wxVariant support +//----------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT) +#endif + + +#endif + // _WX_ICON_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/iconbndl.h b/Externals/wxWidgets/include/wx/iconbndl.h index ced8dbba69..0ee8e9afe1 100644 --- a/Externals/wxWidgets/include/wx/iconbndl.h +++ b/Externals/wxWidgets/include/wx/iconbndl.h @@ -1,69 +1,69 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/iconbndl.h -// Purpose: wxIconBundle -// Author: Mattia barbon -// Modified by: -// Created: 23.03.02 -// RCS-ID: $Id: iconbndl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICONBNDL_H_ -#define _WX_ICONBNDL_H_ - -#include "wx/dynarray.h" -// for wxSize -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_BASE wxString; - -WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray ); - -// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE, -// if you need them, you have to load them manually and call -// wxIconCollection::AddIcon -class WXDLLEXPORT wxIconBundle -{ -public: - // default constructor - wxIconBundle() : m_icons() {} - // initializes the bundle with the icon(s) found in the file - wxIconBundle( const wxString& file, long type ) : m_icons() - { AddIcon( file, type ); } - // initializes the bundle with a single icon - wxIconBundle( const wxIcon& icon ) : m_icons() - { AddIcon( icon ); } - - const wxIconBundle& operator =( const wxIconBundle& ic ); - wxIconBundle( const wxIconBundle& ic ) : m_icons() - { *this = ic; } - - ~wxIconBundle() { DeleteIcons(); } - - // adds all the icons contained in the file to the collection, - // if the collection already contains icons with the same - // width and height, they are replaced - void AddIcon( const wxString& file, long type ); - // adds the icon to the collection, if the collection already - // contains an icon with the same width and height, it is - // replaced - void AddIcon( const wxIcon& icon ); - - // returns the icon with the given size; if no such icon exists, - // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists, - // returns the first icon in the bundle - const wxIcon& GetIcon( const wxSize& size ) const; - // equivalent to GetIcon( wxSize( size, size ) ) - const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const - { return GetIcon( wxSize( size, size ) ); } -private: - // delete all icons - void DeleteIcons(); -public: - wxIconArray m_icons; -}; - -#endif - // _WX_ICONBNDL_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/iconbndl.h +// Purpose: wxIconBundle +// Author: Mattia barbon +// Modified by: +// Created: 23.03.02 +// RCS-ID: $Id: iconbndl.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICONBNDL_H_ +#define _WX_ICONBNDL_H_ + +#include "wx/dynarray.h" +// for wxSize +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_BASE wxString; + +WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray ); + +// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE, +// if you need them, you have to load them manually and call +// wxIconCollection::AddIcon +class WXDLLEXPORT wxIconBundle +{ +public: + // default constructor + wxIconBundle() : m_icons() {} + // initializes the bundle with the icon(s) found in the file + wxIconBundle( const wxString& file, long type ) : m_icons() + { AddIcon( file, type ); } + // initializes the bundle with a single icon + wxIconBundle( const wxIcon& icon ) : m_icons() + { AddIcon( icon ); } + + const wxIconBundle& operator =( const wxIconBundle& ic ); + wxIconBundle( const wxIconBundle& ic ) : m_icons() + { *this = ic; } + + ~wxIconBundle() { DeleteIcons(); } + + // adds all the icons contained in the file to the collection, + // if the collection already contains icons with the same + // width and height, they are replaced + void AddIcon( const wxString& file, long type ); + // adds the icon to the collection, if the collection already + // contains an icon with the same width and height, it is + // replaced + void AddIcon( const wxIcon& icon ); + + // returns the icon with the given size; if no such icon exists, + // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists, + // returns the first icon in the bundle + const wxIcon& GetIcon( const wxSize& size ) const; + // equivalent to GetIcon( wxSize( size, size ) ) + const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const + { return GetIcon( wxSize( size, size ) ); } +private: + // delete all icons + void DeleteIcons(); +public: + wxIconArray m_icons; +}; + +#endif + // _WX_ICONBNDL_H_ diff --git a/Externals/wxWidgets/include/wx/iconloc.h b/Externals/wxWidgets/include/wx/iconloc.h index e89d45d4ec..41abc8fa7a 100644 --- a/Externals/wxWidgets/include/wx/iconloc.h +++ b/Externals/wxWidgets/include/wx/iconloc.h @@ -1,81 +1,81 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/iconloc.h -// Purpose: declaration of wxIconLocation class -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 -// RCS-ID: $Id: iconloc.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICONLOC_H_ -#define _WX_ICONLOC_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxIconLocation: describes the location of an icon -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxIconLocationBase -{ -public: - // ctor takes the name of the file where the icon is - wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString) - : m_filename(filename) { } - - // default copy ctor, assignment operator and dtor are ok - - - // returns true if this object is valid/initialized - bool IsOk() const { return !m_filename.empty(); } - - // set/get the icon file name - void SetFileName(const wxString& filename) { m_filename = filename; } - const wxString& GetFileName() const { return m_filename; } - -private: - wxString m_filename; -}; - -// under MSW the same file may contain several icons so we also store the -// index of the icon -#if defined(__WXMSW__) - -class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase -{ -public: - // ctor takes the name of the file where the icon is and the icons index in - // the file - wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0); - - // set/get the icon index - void SetIndex(int num) { m_index = num; } - int GetIndex() const { return m_index; } - -private: - int m_index; -}; - -inline -wxIconLocation::wxIconLocation(const wxString& file, int num) - : wxIconLocationBase(file) -{ - SetIndex(num); -} - -#else // !MSW - -// must be a class because we forward declare it as class -class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase -{ -public: - wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString) - : wxIconLocationBase(filename) { } -}; - -#endif // platform - -#endif // _WX_ICONLOC_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/iconloc.h +// Purpose: declaration of wxIconLocation class +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.06.2003 +// RCS-ID: $Id: iconloc.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICONLOC_H_ +#define _WX_ICONLOC_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxIconLocation: describes the location of an icon +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxIconLocationBase +{ +public: + // ctor takes the name of the file where the icon is + wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString) + : m_filename(filename) { } + + // default copy ctor, assignment operator and dtor are ok + + + // returns true if this object is valid/initialized + bool IsOk() const { return !m_filename.empty(); } + + // set/get the icon file name + void SetFileName(const wxString& filename) { m_filename = filename; } + const wxString& GetFileName() const { return m_filename; } + +private: + wxString m_filename; +}; + +// under MSW the same file may contain several icons so we also store the +// index of the icon +#if defined(__WXMSW__) + +class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase +{ +public: + // ctor takes the name of the file where the icon is and the icons index in + // the file + wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0); + + // set/get the icon index + void SetIndex(int num) { m_index = num; } + int GetIndex() const { return m_index; } + +private: + int m_index; +}; + +inline +wxIconLocation::wxIconLocation(const wxString& file, int num) + : wxIconLocationBase(file) +{ + SetIndex(num); +} + +#else // !MSW + +// must be a class because we forward declare it as class +class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase +{ +public: + wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString) + : wxIconLocationBase(filename) { } +}; + +#endif // platform + +#endif // _WX_ICONLOC_H_ + diff --git a/Externals/wxWidgets/include/wx/imagbmp.h b/Externals/wxWidgets/include/wx/imagbmp.h index b475b3aa00..b7a5222369 100644 --- a/Externals/wxWidgets/include/wx/imagbmp.h +++ b/Externals/wxWidgets/include/wx/imagbmp.h @@ -1,165 +1,165 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagbmp.h -// Purpose: wxImage BMP, ICO, CUR and ANI handlers -// Author: Robert Roebling, Chris Elliott -// RCS-ID: $Id: imagbmp.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Robert Roebling, Chris Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGBMP_H_ -#define _WX_IMAGBMP_H_ - -#include "wx/image.h" - -// defines for saving the BMP file in different formats, Bits Per Pixel -// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP ); -#define wxIMAGE_OPTION_BMP_FORMAT wxString(_T("wxBMP_FORMAT")) - -// These two options are filled in upon reading CUR file and can (should) be -// specified when saving a CUR file - they define the hotspot of the cursor: -#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX") -#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY") - -#if WXWIN_COMPATIBILITY_2_4 - // Do not use these macros, they are deprecated - #define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT - #define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X - #define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y -#endif - - -enum -{ - wxBMP_24BPP = 24, // default, do not need to set - //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors? - wxBMP_8BPP = 8, // 8bpp, quantized colors - wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys - wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY, - wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale - wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette - wxBMP_4BPP = 4, // 4bpp, quantized colors - wxBMP_1BPP = 1, // 1bpp, quantized "colors" - wxBMP_1BPP_BW = 2 // 1bpp, black & white from red -}; - -// ---------------------------------------------------------------------------- -// wxBMPHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBMPHandler : public wxImageHandler -{ -public: - wxBMPHandler() - { - m_name = _T("Windows bitmap file"); - m_extension = _T("bmp"); - m_type = wxBITMAP_TYPE_BMP; - m_mime = _T("image/x-bmp"); - } - -#if wxUSE_STREAMS - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - -protected: - virtual bool DoCanRead( wxInputStream& stream ); - bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose, - bool IsBmp, bool IsMask); - bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors, - int comp, wxFileOffset bmpOffset, wxInputStream& stream, - bool verbose, bool IsBmp, bool hasPalette); - bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxBMPHandler) -}; - -#if wxUSE_ICO_CUR -// ---------------------------------------------------------------------------- -// wxICOHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxICOHandler : public wxBMPHandler -{ -public: - wxICOHandler() - { - m_name = _T("Windows icon file"); - m_extension = _T("ico"); - m_type = wxBITMAP_TYPE_ICO; - m_mime = _T("image/x-ico"); - } - -#if wxUSE_STREAMS - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); - virtual int GetImageCount( wxInputStream& stream ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxICOHandler) -}; - - -// ---------------------------------------------------------------------------- -// wxCURHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCURHandler : public wxICOHandler -{ -public: - wxCURHandler() - { - m_name = _T("Windows cursor file"); - m_extension = _T("cur"); - m_type = wxBITMAP_TYPE_CUR; - m_mime = _T("image/x-cur"); - } - - // VS: This handler's meat is implemented inside wxICOHandler (the two - // formats are almost identical), but we hide this fact at - // the API level, since it is a mere implementation detail. - -protected: -#if wxUSE_STREAMS - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxCURHandler) -}; -// ---------------------------------------------------------------------------- -// wxANIHandler -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxANIHandler : public wxCURHandler -{ -public: - wxANIHandler() - { - m_name = _T("Windows animated cursor file"); - m_extension = _T("ani"); - m_type = wxBITMAP_TYPE_ANI; - m_mime = _T("image/x-ani"); - } - - -#if wxUSE_STREAMS - virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;} - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual int GetImageCount( wxInputStream& stream ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxANIHandler) -}; - -#endif // wxUSE_ICO_CUR -#endif // _WX_IMAGBMP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagbmp.h +// Purpose: wxImage BMP, ICO, CUR and ANI handlers +// Author: Robert Roebling, Chris Elliott +// RCS-ID: $Id: imagbmp.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Robert Roebling, Chris Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGBMP_H_ +#define _WX_IMAGBMP_H_ + +#include "wx/image.h" + +// defines for saving the BMP file in different formats, Bits Per Pixel +// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP ); +#define wxIMAGE_OPTION_BMP_FORMAT wxString(_T("wxBMP_FORMAT")) + +// These two options are filled in upon reading CUR file and can (should) be +// specified when saving a CUR file - they define the hotspot of the cursor: +#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX") +#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY") + +#if WXWIN_COMPATIBILITY_2_4 + // Do not use these macros, they are deprecated + #define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT + #define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X + #define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y +#endif + + +enum +{ + wxBMP_24BPP = 24, // default, do not need to set + //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors? + wxBMP_8BPP = 8, // 8bpp, quantized colors + wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys + wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY, + wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale + wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette + wxBMP_4BPP = 4, // 4bpp, quantized colors + wxBMP_1BPP = 1, // 1bpp, quantized "colors" + wxBMP_1BPP_BW = 2 // 1bpp, black & white from red +}; + +// ---------------------------------------------------------------------------- +// wxBMPHandler +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBMPHandler : public wxImageHandler +{ +public: + wxBMPHandler() + { + m_name = _T("Windows bitmap file"); + m_extension = _T("bmp"); + m_type = wxBITMAP_TYPE_BMP; + m_mime = _T("image/x-bmp"); + } + +#if wxUSE_STREAMS + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + +protected: + virtual bool DoCanRead( wxInputStream& stream ); + bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose, + bool IsBmp, bool IsMask); + bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors, + int comp, wxFileOffset bmpOffset, wxInputStream& stream, + bool verbose, bool IsBmp, bool hasPalette); + bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp); +#endif // wxUSE_STREAMS + +private: + DECLARE_DYNAMIC_CLASS(wxBMPHandler) +}; + +#if wxUSE_ICO_CUR +// ---------------------------------------------------------------------------- +// wxICOHandler +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxICOHandler : public wxBMPHandler +{ +public: + wxICOHandler() + { + m_name = _T("Windows icon file"); + m_extension = _T("ico"); + m_type = wxBITMAP_TYPE_ICO; + m_mime = _T("image/x-ico"); + } + +#if wxUSE_STREAMS + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); + virtual int GetImageCount( wxInputStream& stream ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif // wxUSE_STREAMS + +private: + DECLARE_DYNAMIC_CLASS(wxICOHandler) +}; + + +// ---------------------------------------------------------------------------- +// wxCURHandler +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCURHandler : public wxICOHandler +{ +public: + wxCURHandler() + { + m_name = _T("Windows cursor file"); + m_extension = _T("cur"); + m_type = wxBITMAP_TYPE_CUR; + m_mime = _T("image/x-cur"); + } + + // VS: This handler's meat is implemented inside wxICOHandler (the two + // formats are almost identical), but we hide this fact at + // the API level, since it is a mere implementation detail. + +protected: +#if wxUSE_STREAMS + virtual bool DoCanRead( wxInputStream& stream ); +#endif // wxUSE_STREAMS + +private: + DECLARE_DYNAMIC_CLASS(wxCURHandler) +}; +// ---------------------------------------------------------------------------- +// wxANIHandler +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxANIHandler : public wxCURHandler +{ +public: + wxANIHandler() + { + m_name = _T("Windows animated cursor file"); + m_extension = _T("ani"); + m_type = wxBITMAP_TYPE_ANI; + m_mime = _T("image/x-ani"); + } + + +#if wxUSE_STREAMS + virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;} + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual int GetImageCount( wxInputStream& stream ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif // wxUSE_STREAMS + +private: + DECLARE_DYNAMIC_CLASS(wxANIHandler) +}; + +#endif // wxUSE_ICO_CUR +#endif // _WX_IMAGBMP_H_ diff --git a/Externals/wxWidgets/include/wx/image.h b/Externals/wxWidgets/include/wx/image.h index cce2d6c1e1..8048da4420 100644 --- a/Externals/wxWidgets/include/wx/image.h +++ b/Externals/wxWidgets/include/wx/image.h @@ -1,454 +1,454 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/image.h -// Purpose: wxImage class -// Author: Robert Roebling -// RCS-ID: $Id: image.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGE_H_ -#define _WX_IMAGE_H_ - -#include "wx/defs.h" - -#if wxUSE_IMAGE - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/gdicmn.h" -#include "wx/hashmap.h" - -#if wxUSE_STREAMS -# include "wx/stream.h" -#endif - -// on some systems (Unixware 7.x) index is defined as a macro in the headers -// which breaks the compilation below -#undef index - -#define wxIMAGE_OPTION_QUALITY wxString(_T("quality")) -#define wxIMAGE_OPTION_FILENAME wxString(_T("FileName")) - -#define wxIMAGE_OPTION_RESOLUTION wxString(_T("Resolution")) -#define wxIMAGE_OPTION_RESOLUTIONX wxString(_T("ResolutionX")) -#define wxIMAGE_OPTION_RESOLUTIONY wxString(_T("ResolutionY")) - -#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(_T("ResolutionUnit")) - -// constants used with wxIMAGE_OPTION_RESOLUTIONUNIT -enum -{ - wxIMAGE_RESOLUTION_INCHES = 1, - wxIMAGE_RESOLUTION_CM = 2 -}; - -// Constants for wxImage::Scale() for determining the level of quality -enum -{ - wxIMAGE_QUALITY_NORMAL = 0, - wxIMAGE_QUALITY_HIGH = 1 -}; - -// alpha channel values: fully transparent, default threshold separating -// transparent pixels from opaque for a few functions dealing with alpha and -// fully opaque -const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0; -const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80; -const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff; - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxImageHandler; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -//----------------------------------------------------------------------------- -// wxVariant support -//----------------------------------------------------------------------------- - -#if wxUSE_VARIANT -#include "wx/variant.h" -DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT) -#endif - -//----------------------------------------------------------------------------- -// wxImageHandler -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxImageHandler: public wxObject -{ -public: - wxImageHandler() - : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(0) - { } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - - virtual int GetImageCount( wxInputStream& stream ); - - bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); } - bool CanRead( const wxString& name ); -#endif // wxUSE_STREAMS - - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(long type) { m_type = type; } - void SetMimeType(const wxString& type) { m_mime = type; } - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - long GetType() const { return m_type; } - const wxString& GetMimeType() const { return m_mime; } - -protected: -#if wxUSE_STREAMS - virtual bool DoCanRead( wxInputStream& stream ) = 0; - - // save the stream position, call DoCanRead() and restore the position - bool CallDoCanRead(wxInputStream& stream); -#endif // wxUSE_STREAMS - - wxString m_name; - wxString m_extension; - wxString m_mime; - long m_type; - -private: - DECLARE_CLASS(wxImageHandler) -}; - -//----------------------------------------------------------------------------- -// wxImageHistogram -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxImageHistogramEntry -{ -public: - wxImageHistogramEntry() { index = value = 0; } - unsigned long index; - unsigned long value; -}; - -WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry, - wxIntegerHash, wxIntegerEqual, - wxImageHistogramBase); - -class WXDLLEXPORT wxImageHistogram : public wxImageHistogramBase -{ -public: - wxImageHistogram() : wxImageHistogramBase(256) { } - - // get the key in the histogram for the given RGB values - static unsigned long MakeKey(unsigned char r, - unsigned char g, - unsigned char b) - { - return (r << 16) | (g << 8) | b; - } - - // find first colour that is not used in the image and has higher - // RGB values than RGB(startR, startG, startB) - // - // returns true and puts this colour in r, g, b (each of which may be NULL) - // on success or returns false if there are no more free colours - bool FindFirstUnusedColour(unsigned char *r, - unsigned char *g, - unsigned char *b, - unsigned char startR = 1, - unsigned char startG = 0, - unsigned char startB = 0 ) const; -}; - -//----------------------------------------------------------------------------- -// wxImage -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxImage: public wxObject -{ -public: - // red, green and blue are 8 bit unsigned integers in the range of 0..255 - // We use the identifier RGBValue instead of RGB, since RGB is #defined - class RGBValue - { - public: - RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0) - : red(r), green(g), blue(b) {} - unsigned char red; - unsigned char green; - unsigned char blue; - }; - - // hue, saturation and value are doubles in the range 0.0..1.0 - class HSVValue - { - public: - HSVValue(double h=0.0, double s=0.0, double v=0.0) - : hue(h), saturation(s), value(v) {} - double hue; - double saturation; - double value; - }; - - wxImage(){} - wxImage( int width, int height, bool clear = true ); - wxImage( int width, int height, unsigned char* data, bool static_data = false ); - wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); - wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - wxImage( const wxString& name, const wxString& mimetype, int index = -1 ); - wxImage( const char* const* xpmData ); - -#if wxUSE_STREAMS - wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 ); -#endif // wxUSE_STREAMS - - bool Create( int width, int height, bool clear = true ); - bool Create( int width, int height, unsigned char* data, bool static_data = false ); - bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); - bool Create( const char* const* xpmData ); -#ifdef __BORLANDC__ - // needed for Borland 5.5 - wxImage( char** xpmData ) { Create(wx_const_cast(const char* const*, xpmData)); } - bool Create( char** xpmData ) { return Create(wx_const_cast(const char* const*, xpmData)); } -#endif - void Destroy(); - - // creates an identical copy of the image (the = operator - // just raises the ref count) - wxImage Copy() const; - - // return the new image with size width*height - wxImage GetSubImage( const wxRect& rect) const; - - // Paste the image or part of this image into an image of the given size at the pos - // any newly exposed areas will be filled with the rgb colour - // by default if r = g = b = -1 then fill with this image's mask colour or find and - // set a suitable mask colour - wxImage Size( const wxSize& size, const wxPoint& pos, - int r = -1, int g = -1, int b = -1 ) const; - - // pastes image into this instance and takes care of - // the mask colour and out of bounds problems - void Paste( const wxImage &image, int x, int y ); - - // return the new image with size width*height - wxImage Scale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) const; - - // box averager and bicubic filters for up/down sampling - wxImage ResampleBox(int width, int height) const; - wxImage ResampleBicubic(int width, int height) const; - - // blur the image according to the specified pixel radius - wxImage Blur(int radius); - wxImage BlurHorizontal(int radius); - wxImage BlurVertical(int radius); - - wxImage ShrinkBy( int xFactor , int yFactor ) const ; - - // rescales the image in place - wxImage& Rescale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) { return *this = Scale(width, height, quality); } - - // resizes the image in place - wxImage& Resize( const wxSize& size, const wxPoint& pos, - int r = -1, int g = -1, int b = -1 ) { return *this = Size(size, pos, r, g, b); } - - // Rotates the image about the given point, 'angle' radians. - // Returns the rotated image, leaving this image intact. - wxImage Rotate(double angle, const wxPoint & centre_of_rotation, - bool interpolating = true, wxPoint * offset_after_rotation = (wxPoint*) NULL) const; - - wxImage Rotate90( bool clockwise = true ) const; - wxImage Mirror( bool horizontally = true ) const; - - // replace one colour with another - void Replace( unsigned char r1, unsigned char g1, unsigned char b1, - unsigned char r2, unsigned char g2, unsigned char b2 ); - - // Convert to greyscale image. Uses the luminance component (Y) of the image. - // The luma value (YUV) is calculated using (R * lr) + (G * lg) + (B * lb), defaults to ITU-T BT.601 - wxImage ConvertToGreyscale( double lr = 0.299, double lg = 0.587, double lb = 0.114 ) const; - - // convert to monochrome image (<r,g,b> will be replaced by white, - // everything else by black) - wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const; - - // these routines are slow but safe - void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); - void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b ); - unsigned char GetRed( int x, int y ) const; - unsigned char GetGreen( int x, int y ) const; - unsigned char GetBlue( int x, int y ) const; - - void SetAlpha(int x, int y, unsigned char alpha); - unsigned char GetAlpha(int x, int y) const; - - // find first colour that is not used in the image and has higher - // RGB values than <startR,startG,startB> - bool FindFirstUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b, - unsigned char startR = 1, unsigned char startG = 0, - unsigned char startB = 0 ) const; - // Set image's mask to the area of 'mask' that has <r,g,b> colour - bool SetMaskFromImage(const wxImage & mask, - unsigned char mr, unsigned char mg, unsigned char mb); - - // converts image's alpha channel to mask, if it has any, does nothing - // otherwise: - bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); - - // This method converts an image where the original alpha - // information is only available as a shades of a colour - // (actually shades of grey) typically when you draw anti- - // aliased text into a bitmap. The DC drawinf routines - // draw grey values on the black background although they - // actually mean to draw white with differnt alpha values. - // This method reverses it, assuming a black (!) background - // and white text (actually only the red channel is read). - // The method will then fill up the whole image with the - // colour given. - bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); - - static bool CanRead( const wxString& name ); - static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY ); - virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 ); - -#if wxUSE_STREAMS - static bool CanRead( wxInputStream& stream ); - static int GetImageCount( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY ); - virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); - virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 ); -#endif - - virtual bool SaveFile( const wxString& name ) const; - virtual bool SaveFile( const wxString& name, int type ) const; - virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const; - -#if wxUSE_STREAMS - virtual bool SaveFile( wxOutputStream& stream, int type ) const; - virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const; -#endif - - bool Ok() const { return IsOk(); } - bool IsOk() const; - int GetWidth() const; - int GetHeight() const; - - // these functions provide fastest access to wxImage data but should be - // used carefully as no checks are done - unsigned char *GetData() const; - void SetData( unsigned char *data, bool static_data=false ); - void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false ); - - unsigned char *GetAlpha() const; // may return NULL! - bool HasAlpha() const { return GetAlpha() != NULL; } - void SetAlpha(unsigned char *alpha = NULL, bool static_data=false); - void InitAlpha(); - - // return true if this pixel is masked or has alpha less than specified - // threshold - bool IsTransparent(int x, int y, - unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const; - - // Mask functions - void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); - // Get the current mask colour or find a suitable colour - // returns true if using current mask colour - bool GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const; - unsigned char GetMaskRed() const; - unsigned char GetMaskGreen() const; - unsigned char GetMaskBlue() const; - void SetMask( bool mask = true ); - bool HasMask() const; - -#if wxUSE_PALETTE - // Palette functions - bool HasPalette() const; - const wxPalette& GetPalette() const; - void SetPalette(const wxPalette& palette); -#endif // wxUSE_PALETTE - - // Option functions (arbitrary name/value mapping) - void SetOption(const wxString& name, const wxString& value); - void SetOption(const wxString& name, int value); - wxString GetOption(const wxString& name) const; - int GetOptionInt(const wxString& name) const; - bool HasOption(const wxString& name) const; - - unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const; - - // Computes the histogram of the image and fills a hash table, indexed - // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry - // objects. Each of them contains an 'index' (useful to build a palette - // with the image colours) and a 'value', which is the number of pixels - // in the image with that colour. - // Returned value: # of entries in the histogram - unsigned long ComputeHistogram( wxImageHistogram &h ) const; - - // Rotates the hue of each pixel of the image. angle is a double in the range - // -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees - void RotateHue(double angle); - - static wxList& GetHandlers() { return sm_handlers; } - static void AddHandler( wxImageHandler *handler ); - static void InsertHandler( wxImageHandler *handler ); - static bool RemoveHandler( const wxString& name ); - static wxImageHandler *FindHandler( const wxString& name ); - static wxImageHandler *FindHandler( const wxString& extension, long imageType ); - static wxImageHandler *FindHandler( long imageType ); - static wxImageHandler *FindHandlerMime( const wxString& mimetype ); - - static wxString GetImageExtWildcard(); - - static void CleanUpHandlers(); - static void InitStandardHandlers(); - - static HSVValue RGBtoHSV(const RGBValue& rgb); - static RGBValue HSVtoRGB(const HSVValue& hsv); - - -protected: - static wxList sm_handlers; - - // return the index of the point with the given coordinates or -1 if the - // image is invalid of the coordinates are out of range - // - // note that index must be multiplied by 3 when using it with RGB array - long XYToIndex(int x, int y) const; - - virtual wxObjectRefData* CreateRefData() const; - virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxImageHandler; - - DECLARE_DYNAMIC_CLASS(wxImage) -}; - - -extern void WXDLLEXPORT wxInitAllImageHandlers(); - -extern WXDLLEXPORT_DATA(wxImage) wxNullImage; - -//----------------------------------------------------------------------------- -// wxImage handlers -//----------------------------------------------------------------------------- - -#include "wx/imagbmp.h" -#include "wx/imagpng.h" -#include "wx/imaggif.h" -#include "wx/imagpcx.h" -#include "wx/imagjpeg.h" -#include "wx/imagtga.h" -#include "wx/imagtiff.h" -#include "wx/imagpnm.h" -#include "wx/imagxpm.h" -#include "wx/imagiff.h" - -#endif // wxUSE_IMAGE - -#endif - // _WX_IMAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/image.h +// Purpose: wxImage class +// Author: Robert Roebling +// RCS-ID: $Id: image.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGE_H_ +#define _WX_IMAGE_H_ + +#include "wx/defs.h" + +#if wxUSE_IMAGE + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdicmn.h" +#include "wx/hashmap.h" + +#if wxUSE_STREAMS +# include "wx/stream.h" +#endif + +// on some systems (Unixware 7.x) index is defined as a macro in the headers +// which breaks the compilation below +#undef index + +#define wxIMAGE_OPTION_QUALITY wxString(_T("quality")) +#define wxIMAGE_OPTION_FILENAME wxString(_T("FileName")) + +#define wxIMAGE_OPTION_RESOLUTION wxString(_T("Resolution")) +#define wxIMAGE_OPTION_RESOLUTIONX wxString(_T("ResolutionX")) +#define wxIMAGE_OPTION_RESOLUTIONY wxString(_T("ResolutionY")) + +#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(_T("ResolutionUnit")) + +// constants used with wxIMAGE_OPTION_RESOLUTIONUNIT +enum +{ + wxIMAGE_RESOLUTION_INCHES = 1, + wxIMAGE_RESOLUTION_CM = 2 +}; + +// Constants for wxImage::Scale() for determining the level of quality +enum +{ + wxIMAGE_QUALITY_NORMAL = 0, + wxIMAGE_QUALITY_HIGH = 1 +}; + +// alpha channel values: fully transparent, default threshold separating +// transparent pixels from opaque for a few functions dealing with alpha and +// fully opaque +const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0; +const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80; +const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff; + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxImageHandler; +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxPalette; + +//----------------------------------------------------------------------------- +// wxVariant support +//----------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT) +#endif + +//----------------------------------------------------------------------------- +// wxImageHandler +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxImageHandler: public wxObject +{ +public: + wxImageHandler() + : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(0) + { } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + + virtual int GetImageCount( wxInputStream& stream ); + + bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); } + bool CanRead( const wxString& name ); +#endif // wxUSE_STREAMS + + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(long type) { m_type = type; } + void SetMimeType(const wxString& type) { m_mime = type; } + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + long GetType() const { return m_type; } + const wxString& GetMimeType() const { return m_mime; } + +protected: +#if wxUSE_STREAMS + virtual bool DoCanRead( wxInputStream& stream ) = 0; + + // save the stream position, call DoCanRead() and restore the position + bool CallDoCanRead(wxInputStream& stream); +#endif // wxUSE_STREAMS + + wxString m_name; + wxString m_extension; + wxString m_mime; + long m_type; + +private: + DECLARE_CLASS(wxImageHandler) +}; + +//----------------------------------------------------------------------------- +// wxImageHistogram +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxImageHistogramEntry +{ +public: + wxImageHistogramEntry() { index = value = 0; } + unsigned long index; + unsigned long value; +}; + +WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry, + wxIntegerHash, wxIntegerEqual, + wxImageHistogramBase); + +class WXDLLEXPORT wxImageHistogram : public wxImageHistogramBase +{ +public: + wxImageHistogram() : wxImageHistogramBase(256) { } + + // get the key in the histogram for the given RGB values + static unsigned long MakeKey(unsigned char r, + unsigned char g, + unsigned char b) + { + return (r << 16) | (g << 8) | b; + } + + // find first colour that is not used in the image and has higher + // RGB values than RGB(startR, startG, startB) + // + // returns true and puts this colour in r, g, b (each of which may be NULL) + // on success or returns false if there are no more free colours + bool FindFirstUnusedColour(unsigned char *r, + unsigned char *g, + unsigned char *b, + unsigned char startR = 1, + unsigned char startG = 0, + unsigned char startB = 0 ) const; +}; + +//----------------------------------------------------------------------------- +// wxImage +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxImage: public wxObject +{ +public: + // red, green and blue are 8 bit unsigned integers in the range of 0..255 + // We use the identifier RGBValue instead of RGB, since RGB is #defined + class RGBValue + { + public: + RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0) + : red(r), green(g), blue(b) {} + unsigned char red; + unsigned char green; + unsigned char blue; + }; + + // hue, saturation and value are doubles in the range 0.0..1.0 + class HSVValue + { + public: + HSVValue(double h=0.0, double s=0.0, double v=0.0) + : hue(h), saturation(s), value(v) {} + double hue; + double saturation; + double value; + }; + + wxImage(){} + wxImage( int width, int height, bool clear = true ); + wxImage( int width, int height, unsigned char* data, bool static_data = false ); + wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); + wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); + wxImage( const wxString& name, const wxString& mimetype, int index = -1 ); + wxImage( const char* const* xpmData ); + +#if wxUSE_STREAMS + wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); + wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 ); +#endif // wxUSE_STREAMS + + bool Create( int width, int height, bool clear = true ); + bool Create( int width, int height, unsigned char* data, bool static_data = false ); + bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); + bool Create( const char* const* xpmData ); +#ifdef __BORLANDC__ + // needed for Borland 5.5 + wxImage( char** xpmData ) { Create(wx_const_cast(const char* const*, xpmData)); } + bool Create( char** xpmData ) { return Create(wx_const_cast(const char* const*, xpmData)); } +#endif + void Destroy(); + + // creates an identical copy of the image (the = operator + // just raises the ref count) + wxImage Copy() const; + + // return the new image with size width*height + wxImage GetSubImage( const wxRect& rect) const; + + // Paste the image or part of this image into an image of the given size at the pos + // any newly exposed areas will be filled with the rgb colour + // by default if r = g = b = -1 then fill with this image's mask colour or find and + // set a suitable mask colour + wxImage Size( const wxSize& size, const wxPoint& pos, + int r = -1, int g = -1, int b = -1 ) const; + + // pastes image into this instance and takes care of + // the mask colour and out of bounds problems + void Paste( const wxImage &image, int x, int y ); + + // return the new image with size width*height + wxImage Scale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) const; + + // box averager and bicubic filters for up/down sampling + wxImage ResampleBox(int width, int height) const; + wxImage ResampleBicubic(int width, int height) const; + + // blur the image according to the specified pixel radius + wxImage Blur(int radius); + wxImage BlurHorizontal(int radius); + wxImage BlurVertical(int radius); + + wxImage ShrinkBy( int xFactor , int yFactor ) const ; + + // rescales the image in place + wxImage& Rescale( int width, int height, int quality = wxIMAGE_QUALITY_NORMAL ) { return *this = Scale(width, height, quality); } + + // resizes the image in place + wxImage& Resize( const wxSize& size, const wxPoint& pos, + int r = -1, int g = -1, int b = -1 ) { return *this = Size(size, pos, r, g, b); } + + // Rotates the image about the given point, 'angle' radians. + // Returns the rotated image, leaving this image intact. + wxImage Rotate(double angle, const wxPoint & centre_of_rotation, + bool interpolating = true, wxPoint * offset_after_rotation = (wxPoint*) NULL) const; + + wxImage Rotate90( bool clockwise = true ) const; + wxImage Mirror( bool horizontally = true ) const; + + // replace one colour with another + void Replace( unsigned char r1, unsigned char g1, unsigned char b1, + unsigned char r2, unsigned char g2, unsigned char b2 ); + + // Convert to greyscale image. Uses the luminance component (Y) of the image. + // The luma value (YUV) is calculated using (R * lr) + (G * lg) + (B * lb), defaults to ITU-T BT.601 + wxImage ConvertToGreyscale( double lr = 0.299, double lg = 0.587, double lb = 0.114 ) const; + + // convert to monochrome image (<r,g,b> will be replaced by white, + // everything else by black) + wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const; + + // these routines are slow but safe + void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); + void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b ); + unsigned char GetRed( int x, int y ) const; + unsigned char GetGreen( int x, int y ) const; + unsigned char GetBlue( int x, int y ) const; + + void SetAlpha(int x, int y, unsigned char alpha); + unsigned char GetAlpha(int x, int y) const; + + // find first colour that is not used in the image and has higher + // RGB values than <startR,startG,startB> + bool FindFirstUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b, + unsigned char startR = 1, unsigned char startG = 0, + unsigned char startB = 0 ) const; + // Set image's mask to the area of 'mask' that has <r,g,b> colour + bool SetMaskFromImage(const wxImage & mask, + unsigned char mr, unsigned char mg, unsigned char mb); + + // converts image's alpha channel to mask, if it has any, does nothing + // otherwise: + bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); + + // This method converts an image where the original alpha + // information is only available as a shades of a colour + // (actually shades of grey) typically when you draw anti- + // aliased text into a bitmap. The DC drawinf routines + // draw grey values on the black background although they + // actually mean to draw white with differnt alpha values. + // This method reverses it, assuming a black (!) background + // and white text (actually only the red channel is read). + // The method will then fill up the whole image with the + // colour given. + bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); + + static bool CanRead( const wxString& name ); + static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY ); + virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); + virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 ); + +#if wxUSE_STREAMS + static bool CanRead( wxInputStream& stream ); + static int GetImageCount( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY ); + virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 ); + virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 ); +#endif + + virtual bool SaveFile( const wxString& name ) const; + virtual bool SaveFile( const wxString& name, int type ) const; + virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const; + +#if wxUSE_STREAMS + virtual bool SaveFile( wxOutputStream& stream, int type ) const; + virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const; +#endif + + bool Ok() const { return IsOk(); } + bool IsOk() const; + int GetWidth() const; + int GetHeight() const; + + // these functions provide fastest access to wxImage data but should be + // used carefully as no checks are done + unsigned char *GetData() const; + void SetData( unsigned char *data, bool static_data=false ); + void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false ); + + unsigned char *GetAlpha() const; // may return NULL! + bool HasAlpha() const { return GetAlpha() != NULL; } + void SetAlpha(unsigned char *alpha = NULL, bool static_data=false); + void InitAlpha(); + + // return true if this pixel is masked or has alpha less than specified + // threshold + bool IsTransparent(int x, int y, + unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const; + + // Mask functions + void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); + // Get the current mask colour or find a suitable colour + // returns true if using current mask colour + bool GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const; + unsigned char GetMaskRed() const; + unsigned char GetMaskGreen() const; + unsigned char GetMaskBlue() const; + void SetMask( bool mask = true ); + bool HasMask() const; + +#if wxUSE_PALETTE + // Palette functions + bool HasPalette() const; + const wxPalette& GetPalette() const; + void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + // Option functions (arbitrary name/value mapping) + void SetOption(const wxString& name, const wxString& value); + void SetOption(const wxString& name, int value); + wxString GetOption(const wxString& name) const; + int GetOptionInt(const wxString& name) const; + bool HasOption(const wxString& name) const; + + unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const; + + // Computes the histogram of the image and fills a hash table, indexed + // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry + // objects. Each of them contains an 'index' (useful to build a palette + // with the image colours) and a 'value', which is the number of pixels + // in the image with that colour. + // Returned value: # of entries in the histogram + unsigned long ComputeHistogram( wxImageHistogram &h ) const; + + // Rotates the hue of each pixel of the image. angle is a double in the range + // -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees + void RotateHue(double angle); + + static wxList& GetHandlers() { return sm_handlers; } + static void AddHandler( wxImageHandler *handler ); + static void InsertHandler( wxImageHandler *handler ); + static bool RemoveHandler( const wxString& name ); + static wxImageHandler *FindHandler( const wxString& name ); + static wxImageHandler *FindHandler( const wxString& extension, long imageType ); + static wxImageHandler *FindHandler( long imageType ); + static wxImageHandler *FindHandlerMime( const wxString& mimetype ); + + static wxString GetImageExtWildcard(); + + static void CleanUpHandlers(); + static void InitStandardHandlers(); + + static HSVValue RGBtoHSV(const RGBValue& rgb); + static RGBValue HSVtoRGB(const HSVValue& hsv); + + +protected: + static wxList sm_handlers; + + // return the index of the point with the given coordinates or -1 if the + // image is invalid of the coordinates are out of range + // + // note that index must be multiplied by 3 when using it with RGB array + long XYToIndex(int x, int y) const; + + virtual wxObjectRefData* CreateRefData() const; + virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxImageHandler; + + DECLARE_DYNAMIC_CLASS(wxImage) +}; + + +extern void WXDLLEXPORT wxInitAllImageHandlers(); + +extern WXDLLEXPORT_DATA(wxImage) wxNullImage; + +//----------------------------------------------------------------------------- +// wxImage handlers +//----------------------------------------------------------------------------- + +#include "wx/imagbmp.h" +#include "wx/imagpng.h" +#include "wx/imaggif.h" +#include "wx/imagpcx.h" +#include "wx/imagjpeg.h" +#include "wx/imagtga.h" +#include "wx/imagtiff.h" +#include "wx/imagpnm.h" +#include "wx/imagxpm.h" +#include "wx/imagiff.h" + +#endif // wxUSE_IMAGE + +#endif + // _WX_IMAGE_H_ diff --git a/Externals/wxWidgets/include/wx/imaggif.h b/Externals/wxWidgets/include/wx/imaggif.h index 21b58e6181..3a3e44db03 100644 --- a/Externals/wxWidgets/include/wx/imaggif.h +++ b/Externals/wxWidgets/include/wx/imaggif.h @@ -1,48 +1,48 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaggif.h -// Purpose: wxImage GIF handler -// Author: Vaclav Slavik & Guillermo Rodriguez Garcia -// RCS-ID: $Id: imaggif.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGGIF_H_ -#define _WX_IMAGGIF_H_ - -#include "wx/image.h" - - -//----------------------------------------------------------------------------- -// wxGIFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_GIF - -class WXDLLEXPORT wxGIFHandler : public wxImageHandler -{ -public: - inline wxGIFHandler() - { - m_name = wxT("GIF file"); - m_extension = wxT("gif"); - m_type = wxBITMAP_TYPE_GIF; - m_mime = wxT("image/gif"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxGIFHandler) -}; -#endif - - -#endif - // _WX_IMAGGIF_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imaggif.h +// Purpose: wxImage GIF handler +// Author: Vaclav Slavik & Guillermo Rodriguez Garcia +// RCS-ID: $Id: imaggif.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGGIF_H_ +#define _WX_IMAGGIF_H_ + +#include "wx/image.h" + + +//----------------------------------------------------------------------------- +// wxGIFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_GIF + +class WXDLLEXPORT wxGIFHandler : public wxImageHandler +{ +public: + inline wxGIFHandler() + { + m_name = wxT("GIF file"); + m_extension = wxT("gif"); + m_type = wxBITMAP_TYPE_GIF; + m_mime = wxT("image/gif"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxGIFHandler) +}; +#endif + + +#endif + // _WX_IMAGGIF_H_ + diff --git a/Externals/wxWidgets/include/wx/imagiff.h b/Externals/wxWidgets/include/wx/imagiff.h index 6b47da7352..d7920c2c04 100644 --- a/Externals/wxWidgets/include/wx/imagiff.h +++ b/Externals/wxWidgets/include/wx/imagiff.h @@ -1,44 +1,44 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagiff.h -// Purpose: wxImage handler for Amiga IFF images -// Author: Steffen Gutmann -// RCS-ID: $Id: imagiff.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Steffen Gutmann, 2002 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGE_IFF_H_ -#define _WX_IMAGE_IFF_H_ - -#include "wx/image.h" - -//----------------------------------------------------------------------------- -// wxIFFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_IMAGE && wxUSE_IFF - -class WXDLLEXPORT wxIFFHandler : public wxImageHandler -{ -public: - wxIFFHandler() - { - m_name = wxT("IFF file"); - m_extension = wxT("iff"); - m_type = wxBITMAP_TYPE_IFF; - m_mime = wxT("image/x-iff"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); - virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); - virtual bool DoCanRead(wxInputStream& stream); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxIFFHandler) -}; - -#endif // wxUSE_IMAGE && wxUSE_IFF - -#endif // _WX_IMAGE_IFF_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: imagiff.h +// Purpose: wxImage handler for Amiga IFF images +// Author: Steffen Gutmann +// RCS-ID: $Id: imagiff.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Steffen Gutmann, 2002 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGE_IFF_H_ +#define _WX_IMAGE_IFF_H_ + +#include "wx/image.h" + +//----------------------------------------------------------------------------- +// wxIFFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_IMAGE && wxUSE_IFF + +class WXDLLEXPORT wxIFFHandler : public wxImageHandler +{ +public: + wxIFFHandler() + { + m_name = wxT("IFF file"); + m_extension = wxT("iff"); + m_type = wxBITMAP_TYPE_IFF; + m_mime = wxT("image/x-iff"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + virtual bool DoCanRead(wxInputStream& stream); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxIFFHandler) +}; + +#endif // wxUSE_IMAGE && wxUSE_IFF + +#endif // _WX_IMAGE_IFF_H_ diff --git a/Externals/wxWidgets/include/wx/imagjpeg.h b/Externals/wxWidgets/include/wx/imagjpeg.h index 410b7cc932..06880683ce 100644 --- a/Externals/wxWidgets/include/wx/imagjpeg.h +++ b/Externals/wxWidgets/include/wx/imagjpeg.h @@ -1,48 +1,48 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagjpeg.h -// Purpose: wxImage JPEG handler -// Author: Vaclav Slavik -// RCS-ID: $Id: imagjpeg.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGJPEG_H_ -#define _WX_IMAGJPEG_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxJPEGHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBJPEG - -#include "wx/image.h" - -class WXDLLEXPORT wxJPEGHandler: public wxImageHandler -{ -public: - inline wxJPEGHandler() - { - m_name = wxT("JPEG file"); - m_extension = wxT("jpg"); - m_type = wxBITMAP_TYPE_JPEG; - m_mime = wxT("image/jpeg"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxJPEGHandler) -}; - -#endif // wxUSE_LIBJPEG - -#endif // _WX_IMAGJPEG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imagjpeg.h +// Purpose: wxImage JPEG handler +// Author: Vaclav Slavik +// RCS-ID: $Id: imagjpeg.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGJPEG_H_ +#define _WX_IMAGJPEG_H_ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// wxJPEGHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBJPEG + +#include "wx/image.h" + +class WXDLLEXPORT wxJPEGHandler: public wxImageHandler +{ +public: + inline wxJPEGHandler() + { + m_name = wxT("JPEG file"); + m_extension = wxT("jpg"); + m_type = wxBITMAP_TYPE_JPEG; + m_mime = wxT("image/jpeg"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxJPEGHandler) +}; + +#endif // wxUSE_LIBJPEG + +#endif // _WX_IMAGJPEG_H_ + diff --git a/Externals/wxWidgets/include/wx/imaglist.h b/Externals/wxWidgets/include/wx/imaglist.h index 91cf8eac65..7c3c24ea36 100644 --- a/Externals/wxWidgets/include/wx/imaglist.h +++ b/Externals/wxWidgets/include/wx/imaglist.h @@ -1,55 +1,55 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/imaglist.h -// Purpose: wxImageList base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: imaglist.h 41288 2006-09-18 23:06:35Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_BASE_ -#define _WX_IMAGLIST_H_BASE_ - -/* - * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to - * images for their items by an index into an image list. - * A wxImageList is capable of creating images with optional masks from - * a variety of sources - a single bitmap plus a colour to indicate the mask, - * two bitmaps, or an icon. - * - * Image lists can also create and draw images used for drag and drop functionality. - * This is not yet implemented in wxImageList. We need to discuss a generic API - * for doing drag and drop and see whether it ties in with the Win95 view of it. - * See below for candidate functions and an explanation of how they might be - * used. - */ - -// Flag values for Set/GetImageList -enum -{ - wxIMAGE_LIST_NORMAL, // Normal icons - wxIMAGE_LIST_SMALL, // Small icons - wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) -}; - -// Flags for Draw -#define wxIMAGELIST_DRAW_NORMAL 0x0001 -#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 -#define wxIMAGELIST_DRAW_SELECTED 0x0004 -#define wxIMAGELIST_DRAW_FOCUSED 0x0008 - -#if defined(__WXMSW__) || defined(__WXMAC_CARBON__) - #define wxHAS_NATIVE_IMAGELIST -#endif - -#if !defined(wxHAS_NATIVE_IMAGELIST) - #include "wx/generic/imaglist.h" -#elif defined(__WXMSW__) - #include "wx/msw/imaglist.h" -#elif defined(__WXMAC_CARBON__) - #include "wx/mac/imaglist.h" -#endif - -#endif // _WX_IMAGLIST_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imaglist.h +// Purpose: wxImageList base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: imaglist.h 41288 2006-09-18 23:06:35Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_BASE_ +#define _WX_IMAGLIST_H_BASE_ + +/* + * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to + * images for their items by an index into an image list. + * A wxImageList is capable of creating images with optional masks from + * a variety of sources - a single bitmap plus a colour to indicate the mask, + * two bitmaps, or an icon. + * + * Image lists can also create and draw images used for drag and drop functionality. + * This is not yet implemented in wxImageList. We need to discuss a generic API + * for doing drag and drop and see whether it ties in with the Win95 view of it. + * See below for candidate functions and an explanation of how they might be + * used. + */ + +// Flag values for Set/GetImageList +enum +{ + wxIMAGE_LIST_NORMAL, // Normal icons + wxIMAGE_LIST_SMALL, // Small icons + wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) +}; + +// Flags for Draw +#define wxIMAGELIST_DRAW_NORMAL 0x0001 +#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 +#define wxIMAGELIST_DRAW_SELECTED 0x0004 +#define wxIMAGELIST_DRAW_FOCUSED 0x0008 + +#if defined(__WXMSW__) || defined(__WXMAC_CARBON__) + #define wxHAS_NATIVE_IMAGELIST +#endif + +#if !defined(wxHAS_NATIVE_IMAGELIST) + #include "wx/generic/imaglist.h" +#elif defined(__WXMSW__) + #include "wx/msw/imaglist.h" +#elif defined(__WXMAC_CARBON__) + #include "wx/mac/imaglist.h" +#endif + +#endif // _WX_IMAGLIST_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/imagpcx.h b/Externals/wxWidgets/include/wx/imagpcx.h index f56048f84f..c35fe0973f 100644 --- a/Externals/wxWidgets/include/wx/imagpcx.h +++ b/Externals/wxWidgets/include/wx/imagpcx.h @@ -1,47 +1,47 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagpcx.h -// Purpose: wxImage PCX handler -// Author: Guillermo Rodriguez Garcia <guille@iies.es> -// RCS-ID: $Id: imagpcx.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 1999 Guillermo Rodriguez Garcia -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGPCX_H_ -#define _WX_IMAGPCX_H_ - -#include "wx/image.h" - - -//----------------------------------------------------------------------------- -// wxPCXHandler -//----------------------------------------------------------------------------- - -#if wxUSE_PCX -class WXDLLEXPORT wxPCXHandler : public wxImageHandler -{ -public: - inline wxPCXHandler() - { - m_name = wxT("PCX file"); - m_extension = wxT("pcx"); - m_type = wxBITMAP_TYPE_PCX; - m_mime = wxT("image/pcx"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif // wxUSE_STREAMS - -private: - DECLARE_DYNAMIC_CLASS(wxPCXHandler) -}; -#endif // wxUSE_PCX - - -#endif - // _WX_IMAGPCX_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imagpcx.h +// Purpose: wxImage PCX handler +// Author: Guillermo Rodriguez Garcia <guille@iies.es> +// RCS-ID: $Id: imagpcx.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 1999 Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGPCX_H_ +#define _WX_IMAGPCX_H_ + +#include "wx/image.h" + + +//----------------------------------------------------------------------------- +// wxPCXHandler +//----------------------------------------------------------------------------- + +#if wxUSE_PCX +class WXDLLEXPORT wxPCXHandler : public wxImageHandler +{ +public: + inline wxPCXHandler() + { + m_name = wxT("PCX file"); + m_extension = wxT("pcx"); + m_type = wxBITMAP_TYPE_PCX; + m_mime = wxT("image/pcx"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif // wxUSE_STREAMS + +private: + DECLARE_DYNAMIC_CLASS(wxPCXHandler) +}; +#endif // wxUSE_PCX + + +#endif + // _WX_IMAGPCX_H_ + diff --git a/Externals/wxWidgets/include/wx/imagpng.h b/Externals/wxWidgets/include/wx/imagpng.h index daea3a26f5..5252e3aa0a 100644 --- a/Externals/wxWidgets/include/wx/imagpng.h +++ b/Externals/wxWidgets/include/wx/imagpng.h @@ -1,60 +1,60 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagpng.h -// Purpose: wxImage PNG handler -// Author: Robert Roebling -// RCS-ID: $Id: imagpng.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGPNG_H_ -#define _WX_IMAGPNG_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxPNGHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBPNG - -#include "wx/image.h" - -#define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") -#define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") - -enum -{ - wxPNG_TYPE_COLOUR = 0, - wxPNG_TYPE_GREY = 2, - wxPNG_TYPE_GREY_RED = 3 -}; - -class WXDLLEXPORT wxPNGHandler: public wxImageHandler -{ -public: - inline wxPNGHandler() - { - m_name = wxT("PNG file"); - m_extension = wxT("png"); - m_type = wxBITMAP_TYPE_PNG; - m_mime = wxT("image/png"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxPNGHandler) -}; - -#endif - // wxUSE_LIBPNG - -#endif - // _WX_IMAGPNG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imagpng.h +// Purpose: wxImage PNG handler +// Author: Robert Roebling +// RCS-ID: $Id: imagpng.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGPNG_H_ +#define _WX_IMAGPNG_H_ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// wxPNGHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBPNG + +#include "wx/image.h" + +#define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") +#define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") + +enum +{ + wxPNG_TYPE_COLOUR = 0, + wxPNG_TYPE_GREY = 2, + wxPNG_TYPE_GREY_RED = 3 +}; + +class WXDLLEXPORT wxPNGHandler: public wxImageHandler +{ +public: + inline wxPNGHandler() + { + m_name = wxT("PNG file"); + m_extension = wxT("png"); + m_type = wxBITMAP_TYPE_PNG; + m_mime = wxT("image/png"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxPNGHandler) +}; + +#endif + // wxUSE_LIBPNG + +#endif + // _WX_IMAGPNG_H_ + diff --git a/Externals/wxWidgets/include/wx/imagpnm.h b/Externals/wxWidgets/include/wx/imagpnm.h index 68b95efd93..e6f5a50aec 100644 --- a/Externals/wxWidgets/include/wx/imagpnm.h +++ b/Externals/wxWidgets/include/wx/imagpnm.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagpnm.h -// Purpose: wxImage PNM handler -// Author: Sylvain Bougnoux -// RCS-ID: $Id: imagpnm.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Sylvain Bougnoux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGPNM_H_ -#define _WX_IMAGPNM_H_ - -#include "wx/image.h" - -//----------------------------------------------------------------------------- -// wxPNMHandler -//----------------------------------------------------------------------------- - -#if wxUSE_PNM -class WXDLLEXPORT wxPNMHandler : public wxImageHandler -{ -public: - inline wxPNMHandler() - { - m_name = wxT("PNM file"); - m_extension = wxT("pnm"); - m_type = wxBITMAP_TYPE_PNM; - m_mime = wxT("image/pnm"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxPNMHandler) -}; -#endif - - -#endif - // _WX_IMAGPNM_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imagpnm.h +// Purpose: wxImage PNM handler +// Author: Sylvain Bougnoux +// RCS-ID: $Id: imagpnm.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Sylvain Bougnoux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGPNM_H_ +#define _WX_IMAGPNM_H_ + +#include "wx/image.h" + +//----------------------------------------------------------------------------- +// wxPNMHandler +//----------------------------------------------------------------------------- + +#if wxUSE_PNM +class WXDLLEXPORT wxPNMHandler : public wxImageHandler +{ +public: + inline wxPNMHandler() + { + m_name = wxT("PNM file"); + m_extension = wxT("pnm"); + m_type = wxBITMAP_TYPE_PNM; + m_mime = wxT("image/pnm"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxPNMHandler) +}; +#endif + + +#endif + // _WX_IMAGPNM_H_ + diff --git a/Externals/wxWidgets/include/wx/imagtga.h b/Externals/wxWidgets/include/wx/imagtga.h index 9b0a84187a..3eec26e0c0 100644 --- a/Externals/wxWidgets/include/wx/imagtga.h +++ b/Externals/wxWidgets/include/wx/imagtga.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/imagtga.h -// Purpose: wxImage TGA handler -// Author: Seth Jackson -// RCS-ID: $Id: imagtga.h 43843 2006-12-07 05:44:44Z PC $ -// Copyright: (c) 2005 Seth Jackson -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGTGA_H_ -#define _WX_IMAGTGA_H_ - -#include "wx/image.h" - -//----------------------------------------------------------------------------- -// wxTGAHandler -//----------------------------------------------------------------------------- - -#if wxUSE_TGA - -class WXDLLEXPORT wxTGAHandler : public wxImageHandler -{ -public: - wxTGAHandler() - { - m_name = wxT("TGA file"); - m_extension = wxT("tga"); - m_type = wxBITMAP_TYPE_TGA; - m_mime = wxT("image/tga"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile(wxImage* image, wxInputStream& stream, - bool verbose = true, int index = -1); - virtual bool SaveFile(wxImage* image, wxOutputStream& stream, - bool verbose = true); -protected: - virtual bool DoCanRead(wxInputStream& stream); -#endif // wxUSE_STREAMS - - DECLARE_DYNAMIC_CLASS(wxTGAHandler) -}; - -#endif // wxUSE_TGA - -#endif // _WX_IMAGTGA_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagtga.h +// Purpose: wxImage TGA handler +// Author: Seth Jackson +// RCS-ID: $Id: imagtga.h 43843 2006-12-07 05:44:44Z PC $ +// Copyright: (c) 2005 Seth Jackson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGTGA_H_ +#define _WX_IMAGTGA_H_ + +#include "wx/image.h" + +//----------------------------------------------------------------------------- +// wxTGAHandler +//----------------------------------------------------------------------------- + +#if wxUSE_TGA + +class WXDLLEXPORT wxTGAHandler : public wxImageHandler +{ +public: + wxTGAHandler() + { + m_name = wxT("TGA file"); + m_extension = wxT("tga"); + m_type = wxBITMAP_TYPE_TGA; + m_mime = wxT("image/tga"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile(wxImage* image, wxInputStream& stream, + bool verbose = true, int index = -1); + virtual bool SaveFile(wxImage* image, wxOutputStream& stream, + bool verbose = true); +protected: + virtual bool DoCanRead(wxInputStream& stream); +#endif // wxUSE_STREAMS + + DECLARE_DYNAMIC_CLASS(wxTGAHandler) +}; + +#endif // wxUSE_TGA + +#endif // _WX_IMAGTGA_H_ diff --git a/Externals/wxWidgets/include/wx/imagtiff.h b/Externals/wxWidgets/include/wx/imagtiff.h index 42ec8bf075..d236b75c07 100644 --- a/Externals/wxWidgets/include/wx/imagtiff.h +++ b/Externals/wxWidgets/include/wx/imagtiff.h @@ -1,49 +1,49 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imagtiff.h -// Purpose: wxImage TIFF handler -// Author: Robert Roebling -// RCS-ID: $Id: imagtiff.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGTIFF_H_ -#define _WX_IMAGTIFF_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxTIFFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBTIFF - -#include "wx/image.h" - -// defines for wxImage::SetOption -#define wxIMAGE_OPTION_BITSPERSAMPLE wxString(_T("BitsPerSample")) -#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxString(_T("SamplesPerPixel")) -#define wxIMAGE_OPTION_COMPRESSION wxString(_T("Compression")) -#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxString(_T("ImageDescriptor")) - -class WXDLLEXPORT wxTIFFHandler: public wxImageHandler -{ -public: - wxTIFFHandler(); - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual int GetImageCount( wxInputStream& stream ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxTIFFHandler) -}; - -#endif // wxUSE_LIBTIFF - -#endif // _WX_IMAGTIFF_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imagtiff.h +// Purpose: wxImage TIFF handler +// Author: Robert Roebling +// RCS-ID: $Id: imagtiff.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGTIFF_H_ +#define _WX_IMAGTIFF_H_ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// wxTIFFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBTIFF + +#include "wx/image.h" + +// defines for wxImage::SetOption +#define wxIMAGE_OPTION_BITSPERSAMPLE wxString(_T("BitsPerSample")) +#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxString(_T("SamplesPerPixel")) +#define wxIMAGE_OPTION_COMPRESSION wxString(_T("Compression")) +#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxString(_T("ImageDescriptor")) + +class WXDLLEXPORT wxTIFFHandler: public wxImageHandler +{ +public: + wxTIFFHandler(); + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual int GetImageCount( wxInputStream& stream ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxTIFFHandler) +}; + +#endif // wxUSE_LIBTIFF + +#endif // _WX_IMAGTIFF_H_ + diff --git a/Externals/wxWidgets/include/wx/imagxpm.h b/Externals/wxWidgets/include/wx/imagxpm.h index 4bff4894f4..6982e77afc 100644 --- a/Externals/wxWidgets/include/wx/imagxpm.h +++ b/Externals/wxWidgets/include/wx/imagxpm.h @@ -1,45 +1,45 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaggif.h -// Purpose: wxImage XPM handler -// Author: Vaclav Slavik -// RCS-ID: $Id: imagxpm.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2001 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGXPM_H_ -#define _WX_IMAGXPM_H_ - -#include "wx/image.h" - - -//----------------------------------------------------------------------------- -// wxXPMHandler -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxXPMHandler : public wxImageHandler -{ -public: - inline wxXPMHandler() - { - m_name = wxT("XPM file"); - m_extension = wxT("xpm"); - m_type = wxBITMAP_TYPE_XPM; - m_mime = wxT("image/xpm"); - } - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxXPMHandler) -}; - - -#endif - // _WX_IMAGXPM_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: imaggif.h +// Purpose: wxImage XPM handler +// Author: Vaclav Slavik +// RCS-ID: $Id: imagxpm.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 2001 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGXPM_H_ +#define _WX_IMAGXPM_H_ + +#include "wx/image.h" + + +//----------------------------------------------------------------------------- +// wxXPMHandler +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxXPMHandler : public wxImageHandler +{ +public: + inline wxXPMHandler() + { + m_name = wxT("XPM file"); + m_extension = wxT("xpm"); + m_type = wxBITMAP_TYPE_XPM; + m_mime = wxT("image/xpm"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); +protected: + virtual bool DoCanRead( wxInputStream& stream ); +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxXPMHandler) +}; + + +#endif + // _WX_IMAGXPM_H_ + diff --git a/Externals/wxWidgets/include/wx/init.h b/Externals/wxWidgets/include/wx/init.h index 49e8b2300c..c40018cfe7 100644 --- a/Externals/wxWidgets/include/wx/init.h +++ b/Externals/wxWidgets/include/wx/init.h @@ -1,95 +1,95 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/init.h -// Purpose: wxWidgets initialization and finalization functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 29.06.2003 -// RCS-ID: $Id: init.h 42109 2006-10-19 07:43:24Z MR $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_INIT_H_ -#define _WX_INIT_H_ - -#include "wx/defs.h" -#include "wx/wxchar.h" - -// ---------------------------------------------------------------------------- -// wxEntry helper functions which allow to have more fine grained control -// ---------------------------------------------------------------------------- - -// do common initialization, return true if ok (in this case wxEntryCleanup -// must be called later), otherwise the program can't use wxWidgets at all -// -// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP -// hadn't been used a dummy default application object is created -// -// note that the parameters may be modified, this is why we pass them by -// reference! -extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv); - -// free the resources allocated by the library in wxEntryStart() and shut it -// down (wxEntryStart() may be called again afterwards if necessary) -extern void WXDLLIMPEXP_BASE wxEntryCleanup(); - - -// ---------------------------------------------------------------------------- -// wxEntry: this function initializes the library, runs the main event loop -// and cleans it up -// ---------------------------------------------------------------------------- - -// note that other, platform-specific, overloads of wxEntry may exist as well -// but this one always exists under all platforms -// -// returns the program exit code -extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv); - -// we overload wxEntry[Start]() to take "char **" pointers too -#if wxUSE_UNICODE - -extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv); -extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); - -#endif// wxUSE_UNICODE - -// ---------------------------------------------------------------------------- -// Using the library without (explicit) application object: you may avoid using -// DECLARE_APP and IMPLEMENT_APP macros and call the functions below instead at -// the program startup and termination -// ---------------------------------------------------------------------------- - -// initialize the library (may be called as many times as needed, but each -// call to wxInitialize() must be matched by wxUninitialize()) -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc = 0, wxChar **argv = NULL); - -// clean up -- the library can't be used any more after the last call to -// wxUninitialize() -extern void WXDLLIMPEXP_BASE wxUninitialize(); - -// create an object of this class on stack to initialize/cleanup the library -// automatically -class WXDLLIMPEXP_BASE wxInitializer -{ -public: - // initialize the library - wxInitializer(int argc = 0, wxChar **argv = NULL) - { - m_ok = wxInitialize(argc, argv); - } - - // has the initialization been successful? (explicit test) - bool IsOk() const { return m_ok; } - - // has the initialization been successful? (implicit test) - operator bool() const { return m_ok; } - - // dtor only does clean up if we initialized the library properly - ~wxInitializer() { if ( m_ok ) wxUninitialize(); } - -private: - bool m_ok; -}; - -#endif // _WX_INIT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/init.h +// Purpose: wxWidgets initialization and finalization functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.06.2003 +// RCS-ID: $Id: init.h 42109 2006-10-19 07:43:24Z MR $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_INIT_H_ +#define _WX_INIT_H_ + +#include "wx/defs.h" +#include "wx/wxchar.h" + +// ---------------------------------------------------------------------------- +// wxEntry helper functions which allow to have more fine grained control +// ---------------------------------------------------------------------------- + +// do common initialization, return true if ok (in this case wxEntryCleanup +// must be called later), otherwise the program can't use wxWidgets at all +// +// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP +// hadn't been used a dummy default application object is created +// +// note that the parameters may be modified, this is why we pass them by +// reference! +extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv); + +// free the resources allocated by the library in wxEntryStart() and shut it +// down (wxEntryStart() may be called again afterwards if necessary) +extern void WXDLLIMPEXP_BASE wxEntryCleanup(); + + +// ---------------------------------------------------------------------------- +// wxEntry: this function initializes the library, runs the main event loop +// and cleans it up +// ---------------------------------------------------------------------------- + +// note that other, platform-specific, overloads of wxEntry may exist as well +// but this one always exists under all platforms +// +// returns the program exit code +extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv); + +// we overload wxEntry[Start]() to take "char **" pointers too +#if wxUSE_UNICODE + +extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv); +extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); + +#endif// wxUSE_UNICODE + +// ---------------------------------------------------------------------------- +// Using the library without (explicit) application object: you may avoid using +// DECLARE_APP and IMPLEMENT_APP macros and call the functions below instead at +// the program startup and termination +// ---------------------------------------------------------------------------- + +// initialize the library (may be called as many times as needed, but each +// call to wxInitialize() must be matched by wxUninitialize()) +extern bool WXDLLIMPEXP_BASE wxInitialize(int argc = 0, wxChar **argv = NULL); + +// clean up -- the library can't be used any more after the last call to +// wxUninitialize() +extern void WXDLLIMPEXP_BASE wxUninitialize(); + +// create an object of this class on stack to initialize/cleanup the library +// automatically +class WXDLLIMPEXP_BASE wxInitializer +{ +public: + // initialize the library + wxInitializer(int argc = 0, wxChar **argv = NULL) + { + m_ok = wxInitialize(argc, argv); + } + + // has the initialization been successful? (explicit test) + bool IsOk() const { return m_ok; } + + // has the initialization been successful? (implicit test) + operator bool() const { return m_ok; } + + // dtor only does clean up if we initialized the library properly + ~wxInitializer() { if ( m_ok ) wxUninitialize(); } + +private: + bool m_ok; +}; + +#endif // _WX_INIT_H_ + diff --git a/Externals/wxWidgets/include/wx/intl.h b/Externals/wxWidgets/include/wx/intl.h index 31f35be662..02bef05b8b 100644 --- a/Externals/wxWidgets/include/wx/intl.h +++ b/Externals/wxWidgets/include/wx/intl.h @@ -1,632 +1,632 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/intl.h -// Purpose: Internationalization and localisation for wxWidgets -// Author: Vadim Zeitlin -// Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su> -// (2003/09/30 - plural forms support) -// Created: 29/01/98 -// RCS-ID: $Id: intl.h 53754 2008-05-26 18:50:17Z RD $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// WARNING: Parts of this file are generated. See misc/languages/README for -// details. - -#ifndef _WX_INTL_H_ -#define _WX_INTL_H_ - -#include "wx/defs.h" -#include "wx/string.h" - -// Make wxLayoutDirection enum available without need for wxUSE_INTL so wxWindow, wxApp -// and other classes are not distrubed by wxUSE_INTL - -enum wxLayoutDirection -{ - wxLayout_Default, - wxLayout_LeftToRight, - wxLayout_RightToLeft -}; - -#if wxUSE_INTL - -#include "wx/fontenc.h" - -// ============================================================================ -// global decls -// ============================================================================ - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// gettext() style macros (notice that xgettext should be invoked with -// --keyword="_" --keyword="wxPLURAL:1,2" options -// to extract the strings from the sources) -#ifndef WXINTL_NO_GETTEXT_MACRO - #define _(s) wxGetTranslation(_T(s)) - #define wxPLURAL(sing, plur, n) wxGetTranslation(_T(sing), _T(plur), n) -#endif - -// another one which just marks the strings for extraction, but doesn't -// perform the translation (use -kwxTRANSLATE with xgettext!) -#define wxTRANSLATE(str) _T(str) - -// ---------------------------------------------------------------------------- -// forward decls -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxLocale; -class WXDLLIMPEXP_FWD_BASE wxLanguageInfoArray; -class wxMsgCatalog; - -// ============================================================================ -// locale support -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxLanguage: defines all supported languages -// ---------------------------------------------------------------------------- - -// --- --- --- generated code begins here --- --- --- - -// This enum is generated by misc/languages/genlang.py -// When making changes, please put them into misc/languages/langtabl.txt -enum wxLanguage -{ - // user's default/preffered language as got from OS: - wxLANGUAGE_DEFAULT, - // unknown language, if wxLocale::GetSystemLanguage fails: - wxLANGUAGE_UNKNOWN, - - wxLANGUAGE_ABKHAZIAN, - wxLANGUAGE_AFAR, - wxLANGUAGE_AFRIKAANS, - wxLANGUAGE_ALBANIAN, - wxLANGUAGE_AMHARIC, - wxLANGUAGE_ARABIC, - wxLANGUAGE_ARABIC_ALGERIA, - wxLANGUAGE_ARABIC_BAHRAIN, - wxLANGUAGE_ARABIC_EGYPT, - wxLANGUAGE_ARABIC_IRAQ, - wxLANGUAGE_ARABIC_JORDAN, - wxLANGUAGE_ARABIC_KUWAIT, - wxLANGUAGE_ARABIC_LEBANON, - wxLANGUAGE_ARABIC_LIBYA, - wxLANGUAGE_ARABIC_MOROCCO, - wxLANGUAGE_ARABIC_OMAN, - wxLANGUAGE_ARABIC_QATAR, - wxLANGUAGE_ARABIC_SAUDI_ARABIA, - wxLANGUAGE_ARABIC_SUDAN, - wxLANGUAGE_ARABIC_SYRIA, - wxLANGUAGE_ARABIC_TUNISIA, - wxLANGUAGE_ARABIC_UAE, - wxLANGUAGE_ARABIC_YEMEN, - wxLANGUAGE_ARMENIAN, - wxLANGUAGE_ASSAMESE, - wxLANGUAGE_AYMARA, - wxLANGUAGE_AZERI, - wxLANGUAGE_AZERI_CYRILLIC, - wxLANGUAGE_AZERI_LATIN, - wxLANGUAGE_BASHKIR, - wxLANGUAGE_BASQUE, - wxLANGUAGE_BELARUSIAN, - wxLANGUAGE_BENGALI, - wxLANGUAGE_BHUTANI, - wxLANGUAGE_BIHARI, - wxLANGUAGE_BISLAMA, - wxLANGUAGE_BRETON, - wxLANGUAGE_BULGARIAN, - wxLANGUAGE_BURMESE, - wxLANGUAGE_CAMBODIAN, - wxLANGUAGE_CATALAN, - wxLANGUAGE_CHINESE, - wxLANGUAGE_CHINESE_SIMPLIFIED, - wxLANGUAGE_CHINESE_TRADITIONAL, - wxLANGUAGE_CHINESE_HONGKONG, - wxLANGUAGE_CHINESE_MACAU, - wxLANGUAGE_CHINESE_SINGAPORE, - wxLANGUAGE_CHINESE_TAIWAN, - wxLANGUAGE_CORSICAN, - wxLANGUAGE_CROATIAN, - wxLANGUAGE_CZECH, - wxLANGUAGE_DANISH, - wxLANGUAGE_DUTCH, - wxLANGUAGE_DUTCH_BELGIAN, - wxLANGUAGE_ENGLISH, - wxLANGUAGE_ENGLISH_UK, - wxLANGUAGE_ENGLISH_US, - wxLANGUAGE_ENGLISH_AUSTRALIA, - wxLANGUAGE_ENGLISH_BELIZE, - wxLANGUAGE_ENGLISH_BOTSWANA, - wxLANGUAGE_ENGLISH_CANADA, - wxLANGUAGE_ENGLISH_CARIBBEAN, - wxLANGUAGE_ENGLISH_DENMARK, - wxLANGUAGE_ENGLISH_EIRE, - wxLANGUAGE_ENGLISH_JAMAICA, - wxLANGUAGE_ENGLISH_NEW_ZEALAND, - wxLANGUAGE_ENGLISH_PHILIPPINES, - wxLANGUAGE_ENGLISH_SOUTH_AFRICA, - wxLANGUAGE_ENGLISH_TRINIDAD, - wxLANGUAGE_ENGLISH_ZIMBABWE, - wxLANGUAGE_ESPERANTO, - wxLANGUAGE_ESTONIAN, - wxLANGUAGE_FAEROESE, - wxLANGUAGE_FARSI, - wxLANGUAGE_FIJI, - wxLANGUAGE_FINNISH, - wxLANGUAGE_FRENCH, - wxLANGUAGE_FRENCH_BELGIAN, - wxLANGUAGE_FRENCH_CANADIAN, - wxLANGUAGE_FRENCH_LUXEMBOURG, - wxLANGUAGE_FRENCH_MONACO, - wxLANGUAGE_FRENCH_SWISS, - wxLANGUAGE_FRISIAN, - wxLANGUAGE_GALICIAN, - wxLANGUAGE_GEORGIAN, - wxLANGUAGE_GERMAN, - wxLANGUAGE_GERMAN_AUSTRIAN, - wxLANGUAGE_GERMAN_BELGIUM, - wxLANGUAGE_GERMAN_LIECHTENSTEIN, - wxLANGUAGE_GERMAN_LUXEMBOURG, - wxLANGUAGE_GERMAN_SWISS, - wxLANGUAGE_GREEK, - wxLANGUAGE_GREENLANDIC, - wxLANGUAGE_GUARANI, - wxLANGUAGE_GUJARATI, - wxLANGUAGE_HAUSA, - wxLANGUAGE_HEBREW, - wxLANGUAGE_HINDI, - wxLANGUAGE_HUNGARIAN, - wxLANGUAGE_ICELANDIC, - wxLANGUAGE_INDONESIAN, - wxLANGUAGE_INTERLINGUA, - wxLANGUAGE_INTERLINGUE, - wxLANGUAGE_INUKTITUT, - wxLANGUAGE_INUPIAK, - wxLANGUAGE_IRISH, - wxLANGUAGE_ITALIAN, - wxLANGUAGE_ITALIAN_SWISS, - wxLANGUAGE_JAPANESE, - wxLANGUAGE_JAVANESE, - wxLANGUAGE_KANNADA, - wxLANGUAGE_KASHMIRI, - wxLANGUAGE_KASHMIRI_INDIA, - wxLANGUAGE_KAZAKH, - wxLANGUAGE_KERNEWEK, - wxLANGUAGE_KINYARWANDA, - wxLANGUAGE_KIRGHIZ, - wxLANGUAGE_KIRUNDI, - wxLANGUAGE_KONKANI, - wxLANGUAGE_KOREAN, - wxLANGUAGE_KURDISH, - wxLANGUAGE_LAOTHIAN, - wxLANGUAGE_LATIN, - wxLANGUAGE_LATVIAN, - wxLANGUAGE_LINGALA, - wxLANGUAGE_LITHUANIAN, - wxLANGUAGE_MACEDONIAN, - wxLANGUAGE_MALAGASY, - wxLANGUAGE_MALAY, - wxLANGUAGE_MALAYALAM, - wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, - wxLANGUAGE_MALAY_MALAYSIA, - wxLANGUAGE_MALTESE, - wxLANGUAGE_MANIPURI, - wxLANGUAGE_MAORI, - wxLANGUAGE_MARATHI, - wxLANGUAGE_MOLDAVIAN, - wxLANGUAGE_MONGOLIAN, - wxLANGUAGE_NAURU, - wxLANGUAGE_NEPALI, - wxLANGUAGE_NEPALI_INDIA, - wxLANGUAGE_NORWEGIAN_BOKMAL, - wxLANGUAGE_NORWEGIAN_NYNORSK, - wxLANGUAGE_OCCITAN, - wxLANGUAGE_ORIYA, - wxLANGUAGE_OROMO, - wxLANGUAGE_PASHTO, - wxLANGUAGE_POLISH, - wxLANGUAGE_PORTUGUESE, - wxLANGUAGE_PORTUGUESE_BRAZILIAN, - wxLANGUAGE_PUNJABI, - wxLANGUAGE_QUECHUA, - wxLANGUAGE_RHAETO_ROMANCE, - wxLANGUAGE_ROMANIAN, - wxLANGUAGE_RUSSIAN, - wxLANGUAGE_RUSSIAN_UKRAINE, - wxLANGUAGE_SAMOAN, - wxLANGUAGE_SANGHO, - wxLANGUAGE_SANSKRIT, - wxLANGUAGE_SCOTS_GAELIC, - wxLANGUAGE_SERBIAN, - wxLANGUAGE_SERBIAN_CYRILLIC, - wxLANGUAGE_SERBIAN_LATIN, - wxLANGUAGE_SERBO_CROATIAN, - wxLANGUAGE_SESOTHO, - wxLANGUAGE_SETSWANA, - wxLANGUAGE_SHONA, - wxLANGUAGE_SINDHI, - wxLANGUAGE_SINHALESE, - wxLANGUAGE_SISWATI, - wxLANGUAGE_SLOVAK, - wxLANGUAGE_SLOVENIAN, - wxLANGUAGE_SOMALI, - wxLANGUAGE_SPANISH, - wxLANGUAGE_SPANISH_ARGENTINA, - wxLANGUAGE_SPANISH_BOLIVIA, - wxLANGUAGE_SPANISH_CHILE, - wxLANGUAGE_SPANISH_COLOMBIA, - wxLANGUAGE_SPANISH_COSTA_RICA, - wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, - wxLANGUAGE_SPANISH_ECUADOR, - wxLANGUAGE_SPANISH_EL_SALVADOR, - wxLANGUAGE_SPANISH_GUATEMALA, - wxLANGUAGE_SPANISH_HONDURAS, - wxLANGUAGE_SPANISH_MEXICAN, - wxLANGUAGE_SPANISH_MODERN, - wxLANGUAGE_SPANISH_NICARAGUA, - wxLANGUAGE_SPANISH_PANAMA, - wxLANGUAGE_SPANISH_PARAGUAY, - wxLANGUAGE_SPANISH_PERU, - wxLANGUAGE_SPANISH_PUERTO_RICO, - wxLANGUAGE_SPANISH_URUGUAY, - wxLANGUAGE_SPANISH_US, - wxLANGUAGE_SPANISH_VENEZUELA, - wxLANGUAGE_SUNDANESE, - wxLANGUAGE_SWAHILI, - wxLANGUAGE_SWEDISH, - wxLANGUAGE_SWEDISH_FINLAND, - wxLANGUAGE_TAGALOG, - wxLANGUAGE_TAJIK, - wxLANGUAGE_TAMIL, - wxLANGUAGE_TATAR, - wxLANGUAGE_TELUGU, - wxLANGUAGE_THAI, - wxLANGUAGE_TIBETAN, - wxLANGUAGE_TIGRINYA, - wxLANGUAGE_TONGA, - wxLANGUAGE_TSONGA, - wxLANGUAGE_TURKISH, - wxLANGUAGE_TURKMEN, - wxLANGUAGE_TWI, - wxLANGUAGE_UIGHUR, - wxLANGUAGE_UKRAINIAN, - wxLANGUAGE_URDU, - wxLANGUAGE_URDU_INDIA, - wxLANGUAGE_URDU_PAKISTAN, - wxLANGUAGE_UZBEK, - wxLANGUAGE_UZBEK_CYRILLIC, - wxLANGUAGE_UZBEK_LATIN, - wxLANGUAGE_VIETNAMESE, - wxLANGUAGE_VOLAPUK, - wxLANGUAGE_WELSH, - wxLANGUAGE_WOLOF, - wxLANGUAGE_XHOSA, - wxLANGUAGE_YIDDISH, - wxLANGUAGE_YORUBA, - wxLANGUAGE_ZHUANG, - wxLANGUAGE_ZULU, - - // for custom, user-defined languages: - wxLANGUAGE_USER_DEFINED - - -#if wxABI_VERSION >= 20808 - // For binary compatibility, we can't put new items in their normal - // position in the enum, because it would change other values. We have to - // put it somewhere well outside normal range -- the particular value used - // is arbitrary: - , wxLANGUAGE_VALENCIAN = 0x1fffffff, - wxLANGUAGE_SAMI -#endif -}; - -// --- --- --- generated code ends here --- --- --- - -// ---------------------------------------------------------------------------- -// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc. -// translation information -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxLanguageInfo -{ - int Language; // wxLanguage id - wxString CanonicalName; // Canonical name, e.g. fr_FR -#ifdef __WIN32__ - wxUint32 WinLang, // Win32 language identifiers - WinSublang; -#endif // __WIN32__ - wxString Description; // human-readable name of the language - wxLayoutDirection LayoutDirection; -}; - -// ---------------------------------------------------------------------------- -// wxLocaleCategory: the category of locale settings -// ---------------------------------------------------------------------------- - -enum wxLocaleCategory -{ - // (any) numbers - wxLOCALE_CAT_NUMBER, - - // date/time - wxLOCALE_CAT_DATE, - - // monetary value - wxLOCALE_CAT_MONEY, - - wxLOCALE_CAT_MAX -}; - -// ---------------------------------------------------------------------------- -// wxLocaleInfo: the items understood by wxLocale::GetInfo() -// ---------------------------------------------------------------------------- - -enum wxLocaleInfo -{ - // the thounsands separator - wxLOCALE_THOUSANDS_SEP, - - // the character used as decimal point - wxLOCALE_DECIMAL_POINT - -}; - -// ---------------------------------------------------------------------------- -// wxLocale: encapsulates all language dependent settings, including current -// message catalogs, date, time and currency formats (TODO) &c -// ---------------------------------------------------------------------------- - -enum wxLocaleInitFlags -{ - wxLOCALE_LOAD_DEFAULT = 0x0001, // load wxwin.mo? - wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly? -}; - -class WXDLLIMPEXP_BASE wxLocale -{ -public: - // ctor & dtor - // ----------- - - // call Init() if you use this ctor - wxLocale() { DoCommonInit(); } - - // the ctor has a side effect of changing current locale - wxLocale(const wxChar *szName, // name (for messages) - const wxChar *szShort = (const wxChar *) NULL, // dir prefix (for msg files) - const wxChar *szLocale = (const wxChar *) NULL, // locale (for setlocale) - bool bLoadDefault = true, // preload wxstd.mo? - bool bConvertEncoding = false) // convert Win<->Unix if necessary? - { - DoCommonInit(); - - Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding); - } - - wxLocale(int language, // wxLanguage id or custom language - int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) - { - DoCommonInit(); - - Init(language, flags); - } - - // the same as a function (returns true on success) - bool Init(const wxChar *szName, - const wxChar *szShort = (const wxChar *) NULL, - const wxChar *szLocale = (const wxChar *) NULL, - bool bLoadDefault = true, - bool bConvertEncoding = false); - - // same as second ctor (returns true on success) - bool Init(int language = wxLANGUAGE_DEFAULT, - int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); - - // restores old locale - virtual ~wxLocale(); - - // Try to get user's (or OS's) preferred language setting. - // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed - static int GetSystemLanguage(); - - // get the encoding used by default for text on this system, returns - // wxFONTENCODING_SYSTEM if it couldn't be determined - static wxFontEncoding GetSystemEncoding(); - - // get the string describing the system encoding, return empty string if - // couldn't be determined - static wxString GetSystemEncodingName(); - - // get the values of the given locale-dependent datum: the current locale - // is used, the US default value is returned if everything else fails - static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat); - - // return true if the locale was set successfully - bool IsOk() const { return m_pszOldLocale != NULL; } - - // returns locale name - const wxChar *GetLocale() const { return m_strLocale; } - - // return current locale wxLanguage value - int GetLanguage() const { return m_language; } - - // return locale name to be passed to setlocale() - wxString GetSysName() const; - - // return 'canonical' name, i.e. in the form of xx[_YY], where xx is - // language code according to ISO 639 and YY is country name - // as specified by ISO 3166. - wxString GetCanonicalName() const { return m_strShort; } - - // add a prefix to the catalog lookup path: the message catalog files will be - // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix - // (in this order). - // - // This only applies to subsequent invocations of AddCatalog()! - static void AddCatalogLookupPathPrefix(const wxString& prefix); - - // add a catalog: it's searched for in standard places (current directory - // first, system one after), but the you may prepend additional directories to - // the search path with AddCatalogLookupPathPrefix(). - // - // The loaded catalog will be used for message lookup by GetString(). - // - // Returns 'true' if it was successfully loaded - bool AddCatalog(const wxChar *szDomain); - bool AddCatalog(const wxChar *szDomain, - wxLanguage msgIdLanguage, const wxChar *msgIdCharset); - - // check if the given locale is provided by OS and C run time - static bool IsAvailable(int lang); - - // check if the given catalog is loaded - bool IsLoaded(const wxChar *szDomain) const; - - // Retrieve the language info struct for the given language - // - // Returns NULL if no info found, pointer must *not* be deleted by caller - static const wxLanguageInfo *GetLanguageInfo(int lang); - - // Returns language name in English or empty string if the language - // is not in database - static wxString GetLanguageName(int lang); - - // Find the language for the given locale string which may be either a - // canonical ISO 2 letter language code ("xx"), a language code followed by - // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") - // - // Returns NULL if no info found, pointer must *not* be deleted by caller - static const wxLanguageInfo *FindLanguageInfo(const wxString& locale); - - // Add custom language to the list of known languages. - // Notes: 1) wxLanguageInfo contains platform-specific data - // 2) must be called before Init to have effect - static void AddLanguage(const wxLanguageInfo& info); - - // retrieve the translation for a string in all loaded domains unless - // the szDomain parameter is specified (and then only this domain is - // searched) - // n - additional parameter for PluralFormsParser - // - // return original string if translation is not available - // (in this case an error message is generated the first time - // a string is not found; use wxLogNull to suppress it) - // - // domains are searched in the last to first order, i.e. catalogs - // added later override those added before. - virtual const wxChar *GetString(const wxChar *szOrigString, - const wxChar *szDomain = NULL) const; - // plural form version of the same: - virtual const wxChar *GetString(const wxChar *szOrigString, - const wxChar *szOrigString2, - size_t n, - const wxChar *szDomain = NULL) const; - - // Returns the current short name for the locale - const wxString& GetName() const { return m_strShort; } - - // return the contents of .po file header - wxString GetHeaderValue( const wxChar* szHeader, - const wxChar* szDomain = NULL ) const; - - // These two methods are for internal use only. First one creates - // ms_languagesDB if it doesn't already exist, second one destroys - // it. - static void CreateLanguagesDB(); - static void DestroyLanguagesDB(); - -private: - // find catalog by name in a linked list, return NULL if !found - wxMsgCatalog *FindCatalog(const wxChar *szDomain) const; - - // copy default table of languages from global static array to - // m_langugagesInfo, called by InitLanguagesDB - static void InitLanguagesDB(); - - // initialize the member fields to default values - void DoCommonInit(); - - wxString m_strLocale, // this locale name - m_strShort; // short name for the locale - int m_language; // this locale wxLanguage value - - const wxChar *m_pszOldLocale; // previous locale from setlocale() - wxLocale *m_pOldLocale; // previous wxLocale - - wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs - - bool m_bConvertEncoding; - - bool m_initialized; - - static wxLanguageInfoArray *ms_languagesDB; - - DECLARE_NO_COPY_CLASS(wxLocale) -}; - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// get the current locale object (note that it may be NULL!) -extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale(); - -// get the translation of the string in the current locale -inline const wxChar * -wxGetTranslation(const wxChar *sz, const wxChar* domain = NULL) -{ - wxLocale *pLoc = wxGetLocale(); - if (pLoc) - return pLoc->GetString(sz, domain); - else - return sz; -} - -inline const wxChar * -wxGetTranslation(const wxChar *sz1, const wxChar *sz2, - size_t n, - const wxChar *domain = NULL) -{ - wxLocale *pLoc = wxGetLocale(); - if (pLoc) - return pLoc->GetString(sz1, sz2, n, domain); - else - return n == 1 ? sz1 : sz2; -} - -#else // !wxUSE_INTL - -// the macros should still be defined - otherwise compilation would fail - -#if !defined(WXINTL_NO_GETTEXT_MACRO) - #if !defined(_) - #define _(s) (_T(s)) - #endif - #define wxPLURAL(sing, plur, n) ((n) == 1 ? _T(sing) : _T(plur)) -#endif - -#define wxTRANSLATE(str) _T(str) - -inline const wxChar * -wxGetTranslation(const wxChar *sz, const wxChar * WXUNUSED(domain) = NULL) -{ - return sz; -} - -#endif // wxUSE_INTL/!wxUSE_INTL - -// define this one just in case it occurs somewhere (instead of preferred -// wxTRANSLATE) too -#if !defined(WXINTL_NO_GETTEXT_MACRO) - #if !defined(gettext_noop) - #define gettext_noop(str) _T(str) - #endif - #if !defined(N_) - #define N_(s) _T(s) - #endif -#endif - -#endif // _WX_INTL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/intl.h +// Purpose: Internationalization and localisation for wxWidgets +// Author: Vadim Zeitlin +// Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su> +// (2003/09/30 - plural forms support) +// Created: 29/01/98 +// RCS-ID: $Id: intl.h 53754 2008-05-26 18:50:17Z RD $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// WARNING: Parts of this file are generated. See misc/languages/README for +// details. + +#ifndef _WX_INTL_H_ +#define _WX_INTL_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +// Make wxLayoutDirection enum available without need for wxUSE_INTL so wxWindow, wxApp +// and other classes are not distrubed by wxUSE_INTL + +enum wxLayoutDirection +{ + wxLayout_Default, + wxLayout_LeftToRight, + wxLayout_RightToLeft +}; + +#if wxUSE_INTL + +#include "wx/fontenc.h" + +// ============================================================================ +// global decls +// ============================================================================ + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// gettext() style macros (notice that xgettext should be invoked with +// --keyword="_" --keyword="wxPLURAL:1,2" options +// to extract the strings from the sources) +#ifndef WXINTL_NO_GETTEXT_MACRO + #define _(s) wxGetTranslation(_T(s)) + #define wxPLURAL(sing, plur, n) wxGetTranslation(_T(sing), _T(plur), n) +#endif + +// another one which just marks the strings for extraction, but doesn't +// perform the translation (use -kwxTRANSLATE with xgettext!) +#define wxTRANSLATE(str) _T(str) + +// ---------------------------------------------------------------------------- +// forward decls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxLocale; +class WXDLLIMPEXP_FWD_BASE wxLanguageInfoArray; +class wxMsgCatalog; + +// ============================================================================ +// locale support +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxLanguage: defines all supported languages +// ---------------------------------------------------------------------------- + +// --- --- --- generated code begins here --- --- --- + +// This enum is generated by misc/languages/genlang.py +// When making changes, please put them into misc/languages/langtabl.txt +enum wxLanguage +{ + // user's default/preffered language as got from OS: + wxLANGUAGE_DEFAULT, + // unknown language, if wxLocale::GetSystemLanguage fails: + wxLANGUAGE_UNKNOWN, + + wxLANGUAGE_ABKHAZIAN, + wxLANGUAGE_AFAR, + wxLANGUAGE_AFRIKAANS, + wxLANGUAGE_ALBANIAN, + wxLANGUAGE_AMHARIC, + wxLANGUAGE_ARABIC, + wxLANGUAGE_ARABIC_ALGERIA, + wxLANGUAGE_ARABIC_BAHRAIN, + wxLANGUAGE_ARABIC_EGYPT, + wxLANGUAGE_ARABIC_IRAQ, + wxLANGUAGE_ARABIC_JORDAN, + wxLANGUAGE_ARABIC_KUWAIT, + wxLANGUAGE_ARABIC_LEBANON, + wxLANGUAGE_ARABIC_LIBYA, + wxLANGUAGE_ARABIC_MOROCCO, + wxLANGUAGE_ARABIC_OMAN, + wxLANGUAGE_ARABIC_QATAR, + wxLANGUAGE_ARABIC_SAUDI_ARABIA, + wxLANGUAGE_ARABIC_SUDAN, + wxLANGUAGE_ARABIC_SYRIA, + wxLANGUAGE_ARABIC_TUNISIA, + wxLANGUAGE_ARABIC_UAE, + wxLANGUAGE_ARABIC_YEMEN, + wxLANGUAGE_ARMENIAN, + wxLANGUAGE_ASSAMESE, + wxLANGUAGE_AYMARA, + wxLANGUAGE_AZERI, + wxLANGUAGE_AZERI_CYRILLIC, + wxLANGUAGE_AZERI_LATIN, + wxLANGUAGE_BASHKIR, + wxLANGUAGE_BASQUE, + wxLANGUAGE_BELARUSIAN, + wxLANGUAGE_BENGALI, + wxLANGUAGE_BHUTANI, + wxLANGUAGE_BIHARI, + wxLANGUAGE_BISLAMA, + wxLANGUAGE_BRETON, + wxLANGUAGE_BULGARIAN, + wxLANGUAGE_BURMESE, + wxLANGUAGE_CAMBODIAN, + wxLANGUAGE_CATALAN, + wxLANGUAGE_CHINESE, + wxLANGUAGE_CHINESE_SIMPLIFIED, + wxLANGUAGE_CHINESE_TRADITIONAL, + wxLANGUAGE_CHINESE_HONGKONG, + wxLANGUAGE_CHINESE_MACAU, + wxLANGUAGE_CHINESE_SINGAPORE, + wxLANGUAGE_CHINESE_TAIWAN, + wxLANGUAGE_CORSICAN, + wxLANGUAGE_CROATIAN, + wxLANGUAGE_CZECH, + wxLANGUAGE_DANISH, + wxLANGUAGE_DUTCH, + wxLANGUAGE_DUTCH_BELGIAN, + wxLANGUAGE_ENGLISH, + wxLANGUAGE_ENGLISH_UK, + wxLANGUAGE_ENGLISH_US, + wxLANGUAGE_ENGLISH_AUSTRALIA, + wxLANGUAGE_ENGLISH_BELIZE, + wxLANGUAGE_ENGLISH_BOTSWANA, + wxLANGUAGE_ENGLISH_CANADA, + wxLANGUAGE_ENGLISH_CARIBBEAN, + wxLANGUAGE_ENGLISH_DENMARK, + wxLANGUAGE_ENGLISH_EIRE, + wxLANGUAGE_ENGLISH_JAMAICA, + wxLANGUAGE_ENGLISH_NEW_ZEALAND, + wxLANGUAGE_ENGLISH_PHILIPPINES, + wxLANGUAGE_ENGLISH_SOUTH_AFRICA, + wxLANGUAGE_ENGLISH_TRINIDAD, + wxLANGUAGE_ENGLISH_ZIMBABWE, + wxLANGUAGE_ESPERANTO, + wxLANGUAGE_ESTONIAN, + wxLANGUAGE_FAEROESE, + wxLANGUAGE_FARSI, + wxLANGUAGE_FIJI, + wxLANGUAGE_FINNISH, + wxLANGUAGE_FRENCH, + wxLANGUAGE_FRENCH_BELGIAN, + wxLANGUAGE_FRENCH_CANADIAN, + wxLANGUAGE_FRENCH_LUXEMBOURG, + wxLANGUAGE_FRENCH_MONACO, + wxLANGUAGE_FRENCH_SWISS, + wxLANGUAGE_FRISIAN, + wxLANGUAGE_GALICIAN, + wxLANGUAGE_GEORGIAN, + wxLANGUAGE_GERMAN, + wxLANGUAGE_GERMAN_AUSTRIAN, + wxLANGUAGE_GERMAN_BELGIUM, + wxLANGUAGE_GERMAN_LIECHTENSTEIN, + wxLANGUAGE_GERMAN_LUXEMBOURG, + wxLANGUAGE_GERMAN_SWISS, + wxLANGUAGE_GREEK, + wxLANGUAGE_GREENLANDIC, + wxLANGUAGE_GUARANI, + wxLANGUAGE_GUJARATI, + wxLANGUAGE_HAUSA, + wxLANGUAGE_HEBREW, + wxLANGUAGE_HINDI, + wxLANGUAGE_HUNGARIAN, + wxLANGUAGE_ICELANDIC, + wxLANGUAGE_INDONESIAN, + wxLANGUAGE_INTERLINGUA, + wxLANGUAGE_INTERLINGUE, + wxLANGUAGE_INUKTITUT, + wxLANGUAGE_INUPIAK, + wxLANGUAGE_IRISH, + wxLANGUAGE_ITALIAN, + wxLANGUAGE_ITALIAN_SWISS, + wxLANGUAGE_JAPANESE, + wxLANGUAGE_JAVANESE, + wxLANGUAGE_KANNADA, + wxLANGUAGE_KASHMIRI, + wxLANGUAGE_KASHMIRI_INDIA, + wxLANGUAGE_KAZAKH, + wxLANGUAGE_KERNEWEK, + wxLANGUAGE_KINYARWANDA, + wxLANGUAGE_KIRGHIZ, + wxLANGUAGE_KIRUNDI, + wxLANGUAGE_KONKANI, + wxLANGUAGE_KOREAN, + wxLANGUAGE_KURDISH, + wxLANGUAGE_LAOTHIAN, + wxLANGUAGE_LATIN, + wxLANGUAGE_LATVIAN, + wxLANGUAGE_LINGALA, + wxLANGUAGE_LITHUANIAN, + wxLANGUAGE_MACEDONIAN, + wxLANGUAGE_MALAGASY, + wxLANGUAGE_MALAY, + wxLANGUAGE_MALAYALAM, + wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, + wxLANGUAGE_MALAY_MALAYSIA, + wxLANGUAGE_MALTESE, + wxLANGUAGE_MANIPURI, + wxLANGUAGE_MAORI, + wxLANGUAGE_MARATHI, + wxLANGUAGE_MOLDAVIAN, + wxLANGUAGE_MONGOLIAN, + wxLANGUAGE_NAURU, + wxLANGUAGE_NEPALI, + wxLANGUAGE_NEPALI_INDIA, + wxLANGUAGE_NORWEGIAN_BOKMAL, + wxLANGUAGE_NORWEGIAN_NYNORSK, + wxLANGUAGE_OCCITAN, + wxLANGUAGE_ORIYA, + wxLANGUAGE_OROMO, + wxLANGUAGE_PASHTO, + wxLANGUAGE_POLISH, + wxLANGUAGE_PORTUGUESE, + wxLANGUAGE_PORTUGUESE_BRAZILIAN, + wxLANGUAGE_PUNJABI, + wxLANGUAGE_QUECHUA, + wxLANGUAGE_RHAETO_ROMANCE, + wxLANGUAGE_ROMANIAN, + wxLANGUAGE_RUSSIAN, + wxLANGUAGE_RUSSIAN_UKRAINE, + wxLANGUAGE_SAMOAN, + wxLANGUAGE_SANGHO, + wxLANGUAGE_SANSKRIT, + wxLANGUAGE_SCOTS_GAELIC, + wxLANGUAGE_SERBIAN, + wxLANGUAGE_SERBIAN_CYRILLIC, + wxLANGUAGE_SERBIAN_LATIN, + wxLANGUAGE_SERBO_CROATIAN, + wxLANGUAGE_SESOTHO, + wxLANGUAGE_SETSWANA, + wxLANGUAGE_SHONA, + wxLANGUAGE_SINDHI, + wxLANGUAGE_SINHALESE, + wxLANGUAGE_SISWATI, + wxLANGUAGE_SLOVAK, + wxLANGUAGE_SLOVENIAN, + wxLANGUAGE_SOMALI, + wxLANGUAGE_SPANISH, + wxLANGUAGE_SPANISH_ARGENTINA, + wxLANGUAGE_SPANISH_BOLIVIA, + wxLANGUAGE_SPANISH_CHILE, + wxLANGUAGE_SPANISH_COLOMBIA, + wxLANGUAGE_SPANISH_COSTA_RICA, + wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, + wxLANGUAGE_SPANISH_ECUADOR, + wxLANGUAGE_SPANISH_EL_SALVADOR, + wxLANGUAGE_SPANISH_GUATEMALA, + wxLANGUAGE_SPANISH_HONDURAS, + wxLANGUAGE_SPANISH_MEXICAN, + wxLANGUAGE_SPANISH_MODERN, + wxLANGUAGE_SPANISH_NICARAGUA, + wxLANGUAGE_SPANISH_PANAMA, + wxLANGUAGE_SPANISH_PARAGUAY, + wxLANGUAGE_SPANISH_PERU, + wxLANGUAGE_SPANISH_PUERTO_RICO, + wxLANGUAGE_SPANISH_URUGUAY, + wxLANGUAGE_SPANISH_US, + wxLANGUAGE_SPANISH_VENEZUELA, + wxLANGUAGE_SUNDANESE, + wxLANGUAGE_SWAHILI, + wxLANGUAGE_SWEDISH, + wxLANGUAGE_SWEDISH_FINLAND, + wxLANGUAGE_TAGALOG, + wxLANGUAGE_TAJIK, + wxLANGUAGE_TAMIL, + wxLANGUAGE_TATAR, + wxLANGUAGE_TELUGU, + wxLANGUAGE_THAI, + wxLANGUAGE_TIBETAN, + wxLANGUAGE_TIGRINYA, + wxLANGUAGE_TONGA, + wxLANGUAGE_TSONGA, + wxLANGUAGE_TURKISH, + wxLANGUAGE_TURKMEN, + wxLANGUAGE_TWI, + wxLANGUAGE_UIGHUR, + wxLANGUAGE_UKRAINIAN, + wxLANGUAGE_URDU, + wxLANGUAGE_URDU_INDIA, + wxLANGUAGE_URDU_PAKISTAN, + wxLANGUAGE_UZBEK, + wxLANGUAGE_UZBEK_CYRILLIC, + wxLANGUAGE_UZBEK_LATIN, + wxLANGUAGE_VIETNAMESE, + wxLANGUAGE_VOLAPUK, + wxLANGUAGE_WELSH, + wxLANGUAGE_WOLOF, + wxLANGUAGE_XHOSA, + wxLANGUAGE_YIDDISH, + wxLANGUAGE_YORUBA, + wxLANGUAGE_ZHUANG, + wxLANGUAGE_ZULU, + + // for custom, user-defined languages: + wxLANGUAGE_USER_DEFINED + + +#if wxABI_VERSION >= 20808 + // For binary compatibility, we can't put new items in their normal + // position in the enum, because it would change other values. We have to + // put it somewhere well outside normal range -- the particular value used + // is arbitrary: + , wxLANGUAGE_VALENCIAN = 0x1fffffff, + wxLANGUAGE_SAMI +#endif +}; + +// --- --- --- generated code ends here --- --- --- + +// ---------------------------------------------------------------------------- +// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc. +// translation information +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxLanguageInfo +{ + int Language; // wxLanguage id + wxString CanonicalName; // Canonical name, e.g. fr_FR +#ifdef __WIN32__ + wxUint32 WinLang, // Win32 language identifiers + WinSublang; +#endif // __WIN32__ + wxString Description; // human-readable name of the language + wxLayoutDirection LayoutDirection; +}; + +// ---------------------------------------------------------------------------- +// wxLocaleCategory: the category of locale settings +// ---------------------------------------------------------------------------- + +enum wxLocaleCategory +{ + // (any) numbers + wxLOCALE_CAT_NUMBER, + + // date/time + wxLOCALE_CAT_DATE, + + // monetary value + wxLOCALE_CAT_MONEY, + + wxLOCALE_CAT_MAX +}; + +// ---------------------------------------------------------------------------- +// wxLocaleInfo: the items understood by wxLocale::GetInfo() +// ---------------------------------------------------------------------------- + +enum wxLocaleInfo +{ + // the thounsands separator + wxLOCALE_THOUSANDS_SEP, + + // the character used as decimal point + wxLOCALE_DECIMAL_POINT + +}; + +// ---------------------------------------------------------------------------- +// wxLocale: encapsulates all language dependent settings, including current +// message catalogs, date, time and currency formats (TODO) &c +// ---------------------------------------------------------------------------- + +enum wxLocaleInitFlags +{ + wxLOCALE_LOAD_DEFAULT = 0x0001, // load wxwin.mo? + wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly? +}; + +class WXDLLIMPEXP_BASE wxLocale +{ +public: + // ctor & dtor + // ----------- + + // call Init() if you use this ctor + wxLocale() { DoCommonInit(); } + + // the ctor has a side effect of changing current locale + wxLocale(const wxChar *szName, // name (for messages) + const wxChar *szShort = (const wxChar *) NULL, // dir prefix (for msg files) + const wxChar *szLocale = (const wxChar *) NULL, // locale (for setlocale) + bool bLoadDefault = true, // preload wxstd.mo? + bool bConvertEncoding = false) // convert Win<->Unix if necessary? + { + DoCommonInit(); + + Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding); + } + + wxLocale(int language, // wxLanguage id or custom language + int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) + { + DoCommonInit(); + + Init(language, flags); + } + + // the same as a function (returns true on success) + bool Init(const wxChar *szName, + const wxChar *szShort = (const wxChar *) NULL, + const wxChar *szLocale = (const wxChar *) NULL, + bool bLoadDefault = true, + bool bConvertEncoding = false); + + // same as second ctor (returns true on success) + bool Init(int language = wxLANGUAGE_DEFAULT, + int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); + + // restores old locale + virtual ~wxLocale(); + + // Try to get user's (or OS's) preferred language setting. + // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed + static int GetSystemLanguage(); + + // get the encoding used by default for text on this system, returns + // wxFONTENCODING_SYSTEM if it couldn't be determined + static wxFontEncoding GetSystemEncoding(); + + // get the string describing the system encoding, return empty string if + // couldn't be determined + static wxString GetSystemEncodingName(); + + // get the values of the given locale-dependent datum: the current locale + // is used, the US default value is returned if everything else fails + static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat); + + // return true if the locale was set successfully + bool IsOk() const { return m_pszOldLocale != NULL; } + + // returns locale name + const wxChar *GetLocale() const { return m_strLocale; } + + // return current locale wxLanguage value + int GetLanguage() const { return m_language; } + + // return locale name to be passed to setlocale() + wxString GetSysName() const; + + // return 'canonical' name, i.e. in the form of xx[_YY], where xx is + // language code according to ISO 639 and YY is country name + // as specified by ISO 3166. + wxString GetCanonicalName() const { return m_strShort; } + + // add a prefix to the catalog lookup path: the message catalog files will be + // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix + // (in this order). + // + // This only applies to subsequent invocations of AddCatalog()! + static void AddCatalogLookupPathPrefix(const wxString& prefix); + + // add a catalog: it's searched for in standard places (current directory + // first, system one after), but the you may prepend additional directories to + // the search path with AddCatalogLookupPathPrefix(). + // + // The loaded catalog will be used for message lookup by GetString(). + // + // Returns 'true' if it was successfully loaded + bool AddCatalog(const wxChar *szDomain); + bool AddCatalog(const wxChar *szDomain, + wxLanguage msgIdLanguage, const wxChar *msgIdCharset); + + // check if the given locale is provided by OS and C run time + static bool IsAvailable(int lang); + + // check if the given catalog is loaded + bool IsLoaded(const wxChar *szDomain) const; + + // Retrieve the language info struct for the given language + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo *GetLanguageInfo(int lang); + + // Returns language name in English or empty string if the language + // is not in database + static wxString GetLanguageName(int lang); + + // Find the language for the given locale string which may be either a + // canonical ISO 2 letter language code ("xx"), a language code followed by + // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo *FindLanguageInfo(const wxString& locale); + + // Add custom language to the list of known languages. + // Notes: 1) wxLanguageInfo contains platform-specific data + // 2) must be called before Init to have effect + static void AddLanguage(const wxLanguageInfo& info); + + // retrieve the translation for a string in all loaded domains unless + // the szDomain parameter is specified (and then only this domain is + // searched) + // n - additional parameter for PluralFormsParser + // + // return original string if translation is not available + // (in this case an error message is generated the first time + // a string is not found; use wxLogNull to suppress it) + // + // domains are searched in the last to first order, i.e. catalogs + // added later override those added before. + virtual const wxChar *GetString(const wxChar *szOrigString, + const wxChar *szDomain = NULL) const; + // plural form version of the same: + virtual const wxChar *GetString(const wxChar *szOrigString, + const wxChar *szOrigString2, + size_t n, + const wxChar *szDomain = NULL) const; + + // Returns the current short name for the locale + const wxString& GetName() const { return m_strShort; } + + // return the contents of .po file header + wxString GetHeaderValue( const wxChar* szHeader, + const wxChar* szDomain = NULL ) const; + + // These two methods are for internal use only. First one creates + // ms_languagesDB if it doesn't already exist, second one destroys + // it. + static void CreateLanguagesDB(); + static void DestroyLanguagesDB(); + +private: + // find catalog by name in a linked list, return NULL if !found + wxMsgCatalog *FindCatalog(const wxChar *szDomain) const; + + // copy default table of languages from global static array to + // m_langugagesInfo, called by InitLanguagesDB + static void InitLanguagesDB(); + + // initialize the member fields to default values + void DoCommonInit(); + + wxString m_strLocale, // this locale name + m_strShort; // short name for the locale + int m_language; // this locale wxLanguage value + + const wxChar *m_pszOldLocale; // previous locale from setlocale() + wxLocale *m_pOldLocale; // previous wxLocale + + wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs + + bool m_bConvertEncoding; + + bool m_initialized; + + static wxLanguageInfoArray *ms_languagesDB; + + DECLARE_NO_COPY_CLASS(wxLocale) +}; + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// get the current locale object (note that it may be NULL!) +extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale(); + +// get the translation of the string in the current locale +inline const wxChar * +wxGetTranslation(const wxChar *sz, const wxChar* domain = NULL) +{ + wxLocale *pLoc = wxGetLocale(); + if (pLoc) + return pLoc->GetString(sz, domain); + else + return sz; +} + +inline const wxChar * +wxGetTranslation(const wxChar *sz1, const wxChar *sz2, + size_t n, + const wxChar *domain = NULL) +{ + wxLocale *pLoc = wxGetLocale(); + if (pLoc) + return pLoc->GetString(sz1, sz2, n, domain); + else + return n == 1 ? sz1 : sz2; +} + +#else // !wxUSE_INTL + +// the macros should still be defined - otherwise compilation would fail + +#if !defined(WXINTL_NO_GETTEXT_MACRO) + #if !defined(_) + #define _(s) (_T(s)) + #endif + #define wxPLURAL(sing, plur, n) ((n) == 1 ? _T(sing) : _T(plur)) +#endif + +#define wxTRANSLATE(str) _T(str) + +inline const wxChar * +wxGetTranslation(const wxChar *sz, const wxChar * WXUNUSED(domain) = NULL) +{ + return sz; +} + +#endif // wxUSE_INTL/!wxUSE_INTL + +// define this one just in case it occurs somewhere (instead of preferred +// wxTRANSLATE) too +#if !defined(WXINTL_NO_GETTEXT_MACRO) + #if !defined(gettext_noop) + #define gettext_noop(str) _T(str) + #endif + #if !defined(N_) + #define N_(s) _T(s) + #endif +#endif + +#endif // _WX_INTL_H_ diff --git a/Externals/wxWidgets/include/wx/iosfwrap.h b/Externals/wxWidgets/include/wx/iosfwrap.h index 0a68afcc26..a4df4bfb9b 100644 --- a/Externals/wxWidgets/include/wx/iosfwrap.h +++ b/Externals/wxWidgets/include/wx/iosfwrap.h @@ -1,26 +1,26 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/iosfwrap.h -// Purpose: includes the correct stream-related forward declarations -// Author: Jan van Dijk <jan@etpmod.phys.tue.nl> -// Modified by: -// Created: 18.12.2002 -// RCS-ID: $Id: iosfwrap.h 33555 2005-04-12 21:06:03Z ABX $ -// Copyright: wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#if wxUSE_STD_IOSTREAM - -#if wxUSE_IOSTREAMH - // There is no pre-ANSI iosfwd header so we include the full declarations. -# include <iostream.h> -#else -# include <iosfwd> -#endif - -#ifdef __WXMSW__ -# include "wx/msw/winundef.h" -#endif - -#endif // wxUSE_STD_IOSTREAM - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/iosfwrap.h +// Purpose: includes the correct stream-related forward declarations +// Author: Jan van Dijk <jan@etpmod.phys.tue.nl> +// Modified by: +// Created: 18.12.2002 +// RCS-ID: $Id: iosfwrap.h 33555 2005-04-12 21:06:03Z ABX $ +// Copyright: wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if wxUSE_STD_IOSTREAM + +#if wxUSE_IOSTREAMH + // There is no pre-ANSI iosfwd header so we include the full declarations. +# include <iostream.h> +#else +# include <iosfwd> +#endif + +#ifdef __WXMSW__ +# include "wx/msw/winundef.h" +#endif + +#endif // wxUSE_STD_IOSTREAM + diff --git a/Externals/wxWidgets/include/wx/ioswrap.h b/Externals/wxWidgets/include/wx/ioswrap.h index 19292af5dd..0c94219f8b 100644 --- a/Externals/wxWidgets/include/wx/ioswrap.h +++ b/Externals/wxWidgets/include/wx/ioswrap.h @@ -1,26 +1,26 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/ioswrap.h -// Purpose: includes the correct iostream headers for current compiler -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.02.99 -// RCS-ID: $Id: ioswrap.h 33555 2005-04-12 21:06:03Z ABX $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#if wxUSE_STD_IOSTREAM - -#if wxUSE_IOSTREAMH -# include <iostream.h> -#else -# include <iostream> -#endif - -#ifdef __WXMSW__ -# include "wx/msw/winundef.h" -#endif - -#endif - // wxUSE_STD_IOSTREAM - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ioswrap.h +// Purpose: includes the correct iostream headers for current compiler +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.02.99 +// RCS-ID: $Id: ioswrap.h 33555 2005-04-12 21:06:03Z ABX $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if wxUSE_STD_IOSTREAM + +#if wxUSE_IOSTREAMH +# include <iostream.h> +#else +# include <iostream> +#endif + +#ifdef __WXMSW__ +# include "wx/msw/winundef.h" +#endif + +#endif + // wxUSE_STD_IOSTREAM + diff --git a/Externals/wxWidgets/include/wx/ipc.h b/Externals/wxWidgets/include/wx/ipc.h index 2472fc43e7..34d056dde4 100644 --- a/Externals/wxWidgets/include/wx/ipc.h +++ b/Externals/wxWidgets/include/wx/ipc.h @@ -1,45 +1,45 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/ipc.h -// Purpose: wrapper around different wxIPC classes implementations -// Author: Vadim Zeitlin -// Modified by: -// Created: 15.04.02 -// RCS-ID: $Id: ipc.h 35698 2005-09-25 20:49:40Z MW $ -// Copyright: (c) 2002 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IPC_H_ -#define _WX_IPC_H_ - -// Set wxUSE_DDE_FOR_IPC to 1 to use DDE for IPC under Windows. If it is set to -// 0, or if the platform is not Windows, use TCP/IP for IPC implementation - -#if !defined(wxUSE_DDE_FOR_IPC) - #ifdef __WXMSW__ - #define wxUSE_DDE_FOR_IPC 1 - #else - #define wxUSE_DDE_FOR_IPC 0 - #endif -#endif // !defined(wxUSE_DDE_FOR_IPC) - -#if !defined(__WINDOWS__) - #undef wxUSE_DDE_FOR_IPC - #define wxUSE_DDE_FOR_IPC 0 -#endif - -#if wxUSE_DDE_FOR_IPC - #define wxConnection wxDDEConnection - #define wxServer wxDDEServer - #define wxClient wxDDEClient - - #include "wx/dde.h" -#else // !wxUSE_DDE_FOR_IPC - #define wxConnection wxTCPConnection - #define wxServer wxTCPServer - #define wxClient wxTCPClient - - #include "wx/sckipc.h" -#endif // wxUSE_DDE_FOR_IPC/!wxUSE_DDE_FOR_IPC - -#endif // _WX_IPC_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ipc.h +// Purpose: wrapper around different wxIPC classes implementations +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.04.02 +// RCS-ID: $Id: ipc.h 35698 2005-09-25 20:49:40Z MW $ +// Copyright: (c) 2002 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IPC_H_ +#define _WX_IPC_H_ + +// Set wxUSE_DDE_FOR_IPC to 1 to use DDE for IPC under Windows. If it is set to +// 0, or if the platform is not Windows, use TCP/IP for IPC implementation + +#if !defined(wxUSE_DDE_FOR_IPC) + #ifdef __WXMSW__ + #define wxUSE_DDE_FOR_IPC 1 + #else + #define wxUSE_DDE_FOR_IPC 0 + #endif +#endif // !defined(wxUSE_DDE_FOR_IPC) + +#if !defined(__WINDOWS__) + #undef wxUSE_DDE_FOR_IPC + #define wxUSE_DDE_FOR_IPC 0 +#endif + +#if wxUSE_DDE_FOR_IPC + #define wxConnection wxDDEConnection + #define wxServer wxDDEServer + #define wxClient wxDDEClient + + #include "wx/dde.h" +#else // !wxUSE_DDE_FOR_IPC + #define wxConnection wxTCPConnection + #define wxServer wxTCPServer + #define wxClient wxTCPClient + + #include "wx/sckipc.h" +#endif // wxUSE_DDE_FOR_IPC/!wxUSE_DDE_FOR_IPC + +#endif // _WX_IPC_H_ diff --git a/Externals/wxWidgets/include/wx/ipcbase.h b/Externals/wxWidgets/include/wx/ipcbase.h index d2a48f6216..e12f52dfe7 100644 --- a/Externals/wxWidgets/include/wx/ipcbase.h +++ b/Externals/wxWidgets/include/wx/ipcbase.h @@ -1,163 +1,163 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ipcbase.h -// Purpose: Base classes for IPC -// Author: Julian Smart -// Modified by: -// Created: 4/1/98 -// RCS-ID: $Id: ipcbase.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IPCBASEH__ -#define _WX_IPCBASEH__ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" - -enum wxIPCFormat -{ - wxIPC_INVALID = 0, - wxIPC_TEXT = 1, /* CF_TEXT */ - wxIPC_BITMAP = 2, /* CF_BITMAP */ - wxIPC_METAFILE = 3, /* CF_METAFILEPICT */ - wxIPC_SYLK = 4, - wxIPC_DIF = 5, - wxIPC_TIFF = 6, - wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */ - wxIPC_DIB = 8, /* CF_DIB */ - wxIPC_PALETTE = 9, - wxIPC_PENDATA = 10, - wxIPC_RIFF = 11, - wxIPC_WAVE = 12, - wxIPC_UNICODETEXT = 13, - wxIPC_ENHMETAFILE = 14, - wxIPC_FILENAME = 15, /* CF_HDROP */ - wxIPC_LOCALE = 16, - wxIPC_PRIVATE = 20 -}; - -class WXDLLIMPEXP_FWD_BASE wxServerBase; -class WXDLLIMPEXP_FWD_BASE wxClientBase; - -class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject -{ - DECLARE_CLASS(wxConnectionBase) - -public: - wxConnectionBase(wxChar *buffer, int size); // use external buffer - wxConnectionBase(); // use internal, adaptive buffer - wxConnectionBase(const wxConnectionBase& copy); - virtual ~wxConnectionBase(void); - - void SetConnected( bool c ) { m_connected = c; } - bool GetConnected() { return m_connected; } - - // Calls that CLIENT can make - virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0; - virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } - virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0; - virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; - virtual bool StartAdvise(const wxString& item) = 0; - virtual bool StopAdvise(const wxString& item) = 0; - - // Calls that SERVER can make - virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; - - // Calls that both can make - virtual bool Disconnect(void) = 0; - - // Callbacks to SERVER - override at will - virtual bool OnExecute ( const wxString& WXUNUSED(topic), - wxChar *WXUNUSED(data), - int WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return false; } - - virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - int *WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return (wxChar *) NULL; } - - virtual bool OnPoke ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - wxChar *WXUNUSED(data), - int WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return false; } - - virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item) ) - { return false; } - - virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item) ) - { return false; } - - // Callbacks to CLIENT - override at will - virtual bool OnAdvise ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - wxChar *WXUNUSED(data), - int WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return false; } - - // Callbacks to BOTH - override at will - // Default behaviour is to delete connection and return true - virtual bool OnDisconnect(void) = 0; - - // return a buffer at least this size, reallocating buffer if needed - // returns NULL if using an inadequate user buffer - it can't be resized - wxChar * GetBufferAtLeast( size_t bytes ); - -protected: - bool m_connected; -private: - wxChar * m_buffer; - size_t m_buffersize; - bool m_deletebufferwhendone; - - // can't use DECLARE_NO_COPY_CLASS(wxConnectionBase) because we already - // have copy ctor but still forbid the default assignment operator - wxConnectionBase& operator=(const wxConnectionBase&); -}; - - -class WXDLLIMPEXP_BASE wxServerBase: public wxObject -{ - DECLARE_CLASS(wxServerBase) - -public: - inline wxServerBase(void) {} - inline ~wxServerBase(void) {} - - // Returns false on error (e.g. port number is already in use) - virtual bool Create(const wxString& serverName) = 0; - - // Callbacks to SERVER - override at will - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; -}; - -class WXDLLIMPEXP_BASE wxClientBase: public wxObject -{ - DECLARE_CLASS(wxClientBase) - -public: - inline wxClientBase(void) {} - inline ~wxClientBase(void) {} - - virtual bool ValidHost(const wxString& host) = 0; - - // Call this to make a connection. Returns NULL if cannot. - virtual wxConnectionBase *MakeConnection(const wxString& host, - const wxString& server, - const wxString& topic) = 0; - - // Callbacks to CLIENT - override at will - virtual wxConnectionBase *OnMakeConnection(void) = 0; -}; - -#endif - // _WX_IPCBASEH__ +///////////////////////////////////////////////////////////////////////////// +// Name: ipcbase.h +// Purpose: Base classes for IPC +// Author: Julian Smart +// Modified by: +// Created: 4/1/98 +// RCS-ID: $Id: ipcbase.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IPCBASEH__ +#define _WX_IPCBASEH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" + +enum wxIPCFormat +{ + wxIPC_INVALID = 0, + wxIPC_TEXT = 1, /* CF_TEXT */ + wxIPC_BITMAP = 2, /* CF_BITMAP */ + wxIPC_METAFILE = 3, /* CF_METAFILEPICT */ + wxIPC_SYLK = 4, + wxIPC_DIF = 5, + wxIPC_TIFF = 6, + wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */ + wxIPC_DIB = 8, /* CF_DIB */ + wxIPC_PALETTE = 9, + wxIPC_PENDATA = 10, + wxIPC_RIFF = 11, + wxIPC_WAVE = 12, + wxIPC_UNICODETEXT = 13, + wxIPC_ENHMETAFILE = 14, + wxIPC_FILENAME = 15, /* CF_HDROP */ + wxIPC_LOCALE = 16, + wxIPC_PRIVATE = 20 +}; + +class WXDLLIMPEXP_FWD_BASE wxServerBase; +class WXDLLIMPEXP_FWD_BASE wxClientBase; + +class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject +{ + DECLARE_CLASS(wxConnectionBase) + +public: + wxConnectionBase(wxChar *buffer, int size); // use external buffer + wxConnectionBase(); // use internal, adaptive buffer + wxConnectionBase(const wxConnectionBase& copy); + virtual ~wxConnectionBase(void); + + void SetConnected( bool c ) { m_connected = c; } + bool GetConnected() { return m_connected; } + + // Calls that CLIENT can make + virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0; + virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } + virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0; + virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; + virtual bool StartAdvise(const wxString& item) = 0; + virtual bool StopAdvise(const wxString& item) = 0; + + // Calls that SERVER can make + virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; + + // Calls that both can make + virtual bool Disconnect(void) = 0; + + // Callbacks to SERVER - override at will + virtual bool OnExecute ( const wxString& WXUNUSED(topic), + wxChar *WXUNUSED(data), + int WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return false; } + + virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + int *WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return (wxChar *) NULL; } + + virtual bool OnPoke ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + wxChar *WXUNUSED(data), + int WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return false; } + + virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item) ) + { return false; } + + virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item) ) + { return false; } + + // Callbacks to CLIENT - override at will + virtual bool OnAdvise ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + wxChar *WXUNUSED(data), + int WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return false; } + + // Callbacks to BOTH - override at will + // Default behaviour is to delete connection and return true + virtual bool OnDisconnect(void) = 0; + + // return a buffer at least this size, reallocating buffer if needed + // returns NULL if using an inadequate user buffer - it can't be resized + wxChar * GetBufferAtLeast( size_t bytes ); + +protected: + bool m_connected; +private: + wxChar * m_buffer; + size_t m_buffersize; + bool m_deletebufferwhendone; + + // can't use DECLARE_NO_COPY_CLASS(wxConnectionBase) because we already + // have copy ctor but still forbid the default assignment operator + wxConnectionBase& operator=(const wxConnectionBase&); +}; + + +class WXDLLIMPEXP_BASE wxServerBase: public wxObject +{ + DECLARE_CLASS(wxServerBase) + +public: + inline wxServerBase(void) {} + inline ~wxServerBase(void) {} + + // Returns false on error (e.g. port number is already in use) + virtual bool Create(const wxString& serverName) = 0; + + // Callbacks to SERVER - override at will + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; +}; + +class WXDLLIMPEXP_BASE wxClientBase: public wxObject +{ + DECLARE_CLASS(wxClientBase) + +public: + inline wxClientBase(void) {} + inline ~wxClientBase(void) {} + + virtual bool ValidHost(const wxString& host) = 0; + + // Call this to make a connection. Returns NULL if cannot. + virtual wxConnectionBase *MakeConnection(const wxString& host, + const wxString& server, + const wxString& topic) = 0; + + // Callbacks to CLIENT - override at will + virtual wxConnectionBase *OnMakeConnection(void) = 0; +}; + +#endif + // _WX_IPCBASEH__ diff --git a/Externals/wxWidgets/include/wx/isql.h b/Externals/wxWidgets/include/wx/isql.h index 26f7824790..cec4920b39 100644 --- a/Externals/wxWidgets/include/wx/isql.h +++ b/Externals/wxWidgets/include/wx/isql.h @@ -1,248 +1,248 @@ -/* - * isql.h - * - * $Id: isql.h 35518 2005-09-16 11:22:35Z JS $ - * - * iODBC defines - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin <kejin@empress.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _ISQL_H -#define _ISQL_H - -#if defined(WIN32) -#define SQL_API __stdcall - -#ifndef FAR -#define FAR -#endif - -#elif defined(__OS2__) -#define SQL_API _Optlink - -#ifndef FAR -#define FAR -#define EXPORT -#define CALLBACK -#endif - -#else -#define FAR -#define EXPORT -#define CALLBACK -#define SQL_API EXPORT CALLBACK - -#ifndef __EMX__ -typedef void *HWND; -#endif -#endif - -typedef void *SQLHWND; - -typedef unsigned char UCHAR; -typedef long int SDWORD; -typedef short int SWORD; -typedef unsigned long int UDWORD; -typedef unsigned short int UWORD; -typedef long SQLINTEGER; -typedef UDWORD SQLUINTEGER; - -typedef void FAR *PTR; -typedef void FAR *HENV; -typedef void FAR *HDBC; -typedef void FAR *HSTMT; - -typedef signed short RETCODE; -#define SQLRETURN RETCODE - - -#define ODBCVER 0x0250 - -#define SQL_MAX_MESSAGE_LENGTH 512 -#define SQL_MAX_DSN_LENGTH 32 - -/* - * Function return codes - */ -#define SQL_INVALID_HANDLE (-2) -#define SQL_ERROR (-1) -#define SQL_SUCCESS 0 -#define SQL_SUCCESS_WITH_INFO 1 -#define SQL_NO_DATA_FOUND 100 - -/* - * Standard SQL datatypes, using ANSI type numbering - */ -#define SQL_CHAR 1 -#define SQL_NUMERIC 2 -#define SQL_DECIMAL 3 -#define SQL_INTEGER 4 -#define SQL_SMALLINT 5 -#define SQL_FLOAT 6 -#define SQL_REAL 7 -#define SQL_DOUBLE 8 -#define SQL_VARCHAR 12 - -#define SQL_TYPE_MIN SQL_CHAR -#define SQL_TYPE_NULL 0 -#define SQL_TYPE_MAX SQL_VARCHAR - -/* - * C datatype to SQL datatype mapping - */ -#define SQL_C_CHAR SQL_CHAR -#define SQL_C_LONG SQL_INTEGER -#define SQL_C_SHORT SQL_SMALLINT -#define SQL_C_FLOAT SQL_REAL -#define SQL_C_DOUBLE SQL_DOUBLE -#define SQL_C_DEFAULT 99 - -/* - * NULL status constants. - */ -#define SQL_NO_NULLS 0 -#define SQL_NULLABLE 1 -#define SQL_NULLABLE_UNKNOWN 2 - -/* - * Special length values - */ -#define SQL_NULL_DATA (-1) -#define SQL_DATA_AT_EXEC (-2) -#define SQL_NTS (-3) - -/* - * SQLFreeStmt - */ -#define SQL_CLOSE 0 -#define SQL_DROP 1 -#define SQL_UNBIND 2 -#define SQL_RESET_PARAMS 3 - -/* - * SQLTransact - */ -#define SQL_COMMIT 0 -#define SQL_ROLLBACK 1 - -/* - * SQLColAttributes - */ -#define SQL_COLUMN_COUNT 0 -#define SQL_COLUMN_NAME 1 -#define SQL_COLUMN_TYPE 2 -#define SQL_COLUMN_LENGTH 3 -#define SQL_COLUMN_PRECISION 4 -#define SQL_COLUMN_SCALE 5 -#define SQL_COLUMN_DISPLAY_SIZE 6 -#define SQL_COLUMN_NULLABLE 7 -#define SQL_COLUMN_UNSIGNED 8 -#define SQL_COLUMN_MONEY 9 -#define SQL_COLUMN_UPDATABLE 10 -#define SQL_COLUMN_AUTO_INCREMENT 11 -#define SQL_COLUMN_CASE_SENSITIVE 12 -#define SQL_COLUMN_SEARCHABLE 13 -#define SQL_COLUMN_TYPE_NAME 14 -#define SQL_COLUMN_TABLE_NAME 15 -#define SQL_COLUMN_OWNER_NAME 16 -#define SQL_COLUMN_QUALIFIER_NAME 17 -#define SQL_COLUMN_LABEL 18 - -#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL -#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT -#define SQL_COLUMN_DRIVER_START 1000 - -/* - * SQLColAttributes : SQL_COLUMN_UPDATABLE - */ -#define SQL_ATTR_READONLY 0 -#define SQL_ATTR_WRITE 1 -#define SQL_ATTR_READWRITE_UNKNOWN 2 - -/* - * SQLColAttributes : SQL_COLUMN_SEARCHABLE - */ -#define SQL_UNSEARCHABLE 0 -#define SQL_LIKE_ONLY 1 -#define SQL_ALL_EXCEPT_LIKE 2 -#define SQL_SEARCHABLE 3 - -/* - * NULL Handles - */ -#define SQL_NULL_HENV 0 -#define SQL_NULL_HDBC 0 -#define SQL_NULL_HSTMT 0 - - -/* - * Function Prototypes - */ -#ifdef __cplusplus -extern "C" -{ -#endif - - RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc); - RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv); - RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt); - RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType, - PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue); - RETCODE SQL_API SQLCancel (HSTMT hstmt); - RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType, - PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc); - RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN, - UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr); - RETCODE SQL_API SQLDescribeCol (HSTMT hstmt, UWORD icol, - UCHAR FAR * szColName, SWORD cbColNameMax, SWORD FAR * pcbColName, - SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale, - SWORD FAR * pfNullable); - RETCODE SQL_API SQLDisconnect (HDBC hdbc); - RETCODE SQL_API SQLError (HENV henv, HDBC hdbc, HSTMT hstmt, - UCHAR FAR * szSqlState, SDWORD FAR * pfNativeError, UCHAR FAR * szErrorMsg, - SWORD cbErrorMsgMax, SWORD FAR * pcbErrorMsg); - RETCODE SQL_API SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr, - SDWORD cbSqlStr); - RETCODE SQL_API SQLExecute (HSTMT hstmt); - RETCODE SQL_API SQLFetch (HSTMT hstmt); - RETCODE SQL_API SQLFreeConnect (HDBC hdbc); - RETCODE SQL_API SQLFreeEnv (HENV henv); - RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption); - RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor, - SWORD cbCursorMax, SWORD FAR * pcbCursor); - RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol); - RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr, - SDWORD cbSqlStr); - RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow); - RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor, - SWORD cbCursor); - RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType); - -/* - * Deprecated ODBC 1.0 function - Use SQLBindParameter - */ - RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType, - SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue, - SDWORD FAR * pcbValue); - -#ifdef __cplusplus -} -#endif - -#endif +/* + * isql.h + * + * $Id: isql.h 35518 2005-09-16 11:22:35Z JS $ + * + * iODBC defines + * + * The iODBC driver manager. + * + * Copyright (C) 1995 by Ke Jin <kejin@empress.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _ISQL_H +#define _ISQL_H + +#if defined(WIN32) +#define SQL_API __stdcall + +#ifndef FAR +#define FAR +#endif + +#elif defined(__OS2__) +#define SQL_API _Optlink + +#ifndef FAR +#define FAR +#define EXPORT +#define CALLBACK +#endif + +#else +#define FAR +#define EXPORT +#define CALLBACK +#define SQL_API EXPORT CALLBACK + +#ifndef __EMX__ +typedef void *HWND; +#endif +#endif + +typedef void *SQLHWND; + +typedef unsigned char UCHAR; +typedef long int SDWORD; +typedef short int SWORD; +typedef unsigned long int UDWORD; +typedef unsigned short int UWORD; +typedef long SQLINTEGER; +typedef UDWORD SQLUINTEGER; + +typedef void FAR *PTR; +typedef void FAR *HENV; +typedef void FAR *HDBC; +typedef void FAR *HSTMT; + +typedef signed short RETCODE; +#define SQLRETURN RETCODE + + +#define ODBCVER 0x0250 + +#define SQL_MAX_MESSAGE_LENGTH 512 +#define SQL_MAX_DSN_LENGTH 32 + +/* + * Function return codes + */ +#define SQL_INVALID_HANDLE (-2) +#define SQL_ERROR (-1) +#define SQL_SUCCESS 0 +#define SQL_SUCCESS_WITH_INFO 1 +#define SQL_NO_DATA_FOUND 100 + +/* + * Standard SQL datatypes, using ANSI type numbering + */ +#define SQL_CHAR 1 +#define SQL_NUMERIC 2 +#define SQL_DECIMAL 3 +#define SQL_INTEGER 4 +#define SQL_SMALLINT 5 +#define SQL_FLOAT 6 +#define SQL_REAL 7 +#define SQL_DOUBLE 8 +#define SQL_VARCHAR 12 + +#define SQL_TYPE_MIN SQL_CHAR +#define SQL_TYPE_NULL 0 +#define SQL_TYPE_MAX SQL_VARCHAR + +/* + * C datatype to SQL datatype mapping + */ +#define SQL_C_CHAR SQL_CHAR +#define SQL_C_LONG SQL_INTEGER +#define SQL_C_SHORT SQL_SMALLINT +#define SQL_C_FLOAT SQL_REAL +#define SQL_C_DOUBLE SQL_DOUBLE +#define SQL_C_DEFAULT 99 + +/* + * NULL status constants. + */ +#define SQL_NO_NULLS 0 +#define SQL_NULLABLE 1 +#define SQL_NULLABLE_UNKNOWN 2 + +/* + * Special length values + */ +#define SQL_NULL_DATA (-1) +#define SQL_DATA_AT_EXEC (-2) +#define SQL_NTS (-3) + +/* + * SQLFreeStmt + */ +#define SQL_CLOSE 0 +#define SQL_DROP 1 +#define SQL_UNBIND 2 +#define SQL_RESET_PARAMS 3 + +/* + * SQLTransact + */ +#define SQL_COMMIT 0 +#define SQL_ROLLBACK 1 + +/* + * SQLColAttributes + */ +#define SQL_COLUMN_COUNT 0 +#define SQL_COLUMN_NAME 1 +#define SQL_COLUMN_TYPE 2 +#define SQL_COLUMN_LENGTH 3 +#define SQL_COLUMN_PRECISION 4 +#define SQL_COLUMN_SCALE 5 +#define SQL_COLUMN_DISPLAY_SIZE 6 +#define SQL_COLUMN_NULLABLE 7 +#define SQL_COLUMN_UNSIGNED 8 +#define SQL_COLUMN_MONEY 9 +#define SQL_COLUMN_UPDATABLE 10 +#define SQL_COLUMN_AUTO_INCREMENT 11 +#define SQL_COLUMN_CASE_SENSITIVE 12 +#define SQL_COLUMN_SEARCHABLE 13 +#define SQL_COLUMN_TYPE_NAME 14 +#define SQL_COLUMN_TABLE_NAME 15 +#define SQL_COLUMN_OWNER_NAME 16 +#define SQL_COLUMN_QUALIFIER_NAME 17 +#define SQL_COLUMN_LABEL 18 + +#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL +#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT +#define SQL_COLUMN_DRIVER_START 1000 + +/* + * SQLColAttributes : SQL_COLUMN_UPDATABLE + */ +#define SQL_ATTR_READONLY 0 +#define SQL_ATTR_WRITE 1 +#define SQL_ATTR_READWRITE_UNKNOWN 2 + +/* + * SQLColAttributes : SQL_COLUMN_SEARCHABLE + */ +#define SQL_UNSEARCHABLE 0 +#define SQL_LIKE_ONLY 1 +#define SQL_ALL_EXCEPT_LIKE 2 +#define SQL_SEARCHABLE 3 + +/* + * NULL Handles + */ +#define SQL_NULL_HENV 0 +#define SQL_NULL_HDBC 0 +#define SQL_NULL_HSTMT 0 + + +/* + * Function Prototypes + */ +#ifdef __cplusplus +extern "C" +{ +#endif + + RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc); + RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv); + RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt); + RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType, + PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue); + RETCODE SQL_API SQLCancel (HSTMT hstmt); + RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType, + PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc); + RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN, + UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr); + RETCODE SQL_API SQLDescribeCol (HSTMT hstmt, UWORD icol, + UCHAR FAR * szColName, SWORD cbColNameMax, SWORD FAR * pcbColName, + SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale, + SWORD FAR * pfNullable); + RETCODE SQL_API SQLDisconnect (HDBC hdbc); + RETCODE SQL_API SQLError (HENV henv, HDBC hdbc, HSTMT hstmt, + UCHAR FAR * szSqlState, SDWORD FAR * pfNativeError, UCHAR FAR * szErrorMsg, + SWORD cbErrorMsgMax, SWORD FAR * pcbErrorMsg); + RETCODE SQL_API SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr, + SDWORD cbSqlStr); + RETCODE SQL_API SQLExecute (HSTMT hstmt); + RETCODE SQL_API SQLFetch (HSTMT hstmt); + RETCODE SQL_API SQLFreeConnect (HDBC hdbc); + RETCODE SQL_API SQLFreeEnv (HENV henv); + RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption); + RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor, + SWORD cbCursorMax, SWORD FAR * pcbCursor); + RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol); + RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr, + SDWORD cbSqlStr); + RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow); + RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor, + SWORD cbCursor); + RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType); + +/* + * Deprecated ODBC 1.0 function - Use SQLBindParameter + */ + RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType, + SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue, + SDWORD FAR * pcbValue); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/wxWidgets/include/wx/isqlext.h b/Externals/wxWidgets/include/wx/isqlext.h index 56dfbddbb0..1b2a833acc 100644 --- a/Externals/wxWidgets/include/wx/isqlext.h +++ b/Externals/wxWidgets/include/wx/isqlext.h @@ -1,1178 +1,1178 @@ -/* - * - * isqlext.h - * - * $Id: isqlext.h 30070 2004-10-22 19:11:07Z KH $ - * - * iODBC defines (ext) - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin <kejin@empress.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _ISQLEXT_H -#define _ISQLEXT_H - -#include "wx/isql.h" - -/* - * Generic constants - */ -#define SQL_MAX_OPTION_STRING_LENGTH 256 - -/* - * Additional return codes - */ -#define SQL_STILL_EXECUTING 2 -#define SQL_NEED_DATA 99 - -/* - * SQL extended datatypes - */ -#define SQL_DATE 9 -#define SQL_TIME 10 -#define SQL_TIMESTAMP 11 -#define SQL_LONGVARCHAR (-1) -#define SQL_BINARY (-2) -#define SQL_VARBINARY (-3) -#define SQL_LONGVARBINARY (-4) -#define SQL_BIGINT (-5) -#define SQL_TINYINT (-6) -#define SQL_BIT (-7) - -#define SQL_INTERVAL_YEAR (-80) -#define SQL_INTERVAL_MONTH (-81) -#define SQL_INTERVAL_YEAR_TO_MONTH (-82) -#define SQL_INTERVAL_DAY (-83) -#define SQL_INTERVAL_HOUR (-84) -#define SQL_INTERVAL_MINUTE (-85) -#define SQL_INTERVAL_SECOND (-86) -#define SQL_INTERVAL_DAY_TO_HOUR (-87) -#define SQL_INTERVAL_DAY_TO_MINUTE (-88) -#define SQL_INTERVAL_DAY_TO_SECOND (-89) -#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) -#define SQL_INTERVAL_HOUR_TO_SECOND (-91) -#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) -#define SQL_UNICODE (-95) - -#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR -#define SQL_TYPE_DRIVER_END SQL_UNICODE - -#define SQL_SIGNED_OFFSET (-20) -#define SQL_UNSIGNED_OFFSET (-22) - -/* - * C datatype to SQL datatype mapping - */ -#define SQL_C_DATE SQL_DATE -#define SQL_C_TIME SQL_TIME -#define SQL_C_TIMESTAMP SQL_TIMESTAMP -#define SQL_C_BINARY SQL_BINARY -#define SQL_C_BIT SQL_BIT -#define SQL_C_TINYINT SQL_TINYINT -#define SQL_C_SLONG SQL_C_LONG+SQL_SIGNED_OFFSET -#define SQL_C_SSHORT SQL_C_SHORT+SQL_SIGNED_OFFSET -#define SQL_C_STINYINT SQL_TINYINT+SQL_SIGNED_OFFSET -#define SQL_C_ULONG SQL_C_LONG+SQL_UNSIGNED_OFFSET -#define SQL_C_USHORT SQL_C_SHORT+SQL_UNSIGNED_OFFSET -#define SQL_C_UTINYINT SQL_TINYINT+SQL_UNSIGNED_OFFSET -#define SQL_C_BOOKMARK SQL_C_ULONG - -/* - * Extended data types override sql.h defined - */ -#undef SQL_TYPE_MIN -#define SQL_TYPE_MIN SQL_BIT -#define SQL_ALL_TYPES 0 - -/* - * SQL portable types for C - DATE, TIME, TIMESTAMP - */ -typedef struct _DATE_STRUCT - { - SWORD year; - UWORD month; - UWORD day; - } -DATE_STRUCT; - -typedef struct _TIME_STRUCT - { - UWORD hour; - UWORD minute; - UWORD second; - } -TIME_STRUCT; - -typedef struct _TIMESTAMP_STRUCT - { - SWORD year; - UWORD month; - UWORD day; - UWORD hour; - UWORD minute; - UWORD second; - UDWORD fraction; - } -TIMESTAMP_STRUCT; - -typedef unsigned long int BOOKMARK; - -/* - * ---------------------------------------------------------------------- - * Level 1 Functions - * ---------------------------------------------------------------------- - */ - -/* - * SQLDriverConnect - */ -#define SQL_DRIVER_NOPROMPT 0 -#define SQL_DRIVER_COMPLETE 1 -#define SQL_DRIVER_PROMPT 2 -#define SQL_DRIVER_COMPLETE_REQUIRED 3 - -/* - * SQLGetData - */ -#define SQL_NO_TOTAL (-4) - -/* - * SQLBindParameter - */ -#define SQL_DEFAULT_PARAM (-5) -#define SQL_IGNORE (-6) -#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) -#define SQL_LEN_DATA_AT_EXEC(length) (-length+SQL_LEN_DATA_AT_EXEC_OFFSET) - -/* - * SQLGetFunctions - */ -#define SQL_API_SQLALLOCCONNECT 1 /* Core Functions */ -#define SQL_API_SQLALLOCENV 2 -#define SQL_API_SQLALLOCSTMT 3 -#define SQL_API_SQLBINDCOL 4 -#define SQL_API_SQLCANCEL 5 -#define SQL_API_SQLCOLATTRIBUTES 6 -#define SQL_API_SQLCONNECT 7 -#define SQL_API_SQLDESCRIBECOL 8 -#define SQL_API_SQLDISCONNECT 9 -#define SQL_API_SQLERROR 10 -#define SQL_API_SQLEXECDIRECT 11 -#define SQL_API_SQLEXECUTE 12 -#define SQL_API_SQLFETCH 13 -#define SQL_API_SQLFREECONNECT 14 -#define SQL_API_SQLFREEENV 15 -#define SQL_API_SQLFREESTMT 16 -#define SQL_API_SQLGETCURSORNAME 17 -#define SQL_API_SQLNUMRESULTCOLS 18 -#define SQL_API_SQLPREPARE 19 -#define SQL_API_SQLROWCOUNT 20 -#define SQL_API_SQLSETCURSORNAME 21 -#define SQL_API_SQLSETPARAM 22 -#define SQL_API_SQLTRANSACT 23 - -#define SQL_NUM_FUNCTIONS 23 - -#define SQL_EXT_API_START 40 - -#define SQL_API_SQLCOLUMNS 40 /* Level 1 Functions */ -#define SQL_API_SQLDRIVERCONNECT 41 -#define SQL_API_SQLGETCONNECTOPTION 42 -#define SQL_API_SQLGETDATA 43 -#define SQL_API_SQLGETFUNCTIONS 44 -#define SQL_API_SQLGETINFO 45 -#define SQL_API_SQLGETSTMTOPTION 46 -#define SQL_API_SQLGETTYPEINFO 47 -#define SQL_API_SQLPARAMDATA 48 -#define SQL_API_SQLPUTDATA 49 -#define SQL_API_SQLSETCONNECTOPTION 50 -#define SQL_API_SQLSETSTMTOPTION 51 -#define SQL_API_SQLSPECIALCOLUMNS 52 -#define SQL_API_SQLSTATISTICS 53 -#define SQL_API_SQLTABLES 54 - -#define SQL_API_SQLBROWSECONNECT 55 /* Level 2 Functions */ -#define SQL_API_SQLCOLUMNPRIVILEGES 56 -#define SQL_API_SQLDATASOURCES 57 -#define SQL_API_SQLDESCRIBEPARAM 58 -#define SQL_API_SQLEXTENDEDFETCH 59 -#define SQL_API_SQLFOREIGNKEYS 60 -#define SQL_API_SQLMORERESULTS 61 -#define SQL_API_SQLNATIVESQL 62 -#define SQL_API_SQLNUMPARAMS 63 -#define SQL_API_SQLPARAMOPTIONS 64 -#define SQL_API_SQLPRIMARYKEYS 65 -#define SQL_API_SQLPROCEDURECOLUMNS 66 -#define SQL_API_SQLPROCEDURES 67 -#define SQL_API_SQLSETPOS 68 -#define SQL_API_SQLSETSCROLLOPTIONS 69 -#define SQL_API_SQLTABLEPRIVILEGES 70 - -#define SQL_API_SQLDRIVERS 71 -#define SQL_API_SQLBINDPARAMETER 72 -#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER - -#define SQL_API_ALL_FUNCTIONS 0 - -#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) - -/* - * SQLGetInfo - */ -#define SQL_INFO_FIRST 0 -#define SQL_ACTIVE_CONNECTIONS 0 -#define SQL_ACTIVE_STATEMENTS 1 -#define SQL_DATA_SOURCE_NAME 2 -#define SQL_DRIVER_HDBC 3 -#define SQL_DRIVER_HENV 4 -#define SQL_DRIVER_HSTMT 5 -#define SQL_DRIVER_NAME 6 -#define SQL_DRIVER_VER 7 -#define SQL_FETCH_DIRECTION 8 -#define SQL_ODBC_API_CONFORMANCE 9 -#define SQL_ODBC_VER 10 -#define SQL_ROW_UPDATES 11 -#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 -#define SQL_SERVER_NAME 13 -#define SQL_SEARCH_PATTERN_ESCAPE 14 -#define SQL_ODBC_SQL_CONFORMANCE 15 -#define SQL_DBMS_NAME 17 -#define SQL_DBMS_VER 18 -#define SQL_ACCESSIBLE_TABLES 19 -#define SQL_ACCESSIBLE_PROCEDURES 20 -#define SQL_PROCEDURES 21 -#define SQL_CONCAT_NULL_BEHAVIOR 22 -#define SQL_CURSOR_COMMIT_BEHAVIOR 23 -#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 -#define SQL_DATA_SOURCE_READ_ONLY 25 -#define SQL_DEFAULT_TXN_ISOLATION 26 -#define SQL_EXPRESSIONS_IN_ORDERBY 27 -#define SQL_IDENTIFIER_CASE 28 -#define SQL_IDENTIFIER_QUOTE_CHAR 29 -#define SQL_MAX_COLUMN_NAME_LEN 30 -#define SQL_MAX_CURSOR_NAME_LEN 31 -#define SQL_MAX_OWNER_NAME_LEN 32 -#define SQL_MAX_PROCEDURE_NAME_LEN 33 -#define SQL_MAX_QUALIFIER_NAME_LEN 34 -#define SQL_MAX_TABLE_NAME_LEN 35 -#define SQL_MULT_RESULT_SETS 36 -#define SQL_MULTIPLE_ACTIVE_TXN 37 -#define SQL_OUTER_JOINS 38 -#define SQL_OWNER_TERM 39 -#define SQL_PROCEDURE_TERM 40 -#define SQL_QUALIFIER_NAME_SEPARATOR 41 -#define SQL_QUALIFIER_TERM 42 -#define SQL_SCROLL_CONCURRENCY 43 -#define SQL_SCROLL_OPTIONS 44 -#define SQL_TABLE_TERM 45 -#define SQL_TXN_CAPABLE 46 -#define SQL_USER_NAME 47 -#define SQL_CONVERT_FUNCTIONS 48 -#define SQL_NUMERIC_FUNCTIONS 49 -#define SQL_STRING_FUNCTIONS 50 -#define SQL_SYSTEM_FUNCTIONS 51 -#define SQL_TIMEDATE_FUNCTIONS 52 -#define SQL_CONVERT_BIGINT 53 -#define SQL_CONVERT_BINARY 54 -#define SQL_CONVERT_BIT 55 -#define SQL_CONVERT_CHAR 56 -#define SQL_CONVERT_DATE 57 -#define SQL_CONVERT_DECIMAL 58 -#define SQL_CONVERT_DOUBLE 59 -#define SQL_CONVERT_FLOAT 60 -#define SQL_CONVERT_INTEGER 61 -#define SQL_CONVERT_LONGVARCHAR 62 -#define SQL_CONVERT_NUMERIC 63 -#define SQL_CONVERT_REAL 64 -#define SQL_CONVERT_SMALLINT 65 -#define SQL_CONVERT_TIME 66 -#define SQL_CONVERT_TIMESTAMP 67 -#define SQL_CONVERT_TINYINT 68 -#define SQL_CONVERT_VARBINARY 69 -#define SQL_CONVERT_VARCHAR 70 -#define SQL_CONVERT_LONGVARBINARY 71 -#define SQL_TXN_ISOLATION_OPTION 72 -#define SQL_ODBC_SQL_OPT_IEF 73 - -/* - * ODBC SDK 1.0 Additions - */ -#define SQL_CORRELATION_NAME 74 -#define SQL_NON_NULLABLE_COLUMNS 75 - -/* - * ODBC SDK 2.0 Additions - */ -#define SQL_DRIVER_HLIB 76 -#define SQL_DRIVER_ODBC_VER 77 -#define SQL_LOCK_TYPES 78 -#define SQL_POS_OPERATIONS 79 -#define SQL_POSITIONED_STATEMENTS 80 -#define SQL_GETDATA_EXTENSIONS 81 -#define SQL_BOOKMARK_PERSISTENCE 82 -#define SQL_STATIC_SENSITIVITY 83 -#define SQL_FILE_USAGE 84 -#define SQL_NULL_COLLATION 85 -#define SQL_ALTER_TABLE 86 -#define SQL_COLUMN_ALIAS 87 -#define SQL_GROUP_BY 88 -#define SQL_KEYWORDS 89 -#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 -#define SQL_OWNER_USAGE 91 -#define SQL_QUALIFIER_USAGE 92 -#define SQL_QUOTED_IDENTIFIER_CASE 93 -#define SQL_SPECIAL_CHARACTERS 94 -#define SQL_SUBQUERIES 95 -#define SQL_UNION 96 -#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 -#define SQL_MAX_COLUMNS_IN_INDEX 98 -#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 -#define SQL_MAX_COLUMNS_IN_SELECT 100 -#define SQL_MAX_COLUMNS_IN_TABLE 101 -#define SQL_MAX_INDEX_SIZE 102 -#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 -#define SQL_MAX_ROW_SIZE 104 -#define SQL_MAX_STATEMENT_LEN 105 -#define SQL_MAX_TABLES_IN_SELECT 106 -#define SQL_MAX_USER_NAME_LEN 107 -#define SQL_MAX_CHAR_LITERAL_LEN 108 -#define SQL_TIMEDATE_ADD_INTERVALS 109 -#define SQL_TIMEDATE_DIFF_INTERVALS 110 -#define SQL_NEED_LONG_DATA_LEN 111 -#define SQL_MAX_BINARY_LITERAL_LEN 112 -#define SQL_LIKE_ESCAPE_CLAUSE 113 -#define SQL_QUALIFIER_LOCATION 114 - -/* - * ODBC SDK 2.01 Additions - */ -#define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */ - -#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION -#define SQL_INFO_DRIVER_START 1000 - - -/* - * SQL_CONVERT_* bitmask values - */ -#define SQL_CVT_CHAR 0x00000001L -#define SQL_CVT_NUMERIC 0x00000002L -#define SQL_CVT_DECIMAL 0x00000004L -#define SQL_CVT_INTEGER 0x00000008L -#define SQL_CVT_SMALLINT 0x00000010L -#define SQL_CVT_FLOAT 0x00000020L -#define SQL_CVT_REAL 0x00000040L -#define SQL_CVT_DOUBLE 0x00000080L -#define SQL_CVT_VARCHAR 0x00000100L -#define SQL_CVT_LONGVARCHAR 0x00000200L -#define SQL_CVT_BINARY 0x00000400L -#define SQL_CVT_VARBINARY 0x00000800L -#define SQL_CVT_BIT 0x00001000L -#define SQL_CVT_TINYINT 0x00002000L -#define SQL_CVT_BIGINT 0x00004000L -#define SQL_CVT_DATE 0x00008000L -#define SQL_CVT_TIME 0x00010000L -#define SQL_CVT_TIMESTAMP 0x00020000L -#define SQL_CVT_LONGVARBINARY 0x00040000L - -/* - * SQL_CONVERT_FUNCTIONS - */ -#define SQL_FN_CVT_CONVERT 0x00000001L - -/* - * SQL_STRING_FUNCTIONS - */ -#define SQL_FN_STR_CONCAT 0x00000001L -#define SQL_FN_STR_INSERT 0x00000002L -#define SQL_FN_STR_LEFT 0x00000004L -#define SQL_FN_STR_LTRIM 0x00000008L -#define SQL_FN_STR_LENGTH 0x00000010L -#define SQL_FN_STR_LOCATE 0x00000020L -#define SQL_FN_STR_LCASE 0x00000040L -#define SQL_FN_STR_REPEAT 0x00000080L -#define SQL_FN_STR_REPLACE 0x00000100L -#define SQL_FN_STR_RIGHT 0x00000200L -#define SQL_FN_STR_RTRIM 0x00000400L -#define SQL_FN_STR_SUBSTRING 0x00000800L -#define SQL_FN_STR_UCASE 0x00001000L -#define SQL_FN_STR_ASCII 0x00002000L -#define SQL_FN_STR_CHAR 0x00004000L -#define SQL_FN_STR_DIFFERENCE 0x00008000L -#define SQL_FN_STR_LOCATE_2 0x00010000L -#define SQL_FN_STR_SOUNDEX 0x00020000L -#define SQL_FN_STR_SPACE 0x00040000L - -/* - * SQL_NUMERIC_FUNCTIONS - */ -#define SQL_FN_NUM_ABS 0x00000001L -#define SQL_FN_NUM_ACOS 0x00000002L -#define SQL_FN_NUM_ASIN 0x00000004L -#define SQL_FN_NUM_ATAN 0x00000008L -#define SQL_FN_NUM_ATAN2 0x00000010L -#define SQL_FN_NUM_CEILING 0x00000020L -#define SQL_FN_NUM_COS 0x00000040L -#define SQL_FN_NUM_COT 0x00000080L -#define SQL_FN_NUM_EXP 0x00000100L -#define SQL_FN_NUM_FLOOR 0x00000200L -#define SQL_FN_NUM_LOG 0x00000400L -#define SQL_FN_NUM_MOD 0x00000800L -#define SQL_FN_NUM_SIGN 0x00001000L -#define SQL_FN_NUM_SIN 0x00002000L -#define SQL_FN_NUM_SQRT 0x00004000L -#define SQL_FN_NUM_TAN 0x00008000L -#define SQL_FN_NUM_PI 0x00010000L -#define SQL_FN_NUM_RAND 0x00020000L -#define SQL_FN_NUM_DEGREES 0x00040000L -#define SQL_FN_NUM_LOG10 0x00080000L -#define SQL_FN_NUM_POWER 0x00100000L -#define SQL_FN_NUM_RADIANS 0x00200000L -#define SQL_FN_NUM_ROUND 0x00400000L -#define SQL_FN_NUM_TRUNCATE 0x00800000L - -/* - * SQL_TIMEDATE_FUNCTIONS - */ -#define SQL_FN_TD_NOW 0x00000001L -#define SQL_FN_TD_CURDATE 0x00000002L -#define SQL_FN_TD_DAYOFMONTH 0x00000004L -#define SQL_FN_TD_DAYOFWEEK 0x00000008L -#define SQL_FN_TD_DAYOFYEAR 0x00000010L -#define SQL_FN_TD_MONTH 0x00000020L -#define SQL_FN_TD_QUARTER 0x00000040L -#define SQL_FN_TD_WEEK 0x00000080L -#define SQL_FN_TD_YEAR 0x00000100L -#define SQL_FN_TD_CURTIME 0x00000200L -#define SQL_FN_TD_HOUR 0x00000400L -#define SQL_FN_TD_MINUTE 0x00000800L -#define SQL_FN_TD_SECOND 0x00001000L -#define SQL_FN_TD_TIMESTAMPADD 0x00002000L -#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L -#define SQL_FN_TD_DAYNAME 0x00008000L -#define SQL_FN_TD_MONTHNAME 0x00010000L - -/* - * SQL_SYSTEM_FUNCTIONS - */ -#define SQL_FN_SYS_USERNAME 0x00000001L -#define SQL_FN_SYS_DBNAME 0x00000002L -#define SQL_FN_SYS_IFNULL 0x00000004L - -/* - * SQL_TIMEDATE_ADD_INTERVALS - * SQL_TIMEDATE_DIFF_INTERVALS - */ -#define SQL_FN_TSI_FRAC_SECOND 0x00000001L -#define SQL_FN_TSI_SECOND 0x00000002L -#define SQL_FN_TSI_MINUTE 0x00000004L -#define SQL_FN_TSI_HOUR 0x00000008L -#define SQL_FN_TSI_DAY 0x00000010L -#define SQL_FN_TSI_WEEK 0x00000020L -#define SQL_FN_TSI_MONTH 0x00000040L -#define SQL_FN_TSI_QUARTER 0x00000080L -#define SQL_FN_TSI_YEAR 0x00000100L - -/* - * SQL_ODBC_API_CONFORMANCE - */ -#define SQL_OAC_NONE 0x0000 -#define SQL_OAC_LEVEL1 0x0001 -#define SQL_OAC_LEVEL2 0x0002 - -/* - * SQL_ODBC_SAG_CLI_CONFORMANCE - */ -#define SQL_OSCC_NOT_COMPLIANT 0x0000 -#define SQL_OSCC_COMPLIANT 0x0001 - -/* - * SQL_ODBC_SQL_CONFORMANCE - */ -#define SQL_OSC_MINIMUM 0x0000 -#define SQL_OSC_CORE 0x0001 -#define SQL_OSC_EXTENDED 0x0002 - -/* - * SQL_CONCAT_NULL_BEHAVIOR - */ -#define SQL_CB_NULL 0x0000 -#define SQL_CB_NON_NULL 0x0001 - -/* - * SQL_CURSOR_COMMIT_BEHAVIOR - * SQL_CURSOR_ROLLBACK_BEHAVIOR - */ -#define SQL_CB_DELETE 0x0000 -#define SQL_CB_CLOSE 0x0001 -#define SQL_CB_PRESERVE 0x0002 - -/* - * SQL_IDENTIFIER_CASE - */ -#define SQL_IC_UPPER 0x0001 -#define SQL_IC_LOWER 0x0002 -#define SQL_IC_SENSITIVE 0x0003 -#define SQL_IC_MIXED 0x0004 - -/* - * SQL_TXN_CAPABLE - */ -#define SQL_TC_NONE 0x0000 -#define SQL_TC_DML 0x0001 -#define SQL_TC_ALL 0x0002 -#define SQL_TC_DDL_COMMIT 0x0003 -#define SQL_TC_DDL_IGNORE 0x0004 - -/* - * SQL_SCROLL_OPTIONS - */ -#define SQL_SO_FORWARD_ONLY 0x00000001L -#define SQL_SO_KEYSET_DRIVEN 0x00000002L -#define SQL_SO_DYNAMIC 0x00000004L -#define SQL_SO_MIXED 0x00000008L -#define SQL_SO_STATIC 0x00000010L - -/* - * SQL_SCROLL_CONCURRENCY - */ -#define SQL_SCCO_READ_ONLY 0x00000001L -#define SQL_SCCO_LOCK 0x00000002L -#define SQL_SCCO_OPT_ROWVER 0x00000004L -#define SQL_SCCO_OPT_VALUES 0x00000008L - -/* - * SQL_FETCH_DIRECTION - */ -#define SQL_FD_FETCH_NEXT 0x00000001L -#define SQL_FD_FETCH_FIRST 0x00000002L -#define SQL_FD_FETCH_LAST 0x00000004L -#define SQL_FD_FETCH_PRIOR 0x00000008L -#define SQL_FD_FETCH_ABSOLUTE 0x00000010L -#define SQL_FD_FETCH_RELATIVE 0x00000020L -#define SQL_FD_FETCH_RESUME 0x00000040L -#define SQL_FD_FETCH_BOOKMARK 0x00000080L - -/* - * SQL_TXN_ISOLATION_OPTION - */ -#define SQL_TXN_READ_UNCOMMITTED 0x00000001L -#define SQL_TXN_READ_COMMITTED 0x00000002L -#define SQL_TXN_REPEATABLE_READ 0x00000004L -#define SQL_TXN_SERIALIZABLE 0x00000008L -#define SQL_TXN_VERSIONING 0x00000010L - -/* - * SQL_CORRELATION_NAME - */ -#define SQL_CN_NONE 0x0000 -#define SQL_CN_DIFFERENT 0x0001 -#define SQL_CN_ANY 0x0002 - -/* - * SQL_NON_NULLABLE_COLUMNS - */ -#define SQL_NNC_NULL 0x0000 -#define SQL_NNC_NON_NULL 0x0001 - -/* - * SQL_NULL_COLLATION - */ -#define SQL_NC_HIGH 0x0000 -#define SQL_NC_LOW 0x0001 -#define SQL_NC_START 0x0002 -#define SQL_NC_END 0x0004 - -/* - * SQL_FILE_USAGE - */ -#define SQL_FILE_NOT_SUPPORTED 0x0000 -#define SQL_FILE_TABLE 0x0001 -#define SQL_FILE_QUALIFIER 0x0002 - -/* - * SQL_GETDATA_EXTENSIONS - */ -#define SQL_GD_ANY_COLUMN 0x00000001L -#define SQL_GD_ANY_ORDER 0x00000002L -#define SQL_GD_BLOCK 0x00000004L -#define SQL_GD_BOUND 0x00000008L - -/* - * SQL_ALTER_TABLE - */ -#define SQL_AT_ADD_COLUMN 0x00000001L -#define SQL_AT_DROP_COLUMN 0x00000002L - -/* - * SQL_POSITIONED_STATEMENTS - */ -#define SQL_PS_POSITIONED_DELETE 0x00000001L -#define SQL_PS_POSITIONED_UPDATE 0x00000002L -#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L - -/* - * SQL_GROUP_BY - */ -#define SQL_GB_NOT_SUPPORTED 0x0000 -#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001 -#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002 -#define SQL_GB_NO_RELATION 0x0003 - -/* - * SQL_OWNER_USAGE - */ -#define SQL_OU_DML_STATEMENTS 0x00000001L -#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L -#define SQL_OU_TABLE_DEFINITION 0x00000004L -#define SQL_OU_INDEX_DEFINITION 0x00000008L -#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L - -/* - * SQL_QUALIFIER_USAGE - */ -#define SQL_QU_DML_STATEMENTS 0x00000001L -#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L -#define SQL_QU_TABLE_DEFINITION 0x00000004L -#define SQL_QU_INDEX_DEFINITION 0x00000008L -#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L - -/* - * SQL_SUBQUERIES - */ -#define SQL_SQ_COMPARISON 0x00000001L -#define SQL_SQ_EXISTS 0x00000002L -#define SQL_SQ_IN 0x00000004L -#define SQL_SQ_QUANTIFIED 0x00000008L -#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L - -/* - * SQL_UNION - */ -#define SQL_U_UNION 0x00000001L -#define SQL_U_UNION_ALL 0x00000002L - -/* - * SQL_BOOKMARK_PERSISTENCE - */ -#define SQL_BP_CLOSE 0x00000001L -#define SQL_BP_DELETE 0x00000002L -#define SQL_BP_DROP 0x00000004L -#define SQL_BP_TRANSACTION 0x00000008L -#define SQL_BP_UPDATE 0x00000010L -#define SQL_BP_OTHER_HSTMT 0x00000020L -#define SQL_BP_SCROLL 0x00000040L - -/* - * SQL_STATIC_SENSITIVITY - */ -#define SQL_SS_ADDITIONS 0x00000001L -#define SQL_SS_DELETIONS 0x00000002L -#define SQL_SS_UPDATES 0x00000004L - -/* - * SQL_LOCK_TYPES - */ -#define SQL_LCK_NO_CHANGE 0x00000001L -#define SQL_LCK_EXCLUSIVE 0x00000002L -#define SQL_LCK_UNLOCK 0x00000004L - -/* - * SQL_POS_OPERATIONS - */ -#define SQL_POS_POSITION 0x00000001L -#define SQL_POS_REFRESH 0x00000002L -#define SQL_POS_UPDATE 0x00000004L -#define SQL_POS_DELETE 0x00000008L -#define SQL_POS_ADD 0x00000010L - -/* - * SQL_QUALIFIER_LOCATION - */ -#define SQL_QL_START 0x0001L -#define SQL_QL_END 0x0002L - -/* - * SQL_OJ_CAPABILITIES - */ -#define SQL_OJ_LEFT 0x00000001L -#define SQL_OJ_RIGHT 0x00000002L -#define SQL_OJ_FULL 0x00000004L -#define SQL_OJ_NESTED 0x00000008L -#define SQL_OJ_NOT_ORDERED 0x00000010L -#define SQL_OJ_INNER 0x00000020L -#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L - -/* - * SQLGetStmtOption/SQLSetStmtOption - */ -#define SQL_QUERY_TIMEOUT 0 -#define SQL_MAX_ROWS 1 -#define SQL_NOSCAN 2 -#define SQL_MAX_LENGTH 3 -#define SQL_ASYNC_ENABLE 4 -#define SQL_BIND_TYPE 5 -#define SQL_CURSOR_TYPE 6 -#define SQL_CONCURRENCY 7 -#define SQL_KEYSET_SIZE 8 -#define SQL_ROWSET_SIZE 9 -#define SQL_SIMULATE_CURSOR 10 -#define SQL_RETRIEVE_DATA 11 -#define SQL_USE_BOOKMARKS 12 -#define SQL_GET_BOOKMARK 13 -#define SQL_ROW_NUMBER 14 - -#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT -#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER - - -/* - * SQL_QUERY_TIMEOUT - */ -#define SQL_QUERY_TIMEOUT_DEFAULT 0UL - -/* - * SQL_MAX_ROWS - */ -#define SQL_MAX_ROWS_DEFAULT 0UL - -/* - * SQL_NOSCAN - */ -#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */ -#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */ -#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF - -/* - * SQL_MAX_LENGTH - */ -#define SQL_MAX_LENGTH_DEFAULT 0UL - -/* - * SQL_ASYNC_ENABLE - */ -#define SQL_ASYNC_ENABLE_OFF 0UL -#define SQL_ASYNC_ENABLE_ON 1UL -#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF - -/* - * SQL_BIND_TYPE - */ -#define SQL_BIND_BY_COLUMN 0UL -#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN - -/* - * SQL_CONCURRENCY - */ -#define SQL_CONCUR_READ_ONLY 1 -#define SQL_CONCUR_LOCK 2 -#define SQL_CONCUR_ROWVER 3 -#define SQL_CONCUR_VALUES 4 -#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY - -/* - * SQL_CURSOR_TYPE - */ -#define SQL_CURSOR_FORWARD_ONLY 0UL -#define SQL_CURSOR_KEYSET_DRIVEN 1UL -#define SQL_CURSOR_DYNAMIC 2UL -#define SQL_CURSOR_STATIC 3UL -#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY - -/* - * SQL_ROWSET_SIZE - */ -#define SQL_ROWSET_SIZE_DEFAULT 1UL - -/* - * SQL_KEYSET_SIZE - */ -#define SQL_KEYSET_SIZE_DEFAULT 0UL - -/* - * SQL_SIMULATE_CURSOR - */ -#define SQL_SC_NON_UNIQUE 0UL -#define SQL_SC_TRY_UNIQUE 1UL -#define SQL_SC_UNIQUE 2UL - -/* - * SQL_RETRIEVE_DATA - */ -#define SQL_RD_OFF 0UL -#define SQL_RD_ON 1UL -#define SQL_RD_DEFAULT SQL_RD_ON - -/* - * SQL_USE_BOOKMARKS - */ -#define SQL_UB_OFF 0UL -#define SQL_UB_ON 1UL -#define SQL_UB_DEFAULT SQL_UB_OFF - -/* - * SQLSetConnectOption/SQLGetConnectOption - */ -#define SQL_ACCESS_MODE 101 -#define SQL_AUTOCOMMIT 102 -#define SQL_LOGIN_TIMEOUT 103 -#define SQL_OPT_TRACE 104 -#define SQL_OPT_TRACEFILE 105 -#define SQL_TRANSLATE_DLL 106 -#define SQL_TRANSLATE_OPTION 107 -#define SQL_TXN_ISOLATION 108 -#define SQL_CURRENT_QUALIFIER 109 -#define SQL_ODBC_CURSORS 110 -#define SQL_QUIET_MODE 111 -#define SQL_PACKET_SIZE 112 - -#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE -#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE -#define SQL_CONNECT_OPT_DRVR_START 1000 - - -/* - * SQL_ACCESS_MODE - */ -#define SQL_MODE_READ_WRITE 0UL -#define SQL_MODE_READ_ONLY 1UL -#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE - -/* - * SQL_AUTOCOMMIT - */ -#define SQL_AUTOCOMMIT_OFF 0UL -#define SQL_AUTOCOMMIT_ON 1UL -#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON - -/* - * SQL_LOGIN_TIMEOUT - */ -#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL - -/* - * SQL_OPT_TRACE - */ -#define SQL_OPT_TRACE_OFF 0UL -#define SQL_OPT_TRACE_ON 1UL -#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF -#define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log" - -/* - * SQL_ODBC_CURSORS - */ -#define SQL_CUR_USE_IF_NEEDED 0UL -#define SQL_CUR_USE_ODBC 1UL -#define SQL_CUR_USE_DRIVER 2UL -#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER - -/* - * SQLSpecialColumns - Column types and scopes - */ -#define SQL_BEST_ROWID 1 -#define SQL_ROWVER 2 - -#define SQL_SCOPE_CURROW 0 -#define SQL_SCOPE_TRANSACTION 1 -#define SQL_SCOPE_SESSION 2 - -/* - * SQLSetPos - */ -#define SQL_ENTIRE_ROWSET 0 - -/* - * SQLSetPos - */ -#define SQL_POSITION 0 -#define SQL_REFRESH 1 -#define SQL_UPDATE 2 -#define SQL_DELETE 3 -#define SQL_ADD 4 - -/* - * SQLSetPos - */ -#define SQL_LOCK_NO_CHANGE 0 -#define SQL_LOCK_EXCLUSIVE 1 -#define SQL_LOCK_UNLOCK 2 - -/* - * SQLSetPos - */ -#define SQL_POSITION_TO(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) -#define SQL_LOCK_RECORD(hstmt,irow,fLock) \ - SQLSetPos(hstmt,irow,SQL_POSITION,fLock) -#define SQL_REFRESH_RECORD(hstmt,irow,fLock) \ - SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) -#define SQL_UPDATE_RECORD(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) -#define SQL_DELETE_RECORD(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) -#define SQL_ADD_RECORD(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) - -/* - * All the ODBC keywords - */ -#define SQL_ODBC_KEYWORDS \ -"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\ -"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\ -"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\ -"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\ -"COBOL,COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\ -"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\ -"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\ -"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\ -"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\ -"DISTINCT,DOMAIN,DOUBLE,DROP,"\ -"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\ -"EXISTS,EXTERNAL,EXTRACT,"\ -"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\ -"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\ -"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\ -"INPUT,INSENSITIVE,INSERT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\ -"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\ -"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,MUMPS,"\ -"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\ -"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\ -"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\ -"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\ -"REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS,"\ -"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SEQUENCE,SESSION,SESSION_USER,SET,SIZE,"\ -"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\ -"SUBSTRING,SUM,SYSTEM_USER,"\ -"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\ -"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\ -"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\ -"VALUE,,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,YEAR" - -/* - * ---------------------------------------------------------------------- - * Level 2 Functions - * ---------------------------------------------------------------------- - */ - -/* - * SQLExtendedFetch - fFetchType - */ -#define SQL_FETCH_NEXT 1 -#define SQL_FETCH_FIRST 2 -#define SQL_FETCH_LAST 3 -#define SQL_FETCH_PRIOR 4 -#define SQL_FETCH_ABSOLUTE 5 -#define SQL_FETCH_RELATIVE 6 -#define SQL_FETCH_BOOKMARK 8 - -/* - * SQLExtendedFetch - rgfRowStatus - */ -#define SQL_ROW_SUCCESS 0 -#define SQL_ROW_DELETED 1 -#define SQL_ROW_UPDATED 2 -#define SQL_ROW_NOROW 3 -#define SQL_ROW_ADDED 4 -#define SQL_ROW_ERROR 5 - -/* - * SQLForeignKeys - UPDATE_RULE/DELETE_RULE - */ -#define SQL_CASCADE 0 -#define SQL_RESTRICT 1 -#define SQL_SET_NULL 2 - -/* - * SQLBindParameter - fParamType - * SQLProcedureColumns - COLUMN_TYPE - */ -#define SQL_PARAM_TYPE_UNKNOWN 0 -#define SQL_PARAM_INPUT 1 -#define SQL_PARAM_INPUT_OUTPUT 2 -#define SQL_RESULT_COL 3 -#define SQL_PARAM_OUTPUT 4 -#define SQL_RETURN_VALUE 5 - -/* - * SQLSetParam to SQLBindParameter conversion - */ -#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT -#define SQL_SETPARAM_VALUE_MAX (-1L) - -/* - * SQLStatistics - fUnique - */ -#define SQL_INDEX_UNIQUE 0 -#define SQL_INDEX_ALL 1 - -/* - * SQLStatistics - fAccuracy - */ -#define SQL_QUICK 0 -#define SQL_ENSURE 1 - -/* - * SQLStatistics - TYPE - */ -#define SQL_TABLE_STAT 0 -#define SQL_INDEX_CLUSTERED 1 -#define SQL_INDEX_HASHED 2 -#define SQL_INDEX_OTHER 3 - -/* - * SQLProcedures - PROCEDURE_TYPE - */ -#define SQL_PT_UNKNOWN 0 -#define SQL_PT_PROCEDURE 1 -#define SQL_PT_FUNCTION 2 - -/* - * SQLSpecialColumns - PSEUDO_COLUMN - */ -#define SQL_PC_UNKNOWN 0 -#define SQL_PC_NOT_PSEUDO 1 -#define SQL_PC_PSEUDO 2 - -/* - * Deprecated defines from prior versions of ODBC - */ -#define SQL_DATABASE_NAME 16 -#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR -#define SQL_FETCH_PREV SQL_FETCH_PRIOR -#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER -#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER -#define SQL_CC_DELETE SQL_CB_DELETE -#define SQL_CR_DELETE SQL_CB_DELETE -#define SQL_CC_CLOSE SQL_CB_CLOSE -#define SQL_CR_CLOSE SQL_CB_CLOSE -#define SQL_CC_PRESERVE SQL_CB_PRESERVE -#define SQL_CR_PRESERVE SQL_CB_PRESERVE -#define SQL_FETCH_RESUME 7 -#define SQL_SCROLL_FORWARD_ONLY 0L -#define SQL_SCROLL_KEYSET_DRIVEN (-1L) -#define SQL_SCROLL_DYNAMIC (-2L) -#define SQL_SCROLL_STATIC (-3L) -#define SQL_PC_NON_PSEUDO SQL_PC_NOT_PSEUDO - -#ifdef __cplusplus -extern "C" { -#endif -/* - * Level 1 function prototypes - */ -RETCODE SQL_API SQLColumns (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName, UCHAR FAR * szColumnName, - SWORD cbColumnName); -/* glt - Changed HWND to SQLHWND to match MSW header typing */ -RETCODE SQL_API SQLDriverConnect (HDBC hdbc, SQLHWND hwnd, - UCHAR FAR * szConnStrIn, SWORD cbConnStrIn, UCHAR FAR * szConnStrOut, - SWORD cbConnStrOutMax, SWORD FAR * pcbConnStrOut, UWORD fDriverCompletion); -RETCODE SQL_API SQLGetConnectOption (HDBC hdbc, UWORD fOption, PTR pvParam); -RETCODE SQL_API SQLGetData (HSTMT hstmt, UWORD icol, SWORD fCType, - PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue); -RETCODE SQL_API SQLGetFunctions (HDBC hdbc, UWORD fFunction, - UWORD FAR * pfExists); -RETCODE SQL_API SQLGetInfo (HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue, - SWORD cbInfoValueMax, SWORD FAR * pcbInfoValue); -RETCODE SQL_API SQLGetStmtOption (HSTMT hstmt, UWORD fOption, PTR pvParam); -RETCODE SQL_API SQLGetTypeInfo (HSTMT hstmt, SWORD fSqlType); -RETCODE SQL_API SQLParamData (HSTMT hstmt, PTR FAR * prgbValue); -RETCODE SQL_API SQLPutData (HSTMT hstmt, PTR rgbValue, SDWORD cbValue); -RETCODE SQL_API SQLSetConnectOption (HDBC hdbc, UWORD fOption, UDWORD vParam); -RETCODE SQL_API SQLSetStmtOption (HSTMT hstmt, UWORD fOption, UDWORD vParam); -RETCODE SQL_API SQLSpecialColumns (HSTMT hstmt, UWORD fColType, - UCHAR FAR * szTableQualifier, SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, SWORD cbTableOwner, UCHAR FAR * szTableName, - SWORD cbTableName, UWORD fScope, UWORD fNullable); -RETCODE SQL_API SQLStatistics (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName, UWORD fUnique, UWORD fAccuracy); -RETCODE SQL_API SQLTables (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName, UCHAR FAR * szTableType, - SWORD cbTableType); - -/* - * Level 2 function prototypes - */ -RETCODE SQL_API SQLBrowseConnect (HDBC hdbc, - UCHAR FAR * szConnStrIn, SWORD cbConnStrIn, UCHAR FAR * szConnStrOut, - SWORD cbConnStrOutMax, SWORD FAR * pcbConnStrOut); -RETCODE SQL_API SQLColumnPrivileges (HSTMT hstmt, - UCHAR FAR * szTableQualifier, SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, SWORD cbTableOwner, UCHAR FAR * szTableName, - SWORD cbTableName, UCHAR FAR * szColumnName, SWORD cbColumnName); -RETCODE SQL_API SQLDataSources (HENV henv, UWORD fDirection, - UCHAR FAR * szDSN, SWORD cbDSNMax, SWORD FAR * pcbDSN, - UCHAR FAR * szDescription, SWORD cbDescriptionMax, - SWORD FAR * pcbDescription); -RETCODE SQL_API SQLDescribeParam (HSTMT hstmt, UWORD ipar, - SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale, - SWORD FAR * pfNullable); -RETCODE SQL_API SQLExtendedFetch (HSTMT hstmt, UWORD fFetchType, SDWORD irow, - UDWORD FAR * pcrow, UWORD FAR * rgfRowStatus); -RETCODE SQL_API SQLForeignKeys (HSTMT hstmt, UCHAR FAR * szPkTableQualifier, - SWORD cbPkTableQualifier, UCHAR FAR * szPkTableOwner, SWORD cbPkTableOwner, - UCHAR FAR * szPkTableName, SWORD cbPkTableName, - UCHAR FAR * szFkTableQualifier, SWORD cbFkTableQualifier, - UCHAR FAR * szFkTableOwner, SWORD cbFkTableOwner, UCHAR FAR * szFkTableName, - SWORD cbFkTableName); -RETCODE SQL_API SQLMoreResults (HSTMT hstmt); -RETCODE SQL_API SQLNativeSql (HDBC hdbc, UCHAR FAR * szSqlStrIn, - SDWORD cbSqlStrIn, UCHAR FAR * szSqlStr, SDWORD cbSqlStrMax, - SDWORD FAR * pcbSqlStr); -RETCODE SQL_API SQLNumParams (HSTMT hstmt, SWORD FAR * pcpar); -RETCODE SQL_API SQLParamOptions (HSTMT hstmt, UDWORD crow, UDWORD FAR * pirow); -RETCODE SQL_API SQLPrimaryKeys (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName); -RETCODE SQL_API SQLProcedureColumns (HSTMT hstmt, UCHAR FAR * szProcQualifier, - SWORD cbProcQualifier, UCHAR FAR * szProcOwner, SWORD cbProcOwner, - UCHAR FAR * szProcName, SWORD cbProcName, UCHAR FAR * szColumnName, - SWORD cbColumnName); -RETCODE SQL_API SQLProcedures (HSTMT hstmt, UCHAR FAR * szProcQualifier, - SWORD cbProcQualifier, UCHAR FAR * szProcOwner, SWORD cbProcOwner, - UCHAR FAR * szProcName, SWORD cbProcName); -RETCODE SQL_API SQLSetPos (HSTMT hstmt, UWORD irow, UWORD fOption, UWORD fLock); -RETCODE SQL_API SQLTablePrivileges (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName); - -/* - * SDK 2.0 Additional function prototypes - */ -RETCODE SQL_API SQLDrivers (HENV henv, UWORD fDirection, - UCHAR FAR * szDriverDesc, SWORD cbDriverDescMax, SWORD FAR * pcbDriverDesc, - UCHAR FAR * szDriverAttributes, SWORD cbDrvrAttrMax, - SWORD FAR * pcbDrvrAttr); -RETCODE SQL_API SQLBindParameter (HSTMT hstmt, UWORD ipar, SWORD fParamType, - SWORD fCType, SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue, - SDWORD cbValueMax, SDWORD FAR * pcbValue); - -/* - * Deprecated - use SQLSetStmtOptions - */ -RETCODE SQL_API SQLSetScrollOptions (HSTMT hstmt, UWORD fConcurrency, - SDWORD crowKeyset, UWORD crowRowset); - -#ifdef __cplusplus -} -#endif - -#endif +/* + * + * isqlext.h + * + * $Id: isqlext.h 30070 2004-10-22 19:11:07Z KH $ + * + * iODBC defines (ext) + * + * The iODBC driver manager. + * + * Copyright (C) 1995 by Ke Jin <kejin@empress.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _ISQLEXT_H +#define _ISQLEXT_H + +#include "wx/isql.h" + +/* + * Generic constants + */ +#define SQL_MAX_OPTION_STRING_LENGTH 256 + +/* + * Additional return codes + */ +#define SQL_STILL_EXECUTING 2 +#define SQL_NEED_DATA 99 + +/* + * SQL extended datatypes + */ +#define SQL_DATE 9 +#define SQL_TIME 10 +#define SQL_TIMESTAMP 11 +#define SQL_LONGVARCHAR (-1) +#define SQL_BINARY (-2) +#define SQL_VARBINARY (-3) +#define SQL_LONGVARBINARY (-4) +#define SQL_BIGINT (-5) +#define SQL_TINYINT (-6) +#define SQL_BIT (-7) + +#define SQL_INTERVAL_YEAR (-80) +#define SQL_INTERVAL_MONTH (-81) +#define SQL_INTERVAL_YEAR_TO_MONTH (-82) +#define SQL_INTERVAL_DAY (-83) +#define SQL_INTERVAL_HOUR (-84) +#define SQL_INTERVAL_MINUTE (-85) +#define SQL_INTERVAL_SECOND (-86) +#define SQL_INTERVAL_DAY_TO_HOUR (-87) +#define SQL_INTERVAL_DAY_TO_MINUTE (-88) +#define SQL_INTERVAL_DAY_TO_SECOND (-89) +#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) +#define SQL_INTERVAL_HOUR_TO_SECOND (-91) +#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) +#define SQL_UNICODE (-95) + +#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR +#define SQL_TYPE_DRIVER_END SQL_UNICODE + +#define SQL_SIGNED_OFFSET (-20) +#define SQL_UNSIGNED_OFFSET (-22) + +/* + * C datatype to SQL datatype mapping + */ +#define SQL_C_DATE SQL_DATE +#define SQL_C_TIME SQL_TIME +#define SQL_C_TIMESTAMP SQL_TIMESTAMP +#define SQL_C_BINARY SQL_BINARY +#define SQL_C_BIT SQL_BIT +#define SQL_C_TINYINT SQL_TINYINT +#define SQL_C_SLONG SQL_C_LONG+SQL_SIGNED_OFFSET +#define SQL_C_SSHORT SQL_C_SHORT+SQL_SIGNED_OFFSET +#define SQL_C_STINYINT SQL_TINYINT+SQL_SIGNED_OFFSET +#define SQL_C_ULONG SQL_C_LONG+SQL_UNSIGNED_OFFSET +#define SQL_C_USHORT SQL_C_SHORT+SQL_UNSIGNED_OFFSET +#define SQL_C_UTINYINT SQL_TINYINT+SQL_UNSIGNED_OFFSET +#define SQL_C_BOOKMARK SQL_C_ULONG + +/* + * Extended data types override sql.h defined + */ +#undef SQL_TYPE_MIN +#define SQL_TYPE_MIN SQL_BIT +#define SQL_ALL_TYPES 0 + +/* + * SQL portable types for C - DATE, TIME, TIMESTAMP + */ +typedef struct _DATE_STRUCT + { + SWORD year; + UWORD month; + UWORD day; + } +DATE_STRUCT; + +typedef struct _TIME_STRUCT + { + UWORD hour; + UWORD minute; + UWORD second; + } +TIME_STRUCT; + +typedef struct _TIMESTAMP_STRUCT + { + SWORD year; + UWORD month; + UWORD day; + UWORD hour; + UWORD minute; + UWORD second; + UDWORD fraction; + } +TIMESTAMP_STRUCT; + +typedef unsigned long int BOOKMARK; + +/* + * ---------------------------------------------------------------------- + * Level 1 Functions + * ---------------------------------------------------------------------- + */ + +/* + * SQLDriverConnect + */ +#define SQL_DRIVER_NOPROMPT 0 +#define SQL_DRIVER_COMPLETE 1 +#define SQL_DRIVER_PROMPT 2 +#define SQL_DRIVER_COMPLETE_REQUIRED 3 + +/* + * SQLGetData + */ +#define SQL_NO_TOTAL (-4) + +/* + * SQLBindParameter + */ +#define SQL_DEFAULT_PARAM (-5) +#define SQL_IGNORE (-6) +#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) +#define SQL_LEN_DATA_AT_EXEC(length) (-length+SQL_LEN_DATA_AT_EXEC_OFFSET) + +/* + * SQLGetFunctions + */ +#define SQL_API_SQLALLOCCONNECT 1 /* Core Functions */ +#define SQL_API_SQLALLOCENV 2 +#define SQL_API_SQLALLOCSTMT 3 +#define SQL_API_SQLBINDCOL 4 +#define SQL_API_SQLCANCEL 5 +#define SQL_API_SQLCOLATTRIBUTES 6 +#define SQL_API_SQLCONNECT 7 +#define SQL_API_SQLDESCRIBECOL 8 +#define SQL_API_SQLDISCONNECT 9 +#define SQL_API_SQLERROR 10 +#define SQL_API_SQLEXECDIRECT 11 +#define SQL_API_SQLEXECUTE 12 +#define SQL_API_SQLFETCH 13 +#define SQL_API_SQLFREECONNECT 14 +#define SQL_API_SQLFREEENV 15 +#define SQL_API_SQLFREESTMT 16 +#define SQL_API_SQLGETCURSORNAME 17 +#define SQL_API_SQLNUMRESULTCOLS 18 +#define SQL_API_SQLPREPARE 19 +#define SQL_API_SQLROWCOUNT 20 +#define SQL_API_SQLSETCURSORNAME 21 +#define SQL_API_SQLSETPARAM 22 +#define SQL_API_SQLTRANSACT 23 + +#define SQL_NUM_FUNCTIONS 23 + +#define SQL_EXT_API_START 40 + +#define SQL_API_SQLCOLUMNS 40 /* Level 1 Functions */ +#define SQL_API_SQLDRIVERCONNECT 41 +#define SQL_API_SQLGETCONNECTOPTION 42 +#define SQL_API_SQLGETDATA 43 +#define SQL_API_SQLGETFUNCTIONS 44 +#define SQL_API_SQLGETINFO 45 +#define SQL_API_SQLGETSTMTOPTION 46 +#define SQL_API_SQLGETTYPEINFO 47 +#define SQL_API_SQLPARAMDATA 48 +#define SQL_API_SQLPUTDATA 49 +#define SQL_API_SQLSETCONNECTOPTION 50 +#define SQL_API_SQLSETSTMTOPTION 51 +#define SQL_API_SQLSPECIALCOLUMNS 52 +#define SQL_API_SQLSTATISTICS 53 +#define SQL_API_SQLTABLES 54 + +#define SQL_API_SQLBROWSECONNECT 55 /* Level 2 Functions */ +#define SQL_API_SQLCOLUMNPRIVILEGES 56 +#define SQL_API_SQLDATASOURCES 57 +#define SQL_API_SQLDESCRIBEPARAM 58 +#define SQL_API_SQLEXTENDEDFETCH 59 +#define SQL_API_SQLFOREIGNKEYS 60 +#define SQL_API_SQLMORERESULTS 61 +#define SQL_API_SQLNATIVESQL 62 +#define SQL_API_SQLNUMPARAMS 63 +#define SQL_API_SQLPARAMOPTIONS 64 +#define SQL_API_SQLPRIMARYKEYS 65 +#define SQL_API_SQLPROCEDURECOLUMNS 66 +#define SQL_API_SQLPROCEDURES 67 +#define SQL_API_SQLSETPOS 68 +#define SQL_API_SQLSETSCROLLOPTIONS 69 +#define SQL_API_SQLTABLEPRIVILEGES 70 + +#define SQL_API_SQLDRIVERS 71 +#define SQL_API_SQLBINDPARAMETER 72 +#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER + +#define SQL_API_ALL_FUNCTIONS 0 + +#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) + +/* + * SQLGetInfo + */ +#define SQL_INFO_FIRST 0 +#define SQL_ACTIVE_CONNECTIONS 0 +#define SQL_ACTIVE_STATEMENTS 1 +#define SQL_DATA_SOURCE_NAME 2 +#define SQL_DRIVER_HDBC 3 +#define SQL_DRIVER_HENV 4 +#define SQL_DRIVER_HSTMT 5 +#define SQL_DRIVER_NAME 6 +#define SQL_DRIVER_VER 7 +#define SQL_FETCH_DIRECTION 8 +#define SQL_ODBC_API_CONFORMANCE 9 +#define SQL_ODBC_VER 10 +#define SQL_ROW_UPDATES 11 +#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 +#define SQL_SERVER_NAME 13 +#define SQL_SEARCH_PATTERN_ESCAPE 14 +#define SQL_ODBC_SQL_CONFORMANCE 15 +#define SQL_DBMS_NAME 17 +#define SQL_DBMS_VER 18 +#define SQL_ACCESSIBLE_TABLES 19 +#define SQL_ACCESSIBLE_PROCEDURES 20 +#define SQL_PROCEDURES 21 +#define SQL_CONCAT_NULL_BEHAVIOR 22 +#define SQL_CURSOR_COMMIT_BEHAVIOR 23 +#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 +#define SQL_DATA_SOURCE_READ_ONLY 25 +#define SQL_DEFAULT_TXN_ISOLATION 26 +#define SQL_EXPRESSIONS_IN_ORDERBY 27 +#define SQL_IDENTIFIER_CASE 28 +#define SQL_IDENTIFIER_QUOTE_CHAR 29 +#define SQL_MAX_COLUMN_NAME_LEN 30 +#define SQL_MAX_CURSOR_NAME_LEN 31 +#define SQL_MAX_OWNER_NAME_LEN 32 +#define SQL_MAX_PROCEDURE_NAME_LEN 33 +#define SQL_MAX_QUALIFIER_NAME_LEN 34 +#define SQL_MAX_TABLE_NAME_LEN 35 +#define SQL_MULT_RESULT_SETS 36 +#define SQL_MULTIPLE_ACTIVE_TXN 37 +#define SQL_OUTER_JOINS 38 +#define SQL_OWNER_TERM 39 +#define SQL_PROCEDURE_TERM 40 +#define SQL_QUALIFIER_NAME_SEPARATOR 41 +#define SQL_QUALIFIER_TERM 42 +#define SQL_SCROLL_CONCURRENCY 43 +#define SQL_SCROLL_OPTIONS 44 +#define SQL_TABLE_TERM 45 +#define SQL_TXN_CAPABLE 46 +#define SQL_USER_NAME 47 +#define SQL_CONVERT_FUNCTIONS 48 +#define SQL_NUMERIC_FUNCTIONS 49 +#define SQL_STRING_FUNCTIONS 50 +#define SQL_SYSTEM_FUNCTIONS 51 +#define SQL_TIMEDATE_FUNCTIONS 52 +#define SQL_CONVERT_BIGINT 53 +#define SQL_CONVERT_BINARY 54 +#define SQL_CONVERT_BIT 55 +#define SQL_CONVERT_CHAR 56 +#define SQL_CONVERT_DATE 57 +#define SQL_CONVERT_DECIMAL 58 +#define SQL_CONVERT_DOUBLE 59 +#define SQL_CONVERT_FLOAT 60 +#define SQL_CONVERT_INTEGER 61 +#define SQL_CONVERT_LONGVARCHAR 62 +#define SQL_CONVERT_NUMERIC 63 +#define SQL_CONVERT_REAL 64 +#define SQL_CONVERT_SMALLINT 65 +#define SQL_CONVERT_TIME 66 +#define SQL_CONVERT_TIMESTAMP 67 +#define SQL_CONVERT_TINYINT 68 +#define SQL_CONVERT_VARBINARY 69 +#define SQL_CONVERT_VARCHAR 70 +#define SQL_CONVERT_LONGVARBINARY 71 +#define SQL_TXN_ISOLATION_OPTION 72 +#define SQL_ODBC_SQL_OPT_IEF 73 + +/* + * ODBC SDK 1.0 Additions + */ +#define SQL_CORRELATION_NAME 74 +#define SQL_NON_NULLABLE_COLUMNS 75 + +/* + * ODBC SDK 2.0 Additions + */ +#define SQL_DRIVER_HLIB 76 +#define SQL_DRIVER_ODBC_VER 77 +#define SQL_LOCK_TYPES 78 +#define SQL_POS_OPERATIONS 79 +#define SQL_POSITIONED_STATEMENTS 80 +#define SQL_GETDATA_EXTENSIONS 81 +#define SQL_BOOKMARK_PERSISTENCE 82 +#define SQL_STATIC_SENSITIVITY 83 +#define SQL_FILE_USAGE 84 +#define SQL_NULL_COLLATION 85 +#define SQL_ALTER_TABLE 86 +#define SQL_COLUMN_ALIAS 87 +#define SQL_GROUP_BY 88 +#define SQL_KEYWORDS 89 +#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 +#define SQL_OWNER_USAGE 91 +#define SQL_QUALIFIER_USAGE 92 +#define SQL_QUOTED_IDENTIFIER_CASE 93 +#define SQL_SPECIAL_CHARACTERS 94 +#define SQL_SUBQUERIES 95 +#define SQL_UNION 96 +#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 +#define SQL_MAX_COLUMNS_IN_INDEX 98 +#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 +#define SQL_MAX_COLUMNS_IN_SELECT 100 +#define SQL_MAX_COLUMNS_IN_TABLE 101 +#define SQL_MAX_INDEX_SIZE 102 +#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 +#define SQL_MAX_ROW_SIZE 104 +#define SQL_MAX_STATEMENT_LEN 105 +#define SQL_MAX_TABLES_IN_SELECT 106 +#define SQL_MAX_USER_NAME_LEN 107 +#define SQL_MAX_CHAR_LITERAL_LEN 108 +#define SQL_TIMEDATE_ADD_INTERVALS 109 +#define SQL_TIMEDATE_DIFF_INTERVALS 110 +#define SQL_NEED_LONG_DATA_LEN 111 +#define SQL_MAX_BINARY_LITERAL_LEN 112 +#define SQL_LIKE_ESCAPE_CLAUSE 113 +#define SQL_QUALIFIER_LOCATION 114 + +/* + * ODBC SDK 2.01 Additions + */ +#define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */ + +#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION +#define SQL_INFO_DRIVER_START 1000 + + +/* + * SQL_CONVERT_* bitmask values + */ +#define SQL_CVT_CHAR 0x00000001L +#define SQL_CVT_NUMERIC 0x00000002L +#define SQL_CVT_DECIMAL 0x00000004L +#define SQL_CVT_INTEGER 0x00000008L +#define SQL_CVT_SMALLINT 0x00000010L +#define SQL_CVT_FLOAT 0x00000020L +#define SQL_CVT_REAL 0x00000040L +#define SQL_CVT_DOUBLE 0x00000080L +#define SQL_CVT_VARCHAR 0x00000100L +#define SQL_CVT_LONGVARCHAR 0x00000200L +#define SQL_CVT_BINARY 0x00000400L +#define SQL_CVT_VARBINARY 0x00000800L +#define SQL_CVT_BIT 0x00001000L +#define SQL_CVT_TINYINT 0x00002000L +#define SQL_CVT_BIGINT 0x00004000L +#define SQL_CVT_DATE 0x00008000L +#define SQL_CVT_TIME 0x00010000L +#define SQL_CVT_TIMESTAMP 0x00020000L +#define SQL_CVT_LONGVARBINARY 0x00040000L + +/* + * SQL_CONVERT_FUNCTIONS + */ +#define SQL_FN_CVT_CONVERT 0x00000001L + +/* + * SQL_STRING_FUNCTIONS + */ +#define SQL_FN_STR_CONCAT 0x00000001L +#define SQL_FN_STR_INSERT 0x00000002L +#define SQL_FN_STR_LEFT 0x00000004L +#define SQL_FN_STR_LTRIM 0x00000008L +#define SQL_FN_STR_LENGTH 0x00000010L +#define SQL_FN_STR_LOCATE 0x00000020L +#define SQL_FN_STR_LCASE 0x00000040L +#define SQL_FN_STR_REPEAT 0x00000080L +#define SQL_FN_STR_REPLACE 0x00000100L +#define SQL_FN_STR_RIGHT 0x00000200L +#define SQL_FN_STR_RTRIM 0x00000400L +#define SQL_FN_STR_SUBSTRING 0x00000800L +#define SQL_FN_STR_UCASE 0x00001000L +#define SQL_FN_STR_ASCII 0x00002000L +#define SQL_FN_STR_CHAR 0x00004000L +#define SQL_FN_STR_DIFFERENCE 0x00008000L +#define SQL_FN_STR_LOCATE_2 0x00010000L +#define SQL_FN_STR_SOUNDEX 0x00020000L +#define SQL_FN_STR_SPACE 0x00040000L + +/* + * SQL_NUMERIC_FUNCTIONS + */ +#define SQL_FN_NUM_ABS 0x00000001L +#define SQL_FN_NUM_ACOS 0x00000002L +#define SQL_FN_NUM_ASIN 0x00000004L +#define SQL_FN_NUM_ATAN 0x00000008L +#define SQL_FN_NUM_ATAN2 0x00000010L +#define SQL_FN_NUM_CEILING 0x00000020L +#define SQL_FN_NUM_COS 0x00000040L +#define SQL_FN_NUM_COT 0x00000080L +#define SQL_FN_NUM_EXP 0x00000100L +#define SQL_FN_NUM_FLOOR 0x00000200L +#define SQL_FN_NUM_LOG 0x00000400L +#define SQL_FN_NUM_MOD 0x00000800L +#define SQL_FN_NUM_SIGN 0x00001000L +#define SQL_FN_NUM_SIN 0x00002000L +#define SQL_FN_NUM_SQRT 0x00004000L +#define SQL_FN_NUM_TAN 0x00008000L +#define SQL_FN_NUM_PI 0x00010000L +#define SQL_FN_NUM_RAND 0x00020000L +#define SQL_FN_NUM_DEGREES 0x00040000L +#define SQL_FN_NUM_LOG10 0x00080000L +#define SQL_FN_NUM_POWER 0x00100000L +#define SQL_FN_NUM_RADIANS 0x00200000L +#define SQL_FN_NUM_ROUND 0x00400000L +#define SQL_FN_NUM_TRUNCATE 0x00800000L + +/* + * SQL_TIMEDATE_FUNCTIONS + */ +#define SQL_FN_TD_NOW 0x00000001L +#define SQL_FN_TD_CURDATE 0x00000002L +#define SQL_FN_TD_DAYOFMONTH 0x00000004L +#define SQL_FN_TD_DAYOFWEEK 0x00000008L +#define SQL_FN_TD_DAYOFYEAR 0x00000010L +#define SQL_FN_TD_MONTH 0x00000020L +#define SQL_FN_TD_QUARTER 0x00000040L +#define SQL_FN_TD_WEEK 0x00000080L +#define SQL_FN_TD_YEAR 0x00000100L +#define SQL_FN_TD_CURTIME 0x00000200L +#define SQL_FN_TD_HOUR 0x00000400L +#define SQL_FN_TD_MINUTE 0x00000800L +#define SQL_FN_TD_SECOND 0x00001000L +#define SQL_FN_TD_TIMESTAMPADD 0x00002000L +#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L +#define SQL_FN_TD_DAYNAME 0x00008000L +#define SQL_FN_TD_MONTHNAME 0x00010000L + +/* + * SQL_SYSTEM_FUNCTIONS + */ +#define SQL_FN_SYS_USERNAME 0x00000001L +#define SQL_FN_SYS_DBNAME 0x00000002L +#define SQL_FN_SYS_IFNULL 0x00000004L + +/* + * SQL_TIMEDATE_ADD_INTERVALS + * SQL_TIMEDATE_DIFF_INTERVALS + */ +#define SQL_FN_TSI_FRAC_SECOND 0x00000001L +#define SQL_FN_TSI_SECOND 0x00000002L +#define SQL_FN_TSI_MINUTE 0x00000004L +#define SQL_FN_TSI_HOUR 0x00000008L +#define SQL_FN_TSI_DAY 0x00000010L +#define SQL_FN_TSI_WEEK 0x00000020L +#define SQL_FN_TSI_MONTH 0x00000040L +#define SQL_FN_TSI_QUARTER 0x00000080L +#define SQL_FN_TSI_YEAR 0x00000100L + +/* + * SQL_ODBC_API_CONFORMANCE + */ +#define SQL_OAC_NONE 0x0000 +#define SQL_OAC_LEVEL1 0x0001 +#define SQL_OAC_LEVEL2 0x0002 + +/* + * SQL_ODBC_SAG_CLI_CONFORMANCE + */ +#define SQL_OSCC_NOT_COMPLIANT 0x0000 +#define SQL_OSCC_COMPLIANT 0x0001 + +/* + * SQL_ODBC_SQL_CONFORMANCE + */ +#define SQL_OSC_MINIMUM 0x0000 +#define SQL_OSC_CORE 0x0001 +#define SQL_OSC_EXTENDED 0x0002 + +/* + * SQL_CONCAT_NULL_BEHAVIOR + */ +#define SQL_CB_NULL 0x0000 +#define SQL_CB_NON_NULL 0x0001 + +/* + * SQL_CURSOR_COMMIT_BEHAVIOR + * SQL_CURSOR_ROLLBACK_BEHAVIOR + */ +#define SQL_CB_DELETE 0x0000 +#define SQL_CB_CLOSE 0x0001 +#define SQL_CB_PRESERVE 0x0002 + +/* + * SQL_IDENTIFIER_CASE + */ +#define SQL_IC_UPPER 0x0001 +#define SQL_IC_LOWER 0x0002 +#define SQL_IC_SENSITIVE 0x0003 +#define SQL_IC_MIXED 0x0004 + +/* + * SQL_TXN_CAPABLE + */ +#define SQL_TC_NONE 0x0000 +#define SQL_TC_DML 0x0001 +#define SQL_TC_ALL 0x0002 +#define SQL_TC_DDL_COMMIT 0x0003 +#define SQL_TC_DDL_IGNORE 0x0004 + +/* + * SQL_SCROLL_OPTIONS + */ +#define SQL_SO_FORWARD_ONLY 0x00000001L +#define SQL_SO_KEYSET_DRIVEN 0x00000002L +#define SQL_SO_DYNAMIC 0x00000004L +#define SQL_SO_MIXED 0x00000008L +#define SQL_SO_STATIC 0x00000010L + +/* + * SQL_SCROLL_CONCURRENCY + */ +#define SQL_SCCO_READ_ONLY 0x00000001L +#define SQL_SCCO_LOCK 0x00000002L +#define SQL_SCCO_OPT_ROWVER 0x00000004L +#define SQL_SCCO_OPT_VALUES 0x00000008L + +/* + * SQL_FETCH_DIRECTION + */ +#define SQL_FD_FETCH_NEXT 0x00000001L +#define SQL_FD_FETCH_FIRST 0x00000002L +#define SQL_FD_FETCH_LAST 0x00000004L +#define SQL_FD_FETCH_PRIOR 0x00000008L +#define SQL_FD_FETCH_ABSOLUTE 0x00000010L +#define SQL_FD_FETCH_RELATIVE 0x00000020L +#define SQL_FD_FETCH_RESUME 0x00000040L +#define SQL_FD_FETCH_BOOKMARK 0x00000080L + +/* + * SQL_TXN_ISOLATION_OPTION + */ +#define SQL_TXN_READ_UNCOMMITTED 0x00000001L +#define SQL_TXN_READ_COMMITTED 0x00000002L +#define SQL_TXN_REPEATABLE_READ 0x00000004L +#define SQL_TXN_SERIALIZABLE 0x00000008L +#define SQL_TXN_VERSIONING 0x00000010L + +/* + * SQL_CORRELATION_NAME + */ +#define SQL_CN_NONE 0x0000 +#define SQL_CN_DIFFERENT 0x0001 +#define SQL_CN_ANY 0x0002 + +/* + * SQL_NON_NULLABLE_COLUMNS + */ +#define SQL_NNC_NULL 0x0000 +#define SQL_NNC_NON_NULL 0x0001 + +/* + * SQL_NULL_COLLATION + */ +#define SQL_NC_HIGH 0x0000 +#define SQL_NC_LOW 0x0001 +#define SQL_NC_START 0x0002 +#define SQL_NC_END 0x0004 + +/* + * SQL_FILE_USAGE + */ +#define SQL_FILE_NOT_SUPPORTED 0x0000 +#define SQL_FILE_TABLE 0x0001 +#define SQL_FILE_QUALIFIER 0x0002 + +/* + * SQL_GETDATA_EXTENSIONS + */ +#define SQL_GD_ANY_COLUMN 0x00000001L +#define SQL_GD_ANY_ORDER 0x00000002L +#define SQL_GD_BLOCK 0x00000004L +#define SQL_GD_BOUND 0x00000008L + +/* + * SQL_ALTER_TABLE + */ +#define SQL_AT_ADD_COLUMN 0x00000001L +#define SQL_AT_DROP_COLUMN 0x00000002L + +/* + * SQL_POSITIONED_STATEMENTS + */ +#define SQL_PS_POSITIONED_DELETE 0x00000001L +#define SQL_PS_POSITIONED_UPDATE 0x00000002L +#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L + +/* + * SQL_GROUP_BY + */ +#define SQL_GB_NOT_SUPPORTED 0x0000 +#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001 +#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002 +#define SQL_GB_NO_RELATION 0x0003 + +/* + * SQL_OWNER_USAGE + */ +#define SQL_OU_DML_STATEMENTS 0x00000001L +#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_OU_TABLE_DEFINITION 0x00000004L +#define SQL_OU_INDEX_DEFINITION 0x00000008L +#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L + +/* + * SQL_QUALIFIER_USAGE + */ +#define SQL_QU_DML_STATEMENTS 0x00000001L +#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_QU_TABLE_DEFINITION 0x00000004L +#define SQL_QU_INDEX_DEFINITION 0x00000008L +#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L + +/* + * SQL_SUBQUERIES + */ +#define SQL_SQ_COMPARISON 0x00000001L +#define SQL_SQ_EXISTS 0x00000002L +#define SQL_SQ_IN 0x00000004L +#define SQL_SQ_QUANTIFIED 0x00000008L +#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L + +/* + * SQL_UNION + */ +#define SQL_U_UNION 0x00000001L +#define SQL_U_UNION_ALL 0x00000002L + +/* + * SQL_BOOKMARK_PERSISTENCE + */ +#define SQL_BP_CLOSE 0x00000001L +#define SQL_BP_DELETE 0x00000002L +#define SQL_BP_DROP 0x00000004L +#define SQL_BP_TRANSACTION 0x00000008L +#define SQL_BP_UPDATE 0x00000010L +#define SQL_BP_OTHER_HSTMT 0x00000020L +#define SQL_BP_SCROLL 0x00000040L + +/* + * SQL_STATIC_SENSITIVITY + */ +#define SQL_SS_ADDITIONS 0x00000001L +#define SQL_SS_DELETIONS 0x00000002L +#define SQL_SS_UPDATES 0x00000004L + +/* + * SQL_LOCK_TYPES + */ +#define SQL_LCK_NO_CHANGE 0x00000001L +#define SQL_LCK_EXCLUSIVE 0x00000002L +#define SQL_LCK_UNLOCK 0x00000004L + +/* + * SQL_POS_OPERATIONS + */ +#define SQL_POS_POSITION 0x00000001L +#define SQL_POS_REFRESH 0x00000002L +#define SQL_POS_UPDATE 0x00000004L +#define SQL_POS_DELETE 0x00000008L +#define SQL_POS_ADD 0x00000010L + +/* + * SQL_QUALIFIER_LOCATION + */ +#define SQL_QL_START 0x0001L +#define SQL_QL_END 0x0002L + +/* + * SQL_OJ_CAPABILITIES + */ +#define SQL_OJ_LEFT 0x00000001L +#define SQL_OJ_RIGHT 0x00000002L +#define SQL_OJ_FULL 0x00000004L +#define SQL_OJ_NESTED 0x00000008L +#define SQL_OJ_NOT_ORDERED 0x00000010L +#define SQL_OJ_INNER 0x00000020L +#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L + +/* + * SQLGetStmtOption/SQLSetStmtOption + */ +#define SQL_QUERY_TIMEOUT 0 +#define SQL_MAX_ROWS 1 +#define SQL_NOSCAN 2 +#define SQL_MAX_LENGTH 3 +#define SQL_ASYNC_ENABLE 4 +#define SQL_BIND_TYPE 5 +#define SQL_CURSOR_TYPE 6 +#define SQL_CONCURRENCY 7 +#define SQL_KEYSET_SIZE 8 +#define SQL_ROWSET_SIZE 9 +#define SQL_SIMULATE_CURSOR 10 +#define SQL_RETRIEVE_DATA 11 +#define SQL_USE_BOOKMARKS 12 +#define SQL_GET_BOOKMARK 13 +#define SQL_ROW_NUMBER 14 + +#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT +#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER + + +/* + * SQL_QUERY_TIMEOUT + */ +#define SQL_QUERY_TIMEOUT_DEFAULT 0UL + +/* + * SQL_MAX_ROWS + */ +#define SQL_MAX_ROWS_DEFAULT 0UL + +/* + * SQL_NOSCAN + */ +#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */ +#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */ +#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF + +/* + * SQL_MAX_LENGTH + */ +#define SQL_MAX_LENGTH_DEFAULT 0UL + +/* + * SQL_ASYNC_ENABLE + */ +#define SQL_ASYNC_ENABLE_OFF 0UL +#define SQL_ASYNC_ENABLE_ON 1UL +#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF + +/* + * SQL_BIND_TYPE + */ +#define SQL_BIND_BY_COLUMN 0UL +#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN + +/* + * SQL_CONCURRENCY + */ +#define SQL_CONCUR_READ_ONLY 1 +#define SQL_CONCUR_LOCK 2 +#define SQL_CONCUR_ROWVER 3 +#define SQL_CONCUR_VALUES 4 +#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY + +/* + * SQL_CURSOR_TYPE + */ +#define SQL_CURSOR_FORWARD_ONLY 0UL +#define SQL_CURSOR_KEYSET_DRIVEN 1UL +#define SQL_CURSOR_DYNAMIC 2UL +#define SQL_CURSOR_STATIC 3UL +#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY + +/* + * SQL_ROWSET_SIZE + */ +#define SQL_ROWSET_SIZE_DEFAULT 1UL + +/* + * SQL_KEYSET_SIZE + */ +#define SQL_KEYSET_SIZE_DEFAULT 0UL + +/* + * SQL_SIMULATE_CURSOR + */ +#define SQL_SC_NON_UNIQUE 0UL +#define SQL_SC_TRY_UNIQUE 1UL +#define SQL_SC_UNIQUE 2UL + +/* + * SQL_RETRIEVE_DATA + */ +#define SQL_RD_OFF 0UL +#define SQL_RD_ON 1UL +#define SQL_RD_DEFAULT SQL_RD_ON + +/* + * SQL_USE_BOOKMARKS + */ +#define SQL_UB_OFF 0UL +#define SQL_UB_ON 1UL +#define SQL_UB_DEFAULT SQL_UB_OFF + +/* + * SQLSetConnectOption/SQLGetConnectOption + */ +#define SQL_ACCESS_MODE 101 +#define SQL_AUTOCOMMIT 102 +#define SQL_LOGIN_TIMEOUT 103 +#define SQL_OPT_TRACE 104 +#define SQL_OPT_TRACEFILE 105 +#define SQL_TRANSLATE_DLL 106 +#define SQL_TRANSLATE_OPTION 107 +#define SQL_TXN_ISOLATION 108 +#define SQL_CURRENT_QUALIFIER 109 +#define SQL_ODBC_CURSORS 110 +#define SQL_QUIET_MODE 111 +#define SQL_PACKET_SIZE 112 + +#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE +#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE +#define SQL_CONNECT_OPT_DRVR_START 1000 + + +/* + * SQL_ACCESS_MODE + */ +#define SQL_MODE_READ_WRITE 0UL +#define SQL_MODE_READ_ONLY 1UL +#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE + +/* + * SQL_AUTOCOMMIT + */ +#define SQL_AUTOCOMMIT_OFF 0UL +#define SQL_AUTOCOMMIT_ON 1UL +#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON + +/* + * SQL_LOGIN_TIMEOUT + */ +#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL + +/* + * SQL_OPT_TRACE + */ +#define SQL_OPT_TRACE_OFF 0UL +#define SQL_OPT_TRACE_ON 1UL +#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF +#define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log" + +/* + * SQL_ODBC_CURSORS + */ +#define SQL_CUR_USE_IF_NEEDED 0UL +#define SQL_CUR_USE_ODBC 1UL +#define SQL_CUR_USE_DRIVER 2UL +#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER + +/* + * SQLSpecialColumns - Column types and scopes + */ +#define SQL_BEST_ROWID 1 +#define SQL_ROWVER 2 + +#define SQL_SCOPE_CURROW 0 +#define SQL_SCOPE_TRANSACTION 1 +#define SQL_SCOPE_SESSION 2 + +/* + * SQLSetPos + */ +#define SQL_ENTIRE_ROWSET 0 + +/* + * SQLSetPos + */ +#define SQL_POSITION 0 +#define SQL_REFRESH 1 +#define SQL_UPDATE 2 +#define SQL_DELETE 3 +#define SQL_ADD 4 + +/* + * SQLSetPos + */ +#define SQL_LOCK_NO_CHANGE 0 +#define SQL_LOCK_EXCLUSIVE 1 +#define SQL_LOCK_UNLOCK 2 + +/* + * SQLSetPos + */ +#define SQL_POSITION_TO(hstmt,irow) \ + SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) +#define SQL_LOCK_RECORD(hstmt,irow,fLock) \ + SQLSetPos(hstmt,irow,SQL_POSITION,fLock) +#define SQL_REFRESH_RECORD(hstmt,irow,fLock) \ + SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) +#define SQL_UPDATE_RECORD(hstmt,irow) \ + SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) +#define SQL_DELETE_RECORD(hstmt,irow) \ + SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) +#define SQL_ADD_RECORD(hstmt,irow) \ + SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) + +/* + * All the ODBC keywords + */ +#define SQL_ODBC_KEYWORDS \ +"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\ +"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\ +"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\ +"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\ +"COBOL,COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\ +"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\ +"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\ +"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\ +"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\ +"DISTINCT,DOMAIN,DOUBLE,DROP,"\ +"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\ +"EXISTS,EXTERNAL,EXTRACT,"\ +"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\ +"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\ +"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\ +"INPUT,INSENSITIVE,INSERT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\ +"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\ +"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,MUMPS,"\ +"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\ +"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\ +"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\ +"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\ +"REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS,"\ +"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SEQUENCE,SESSION,SESSION_USER,SET,SIZE,"\ +"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\ +"SUBSTRING,SUM,SYSTEM_USER,"\ +"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\ +"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\ +"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\ +"VALUE,,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,YEAR" + +/* + * ---------------------------------------------------------------------- + * Level 2 Functions + * ---------------------------------------------------------------------- + */ + +/* + * SQLExtendedFetch - fFetchType + */ +#define SQL_FETCH_NEXT 1 +#define SQL_FETCH_FIRST 2 +#define SQL_FETCH_LAST 3 +#define SQL_FETCH_PRIOR 4 +#define SQL_FETCH_ABSOLUTE 5 +#define SQL_FETCH_RELATIVE 6 +#define SQL_FETCH_BOOKMARK 8 + +/* + * SQLExtendedFetch - rgfRowStatus + */ +#define SQL_ROW_SUCCESS 0 +#define SQL_ROW_DELETED 1 +#define SQL_ROW_UPDATED 2 +#define SQL_ROW_NOROW 3 +#define SQL_ROW_ADDED 4 +#define SQL_ROW_ERROR 5 + +/* + * SQLForeignKeys - UPDATE_RULE/DELETE_RULE + */ +#define SQL_CASCADE 0 +#define SQL_RESTRICT 1 +#define SQL_SET_NULL 2 + +/* + * SQLBindParameter - fParamType + * SQLProcedureColumns - COLUMN_TYPE + */ +#define SQL_PARAM_TYPE_UNKNOWN 0 +#define SQL_PARAM_INPUT 1 +#define SQL_PARAM_INPUT_OUTPUT 2 +#define SQL_RESULT_COL 3 +#define SQL_PARAM_OUTPUT 4 +#define SQL_RETURN_VALUE 5 + +/* + * SQLSetParam to SQLBindParameter conversion + */ +#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT +#define SQL_SETPARAM_VALUE_MAX (-1L) + +/* + * SQLStatistics - fUnique + */ +#define SQL_INDEX_UNIQUE 0 +#define SQL_INDEX_ALL 1 + +/* + * SQLStatistics - fAccuracy + */ +#define SQL_QUICK 0 +#define SQL_ENSURE 1 + +/* + * SQLStatistics - TYPE + */ +#define SQL_TABLE_STAT 0 +#define SQL_INDEX_CLUSTERED 1 +#define SQL_INDEX_HASHED 2 +#define SQL_INDEX_OTHER 3 + +/* + * SQLProcedures - PROCEDURE_TYPE + */ +#define SQL_PT_UNKNOWN 0 +#define SQL_PT_PROCEDURE 1 +#define SQL_PT_FUNCTION 2 + +/* + * SQLSpecialColumns - PSEUDO_COLUMN + */ +#define SQL_PC_UNKNOWN 0 +#define SQL_PC_NOT_PSEUDO 1 +#define SQL_PC_PSEUDO 2 + +/* + * Deprecated defines from prior versions of ODBC + */ +#define SQL_DATABASE_NAME 16 +#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR +#define SQL_FETCH_PREV SQL_FETCH_PRIOR +#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER +#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER +#define SQL_CC_DELETE SQL_CB_DELETE +#define SQL_CR_DELETE SQL_CB_DELETE +#define SQL_CC_CLOSE SQL_CB_CLOSE +#define SQL_CR_CLOSE SQL_CB_CLOSE +#define SQL_CC_PRESERVE SQL_CB_PRESERVE +#define SQL_CR_PRESERVE SQL_CB_PRESERVE +#define SQL_FETCH_RESUME 7 +#define SQL_SCROLL_FORWARD_ONLY 0L +#define SQL_SCROLL_KEYSET_DRIVEN (-1L) +#define SQL_SCROLL_DYNAMIC (-2L) +#define SQL_SCROLL_STATIC (-3L) +#define SQL_PC_NON_PSEUDO SQL_PC_NOT_PSEUDO + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Level 1 function prototypes + */ +RETCODE SQL_API SQLColumns (HSTMT hstmt, UCHAR FAR * szTableQualifier, + SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, + UCHAR FAR * szTableName, SWORD cbTableName, UCHAR FAR * szColumnName, + SWORD cbColumnName); +/* glt - Changed HWND to SQLHWND to match MSW header typing */ +RETCODE SQL_API SQLDriverConnect (HDBC hdbc, SQLHWND hwnd, + UCHAR FAR * szConnStrIn, SWORD cbConnStrIn, UCHAR FAR * szConnStrOut, + SWORD cbConnStrOutMax, SWORD FAR * pcbConnStrOut, UWORD fDriverCompletion); +RETCODE SQL_API SQLGetConnectOption (HDBC hdbc, UWORD fOption, PTR pvParam); +RETCODE SQL_API SQLGetData (HSTMT hstmt, UWORD icol, SWORD fCType, + PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue); +RETCODE SQL_API SQLGetFunctions (HDBC hdbc, UWORD fFunction, + UWORD FAR * pfExists); +RETCODE SQL_API SQLGetInfo (HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue, + SWORD cbInfoValueMax, SWORD FAR * pcbInfoValue); +RETCODE SQL_API SQLGetStmtOption (HSTMT hstmt, UWORD fOption, PTR pvParam); +RETCODE SQL_API SQLGetTypeInfo (HSTMT hstmt, SWORD fSqlType); +RETCODE SQL_API SQLParamData (HSTMT hstmt, PTR FAR * prgbValue); +RETCODE SQL_API SQLPutData (HSTMT hstmt, PTR rgbValue, SDWORD cbValue); +RETCODE SQL_API SQLSetConnectOption (HDBC hdbc, UWORD fOption, UDWORD vParam); +RETCODE SQL_API SQLSetStmtOption (HSTMT hstmt, UWORD fOption, UDWORD vParam); +RETCODE SQL_API SQLSpecialColumns (HSTMT hstmt, UWORD fColType, + UCHAR FAR * szTableQualifier, SWORD cbTableQualifier, + UCHAR FAR * szTableOwner, SWORD cbTableOwner, UCHAR FAR * szTableName, + SWORD cbTableName, UWORD fScope, UWORD fNullable); +RETCODE SQL_API SQLStatistics (HSTMT hstmt, UCHAR FAR * szTableQualifier, + SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, + UCHAR FAR * szTableName, SWORD cbTableName, UWORD fUnique, UWORD fAccuracy); +RETCODE SQL_API SQLTables (HSTMT hstmt, UCHAR FAR * szTableQualifier, + SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, + UCHAR FAR * szTableName, SWORD cbTableName, UCHAR FAR * szTableType, + SWORD cbTableType); + +/* + * Level 2 function prototypes + */ +RETCODE SQL_API SQLBrowseConnect (HDBC hdbc, + UCHAR FAR * szConnStrIn, SWORD cbConnStrIn, UCHAR FAR * szConnStrOut, + SWORD cbConnStrOutMax, SWORD FAR * pcbConnStrOut); +RETCODE SQL_API SQLColumnPrivileges (HSTMT hstmt, + UCHAR FAR * szTableQualifier, SWORD cbTableQualifier, + UCHAR FAR * szTableOwner, SWORD cbTableOwner, UCHAR FAR * szTableName, + SWORD cbTableName, UCHAR FAR * szColumnName, SWORD cbColumnName); +RETCODE SQL_API SQLDataSources (HENV henv, UWORD fDirection, + UCHAR FAR * szDSN, SWORD cbDSNMax, SWORD FAR * pcbDSN, + UCHAR FAR * szDescription, SWORD cbDescriptionMax, + SWORD FAR * pcbDescription); +RETCODE SQL_API SQLDescribeParam (HSTMT hstmt, UWORD ipar, + SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale, + SWORD FAR * pfNullable); +RETCODE SQL_API SQLExtendedFetch (HSTMT hstmt, UWORD fFetchType, SDWORD irow, + UDWORD FAR * pcrow, UWORD FAR * rgfRowStatus); +RETCODE SQL_API SQLForeignKeys (HSTMT hstmt, UCHAR FAR * szPkTableQualifier, + SWORD cbPkTableQualifier, UCHAR FAR * szPkTableOwner, SWORD cbPkTableOwner, + UCHAR FAR * szPkTableName, SWORD cbPkTableName, + UCHAR FAR * szFkTableQualifier, SWORD cbFkTableQualifier, + UCHAR FAR * szFkTableOwner, SWORD cbFkTableOwner, UCHAR FAR * szFkTableName, + SWORD cbFkTableName); +RETCODE SQL_API SQLMoreResults (HSTMT hstmt); +RETCODE SQL_API SQLNativeSql (HDBC hdbc, UCHAR FAR * szSqlStrIn, + SDWORD cbSqlStrIn, UCHAR FAR * szSqlStr, SDWORD cbSqlStrMax, + SDWORD FAR * pcbSqlStr); +RETCODE SQL_API SQLNumParams (HSTMT hstmt, SWORD FAR * pcpar); +RETCODE SQL_API SQLParamOptions (HSTMT hstmt, UDWORD crow, UDWORD FAR * pirow); +RETCODE SQL_API SQLPrimaryKeys (HSTMT hstmt, UCHAR FAR * szTableQualifier, + SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, + UCHAR FAR * szTableName, SWORD cbTableName); +RETCODE SQL_API SQLProcedureColumns (HSTMT hstmt, UCHAR FAR * szProcQualifier, + SWORD cbProcQualifier, UCHAR FAR * szProcOwner, SWORD cbProcOwner, + UCHAR FAR * szProcName, SWORD cbProcName, UCHAR FAR * szColumnName, + SWORD cbColumnName); +RETCODE SQL_API SQLProcedures (HSTMT hstmt, UCHAR FAR * szProcQualifier, + SWORD cbProcQualifier, UCHAR FAR * szProcOwner, SWORD cbProcOwner, + UCHAR FAR * szProcName, SWORD cbProcName); +RETCODE SQL_API SQLSetPos (HSTMT hstmt, UWORD irow, UWORD fOption, UWORD fLock); +RETCODE SQL_API SQLTablePrivileges (HSTMT hstmt, UCHAR FAR * szTableQualifier, + SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, + UCHAR FAR * szTableName, SWORD cbTableName); + +/* + * SDK 2.0 Additional function prototypes + */ +RETCODE SQL_API SQLDrivers (HENV henv, UWORD fDirection, + UCHAR FAR * szDriverDesc, SWORD cbDriverDescMax, SWORD FAR * pcbDriverDesc, + UCHAR FAR * szDriverAttributes, SWORD cbDrvrAttrMax, + SWORD FAR * pcbDrvrAttr); +RETCODE SQL_API SQLBindParameter (HSTMT hstmt, UWORD ipar, SWORD fParamType, + SWORD fCType, SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue, + SDWORD cbValueMax, SDWORD FAR * pcbValue); + +/* + * Deprecated - use SQLSetStmtOptions + */ +RETCODE SQL_API SQLSetScrollOptions (HSTMT hstmt, UWORD fConcurrency, + SDWORD crowKeyset, UWORD crowRowset); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/wxWidgets/include/wx/joystick.h b/Externals/wxWidgets/include/wx/joystick.h index d6666fa7cf..388ab2e9a6 100644 --- a/Externals/wxWidgets/include/wx/joystick.h +++ b/Externals/wxWidgets/include/wx/joystick.h @@ -1,38 +1,38 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: joystick.h -// Purpose: wxJoystick base header -// Author: wxWidgets Team -// Modified by: -// Created: -// Copyright: (c) wxWidgets Team -// RCS-ID: $Id: joystick.h 32852 2005-03-16 16:18:31Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_JOYSTICK_H_BASE_ -#define _WX_JOYSTICK_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_JOYSTICK - -#if defined(__WXMSW__) -#include "wx/msw/joystick.h" -#elif defined(__WXMOTIF__) -#include "wx/unix/joystick.h" -#elif defined(__WXGTK__) -#include "wx/unix/joystick.h" -#elif defined(__WXX11__) -#include "wx/unix/joystick.h" -#elif defined(__DARWIN__) -#include "wx/mac/corefoundation/joystick.h" -#elif defined(__WXMAC__) -#include "wx/mac/joystick.h" -#elif defined(__WXPM__) -#include "wx/os2/joystick.h" -#endif - -#endif // wxUSE_JOYSTICK - -#endif - // _WX_JOYSTICK_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.h +// Purpose: wxJoystick base header +// Author: wxWidgets Team +// Modified by: +// Created: +// Copyright: (c) wxWidgets Team +// RCS-ID: $Id: joystick.h 32852 2005-03-16 16:18:31Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_BASE_ +#define _WX_JOYSTICK_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_JOYSTICK + +#if defined(__WXMSW__) +#include "wx/msw/joystick.h" +#elif defined(__WXMOTIF__) +#include "wx/unix/joystick.h" +#elif defined(__WXGTK__) +#include "wx/unix/joystick.h" +#elif defined(__WXX11__) +#include "wx/unix/joystick.h" +#elif defined(__DARWIN__) +#include "wx/mac/corefoundation/joystick.h" +#elif defined(__WXMAC__) +#include "wx/mac/joystick.h" +#elif defined(__WXPM__) +#include "wx/os2/joystick.h" +#endif + +#endif // wxUSE_JOYSTICK + +#endif + // _WX_JOYSTICK_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/layout.h b/Externals/wxWidgets/include/wx/layout.h index 4a6d82d7bc..06dc60934c 100644 --- a/Externals/wxWidgets/include/wx/layout.h +++ b/Externals/wxWidgets/include/wx/layout.h @@ -1,191 +1,191 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/layout.h -// Purpose: OBSOLETE layout constraint classes, use sizers instead -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: layout.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LAYOUT_H_ -#define _WX_LAYOUT_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/object.h" - -// X stupidly defines these in X.h -#ifdef Above - #undef Above -#endif -#ifdef Below - #undef Below -#endif - -#if wxUSE_CONSTRAINTS - -// ---------------------------------------------------------------------------- -// forward declrations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxWindowBase; -class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#define wxLAYOUT_DEFAULT_MARGIN 0 - -enum wxEdge -{ - wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight, - wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY -}; - -enum wxRelationship -{ - wxUnconstrained = 0, - wxAsIs, - wxPercentOf, - wxAbove, - wxBelow, - wxLeftOf, - wxRightOf, - wxSameAs, - wxAbsolute -}; - -// ---------------------------------------------------------------------------- -// wxIndividualLayoutConstraint: a constraint on window position -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxIndividualLayoutConstraint : public wxObject -{ -public: - wxIndividualLayoutConstraint(); - - // note that default copy ctor and assignment operators are ok - - virtual ~wxIndividualLayoutConstraint(){} - - void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); - - // - // Sibling relationships - // - void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); - - // - // 'Same edge' alignment - // - void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN); - - // The edge is a percentage of the other window's edge - void PercentOf(wxWindowBase *otherW, wxEdge wh, int per); - - // - // Edge has absolute value - // - void Absolute(int val); - - // - // Dimension is unconstrained - // - void Unconstrained() { relationship = wxUnconstrained; } - - // - // Dimension is 'as is' (use current size settings) - // - void AsIs() { relationship = wxAsIs; } - - // - // Accessors - // - wxWindowBase *GetOtherWindow() { return otherWin; } - wxEdge GetMyEdge() const { return myEdge; } - void SetEdge(wxEdge which) { myEdge = which; } - void SetValue(int v) { value = v; } - int GetMargin() { return margin; } - void SetMargin(int m) { margin = m; } - int GetValue() const { return value; } - int GetPercent() const { return percent; } - int GetOtherEdge() const { return otherEdge; } - bool GetDone() const { return done; } - void SetDone(bool d) { done = d; } - wxRelationship GetRelationship() { return relationship; } - void SetRelationship(wxRelationship r) { relationship = r; } - - // Reset constraint if it mentions otherWin - bool ResetIfWin(wxWindowBase *otherW); - - // Try to satisfy constraint - bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win); - - // Get the value of this edge or dimension, or if this - // is not determinable, -1. - int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const; - -protected: - // To be allowed to modify the internal variables - friend class wxIndividualLayoutConstraint_Serialize; - - // 'This' window is the parent or sibling of otherWin - wxWindowBase *otherWin; - - wxEdge myEdge; - wxRelationship relationship; - int margin; - int value; - int percent; - wxEdge otherEdge; - bool done; - - DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint) -}; - -// ---------------------------------------------------------------------------- -// wxLayoutConstraints: the complete set of constraints for a window -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxLayoutConstraints : public wxObject -{ -public: - // Edge constraints - wxIndividualLayoutConstraint left; - wxIndividualLayoutConstraint top; - wxIndividualLayoutConstraint right; - wxIndividualLayoutConstraint bottom; - // Size constraints - wxIndividualLayoutConstraint width; - wxIndividualLayoutConstraint height; - // Centre constraints - wxIndividualLayoutConstraint centreX; - wxIndividualLayoutConstraint centreY; - - wxLayoutConstraints(); - - // note that default copy ctor and assignment operators are ok - - virtual ~wxLayoutConstraints(){} - - bool SatisfyConstraints(wxWindowBase *win, int *noChanges); - bool AreSatisfied() const - { - return left.GetDone() && top.GetDone() && - width.GetDone() && height.GetDone(); - } - - DECLARE_DYNAMIC_CLASS(wxLayoutConstraints) -}; - -#endif // wxUSE_CONSTRAINTS - -#endif // _WX_LAYOUT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/layout.h +// Purpose: OBSOLETE layout constraint classes, use sizers instead +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: layout.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LAYOUT_H_ +#define _WX_LAYOUT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/object.h" + +// X stupidly defines these in X.h +#ifdef Above + #undef Above +#endif +#ifdef Below + #undef Below +#endif + +#if wxUSE_CONSTRAINTS + +// ---------------------------------------------------------------------------- +// forward declrations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindowBase; +class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#define wxLAYOUT_DEFAULT_MARGIN 0 + +enum wxEdge +{ + wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight, + wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY +}; + +enum wxRelationship +{ + wxUnconstrained = 0, + wxAsIs, + wxPercentOf, + wxAbove, + wxBelow, + wxLeftOf, + wxRightOf, + wxSameAs, + wxAbsolute +}; + +// ---------------------------------------------------------------------------- +// wxIndividualLayoutConstraint: a constraint on window position +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxIndividualLayoutConstraint : public wxObject +{ +public: + wxIndividualLayoutConstraint(); + + // note that default copy ctor and assignment operators are ok + + virtual ~wxIndividualLayoutConstraint(){} + + void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); + + // + // Sibling relationships + // + void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + + // + // 'Same edge' alignment + // + void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN); + + // The edge is a percentage of the other window's edge + void PercentOf(wxWindowBase *otherW, wxEdge wh, int per); + + // + // Edge has absolute value + // + void Absolute(int val); + + // + // Dimension is unconstrained + // + void Unconstrained() { relationship = wxUnconstrained; } + + // + // Dimension is 'as is' (use current size settings) + // + void AsIs() { relationship = wxAsIs; } + + // + // Accessors + // + wxWindowBase *GetOtherWindow() { return otherWin; } + wxEdge GetMyEdge() const { return myEdge; } + void SetEdge(wxEdge which) { myEdge = which; } + void SetValue(int v) { value = v; } + int GetMargin() { return margin; } + void SetMargin(int m) { margin = m; } + int GetValue() const { return value; } + int GetPercent() const { return percent; } + int GetOtherEdge() const { return otherEdge; } + bool GetDone() const { return done; } + void SetDone(bool d) { done = d; } + wxRelationship GetRelationship() { return relationship; } + void SetRelationship(wxRelationship r) { relationship = r; } + + // Reset constraint if it mentions otherWin + bool ResetIfWin(wxWindowBase *otherW); + + // Try to satisfy constraint + bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win); + + // Get the value of this edge or dimension, or if this + // is not determinable, -1. + int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const; + +protected: + // To be allowed to modify the internal variables + friend class wxIndividualLayoutConstraint_Serialize; + + // 'This' window is the parent or sibling of otherWin + wxWindowBase *otherWin; + + wxEdge myEdge; + wxRelationship relationship; + int margin; + int value; + int percent; + wxEdge otherEdge; + bool done; + + DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint) +}; + +// ---------------------------------------------------------------------------- +// wxLayoutConstraints: the complete set of constraints for a window +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxLayoutConstraints : public wxObject +{ +public: + // Edge constraints + wxIndividualLayoutConstraint left; + wxIndividualLayoutConstraint top; + wxIndividualLayoutConstraint right; + wxIndividualLayoutConstraint bottom; + // Size constraints + wxIndividualLayoutConstraint width; + wxIndividualLayoutConstraint height; + // Centre constraints + wxIndividualLayoutConstraint centreX; + wxIndividualLayoutConstraint centreY; + + wxLayoutConstraints(); + + // note that default copy ctor and assignment operators are ok + + virtual ~wxLayoutConstraints(){} + + bool SatisfyConstraints(wxWindowBase *win, int *noChanges); + bool AreSatisfied() const + { + return left.GetDone() && top.GetDone() && + width.GetDone() && height.GetDone(); + } + + DECLARE_DYNAMIC_CLASS(wxLayoutConstraints) +}; + +#endif // wxUSE_CONSTRAINTS + +#endif // _WX_LAYOUT_H_ diff --git a/Externals/wxWidgets/include/wx/laywin.h b/Externals/wxWidgets/include/wx/laywin.h index dc75b1b7de..c27d1e7dbe 100644 --- a/Externals/wxWidgets/include/wx/laywin.h +++ b/Externals/wxWidgets/include/wx/laywin.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/laywin.h -// Purpose: wxSashLayoutWindow base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: laywin.h 33948 2005-05-04 18:57:50Z JS $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LAYWIN_H_BASE_ -#define _WX_LAYWIN_H_BASE_ - -#include "wx/generic/laywin.h" - -#endif - // _WX_LAYWIN_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/laywin.h +// Purpose: wxSashLayoutWindow base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: laywin.h 33948 2005-05-04 18:57:50Z JS $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LAYWIN_H_BASE_ +#define _WX_LAYWIN_H_BASE_ + +#include "wx/generic/laywin.h" + +#endif + // _WX_LAYWIN_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/link.h b/Externals/wxWidgets/include/wx/link.h index eaa503ed85..394f2422ea 100644 --- a/Externals/wxWidgets/include/wx/link.h +++ b/Externals/wxWidgets/include/wx/link.h @@ -1,32 +1,32 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/link.h -// Purpose: macros to force linking modules which might otherwise be -// discarded by the linker -// Author: Vaclav Slavik -// RCS-ID: $Id: link.h 35722 2005-09-26 12:29:25Z VZ $ -// Copyright: (c) Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LINK_H_ -#define _WX_LINK_H_ - -// This must be part of the module you want to force: -#define wxFORCE_LINK_THIS_MODULE(module_name) \ - extern void _wx_link_dummy_func_##module_name (); \ - void _wx_link_dummy_func_##module_name () { } - - -// And this must be somewhere where it certainly will be linked: -#define wxFORCE_LINK_MODULE(module_name) \ - extern void _wx_link_dummy_func_##module_name (); \ - static struct wxForceLink##module_name \ - { \ - wxForceLink##module_name() \ - { \ - _wx_link_dummy_func_##module_name (); \ - } \ - } _wx_link_dummy_var_##module_name; - - -#endif // _WX_LINK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/link.h +// Purpose: macros to force linking modules which might otherwise be +// discarded by the linker +// Author: Vaclav Slavik +// RCS-ID: $Id: link.h 35722 2005-09-26 12:29:25Z VZ $ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LINK_H_ +#define _WX_LINK_H_ + +// This must be part of the module you want to force: +#define wxFORCE_LINK_THIS_MODULE(module_name) \ + extern void _wx_link_dummy_func_##module_name (); \ + void _wx_link_dummy_func_##module_name () { } + + +// And this must be somewhere where it certainly will be linked: +#define wxFORCE_LINK_MODULE(module_name) \ + extern void _wx_link_dummy_func_##module_name (); \ + static struct wxForceLink##module_name \ + { \ + wxForceLink##module_name() \ + { \ + _wx_link_dummy_func_##module_name (); \ + } \ + } _wx_link_dummy_var_##module_name; + + +#endif // _WX_LINK_H_ diff --git a/Externals/wxWidgets/include/wx/list.h b/Externals/wxWidgets/include/wx/list.h index c1daac2edf..e5078ee501 100644 --- a/Externals/wxWidgets/include/wx/list.h +++ b/Externals/wxWidgets/include/wx/list.h @@ -1,1301 +1,1301 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/list.h -// Purpose: wxList, wxStringList classes -// Author: Julian Smart -// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added -// Created: 29/01/98 -// RCS-ID: $Id: list.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* - All this is quite ugly but serves two purposes: - 1. Be almost 100% compatible with old, untyped, wxList class - 2. Ensure compile-time type checking for the linked lists - - The idea is to have one base class (wxListBase) working with "void *" data, - but to hide these untyped functions - i.e. make them protected, so they - can only be used from derived classes which have inline member functions - working with right types. This achieves the 2nd goal. As for the first one, - we provide a special derivation of wxListBase called wxList which looks just - like the old class. -*/ - -#ifndef _WX_LISTH__ -#define _WX_LISTH__ - -// ----------------------------------------------------------------------------- -// headers -// ----------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" - -#if wxUSE_STL - #include "wx/beforestd.h" - #include <algorithm> - #include <iterator> - #include <list> - #include "wx/afterstd.h" -#endif - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// type of compare function for list sort operation (as in 'qsort'): it should -// return a negative value, 0 or positive value if the first element is less -// than, equal or greater than the second - -extern "C" -{ -typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); -} - -class WXDLLIMPEXP_FWD_BASE wxObjectListNode; -typedef wxObjectListNode wxNode; - -// -typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#if !defined(wxENUM_KEY_TYPE_DEFINED) -#define wxENUM_KEY_TYPE_DEFINED - -enum wxKeyType -{ - wxKEY_NONE, - wxKEY_INTEGER, - wxKEY_STRING -}; - -#endif - -#if wxUSE_STL - -#define wxLIST_COMPATIBILITY - -#define WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) \ - WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) -#define WX_DECLARE_LIST_PTR_3(elT, dummy1, liT, dummy2, decl) \ - WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) - -#define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ - WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) -#define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \ - WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ - -#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ - WX_DECLARE_LIST_XO(elT*, liT, decl) - -#if !defined( __VISUALC__ ) - -template<class T> -class WXDLLIMPEXP_BASE wxList_SortFunction -{ -public: - wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { } - bool operator()(const T& i1, const T& i2) - { return m_f((T*)&i1, (T*)&i2) < 0; } -private: - wxSortCompareFunction m_f; -}; - -#define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction<elT>(f) -#define VC6_WORKAROUND(elT, liT, decl) - -#else // if defined( __VISUALC__ ) - -#define WX_LIST_SORTFUNCTION( elT, f ) std::greater<elT>( f ) -#define VC6_WORKAROUND(elT, liT, decl) \ - decl liT; \ - \ - /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \ - /* to be passed into std::list::sort() */ \ - template <> \ - struct std::greater<elT> \ - { \ - private: \ - wxSortCompareFunction m_CompFunc; \ - public: \ - greater( wxSortCompareFunction compfunc = NULL ) \ - : m_CompFunc( compfunc ) {} \ - bool operator()(const elT X, const elT Y) const \ - { \ - return m_CompFunc ? \ - ( m_CompFunc( X, Y ) < 0 ) : \ - ( X > Y ); \ - } \ - }; - -#endif // defined( __VISUALC__ ) - -/* - Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround - for mingw 3.2.3 compiler bug that prevents a static function of liT class - from being exported into dll. A minimal code snippet reproducing the bug: - - struct WXDLLEXPORT Foo - { - static void Bar(); - struct SomeInnerClass - { - friend class Foo; // comment this out to make it link - }; - ~Foo() - { - Bar(); - } - }; - - The program does not link under mingw_gcc 3.2.3 producing undefined - reference to Foo::Bar() function - - - Note 2: the EmptyList is needed to allow having a NULL pointer-like - invalid iterator. We used to use just an uninitialized iterator object - instead but this fails with some debug/checked versions of STL, notably the - glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate - invalid iterator. - */ - -// the real wxList-class declaration -#define WX_DECLARE_LIST_XO(elT, liT, decl) \ - decl _WX_LIST_HELPER_##liT \ - { \ - typedef elT _WX_LIST_ITEM_TYPE_##liT; \ - public: \ - static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \ - }; \ - \ - VC6_WORKAROUND(elT, liT, decl) \ - decl liT : public std::list<elT> \ - { \ - private: \ - typedef std::list<elT> BaseListType; \ - static BaseListType EmptyList; \ - \ - bool m_destroy; \ - \ - public: \ - decl compatibility_iterator \ - { \ - private: \ - /* Workaround for broken VC6 nested class name resolution */ \ - typedef std::list<elT>::iterator iterator; \ - friend class liT; \ - \ - iterator m_iter; \ - liT * m_list; \ - \ - public: \ - compatibility_iterator() \ - : m_iter(EmptyList.end()), m_list( NULL ) {} \ - compatibility_iterator( liT* li, iterator i ) \ - : m_iter( i ), m_list( li ) {} \ - compatibility_iterator( const liT* li, iterator i ) \ - : m_iter( i ), m_list( const_cast< liT* >( li ) ) {} \ - \ - compatibility_iterator* operator->() { return this; } \ - const compatibility_iterator* operator->() const { return this; } \ - \ - bool operator==(const compatibility_iterator& i) const \ - { \ - wxASSERT_MSG( m_list && i.m_list, \ - _T("comparing invalid iterators is illegal") ); \ - return (m_list == i.m_list) && (m_iter == i.m_iter); \ - } \ - bool operator!=(const compatibility_iterator& i) const \ - { return !( operator==( i ) ); } \ - operator bool() const \ - { return m_list ? m_iter != m_list->end() : false; } \ - bool operator !() const \ - { return !( operator bool() ); } \ - \ - elT GetData() const \ - { return *m_iter; } \ - void SetData( elT e ) \ - { *m_iter = e; } \ - \ - compatibility_iterator GetNext() const \ - { \ - iterator i = m_iter; \ - return compatibility_iterator( m_list, ++i ); \ - } \ - compatibility_iterator GetPrevious() const \ - { \ - if ( m_iter == m_list->begin() ) \ - return compatibility_iterator(); \ - \ - iterator i = m_iter; \ - return compatibility_iterator( m_list, --i ); \ - } \ - int IndexOf() const \ - { \ - return *this ? std::distance( m_list->begin(), m_iter ) \ - : wxNOT_FOUND; \ - } \ - }; \ - public: \ - liT() : m_destroy( false ) {} \ - \ - compatibility_iterator Find( const elT e ) const \ - { \ - liT* _this = const_cast< liT* >( this ); \ - return compatibility_iterator( _this, \ - std::find( _this->begin(), _this->end(), e ) ); \ - } \ - \ - bool IsEmpty() const \ - { return empty(); } \ - size_t GetCount() const \ - { return size(); } \ - int Number() const \ - { return static_cast< int >( GetCount() ); } \ - \ - compatibility_iterator Item( size_t idx ) const \ - { \ - iterator i = const_cast< liT* >(this)->begin(); \ - std::advance( i, idx ); \ - return compatibility_iterator( this, i ); \ - } \ - elT operator[](size_t idx) const \ - { \ - return Item(idx).GetData(); \ - } \ - \ - compatibility_iterator GetFirst() const \ - { \ - return compatibility_iterator( this, \ - const_cast< liT* >(this)->begin() ); \ - } \ - compatibility_iterator GetLast() const \ - { \ - iterator i = const_cast< liT* >(this)->end(); \ - return compatibility_iterator( this, !empty() ? --i : i ); \ - } \ - compatibility_iterator Member( elT e ) const \ - { return Find( e ); } \ - compatibility_iterator Nth( int n ) const \ - { return Item( n ); } \ - int IndexOf( elT e ) const \ - { return Find( e ).IndexOf(); } \ - \ - compatibility_iterator Append( elT e ) \ - { \ - push_back( e ); \ - return GetLast(); \ - } \ - compatibility_iterator Insert( elT e ) \ - { \ - push_front( e ); \ - return compatibility_iterator( this, begin() ); \ - } \ - compatibility_iterator Insert( compatibility_iterator & i, elT e ) \ - { \ - return compatibility_iterator( this, insert( i.m_iter, e ) ); \ - } \ - compatibility_iterator Insert( size_t idx, elT e ) \ - { \ - return compatibility_iterator( this, \ - insert( Item( idx ).m_iter, e ) ); \ - } \ - \ - void DeleteContents( bool destroy ) \ - { m_destroy = destroy; } \ - bool GetDeleteContents() const \ - { return m_destroy; } \ - void Erase( const compatibility_iterator& i ) \ - { \ - if ( m_destroy ) \ - _WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \ - erase( i.m_iter ); \ - } \ - bool DeleteNode( const compatibility_iterator& i ) \ - { \ - if( i ) \ - { \ - Erase( i ); \ - return true; \ - } \ - return false; \ - } \ - bool DeleteObject( elT e ) \ - { \ - return DeleteNode( Find( e ) ); \ - } \ - void Clear() \ - { \ - if ( m_destroy ) \ - std::for_each( begin(), end(), \ - _WX_LIST_HELPER_##liT::DeleteFunction ); \ - clear(); \ - } \ - /* Workaround for broken VC6 std::list::sort() see above */ \ - void Sort( wxSortCompareFunction compfunc ) \ - { sort( WX_LIST_SORTFUNCTION( elT, compfunc ) ); } \ - ~liT() { Clear(); } \ - \ - /* It needs access to our EmptyList */ \ - friend decl compatibility_iterator; \ - } - -#define WX_DECLARE_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class) -#define WX_DECLARE_LIST_PTR(elementtype, listname) \ - WX_DECLARE_LIST(elementtype, listname) - -#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) -#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ - WX_DECLARE_EXPORTED_LIST(elementtype, listname) - -#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo) -#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ - WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) - -// this macro must be inserted in your program after -// #include "wx/listimpl.cpp" -#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" - -#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) - -#else // if !wxUSE_STL - -// due to circular header dependencies this function has to be declared here -// (normally it's found in utils.h which includes itself list.h...) -#if WXWIN_COMPATIBILITY_2_4 -extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s); -#endif - -// undef it to get rid of old, deprecated functions -#define wxLIST_COMPATIBILITY - -// ----------------------------------------------------------------------------- -// key stuff: a list may be optionally keyed on integer or string key -// ----------------------------------------------------------------------------- - -union wxListKeyValue -{ - long integer; - wxChar *string; -}; - -// a struct which may contain both types of keys -// -// implementation note: on one hand, this class allows to have only one function -// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to -// resolve ambiguity which we would otherwise have with wxStringList::Find() and -// wxList::Find(const char *). -class WXDLLIMPEXP_BASE wxListKey -{ -public: - // implicit ctors - wxListKey() : m_keyType(wxKEY_NONE) - { } - wxListKey(long i) : m_keyType(wxKEY_INTEGER) - { m_key.integer = i; } - wxListKey(const wxChar *s) : m_keyType(wxKEY_STRING) - { m_key.string = wxStrdup(s); } - wxListKey(const wxString& s) : m_keyType(wxKEY_STRING) - { m_key.string = wxStrdup(s.c_str()); } - - // accessors - wxKeyType GetKeyType() const { return m_keyType; } - const wxChar *GetString() const - { wxASSERT( m_keyType == wxKEY_STRING ); return m_key.string; } - long GetNumber() const - { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; } - - // comparison - // Note: implementation moved to list.cpp to prevent BC++ inline - // expansion warning. - bool operator==(wxListKeyValue value) const ; - - // dtor - ~wxListKey() - { - if ( m_keyType == wxKEY_STRING ) - free(m_key.string); - } - -private: - wxKeyType m_keyType; - wxListKeyValue m_key; -}; - -// ----------------------------------------------------------------------------- -// wxNodeBase class is a (base for) node in a double linked list -// ----------------------------------------------------------------------------- - -extern WXDLLIMPEXP_DATA_BASE(wxListKey) wxDefaultListKey; - -class WXDLLIMPEXP_FWD_BASE wxListBase; - -class WXDLLIMPEXP_BASE wxNodeBase -{ -friend class wxListBase; -public: - // ctor - wxNodeBase(wxListBase *list = (wxListBase *)NULL, - wxNodeBase *previous = (wxNodeBase *)NULL, - wxNodeBase *next = (wxNodeBase *)NULL, - void *data = NULL, - const wxListKey& key = wxDefaultListKey); - - virtual ~wxNodeBase(); - - // FIXME no check is done that the list is really keyed on strings - const wxChar *GetKeyString() const { return m_key.string; } - long GetKeyInteger() const { return m_key.integer; } - - // Necessary for some existing code - void SetKeyString(wxChar* s) { m_key.string = s; } - void SetKeyInteger(long i) { m_key.integer = i; } - -#ifdef wxLIST_COMPATIBILITY - // compatibility methods, use Get* instead. - wxDEPRECATED( wxNode *Next() const ); - wxDEPRECATED( wxNode *Previous() const ); - wxDEPRECATED( wxObject *Data() const ); -#endif // wxLIST_COMPATIBILITY - -protected: - // all these are going to be "overloaded" in the derived classes - wxNodeBase *GetNext() const { return m_next; } - wxNodeBase *GetPrevious() const { return m_previous; } - - void *GetData() const { return m_data; } - void SetData(void *data) { m_data = data; } - - // get 0-based index of this node within the list or wxNOT_FOUND - int IndexOf() const; - - virtual void DeleteData() { } -public: - // for wxList::iterator - void** GetDataPtr() const { return &(((wxNodeBase*)this)->m_data); } -private: - // optional key stuff - wxListKeyValue m_key; - - void *m_data; // user data - wxNodeBase *m_next, // next and previous nodes in the list - *m_previous; - - wxListBase *m_list; // list we belong to - - DECLARE_NO_COPY_CLASS(wxNodeBase) -}; - -// ----------------------------------------------------------------------------- -// a double-linked list class -// ----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxList; - -class WXDLLIMPEXP_BASE wxListBase : public wxObject -{ -friend class WXDLLIMPEXP_FWD_BASE wxNodeBase; // should be able to call DetachNode() -friend class wxHashTableBase; // should be able to call untyped Find() - -public: - // default ctor & dtor - wxListBase(wxKeyType keyType = wxKEY_NONE) - { Init(keyType); } - virtual ~wxListBase(); - - // accessors - // count of items in the list - size_t GetCount() const { return m_count; } - - // return true if this list is empty - bool IsEmpty() const { return m_count == 0; } - - // operations - - // delete all nodes - void Clear(); - - // instruct it to destroy user data when deleting nodes - void DeleteContents(bool destroy) { m_destroy = destroy; } - - // query if to delete - bool GetDeleteContents() const - { return m_destroy; } - - // get the keytype - wxKeyType GetKeyType() const - { return m_keyType; } - - // set the keytype (required by the serial code) - void SetKeyType(wxKeyType keyType) - { wxASSERT( m_count==0 ); m_keyType = keyType; } - -#ifdef wxLIST_COMPATIBILITY - // compatibility methods from old wxList - wxDEPRECATED( int Number() const ); // use GetCount instead. - wxDEPRECATED( wxNode *First() const ); // use GetFirst - wxDEPRECATED( wxNode *Last() const ); // use GetLast - wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item - - // kludge for typesafe list migration in core classes. - wxDEPRECATED( operator wxList&() const ); -#endif // wxLIST_COMPATIBILITY - -protected: - - // all methods here are "overloaded" in derived classes to provide compile - // time type checking - - // create a node for the list of this type - virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, - void *data, - const wxListKey& key = wxDefaultListKey) = 0; - -// Can't access these from derived classes otherwise (bug in Salford C++?) -#ifdef __SALFORDC__ -public: -#endif - - // ctors - // from an array - wxListBase(size_t count, void *elements[]); - // from a sequence of objects - wxListBase(void *object, ... /* terminate with NULL */); - -protected: - void Assign(const wxListBase& list) - { Clear(); DoCopy(list); } - - // get list head/tail - wxNodeBase *GetFirst() const { return m_nodeFirst; } - wxNodeBase *GetLast() const { return m_nodeLast; } - - // by (0-based) index - wxNodeBase *Item(size_t index) const; - - // get the list item's data - void *operator[](size_t n) const - { - wxNodeBase *node = Item(n); - - return node ? node->GetData() : (wxNodeBase *)NULL; - } - - // operations - // append to end of list - wxNodeBase *Prepend(void *object) - { return (wxNodeBase *)wxListBase::Insert(object); } - // append to beginning of list - wxNodeBase *Append(void *object); - // insert a new item at the beginning of the list - wxNodeBase *Insert(void *object) { return Insert( (wxNodeBase*)NULL, object); } - // insert a new item at the given position - wxNodeBase *Insert(size_t pos, void *object) - { return pos == GetCount() ? Append(object) - : Insert(Item(pos), object); } - // insert before given node or at front of list if prev == NULL - wxNodeBase *Insert(wxNodeBase *prev, void *object); - - // keyed append - wxNodeBase *Append(long key, void *object); - wxNodeBase *Append(const wxChar *key, void *object); - - // removes node from the list but doesn't delete it (returns pointer - // to the node or NULL if it wasn't found in the list) - wxNodeBase *DetachNode(wxNodeBase *node); - // delete element from list, returns false if node not found - bool DeleteNode(wxNodeBase *node); - // finds object pointer and deletes node (and object if DeleteContents - // is on), returns false if object not found - bool DeleteObject(void *object); - - // search (all return NULL if item not found) - // by data - wxNodeBase *Find(const void *object) const; - - // by key - wxNodeBase *Find(const wxListKey& key) const; - - // get 0-based index of object or wxNOT_FOUND - int IndexOf( void *object ) const; - - // this function allows the sorting of arbitrary lists by giving - // a function to compare two list elements. The list is sorted in place. - void Sort(const wxSortCompareFunction compfunc); - - // functions for iterating over the list - void *FirstThat(wxListIterateFunction func); - void ForEach(wxListIterateFunction func); - void *LastThat(wxListIterateFunction func); - - // for STL interface, "last" points to one after the last node - // of the controlled sequence (NULL for the end of the list) - void Reverse(); - void DeleteNodes(wxNodeBase* first, wxNodeBase* last); -private: - - // common part of all ctors - void Init(wxKeyType keyType = wxKEY_NONE); - - // helpers - // common part of copy ctor and assignment operator - void DoCopy(const wxListBase& list); - // common part of all Append()s - wxNodeBase *AppendCommon(wxNodeBase *node); - // free node's data and node itself - void DoDeleteNode(wxNodeBase *node); - - size_t m_count; // number of elements in the list - bool m_destroy; // destroy user data when deleting list items? - wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list - *m_nodeLast; - - wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE) -}; - -// ----------------------------------------------------------------------------- -// macros for definition of "template" list type -// ----------------------------------------------------------------------------- - -// and now some heavy magic... - -// declare a list type named 'name' and containing elements of type 'T *' -// (as a by product of macro expansion you also get wx##name##Node -// wxNode-derived type) -// -// implementation details: -// 1. We define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type -// for the list of given type - this allows us to pass only the list name -// to WX_DEFINE_LIST() even if it needs both the name and the type -// -// 2. We redefine all non-type-safe wxList functions with type-safe versions -// which don't take any space (everything is inline), but bring compile -// time error checking. -// -// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of -// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most -// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes -// interesting capability to store polymorphic objects in the list and is -// particularly useful with, for example, "wxWindow *" list where the -// wxWindowBase pointers are put into the list, but wxWindow pointers are -// retrieved from it. -// -// 4. final hack is that WX_DECLARE_LIST_3 is defined in terms of -// WX_DECLARE_LIST_4 to allow defining classes without operator->() as -// it results in compiler warnings when this operator doesn't make sense -// (i.e. stored elements are not pointers) - -// common part of WX_DECLARE_LIST_3 and WX_DECLARE_LIST_PTR_3 -#define WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, ptrop) \ - typedef int (*wxSortFuncFor_##name)(const T **, const T **); \ - \ - classexp nodetype : public wxNodeBase \ - { \ - public: \ - nodetype(wxListBase *list = (wxListBase *)NULL, \ - nodetype *previous = (nodetype *)NULL, \ - nodetype *next = (nodetype *)NULL, \ - T *data = (T *)NULL, \ - const wxListKey& key = wxDefaultListKey) \ - : wxNodeBase(list, previous, next, data, key) { } \ - \ - nodetype *GetNext() const \ - { return (nodetype *)wxNodeBase::GetNext(); } \ - nodetype *GetPrevious() const \ - { return (nodetype *)wxNodeBase::GetPrevious(); } \ - \ - T *GetData() const \ - { return (T *)wxNodeBase::GetData(); } \ - void SetData(T *data) \ - { wxNodeBase::SetData(data); } \ - \ - protected: \ - virtual void DeleteData(); \ - \ - DECLARE_NO_COPY_CLASS(nodetype) \ - }; \ - \ - classexp name : public wxListBase \ - { \ - public: \ - typedef nodetype Node; \ - classexp compatibility_iterator \ - { \ - public: \ - compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ - \ - Node *operator->() const { return m_ptr; } \ - operator Node *() const { return m_ptr; } \ - \ - private: \ - Node *m_ptr; \ - }; \ - \ - name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \ - { } \ - name(const name& list) : wxListBase(list.GetKeyType()) \ - { Assign(list); } \ - name(size_t count, T *elements[]) \ - : wxListBase(count, (void **)elements) { } \ - \ - name& operator=(const name& list) \ - { Assign(list); return *this; } \ - \ - nodetype *GetFirst() const \ - { return (nodetype *)wxListBase::GetFirst(); } \ - nodetype *GetLast() const \ - { return (nodetype *)wxListBase::GetLast(); } \ - \ - nodetype *Item(size_t index) const \ - { return (nodetype *)wxListBase::Item(index); } \ - \ - T *operator[](size_t index) const \ - { \ - nodetype *node = Item(index); \ - return node ? (T*)(node->GetData()) : (T*)NULL; \ - } \ - \ - nodetype *Append(Tbase *object) \ - { return (nodetype *)wxListBase::Append(object); } \ - nodetype *Insert(Tbase *object) \ - { return (nodetype *)Insert((nodetype*)NULL, object); } \ - nodetype *Insert(size_t pos, Tbase *object) \ - { return (nodetype *)wxListBase::Insert(pos, object); } \ - nodetype *Insert(nodetype *prev, Tbase *object) \ - { return (nodetype *)wxListBase::Insert(prev, object); } \ - \ - nodetype *Append(long key, void *object) \ - { return (nodetype *)wxListBase::Append(key, object); } \ - nodetype *Append(const wxChar *key, void *object) \ - { return (nodetype *)wxListBase::Append(key, object); } \ - \ - nodetype *DetachNode(nodetype *node) \ - { return (nodetype *)wxListBase::DetachNode(node); } \ - bool DeleteNode(nodetype *node) \ - { return wxListBase::DeleteNode(node); } \ - bool DeleteObject(Tbase *object) \ - { return wxListBase::DeleteObject(object); } \ - void Erase(nodetype *it) \ - { DeleteNode(it); } \ - \ - nodetype *Find(const Tbase *object) const \ - { return (nodetype *)wxListBase::Find(object); } \ - \ - virtual nodetype *Find(const wxListKey& key) const \ - { return (nodetype *)wxListBase::Find(key); } \ - \ - int IndexOf(Tbase *object) const \ - { return wxListBase::IndexOf(object); } \ - \ - void Sort(wxSortCompareFunction func) \ - { wxListBase::Sort(func); } \ - void Sort(wxSortFuncFor_##name func) \ - { Sort((wxSortCompareFunction)func); } \ - \ - protected: \ - virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \ - void *data, \ - const wxListKey& key = wxDefaultListKey) \ - { \ - return new nodetype(this, \ - (nodetype *)prev, (nodetype *)next, \ - (T *)data, key); \ - } \ - /* STL interface */ \ - public: \ - typedef size_t size_type; \ - typedef int difference_type; \ - typedef T* value_type; \ - typedef Tbase* base_value_type; \ - typedef value_type& reference; \ - typedef const value_type& const_reference; \ - typedef base_value_type& base_reference; \ - typedef const base_value_type& const_base_reference; \ - \ - classexp iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef iterator itor; \ - typedef T* value_type; \ - typedef value_type* ptr_type; \ - typedef value_type& reference; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef reference reference_type; \ - typedef ptr_type pointer_type; \ - \ - iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\ - iterator() : m_node(NULL), m_init(NULL) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() { m_node = m_node->GetNext(); return *this; }\ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ - itor& operator--() \ - { \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return *this; \ - } \ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - classexp const_iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef T* value_type; \ - typedef const value_type& const_reference; \ - typedef const_iterator itor; \ - typedef value_type* ptr_type; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef const_reference reference_type; \ - typedef const ptr_type pointer_type; \ - \ - const_iterator(Node* node, Node* init) \ - : m_node(node), m_init(init) { } \ - const_iterator() : m_node(NULL), m_init(NULL) { } \ - const_iterator(const iterator& it) \ - : m_node(it.m_node), m_init(it.m_init) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() { m_node = m_node->GetNext(); return *this; }\ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ - itor& operator--() \ - { \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return *this; \ - } \ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetPrevious() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - classexp reverse_iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef T* value_type; \ - typedef reverse_iterator itor; \ - typedef value_type* ptr_type; \ - typedef value_type& reference; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef reference reference_type; \ - typedef ptr_type pointer_type; \ - \ - reverse_iterator(Node* node, Node* init) \ - : m_node(node), m_init(init) { } \ - reverse_iterator() : m_node(NULL), m_init(NULL) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() \ - { m_node = m_node->GetPrevious(); return *this; } \ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ - itor& operator--() \ - { m_node = m_node ? m_node->GetNext() : m_init; return *this; } \ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetNext() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - classexp const_reverse_iterator \ - { \ - typedef name list; \ - public: \ - typedef nodetype Node; \ - typedef T* value_type; \ - typedef const_reverse_iterator itor; \ - typedef value_type* ptr_type; \ - typedef const value_type& const_reference; \ - \ - Node* m_node; \ - Node* m_init; \ - public: \ - typedef const_reference reference_type; \ - typedef const ptr_type pointer_type; \ - \ - const_reverse_iterator(Node* node, Node* init) \ - : m_node(node), m_init(init) { } \ - const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \ - const_reverse_iterator(const reverse_iterator& it) \ - : m_node(it.m_node), m_init(it.m_init) { } \ - reference_type operator*() const \ - { return *(pointer_type)m_node->GetDataPtr(); } \ - ptrop \ - itor& operator++() \ - { m_node = m_node->GetPrevious(); return *this; } \ - const itor operator++(int) \ - { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ - itor& operator--() \ - { m_node = m_node ? m_node->GetNext() : m_init; return *this;}\ - const itor operator--(int) \ - { \ - itor tmp = *this; \ - m_node = m_node ? m_node->GetNext() : m_init; \ - return tmp; \ - } \ - bool operator!=(const itor& it) const \ - { return it.m_node != m_node; } \ - bool operator==(const itor& it) const \ - { return it.m_node == m_node; } \ - }; \ - \ - wxEXPLICIT name(size_type n, const_reference v = value_type()) \ - { assign(n, v); } \ - name(const const_iterator& first, const const_iterator& last) \ - { assign(first, last); } \ - iterator begin() { return iterator(GetFirst(), GetLast()); } \ - const_iterator begin() const \ - { return const_iterator(GetFirst(), GetLast()); } \ - iterator end() { return iterator(NULL, GetLast()); } \ - const_iterator end() const { return const_iterator(NULL, GetLast()); }\ - reverse_iterator rbegin() \ - { return reverse_iterator(GetLast(), GetFirst()); } \ - const_reverse_iterator rbegin() const \ - { return const_reverse_iterator(GetLast(), GetFirst()); } \ - reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\ - const_reverse_iterator rend() const \ - { return const_reverse_iterator(NULL, GetFirst()); } \ - void resize(size_type n, value_type v = value_type()) \ - { \ - while (n < size()) \ - pop_back(); \ - while (n > size()) \ - push_back(v); \ - } \ - size_type size() const { return GetCount(); } \ - size_type max_size() const { return INT_MAX; } \ - bool empty() const { return IsEmpty(); } \ - reference front() { return *begin(); } \ - const_reference front() const { return *begin(); } \ - reference back() { iterator tmp = end(); return *--tmp; } \ - const_reference back() const { const_iterator tmp = end(); return *--tmp; }\ - void push_front(const_reference v = value_type()) \ - { Insert(GetFirst(), (const_base_reference)v); } \ - void pop_front() { DeleteNode(GetFirst()); } \ - void push_back(const_reference v = value_type()) \ - { Append((const_base_reference)v); } \ - void pop_back() { DeleteNode(GetLast()); } \ - void assign(const_iterator first, const const_iterator& last) \ - { \ - clear(); \ - for(; first != last; ++first) \ - Append((const_base_reference)*first); \ - } \ - void assign(size_type n, const_reference v = value_type()) \ - { \ - clear(); \ - for(size_type i = 0; i < n; ++i) \ - Append((const_base_reference)v); \ - } \ - iterator insert(const iterator& it, const_reference v = value_type())\ - { \ - Insert(it.m_node, (const_base_reference)v); \ - return iterator(it.m_node->GetPrevious(), GetLast()); \ - } \ - void insert(const iterator& it, size_type n, const_reference v = value_type())\ - { \ - for(size_type i = 0; i < n; ++i) \ - Insert(it.m_node, (const_base_reference)v); \ - } \ - void insert(const iterator& it, const_iterator first, const const_iterator& last)\ - { \ - for(; first != last; ++first) \ - Insert(it.m_node, (const_base_reference)*first); \ - } \ - iterator erase(const iterator& it) \ - { \ - iterator next = iterator(it.m_node->GetNext(), GetLast()); \ - DeleteNode(it.m_node); return next; \ - } \ - iterator erase(const iterator& first, const iterator& last) \ - { \ - iterator next = last; ++next; \ - DeleteNodes(first.m_node, last.m_node); \ - return next; \ - } \ - void clear() { Clear(); } \ - void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\ - { insert(it, first, last); l.erase(first, last); } \ - void splice(const iterator& it, name& l) \ - { splice(it, l, l.begin(), l.end() ); } \ - void splice(const iterator& it, name& l, const iterator& first) \ - { \ - iterator tmp = first; ++tmp; \ - if(it == first || it == tmp) return; \ - insert(it, *first); \ - l.erase(first); \ - } \ - void remove(const_reference v) \ - { DeleteObject((const_base_reference)v); } \ - void reverse() \ - { Reverse(); } \ - /* void swap(name& l) \ - { \ - { size_t t = m_count; m_count = l.m_count; l.m_count = t; } \ - { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }\ - { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }\ - { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }\ - { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }\ - } */ \ - } - -#define WX_LIST_PTROP \ - pointer_type operator->() const \ - { return (pointer_type)m_node->GetDataPtr(); } -#define WX_LIST_PTROP_NONE - -#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \ - WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP_NONE) -#define WX_DECLARE_LIST_PTR_3(T, Tbase, name, nodetype, classexp) \ - WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP) - -#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \ - WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp) -#define WX_DECLARE_LIST_PTR_2(elementtype, listname, nodename, classexp) \ - WX_DECLARE_LIST_PTR_3(elementtype, elementtype, listname, nodename, classexp) - -#define WX_DECLARE_LIST(elementtype, listname) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class) -#define WX_DECLARE_LIST_PTR(elementtype, listname) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class) - -#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl) - -#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ - WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) - -#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT) - -#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class usergoo) -#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ - typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class usergoo) - -// this macro must be inserted in your program after -// #include "wx/listimpl.cpp" -#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" - -#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) -#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) - -#endif // !wxUSE_STL - -// ============================================================================ -// now we can define classes 100% compatible with the old ones -// ============================================================================ - -// ---------------------------------------------------------------------------- -// commonly used list classes -// ---------------------------------------------------------------------------- - -#if defined(wxLIST_COMPATIBILITY) - -// inline compatibility functions - -#if !wxUSE_STL - -// ---------------------------------------------------------------------------- -// wxNodeBase deprecated methods -// ---------------------------------------------------------------------------- - -inline wxNode *wxNodeBase::Next() const { return (wxNode *)GetNext(); } -inline wxNode *wxNodeBase::Previous() const { return (wxNode *)GetPrevious(); } -inline wxObject *wxNodeBase::Data() const { return (wxObject *)GetData(); } - -// ---------------------------------------------------------------------------- -// wxListBase deprecated methods -// ---------------------------------------------------------------------------- - -inline int wxListBase::Number() const { return (int)GetCount(); } -inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); } -inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); } -inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); } -inline wxListBase::operator wxList&() const { return *(wxList*)this; } - -#endif - -// define this to make a lot of noise about use of the old wxList classes. -//#define wxWARN_COMPAT_LIST_USE - -// ---------------------------------------------------------------------------- -// wxList compatibility class: in fact, it's a list of wxObjects -// ---------------------------------------------------------------------------- - -WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, - class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxList : public wxObjectList -{ -public: -#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STL - wxList() { }; - wxDEPRECATED( wxList(int key_type) ); -#elif !wxUSE_STL - wxList(int key_type = wxKEY_NONE); -#endif - - // this destructor is required for Darwin - ~wxList() { } - -#if !wxUSE_STL - wxList& operator=(const wxList& list) - { (void) wxListBase::operator=(list); return *this; } - - // compatibility methods - void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } -#endif - -#if wxUSE_STL -#else - wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); } -#endif - -private: -#if !wxUSE_STL - DECLARE_DYNAMIC_CLASS(wxList) -#endif -}; - -#if !wxUSE_STL - -// ----------------------------------------------------------------------------- -// wxStringList class for compatibility with the old code -// ----------------------------------------------------------------------------- -WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase -{ -public: - // ctors and such - // default -#ifdef wxWARN_COMPAT_LIST_USE - wxStringList(); - wxDEPRECATED( wxStringList(const wxChar *first ...) ); -#else - wxStringList(); - wxStringList(const wxChar *first ...); -#endif - - // copying the string list: the strings are copied, too (extremely - // inefficient!) - wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); } - wxStringList& operator=(const wxStringList& other) - { Clear(); DoCopy(other); return *this; } - - // operations - // makes a copy of the string - wxNode *Add(const wxChar *s); - - // Append to beginning of list - wxNode *Prepend(const wxChar *s); - - bool Delete(const wxChar *s); - - wxChar **ListToArray(bool new_copies = false) const; - bool Member(const wxChar *s) const; - - // alphabetic sort - void Sort(); - -private: - void DoCopy(const wxStringList&); // common part of copy ctor and operator= - - DECLARE_DYNAMIC_CLASS(wxStringList) -}; - -#else // if wxUSE_STL - -WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase -{ -public: - compatibility_iterator Append(wxChar* s) - { wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); } - compatibility_iterator Insert(wxChar* s) - { wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); } - compatibility_iterator Insert(size_t pos, wxChar* s) - { - wxString tmp = s; - delete[] s; - return wxStringListBase::Insert(pos, tmp); - } - compatibility_iterator Add(const wxChar* s) - { push_back(s); return GetLast(); } - compatibility_iterator Prepend(const wxChar* s) - { push_front(s); return GetFirst(); } -}; - -#endif // wxUSE_STL - -#endif // wxLIST_COMPATIBILITY - -// delete all list elements -// -// NB: the class declaration of the list elements must be visible from the -// place where you use this macro, otherwise the proper destructor may not -// be called (a decent compiler should give a warning about it, but don't -// count on it)! -#define WX_CLEAR_LIST(type, list) \ - { \ - type::iterator it, en; \ - for( it = (list).begin(), en = (list).end(); it != en; ++it ) \ - delete *it; \ - (list).clear(); \ - } - -#endif // _WX_LISTH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/list.h +// Purpose: wxList, wxStringList classes +// Author: Julian Smart +// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added +// Created: 29/01/98 +// RCS-ID: $Id: list.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + All this is quite ugly but serves two purposes: + 1. Be almost 100% compatible with old, untyped, wxList class + 2. Ensure compile-time type checking for the linked lists + + The idea is to have one base class (wxListBase) working with "void *" data, + but to hide these untyped functions - i.e. make them protected, so they + can only be used from derived classes which have inline member functions + working with right types. This achieves the 2nd goal. As for the first one, + we provide a special derivation of wxListBase called wxList which looks just + like the old class. +*/ + +#ifndef _WX_LISTH__ +#define _WX_LISTH__ + +// ----------------------------------------------------------------------------- +// headers +// ----------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" + +#if wxUSE_STL + #include "wx/beforestd.h" + #include <algorithm> + #include <iterator> + #include <list> + #include "wx/afterstd.h" +#endif + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// type of compare function for list sort operation (as in 'qsort'): it should +// return a negative value, 0 or positive value if the first element is less +// than, equal or greater than the second + +extern "C" +{ +typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); +} + +class WXDLLIMPEXP_FWD_BASE wxObjectListNode; +typedef wxObjectListNode wxNode; + +// +typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#if !defined(wxENUM_KEY_TYPE_DEFINED) +#define wxENUM_KEY_TYPE_DEFINED + +enum wxKeyType +{ + wxKEY_NONE, + wxKEY_INTEGER, + wxKEY_STRING +}; + +#endif + +#if wxUSE_STL + +#define wxLIST_COMPATIBILITY + +#define WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) \ + WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) +#define WX_DECLARE_LIST_PTR_3(elT, dummy1, liT, dummy2, decl) \ + WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) + +#define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ + WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) +#define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \ + WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ + +#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ + WX_DECLARE_LIST_XO(elT*, liT, decl) + +#if !defined( __VISUALC__ ) + +template<class T> +class WXDLLIMPEXP_BASE wxList_SortFunction +{ +public: + wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { } + bool operator()(const T& i1, const T& i2) + { return m_f((T*)&i1, (T*)&i2) < 0; } +private: + wxSortCompareFunction m_f; +}; + +#define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction<elT>(f) +#define VC6_WORKAROUND(elT, liT, decl) + +#else // if defined( __VISUALC__ ) + +#define WX_LIST_SORTFUNCTION( elT, f ) std::greater<elT>( f ) +#define VC6_WORKAROUND(elT, liT, decl) \ + decl liT; \ + \ + /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \ + /* to be passed into std::list::sort() */ \ + template <> \ + struct std::greater<elT> \ + { \ + private: \ + wxSortCompareFunction m_CompFunc; \ + public: \ + greater( wxSortCompareFunction compfunc = NULL ) \ + : m_CompFunc( compfunc ) {} \ + bool operator()(const elT X, const elT Y) const \ + { \ + return m_CompFunc ? \ + ( m_CompFunc( X, Y ) < 0 ) : \ + ( X > Y ); \ + } \ + }; + +#endif // defined( __VISUALC__ ) + +/* + Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround + for mingw 3.2.3 compiler bug that prevents a static function of liT class + from being exported into dll. A minimal code snippet reproducing the bug: + + struct WXDLLEXPORT Foo + { + static void Bar(); + struct SomeInnerClass + { + friend class Foo; // comment this out to make it link + }; + ~Foo() + { + Bar(); + } + }; + + The program does not link under mingw_gcc 3.2.3 producing undefined + reference to Foo::Bar() function + + + Note 2: the EmptyList is needed to allow having a NULL pointer-like + invalid iterator. We used to use just an uninitialized iterator object + instead but this fails with some debug/checked versions of STL, notably the + glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate + invalid iterator. + */ + +// the real wxList-class declaration +#define WX_DECLARE_LIST_XO(elT, liT, decl) \ + decl _WX_LIST_HELPER_##liT \ + { \ + typedef elT _WX_LIST_ITEM_TYPE_##liT; \ + public: \ + static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \ + }; \ + \ + VC6_WORKAROUND(elT, liT, decl) \ + decl liT : public std::list<elT> \ + { \ + private: \ + typedef std::list<elT> BaseListType; \ + static BaseListType EmptyList; \ + \ + bool m_destroy; \ + \ + public: \ + decl compatibility_iterator \ + { \ + private: \ + /* Workaround for broken VC6 nested class name resolution */ \ + typedef std::list<elT>::iterator iterator; \ + friend class liT; \ + \ + iterator m_iter; \ + liT * m_list; \ + \ + public: \ + compatibility_iterator() \ + : m_iter(EmptyList.end()), m_list( NULL ) {} \ + compatibility_iterator( liT* li, iterator i ) \ + : m_iter( i ), m_list( li ) {} \ + compatibility_iterator( const liT* li, iterator i ) \ + : m_iter( i ), m_list( const_cast< liT* >( li ) ) {} \ + \ + compatibility_iterator* operator->() { return this; } \ + const compatibility_iterator* operator->() const { return this; } \ + \ + bool operator==(const compatibility_iterator& i) const \ + { \ + wxASSERT_MSG( m_list && i.m_list, \ + _T("comparing invalid iterators is illegal") ); \ + return (m_list == i.m_list) && (m_iter == i.m_iter); \ + } \ + bool operator!=(const compatibility_iterator& i) const \ + { return !( operator==( i ) ); } \ + operator bool() const \ + { return m_list ? m_iter != m_list->end() : false; } \ + bool operator !() const \ + { return !( operator bool() ); } \ + \ + elT GetData() const \ + { return *m_iter; } \ + void SetData( elT e ) \ + { *m_iter = e; } \ + \ + compatibility_iterator GetNext() const \ + { \ + iterator i = m_iter; \ + return compatibility_iterator( m_list, ++i ); \ + } \ + compatibility_iterator GetPrevious() const \ + { \ + if ( m_iter == m_list->begin() ) \ + return compatibility_iterator(); \ + \ + iterator i = m_iter; \ + return compatibility_iterator( m_list, --i ); \ + } \ + int IndexOf() const \ + { \ + return *this ? std::distance( m_list->begin(), m_iter ) \ + : wxNOT_FOUND; \ + } \ + }; \ + public: \ + liT() : m_destroy( false ) {} \ + \ + compatibility_iterator Find( const elT e ) const \ + { \ + liT* _this = const_cast< liT* >( this ); \ + return compatibility_iterator( _this, \ + std::find( _this->begin(), _this->end(), e ) ); \ + } \ + \ + bool IsEmpty() const \ + { return empty(); } \ + size_t GetCount() const \ + { return size(); } \ + int Number() const \ + { return static_cast< int >( GetCount() ); } \ + \ + compatibility_iterator Item( size_t idx ) const \ + { \ + iterator i = const_cast< liT* >(this)->begin(); \ + std::advance( i, idx ); \ + return compatibility_iterator( this, i ); \ + } \ + elT operator[](size_t idx) const \ + { \ + return Item(idx).GetData(); \ + } \ + \ + compatibility_iterator GetFirst() const \ + { \ + return compatibility_iterator( this, \ + const_cast< liT* >(this)->begin() ); \ + } \ + compatibility_iterator GetLast() const \ + { \ + iterator i = const_cast< liT* >(this)->end(); \ + return compatibility_iterator( this, !empty() ? --i : i ); \ + } \ + compatibility_iterator Member( elT e ) const \ + { return Find( e ); } \ + compatibility_iterator Nth( int n ) const \ + { return Item( n ); } \ + int IndexOf( elT e ) const \ + { return Find( e ).IndexOf(); } \ + \ + compatibility_iterator Append( elT e ) \ + { \ + push_back( e ); \ + return GetLast(); \ + } \ + compatibility_iterator Insert( elT e ) \ + { \ + push_front( e ); \ + return compatibility_iterator( this, begin() ); \ + } \ + compatibility_iterator Insert( compatibility_iterator & i, elT e ) \ + { \ + return compatibility_iterator( this, insert( i.m_iter, e ) ); \ + } \ + compatibility_iterator Insert( size_t idx, elT e ) \ + { \ + return compatibility_iterator( this, \ + insert( Item( idx ).m_iter, e ) ); \ + } \ + \ + void DeleteContents( bool destroy ) \ + { m_destroy = destroy; } \ + bool GetDeleteContents() const \ + { return m_destroy; } \ + void Erase( const compatibility_iterator& i ) \ + { \ + if ( m_destroy ) \ + _WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \ + erase( i.m_iter ); \ + } \ + bool DeleteNode( const compatibility_iterator& i ) \ + { \ + if( i ) \ + { \ + Erase( i ); \ + return true; \ + } \ + return false; \ + } \ + bool DeleteObject( elT e ) \ + { \ + return DeleteNode( Find( e ) ); \ + } \ + void Clear() \ + { \ + if ( m_destroy ) \ + std::for_each( begin(), end(), \ + _WX_LIST_HELPER_##liT::DeleteFunction ); \ + clear(); \ + } \ + /* Workaround for broken VC6 std::list::sort() see above */ \ + void Sort( wxSortCompareFunction compfunc ) \ + { sort( WX_LIST_SORTFUNCTION( elT, compfunc ) ); } \ + ~liT() { Clear(); } \ + \ + /* It needs access to our EmptyList */ \ + friend decl compatibility_iterator; \ + } + +#define WX_DECLARE_LIST(elementtype, listname) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class) +#define WX_DECLARE_LIST_PTR(elementtype, listname) \ + WX_DECLARE_LIST(elementtype, listname) + +#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) +#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ + WX_DECLARE_EXPORTED_LIST(elementtype, listname) + +#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo) +#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ + WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) + +// this macro must be inserted in your program after +// #include "wx/listimpl.cpp" +#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" + +#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) +#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) + +#else // if !wxUSE_STL + +// due to circular header dependencies this function has to be declared here +// (normally it's found in utils.h which includes itself list.h...) +#if WXWIN_COMPATIBILITY_2_4 +extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s); +#endif + +// undef it to get rid of old, deprecated functions +#define wxLIST_COMPATIBILITY + +// ----------------------------------------------------------------------------- +// key stuff: a list may be optionally keyed on integer or string key +// ----------------------------------------------------------------------------- + +union wxListKeyValue +{ + long integer; + wxChar *string; +}; + +// a struct which may contain both types of keys +// +// implementation note: on one hand, this class allows to have only one function +// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to +// resolve ambiguity which we would otherwise have with wxStringList::Find() and +// wxList::Find(const char *). +class WXDLLIMPEXP_BASE wxListKey +{ +public: + // implicit ctors + wxListKey() : m_keyType(wxKEY_NONE) + { } + wxListKey(long i) : m_keyType(wxKEY_INTEGER) + { m_key.integer = i; } + wxListKey(const wxChar *s) : m_keyType(wxKEY_STRING) + { m_key.string = wxStrdup(s); } + wxListKey(const wxString& s) : m_keyType(wxKEY_STRING) + { m_key.string = wxStrdup(s.c_str()); } + + // accessors + wxKeyType GetKeyType() const { return m_keyType; } + const wxChar *GetString() const + { wxASSERT( m_keyType == wxKEY_STRING ); return m_key.string; } + long GetNumber() const + { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; } + + // comparison + // Note: implementation moved to list.cpp to prevent BC++ inline + // expansion warning. + bool operator==(wxListKeyValue value) const ; + + // dtor + ~wxListKey() + { + if ( m_keyType == wxKEY_STRING ) + free(m_key.string); + } + +private: + wxKeyType m_keyType; + wxListKeyValue m_key; +}; + +// ----------------------------------------------------------------------------- +// wxNodeBase class is a (base for) node in a double linked list +// ----------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_BASE(wxListKey) wxDefaultListKey; + +class WXDLLIMPEXP_FWD_BASE wxListBase; + +class WXDLLIMPEXP_BASE wxNodeBase +{ +friend class wxListBase; +public: + // ctor + wxNodeBase(wxListBase *list = (wxListBase *)NULL, + wxNodeBase *previous = (wxNodeBase *)NULL, + wxNodeBase *next = (wxNodeBase *)NULL, + void *data = NULL, + const wxListKey& key = wxDefaultListKey); + + virtual ~wxNodeBase(); + + // FIXME no check is done that the list is really keyed on strings + const wxChar *GetKeyString() const { return m_key.string; } + long GetKeyInteger() const { return m_key.integer; } + + // Necessary for some existing code + void SetKeyString(wxChar* s) { m_key.string = s; } + void SetKeyInteger(long i) { m_key.integer = i; } + +#ifdef wxLIST_COMPATIBILITY + // compatibility methods, use Get* instead. + wxDEPRECATED( wxNode *Next() const ); + wxDEPRECATED( wxNode *Previous() const ); + wxDEPRECATED( wxObject *Data() const ); +#endif // wxLIST_COMPATIBILITY + +protected: + // all these are going to be "overloaded" in the derived classes + wxNodeBase *GetNext() const { return m_next; } + wxNodeBase *GetPrevious() const { return m_previous; } + + void *GetData() const { return m_data; } + void SetData(void *data) { m_data = data; } + + // get 0-based index of this node within the list or wxNOT_FOUND + int IndexOf() const; + + virtual void DeleteData() { } +public: + // for wxList::iterator + void** GetDataPtr() const { return &(((wxNodeBase*)this)->m_data); } +private: + // optional key stuff + wxListKeyValue m_key; + + void *m_data; // user data + wxNodeBase *m_next, // next and previous nodes in the list + *m_previous; + + wxListBase *m_list; // list we belong to + + DECLARE_NO_COPY_CLASS(wxNodeBase) +}; + +// ----------------------------------------------------------------------------- +// a double-linked list class +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxList; + +class WXDLLIMPEXP_BASE wxListBase : public wxObject +{ +friend class WXDLLIMPEXP_FWD_BASE wxNodeBase; // should be able to call DetachNode() +friend class wxHashTableBase; // should be able to call untyped Find() + +public: + // default ctor & dtor + wxListBase(wxKeyType keyType = wxKEY_NONE) + { Init(keyType); } + virtual ~wxListBase(); + + // accessors + // count of items in the list + size_t GetCount() const { return m_count; } + + // return true if this list is empty + bool IsEmpty() const { return m_count == 0; } + + // operations + + // delete all nodes + void Clear(); + + // instruct it to destroy user data when deleting nodes + void DeleteContents(bool destroy) { m_destroy = destroy; } + + // query if to delete + bool GetDeleteContents() const + { return m_destroy; } + + // get the keytype + wxKeyType GetKeyType() const + { return m_keyType; } + + // set the keytype (required by the serial code) + void SetKeyType(wxKeyType keyType) + { wxASSERT( m_count==0 ); m_keyType = keyType; } + +#ifdef wxLIST_COMPATIBILITY + // compatibility methods from old wxList + wxDEPRECATED( int Number() const ); // use GetCount instead. + wxDEPRECATED( wxNode *First() const ); // use GetFirst + wxDEPRECATED( wxNode *Last() const ); // use GetLast + wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item + + // kludge for typesafe list migration in core classes. + wxDEPRECATED( operator wxList&() const ); +#endif // wxLIST_COMPATIBILITY + +protected: + + // all methods here are "overloaded" in derived classes to provide compile + // time type checking + + // create a node for the list of this type + virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, + void *data, + const wxListKey& key = wxDefaultListKey) = 0; + +// Can't access these from derived classes otherwise (bug in Salford C++?) +#ifdef __SALFORDC__ +public: +#endif + + // ctors + // from an array + wxListBase(size_t count, void *elements[]); + // from a sequence of objects + wxListBase(void *object, ... /* terminate with NULL */); + +protected: + void Assign(const wxListBase& list) + { Clear(); DoCopy(list); } + + // get list head/tail + wxNodeBase *GetFirst() const { return m_nodeFirst; } + wxNodeBase *GetLast() const { return m_nodeLast; } + + // by (0-based) index + wxNodeBase *Item(size_t index) const; + + // get the list item's data + void *operator[](size_t n) const + { + wxNodeBase *node = Item(n); + + return node ? node->GetData() : (wxNodeBase *)NULL; + } + + // operations + // append to end of list + wxNodeBase *Prepend(void *object) + { return (wxNodeBase *)wxListBase::Insert(object); } + // append to beginning of list + wxNodeBase *Append(void *object); + // insert a new item at the beginning of the list + wxNodeBase *Insert(void *object) { return Insert( (wxNodeBase*)NULL, object); } + // insert a new item at the given position + wxNodeBase *Insert(size_t pos, void *object) + { return pos == GetCount() ? Append(object) + : Insert(Item(pos), object); } + // insert before given node or at front of list if prev == NULL + wxNodeBase *Insert(wxNodeBase *prev, void *object); + + // keyed append + wxNodeBase *Append(long key, void *object); + wxNodeBase *Append(const wxChar *key, void *object); + + // removes node from the list but doesn't delete it (returns pointer + // to the node or NULL if it wasn't found in the list) + wxNodeBase *DetachNode(wxNodeBase *node); + // delete element from list, returns false if node not found + bool DeleteNode(wxNodeBase *node); + // finds object pointer and deletes node (and object if DeleteContents + // is on), returns false if object not found + bool DeleteObject(void *object); + + // search (all return NULL if item not found) + // by data + wxNodeBase *Find(const void *object) const; + + // by key + wxNodeBase *Find(const wxListKey& key) const; + + // get 0-based index of object or wxNOT_FOUND + int IndexOf( void *object ) const; + + // this function allows the sorting of arbitrary lists by giving + // a function to compare two list elements. The list is sorted in place. + void Sort(const wxSortCompareFunction compfunc); + + // functions for iterating over the list + void *FirstThat(wxListIterateFunction func); + void ForEach(wxListIterateFunction func); + void *LastThat(wxListIterateFunction func); + + // for STL interface, "last" points to one after the last node + // of the controlled sequence (NULL for the end of the list) + void Reverse(); + void DeleteNodes(wxNodeBase* first, wxNodeBase* last); +private: + + // common part of all ctors + void Init(wxKeyType keyType = wxKEY_NONE); + + // helpers + // common part of copy ctor and assignment operator + void DoCopy(const wxListBase& list); + // common part of all Append()s + wxNodeBase *AppendCommon(wxNodeBase *node); + // free node's data and node itself + void DoDeleteNode(wxNodeBase *node); + + size_t m_count; // number of elements in the list + bool m_destroy; // destroy user data when deleting list items? + wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list + *m_nodeLast; + + wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE) +}; + +// ----------------------------------------------------------------------------- +// macros for definition of "template" list type +// ----------------------------------------------------------------------------- + +// and now some heavy magic... + +// declare a list type named 'name' and containing elements of type 'T *' +// (as a by product of macro expansion you also get wx##name##Node +// wxNode-derived type) +// +// implementation details: +// 1. We define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type +// for the list of given type - this allows us to pass only the list name +// to WX_DEFINE_LIST() even if it needs both the name and the type +// +// 2. We redefine all non-type-safe wxList functions with type-safe versions +// which don't take any space (everything is inline), but bring compile +// time error checking. +// +// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of +// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most +// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes +// interesting capability to store polymorphic objects in the list and is +// particularly useful with, for example, "wxWindow *" list where the +// wxWindowBase pointers are put into the list, but wxWindow pointers are +// retrieved from it. +// +// 4. final hack is that WX_DECLARE_LIST_3 is defined in terms of +// WX_DECLARE_LIST_4 to allow defining classes without operator->() as +// it results in compiler warnings when this operator doesn't make sense +// (i.e. stored elements are not pointers) + +// common part of WX_DECLARE_LIST_3 and WX_DECLARE_LIST_PTR_3 +#define WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, ptrop) \ + typedef int (*wxSortFuncFor_##name)(const T **, const T **); \ + \ + classexp nodetype : public wxNodeBase \ + { \ + public: \ + nodetype(wxListBase *list = (wxListBase *)NULL, \ + nodetype *previous = (nodetype *)NULL, \ + nodetype *next = (nodetype *)NULL, \ + T *data = (T *)NULL, \ + const wxListKey& key = wxDefaultListKey) \ + : wxNodeBase(list, previous, next, data, key) { } \ + \ + nodetype *GetNext() const \ + { return (nodetype *)wxNodeBase::GetNext(); } \ + nodetype *GetPrevious() const \ + { return (nodetype *)wxNodeBase::GetPrevious(); } \ + \ + T *GetData() const \ + { return (T *)wxNodeBase::GetData(); } \ + void SetData(T *data) \ + { wxNodeBase::SetData(data); } \ + \ + protected: \ + virtual void DeleteData(); \ + \ + DECLARE_NO_COPY_CLASS(nodetype) \ + }; \ + \ + classexp name : public wxListBase \ + { \ + public: \ + typedef nodetype Node; \ + classexp compatibility_iterator \ + { \ + public: \ + compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ + \ + Node *operator->() const { return m_ptr; } \ + operator Node *() const { return m_ptr; } \ + \ + private: \ + Node *m_ptr; \ + }; \ + \ + name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \ + { } \ + name(const name& list) : wxListBase(list.GetKeyType()) \ + { Assign(list); } \ + name(size_t count, T *elements[]) \ + : wxListBase(count, (void **)elements) { } \ + \ + name& operator=(const name& list) \ + { Assign(list); return *this; } \ + \ + nodetype *GetFirst() const \ + { return (nodetype *)wxListBase::GetFirst(); } \ + nodetype *GetLast() const \ + { return (nodetype *)wxListBase::GetLast(); } \ + \ + nodetype *Item(size_t index) const \ + { return (nodetype *)wxListBase::Item(index); } \ + \ + T *operator[](size_t index) const \ + { \ + nodetype *node = Item(index); \ + return node ? (T*)(node->GetData()) : (T*)NULL; \ + } \ + \ + nodetype *Append(Tbase *object) \ + { return (nodetype *)wxListBase::Append(object); } \ + nodetype *Insert(Tbase *object) \ + { return (nodetype *)Insert((nodetype*)NULL, object); } \ + nodetype *Insert(size_t pos, Tbase *object) \ + { return (nodetype *)wxListBase::Insert(pos, object); } \ + nodetype *Insert(nodetype *prev, Tbase *object) \ + { return (nodetype *)wxListBase::Insert(prev, object); } \ + \ + nodetype *Append(long key, void *object) \ + { return (nodetype *)wxListBase::Append(key, object); } \ + nodetype *Append(const wxChar *key, void *object) \ + { return (nodetype *)wxListBase::Append(key, object); } \ + \ + nodetype *DetachNode(nodetype *node) \ + { return (nodetype *)wxListBase::DetachNode(node); } \ + bool DeleteNode(nodetype *node) \ + { return wxListBase::DeleteNode(node); } \ + bool DeleteObject(Tbase *object) \ + { return wxListBase::DeleteObject(object); } \ + void Erase(nodetype *it) \ + { DeleteNode(it); } \ + \ + nodetype *Find(const Tbase *object) const \ + { return (nodetype *)wxListBase::Find(object); } \ + \ + virtual nodetype *Find(const wxListKey& key) const \ + { return (nodetype *)wxListBase::Find(key); } \ + \ + int IndexOf(Tbase *object) const \ + { return wxListBase::IndexOf(object); } \ + \ + void Sort(wxSortCompareFunction func) \ + { wxListBase::Sort(func); } \ + void Sort(wxSortFuncFor_##name func) \ + { Sort((wxSortCompareFunction)func); } \ + \ + protected: \ + virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \ + void *data, \ + const wxListKey& key = wxDefaultListKey) \ + { \ + return new nodetype(this, \ + (nodetype *)prev, (nodetype *)next, \ + (T *)data, key); \ + } \ + /* STL interface */ \ + public: \ + typedef size_t size_type; \ + typedef int difference_type; \ + typedef T* value_type; \ + typedef Tbase* base_value_type; \ + typedef value_type& reference; \ + typedef const value_type& const_reference; \ + typedef base_value_type& base_reference; \ + typedef const base_value_type& const_base_reference; \ + \ + classexp iterator \ + { \ + typedef name list; \ + public: \ + typedef nodetype Node; \ + typedef iterator itor; \ + typedef T* value_type; \ + typedef value_type* ptr_type; \ + typedef value_type& reference; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef reference reference_type; \ + typedef ptr_type pointer_type; \ + \ + iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\ + iterator() : m_node(NULL), m_init(NULL) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() { m_node = m_node->GetNext(); return *this; }\ + const itor operator++(int) \ + { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ + itor& operator--() \ + { \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return *this; \ + } \ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + classexp const_iterator \ + { \ + typedef name list; \ + public: \ + typedef nodetype Node; \ + typedef T* value_type; \ + typedef const value_type& const_reference; \ + typedef const_iterator itor; \ + typedef value_type* ptr_type; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef const_reference reference_type; \ + typedef const ptr_type pointer_type; \ + \ + const_iterator(Node* node, Node* init) \ + : m_node(node), m_init(init) { } \ + const_iterator() : m_node(NULL), m_init(NULL) { } \ + const_iterator(const iterator& it) \ + : m_node(it.m_node), m_init(it.m_init) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() { m_node = m_node->GetNext(); return *this; }\ + const itor operator++(int) \ + { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\ + itor& operator--() \ + { \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return *this; \ + } \ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + classexp reverse_iterator \ + { \ + typedef name list; \ + public: \ + typedef nodetype Node; \ + typedef T* value_type; \ + typedef reverse_iterator itor; \ + typedef value_type* ptr_type; \ + typedef value_type& reference; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef reference reference_type; \ + typedef ptr_type pointer_type; \ + \ + reverse_iterator(Node* node, Node* init) \ + : m_node(node), m_init(init) { } \ + reverse_iterator() : m_node(NULL), m_init(NULL) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() \ + { m_node = m_node->GetPrevious(); return *this; } \ + const itor operator++(int) \ + { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ + itor& operator--() \ + { m_node = m_node ? m_node->GetNext() : m_init; return *this; } \ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetNext() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + classexp const_reverse_iterator \ + { \ + typedef name list; \ + public: \ + typedef nodetype Node; \ + typedef T* value_type; \ + typedef const_reverse_iterator itor; \ + typedef value_type* ptr_type; \ + typedef const value_type& const_reference; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef const_reference reference_type; \ + typedef const ptr_type pointer_type; \ + \ + const_reverse_iterator(Node* node, Node* init) \ + : m_node(node), m_init(init) { } \ + const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \ + const_reverse_iterator(const reverse_iterator& it) \ + : m_node(it.m_node), m_init(it.m_init) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() \ + { m_node = m_node->GetPrevious(); return *this; } \ + const itor operator++(int) \ + { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ + itor& operator--() \ + { m_node = m_node ? m_node->GetNext() : m_init; return *this;}\ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetNext() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + \ + wxEXPLICIT name(size_type n, const_reference v = value_type()) \ + { assign(n, v); } \ + name(const const_iterator& first, const const_iterator& last) \ + { assign(first, last); } \ + iterator begin() { return iterator(GetFirst(), GetLast()); } \ + const_iterator begin() const \ + { return const_iterator(GetFirst(), GetLast()); } \ + iterator end() { return iterator(NULL, GetLast()); } \ + const_iterator end() const { return const_iterator(NULL, GetLast()); }\ + reverse_iterator rbegin() \ + { return reverse_iterator(GetLast(), GetFirst()); } \ + const_reverse_iterator rbegin() const \ + { return const_reverse_iterator(GetLast(), GetFirst()); } \ + reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\ + const_reverse_iterator rend() const \ + { return const_reverse_iterator(NULL, GetFirst()); } \ + void resize(size_type n, value_type v = value_type()) \ + { \ + while (n < size()) \ + pop_back(); \ + while (n > size()) \ + push_back(v); \ + } \ + size_type size() const { return GetCount(); } \ + size_type max_size() const { return INT_MAX; } \ + bool empty() const { return IsEmpty(); } \ + reference front() { return *begin(); } \ + const_reference front() const { return *begin(); } \ + reference back() { iterator tmp = end(); return *--tmp; } \ + const_reference back() const { const_iterator tmp = end(); return *--tmp; }\ + void push_front(const_reference v = value_type()) \ + { Insert(GetFirst(), (const_base_reference)v); } \ + void pop_front() { DeleteNode(GetFirst()); } \ + void push_back(const_reference v = value_type()) \ + { Append((const_base_reference)v); } \ + void pop_back() { DeleteNode(GetLast()); } \ + void assign(const_iterator first, const const_iterator& last) \ + { \ + clear(); \ + for(; first != last; ++first) \ + Append((const_base_reference)*first); \ + } \ + void assign(size_type n, const_reference v = value_type()) \ + { \ + clear(); \ + for(size_type i = 0; i < n; ++i) \ + Append((const_base_reference)v); \ + } \ + iterator insert(const iterator& it, const_reference v = value_type())\ + { \ + Insert(it.m_node, (const_base_reference)v); \ + return iterator(it.m_node->GetPrevious(), GetLast()); \ + } \ + void insert(const iterator& it, size_type n, const_reference v = value_type())\ + { \ + for(size_type i = 0; i < n; ++i) \ + Insert(it.m_node, (const_base_reference)v); \ + } \ + void insert(const iterator& it, const_iterator first, const const_iterator& last)\ + { \ + for(; first != last; ++first) \ + Insert(it.m_node, (const_base_reference)*first); \ + } \ + iterator erase(const iterator& it) \ + { \ + iterator next = iterator(it.m_node->GetNext(), GetLast()); \ + DeleteNode(it.m_node); return next; \ + } \ + iterator erase(const iterator& first, const iterator& last) \ + { \ + iterator next = last; ++next; \ + DeleteNodes(first.m_node, last.m_node); \ + return next; \ + } \ + void clear() { Clear(); } \ + void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\ + { insert(it, first, last); l.erase(first, last); } \ + void splice(const iterator& it, name& l) \ + { splice(it, l, l.begin(), l.end() ); } \ + void splice(const iterator& it, name& l, const iterator& first) \ + { \ + iterator tmp = first; ++tmp; \ + if(it == first || it == tmp) return; \ + insert(it, *first); \ + l.erase(first); \ + } \ + void remove(const_reference v) \ + { DeleteObject((const_base_reference)v); } \ + void reverse() \ + { Reverse(); } \ + /* void swap(name& l) \ + { \ + { size_t t = m_count; m_count = l.m_count; l.m_count = t; } \ + { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }\ + { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }\ + { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }\ + { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }\ + } */ \ + } + +#define WX_LIST_PTROP \ + pointer_type operator->() const \ + { return (pointer_type)m_node->GetDataPtr(); } +#define WX_LIST_PTROP_NONE + +#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \ + WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP_NONE) +#define WX_DECLARE_LIST_PTR_3(T, Tbase, name, nodetype, classexp) \ + WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP) + +#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \ + WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp) +#define WX_DECLARE_LIST_PTR_2(elementtype, listname, nodename, classexp) \ + WX_DECLARE_LIST_PTR_3(elementtype, elementtype, listname, nodename, classexp) + +#define WX_DECLARE_LIST(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class) +#define WX_DECLARE_LIST_PTR(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class) + +#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl) + +#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT) + +#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT) + +#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class usergoo) +#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class usergoo) + +// this macro must be inserted in your program after +// #include "wx/listimpl.cpp" +#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" + +#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) +#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) + +#endif // !wxUSE_STL + +// ============================================================================ +// now we can define classes 100% compatible with the old ones +// ============================================================================ + +// ---------------------------------------------------------------------------- +// commonly used list classes +// ---------------------------------------------------------------------------- + +#if defined(wxLIST_COMPATIBILITY) + +// inline compatibility functions + +#if !wxUSE_STL + +// ---------------------------------------------------------------------------- +// wxNodeBase deprecated methods +// ---------------------------------------------------------------------------- + +inline wxNode *wxNodeBase::Next() const { return (wxNode *)GetNext(); } +inline wxNode *wxNodeBase::Previous() const { return (wxNode *)GetPrevious(); } +inline wxObject *wxNodeBase::Data() const { return (wxObject *)GetData(); } + +// ---------------------------------------------------------------------------- +// wxListBase deprecated methods +// ---------------------------------------------------------------------------- + +inline int wxListBase::Number() const { return (int)GetCount(); } +inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); } +inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); } +inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); } +inline wxListBase::operator wxList&() const { return *(wxList*)this; } + +#endif + +// define this to make a lot of noise about use of the old wxList classes. +//#define wxWARN_COMPAT_LIST_USE + +// ---------------------------------------------------------------------------- +// wxList compatibility class: in fact, it's a list of wxObjects +// ---------------------------------------------------------------------------- + +WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, + class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxList : public wxObjectList +{ +public: +#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STL + wxList() { }; + wxDEPRECATED( wxList(int key_type) ); +#elif !wxUSE_STL + wxList(int key_type = wxKEY_NONE); +#endif + + // this destructor is required for Darwin + ~wxList() { } + +#if !wxUSE_STL + wxList& operator=(const wxList& list) + { (void) wxListBase::operator=(list); return *this; } + + // compatibility methods + void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } +#endif + +#if wxUSE_STL +#else + wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); } +#endif + +private: +#if !wxUSE_STL + DECLARE_DYNAMIC_CLASS(wxList) +#endif +}; + +#if !wxUSE_STL + +// ----------------------------------------------------------------------------- +// wxStringList class for compatibility with the old code +// ----------------------------------------------------------------------------- +WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase +{ +public: + // ctors and such + // default +#ifdef wxWARN_COMPAT_LIST_USE + wxStringList(); + wxDEPRECATED( wxStringList(const wxChar *first ...) ); +#else + wxStringList(); + wxStringList(const wxChar *first ...); +#endif + + // copying the string list: the strings are copied, too (extremely + // inefficient!) + wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); } + wxStringList& operator=(const wxStringList& other) + { Clear(); DoCopy(other); return *this; } + + // operations + // makes a copy of the string + wxNode *Add(const wxChar *s); + + // Append to beginning of list + wxNode *Prepend(const wxChar *s); + + bool Delete(const wxChar *s); + + wxChar **ListToArray(bool new_copies = false) const; + bool Member(const wxChar *s) const; + + // alphabetic sort + void Sort(); + +private: + void DoCopy(const wxStringList&); // common part of copy ctor and operator= + + DECLARE_DYNAMIC_CLASS(wxStringList) +}; + +#else // if wxUSE_STL + +WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase +{ +public: + compatibility_iterator Append(wxChar* s) + { wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); } + compatibility_iterator Insert(wxChar* s) + { wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); } + compatibility_iterator Insert(size_t pos, wxChar* s) + { + wxString tmp = s; + delete[] s; + return wxStringListBase::Insert(pos, tmp); + } + compatibility_iterator Add(const wxChar* s) + { push_back(s); return GetLast(); } + compatibility_iterator Prepend(const wxChar* s) + { push_front(s); return GetFirst(); } +}; + +#endif // wxUSE_STL + +#endif // wxLIST_COMPATIBILITY + +// delete all list elements +// +// NB: the class declaration of the list elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_LIST(type, list) \ + { \ + type::iterator it, en; \ + for( it = (list).begin(), en = (list).end(); it != en; ++it ) \ + delete *it; \ + (list).clear(); \ + } + +#endif // _WX_LISTH__ diff --git a/Externals/wxWidgets/include/wx/listbase.h b/Externals/wxWidgets/include/wx/listbase.h index 1528647861..4685ebbbee 100644 --- a/Externals/wxWidgets/include/wx/listbase.h +++ b/Externals/wxWidgets/include/wx/listbase.h @@ -1,491 +1,491 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listbase.h -// Purpose: wxListCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.12.99 -// RCS-ID: $Id: listbase.h 46313 2007-06-03 22:38:28Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBASE_H_BASE_ -#define _WX_LISTBASE_H_BASE_ - -#include "wx/colour.h" -#include "wx/font.h" -#include "wx/gdicmn.h" -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// type of compare function for wxListCtrl sort operation -typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); - -// ---------------------------------------------------------------------------- -// wxListCtrl constants -// ---------------------------------------------------------------------------- - -// style flags -#define wxLC_VRULES 0x0001 -#define wxLC_HRULES 0x0002 - -#define wxLC_ICON 0x0004 -#define wxLC_SMALL_ICON 0x0008 -#define wxLC_LIST 0x0010 -#define wxLC_REPORT 0x0020 - -#define wxLC_ALIGN_TOP 0x0040 -#define wxLC_ALIGN_LEFT 0x0080 -#define wxLC_AUTOARRANGE 0x0100 -#define wxLC_VIRTUAL 0x0200 -#define wxLC_EDIT_LABELS 0x0400 -#define wxLC_NO_HEADER 0x0800 -#define wxLC_NO_SORT_HEADER 0x1000 -#define wxLC_SINGLE_SEL 0x2000 -#define wxLC_SORT_ASCENDING 0x4000 -#define wxLC_SORT_DESCENDING 0x8000 - -#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT) -#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT) -#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING) - -// for compatibility only -#define wxLC_USER_TEXT wxLC_VIRTUAL - -// Omitted because -// (a) too much detail -// (b) not enough style flags -// (c) not implemented anyhow in the generic version -// -// #define wxLC_NO_SCROLL -// #define wxLC_NO_LABEL_WRAP -// #define wxLC_OWNERDRAW_FIXED -// #define wxLC_SHOW_SEL_ALWAYS - -// Mask flags to tell app/GUI what fields of wxListItem are valid -#define wxLIST_MASK_STATE 0x0001 -#define wxLIST_MASK_TEXT 0x0002 -#define wxLIST_MASK_IMAGE 0x0004 -#define wxLIST_MASK_DATA 0x0008 -#define wxLIST_SET_ITEM 0x0010 -#define wxLIST_MASK_WIDTH 0x0020 -#define wxLIST_MASK_FORMAT 0x0040 - -// State flags for indicating the state of an item -#define wxLIST_STATE_DONTCARE 0x0000 -#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only -#define wxLIST_STATE_FOCUSED 0x0002 -#define wxLIST_STATE_SELECTED 0x0004 -#define wxLIST_STATE_CUT 0x0008 // MSW only -#define wxLIST_STATE_DISABLED 0x0010 // OS2 only -#define wxLIST_STATE_FILTERED 0x0020 // OS2 only -#define wxLIST_STATE_INUSE 0x0040 // OS2 only -#define wxLIST_STATE_PICKED 0x0080 // OS2 only -#define wxLIST_STATE_SOURCE 0x0100 // OS2 only - -// Hit test flags, used in HitTest -#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. -#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. -#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. -#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. -#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. -#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. -#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. -#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. -#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. - -#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) - -// GetSubItemRect constants -#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l - -// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL) -enum -{ - wxLIST_NEXT_ABOVE, // Searches for an item above the specified item - wxLIST_NEXT_ALL, // Searches for subsequent item by index - wxLIST_NEXT_BELOW, // Searches for an item below the specified item - wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item - wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item -}; - -// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT) -enum -{ - wxLIST_ALIGN_DEFAULT, - wxLIST_ALIGN_LEFT, - wxLIST_ALIGN_TOP, - wxLIST_ALIGN_SNAP_TO_GRID -}; - -// Column format (MSW only except wxLIST_FORMAT_LEFT) -enum wxListColumnFormat -{ - wxLIST_FORMAT_LEFT, - wxLIST_FORMAT_RIGHT, - wxLIST_FORMAT_CENTRE, - wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE -}; - -// Autosize values for SetColumnWidth -enum -{ - wxLIST_AUTOSIZE = -1, - wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version -}; - -// Flag values for GetItemRect -enum -{ - wxLIST_RECT_BOUNDS, - wxLIST_RECT_ICON, - wxLIST_RECT_LABEL -}; - -// Flag values for FindItem (MSW only) -enum -{ - wxLIST_FIND_UP, - wxLIST_FIND_DOWN, - wxLIST_FIND_LEFT, - wxLIST_FIND_RIGHT -}; - -// ---------------------------------------------------------------------------- -// wxListItemAttr: a structure containing the visual attributes of an item -// ---------------------------------------------------------------------------- - -// TODO: this should be renamed to wxItemAttr or something general like this -// and used as base class for wxTextAttr which duplicates this class -// entirely currently -class WXDLLEXPORT wxListItemAttr -{ -public: - // ctors - wxListItemAttr() { } - wxListItemAttr(const wxColour& colText, - const wxColour& colBack, - const wxFont& font) - : m_colText(colText), m_colBack(colBack), m_font(font) - { - } - - // default copy ctor, assignment operator and dtor are ok - - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } - void SetFont(const wxFont& font) { m_font = font; } - - // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxFont& GetFont() const { return m_font; } - - - // this is almost like assignment operator except it doesn't overwrite the - // fields unset in the source attribute - void AssignFrom(const wxListItemAttr& source) - { - if ( source.HasTextColour() ) - SetTextColour(source.GetTextColour()); - if ( source.HasBackgroundColour() ) - SetBackgroundColour(source.GetBackgroundColour()); - if ( source.HasFont() ) - SetFont(source.GetFont()); - } - -private: - wxColour m_colText, - m_colBack; - wxFont m_font; -}; - -// ---------------------------------------------------------------------------- -// wxListItem: the item or column info, used to exchange data with wxListCtrl -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListItem : public wxObject -{ -public: - wxListItem() { Init(); m_attr = NULL; } - wxListItem(const wxListItem& item) - : wxObject(), - m_mask(item.m_mask), - m_itemId(item.m_itemId), - m_col(item.m_col), - m_state(item.m_state), - m_stateMask(item.m_stateMask), - m_text(item.m_text), - m_image(item.m_image), - m_data(item.m_data), - m_format(item.m_format), - m_width(item.m_width), - m_attr(NULL) - { - // copy list item attributes - if ( item.HasAttributes() ) - m_attr = new wxListItemAttr(*item.GetAttributes()); - } - virtual ~wxListItem() { delete m_attr; } - - // resetting - void Clear() { Init(); m_text.clear(); ClearAttributes(); } - void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } } - - // setters - void SetMask(long mask) - { m_mask = mask; } - void SetId(long id) - { m_itemId = id; } - void SetColumn(int col) - { m_col = col; } - void SetState(long state) - { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; } - void SetStateMask(long stateMask) - { m_stateMask = stateMask; } - void SetText(const wxString& text) - { m_mask |= wxLIST_MASK_TEXT; m_text = text; } - void SetImage(int image) - { m_mask |= wxLIST_MASK_IMAGE; m_image = image; } - void SetData(long data) - { m_mask |= wxLIST_MASK_DATA; m_data = data; } - void SetData(void *data) - { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); } - - void SetWidth(int width) - { m_mask |= wxLIST_MASK_WIDTH; m_width = width; } - void SetAlign(wxListColumnFormat align) - { m_mask |= wxLIST_MASK_FORMAT; m_format = align; } - - void SetTextColour(const wxColour& colText) - { Attributes().SetTextColour(colText); } - void SetBackgroundColour(const wxColour& colBack) - { Attributes().SetBackgroundColour(colBack); } - void SetFont(const wxFont& font) - { Attributes().SetFont(font); } - - // accessors - long GetMask() const { return m_mask; } - long GetId() const { return m_itemId; } - int GetColumn() const { return m_col; } - long GetState() const { return m_state & m_stateMask; } - const wxString& GetText() const { return m_text; } - int GetImage() const { return m_image; } - wxUIntPtr GetData() const { return m_data; } - - int GetWidth() const { return m_width; } - wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; } - - wxListItemAttr *GetAttributes() const { return m_attr; } - bool HasAttributes() const { return m_attr != NULL; } - - wxColour GetTextColour() const - { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; } - wxColour GetBackgroundColour() const - { return HasAttributes() ? m_attr->GetBackgroundColour() - : wxNullColour; } - wxFont GetFont() const - { return HasAttributes() ? m_attr->GetFont() : wxNullFont; } - - // this conversion is necessary to make old code using GetItem() to - // compile - operator long() const { return m_itemId; } - - // these members are public for compatibility - - long m_mask; // Indicates what fields are valid - long m_itemId; // The zero-based item position - int m_col; // Zero-based column, if in report mode - long m_state; // The state of the item - long m_stateMask;// Which flags of m_state are valid (uses same flags) - wxString m_text; // The label/header text - int m_image; // The zero-based index into an image list - wxUIntPtr m_data; // App-defined data - - // For columns only - int m_format; // left, right, centre - int m_width; // width of column - -#ifdef __WXPM__ - int m_miniImage; // handle to the mini image for OS/2 -#endif - -protected: - // creates m_attr if we don't have it yet - wxListItemAttr& Attributes() - { - if ( !m_attr ) - m_attr = new wxListItemAttr; - - return *m_attr; - } - - void Init() - { - m_mask = 0; - m_itemId = 0; - m_col = 0; - m_state = 0; - m_stateMask = 0; - m_image = -1; - m_data = 0; - - m_format = wxLIST_FORMAT_CENTRE; - m_width = 0; - } - - wxListItemAttr *m_attr; // optional pointer to the items style - -private: - // VZ: this is strange, we have a copy ctor but not operator=(), why? - wxListItem& operator=(const wxListItem& item); - - DECLARE_DYNAMIC_CLASS(wxListItem) -}; - -// ---------------------------------------------------------------------------- -// wxListEvent - the event class for the wxListCtrl notifications -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListEvent : public wxNotifyEvent -{ -public: - wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid) - , m_code(0) - , m_oldItemIndex(0) - , m_itemIndex(0) - , m_col(0) - , m_pointDrag() - , m_item() - , m_editCancelled(false) - { } - - wxListEvent(const wxListEvent& event) - : wxNotifyEvent(event) - , m_code(event.m_code) - , m_oldItemIndex(event.m_oldItemIndex) - , m_itemIndex(event.m_itemIndex) - , m_col(event.m_col) - , m_pointDrag(event.m_pointDrag) - , m_item(event.m_item) - , m_editCancelled(event.m_editCancelled) - { } - - int GetKeyCode() const { return m_code; } - long GetIndex() const { return m_itemIndex; } - int GetColumn() const { return m_col; } - wxPoint GetPoint() const { return m_pointDrag; } - const wxString& GetLabel() const { return m_item.m_text; } - const wxString& GetText() const { return m_item.m_text; } - int GetImage() const { return m_item.m_image; } - long GetData() const { return wx_static_cast(long, m_item.m_data); } - long GetMask() const { return m_item.m_mask; } - const wxListItem& GetItem() const { return m_item; } - - // for wxEVT_COMMAND_LIST_CACHE_HINT only - long GetCacheFrom() const { return m_oldItemIndex; } - long GetCacheTo() const { return m_itemIndex; } - - // was label editing canceled? (for wxEVT_COMMAND_LIST_END_LABEL_EDIT only) - bool IsEditCancelled() const { return m_editCancelled; } - void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } - - virtual wxEvent *Clone() const { return new wxListEvent(*this); } - -//protected: -- not for backwards compatibility - int m_code; - long m_oldItemIndex; // only for wxEVT_COMMAND_LIST_CACHE_HINT - long m_itemIndex; - int m_col; - wxPoint m_pointDrag; - - wxListItem m_item; - -protected: - bool m_editCancelled; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent) -}; - -// ---------------------------------------------------------------------------- -// wxListCtrl event macros -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG, 700) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG, 701) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 702) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM, 704) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705) -#if WXWIN_COMPATIBILITY_2_4 - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO, 706) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707) -#endif - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED, 708) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM, 711) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK, 712) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 713) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 714) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 715) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT, 716) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 717) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 718) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING, 719) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG, 720) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED, 721) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); - -#define wxListEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListEventFunction, &func) - -#define wx__DECLARE_LISTEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LIST_ ## evt, id, wxListEventHandler(fn)) - -#define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn) -#define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn) -#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn) -#define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn) -#define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn) -#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn) -#define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn) -#define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn) - -#define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn) -#define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn) -#define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn) -#define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn) -#define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn) - -#define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn) -#define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn) -#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn) -#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn) -#define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn) -#define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn) - -#define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn) - - -#if WXWIN_COMPATIBILITY_2_4 -#define EVT_LIST_GET_INFO(id, fn) wx__DECLARE_LISTEVT(GET_INFO, id, fn) -#define EVT_LIST_SET_INFO(id, fn) wx__DECLARE_LISTEVT(SET_INFO, id, fn) -#endif - -#endif - // _WX_LISTCTRL_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listbase.h +// Purpose: wxListCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.12.99 +// RCS-ID: $Id: listbase.h 46313 2007-06-03 22:38:28Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBASE_H_BASE_ +#define _WX_LISTBASE_H_BASE_ + +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/gdicmn.h" +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// type of compare function for wxListCtrl sort operation +typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); + +// ---------------------------------------------------------------------------- +// wxListCtrl constants +// ---------------------------------------------------------------------------- + +// style flags +#define wxLC_VRULES 0x0001 +#define wxLC_HRULES 0x0002 + +#define wxLC_ICON 0x0004 +#define wxLC_SMALL_ICON 0x0008 +#define wxLC_LIST 0x0010 +#define wxLC_REPORT 0x0020 + +#define wxLC_ALIGN_TOP 0x0040 +#define wxLC_ALIGN_LEFT 0x0080 +#define wxLC_AUTOARRANGE 0x0100 +#define wxLC_VIRTUAL 0x0200 +#define wxLC_EDIT_LABELS 0x0400 +#define wxLC_NO_HEADER 0x0800 +#define wxLC_NO_SORT_HEADER 0x1000 +#define wxLC_SINGLE_SEL 0x2000 +#define wxLC_SORT_ASCENDING 0x4000 +#define wxLC_SORT_DESCENDING 0x8000 + +#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT) +#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT) +#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING) + +// for compatibility only +#define wxLC_USER_TEXT wxLC_VIRTUAL + +// Omitted because +// (a) too much detail +// (b) not enough style flags +// (c) not implemented anyhow in the generic version +// +// #define wxLC_NO_SCROLL +// #define wxLC_NO_LABEL_WRAP +// #define wxLC_OWNERDRAW_FIXED +// #define wxLC_SHOW_SEL_ALWAYS + +// Mask flags to tell app/GUI what fields of wxListItem are valid +#define wxLIST_MASK_STATE 0x0001 +#define wxLIST_MASK_TEXT 0x0002 +#define wxLIST_MASK_IMAGE 0x0004 +#define wxLIST_MASK_DATA 0x0008 +#define wxLIST_SET_ITEM 0x0010 +#define wxLIST_MASK_WIDTH 0x0020 +#define wxLIST_MASK_FORMAT 0x0040 + +// State flags for indicating the state of an item +#define wxLIST_STATE_DONTCARE 0x0000 +#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only +#define wxLIST_STATE_FOCUSED 0x0002 +#define wxLIST_STATE_SELECTED 0x0004 +#define wxLIST_STATE_CUT 0x0008 // MSW only +#define wxLIST_STATE_DISABLED 0x0010 // OS2 only +#define wxLIST_STATE_FILTERED 0x0020 // OS2 only +#define wxLIST_STATE_INUSE 0x0040 // OS2 only +#define wxLIST_STATE_PICKED 0x0080 // OS2 only +#define wxLIST_STATE_SOURCE 0x0100 // OS2 only + +// Hit test flags, used in HitTest +#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. +#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. +#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. +#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. +#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. +#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. +#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. +#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. +#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. + +#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) + +// GetSubItemRect constants +#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l + +// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL) +enum +{ + wxLIST_NEXT_ABOVE, // Searches for an item above the specified item + wxLIST_NEXT_ALL, // Searches for subsequent item by index + wxLIST_NEXT_BELOW, // Searches for an item below the specified item + wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item + wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item +}; + +// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT) +enum +{ + wxLIST_ALIGN_DEFAULT, + wxLIST_ALIGN_LEFT, + wxLIST_ALIGN_TOP, + wxLIST_ALIGN_SNAP_TO_GRID +}; + +// Column format (MSW only except wxLIST_FORMAT_LEFT) +enum wxListColumnFormat +{ + wxLIST_FORMAT_LEFT, + wxLIST_FORMAT_RIGHT, + wxLIST_FORMAT_CENTRE, + wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE +}; + +// Autosize values for SetColumnWidth +enum +{ + wxLIST_AUTOSIZE = -1, + wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version +}; + +// Flag values for GetItemRect +enum +{ + wxLIST_RECT_BOUNDS, + wxLIST_RECT_ICON, + wxLIST_RECT_LABEL +}; + +// Flag values for FindItem (MSW only) +enum +{ + wxLIST_FIND_UP, + wxLIST_FIND_DOWN, + wxLIST_FIND_LEFT, + wxLIST_FIND_RIGHT +}; + +// ---------------------------------------------------------------------------- +// wxListItemAttr: a structure containing the visual attributes of an item +// ---------------------------------------------------------------------------- + +// TODO: this should be renamed to wxItemAttr or something general like this +// and used as base class for wxTextAttr which duplicates this class +// entirely currently +class WXDLLEXPORT wxListItemAttr +{ +public: + // ctors + wxListItemAttr() { } + wxListItemAttr(const wxColour& colText, + const wxColour& colBack, + const wxFont& font) + : m_colText(colText), m_colBack(colBack), m_font(font) + { + } + + // default copy ctor, assignment operator and dtor are ok + + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } + void SetFont(const wxFont& font) { m_font = font; } + + // accessors + bool HasTextColour() const { return m_colText.Ok(); } + bool HasBackgroundColour() const { return m_colBack.Ok(); } + bool HasFont() const { return m_font.Ok(); } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + const wxFont& GetFont() const { return m_font; } + + + // this is almost like assignment operator except it doesn't overwrite the + // fields unset in the source attribute + void AssignFrom(const wxListItemAttr& source) + { + if ( source.HasTextColour() ) + SetTextColour(source.GetTextColour()); + if ( source.HasBackgroundColour() ) + SetBackgroundColour(source.GetBackgroundColour()); + if ( source.HasFont() ) + SetFont(source.GetFont()); + } + +private: + wxColour m_colText, + m_colBack; + wxFont m_font; +}; + +// ---------------------------------------------------------------------------- +// wxListItem: the item or column info, used to exchange data with wxListCtrl +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListItem : public wxObject +{ +public: + wxListItem() { Init(); m_attr = NULL; } + wxListItem(const wxListItem& item) + : wxObject(), + m_mask(item.m_mask), + m_itemId(item.m_itemId), + m_col(item.m_col), + m_state(item.m_state), + m_stateMask(item.m_stateMask), + m_text(item.m_text), + m_image(item.m_image), + m_data(item.m_data), + m_format(item.m_format), + m_width(item.m_width), + m_attr(NULL) + { + // copy list item attributes + if ( item.HasAttributes() ) + m_attr = new wxListItemAttr(*item.GetAttributes()); + } + virtual ~wxListItem() { delete m_attr; } + + // resetting + void Clear() { Init(); m_text.clear(); ClearAttributes(); } + void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } } + + // setters + void SetMask(long mask) + { m_mask = mask; } + void SetId(long id) + { m_itemId = id; } + void SetColumn(int col) + { m_col = col; } + void SetState(long state) + { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; } + void SetStateMask(long stateMask) + { m_stateMask = stateMask; } + void SetText(const wxString& text) + { m_mask |= wxLIST_MASK_TEXT; m_text = text; } + void SetImage(int image) + { m_mask |= wxLIST_MASK_IMAGE; m_image = image; } + void SetData(long data) + { m_mask |= wxLIST_MASK_DATA; m_data = data; } + void SetData(void *data) + { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); } + + void SetWidth(int width) + { m_mask |= wxLIST_MASK_WIDTH; m_width = width; } + void SetAlign(wxListColumnFormat align) + { m_mask |= wxLIST_MASK_FORMAT; m_format = align; } + + void SetTextColour(const wxColour& colText) + { Attributes().SetTextColour(colText); } + void SetBackgroundColour(const wxColour& colBack) + { Attributes().SetBackgroundColour(colBack); } + void SetFont(const wxFont& font) + { Attributes().SetFont(font); } + + // accessors + long GetMask() const { return m_mask; } + long GetId() const { return m_itemId; } + int GetColumn() const { return m_col; } + long GetState() const { return m_state & m_stateMask; } + const wxString& GetText() const { return m_text; } + int GetImage() const { return m_image; } + wxUIntPtr GetData() const { return m_data; } + + int GetWidth() const { return m_width; } + wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; } + + wxListItemAttr *GetAttributes() const { return m_attr; } + bool HasAttributes() const { return m_attr != NULL; } + + wxColour GetTextColour() const + { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; } + wxColour GetBackgroundColour() const + { return HasAttributes() ? m_attr->GetBackgroundColour() + : wxNullColour; } + wxFont GetFont() const + { return HasAttributes() ? m_attr->GetFont() : wxNullFont; } + + // this conversion is necessary to make old code using GetItem() to + // compile + operator long() const { return m_itemId; } + + // these members are public for compatibility + + long m_mask; // Indicates what fields are valid + long m_itemId; // The zero-based item position + int m_col; // Zero-based column, if in report mode + long m_state; // The state of the item + long m_stateMask;// Which flags of m_state are valid (uses same flags) + wxString m_text; // The label/header text + int m_image; // The zero-based index into an image list + wxUIntPtr m_data; // App-defined data + + // For columns only + int m_format; // left, right, centre + int m_width; // width of column + +#ifdef __WXPM__ + int m_miniImage; // handle to the mini image for OS/2 +#endif + +protected: + // creates m_attr if we don't have it yet + wxListItemAttr& Attributes() + { + if ( !m_attr ) + m_attr = new wxListItemAttr; + + return *m_attr; + } + + void Init() + { + m_mask = 0; + m_itemId = 0; + m_col = 0; + m_state = 0; + m_stateMask = 0; + m_image = -1; + m_data = 0; + + m_format = wxLIST_FORMAT_CENTRE; + m_width = 0; + } + + wxListItemAttr *m_attr; // optional pointer to the items style + +private: + // VZ: this is strange, we have a copy ctor but not operator=(), why? + wxListItem& operator=(const wxListItem& item); + + DECLARE_DYNAMIC_CLASS(wxListItem) +}; + +// ---------------------------------------------------------------------------- +// wxListEvent - the event class for the wxListCtrl notifications +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListEvent : public wxNotifyEvent +{ +public: + wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid) + , m_code(0) + , m_oldItemIndex(0) + , m_itemIndex(0) + , m_col(0) + , m_pointDrag() + , m_item() + , m_editCancelled(false) + { } + + wxListEvent(const wxListEvent& event) + : wxNotifyEvent(event) + , m_code(event.m_code) + , m_oldItemIndex(event.m_oldItemIndex) + , m_itemIndex(event.m_itemIndex) + , m_col(event.m_col) + , m_pointDrag(event.m_pointDrag) + , m_item(event.m_item) + , m_editCancelled(event.m_editCancelled) + { } + + int GetKeyCode() const { return m_code; } + long GetIndex() const { return m_itemIndex; } + int GetColumn() const { return m_col; } + wxPoint GetPoint() const { return m_pointDrag; } + const wxString& GetLabel() const { return m_item.m_text; } + const wxString& GetText() const { return m_item.m_text; } + int GetImage() const { return m_item.m_image; } + long GetData() const { return wx_static_cast(long, m_item.m_data); } + long GetMask() const { return m_item.m_mask; } + const wxListItem& GetItem() const { return m_item; } + + // for wxEVT_COMMAND_LIST_CACHE_HINT only + long GetCacheFrom() const { return m_oldItemIndex; } + long GetCacheTo() const { return m_itemIndex; } + + // was label editing canceled? (for wxEVT_COMMAND_LIST_END_LABEL_EDIT only) + bool IsEditCancelled() const { return m_editCancelled; } + void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } + + virtual wxEvent *Clone() const { return new wxListEvent(*this); } + +//protected: -- not for backwards compatibility + int m_code; + long m_oldItemIndex; // only for wxEVT_COMMAND_LIST_CACHE_HINT + long m_itemIndex; + int m_col; + wxPoint m_pointDrag; + + wxListItem m_item; + +protected: + bool m_editCancelled; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent) +}; + +// ---------------------------------------------------------------------------- +// wxListCtrl event macros +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG, 700) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG, 701) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 702) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM, 704) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705) +#if WXWIN_COMPATIBILITY_2_4 + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO, 706) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707) +#endif + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED, 708) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM, 711) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK, 712) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 713) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 714) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 715) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT, 716) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 717) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 718) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING, 719) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG, 720) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED, 721) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); + +#define wxListEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListEventFunction, &func) + +#define wx__DECLARE_LISTEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_LIST_ ## evt, id, wxListEventHandler(fn)) + +#define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn) +#define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn) +#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn) +#define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn) +#define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn) +#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn) +#define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn) +#define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn) + +#define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn) +#define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn) +#define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn) +#define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn) +#define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn) + +#define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn) +#define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn) +#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn) +#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn) +#define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn) +#define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn) + +#define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn) + + +#if WXWIN_COMPATIBILITY_2_4 +#define EVT_LIST_GET_INFO(id, fn) wx__DECLARE_LISTEVT(GET_INFO, id, fn) +#define EVT_LIST_SET_INFO(id, fn) wx__DECLARE_LISTEVT(SET_INFO, id, fn) +#endif + +#endif + // _WX_LISTCTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/listbook.h b/Externals/wxWidgets/include/wx/listbook.h index b14ee4cdbc..fe8484ee62 100644 --- a/Externals/wxWidgets/include/wx/listbook.h +++ b/Externals/wxWidgets/include/wx/listbook.h @@ -1,152 +1,152 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listbook.h -// Purpose: wxListbook: wxListCtrl and wxNotebook combination -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.03 -// RCS-ID: $Id: listbook.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBOOK_H_ -#define _WX_LISTBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_LISTBOOK - -#include "wx/bookctrl.h" - -class WXDLLIMPEXP_FWD_CORE wxListView; -class WXDLLIMPEXP_FWD_CORE wxListEvent; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING; - -// wxListbook flags -#define wxLB_DEFAULT wxBK_DEFAULT -#define wxLB_TOP wxBK_TOP -#define wxLB_BOTTOM wxBK_BOTTOM -#define wxLB_LEFT wxBK_LEFT -#define wxLB_RIGHT wxBK_RIGHT -#define wxLB_ALIGN_MASK wxBK_ALIGN_MASK - -// ---------------------------------------------------------------------------- -// wxListbook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListbook : public wxBookCtrlBase -{ -public: - wxListbook() - { - Init(); - } - - wxListbook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - - // overridden base class methods - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1); - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - virtual void SetImageList(wxImageList *imageList); - - virtual bool DeleteAllPages(); - - wxListView* GetListView() const { return (wxListView*)m_bookctrl; } - -protected: - virtual wxWindow *DoRemovePage(size_t page); - - // get the size which the list control should have - virtual wxSize GetControllerSize() const; - - void UpdateSelectedPage(size_t newsel); - - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); - - // event handlers - void OnListSelected(wxListEvent& event); - void OnSize(wxSizeEvent& event); - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - -private: - // common part of all constructors - void Init(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook) -}; - -// ---------------------------------------------------------------------------- -// listbook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent -{ -public: - wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxListbookEvent(const wxListbookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxListbookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent) -}; - -typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&); - -#define wxListbookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func) - -#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn)) - -#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn)) - -#endif // wxUSE_LISTBOOK - -#endif // _WX_LISTBOOK_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listbook.h +// Purpose: wxListbook: wxListCtrl and wxNotebook combination +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.03 +// RCS-ID: $Id: listbook.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOOK_H_ +#define _WX_LISTBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_LISTBOOK + +#include "wx/bookctrl.h" + +class WXDLLIMPEXP_FWD_CORE wxListView; +class WXDLLIMPEXP_FWD_CORE wxListEvent; + +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING; + +// wxListbook flags +#define wxLB_DEFAULT wxBK_DEFAULT +#define wxLB_TOP wxBK_TOP +#define wxLB_BOTTOM wxBK_BOTTOM +#define wxLB_LEFT wxBK_LEFT +#define wxLB_RIGHT wxBK_RIGHT +#define wxLB_ALIGN_MASK wxBK_ALIGN_MASK + +// ---------------------------------------------------------------------------- +// wxListbook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListbook : public wxBookCtrlBase +{ +public: + wxListbook() + { + Init(); + } + + wxListbook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + // overridden base class methods + virtual int GetSelection() const; + virtual bool SetPageText(size_t n, const wxString& strText); + virtual wxString GetPageText(size_t n) const; + virtual int GetPageImage(size_t n) const; + virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = -1); + virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + virtual void SetImageList(wxImageList *imageList); + + virtual bool DeleteAllPages(); + + wxListView* GetListView() const { return (wxListView*)m_bookctrl; } + +protected: + virtual wxWindow *DoRemovePage(size_t page); + + // get the size which the list control should have + virtual wxSize GetControllerSize() const; + + void UpdateSelectedPage(size_t newsel); + + wxBookCtrlBaseEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlBaseEvent &event); + + // event handlers + void OnListSelected(wxListEvent& event); + void OnSize(wxSizeEvent& event); + + // the currently selected page or wxNOT_FOUND if none + int m_selection; + +private: + // common part of all constructors + void Init(); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook) +}; + +// ---------------------------------------------------------------------------- +// listbook event class and related stuff +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent +{ +public: + wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + + wxListbookEvent(const wxListbookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxListbookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent) +}; + +typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&); + +#define wxListbookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func) + +#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn)) + +#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn)) + +#endif // wxUSE_LISTBOOK + +#endif // _WX_LISTBOOK_H_ diff --git a/Externals/wxWidgets/include/wx/listbox.h b/Externals/wxWidgets/include/wx/listbox.h index a3b98fc481..c6a669d5c1 100644 --- a/Externals/wxWidgets/include/wx/listbox.h +++ b/Externals/wxWidgets/include/wx/listbox.h @@ -1,166 +1,166 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listbox.h -// Purpose: wxListBox class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.10.99 -// RCS-ID: $Id: listbox.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBOX_H_BASE_ -#define _WX_LISTBOX_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_LISTBOX - -#include "wx/ctrlsub.h" // base class - -// forward declarations are enough here -class WXDLLIMPEXP_FWD_BASE wxArrayInt; -class WXDLLIMPEXP_FWD_BASE wxArrayString; - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxListBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxListBox interface is defined by the class wxListBoxBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListBoxBase : public wxControlWithItems -{ -public: - wxListBoxBase() { } - virtual ~wxListBoxBase(); - - // all generic methods are in wxControlWithItems, except for the following - // ones which are not yet implemented by wxChoice/wxComboBox - void Insert(const wxString& item, unsigned int pos) - { /* return*/ wxControlWithItems::Insert(item,pos); } - void Insert(const wxString& item, unsigned int pos, void *clientData) - { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } - void Insert(const wxString& item, unsigned int pos, wxClientData *clientData) - { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } - - void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos); - void InsertItems(const wxArrayString& items, unsigned int pos) - { DoInsertItems(items, pos); } - - void Set(int n, const wxString* items, void **clientData = NULL); - void Set(const wxArrayString& items, void **clientData = NULL) - { DoSetItems(items, clientData); } - - // multiple selection logic - virtual bool IsSelected(int n) const = 0; - virtual void SetSelection(int n) { DoSetSelection(n, true); } - void SetSelection(int n, bool select) { DoSetSelection(n, select); } - void Deselect(int n) { DoSetSelection(n, false); } - void DeselectAll(int itemToLeaveSelected = -1); - - virtual bool SetStringSelection(const wxString& s, bool select); - virtual bool SetStringSelection(const wxString& s) - { - return SetStringSelection(s, true); - } - - // works for single as well as multiple selection listboxes (unlike - // GetSelection which only works for listboxes with single selection) - virtual int GetSelections(wxArrayInt& aSelections) const = 0; - - // set the specified item at the first visible item or scroll to max - // range. - void SetFirstItem(int n) { DoSetFirstItem(n); } - void SetFirstItem(const wxString& s); - - // ensures that the given item is visible scrolling the listbox if - // necessary - virtual void EnsureVisible(int n); - - // a combination of Append() and EnsureVisible(): appends the item to the - // listbox and ensures that it is visible i.e. not scrolled out of view - void AppendAndEnsureVisible(const wxString& s); - - // return true if the listbox allows multiple selection - bool HasMultipleSelection() const - { - return (m_windowStyle & wxLB_MULTIPLE) || - (m_windowStyle & wxLB_EXTENDED); - } - - // return true if this listbox is sorted - bool IsSorted() const { return (m_windowStyle & wxLB_SORT) != 0; } - - // emulate selecting or deselecting the item event.GetInt() (depending on - // event.GetExtraLong()) - void Command(wxCommandEvent& event); - - // returns the item number at a point or wxNOT_FOUND - int HitTest(const wxPoint& point) const { return DoListHitTest(point); } - -#if WXWIN_COMPATIBILITY_2_6 - // compatibility - these functions are deprecated, use the new ones - // instead - wxDEPRECATED( bool Selected(int n) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // NB: due to wxGTK implementation details, DoInsert() is implemented - // using DoInsertItems() and not the other way round - virtual int DoInsert(const wxString& item, unsigned int pos) - { InsertItems(1, &item, pos); return pos; } - - // to be implemented in derived classes - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos) = 0; - virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0; - - virtual void DoSetFirstItem(int n) = 0; - - virtual void DoSetSelection(int n, bool select) = 0; - - // there is already wxWindow::DoHitTest() so call this one differently - virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const - { return wxNOT_FOUND; } - - - DECLARE_NO_COPY_CLASS(wxListBoxBase) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxListBoxBase::Selected(int n) const { return IsSelected(n); } -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// include the platform-specific class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/listbox.h" -#elif defined(__WXMSW__) - #include "wx/msw/listbox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/listbox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/listbox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/listbox.h" -#elif defined(__WXMAC__) - #include "wx/mac/listbox.h" -#elif defined(__WXPM__) - #include "wx/os2/listbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/listbox.h" -#endif - -#endif // wxUSE_LISTBOX - -#endif - // _WX_LISTBOX_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listbox.h +// Purpose: wxListBox class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.10.99 +// RCS-ID: $Id: listbox.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_BASE_ +#define _WX_LISTBOX_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_LISTBOX + +#include "wx/ctrlsub.h" // base class + +// forward declarations are enough here +class WXDLLIMPEXP_FWD_BASE wxArrayInt; +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxListBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxListBox interface is defined by the class wxListBoxBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListBoxBase : public wxControlWithItems +{ +public: + wxListBoxBase() { } + virtual ~wxListBoxBase(); + + // all generic methods are in wxControlWithItems, except for the following + // ones which are not yet implemented by wxChoice/wxComboBox + void Insert(const wxString& item, unsigned int pos) + { /* return*/ wxControlWithItems::Insert(item,pos); } + void Insert(const wxString& item, unsigned int pos, void *clientData) + { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } + void Insert(const wxString& item, unsigned int pos, wxClientData *clientData) + { /* return*/ wxControlWithItems::Insert(item,pos,clientData); } + + void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos); + void InsertItems(const wxArrayString& items, unsigned int pos) + { DoInsertItems(items, pos); } + + void Set(int n, const wxString* items, void **clientData = NULL); + void Set(const wxArrayString& items, void **clientData = NULL) + { DoSetItems(items, clientData); } + + // multiple selection logic + virtual bool IsSelected(int n) const = 0; + virtual void SetSelection(int n) { DoSetSelection(n, true); } + void SetSelection(int n, bool select) { DoSetSelection(n, select); } + void Deselect(int n) { DoSetSelection(n, false); } + void DeselectAll(int itemToLeaveSelected = -1); + + virtual bool SetStringSelection(const wxString& s, bool select); + virtual bool SetStringSelection(const wxString& s) + { + return SetStringSelection(s, true); + } + + // works for single as well as multiple selection listboxes (unlike + // GetSelection which only works for listboxes with single selection) + virtual int GetSelections(wxArrayInt& aSelections) const = 0; + + // set the specified item at the first visible item or scroll to max + // range. + void SetFirstItem(int n) { DoSetFirstItem(n); } + void SetFirstItem(const wxString& s); + + // ensures that the given item is visible scrolling the listbox if + // necessary + virtual void EnsureVisible(int n); + + // a combination of Append() and EnsureVisible(): appends the item to the + // listbox and ensures that it is visible i.e. not scrolled out of view + void AppendAndEnsureVisible(const wxString& s); + + // return true if the listbox allows multiple selection + bool HasMultipleSelection() const + { + return (m_windowStyle & wxLB_MULTIPLE) || + (m_windowStyle & wxLB_EXTENDED); + } + + // return true if this listbox is sorted + bool IsSorted() const { return (m_windowStyle & wxLB_SORT) != 0; } + + // emulate selecting or deselecting the item event.GetInt() (depending on + // event.GetExtraLong()) + void Command(wxCommandEvent& event); + + // returns the item number at a point or wxNOT_FOUND + int HitTest(const wxPoint& point) const { return DoListHitTest(point); } + +#if WXWIN_COMPATIBILITY_2_6 + // compatibility - these functions are deprecated, use the new ones + // instead + wxDEPRECATED( bool Selected(int n) const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + // NB: due to wxGTK implementation details, DoInsert() is implemented + // using DoInsertItems() and not the other way round + virtual int DoInsert(const wxString& item, unsigned int pos) + { InsertItems(1, &item, pos); return pos; } + + // to be implemented in derived classes + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos) = 0; + virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0; + + virtual void DoSetFirstItem(int n) = 0; + + virtual void DoSetSelection(int n, bool select) = 0; + + // there is already wxWindow::DoHitTest() so call this one differently + virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const + { return wxNOT_FOUND; } + + + DECLARE_NO_COPY_CLASS(wxListBoxBase) +}; + +#if WXWIN_COMPATIBILITY_2_6 + inline bool wxListBoxBase::Selected(int n) const { return IsSelected(n); } +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// include the platform-specific class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/listbox.h" +#elif defined(__WXMSW__) + #include "wx/msw/listbox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/listbox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/listbox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/listbox.h" +#elif defined(__WXMAC__) + #include "wx/mac/listbox.h" +#elif defined(__WXPM__) + #include "wx/os2/listbox.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/listbox.h" +#endif + +#endif // wxUSE_LISTBOX + +#endif + // _WX_LISTBOX_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/listctrl.h b/Externals/wxWidgets/include/wx/listctrl.h index efccc7300f..96b6fa7b1c 100644 --- a/Externals/wxWidgets/include/wx/listctrl.h +++ b/Externals/wxWidgets/include/wx/listctrl.h @@ -1,110 +1,110 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/listctrl.h -// Purpose: wxListCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.12.99 -// RCS-ID: $Id: listctrl.h 46432 2007-06-13 03:46:20Z SC $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTCTRL_H_BASE_ -#define _WX_LISTCTRL_H_BASE_ - -#include "wx/defs.h" // headers should include this before first wxUSE_XXX check - -#if wxUSE_LISTCTRL - -#include "wx/listbase.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxListCtrlNameStr[]; - -// ---------------------------------------------------------------------------- -// include the wxListCtrl class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WIN32__) && !defined(__WXUNIVERSAL__) - #include "wx/msw/listctrl.h" -#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) - #include "wx/mac/carbon/listctrl.h" -#else - #include "wx/generic/listctrl.h" -#endif - -// ---------------------------------------------------------------------------- -// wxListView: a class which provides a better API for list control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListView : public wxListCtrl -{ -public: - wxListView() { } - wxListView( wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_REPORT, - const wxValidator& validator = wxDefaultValidator, - const wxString &name = wxListCtrlNameStr) - { - Create(parent, winid, pos, size, style, validator, name); - } - - // focus/selection stuff - // --------------------- - - // [de]select an item - void Select(long n, bool on = true) - { - SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED); - } - - // focus and show the given item - void Focus(long index) - { - SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); - EnsureVisible(index); - } - - // get the currently focused item or -1 if none - long GetFocusedItem() const - { - return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); - } - - // get first and subsequent selected items, return -1 when no more - long GetNextSelected(long item) const - { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } - long GetFirstSelected() const - { return GetNextSelected(-1); } - - // return true if the item is selected - bool IsSelected(long index) const - { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; } - - // columns - // ------- - - void SetColumnImage(int col, int image) - { - wxListItem item; - item.SetMask(wxLIST_MASK_IMAGE); - item.SetImage(image); - SetColumn(col, item); - } - - void ClearColumnImage(int col) { SetColumnImage(col, -1); } - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView) -}; - -#endif // wxUSE_LISTCTRL - -#endif - // _WX_LISTCTRL_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listctrl.h +// Purpose: wxListCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.12.99 +// RCS-ID: $Id: listctrl.h 46432 2007-06-13 03:46:20Z SC $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTCTRL_H_BASE_ +#define _WX_LISTCTRL_H_BASE_ + +#include "wx/defs.h" // headers should include this before first wxUSE_XXX check + +#if wxUSE_LISTCTRL + +#include "wx/listbase.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxListCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// include the wxListCtrl class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WIN32__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/listctrl.h" +#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) + #include "wx/mac/carbon/listctrl.h" +#else + #include "wx/generic/listctrl.h" +#endif + +// ---------------------------------------------------------------------------- +// wxListView: a class which provides a better API for list control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListView : public wxListCtrl +{ +public: + wxListView() { } + wxListView( wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_REPORT, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxListCtrlNameStr) + { + Create(parent, winid, pos, size, style, validator, name); + } + + // focus/selection stuff + // --------------------- + + // [de]select an item + void Select(long n, bool on = true) + { + SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED); + } + + // focus and show the given item + void Focus(long index) + { + SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); + EnsureVisible(index); + } + + // get the currently focused item or -1 if none + long GetFocusedItem() const + { + return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); + } + + // get first and subsequent selected items, return -1 when no more + long GetNextSelected(long item) const + { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } + long GetFirstSelected() const + { return GetNextSelected(-1); } + + // return true if the item is selected + bool IsSelected(long index) const + { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; } + + // columns + // ------- + + void SetColumnImage(int col, int image) + { + wxListItem item; + item.SetMask(wxLIST_MASK_IMAGE); + item.SetImage(image); + SetColumn(col, item); + } + + void ClearColumnImage(int col) { SetColumnImage(col, -1); } + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView) +}; + +#endif // wxUSE_LISTCTRL + +#endif + // _WX_LISTCTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/log.h b/Externals/wxWidgets/include/wx/log.h index 5e23bcf927..288e8e5525 100644 --- a/Externals/wxWidgets/include/wx/log.h +++ b/Externals/wxWidgets/include/wx/log.h @@ -1,653 +1,653 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/log.h -// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: log.h 50993 2008-01-02 21:18:15Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LOG_H_ -#define _WX_LOG_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// common constants for use in wxUSE_LOG/!wxUSE_LOG -// ---------------------------------------------------------------------------- - -// the trace masks have been superceded by symbolic trace constants, they're -// for compatibility only andwill be removed soon - do NOT use them - -// meaning of different bits of the trace mask (which allows selectively -// enable/disable some trace messages) -#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) -#define wxTraceMessages 0x0002 // trace window messages/X callbacks -#define wxTraceResAlloc 0x0004 // trace GDI resource allocation -#define wxTraceRefCount 0x0008 // trace various ref counting operations - -#ifdef __WXMSW__ - #define wxTraceOleCalls 0x0100 // OLE interface calls -#endif - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// NB: these types are needed even if wxUSE_LOG == 0 -typedef unsigned long wxTraceMask; -typedef unsigned long wxLogLevel; - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/string.h" - -#if wxUSE_LOG - -#include "wx/arrstr.h" - -#ifndef __WXWINCE__ - #include <time.h> // for time_t -#endif - -#include "wx/dynarray.h" - -#ifndef wxUSE_LOG_DEBUG -# ifdef __WXDEBUG__ -# define wxUSE_LOG_DEBUG 1 -# else // !__WXDEBUG__ -# define wxUSE_LOG_DEBUG 0 -# endif -#endif - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - class WXDLLIMPEXP_FWD_CORE wxLogFrame; - class WXDLLIMPEXP_FWD_CORE wxFrame; - class WXDLLIMPEXP_FWD_CORE wxWindow; -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// different standard log levels (you may also define your own) -enum -{ - wxLOG_FatalError, // program can't continue, abort immediately - wxLOG_Error, // a serious error, user must be informed about it - wxLOG_Warning, // user is normally informed about it but may be ignored - wxLOG_Message, // normal message (i.e. normal output of a non GUI app) - wxLOG_Status, // informational: might go to the status line of GUI app - wxLOG_Info, // informational message (a.k.a. 'Verbose') - wxLOG_Debug, // never shown to the user, disabled in release mode - wxLOG_Trace, // trace messages are also only enabled in debug mode - wxLOG_Progress, // used for progress indicator (not yet) - wxLOG_User = 100, // user defined levels start here - wxLOG_Max = 10000 -}; - -// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be -// discarded unless the string "foo" has been added to the list of allowed -// ones with AddTraceMask() - -#define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete) -#define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks -#define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation -#define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations - -#ifdef __WXMSW__ - #define wxTRACE_OleCalls wxT("ole") // OLE interface calls -#endif - -#include "wx/iosfwrap.h" - -// ---------------------------------------------------------------------------- -// derive from this class to redirect (or suppress, or ...) log messages -// normally, only a single instance of this class exists but it's not enforced -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxLog -{ -public: - // ctor - wxLog(){} - - // these functions allow to completely disable all log messages - - // is logging disabled now? - static bool IsEnabled() { return ms_doLog; } - - // change the flag state, return the previous one - static bool EnableLogging(bool doIt = true) - { bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; } - - // static sink function - see DoLog() for function to overload in the - // derived classes - static void OnLog(wxLogLevel level, const wxChar *szString, time_t t); - - // message buffering - - // flush shows all messages if they're not logged immediately (FILE - // and iostream logs don't need it, but wxGuiLog does to avoid showing - // 17 modal dialogs one after another) - virtual void Flush(); - - // flush the active target if any - static void FlushActive() - { - if ( !ms_suspendCount ) - { - wxLog *log = GetActiveTarget(); - if ( log ) - log->Flush(); - } - } - - // only one sink is active at each moment - // get current log target, will call wxApp::CreateLogTarget() to - // create one if none exists - static wxLog *GetActiveTarget(); - - // change log target, pLogger may be NULL - static wxLog *SetActiveTarget(wxLog *pLogger); - - // suspend the message flushing of the main target until the next call - // to Resume() - this is mainly for internal use (to prevent wxYield() - // from flashing the messages) - static void Suspend() { ms_suspendCount++; } - - // must be called for each Suspend()! - static void Resume() { ms_suspendCount--; } - - // functions controlling the default wxLog behaviour - // verbose mode is activated by standard command-line '-verbose' - // option - static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } - - // Set log level. Log messages with level > logLevel will not be logged. - static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } - -#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ - // should GetActiveTarget() try to create a new log object if the - // current is NULL? - static void DontCreateOnDemand(); -#endif - - // Make GetActiveTarget() create a new log object again. - static void DoCreateOnDemand(); - - // log the count of repeating messages instead of logging the messages - // multiple times - static void SetRepetitionCounting(bool bRepetCounting = true) - { ms_bRepetCounting = bRepetCounting; } - - // gets duplicate counting status - static bool GetRepetitionCounting() { return ms_bRepetCounting; } - - // trace mask (see wxTraceXXX constants for details) - static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; } - - // add string trace mask - static void AddTraceMask(const wxString& str) - { ms_aTraceMasks.push_back(str); } - - // add string trace mask - static void RemoveTraceMask(const wxString& str); - - // remove all string trace masks - static void ClearTraceMasks(); - - // get string trace masks - static const wxArrayString &GetTraceMasks() { return ms_aTraceMasks; } - - // sets the timestamp string: this is used as strftime() format string - // for the log targets which add time stamps to the messages - set it - // to NULL to disable time stamping completely. - static void SetTimestamp(const wxChar *ts) { ms_timestamp = ts; } - - - // accessors - - // gets the verbose status - static bool GetVerbose() { return ms_bVerbose; } - - // get trace mask - static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } - - // is this trace mask in the list? - static bool IsAllowedTraceMask(const wxChar *mask); - - // return the current loglevel limit - static wxLogLevel GetLogLevel() { return ms_logLevel; } - - // get the current timestamp format string (may be NULL) - static const wxChar *GetTimestamp() { return ms_timestamp; } - - - // helpers - - // put the time stamp into the string if ms_timestamp != NULL (don't - // change it otherwise) - static void TimeStamp(wxString *str); - - // make dtor virtual for all derived classes - virtual ~wxLog(); - - - // this method exists for backwards compatibility only, don't use - bool HasPendingMessages() const { return true; } - -#if WXWIN_COMPATIBILITY_2_6 - // this function doesn't do anything any more, don't call it - wxDEPRECATED( static wxChar *SetLogBuffer(wxChar *buf, size_t size = 0) ); -#endif - -protected: - // the logging functions that can be overriden - - // default DoLog() prepends the time stamp and a prefix corresponding - // to the message to szString and then passes it to DoLogString() - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - - // default DoLogString does nothing but is not pure virtual because if - // you override DoLog() you might not need it at all - virtual void DoLogString(const wxChar *szString, time_t t); - - // log a line containing the number of times the previous message was - // repeated and returns this number (which can be 0) - static unsigned DoLogNumberOfRepeats(); - -private: - // static variables - // ---------------- - - // traditional behaviour or counting repetitions - static bool ms_bRepetCounting; - static wxString ms_prevString; // previous message that was logged - // how many times the previous message was logged - static unsigned ms_prevCounter; - static time_t ms_prevTimeStamp;// timestamp of the previous message - static wxLogLevel ms_prevLevel; // level of the previous message - - static wxLog *ms_pLogger; // currently active log sink - static bool ms_doLog; // false => all logging disabled - static bool ms_bAutoCreate; // create new log targets on demand? - static bool ms_bVerbose; // false => ignore LogInfo messages - - static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel - - static size_t ms_suspendCount; // if positive, logs are not flushed - - // format string for strftime(), if NULL, time stamping log messages is - // disabled - static const wxChar *ms_timestamp; - - static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour - static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace - - - // this is the replacement of DoLogNumberOfRepeats() (which has to be kept - // to avoid breaking ABI in this version) - unsigned LogLastRepeatIfNeeded(); - - // implementation of the function above which supposes that the caller had - // already locked gs_prevCS - unsigned LogLastRepeatIfNeededUnlocked(); -}; - -// ---------------------------------------------------------------------------- -// "trivial" derivations of wxLog -// ---------------------------------------------------------------------------- - -// log everything to a buffer -class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog -{ -public: - wxLogBuffer() { } - - // get the string contents with all messages logged - const wxString& GetBuffer() const { return m_str; } - - // show the buffer contents to the user in the best possible way (this uses - // wxMessageOutputMessageBox) and clear it - virtual void Flush(); - -protected: - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - virtual void DoLogString(const wxChar *szString, time_t t); - -private: - wxString m_str; - - DECLARE_NO_COPY_CLASS(wxLogBuffer) -}; - - -// log everything to a "FILE *", stderr by default -class WXDLLIMPEXP_BASE wxLogStderr : public wxLog -{ -public: - // redirect log output to a FILE - wxLogStderr(FILE *fp = (FILE *) NULL); - -protected: - // implement sink function - virtual void DoLogString(const wxChar *szString, time_t t); - - FILE *m_fp; - - DECLARE_NO_COPY_CLASS(wxLogStderr) -}; - -#if wxUSE_STD_IOSTREAM - -// log everything to an "ostream", cerr by default -class WXDLLIMPEXP_BASE wxLogStream : public wxLog -{ -public: - // redirect log output to an ostream - wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL); - -protected: - // implement sink function - virtual void DoLogString(const wxChar *szString, time_t t); - - // using ptr here to avoid including <iostream.h> from this file - wxSTD ostream *m_ostr; -}; - -#endif // wxUSE_STD_IOSTREAM - -// ---------------------------------------------------------------------------- -// /dev/null log target: suppress logging until this object goes out of scope -// ---------------------------------------------------------------------------- - -// example of usage: -/* - void Foo() - { - wxFile file; - - // wxFile.Open() normally complains if file can't be opened, we don't - // want it - wxLogNull logNo; - - if ( !file.Open("bar") ) - ... process error ourselves ... - - // ~wxLogNull called, old log sink restored - } - */ -class WXDLLIMPEXP_BASE wxLogNull -{ -public: - wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { } - ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } - -private: - bool m_flagOld; // the previous value of the wxLog::ms_doLog -}; - -// ---------------------------------------------------------------------------- -// chaining log target: installs itself as a log target and passes all -// messages to the real log target given to it in the ctor but also forwards -// them to the previously active one -// -// note that you don't have to call SetActiveTarget() with this class, it -// does it itself in its ctor -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxLogChain : public wxLog -{ -public: - wxLogChain(wxLog *logger); - virtual ~wxLogChain(); - - // change the new log target - void SetLog(wxLog *logger); - - // this can be used to temporarily disable (and then reenable) passing - // messages to the old logger (by default we do pass them) - void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } - - // are we passing the messages to the previous log target? - bool IsPassingMessages() const { return m_bPassMessages; } - - // return the previous log target (may be NULL) - wxLog *GetOldLog() const { return m_logOld; } - - // override base class version to flush the old logger as well - virtual void Flush(); - - // call to avoid destroying the old log target -#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ - void DetachOldLog() { m_logOld = NULL; } -#endif - -protected: - // pass the chain to the old logger if needed - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); - -private: - // the current log target - wxLog *m_logNew; - - // the previous log target - wxLog *m_logOld; - - // do we pass the messages to the old logger? - bool m_bPassMessages; - - DECLARE_NO_COPY_CLASS(wxLogChain) -}; - -// a chain log target which uses itself as the new logger -class WXDLLIMPEXP_BASE wxLogPassThrough : public wxLogChain -{ -public: - wxLogPassThrough(); - -private: - DECLARE_NO_COPY_CLASS(wxLogPassThrough) -}; - -#if wxUSE_GUI - // include GUI log targets: - #include "wx/generic/logg.h" -#endif // wxUSE_GUI - -// ============================================================================ -// global functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Log functions should be used by application instead of stdio, iostream &c -// for log messages for easy redirection -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// get error code/error message from system in a portable way -// ---------------------------------------------------------------------------- - -// return the last system error code -WXDLLIMPEXP_BASE unsigned long wxSysErrorCode(); - -// return the error message for given (or last if 0) error code -WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); - -// ---------------------------------------------------------------------------- -// define wxLog<level> -// ---------------------------------------------------------------------------- - -#define DECLARE_LOG_FUNCTION(level) \ -extern void WXDLLIMPEXP_BASE wxVLog##level(const wxChar *szFormat, \ - va_list argptr); \ -extern void WXDLLIMPEXP_BASE wxLog##level(const wxChar *szFormat, \ - ...) ATTRIBUTE_PRINTF_1 -#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ -extern void expdecl wxVLog##level(argclass arg, \ - const wxChar *szFormat, \ - va_list argptr); \ -extern void expdecl wxLog##level(argclass arg, \ - const wxChar *szFormat, \ - ...) ATTRIBUTE_PRINTF_2 -#else // !wxUSE_LOG - -// log functions do nothing at all -#define DECLARE_LOG_FUNCTION(level) \ -inline void wxVLog##level(const wxChar *WXUNUSED(szFormat), \ - va_list WXUNUSED(argptr)) { } \ -inline void wxLog##level(const wxChar *WXUNUSED(szFormat), \ - ...) { } -#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ -inline void wxVLog##level(argclass WXUNUSED(arg), \ - const wxChar *WXUNUSED(szFormat), \ - va_list WXUNUSED(argptr)) {} \ -inline void wxLog##level(argclass WXUNUSED(arg), \ - const wxChar *WXUNUSED(szFormat), \ - ...) { } - -// Empty Class to fake wxLogNull -class WXDLLIMPEXP_BASE wxLogNull -{ -public: - wxLogNull() { } -}; - -// Dummy macros to replace some functions. -#define wxSysErrorCode() (unsigned long)0 -#define wxSysErrorMsg( X ) (const wxChar*)NULL - -// Fake symbolic trace masks... for those that are used frequently -#define wxTRACE_OleCalls wxEmptyString // OLE interface calls - -#endif // wxUSE_LOG/!wxUSE_LOG - -#define DECLARE_LOG_FUNCTION2(level, argclass, arg) \ - DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, WXDLLIMPEXP_BASE) - - -// a generic function for all levels (level is passes as parameter) -DECLARE_LOG_FUNCTION2(Generic, wxLogLevel, level); - -// one function per each level -DECLARE_LOG_FUNCTION(FatalError); -DECLARE_LOG_FUNCTION(Error); -DECLARE_LOG_FUNCTION(Warning); -DECLARE_LOG_FUNCTION(Message); -DECLARE_LOG_FUNCTION(Info); -DECLARE_LOG_FUNCTION(Verbose); - -// this function sends the log message to the status line of the top level -// application frame, if any -DECLARE_LOG_FUNCTION(Status); - -#if wxUSE_GUI - // this one is the same as previous except that it allows to explicitly - class WXDLLIMPEXP_FWD_CORE wxFrame; - // specify the frame to which the output should go - DECLARE_LOG_FUNCTION2_EXP(Status, wxFrame *, pFrame, WXDLLIMPEXP_CORE); -#endif // wxUSE_GUI - -// additional one: as wxLogError, but also logs last system call error code -// and the corresponding error message if available -DECLARE_LOG_FUNCTION(SysError); - -// and another one which also takes the error code (for those broken APIs -// that don't set the errno (like registry APIs in Win32)) -DECLARE_LOG_FUNCTION2(SysError, long, lErrCode); - -// debug functions do nothing in release mode -#if wxUSE_LOG && wxUSE_LOG_DEBUG - DECLARE_LOG_FUNCTION(Debug); - - // there is no more unconditional LogTrace: it is not different from - // LogDebug and it creates overload ambiguities - //DECLARE_LOG_FUNCTION(Trace); - - // this version only logs the message if the mask had been added to the - // list of masks with AddTraceMask() - DECLARE_LOG_FUNCTION2(Trace, const wxChar *, mask); - - // and this one does nothing if all of level bits are not set in - // wxLog::GetActive()->GetTraceMask() -- it's deprecated in favour of - // string identifiers - DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask); -#else //!debug || !wxUSE_LOG - // these functions do nothing in release builds, but don't define them as - // nothing as it could result in different code structure in debug and - // release and this could result in trouble when these macros are used - // inside if/else - // - // note that making wxVLogDebug/Trace() themselves (empty inline) functions - // is a bad idea as some compilers are stupid enough to not inline even - // empty functions if their parameters are complicated enough, but by - // defining them as an empty inline function we ensure that even dumbest - // compilers optimise them away - inline void wxLogNop() { } - - #define wxVLogDebug(fmt, valist) wxLogNop() - #define wxVLogTrace(mask, fmt, valist) wxLogNop() - - #ifdef HAVE_VARIADIC_MACROS - // unlike the inline functions below, this completely removes the - // wxLogXXX calls from the object file: - #define wxLogDebug(fmt, ...) wxLogNop() - #define wxLogTrace(mask, fmt, ...) wxLogNop() - #else // !HAVE_VARIADIC_MACROS - // note that leaving out "fmt" in the vararg functions provokes a warning - // from SGI CC: "the last argument of the varargs function is unnamed" - inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); } - inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); } - inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); } - #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS -#endif // debug/!debug - -// wxLogFatalError helper: show the (fatal) error to the user in a safe way, -// i.e. without using wxMessageBox() for example because it could crash -void WXDLLIMPEXP_BASE -wxSafeShowMessage(const wxString& title, const wxString& text); - -// ---------------------------------------------------------------------------- -// debug only logging functions: use them with API name and error code -// ---------------------------------------------------------------------------- - -#ifdef __WXDEBUG__ - // make life easier for people using VC++ IDE: clicking on the message - // will take us immediately to the place of the failed API -#ifdef __VISUALC__ - #define wxLogApiError(api, rc) \ - wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ - __TFILE__, __LINE__, api, \ - (long)rc, wxSysErrorMsg(rc)) -#else // !VC++ - #define wxLogApiError(api, rc) \ - wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \ - wxT("error 0x%08lx (%s)."), \ - __TFILE__, __LINE__, api, \ - (long)rc, wxSysErrorMsg(rc)) -#endif // VC++/!VC++ - - #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) - -#else //!debug - #define wxLogApiError(api, err) wxLogNop() - #define wxLogLastError(api) wxLogNop() -#endif //debug/!debug - -// wxCocoa has additiional trace masks -#if defined(__WXCOCOA__) -#include "wx/cocoa/log.h" -#endif - -#endif // _WX_LOG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/log.h +// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: log.h 50993 2008-01-02 21:18:15Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LOG_H_ +#define _WX_LOG_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// common constants for use in wxUSE_LOG/!wxUSE_LOG +// ---------------------------------------------------------------------------- + +// the trace masks have been superceded by symbolic trace constants, they're +// for compatibility only andwill be removed soon - do NOT use them + +// meaning of different bits of the trace mask (which allows selectively +// enable/disable some trace messages) +#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) +#define wxTraceMessages 0x0002 // trace window messages/X callbacks +#define wxTraceResAlloc 0x0004 // trace GDI resource allocation +#define wxTraceRefCount 0x0008 // trace various ref counting operations + +#ifdef __WXMSW__ + #define wxTraceOleCalls 0x0100 // OLE interface calls +#endif + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// NB: these types are needed even if wxUSE_LOG == 0 +typedef unsigned long wxTraceMask; +typedef unsigned long wxLogLevel; + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/string.h" + +#if wxUSE_LOG + +#include "wx/arrstr.h" + +#ifndef __WXWINCE__ + #include <time.h> // for time_t +#endif + +#include "wx/dynarray.h" + +#ifndef wxUSE_LOG_DEBUG +# ifdef __WXDEBUG__ +# define wxUSE_LOG_DEBUG 1 +# else // !__WXDEBUG__ +# define wxUSE_LOG_DEBUG 0 +# endif +#endif + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + class WXDLLIMPEXP_FWD_CORE wxLogFrame; + class WXDLLIMPEXP_FWD_CORE wxFrame; + class WXDLLIMPEXP_FWD_CORE wxWindow; +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// different standard log levels (you may also define your own) +enum +{ + wxLOG_FatalError, // program can't continue, abort immediately + wxLOG_Error, // a serious error, user must be informed about it + wxLOG_Warning, // user is normally informed about it but may be ignored + wxLOG_Message, // normal message (i.e. normal output of a non GUI app) + wxLOG_Status, // informational: might go to the status line of GUI app + wxLOG_Info, // informational message (a.k.a. 'Verbose') + wxLOG_Debug, // never shown to the user, disabled in release mode + wxLOG_Trace, // trace messages are also only enabled in debug mode + wxLOG_Progress, // used for progress indicator (not yet) + wxLOG_User = 100, // user defined levels start here + wxLOG_Max = 10000 +}; + +// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be +// discarded unless the string "foo" has been added to the list of allowed +// ones with AddTraceMask() + +#define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete) +#define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks +#define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation +#define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations + +#ifdef __WXMSW__ + #define wxTRACE_OleCalls wxT("ole") // OLE interface calls +#endif + +#include "wx/iosfwrap.h" + +// ---------------------------------------------------------------------------- +// derive from this class to redirect (or suppress, or ...) log messages +// normally, only a single instance of this class exists but it's not enforced +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLog +{ +public: + // ctor + wxLog(){} + + // these functions allow to completely disable all log messages + + // is logging disabled now? + static bool IsEnabled() { return ms_doLog; } + + // change the flag state, return the previous one + static bool EnableLogging(bool doIt = true) + { bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; } + + // static sink function - see DoLog() for function to overload in the + // derived classes + static void OnLog(wxLogLevel level, const wxChar *szString, time_t t); + + // message buffering + + // flush shows all messages if they're not logged immediately (FILE + // and iostream logs don't need it, but wxGuiLog does to avoid showing + // 17 modal dialogs one after another) + virtual void Flush(); + + // flush the active target if any + static void FlushActive() + { + if ( !ms_suspendCount ) + { + wxLog *log = GetActiveTarget(); + if ( log ) + log->Flush(); + } + } + + // only one sink is active at each moment + // get current log target, will call wxApp::CreateLogTarget() to + // create one if none exists + static wxLog *GetActiveTarget(); + + // change log target, pLogger may be NULL + static wxLog *SetActiveTarget(wxLog *pLogger); + + // suspend the message flushing of the main target until the next call + // to Resume() - this is mainly for internal use (to prevent wxYield() + // from flashing the messages) + static void Suspend() { ms_suspendCount++; } + + // must be called for each Suspend()! + static void Resume() { ms_suspendCount--; } + + // functions controlling the default wxLog behaviour + // verbose mode is activated by standard command-line '-verbose' + // option + static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } + + // Set log level. Log messages with level > logLevel will not be logged. + static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } + +#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ + // should GetActiveTarget() try to create a new log object if the + // current is NULL? + static void DontCreateOnDemand(); +#endif + + // Make GetActiveTarget() create a new log object again. + static void DoCreateOnDemand(); + + // log the count of repeating messages instead of logging the messages + // multiple times + static void SetRepetitionCounting(bool bRepetCounting = true) + { ms_bRepetCounting = bRepetCounting; } + + // gets duplicate counting status + static bool GetRepetitionCounting() { return ms_bRepetCounting; } + + // trace mask (see wxTraceXXX constants for details) + static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; } + + // add string trace mask + static void AddTraceMask(const wxString& str) + { ms_aTraceMasks.push_back(str); } + + // add string trace mask + static void RemoveTraceMask(const wxString& str); + + // remove all string trace masks + static void ClearTraceMasks(); + + // get string trace masks + static const wxArrayString &GetTraceMasks() { return ms_aTraceMasks; } + + // sets the timestamp string: this is used as strftime() format string + // for the log targets which add time stamps to the messages - set it + // to NULL to disable time stamping completely. + static void SetTimestamp(const wxChar *ts) { ms_timestamp = ts; } + + + // accessors + + // gets the verbose status + static bool GetVerbose() { return ms_bVerbose; } + + // get trace mask + static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } + + // is this trace mask in the list? + static bool IsAllowedTraceMask(const wxChar *mask); + + // return the current loglevel limit + static wxLogLevel GetLogLevel() { return ms_logLevel; } + + // get the current timestamp format string (may be NULL) + static const wxChar *GetTimestamp() { return ms_timestamp; } + + + // helpers + + // put the time stamp into the string if ms_timestamp != NULL (don't + // change it otherwise) + static void TimeStamp(wxString *str); + + // make dtor virtual for all derived classes + virtual ~wxLog(); + + + // this method exists for backwards compatibility only, don't use + bool HasPendingMessages() const { return true; } + +#if WXWIN_COMPATIBILITY_2_6 + // this function doesn't do anything any more, don't call it + wxDEPRECATED( static wxChar *SetLogBuffer(wxChar *buf, size_t size = 0) ); +#endif + +protected: + // the logging functions that can be overriden + + // default DoLog() prepends the time stamp and a prefix corresponding + // to the message to szString and then passes it to DoLogString() + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + + // default DoLogString does nothing but is not pure virtual because if + // you override DoLog() you might not need it at all + virtual void DoLogString(const wxChar *szString, time_t t); + + // log a line containing the number of times the previous message was + // repeated and returns this number (which can be 0) + static unsigned DoLogNumberOfRepeats(); + +private: + // static variables + // ---------------- + + // traditional behaviour or counting repetitions + static bool ms_bRepetCounting; + static wxString ms_prevString; // previous message that was logged + // how many times the previous message was logged + static unsigned ms_prevCounter; + static time_t ms_prevTimeStamp;// timestamp of the previous message + static wxLogLevel ms_prevLevel; // level of the previous message + + static wxLog *ms_pLogger; // currently active log sink + static bool ms_doLog; // false => all logging disabled + static bool ms_bAutoCreate; // create new log targets on demand? + static bool ms_bVerbose; // false => ignore LogInfo messages + + static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel + + static size_t ms_suspendCount; // if positive, logs are not flushed + + // format string for strftime(), if NULL, time stamping log messages is + // disabled + static const wxChar *ms_timestamp; + + static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour + static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace + + + // this is the replacement of DoLogNumberOfRepeats() (which has to be kept + // to avoid breaking ABI in this version) + unsigned LogLastRepeatIfNeeded(); + + // implementation of the function above which supposes that the caller had + // already locked gs_prevCS + unsigned LogLastRepeatIfNeededUnlocked(); +}; + +// ---------------------------------------------------------------------------- +// "trivial" derivations of wxLog +// ---------------------------------------------------------------------------- + +// log everything to a buffer +class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog +{ +public: + wxLogBuffer() { } + + // get the string contents with all messages logged + const wxString& GetBuffer() const { return m_str; } + + // show the buffer contents to the user in the best possible way (this uses + // wxMessageOutputMessageBox) and clear it + virtual void Flush(); + +protected: + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + virtual void DoLogString(const wxChar *szString, time_t t); + +private: + wxString m_str; + + DECLARE_NO_COPY_CLASS(wxLogBuffer) +}; + + +// log everything to a "FILE *", stderr by default +class WXDLLIMPEXP_BASE wxLogStderr : public wxLog +{ +public: + // redirect log output to a FILE + wxLogStderr(FILE *fp = (FILE *) NULL); + +protected: + // implement sink function + virtual void DoLogString(const wxChar *szString, time_t t); + + FILE *m_fp; + + DECLARE_NO_COPY_CLASS(wxLogStderr) +}; + +#if wxUSE_STD_IOSTREAM + +// log everything to an "ostream", cerr by default +class WXDLLIMPEXP_BASE wxLogStream : public wxLog +{ +public: + // redirect log output to an ostream + wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL); + +protected: + // implement sink function + virtual void DoLogString(const wxChar *szString, time_t t); + + // using ptr here to avoid including <iostream.h> from this file + wxSTD ostream *m_ostr; +}; + +#endif // wxUSE_STD_IOSTREAM + +// ---------------------------------------------------------------------------- +// /dev/null log target: suppress logging until this object goes out of scope +// ---------------------------------------------------------------------------- + +// example of usage: +/* + void Foo() + { + wxFile file; + + // wxFile.Open() normally complains if file can't be opened, we don't + // want it + wxLogNull logNo; + + if ( !file.Open("bar") ) + ... process error ourselves ... + + // ~wxLogNull called, old log sink restored + } + */ +class WXDLLIMPEXP_BASE wxLogNull +{ +public: + wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { } + ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } + +private: + bool m_flagOld; // the previous value of the wxLog::ms_doLog +}; + +// ---------------------------------------------------------------------------- +// chaining log target: installs itself as a log target and passes all +// messages to the real log target given to it in the ctor but also forwards +// them to the previously active one +// +// note that you don't have to call SetActiveTarget() with this class, it +// does it itself in its ctor +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLogChain : public wxLog +{ +public: + wxLogChain(wxLog *logger); + virtual ~wxLogChain(); + + // change the new log target + void SetLog(wxLog *logger); + + // this can be used to temporarily disable (and then reenable) passing + // messages to the old logger (by default we do pass them) + void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } + + // are we passing the messages to the previous log target? + bool IsPassingMessages() const { return m_bPassMessages; } + + // return the previous log target (may be NULL) + wxLog *GetOldLog() const { return m_logOld; } + + // override base class version to flush the old logger as well + virtual void Flush(); + + // call to avoid destroying the old log target +#if wxABI_VERSION >= 20805 /* 2.8.5+ only */ + void DetachOldLog() { m_logOld = NULL; } +#endif + +protected: + // pass the chain to the old logger if needed + virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); + +private: + // the current log target + wxLog *m_logNew; + + // the previous log target + wxLog *m_logOld; + + // do we pass the messages to the old logger? + bool m_bPassMessages; + + DECLARE_NO_COPY_CLASS(wxLogChain) +}; + +// a chain log target which uses itself as the new logger +class WXDLLIMPEXP_BASE wxLogPassThrough : public wxLogChain +{ +public: + wxLogPassThrough(); + +private: + DECLARE_NO_COPY_CLASS(wxLogPassThrough) +}; + +#if wxUSE_GUI + // include GUI log targets: + #include "wx/generic/logg.h" +#endif // wxUSE_GUI + +// ============================================================================ +// global functions +// ============================================================================ + +// ---------------------------------------------------------------------------- +// Log functions should be used by application instead of stdio, iostream &c +// for log messages for easy redirection +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// get error code/error message from system in a portable way +// ---------------------------------------------------------------------------- + +// return the last system error code +WXDLLIMPEXP_BASE unsigned long wxSysErrorCode(); + +// return the error message for given (or last if 0) error code +WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); + +// ---------------------------------------------------------------------------- +// define wxLog<level> +// ---------------------------------------------------------------------------- + +#define DECLARE_LOG_FUNCTION(level) \ +extern void WXDLLIMPEXP_BASE wxVLog##level(const wxChar *szFormat, \ + va_list argptr); \ +extern void WXDLLIMPEXP_BASE wxLog##level(const wxChar *szFormat, \ + ...) ATTRIBUTE_PRINTF_1 +#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ +extern void expdecl wxVLog##level(argclass arg, \ + const wxChar *szFormat, \ + va_list argptr); \ +extern void expdecl wxLog##level(argclass arg, \ + const wxChar *szFormat, \ + ...) ATTRIBUTE_PRINTF_2 +#else // !wxUSE_LOG + +// log functions do nothing at all +#define DECLARE_LOG_FUNCTION(level) \ +inline void wxVLog##level(const wxChar *WXUNUSED(szFormat), \ + va_list WXUNUSED(argptr)) { } \ +inline void wxLog##level(const wxChar *WXUNUSED(szFormat), \ + ...) { } +#define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl) \ +inline void wxVLog##level(argclass WXUNUSED(arg), \ + const wxChar *WXUNUSED(szFormat), \ + va_list WXUNUSED(argptr)) {} \ +inline void wxLog##level(argclass WXUNUSED(arg), \ + const wxChar *WXUNUSED(szFormat), \ + ...) { } + +// Empty Class to fake wxLogNull +class WXDLLIMPEXP_BASE wxLogNull +{ +public: + wxLogNull() { } +}; + +// Dummy macros to replace some functions. +#define wxSysErrorCode() (unsigned long)0 +#define wxSysErrorMsg( X ) (const wxChar*)NULL + +// Fake symbolic trace masks... for those that are used frequently +#define wxTRACE_OleCalls wxEmptyString // OLE interface calls + +#endif // wxUSE_LOG/!wxUSE_LOG + +#define DECLARE_LOG_FUNCTION2(level, argclass, arg) \ + DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, WXDLLIMPEXP_BASE) + + +// a generic function for all levels (level is passes as parameter) +DECLARE_LOG_FUNCTION2(Generic, wxLogLevel, level); + +// one function per each level +DECLARE_LOG_FUNCTION(FatalError); +DECLARE_LOG_FUNCTION(Error); +DECLARE_LOG_FUNCTION(Warning); +DECLARE_LOG_FUNCTION(Message); +DECLARE_LOG_FUNCTION(Info); +DECLARE_LOG_FUNCTION(Verbose); + +// this function sends the log message to the status line of the top level +// application frame, if any +DECLARE_LOG_FUNCTION(Status); + +#if wxUSE_GUI + // this one is the same as previous except that it allows to explicitly + class WXDLLIMPEXP_FWD_CORE wxFrame; + // specify the frame to which the output should go + DECLARE_LOG_FUNCTION2_EXP(Status, wxFrame *, pFrame, WXDLLIMPEXP_CORE); +#endif // wxUSE_GUI + +// additional one: as wxLogError, but also logs last system call error code +// and the corresponding error message if available +DECLARE_LOG_FUNCTION(SysError); + +// and another one which also takes the error code (for those broken APIs +// that don't set the errno (like registry APIs in Win32)) +DECLARE_LOG_FUNCTION2(SysError, long, lErrCode); + +// debug functions do nothing in release mode +#if wxUSE_LOG && wxUSE_LOG_DEBUG + DECLARE_LOG_FUNCTION(Debug); + + // there is no more unconditional LogTrace: it is not different from + // LogDebug and it creates overload ambiguities + //DECLARE_LOG_FUNCTION(Trace); + + // this version only logs the message if the mask had been added to the + // list of masks with AddTraceMask() + DECLARE_LOG_FUNCTION2(Trace, const wxChar *, mask); + + // and this one does nothing if all of level bits are not set in + // wxLog::GetActive()->GetTraceMask() -- it's deprecated in favour of + // string identifiers + DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask); +#else //!debug || !wxUSE_LOG + // these functions do nothing in release builds, but don't define them as + // nothing as it could result in different code structure in debug and + // release and this could result in trouble when these macros are used + // inside if/else + // + // note that making wxVLogDebug/Trace() themselves (empty inline) functions + // is a bad idea as some compilers are stupid enough to not inline even + // empty functions if their parameters are complicated enough, but by + // defining them as an empty inline function we ensure that even dumbest + // compilers optimise them away + inline void wxLogNop() { } + + #define wxVLogDebug(fmt, valist) wxLogNop() + #define wxVLogTrace(mask, fmt, valist) wxLogNop() + + #ifdef HAVE_VARIADIC_MACROS + // unlike the inline functions below, this completely removes the + // wxLogXXX calls from the object file: + #define wxLogDebug(fmt, ...) wxLogNop() + #define wxLogTrace(mask, fmt, ...) wxLogNop() + #else // !HAVE_VARIADIC_MACROS + // note that leaving out "fmt" in the vararg functions provokes a warning + // from SGI CC: "the last argument of the varargs function is unnamed" + inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); } + inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); } + inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); } + #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS +#endif // debug/!debug + +// wxLogFatalError helper: show the (fatal) error to the user in a safe way, +// i.e. without using wxMessageBox() for example because it could crash +void WXDLLIMPEXP_BASE +wxSafeShowMessage(const wxString& title, const wxString& text); + +// ---------------------------------------------------------------------------- +// debug only logging functions: use them with API name and error code +// ---------------------------------------------------------------------------- + +#ifdef __WXDEBUG__ + // make life easier for people using VC++ IDE: clicking on the message + // will take us immediately to the place of the failed API +#ifdef __VISUALC__ + #define wxLogApiError(api, rc) \ + wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ + __TFILE__, __LINE__, api, \ + (long)rc, wxSysErrorMsg(rc)) +#else // !VC++ + #define wxLogApiError(api, rc) \ + wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \ + wxT("error 0x%08lx (%s)."), \ + __TFILE__, __LINE__, api, \ + (long)rc, wxSysErrorMsg(rc)) +#endif // VC++/!VC++ + + #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) + +#else //!debug + #define wxLogApiError(api, err) wxLogNop() + #define wxLogLastError(api) wxLogNop() +#endif //debug/!debug + +// wxCocoa has additiional trace masks +#if defined(__WXCOCOA__) +#include "wx/cocoa/log.h" +#endif + +#endif // _WX_LOG_H_ + diff --git a/Externals/wxWidgets/include/wx/longlong.h b/Externals/wxWidgets/include/wx/longlong.h index 007340c9a5..bab44e92f2 100644 --- a/Externals/wxWidgets/include/wx/longlong.h +++ b/Externals/wxWidgets/include/wx/longlong.h @@ -1,1080 +1,1080 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/longlong.h -// Purpose: declaration of wxLongLong class - best implementation of a 64 -// bit integer for the current platform. -// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin -// Modified by: -// Created: 10.02.99 -// RCS-ID: $Id: longlong.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LONGLONG_H -#define _WX_LONGLONG_H - -#include "wx/defs.h" - -#if wxUSE_LONGLONG - -#include "wx/string.h" - -#include <limits.h> // for LONG_MAX - -// define this to compile wxLongLongWx in "test" mode: the results of all -// calculations will be compared with the real results taken from -// wxLongLongNative -- this is extremely useful to find the bugs in -// wxLongLongWx class! - -// #define wxLONGLONG_TEST_MODE - -#ifdef wxLONGLONG_TEST_MODE - #define wxUSE_LONGLONG_WX 1 - #define wxUSE_LONGLONG_NATIVE 1 -#endif // wxLONGLONG_TEST_MODE - -// ---------------------------------------------------------------------------- -// decide upon which class we will use -// ---------------------------------------------------------------------------- - -#ifndef wxLongLong_t - // both warning and pragma warning are not portable, but at least an - // unknown pragma should never be an error -- except that, actually, some - // broken compilers don't like it, so we have to disable it in this case - // <sigh> - #ifdef __GNUC__ - #warning "Your compiler does not appear to support 64 bit "\ - "integers, using emulation class instead.\n" \ - "Please report your compiler version to " \ - "wx-dev@lists.wxwidgets.org!" - #elif !(defined(__WATCOMC__) || defined(__VISAGECPP__)) - #pragma warning "Your compiler does not appear to support 64 bit "\ - "integers, using emulation class instead.\n" \ - "Please report your compiler version to " \ - "wx-dev@lists.wxwidgets.org!" - #endif - - #define wxUSE_LONGLONG_WX 1 -#endif // compiler - -// the user may predefine wxUSE_LONGLONG_NATIVE and/or wxUSE_LONGLONG_NATIVE -// to disable automatic testing (useful for the test program which defines -// both classes) but by default we only use one class -#if (defined(wxUSE_LONGLONG_WX) && wxUSE_LONGLONG_WX) || !defined(wxLongLong_t) - // don't use both classes unless wxUSE_LONGLONG_NATIVE was explicitly set: - // this is useful in test programs and only there - #ifndef wxUSE_LONGLONG_NATIVE - #define wxUSE_LONGLONG_NATIVE 0 - #endif - - class WXDLLIMPEXP_BASE wxLongLongWx; - class WXDLLIMPEXP_BASE wxULongLongWx; -#if defined(__VISUALC__) && !defined(__WIN32__) - #define wxLongLong wxLongLongWx - #define wxULongLong wxULongLongWx -#else - typedef wxLongLongWx wxLongLong; - typedef wxULongLongWx wxULongLong; -#endif - -#else - // if nothing is defined, use native implementation by default, of course - #ifndef wxUSE_LONGLONG_NATIVE - #define wxUSE_LONGLONG_NATIVE 1 - #endif -#endif - -#ifndef wxUSE_LONGLONG_WX - #define wxUSE_LONGLONG_WX 0 - class WXDLLIMPEXP_FWD_BASE wxLongLongNative; - class WXDLLIMPEXP_FWD_BASE wxULongLongNative; - typedef wxLongLongNative wxLongLong; - typedef wxULongLongNative wxULongLong; -#endif - -// NB: if both wxUSE_LONGLONG_WX and NATIVE are defined, the user code should -// typedef wxLongLong as it wants, we don't do it - -// ---------------------------------------------------------------------------- -// choose the appropriate class -// ---------------------------------------------------------------------------- - -// we use iostream for wxLongLong output -#include "wx/iosfwrap.h" - -#if wxUSE_LONGLONG_NATIVE - -class WXDLLIMPEXP_BASE wxLongLongNative -{ -public: - // ctors - // default ctor initializes to 0 - wxLongLongNative() : m_ll(0) { } - // from long long - wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { } - // from 2 longs - wxLongLongNative(long hi, unsigned long lo) : m_ll(0) - { - // assign first to avoid precision loss! - m_ll = ((wxLongLong_t) hi) << 32; - m_ll |= (wxLongLong_t) lo; - } -#if wxUSE_LONGLONG_WX - wxLongLongNative(wxLongLongWx ll); -#endif - - // default copy ctor is ok - - // no dtor - - // assignment operators - // from native 64 bit integer -#ifndef wxLongLongIsLong - wxLongLongNative& operator=(wxLongLong_t ll) - { m_ll = ll; return *this; } - wxLongLongNative& operator=(wxULongLong_t ll) - { m_ll = ll; return *this; } -#endif // !wxLongLongNative - wxLongLongNative& operator=(const wxULongLongNative &ll); - wxLongLongNative& operator=(int l) - { m_ll = l; return *this; } - wxLongLongNative& operator=(long l) - { m_ll = l; return *this; } - wxLongLongNative& operator=(unsigned int l) - { m_ll = l; return *this; } - wxLongLongNative& operator=(unsigned long l) - { m_ll = l; return *this; } -#if wxUSE_LONGLONG_WX - wxLongLongNative& operator=(wxLongLongWx ll); - wxLongLongNative& operator=(const class wxULongLongWx &ll); -#endif - - - // from double: this one has an explicit name because otherwise we - // would have ambiguity with "ll = int" and also because we don't want - // to have implicit conversions between doubles and wxLongLongs - wxLongLongNative& Assign(double d) - { m_ll = (wxLongLong_t)d; return *this; } - - // assignment operators from wxLongLongNative is ok - - // accessors - // get high part - long GetHi() const - { return wx_truncate_cast(long, m_ll >> 32); } - // get low part - unsigned long GetLo() const - { return wx_truncate_cast(unsigned long, m_ll); } - - // get absolute value - wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); } - wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; } - - // convert to native long long - wxLongLong_t GetValue() const { return m_ll; } - - // convert to long with range checking in debug mode (only!) - long ToLong() const - { - wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX), - _T("wxLongLong to long conversion loss of precision") ); - - return wx_truncate_cast(long, m_ll); - } - - // convert to double - double ToDouble() const { return wx_truncate_cast(double, m_ll); } - - // don't provide implicit conversion to wxLongLong_t or we will have an - // ambiguity for all arithmetic operations - //operator wxLongLong_t() const { return m_ll; } - - // operations - // addition - wxLongLongNative operator+(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll + ll.m_ll); } - wxLongLongNative& operator+=(const wxLongLongNative& ll) - { m_ll += ll.m_ll; return *this; } - - wxLongLongNative operator+(const wxLongLong_t ll) const - { return wxLongLongNative(m_ll + ll); } - wxLongLongNative& operator+=(const wxLongLong_t ll) - { m_ll += ll; return *this; } - - // pre increment - wxLongLongNative& operator++() - { m_ll++; return *this; } - - // post increment - wxLongLongNative operator++(int) - { wxLongLongNative value(*this); m_ll++; return value; } - - // negation operator - wxLongLongNative operator-() const - { return wxLongLongNative(-m_ll); } - wxLongLongNative& Negate() { m_ll = -m_ll; return *this; } - - // subtraction - wxLongLongNative operator-(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll - ll.m_ll); } - wxLongLongNative& operator-=(const wxLongLongNative& ll) - { m_ll -= ll.m_ll; return *this; } - - wxLongLongNative operator-(const wxLongLong_t ll) const - { return wxLongLongNative(m_ll - ll); } - wxLongLongNative& operator-=(const wxLongLong_t ll) - { m_ll -= ll; return *this; } - - // pre decrement - wxLongLongNative& operator--() - { m_ll--; return *this; } - - // post decrement - wxLongLongNative operator--(int) - { wxLongLongNative value(*this); m_ll--; return value; } - - // shifts - // left shift - wxLongLongNative operator<<(int shift) const - { return wxLongLongNative(m_ll << shift); } - wxLongLongNative& operator<<=(int shift) - { m_ll <<= shift; return *this; } - - // right shift - wxLongLongNative operator>>(int shift) const - { return wxLongLongNative(m_ll >> shift); } - wxLongLongNative& operator>>=(int shift) - { m_ll >>= shift; return *this; } - - // bitwise operators - wxLongLongNative operator&(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll & ll.m_ll); } - wxLongLongNative& operator&=(const wxLongLongNative& ll) - { m_ll &= ll.m_ll; return *this; } - - wxLongLongNative operator|(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll | ll.m_ll); } - wxLongLongNative& operator|=(const wxLongLongNative& ll) - { m_ll |= ll.m_ll; return *this; } - - wxLongLongNative operator^(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll ^ ll.m_ll); } - wxLongLongNative& operator^=(const wxLongLongNative& ll) - { m_ll ^= ll.m_ll; return *this; } - - // multiplication/division - wxLongLongNative operator*(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll * ll.m_ll); } - wxLongLongNative operator*(long l) const - { return wxLongLongNative(m_ll * l); } - wxLongLongNative& operator*=(const wxLongLongNative& ll) - { m_ll *= ll.m_ll; return *this; } - wxLongLongNative& operator*=(long l) - { m_ll *= l; return *this; } - - wxLongLongNative operator/(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll / ll.m_ll); } - wxLongLongNative operator/(long l) const - { return wxLongLongNative(m_ll / l); } - wxLongLongNative& operator/=(const wxLongLongNative& ll) - { m_ll /= ll.m_ll; return *this; } - wxLongLongNative& operator/=(long l) - { m_ll /= l; return *this; } - - wxLongLongNative operator%(const wxLongLongNative& ll) const - { return wxLongLongNative(m_ll % ll.m_ll); } - wxLongLongNative operator%(long l) const - { return wxLongLongNative(m_ll % l); } - - // comparison - bool operator==(const wxLongLongNative& ll) const - { return m_ll == ll.m_ll; } - bool operator==(long l) const - { return m_ll == l; } - bool operator!=(const wxLongLongNative& ll) const - { return m_ll != ll.m_ll; } - bool operator!=(long l) const - { return m_ll != l; } - bool operator<(const wxLongLongNative& ll) const - { return m_ll < ll.m_ll; } - bool operator<(long l) const - { return m_ll < l; } - bool operator>(const wxLongLongNative& ll) const - { return m_ll > ll.m_ll; } - bool operator>(long l) const - { return m_ll > l; } - bool operator<=(const wxLongLongNative& ll) const - { return m_ll <= ll.m_ll; } - bool operator<=(long l) const - { return m_ll <= l; } - bool operator>=(const wxLongLongNative& ll) const - { return m_ll >= ll.m_ll; } - bool operator>=(long l) const - { return m_ll >= l; } - - // miscellaneous - - // return the string representation of this number - wxString ToString() const; - - // conversion to byte array: returns a pointer to static buffer! - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - // input/output - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&); -#endif - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxLongLongNative&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongNative&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongNative&); -#endif - -private: - wxLongLong_t m_ll; -}; - - -class WXDLLIMPEXP_BASE wxULongLongNative -{ -public: - // ctors - // default ctor initializes to 0 - wxULongLongNative() : m_ll(0) { } - // from long long - wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { } - // from 2 longs - wxULongLongNative(unsigned long hi, unsigned long lo) : m_ll(0) - { - // assign first to avoid precision loss! - m_ll = ((wxULongLong_t) hi) << 32; - m_ll |= (wxULongLong_t) lo; - } - -#if wxUSE_LONGLONG_WX - wxULongLongNative(const class wxULongLongWx &ll); -#endif - - // default copy ctor is ok - - // no dtor - - // assignment operators - // from native 64 bit integer -#ifndef wxLongLongIsLong - wxULongLongNative& operator=(wxULongLong_t ll) - { m_ll = ll; return *this; } - wxULongLongNative& operator=(wxLongLong_t ll) - { m_ll = ll; return *this; } -#endif // !wxLongLongNative - wxULongLongNative& operator=(int l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(long l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(unsigned int l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(unsigned long l) - { m_ll = l; return *this; } - wxULongLongNative& operator=(const wxLongLongNative &ll) - { m_ll = ll.GetValue(); return *this; } -#if wxUSE_LONGLONG_WX - wxULongLongNative& operator=(wxLongLongWx ll); - wxULongLongNative& operator=(const class wxULongLongWx &ll); -#endif - - // assignment operators from wxULongLongNative is ok - - // accessors - // get high part - unsigned long GetHi() const - { return wx_truncate_cast(unsigned long, m_ll >> 32); } - // get low part - unsigned long GetLo() const - { return wx_truncate_cast(unsigned long, m_ll); } - - // convert to native ulong long - wxULongLong_t GetValue() const { return m_ll; } - - // convert to ulong with range checking in debug mode (only!) - unsigned long ToULong() const - { - wxASSERT_MSG( m_ll <= LONG_MAX, - _T("wxULongLong to long conversion loss of precision") ); - - return wx_truncate_cast(unsigned long, m_ll); - } - - // convert to double -#ifdef _MSC_VER - double ToDouble() const { return wx_truncate_cast(double, (__int64) m_ll); } -#else - double ToDouble() const { return wx_truncate_cast(double, m_ll); } -#endif - - // operations - // addition - wxULongLongNative operator+(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll + ll.m_ll); } - wxULongLongNative& operator+=(const wxULongLongNative& ll) - { m_ll += ll.m_ll; return *this; } - - wxULongLongNative operator+(const wxULongLong_t ll) const - { return wxULongLongNative(m_ll + ll); } - wxULongLongNative& operator+=(const wxULongLong_t ll) - { m_ll += ll; return *this; } - - // pre increment - wxULongLongNative& operator++() - { m_ll++; return *this; } - - // post increment - wxULongLongNative operator++(int) - { wxULongLongNative value(*this); m_ll++; return value; } - - // subtraction - wxULongLongNative operator-(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll - ll.m_ll); } - wxULongLongNative& operator-=(const wxULongLongNative& ll) - { m_ll -= ll.m_ll; return *this; } - - wxULongLongNative operator-(const wxULongLong_t ll) const - { return wxULongLongNative(m_ll - ll); } - wxULongLongNative& operator-=(const wxULongLong_t ll) - { m_ll -= ll; return *this; } - - // pre decrement - wxULongLongNative& operator--() - { m_ll--; return *this; } - - // post decrement - wxULongLongNative operator--(int) - { wxULongLongNative value(*this); m_ll--; return value; } - - // shifts - // left shift - wxULongLongNative operator<<(int shift) const - { return wxULongLongNative(m_ll << shift); } - wxULongLongNative& operator<<=(int shift) - { m_ll <<= shift; return *this; } - - // right shift - wxULongLongNative operator>>(int shift) const - { return wxULongLongNative(m_ll >> shift); } - wxULongLongNative& operator>>=(int shift) - { m_ll >>= shift; return *this; } - - // bitwise operators - wxULongLongNative operator&(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll & ll.m_ll); } - wxULongLongNative& operator&=(const wxULongLongNative& ll) - { m_ll &= ll.m_ll; return *this; } - - wxULongLongNative operator|(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll | ll.m_ll); } - wxULongLongNative& operator|=(const wxULongLongNative& ll) - { m_ll |= ll.m_ll; return *this; } - - wxULongLongNative operator^(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll ^ ll.m_ll); } - wxULongLongNative& operator^=(const wxULongLongNative& ll) - { m_ll ^= ll.m_ll; return *this; } - - // multiplication/division - wxULongLongNative operator*(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll * ll.m_ll); } - wxULongLongNative operator*(unsigned long l) const - { return wxULongLongNative(m_ll * l); } - wxULongLongNative& operator*=(const wxULongLongNative& ll) - { m_ll *= ll.m_ll; return *this; } - wxULongLongNative& operator*=(unsigned long l) - { m_ll *= l; return *this; } - - wxULongLongNative operator/(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll / ll.m_ll); } - wxULongLongNative operator/(unsigned long l) const - { return wxULongLongNative(m_ll / l); } - wxULongLongNative& operator/=(const wxULongLongNative& ll) - { m_ll /= ll.m_ll; return *this; } - wxULongLongNative& operator/=(unsigned long l) - { m_ll /= l; return *this; } - - wxULongLongNative operator%(const wxULongLongNative& ll) const - { return wxULongLongNative(m_ll % ll.m_ll); } - wxULongLongNative operator%(unsigned long l) const - { return wxULongLongNative(m_ll % l); } - - // comparison - bool operator==(const wxULongLongNative& ll) const - { return m_ll == ll.m_ll; } - bool operator==(unsigned long l) const - { return m_ll == l; } - bool operator!=(const wxULongLongNative& ll) const - { return m_ll != ll.m_ll; } - bool operator!=(unsigned long l) const - { return m_ll != l; } - bool operator<(const wxULongLongNative& ll) const - { return m_ll < ll.m_ll; } - bool operator<(unsigned long l) const - { return m_ll < l; } - bool operator>(const wxULongLongNative& ll) const - { return m_ll > ll.m_ll; } - bool operator>(unsigned long l) const - { return m_ll > l; } - bool operator<=(const wxULongLongNative& ll) const - { return m_ll <= ll.m_ll; } - bool operator<=(unsigned long l) const - { return m_ll <= l; } - bool operator>=(const wxULongLongNative& ll) const - { return m_ll >= ll.m_ll; } - bool operator>=(unsigned long l) const - { return m_ll >= l; } - - // miscellaneous - - // return the string representation of this number - wxString ToString() const; - - // conversion to byte array: returns a pointer to static buffer! - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - // input/output - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&); -#endif - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxULongLongNative&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongNative&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongNative&); -#endif - -private: - wxULongLong_t m_ll; -}; - -inline -wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll) -{ - m_ll = ll.GetValue(); - return *this; -} - -#endif // wxUSE_LONGLONG_NATIVE - -#if wxUSE_LONGLONG_WX - -class WXDLLIMPEXP_BASE wxLongLongWx -{ -public: - // ctors - // default ctor initializes to 0 - wxLongLongWx() - { - m_lo = m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = 0; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - // from long - wxLongLongWx(long l) { *this = l; } - // from 2 longs - wxLongLongWx(long hi, unsigned long lo) - { - m_hi = hi; - m_lo = lo; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = hi; - m_ll <<= 32; - m_ll |= lo; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - - // default copy ctor is ok in both cases - - // no dtor - - // assignment operators - // from long - wxLongLongWx& operator=(long l) - { - m_lo = l; - m_hi = (l < 0 ? -1l : 0l); - -#ifdef wxLONGLONG_TEST_MODE - m_ll = l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - // from int - wxLongLongWx& operator=(int l) - { - return operator=((long)l); - } - - wxLongLongWx& operator=(unsigned long l) - { - m_lo = l; - m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - - wxLongLongWx& operator=(unsigned int l) - { - return operator=((unsigned long)l); - } - - wxLongLongWx& operator=(const class wxULongLongWx &ll); - - // from double - wxLongLongWx& Assign(double d); - // can't have assignment operator from 2 longs - - // accessors - // get high part - long GetHi() const { return m_hi; } - // get low part - unsigned long GetLo() const { return m_lo; } - - // get absolute value - wxLongLongWx Abs() const { return wxLongLongWx(*this).Abs(); } - wxLongLongWx& Abs() - { - if ( m_hi < 0 ) - m_hi = -m_hi; - -#ifdef wxLONGLONG_TEST_MODE - if ( m_ll < 0 ) - m_ll = -m_ll; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - - // convert to long with range checking in debug mode (only!) - long ToLong() const - { - wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l), - _T("wxLongLong to long conversion loss of precision") ); - - return (long)m_lo; - } - - // convert to double - double ToDouble() const; - - // operations - // addition - wxLongLongWx operator+(const wxLongLongWx& ll) const; - wxLongLongWx& operator+=(const wxLongLongWx& ll); - wxLongLongWx operator+(long l) const; - wxLongLongWx& operator+=(long l); - - // pre increment operator - wxLongLongWx& operator++(); - - // post increment operator - wxLongLongWx& operator++(int) { return ++(*this); } - - // negation operator - wxLongLongWx operator-() const; - wxLongLongWx& Negate(); - - // subraction - wxLongLongWx operator-(const wxLongLongWx& ll) const; - wxLongLongWx& operator-=(const wxLongLongWx& ll); - - // pre decrement operator - wxLongLongWx& operator--(); - - // post decrement operator - wxLongLongWx& operator--(int) { return --(*this); } - - // shifts - // left shift - wxLongLongWx operator<<(int shift) const; - wxLongLongWx& operator<<=(int shift); - - // right shift - wxLongLongWx operator>>(int shift) const; - wxLongLongWx& operator>>=(int shift); - - // bitwise operators - wxLongLongWx operator&(const wxLongLongWx& ll) const; - wxLongLongWx& operator&=(const wxLongLongWx& ll); - wxLongLongWx operator|(const wxLongLongWx& ll) const; - wxLongLongWx& operator|=(const wxLongLongWx& ll); - wxLongLongWx operator^(const wxLongLongWx& ll) const; - wxLongLongWx& operator^=(const wxLongLongWx& ll); - wxLongLongWx operator~() const; - - // comparison - bool operator==(const wxLongLongWx& ll) const - { return m_lo == ll.m_lo && m_hi == ll.m_hi; } -#if wxUSE_LONGLONG_NATIVE - bool operator==(const wxLongLongNative& ll) const - { return m_lo == ll.GetLo() && m_hi == ll.GetHi(); } -#endif - bool operator!=(const wxLongLongWx& ll) const - { return !(*this == ll); } - bool operator<(const wxLongLongWx& ll) const; - bool operator>(const wxLongLongWx& ll) const; - bool operator<=(const wxLongLongWx& ll) const - { return *this < ll || *this == ll; } - bool operator>=(const wxLongLongWx& ll) const - { return *this > ll || *this == ll; } - - bool operator<(long l) const { return *this < wxLongLongWx(l); } - bool operator>(long l) const { return *this > wxLongLongWx(l); } - bool operator==(long l) const - { - return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l) - : (m_hi == -1 && m_lo == (unsigned long)l); - } - - bool operator<=(long l) const { return *this < l || *this == l; } - bool operator>=(long l) const { return *this > l || *this == l; } - - // multiplication - wxLongLongWx operator*(const wxLongLongWx& ll) const; - wxLongLongWx& operator*=(const wxLongLongWx& ll); - - // division - wxLongLongWx operator/(const wxLongLongWx& ll) const; - wxLongLongWx& operator/=(const wxLongLongWx& ll); - - wxLongLongWx operator%(const wxLongLongWx& ll) const; - - void Divide(const wxLongLongWx& divisor, - wxLongLongWx& quotient, - wxLongLongWx& remainder) const; - - // input/output - - // return the string representation of this number - wxString ToString() const; - - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&); -#endif // wxUSE_STD_IOSTREAM - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxLongLongWx&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&); -#endif - -private: - // long is at least 32 bits, so represent our 64bit number as 2 longs - - long m_hi; // signed bit is in the high part - unsigned long m_lo; - -#ifdef wxLONGLONG_TEST_MODE - void Check() - { - wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); - } - - wxLongLong_t m_ll; -#endif // wxLONGLONG_TEST_MODE -}; - - -class WXDLLIMPEXP_BASE wxULongLongWx -{ -public: - // ctors - // default ctor initializes to 0 - wxULongLongWx() - { - m_lo = m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = 0; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - // from ulong - wxULongLongWx(unsigned long l) { *this = l; } - // from 2 ulongs - wxULongLongWx(unsigned long hi, unsigned long lo) - { - m_hi = hi; - m_lo = lo; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = hi; - m_ll <<= 32; - m_ll |= lo; - - Check(); -#endif // wxLONGLONG_TEST_MODE - } - - // from signed to unsigned - wxULongLongWx(wxLongLongWx ll) - { - wxASSERT(ll.GetHi() >= 0); - m_hi = (unsigned long)ll.GetHi(); - m_lo = ll.GetLo(); - } - - // default copy ctor is ok in both cases - - // no dtor - - // assignment operators - // from long - wxULongLongWx& operator=(unsigned long l) - { - m_lo = l; - m_hi = 0; - -#ifdef wxLONGLONG_TEST_MODE - m_ll = l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - wxULongLongWx& operator=(long l) - { - m_lo = l; - m_hi = (unsigned long) ((l<0) ? -1l : 0); - -#ifdef wxLONGLONG_TEST_MODE - m_ll = (wxULongLong_t) (wxLongLong_t) l; - - Check(); -#endif // wxLONGLONG_TEST_MODE - - return *this; - } - wxULongLongWx& operator=(const class wxLongLongWx &ll) { - // Should we use an assert like it was before in the constructor? - // wxASSERT(ll.GetHi() >= 0); - m_hi = (unsigned long)ll.GetHi(); - m_lo = ll.GetLo(); - return *this; - } - - // can't have assignment operator from 2 longs - - // accessors - // get high part - unsigned long GetHi() const { return m_hi; } - // get low part - unsigned long GetLo() const { return m_lo; } - - // convert to long with range checking in debug mode (only!) - unsigned long ToULong() const - { - wxASSERT_MSG( m_hi == 0ul, - _T("wxULongLong to long conversion loss of precision") ); - - return (unsigned long)m_lo; - } - - // convert to double - double ToDouble() const; - - // operations - // addition - wxULongLongWx operator+(const wxULongLongWx& ll) const; - wxULongLongWx& operator+=(const wxULongLongWx& ll); - wxULongLongWx operator+(unsigned long l) const; - wxULongLongWx& operator+=(unsigned long l); - - // pre increment operator - wxULongLongWx& operator++(); - - // post increment operator - wxULongLongWx& operator++(int) { return ++(*this); } - - // subtraction - wxLongLongWx operator-(const wxULongLongWx& ll) const; - wxULongLongWx& operator-=(const wxULongLongWx& ll); - - // pre decrement operator - wxULongLongWx& operator--(); - - // post decrement operator - wxULongLongWx& operator--(int) { return --(*this); } - - // shifts - // left shift - wxULongLongWx operator<<(int shift) const; - wxULongLongWx& operator<<=(int shift); - - // right shift - wxULongLongWx operator>>(int shift) const; - wxULongLongWx& operator>>=(int shift); - - // bitwise operators - wxULongLongWx operator&(const wxULongLongWx& ll) const; - wxULongLongWx& operator&=(const wxULongLongWx& ll); - wxULongLongWx operator|(const wxULongLongWx& ll) const; - wxULongLongWx& operator|=(const wxULongLongWx& ll); - wxULongLongWx operator^(const wxULongLongWx& ll) const; - wxULongLongWx& operator^=(const wxULongLongWx& ll); - wxULongLongWx operator~() const; - - // comparison - bool operator==(const wxULongLongWx& ll) const - { return m_lo == ll.m_lo && m_hi == ll.m_hi; } - bool operator!=(const wxULongLongWx& ll) const - { return !(*this == ll); } - bool operator<(const wxULongLongWx& ll) const; - bool operator>(const wxULongLongWx& ll) const; - bool operator<=(const wxULongLongWx& ll) const - { return *this < ll || *this == ll; } - bool operator>=(const wxULongLongWx& ll) const - { return *this > ll || *this == ll; } - - bool operator<(unsigned long l) const { return *this < wxULongLongWx(l); } - bool operator>(unsigned long l) const { return *this > wxULongLongWx(l); } - bool operator==(unsigned long l) const - { - return (m_hi == 0 && m_lo == (unsigned long)l); - } - - bool operator<=(unsigned long l) const { return *this < l || *this == l; } - bool operator>=(unsigned long l) const { return *this > l || *this == l; } - - // multiplication - wxULongLongWx operator*(const wxULongLongWx& ll) const; - wxULongLongWx& operator*=(const wxULongLongWx& ll); - - // division - wxULongLongWx operator/(const wxULongLongWx& ll) const; - wxULongLongWx& operator/=(const wxULongLongWx& ll); - - wxULongLongWx operator%(const wxULongLongWx& ll) const; - - void Divide(const wxULongLongWx& divisor, - wxULongLongWx& quotient, - wxULongLongWx& remainder) const; - - // input/output - - // return the string representation of this number - wxString ToString() const; - - void *asArray() const; - -#if wxUSE_STD_IOSTREAM - friend WXDLLIMPEXP_BASE - wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&); -#endif // wxUSE_STD_IOSTREAM - - friend WXDLLIMPEXP_BASE - wxString& operator<<(wxString&, const wxULongLongWx&); - -#if wxUSE_STREAMS - friend WXDLLIMPEXP_BASE - class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&); - friend WXDLLIMPEXP_BASE - class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&); -#endif - -private: - // long is at least 32 bits, so represent our 64bit number as 2 longs - - unsigned long m_hi; - unsigned long m_lo; - -#ifdef wxLONGLONG_TEST_MODE - void Check() - { - wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); - } - - wxULongLong_t m_ll; -#endif // wxLONGLONG_TEST_MODE -}; - -#endif // wxUSE_LONGLONG_WX - -// ---------------------------------------------------------------------------- -// binary operators -// ---------------------------------------------------------------------------- - -inline bool operator<(long l, const wxLongLong& ll) { return ll > l; } -inline bool operator>(long l, const wxLongLong& ll) { return ll < l; } -inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; } -inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; } -inline bool operator==(long l, const wxLongLong& ll) { return ll == l; } -inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; } - -inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; } -inline wxLongLong operator-(long l, const wxLongLong& ll) -{ - return wxLongLong(l) - ll; -} - -inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; } -inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; } -inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; } -inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; } -inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; } -inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; } - -inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; } - -inline wxLongLong operator-(unsigned long l, const wxULongLong& ull) -{ - wxULongLong ret = wxULongLong(l) - ull; - return wxLongLong((long)ret.GetHi(),ret.GetLo()); -} - -#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS - -WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value); -WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value); - -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value); -WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value); - -#endif - -#endif // wxUSE_LONGLONG - -#endif // _WX_LONGLONG_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/longlong.h +// Purpose: declaration of wxLongLong class - best implementation of a 64 +// bit integer for the current platform. +// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin +// Modified by: +// Created: 10.02.99 +// RCS-ID: $Id: longlong.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LONGLONG_H +#define _WX_LONGLONG_H + +#include "wx/defs.h" + +#if wxUSE_LONGLONG + +#include "wx/string.h" + +#include <limits.h> // for LONG_MAX + +// define this to compile wxLongLongWx in "test" mode: the results of all +// calculations will be compared with the real results taken from +// wxLongLongNative -- this is extremely useful to find the bugs in +// wxLongLongWx class! + +// #define wxLONGLONG_TEST_MODE + +#ifdef wxLONGLONG_TEST_MODE + #define wxUSE_LONGLONG_WX 1 + #define wxUSE_LONGLONG_NATIVE 1 +#endif // wxLONGLONG_TEST_MODE + +// ---------------------------------------------------------------------------- +// decide upon which class we will use +// ---------------------------------------------------------------------------- + +#ifndef wxLongLong_t + // both warning and pragma warning are not portable, but at least an + // unknown pragma should never be an error -- except that, actually, some + // broken compilers don't like it, so we have to disable it in this case + // <sigh> + #ifdef __GNUC__ + #warning "Your compiler does not appear to support 64 bit "\ + "integers, using emulation class instead.\n" \ + "Please report your compiler version to " \ + "wx-dev@lists.wxwidgets.org!" + #elif !(defined(__WATCOMC__) || defined(__VISAGECPP__)) + #pragma warning "Your compiler does not appear to support 64 bit "\ + "integers, using emulation class instead.\n" \ + "Please report your compiler version to " \ + "wx-dev@lists.wxwidgets.org!" + #endif + + #define wxUSE_LONGLONG_WX 1 +#endif // compiler + +// the user may predefine wxUSE_LONGLONG_NATIVE and/or wxUSE_LONGLONG_NATIVE +// to disable automatic testing (useful for the test program which defines +// both classes) but by default we only use one class +#if (defined(wxUSE_LONGLONG_WX) && wxUSE_LONGLONG_WX) || !defined(wxLongLong_t) + // don't use both classes unless wxUSE_LONGLONG_NATIVE was explicitly set: + // this is useful in test programs and only there + #ifndef wxUSE_LONGLONG_NATIVE + #define wxUSE_LONGLONG_NATIVE 0 + #endif + + class WXDLLIMPEXP_BASE wxLongLongWx; + class WXDLLIMPEXP_BASE wxULongLongWx; +#if defined(__VISUALC__) && !defined(__WIN32__) + #define wxLongLong wxLongLongWx + #define wxULongLong wxULongLongWx +#else + typedef wxLongLongWx wxLongLong; + typedef wxULongLongWx wxULongLong; +#endif + +#else + // if nothing is defined, use native implementation by default, of course + #ifndef wxUSE_LONGLONG_NATIVE + #define wxUSE_LONGLONG_NATIVE 1 + #endif +#endif + +#ifndef wxUSE_LONGLONG_WX + #define wxUSE_LONGLONG_WX 0 + class WXDLLIMPEXP_FWD_BASE wxLongLongNative; + class WXDLLIMPEXP_FWD_BASE wxULongLongNative; + typedef wxLongLongNative wxLongLong; + typedef wxULongLongNative wxULongLong; +#endif + +// NB: if both wxUSE_LONGLONG_WX and NATIVE are defined, the user code should +// typedef wxLongLong as it wants, we don't do it + +// ---------------------------------------------------------------------------- +// choose the appropriate class +// ---------------------------------------------------------------------------- + +// we use iostream for wxLongLong output +#include "wx/iosfwrap.h" + +#if wxUSE_LONGLONG_NATIVE + +class WXDLLIMPEXP_BASE wxLongLongNative +{ +public: + // ctors + // default ctor initializes to 0 + wxLongLongNative() : m_ll(0) { } + // from long long + wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { } + // from 2 longs + wxLongLongNative(long hi, unsigned long lo) : m_ll(0) + { + // assign first to avoid precision loss! + m_ll = ((wxLongLong_t) hi) << 32; + m_ll |= (wxLongLong_t) lo; + } +#if wxUSE_LONGLONG_WX + wxLongLongNative(wxLongLongWx ll); +#endif + + // default copy ctor is ok + + // no dtor + + // assignment operators + // from native 64 bit integer +#ifndef wxLongLongIsLong + wxLongLongNative& operator=(wxLongLong_t ll) + { m_ll = ll; return *this; } + wxLongLongNative& operator=(wxULongLong_t ll) + { m_ll = ll; return *this; } +#endif // !wxLongLongNative + wxLongLongNative& operator=(const wxULongLongNative &ll); + wxLongLongNative& operator=(int l) + { m_ll = l; return *this; } + wxLongLongNative& operator=(long l) + { m_ll = l; return *this; } + wxLongLongNative& operator=(unsigned int l) + { m_ll = l; return *this; } + wxLongLongNative& operator=(unsigned long l) + { m_ll = l; return *this; } +#if wxUSE_LONGLONG_WX + wxLongLongNative& operator=(wxLongLongWx ll); + wxLongLongNative& operator=(const class wxULongLongWx &ll); +#endif + + + // from double: this one has an explicit name because otherwise we + // would have ambiguity with "ll = int" and also because we don't want + // to have implicit conversions between doubles and wxLongLongs + wxLongLongNative& Assign(double d) + { m_ll = (wxLongLong_t)d; return *this; } + + // assignment operators from wxLongLongNative is ok + + // accessors + // get high part + long GetHi() const + { return wx_truncate_cast(long, m_ll >> 32); } + // get low part + unsigned long GetLo() const + { return wx_truncate_cast(unsigned long, m_ll); } + + // get absolute value + wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); } + wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; } + + // convert to native long long + wxLongLong_t GetValue() const { return m_ll; } + + // convert to long with range checking in debug mode (only!) + long ToLong() const + { + wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX), + _T("wxLongLong to long conversion loss of precision") ); + + return wx_truncate_cast(long, m_ll); + } + + // convert to double + double ToDouble() const { return wx_truncate_cast(double, m_ll); } + + // don't provide implicit conversion to wxLongLong_t or we will have an + // ambiguity for all arithmetic operations + //operator wxLongLong_t() const { return m_ll; } + + // operations + // addition + wxLongLongNative operator+(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll + ll.m_ll); } + wxLongLongNative& operator+=(const wxLongLongNative& ll) + { m_ll += ll.m_ll; return *this; } + + wxLongLongNative operator+(const wxLongLong_t ll) const + { return wxLongLongNative(m_ll + ll); } + wxLongLongNative& operator+=(const wxLongLong_t ll) + { m_ll += ll; return *this; } + + // pre increment + wxLongLongNative& operator++() + { m_ll++; return *this; } + + // post increment + wxLongLongNative operator++(int) + { wxLongLongNative value(*this); m_ll++; return value; } + + // negation operator + wxLongLongNative operator-() const + { return wxLongLongNative(-m_ll); } + wxLongLongNative& Negate() { m_ll = -m_ll; return *this; } + + // subtraction + wxLongLongNative operator-(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll - ll.m_ll); } + wxLongLongNative& operator-=(const wxLongLongNative& ll) + { m_ll -= ll.m_ll; return *this; } + + wxLongLongNative operator-(const wxLongLong_t ll) const + { return wxLongLongNative(m_ll - ll); } + wxLongLongNative& operator-=(const wxLongLong_t ll) + { m_ll -= ll; return *this; } + + // pre decrement + wxLongLongNative& operator--() + { m_ll--; return *this; } + + // post decrement + wxLongLongNative operator--(int) + { wxLongLongNative value(*this); m_ll--; return value; } + + // shifts + // left shift + wxLongLongNative operator<<(int shift) const + { return wxLongLongNative(m_ll << shift); } + wxLongLongNative& operator<<=(int shift) + { m_ll <<= shift; return *this; } + + // right shift + wxLongLongNative operator>>(int shift) const + { return wxLongLongNative(m_ll >> shift); } + wxLongLongNative& operator>>=(int shift) + { m_ll >>= shift; return *this; } + + // bitwise operators + wxLongLongNative operator&(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll & ll.m_ll); } + wxLongLongNative& operator&=(const wxLongLongNative& ll) + { m_ll &= ll.m_ll; return *this; } + + wxLongLongNative operator|(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll | ll.m_ll); } + wxLongLongNative& operator|=(const wxLongLongNative& ll) + { m_ll |= ll.m_ll; return *this; } + + wxLongLongNative operator^(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll ^ ll.m_ll); } + wxLongLongNative& operator^=(const wxLongLongNative& ll) + { m_ll ^= ll.m_ll; return *this; } + + // multiplication/division + wxLongLongNative operator*(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll * ll.m_ll); } + wxLongLongNative operator*(long l) const + { return wxLongLongNative(m_ll * l); } + wxLongLongNative& operator*=(const wxLongLongNative& ll) + { m_ll *= ll.m_ll; return *this; } + wxLongLongNative& operator*=(long l) + { m_ll *= l; return *this; } + + wxLongLongNative operator/(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll / ll.m_ll); } + wxLongLongNative operator/(long l) const + { return wxLongLongNative(m_ll / l); } + wxLongLongNative& operator/=(const wxLongLongNative& ll) + { m_ll /= ll.m_ll; return *this; } + wxLongLongNative& operator/=(long l) + { m_ll /= l; return *this; } + + wxLongLongNative operator%(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll % ll.m_ll); } + wxLongLongNative operator%(long l) const + { return wxLongLongNative(m_ll % l); } + + // comparison + bool operator==(const wxLongLongNative& ll) const + { return m_ll == ll.m_ll; } + bool operator==(long l) const + { return m_ll == l; } + bool operator!=(const wxLongLongNative& ll) const + { return m_ll != ll.m_ll; } + bool operator!=(long l) const + { return m_ll != l; } + bool operator<(const wxLongLongNative& ll) const + { return m_ll < ll.m_ll; } + bool operator<(long l) const + { return m_ll < l; } + bool operator>(const wxLongLongNative& ll) const + { return m_ll > ll.m_ll; } + bool operator>(long l) const + { return m_ll > l; } + bool operator<=(const wxLongLongNative& ll) const + { return m_ll <= ll.m_ll; } + bool operator<=(long l) const + { return m_ll <= l; } + bool operator>=(const wxLongLongNative& ll) const + { return m_ll >= ll.m_ll; } + bool operator>=(long l) const + { return m_ll >= l; } + + // miscellaneous + + // return the string representation of this number + wxString ToString() const; + + // conversion to byte array: returns a pointer to static buffer! + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + // input/output + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&); +#endif + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxLongLongNative&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongNative&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongNative&); +#endif + +private: + wxLongLong_t m_ll; +}; + + +class WXDLLIMPEXP_BASE wxULongLongNative +{ +public: + // ctors + // default ctor initializes to 0 + wxULongLongNative() : m_ll(0) { } + // from long long + wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { } + // from 2 longs + wxULongLongNative(unsigned long hi, unsigned long lo) : m_ll(0) + { + // assign first to avoid precision loss! + m_ll = ((wxULongLong_t) hi) << 32; + m_ll |= (wxULongLong_t) lo; + } + +#if wxUSE_LONGLONG_WX + wxULongLongNative(const class wxULongLongWx &ll); +#endif + + // default copy ctor is ok + + // no dtor + + // assignment operators + // from native 64 bit integer +#ifndef wxLongLongIsLong + wxULongLongNative& operator=(wxULongLong_t ll) + { m_ll = ll; return *this; } + wxULongLongNative& operator=(wxLongLong_t ll) + { m_ll = ll; return *this; } +#endif // !wxLongLongNative + wxULongLongNative& operator=(int l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(long l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(unsigned int l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(unsigned long l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(const wxLongLongNative &ll) + { m_ll = ll.GetValue(); return *this; } +#if wxUSE_LONGLONG_WX + wxULongLongNative& operator=(wxLongLongWx ll); + wxULongLongNative& operator=(const class wxULongLongWx &ll); +#endif + + // assignment operators from wxULongLongNative is ok + + // accessors + // get high part + unsigned long GetHi() const + { return wx_truncate_cast(unsigned long, m_ll >> 32); } + // get low part + unsigned long GetLo() const + { return wx_truncate_cast(unsigned long, m_ll); } + + // convert to native ulong long + wxULongLong_t GetValue() const { return m_ll; } + + // convert to ulong with range checking in debug mode (only!) + unsigned long ToULong() const + { + wxASSERT_MSG( m_ll <= LONG_MAX, + _T("wxULongLong to long conversion loss of precision") ); + + return wx_truncate_cast(unsigned long, m_ll); + } + + // convert to double +#ifdef _MSC_VER + double ToDouble() const { return wx_truncate_cast(double, (__int64) m_ll); } +#else + double ToDouble() const { return wx_truncate_cast(double, m_ll); } +#endif + + // operations + // addition + wxULongLongNative operator+(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll + ll.m_ll); } + wxULongLongNative& operator+=(const wxULongLongNative& ll) + { m_ll += ll.m_ll; return *this; } + + wxULongLongNative operator+(const wxULongLong_t ll) const + { return wxULongLongNative(m_ll + ll); } + wxULongLongNative& operator+=(const wxULongLong_t ll) + { m_ll += ll; return *this; } + + // pre increment + wxULongLongNative& operator++() + { m_ll++; return *this; } + + // post increment + wxULongLongNative operator++(int) + { wxULongLongNative value(*this); m_ll++; return value; } + + // subtraction + wxULongLongNative operator-(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll - ll.m_ll); } + wxULongLongNative& operator-=(const wxULongLongNative& ll) + { m_ll -= ll.m_ll; return *this; } + + wxULongLongNative operator-(const wxULongLong_t ll) const + { return wxULongLongNative(m_ll - ll); } + wxULongLongNative& operator-=(const wxULongLong_t ll) + { m_ll -= ll; return *this; } + + // pre decrement + wxULongLongNative& operator--() + { m_ll--; return *this; } + + // post decrement + wxULongLongNative operator--(int) + { wxULongLongNative value(*this); m_ll--; return value; } + + // shifts + // left shift + wxULongLongNative operator<<(int shift) const + { return wxULongLongNative(m_ll << shift); } + wxULongLongNative& operator<<=(int shift) + { m_ll <<= shift; return *this; } + + // right shift + wxULongLongNative operator>>(int shift) const + { return wxULongLongNative(m_ll >> shift); } + wxULongLongNative& operator>>=(int shift) + { m_ll >>= shift; return *this; } + + // bitwise operators + wxULongLongNative operator&(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll & ll.m_ll); } + wxULongLongNative& operator&=(const wxULongLongNative& ll) + { m_ll &= ll.m_ll; return *this; } + + wxULongLongNative operator|(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll | ll.m_ll); } + wxULongLongNative& operator|=(const wxULongLongNative& ll) + { m_ll |= ll.m_ll; return *this; } + + wxULongLongNative operator^(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll ^ ll.m_ll); } + wxULongLongNative& operator^=(const wxULongLongNative& ll) + { m_ll ^= ll.m_ll; return *this; } + + // multiplication/division + wxULongLongNative operator*(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll * ll.m_ll); } + wxULongLongNative operator*(unsigned long l) const + { return wxULongLongNative(m_ll * l); } + wxULongLongNative& operator*=(const wxULongLongNative& ll) + { m_ll *= ll.m_ll; return *this; } + wxULongLongNative& operator*=(unsigned long l) + { m_ll *= l; return *this; } + + wxULongLongNative operator/(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll / ll.m_ll); } + wxULongLongNative operator/(unsigned long l) const + { return wxULongLongNative(m_ll / l); } + wxULongLongNative& operator/=(const wxULongLongNative& ll) + { m_ll /= ll.m_ll; return *this; } + wxULongLongNative& operator/=(unsigned long l) + { m_ll /= l; return *this; } + + wxULongLongNative operator%(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll % ll.m_ll); } + wxULongLongNative operator%(unsigned long l) const + { return wxULongLongNative(m_ll % l); } + + // comparison + bool operator==(const wxULongLongNative& ll) const + { return m_ll == ll.m_ll; } + bool operator==(unsigned long l) const + { return m_ll == l; } + bool operator!=(const wxULongLongNative& ll) const + { return m_ll != ll.m_ll; } + bool operator!=(unsigned long l) const + { return m_ll != l; } + bool operator<(const wxULongLongNative& ll) const + { return m_ll < ll.m_ll; } + bool operator<(unsigned long l) const + { return m_ll < l; } + bool operator>(const wxULongLongNative& ll) const + { return m_ll > ll.m_ll; } + bool operator>(unsigned long l) const + { return m_ll > l; } + bool operator<=(const wxULongLongNative& ll) const + { return m_ll <= ll.m_ll; } + bool operator<=(unsigned long l) const + { return m_ll <= l; } + bool operator>=(const wxULongLongNative& ll) const + { return m_ll >= ll.m_ll; } + bool operator>=(unsigned long l) const + { return m_ll >= l; } + + // miscellaneous + + // return the string representation of this number + wxString ToString() const; + + // conversion to byte array: returns a pointer to static buffer! + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + // input/output + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&); +#endif + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxULongLongNative&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongNative&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongNative&); +#endif + +private: + wxULongLong_t m_ll; +}; + +inline +wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll) +{ + m_ll = ll.GetValue(); + return *this; +} + +#endif // wxUSE_LONGLONG_NATIVE + +#if wxUSE_LONGLONG_WX + +class WXDLLIMPEXP_BASE wxLongLongWx +{ +public: + // ctors + // default ctor initializes to 0 + wxLongLongWx() + { + m_lo = m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = 0; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + // from long + wxLongLongWx(long l) { *this = l; } + // from 2 longs + wxLongLongWx(long hi, unsigned long lo) + { + m_hi = hi; + m_lo = lo; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = hi; + m_ll <<= 32; + m_ll |= lo; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + + // default copy ctor is ok in both cases + + // no dtor + + // assignment operators + // from long + wxLongLongWx& operator=(long l) + { + m_lo = l; + m_hi = (l < 0 ? -1l : 0l); + +#ifdef wxLONGLONG_TEST_MODE + m_ll = l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + // from int + wxLongLongWx& operator=(int l) + { + return operator=((long)l); + } + + wxLongLongWx& operator=(unsigned long l) + { + m_lo = l; + m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + + wxLongLongWx& operator=(unsigned int l) + { + return operator=((unsigned long)l); + } + + wxLongLongWx& operator=(const class wxULongLongWx &ll); + + // from double + wxLongLongWx& Assign(double d); + // can't have assignment operator from 2 longs + + // accessors + // get high part + long GetHi() const { return m_hi; } + // get low part + unsigned long GetLo() const { return m_lo; } + + // get absolute value + wxLongLongWx Abs() const { return wxLongLongWx(*this).Abs(); } + wxLongLongWx& Abs() + { + if ( m_hi < 0 ) + m_hi = -m_hi; + +#ifdef wxLONGLONG_TEST_MODE + if ( m_ll < 0 ) + m_ll = -m_ll; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + + // convert to long with range checking in debug mode (only!) + long ToLong() const + { + wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l), + _T("wxLongLong to long conversion loss of precision") ); + + return (long)m_lo; + } + + // convert to double + double ToDouble() const; + + // operations + // addition + wxLongLongWx operator+(const wxLongLongWx& ll) const; + wxLongLongWx& operator+=(const wxLongLongWx& ll); + wxLongLongWx operator+(long l) const; + wxLongLongWx& operator+=(long l); + + // pre increment operator + wxLongLongWx& operator++(); + + // post increment operator + wxLongLongWx& operator++(int) { return ++(*this); } + + // negation operator + wxLongLongWx operator-() const; + wxLongLongWx& Negate(); + + // subraction + wxLongLongWx operator-(const wxLongLongWx& ll) const; + wxLongLongWx& operator-=(const wxLongLongWx& ll); + + // pre decrement operator + wxLongLongWx& operator--(); + + // post decrement operator + wxLongLongWx& operator--(int) { return --(*this); } + + // shifts + // left shift + wxLongLongWx operator<<(int shift) const; + wxLongLongWx& operator<<=(int shift); + + // right shift + wxLongLongWx operator>>(int shift) const; + wxLongLongWx& operator>>=(int shift); + + // bitwise operators + wxLongLongWx operator&(const wxLongLongWx& ll) const; + wxLongLongWx& operator&=(const wxLongLongWx& ll); + wxLongLongWx operator|(const wxLongLongWx& ll) const; + wxLongLongWx& operator|=(const wxLongLongWx& ll); + wxLongLongWx operator^(const wxLongLongWx& ll) const; + wxLongLongWx& operator^=(const wxLongLongWx& ll); + wxLongLongWx operator~() const; + + // comparison + bool operator==(const wxLongLongWx& ll) const + { return m_lo == ll.m_lo && m_hi == ll.m_hi; } +#if wxUSE_LONGLONG_NATIVE + bool operator==(const wxLongLongNative& ll) const + { return m_lo == ll.GetLo() && m_hi == ll.GetHi(); } +#endif + bool operator!=(const wxLongLongWx& ll) const + { return !(*this == ll); } + bool operator<(const wxLongLongWx& ll) const; + bool operator>(const wxLongLongWx& ll) const; + bool operator<=(const wxLongLongWx& ll) const + { return *this < ll || *this == ll; } + bool operator>=(const wxLongLongWx& ll) const + { return *this > ll || *this == ll; } + + bool operator<(long l) const { return *this < wxLongLongWx(l); } + bool operator>(long l) const { return *this > wxLongLongWx(l); } + bool operator==(long l) const + { + return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l) + : (m_hi == -1 && m_lo == (unsigned long)l); + } + + bool operator<=(long l) const { return *this < l || *this == l; } + bool operator>=(long l) const { return *this > l || *this == l; } + + // multiplication + wxLongLongWx operator*(const wxLongLongWx& ll) const; + wxLongLongWx& operator*=(const wxLongLongWx& ll); + + // division + wxLongLongWx operator/(const wxLongLongWx& ll) const; + wxLongLongWx& operator/=(const wxLongLongWx& ll); + + wxLongLongWx operator%(const wxLongLongWx& ll) const; + + void Divide(const wxLongLongWx& divisor, + wxLongLongWx& quotient, + wxLongLongWx& remainder) const; + + // input/output + + // return the string representation of this number + wxString ToString() const; + + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&); +#endif // wxUSE_STD_IOSTREAM + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxLongLongWx&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&); +#endif + +private: + // long is at least 32 bits, so represent our 64bit number as 2 longs + + long m_hi; // signed bit is in the high part + unsigned long m_lo; + +#ifdef wxLONGLONG_TEST_MODE + void Check() + { + wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); + } + + wxLongLong_t m_ll; +#endif // wxLONGLONG_TEST_MODE +}; + + +class WXDLLIMPEXP_BASE wxULongLongWx +{ +public: + // ctors + // default ctor initializes to 0 + wxULongLongWx() + { + m_lo = m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = 0; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + // from ulong + wxULongLongWx(unsigned long l) { *this = l; } + // from 2 ulongs + wxULongLongWx(unsigned long hi, unsigned long lo) + { + m_hi = hi; + m_lo = lo; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = hi; + m_ll <<= 32; + m_ll |= lo; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + + // from signed to unsigned + wxULongLongWx(wxLongLongWx ll) + { + wxASSERT(ll.GetHi() >= 0); + m_hi = (unsigned long)ll.GetHi(); + m_lo = ll.GetLo(); + } + + // default copy ctor is ok in both cases + + // no dtor + + // assignment operators + // from long + wxULongLongWx& operator=(unsigned long l) + { + m_lo = l; + m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + wxULongLongWx& operator=(long l) + { + m_lo = l; + m_hi = (unsigned long) ((l<0) ? -1l : 0); + +#ifdef wxLONGLONG_TEST_MODE + m_ll = (wxULongLong_t) (wxLongLong_t) l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + wxULongLongWx& operator=(const class wxLongLongWx &ll) { + // Should we use an assert like it was before in the constructor? + // wxASSERT(ll.GetHi() >= 0); + m_hi = (unsigned long)ll.GetHi(); + m_lo = ll.GetLo(); + return *this; + } + + // can't have assignment operator from 2 longs + + // accessors + // get high part + unsigned long GetHi() const { return m_hi; } + // get low part + unsigned long GetLo() const { return m_lo; } + + // convert to long with range checking in debug mode (only!) + unsigned long ToULong() const + { + wxASSERT_MSG( m_hi == 0ul, + _T("wxULongLong to long conversion loss of precision") ); + + return (unsigned long)m_lo; + } + + // convert to double + double ToDouble() const; + + // operations + // addition + wxULongLongWx operator+(const wxULongLongWx& ll) const; + wxULongLongWx& operator+=(const wxULongLongWx& ll); + wxULongLongWx operator+(unsigned long l) const; + wxULongLongWx& operator+=(unsigned long l); + + // pre increment operator + wxULongLongWx& operator++(); + + // post increment operator + wxULongLongWx& operator++(int) { return ++(*this); } + + // subtraction + wxLongLongWx operator-(const wxULongLongWx& ll) const; + wxULongLongWx& operator-=(const wxULongLongWx& ll); + + // pre decrement operator + wxULongLongWx& operator--(); + + // post decrement operator + wxULongLongWx& operator--(int) { return --(*this); } + + // shifts + // left shift + wxULongLongWx operator<<(int shift) const; + wxULongLongWx& operator<<=(int shift); + + // right shift + wxULongLongWx operator>>(int shift) const; + wxULongLongWx& operator>>=(int shift); + + // bitwise operators + wxULongLongWx operator&(const wxULongLongWx& ll) const; + wxULongLongWx& operator&=(const wxULongLongWx& ll); + wxULongLongWx operator|(const wxULongLongWx& ll) const; + wxULongLongWx& operator|=(const wxULongLongWx& ll); + wxULongLongWx operator^(const wxULongLongWx& ll) const; + wxULongLongWx& operator^=(const wxULongLongWx& ll); + wxULongLongWx operator~() const; + + // comparison + bool operator==(const wxULongLongWx& ll) const + { return m_lo == ll.m_lo && m_hi == ll.m_hi; } + bool operator!=(const wxULongLongWx& ll) const + { return !(*this == ll); } + bool operator<(const wxULongLongWx& ll) const; + bool operator>(const wxULongLongWx& ll) const; + bool operator<=(const wxULongLongWx& ll) const + { return *this < ll || *this == ll; } + bool operator>=(const wxULongLongWx& ll) const + { return *this > ll || *this == ll; } + + bool operator<(unsigned long l) const { return *this < wxULongLongWx(l); } + bool operator>(unsigned long l) const { return *this > wxULongLongWx(l); } + bool operator==(unsigned long l) const + { + return (m_hi == 0 && m_lo == (unsigned long)l); + } + + bool operator<=(unsigned long l) const { return *this < l || *this == l; } + bool operator>=(unsigned long l) const { return *this > l || *this == l; } + + // multiplication + wxULongLongWx operator*(const wxULongLongWx& ll) const; + wxULongLongWx& operator*=(const wxULongLongWx& ll); + + // division + wxULongLongWx operator/(const wxULongLongWx& ll) const; + wxULongLongWx& operator/=(const wxULongLongWx& ll); + + wxULongLongWx operator%(const wxULongLongWx& ll) const; + + void Divide(const wxULongLongWx& divisor, + wxULongLongWx& quotient, + wxULongLongWx& remainder) const; + + // input/output + + // return the string representation of this number + wxString ToString() const; + + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&); +#endif // wxUSE_STD_IOSTREAM + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxULongLongWx&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&); +#endif + +private: + // long is at least 32 bits, so represent our 64bit number as 2 longs + + unsigned long m_hi; + unsigned long m_lo; + +#ifdef wxLONGLONG_TEST_MODE + void Check() + { + wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); + } + + wxULongLong_t m_ll; +#endif // wxLONGLONG_TEST_MODE +}; + +#endif // wxUSE_LONGLONG_WX + +// ---------------------------------------------------------------------------- +// binary operators +// ---------------------------------------------------------------------------- + +inline bool operator<(long l, const wxLongLong& ll) { return ll > l; } +inline bool operator>(long l, const wxLongLong& ll) { return ll < l; } +inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; } +inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; } +inline bool operator==(long l, const wxLongLong& ll) { return ll == l; } +inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; } + +inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; } +inline wxLongLong operator-(long l, const wxLongLong& ll) +{ + return wxLongLong(l) - ll; +} + +inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; } +inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; } +inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; } +inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; } +inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; } +inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; } + +inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; } + +inline wxLongLong operator-(unsigned long l, const wxULongLong& ull) +{ + wxULongLong ret = wxULongLong(l) - ull; + return wxLongLong((long)ret.GetHi(),ret.GetLo()); +} + +#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS + +WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value); +WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value); + +WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value); +WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value); + +#endif + +#endif // wxUSE_LONGLONG + +#endif // _WX_LONGLONG_H diff --git a/Externals/wxWidgets/include/wx/math.h b/Externals/wxWidgets/include/wx/math.h index b82cf305a3..589715c87a 100644 --- a/Externals/wxWidgets/include/wx/math.h +++ b/Externals/wxWidgets/include/wx/math.h @@ -1,140 +1,140 @@ -/** -* Name: wx/math.h -* Purpose: Declarations/definitions of common math functions -* Author: John Labenski and others -* Modified by: -* Created: 02/02/03 -* RCS-ID: $Id: math.h 44690 2007-03-08 04:31:24Z PC $ -* Copyright: (c) John Labenski -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_MATH_H_ -#define _WX_MATH_H_ - -#include "wx/defs.h" - -#include <math.h> - -#ifndef M_PI - #define M_PI 3.1415926535897932384626433832795 -#endif - -/* Scaling factors for various unit conversions */ -#ifndef METRIC_CONVERSION_CONSTANT - #define METRIC_CONVERSION_CONSTANT 0.0393700787 -#endif - -#ifndef mm2inches - #define mm2inches (METRIC_CONVERSION_CONSTANT) -#endif - -#ifndef inches2mm - #define inches2mm (1/(mm2inches)) -#endif - -#ifndef mm2twips - #define mm2twips (METRIC_CONVERSION_CONSTANT*1440) -#endif - -#ifndef twips2mm - #define twips2mm (1/(mm2twips)) -#endif - -#ifndef mm2pt - #define mm2pt (METRIC_CONVERSION_CONSTANT*72) -#endif - -#ifndef pt2mm - #define pt2mm (1/(mm2pt)) -#endif - - -/* unknown __VISAGECC__, __SYMANTECCC__ */ - -#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) - #include <float.h> - #define wxFinite(x) _finite(x) -#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ - defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ - defined(__HPUX__)||defined(__MWERKS__) - #define wxFinite(x) finite(x) -#else - #define wxFinite(x) ((x) == (x)) -#endif - - -#if defined(__VISUALC__)||defined(__BORLAND__) - #define wxIsNaN(x) _isnan(x) -#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ - defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ - defined(__HPUX__)||defined(__MWERKS__) - #define wxIsNaN(x) isnan(x) -#else - #define wxIsNaN(x) ((x) != (x)) -#endif - -#ifdef __cplusplus - - #ifdef __INTELC__ - - inline bool wxIsSameDouble(double x, double y) - { - // VZ: this warning, given for operators==() and !=() is not wrong, as == - // shouldn't be used with doubles, but we get too many of them and - // removing these operators is probably not a good idea - // - // Maybe we should alway compare doubles up to some "epsilon" precision - #pragma warning(push) - - // floating-point equality and inequality comparisons are unreliable - #pragma warning(disable: 1572) - - return x == y; - - #pragma warning(pop) - } - - #else /* !__INTELC__ */ - - inline bool wxIsSameDouble(double x, double y) { return x == y; } - - #endif /* __INTELC__/!__INTELC__ */ - - inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); } - - inline int wxRound(double x) - { - #if defined(HAVE_ROUND) - return int(round(x)); - #else - return (int)(x < 0 ? x - 0.5 : x + 0.5); - #endif - } -#endif /* __cplusplus */ - - -#if defined(__WXMSW__) && !defined(__WXWINCE__) - #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) -#elif defined( __WXMAC__ ) - #define wxMulDivInt32( a , b , c ) ( (wxInt32) ( ( (wxInt64)(a) * (wxInt64)(b) ) / (wxInt64)(c) ) ) -#else - #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) -#endif - -#if wxUSE_APPLE_IEEE -#ifdef __cplusplus - extern "C" { -#endif - /* functions from common/extended.c */ - extern wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes); - extern void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes); -#ifdef __cplusplus - } -#endif -#endif /* wxUSE_APPLE_IEEE */ - - -#endif /* _WX_MATH_H_ */ +/** +* Name: wx/math.h +* Purpose: Declarations/definitions of common math functions +* Author: John Labenski and others +* Modified by: +* Created: 02/02/03 +* RCS-ID: $Id: math.h 44690 2007-03-08 04:31:24Z PC $ +* Copyright: (c) John Labenski +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_MATH_H_ +#define _WX_MATH_H_ + +#include "wx/defs.h" + +#include <math.h> + +#ifndef M_PI + #define M_PI 3.1415926535897932384626433832795 +#endif + +/* Scaling factors for various unit conversions */ +#ifndef METRIC_CONVERSION_CONSTANT + #define METRIC_CONVERSION_CONSTANT 0.0393700787 +#endif + +#ifndef mm2inches + #define mm2inches (METRIC_CONVERSION_CONSTANT) +#endif + +#ifndef inches2mm + #define inches2mm (1/(mm2inches)) +#endif + +#ifndef mm2twips + #define mm2twips (METRIC_CONVERSION_CONSTANT*1440) +#endif + +#ifndef twips2mm + #define twips2mm (1/(mm2twips)) +#endif + +#ifndef mm2pt + #define mm2pt (METRIC_CONVERSION_CONSTANT*72) +#endif + +#ifndef pt2mm + #define pt2mm (1/(mm2pt)) +#endif + + +/* unknown __VISAGECC__, __SYMANTECCC__ */ + +#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) + #include <float.h> + #define wxFinite(x) _finite(x) +#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ + defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ + defined(__HPUX__)||defined(__MWERKS__) + #define wxFinite(x) finite(x) +#else + #define wxFinite(x) ((x) == (x)) +#endif + + +#if defined(__VISUALC__)||defined(__BORLAND__) + #define wxIsNaN(x) _isnan(x) +#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ + defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ + defined(__HPUX__)||defined(__MWERKS__) + #define wxIsNaN(x) isnan(x) +#else + #define wxIsNaN(x) ((x) != (x)) +#endif + +#ifdef __cplusplus + + #ifdef __INTELC__ + + inline bool wxIsSameDouble(double x, double y) + { + // VZ: this warning, given for operators==() and !=() is not wrong, as == + // shouldn't be used with doubles, but we get too many of them and + // removing these operators is probably not a good idea + // + // Maybe we should alway compare doubles up to some "epsilon" precision + #pragma warning(push) + + // floating-point equality and inequality comparisons are unreliable + #pragma warning(disable: 1572) + + return x == y; + + #pragma warning(pop) + } + + #else /* !__INTELC__ */ + + inline bool wxIsSameDouble(double x, double y) { return x == y; } + + #endif /* __INTELC__/!__INTELC__ */ + + inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); } + + inline int wxRound(double x) + { + #if defined(HAVE_ROUND) + return int(round(x)); + #else + return (int)(x < 0 ? x - 0.5 : x + 0.5); + #endif + } +#endif /* __cplusplus */ + + +#if defined(__WXMSW__) && !defined(__WXWINCE__) + #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) +#elif defined( __WXMAC__ ) + #define wxMulDivInt32( a , b , c ) ( (wxInt32) ( ( (wxInt64)(a) * (wxInt64)(b) ) / (wxInt64)(c) ) ) +#else + #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) +#endif + +#if wxUSE_APPLE_IEEE +#ifdef __cplusplus + extern "C" { +#endif + /* functions from common/extended.c */ + extern wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes); + extern void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes); +#ifdef __cplusplus + } +#endif +#endif /* wxUSE_APPLE_IEEE */ + + +#endif /* _WX_MATH_H_ */ diff --git a/Externals/wxWidgets/include/wx/matrix.h b/Externals/wxWidgets/include/wx/matrix.h index 11c688ba4d..67812cd2e2 100644 --- a/Externals/wxWidgets/include/wx/matrix.h +++ b/Externals/wxWidgets/include/wx/matrix.h @@ -1,235 +1,235 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/matrix.h -// Purpose: wxTransformMatrix class. NOT YET USED -// Author: Chris Breeze, Julian Smart -// Modified by: Klaas Holwerda -// Created: 01/02/97 -// RCS-ID: $Id: matrix.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart, Chris Breeze -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MATRIXH__ -#define _WX_MATRIXH__ - -//! headerfiles="matrix.h wx/object.h" -#include "wx/object.h" -#include "wx/math.h" - -//! codefiles="matrix.cpp" - -// A simple 3x3 matrix. This may be replaced by a more general matrix -// class some day. -// -// Note: this is intended to be used in wxDC at some point to replace -// the current system of scaling/translation. It is not yet used. - -//:definition -// A 3x3 matrix to do 2D transformations. -// It can be used to map data to window coordinates, -// and also for manipulating your own data. -// For example drawing a picture (composed of several primitives) -// at a certain coordinate and angle within another parent picture. -// At all times m_isIdentity is set if the matrix itself is an Identity matrix. -// It is used where possible to optimize calculations. -class WXDLLEXPORT wxTransformMatrix: public wxObject -{ -public: - wxTransformMatrix(void); - wxTransformMatrix(const wxTransformMatrix& mat); - - //get the value in the matrix at col,row - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - double GetValue(int col, int row) const; - - //set the value in the matrix at col,row - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - void SetValue(int col, int row, double value); - - void operator = (const wxTransformMatrix& mat); - bool operator == (const wxTransformMatrix& mat) const; - bool operator != (const wxTransformMatrix& mat) const; - - //multiply every element by t - wxTransformMatrix& operator*=(const double& t); - //divide every element by t - wxTransformMatrix& operator/=(const double& t); - //add matrix m to this t - wxTransformMatrix& operator+=(const wxTransformMatrix& m); - //subtract matrix m from this - wxTransformMatrix& operator-=(const wxTransformMatrix& m); - //multiply matrix m with this - wxTransformMatrix& operator*=(const wxTransformMatrix& m); - - // constant operators - - //multiply every element by t and return result - wxTransformMatrix operator*(const double& t) const; - //divide this matrix by t and return result - wxTransformMatrix operator/(const double& t) const; - //add matrix m to this and return result - wxTransformMatrix operator+(const wxTransformMatrix& m) const; - //subtract matrix m from this and return result - wxTransformMatrix operator-(const wxTransformMatrix& m) const; - //multiply this by matrix m and return result - wxTransformMatrix operator*(const wxTransformMatrix& m) const; - wxTransformMatrix operator-() const; - - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - double& operator()(int col, int row); - - //rows are horizontal (second index of m_matrix member) - //columns are vertical (first index of m_matrix member) - double operator()(int col, int row) const; - - // Invert matrix - bool Invert(void); - - // Make into identity matrix - bool Identity(void); - - // Is the matrix the identity matrix? - // Only returns a flag, which is set whenever an operation - // is done. - inline bool IsIdentity(void) const { return m_isIdentity; } - - // This does an actual check. - inline bool IsIdentity1(void) const ; - - //Scale by scale (isotropic scaling i.e. the same in x and y): - //!ex: - //!code: | scale 0 0 | - //!code: matrix' = | 0 scale 0 | x matrix - //!code: | 0 0 scale | - bool Scale(double scale); - - //Scale with center point and x/y scale - // - //!ex: - //!code: | xs 0 xc(1-xs) | - //!code: matrix' = | 0 ys yc(1-ys) | x matrix - //!code: | 0 0 1 | - wxTransformMatrix& Scale(const double &xs, const double &ys,const double &xc, const double &yc); - - // mirror a matrix in x, y - //!ex: - //!code: | -1 0 0 | - //!code: matrix' = | 0 -1 0 | x matrix - //!code: | 0 0 1 | - wxTransformMatrix& Mirror(bool x=true, bool y=false); - // Translate by dx, dy: - //!ex: - //!code: | 1 0 dx | - //!code: matrix' = | 0 1 dy | x matrix - //!code: | 0 0 1 | - bool Translate(double x, double y); - - // Rotate clockwise by the given number of degrees: - //!ex: - //!code: | cos sin 0 | - //!code: matrix' = | -sin cos 0 | x matrix - //!code: | 0 0 1 | - bool Rotate(double angle); - - //Rotate counter clockwise with point of rotation - // - //!ex: - //!code: | cos(r) -sin(r) x(1-cos(r))+y(sin(r)| - //!code: matrix' = | sin(r) cos(r) y(1-cos(r))-x(sin(r)| x matrix - //!code: | 0 0 1 | - wxTransformMatrix& Rotate(const double &r, const double &x, const double &y); - - // Transform X value from logical to device - inline double TransformX(double x) const; - - // Transform Y value from logical to device - inline double TransformY(double y) const; - - // Transform a point from logical to device coordinates - bool TransformPoint(double x, double y, double& tx, double& ty) const; - - // Transform a point from device to logical coordinates. - // Example of use: - // wxTransformMatrix mat = dc.GetTransformation(); - // mat.Invert(); - // mat.InverseTransformPoint(x, y, x1, y1); - // OR (shorthand:) - // dc.LogicalToDevice(x, y, x1, y1); - // The latter is slightly less efficient if we're doing several - // conversions, since the matrix is inverted several times. - // N.B. 'this' matrix is the inverse at this point - bool InverseTransformPoint(double x, double y, double& tx, double& ty) const; - - double Get_scaleX(); - double Get_scaleY(); - double GetRotation(); - void SetRotation(double rotation); - - -public: - double m_matrix[3][3]; - bool m_isIdentity; -}; - - -/* -Chris Breeze reported, that -some functions of wxTransformMatrix cannot work because it is not -known if he matrix has been inverted. Be careful when using it. -*/ - -// Transform X value from logical to device -// warning: this function can only be used for this purpose -// because no rotation is involved when mapping logical to device coordinates -// mirror and scaling for x and y will be part of the matrix -// if you have a matrix that is rotated, eg a shape containing a matrix to place -// it in the logical coordinate system, use TransformPoint -inline double wxTransformMatrix::TransformX(double x) const -{ - //normally like this, but since no rotation is involved (only mirror and scale) - //we can do without Y -> m_matrix[1]{0] is -sin(rotation angle) and therefore zero - //(x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0])) - return (m_isIdentity ? x : (x * m_matrix[0][0] + m_matrix[2][0])); -} - -// Transform Y value from logical to device -// warning: this function can only be used for this purpose -// because no rotation is involved when mapping logical to device coordinates -// mirror and scaling for x and y will be part of the matrix -// if you have a matrix that is rotated, eg a shape containing a matrix to place -// it in the logical coordinate system, use TransformPoint -inline double wxTransformMatrix::TransformY(double y) const -{ - //normally like this, but since no rotation is involved (only mirror and scale) - //we can do without X -> m_matrix[0]{1] is sin(rotation angle) and therefore zero - //(x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1])) - return (m_isIdentity ? y : (y * m_matrix[1][1] + m_matrix[2][1])); -} - - -// Is the matrix the identity matrix? -// Each operation checks whether the result is still the identity matrix and sets a flag. -inline bool wxTransformMatrix::IsIdentity1(void) const -{ - return - ( wxIsSameDouble(m_matrix[0][0], 1.0) && - wxIsSameDouble(m_matrix[1][1], 1.0) && - wxIsSameDouble(m_matrix[2][2], 1.0) && - wxIsSameDouble(m_matrix[1][0], 0.0) && - wxIsSameDouble(m_matrix[2][0], 0.0) && - wxIsSameDouble(m_matrix[0][1], 0.0) && - wxIsSameDouble(m_matrix[2][1], 0.0) && - wxIsSameDouble(m_matrix[0][2], 0.0) && - wxIsSameDouble(m_matrix[1][2], 0.0) ); -} - -// Calculates the determinant of a 2 x 2 matrix -inline double wxCalculateDet(double a11, double a21, double a12, double a22) -{ - return a11 * a22 - a12 * a21; -} - -#endif // _WX_MATRIXH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/matrix.h +// Purpose: wxTransformMatrix class. NOT YET USED +// Author: Chris Breeze, Julian Smart +// Modified by: Klaas Holwerda +// Created: 01/02/97 +// RCS-ID: $Id: matrix.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Julian Smart, Chris Breeze +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MATRIXH__ +#define _WX_MATRIXH__ + +//! headerfiles="matrix.h wx/object.h" +#include "wx/object.h" +#include "wx/math.h" + +//! codefiles="matrix.cpp" + +// A simple 3x3 matrix. This may be replaced by a more general matrix +// class some day. +// +// Note: this is intended to be used in wxDC at some point to replace +// the current system of scaling/translation. It is not yet used. + +//:definition +// A 3x3 matrix to do 2D transformations. +// It can be used to map data to window coordinates, +// and also for manipulating your own data. +// For example drawing a picture (composed of several primitives) +// at a certain coordinate and angle within another parent picture. +// At all times m_isIdentity is set if the matrix itself is an Identity matrix. +// It is used where possible to optimize calculations. +class WXDLLEXPORT wxTransformMatrix: public wxObject +{ +public: + wxTransformMatrix(void); + wxTransformMatrix(const wxTransformMatrix& mat); + + //get the value in the matrix at col,row + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + double GetValue(int col, int row) const; + + //set the value in the matrix at col,row + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + void SetValue(int col, int row, double value); + + void operator = (const wxTransformMatrix& mat); + bool operator == (const wxTransformMatrix& mat) const; + bool operator != (const wxTransformMatrix& mat) const; + + //multiply every element by t + wxTransformMatrix& operator*=(const double& t); + //divide every element by t + wxTransformMatrix& operator/=(const double& t); + //add matrix m to this t + wxTransformMatrix& operator+=(const wxTransformMatrix& m); + //subtract matrix m from this + wxTransformMatrix& operator-=(const wxTransformMatrix& m); + //multiply matrix m with this + wxTransformMatrix& operator*=(const wxTransformMatrix& m); + + // constant operators + + //multiply every element by t and return result + wxTransformMatrix operator*(const double& t) const; + //divide this matrix by t and return result + wxTransformMatrix operator/(const double& t) const; + //add matrix m to this and return result + wxTransformMatrix operator+(const wxTransformMatrix& m) const; + //subtract matrix m from this and return result + wxTransformMatrix operator-(const wxTransformMatrix& m) const; + //multiply this by matrix m and return result + wxTransformMatrix operator*(const wxTransformMatrix& m) const; + wxTransformMatrix operator-() const; + + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + double& operator()(int col, int row); + + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + double operator()(int col, int row) const; + + // Invert matrix + bool Invert(void); + + // Make into identity matrix + bool Identity(void); + + // Is the matrix the identity matrix? + // Only returns a flag, which is set whenever an operation + // is done. + inline bool IsIdentity(void) const { return m_isIdentity; } + + // This does an actual check. + inline bool IsIdentity1(void) const ; + + //Scale by scale (isotropic scaling i.e. the same in x and y): + //!ex: + //!code: | scale 0 0 | + //!code: matrix' = | 0 scale 0 | x matrix + //!code: | 0 0 scale | + bool Scale(double scale); + + //Scale with center point and x/y scale + // + //!ex: + //!code: | xs 0 xc(1-xs) | + //!code: matrix' = | 0 ys yc(1-ys) | x matrix + //!code: | 0 0 1 | + wxTransformMatrix& Scale(const double &xs, const double &ys,const double &xc, const double &yc); + + // mirror a matrix in x, y + //!ex: + //!code: | -1 0 0 | + //!code: matrix' = | 0 -1 0 | x matrix + //!code: | 0 0 1 | + wxTransformMatrix& Mirror(bool x=true, bool y=false); + // Translate by dx, dy: + //!ex: + //!code: | 1 0 dx | + //!code: matrix' = | 0 1 dy | x matrix + //!code: | 0 0 1 | + bool Translate(double x, double y); + + // Rotate clockwise by the given number of degrees: + //!ex: + //!code: | cos sin 0 | + //!code: matrix' = | -sin cos 0 | x matrix + //!code: | 0 0 1 | + bool Rotate(double angle); + + //Rotate counter clockwise with point of rotation + // + //!ex: + //!code: | cos(r) -sin(r) x(1-cos(r))+y(sin(r)| + //!code: matrix' = | sin(r) cos(r) y(1-cos(r))-x(sin(r)| x matrix + //!code: | 0 0 1 | + wxTransformMatrix& Rotate(const double &r, const double &x, const double &y); + + // Transform X value from logical to device + inline double TransformX(double x) const; + + // Transform Y value from logical to device + inline double TransformY(double y) const; + + // Transform a point from logical to device coordinates + bool TransformPoint(double x, double y, double& tx, double& ty) const; + + // Transform a point from device to logical coordinates. + // Example of use: + // wxTransformMatrix mat = dc.GetTransformation(); + // mat.Invert(); + // mat.InverseTransformPoint(x, y, x1, y1); + // OR (shorthand:) + // dc.LogicalToDevice(x, y, x1, y1); + // The latter is slightly less efficient if we're doing several + // conversions, since the matrix is inverted several times. + // N.B. 'this' matrix is the inverse at this point + bool InverseTransformPoint(double x, double y, double& tx, double& ty) const; + + double Get_scaleX(); + double Get_scaleY(); + double GetRotation(); + void SetRotation(double rotation); + + +public: + double m_matrix[3][3]; + bool m_isIdentity; +}; + + +/* +Chris Breeze reported, that +some functions of wxTransformMatrix cannot work because it is not +known if he matrix has been inverted. Be careful when using it. +*/ + +// Transform X value from logical to device +// warning: this function can only be used for this purpose +// because no rotation is involved when mapping logical to device coordinates +// mirror and scaling for x and y will be part of the matrix +// if you have a matrix that is rotated, eg a shape containing a matrix to place +// it in the logical coordinate system, use TransformPoint +inline double wxTransformMatrix::TransformX(double x) const +{ + //normally like this, but since no rotation is involved (only mirror and scale) + //we can do without Y -> m_matrix[1]{0] is -sin(rotation angle) and therefore zero + //(x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0])) + return (m_isIdentity ? x : (x * m_matrix[0][0] + m_matrix[2][0])); +} + +// Transform Y value from logical to device +// warning: this function can only be used for this purpose +// because no rotation is involved when mapping logical to device coordinates +// mirror and scaling for x and y will be part of the matrix +// if you have a matrix that is rotated, eg a shape containing a matrix to place +// it in the logical coordinate system, use TransformPoint +inline double wxTransformMatrix::TransformY(double y) const +{ + //normally like this, but since no rotation is involved (only mirror and scale) + //we can do without X -> m_matrix[0]{1] is sin(rotation angle) and therefore zero + //(x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1])) + return (m_isIdentity ? y : (y * m_matrix[1][1] + m_matrix[2][1])); +} + + +// Is the matrix the identity matrix? +// Each operation checks whether the result is still the identity matrix and sets a flag. +inline bool wxTransformMatrix::IsIdentity1(void) const +{ + return + ( wxIsSameDouble(m_matrix[0][0], 1.0) && + wxIsSameDouble(m_matrix[1][1], 1.0) && + wxIsSameDouble(m_matrix[2][2], 1.0) && + wxIsSameDouble(m_matrix[1][0], 0.0) && + wxIsSameDouble(m_matrix[2][0], 0.0) && + wxIsSameDouble(m_matrix[0][1], 0.0) && + wxIsSameDouble(m_matrix[2][1], 0.0) && + wxIsSameDouble(m_matrix[0][2], 0.0) && + wxIsSameDouble(m_matrix[1][2], 0.0) ); +} + +// Calculates the determinant of a 2 x 2 matrix +inline double wxCalculateDet(double a11, double a21, double a12, double a22) +{ + return a11 * a22 - a12 * a21; +} + +#endif // _WX_MATRIXH__ diff --git a/Externals/wxWidgets/include/wx/mdi.h b/Externals/wxWidgets/include/wx/mdi.h index 7a9eeca596..f18b54a967 100644 --- a/Externals/wxWidgets/include/wx/mdi.h +++ b/Externals/wxWidgets/include/wx/mdi.h @@ -1,40 +1,40 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mdi.h -// Purpose: wxMDI base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: mdi.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MDI_H_BASE_ -#define _WX_MDI_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MDI - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/mdig.h" -#elif defined(__WXMSW__) - #include "wx/msw/mdi.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/mdi.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/mdi.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/mdi.h" -#elif defined(__WXMAC__) - #include "wx/mac/mdi.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/mdi.h" -#elif defined(__WXPM__) - #include "wx/generic/mdig.h" -#endif - -#endif // wxUSE_MDI - -#endif - // _WX_MDI_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mdi.h +// Purpose: wxMDI base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: mdi.h 37066 2006-01-23 03:27:34Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDI_H_BASE_ +#define _WX_MDI_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MDI + +#if defined(__WXUNIVERSAL__) + #include "wx/generic/mdig.h" +#elif defined(__WXMSW__) + #include "wx/msw/mdi.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/mdi.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/mdi.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/mdi.h" +#elif defined(__WXMAC__) + #include "wx/mac/mdi.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/mdi.h" +#elif defined(__WXPM__) + #include "wx/generic/mdig.h" +#endif + +#endif // wxUSE_MDI + +#endif + // _WX_MDI_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/mediactrl.h b/Externals/wxWidgets/include/wx/mediactrl.h index e558bd3151..c47557b03a 100644 --- a/Externals/wxWidgets/include/wx/mediactrl.h +++ b/Externals/wxWidgets/include/wx/mediactrl.h @@ -1,422 +1,422 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mediactrl.h -// Purpose: wxMediaCtrl class -// Author: Ryan Norton <wxprojects@comcast.net> -// Modified by: -// Created: 11/07/04 -// RCS-ID: $Id: mediactrl.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// Definitions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Header guard -// ---------------------------------------------------------------------------- -#ifndef _WX_MEDIACTRL_H_ -#define _WX_MEDIACTRL_H_ - -// ---------------------------------------------------------------------------- -// Pre-compiled header stuff -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// Compilation guard -// ---------------------------------------------------------------------------- - -#if wxUSE_MEDIACTRL - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "wx/control.h" -#include "wx/uri.h" - -// ============================================================================ -// Declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// -// Enumerations -// -// ---------------------------------------------------------------------------- - -enum wxMediaState -{ - wxMEDIASTATE_STOPPED, - wxMEDIASTATE_PAUSED, - wxMEDIASTATE_PLAYING -}; - -enum wxMediaCtrlPlayerControls -{ - wxMEDIACTRLPLAYERCONTROLS_NONE = 0, - //Step controls like fastfoward, step one frame etc. - wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0, - //Volume controls like the speaker icon, volume slider, etc. - wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1, - wxMEDIACTRLPLAYERCONTROLS_DEFAULT = - wxMEDIACTRLPLAYERCONTROLS_STEP | - wxMEDIACTRLPLAYERCONTROLS_VOLUME -}; - -#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend") -#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend") -#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend") -#define wxMEDIABACKEND_GSTREAMER wxT("wxGStreamerMediaBackend") -#define wxMEDIABACKEND_REALPLAYER wxT("wxRealPlayerMediaBackend") -#define wxMEDIABACKEND_WMP10 wxT("wxWMP10MediaBackend") - -// ---------------------------------------------------------------------------- -// -// wxMediaEvent -// -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent -{ -public: - // ------------------------------------------------------------------------ - // wxMediaEvent Constructor - // - // Normal constructor, much the same as wxNotifyEvent - // ------------------------------------------------------------------------ - wxMediaEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid) - { } - - // ------------------------------------------------------------------------ - // wxMediaEvent Copy Constructor - // - // Normal copy constructor, much the same as wxNotifyEvent - // ------------------------------------------------------------------------ - wxMediaEvent(const wxMediaEvent &clone) - : wxNotifyEvent(clone) - { } - - // ------------------------------------------------------------------------ - // wxMediaEvent::Clone - // - // Allocates a copy of this object. - // Required for wxEvtHandler::AddPendingEvent - // ------------------------------------------------------------------------ - virtual wxEvent *Clone() const - { return new wxMediaEvent(*this); } - - - // Put this class on wxWidget's RTTI table - DECLARE_DYNAMIC_CLASS(wxMediaEvent) -}; - -// ---------------------------------------------------------------------------- -// -// wxMediaCtrl -// -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_MEDIA wxMediaCtrl : public wxControl -{ -public: - wxMediaCtrl() : m_imp(NULL), m_bLoaded(false) - { } - - wxMediaCtrl(wxWindow* parent, wxWindowID winid, - const wxString& fileName = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxEmptyString, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("mediaCtrl")) - : m_imp(NULL), m_bLoaded(false) - { Create(parent, winid, fileName, pos, size, style, - szBackend, validator, name); } - - wxMediaCtrl(wxWindow* parent, wxWindowID winid, - const wxURI& location, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxEmptyString, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("mediaCtrl")) - : m_imp(NULL), m_bLoaded(false) - { Create(parent, winid, location, pos, size, style, - szBackend, validator, name); } - - virtual ~wxMediaCtrl(); - - bool Create(wxWindow* parent, wxWindowID winid, - const wxString& fileName = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxEmptyString, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("mediaCtrl")); - - bool Create(wxWindow* parent, wxWindowID winid, - const wxURI& location, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxEmptyString, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("mediaCtrl")); - - bool DoCreate(wxClassInfo* instance, - wxWindow* parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxT("mediaCtrl")); - - bool Play(); - bool Pause(); - bool Stop(); - - bool Load(const wxString& fileName); - - wxMediaState GetState(); - - wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart); - wxFileOffset Tell(); //FIXME: This should be const - wxFileOffset Length(); //FIXME: This should be const - -#if wxABI_VERSION >= 20601 /* 2.6.1+ only */ - double GetPlaybackRate(); //All but MCI & GStreamer - bool SetPlaybackRate(double dRate); //All but MCI & GStreamer -#endif - -#if wxABI_VERSION >= 20602 /* 2.6.2+ only */ - bool Load(const wxURI& location); - bool Load(const wxURI& location, const wxURI& proxy); - - wxFileOffset GetDownloadProgress(); // DirectShow only - wxFileOffset GetDownloadTotal(); // DirectShow only - - double GetVolume(); - bool SetVolume(double dVolume); - - bool ShowPlayerControls( - wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT); - - //helpers for the wxPython people - bool LoadURI(const wxString& fileName) - { return Load(wxURI(fileName)); } - bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) - { return Load(wxURI(fileName), wxURI(proxy)); } -#endif - -protected: - static wxClassInfo* NextBackend(); - - void OnMediaFinished(wxMediaEvent& evt); - virtual void DoMoveWindow(int x, int y, int w, int h); - wxSize DoGetBestSize() const; - - //FIXME: This is nasty... find a better way to work around - //inheritance issues -#if defined(__WXMAC__) - virtual void MacVisibilityChanged(); -#endif -#if defined(__WXMAC__) || defined(__WXCOCOA__) - friend class wxQTMediaBackend; -#endif - class wxMediaBackend* m_imp; - bool m_bLoaded; - - DECLARE_DYNAMIC_CLASS(wxMediaCtrl) -}; - -// ---------------------------------------------------------------------------- -// -// wxMediaBackend -// -// Derive from this and use standard wxWidgets RTTI -// (DECLARE_DYNAMIC_CLASS and IMPLEMENT_CLASS) to make a backend -// for wxMediaCtrl. Backends are searched alphabetically - -// the one with the earliest letter is tried first. -// -// Note that this is currently not API or ABI compatable - -// so statically link or make the client compile on-site. -// -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_MEDIA wxMediaBackend : public wxObject -{ -public: - wxMediaBackend() - { } - - virtual ~wxMediaBackend(); - - virtual bool CreateControl(wxControl* WXUNUSED(ctrl), - wxWindow* WXUNUSED(parent), - wxWindowID WXUNUSED(winid), - const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(size), - long WXUNUSED(style), - const wxValidator& WXUNUSED(validator), - const wxString& WXUNUSED(name)) - { return false; } - - virtual bool Play() - { return false; } - virtual bool Pause() - { return false; } - virtual bool Stop() - { return false; } - - virtual bool Load(const wxString& WXUNUSED(fileName)) - { return false; } - virtual bool Load(const wxURI& WXUNUSED(location)) - { return false; } - - virtual bool SetPosition(wxLongLong WXUNUSED(where)) - { return 0; } - virtual wxLongLong GetPosition() - { return 0; } - virtual wxLongLong GetDuration() - { return 0; } - - virtual void Move(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(w), int WXUNUSED(h)) - { } - virtual wxSize GetVideoSize() const - { return wxSize(0,0); } - - virtual double GetPlaybackRate() - { return 0.0; } - virtual bool SetPlaybackRate(double WXUNUSED(dRate)) - { return false; } - - virtual wxMediaState GetState() - { return wxMEDIASTATE_STOPPED; } - - virtual double GetVolume() - { return 0.0; } - virtual bool SetVolume(double WXUNUSED(dVolume)) - { return false; } - - virtual bool Load(const wxURI& WXUNUSED(location), - const wxURI& WXUNUSED(proxy)) - { return false; } - - virtual bool ShowPlayerControls( - wxMediaCtrlPlayerControls WXUNUSED(flags)) - { return false; } - virtual bool IsInterfaceShown() - { return false; } - - virtual wxLongLong GetDownloadProgress() - { return 0; } - virtual wxLongLong GetDownloadTotal() - { return 0; } - - virtual void MacVisibilityChanged() - { } - virtual void RESERVED9() {} - - DECLARE_DYNAMIC_CLASS(wxMediaBackend) -}; - - -//Event ID to give to our events -#define wxMEDIA_FINISHED_ID 13000 -#define wxMEDIA_STOP_ID 13001 - -//Define our event types - we need to call DEFINE_EVENT_TYPE(EVT) later -DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_FINISHED, wxMEDIA_FINISHED_ID) -DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STOP, wxMEDIA_STOP_ID) - -//Function type(s) our events need -typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&); - -#define wxMediaEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMediaEventFunction, &func) - -//Macro for usage with message maps -#define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), -#define EVT_MEDIA_STOP(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), - -#if wxABI_VERSION >= 20602 /* 2.6.2+ only */ -# define wxMEDIA_LOADED_ID 13002 - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_LOADED, wxMEDIA_LOADED_ID) -# define EVT_MEDIA_LOADED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), -#endif - -#if wxABI_VERSION >= 20603 /* 2.6.3+ only */ -# define wxMEDIA_STATECHANGED_ID 13003 -# define wxMEDIA_PLAY_ID 13004 -# define wxMEDIA_PAUSE_ID 13005 - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STATECHANGED, wxMEDIA_STATECHANGED_ID) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PLAY, wxMEDIA_PLAY_ID) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PAUSE, wxMEDIA_PAUSE_ID) -# define EVT_MEDIA_STATECHANGED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STATECHANGED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), -# define EVT_MEDIA_PLAY(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PLAY, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), -# define EVT_MEDIA_PAUSE(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PAUSE, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), -#endif - -// ---------------------------------------------------------------------------- -// common backend base class used by many other backends -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_MEDIA wxMediaBackendCommonBase : public wxMediaBackend -{ -public: - // add a pending wxMediaEvent of the given type - void QueueEvent(wxEventType evtType); - - // notify that the movie playback is finished - void QueueFinishEvent() - { -#if wxABI_VERSION >= 20603 /* 2.6.3+ only */ - QueueEvent(wxEVT_MEDIA_STATECHANGED); -#endif - QueueEvent(wxEVT_MEDIA_FINISHED); - } - - // send the stop event and return true if it hasn't been vetoed - bool SendStopEvent(); - - // Queue pause event - void QueuePlayEvent(); - - // Queue pause event - void QueuePauseEvent(); - - // Queue stop event (no veto) - void QueueStopEvent(); - -protected: - // call this when the movie size has changed but not because it has just - // been loaded (in this case, call NotifyMovieLoaded() below) - void NotifyMovieSizeChanged(); - - // call this when the movie is fully loaded - void NotifyMovieLoaded(); - - - wxMediaCtrl *m_ctrl; // parent control -}; - -// ---------------------------------------------------------------------------- -// End compilation gaurd -// ---------------------------------------------------------------------------- -#endif // wxUSE_MEDIACTRL - -// ---------------------------------------------------------------------------- -// End header guard and header itself -// ---------------------------------------------------------------------------- -#endif // _WX_MEDIACTRL_H_ - - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mediactrl.h +// Purpose: wxMediaCtrl class +// Author: Ryan Norton <wxprojects@comcast.net> +// Modified by: +// Created: 11/07/04 +// RCS-ID: $Id: mediactrl.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Definitions +// ============================================================================ + +// ---------------------------------------------------------------------------- +// Header guard +// ---------------------------------------------------------------------------- +#ifndef _WX_MEDIACTRL_H_ +#define _WX_MEDIACTRL_H_ + +// ---------------------------------------------------------------------------- +// Pre-compiled header stuff +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// Compilation guard +// ---------------------------------------------------------------------------- + +#if wxUSE_MEDIACTRL + +// ---------------------------------------------------------------------------- +// Includes +// ---------------------------------------------------------------------------- + +#include "wx/control.h" +#include "wx/uri.h" + +// ============================================================================ +// Declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// +// Enumerations +// +// ---------------------------------------------------------------------------- + +enum wxMediaState +{ + wxMEDIASTATE_STOPPED, + wxMEDIASTATE_PAUSED, + wxMEDIASTATE_PLAYING +}; + +enum wxMediaCtrlPlayerControls +{ + wxMEDIACTRLPLAYERCONTROLS_NONE = 0, + //Step controls like fastfoward, step one frame etc. + wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0, + //Volume controls like the speaker icon, volume slider, etc. + wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1, + wxMEDIACTRLPLAYERCONTROLS_DEFAULT = + wxMEDIACTRLPLAYERCONTROLS_STEP | + wxMEDIACTRLPLAYERCONTROLS_VOLUME +}; + +#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend") +#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend") +#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend") +#define wxMEDIABACKEND_GSTREAMER wxT("wxGStreamerMediaBackend") +#define wxMEDIABACKEND_REALPLAYER wxT("wxRealPlayerMediaBackend") +#define wxMEDIABACKEND_WMP10 wxT("wxWMP10MediaBackend") + +// ---------------------------------------------------------------------------- +// +// wxMediaEvent +// +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent +{ +public: + // ------------------------------------------------------------------------ + // wxMediaEvent Constructor + // + // Normal constructor, much the same as wxNotifyEvent + // ------------------------------------------------------------------------ + wxMediaEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid) + { } + + // ------------------------------------------------------------------------ + // wxMediaEvent Copy Constructor + // + // Normal copy constructor, much the same as wxNotifyEvent + // ------------------------------------------------------------------------ + wxMediaEvent(const wxMediaEvent &clone) + : wxNotifyEvent(clone) + { } + + // ------------------------------------------------------------------------ + // wxMediaEvent::Clone + // + // Allocates a copy of this object. + // Required for wxEvtHandler::AddPendingEvent + // ------------------------------------------------------------------------ + virtual wxEvent *Clone() const + { return new wxMediaEvent(*this); } + + + // Put this class on wxWidget's RTTI table + DECLARE_DYNAMIC_CLASS(wxMediaEvent) +}; + +// ---------------------------------------------------------------------------- +// +// wxMediaCtrl +// +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaCtrl : public wxControl +{ +public: + wxMediaCtrl() : m_imp(NULL), m_bLoaded(false) + { } + + wxMediaCtrl(wxWindow* parent, wxWindowID winid, + const wxString& fileName = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")) + : m_imp(NULL), m_bLoaded(false) + { Create(parent, winid, fileName, pos, size, style, + szBackend, validator, name); } + + wxMediaCtrl(wxWindow* parent, wxWindowID winid, + const wxURI& location, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")) + : m_imp(NULL), m_bLoaded(false) + { Create(parent, winid, location, pos, size, style, + szBackend, validator, name); } + + virtual ~wxMediaCtrl(); + + bool Create(wxWindow* parent, wxWindowID winid, + const wxString& fileName = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")); + + bool Create(wxWindow* parent, wxWindowID winid, + const wxURI& location, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")); + + bool DoCreate(wxClassInfo* instance, + wxWindow* parent, wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")); + + bool Play(); + bool Pause(); + bool Stop(); + + bool Load(const wxString& fileName); + + wxMediaState GetState(); + + wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart); + wxFileOffset Tell(); //FIXME: This should be const + wxFileOffset Length(); //FIXME: This should be const + +#if wxABI_VERSION >= 20601 /* 2.6.1+ only */ + double GetPlaybackRate(); //All but MCI & GStreamer + bool SetPlaybackRate(double dRate); //All but MCI & GStreamer +#endif + +#if wxABI_VERSION >= 20602 /* 2.6.2+ only */ + bool Load(const wxURI& location); + bool Load(const wxURI& location, const wxURI& proxy); + + wxFileOffset GetDownloadProgress(); // DirectShow only + wxFileOffset GetDownloadTotal(); // DirectShow only + + double GetVolume(); + bool SetVolume(double dVolume); + + bool ShowPlayerControls( + wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT); + + //helpers for the wxPython people + bool LoadURI(const wxString& fileName) + { return Load(wxURI(fileName)); } + bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) + { return Load(wxURI(fileName), wxURI(proxy)); } +#endif + +protected: + static wxClassInfo* NextBackend(); + + void OnMediaFinished(wxMediaEvent& evt); + virtual void DoMoveWindow(int x, int y, int w, int h); + wxSize DoGetBestSize() const; + + //FIXME: This is nasty... find a better way to work around + //inheritance issues +#if defined(__WXMAC__) + virtual void MacVisibilityChanged(); +#endif +#if defined(__WXMAC__) || defined(__WXCOCOA__) + friend class wxQTMediaBackend; +#endif + class wxMediaBackend* m_imp; + bool m_bLoaded; + + DECLARE_DYNAMIC_CLASS(wxMediaCtrl) +}; + +// ---------------------------------------------------------------------------- +// +// wxMediaBackend +// +// Derive from this and use standard wxWidgets RTTI +// (DECLARE_DYNAMIC_CLASS and IMPLEMENT_CLASS) to make a backend +// for wxMediaCtrl. Backends are searched alphabetically - +// the one with the earliest letter is tried first. +// +// Note that this is currently not API or ABI compatable - +// so statically link or make the client compile on-site. +// +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaBackend : public wxObject +{ +public: + wxMediaBackend() + { } + + virtual ~wxMediaBackend(); + + virtual bool CreateControl(wxControl* WXUNUSED(ctrl), + wxWindow* WXUNUSED(parent), + wxWindowID WXUNUSED(winid), + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), + long WXUNUSED(style), + const wxValidator& WXUNUSED(validator), + const wxString& WXUNUSED(name)) + { return false; } + + virtual bool Play() + { return false; } + virtual bool Pause() + { return false; } + virtual bool Stop() + { return false; } + + virtual bool Load(const wxString& WXUNUSED(fileName)) + { return false; } + virtual bool Load(const wxURI& WXUNUSED(location)) + { return false; } + + virtual bool SetPosition(wxLongLong WXUNUSED(where)) + { return 0; } + virtual wxLongLong GetPosition() + { return 0; } + virtual wxLongLong GetDuration() + { return 0; } + + virtual void Move(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(w), int WXUNUSED(h)) + { } + virtual wxSize GetVideoSize() const + { return wxSize(0,0); } + + virtual double GetPlaybackRate() + { return 0.0; } + virtual bool SetPlaybackRate(double WXUNUSED(dRate)) + { return false; } + + virtual wxMediaState GetState() + { return wxMEDIASTATE_STOPPED; } + + virtual double GetVolume() + { return 0.0; } + virtual bool SetVolume(double WXUNUSED(dVolume)) + { return false; } + + virtual bool Load(const wxURI& WXUNUSED(location), + const wxURI& WXUNUSED(proxy)) + { return false; } + + virtual bool ShowPlayerControls( + wxMediaCtrlPlayerControls WXUNUSED(flags)) + { return false; } + virtual bool IsInterfaceShown() + { return false; } + + virtual wxLongLong GetDownloadProgress() + { return 0; } + virtual wxLongLong GetDownloadTotal() + { return 0; } + + virtual void MacVisibilityChanged() + { } + virtual void RESERVED9() {} + + DECLARE_DYNAMIC_CLASS(wxMediaBackend) +}; + + +//Event ID to give to our events +#define wxMEDIA_FINISHED_ID 13000 +#define wxMEDIA_STOP_ID 13001 + +//Define our event types - we need to call DEFINE_EVENT_TYPE(EVT) later +DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_FINISHED, wxMEDIA_FINISHED_ID) +DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STOP, wxMEDIA_STOP_ID) + +//Function type(s) our events need +typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&); + +#define wxMediaEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMediaEventFunction, &func) + +//Macro for usage with message maps +#define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), +#define EVT_MEDIA_STOP(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), + +#if wxABI_VERSION >= 20602 /* 2.6.2+ only */ +# define wxMEDIA_LOADED_ID 13002 + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_LOADED, wxMEDIA_LOADED_ID) +# define EVT_MEDIA_LOADED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), +#endif + +#if wxABI_VERSION >= 20603 /* 2.6.3+ only */ +# define wxMEDIA_STATECHANGED_ID 13003 +# define wxMEDIA_PLAY_ID 13004 +# define wxMEDIA_PAUSE_ID 13005 + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STATECHANGED, wxMEDIA_STATECHANGED_ID) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PLAY, wxMEDIA_PLAY_ID) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PAUSE, wxMEDIA_PAUSE_ID) +# define EVT_MEDIA_STATECHANGED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STATECHANGED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), +# define EVT_MEDIA_PLAY(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PLAY, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), +# define EVT_MEDIA_PAUSE(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PAUSE, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ), +#endif + +// ---------------------------------------------------------------------------- +// common backend base class used by many other backends +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaBackendCommonBase : public wxMediaBackend +{ +public: + // add a pending wxMediaEvent of the given type + void QueueEvent(wxEventType evtType); + + // notify that the movie playback is finished + void QueueFinishEvent() + { +#if wxABI_VERSION >= 20603 /* 2.6.3+ only */ + QueueEvent(wxEVT_MEDIA_STATECHANGED); +#endif + QueueEvent(wxEVT_MEDIA_FINISHED); + } + + // send the stop event and return true if it hasn't been vetoed + bool SendStopEvent(); + + // Queue pause event + void QueuePlayEvent(); + + // Queue pause event + void QueuePauseEvent(); + + // Queue stop event (no veto) + void QueueStopEvent(); + +protected: + // call this when the movie size has changed but not because it has just + // been loaded (in this case, call NotifyMovieLoaded() below) + void NotifyMovieSizeChanged(); + + // call this when the movie is fully loaded + void NotifyMovieLoaded(); + + + wxMediaCtrl *m_ctrl; // parent control +}; + +// ---------------------------------------------------------------------------- +// End compilation gaurd +// ---------------------------------------------------------------------------- +#endif // wxUSE_MEDIACTRL + +// ---------------------------------------------------------------------------- +// End header guard and header itself +// ---------------------------------------------------------------------------- +#endif // _WX_MEDIACTRL_H_ + + diff --git a/Externals/wxWidgets/include/wx/memconf.h b/Externals/wxWidgets/include/wx/memconf.h index 9508b1fef9..eec82a43ae 100644 --- a/Externals/wxWidgets/include/wx/memconf.h +++ b/Externals/wxWidgets/include/wx/memconf.h @@ -1,54 +1,54 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/memconf.h -// Purpose: wxMemoryConfig class: a wxConfigBase implementation which only -// stores the settings in memory (thus they are lost when the -// program terminates) -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.01.00 -// RCS-ID: $Id: memconf.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - * NB: I don't see how this class may possibly be useful to the application - * program (as the settings are lost on program termination), but it is - * handy to have it inside wxWidgets. So for now let's say that this class - * is private and should only be used by wxWidgets itself - this might - * change in the future. - */ - -#ifndef _WX_MEMCONF_H_ -#define _WX_MEMCONF_H_ - -#if wxUSE_CONFIG - -#include "wx/fileconf.h" // the base class - -// ---------------------------------------------------------------------------- -// wxMemoryConfig: a config class which stores settings in non-persistent way -// ---------------------------------------------------------------------------- - -// notice that we inherit from wxFileConfig which already stores its data in -// memory and just disable file reading/writing - this is probably not optimal -// and might be changed in future as well (this class will always deriev from -// wxConfigBase though) -class wxMemoryConfig : public wxFileConfig -{ -public: - // default (and only) ctor - wxMemoryConfig() : wxFileConfig(wxEmptyString, // default app name - wxEmptyString, // default vendor name - wxEmptyString, // no local config file - wxEmptyString, // no system config file - 0) // don't use any files - { - } - - DECLARE_NO_COPY_CLASS(wxMemoryConfig) -}; - -#endif // wxUSE_CONFIG - -#endif // _WX_MEMCONF_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/memconf.h +// Purpose: wxMemoryConfig class: a wxConfigBase implementation which only +// stores the settings in memory (thus they are lost when the +// program terminates) +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.01.00 +// RCS-ID: $Id: memconf.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + * NB: I don't see how this class may possibly be useful to the application + * program (as the settings are lost on program termination), but it is + * handy to have it inside wxWidgets. So for now let's say that this class + * is private and should only be used by wxWidgets itself - this might + * change in the future. + */ + +#ifndef _WX_MEMCONF_H_ +#define _WX_MEMCONF_H_ + +#if wxUSE_CONFIG + +#include "wx/fileconf.h" // the base class + +// ---------------------------------------------------------------------------- +// wxMemoryConfig: a config class which stores settings in non-persistent way +// ---------------------------------------------------------------------------- + +// notice that we inherit from wxFileConfig which already stores its data in +// memory and just disable file reading/writing - this is probably not optimal +// and might be changed in future as well (this class will always deriev from +// wxConfigBase though) +class wxMemoryConfig : public wxFileConfig +{ +public: + // default (and only) ctor + wxMemoryConfig() : wxFileConfig(wxEmptyString, // default app name + wxEmptyString, // default vendor name + wxEmptyString, // no local config file + wxEmptyString, // no system config file + 0) // don't use any files + { + } + + DECLARE_NO_COPY_CLASS(wxMemoryConfig) +}; + +#endif // wxUSE_CONFIG + +#endif // _WX_MEMCONF_H_ diff --git a/Externals/wxWidgets/include/wx/memory.h b/Externals/wxWidgets/include/wx/memory.h index e4594f66e3..adb8ed2ba4 100644 --- a/Externals/wxWidgets/include/wx/memory.h +++ b/Externals/wxWidgets/include/wx/memory.h @@ -1,373 +1,373 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/memory.h -// Purpose: Memory operations -// Author: Arthur Seaton, Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: memory.h 39634 2006-06-08 12:51:01Z ABX $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MEMORYH__ -#define _WX_MEMORYH__ - -#include "wx/defs.h" -#include "wx/string.h" -#include "wx/msgout.h" - -/* - The macro which will be expanded to include the file and line number - info, or to be a straight call to the new operator. -*/ - -#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#include <stddef.h> - -#ifdef __WXDEBUG__ - -WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false); -WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); - -//********************************************************************************** -/* - The global operator new used for everything apart from getting - dynamic storage within this function itself. -*/ - -// We'll only do malloc and free for the moment: leave the interesting -// stuff for the wxObject versions. - - -#if wxUSE_GLOBAL_MEMORY_OPERATORS - -// Undefine temporarily (new is #defined in object.h) because we want to -// declare some new operators. -#ifdef new - #undef new -#endif - -#if defined(__SUNCC__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 -#elif defined (__SGI_CC_) - // only supported by -n32 compilers - #ifndef __EDG_ABI_COMPATIBILITY_VERSION - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 - #endif -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 -#else - // ::operator new[] is a recent C++ feature, so assume it's not supported - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#endif - -// devik 2000-8-29: All new/delete ops are now inline because they can't -// be marked as dllexport/dllimport. It then leads to weird bugs when -// used on MSW as DLL -#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) -inline void * operator new (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, false); -} - -inline void * operator new (size_t size) -{ - return wxDebugAlloc(size, NULL, 0, false); -} - -inline void operator delete (void * buf) -{ - wxDebugFree(buf, false); -} - -#if wxUSE_ARRAY_MEMORY_OPERATORS -inline void * operator new[] (size_t size) -{ - return wxDebugAlloc(size, NULL, 0, false, true); -} - -inline void * operator new[] (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, true); -} - -inline void operator delete[] (void * buf) -{ - wxDebugFree(buf, true); -} -#endif // wxUSE_ARRAY_MEMORY_OPERATORS - -#else - -void * operator new (size_t size, wxChar * fileName, int lineNum); - -void * operator new (size_t size); - -void operator delete (void * buf); - -#if wxUSE_ARRAY_MEMORY_OPERATORS -void * operator new[] (size_t size); - -void * operator new[] (size_t size, wxChar * fileName, int lineNum); - -void operator delete[] (void * buf); -#endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) - -// VC++ 6.0 and MWERKS -#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) || defined(__MWERKS__) -inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) -{ - wxDebugFree(pData, false); -} -inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */) -{ - wxDebugFree(pData, true); -} -#endif // __VISUALC__>=1200 -#endif // wxUSE_GLOBAL_MEMORY_OPERATORS -#endif // __WXDEBUG__ - -//********************************************************************************** - -typedef unsigned int wxMarkerType; - -/* - Define the struct which will be placed at the start of all dynamically - allocated memory. -*/ - -class WXDLLIMPEXP_BASE wxMemStruct { - -friend class WXDLLIMPEXP_BASE wxDebugContext; // access to the m_next pointer for list traversal. - -public: -public: - int AssertList (); - - size_t RequestSize () { return m_reqSize; } - wxMarkerType Marker () { return m_firstMarker; } - - // When an object is deleted we set the id slot to a specific value. - inline void SetDeleted (); - inline int IsDeleted (); - - int Append (); - int Unlink (); - - // Used to determine if the object is really a wxMemStruct. - // Not a foolproof test by any means, but better than none I hope! - int AssertIt (); - - // Do all validation on a node. - int ValidateNode (); - - // Check the integrity of a node and of the list, node by node. - int CheckBlock (); - int CheckAllPrevious (); - - // Print a single node. - void PrintNode (); - - // Called when the memory linking functions get an error. - void ErrorMsg (const char *); - void ErrorMsg (); - - inline void *GetActualData(void) const { return m_actualData; } - - void Dump(void); - -public: - // Check for underwriting. There are 2 of these checks. This one - // inside the struct and another right after the struct. - wxMarkerType m_firstMarker; - - // File name and line number are from cpp. - wxChar* m_fileName; - int m_lineNum; - - // The amount of memory requested by the caller. - size_t m_reqSize; - - // Used to try to verify that we really are dealing with an object - // of the required class. Can be 1 of 2 values these indicating a valid - // wxMemStruct object, or a deleted wxMemStruct object. - wxMarkerType m_id; - - wxMemStruct * m_prev; - wxMemStruct * m_next; - - void * m_actualData; - bool m_isObject; -}; - - -typedef void (wxMemStruct::*PmSFV) (); - - -/* - Debugging class. This will only have a single instance, but it's - a reasonable way to keep everything together and to make this - available for change if needed by someone else. - A lot of this stuff would be better off within the wxMemStruct class, but - it's stuff which we need to access at times when there is no wxMemStruct - object so we use this class instead. Think of it as a collection of - globals which have to do with the wxMemStruct class. -*/ - -class WXDLLIMPEXP_BASE wxDebugContext { - -protected: - // Used to set alignment for markers. - static size_t CalcAlignment (); - - // Returns the amount of padding needed after something of the given - // size. This is so that when we cast pointers backwards and forwards - // the pointer value will be valid for a wxMarkerType. - static size_t GetPadding (const size_t size) ; - - // Traverse the list. - static void TraverseList (PmSFV, wxMemStruct *from = NULL); - - static int debugLevel; - static bool debugOn; - - static int m_balign; // byte alignment - static int m_balignmask; // mask for performing byte alignment -public: - // Set a checkpoint to dump only the memory from - // a given point - static wxMemStruct *checkPoint; - - wxDebugContext(void); - ~wxDebugContext(void); - - static int GetLevel(void) { return debugLevel; } - static void SetLevel(int level) { debugLevel = level; } - - static bool GetDebugMode(void) { return debugOn; } - static void SetDebugMode(bool flag) { debugOn = flag; } - - static void SetCheckpoint(bool all = false); - static wxMemStruct *GetCheckpoint(void) { return checkPoint; } - - // Calculated from the request size and any padding needed - // before the final marker. - static size_t PaddedSize (const size_t reqSize); - - // Calc the total amount of space we need from the system - // to satisfy a caller request. This includes all padding. - static size_t TotSize (const size_t reqSize); - - // Return valid pointers to offsets within the allocated memory. - static char * StructPos (const char * buf); - static char * MidMarkerPos (const char * buf); - static char * CallerMemPos (const char * buf); - static char * EndMarkerPos (const char * buf, const size_t size); - - // Given a pointer to the start of the caller requested area - // return a pointer to the start of the entire alloc\'d buffer. - static char * StartPos (const char * caller); - - // Access to the list. - static wxMemStruct * GetHead () { return m_head; } - static wxMemStruct * GetTail () { return m_tail; } - - // Set the list sentinals. - static wxMemStruct * SetHead (wxMemStruct * st) { return (m_head = st); } - static wxMemStruct * SetTail (wxMemStruct * st) { return (m_tail = st); } - - // If this is set then every new operation checks the validity - // of the all previous nodes in the list. - static bool GetCheckPrevious () { return m_checkPrevious; } - static void SetCheckPrevious (bool value) { m_checkPrevious = value; } - - // Checks all nodes, or all nodes if checkAll is true - static int Check(bool checkAll = false); - - // Print out the list of wxMemStruct nodes. - static bool PrintList(void); - - // Dump objects - static bool Dump(void); - - // Print statistics - static bool PrintStatistics(bool detailed = true); - - // Print out the classes in the application. - static bool PrintClasses(void); - - // Count the number of non-wxDebugContext-related objects - // that are outstanding - static int CountObjectsLeft(bool sinceCheckpoint = false); - - // This function is used to output the dump - static void OutputDumpLine(const wxChar *szFormat, ...); - -private: - // Store these here to allow access to the list without - // needing to have a wxMemStruct object. - static wxMemStruct* m_head; - static wxMemStruct* m_tail; - - // Set to false if we're not checking all previous nodes when - // we do a new. Set to true when we are. - static bool m_checkPrevious; -}; - -// Final cleanup (e.g. deleting the log object and doing memory leak checking) -// will be delayed until all wxDebugContextDumpDelayCounter objects have been -// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay -// memory leak checking until after destructing all global objects. -class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter -{ -public: - wxDebugContextDumpDelayCounter() { - sm_count++; - } - - ~wxDebugContextDumpDelayCounter() { - sm_count--; - if(!sm_count) DoDump(); - } -private: - void DoDump(); - static int sm_count; -}; - -// make leak dump after all globals have been destructed -static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File; -#define WXDEBUG_DUMPDELAYCOUNTER \ - static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra; - -// Output a debug message, in a system dependent fashion. -void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1; -void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) ATTRIBUTE_PRINTF_2; - -#define WXTRACE wxTrace -#define WXTRACELEVEL wxTraceLevel - -#else // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#define WXDEBUG_DUMPDELAYCOUNTER - -// Borland C++ Builder 6 seems to have troubles with inline functions (see bug -// 819700) -#if 0 - inline void wxTrace(const wxChar *WXUNUSED(fmt)) {} - inline void wxTraceLevel(int WXUNUSED(level), const wxChar *WXUNUSED(fmt)) {} -#else - #define wxTrace(fmt) - #define wxTraceLevel(l, fmt) -#endif - -#define WXTRACE true ? (void)0 : wxTrace -#define WXTRACELEVEL true ? (void)0 : wxTraceLevel - -#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - -#endif - // _WX_MEMORYH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/memory.h +// Purpose: Memory operations +// Author: Arthur Seaton, Julian Smart +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: memory.h 39634 2006-06-08 12:51:01Z ABX $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MEMORYH__ +#define _WX_MEMORYH__ + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/msgout.h" + +/* + The macro which will be expanded to include the file and line number + info, or to be a straight call to the new operator. +*/ + +#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + +#include <stddef.h> + +#ifdef __WXDEBUG__ + +WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false); +WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); + +//********************************************************************************** +/* + The global operator new used for everything apart from getting + dynamic storage within this function itself. +*/ + +// We'll only do malloc and free for the moment: leave the interesting +// stuff for the wxObject versions. + + +#if wxUSE_GLOBAL_MEMORY_OPERATORS + +// Undefine temporarily (new is #defined in object.h) because we want to +// declare some new operators. +#ifdef new + #undef new +#endif + +#if defined(__SUNCC__) + #define wxUSE_ARRAY_MEMORY_OPERATORS 0 +#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) + #define wxUSE_ARRAY_MEMORY_OPERATORS 1 +#elif defined (__SGI_CC_) + // only supported by -n32 compilers + #ifndef __EDG_ABI_COMPATIBILITY_VERSION + #define wxUSE_ARRAY_MEMORY_OPERATORS 0 + #endif +#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) || defined( __MWERKS__) + #define wxUSE_ARRAY_MEMORY_OPERATORS 1 +#else + // ::operator new[] is a recent C++ feature, so assume it's not supported + #define wxUSE_ARRAY_MEMORY_OPERATORS 0 +#endif + +// devik 2000-8-29: All new/delete ops are now inline because they can't +// be marked as dllexport/dllimport. It then leads to weird bugs when +// used on MSW as DLL +#if defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) +inline void * operator new (size_t size, wxChar * fileName, int lineNum) +{ + return wxDebugAlloc(size, fileName, lineNum, false, false); +} + +inline void * operator new (size_t size) +{ + return wxDebugAlloc(size, NULL, 0, false); +} + +inline void operator delete (void * buf) +{ + wxDebugFree(buf, false); +} + +#if wxUSE_ARRAY_MEMORY_OPERATORS +inline void * operator new[] (size_t size) +{ + return wxDebugAlloc(size, NULL, 0, false, true); +} + +inline void * operator new[] (size_t size, wxChar * fileName, int lineNum) +{ + return wxDebugAlloc(size, fileName, lineNum, false, true); +} + +inline void operator delete[] (void * buf) +{ + wxDebugFree(buf, true); +} +#endif // wxUSE_ARRAY_MEMORY_OPERATORS + +#else + +void * operator new (size_t size, wxChar * fileName, int lineNum); + +void * operator new (size_t size); + +void operator delete (void * buf); + +#if wxUSE_ARRAY_MEMORY_OPERATORS +void * operator new[] (size_t size); + +void * operator new[] (size_t size, wxChar * fileName, int lineNum); + +void operator delete[] (void * buf); +#endif // wxUSE_ARRAY_MEMORY_OPERATORS +#endif // defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) + +// VC++ 6.0 and MWERKS +#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) || defined(__MWERKS__) +inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) +{ + wxDebugFree(pData, false); +} +inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */) +{ + wxDebugFree(pData, true); +} +#endif // __VISUALC__>=1200 +#endif // wxUSE_GLOBAL_MEMORY_OPERATORS +#endif // __WXDEBUG__ + +//********************************************************************************** + +typedef unsigned int wxMarkerType; + +/* + Define the struct which will be placed at the start of all dynamically + allocated memory. +*/ + +class WXDLLIMPEXP_BASE wxMemStruct { + +friend class WXDLLIMPEXP_BASE wxDebugContext; // access to the m_next pointer for list traversal. + +public: +public: + int AssertList (); + + size_t RequestSize () { return m_reqSize; } + wxMarkerType Marker () { return m_firstMarker; } + + // When an object is deleted we set the id slot to a specific value. + inline void SetDeleted (); + inline int IsDeleted (); + + int Append (); + int Unlink (); + + // Used to determine if the object is really a wxMemStruct. + // Not a foolproof test by any means, but better than none I hope! + int AssertIt (); + + // Do all validation on a node. + int ValidateNode (); + + // Check the integrity of a node and of the list, node by node. + int CheckBlock (); + int CheckAllPrevious (); + + // Print a single node. + void PrintNode (); + + // Called when the memory linking functions get an error. + void ErrorMsg (const char *); + void ErrorMsg (); + + inline void *GetActualData(void) const { return m_actualData; } + + void Dump(void); + +public: + // Check for underwriting. There are 2 of these checks. This one + // inside the struct and another right after the struct. + wxMarkerType m_firstMarker; + + // File name and line number are from cpp. + wxChar* m_fileName; + int m_lineNum; + + // The amount of memory requested by the caller. + size_t m_reqSize; + + // Used to try to verify that we really are dealing with an object + // of the required class. Can be 1 of 2 values these indicating a valid + // wxMemStruct object, or a deleted wxMemStruct object. + wxMarkerType m_id; + + wxMemStruct * m_prev; + wxMemStruct * m_next; + + void * m_actualData; + bool m_isObject; +}; + + +typedef void (wxMemStruct::*PmSFV) (); + + +/* + Debugging class. This will only have a single instance, but it's + a reasonable way to keep everything together and to make this + available for change if needed by someone else. + A lot of this stuff would be better off within the wxMemStruct class, but + it's stuff which we need to access at times when there is no wxMemStruct + object so we use this class instead. Think of it as a collection of + globals which have to do with the wxMemStruct class. +*/ + +class WXDLLIMPEXP_BASE wxDebugContext { + +protected: + // Used to set alignment for markers. + static size_t CalcAlignment (); + + // Returns the amount of padding needed after something of the given + // size. This is so that when we cast pointers backwards and forwards + // the pointer value will be valid for a wxMarkerType. + static size_t GetPadding (const size_t size) ; + + // Traverse the list. + static void TraverseList (PmSFV, wxMemStruct *from = NULL); + + static int debugLevel; + static bool debugOn; + + static int m_balign; // byte alignment + static int m_balignmask; // mask for performing byte alignment +public: + // Set a checkpoint to dump only the memory from + // a given point + static wxMemStruct *checkPoint; + + wxDebugContext(void); + ~wxDebugContext(void); + + static int GetLevel(void) { return debugLevel; } + static void SetLevel(int level) { debugLevel = level; } + + static bool GetDebugMode(void) { return debugOn; } + static void SetDebugMode(bool flag) { debugOn = flag; } + + static void SetCheckpoint(bool all = false); + static wxMemStruct *GetCheckpoint(void) { return checkPoint; } + + // Calculated from the request size and any padding needed + // before the final marker. + static size_t PaddedSize (const size_t reqSize); + + // Calc the total amount of space we need from the system + // to satisfy a caller request. This includes all padding. + static size_t TotSize (const size_t reqSize); + + // Return valid pointers to offsets within the allocated memory. + static char * StructPos (const char * buf); + static char * MidMarkerPos (const char * buf); + static char * CallerMemPos (const char * buf); + static char * EndMarkerPos (const char * buf, const size_t size); + + // Given a pointer to the start of the caller requested area + // return a pointer to the start of the entire alloc\'d buffer. + static char * StartPos (const char * caller); + + // Access to the list. + static wxMemStruct * GetHead () { return m_head; } + static wxMemStruct * GetTail () { return m_tail; } + + // Set the list sentinals. + static wxMemStruct * SetHead (wxMemStruct * st) { return (m_head = st); } + static wxMemStruct * SetTail (wxMemStruct * st) { return (m_tail = st); } + + // If this is set then every new operation checks the validity + // of the all previous nodes in the list. + static bool GetCheckPrevious () { return m_checkPrevious; } + static void SetCheckPrevious (bool value) { m_checkPrevious = value; } + + // Checks all nodes, or all nodes if checkAll is true + static int Check(bool checkAll = false); + + // Print out the list of wxMemStruct nodes. + static bool PrintList(void); + + // Dump objects + static bool Dump(void); + + // Print statistics + static bool PrintStatistics(bool detailed = true); + + // Print out the classes in the application. + static bool PrintClasses(void); + + // Count the number of non-wxDebugContext-related objects + // that are outstanding + static int CountObjectsLeft(bool sinceCheckpoint = false); + + // This function is used to output the dump + static void OutputDumpLine(const wxChar *szFormat, ...); + +private: + // Store these here to allow access to the list without + // needing to have a wxMemStruct object. + static wxMemStruct* m_head; + static wxMemStruct* m_tail; + + // Set to false if we're not checking all previous nodes when + // we do a new. Set to true when we are. + static bool m_checkPrevious; +}; + +// Final cleanup (e.g. deleting the log object and doing memory leak checking) +// will be delayed until all wxDebugContextDumpDelayCounter objects have been +// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay +// memory leak checking until after destructing all global objects. +class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter +{ +public: + wxDebugContextDumpDelayCounter() { + sm_count++; + } + + ~wxDebugContextDumpDelayCounter() { + sm_count--; + if(!sm_count) DoDump(); + } +private: + void DoDump(); + static int sm_count; +}; + +// make leak dump after all globals have been destructed +static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File; +#define WXDEBUG_DUMPDELAYCOUNTER \ + static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra; + +// Output a debug message, in a system dependent fashion. +void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1; +void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) ATTRIBUTE_PRINTF_2; + +#define WXTRACE wxTrace +#define WXTRACELEVEL wxTraceLevel + +#else // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + +#define WXDEBUG_DUMPDELAYCOUNTER + +// Borland C++ Builder 6 seems to have troubles with inline functions (see bug +// 819700) +#if 0 + inline void wxTrace(const wxChar *WXUNUSED(fmt)) {} + inline void wxTraceLevel(int WXUNUSED(level), const wxChar *WXUNUSED(fmt)) {} +#else + #define wxTrace(fmt) + #define wxTraceLevel(l, fmt) +#endif + +#define WXTRACE true ? (void)0 : wxTrace +#define WXTRACELEVEL true ? (void)0 : wxTraceLevel + +#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + +#endif + // _WX_MEMORYH__ diff --git a/Externals/wxWidgets/include/wx/memtext.h b/Externals/wxWidgets/include/wx/memtext.h index 16706092ac..a093f40b04 100644 --- a/Externals/wxWidgets/include/wx/memtext.h +++ b/Externals/wxWidgets/include/wx/memtext.h @@ -1,54 +1,54 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/memtext.h -// Purpose: wxMemoryText allows to use wxTextBuffer without a file -// Created: 14.11.01 -// Author: Morten Hanssen -// Copyright: (c) 2001 Morten Hanssen -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MEMTEXT_H -#define _WX_MEMTEXT_H - -#include "wx/defs.h" - -// there is no separate setting for wxMemoryText, it's smallish anyhow -#if wxUSE_TEXTBUFFER - -// ---------------------------------------------------------------------------- -// wxMemoryText -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMemoryText : public wxTextBuffer -{ -public: - // Constructors. - wxMemoryText() { } - wxMemoryText(const wxString& name) : wxTextBuffer(name) { } - -protected: - virtual bool OnExists() const - { return false; } - - virtual bool OnOpen(const wxString & WXUNUSED(strBufferName), - wxTextBufferOpenMode WXUNUSED(OpenMode)) - { return true; } - - virtual bool OnClose() - { return true; } - - virtual bool OnRead(const wxMBConv& WXUNUSED(conv)) - { return true; } - - virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew), - const wxMBConv& WXUNUSED(conv) = wxConvUTF8) - { return true; } - -private: - DECLARE_NO_COPY_CLASS(wxMemoryText) -}; - -#endif // wxUSE_TEXTBUFFER - -#endif // _WX_MEMTEXT_H - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/memtext.h +// Purpose: wxMemoryText allows to use wxTextBuffer without a file +// Created: 14.11.01 +// Author: Morten Hanssen +// Copyright: (c) 2001 Morten Hanssen +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MEMTEXT_H +#define _WX_MEMTEXT_H + +#include "wx/defs.h" + +// there is no separate setting for wxMemoryText, it's smallish anyhow +#if wxUSE_TEXTBUFFER + +// ---------------------------------------------------------------------------- +// wxMemoryText +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMemoryText : public wxTextBuffer +{ +public: + // Constructors. + wxMemoryText() { } + wxMemoryText(const wxString& name) : wxTextBuffer(name) { } + +protected: + virtual bool OnExists() const + { return false; } + + virtual bool OnOpen(const wxString & WXUNUSED(strBufferName), + wxTextBufferOpenMode WXUNUSED(OpenMode)) + { return true; } + + virtual bool OnClose() + { return true; } + + virtual bool OnRead(const wxMBConv& WXUNUSED(conv)) + { return true; } + + virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew), + const wxMBConv& WXUNUSED(conv) = wxConvUTF8) + { return true; } + +private: + DECLARE_NO_COPY_CLASS(wxMemoryText) +}; + +#endif // wxUSE_TEXTBUFFER + +#endif // _WX_MEMTEXT_H + diff --git a/Externals/wxWidgets/include/wx/menu.h b/Externals/wxWidgets/include/wx/menu.h index dad76c795e..23e47a0b35 100644 --- a/Externals/wxWidgets/include/wx/menu.h +++ b/Externals/wxWidgets/include/wx/menu.h @@ -1,555 +1,555 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/menu.h -// Purpose: wxMenu and wxMenuBar classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 26.10.99 -// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MENU_H_BASE_ -#define _WX_MENU_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MENUS - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/list.h" // for "template" list classes -#include "wx/window.h" // base class for wxMenuBar - -// also include this one to ensure compatibility with old code which only -// included wx/menu.h -#include "wx/menuitem.h" - -class WXDLLIMPEXP_FWD_CORE wxMenu; -class WXDLLIMPEXP_FWD_CORE wxMenuBarBase; -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; - -// pseudo template list classes -WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); -WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); - -// ---------------------------------------------------------------------------- -// wxMenu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuBase : public wxEvtHandler -{ -public: - // create a menu - static wxMenu *New(const wxString& title = wxEmptyString, long style = 0); - - // ctors - wxMenuBase(const wxString& title, long style = 0) : m_title(title) - { Init(style); } - wxMenuBase(long style = 0) - { Init(style); } - - // dtor deletes all the menu items we own - virtual ~wxMenuBase(); - - // menu construction - // ----------------- - - // append any kind of item (normal/check/radio/separator) - wxMenuItem* Append(int itemid, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); - } - - // append a separator to the menu - wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR, wxEmptyString); } - - // append a check item - wxMenuItem* AppendCheckItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Append(itemid, text, help, wxITEM_CHECK); - } - - // append a radio item - wxMenuItem* AppendRadioItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Append(itemid, text, help, wxITEM_RADIO); - } - - // append a submenu - wxMenuItem* AppendSubMenu(wxMenu *submenu, - const wxString& text, - const wxString& help = wxEmptyString) - { - return DoAppend(wxMenuItem::New((wxMenu *)this, wxID_ANY, text, help, - wxITEM_NORMAL, submenu)); - } - - // the most generic form of Append() - append anything - wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); } - - // insert a break in the menu (only works when appending the items, not - // inserting them) - virtual void Break() { } - - // insert an item before given position - wxMenuItem* Insert(size_t pos, wxMenuItem *item); - - // insert an item before given position - wxMenuItem* Insert(size_t pos, - int itemid, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); - } - - // insert a separator - wxMenuItem* InsertSeparator(size_t pos) - { - return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR)); - } - - // insert a check item - wxMenuItem* InsertCheckItem(size_t pos, - int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Insert(pos, itemid, text, help, wxITEM_CHECK); - } - - // insert a radio item - wxMenuItem* InsertRadioItem(size_t pos, - int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return Insert(pos, itemid, text, help, wxITEM_RADIO); - } - - // insert a submenu - wxMenuItem* Insert(size_t pos, - int itemid, - const wxString& text, - wxMenu *submenu, - const wxString& help = wxEmptyString) - { - return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, - wxITEM_NORMAL, submenu)); - } - - // prepend an item to the menu - wxMenuItem* Prepend(wxMenuItem *item) - { - return Insert(0u, item); - } - - // prepend any item to the menu - wxMenuItem* Prepend(int itemid, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return Insert(0u, itemid, text, help, kind); - } - - // prepend a separator - wxMenuItem* PrependSeparator() - { - return InsertSeparator(0u); - } - - // prepend a check item - wxMenuItem* PrependCheckItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return InsertCheckItem(0u, itemid, text, help); - } - - // prepend a radio item - wxMenuItem* PrependRadioItem(int itemid, - const wxString& text, - const wxString& help = wxEmptyString) - { - return InsertRadioItem(0u, itemid, text, help); - } - - // prepend a submenu - wxMenuItem* Prepend(int itemid, - const wxString& text, - wxMenu *submenu, - const wxString& help = wxEmptyString) - { - return Insert(0u, itemid, text, submenu, help); - } - - // detach an item from the menu, but don't delete it so that it can be - // added back later (but if it's not, the caller is responsible for - // deleting it!) - wxMenuItem *Remove(int itemid) { return Remove(FindChildItem(itemid)); } - wxMenuItem *Remove(wxMenuItem *item); - - // delete an item from the menu (submenus are not destroyed by this - // function, see Destroy) - bool Delete(int itemid) { return Delete(FindChildItem(itemid)); } - bool Delete(wxMenuItem *item); - - // delete the item from menu and destroy it (if it's a submenu) - bool Destroy(int itemid) { return Destroy(FindChildItem(itemid)); } - bool Destroy(wxMenuItem *item); - - // menu items access - // ----------------- - - // get the items - size_t GetMenuItemCount() const { return m_items.GetCount(); } - - const wxMenuItemList& GetMenuItems() const { return m_items; } - wxMenuItemList& GetMenuItems() { return m_items; } - - // search - virtual int FindItem(const wxString& item) const; - wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; - - // find by position - wxMenuItem* FindItemByPosition(size_t position) const; - - // get/set items attributes - void Enable(int itemid, bool enable); - bool IsEnabled(int itemid) const; - - void Check(int itemid, bool check); - bool IsChecked(int itemid) const; - - void SetLabel(int itemid, const wxString& label); - wxString GetLabel(int itemid) const; - - virtual void SetHelpString(int itemid, const wxString& helpString); - virtual wxString GetHelpString(int itemid) const; - - // misc accessors - // -------------- - - // the title - virtual void SetTitle(const wxString& title) { m_title = title; } - const wxString GetTitle() const { return m_title; } - - // event handler - void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } - wxEvtHandler *GetEventHandler() const { return m_eventHandler; } - - // invoking window - void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; } - wxWindow *GetInvokingWindow() const { return m_invokingWindow; } - - // style - long GetStyle() const { return m_style; } - - // implementation helpers - // ---------------------- - - // Updates the UI for a menu and all submenus recursively. source is the - // object that has the update event handlers defined for it. If NULL, the - // menu or associated window will be used. - void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL); - - // get the menu bar this menu is attached to (may be NULL, always NULL for - // popup menus). Traverse up the menu hierarchy to find it. - wxMenuBar *GetMenuBar() const; - - // called when the menu is attached/detached to/from a menu bar - virtual void Attach(wxMenuBarBase *menubar); - virtual void Detach(); - - // is the menu attached to a menu bar (or is it a popup one)? - bool IsAttached() const { return GetMenuBar() != NULL; } - - // set/get the parent of this menu - void SetParent(wxMenu *parent) { m_menuParent = parent; } - wxMenu *GetParent() const { return m_menuParent; } - - // implementation only from now on - // ------------------------------- - - // unlike FindItem(), this function doesn't recurse but only looks through - // our direct children and also may return the index of the found child if - // pos != NULL - wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const; - - // called to generate a wxCommandEvent, return true if it was processed, - // false otherwise - // - // the checked parameter may have boolean value or -1 for uncheckable items - bool SendEvent(int itemid, int checked = -1); - - // compatibility: these functions are deprecated, use the new ones instead - // ----------------------------------------------------------------------- - - // use the versions taking wxItem_XXX now instead, they're more readable - // and allow adding the radio items as well - void Append(int itemid, - const wxString& text, - const wxString& help, - bool isCheckable) - { - Append(itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); - } - - // use more readable and not requiring unused itemid AppendSubMenu() instead - wxMenuItem* Append(int itemid, - const wxString& text, - wxMenu *submenu, - const wxString& help = wxEmptyString) - { - return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, - wxITEM_NORMAL, submenu)); - } - - void Insert(size_t pos, - int itemid, - const wxString& text, - const wxString& help, - bool isCheckable) - { - Insert(pos, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); - } - - void Prepend(int itemid, - const wxString& text, - const wxString& help, - bool isCheckable) - { - Insert(0u, itemid, text, help, isCheckable); - } - - static void LockAccels(bool locked) - { - ms_locked = locked; - } - -protected: - // virtuals to override in derived classes - // --------------------------------------- - - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - - virtual wxMenuItem *DoRemove(wxMenuItem *item); - virtual bool DoDelete(wxMenuItem *item); - virtual bool DoDestroy(wxMenuItem *item); - - // helpers - // ------- - - // common part of all ctors - void Init(long style); - - // associate the submenu with this menu - void AddSubMenu(wxMenu *submenu); - - wxMenuBar *m_menuBar; // menubar we belong to or NULL - wxMenu *m_menuParent; // parent menu or NULL - - wxString m_title; // the menu title or label - wxMenuItemList m_items; // the list of menu items - - wxWindow *m_invokingWindow; // for popup menus - - long m_style; // combination of wxMENU_XXX flags - - wxEvtHandler *m_eventHandler; // a pluggable in event handler - - static bool ms_locked; - - DECLARE_NO_COPY_CLASS(wxMenuBase) - -public: - -#if wxABI_VERSION >= 20805 - // Returns the stripped label - wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelFromText(GetLabel(itemid)); } -#endif - -}; - -// ---------------------------------------------------------------------------- -// wxMenuBar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuBarBase : public wxWindow -{ -public: - // default ctor - wxMenuBarBase(); - - // dtor will delete all menus we own - virtual ~wxMenuBarBase(); - - // menu bar construction - // --------------------- - - // append a menu to the end of menubar, return true if ok - virtual bool Append(wxMenu *menu, const wxString& title); - - // insert a menu before the given position into the menubar, return true - // if inserted ok - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - - // menu bar items access - // --------------------- - - // get the number of menus in the menu bar - size_t GetMenuCount() const { return m_menus.GetCount(); } - - // get the menu at given position - wxMenu *GetMenu(size_t pos) const; - - // replace the menu at given position with another one, returns the - // previous menu (which should be deleted by the caller) - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - - // delete the menu at given position from the menu bar, return the pointer - // to the menu (which should be deleted by the caller) - virtual wxMenu *Remove(size_t pos); - - // enable or disable a submenu - virtual void EnableTop(size_t pos, bool enable) = 0; - - // is the menu enabled? - virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; } - - // get or change the label of the menu at given position - virtual void SetLabelTop(size_t pos, const wxString& label) = 0; - virtual wxString GetLabelTop(size_t pos) const = 0; - - // item search - // ----------- - - // by menu and item names, returns wxNOT_FOUND if not found or id of the - // found item - virtual int FindMenuItem(const wxString& menu, const wxString& item) const; - - // find item by id (in any menu), returns NULL if not found - // - // if menu is !NULL, it will be filled with wxMenu this item belongs to - virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; - - // find menu by its caption, return wxNOT_FOUND on failure - int FindMenu(const wxString& title) const; - - // item access - // ----------- - - // all these functions just use FindItem() and then call an appropriate - // method on it - // - // NB: under MSW, these methods can only be used after the menubar had - // been attached to the frame - - void Enable(int itemid, bool enable); - void Check(int itemid, bool check); - bool IsChecked(int itemid) const; - bool IsEnabled(int itemid) const; - virtual bool IsEnabled() const { return wxWindow::IsEnabled(); } - - void SetLabel(int itemid, const wxString &label); - wxString GetLabel(int itemid) const; - - void SetHelpString(int itemid, const wxString& helpString); - wxString GetHelpString(int itemid) const; - - // implementation helpers - - // get the frame we are attached to (may return NULL) - wxFrame *GetFrame() const { return m_menuBarFrame; } - - // returns true if we're attached to a frame - bool IsAttached() const { return GetFrame() != NULL; } - - // associate the menubar with the frame - virtual void Attach(wxFrame *frame); - - // called before deleting the menubar normally - virtual void Detach(); - - // need to override these ones to avoid virtual function hiding - virtual bool Enable(bool enable = true) { return wxWindow::Enable(enable); } - virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); } - virtual wxString GetLabel() const { return wxWindow::GetLabel(); } - - // don't want menu bars to accept the focus by tabbing to them - virtual bool AcceptsFocusFromKeyboard() const { return false; } - - // update all menu item states in all menus - virtual void UpdateMenus(); - -protected: - // the list of all our menus - wxMenuList m_menus; - - // the frame we are attached to (may be NULL) - wxFrame *m_menuBarFrame; - - DECLARE_NO_COPY_CLASS(wxMenuBarBase) - -public: - -#if wxABI_VERSION >= 20805 - // Replacement for SetLabelTop - void SetMenuLabel(size_t pos, const wxString& label) { SetLabelTop(pos, label); } - - // Gets the original label at the top-level of the menubar - // Implemented per port, since we can't have virtual functions in the stable branch. - // wxString GetMenuLabel(size_t pos) const; - - // Get the text only, from the label at the top-level of the menubar - wxString GetMenuLabelText(size_t pos) const; -#endif - -}; - -// ---------------------------------------------------------------------------- -// include the real class declaration -// ---------------------------------------------------------------------------- - -#ifdef wxUSE_BASE_CLASSES_ONLY - #define wxMenuItem wxMenuItemBase -#else // !wxUSE_BASE_CLASSES_ONLY -#if defined(__WXUNIVERSAL__) - #include "wx/univ/menu.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menu.h" -#elif defined(__WXMSW__) - #include "wx/msw/menu.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/menu.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/menu.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/menu.h" -#elif defined(__WXMAC__) - #include "wx/mac/menu.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/menu.h" -#elif defined(__WXPM__) - #include "wx/os2/menu.h" -#endif -#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY - -#endif // wxUSE_MENUS - -#endif - // _WX_MENU_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/menu.h +// Purpose: wxMenu and wxMenuBar classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 26.10.99 +// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_BASE_ +#define _WX_MENU_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MENUS + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/list.h" // for "template" list classes +#include "wx/window.h" // base class for wxMenuBar + +// also include this one to ensure compatibility with old code which only +// included wx/menu.h +#include "wx/menuitem.h" + +class WXDLLIMPEXP_FWD_CORE wxMenu; +class WXDLLIMPEXP_FWD_CORE wxMenuBarBase; +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxMenuItem; + +// pseudo template list classes +WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); +WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); + +// ---------------------------------------------------------------------------- +// wxMenu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuBase : public wxEvtHandler +{ +public: + // create a menu + static wxMenu *New(const wxString& title = wxEmptyString, long style = 0); + + // ctors + wxMenuBase(const wxString& title, long style = 0) : m_title(title) + { Init(style); } + wxMenuBase(long style = 0) + { Init(style); } + + // dtor deletes all the menu items we own + virtual ~wxMenuBase(); + + // menu construction + // ----------------- + + // append any kind of item (normal/check/radio/separator) + wxMenuItem* Append(int itemid, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); + } + + // append a separator to the menu + wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR, wxEmptyString); } + + // append a check item + wxMenuItem* AppendCheckItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Append(itemid, text, help, wxITEM_CHECK); + } + + // append a radio item + wxMenuItem* AppendRadioItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Append(itemid, text, help, wxITEM_RADIO); + } + + // append a submenu + wxMenuItem* AppendSubMenu(wxMenu *submenu, + const wxString& text, + const wxString& help = wxEmptyString) + { + return DoAppend(wxMenuItem::New((wxMenu *)this, wxID_ANY, text, help, + wxITEM_NORMAL, submenu)); + } + + // the most generic form of Append() - append anything + wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); } + + // insert a break in the menu (only works when appending the items, not + // inserting them) + virtual void Break() { } + + // insert an item before given position + wxMenuItem* Insert(size_t pos, wxMenuItem *item); + + // insert an item before given position + wxMenuItem* Insert(size_t pos, + int itemid, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); + } + + // insert a separator + wxMenuItem* InsertSeparator(size_t pos) + { + return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR)); + } + + // insert a check item + wxMenuItem* InsertCheckItem(size_t pos, + int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Insert(pos, itemid, text, help, wxITEM_CHECK); + } + + // insert a radio item + wxMenuItem* InsertRadioItem(size_t pos, + int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Insert(pos, itemid, text, help, wxITEM_RADIO); + } + + // insert a submenu + wxMenuItem* Insert(size_t pos, + int itemid, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, + wxITEM_NORMAL, submenu)); + } + + // prepend an item to the menu + wxMenuItem* Prepend(wxMenuItem *item) + { + return Insert(0u, item); + } + + // prepend any item to the menu + wxMenuItem* Prepend(int itemid, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return Insert(0u, itemid, text, help, kind); + } + + // prepend a separator + wxMenuItem* PrependSeparator() + { + return InsertSeparator(0u); + } + + // prepend a check item + wxMenuItem* PrependCheckItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return InsertCheckItem(0u, itemid, text, help); + } + + // prepend a radio item + wxMenuItem* PrependRadioItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return InsertRadioItem(0u, itemid, text, help); + } + + // prepend a submenu + wxMenuItem* Prepend(int itemid, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + return Insert(0u, itemid, text, submenu, help); + } + + // detach an item from the menu, but don't delete it so that it can be + // added back later (but if it's not, the caller is responsible for + // deleting it!) + wxMenuItem *Remove(int itemid) { return Remove(FindChildItem(itemid)); } + wxMenuItem *Remove(wxMenuItem *item); + + // delete an item from the menu (submenus are not destroyed by this + // function, see Destroy) + bool Delete(int itemid) { return Delete(FindChildItem(itemid)); } + bool Delete(wxMenuItem *item); + + // delete the item from menu and destroy it (if it's a submenu) + bool Destroy(int itemid) { return Destroy(FindChildItem(itemid)); } + bool Destroy(wxMenuItem *item); + + // menu items access + // ----------------- + + // get the items + size_t GetMenuItemCount() const { return m_items.GetCount(); } + + const wxMenuItemList& GetMenuItems() const { return m_items; } + wxMenuItemList& GetMenuItems() { return m_items; } + + // search + virtual int FindItem(const wxString& item) const; + wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; + + // find by position + wxMenuItem* FindItemByPosition(size_t position) const; + + // get/set items attributes + void Enable(int itemid, bool enable); + bool IsEnabled(int itemid) const; + + void Check(int itemid, bool check); + bool IsChecked(int itemid) const; + + void SetLabel(int itemid, const wxString& label); + wxString GetLabel(int itemid) const; + + virtual void SetHelpString(int itemid, const wxString& helpString); + virtual wxString GetHelpString(int itemid) const; + + // misc accessors + // -------------- + + // the title + virtual void SetTitle(const wxString& title) { m_title = title; } + const wxString GetTitle() const { return m_title; } + + // event handler + void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } + wxEvtHandler *GetEventHandler() const { return m_eventHandler; } + + // invoking window + void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; } + wxWindow *GetInvokingWindow() const { return m_invokingWindow; } + + // style + long GetStyle() const { return m_style; } + + // implementation helpers + // ---------------------- + + // Updates the UI for a menu and all submenus recursively. source is the + // object that has the update event handlers defined for it. If NULL, the + // menu or associated window will be used. + void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL); + + // get the menu bar this menu is attached to (may be NULL, always NULL for + // popup menus). Traverse up the menu hierarchy to find it. + wxMenuBar *GetMenuBar() const; + + // called when the menu is attached/detached to/from a menu bar + virtual void Attach(wxMenuBarBase *menubar); + virtual void Detach(); + + // is the menu attached to a menu bar (or is it a popup one)? + bool IsAttached() const { return GetMenuBar() != NULL; } + + // set/get the parent of this menu + void SetParent(wxMenu *parent) { m_menuParent = parent; } + wxMenu *GetParent() const { return m_menuParent; } + + // implementation only from now on + // ------------------------------- + + // unlike FindItem(), this function doesn't recurse but only looks through + // our direct children and also may return the index of the found child if + // pos != NULL + wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const; + + // called to generate a wxCommandEvent, return true if it was processed, + // false otherwise + // + // the checked parameter may have boolean value or -1 for uncheckable items + bool SendEvent(int itemid, int checked = -1); + + // compatibility: these functions are deprecated, use the new ones instead + // ----------------------------------------------------------------------- + + // use the versions taking wxItem_XXX now instead, they're more readable + // and allow adding the radio items as well + void Append(int itemid, + const wxString& text, + const wxString& help, + bool isCheckable) + { + Append(itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); + } + + // use more readable and not requiring unused itemid AppendSubMenu() instead + wxMenuItem* Append(int itemid, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, + wxITEM_NORMAL, submenu)); + } + + void Insert(size_t pos, + int itemid, + const wxString& text, + const wxString& help, + bool isCheckable) + { + Insert(pos, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); + } + + void Prepend(int itemid, + const wxString& text, + const wxString& help, + bool isCheckable) + { + Insert(0u, itemid, text, help, isCheckable); + } + + static void LockAccels(bool locked) + { + ms_locked = locked; + } + +protected: + // virtuals to override in derived classes + // --------------------------------------- + + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + + virtual wxMenuItem *DoRemove(wxMenuItem *item); + virtual bool DoDelete(wxMenuItem *item); + virtual bool DoDestroy(wxMenuItem *item); + + // helpers + // ------- + + // common part of all ctors + void Init(long style); + + // associate the submenu with this menu + void AddSubMenu(wxMenu *submenu); + + wxMenuBar *m_menuBar; // menubar we belong to or NULL + wxMenu *m_menuParent; // parent menu or NULL + + wxString m_title; // the menu title or label + wxMenuItemList m_items; // the list of menu items + + wxWindow *m_invokingWindow; // for popup menus + + long m_style; // combination of wxMENU_XXX flags + + wxEvtHandler *m_eventHandler; // a pluggable in event handler + + static bool ms_locked; + + DECLARE_NO_COPY_CLASS(wxMenuBase) + +public: + +#if wxABI_VERSION >= 20805 + // Returns the stripped label + wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelFromText(GetLabel(itemid)); } +#endif + +}; + +// ---------------------------------------------------------------------------- +// wxMenuBar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuBarBase : public wxWindow +{ +public: + // default ctor + wxMenuBarBase(); + + // dtor will delete all menus we own + virtual ~wxMenuBarBase(); + + // menu bar construction + // --------------------- + + // append a menu to the end of menubar, return true if ok + virtual bool Append(wxMenu *menu, const wxString& title); + + // insert a menu before the given position into the menubar, return true + // if inserted ok + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + + // menu bar items access + // --------------------- + + // get the number of menus in the menu bar + size_t GetMenuCount() const { return m_menus.GetCount(); } + + // get the menu at given position + wxMenu *GetMenu(size_t pos) const; + + // replace the menu at given position with another one, returns the + // previous menu (which should be deleted by the caller) + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + + // delete the menu at given position from the menu bar, return the pointer + // to the menu (which should be deleted by the caller) + virtual wxMenu *Remove(size_t pos); + + // enable or disable a submenu + virtual void EnableTop(size_t pos, bool enable) = 0; + + // is the menu enabled? + virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; } + + // get or change the label of the menu at given position + virtual void SetLabelTop(size_t pos, const wxString& label) = 0; + virtual wxString GetLabelTop(size_t pos) const = 0; + + // item search + // ----------- + + // by menu and item names, returns wxNOT_FOUND if not found or id of the + // found item + virtual int FindMenuItem(const wxString& menu, const wxString& item) const; + + // find item by id (in any menu), returns NULL if not found + // + // if menu is !NULL, it will be filled with wxMenu this item belongs to + virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; + + // find menu by its caption, return wxNOT_FOUND on failure + int FindMenu(const wxString& title) const; + + // item access + // ----------- + + // all these functions just use FindItem() and then call an appropriate + // method on it + // + // NB: under MSW, these methods can only be used after the menubar had + // been attached to the frame + + void Enable(int itemid, bool enable); + void Check(int itemid, bool check); + bool IsChecked(int itemid) const; + bool IsEnabled(int itemid) const; + virtual bool IsEnabled() const { return wxWindow::IsEnabled(); } + + void SetLabel(int itemid, const wxString &label); + wxString GetLabel(int itemid) const; + + void SetHelpString(int itemid, const wxString& helpString); + wxString GetHelpString(int itemid) const; + + // implementation helpers + + // get the frame we are attached to (may return NULL) + wxFrame *GetFrame() const { return m_menuBarFrame; } + + // returns true if we're attached to a frame + bool IsAttached() const { return GetFrame() != NULL; } + + // associate the menubar with the frame + virtual void Attach(wxFrame *frame); + + // called before deleting the menubar normally + virtual void Detach(); + + // need to override these ones to avoid virtual function hiding + virtual bool Enable(bool enable = true) { return wxWindow::Enable(enable); } + virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); } + virtual wxString GetLabel() const { return wxWindow::GetLabel(); } + + // don't want menu bars to accept the focus by tabbing to them + virtual bool AcceptsFocusFromKeyboard() const { return false; } + + // update all menu item states in all menus + virtual void UpdateMenus(); + +protected: + // the list of all our menus + wxMenuList m_menus; + + // the frame we are attached to (may be NULL) + wxFrame *m_menuBarFrame; + + DECLARE_NO_COPY_CLASS(wxMenuBarBase) + +public: + +#if wxABI_VERSION >= 20805 + // Replacement for SetLabelTop + void SetMenuLabel(size_t pos, const wxString& label) { SetLabelTop(pos, label); } + + // Gets the original label at the top-level of the menubar + // Implemented per port, since we can't have virtual functions in the stable branch. + // wxString GetMenuLabel(size_t pos) const; + + // Get the text only, from the label at the top-level of the menubar + wxString GetMenuLabelText(size_t pos) const; +#endif + +}; + +// ---------------------------------------------------------------------------- +// include the real class declaration +// ---------------------------------------------------------------------------- + +#ifdef wxUSE_BASE_CLASSES_ONLY + #define wxMenuItem wxMenuItemBase +#else // !wxUSE_BASE_CLASSES_ONLY +#if defined(__WXUNIVERSAL__) + #include "wx/univ/menu.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/menu.h" +#elif defined(__WXMSW__) + #include "wx/msw/menu.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/menu.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/menu.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/menu.h" +#elif defined(__WXMAC__) + #include "wx/mac/menu.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/menu.h" +#elif defined(__WXPM__) + #include "wx/os2/menu.h" +#endif +#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY + +#endif // wxUSE_MENUS + +#endif + // _WX_MENU_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/menuitem.h b/Externals/wxWidgets/include/wx/menuitem.h index 2a55e582bd..ac26948bae 100644 --- a/Externals/wxWidgets/include/wx/menuitem.h +++ b/Externals/wxWidgets/include/wx/menuitem.h @@ -1,203 +1,203 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/menuitem.h -// Purpose: wxMenuItem class -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.10.99 -// RCS-ID: $Id: menuitem.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MENUITEM_H_BASE_ -#define _WX_MENUITEM_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MENUS - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/object.h" // base class - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; -class WXDLLIMPEXP_FWD_CORE wxMenuItem; -class WXDLLIMPEXP_FWD_CORE wxMenu; - -// ---------------------------------------------------------------------------- -// wxMenuItem is an item in the menu which may be either a normal item, a sub -// menu or a separator -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuItemBase : public wxObject -{ -public: - // creation - static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL, - int itemid = wxID_SEPARATOR, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - - // destruction: wxMenuItem will delete its submenu - virtual ~wxMenuItemBase(); - - // the menu we're in - wxMenu *GetMenu() const { return m_parentMenu; } - void SetMenu(wxMenu* menu) { m_parentMenu = menu; } - - // get/set id - void SetId(int itemid) { m_id = itemid; } - int GetId() const { return m_id; } - bool IsSeparator() const { return m_id == wxID_SEPARATOR; } - - // the item's text (or name) - // - // NB: the item's text includes the accelerators and mnemonics info (if - // any), i.e. it may contain '&' or '_' or "\t..." and thus is - // different from the item's label which only contains the text shown - // in the menu - virtual void SetText(const wxString& str); - - wxString GetLabel() const { return GetLabelFromText(m_text); } - const wxString& GetText() const { return m_text; } - - // get the label from text (implemented in platform-specific code) - static wxString GetLabelFromText(const wxString& text); - - // what kind of menu item we are - wxItemKind GetKind() const { return m_kind; } - void SetKind(wxItemKind kind) { m_kind = kind; } - - virtual void SetCheckable(bool checkable) { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } - bool IsCheckable() const - { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } - - bool IsSubMenu() const { return m_subMenu != NULL; } - void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } - wxMenu *GetSubMenu() const { return m_subMenu; } - - // state - virtual void Enable(bool enable = true) { m_isEnabled = enable; } - virtual bool IsEnabled() const { return m_isEnabled; } - - virtual void Check(bool check = true) { m_isChecked = check; } - virtual bool IsChecked() const { return m_isChecked; } - void Toggle() { Check(!m_isChecked); } - - // help string (displayed in the status bar by default) - void SetHelp(const wxString& str); - const wxString& GetHelp() const { return m_help; } - -#if wxUSE_ACCEL - // extract the accelerator from the given menu string, return NULL if none - // found - static wxAcceleratorEntry *GetAccelFromString(const wxString& label); - - // get our accelerator or NULL (caller must delete the pointer) - virtual wxAcceleratorEntry *GetAccel() const; - - // set the accel for this item - this may also be done indirectly with - // SetText() - virtual void SetAccel(wxAcceleratorEntry *accel); -#endif // wxUSE_ACCEL - - // compatibility only, use new functions in the new code - void SetName(const wxString& str) { SetText(str); } - const wxString& GetName() const { return GetText(); } - - static wxMenuItem *New(wxMenu *parentMenu, - int itemid, - const wxString& text, - const wxString& help, - bool isCheckable, - wxMenu *subMenu = (wxMenu *)NULL) - { - return New(parentMenu, itemid, text, help, - isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); - } - -protected: - int m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR - wxMenu *m_parentMenu, // the menu we belong to - *m_subMenu; // our sub menu or NULL - wxString m_text, // label of the item - m_help; // the help string for the item - wxItemKind m_kind; // separator/normal/check/radio item? - bool m_isChecked; // is checked? - bool m_isEnabled; // is enabled? - - // this ctor is for the derived classes only, we're never created directly - wxMenuItemBase(wxMenu *parentMenu = (wxMenu *)NULL, - int itemid = wxID_SEPARATOR, - const wxString& text = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - -private: - // and, if we have one ctor, compiler won't generate a default copy one, so - // declare them ourselves - but don't implement as they shouldn't be used - wxMenuItemBase(const wxMenuItemBase& item); - wxMenuItemBase& operator=(const wxMenuItemBase& item); - -public: - -#if wxABI_VERSION >= 20805 - // Sets the label. This function replaces SetText. - void SetItemLabel(const wxString& str) { SetText(str); } - - // return the item label including any mnemonics and accelerators. - // This used to be called GetText. - // We can't implement this in the base class (no new virtuals in stable branch) - // wxString GetItemLabel() const; - - // return just the text of the item label, without any mnemonics - // This used to be called GetLabel. - wxString GetItemLabelText() const { return GetLabelText(m_text); } - - // return just the text part of the given label. In 2.9 and up, this is implemented in - // platform-specific code, but is now implemented in terms of GetLabelFromText. - static wxString GetLabelText(const wxString& label); -#endif -}; - -// ---------------------------------------------------------------------------- -// include the real class declaration -// ---------------------------------------------------------------------------- - -#ifdef wxUSE_BASE_CLASSES_ONLY - #define wxMenuItem wxMenuItemBase -#else // !wxUSE_BASE_CLASSES_ONLY -#if defined(__WXUNIVERSAL__) - #include "wx/univ/menuitem.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/menuitem.h" -#elif defined(__WXMSW__) - #include "wx/msw/menuitem.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/menuitem.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/menuitem.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/menuitem.h" -#elif defined(__WXMAC__) - #include "wx/mac/menuitem.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/menuitem.h" -#elif defined(__WXPM__) - #include "wx/os2/menuitem.h" -#endif -#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY - -#endif // wxUSE_MENUS - -#endif - // _WX_MENUITEM_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.10.99 +// RCS-ID: $Id: menuitem.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENUITEM_H_BASE_ +#define _WX_MENUITEM_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MENUS + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/object.h" // base class + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; +class WXDLLIMPEXP_FWD_CORE wxMenuItem; +class WXDLLIMPEXP_FWD_CORE wxMenu; + +// ---------------------------------------------------------------------------- +// wxMenuItem is an item in the menu which may be either a normal item, a sub +// menu or a separator +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuItemBase : public wxObject +{ +public: + // creation + static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL, + int itemid = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = (wxMenu *)NULL); + + // destruction: wxMenuItem will delete its submenu + virtual ~wxMenuItemBase(); + + // the menu we're in + wxMenu *GetMenu() const { return m_parentMenu; } + void SetMenu(wxMenu* menu) { m_parentMenu = menu; } + + // get/set id + void SetId(int itemid) { m_id = itemid; } + int GetId() const { return m_id; } + bool IsSeparator() const { return m_id == wxID_SEPARATOR; } + + // the item's text (or name) + // + // NB: the item's text includes the accelerators and mnemonics info (if + // any), i.e. it may contain '&' or '_' or "\t..." and thus is + // different from the item's label which only contains the text shown + // in the menu + virtual void SetText(const wxString& str); + + wxString GetLabel() const { return GetLabelFromText(m_text); } + const wxString& GetText() const { return m_text; } + + // get the label from text (implemented in platform-specific code) + static wxString GetLabelFromText(const wxString& text); + + // what kind of menu item we are + wxItemKind GetKind() const { return m_kind; } + void SetKind(wxItemKind kind) { m_kind = kind; } + + virtual void SetCheckable(bool checkable) { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } + bool IsCheckable() const + { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } + + bool IsSubMenu() const { return m_subMenu != NULL; } + void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } + wxMenu *GetSubMenu() const { return m_subMenu; } + + // state + virtual void Enable(bool enable = true) { m_isEnabled = enable; } + virtual bool IsEnabled() const { return m_isEnabled; } + + virtual void Check(bool check = true) { m_isChecked = check; } + virtual bool IsChecked() const { return m_isChecked; } + void Toggle() { Check(!m_isChecked); } + + // help string (displayed in the status bar by default) + void SetHelp(const wxString& str); + const wxString& GetHelp() const { return m_help; } + +#if wxUSE_ACCEL + // extract the accelerator from the given menu string, return NULL if none + // found + static wxAcceleratorEntry *GetAccelFromString(const wxString& label); + + // get our accelerator or NULL (caller must delete the pointer) + virtual wxAcceleratorEntry *GetAccel() const; + + // set the accel for this item - this may also be done indirectly with + // SetText() + virtual void SetAccel(wxAcceleratorEntry *accel); +#endif // wxUSE_ACCEL + + // compatibility only, use new functions in the new code + void SetName(const wxString& str) { SetText(str); } + const wxString& GetName() const { return GetText(); } + + static wxMenuItem *New(wxMenu *parentMenu, + int itemid, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = (wxMenu *)NULL) + { + return New(parentMenu, itemid, text, help, + isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); + } + +protected: + int m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR + wxMenu *m_parentMenu, // the menu we belong to + *m_subMenu; // our sub menu or NULL + wxString m_text, // label of the item + m_help; // the help string for the item + wxItemKind m_kind; // separator/normal/check/radio item? + bool m_isChecked; // is checked? + bool m_isEnabled; // is enabled? + + // this ctor is for the derived classes only, we're never created directly + wxMenuItemBase(wxMenu *parentMenu = (wxMenu *)NULL, + int itemid = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = (wxMenu *)NULL); + +private: + // and, if we have one ctor, compiler won't generate a default copy one, so + // declare them ourselves - but don't implement as they shouldn't be used + wxMenuItemBase(const wxMenuItemBase& item); + wxMenuItemBase& operator=(const wxMenuItemBase& item); + +public: + +#if wxABI_VERSION >= 20805 + // Sets the label. This function replaces SetText. + void SetItemLabel(const wxString& str) { SetText(str); } + + // return the item label including any mnemonics and accelerators. + // This used to be called GetText. + // We can't implement this in the base class (no new virtuals in stable branch) + // wxString GetItemLabel() const; + + // return just the text of the item label, without any mnemonics + // This used to be called GetLabel. + wxString GetItemLabelText() const { return GetLabelText(m_text); } + + // return just the text part of the given label. In 2.9 and up, this is implemented in + // platform-specific code, but is now implemented in terms of GetLabelFromText. + static wxString GetLabelText(const wxString& label); +#endif +}; + +// ---------------------------------------------------------------------------- +// include the real class declaration +// ---------------------------------------------------------------------------- + +#ifdef wxUSE_BASE_CLASSES_ONLY + #define wxMenuItem wxMenuItemBase +#else // !wxUSE_BASE_CLASSES_ONLY +#if defined(__WXUNIVERSAL__) + #include "wx/univ/menuitem.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/menuitem.h" +#elif defined(__WXMSW__) + #include "wx/msw/menuitem.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/menuitem.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/menuitem.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/menuitem.h" +#elif defined(__WXMAC__) + #include "wx/mac/menuitem.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/menuitem.h" +#elif defined(__WXPM__) + #include "wx/os2/menuitem.h" +#endif +#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY + +#endif // wxUSE_MENUS + +#endif + // _WX_MENUITEM_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/metafile.h b/Externals/wxWidgets/include/wx/metafile.h index 7d92ab0f38..50b8365241 100644 --- a/Externals/wxWidgets/include/wx/metafile.h +++ b/Externals/wxWidgets/include/wx/metafile.h @@ -1,62 +1,62 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/metafile.h -// Purpose: wxMetaFile class declaration -// Author: wxWidgets team -// Modified by: -// Created: 13.01.00 -// RCS-ID: $Id: metafile.h 39841 2006-06-26 14:37:34Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_METAFILE_H_BASE_ -#define _WX_METAFILE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_METAFILE - -// provide synonyms for all metafile classes -#define wxMetaFile wxMetafile -#define wxMetaFileDC wxMetafileDC -#define wxMetaFileDataObject wxMetafileDataObject - -#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable - -#if defined(__WXMSW__) - #if wxUSE_ENH_METAFILE - #if defined(__WXPALMOS__) - #include "wx/palmos/enhmeta.h" - #else - #include "wx/msw/enhmeta.h" - #endif - - #if wxUSE_WIN_METAFILES_ALWAYS - // use normal metafiles as well - #include "wx/msw/metafile.h" - #else // also map all metafile classes to enh metafile - typedef wxEnhMetaFile wxMetafile; - typedef wxEnhMetaFileDC wxMetafileDC; - #if wxUSE_DRAG_AND_DROP - typedef wxEnhMetaFileDataObject wxMetafileDataObject; - #endif - - // this flag will be set if wxMetafile class is wxEnhMetaFile - #define wxMETAFILE_IS_ENH - #endif // wxUSE_WIN_METAFILES_ALWAYS - #else // !wxUSE_ENH_METAFILE - #if defined(__WXPALMOS__) - #include "wx/palmos/metafile.h" - #else - #include "wx/msw/metafile.h" - #endif - #endif -#elif defined(__WXPM__) - #include "wx/os2/metafile.h" -#elif defined(__WXMAC__) - #include "wx/mac/metafile.h" -#endif - -#endif // wxUSE_METAFILE - -#endif // _WX_METAFILE_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/metafile.h +// Purpose: wxMetaFile class declaration +// Author: wxWidgets team +// Modified by: +// Created: 13.01.00 +// RCS-ID: $Id: metafile.h 39841 2006-06-26 14:37:34Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_METAFILE_H_BASE_ +#define _WX_METAFILE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_METAFILE + +// provide synonyms for all metafile classes +#define wxMetaFile wxMetafile +#define wxMetaFileDC wxMetafileDC +#define wxMetaFileDataObject wxMetafileDataObject + +#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable + +#if defined(__WXMSW__) + #if wxUSE_ENH_METAFILE + #if defined(__WXPALMOS__) + #include "wx/palmos/enhmeta.h" + #else + #include "wx/msw/enhmeta.h" + #endif + + #if wxUSE_WIN_METAFILES_ALWAYS + // use normal metafiles as well + #include "wx/msw/metafile.h" + #else // also map all metafile classes to enh metafile + typedef wxEnhMetaFile wxMetafile; + typedef wxEnhMetaFileDC wxMetafileDC; + #if wxUSE_DRAG_AND_DROP + typedef wxEnhMetaFileDataObject wxMetafileDataObject; + #endif + + // this flag will be set if wxMetafile class is wxEnhMetaFile + #define wxMETAFILE_IS_ENH + #endif // wxUSE_WIN_METAFILES_ALWAYS + #else // !wxUSE_ENH_METAFILE + #if defined(__WXPALMOS__) + #include "wx/palmos/metafile.h" + #else + #include "wx/msw/metafile.h" + #endif + #endif +#elif defined(__WXPM__) + #include "wx/os2/metafile.h" +#elif defined(__WXMAC__) + #include "wx/mac/metafile.h" +#endif + +#endif // wxUSE_METAFILE + +#endif // _WX_METAFILE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/mimetype.h b/Externals/wxWidgets/include/wx/mimetype.h index 8dfa73b94b..2ebf996184 100644 --- a/Externals/wxWidgets/include/wx/mimetype.h +++ b/Externals/wxWidgets/include/wx/mimetype.h @@ -1,453 +1,453 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mimetype.h -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 -// Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MIMETYPE_H_ -#define _WX_MIMETYPE_H_ - -// ---------------------------------------------------------------------------- -// headers and such -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_MIMETYPE - -// the things we really need -#include "wx/string.h" -#include "wx/dynarray.h" -#include "wx/arrstr.h" - -// fwd decls -class WXDLLIMPEXP_FWD_BASE wxIconLocation; -class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl; -class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; - -// these constants define the MIME informations source under UNIX and are used -// by wxMimeTypesManager::Initialize() -enum wxMailcapStyle -{ - wxMAILCAP_STANDARD = 1, - wxMAILCAP_NETSCAPE = 2, - wxMAILCAP_KDE = 4, - wxMAILCAP_GNOME = 8, - - wxMAILCAP_ALL = 15 -}; - -/* - TODO: would it be more convenient to have this class? - -class WXDLLIMPEXP_BASE wxMimeType : public wxString -{ -public: - // all string ctors here - - wxString GetType() const { return BeforeFirst(_T('/')); } - wxString GetSubType() const { return AfterFirst(_T('/')); } - - void SetSubType(const wxString& subtype) - { - *this = GetType() + _T('/') + subtype; - } - - bool Matches(const wxMimeType& wildcard) - { - // implement using wxMimeTypesManager::IsOfType() - } -}; - -*/ - -// wxMimeTypeCommands stores the verbs defined for the given MIME type with -// their values -class WXDLLIMPEXP_BASE wxMimeTypeCommands -{ -public: - wxMimeTypeCommands() {} - - wxMimeTypeCommands(const wxArrayString& verbs, - const wxArrayString& commands) - : m_verbs(verbs), - m_commands(commands) - { - } - - // add a new verb with the command or replace the old value - void AddOrReplaceVerb(const wxString& verb, const wxString& cmd); - void Add(const wxString& s) - { - m_verbs.Add(s.BeforeFirst(wxT('='))); - m_commands.Add(s.AfterFirst(wxT('='))); - } - - // access the commands - size_t GetCount() const { return m_verbs.GetCount(); } - const wxString& GetVerb(size_t n) const { return m_verbs[n]; } - const wxString& GetCmd(size_t n) const { return m_commands[n]; } - - bool HasVerb(const wxString& verb) const - { return m_verbs.Index(verb) != wxNOT_FOUND; } - - // returns empty string and wxNOT_FOUND in idx if no such verb - wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const; - - // get a "verb=command" string - wxString GetVerbCmd(size_t n) const; - -private: - wxArrayString m_verbs; - wxArrayString m_commands; -}; - -// ---------------------------------------------------------------------------- -// wxFileTypeInfo: static container of information accessed via wxFileType. -// -// This class is used with wxMimeTypesManager::AddFallbacks() and Associate() -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileTypeInfo -{ -public: - // ctors - // a normal item - wxFileTypeInfo(const wxChar *mimeType, - const wxChar *openCmd, - const wxChar *printCmd, - const wxChar *desc, - // the other parameters form a NULL terminated list of - // extensions - ...); - - // the array elements correspond to the parameters of the ctor above in - // the same order - wxFileTypeInfo(const wxArrayString& sArray); - - // invalid item - use this to terminate the array passed to - // wxMimeTypesManager::AddFallbacks - wxFileTypeInfo() { } - - // test if this object can be used - bool IsValid() const { return !m_mimeType.empty(); } - - // setters - // set the icon info - void SetIcon(const wxString& iconFile, int iconIndex = 0) - { - m_iconFile = iconFile; - m_iconIndex = iconIndex; - } - // set the short desc - void SetShortDesc(const wxString& shortDesc) { m_shortDesc = shortDesc; } - - // accessors - // get the MIME type - const wxString& GetMimeType() const { return m_mimeType; } - // get the open command - const wxString& GetOpenCommand() const { return m_openCmd; } - // get the print command - const wxString& GetPrintCommand() const { return m_printCmd; } - // get the short description (only used under Win32 so far) - const wxString& GetShortDesc() const { return m_shortDesc; } - // get the long, user visible description - const wxString& GetDescription() const { return m_desc; } - // get the array of all extensions - const wxArrayString& GetExtensions() const { return m_exts; } - size_t GetExtensionsCount() const {return m_exts.GetCount(); } - // get the icon info - const wxString& GetIconFile() const { return m_iconFile; } - int GetIconIndex() const { return m_iconIndex; } - -private: - wxString m_mimeType, // the MIME type in "type/subtype" form - m_openCmd, // command to use for opening the file (%s allowed) - m_printCmd, // command to use for printing the file (%s allowed) - m_shortDesc, // a short string used in the registry - m_desc; // a free form description of this file type - - // icon stuff - wxString m_iconFile; // the file containing the icon - int m_iconIndex; // icon index in this file - - wxArrayString m_exts; // the extensions which are mapped on this filetype - - -#if 0 // TODO - // the additional (except "open" and "print") command names and values - wxArrayString m_commandNames, - m_commandValues; -#endif // 0 -}; - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo, - WXDLLIMPEXP_BASE); - -// ---------------------------------------------------------------------------- -// wxFileType: gives access to all information about the files of given type. -// -// This class holds information about a given "file type". File type is the -// same as MIME type under Unix, but under Windows it corresponds more to an -// extension than to MIME type (in fact, several extensions may correspond to a -// file type). This object may be created in many different ways and depending -// on how it was created some fields may be unknown so the return value of all -// the accessors *must* be checked! -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileType -{ -friend class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; // it has access to m_impl - -public: - // An object of this class must be passed to Get{Open|Print}Command. The - // default implementation is trivial and doesn't know anything at all about - // parameters, only filename and MIME type are used (so it's probably ok for - // Windows where %{param} is not used anyhow) - class MessageParameters - { - public: - // ctors - MessageParameters() { } - MessageParameters(const wxString& filename, - const wxString& mimetype = wxEmptyString) - : m_filename(filename), m_mimetype(mimetype) { } - - // accessors (called by GetOpenCommand) - // filename - const wxString& GetFileName() const { return m_filename; } - // mime type - const wxString& GetMimeType() const { return m_mimetype; } - - // override this function in derived class - virtual wxString GetParamValue(const wxString& WXUNUSED(name)) const - { return wxEmptyString; } - - // virtual dtor as in any base class - virtual ~MessageParameters() { } - - protected: - wxString m_filename, m_mimetype; - }; - - // ctor from static data - wxFileType(const wxFileTypeInfo& ftInfo); - - // accessors: all of them return true if the corresponding information - // could be retrieved/found, false otherwise (and in this case all [out] - // parameters are unchanged) - // return the MIME type for this file type - bool GetMimeType(wxString *mimeType) const; - bool GetMimeTypes(wxArrayString& mimeTypes) const; - // fill passed in array with all extensions associated with this file - // type - bool GetExtensions(wxArrayString& extensions); - // get the icon corresponding to this file type and of the given size - bool GetIcon(wxIconLocation *iconloc) const; - bool GetIcon(wxIconLocation *iconloc, - const MessageParameters& params) const; - // get a brief file type description ("*.txt" => "text document") - bool GetDescription(wxString *desc) const; - - // get the command to be used to open/print the given file. - // get the command to execute the file of given type - bool GetOpenCommand(wxString *openCmd, - const MessageParameters& params) const; - // a simpler to use version of GetOpenCommand() -- it only takes the - // filename and returns an empty string on failure - wxString GetOpenCommand(const wxString& filename) const; - // get the command to print the file of given type - bool GetPrintCommand(wxString *printCmd, - const MessageParameters& params) const; - - - // return the number of commands defined for this file type, 0 if none - size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, - const wxFileType::MessageParameters& params) const; - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is true - bool SetCommand(const wxString& cmd, const wxString& verb, - bool overwriteprompt = true); - - bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); - - - // remove the association for this filetype from the system MIME database: - // notice that it will only work if the association is defined in the user - // file/registry part, we will never modify the system-wide settings - bool Unassociate(); - - // operations - // expand a string in the format of GetOpenCommand (which may contain - // '%s' and '%t' format specificators for the file name and mime type - // and %{param} constructions). - static wxString ExpandCommand(const wxString& command, - const MessageParameters& params); - - // dtor (not virtual, shouldn't be derived from) - ~wxFileType(); - -private: - // default ctor is private because the user code never creates us - wxFileType(); - - // no copy ctor/assignment operator - wxFileType(const wxFileType&); - wxFileType& operator=(const wxFileType&); - - // the static container of wxFileType data: if it's not NULL, it means that - // this object is used as fallback only - const wxFileTypeInfo *m_info; - - // the object which implements the real stuff like reading and writing - // to/from system MIME database - wxFileTypeImpl *m_impl; -}; - -//---------------------------------------------------------------------------- -// wxMimeTypesManagerFactory -//---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory -{ -public: - wxMimeTypesManagerFactory() {} - virtual ~wxMimeTypesManagerFactory() {} - - virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl(); - - static void Set( wxMimeTypesManagerFactory *factory ); - static wxMimeTypesManagerFactory *Get(); - -private: - static wxMimeTypesManagerFactory *m_factory; -}; - -// ---------------------------------------------------------------------------- -// wxMimeTypesManager: interface to system MIME database. -// -// This class accesses the information about all known MIME types and allows -// the application to retrieve information (including how to handle data of -// given type) about them. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMimeTypesManager -{ -public: - // static helper functions - // ----------------------- - - // check if the given MIME type is the same as the other one: the - // second argument may contain wildcards ('*'), but not the first. If - // the types are equal or if the mimeType matches wildcard the function - // returns true, otherwise it returns false - static bool IsOfType(const wxString& mimeType, const wxString& wildcard); - - // ctor - wxMimeTypesManager(); - - // NB: the following 2 functions are for Unix only and don't do anything - // elsewhere - - // loads data from standard files according to the mailcap styles - // specified: this is a bitwise OR of wxMailcapStyle values - // - // use the extraDir parameter if you want to look for files in another - // directory - void Initialize(int mailcapStyle = wxMAILCAP_ALL, - const wxString& extraDir = wxEmptyString); - - // and this function clears all the data from the manager - void ClearData(); - - // Database lookup: all functions return a pointer to wxFileType object - // whose methods may be used to query it for the information you're - // interested in. If the return value is !NULL, caller is responsible for - // deleting it. - // get file type from file extension - wxFileType *GetFileTypeFromExtension(const wxString& ext); - // get file type from MIME type (in format <category>/<format>) - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - // other operations: return true if there were no errors or false if there - // were some unrecognized entries (the good entries are always read anyhow) - // - // FIXME: These ought to be private ?? - - // read in additional file (the standard ones are read automatically) - // in mailcap format (see mimetype.cpp for description) - // - // 'fallback' parameter may be set to true to avoid overriding the - // settings from other, previously parsed, files by this one: normally, - // the files read most recently would override the older files, but with - // fallback == true this won't happen - - bool ReadMailcap(const wxString& filename, bool fallback = false); - // read in additional file in mime.types format - bool ReadMimeTypes(const wxString& filename); - - // enumerate all known MIME types - // - // returns the number of retrieved file types - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - // these functions can be used to provide default values for some of the - // MIME types inside the program itself (you may also use - // ReadMailcap(filenameWithDefaultTypes, true /* use as fallback */) to - // achieve the same goal, but this requires having this info in a file). - // - // The filetypes array should be terminated by either NULL entry or an - // invalid wxFileTypeInfo (i.e. the one created with default ctor) - void AddFallbacks(const wxFileTypeInfo *filetypes); - void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } - - // create or remove associations - - // create a new association using the fields of wxFileTypeInfo (at least - // the MIME type and the extension should be set) - // if the other fields are empty, the existing values should be left alone - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - - // undo Associate() - bool Unassociate(wxFileType *ft) ; - - // dtor (not virtual, shouldn't be derived from) - ~wxMimeTypesManager(); - -private: - // no copy ctor/assignment operator - wxMimeTypesManager(const wxMimeTypesManager&); - wxMimeTypesManager& operator=(const wxMimeTypesManager&); - - // the fallback info which is used if the information is not found in the - // real system database - wxArrayFileTypeInfo m_fallbacks; - - // the object working with the system MIME database - wxMimeTypesManagerImpl *m_impl; - - // if m_impl is NULL, create one - void EnsureImpl(); - - friend class wxMimeTypeCmnModule; -}; - - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the default mime manager for wxWidgets programs -extern WXDLLIMPEXP_DATA_BASE(wxMimeTypesManager *) wxTheMimeTypesManager; - -#endif // wxUSE_MIMETYPE - -#endif - //_WX_MIMETYPE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 +// Created: 23.09.98 +// RCS-ID: $Id: mimetype.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MIMETYPE_H_ +#define _WX_MIMETYPE_H_ + +// ---------------------------------------------------------------------------- +// headers and such +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE + +// the things we really need +#include "wx/string.h" +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +// fwd decls +class WXDLLIMPEXP_FWD_BASE wxIconLocation; +class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl; +class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; + +// these constants define the MIME informations source under UNIX and are used +// by wxMimeTypesManager::Initialize() +enum wxMailcapStyle +{ + wxMAILCAP_STANDARD = 1, + wxMAILCAP_NETSCAPE = 2, + wxMAILCAP_KDE = 4, + wxMAILCAP_GNOME = 8, + + wxMAILCAP_ALL = 15 +}; + +/* + TODO: would it be more convenient to have this class? + +class WXDLLIMPEXP_BASE wxMimeType : public wxString +{ +public: + // all string ctors here + + wxString GetType() const { return BeforeFirst(_T('/')); } + wxString GetSubType() const { return AfterFirst(_T('/')); } + + void SetSubType(const wxString& subtype) + { + *this = GetType() + _T('/') + subtype; + } + + bool Matches(const wxMimeType& wildcard) + { + // implement using wxMimeTypesManager::IsOfType() + } +}; + +*/ + +// wxMimeTypeCommands stores the verbs defined for the given MIME type with +// their values +class WXDLLIMPEXP_BASE wxMimeTypeCommands +{ +public: + wxMimeTypeCommands() {} + + wxMimeTypeCommands(const wxArrayString& verbs, + const wxArrayString& commands) + : m_verbs(verbs), + m_commands(commands) + { + } + + // add a new verb with the command or replace the old value + void AddOrReplaceVerb(const wxString& verb, const wxString& cmd); + void Add(const wxString& s) + { + m_verbs.Add(s.BeforeFirst(wxT('='))); + m_commands.Add(s.AfterFirst(wxT('='))); + } + + // access the commands + size_t GetCount() const { return m_verbs.GetCount(); } + const wxString& GetVerb(size_t n) const { return m_verbs[n]; } + const wxString& GetCmd(size_t n) const { return m_commands[n]; } + + bool HasVerb(const wxString& verb) const + { return m_verbs.Index(verb) != wxNOT_FOUND; } + + // returns empty string and wxNOT_FOUND in idx if no such verb + wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const; + + // get a "verb=command" string + wxString GetVerbCmd(size_t n) const; + +private: + wxArrayString m_verbs; + wxArrayString m_commands; +}; + +// ---------------------------------------------------------------------------- +// wxFileTypeInfo: static container of information accessed via wxFileType. +// +// This class is used with wxMimeTypesManager::AddFallbacks() and Associate() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileTypeInfo +{ +public: + // ctors + // a normal item + wxFileTypeInfo(const wxChar *mimeType, + const wxChar *openCmd, + const wxChar *printCmd, + const wxChar *desc, + // the other parameters form a NULL terminated list of + // extensions + ...); + + // the array elements correspond to the parameters of the ctor above in + // the same order + wxFileTypeInfo(const wxArrayString& sArray); + + // invalid item - use this to terminate the array passed to + // wxMimeTypesManager::AddFallbacks + wxFileTypeInfo() { } + + // test if this object can be used + bool IsValid() const { return !m_mimeType.empty(); } + + // setters + // set the icon info + void SetIcon(const wxString& iconFile, int iconIndex = 0) + { + m_iconFile = iconFile; + m_iconIndex = iconIndex; + } + // set the short desc + void SetShortDesc(const wxString& shortDesc) { m_shortDesc = shortDesc; } + + // accessors + // get the MIME type + const wxString& GetMimeType() const { return m_mimeType; } + // get the open command + const wxString& GetOpenCommand() const { return m_openCmd; } + // get the print command + const wxString& GetPrintCommand() const { return m_printCmd; } + // get the short description (only used under Win32 so far) + const wxString& GetShortDesc() const { return m_shortDesc; } + // get the long, user visible description + const wxString& GetDescription() const { return m_desc; } + // get the array of all extensions + const wxArrayString& GetExtensions() const { return m_exts; } + size_t GetExtensionsCount() const {return m_exts.GetCount(); } + // get the icon info + const wxString& GetIconFile() const { return m_iconFile; } + int GetIconIndex() const { return m_iconIndex; } + +private: + wxString m_mimeType, // the MIME type in "type/subtype" form + m_openCmd, // command to use for opening the file (%s allowed) + m_printCmd, // command to use for printing the file (%s allowed) + m_shortDesc, // a short string used in the registry + m_desc; // a free form description of this file type + + // icon stuff + wxString m_iconFile; // the file containing the icon + int m_iconIndex; // icon index in this file + + wxArrayString m_exts; // the extensions which are mapped on this filetype + + +#if 0 // TODO + // the additional (except "open" and "print") command names and values + wxArrayString m_commandNames, + m_commandValues; +#endif // 0 +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo, + WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// wxFileType: gives access to all information about the files of given type. +// +// This class holds information about a given "file type". File type is the +// same as MIME type under Unix, but under Windows it corresponds more to an +// extension than to MIME type (in fact, several extensions may correspond to a +// file type). This object may be created in many different ways and depending +// on how it was created some fields may be unknown so the return value of all +// the accessors *must* be checked! +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileType +{ +friend class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; // it has access to m_impl + +public: + // An object of this class must be passed to Get{Open|Print}Command. The + // default implementation is trivial and doesn't know anything at all about + // parameters, only filename and MIME type are used (so it's probably ok for + // Windows where %{param} is not used anyhow) + class MessageParameters + { + public: + // ctors + MessageParameters() { } + MessageParameters(const wxString& filename, + const wxString& mimetype = wxEmptyString) + : m_filename(filename), m_mimetype(mimetype) { } + + // accessors (called by GetOpenCommand) + // filename + const wxString& GetFileName() const { return m_filename; } + // mime type + const wxString& GetMimeType() const { return m_mimetype; } + + // override this function in derived class + virtual wxString GetParamValue(const wxString& WXUNUSED(name)) const + { return wxEmptyString; } + + // virtual dtor as in any base class + virtual ~MessageParameters() { } + + protected: + wxString m_filename, m_mimetype; + }; + + // ctor from static data + wxFileType(const wxFileTypeInfo& ftInfo); + + // accessors: all of them return true if the corresponding information + // could be retrieved/found, false otherwise (and in this case all [out] + // parameters are unchanged) + // return the MIME type for this file type + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + // fill passed in array with all extensions associated with this file + // type + bool GetExtensions(wxArrayString& extensions); + // get the icon corresponding to this file type and of the given size + bool GetIcon(wxIconLocation *iconloc) const; + bool GetIcon(wxIconLocation *iconloc, + const MessageParameters& params) const; + // get a brief file type description ("*.txt" => "text document") + bool GetDescription(wxString *desc) const; + + // get the command to be used to open/print the given file. + // get the command to execute the file of given type + bool GetOpenCommand(wxString *openCmd, + const MessageParameters& params) const; + // a simpler to use version of GetOpenCommand() -- it only takes the + // filename and returns an empty string on failure + wxString GetOpenCommand(const wxString& filename) const; + // get the command to print the file of given type + bool GetPrintCommand(wxString *printCmd, + const MessageParameters& params) const; + + + // return the number of commands defined for this file type, 0 if none + size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, + const wxFileType::MessageParameters& params) const; + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is true + bool SetCommand(const wxString& cmd, const wxString& verb, + bool overwriteprompt = true); + + bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); + + + // remove the association for this filetype from the system MIME database: + // notice that it will only work if the association is defined in the user + // file/registry part, we will never modify the system-wide settings + bool Unassociate(); + + // operations + // expand a string in the format of GetOpenCommand (which may contain + // '%s' and '%t' format specificators for the file name and mime type + // and %{param} constructions). + static wxString ExpandCommand(const wxString& command, + const MessageParameters& params); + + // dtor (not virtual, shouldn't be derived from) + ~wxFileType(); + +private: + // default ctor is private because the user code never creates us + wxFileType(); + + // no copy ctor/assignment operator + wxFileType(const wxFileType&); + wxFileType& operator=(const wxFileType&); + + // the static container of wxFileType data: if it's not NULL, it means that + // this object is used as fallback only + const wxFileTypeInfo *m_info; + + // the object which implements the real stuff like reading and writing + // to/from system MIME database + wxFileTypeImpl *m_impl; +}; + +//---------------------------------------------------------------------------- +// wxMimeTypesManagerFactory +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory +{ +public: + wxMimeTypesManagerFactory() {} + virtual ~wxMimeTypesManagerFactory() {} + + virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl(); + + static void Set( wxMimeTypesManagerFactory *factory ); + static wxMimeTypesManagerFactory *Get(); + +private: + static wxMimeTypesManagerFactory *m_factory; +}; + +// ---------------------------------------------------------------------------- +// wxMimeTypesManager: interface to system MIME database. +// +// This class accesses the information about all known MIME types and allows +// the application to retrieve information (including how to handle data of +// given type) about them. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMimeTypesManager +{ +public: + // static helper functions + // ----------------------- + + // check if the given MIME type is the same as the other one: the + // second argument may contain wildcards ('*'), but not the first. If + // the types are equal or if the mimeType matches wildcard the function + // returns true, otherwise it returns false + static bool IsOfType(const wxString& mimeType, const wxString& wildcard); + + // ctor + wxMimeTypesManager(); + + // NB: the following 2 functions are for Unix only and don't do anything + // elsewhere + + // loads data from standard files according to the mailcap styles + // specified: this is a bitwise OR of wxMailcapStyle values + // + // use the extraDir parameter if you want to look for files in another + // directory + void Initialize(int mailcapStyle = wxMAILCAP_ALL, + const wxString& extraDir = wxEmptyString); + + // and this function clears all the data from the manager + void ClearData(); + + // Database lookup: all functions return a pointer to wxFileType object + // whose methods may be used to query it for the information you're + // interested in. If the return value is !NULL, caller is responsible for + // deleting it. + // get file type from file extension + wxFileType *GetFileTypeFromExtension(const wxString& ext); + // get file type from MIME type (in format <category>/<format>) + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + // other operations: return true if there were no errors or false if there + // were some unrecognized entries (the good entries are always read anyhow) + // + // FIXME: These ought to be private ?? + + // read in additional file (the standard ones are read automatically) + // in mailcap format (see mimetype.cpp for description) + // + // 'fallback' parameter may be set to true to avoid overriding the + // settings from other, previously parsed, files by this one: normally, + // the files read most recently would override the older files, but with + // fallback == true this won't happen + + bool ReadMailcap(const wxString& filename, bool fallback = false); + // read in additional file in mime.types format + bool ReadMimeTypes(const wxString& filename); + + // enumerate all known MIME types + // + // returns the number of retrieved file types + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + // these functions can be used to provide default values for some of the + // MIME types inside the program itself (you may also use + // ReadMailcap(filenameWithDefaultTypes, true /* use as fallback */) to + // achieve the same goal, but this requires having this info in a file). + // + // The filetypes array should be terminated by either NULL entry or an + // invalid wxFileTypeInfo (i.e. the one created with default ctor) + void AddFallbacks(const wxFileTypeInfo *filetypes); + void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } + + // create or remove associations + + // create a new association using the fields of wxFileTypeInfo (at least + // the MIME type and the extension should be set) + // if the other fields are empty, the existing values should be left alone + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + + // undo Associate() + bool Unassociate(wxFileType *ft) ; + + // dtor (not virtual, shouldn't be derived from) + ~wxMimeTypesManager(); + +private: + // no copy ctor/assignment operator + wxMimeTypesManager(const wxMimeTypesManager&); + wxMimeTypesManager& operator=(const wxMimeTypesManager&); + + // the fallback info which is used if the information is not found in the + // real system database + wxArrayFileTypeInfo m_fallbacks; + + // the object working with the system MIME database + wxMimeTypesManagerImpl *m_impl; + + // if m_impl is NULL, create one + void EnsureImpl(); + + friend class wxMimeTypeCmnModule; +}; + + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default mime manager for wxWidgets programs +extern WXDLLIMPEXP_DATA_BASE(wxMimeTypesManager *) wxTheMimeTypesManager; + +#endif // wxUSE_MIMETYPE + +#endif + //_WX_MIMETYPE_H_ diff --git a/Externals/wxWidgets/include/wx/minifram.h b/Externals/wxWidgets/include/wx/minifram.h index 50df6006a1..b05574a65b 100644 --- a/Externals/wxWidgets/include/wx/minifram.h +++ b/Externals/wxWidgets/include/wx/minifram.h @@ -1,43 +1,43 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/minifram.h -// Purpose: wxMiniFrame base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: minifram.h 49299 2007-10-21 18:07:29Z PC $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MINIFRAM_H_BASE_ -#define _WX_MINIFRAM_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MINIFRAME - -#if defined(__WXPALMOS__) -#include "wx/palmos/minifram.h" -#elif defined(__WXMSW__) -#include "wx/msw/minifram.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/minifram.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/minifram.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/minifram.h" -#elif defined(__WXX11__) -#include "wx/x11/minifram.h" -#elif defined(__WXMAC__) -#include "wx/mac/minifram.h" -#elif defined(__WXPM__) -#include "wx/os2/minifram.h" -#else -// TODO: it seems that wxMiniFrame could be just defined here generically -// instead of having all the above port-specific headers -#include "wx/frame.h" -typedef wxFrame wxMiniFrame; -#endif - -#endif // wxUSE_MINIFRAME -#endif // _WX_MINIFRAM_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/minifram.h +// Purpose: wxMiniFrame base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: minifram.h 49299 2007-10-21 18:07:29Z PC $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_BASE_ +#define _WX_MINIFRAM_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MINIFRAME + +#if defined(__WXPALMOS__) +#include "wx/palmos/minifram.h" +#elif defined(__WXMSW__) +#include "wx/msw/minifram.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/minifram.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/minifram.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/minifram.h" +#elif defined(__WXX11__) +#include "wx/x11/minifram.h" +#elif defined(__WXMAC__) +#include "wx/mac/minifram.h" +#elif defined(__WXPM__) +#include "wx/os2/minifram.h" +#else +// TODO: it seems that wxMiniFrame could be just defined here generically +// instead of having all the above port-specific headers +#include "wx/frame.h" +typedef wxFrame wxMiniFrame; +#endif + +#endif // wxUSE_MINIFRAME +#endif // _WX_MINIFRAM_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/module.h b/Externals/wxWidgets/include/wx/module.h index 5e8af96ac9..7394f4e616 100644 --- a/Externals/wxWidgets/include/wx/module.h +++ b/Externals/wxWidgets/include/wx/module.h @@ -1,103 +1,103 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/module.h -// Purpose: Modules handling -// Author: Wolfram Gloger/adapted by Guilhem Lavaux -// Modified by: -// Created: 04/11/98 -// RCS-ID: $Id: module.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Wolfram Gloger and Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MODULE_H_ -#define _WX_MODULE_H_ - -#include "wx/object.h" -#include "wx/list.h" -#include "wx/dynarray.h" - -// declare a linked list of modules -class WXDLLIMPEXP_FWD_BASE wxModule; -WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE); - -// and an array of class info objects -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxClassInfo *, wxArrayClassInfo, - class WXDLLIMPEXP_BASE); - - -// declaring a class derived from wxModule will automatically create an -// instance of this class on program startup, call its OnInit() method and call -// OnExit() on program termination (but only if OnInit() succeeded) -class WXDLLIMPEXP_BASE wxModule : public wxObject -{ -public: - wxModule() {} - virtual ~wxModule() {} - - // if module init routine returns false the application - // will fail to startup - - bool Init() { return OnInit(); } - void Exit() { OnExit(); } - - // Override both of these - - // called on program startup - - virtual bool OnInit() = 0; - - // called just before program termination, but only if OnInit() - // succeeded - - virtual void OnExit() = 0; - - static void RegisterModule(wxModule *module); - static void RegisterModules(); - static bool InitializeModules(); - static void CleanUpModules() { DoCleanUpModules(m_modules); } - - // used by wxObjectLoader when unloading shared libs's - - static void UnregisterModule(wxModule *module); - -protected: - static wxModuleList m_modules; - - // the function to call from constructor of a deriving class add module - // dependency which will be initialized before the module and unloaded - // after that - void AddDependency(wxClassInfo *dep) - { - wxCHECK_RET( dep, _T("NULL module dependency") ); - - m_dependencies.Add(dep); - } - -private: - // initialize module and Append it to initializedModules list recursively - // calling itself to satisfy module dependencies if needed - static bool - DoInitializeModule(wxModule *module, wxModuleList &initializedModules); - - // cleanup the modules in the specified list (which may not contain all - // modules if we're called during initialization because not all modules - // could be initialized) and also empty m_modules itself - static void DoCleanUpModules(const wxModuleList& modules); - - - // module dependencies: contains - wxArrayClassInfo m_dependencies; - - // used internally while initiliazing/cleaning up modules - enum - { - State_Registered, // module registered but not initialized yet - State_Initializing, // we're initializing this module but not done yet - State_Initialized // module initialized successfully - } m_state; - - - DECLARE_CLASS(wxModule) -}; - -#endif // _WX_MODULE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/module.h +// Purpose: Modules handling +// Author: Wolfram Gloger/adapted by Guilhem Lavaux +// Modified by: +// Created: 04/11/98 +// RCS-ID: $Id: module.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Wolfram Gloger and Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MODULE_H_ +#define _WX_MODULE_H_ + +#include "wx/object.h" +#include "wx/list.h" +#include "wx/dynarray.h" + +// declare a linked list of modules +class WXDLLIMPEXP_FWD_BASE wxModule; +WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE); + +// and an array of class info objects +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxClassInfo *, wxArrayClassInfo, + class WXDLLIMPEXP_BASE); + + +// declaring a class derived from wxModule will automatically create an +// instance of this class on program startup, call its OnInit() method and call +// OnExit() on program termination (but only if OnInit() succeeded) +class WXDLLIMPEXP_BASE wxModule : public wxObject +{ +public: + wxModule() {} + virtual ~wxModule() {} + + // if module init routine returns false the application + // will fail to startup + + bool Init() { return OnInit(); } + void Exit() { OnExit(); } + + // Override both of these + + // called on program startup + + virtual bool OnInit() = 0; + + // called just before program termination, but only if OnInit() + // succeeded + + virtual void OnExit() = 0; + + static void RegisterModule(wxModule *module); + static void RegisterModules(); + static bool InitializeModules(); + static void CleanUpModules() { DoCleanUpModules(m_modules); } + + // used by wxObjectLoader when unloading shared libs's + + static void UnregisterModule(wxModule *module); + +protected: + static wxModuleList m_modules; + + // the function to call from constructor of a deriving class add module + // dependency which will be initialized before the module and unloaded + // after that + void AddDependency(wxClassInfo *dep) + { + wxCHECK_RET( dep, _T("NULL module dependency") ); + + m_dependencies.Add(dep); + } + +private: + // initialize module and Append it to initializedModules list recursively + // calling itself to satisfy module dependencies if needed + static bool + DoInitializeModule(wxModule *module, wxModuleList &initializedModules); + + // cleanup the modules in the specified list (which may not contain all + // modules if we're called during initialization because not all modules + // could be initialized) and also empty m_modules itself + static void DoCleanUpModules(const wxModuleList& modules); + + + // module dependencies: contains + wxArrayClassInfo m_dependencies; + + // used internally while initiliazing/cleaning up modules + enum + { + State_Registered, // module registered but not initialized yet + State_Initializing, // we're initializing this module but not done yet + State_Initialized // module initialized successfully + } m_state; + + + DECLARE_CLASS(wxModule) +}; + +#endif // _WX_MODULE_H_ diff --git a/Externals/wxWidgets/include/wx/msdos/apptrait.h b/Externals/wxWidgets/include/wx/msdos/apptrait.h index 4201970852..f6693ae6ec 100644 --- a/Externals/wxWidgets/include/wx/msdos/apptrait.h +++ b/Externals/wxWidgets/include/wx/msdos/apptrait.h @@ -1,27 +1,27 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msdos/apptrait.h -// Author: Michael Wetherell -// RCS-ID: $Id: apptrait.h 40807 2006-08-24 21:18:18Z MW $ -// Copyright: (c) 2006 Michael Wetherell -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSDOS_APPTRAIT_H_ -#define _WX_MSDOS_APPTRAIT_H_ - -class wxConsoleAppTraits : public wxConsoleAppTraitsBase -{ -public: -}; - -#if wxUSE_GUI - -class wxGUIAppTraits : public wxGUIAppTraitsBase -{ -public: - virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; -}; - -#endif // wxUSE_GUI - -#endif // _WX_MSDOS_APPTRAIT_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msdos/apptrait.h +// Author: Michael Wetherell +// RCS-ID: $Id: apptrait.h 40807 2006-08-24 21:18:18Z MW $ +// Copyright: (c) 2006 Michael Wetherell +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSDOS_APPTRAIT_H_ +#define _WX_MSDOS_APPTRAIT_H_ + +class wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: +}; + +#if wxUSE_GUI + +class wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; +}; + +#endif // wxUSE_GUI + +#endif // _WX_MSDOS_APPTRAIT_H_ diff --git a/Externals/wxWidgets/include/wx/msdos/mimetype.h b/Externals/wxWidgets/include/wx/msdos/mimetype.h index 5e6b29e4b8..587736e98b 100644 --- a/Externals/wxWidgets/include/wx/msdos/mimetype.h +++ b/Externals/wxWidgets/include/wx/msdos/mimetype.h @@ -1,115 +1,115 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msdos/mimetype.h -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 39763 2006-06-16 09:31:12Z ABX $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MIMETYPE_IMPL_H -#define _MIMETYPE_IMPL_H - -#include "wx/defs.h" -#include "wx/mimetype.h" - - -class wxMimeTypesManagerImpl -{ -public : - wxMimeTypesManagerImpl() { } - - // load all data into memory - done when it is needed for the first time - void Initialize(int mailcapStyles = wxMAILCAP_STANDARD, - const wxString& extraDir = wxEmptyString); - - // and delete the data here - void ClearData(); - - // implement containing class functions - wxFileType *GetFileTypeFromExtension(const wxString& ext); - wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ; - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - // this are NOPs under MacOS - bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = TRUE) { return TRUE; } - bool ReadMimeTypes(const wxString& WXUNUSED(filename)) { return TRUE; } - - void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } - - // create a new filetype association - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - // remove association - bool Unassociate(wxFileType *ft); - - // create a new filetype with the given name and extension - wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); - -private: - wxArrayFileTypeInfo m_fallbacks; -}; - -class wxFileTypeImpl -{ -public: - // initialization functions - // this is used to construct a list of mimetypes which match; - // if built with GetFileTypeFromMimetype index 0 has the exact match and - // index 1 the type / * match - // if built with GetFileTypeFromExtension, index 0 has the mimetype for - // the first extension found, index 1 for the second and so on - - void Init(wxMimeTypesManagerImpl *manager, size_t index) - { m_manager = manager; m_index.Add(index); } - - // initialize us with our file type name - void SetFileType(const wxString& strFileType) - { m_strFileType = strFileType; } - void SetExt(const wxString& ext) - { m_ext = ext; } - - // implement accessor functions - bool GetExtensions(wxArrayString& extensions); - bool GetMimeType(wxString *mimeType) const; - bool GetMimeTypes(wxArrayString& mimeTypes) const; - bool GetIcon(wxIconLocation *iconLoc) const; - bool GetDescription(wxString *desc) const; - bool GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters&) const - { return GetCommand(openCmd, "open"); } - bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters&) const - { return GetCommand(printCmd, "print"); } - - size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, - const wxFileType::MessageParameters& params) const; - - // remove the record for this file type - // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead - bool Unassociate(wxFileType *ft) - { - return m_manager->Unassociate(ft); - } - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is TRUE - bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); - bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); - - private: - // helper function - bool GetCommand(wxString *command, const char *verb) const; - - wxMimeTypesManagerImpl *m_manager; - wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays - wxString m_strFileType, m_ext; -}; - -#endif - //_MIMETYPE_H - -/* vi: set cin tw=80 ts=4 sw=4: */ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msdos/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// RCS-ID: $Id: mimetype.h 39763 2006-06-16 09:31:12Z ABX $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/defs.h" +#include "wx/mimetype.h" + + +class wxMimeTypesManagerImpl +{ +public : + wxMimeTypesManagerImpl() { } + + // load all data into memory - done when it is needed for the first time + void Initialize(int mailcapStyles = wxMAILCAP_STANDARD, + const wxString& extraDir = wxEmptyString); + + // and delete the data here + void ClearData(); + + // implement containing class functions + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ; + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + // this are NOPs under MacOS + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = TRUE) { return TRUE; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) { return TRUE; } + + void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } + + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + // remove association + bool Unassociate(wxFileType *ft); + + // create a new filetype with the given name and extension + wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); + +private: + wxArrayFileTypeInfo m_fallbacks; +}; + +class wxFileTypeImpl +{ +public: + // initialization functions + // this is used to construct a list of mimetypes which match; + // if built with GetFileTypeFromMimetype index 0 has the exact match and + // index 1 the type / * match + // if built with GetFileTypeFromExtension, index 0 has the mimetype for + // the first extension found, index 1 for the second and so on + + void Init(wxMimeTypesManagerImpl *manager, size_t index) + { m_manager = manager; m_index.Add(index); } + + // initialize us with our file type name + void SetFileType(const wxString& strFileType) + { m_strFileType = strFileType; } + void SetExt(const wxString& ext) + { m_ext = ext; } + + // implement accessor functions + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + bool GetDescription(wxString *desc) const; + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters&) const + { return GetCommand(openCmd, "open"); } + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters&) const + { return GetCommand(printCmd, "print"); } + + size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, + const wxFileType::MessageParameters& params) const; + + // remove the record for this file type + // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead + bool Unassociate(wxFileType *ft) + { + return m_manager->Unassociate(ft); + } + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is TRUE + bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); + bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); + + private: + // helper function + bool GetCommand(wxString *command, const char *verb) const; + + wxMimeTypesManagerImpl *m_manager; + wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays + wxString m_strFileType, m_ext; +}; + +#endif + //_MIMETYPE_H + +/* vi: set cin tw=80 ts=4 sw=4: */ diff --git a/Externals/wxWidgets/include/wx/msgdlg.h b/Externals/wxWidgets/include/wx/msgdlg.h index 242de6623b..d22572600b 100644 --- a/Externals/wxWidgets/include/wx/msgdlg.h +++ b/Externals/wxWidgets/include/wx/msgdlg.h @@ -1,79 +1,79 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msgdlgg.h -// Purpose: common header and base class for wxMessageDialog -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: msgdlg.h 49765 2007-11-09 18:32:38Z DE $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSGDLG_H_BASE_ -#define _WX_MSGDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_MSGDLG - -class WXDLLEXPORT wxMessageDialogBase -{ -protected: - // common validation of wxMessageDialog style - void SetMessageDialogStyle(long style) - { - wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || ((style & wxYES_NO) == 0), - _T("wxYES and wxNO may only be used together in wxMessageDialog") ); - - wxASSERT_MSG( (style & wxID_OK) != wxID_OK, - _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") ); - - m_dialogStyle = style; - } - inline long GetMessageDialogStyle() const - { - return m_dialogStyle; - } - -private: - long m_dialogStyle; -}; - -#if defined(__WX_COMPILING_MSGDLGG_CPP__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXUNIVERSAL__) || defined(__WXGPE__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXPALMOS__) -#include "wx/palmos/msgdlg.h" -#elif defined(__WXMSW__) -#include "wx/msw/msgdlg.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/msgdlg.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/msgdlg.h" -#elif defined(__WXGTK__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXGTK__) -#include "wx/generic/msgdlgg.h" -#elif defined(__WXMAC__) -#include "wx/mac/msgdlg.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/msgdlg.h" -#elif defined(__WXPM__) -#include "wx/os2/msgdlg.h" -#endif - -// ---------------------------------------------------------------------------- -// wxMessageBox: the simplest way to use wxMessageDialog -// ---------------------------------------------------------------------------- - -int WXDLLEXPORT wxMessageBox(const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK | wxCENTRE, - wxWindow *parent = NULL, - int x = wxDefaultCoord, int y = wxDefaultCoord); - -#endif // wxUSE_MSGDLG - -#endif - // _WX_MSGDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msgdlgg.h +// Purpose: common header and base class for wxMessageDialog +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: msgdlg.h 49765 2007-11-09 18:32:38Z DE $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGDLG_H_BASE_ +#define _WX_MSGDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MSGDLG + +class WXDLLEXPORT wxMessageDialogBase +{ +protected: + // common validation of wxMessageDialog style + void SetMessageDialogStyle(long style) + { + wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || ((style & wxYES_NO) == 0), + _T("wxYES and wxNO may only be used together in wxMessageDialog") ); + + wxASSERT_MSG( (style & wxID_OK) != wxID_OK, + _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") ); + + m_dialogStyle = style; + } + inline long GetMessageDialogStyle() const + { + return m_dialogStyle; + } + +private: + long m_dialogStyle; +}; + +#if defined(__WX_COMPILING_MSGDLGG_CPP__) +#include "wx/generic/msgdlgg.h" +#elif defined(__WXUNIVERSAL__) || defined(__WXGPE__) +#include "wx/generic/msgdlgg.h" +#elif defined(__WXPALMOS__) +#include "wx/palmos/msgdlg.h" +#elif defined(__WXMSW__) +#include "wx/msw/msgdlg.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/msgdlg.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/msgdlg.h" +#elif defined(__WXGTK__) +#include "wx/generic/msgdlgg.h" +#elif defined(__WXGTK__) +#include "wx/generic/msgdlgg.h" +#elif defined(__WXMAC__) +#include "wx/mac/msgdlg.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/msgdlg.h" +#elif defined(__WXPM__) +#include "wx/os2/msgdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// wxMessageBox: the simplest way to use wxMessageDialog +// ---------------------------------------------------------------------------- + +int WXDLLEXPORT wxMessageBox(const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK | wxCENTRE, + wxWindow *parent = NULL, + int x = wxDefaultCoord, int y = wxDefaultCoord); + +#endif // wxUSE_MSGDLG + +#endif + // _WX_MSGDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/msgout.h b/Externals/wxWidgets/include/wx/msgout.h index 63803bfa32..6130849c10 100644 --- a/Externals/wxWidgets/include/wx/msgout.h +++ b/Externals/wxWidgets/include/wx/msgout.h @@ -1,113 +1,113 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msgout.h -// Purpose: wxMessageOutput class. Shows a message to the user -// Author: Mattia Barbon -// Modified by: -// Created: 17.07.02 -// RCS-ID: $Id: msgout.h 35690 2005-09-25 20:23:30Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSGOUT_H_ -#define _WX_MSGOUT_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/wxchar.h" - -// ---------------------------------------------------------------------------- -// wxMessageOutput is a class abstracting formatted output target, i.e. -// something you can printf() to -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutput -{ -public: - virtual ~wxMessageOutput() { } - - // show a message to the user - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; - - // gets the current wxMessageOutput object (may be NULL during - // initialization or shutdown) - static wxMessageOutput* Get(); - - // sets the global wxMessageOutput instance; returns the previous one - static wxMessageOutput* Set(wxMessageOutput* msgout); - -private: - static wxMessageOutput* ms_msgOut; -}; - -// ---------------------------------------------------------------------------- -// implementation showing the message to the user in "best" possible way: uses -// native message box if available (currently only under Windows) and stderr -// otherwise; unlike wxMessageOutputMessageBox this class is always safe to use -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput -{ -public: - wxMessageOutputBest() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -// ---------------------------------------------------------------------------- -// implementation which sends output to stderr -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput -{ -public: - wxMessageOutputStderr() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -// ---------------------------------------------------------------------------- -// implementation which shows output in a message box -// ---------------------------------------------------------------------------- - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput -{ -public: - wxMessageOutputMessageBox() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// implementation using the native way of outputting debug messages -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput -{ -public: - wxMessageOutputDebug() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -// ---------------------------------------------------------------------------- -// implementation using wxLog (mainly for backwards compatibility) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput -{ -public: - wxMessageOutputLog() { } - - virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; -}; - -#endif - // _WX_MSGOUT_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msgout.h +// Purpose: wxMessageOutput class. Shows a message to the user +// Author: Mattia Barbon +// Modified by: +// Created: 17.07.02 +// RCS-ID: $Id: msgout.h 35690 2005-09-25 20:23:30Z VZ $ +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGOUT_H_ +#define _WX_MSGOUT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/wxchar.h" + +// ---------------------------------------------------------------------------- +// wxMessageOutput is a class abstracting formatted output target, i.e. +// something you can printf() to +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutput +{ +public: + virtual ~wxMessageOutput() { } + + // show a message to the user + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; + + // gets the current wxMessageOutput object (may be NULL during + // initialization or shutdown) + static wxMessageOutput* Get(); + + // sets the global wxMessageOutput instance; returns the previous one + static wxMessageOutput* Set(wxMessageOutput* msgout); + +private: + static wxMessageOutput* ms_msgOut; +}; + +// ---------------------------------------------------------------------------- +// implementation showing the message to the user in "best" possible way: uses +// native message box if available (currently only under Windows) and stderr +// otherwise; unlike wxMessageOutputMessageBox this class is always safe to use +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput +{ +public: + wxMessageOutputBest() { } + + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; +}; + +// ---------------------------------------------------------------------------- +// implementation which sends output to stderr +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput +{ +public: + wxMessageOutputStderr() { } + + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; +}; + +// ---------------------------------------------------------------------------- +// implementation which shows output in a message box +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput +{ +public: + wxMessageOutputMessageBox() { } + + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; +}; + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// implementation using the native way of outputting debug messages +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput +{ +public: + wxMessageOutputDebug() { } + + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; +}; + +// ---------------------------------------------------------------------------- +// implementation using wxLog (mainly for backwards compatibility) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput +{ +public: + wxMessageOutputLog() { } + + virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; +}; + +#endif + // _WX_MSGOUT_H_ diff --git a/Externals/wxWidgets/include/wx/mstream.h b/Externals/wxWidgets/include/wx/mstream.h index a814522846..19329a963c 100644 --- a/Externals/wxWidgets/include/wx/mstream.h +++ b/Externals/wxWidgets/include/wx/mstream.h @@ -1,92 +1,92 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mstream.h -// Purpose: Memory stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: mstream.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXMMSTREAM_H__ -#define _WX_WXMMSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include "wx/stream.h" - -class WXDLLIMPEXP_FWD_BASE wxMemoryOutputStream; - -class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream -{ -public: - wxMemoryInputStream(const void *data, size_t length); - wxMemoryInputStream(const wxMemoryOutputStream& stream); - virtual ~wxMemoryInputStream(); - virtual wxFileOffset GetLength() const { return m_length; } - virtual bool IsSeekable() const { return true; } - - char Peek(); - - wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, compatibility only - wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - wxStreamBuffer *m_i_streambuf; - - size_t OnSysRead(void *buffer, size_t nbytes); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -private: - size_t m_length; - - DECLARE_NO_COPY_CLASS(wxMemoryInputStream) -}; - -class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream -{ -public: - // if data is !NULL it must be allocated with malloc() - wxMemoryOutputStream(void *data = NULL, size_t length = 0); - virtual ~wxMemoryOutputStream(); - virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); } - virtual bool IsSeekable() const { return true; } - - size_t CopyTo(void *buffer, size_t len) const; - - wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, compatibility only - wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - wxStreamBuffer *m_o_streambuf; - -protected: - size_t OnSysWrite(const void *buffer, size_t nbytes); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - - DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline wxStreamBuffer *wxMemoryInputStream::InputStreamBuffer() const { return m_i_streambuf; } - inline wxStreamBuffer *wxMemoryOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif - // wxUSE_STREAMS - -#endif - // _WX_WXMMSTREAM_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mstream.h +// Purpose: Memory stream classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 11/07/98 +// RCS-ID: $Id: mstream.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXMMSTREAM_H__ +#define _WX_WXMMSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include "wx/stream.h" + +class WXDLLIMPEXP_FWD_BASE wxMemoryOutputStream; + +class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream +{ +public: + wxMemoryInputStream(const void *data, size_t length); + wxMemoryInputStream(const wxMemoryOutputStream& stream); + virtual ~wxMemoryInputStream(); + virtual wxFileOffset GetLength() const { return m_length; } + virtual bool IsSeekable() const { return true; } + + char Peek(); + + wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, compatibility only + wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + wxStreamBuffer *m_i_streambuf; + + size_t OnSysRead(void *buffer, size_t nbytes); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + +private: + size_t m_length; + + DECLARE_NO_COPY_CLASS(wxMemoryInputStream) +}; + +class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream +{ +public: + // if data is !NULL it must be allocated with malloc() + wxMemoryOutputStream(void *data = NULL, size_t length = 0); + virtual ~wxMemoryOutputStream(); + virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); } + virtual bool IsSeekable() const { return true; } + + size_t CopyTo(void *buffer, size_t len) const; + + wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, compatibility only + wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + wxStreamBuffer *m_o_streambuf; + +protected: + size_t OnSysWrite(const void *buffer, size_t nbytes); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + + DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) +}; + +#if WXWIN_COMPATIBILITY_2_6 + inline wxStreamBuffer *wxMemoryInputStream::InputStreamBuffer() const { return m_i_streambuf; } + inline wxStreamBuffer *wxMemoryOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } +#endif // WXWIN_COMPATIBILITY_2_6 + +#endif + // wxUSE_STREAMS + +#endif + // _WX_WXMMSTREAM_H__ diff --git a/Externals/wxWidgets/include/wx/msw/accel.h b/Externals/wxWidgets/include/wx/msw/accel.h index 7051468946..284a6f136f 100644 --- a/Externals/wxWidgets/include/wx/msw/accel.h +++ b/Externals/wxWidgets/include/wx/msw/accel.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/accel.h -// Purpose: wxAcceleratorTable class -// Author: Julian Smart -// Modified by: -// Created: 31/7/98 -// RCS-ID: $Id: accel.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCEL_H_ -#define _WX_ACCEL_H_ - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// ---------------------------------------------------------------------------- -// the accel table has all accelerators for a given window or menu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAcceleratorTable : public wxObject -{ -public: - // default ctor - wxAcceleratorTable() { } - - // load from .rc resource (Windows specific) - wxAcceleratorTable(const wxString& resource); - - // initialize from array - wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); - - bool Ok() const { return IsOk(); } - bool IsOk() const; - void SetHACCEL(WXHACCEL hAccel); - WXHACCEL GetHACCEL() const; - - // translate the accelerator, return true if done - bool Translate(wxWindow *window, WXMSG *msg) const; - -private: - DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) -}; - -#endif - // _WX_ACCEL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/accel.h +// Purpose: wxAcceleratorTable class +// Author: Julian Smart +// Modified by: +// Created: 31/7/98 +// RCS-ID: $Id: accel.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_ +#define _WX_ACCEL_H_ + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// the accel table has all accelerators for a given window or menu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAcceleratorTable : public wxObject +{ +public: + // default ctor + wxAcceleratorTable() { } + + // load from .rc resource (Windows specific) + wxAcceleratorTable(const wxString& resource); + + // initialize from array + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + void SetHACCEL(WXHACCEL hAccel); + WXHACCEL GetHACCEL() const; + + // translate the accelerator, return true if done + bool Translate(wxWindow *window, WXMSG *msg) const; + +private: + DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) +}; + +#endif + // _WX_ACCEL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/app.h b/Externals/wxWidgets/include/wx/msw/app.h index 4989c9c7a4..196600e58a 100644 --- a/Externals/wxWidgets/include/wx/msw/app.h +++ b/Externals/wxWidgets/include/wx/msw/app.h @@ -1,147 +1,147 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: app.h -// Purpose: wxApp class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: app.h 53157 2008-04-13 12:17:37Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_APP_H_ -#define _WX_APP_H_ - -#include "wx/event.h" -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxApp; -class WXDLLIMPEXP_FWD_CORE wxKeyEvent; -class WXDLLIMPEXP_FWD_BASE wxLog; - -// Represents the application. Derive OnInit and declare -// a new App object to start application -class WXDLLEXPORT wxApp : public wxAppBase -{ - DECLARE_DYNAMIC_CLASS(wxApp) - -public: - wxApp(); - virtual ~wxApp(); - - // override base class (pure) virtuals - virtual bool Initialize(int& argc, wxChar **argv); - virtual void CleanUp(); - - virtual bool Yield(bool onlyIfNeeded = false); - virtual void WakeUpIdle(); - - virtual void SetPrintMode(int mode) { m_printMode = mode; } - virtual int GetPrintMode() const { return m_printMode; } - - // implementation only - void OnIdle(wxIdleEvent& event); - void OnEndSession(wxCloseEvent& event); - void OnQueryEndSession(wxCloseEvent& event); - -#if wxUSE_EXCEPTIONS - virtual bool OnExceptionInMainLoop(); -#endif // wxUSE_EXCEPTIONS - - // deprecated functions, use wxEventLoop directly instead -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( void DoMessage(WXMSG *pMsg) ); - wxDEPRECATED( bool DoMessage() ); - wxDEPRECATED( bool ProcessMessage(WXMSG* pMsg) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -protected: - int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT - -public: - // Implementation - static bool RegisterWindowClasses(); - static bool UnregisterWindowClasses(); - -#if wxUSE_RICHEDIT - // initialize the richedit DLL of (at least) given version, return true if - // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) - static bool InitRichEdit(int version = 2); -#endif // wxUSE_RICHEDIT - - // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it - // wasn't found at all - static int GetComCtl32Version(); - - // the SW_XXX value to be used for the frames opened by the application - // (currently seems unused which is a bug -- TODO) - static int m_nCmdShow; - -protected: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxApp) -}; - -// ---------------------------------------------------------------------------- -// MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition -// ---------------------------------------------------------------------------- - -// we need HINSTANCE declaration to define WinMain() -#include "wx/msw/wrapwin.h" - -#ifndef SW_SHOWNORMAL - #define SW_SHOWNORMAL 1 -#endif - -// WinMain() is always ANSI, even in Unicode build, under normal Windows -// but is always Unicode under CE -#ifdef __WXWINCE__ - typedef wchar_t *wxCmdLineArgType; -#else - typedef char *wxCmdLineArgType; -#endif - -extern int WXDLLEXPORT -wxEntry(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - wxCmdLineArgType pCmdLine = NULL, - int nCmdShow = SW_SHOWNORMAL); - -#if defined(__BORLANDC__) && wxUSE_UNICODE - // Borland C++ has the following nonstandard behaviour: when the -WU - // command line flag is used, the linker expects to find wWinMain instead - // of WinMain. This flag causes the compiler to define _UNICODE and - // UNICODE symbols and there's no way to detect its use, so we have to - // define both WinMain and wWinMain so that IMPLEMENT_WXWIN_MAIN works - // for both code compiled with and without -WU. - // See http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1935997&group_id=9863 - // for more details. - #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD \ - extern "C" int WINAPI wWinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - wchar_t * WXUNUSED(lpCmdLine), \ - int nCmdShow) \ - { \ - /* NB: wxEntry expects lpCmdLine argument to be char*, not */ \ - /* wchar_t*, but fortunately it's not used anywhere */ \ - /* and we can simply pass NULL in: */ \ - return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ - } -#else - #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD -#endif // defined(__BORLANDC__) && wxUSE_UNICODE - -#define IMPLEMENT_WXWIN_MAIN \ - extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - wxCmdLineArgType lpCmdLine, \ - int nCmdShow) \ - { \ - return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \ - } \ - IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD - -#endif // _WX_APP_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: app.h +// Purpose: wxApp class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: app.h 53157 2008-04-13 12:17:37Z VS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_ +#define _WX_APP_H_ + +#include "wx/event.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxApp; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; + +// Represents the application. Derive OnInit and declare +// a new App object to start application +class WXDLLEXPORT wxApp : public wxAppBase +{ + DECLARE_DYNAMIC_CLASS(wxApp) + +public: + wxApp(); + virtual ~wxApp(); + + // override base class (pure) virtuals + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + virtual bool Yield(bool onlyIfNeeded = false); + virtual void WakeUpIdle(); + + virtual void SetPrintMode(int mode) { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } + + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + +#if wxUSE_EXCEPTIONS + virtual bool OnExceptionInMainLoop(); +#endif // wxUSE_EXCEPTIONS + + // deprecated functions, use wxEventLoop directly instead +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void DoMessage(WXMSG *pMsg) ); + wxDEPRECATED( bool DoMessage() ); + wxDEPRECATED( bool ProcessMessage(WXMSG* pMsg) ); +#endif // WXWIN_COMPATIBILITY_2_4 + +protected: + int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT + +public: + // Implementation + static bool RegisterWindowClasses(); + static bool UnregisterWindowClasses(); + +#if wxUSE_RICHEDIT + // initialize the richedit DLL of (at least) given version, return true if + // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) + static bool InitRichEdit(int version = 2); +#endif // wxUSE_RICHEDIT + + // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it + // wasn't found at all + static int GetComCtl32Version(); + + // the SW_XXX value to be used for the frames opened by the application + // (currently seems unused which is a bug -- TODO) + static int m_nCmdShow; + +protected: + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxApp) +}; + +// ---------------------------------------------------------------------------- +// MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition +// ---------------------------------------------------------------------------- + +// we need HINSTANCE declaration to define WinMain() +#include "wx/msw/wrapwin.h" + +#ifndef SW_SHOWNORMAL + #define SW_SHOWNORMAL 1 +#endif + +// WinMain() is always ANSI, even in Unicode build, under normal Windows +// but is always Unicode under CE +#ifdef __WXWINCE__ + typedef wchar_t *wxCmdLineArgType; +#else + typedef char *wxCmdLineArgType; +#endif + +extern int WXDLLEXPORT +wxEntry(HINSTANCE hInstance, + HINSTANCE hPrevInstance = NULL, + wxCmdLineArgType pCmdLine = NULL, + int nCmdShow = SW_SHOWNORMAL); + +#if defined(__BORLANDC__) && wxUSE_UNICODE + // Borland C++ has the following nonstandard behaviour: when the -WU + // command line flag is used, the linker expects to find wWinMain instead + // of WinMain. This flag causes the compiler to define _UNICODE and + // UNICODE symbols and there's no way to detect its use, so we have to + // define both WinMain and wWinMain so that IMPLEMENT_WXWIN_MAIN works + // for both code compiled with and without -WU. + // See http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1935997&group_id=9863 + // for more details. + #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD \ + extern "C" int WINAPI wWinMain(HINSTANCE hInstance, \ + HINSTANCE hPrevInstance, \ + wchar_t * WXUNUSED(lpCmdLine), \ + int nCmdShow) \ + { \ + /* NB: wxEntry expects lpCmdLine argument to be char*, not */ \ + /* wchar_t*, but fortunately it's not used anywhere */ \ + /* and we can simply pass NULL in: */ \ + return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ + } +#else + #define IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD +#endif // defined(__BORLANDC__) && wxUSE_UNICODE + +#define IMPLEMENT_WXWIN_MAIN \ + extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ + HINSTANCE hPrevInstance, \ + wxCmdLineArgType lpCmdLine, \ + int nCmdShow) \ + { \ + return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \ + } \ + IMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD + +#endif // _WX_APP_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/apptbase.h b/Externals/wxWidgets/include/wx/msw/apptbase.h index efab1ed336..855f759e10 100644 --- a/Externals/wxWidgets/include/wx/msw/apptbase.h +++ b/Externals/wxWidgets/include/wx/msw/apptbase.h @@ -1,46 +1,46 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/apptbase.h -// Purpose: declaration of wxAppTraits for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.06.2003 -// RCS-ID: $Id: apptbase.h 40599 2006-08-13 21:00:32Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_APPTBASE_H_ -#define _WX_MSW_APPTBASE_H_ - -// ---------------------------------------------------------------------------- -// wxAppTraits: the MSW version adds extra hooks needed by MSW-only code -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase -{ -public: - // wxExecute() support methods - // --------------------------- - - // called before starting to wait for the child termination, may return - // some opaque data which will be passed later to AfterChildWaitLoop() - virtual void *BeforeChildWaitLoop() = 0; - - // process pending Windows messages, even in console app - virtual void AlwaysYield() = 0; - - // called after starting to wait for the child termination, the parameter - // is the return value of BeforeChildWaitLoop() - virtual void AfterChildWaitLoop(void *data) = 0; - - - // wxThread helpers - // ---------------- - - // process a message while waiting for a(nother) thread, should return - // false if and only if we have to exit the application - virtual bool DoMessageFromThreadWait() = 0; -}; - -#endif // _WX_MSW_APPTBASE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/apptbase.h +// Purpose: declaration of wxAppTraits for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.06.2003 +// RCS-ID: $Id: apptbase.h 40599 2006-08-13 21:00:32Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPTBASE_H_ +#define _WX_MSW_APPTBASE_H_ + +// ---------------------------------------------------------------------------- +// wxAppTraits: the MSW version adds extra hooks needed by MSW-only code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase +{ +public: + // wxExecute() support methods + // --------------------------- + + // called before starting to wait for the child termination, may return + // some opaque data which will be passed later to AfterChildWaitLoop() + virtual void *BeforeChildWaitLoop() = 0; + + // process pending Windows messages, even in console app + virtual void AlwaysYield() = 0; + + // called after starting to wait for the child termination, the parameter + // is the return value of BeforeChildWaitLoop() + virtual void AfterChildWaitLoop(void *data) = 0; + + + // wxThread helpers + // ---------------- + + // process a message while waiting for a(nother) thread, should return + // false if and only if we have to exit the application + virtual bool DoMessageFromThreadWait() = 0; +}; + +#endif // _WX_MSW_APPTBASE_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/apptrait.h b/Externals/wxWidgets/include/wx/msw/apptrait.h index 6b094ce294..1e5971144b 100644 --- a/Externals/wxWidgets/include/wx/msw/apptrait.h +++ b/Externals/wxWidgets/include/wx/msw/apptrait.h @@ -1,45 +1,45 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/apptrait.h -// Purpose: class implementing wxAppTraits for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.06.2003 -// RCS-ID: $Id: apptrait.h 40599 2006-08-13 21:00:32Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_APPTRAIT_H_ -#define _WX_MSW_APPTRAIT_H_ - -// ---------------------------------------------------------------------------- -// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase -{ -public: - virtual void *BeforeChildWaitLoop(); - virtual void AlwaysYield(); - virtual void AfterChildWaitLoop(void *data); - - virtual bool DoMessageFromThreadWait(); -}; - -#if wxUSE_GUI - -class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase -{ -public: - virtual void *BeforeChildWaitLoop(); - virtual void AlwaysYield(); - virtual void AfterChildWaitLoop(void *data); - - virtual bool DoMessageFromThreadWait(); - virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; -}; - -#endif // wxUSE_GUI - -#endif // _WX_MSW_APPTRAIT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/apptrait.h +// Purpose: class implementing wxAppTraits for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.06.2003 +// RCS-ID: $Id: apptrait.h 40599 2006-08-13 21:00:32Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPTRAIT_H_ +#define _WX_MSW_APPTRAIT_H_ + +// ---------------------------------------------------------------------------- +// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: + virtual void *BeforeChildWaitLoop(); + virtual void AlwaysYield(); + virtual void AfterChildWaitLoop(void *data); + + virtual bool DoMessageFromThreadWait(); +}; + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual void *BeforeChildWaitLoop(); + virtual void AlwaysYield(); + virtual void AfterChildWaitLoop(void *data); + + virtual bool DoMessageFromThreadWait(); + virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; +}; + +#endif // wxUSE_GUI + +#endif // _WX_MSW_APPTRAIT_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/bitmap.h b/Externals/wxWidgets/include/wx/msw/bitmap.h index 4e71852a56..819878129f 100644 --- a/Externals/wxWidgets/include/wx/msw/bitmap.h +++ b/Externals/wxWidgets/include/wx/msw/bitmap.h @@ -1,282 +1,282 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/bitmap.h -// Purpose: wxBitmap class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BITMAP_H_ -#define _WX_BITMAP_H_ - -#include "wx/msw/gdiimage.h" -#include "wx/palette.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; -class WXDLLIMPEXP_FWD_CORE wxBitmapRefData; -class WXDLLIMPEXP_FWD_CORE wxControl; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxDC; -#if wxUSE_WXDIB -class WXDLLIMPEXP_FWD_CORE wxDIB; -#endif -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxMask; -class WXDLLIMPEXP_FWD_CORE wxPalette; -class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; - -// ---------------------------------------------------------------------------- -// wxBitmap: a mono or colour bitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmap : public wxGDIImage -{ -public: - // default ctor creates an invalid bitmap, you must Create() it later - wxBitmap() { } - - // Initialize with raw data - wxBitmap(const char bits[], int width, int height, int depth = 1); - - // Initialize with XPM data - wxBitmap(const char* const* data); -#ifdef wxNEEDS_CHARPP - wxBitmap(char** data) - { - *this = wxBitmap(wx_const_cast(const char* const*, data)); - } -#endif - - // Load a file or resource - wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); - - // New constructor for generalised creation from data - wxBitmap(const void* data, long type, int width, int height, int depth = 1); - - // Create a new, uninitialized bitmap of the given size and depth (if it - // is omitted, will create a bitmap compatible with the display) - // - // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor - // taking a DC argument if you want to force using DDB in this case - wxBitmap(int width, int height, int depth = -1); - - // Create a bitmap compatible with the given DC - wxBitmap(int width, int height, const wxDC& dc); - -#if wxUSE_IMAGE - // Convert from wxImage - wxBitmap(const wxImage& image, int depth = -1) - { (void)CreateFromImage(image, depth); } - - // Create a DDB compatible with the given DC from wxImage - wxBitmap(const wxImage& image, const wxDC& dc) - { (void)CreateFromImage(image, dc); } -#endif // wxUSE_IMAGE - - // we must have this, otherwise icons are silently copied into bitmaps using - // the copy ctor but the resulting bitmap is invalid! - wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } - - wxBitmap& operator=(const wxIcon& icon) - { - (void)CopyFromIcon(icon); - - return *this; - } - - wxBitmap& operator=(const wxCursor& cursor) - { - (void)CopyFromCursor(cursor); - - return *this; - } - - virtual ~wxBitmap(); - -#if wxUSE_IMAGE - wxImage ConvertToImage() const; -#endif // wxUSE_IMAGE - - // get the given part of bitmap - wxBitmap GetSubBitmap( const wxRect& rect ) const; - - // NB: This should not be called from user code. It is for wx internal - // use only. - wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const; - - // copies the contents and mask of the given (colour) icon to the bitmap - bool CopyFromIcon(const wxIcon& icon); - - // copies the contents and mask of the given cursor to the bitmap - bool CopyFromCursor(const wxCursor& cursor); - -#if wxUSE_WXDIB - // copies from a device independent bitmap - bool CopyFromDIB(const wxDIB& dib); -#endif - - virtual bool Create(int width, int height, int depth = -1); - virtual bool Create(int width, int height, const wxDC& dc); - virtual bool Create(const void* data, long type, int width, int height, int depth = 1); - virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); - virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); - - wxBitmapRefData *GetBitmapData() const - { return (wxBitmapRefData *)m_refData; } - - // raw bitmap access support functions - void *GetRawData(wxPixelDataBase& data, int bpp); - void UngetRawData(wxPixelDataBase& data); - -#if wxUSE_PALETTE - wxPalette* GetPalette() const; - void SetPalette(const wxPalette& palette); -#endif // wxUSE_PALETTE - - wxMask *GetMask() const; - wxBitmap GetMaskBitmap() const; - void SetMask(wxMask *mask); - - // these functions are internal and shouldn't be used, they risk to - // disappear in the future - bool HasAlpha() const; - void UseAlpha(); - -#if WXWIN_COMPATIBILITY_2_4 - // these functions do nothing and are only there for backwards - // compatibility - wxDEPRECATED( int GetQuality() const ); - wxDEPRECATED( void SetQuality(int quality) ); -#endif // WXWIN_COMPATIBILITY_2_4 - - // implementation only from now on - // ------------------------------- - -public: - void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } - WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } - -#ifdef __WXDEBUG__ - void SetSelectedInto(wxDC *dc); - wxDC *GetSelectedInto() const; -#endif // __WXDEBUG__ - -protected: - virtual wxGDIImageRefData *CreateData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - // creates an uninitialized bitmap, called from Create()s above - bool DoCreate(int w, int h, int depth, WXHDC hdc); - -#if wxUSE_IMAGE - // creates the bitmap from wxImage, supposed to be called from ctor - bool CreateFromImage(const wxImage& image, int depth); - - // creates a DDB from wxImage, supposed to be called from ctor - bool CreateFromImage(const wxImage& image, const wxDC& dc); - - // common part of the 2 methods above (hdc may be 0) - bool CreateFromImage(const wxImage& image, int depth, WXHDC hdc); -#endif // wxUSE_IMAGE - -private: - // common part of CopyFromIcon/CopyFromCursor for Win32 - bool CopyFromIconOrCursor(const wxGDIImage& icon); - - - DECLARE_DYNAMIC_CLASS(wxBitmap) -}; - -// ---------------------------------------------------------------------------- -// wxMask: a mono bitmap used for drawing bitmaps transparently. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMask : public wxObject -{ -public: - wxMask(); - - // Copy constructor - wxMask(const wxMask &mask); - - // Construct a mask from a bitmap and a colour indicating the transparent - // area - wxMask(const wxBitmap& bitmap, const wxColour& colour); - - // Construct a mask from a bitmap and a palette index indicating the - // transparent area - wxMask(const wxBitmap& bitmap, int paletteIndex); - - // Construct a mask from a mono bitmap (copies the bitmap). - wxMask(const wxBitmap& bitmap); - - // construct a mask from the givne bitmap handle - wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; } - - virtual ~wxMask(); - - bool Create(const wxBitmap& bitmap, const wxColour& colour); - bool Create(const wxBitmap& bitmap, int paletteIndex); - bool Create(const wxBitmap& bitmap); - - // Implementation - WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } - void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; } - -protected: - WXHBITMAP m_maskBitmap; - - DECLARE_DYNAMIC_CLASS(wxMask) -}; - -// ---------------------------------------------------------------------------- -// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler -{ -public: - wxBitmapHandler() { } - wxBitmapHandler(const wxString& name, const wxString& ext, long type) - : wxGDIImageHandler(name, ext, type) - { - } - - // keep wxBitmapHandler derived from wxGDIImageHandler compatible with the - // old class which worked only with bitmaps - virtual bool Create(wxBitmap *bitmap, - const void* data, - long flags, - int width, int height, int depth = 1); - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(wxBitmap *bitmap, - const wxString& name, - int type, - const wxPalette *palette = NULL); - - virtual bool Create(wxGDIImage *image, - const void* data, - long flags, - int width, int height, int depth = 1); - virtual bool Load(wxGDIImage *image, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight); - virtual bool Save(wxGDIImage *image, - const wxString& name, - int type); - -private: - DECLARE_DYNAMIC_CLASS(wxBitmapHandler) -}; - -#endif - // _WX_BITMAP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/bitmap.h +// Purpose: wxBitmap class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: bitmap.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#include "wx/msw/gdiimage.h" +#include "wx/palette.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; +class WXDLLIMPEXP_FWD_CORE wxBitmapRefData; +class WXDLLIMPEXP_FWD_CORE wxControl; +class WXDLLIMPEXP_FWD_CORE wxCursor; +class WXDLLIMPEXP_FWD_CORE wxDC; +#if wxUSE_WXDIB +class WXDLLIMPEXP_FWD_CORE wxDIB; +#endif +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxMask; +class WXDLLIMPEXP_FWD_CORE wxPalette; +class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; + +// ---------------------------------------------------------------------------- +// wxBitmap: a mono or colour bitmap +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmap : public wxGDIImage +{ +public: + // default ctor creates an invalid bitmap, you must Create() it later + wxBitmap() { } + + // Initialize with raw data + wxBitmap(const char bits[], int width, int height, int depth = 1); + + // Initialize with XPM data + wxBitmap(const char* const* data); +#ifdef wxNEEDS_CHARPP + wxBitmap(char** data) + { + *this = wxBitmap(wx_const_cast(const char* const*, data)); + } +#endif + + // Load a file or resource + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); + + // New constructor for generalised creation from data + wxBitmap(const void* data, long type, int width, int height, int depth = 1); + + // Create a new, uninitialized bitmap of the given size and depth (if it + // is omitted, will create a bitmap compatible with the display) + // + // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor + // taking a DC argument if you want to force using DDB in this case + wxBitmap(int width, int height, int depth = -1); + + // Create a bitmap compatible with the given DC + wxBitmap(int width, int height, const wxDC& dc); + +#if wxUSE_IMAGE + // Convert from wxImage + wxBitmap(const wxImage& image, int depth = -1) + { (void)CreateFromImage(image, depth); } + + // Create a DDB compatible with the given DC from wxImage + wxBitmap(const wxImage& image, const wxDC& dc) + { (void)CreateFromImage(image, dc); } +#endif // wxUSE_IMAGE + + // we must have this, otherwise icons are silently copied into bitmaps using + // the copy ctor but the resulting bitmap is invalid! + wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } + + wxBitmap& operator=(const wxIcon& icon) + { + (void)CopyFromIcon(icon); + + return *this; + } + + wxBitmap& operator=(const wxCursor& cursor) + { + (void)CopyFromCursor(cursor); + + return *this; + } + + virtual ~wxBitmap(); + +#if wxUSE_IMAGE + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + + // get the given part of bitmap + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + // NB: This should not be called from user code. It is for wx internal + // use only. + wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const; + + // copies the contents and mask of the given (colour) icon to the bitmap + bool CopyFromIcon(const wxIcon& icon); + + // copies the contents and mask of the given cursor to the bitmap + bool CopyFromCursor(const wxCursor& cursor); + +#if wxUSE_WXDIB + // copies from a device independent bitmap + bool CopyFromDIB(const wxDIB& dib); +#endif + + virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, const wxDC& dc); + virtual bool Create(const void* data, long type, int width, int height, int depth = 1); + virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); + virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); + + wxBitmapRefData *GetBitmapData() const + { return (wxBitmapRefData *)m_refData; } + + // raw bitmap access support functions + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + +#if wxUSE_PALETTE + wxPalette* GetPalette() const; + void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + wxMask *GetMask() const; + wxBitmap GetMaskBitmap() const; + void SetMask(wxMask *mask); + + // these functions are internal and shouldn't be used, they risk to + // disappear in the future + bool HasAlpha() const; + void UseAlpha(); + +#if WXWIN_COMPATIBILITY_2_4 + // these functions do nothing and are only there for backwards + // compatibility + wxDEPRECATED( int GetQuality() const ); + wxDEPRECATED( void SetQuality(int quality) ); +#endif // WXWIN_COMPATIBILITY_2_4 + + // implementation only from now on + // ------------------------------- + +public: + void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } + WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } + +#ifdef __WXDEBUG__ + void SetSelectedInto(wxDC *dc); + wxDC *GetSelectedInto() const; +#endif // __WXDEBUG__ + +protected: + virtual wxGDIImageRefData *CreateData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + // creates an uninitialized bitmap, called from Create()s above + bool DoCreate(int w, int h, int depth, WXHDC hdc); + +#if wxUSE_IMAGE + // creates the bitmap from wxImage, supposed to be called from ctor + bool CreateFromImage(const wxImage& image, int depth); + + // creates a DDB from wxImage, supposed to be called from ctor + bool CreateFromImage(const wxImage& image, const wxDC& dc); + + // common part of the 2 methods above (hdc may be 0) + bool CreateFromImage(const wxImage& image, int depth, WXHDC hdc); +#endif // wxUSE_IMAGE + +private: + // common part of CopyFromIcon/CopyFromCursor for Win32 + bool CopyFromIconOrCursor(const wxGDIImage& icon); + + + DECLARE_DYNAMIC_CLASS(wxBitmap) +}; + +// ---------------------------------------------------------------------------- +// wxMask: a mono bitmap used for drawing bitmaps transparently. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMask : public wxObject +{ +public: + wxMask(); + + // Copy constructor + wxMask(const wxMask &mask); + + // Construct a mask from a bitmap and a colour indicating the transparent + // area + wxMask(const wxBitmap& bitmap, const wxColour& colour); + + // Construct a mask from a bitmap and a palette index indicating the + // transparent area + wxMask(const wxBitmap& bitmap, int paletteIndex); + + // Construct a mask from a mono bitmap (copies the bitmap). + wxMask(const wxBitmap& bitmap); + + // construct a mask from the givne bitmap handle + wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; } + + virtual ~wxMask(); + + bool Create(const wxBitmap& bitmap, const wxColour& colour); + bool Create(const wxBitmap& bitmap, int paletteIndex); + bool Create(const wxBitmap& bitmap); + + // Implementation + WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } + void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; } + +protected: + WXHBITMAP m_maskBitmap; + + DECLARE_DYNAMIC_CLASS(wxMask) +}; + +// ---------------------------------------------------------------------------- +// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler +{ +public: + wxBitmapHandler() { } + wxBitmapHandler(const wxString& name, const wxString& ext, long type) + : wxGDIImageHandler(name, ext, type) + { + } + + // keep wxBitmapHandler derived from wxGDIImageHandler compatible with the + // old class which worked only with bitmaps + virtual bool Create(wxBitmap *bitmap, + const void* data, + long flags, + int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(wxBitmap *bitmap, + const wxString& name, + int type, + const wxPalette *palette = NULL); + + virtual bool Create(wxGDIImage *image, + const void* data, + long flags, + int width, int height, int depth = 1); + virtual bool Load(wxGDIImage *image, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight); + virtual bool Save(wxGDIImage *image, + const wxString& name, + int type); + +private: + DECLARE_DYNAMIC_CLASS(wxBitmapHandler) +}; + +#endif + // _WX_BITMAP_H_ diff --git a/Externals/wxWidgets/include/wx/msw/bmpbuttn.h b/Externals/wxWidgets/include/wx/msw/bmpbuttn.h index a9173613b8..e45e1c0c80 100644 --- a/Externals/wxWidgets/include/wx/msw/bmpbuttn.h +++ b/Externals/wxWidgets/include/wx/msw/bmpbuttn.h @@ -1,73 +1,73 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/bmpbuttn.h -// Purpose: wxBitmapButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: bmpbuttn.h 36078 2005-11-03 19:38:20Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BMPBUTTN_H_ -#define _WX_BMPBUTTN_H_ - -#include "wx/button.h" -#include "wx/bitmap.h" -#include "wx/brush.h" - -class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase -{ -public: - wxBitmapButton() { } - - wxBitmapButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, bitmap, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - // Implementation - virtual bool SetBackgroundColour(const wxColour& colour); - virtual void SetDefault(); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); - virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); - virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); - -protected: - // reimplement some base class virtuals - virtual wxSize DoGetBestSize() const; - virtual void OnSetBitmap(); - - // invalidate m_brushDisabled when system colours change - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // change the currently bitmap if we have a hover one - void OnMouseEnterOrLeave(wxMouseEvent& event); - - - // the brush we use to draw disabled buttons - wxBrush m_brushDisabled; - - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) -}; - -#endif // _WX_BMPBUTTN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/bmpbuttn.h +// Purpose: wxBitmapButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: bmpbuttn.h 36078 2005-11-03 19:38:20Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTN_H_ +#define _WX_BMPBUTTN_H_ + +#include "wx/button.h" +#include "wx/bitmap.h" +#include "wx/brush.h" + +class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton() { } + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBU_AUTODRAW, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBU_AUTODRAW, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + // Implementation + virtual bool SetBackgroundColour(const wxColour& colour); + virtual void SetDefault(); + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); + +protected: + // reimplement some base class virtuals + virtual wxSize DoGetBestSize() const; + virtual void OnSetBitmap(); + + // invalidate m_brushDisabled when system colours change + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // change the currently bitmap if we have a hover one + void OnMouseEnterOrLeave(wxMouseEvent& event); + + + // the brush we use to draw disabled buttons + wxBrush m_brushDisabled; + + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) +}; + +#endif // _WX_BMPBUTTN_H_ diff --git a/Externals/wxWidgets/include/wx/msw/brush.h b/Externals/wxWidgets/include/wx/msw/brush.h index 37de6d77d6..b2224f7c54 100644 --- a/Externals/wxWidgets/include/wx/msw/brush.h +++ b/Externals/wxWidgets/include/wx/msw/brush.h @@ -1,60 +1,60 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/brush.h -// Purpose: wxBrush class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: brush.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BRUSH_H_ -#define _WX_BRUSH_H_ - -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxBrush; - -// ---------------------------------------------------------------------------- -// wxBrush -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBrush : public wxBrushBase -{ -public: - wxBrush(); - wxBrush(const wxColour& col, int style = wxSOLID); - wxBrush(const wxBitmap& stipple); - virtual ~wxBrush(); - - virtual void SetColour(const wxColour& col); - virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); - virtual void SetStyle(int style); - virtual void SetStipple(const wxBitmap& stipple); - - bool operator==(const wxBrush& brush) const; - bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - - wxColour GetColour() const; - virtual int GetStyle() const; - wxBitmap *GetStipple() const; - - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_refData != NULL; } - - // return the HBRUSH for this brush - virtual WXHANDLE GetResourceHandle() const; - -protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - -private: - DECLARE_DYNAMIC_CLASS(wxBrush) -}; - -#endif - // _WX_BRUSH_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/brush.h +// Purpose: wxBrush class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: brush.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxBrush; + +// ---------------------------------------------------------------------------- +// wxBrush +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBrush : public wxBrushBase +{ +public: + wxBrush(); + wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxBitmap& stipple); + virtual ~wxBrush(); + + virtual void SetColour(const wxColour& col); + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); + virtual void SetStyle(int style); + virtual void SetStipple(const wxBitmap& stipple); + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxColour GetColour() const; + virtual int GetStyle() const; + wxBitmap *GetStipple() const; + + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } + + // return the HBRUSH for this brush + virtual WXHANDLE GetResourceHandle() const; + +protected: + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + +private: + DECLARE_DYNAMIC_CLASS(wxBrush) +}; + +#endif + // _WX_BRUSH_H_ diff --git a/Externals/wxWidgets/include/wx/msw/button.h b/Externals/wxWidgets/include/wx/msw/button.h index e36e44ff6a..3f7c7d2c42 100644 --- a/Externals/wxWidgets/include/wx/msw/button.h +++ b/Externals/wxWidgets/include/wx/msw/button.h @@ -1,82 +1,82 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/button.h -// Purpose: wxButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: button.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BUTTON_H_ -#define _WX_BUTTON_H_ - -// ---------------------------------------------------------------------------- -// Pushbutton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButton : public wxButtonBase -{ -public: - wxButton() { } - wxButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - virtual ~wxButton(); - - virtual void SetDefault(); - - // implementation from now on - virtual void Command(wxCommandEvent& event); - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWCommand(WXUINT param, WXWORD id); - - // coloured buttons support - virtual bool SetBackgroundColour(const wxColour &colour); - virtual bool SetForegroundColour(const wxColour &colour); - - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -private: - void MakeOwnerDrawn(); - -protected: - // send a notification event, return true if processed - bool SendClickEvent(); - - // default button handling - void SetTmpDefault(); - void UnsetTmpDefault(); - - // set or unset BS_DEFPUSHBUTTON style - static void SetDefaultStyle(wxButton *btn, bool on); - - // usually overridden base class virtuals - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton) -}; - -#endif - // _WX_BUTTON_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/button.h +// Purpose: wxButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: button.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTON_H_ +#define _WX_BUTTON_H_ + +// ---------------------------------------------------------------------------- +// Pushbutton +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxButton : public wxButtonBase +{ +public: + wxButton() { } + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual ~wxButton(); + + virtual void SetDefault(); + + // implementation from now on + virtual void Command(wxCommandEvent& event); + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWCommand(WXUINT param, WXWORD id); + + // coloured buttons support + virtual bool SetBackgroundColour(const wxColour &colour); + virtual bool SetForegroundColour(const wxColour &colour); + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +private: + void MakeOwnerDrawn(); + +protected: + // send a notification event, return true if processed + bool SendClickEvent(); + + // default button handling + void SetTmpDefault(); + void UnsetTmpDefault(); + + // set or unset BS_DEFPUSHBUTTON style + static void SetDefaultStyle(wxButton *btn, bool on); + + // usually overridden base class virtuals + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton) +}; + +#endif + // _WX_BUTTON_H_ diff --git a/Externals/wxWidgets/include/wx/msw/caret.h b/Externals/wxWidgets/include/wx/msw/caret.h index 90b0d29cc6..b1af3f8873 100644 --- a/Externals/wxWidgets/include/wx/msw/caret.h +++ b/Externals/wxWidgets/include/wx/msw/caret.h @@ -1,64 +1,64 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/caret.h -// Purpose: wxCaret class - the MSW implementation of wxCaret -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.05.99 -// RCS-ID: $Id: caret.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CARET_H_ -#define _WX_CARET_H_ - -class WXDLLEXPORT wxCaret : public wxCaretBase -{ -public: - wxCaret() { Init(); } - // create the caret of given (in pixels) width and height and associate - // with the given window - wxCaret(wxWindow *window, int width, int height) - { - Init(); - - (void)Create(window, width, height); - } - // same as above - wxCaret(wxWindowBase *window, const wxSize& size) - { - Init(); - - (void)Create(window, size); - } - - // process wxWindow notifications - virtual void OnSetFocus(); - virtual void OnKillFocus(); - -protected: - void Init() - { - wxCaretBase::Init(); - - m_hasCaret = false; - } - - // override base class virtuals - virtual void DoMove(); - virtual void DoShow(); - virtual void DoHide(); - virtual void DoSize(); - - // helper function which creates the system caret - bool MSWCreateCaret(); - -private: - bool m_hasCaret; - - DECLARE_NO_COPY_CLASS(wxCaret) -}; - -#endif // _WX_CARET_H_ - - +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/caret.h +// Purpose: wxCaret class - the MSW implementation of wxCaret +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.05.99 +// RCS-ID: $Id: caret.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_ +#define _WX_CARET_H_ + +class WXDLLEXPORT wxCaret : public wxCaretBase +{ +public: + wxCaret() { Init(); } + // create the caret of given (in pixels) width and height and associate + // with the given window + wxCaret(wxWindow *window, int width, int height) + { + Init(); + + (void)Create(window, width, height); + } + // same as above + wxCaret(wxWindowBase *window, const wxSize& size) + { + Init(); + + (void)Create(window, size); + } + + // process wxWindow notifications + virtual void OnSetFocus(); + virtual void OnKillFocus(); + +protected: + void Init() + { + wxCaretBase::Init(); + + m_hasCaret = false; + } + + // override base class virtuals + virtual void DoMove(); + virtual void DoShow(); + virtual void DoHide(); + virtual void DoSize(); + + // helper function which creates the system caret + bool MSWCreateCaret(); + +private: + bool m_hasCaret; + + DECLARE_NO_COPY_CLASS(wxCaret) +}; + +#endif // _WX_CARET_H_ + + diff --git a/Externals/wxWidgets/include/wx/msw/checkbox.h b/Externals/wxWidgets/include/wx/msw/checkbox.h index 6f5605571e..21d9963c64 100644 --- a/Externals/wxWidgets/include/wx/msw/checkbox.h +++ b/Externals/wxWidgets/include/wx/msw/checkbox.h @@ -1,86 +1,86 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/checkbox.h -// Purpose: wxCheckBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: checkbox.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHECKBOX_H_ -#define _WX_CHECKBOX_H_ - -// Checkbox item (single checkbox) -class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase -{ -public: - wxCheckBox() { } - wxCheckBox(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual void SetValue(bool value); - virtual bool GetValue() const; - - // override some base class virtuals - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void Command(wxCommandEvent& event); - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - -protected: - virtual wxSize DoGetBestSize() const; - - virtual void DoSet3StateValue(wxCheckBoxState value); - virtual wxCheckBoxState DoGet3StateValue() const; - - // make the checkbox owner drawn or reset it to normal style - void MakeOwnerDrawn(bool ownerDrawn); - - // return true if this checkbox is owner drawn - bool IsOwnerDrawn() const; - -private: - // common part of all ctors - void Init(); - - // event handlers used by owner-drawn checkbox - void OnMouseEnterOrLeave(wxMouseEvent& event); - void OnMouseLeft(wxMouseEvent& event); - void OnFocus(wxFocusEvent& event); - - - // current state of the checkbox - wxCheckBoxState m_state; - - // true if the checkbox is currently pressed - bool m_isPressed; - - // true if mouse is currently over the control - bool m_isHot; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox) -}; - -#endif - // _WX_CHECKBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/checkbox.h +// Purpose: wxCheckBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: checkbox.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_ +#define _WX_CHECKBOX_H_ + +// Checkbox item (single checkbox) +class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox() { } + wxCheckBox(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const; + + // override some base class virtuals + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void Command(wxCommandEvent& event); + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + +protected: + virtual wxSize DoGetBestSize() const; + + virtual void DoSet3StateValue(wxCheckBoxState value); + virtual wxCheckBoxState DoGet3StateValue() const; + + // make the checkbox owner drawn or reset it to normal style + void MakeOwnerDrawn(bool ownerDrawn); + + // return true if this checkbox is owner drawn + bool IsOwnerDrawn() const; + +private: + // common part of all ctors + void Init(); + + // event handlers used by owner-drawn checkbox + void OnMouseEnterOrLeave(wxMouseEvent& event); + void OnMouseLeft(wxMouseEvent& event); + void OnFocus(wxFocusEvent& event); + + + // current state of the checkbox + wxCheckBoxState m_state; + + // true if the checkbox is currently pressed + bool m_isPressed; + + // true if mouse is currently over the control + bool m_isHot; + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox) +}; + +#endif + // _WX_CHECKBOX_H_ diff --git a/Externals/wxWidgets/include/wx/msw/checklst.h b/Externals/wxWidgets/include/wx/msw/checklst.h index 5f12727815..609936c167 100644 --- a/Externals/wxWidgets/include/wx/msw/checklst.h +++ b/Externals/wxWidgets/include/wx/msw/checklst.h @@ -1,96 +1,96 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/checklst.h -// Purpose: wxCheckListBox class - a listbox with checkable items -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.11.97 -// RCS-ID: $Id: checklst.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __CHECKLST__H_ -#define __CHECKLST__H_ - -#if !wxUSE_OWNER_DRAWN - #error "wxCheckListBox class requires owner-drawn functionality." -#endif - -class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; -class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp - -class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase -{ -public: - // ctors - wxCheckListBox(); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - // override base class virtuals - virtual void Delete(unsigned int n); - - virtual bool SetFont( const wxFont &font ); - - // items may be checked - virtual bool IsChecked(unsigned int uiIndex) const; - virtual void Check(unsigned int uiIndex, bool bCheck = true); - - // return the index of the item at this position or wxNOT_FOUND - int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } - int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); } - - // accessors - size_t GetItemHeight() const { return m_nItemHeight; } - - // we create our items ourselves and they have non-standard size, - // so we need to override these functions - virtual wxOwnerDrawn *CreateLboxItem(size_t n); - virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); - -protected: - // this can't be called DoHitTest() because wxWindow already has this method - int DoHitTestItem(wxCoord x, wxCoord y) const; - - // pressing space or clicking the check box toggles the item - void OnKeyDown(wxKeyEvent& event); - void OnLeftClick(wxMouseEvent& event); - - wxSize DoGetBestSize() const; - -private: - size_t m_nItemHeight; // height of checklistbox items (the same for all) - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) -}; - -#endif //_CHECKLST_H +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Author: Vadim Zeitlin +// Modified by: +// Created: 16.11.97 +// RCS-ID: $Id: checklst.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __CHECKLST__H_ +#define __CHECKLST__H_ + +#if !wxUSE_OWNER_DRAWN + #error "wxCheckListBox class requires owner-drawn functionality." +#endif + +class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; +class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp + +class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + // override base class virtuals + virtual void Delete(unsigned int n); + + virtual bool SetFont( const wxFont &font ); + + // items may be checked + virtual bool IsChecked(unsigned int uiIndex) const; + virtual void Check(unsigned int uiIndex, bool bCheck = true); + + // return the index of the item at this position or wxNOT_FOUND + int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } + int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); } + + // accessors + size_t GetItemHeight() const { return m_nItemHeight; } + + // we create our items ourselves and they have non-standard size, + // so we need to override these functions + virtual wxOwnerDrawn *CreateLboxItem(size_t n); + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); + +protected: + // this can't be called DoHitTest() because wxWindow already has this method + int DoHitTestItem(wxCoord x, wxCoord y) const; + + // pressing space or clicking the check box toggles the item + void OnKeyDown(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); + + wxSize DoGetBestSize() const; + +private: + size_t m_nItemHeight; // height of checklistbox items (the same for all) + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) +}; + +#endif //_CHECKLST_H diff --git a/Externals/wxWidgets/include/wx/msw/chkconf.h b/Externals/wxWidgets/include/wx/msw/chkconf.h index 022ca20ddb..ab3db00401 100644 --- a/Externals/wxWidgets/include/wx/msw/chkconf.h +++ b/Externals/wxWidgets/include/wx/msw/chkconf.h @@ -1,387 +1,387 @@ -/* - * Name: wx/msw/chkconf.h - * Purpose: Compiler-specific configuration checking - * Author: Julian Smart - * Modified by: - * Created: 01/02/97 - * RCS-ID: $Id: chkconf.h 44436 2007-02-10 02:06:54Z RD $ - * Copyright: (c) Julian Smart - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_MSW_CHKCONF_H_ -#define _WX_MSW_CHKCONF_H_ - -/* ensure that MSW-specific settings are defined */ -#ifndef wxUSE_DC_CACHEING -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DC_CACHEING must be defined" -# else -# define wxUSE_DC_CACHEING 1 -# endif -#endif /* wxUSE_DC_CACHEING */ - - -/* - * disable the settings which don't work for some compilers - */ - -/* - * If using PostScript-in-MSW in Univ, must enable PostScript - */ -#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT -# undef wxUSE_POSTSCRIPT -# define wxUSE_POSTSCRIPT 1 -#endif - -#ifndef wxUSE_NORLANDER_HEADERS -# if ( wxCHECK_WATCOM_VERSION(1,0) || defined(__WINE__) ) || \ - ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) -# define wxUSE_NORLANDER_HEADERS 1 -# else -# define wxUSE_NORLANDER_HEADERS 0 -# endif -#endif - -/* - * We don't want to give an error if wxUSE_UNICODE_MSLU is enabled but - * wxUSE_UNICODE is not as this would make it impossible to simply set the - * former in wx/setup.h as then the library wouldn't compile in non-Unicode - * configurations, so instead simply unset it silently when it doesn't make - * sense. - */ -#if wxUSE_UNICODE_MSLU && !wxUSE_UNICODE -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 -#endif - -/* - * Don't use MSLU if compiling with Wine - */ - -#if wxUSE_UNICODE_MSLU && defined(__WINE__) -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 -#endif - -/* - * All of the settings below require SEH support (__try/__catch) and can't work - * without it. - */ -#if !defined(_MSC_VER) && \ - (!defined(__BORLANDC__) || __BORLANDC__ < 0x0550) -# undef wxUSE_ON_FATAL_EXCEPTION -# define wxUSE_ON_FATAL_EXCEPTION 0 - -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 - -# undef wxUSE_STACKWALKER -# define wxUSE_STACKWALKER 0 -#endif /* compiler doesn't support SEH */ - -/* wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior */ -#if defined(__MWERKS__) -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif - -#if defined(__GNUWIN32__) - /* These don't work as expected for mingw32 and cygwin32 */ -# undef wxUSE_MEMORY_TRACING -# define wxUSE_MEMORY_TRACING 0 - -# undef wxUSE_GLOBAL_MEMORY_OPERATORS -# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 - -/* some Cygwin versions don't have wcslen */ -# if defined(__CYGWIN__) || defined(__CYGWIN32__) -# if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) -# undef wxUSE_WCHAR_T -# define wxUSE_WCHAR_T 0 -# endif -#endif - -#endif /* __GNUWIN32__ */ - -/* wxUSE_MFC is not defined when using configure as it doesn't make sense for - gcc or mingw32 anyhow */ -#ifndef wxUSE_MFC - #define wxUSE_MFC 0 -#endif /* !defined(wxUSE_MFC) */ - -/* MFC duplicates these operators */ -#if wxUSE_MFC -# undef wxUSE_GLOBAL_MEMORY_OPERATORS -# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif /* wxUSE_MFC */ - -#if (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) - /* GnuWin32 doesn't have appropriate headers for e.g. IUnknown. */ -# undef wxUSE_DRAG_AND_DROP -# define wxUSE_DRAG_AND_DROP 0 -#endif - -#if !wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) -# undef wxUSE_CHECKLISTBOX -# define wxUSE_CHECKLISTBOX 0 -#endif - -#if wxUSE_SPINCTRL -# if !wxUSE_SPINBTN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxSpinCtrl requires wxSpinButton on MSW" -# else -# undef wxUSE_SPINBTN -# define wxUSE_SPINBTN 1 -# endif -# endif -#endif - -/* - Win64-specific checks. - */ -#ifdef __WIN64__ -# if wxUSE_STACKWALKER - /* this is not currently supported under Win64, volunteers needed to - make it work */ -# undef wxUSE_STACKWALKER -# define wxUSE_STACKWALKER 0 - -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* __WIN64__ */ - - -/* - Compiler-specific checks. - */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) - /* BC++ 4.0 can't compile JPEG library */ -# undef wxUSE_LIBJPEG -# define wxUSE_LIBJPEG 0 -#endif - -/* wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode */ -#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif - -/* DMC++ doesn't have definitions for date picker control, so use generic control - */ -#ifdef __DMC__ -# if wxUSE_DATEPICKCTRL -# undef wxUSE_DATEPICKCTRL_GENERIC -# undef wxUSE_DATEPICKCTRL -# endif -# define wxUSE_DATEPICKCTRL 0 -# define wxUSE_DATEPICKCTRL_GENERIC 1 -#endif - - -/* check that MSW-specific options are defined too */ -#ifndef wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ACTIVEX must be defined." -# else -# define wxUSE_ACTIVEX 0 -# endif -#endif /* !defined(wxUSE_ACTIVEX) */ - -#ifndef wxUSE_DIALUP_MANAGER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIALUP_MANAGER must be defined." -# else -# define wxUSE_DIALUP_MANAGER 0 -# endif -#endif /* !defined(wxUSE_DIALUP_MANAGER) */ - -#ifndef wxUSE_MS_HTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MS_HTML_HELP must be defined." -# else -# define wxUSE_MS_HTML_HELP 0 -# endif -#endif /* !defined(wxUSE_MS_HTML_HELP) */ - -#ifndef wxUSE_OLE -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_OLE must be defined." -# else -# define wxUSE_OLE 0 -# endif -#endif /* !defined(wxUSE_OLE) */ - -#ifndef wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_OLE_AUTOMATION must be defined." -# else -# define wxUSE_OLE_AUTOMATION 0 -# endif -#endif /* !defined(wxUSE_OLE_AUTOMATION) */ - -#ifndef wxUSE_UNICODE_MSLU -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE_MSLU must be defined." -# else -# define wxUSE_UNICODE_MSLU 0 -# endif -#endif /* wxUSE_UNICODE_MSLU */ - -#ifndef wxUSE_UXTHEME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME must be defined." -# else -# define wxUSE_UXTHEME 0 -# endif -#endif /* wxUSE_UXTHEME */ - -#ifndef wxUSE_UXTHEME_AUTO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME_AUTO must be defined." -# else -# define wxUSE_UXTHEME_AUTO 0 -# endif -#endif /* wxUSE_UXTHEME_AUTO */ - - -/* - un/redefine the options which we can't compile (after checking that they're - defined - */ -#ifdef __WINE__ - /* apparently it doesn't compile under Wine, remove it/when it does */ - #if wxUSE_ACTIVEX - #undef wxUSE_ACTIVEX - #define wxUSE_ACTIVEX 0 - #endif // wxUSE_ACTIVEX -#endif // __WINE__ - - -/* check settings consistency for MSW-specific ones */ -#if !wxUSE_VARIANT -# if wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxActiveXContainer requires wxVariant" -# else -# undef wxUSE_ACTIVEX -# define wxUSE_ACTIVEX 0 -# endif -# endif - -# if wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxAutomationObject requires wxVariant" -# else -# undef wxUSE_OLE_AUTOMATION -# define wxUSE_OLE_AUTOMATION 0 -# endif -# endif -#endif /* !wxUSE_VARIANT */ - -#if !wxUSE_DYNAMIC_LOADER -# if wxUSE_MS_HTML_HELP -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MS_HTML_HELP requires wxUSE_DYNAMIC_LOADER." -# else -# undef wxUSE_MS_HTML_HELP -# define wxUSE_MS_HTML_HELP 0 -# endif -# endif -# if wxUSE_DIALUP_MANAGER -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DIALUP_MANAGER requires wxUSE_DYNAMIC_LOADER." -# else -# undef wxUSE_DIALUP_MANAGER -# define wxUSE_DIALUP_MANAGER 0 -# endif -# endif -#endif /* !wxUSE_DYNAMIC_LOADER */ - -#if !wxUSE_DYNLIB_CLASS -# if wxUSE_UXTHEME -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_UXTHEME -# define wxUSE_UXTHEME 0 -# endif -# endif -# if wxUSE_MEDIACTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_MEDIACTRL requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_MEDIACTRL -# define wxUSE_MEDIACTRL 0 -# endif -# endif -# if wxUSE_INKEDIT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_INKEDIT requires wxUSE_DYNLIB_CLASS" -# else -# undef wxUSE_INKEDIT -# define wxUSE_INKEDIT 0 -# endif -# endif -#endif /* !wxUSE_DYNLIB_CLASS */ - -#if !wxUSE_OLE -# if wxUSE_ACTIVEX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxActiveXContainer requires wxUSE_OLE" -# else -# undef wxUSE_ACTIVEX -# define wxUSE_ACTIVEX 0 -# endif -# endif - -# if wxUSE_DATAOBJ -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_DATAOBJ requires wxUSE_OLE" -# else -# undef wxUSE_DATAOBJ -# define wxUSE_DATAOBJ 0 -# endif -# endif - -# if wxUSE_OLE_AUTOMATION -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxAutomationObject requires wxUSE_OLE" -# else -# undef wxUSE_OLE_AUTOMATION -# define wxUSE_OLE_AUTOMATION 0 -# endif -# endif -#endif /* !wxUSE_OLE */ - -#if !wxUSE_ACTIVEX -# if wxUSE_MEDIACTRL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxMediaCtl requires wxActiveXContainer" -# else -# undef wxUSE_MEDIACTRL -# define wxUSE_MEDIACTRL 0 -# endif -# endif -#endif /* !wxUSE_ACTIVEX */ - -#if defined(_MSC_VER) && _MSC_VER <= 1200 && wxUSE_GRAPHICS_CONTEXT -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxGraphicsContext needs MSVC 7 or newer" -# else -# undef wxUSE_GRAPHICS_CONTEXT -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#endif - -#endif /* _WX_MSW_CHKCONF_H_ */ +/* + * Name: wx/msw/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * RCS-ID: $Id: chkconf.h 44436 2007-02-10 02:06:54Z RD $ + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_MSW_CHKCONF_H_ +#define _WX_MSW_CHKCONF_H_ + +/* ensure that MSW-specific settings are defined */ +#ifndef wxUSE_DC_CACHEING +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_CACHEING must be defined" +# else +# define wxUSE_DC_CACHEING 1 +# endif +#endif /* wxUSE_DC_CACHEING */ + + +/* + * disable the settings which don't work for some compilers + */ + +/* + * If using PostScript-in-MSW in Univ, must enable PostScript + */ +#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT +# undef wxUSE_POSTSCRIPT +# define wxUSE_POSTSCRIPT 1 +#endif + +#ifndef wxUSE_NORLANDER_HEADERS +# if ( wxCHECK_WATCOM_VERSION(1,0) || defined(__WINE__) ) || \ + ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) +# define wxUSE_NORLANDER_HEADERS 1 +# else +# define wxUSE_NORLANDER_HEADERS 0 +# endif +#endif + +/* + * We don't want to give an error if wxUSE_UNICODE_MSLU is enabled but + * wxUSE_UNICODE is not as this would make it impossible to simply set the + * former in wx/setup.h as then the library wouldn't compile in non-Unicode + * configurations, so instead simply unset it silently when it doesn't make + * sense. + */ +#if wxUSE_UNICODE_MSLU && !wxUSE_UNICODE +# undef wxUSE_UNICODE_MSLU +# define wxUSE_UNICODE_MSLU 0 +#endif + +/* + * Don't use MSLU if compiling with Wine + */ + +#if wxUSE_UNICODE_MSLU && defined(__WINE__) +# undef wxUSE_UNICODE_MSLU +# define wxUSE_UNICODE_MSLU 0 +#endif + +/* + * All of the settings below require SEH support (__try/__catch) and can't work + * without it. + */ +#if !defined(_MSC_VER) && \ + (!defined(__BORLANDC__) || __BORLANDC__ < 0x0550) +# undef wxUSE_ON_FATAL_EXCEPTION +# define wxUSE_ON_FATAL_EXCEPTION 0 + +# undef wxUSE_CRASHREPORT +# define wxUSE_CRASHREPORT 0 + +# undef wxUSE_STACKWALKER +# define wxUSE_STACKWALKER 0 +#endif /* compiler doesn't support SEH */ + +/* wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior */ +#if defined(__MWERKS__) +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +#if defined(__GNUWIN32__) + /* These don't work as expected for mingw32 and cygwin32 */ +# undef wxUSE_MEMORY_TRACING +# define wxUSE_MEMORY_TRACING 0 + +# undef wxUSE_GLOBAL_MEMORY_OPERATORS +# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 + +/* some Cygwin versions don't have wcslen */ +# if defined(__CYGWIN__) || defined(__CYGWIN32__) +# if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) +# undef wxUSE_WCHAR_T +# define wxUSE_WCHAR_T 0 +# endif +#endif + +#endif /* __GNUWIN32__ */ + +/* wxUSE_MFC is not defined when using configure as it doesn't make sense for + gcc or mingw32 anyhow */ +#ifndef wxUSE_MFC + #define wxUSE_MFC 0 +#endif /* !defined(wxUSE_MFC) */ + +/* MFC duplicates these operators */ +#if wxUSE_MFC +# undef wxUSE_GLOBAL_MEMORY_OPERATORS +# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif /* wxUSE_MFC */ + +#if (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) + /* GnuWin32 doesn't have appropriate headers for e.g. IUnknown. */ +# undef wxUSE_DRAG_AND_DROP +# define wxUSE_DRAG_AND_DROP 0 +#endif + +#if !wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) +# undef wxUSE_CHECKLISTBOX +# define wxUSE_CHECKLISTBOX 0 +#endif + +#if wxUSE_SPINCTRL +# if !wxUSE_SPINBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxSpinCtrl requires wxSpinButton on MSW" +# else +# undef wxUSE_SPINBTN +# define wxUSE_SPINBTN 1 +# endif +# endif +#endif + +/* + Win64-specific checks. + */ +#ifdef __WIN64__ +# if wxUSE_STACKWALKER + /* this is not currently supported under Win64, volunteers needed to + make it work */ +# undef wxUSE_STACKWALKER +# define wxUSE_STACKWALKER 0 + +# undef wxUSE_CRASHREPORT +# define wxUSE_CRASHREPORT 0 +# endif +#endif /* __WIN64__ */ + + +/* + Compiler-specific checks. + */ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) + /* BC++ 4.0 can't compile JPEG library */ +# undef wxUSE_LIBJPEG +# define wxUSE_LIBJPEG 0 +#endif + +/* wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode */ +#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +/* DMC++ doesn't have definitions for date picker control, so use generic control + */ +#ifdef __DMC__ +# if wxUSE_DATEPICKCTRL +# undef wxUSE_DATEPICKCTRL_GENERIC +# undef wxUSE_DATEPICKCTRL +# endif +# define wxUSE_DATEPICKCTRL 0 +# define wxUSE_DATEPICKCTRL_GENERIC 1 +#endif + + +/* check that MSW-specific options are defined too */ +#ifndef wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVEX must be defined." +# else +# define wxUSE_ACTIVEX 0 +# endif +#endif /* !defined(wxUSE_ACTIVEX) */ + +#ifndef wxUSE_DIALUP_MANAGER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIALUP_MANAGER must be defined." +# else +# define wxUSE_DIALUP_MANAGER 0 +# endif +#endif /* !defined(wxUSE_DIALUP_MANAGER) */ + +#ifndef wxUSE_MS_HTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MS_HTML_HELP must be defined." +# else +# define wxUSE_MS_HTML_HELP 0 +# endif +#endif /* !defined(wxUSE_MS_HTML_HELP) */ + +#ifndef wxUSE_OLE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE must be defined." +# else +# define wxUSE_OLE 0 +# endif +#endif /* !defined(wxUSE_OLE) */ + +#ifndef wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE_AUTOMATION must be defined." +# else +# define wxUSE_OLE_AUTOMATION 0 +# endif +#endif /* !defined(wxUSE_OLE_AUTOMATION) */ + +#ifndef wxUSE_UNICODE_MSLU +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UNICODE_MSLU must be defined." +# else +# define wxUSE_UNICODE_MSLU 0 +# endif +#endif /* wxUSE_UNICODE_MSLU */ + +#ifndef wxUSE_UXTHEME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME must be defined." +# else +# define wxUSE_UXTHEME 0 +# endif +#endif /* wxUSE_UXTHEME */ + +#ifndef wxUSE_UXTHEME_AUTO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME_AUTO must be defined." +# else +# define wxUSE_UXTHEME_AUTO 0 +# endif +#endif /* wxUSE_UXTHEME_AUTO */ + + +/* + un/redefine the options which we can't compile (after checking that they're + defined + */ +#ifdef __WINE__ + /* apparently it doesn't compile under Wine, remove it/when it does */ + #if wxUSE_ACTIVEX + #undef wxUSE_ACTIVEX + #define wxUSE_ACTIVEX 0 + #endif // wxUSE_ACTIVEX +#endif // __WINE__ + + +/* check settings consistency for MSW-specific ones */ +#if !wxUSE_VARIANT +# if wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxActiveXContainer requires wxVariant" +# else +# undef wxUSE_ACTIVEX +# define wxUSE_ACTIVEX 0 +# endif +# endif + +# if wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxAutomationObject requires wxVariant" +# else +# undef wxUSE_OLE_AUTOMATION +# define wxUSE_OLE_AUTOMATION 0 +# endif +# endif +#endif /* !wxUSE_VARIANT */ + +#if !wxUSE_DYNAMIC_LOADER +# if wxUSE_MS_HTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MS_HTML_HELP requires wxUSE_DYNAMIC_LOADER." +# else +# undef wxUSE_MS_HTML_HELP +# define wxUSE_MS_HTML_HELP 0 +# endif +# endif +# if wxUSE_DIALUP_MANAGER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIALUP_MANAGER requires wxUSE_DYNAMIC_LOADER." +# else +# undef wxUSE_DIALUP_MANAGER +# define wxUSE_DIALUP_MANAGER 0 +# endif +# endif +#endif /* !wxUSE_DYNAMIC_LOADER */ + +#if !wxUSE_DYNLIB_CLASS +# if wxUSE_UXTHEME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_UXTHEME +# define wxUSE_UXTHEME 0 +# endif +# endif +# if wxUSE_MEDIACTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MEDIACTRL requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_MEDIACTRL +# define wxUSE_MEDIACTRL 0 +# endif +# endif +# if wxUSE_INKEDIT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_INKEDIT requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_INKEDIT +# define wxUSE_INKEDIT 0 +# endif +# endif +#endif /* !wxUSE_DYNLIB_CLASS */ + +#if !wxUSE_OLE +# if wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxActiveXContainer requires wxUSE_OLE" +# else +# undef wxUSE_ACTIVEX +# define wxUSE_ACTIVEX 0 +# endif +# endif + +# if wxUSE_DATAOBJ +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATAOBJ requires wxUSE_OLE" +# else +# undef wxUSE_DATAOBJ +# define wxUSE_DATAOBJ 0 +# endif +# endif + +# if wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxAutomationObject requires wxUSE_OLE" +# else +# undef wxUSE_OLE_AUTOMATION +# define wxUSE_OLE_AUTOMATION 0 +# endif +# endif +#endif /* !wxUSE_OLE */ + +#if !wxUSE_ACTIVEX +# if wxUSE_MEDIACTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxMediaCtl requires wxActiveXContainer" +# else +# undef wxUSE_MEDIACTRL +# define wxUSE_MEDIACTRL 0 +# endif +# endif +#endif /* !wxUSE_ACTIVEX */ + +#if defined(_MSC_VER) && _MSC_VER <= 1200 && wxUSE_GRAPHICS_CONTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxGraphicsContext needs MSVC 7 or newer" +# else +# undef wxUSE_GRAPHICS_CONTEXT +# define wxUSE_GRAPHICS_CONTEXT 0 +# endif +#endif + +#endif /* _WX_MSW_CHKCONF_H_ */ diff --git a/Externals/wxWidgets/include/wx/msw/choice.h b/Externals/wxWidgets/include/wx/msw/choice.h index 6dccdafa49..c62037f879 100644 --- a/Externals/wxWidgets/include/wx/msw/choice.h +++ b/Externals/wxWidgets/include/wx/msw/choice.h @@ -1,135 +1,135 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/choice.h -// Purpose: wxChoice class -// Author: Julian Smart -// Modified by: Vadim Zeitlin to derive from wxChoiceBase -// Created: 01/02/97 -// RCS-ID: $Id: choice.h 51616 2008-02-09 15:22:15Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICE_H_ -#define _WX_CHOICE_H_ - -// ---------------------------------------------------------------------------- -// Choice item -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoice : public wxChoiceBase -{ -public: - // ctors - wxChoice() { Init(); } - virtual ~wxChoice(); - - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Init(); - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Init(); - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - virtual void SetLabel(const wxString& label); - - virtual void Delete(unsigned int n); - virtual void Clear(); - - virtual unsigned int GetCount() const; - virtual int GetSelection() const; - virtual int GetCurrentSelection() const; - virtual void SetSelection(int n); - - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - - // MSW only - virtual bool MSWCommand(WXUINT param, WXWORD id); - WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); - virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - // common part of all ctors - void Init() { m_lastAcceptedSelection = wxID_NONE; } - - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - - // MSW implementation - virtual wxSize DoGetBestSize() const; - virtual void DoGetSize(int *w, int *h) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - // update the height of the drop down list to fit the number of items we - // have (without changing the visible height) - void UpdateVisibleHeight(); - - // create and initialize the control - bool CreateAndInit(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name); - - // free all memory we have (used by Clear() and dtor) - void Free(); - - - // last "completed" selection, i.e. not the transient one while the user is - // browsing the popup list: this is only used when != wxID_NONE which is - // the case while the drop down is opened - int m_lastAcceptedSelection; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) -}; - -#endif // _WX_CHOICE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/choice.h +// Purpose: wxChoice class +// Author: Julian Smart +// Modified by: Vadim Zeitlin to derive from wxChoiceBase +// Created: 01/02/97 +// RCS-ID: $Id: choice.h 51616 2008-02-09 15:22:15Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_ +#define _WX_CHOICE_H_ + +// ---------------------------------------------------------------------------- +// Choice item +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxChoice : public wxChoiceBase +{ +public: + // ctors + wxChoice() { Init(); } + virtual ~wxChoice(); + + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Init(); + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Init(); + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + virtual void SetLabel(const wxString& label); + + virtual void Delete(unsigned int n); + virtual void Clear(); + + virtual unsigned int GetCount() const; + virtual int GetSelection() const; + virtual int GetCurrentSelection() const; + virtual void SetSelection(int n); + + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + + // MSW only + virtual bool MSWCommand(WXUINT param, WXWORD id); + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); + virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + // common part of all ctors + void Init() { m_lastAcceptedSelection = wxID_NONE; } + + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + + // MSW implementation + virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *w, int *h) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // update the height of the drop down list to fit the number of items we + // have (without changing the visible height) + void UpdateVisibleHeight(); + + // create and initialize the control + bool CreateAndInit(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name); + + // free all memory we have (used by Clear() and dtor) + void Free(); + + + // last "completed" selection, i.e. not the transient one while the user is + // browsing the popup list: this is only used when != wxID_NONE which is + // the case while the drop down is opened + int m_lastAcceptedSelection; + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) +}; + +#endif // _WX_CHOICE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/clipbrd.h b/Externals/wxWidgets/include/wx/msw/clipbrd.h index a8cf81c3c7..85f8902172 100644 --- a/Externals/wxWidgets/include/wx/msw/clipbrd.h +++ b/Externals/wxWidgets/include/wx/msw/clipbrd.h @@ -1,98 +1,98 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/clipbrd.h -// Purpose: wxClipboad class and clipboard functions for MSW -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CLIPBRD_H_ -#define _WX_CLIPBRD_H_ - -#if wxUSE_CLIPBOARD - -#include "wx/list.h" -#include "wx/module.h" -#include "wx/dataobj.h" // for wxDataFormat - -// These functions superceded by wxClipboard, but retained in order to -// implement wxClipboard, and for compatibility. - -// open/close the clipboard -WXDLLEXPORT bool wxOpenClipboard(); -WXDLLEXPORT bool wxIsClipboardOpened(); -#define wxClipboardOpen wxIsClipboardOpened -WXDLLEXPORT bool wxCloseClipboard(); - -// get/set data -WXDLLEXPORT bool wxEmptyClipboard(); -WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, - const void *data, - int width = 0, int height = 0); -WXDLLEXPORT void* wxGetClipboardData(wxDataFormat dataFormat, - long *len = NULL); - -// clipboard formats -WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); -WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); -WXDLLEXPORT int wxRegisterClipboardFormat(wxChar *formatName); -WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, - wxChar *formatName, - int maxCount); - -//----------------------------------------------------------------------------- -// wxClipboard -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLEXPORT wxClipboard : public wxClipboardBase -{ - DECLARE_DYNAMIC_CLASS(wxClipboard) - -public: - wxClipboard(); - virtual ~wxClipboard(); - - // open the clipboard before SetData() and GetData() - virtual bool Open(); - - // close the clipboard after SetData() and GetData() - virtual void Close(); - - // query whether the clipboard is opened - virtual bool IsOpened() const; - - // set the clipboard data. all other formats will be deleted. - virtual bool SetData( wxDataObject *data ); - - // add to the clipboard data. - virtual bool AddData( wxDataObject *data ); - - // ask if data in correct format is available - virtual bool IsSupported( const wxDataFormat& format ); - - // fill data with data on the clipboard (if available) - virtual bool GetData( wxDataObject& data ); - - // clears wxTheClipboard and the system's clipboard if possible - virtual void Clear(); - - // flushes the clipboard: this means that the data which is currently on - // clipboard will stay available even after the application exits (possibly - // eating memory), otherwise the clipboard will be emptied on exit - virtual bool Flush(); - - // X11 has two clipboards which get selected by this call. Empty on MSW. - void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } - -private: - IDataObject *m_lastDataObject; - bool m_isOpened; -}; - -#endif // wxUSE_CLIPBOARD -#endif - // _WX_CLIPBRD_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/clipbrd.h +// Purpose: wxClipboad class and clipboard functions for MSW +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: clipbrd.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_ +#define _WX_CLIPBRD_H_ + +#if wxUSE_CLIPBOARD + +#include "wx/list.h" +#include "wx/module.h" +#include "wx/dataobj.h" // for wxDataFormat + +// These functions superceded by wxClipboard, but retained in order to +// implement wxClipboard, and for compatibility. + +// open/close the clipboard +WXDLLEXPORT bool wxOpenClipboard(); +WXDLLEXPORT bool wxIsClipboardOpened(); +#define wxClipboardOpen wxIsClipboardOpened +WXDLLEXPORT bool wxCloseClipboard(); + +// get/set data +WXDLLEXPORT bool wxEmptyClipboard(); +WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, + const void *data, + int width = 0, int height = 0); +WXDLLEXPORT void* wxGetClipboardData(wxDataFormat dataFormat, + long *len = NULL); + +// clipboard formats +WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); +WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); +WXDLLEXPORT int wxRegisterClipboardFormat(wxChar *formatName); +WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, + wxChar *formatName, + int maxCount); + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDataObject; +class WXDLLEXPORT wxClipboard : public wxClipboardBase +{ + DECLARE_DYNAMIC_CLASS(wxClipboard) + +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // query whether the clipboard is opened + virtual bool IsOpened() const; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ); + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ); + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush(); + + // X11 has two clipboards which get selected by this call. Empty on MSW. + void UsePrimarySelection( bool WXUNUSED(primary) = false ) { } + +private: + IDataObject *m_lastDataObject; + bool m_isOpened; +}; + +#endif // wxUSE_CLIPBOARD +#endif + // _WX_CLIPBRD_H_ diff --git a/Externals/wxWidgets/include/wx/msw/colordlg.h b/Externals/wxWidgets/include/wx/msw/colordlg.h index fa09134734..7d9764393f 100644 --- a/Externals/wxWidgets/include/wx/msw/colordlg.h +++ b/Externals/wxWidgets/include/wx/msw/colordlg.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/colordlg.h -// Purpose: wxColourDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colordlg.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLORDLG_H_ -#define _WX_COLORDLG_H_ - -#include "wx/defs.h" -#include "wx/dialog.h" -#include "wx/cmndata.h" - -// ---------------------------------------------------------------------------- -// wxColourDialog: dialog for choosing a colours -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxColourDialog : public wxDialog -{ -public: - wxColourDialog(); - wxColourDialog(wxWindow *parent, wxColourData *data = NULL); - - bool Create(wxWindow *parent, wxColourData *data = NULL); - - wxColourData& GetColourData() { return m_colourData; } - - // override some base class virtuals - virtual void SetTitle(const wxString& title); - virtual wxString GetTitle() const; - - virtual int ShowModal(); - -protected: - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - wxColourData m_colourData; - wxString m_title; - - wxPoint m_pos; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) -}; - -#endif - // _WX_COLORDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/colordlg.h +// Purpose: wxColourDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: colordlg.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_ +#define _WX_COLORDLG_H_ + +#include "wx/defs.h" +#include "wx/dialog.h" +#include "wx/cmndata.h" + +// ---------------------------------------------------------------------------- +// wxColourDialog: dialog for choosing a colours +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxColourDialog : public wxDialog +{ +public: + wxColourDialog(); + wxColourDialog(wxWindow *parent, wxColourData *data = NULL); + + bool Create(wxWindow *parent, wxColourData *data = NULL); + + wxColourData& GetColourData() { return m_colourData; } + + // override some base class virtuals + virtual void SetTitle(const wxString& title); + virtual wxString GetTitle() const; + + virtual int ShowModal(); + +protected: + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + wxColourData m_colourData; + wxString m_title; + + wxPoint m_pos; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) +}; + +#endif + // _WX_COLORDLG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/colour.h b/Externals/wxWidgets/include/wx/msw/colour.h index d66b838d72..9d7c31d477 100644 --- a/Externals/wxWidgets/include/wx/msw/colour.h +++ b/Externals/wxWidgets/include/wx/msw/colour.h @@ -1,88 +1,88 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/colour.h -// Purpose: wxColour class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: colour.h 51769 2008-02-13 22:36:43Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLOUR_H_ -#define _WX_COLOUR_H_ - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// Colour -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxColour : public wxColourBase -{ -public: - // constructors - // ------------ - - wxColour() { Init(); } - wxColour( ChannelType red, ChannelType green, ChannelType blue, - ChannelType alpha = wxALPHA_OPAQUE ) - { Set(red, green, blue, alpha); } - wxColour( unsigned long colRGB ) { Set(colRGB); } - wxColour(const wxString& colourName) { Init(); Set(colourName); } - wxColour(const wxChar *colourName) { Init(); Set(colourName); } - - - // dtor - virtual ~wxColour(); - - - // accessors - // --------- - - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_isInit; } - - unsigned char Red() const { return m_red; } - unsigned char Green() const { return m_green; } - unsigned char Blue() const { return m_blue; } - unsigned char Alpha() const { return m_alpha ; } - - // comparison - bool operator==(const wxColour& colour) const - { - return m_isInit == colour.m_isInit - && m_red == colour.m_red - && m_green == colour.m_green - && m_blue == colour.m_blue - && m_alpha == colour.m_alpha; - } - - bool operator != (const wxColour& colour) const { return !(*this == colour); } - - WXCOLORREF GetPixel() const { return m_pixel; } - - -public: - WXCOLORREF m_pixel; - -protected: - // Helper function - void Init(); - - virtual void - InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); - -private: - bool m_isInit; - unsigned char m_red; - unsigned char m_blue; - unsigned char m_green; - unsigned char m_alpha; - -private: - DECLARE_DYNAMIC_CLASS(wxColour) -}; - -#endif - // _WX_COLOUR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/colour.h +// Purpose: wxColour class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: colour.h 51769 2008-02-13 22:36:43Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// Colour +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxColour : public wxColourBase +{ +public: + // constructors + // ------------ + + wxColour() { Init(); } + wxColour( ChannelType red, ChannelType green, ChannelType blue, + ChannelType alpha = wxALPHA_OPAQUE ) + { Set(red, green, blue, alpha); } + wxColour( unsigned long colRGB ) { Set(colRGB); } + wxColour(const wxString& colourName) { Init(); Set(colourName); } + wxColour(const wxChar *colourName) { Init(); Set(colourName); } + + + // dtor + virtual ~wxColour(); + + + // accessors + // --------- + + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_isInit; } + + unsigned char Red() const { return m_red; } + unsigned char Green() const { return m_green; } + unsigned char Blue() const { return m_blue; } + unsigned char Alpha() const { return m_alpha ; } + + // comparison + bool operator==(const wxColour& colour) const + { + return m_isInit == colour.m_isInit + && m_red == colour.m_red + && m_green == colour.m_green + && m_blue == colour.m_blue + && m_alpha == colour.m_alpha; + } + + bool operator != (const wxColour& colour) const { return !(*this == colour); } + + WXCOLORREF GetPixel() const { return m_pixel; } + + +public: + WXCOLORREF m_pixel; + +protected: + // Helper function + void Init(); + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + unsigned char m_alpha; + +private: + DECLARE_DYNAMIC_CLASS(wxColour) +}; + +#endif + // _WX_COLOUR_H_ diff --git a/Externals/wxWidgets/include/wx/msw/combo.h b/Externals/wxWidgets/include/wx/msw/combo.h index 0cd58b32d9..ffb72c85d8 100644 --- a/Externals/wxWidgets/include/wx/msw/combo.h +++ b/Externals/wxWidgets/include/wx/msw/combo.h @@ -1,111 +1,111 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/combo.h -// Purpose: wxComboCtrl class -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: combo.h 43881 2006-12-09 19:48:21Z PC $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOCONTROL_H_ -#define _WX_COMBOCONTROL_H_ - -// NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to -// determine whether there is native wxComboCtrl, so make sure you -// use it in all native wxComboCtrls. - -#if wxUSE_COMBOCTRL - -#if !defined(__WXWINCE__) && wxUSE_TIMER - #include "wx/timer.h" - #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1 -#else - #define wxUSE_COMBOCTRL_POPUP_ANIMATION 0 -#endif - - -// ---------------------------------------------------------------------------- -// Native wxComboCtrl -// ---------------------------------------------------------------------------- - -// Define this only if native implementation includes all features -#define wxCOMBOCONTROL_FULLY_FEATURED - -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; - -class WXDLLEXPORT wxComboCtrl : public wxComboCtrlBase -{ -public: - // ctors and such - wxComboCtrl() : wxComboCtrlBase() { Init(); } - - wxComboCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxComboCtrlBase() - { - Init(); - - (void)Create(parent, id, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - virtual ~wxComboCtrl(); - - virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; - - static int GetFeatures() { return wxComboCtrlFeatures::All; } - -#if wxUSE_COMBOCTRL_POPUP_ANIMATION - void OnTimerEvent( wxTimerEvent& event ); -protected: - virtual bool AnimateShow( const wxRect& rect, int flags ); -#endif - -protected: - - // customization - virtual void OnResize(); - virtual wxCoord GetNativeTextIndent() const; - virtual void OnThemeChange(); - - // event handlers - void OnPaintEvent( wxPaintEvent& event ); - void OnMouseEvent( wxMouseEvent& event ); - -private: - void Init(); - -#if wxUSE_COMBOCTRL_POPUP_ANIMATION - // Popup animation related - wxLongLong m_animStart; - wxTimer m_animTimer; - wxRect m_animRect; - int m_animFlags; -#endif - - DECLARE_EVENT_TABLE() - - DECLARE_DYNAMIC_CLASS(wxComboCtrl) -}; - - -#endif // wxUSE_COMBOCTRL -#endif - // _WX_COMBOCONTROL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/combo.h +// Purpose: wxComboCtrl class +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id: combo.h 43881 2006-12-09 19:48:21Z PC $ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOCONTROL_H_ +#define _WX_COMBOCONTROL_H_ + +// NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to +// determine whether there is native wxComboCtrl, so make sure you +// use it in all native wxComboCtrls. + +#if wxUSE_COMBOCTRL + +#if !defined(__WXWINCE__) && wxUSE_TIMER + #include "wx/timer.h" + #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1 +#else + #define wxUSE_COMBOCTRL_POPUP_ANIMATION 0 +#endif + + +// ---------------------------------------------------------------------------- +// Native wxComboCtrl +// ---------------------------------------------------------------------------- + +// Define this only if native implementation includes all features +#define wxCOMBOCONTROL_FULLY_FEATURED + +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; + +class WXDLLEXPORT wxComboCtrl : public wxComboCtrlBase +{ +public: + // ctors and such + wxComboCtrl() : wxComboCtrlBase() { Init(); } + + wxComboCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboCtrlBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxComboCtrl(); + + virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; + + static int GetFeatures() { return wxComboCtrlFeatures::All; } + +#if wxUSE_COMBOCTRL_POPUP_ANIMATION + void OnTimerEvent( wxTimerEvent& event ); +protected: + virtual bool AnimateShow( const wxRect& rect, int flags ); +#endif + +protected: + + // customization + virtual void OnResize(); + virtual wxCoord GetNativeTextIndent() const; + virtual void OnThemeChange(); + + // event handlers + void OnPaintEvent( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + +private: + void Init(); + +#if wxUSE_COMBOCTRL_POPUP_ANIMATION + // Popup animation related + wxLongLong m_animStart; + wxTimer m_animTimer; + wxRect m_animRect; + int m_animFlags; +#endif + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxComboCtrl) +}; + + +#endif // wxUSE_COMBOCTRL +#endif + // _WX_COMBOCONTROL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/combobox.h b/Externals/wxWidgets/include/wx/msw/combobox.h index 5d4d7761fb..4ac642da4f 100644 --- a/Externals/wxWidgets/include/wx/msw/combobox.h +++ b/Externals/wxWidgets/include/wx/msw/combobox.h @@ -1,138 +1,138 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/combobox.h -// Purpose: wxComboBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: combobox.h 45818 2007-05-05 13:15:47Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COMBOBOX_H_ -#define _WX_COMBOBOX_H_ - -#include "wx/choice.h" - -#if wxUSE_COMBOBOX - -// ---------------------------------------------------------------------------- -// Combobox control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxComboBox: public wxChoice -{ -public: - wxComboBox() { } - - wxComboBox(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, id, value, pos, size, n, choices, style, validator, name); - } - wxComboBox(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, id, value, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - // List functions: see wxChoice - - // Text field functions - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(int n) { wxChoice::SetSelection(n); } - virtual void SetSelection(long from, long to); - virtual int GetSelection() const { return wxChoice::GetSelection(); } - virtual void GetSelection(long* from, long* to) const; - virtual void SetEditable(bool editable); - - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - virtual void SelectAll(); - virtual bool IsEditable() const; - virtual bool HasSelection() const; - - // implementation only from now on - virtual bool MSWCommand(WXUINT param, WXWORD id); - bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - bool MSWShouldPreProcessMessage(WXMSG *pMsg); - - WXHWND GetEditHWND() const; - - // Standard event handling - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_COMBOBOX -#endif - // _WX_COMBOBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/combobox.h +// Purpose: wxComboBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: combobox.h 45818 2007-05-05 13:15:47Z RR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_ +#define _WX_COMBOBOX_H_ + +#include "wx/choice.h" + +#if wxUSE_COMBOBOX + +// ---------------------------------------------------------------------------- +// Combobox control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxComboBox: public wxChoice +{ +public: + wxComboBox() { } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + // List functions: see wxChoice + + // Text field functions + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(int n) { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to); + virtual int GetSelection() const { return wxChoice::GetSelection(); } + virtual void GetSelection(long* from, long* to) const; + virtual void SetEditable(bool editable); + + virtual void Undo(); + virtual void Redo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; + virtual void SelectAll(); + virtual bool IsEditable() const; + virtual bool HasSelection() const; + + // implementation only from now on + virtual bool MSWCommand(WXUINT param, WXWORD id); + bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + bool MSWShouldPreProcessMessage(WXMSG *pMsg); + + WXHWND GetEditHWND() const; + + // Standard event handling + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_COMBOBOX +#endif + // _WX_COMBOBOX_H_ diff --git a/Externals/wxWidgets/include/wx/msw/control.h b/Externals/wxWidgets/include/wx/msw/control.h index c70454cbc7..8818448669 100644 --- a/Externals/wxWidgets/include/wx/msw/control.h +++ b/Externals/wxWidgets/include/wx/msw/control.h @@ -1,141 +1,141 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/control.h -// Purpose: wxControl class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: control.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CONTROL_H_ -#define _WX_CONTROL_H_ - -#include "wx/dynarray.h" - -// General item class -class WXDLLEXPORT wxControl : public wxControlBase -{ -public: - wxControl() { } - - wxControl(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr); - - virtual ~wxControl(); - - // Simulates an event - virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } - - - // implementation from now on - // -------------------------- - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // Calls the callback and appropriate event handlers - bool ProcessCommand(wxCommandEvent& event); - - // MSW-specific - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // For ownerdraw items - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return false; } - virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return false; } - - const wxArrayLong& GetSubcontrols() const { return m_subControls; } - - // default handling of WM_CTLCOLORxxx: this is public so that wxWindow - // could call it - virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); - - // default style for the control include WS_TABSTOP if it AcceptsFocus() - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - - // return default best size (doesn't really make any sense, override this) - virtual wxSize DoGetBestSize() const; - - // This is a helper for all wxControls made with UPDOWN native control. - // In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in - // WinCE of Smartphones this happens also for native wxTextCtrl, - // wxChoice and others. - virtual wxSize GetBestSpinnerSize(const bool is_vertical) const; - - // create the control of the given Windows class: this is typically called - // from Create() method of the derived class passing its label, pos and - // size parameter (style parameter is not needed because m_windowStyle is - // supposed to had been already set and so is used instead when this - // function is called) - bool MSWCreateControl(const wxChar *classname, - const wxString& label, - const wxPoint& pos, - const wxSize& size); - - // NB: the method below is deprecated now, with MSWGetStyle() the method - // above should be used instead! Once all the controls are updated to - // implement MSWGetStyle() this version will disappear. - // - // create the control of the given class with the given style (combination - // of WS_XXX flags, i.e. Windows style, not wxWidgets one), returns - // false if creation failed - // - // All parameters except classname and style are optional, if the - // size/position are not given, they should be set later with SetSize() - // and, label (the title of the window), of course, is left empty. The - // extended style is determined from the style and the app 3D settings - // automatically if it's not specified explicitly. - bool MSWCreateControl(const wxChar *classname, - WXDWORD style, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& label = wxEmptyString, - WXDWORD exstyle = (WXDWORD)-1); - - // call this from the derived class MSWControlColor() if you want to show - // the control greyed out (and opaque) - WXHBRUSH MSWControlColorDisabled(WXHDC pDC); - - // common part of the 3 functions above: pass wxNullColour to use the - // appropriate background colour (meaning ours or our parents) or a fixed - // one - virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd); - - // this is a helper for the derived class GetClassDefaultAttributes() - // implementation: it returns the right colours for the classes which - // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of - // being simple controls (such as wxButton, wxCheckBox, ...) - static wxVisualAttributes - GetCompositeControlsDefaultAttributes(wxWindowVariant variant); - - // for controls like radiobuttons which are really composite this array - // holds the ids (not HWNDs!) of the sub controls - wxArrayLong m_subControls; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl) -}; - -#endif // _WX_CONTROL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/control.h +// Purpose: wxControl class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: control.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_ +#define _WX_CONTROL_H_ + +#include "wx/dynarray.h" + +// General item class +class WXDLLEXPORT wxControl : public wxControlBase +{ +public: + wxControl() { } + + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr); + + virtual ~wxControl(); + + // Simulates an event + virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } + + + // implementation from now on + // -------------------------- + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // Calls the callback and appropriate event handlers + bool ProcessCommand(wxCommandEvent& event); + + // MSW-specific + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // For ownerdraw items + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return false; } + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return false; } + + const wxArrayLong& GetSubcontrols() const { return m_subControls; } + + // default handling of WM_CTLCOLORxxx: this is public so that wxWindow + // could call it + virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); + + // default style for the control include WS_TABSTOP if it AcceptsFocus() + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const; + + // return default best size (doesn't really make any sense, override this) + virtual wxSize DoGetBestSize() const; + + // This is a helper for all wxControls made with UPDOWN native control. + // In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in + // WinCE of Smartphones this happens also for native wxTextCtrl, + // wxChoice and others. + virtual wxSize GetBestSpinnerSize(const bool is_vertical) const; + + // create the control of the given Windows class: this is typically called + // from Create() method of the derived class passing its label, pos and + // size parameter (style parameter is not needed because m_windowStyle is + // supposed to had been already set and so is used instead when this + // function is called) + bool MSWCreateControl(const wxChar *classname, + const wxString& label, + const wxPoint& pos, + const wxSize& size); + + // NB: the method below is deprecated now, with MSWGetStyle() the method + // above should be used instead! Once all the controls are updated to + // implement MSWGetStyle() this version will disappear. + // + // create the control of the given class with the given style (combination + // of WS_XXX flags, i.e. Windows style, not wxWidgets one), returns + // false if creation failed + // + // All parameters except classname and style are optional, if the + // size/position are not given, they should be set later with SetSize() + // and, label (the title of the window), of course, is left empty. The + // extended style is determined from the style and the app 3D settings + // automatically if it's not specified explicitly. + bool MSWCreateControl(const wxChar *classname, + WXDWORD style, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& label = wxEmptyString, + WXDWORD exstyle = (WXDWORD)-1); + + // call this from the derived class MSWControlColor() if you want to show + // the control greyed out (and opaque) + WXHBRUSH MSWControlColorDisabled(WXHDC pDC); + + // common part of the 3 functions above: pass wxNullColour to use the + // appropriate background colour (meaning ours or our parents) or a fixed + // one + virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd); + + // this is a helper for the derived class GetClassDefaultAttributes() + // implementation: it returns the right colours for the classes which + // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of + // being simple controls (such as wxButton, wxCheckBox, ...) + static wxVisualAttributes + GetCompositeControlsDefaultAttributes(wxWindowVariant variant); + + // for controls like radiobuttons which are really composite this array + // holds the ids (not HWNDs!) of the sub controls + wxArrayLong m_subControls; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl) +}; + +#endif // _WX_CONTROL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/crashrpt.h b/Externals/wxWidgets/include/wx/msw/crashrpt.h index 3933a387d4..81091b301f 100644 --- a/Externals/wxWidgets/include/wx/msw/crashrpt.h +++ b/Externals/wxWidgets/include/wx/msw/crashrpt.h @@ -1,120 +1,120 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/crashrpt.h -// Purpose: helpers for the structured exception handling (SEH) under Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 13.07.2003 -// RCS-ID: $Id: crashrpt.h 34436 2005-05-31 09:20:43Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_CRASHRPT_H_ -#define _WX_MSW_CRASHRPT_H_ - -#include "wx/defs.h" - -#if wxUSE_CRASHREPORT - -struct _EXCEPTION_POINTERS; - -// ---------------------------------------------------------------------------- -// crash report generation flags -// ---------------------------------------------------------------------------- - -enum -{ - // we always report where the crash occurred - wxCRASH_REPORT_LOCATION = 0, - - // if this flag is given, the call stack is dumped - // - // this results in dump/crash report as small as possible, this is the - // default flag - wxCRASH_REPORT_STACK = 1, - - // if this flag is given, the values of the local variables are dumped - // - // note that with the current implementation it requires dumping the full - // process address space and so this will result in huge dump file and will - // take some time to generate - // - // it's probably not a good idea to use this by default, start with default - // mini dump and ask your users to set WX_CRASH_FLAGS environment variable - // to 2 or 4 if you need more information in the dump - wxCRASH_REPORT_LOCALS = 2, - - // if this flag is given, the values of all global variables are dumped - // - // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but - // still much smaller than wxCRASH_REPORT_LOCALS one - wxCRASH_REPORT_GLOBALS = 4, - - // default is to create the smallest possible crash report - wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK -}; - -// ---------------------------------------------------------------------------- -// wxCrashContext: information about the crash context -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxCrashContext -{ - // initialize this object with the given information or from the current - // global exception info which is only valid inside wxApp::OnFatalException - wxCrashContext(_EXCEPTION_POINTERS *ep = NULL); - - // get the name for this exception code - wxString GetExceptionString() const; - - - // exception code - size_t code; - - // exception address - void *addr; - - // machine-specific registers vaues - struct - { -#ifdef __INTEL__ - wxInt32 eax, ebx, ecx, edx, esi, edi, - ebp, esp, eip, - cs, ds, es, fs, gs, ss, - flags; -#endif // __INTEL__ - } regs; -}; - -// ---------------------------------------------------------------------------- -// wxCrashReport: this class is used to create crash reports -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxCrashReport -{ - // set the name of the file to which the report is written, it is - // constructed from the .exe name by default - static void SetFileName(const wxChar *filename); - - // return the current file name - static const wxChar *GetFileName(); - - // write the exception report to the file, return true if it could be done - // or false otherwise - // - // if ep pointer is NULL, the global exception info which is valid only - // inside wxApp::OnFatalException() is used - static bool Generate(int flags = wxCRASH_REPORT_DEFAULT, - _EXCEPTION_POINTERS *ep = NULL); - - - // generate a crash report from outside of wxApp::OnFatalException(), this - // can be used to take "snapshots" of the program in wxApp::OnAssert() for - // example - static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT); -}; - -#endif // wxUSE_CRASHREPORT - -#endif // _WX_MSW_CRASHRPT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/crashrpt.h +// Purpose: helpers for the structured exception handling (SEH) under Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.07.2003 +// RCS-ID: $Id: crashrpt.h 34436 2005-05-31 09:20:43Z JS $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CRASHRPT_H_ +#define _WX_MSW_CRASHRPT_H_ + +#include "wx/defs.h" + +#if wxUSE_CRASHREPORT + +struct _EXCEPTION_POINTERS; + +// ---------------------------------------------------------------------------- +// crash report generation flags +// ---------------------------------------------------------------------------- + +enum +{ + // we always report where the crash occurred + wxCRASH_REPORT_LOCATION = 0, + + // if this flag is given, the call stack is dumped + // + // this results in dump/crash report as small as possible, this is the + // default flag + wxCRASH_REPORT_STACK = 1, + + // if this flag is given, the values of the local variables are dumped + // + // note that with the current implementation it requires dumping the full + // process address space and so this will result in huge dump file and will + // take some time to generate + // + // it's probably not a good idea to use this by default, start with default + // mini dump and ask your users to set WX_CRASH_FLAGS environment variable + // to 2 or 4 if you need more information in the dump + wxCRASH_REPORT_LOCALS = 2, + + // if this flag is given, the values of all global variables are dumped + // + // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but + // still much smaller than wxCRASH_REPORT_LOCALS one + wxCRASH_REPORT_GLOBALS = 4, + + // default is to create the smallest possible crash report + wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK +}; + +// ---------------------------------------------------------------------------- +// wxCrashContext: information about the crash context +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxCrashContext +{ + // initialize this object with the given information or from the current + // global exception info which is only valid inside wxApp::OnFatalException + wxCrashContext(_EXCEPTION_POINTERS *ep = NULL); + + // get the name for this exception code + wxString GetExceptionString() const; + + + // exception code + size_t code; + + // exception address + void *addr; + + // machine-specific registers vaues + struct + { +#ifdef __INTEL__ + wxInt32 eax, ebx, ecx, edx, esi, edi, + ebp, esp, eip, + cs, ds, es, fs, gs, ss, + flags; +#endif // __INTEL__ + } regs; +}; + +// ---------------------------------------------------------------------------- +// wxCrashReport: this class is used to create crash reports +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxCrashReport +{ + // set the name of the file to which the report is written, it is + // constructed from the .exe name by default + static void SetFileName(const wxChar *filename); + + // return the current file name + static const wxChar *GetFileName(); + + // write the exception report to the file, return true if it could be done + // or false otherwise + // + // if ep pointer is NULL, the global exception info which is valid only + // inside wxApp::OnFatalException() is used + static bool Generate(int flags = wxCRASH_REPORT_DEFAULT, + _EXCEPTION_POINTERS *ep = NULL); + + + // generate a crash report from outside of wxApp::OnFatalException(), this + // can be used to take "snapshots" of the program in wxApp::OnAssert() for + // example + static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT); +}; + +#endif // wxUSE_CRASHREPORT + +#endif // _WX_MSW_CRASHRPT_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/cursor.h b/Externals/wxWidgets/include/wx/msw/cursor.h index 3cf280d435..81758202cd 100644 --- a/Externals/wxWidgets/include/wx/msw/cursor.h +++ b/Externals/wxWidgets/include/wx/msw/cursor.h @@ -1,47 +1,47 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/cursor.h -// Purpose: wxCursor class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: cursor.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CURSOR_H_ -#define _WX_CURSOR_H_ - -#include "wx/msw/gdiimage.h" - -class WXDLLIMPEXP_FWD_CORE wxImage; - -// Cursor -class WXDLLEXPORT wxCursor : public wxGDIImage -{ -public: - // constructors - wxCursor(); - wxCursor(const wxImage& image); - wxCursor(const char bits[], int width, int height, - int hotSpotX = -1, int hotSpotY = -1, - const char maskBits[] = NULL); - wxCursor(const wxString& name, - long flags = wxBITMAP_TYPE_CUR_RESOURCE, - int hotSpotX = 0, int hotSpotY = 0); - wxCursor(int idCursor); - virtual ~wxCursor(); - - // implementation only - void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); } - WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } - -protected: - virtual wxGDIImageRefData *CreateData() const; - -private: - DECLARE_DYNAMIC_CLASS(wxCursor) -}; - -#endif - // _WX_CURSOR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/cursor.h +// Purpose: wxCursor class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: cursor.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#include "wx/msw/gdiimage.h" + +class WXDLLIMPEXP_FWD_CORE wxImage; + +// Cursor +class WXDLLEXPORT wxCursor : public wxGDIImage +{ +public: + // constructors + wxCursor(); + wxCursor(const wxImage& image); + wxCursor(const char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL); + wxCursor(const wxString& name, + long flags = wxBITMAP_TYPE_CUR_RESOURCE, + int hotSpotX = 0, int hotSpotY = 0); + wxCursor(int idCursor); + virtual ~wxCursor(); + + // implementation only + void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); } + WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } + +protected: + virtual wxGDIImageRefData *CreateData() const; + +private: + DECLARE_DYNAMIC_CLASS(wxCursor) +}; + +#endif + // _WX_CURSOR_H_ diff --git a/Externals/wxWidgets/include/wx/msw/datectrl.h b/Externals/wxWidgets/include/wx/msw/datectrl.h index a814135b4a..18e17365d9 100644 --- a/Externals/wxWidgets/include/wx/msw/datectrl.h +++ b/Externals/wxWidgets/include/wx/msw/datectrl.h @@ -1,70 +1,70 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/datectrl.h -// Purpose: wxDatePickerCtrl for Windows -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-09 -// RCS-ID: $Id: datectrl.h 42207 2006-10-21 16:29:33Z VZ $ -// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DATECTRL_H_ -#define _WX_MSW_DATECTRL_H_ - -// ---------------------------------------------------------------------------- -// wxDatePickerCtrl -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase -{ -public: - // ctors - wxDatePickerCtrl() { } - - wxDatePickerCtrl(wxWindow *parent, - wxWindowID id, - const wxDateTime& dt = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDatePickerCtrlNameStr) - { - Create(parent, id, dt, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxDateTime& dt = wxDefaultDateTime, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxDatePickerCtrlNameStr); - - // set/get the date - virtual void SetValue(const wxDateTime& dt); - virtual wxDateTime GetValue() const; - - // set/get the allowed valid range for the dates, if either/both of them - // are invalid, there is no corresponding limit and if neither is set - // GetRange() returns false - virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2); - virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - -protected: - virtual wxSize DoGetBestSize() const; - - // the date currently shown by the control, may be invalid - wxDateTime m_date; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) -}; - -#endif // _WX_MSW_DATECTRL_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/datectrl.h +// Purpose: wxDatePickerCtrl for Windows +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-09 +// RCS-ID: $Id: datectrl.h 42207 2006-10-21 16:29:33Z VZ $ +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DATECTRL_H_ +#define _WX_MSW_DATECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase +{ +public: + // ctors + wxDatePickerCtrl() { } + + wxDatePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr); + + // set/get the date + virtual void SetValue(const wxDateTime& dt); + virtual wxDateTime GetValue() const; + + // set/get the allowed valid range for the dates, if either/both of them + // are invalid, there is no corresponding limit and if neither is set + // GetRange() returns false + virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2); + virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + +protected: + virtual wxSize DoGetBestSize() const; + + // the date currently shown by the control, may be invalid + wxDateTime m_date; + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) +}; + +#endif // _WX_MSW_DATECTRL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/dc.h b/Externals/wxWidgets/include/wx/msw/dc.h index 97b1444fcf..85736af1ac 100644 --- a/Externals/wxWidgets/include/wx/msw/dc.h +++ b/Externals/wxWidgets/include/wx/msw/dc.h @@ -1,345 +1,345 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dc.h -// Purpose: wxDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dc.h 42612 2006-10-29 10:46:49Z SC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DC_H_ -#define _WX_MSW_DC_H_ - -#include "wx/defs.h" - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -#if wxUSE_DC_CACHEING -/* - * Cached blitting, maintaining a cache - * of bitmaps required for transparent blitting - * instead of constant creation/deletion - */ - -class wxDCCacheEntry: public wxObject -{ -public: - wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth); - wxDCCacheEntry(WXHDC hDC, int depth); - virtual ~wxDCCacheEntry(); - - WXHBITMAP m_bitmap; - WXHDC m_dc; - int m_width; - int m_height; - int m_depth; -}; -#endif - -// this is an ABC: use one of the derived classes to create a DC associated -// with a window, screen, printer and so on -class WXDLLEXPORT wxDC : public wxDCBase -{ -public: - wxDC(WXHDC hDC) { Init(); m_hDC = hDC; } - virtual ~wxDC(); - - // implement base class pure virtuals - // ---------------------------------- - - virtual void Clear(); - - virtual bool StartDoc(const wxString& message); - virtual void EndDoc(); - - virtual void StartPage(); - virtual void EndPage(); - - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode); -#if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette); -#endif // wxUSE_PALETTE - - virtual void DestroyClippingRegion(); - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(int mode); - virtual void SetUserScale(double x, double y); - virtual void SetSystemScale(double x, double y); - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); - - // implementation from now on - // -------------------------- - - virtual void SetRop(WXHDC cdc); - virtual void SelectOldObjects(WXHDC dc); - - wxWindow *GetWindow() const { return m_canvas; } - void SetWindow(wxWindow *win) - { - m_canvas = win; - -#if wxUSE_PALETTE - // if we have palettes use the correct one for this window - InitializePalette(); -#endif // wxUSE_PALETTE - } - - WXHDC GetHDC() const { return m_hDC; } - void SetHDC(WXHDC dc, bool bOwnsDC = false) - { - m_hDC = dc; - m_bOwnsDC = bOwnsDC; - - // we might have a pre existing clipping region, make sure that we - // return it if asked -- but avoid calling ::GetClipBox() right now as - // it could be unnecessary wasteful - m_clipping = true; - m_clipX1 = - m_clipX2 = 0; - } - - const wxBitmap& GetSelectedBitmap() const { return m_selectedBitmap; } - wxBitmap& GetSelectedBitmap() { return m_selectedBitmap; } - - // update the internal clip box variables - void UpdateClipBox(); - -#if wxUSE_DC_CACHEING - static wxDCCacheEntry* FindBitmapInCache(WXHDC hDC, int w, int h); - static wxDCCacheEntry* FindDCInCache(wxDCCacheEntry* notThis, WXHDC hDC); - - static void AddToBitmapCache(wxDCCacheEntry* entry); - static void AddToDCCache(wxDCCacheEntry* entry); - static void ClearCache(); -#endif - - // RTL related functions - // --------------------- - - // get or change the layout direction (LTR or RTL) for this dc, - // wxLayout_Default is returned if layout direction is not supported - virtual wxLayoutDirection GetLayoutDirection() const; - virtual void SetLayoutDirection(wxLayoutDirection dir); - -protected: - void Init() - { - m_canvas = NULL; - m_bOwnsDC = false; - m_hDC = NULL; - - m_oldBitmap = NULL; - m_oldPen = NULL; - m_oldBrush = NULL; - m_oldFont = NULL; - -#if wxUSE_PALETTE - m_oldPalette = NULL; -#endif // wxUSE_PALETTE - } - - // create an uninitialized DC: this should be only used by the derived - // classes - wxDC() { Init(); } - - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE); - - virtual void DoGradientFillLinear(const wxRect& rect, - const wxColour& initialColour, - const wxColour& destColour, - wxDirection nDirection = wxEAST); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - - virtual void DoDrawPoint(wxCoord x, wxCoord y); - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif - - virtual void DoCrossHair(wxCoord x, wxCoord y); - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - - // this is gnarly - we can't even call this function DoSetClippingRegion() - // because of virtual function hiding - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, - wxCoord *w, wxCoord *h) const; - - virtual void DoGetSizeMM(int* width, int* height) const; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset); - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); - virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } - - -#if wxUSE_PALETTE - // MSW specific, select a logical palette into the HDC - // (tell windows to translate pixel from other palettes to our custom one - // and vice versa) - // Realize tells it to also reset the system palette to this one. - void DoSelectPalette(bool realize = false); - - // Find out what palette our parent window has, then select it into the dc - void InitializePalette(); -#endif // wxUSE_PALETTE - - // common part of DoDrawText() and DoDrawRotatedText() - void DrawAnyText(const wxString& text, wxCoord x, wxCoord y); - - // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() - void SetClippingHrgn(WXHRGN hrgn); - - // implementation of DoGetSize() for wxScreen/PrinterDC: this simply - // returns the size of the entire device this DC is associated with - // - // notice that we intentionally put it in a separate function instead of - // DoGetSize() itself because we want it to remain pure virtual both - // because each derived class should take care to define it as needed (this - // implementation is not at all always appropriate) and because we want - // wxDC to be an ABC to prevent it from being created directly - void GetDeviceSize(int *width, int *height) const; - - - // MSW-specific member variables - // ----------------------------- - - // the window associated with this DC (may be NULL) - wxWindow *m_canvas; - - wxBitmap m_selectedBitmap; - - // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it - bool m_bOwnsDC:1; - - // our HDC - WXHDC m_hDC; - - // Store all old GDI objects when do a SelectObject, so we can select them - // back in (this unselecting user's objects) so we can safely delete the - // DC. - WXHBITMAP m_oldBitmap; - WXHPEN m_oldPen; - WXHBRUSH m_oldBrush; - WXHFONT m_oldFont; - -#if wxUSE_PALETTE - WXHPALETTE m_oldPalette; -#endif // wxUSE_PALETTE - -#if wxUSE_DC_CACHEING - static wxList sm_bitmapCache; - static wxList sm_dcCache; -#endif - - DECLARE_DYNAMIC_CLASS(wxDC) - DECLARE_NO_COPY_CLASS(wxDC) -}; - -// ---------------------------------------------------------------------------- -// wxDCTemp: a wxDC which doesn't free the given HDC (used by wxWidgets -// only/mainly) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDCTemp : public wxDC -{ -public: - // construct a temporary DC with the specified HDC and size (it should be - // specified whenever we know it for this HDC) - wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize) - : wxDC(hdc), - m_size(size) - { - } - - virtual ~wxDCTemp() - { - // prevent base class dtor from freeing it - SetHDC((WXHDC)NULL); - } - -protected: - virtual void DoGetSize(int *w, int *h) const - { - wxASSERT_MSG( m_size.IsFullySpecified(), - _T("size of this DC hadn't been set and is unknown") ); - - if ( w ) - *w = m_size.x; - if ( h ) - *h = m_size.y; - } - -private: - // size of this DC must be explicitly set by SetSize() as we have no way to - // find it ourselves - const wxSize m_size; - - DECLARE_NO_COPY_CLASS(wxDCTemp) -}; - -#endif // _WX_MSW_DC_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dc.h +// Purpose: wxDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dc.h 42612 2006-10-29 10:46:49Z SC $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DC_H_ +#define _WX_MSW_DC_H_ + +#include "wx/defs.h" + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +#if wxUSE_DC_CACHEING +/* + * Cached blitting, maintaining a cache + * of bitmaps required for transparent blitting + * instead of constant creation/deletion + */ + +class wxDCCacheEntry: public wxObject +{ +public: + wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth); + wxDCCacheEntry(WXHDC hDC, int depth); + virtual ~wxDCCacheEntry(); + + WXHBITMAP m_bitmap; + WXHDC m_dc; + int m_width; + int m_height; + int m_depth; +}; +#endif + +// this is an ABC: use one of the derived classes to create a DC associated +// with a window, screen, printer and so on +class WXDLLEXPORT wxDC : public wxDCBase +{ +public: + wxDC(WXHDC hDC) { Init(); m_hDC = hDC; } + virtual ~wxDC(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual bool StartDoc(const wxString& message); + virtual void EndDoc(); + + virtual void StartPage(); + virtual void EndPage(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + virtual void DestroyClippingRegion(); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + + virtual bool CanDrawBitmap() const; + virtual bool CanGetTextExtent() const; + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void SetMapMode(int mode); + virtual void SetUserScale(double x, double y); + virtual void SetSystemScale(double x, double y); + virtual void SetLogicalScale(double x, double y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + virtual void SetLogicalFunction(int function); + + // implementation from now on + // -------------------------- + + virtual void SetRop(WXHDC cdc); + virtual void SelectOldObjects(WXHDC dc); + + wxWindow *GetWindow() const { return m_canvas; } + void SetWindow(wxWindow *win) + { + m_canvas = win; + +#if wxUSE_PALETTE + // if we have palettes use the correct one for this window + InitializePalette(); +#endif // wxUSE_PALETTE + } + + WXHDC GetHDC() const { return m_hDC; } + void SetHDC(WXHDC dc, bool bOwnsDC = false) + { + m_hDC = dc; + m_bOwnsDC = bOwnsDC; + + // we might have a pre existing clipping region, make sure that we + // return it if asked -- but avoid calling ::GetClipBox() right now as + // it could be unnecessary wasteful + m_clipping = true; + m_clipX1 = + m_clipX2 = 0; + } + + const wxBitmap& GetSelectedBitmap() const { return m_selectedBitmap; } + wxBitmap& GetSelectedBitmap() { return m_selectedBitmap; } + + // update the internal clip box variables + void UpdateClipBox(); + +#if wxUSE_DC_CACHEING + static wxDCCacheEntry* FindBitmapInCache(WXHDC hDC, int w, int h); + static wxDCCacheEntry* FindDCInCache(wxDCCacheEntry* notThis, WXHDC hDC); + + static void AddToBitmapCache(wxDCCacheEntry* entry); + static void AddToDCCache(wxDCCacheEntry* entry); + static void ClearCache(); +#endif + + // RTL related functions + // --------------------- + + // get or change the layout direction (LTR or RTL) for this dc, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const; + virtual void SetLayoutDirection(wxLayoutDirection dir); + +protected: + void Init() + { + m_canvas = NULL; + m_bOwnsDC = false; + m_hDC = NULL; + + m_oldBitmap = NULL; + m_oldPen = NULL; + m_oldBrush = NULL; + m_oldFont = NULL; + +#if wxUSE_PALETTE + m_oldPalette = NULL; +#endif // wxUSE_PALETTE + } + + // create an uninitialized DC: this should be only used by the derived + // classes + wxDC() { Init(); } + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE); + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + +#if wxUSE_SPLINES + virtual void DoDrawSpline(wxList *points); +#endif + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + + // this is gnarly - we can't even call this function DoSetClippingRegion() + // because of virtual function hiding + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) const; + + virtual void DoGetSizeMM(int* width, int* height) const; + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const + { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } + + +#if wxUSE_PALETTE + // MSW specific, select a logical palette into the HDC + // (tell windows to translate pixel from other palettes to our custom one + // and vice versa) + // Realize tells it to also reset the system palette to this one. + void DoSelectPalette(bool realize = false); + + // Find out what palette our parent window has, then select it into the dc + void InitializePalette(); +#endif // wxUSE_PALETTE + + // common part of DoDrawText() and DoDrawRotatedText() + void DrawAnyText(const wxString& text, wxCoord x, wxCoord y); + + // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() + void SetClippingHrgn(WXHRGN hrgn); + + // implementation of DoGetSize() for wxScreen/PrinterDC: this simply + // returns the size of the entire device this DC is associated with + // + // notice that we intentionally put it in a separate function instead of + // DoGetSize() itself because we want it to remain pure virtual both + // because each derived class should take care to define it as needed (this + // implementation is not at all always appropriate) and because we want + // wxDC to be an ABC to prevent it from being created directly + void GetDeviceSize(int *width, int *height) const; + + + // MSW-specific member variables + // ----------------------------- + + // the window associated with this DC (may be NULL) + wxWindow *m_canvas; + + wxBitmap m_selectedBitmap; + + // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it + bool m_bOwnsDC:1; + + // our HDC + WXHDC m_hDC; + + // Store all old GDI objects when do a SelectObject, so we can select them + // back in (this unselecting user's objects) so we can safely delete the + // DC. + WXHBITMAP m_oldBitmap; + WXHPEN m_oldPen; + WXHBRUSH m_oldBrush; + WXHFONT m_oldFont; + +#if wxUSE_PALETTE + WXHPALETTE m_oldPalette; +#endif // wxUSE_PALETTE + +#if wxUSE_DC_CACHEING + static wxList sm_bitmapCache; + static wxList sm_dcCache; +#endif + + DECLARE_DYNAMIC_CLASS(wxDC) + DECLARE_NO_COPY_CLASS(wxDC) +}; + +// ---------------------------------------------------------------------------- +// wxDCTemp: a wxDC which doesn't free the given HDC (used by wxWidgets +// only/mainly) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCTemp : public wxDC +{ +public: + // construct a temporary DC with the specified HDC and size (it should be + // specified whenever we know it for this HDC) + wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize) + : wxDC(hdc), + m_size(size) + { + } + + virtual ~wxDCTemp() + { + // prevent base class dtor from freeing it + SetHDC((WXHDC)NULL); + } + +protected: + virtual void DoGetSize(int *w, int *h) const + { + wxASSERT_MSG( m_size.IsFullySpecified(), + _T("size of this DC hadn't been set and is unknown") ); + + if ( w ) + *w = m_size.x; + if ( h ) + *h = m_size.y; + } + +private: + // size of this DC must be explicitly set by SetSize() as we have no way to + // find it ourselves + const wxSize m_size; + + DECLARE_NO_COPY_CLASS(wxDCTemp) +}; + +#endif // _WX_MSW_DC_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/dcclient.h b/Externals/wxWidgets/include/wx/msw/dcclient.h index e01171e3e4..19d7402808 100644 --- a/Externals/wxWidgets/include/wx/msw/dcclient.h +++ b/Externals/wxWidgets/include/wx/msw/dcclient.h @@ -1,118 +1,118 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dcclient.h -// Purpose: wxClientDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcclient.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCCLIENT_H_ -#define _WX_DCCLIENT_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/dc.h" -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// array types -// ---------------------------------------------------------------------------- - -// this one if used by wxPaintDC only -struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo; - -WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); - -// ---------------------------------------------------------------------------- -// DC classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowDC : public wxDC -{ -public: - // default ctor - wxWindowDC(); - - // Create a DC corresponding to the whole window - wxWindowDC(wxWindow *win); - -protected: - // initialize the newly created DC - void InitDC(); - - // override some base class virtuals - virtual void DoGetSize(int *width, int *height) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowDC) -}; - -class WXDLLEXPORT wxClientDC : public wxWindowDC -{ -public: - // default ctor - wxClientDC(); - - // Create a DC corresponding to the client area of the window - wxClientDC(wxWindow *win); - - virtual ~wxClientDC(); - -protected: - void InitDC(); - - // override some base class virtuals - virtual void DoGetSize(int *width, int *height) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxClientDC) -}; - -class WXDLLEXPORT wxPaintDC : public wxClientDC -{ -public: - wxPaintDC(); - - // Create a DC corresponding for painting the window in OnPaint() - wxPaintDC(wxWindow *win); - - virtual ~wxPaintDC(); - - // find the entry for this DC in the cache (keyed by the window) - static WXHDC FindDCInCache(wxWindow* win); - -protected: - static wxArrayDCInfo ms_cache; - - // find the entry for this DC in the cache (keyed by the window) - wxPaintDCInfo *FindInCache(size_t *index = NULL) const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC) -}; - -/* - * wxPaintDCEx - * This class is used when an application sends an HDC with the WM_PAINT - * message. It is used in HandlePaint and need not be used by an application. - */ - -class WXDLLEXPORT wxPaintDCEx : public wxPaintDC -{ -public: - wxPaintDCEx(wxWindow *canvas, WXHDC dc); - virtual ~wxPaintDCEx(); -private: - int saveState; - - DECLARE_CLASS(wxPaintDCEx) - DECLARE_NO_COPY_CLASS(wxPaintDCEx) -}; - -#endif - // _WX_DCCLIENT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: dcclient.h +// Purpose: wxClientDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dcclient.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/dc.h" +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// array types +// ---------------------------------------------------------------------------- + +// this one if used by wxPaintDC only +struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo; + +WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); + +// ---------------------------------------------------------------------------- +// DC classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowDC : public wxDC +{ +public: + // default ctor + wxWindowDC(); + + // Create a DC corresponding to the whole window + wxWindowDC(wxWindow *win); + +protected: + // initialize the newly created DC + void InitDC(); + + // override some base class virtuals + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowDC) +}; + +class WXDLLEXPORT wxClientDC : public wxWindowDC +{ +public: + // default ctor + wxClientDC(); + + // Create a DC corresponding to the client area of the window + wxClientDC(wxWindow *win); + + virtual ~wxClientDC(); + +protected: + void InitDC(); + + // override some base class virtuals + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxClientDC) +}; + +class WXDLLEXPORT wxPaintDC : public wxClientDC +{ +public: + wxPaintDC(); + + // Create a DC corresponding for painting the window in OnPaint() + wxPaintDC(wxWindow *win); + + virtual ~wxPaintDC(); + + // find the entry for this DC in the cache (keyed by the window) + static WXHDC FindDCInCache(wxWindow* win); + +protected: + static wxArrayDCInfo ms_cache; + + // find the entry for this DC in the cache (keyed by the window) + wxPaintDCInfo *FindInCache(size_t *index = NULL) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC) +}; + +/* + * wxPaintDCEx + * This class is used when an application sends an HDC with the WM_PAINT + * message. It is used in HandlePaint and need not be used by an application. + */ + +class WXDLLEXPORT wxPaintDCEx : public wxPaintDC +{ +public: + wxPaintDCEx(wxWindow *canvas, WXHDC dc); + virtual ~wxPaintDCEx(); +private: + int saveState; + + DECLARE_CLASS(wxPaintDCEx) + DECLARE_NO_COPY_CLASS(wxPaintDCEx) +}; + +#endif + // _WX_DCCLIENT_H_ diff --git a/Externals/wxWidgets/include/wx/msw/dcmemory.h b/Externals/wxWidgets/include/wx/msw/dcmemory.h index fced2bc4f5..7cb91de0f0 100644 --- a/Externals/wxWidgets/include/wx/msw/dcmemory.h +++ b/Externals/wxWidgets/include/wx/msw/dcmemory.h @@ -1,45 +1,45 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcmemory.h -// Purpose: wxMemoryDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcmemory.h 48236 2007-08-20 23:43:32Z KO $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DCMEMORY_H_ -#define _WX_DCMEMORY_H_ - -#include "wx/dcclient.h" - -class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase -{ -public: - wxMemoryDC() { CreateCompatible(NULL); Init(); } - wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); } - wxMemoryDC(wxDC *dc); // Create compatible DC - - -protected: - // override some base class virtuals - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoGetSize(int* width, int* height) const; - virtual void DoSelect(const wxBitmap& bitmap); - - virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} - - // create DC compatible with the given one or screen if dc == NULL - bool CreateCompatible(wxDC *dc); - - // initialize the newly created DC - void Init(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC) -}; - -#endif - // _WX_DCMEMORY_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcmemory.h +// Purpose: wxMemoryDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dcmemory.h 48236 2007-08-20 23:43:32Z KO $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#include "wx/dcclient.h" + +class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase +{ +public: + wxMemoryDC() { CreateCompatible(NULL); Init(); } + wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); } + wxMemoryDC(wxDC *dc); // Create compatible DC + + +protected: + // override some base class virtuals + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoGetSize(int* width, int* height) const; + virtual void DoSelect(const wxBitmap& bitmap); + + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const + { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} + + // create DC compatible with the given one or screen if dc == NULL + bool CreateCompatible(wxDC *dc); + + // initialize the newly created DC + void Init(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC) +}; + +#endif + // _WX_DCMEMORY_H_ diff --git a/Externals/wxWidgets/include/wx/msw/dcprint.h b/Externals/wxWidgets/include/wx/msw/dcprint.h index 948b52e454..040a26383a 100644 --- a/Externals/wxWidgets/include/wx/msw/dcprint.h +++ b/Externals/wxWidgets/include/wx/msw/dcprint.h @@ -1,70 +1,70 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcprint.h -// Purpose: wxPrinterDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcprint.h 42522 2006-10-27 13:07:40Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DCPRINT_H_ -#define _WX_MSW_DCPRINT_H_ - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/dc.h" -#include "wx/cmndata.h" - -class WXDLLEXPORT wxPrinterDC : public wxDC -{ -public: - // Create a printer DC (obsolete function: use wxPrintData version now) - wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, int orientation = wxPORTRAIT); - - // Create from print data - wxPrinterDC(const wxPrintData& data); - - wxPrinterDC(WXHDC theDC); - - // override some base class virtuals - virtual bool StartDoc(const wxString& message); - virtual void EndDoc(); - virtual void StartPage(); - virtual void EndPage(); - - wxRect GetPaperRect(); - -protected: - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - virtual void DoGetSize(int *w, int *h) const - { - GetDeviceSize(w, h); - } - - - // init the dc - void Init(); - - wxPrintData m_printData; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPrinterDC) -}; - -// Gets an HDC for the default printer configuration -// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation); - -// Gets an HDC for the specified printer configuration -WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif // _WX_MSW_DCPRINT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcprint.h +// Purpose: wxPrinterDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dcprint.h 42522 2006-10-27 13:07:40Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DCPRINT_H_ +#define _WX_MSW_DCPRINT_H_ + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dc.h" +#include "wx/cmndata.h" + +class WXDLLEXPORT wxPrinterDC : public wxDC +{ +public: + // Create a printer DC (obsolete function: use wxPrintData version now) + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, int orientation = wxPORTRAIT); + + // Create from print data + wxPrinterDC(const wxPrintData& data); + + wxPrinterDC(WXHDC theDC); + + // override some base class virtuals + virtual bool StartDoc(const wxString& message); + virtual void EndDoc(); + virtual void StartPage(); + virtual void EndPage(); + + wxRect GetPaperRect(); + +protected: + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false); + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + virtual void DoGetSize(int *w, int *h) const + { + GetDeviceSize(w, h); + } + + + // init the dc + void Init(); + + wxPrintData m_printData; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPrinterDC) +}; + +// Gets an HDC for the default printer configuration +// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation); + +// Gets an HDC for the specified printer configuration +WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_MSW_DCPRINT_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/dcscreen.h b/Externals/wxWidgets/include/wx/msw/dcscreen.h index 89c83ae7f9..4a72f92c06 100644 --- a/Externals/wxWidgets/include/wx/msw/dcscreen.h +++ b/Externals/wxWidgets/include/wx/msw/dcscreen.h @@ -1,40 +1,40 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dcscreen.h -// Purpose: wxScreenDC class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dcscreen.h 36565 2005-12-25 12:52:53Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DCSCREEN_H_ -#define _WX_MSW_DCSCREEN_H_ - -#include "wx/dc.h" - -class WXDLLEXPORT wxScreenDC : public wxDC -{ -public: - // Create a DC representing the whole screen - wxScreenDC(); - - // Compatibility with X's requirements for drawing on top of all windows: - // they don't do anything under MSW - static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; } - static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; } - static bool EndDrawingOnTop() { return true; } - -protected: - virtual void DoGetSize(int *w, int *h) const - { - GetDeviceSize(w, h); - } - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC) -}; - -#endif // _WX_MSW_DCSCREEN_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcscreen.h +// Purpose: wxScreenDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dcscreen.h 36565 2005-12-25 12:52:53Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DCSCREEN_H_ +#define _WX_MSW_DCSCREEN_H_ + +#include "wx/dc.h" + +class WXDLLEXPORT wxScreenDC : public wxDC +{ +public: + // Create a DC representing the whole screen + wxScreenDC(); + + // Compatibility with X's requirements for drawing on top of all windows: + // they don't do anything under MSW + static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; } + static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; } + static bool EndDrawingOnTop() { return true; } + +protected: + virtual void DoGetSize(int *w, int *h) const + { + GetDeviceSize(w, h); + } + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC) +}; + +#endif // _WX_MSW_DCSCREEN_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/dde.h b/Externals/wxWidgets/include/wx/msw/dde.h index fe8f23c2ff..3be1625c79 100644 --- a/Externals/wxWidgets/include/wx/msw/dde.h +++ b/Externals/wxWidgets/include/wx/msw/dde.h @@ -1,144 +1,144 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dde.h -// Purpose: DDE class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DDE_H_ -#define _WX_DDE_H_ - -#include "wx/ipcbase.h" - -/* - * Mini-DDE implementation - - Most transactions involve a topic name and an item name (choose these - as befits your application). - - A client can: - - - ask the server to execute commands (data) associated with a topic - - request data from server by topic and item - - poke data into the server - - ask the server to start an advice loop on topic/item - - ask the server to stop an advice loop - - A server can: - - - respond to execute, request, poke and advice start/stop - - send advise data to client - - Note that this limits the server in the ways it can send data to the - client, i.e. it can't send unsolicited information. - * - */ - -class WXDLLIMPEXP_FWD_BASE wxDDEServer; -class WXDLLIMPEXP_FWD_BASE wxDDEClient; - -class WXDLLIMPEXP_BASE wxDDEConnection: public wxConnectionBase -{ - DECLARE_DYNAMIC_CLASS(wxDDEConnection) -public: - wxDDEConnection(wxChar *buffer, int size); // use external buffer - wxDDEConnection(); // use internal buffer - virtual ~wxDDEConnection(void); - - // Calls that CLIENT can make - virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } - virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); - virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - virtual bool StartAdvise(const wxString& item); - virtual bool StopAdvise(const wxString& item); - - // Calls that SERVER can make - virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - - // Calls that both can make - virtual bool Disconnect(void); - - // Default behaviour is to delete connection and return true - virtual bool OnDisconnect(void); - - public: - wxString m_topicName; - wxDDEServer* m_server; - wxDDEClient* m_client; - - WXHCONV m_hConv; - wxChar* m_sendingData; - int m_dataSize; - wxIPCFormat m_dataType; - - DECLARE_NO_COPY_CLASS(wxDDEConnection) -}; - -class WXDLLIMPEXP_BASE wxDDEServer: public wxServerBase -{ - DECLARE_DYNAMIC_CLASS(wxDDEServer) - public: - - wxDDEServer(void); - virtual ~wxDDEServer(void); - bool Create(const wxString& server_name); // Returns false if can't create server (e.g. port - // number is already in use) - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); - - //////////////////////////////////////////////////////////// - // Implementation - - // Find/delete wxDDEConnection corresponding to the HCONV - wxDDEConnection *FindConnection(WXHCONV conv); - bool DeleteConnection(WXHCONV conv); - inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; } - inline wxDDEConnectionList& GetConnections(void) const - { - return (wxDDEConnectionList&) m_connections; - } - -protected: - int m_lastError; - wxString m_serviceName; - wxDDEConnectionList m_connections; -}; - -class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase -{ - DECLARE_DYNAMIC_CLASS(wxDDEClient) - public: - wxDDEClient(void); - virtual ~wxDDEClient(void); - bool ValidHost(const wxString& host); - virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic); - // Call this to make a connection. - // Returns NULL if cannot. - virtual wxConnectionBase *OnMakeConnection(void); // Tailor this to return own connection. - - //////////////////////////////////////////////////////////// - // Implementation - - // Find/delete wxDDEConnection corresponding to the HCONV - wxDDEConnection *FindConnection(WXHCONV conv); - bool DeleteConnection(WXHCONV conv); - - inline wxDDEConnectionList& GetConnections(void) const - { - return (wxDDEConnectionList&) m_connections; - } - -protected: - int m_lastError; - wxDDEConnectionList m_connections; -}; - -void WXDLLIMPEXP_BASE wxDDEInitialize(); -void WXDLLIMPEXP_BASE wxDDECleanUp(); - -#endif - // _WX_DDE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: dde.h +// Purpose: DDE class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dde.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DDE_H_ +#define _WX_DDE_H_ + +#include "wx/ipcbase.h" + +/* + * Mini-DDE implementation + + Most transactions involve a topic name and an item name (choose these + as befits your application). + + A client can: + + - ask the server to execute commands (data) associated with a topic + - request data from server by topic and item + - poke data into the server + - ask the server to start an advice loop on topic/item + - ask the server to stop an advice loop + + A server can: + + - respond to execute, request, poke and advice start/stop + - send advise data to client + + Note that this limits the server in the ways it can send data to the + client, i.e. it can't send unsolicited information. + * + */ + +class WXDLLIMPEXP_FWD_BASE wxDDEServer; +class WXDLLIMPEXP_FWD_BASE wxDDEClient; + +class WXDLLIMPEXP_BASE wxDDEConnection: public wxConnectionBase +{ + DECLARE_DYNAMIC_CLASS(wxDDEConnection) +public: + wxDDEConnection(wxChar *buffer, int size); // use external buffer + wxDDEConnection(); // use internal buffer + virtual ~wxDDEConnection(void); + + // Calls that CLIENT can make + virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); } + virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); + virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + virtual bool StartAdvise(const wxString& item); + virtual bool StopAdvise(const wxString& item); + + // Calls that SERVER can make + virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + + // Calls that both can make + virtual bool Disconnect(void); + + // Default behaviour is to delete connection and return true + virtual bool OnDisconnect(void); + + public: + wxString m_topicName; + wxDDEServer* m_server; + wxDDEClient* m_client; + + WXHCONV m_hConv; + wxChar* m_sendingData; + int m_dataSize; + wxIPCFormat m_dataType; + + DECLARE_NO_COPY_CLASS(wxDDEConnection) +}; + +class WXDLLIMPEXP_BASE wxDDEServer: public wxServerBase +{ + DECLARE_DYNAMIC_CLASS(wxDDEServer) + public: + + wxDDEServer(void); + virtual ~wxDDEServer(void); + bool Create(const wxString& server_name); // Returns false if can't create server (e.g. port + // number is already in use) + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); + + //////////////////////////////////////////////////////////// + // Implementation + + // Find/delete wxDDEConnection corresponding to the HCONV + wxDDEConnection *FindConnection(WXHCONV conv); + bool DeleteConnection(WXHCONV conv); + inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; } + inline wxDDEConnectionList& GetConnections(void) const + { + return (wxDDEConnectionList&) m_connections; + } + +protected: + int m_lastError; + wxString m_serviceName; + wxDDEConnectionList m_connections; +}; + +class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase +{ + DECLARE_DYNAMIC_CLASS(wxDDEClient) + public: + wxDDEClient(void); + virtual ~wxDDEClient(void); + bool ValidHost(const wxString& host); + virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic); + // Call this to make a connection. + // Returns NULL if cannot. + virtual wxConnectionBase *OnMakeConnection(void); // Tailor this to return own connection. + + //////////////////////////////////////////////////////////// + // Implementation + + // Find/delete wxDDEConnection corresponding to the HCONV + wxDDEConnection *FindConnection(WXHCONV conv); + bool DeleteConnection(WXHCONV conv); + + inline wxDDEConnectionList& GetConnections(void) const + { + return (wxDDEConnectionList&) m_connections; + } + +protected: + int m_lastError; + wxDDEConnectionList m_connections; +}; + +void WXDLLIMPEXP_BASE wxDDEInitialize(); +void WXDLLIMPEXP_BASE wxDDECleanUp(); + +#endif + // _WX_DDE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/debughlp.h b/Externals/wxWidgets/include/wx/msw/debughlp.h index 65ca85d82c..0728c44f21 100644 --- a/Externals/wxWidgets/include/wx/msw/debughlp.h +++ b/Externals/wxWidgets/include/wx/msw/debughlp.h @@ -1,228 +1,228 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapdbgh.h -// Purpose: wraps dbghelp.h standard file -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-08 (extracted from msw/crashrpt.cpp) -// RCS-ID: $Id: debughlp.h 31443 2005-01-18 10:10:23Z ABX $ -// Copyright: (c) 2003-2005 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DEBUGHLPH_H_ -#define _WX_MSW_DEBUGHLPH_H_ - -#include "wx/dynlib.h" - -#include "wx/msw/wrapwin.h" -#ifndef __WXWINCE__ -#include <imagehlp.h> -#endif // __WXWINCE__ -#include "wx/msw/private.h" - -// we need to determine whether we have the declarations for the function in -// debughlp.dll version 5.81 (at least) and we check for DBHLPAPI to test this -// -// reasons: -// - VC6 version of imagehlp.h doesn't define it -// - VC7 one does -// - testing for compiler version doesn't work as you can install and use -// the new SDK headers with VC6 -// -// in any case, the user may override by defining wxUSE_DBGHELP himself -#ifndef wxUSE_DBGHELP - #ifdef DBHLPAPI - #define wxUSE_DBGHELP 1 - #else - #define wxUSE_DBGHELP 0 - #endif -#endif - -#if wxUSE_DBGHELP - -// ---------------------------------------------------------------------------- -// wxDbgHelpDLL: dynamically load dbghelp.dll functions -// ---------------------------------------------------------------------------- - -// wrapper for some functions from dbghelp.dll -// -// MT note: this class is not MT safe and should be only used from a single -// thread at a time (this is so because dbghelp.dll is not MT-safe -// itself anyhow) -class wxDbgHelpDLL -{ -public: - // some useful constants not present in debughlp.h (stolen from DIA SDK) - enum BasicType - { - BASICTYPE_NOTYPE = 0, - BASICTYPE_VOID = 1, - BASICTYPE_CHAR = 2, - BASICTYPE_WCHAR = 3, - BASICTYPE_INT = 6, - BASICTYPE_UINT = 7, - BASICTYPE_FLOAT = 8, - BASICTYPE_BCD = 9, - BASICTYPE_BOOL = 10, - BASICTYPE_LONG = 13, - BASICTYPE_ULONG = 14, - BASICTYPE_CURRENCY = 25, - BASICTYPE_DATE = 26, - BASICTYPE_VARIANT = 27, - BASICTYPE_COMPLEX = 28, - BASICTYPE_BIT = 29, - BASICTYPE_BSTR = 30, - BASICTYPE_HRESULT = 31, - BASICTYPE_MAX - }; - - enum SymbolTag - { - SYMBOL_TAG_NULL, - SYMBOL_TAG_EXE, - SYMBOL_TAG_COMPILAND, - SYMBOL_TAG_COMPILAND_DETAILS, - SYMBOL_TAG_COMPILAND_ENV, - SYMBOL_TAG_FUNCTION, - SYMBOL_TAG_BLOCK, - SYMBOL_TAG_DATA, - SYMBOL_TAG_ANNOTATION, - SYMBOL_TAG_LABEL, - SYMBOL_TAG_PUBLIC_SYMBOL, - SYMBOL_TAG_UDT, - SYMBOL_TAG_ENUM, - SYMBOL_TAG_FUNCTION_TYPE, - SYMBOL_TAG_POINTER_TYPE, - SYMBOL_TAG_ARRAY_TYPE, - SYMBOL_TAG_BASE_TYPE, - SYMBOL_TAG_TYPEDEF, - SYMBOL_TAG_BASE_CLASS, - SYMBOL_TAG_FRIEND, - SYMBOL_TAG_FUNCTION_ARG_TYPE, - SYMBOL_TAG_FUNC_DEBUG_START, - SYMBOL_TAG_FUNC_DEBUG_END, - SYMBOL_TAG_USING_NAMESPACE, - SYMBOL_TAG_VTABLE_SHAPE, - SYMBOL_TAG_VTABLE, - SYMBOL_TAG_CUSTOM, - SYMBOL_TAG_THUNK, - SYMBOL_TAG_CUSTOM_TYPE, - SYMBOL_TAG_MANAGED_TYPE, - SYMBOL_TAG_DIMENSION, - SYMBOL_TAG_MAX - }; - - enum DataKind - { - DATA_UNKNOWN, - DATA_LOCAL, - DATA_STATIC_LOCAL, - DATA_PARAM, - DATA_OBJECT_PTR, // "this" pointer - DATA_FILE_STATIC, - DATA_GLOBAL, - DATA_MEMBER, - DATA_STATIC_MEMBER, - DATA_CONSTANT, - DATA_MAX - }; - - enum UdtKind - { - UDT_STRUCT, - UDT_CLASS, - UDT_UNION, - UDT_MAX - }; - - - // function types - typedef DWORD (WINAPI *SymGetOptions_t)(); - typedef DWORD (WINAPI *SymSetOptions_t)(DWORD); - typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPSTR, BOOL); - typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, - LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, - PFUNCTION_TABLE_ACCESS_ROUTINE, - PGET_MODULE_BASE_ROUTINE, - PTRANSLATE_ADDRESS_ROUTINE); - typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); - typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD); - typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD); - typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, - PDWORD, PIMAGEHLP_LINE); - typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, - PIMAGEHLP_CONTEXT); - typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR, - PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); - typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG, - IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); - typedef BOOL (WINAPI *SymCleanup_t)(HANDLE); - typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID); - typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE, - MINIDUMP_TYPE, - CONST PMINIDUMP_EXCEPTION_INFORMATION, - CONST PMINIDUMP_USER_STREAM_INFORMATION, - CONST PMINIDUMP_CALLBACK_INFORMATION); - - #define wxDO_FOR_ALL_SYM_FUNCS(what) \ - what(SymGetOptions); \ - what(SymSetOptions); \ - what(SymInitialize); \ - what(StackWalk); \ - what(SymFromAddr); \ - what(SymFunctionTableAccess); \ - what(SymGetModuleBase); \ - what(SymGetLineFromAddr); \ - what(SymSetContext); \ - what(SymEnumSymbols); \ - what(SymGetTypeInfo); \ - what(SymCleanup); \ - what(EnumerateLoadedModules); \ - what(MiniDumpWriteDump) - - #define wxDECLARE_SYM_FUNCTION(func) static func ## _t func - - wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION); - - #undef wxDECLARE_SYM_FUNCTION - - // load all functions from DLL, return true if ok - static bool Init(); - - // return the string with the error message explaining why Init() failed - static const wxString& GetErrorMessage(); - - // log error returned by the given function to debug output - static void LogError(const wxChar *func); - - // return textual representation of the value of given symbol - static wxString DumpSymbol(PSYMBOL_INFO pSymInfo, void *pVariable); - - // return the name of the symbol with given type index - static wxString GetSymbolName(PSYMBOL_INFO pSymInfo); - -private: - // dereference the given symbol, i.e. return symbol which is not a - // pointer/reference any more - // - // if ppData != NULL, dereference the pointer as many times as we - // dereferenced the symbol - // - // return the tag of the dereferenced symbol - static SymbolTag DereferenceSymbol(PSYMBOL_INFO pSymInfo, void **ppData); - - static wxString DumpField(PSYMBOL_INFO pSymInfo, - void *pVariable, - unsigned level); - - static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable); - - static wxString DumpUDT(PSYMBOL_INFO pSymInfo, - void *pVariable, - unsigned level = 0); -}; - -#endif // wxUSE_DBGHELP - -#endif // _WX_MSW_DEBUGHLPH_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapdbgh.h +// Purpose: wraps dbghelp.h standard file +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-08 (extracted from msw/crashrpt.cpp) +// RCS-ID: $Id: debughlp.h 31443 2005-01-18 10:10:23Z ABX $ +// Copyright: (c) 2003-2005 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DEBUGHLPH_H_ +#define _WX_MSW_DEBUGHLPH_H_ + +#include "wx/dynlib.h" + +#include "wx/msw/wrapwin.h" +#ifndef __WXWINCE__ +#include <imagehlp.h> +#endif // __WXWINCE__ +#include "wx/msw/private.h" + +// we need to determine whether we have the declarations for the function in +// debughlp.dll version 5.81 (at least) and we check for DBHLPAPI to test this +// +// reasons: +// - VC6 version of imagehlp.h doesn't define it +// - VC7 one does +// - testing for compiler version doesn't work as you can install and use +// the new SDK headers with VC6 +// +// in any case, the user may override by defining wxUSE_DBGHELP himself +#ifndef wxUSE_DBGHELP + #ifdef DBHLPAPI + #define wxUSE_DBGHELP 1 + #else + #define wxUSE_DBGHELP 0 + #endif +#endif + +#if wxUSE_DBGHELP + +// ---------------------------------------------------------------------------- +// wxDbgHelpDLL: dynamically load dbghelp.dll functions +// ---------------------------------------------------------------------------- + +// wrapper for some functions from dbghelp.dll +// +// MT note: this class is not MT safe and should be only used from a single +// thread at a time (this is so because dbghelp.dll is not MT-safe +// itself anyhow) +class wxDbgHelpDLL +{ +public: + // some useful constants not present in debughlp.h (stolen from DIA SDK) + enum BasicType + { + BASICTYPE_NOTYPE = 0, + BASICTYPE_VOID = 1, + BASICTYPE_CHAR = 2, + BASICTYPE_WCHAR = 3, + BASICTYPE_INT = 6, + BASICTYPE_UINT = 7, + BASICTYPE_FLOAT = 8, + BASICTYPE_BCD = 9, + BASICTYPE_BOOL = 10, + BASICTYPE_LONG = 13, + BASICTYPE_ULONG = 14, + BASICTYPE_CURRENCY = 25, + BASICTYPE_DATE = 26, + BASICTYPE_VARIANT = 27, + BASICTYPE_COMPLEX = 28, + BASICTYPE_BIT = 29, + BASICTYPE_BSTR = 30, + BASICTYPE_HRESULT = 31, + BASICTYPE_MAX + }; + + enum SymbolTag + { + SYMBOL_TAG_NULL, + SYMBOL_TAG_EXE, + SYMBOL_TAG_COMPILAND, + SYMBOL_TAG_COMPILAND_DETAILS, + SYMBOL_TAG_COMPILAND_ENV, + SYMBOL_TAG_FUNCTION, + SYMBOL_TAG_BLOCK, + SYMBOL_TAG_DATA, + SYMBOL_TAG_ANNOTATION, + SYMBOL_TAG_LABEL, + SYMBOL_TAG_PUBLIC_SYMBOL, + SYMBOL_TAG_UDT, + SYMBOL_TAG_ENUM, + SYMBOL_TAG_FUNCTION_TYPE, + SYMBOL_TAG_POINTER_TYPE, + SYMBOL_TAG_ARRAY_TYPE, + SYMBOL_TAG_BASE_TYPE, + SYMBOL_TAG_TYPEDEF, + SYMBOL_TAG_BASE_CLASS, + SYMBOL_TAG_FRIEND, + SYMBOL_TAG_FUNCTION_ARG_TYPE, + SYMBOL_TAG_FUNC_DEBUG_START, + SYMBOL_TAG_FUNC_DEBUG_END, + SYMBOL_TAG_USING_NAMESPACE, + SYMBOL_TAG_VTABLE_SHAPE, + SYMBOL_TAG_VTABLE, + SYMBOL_TAG_CUSTOM, + SYMBOL_TAG_THUNK, + SYMBOL_TAG_CUSTOM_TYPE, + SYMBOL_TAG_MANAGED_TYPE, + SYMBOL_TAG_DIMENSION, + SYMBOL_TAG_MAX + }; + + enum DataKind + { + DATA_UNKNOWN, + DATA_LOCAL, + DATA_STATIC_LOCAL, + DATA_PARAM, + DATA_OBJECT_PTR, // "this" pointer + DATA_FILE_STATIC, + DATA_GLOBAL, + DATA_MEMBER, + DATA_STATIC_MEMBER, + DATA_CONSTANT, + DATA_MAX + }; + + enum UdtKind + { + UDT_STRUCT, + UDT_CLASS, + UDT_UNION, + UDT_MAX + }; + + + // function types + typedef DWORD (WINAPI *SymGetOptions_t)(); + typedef DWORD (WINAPI *SymSetOptions_t)(DWORD); + typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPSTR, BOOL); + typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, + LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, + PFUNCTION_TABLE_ACCESS_ROUTINE, + PGET_MODULE_BASE_ROUTINE, + PTRANSLATE_ADDRESS_ROUTINE); + typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); + typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD); + typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD); + typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, + PDWORD, PIMAGEHLP_LINE); + typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, + PIMAGEHLP_CONTEXT); + typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR, + PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); + typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG, + IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); + typedef BOOL (WINAPI *SymCleanup_t)(HANDLE); + typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID); + typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE, + MINIDUMP_TYPE, + CONST PMINIDUMP_EXCEPTION_INFORMATION, + CONST PMINIDUMP_USER_STREAM_INFORMATION, + CONST PMINIDUMP_CALLBACK_INFORMATION); + + #define wxDO_FOR_ALL_SYM_FUNCS(what) \ + what(SymGetOptions); \ + what(SymSetOptions); \ + what(SymInitialize); \ + what(StackWalk); \ + what(SymFromAddr); \ + what(SymFunctionTableAccess); \ + what(SymGetModuleBase); \ + what(SymGetLineFromAddr); \ + what(SymSetContext); \ + what(SymEnumSymbols); \ + what(SymGetTypeInfo); \ + what(SymCleanup); \ + what(EnumerateLoadedModules); \ + what(MiniDumpWriteDump) + + #define wxDECLARE_SYM_FUNCTION(func) static func ## _t func + + wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION); + + #undef wxDECLARE_SYM_FUNCTION + + // load all functions from DLL, return true if ok + static bool Init(); + + // return the string with the error message explaining why Init() failed + static const wxString& GetErrorMessage(); + + // log error returned by the given function to debug output + static void LogError(const wxChar *func); + + // return textual representation of the value of given symbol + static wxString DumpSymbol(PSYMBOL_INFO pSymInfo, void *pVariable); + + // return the name of the symbol with given type index + static wxString GetSymbolName(PSYMBOL_INFO pSymInfo); + +private: + // dereference the given symbol, i.e. return symbol which is not a + // pointer/reference any more + // + // if ppData != NULL, dereference the pointer as many times as we + // dereferenced the symbol + // + // return the tag of the dereferenced symbol + static SymbolTag DereferenceSymbol(PSYMBOL_INFO pSymInfo, void **ppData); + + static wxString DumpField(PSYMBOL_INFO pSymInfo, + void *pVariable, + unsigned level); + + static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable); + + static wxString DumpUDT(PSYMBOL_INFO pSymInfo, + void *pVariable, + unsigned level = 0); +}; + +#endif // wxUSE_DBGHELP + +#endif // _WX_MSW_DEBUGHLPH_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/dialog.h b/Externals/wxWidgets/include/wx/msw/dialog.h index 15f8ba10f0..79a1240666 100644 --- a/Externals/wxWidgets/include/wx/msw/dialog.h +++ b/Externals/wxWidgets/include/wx/msw/dialog.h @@ -1,140 +1,140 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dialog.h -// Purpose: wxDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dialog.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIALOG_H_ -#define _WX_DIALOG_H_ - -#include "wx/panel.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxDialogModalData; - -#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) -class WXDLLIMPEXP_FWD_CORE wxToolBar; -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; -#endif - -// Dialog boxes -class WXDLLEXPORT wxDialog : public wxDialogBase -{ -public: - wxDialog() { Init(); } - - // full ctor - wxDialog(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - - virtual ~wxDialog(); - - // return true if we're showing the dialog modally - virtual bool IsModal() const { return m_modalData != NULL; } - - // show the dialog modally and return the value passed to EndModal() - virtual int ShowModal(); - - // may be called to terminate the dialog with the given return code - virtual void EndModal(int retCode); - - - // we treat dialog toolbars specially under Windows CE -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - // create main toolbar by calling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = wxID_ANY, - const wxString& name = wxToolBarNameStr); - // return a new toolbar - virtual wxToolBar *OnCreateToolBar(long style, - wxWindowID winid, - const wxString& name ); - - // get the main toolbar - wxToolBar *GetToolBar() const { return m_dialogToolBar; } -#endif // wxUSE_TOOLBAR && __POCKETPC__ - - - // implementation only from now on - // ------------------------------- - - // override some base class virtuals - virtual bool Show(bool show = true); - - virtual void Raise(); - -#ifdef __POCKETPC__ - // Responds to the OK button in a PocketPC titlebar. This - // can be overridden, or you can change the id used for - // sending the event with SetAffirmativeId. Returns false - // if the event was not processed. - virtual bool DoOK(); -#endif - - // Windows callbacks - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - -#if WXWIN_COMPATIBILITY_2_6 - // use the other ctor - wxDEPRECATED( wxDialog(wxWindow *parent, - const wxString& title, bool modal, - int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) ); - - // just call Show() or ShowModal() - wxDEPRECATED( void SetModal(bool flag) ); - - // use IsModal() - wxDEPRECATED( bool IsModalShowing() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - // find the window to use as parent for this dialog if none has been - // specified explicitly by the user - // - // may return NULL - wxWindow *FindSuitableParent() const; - - // common part of all ctors - void Init(); - -private: - wxWindow* m_oldFocus; - bool m_endModalCalled; // allow for closing within InitDialog - -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - wxToolBar* m_dialogToolBar; -#endif - - // this pointer is non-NULL only while the modal event loop is running - wxDialogModalData *m_modalData; - - DECLARE_DYNAMIC_CLASS(wxDialog) - DECLARE_NO_COPY_CLASS(wxDialog) -}; - -#endif - // _WX_DIALOG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dialog.h +// Purpose: wxDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dialog.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_ +#define _WX_DIALOG_H_ + +#include "wx/panel.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxDialogModalData; + +#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) +class WXDLLIMPEXP_FWD_CORE wxToolBar; +extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; +#endif + +// Dialog boxes +class WXDLLEXPORT wxDialog : public wxDialogBase +{ +public: + wxDialog() { Init(); } + + // full ctor + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + + virtual ~wxDialog(); + + // return true if we're showing the dialog modally + virtual bool IsModal() const { return m_modalData != NULL; } + + // show the dialog modally and return the value passed to EndModal() + virtual int ShowModal(); + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode); + + + // we treat dialog toolbars specially under Windows CE +#if wxUSE_TOOLBAR && defined(__POCKETPC__) + // create main toolbar by calling OnCreateToolBar() + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID winid = wxID_ANY, + const wxString& name = wxToolBarNameStr); + // return a new toolbar + virtual wxToolBar *OnCreateToolBar(long style, + wxWindowID winid, + const wxString& name ); + + // get the main toolbar + wxToolBar *GetToolBar() const { return m_dialogToolBar; } +#endif // wxUSE_TOOLBAR && __POCKETPC__ + + + // implementation only from now on + // ------------------------------- + + // override some base class virtuals + virtual bool Show(bool show = true); + + virtual void Raise(); + +#ifdef __POCKETPC__ + // Responds to the OK button in a PocketPC titlebar. This + // can be overridden, or you can change the id used for + // sending the event with SetAffirmativeId. Returns false + // if the event was not processed. + virtual bool DoOK(); +#endif + + // Windows callbacks + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +#if WXWIN_COMPATIBILITY_2_6 + // use the other ctor + wxDEPRECATED( wxDialog(wxWindow *parent, + const wxString& title, bool modal, + int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) ); + + // just call Show() or ShowModal() + wxDEPRECATED( void SetModal(bool flag) ); + + // use IsModal() + wxDEPRECATED( bool IsModalShowing() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + // find the window to use as parent for this dialog if none has been + // specified explicitly by the user + // + // may return NULL + wxWindow *FindSuitableParent() const; + + // common part of all ctors + void Init(); + +private: + wxWindow* m_oldFocus; + bool m_endModalCalled; // allow for closing within InitDialog + +#if wxUSE_TOOLBAR && defined(__POCKETPC__) + wxToolBar* m_dialogToolBar; +#endif + + // this pointer is non-NULL only while the modal event loop is running + wxDialogModalData *m_modalData; + + DECLARE_DYNAMIC_CLASS(wxDialog) + DECLARE_NO_COPY_CLASS(wxDialog) +}; + +#endif + // _WX_DIALOG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/dib.h b/Externals/wxWidgets/include/wx/msw/dib.h index 71ae02bb75..c1eb28c0dd 100644 --- a/Externals/wxWidgets/include/wx/msw/dib.h +++ b/Externals/wxWidgets/include/wx/msw/dib.h @@ -1,255 +1,255 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dib.h -// Purpose: wxDIB class representing Win32 device independent bitmaps -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.03.03 (replaces the old file with the same name) -// RCS-ID: $Id: dib.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1997-2003 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_DIB_H_ -#define _WX_MSW_DIB_H_ - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -#include "wx/msw/private.h" - -#if wxUSE_WXDIB - -// ---------------------------------------------------------------------------- -// wxDIB: represents a DIB section -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDIB -{ -public: - // ctors and such - // -------------- - - // create an uninitialized DIB with the given width, height and depth (only - // 24 and 32 bpp DIBs are currently supported) - // - // after using this ctor, GetData() and GetHandle() may be used if IsOk() - // returns true - wxDIB(int width, int height, int depth) - { Init(); (void)Create(width, height, depth); } - - // create a DIB from the DDB - wxDIB(const wxBitmap& bmp) - { Init(); (void)Create(bmp); } - - // create a DIB from the Windows DDB - wxDIB(HBITMAP hbmp) - { Init(); (void)Create(hbmp); } - - // load a DIB from file (any depth is supoprted here unlike above) - // - // as above, use IsOk() to see if the bitmap was loaded successfully - wxDIB(const wxString& filename) - { Init(); (void)Load(filename); } - - // same as the corresponding ctors but with return value - bool Create(int width, int height, int depth); - bool Create(const wxBitmap& bmp); - bool Create(HBITMAP hbmp); - bool Load(const wxString& filename); - - // dtor is not virtual, this class is not meant to be used polymorphically - ~wxDIB(); - - - // operations - // ---------- - -#ifndef __WXWINCE__ - // create a bitmap compatible with the given HDC (or screen by default) and - // return its handle, the caller is responsible for freeing it (using - // DeleteObject()) - HBITMAP CreateDDB(HDC hdc = 0) const; -#endif // !__WXWINCE__ - - // get the handle from the DIB and reset it, i.e. this object won't destroy - // the DIB after this (but the caller should do it) - HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; } - -#if wxUSE_PALETTE - // create a palette for this DIB (always a trivial/default one for 24bpp) - wxPalette *CreatePalette() const; -#endif // wxUSE_PALETTE - - // save the DIB as a .BMP file to the file with the given name - bool Save(const wxString& filename); - - - // accessors - // --------- - - // return true if DIB was successfully created, false otherwise - bool IsOk() const { return m_handle != 0; } - - // get the bitmap size - wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } - int GetWidth() const { DoGetObject(); return m_width; } - int GetHeight() const { DoGetObject(); return m_height; } - - // get the number of bits per pixel, or depth - int GetDepth() const { DoGetObject(); return m_depth; } - - // get the DIB handle - HBITMAP GetHandle() const { return m_handle; } - - // get raw pointer to bitmap bits, you should know what you do if you - // decide to use it - unsigned char *GetData() const - { DoGetObject(); return (unsigned char *)m_data; } - - - // HBITMAP conversion - // ------------------ - - // these functions are only used by wxWidgets internally right now, please - // don't use them directly if possible as they're subject to change - -#ifndef __WXWINCE__ - // creates a DDB compatible with the given (or screen) DC from either - // a plain DIB or a DIB section (in which case the last parameter must be - // non NULL) - static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, - HDC hdc = 0, - void *bits = NULL); - - // create a plain DIB (not a DIB section) from a DDB, the caller is - // responsable for freeing it using ::GlobalFree() - static HGLOBAL ConvertFromBitmap(HBITMAP hbmp); - - // creates a DIB from the given DDB or calculates the space needed by it: - // if pbi is NULL, only the space is calculated, otherwise pbi is supposed - // to point at BITMAPINFO of the correct size which is filled by this - // function (this overload is needed for wxBitmapDataObject code in - // src/msw/ole/dataobj.cpp) - static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp); -#endif // __WXWINCE__ - - - // wxImage conversion - // ------------------ - -#if wxUSE_IMAGE - // create a DIB from the given image, the DIB will be either 24 or 32 (if - // the image has alpha channel) bpp - wxDIB(const wxImage& image) { Init(); (void)Create(image); } - - // same as the above ctor but with the return code - bool Create(const wxImage& image); - - // create wxImage having the same data as this DIB - wxImage ConvertToImage() const; -#endif // wxUSE_IMAGE - - - // helper functions - // ---------------- - - // return the size of one line in a DIB with given width and depth: the - // point here is that as the scan lines need to be DWORD aligned so we may - // need to add some padding - static unsigned long GetLineSize(int width, int depth) - { - return ((width*depth + 31) & ~31) >> 3; - } - -private: - // common part of all ctors - void Init(); - - // free resources - void Free(); - - // initialize the contents from the provided DDB (Create() must have been - // already called) - bool CopyFromDDB(HBITMAP hbmp); - - - // the DIB section handle, 0 if invalid - HBITMAP m_handle; - - // NB: we could store only m_handle and not any of the other fields as - // we may always retrieve them from it using ::GetObject(), but we - // decide to still store them for efficiency concerns -- however if we - // don't have them from the very beginning (e.g. DIB constructed from a - // bitmap), we only retrieve them when necessary and so these fields - // should *never* be accessed directly, even from inside wxDIB code - - // function which must be called before accessing any members and which - // gets their values from m_handle, if not done yet - void DoGetObject() const; - - // pointer to DIB bits, may be NULL - void *m_data; - - // size and depth of the image - int m_width, - m_height, - m_depth; - - // in some cases we could be using a handle which we didn't create and in - // this case we shouldn't free it neither -- this flag tell us if this is - // the case - bool m_ownsHandle; - - // if true, we have alpha, if false we don't (note that we can still have - // m_depth == 32 but the last component is then simply padding and not - // alpha) - bool m_hasAlpha; - - - // DIBs can't be copied - wxDIB(const wxDIB&); - wxDIB& operator=(const wxDIB&); -}; - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -inline -void wxDIB::Init() -{ - m_handle = 0; - m_ownsHandle = true; - m_hasAlpha = false; - - m_data = NULL; - - m_width = - m_height = - m_depth = 0; -} - -inline -void wxDIB::Free() -{ - if ( m_handle && m_ownsHandle ) - { - if ( !::DeleteObject(m_handle) ) - { - wxLogLastError(wxT("DeleteObject(hDIB)")); - } - - Init(); - } -} - -inline wxDIB::~wxDIB() -{ - Free(); -} - -#endif - // wxUSE_WXDIB - -#endif // _WX_MSW_DIB_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dib.h +// Purpose: wxDIB class representing Win32 device independent bitmaps +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.03.03 (replaces the old file with the same name) +// RCS-ID: $Id: dib.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 1997-2003 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DIB_H_ +#define _WX_MSW_DIB_H_ + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxPalette; + +#include "wx/msw/private.h" + +#if wxUSE_WXDIB + +// ---------------------------------------------------------------------------- +// wxDIB: represents a DIB section +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDIB +{ +public: + // ctors and such + // -------------- + + // create an uninitialized DIB with the given width, height and depth (only + // 24 and 32 bpp DIBs are currently supported) + // + // after using this ctor, GetData() and GetHandle() may be used if IsOk() + // returns true + wxDIB(int width, int height, int depth) + { Init(); (void)Create(width, height, depth); } + + // create a DIB from the DDB + wxDIB(const wxBitmap& bmp) + { Init(); (void)Create(bmp); } + + // create a DIB from the Windows DDB + wxDIB(HBITMAP hbmp) + { Init(); (void)Create(hbmp); } + + // load a DIB from file (any depth is supoprted here unlike above) + // + // as above, use IsOk() to see if the bitmap was loaded successfully + wxDIB(const wxString& filename) + { Init(); (void)Load(filename); } + + // same as the corresponding ctors but with return value + bool Create(int width, int height, int depth); + bool Create(const wxBitmap& bmp); + bool Create(HBITMAP hbmp); + bool Load(const wxString& filename); + + // dtor is not virtual, this class is not meant to be used polymorphically + ~wxDIB(); + + + // operations + // ---------- + +#ifndef __WXWINCE__ + // create a bitmap compatible with the given HDC (or screen by default) and + // return its handle, the caller is responsible for freeing it (using + // DeleteObject()) + HBITMAP CreateDDB(HDC hdc = 0) const; +#endif // !__WXWINCE__ + + // get the handle from the DIB and reset it, i.e. this object won't destroy + // the DIB after this (but the caller should do it) + HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; } + +#if wxUSE_PALETTE + // create a palette for this DIB (always a trivial/default one for 24bpp) + wxPalette *CreatePalette() const; +#endif // wxUSE_PALETTE + + // save the DIB as a .BMP file to the file with the given name + bool Save(const wxString& filename); + + + // accessors + // --------- + + // return true if DIB was successfully created, false otherwise + bool IsOk() const { return m_handle != 0; } + + // get the bitmap size + wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } + int GetWidth() const { DoGetObject(); return m_width; } + int GetHeight() const { DoGetObject(); return m_height; } + + // get the number of bits per pixel, or depth + int GetDepth() const { DoGetObject(); return m_depth; } + + // get the DIB handle + HBITMAP GetHandle() const { return m_handle; } + + // get raw pointer to bitmap bits, you should know what you do if you + // decide to use it + unsigned char *GetData() const + { DoGetObject(); return (unsigned char *)m_data; } + + + // HBITMAP conversion + // ------------------ + + // these functions are only used by wxWidgets internally right now, please + // don't use them directly if possible as they're subject to change + +#ifndef __WXWINCE__ + // creates a DDB compatible with the given (or screen) DC from either + // a plain DIB or a DIB section (in which case the last parameter must be + // non NULL) + static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, + HDC hdc = 0, + void *bits = NULL); + + // create a plain DIB (not a DIB section) from a DDB, the caller is + // responsable for freeing it using ::GlobalFree() + static HGLOBAL ConvertFromBitmap(HBITMAP hbmp); + + // creates a DIB from the given DDB or calculates the space needed by it: + // if pbi is NULL, only the space is calculated, otherwise pbi is supposed + // to point at BITMAPINFO of the correct size which is filled by this + // function (this overload is needed for wxBitmapDataObject code in + // src/msw/ole/dataobj.cpp) + static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp); +#endif // __WXWINCE__ + + + // wxImage conversion + // ------------------ + +#if wxUSE_IMAGE + // create a DIB from the given image, the DIB will be either 24 or 32 (if + // the image has alpha channel) bpp + wxDIB(const wxImage& image) { Init(); (void)Create(image); } + + // same as the above ctor but with the return code + bool Create(const wxImage& image); + + // create wxImage having the same data as this DIB + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + + + // helper functions + // ---------------- + + // return the size of one line in a DIB with given width and depth: the + // point here is that as the scan lines need to be DWORD aligned so we may + // need to add some padding + static unsigned long GetLineSize(int width, int depth) + { + return ((width*depth + 31) & ~31) >> 3; + } + +private: + // common part of all ctors + void Init(); + + // free resources + void Free(); + + // initialize the contents from the provided DDB (Create() must have been + // already called) + bool CopyFromDDB(HBITMAP hbmp); + + + // the DIB section handle, 0 if invalid + HBITMAP m_handle; + + // NB: we could store only m_handle and not any of the other fields as + // we may always retrieve them from it using ::GetObject(), but we + // decide to still store them for efficiency concerns -- however if we + // don't have them from the very beginning (e.g. DIB constructed from a + // bitmap), we only retrieve them when necessary and so these fields + // should *never* be accessed directly, even from inside wxDIB code + + // function which must be called before accessing any members and which + // gets their values from m_handle, if not done yet + void DoGetObject() const; + + // pointer to DIB bits, may be NULL + void *m_data; + + // size and depth of the image + int m_width, + m_height, + m_depth; + + // in some cases we could be using a handle which we didn't create and in + // this case we shouldn't free it neither -- this flag tell us if this is + // the case + bool m_ownsHandle; + + // if true, we have alpha, if false we don't (note that we can still have + // m_depth == 32 but the last component is then simply padding and not + // alpha) + bool m_hasAlpha; + + + // DIBs can't be copied + wxDIB(const wxDIB&); + wxDIB& operator=(const wxDIB&); +}; + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +inline +void wxDIB::Init() +{ + m_handle = 0; + m_ownsHandle = true; + m_hasAlpha = false; + + m_data = NULL; + + m_width = + m_height = + m_depth = 0; +} + +inline +void wxDIB::Free() +{ + if ( m_handle && m_ownsHandle ) + { + if ( !::DeleteObject(m_handle) ) + { + wxLogLastError(wxT("DeleteObject(hDIB)")); + } + + Init(); + } +} + +inline wxDIB::~wxDIB() +{ + Free(); +} + +#endif + // wxUSE_WXDIB + +#endif // _WX_MSW_DIB_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/dirdlg.h b/Externals/wxWidgets/include/wx/msw/dirdlg.h index 8e27d57e3e..9a9708e1ed 100644 --- a/Externals/wxWidgets/include/wx/msw/dirdlg.h +++ b/Externals/wxWidgets/include/wx/msw/dirdlg.h @@ -1,35 +1,35 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dirdlg.h -// Purpose: wxDirDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: dirdlg.h 38956 2006-04-30 09:44:29Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DIRDLG_H_ -#define _WX_DIRDLG_H_ - -class WXDLLEXPORT wxDirDialog : public wxDirDialogBase -{ -public: - wxDirDialog(wxWindow *parent, - const wxString& message = wxDirSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& name = wxDirDialogNameStr); - - void SetPath(const wxString& path); - - virtual int ShowModal(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog) -}; - -#endif - // _WX_DIRDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dirdlg.h +// Purpose: wxDirDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: dirdlg.h 38956 2006-04-30 09:44:29Z RR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_ +#define _WX_DIRDLG_H_ + +class WXDLLEXPORT wxDirDialog : public wxDirDialogBase +{ +public: + wxDirDialog(wxWindow *parent, + const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); + + void SetPath(const wxString& path); + + virtual int ShowModal(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog) +}; + +#endif + // _WX_DIRDLG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/dragimag.h b/Externals/wxWidgets/include/wx/msw/dragimag.h index ce944200ef..d7763d6c13 100644 --- a/Externals/wxWidgets/include/wx/msw/dragimag.h +++ b/Externals/wxWidgets/include/wx/msw/dragimag.h @@ -1,274 +1,274 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/dragimag.h -// Purpose: wxDragImage class: a kind of a cursor, that can cope -// with more sophisticated images -// Author: Julian Smart -// Modified by: -// Created: 08/04/99 -// RCS-ID: $Id: dragimag.h 45845 2007-05-05 19:00:35Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DRAGIMAG_H_ -#define _WX_DRAGIMAG_H_ - -#if wxUSE_DRAGIMAGE - -#include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/treectrl.h" -#include "wx/listctrl.h" - -// If 1, use a simple wxCursor instead of ImageList_SetDragCursorImage -#define wxUSE_SIMPLER_DRAGIMAGE 0 - -/* - To use this class, create a wxDragImage when you start dragging, for example: - - void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) - { -#ifdef __WXMSW__ - ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets -#endif - - CaptureMouse(); - - m_dragImage = new wxDragImage(* this, itemId); - m_dragImage->BeginDrag(wxPoint(0, 0), this); - m_dragImage->Move(pt, this); - m_dragImage->Show(this); - ... - } - - In your OnMouseMove function, hide the image, do any display updating required, - then move and show the image again: - - void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) - { - if (m_dragMode == MY_TREE_DRAG_NONE) - { - event.Skip(); - return; - } - - // Prevent screen corruption by hiding the image - if (m_dragImage) - m_dragImage->Hide(this); - - // Do some updating of the window, such as highlighting the drop target - ... - -#ifdef __WXMSW__ - if (updateWindow) - ::UpdateWindow((HWND) GetHWND()); -#endif - - // Move and show the image again - m_dragImage->Move(event.GetPosition(), this); - m_dragImage->Show(this); - } - - Eventually we end the drag and delete the drag image. - - void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) - { - ... - - // End the drag and delete the drag image - if (m_dragImage) - { - m_dragImage->EndDrag(this); - delete m_dragImage; - m_dragImage = NULL; - } - ReleaseMouse(); - } -*/ - -/* - Notes for Unix version: - Can we simply use cursors instead, creating a cursor dynamically, setting it into the window - in BeginDrag, and restoring the old cursor in EndDrag? - For a really bog-standard implementation, we could simply use a normal dragging cursor - and ignore the image. -*/ - -/* - * wxDragImage - */ - -class WXDLLEXPORT wxDragImage: public wxObject -{ -public: - - // Ctors & dtor - //////////////////////////////////////////////////////////////////////////// - - wxDragImage(); - wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - // Deprecated form of the above - wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(image, cursor, cursorHotspot); - } - - wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(image, cursor); - } - - // Deprecated form of the above - wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(image, cursor, cursorHotspot); - } - - wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) - { - Init(); - - Create(str, cursor); - } - - // Deprecated form of the above - wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) - { - Init(); - - Create(str, cursor, cursorHotspot); - } - -#if wxUSE_TREECTRL - wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) - { - Init(); - - Create(treeCtrl, id); - } -#endif - -#if wxUSE_LISTCTRL - wxDragImage(const wxListCtrl& listCtrl, long id) - { - Init(); - - Create(listCtrl, id); - } -#endif - - virtual ~wxDragImage(); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Create a drag image from a bitmap and optional cursor - bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); - bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(image, cursor); - } - - // Create a drag image from an icon and optional cursor - bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); - bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(image, cursor); - } - - // Create a drag image from a string and optional cursor - bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); - bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) - { - wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); - return Create(str, cursor); - } - -#if wxUSE_TREECTRL - // Create a drag image for the given tree control item - bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); -#endif - -#if wxUSE_LISTCTRL - // Create a drag image for the given list control item - bool Create(const wxListCtrl& listCtrl, long id); -#endif - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); - - // Begin drag. hotspot is the location of the drag position relative to the upper-left - // corner of the image. This is full screen only. fullScreenRect gives the - // position of the window on the screen, to restrict the drag to. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); - - // End drag - bool EndDrag(); - - // Move the image: call from OnMouseMove. Pt is in window client coordinates if window - // is non-NULL, or in screen coordinates if NULL. - bool Move(const wxPoint& pt); - - // Show the image - bool Show(); - - // Hide the image - bool Hide(); - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - // Initialize variables - void Init(); - - // Returns the native image list handle - WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } - -#if !wxUSE_SIMPLER_DRAGIMAGE - // Returns the native image list handle for the cursor - WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } -#endif - -protected: - WXHIMAGELIST m_hImageList; - -#if wxUSE_SIMPLER_DRAGIMAGE - wxCursor m_oldCursor; -#else - WXHIMAGELIST m_hCursorImageList; -#endif - - wxCursor m_cursor; -// wxPoint m_cursorHotspot; // Obsolete - wxPoint m_position; - wxWindow* m_window; - wxRect m_boundingRect; - bool m_fullScreen; - -private: - DECLARE_DYNAMIC_CLASS(wxDragImage) - DECLARE_NO_COPY_CLASS(wxDragImage) -}; - -#endif // wxUSE_DRAGIMAGE -#endif - // _WX_DRAGIMAG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dragimag.h +// Purpose: wxDragImage class: a kind of a cursor, that can cope +// with more sophisticated images +// Author: Julian Smart +// Modified by: +// Created: 08/04/99 +// RCS-ID: $Id: dragimag.h 45845 2007-05-05 19:00:35Z PC $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMAG_H_ +#define _WX_DRAGIMAG_H_ + +#if wxUSE_DRAGIMAGE + +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/treectrl.h" +#include "wx/listctrl.h" + +// If 1, use a simple wxCursor instead of ImageList_SetDragCursorImage +#define wxUSE_SIMPLER_DRAGIMAGE 0 + +/* + To use this class, create a wxDragImage when you start dragging, for example: + + void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) + { +#ifdef __WXMSW__ + ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets +#endif + + CaptureMouse(); + + m_dragImage = new wxDragImage(* this, itemId); + m_dragImage->BeginDrag(wxPoint(0, 0), this); + m_dragImage->Move(pt, this); + m_dragImage->Show(this); + ... + } + + In your OnMouseMove function, hide the image, do any display updating required, + then move and show the image again: + + void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) + { + if (m_dragMode == MY_TREE_DRAG_NONE) + { + event.Skip(); + return; + } + + // Prevent screen corruption by hiding the image + if (m_dragImage) + m_dragImage->Hide(this); + + // Do some updating of the window, such as highlighting the drop target + ... + +#ifdef __WXMSW__ + if (updateWindow) + ::UpdateWindow((HWND) GetHWND()); +#endif + + // Move and show the image again + m_dragImage->Move(event.GetPosition(), this); + m_dragImage->Show(this); + } + + Eventually we end the drag and delete the drag image. + + void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) + { + ... + + // End the drag and delete the drag image + if (m_dragImage) + { + m_dragImage->EndDrag(this); + delete m_dragImage; + m_dragImage = NULL; + } + ReleaseMouse(); + } +*/ + +/* + Notes for Unix version: + Can we simply use cursors instead, creating a cursor dynamically, setting it into the window + in BeginDrag, and restoring the old cursor in EndDrag? + For a really bog-standard implementation, we could simply use a normal dragging cursor + and ignore the image. +*/ + +/* + * wxDragImage + */ + +class WXDLLEXPORT wxDragImage: public wxObject +{ +public: + + // Ctors & dtor + //////////////////////////////////////////////////////////////////////////// + + wxDragImage(); + wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + // Deprecated form of the above + wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(image, cursor, cursorHotspot); + } + + wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + // Deprecated form of the above + wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(image, cursor, cursorHotspot); + } + + wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(str, cursor); + } + + // Deprecated form of the above + wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(str, cursor, cursorHotspot); + } + +#if wxUSE_TREECTRL + wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) + { + Init(); + + Create(treeCtrl, id); + } +#endif + +#if wxUSE_LISTCTRL + wxDragImage(const wxListCtrl& listCtrl, long id) + { + Init(); + + Create(listCtrl, id); + } +#endif + + virtual ~wxDragImage(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Create a drag image from a bitmap and optional cursor + bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); + bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(image, cursor); + } + + // Create a drag image from an icon and optional cursor + bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); + bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(image, cursor); + } + + // Create a drag image from a string and optional cursor + bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); + bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(str, cursor); + } + +#if wxUSE_TREECTRL + // Create a drag image for the given tree control item + bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); +#endif + +#if wxUSE_LISTCTRL + // Create a drag image for the given list control item + bool Create(const wxListCtrl& listCtrl, long id); +#endif + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL); + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. This is full screen only. fullScreenRect gives the + // position of the window on the screen, to restrict the drag to. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); + + // End drag + bool EndDrag(); + + // Move the image: call from OnMouseMove. Pt is in window client coordinates if window + // is non-NULL, or in screen coordinates if NULL. + bool Move(const wxPoint& pt); + + // Show the image + bool Show(); + + // Hide the image + bool Hide(); + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Initialize variables + void Init(); + + // Returns the native image list handle + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +#if !wxUSE_SIMPLER_DRAGIMAGE + // Returns the native image list handle for the cursor + WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } +#endif + +protected: + WXHIMAGELIST m_hImageList; + +#if wxUSE_SIMPLER_DRAGIMAGE + wxCursor m_oldCursor; +#else + WXHIMAGELIST m_hCursorImageList; +#endif + + wxCursor m_cursor; +// wxPoint m_cursorHotspot; // Obsolete + wxPoint m_position; + wxWindow* m_window; + wxRect m_boundingRect; + bool m_fullScreen; + +private: + DECLARE_DYNAMIC_CLASS(wxDragImage) + DECLARE_NO_COPY_CLASS(wxDragImage) +}; + +#endif // wxUSE_DRAGIMAGE +#endif + // _WX_DRAGIMAG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/enhmeta.h b/Externals/wxWidgets/include/wx/msw/enhmeta.h index e5be570a28..6d4cb58c61 100644 --- a/Externals/wxWidgets/include/wx/msw/enhmeta.h +++ b/Externals/wxWidgets/include/wx/msw/enhmeta.h @@ -1,184 +1,184 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/enhmeta.h -// Purpose: wxEnhMetaFile class for Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 13.01.00 -// RCS-ID: $Id: enhmeta.h 41751 2006-10-08 21:56:55Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_ENHMETA_H_ -#define _WX_MSW_ENHMETA_H_ - -#include "wx/dc.h" - -#if wxUSE_DRAG_AND_DROP - #include "wx/dataobj.h" -#endif - -// ---------------------------------------------------------------------------- -// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEnhMetaFile : public wxObject -{ -public: - wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file) - { Init(); } - wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxObject() - { Init(); Assign(metafile); } - wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile) - { Free(); Assign(metafile); return *this; } - - virtual ~wxEnhMetaFile() - { Free(); } - - // display the picture stored in the metafile on the given DC - bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL); - - // accessors - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_hMF != 0; } - - wxSize GetSize() const; - int GetWidth() const { return GetSize().x; } - int GetHeight() const { return GetSize().y; } - - const wxString& GetFileName() const { return m_filename; } - - // copy the metafile to the clipboard: the width and height parameters are - // for backwards compatibility (with wxMetaFile) only, they are ignored by - // this method - bool SetClipboard(int width = 0, int height = 0); - - // implementation - WXHANDLE GetHENHMETAFILE() const { return m_hMF; } - void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; } - -protected: - void Init(); - void Free(); - void Assign(const wxEnhMetaFile& mf); - -private: - wxString m_filename; - WXHANDLE m_hMF; - - DECLARE_DYNAMIC_CLASS(wxEnhMetaFile) -}; - -// ---------------------------------------------------------------------------- -// wxEnhMetaFileDC: allows to create a wxEnhMetaFile -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEnhMetaFileDC : public wxDC -{ -public: - // the ctor parameters specify the filename (empty for memory metafiles), - // the metafile picture size and the optional description/comment - wxEnhMetaFileDC(const wxString& filename = wxEmptyString, - int width = 0, int height = 0, - const wxString& description = wxEmptyString); - - virtual ~wxEnhMetaFileDC(); - - // obtain a pointer to the new metafile (caller should delete it) - wxEnhMetaFile *Close(); - -protected: - virtual void DoGetSize(int *width, int *height) const; - -private: - // size passed to ctor and returned by DoGetSize() - int m_width, - m_height; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC) -}; - -#if wxUSE_DRAG_AND_DROP - -// ---------------------------------------------------------------------------- -// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile -// ---------------------------------------------------------------------------- - -// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and -// so we derive from wxDataObject and not from wxDataObjectSimple -class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject -{ -public: - // ctors - wxEnhMetaFileDataObject() { } - wxEnhMetaFileDataObject(const wxEnhMetaFile& metafile) - : m_metafile(metafile) { } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual void SetMetafile(const wxEnhMetaFile& metafile) - { m_metafile = metafile; } - virtual wxEnhMetaFile GetMetafile() const - { return m_metafile; } - - // implement base class pure virtuals - virtual wxDataFormat GetPreferredFormat(Direction dir) const; - virtual size_t GetFormatCount(Direction dir) const; - virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const; - virtual size_t GetDataSize(const wxDataFormat& format) const; - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; - virtual bool SetData(const wxDataFormat& format, size_t len, - const void *buf); - -protected: - wxEnhMetaFile m_metafile; - - DECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject) -}; - - -// ---------------------------------------------------------------------------- -// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which -// makes it more convenient to use (it can be used with wxDataObjectComposite) -// at the price of not supoprting any more CF_METAFILEPICT but only -// CF_ENHMETAFILE -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple -{ -public: - // ctors - wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { } - wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile) - : wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual void SetEnhMetafile(const wxEnhMetaFile& metafile) - { m_metafile = metafile; } - virtual wxEnhMetaFile GetEnhMetafile() const - { return m_metafile; } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -protected: - wxEnhMetaFile m_metafile; - - DECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject) -}; - -#endif // wxUSE_DRAG_AND_DROP - -#endif // _WX_MSW_ENHMETA_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/enhmeta.h +// Purpose: wxEnhMetaFile class for Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.01.00 +// RCS-ID: $Id: enhmeta.h 41751 2006-10-08 21:56:55Z VZ $ +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_ENHMETA_H_ +#define _WX_MSW_ENHMETA_H_ + +#include "wx/dc.h" + +#if wxUSE_DRAG_AND_DROP + #include "wx/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEnhMetaFile : public wxObject +{ +public: + wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file) + { Init(); } + wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxObject() + { Init(); Assign(metafile); } + wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile) + { Free(); Assign(metafile); return *this; } + + virtual ~wxEnhMetaFile() + { Free(); } + + // display the picture stored in the metafile on the given DC + bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL); + + // accessors + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_hMF != 0; } + + wxSize GetSize() const; + int GetWidth() const { return GetSize().x; } + int GetHeight() const { return GetSize().y; } + + const wxString& GetFileName() const { return m_filename; } + + // copy the metafile to the clipboard: the width and height parameters are + // for backwards compatibility (with wxMetaFile) only, they are ignored by + // this method + bool SetClipboard(int width = 0, int height = 0); + + // implementation + WXHANDLE GetHENHMETAFILE() const { return m_hMF; } + void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; } + +protected: + void Init(); + void Free(); + void Assign(const wxEnhMetaFile& mf); + +private: + wxString m_filename; + WXHANDLE m_hMF; + + DECLARE_DYNAMIC_CLASS(wxEnhMetaFile) +}; + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDC: allows to create a wxEnhMetaFile +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEnhMetaFileDC : public wxDC +{ +public: + // the ctor parameters specify the filename (empty for memory metafiles), + // the metafile picture size and the optional description/comment + wxEnhMetaFileDC(const wxString& filename = wxEmptyString, + int width = 0, int height = 0, + const wxString& description = wxEmptyString); + + virtual ~wxEnhMetaFileDC(); + + // obtain a pointer to the new metafile (caller should delete it) + wxEnhMetaFile *Close(); + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + // size passed to ctor and returned by DoGetSize() + int m_width, + m_height; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC) +}; + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile +// ---------------------------------------------------------------------------- + +// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and +// so we derive from wxDataObject and not from wxDataObjectSimple +class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject +{ +public: + // ctors + wxEnhMetaFileDataObject() { } + wxEnhMetaFileDataObject(const wxEnhMetaFile& metafile) + : m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxEnhMetaFile& metafile) + { m_metafile = metafile; } + virtual wxEnhMetaFile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual wxDataFormat GetPreferredFormat(Direction dir) const; + virtual size_t GetFormatCount(Direction dir) const; + virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const; + virtual size_t GetDataSize(const wxDataFormat& format) const; + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; + virtual bool SetData(const wxDataFormat& format, size_t len, + const void *buf); + +protected: + wxEnhMetaFile m_metafile; + + DECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject) +}; + + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which +// makes it more convenient to use (it can be used with wxDataObjectComposite) +// at the price of not supoprting any more CF_METAFILEPICT but only +// CF_ENHMETAFILE +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { } + wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile) + : wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetEnhMetafile(const wxEnhMetaFile& metafile) + { m_metafile = metafile; } + virtual wxEnhMetaFile GetEnhMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } + +protected: + wxEnhMetaFile m_metafile; + + DECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject) +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif // _WX_MSW_ENHMETA_H_ diff --git a/Externals/wxWidgets/include/wx/msw/evtloop.h b/Externals/wxWidgets/include/wx/msw/evtloop.h index d6f4312ac3..ee4e7be6ca 100644 --- a/Externals/wxWidgets/include/wx/msw/evtloop.h +++ b/Externals/wxWidgets/include/wx/msw/evtloop.h @@ -1,69 +1,69 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/evtloop.h -// Purpose: wxEventLoop class for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-07-31 -// RCS-ID: $Id: evtloop.h 36881 2006-01-15 10:13:40Z ABX $ -// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_EVTLOOP_H_ -#define _WX_MSW_EVTLOOP_H_ - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxEventLoop -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxEventLoop : public wxEventLoopManual -{ -public: - wxEventLoop(); - - // implement base class pure virtuals - virtual bool Pending() const; - virtual bool Dispatch(); - - // MSW-specific methods - // -------------------- - - // preprocess a message, return true if processed (i.e. no further - // dispatching required) - virtual bool PreProcessMessage(WXMSG *msg); - - // process a single message - virtual void ProcessMessage(WXMSG *msg); - - // set the critical window: this is the window such that all the events - // except those to this window (and its children) stop to be processed - // (typical examples: assert or crash report dialog) - // - // calling this function with NULL argument restores the normal event - // handling - static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } - - // return true if there is no critical window or if this window is [a child - // of] the critical one - static bool AllowProcessing(wxWindowMSW *win) - { - return !ms_winCritical || IsChildOfCriticalWindow(win); - } - -protected: - // override/implement base class virtuals - virtual void WakeUp(); - virtual void OnNextIteration(); - - // check if the given window is a child of ms_winCritical (which must be - // non NULL) - static bool IsChildOfCriticalWindow(wxWindowMSW *win); - - - // critical window or NULL - static wxWindowMSW *ms_winCritical; -}; - -#endif // _WX_MSW_EVTLOOP_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/evtloop.h +// Purpose: wxEventLoop class for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-07-31 +// RCS-ID: $Id: evtloop.h 36881 2006-01-15 10:13:40Z ABX $ +// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_EVTLOOP_H_ +#define _WX_MSW_EVTLOOP_H_ + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxEventLoop +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEventLoop : public wxEventLoopManual +{ +public: + wxEventLoop(); + + // implement base class pure virtuals + virtual bool Pending() const; + virtual bool Dispatch(); + + // MSW-specific methods + // -------------------- + + // preprocess a message, return true if processed (i.e. no further + // dispatching required) + virtual bool PreProcessMessage(WXMSG *msg); + + // process a single message + virtual void ProcessMessage(WXMSG *msg); + + // set the critical window: this is the window such that all the events + // except those to this window (and its children) stop to be processed + // (typical examples: assert or crash report dialog) + // + // calling this function with NULL argument restores the normal event + // handling + static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } + + // return true if there is no critical window or if this window is [a child + // of] the critical one + static bool AllowProcessing(wxWindowMSW *win) + { + return !ms_winCritical || IsChildOfCriticalWindow(win); + } + +protected: + // override/implement base class virtuals + virtual void WakeUp(); + virtual void OnNextIteration(); + + // check if the given window is a child of ms_winCritical (which must be + // non NULL) + static bool IsChildOfCriticalWindow(wxWindowMSW *win); + + + // critical window or NULL + static wxWindowMSW *ms_winCritical; +}; + +#endif // _WX_MSW_EVTLOOP_H_ diff --git a/Externals/wxWidgets/include/wx/msw/fdrepdlg.h b/Externals/wxWidgets/include/wx/msw/fdrepdlg.h index 1e534ae85d..f7874715e4 100644 --- a/Externals/wxWidgets/include/wx/msw/fdrepdlg.h +++ b/Externals/wxWidgets/include/wx/msw/fdrepdlg.h @@ -1,62 +1,62 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fdrepdlg.h -// Purpose: wxFindReplaceDialog class -// Author: Markus Greither -// Modified by: 31.07.01: VZ: integrated into wxWidgets -// Created: 23/03/2001 -// RCS-ID: -// Copyright: (c) Markus Greither -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_FDREPDLG_H_ -#define _WX_MSW_FDREPDLG_H_ - -// ---------------------------------------------------------------------------- -// wxFindReplaceDialog: dialog for searching / replacing text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFindReplaceDialog : public wxFindReplaceDialogBase -{ -public: - // ctors and such - wxFindReplaceDialog() { Init(); } - wxFindReplaceDialog(wxWindow *parent, - wxFindReplaceData *data, - const wxString &title, - int style = 0); - - bool Create(wxWindow *parent, - wxFindReplaceData *data, - const wxString &title, - int style = 0); - - virtual ~wxFindReplaceDialog(); - - // implementation only from now on - - wxFindReplaceDialogImpl *GetImpl() const { return m_impl; } - - // override some base class virtuals - virtual bool Show(bool show = true); - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; - -protected: - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - void Init(); - - wxString m_title; - - wxFindReplaceDialogImpl *m_impl; - - DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog) - DECLARE_NO_COPY_CLASS(wxFindReplaceDialog) -}; - -#endif // _WX_MSW_FDREPDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fdrepdlg.h +// Purpose: wxFindReplaceDialog class +// Author: Markus Greither +// Modified by: 31.07.01: VZ: integrated into wxWidgets +// Created: 23/03/2001 +// RCS-ID: +// Copyright: (c) Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_FDREPDLG_H_ +#define _WX_MSW_FDREPDLG_H_ + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog: dialog for searching / replacing text +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFindReplaceDialog : public wxFindReplaceDialogBase +{ +public: + // ctors and such + wxFindReplaceDialog() { Init(); } + wxFindReplaceDialog(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int style = 0); + + bool Create(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int style = 0); + + virtual ~wxFindReplaceDialog(); + + // implementation only from now on + + wxFindReplaceDialogImpl *GetImpl() const { return m_impl; } + + // override some base class virtuals + virtual bool Show(bool show = true); + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + +protected: + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + void Init(); + + wxString m_title; + + wxFindReplaceDialogImpl *m_impl; + + DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog) + DECLARE_NO_COPY_CLASS(wxFindReplaceDialog) +}; + +#endif // _WX_MSW_FDREPDLG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/filedlg.h b/Externals/wxWidgets/include/wx/msw/filedlg.h index 4608a2ed94..8ca031b7e7 100644 --- a/Externals/wxWidgets/include/wx/msw/filedlg.h +++ b/Externals/wxWidgets/include/wx/msw/filedlg.h @@ -1,55 +1,55 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/filedlg.h -// Purpose: wxFileDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: filedlg.h 39402 2006-05-28 23:32:12Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEDLG_H_ -#define _WX_FILEDLG_H_ - -//------------------------------------------------------------------------- -// wxFileDialog -//------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDialog: public wxFileDialogBase -{ -public: - wxFileDialog(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultDir = wxEmptyString, - const wxString& defaultFile = wxEmptyString, - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, - long style = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr); - - virtual void SetPath(const wxString& path); - virtual void GetPaths(wxArrayString& paths) const; - virtual void GetFilenames(wxArrayString& files) const; - - virtual int ShowModal(); - -protected: - -#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoGetPosition( int *x, int *y ) const; -#endif // !(__SMARTPHONE__ && __WXWINCE__) - -private: - wxArrayString m_fileNames; - bool m_bMovedWindow; - - DECLARE_DYNAMIC_CLASS(wxFileDialog) - DECLARE_NO_COPY_CLASS(wxFileDialog) -}; - -#endif // _WX_FILEDLG_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/filedlg.h +// Purpose: wxFileDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: filedlg.h 39402 2006-05-28 23:32:12Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_ +#define _WX_FILEDLG_H_ + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDialog: public wxFileDialogBase +{ +public: + wxFileDialog(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr); + + virtual void SetPath(const wxString& path); + virtual void GetPaths(wxArrayString& paths) const; + virtual void GetFilenames(wxArrayString& files) const; + + virtual int ShowModal(); + +protected: + +#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetPosition( int *x, int *y ) const; +#endif // !(__SMARTPHONE__ && __WXWINCE__) + +private: + wxArrayString m_fileNames; + bool m_bMovedWindow; + + DECLARE_DYNAMIC_CLASS(wxFileDialog) + DECLARE_NO_COPY_CLASS(wxFileDialog) +}; + +#endif // _WX_FILEDLG_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/font.h b/Externals/wxWidgets/include/wx/msw/font.h index 925355dfb0..fb4fab0fe9 100644 --- a/Externals/wxWidgets/include/wx/msw/font.h +++ b/Externals/wxWidgets/include/wx/msw/font.h @@ -1,148 +1,148 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/font.h -// Purpose: wxFont class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: font.h 39411 2006-05-29 00:03:36Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONT_H_ -#define _WX_FONT_H_ - -#include "wx/gdicmn.h" - -// ---------------------------------------------------------------------------- -// wxFont -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFont : public wxFontBase -{ -public: - // ctors and such - wxFont() { } - - wxFont(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, family, style, weight, underlined, face, encoding); - } - - wxFont(const wxSize& pixelSize, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(pixelSize, family, style, weight, - underlined, face, encoding); - } - - wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) - { - Create(info, hFont); - } - - wxFont(const wxString& fontDesc); - - bool Create(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - return DoCreate(size, wxDefaultSize, false, family, style, - weight, underlined, face, encoding); - } - - bool Create(const wxSize& pixelSize, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - return DoCreate(-1, pixelSize, true, family, style, - weight, underlined, face, encoding); - } - - bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); - - virtual ~wxFont(); - - // wxFontBase overridden functions - virtual wxString GetNativeFontInfoDesc() const; - virtual wxString GetNativeFontInfoUserDesc() const; - - // implement base class pure virtuals - virtual int GetPointSize() const; - virtual wxSize GetPixelSize() const; - virtual bool IsUsingSizeInPixels() const; - virtual int GetFamily() const; - virtual int GetStyle() const; - virtual int GetWeight() const; - virtual bool GetUnderlined() const; - virtual wxString GetFaceName() const; - virtual wxFontEncoding GetEncoding() const; - virtual const wxNativeFontInfo *GetNativeFontInfo() const; - - virtual void SetPointSize(int pointSize); - virtual void SetPixelSize(const wxSize& pixelSize); - virtual void SetFamily(int family); - virtual void SetStyle(int style); - virtual void SetWeight(int weight); - virtual bool SetFaceName(const wxString& faceName); - virtual void SetUnderlined(bool underlined); - virtual void SetEncoding(wxFontEncoding encoding); - - virtual bool IsFixedWidth() const; - - // implementation only from now on - // ------------------------------- - - virtual bool IsFree() const; - virtual bool RealizeResource(); - virtual WXHANDLE GetResourceHandle() const; - virtual bool FreeResource(bool force = false); - - // for consistency with other wxMSW classes - WXHFONT GetHFONT() const; - - /* - virtual bool UseResource(); - virtual bool ReleaseResource(); - */ - -protected: - // real font creation function, used in all cases - bool DoCreate(int size, - const wxSize& pixelSize, - bool sizeUsingPixels, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); - - void Unshare(); - -private: - DECLARE_DYNAMIC_CLASS(wxFont) -}; - -#endif // _WX_FONT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/font.h +// Purpose: wxFont class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: font.h 39411 2006-05-29 00:03:36Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +#include "wx/gdicmn.h" + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(pixelSize, family, style, weight, + underlined, face, encoding); + } + + wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) + { + Create(info, hFont); + } + + wxFont(const wxString& fontDesc); + + bool Create(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + return DoCreate(size, wxDefaultSize, false, family, style, + weight, underlined, face, encoding); + } + + bool Create(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + return DoCreate(-1, pixelSize, true, family, style, + weight, underlined, face, encoding); + } + + bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); + + virtual ~wxFont(); + + // wxFontBase overridden functions + virtual wxString GetNativeFontInfoDesc() const; + virtual wxString GetNativeFontInfoUserDesc() const; + + // implement base class pure virtuals + virtual int GetPointSize() const; + virtual wxSize GetPixelSize() const; + virtual bool IsUsingSizeInPixels() const; + virtual int GetFamily() const; + virtual int GetStyle() const; + virtual int GetWeight() const; + virtual bool GetUnderlined() const; + virtual wxString GetFaceName() const; + virtual wxFontEncoding GetEncoding() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + virtual void SetPointSize(int pointSize); + virtual void SetPixelSize(const wxSize& pixelSize); + virtual void SetFamily(int family); + virtual void SetStyle(int style); + virtual void SetWeight(int weight); + virtual bool SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + virtual bool IsFixedWidth() const; + + // implementation only from now on + // ------------------------------- + + virtual bool IsFree() const; + virtual bool RealizeResource(); + virtual WXHANDLE GetResourceHandle() const; + virtual bool FreeResource(bool force = false); + + // for consistency with other wxMSW classes + WXHFONT GetHFONT() const; + + /* + virtual bool UseResource(); + virtual bool ReleaseResource(); + */ + +protected: + // real font creation function, used in all cases + bool DoCreate(int size, + const wxSize& pixelSize, + bool sizeUsingPixels, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); + + void Unshare(); + +private: + DECLARE_DYNAMIC_CLASS(wxFont) +}; + +#endif // _WX_FONT_H_ diff --git a/Externals/wxWidgets/include/wx/msw/fontdlg.h b/Externals/wxWidgets/include/wx/msw/fontdlg.h index f3c3562d33..5892d2e60e 100644 --- a/Externals/wxWidgets/include/wx/msw/fontdlg.h +++ b/Externals/wxWidgets/include/wx/msw/fontdlg.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fontdlg.h -// Purpose: wxFontDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: fontdlg.h 38448 2006-03-30 14:04:17Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_FONTDLG_H_ -#define _WX_MSW_FONTDLG_H_ - -// ---------------------------------------------------------------------------- -// wxFontDialog -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFontDialog : public wxFontDialogBase -{ -public: - wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } - wxFontDialog(wxWindow *parent) - : wxFontDialogBase(parent) { Create(parent); } - wxFontDialog(wxWindow *parent, const wxFontData& data) - : wxFontDialogBase(parent, data) { Create(parent, data); } - - virtual int ShowModal(); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use - wxDEPRECATED( wxFontDialog(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) -}; - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use -inline wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData *data) - : wxFontDialogBase(parent) { InitFontData(data); Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif - // _WX_MSW_FONTDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fontdlg.h +// Purpose: wxFontDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: fontdlg.h 38448 2006-03-30 14:04:17Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_FONTDLG_H_ +#define _WX_MSW_FONTDLG_H_ + +// ---------------------------------------------------------------------------- +// wxFontDialog +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFontDialog : public wxFontDialogBase +{ +public: + wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } + wxFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Create(parent); } + wxFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Create(parent, data); } + + virtual int ShowModal(); + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated interface, don't use + wxDEPRECATED( wxFontDialog(wxWindow *parent, const wxFontData *data) ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) +}; + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated interface, don't use +inline wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData *data) + : wxFontDialogBase(parent) { InitFontData(data); Create(parent); } +#endif // WXWIN_COMPATIBILITY_2_6 + +#endif + // _WX_MSW_FONTDLG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/fontenum.h b/Externals/wxWidgets/include/wx/msw/fontenum.h index 797c58b999..c43ae2cac1 100644 --- a/Externals/wxWidgets/include/wx/msw/fontenum.h +++ b/Externals/wxWidgets/include/wx/msw/fontenum.h @@ -1,40 +1,40 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/fontenum.h -// Purpose: wxFontEnumerator class for Windows -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: fontenum.h 39461 2006-05-29 21:12:51Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTENUM_MSW_H_ -#define _WX_FONTENUM_MSW_H_ - -/* - * wxFontEnumerator: for gathering font information - */ - -class wxFontEnumerator: public wxObject -{ -DECLARE_CLASS(wxFontEnumerator) -public: - wxFontEnumerator() {} - - // Enumerate the fonts. - bool Enumerate(); - - // Stop enumeration if false is returned. - // By default, the enumerator stores the facenames in a list for - // retrieval via GetFacenames(). - virtual bool OnFont(const wxFont& font); - - // Return the list of facenames. - wxStringList& GetFacenames() { return (wxStringList&) m_faceNames; } -protected: - wxStringList m_faceNames; -}; - -#endif - // _WX_FONTENUM_MSW_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fontenum.h +// Purpose: wxFontEnumerator class for Windows +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id: fontenum.h 39461 2006-05-29 21:12:51Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENUM_MSW_H_ +#define _WX_FONTENUM_MSW_H_ + +/* + * wxFontEnumerator: for gathering font information + */ + +class wxFontEnumerator: public wxObject +{ +DECLARE_CLASS(wxFontEnumerator) +public: + wxFontEnumerator() {} + + // Enumerate the fonts. + bool Enumerate(); + + // Stop enumeration if false is returned. + // By default, the enumerator stores the facenames in a list for + // retrieval via GetFacenames(). + virtual bool OnFont(const wxFont& font); + + // Return the list of facenames. + wxStringList& GetFacenames() { return (wxStringList&) m_faceNames; } +protected: + wxStringList m_faceNames; +}; + +#endif + // _WX_FONTENUM_MSW_H_ diff --git a/Externals/wxWidgets/include/wx/msw/frame.h b/Externals/wxWidgets/include/wx/msw/frame.h index dc3a58be51..6139e5a297 100644 --- a/Externals/wxWidgets/include/wx/msw/frame.h +++ b/Externals/wxWidgets/include/wx/msw/frame.h @@ -1,172 +1,172 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/frame.h -// Purpose: wxFrame class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: frame.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FRAME_H_ -#define _WX_FRAME_H_ - -class WXDLLEXPORT wxFrame : public wxFrameBase -{ -public: - // construction - wxFrame() { Init(); } - wxFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxFrame(); - - // implement base class pure virtuals - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual void Raise(); - - // implementation only from now on - // ------------------------------- - - // event handlers - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Toolbar -#if wxUSE_TOOLBAR - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID id = wxID_ANY, - const wxString& name = wxToolBarNameStr); -#endif // wxUSE_TOOLBAR - - // Status bar -#if wxUSE_STATUSBAR - virtual wxStatusBar* OnCreateStatusBar(int number = 1, - long style = wxST_SIZEGRIP, - wxWindowID id = 0, - const wxString& name = wxStatusLineNameStr); - - // Hint to tell framework which status bar to use: the default is to use - // native one for the platforms which support it (Win32), the generic one - // otherwise - - // TODO: should this go into a wxFrameworkSettings class perhaps? - static void UseNativeStatusBar(bool useNative) - { m_useNativeStatusBar = useNative; } - static bool UsesNativeStatusBar() - { return m_useNativeStatusBar; } -#endif // wxUSE_STATUSBAR - -#if wxUSE_MENUS - WXHMENU GetWinMenu() const { return m_hMenu; } -#endif // wxUSE_MENUS - - // event handlers - bool HandlePaint(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); - bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); - - // tooltip management -#if wxUSE_TOOLTIPS - WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } - void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } -#endif // tooltips - - // a MSW only function which sends a size event to the window using its - // current size - this has an effect of refreshing the window layout - virtual void SendSizeEvent(); - - virtual wxPoint GetClientAreaOrigin() const; - - // override base class version to add menu bar accel processing - virtual bool MSWTranslateMessage(WXMSG *msg) - { - return MSWDoTranslateMessage(this, msg); - } - - // window proc for the frames - virtual WXLRESULT MSWWindowProc(WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // override base class virtuals - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int height); - -#if wxUSE_MENUS_NATIVE - // perform MSW-specific action when menubar is changed - virtual void AttachMenuBar(wxMenuBar *menubar); - - // a plug in for MDI frame classes which need to do something special when - // the menubar is set - virtual void InternalSetMenuBar(); -#endif // wxUSE_MENUS_NATIVE - - // propagate our state change to all child frames - void IconizeChildFrames(bool bIconize); - - // the real implementation of MSWTranslateMessage(), also used by - // wxMDIChildFrame - bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); - - // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN - bool HandleInitMenuPopup(WXHMENU hMenu); - - virtual bool IsMDIChild() const { return false; } - - // get default (wxWidgets) icon for the frame - virtual WXHICON GetDefaultIcon() const; - -#if wxUSE_TOOLBAR - virtual void PositionToolBar(); -#endif // wxUSE_TOOLBAR - -#if wxUSE_STATUSBAR - virtual void PositionStatusBar(); - - static bool m_useNativeStatusBar; -#endif // wxUSE_STATUSBAR - -#if wxUSE_MENUS - // frame menu, NULL if none - WXHMENU m_hMenu; -#endif // wxUSE_MENUS - -private: -#if wxUSE_TOOLTIPS - WXHWND m_hwndToolTip; -#endif // tooltips - - // used by IconizeChildFrames(), see comments there - bool m_wasMinimized; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) -}; - -#endif - // _WX_FRAME_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/frame.h +// Purpose: wxFrame class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: frame.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_ +#define _WX_FRAME_H_ + +class WXDLLEXPORT wxFrame : public wxFrameBase +{ +public: + // construction + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxFrame(); + + // implement base class pure virtuals + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual void Raise(); + + // implementation only from now on + // ------------------------------- + + // event handlers + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Toolbar +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = wxID_ANY, + const wxString& name = wxToolBarNameStr); +#endif // wxUSE_TOOLBAR + + // Status bar +#if wxUSE_STATUSBAR + virtual wxStatusBar* OnCreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP, + wxWindowID id = 0, + const wxString& name = wxStatusLineNameStr); + + // Hint to tell framework which status bar to use: the default is to use + // native one for the platforms which support it (Win32), the generic one + // otherwise + + // TODO: should this go into a wxFrameworkSettings class perhaps? + static void UseNativeStatusBar(bool useNative) + { m_useNativeStatusBar = useNative; } + static bool UsesNativeStatusBar() + { return m_useNativeStatusBar; } +#endif // wxUSE_STATUSBAR + +#if wxUSE_MENUS + WXHMENU GetWinMenu() const { return m_hMenu; } +#endif // wxUSE_MENUS + + // event handlers + bool HandlePaint(); + bool HandleSize(int x, int y, WXUINT flag); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); + bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); + + // tooltip management +#if wxUSE_TOOLTIPS + WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } + void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } +#endif // tooltips + + // a MSW only function which sends a size event to the window using its + // current size - this has an effect of refreshing the window layout + virtual void SendSizeEvent(); + + virtual wxPoint GetClientAreaOrigin() const; + + // override base class version to add menu bar accel processing + virtual bool MSWTranslateMessage(WXMSG *msg) + { + return MSWDoTranslateMessage(this, msg); + } + + // window proc for the frames + virtual WXLRESULT MSWWindowProc(WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); + +protected: + // common part of all ctors + void Init(); + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + +#if wxUSE_MENUS_NATIVE + // perform MSW-specific action when menubar is changed + virtual void AttachMenuBar(wxMenuBar *menubar); + + // a plug in for MDI frame classes which need to do something special when + // the menubar is set + virtual void InternalSetMenuBar(); +#endif // wxUSE_MENUS_NATIVE + + // propagate our state change to all child frames + void IconizeChildFrames(bool bIconize); + + // the real implementation of MSWTranslateMessage(), also used by + // wxMDIChildFrame + bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); + + // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN + bool HandleInitMenuPopup(WXHMENU hMenu); + + virtual bool IsMDIChild() const { return false; } + + // get default (wxWidgets) icon for the frame + virtual WXHICON GetDefaultIcon() const; + +#if wxUSE_TOOLBAR + virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR + +#if wxUSE_STATUSBAR + virtual void PositionStatusBar(); + + static bool m_useNativeStatusBar; +#endif // wxUSE_STATUSBAR + +#if wxUSE_MENUS + // frame menu, NULL if none + WXHMENU m_hMenu; +#endif // wxUSE_MENUS + +private: +#if wxUSE_TOOLTIPS + WXHWND m_hwndToolTip; +#endif // tooltips + + // used by IconizeChildFrames(), see comments there + bool m_wasMinimized; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) +}; + +#endif + // _WX_FRAME_H_ diff --git a/Externals/wxWidgets/include/wx/msw/gauge95.h b/Externals/wxWidgets/include/wx/msw/gauge95.h index edc0bfb50b..c6c74df206 100644 --- a/Externals/wxWidgets/include/wx/msw/gauge95.h +++ b/Externals/wxWidgets/include/wx/msw/gauge95.h @@ -1,70 +1,70 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: gauge95.h -// Purpose: wxGauge95 class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: gauge95.h 43881 2006-12-09 19:48:21Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _GAUGE95_H_ -#define _GAUGE95_H_ - -#if wxUSE_GAUGE - -extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; - -// Group box -class WXDLLEXPORT wxGauge95 : public wxGaugeBase -{ -public: - wxGauge95() { } - - wxGauge95(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - (void)Create(parent, id, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - // set gauge range/value - virtual void SetRange(int range); - virtual void SetValue(int pos); - - // overriden base class virtuals - virtual bool SetForegroundColour(const wxColour& col); - virtual bool SetBackgroundColour(const wxColour& col); - - - void SetIndeterminateMode(); - void SetDeterminateMode(); - void Pulse(); - - WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge95) -}; - -#endif // wxUSE_GAUGE - -#endif - // _GAUGEMSW_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: gauge95.h +// Purpose: wxGauge95 class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: gauge95.h 43881 2006-12-09 19:48:21Z PC $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _GAUGE95_H_ +#define _GAUGE95_H_ + +#if wxUSE_GAUGE + +extern WXDLLEXPORT_DATA(const wxChar) wxGaugeNameStr[]; + +// Group box +class WXDLLEXPORT wxGauge95 : public wxGaugeBase +{ +public: + wxGauge95() { } + + wxGauge95(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + (void)Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + // set gauge range/value + virtual void SetRange(int range); + virtual void SetValue(int pos); + + // overriden base class virtuals + virtual bool SetForegroundColour(const wxColour& col); + virtual bool SetBackgroundColour(const wxColour& col); + + + void SetIndeterminateMode(); + void SetDeterminateMode(); + void Pulse(); + + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxSize DoGetBestSize() const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge95) +}; + +#endif // wxUSE_GAUGE + +#endif + // _GAUGEMSW_H_ diff --git a/Externals/wxWidgets/include/wx/msw/gccpriv.h b/Externals/wxWidgets/include/wx/msw/gccpriv.h index f2d40f293c..db4c72a84d 100644 --- a/Externals/wxWidgets/include/wx/msw/gccpriv.h +++ b/Externals/wxWidgets/include/wx/msw/gccpriv.h @@ -1,127 +1,127 @@ -/* - Name: wx/msw/gccpriv.h - Purpose: MinGW/Cygwin definitions - Author: Vadim Zeitlin - Modified by: - Created: - RCS-ID: $Id: gccpriv.h 36155 2005-11-10 16:16:05Z ABX $ - Copyright: (c) Vadim Zeitlin - Licence: wxWindows Licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_MSW_GCCPRIV_H_ -#define _WX_MSW_GCCPRIV_H_ - -#if defined(__MINGW32__) && !defined(__GNUWIN32__) - #define __GNUWIN32__ -#endif - -#if defined(__MINGW32__) && ( ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 95 ) ) ) - #include <_mingw.h> -#endif - -#if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H ) - #if __MINGW32_MAJOR_VERSION >= 1 - #define HAVE_W32API_H - #endif -#elif defined( __CYGWIN__ ) && !defined( HAVE_W32API_H ) - #if ( __GNUC__ > 2 ) - #define HAVE_W32API_H - #endif -#endif - -#if wxCHECK_WATCOM_VERSION(1,0) - #define HAVE_W32API_H -#endif - -/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */ -#if defined( HAVE_W32API_H ) -#include <w32api.h> -#endif - -/* Watcom can't handle defined(xxx) here: */ -#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION) - #define wxCHECK_W32API_VERSION( major, minor ) \ - ( ( ( __W32API_MAJOR_VERSION > (major) ) \ - || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) ) -#else - #define wxCHECK_W32API_VERSION( major, minor ) (0) -#endif - -/* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which - are more ms-like (header author is Anders Norlander, hence the name) */ -#if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95))) - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 1 - #endif -#else - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 0 - #endif -#endif - -/* "old" GNUWIN32 is the one without Norlander's headers: it lacks the - standard Win32 headers and we define the used stuff ourselves for it - in wx/msw/gnuwin32/extra.h */ -#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS - #define __GNUWIN32_OLD__ -#endif - -/* Cygwin 1.0 */ -#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9)) - #define __CYGWIN10__ -#endif - -/* Check for Mingw runtime version: */ -#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION) - #define wxCHECK_MINGW32_VERSION( major, minor ) \ - ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \ - || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) ) -#else - #define wxCHECK_MINGW32_VERSION( major, minor ) (0) -#endif - -/* Mingw runtime 1.0-20010604 has some missing _tXXXX functions, - so let's define them ourselves: */ -#if defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) \ - && !wxCHECK_W32API_VERSION( 1, 1 ) - #ifndef _tsetlocale - #if wxUSE_UNICODE - #define _tsetlocale _wsetlocale - #else - #define _tsetlocale setlocale - #endif - #endif - #ifndef _tgetenv - #if wxUSE_UNICODE - #define _tgetenv _wgetenv - #else - #define _tgetenv getenv - #endif - #endif - #ifndef _tfopen - #if wxUSE_UNICODE - #define _tfopen _wfopen - #else - #define _tfopen fopen - #endif - #endif -#endif - -/* current (= before mingw-runtime 3.3) mingw32 headers forget to - define _puttchar, this will probably be fixed in the next versions but - for now do it ourselves - */ -#if defined( __MINGW32__ ) && \ - !wxCHECK_MINGW32_VERSION(3,3) && !defined( _puttchar ) - #ifdef wxUSE_UNICODE - #define _puttchar putwchar - #else - #define _puttchar puttchar - #endif -#endif - -#endif - /* _WX_MSW_GCCPRIV_H_ */ +/* + Name: wx/msw/gccpriv.h + Purpose: MinGW/Cygwin definitions + Author: Vadim Zeitlin + Modified by: + Created: + RCS-ID: $Id: gccpriv.h 36155 2005-11-10 16:16:05Z ABX $ + Copyright: (c) Vadim Zeitlin + Licence: wxWindows Licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_MSW_GCCPRIV_H_ +#define _WX_MSW_GCCPRIV_H_ + +#if defined(__MINGW32__) && !defined(__GNUWIN32__) + #define __GNUWIN32__ +#endif + +#if defined(__MINGW32__) && ( ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 95 ) ) ) + #include <_mingw.h> +#endif + +#if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H ) + #if __MINGW32_MAJOR_VERSION >= 1 + #define HAVE_W32API_H + #endif +#elif defined( __CYGWIN__ ) && !defined( HAVE_W32API_H ) + #if ( __GNUC__ > 2 ) + #define HAVE_W32API_H + #endif +#endif + +#if wxCHECK_WATCOM_VERSION(1,0) + #define HAVE_W32API_H +#endif + +/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */ +#if defined( HAVE_W32API_H ) +#include <w32api.h> +#endif + +/* Watcom can't handle defined(xxx) here: */ +#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION) + #define wxCHECK_W32API_VERSION( major, minor ) \ + ( ( ( __W32API_MAJOR_VERSION > (major) ) \ + || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) ) +#else + #define wxCHECK_W32API_VERSION( major, minor ) (0) +#endif + +/* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which + are more ms-like (header author is Anders Norlander, hence the name) */ +#if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95))) + #ifndef wxUSE_NORLANDER_HEADERS + #define wxUSE_NORLANDER_HEADERS 1 + #endif +#else + #ifndef wxUSE_NORLANDER_HEADERS + #define wxUSE_NORLANDER_HEADERS 0 + #endif +#endif + +/* "old" GNUWIN32 is the one without Norlander's headers: it lacks the + standard Win32 headers and we define the used stuff ourselves for it + in wx/msw/gnuwin32/extra.h */ +#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS + #define __GNUWIN32_OLD__ +#endif + +/* Cygwin 1.0 */ +#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9)) + #define __CYGWIN10__ +#endif + +/* Check for Mingw runtime version: */ +#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION) + #define wxCHECK_MINGW32_VERSION( major, minor ) \ + ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \ + || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) ) +#else + #define wxCHECK_MINGW32_VERSION( major, minor ) (0) +#endif + +/* Mingw runtime 1.0-20010604 has some missing _tXXXX functions, + so let's define them ourselves: */ +#if defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) \ + && !wxCHECK_W32API_VERSION( 1, 1 ) + #ifndef _tsetlocale + #if wxUSE_UNICODE + #define _tsetlocale _wsetlocale + #else + #define _tsetlocale setlocale + #endif + #endif + #ifndef _tgetenv + #if wxUSE_UNICODE + #define _tgetenv _wgetenv + #else + #define _tgetenv getenv + #endif + #endif + #ifndef _tfopen + #if wxUSE_UNICODE + #define _tfopen _wfopen + #else + #define _tfopen fopen + #endif + #endif +#endif + +/* current (= before mingw-runtime 3.3) mingw32 headers forget to + define _puttchar, this will probably be fixed in the next versions but + for now do it ourselves + */ +#if defined( __MINGW32__ ) && \ + !wxCHECK_MINGW32_VERSION(3,3) && !defined( _puttchar ) + #ifdef wxUSE_UNICODE + #define _puttchar putwchar + #else + #define _puttchar puttchar + #endif +#endif + +#endif + /* _WX_MSW_GCCPRIV_H_ */ diff --git a/Externals/wxWidgets/include/wx/msw/gdiimage.h b/Externals/wxWidgets/include/wx/msw/gdiimage.h index d78f5b6201..87582e104c 100644 --- a/Externals/wxWidgets/include/wx/msw/gdiimage.h +++ b/Externals/wxWidgets/include/wx/msw/gdiimage.h @@ -1,189 +1,189 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/gdiimage.h -// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor -// under MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.11.99 -// RCS-ID: $Id: gdiimage.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// NB: this is a private header, it is not intended to be directly included by -// user code (but may be included from other, public, wxWin headers - -#ifndef _WX_MSW_GDIIMAGE_H_ -#define _WX_MSW_GDIIMAGE_H_ - -#include "wx/gdiobj.h" // base class -#include "wx/gdicmn.h" // wxBITMAP_TYPE_INVALID -#include "wx/list.h" - -class WXDLLIMPEXP_FWD_CORE wxGDIImageRefData; -class WXDLLIMPEXP_FWD_CORE wxGDIImageHandler; -class WXDLLIMPEXP_FWD_CORE wxGDIImage; - -WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList); - -// ---------------------------------------------------------------------------- -// wxGDIImageRefData: common data fields for all derived classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImageRefData : public wxGDIRefData -{ -public: - wxGDIImageRefData() - { - m_width = m_height = m_depth = 0; - - m_handle = 0; - } - - wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData(data) - { - m_width = data.m_width; - m_height = data.m_height; - m_depth = data.m_depth; - - // can't copy handles like this, derived class copy ctor must do it! - m_handle = NULL; - } - - // accessors - bool IsOk() const { return m_handle != 0; } - - void SetSize(int w, int h) { m_width = w; m_height = h; } - - // free the ressources we allocated - virtual void Free() = 0; - - // for compatibility, the member fields are public - - // the size of the image - int m_width, m_height; - - // the depth of the image - int m_depth; - - // the handle to it - union - { - WXHANDLE m_handle; // for untyped access - WXHBITMAP m_hBitmap; - WXHICON m_hIcon; - WXHCURSOR m_hCursor; - }; -}; - -// ---------------------------------------------------------------------------- -// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImageHandler : public wxObject -{ -public: - // ctor - wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } - wxGDIImageHandler(const wxString& name, - const wxString& ext, - long type) - : m_name(name), m_extension(ext) - { - m_type = type; - } - - // accessors - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(long type) { m_type = type; } - - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - long GetType() const { return m_type; } - - // real handler operations: to implement in derived classes - virtual bool Create(wxGDIImage *image, - const void* data, - long flags, - int width, int height, int depth = 1) = 0; - virtual bool Load(wxGDIImage *image, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight) = 0; - virtual bool Save(wxGDIImage *image, - const wxString& name, - int type) = 0; - -protected: - wxString m_name; - wxString m_extension; - long m_type; -}; - -// ---------------------------------------------------------------------------- -// wxGDIImage: this class supports GDI image handlers which may be registered -// dynamically and will be used for loading/saving the images in the specified -// format. It also falls back to wxImage if no appropriate image is found. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImage : public wxGDIObject -{ -public: - // handlers list interface - static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; } - - static void AddHandler(wxGDIImageHandler *handler); - static void InsertHandler(wxGDIImageHandler *handler); - static bool RemoveHandler(const wxString& name); - - static wxGDIImageHandler *FindHandler(const wxString& name); - static wxGDIImageHandler *FindHandler(const wxString& extension, long type); - static wxGDIImageHandler *FindHandler(long type); - - static void InitStandardHandlers(); - static void CleanUpHandlers(); - - // access to the ref data casted to the right type - wxGDIImageRefData *GetGDIImageData() const - { return (wxGDIImageRefData *)m_refData; } - - // accessors - WXHANDLE GetHandle() const - { return IsNull() ? 0 : GetGDIImageData()->m_handle; } - void SetHandle(WXHANDLE handle) - { AllocExclusive(); GetGDIImageData()->m_handle = handle; } - - bool Ok() const { return IsOk(); } - bool IsOk() const { return GetHandle() != 0; } - - int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; } - int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; } - int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; } - - void SetWidth(int w) { AllocExclusive(); GetGDIImageData()->m_width = w; } - void SetHeight(int h) { AllocExclusive(); GetGDIImageData()->m_height = h; } - void SetDepth(int d) { AllocExclusive(); GetGDIImageData()->m_depth = d; } - - void SetSize(int w, int h) - { - AllocExclusive(); - GetGDIImageData()->SetSize(w, h); - } - void SetSize(const wxSize& size) { SetSize(size.x, size.y); } - - // forward some of base class virtuals to wxGDIImageRefData - bool FreeResource(bool force = false); - virtual WXHANDLE GetResourceHandle() const; - -protected: - // create the data for the derived class here - virtual wxGDIImageRefData *CreateData() const = 0; - - // implement the wxObject method in terms of our, more specific, one - virtual wxObjectRefData *CreateRefData() const { return CreateData(); } - - static wxGDIImageHandlerList ms_handlers; -}; - -#endif // _WX_MSW_GDIIMAGE_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/gdiimage.h +// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor +// under MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.11.99 +// RCS-ID: $Id: gdiimage.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// NB: this is a private header, it is not intended to be directly included by +// user code (but may be included from other, public, wxWin headers + +#ifndef _WX_MSW_GDIIMAGE_H_ +#define _WX_MSW_GDIIMAGE_H_ + +#include "wx/gdiobj.h" // base class +#include "wx/gdicmn.h" // wxBITMAP_TYPE_INVALID +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxGDIImageRefData; +class WXDLLIMPEXP_FWD_CORE wxGDIImageHandler; +class WXDLLIMPEXP_FWD_CORE wxGDIImage; + +WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList); + +// ---------------------------------------------------------------------------- +// wxGDIImageRefData: common data fields for all derived classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImageRefData : public wxGDIRefData +{ +public: + wxGDIImageRefData() + { + m_width = m_height = m_depth = 0; + + m_handle = 0; + } + + wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData(data) + { + m_width = data.m_width; + m_height = data.m_height; + m_depth = data.m_depth; + + // can't copy handles like this, derived class copy ctor must do it! + m_handle = NULL; + } + + // accessors + bool IsOk() const { return m_handle != 0; } + + void SetSize(int w, int h) { m_width = w; m_height = h; } + + // free the ressources we allocated + virtual void Free() = 0; + + // for compatibility, the member fields are public + + // the size of the image + int m_width, m_height; + + // the depth of the image + int m_depth; + + // the handle to it + union + { + WXHANDLE m_handle; // for untyped access + WXHBITMAP m_hBitmap; + WXHICON m_hIcon; + WXHCURSOR m_hCursor; + }; +}; + +// ---------------------------------------------------------------------------- +// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImageHandler : public wxObject +{ +public: + // ctor + wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } + wxGDIImageHandler(const wxString& name, + const wxString& ext, + long type) + : m_name(name), m_extension(ext) + { + m_type = type; + } + + // accessors + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(long type) { m_type = type; } + + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + long GetType() const { return m_type; } + + // real handler operations: to implement in derived classes + virtual bool Create(wxGDIImage *image, + const void* data, + long flags, + int width, int height, int depth = 1) = 0; + virtual bool Load(wxGDIImage *image, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight) = 0; + virtual bool Save(wxGDIImage *image, + const wxString& name, + int type) = 0; + +protected: + wxString m_name; + wxString m_extension; + long m_type; +}; + +// ---------------------------------------------------------------------------- +// wxGDIImage: this class supports GDI image handlers which may be registered +// dynamically and will be used for loading/saving the images in the specified +// format. It also falls back to wxImage if no appropriate image is found. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImage : public wxGDIObject +{ +public: + // handlers list interface + static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; } + + static void AddHandler(wxGDIImageHandler *handler); + static void InsertHandler(wxGDIImageHandler *handler); + static bool RemoveHandler(const wxString& name); + + static wxGDIImageHandler *FindHandler(const wxString& name); + static wxGDIImageHandler *FindHandler(const wxString& extension, long type); + static wxGDIImageHandler *FindHandler(long type); + + static void InitStandardHandlers(); + static void CleanUpHandlers(); + + // access to the ref data casted to the right type + wxGDIImageRefData *GetGDIImageData() const + { return (wxGDIImageRefData *)m_refData; } + + // accessors + WXHANDLE GetHandle() const + { return IsNull() ? 0 : GetGDIImageData()->m_handle; } + void SetHandle(WXHANDLE handle) + { AllocExclusive(); GetGDIImageData()->m_handle = handle; } + + bool Ok() const { return IsOk(); } + bool IsOk() const { return GetHandle() != 0; } + + int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; } + int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; } + int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; } + + void SetWidth(int w) { AllocExclusive(); GetGDIImageData()->m_width = w; } + void SetHeight(int h) { AllocExclusive(); GetGDIImageData()->m_height = h; } + void SetDepth(int d) { AllocExclusive(); GetGDIImageData()->m_depth = d; } + + void SetSize(int w, int h) + { + AllocExclusive(); + GetGDIImageData()->SetSize(w, h); + } + void SetSize(const wxSize& size) { SetSize(size.x, size.y); } + + // forward some of base class virtuals to wxGDIImageRefData + bool FreeResource(bool force = false); + virtual WXHANDLE GetResourceHandle() const; + +protected: + // create the data for the derived class here + virtual wxGDIImageRefData *CreateData() const = 0; + + // implement the wxObject method in terms of our, more specific, one + virtual wxObjectRefData *CreateRefData() const { return CreateData(); } + + static wxGDIImageHandlerList ms_handlers; +}; + +#endif // _WX_MSW_GDIIMAGE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/genrcdefs.h b/Externals/wxWidgets/include/wx/msw/genrcdefs.h index d96634cfe6..3608ccb7cc 100644 --- a/Externals/wxWidgets/include/wx/msw/genrcdefs.h +++ b/Externals/wxWidgets/include/wx/msw/genrcdefs.h @@ -1,43 +1,43 @@ -/* - * Name: wx/msw/genrcdefs.h - * Purpose: Emit preprocessor symbols into rcdefs.h for resource compiler - * Author: Mike Wetherell - * RCS-ID: $Id: genrcdefs.h 36133 2005-11-08 22:49:46Z MW $ - * Copyright: (c) 2005 Mike Wetherell - * Licence: wxWindows licence - */ - -#define EMIT(line) line - -EMIT(#ifndef _WX_RCDEFS_H) -EMIT(#define _WX_RCDEFS_H) - -#ifdef _MSC_FULL_VER -EMIT(#define WX_MSC_FULL_VER _MSC_FULL_VER) -#endif - -#ifdef _M_AMD64 -EMIT(#define WX_CPU_AMD64) -#endif - -#ifdef _M_ARM -EMIT(#define WX_CPU_ARM) -#endif - -#ifdef _M_IA64 -EMIT(#define WX_CPU_IA64) -#endif - -#if defined _M_IX86 || defined _X86_ -EMIT(#define WX_CPU_X86) -#endif - -#ifdef _M_PPC -EMIT(#define WX_CPU_PPC) -#endif - -#ifdef _M_SH -EMIT(#define WX_CPU_SH) -#endif - -EMIT(#endif) +/* + * Name: wx/msw/genrcdefs.h + * Purpose: Emit preprocessor symbols into rcdefs.h for resource compiler + * Author: Mike Wetherell + * RCS-ID: $Id: genrcdefs.h 36133 2005-11-08 22:49:46Z MW $ + * Copyright: (c) 2005 Mike Wetherell + * Licence: wxWindows licence + */ + +#define EMIT(line) line + +EMIT(#ifndef _WX_RCDEFS_H) +EMIT(#define _WX_RCDEFS_H) + +#ifdef _MSC_FULL_VER +EMIT(#define WX_MSC_FULL_VER _MSC_FULL_VER) +#endif + +#ifdef _M_AMD64 +EMIT(#define WX_CPU_AMD64) +#endif + +#ifdef _M_ARM +EMIT(#define WX_CPU_ARM) +#endif + +#ifdef _M_IA64 +EMIT(#define WX_CPU_IA64) +#endif + +#if defined _M_IX86 || defined _X86_ +EMIT(#define WX_CPU_X86) +#endif + +#ifdef _M_PPC +EMIT(#define WX_CPU_PPC) +#endif + +#ifdef _M_SH +EMIT(#define WX_CPU_SH) +#endif + +EMIT(#endif) diff --git a/Externals/wxWidgets/include/wx/msw/glcanvas.h b/Externals/wxWidgets/include/wx/msw/glcanvas.h index be8b6351ba..1204fd4057 100644 --- a/Externals/wxWidgets/include/wx/msw/glcanvas.h +++ b/Externals/wxWidgets/include/wx/msw/glcanvas.h @@ -1,128 +1,128 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/glcanvas.h -// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Windows -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: glcanvas.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GLCANVAS_H_ -#define _WX_GLCANVAS_H_ - -#include "wx/palette.h" -#include "wx/scrolwin.h" - -#include "wx/msw/wrapwin.h" - -#include <GL/gl.h> - -class WXDLLIMPEXP_FWD_GL wxGLCanvas; /* forward reference */ - -class WXDLLIMPEXP_GL wxGLContext: public wxObject -{ -public: - wxGLContext(wxGLCanvas *win, const wxGLContext* other=NULL /* for sharing display lists */ ); - virtual ~wxGLContext(); - - void SetCurrent(const wxGLCanvas& win) const; - inline HGLRC GetGLRC() const { return m_glContext; } - -protected: - HGLRC m_glContext; - -private: - DECLARE_CLASS(wxGLContext) -}; - -class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow -{ -public: - // This ctor is identical to the next, except for the fact that it - // doesn't create an implicit wxGLContext. - // The attribList parameter has been moved to avoid overload clashes. - wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - int* attribList = 0, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxGLCanvasName, - const wxPalette& palette = wxNullPalette); - - wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxGLCanvasName, int *attribList = 0, - const wxPalette& palette = wxNullPalette); - - wxGLCanvas(wxWindow *parent, - const wxGLContext *shared, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - int *attribList = (int *) NULL, - const wxPalette& palette = wxNullPalette); - - wxGLCanvas(wxWindow *parent, - const wxGLCanvas *shared, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - int *attribList = 0, - const wxPalette& palette = wxNullPalette); - - virtual ~wxGLCanvas(); - - // Replaces wxWindow::Create functionality, since - // we need to use a different window class - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name); - - void SetCurrent(const wxGLContext& RC) const; - void SetCurrent(); - -#ifdef __WXUNIVERSAL__ - virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); }; -#endif - - void SetColour(const wxChar *colour); - - void SwapBuffers(); - - void OnSize(wxSizeEvent& event); - - void OnQueryNewPalette(wxQueryNewPaletteEvent& event); - - void OnPaletteChanged(wxPaletteChangedEvent& event); - - inline wxGLContext* GetContext() const { return m_glContext; } - - inline WXHDC GetHDC() const { return m_hDC; } - - void SetupPixelFormat(int *attribList = (int *) NULL); - - void SetupPalette(const wxPalette& palette); - - wxPalette CreateDefaultPalette(); - - inline wxPalette* GetPalette() const { return (wxPalette *) &m_palette; } - -protected: - wxGLContext* m_glContext; // this is typedef-ed ptr, in fact - wxPalette m_palette; - WXHDC m_hDC; - -private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGLCanvas) -}; - -#endif - // _WX_GLCANVAS_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Windows +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id: glcanvas.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/palette.h" +#include "wx/scrolwin.h" + +#include "wx/msw/wrapwin.h" + +#include <GL/gl.h> + +class WXDLLIMPEXP_FWD_GL wxGLCanvas; /* forward reference */ + +class WXDLLIMPEXP_GL wxGLContext: public wxObject +{ +public: + wxGLContext(wxGLCanvas *win, const wxGLContext* other=NULL /* for sharing display lists */ ); + virtual ~wxGLContext(); + + void SetCurrent(const wxGLCanvas& win) const; + inline HGLRC GetGLRC() const { return m_glContext; } + +protected: + HGLRC m_glContext; + +private: + DECLARE_CLASS(wxGLContext) +}; + +class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow +{ +public: + // This ctor is identical to the next, except for the fact that it + // doesn't create an implicit wxGLContext. + // The attribList parameter has been moved to avoid overload clashes. + wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, + int* attribList = 0, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxGLCanvasName, int *attribList = 0, + const wxPalette& palette = wxNullPalette); + + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + int *attribList = (int *) NULL, + const wxPalette& palette = wxNullPalette); + + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + int *attribList = 0, + const wxPalette& palette = wxNullPalette); + + virtual ~wxGLCanvas(); + + // Replaces wxWindow::Create functionality, since + // we need to use a different window class + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name); + + void SetCurrent(const wxGLContext& RC) const; + void SetCurrent(); + +#ifdef __WXUNIVERSAL__ + virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); }; +#endif + + void SetColour(const wxChar *colour); + + void SwapBuffers(); + + void OnSize(wxSizeEvent& event); + + void OnQueryNewPalette(wxQueryNewPaletteEvent& event); + + void OnPaletteChanged(wxPaletteChangedEvent& event); + + inline wxGLContext* GetContext() const { return m_glContext; } + + inline WXHDC GetHDC() const { return m_hDC; } + + void SetupPixelFormat(int *attribList = (int *) NULL); + + void SetupPalette(const wxPalette& palette); + + wxPalette CreateDefaultPalette(); + + inline wxPalette* GetPalette() const { return (wxPalette *) &m_palette; } + +protected: + wxGLContext* m_glContext; // this is typedef-ed ptr, in fact + wxPalette m_palette; + WXHDC m_hDC; + +private: + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxGLCanvas) +}; + +#endif + // _WX_GLCANVAS_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/gsockmsw.h b/Externals/wxWidgets/include/wx/msw/gsockmsw.h index d030726922..6b5149ebbc 100644 --- a/Externals/wxWidgets/include/wx/msw/gsockmsw.h +++ b/Externals/wxWidgets/include/wx/msw/gsockmsw.h @@ -1,145 +1,145 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) for WX - * Name: gsockmsw.h - * Copyright: (c) Guilhem Lavaux - * Licence: wxWindows Licence - * Purpose: GSocket MSW header - * CVSID: $Id: gsockmsw.h 33948 2005-05-04 18:57:50Z JS $ - * ------------------------------------------------------------------------- - */ - -#ifndef __GSOCK_MSW_H -#define __GSOCK_MSW_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/setup.h" -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/gsocket.h" -#else -#include "gsocket.h" -#endif - -#include "wx/msw/wrapwin.h" - -#if defined(__CYGWIN__) - //CYGWIN gives annoying warning about runtime stuff if we don't do this -# define USE_SYS_TYPES_FD_SET -# include <sys/types.h> -#endif - -#if defined(__WXWINCE__) || defined(__CYGWIN__) -#include <winsock.h> -#endif - -class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - -/* Definition of GSocket */ -class GSocket -{ -public: - GSocket(); - ~GSocket(); - bool IsOk() { return m_ok; } - void Close(); - void Shutdown(); - GSocketError SetLocal(GAddress *address); - GSocketError SetPeer(GAddress *address); - GAddress *GetLocal(); - GAddress *GetPeer(); - GSocketError SetServer(); - GSocket *WaitConnection(); - bool SetReusable(); - GSocketError Connect(GSocketStream stream); - GSocketError SetNonOriented(); - int Read(char *buffer, int size); - int Write(const char *buffer, int size); - GSocketEventFlags Select(GSocketEventFlags flags); - void SetNonBlocking(bool non_block); - void SetTimeout(unsigned long millis); - GSocketError WXDLLIMPEXP_NET GetError(); - void SetCallback(GSocketEventFlags flags, - GSocketCallback callback, char *cdata); - void UnsetCallback(GSocketEventFlags flags); - GSocketError GetSockOpt(int level, int optname, - void *optval, int *optlen); - GSocketError SetSockOpt(int level, int optname, - const void *optval, int optlen); -protected: - GSocketError Input_Timeout(); - GSocketError Output_Timeout(); - GSocketError Connect_Timeout(); - int Recv_Stream(char *buffer, int size); - int Recv_Dgram(char *buffer, int size); - int Send_Stream(const char *buffer, int size); - int Send_Dgram(const char *buffer, int size); - bool m_ok; - -/* TODO: Make these protected */ -public: - SOCKET m_fd; - GAddress *m_local; - GAddress *m_peer; - GSocketError m_error; - - /* Attributes */ - bool m_non_blocking; - bool m_server; - bool m_stream; - bool m_establishing; - bool m_reusable; - struct timeval m_timeout; - - /* Callbacks */ - GSocketEventFlags m_detected; - GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; - char *m_data[GSOCK_MAX_EVENT]; - int m_msgnumber; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Definition of GAddress */ -struct _GAddress -{ - struct sockaddr *m_addr; - size_t m_len; - - GAddressType m_family; - int m_realfamily; - - GSocketError m_error; -}; - - -/* GAddress */ - -GSocketError _GAddress_translate_from(GAddress *address, - struct sockaddr *addr, int len); -GSocketError _GAddress_translate_to (GAddress *address, - struct sockaddr **addr, int *len); -GSocketError _GAddress_Init_INET(GAddress *address); -GSocketError _GAddress_Init_UNIX(GAddress *address); - -#ifdef __cplusplus -} -#endif - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -#endif /* __GSOCK_MSW_H */ +/* ------------------------------------------------------------------------- + * Project: GSocket (Generic Socket) for WX + * Name: gsockmsw.h + * Copyright: (c) Guilhem Lavaux + * Licence: wxWindows Licence + * Purpose: GSocket MSW header + * CVSID: $Id: gsockmsw.h 33948 2005-05-04 18:57:50Z JS $ + * ------------------------------------------------------------------------- + */ + +#ifndef __GSOCK_MSW_H +#define __GSOCK_MSW_H + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/setup.h" +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/gsocket.h" +#else +#include "gsocket.h" +#endif + +#include "wx/msw/wrapwin.h" + +#if defined(__CYGWIN__) + //CYGWIN gives annoying warning about runtime stuff if we don't do this +# define USE_SYS_TYPES_FD_SET +# include <sys/types.h> +#endif + +#if defined(__WXWINCE__) || defined(__CYGWIN__) +#include <winsock.h> +#endif + +class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable +{ +public: + virtual bool OnInit(); + virtual void OnExit(); + virtual bool CanUseEventLoop(); + virtual bool Init_Socket(GSocket *socket); + virtual void Destroy_Socket(GSocket *socket); + virtual void Enable_Events(GSocket *socket); + virtual void Disable_Events(GSocket *socket); +}; + +/* Definition of GSocket */ +class GSocket +{ +public: + GSocket(); + ~GSocket(); + bool IsOk() { return m_ok; } + void Close(); + void Shutdown(); + GSocketError SetLocal(GAddress *address); + GSocketError SetPeer(GAddress *address); + GAddress *GetLocal(); + GAddress *GetPeer(); + GSocketError SetServer(); + GSocket *WaitConnection(); + bool SetReusable(); + GSocketError Connect(GSocketStream stream); + GSocketError SetNonOriented(); + int Read(char *buffer, int size); + int Write(const char *buffer, int size); + GSocketEventFlags Select(GSocketEventFlags flags); + void SetNonBlocking(bool non_block); + void SetTimeout(unsigned long millis); + GSocketError WXDLLIMPEXP_NET GetError(); + void SetCallback(GSocketEventFlags flags, + GSocketCallback callback, char *cdata); + void UnsetCallback(GSocketEventFlags flags); + GSocketError GetSockOpt(int level, int optname, + void *optval, int *optlen); + GSocketError SetSockOpt(int level, int optname, + const void *optval, int optlen); +protected: + GSocketError Input_Timeout(); + GSocketError Output_Timeout(); + GSocketError Connect_Timeout(); + int Recv_Stream(char *buffer, int size); + int Recv_Dgram(char *buffer, int size); + int Send_Stream(const char *buffer, int size); + int Send_Dgram(const char *buffer, int size); + bool m_ok; + +/* TODO: Make these protected */ +public: + SOCKET m_fd; + GAddress *m_local; + GAddress *m_peer; + GSocketError m_error; + + /* Attributes */ + bool m_non_blocking; + bool m_server; + bool m_stream; + bool m_establishing; + bool m_reusable; + struct timeval m_timeout; + + /* Callbacks */ + GSocketEventFlags m_detected; + GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; + char *m_data[GSOCK_MAX_EVENT]; + int m_msgnumber; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Definition of GAddress */ +struct _GAddress +{ + struct sockaddr *m_addr; + size_t m_len; + + GAddressType m_family; + int m_realfamily; + + GSocketError m_error; +}; + + +/* GAddress */ + +GSocketError _GAddress_translate_from(GAddress *address, + struct sockaddr *addr, int len); +GSocketError _GAddress_translate_to (GAddress *address, + struct sockaddr **addr, int *len); +GSocketError _GAddress_Init_INET(GAddress *address); +GSocketError _GAddress_Init_UNIX(GAddress *address); + +#ifdef __cplusplus +} +#endif + +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + +#endif /* __GSOCK_MSW_H */ diff --git a/Externals/wxWidgets/include/wx/msw/helpbest.h b/Externals/wxWidgets/include/wx/msw/helpbest.h index 2a9282dffb..551fe8bbed 100644 --- a/Externals/wxWidgets/include/wx/msw/helpbest.h +++ b/Externals/wxWidgets/include/wx/msw/helpbest.h @@ -1,129 +1,129 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/helpbest.h -// Purpose: Tries to load MS HTML Help, falls back to wxHTML upon failure -// Author: Mattia Barbon -// Modified by: -// Created: 02/04/2001 -// RCS-ID: $Id: helpbest.h 39440 2006-05-29 14:51:42Z VZ $ -// Copyright: (c) Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPBEST_H_ -#define _WX_HELPBEST_H_ - -#if wxUSE_HELP && wxUSE_MS_HTML_HELP \ - && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) - -#include "wx/helpbase.h" -#include "wx/html/helpfrm.h" // for wxHF_DEFAULT_STYLE - -class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase -{ -public: - wxBestHelpController(wxWindow* parentWindow = NULL, - int style = wxHF_DEFAULT_STYLE) - : wxHelpControllerBase(parentWindow), - m_helpControllerType(wxUseNone), - m_helpController(NULL), - m_style(style) - { - } - - virtual ~wxBestHelpController() { delete m_helpController; } - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString) - { - return m_helpController->LoadFile( GetValidFilename( file ) ); - } - - virtual bool DisplayContents() - { - return m_helpController->DisplayContents(); - } - - virtual bool DisplaySection(int sectionNo) - { - return m_helpController->DisplaySection( sectionNo ); - } - - virtual bool DisplaySection(const wxString& section) - { - return m_helpController->DisplaySection( section ); - } - - virtual bool DisplayBlock(long blockNo) - { - return m_helpController->DisplayBlock( blockNo ); - } - - virtual bool DisplayContextPopup(int contextId) - { - return m_helpController->DisplayContextPopup( contextId ); - } - - virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) - { - return m_helpController->DisplayTextPopup( text, pos ); - } - - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL) - { - return m_helpController->KeywordSearch( k, mode ); - } - - virtual bool Quit() - { - return m_helpController->Quit(); - } - - // Allows one to override the default settings for the help frame. - virtual void SetFrameParameters(const wxString& title, - const wxSize& size, - const wxPoint& pos = wxDefaultPosition, - bool newFrameEachTime = false) - { - m_helpController->SetFrameParameters( title, size, pos, - newFrameEachTime ); - } - - // Obtains the latest settings used by the help frame and the help frame. - virtual wxFrame *GetFrameParameters(wxSize *size = NULL, - wxPoint *pos = NULL, - bool *newFrameEachTime = NULL) - { - return m_helpController->GetFrameParameters( size, pos, - newFrameEachTime ); - } - - /// Set the window that can optionally be used for the help window's parent. - virtual void SetParentWindow(wxWindow* win) { m_helpController->SetParentWindow(win); } - - /// Get the window that can optionally be used for the help window's parent. - virtual wxWindow* GetParentWindow() const { return m_helpController->GetParentWindow(); } - -protected: - // Append/change extension if necessary. - wxString GetValidFilename(const wxString& file) const; - -protected: - enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp }; - - HelpControllerType m_helpControllerType; - wxHelpControllerBase* m_helpController; - int m_style; - - DECLARE_DYNAMIC_CLASS(wxBestHelpController) - DECLARE_NO_COPY_CLASS(wxBestHelpController) -}; - -#endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP - -#endif - // _WX_HELPBEST_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/helpbest.h +// Purpose: Tries to load MS HTML Help, falls back to wxHTML upon failure +// Author: Mattia Barbon +// Modified by: +// Created: 02/04/2001 +// RCS-ID: $Id: helpbest.h 39440 2006-05-29 14:51:42Z VZ $ +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPBEST_H_ +#define _WX_HELPBEST_H_ + +#if wxUSE_HELP && wxUSE_MS_HTML_HELP \ + && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) + +#include "wx/helpbase.h" +#include "wx/html/helpfrm.h" // for wxHF_DEFAULT_STYLE + +class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase +{ +public: + wxBestHelpController(wxWindow* parentWindow = NULL, + int style = wxHF_DEFAULT_STYLE) + : wxHelpControllerBase(parentWindow), + m_helpControllerType(wxUseNone), + m_helpController(NULL), + m_style(style) + { + } + + virtual ~wxBestHelpController() { delete m_helpController; } + + // Must call this to set the filename + virtual bool Initialize(const wxString& file); + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString) + { + return m_helpController->LoadFile( GetValidFilename( file ) ); + } + + virtual bool DisplayContents() + { + return m_helpController->DisplayContents(); + } + + virtual bool DisplaySection(int sectionNo) + { + return m_helpController->DisplaySection( sectionNo ); + } + + virtual bool DisplaySection(const wxString& section) + { + return m_helpController->DisplaySection( section ); + } + + virtual bool DisplayBlock(long blockNo) + { + return m_helpController->DisplayBlock( blockNo ); + } + + virtual bool DisplayContextPopup(int contextId) + { + return m_helpController->DisplayContextPopup( contextId ); + } + + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) + { + return m_helpController->DisplayTextPopup( text, pos ); + } + + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) + { + return m_helpController->KeywordSearch( k, mode ); + } + + virtual bool Quit() + { + return m_helpController->Quit(); + } + + // Allows one to override the default settings for the help frame. + virtual void SetFrameParameters(const wxString& title, + const wxSize& size, + const wxPoint& pos = wxDefaultPosition, + bool newFrameEachTime = false) + { + m_helpController->SetFrameParameters( title, size, pos, + newFrameEachTime ); + } + + // Obtains the latest settings used by the help frame and the help frame. + virtual wxFrame *GetFrameParameters(wxSize *size = NULL, + wxPoint *pos = NULL, + bool *newFrameEachTime = NULL) + { + return m_helpController->GetFrameParameters( size, pos, + newFrameEachTime ); + } + + /// Set the window that can optionally be used for the help window's parent. + virtual void SetParentWindow(wxWindow* win) { m_helpController->SetParentWindow(win); } + + /// Get the window that can optionally be used for the help window's parent. + virtual wxWindow* GetParentWindow() const { return m_helpController->GetParentWindow(); } + +protected: + // Append/change extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +protected: + enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp }; + + HelpControllerType m_helpControllerType; + wxHelpControllerBase* m_helpController; + int m_style; + + DECLARE_DYNAMIC_CLASS(wxBestHelpController) + DECLARE_NO_COPY_CLASS(wxBestHelpController) +}; + +#endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP + +#endif + // _WX_HELPBEST_H_ diff --git a/Externals/wxWidgets/include/wx/msw/helpchm.h b/Externals/wxWidgets/include/wx/msw/helpchm.h index a6c3e84407..c057232c54 100644 --- a/Externals/wxWidgets/include/wx/msw/helpchm.h +++ b/Externals/wxWidgets/include/wx/msw/helpchm.h @@ -1,60 +1,60 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpchm.h -// Purpose: Help system: MS HTML Help implementation -// Author: Julian Smart -// Modified by: -// Created: 16/04/2000 -// RCS-ID: $Id: helpchm.h 39725 2006-06-14 17:46:51Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPCHM_H_ -#define _WX_HELPCHM_H_ - -#if wxUSE_MS_HTML_HELP - -#include "wx/helpbase.h" - -class WXDLLEXPORT wxCHMHelpController : public wxHelpControllerBase -{ -public: - wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section); - virtual bool DisplayBlock(long blockNo); - virtual bool DisplayContextPopup(int contextId); - virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - virtual bool Quit(); - - wxString GetHelpFile() const { return m_helpFile; } - - // helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp - static bool ShowContextHelpPopup(const wxString& text, - const wxPoint& pos, - wxWindow *window); - -protected: - // Append extension if necessary. - wxString GetValidFilename(const wxString& file) const; - -protected: - wxString m_helpFile; - - DECLARE_CLASS(wxCHMHelpController) -}; - -#endif // wxUSE_MS_HTML_HELP - -#endif -// _WX_HELPCHM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: helpchm.h +// Purpose: Help system: MS HTML Help implementation +// Author: Julian Smart +// Modified by: +// Created: 16/04/2000 +// RCS-ID: $Id: helpchm.h 39725 2006-06-14 17:46:51Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPCHM_H_ +#define _WX_HELPCHM_H_ + +#if wxUSE_MS_HTML_HELP + +#include "wx/helpbase.h" + +class WXDLLEXPORT wxCHMHelpController : public wxHelpControllerBase +{ +public: + wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } + + // Must call this to set the filename + virtual bool Initialize(const wxString& file); + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section); + virtual bool DisplayBlock(long blockNo); + virtual bool DisplayContextPopup(int contextId); + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + virtual bool Quit(); + + wxString GetHelpFile() const { return m_helpFile; } + + // helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp + static bool ShowContextHelpPopup(const wxString& text, + const wxPoint& pos, + wxWindow *window); + +protected: + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +protected: + wxString m_helpFile; + + DECLARE_CLASS(wxCHMHelpController) +}; + +#endif // wxUSE_MS_HTML_HELP + +#endif +// _WX_HELPCHM_H_ diff --git a/Externals/wxWidgets/include/wx/msw/helpwin.h b/Externals/wxWidgets/include/wx/msw/helpwin.h index e563c8e9cf..7c363fbd96 100644 --- a/Externals/wxWidgets/include/wx/msw/helpwin.h +++ b/Externals/wxWidgets/include/wx/msw/helpwin.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: helpwin.h -// Purpose: Help system: WinHelp implementation -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: helpwin.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPWIN_H_ -#define _WX_HELPWIN_H_ - -#include "wx/wx.h" - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase -{ - DECLARE_CLASS(wxWinHelpController) - -public: - wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} - virtual ~wxWinHelpController() {} - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } - virtual bool DisplayBlock(long blockNo); - virtual bool DisplayContextPopup(int contextId); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - virtual bool Quit(); - - inline wxString GetHelpFile() const { return m_helpFile; } - -protected: - // Append extension if necessary. - wxString GetValidFilename(const wxString& file) const; - -private: - wxString m_helpFile; -}; - -#endif // wxUSE_HELP -#endif -// _WX_HELPWIN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: helpwin.h +// Purpose: Help system: WinHelp implementation +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id: helpwin.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWIN_H_ +#define _WX_HELPWIN_H_ + +#include "wx/wx.h" + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase +{ + DECLARE_CLASS(wxWinHelpController) + +public: + wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} + virtual ~wxWinHelpController() {} + + // Must call this to set the filename + virtual bool Initialize(const wxString& file); + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } + virtual bool DisplayBlock(long blockNo); + virtual bool DisplayContextPopup(int contextId); + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + virtual bool Quit(); + + inline wxString GetHelpFile() const { return m_helpFile; } + +protected: + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +private: + wxString m_helpFile; +}; + +#endif // wxUSE_HELP +#endif +// _WX_HELPWIN_H_ diff --git a/Externals/wxWidgets/include/wx/msw/htmlhelp.h b/Externals/wxWidgets/include/wx/msw/htmlhelp.h index 960ee155c7..1bd4065ba4 100644 --- a/Externals/wxWidgets/include/wx/msw/htmlhelp.h +++ b/Externals/wxWidgets/include/wx/msw/htmlhelp.h @@ -1,465 +1,465 @@ -/* - * wx/msw/htmlhelp.h - * Copyright 2004 Jacek Caban - * - * Originally written for the Wine project, and issued under - * the wxWindows License by kind permission of the author. - * - * License: wxWindows License - */ - -#ifndef __HTMLHELP_H__ -#define __HTMLHELP_H__ - -#define HH_DISPLAY_TOPIC 0x00 -#define HH_HELP_FINDER 0x00 -#define HH_DISPLAY_TOC 0x01 -#define HH_DISPLAY_INDEX 0x02 -#define HH_DISPLAY_SEARCH 0x03 -#define HH_SET_WIN_TYPE 0x04 -#define HH_GET_WIN_TYPE 0x05 -#define HH_GET_WIN_HANDLE 0x06 -#define HH_ENUM_INFO_TYPE 0x07 -#define HH_SET_INFO_TYPE 0x08 -#define HH_SYNC 0x09 -#define HH_RESERVED1 0x0A -#define HH_RESERVED2 0x0B -#define HH_RESERVED3 0x0C -#define HH_KEYWORD_LOOKUP 0x0D -#define HH_DISPLAY_TEXT_POPUP 0x0E -#define HH_HELP_CONTEXT 0x0F -#define HH_TP_HELP_CONTEXTMENU 0x10 -#define HH_TP_HELP_WM_HELP 0x11 -#define HH_CLOSE_ALL 0x12 -#define HH_ALINK_LOOKUP 0x13 -#define HH_GET_LAST_ERROR 0x14 -#define HH_ENUM_CATEGORY 0x15 -#define HH_ENUM_CATEGORY_IT 0x16 -#define HH_RESET_IT_FILTER 0x17 -#define HH_SET_INCLUSIVE_FILTER 0x18 -#define HH_SET_EXCLUSIVE_FILTER 0x19 -#define HH_INITIALIZE 0x1C -#define HH_UNINITIALIZE 0x1D -#define HH_PRETRANSLATEMESSAGE 0xFD -#define HH_SET_GLOBAL_PROPERTY 0xFC - -#define HHWIN_PROP_TAB_AUTOHIDESHOW 0x00000001 -#define HHWIN_PROP_ONTOP 0x00000002 -#define HHWIN_PROP_NOTITLEBAR 0x00000004 -#define HHWIN_PROP_NODEF_STYLES 0x00000008 -#define HHWIN_PROP_NODEF_EXSTYLES 0x00000010 -#define HHWIN_PROP_TRI_PANE 0x00000020 -#define HHWIN_PROP_NOTB_TEXT 0x00000040 -#define HHWIN_PROP_POST_QUIT 0x00000080 -#define HHWIN_PROP_AUTO_SYNC 0x00000100 -#define HHWIN_PROP_TRACKING 0x00000200 -#define HHWIN_PROP_TAB_SEARCH 0x00000400 -#define HHWIN_PROP_TAB_HISTORY 0x00000800 -#define HHWIN_PROP_TAB_FAVORITES 0x00001000 -#define HHWIN_PROP_CHANGE_TITLE 0x00002000 -#define HHWIN_PROP_NAV_ONLY_WIN 0x00004000 -#define HHWIN_PROP_NO_TOOLBAR 0x00008000 -#define HHWIN_PROP_MENU 0x00010000 -#define HHWIN_PROP_TAB_ADVSEARCH 0x00020000 -#define HHWIN_PROP_USER_POS 0x00040000 -#define HHWIN_PROP_TAB_CUSTOM1 0x00080000 -#define HHWIN_PROP_TAB_CUSTOM2 0x00100000 -#define HHWIN_PROP_TAB_CUSTOM3 0x00200000 -#define HHWIN_PROP_TAB_CUSTOM4 0x00400000 -#define HHWIN_PROP_TAB_CUSTOM5 0x00800000 -#define HHWIN_PROP_TAB_CUSTOM6 0x01000000 -#define HHWIN_PROP_TAB_CUSTOM7 0x02000000 -#define HHWIN_PROP_TAB_CUSTOM8 0x04000000 -#define HHWIN_PROP_TAB_CUSTOM9 0x08000000 -#define HHWIN_TB_MARGIN 0x10000000 - -#define HHWIN_PARAM_PROPERTIES 0x00000002 -#define HHWIN_PARAM_STYLES 0x00000004 -#define HHWIN_PARAM_EXSTYLES 0x00000008 -#define HHWIN_PARAM_RECT 0x00000010 -#define HHWIN_PARAM_NAV_WIDTH 0x00000020 -#define HHWIN_PARAM_SHOWSTATE 0x00000040 -#define HHWIN_PARAM_INFOTYPES 0x00000080 -#define HHWIN_PARAM_TB_FLAGS 0x00000100 -#define HHWIN_PARAM_EXPANSION 0x00000200 -#define HHWIN_PARAM_TABPOS 0x00000400 -#define HHWIN_PARAM_TABORDER 0x00000800 -#define HHWIN_PARAM_HISTORY_COUNT 0x00001000 -#define HHWIN_PARAM_CUR_TAB 0x00002000 - -#define HHWIN_BUTTON_EXPAND 0x00000002 -#define HHWIN_BUTTON_BACK 0x00000004 -#define HHWIN_BUTTON_FORWARD 0x00000008 -#define HHWIN_BUTTON_STOP 0x00000010 -#define HHWIN_BUTTON_REFRESH 0x00000020 -#define HHWIN_BUTTON_HOME 0x00000040 -#define HHWIN_BUTTON_BROWSE_FWD 0x00000080 -#define HHWIN_BUTTON_BROWSE_BCK 0x00000100 -#define HHWIN_BUTTON_NOTES 0x00000200 -#define HHWIN_BUTTON_CONTENTS 0x00000400 -#define HHWIN_BUTTON_SYNC 0x00000800 -#define HHWIN_BUTTON_OPTIONS 0x00001000 -#define HHWIN_BUTTON_PRINT 0x00002000 -#define HHWIN_BUTTON_INDEX 0x00004000 -#define HHWIN_BUTTON_SEARCH 0x00008000 -#define HHWIN_BUTTON_HISTORY 0x00010000 -#define HHWIN_BUTTON_FAVORITES 0x00020000 -#define HHWIN_BUTTON_JUMP1 0x00040000 -#define HHWIN_BUTTON_JUMP2 0x00080000 -#define HHWIN_BUTTON_ZOOM 0x00100000 -#define HHWIN_BUTTON_TOC_NEXT 0x00200000 -#define HHWIN_BUTTON_TOC_PREV 0x00400000 - -#define HHWIN_DEF_BUTTONS \ - (HHWIN_BUTTON_EXPAND | HHWIN_BUTTON_BACK | HHWIN_BUTTON_OPTIONS | HHWIN_BUTTON_PRINT) - -#define IDTB_EXPAND 200 -#define IDTB_CONTRACT 201 -#define IDTB_STOP 202 -#define IDTB_REFRESH 203 -#define IDTB_BACK 204 -#define IDTB_HOME 205 -#define IDTB_SYNC 206 -#define IDTB_PRINT 207 -#define IDTB_OPTIONS 208 -#define IDTB_FORWARD 209 -#define IDTB_NOTES 210 -#define IDTB_BROWSE_FWD 211 -#define IDTB_BROWSE_BACK 212 -#define IDTB_CONTENTS 213 -#define IDTB_INDEX 214 -#define IDTB_SEARCH 215 -#define IDTB_HISTORY 216 -#define IDTB_FAVORITES 217 -#define IDTB_JUMP1 218 -#define IDTB_JUMP2 219 -#define IDTB_CUSTOMIZE 221 -#define IDTB_ZOOM 222 -#define IDTB_TOC_NEXT 223 -#define IDTB_TOC_PREV 224 - -#define HHN_FIRST (0U-860U) -#define HHN_LAST (0U-879U) -#define HHN_NAVCOMPLETE HHN_FIRST -#define HHN_TRACK (HHN_FIRST-1) -#define HHN_WINDOW_CREATE (HHN_FIRST-2) - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct tagHH_NOTIFY { - NMHDR hdr; - PCSTR pszurl; -} HH_NOTIFY; - -typedef struct tagHH_POPUPA { - int cbStruct; - HINSTANCE hinst; - UINT idString; - LPCSTR pszText; - POINT pt; - COLORREF clrForeground; - COLORREF clrBackground; - RECT rcMargins; - LPCSTR pszFont; -} HH_POPUPA; - -typedef struct tagHH_POPUPW { - int cbStruct; - HINSTANCE hinst; - UINT idString; - LPCWSTR pszText; - POINT pt; - COLORREF clrForeground; - COLORREF clrBackground; - RECT rcMargins; - LPCWSTR pszFont; -} HH_POPUPW; - -#ifdef _UNICODE -typedef HH_POPUPW HH_POPUP; -#else -typedef HH_POPUPA HH_POPUP; -#endif - -typedef struct tagHH_ALINKA { - int cbStruct; - BOOL fReserved; - LPCSTR pszKeywords; - LPCSTR pszUrl; - LPCSTR pszMsgText; - LPCSTR pszMsgTitle; - LPCSTR pszWindow; - BOOL fIndexOnFail; -} HH_ALINKA; - -typedef struct tagHH_ALINKW { - int cbStruct; - BOOL fReserved; - LPCWSTR pszKeywords; - LPCWSTR pszUrl; - LPCWSTR pszMsgText; - LPCWSTR pszMsgTitle; - LPCWSTR pszWindow; - BOOL fIndexOnFail; -} HH_ALINKW; - -#ifdef _UNICODE -typedef HH_ALINKW HH_ALINK; -typedef HH_ALINKW HH_AKLINK; -#else -typedef HH_ALINKA HH_ALINK; -typedef HH_ALINKA HH_AKLINK; -#endif - -enum { - HHWIN_NAVTYPE_TOC, - HHWIN_NAVTYPE_INDEX, - HHWIN_NAVTYPE_SEARCH, - HHWIN_NAVTYPE_FAVORITES, - HHWIN_NAVTYPE_HISTORY, - HHWIN_NAVTYPE_AUTHOR, - HHWIN_NAVTYPE_CUSTOM_FIRST = 11 -}; - -enum { - IT_INCLUSIVE, - IT_EXCLUSIVE, - IT_HIDDEN -}; - -typedef struct tagHH_ENUM_IT { - int cbStruct; - int iType; - LPCSTR pszCatName; - LPCSTR pszITName; - LPCSTR pszITDescription; -} HH_ENUM_IT, *PHH_ENUM_IT; - -typedef struct tagHH_ENUM_CAT { - int cbStruct; - LPCSTR pszCatName; - LPCSTR pszCatDescription; -} HH_ENUM_CAT, *PHH_ENUM_CAT; - -typedef struct tagHH_SET_INFOTYPE { - int cbStruct; - LPCSTR pszCatName; - LPCSTR pszInfoTypeName; -} HH_SET_INFOTYPE; - -typedef DWORD HH_INFOTYPE, *PHH_INFOTYPE; - -enum { - HHWIN_NAVTAB_TOP, - HHWIN_NAVTAB_LEFT, - HHWIN_NAVTAB_BOTTOM -}; - -#define HH_MAX_TABS 19 - -enum { - HH_TAB_CONTENTS, - HH_TAB_INDEX, - HH_TAB_SEARCH, - HH_TAB_FAVORITES, - HH_TAB_HISTORY, - HH_TAB_AUTHOR, - HH_TAB_CUSTOM_FIRST = 11, - HH_TAB_CUSTOM_LAST = HH_MAX_TABS -}; - -#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST-HH_TAB_CUSTOM_FIRST+1) -#define HH_FTS_DEFAULT_PROXIMITY -1 - -typedef struct tagHH_FTS_QUERYA { - int cbStruct; - BOOL fUniCodeStrings; - LPCSTR pszSearchQuery; - LONG iProximity; - BOOL fStemmedSearch; - BOOL fTitleOnly; - BOOL fExecute; - LPCSTR pszWindow; -} HH_FTS_QUERYA; - -typedef struct tagHH_FTS_QUERYW { - int cbStruct; - BOOL fUniCodeStrings; - LPCWSTR pszSearchQuery; - LONG iProximity; - BOOL fStemmedSearch; - BOOL fTitleOnly; - BOOL fExecute; - LPCWSTR pszWindow; -} HH_FTS_QUERYW; - -#ifdef _UNICODE -typedef HH_FTS_QUERYW HH_FTS_QUERY; -#else -typedef HH_FTS_QUERYA HH_FTS_QUERY; -#endif - -typedef struct tagHH_WINTYPEA { - int cbStruct; - BOOL fUniCodeStrings; - LPCSTR pszType; - DWORD fsValidMembers; - DWORD fsWinProperties; - LPCSTR pszCaption; - DWORD dwStyles; - DWORD dwExStyles; - RECT rcWindowPos; - int nShowState; - HWND hwndHelp; - HWND hwndCaller; - PHH_INFOTYPE paInfoTypes; - HWND hwndToolBar; - HWND hwndNavigation; - HWND hwndHTML; - int iNavWidth; - RECT rcHTML; - LPCSTR pszToc; - LPCSTR pszIndex; - LPCSTR pszFile; - LPCSTR pszHome; - DWORD fsToolBarFlags; - BOOL fNotExpanded; - int curNavType; - int tabpos; - int idNotify; - BYTE tabOrder[HH_MAX_TABS+1]; - int cHistory; - LPCSTR pszJump1; - LPCSTR pszJump2; - LPCSTR pszUrlJump1; - LPCSTR pszUrlJump2; - RECT rcMinSize; - int cbInfoTypes; - LPCSTR pszCustomTabs; -} HH_WINTYPEA, *PHH_WINTYPEA; - -typedef struct tagHH_WINTYPEW { - int cbStruct; - BOOL fUniCodeStrings; - LPCWSTR pszType; - DWORD fsValidMembers; - DWORD fsWinProperties; - LPCWSTR pszCaption; - DWORD dwStyles; - DWORD dwExStyles; - RECT rcWindowPos; - int nShowState; - HWND hwndHelp; - HWND hwndCaller; - PHH_INFOTYPE paInfoTypes; - HWND hwndToolBar; - HWND hwndNavigation; - HWND hwndHTML; - int iNavWidth; - RECT rcHTML; - LPCWSTR pszToc; - LPCWSTR pszIndex; - LPCWSTR pszFile; - LPCWSTR pszHome; - DWORD fsToolBarFlags; - BOOL fNotExpanded; - int curNavType; - int tabpos; - int idNotify; - BYTE tabOrder[HH_MAX_TABS+1]; - int cHistory; - LPCWSTR pszJump1; - LPCWSTR pszJump2; - LPCWSTR pszUrlJump1; - LPCWSTR pszUrlJump2; - RECT rcMinSize; - int cbInfoTypes; - LPCWSTR pszCustomTabs; -} HH_WINTYPEW, *PHH_WINTYPEW; - -#ifdef _UNICODE -typedef HH_WINTYPEW HH_WINTYPE; -#else -typedef HH_WINTYPEA HH_WINTYPE; -#endif - -enum { - HHACT_TAB_CONTENTS, - HHACT_TAB_INDEX, - HHACT_TAB_SEARCH, - HHACT_TAB_HISTORY, - HHACT_TAB_FAVORITES, - HHACT_EXPAND, - HHACT_CONTRACT, - HHACT_BACK, - HHACT_FORWARD, - HHACT_STOP, - HHACT_REFRESH, - HHACT_HOME, - HHACT_SYNC, - HHACT_OPTIONS, - HHACT_PRINT, - HHACT_HIGHLIGHT, - HHACT_CUSTOMIZE, - HHACT_JUMP1, - HHACT_JUMP2, - HHACT_ZOOM, - HHACT_TOC_NEXT, - HHACT_TOC_PREV, - HHACT_NOTES, - HHACT_LAST_ENUM -}; - -typedef struct tagHH_NTRACKA { - NMHDR hdr; - PCSTR pszCurUrl; - int idAction; - PHH_WINTYPEA phhWinType; -} HH_NTRACKA; - -typedef struct tagHH_NTRACKW { - NMHDR hdr; - PCSTR pszCurUrl; - int idAction; - PHH_WINTYPEW phhWinType; -} HH_NTRACKW; - -#ifdef _UNICODE -typedef HH_NTRACKW HH_NTRACK; -#else -typedef HH_NTRACKA HH_NTRACK; -#endif - -HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); -HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); -#define HtmlHelp WINELIB_NAME_AW(HtmlHelp) - -#define ATOM_HTMLHELP_API_ANSI (LPTSTR)14 -#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)15 - -typedef enum tagHH_GPROPID { - HH_GPROPID_SINGLETHREAD = 1, - HH_GPROPID_TOOLBAR_MARGIN = 2, - HH_GPROPID_UI_LANGUAGE = 3, - HH_GPROPID_CURRENT_SUBSET = 4, - HH_GPROPID_CONTENT_LANGUAGE = 5 -} HH_GPROPID; - -#ifdef __WIDL_OAIDL_H - -typedef struct tagHH_GLOBAL_PROPERTY -{ - HH_GPROPID id; - VARIANT var; -} HH_GLOBAL_PROPERTY ; - -#endif /* __WIDL_OAIDL_H */ - -#ifdef __cplusplus -} -#endif - -#endif /* __HTMLHELP_H__ */ +/* + * wx/msw/htmlhelp.h + * Copyright 2004 Jacek Caban + * + * Originally written for the Wine project, and issued under + * the wxWindows License by kind permission of the author. + * + * License: wxWindows License + */ + +#ifndef __HTMLHELP_H__ +#define __HTMLHELP_H__ + +#define HH_DISPLAY_TOPIC 0x00 +#define HH_HELP_FINDER 0x00 +#define HH_DISPLAY_TOC 0x01 +#define HH_DISPLAY_INDEX 0x02 +#define HH_DISPLAY_SEARCH 0x03 +#define HH_SET_WIN_TYPE 0x04 +#define HH_GET_WIN_TYPE 0x05 +#define HH_GET_WIN_HANDLE 0x06 +#define HH_ENUM_INFO_TYPE 0x07 +#define HH_SET_INFO_TYPE 0x08 +#define HH_SYNC 0x09 +#define HH_RESERVED1 0x0A +#define HH_RESERVED2 0x0B +#define HH_RESERVED3 0x0C +#define HH_KEYWORD_LOOKUP 0x0D +#define HH_DISPLAY_TEXT_POPUP 0x0E +#define HH_HELP_CONTEXT 0x0F +#define HH_TP_HELP_CONTEXTMENU 0x10 +#define HH_TP_HELP_WM_HELP 0x11 +#define HH_CLOSE_ALL 0x12 +#define HH_ALINK_LOOKUP 0x13 +#define HH_GET_LAST_ERROR 0x14 +#define HH_ENUM_CATEGORY 0x15 +#define HH_ENUM_CATEGORY_IT 0x16 +#define HH_RESET_IT_FILTER 0x17 +#define HH_SET_INCLUSIVE_FILTER 0x18 +#define HH_SET_EXCLUSIVE_FILTER 0x19 +#define HH_INITIALIZE 0x1C +#define HH_UNINITIALIZE 0x1D +#define HH_PRETRANSLATEMESSAGE 0xFD +#define HH_SET_GLOBAL_PROPERTY 0xFC + +#define HHWIN_PROP_TAB_AUTOHIDESHOW 0x00000001 +#define HHWIN_PROP_ONTOP 0x00000002 +#define HHWIN_PROP_NOTITLEBAR 0x00000004 +#define HHWIN_PROP_NODEF_STYLES 0x00000008 +#define HHWIN_PROP_NODEF_EXSTYLES 0x00000010 +#define HHWIN_PROP_TRI_PANE 0x00000020 +#define HHWIN_PROP_NOTB_TEXT 0x00000040 +#define HHWIN_PROP_POST_QUIT 0x00000080 +#define HHWIN_PROP_AUTO_SYNC 0x00000100 +#define HHWIN_PROP_TRACKING 0x00000200 +#define HHWIN_PROP_TAB_SEARCH 0x00000400 +#define HHWIN_PROP_TAB_HISTORY 0x00000800 +#define HHWIN_PROP_TAB_FAVORITES 0x00001000 +#define HHWIN_PROP_CHANGE_TITLE 0x00002000 +#define HHWIN_PROP_NAV_ONLY_WIN 0x00004000 +#define HHWIN_PROP_NO_TOOLBAR 0x00008000 +#define HHWIN_PROP_MENU 0x00010000 +#define HHWIN_PROP_TAB_ADVSEARCH 0x00020000 +#define HHWIN_PROP_USER_POS 0x00040000 +#define HHWIN_PROP_TAB_CUSTOM1 0x00080000 +#define HHWIN_PROP_TAB_CUSTOM2 0x00100000 +#define HHWIN_PROP_TAB_CUSTOM3 0x00200000 +#define HHWIN_PROP_TAB_CUSTOM4 0x00400000 +#define HHWIN_PROP_TAB_CUSTOM5 0x00800000 +#define HHWIN_PROP_TAB_CUSTOM6 0x01000000 +#define HHWIN_PROP_TAB_CUSTOM7 0x02000000 +#define HHWIN_PROP_TAB_CUSTOM8 0x04000000 +#define HHWIN_PROP_TAB_CUSTOM9 0x08000000 +#define HHWIN_TB_MARGIN 0x10000000 + +#define HHWIN_PARAM_PROPERTIES 0x00000002 +#define HHWIN_PARAM_STYLES 0x00000004 +#define HHWIN_PARAM_EXSTYLES 0x00000008 +#define HHWIN_PARAM_RECT 0x00000010 +#define HHWIN_PARAM_NAV_WIDTH 0x00000020 +#define HHWIN_PARAM_SHOWSTATE 0x00000040 +#define HHWIN_PARAM_INFOTYPES 0x00000080 +#define HHWIN_PARAM_TB_FLAGS 0x00000100 +#define HHWIN_PARAM_EXPANSION 0x00000200 +#define HHWIN_PARAM_TABPOS 0x00000400 +#define HHWIN_PARAM_TABORDER 0x00000800 +#define HHWIN_PARAM_HISTORY_COUNT 0x00001000 +#define HHWIN_PARAM_CUR_TAB 0x00002000 + +#define HHWIN_BUTTON_EXPAND 0x00000002 +#define HHWIN_BUTTON_BACK 0x00000004 +#define HHWIN_BUTTON_FORWARD 0x00000008 +#define HHWIN_BUTTON_STOP 0x00000010 +#define HHWIN_BUTTON_REFRESH 0x00000020 +#define HHWIN_BUTTON_HOME 0x00000040 +#define HHWIN_BUTTON_BROWSE_FWD 0x00000080 +#define HHWIN_BUTTON_BROWSE_BCK 0x00000100 +#define HHWIN_BUTTON_NOTES 0x00000200 +#define HHWIN_BUTTON_CONTENTS 0x00000400 +#define HHWIN_BUTTON_SYNC 0x00000800 +#define HHWIN_BUTTON_OPTIONS 0x00001000 +#define HHWIN_BUTTON_PRINT 0x00002000 +#define HHWIN_BUTTON_INDEX 0x00004000 +#define HHWIN_BUTTON_SEARCH 0x00008000 +#define HHWIN_BUTTON_HISTORY 0x00010000 +#define HHWIN_BUTTON_FAVORITES 0x00020000 +#define HHWIN_BUTTON_JUMP1 0x00040000 +#define HHWIN_BUTTON_JUMP2 0x00080000 +#define HHWIN_BUTTON_ZOOM 0x00100000 +#define HHWIN_BUTTON_TOC_NEXT 0x00200000 +#define HHWIN_BUTTON_TOC_PREV 0x00400000 + +#define HHWIN_DEF_BUTTONS \ + (HHWIN_BUTTON_EXPAND | HHWIN_BUTTON_BACK | HHWIN_BUTTON_OPTIONS | HHWIN_BUTTON_PRINT) + +#define IDTB_EXPAND 200 +#define IDTB_CONTRACT 201 +#define IDTB_STOP 202 +#define IDTB_REFRESH 203 +#define IDTB_BACK 204 +#define IDTB_HOME 205 +#define IDTB_SYNC 206 +#define IDTB_PRINT 207 +#define IDTB_OPTIONS 208 +#define IDTB_FORWARD 209 +#define IDTB_NOTES 210 +#define IDTB_BROWSE_FWD 211 +#define IDTB_BROWSE_BACK 212 +#define IDTB_CONTENTS 213 +#define IDTB_INDEX 214 +#define IDTB_SEARCH 215 +#define IDTB_HISTORY 216 +#define IDTB_FAVORITES 217 +#define IDTB_JUMP1 218 +#define IDTB_JUMP2 219 +#define IDTB_CUSTOMIZE 221 +#define IDTB_ZOOM 222 +#define IDTB_TOC_NEXT 223 +#define IDTB_TOC_PREV 224 + +#define HHN_FIRST (0U-860U) +#define HHN_LAST (0U-879U) +#define HHN_NAVCOMPLETE HHN_FIRST +#define HHN_TRACK (HHN_FIRST-1) +#define HHN_WINDOW_CREATE (HHN_FIRST-2) + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct tagHH_NOTIFY { + NMHDR hdr; + PCSTR pszurl; +} HH_NOTIFY; + +typedef struct tagHH_POPUPA { + int cbStruct; + HINSTANCE hinst; + UINT idString; + LPCSTR pszText; + POINT pt; + COLORREF clrForeground; + COLORREF clrBackground; + RECT rcMargins; + LPCSTR pszFont; +} HH_POPUPA; + +typedef struct tagHH_POPUPW { + int cbStruct; + HINSTANCE hinst; + UINT idString; + LPCWSTR pszText; + POINT pt; + COLORREF clrForeground; + COLORREF clrBackground; + RECT rcMargins; + LPCWSTR pszFont; +} HH_POPUPW; + +#ifdef _UNICODE +typedef HH_POPUPW HH_POPUP; +#else +typedef HH_POPUPA HH_POPUP; +#endif + +typedef struct tagHH_ALINKA { + int cbStruct; + BOOL fReserved; + LPCSTR pszKeywords; + LPCSTR pszUrl; + LPCSTR pszMsgText; + LPCSTR pszMsgTitle; + LPCSTR pszWindow; + BOOL fIndexOnFail; +} HH_ALINKA; + +typedef struct tagHH_ALINKW { + int cbStruct; + BOOL fReserved; + LPCWSTR pszKeywords; + LPCWSTR pszUrl; + LPCWSTR pszMsgText; + LPCWSTR pszMsgTitle; + LPCWSTR pszWindow; + BOOL fIndexOnFail; +} HH_ALINKW; + +#ifdef _UNICODE +typedef HH_ALINKW HH_ALINK; +typedef HH_ALINKW HH_AKLINK; +#else +typedef HH_ALINKA HH_ALINK; +typedef HH_ALINKA HH_AKLINK; +#endif + +enum { + HHWIN_NAVTYPE_TOC, + HHWIN_NAVTYPE_INDEX, + HHWIN_NAVTYPE_SEARCH, + HHWIN_NAVTYPE_FAVORITES, + HHWIN_NAVTYPE_HISTORY, + HHWIN_NAVTYPE_AUTHOR, + HHWIN_NAVTYPE_CUSTOM_FIRST = 11 +}; + +enum { + IT_INCLUSIVE, + IT_EXCLUSIVE, + IT_HIDDEN +}; + +typedef struct tagHH_ENUM_IT { + int cbStruct; + int iType; + LPCSTR pszCatName; + LPCSTR pszITName; + LPCSTR pszITDescription; +} HH_ENUM_IT, *PHH_ENUM_IT; + +typedef struct tagHH_ENUM_CAT { + int cbStruct; + LPCSTR pszCatName; + LPCSTR pszCatDescription; +} HH_ENUM_CAT, *PHH_ENUM_CAT; + +typedef struct tagHH_SET_INFOTYPE { + int cbStruct; + LPCSTR pszCatName; + LPCSTR pszInfoTypeName; +} HH_SET_INFOTYPE; + +typedef DWORD HH_INFOTYPE, *PHH_INFOTYPE; + +enum { + HHWIN_NAVTAB_TOP, + HHWIN_NAVTAB_LEFT, + HHWIN_NAVTAB_BOTTOM +}; + +#define HH_MAX_TABS 19 + +enum { + HH_TAB_CONTENTS, + HH_TAB_INDEX, + HH_TAB_SEARCH, + HH_TAB_FAVORITES, + HH_TAB_HISTORY, + HH_TAB_AUTHOR, + HH_TAB_CUSTOM_FIRST = 11, + HH_TAB_CUSTOM_LAST = HH_MAX_TABS +}; + +#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST-HH_TAB_CUSTOM_FIRST+1) +#define HH_FTS_DEFAULT_PROXIMITY -1 + +typedef struct tagHH_FTS_QUERYA { + int cbStruct; + BOOL fUniCodeStrings; + LPCSTR pszSearchQuery; + LONG iProximity; + BOOL fStemmedSearch; + BOOL fTitleOnly; + BOOL fExecute; + LPCSTR pszWindow; +} HH_FTS_QUERYA; + +typedef struct tagHH_FTS_QUERYW { + int cbStruct; + BOOL fUniCodeStrings; + LPCWSTR pszSearchQuery; + LONG iProximity; + BOOL fStemmedSearch; + BOOL fTitleOnly; + BOOL fExecute; + LPCWSTR pszWindow; +} HH_FTS_QUERYW; + +#ifdef _UNICODE +typedef HH_FTS_QUERYW HH_FTS_QUERY; +#else +typedef HH_FTS_QUERYA HH_FTS_QUERY; +#endif + +typedef struct tagHH_WINTYPEA { + int cbStruct; + BOOL fUniCodeStrings; + LPCSTR pszType; + DWORD fsValidMembers; + DWORD fsWinProperties; + LPCSTR pszCaption; + DWORD dwStyles; + DWORD dwExStyles; + RECT rcWindowPos; + int nShowState; + HWND hwndHelp; + HWND hwndCaller; + PHH_INFOTYPE paInfoTypes; + HWND hwndToolBar; + HWND hwndNavigation; + HWND hwndHTML; + int iNavWidth; + RECT rcHTML; + LPCSTR pszToc; + LPCSTR pszIndex; + LPCSTR pszFile; + LPCSTR pszHome; + DWORD fsToolBarFlags; + BOOL fNotExpanded; + int curNavType; + int tabpos; + int idNotify; + BYTE tabOrder[HH_MAX_TABS+1]; + int cHistory; + LPCSTR pszJump1; + LPCSTR pszJump2; + LPCSTR pszUrlJump1; + LPCSTR pszUrlJump2; + RECT rcMinSize; + int cbInfoTypes; + LPCSTR pszCustomTabs; +} HH_WINTYPEA, *PHH_WINTYPEA; + +typedef struct tagHH_WINTYPEW { + int cbStruct; + BOOL fUniCodeStrings; + LPCWSTR pszType; + DWORD fsValidMembers; + DWORD fsWinProperties; + LPCWSTR pszCaption; + DWORD dwStyles; + DWORD dwExStyles; + RECT rcWindowPos; + int nShowState; + HWND hwndHelp; + HWND hwndCaller; + PHH_INFOTYPE paInfoTypes; + HWND hwndToolBar; + HWND hwndNavigation; + HWND hwndHTML; + int iNavWidth; + RECT rcHTML; + LPCWSTR pszToc; + LPCWSTR pszIndex; + LPCWSTR pszFile; + LPCWSTR pszHome; + DWORD fsToolBarFlags; + BOOL fNotExpanded; + int curNavType; + int tabpos; + int idNotify; + BYTE tabOrder[HH_MAX_TABS+1]; + int cHistory; + LPCWSTR pszJump1; + LPCWSTR pszJump2; + LPCWSTR pszUrlJump1; + LPCWSTR pszUrlJump2; + RECT rcMinSize; + int cbInfoTypes; + LPCWSTR pszCustomTabs; +} HH_WINTYPEW, *PHH_WINTYPEW; + +#ifdef _UNICODE +typedef HH_WINTYPEW HH_WINTYPE; +#else +typedef HH_WINTYPEA HH_WINTYPE; +#endif + +enum { + HHACT_TAB_CONTENTS, + HHACT_TAB_INDEX, + HHACT_TAB_SEARCH, + HHACT_TAB_HISTORY, + HHACT_TAB_FAVORITES, + HHACT_EXPAND, + HHACT_CONTRACT, + HHACT_BACK, + HHACT_FORWARD, + HHACT_STOP, + HHACT_REFRESH, + HHACT_HOME, + HHACT_SYNC, + HHACT_OPTIONS, + HHACT_PRINT, + HHACT_HIGHLIGHT, + HHACT_CUSTOMIZE, + HHACT_JUMP1, + HHACT_JUMP2, + HHACT_ZOOM, + HHACT_TOC_NEXT, + HHACT_TOC_PREV, + HHACT_NOTES, + HHACT_LAST_ENUM +}; + +typedef struct tagHH_NTRACKA { + NMHDR hdr; + PCSTR pszCurUrl; + int idAction; + PHH_WINTYPEA phhWinType; +} HH_NTRACKA; + +typedef struct tagHH_NTRACKW { + NMHDR hdr; + PCSTR pszCurUrl; + int idAction; + PHH_WINTYPEW phhWinType; +} HH_NTRACKW; + +#ifdef _UNICODE +typedef HH_NTRACKW HH_NTRACK; +#else +typedef HH_NTRACKA HH_NTRACK; +#endif + +HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); +HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); +#define HtmlHelp WINELIB_NAME_AW(HtmlHelp) + +#define ATOM_HTMLHELP_API_ANSI (LPTSTR)14 +#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)15 + +typedef enum tagHH_GPROPID { + HH_GPROPID_SINGLETHREAD = 1, + HH_GPROPID_TOOLBAR_MARGIN = 2, + HH_GPROPID_UI_LANGUAGE = 3, + HH_GPROPID_CURRENT_SUBSET = 4, + HH_GPROPID_CONTENT_LANGUAGE = 5 +} HH_GPROPID; + +#ifdef __WIDL_OAIDL_H + +typedef struct tagHH_GLOBAL_PROPERTY +{ + HH_GPROPID id; + VARIANT var; +} HH_GLOBAL_PROPERTY ; + +#endif /* __WIDL_OAIDL_H */ + +#ifdef __cplusplus +} +#endif + +#endif /* __HTMLHELP_H__ */ diff --git a/Externals/wxWidgets/include/wx/msw/icon.h b/Externals/wxWidgets/include/wx/msw/icon.h index d716a26a5a..c9b822cd17 100644 --- a/Externals/wxWidgets/include/wx/msw/icon.h +++ b/Externals/wxWidgets/include/wx/msw/icon.h @@ -1,95 +1,95 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/icon.h -// Purpose: wxIcon class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: icon.h 42752 2006-10-30 19:26:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICON_H_ -#define _WX_ICON_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/msw/gdiimage.h" - -// --------------------------------------------------------------------------- -// icon data -// --------------------------------------------------------------------------- - -// notice that although wxIconRefData inherits from wxBitmapRefData, it is not -// a valid wxBitmapRefData -class WXDLLEXPORT wxIconRefData : public wxGDIImageRefData -{ -public: - wxIconRefData() { } - virtual ~wxIconRefData() { Free(); } - - virtual void Free(); -}; - -// --------------------------------------------------------------------------- -// Icon -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxIcon : public wxGDIImage -{ -public: - // ctors - // default - wxIcon() { } - - // from raw data - wxIcon(const char bits[], int width, int height); - - // from XPM data - wxIcon(const char **data) { CreateIconFromXpm(data); } - - wxIcon(char **data) { CreateIconFromXpm((const char **)data); } - - // from resource/file - wxIcon(const wxString& name, - long type = wxBITMAP_TYPE_ICO_RESOURCE, - int desiredWidth = -1, int desiredHeight = -1); - - wxIcon(const wxIconLocation& loc); - - virtual ~wxIcon(); - - virtual bool LoadFile(const wxString& name, - long type = wxBITMAP_TYPE_ICO_RESOURCE, - int desiredWidth = -1, int desiredHeight = -1); - - // implementation only from now on - wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } - - void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); } - WXHICON GetHICON() const { return (WXHICON)GetHandle(); } - - // create from bitmap (which should have a mask unless it's monochrome): - // there shouldn't be any implicit bitmap -> icon conversion (i.e. no - // ctors, assignment operators...), but it's ok to have such function - void CopyFromBitmap(const wxBitmap& bmp); - -protected: - virtual wxGDIImageRefData *CreateData() const - { - return new wxIconRefData; - } - - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - // create from XPM data - void CreateIconFromXpm(const char **data); - -private: - DECLARE_DYNAMIC_CLASS(wxIcon) -}; - -#endif - // _WX_ICON_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/icon.h +// Purpose: wxIcon class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: icon.h 42752 2006-10-30 19:26:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_ +#define _WX_ICON_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/msw/gdiimage.h" + +// --------------------------------------------------------------------------- +// icon data +// --------------------------------------------------------------------------- + +// notice that although wxIconRefData inherits from wxBitmapRefData, it is not +// a valid wxBitmapRefData +class WXDLLEXPORT wxIconRefData : public wxGDIImageRefData +{ +public: + wxIconRefData() { } + virtual ~wxIconRefData() { Free(); } + + virtual void Free(); +}; + +// --------------------------------------------------------------------------- +// Icon +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxIcon : public wxGDIImage +{ +public: + // ctors + // default + wxIcon() { } + + // from raw data + wxIcon(const char bits[], int width, int height); + + // from XPM data + wxIcon(const char **data) { CreateIconFromXpm(data); } + + wxIcon(char **data) { CreateIconFromXpm((const char **)data); } + + // from resource/file + wxIcon(const wxString& name, + long type = wxBITMAP_TYPE_ICO_RESOURCE, + int desiredWidth = -1, int desiredHeight = -1); + + wxIcon(const wxIconLocation& loc); + + virtual ~wxIcon(); + + virtual bool LoadFile(const wxString& name, + long type = wxBITMAP_TYPE_ICO_RESOURCE, + int desiredWidth = -1, int desiredHeight = -1); + + // implementation only from now on + wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } + + void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); } + WXHICON GetHICON() const { return (WXHICON)GetHandle(); } + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); + +protected: + virtual wxGDIImageRefData *CreateData() const + { + return new wxIconRefData; + } + + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + // create from XPM data + void CreateIconFromXpm(const char **data); + +private: + DECLARE_DYNAMIC_CLASS(wxIcon) +}; + +#endif + // _WX_ICON_H_ diff --git a/Externals/wxWidgets/include/wx/msw/imaglist.h b/Externals/wxWidgets/include/wx/msw/imaglist.h index b31c73539d..9b72aaaa8d 100644 --- a/Externals/wxWidgets/include/wx/msw/imaglist.h +++ b/Externals/wxWidgets/include/wx/msw/imaglist.h @@ -1,206 +1,206 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/imaglist.h -// Purpose: wxImageList class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: imaglist.h 41271 2006-09-18 04:41:09Z KO $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_ -#define _WX_IMAGLIST_H_ - -#include "wx/bitmap.h" - -// Eventually we'll make this a reference-counted wxGDIObject. For -// now, the app must take care of ownership issues. That is, the -// image lists must be explicitly deleted after the control(s) that uses them -// is (are) deleted, or when the app exits. -class WXDLLEXPORT wxImageList : public wxObject -{ -public: - /* - * Public interface - */ - - wxImageList(); - - // Creates an image list. - // Specify the width and height of the images in the list, - // whether there are masks associated with them (e.g. if creating images - // from icons), and the initial size of the list. - wxImageList(int width, int height, bool mask = true, int initialCount = 1) - { - Create(width, height, mask, initialCount); - } - virtual ~wxImageList(); - - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Returns the number of images in the image list. - int GetImageCount() const; - - // Returns the size (same for all images) of the images in the list - bool GetSize(int index, int &width, int &height) const; - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Creates an image list - // width, height specify the size of the images in the list (all the same). - // mask specifies whether the images have masks or not. - // initialNumber is the initial number of images to reserve. - bool Create(int width, int height, bool mask = true, int initialNumber = 1); - - // Adds a bitmap, and optionally a mask bitmap. - // Note that wxImageList creates *new* bitmaps, so you may delete - // 'bitmap' and 'mask' after calling Add. - int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - - // Adds a bitmap, using the specified colour to create the mask bitmap - // Note that wxImageList creates *new* bitmaps, so you may delete - // 'bitmap' after calling Add. - int Add(const wxBitmap& bitmap, const wxColour& maskColour); - - // Adds a bitmap and mask from an icon. - int Add(const wxIcon& icon); - - // Replaces a bitmap, optionally passing a mask bitmap. - // Note that wxImageList creates new bitmaps, so you may delete - // 'bitmap' and 'mask' after calling Replace. - bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - -/* Not supported by Win95 - // Replacing a bitmap, using the specified colour to create the mask bitmap - // Note that wxImageList creates new bitmaps, so you may delete - // 'bitmap'. - bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour); -*/ - - // Replaces a bitmap and mask from an icon. - // You can delete 'icon' after calling Replace. - bool Replace(int index, const wxIcon& icon); - - // Removes the image at the given index. - bool Remove(int index); - - // Remove all images - bool RemoveAll(); - - // Draws the given image on a dc at the specified position. - // If 'solidBackground' is true, Draw sets the image list background - // colour to the background colour of the wxDC, to speed up - // drawing by eliminating masked drawing where possible. - bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, - bool solidBackground = false); - - // Get a bitmap - wxBitmap GetBitmap(int index) const; - - // Get an icon - wxIcon GetIcon(int index) const; - - // TODO: miscellaneous functionality -/* - wxIcon *MakeIcon(int index); - bool SetOverlayImage(int index, int overlayMask); - -*/ - - // TODO: Drag-and-drop related functionality. - -#if 0 - // Creates a new drag image by combining the given image (typically a mouse cursor image) - // with the current drag image. - bool SetDragCursorImage(int index, const wxPoint& hotSpot); - - // If successful, returns a pointer to the temporary image list that is used for dragging; - // otherwise, NULL. - // dragPos: receives the current drag position. - // hotSpot: receives the offset of the drag image relative to the drag position. - static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot); - - // Call this function to begin dragging an image. This function creates a temporary image list - // that is used for dragging. The image combines the specified image and its mask with the - // current cursor. In response to subsequent mouse move messages, you can move the drag image - // by using the DragMove member function. To end the drag operation, you can use the EndDrag - // member function. - bool BeginDrag(int index, const wxPoint& hotSpot); - - // Ends a drag operation. - bool EndDrag(); - - // Call this function to move the image that is being dragged during a drag-and-drop operation. - // This function is typically called in response to a mouse move message. To begin a drag - // operation, use the BeginDrag member function. - static bool DragMove(const wxPoint& point); - - // During a drag operation, locks updates to the window specified by lockWindow and displays - // the drag image at the position specified by point. - // The coordinates are relative to the window's upper left corner, so you must compensate - // for the widths of window elements, such as the border, title bar, and menu bar, when - // specifying the coordinates. - // If lockWindow is NULL, this function draws the image in the display context associated - // with the desktop window, and coordinates are relative to the upper left corner of the screen. - // This function locks all other updates to the given window during the drag operation. - // If you need to do any drawing during a drag operation, such as highlighting the target - // of a drag-and-drop operation, you can temporarily hide the dragged image by using the - // wxImageList::DragLeave function. - - // lockWindow: pointer to the window that owns the drag image. - // point: position at which to display the drag image. Coordinates are relative to the - // upper left corner of the window (not the client area). - - static bool DragEnter( wxWindow *lockWindow, const wxPoint& point ); - - // Unlocks the window specified by pWndLock and hides the drag image, allowing the - // window to be updated. - static bool DragLeave( wxWindow *lockWindow ); - - /* Here's roughly how you'd use these functions if implemented in this Win95-like way: - - 1) Starting to drag: - - wxImageList *dragImageList = new wxImageList(16, 16, true); - dragImageList->Add(myDragImage); // Provide an image to combine with the current cursor - dragImageList->BeginDrag(0, wxPoint(0, 0)); - wxShowCursor(false); // wxShowCursor not yet implemented in wxWin - myWindow->CaptureMouse(); - - 2) Dragging: - - // Called within mouse move event. Could also use dragImageList instead of assuming - // these are static functions. - // These two functions could possibly be combined into one, since DragEnter is - // a bit obscure. - wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position - wxImageList::DragEnter(NULL, wxPoint(x, y)); // NULL assumes dragging across whole screen - - 3) Finishing dragging: - - dragImageList->EndDrag(); - myWindow->ReleaseMouse(); - wxShowCursor(true); -*/ - -#endif - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - // Returns the native image list handle - WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } - -protected: - WXHIMAGELIST m_hImageList; - - DECLARE_DYNAMIC_CLASS(wxImageList) -}; - -#endif - // _WX_IMAGLIST_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/imaglist.h +// Purpose: wxImageList class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: imaglist.h 41271 2006-09-18 04:41:09Z KO $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_ +#define _WX_IMAGLIST_H_ + +#include "wx/bitmap.h" + +// Eventually we'll make this a reference-counted wxGDIObject. For +// now, the app must take care of ownership issues. That is, the +// image lists must be explicitly deleted after the control(s) that uses them +// is (are) deleted, or when the app exits. +class WXDLLEXPORT wxImageList : public wxObject +{ +public: + /* + * Public interface + */ + + wxImageList(); + + // Creates an image list. + // Specify the width and height of the images in the list, + // whether there are masks associated with them (e.g. if creating images + // from icons), and the initial size of the list. + wxImageList(int width, int height, bool mask = true, int initialCount = 1) + { + Create(width, height, mask, initialCount); + } + virtual ~wxImageList(); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Returns the number of images in the image list. + int GetImageCount() const; + + // Returns the size (same for all images) of the images in the list + bool GetSize(int index, int &width, int &height) const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Creates an image list + // width, height specify the size of the images in the list (all the same). + // mask specifies whether the images have masks or not. + // initialNumber is the initial number of images to reserve. + bool Create(int width, int height, bool mask = true, int initialNumber = 1); + + // Adds a bitmap, and optionally a mask bitmap. + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Add. + int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + + // Adds a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' after calling Add. + int Add(const wxBitmap& bitmap, const wxColour& maskColour); + + // Adds a bitmap and mask from an icon. + int Add(const wxIcon& icon); + + // Replaces a bitmap, optionally passing a mask bitmap. + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Replace. + bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + +/* Not supported by Win95 + // Replacing a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap'. + bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour); +*/ + + // Replaces a bitmap and mask from an icon. + // You can delete 'icon' after calling Replace. + bool Replace(int index, const wxIcon& icon); + + // Removes the image at the given index. + bool Remove(int index); + + // Remove all images + bool RemoveAll(); + + // Draws the given image on a dc at the specified position. + // If 'solidBackground' is true, Draw sets the image list background + // colour to the background colour of the wxDC, to speed up + // drawing by eliminating masked drawing where possible. + bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = false); + + // Get a bitmap + wxBitmap GetBitmap(int index) const; + + // Get an icon + wxIcon GetIcon(int index) const; + + // TODO: miscellaneous functionality +/* + wxIcon *MakeIcon(int index); + bool SetOverlayImage(int index, int overlayMask); + +*/ + + // TODO: Drag-and-drop related functionality. + +#if 0 + // Creates a new drag image by combining the given image (typically a mouse cursor image) + // with the current drag image. + bool SetDragCursorImage(int index, const wxPoint& hotSpot); + + // If successful, returns a pointer to the temporary image list that is used for dragging; + // otherwise, NULL. + // dragPos: receives the current drag position. + // hotSpot: receives the offset of the drag image relative to the drag position. + static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot); + + // Call this function to begin dragging an image. This function creates a temporary image list + // that is used for dragging. The image combines the specified image and its mask with the + // current cursor. In response to subsequent mouse move messages, you can move the drag image + // by using the DragMove member function. To end the drag operation, you can use the EndDrag + // member function. + bool BeginDrag(int index, const wxPoint& hotSpot); + + // Ends a drag operation. + bool EndDrag(); + + // Call this function to move the image that is being dragged during a drag-and-drop operation. + // This function is typically called in response to a mouse move message. To begin a drag + // operation, use the BeginDrag member function. + static bool DragMove(const wxPoint& point); + + // During a drag operation, locks updates to the window specified by lockWindow and displays + // the drag image at the position specified by point. + // The coordinates are relative to the window's upper left corner, so you must compensate + // for the widths of window elements, such as the border, title bar, and menu bar, when + // specifying the coordinates. + // If lockWindow is NULL, this function draws the image in the display context associated + // with the desktop window, and coordinates are relative to the upper left corner of the screen. + // This function locks all other updates to the given window during the drag operation. + // If you need to do any drawing during a drag operation, such as highlighting the target + // of a drag-and-drop operation, you can temporarily hide the dragged image by using the + // wxImageList::DragLeave function. + + // lockWindow: pointer to the window that owns the drag image. + // point: position at which to display the drag image. Coordinates are relative to the + // upper left corner of the window (not the client area). + + static bool DragEnter( wxWindow *lockWindow, const wxPoint& point ); + + // Unlocks the window specified by pWndLock and hides the drag image, allowing the + // window to be updated. + static bool DragLeave( wxWindow *lockWindow ); + + /* Here's roughly how you'd use these functions if implemented in this Win95-like way: + + 1) Starting to drag: + + wxImageList *dragImageList = new wxImageList(16, 16, true); + dragImageList->Add(myDragImage); // Provide an image to combine with the current cursor + dragImageList->BeginDrag(0, wxPoint(0, 0)); + wxShowCursor(false); // wxShowCursor not yet implemented in wxWin + myWindow->CaptureMouse(); + + 2) Dragging: + + // Called within mouse move event. Could also use dragImageList instead of assuming + // these are static functions. + // These two functions could possibly be combined into one, since DragEnter is + // a bit obscure. + wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position + wxImageList::DragEnter(NULL, wxPoint(x, y)); // NULL assumes dragging across whole screen + + 3) Finishing dragging: + + dragImageList->EndDrag(); + myWindow->ReleaseMouse(); + wxShowCursor(true); +*/ + +#endif + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Returns the native image list handle + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +protected: + WXHIMAGELIST m_hImageList; + + DECLARE_DYNAMIC_CLASS(wxImageList) +}; + +#endif + // _WX_IMAGLIST_H_ diff --git a/Externals/wxWidgets/include/wx/msw/iniconf.h b/Externals/wxWidgets/include/wx/msw/iniconf.h index 504d21c716..40d6875881 100644 --- a/Externals/wxWidgets/include/wx/msw/iniconf.h +++ b/Externals/wxWidgets/include/wx/msw/iniconf.h @@ -1,95 +1,95 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/iniconf.h -// Purpose: INI-file based wxConfigBase implementation -// Author: Vadim Zeitlin -// Modified by: -// Created: 27.07.98 -// RCS-ID: $Id: iniconf.h 28931 2004-08-27 18:59:37Z ABX $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _INICONF_H -#define _INICONF_H - -// ---------------------------------------------------------------------------- -// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to -// store the data. Because INI files don't really support arbitrary nesting of -// groups, we do the following: -// (1) in win.ini file we store all entries in the [vendor] section and -// the value group1/group2/key is mapped to the value group1_group2_key -// in this section, i.e. all path separators are replaced with underscore -// (2) in appname.ini file we map group1/group2/group3/key to the entry -// group2_group3_key in [group1] -// -// Of course, it might lead to indesirable results if '_' is also used in key -// names (i.e. group/key is the same as group_key) and also GetPath() result -// may be not what you would expect it to be. -// -// Another limitation: the keys and section names are never case-sensitive -// which might differ from wxFileConfig it it was compiled with -// wxCONFIG_CASE_SENSITIVE option. -// ---------------------------------------------------------------------------- - -// for this class, "local" file is the file appname.ini and the global file -// is the [vendor] subsection of win.ini (default for "vendor" is to be the -// same as appname). The file name (strAppName parameter) may, in fact, -// contain the full path to the file. If it doesn't, the file is searched for -// in the Windows directory. -class WXDLLEXPORT wxIniConfig : public wxConfigBase -{ -public: - // ctor & dtor - // if strAppName doesn't contain the extension and is not an absolute path, - // ".ini" is appended to it. if strVendor is empty, it's taken to be the - // same as strAppName. - wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString, - const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE); - virtual ~wxIniConfig(); - - // implement inherited pure virtual functions - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const; - - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; - - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; - - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; - - // return true if the current group is empty - bool IsEmpty() const; - - virtual bool Flush(bool bCurrentOnly = false); - - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - - virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& szKey); - virtual bool DeleteAll(); - -protected: - // read/write - bool DoReadString(const wxString& key, wxString *pStr) const; - bool DoReadLong(const wxString& key, long *plResult) const; - - bool DoWriteString(const wxString& key, const wxString& szValue); - bool DoWriteLong(const wxString& key, long lValue); - -private: - // helpers - wxString GetPrivateKeyName(const wxString& szKey) const; - wxString GetKeyName(const wxString& szKey) const; - - wxString m_strLocalFilename; // name of the private INI file - wxString m_strGroup, // current group in appname.ini file - m_strPath; // the rest of the path (no trailing '_'!) -}; - -#endif //_INICONF_H +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/iniconf.h +// Purpose: INI-file based wxConfigBase implementation +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.07.98 +// RCS-ID: $Id: iniconf.h 28931 2004-08-27 18:59:37Z ABX $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _INICONF_H +#define _INICONF_H + +// ---------------------------------------------------------------------------- +// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to +// store the data. Because INI files don't really support arbitrary nesting of +// groups, we do the following: +// (1) in win.ini file we store all entries in the [vendor] section and +// the value group1/group2/key is mapped to the value group1_group2_key +// in this section, i.e. all path separators are replaced with underscore +// (2) in appname.ini file we map group1/group2/group3/key to the entry +// group2_group3_key in [group1] +// +// Of course, it might lead to indesirable results if '_' is also used in key +// names (i.e. group/key is the same as group_key) and also GetPath() result +// may be not what you would expect it to be. +// +// Another limitation: the keys and section names are never case-sensitive +// which might differ from wxFileConfig it it was compiled with +// wxCONFIG_CASE_SENSITIVE option. +// ---------------------------------------------------------------------------- + +// for this class, "local" file is the file appname.ini and the global file +// is the [vendor] subsection of win.ini (default for "vendor" is to be the +// same as appname). The file name (strAppName parameter) may, in fact, +// contain the full path to the file. If it doesn't, the file is searched for +// in the Windows directory. +class WXDLLEXPORT wxIniConfig : public wxConfigBase +{ +public: + // ctor & dtor + // if strAppName doesn't contain the extension and is not an absolute path, + // ".ini" is appended to it. if strVendor is empty, it's taken to be the + // same as strAppName. + wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString, + const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE); + virtual ~wxIniConfig(); + + // implement inherited pure virtual functions + virtual void SetPath(const wxString& strPath); + virtual const wxString& GetPath() const; + + virtual bool GetFirstGroup(wxString& str, long& lIndex) const; + virtual bool GetNextGroup (wxString& str, long& lIndex) const; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const; + virtual bool GetNextEntry (wxString& str, long& lIndex) const; + + virtual size_t GetNumberOfEntries(bool bRecursive = false) const; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const; + + virtual bool HasGroup(const wxString& strName) const; + virtual bool HasEntry(const wxString& strName) const; + + // return true if the current group is empty + bool IsEmpty() const; + + virtual bool Flush(bool bCurrentOnly = false); + + virtual bool RenameEntry(const wxString& oldName, const wxString& newName); + virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + + virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = true); + virtual bool DeleteGroup(const wxString& szKey); + virtual bool DeleteAll(); + +protected: + // read/write + bool DoReadString(const wxString& key, wxString *pStr) const; + bool DoReadLong(const wxString& key, long *plResult) const; + + bool DoWriteString(const wxString& key, const wxString& szValue); + bool DoWriteLong(const wxString& key, long lValue); + +private: + // helpers + wxString GetPrivateKeyName(const wxString& szKey) const; + wxString GetKeyName(const wxString& szKey) const; + + wxString m_strLocalFilename; // name of the private INI file + wxString m_strGroup, // current group in appname.ini file + m_strPath; // the rest of the path (no trailing '_'!) +}; + +#endif //_INICONF_H diff --git a/Externals/wxWidgets/include/wx/msw/joystick.h b/Externals/wxWidgets/include/wx/msw/joystick.h index a52541b085..1b24d22dff 100644 --- a/Externals/wxWidgets/include/wx/msw/joystick.h +++ b/Externals/wxWidgets/include/wx/msw/joystick.h @@ -1,90 +1,90 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: joystick.h -// Purpose: wxJoystick class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: joystick.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_JOYSTICK_H_ -#define _WX_JOYSTICK_H_ - -#include "wx/event.h" - -class WXDLLIMPEXP_ADV wxJoystick: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxJoystick) - public: - /* - * Public interface - */ - - wxJoystick(int joystick = wxJOYSTICK1); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - wxPoint GetPosition(void) const; - int GetZPosition(void) const; - int GetButtonState(void) const; - int GetPOVPosition(void) const; - int GetPOVCTSPosition(void) const; - int GetRudderPosition(void) const; - int GetUPosition(void) const; - int GetVPosition(void) const; - int GetMovementThreshold(void) const; - void SetMovementThreshold(int threshold) ; - - // Capabilities - //////////////////////////////////////////////////////////////////////////// - - static int GetNumberJoysticks(void); - - bool IsOk(void) const; // Checks that the joystick is functioning - int GetManufacturerId(void) const ; - int GetProductId(void) const ; - wxString GetProductName(void) const ; - int GetXMin(void) const; - int GetYMin(void) const; - int GetZMin(void) const; - int GetXMax(void) const; - int GetYMax(void) const; - int GetZMax(void) const; - int GetNumberButtons(void) const; - int GetNumberAxes(void) const; - int GetMaxButtons(void) const; - int GetMaxAxes(void) const; - int GetPollingMin(void) const; - int GetPollingMax(void) const; - int GetRudderMin(void) const; - int GetRudderMax(void) const; - int GetUMin(void) const; - int GetUMax(void) const; - int GetVMin(void) const; - int GetVMax(void) const; - - bool HasRudder(void) const; - bool HasZ(void) const; - bool HasU(void) const; - bool HasV(void) const; - bool HasPOV(void) const; - bool HasPOV4Dir(void) const; - bool HasPOVCTS(void) const; - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // pollingFreq = 0 means that movement events are sent when above the threshold. - // If pollingFreq > 0, events are received every this many milliseconds. - bool SetCapture(wxWindow* win, int pollingFreq = 0); - bool ReleaseCapture(void); - -protected: - int m_joystick; -}; - -#endif - // _WX_JOYSTICK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.h +// Purpose: wxJoystick class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: joystick.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition(void) const; + int GetZPosition(void) const; + int GetButtonState(void) const; + int GetPOVPosition(void) const; + int GetPOVCTSPosition(void) const; + int GetRudderPosition(void) const; + int GetUPosition(void) const; + int GetVPosition(void) const; + int GetMovementThreshold(void) const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + static int GetNumberJoysticks(void); + + bool IsOk(void) const; // Checks that the joystick is functioning + int GetManufacturerId(void) const ; + int GetProductId(void) const ; + wxString GetProductName(void) const ; + int GetXMin(void) const; + int GetYMin(void) const; + int GetZMin(void) const; + int GetXMax(void) const; + int GetYMax(void) const; + int GetZMax(void) const; + int GetNumberButtons(void) const; + int GetNumberAxes(void) const; + int GetMaxButtons(void) const; + int GetMaxAxes(void) const; + int GetPollingMin(void) const; + int GetPollingMax(void) const; + int GetRudderMin(void) const; + int GetRudderMax(void) const; + int GetUMin(void) const; + int GetUMax(void) const; + int GetVMin(void) const; + int GetVMax(void) const; + + bool HasRudder(void) const; + bool HasZ(void) const; + bool HasU(void) const; + bool HasV(void) const; + bool HasPOV(void) const; + bool HasPOV4Dir(void) const; + bool HasPOVCTS(void) const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(void); + +protected: + int m_joystick; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/Externals/wxWidgets/include/wx/msw/libraries.h b/Externals/wxWidgets/include/wx/msw/libraries.h index efd7389e00..09ff8996d9 100644 --- a/Externals/wxWidgets/include/wx/msw/libraries.h +++ b/Externals/wxWidgets/include/wx/msw/libraries.h @@ -1,27 +1,27 @@ -/* - * Name: wx/msw/libraries.h - * Purpose: Pragmas for linking libs conditionally - * Author: Michael Wetherell - * Modified by: - * RCS-ID: $Id: libraries.h 37045 2006-01-21 22:50:46Z MW $ - * Copyright: (c) 2005 Michael Wetherell - * Licence: wxWindows licence - */ - -#ifndef _WX_MSW_LIBRARIES_H_ -#define _WX_MSW_LIBRARIES_H_ - -/* - * Notes: - * - * In general the preferred place to add libs is in the bakefiles. This file - * can be used where libs must be added conditionally, for those compilers that - * support a way to do that. - */ - -/* VC++ 5 didn't include oleacc.lib, though it came with the PSDK */ -#if defined __VISUALC__ && (wxUSE_ACCESSIBILITY || __VISUALC__ >= 1200) -#pragma comment(lib, "oleacc") -#endif - -#endif /* _WX_MSW_LIBRARIES_H_ */ +/* + * Name: wx/msw/libraries.h + * Purpose: Pragmas for linking libs conditionally + * Author: Michael Wetherell + * Modified by: + * RCS-ID: $Id: libraries.h 37045 2006-01-21 22:50:46Z MW $ + * Copyright: (c) 2005 Michael Wetherell + * Licence: wxWindows licence + */ + +#ifndef _WX_MSW_LIBRARIES_H_ +#define _WX_MSW_LIBRARIES_H_ + +/* + * Notes: + * + * In general the preferred place to add libs is in the bakefiles. This file + * can be used where libs must be added conditionally, for those compilers that + * support a way to do that. + */ + +/* VC++ 5 didn't include oleacc.lib, though it came with the PSDK */ +#if defined __VISUALC__ && (wxUSE_ACCESSIBILITY || __VISUALC__ >= 1200) +#pragma comment(lib, "oleacc") +#endif + +#endif /* _WX_MSW_LIBRARIES_H_ */ diff --git a/Externals/wxWidgets/include/wx/msw/listbox.h b/Externals/wxWidgets/include/wx/msw/listbox.h index f086d36d79..94b99c5ef7 100644 --- a/Externals/wxWidgets/include/wx/msw/listbox.h +++ b/Externals/wxWidgets/include/wx/msw/listbox.h @@ -1,168 +1,168 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/listbox.h -// Purpose: wxListBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: listbox.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTBOX_H_ -#define _WX_LISTBOX_H_ - -#if wxUSE_LISTBOX - -// ---------------------------------------------------------------------------- -// simple types -// ---------------------------------------------------------------------------- - -#if wxUSE_OWNER_DRAWN - class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; - - // define the array of list box items - #include "wx/dynarray.h" - - WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); -#endif // wxUSE_OWNER_DRAWN - -// forward decl for GetSelections() -class WXDLLIMPEXP_FWD_BASE wxArrayInt; - -// ---------------------------------------------------------------------------- -// List box control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListBox : public wxListBoxBase -{ -public: - // ctors and such - wxListBox(); - wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - virtual ~wxListBox(); - - // implement base class pure virtuals - virtual void Clear(); - virtual void Delete(unsigned int n); - - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; - - virtual bool IsSelected(int n) const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - - // wxCheckListBox support -#if wxUSE_OWNER_DRAWN - bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); - bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - - // plug-in for derived classes - virtual wxOwnerDrawn *CreateLboxItem(size_t n); - - // allows to get the item and use SetXXX functions to set it's appearance - wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } - - // get the index of the given item - int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } -#endif // wxUSE_OWNER_DRAWN - - // Windows-specific code to update the horizontal extent of the listbox, if - // necessary. If s is non-empty, the horizontal extent is increased to the - // length of this string if it's currently too short, otherwise the maximum - // extent of all strings is used. In any case calls InvalidateBestSize() - virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); - - // Windows callbacks - bool MSWCommand(WXUINT param, WXWORD id); - WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // under XP when using "transition effect for menus and tooltips" if we - // return true for WM_PRINTCLIENT here then it causes noticable slowdown - virtual bool MSWShouldPropagatePrintChild() - { - return false; - } - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) - { - return GetCompositeControlsDefaultAttributes(variant); - } - -protected: - virtual void DoSetSelection(int n, bool select); - virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); - virtual void DoSetItems(const wxArrayString& items, void **clientData); - virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - virtual int DoListHitTest(const wxPoint& point) const; - - // free memory (common part of Clear() and dtor) - void Free(); - - unsigned int m_noItems; - int m_selected; - - virtual wxSize DoGetBestSize() const; - -#if wxUSE_OWNER_DRAWN - // control items - wxListBoxItemsArray m_aItems; -#endif - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox) -}; - -#endif // wxUSE_LISTBOX - -#endif - // _WX_LISTBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/listbox.h +// Purpose: wxListBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: listbox.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_ +#define _WX_LISTBOX_H_ + +#if wxUSE_LISTBOX + +// ---------------------------------------------------------------------------- +// simple types +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; + + // define the array of list box items + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); +#endif // wxUSE_OWNER_DRAWN + +// forward decl for GetSelections() +class WXDLLIMPEXP_FWD_BASE wxArrayInt; + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + virtual ~wxListBox(); + + // implement base class pure virtuals + virtual void Clear(); + virtual void Delete(unsigned int n); + + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const; + + virtual bool IsSelected(int n) const; + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + + // wxCheckListBox support +#if wxUSE_OWNER_DRAWN + bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); + bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + + // plug-in for derived classes + virtual wxOwnerDrawn *CreateLboxItem(size_t n); + + // allows to get the item and use SetXXX functions to set it's appearance + wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } + + // get the index of the given item + int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } +#endif // wxUSE_OWNER_DRAWN + + // Windows-specific code to update the horizontal extent of the listbox, if + // necessary. If s is non-empty, the horizontal extent is increased to the + // length of this string if it's currently too short, otherwise the maximum + // extent of all strings is used. In any case calls InvalidateBestSize() + virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); + + // Windows callbacks + bool MSWCommand(WXUINT param, WXWORD id); + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // under XP when using "transition effect for menus and tooltips" if we + // return true for WM_PRINTCLIENT here then it causes noticable slowdown + virtual bool MSWShouldPropagatePrintChild() + { + return false; + } + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return GetCompositeControlsDefaultAttributes(variant); + } + +protected: + virtual void DoSetSelection(int n, bool select); + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + virtual void DoSetFirstItem(int n); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + virtual int DoListHitTest(const wxPoint& point) const; + + // free memory (common part of Clear() and dtor) + void Free(); + + unsigned int m_noItems; + int m_selected; + + virtual wxSize DoGetBestSize() const; + +#if wxUSE_OWNER_DRAWN + // control items + wxListBoxItemsArray m_aItems; +#endif + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox) +}; + +#endif // wxUSE_LISTBOX + +#endif + // _WX_LISTBOX_H_ diff --git a/Externals/wxWidgets/include/wx/msw/listctrl.h b/Externals/wxWidgets/include/wx/msw/listctrl.h index 8249483441..4952609eea 100644 --- a/Externals/wxWidgets/include/wx/msw/listctrl.h +++ b/Externals/wxWidgets/include/wx/msw/listctrl.h @@ -1,446 +1,446 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/listctrl.h -// Purpose: wxListCtrl class -// Author: Julian Smart -// Modified by: Agron Selimaj -// Created: 01/02/97 -// RCS-ID: $Id: listctrl.h 51773 2008-02-13 22:46:30Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTCTRL_H_ -#define _WX_LISTCTRL_H_ - -#include "wx/dcbuffer.h" -#include "wx/textctrl.h" - -class WXDLLIMPEXP_FWD_CORE wxImageList; - -/* - The wxListCtrl can show lists of items in four different modes: - wxLC_LIST: multicolumn list view, with optional small icons (icons could be - optional for some platforms). Columns are computed automatically, - i.e. you don't set columns as in wxLC_REPORT. In other words, - the list wraps, unlike a wxListBox. - wxLC_REPORT: single or multicolumn report view (with optional header) - wxLC_ICON: large icon view, with optional labels - wxLC_SMALL_ICON: small icon view, with optional labels - - You can change the style dynamically, either with SetSingleStyle or - SetWindowStyleFlag. - - Further window styles: - - wxLC_ALIGN_TOP icons align to the top (default) - wxLC_ALIGN_LEFT icons align to the left - wxLC_AUTOARRANGE icons arrange themselves - wxLC_USER_TEXT the app provides label text on demand, except for column headers - wxLC_EDIT_LABELS labels are editable: app will be notified. - wxLC_NO_HEADER no header in report mode - wxLC_NO_SORT_HEADER can't click on header - wxLC_SINGLE_SEL single selection - wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) - wxLC_SORT_DESCENDING sort descending (ditto) - - Items are referred to by their index (position in the list starting from zero). - - Label text is supplied via insertion/setting functions and is stored by the - control, unless the wxLC_USER_TEXT style has been specified, in which case - the app will be notified when text is required (see sample). - - Images are dealt with by (optionally) associating 3 image lists with the control. - Zero-based indexes into these image lists indicate which image is to be used for - which item. Each image in an image list can contain a mask, and can be made out - of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. - - Notifications are passed via the wxWidgets 2.0 event system, or using virtual - functions in wxWidgets 1.66. - - See the sample wxListCtrl app for API usage. - - TODO: - - addition of further convenience functions - to avoid use of wxListItem in some functions - - state/overlay images: probably not needed. - - in Win95, you can be called back to supply other information - besides text, such as state information. This saves no memory - and is probably superfluous to requirements. - - testing of whole API, extending current sample. - - - */ - -class WXDLLEXPORT wxListCtrl: public wxControl -{ -public: - /* - * Public interface - */ - - wxListCtrl() { Init(); } - - wxListCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListCtrlNameStr) - { - Init(); - - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxListCtrl(); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListCtrlNameStr); - - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Set the control colours - bool SetForegroundColour(const wxColour& col); - bool SetBackgroundColour(const wxColour& col); - - // Gets information about this column - bool GetColumn(int col, wxListItem& item) const; - - // Sets information about this column - bool SetColumn(int col, const wxListItem& item) ; - - // Gets the column width - int GetColumnWidth(int col) const; - - // Sets the column width - bool SetColumnWidth(int col, int width) ; - - // Gets the number of items that can fit vertically in the - // visible area of the list control (list or report view) - // or the total number of items in the list control (icon - // or small icon view) - int GetCountPerPage() const; - - // return the total area occupied by all the items (icon/small icon only) - wxRect GetViewRect() const; - - // Gets the edit control for editing labels. - wxTextCtrl* GetEditControl() const; - - // Gets information about the item - bool GetItem(wxListItem& info) const ; - - // Sets information about the item - bool SetItem(wxListItem& info) ; - - // Sets a string field at a particular column - long SetItem(long index, int col, const wxString& label, int imageId = -1); - - // Gets the item state - int GetItemState(long item, long stateMask) const ; - - // Sets the item state - bool SetItemState(long item, long state, long stateMask) ; - - // Sets the item image - bool SetItemImage(long item, int image, int selImage = -1) ; - bool SetItemColumnImage(long item, long column, int image); - - // Gets the item text - wxString GetItemText(long item) const ; - - // Sets the item text - void SetItemText(long item, const wxString& str) ; - - // Gets the item data - wxUIntPtr GetItemData(long item) const ; - - // Sets the item data -#if wxABI_VERSION >= 20804 - bool SetItemPtrData(long item, wxUIntPtr data); -#endif // wxABI 2.8.4+ - bool SetItemData(long item, long data); - - // Gets the item rectangle - bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; - - // Gets the subitem rectangle in report mode - bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; - - // Gets the item position - bool GetItemPosition(long item, wxPoint& pos) const ; - - // Sets the item position - bool SetItemPosition(long item, const wxPoint& pos) ; - - // Gets the number of items in the list control - int GetItemCount() const; - - // Gets the number of columns in the list control - int GetColumnCount() const { return m_colCount; } - - // get the horizontal and vertical components of the item spacing - wxSize GetItemSpacing() const; - - // Foreground colour of an item. - void SetItemTextColour( long item, const wxColour& col); - wxColour GetItemTextColour( long item ) const; - - // Background colour of an item. - void SetItemBackgroundColour( long item, const wxColour &col); - wxColour GetItemBackgroundColour( long item ) const; - - // Font of an item. - void SetItemFont( long item, const wxFont &f); - wxFont GetItemFont( long item ) const; - - // Gets the number of selected items in the list control - int GetSelectedItemCount() const; - - // Gets the text colour of the listview - wxColour GetTextColour() const; - - // Sets the text colour of the listview - void SetTextColour(const wxColour& col); - - // Gets the index of the topmost visible item when in - // list or report view - long GetTopItem() const ; - - // Add or remove a single window style - void SetSingleStyle(long style, bool add = true) ; - - // Set the whole window style - void SetWindowStyleFlag(long style) ; - - // Searches for an item, starting from 'item'. - // item can be -1 to find the first item that matches the - // specified flags. - // Returns the item or -1 if unsuccessful. - long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; - - // Gets one of the three image lists - wxImageList *GetImageList(int which) const ; - - // Sets the image list - // N.B. There's a quirk in the Win95 list view implementation. - // If in wxLC_LIST mode, it'll *still* display images by the labels if - // there's a small-icon image list set for the control - even though you - // haven't specified wxLIST_MASK_IMAGE when inserting. - // So you have to set a NULL small-icon image list to be sure that - // the wxLC_LIST mode works without icons. Of course, you may want icons... - void SetImageList(wxImageList *imageList, int which) ; - void AssignImageList(wxImageList *imageList, int which) ; - - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - // are we in virtual report mode? - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - - // refresh items selectively (only useful for virtual list controls) - void RefreshItem(long item); - void RefreshItems(long itemFrom, long itemTo); - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Arranges the items - bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); - - // Deletes an item - bool DeleteItem(long item); - - // Deletes all items - bool DeleteAllItems() ; - - // Deletes a column - bool DeleteColumn(int col); - - // Deletes all columns - bool DeleteAllColumns(); - - // Clears items, and columns if there are any. - void ClearAll(); - - // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); - - // End label editing, optionally cancelling the edit - bool EndEditLabel(bool cancel); - - // Ensures this item is visible - bool EnsureVisible(long item) ; - - // Find an item whose label matches this string, starting from the item after 'start' - // or the beginning if 'start' is -1. - long FindItem(long start, const wxString& str, bool partial = false); - - // Find an item whose data matches this data, starting from the item after 'start' - // or the beginning if 'start' is -1. - long FindItem(long start, wxUIntPtr data); - - // Find an item nearest this position in the specified direction, starting from - // the item after 'start' or the beginning if 'start' is -1. - long FindItem(long start, const wxPoint& pt, int direction); - - // Determines which item (if any) is at the specified point, - // giving details in 'flags' (see wxLIST_HITTEST_... flags above) - // Request the subitem number as well at the given coordinate. - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; - - // Inserts an item, returning the index of the new item if successful, - // -1 otherwise. - long InsertItem(const wxListItem& info); - - // Insert a string item - long InsertItem(long index, const wxString& label); - - // Insert an image item - long InsertItem(long index, int imageIndex); - - // Insert an image/string item - long InsertItem(long index, const wxString& label, int imageIndex); - - // For list view mode (only), inserts a column. - long InsertColumn(long col, const wxListItem& info); - - long InsertColumn(long col, - const wxString& heading, - int format = wxLIST_FORMAT_LEFT, - int width = -1); - - // set the number of items in a virtual list control - void SetItemCount(long count); - - // Scrolls the list control. If in icon, small icon or report view mode, - // x specifies the number of pixels to scroll. If in list view mode, x - // specifies the number of columns to scroll. - // If in icon, small icon or list view mode, y specifies the number of pixels - // to scroll. If in report view mode, y specifies the number of lines to scroll. - bool ScrollList(int dx, int dy); - - // Sort items. - - // fn is a function which takes 3 long arguments: item1, item2, data. - // item1 is the long data associated with a first item (NOT the index). - // item2 is the long data associated with a second item (NOT the index). - // data is the same value as passed to SortItems. - // The return value is a negative number if the first item should precede the second - // item, a positive number of the second item should precede the first, - // or zero if the two items are equivalent. - - // data is arbitrary data to be passed to the sort function. - bool SortItems(wxListCtrlCompare fn, long data); - - // IMPLEMENTATION - virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWShouldPreProcessMessage(WXMSG* msg); - - // bring the control in sync with current m_windowStyle value - void UpdateStyle(); - - // Event handlers - //////////////////////////////////////////////////////////////////////////// - // Necessary for drawing hrules and vrules, if specified - void OnPaint(wxPaintEvent& event); - - - virtual bool ShouldInheritColours() const { return false; } - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete stuff, for compatibility only -- don't use - wxDEPRECATED( int GetItemSpacing(bool isSmall) const); -#endif // WXWIN_COMPATIBILITY_2_6 - - // convert our styles to Windows - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // special Windows message handling - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // free memory taken by all internal data - void FreeAllInternalData(); - - // get the item attribute, either by quering it for virtual control, or by - // returning the one previously set using setter methods for a normal one - wxListItemAttr *DoGetItemAttr(long item) const; - - - wxTextCtrl* m_textCtrl; // The control used for editing a label - wxImageList * m_imageListNormal; // The image list for normal icons - wxImageList * m_imageListSmall; // The image list for small icons - wxImageList * m_imageListState; // The image list state icons (not implemented yet) - bool m_ownsImageListNormal, - m_ownsImageListSmall, - m_ownsImageListState; - - int m_colCount; // Windows doesn't have GetColumnCount so must - // keep track of inserted/deleted columns - long m_count; // Keep track of item count to save calls to - // ListView_GetItemCount - bool m_ignoreChangeMessages; - - // true if we have any internal data (user data & attributes) - bool m_AnyInternalData; - - // true if we have any items with custom attributes - bool m_hasAnyAttr; - - // these functions are only used for virtual list view controls, i.e. the - // ones with wxLC_VIRTUAL style - - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - - // return the attribute for the item (may return NULL if none) - virtual wxListItemAttr *OnGetItemAttr(long item) const; - -private: - // process NM_CUSTOMDRAW notification message - WXLPARAM OnCustomDraw(WXLPARAM lParam); - - // set the extended styles for the control (used by Create() and - // UpdateStyle()), only should be called if InReportView() - void MSWSetExListStyles(); - - - DECLARE_DYNAMIC_CLASS(wxListCtrl) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxListCtrl) -}; - -#endif // _WX_LISTCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/listctrl.h +// Purpose: wxListCtrl class +// Author: Julian Smart +// Modified by: Agron Selimaj +// Created: 01/02/97 +// RCS-ID: $Id: listctrl.h 51773 2008-02-13 22:46:30Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTCTRL_H_ +#define _WX_LISTCTRL_H_ + +#include "wx/dcbuffer.h" +#include "wx/textctrl.h" + +class WXDLLIMPEXP_FWD_CORE wxImageList; + +/* + The wxListCtrl can show lists of items in four different modes: + wxLC_LIST: multicolumn list view, with optional small icons (icons could be + optional for some platforms). Columns are computed automatically, + i.e. you don't set columns as in wxLC_REPORT. In other words, + the list wraps, unlike a wxListBox. + wxLC_REPORT: single or multicolumn report view (with optional header) + wxLC_ICON: large icon view, with optional labels + wxLC_SMALL_ICON: small icon view, with optional labels + + You can change the style dynamically, either with SetSingleStyle or + SetWindowStyleFlag. + + Further window styles: + + wxLC_ALIGN_TOP icons align to the top (default) + wxLC_ALIGN_LEFT icons align to the left + wxLC_AUTOARRANGE icons arrange themselves + wxLC_USER_TEXT the app provides label text on demand, except for column headers + wxLC_EDIT_LABELS labels are editable: app will be notified. + wxLC_NO_HEADER no header in report mode + wxLC_NO_SORT_HEADER can't click on header + wxLC_SINGLE_SEL single selection + wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) + wxLC_SORT_DESCENDING sort descending (ditto) + + Items are referred to by their index (position in the list starting from zero). + + Label text is supplied via insertion/setting functions and is stored by the + control, unless the wxLC_USER_TEXT style has been specified, in which case + the app will be notified when text is required (see sample). + + Images are dealt with by (optionally) associating 3 image lists with the control. + Zero-based indexes into these image lists indicate which image is to be used for + which item. Each image in an image list can contain a mask, and can be made out + of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. + + Notifications are passed via the wxWidgets 2.0 event system, or using virtual + functions in wxWidgets 1.66. + + See the sample wxListCtrl app for API usage. + + TODO: + - addition of further convenience functions + to avoid use of wxListItem in some functions + - state/overlay images: probably not needed. + - in Win95, you can be called back to supply other information + besides text, such as state information. This saves no memory + and is probably superfluous to requirements. + - testing of whole API, extending current sample. + + + */ + +class WXDLLEXPORT wxListCtrl: public wxControl +{ +public: + /* + * Public interface + */ + + wxListCtrl() { Init(); } + + wxListCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListCtrlNameStr) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxListCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListCtrlNameStr); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Set the control colours + bool SetForegroundColour(const wxColour& col); + bool SetBackgroundColour(const wxColour& col); + + // Gets information about this column + bool GetColumn(int col, wxListItem& item) const; + + // Sets information about this column + bool SetColumn(int col, const wxListItem& item) ; + + // Gets the column width + int GetColumnWidth(int col) const; + + // Sets the column width + bool SetColumnWidth(int col, int width) ; + + // Gets the number of items that can fit vertically in the + // visible area of the list control (list or report view) + // or the total number of items in the list control (icon + // or small icon view) + int GetCountPerPage() const; + + // return the total area occupied by all the items (icon/small icon only) + wxRect GetViewRect() const; + + // Gets the edit control for editing labels. + wxTextCtrl* GetEditControl() const; + + // Gets information about the item + bool GetItem(wxListItem& info) const ; + + // Sets information about the item + bool SetItem(wxListItem& info) ; + + // Sets a string field at a particular column + long SetItem(long index, int col, const wxString& label, int imageId = -1); + + // Gets the item state + int GetItemState(long item, long stateMask) const ; + + // Sets the item state + bool SetItemState(long item, long state, long stateMask) ; + + // Sets the item image + bool SetItemImage(long item, int image, int selImage = -1) ; + bool SetItemColumnImage(long item, long column, int image); + + // Gets the item text + wxString GetItemText(long item) const ; + + // Sets the item text + void SetItemText(long item, const wxString& str) ; + + // Gets the item data + wxUIntPtr GetItemData(long item) const ; + + // Sets the item data +#if wxABI_VERSION >= 20804 + bool SetItemPtrData(long item, wxUIntPtr data); +#endif // wxABI 2.8.4+ + bool SetItemData(long item, long data); + + // Gets the item rectangle + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; + + // Gets the subitem rectangle in report mode + bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; + + // Gets the item position + bool GetItemPosition(long item, wxPoint& pos) const ; + + // Sets the item position + bool SetItemPosition(long item, const wxPoint& pos) ; + + // Gets the number of items in the list control + int GetItemCount() const; + + // Gets the number of columns in the list control + int GetColumnCount() const { return m_colCount; } + + // get the horizontal and vertical components of the item spacing + wxSize GetItemSpacing() const; + + // Foreground colour of an item. + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + + // Background colour of an item. + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + + // Font of an item. + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; + + // Gets the number of selected items in the list control + int GetSelectedItemCount() const; + + // Gets the text colour of the listview + wxColour GetTextColour() const; + + // Sets the text colour of the listview + void SetTextColour(const wxColour& col); + + // Gets the index of the topmost visible item when in + // list or report view + long GetTopItem() const ; + + // Add or remove a single window style + void SetSingleStyle(long style, bool add = true) ; + + // Set the whole window style + void SetWindowStyleFlag(long style) ; + + // Searches for an item, starting from 'item'. + // item can be -1 to find the first item that matches the + // specified flags. + // Returns the item or -1 if unsuccessful. + long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; + + // Gets one of the three image lists + wxImageList *GetImageList(int which) const ; + + // Sets the image list + // N.B. There's a quirk in the Win95 list view implementation. + // If in wxLC_LIST mode, it'll *still* display images by the labels if + // there's a small-icon image list set for the control - even though you + // haven't specified wxLIST_MASK_IMAGE when inserting. + // So you have to set a NULL small-icon image list to be sure that + // the wxLC_LIST mode works without icons. Of course, you may want icons... + void SetImageList(wxImageList *imageList, int which) ; + void AssignImageList(wxImageList *imageList, int which) ; + + // are we in report mode? + bool InReportView() const { return HasFlag(wxLC_REPORT); } + + // are we in virtual report mode? + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + + // refresh items selectively (only useful for virtual list controls) + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Arranges the items + bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); + + // Deletes an item + bool DeleteItem(long item); + + // Deletes all items + bool DeleteAllItems() ; + + // Deletes a column + bool DeleteColumn(int col); + + // Deletes all columns + bool DeleteAllColumns(); + + // Clears items, and columns if there are any. + void ClearAll(); + + // Edit the label + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + // Ensures this item is visible + bool EnsureVisible(long item) ; + + // Find an item whose label matches this string, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, const wxString& str, bool partial = false); + + // Find an item whose data matches this data, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, wxUIntPtr data); + + // Find an item nearest this position in the specified direction, starting from + // the item after 'start' or the beginning if 'start' is -1. + long FindItem(long start, const wxPoint& pt, int direction); + + // Determines which item (if any) is at the specified point, + // giving details in 'flags' (see wxLIST_HITTEST_... flags above) + // Request the subitem number as well at the given coordinate. + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + + // Inserts an item, returning the index of the new item if successful, + // -1 otherwise. + long InsertItem(const wxListItem& info); + + // Insert a string item + long InsertItem(long index, const wxString& label); + + // Insert an image item + long InsertItem(long index, int imageIndex); + + // Insert an image/string item + long InsertItem(long index, const wxString& label, int imageIndex); + + // For list view mode (only), inserts a column. + long InsertColumn(long col, const wxListItem& info); + + long InsertColumn(long col, + const wxString& heading, + int format = wxLIST_FORMAT_LEFT, + int width = -1); + + // set the number of items in a virtual list control + void SetItemCount(long count); + + // Scrolls the list control. If in icon, small icon or report view mode, + // x specifies the number of pixels to scroll. If in list view mode, x + // specifies the number of columns to scroll. + // If in icon, small icon or list view mode, y specifies the number of pixels + // to scroll. If in report view mode, y specifies the number of lines to scroll. + bool ScrollList(int dx, int dy); + + // Sort items. + + // fn is a function which takes 3 long arguments: item1, item2, data. + // item1 is the long data associated with a first item (NOT the index). + // item2 is the long data associated with a second item (NOT the index). + // data is the same value as passed to SortItems. + // The return value is a negative number if the first item should precede the second + // item, a positive number of the second item should precede the first, + // or zero if the two items are equivalent. + + // data is arbitrary data to be passed to the sort function. + bool SortItems(wxListCtrlCompare fn, long data); + + // IMPLEMENTATION + virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWShouldPreProcessMessage(WXMSG* msg); + + // bring the control in sync with current m_windowStyle value + void UpdateStyle(); + + // Event handlers + //////////////////////////////////////////////////////////////////////////// + // Necessary for drawing hrules and vrules, if specified + void OnPaint(wxPaintEvent& event); + + + virtual bool ShouldInheritColours() const { return false; } + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + +#if WXWIN_COMPATIBILITY_2_6 + // obsolete stuff, for compatibility only -- don't use + wxDEPRECATED( int GetItemSpacing(bool isSmall) const); +#endif // WXWIN_COMPATIBILITY_2_6 + + // convert our styles to Windows + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // special Windows message handling + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam); + +protected: + // common part of all ctors + void Init(); + + // free memory taken by all internal data + void FreeAllInternalData(); + + // get the item attribute, either by quering it for virtual control, or by + // returning the one previously set using setter methods for a normal one + wxListItemAttr *DoGetItemAttr(long item) const; + + + wxTextCtrl* m_textCtrl; // The control used for editing a label + wxImageList * m_imageListNormal; // The image list for normal icons + wxImageList * m_imageListSmall; // The image list for small icons + wxImageList * m_imageListState; // The image list state icons (not implemented yet) + bool m_ownsImageListNormal, + m_ownsImageListSmall, + m_ownsImageListState; + + int m_colCount; // Windows doesn't have GetColumnCount so must + // keep track of inserted/deleted columns + long m_count; // Keep track of item count to save calls to + // ListView_GetItemCount + bool m_ignoreChangeMessages; + + // true if we have any internal data (user data & attributes) + bool m_AnyInternalData; + + // true if we have any items with custom attributes + bool m_hasAnyAttr; + + // these functions are only used for virtual list view controls, i.e. the + // ones with wxLC_VIRTUAL style + + // return the text for the given column of the given item + virtual wxString OnGetItemText(long item, long column) const; + + // return the icon for the given item. In report view, OnGetItemImage will + // only be called for the first column. See OnGetItemColumnImage for + // details. + virtual int OnGetItemImage(long item) const; + + // return the icon for the given item and column. + virtual int OnGetItemColumnImage(long item, long column) const; + + // return the attribute for the item (may return NULL if none) + virtual wxListItemAttr *OnGetItemAttr(long item) const; + +private: + // process NM_CUSTOMDRAW notification message + WXLPARAM OnCustomDraw(WXLPARAM lParam); + + // set the extended styles for the control (used by Create() and + // UpdateStyle()), only should be called if InReportView() + void MSWSetExListStyles(); + + + DECLARE_DYNAMIC_CLASS(wxListCtrl) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxListCtrl) +}; + +#endif // _WX_LISTCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/mdi.h b/Externals/wxWidgets/include/wx/msw/mdi.h index 46f7f10596..69ee0fd58d 100644 --- a/Externals/wxWidgets/include/wx/msw/mdi.h +++ b/Externals/wxWidgets/include/wx/msw/mdi.h @@ -1,238 +1,238 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mdi.h -// Purpose: MDI (Multiple Document Interface) classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: mdi.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MDI_H_ -#define _WX_MDI_H_ - -#include "wx/frame.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; -class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - -// --------------------------------------------------------------------------- -// wxMDIParentFrame -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIParentFrame : public wxFrame -{ -public: - wxMDIParentFrame(); - wxMDIParentFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - virtual ~wxMDIParentFrame(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr); - - // accessors - // --------- - - // Get the active MDI child window (Windows only) - wxMDIChildFrame *GetActiveChild() const; - - // Get the client window - wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } - - // Create the client window class (don't Create the window, - // just return a new class) - virtual wxMDIClientWindow *OnCreateClient(void); - - // MDI windows menu - wxMenu* GetWindowMenu() const { return m_windowMenu; } - void SetWindowMenu(wxMenu* menu) ; - virtual void DoMenuUpdates(wxMenu* menu = NULL); - - // MDI operations - // -------------- - virtual void Cascade(); - virtual void Tile(wxOrientation orient = wxHORIZONTAL); - virtual void ArrangeIcons(); - virtual void ActivateNext(); - virtual void ActivatePrevious(); - - // handlers - // -------- - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - void OnSize(wxSizeEvent& event); - void OnIconized(wxIconizeEvent& event); - - bool HandleActivate(int state, bool minimized, WXHWND activate); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - - // override window proc for MDI-specific message processing - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); - virtual bool MSWTranslateMessage(WXMSG* msg); - -protected: -#if wxUSE_MENUS_NATIVE - virtual void InternalSetMenuBar(); -#endif // wxUSE_MENUS_NATIVE - - virtual WXHICON GetDefaultIcon() const; - - // set the size of the MDI client window to match the frame size - void UpdateClientSize(); - - - wxMDIClientWindow * m_clientWindow; - wxMDIChildFrame * m_currentChild; - wxMenu* m_windowMenu; - - // true if MDI Frame is intercepting commands, not child - bool m_parentFrameActive; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) - DECLARE_NO_COPY_CLASS(wxMDIParentFrame) -}; - -// --------------------------------------------------------------------------- -// wxMDIChildFrame -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIChildFrame : public wxFrame -{ -public: - wxMDIChildFrame() { Init(); } - wxMDIChildFrame(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - Create(parent, id, title, pos, size, style, name); - } - - virtual ~wxMDIChildFrame(); - - bool Create(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual bool IsTopLevel() const { return false; } - - // MDI operations - virtual void Maximize(bool maximize = true); - virtual void Restore(); - virtual void Activate(); - - // Implementation only from now on - // ------------------------------- - - // Handlers - bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); - bool HandleWindowPosChanging(void *lpPos); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleGetMinMaxInfo(void *mmInfo); - - virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWTranslateMessage(WXMSG *msg); - - virtual void MSWDestroyWindow(); - - bool ResetWindowStyle(void *vrect); - - void OnIdle(wxIdleEvent& event); - - virtual bool Show(bool show = true); - -protected: - virtual void DoGetScreenPosition(int *x, int *y) const; - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoSetClientSize(int width, int height); - virtual void InternalSetMenuBar(); - virtual bool IsMDIChild() const { return true; } - virtual void DetachMenuBar(); - - virtual WXHICON GetDefaultIcon() const; - - // common part of all ctors - void Init(); - -private: - bool m_needsInitialShow; // Show must be called in idle time after Creation - bool m_needsResize; // flag which tells us to artificially resize the frame - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) -}; - -// --------------------------------------------------------------------------- -// wxMDIClientWindow -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxMDIClientWindow : public wxWindow -{ -public: - wxMDIClientWindow() { Init(); } - wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) - { - Init(); - - CreateClient(parent, style); - } - - // Note: this is virtual, to allow overridden behaviour. - virtual bool CreateClient(wxMDIParentFrame *parent, - long style = wxVSCROLL | wxHSCROLL); - - // Explicitly call default scroll behaviour - void OnScroll(wxScrollEvent& event); - -protected: - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - void Init() { m_scrollX = m_scrollY = 0; } - - int m_scrollX, m_scrollY; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) -}; - -#endif - // _WX_MDI_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/mdi.h +// Purpose: MDI (Multiple Document Interface) classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: mdi.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDI_H_ +#define _WX_MDI_H_ + +#include "wx/frame.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; + +// --------------------------------------------------------------------------- +// wxMDIParentFrame +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIParentFrame : public wxFrame +{ +public: + wxMDIParentFrame(); + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMDIParentFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr); + + // accessors + // --------- + + // Get the active MDI child window (Windows only) + wxMDIChildFrame *GetActiveChild() const; + + // Get the client window + wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } + + // Create the client window class (don't Create the window, + // just return a new class) + virtual wxMDIClientWindow *OnCreateClient(void); + + // MDI windows menu + wxMenu* GetWindowMenu() const { return m_windowMenu; } + void SetWindowMenu(wxMenu* menu) ; + virtual void DoMenuUpdates(wxMenu* menu = NULL); + + // MDI operations + // -------------- + virtual void Cascade(); + virtual void Tile(wxOrientation orient = wxHORIZONTAL); + virtual void ArrangeIcons(); + virtual void ActivateNext(); + virtual void ActivatePrevious(); + + // handlers + // -------- + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void OnSize(wxSizeEvent& event); + void OnIconized(wxIconizeEvent& event); + + bool HandleActivate(int state, bool minimized, WXHWND activate); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + // override window proc for MDI-specific message processing + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); + virtual bool MSWTranslateMessage(WXMSG* msg); + +protected: +#if wxUSE_MENUS_NATIVE + virtual void InternalSetMenuBar(); +#endif // wxUSE_MENUS_NATIVE + + virtual WXHICON GetDefaultIcon() const; + + // set the size of the MDI client window to match the frame size + void UpdateClientSize(); + + + wxMDIClientWindow * m_clientWindow; + wxMDIChildFrame * m_currentChild; + wxMenu* m_windowMenu; + + // true if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + DECLARE_NO_COPY_CLASS(wxMDIParentFrame) +}; + +// --------------------------------------------------------------------------- +// wxMDIChildFrame +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIChildFrame : public wxFrame +{ +public: + wxMDIChildFrame() { Init(); } + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMDIChildFrame(); + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual bool IsTopLevel() const { return false; } + + // MDI operations + virtual void Maximize(bool maximize = true); + virtual void Restore(); + virtual void Activate(); + + // Implementation only from now on + // ------------------------------- + + // Handlers + bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); + bool HandleWindowPosChanging(void *lpPos); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + bool HandleGetMinMaxInfo(void *mmInfo); + + virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWTranslateMessage(WXMSG *msg); + + virtual void MSWDestroyWindow(); + + bool ResetWindowStyle(void *vrect); + + void OnIdle(wxIdleEvent& event); + + virtual bool Show(bool show = true); + +protected: + virtual void DoGetScreenPosition(int *x, int *y) const; + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoSetClientSize(int width, int height); + virtual void InternalSetMenuBar(); + virtual bool IsMDIChild() const { return true; } + virtual void DetachMenuBar(); + + virtual WXHICON GetDefaultIcon() const; + + // common part of all ctors + void Init(); + +private: + bool m_needsInitialShow; // Show must be called in idle time after Creation + bool m_needsResize; // flag which tells us to artificially resize the frame + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) +}; + +// --------------------------------------------------------------------------- +// wxMDIClientWindow +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIClientWindow : public wxWindow +{ +public: + wxMDIClientWindow() { Init(); } + wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + Init(); + + CreateClient(parent, style); + } + + // Note: this is virtual, to allow overridden behaviour. + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL); + + // Explicitly call default scroll behaviour + void OnScroll(wxScrollEvent& event); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + void Init() { m_scrollX = m_scrollY = 0; } + + int m_scrollX, m_scrollY; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) +}; + +#endif + // _WX_MDI_H_ diff --git a/Externals/wxWidgets/include/wx/msw/menu.h b/Externals/wxWidgets/include/wx/msw/menu.h index b25f77d5db..87c25ef725 100644 --- a/Externals/wxWidgets/include/wx/msw/menu.h +++ b/Externals/wxWidgets/include/wx/msw/menu.h @@ -1,241 +1,241 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/menu.h -// Purpose: wxMenu, wxMenuBar classes -// Author: Julian Smart -// Modified by: Vadim Zeitlin (wxMenuItem is now in separate file) -// Created: 01/02/97 -// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MENU_H_ -#define _WX_MENU_H_ - -#if wxUSE_ACCEL - #include "wx/accel.h" - #include "wx/dynarray.h" - - WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray); -#endif // wxUSE_ACCEL - -class WXDLLIMPEXP_FWD_CORE wxFrame; - -#if defined(__WXWINCE__) && wxUSE_TOOLBAR -class WXDLLIMPEXP_FWD_CORE wxToolBar; -#endif - - -// Not using a combined wxToolBar/wxMenuBar? then use -// a commandbar in WinCE .NET to implement the -// menubar, since there is no ::SetMenu function. -#if defined(__WXWINCE__) -# if ((_WIN32_WCE >= 400) && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) || \ - defined(__HANDHELDPC__) -# define WINCE_WITH_COMMANDBAR -# else -# define WINCE_WITHOUT_COMMANDBAR -# endif -#endif - - -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// Menu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenu : public wxMenuBase -{ -public: - // ctors & dtor - wxMenu(const wxString& title, long style = 0) - : wxMenuBase(title, style) { Init(); } - - wxMenu(long style = 0) : wxMenuBase(style) { Init(); } - - virtual ~wxMenu(); - - virtual void Break(); - - virtual void SetTitle(const wxString& title); - - // implementation only from now on - // ------------------------------- - - virtual void Attach(wxMenuBarBase *menubar); - - bool MSWCommand(WXUINT param, WXWORD id); - - // semi-private accessors - // get the window which contains this menu - wxWindow *GetWindow() const; - // get the menu handle - WXHMENU GetHMenu() const { return m_hMenu; } - -#if wxUSE_ACCEL - // called by wxMenuBar to build its accel table from the accels of all menus - bool HasAccels() const { return !m_accels.IsEmpty(); } - size_t GetAccelCount() const { return m_accels.GetCount(); } - size_t CopyAccels(wxAcceleratorEntry *accels) const; - - // called by wxMenuItem when its accels changes - void UpdateAccel(wxMenuItem *item); - - // helper used by wxMenu itself (returns the index in m_accels) - int FindAccel(int id) const; -#endif // wxUSE_ACCEL - -protected: - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem* DoRemove(wxMenuItem *item); - -private: - // common part of all ctors - void Init(); - - // common part of Append/Insert (behaves as Append is pos == (size_t)-1) - bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); - - // terminate the current radio group, if any - void EndRadioGroup(); - - // if true, insert a breal before appending the next item - bool m_doBreak; - - // the position of the first item in the current radio group or -1 - int m_startRadioGroup; - - // the menu handle of this menu - WXHMENU m_hMenu; - -#if wxUSE_ACCEL - // the accelerators for our menu items - wxAcceleratorArray m_accels; -#endif // wxUSE_ACCEL - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu) -}; - -// ---------------------------------------------------------------------------- -// Menu Bar (a la Windows) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuInfo : public wxObject -{ -public : - wxMenuInfo() { m_menu = NULL; } - virtual ~wxMenuInfo() { } - - void Create( wxMenu *menu , const wxString &title ) - { m_menu = menu; m_title = title; } - wxMenu* GetMenu() const { return m_menu; } - wxString GetTitle() const { return m_title; } -private : - wxMenu *m_menu; - wxString m_title; - - DECLARE_DYNAMIC_CLASS(wxMenuInfo) -}; - -WX_DECLARE_EXPORTED_LIST(wxMenuInfo, wxMenuInfoList ); - -class WXDLLEXPORT wxMenuBar : public wxMenuBarBase -{ -public: - // ctors & dtor - // default constructor - wxMenuBar(); - // unused under MSW - wxMenuBar(long style); - // menubar takes ownership of the menus arrays but copies the titles - wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); - virtual ~wxMenuBar(); - - // menubar construction - bool Append( wxMenuInfo *info ) { return Append( info->GetMenu() , info->GetTitle() ); } - const wxMenuInfoList& GetMenuInfos() const; - - virtual bool Append( wxMenu *menu, const wxString &title ); - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Remove(size_t pos); - - virtual void EnableTop( size_t pos, bool flag ); - virtual void SetLabelTop( size_t pos, const wxString& label ); - virtual wxString GetLabelTop( size_t pos ) const; - - // implementation from now on - WXHMENU Create(); - virtual void Detach(); - virtual void Attach(wxFrame *frame); - -#if defined(__WXWINCE__) && wxUSE_TOOLBAR - // Under WinCE, a menubar is owned by the frame's toolbar - void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; } - wxToolBar* GetToolBar() const { return m_toolBar; } -#endif - -#ifdef WINCE_WITH_COMMANDBAR - WXHWND GetCommandBar() const { return m_commandBar; } - bool AddAdornments(long style); -#endif - -#if wxUSE_ACCEL - // get the accel table for all the menus - const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } - - // update the accel table (must be called after adding/deleting a menu) - void RebuildAccelTable(); -#endif // wxUSE_ACCEL - - // get the menu handle - WXHMENU GetHMenu() const { return m_hMenu; } - - // if the menubar is modified, the display is not updated automatically, - // call this function to update it (m_menuBarFrame should be !NULL) - void Refresh(); - - // To avoid compile warning - void Refresh( bool eraseBackground, - const wxRect *rect = (const wxRect *) NULL ) { wxWindow::Refresh(eraseBackground, rect); } - -protected: - // common part of all ctors - void Init(); - - wxArrayString m_titles; - wxMenuInfoList m_menuInfos; - - WXHMENU m_hMenu; - - // Return the MSW position for a wxMenu which is sometimes different from - // the wxWidgets position. - int MSWPositionForWxMenu(wxMenu *menu, int wxpos); -#if wxUSE_ACCEL - // the accelerator table for all accelerators in all our menus - wxAcceleratorTable m_accelTable; -#endif // wxUSE_ACCEL - -#if defined(__WXWINCE__) && wxUSE_TOOLBAR - wxToolBar* m_toolBar; -#endif - -#ifdef WINCE_WITH_COMMANDBAR - WXHWND m_commandBar; - bool m_adornmentsAdded; -#endif - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar) - -public: - -#if wxABI_VERSION >= 20805 - // Gets the original label at the top-level of the menubar - wxString GetMenuLabel(size_t pos) const; -#endif -}; - -#endif // _WX_MENU_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/menu.h +// Purpose: wxMenu, wxMenuBar classes +// Author: Julian Smart +// Modified by: Vadim Zeitlin (wxMenuItem is now in separate file) +// Created: 01/02/97 +// RCS-ID: $Id: menu.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_ +#define _WX_MENU_H_ + +#if wxUSE_ACCEL + #include "wx/accel.h" + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray); +#endif // wxUSE_ACCEL + +class WXDLLIMPEXP_FWD_CORE wxFrame; + +#if defined(__WXWINCE__) && wxUSE_TOOLBAR +class WXDLLIMPEXP_FWD_CORE wxToolBar; +#endif + + +// Not using a combined wxToolBar/wxMenuBar? then use +// a commandbar in WinCE .NET to implement the +// menubar, since there is no ::SetMenu function. +#if defined(__WXWINCE__) +# if ((_WIN32_WCE >= 400) && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) || \ + defined(__HANDHELDPC__) +# define WINCE_WITH_COMMANDBAR +# else +# define WINCE_WITHOUT_COMMANDBAR +# endif +#endif + + +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + virtual void Break(); + + virtual void SetTitle(const wxString& title); + + // implementation only from now on + // ------------------------------- + + virtual void Attach(wxMenuBarBase *menubar); + + bool MSWCommand(WXUINT param, WXWORD id); + + // semi-private accessors + // get the window which contains this menu + wxWindow *GetWindow() const; + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + +#if wxUSE_ACCEL + // called by wxMenuBar to build its accel table from the accels of all menus + bool HasAccels() const { return !m_accels.IsEmpty(); } + size_t GetAccelCount() const { return m_accels.GetCount(); } + size_t CopyAccels(wxAcceleratorEntry *accels) const; + + // called by wxMenuItem when its accels changes + void UpdateAccel(wxMenuItem *item); + + // helper used by wxMenu itself (returns the index in m_accels) + int FindAccel(int id) const; +#endif // wxUSE_ACCEL + +protected: + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + +private: + // common part of all ctors + void Init(); + + // common part of Append/Insert (behaves as Append is pos == (size_t)-1) + bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); + + // terminate the current radio group, if any + void EndRadioGroup(); + + // if true, insert a breal before appending the next item + bool m_doBreak; + + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + + // the menu handle of this menu + WXHMENU m_hMenu; + +#if wxUSE_ACCEL + // the accelerators for our menu items + wxAcceleratorArray m_accels; +#endif // wxUSE_ACCEL + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu) +}; + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuInfo : public wxObject +{ +public : + wxMenuInfo() { m_menu = NULL; } + virtual ~wxMenuInfo() { } + + void Create( wxMenu *menu , const wxString &title ) + { m_menu = menu; m_title = title; } + wxMenu* GetMenu() const { return m_menu; } + wxString GetTitle() const { return m_title; } +private : + wxMenu *m_menu; + wxString m_title; + + DECLARE_DYNAMIC_CLASS(wxMenuInfo) +}; + +WX_DECLARE_EXPORTED_LIST(wxMenuInfo, wxMenuInfoList ); + +class WXDLLEXPORT wxMenuBar : public wxMenuBarBase +{ +public: + // ctors & dtor + // default constructor + wxMenuBar(); + // unused under MSW + wxMenuBar(long style); + // menubar takes ownership of the menus arrays but copies the titles + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + virtual ~wxMenuBar(); + + // menubar construction + bool Append( wxMenuInfo *info ) { return Append( info->GetMenu() , info->GetTitle() ); } + const wxMenuInfoList& GetMenuInfos() const; + + virtual bool Append( wxMenu *menu, const wxString &title ); + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Remove(size_t pos); + + virtual void EnableTop( size_t pos, bool flag ); + virtual void SetLabelTop( size_t pos, const wxString& label ); + virtual wxString GetLabelTop( size_t pos ) const; + + // implementation from now on + WXHMENU Create(); + virtual void Detach(); + virtual void Attach(wxFrame *frame); + +#if defined(__WXWINCE__) && wxUSE_TOOLBAR + // Under WinCE, a menubar is owned by the frame's toolbar + void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; } + wxToolBar* GetToolBar() const { return m_toolBar; } +#endif + +#ifdef WINCE_WITH_COMMANDBAR + WXHWND GetCommandBar() const { return m_commandBar; } + bool AddAdornments(long style); +#endif + +#if wxUSE_ACCEL + // get the accel table for all the menus + const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } + + // update the accel table (must be called after adding/deleting a menu) + void RebuildAccelTable(); +#endif // wxUSE_ACCEL + + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + + // if the menubar is modified, the display is not updated automatically, + // call this function to update it (m_menuBarFrame should be !NULL) + void Refresh(); + + // To avoid compile warning + void Refresh( bool eraseBackground, + const wxRect *rect = (const wxRect *) NULL ) { wxWindow::Refresh(eraseBackground, rect); } + +protected: + // common part of all ctors + void Init(); + + wxArrayString m_titles; + wxMenuInfoList m_menuInfos; + + WXHMENU m_hMenu; + + // Return the MSW position for a wxMenu which is sometimes different from + // the wxWidgets position. + int MSWPositionForWxMenu(wxMenu *menu, int wxpos); +#if wxUSE_ACCEL + // the accelerator table for all accelerators in all our menus + wxAcceleratorTable m_accelTable; +#endif // wxUSE_ACCEL + +#if defined(__WXWINCE__) && wxUSE_TOOLBAR + wxToolBar* m_toolBar; +#endif + +#ifdef WINCE_WITH_COMMANDBAR + WXHWND m_commandBar; + bool m_adornmentsAdded; +#endif + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar) + +public: + +#if wxABI_VERSION >= 20805 + // Gets the original label at the top-level of the menubar + wxString GetMenuLabel(size_t pos) const; +#endif +}; + +#endif // _WX_MENU_H_ diff --git a/Externals/wxWidgets/include/wx/msw/menuitem.h b/Externals/wxWidgets/include/wx/msw/menuitem.h index 641365848a..1e49604cb6 100644 --- a/Externals/wxWidgets/include/wx/msw/menuitem.h +++ b/Externals/wxWidgets/include/wx/msw/menuitem.h @@ -1,100 +1,100 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: menuitem.h -// Purpose: wxMenuItem class -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.11.97 -// RCS-ID: $Id: menuitem.h 48053 2007-08-13 17:07:01Z JS $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MENUITEM_H -#define _MENUITEM_H - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_OWNER_DRAWN - #include "wx/ownerdrw.h" // base class -#endif - -// ---------------------------------------------------------------------------- -// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuItem : public wxMenuItemBase -#if wxUSE_OWNER_DRAWN - , public wxOwnerDrawn -#endif -{ -public: - // ctor & dtor - wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, - int id = wxID_SEPARATOR, - const wxString& name = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - virtual ~wxMenuItem(); - - // override base class virtuals - virtual void SetText(const wxString& strName); - virtual void SetCheckable(bool checkable); - - virtual void Enable(bool bDoEnable = true); - virtual void Check(bool bDoCheck = true); - virtual bool IsChecked() const; - - // unfortunately needed to resolve ambiguity between - // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() - bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } - - // the id for a popup menu is really its menu handle (as required by - // ::AppendMenu() API), so this function will return either the id or the - // menu handle depending on what we're - int GetRealId() const; - - // mark item as belonging to the given radio group - void SetAsRadioGroupStart(); - void SetRadioGroupStart(int start); - void SetRadioGroupEnd(int end); - - // compatibility only, don't use in new code - wxMenuItem(wxMenu *parentMenu, - int id, - const wxString& text, - const wxString& help, - bool isCheckable, - wxMenu *subMenu = (wxMenu *)NULL); - -private: - // common part of all ctors - void Init(); - - // the positions of the first and last items of the radio group this item - // belongs to or -1: start is the radio group start and is valid for all - // but first radio group items (m_isRadioGroupStart == false), end is valid - // only for the first one - union - { - int start; - int end; - } m_radioGroup; - - // does this item start a radio group? - bool m_isRadioGroupStart; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) - -public: - -#if wxABI_VERSION >= 20805 - // return the item label including any mnemonics and accelerators. - // This used to be called GetText. - wxString GetItemLabel() const { return GetText(); } -#endif -}; - -#endif //_MENUITEM_H +/////////////////////////////////////////////////////////////////////////////// +// Name: menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.11.97 +// RCS-ID: $Id: menuitem.h 48053 2007-08-13 17:07:01Z JS $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MENUITEM_H +#define _MENUITEM_H + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + #include "wx/ownerdrw.h" // base class +#endif + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuItem : public wxMenuItemBase +#if wxUSE_OWNER_DRAWN + , public wxOwnerDrawn +#endif +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = (wxMenu *)NULL); + virtual ~wxMenuItem(); + + // override base class virtuals + virtual void SetText(const wxString& strName); + virtual void SetCheckable(bool checkable); + + virtual void Enable(bool bDoEnable = true); + virtual void Check(bool bDoCheck = true); + virtual bool IsChecked() const; + + // unfortunately needed to resolve ambiguity between + // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() + bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } + + // the id for a popup menu is really its menu handle (as required by + // ::AppendMenu() API), so this function will return either the id or the + // menu handle depending on what we're + int GetRealId() const; + + // mark item as belonging to the given radio group + void SetAsRadioGroupStart(); + void SetRadioGroupStart(int start); + void SetRadioGroupEnd(int end); + + // compatibility only, don't use in new code + wxMenuItem(wxMenu *parentMenu, + int id, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = (wxMenu *)NULL); + +private: + // common part of all ctors + void Init(); + + // the positions of the first and last items of the radio group this item + // belongs to or -1: start is the radio group start and is valid for all + // but first radio group items (m_isRadioGroupStart == false), end is valid + // only for the first one + union + { + int start; + int end; + } m_radioGroup; + + // does this item start a radio group? + bool m_isRadioGroupStart; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) + +public: + +#if wxABI_VERSION >= 20805 + // return the item label including any mnemonics and accelerators. + // This used to be called GetText. + wxString GetItemLabel() const { return GetText(); } +#endif +}; + +#endif //_MENUITEM_H diff --git a/Externals/wxWidgets/include/wx/msw/metafile.h b/Externals/wxWidgets/include/wx/msw/metafile.h index 35d6f793f4..04effbb6d8 100644 --- a/Externals/wxWidgets/include/wx/msw/metafile.h +++ b/Externals/wxWidgets/include/wx/msw/metafile.h @@ -1,171 +1,171 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/metafile.h -// Purpose: wxMetaFile, wxMetaFileDC and wxMetaFileDataObject classes -// Author: Julian Smart -// Modified by: VZ 07.01.00: implemented wxMetaFileDataObject -// Created: 01/02/97 -// RCS-ID: $Id: metafile.h 46103 2007-05-18 15:14:44Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_METAFIILE_H_ -#define _WX_METAFIILE_H_ - -#include "wx/dc.h" -#include "wx/gdiobj.h" - -#if wxUSE_DRAG_AND_DROP - #include "wx/dataobj.h" -#endif - -// ---------------------------------------------------------------------------- -// Metafile and metafile device context classes -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMetafile; - -class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData -{ - friend class WXDLLEXPORT wxMetafile; -public: - wxMetafileRefData(); - virtual ~wxMetafileRefData(); - -public: - WXHANDLE m_metafile; - int m_windowsMappingMode; - int m_width, m_height; -}; - -#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) - -class WXDLLEXPORT wxMetafile: public wxGDIObject -{ -public: - wxMetafile(const wxString& file = wxEmptyString); - virtual ~wxMetafile(); - - // After this is called, the metafile cannot be used for anything - // since it is now owned by the clipboard. - virtual bool SetClipboard(int width = 0, int height = 0); - - virtual bool Play(wxDC *dc); - bool Ok() const { return IsOk(); } - bool IsOk() const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; - - // set/get the size of metafile for clipboard operations - wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } - int GetWidth() const { return M_METAFILEDATA->m_width; } - int GetHeight() const { return M_METAFILEDATA->m_height; } - - void SetWidth(int width) { M_METAFILEDATA->m_width = width; } - void SetHeight(int height) { M_METAFILEDATA->m_height = height; } - - // Implementation - WXHANDLE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; } - void SetHMETAFILE(WXHANDLE mf) ; - int GetWindowsMappingMode() const { return M_METAFILEDATA->m_windowsMappingMode; } - void SetWindowsMappingMode(int mm); - -private: - DECLARE_DYNAMIC_CLASS(wxMetafile) -}; - -class WXDLLEXPORT wxMetafileDC: public wxDC -{ -public: - // Don't supply origin and extent - // Supply them to wxMakeMetaFilePlaceable instead. - wxMetafileDC(const wxString& file = wxEmptyString); - - // Supply origin and extent (recommended). - // Then don't need to supply them to wxMakeMetaFilePlaceable. - wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg); - - virtual ~wxMetafileDC(); - - // Should be called at end of drawing - virtual wxMetafile *Close(); - virtual void SetMapMode(int mode); - -#if wxABI_VERSION >= 20805 - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; -#endif // wx ABI 2.8.5+ - - // this method shouldn't have been defined here (DoGetTextExtent() is the - // correct one) but keep it to avoid breaking binary backwards - // compatibility - virtual void GetTextExtent(const wxString& string, long *x, long *y, - long *descent = NULL, long *externalLeading = NULL, - wxFont *theFont = NULL, bool use16bit = false) const; - - // Implementation - wxMetafile *GetMetaFile() const { return m_metaFile; } - void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } - int GetWindowsMappingMode() const { return m_windowsMappingMode; } - void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } - -protected: - virtual void DoGetSize(int *width, int *height) const; - - int m_windowsMappingMode; - wxMetafile* m_metaFile; - -private: - DECLARE_DYNAMIC_CLASS(wxMetafileDC) -}; - -/* - * Pass filename of existing non-placeable metafile, and bounding box. - * Adds a placeable metafile header, sets the mapping mode to anisotropic, - * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode. - * - */ - -// No origin or extent -bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); - -// Optional origin and extent -bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = true); - -// ---------------------------------------------------------------------------- -// wxMetafileDataObject is a specialization of wxDataObject for metafile data -// ---------------------------------------------------------------------------- - -#if wxUSE_DRAG_AND_DROP - -class WXDLLEXPORT wxMetafileDataObject : public wxDataObjectSimple -{ -public: - // ctors - wxMetafileDataObject() : wxDataObjectSimple(wxDF_METAFILE) - { } - wxMetafileDataObject(const wxMetafile& metafile) - : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } - - // virtual functions which you may override if you want to provide data on - // demand only - otherwise, the trivial default versions will be used - virtual void SetMetafile(const wxMetafile& metafile) - { m_metafile = metafile; } - virtual wxMetafile GetMetafile() const - { return m_metafile; } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - -protected: - wxMetafile m_metafile; -}; - -#endif // wxUSE_DRAG_AND_DROP - -#endif - // _WX_METAFIILE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/metafile.h +// Purpose: wxMetaFile, wxMetaFileDC and wxMetaFileDataObject classes +// Author: Julian Smart +// Modified by: VZ 07.01.00: implemented wxMetaFileDataObject +// Created: 01/02/97 +// RCS-ID: $Id: metafile.h 46103 2007-05-18 15:14:44Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_METAFIILE_H_ +#define _WX_METAFIILE_H_ + +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DRAG_AND_DROP + #include "wx/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// Metafile and metafile device context classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMetafile; + +class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData +{ + friend class WXDLLEXPORT wxMetafile; +public: + wxMetafileRefData(); + virtual ~wxMetafileRefData(); + +public: + WXHANDLE m_metafile; + int m_windowsMappingMode; + int m_width, m_height; +}; + +#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) + +class WXDLLEXPORT wxMetafile: public wxGDIObject +{ +public: + wxMetafile(const wxString& file = wxEmptyString); + virtual ~wxMetafile(); + + // After this is called, the metafile cannot be used for anything + // since it is now owned by the clipboard. + virtual bool SetClipboard(int width = 0, int height = 0); + + virtual bool Play(wxDC *dc); + bool Ok() const { return IsOk(); } + bool IsOk() const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; + + // set/get the size of metafile for clipboard operations + wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } + int GetWidth() const { return M_METAFILEDATA->m_width; } + int GetHeight() const { return M_METAFILEDATA->m_height; } + + void SetWidth(int width) { M_METAFILEDATA->m_width = width; } + void SetHeight(int height) { M_METAFILEDATA->m_height = height; } + + // Implementation + WXHANDLE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; } + void SetHMETAFILE(WXHANDLE mf) ; + int GetWindowsMappingMode() const { return M_METAFILEDATA->m_windowsMappingMode; } + void SetWindowsMappingMode(int mm); + +private: + DECLARE_DYNAMIC_CLASS(wxMetafile) +}; + +class WXDLLEXPORT wxMetafileDC: public wxDC +{ +public: + // Don't supply origin and extent + // Supply them to wxMakeMetaFilePlaceable instead. + wxMetafileDC(const wxString& file = wxEmptyString); + + // Supply origin and extent (recommended). + // Then don't need to supply them to wxMakeMetaFilePlaceable. + wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg); + + virtual ~wxMetafileDC(); + + // Should be called at end of drawing + virtual wxMetafile *Close(); + virtual void SetMapMode(int mode); + +#if wxABI_VERSION >= 20805 + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const; +#endif // wx ABI 2.8.5+ + + // this method shouldn't have been defined here (DoGetTextExtent() is the + // correct one) but keep it to avoid breaking binary backwards + // compatibility + virtual void GetTextExtent(const wxString& string, long *x, long *y, + long *descent = NULL, long *externalLeading = NULL, + wxFont *theFont = NULL, bool use16bit = false) const; + + // Implementation + wxMetafile *GetMetaFile() const { return m_metaFile; } + void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + int GetWindowsMappingMode() const { return m_windowsMappingMode; } + void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } + +protected: + virtual void DoGetSize(int *width, int *height) const; + + int m_windowsMappingMode; + wxMetafile* m_metaFile; + +private: + DECLARE_DYNAMIC_CLASS(wxMetafileDC) +}; + +/* + * Pass filename of existing non-placeable metafile, and bounding box. + * Adds a placeable metafile header, sets the mapping mode to anisotropic, + * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode. + * + */ + +// No origin or extent +bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); + +// Optional origin and extent +bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = true); + +// ---------------------------------------------------------------------------- +// wxMetafileDataObject is a specialization of wxDataObject for metafile data +// ---------------------------------------------------------------------------- + +#if wxUSE_DRAG_AND_DROP + +class WXDLLEXPORT wxMetafileDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxMetafileDataObject() : wxDataObjectSimple(wxDF_METAFILE) + { } + wxMetafileDataObject(const wxMetafile& metafile) + : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxMetafile& metafile) + { m_metafile = metafile; } + virtual wxMetafile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + +protected: + wxMetafile m_metafile; +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif + // _WX_METAFIILE_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/microwin.h b/Externals/wxWidgets/include/wx/msw/microwin.h index ef077b13ad..934302d0c6 100644 --- a/Externals/wxWidgets/include/wx/msw/microwin.h +++ b/Externals/wxWidgets/include/wx/msw/microwin.h @@ -1,235 +1,235 @@ -/* -///////////////////////////////////////////////////////////////////////////// -// Name: microwin.h -// Purpose: Extra implementation for MicroWindows -// Author: Julian Smart -// Created: 2001-05-31 -// RCS-ID: $Id: microwin.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -*/ - -#ifndef _WX_MICROWIN_H_ -#define _WX_MICROWIN_H_ - -/* Implemented by microwin.cpp */ - -#ifdef __cplusplus -extern "C" { -#endif - -BOOL SetCursorPos(int x, int y); - -HCURSOR SetCursor(HCURSOR hCursor); - -/* Implemented with wrong number of args by MicroWindows */ -/* so we need to use a different name */ -int GetScrollPosWX (HWND hWnd, int iSBar); - -BOOL ScrollWindow(HWND, int xAmount, int yAmount, - CONST RECT* lpRect, CONST RECT* lpClipRect); - -HWND WindowFromPoint(POINT pt); -SHORT GetKeyState(int nVirtKey); -HWND SetParent(HWND hWndChild, HWND hWndNewParent); -VOID DragAcceptFiles(HWND, BOOL); -BOOL IsDialogMessage(HWND hWnd, MSG* msg); -DWORD GetMessagePos(VOID); -BOOL IsIconic(HWND hWnd); -int SetMapMode(HDC hDC, int mode); -int GetMapMode(HDC hDC); -HCURSOR LoadCursor(HINSTANCE hInst, int cursor); -DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz); -VOID DestroyIcon(HICON hIcon); -COLORREF GetTextColor(HDC hdc); -COLORREF GetBkColor(HDC hdc); -HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b); -BOOL IntersectClipRect(HDC hdc, int x, int y, - int w, int h); -BOOL GetClipBox(HDC hdc, RECT* rect); -BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); -BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize); -BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint); -BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize); -BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize); -BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags); -int SetPolyFillMode(HDC hdc, int mode); -BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2); -BOOL MaskBlt(HDC hdc, int x, int y, int w, int h, - HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop); -UINT RealizePalette(HDC hDC); -BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint); -int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj); - -/* For some reason these aren't defined in the headers */ -BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) ; -BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos); -BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos); -BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos); -BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos); -BOOL SetScrollInfo (HWND hWnd, int iSBar, - LPCSCROLLINFO lpsi, BOOL fRedraw); -BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi); -BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow); -HBITMAP WINAPI -CreateBitmap( int width, int height, int nPlanes, int bPP, LPCVOID lpData); - -#ifdef __cplusplus -} -#endif - -/* - * Key State Masks for Mouse Messages - */ -#ifndef MK_LBUTTON -#define MK_LBUTTON 0x0001 -#define MK_RBUTTON 0x0002 -#define MK_SHIFT 0x0004 -#define MK_CONTROL 0x0008 -#define MK_MBUTTON 0x0010 -#endif - -/* - * DrawIcon flags - */ - -#ifndef DI_MASK -#define DI_MASK 0x0001 -#define DI_IMAGE 0x0002 -#define DI_NORMAL 0x0003 -#define DI_COMPAT 0x0004 -#define DI_DEFAULTSIZE 0x0008 -#endif - -/* TODO: May have to fake these message */ -#ifndef WM_INITDIALOG -#define WM_INITDIALOG 0x0110 -#endif -#ifndef WM_QUERYENDSESSION -#define WM_QUERYENDSESSION 0x0011 -#endif -#ifndef WM_ENDSESSION -#define WM_ENDSESSION 0x0016 -#endif -#ifndef WM_SETCURSOR -#define WM_SETCURSOR 0x0020 -#endif -#ifndef WM_GETMINMAXINFO -#define WM_GETMINMAXINFO 0x0024 -typedef struct tagMINMAXINFO { - POINT ptReserved; - POINT ptMaxSize; - POINT ptMaxPosition; - POINT ptMinTrackSize; - POINT ptMaxTrackSize; -} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; - -#endif -#ifndef WM_SYSCOMMAND -#define WM_SYSCOMMAND 0x0112 -#endif -#ifndef WM_SYSCOLORCHANGE -#define WM_SYSCOLORCHANGE 0x0015 -#endif -#ifndef WM_QUERYNEWPALETTE -#define WM_QUERYNEWPALETTE 0x030F -#endif -#ifndef WM_PALETTEISCHANGING -#define WM_PALETTEISCHANGING 0x0310 -#endif -#ifndef WM_PALETTECHANGED -#define WM_PALETTECHANGED 0x0311 -#endif -#ifndef WM_NOTIFY -#define WM_NOTIFY 0x004E -#endif -#ifndef WM_DROPFILES -#define WM_DROPFILES 0x0233 -#endif - -#ifndef PALETTERGB -#define PALETTERGB RGB -#endif - -#ifndef MM_TEXT -#define MM_TEXT 1 -#define MM_LOMETRIC 2 -#define MM_HIMETRIC 3 -#define MM_LOENGLISH 4 -#define MM_HIENGLISH 5 -#define MM_TWIPS 6 -#define MM_ISOTROPIC 7 -#define MM_ANISOTROPIC 8 -#endif - -#ifndef SC_MAXIMIZE -#define SC_MINIMIZE 0xF020 -#define SC_MAXIMIZE 0xF030 -#endif - -// TODO: all of them -#ifndef IDC_ARROW -#define IDC_ARROW 1 -#endif - -/* - * Standard Cursor IDs - */ -#ifndef MAKEINTRESOURCE -#define MAKEINTRESOURCE(r) r -#endif - -#ifndef IDC_ARROW -#define IDC_ARROW MAKEINTRESOURCE(32512) -#define IDC_IBEAM MAKEINTRESOURCE(32513) -#define IDC_WAIT MAKEINTRESOURCE(32514) -#define IDC_CROSS MAKEINTRESOURCE(32515) -#define IDC_UPARROW MAKEINTRESOURCE(32516) -#define IDC_SIZE MAKEINTRESOURCE(32640) /* OBSOLETE: use IDC_SIZEALL */ -#define IDC_ICON MAKEINTRESOURCE(32641) /* OBSOLETE: use IDC_ARROW */ -#define IDC_SIZENWSE MAKEINTRESOURCE(32642) -#define IDC_SIZENESW MAKEINTRESOURCE(32643) -#define IDC_SIZEWE MAKEINTRESOURCE(32644) -#define IDC_SIZENS MAKEINTRESOURCE(32645) -#define IDC_SIZEALL MAKEINTRESOURCE(32646) -#define IDC_NO MAKEINTRESOURCE(32648) /* not in win3.1 */ -#if(WINVER >= 0x0500) -#define IDC_HAND MAKEINTRESOURCE(32649) -#endif /* WINVER >= 0x0500 */ -#define IDC_APPSTARTING MAKEINTRESOURCE(32650) /* not in win3.1 */ -#if(WINVER >= 0x0400) -#define IDC_HELP MAKEINTRESOURCE(32651) -#endif /* WINVER >= 0x0400 */ -#endif - -/* ExtFloodFill style flags */ -#define FLOODFILLBORDER 0 -#define FLOODFILLSURFACE 1 - -/* PolyFill() Modes */ -#define ALTERNATE 1 -#define WINDING 2 -#define POLYFILL_LAST 2 - -/* Quaternary raster codes */ -#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) - -/* Device Parameters for GetDeviceCaps() */ -#define DRIVERVERSION 0 /* Device driver version */ -#define TECHNOLOGY 2 /* Device classification */ -#define HORZSIZE 4 /* Horizontal size in millimeters */ -#define VERTSIZE 6 /* Vertical size in millimeters */ - -/* Ternary raster operations */ -/* Now defined by MicroWindows */ -#if 0 -#define DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */ -#define WHITENESS (DWORD)0x00FF0062 /* dest = WHITE */ -#define SRCERASE (DWORD)0x00440328 /* dest = source AND (NOT dest ) */ -#define MERGEPAINT (DWORD)0x00BB0226 /* dest = (NOT source) OR dest */ -#define SRCPAINT (DWORD)0x00EE0086 /* dest = source OR dest */ -#define NOTSRCCOPY (DWORD)0x00330008 /* dest = (NOT source) */ -#endif - -#endif /* _WX_MICROWIN_H_ */ +/* +///////////////////////////////////////////////////////////////////////////// +// Name: microwin.h +// Purpose: Extra implementation for MicroWindows +// Author: Julian Smart +// Created: 2001-05-31 +// RCS-ID: $Id: microwin.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +*/ + +#ifndef _WX_MICROWIN_H_ +#define _WX_MICROWIN_H_ + +/* Implemented by microwin.cpp */ + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL SetCursorPos(int x, int y); + +HCURSOR SetCursor(HCURSOR hCursor); + +/* Implemented with wrong number of args by MicroWindows */ +/* so we need to use a different name */ +int GetScrollPosWX (HWND hWnd, int iSBar); + +BOOL ScrollWindow(HWND, int xAmount, int yAmount, + CONST RECT* lpRect, CONST RECT* lpClipRect); + +HWND WindowFromPoint(POINT pt); +SHORT GetKeyState(int nVirtKey); +HWND SetParent(HWND hWndChild, HWND hWndNewParent); +VOID DragAcceptFiles(HWND, BOOL); +BOOL IsDialogMessage(HWND hWnd, MSG* msg); +DWORD GetMessagePos(VOID); +BOOL IsIconic(HWND hWnd); +int SetMapMode(HDC hDC, int mode); +int GetMapMode(HDC hDC); +HCURSOR LoadCursor(HINSTANCE hInst, int cursor); +DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz); +VOID DestroyIcon(HICON hIcon); +COLORREF GetTextColor(HDC hdc); +COLORREF GetBkColor(HDC hdc); +HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b); +BOOL IntersectClipRect(HDC hdc, int x, int y, + int w, int h); +BOOL GetClipBox(HDC hdc, RECT* rect); +BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); +BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize); +BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint); +BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize); +BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize); +BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags); +int SetPolyFillMode(HDC hdc, int mode); +BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2); +BOOL MaskBlt(HDC hdc, int x, int y, int w, int h, + HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop); +UINT RealizePalette(HDC hDC); +BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint); +int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj); + +/* For some reason these aren't defined in the headers */ +BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) ; +BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos); +BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos); +BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos); +BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos); +BOOL SetScrollInfo (HWND hWnd, int iSBar, + LPCSCROLLINFO lpsi, BOOL fRedraw); +BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi); +BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow); +HBITMAP WINAPI +CreateBitmap( int width, int height, int nPlanes, int bPP, LPCVOID lpData); + +#ifdef __cplusplus +} +#endif + +/* + * Key State Masks for Mouse Messages + */ +#ifndef MK_LBUTTON +#define MK_LBUTTON 0x0001 +#define MK_RBUTTON 0x0002 +#define MK_SHIFT 0x0004 +#define MK_CONTROL 0x0008 +#define MK_MBUTTON 0x0010 +#endif + +/* + * DrawIcon flags + */ + +#ifndef DI_MASK +#define DI_MASK 0x0001 +#define DI_IMAGE 0x0002 +#define DI_NORMAL 0x0003 +#define DI_COMPAT 0x0004 +#define DI_DEFAULTSIZE 0x0008 +#endif + +/* TODO: May have to fake these message */ +#ifndef WM_INITDIALOG +#define WM_INITDIALOG 0x0110 +#endif +#ifndef WM_QUERYENDSESSION +#define WM_QUERYENDSESSION 0x0011 +#endif +#ifndef WM_ENDSESSION +#define WM_ENDSESSION 0x0016 +#endif +#ifndef WM_SETCURSOR +#define WM_SETCURSOR 0x0020 +#endif +#ifndef WM_GETMINMAXINFO +#define WM_GETMINMAXINFO 0x0024 +typedef struct tagMINMAXINFO { + POINT ptReserved; + POINT ptMaxSize; + POINT ptMaxPosition; + POINT ptMinTrackSize; + POINT ptMaxTrackSize; +} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; + +#endif +#ifndef WM_SYSCOMMAND +#define WM_SYSCOMMAND 0x0112 +#endif +#ifndef WM_SYSCOLORCHANGE +#define WM_SYSCOLORCHANGE 0x0015 +#endif +#ifndef WM_QUERYNEWPALETTE +#define WM_QUERYNEWPALETTE 0x030F +#endif +#ifndef WM_PALETTEISCHANGING +#define WM_PALETTEISCHANGING 0x0310 +#endif +#ifndef WM_PALETTECHANGED +#define WM_PALETTECHANGED 0x0311 +#endif +#ifndef WM_NOTIFY +#define WM_NOTIFY 0x004E +#endif +#ifndef WM_DROPFILES +#define WM_DROPFILES 0x0233 +#endif + +#ifndef PALETTERGB +#define PALETTERGB RGB +#endif + +#ifndef MM_TEXT +#define MM_TEXT 1 +#define MM_LOMETRIC 2 +#define MM_HIMETRIC 3 +#define MM_LOENGLISH 4 +#define MM_HIENGLISH 5 +#define MM_TWIPS 6 +#define MM_ISOTROPIC 7 +#define MM_ANISOTROPIC 8 +#endif + +#ifndef SC_MAXIMIZE +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#endif + +// TODO: all of them +#ifndef IDC_ARROW +#define IDC_ARROW 1 +#endif + +/* + * Standard Cursor IDs + */ +#ifndef MAKEINTRESOURCE +#define MAKEINTRESOURCE(r) r +#endif + +#ifndef IDC_ARROW +#define IDC_ARROW MAKEINTRESOURCE(32512) +#define IDC_IBEAM MAKEINTRESOURCE(32513) +#define IDC_WAIT MAKEINTRESOURCE(32514) +#define IDC_CROSS MAKEINTRESOURCE(32515) +#define IDC_UPARROW MAKEINTRESOURCE(32516) +#define IDC_SIZE MAKEINTRESOURCE(32640) /* OBSOLETE: use IDC_SIZEALL */ +#define IDC_ICON MAKEINTRESOURCE(32641) /* OBSOLETE: use IDC_ARROW */ +#define IDC_SIZENWSE MAKEINTRESOURCE(32642) +#define IDC_SIZENESW MAKEINTRESOURCE(32643) +#define IDC_SIZEWE MAKEINTRESOURCE(32644) +#define IDC_SIZENS MAKEINTRESOURCE(32645) +#define IDC_SIZEALL MAKEINTRESOURCE(32646) +#define IDC_NO MAKEINTRESOURCE(32648) /* not in win3.1 */ +#if(WINVER >= 0x0500) +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif /* WINVER >= 0x0500 */ +#define IDC_APPSTARTING MAKEINTRESOURCE(32650) /* not in win3.1 */ +#if(WINVER >= 0x0400) +#define IDC_HELP MAKEINTRESOURCE(32651) +#endif /* WINVER >= 0x0400 */ +#endif + +/* ExtFloodFill style flags */ +#define FLOODFILLBORDER 0 +#define FLOODFILLSURFACE 1 + +/* PolyFill() Modes */ +#define ALTERNATE 1 +#define WINDING 2 +#define POLYFILL_LAST 2 + +/* Quaternary raster codes */ +#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) + +/* Device Parameters for GetDeviceCaps() */ +#define DRIVERVERSION 0 /* Device driver version */ +#define TECHNOLOGY 2 /* Device classification */ +#define HORZSIZE 4 /* Horizontal size in millimeters */ +#define VERTSIZE 6 /* Vertical size in millimeters */ + +/* Ternary raster operations */ +/* Now defined by MicroWindows */ +#if 0 +#define DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */ +#define WHITENESS (DWORD)0x00FF0062 /* dest = WHITE */ +#define SRCERASE (DWORD)0x00440328 /* dest = source AND (NOT dest ) */ +#define MERGEPAINT (DWORD)0x00BB0226 /* dest = (NOT source) OR dest */ +#define SRCPAINT (DWORD)0x00EE0086 /* dest = source OR dest */ +#define NOTSRCCOPY (DWORD)0x00330008 /* dest = (NOT source) */ +#endif + +#endif /* _WX_MICROWIN_H_ */ diff --git a/Externals/wxWidgets/include/wx/msw/mimetype.h b/Externals/wxWidgets/include/wx/msw/mimetype.h index 9052d07dcb..0b5107ac69 100644 --- a/Externals/wxWidgets/include/wx/msw/mimetype.h +++ b/Externals/wxWidgets/include/wx/msw/mimetype.h @@ -1,122 +1,122 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mimetype.h -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MIMETYPE_IMPL_H -#define _MIMETYPE_IMPL_H - -#include "wx/defs.h" - -#if wxUSE_MIMETYPE - -#include "wx/mimetype.h" - -// ---------------------------------------------------------------------------- -// wxFileTypeImpl is the MSW version of wxFileType, this is a private class -// and is never used directly by the application -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileTypeImpl -{ -public: - // ctor - wxFileTypeImpl() { } - - // one of these Init() function must be called (ctor can't take any - // arguments because it's common) - - // initialize us with our file type name and extension - in this case - // we will read all other data from the registry - void Init(const wxString& strFileType, const wxString& ext); - - // implement accessor functions - bool GetExtensions(wxArrayString& extensions); - bool GetMimeType(wxString *mimeType) const; - bool GetMimeTypes(wxArrayString& mimeTypes) const; - bool GetIcon(wxIconLocation *iconLoc) const; - bool GetDescription(wxString *desc) const; - bool GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) const; - bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters& params) const; - - size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, - const wxFileType::MessageParameters& params) const; - - bool Unassociate(); - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is true - bool SetCommand(const wxString& cmd, - const wxString& verb, - bool overwriteprompt = true); - - bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); - - // this is called by Associate - bool SetDescription (const wxString& desc); - -private: - // helper function: reads the command corresponding to the specified verb - // from the registry (returns an empty string if not found) - wxString GetCommand(const wxChar *verb) const; - - // get the registry path for the given verb - wxString GetVerbPath(const wxString& verb) const; - - // check that the registry key for our extension exists, create it if it - // doesn't, return false if this failed - bool EnsureExtKeyExists(); - - wxString m_strFileType, // may be empty - m_ext; - - // these methods are not publicly accessible (as wxMimeTypesManager - // doesn't know about them), and should only be called by Unassociate - - bool RemoveOpenCommand(); - bool RemoveCommand(const wxString& verb); - bool RemoveMimeType(); - bool RemoveDefaultIcon(); - bool RemoveDescription(); -}; - -class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl -{ -public: - // nothing to do here, we don't load any data but just go and fetch it from - // the registry when asked for - wxMimeTypesManagerImpl() { } - - // implement containing class functions - wxFileType *GetFileTypeFromExtension(const wxString& ext); - wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext); - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - // this are NOPs under Windows - bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = true) - { return true; } - bool ReadMimeTypes(const wxString& WXUNUSED(filename)) - { return true; } - - // create a new filetype association - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - - // create a new filetype with the given name and extension - wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); -}; - -#endif // wxUSE_MIMETYPE - -#endif - //_MIMETYPE_IMPL_H - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// RCS-ID: $Id: mimetype.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE + +#include "wx/mimetype.h" + +// ---------------------------------------------------------------------------- +// wxFileTypeImpl is the MSW version of wxFileType, this is a private class +// and is never used directly by the application +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileTypeImpl +{ +public: + // ctor + wxFileTypeImpl() { } + + // one of these Init() function must be called (ctor can't take any + // arguments because it's common) + + // initialize us with our file type name and extension - in this case + // we will read all other data from the registry + void Init(const wxString& strFileType, const wxString& ext); + + // implement accessor functions + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + bool GetDescription(wxString *desc) const; + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters& params) const; + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters& params) const; + + size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, + const wxFileType::MessageParameters& params) const; + + bool Unassociate(); + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is true + bool SetCommand(const wxString& cmd, + const wxString& verb, + bool overwriteprompt = true); + + bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); + + // this is called by Associate + bool SetDescription (const wxString& desc); + +private: + // helper function: reads the command corresponding to the specified verb + // from the registry (returns an empty string if not found) + wxString GetCommand(const wxChar *verb) const; + + // get the registry path for the given verb + wxString GetVerbPath(const wxString& verb) const; + + // check that the registry key for our extension exists, create it if it + // doesn't, return false if this failed + bool EnsureExtKeyExists(); + + wxString m_strFileType, // may be empty + m_ext; + + // these methods are not publicly accessible (as wxMimeTypesManager + // doesn't know about them), and should only be called by Unassociate + + bool RemoveOpenCommand(); + bool RemoveCommand(const wxString& verb); + bool RemoveMimeType(); + bool RemoveDefaultIcon(); + bool RemoveDescription(); +}; + +class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl +{ +public: + // nothing to do here, we don't load any data but just go and fetch it from + // the registry when asked for + wxMimeTypesManagerImpl() { } + + // implement containing class functions + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext); + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + // this are NOPs under Windows + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = true) + { return true; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) + { return true; } + + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + + // create a new filetype with the given name and extension + wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); +}; + +#endif // wxUSE_MIMETYPE + +#endif + //_MIMETYPE_IMPL_H + diff --git a/Externals/wxWidgets/include/wx/msw/minifram.h b/Externals/wxWidgets/include/wx/msw/minifram.h index d2e23d9cf7..63dc24f1bd 100644 --- a/Externals/wxWidgets/include/wx/msw/minifram.h +++ b/Externals/wxWidgets/include/wx/msw/minifram.h @@ -1,52 +1,52 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/minifram.h -// Purpose: wxMiniFrame class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: minifram.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MINIFRAM_H_ -#define _WX_MINIFRAM_H_ - -#include "wx/frame.h" - -class WXDLLEXPORT wxMiniFrame : public wxFrame -{ -public: - wxMiniFrame() { } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, - const wxString& name = wxFrameNameStr) - { - return wxFrame::Create(parent, id, title, pos, size, - style | - wxFRAME_TOOL_WINDOW | - (parent ? wxFRAME_FLOAT_ON_PARENT : 0), name); - } - - wxMiniFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame) -}; - -#endif - // _WX_MINIFRAM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/minifram.h +// Purpose: wxMiniFrame class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: minifram.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLEXPORT wxMiniFrame : public wxFrame +{ +public: + wxMiniFrame() { } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxFrameNameStr) + { + return wxFrame::Create(parent, id, title, pos, size, + style | + wxFRAME_TOOL_WINDOW | + (parent ? wxFRAME_FLOAT_ON_PARENT : 0), name); + } + + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame) +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/Externals/wxWidgets/include/wx/msw/missing.h b/Externals/wxWidgets/include/wx/msw/missing.h index c84134bdf6..871cbfafd0 100644 --- a/Externals/wxWidgets/include/wx/msw/missing.h +++ b/Externals/wxWidgets/include/wx/msw/missing.h @@ -1,495 +1,495 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/missing.h -// Purpose: Declarations for parts of the Win32 SDK that are missing in -// the versions that come with some compilers -// Created: 2002/04/23 -// RCS-ID: $Id: missing.h 48436 2007-08-28 19:26:16Z JS $ -// Copyright: (c) 2002 Mattia Barbon -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MISSING_H_ -#define _WX_MISSING_H_ - -/* - * The following are required for VC++ 6. - */ - -// Needed by cursor.cpp -#ifndef IDC_HAND - #define IDC_HAND MAKEINTRESOURCE(32649) -#endif - -// Needed by strconv.cpp -#ifndef WC_NO_BEST_FIT_CHARS - #define WC_NO_BEST_FIT_CHARS 0x400 -#endif - -#ifndef WM_CONTEXTMENU - #define WM_CONTEXTMENU 0x007B -#endif - -// Needed by toplevel.cpp -#ifndef WM_UPDATEUISTATE - #define WM_UPDATEUISTATE 0x0128 -#endif - -#ifndef WM_CHANGEUISTATE - #define WM_CHANGEUISTATE 0x0127 -#endif - -#ifndef WM_PRINTCLIENT - #define WM_PRINTCLIENT 0x318 -#endif - -// Needed by toplevel.cpp -#ifndef UIS_SET - #define UIS_SET 1 - #define UIS_CLEAR 2 - #define UIS_INITIALIZE 3 -#endif - -#ifndef UISF_HIDEFOCUS - #define UISF_HIDEFOCUS 1 -#endif - -#ifndef UISF_HIDEACCEL - #define UISF_HIDEACCEL 2 -#endif - -#ifndef OFN_EXPLORER - #define OFN_EXPLORER 0x00080000 -#endif - -#ifndef OFN_ENABLESIZING - #define OFN_ENABLESIZING 0x00800000 -#endif - -// Needed by window.cpp -#if wxUSE_MOUSEWHEEL - #ifndef WM_MOUSEWHEEL - #define WM_MOUSEWHEEL 0x020A - #endif - #ifndef WHEEL_DELTA - #define WHEEL_DELTA 120 - #endif - #ifndef SPI_GETWHEELSCROLLLINES - #define SPI_GETWHEELSCROLLLINES 104 - #endif -#endif // wxUSE_MOUSEWHEEL - -// Needed by window.cpp -#ifndef VK_OEM_1 - #define VK_OEM_1 0xBA - #define VK_OEM_2 0xBF - #define VK_OEM_3 0xC0 - #define VK_OEM_4 0xDB - #define VK_OEM_5 0xDC - #define VK_OEM_6 0xDD - #define VK_OEM_7 0xDE -#endif - -#ifndef VK_OEM_COMMA - #define VK_OEM_PLUS 0xBB - #define VK_OEM_COMMA 0xBC - #define VK_OEM_MINUS 0xBD - #define VK_OEM_PERIOD 0xBE -#endif - -#ifndef SM_TABLETPC - #define SM_TABLETPC 86 -#endif - -#ifndef INKEDIT_CLASS -# define INKEDIT_CLASSW L"INKEDIT" -# ifdef UNICODE -# define INKEDIT_CLASS INKEDIT_CLASSW -# else -# define INKEDIT_CLASS "INKEDIT" -# endif -#endif - -#ifndef EM_SETINKINSERTMODE -# define EM_SETINKINSERTMODE (WM_USER + 0x0204) -#endif - -#ifndef EM_SETUSEMOUSEFORINPUT -#define EM_SETUSEMOUSEFORINPUT (WM_USER + 0x224) -#endif - -#ifndef TPM_RECURSE -#define TPM_RECURSE 1 -#endif - - -#ifndef WS_EX_LAYOUTRTL -#define WS_EX_LAYOUTRTL 0x00400000 -#endif - -#ifndef WS_EX_COMPOSITED -#define WS_EX_COMPOSITED 0x02000000L -#endif - -#ifndef WS_EX_LAYERED -#define WS_EX_LAYERED 0x00080000 -#endif - -#ifndef LWA_ALPHA -#define LWA_ALPHA 2 -#endif - -#if defined __VISUALC__ && __VISUALC__ <= 1200 && !defined MIIM_BITMAP -#define MIIM_STRING 0x00000040 -#define MIIM_BITMAP 0x00000080 -#define MIIM_FTYPE 0x00000100 -#define HBMMENU_CALLBACK ((HBITMAP) -1) -typedef struct tagMENUINFO -{ - DWORD cbSize; - DWORD fMask; - DWORD dwStyle; - UINT cyMax; - HBRUSH hbrBack; - DWORD dwContextHelpID; - DWORD dwMenuData; -} MENUINFO, FAR *LPMENUINFO; -struct wxMENUITEMINFO_ -{ - UINT cbSize; - UINT fMask; - UINT fType; - UINT fState; - UINT wID; - HMENU hSubMenu; - HBITMAP hbmpChecked; - HBITMAP hbmpUnchecked; - DWORD dwItemData; - LPTSTR dwTypeData; - UINT cch; - HBITMAP hbmpItem; -}; -#else -#define wxMENUITEMINFO_ MENUITEMINFO -#endif - -/* - * The following are required for VC++ 5 when the PSDK is not available. - */ - -#if defined __VISUALC__ && __VISUALC__ <= 1100 - -#ifndef VER_NT_WORKSTATION - -typedef struct _OSVERSIONINFOEXA { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - CHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; -typedef struct _OSVERSIONINFOEXW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW; - -#ifdef UNICODE -typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; -typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; -#else -typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; -typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; -#endif - -#endif // defined VER_NT_WORKSTATION - -#ifndef CP_SYMBOL - #define CP_SYMBOL 42 -#endif - -// NMLVCUSTOMDRAW originally didn't have the iSubItem member. It was added -// with IE4, as was IPN_FIRST which is used as a test :-(. -// -#ifndef IPN_FIRST - -typedef struct wxtagNMLVCUSTOMDRAW_ { - NMCUSTOMDRAW nmcd; - COLORREF clrText; - COLORREF clrTextBk; - int iSubItem; -} wxNMLVCUSTOMDRAW_, *wxLPNMLVCUSTOMDRAW_; - -#define NMLVCUSTOMDRAW wxNMLVCUSTOMDRAW_ -#define LPNMLVCUSTOMDRAW wxLPNMLVCUSTOMDRAW_ - -#endif // defined IPN_FIRST - -#endif // defined __VISUALC__ && __VISUALC__ <= 1100 - -// ---------------------------------------------------------------------------- -// ListView common control -// Needed by listctrl.cpp -// ---------------------------------------------------------------------------- - -#ifndef LVS_EX_FULLROWSELECT - #define LVS_EX_FULLROWSELECT 0x00000020 -#endif - -#ifndef LVS_EX_LABELTIP - #define LVS_EX_LABELTIP 0x00004000 -#endif - -#ifndef LVS_EX_SUBITEMIMAGES - #define LVS_EX_SUBITEMIMAGES 0x00000002 -#endif - -#ifndef HDN_GETDISPINFOW - #define HDN_GETDISPINFOW (HDN_FIRST-29) -#endif - - /* - * In addition to the above, the following are required for several compilers. - */ - -#if !defined(CCS_VERT) -#define CCS_VERT 0x00000080L -#endif - -#if !defined(CCS_RIGHT) -#define CCS_RIGHT (CCS_VERT|CCS_BOTTOM) -#endif - -#if !defined(TB_SETDISABLEDIMAGELIST) - #define TB_SETDISABLEDIMAGELIST (WM_USER + 54) -#endif // !defined(TB_SETDISABLEDIMAGELIST) - -#ifndef CFM_BACKCOLOR - #define CFM_BACKCOLOR 0x04000000 -#endif - -#ifndef HANGUL_CHARSET - #define HANGUL_CHARSET 129 -#endif - -#ifndef CCM_SETUNICODEFORMAT - #define CCM_SETUNICODEFORMAT 8197 -#endif - -// ---------------------------------------------------------------------------- -// Tree control -// ---------------------------------------------------------------------------- - -#ifndef TV_FIRST - #define TV_FIRST 0x1100 -#endif - -#ifndef TVS_FULLROWSELECT - #define TVS_FULLROWSELECT 0x1000 -#endif - -#ifndef TVM_SETBKCOLOR - #define TVM_SETBKCOLOR (TV_FIRST + 29) - #define TVM_SETTEXTCOLOR (TV_FIRST + 30) -#endif - - /* - * The following are required for BC++ 5.5 (none at present.) - */ - - /* - * The following are specifically required for Digital Mars C++ - */ - -#ifdef __DMC__ - -typedef struct _OSVERSIONINFOEX { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - TCHAR szCSDVersion[ 128 ]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEX; - -#ifndef _TrackMouseEvent - #define _TrackMouseEvent TrackMouseEvent -#endif - -#ifndef LVM_SETEXTENDEDLISTVIEWSTYLE - #define LVM_SETEXTENDEDLISTVIEWSTYLE (0x1000 + 54) -#endif - -#ifndef LVM_GETSUBITEMRECT - #define LVM_GETSUBITEMRECT (0x1000 + 56) -#endif - -#ifndef LVCF_IMAGE - #define LVCF_IMAGE 0x0010 -#endif - -#ifndef Header_GetItemRect - #define Header_GetItemRect(w,i,r) \ - (BOOL)SendMessage((w),HDM_GETITEMRECT,(WPARAM)(i),(LPARAM)(r)) -#endif - -#ifndef HDM_GETITEMRECT - #define HDM_GETITEMRECT (HDM_FIRST+7) -#endif - -#ifndef ListView_GetHeader - #define ListView_GetHeader(w) (HWND)SendMessage((w),LVM_GETHEADER,0,0) -#endif - -#ifndef ListView_GetSubItemRect - #define ListView_GetSubItemRect(w, i, s, c, p) (HWND)SendMessage(w,LVM_GETSUBITEMRECT,i, ((p) ? ((((LPRECT)(p))->top = s), (((LPRECT)(p))->left = c), (LPARAM)(p)) : (LPARAM)(LPRECT)NULL)) -#endif - -#ifndef LVM_GETHEADER - #define LVM_GETHEADER (LVM_FIRST+31) -#endif - -#ifndef LVSICF_NOSCROLL - #define LVSICF_NOINVALIDATEALL 0x0001 - #define LVSICF_NOSCROLL 0x0002 -#endif - -#ifndef CP_SYMBOL - #define CP_SYMBOL 42 -#endif - -// ---------------------------------------------------------------------------- -// wxDisplay -// ---------------------------------------------------------------------------- - -// The windows headers with Digital Mars lack some typedefs. -// typedef them as my_XXX and then #define to rename to XXX in case -// a newer version of Digital Mars fixes the headers -// (or up to date PSDK is in use with older version) -// also we use any required definition (MONITOR_DEFAULTTONULL) to recognize -// whether whole missing block needs to be included - -#ifndef MONITOR_DEFAULTTONULL - - #define HMONITOR_DECLARED - DECLARE_HANDLE(HMONITOR); - typedef BOOL(CALLBACK* my_MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); - #define MONITORENUMPROC my_MONITORENUMPROC - typedef struct my_tagMONITORINFO { - DWORD cbSize; - RECT rcMonitor; - RECT rcWork; - DWORD dwFlags; - } my_MONITORINFO,*my_LPMONITORINFO; - #define MONITORINFO my_MONITORINFO - #define LPMONITORINFO my_LPMONITORINFO - - typedef struct my_MONITORINFOEX : public my_tagMONITORINFO - { - TCHAR szDevice[CCHDEVICENAME]; - } my_MONITORINFOEX, *my_LPMONITORINFOEX; - #define MONITORINFOEX my_MONITORINFOEX - #define LPMONITORINFOEX my_LPMONITORINFOEX - - #ifndef MONITOR_DEFAULTTONULL - #define MONITOR_DEFAULTTONULL 0 - #endif // MONITOR_DEFAULTTONULL - - #ifndef MONITORINFOF_PRIMARY - #define MONITORINFOF_PRIMARY 1 - #endif // MONITORINFOF_PRIMARY - - #ifndef DDENUM_ATTACHEDSECONDARYDEVICES - #define DDENUM_ATTACHEDSECONDARYDEVICES 1 - #endif - -#endif // MONITOR_DEFAULTTONULL - -// ---------------------------------------------------------------------------- -// Tree control -// ---------------------------------------------------------------------------- - -#ifndef TVIS_FOCUSED - #define TVIS_FOCUSED 0x0001 -#endif - -#ifndef TVS_CHECKBOXES - #define TVS_CHECKBOXES 0x0100 -#endif - -#ifndef TVITEM - #define TVITEM TV_ITEM -#endif - -#endif - // DMC++ - - /* - * The following are specifically required for OpenWatcom C++ (none at present) - */ - -#if defined(__WATCOMC__) -#endif - - /* - * The following are specifically required for MinGW (none at present) - */ - -#if defined (__MINGW32__) - -#if !wxCHECK_W32API_VERSION(3,1) - -#include <windows.h> -#include "wx/msw/winundef.h" - -typedef struct -{ - RECT rgrc[3]; - WINDOWPOS *lppos; -} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS; - -#endif - -#endif - - /* - * In addition to the declarations for VC++, the following are required for WinCE - */ - -#ifdef __WXWINCE__ - #include "wx/msw/wince/missing.h" -#endif - - /* - * The following are specifically required for Wine - */ - -#ifdef __WINE__ - #ifndef ENUM_CURRENT_SETTINGS - #define ENUM_CURRENT_SETTINGS ((DWORD)-1) - #endif - #ifndef BROADCAST_QUERY_DENY - #define BROADCAST_QUERY_DENY 1112363332 - #endif -#endif // defined __WINE__ - -#endif - // _WX_MISSING_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/missing.h +// Purpose: Declarations for parts of the Win32 SDK that are missing in +// the versions that come with some compilers +// Created: 2002/04/23 +// RCS-ID: $Id: missing.h 48436 2007-08-28 19:26:16Z JS $ +// Copyright: (c) 2002 Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MISSING_H_ +#define _WX_MISSING_H_ + +/* + * The following are required for VC++ 6. + */ + +// Needed by cursor.cpp +#ifndef IDC_HAND + #define IDC_HAND MAKEINTRESOURCE(32649) +#endif + +// Needed by strconv.cpp +#ifndef WC_NO_BEST_FIT_CHARS + #define WC_NO_BEST_FIT_CHARS 0x400 +#endif + +#ifndef WM_CONTEXTMENU + #define WM_CONTEXTMENU 0x007B +#endif + +// Needed by toplevel.cpp +#ifndef WM_UPDATEUISTATE + #define WM_UPDATEUISTATE 0x0128 +#endif + +#ifndef WM_CHANGEUISTATE + #define WM_CHANGEUISTATE 0x0127 +#endif + +#ifndef WM_PRINTCLIENT + #define WM_PRINTCLIENT 0x318 +#endif + +// Needed by toplevel.cpp +#ifndef UIS_SET + #define UIS_SET 1 + #define UIS_CLEAR 2 + #define UIS_INITIALIZE 3 +#endif + +#ifndef UISF_HIDEFOCUS + #define UISF_HIDEFOCUS 1 +#endif + +#ifndef UISF_HIDEACCEL + #define UISF_HIDEACCEL 2 +#endif + +#ifndef OFN_EXPLORER + #define OFN_EXPLORER 0x00080000 +#endif + +#ifndef OFN_ENABLESIZING + #define OFN_ENABLESIZING 0x00800000 +#endif + +// Needed by window.cpp +#if wxUSE_MOUSEWHEEL + #ifndef WM_MOUSEWHEEL + #define WM_MOUSEWHEEL 0x020A + #endif + #ifndef WHEEL_DELTA + #define WHEEL_DELTA 120 + #endif + #ifndef SPI_GETWHEELSCROLLLINES + #define SPI_GETWHEELSCROLLLINES 104 + #endif +#endif // wxUSE_MOUSEWHEEL + +// Needed by window.cpp +#ifndef VK_OEM_1 + #define VK_OEM_1 0xBA + #define VK_OEM_2 0xBF + #define VK_OEM_3 0xC0 + #define VK_OEM_4 0xDB + #define VK_OEM_5 0xDC + #define VK_OEM_6 0xDD + #define VK_OEM_7 0xDE +#endif + +#ifndef VK_OEM_COMMA + #define VK_OEM_PLUS 0xBB + #define VK_OEM_COMMA 0xBC + #define VK_OEM_MINUS 0xBD + #define VK_OEM_PERIOD 0xBE +#endif + +#ifndef SM_TABLETPC + #define SM_TABLETPC 86 +#endif + +#ifndef INKEDIT_CLASS +# define INKEDIT_CLASSW L"INKEDIT" +# ifdef UNICODE +# define INKEDIT_CLASS INKEDIT_CLASSW +# else +# define INKEDIT_CLASS "INKEDIT" +# endif +#endif + +#ifndef EM_SETINKINSERTMODE +# define EM_SETINKINSERTMODE (WM_USER + 0x0204) +#endif + +#ifndef EM_SETUSEMOUSEFORINPUT +#define EM_SETUSEMOUSEFORINPUT (WM_USER + 0x224) +#endif + +#ifndef TPM_RECURSE +#define TPM_RECURSE 1 +#endif + + +#ifndef WS_EX_LAYOUTRTL +#define WS_EX_LAYOUTRTL 0x00400000 +#endif + +#ifndef WS_EX_COMPOSITED +#define WS_EX_COMPOSITED 0x02000000L +#endif + +#ifndef WS_EX_LAYERED +#define WS_EX_LAYERED 0x00080000 +#endif + +#ifndef LWA_ALPHA +#define LWA_ALPHA 2 +#endif + +#if defined __VISUALC__ && __VISUALC__ <= 1200 && !defined MIIM_BITMAP +#define MIIM_STRING 0x00000040 +#define MIIM_BITMAP 0x00000080 +#define MIIM_FTYPE 0x00000100 +#define HBMMENU_CALLBACK ((HBITMAP) -1) +typedef struct tagMENUINFO +{ + DWORD cbSize; + DWORD fMask; + DWORD dwStyle; + UINT cyMax; + HBRUSH hbrBack; + DWORD dwContextHelpID; + DWORD dwMenuData; +} MENUINFO, FAR *LPMENUINFO; +struct wxMENUITEMINFO_ +{ + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + DWORD dwItemData; + LPTSTR dwTypeData; + UINT cch; + HBITMAP hbmpItem; +}; +#else +#define wxMENUITEMINFO_ MENUITEMINFO +#endif + +/* + * The following are required for VC++ 5 when the PSDK is not available. + */ + +#if defined __VISUALC__ && __VISUALC__ <= 1100 + +#ifndef VER_NT_WORKSTATION + +typedef struct _OSVERSIONINFOEXA { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; +} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; +typedef struct _OSVERSIONINFOEXW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; +} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW; + +#ifdef UNICODE +typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; +typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; +#else +typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; +typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; +#endif + +#endif // defined VER_NT_WORKSTATION + +#ifndef CP_SYMBOL + #define CP_SYMBOL 42 +#endif + +// NMLVCUSTOMDRAW originally didn't have the iSubItem member. It was added +// with IE4, as was IPN_FIRST which is used as a test :-(. +// +#ifndef IPN_FIRST + +typedef struct wxtagNMLVCUSTOMDRAW_ { + NMCUSTOMDRAW nmcd; + COLORREF clrText; + COLORREF clrTextBk; + int iSubItem; +} wxNMLVCUSTOMDRAW_, *wxLPNMLVCUSTOMDRAW_; + +#define NMLVCUSTOMDRAW wxNMLVCUSTOMDRAW_ +#define LPNMLVCUSTOMDRAW wxLPNMLVCUSTOMDRAW_ + +#endif // defined IPN_FIRST + +#endif // defined __VISUALC__ && __VISUALC__ <= 1100 + +// ---------------------------------------------------------------------------- +// ListView common control +// Needed by listctrl.cpp +// ---------------------------------------------------------------------------- + +#ifndef LVS_EX_FULLROWSELECT + #define LVS_EX_FULLROWSELECT 0x00000020 +#endif + +#ifndef LVS_EX_LABELTIP + #define LVS_EX_LABELTIP 0x00004000 +#endif + +#ifndef LVS_EX_SUBITEMIMAGES + #define LVS_EX_SUBITEMIMAGES 0x00000002 +#endif + +#ifndef HDN_GETDISPINFOW + #define HDN_GETDISPINFOW (HDN_FIRST-29) +#endif + + /* + * In addition to the above, the following are required for several compilers. + */ + +#if !defined(CCS_VERT) +#define CCS_VERT 0x00000080L +#endif + +#if !defined(CCS_RIGHT) +#define CCS_RIGHT (CCS_VERT|CCS_BOTTOM) +#endif + +#if !defined(TB_SETDISABLEDIMAGELIST) + #define TB_SETDISABLEDIMAGELIST (WM_USER + 54) +#endif // !defined(TB_SETDISABLEDIMAGELIST) + +#ifndef CFM_BACKCOLOR + #define CFM_BACKCOLOR 0x04000000 +#endif + +#ifndef HANGUL_CHARSET + #define HANGUL_CHARSET 129 +#endif + +#ifndef CCM_SETUNICODEFORMAT + #define CCM_SETUNICODEFORMAT 8197 +#endif + +// ---------------------------------------------------------------------------- +// Tree control +// ---------------------------------------------------------------------------- + +#ifndef TV_FIRST + #define TV_FIRST 0x1100 +#endif + +#ifndef TVS_FULLROWSELECT + #define TVS_FULLROWSELECT 0x1000 +#endif + +#ifndef TVM_SETBKCOLOR + #define TVM_SETBKCOLOR (TV_FIRST + 29) + #define TVM_SETTEXTCOLOR (TV_FIRST + 30) +#endif + + /* + * The following are required for BC++ 5.5 (none at present.) + */ + + /* + * The following are specifically required for Digital Mars C++ + */ + +#ifdef __DMC__ + +typedef struct _OSVERSIONINFOEX { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + TCHAR szCSDVersion[ 128 ]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; +} OSVERSIONINFOEX; + +#ifndef _TrackMouseEvent + #define _TrackMouseEvent TrackMouseEvent +#endif + +#ifndef LVM_SETEXTENDEDLISTVIEWSTYLE + #define LVM_SETEXTENDEDLISTVIEWSTYLE (0x1000 + 54) +#endif + +#ifndef LVM_GETSUBITEMRECT + #define LVM_GETSUBITEMRECT (0x1000 + 56) +#endif + +#ifndef LVCF_IMAGE + #define LVCF_IMAGE 0x0010 +#endif + +#ifndef Header_GetItemRect + #define Header_GetItemRect(w,i,r) \ + (BOOL)SendMessage((w),HDM_GETITEMRECT,(WPARAM)(i),(LPARAM)(r)) +#endif + +#ifndef HDM_GETITEMRECT + #define HDM_GETITEMRECT (HDM_FIRST+7) +#endif + +#ifndef ListView_GetHeader + #define ListView_GetHeader(w) (HWND)SendMessage((w),LVM_GETHEADER,0,0) +#endif + +#ifndef ListView_GetSubItemRect + #define ListView_GetSubItemRect(w, i, s, c, p) (HWND)SendMessage(w,LVM_GETSUBITEMRECT,i, ((p) ? ((((LPRECT)(p))->top = s), (((LPRECT)(p))->left = c), (LPARAM)(p)) : (LPARAM)(LPRECT)NULL)) +#endif + +#ifndef LVM_GETHEADER + #define LVM_GETHEADER (LVM_FIRST+31) +#endif + +#ifndef LVSICF_NOSCROLL + #define LVSICF_NOINVALIDATEALL 0x0001 + #define LVSICF_NOSCROLL 0x0002 +#endif + +#ifndef CP_SYMBOL + #define CP_SYMBOL 42 +#endif + +// ---------------------------------------------------------------------------- +// wxDisplay +// ---------------------------------------------------------------------------- + +// The windows headers with Digital Mars lack some typedefs. +// typedef them as my_XXX and then #define to rename to XXX in case +// a newer version of Digital Mars fixes the headers +// (or up to date PSDK is in use with older version) +// also we use any required definition (MONITOR_DEFAULTTONULL) to recognize +// whether whole missing block needs to be included + +#ifndef MONITOR_DEFAULTTONULL + + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); + typedef BOOL(CALLBACK* my_MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); + #define MONITORENUMPROC my_MONITORENUMPROC + typedef struct my_tagMONITORINFO { + DWORD cbSize; + RECT rcMonitor; + RECT rcWork; + DWORD dwFlags; + } my_MONITORINFO,*my_LPMONITORINFO; + #define MONITORINFO my_MONITORINFO + #define LPMONITORINFO my_LPMONITORINFO + + typedef struct my_MONITORINFOEX : public my_tagMONITORINFO + { + TCHAR szDevice[CCHDEVICENAME]; + } my_MONITORINFOEX, *my_LPMONITORINFOEX; + #define MONITORINFOEX my_MONITORINFOEX + #define LPMONITORINFOEX my_LPMONITORINFOEX + + #ifndef MONITOR_DEFAULTTONULL + #define MONITOR_DEFAULTTONULL 0 + #endif // MONITOR_DEFAULTTONULL + + #ifndef MONITORINFOF_PRIMARY + #define MONITORINFOF_PRIMARY 1 + #endif // MONITORINFOF_PRIMARY + + #ifndef DDENUM_ATTACHEDSECONDARYDEVICES + #define DDENUM_ATTACHEDSECONDARYDEVICES 1 + #endif + +#endif // MONITOR_DEFAULTTONULL + +// ---------------------------------------------------------------------------- +// Tree control +// ---------------------------------------------------------------------------- + +#ifndef TVIS_FOCUSED + #define TVIS_FOCUSED 0x0001 +#endif + +#ifndef TVS_CHECKBOXES + #define TVS_CHECKBOXES 0x0100 +#endif + +#ifndef TVITEM + #define TVITEM TV_ITEM +#endif + +#endif + // DMC++ + + /* + * The following are specifically required for OpenWatcom C++ (none at present) + */ + +#if defined(__WATCOMC__) +#endif + + /* + * The following are specifically required for MinGW (none at present) + */ + +#if defined (__MINGW32__) + +#if !wxCHECK_W32API_VERSION(3,1) + +#include <windows.h> +#include "wx/msw/winundef.h" + +typedef struct +{ + RECT rgrc[3]; + WINDOWPOS *lppos; +} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS; + +#endif + +#endif + + /* + * In addition to the declarations for VC++, the following are required for WinCE + */ + +#ifdef __WXWINCE__ + #include "wx/msw/wince/missing.h" +#endif + + /* + * The following are specifically required for Wine + */ + +#ifdef __WINE__ + #ifndef ENUM_CURRENT_SETTINGS + #define ENUM_CURRENT_SETTINGS ((DWORD)-1) + #endif + #ifndef BROADCAST_QUERY_DENY + #define BROADCAST_QUERY_DENY 1112363332 + #endif +#endif // defined __WINE__ + +#endif + // _WX_MISSING_H_ diff --git a/Externals/wxWidgets/include/wx/msw/msgdlg.h b/Externals/wxWidgets/include/wx/msw/msgdlg.h index 690678b8d9..8d43b38078 100644 --- a/Externals/wxWidgets/include/wx/msw/msgdlg.h +++ b/Externals/wxWidgets/include/wx/msw/msgdlg.h @@ -1,42 +1,42 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/msgdlg.h -// Purpose: wxMessageDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: msgdlg.h 37164 2006-01-26 17:20:50Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSGBOXDLG_H_ -#define _WX_MSGBOXDLG_H_ - -#include "wx/defs.h" -#include "wx/dialog.h" - -/* - * Message box dialog - */ - -extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; - -class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase -{ -DECLARE_DYNAMIC_CLASS(wxMessageDialog) -protected: - wxString m_caption; - wxString m_message; - wxWindow * m_parent; -public: - wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - - int ShowModal(void); - - DECLARE_NO_COPY_CLASS(wxMessageDialog) -}; - - -#endif - // _WX_MSGBOXDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/msgdlg.h +// Purpose: wxMessageDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: msgdlg.h 37164 2006-01-26 17:20:50Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGBOXDLG_H_ +#define _WX_MSGBOXDLG_H_ + +#include "wx/defs.h" +#include "wx/dialog.h" + +/* + * Message box dialog + */ + +extern WXDLLEXPORT_DATA(const wxChar) wxMessageBoxCaptionStr[]; + +class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase +{ +DECLARE_DYNAMIC_CLASS(wxMessageDialog) +protected: + wxString m_caption; + wxString m_message; + wxWindow * m_parent; +public: + wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); + + int ShowModal(void); + + DECLARE_NO_COPY_CLASS(wxMessageDialog) +}; + + +#endif + // _WX_MSGBOXDLG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/mslu.h b/Externals/wxWidgets/include/wx/msw/mslu.h index 83f4060d7a..eccf13a26d 100644 --- a/Externals/wxWidgets/include/wx/msw/mslu.h +++ b/Externals/wxWidgets/include/wx/msw/mslu.h @@ -1,23 +1,23 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mslu.h -// Purpose: MSLU-related declarations -// Author: Vaclav Slavik -// Modified by: Vadim Zeitlin to move out various functions to other files -// to fix header inter-dependencies -// Created: 2002/02/17 -// RCS-ID: $Id: mslu.h 42462 2006-10-26 19:06:51Z VZ $ -// Copyright: (c) 2002 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSLU_H_ -#define _WX_MSLU_H_ - -#include "wx/defs.h" - -// Returns true if we are running under Unicode emulation in Win9x environment. -// Workaround hacks take effect only if this condition is met -// (NB: this function is needed even if !wxUSE_UNICODE_MSLU) -WXDLLIMPEXP_BASE bool wxUsingUnicowsDll(); - -#endif // _WX_MSLU_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/mslu.h +// Purpose: MSLU-related declarations +// Author: Vaclav Slavik +// Modified by: Vadim Zeitlin to move out various functions to other files +// to fix header inter-dependencies +// Created: 2002/02/17 +// RCS-ID: $Id: mslu.h 42462 2006-10-26 19:06:51Z VZ $ +// Copyright: (c) 2002 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSLU_H_ +#define _WX_MSLU_H_ + +#include "wx/defs.h" + +// Returns true if we are running under Unicode emulation in Win9x environment. +// Workaround hacks take effect only if this condition is met +// (NB: this function is needed even if !wxUSE_UNICODE_MSLU) +WXDLLIMPEXP_BASE bool wxUsingUnicowsDll(); + +#endif // _WX_MSLU_H_ diff --git a/Externals/wxWidgets/include/wx/msw/msvcrt.h b/Externals/wxWidgets/include/wx/msw/msvcrt.h index 15c4dfbde4..913965de7f 100644 --- a/Externals/wxWidgets/include/wx/msw/msvcrt.h +++ b/Externals/wxWidgets/include/wx/msw/msvcrt.h @@ -1,69 +1,69 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/msvcrt.h -// Purpose: macros to use some non-standard features of MS Visual C++ -// C run-time library -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.01.1999 -// RCS-ID: $Id: msvcrt.h 42363 2006-10-24 23:19:12Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// the goal of this file is to define wxCrtSetDbgFlag() macro which may be -// used like this: -// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); -// to turn on memory leak checks for programs compiled with Microsoft Visual -// C++ (5.0+). The macro will expand to nothing under other compilers. - -#ifndef _MSW_MSVCRT_H_ -#define _MSW_MSVCRT_H_ - -// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug -// builds -#undef wxUSE_VC_CRTDBG -#if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ - && !defined(UNDER_CE) - // it doesn't combine well with wxWin own memory debugging methods - #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) - #define wxUSE_VC_CRTDBG - #endif -#endif - -#ifdef wxUSE_VC_CRTDBG - // VC++ uses this macro as debug/release mode indicator - #ifndef _DEBUG - #define _DEBUG - #endif - - // Need to undef new if including crtdbg.h which may redefine new itself - #ifdef new - #undef new - #endif - - #include <stdlib.h> - #ifndef _CRTBLD - // Need when builded with pure MS SDK - #define _CRTBLD - #endif - - #include <crtdbg.h> - - #undef WXDEBUG_NEW - #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) - - // this define works around a bug with inline declarations of new, see - // - // http://support.microsoft.com/support/kb/articles/Q140/8/58.asp - // - // for the details - #define new WXDEBUG_NEW - - #define wxCrtSetDbgFlag(flag) \ - _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag)) -#else // !using VC CRT - #define wxCrtSetDbgFlag(flag) -#endif // wxUSE_VC_CRTDBG - -#endif // _MSW_MSVCRT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/msvcrt.h +// Purpose: macros to use some non-standard features of MS Visual C++ +// C run-time library +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.01.1999 +// RCS-ID: $Id: msvcrt.h 42363 2006-10-24 23:19:12Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// the goal of this file is to define wxCrtSetDbgFlag() macro which may be +// used like this: +// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); +// to turn on memory leak checks for programs compiled with Microsoft Visual +// C++ (5.0+). The macro will expand to nothing under other compilers. + +#ifndef _MSW_MSVCRT_H_ +#define _MSW_MSVCRT_H_ + +// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug +// builds +#undef wxUSE_VC_CRTDBG +#if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ + && !defined(UNDER_CE) + // it doesn't combine well with wxWin own memory debugging methods + #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) + #define wxUSE_VC_CRTDBG + #endif +#endif + +#ifdef wxUSE_VC_CRTDBG + // VC++ uses this macro as debug/release mode indicator + #ifndef _DEBUG + #define _DEBUG + #endif + + // Need to undef new if including crtdbg.h which may redefine new itself + #ifdef new + #undef new + #endif + + #include <stdlib.h> + #ifndef _CRTBLD + // Need when builded with pure MS SDK + #define _CRTBLD + #endif + + #include <crtdbg.h> + + #undef WXDEBUG_NEW + #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) + + // this define works around a bug with inline declarations of new, see + // + // http://support.microsoft.com/support/kb/articles/Q140/8/58.asp + // + // for the details + #define new WXDEBUG_NEW + + #define wxCrtSetDbgFlag(flag) \ + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag)) +#else // !using VC CRT + #define wxCrtSetDbgFlag(flag) +#endif // wxUSE_VC_CRTDBG + +#endif // _MSW_MSVCRT_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/notebook.h b/Externals/wxWidgets/include/wx/msw/notebook.h index 5832c2d0e2..810bd8ae23 100644 --- a/Externals/wxWidgets/include/wx/msw/notebook.h +++ b/Externals/wxWidgets/include/wx/msw/notebook.h @@ -1,254 +1,254 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/notebook.h -// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) -// Author: Robert Roebling -// Modified by: Vadim Zeitlin for Windows version -// RCS-ID: $Id: notebook.h 41797 2006-10-09 12:10:01Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _NOTEBOOK_H -#define _NOTEBOOK_H - -#if wxUSE_NOTEBOOK - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxNotebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookPageInfo : public wxObject -{ -public : - wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } - virtual ~wxNotebookPageInfo() { } - - void Create(wxNotebookPage *page, - const wxString& text, - bool selected, - int imageId) - { - m_page = page; - m_text = text; - m_selected = selected; - m_imageId = imageId; - } - - wxNotebookPage* GetPage() const { return m_page; } - wxString GetText() const { return m_text; } - bool GetSelected() const { return m_selected; } - int GetImageId() const { return m_imageId; } - -private: - wxNotebookPage *m_page; - wxString m_text; - bool m_selected; - int m_imageId; - - DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) -}; - - -WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); - -class WXDLLEXPORT wxNotebook : public wxNotebookBase -{ -public: - // ctors - // ----- - // default for dynamic class - wxNotebook(); - // the same arguments as for wxControl (@@@ any special styles?) - wxNotebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // Create() function - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - virtual ~wxNotebook(); - - // accessors - // --------- - // get number of pages in the dialog - virtual size_t GetPageCount() const; - - // set the currently selected page, return the index of the previously - // selected one (or -1 on error) - // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events - int SetSelection(size_t nPage); - // get the currently selected page - int GetSelection() const { return m_nSelection; } - - // changes selected page without sending events - int ChangeSelection(size_t nPage); - - // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; - - // image list stuff: each page may have an image associated with it. All - // the images belong to an image list, so you have to - // 1) create an image list - // 2) associate it with the notebook - // 3) set for each page it's image - // associate image list with a control - void SetImageList(wxImageList* imageList); - - // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); - - // currently it's always 1 because wxGTK doesn't support multi-row - // tab controls - int GetRowCount() const; - - // control the appearance of the notebook pages - // set the size (the same for all pages) - void SetPageSize(const wxSize& size); - // set the padding between tabs (in pixels) - void SetPadding(const wxSize& padding); - - // operations - // ---------- - // remove all pages - bool DeleteAllPages(); - - // inserts a new page to the notebook (it will be deleted ny the notebook, - // don't delete it yourself). If bSelect, this page becomes active. - bool InsertPage(size_t nPage, - wxNotebookPage *pPage, - const wxString& strText, - bool bSelect = false, - int imageId = -1); - - void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ); } - const wxNotebookPageInfoList& GetPageInfos() const; - - // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH - // style. - void SetTabSize(const wxSize& sz); - - // hit test - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - - // calculate the size of the notebook from the size of its page - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - // callbacks - // --------- - void OnSize(wxSizeEvent& event); - void OnSelChange(wxNotebookEvent& event); - void OnNavigationKey(wxNavigationKeyEvent& event); - - // base class virtuals - // ------------------- - - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, - WXWORD pos, WXHWND control); - -#if wxUSE_CONSTRAINTS - virtual void SetConstraintSizes(bool recurse = true); - virtual bool DoPhase(int nPhase); -#endif // wxUSE_CONSTRAINTS - - // Attempts to get colour for UX theme page background - wxColour GetThemeBackgroundColour() const; - - // implementation only - // ------------------- - -#if wxUSE_UXTHEME - virtual bool SetBackgroundColour(const wxColour& colour) - { - if ( !wxNotebookBase::SetBackgroundColour(colour) ) - return false; - - UpdateBgBrush(); - - return true; - } - - // return the themed brush for painting our children - virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); - - // draw child background - virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win); -#endif // wxUSE_UXTHEME - - // translate wxWin styles to the Windows ones - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // common part of all ctors - void Init(); - - // hides the currently shown page and shows the given one (if not -1) and - // updates m_nSelection accordingly - void UpdateSelection(int selNew); - - // remove one page from the notebook, without deleting - virtual wxNotebookPage *DoRemovePage(size_t nPage); - - // get the page rectangle for the current notebook size - // - // returns empty rectangle if an error occurs, do test for it - wxRect GetPageSize() const; - - // set the size of the given page to fit in the notebook - void AdjustPageSize(wxNotebookPage *page); - -#if wxUSE_UXTHEME - // gets the bitmap of notebook background and returns a brush from it - WXHBRUSH QueryBgBitmap(); - - // creates the brush to be used for drawing the tab control background - void UpdateBgBrush(); - - // common part of QueryBgBitmap() and MSWPrintChild() - // - // if child == NULL, draw background for the entire notebook itself - bool DoDrawBackground(WXHDC hDC, wxWindow *child = NULL); -#endif // wxUSE_UXTHEME - - // these function are only used for reducing flicker on notebook resize and - // we don't need to do this for WinCE -#ifndef __WXWINCE__ - void OnEraseBackground(wxEraseEvent& event); - void OnPaint(wxPaintEvent& event); - - // true if we have already subclassed our updown control - bool m_hasSubclassedUpdown; -#endif // __WXWINCE__ - - // the current selection (-1 if none) - int m_nSelection; - - wxNotebookPageInfoList m_pageInfos; - -#if wxUSE_UXTHEME - // background brush used to paint the tab control - WXHBRUSH m_hbrBackground; -#endif // wxUSE_UXTHEME - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook) - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_NOTEBOOK - -#endif // _NOTEBOOK_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/notebook.h +// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) +// Author: Robert Roebling +// Modified by: Vadim Zeitlin for Windows version +// RCS-ID: $Id: notebook.h 41797 2006-10-09 12:10:01Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _NOTEBOOK_H +#define _NOTEBOOK_H + +#if wxUSE_NOTEBOOK + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNotebookPageInfo : public wxObject +{ +public : + wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } + virtual ~wxNotebookPageInfo() { } + + void Create(wxNotebookPage *page, + const wxString& text, + bool selected, + int imageId) + { + m_page = page; + m_text = text; + m_selected = selected; + m_imageId = imageId; + } + + wxNotebookPage* GetPage() const { return m_page; } + wxString GetText() const { return m_text; } + bool GetSelected() const { return m_selected; } + int GetImageId() const { return m_imageId; } + +private: + wxNotebookPage *m_page; + wxString m_text; + bool m_selected; + int m_imageId; + + DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) +}; + + +WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); + +class WXDLLEXPORT wxNotebook : public wxNotebookBase +{ +public: + // ctors + // ----- + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl (@@@ any special styles?) + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr); + virtual ~wxNotebook(); + + // accessors + // --------- + // get number of pages in the dialog + virtual size_t GetPageCount() const; + + // set the currently selected page, return the index of the previously + // selected one (or -1 on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage); + // get the currently selected page + int GetSelection() const { return m_nSelection; } + + // changes selected page without sending events + int ChangeSelection(size_t nPage); + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText); + wxString GetPageText(size_t nPage) const; + + // image list stuff: each page may have an image associated with it. All + // the images belong to an image list, so you have to + // 1) create an image list + // 2) associate it with the notebook + // 3) set for each page it's image + // associate image list with a control + void SetImageList(wxImageList* imageList); + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const; + bool SetPageImage(size_t nPage, int nImage); + + // currently it's always 1 because wxGTK doesn't support multi-row + // tab controls + int GetRowCount() const; + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + + // operations + // ---------- + // remove all pages + bool DeleteAllPages(); + + // inserts a new page to the notebook (it will be deleted ny the notebook, + // don't delete it yourself). If bSelect, this page becomes active. + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = -1); + + void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ); } + const wxNotebookPageInfoList& GetPageInfos() const; + + // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH + // style. + void SetTabSize(const wxSize& sz); + + // hit test + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + + // calculate the size of the notebook from the size of its page + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnSelChange(wxNotebookEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + + // base class virtuals + // ------------------- + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control); + +#if wxUSE_CONSTRAINTS + virtual void SetConstraintSizes(bool recurse = true); + virtual bool DoPhase(int nPhase); +#endif // wxUSE_CONSTRAINTS + + // Attempts to get colour for UX theme page background + wxColour GetThemeBackgroundColour() const; + + // implementation only + // ------------------- + +#if wxUSE_UXTHEME + virtual bool SetBackgroundColour(const wxColour& colour) + { + if ( !wxNotebookBase::SetBackgroundColour(colour) ) + return false; + + UpdateBgBrush(); + + return true; + } + + // return the themed brush for painting our children + virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); + + // draw child background + virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win); +#endif // wxUSE_UXTHEME + + // translate wxWin styles to the Windows ones + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + +protected: + // common part of all ctors + void Init(); + + // hides the currently shown page and shows the given one (if not -1) and + // updates m_nSelection accordingly + void UpdateSelection(int selNew); + + // remove one page from the notebook, without deleting + virtual wxNotebookPage *DoRemovePage(size_t nPage); + + // get the page rectangle for the current notebook size + // + // returns empty rectangle if an error occurs, do test for it + wxRect GetPageSize() const; + + // set the size of the given page to fit in the notebook + void AdjustPageSize(wxNotebookPage *page); + +#if wxUSE_UXTHEME + // gets the bitmap of notebook background and returns a brush from it + WXHBRUSH QueryBgBitmap(); + + // creates the brush to be used for drawing the tab control background + void UpdateBgBrush(); + + // common part of QueryBgBitmap() and MSWPrintChild() + // + // if child == NULL, draw background for the entire notebook itself + bool DoDrawBackground(WXHDC hDC, wxWindow *child = NULL); +#endif // wxUSE_UXTHEME + + // these function are only used for reducing flicker on notebook resize and + // we don't need to do this for WinCE +#ifndef __WXWINCE__ + void OnEraseBackground(wxEraseEvent& event); + void OnPaint(wxPaintEvent& event); + + // true if we have already subclassed our updown control + bool m_hasSubclassedUpdown; +#endif // __WXWINCE__ + + // the current selection (-1 if none) + int m_nSelection; + + wxNotebookPageInfoList m_pageInfos; + +#if wxUSE_UXTHEME + // background brush used to paint the tab control + WXHBRUSH m_hbrBackground; +#endif // wxUSE_UXTHEME + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook) + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_NOTEBOOK + +#endif // _NOTEBOOK_H diff --git a/Externals/wxWidgets/include/wx/msw/ole/access.h b/Externals/wxWidgets/include/wx/msw/ole/access.h index 5f3e28b007..45e684a1a8 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/access.h +++ b/Externals/wxWidgets/include/wx/msw/ole/access.h @@ -1,68 +1,68 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/access.h -// Purpose: declaration of the wxAccessible class -// Author: Julian Smart -// Modified by: -// Created: 2003-02-12 -// RCS-ID: $Id: access.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2003 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ACCESS_H_ -#define _WX_ACCESS_H_ - -#if wxUSE_ACCESSIBILITY - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class wxIAccessible; -class WXDLLEXPORT wxWindow; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// wxAccessible implements accessibility behaviour. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAccessible : public wxAccessibleBase -{ -public: - wxAccessible(wxWindow *win = NULL); - virtual ~wxAccessible(); - -// Overridables - -// Accessors - - // Returns the wxIAccessible pointer - wxIAccessible* GetIAccessible() { return m_pIAccessible; } - - // Returns the IAccessible standard interface pointer - void* GetIAccessibleStd() ; - -// Operations - - // Sends an event when something changes in an accessible object. - static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType, - int objectId); - -protected: - void Init(); - -private: - wxIAccessible * m_pIAccessible; // the pointer to COM interface - void* m_pIAccessibleStd; // the pointer to the standard COM interface, - // for default processing - - DECLARE_NO_COPY_CLASS(wxAccessible) -}; - -#endif //wxUSE_ACCESSIBILITY - -#endif //_WX_ACCESS_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: ole/access.h +// Purpose: declaration of the wxAccessible class +// Author: Julian Smart +// Modified by: +// Created: 2003-02-12 +// RCS-ID: $Id: access.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2003 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCESS_H_ +#define _WX_ACCESS_H_ + +#if wxUSE_ACCESSIBILITY + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class wxIAccessible; +class WXDLLEXPORT wxWindow; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxAccessible implements accessibility behaviour. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAccessible : public wxAccessibleBase +{ +public: + wxAccessible(wxWindow *win = NULL); + virtual ~wxAccessible(); + +// Overridables + +// Accessors + + // Returns the wxIAccessible pointer + wxIAccessible* GetIAccessible() { return m_pIAccessible; } + + // Returns the IAccessible standard interface pointer + void* GetIAccessibleStd() ; + +// Operations + + // Sends an event when something changes in an accessible object. + static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType, + int objectId); + +protected: + void Init(); + +private: + wxIAccessible * m_pIAccessible; // the pointer to COM interface + void* m_pIAccessibleStd; // the pointer to the standard COM interface, + // for default processing + + DECLARE_NO_COPY_CLASS(wxAccessible) +}; + +#endif //wxUSE_ACCESSIBILITY + +#endif //_WX_ACCESS_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/ole/activex.h b/Externals/wxWidgets/include/wx/msw/ole/activex.h index 20de45c2dd..96fddfe0ff 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/activex.h +++ b/Externals/wxWidgets/include/wx/msw/ole/activex.h @@ -1,221 +1,221 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/activex.h -// Purpose: wxActiveXContainer class -// Author: Ryan Norton <wxprojects@comcast.net> -// Modified by: -// Created: 8/18/05 -// RCS-ID: $Id: activex.h 41793 2006-10-09 09:32:08Z ABX $ -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// Definitions -// ============================================================================ - -#ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_ -#define _WX_MSW_OLE_ACTIVEXCONTAINER_H_ - -#if wxUSE_ACTIVEX - -//--------------------------------------------------------------------------- -// wx includes -//--------------------------------------------------------------------------- - -#include "wx/msw/ole/oleutils.h" // wxBasicString &c -#include "wx/msw/ole/uuid.h" -#include "wx/window.h" -#include "wx/variant.h" - -//--------------------------------------------------------------------------- -// MSW COM includes -//--------------------------------------------------------------------------- -#include <oleidl.h> -#include <olectl.h> - -#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__) -#include <exdisp.h> -#endif - -#include <docobj.h> - -#ifndef STDMETHOD - #define STDMETHOD(funcname) virtual HRESULT wxSTDCALL funcname -#endif - -// -// These defines are from another ole header - but its not in the -// latest sdk. Also the ifndef DISPID_READYSTATE is here because at -// least on my machine with the latest sdk olectl.h defines these 3 -// -#ifndef DISPID_READYSTATE - #define DISPID_READYSTATE (-525) - #define DISPID_READYSTATECHANGE (-609) - #define DISPID_AMBIENT_TRANSFERPRIORITY (-728) -#endif - -#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501) -#define DISPID_AMBIENT_SILENT (-5502) - -#ifndef DISPID_AMBIENT_CODEPAGE - #define DISPID_AMBIENT_CODEPAGE (-725) - #define DISPID_AMBIENT_CHARSET (-727) -#endif - - -//--------------------------------------------------------------------------- -// -// wxActiveXContainer -// -//--------------------------------------------------------------------------- - -#define WX_DECLARE_AUTOOLE(wxAutoOleInterface, I) \ -class wxAutoOleInterface \ -{ \ - protected: \ - I *m_interface; \ -\ - public: \ - explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {} \ - wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) \ - { QueryInterface(riid, pUnk); } \ - wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) \ - { QueryInterface(riid, pDispatch); } \ - wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)\ - { CreateInstance(clsid, riid); }\ - wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL)\ - { operator = (ti); }\ -\ - wxAutoOleInterface& operator = (const wxAutoOleInterface& ti)\ - {\ - if (ti.m_interface)\ - ti.m_interface->AddRef();\ - Free();\ - m_interface = ti.m_interface;\ - return *this;\ - }\ -\ - wxAutoOleInterface& operator = (I *&ti)\ - {\ - Free();\ - m_interface = ti;\ - return *this;\ - }\ -\ - ~wxAutoOleInterface() { Free(); }\ -\ - inline void Free()\ - {\ - if (m_interface)\ - m_interface->Release();\ - m_interface = NULL;\ - }\ -\ - HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)\ - {\ - Free();\ - wxASSERT(pUnk != NULL);\ - return pUnk->QueryInterface(riid, (void **) &m_interface);\ - }\ -\ - HRESULT CreateInstance(REFCLSID clsid, REFIID riid)\ - {\ - Free();\ - return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);\ - }\ -\ - inline operator I *() const {return m_interface;}\ - inline I* operator ->() {return m_interface;}\ - inline I** GetRef() {return &m_interface;}\ - inline bool Ok() const { return IsOk(); }\ - inline bool IsOk() const {return m_interface != NULL;}\ -}; - -WX_DECLARE_AUTOOLE(wxAutoIDispatch, IDispatch) -WX_DECLARE_AUTOOLE(wxAutoIOleClientSite, IOleClientSite) -WX_DECLARE_AUTOOLE(wxAutoIUnknown, IUnknown) -WX_DECLARE_AUTOOLE(wxAutoIOleObject, IOleObject) -WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceObject, IOleInPlaceObject) -WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceActiveObject, IOleInPlaceActiveObject) -WX_DECLARE_AUTOOLE(wxAutoIOleDocumentView, IOleDocumentView) -WX_DECLARE_AUTOOLE(wxAutoIViewObject, IViewObject) - -class wxActiveXContainer : public wxWindow -{ -public: - wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk); - virtual ~wxActiveXContainer(); - - void OnSize(wxSizeEvent&); - void OnPaint(wxPaintEvent&); - void OnSetFocus(wxFocusEvent&); - void OnKillFocus(wxFocusEvent&); - -protected: - friend class FrameSite; - friend class wxActiveXEvents; - - wxAutoIDispatch m_Dispatch; - wxAutoIOleClientSite m_clientSite; - wxAutoIUnknown m_ActiveX; - wxAutoIOleObject m_oleObject; - wxAutoIOleInPlaceObject m_oleInPlaceObject; - wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject; - wxAutoIOleDocumentView m_docView; - wxAutoIViewObject m_viewObject; - HWND m_oleObjectHWND; - bool m_bAmbientUserMode; - DWORD m_docAdviseCookie; - wxWindow* m_realparent; - - void CreateActiveX(REFIID, IUnknown*); -}; - - -// Events -class wxActiveXEvent : public wxCommandEvent -{ -private: - friend class wxActiveXEvents; - wxVariant m_params; - DISPID m_dispid; - -public: - virtual wxEvent *Clone() const - { return new wxActiveXEvent(*this); } - - size_t ParamCount() const - { return m_params.GetCount(); } - - wxString ParamType(size_t idx) const - { - wxASSERT(idx < m_params.GetCount()); - return m_params[idx].GetType(); - } - - wxString ParamName(size_t idx) const - { - wxASSERT(idx < m_params.GetCount()); - return m_params[idx].GetName(); - } - - wxVariant& operator[] (size_t idx) - { - wxASSERT(idx < ParamCount()); - return m_params[idx]; - } - - DISPID GetDispatchId() const - { return m_dispid; } -}; - -#define wxACTIVEX_ID 14001 -DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_ACTIVEX, wxACTIVEX_ID) -typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); -#define EVT_ACTIVEX(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ), -#define wxActiveXEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActiveXEventFunction, &func) - -#endif // wxUSE_ACTIVEX - -#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/activex.h +// Purpose: wxActiveXContainer class +// Author: Ryan Norton <wxprojects@comcast.net> +// Modified by: +// Created: 8/18/05 +// RCS-ID: $Id: activex.h 41793 2006-10-09 09:32:08Z ABX $ +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Definitions +// ============================================================================ + +#ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_ +#define _WX_MSW_OLE_ACTIVEXCONTAINER_H_ + +#if wxUSE_ACTIVEX + +//--------------------------------------------------------------------------- +// wx includes +//--------------------------------------------------------------------------- + +#include "wx/msw/ole/oleutils.h" // wxBasicString &c +#include "wx/msw/ole/uuid.h" +#include "wx/window.h" +#include "wx/variant.h" + +//--------------------------------------------------------------------------- +// MSW COM includes +//--------------------------------------------------------------------------- +#include <oleidl.h> +#include <olectl.h> + +#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__) +#include <exdisp.h> +#endif + +#include <docobj.h> + +#ifndef STDMETHOD + #define STDMETHOD(funcname) virtual HRESULT wxSTDCALL funcname +#endif + +// +// These defines are from another ole header - but its not in the +// latest sdk. Also the ifndef DISPID_READYSTATE is here because at +// least on my machine with the latest sdk olectl.h defines these 3 +// +#ifndef DISPID_READYSTATE + #define DISPID_READYSTATE (-525) + #define DISPID_READYSTATECHANGE (-609) + #define DISPID_AMBIENT_TRANSFERPRIORITY (-728) +#endif + +#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501) +#define DISPID_AMBIENT_SILENT (-5502) + +#ifndef DISPID_AMBIENT_CODEPAGE + #define DISPID_AMBIENT_CODEPAGE (-725) + #define DISPID_AMBIENT_CHARSET (-727) +#endif + + +//--------------------------------------------------------------------------- +// +// wxActiveXContainer +// +//--------------------------------------------------------------------------- + +#define WX_DECLARE_AUTOOLE(wxAutoOleInterface, I) \ +class wxAutoOleInterface \ +{ \ + protected: \ + I *m_interface; \ +\ + public: \ + explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {} \ + wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) \ + { QueryInterface(riid, pUnk); } \ + wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) \ + { QueryInterface(riid, pDispatch); } \ + wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)\ + { CreateInstance(clsid, riid); }\ + wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL)\ + { operator = (ti); }\ +\ + wxAutoOleInterface& operator = (const wxAutoOleInterface& ti)\ + {\ + if (ti.m_interface)\ + ti.m_interface->AddRef();\ + Free();\ + m_interface = ti.m_interface;\ + return *this;\ + }\ +\ + wxAutoOleInterface& operator = (I *&ti)\ + {\ + Free();\ + m_interface = ti;\ + return *this;\ + }\ +\ + ~wxAutoOleInterface() { Free(); }\ +\ + inline void Free()\ + {\ + if (m_interface)\ + m_interface->Release();\ + m_interface = NULL;\ + }\ +\ + HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)\ + {\ + Free();\ + wxASSERT(pUnk != NULL);\ + return pUnk->QueryInterface(riid, (void **) &m_interface);\ + }\ +\ + HRESULT CreateInstance(REFCLSID clsid, REFIID riid)\ + {\ + Free();\ + return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);\ + }\ +\ + inline operator I *() const {return m_interface;}\ + inline I* operator ->() {return m_interface;}\ + inline I** GetRef() {return &m_interface;}\ + inline bool Ok() const { return IsOk(); }\ + inline bool IsOk() const {return m_interface != NULL;}\ +}; + +WX_DECLARE_AUTOOLE(wxAutoIDispatch, IDispatch) +WX_DECLARE_AUTOOLE(wxAutoIOleClientSite, IOleClientSite) +WX_DECLARE_AUTOOLE(wxAutoIUnknown, IUnknown) +WX_DECLARE_AUTOOLE(wxAutoIOleObject, IOleObject) +WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceObject, IOleInPlaceObject) +WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceActiveObject, IOleInPlaceActiveObject) +WX_DECLARE_AUTOOLE(wxAutoIOleDocumentView, IOleDocumentView) +WX_DECLARE_AUTOOLE(wxAutoIViewObject, IViewObject) + +class wxActiveXContainer : public wxWindow +{ +public: + wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk); + virtual ~wxActiveXContainer(); + + void OnSize(wxSizeEvent&); + void OnPaint(wxPaintEvent&); + void OnSetFocus(wxFocusEvent&); + void OnKillFocus(wxFocusEvent&); + +protected: + friend class FrameSite; + friend class wxActiveXEvents; + + wxAutoIDispatch m_Dispatch; + wxAutoIOleClientSite m_clientSite; + wxAutoIUnknown m_ActiveX; + wxAutoIOleObject m_oleObject; + wxAutoIOleInPlaceObject m_oleInPlaceObject; + wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject; + wxAutoIOleDocumentView m_docView; + wxAutoIViewObject m_viewObject; + HWND m_oleObjectHWND; + bool m_bAmbientUserMode; + DWORD m_docAdviseCookie; + wxWindow* m_realparent; + + void CreateActiveX(REFIID, IUnknown*); +}; + + +// Events +class wxActiveXEvent : public wxCommandEvent +{ +private: + friend class wxActiveXEvents; + wxVariant m_params; + DISPID m_dispid; + +public: + virtual wxEvent *Clone() const + { return new wxActiveXEvent(*this); } + + size_t ParamCount() const + { return m_params.GetCount(); } + + wxString ParamType(size_t idx) const + { + wxASSERT(idx < m_params.GetCount()); + return m_params[idx].GetType(); + } + + wxString ParamName(size_t idx) const + { + wxASSERT(idx < m_params.GetCount()); + return m_params[idx].GetName(); + } + + wxVariant& operator[] (size_t idx) + { + wxASSERT(idx < ParamCount()); + return m_params[idx]; + } + + DISPID GetDispatchId() const + { return m_dispid; } +}; + +#define wxACTIVEX_ID 14001 +DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_ACTIVEX, wxACTIVEX_ID) +typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); +#define EVT_ACTIVEX(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ), +#define wxActiveXEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActiveXEventFunction, &func) + +#endif // wxUSE_ACTIVEX + +#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_ diff --git a/Externals/wxWidgets/include/wx/msw/ole/automtn.h b/Externals/wxWidgets/include/wx/msw/ole/automtn.h index 9dd1e37630..51a7fd811a 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/automtn.h +++ b/Externals/wxWidgets/include/wx/msw/ole/automtn.h @@ -1,101 +1,101 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: automtn.h -// Purpose: OLE automation utilities -// Author: Julian Smart -// Modified by: -// Created: 11/6/98 -// RCS-ID: $Id: automtn.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 1998, Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_AUTOMTN_H_ -#define _WX_AUTOMTN_H_ - -#include "wx/defs.h" - -#if wxUSE_OLE_AUTOMATION - -#include "wx/object.h" -#include "wx/variant.h" - -typedef void WXIDISPATCH; -typedef unsigned short* WXBSTR; - -#ifdef GetObject -#undef GetObject -#endif - -/* - * wxAutomationObject - * Wraps up an IDispatch pointer and invocation; does variant conversion. - */ - -class WXDLLEXPORT wxAutomationObject: public wxObject -{ -public: - wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); - virtual ~wxAutomationObject(); - - // Set/get dispatch pointer - inline void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } - inline WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } - - // Get a dispatch pointer from the current object associated - // with a class id, such as "Excel.Application" - bool GetInstance(const wxString& classId) const; - - // Get a dispatch pointer from a new instance of the the class - bool CreateInstance(const wxString& classId) const; - - // Low-level invocation function. Pass either an array of variants, - // or an array of pointers to variants. - bool Invoke(const wxString& member, int action, - wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const; - - // Invoke a member function - wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]); - wxVariant CallMethodArray(const wxString& method, int noArgs, const wxVariant **args); - - // Convenience function - wxVariant CallMethod(const wxString& method, - const wxVariant& arg1 = wxNullVariant, const wxVariant& arg2 = wxNullVariant, - const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, - const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); - - // Get/Put property - wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; - wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const; - wxVariant GetProperty(const wxString& property, - const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, - const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, - const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); - - bool PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args); - bool PutProperty(const wxString& property, int noArgs, wxVariant args[]) ; - bool PutProperty(const wxString& property, - const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, - const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, - const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); - - // Uses DISPATCH_PROPERTYGET - // and returns a dispatch pointer. The calling code should call Release - // on the pointer, though this could be implicit by constructing an wxAutomationObject - // with it and letting the destructor call Release. - WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, wxVariant args[]) const; - WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const; - - // A way of initialising another wxAutomationObject with a dispatch object, - // without having to deal with nasty IDispatch pointers. - bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; - bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const; - -public: - WXIDISPATCH* m_dispatchPtr; - - DECLARE_NO_COPY_CLASS(wxAutomationObject) -}; - -#endif // wxUSE_OLE_AUTOMATION - -#endif // _WX_AUTOMTN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: automtn.h +// Purpose: OLE automation utilities +// Author: Julian Smart +// Modified by: +// Created: 11/6/98 +// RCS-ID: $Id: automtn.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) 1998, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUTOMTN_H_ +#define _WX_AUTOMTN_H_ + +#include "wx/defs.h" + +#if wxUSE_OLE_AUTOMATION + +#include "wx/object.h" +#include "wx/variant.h" + +typedef void WXIDISPATCH; +typedef unsigned short* WXBSTR; + +#ifdef GetObject +#undef GetObject +#endif + +/* + * wxAutomationObject + * Wraps up an IDispatch pointer and invocation; does variant conversion. + */ + +class WXDLLEXPORT wxAutomationObject: public wxObject +{ +public: + wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); + virtual ~wxAutomationObject(); + + // Set/get dispatch pointer + inline void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } + inline WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } + + // Get a dispatch pointer from the current object associated + // with a class id, such as "Excel.Application" + bool GetInstance(const wxString& classId) const; + + // Get a dispatch pointer from a new instance of the the class + bool CreateInstance(const wxString& classId) const; + + // Low-level invocation function. Pass either an array of variants, + // or an array of pointers to variants. + bool Invoke(const wxString& member, int action, + wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const; + + // Invoke a member function + wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]); + wxVariant CallMethodArray(const wxString& method, int noArgs, const wxVariant **args); + + // Convenience function + wxVariant CallMethod(const wxString& method, + const wxVariant& arg1 = wxNullVariant, const wxVariant& arg2 = wxNullVariant, + const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, + const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); + + // Get/Put property + wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; + wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const; + wxVariant GetProperty(const wxString& property, + const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, + const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, + const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); + + bool PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args); + bool PutProperty(const wxString& property, int noArgs, wxVariant args[]) ; + bool PutProperty(const wxString& property, + const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, + const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, + const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); + + // Uses DISPATCH_PROPERTYGET + // and returns a dispatch pointer. The calling code should call Release + // on the pointer, though this could be implicit by constructing an wxAutomationObject + // with it and letting the destructor call Release. + WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, wxVariant args[]) const; + WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const; + + // A way of initialising another wxAutomationObject with a dispatch object, + // without having to deal with nasty IDispatch pointers. + bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; + bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const; + +public: + WXIDISPATCH* m_dispatchPtr; + + DECLARE_NO_COPY_CLASS(wxAutomationObject) +}; + +#endif // wxUSE_OLE_AUTOMATION + +#endif // _WX_AUTOMTN_H_ diff --git a/Externals/wxWidgets/include/wx/msw/ole/dataform.h b/Externals/wxWidgets/include/wx/msw/ole/dataform.h index f94c87f86a..733b1b967c 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/dataform.h +++ b/Externals/wxWidgets/include/wx/msw/ole/dataform.h @@ -1,68 +1,68 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/ole/dataform.h -// Purpose: declaration of the wxDataFormat class -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.10.99 (extracted from msw/ole/dataobj.h) -// RCS-ID: $Id: dataform.h 28812 2004-08-16 12:45:46Z ABX $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_OLE_DATAFORM_H -#define _WX_MSW_OLE_DATAFORM_H - -// ---------------------------------------------------------------------------- -// wxDataFormat identifies the single format of data -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataFormat -{ -public: - // the clipboard formats under Win32 are WORD's - typedef unsigned short NativeFormat; - - wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; } - wxDataFormat(const wxChar *format) { SetId(format); } - - wxDataFormat& operator=(NativeFormat format) - { m_format = format; return *this; } - wxDataFormat& operator=(const wxDataFormat& format) - { m_format = format.m_format; return *this; } - - // default copy ctor/assignment operators ok - - // comparison (must have both versions) - bool operator==(wxDataFormatId format) const - { return m_format == (NativeFormat)format; } - bool operator!=(wxDataFormatId format) const - { return m_format != (NativeFormat)format; } - bool operator==(const wxDataFormat& format) const - { return m_format == format.m_format; } - bool operator!=(const wxDataFormat& format) const - { return m_format != format.m_format; } - - // explicit and implicit conversions to NativeFormat which is one of - // standard data types (implicit conversion is useful for preserving the - // compatibility with old code) - NativeFormat GetFormatId() const { return m_format; } - operator NativeFormat() const { return m_format; } - - // this works with standard as well as custom ids - void SetType(NativeFormat format) { m_format = format; } - NativeFormat GetType() const { return m_format; } - - // string ids are used for custom types - this SetId() must be used for - // application-specific formats - wxString GetId() const; - void SetId(const wxChar *format); - - // returns true if the format is one of those defined in wxDataFormatId - bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; } - -private: - NativeFormat m_format; -}; - -#endif // _WX_MSW_OLE_DATAFORM_H - +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/ole/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.10.99 (extracted from msw/ole/dataobj.h) +// RCS-ID: $Id: dataform.h 28812 2004-08-16 12:45:46Z ABX $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OLE_DATAFORM_H +#define _WX_MSW_OLE_DATAFORM_H + +// ---------------------------------------------------------------------------- +// wxDataFormat identifies the single format of data +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataFormat +{ +public: + // the clipboard formats under Win32 are WORD's + typedef unsigned short NativeFormat; + + wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; } + wxDataFormat(const wxChar *format) { SetId(format); } + + wxDataFormat& operator=(NativeFormat format) + { m_format = format; return *this; } + wxDataFormat& operator=(const wxDataFormat& format) + { m_format = format.m_format; return *this; } + + // default copy ctor/assignment operators ok + + // comparison (must have both versions) + bool operator==(wxDataFormatId format) const + { return m_format == (NativeFormat)format; } + bool operator!=(wxDataFormatId format) const + { return m_format != (NativeFormat)format; } + bool operator==(const wxDataFormat& format) const + { return m_format == format.m_format; } + bool operator!=(const wxDataFormat& format) const + { return m_format != format.m_format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + // this works with standard as well as custom ids + void SetType(NativeFormat format) { m_format = format; } + NativeFormat GetType() const { return m_format; } + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId(const wxChar *format); + + // returns true if the format is one of those defined in wxDataFormatId + bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; } + +private: + NativeFormat m_format; +}; + +#endif // _WX_MSW_OLE_DATAFORM_H + diff --git a/Externals/wxWidgets/include/wx/msw/ole/dataobj.h b/Externals/wxWidgets/include/wx/msw/ole/dataobj.h index 71cd445536..ec2acdabbd 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/dataobj.h +++ b/Externals/wxWidgets/include/wx/msw/ole/dataobj.h @@ -1,79 +1,79 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/ole/dataobj.h -// Purpose: declaration of the wxDataObject class -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.05.98 -// RCS-ID: $Id: dataobj.h 37406 2006-02-09 03:45:14Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_OLE_DATAOBJ_H -#define _WX_MSW_OLE_DATAOBJ_H - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -struct IDataObject; - -// ---------------------------------------------------------------------------- -// wxDataObject is a "smart" and polymorphic piece of data. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDataObject : public wxDataObjectBase -{ -public: - // ctor & dtor - wxDataObject(); - virtual ~wxDataObject(); - - // retrieve IDataObject interface (for other OLE related classes) - IDataObject *GetInterface() const { return m_pIDataObject; } - - // tell the object that it should be now owned by IDataObject - i.e. when - // it is deleted, it should delete us as well - void SetAutoDelete(); - - // return true if we support this format in "Get" direction - bool IsSupportedFormat(const wxDataFormat& format) const - { return wxDataObjectBase::IsSupported(format, Get); } - - // if this method returns false, this wxDataObject will be copied to - // the clipboard with its size prepended to it, which is compatible with - // older wx versions - // - // if returns true, then this wxDataObject will be copied to the clipboard - // without any additional information and ::HeapSize() function will be used - // to get the size of that data - virtual bool NeedsVerbatimData(const wxDataFormat& WXUNUSED(format)) const - { - // return false from here only for compatibility with earlier wx versions - return true; - } - - // function to return symbolic name of clipboard format (for debug messages) -#ifdef __WXDEBUG__ - static const wxChar *GetFormatName(wxDataFormat format); - - #define wxGetFormatName(format) wxDataObject::GetFormatName(format) -#else // !Debug - #define wxGetFormatName(format) _T("") -#endif // Debug/!Debug - // they need to be accessed from wxIDataObject, so made them public, - // or wxIDataObject friend -public: - virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, - const wxDataFormat& format ); - virtual void* SetSizeInBuffer( void* buffer, size_t size, - const wxDataFormat& format ); - virtual size_t GetBufferOffset( const wxDataFormat& format ); - -private: - IDataObject *m_pIDataObject; // pointer to the COM interface - - DECLARE_NO_COPY_CLASS(wxDataObject) -}; - -#endif //_WX_MSW_OLE_DATAOBJ_H +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/ole/dataobj.h +// Purpose: declaration of the wxDataObject class +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.05.98 +// RCS-ID: $Id: dataobj.h 37406 2006-02-09 03:45:14Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OLE_DATAOBJ_H +#define _WX_MSW_OLE_DATAOBJ_H + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +struct IDataObject; + +// ---------------------------------------------------------------------------- +// wxDataObject is a "smart" and polymorphic piece of data. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataObject : public wxDataObjectBase +{ +public: + // ctor & dtor + wxDataObject(); + virtual ~wxDataObject(); + + // retrieve IDataObject interface (for other OLE related classes) + IDataObject *GetInterface() const { return m_pIDataObject; } + + // tell the object that it should be now owned by IDataObject - i.e. when + // it is deleted, it should delete us as well + void SetAutoDelete(); + + // return true if we support this format in "Get" direction + bool IsSupportedFormat(const wxDataFormat& format) const + { return wxDataObjectBase::IsSupported(format, Get); } + + // if this method returns false, this wxDataObject will be copied to + // the clipboard with its size prepended to it, which is compatible with + // older wx versions + // + // if returns true, then this wxDataObject will be copied to the clipboard + // without any additional information and ::HeapSize() function will be used + // to get the size of that data + virtual bool NeedsVerbatimData(const wxDataFormat& WXUNUSED(format)) const + { + // return false from here only for compatibility with earlier wx versions + return true; + } + + // function to return symbolic name of clipboard format (for debug messages) +#ifdef __WXDEBUG__ + static const wxChar *GetFormatName(wxDataFormat format); + + #define wxGetFormatName(format) wxDataObject::GetFormatName(format) +#else // !Debug + #define wxGetFormatName(format) _T("") +#endif // Debug/!Debug + // they need to be accessed from wxIDataObject, so made them public, + // or wxIDataObject friend +public: + virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, + const wxDataFormat& format ); + virtual void* SetSizeInBuffer( void* buffer, size_t size, + const wxDataFormat& format ); + virtual size_t GetBufferOffset( const wxDataFormat& format ); + +private: + IDataObject *m_pIDataObject; // pointer to the COM interface + + DECLARE_NO_COPY_CLASS(wxDataObject) +}; + +#endif //_WX_MSW_OLE_DATAOBJ_H diff --git a/Externals/wxWidgets/include/wx/msw/ole/dataobj2.h b/Externals/wxWidgets/include/wx/msw/ole/dataobj2.h index dc1954d0b3..89c2b21414 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/dataobj2.h +++ b/Externals/wxWidgets/include/wx/msw/ole/dataobj2.h @@ -1,146 +1,146 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/ole/dataobj2.h -// Purpose: second part of platform specific wxDataObject header - -// declarations of predefined wxDataObjectSimple-derived classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.10.99 -// RCS-ID: $Id: dataobj2.h 40772 2006-08-23 13:38:45Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_OLE_DATAOBJ2_H -#define _WX_MSW_OLE_DATAOBJ2_H - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject is a specialization of wxDataObject for bitmap data -// -// NB: in fact, under MSW we support CF_DIB (and not CF_BITMAP) clipboard -// format and we also provide wxBitmapDataObject2 for CF_BITMAP (which is -// rarely used). This is ugly, but I haven't found a solution for it yet. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapDataObject : public wxBitmapDataObjectBase -{ -public: - // ctors - wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap) - : wxBitmapDataObjectBase(bitmap) - { - SetFormat(wxDF_DIB); - - m_data = NULL; - } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - // the DIB data - void /* BITMAPINFO */ *m_data; - - DECLARE_NO_COPY_CLASS(wxBitmapDataObject) -}; - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject2 - a data object for CF_BITMAP -// -// FIXME did I already mention it was ugly? -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxBitmapDataObject2 : public wxBitmapDataObjectBase -{ -public: - // ctors - wxBitmapDataObject2(const wxBitmap& bitmap = wxNullBitmap) - : wxBitmapDataObjectBase(bitmap) - { - } - - // implement base class pure virtuals - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - DECLARE_NO_COPY_CLASS(wxBitmapDataObject2) -}; - -// ---------------------------------------------------------------------------- -// wxFileDataObject - data object for CF_HDROP -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDataObject : public wxFileDataObjectBase -{ -public: - wxFileDataObject() { } - - // implement base class pure virtuals - virtual bool SetData(size_t len, const void *buf); - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *pData) const; - virtual void AddFile(const wxString& file); - - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const - { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const - { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) - { return SetData(len, buf); } - -private: - DECLARE_NO_COPY_CLASS(wxFileDataObject) -}; - -// ---------------------------------------------------------------------------- -// wxURLDataObject: data object for URLs -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxURLDataObject : public wxDataObjectComposite -{ -public: - // initialize with URL in ctor or use SetURL later - wxURLDataObject(const wxString& url = wxEmptyString); - - // return the URL as string - wxString GetURL() const; - - // Set a string as the URL in the data object - void SetURL(const wxString& url); - - // override to set m_textFormat - virtual bool SetData(const wxDataFormat& format, - size_t len, - const void *buf); - -private: - // last data object we got data in - wxDataObjectSimple *m_dataObjectLast; - - DECLARE_NO_COPY_CLASS(wxURLDataObject) -}; - -#endif // _WX_MSW_OLE_DATAOBJ2_H +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/dataobj2.h +// Purpose: second part of platform specific wxDataObject header - +// declarations of predefined wxDataObjectSimple-derived classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.10.99 +// RCS-ID: $Id: dataobj2.h 40772 2006-08-23 13:38:45Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OLE_DATAOBJ2_H +#define _WX_MSW_OLE_DATAOBJ2_H + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmap data +// +// NB: in fact, under MSW we support CF_DIB (and not CF_BITMAP) clipboard +// format and we also provide wxBitmapDataObject2 for CF_BITMAP (which is +// rarely used). This is ugly, but I haven't found a solution for it yet. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap) + : wxBitmapDataObjectBase(bitmap) + { + SetFormat(wxDF_DIB); + + m_data = NULL; + } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } + +private: + // the DIB data + void /* BITMAPINFO */ *m_data; + + DECLARE_NO_COPY_CLASS(wxBitmapDataObject) +}; + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject2 - a data object for CF_BITMAP +// +// FIXME did I already mention it was ugly? +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapDataObject2 : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject2(const wxBitmap& bitmap = wxNullBitmap) + : wxBitmapDataObjectBase(bitmap) + { + } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } + +private: + DECLARE_NO_COPY_CLASS(wxBitmapDataObject2) +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject - data object for CF_HDROP +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDataObject : public wxFileDataObjectBase +{ +public: + wxFileDataObject() { } + + // implement base class pure virtuals + virtual bool SetData(size_t len, const void *buf); + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *pData) const; + virtual void AddFile(const wxString& file); + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } + +private: + DECLARE_NO_COPY_CLASS(wxFileDataObject) +}; + +// ---------------------------------------------------------------------------- +// wxURLDataObject: data object for URLs +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxURLDataObject : public wxDataObjectComposite +{ +public: + // initialize with URL in ctor or use SetURL later + wxURLDataObject(const wxString& url = wxEmptyString); + + // return the URL as string + wxString GetURL() const; + + // Set a string as the URL in the data object + void SetURL(const wxString& url); + + // override to set m_textFormat + virtual bool SetData(const wxDataFormat& format, + size_t len, + const void *buf); + +private: + // last data object we got data in + wxDataObjectSimple *m_dataObjectLast; + + DECLARE_NO_COPY_CLASS(wxURLDataObject) +}; + +#endif // _WX_MSW_OLE_DATAOBJ2_H diff --git a/Externals/wxWidgets/include/wx/msw/ole/dropsrc.h b/Externals/wxWidgets/include/wx/msw/ole/dropsrc.h index 8646558f92..f04eaba41c 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/dropsrc.h +++ b/Externals/wxWidgets/include/wx/msw/ole/dropsrc.h @@ -1,79 +1,79 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/dropsrc.h -// Purpose: declaration of the wxDropSource class -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.03.98 -// RCS-ID: $Id: dropsrc.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEDROPSRC_H -#define _WX_OLEDROPSRC_H - -#if wxUSE_DRAG_AND_DROP - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class wxIDropSource; -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// this macro may be used instead for wxDropSource ctor arguments: it will use -// the cursor 'name' from the resources under MSW, but will expand to -// something else under GTK. If you don't use it, you will have to use #ifdef -// in the application code. -#define wxDROP_ICON(name) wxCursor(_T(#name)) - -// ---------------------------------------------------------------------------- -// wxDropSource is used to start the drag-&-drop operation on associated -// wxDataObject object. It's responsible for giving UI feedback while dragging. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropSource : public wxDropSourceBase -{ -public: - // ctors: if you use default ctor you must call SetData() later! - // - // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK - // compatibility, as well as both icon parameters - wxDropSource(wxWindow *win = NULL, - const wxCursor &cursorCopy = wxNullCursor, - const wxCursor &cursorMove = wxNullCursor, - const wxCursor &cursorStop = wxNullCursor); - wxDropSource(wxDataObject& data, - wxWindow *win = NULL, - const wxCursor &cursorCopy = wxNullCursor, - const wxCursor &cursorMove = wxNullCursor, - const wxCursor &cursorStop = wxNullCursor); - - virtual ~wxDropSource(); - - // do it (call this in response to a mouse button press, for example) - // params: if bAllowMove is false, data can be only copied - virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); - - // overridable: you may give some custom UI feedback during d&d operation - // in this function (it's called on each mouse move, so it shouldn't be - // too slow). Just return false if you want default feedback. - virtual bool GiveFeedback(wxDragResult effect); - -protected: - void Init(); - -private: - wxIDropSource *m_pIDropSource; // the pointer to COM interface - - DECLARE_NO_COPY_CLASS(wxDropSource) -}; - -#endif //wxUSE_DRAG_AND_DROP - -#endif //_WX_OLEDROPSRC_H +/////////////////////////////////////////////////////////////////////////////// +// Name: ole/dropsrc.h +// Purpose: declaration of the wxDropSource class +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.03.98 +// RCS-ID: $Id: dropsrc.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEDROPSRC_H +#define _WX_OLEDROPSRC_H + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class wxIDropSource; +class WXDLLIMPEXP_FWD_CORE wxDataObject; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the cursor 'name' from the resources under MSW, but will expand to +// something else under GTK. If you don't use it, you will have to use #ifdef +// in the application code. +#define wxDROP_ICON(name) wxCursor(_T(#name)) + +// ---------------------------------------------------------------------------- +// wxDropSource is used to start the drag-&-drop operation on associated +// wxDataObject object. It's responsible for giving UI feedback while dragging. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDropSource : public wxDropSourceBase +{ +public: + // ctors: if you use default ctor you must call SetData() later! + // + // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK + // compatibility, as well as both icon parameters + wxDropSource(wxWindow *win = NULL, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + wxDropSource(wxDataObject& data, + wxWindow *win = NULL, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + + virtual ~wxDropSource(); + + // do it (call this in response to a mouse button press, for example) + // params: if bAllowMove is false, data can be only copied + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + + // overridable: you may give some custom UI feedback during d&d operation + // in this function (it's called on each mouse move, so it shouldn't be + // too slow). Just return false if you want default feedback. + virtual bool GiveFeedback(wxDragResult effect); + +protected: + void Init(); + +private: + wxIDropSource *m_pIDropSource; // the pointer to COM interface + + DECLARE_NO_COPY_CLASS(wxDropSource) +}; + +#endif //wxUSE_DRAG_AND_DROP + +#endif //_WX_OLEDROPSRC_H diff --git a/Externals/wxWidgets/include/wx/msw/ole/droptgt.h b/Externals/wxWidgets/include/wx/msw/ole/droptgt.h index a1d44a0efc..f96729d696 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/droptgt.h +++ b/Externals/wxWidgets/include/wx/msw/ole/droptgt.h @@ -1,72 +1,72 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/droptgt.h -// Purpose: declaration of the wxDropTarget class -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.03.98 -// RCS-ID: $Id: droptgt.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEDROPTGT_H -#define _WX_OLEDROPTGT_H - -#if wxUSE_DRAG_AND_DROP - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class wxIDropTarget; -struct IDataObject; - -// ---------------------------------------------------------------------------- -// An instance of the class wxDropTarget may be associated with any wxWindow -// derived object via SetDropTarget() function. If this is done, the virtual -// methods of wxDropTarget are called when something is dropped on the window. -// -// Note that wxDropTarget is an abstract base class (ABC) and you should derive -// your own class from it implementing pure virtual function in order to use it -// (all of them, including protected ones which are called by the class itself) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDropTarget : public wxDropTargetBase -{ -public: - // ctor & dtor - wxDropTarget(wxDataObject *dataObject = NULL); - virtual ~wxDropTarget(); - - // normally called by wxWindow on window creation/destruction, but might be - // called `manually' as well. Register() returns true on success. - bool Register(WXHWND hwnd); - void Revoke(WXHWND hwnd); - - // provide default implementation for base class pure virtuals - virtual bool OnDrop(wxCoord x, wxCoord y); - virtual bool GetData(); - - // implementation only from now on - // ------------------------------- - - // do we accept this kind of data? - bool IsAcceptedData(IDataObject *pIDataSource) const; - - // give us the data source from IDropTarget::Drop() - this is later used by - // GetData() when it's called from inside OnData() - void SetDataSource(IDataObject *pIDataSource); - -private: - // helper used by IsAcceptedData() and GetData() - wxDataFormat GetSupportedFormat(IDataObject *pIDataSource) const; - - wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface - IDataObject *m_pIDataSource; // the pointer to the source data object - - DECLARE_NO_COPY_CLASS(wxDropTarget) -}; - -#endif //wxUSE_DRAG_AND_DROP - -#endif //_WX_OLEDROPTGT_H +/////////////////////////////////////////////////////////////////////////////// +// Name: ole/droptgt.h +// Purpose: declaration of the wxDropTarget class +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.03.98 +// RCS-ID: $Id: droptgt.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEDROPTGT_H +#define _WX_OLEDROPTGT_H + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class wxIDropTarget; +struct IDataObject; + +// ---------------------------------------------------------------------------- +// An instance of the class wxDropTarget may be associated with any wxWindow +// derived object via SetDropTarget() function. If this is done, the virtual +// methods of wxDropTarget are called when something is dropped on the window. +// +// Note that wxDropTarget is an abstract base class (ABC) and you should derive +// your own class from it implementing pure virtual function in order to use it +// (all of them, including protected ones which are called by the class itself) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDropTarget : public wxDropTargetBase +{ +public: + // ctor & dtor + wxDropTarget(wxDataObject *dataObject = NULL); + virtual ~wxDropTarget(); + + // normally called by wxWindow on window creation/destruction, but might be + // called `manually' as well. Register() returns true on success. + bool Register(WXHWND hwnd); + void Revoke(WXHWND hwnd); + + // provide default implementation for base class pure virtuals + virtual bool OnDrop(wxCoord x, wxCoord y); + virtual bool GetData(); + + // implementation only from now on + // ------------------------------- + + // do we accept this kind of data? + bool IsAcceptedData(IDataObject *pIDataSource) const; + + // give us the data source from IDropTarget::Drop() - this is later used by + // GetData() when it's called from inside OnData() + void SetDataSource(IDataObject *pIDataSource); + +private: + // helper used by IsAcceptedData() and GetData() + wxDataFormat GetSupportedFormat(IDataObject *pIDataSource) const; + + wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface + IDataObject *m_pIDataSource; // the pointer to the source data object + + DECLARE_NO_COPY_CLASS(wxDropTarget) +}; + +#endif //wxUSE_DRAG_AND_DROP + +#endif //_WX_OLEDROPTGT_H diff --git a/Externals/wxWidgets/include/wx/msw/ole/oleutils.h b/Externals/wxWidgets/include/wx/msw/ole/oleutils.h index 635c11b19c..94de2657b4 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/oleutils.h +++ b/Externals/wxWidgets/include/wx/msw/ole/oleutils.h @@ -1,256 +1,256 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: oleutils.h -// Purpose: OLE helper routines, OLE debugging support &c -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.02.1998 -// RCS-ID: $Id: oleutils.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEUTILS_H -#define _WX_OLEUTILS_H - -#include "wx/defs.h" - -#if wxUSE_OLE - -// ole2.h includes windows.h, so include wrapwin.h first -#include "wx/msw/wrapwin.h" -// get IUnknown, REFIID &c -#include <ole2.h> -#include "wx/intl.h" -#include "wx/log.h" - -// ============================================================================ -// General purpose functions and macros -// ============================================================================ - -// ---------------------------------------------------------------------------- -// initialize/cleanup OLE -// ---------------------------------------------------------------------------- - -// call OleInitialize() or CoInitialize[Ex]() depending on the platform -// -// return true if ok, false otherwise -inline bool wxOleInitialize() -{ - // we need to initialize OLE library -#ifdef __WXWINCE__ - if ( FAILED(::CoInitializeEx(NULL, COINIT_MULTITHREADED)) ) -#else - if ( FAILED(::OleInitialize(NULL)) ) -#endif - { - wxLogError(_("Cannot initialize OLE")); - - return false; - } - - return true; -} - -inline void wxOleUninitialize() -{ -#ifdef __WXWINCE__ - ::CoUninitialize(); -#else - ::OleUninitialize(); -#endif -} - -// ---------------------------------------------------------------------------- -// misc helper functions/macros -// ---------------------------------------------------------------------------- - -// release the interface pointer (if !NULL) -inline void ReleaseInterface(IUnknown *pIUnk) -{ - if ( pIUnk != NULL ) - pIUnk->Release(); -} - -// release the interface pointer (if !NULL) and make it NULL -#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; - -// return true if the iid is in the array -extern bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); - -// ============================================================================ -// IUnknown implementation helpers -// ============================================================================ - -/* - The most dumb implementation of IUnknown methods. We don't support - aggregation nor containment, but for 99% of cases this simple - implementation is quite enough. - - Usage is trivial: here is all you should have - 1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration - 2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you - support (at least all for which you intent to return 'this' from QI, - i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else - 3) IMPLEMENT_IUNKNOWN_METHODS somewhere also - - These macros are quite simple: AddRef and Release are trivial and QI does - lookup in a static member array of IIDs and returns 'this' if it founds - the requested interface in it or E_NOINTERFACE if not. - */ - -/* - wxAutoULong: this class is used for automatically initalising m_cRef to 0 -*/ -class wxAutoULong -{ -public: - wxAutoULong(ULONG value = 0) : m_Value(value) { } - - operator ULONG&() { return m_Value; } - ULONG& operator=(ULONG value) { m_Value = value; return m_Value; } - - wxAutoULong& operator++() { ++m_Value; return *this; } - const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; } - - wxAutoULong& operator--() { --m_Value; return *this; } - const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; } - -private: - ULONG m_Value; -}; - -// declare the methods and the member variable containing reference count -// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE -// and friends (see below) - -#define DECLARE_IUNKNOWN_METHODS \ - public: \ - STDMETHODIMP QueryInterface(REFIID, void **); \ - STDMETHODIMP_(ULONG) AddRef(); \ - STDMETHODIMP_(ULONG) Release(); \ - private: \ - static const IID *ms_aIids[]; \ - wxAutoULong m_cRef - -// macros for declaring supported interfaces -// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)! -#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = { -#define ADD_IID(iid) &IID_I##iid, -#define END_IID_TABLE } - -// implementation is as straightforward as possible -// Parameter: classname - the name of the class -#define IMPLEMENT_IUNKNOWN_METHODS(classname) \ - STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ - { \ - wxLogQueryInterface(_T(#classname), riid); \ - \ - if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ - *ppv = this; \ - AddRef(); \ - \ - return S_OK; \ - } \ - else { \ - *ppv = NULL; \ - \ - return (HRESULT) E_NOINTERFACE; \ - } \ - } \ - \ - STDMETHODIMP_(ULONG) classname::AddRef() \ - { \ - wxLogAddRef(_T(#classname), m_cRef); \ - \ - return ++m_cRef; \ - } \ - \ - STDMETHODIMP_(ULONG) classname::Release() \ - { \ - wxLogRelease(_T(#classname), m_cRef); \ - \ - if ( --m_cRef == wxAutoULong(0) ) { \ - delete this; \ - return 0; \ - } \ - else \ - return m_cRef; \ - } - -// ============================================================================ -// Debugging support -// ============================================================================ - -// VZ: I don't know it's not done for compilers other than VC++ but I leave it -// as is. Please note, though, that tracing OLE interface calls may be -// incredibly useful when debugging OLE programs. -#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ >= 1000) ) || defined(__MWERKS__) ) -// ---------------------------------------------------------------------------- -// All OLE specific log functions have DebugTrace level (as LogTrace) -// ---------------------------------------------------------------------------- - -// tries to translate riid into a symbolic name, if possible -void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); - -// these functions print out the new value of reference counter -void wxLogAddRef (const wxChar *szInterface, ULONG cRef); -void wxLogRelease(const wxChar *szInterface, ULONG cRef); - -#else //!__WXDEBUG__ - #define wxLogQueryInterface(szInterface, riid) - #define wxLogAddRef(szInterface, cRef) - #define wxLogRelease(szInterface, cRef) -#endif //__WXDEBUG__ - -// wrapper around BSTR type (by Vadim Zeitlin) - -class WXDLLEXPORT wxBasicString -{ -public: - // ctors & dtor - wxBasicString(const char *sz); - wxBasicString(const wxString& str); - ~wxBasicString(); - - void Init(const char* sz); - - // accessors - // just get the string - operator BSTR() const { return m_wzBuf; } - // retrieve a copy of our string - caller must SysFreeString() it later! - BSTR Get() const { return SysAllocString(m_wzBuf); } - -private: - // @@@ not implemented (but should be) - wxBasicString(const wxBasicString&); - wxBasicString& operator=(const wxBasicString&); - - OLECHAR *m_wzBuf; // actual string -}; - -#if wxUSE_VARIANT -// Convert variants -class WXDLLIMPEXP_FWD_BASE wxVariant; - -WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant); -WXDLLEXPORT bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant); -#endif // wxUSE_VARIANT - -// Convert string to Unicode -WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str); - -// Convert string from BSTR to wxString -WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr); - -#else // !wxUSE_OLE - -// ---------------------------------------------------------------------------- -// stub functions to avoid #if wxUSE_OLE in the main code -// ---------------------------------------------------------------------------- - -inline bool wxOleInitialize() { return false; } -inline void wxOleUninitialize() { } - -#endif // wxUSE_OLE/!wxUSE_OLE - -#endif //_WX_OLEUTILS_H +/////////////////////////////////////////////////////////////////////////////// +// Name: oleutils.h +// Purpose: OLE helper routines, OLE debugging support &c +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.02.1998 +// RCS-ID: $Id: oleutils.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEUTILS_H +#define _WX_OLEUTILS_H + +#include "wx/defs.h" + +#if wxUSE_OLE + +// ole2.h includes windows.h, so include wrapwin.h first +#include "wx/msw/wrapwin.h" +// get IUnknown, REFIID &c +#include <ole2.h> +#include "wx/intl.h" +#include "wx/log.h" + +// ============================================================================ +// General purpose functions and macros +// ============================================================================ + +// ---------------------------------------------------------------------------- +// initialize/cleanup OLE +// ---------------------------------------------------------------------------- + +// call OleInitialize() or CoInitialize[Ex]() depending on the platform +// +// return true if ok, false otherwise +inline bool wxOleInitialize() +{ + // we need to initialize OLE library +#ifdef __WXWINCE__ + if ( FAILED(::CoInitializeEx(NULL, COINIT_MULTITHREADED)) ) +#else + if ( FAILED(::OleInitialize(NULL)) ) +#endif + { + wxLogError(_("Cannot initialize OLE")); + + return false; + } + + return true; +} + +inline void wxOleUninitialize() +{ +#ifdef __WXWINCE__ + ::CoUninitialize(); +#else + ::OleUninitialize(); +#endif +} + +// ---------------------------------------------------------------------------- +// misc helper functions/macros +// ---------------------------------------------------------------------------- + +// release the interface pointer (if !NULL) +inline void ReleaseInterface(IUnknown *pIUnk) +{ + if ( pIUnk != NULL ) + pIUnk->Release(); +} + +// release the interface pointer (if !NULL) and make it NULL +#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; + +// return true if the iid is in the array +extern bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); + +// ============================================================================ +// IUnknown implementation helpers +// ============================================================================ + +/* + The most dumb implementation of IUnknown methods. We don't support + aggregation nor containment, but for 99% of cases this simple + implementation is quite enough. + + Usage is trivial: here is all you should have + 1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration + 2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you + support (at least all for which you intent to return 'this' from QI, + i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else + 3) IMPLEMENT_IUNKNOWN_METHODS somewhere also + + These macros are quite simple: AddRef and Release are trivial and QI does + lookup in a static member array of IIDs and returns 'this' if it founds + the requested interface in it or E_NOINTERFACE if not. + */ + +/* + wxAutoULong: this class is used for automatically initalising m_cRef to 0 +*/ +class wxAutoULong +{ +public: + wxAutoULong(ULONG value = 0) : m_Value(value) { } + + operator ULONG&() { return m_Value; } + ULONG& operator=(ULONG value) { m_Value = value; return m_Value; } + + wxAutoULong& operator++() { ++m_Value; return *this; } + const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; } + + wxAutoULong& operator--() { --m_Value; return *this; } + const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; } + +private: + ULONG m_Value; +}; + +// declare the methods and the member variable containing reference count +// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE +// and friends (see below) + +#define DECLARE_IUNKNOWN_METHODS \ + public: \ + STDMETHODIMP QueryInterface(REFIID, void **); \ + STDMETHODIMP_(ULONG) AddRef(); \ + STDMETHODIMP_(ULONG) Release(); \ + private: \ + static const IID *ms_aIids[]; \ + wxAutoULong m_cRef + +// macros for declaring supported interfaces +// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)! +#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = { +#define ADD_IID(iid) &IID_I##iid, +#define END_IID_TABLE } + +// implementation is as straightforward as possible +// Parameter: classname - the name of the class +#define IMPLEMENT_IUNKNOWN_METHODS(classname) \ + STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ + { \ + wxLogQueryInterface(_T(#classname), riid); \ + \ + if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ + *ppv = this; \ + AddRef(); \ + \ + return S_OK; \ + } \ + else { \ + *ppv = NULL; \ + \ + return (HRESULT) E_NOINTERFACE; \ + } \ + } \ + \ + STDMETHODIMP_(ULONG) classname::AddRef() \ + { \ + wxLogAddRef(_T(#classname), m_cRef); \ + \ + return ++m_cRef; \ + } \ + \ + STDMETHODIMP_(ULONG) classname::Release() \ + { \ + wxLogRelease(_T(#classname), m_cRef); \ + \ + if ( --m_cRef == wxAutoULong(0) ) { \ + delete this; \ + return 0; \ + } \ + else \ + return m_cRef; \ + } + +// ============================================================================ +// Debugging support +// ============================================================================ + +// VZ: I don't know it's not done for compilers other than VC++ but I leave it +// as is. Please note, though, that tracing OLE interface calls may be +// incredibly useful when debugging OLE programs. +#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ >= 1000) ) || defined(__MWERKS__) ) +// ---------------------------------------------------------------------------- +// All OLE specific log functions have DebugTrace level (as LogTrace) +// ---------------------------------------------------------------------------- + +// tries to translate riid into a symbolic name, if possible +void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); + +// these functions print out the new value of reference counter +void wxLogAddRef (const wxChar *szInterface, ULONG cRef); +void wxLogRelease(const wxChar *szInterface, ULONG cRef); + +#else //!__WXDEBUG__ + #define wxLogQueryInterface(szInterface, riid) + #define wxLogAddRef(szInterface, cRef) + #define wxLogRelease(szInterface, cRef) +#endif //__WXDEBUG__ + +// wrapper around BSTR type (by Vadim Zeitlin) + +class WXDLLEXPORT wxBasicString +{ +public: + // ctors & dtor + wxBasicString(const char *sz); + wxBasicString(const wxString& str); + ~wxBasicString(); + + void Init(const char* sz); + + // accessors + // just get the string + operator BSTR() const { return m_wzBuf; } + // retrieve a copy of our string - caller must SysFreeString() it later! + BSTR Get() const { return SysAllocString(m_wzBuf); } + +private: + // @@@ not implemented (but should be) + wxBasicString(const wxBasicString&); + wxBasicString& operator=(const wxBasicString&); + + OLECHAR *m_wzBuf; // actual string +}; + +#if wxUSE_VARIANT +// Convert variants +class WXDLLIMPEXP_FWD_BASE wxVariant; + +WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant); +WXDLLEXPORT bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant); +#endif // wxUSE_VARIANT + +// Convert string to Unicode +WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str); + +// Convert string from BSTR to wxString +WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr); + +#else // !wxUSE_OLE + +// ---------------------------------------------------------------------------- +// stub functions to avoid #if wxUSE_OLE in the main code +// ---------------------------------------------------------------------------- + +inline bool wxOleInitialize() { return false; } +inline void wxOleUninitialize() { } + +#endif // wxUSE_OLE/!wxUSE_OLE + +#endif //_WX_OLEUTILS_H diff --git a/Externals/wxWidgets/include/wx/msw/ole/uuid.h b/Externals/wxWidgets/include/wx/msw/ole/uuid.h index 7323dc18e3..474964dcff 100644 --- a/Externals/wxWidgets/include/wx/msw/ole/uuid.h +++ b/Externals/wxWidgets/include/wx/msw/ole/uuid.h @@ -1,86 +1,86 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ole/uuid.h -// Purpose: encapsulates an UUID with some added helper functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.07.97 -// RCS-ID: $Id: uuid.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -// -// Notes: you should link your project with RPCRT4.LIB! -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OLEUUID_H -#define _WX_OLEUUID_H - -#include "wx/wxchar.h" -// ------------------------------------------------------------------ -// UUID (Universally Unique IDentifier) definition -// ------------------------------------------------------------------ - -// ----- taken from RPC.H -#ifndef UUID_DEFINED // in some cases RPC.H will be already - #ifdef __WIN32__ // included, so avoid redefinition - typedef struct - { - unsigned long Data1; - unsigned short Data2; - unsigned short Data3; - unsigned char Data4[8]; - } UUID; // UUID = GUID = CLSID = LIBID = IID - #endif // WIN32 -#endif // UUID_DEFINED - -#ifndef GUID_DEFINED - typedef UUID GUID; - #define UUID_DEFINED // prevent redefinition -#endif // GUID_DEFINED - -typedef unsigned char uchar; - -// ------------------------------------------------------------------ -// a class to store UUID and it's string representation -// ------------------------------------------------------------------ - -// uses RPC functions to create/convert Universally Unique Identifiers -class WXDLLEXPORT Uuid -{ -private: - UUID m_uuid; - wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC - wxChar *m_pszCForm; // this string is allocated in Set/Create - - void UuidToCForm(); - - // function used to set initial state by all ctors - void Init() { m_pszUuid = NULL; m_pszCForm = NULL; } - -public: - // ctors & dtor - Uuid() { Init(); } - Uuid(const wxChar *pc) { Init(); Set(pc); } - Uuid(const UUID &uuid) { Init(); Set(uuid); } - ~Uuid(); - - // copy ctor and assignment operator needed for this class - Uuid(const Uuid& uuid); - Uuid& operator=(const Uuid& uuid); - - // create a brand new UUID - void Create(); - - // set value of UUID - bool Set(const wxChar *pc); // from a string, returns true if ok - void Set(const UUID& uuid); // from another UUID (never fails) - - // accessors - operator const UUID*() const { return &m_uuid; } - operator const wxChar*() const { return (wxChar *)(m_pszUuid); } - - // return string representation of the UUID in the C form - // (as in DEFINE_GUID macro) - const wxChar *CForm() const { return m_pszCForm; } -}; - -#endif //_WX_OLEUUID_H +/////////////////////////////////////////////////////////////////////////////// +// Name: ole/uuid.h +// Purpose: encapsulates an UUID with some added helper functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.07.97 +// RCS-ID: $Id: uuid.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +// +// Notes: you should link your project with RPCRT4.LIB! +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEUUID_H +#define _WX_OLEUUID_H + +#include "wx/wxchar.h" +// ------------------------------------------------------------------ +// UUID (Universally Unique IDentifier) definition +// ------------------------------------------------------------------ + +// ----- taken from RPC.H +#ifndef UUID_DEFINED // in some cases RPC.H will be already + #ifdef __WIN32__ // included, so avoid redefinition + typedef struct + { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; + } UUID; // UUID = GUID = CLSID = LIBID = IID + #endif // WIN32 +#endif // UUID_DEFINED + +#ifndef GUID_DEFINED + typedef UUID GUID; + #define UUID_DEFINED // prevent redefinition +#endif // GUID_DEFINED + +typedef unsigned char uchar; + +// ------------------------------------------------------------------ +// a class to store UUID and it's string representation +// ------------------------------------------------------------------ + +// uses RPC functions to create/convert Universally Unique Identifiers +class WXDLLEXPORT Uuid +{ +private: + UUID m_uuid; + wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC + wxChar *m_pszCForm; // this string is allocated in Set/Create + + void UuidToCForm(); + + // function used to set initial state by all ctors + void Init() { m_pszUuid = NULL; m_pszCForm = NULL; } + +public: + // ctors & dtor + Uuid() { Init(); } + Uuid(const wxChar *pc) { Init(); Set(pc); } + Uuid(const UUID &uuid) { Init(); Set(uuid); } + ~Uuid(); + + // copy ctor and assignment operator needed for this class + Uuid(const Uuid& uuid); + Uuid& operator=(const Uuid& uuid); + + // create a brand new UUID + void Create(); + + // set value of UUID + bool Set(const wxChar *pc); // from a string, returns true if ok + void Set(const UUID& uuid); // from another UUID (never fails) + + // accessors + operator const UUID*() const { return &m_uuid; } + operator const wxChar*() const { return (wxChar *)(m_pszUuid); } + + // return string representation of the UUID in the C form + // (as in DEFINE_GUID macro) + const wxChar *CForm() const { return m_pszCForm; } +}; + +#endif //_WX_OLEUUID_H diff --git a/Externals/wxWidgets/include/wx/msw/palette.h b/Externals/wxWidgets/include/wx/msw/palette.h index 87b59ec335..25aad71a5c 100644 --- a/Externals/wxWidgets/include/wx/msw/palette.h +++ b/Externals/wxWidgets/include/wx/msw/palette.h @@ -1,58 +1,58 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/palette.h -// Purpose: wxPalette class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: palette.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PALETTE_H_ -#define _WX_PALETTE_H_ - -#include "wx/gdiobj.h" - -class WXDLLIMPEXP_FWD_CORE wxPalette; - -class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData -{ - friend class WXDLLIMPEXP_FWD_CORE wxPalette; -public: - wxPaletteRefData(void); - virtual ~wxPaletteRefData(void); -protected: - WXHPALETTE m_hPalette; -}; - -#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) - -class WXDLLEXPORT wxPalette: public wxPaletteBase -{ -public: - wxPalette(); - wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - virtual ~wxPalette(void); - bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - - int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; - bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; - - virtual int GetColoursCount() const; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk(void) const { return (m_refData != NULL) ; } - - virtual bool FreeResource(bool force = false); - - // implemetation - inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } - void SetHPALETTE(WXHPALETTE pal); - -private: - DECLARE_DYNAMIC_CLASS(wxPalette) -}; - -#endif - // _WX_PALETTE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/palette.h +// Purpose: wxPalette class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: palette.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#include "wx/gdiobj.h" + +class WXDLLIMPEXP_FWD_CORE wxPalette; + +class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData +{ + friend class WXDLLIMPEXP_FWD_CORE wxPalette; +public: + wxPaletteRefData(void); + virtual ~wxPaletteRefData(void); +protected: + WXHPALETTE m_hPalette; +}; + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLEXPORT wxPalette: public wxPaletteBase +{ +public: + wxPalette(); + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + virtual ~wxPalette(void); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + + virtual int GetColoursCount() const; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk(void) const { return (m_refData != NULL) ; } + + virtual bool FreeResource(bool force = false); + + // implemetation + inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } + void SetHPALETTE(WXHPALETTE pal); + +private: + DECLARE_DYNAMIC_CLASS(wxPalette) +}; + +#endif + // _WX_PALETTE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/pen.h b/Externals/wxWidgets/include/wx/msw/pen.h index caf378d336..e5da34b8c9 100644 --- a/Externals/wxWidgets/include/wx/msw/pen.h +++ b/Externals/wxWidgets/include/wx/msw/pen.h @@ -1,132 +1,132 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/pen.h -// Purpose: wxPen class -// Author: Julian Smart -// Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=() -// Created: 01/02/97 -// RCS-ID: $Id: pen.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PEN_H_ -#define _WX_PEN_H_ - -#include "wx/gdiobj.h" -#include "wx/bitmap.h" -#include "wx/colour.h" - -typedef WXDWORD wxMSWDash; - -class WXDLLIMPEXP_FWD_CORE wxPen; - -// VZ: this class should be made private -class WXDLLEXPORT wxPenRefData : public wxGDIRefData -{ -public: - wxPenRefData(); - wxPenRefData(const wxPenRefData& data); - virtual ~wxPenRefData(); - - bool operator==(const wxPenRefData& data) const - { - // we intentionally don't compare m_hPen fields here - return m_style == data.m_style && - m_width == data.m_width && - m_join == data.m_join && - m_cap == data.m_cap && - m_colour == data.m_colour && - (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) && - (m_style != wxUSER_DASH || - (m_nbDash == data.m_nbDash && - memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0)); - } - -protected: - int m_width; - int m_style; - int m_join; - int m_cap; - wxBitmap m_stipple; - int m_nbDash; - wxDash * m_dash; - wxColour m_colour; - WXHPEN m_hPen; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxPen; - - // Cannot use - // DECLARE_NO_COPY_CLASS(wxPenRefData) - // because copy constructor is explicitly declared above; - // but no copy assignment operator is defined, so declare - // it private to prevent the compiler from defining it: - wxPenRefData& operator=(const wxPenRefData&); -}; - -#define M_PENDATA ((wxPenRefData *)m_refData) -#define wxPENDATA(x) ((wxPenRefData *)(x).m_refData) - -// ---------------------------------------------------------------------------- -// Pen -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPen : public wxGDIObject -{ -public: - wxPen(); - wxPen(const wxColour& col, int width = 1, int style = wxSOLID); - wxPen(const wxBitmap& stipple, int width); - virtual ~wxPen(); - - bool operator==(const wxPen& pen) const - { - const wxPenRefData *penData = (wxPenRefData *)pen.m_refData; - - // an invalid pen is only equal to another invalid pen - return m_refData ? penData && *M_PENDATA == *penData : !penData; - } - - bool operator!=(const wxPen& pen) const { return !(*this == pen); } - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return (m_refData != NULL); } - - // Override in order to recreate the pen - void SetColour(const wxColour& col); - void SetColour(unsigned char r, unsigned char g, unsigned char b); - - void SetWidth(int width); - void SetStyle(int style); - void SetStipple(const wxBitmap& stipple); - void SetDashes(int nb_dashes, const wxDash *dash); - void SetJoin(int join); - void SetCap(int cap); - - wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); } - int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); } - int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); } - int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); } - int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); } - int GetDashes(wxDash **ptr) const - { - *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL); - return (M_PENDATA ? M_PENDATA->m_nbDash : 0); - } - wxDash* GetDash() const { return (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); } - inline int GetDashCount() const { return (M_PENDATA ? M_PENDATA->m_nbDash : 0); } - - inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); } - - // Internal - bool RealizeResource(); - bool FreeResource(bool force = false); - WXHANDLE GetResourceHandle() const; - bool IsFree() const; - void Unshare(); - -private: - DECLARE_DYNAMIC_CLASS(wxPen) -}; - -#endif // _WX_PEN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/pen.h +// Purpose: wxPen class +// Author: Julian Smart +// Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=() +// Created: 01/02/97 +// RCS-ID: $Id: pen.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#include "wx/gdiobj.h" +#include "wx/bitmap.h" +#include "wx/colour.h" + +typedef WXDWORD wxMSWDash; + +class WXDLLIMPEXP_FWD_CORE wxPen; + +// VZ: this class should be made private +class WXDLLEXPORT wxPenRefData : public wxGDIRefData +{ +public: + wxPenRefData(); + wxPenRefData(const wxPenRefData& data); + virtual ~wxPenRefData(); + + bool operator==(const wxPenRefData& data) const + { + // we intentionally don't compare m_hPen fields here + return m_style == data.m_style && + m_width == data.m_width && + m_join == data.m_join && + m_cap == data.m_cap && + m_colour == data.m_colour && + (m_style != wxSTIPPLE || m_stipple.IsSameAs(data.m_stipple)) && + (m_style != wxUSER_DASH || + (m_nbDash == data.m_nbDash && + memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0)); + } + +protected: + int m_width; + int m_style; + int m_join; + int m_cap; + wxBitmap m_stipple; + int m_nbDash; + wxDash * m_dash; + wxColour m_colour; + WXHPEN m_hPen; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxPen; + + // Cannot use + // DECLARE_NO_COPY_CLASS(wxPenRefData) + // because copy constructor is explicitly declared above; + // but no copy assignment operator is defined, so declare + // it private to prevent the compiler from defining it: + wxPenRefData& operator=(const wxPenRefData&); +}; + +#define M_PENDATA ((wxPenRefData *)m_refData) +#define wxPENDATA(x) ((wxPenRefData *)(x).m_refData) + +// ---------------------------------------------------------------------------- +// Pen +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPen : public wxGDIObject +{ +public: + wxPen(); + wxPen(const wxColour& col, int width = 1, int style = wxSOLID); + wxPen(const wxBitmap& stipple, int width); + virtual ~wxPen(); + + bool operator==(const wxPen& pen) const + { + const wxPenRefData *penData = (wxPenRefData *)pen.m_refData; + + // an invalid pen is only equal to another invalid pen + return m_refData ? penData && *M_PENDATA == *penData : !penData; + } + + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return (m_refData != NULL); } + + // Override in order to recreate the pen + void SetColour(const wxColour& col); + void SetColour(unsigned char r, unsigned char g, unsigned char b); + + void SetWidth(int width); + void SetStyle(int style); + void SetStipple(const wxBitmap& stipple); + void SetDashes(int nb_dashes, const wxDash *dash); + void SetJoin(int join); + void SetCap(int cap); + + wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); } + int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); } + int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); } + int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); } + int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); } + int GetDashes(wxDash **ptr) const + { + *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL); + return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + } + wxDash* GetDash() const { return (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); } + inline int GetDashCount() const { return (M_PENDATA ? M_PENDATA->m_nbDash : 0); } + + inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); } + + // Internal + bool RealizeResource(); + bool FreeResource(bool force = false); + WXHANDLE GetResourceHandle() const; + bool IsFree() const; + void Unshare(); + +private: + DECLARE_DYNAMIC_CLASS(wxPen) +}; + +#endif // _WX_PEN_H_ diff --git a/Externals/wxWidgets/include/wx/msw/popupwin.h b/Externals/wxWidgets/include/wx/msw/popupwin.h index 56f63fef4f..646cb5ca33 100644 --- a/Externals/wxWidgets/include/wx/msw/popupwin.h +++ b/Externals/wxWidgets/include/wx/msw/popupwin.h @@ -1,45 +1,45 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/popupwin.h -// Purpose: wxPopupWindow class for wxMSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.01.01 -// RCS-ID: $Id: popupwin.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_POPUPWIN_H_ -#define _WX_MSW_POPUPWIN_H_ - -// ---------------------------------------------------------------------------- -// wxPopupWindow -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase -{ -public: - wxPopupWindow() { } - - wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) - { (void)Create(parent, flags); } - - bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - - virtual bool Show(bool show = true); - - // return the style to be used for the popup windows - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; - - // get the HWND to be used as parent of this window with CreateWindow() - virtual WXHWND MSWGetParent() const; - -protected: - // popups handle the position like wxTopLevelWindow, not wxWindow - virtual void DoGetPosition(int *x, int *y) const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) -}; - -#endif // _WX_MSW_POPUPWIN_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/popupwin.h +// Purpose: wxPopupWindow class for wxMSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.01.01 +// RCS-ID: $Id: popupwin.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_POPUPWIN_H_ +#define _WX_MSW_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show(bool show = true); + + // return the style to be used for the popup windows + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; + + // get the HWND to be used as parent of this window with CreateWindow() + virtual WXHWND MSWGetParent() const; + +protected: + // popups handle the position like wxTopLevelWindow, not wxWindow + virtual void DoGetPosition(int *x, int *y) const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) +}; + +#endif // _WX_MSW_POPUPWIN_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/printdlg.h b/Externals/wxWidgets/include/wx/msw/printdlg.h index 25b21a50f4..581a9d7c17 100644 --- a/Externals/wxWidgets/include/wx/msw/printdlg.h +++ b/Externals/wxWidgets/include/wx/msw/printdlg.h @@ -1,124 +1,124 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: printdlg.h -// Purpose: wxPrintDialog, wxPageSetupDialog classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: printdlg.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINTDLG_H_ -#define _WX_PRINTDLG_H_ - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/dialog.h" -#include "wx/cmndata.h" -#include "wx/prntbase.h" -#include "wx/printdlg.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; - -//---------------------------------------------------------------------------- -// wxWindowsPrintNativeData -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrintNativeData: public wxPrintNativeDataBase -{ -public: - wxWindowsPrintNativeData(); - virtual ~wxWindowsPrintNativeData(); - - virtual bool TransferTo( wxPrintData &data ); - virtual bool TransferFrom( const wxPrintData &data ); - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - - void* GetDevMode() const { return m_devMode; } - void SetDevMode(void* data) { m_devMode = data; } - void* GetDevNames() const { return m_devNames; } - void SetDevNames(void* data) { m_devNames = data; } - -private: - void* m_devMode; - void* m_devNames; - - short m_customWindowsPaperId; - -private: - DECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData) -}; - -// --------------------------------------------------------------------------- -// wxWindowsPrintDialog: the MSW dialog for printing -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase -{ -public: - wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); - wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data); - virtual ~wxWindowsPrintDialog(); - - bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); - virtual int ShowModal(); - - wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } - wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } - - virtual wxDC *GetPrintDC(); - -private: - wxPrintDialogData m_printDialogData; - wxPrinterDC* m_printerDC; - bool m_destroyDC; - wxWindow* m_dialogParent; - -private: - bool ConvertToNative( wxPrintDialogData &data ); - bool ConvertFromNative( wxPrintDialogData &data ); - - // holds MSW handle - void* m_printDlg; - -private: - DECLARE_NO_COPY_CLASS(wxWindowsPrintDialog) - DECLARE_CLASS(wxWindowsPrintDialog) -}; - -// --------------------------------------------------------------------------- -// wxWindowsPageSetupDialog: the MSW page setup dialog -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPageSetupDialog: public wxPageSetupDialogBase -{ -public: - wxWindowsPageSetupDialog(); - wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); - virtual ~wxWindowsPageSetupDialog(); - - bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); - virtual int ShowModal(); - bool ConvertToNative( wxPageSetupDialogData &data ); - bool ConvertFromNative( wxPageSetupDialogData &data ); - - virtual wxPageSetupData& GetPageSetupDialogData() { return m_pageSetupData; } - -private: - wxPageSetupDialogData m_pageSetupData; - wxWindow* m_dialogParent; - - // holds MSW handle - void* m_pageDlg; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog) -}; - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif - // _WX_PRINTDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: printdlg.h +// Purpose: wxPrintDialog, wxPageSetupDialog classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: printdlg.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_ +#define _WX_PRINTDLG_H_ + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dialog.h" +#include "wx/cmndata.h" +#include "wx/prntbase.h" +#include "wx/printdlg.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; + +//---------------------------------------------------------------------------- +// wxWindowsPrintNativeData +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowsPrintNativeData: public wxPrintNativeDataBase +{ +public: + wxWindowsPrintNativeData(); + virtual ~wxWindowsPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ); + virtual bool TransferFrom( const wxPrintData &data ); + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + + void* GetDevMode() const { return m_devMode; } + void SetDevMode(void* data) { m_devMode = data; } + void* GetDevNames() const { return m_devNames; } + void SetDevNames(void* data) { m_devNames = data; } + +private: + void* m_devMode; + void* m_devNames; + + short m_customWindowsPaperId; + +private: + DECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData) +}; + +// --------------------------------------------------------------------------- +// wxWindowsPrintDialog: the MSW dialog for printing +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase +{ +public: + wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxWindowsPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal(); + + wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } + + virtual wxDC *GetPrintDC(); + +private: + wxPrintDialogData m_printDialogData; + wxPrinterDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; + +private: + bool ConvertToNative( wxPrintDialogData &data ); + bool ConvertFromNative( wxPrintDialogData &data ); + + // holds MSW handle + void* m_printDlg; + +private: + DECLARE_NO_COPY_CLASS(wxWindowsPrintDialog) + DECLARE_CLASS(wxWindowsPrintDialog) +}; + +// --------------------------------------------------------------------------- +// wxWindowsPageSetupDialog: the MSW page setup dialog +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowsPageSetupDialog: public wxPageSetupDialogBase +{ +public: + wxWindowsPageSetupDialog(); + wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual ~wxWindowsPageSetupDialog(); + + bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual int ShowModal(); + bool ConvertToNative( wxPageSetupDialogData &data ); + bool ConvertFromNative( wxPageSetupDialogData &data ); + + virtual wxPageSetupData& GetPageSetupDialogData() { return m_pageSetupData; } + +private: + wxPageSetupDialogData m_pageSetupData; + wxWindow* m_dialogParent; + + // holds MSW handle + void* m_pageDlg; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog) +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_PRINTDLG_H_ diff --git a/Externals/wxWidgets/include/wx/msw/printwin.h b/Externals/wxWidgets/include/wx/msw/printwin.h index 4240682a6b..8179f1b011 100644 --- a/Externals/wxWidgets/include/wx/msw/printwin.h +++ b/Externals/wxWidgets/include/wx/msw/printwin.h @@ -1,66 +1,66 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: printwin.h -// Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: printwin.h 42522 2006-10-27 13:07:40Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINTWIN_H_ -#define _WX_PRINTWIN_H_ - -#include "wx/prntbase.h" - -// --------------------------------------------------------------------------- -// Represents the printer: manages printing a wxPrintout object -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrinter : public wxPrinterBase -{ - DECLARE_DYNAMIC_CLASS(wxWindowsPrinter) - -public: - wxWindowsPrinter(wxPrintDialogData *data = NULL); - virtual ~wxWindowsPrinter(); - - virtual bool Print(wxWindow *parent, - wxPrintout *printout, - bool prompt = true); - - virtual wxDC *PrintDialog(wxWindow *parent); - virtual bool Setup(wxWindow *parent); - -private: - WXFARPROC m_lpAbortProc; - - DECLARE_NO_COPY_CLASS(wxWindowsPrinter) -}; - -// --------------------------------------------------------------------------- -// wxPrintPreview: programmer creates an object of this class to preview a -// wxPrintout. -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowsPrintPreview : public wxPrintPreviewBase -{ -public: - wxWindowsPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); - wxWindowsPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - virtual ~wxWindowsPrintPreview(); - - virtual bool Print(bool interactive); - virtual void DetermineScaling(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) -}; - -#endif -// _WX_PRINTWIN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: printwin.h +// Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: printwin.h 42522 2006-10-27 13:07:40Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTWIN_H_ +#define _WX_PRINTWIN_H_ + +#include "wx/prntbase.h" + +// --------------------------------------------------------------------------- +// Represents the printer: manages printing a wxPrintout object +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowsPrinter : public wxPrinterBase +{ + DECLARE_DYNAMIC_CLASS(wxWindowsPrinter) + +public: + wxWindowsPrinter(wxPrintDialogData *data = NULL); + virtual ~wxWindowsPrinter(); + + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = true); + + virtual wxDC *PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); + +private: + WXFARPROC m_lpAbortProc; + + DECLARE_NO_COPY_CLASS(wxWindowsPrinter) +}; + +// --------------------------------------------------------------------------- +// wxPrintPreview: programmer creates an object of this class to preview a +// wxPrintout. +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowsPrintPreview : public wxPrintPreviewBase +{ +public: + wxWindowsPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxWindowsPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxWindowsPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) +}; + +#endif +// _WX_PRINTWIN_H_ diff --git a/Externals/wxWidgets/include/wx/msw/private.h b/Externals/wxWidgets/include/wx/msw/private.h index 330450db30..cf3c0b9a01 100644 --- a/Externals/wxWidgets/include/wx/msw/private.h +++ b/Externals/wxWidgets/include/wx/msw/private.h @@ -1,953 +1,953 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/private.h -// Purpose: Private declarations: as this header is only included by -// wxWidgets itself, it may contain identifiers which don't start -// with "wx". -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: private.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_H_ -#define _WX_PRIVATE_H_ - -#include "wx/msw/wrapwin.h" - -#ifdef __WXMICROWIN__ - // Extra prototypes and symbols not defined by MicroWindows - #include "wx/msw/microwin.h" -#endif - -#include "wx/log.h" - -class WXDLLIMPEXP_FWD_CORE wxFont; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -// --------------------------------------------------------------------------- -// private constants -// --------------------------------------------------------------------------- - -// 260 was taken from windef.h -#ifndef MAX_PATH - #define MAX_PATH 260 -#endif - -// --------------------------------------------------------------------------- -// standard icons from the resources -// --------------------------------------------------------------------------- - -#if wxUSE_GUI - -extern WXDLLEXPORT_DATA(HICON) wxSTD_FRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxSTD_MDIPARENTFRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxSTD_MDICHILDFRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_FRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDIPARENTFRAME_ICON; -extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDICHILDFRAME_ICON; -extern WXDLLEXPORT_DATA(HFONT) wxSTATUS_LINE_FONT; - -#endif // wxUSE_GUI - -// --------------------------------------------------------------------------- -// global data -// --------------------------------------------------------------------------- - -extern WXDLLIMPEXP_DATA_BASE(HINSTANCE) wxhInstance; - -// --------------------------------------------------------------------------- -// define things missing from some compilers' headers -// --------------------------------------------------------------------------- - -#if defined(__WXWINCE__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) -#ifndef ZeroMemory - inline void ZeroMemory(void *buf, size_t len) { memset(buf, 0, len); } -#endif -#endif // old mingw32 - -// this defines a CASTWNDPROC macro which casts a pointer to the type of a -// window proc -#if defined(STRICT) || defined(__GNUC__) - typedef WNDPROC WndProcCast; -#else - typedef FARPROC WndProcCast; -#endif - - -#define CASTWNDPROC (WndProcCast) - - - -// --------------------------------------------------------------------------- -// some stuff for old Windows versions (FIXME: what does it do here??) -// --------------------------------------------------------------------------- - -#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not - #define APIENTRY FAR PASCAL -#endif - -#ifdef __WIN32__ - #define _EXPORT -#else - #define _EXPORT _export -#endif - -#ifndef __WIN32__ - typedef signed short int SHORT; -#endif - -#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs -#ifndef STRICT - #define DLGPROC FARPROC -#endif -#endif - -/* - * Decide what window classes we're going to use - * for this combination of CTl3D/FAFA settings - */ - -#define STATIC_CLASS wxT("STATIC") -#define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE) -#define CHECK_CLASS wxT("BUTTON") -#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD) -#define CHECK_IS_FAFA FALSE -#define RADIO_CLASS wxT("BUTTON") -#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE) -#define RADIO_SIZE 20 -#define RADIO_IS_FAFA FALSE -#define PURE_WINDOWS -#define GROUP_CLASS wxT("BUTTON") -#define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE) - -/* -#define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE) -#define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE) -*/ - -// --------------------------------------------------------------------------- -// misc macros -// --------------------------------------------------------------------------- - -#define MEANING_CHARACTER '0' -#define DEFAULT_ITEM_WIDTH 100 -#define DEFAULT_ITEM_HEIGHT 80 - -// Scale font to get edit control height -//#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2) -#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (cy+8) - -// Generic subclass proc, for panel item moving/sizing and intercept -// EDIT control VK_RETURN messages -extern LONG APIENTRY _EXPORT - wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - -// --------------------------------------------------------------------------- -// useful macros and functions -// --------------------------------------------------------------------------- - -// a wrapper macro for ZeroMemory() -#if defined(__WIN32__) && !defined(__WXMICROWIN__) -#define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj)) -#else -#define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) -#endif - -// This one is a macro so that it can be tested with #ifdef, it will be -// undefined if it cannot be implemented for a given compiler. -// Vc++, bcc, dmc, ow, mingw, codewarrior (and rsxnt) have _get_osfhandle. -// Cygwin has get_osfhandle. Others are currently unknown, e.g. Salford, -// Intel, Visual Age. -#if defined(__WXWINCE__) - #define wxGetOSFHandle(fd) ((HANDLE)fd) - #define wxOpenOSFHandle(h, flags) ((int)wxPtrToUInt(h)) -#elif defined(__CYGWIN__) - #define wxGetOSFHandle(fd) ((HANDLE)get_osfhandle(fd)) -#elif defined(__VISUALC__) \ - || defined(__BORLANDC__) \ - || defined(__DMC__) \ - || defined(__WATCOMC__) \ - || defined(__MINGW32__) \ - || (defined(__MWERKS__) && defined(__MSL__)) - #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) - #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) - #define wx_fdopen _fdopen -#endif - -// close the handle in the class dtor -class AutoHANDLE -{ -public: - wxEXPLICIT AutoHANDLE(HANDLE handle) : m_handle(handle) { } - - bool IsOk() const { return m_handle != INVALID_HANDLE_VALUE; } - operator HANDLE() const { return m_handle; } - - ~AutoHANDLE() { if ( IsOk() ) ::CloseHandle(m_handle); } - -protected: - HANDLE m_handle; -}; - -// a template to make initializing Windows styructs less painful: it zeroes all -// the struct fields and also sets cbSize member to the correct value (and so -// can be only used with structures which have this member...) -template <class T> -struct WinStruct : public T -{ - WinStruct() - { - ::ZeroMemory(this, sizeof(T)); - - // explicit qualification is required here for this to be valid C++ - this->cbSize = sizeof(T); - } -}; - - -#if wxUSE_GUI - -#include "wx/gdicmn.h" -#include "wx/colour.h" - -// make conversion from wxColour and COLORREF a bit less painful -inline COLORREF wxColourToRGB(const wxColour& c) -{ - return RGB(c.Red(), c.Green(), c.Blue()); -} - -inline COLORREF wxColourToPalRGB(const wxColour& c) -{ - return PALETTERGB(c.Red(), c.Green(), c.Blue()); -} - -inline wxColour wxRGBToColour(COLORREF rgb) -{ - return wxColour(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); -} - -inline void wxRGBToColour(wxColour& c, COLORREF rgb) -{ - c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); -} - -// get the standard colour map for some standard colours - see comment in this -// function to understand why is it needed and when should it be used -// -// it returns a wxCOLORMAP (can't use COLORMAP itself here as comctl32.dll -// might be not included/available) array of size wxSTD_COLOUR_MAX -// -// NB: if you change these colours, update wxBITMAP_STD_COLOURS in the -// resources as well: it must have the same number of pixels! -enum wxSTD_COLOUR -{ - wxSTD_COL_BTNTEXT, - wxSTD_COL_BTNSHADOW, - wxSTD_COL_BTNFACE, - wxSTD_COL_BTNHIGHLIGHT, - wxSTD_COL_MAX -}; - -struct WXDLLEXPORT wxCOLORMAP -{ - COLORREF from, to; -}; - -// this function is implemented in src/msw/window.cpp -extern wxCOLORMAP *wxGetStdColourMap(); - -// create a wxRect from Windows RECT -inline wxRect wxRectFromRECT(const RECT& rc) -{ - return wxRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); -} - -// copy Windows RECT to our wxRect -inline void wxCopyRECTToRect(const RECT& rc, wxRect& rect) -{ - rect = wxRectFromRECT(rc); -} - -// and vice versa -inline void wxCopyRectToRECT(const wxRect& rect, RECT& rc) -{ - // note that we don't use wxRect::GetRight() as it is one of compared to - // wxRectFromRECT() above - rc.top = rect.y; - rc.left = rect.x; - rc.right = rect.x + rect.width; - rc.bottom = rect.y + rect.height; -} - -// translations between HIMETRIC units (which OLE likes) and pixels (which are -// liked by all the others) - implemented in msw/utilsexc.cpp -extern void HIMETRICToPixel(LONG *x, LONG *y); -extern void PixelToHIMETRIC(LONG *x, LONG *y); - -// Windows convention of the mask is opposed to the wxWidgets one, so we need -// to invert the mask each time we pass one/get one to/from Windows -extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); - -// Creates an icon or cursor depending from a bitmap -// -// The bitmap must be valid and it should have a mask. If it doesn't, a default -// mask is created using light grey as the transparent colour. -extern HICON wxBitmapToHICON(const wxBitmap& bmp); - -// Same requirments as above apply and the bitmap must also have the correct -// size. -extern -HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); - -// get (x, y) from DWORD - notice that HI/LOWORD can *not* be used because they -// will fail on system with multiple monitors where the coords may be negative -// -// these macros are standard now (Win98) but some older headers don't have them -#ifndef GET_X_LPARAM - #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) - #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) -#endif // GET_X_LPARAM - -// get the current state of SHIFT/CTRL keys -inline bool wxIsShiftDown() -{ -// return (::GetKeyState(VK_SHIFT) & 0x100) != 0; - // Returns different negative values on WinME and WinNT, - // so simply test for negative value. - return ::GetKeyState(VK_SHIFT) < 0; -} - -inline bool wxIsCtrlDown() -{ -// return (::GetKeyState(VK_CONTROL) & 0x100) != 0; - // Returns different negative values on WinME and WinNT, - // so simply test for negative value. - return ::GetKeyState(VK_CONTROL) < 0; -} - -// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking -// for Win32 -inline RECT wxGetWindowRect(HWND hwnd) -{ - RECT rect; - - if ( !::GetWindowRect(hwnd, &rect) ) - wxLogLastError(_T("GetWindowRect")); - - return rect; -} - -inline RECT wxGetClientRect(HWND hwnd) -{ - RECT rect; - - if ( !::GetClientRect(hwnd, &rect) ) - wxLogLastError(_T("GetClientRect")); - - return rect; -} - -// --------------------------------------------------------------------------- -// small helper classes -// --------------------------------------------------------------------------- - -// create an instance of this class and use it as the HDC for screen, will -// automatically release the DC going out of scope -class ScreenHDC -{ -public: - ScreenHDC() { m_hdc = ::GetDC(NULL); } - ~ScreenHDC() { ::ReleaseDC(NULL, m_hdc); } - - operator HDC() const { return m_hdc; } - -private: - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(ScreenHDC) -}; - -// the same as ScreenHDC but for window DCs -class WindowHDC -{ -public: - WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } - ~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); } - - operator HDC() const { return m_hdc; } - -private: - HWND m_hwnd; - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(WindowHDC) -}; - -// the same as ScreenHDC but for memory DCs: creates the HDC compatible with -// the given one (screen by default) in ctor and destroys it in dtor -class MemoryHDC -{ -public: - MemoryHDC(HDC hdc = 0) { m_hdc = ::CreateCompatibleDC(hdc); } - ~MemoryHDC() { ::DeleteDC(m_hdc); } - - operator HDC() const { return m_hdc; } - -private: - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(MemoryHDC) -}; - -// a class which selects a GDI object into a DC in its ctor and deselects in -// dtor -class SelectInHDC -{ -private: - void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } - -public: - SelectInHDC() : m_hdc(NULL) { } - SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } - - void Init(HDC hdc, HGDIOBJ hgdiobj) - { - wxASSERT_MSG( !m_hdc, _T("initializing twice?") ); - - m_hdc = hdc; - - DoInit(hgdiobj); - } - - ~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); } - - // return true if the object was successfully selected - operator bool() const { return m_hgdiobj != 0; } - -private: - HDC m_hdc; - HGDIOBJ m_hgdiobj; - - DECLARE_NO_COPY_CLASS(SelectInHDC) -}; - -// a class which cleans up any GDI object -class AutoGDIObject -{ -protected: - AutoGDIObject() { m_gdiobj = NULL; } - AutoGDIObject(HGDIOBJ gdiobj) : m_gdiobj(gdiobj) { } - ~AutoGDIObject() { if ( m_gdiobj ) ::DeleteObject(m_gdiobj); } - - void InitGdiobj(HGDIOBJ gdiobj) - { - wxASSERT_MSG( !m_gdiobj, _T("initializing twice?") ); - - m_gdiobj = gdiobj; - } - - HGDIOBJ GetObject() const { return m_gdiobj; } - -private: - HGDIOBJ m_gdiobj; -}; - -// TODO: all this asks for using a AutoHandler<T, CreateFunc> template... - -// a class for temporary brushes -class AutoHBRUSH : private AutoGDIObject -{ -public: - AutoHBRUSH(COLORREF col) - : AutoGDIObject(::CreateSolidBrush(col)) { } - - operator HBRUSH() const { return (HBRUSH)GetObject(); } -}; - -// a class for temporary fonts -class AutoHFONT : private AutoGDIObject -{ -private: -public: - AutoHFONT() - : AutoGDIObject() { } - - AutoHFONT(const LOGFONT& lf) - : AutoGDIObject(::CreateFontIndirect(&lf)) { } - - void Init(const LOGFONT& lf) { InitGdiobj(::CreateFontIndirect(&lf)); } - - operator HFONT() const { return (HFONT)GetObject(); } -}; - -// a class for temporary pens -class AutoHPEN : private AutoGDIObject -{ -public: - AutoHPEN(COLORREF col) - : AutoGDIObject(::CreatePen(PS_SOLID, 0, col)) { } - - operator HPEN() const { return (HPEN)GetObject(); } -}; - -// classes for temporary bitmaps -class AutoHBITMAP : private AutoGDIObject -{ -public: - AutoHBITMAP(HBITMAP hbmp) : AutoGDIObject(hbmp) { } - - operator HBITMAP() const { return (HBITMAP)GetObject(); } -}; - -class CompatibleBitmap : public AutoHBITMAP -{ -public: - CompatibleBitmap(HDC hdc, int w, int h) - : AutoHBITMAP(::CreateCompatibleBitmap(hdc, w, h)) - { - } -}; - -class MonoBitmap : public AutoHBITMAP -{ -public: - MonoBitmap(int w, int h) - : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, 0)) - { - } -}; - -// class automatically destroys the region object -class AutoHRGN : private AutoGDIObject -{ -public: - AutoHRGN(HRGN hrgn) : AutoGDIObject(hrgn) { } - - operator HRGN() const { return (HRGN)GetObject(); } -}; - -// class sets the specified clipping region during its life time -class HDCClipper -{ -public: - HDCClipper(HDC hdc, HRGN hrgn) - : m_hdc(hdc) - { - if ( !::SelectClipRgn(hdc, hrgn) ) - wxLogLastError(_T("SelectClipRgn")); - } - - ~HDCClipper() - { - ::SelectClipRgn(m_hdc, NULL); - } - -private: - HDC m_hdc; - - DECLARE_NO_COPY_CLASS(HDCClipper) -}; - -// set the given map mode for the life time of this object -// -// NB: SetMapMode() is not supported by CE so we also define a helper macro -// to avoid using it there -#ifdef __WXWINCE__ - #define wxCHANGE_HDC_MAP_MODE(hdc, mm) -#else // !__WXWINCE__ - class HDCMapModeChanger - { - public: - HDCMapModeChanger(HDC hdc, int mm) - : m_hdc(hdc) - { - m_modeOld = ::SetMapMode(hdc, mm); - if ( !m_modeOld ) - wxLogLastError(_T("SelectClipRgn")); - } - - ~HDCMapModeChanger() - { - if ( m_modeOld ) - ::SetMapMode(m_hdc, m_modeOld); - } - - private: - HDC m_hdc; - int m_modeOld; - - DECLARE_NO_COPY_CLASS(HDCMapModeChanger) - }; - - #define wxCHANGE_HDC_MAP_MODE(hdc, mm) \ - HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) -#endif // __WXWINCE__/!__WXWINCE__ - -// smart buffeer using GlobalAlloc/GlobalFree() -class GlobalPtr -{ -public: - // allocates a block of given size - GlobalPtr(size_t size, unsigned flags = GMEM_MOVEABLE) - { - m_hGlobal = ::GlobalAlloc(flags, size); - if ( !m_hGlobal ) - wxLogLastError(_T("GlobalAlloc")); - } - - ~GlobalPtr() - { - if ( m_hGlobal && ::GlobalFree(m_hGlobal) ) - wxLogLastError(_T("GlobalFree")); - } - - // implicit conversion - operator HGLOBAL() const { return m_hGlobal; } - -private: - HGLOBAL m_hGlobal; - - DECLARE_NO_COPY_CLASS(GlobalPtr) -}; - -// when working with global pointers (which is unfortunately still necessary -// sometimes, e.g. for clipboard) it is important to unlock them exactly as -// many times as we lock them which just asks for using a "smart lock" class -class GlobalPtrLock -{ -public: - GlobalPtrLock(HGLOBAL hGlobal) : m_hGlobal(hGlobal) - { - m_ptr = GlobalLock(hGlobal); - if ( !m_ptr ) - wxLogLastError(_T("GlobalLock")); - } - - ~GlobalPtrLock() - { - if ( !GlobalUnlock(m_hGlobal) ) - { -#ifdef __WXDEBUG__ - // this might happen simply because the block became unlocked - DWORD dwLastError = ::GetLastError(); - if ( dwLastError != NO_ERROR ) - { - wxLogApiError(_T("GlobalUnlock"), dwLastError); - } -#endif // __WXDEBUG__ - } - } - - operator void *() const { return m_ptr; } - -private: - HGLOBAL m_hGlobal; - void *m_ptr; - - DECLARE_NO_COPY_CLASS(GlobalPtrLock) -}; - -// register the class when it is first needed and unregister it in dtor -class ClassRegistrar -{ -public: - // ctor doesn't register the class, call Initialize() for this - ClassRegistrar() { m_registered = -1; } - - // return true if the class is already registered - bool IsInitialized() const { return m_registered != -1; } - - // return true if the class had been already registered - bool IsRegistered() const { return m_registered == 1; } - - // try to register the class if not done yet, return true on success - bool Register(const WNDCLASS& wc) - { - // we should only be called if we hadn't been initialized yet - wxASSERT_MSG( m_registered == -1, - _T("calling ClassRegistrar::Register() twice?") ); - - m_registered = ::RegisterClass(&wc) ? 1 : 0; - if ( !IsRegistered() ) - { - wxLogLastError(_T("RegisterClassEx()")); - } - else - { - m_clsname = wc.lpszClassName; - } - - return m_registered == 1; - } - - // get the name of the registered class (returns empty string if not - // registered) - const wxString& GetName() const { return m_clsname; } - - // unregister the class if it had been registered - ~ClassRegistrar() - { - if ( IsRegistered() ) - { - if ( !::UnregisterClass(m_clsname, wxhInstance) ) - { - wxLogLastError(_T("UnregisterClass")); - } - } - } - -private: - // initial value is -1 which means that we hadn't tried registering the - // class yet, it becomes true or false (1 or 0) when Initialize() is called - int m_registered; - - // the name of the class, only non empty if it had been registered - wxString m_clsname; -}; - -// --------------------------------------------------------------------------- -// macros to make casting between WXFOO and FOO a bit easier: the GetFoo() -// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes -// an argument which should be a pointer or reference to the object of the -// corresponding class (this depends on the macro) -// --------------------------------------------------------------------------- - -#define GetHwnd() ((HWND)GetHWND()) -#define GetHwndOf(win) ((HWND)((win)->GetHWND())) -// old name -#define GetWinHwnd GetHwndOf - -#define GetHdc() ((HDC)GetHDC()) -#define GetHdcOf(dc) ((HDC)(dc).GetHDC()) - -#define GetHbitmap() ((HBITMAP)GetHBITMAP()) -#define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP()) - -#define GetHicon() ((HICON)GetHICON()) -#define GetHiconOf(icon) ((HICON)(icon).GetHICON()) - -#define GetHaccel() ((HACCEL)GetHACCEL()) -#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL())) - -#define GetHbrush() ((HBRUSH)GetResourceHandle()) -#define GetHbrushOf(brush) ((HBRUSH)(brush).GetResourceHandle()) - -#define GetHmenu() ((HMENU)GetHMenu()) -#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu()) - -#define GetHcursor() ((HCURSOR)GetHCURSOR()) -#define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) - -#define GetHfont() ((HFONT)GetHFONT()) -#define GetHfontOf(font) ((HFONT)(font).GetHFONT()) - -#define GetHimagelist() ((HIMAGELIST)GetHIMAGELIST()) -#define GetHimagelistOf(imgl) ((HIMAGELIST)imgl->GetHIMAGELIST()) - -#define GetHpalette() ((HPALETTE)GetHPALETTE()) -#define GetHpaletteOf(pal) ((HPALETTE)(pal).GetHPALETTE()) - -#define GetHpen() ((HPEN)GetResourceHandle()) -#define GetHpenOf(pen) ((HPEN)(pen).GetResourceHandle()) - -#define GetHrgn() ((HRGN)GetHRGN()) -#define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN()) - -#endif // wxUSE_GUI - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -extern "C" -{ - WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); -} - -WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); - -// return the full path of the given module -inline wxString wxGetFullModuleName(HMODULE hmod) -{ - wxString fullname; - if ( !::GetModuleFileName - ( - hmod, - wxStringBuffer(fullname, MAX_PATH), - MAX_PATH - ) ) - { - wxLogLastError(_T("GetModuleFileName")); - } - - return fullname; -} - -// return the full path of the program file -inline wxString wxGetFullModuleName() -{ - return wxGetFullModuleName((HMODULE)wxGetInstance()); -} - -// return the run-time version of the OS in a format similar to -// WINVER/_WIN32_WINNT compile-time macros: -// -// 0x0300 Windows NT 3.51 -// 0x0400 Windows 95, NT4 -// 0x0410 Windows 98 -// 0x0500 Windows ME, 2000 -// 0x0501 Windows XP -// 0x0502 Windows 2003 -// 0x0600 Longhorn -// -// for the other Windows versions 0 is currently returned -enum wxWinVersion -{ - wxWinVersion_Unknown = 0, - - wxWinVersion_3 = 0x0300, - wxWinVersion_NT3 = wxWinVersion_3, - - wxWinVersion_4 = 0x0400, - wxWinVersion_95 = wxWinVersion_4, - wxWinVersion_NT4 = wxWinVersion_4, - wxWinVersion_98 = 0x0410, - - wxWinVersion_5 = 0x0500, - wxWinVersion_ME = wxWinVersion_5, - wxWinVersion_NT5 = wxWinVersion_5, - wxWinVersion_2000 = wxWinVersion_5, - wxWinVersion_XP = 0x0501, - wxWinVersion_2003 = 0x0502, - - wxWinVersion_6 = 0x0600, - wxWinVersion_NT6 = 0x0600 -}; - -WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); - -#if wxUSE_GUI - -// cursor stuff -extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp -extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp - -WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); -WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); -WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); -WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); - -WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); -WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); - -// Find maximum size of window/rectangle -extern WXDLLEXPORT void wxFindMaxSize(WXHWND hwnd, RECT *rect); - -// Safely get the window text (i.e. without using fixed size buffer) -extern WXDLLEXPORT wxString wxGetWindowText(WXHWND hWnd); - -// get the window class name -extern WXDLLEXPORT wxString wxGetWindowClass(WXHWND hWnd); - -// get the window id (should be unsigned, hence this is not wxWindowID which -// is, for mainly historical reasons, signed) -extern WXDLLEXPORT WXWORD wxGetWindowId(WXHWND hWnd); - -// check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are -// different -extern WXDLLEXPORT bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc); - -// Does this window style specify any border? -inline bool wxStyleHasBorder(long style) -{ - return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER | - wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; -} - -// ---------------------------------------------------------------------------- -// functions mapping HWND to wxWindow -// ---------------------------------------------------------------------------- - -// this function simply checks whether the given hWnd corresponds to a wxWindow -// and returns either that window if it does or NULL otherwise -extern WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); - -// find the window for HWND which is part of some wxWindow, i.e. unlike -// wxFindWinFromHandle() above it will also work for "sub controls" of a -// wxWindow. -// -// returns the wxWindow corresponding to the given HWND or NULL. -extern WXDLLEXPORT wxWindow *wxGetWindowFromHWND(WXHWND hwnd); - -// Get the size of an icon -extern WXDLLEXPORT wxSize wxGetHiconSize(HICON hicon); - -// Lines are drawn differently for WinCE and regular WIN32 -WXDLLEXPORT void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2); - -// fill the client rect of the given window on the provided dc using this brush -inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr) -{ - RECT rc; - ::GetClientRect(hwnd, &rc); - ::FillRect(hdc, &rc, hbr); -} - -// ---------------------------------------------------------------------------- -// 32/64 bit helpers -// ---------------------------------------------------------------------------- - -#ifdef __WIN64__ - -inline void *wxGetWindowProc(HWND hwnd) -{ - return (void *)::GetWindowLongPtr(hwnd, GWLP_WNDPROC); -} - -inline void *wxGetWindowUserData(HWND hwnd) -{ - return (void *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); -} - -inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) -{ - return (WNDPROC)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func); -} - -inline void *wxSetWindowUserData(HWND hwnd, void *data) -{ - return (void *)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); -} - -#else // __WIN32__ - -// note that the casts to LONG_PTR here are required even on 32-bit machines -// for the 64-bit warning mode of later versions of MSVC (C4311/4312) -inline WNDPROC wxGetWindowProc(HWND hwnd) -{ - return (WNDPROC)(LONG_PTR)::GetWindowLong(hwnd, GWL_WNDPROC); -} - -inline void *wxGetWindowUserData(HWND hwnd) -{ - return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_USERDATA); -} - -inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) -{ - return (WNDPROC)(LONG_PTR)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)func); -} - -inline void *wxSetWindowUserData(HWND hwnd, void *data) -{ - return (void *)(LONG_PTR)::SetWindowLong(hwnd, GWL_USERDATA, (LONG_PTR)data); -} - -#endif // __WIN64__/__WIN32__ - -#endif // wxUSE_GUI - -#endif // _WX_PRIVATE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: private.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/msw/wrapwin.h" + +#ifdef __WXMICROWIN__ + // Extra prototypes and symbols not defined by MicroWindows + #include "wx/msw/microwin.h" +#endif + +#include "wx/log.h" + +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +// --------------------------------------------------------------------------- +// private constants +// --------------------------------------------------------------------------- + +// 260 was taken from windef.h +#ifndef MAX_PATH + #define MAX_PATH 260 +#endif + +// --------------------------------------------------------------------------- +// standard icons from the resources +// --------------------------------------------------------------------------- + +#if wxUSE_GUI + +extern WXDLLEXPORT_DATA(HICON) wxSTD_FRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxSTD_MDIPARENTFRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxSTD_MDICHILDFRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_FRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDIPARENTFRAME_ICON; +extern WXDLLEXPORT_DATA(HICON) wxDEFAULT_MDICHILDFRAME_ICON; +extern WXDLLEXPORT_DATA(HFONT) wxSTATUS_LINE_FONT; + +#endif // wxUSE_GUI + +// --------------------------------------------------------------------------- +// global data +// --------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_BASE(HINSTANCE) wxhInstance; + +// --------------------------------------------------------------------------- +// define things missing from some compilers' headers +// --------------------------------------------------------------------------- + +#if defined(__WXWINCE__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) +#ifndef ZeroMemory + inline void ZeroMemory(void *buf, size_t len) { memset(buf, 0, len); } +#endif +#endif // old mingw32 + +// this defines a CASTWNDPROC macro which casts a pointer to the type of a +// window proc +#if defined(STRICT) || defined(__GNUC__) + typedef WNDPROC WndProcCast; +#else + typedef FARPROC WndProcCast; +#endif + + +#define CASTWNDPROC (WndProcCast) + + + +// --------------------------------------------------------------------------- +// some stuff for old Windows versions (FIXME: what does it do here??) +// --------------------------------------------------------------------------- + +#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not + #define APIENTRY FAR PASCAL +#endif + +#ifdef __WIN32__ + #define _EXPORT +#else + #define _EXPORT _export +#endif + +#ifndef __WIN32__ + typedef signed short int SHORT; +#endif + +#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs +#ifndef STRICT + #define DLGPROC FARPROC +#endif +#endif + +/* + * Decide what window classes we're going to use + * for this combination of CTl3D/FAFA settings + */ + +#define STATIC_CLASS wxT("STATIC") +#define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE) +#define CHECK_CLASS wxT("BUTTON") +#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD) +#define CHECK_IS_FAFA FALSE +#define RADIO_CLASS wxT("BUTTON") +#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE) +#define RADIO_SIZE 20 +#define RADIO_IS_FAFA FALSE +#define PURE_WINDOWS +#define GROUP_CLASS wxT("BUTTON") +#define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE) + +/* +#define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE) +#define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE) +*/ + +// --------------------------------------------------------------------------- +// misc macros +// --------------------------------------------------------------------------- + +#define MEANING_CHARACTER '0' +#define DEFAULT_ITEM_WIDTH 100 +#define DEFAULT_ITEM_HEIGHT 80 + +// Scale font to get edit control height +//#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2) +#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (cy+8) + +// Generic subclass proc, for panel item moving/sizing and intercept +// EDIT control VK_RETURN messages +extern LONG APIENTRY _EXPORT + wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +// --------------------------------------------------------------------------- +// useful macros and functions +// --------------------------------------------------------------------------- + +// a wrapper macro for ZeroMemory() +#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj)) +#else +#define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) +#endif + +// This one is a macro so that it can be tested with #ifdef, it will be +// undefined if it cannot be implemented for a given compiler. +// Vc++, bcc, dmc, ow, mingw, codewarrior (and rsxnt) have _get_osfhandle. +// Cygwin has get_osfhandle. Others are currently unknown, e.g. Salford, +// Intel, Visual Age. +#if defined(__WXWINCE__) + #define wxGetOSFHandle(fd) ((HANDLE)fd) + #define wxOpenOSFHandle(h, flags) ((int)wxPtrToUInt(h)) +#elif defined(__CYGWIN__) + #define wxGetOSFHandle(fd) ((HANDLE)get_osfhandle(fd)) +#elif defined(__VISUALC__) \ + || defined(__BORLANDC__) \ + || defined(__DMC__) \ + || defined(__WATCOMC__) \ + || defined(__MINGW32__) \ + || (defined(__MWERKS__) && defined(__MSL__)) + #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) + #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) + #define wx_fdopen _fdopen +#endif + +// close the handle in the class dtor +class AutoHANDLE +{ +public: + wxEXPLICIT AutoHANDLE(HANDLE handle) : m_handle(handle) { } + + bool IsOk() const { return m_handle != INVALID_HANDLE_VALUE; } + operator HANDLE() const { return m_handle; } + + ~AutoHANDLE() { if ( IsOk() ) ::CloseHandle(m_handle); } + +protected: + HANDLE m_handle; +}; + +// a template to make initializing Windows styructs less painful: it zeroes all +// the struct fields and also sets cbSize member to the correct value (and so +// can be only used with structures which have this member...) +template <class T> +struct WinStruct : public T +{ + WinStruct() + { + ::ZeroMemory(this, sizeof(T)); + + // explicit qualification is required here for this to be valid C++ + this->cbSize = sizeof(T); + } +}; + + +#if wxUSE_GUI + +#include "wx/gdicmn.h" +#include "wx/colour.h" + +// make conversion from wxColour and COLORREF a bit less painful +inline COLORREF wxColourToRGB(const wxColour& c) +{ + return RGB(c.Red(), c.Green(), c.Blue()); +} + +inline COLORREF wxColourToPalRGB(const wxColour& c) +{ + return PALETTERGB(c.Red(), c.Green(), c.Blue()); +} + +inline wxColour wxRGBToColour(COLORREF rgb) +{ + return wxColour(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); +} + +inline void wxRGBToColour(wxColour& c, COLORREF rgb) +{ + c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); +} + +// get the standard colour map for some standard colours - see comment in this +// function to understand why is it needed and when should it be used +// +// it returns a wxCOLORMAP (can't use COLORMAP itself here as comctl32.dll +// might be not included/available) array of size wxSTD_COLOUR_MAX +// +// NB: if you change these colours, update wxBITMAP_STD_COLOURS in the +// resources as well: it must have the same number of pixels! +enum wxSTD_COLOUR +{ + wxSTD_COL_BTNTEXT, + wxSTD_COL_BTNSHADOW, + wxSTD_COL_BTNFACE, + wxSTD_COL_BTNHIGHLIGHT, + wxSTD_COL_MAX +}; + +struct WXDLLEXPORT wxCOLORMAP +{ + COLORREF from, to; +}; + +// this function is implemented in src/msw/window.cpp +extern wxCOLORMAP *wxGetStdColourMap(); + +// create a wxRect from Windows RECT +inline wxRect wxRectFromRECT(const RECT& rc) +{ + return wxRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); +} + +// copy Windows RECT to our wxRect +inline void wxCopyRECTToRect(const RECT& rc, wxRect& rect) +{ + rect = wxRectFromRECT(rc); +} + +// and vice versa +inline void wxCopyRectToRECT(const wxRect& rect, RECT& rc) +{ + // note that we don't use wxRect::GetRight() as it is one of compared to + // wxRectFromRECT() above + rc.top = rect.y; + rc.left = rect.x; + rc.right = rect.x + rect.width; + rc.bottom = rect.y + rect.height; +} + +// translations between HIMETRIC units (which OLE likes) and pixels (which are +// liked by all the others) - implemented in msw/utilsexc.cpp +extern void HIMETRICToPixel(LONG *x, LONG *y); +extern void PixelToHIMETRIC(LONG *x, LONG *y); + +// Windows convention of the mask is opposed to the wxWidgets one, so we need +// to invert the mask each time we pass one/get one to/from Windows +extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); + +// Creates an icon or cursor depending from a bitmap +// +// The bitmap must be valid and it should have a mask. If it doesn't, a default +// mask is created using light grey as the transparent colour. +extern HICON wxBitmapToHICON(const wxBitmap& bmp); + +// Same requirments as above apply and the bitmap must also have the correct +// size. +extern +HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); + +// get (x, y) from DWORD - notice that HI/LOWORD can *not* be used because they +// will fail on system with multiple monitors where the coords may be negative +// +// these macros are standard now (Win98) but some older headers don't have them +#ifndef GET_X_LPARAM + #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) + #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) +#endif // GET_X_LPARAM + +// get the current state of SHIFT/CTRL keys +inline bool wxIsShiftDown() +{ +// return (::GetKeyState(VK_SHIFT) & 0x100) != 0; + // Returns different negative values on WinME and WinNT, + // so simply test for negative value. + return ::GetKeyState(VK_SHIFT) < 0; +} + +inline bool wxIsCtrlDown() +{ +// return (::GetKeyState(VK_CONTROL) & 0x100) != 0; + // Returns different negative values on WinME and WinNT, + // so simply test for negative value. + return ::GetKeyState(VK_CONTROL) < 0; +} + +// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking +// for Win32 +inline RECT wxGetWindowRect(HWND hwnd) +{ + RECT rect; + + if ( !::GetWindowRect(hwnd, &rect) ) + wxLogLastError(_T("GetWindowRect")); + + return rect; +} + +inline RECT wxGetClientRect(HWND hwnd) +{ + RECT rect; + + if ( !::GetClientRect(hwnd, &rect) ) + wxLogLastError(_T("GetClientRect")); + + return rect; +} + +// --------------------------------------------------------------------------- +// small helper classes +// --------------------------------------------------------------------------- + +// create an instance of this class and use it as the HDC for screen, will +// automatically release the DC going out of scope +class ScreenHDC +{ +public: + ScreenHDC() { m_hdc = ::GetDC(NULL); } + ~ScreenHDC() { ::ReleaseDC(NULL, m_hdc); } + + operator HDC() const { return m_hdc; } + +private: + HDC m_hdc; + + DECLARE_NO_COPY_CLASS(ScreenHDC) +}; + +// the same as ScreenHDC but for window DCs +class WindowHDC +{ +public: + WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } + ~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); } + + operator HDC() const { return m_hdc; } + +private: + HWND m_hwnd; + HDC m_hdc; + + DECLARE_NO_COPY_CLASS(WindowHDC) +}; + +// the same as ScreenHDC but for memory DCs: creates the HDC compatible with +// the given one (screen by default) in ctor and destroys it in dtor +class MemoryHDC +{ +public: + MemoryHDC(HDC hdc = 0) { m_hdc = ::CreateCompatibleDC(hdc); } + ~MemoryHDC() { ::DeleteDC(m_hdc); } + + operator HDC() const { return m_hdc; } + +private: + HDC m_hdc; + + DECLARE_NO_COPY_CLASS(MemoryHDC) +}; + +// a class which selects a GDI object into a DC in its ctor and deselects in +// dtor +class SelectInHDC +{ +private: + void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } + +public: + SelectInHDC() : m_hdc(NULL) { } + SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } + + void Init(HDC hdc, HGDIOBJ hgdiobj) + { + wxASSERT_MSG( !m_hdc, _T("initializing twice?") ); + + m_hdc = hdc; + + DoInit(hgdiobj); + } + + ~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); } + + // return true if the object was successfully selected + operator bool() const { return m_hgdiobj != 0; } + +private: + HDC m_hdc; + HGDIOBJ m_hgdiobj; + + DECLARE_NO_COPY_CLASS(SelectInHDC) +}; + +// a class which cleans up any GDI object +class AutoGDIObject +{ +protected: + AutoGDIObject() { m_gdiobj = NULL; } + AutoGDIObject(HGDIOBJ gdiobj) : m_gdiobj(gdiobj) { } + ~AutoGDIObject() { if ( m_gdiobj ) ::DeleteObject(m_gdiobj); } + + void InitGdiobj(HGDIOBJ gdiobj) + { + wxASSERT_MSG( !m_gdiobj, _T("initializing twice?") ); + + m_gdiobj = gdiobj; + } + + HGDIOBJ GetObject() const { return m_gdiobj; } + +private: + HGDIOBJ m_gdiobj; +}; + +// TODO: all this asks for using a AutoHandler<T, CreateFunc> template... + +// a class for temporary brushes +class AutoHBRUSH : private AutoGDIObject +{ +public: + AutoHBRUSH(COLORREF col) + : AutoGDIObject(::CreateSolidBrush(col)) { } + + operator HBRUSH() const { return (HBRUSH)GetObject(); } +}; + +// a class for temporary fonts +class AutoHFONT : private AutoGDIObject +{ +private: +public: + AutoHFONT() + : AutoGDIObject() { } + + AutoHFONT(const LOGFONT& lf) + : AutoGDIObject(::CreateFontIndirect(&lf)) { } + + void Init(const LOGFONT& lf) { InitGdiobj(::CreateFontIndirect(&lf)); } + + operator HFONT() const { return (HFONT)GetObject(); } +}; + +// a class for temporary pens +class AutoHPEN : private AutoGDIObject +{ +public: + AutoHPEN(COLORREF col) + : AutoGDIObject(::CreatePen(PS_SOLID, 0, col)) { } + + operator HPEN() const { return (HPEN)GetObject(); } +}; + +// classes for temporary bitmaps +class AutoHBITMAP : private AutoGDIObject +{ +public: + AutoHBITMAP(HBITMAP hbmp) : AutoGDIObject(hbmp) { } + + operator HBITMAP() const { return (HBITMAP)GetObject(); } +}; + +class CompatibleBitmap : public AutoHBITMAP +{ +public: + CompatibleBitmap(HDC hdc, int w, int h) + : AutoHBITMAP(::CreateCompatibleBitmap(hdc, w, h)) + { + } +}; + +class MonoBitmap : public AutoHBITMAP +{ +public: + MonoBitmap(int w, int h) + : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, 0)) + { + } +}; + +// class automatically destroys the region object +class AutoHRGN : private AutoGDIObject +{ +public: + AutoHRGN(HRGN hrgn) : AutoGDIObject(hrgn) { } + + operator HRGN() const { return (HRGN)GetObject(); } +}; + +// class sets the specified clipping region during its life time +class HDCClipper +{ +public: + HDCClipper(HDC hdc, HRGN hrgn) + : m_hdc(hdc) + { + if ( !::SelectClipRgn(hdc, hrgn) ) + wxLogLastError(_T("SelectClipRgn")); + } + + ~HDCClipper() + { + ::SelectClipRgn(m_hdc, NULL); + } + +private: + HDC m_hdc; + + DECLARE_NO_COPY_CLASS(HDCClipper) +}; + +// set the given map mode for the life time of this object +// +// NB: SetMapMode() is not supported by CE so we also define a helper macro +// to avoid using it there +#ifdef __WXWINCE__ + #define wxCHANGE_HDC_MAP_MODE(hdc, mm) +#else // !__WXWINCE__ + class HDCMapModeChanger + { + public: + HDCMapModeChanger(HDC hdc, int mm) + : m_hdc(hdc) + { + m_modeOld = ::SetMapMode(hdc, mm); + if ( !m_modeOld ) + wxLogLastError(_T("SelectClipRgn")); + } + + ~HDCMapModeChanger() + { + if ( m_modeOld ) + ::SetMapMode(m_hdc, m_modeOld); + } + + private: + HDC m_hdc; + int m_modeOld; + + DECLARE_NO_COPY_CLASS(HDCMapModeChanger) + }; + + #define wxCHANGE_HDC_MAP_MODE(hdc, mm) \ + HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) +#endif // __WXWINCE__/!__WXWINCE__ + +// smart buffeer using GlobalAlloc/GlobalFree() +class GlobalPtr +{ +public: + // allocates a block of given size + GlobalPtr(size_t size, unsigned flags = GMEM_MOVEABLE) + { + m_hGlobal = ::GlobalAlloc(flags, size); + if ( !m_hGlobal ) + wxLogLastError(_T("GlobalAlloc")); + } + + ~GlobalPtr() + { + if ( m_hGlobal && ::GlobalFree(m_hGlobal) ) + wxLogLastError(_T("GlobalFree")); + } + + // implicit conversion + operator HGLOBAL() const { return m_hGlobal; } + +private: + HGLOBAL m_hGlobal; + + DECLARE_NO_COPY_CLASS(GlobalPtr) +}; + +// when working with global pointers (which is unfortunately still necessary +// sometimes, e.g. for clipboard) it is important to unlock them exactly as +// many times as we lock them which just asks for using a "smart lock" class +class GlobalPtrLock +{ +public: + GlobalPtrLock(HGLOBAL hGlobal) : m_hGlobal(hGlobal) + { + m_ptr = GlobalLock(hGlobal); + if ( !m_ptr ) + wxLogLastError(_T("GlobalLock")); + } + + ~GlobalPtrLock() + { + if ( !GlobalUnlock(m_hGlobal) ) + { +#ifdef __WXDEBUG__ + // this might happen simply because the block became unlocked + DWORD dwLastError = ::GetLastError(); + if ( dwLastError != NO_ERROR ) + { + wxLogApiError(_T("GlobalUnlock"), dwLastError); + } +#endif // __WXDEBUG__ + } + } + + operator void *() const { return m_ptr; } + +private: + HGLOBAL m_hGlobal; + void *m_ptr; + + DECLARE_NO_COPY_CLASS(GlobalPtrLock) +}; + +// register the class when it is first needed and unregister it in dtor +class ClassRegistrar +{ +public: + // ctor doesn't register the class, call Initialize() for this + ClassRegistrar() { m_registered = -1; } + + // return true if the class is already registered + bool IsInitialized() const { return m_registered != -1; } + + // return true if the class had been already registered + bool IsRegistered() const { return m_registered == 1; } + + // try to register the class if not done yet, return true on success + bool Register(const WNDCLASS& wc) + { + // we should only be called if we hadn't been initialized yet + wxASSERT_MSG( m_registered == -1, + _T("calling ClassRegistrar::Register() twice?") ); + + m_registered = ::RegisterClass(&wc) ? 1 : 0; + if ( !IsRegistered() ) + { + wxLogLastError(_T("RegisterClassEx()")); + } + else + { + m_clsname = wc.lpszClassName; + } + + return m_registered == 1; + } + + // get the name of the registered class (returns empty string if not + // registered) + const wxString& GetName() const { return m_clsname; } + + // unregister the class if it had been registered + ~ClassRegistrar() + { + if ( IsRegistered() ) + { + if ( !::UnregisterClass(m_clsname, wxhInstance) ) + { + wxLogLastError(_T("UnregisterClass")); + } + } + } + +private: + // initial value is -1 which means that we hadn't tried registering the + // class yet, it becomes true or false (1 or 0) when Initialize() is called + int m_registered; + + // the name of the class, only non empty if it had been registered + wxString m_clsname; +}; + +// --------------------------------------------------------------------------- +// macros to make casting between WXFOO and FOO a bit easier: the GetFoo() +// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes +// an argument which should be a pointer or reference to the object of the +// corresponding class (this depends on the macro) +// --------------------------------------------------------------------------- + +#define GetHwnd() ((HWND)GetHWND()) +#define GetHwndOf(win) ((HWND)((win)->GetHWND())) +// old name +#define GetWinHwnd GetHwndOf + +#define GetHdc() ((HDC)GetHDC()) +#define GetHdcOf(dc) ((HDC)(dc).GetHDC()) + +#define GetHbitmap() ((HBITMAP)GetHBITMAP()) +#define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP()) + +#define GetHicon() ((HICON)GetHICON()) +#define GetHiconOf(icon) ((HICON)(icon).GetHICON()) + +#define GetHaccel() ((HACCEL)GetHACCEL()) +#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL())) + +#define GetHbrush() ((HBRUSH)GetResourceHandle()) +#define GetHbrushOf(brush) ((HBRUSH)(brush).GetResourceHandle()) + +#define GetHmenu() ((HMENU)GetHMenu()) +#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu()) + +#define GetHcursor() ((HCURSOR)GetHCURSOR()) +#define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) + +#define GetHfont() ((HFONT)GetHFONT()) +#define GetHfontOf(font) ((HFONT)(font).GetHFONT()) + +#define GetHimagelist() ((HIMAGELIST)GetHIMAGELIST()) +#define GetHimagelistOf(imgl) ((HIMAGELIST)imgl->GetHIMAGELIST()) + +#define GetHpalette() ((HPALETTE)GetHPALETTE()) +#define GetHpaletteOf(pal) ((HPALETTE)(pal).GetHPALETTE()) + +#define GetHpen() ((HPEN)GetResourceHandle()) +#define GetHpenOf(pen) ((HPEN)(pen).GetResourceHandle()) + +#define GetHrgn() ((HRGN)GetHRGN()) +#define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN()) + +#endif // wxUSE_GUI + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +extern "C" +{ + WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); +} + +WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); + +// return the full path of the given module +inline wxString wxGetFullModuleName(HMODULE hmod) +{ + wxString fullname; + if ( !::GetModuleFileName + ( + hmod, + wxStringBuffer(fullname, MAX_PATH), + MAX_PATH + ) ) + { + wxLogLastError(_T("GetModuleFileName")); + } + + return fullname; +} + +// return the full path of the program file +inline wxString wxGetFullModuleName() +{ + return wxGetFullModuleName((HMODULE)wxGetInstance()); +} + +// return the run-time version of the OS in a format similar to +// WINVER/_WIN32_WINNT compile-time macros: +// +// 0x0300 Windows NT 3.51 +// 0x0400 Windows 95, NT4 +// 0x0410 Windows 98 +// 0x0500 Windows ME, 2000 +// 0x0501 Windows XP +// 0x0502 Windows 2003 +// 0x0600 Longhorn +// +// for the other Windows versions 0 is currently returned +enum wxWinVersion +{ + wxWinVersion_Unknown = 0, + + wxWinVersion_3 = 0x0300, + wxWinVersion_NT3 = wxWinVersion_3, + + wxWinVersion_4 = 0x0400, + wxWinVersion_95 = wxWinVersion_4, + wxWinVersion_NT4 = wxWinVersion_4, + wxWinVersion_98 = 0x0410, + + wxWinVersion_5 = 0x0500, + wxWinVersion_ME = wxWinVersion_5, + wxWinVersion_NT5 = wxWinVersion_5, + wxWinVersion_2000 = wxWinVersion_5, + wxWinVersion_XP = 0x0501, + wxWinVersion_2003 = 0x0502, + + wxWinVersion_6 = 0x0600, + wxWinVersion_NT6 = 0x0600 +}; + +WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); + +#if wxUSE_GUI + +// cursor stuff +extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp +extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp + +WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); +WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); +WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); +WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); + +WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); +WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); + +// Find maximum size of window/rectangle +extern WXDLLEXPORT void wxFindMaxSize(WXHWND hwnd, RECT *rect); + +// Safely get the window text (i.e. without using fixed size buffer) +extern WXDLLEXPORT wxString wxGetWindowText(WXHWND hWnd); + +// get the window class name +extern WXDLLEXPORT wxString wxGetWindowClass(WXHWND hWnd); + +// get the window id (should be unsigned, hence this is not wxWindowID which +// is, for mainly historical reasons, signed) +extern WXDLLEXPORT WXWORD wxGetWindowId(WXHWND hWnd); + +// check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are +// different +extern WXDLLEXPORT bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc); + +// Does this window style specify any border? +inline bool wxStyleHasBorder(long style) +{ + return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER | + wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; +} + +// ---------------------------------------------------------------------------- +// functions mapping HWND to wxWindow +// ---------------------------------------------------------------------------- + +// this function simply checks whether the given hWnd corresponds to a wxWindow +// and returns either that window if it does or NULL otherwise +extern WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); + +// find the window for HWND which is part of some wxWindow, i.e. unlike +// wxFindWinFromHandle() above it will also work for "sub controls" of a +// wxWindow. +// +// returns the wxWindow corresponding to the given HWND or NULL. +extern WXDLLEXPORT wxWindow *wxGetWindowFromHWND(WXHWND hwnd); + +// Get the size of an icon +extern WXDLLEXPORT wxSize wxGetHiconSize(HICON hicon); + +// Lines are drawn differently for WinCE and regular WIN32 +WXDLLEXPORT void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2); + +// fill the client rect of the given window on the provided dc using this brush +inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr) +{ + RECT rc; + ::GetClientRect(hwnd, &rc); + ::FillRect(hdc, &rc, hbr); +} + +// ---------------------------------------------------------------------------- +// 32/64 bit helpers +// ---------------------------------------------------------------------------- + +#ifdef __WIN64__ + +inline void *wxGetWindowProc(HWND hwnd) +{ + return (void *)::GetWindowLongPtr(hwnd, GWLP_WNDPROC); +} + +inline void *wxGetWindowUserData(HWND hwnd) +{ + return (void *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); +} + +inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) +{ + return (WNDPROC)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func); +} + +inline void *wxSetWindowUserData(HWND hwnd, void *data) +{ + return (void *)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); +} + +#else // __WIN32__ + +// note that the casts to LONG_PTR here are required even on 32-bit machines +// for the 64-bit warning mode of later versions of MSVC (C4311/4312) +inline WNDPROC wxGetWindowProc(HWND hwnd) +{ + return (WNDPROC)(LONG_PTR)::GetWindowLong(hwnd, GWL_WNDPROC); +} + +inline void *wxGetWindowUserData(HWND hwnd) +{ + return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_USERDATA); +} + +inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) +{ + return (WNDPROC)(LONG_PTR)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)func); +} + +inline void *wxSetWindowUserData(HWND hwnd, void *data) +{ + return (void *)(LONG_PTR)::SetWindowLong(hwnd, GWL_USERDATA, (LONG_PTR)data); +} + +#endif // __WIN64__/__WIN32__ + +#endif // wxUSE_GUI + +#endif // _WX_PRIVATE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/radiobox.h b/Externals/wxWidgets/include/wx/msw/radiobox.h index 8012dd8b97..303876a464 100644 --- a/Externals/wxWidgets/include/wx/msw/radiobox.h +++ b/Externals/wxWidgets/include/wx/msw/radiobox.h @@ -1,175 +1,175 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/radiobox.h -// Purpose: wxRadioBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: radiobox.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBOX_H_ -#define _WX_RADIOBOX_H_ - -#include "wx/statbox.h" - -class WXDLLIMPEXP_FWD_CORE wxSubwindows; - -// ---------------------------------------------------------------------------- -// wxRadioBox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase -{ -public: - wxRadioBox() { Init(); } - - wxRadioBox(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, n, choices, majorDim, - style, val, name); - } - - wxRadioBox(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, choices, majorDim, - style, val, name); - } - - virtual ~wxRadioBox(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - - // implement the radiobox interface - virtual void SetSelection(int n); - virtual int GetSelection() const { return m_selectedButton; } - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& label); - virtual bool Enable(unsigned int n, bool enable = true); - virtual bool Show(unsigned int n, bool show = true); - virtual bool IsItemEnabled(unsigned int n) const; - virtual bool IsItemShown(unsigned int n) const; - virtual int GetItemFromPoint(const wxPoint& pt) const; - - // override some base class methods - virtual bool Show(bool show = true); - virtual bool Enable(bool enable = true); - virtual void SetFocus(); - virtual bool SetFont(const wxFont& font); - virtual bool ContainsHWND(WXHWND hWnd) const; -#if wxUSE_TOOLTIPS - virtual bool HasToolTips() const; -#endif // wxUSE_TOOLTIPS -#if wxUSE_HELP - // override virtual function with a platform-independent implementation - virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const - { - return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); - } -#endif // wxUSE_HELP - - virtual bool Reparent(wxWindowBase *newParent); - - // we inherit a version always returning false from wxStaticBox, override - // it to behave normally - virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } - - void SetLabelFont(const wxFont& WXUNUSED(font)) {} - void SetButtonFont(const wxFont& font) { SetFont(font); } - - // implementation only from now on - // ------------------------------- - - virtual bool MSWCommand(WXUINT param, WXWORD id); - void Command(wxCommandEvent& event); - - void SendNotificationEvent(); - -protected: - // common part of all ctors - void Init(); - - // subclass one radio button - void SubclassRadioButton(WXHWND hWndBtn); - - // get the max size of radio buttons - wxSize GetMaxButtonSize() const; - - // get the total size occupied by the radio box buttons - wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; - - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual wxSize DoGetBestSize() const; - -#if wxUSE_TOOLTIPS - virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip); -#endif - -#ifndef __WXWINCE__ - virtual WXHRGN MSWGetRegionWithoutChildren(); -#endif // __WXWINCE__ - - - // the buttons we contain - wxSubwindows *m_radioButtons; - - // array of widths and heights of the buttons, may be wxDefaultCoord if the - // corresponding quantity should be computed - int *m_radioWidth; - int *m_radioHeight; - - // currently selected button or wxNOT_FOUND if none - int m_selectedButton; - -private: - DECLARE_DYNAMIC_CLASS(wxRadioBox) - DECLARE_NO_COPY_CLASS(wxRadioBox) -}; - -#endif - // _WX_RADIOBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/radiobox.h +// Purpose: wxRadioBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: radiobox.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_ +#define _WX_RADIOBOX_H_ + +#include "wx/statbox.h" + +class WXDLLIMPEXP_FWD_CORE wxSubwindows; + +// ---------------------------------------------------------------------------- +// wxRadioBox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRadioBox : public wxStaticBox, public wxRadioBoxBase +{ +public: + wxRadioBox() { Init(); } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, n, choices, majorDim, + style, val, name); + } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, choices, majorDim, + style, val, name); + } + + virtual ~wxRadioBox(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + + // implement the radiobox interface + virtual void SetSelection(int n); + virtual int GetSelection() const { return m_selectedButton; } + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& label); + virtual bool Enable(unsigned int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; + virtual int GetItemFromPoint(const wxPoint& pt) const; + + // override some base class methods + virtual bool Show(bool show = true); + virtual bool Enable(bool enable = true); + virtual void SetFocus(); + virtual bool SetFont(const wxFont& font); + virtual bool ContainsHWND(WXHWND hWnd) const; +#if wxUSE_TOOLTIPS + virtual bool HasToolTips() const; +#endif // wxUSE_TOOLTIPS +#if wxUSE_HELP + // override virtual function with a platform-independent implementation + virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const + { + return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); + } +#endif // wxUSE_HELP + + virtual bool Reparent(wxWindowBase *newParent); + + // we inherit a version always returning false from wxStaticBox, override + // it to behave normally + virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } + + void SetLabelFont(const wxFont& WXUNUSED(font)) {} + void SetButtonFont(const wxFont& font) { SetFont(font); } + + // implementation only from now on + // ------------------------------- + + virtual bool MSWCommand(WXUINT param, WXWORD id); + void Command(wxCommandEvent& event); + + void SendNotificationEvent(); + +protected: + // common part of all ctors + void Init(); + + // subclass one radio button + void SubclassRadioButton(WXHWND hWndBtn); + + // get the max size of radio buttons + wxSize GetMaxButtonSize() const; + + // get the total size occupied by the radio box buttons + wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual wxSize DoGetBestSize() const; + +#if wxUSE_TOOLTIPS + virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip); +#endif + +#ifndef __WXWINCE__ + virtual WXHRGN MSWGetRegionWithoutChildren(); +#endif // __WXWINCE__ + + + // the buttons we contain + wxSubwindows *m_radioButtons; + + // array of widths and heights of the buttons, may be wxDefaultCoord if the + // corresponding quantity should be computed + int *m_radioWidth; + int *m_radioHeight; + + // currently selected button or wxNOT_FOUND if none + int m_selectedButton; + +private: + DECLARE_DYNAMIC_CLASS(wxRadioBox) + DECLARE_NO_COPY_CLASS(wxRadioBox) +}; + +#endif + // _WX_RADIOBOX_H_ diff --git a/Externals/wxWidgets/include/wx/msw/radiobut.h b/Externals/wxWidgets/include/wx/msw/radiobut.h index 6e48bf3f37..4a6e86e450 100644 --- a/Externals/wxWidgets/include/wx/msw/radiobut.h +++ b/Externals/wxWidgets/include/wx/msw/radiobut.h @@ -1,70 +1,70 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: radiobut.h -// Purpose: wxRadioButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: radiobut.h 41144 2006-09-10 23:08:13Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBUT_H_ -#define _WX_RADIOBUT_H_ - -class WXDLLEXPORT wxRadioButton: public wxControl -{ -public: - // ctors and creation functions - wxRadioButton() { Init(); } - - wxRadioButton(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr); - - // implement the radio button interface - virtual void SetValue(bool value); - virtual bool GetValue() const; - - // implementation only from now on - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void Command(wxCommandEvent& event); - virtual bool HasTransparentBackground() { return true; } - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - -private: - // common part of all ctors - void Init(); - - // we need to store the state internally as the result of GetValue() - // sometimes gets out of sync in WM_COMMAND handler - bool m_isChecked; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton) -}; - -#endif - // _WX_RADIOBUT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobut.h +// Purpose: wxRadioButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: radiobut.h 41144 2006-09-10 23:08:13Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_ +#define _WX_RADIOBUT_H_ + +class WXDLLEXPORT wxRadioButton: public wxControl +{ +public: + // ctors and creation functions + wxRadioButton() { Init(); } + + wxRadioButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr); + + // implement the radio button interface + virtual void SetValue(bool value); + virtual bool GetValue() const; + + // implementation only from now on + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void Command(wxCommandEvent& event); + virtual bool HasTransparentBackground() { return true; } + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxSize DoGetBestSize() const; + +private: + // common part of all ctors + void Init(); + + // we need to store the state internally as the result of GetValue() + // sometimes gets out of sync in WM_COMMAND handler + bool m_isChecked; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton) +}; + +#endif + // _WX_RADIOBUT_H_ diff --git a/Externals/wxWidgets/include/wx/msw/rcdefs.h b/Externals/wxWidgets/include/wx/msw/rcdefs.h index f1b9aa465d..7d963d966a 100644 --- a/Externals/wxWidgets/include/wx/msw/rcdefs.h +++ b/Externals/wxWidgets/include/wx/msw/rcdefs.h @@ -1,15 +1,15 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/rcdefs.h -// Purpose: Fallback for the generated rcdefs.h under the lib directory -// Author: Mike Wetherell -// RCS-ID: $Id: rcdefs.h 36133 2005-11-08 22:49:46Z MW $ -// Copyright: (c) 2005 Mike Wetherell -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RCDEFS_H -#define _WX_RCDEFS_H - -#define WX_CPU_X86 - -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rcdefs.h +// Purpose: Fallback for the generated rcdefs.h under the lib directory +// Author: Mike Wetherell +// RCS-ID: $Id: rcdefs.h 36133 2005-11-08 22:49:46Z MW $ +// Copyright: (c) 2005 Mike Wetherell +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RCDEFS_H +#define _WX_RCDEFS_H + +#define WX_CPU_X86 + +#endif diff --git a/Externals/wxWidgets/include/wx/msw/regconf.h b/Externals/wxWidgets/include/wx/msw/regconf.h index a352a249a3..3fc7aec0f8 100644 --- a/Externals/wxWidgets/include/wx/msw/regconf.h +++ b/Externals/wxWidgets/include/wx/msw/regconf.h @@ -1,110 +1,110 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/regconf.h -// Purpose: Registry based implementation of wxConfigBase -// Author: Vadim Zeitlin -// Modified by: -// Created: 27.04.98 -// RCS-ID: $Id: regconf.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _REGCONF_H -#define _REGCONF_H - -#ifndef _REGISTRY_H - #include "wx/msw/registry.h" -#endif - -#include "wx/object.h" -#include "wx/confbase.h" - -// ---------------------------------------------------------------------------- -// wxRegConfig -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase -{ -public: - // ctor & dtor - // will store data in HKLM\appName and HKCU\appName - wxRegConfig(const wxString& appName = wxEmptyString, - const wxString& vendorName = wxEmptyString, - const wxString& localFilename = wxEmptyString, - const wxString& globalFilename = wxEmptyString, - long style = wxCONFIG_USE_GLOBAL_FILE); - - // dtor will save unsaved data - virtual ~wxRegConfig(){} - - // implement inherited pure virtual functions - // ------------------------------------------ - - // path management - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const { return m_strPath; } - - // entry/subgroup info - // enumerate all of them - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; - - // tests for existence - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; - virtual EntryType GetEntryType(const wxString& name) const; - - // get number of entries/subgroups in the current group, with or without - // it's subgroups - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; - - virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; } - - // rename - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - - // delete - virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& key); - virtual bool DeleteAll(); - -protected: - // opens the local key creating it if necessary and returns it - wxRegKey& LocalKey() const // must be const to be callable from const funcs - { - wxRegConfig* self = wxConstCast(this, wxRegConfig); - - if ( !m_keyLocal.IsOpened() ) - { - // create on demand - self->m_keyLocal.Create(); - } - - return self->m_keyLocal; - } - - // implement read/write methods - virtual bool DoReadString(const wxString& key, wxString *pStr) const; - virtual bool DoReadLong(const wxString& key, long *plResult) const; - - virtual bool DoWriteString(const wxString& key, const wxString& szValue); - virtual bool DoWriteLong(const wxString& key, long lValue); - -private: - // no copy ctor/assignment operator - wxRegConfig(const wxRegConfig&); - wxRegConfig& operator=(const wxRegConfig&); - - // these keys are opened during all lifetime of wxRegConfig object - wxRegKey m_keyLocalRoot, m_keyLocal, - m_keyGlobalRoot, m_keyGlobal; - - // current path (not '/' terminated) - wxString m_strPath; -}; - -#endif //_REGCONF_H +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/regconf.h +// Purpose: Registry based implementation of wxConfigBase +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.04.98 +// RCS-ID: $Id: regconf.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _REGCONF_H +#define _REGCONF_H + +#ifndef _REGISTRY_H + #include "wx/msw/registry.h" +#endif + +#include "wx/object.h" +#include "wx/confbase.h" + +// ---------------------------------------------------------------------------- +// wxRegConfig +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase +{ +public: + // ctor & dtor + // will store data in HKLM\appName and HKCU\appName + wxRegConfig(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = wxCONFIG_USE_GLOBAL_FILE); + + // dtor will save unsaved data + virtual ~wxRegConfig(){} + + // implement inherited pure virtual functions + // ------------------------------------------ + + // path management + virtual void SetPath(const wxString& strPath); + virtual const wxString& GetPath() const { return m_strPath; } + + // entry/subgroup info + // enumerate all of them + virtual bool GetFirstGroup(wxString& str, long& lIndex) const; + virtual bool GetNextGroup (wxString& str, long& lIndex) const; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const; + virtual bool GetNextEntry (wxString& str, long& lIndex) const; + + // tests for existence + virtual bool HasGroup(const wxString& strName) const; + virtual bool HasEntry(const wxString& strName) const; + virtual EntryType GetEntryType(const wxString& name) const; + + // get number of entries/subgroups in the current group, with or without + // it's subgroups + virtual size_t GetNumberOfEntries(bool bRecursive = false) const; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const; + + virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; } + + // rename + virtual bool RenameEntry(const wxString& oldName, const wxString& newName); + virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + + // delete + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); + virtual bool DeleteGroup(const wxString& key); + virtual bool DeleteAll(); + +protected: + // opens the local key creating it if necessary and returns it + wxRegKey& LocalKey() const // must be const to be callable from const funcs + { + wxRegConfig* self = wxConstCast(this, wxRegConfig); + + if ( !m_keyLocal.IsOpened() ) + { + // create on demand + self->m_keyLocal.Create(); + } + + return self->m_keyLocal; + } + + // implement read/write methods + virtual bool DoReadString(const wxString& key, wxString *pStr) const; + virtual bool DoReadLong(const wxString& key, long *plResult) const; + + virtual bool DoWriteString(const wxString& key, const wxString& szValue); + virtual bool DoWriteLong(const wxString& key, long lValue); + +private: + // no copy ctor/assignment operator + wxRegConfig(const wxRegConfig&); + wxRegConfig& operator=(const wxRegConfig&); + + // these keys are opened during all lifetime of wxRegConfig object + wxRegKey m_keyLocalRoot, m_keyLocal, + m_keyGlobalRoot, m_keyGlobal; + + // current path (not '/' terminated) + wxString m_strPath; +}; + +#endif //_REGCONF_H diff --git a/Externals/wxWidgets/include/wx/msw/region.h b/Externals/wxWidgets/include/wx/msw/region.h index ee1f60bf2b..8afd863fdf 100644 --- a/Externals/wxWidgets/include/wx/msw/region.h +++ b/Externals/wxWidgets/include/wx/msw/region.h @@ -1,102 +1,102 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/region.h -// Purpose: wxRegion class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: region.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1997-2002 wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_REGION_H_ -#define _WX_MSW_REGION_H_ - -class WXDLLEXPORT wxRegion : public wxRegionWithCombine -{ -public: - wxRegion(); - wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRegion(const wxRect& rect); - wxRegion(WXHRGN hRegion); // Hangs on to this region - wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); - wxRegion( const wxBitmap& bmp) - { - Union(bmp); - } - wxRegion( const wxBitmap& bmp, - const wxColour& transColour, int tolerance = 0) - { - Union(bmp, transColour, tolerance); - } - - virtual ~wxRegion(); - - // wxRegionBase methods - virtual void Clear(); - virtual bool IsEmpty() const; - - // Get internal region handle - WXHRGN GetHRGN() const; - -protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - virtual bool DoIsEqual(const wxRegion& region) const; - virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; - virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; - virtual wxRegionContain DoContainsRect(const wxRect& rect) const; - - virtual bool DoOffset(wxCoord x, wxCoord y); - virtual bool DoCombine(const wxRegion& region, wxRegionOp op); - - friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; - - DECLARE_DYNAMIC_CLASS(wxRegion) -}; - -class WXDLLEXPORT wxRegionIterator : public wxObject -{ -public: - wxRegionIterator() { Init(); } - wxRegionIterator(const wxRegion& region); - wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; } - - wxRegionIterator& operator=(const wxRegionIterator& ri); - - virtual ~wxRegionIterator(); - - void Reset() { m_current = 0; } - void Reset(const wxRegion& region); - - bool HaveRects() const { return (m_current < m_numRects); } - - operator bool () const { return HaveRects(); } - - wxRegionIterator& operator++(); - wxRegionIterator operator++(int); - - wxCoord GetX() const; - wxCoord GetY() const; - wxCoord GetW() const; - wxCoord GetWidth() const { return GetW(); } - wxCoord GetH() const; - wxCoord GetHeight() const { return GetH(); } - - wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); } - -private: - // common part of all ctors - void Init(); - - long m_current; - long m_numRects; - wxRegion m_region; - wxRect* m_rects; - - DECLARE_DYNAMIC_CLASS(wxRegionIterator) -}; - -#endif // _WX_MSW_REGION_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/region.h +// Purpose: wxRegion class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: region.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1997-2002 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_REGION_H_ +#define _WX_MSW_REGION_H_ + +class WXDLLEXPORT wxRegion : public wxRegionWithCombine +{ +public: + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(WXHRGN hRegion); // Hangs on to this region + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear(); + virtual bool IsEmpty() const; + + // Get internal region handle + WXHRGN GetHRGN() const; + +protected: + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoCombine(const wxRegion& region, wxRegionOp op); + + friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; + + DECLARE_DYNAMIC_CLASS(wxRegion) +}; + +class WXDLLEXPORT wxRegionIterator : public wxObject +{ +public: + wxRegionIterator() { Init(); } + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; } + + wxRegionIterator& operator=(const wxRegionIterator& ri); + + virtual ~wxRegionIterator(); + + void Reset() { m_current = 0; } + void Reset(const wxRegion& region); + + bool HaveRects() const { return (m_current < m_numRects); } + + operator bool () const { return HaveRects(); } + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + + wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); } + +private: + // common part of all ctors + void Init(); + + long m_current; + long m_numRects; + wxRegion m_region; + wxRect* m_rects; + + DECLARE_DYNAMIC_CLASS(wxRegionIterator) +}; + +#endif // _WX_MSW_REGION_H_ diff --git a/Externals/wxWidgets/include/wx/msw/registry.h b/Externals/wxWidgets/include/wx/msw/registry.h index 04758d2804..27783e9ce6 100644 --- a/Externals/wxWidgets/include/wx/msw/registry.h +++ b/Externals/wxWidgets/include/wx/msw/registry.h @@ -1,247 +1,247 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/registry.h -// Purpose: Registry classes and functions -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.04.1998 -// RCS-ID: $Id: registry.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_REGISTRY_H_ -#define _WX_MSW_REGISTRY_H_ - -class WXDLLIMPEXP_FWD_BASE wxOutputStream; - -// ---------------------------------------------------------------------------- -// class wxRegKey encapsulates window HKEY handle -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRegKey -{ -public: - // NB: do _not_ change the values of elements in these enumerations! - - // registry value types (with comments from winnt.h) - enum ValueType - { - Type_None, // No value type - Type_String, // Unicode nul terminated string - Type_Expand_String, // Unicode nul terminated string - // (with environment variable references) - Type_Binary, // Free form binary - Type_Dword, // 32-bit number - Type_Dword_little_endian // 32-bit number - = Type_Dword, // (same as Type_DWORD) - Type_Dword_big_endian, // 32-bit number - Type_Link, // Symbolic Link (unicode) - Type_Multi_String, // Multiple Unicode strings - Type_Resource_list, // Resource list in the resource map - Type_Full_resource_descriptor, // Resource list in the hardware description - Type_Resource_requirements_list // ??? - }; - - // predefined registry keys - enum StdKey - { - HKCR, // classes root - HKCU, // current user - HKLM, // local machine - HKUSR, // users - HKPD, // performance data (WinNT/2K only) - HKCC, // current config - HKDD, // dynamic data (Win95/98 only) - HKMAX - }; - - // access mode for the key - enum AccessMode - { - Read, // read-only - Write // read and write - }; - - // information about standard (predefined) registry keys - // number of standard keys - static const size_t nStdKeys; - // get the name of a standard key - static const wxChar *GetStdKeyName(size_t key); - // get the short name of a standard key - static const wxChar *GetStdKeyShortName(size_t key); - // get StdKey from root HKEY - static StdKey GetStdKeyFromHkey(WXHKEY hkey); - - // extacts the std key prefix from the string (return value) and - // leaves only the part after it (i.e. modifies the string passed!) - static StdKey ExtractKeyName(wxString& str); - - // ctors - // root key is set to HKCR (the only root key under Win16) - wxRegKey(); - // strKey is the full name of the key (i.e. starting with HKEY_xxx...) - wxRegKey(const wxString& strKey); - // strKey is the name of key under (standard key) keyParent - wxRegKey(StdKey keyParent, const wxString& strKey); - // strKey is the name of key under (previously created) keyParent - wxRegKey(const wxRegKey& keyParent, const wxString& strKey); - // dtor closes the key - ~wxRegKey(); - - // change key (closes the previously opened key if any) - // the name is absolute, i.e. should start with HKEY_xxx - void SetName(const wxString& strKey); - // the name is relative to the parent key - void SetName(StdKey keyParent, const wxString& strKey); - // the name is relative to the parent key - void SetName(const wxRegKey& keyParent, const wxString& strKey); - // hKey should be opened and will be closed in wxRegKey dtor - void SetHkey(WXHKEY hKey); - - // get infomation about the key - // get the (full) key name. Abbreviate std root keys if bShortPrefix. - wxString GetName(bool bShortPrefix = true) const; - // return true if the key exists - bool Exists() const; - // get the info about key (any number of these pointers may be NULL) - bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys - size_t *pnMaxKeyLen, // max len of subkey name - size_t *pnValues, // number of values - size_t *pnMaxValueLen) const; - // return true if the key is opened - bool IsOpened() const { return m_hKey != 0; } - // for "if ( !key ) wxLogError(...)" kind of expressions - operator bool() const { return m_dwLastError == 0; } - - // operations on the key itself - // explicitly open the key (will be automatically done by all functions - // which need the key to be opened if the key is not opened yet) - bool Open(AccessMode mode = Write); - // create the key: will fail if the key already exists and !bOkIfExists - bool Create(bool bOkIfExists = true); - // rename a value from old name to new one - bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew); - // rename the key - bool Rename(const wxChar *szNewName); - // copy value to another key possibly changing its name (by default it will - // remain the same) - bool CopyValue(const wxChar *szValue, wxRegKey& keyDst, - const wxChar *szNewName = NULL); - // copy the entire contents of the key recursively to another location - bool Copy(const wxChar *szNewName); - // same as Copy() but using a key and not the name - bool Copy(wxRegKey& keyDst); - // close the key (will be automatically done in dtor) - bool Close(); - - // deleting keys/values - // deletes this key and all of it's subkeys/values - bool DeleteSelf(); - // deletes the subkey with all of it's subkeys/values recursively - bool DeleteKey(const wxChar *szKey); - // deletes the named value (may be NULL to remove the default value) - bool DeleteValue(const wxChar *szValue); - - // access to values and subkeys - // get value type - ValueType GetValueType(const wxChar *szValue) const; - // returns true if the value contains a number (else it's some string) - bool IsNumericValue(const wxChar *szValue) const; - - // assignment operators set the default value of the key - wxRegKey& operator=(const wxString& strValue) - { SetValue(NULL, strValue); return *this; } - wxRegKey& operator=(long lValue) - { SetValue(NULL, lValue); return *this; } - - // query the default value of the key: implicitly or explicitly - wxString QueryDefaultValue() const; - operator wxString() const { return QueryDefaultValue(); } - - // named values - - // set the string value - bool SetValue(const wxChar *szValue, const wxString& strValue); - // retrieve the string value - bool QueryValue(const wxChar *szValue, wxString& strValue) const - { return QueryValue(szValue, strValue, false); } - // retrieve raw string value - bool QueryRawValue(const wxChar *szValue, wxString& strValue) const - { return QueryValue(szValue, strValue, true); } - // retrieve either raw or expanded string value - bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const; - - // set the numeric value - bool SetValue(const wxChar *szValue, long lValue); - // return the numeric value - bool QueryValue(const wxChar *szValue, long *plValue) const; - // set the binary value - bool SetValue(const wxChar *szValue, const wxMemoryBuffer& buf); - // return the binary value - bool QueryValue(const wxChar *szValue, wxMemoryBuffer& buf) const; - - // query existence of a key/value - // return true if value exists - bool HasValue(const wxChar *szKey) const; - // return true if given subkey exists - bool HasSubKey(const wxChar *szKey) const; - // return true if any subkeys exist - bool HasSubkeys() const; - // return true if any values exist - bool HasValues() const; - // return true if the key is empty (nothing under this key) - bool IsEmpty() const { return !HasSubkeys() && !HasValues(); } - - // enumerate values and subkeys - bool GetFirstValue(wxString& strValueName, long& lIndex); - bool GetNextValue (wxString& strValueName, long& lIndex) const; - - bool GetFirstKey (wxString& strKeyName , long& lIndex); - bool GetNextKey (wxString& strKeyName , long& lIndex) const; - - // export the contents of this key and all its subkeys to the given file - // (which won't be overwritten, it's an error if it already exists) - // - // note that we export the key in REGEDIT4 format, not RegSaveKey() binary - // format nor newer REGEDIT5 one - bool Export(const wxString& filename) const; - - // same as above but write to the given (opened) stream - bool Export(wxOutputStream& ostr) const; - - - // for wxRegConfig usage only: preallocate some memory for the name - void ReserveMemoryForName(size_t bytes) { m_strKey.reserve(bytes); } - -private: - // common part of all ctors - void Init() - { - m_hKey = (WXHKEY) NULL; - m_dwLastError = 0; - } - - // recursive helper for Export() - bool DoExport(wxOutputStream& ostr) const; - - // export a single value - bool DoExportValue(wxOutputStream& ostr, const wxString& name) const; - - // return the text representation (in REGEDIT4 format) of the value with the - // given name - wxString FormatValue(const wxString& name) const; - - - WXHKEY m_hKey, // our handle - m_hRootKey; // handle of the top key (i.e. StdKey) - wxString m_strKey; // key name (relative to m_hRootKey) - - AccessMode m_mode; // valid only if key is opened - long m_dwLastError; // last error (0 if none) - - - DECLARE_NO_COPY_CLASS(wxRegKey) -}; - -#endif // _WX_MSW_REGISTRY_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/registry.h +// Purpose: Registry classes and functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.04.1998 +// RCS-ID: $Id: registry.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_REGISTRY_H_ +#define _WX_MSW_REGISTRY_H_ + +class WXDLLIMPEXP_FWD_BASE wxOutputStream; + +// ---------------------------------------------------------------------------- +// class wxRegKey encapsulates window HKEY handle +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRegKey +{ +public: + // NB: do _not_ change the values of elements in these enumerations! + + // registry value types (with comments from winnt.h) + enum ValueType + { + Type_None, // No value type + Type_String, // Unicode nul terminated string + Type_Expand_String, // Unicode nul terminated string + // (with environment variable references) + Type_Binary, // Free form binary + Type_Dword, // 32-bit number + Type_Dword_little_endian // 32-bit number + = Type_Dword, // (same as Type_DWORD) + Type_Dword_big_endian, // 32-bit number + Type_Link, // Symbolic Link (unicode) + Type_Multi_String, // Multiple Unicode strings + Type_Resource_list, // Resource list in the resource map + Type_Full_resource_descriptor, // Resource list in the hardware description + Type_Resource_requirements_list // ??? + }; + + // predefined registry keys + enum StdKey + { + HKCR, // classes root + HKCU, // current user + HKLM, // local machine + HKUSR, // users + HKPD, // performance data (WinNT/2K only) + HKCC, // current config + HKDD, // dynamic data (Win95/98 only) + HKMAX + }; + + // access mode for the key + enum AccessMode + { + Read, // read-only + Write // read and write + }; + + // information about standard (predefined) registry keys + // number of standard keys + static const size_t nStdKeys; + // get the name of a standard key + static const wxChar *GetStdKeyName(size_t key); + // get the short name of a standard key + static const wxChar *GetStdKeyShortName(size_t key); + // get StdKey from root HKEY + static StdKey GetStdKeyFromHkey(WXHKEY hkey); + + // extacts the std key prefix from the string (return value) and + // leaves only the part after it (i.e. modifies the string passed!) + static StdKey ExtractKeyName(wxString& str); + + // ctors + // root key is set to HKCR (the only root key under Win16) + wxRegKey(); + // strKey is the full name of the key (i.e. starting with HKEY_xxx...) + wxRegKey(const wxString& strKey); + // strKey is the name of key under (standard key) keyParent + wxRegKey(StdKey keyParent, const wxString& strKey); + // strKey is the name of key under (previously created) keyParent + wxRegKey(const wxRegKey& keyParent, const wxString& strKey); + // dtor closes the key + ~wxRegKey(); + + // change key (closes the previously opened key if any) + // the name is absolute, i.e. should start with HKEY_xxx + void SetName(const wxString& strKey); + // the name is relative to the parent key + void SetName(StdKey keyParent, const wxString& strKey); + // the name is relative to the parent key + void SetName(const wxRegKey& keyParent, const wxString& strKey); + // hKey should be opened and will be closed in wxRegKey dtor + void SetHkey(WXHKEY hKey); + + // get infomation about the key + // get the (full) key name. Abbreviate std root keys if bShortPrefix. + wxString GetName(bool bShortPrefix = true) const; + // return true if the key exists + bool Exists() const; + // get the info about key (any number of these pointers may be NULL) + bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys + size_t *pnMaxKeyLen, // max len of subkey name + size_t *pnValues, // number of values + size_t *pnMaxValueLen) const; + // return true if the key is opened + bool IsOpened() const { return m_hKey != 0; } + // for "if ( !key ) wxLogError(...)" kind of expressions + operator bool() const { return m_dwLastError == 0; } + + // operations on the key itself + // explicitly open the key (will be automatically done by all functions + // which need the key to be opened if the key is not opened yet) + bool Open(AccessMode mode = Write); + // create the key: will fail if the key already exists and !bOkIfExists + bool Create(bool bOkIfExists = true); + // rename a value from old name to new one + bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew); + // rename the key + bool Rename(const wxChar *szNewName); + // copy value to another key possibly changing its name (by default it will + // remain the same) + bool CopyValue(const wxChar *szValue, wxRegKey& keyDst, + const wxChar *szNewName = NULL); + // copy the entire contents of the key recursively to another location + bool Copy(const wxChar *szNewName); + // same as Copy() but using a key and not the name + bool Copy(wxRegKey& keyDst); + // close the key (will be automatically done in dtor) + bool Close(); + + // deleting keys/values + // deletes this key and all of it's subkeys/values + bool DeleteSelf(); + // deletes the subkey with all of it's subkeys/values recursively + bool DeleteKey(const wxChar *szKey); + // deletes the named value (may be NULL to remove the default value) + bool DeleteValue(const wxChar *szValue); + + // access to values and subkeys + // get value type + ValueType GetValueType(const wxChar *szValue) const; + // returns true if the value contains a number (else it's some string) + bool IsNumericValue(const wxChar *szValue) const; + + // assignment operators set the default value of the key + wxRegKey& operator=(const wxString& strValue) + { SetValue(NULL, strValue); return *this; } + wxRegKey& operator=(long lValue) + { SetValue(NULL, lValue); return *this; } + + // query the default value of the key: implicitly or explicitly + wxString QueryDefaultValue() const; + operator wxString() const { return QueryDefaultValue(); } + + // named values + + // set the string value + bool SetValue(const wxChar *szValue, const wxString& strValue); + // retrieve the string value + bool QueryValue(const wxChar *szValue, wxString& strValue) const + { return QueryValue(szValue, strValue, false); } + // retrieve raw string value + bool QueryRawValue(const wxChar *szValue, wxString& strValue) const + { return QueryValue(szValue, strValue, true); } + // retrieve either raw or expanded string value + bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const; + + // set the numeric value + bool SetValue(const wxChar *szValue, long lValue); + // return the numeric value + bool QueryValue(const wxChar *szValue, long *plValue) const; + // set the binary value + bool SetValue(const wxChar *szValue, const wxMemoryBuffer& buf); + // return the binary value + bool QueryValue(const wxChar *szValue, wxMemoryBuffer& buf) const; + + // query existence of a key/value + // return true if value exists + bool HasValue(const wxChar *szKey) const; + // return true if given subkey exists + bool HasSubKey(const wxChar *szKey) const; + // return true if any subkeys exist + bool HasSubkeys() const; + // return true if any values exist + bool HasValues() const; + // return true if the key is empty (nothing under this key) + bool IsEmpty() const { return !HasSubkeys() && !HasValues(); } + + // enumerate values and subkeys + bool GetFirstValue(wxString& strValueName, long& lIndex); + bool GetNextValue (wxString& strValueName, long& lIndex) const; + + bool GetFirstKey (wxString& strKeyName , long& lIndex); + bool GetNextKey (wxString& strKeyName , long& lIndex) const; + + // export the contents of this key and all its subkeys to the given file + // (which won't be overwritten, it's an error if it already exists) + // + // note that we export the key in REGEDIT4 format, not RegSaveKey() binary + // format nor newer REGEDIT5 one + bool Export(const wxString& filename) const; + + // same as above but write to the given (opened) stream + bool Export(wxOutputStream& ostr) const; + + + // for wxRegConfig usage only: preallocate some memory for the name + void ReserveMemoryForName(size_t bytes) { m_strKey.reserve(bytes); } + +private: + // common part of all ctors + void Init() + { + m_hKey = (WXHKEY) NULL; + m_dwLastError = 0; + } + + // recursive helper for Export() + bool DoExport(wxOutputStream& ostr) const; + + // export a single value + bool DoExportValue(wxOutputStream& ostr, const wxString& name) const; + + // return the text representation (in REGEDIT4 format) of the value with the + // given name + wxString FormatValue(const wxString& name) const; + + + WXHKEY m_hKey, // our handle + m_hRootKey; // handle of the top key (i.e. StdKey) + wxString m_strKey; // key name (relative to m_hRootKey) + + AccessMode m_mode; // valid only if key is opened + long m_dwLastError; // last error (0 if none) + + + DECLARE_NO_COPY_CLASS(wxRegKey) +}; + +#endif // _WX_MSW_REGISTRY_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/scrolbar.h b/Externals/wxWidgets/include/wx/msw/scrolbar.h index bfe86c6a80..051e1049d8 100644 --- a/Externals/wxWidgets/include/wx/msw/scrolbar.h +++ b/Externals/wxWidgets/include/wx/msw/scrolbar.h @@ -1,72 +1,72 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: scrollbar.h -// Purpose: wxScrollBar class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: scrolbar.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCROLBAR_H_ -#define _WX_SCROLBAR_H_ - -// Scrollbar item -class WXDLLEXPORT wxScrollBar: public wxScrollBarBase -{ -public: - wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } - virtual ~wxScrollBar(); - - wxScrollBar(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - - int GetThumbPosition() const ; - int GetThumbSize() const { return m_pageSize; } - int GetPageSize() const { return m_viewSize; } - int GetRange() const { return m_objectSize; } - - virtual void SetThumbPosition(int viewStart); - virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, - bool refresh = true); - - // needed for RTTI - void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } - void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; } - void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } - - void Command(wxCommandEvent& event); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - // override wxControl version to not use solid background here - virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - - int m_pageSize; - int m_viewSize; - int m_objectSize; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar) -}; - -#endif - // _WX_SCROLBAR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: scrollbar.h +// Purpose: wxScrollBar class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: scrolbar.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_ +#define _WX_SCROLBAR_H_ + +// Scrollbar item +class WXDLLEXPORT wxScrollBar: public wxScrollBarBase +{ +public: + wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + virtual ~wxScrollBar(); + + wxScrollBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr); + + int GetThumbPosition() const ; + int GetThumbSize() const { return m_pageSize; } + int GetPageSize() const { return m_viewSize; } + int GetRange() const { return m_objectSize; } + + virtual void SetThumbPosition(int viewStart); + virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, + bool refresh = true); + + // needed for RTTI + void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } + void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; } + void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } + + void Command(wxCommandEvent& event); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + + // override wxControl version to not use solid background here + virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxSize DoGetBestSize() const; + + int m_pageSize; + int m_viewSize; + int m_objectSize; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar) +}; + +#endif + // _WX_SCROLBAR_H_ diff --git a/Externals/wxWidgets/include/wx/msw/seh.h b/Externals/wxWidgets/include/wx/msw/seh.h index 23053fab09..418df910e0 100644 --- a/Externals/wxWidgets/include/wx/msw/seh.h +++ b/Externals/wxWidgets/include/wx/msw/seh.h @@ -1,74 +1,74 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/seh.h -// Purpose: declarations for SEH (structured exceptions handling) support -// Author: Vadim Zeitlin -// Created: 2006-04-26 -// RCS-ID: $Id: seh.h 44451 2007-02-11 02:17:28Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_SEH_H_ -#define _WX_MSW_SEH_H_ - -#if wxUSE_ON_FATAL_EXCEPTION - - // the exception handler which should be called from the exception filter - // - // it calsl wxApp::OnFatalException() if possible - extern unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs); - - // helper macro for wxSEH_HANDLE -#if defined(__BORLANDC__) || (defined(__VISUALC__) && (__VISUALC__ <= 1200)) - // some compilers don't understand that this code is unreachable and warn - // about no value being returned from the function without it, so calm them - // down - #define wxSEH_DUMMY_RETURN(rc) return rc; -#else - #define wxSEH_DUMMY_RETURN(rc) -#endif - - // macros which allow to avoid many #if wxUSE_ON_FATAL_EXCEPTION in the code - // which uses them - #define wxSEH_TRY __try - #define wxSEH_IGNORE __except ( EXCEPTION_EXECUTE_HANDLER ) { } - #define wxSEH_HANDLE(rc) \ - __except ( wxGlobalSEHandler(GetExceptionInformation()) ) \ - { \ - /* use the same exit code as abort() */ \ - ::ExitProcess(3); \ - \ - wxSEH_DUMMY_RETURN(rc) \ - } - -#else // wxUSE_ON_FATAL_EXCEPTION - #define wxSEH_TRY - #define wxSEH_IGNORE - #define wxSEH_HANDLE(rc) -#endif // wxUSE_ON_FATAL_EXCEPTION - -#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) && !defined(__WXWINCE__) - #include <eh.h> - - // C++ exception to structured exceptions translator: we need it in order - // to prevent VC++ from "helpfully" translating structured exceptions (such - // as division by 0 or access violation) to C++ pseudo-exceptions - extern void wxSETranslator(unsigned int code, EXCEPTION_POINTERS *ep); - - // up to VC 7.1 this warning ("calling _set_se_translator() requires /EHa") - // is harmless and it's easier to suppress it than use different makefiles - // for VC5 and 6 (which don't support /EHa at all) and VC7 (which does - // accept it but it seems to change nothing for it anyhow) - #if __VISUALC__ <= 1310 - #pragma warning(disable: 4535) - #endif - - // note that the SE translator must be called wxSETranslator! - #define DisableAutomaticSETranslator() _set_se_translator(wxSETranslator) -#else // !__VISUALC__ - // the other compilers do nothing as stupid by default so nothing to do for - // them - #define DisableAutomaticSETranslator() -#endif // __VISUALC__/!__VISUALC__ - -#endif // _WX_MSW_SEH_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/seh.h +// Purpose: declarations for SEH (structured exceptions handling) support +// Author: Vadim Zeitlin +// Created: 2006-04-26 +// RCS-ID: $Id: seh.h 44451 2007-02-11 02:17:28Z VZ $ +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SEH_H_ +#define _WX_MSW_SEH_H_ + +#if wxUSE_ON_FATAL_EXCEPTION + + // the exception handler which should be called from the exception filter + // + // it calsl wxApp::OnFatalException() if possible + extern unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs); + + // helper macro for wxSEH_HANDLE +#if defined(__BORLANDC__) || (defined(__VISUALC__) && (__VISUALC__ <= 1200)) + // some compilers don't understand that this code is unreachable and warn + // about no value being returned from the function without it, so calm them + // down + #define wxSEH_DUMMY_RETURN(rc) return rc; +#else + #define wxSEH_DUMMY_RETURN(rc) +#endif + + // macros which allow to avoid many #if wxUSE_ON_FATAL_EXCEPTION in the code + // which uses them + #define wxSEH_TRY __try + #define wxSEH_IGNORE __except ( EXCEPTION_EXECUTE_HANDLER ) { } + #define wxSEH_HANDLE(rc) \ + __except ( wxGlobalSEHandler(GetExceptionInformation()) ) \ + { \ + /* use the same exit code as abort() */ \ + ::ExitProcess(3); \ + \ + wxSEH_DUMMY_RETURN(rc) \ + } + +#else // wxUSE_ON_FATAL_EXCEPTION + #define wxSEH_TRY + #define wxSEH_IGNORE + #define wxSEH_HANDLE(rc) +#endif // wxUSE_ON_FATAL_EXCEPTION + +#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) && !defined(__WXWINCE__) + #include <eh.h> + + // C++ exception to structured exceptions translator: we need it in order + // to prevent VC++ from "helpfully" translating structured exceptions (such + // as division by 0 or access violation) to C++ pseudo-exceptions + extern void wxSETranslator(unsigned int code, EXCEPTION_POINTERS *ep); + + // up to VC 7.1 this warning ("calling _set_se_translator() requires /EHa") + // is harmless and it's easier to suppress it than use different makefiles + // for VC5 and 6 (which don't support /EHa at all) and VC7 (which does + // accept it but it seems to change nothing for it anyhow) + #if __VISUALC__ <= 1310 + #pragma warning(disable: 4535) + #endif + + // note that the SE translator must be called wxSETranslator! + #define DisableAutomaticSETranslator() _set_se_translator(wxSETranslator) +#else // !__VISUALC__ + // the other compilers do nothing as stupid by default so nothing to do for + // them + #define DisableAutomaticSETranslator() +#endif // __VISUALC__/!__VISUALC__ + +#endif // _WX_MSW_SEH_H_ diff --git a/Externals/wxWidgets/include/wx/msw/setup.h b/Externals/wxWidgets/include/wx/msw/setup.h index dd3112dacd..5df4a4ec17 100644 --- a/Externals/wxWidgets/include/wx/msw/setup.h +++ b/Externals/wxWidgets/include/wx/msw/setup.h @@ -1,1349 +1,1349 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup0.h 51451 2008-01-29 23:11:55Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable the use of DIB's for wxBitmap to support -// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. -#define wxUSE_DIB_FOR_BITMAP 0 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmao data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile <richedit.h> -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to auto-adapt to MS Windows XP themes where possible -// (notably, wxNotebook pages) -#define wxUSE_UXTHEME_AUTO 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 - -// ---------------------------------------------------------------------------- -// obsolete settings -// ---------------------------------------------------------------------------- - -// NB: all settings in this section are obsolete and should not be used/changed -// at all, they will disappear - -// Define 1 to use bitmap messages. -#define wxUSE_BITMAP_MESSAGE 1 - -#endif // _WX_SETUP_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: setup0.h 51451 2008-01-29 23:11:55Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + +/* --- end common options --- */ + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode +// and want to run your programs under Windows 9x and not only NT/2000/XP. +// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note +// that you will have to modify the makefiles to include unicows.lib import +// library as the first library (see installation instructions in install.txt +// to learn how to do it when building the library or samples). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) +#ifndef wxUSE_UNICODE_MSLU + #define wxUSE_UNICODE_MSLU 0 +#endif + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmao data. +// +// Default is 1, set it to 0 only if you don't use wxImage neither +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 + +#endif // _WX_SETUP_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/setup0.h b/Externals/wxWidgets/include/wx/msw/setup0.h index dd3112dacd..5df4a4ec17 100644 --- a/Externals/wxWidgets/include/wx/msw/setup0.h +++ b/Externals/wxWidgets/include/wx/msw/setup0.h @@ -1,1349 +1,1349 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup0.h 51451 2008-01-29 23:11:55Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable the use of DIB's for wxBitmap to support -// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. -#define wxUSE_DIB_FOR_BITMAP 0 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmao data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile <richedit.h> -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to auto-adapt to MS Windows XP themes where possible -// (notably, wxNotebook pages) -#define wxUSE_UXTHEME_AUTO 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 - -// ---------------------------------------------------------------------------- -// obsolete settings -// ---------------------------------------------------------------------------- - -// NB: all settings in this section are obsolete and should not be used/changed -// at all, they will disappear - -// Define 1 to use bitmap messages. -#define wxUSE_BITMAP_MESSAGE 1 - -#endif // _WX_SETUP_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: setup0.h 51451 2008-01-29 23:11:55Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + +/* --- end common options --- */ + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode +// and want to run your programs under Windows 9x and not only NT/2000/XP. +// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note +// that you will have to modify the makefiles to include unicows.lib import +// library as the first library (see installation instructions in install.txt +// to learn how to do it when building the library or samples). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) +#ifndef wxUSE_UNICODE_MSLU + #define wxUSE_UNICODE_MSLU 0 +#endif + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmao data. +// +// Default is 1, set it to 0 only if you don't use wxImage neither +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 + +#endif // _WX_SETUP_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/setup_microwin.h b/Externals/wxWidgets/include/wx/msw/setup_microwin.h index fe95d6833e..eff9b63cfe 100644 --- a/Externals/wxWidgets/include/wx/msw/setup_microwin.h +++ b/Externals/wxWidgets/include/wx/msw/setup_microwin.h @@ -1,1179 +1,1179 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup_microwin.h 40766 2006-08-23 09:54:29Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -//#define WXWIN_OS_DESCRIPTION wxT("MicroWindows") - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. -// If migrating between versions, your dialogs may seem to shrink. -// -// Default is 1 -// -// Recommended setting: 0 (the new calculations are more correct!) -#define wxDIALOG_UNIT_COMPATIBILITY 1 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use normal memory operators. It's -// recommended to set this to 1, since you may well need to output an error log -// in a production version (or non-debugging beta). -// -// Default is 1. -// -// Recommended setting: 1 but see comment above -#define wxUSE_DEBUG_CONTEXT 1 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 1 -// -// Recommended setting: 1 but see comment in the beginning of this section -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 1 -// -// Recommended setting: 1 but see comment in the beginning of this section -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin -// -// Default is 1 -// -// Recommended setting: 1 but see comment in the beginning of this section -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#ifdef _MSC_VER - #define wxUSE_ON_FATAL_EXCEPTION 1 -#else - #define wxUSE_ON_FATAL_EXCEPTION 0 -#endif - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000 (Windows 9x -// doesn't support it and the programs compiled in Unicode mode will not run -// under 9x). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000) -#define wxUSE_UNICODE 0 - -// Set wxUSE_UNICODE_MSLU to 1 if you want to compile wxWidgets in Unicode mode -// and be able to run compiled apps under Windows 9x as well as NT/2000/XP. This -// setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/Articles/mslu_announce.asp). Note that you -// will have to modify the makefiles to include unicows.lib import library as the first -// library. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_UNICODE_MSLU 0 - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 0 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 0 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// This is ignored under Win16, threads are only supported under Win32. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 0 - -// If enabled (1), compiles wxWidgets streams classes -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1. If 0, use wxWin streams implementation. -#define wxUSE_STD_IOSTREAM 0 - -// Use serialization (requires utils/serialize) -#define wxUSE_SERIAL 0 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 0 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNLIB_CLASS. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 0 - -// Compile in wxLibrary class for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNAMIC_LOADER 0 - -#define wxUSE_DYNLIB_CLASS 0 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 0 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 0 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 0 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 0 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 0 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG. -#define wxUSE_ZLIB 0 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 0 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 0 - -// wxSound class -#define wxUSE_SOUND 0 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use QuickTime -// -// Default is 0 -// -// Recommended setting: 1 if you have the QT SDK installed and you need it, else 0 -#define wxUSE_QUICKTIME 0 - -// Use DirectShow -// -// Default is 0 -// -// Recommended setting: 1 if the DirectX 7 SDK is installed (highly recommended), else 0 -#define wxUSE_DIRECTSHOW 1 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is 1 -// -// Recommended setting: 1 (required by XRC) -#if wxUSE_XRC -# define wxUSE_XML 1 -#else -# define wxUSE_XML 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is not used currently by wxMSW -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 0 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 0 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 0 // requires wxButton -#define wxUSE_TREECTRL 0 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 0 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 0 -#define wxUSE_TOOLBAR_NATIVE 0 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used ot logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// Default is 1 -// -#define wxUSE_GRID 0 - -// wxProperty[Value/Form/List] classes, used by Dialog Editor -#define wxUSE_PROPSHEET 0 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 0 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 0 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 0 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 0 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 0 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 0 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 0 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 0 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 0 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 0 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 0 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 0 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 0 - -// number entry dialog -#define wxUSE_NUMBERDLG 0 - -// splash screen class -#define wxUSE_SPLASH 0 - -// wizards -#define wxUSE_WIZARDDLG 0 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 0 -#define wxUSE_ENH_METAFILE 0 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 0 - -// Set to 0 to disable MDI document/view architecture -#define wxUSE_MDI_ARCHITECTURE 0 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 0 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 0 - -// OpenGL canvas -#define wxUSE_GLCANVAS 0 - -// wxTreeLayout class -#define wxUSE_TREELAYOUT 0 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 0 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 0 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running (it is only available under Win32) -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 0 - -#define wxUSE_DRAGIMAGE 0 - -#define wxUSE_IPC 0 - // 0 for no interprocess comms -#define wxUSE_HELP 0 - // 0 for no help facility -#define wxUSE_MS_HTML_HELP 0 - // 0 for no MS HTML Help - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 0 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_XPM_IN_MSW 1 - // 0 for no XPM support in wxBitmap. - // Default is 1, as XPM is now fully - // supported this makes easier the issue - // of portable icons and bitmaps. - -#define wxUSE_IMAGE_LOADING_IN_MSW 0 - // Use dynamic DIB loading/saving code in utils/dib under MSW. -#define wxUSE_RESOURCE_LOADING_IN_MSW 0 - // Use dynamic icon/cursor loading/saving code - // under MSW. -#define wxUSE_WX_RESOURCES 0 - // Use .wxr resource mechanism (requires PrologIO library) - -#define wxUSE_MOUSEWHEEL 0 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 0 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream> -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 0 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 0 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 0 - -// Set to 1 for GIF format support -#define wxUSE_GIF 0 - -// Set to 1 for PNM format support -#define wxUSE_PNM 0 - -// Set to 1 for PCX format support -#define wxUSE_PCX 0 - -// Set to 1 for IFF format support -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 0 - -// Set this to 1 to use Microsoft CTL3D library for "3D-look" under Win16 or NT -// 3.x. This setting is ignored under Win9x and NT 4.0+. -// -// Default is 0 for (most) Win32 (systems), 1 for Win16 -// -// Recommended setting: same as default -#if defined(__WIN95__) -#define wxUSE_CTL3D 0 -#else -#define wxUSE_CTL3D 1 -#endif - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile <richedit.h> -#if defined(__WIN95__) && !defined(__WINE__) && !defined(__GNUWIN32_OLD__) -#define wxUSE_RICHEDIT 1 - -// TODO: This should be ifdef'ed for any compilers that don't support -// RichEdit 2.0 but do have RichEdit 1.0... -#define wxUSE_RICHEDIT2 1 - -#else -#define wxUSE_RICHEDIT 0 -#define wxUSE_RICHEDIT2 0 -#endif - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 0 - -// ---------------------------------------------------------------------------- -// obsolete settings -// ---------------------------------------------------------------------------- - -// NB: all settings in this section are obsolete and should not be used/changed -// at all, they will disappear - -// Define 1 to use bitmap messages. -#define wxUSE_BITMAP_MESSAGE 1 - -// If 1, enables provision of run-time type information. -// NOW MANDATORY: don't change. -#define wxUSE_DYNAMIC_CLASSES 1 - -// ---------------------------------------------------------------------------- -// disable the settings which don't work for some compilers -// ---------------------------------------------------------------------------- - -#ifndef wxUSE_NORLANDER_HEADERS -#if (defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) -# define wxUSE_NORLANDER_HEADERS 1 -#else -# define wxUSE_NORLANDER_HEADERS 0 -#endif -#endif - -#if defined(__GNUWIN32__) -// These don't work as expected for mingw32 and cygwin32 -#undef wxUSE_MEMORY_TRACING -#define wxUSE_MEMORY_TRACING 0 - -#undef wxUSE_GLOBAL_MEMORY_OPERATORS -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -#undef wxUSE_DEBUG_NEW_ALWAYS -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// Cygwin betas don't have wcslen -#if defined(__CYGWIN__) || defined(__CYGWIN32__) -# if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) -# undef wxUSE_WCHAR_T -# define wxUSE_WCHAR_T 0 -# endif -#endif - -#endif // __GNUWIN32__ - -// MFC duplicates these operators -#if wxUSE_MFC -#undef wxUSE_GLOBAL_MEMORY_OPERATORS -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -#undef wxUSE_DEBUG_NEW_ALWAYS -#define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif // wxUSE_MFC - -#if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) -// Can't use OLE drag and drop in Windows 3.1 because we don't know how -// to implement UUIDs -// GnuWin32 doesn't have appropriate headers for e.g. IUnknown. -#undef wxUSE_DRAG_AND_DROP -#define wxUSE_DRAG_AND_DROP 0 -#endif - -// Only WIN32 supports wxStatusBar95 -#if !defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR -#undef wxUSE_NATIVE_STATUSBAR -#define wxUSE_NATIVE_STATUSBAR 0 -#endif - -#if !wxUSE_OWNER_DRAWN -#undef wxUSE_CHECKLISTBOX -#define wxUSE_CHECKLISTBOX 0 -#endif - -// Salford C++ doesn't like some of the memory operator definitions -#ifdef __SALFORDC__ -#undef wxUSE_MEMORY_TRACING -#define wxUSE_MEMORY_TRACING 0 - -#undef wxUSE_GLOBAL_MEMORY_OPERATORS -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -#undef wxUSE_DEBUG_NEW_ALWAYS -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -#undef wxUSE_THREADS -#define wxUSE_THREADS 0 - -#undef wxUSE_OWNER_DRAWN -#define wxUSE_OWNER_DRAWN 0 -#endif // __SALFORDC__ - -// BC++/Win16 can't cope with the amount of data in resource.cpp -#if defined(__WIN16__) && defined(__BORLANDC__) -#undef wxUSE_WX_RESOURCES -#define wxUSE_WX_RESOURCES 0 - -#undef wxUSE_ODBC -#define wxUSE_ODBC 0 - -#undef wxUSE_NEW_GRID -#define wxUSE_NEW_GRID 0 -#endif - -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -// BC++ 4.0 can't compile JPEG library -#undef wxUSE_LIBJPEG -#define wxUSE_LIBJPEG 0 -#endif - -// wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode -#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) -#undef wxUSE_DEBUG_NEW_ALWAYS -#define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif - -#if defined(__WXMSW__) && defined(__WATCOMC__) -/* -#undef wxUSE_GLCANVAS -#define wxUSE_GLCANVAS 0 -*/ - -#undef wxUSE_WCHAR_T -#define wxUSE_WCHAR_T 0 -#endif - -#if defined(__WXMSW__) && !defined(__WIN32__) - -#undef wxUSE_SOCKETS -#define wxUSE_SOCKETS 0 - -#undef wxUSE_THREADS -#define wxUSE_THREADS 0 - -#undef wxUSE_TOOLTIPS -#define wxUSE_TOOLTIPS 0 - -#undef wxUSE_SPINCTRL -#define wxUSE_SPINCTRL 0 - -#undef wxUSE_SPINBTN -#define wxUSE_SPINBTN 0 - -#undef wxUSE_LIBPNG -#define wxUSE_LIBPNG 0 - -#undef wxUSE_LIBJPEG -#define wxUSE_LIBJPEG 0 - -#undef wxUSE_LIBTIFF -#define wxUSE_LIBTIFF 0 - -#undef wxUSE_GIF -#define wxUSE_GIF 0 - -#undef wxUSE_PNM -#define wxUSE_PNM 0 - -#undef wxUSE_PCX -#define wxUSE_PCX 0 - -#undef wxUSE_GLCANVAS -#define wxUSE_GLCANVAS 0 - -#undef wxUSE_MS_HTML_HELP -#define wxUSE_MS_HTML_HELP 0 - -#undef wxUSE_WCHAR_T -#define wxUSE_WCHAR_T 0 - -#endif // Win16 - -// ---------------------------------------------------------------------------- -// undef the things which don't make sense for wxBase build -// ---------------------------------------------------------------------------- - -#if !wxUSE_GUI - -#undef wxUSE_HTML -#define wxUSE_HTML 0 - -#endif // !wxUSE_GUI - -// ---------------------------------------------------------------------------- -// check the settings consistency: do it here to abort compilation immediately -// and not almost in the very end when the relevant file fails to compile and -// you need to modify setup.h and rebuild everything -// ---------------------------------------------------------------------------- - -#if wxUSE_DATETIME && !wxUSE_LONGLONG - #error wxDateTime requires wxLongLong -#endif - -#if wxUSE_TEXTFILE && !wxUSE_FILE - #error You cannot compile wxTextFile without wxFile -#endif - -#if wxUSE_FILESYSTEM && !wxUSE_STREAMS - #error You cannot compile virtual file systems without wxUSE_STREAMS -#endif - -#if wxUSE_HTML && !wxUSE_FILESYSTEM - #error You cannot compile wxHTML without virtual file systems -#endif - -// add more tests here... - -#endif - // _WX_SETUP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: setup_microwin.h 40766 2006-08-23 09:54:29Z VS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +//#define WXWIN_OS_DESCRIPTION wxT("MicroWindows") + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. +// If migrating between versions, your dialogs may seem to shrink. +// +// Default is 1 +// +// Recommended setting: 0 (the new calculations are more correct!) +#define wxDIALOG_UNIT_COMPATIBILITY 1 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use normal memory operators. It's +// recommended to set this to 1, since you may well need to output an error log +// in a production version (or non-debugging beta). +// +// Default is 1. +// +// Recommended setting: 1 but see comment above +#define wxUSE_DEBUG_CONTEXT 1 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 1 +// +// Recommended setting: 1 but see comment in the beginning of this section +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 1 +// +// Recommended setting: 1 but see comment in the beginning of this section +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin +// +// Default is 1 +// +// Recommended setting: 1 but see comment in the beginning of this section +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#ifdef _MSC_VER + #define wxUSE_ON_FATAL_EXCEPTION 1 +#else + #define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000 (Windows 9x +// doesn't support it and the programs compiled in Unicode mode will not run +// under 9x). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000) +#define wxUSE_UNICODE 0 + +// Set wxUSE_UNICODE_MSLU to 1 if you want to compile wxWidgets in Unicode mode +// and be able to run compiled apps under Windows 9x as well as NT/2000/XP. This +// setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/Articles/mslu_announce.asp). Note that you +// will have to modify the makefiles to include unicows.lib import library as the first +// library. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_UNICODE_MSLU 0 + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 0 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 0 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// This is ignored under Win16, threads are only supported under Win32. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 0 + +// If enabled (1), compiles wxWidgets streams classes +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1. If 0, use wxWin streams implementation. +#define wxUSE_STD_IOSTREAM 0 + +// Use serialization (requires utils/serialize) +#define wxUSE_SERIAL 0 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 0 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNLIB_CLASS. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 0 + +// Compile in wxLibrary class for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNAMIC_LOADER 0 + +#define wxUSE_DYNLIB_CLASS 0 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 0 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 0 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 0 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 0 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 0 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG. +#define wxUSE_ZLIB 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 0 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 0 + +// wxSound class +#define wxUSE_SOUND 0 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use QuickTime +// +// Default is 0 +// +// Recommended setting: 1 if you have the QT SDK installed and you need it, else 0 +#define wxUSE_QUICKTIME 0 + +// Use DirectShow +// +// Default is 0 +// +// Recommended setting: 1 if the DirectX 7 SDK is installed (highly recommended), else 0 +#define wxUSE_DIRECTSHOW 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#if wxUSE_XRC +# define wxUSE_XML 1 +#else +# define wxUSE_XML 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is not used currently by wxMSW +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 0 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 0 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 0 // requires wxButton +#define wxUSE_TREECTRL 0 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 0 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 0 +#define wxUSE_TOOLBAR_NATIVE 0 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// Default is 1 +// +#define wxUSE_GRID 0 + +// wxProperty[Value/Form/List] classes, used by Dialog Editor +#define wxUSE_PROPSHEET 0 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 0 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 0 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 0 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 0 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 0 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 0 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 0 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 0 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 0 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 0 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 0 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 0 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 0 + +// number entry dialog +#define wxUSE_NUMBERDLG 0 + +// splash screen class +#define wxUSE_SPLASH 0 + +// wizards +#define wxUSE_WIZARDDLG 0 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 0 +#define wxUSE_ENH_METAFILE 0 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 0 + +// Set to 0 to disable MDI document/view architecture +#define wxUSE_MDI_ARCHITECTURE 0 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 0 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 0 + +// OpenGL canvas +#define wxUSE_GLCANVAS 0 + +// wxTreeLayout class +#define wxUSE_TREELAYOUT 0 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 0 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 0 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 0 + +#define wxUSE_DRAGIMAGE 0 + +#define wxUSE_IPC 0 + // 0 for no interprocess comms +#define wxUSE_HELP 0 + // 0 for no help facility +#define wxUSE_MS_HTML_HELP 0 + // 0 for no MS HTML Help + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 0 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_XPM_IN_MSW 1 + // 0 for no XPM support in wxBitmap. + // Default is 1, as XPM is now fully + // supported this makes easier the issue + // of portable icons and bitmaps. + +#define wxUSE_IMAGE_LOADING_IN_MSW 0 + // Use dynamic DIB loading/saving code in utils/dib under MSW. +#define wxUSE_RESOURCE_LOADING_IN_MSW 0 + // Use dynamic icon/cursor loading/saving code + // under MSW. +#define wxUSE_WX_RESOURCES 0 + // Use .wxr resource mechanism (requires PrologIO library) + +#define wxUSE_MOUSEWHEEL 0 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 0 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream> +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 0 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 0 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 0 + +// Set to 1 for GIF format support +#define wxUSE_GIF 0 + +// Set to 1 for PNM format support +#define wxUSE_PNM 0 + +// Set to 1 for PCX format support +#define wxUSE_PCX 0 + +// Set to 1 for IFF format support +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 0 + +// Set this to 1 to use Microsoft CTL3D library for "3D-look" under Win16 or NT +// 3.x. This setting is ignored under Win9x and NT 4.0+. +// +// Default is 0 for (most) Win32 (systems), 1 for Win16 +// +// Recommended setting: same as default +#if defined(__WIN95__) +#define wxUSE_CTL3D 0 +#else +#define wxUSE_CTL3D 1 +#endif + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#if defined(__WIN95__) && !defined(__WINE__) && !defined(__GNUWIN32_OLD__) +#define wxUSE_RICHEDIT 1 + +// TODO: This should be ifdef'ed for any compilers that don't support +// RichEdit 2.0 but do have RichEdit 1.0... +#define wxUSE_RICHEDIT2 1 + +#else +#define wxUSE_RICHEDIT 0 +#define wxUSE_RICHEDIT2 0 +#endif + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 0 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 + +// If 1, enables provision of run-time type information. +// NOW MANDATORY: don't change. +#define wxUSE_DYNAMIC_CLASSES 1 + +// ---------------------------------------------------------------------------- +// disable the settings which don't work for some compilers +// ---------------------------------------------------------------------------- + +#ifndef wxUSE_NORLANDER_HEADERS +#if (defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) +# define wxUSE_NORLANDER_HEADERS 1 +#else +# define wxUSE_NORLANDER_HEADERS 0 +#endif +#endif + +#if defined(__GNUWIN32__) +// These don't work as expected for mingw32 and cygwin32 +#undef wxUSE_MEMORY_TRACING +#define wxUSE_MEMORY_TRACING 0 + +#undef wxUSE_GLOBAL_MEMORY_OPERATORS +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// Cygwin betas don't have wcslen +#if defined(__CYGWIN__) || defined(__CYGWIN32__) +# if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) +# undef wxUSE_WCHAR_T +# define wxUSE_WCHAR_T 0 +# endif +#endif + +#endif // __GNUWIN32__ + +// MFC duplicates these operators +#if wxUSE_MFC +#undef wxUSE_GLOBAL_MEMORY_OPERATORS +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif // wxUSE_MFC + +#if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) +// Can't use OLE drag and drop in Windows 3.1 because we don't know how +// to implement UUIDs +// GnuWin32 doesn't have appropriate headers for e.g. IUnknown. +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 +#endif + +// Only WIN32 supports wxStatusBar95 +#if !defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR +#undef wxUSE_NATIVE_STATUSBAR +#define wxUSE_NATIVE_STATUSBAR 0 +#endif + +#if !wxUSE_OWNER_DRAWN +#undef wxUSE_CHECKLISTBOX +#define wxUSE_CHECKLISTBOX 0 +#endif + +// Salford C++ doesn't like some of the memory operator definitions +#ifdef __SALFORDC__ +#undef wxUSE_MEMORY_TRACING +#define wxUSE_MEMORY_TRACING 0 + +#undef wxUSE_GLOBAL_MEMORY_OPERATORS +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +#undef wxUSE_THREADS +#define wxUSE_THREADS 0 + +#undef wxUSE_OWNER_DRAWN +#define wxUSE_OWNER_DRAWN 0 +#endif // __SALFORDC__ + +// BC++/Win16 can't cope with the amount of data in resource.cpp +#if defined(__WIN16__) && defined(__BORLANDC__) +#undef wxUSE_WX_RESOURCES +#define wxUSE_WX_RESOURCES 0 + +#undef wxUSE_ODBC +#define wxUSE_ODBC 0 + +#undef wxUSE_NEW_GRID +#define wxUSE_NEW_GRID 0 +#endif + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) +// BC++ 4.0 can't compile JPEG library +#undef wxUSE_LIBJPEG +#define wxUSE_LIBJPEG 0 +#endif + +// wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode +#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +#if defined(__WXMSW__) && defined(__WATCOMC__) +/* +#undef wxUSE_GLCANVAS +#define wxUSE_GLCANVAS 0 +*/ + +#undef wxUSE_WCHAR_T +#define wxUSE_WCHAR_T 0 +#endif + +#if defined(__WXMSW__) && !defined(__WIN32__) + +#undef wxUSE_SOCKETS +#define wxUSE_SOCKETS 0 + +#undef wxUSE_THREADS +#define wxUSE_THREADS 0 + +#undef wxUSE_TOOLTIPS +#define wxUSE_TOOLTIPS 0 + +#undef wxUSE_SPINCTRL +#define wxUSE_SPINCTRL 0 + +#undef wxUSE_SPINBTN +#define wxUSE_SPINBTN 0 + +#undef wxUSE_LIBPNG +#define wxUSE_LIBPNG 0 + +#undef wxUSE_LIBJPEG +#define wxUSE_LIBJPEG 0 + +#undef wxUSE_LIBTIFF +#define wxUSE_LIBTIFF 0 + +#undef wxUSE_GIF +#define wxUSE_GIF 0 + +#undef wxUSE_PNM +#define wxUSE_PNM 0 + +#undef wxUSE_PCX +#define wxUSE_PCX 0 + +#undef wxUSE_GLCANVAS +#define wxUSE_GLCANVAS 0 + +#undef wxUSE_MS_HTML_HELP +#define wxUSE_MS_HTML_HELP 0 + +#undef wxUSE_WCHAR_T +#define wxUSE_WCHAR_T 0 + +#endif // Win16 + +// ---------------------------------------------------------------------------- +// undef the things which don't make sense for wxBase build +// ---------------------------------------------------------------------------- + +#if !wxUSE_GUI + +#undef wxUSE_HTML +#define wxUSE_HTML 0 + +#endif // !wxUSE_GUI + +// ---------------------------------------------------------------------------- +// check the settings consistency: do it here to abort compilation immediately +// and not almost in the very end when the relevant file fails to compile and +// you need to modify setup.h and rebuild everything +// ---------------------------------------------------------------------------- + +#if wxUSE_DATETIME && !wxUSE_LONGLONG + #error wxDateTime requires wxLongLong +#endif + +#if wxUSE_TEXTFILE && !wxUSE_FILE + #error You cannot compile wxTextFile without wxFile +#endif + +#if wxUSE_FILESYSTEM && !wxUSE_STREAMS + #error You cannot compile virtual file systems without wxUSE_STREAMS +#endif + +#if wxUSE_HTML && !wxUSE_FILESYSTEM + #error You cannot compile wxHTML without virtual file systems +#endif + +// add more tests here... + +#endif + // _WX_SETUP_H_ diff --git a/Externals/wxWidgets/include/wx/msw/slider95.h b/Externals/wxWidgets/include/wx/msw/slider95.h index c81f9f1091..55415c789b 100644 --- a/Externals/wxWidgets/include/wx/msw/slider95.h +++ b/Externals/wxWidgets/include/wx/msw/slider95.h @@ -1,137 +1,137 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/slider95.h -// Purpose: wxSlider class, using the Win95 (and later) trackbar control -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: slider95.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SLIDER95_H_ -#define _WX_SLIDER95_H_ - -class WXDLLIMPEXP_FWD_CORE wxSubwindows; - -// Slider -class WXDLLEXPORT wxSlider : public wxSliderBase -{ -public: - wxSlider() { Init(); } - - wxSlider(wxWindow *parent, - wxWindowID id, - int value, - int minValue, - int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Init(); - - (void)Create(parent, id, value, minValue, maxValue, - pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int value, - int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - virtual ~wxSlider(); - - // slider methods - virtual int GetValue() const; - virtual void SetValue(int); - - void SetRange(int minValue, int maxValue); - - int GetMin() const { return m_rangeMin; } - int GetMax() const { return m_rangeMax; } - - // Win32-specific slider methods - void SetTickFreq(int n, int pos); - int GetTickFreq() const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize() const; - void ClearSel(); - void ClearTicks(); - void SetLineSize(int lineSize); - int GetLineSize() const; - int GetSelEnd() const; - int GetSelStart() const; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len); - int GetThumbLength() const; - void SetTick(int tickPos); - - // implementation only from now on - WXHWND GetStaticMin() const; - WXHWND GetStaticMax() const; - WXHWND GetEditValue() const; - virtual bool ContainsHWND(WXHWND hWnd) const; - - // we should let background show through the slider (and its labels) - virtual bool HasTransparentBackground() { return true; } - - - void Command(wxCommandEvent& event); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - virtual bool Show(bool show = true); - virtual bool Enable(bool show = true); - virtual bool SetFont(const wxFont& font); - - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // common part of all ctors - void Init(); - - // format an integer value as string - static wxString Format(int n) { return wxString::Format(_T("%d"), n); } - - // get the boundig box for the slider and possible labels - wxRect GetBoundingBox() const; - - // get the height and, if the pointer is not NULL, width of our labels - int GetLabelsSize(int *width = NULL) const; - - - // overridden base class virtuals - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - - // the labels windows, if any - wxSubwindows *m_labels; - - int m_rangeMin; - int m_rangeMax; - int m_pageSize; - int m_lineSize; - int m_tickFreq; - - // flag needed to detect whether we're getting THUMBRELEASE event because - // of dragging the thumb or scrolling the mouse wheel - bool m_isDragging; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) -}; - -#endif // _WX_SLIDER95_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/slider95.h +// Purpose: wxSlider class, using the Win95 (and later) trackbar control +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: slider95.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER95_H_ +#define _WX_SLIDER95_H_ + +class WXDLLIMPEXP_FWD_CORE wxSubwindows; + +// Slider +class WXDLLEXPORT wxSlider : public wxSliderBase +{ +public: + wxSlider() { Init(); } + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, + int minValue, + int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr) + { + Init(); + + (void)Create(parent, id, value, minValue, maxValue, + pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int value, + int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + virtual ~wxSlider(); + + // slider methods + virtual int GetValue() const; + virtual void SetValue(int); + + void SetRange(int minValue, int maxValue); + + int GetMin() const { return m_rangeMin; } + int GetMax() const { return m_rangeMax; } + + // Win32-specific slider methods + void SetTickFreq(int n, int pos); + int GetTickFreq() const { return m_tickFreq; } + void SetPageSize(int pageSize); + int GetPageSize() const; + void ClearSel(); + void ClearTicks(); + void SetLineSize(int lineSize); + int GetLineSize() const; + int GetSelEnd() const; + int GetSelStart() const; + void SetSelection(int minPos, int maxPos); + void SetThumbLength(int len); + int GetThumbLength() const; + void SetTick(int tickPos); + + // implementation only from now on + WXHWND GetStaticMin() const; + WXHWND GetStaticMax() const; + WXHWND GetEditValue() const; + virtual bool ContainsHWND(WXHWND hWnd) const; + + // we should let background show through the slider (and its labels) + virtual bool HasTransparentBackground() { return true; } + + + void Command(wxCommandEvent& event); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + + virtual bool Show(bool show = true); + virtual bool Enable(bool show = true); + virtual bool SetFont(const wxFont& font); + + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + +protected: + // common part of all ctors + void Init(); + + // format an integer value as string + static wxString Format(int n) { return wxString::Format(_T("%d"), n); } + + // get the boundig box for the slider and possible labels + wxRect GetBoundingBox() const; + + // get the height and, if the pointer is not NULL, width of our labels + int GetLabelsSize(int *width = NULL) const; + + + // overridden base class virtuals + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + + // the labels windows, if any + wxSubwindows *m_labels; + + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + // flag needed to detect whether we're getting THUMBRELEASE event because + // of dragging the thumb or scrolling the mouse wheel + bool m_isDragging; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) +}; + +#endif // _WX_SLIDER95_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/sound.h b/Externals/wxWidgets/include/wx/msw/sound.h index f0ef42cae7..f1f52c9a2f 100644 --- a/Externals/wxWidgets/include/wx/msw/sound.h +++ b/Externals/wxWidgets/include/wx/msw/sound.h @@ -1,52 +1,52 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/sound.h -// Purpose: wxSound class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: sound.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SOUND_H_ -#define _WX_SOUND_H_ - -#if wxUSE_SOUND - -class WXDLLIMPEXP_ADV wxSound : public wxSoundBase -{ -public: - wxSound(); - wxSound(const wxString& fileName, bool isResource = false); - wxSound(int size, const wxByte* data); - virtual ~wxSound(); - - // Create from resource or file - bool Create(const wxString& fileName, bool isResource = false); - - // Create from data - bool Create(int size, const wxByte* data); - - bool IsOk() const { return m_data != NULL; } - - static void Stop(); - -protected: - void Init() { m_data = NULL; } - bool CheckCreatedOk(); - void Free(); - - virtual bool DoPlay(unsigned flags) const; - -private: - // data of this object - class wxSoundData *m_data; - - DECLARE_NO_COPY_CLASS(wxSound) -}; - -#endif // wxUSE_SOUND - -#endif // _WX_SOUND_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/sound.h +// Purpose: wxSound class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: sound.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#if wxUSE_SOUND + +class WXDLLIMPEXP_ADV wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = false); + wxSound(int size, const wxByte* data); + virtual ~wxSound(); + + // Create from resource or file + bool Create(const wxString& fileName, bool isResource = false); + + // Create from data + bool Create(int size, const wxByte* data); + + bool IsOk() const { return m_data != NULL; } + + static void Stop(); + +protected: + void Init() { m_data = NULL; } + bool CheckCreatedOk(); + void Free(); + + virtual bool DoPlay(unsigned flags) const; + +private: + // data of this object + class wxSoundData *m_data; + + DECLARE_NO_COPY_CLASS(wxSound) +}; + +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/spinbutt.h b/Externals/wxWidgets/include/wx/msw/spinbutt.h index dcfb0a3706..cf0bf62ccb 100644 --- a/Externals/wxWidgets/include/wx/msw/spinbutt.h +++ b/Externals/wxWidgets/include/wx/msw/spinbutt.h @@ -1,72 +1,72 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/spinbutt.h -// Purpose: wxSpinButton class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: spinbutt.h 41316 2006-09-20 14:15:14Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPINBUTT_H_ -#define _WX_SPINBUTT_H_ - -#include "wx/control.h" -#include "wx/event.h" - -#if wxUSE_SPINBTN - -class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase -{ -public: - // construction - wxSpinButton() { } - - wxSpinButton(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME) - { - Create(parent, id, pos, size, style, name); - } - - virtual ~wxSpinButton(); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME); - - - // accessors - virtual int GetValue() const; - virtual void SetValue(int val); - virtual void SetRange(int minVal, int maxVal); - - // implementation - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); - - // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can - virtual bool AcceptsFocus() const { return false; } - -protected: - virtual wxSize DoGetBestSize() const; - - // ensure that the control displays a value in the current range - virtual void NormalizeValue(); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton) -}; - -#endif // wxUSE_SPINBTN - -#endif // _WX_SPINBUTT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/spinbutt.h +// Purpose: wxSpinButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: spinbutt.h 41316 2006-09-20 14:15:14Z RR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_ +#define _WX_SPINBUTT_H_ + +#include "wx/control.h" +#include "wx/event.h" + +#if wxUSE_SPINBTN + +class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase +{ +public: + // construction + wxSpinButton() { } + + wxSpinButton(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME) + { + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSpinButton(); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME); + + + // accessors + virtual int GetValue() const; + virtual void SetValue(int val); + virtual void SetRange(int minVal, int maxVal); + + // implementation + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + + // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can + virtual bool AcceptsFocus() const { return false; } + +protected: + virtual wxSize DoGetBestSize() const; + + // ensure that the control displays a value in the current range + virtual void NormalizeValue(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton) +}; + +#endif // wxUSE_SPINBTN + +#endif // _WX_SPINBUTT_H_ diff --git a/Externals/wxWidgets/include/wx/msw/spinctrl.h b/Externals/wxWidgets/include/wx/msw/spinctrl.h index 08b6194504..04e0cb4622 100644 --- a/Externals/wxWidgets/include/wx/msw/spinctrl.h +++ b/Externals/wxWidgets/include/wx/msw/spinctrl.h @@ -1,142 +1,142 @@ -//////////////////////////////////////////////////////////////////////////// -// Name: msw/spinctrl.h -// Purpose: wxSpinCtrl class declaration for Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.07.99 -// RCS-ID: $Id: spinctrl.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_SPINCTRL_H_ -#define _WX_MSW_SPINCTRL_H_ - -#include "wx/spinbutt.h" // the base class - -#if wxUSE_SPINCTRL - -#include "wx/dynarray.h" - -class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; -WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); - -// ---------------------------------------------------------------------------- -// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call -// it) text window whose contents is automatically updated when the spin -// control is clicked. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinCtrl : public wxSpinButton -{ -public: - wxSpinCtrl() { } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")) - { - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS, - int min = 0, int max = 100, int initial = 0, - const wxString& name = _T("wxSpinCtrl")); - - // a wxTextCtrl-like method (but we can't have GetValue returning wxString - // because the base class already has one returning int!) - void SetValue(const wxString& text); - - // another wxTextCtrl-like method - void SetSelection(long from, long to); - - // implementation only from now on - // ------------------------------- - - virtual ~wxSpinCtrl(); - - virtual void SetValue(int val); - virtual int GetValue() const; - virtual bool SetFont(const wxFont &font); - virtual void SetFocus(); - - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - - virtual bool Reparent(wxWindowBase *newParent); - - // wxSpinButton doesn't accept focus, but we do - virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } - - // for internal use only - - // get the subclassed window proc of the buddy text - WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - - // return the spinctrl object whose buddy is the given window or NULL - static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); - - // process a WM_COMMAND generated by the buddy text control - bool ProcessTextCommand(WXWORD cmd, WXWORD id); - -protected: - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - virtual void DoGetSize(int *width, int *height) const; -#if wxABI_VERSION >= 20808 - virtual void DoGetClientSize(int *x, int *y) const; -#endif - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif // wxUSE_TOOLTIPS - - // the handler for wxSpinButton events - void OnSpinChange(wxSpinEvent& event); - - // handle processing of special keys - void OnChar(wxKeyEvent& event); - void OnSetFocus(wxFocusEvent& event); - void OnKillFocus(wxFocusEvent& event); - - // generate spin control update event with the given value - void SendSpinUpdate(int value); - - // called to ensure that the value is in the correct range - virtual void NormalizeValue(); - - - // the value of the control before the latest change (which might not have - // changed anything in fact -- this is why we need this field) - int m_oldValue; - - // the data for the "buddy" text ctrl - WXHWND m_hwndBuddy; - WXFARPROC m_wndProcBuddy; - - // all existing wxSpinCtrls - this allows to find the one corresponding to - // the given buddy window in GetSpinForTextCtrl() - static wxArraySpins ms_allSpins; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSpinCtrl) -}; - -#endif // wxUSE_SPINCTRL - -#endif // _WX_MSW_SPINCTRL_H_ - - +//////////////////////////////////////////////////////////////////////////// +// Name: msw/spinctrl.h +// Purpose: wxSpinCtrl class declaration for Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.07.99 +// RCS-ID: $Id: spinctrl.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SPINCTRL_H_ +#define _WX_MSW_SPINCTRL_H_ + +#include "wx/spinbutt.h" // the base class + +#if wxUSE_SPINCTRL + +#include "wx/dynarray.h" + +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); + +// ---------------------------------------------------------------------------- +// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call +// it) text window whose contents is automatically updated when the spin +// control is clicked. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSpinCtrl : public wxSpinButton +{ +public: + wxSpinCtrl() { } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")); + + // a wxTextCtrl-like method (but we can't have GetValue returning wxString + // because the base class already has one returning int!) + void SetValue(const wxString& text); + + // another wxTextCtrl-like method + void SetSelection(long from, long to); + + // implementation only from now on + // ------------------------------- + + virtual ~wxSpinCtrl(); + + virtual void SetValue(int val); + virtual int GetValue() const; + virtual bool SetFont(const wxFont &font); + virtual void SetFocus(); + + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + + virtual bool Reparent(wxWindowBase *newParent); + + // wxSpinButton doesn't accept focus, but we do + virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } + + // for internal use only + + // get the subclassed window proc of the buddy text + WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } + + // return the spinctrl object whose buddy is the given window or NULL + static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); + + // process a WM_COMMAND generated by the buddy text control + bool ProcessTextCommand(WXWORD cmd, WXWORD id); + +protected: + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *width, int *height) const; +#if wxABI_VERSION >= 20808 + virtual void DoGetClientSize(int *x, int *y) const; +#endif + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + + // the handler for wxSpinButton events + void OnSpinChange(wxSpinEvent& event); + + // handle processing of special keys + void OnChar(wxKeyEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + + // generate spin control update event with the given value + void SendSpinUpdate(int value); + + // called to ensure that the value is in the correct range + virtual void NormalizeValue(); + + + // the value of the control before the latest change (which might not have + // changed anything in fact -- this is why we need this field) + int m_oldValue; + + // the data for the "buddy" text ctrl + WXHWND m_hwndBuddy; + WXFARPROC m_wndProcBuddy; + + // all existing wxSpinCtrls - this allows to find the one corresponding to + // the given buddy window in GetSpinForTextCtrl() + static wxArraySpins ms_allSpins; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSpinCtrl) +}; + +#endif // wxUSE_SPINCTRL + +#endif // _WX_MSW_SPINCTRL_H_ + + diff --git a/Externals/wxWidgets/include/wx/msw/stackwalk.h b/Externals/wxWidgets/include/wx/msw/stackwalk.h index 2aeba90c59..1109a53dfe 100644 --- a/Externals/wxWidgets/include/wx/msw/stackwalk.h +++ b/Externals/wxWidgets/include/wx/msw/stackwalk.h @@ -1,103 +1,103 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/stackwalk.h -// Purpose: wxStackWalker for MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-08 -// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ -// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STACKWALK_H_ -#define _WX_MSW_STACKWALK_H_ - -#include "wx/arrstr.h" - -// these structs are declared in windows headers -struct _CONTEXT; -struct _EXCEPTION_POINTERS; - -// and these in dbghelp.h -struct _SYMBOL_INFO; - -// ---------------------------------------------------------------------------- -// wxStackFrame -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase -{ -private: - wxStackFrame *ConstCast() const - { return wx_const_cast(wxStackFrame *, this); } - - size_t DoGetParamCount() const { return m_paramTypes.GetCount(); } - -public: - wxStackFrame(size_t level, void *address, size_t addrFrame) - : wxStackFrameBase(level, address) - { - m_hasName = - m_hasLocation = false; - - m_addrFrame = addrFrame; - } - - virtual size_t GetParamCount() const - { - ConstCast()->OnGetParam(); - return DoGetParamCount(); - } - - virtual bool - GetParam(size_t n, wxString *type, wxString *name, wxString *value) const; - - // callback used by OnGetParam(), don't call directly - void OnParam(_SYMBOL_INFO *pSymInfo); - -protected: - virtual void OnGetName(); - virtual void OnGetLocation(); - - void OnGetParam(); - - - // helper for debug API: it wants to have addresses as DWORDs - size_t GetSymAddr() const - { - return wx_reinterpret_cast(size_t, m_address); - } - -private: - bool m_hasName, - m_hasLocation; - - size_t m_addrFrame; - - wxArrayString m_paramTypes, - m_paramNames, - m_paramValues; -}; - -// ---------------------------------------------------------------------------- -// wxStackWalker -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase -{ -public: - // we don't use ctor argument, it is for compatibility with Unix version - // only - wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } - - virtual void Walk(size_t skip = 1, size_t maxDepth = 200); - virtual void WalkFromException(); - - - // enumerate stack frames from the given context - void WalkFrom(const _CONTEXT *ctx, size_t skip = 1); - void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1); -}; - -#endif // _WX_MSW_STACKWALK_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/stackwalk.h +// Purpose: wxStackWalker for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-08 +// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STACKWALK_H_ +#define _WX_MSW_STACKWALK_H_ + +#include "wx/arrstr.h" + +// these structs are declared in windows headers +struct _CONTEXT; +struct _EXCEPTION_POINTERS; + +// and these in dbghelp.h +struct _SYMBOL_INFO; + +// ---------------------------------------------------------------------------- +// wxStackFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase +{ +private: + wxStackFrame *ConstCast() const + { return wx_const_cast(wxStackFrame *, this); } + + size_t DoGetParamCount() const { return m_paramTypes.GetCount(); } + +public: + wxStackFrame(size_t level, void *address, size_t addrFrame) + : wxStackFrameBase(level, address) + { + m_hasName = + m_hasLocation = false; + + m_addrFrame = addrFrame; + } + + virtual size_t GetParamCount() const + { + ConstCast()->OnGetParam(); + return DoGetParamCount(); + } + + virtual bool + GetParam(size_t n, wxString *type, wxString *name, wxString *value) const; + + // callback used by OnGetParam(), don't call directly + void OnParam(_SYMBOL_INFO *pSymInfo); + +protected: + virtual void OnGetName(); + virtual void OnGetLocation(); + + void OnGetParam(); + + + // helper for debug API: it wants to have addresses as DWORDs + size_t GetSymAddr() const + { + return wx_reinterpret_cast(size_t, m_address); + } + +private: + bool m_hasName, + m_hasLocation; + + size_t m_addrFrame; + + wxArrayString m_paramTypes, + m_paramNames, + m_paramValues; +}; + +// ---------------------------------------------------------------------------- +// wxStackWalker +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase +{ +public: + // we don't use ctor argument, it is for compatibility with Unix version + // only + wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } + + virtual void Walk(size_t skip = 1, size_t maxDepth = 200); + virtual void WalkFromException(); + + + // enumerate stack frames from the given context + void WalkFrom(const _CONTEXT *ctx, size_t skip = 1); + void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1); +}; + +#endif // _WX_MSW_STACKWALK_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/statbmp.h b/Externals/wxWidgets/include/wx/msw/statbmp.h index 99bc985955..914721053e 100644 --- a/Externals/wxWidgets/include/wx/msw/statbmp.h +++ b/Externals/wxWidgets/include/wx/msw/statbmp.h @@ -1,90 +1,90 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/statbmp.h -// Purpose: wxStaticBitmap class for wxMSW -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: statbmp.h 51824 2008-02-16 01:59:21Z SN $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBMP_H_ -#define _WX_STATBMP_H_ - -#include "wx/control.h" -#include "wx/icon.h" -#include "wx/bitmap.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; - -// a control showing an icon or a bitmap -class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase -{ -public: - wxStaticBitmap() { Init(); } - - wxStaticBitmap(wxWindow *parent, - wxWindowID id, - const wxGDIImage& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxGDIImage& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr); - - virtual ~wxStaticBitmap() { Free(); } - - virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); } - virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); } - virtual wxBitmap GetBitmap() const; - virtual wxIcon GetIcon() const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxBorder GetDefaultBorder() const; - virtual wxSize DoGetBestSize() const; - - // ctor/dtor helpers - void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; } - void Free(); - - // true if icon/bitmap is valid - bool ImageIsOk() const; - - void SetImage(const wxGDIImage* image); - void SetImageNoCopy( wxGDIImage* image ); - -#if wxABI_VERSION >= 20808 - // draw the bitmap ourselves here if the OS can't do it correctly (if it - // can we leave it to it) - void DoPaintManually(wxPaintEvent& event); -#endif - - // we can have either an icon or a bitmap - bool m_isIcon; - wxGDIImage *m_image; - - // handle used in last call to STM_SETIMAGE - WXHANDLE m_currentHandle; - -private: - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) - DECLARE_NO_COPY_CLASS(wxStaticBitmap) -}; - -#endif - // _WX_STATBMP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/statbmp.h +// Purpose: wxStaticBitmap class for wxMSW +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: statbmp.h 51824 2008-02-16 01:59:21Z SN $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#include "wx/control.h" +#include "wx/icon.h" +#include "wx/bitmap.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; + +// a control showing an icon or a bitmap +class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() { Init(); } + + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxGDIImage& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxGDIImage& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual ~wxStaticBitmap() { Free(); } + + virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); } + virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); } + virtual wxBitmap GetBitmap() const; + virtual wxIcon GetIcon() const; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxBorder GetDefaultBorder() const; + virtual wxSize DoGetBestSize() const; + + // ctor/dtor helpers + void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; } + void Free(); + + // true if icon/bitmap is valid + bool ImageIsOk() const; + + void SetImage(const wxGDIImage* image); + void SetImageNoCopy( wxGDIImage* image ); + +#if wxABI_VERSION >= 20808 + // draw the bitmap ourselves here if the OS can't do it correctly (if it + // can we leave it to it) + void DoPaintManually(wxPaintEvent& event); +#endif + + // we can have either an icon or a bitmap + bool m_isIcon; + wxGDIImage *m_image; + + // handle used in last call to STM_SETIMAGE + WXHANDLE m_currentHandle; + +private: + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + DECLARE_NO_COPY_CLASS(wxStaticBitmap) +}; + +#endif + // _WX_STATBMP_H_ diff --git a/Externals/wxWidgets/include/wx/msw/statbox.h b/Externals/wxWidgets/include/wx/msw/statbox.h index 99604516db..35c7d33003 100644 --- a/Externals/wxWidgets/include/wx/msw/statbox.h +++ b/Externals/wxWidgets/include/wx/msw/statbox.h @@ -1,73 +1,73 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/statbox.h -// Purpose: wxStaticBox class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STATBOX_H_ -#define _WX_MSW_STATBOX_H_ - -// Group box -class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase -{ -public: - wxStaticBox() { } - - wxStaticBox(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr); - - /// Implementation only - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - virtual wxSize DoGetBestSize() const; - - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - -#ifndef __WXWINCE__ -public: - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - -protected: - // return the region with all the windows inside this static box excluded - virtual WXHRGN MSWGetRegionWithoutChildren(); - - // remove the parts which are painted by static box itself from the given - // region which is embedded in a rectangle (0, 0)-(w, h) - virtual void MSWGetRegionWithoutSelf(WXHRGN hrgn, int w, int h); - - // paint the given rectangle with our background brush/colour - virtual void PaintBackground(wxDC& dc, const struct tagRECT& rc); - // paint the foreground of the static box - virtual void PaintForeground(wxDC& dc, const struct tagRECT& rc); - - void OnPaint(wxPaintEvent& event); -#endif // !__WXWINCE__ - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox) -}; - -#endif // _WX_MSW_STATBOX_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/statbox.h +// Purpose: wxStaticBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATBOX_H_ +#define _WX_MSW_STATBOX_H_ + +// Group box +class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox() { } + + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr); + + /// Implementation only + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + virtual wxSize DoGetBestSize() const; + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const; + +#ifndef __WXWINCE__ +public: + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + +protected: + // return the region with all the windows inside this static box excluded + virtual WXHRGN MSWGetRegionWithoutChildren(); + + // remove the parts which are painted by static box itself from the given + // region which is embedded in a rectangle (0, 0)-(w, h) + virtual void MSWGetRegionWithoutSelf(WXHRGN hrgn, int w, int h); + + // paint the given rectangle with our background brush/colour + virtual void PaintBackground(wxDC& dc, const struct tagRECT& rc); + // paint the foreground of the static box + virtual void PaintForeground(wxDC& dc, const struct tagRECT& rc); + + void OnPaint(wxPaintEvent& event); +#endif // !__WXWINCE__ + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox) +}; + +#endif // _WX_MSW_STATBOX_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/statbr95.h b/Externals/wxWidgets/include/wx/msw/statbr95.h index 3b7002d6f5..1e3155ad03 100644 --- a/Externals/wxWidgets/include/wx/msw/statbr95.h +++ b/Externals/wxWidgets/include/wx/msw/statbr95.h @@ -1,76 +1,76 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: msw/statbr95.h -// Purpose: native implementation of wxStatusBar -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.04.98 -// RCS-ID: $Id: statbr95.h 41035 2006-09-06 17:36:22Z PC $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _STATBR95_H -#define _STATBR95_H - -#if wxUSE_NATIVE_STATUSBAR - -class WXDLLEXPORT wxStatusBar95 : public wxStatusBarBase -{ -public: - // ctors and such - wxStatusBar95(); - wxStatusBar95(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr) - { - (void)Create(parent, id, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr); - - virtual ~wxStatusBar95(); - - // a status line can have several (<256) fields numbered from 0 - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - - // each field of status line has it's own text - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; - - // set status line fields' widths - virtual void SetStatusWidths(int n, const int widths_field[]); - - // set status line fields' styles - virtual void SetStatusStyles(int n, const int styles[]); - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height); - - // get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const; - - // get the border size - virtual int GetBorderX() const; - virtual int GetBorderY() const; - - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, - WXWPARAM wParam, - WXLPARAM lParam); -protected: - void CopyFieldsWidth(const int widths[]); - void SetFieldsWidth(); - - // override base class virtual - void DoMoveWindow(int x, int y, int width, int height); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar95) -}; - -#endif // wxUSE_NATIVE_STATUSBAR - -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/statbr95.h +// Purpose: native implementation of wxStatusBar +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.04.98 +// RCS-ID: $Id: statbr95.h 41035 2006-09-06 17:36:22Z PC $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _STATBR95_H +#define _STATBR95_H + +#if wxUSE_NATIVE_STATUSBAR + +class WXDLLEXPORT wxStatusBar95 : public wxStatusBarBase +{ +public: + // ctors and such + wxStatusBar95(); + wxStatusBar95(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr) + { + (void)Create(parent, id, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr); + + virtual ~wxStatusBar95(); + + // a status line can have several (<256) fields numbered from 0 + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + + // each field of status line has it's own text + virtual void SetStatusText(const wxString& text, int number = 0); + virtual wxString GetStatusText(int number = 0) const; + + // set status line fields' widths + virtual void SetStatusWidths(int n, const int widths_field[]); + + // set status line fields' styles + virtual void SetStatusStyles(int n, const int styles[]); + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height); + + // get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const; + + // get the border size + virtual int GetBorderX() const; + virtual int GetBorderY() const; + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam); +protected: + void CopyFieldsWidth(const int widths[]); + void SetFieldsWidth(); + + // override base class virtual + void DoMoveWindow(int x, int y, int width, int height); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar95) +}; + +#endif // wxUSE_NATIVE_STATUSBAR + +#endif diff --git a/Externals/wxWidgets/include/wx/msw/statline.h b/Externals/wxWidgets/include/wx/msw/statline.h index 7b7edf9306..cdbd933a5f 100644 --- a/Externals/wxWidgets/include/wx/msw/statline.h +++ b/Externals/wxWidgets/include/wx/msw/statline.h @@ -1,52 +1,52 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msw/statline.h -// Purpose: MSW version of wxStaticLine class -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STATLINE_H_ -#define _WX_MSW_STATLINE_H_ - -// ---------------------------------------------------------------------------- -// wxStaticLine -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticLine : public wxStaticLineBase -{ -public: - // constructors and pseudo-constructors - wxStaticLine() { } - - wxStaticLine( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ) - { - Create(parent, id, pos, size, style, name); - } - - bool Create( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ); - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - - // usually overridden base class virtuals - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine) -}; - -#endif // _WX_MSW_STATLINE_H_ - - +///////////////////////////////////////////////////////////////////////////// +// Name: msw/statline.h +// Purpose: MSW version of wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATLINE_H_ +#define _WX_MSW_STATLINE_H_ + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ); + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return false; } + + // usually overridden base class virtuals + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine) +}; + +#endif // _WX_MSW_STATLINE_H_ + + diff --git a/Externals/wxWidgets/include/wx/msw/stattext.h b/Externals/wxWidgets/include/wx/msw/stattext.h index 2338315cbf..e3e16595a0 100644 --- a/Externals/wxWidgets/include/wx/msw/stattext.h +++ b/Externals/wxWidgets/include/wx/msw/stattext.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/stattext.h -// Purpose: wxStaticText class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: stattext.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATTEXT_H_ -#define _WX_STATTEXT_H_ - -class WXDLLEXPORT wxStaticText : public wxStaticTextBase -{ -public: - wxStaticText() { } - - wxStaticText(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticTextNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticTextNameStr); - - // override some methods to resize the window properly - virtual void SetLabel(const wxString& label); - virtual bool SetFont( const wxFont &font ); - - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - // implement/override some base class virtuals - virtual wxBorder GetDefaultBorder() const; - virtual void DoSetSize(int x, int y, int w, int h, - int sizeFlags = wxSIZE_AUTO); - virtual wxSize DoGetBestSize() const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) -}; - -#endif - // _WX_STATTEXT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/stattext.h +// Purpose: wxStaticText class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: stattext.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_ +#define _WX_STATTEXT_H_ + +class WXDLLEXPORT wxStaticText : public wxStaticTextBase +{ +public: + wxStaticText() { } + + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticTextNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticTextNameStr); + + // override some methods to resize the window properly + virtual void SetLabel(const wxString& label); + virtual bool SetFont( const wxFont &font ); + + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + +protected: + // implement/override some base class virtuals + virtual wxBorder GetDefaultBorder() const; + virtual void DoSetSize(int x, int y, int w, int h, + int sizeFlags = wxSIZE_AUTO); + virtual wxSize DoGetBestSize() const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) +}; + +#endif + // _WX_STATTEXT_H_ diff --git a/Externals/wxWidgets/include/wx/msw/stdpaths.h b/Externals/wxWidgets/include/wx/msw/stdpaths.h index 55f8f2d98f..34cc778bb6 100644 --- a/Externals/wxWidgets/include/wx/msw/stdpaths.h +++ b/Externals/wxWidgets/include/wx/msw/stdpaths.h @@ -1,53 +1,53 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/stdpaths.h -// Purpose: wxStandardPaths for Win32 -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-19 -// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_STDPATHS_H_ -#define _WX_MSW_STDPATHS_H_ - -// ---------------------------------------------------------------------------- -// wxStandardPaths -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase -{ -public: - // implement base class pure virtuals - virtual wxString GetExecutablePath() const; - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; - virtual wxString GetDataDir() const; - virtual wxString GetUserDataDir() const; - virtual wxString GetUserLocalDataDir() const; - virtual wxString GetPluginsDir() const; - virtual wxString GetDocumentsDir() const; - -protected: - // get the path corresponding to the given standard CSIDL_XXX constant - static wxString DoGetDirectory(int csidl); - - // return the directory of the application itself - static wxString GetAppDir(); -}; - -// ---------------------------------------------------------------------------- -// wxStandardPathsWin16: this class is for internal use only -// ---------------------------------------------------------------------------- - -// override config file locations to be compatible with the values used by -// wxFileConfig (dating from Win16 days which explains the class name) -class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths -{ -public: - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; -}; - -#endif // _WX_MSW_STDPATHS_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/stdpaths.h +// Purpose: wxStandardPaths for Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-19 +// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STDPATHS_H_ +#define _WX_MSW_STDPATHS_H_ + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + // implement base class pure virtuals + virtual wxString GetExecutablePath() const; + virtual wxString GetConfigDir() const; + virtual wxString GetUserConfigDir() const; + virtual wxString GetDataDir() const; + virtual wxString GetUserDataDir() const; + virtual wxString GetUserLocalDataDir() const; + virtual wxString GetPluginsDir() const; + virtual wxString GetDocumentsDir() const; + +protected: + // get the path corresponding to the given standard CSIDL_XXX constant + static wxString DoGetDirectory(int csidl); + + // return the directory of the application itself + static wxString GetAppDir(); +}; + +// ---------------------------------------------------------------------------- +// wxStandardPathsWin16: this class is for internal use only +// ---------------------------------------------------------------------------- + +// override config file locations to be compatible with the values used by +// wxFileConfig (dating from Win16 days which explains the class name) +class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths +{ +public: + virtual wxString GetConfigDir() const; + virtual wxString GetUserConfigDir() const; +}; + +#endif // _WX_MSW_STDPATHS_H_ diff --git a/Externals/wxWidgets/include/wx/msw/subwin.h b/Externals/wxWidgets/include/wx/msw/subwin.h index 75f8dad6d0..709004ac90 100644 --- a/Externals/wxWidgets/include/wx/msw/subwin.h +++ b/Externals/wxWidgets/include/wx/msw/subwin.h @@ -1,195 +1,195 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/subwin.h -// Purpose: helper for implementing the controls with subwindows -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-12-11 -// RCS-ID: $Id: subwin.h 30981 2004-12-13 01:02:32Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_SUBWIN_H_ -#define _WX_MSW_SUBWIN_H_ - -#include "wx/msw/private.h" - -// ---------------------------------------------------------------------------- -// wxSubwindows contains all HWNDs making part of a single wx control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSubwindows -{ -public: - // the number of subwindows can be specified either as parameter to ctor or - // later in Create() - wxSubwindows(size_t n = 0) { Init(); if ( n ) Create(n); } - - // allocate enough space for the given number of windows - void Create(size_t n) - { - wxASSERT_MSG( !m_hwnds, _T("Create() called twice?") ); - - m_count = n; - m_hwnds = (HWND *)calloc(n, sizeof(HWND)); - } - - // non-virtual dtor, this class is not supposed to be used polymorphically - ~wxSubwindows() - { - for ( size_t n = 0; n < m_count; n++ ) - { - ::DestroyWindow(m_hwnds[n]); - } - - free(m_hwnds); - } - - // get the number of subwindows - size_t GetCount() const { return m_count; } - - // access a given window - HWND& Get(size_t n) - { - wxASSERT_MSG( n < m_count, _T("subwindow index out of range") ); - - return m_hwnds[n]; - } - - HWND& operator[](size_t n) { return Get(n); } - HWND operator[](size_t n) const - { - return wx_const_cast(wxSubwindows *, this)->Get(n); - } - - // check if we have this window - bool HasWindow(HWND hwnd) - { - for ( size_t n = 0; n < m_count; n++ ) - { - if ( m_hwnds[n] == hwnd ) - return true; - } - - return false; - } - - - // methods which are forwarded to all subwindows - // --------------------------------------------- - - // show/hide everything - void Show(bool show) - { - int sw = show ? SW_SHOW : SW_HIDE; - for ( size_t n = 0; n < m_count; n++ ) - { - ::ShowWindow(m_hwnds[n], sw); - } - } - - // enable/disable everything - void Enable(bool enable) - { - for ( size_t n = 0; n < m_count; n++ ) - { - ::EnableWindow(m_hwnds[n], enable); - } - } - - // set font for all windows - void SetFont(const wxFont& font) - { - HFONT hfont = GetHfontOf(font); - wxCHECK_RET( hfont, _T("invalid font") ); - - for ( size_t n = 0; n < m_count; n++ ) - { - ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); - - // otherwise the window might not be redrawn correctly - ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); - } - } - - // find the bounding box for all windows - wxRect GetBoundingBox() const - { - wxRect r; - for ( size_t n = 0; n < m_count; n++ ) - { - RECT rc; - ::GetWindowRect(m_hwnds[n], &rc); - - r.Union(wxRectFromRECT(rc)); - } - - return r; - } - -private: - void Init() - { - m_count = 0; - m_hwnds = NULL; - } - - // number of elements in m_hwnds array - size_t m_count; - - // the HWNDs we contain - HWND *m_hwnds; - - - DECLARE_NO_COPY_CLASS(wxSubwindows) -}; - -// convenient macro to forward a few methods which are usually propagated to -// subwindows to a wxSubwindows object -// -// parameters should be: -// - cname the name of the class implementing these methods -// - base the name of its base class -// - subwins the name of the member variable of type wxSubwindows * -#define WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(cname, base, subwins) \ - bool cname::ContainsHWND(WXHWND hWnd) const \ - { \ - return subwins && subwins->HasWindow((HWND)hWnd); \ - } \ - \ - bool cname::Show(bool show) \ - { \ - if ( !base::Show(show) ) \ - return false; \ - \ - if ( subwins ) \ - subwins->Show(show); \ - \ - return true; \ - } \ - \ - bool cname::Enable(bool enable) \ - { \ - if ( !base::Enable(enable) ) \ - return false; \ - \ - if ( subwins ) \ - subwins->Enable(enable); \ - \ - return true; \ - } \ - \ - bool cname::SetFont(const wxFont& font) \ - { \ - if ( !base::SetFont(font) ) \ - return false; \ - \ - if ( subwins ) \ - subwins->SetFont(font); \ - \ - return true; \ - } - - -#endif // _WX_MSW_SUBWIN_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/subwin.h +// Purpose: helper for implementing the controls with subwindows +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-12-11 +// RCS-ID: $Id: subwin.h 30981 2004-12-13 01:02:32Z VZ $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SUBWIN_H_ +#define _WX_MSW_SUBWIN_H_ + +#include "wx/msw/private.h" + +// ---------------------------------------------------------------------------- +// wxSubwindows contains all HWNDs making part of a single wx control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSubwindows +{ +public: + // the number of subwindows can be specified either as parameter to ctor or + // later in Create() + wxSubwindows(size_t n = 0) { Init(); if ( n ) Create(n); } + + // allocate enough space for the given number of windows + void Create(size_t n) + { + wxASSERT_MSG( !m_hwnds, _T("Create() called twice?") ); + + m_count = n; + m_hwnds = (HWND *)calloc(n, sizeof(HWND)); + } + + // non-virtual dtor, this class is not supposed to be used polymorphically + ~wxSubwindows() + { + for ( size_t n = 0; n < m_count; n++ ) + { + ::DestroyWindow(m_hwnds[n]); + } + + free(m_hwnds); + } + + // get the number of subwindows + size_t GetCount() const { return m_count; } + + // access a given window + HWND& Get(size_t n) + { + wxASSERT_MSG( n < m_count, _T("subwindow index out of range") ); + + return m_hwnds[n]; + } + + HWND& operator[](size_t n) { return Get(n); } + HWND operator[](size_t n) const + { + return wx_const_cast(wxSubwindows *, this)->Get(n); + } + + // check if we have this window + bool HasWindow(HWND hwnd) + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] == hwnd ) + return true; + } + + return false; + } + + + // methods which are forwarded to all subwindows + // --------------------------------------------- + + // show/hide everything + void Show(bool show) + { + int sw = show ? SW_SHOW : SW_HIDE; + for ( size_t n = 0; n < m_count; n++ ) + { + ::ShowWindow(m_hwnds[n], sw); + } + } + + // enable/disable everything + void Enable(bool enable) + { + for ( size_t n = 0; n < m_count; n++ ) + { + ::EnableWindow(m_hwnds[n], enable); + } + } + + // set font for all windows + void SetFont(const wxFont& font) + { + HFONT hfont = GetHfontOf(font); + wxCHECK_RET( hfont, _T("invalid font") ); + + for ( size_t n = 0; n < m_count; n++ ) + { + ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); + + // otherwise the window might not be redrawn correctly + ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + } + } + + // find the bounding box for all windows + wxRect GetBoundingBox() const + { + wxRect r; + for ( size_t n = 0; n < m_count; n++ ) + { + RECT rc; + ::GetWindowRect(m_hwnds[n], &rc); + + r.Union(wxRectFromRECT(rc)); + } + + return r; + } + +private: + void Init() + { + m_count = 0; + m_hwnds = NULL; + } + + // number of elements in m_hwnds array + size_t m_count; + + // the HWNDs we contain + HWND *m_hwnds; + + + DECLARE_NO_COPY_CLASS(wxSubwindows) +}; + +// convenient macro to forward a few methods which are usually propagated to +// subwindows to a wxSubwindows object +// +// parameters should be: +// - cname the name of the class implementing these methods +// - base the name of its base class +// - subwins the name of the member variable of type wxSubwindows * +#define WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(cname, base, subwins) \ + bool cname::ContainsHWND(WXHWND hWnd) const \ + { \ + return subwins && subwins->HasWindow((HWND)hWnd); \ + } \ + \ + bool cname::Show(bool show) \ + { \ + if ( !base::Show(show) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Show(show); \ + \ + return true; \ + } \ + \ + bool cname::Enable(bool enable) \ + { \ + if ( !base::Enable(enable) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Enable(enable); \ + \ + return true; \ + } \ + \ + bool cname::SetFont(const wxFont& font) \ + { \ + if ( !base::SetFont(font) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->SetFont(font); \ + \ + return true; \ + } + + +#endif // _WX_MSW_SUBWIN_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/tabctrl.h b/Externals/wxWidgets/include/wx/msw/tabctrl.h index 23df097c59..20f4f46954 100644 --- a/Externals/wxWidgets/include/wx/msw/tabctrl.h +++ b/Externals/wxWidgets/include/wx/msw/tabctrl.h @@ -1,160 +1,160 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tabctrl.h -// Purpose: wxTabCtrl class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: tabctrl.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_ -#define _WX_TABCTRL_H_ - -class WXDLLIMPEXP_CORE wxImageList; - -// extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; - -/* - * Flags returned by HitTest - */ - -#define wxTAB_HITTEST_NOWHERE 1 -#define wxTAB_HITTEST_ONICON 2 -#define wxTAB_HITTEST_ONLABEL 4 -#define wxTAB_HITTEST_ONITEM 6 - -class WXDLLEXPORT wxTabCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxTabCtrl) - public: - /* - * Public interface - */ - - wxTabCtrl(); - - inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")) - { - Create(parent, id, pos, size, style, name); - } - virtual ~wxTabCtrl(); - -// Accessors - - // Get the selection - int GetSelection() const; - - // Get the tab with the current keyboard focus - int GetCurFocus() const; - - // Get the associated image list - wxImageList* GetImageList() const; - - // Get the number of items - int GetItemCount() const; - - // Get the rect corresponding to the tab - bool GetItemRect(int item, wxRect& rect) const; - - // Get the number of rows - int GetRowCount() const; - - // Get the item text - wxString GetItemText(int item) const ; - - // Get the item image - int GetItemImage(int item) const; - - // Get the item data - void* GetItemData(int item) const; - - // Set the selection - int SetSelection(int item); - - // Set the image list - void SetImageList(wxImageList* imageList); - - // Set the text for an item - bool SetItemText(int item, const wxString& text); - - // Set the image for an item - bool SetItemImage(int item, int image); - - // Set the data for an item - bool SetItemData(int item, void* data); - - // Set the size for a fixed-width tab control - void SetItemSize(const wxSize& size); - - // Set the padding between tabs - void SetPadding(const wxSize& padding); - -// Operations - - bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")); - - // Delete all items - bool DeleteAllItems(); - - // Delete an item - bool DeleteItem(int item); - - // Hit test - int HitTest(const wxPoint& pt, long& flags); - - // Insert an item - bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); - - // Implementation - - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -protected: - wxImageList* m_imageList; - -DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTabCtrl) -}; - -class WXDLLEXPORT wxTabEvent : public wxNotifyEvent -{ -public: - wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxNotifyEvent(commandType, id) - { - m_nSel = nSel; - m_nOldSel = nOldSel; - } - - // accessors - // the currently selected page (-1 if none) - int GetSelection() const { return m_nSel; } - void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (-1 if none) - int GetOldSelection() const { return m_nOldSel; } - void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent) -}; - -typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); - -#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \ - id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), -#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \ - id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), - -#endif - // _WX_TABCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: tabctrl.h +// Purpose: wxTabCtrl class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: tabctrl.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TABCTRL_H_ +#define _WX_TABCTRL_H_ + +class WXDLLIMPEXP_CORE wxImageList; + +// extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; + +/* + * Flags returned by HitTest + */ + +#define wxTAB_HITTEST_NOWHERE 1 +#define wxTAB_HITTEST_ONICON 2 +#define wxTAB_HITTEST_ONLABEL 4 +#define wxTAB_HITTEST_ONITEM 6 + +class WXDLLEXPORT wxTabCtrl: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxTabCtrl) + public: + /* + * Public interface + */ + + wxTabCtrl(); + + inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")) + { + Create(parent, id, pos, size, style, name); + } + virtual ~wxTabCtrl(); + +// Accessors + + // Get the selection + int GetSelection() const; + + // Get the tab with the current keyboard focus + int GetCurFocus() const; + + // Get the associated image list + wxImageList* GetImageList() const; + + // Get the number of items + int GetItemCount() const; + + // Get the rect corresponding to the tab + bool GetItemRect(int item, wxRect& rect) const; + + // Get the number of rows + int GetRowCount() const; + + // Get the item text + wxString GetItemText(int item) const ; + + // Get the item image + int GetItemImage(int item) const; + + // Get the item data + void* GetItemData(int item) const; + + // Set the selection + int SetSelection(int item); + + // Set the image list + void SetImageList(wxImageList* imageList); + + // Set the text for an item + bool SetItemText(int item, const wxString& text); + + // Set the image for an item + bool SetItemImage(int item, int image); + + // Set the data for an item + bool SetItemData(int item, void* data); + + // Set the size for a fixed-width tab control + void SetItemSize(const wxSize& size); + + // Set the padding between tabs + void SetPadding(const wxSize& padding); + +// Operations + + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")); + + // Delete all items + bool DeleteAllItems(); + + // Delete an item + bool DeleteItem(int item); + + // Hit test + int HitTest(const wxPoint& pt, long& flags); + + // Insert an item + bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); + + // Implementation + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + wxImageList* m_imageList; + +DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxTabCtrl) +}; + +class WXDLLEXPORT wxTabEvent : public wxNotifyEvent +{ +public: + wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = -1, int nOldSel = -1) + : wxNotifyEvent(commandType, id) + { + m_nSel = nSel; + m_nOldSel = nOldSel; + } + + // accessors + // the currently selected page (-1 if none) + int GetSelection() const { return m_nSel; } + void SetSelection(int nSel) { m_nSel = nSel; } + // the page that was selected before the change (-1 if none) + int GetOldSelection() const { return m_nOldSel; } + void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } + +private: + int m_nSel, // currently selected page + m_nOldSel; // previously selected page + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent) +}; + +typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); + +#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \ + id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), +#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \ + id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), + +#endif + // _WX_TABCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/taskbar.h b/Externals/wxWidgets/include/wx/msw/taskbar.h index 9956ee4cc0..c29c5c9159 100644 --- a/Externals/wxWidgets/include/wx/msw/taskbar.h +++ b/Externals/wxWidgets/include/wx/msw/taskbar.h @@ -1,82 +1,82 @@ -///////////////////////////////////////////////////////////////////////// -// File: wx/msw/taskbar.h -// Purpose: Defines wxTaskBarIcon class for manipulating icons on the -// Windows task bar. -// Author: Julian Smart -// Modified by: Vaclav Slavik -// Created: 24/3/98 -// RCS-ID: $Id: taskbar.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////// - -#ifndef _TASKBAR_H_ -#define _TASKBAR_H_ - -#include "wx/icon.h" - -// private helper class: -class WXDLLIMPEXP_FWD_ADV wxTaskBarIconWindow; - -class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase -{ - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) -public: - wxTaskBarIcon(); - virtual ~wxTaskBarIcon(); - -// Accessors - inline bool IsOk() const { return true; } - inline bool IsIconInstalled() const { return m_iconAdded; } - -// Operations - bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - bool RemoveIcon(void); - bool PopupMenu(wxMenu *menu); //, int x, int y); - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( bool IsOK() const ); - -// Overridables - virtual void OnMouseMove(wxEvent&); - virtual void OnLButtonDown(wxEvent&); - virtual void OnLButtonUp(wxEvent&); - virtual void OnRButtonDown(wxEvent&); - virtual void OnRButtonUp(wxEvent&); - virtual void OnLButtonDClick(wxEvent&); - virtual void OnRButtonDClick(wxEvent&); -#endif - -// Implementation -protected: - friend class wxTaskBarIconWindow; - long WindowProc(unsigned int msg, unsigned int wParam, long lParam); - void RegisterWindowMessages(); - -// Data members -protected: - wxTaskBarIconWindow *m_win; - bool m_iconAdded; - wxIcon m_icon; - wxString m_strTooltip; - -#if WXWIN_COMPATIBILITY_2_4 - // non-virtual default event handlers to forward events to the virtuals - void _OnMouseMove(wxTaskBarIconEvent&); - void _OnLButtonDown(wxTaskBarIconEvent&); - void _OnLButtonUp(wxTaskBarIconEvent&); - void _OnRButtonDown(wxTaskBarIconEvent&); - void _OnRButtonUp(wxTaskBarIconEvent&); - void _OnLButtonDClick(wxTaskBarIconEvent&); - void _OnRButtonDClick(wxTaskBarIconEvent&); - - DECLARE_EVENT_TABLE() -#endif -}; - -#if WXWIN_COMPATIBILITY_2_4 -inline bool wxTaskBarIcon::IsOK() const { return IsOk(); } -#endif - -#endif - // _TASKBAR_H_ +///////////////////////////////////////////////////////////////////////// +// File: wx/msw/taskbar.h +// Purpose: Defines wxTaskBarIcon class for manipulating icons on the +// Windows task bar. +// Author: Julian Smart +// Modified by: Vaclav Slavik +// Created: 24/3/98 +// RCS-ID: $Id: taskbar.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _TASKBAR_H_ +#define _TASKBAR_H_ + +#include "wx/icon.h" + +// private helper class: +class WXDLLIMPEXP_FWD_ADV wxTaskBarIconWindow; + +class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase +{ + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) +public: + wxTaskBarIcon(); + virtual ~wxTaskBarIcon(); + +// Accessors + inline bool IsOk() const { return true; } + inline bool IsIconInstalled() const { return m_iconAdded; } + +// Operations + bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); + bool RemoveIcon(void); + bool PopupMenu(wxMenu *menu); //, int x, int y); + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool IsOK() const ); + +// Overridables + virtual void OnMouseMove(wxEvent&); + virtual void OnLButtonDown(wxEvent&); + virtual void OnLButtonUp(wxEvent&); + virtual void OnRButtonDown(wxEvent&); + virtual void OnRButtonUp(wxEvent&); + virtual void OnLButtonDClick(wxEvent&); + virtual void OnRButtonDClick(wxEvent&); +#endif + +// Implementation +protected: + friend class wxTaskBarIconWindow; + long WindowProc(unsigned int msg, unsigned int wParam, long lParam); + void RegisterWindowMessages(); + +// Data members +protected: + wxTaskBarIconWindow *m_win; + bool m_iconAdded; + wxIcon m_icon; + wxString m_strTooltip; + +#if WXWIN_COMPATIBILITY_2_4 + // non-virtual default event handlers to forward events to the virtuals + void _OnMouseMove(wxTaskBarIconEvent&); + void _OnLButtonDown(wxTaskBarIconEvent&); + void _OnLButtonUp(wxTaskBarIconEvent&); + void _OnRButtonDown(wxTaskBarIconEvent&); + void _OnRButtonUp(wxTaskBarIconEvent&); + void _OnLButtonDClick(wxTaskBarIconEvent&); + void _OnRButtonDClick(wxTaskBarIconEvent&); + + DECLARE_EVENT_TABLE() +#endif +}; + +#if WXWIN_COMPATIBILITY_2_4 +inline bool wxTaskBarIcon::IsOK() const { return IsOk(); } +#endif + +#endif + // _TASKBAR_H_ diff --git a/Externals/wxWidgets/include/wx/msw/tbar95.h b/Externals/wxWidgets/include/wx/msw/tbar95.h index 441e878b57..e5f465f3b6 100644 --- a/Externals/wxWidgets/include/wx/msw/tbar95.h +++ b/Externals/wxWidgets/include/wx/msw/tbar95.h @@ -1,153 +1,153 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/tbar95.h -// Purpose: wxToolBar (Windows 95 toolbar) class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: tbar95.h 44317 2007-01-25 23:35:07Z RD $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TBAR95_H_ -#define _WX_MSW_TBAR95_H_ - -#if wxUSE_TOOLBAR - -#include "wx/dynarray.h" -#include "wx/imaglist.h" - -class WXDLLEXPORT wxToolBar : public wxToolBarBase -{ -public: - // ctors and dtor - wxToolBar() { Init(); } - - wxToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr) - { - Init(); - - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr); - - virtual ~wxToolBar(); - - // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - - virtual bool Realize(); - - virtual void SetToolBitmapSize(const wxSize& size); - virtual wxSize GetToolSize() const; - - virtual void SetRows(int nRows); - -#if wxABI_VERSION >= 20802 - // TODO: In 2.9 these should probably be virtual, and declared in the base class... - void SetToolNormalBitmap(int id, const wxBitmap& bitmap); - void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); -#endif - - // implementation only from now on - // ------------------------------- - - virtual void SetWindowStyleFlag(long style); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - void OnMouseEvent(wxMouseEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnEraseBackground(wxEraseEvent& event); - - void SetFocus() {} - - static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); - - // override WndProc mainly to process WM_SIZE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -protected: - // common part of all ctors - void Init(); - - // create the native toolbar control - bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); - - // recreate the control completely - void Recreate(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); - - // return the appropriate size and flags for the toolbar control - virtual wxSize DoGetBestSize() const; - - // handlers for various events - bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); - bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); - void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); - - // should be called whenever the toolbar size changes - void UpdateSize(); - - // create m_disabledImgList (but doesn't fill it), set it to NULL if it is - // unneeded - void CreateDisabledImageList(); - - // get the Windows toolbar style of this control - long GetMSWToolbarStyle() const; - - - // the big bitmap containing all bitmaps of the toolbar buttons - WXHBITMAP m_hBitmap; - - // the image list with disabled images, may be NULL if we use - // system-provided versions of them - wxImageList *m_disabledImgList; - - // the total number of toolbar elements - size_t m_nButtons; - - // the tool the cursor is in - wxToolBarToolBase *m_pInTool; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolBar) - DECLARE_NO_COPY_CLASS(wxToolBar) -}; - -#endif // wxUSE_TOOLBAR - -#endif // _WX_MSW_TBAR95_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tbar95.h +// Purpose: wxToolBar (Windows 95 toolbar) class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: tbar95.h 44317 2007-01-25 23:35:07Z RD $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TBAR95_H_ +#define _WX_MSW_TBAR95_H_ + +#if wxUSE_TOOLBAR + +#include "wx/dynarray.h" +#include "wx/imaglist.h" + +class WXDLLEXPORT wxToolBar : public wxToolBarBase +{ +public: + // ctors and dtor + wxToolBar() { Init(); } + + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr); + + virtual ~wxToolBar(); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual bool Realize(); + + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolSize() const; + + virtual void SetRows(int nRows); + +#if wxABI_VERSION >= 20802 + // TODO: In 2.9 these should probably be virtual, and declared in the base class... + void SetToolNormalBitmap(int id, const wxBitmap& bitmap); + void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); +#endif + + // implementation only from now on + // ------------------------------- + + virtual void SetWindowStyleFlag(long style); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + void OnMouseEvent(wxMouseEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnEraseBackground(wxEraseEvent& event); + + void SetFocus() {} + + static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); + + // override WndProc mainly to process WM_SIZE + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +protected: + // common part of all ctors + void Init(); + + // create the native toolbar control + bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); + + // recreate the control completely + void Recreate(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + // return the appropriate size and flags for the toolbar control + virtual wxSize DoGetBestSize() const; + + // handlers for various events + bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); + bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); + void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); + + // should be called whenever the toolbar size changes + void UpdateSize(); + + // create m_disabledImgList (but doesn't fill it), set it to NULL if it is + // unneeded + void CreateDisabledImageList(); + + // get the Windows toolbar style of this control + long GetMSWToolbarStyle() const; + + + // the big bitmap containing all bitmaps of the toolbar buttons + WXHBITMAP m_hBitmap; + + // the image list with disabled images, may be NULL if we use + // system-provided versions of them + wxImageList *m_disabledImgList; + + // the total number of toolbar elements + size_t m_nButtons; + + // the tool the cursor is in + wxToolBarToolBase *m_pInTool; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxToolBar) + DECLARE_NO_COPY_CLASS(wxToolBar) +}; + +#endif // wxUSE_TOOLBAR + +#endif // _WX_MSW_TBAR95_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/textctrl.h b/Externals/wxWidgets/include/wx/msw/textctrl.h index 5790a7c93f..2ffea75d32 100644 --- a/Externals/wxWidgets/include/wx/msw/textctrl.h +++ b/Externals/wxWidgets/include/wx/msw/textctrl.h @@ -1,291 +1,291 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/textctrl.h -// Purpose: wxTextCtrl class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: textctrl.h 52547 2008-03-15 12:33:04Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCTRL_H_ -#define _WX_TEXTCTRL_H_ - -class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase -{ -public: - // creation - // -------- - - wxTextCtrl() { Init(); } - wxTextCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) - { - Init(); - - Create(parent, id, value, pos, size, style, validator, name); - } - virtual ~wxTextCtrl(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - - // implement base class pure virtuals - // ---------------------------------- - - virtual wxString GetValue() const; - virtual bool IsEmpty() const; - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - virtual void GetSelection(long* from, long* to) const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load the control's contents from the file - virtual bool DoLoadFile(const wxString& file, int fileType); - - // clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - virtual void SetMaxLength(unsigned long len); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - -#ifdef __WIN32__ - virtual bool EmulateKeyPress(const wxKeyEvent& event); -#endif // __WIN32__ - -#if wxUSE_RICHEDIT - // apply text attribute to the range of text (only works with richedit - // controls) - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); -#endif // wxUSE_RICHEDIT - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const - { - return wxTextCtrlBase::HitTest(pt, col, row); - } - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - - // Caret handling (Windows only) - - bool ShowNativeCaret(bool show = true); - bool HideNativeCaret() { return ShowNativeCaret(false); } - - // Implementation from now on - // -------------------------- - - virtual void SetWindowStyleFlag(long style); - - virtual void Command(wxCommandEvent& event); - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); - -#if wxUSE_RICHEDIT - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - int GetRichVersion() const { return m_verRichEdit; } - bool IsRich() const { return m_verRichEdit != 0; } - - // rich edit controls are not compatible with normal ones and wem ust set - // the colours for them otherwise - virtual bool SetBackgroundColour(const wxColour& colour); - virtual bool SetForegroundColour(const wxColour& colour); -#else - bool IsRich() const { return false; } -#endif // wxUSE_RICHEDIT - -#if wxUSE_INKEDIT && wxUSE_RICHEDIT - bool IsInkEdit() const { return m_isInkEdit != 0; } -#else - bool IsInkEdit() const { return false; } -#endif - - virtual void AdoptAttributesFromHWND(); - - virtual bool AcceptsFocus() const; - - // callbacks - void OnDropFiles(wxDropFilesEvent& event); - void OnChar(wxKeyEvent& event); // Process 'enter' if required - - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - // Show a context menu for Rich Edit controls (the standard - // EDIT control has one already) - void OnContextMenu(wxContextMenuEvent& event); - - // be sure the caret remains invisible if the user - // called HideNativeCaret() before - void OnSetFocus(wxFocusEvent& event); - - // intercept WM_GETDLGCODE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - virtual wxVisualAttributes GetDefaultAttributes() const; - -protected: - // common part of all ctors - void Init(); - - // creates the control of appropriate class (plain or rich edit) with the - // styles corresponding to m_windowStyle - // - // this is used by ctor/Create() and when we need to recreate the control - // later - bool MSWCreateText(const wxString& value, - const wxPoint& pos, - const wxSize& size); - - virtual void DoSetValue(const wxString &value, int flags = 0); - - // return true if this control has a user-set limit on amount of text (i.e. - // the limit is due to a previous call to SetMaxLength() and not built in) - bool HasSpaceLimit(unsigned int *len) const; - - // call this to increase the size limit (will do nothing if the current - // limit is big enough) - // - // returns true if we increased the limit to allow entering more text, - // false if we hit the limit set by SetMaxLength() and so didn't change it - bool AdjustSpaceLimit(); - -#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) - // replace the selection or the entire control contents with the given text - // in the specified encoding - bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly); - - // get the contents of the control out as text in the given encoding - wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const; -#endif // wxUSE_RICHEDIT - - // replace the contents of the selection or of the entire control with the - // given text - void DoWriteText(const wxString& text, - int flags = SetValue_SendEvent | SetValue_SelectionOnly); - - // set the selection possibly without scrolling the caret into view - void DoSetSelection(long from, long to, bool scrollCaret = true); - - // return true if there is a non empty selection in the control - bool HasSelection() const; - - // get the length of the line containing the character at the given - // position - long GetLengthOfLineContainingPos(long pos) const; - - // send TEXT_UPDATED event, return true if it was handled, false otherwise - bool SendUpdateEvent(); - - virtual wxSize DoGetBestSize() const; - -#if wxUSE_RICHEDIT - // we're using RICHEDIT (and not simple EDIT) control if this field is not - // 0, it also gives the version of the RICHEDIT control being used (1, 2 or - // 3 so far) - int m_verRichEdit; -#endif // wxUSE_RICHEDIT - - // number of EN_UPDATE events sent by Windows when we change the controls - // text ourselves: we want this to be exactly 1 - int m_updatesCount; - -private: - void OnKeyDown(wxKeyEvent& event); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) - - wxMenu* m_privateContextMenu; - - bool m_isNativeCaretShown; - -#if wxUSE_INKEDIT && wxUSE_RICHEDIT - int m_isInkEdit; -#endif - -}; - -#endif - // _WX_TEXTCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/textctrl.h +// Purpose: wxTextCtrl class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: textctrl.h 52547 2008-03-15 12:33:04Z VS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_ +#define _WX_TEXTCTRL_H_ + +class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase +{ +public: + // creation + // -------- + + wxTextCtrl() { Init(); } + wxTextCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr) + { + Init(); + + Create(parent, id, value, pos, size, style, validator, name); + } + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr); + + // implement base class pure virtuals + // ---------------------------------- + + virtual wxString GetValue() const; + virtual bool IsEmpty() const; + + virtual wxString GetRange(long from, long to) const; + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load the control's contents from the file + virtual bool DoLoadFile(const wxString& file, int fileType); + + // clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + virtual void SetMaxLength(unsigned long len); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + +#ifdef __WIN32__ + virtual bool EmulateKeyPress(const wxKeyEvent& event); +#endif // __WIN32__ + +#if wxUSE_RICHEDIT + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual bool GetStyle(long position, wxTextAttr& style); +#endif // wxUSE_RICHEDIT + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const + { + return wxTextCtrlBase::HitTest(pt, col, row); + } + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // Caret handling (Windows only) + + bool ShowNativeCaret(bool show = true); + bool HideNativeCaret() { return ShowNativeCaret(false); } + + // Implementation from now on + // -------------------------- + + virtual void SetWindowStyleFlag(long style); + + virtual void Command(wxCommandEvent& event); + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); + +#if wxUSE_RICHEDIT + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + int GetRichVersion() const { return m_verRichEdit; } + bool IsRich() const { return m_verRichEdit != 0; } + + // rich edit controls are not compatible with normal ones and wem ust set + // the colours for them otherwise + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); +#else + bool IsRich() const { return false; } +#endif // wxUSE_RICHEDIT + +#if wxUSE_INKEDIT && wxUSE_RICHEDIT + bool IsInkEdit() const { return m_isInkEdit != 0; } +#else + bool IsInkEdit() const { return false; } +#endif + + virtual void AdoptAttributesFromHWND(); + + virtual bool AcceptsFocus() const; + + // callbacks + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + // Show a context menu for Rich Edit controls (the standard + // EDIT control has one already) + void OnContextMenu(wxContextMenuEvent& event); + + // be sure the caret remains invisible if the user + // called HideNativeCaret() before + void OnSetFocus(wxFocusEvent& event); + + // intercept WM_GETDLGCODE + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + virtual wxVisualAttributes GetDefaultAttributes() const; + +protected: + // common part of all ctors + void Init(); + + // creates the control of appropriate class (plain or rich edit) with the + // styles corresponding to m_windowStyle + // + // this is used by ctor/Create() and when we need to recreate the control + // later + bool MSWCreateText(const wxString& value, + const wxPoint& pos, + const wxSize& size); + + virtual void DoSetValue(const wxString &value, int flags = 0); + + // return true if this control has a user-set limit on amount of text (i.e. + // the limit is due to a previous call to SetMaxLength() and not built in) + bool HasSpaceLimit(unsigned int *len) const; + + // call this to increase the size limit (will do nothing if the current + // limit is big enough) + // + // returns true if we increased the limit to allow entering more text, + // false if we hit the limit set by SetMaxLength() and so didn't change it + bool AdjustSpaceLimit(); + +#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) + // replace the selection or the entire control contents with the given text + // in the specified encoding + bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly); + + // get the contents of the control out as text in the given encoding + wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const; +#endif // wxUSE_RICHEDIT + + // replace the contents of the selection or of the entire control with the + // given text + void DoWriteText(const wxString& text, + int flags = SetValue_SendEvent | SetValue_SelectionOnly); + + // set the selection possibly without scrolling the caret into view + void DoSetSelection(long from, long to, bool scrollCaret = true); + + // return true if there is a non empty selection in the control + bool HasSelection() const; + + // get the length of the line containing the character at the given + // position + long GetLengthOfLineContainingPos(long pos) const; + + // send TEXT_UPDATED event, return true if it was handled, false otherwise + bool SendUpdateEvent(); + + virtual wxSize DoGetBestSize() const; + +#if wxUSE_RICHEDIT + // we're using RICHEDIT (and not simple EDIT) control if this field is not + // 0, it also gives the version of the RICHEDIT control being used (1, 2 or + // 3 so far) + int m_verRichEdit; +#endif // wxUSE_RICHEDIT + + // number of EN_UPDATE events sent by Windows when we change the controls + // text ourselves: we want this to be exactly 1 + int m_updatesCount; + +private: + void OnKeyDown(wxKeyEvent& event); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) + + wxMenu* m_privateContextMenu; + + bool m_isNativeCaretShown; + +#if wxUSE_INKEDIT && wxUSE_RICHEDIT + int m_isInkEdit; +#endif + +}; + +#endif + // _WX_TEXTCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/tglbtn.h b/Externals/wxWidgets/include/wx/msw/tglbtn.h index ae45202c2d..0c5d1c46dc 100644 --- a/Externals/wxWidgets/include/wx/msw/tglbtn.h +++ b/Externals/wxWidgets/include/wx/msw/tglbtn.h @@ -1,60 +1,60 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/tglbtn.h -// Purpose: Declaration of the wxToggleButton class, which implements a -// toggle button under wxMSW. -// Author: John Norris, minor changes by Axel Schlueter -// Modified by: -// Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2000 Johnny C. Norris II -// License: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOGGLEBUTTON_H_ -#define _WX_TOGGLEBUTTON_H_ - -extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; - -// Checkbox item (single checkbox) -class WXDLLEXPORT wxToggleButton : public wxControl -{ -public: - wxToggleButton() {} - wxToggleButton(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual void SetValue(bool value); - virtual bool GetValue() const ; - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void Command(wxCommandEvent& event); - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; - -protected: - virtual wxSize DoGetBestSize() const; - virtual wxBorder GetDefaultBorder() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) -}; - -#endif // _WX_TOGGLEBUTTON_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxMSW. +// Author: John Norris, minor changes by Axel Schlueter +// Modified by: +// Created: 08.02.01 +// RCS-ID: $Id: tglbtn.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 2000 Johnny C. Norris II +// License: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; + +// Checkbox item (single checkbox) +class WXDLLEXPORT wxToggleButton : public wxControl +{ +public: + wxToggleButton() {} + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const ; + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void Command(wxCommandEvent& event); + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + +protected: + virtual wxSize DoGetBestSize() const; + virtual wxBorder GetDefaultBorder() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) +}; + +#endif // _WX_TOGGLEBUTTON_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/timer.h b/Externals/wxWidgets/include/wx/msw/timer.h index 297293dc2f..449543300a 100644 --- a/Externals/wxWidgets/include/wx/msw/timer.h +++ b/Externals/wxWidgets/include/wx/msw/timer.h @@ -1,40 +1,40 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: timer.h -// Purpose: wxTimer class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIMER_H_ -#define _WX_TIMER_H_ - -class WXDLLEXPORT wxTimer : public wxTimerBase -{ -friend void wxProcessTimer(wxTimer& timer); - -public: - wxTimer() { Init(); } - wxTimer(wxEvtHandler *owner, int id = wxID_ANY) : wxTimerBase(owner, id) - { Init(); } - virtual ~wxTimer(); - - virtual bool Start(int milliseconds = -1, bool oneShot = false); - virtual void Stop(); - - virtual bool IsRunning() const { return m_id != 0; } - -protected: - void Init(); - - unsigned long m_id; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTimer) -}; - -#endif - // _WX_TIMERH_ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: wxTimer class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: timer.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMER_H_ +#define _WX_TIMER_H_ + +class WXDLLEXPORT wxTimer : public wxTimerBase +{ +friend void wxProcessTimer(wxTimer& timer); + +public: + wxTimer() { Init(); } + wxTimer(wxEvtHandler *owner, int id = wxID_ANY) : wxTimerBase(owner, id) + { Init(); } + virtual ~wxTimer(); + + virtual bool Start(int milliseconds = -1, bool oneShot = false); + virtual void Stop(); + + virtual bool IsRunning() const { return m_id != 0; } + +protected: + void Init(); + + unsigned long m_id; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTimer) +}; + +#endif + // _WX_TIMERH_ diff --git a/Externals/wxWidgets/include/wx/msw/tooltip.h b/Externals/wxWidgets/include/wx/msw/tooltip.h index 3e623a39a6..5da413c7bd 100644 --- a/Externals/wxWidgets/include/wx/msw/tooltip.h +++ b/Externals/wxWidgets/include/wx/msw/tooltip.h @@ -1,71 +1,71 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/tooltip.h -// Purpose: wxToolTip class - tooltip control -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.01.99 -// RCS-ID: $Id: tooltip.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TOOLTIP_H_ -#define _WX_MSW_TOOLTIP_H_ - -#include "wx/object.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -class WXDLLEXPORT wxToolTip : public wxObject -{ -public: - // ctor & dtor - wxToolTip(const wxString &tip); - virtual ~wxToolTip(); - - // accessors - // tip text - void SetTip(const wxString& tip); - const wxString& GetTip() const { return m_text; } - - // the window we're associated with - void SetWindow(wxWindow *win); - wxWindow *GetWindow() const { return m_window; } - - // controlling tooltip behaviour: globally change tooltip parameters - // enable or disable the tooltips globally - static void Enable(bool flag); - // set the delay after which the tooltip appears - static void SetDelay(long milliseconds); - - // implementation only from now on - // ------------------------------- - - // should be called in responde to WM_MOUSEMOVE - static void RelayEvent(WXMSG *msg); - - // add a window to the tooltip control - void Add(WXHWND hwnd); - - // remove any tooltip from the window - static void Remove(WXHWND hwnd); - -private: - // the one and only one tooltip control we use - never access it directly - // but use GetToolTipCtrl() which will create it when needed - static WXHWND ms_hwndTT; - - // create the tooltip ctrl if it doesn't exist yet and return its HWND - static WXHWND GetToolTipCtrl(); - - // remove this tooltip from the tooltip control - void Remove(); - - wxString m_text; // tooltip text - wxWindow *m_window; // window we're associated with - - DECLARE_ABSTRACT_CLASS(wxToolTip) - DECLARE_NO_COPY_CLASS(wxToolTip) -}; - -#endif // _WX_MSW_TOOLTIP_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tooltip.h +// Purpose: wxToolTip class - tooltip control +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.01.99 +// RCS-ID: $Id: tooltip.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TOOLTIP_H_ +#define _WX_MSW_TOOLTIP_H_ + +#include "wx/object.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLEXPORT wxToolTip : public wxObject +{ +public: + // ctor & dtor + wxToolTip(const wxString &tip); + virtual ~wxToolTip(); + + // accessors + // tip text + void SetTip(const wxString& tip); + const wxString& GetTip() const { return m_text; } + + // the window we're associated with + void SetWindow(wxWindow *win); + wxWindow *GetWindow() const { return m_window; } + + // controlling tooltip behaviour: globally change tooltip parameters + // enable or disable the tooltips globally + static void Enable(bool flag); + // set the delay after which the tooltip appears + static void SetDelay(long milliseconds); + + // implementation only from now on + // ------------------------------- + + // should be called in responde to WM_MOUSEMOVE + static void RelayEvent(WXMSG *msg); + + // add a window to the tooltip control + void Add(WXHWND hwnd); + + // remove any tooltip from the window + static void Remove(WXHWND hwnd); + +private: + // the one and only one tooltip control we use - never access it directly + // but use GetToolTipCtrl() which will create it when needed + static WXHWND ms_hwndTT; + + // create the tooltip ctrl if it doesn't exist yet and return its HWND + static WXHWND GetToolTipCtrl(); + + // remove this tooltip from the tooltip control + void Remove(); + + wxString m_text; // tooltip text + wxWindow *m_window; // window we're associated with + + DECLARE_ABSTRACT_CLASS(wxToolTip) + DECLARE_NO_COPY_CLASS(wxToolTip) +}; + +#endif // _WX_MSW_TOOLTIP_H_ diff --git a/Externals/wxWidgets/include/wx/msw/toplevel.h b/Externals/wxWidgets/include/wx/msw/toplevel.h index 30ddeeda91..dd86f41df3 100644 --- a/Externals/wxWidgets/include/wx/msw/toplevel.h +++ b/Externals/wxWidgets/include/wx/msw/toplevel.h @@ -1,197 +1,197 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/toplevel.h -// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.09.01 -// RCS-ID: $Id: toplevel.h 50999 2008-01-03 01:13:44Z VZ $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TOPLEVEL_H_ -#define _WX_MSW_TOPLEVEL_H_ - -// ---------------------------------------------------------------------------- -// wxTopLevelWindowMSW -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase -{ -public: - // constructors and such - wxTopLevelWindowMSW() { Init(); } - - wxTopLevelWindowMSW(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxTopLevelWindowMSW(); - - // implement base class pure virtuals - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; - virtual void Maximize(bool maximize = true); - virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = true); - virtual bool IsIconized() const; - virtual void SetIcon(const wxIcon& icon); - virtual void SetIcons(const wxIconBundle& icons ); - virtual void Restore(); - - virtual void SetLayoutDirection(wxLayoutDirection dir); - -#ifndef __WXWINCE__ - virtual bool SetShape(const wxRegion& region); -#endif // __WXWINCE__ - virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - - virtual bool Show(bool show = true); - - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual bool IsFullScreen() const { return m_fsIsShowing; } - - // wxMSW only: EnableCloseButton(false) may be used to remove the "Close" - // button from the title bar - virtual bool EnableCloseButton(bool enable = true); - - // Set window transparency if the platform supports it - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent(); - - - // implementation from now on - // -------------------------- - - // event handlers - void OnActivate(wxActivateEvent& event); - - // called by wxWindow whenever it gets focus - void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } - wxWindow *GetLastFocus() const { return m_winLastFocused; } - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); - virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); -#endif // __SMARTPHONE__ && __WXWINCE__ - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - // Soft Input Panel (SIP) change notification - virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); -#endif - - // translate wxWidgets flags to Windows ones - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; - - // choose the right parent to use with CreateWindow() - virtual WXHWND MSWGetParent() const; - - // window proc for the frames - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // create a new frame, return false if it couldn't be created - bool CreateFrame(const wxString& title, - const wxPoint& pos, - const wxSize& size); - - // create a new dialog using the given dialog template from resources, - // return false if it couldn't be created - bool CreateDialog(const void *dlgTemplate, - const wxString& title, - const wxPoint& pos, - const wxSize& size); - - // common part of Iconize(), Maximize() and Restore() - void DoShowWindow(int nShowCmd); - - // is the window currently iconized? - bool m_iconized; - - // should the frame be maximized when it will be shown? set by Maximize() - // when it is called while the frame is hidden - bool m_maximizeOnShow; - - // Data to save/restore when calling ShowFullScreen - long m_fsStyle; // Passed to ShowFullScreen - wxRect m_fsOldSize; - long m_fsOldWindowStyle; - bool m_fsIsMaximized; - bool m_fsIsShowing; - - // the last focused child: we restore focus to it on activation - wxWindow *m_winLastFocused; - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - class ButtonMenu - { - public: - ButtonMenu(); - ~ButtonMenu(); - - void SetButton(int id = wxID_ANY, - const wxString& label = wxEmptyString, - wxMenu *subMenu = NULL); - - bool IsAssigned() const {return m_assigned;} - bool IsMenu() const {return m_menu!=NULL;} - - int GetId() const {return m_id;} - wxMenu* GetMenu() const {return m_menu;} - wxString GetLabel() {return m_label;} - - static wxMenu *DuplicateMenu(wxMenu *menu); - - protected: - int m_id; - wxString m_label; - wxMenu *m_menu; - bool m_assigned; - }; - - ButtonMenu m_LeftButton; - ButtonMenu m_RightButton; - HWND m_MenuBarHWND; - - void ReloadButton(ButtonMenu& button, UINT menuID); - void ReloadAllButtons(); -#endif // __SMARTPHONE__ && __WXWINCE__ - -private: - // helper of SetIcons(): calls gets the icon with the size specified by the - // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it - // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG) - void DoSelectAndSetIcon(const wxIconBundle& icons, int smX, int smY, int i); - - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - void* m_activateInfo; -#endif - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) -}; - -#endif // _WX_MSW_TOPLEVEL_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/toplevel.h +// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.09.01 +// RCS-ID: $Id: toplevel.h 50999 2008-01-03 01:13:44Z VZ $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TOPLEVEL_H_ +#define _WX_MSW_TOPLEVEL_H_ + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowMSW +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowMSW() { Init(); } + + wxTopLevelWindowMSW(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxTopLevelWindowMSW(); + + // implement base class pure virtuals + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + virtual void Maximize(bool maximize = true); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = true); + virtual bool IsIconized() const; + virtual void SetIcon(const wxIcon& icon); + virtual void SetIcons(const wxIconBundle& icons ); + virtual void Restore(); + + virtual void SetLayoutDirection(wxLayoutDirection dir); + +#ifndef __WXWINCE__ + virtual bool SetShape(const wxRegion& region); +#endif // __WXWINCE__ + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + + virtual bool Show(bool show = true); + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual bool IsFullScreen() const { return m_fsIsShowing; } + + // wxMSW only: EnableCloseButton(false) may be used to remove the "Close" + // button from the title bar + virtual bool EnableCloseButton(bool enable = true); + + // Set window transparency if the platform supports it + virtual bool SetTransparent(wxByte alpha); + virtual bool CanSetTransparent(); + + + // implementation from now on + // -------------------------- + + // event handlers + void OnActivate(wxActivateEvent& event); + + // called by wxWindow whenever it gets focus + void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } + wxWindow *GetLastFocus() const { return m_winLastFocused; } + +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) + virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); + virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); +#endif // __SMARTPHONE__ && __WXWINCE__ + +#if defined(__SMARTPHONE__) || defined(__POCKETPC__) + // Soft Input Panel (SIP) change notification + virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); +#endif + + // translate wxWidgets flags to Windows ones + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; + + // choose the right parent to use with CreateWindow() + virtual WXHWND MSWGetParent() const; + + // window proc for the frames + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +protected: + // common part of all ctors + void Init(); + + // create a new frame, return false if it couldn't be created + bool CreateFrame(const wxString& title, + const wxPoint& pos, + const wxSize& size); + + // create a new dialog using the given dialog template from resources, + // return false if it couldn't be created + bool CreateDialog(const void *dlgTemplate, + const wxString& title, + const wxPoint& pos, + const wxSize& size); + + // common part of Iconize(), Maximize() and Restore() + void DoShowWindow(int nShowCmd); + + // is the window currently iconized? + bool m_iconized; + + // should the frame be maximized when it will be shown? set by Maximize() + // when it is called while the frame is hidden + bool m_maximizeOnShow; + + // Data to save/restore when calling ShowFullScreen + long m_fsStyle; // Passed to ShowFullScreen + wxRect m_fsOldSize; + long m_fsOldWindowStyle; + bool m_fsIsMaximized; + bool m_fsIsShowing; + + // the last focused child: we restore focus to it on activation + wxWindow *m_winLastFocused; + +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) + class ButtonMenu + { + public: + ButtonMenu(); + ~ButtonMenu(); + + void SetButton(int id = wxID_ANY, + const wxString& label = wxEmptyString, + wxMenu *subMenu = NULL); + + bool IsAssigned() const {return m_assigned;} + bool IsMenu() const {return m_menu!=NULL;} + + int GetId() const {return m_id;} + wxMenu* GetMenu() const {return m_menu;} + wxString GetLabel() {return m_label;} + + static wxMenu *DuplicateMenu(wxMenu *menu); + + protected: + int m_id; + wxString m_label; + wxMenu *m_menu; + bool m_assigned; + }; + + ButtonMenu m_LeftButton; + ButtonMenu m_RightButton; + HWND m_MenuBarHWND; + + void ReloadButton(ButtonMenu& button, UINT menuID); + void ReloadAllButtons(); +#endif // __SMARTPHONE__ && __WXWINCE__ + +private: + // helper of SetIcons(): calls gets the icon with the size specified by the + // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it + // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG) + void DoSelectAndSetIcon(const wxIconBundle& icons, int smX, int smY, int i); + + +#if defined(__SMARTPHONE__) || defined(__POCKETPC__) + void* m_activateInfo; +#endif + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) +}; + +#endif // _WX_MSW_TOPLEVEL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/treectrl.h b/Externals/wxWidgets/include/wx/msw/treectrl.h index d3a6a2e35b..f3bf13b5e5 100644 --- a/Externals/wxWidgets/include/wx/msw/treectrl.h +++ b/Externals/wxWidgets/include/wx/msw/treectrl.h @@ -1,315 +1,315 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/treectrl.h -// Purpose: wxTreeCtrl class -// Author: Julian Smart -// Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98 -// Created: 01/02/97 -// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TREECTRL_H_ -#define _WX_MSW_TREECTRL_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#if wxUSE_TREECTRL - -#include "wx/textctrl.h" -#include "wx/dynarray.h" -#include "wx/treebase.h" -#include "wx/hashmap.h" - -#ifdef __GNUWIN32__ - // Cygwin windows.h defines these identifiers - #undef GetFirstChild - #undef GetNextSibling -#endif // Cygwin - -// fwd decl -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxDragImage; -struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; - -#if WXWIN_COMPATIBILITY_2_6 - // NB: all the following flags are for compatbility only and will be removed in the - // next versions - // flags for deprecated InsertItem() variant (their values are the same as of - // TVI_FIRST and TVI_LAST) - #define wxTREE_INSERT_FIRST 0xFFFF0001 - #define wxTREE_INSERT_LAST 0xFFFF0002 -#endif - -// hash storing attributes for our items -WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); - -// ---------------------------------------------------------------------------- -// wxTreeCtrl -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeCtrl : public wxTreeCtrlBase -{ -public: - // creation - // -------- - wxTreeCtrl() { Init(); } - - wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTreeCtrlNameStr); - - // implement base class pure virtuals - // ---------------------------------- - - virtual unsigned int GetCount() const; - - virtual unsigned int GetIndent() const; - virtual void SetIndent(unsigned int indent); - - virtual void SetImageList(wxImageList *imageList); - virtual void SetStateImageList(wxImageList *imageList); - - virtual wxString GetItemText(const wxTreeItemId& item) const; - virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const; - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; - virtual wxFont GetItemFont(const wxTreeItemId& item) const; - - virtual void SetItemText(const wxTreeItemId& item, const wxString& text); - virtual void SetItemImage(const wxTreeItemId& item, int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal); - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); - virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); - virtual void SetItemDropHighlight(const wxTreeItemId& item, - bool highlight = true); - virtual void SetItemTextColour(const wxTreeItemId& item, - const wxColour& col); - virtual void SetItemBackgroundColour(const wxTreeItemId& item, - const wxColour& col); - virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); - - // item status inquiries - // --------------------- - - virtual bool IsVisible(const wxTreeItemId& item) const; - virtual bool ItemHasChildren(const wxTreeItemId& item) const; - virtual bool IsExpanded(const wxTreeItemId& item) const; - virtual bool IsSelected(const wxTreeItemId& item) const; - virtual bool IsBold(const wxTreeItemId& item) const; - - virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const; - - // navigation - // ---------- - - virtual wxTreeItemId GetRootItem() const; - virtual wxTreeItemId GetSelection() const; - virtual size_t GetSelections(wxArrayTreeItemIds& selections) const; - - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; - virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; - - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; - - virtual wxTreeItemId GetFirstVisibleItem() const; - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; - - // operations - // ---------- - - virtual wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - virtual void Delete(const wxTreeItemId& item); - virtual void DeleteChildren(const wxTreeItemId& item); - virtual void DeleteAllItems(); - - virtual void Expand(const wxTreeItemId& item); - virtual void Collapse(const wxTreeItemId& item); - virtual void CollapseAndReset(const wxTreeItemId& item); - virtual void Toggle(const wxTreeItemId& item); - - virtual void Unselect(); - virtual void UnselectAll(); - virtual void SelectItem(const wxTreeItemId& item, bool select = true); - - virtual void EnsureVisible(const wxTreeItemId& item); - virtual void ScrollTo(const wxTreeItemId& item); - - virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); - virtual wxTextCtrl *GetEditControl() const; - virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), - bool discardChanges = false) - { - DoEndEditLabel(discardChanges); - } - - virtual void SortChildren(const wxTreeItemId& item); - - virtual bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = false) const; - - // deprecated - // ---------- - -#if WXWIN_COMPATIBILITY_2_4 - // these methods are deprecated and will be removed in future versions of - // wxWidgets, they're here for compatibility only, don't use them in new - // code (the comments indicate why these methods are now useless and how to - // replace them) - - // use Expand, Collapse, CollapseAndReset or Toggle - wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) ); - - // use Set/GetImageList and Set/GetStateImageList - // Use base class GetImageList() - wxDEPRECATED( void SetImageList(wxImageList *imageList, int) ); - - // use Set/GetItemImage directly - wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); - wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); - - // use the versions taking wxTreeItemIdValue cookies - wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, - long& cookie) const ); - wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, - long& cookie) const ); -#endif // WXWIN_COMPATIBILITY_2_4 - - - // implementation - // -------------- - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - virtual bool MSWShouldPreProcessMessage(WXMSG* msg); - - // override some base class virtuals - virtual bool SetBackgroundColour(const wxColour &colour); - virtual bool SetForegroundColour(const wxColour &colour); - - // get/set the check state for the item (only for wxTR_MULTIPLE) - bool IsItemChecked(const wxTreeItemId& item) const; - void SetItemCheck(const wxTreeItemId& item, bool check = true); - - // set/get the item state.image (state == -1 means cycle to the next one) - void SetState(const wxTreeItemId& node, int state); - int GetState(const wxTreeItemId& node); - -protected: - // SetImageList helper - void SetAnyImageList(wxImageList *imageList, int which); - - // refresh a single item - void RefreshItem(const wxTreeItemId& item); - - // end edit label - void DoEndEditLabel(bool discardChanges = false); - - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - size_t pos, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data); - virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; - - // obtain the user data for the lParam member of TV_ITEM - class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; - - - // data used only while editing the item label: - wxTextCtrl *m_textCtrl; // text control in which it is edited - wxTreeItemId m_idEdited; // the item being edited - -private: - // the common part of all ctors - void Init(); - - // helper functions - bool DoGetItem(wxTreeViewItem *tvItem) const; - void DoSetItem(wxTreeViewItem *tvItem); - - void DoExpand(const wxTreeItemId& item, int flag); - - void DeleteTextCtrl(); - - // return true if the item is the hidden root one (i.e. it's the root item - // and the tree has wxTR_HIDE_ROOT style) - bool IsHiddenRoot(const wxTreeItemId& item) const; - - - // the hash storing the items attributes (indexed by item ids) - wxMapTreeAttr m_attrs; - - // true if the hash above is not empty - bool m_hasAnyAttr; - -#if wxUSE_DRAGIMAGE - // used for dragging - wxDragImage *m_dragImage; -#endif - - // Virtual root item, if wxTR_HIDE_ROOT is set. - void* m_pVirtualRoot; - - // the starting item for selection with Shift - wxTreeItemId m_htSelStart, m_htClickedItem; - wxPoint m_ptClick; - - friend class wxTreeItemIndirectData; - friend class wxTreeSortHelper; - - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) - DECLARE_NO_COPY_CLASS(wxTreeCtrl) -}; - -#endif // wxUSE_TREECTRL - -#endif // _WX_MSW_TREECTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/treectrl.h +// Purpose: wxTreeCtrl class +// Author: Julian Smart +// Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98 +// Created: 01/02/97 +// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TREECTRL_H_ +#define _WX_MSW_TREECTRL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_TREECTRL + +#include "wx/textctrl.h" +#include "wx/dynarray.h" +#include "wx/treebase.h" +#include "wx/hashmap.h" + +#ifdef __GNUWIN32__ + // Cygwin windows.h defines these identifiers + #undef GetFirstChild + #undef GetNextSibling +#endif // Cygwin + +// fwd decl +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxDragImage; +struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; + +#if WXWIN_COMPATIBILITY_2_6 + // NB: all the following flags are for compatbility only and will be removed in the + // next versions + // flags for deprecated InsertItem() variant (their values are the same as of + // TVI_FIRST and TVI_LAST) + #define wxTREE_INSERT_FIRST 0xFFFF0001 + #define wxTREE_INSERT_LAST 0xFFFF0002 +#endif + +// hash storing attributes for our items +WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); + +// ---------------------------------------------------------------------------- +// wxTreeCtrl +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreeCtrl : public wxTreeCtrlBase +{ +public: + // creation + // -------- + wxTreeCtrl() { Init(); } + + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr); + + // implement base class pure virtuals + // ---------------------------------- + + virtual unsigned int GetCount() const; + + virtual unsigned int GetIndent() const; + virtual void SetIndent(unsigned int indent); + + virtual void SetImageList(wxImageList *imageList); + virtual void SetStateImageList(wxImageList *imageList); + + virtual wxString GetItemText(const wxTreeItemId& item) const; + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const; + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; + virtual wxFont GetItemFont(const wxTreeItemId& item) const; + + virtual void SetItemText(const wxTreeItemId& item, const wxString& text); + virtual void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); + virtual void SetItemDropHighlight(const wxTreeItemId& item, + bool highlight = true); + virtual void SetItemTextColour(const wxTreeItemId& item, + const wxColour& col); + virtual void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col); + virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); + + // item status inquiries + // --------------------- + + virtual bool IsVisible(const wxTreeItemId& item) const; + virtual bool ItemHasChildren(const wxTreeItemId& item) const; + virtual bool IsExpanded(const wxTreeItemId& item) const; + virtual bool IsSelected(const wxTreeItemId& item) const; + virtual bool IsBold(const wxTreeItemId& item) const; + + virtual size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = true) const; + + // navigation + // ---------- + + virtual wxTreeItemId GetRootItem() const; + virtual wxTreeItemId GetSelection() const; + virtual size_t GetSelections(wxArrayTreeItemIds& selections) const; + + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const; + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const; + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + virtual wxTreeItemId GetFirstVisibleItem() const; + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + // operations + // ---------- + + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + virtual void Delete(const wxTreeItemId& item); + virtual void DeleteChildren(const wxTreeItemId& item); + virtual void DeleteAllItems(); + + virtual void Expand(const wxTreeItemId& item); + virtual void Collapse(const wxTreeItemId& item); + virtual void CollapseAndReset(const wxTreeItemId& item); + virtual void Toggle(const wxTreeItemId& item); + + virtual void Unselect(); + virtual void UnselectAll(); + virtual void SelectItem(const wxTreeItemId& item, bool select = true); + + virtual void EnsureVisible(const wxTreeItemId& item); + virtual void ScrollTo(const wxTreeItemId& item); + + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + virtual wxTextCtrl *GetEditControl() const; + virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), + bool discardChanges = false) + { + DoEndEditLabel(discardChanges); + } + + virtual void SortChildren(const wxTreeItemId& item); + + virtual bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = false) const; + + // deprecated + // ---------- + +#if WXWIN_COMPATIBILITY_2_4 + // these methods are deprecated and will be removed in future versions of + // wxWidgets, they're here for compatibility only, don't use them in new + // code (the comments indicate why these methods are now useless and how to + // replace them) + + // use Expand, Collapse, CollapseAndReset or Toggle + wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) ); + + // use Set/GetImageList and Set/GetStateImageList + // Use base class GetImageList() + wxDEPRECATED( void SetImageList(wxImageList *imageList, int) ); + + // use Set/GetItemImage directly + wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); + wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); + + // use the versions taking wxTreeItemIdValue cookies + wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, + long& cookie) const ); + wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, + long& cookie) const ); +#endif // WXWIN_COMPATIBILITY_2_4 + + + // implementation + // -------------- + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWShouldPreProcessMessage(WXMSG* msg); + + // override some base class virtuals + virtual bool SetBackgroundColour(const wxColour &colour); + virtual bool SetForegroundColour(const wxColour &colour); + + // get/set the check state for the item (only for wxTR_MULTIPLE) + bool IsItemChecked(const wxTreeItemId& item) const; + void SetItemCheck(const wxTreeItemId& item, bool check = true); + + // set/get the item state.image (state == -1 means cycle to the next one) + void SetState(const wxTreeItemId& node, int state); + int GetState(const wxTreeItemId& node); + +protected: + // SetImageList helper + void SetAnyImageList(wxImageList *imageList, int which); + + // refresh a single item + void RefreshItem(const wxTreeItemId& item); + + // end edit label + void DoEndEditLabel(bool discardChanges = false); + + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data); + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL); + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; + + // obtain the user data for the lParam member of TV_ITEM + class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; + + + // data used only while editing the item label: + wxTextCtrl *m_textCtrl; // text control in which it is edited + wxTreeItemId m_idEdited; // the item being edited + +private: + // the common part of all ctors + void Init(); + + // helper functions + bool DoGetItem(wxTreeViewItem *tvItem) const; + void DoSetItem(wxTreeViewItem *tvItem); + + void DoExpand(const wxTreeItemId& item, int flag); + + void DeleteTextCtrl(); + + // return true if the item is the hidden root one (i.e. it's the root item + // and the tree has wxTR_HIDE_ROOT style) + bool IsHiddenRoot(const wxTreeItemId& item) const; + + + // the hash storing the items attributes (indexed by item ids) + wxMapTreeAttr m_attrs; + + // true if the hash above is not empty + bool m_hasAnyAttr; + +#if wxUSE_DRAGIMAGE + // used for dragging + wxDragImage *m_dragImage; +#endif + + // Virtual root item, if wxTR_HIDE_ROOT is set. + void* m_pVirtualRoot; + + // the starting item for selection with Shift + wxTreeItemId m_htSelStart, m_htClickedItem; + wxPoint m_ptClick; + + friend class wxTreeItemIndirectData; + friend class wxTreeSortHelper; + + DECLARE_DYNAMIC_CLASS(wxTreeCtrl) + DECLARE_NO_COPY_CLASS(wxTreeCtrl) +}; + +#endif // wxUSE_TREECTRL + +#endif // _WX_MSW_TREECTRL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/uxtheme.h b/Externals/wxWidgets/include/wx/msw/uxtheme.h index 23e745fc9e..ba64a87b50 100644 --- a/Externals/wxWidgets/include/wx/msw/uxtheme.h +++ b/Externals/wxWidgets/include/wx/msw/uxtheme.h @@ -1,230 +1,230 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/uxtheme.h -// Purpose: wxUxThemeEngine class: support for XP themes -// Author: John Platts, Vadim Zeitlin -// Modified by: -// Created: 2003 -// RCS-ID: $Id: uxtheme.h 42725 2006-10-30 15:37:42Z VZ $ -// Copyright: (c) 2003 John Platts, Vadim Zeitlin -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UXTHEME_H_ -#define _WX_UXTHEME_H_ - -#include "wx/defs.h" - -#include "wx/msw/private.h" // we use GetHwndOf() -#include "wx/msw/uxthemep.h" - -typedef HTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(HWND, const wchar_t *); -typedef HRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(HTHEME); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(HTHEME, HDC, int, int, const RECT *, const RECT *); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, DWORD, const RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME, HDC, int, int, const RECT *, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(HTHEME, HDC, int, int, const RECT *, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(HTHEME, HDC, int, int, const RECT *, /* enum */ THEMESIZE, SIZE *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, const RECT *, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(HTHEME, HDC, int, int, TEXTMETRIC*); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(HTHEME, HDC, int, int, const RECT *, HRGN *); -typedef HRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(HTHEME, HDC, int, int, DWORD, const RECT *, HRGN, POINT, unsigned short *); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(HTHEME, HDC, int, int, const RECT *, unsigned int, unsigned int, RECT *); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(HTHEME, HDC, int, int, const RECT *, HIMAGELIST, int); -typedef BOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(HTHEME, int, int); -typedef BOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HTHEME, int, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(HTHEME, int, int, int, COLORREF*); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(HTHEME, HDC, int, int, int, int *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESTRING)(HTHEME, int, int, int, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(HTHEME, int, int, int, BOOL *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEINT)(HTHEME, int, int, int, int *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(HTHEME, int, int, int, int *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(HTHEME, int, int, int, POINT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEFONT)(HTHEME, HDC, int, int, int, LOGFONT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMERECT)(HTHEME, int, int, int, RECT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(HTHEME, HDC, int, int, int, RECT *, MARGINS *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(HTHEME, int, int, int, INTLIST*); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(HTHEME, int, int, int, /* enum */ PROPERTYORIGIN *); -typedef HRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(HWND, const wchar_t*, const wchar_t *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(HTHEME, int, int, int, wchar_t *, int); -typedef COLORREF(__stdcall *PFNWXUGETTHEMESYSCOLOR)(HTHEME, int); -typedef HBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(HTHEME, int); -typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(HTHEME, int); -typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(HTHEME, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(HTHEME, int, LOGFONT *); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(HTHEME, int, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(HTHEME, int, int *); -typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)(); -typedef BOOL (__stdcall *PFNWXUISAPPTHEMED)(); -typedef HTHEME (__stdcall *PFNWXUGETWINDOWTHEME)(HWND); -typedef HRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(HWND, DWORD); -typedef BOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(HWND); -typedef DWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)(); -typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(DWORD); -typedef HRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int, wchar_t *, int, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *, const wchar_t *, wchar_t *, int); -typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(HWND, HDC, RECT *); -typedef HRESULT (__stdcall *PFNWXUENABLETHEMING)(BOOL); - -// ---------------------------------------------------------------------------- -// wxUxThemeEngine: provides all theme functions from uxtheme.dll -// ---------------------------------------------------------------------------- - -// we always define this class, even if wxUSE_UXTHEME == 0, but we just make it -// empty in this case -- this allows to use it elsewhere without any #ifdefs -#if wxUSE_UXTHEME - #include "wx/dynlib.h" - - #define wxUX_THEME_DECLARE(type, func) type func; -#else - #define wxUX_THEME_DECLARE(type, func) type func(...) { return 0; } -#endif - -class WXDLLEXPORT wxUxThemeEngine -{ -public: - // get the theme engine or NULL if themes are not available - static wxUxThemeEngine *Get(); - - // get the theme enging or NULL if themes are not available or not used for - // this application - static wxUxThemeEngine *GetIfActive(); - - // all uxtheme.dll functions - wxUX_THEME_DECLARE(PFNWXUOPENTHEMEDATA, OpenThemeData) - wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXT, DrawThemeText) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize) - wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTEXTENT, GetThemeTextExtent) - wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTMETRICS, GetThemeTextMetrics) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDREGION, GetThemeBackgroundRegion) - wxUX_THEME_DECLARE(PFNWXUHITTESTTHEMEBACKGROUND, HitTestThemeBackground) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEEDGE, DrawThemeEdge) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEICON, DrawThemeIcon) - wxUX_THEME_DECLARE(PFNWXUISTHEMEPARTDEFINED, IsThemePartDefined) - wxUX_THEME_DECLARE(PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT, IsThemeBackgroundPartiallyTransparent) - wxUX_THEME_DECLARE(PFNWXUGETTHEMECOLOR, GetThemeColor) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEMETRIC, GetThemeMetric) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESTRING, GetThemeString) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEBOOL, GetThemeBool) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEINT, GetThemeInt) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEENUMVALUE, GetThemeEnumValue) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEPOSITION, GetThemePosition) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEFONT, GetThemeFont) - wxUX_THEME_DECLARE(PFNWXUGETTHEMERECT, GetThemeRect) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEMARGINS, GetThemeMargins) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEINTLIST, GetThemeIntList) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEPROPERTYORIGIN, GetThemePropertyOrigin) - wxUX_THEME_DECLARE(PFNWXUSETWINDOWTHEME, SetWindowTheme) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEFILENAME, GetThemeFilename) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLOR, GetThemeSysColor) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLORBRUSH, GetThemeSysColorBrush) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSBOOL, GetThemeSysBool) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSIZE, GetThemeSysSize) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSFONT, GetThemeSysFont) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSTRING, GetThemeSysString) - wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSINT, GetThemeSysInt) - wxUX_THEME_DECLARE(PFNWXUISTHEMEACTIVE, IsThemeActive) - wxUX_THEME_DECLARE(PFNWXUISAPPTHEMED, IsAppThemed) - wxUX_THEME_DECLARE(PFNWXUGETWINDOWTHEME, GetWindowTheme) - wxUX_THEME_DECLARE(PFNWXUENABLETHEMEDIALOGTEXTURE, EnableThemeDialogTexture) - wxUX_THEME_DECLARE(PFNWXUISTHEMEDIALOGTEXTUREENABLED, IsThemeDialogTextureEnabled) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEAPPPROPERTIES, GetThemeAppProperties) - wxUX_THEME_DECLARE(PFNWXUSETTHEMEAPPPROPERTIES, SetThemeAppProperties) - wxUX_THEME_DECLARE(PFNWXUGETCURRENTTHEMENAME, GetCurrentThemeName) - wxUX_THEME_DECLARE(PFNWXUGETTHEMEDOCUMENTATIONPROPERTY, GetThemeDocumentationProperty) - wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEPARENTBACKGROUND, DrawThemeParentBackground) - wxUX_THEME_DECLARE(PFNWXUENABLETHEMING, EnableTheming) - -private: - // construcor is private as only Get() can create us and is also trivial as - // everything really happens in Initialize() - wxUxThemeEngine() { } - - // destructor is private as only Get() and wxUxThemeModule delete us, it is - // not virtual as we're not supposed to be derived from - ~wxUxThemeEngine() { } - -#if wxUSE_UXTHEME - // initialize the theme engine: load the DLL, resolve the functions - // - // return true if we can be used, false if themes are not available - bool Initialize(); - - - // uxtheme.dll - wxDynamicLibrary m_dllUxTheme; - - - // the one and only theme engine, initially NULL - static wxUxThemeEngine *ms_themeEngine; - - // this is a bool which initially has the value -1 meaning "unknown" - static int ms_isThemeEngineAvailable; - - // it must be able to delete us - friend class wxUxThemeModule; -#endif // wxUSE_UXTHEME - - DECLARE_NO_COPY_CLASS(wxUxThemeEngine) -}; - -#if wxUSE_UXTHEME - -/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() -{ - wxUxThemeEngine *engine = Get(); - return engine && engine->IsAppThemed() && engine->IsThemeActive() - ? engine - : NULL; -} - -#else // !wxUSE_UXTHEME - -/* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get() -{ - return NULL; -} - -/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() -{ - return NULL; -} - -#endif // wxUSE_UXTHEME/!wxUSE_UXTHEME - -// ---------------------------------------------------------------------------- -// wxUxThemeHandle: encapsulates ::Open/CloseThemeData() -// ---------------------------------------------------------------------------- - -class wxUxThemeHandle -{ -public: - wxUxThemeHandle(const wxWindow *win, const wchar_t *classes) - { - wxUxThemeEngine *engine = wxUxThemeEngine::Get(); - - m_hTheme = engine ? (HTHEME)engine->OpenThemeData(GetHwndOf(win), classes) - : NULL; - } - - operator HTHEME() const { return m_hTheme; } - - ~wxUxThemeHandle() - { - if ( m_hTheme ) - { - wxUxThemeEngine::Get()->CloseThemeData(m_hTheme); - } - } - -private: - HTHEME m_hTheme; - - DECLARE_NO_COPY_CLASS(wxUxThemeHandle) -}; - -#endif // _WX_UXTHEME_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/uxtheme.h +// Purpose: wxUxThemeEngine class: support for XP themes +// Author: John Platts, Vadim Zeitlin +// Modified by: +// Created: 2003 +// RCS-ID: $Id: uxtheme.h 42725 2006-10-30 15:37:42Z VZ $ +// Copyright: (c) 2003 John Platts, Vadim Zeitlin +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UXTHEME_H_ +#define _WX_UXTHEME_H_ + +#include "wx/defs.h" + +#include "wx/msw/private.h" // we use GetHwndOf() +#include "wx/msw/uxthemep.h" + +typedef HTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(HWND, const wchar_t *); +typedef HRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(HTHEME); +typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(HTHEME, HDC, int, int, const RECT *, const RECT *); +typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, DWORD, const RECT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME, HDC, int, int, const RECT *, RECT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(HTHEME, HDC, int, int, const RECT *, RECT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(HTHEME, HDC, int, int, const RECT *, /* enum */ THEMESIZE, SIZE *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, const RECT *, RECT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(HTHEME, HDC, int, int, TEXTMETRIC*); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(HTHEME, HDC, int, int, const RECT *, HRGN *); +typedef HRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(HTHEME, HDC, int, int, DWORD, const RECT *, HRGN, POINT, unsigned short *); +typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(HTHEME, HDC, int, int, const RECT *, unsigned int, unsigned int, RECT *); +typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(HTHEME, HDC, int, int, const RECT *, HIMAGELIST, int); +typedef BOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(HTHEME, int, int); +typedef BOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HTHEME, int, int); +typedef HRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(HTHEME, int, int, int, COLORREF*); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(HTHEME, HDC, int, int, int, int *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMESTRING)(HTHEME, int, int, int, wchar_t *, int); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(HTHEME, int, int, int, BOOL *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEINT)(HTHEME, int, int, int, int *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(HTHEME, int, int, int, int *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(HTHEME, int, int, int, POINT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEFONT)(HTHEME, HDC, int, int, int, LOGFONT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMERECT)(HTHEME, int, int, int, RECT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(HTHEME, HDC, int, int, int, RECT *, MARGINS *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(HTHEME, int, int, int, INTLIST*); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(HTHEME, int, int, int, /* enum */ PROPERTYORIGIN *); +typedef HRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(HWND, const wchar_t*, const wchar_t *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(HTHEME, int, int, int, wchar_t *, int); +typedef COLORREF(__stdcall *PFNWXUGETTHEMESYSCOLOR)(HTHEME, int); +typedef HBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(HTHEME, int); +typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(HTHEME, int); +typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(HTHEME, int); +typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(HTHEME, int, LOGFONT *); +typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(HTHEME, int, wchar_t *, int); +typedef HRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(HTHEME, int, int *); +typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)(); +typedef BOOL (__stdcall *PFNWXUISAPPTHEMED)(); +typedef HTHEME (__stdcall *PFNWXUGETWINDOWTHEME)(HWND); +typedef HRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(HWND, DWORD); +typedef BOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(HWND); +typedef DWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)(); +typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(DWORD); +typedef HRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int, wchar_t *, int, wchar_t *, int); +typedef HRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *, const wchar_t *, wchar_t *, int); +typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(HWND, HDC, RECT *); +typedef HRESULT (__stdcall *PFNWXUENABLETHEMING)(BOOL); + +// ---------------------------------------------------------------------------- +// wxUxThemeEngine: provides all theme functions from uxtheme.dll +// ---------------------------------------------------------------------------- + +// we always define this class, even if wxUSE_UXTHEME == 0, but we just make it +// empty in this case -- this allows to use it elsewhere without any #ifdefs +#if wxUSE_UXTHEME + #include "wx/dynlib.h" + + #define wxUX_THEME_DECLARE(type, func) type func; +#else + #define wxUX_THEME_DECLARE(type, func) type func(...) { return 0; } +#endif + +class WXDLLEXPORT wxUxThemeEngine +{ +public: + // get the theme engine or NULL if themes are not available + static wxUxThemeEngine *Get(); + + // get the theme enging or NULL if themes are not available or not used for + // this application + static wxUxThemeEngine *GetIfActive(); + + // all uxtheme.dll functions + wxUX_THEME_DECLARE(PFNWXUOPENTHEMEDATA, OpenThemeData) + wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData) + wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground) + wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXT, DrawThemeText) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize) + wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTEXTENT, GetThemeTextExtent) + wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTMETRICS, GetThemeTextMetrics) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDREGION, GetThemeBackgroundRegion) + wxUX_THEME_DECLARE(PFNWXUHITTESTTHEMEBACKGROUND, HitTestThemeBackground) + wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEEDGE, DrawThemeEdge) + wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEICON, DrawThemeIcon) + wxUX_THEME_DECLARE(PFNWXUISTHEMEPARTDEFINED, IsThemePartDefined) + wxUX_THEME_DECLARE(PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT, IsThemeBackgroundPartiallyTransparent) + wxUX_THEME_DECLARE(PFNWXUGETTHEMECOLOR, GetThemeColor) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEMETRIC, GetThemeMetric) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESTRING, GetThemeString) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEBOOL, GetThemeBool) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEINT, GetThemeInt) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEENUMVALUE, GetThemeEnumValue) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEPOSITION, GetThemePosition) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEFONT, GetThemeFont) + wxUX_THEME_DECLARE(PFNWXUGETTHEMERECT, GetThemeRect) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEMARGINS, GetThemeMargins) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEINTLIST, GetThemeIntList) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEPROPERTYORIGIN, GetThemePropertyOrigin) + wxUX_THEME_DECLARE(PFNWXUSETWINDOWTHEME, SetWindowTheme) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEFILENAME, GetThemeFilename) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLOR, GetThemeSysColor) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLORBRUSH, GetThemeSysColorBrush) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSBOOL, GetThemeSysBool) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSIZE, GetThemeSysSize) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSFONT, GetThemeSysFont) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSTRING, GetThemeSysString) + wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSINT, GetThemeSysInt) + wxUX_THEME_DECLARE(PFNWXUISTHEMEACTIVE, IsThemeActive) + wxUX_THEME_DECLARE(PFNWXUISAPPTHEMED, IsAppThemed) + wxUX_THEME_DECLARE(PFNWXUGETWINDOWTHEME, GetWindowTheme) + wxUX_THEME_DECLARE(PFNWXUENABLETHEMEDIALOGTEXTURE, EnableThemeDialogTexture) + wxUX_THEME_DECLARE(PFNWXUISTHEMEDIALOGTEXTUREENABLED, IsThemeDialogTextureEnabled) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEAPPPROPERTIES, GetThemeAppProperties) + wxUX_THEME_DECLARE(PFNWXUSETTHEMEAPPPROPERTIES, SetThemeAppProperties) + wxUX_THEME_DECLARE(PFNWXUGETCURRENTTHEMENAME, GetCurrentThemeName) + wxUX_THEME_DECLARE(PFNWXUGETTHEMEDOCUMENTATIONPROPERTY, GetThemeDocumentationProperty) + wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEPARENTBACKGROUND, DrawThemeParentBackground) + wxUX_THEME_DECLARE(PFNWXUENABLETHEMING, EnableTheming) + +private: + // construcor is private as only Get() can create us and is also trivial as + // everything really happens in Initialize() + wxUxThemeEngine() { } + + // destructor is private as only Get() and wxUxThemeModule delete us, it is + // not virtual as we're not supposed to be derived from + ~wxUxThemeEngine() { } + +#if wxUSE_UXTHEME + // initialize the theme engine: load the DLL, resolve the functions + // + // return true if we can be used, false if themes are not available + bool Initialize(); + + + // uxtheme.dll + wxDynamicLibrary m_dllUxTheme; + + + // the one and only theme engine, initially NULL + static wxUxThemeEngine *ms_themeEngine; + + // this is a bool which initially has the value -1 meaning "unknown" + static int ms_isThemeEngineAvailable; + + // it must be able to delete us + friend class wxUxThemeModule; +#endif // wxUSE_UXTHEME + + DECLARE_NO_COPY_CLASS(wxUxThemeEngine) +}; + +#if wxUSE_UXTHEME + +/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() +{ + wxUxThemeEngine *engine = Get(); + return engine && engine->IsAppThemed() && engine->IsThemeActive() + ? engine + : NULL; +} + +#else // !wxUSE_UXTHEME + +/* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get() +{ + return NULL; +} + +/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() +{ + return NULL; +} + +#endif // wxUSE_UXTHEME/!wxUSE_UXTHEME + +// ---------------------------------------------------------------------------- +// wxUxThemeHandle: encapsulates ::Open/CloseThemeData() +// ---------------------------------------------------------------------------- + +class wxUxThemeHandle +{ +public: + wxUxThemeHandle(const wxWindow *win, const wchar_t *classes) + { + wxUxThemeEngine *engine = wxUxThemeEngine::Get(); + + m_hTheme = engine ? (HTHEME)engine->OpenThemeData(GetHwndOf(win), classes) + : NULL; + } + + operator HTHEME() const { return m_hTheme; } + + ~wxUxThemeHandle() + { + if ( m_hTheme ) + { + wxUxThemeEngine::Get()->CloseThemeData(m_hTheme); + } + } + +private: + HTHEME m_hTheme; + + DECLARE_NO_COPY_CLASS(wxUxThemeHandle) +}; + +#endif // _WX_UXTHEME_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/uxthemep.h b/Externals/wxWidgets/include/wx/msw/uxthemep.h index bc2fda91d4..9dc75c7806 100644 --- a/Externals/wxWidgets/include/wx/msw/uxthemep.h +++ b/Externals/wxWidgets/include/wx/msw/uxthemep.h @@ -1,169 +1,169 @@ -/* - * Win32 5.1 theme definitions - * - * Copyright (C) 2003 Kevin Koltzau - * - * Originally written for the Wine project, and issued under - * the wxWindows License by kind permission of the author. - * - * License: wxWindows License - */ - -#ifndef __WINE_UXTHEME_H -#define __WINE_UXTHEME_H - -#include "wx/msw/wrapcctl.h" - -typedef HANDLE HTHEME; - -HRESULT WINAPI CloseThemeData(HTHEME hTheme); -HRESULT WINAPI DrawThemeBackground(HTHEME,HDC,int,int,const RECT*,const RECT*); - -#define DTBG_CLIPRECT 0x00000001 -#define DTBG_DRAWSOLID 0x00000002 -#define DTBG_OMITBORDER 0x00000004 -#define DTBG_OMITCONTENT 0x00000008 -#define DTBG_COMPUTINGREGION 0x00000010 -#define DTBG_MIRRORDC 0x00000020 - -typedef struct _DTBGOPTS { - DWORD dwSize; - DWORD dwFlags; - RECT rcClip; -} DTBGOPTS, *PDTBGOPTS; - -HRESULT WINAPI DrawThemeBackgroundEx(HTHEME,HDC,int,int,const RECT*, - const DTBGOPTS*); -HRESULT WINAPI DrawThemeEdge(HTHEME,HDC,int,int,const RECT*,UINT,UINT, - RECT*); -HRESULT WINAPI DrawThemeIcon(HTHEME,HDC,int,int,const RECT*,HIMAGELIST,int); -HRESULT WINAPI DrawThemeParentBackground(HWND,HDC,RECT*); - -#define DTT_GRAYED 0x1 - -HRESULT WINAPI DrawThemeText(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD, - const RECT*); - -#define ETDT_DISABLE 0x00000001 -#define ETDT_ENABLE 0x00000002 -#define ETDT_USETABTEXTURE 0x00000004 -#define ETDT_ENABLETAB (ETDT_ENABLE|ETDT_USETABTEXTURE) - -HRESULT WINAPI EnableThemeDialogTexture(HWND,DWORD); -HRESULT WINAPI EnableTheming(BOOL); -HRESULT WINAPI GetCurrentThemeName(LPWSTR,int,LPWSTR,int,LPWSTR,int); - -#define STAP_ALLOW_NONCLIENT (1<<0) -#define STAP_ALLOW_CONTROLS (1<<1) -#define STAP_ALLOW_WEBCONTENT (1<<2) - -DWORD WINAPI GetThemeAppProperties(void); -HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME,HDC,int,int, - const RECT*,RECT*); -HRESULT WINAPI GetThemeBackgroundExtent(HTHEME,HDC,int,int,const RECT*,RECT*); -HRESULT WINAPI GetThemeBackgroundRegion(HTHEME,HDC,int,int,const RECT*,HRGN*); -HRESULT WINAPI GetThemeBool(HTHEME,int,int,int,BOOL*); -HRESULT WINAPI GetThemeColor(HTHEME,int,int,int,COLORREF*); - -#if defined(__GNUC__) -# define SZ_THDOCPROP_DISPLAYNAME (const WCHAR []){ 'D','i','s','p','l','a','y','N','a','m','e',0 } -# define SZ_THDOCPROP_CANONICALNAME (const WCHAR []){ 'T','h','e','m','e','N','a','m','e',0 } -# define SZ_THDOCPROP_TOOLTIP (const WCHAR []){ 'T','o','o','l','T','i','p',0 } -# define SZ_THDOCPROP_AUTHOR (const WCHAR []){ 'a','u','t','h','o','r',0 } -#else /* lif defined(_MSC_VER) */ -# define SZ_THDOCPROP_DISPLAYNAME L"DisplayName" -# define SZ_THDOCPROP_CANONICALNAME L"ThemeName" -# define SZ_THDOCPROP_TOOLTIP L"ToolTip" -# define SZ_THDOCPROP_AUTHOR L"author" -/* -#else -static const WCHAR SZ_THDOCPROP_DISPLAYNAME[] = { 'D','i','s','p','l','a','y','N','a','m','e',0 }; -static const WCHAR SZ_THDOCPROP_CANONICALNAME[] = { 'T','h','e','m','e','N','a','m','e',0 }; -static const WCHAR SZ_THDOCPROP_TOOLTIP[] = { 'T','o','o','l','T','i','p',0 }; -static const WCHAR SZ_THDOCPROP_AUTHOR[] = { 'a','u','t','h','o','r',0 }; -*/ -#endif - -HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR,LPCWSTR,LPWSTR,int); -HRESULT WINAPI GetThemeEnumValue(HTHEME,int,int,int,int*); -HRESULT WINAPI GetThemeFilename(HTHEME,int,int,int,LPWSTR,int); -HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONTW*); -HRESULT WINAPI GetThemeInt(HTHEME,int,int,int,int*); - -#define MAX_INTLIST_COUNT 10 -typedef struct _INTLIST { - int iValueCount; - int iValues[MAX_INTLIST_COUNT]; -} INTLIST, *PINTLIST; - -HRESULT WINAPI GetThemeIntList(HTHEME,int,int,int,INTLIST*); - -typedef struct _MARGINS { - int cxLeftWidth; - int cxRightWidth; - int cyTopHeight; - int cyBottomHeight; -} MARGINS, *PMARGINS; - -HRESULT WINAPI GetThemeMargins(HTHEME,HDC,int,int,int,RECT*,MARGINS*); -HRESULT WINAPI GetThemeMetric(HTHEME,HDC,int,int,int,int*); - -typedef enum { - TS_MIN, - TS_TRUE, - TS_DRAW -} THEMESIZE; - -HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEMESIZE,SIZE*); -HRESULT WINAPI GetThemePosition(HTHEME,int,int,int,POINT*); - -typedef enum { - PO_STATE, - PO_PART, - PO_CLASS, - PO_GLOBAL, - PO_NOTFOUND -} PROPERTYORIGIN; - -HRESULT WINAPI GetThemePropertyOrigin(HTHEME,int,int,int,PROPERTYORIGIN*); -HRESULT WINAPI GetThemeRect(HTHEME,int,int,int,RECT*); -HRESULT WINAPI GetThemeString(HTHEME,int,int,int,LPWSTR,int); -BOOL WINAPI GetThemeSysBool(HTHEME,int); -COLORREF WINAPI GetThemeSysColor(HTHEME,int); -HBRUSH WINAPI GetThemeSysColorBrush(HTHEME,int); -HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONTW*); -HRESULT WINAPI GetThemeSysInt(HTHEME,int,int*); -int WINAPI GetThemeSysSize(HTHEME,int); -HRESULT WINAPI GetThemeSysString(HTHEME,int,LPWSTR,int); -HRESULT WINAPI GetThemeTextExtent(HTHEME,HDC,int,int,LPCWSTR,int,DWORD, - const RECT*,RECT*); -HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRICW*); -HTHEME WINAPI GetWindowTheme(HWND); - -#define HTTB_BACKGROUNDSEG 0x0000 -#define HTTB_FIXEDBORDER 0x0002 -#define HTTB_CAPTION 0x0004 -#define HTTB_RESIZINGBORDER_LEFT 0x0010 -#define HTTB_RESIZINGBORDER_TOP 0x0020 -#define HTTB_RESIZINGBORDER_RIGHT 0x0040 -#define HTTB_RESIZINGBORDER_BOTTOM 0x0080 -#define HTTB_RESIZINGBORDER \ - (HTTB_RESIZINGBORDER_LEFT|HTTB_RESIZINGBORDER_TOP|\ - HTTB_RESIZINGBORDER_RIGHT|HTTB_RESIZINGBORDER_BOTTOM) -#define HTTB_SIZINGTEMPLATE 0x0100 -#define HTTB_SYSTEMSIZINGMARGINS 0x0200 - -HRESULT WINAPI HitTestThemeBackground(HTHEME,HDC,int,int,DWORD,const RECT*, - HRGN,POINT,WORD*); -BOOL WINAPI IsAppThemed(void); -BOOL WINAPI IsThemeActive(void); -BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME,int,int); -BOOL WINAPI IsThemeDialogTextureEnabled(void); -BOOL WINAPI IsThemePartDefined(HTHEME,int,int); -HTHEME WINAPI OpenThemeData(HWND,LPCWSTR); -void WINAPI SetThemeAppProperties(DWORD); -HRESULT WINAPI SetWindowTheme(HWND,LPCWSTR,LPCWSTR); - - -#endif - +/* + * Win32 5.1 theme definitions + * + * Copyright (C) 2003 Kevin Koltzau + * + * Originally written for the Wine project, and issued under + * the wxWindows License by kind permission of the author. + * + * License: wxWindows License + */ + +#ifndef __WINE_UXTHEME_H +#define __WINE_UXTHEME_H + +#include "wx/msw/wrapcctl.h" + +typedef HANDLE HTHEME; + +HRESULT WINAPI CloseThemeData(HTHEME hTheme); +HRESULT WINAPI DrawThemeBackground(HTHEME,HDC,int,int,const RECT*,const RECT*); + +#define DTBG_CLIPRECT 0x00000001 +#define DTBG_DRAWSOLID 0x00000002 +#define DTBG_OMITBORDER 0x00000004 +#define DTBG_OMITCONTENT 0x00000008 +#define DTBG_COMPUTINGREGION 0x00000010 +#define DTBG_MIRRORDC 0x00000020 + +typedef struct _DTBGOPTS { + DWORD dwSize; + DWORD dwFlags; + RECT rcClip; +} DTBGOPTS, *PDTBGOPTS; + +HRESULT WINAPI DrawThemeBackgroundEx(HTHEME,HDC,int,int,const RECT*, + const DTBGOPTS*); +HRESULT WINAPI DrawThemeEdge(HTHEME,HDC,int,int,const RECT*,UINT,UINT, + RECT*); +HRESULT WINAPI DrawThemeIcon(HTHEME,HDC,int,int,const RECT*,HIMAGELIST,int); +HRESULT WINAPI DrawThemeParentBackground(HWND,HDC,RECT*); + +#define DTT_GRAYED 0x1 + +HRESULT WINAPI DrawThemeText(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD, + const RECT*); + +#define ETDT_DISABLE 0x00000001 +#define ETDT_ENABLE 0x00000002 +#define ETDT_USETABTEXTURE 0x00000004 +#define ETDT_ENABLETAB (ETDT_ENABLE|ETDT_USETABTEXTURE) + +HRESULT WINAPI EnableThemeDialogTexture(HWND,DWORD); +HRESULT WINAPI EnableTheming(BOOL); +HRESULT WINAPI GetCurrentThemeName(LPWSTR,int,LPWSTR,int,LPWSTR,int); + +#define STAP_ALLOW_NONCLIENT (1<<0) +#define STAP_ALLOW_CONTROLS (1<<1) +#define STAP_ALLOW_WEBCONTENT (1<<2) + +DWORD WINAPI GetThemeAppProperties(void); +HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME,HDC,int,int, + const RECT*,RECT*); +HRESULT WINAPI GetThemeBackgroundExtent(HTHEME,HDC,int,int,const RECT*,RECT*); +HRESULT WINAPI GetThemeBackgroundRegion(HTHEME,HDC,int,int,const RECT*,HRGN*); +HRESULT WINAPI GetThemeBool(HTHEME,int,int,int,BOOL*); +HRESULT WINAPI GetThemeColor(HTHEME,int,int,int,COLORREF*); + +#if defined(__GNUC__) +# define SZ_THDOCPROP_DISPLAYNAME (const WCHAR []){ 'D','i','s','p','l','a','y','N','a','m','e',0 } +# define SZ_THDOCPROP_CANONICALNAME (const WCHAR []){ 'T','h','e','m','e','N','a','m','e',0 } +# define SZ_THDOCPROP_TOOLTIP (const WCHAR []){ 'T','o','o','l','T','i','p',0 } +# define SZ_THDOCPROP_AUTHOR (const WCHAR []){ 'a','u','t','h','o','r',0 } +#else /* lif defined(_MSC_VER) */ +# define SZ_THDOCPROP_DISPLAYNAME L"DisplayName" +# define SZ_THDOCPROP_CANONICALNAME L"ThemeName" +# define SZ_THDOCPROP_TOOLTIP L"ToolTip" +# define SZ_THDOCPROP_AUTHOR L"author" +/* +#else +static const WCHAR SZ_THDOCPROP_DISPLAYNAME[] = { 'D','i','s','p','l','a','y','N','a','m','e',0 }; +static const WCHAR SZ_THDOCPROP_CANONICALNAME[] = { 'T','h','e','m','e','N','a','m','e',0 }; +static const WCHAR SZ_THDOCPROP_TOOLTIP[] = { 'T','o','o','l','T','i','p',0 }; +static const WCHAR SZ_THDOCPROP_AUTHOR[] = { 'a','u','t','h','o','r',0 }; +*/ +#endif + +HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR,LPCWSTR,LPWSTR,int); +HRESULT WINAPI GetThemeEnumValue(HTHEME,int,int,int,int*); +HRESULT WINAPI GetThemeFilename(HTHEME,int,int,int,LPWSTR,int); +HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONTW*); +HRESULT WINAPI GetThemeInt(HTHEME,int,int,int,int*); + +#define MAX_INTLIST_COUNT 10 +typedef struct _INTLIST { + int iValueCount; + int iValues[MAX_INTLIST_COUNT]; +} INTLIST, *PINTLIST; + +HRESULT WINAPI GetThemeIntList(HTHEME,int,int,int,INTLIST*); + +typedef struct _MARGINS { + int cxLeftWidth; + int cxRightWidth; + int cyTopHeight; + int cyBottomHeight; +} MARGINS, *PMARGINS; + +HRESULT WINAPI GetThemeMargins(HTHEME,HDC,int,int,int,RECT*,MARGINS*); +HRESULT WINAPI GetThemeMetric(HTHEME,HDC,int,int,int,int*); + +typedef enum { + TS_MIN, + TS_TRUE, + TS_DRAW +} THEMESIZE; + +HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEMESIZE,SIZE*); +HRESULT WINAPI GetThemePosition(HTHEME,int,int,int,POINT*); + +typedef enum { + PO_STATE, + PO_PART, + PO_CLASS, + PO_GLOBAL, + PO_NOTFOUND +} PROPERTYORIGIN; + +HRESULT WINAPI GetThemePropertyOrigin(HTHEME,int,int,int,PROPERTYORIGIN*); +HRESULT WINAPI GetThemeRect(HTHEME,int,int,int,RECT*); +HRESULT WINAPI GetThemeString(HTHEME,int,int,int,LPWSTR,int); +BOOL WINAPI GetThemeSysBool(HTHEME,int); +COLORREF WINAPI GetThemeSysColor(HTHEME,int); +HBRUSH WINAPI GetThemeSysColorBrush(HTHEME,int); +HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONTW*); +HRESULT WINAPI GetThemeSysInt(HTHEME,int,int*); +int WINAPI GetThemeSysSize(HTHEME,int); +HRESULT WINAPI GetThemeSysString(HTHEME,int,LPWSTR,int); +HRESULT WINAPI GetThemeTextExtent(HTHEME,HDC,int,int,LPCWSTR,int,DWORD, + const RECT*,RECT*); +HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRICW*); +HTHEME WINAPI GetWindowTheme(HWND); + +#define HTTB_BACKGROUNDSEG 0x0000 +#define HTTB_FIXEDBORDER 0x0002 +#define HTTB_CAPTION 0x0004 +#define HTTB_RESIZINGBORDER_LEFT 0x0010 +#define HTTB_RESIZINGBORDER_TOP 0x0020 +#define HTTB_RESIZINGBORDER_RIGHT 0x0040 +#define HTTB_RESIZINGBORDER_BOTTOM 0x0080 +#define HTTB_RESIZINGBORDER \ + (HTTB_RESIZINGBORDER_LEFT|HTTB_RESIZINGBORDER_TOP|\ + HTTB_RESIZINGBORDER_RIGHT|HTTB_RESIZINGBORDER_BOTTOM) +#define HTTB_SIZINGTEMPLATE 0x0100 +#define HTTB_SYSTEMSIZINGMARGINS 0x0200 + +HRESULT WINAPI HitTestThemeBackground(HTHEME,HDC,int,int,DWORD,const RECT*, + HRGN,POINT,WORD*); +BOOL WINAPI IsAppThemed(void); +BOOL WINAPI IsThemeActive(void); +BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME,int,int); +BOOL WINAPI IsThemeDialogTextureEnabled(void); +BOOL WINAPI IsThemePartDefined(HTHEME,int,int); +HTHEME WINAPI OpenThemeData(HWND,LPCWSTR); +void WINAPI SetThemeAppProperties(DWORD); +HRESULT WINAPI SetWindowTheme(HWND,LPCWSTR,LPCWSTR); + + +#endif + diff --git a/Externals/wxWidgets/include/wx/msw/wince/checklst.h b/Externals/wxWidgets/include/wx/msw/wince/checklst.h index 39f8c5e698..76adae99d8 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/checklst.h +++ b/Externals/wxWidgets/include/wx/msw/wince/checklst.h @@ -1,95 +1,95 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/checklst.h -// Purpose: wxCheckListBox class - a listbox with checkable items -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 30.10.2005 -// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $ -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __CHECKLSTCE__H_ -#define __CHECKLSTCE__H_ - -class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase -{ -public: - // ctors - wxCheckListBox(); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - virtual ~wxCheckListBox(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - // override base class virtuals - virtual void Delete(unsigned int n); - - // items may be checked - virtual bool IsChecked(unsigned int uiIndex) const; - virtual void Check(unsigned int uiIndex, bool bCheck = true); - - // public interface derived from wxListBox and lower classes - virtual void Clear(); - virtual unsigned int GetCount() const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - virtual wxString GetString(unsigned int n) const; - virtual bool IsSelected(int n) const; - virtual void SetString(unsigned int n, const wxString& s); - - // Implementation - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); -protected: - - void OnSize(wxSizeEvent& event); - - // protected interface derived from wxListBox and lower classes - virtual int DoAppend(const wxString& item); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); - virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual void DoSetItems(const wxArrayString& items, void **clientData); - virtual void DoSetSelection(int n, bool select); - // convert our styles to Windows - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -private: - - wxArrayPtrVoid m_itemsClientData; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) -}; - -#endif //_CHECKLSTCE_H +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 30.10.2005 +// RCS-ID: $Id: checklst.h 38319 2006-03-23 22:05:23Z VZ $ +// Copyright: (c) Wlodzimierz Skiba +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __CHECKLSTCE__H_ +#define __CHECKLSTCE__H_ + +class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + virtual ~wxCheckListBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + // override base class virtuals + virtual void Delete(unsigned int n); + + // items may be checked + virtual bool IsChecked(unsigned int uiIndex) const; + virtual void Check(unsigned int uiIndex, bool bCheck = true); + + // public interface derived from wxListBox and lower classes + virtual void Clear(); + virtual unsigned int GetCount() const; + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + virtual wxString GetString(unsigned int n) const; + virtual bool IsSelected(int n) const; + virtual void SetString(unsigned int n, const wxString& s); + + // Implementation + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); +protected: + + void OnSize(wxSizeEvent& event); + + // protected interface derived from wxListBox and lower classes + virtual int DoAppend(const wxString& item); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); + virtual void DoSetFirstItem(int n); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + virtual void DoSetSelection(int n, bool select); + // convert our styles to Windows + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +private: + + wxArrayPtrVoid m_itemsClientData; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) +}; + +#endif //_CHECKLSTCE_H diff --git a/Externals/wxWidgets/include/wx/msw/wince/chkconf.h b/Externals/wxWidgets/include/wx/msw/wince/chkconf.h index c15a77fa06..c79f5ed5b2 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/chkconf.h +++ b/Externals/wxWidgets/include/wx/msw/wince/chkconf.h @@ -1,90 +1,90 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/chkconf.h -// Purpose: WinCE-specific configuration options checks -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-03-07 -// RCS-ID: $Id: chkconf.h 40023 2006-07-06 07:07:52Z ABX $ -// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WINCE_CHKCONF_H_ -#define _WX_MSW_WINCE_CHKCONF_H_ - -// Standard SDK lacks a few things, forcefully disable them -#ifdef WCE_PLATFORM_STANDARDSDK - // no shell functions support - #undef wxUSE_STDPATHS - #define wxUSE_STDPATHS 0 -#endif // WCE_PLATFORM_STANDARDSDK - -#if _WIN32_WCE < 400 - // not enough API and lack of ddraw.h - #undef wxUSE_DISPLAY - #define wxUSE_DISPLAY 0 -#endif - -// DDE doesn't exist under WinCE and wxIPC is DDE-based under MSW -#undef wxUSE_IPC -#define wxUSE_IPC 0 - -// metafiles are not supported neither -#undef wxUSE_ENH_METAFILE -#define wxUSE_ENH_METAFILE 0 - -#undef wxUSE_METAFILE -#define wxUSE_METAFILE 0 - -// eVC doesn't support SEH -#undef wxUSE_ON_FATAL_EXCEPTION -#define wxUSE_ON_FATAL_EXCEPTION 0 - -#undef wxUSE_WXHTML_HELP -#define wxUSE_WXHTML_HELP 0 - -// libtiff and regex apparently don't compile with eVC (to check with eVC4?) -// and they're disabled for WinCE in build/bakefiles/{tiff|regex}.bkl so can't -// be enabled here -#undef wxUSE_LIBTIFF -#define wxUSE_LIBTIFF 0 - -#undef wxUSE_REGEX -#define wxUSE_REGEX 0 - -#undef wxUSE_DEBUGREPORT -#define wxUSE_DEBUGREPORT 0 - -// other MSW settings not supported by CE -#undef wxUSE_RICHEDIT -#define wxUSE_RICHEDIT 0 -#undef wxUSE_RICHEDIT2 -#define wxUSE_RICHEDIT2 0 - -#undef wxUSE_UXTHEME -#define wxUSE_UXTHEME 0 -#undef wxUSE_UXTHEME_AUTO -#define wxUSE_UXTHEME_AUTO 0 - -#undef wxUSE_UNICODE_MSLU -#define wxUSE_UNICODE_MSLU 0 - - -// Disable features which don't make sense for MS Smartphones -// (due to pointer device usage, limited controls or dialogs, file system) -#if defined(__SMARTPHONE__) - #undef wxUSE_LISTBOOK - #define wxUSE_LISTBOOK 0 - - #undef wxUSE_NOTEBOOK - #define wxUSE_NOTEBOOK 0 - - #undef wxUSE_STATUSBAR - #define wxUSE_STATUSBAR 0 - - #undef wxUSE_COLOURPICKERCTRL - #define wxUSE_COLOURPICKERCTRL 0 -#endif // __SMARTPHONE__ - -#endif // _WX_MSW_WINCE_CHKCONF_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/chkconf.h +// Purpose: WinCE-specific configuration options checks +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-03-07 +// RCS-ID: $Id: chkconf.h 40023 2006-07-06 07:07:52Z ABX $ +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WINCE_CHKCONF_H_ +#define _WX_MSW_WINCE_CHKCONF_H_ + +// Standard SDK lacks a few things, forcefully disable them +#ifdef WCE_PLATFORM_STANDARDSDK + // no shell functions support + #undef wxUSE_STDPATHS + #define wxUSE_STDPATHS 0 +#endif // WCE_PLATFORM_STANDARDSDK + +#if _WIN32_WCE < 400 + // not enough API and lack of ddraw.h + #undef wxUSE_DISPLAY + #define wxUSE_DISPLAY 0 +#endif + +// DDE doesn't exist under WinCE and wxIPC is DDE-based under MSW +#undef wxUSE_IPC +#define wxUSE_IPC 0 + +// metafiles are not supported neither +#undef wxUSE_ENH_METAFILE +#define wxUSE_ENH_METAFILE 0 + +#undef wxUSE_METAFILE +#define wxUSE_METAFILE 0 + +// eVC doesn't support SEH +#undef wxUSE_ON_FATAL_EXCEPTION +#define wxUSE_ON_FATAL_EXCEPTION 0 + +#undef wxUSE_WXHTML_HELP +#define wxUSE_WXHTML_HELP 0 + +// libtiff and regex apparently don't compile with eVC (to check with eVC4?) +// and they're disabled for WinCE in build/bakefiles/{tiff|regex}.bkl so can't +// be enabled here +#undef wxUSE_LIBTIFF +#define wxUSE_LIBTIFF 0 + +#undef wxUSE_REGEX +#define wxUSE_REGEX 0 + +#undef wxUSE_DEBUGREPORT +#define wxUSE_DEBUGREPORT 0 + +// other MSW settings not supported by CE +#undef wxUSE_RICHEDIT +#define wxUSE_RICHEDIT 0 +#undef wxUSE_RICHEDIT2 +#define wxUSE_RICHEDIT2 0 + +#undef wxUSE_UXTHEME +#define wxUSE_UXTHEME 0 +#undef wxUSE_UXTHEME_AUTO +#define wxUSE_UXTHEME_AUTO 0 + +#undef wxUSE_UNICODE_MSLU +#define wxUSE_UNICODE_MSLU 0 + + +// Disable features which don't make sense for MS Smartphones +// (due to pointer device usage, limited controls or dialogs, file system) +#if defined(__SMARTPHONE__) + #undef wxUSE_LISTBOOK + #define wxUSE_LISTBOOK 0 + + #undef wxUSE_NOTEBOOK + #define wxUSE_NOTEBOOK 0 + + #undef wxUSE_STATUSBAR + #define wxUSE_STATUSBAR 0 + + #undef wxUSE_COLOURPICKERCTRL + #define wxUSE_COLOURPICKERCTRL 0 +#endif // __SMARTPHONE__ + +#endif // _WX_MSW_WINCE_CHKCONF_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/wince/choicece.h b/Externals/wxWidgets/include/wx/msw/wince/choicece.h index c77f751720..0d3f738a97 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/choicece.h +++ b/Externals/wxWidgets/include/wx/msw/wince/choicece.h @@ -1,142 +1,142 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/choicece.h -// Purpose: wxChoice implementation for smart phones driven by WinCE -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 29.07.2004 -// RCS-ID: $Id: choicece.h 38319 2006-03-23 22:05:23Z VZ $ -// Copyright: (c) Wlodzimierz Skiba -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICECE_H_BASE_ -#define _WX_CHOICECE_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_CHOICE - -#include "wx/dynarray.h" - -class WXDLLEXPORT wxChoice; -WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins); - -// ---------------------------------------------------------------------------- -// Choice item -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxChoice : public wxChoiceBase -{ -public: - // ctors - wxChoice() { } - virtual ~wxChoice(); - - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - // implement base class pure virtuals - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void Delete(unsigned int n); - virtual void Clear() ; - - virtual unsigned int GetCount() const; - virtual int GetSelection() const; - virtual void SetSelection(int n); - - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - - // get the subclassed window proc of the buddy list of choices - WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - - // return the choice object whose buddy is the given window or NULL - static wxChoice *GetChoiceForListBox(WXHWND hwndBuddy); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - -protected: - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - - // MSW implementation - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - virtual void DoGetSize(int *width, int *height) const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // create and initialize the control - bool CreateAndInit(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name); - - // free all memory we have (used by Clear() and dtor) - void Free(); - - // the data for the "buddy" list - WXHWND m_hwndBuddy; - WXFARPROC m_wndProcBuddy; - - // all existing wxChoice - this allows to find the one corresponding to - // the given buddy window in GetSpinChoiceCtrl() - static wxArrayChoiceSpins ms_allChoiceSpins; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) -}; - -#endif // wxUSE_CHOICE - -#endif // _WX_CHOICECE_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/choicece.h +// Purpose: wxChoice implementation for smart phones driven by WinCE +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 29.07.2004 +// RCS-ID: $Id: choicece.h 38319 2006-03-23 22:05:23Z VZ $ +// Copyright: (c) Wlodzimierz Skiba +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICECE_H_BASE_ +#define _WX_CHOICECE_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_CHOICE + +#include "wx/dynarray.h" + +class WXDLLEXPORT wxChoice; +WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins); + +// ---------------------------------------------------------------------------- +// Choice item +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxChoice : public wxChoiceBase +{ +public: + // ctors + wxChoice() { } + virtual ~wxChoice(); + + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + // implement base class pure virtuals + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void Delete(unsigned int n); + virtual void Clear() ; + + virtual unsigned int GetCount() const; + virtual int GetSelection() const; + virtual void SetSelection(int n); + + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + + // get the subclassed window proc of the buddy list of choices + WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } + + // return the choice object whose buddy is the given window or NULL + static wxChoice *GetChoiceForListBox(WXHWND hwndBuddy); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + +protected: + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + + // MSW implementation + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *width, int *height) const; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // create and initialize the control + bool CreateAndInit(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name); + + // free all memory we have (used by Clear() and dtor) + void Free(); + + // the data for the "buddy" list + WXHWND m_hwndBuddy; + WXFARPROC m_wndProcBuddy; + + // all existing wxChoice - this allows to find the one corresponding to + // the given buddy window in GetSpinChoiceCtrl() + static wxArrayChoiceSpins ms_allChoiceSpins; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) +}; + +#endif // wxUSE_CHOICE + +#endif // _WX_CHOICECE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/msw/wince/helpwce.h b/Externals/wxWidgets/include/wx/msw/wince/helpwce.h index db1e967d53..a1cafb1ac5 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/helpwce.h +++ b/Externals/wxWidgets/include/wx/msw/wince/helpwce.h @@ -1,58 +1,58 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/helpwce.h -// Purpose: Help system: Windows CE help implementation -// Author: Julian Smart -// Modified by: -// Created: 2003-07-12 -// RCS-ID: $Id: helpwce.h 36026 2005-10-27 21:00:26Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPWCE_H_ -#define _WX_HELPWCE_H_ - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -class WXDLLEXPORT wxWinceHelpController : public wxHelpControllerBase -{ -public: - wxWinceHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} - virtual ~wxWinceHelpController() {} - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section); - virtual bool DisplayBlock(long blockNo); - virtual bool DisplayContextPopup(int contextId); - virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - virtual bool Quit(); - - wxString GetHelpFile() const { return m_helpFile; } - -protected: - // Append extension if necessary. - wxString GetValidFilename(const wxString& file) const; - - // View topic, or just the HTML file - bool ViewURL(const wxString& topic = wxEmptyString); - -private: - wxString m_helpFile; - - DECLARE_CLASS(wxWinceHelpController) -}; - -#endif // wxUSE_MS_HTML_HELP - -#endif -// _WX_HELPWCE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/helpwce.h +// Purpose: Help system: Windows CE help implementation +// Author: Julian Smart +// Modified by: +// Created: 2003-07-12 +// RCS-ID: $Id: helpwce.h 36026 2005-10-27 21:00:26Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWCE_H_ +#define _WX_HELPWCE_H_ + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +class WXDLLEXPORT wxWinceHelpController : public wxHelpControllerBase +{ +public: + wxWinceHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} + virtual ~wxWinceHelpController() {} + + // Must call this to set the filename + virtual bool Initialize(const wxString& file); + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section); + virtual bool DisplayBlock(long blockNo); + virtual bool DisplayContextPopup(int contextId); + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + virtual bool Quit(); + + wxString GetHelpFile() const { return m_helpFile; } + +protected: + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + + // View topic, or just the HTML file + bool ViewURL(const wxString& topic = wxEmptyString); + +private: + wxString m_helpFile; + + DECLARE_CLASS(wxWinceHelpController) +}; + +#endif // wxUSE_MS_HTML_HELP + +#endif +// _WX_HELPWCE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/wince/libraries.h b/Externals/wxWidgets/include/wx/msw/wince/libraries.h index 055b628adb..1c0e836031 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/libraries.h +++ b/Externals/wxWidgets/include/wx/msw/wince/libraries.h @@ -1,59 +1,59 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/libraries.h -// Purpose: VC++ pragmas for linking against SDK libs -// Author: Vaclav Slavik -// Modified by: -// Created: 2004-04-11 -// RCS-ID: $Id: libraries.h 38141 2006-03-16 11:03:26Z JS $ -// Copyright: (c) 2004 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LIBRARIES_H_ -#define _WX_LIBRARIES_H_ - -// NB: According to Microsoft, it is up to the OEM to decide whether -// some of libraries will be included in the system or not. For example, -// MS' STANDARDSDK does not include cyshell.lib and aygshell.lib, while -// Pocket PC 2003 SDK does. We depend on some symbols that are in these -// libraries in some SDKs and in different libs in others. Fortunately we -// can detect what SDK is used in C++ code, so we take advantage of -// VC++'s #pragma to link against the libraries conditionally, instead of -// including libraries in project files. - -#if defined(__VISUALC__) && defined(__WXWINCE__) - -#if (_WIN32_WCE >= 400) || defined(__POCKETPC__) - // No commdlg.lib in Mobile 5.0 Smartphone -#if !(defined(__SMARTPHONE__) && _WIN32_WCE >= 1200) - #pragma comment(lib,"commdlg.lib") -#endif -#endif - -#if (_WIN32_WCE >= 400) && !defined(wxNO_RTTI) - #pragma comment(lib,"ccrtrtti.lib") -#endif - -#if defined(__WINCE_STANDARDSDK__) - // DoDragDrop: - #pragma comment(lib,"olece400.lib") -#elif defined(__POCKETPC__) - // PocketPC build: - // DoDragDrop: - #pragma comment(lib,"ceshell.lib") - - #pragma comment(lib,"aygshell.lib") -#elif defined(__HANDHELDPC__) - // Handheld PC builds. Maybe WindowsCE.NET 4.X needs another symbol. - #pragma comment(lib,"ceshell.lib") -#elif defined(__SMARTPHONE__) - // Smartphone build: - #pragma comment(lib,"ceshell.lib") - #pragma comment(lib,"aygshell.lib") -#else - #error "Unknown SDK, please fill-in missing pieces" -#endif - -#endif // __VISUALC__ && __WXWINCE__ - -#endif // _WX_LIBRARIES_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/libraries.h +// Purpose: VC++ pragmas for linking against SDK libs +// Author: Vaclav Slavik +// Modified by: +// Created: 2004-04-11 +// RCS-ID: $Id: libraries.h 38141 2006-03-16 11:03:26Z JS $ +// Copyright: (c) 2004 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LIBRARIES_H_ +#define _WX_LIBRARIES_H_ + +// NB: According to Microsoft, it is up to the OEM to decide whether +// some of libraries will be included in the system or not. For example, +// MS' STANDARDSDK does not include cyshell.lib and aygshell.lib, while +// Pocket PC 2003 SDK does. We depend on some symbols that are in these +// libraries in some SDKs and in different libs in others. Fortunately we +// can detect what SDK is used in C++ code, so we take advantage of +// VC++'s #pragma to link against the libraries conditionally, instead of +// including libraries in project files. + +#if defined(__VISUALC__) && defined(__WXWINCE__) + +#if (_WIN32_WCE >= 400) || defined(__POCKETPC__) + // No commdlg.lib in Mobile 5.0 Smartphone +#if !(defined(__SMARTPHONE__) && _WIN32_WCE >= 1200) + #pragma comment(lib,"commdlg.lib") +#endif +#endif + +#if (_WIN32_WCE >= 400) && !defined(wxNO_RTTI) + #pragma comment(lib,"ccrtrtti.lib") +#endif + +#if defined(__WINCE_STANDARDSDK__) + // DoDragDrop: + #pragma comment(lib,"olece400.lib") +#elif defined(__POCKETPC__) + // PocketPC build: + // DoDragDrop: + #pragma comment(lib,"ceshell.lib") + + #pragma comment(lib,"aygshell.lib") +#elif defined(__HANDHELDPC__) + // Handheld PC builds. Maybe WindowsCE.NET 4.X needs another symbol. + #pragma comment(lib,"ceshell.lib") +#elif defined(__SMARTPHONE__) + // Smartphone build: + #pragma comment(lib,"ceshell.lib") + #pragma comment(lib,"aygshell.lib") +#else + #error "Unknown SDK, please fill-in missing pieces" +#endif + +#endif // __VISUALC__ && __WXWINCE__ + +#endif // _WX_LIBRARIES_H_ diff --git a/Externals/wxWidgets/include/wx/msw/wince/missing.h b/Externals/wxWidgets/include/wx/msw/wince/missing.h index d9de8566a4..0c5ccbec04 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/missing.h +++ b/Externals/wxWidgets/include/wx/msw/wince/missing.h @@ -1,140 +1,140 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wince/missing.h -// Purpose: Missing things in WinCE -// Author: Marco Cavallini -// Modified by: -// Created: 16/11/2002 -// RCS-ID: -// Copyright: (c) KOAN SAS ( www.koansoftware.com ) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CE_MISSING_H_ -#define _WX_CE_MISSING_H_ - -#include "wx/msw/private.h" -#include "shellapi.h" - -inline BOOL IsIconic( HWND WXUNUSED(hWnd) ) -{ - // Probably not right... -#if 0 - long style = GetWindowLong(hWnd, GWL_STYLE); - return ((style & WS_MINIMIZE) == 0); -#endif - return FALSE; -} - -#ifdef __POCKETPC__ -#define SM_CXCURSOR 13 -#define SM_CYCURSOR 14 -#endif - -// Missing from eVC 4 for some reason -#ifndef I_IMAGENONE -#define I_IMAGENONE (-2) -#endif - -#ifndef TBSTYLE_NO_DROPDOWN_ARROW -#define TBSTYLE_NO_DROPDOWN_ARROW 0x0080 -#endif - -#ifndef SHCMBM_GETMENU -#define SHCMBM_GETMENU (WM_USER + 402) -#endif - -#ifndef SHCMBM_SETSUBMENU -#define SHCMBM_SETSUBMENU (WM_USER + 400) // wparam == id of button, lParam == hmenu, return is old hmenu -#endif - -#ifndef SHCMBM_GETSUBMENU -#define SHCMBM_GETSUBMENU (WM_USER + 401) // lParam == ID -#endif - -#ifndef LVS_EX_FULLROWSELECT - #define LVS_EX_FULLROWSELECT 0x00000020 -#endif - -#ifndef TVS_FULLROWSELECT - #define TVS_FULLROWSELECT 0x1000 -#endif - -#ifndef TVM_SETBKCOLOR - #define TVM_SETBKCOLOR (TV_FIRST + 29) - #define TVM_SETTEXTCOLOR (TV_FIRST + 30) -#endif - -// Used in msgdlg.cpp, evtloop.cpp -#ifndef MB_TASKMODAL -#define MB_TASKMODAL 0x2000 -#endif - -#ifndef HGDI_ERROR -#define HGDI_ERROR ((HANDLE)(0xFFFFFFFFL)) -#endif - -// some windows styles don't exist in CE SDK, replace them with closest -// equivalents -#ifndef WS_THICKFRAME - #define WS_THICKFRAME WS_BORDER -#endif - -#ifndef WS_MINIMIZE - #define WS_MINIMIZE 0 -#endif - -#ifndef WS_MAXIMIZE - #define WS_MAXIMIZE 0 -#endif - - -// global memory functions don't exist under CE (good riddance, of course, but -// the existing code still uses them in some places, so make it compile) -// -// update: they're defined in eVC 4 inside "#ifdef UNDER_CE" block -#ifndef UNDER_CE - #define GlobalAlloc LocalAlloc - #define GlobalFree LocalFree - #define GlobalSize LocalSize - #define GPTR LPTR - #define GHND LPTR - #define GMEM_MOVEABLE 0 - #define GMEM_SHARE 0 -#endif // !UNDER_CE - -// WinCE RTL doesn't implement bsearch() used in encconv.cpp -extern "C" void * -bsearch(const void *key, const void *base, size_t num, size_t size, - int (wxCMPFUNC_CONV *cmp)(const void *, const void *)); - -#define O_RDONLY 0x0000 /* open for reading only */ -#define O_WRONLY 0x0001 /* open for writing only */ -#define O_RDWR 0x0002 /* open for reading and writing */ -#define O_APPEND 0x0008 /* writes done at eof */ - -#define O_CREAT 0x0100 /* create and open file */ -#define O_TRUNC 0x0200 /* open and truncate */ -#define O_EXCL 0x0400 /* open only if file doesn't already exist */ - -#define O_TEXT 0x4000 /* file mode is text (translated) */ -#define O_BINARY 0x8000 /* file mode is binary (untranslated) */ - -#ifndef SS_SUNKEN - #define SS_SUNKEN 0x00001000L -#endif - -// unsupported flags for WINDOWPOS structure -#ifndef SWP_NOCOPYBITS - #define SWP_NOCOPYBITS 0 -#endif - -#ifndef SWP_NOOWNERZORDER - #define SWP_NOOWNERZORDER 0 -#endif - -#ifndef SWP_NOSENDCHANGING - #define SWP_NOSENDCHANGING 0 -#endif - -#endif // _WX_CE_MISSING_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wince/missing.h +// Purpose: Missing things in WinCE +// Author: Marco Cavallini +// Modified by: +// Created: 16/11/2002 +// RCS-ID: +// Copyright: (c) KOAN SAS ( www.koansoftware.com ) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CE_MISSING_H_ +#define _WX_CE_MISSING_H_ + +#include "wx/msw/private.h" +#include "shellapi.h" + +inline BOOL IsIconic( HWND WXUNUSED(hWnd) ) +{ + // Probably not right... +#if 0 + long style = GetWindowLong(hWnd, GWL_STYLE); + return ((style & WS_MINIMIZE) == 0); +#endif + return FALSE; +} + +#ifdef __POCKETPC__ +#define SM_CXCURSOR 13 +#define SM_CYCURSOR 14 +#endif + +// Missing from eVC 4 for some reason +#ifndef I_IMAGENONE +#define I_IMAGENONE (-2) +#endif + +#ifndef TBSTYLE_NO_DROPDOWN_ARROW +#define TBSTYLE_NO_DROPDOWN_ARROW 0x0080 +#endif + +#ifndef SHCMBM_GETMENU +#define SHCMBM_GETMENU (WM_USER + 402) +#endif + +#ifndef SHCMBM_SETSUBMENU +#define SHCMBM_SETSUBMENU (WM_USER + 400) // wparam == id of button, lParam == hmenu, return is old hmenu +#endif + +#ifndef SHCMBM_GETSUBMENU +#define SHCMBM_GETSUBMENU (WM_USER + 401) // lParam == ID +#endif + +#ifndef LVS_EX_FULLROWSELECT + #define LVS_EX_FULLROWSELECT 0x00000020 +#endif + +#ifndef TVS_FULLROWSELECT + #define TVS_FULLROWSELECT 0x1000 +#endif + +#ifndef TVM_SETBKCOLOR + #define TVM_SETBKCOLOR (TV_FIRST + 29) + #define TVM_SETTEXTCOLOR (TV_FIRST + 30) +#endif + +// Used in msgdlg.cpp, evtloop.cpp +#ifndef MB_TASKMODAL +#define MB_TASKMODAL 0x2000 +#endif + +#ifndef HGDI_ERROR +#define HGDI_ERROR ((HANDLE)(0xFFFFFFFFL)) +#endif + +// some windows styles don't exist in CE SDK, replace them with closest +// equivalents +#ifndef WS_THICKFRAME + #define WS_THICKFRAME WS_BORDER +#endif + +#ifndef WS_MINIMIZE + #define WS_MINIMIZE 0 +#endif + +#ifndef WS_MAXIMIZE + #define WS_MAXIMIZE 0 +#endif + + +// global memory functions don't exist under CE (good riddance, of course, but +// the existing code still uses them in some places, so make it compile) +// +// update: they're defined in eVC 4 inside "#ifdef UNDER_CE" block +#ifndef UNDER_CE + #define GlobalAlloc LocalAlloc + #define GlobalFree LocalFree + #define GlobalSize LocalSize + #define GPTR LPTR + #define GHND LPTR + #define GMEM_MOVEABLE 0 + #define GMEM_SHARE 0 +#endif // !UNDER_CE + +// WinCE RTL doesn't implement bsearch() used in encconv.cpp +extern "C" void * +bsearch(const void *key, const void *base, size_t num, size_t size, + int (wxCMPFUNC_CONV *cmp)(const void *, const void *)); + +#define O_RDONLY 0x0000 /* open for reading only */ +#define O_WRONLY 0x0001 /* open for writing only */ +#define O_RDWR 0x0002 /* open for reading and writing */ +#define O_APPEND 0x0008 /* writes done at eof */ + +#define O_CREAT 0x0100 /* create and open file */ +#define O_TRUNC 0x0200 /* open and truncate */ +#define O_EXCL 0x0400 /* open only if file doesn't already exist */ + +#define O_TEXT 0x4000 /* file mode is text (translated) */ +#define O_BINARY 0x8000 /* file mode is binary (untranslated) */ + +#ifndef SS_SUNKEN + #define SS_SUNKEN 0x00001000L +#endif + +// unsupported flags for WINDOWPOS structure +#ifndef SWP_NOCOPYBITS + #define SWP_NOCOPYBITS 0 +#endif + +#ifndef SWP_NOOWNERZORDER + #define SWP_NOOWNERZORDER 0 +#endif + +#ifndef SWP_NOSENDCHANGING + #define SWP_NOSENDCHANGING 0 +#endif + +#endif // _WX_CE_MISSING_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/wince/net.h b/Externals/wxWidgets/include/wx/msw/wince/net.h index 9342e513d5..f99209bd55 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/net.h +++ b/Externals/wxWidgets/include/wx/msw/wince/net.h @@ -1,20 +1,20 @@ -// Copyright 1998, Ben Goetter. All rights reserved. - -/* - patch holes in winsock - - WCE 2.0 lacks many of the 'database' winsock routines. - Stub just enough them for ss.dll. - - getprotobynumber - getservbyport - getservbyname - -*/ - -struct servent * WINSOCKAPI getservbyport(int port, const char * proto) ; - -struct servent * WINSOCKAPI getservbyname(const char * name, - const char * proto) ; -struct protoent * WINSOCKAPI getprotobynumber(int proto) ; - +// Copyright 1998, Ben Goetter. All rights reserved. + +/* + patch holes in winsock + + WCE 2.0 lacks many of the 'database' winsock routines. + Stub just enough them for ss.dll. + + getprotobynumber + getservbyport + getservbyname + +*/ + +struct servent * WINSOCKAPI getservbyport(int port, const char * proto) ; + +struct servent * WINSOCKAPI getservbyname(const char * name, + const char * proto) ; +struct protoent * WINSOCKAPI getprotobynumber(int proto) ; + diff --git a/Externals/wxWidgets/include/wx/msw/wince/resources.h b/Externals/wxWidgets/include/wx/msw/wince/resources.h index 4fdccd1cdf..df64656b2e 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/resources.h +++ b/Externals/wxWidgets/include/wx/msw/wince/resources.h @@ -1,25 +1,25 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/resources.h -// Purpose: identifiers shared between resource compiler and eVC -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 01.05.2004 -// RCS-ID: $Id: resources.h 27829 2004-06-16 06:17:27Z ABX $ -// Copyright: (c) Wlodzimierz Skiba -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#define IDM_LEFT 40001 -#define IDM_RIGHT 40002 -#define IDM_ITEM 40003 - -#define IDS_EMPTY 40010 - -#define IDR_POPUP_1 40020 -#define IDR_POPUP_2 40021 - -#define IDR_MENUBAR_ONE_BUTTON 40030 -#define IDR_MENUBAR_LEFT_MENU 40031 -#define IDR_MENUBAR_RIGHT_MENU 40032 -#define IDR_MENUBAR_BOTH_MENUS 40033 - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/resources.h +// Purpose: identifiers shared between resource compiler and eVC +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 01.05.2004 +// RCS-ID: $Id: resources.h 27829 2004-06-16 06:17:27Z ABX $ +// Copyright: (c) Wlodzimierz Skiba +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#define IDM_LEFT 40001 +#define IDM_RIGHT 40002 +#define IDM_ITEM 40003 + +#define IDS_EMPTY 40010 + +#define IDR_POPUP_1 40020 +#define IDR_POPUP_2 40021 + +#define IDR_MENUBAR_ONE_BUTTON 40030 +#define IDR_MENUBAR_LEFT_MENU 40031 +#define IDR_MENUBAR_RIGHT_MENU 40032 +#define IDR_MENUBAR_BOTH_MENUS 40033 + diff --git a/Externals/wxWidgets/include/wx/msw/wince/setup.h b/Externals/wxWidgets/include/wx/msw/wince/setup.h index 9d4671c29d..193f703d4c 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/setup.h +++ b/Externals/wxWidgets/include/wx/msw/wince/setup.h @@ -1,1295 +1,1295 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup.h 51451 2008-01-29 23:11:55Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// general Windows-specific stuff -// ---------------------------------------------------------------------------- - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxDIB (don't change unless you have reason to) -#define wxUSE_WXDIB 1 - -// ---------------------------------------------------------------------------- -// Windows CE specific stuff -// ---------------------------------------------------------------------------- - -// list of things which don't make sense under Windows CE in alphabetical order -// (please keep it!) -// -// NB: stuff which doesn't work at all under CE is forcefully disabled in -// wx/msw/wince/chkconf.h - -// Windows CE doesn't use RAS so wxDialUpManager doesn't work under it -#undef wxUSE_DIALUP_MANAGER -#define wxUSE_DIALUP_MANAGER 0 - -#undef wxUSE_DRAG_AND_DROP -#define wxUSE_DRAG_AND_DROP 0 - -#undef wxUSE_FSVOLUME -#define wxUSE_FSVOLUME 0 - -// MDI is not supported under CE -#undef wxUSE_MDI -#define wxUSE_MDI 0 - -#undef wxUSE_MDI_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 0 - -// there is no difference between frame and mini frame decorations under CE -#undef wxUSE_MINIFRAME -#define wxUSE_MINIFRAME 0 - -// no CHM support under CE -#undef wxUSE_MS_HTML_HELP -#define wxUSE_MS_HTML_HELP 0 - -// ??? -#undef wxUSE_OWNER_DRAWN -#define wxUSE_OWNER_DRAWN 0 - -// there is usually no printer attached to a PDA... -#undef wxUSE_PRINTING_ARCHITECTURE -#define wxUSE_PRINTING_ARCHITECTURE 0 - -// doesn't make much sense in absence of mouse... -#undef wxUSE_TOOLTIPS -#define wxUSE_TOOLTIPS 0 - -// Do use commdlg.h -#undef wxUSE_COMMON_DIALOGS -#define wxUSE_COMMON_DIALOGS 1 - -// don't use wxRichTextCtrl on WinCE yet, it's not ready, plus it's -// probably overkill for a WinCE environment. -#undef wxUSE_RICHTEXT -#define wxUSE_RICHTEXT 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 0 - -// ---------------------------------------------------------------------------- -// obsolete MSW settings, don't change -// ---------------------------------------------------------------------------- - -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 - -#endif // _WX_SETUP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: setup.h 51451 2008-01-29 23:11:55Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + +/* --- end common options --- */ + +// ---------------------------------------------------------------------------- +// general Windows-specific stuff +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxDIB (don't change unless you have reason to) +#define wxUSE_WXDIB 1 + +// ---------------------------------------------------------------------------- +// Windows CE specific stuff +// ---------------------------------------------------------------------------- + +// list of things which don't make sense under Windows CE in alphabetical order +// (please keep it!) +// +// NB: stuff which doesn't work at all under CE is forcefully disabled in +// wx/msw/wince/chkconf.h + +// Windows CE doesn't use RAS so wxDialUpManager doesn't work under it +#undef wxUSE_DIALUP_MANAGER +#define wxUSE_DIALUP_MANAGER 0 + +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 + +#undef wxUSE_FSVOLUME +#define wxUSE_FSVOLUME 0 + +// MDI is not supported under CE +#undef wxUSE_MDI +#define wxUSE_MDI 0 + +#undef wxUSE_MDI_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 + +// there is no difference between frame and mini frame decorations under CE +#undef wxUSE_MINIFRAME +#define wxUSE_MINIFRAME 0 + +// no CHM support under CE +#undef wxUSE_MS_HTML_HELP +#define wxUSE_MS_HTML_HELP 0 + +// ??? +#undef wxUSE_OWNER_DRAWN +#define wxUSE_OWNER_DRAWN 0 + +// there is usually no printer attached to a PDA... +#undef wxUSE_PRINTING_ARCHITECTURE +#define wxUSE_PRINTING_ARCHITECTURE 0 + +// doesn't make much sense in absence of mouse... +#undef wxUSE_TOOLTIPS +#define wxUSE_TOOLTIPS 0 + +// Do use commdlg.h +#undef wxUSE_COMMON_DIALOGS +#define wxUSE_COMMON_DIALOGS 1 + +// don't use wxRichTextCtrl on WinCE yet, it's not ready, plus it's +// probably overkill for a WinCE environment. +#undef wxUSE_RICHTEXT +#define wxUSE_RICHTEXT 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 0 + +// ---------------------------------------------------------------------------- +// obsolete MSW settings, don't change +// ---------------------------------------------------------------------------- + +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 + +#endif // _WX_SETUP_H_ diff --git a/Externals/wxWidgets/include/wx/msw/wince/tbarwce.h b/Externals/wxWidgets/include/wx/msw/wince/tbarwce.h index 9b3ab5f833..5fc0cf7099 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/tbarwce.h +++ b/Externals/wxWidgets/include/wx/msw/wince/tbarwce.h @@ -1,168 +1,168 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/tbarwce.h -// Purpose: Windows CE wxToolBar class -// Author: Julian Smart -// Modified by: -// Created: 2003-07-12 -// RCS-ID: $Id: tbarwce.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BARWCE_H_ -#define _WX_BARWCE_H_ - -#if wxUSE_TOOLBAR - -#include "wx/dynarray.h" - -// Smartphones don't have toolbars, so use a dummy class -#ifdef __SMARTPHONE__ - -class WXDLLEXPORT wxToolBar : public wxToolBarBase -{ -public: - // ctors and dtor - wxToolBar() { } - - wxToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr) - { - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr); - - // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - virtual bool Realize() { return true; } - -protected: - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolBar) - DECLARE_NO_COPY_CLASS(wxToolBar) -}; - -#else - -// For __POCKETPC__ - -#include "wx/msw/tbar95.h" - -class WXDLLEXPORT wxToolMenuBar : public wxToolBar -{ -public: - // ctors and dtor - wxToolMenuBar() { Init(); } - - wxToolMenuBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr, - wxMenuBar* menuBar = NULL) - { - Init(); - - Create(parent, id, pos, size, style, name, menuBar); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER | wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr, - wxMenuBar* menuBar = NULL); - - virtual ~wxToolMenuBar(); - - // override/implement base class virtuals - virtual bool Realize(); - - // implementation only from now on - // ------------------------------- - - // Override in order to bypass wxToolBar's overridden function - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - - // Return HMENU for the menu associated with the commandbar - WXHMENU GetHMenu(); - - // Set the wxMenuBar associated with this commandbar - void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } - - // Returns the wxMenuBar associated with this commandbar - wxMenuBar* GetMenuBar() const { return m_menuBar; } - -protected: - // common part of all ctors - void Init(); - - // create the native toolbar control - bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size, wxMenuBar* menuBar); - - // recreate the control completely - void Recreate(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); - - // The menubar associated with this toolbar - wxMenuBar* m_menuBar; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolMenuBar) - DECLARE_NO_COPY_CLASS(wxToolMenuBar) -}; - -#endif - // __SMARTPHONE__ - -#endif // wxUSE_TOOLBAR - -#endif - // _WX_BARWCE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/tbarwce.h +// Purpose: Windows CE wxToolBar class +// Author: Julian Smart +// Modified by: +// Created: 2003-07-12 +// RCS-ID: $Id: tbarwce.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BARWCE_H_ +#define _WX_BARWCE_H_ + +#if wxUSE_TOOLBAR + +#include "wx/dynarray.h" + +// Smartphones don't have toolbars, so use a dummy class +#ifdef __SMARTPHONE__ + +class WXDLLEXPORT wxToolBar : public wxToolBarBase +{ +public: + // ctors and dtor + wxToolBar() { } + + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + virtual bool Realize() { return true; } + +protected: + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxToolBar) + DECLARE_NO_COPY_CLASS(wxToolBar) +}; + +#else + +// For __POCKETPC__ + +#include "wx/msw/tbar95.h" + +class WXDLLEXPORT wxToolMenuBar : public wxToolBar +{ +public: + // ctors and dtor + wxToolMenuBar() { Init(); } + + wxToolMenuBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr, + wxMenuBar* menuBar = NULL) + { + Init(); + + Create(parent, id, pos, size, style, name, menuBar); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER | wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr, + wxMenuBar* menuBar = NULL); + + virtual ~wxToolMenuBar(); + + // override/implement base class virtuals + virtual bool Realize(); + + // implementation only from now on + // ------------------------------- + + // Override in order to bypass wxToolBar's overridden function + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + + // Return HMENU for the menu associated with the commandbar + WXHMENU GetHMenu(); + + // Set the wxMenuBar associated with this commandbar + void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } + + // Returns the wxMenuBar associated with this commandbar + wxMenuBar* GetMenuBar() const { return m_menuBar; } + +protected: + // common part of all ctors + void Init(); + + // create the native toolbar control + bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size, wxMenuBar* menuBar); + + // recreate the control completely + void Recreate(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + // The menubar associated with this toolbar + wxMenuBar* m_menuBar; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxToolMenuBar) + DECLARE_NO_COPY_CLASS(wxToolMenuBar) +}; + +#endif + // __SMARTPHONE__ + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_BARWCE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/wince/textctrlce.h b/Externals/wxWidgets/include/wx/msw/wince/textctrlce.h index 3961010e2f..aec359cf9a 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/textctrlce.h +++ b/Externals/wxWidgets/include/wx/msw/wince/textctrlce.h @@ -1,236 +1,236 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/textctrlce.h -// Purpose: wxTextCtrl implementation for smart phones driven by WinCE -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 30.08.2004 -// RCS-ID: $Id: textctrlce.h 41739 2006-10-08 17:46:12Z VZ $ -// Copyright: (c) Wlodzimierz Skiba -// License: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCTRLCE_H_ -#define _WX_TEXTCTRLCE_H_ - -#include "wx/dynarray.h" - -class WXDLLEXPORT wxTextCtrl; -WX_DEFINE_EXPORTED_ARRAY_PTR(wxTextCtrl *, wxArrayTextSpins); - -class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase -{ -public: - // creation - // -------- - - wxTextCtrl() { Init(); } - wxTextCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) - { - Init(); - - Create(parent, id, value, pos, size, style, validator, name); - } - virtual ~wxTextCtrl(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - - // implement base class pure virtuals - // ---------------------------------- - - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value) { DoSetValue(value, SetValue_SendEvent); } - - virtual void ChangeValue(const wxString &value) { DoSetValue(value); } - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - virtual void GetSelection(long* from, long* to) const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load the controls contents from the file - virtual bool LoadFile(const wxString& file); - - // clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - virtual void SetMaxLength(unsigned long len); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const - { - return wxTextCtrlBase::HitTest(pt, col, row); - } - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - - // Caret handling (Windows only) - - bool ShowNativeCaret(bool show = true); - bool HideNativeCaret() { return ShowNativeCaret(false); } - - // Implementation from now on - // -------------------------- - - virtual void Command(wxCommandEvent& event); - virtual bool MSWCommand(WXUINT param, WXWORD id); - - virtual void AdoptAttributesFromHWND(); - - virtual bool AcceptsFocus() const; - - // callbacks - void OnDropFiles(wxDropFilesEvent& event); - void OnChar(wxKeyEvent& event); // Process 'enter' if required - - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - // Show a context menu for Rich Edit controls (the standard - // EDIT control has one already) - void OnRightClick(wxMouseEvent& event); - - // be sure the caret remains invisible if the user - // called HideNativeCaret() before - void OnSetFocus(wxFocusEvent& event); - - // get the subclassed window proc of the buddy - WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - - // intercept WM_GETDLGCODE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // call this to increase the size limit (will do nothing if the current - // limit is big enough) - // - // returns true if we increased the limit to allow entering more text, - // false if we hit the limit set by SetMaxLength() and so didn't change it - bool AdjustSpaceLimit(); - - void DoSetValue(const wxString &value, int flags = 0); - - // replace the contents of the selection or of the entire control with the - // given text - void DoWriteText(const wxString& text, int flags = SetValue_SelectionOnly); - - // set the selection possibly without scrolling the caret into view - void DoSetSelection(long from, long to, bool scrollCaret = true); - - // return true if there is a non empty selection in the control - bool HasSelection() const; - - // get the length of the line containing the character at the given - // position - long GetLengthOfLineContainingPos(long pos) const; - - // send TEXT_UPDATED event, return true if it was handled, false otherwise - bool SendUpdateEvent(); - - // override some base class virtuals - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // if true, SendUpdateEvent() will eat the next event (see comments in the - // code as to why this is needed) - bool m_suppressNextUpdate; - - // all existing wxTextCtrl - this allows to find the one corresponding to - // the given buddy window in GetSpinTextCtrl() - static wxArrayTextSpins ms_allTextSpins; - -protected: - - // the data for the "buddy" list - WXHWND m_hwndBuddy; - WXFARPROC m_wndProcBuddy; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) - - bool m_isNativeCaretShown; -}; - -#endif // _WX_TEXTCTRLCE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wince/textctrlce.h +// Purpose: wxTextCtrl implementation for smart phones driven by WinCE +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 30.08.2004 +// RCS-ID: $Id: textctrlce.h 41739 2006-10-08 17:46:12Z VZ $ +// Copyright: (c) Wlodzimierz Skiba +// License: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRLCE_H_ +#define _WX_TEXTCTRLCE_H_ + +#include "wx/dynarray.h" + +class WXDLLEXPORT wxTextCtrl; +WX_DEFINE_EXPORTED_ARRAY_PTR(wxTextCtrl *, wxArrayTextSpins); + +class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase +{ +public: + // creation + // -------- + + wxTextCtrl() { Init(); } + wxTextCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr) + { + Init(); + + Create(parent, id, value, pos, size, style, validator, name); + } + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr); + + // implement base class pure virtuals + // ---------------------------------- + + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value) { DoSetValue(value, SetValue_SendEvent); } + + virtual void ChangeValue(const wxString &value) { DoSetValue(value); } + + virtual wxString GetRange(long from, long to) const; + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load the controls contents from the file + virtual bool LoadFile(const wxString& file); + + // clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + virtual void SetMaxLength(unsigned long len); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const + { + return wxTextCtrlBase::HitTest(pt, col, row); + } + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // Caret handling (Windows only) + + bool ShowNativeCaret(bool show = true); + bool HideNativeCaret() { return ShowNativeCaret(false); } + + // Implementation from now on + // -------------------------- + + virtual void Command(wxCommandEvent& event); + virtual bool MSWCommand(WXUINT param, WXWORD id); + + virtual void AdoptAttributesFromHWND(); + + virtual bool AcceptsFocus() const; + + // callbacks + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + // Show a context menu for Rich Edit controls (the standard + // EDIT control has one already) + void OnRightClick(wxMouseEvent& event); + + // be sure the caret remains invisible if the user + // called HideNativeCaret() before + void OnSetFocus(wxFocusEvent& event); + + // get the subclassed window proc of the buddy + WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } + + // intercept WM_GETDLGCODE + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + +protected: + // common part of all ctors + void Init(); + + // call this to increase the size limit (will do nothing if the current + // limit is big enough) + // + // returns true if we increased the limit to allow entering more text, + // false if we hit the limit set by SetMaxLength() and so didn't change it + bool AdjustSpaceLimit(); + + void DoSetValue(const wxString &value, int flags = 0); + + // replace the contents of the selection or of the entire control with the + // given text + void DoWriteText(const wxString& text, int flags = SetValue_SelectionOnly); + + // set the selection possibly without scrolling the caret into view + void DoSetSelection(long from, long to, bool scrollCaret = true); + + // return true if there is a non empty selection in the control + bool HasSelection() const; + + // get the length of the line containing the character at the given + // position + long GetLengthOfLineContainingPos(long pos) const; + + // send TEXT_UPDATED event, return true if it was handled, false otherwise + bool SendUpdateEvent(); + + // override some base class virtuals + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // if true, SendUpdateEvent() will eat the next event (see comments in the + // code as to why this is needed) + bool m_suppressNextUpdate; + + // all existing wxTextCtrl - this allows to find the one corresponding to + // the given buddy window in GetSpinTextCtrl() + static wxArrayTextSpins ms_allTextSpins; + +protected: + + // the data for the "buddy" list + WXHWND m_hwndBuddy; + WXFARPROC m_wndProcBuddy; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) + + bool m_isNativeCaretShown; +}; + +#endif // _WX_TEXTCTRLCE_H_ diff --git a/Externals/wxWidgets/include/wx/msw/wince/time.h b/Externals/wxWidgets/include/wx/msw/wince/time.h index 4eafc18986..d711111c89 100644 --- a/Externals/wxWidgets/include/wx/msw/wince/time.h +++ b/Externals/wxWidgets/include/wx/msw/wince/time.h @@ -1,53 +1,53 @@ - -/* - * time.h - * Missing time functions and structures for use under WinCE - */ - -#ifndef _WX_MSW_WINCE_TIME_H_ -#define _WX_MSW_WINCE_TIME_H_ - -#ifndef _TM_DEFINED - -#define _TM_DEFINED - -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight savings time flag */ - }; - -extern "C" -{ - -time_t __cdecl time(time_t *); - -time_t __cdecl mktime(struct tm *); - -// VC8 CRT provides the other functions -#if !defined(__VISUALC__) || (__VISUALC__ < 1400) - -struct tm * __cdecl localtime(const time_t *); - -struct tm * __cdecl gmtime(const time_t *); - -#define _tcsftime wcsftime - -size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *); - -extern long timezone; - -#endif // !VC8 - -} - -#endif // !_TM_DEFINED - -#endif // _WX_MSW_WINCE_TIME_H_ - + +/* + * time.h + * Missing time functions and structures for use under WinCE + */ + +#ifndef _WX_MSW_WINCE_TIME_H_ +#define _WX_MSW_WINCE_TIME_H_ + +#ifndef _TM_DEFINED + +#define _TM_DEFINED + +struct tm { + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday - [0,6] */ + int tm_yday; /* days since January 1 - [0,365] */ + int tm_isdst; /* daylight savings time flag */ + }; + +extern "C" +{ + +time_t __cdecl time(time_t *); + +time_t __cdecl mktime(struct tm *); + +// VC8 CRT provides the other functions +#if !defined(__VISUALC__) || (__VISUALC__ < 1400) + +struct tm * __cdecl localtime(const time_t *); + +struct tm * __cdecl gmtime(const time_t *); + +#define _tcsftime wcsftime + +size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *); + +extern long timezone; + +#endif // !VC8 + +} + +#endif // !_TM_DEFINED + +#endif // _WX_MSW_WINCE_TIME_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/window.h b/Externals/wxWidgets/include/wx/msw/window.h index b765ac1dbb..c75ac55d33 100644 --- a/Externals/wxWidgets/include/wx/msw/window.h +++ b/Externals/wxWidgets/include/wx/msw/window.h @@ -1,601 +1,601 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/window.h -// Purpose: wxWindowMSW class -// Author: Julian Smart -// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling, -// elimination of Default(), ... -// Created: 01/02/97 -// RCS-ID: $Id: window.h 53929 2008-06-02 18:27:16Z RD $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WINDOW_H_ -#define _WX_WINDOW_H_ - -// --------------------------------------------------------------------------- -// constants -// --------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_4 -// they're unused by wxWidgets... -enum -{ - wxKEY_SHIFT = 1, - wxKEY_CTRL = 2 -}; -#endif - -// --------------------------------------------------------------------------- -// wxWindow declaration for MSW -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowMSW : public wxWindowBase -{ - friend class wxSpinCtrl; - friend class wxSlider; - friend class wxRadioBox; -#if defined __VISUALC__ && __VISUALC__ <= 1200 - friend class wxWindowMSW; -#endif -public: - wxWindowMSW() { Init(); } - - wxWindowMSW(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - Create(parent, id, pos, size, style, name); - } - - virtual ~wxWindowMSW(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - // implement base class pure virtuals - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; - - virtual void Raise(); - virtual void Lower(); - - virtual bool Show( bool show = true ); - virtual bool Enable( bool enable = true ); - - virtual void SetFocus(); - virtual void SetFocusFromKbd(); - - virtual bool Reparent(wxWindowBase *newParent); - - virtual void WarpPointer(int x, int y); - - virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); - virtual void Update(); - virtual void Freeze(); - virtual void Thaw(); - virtual bool IsFrozen() const { return m_frozenness > 0; } - - virtual void SetWindowStyleFlag(long style); - virtual void SetExtraStyle(long exStyle); - virtual bool SetCursor( const wxCursor &cursor ); - virtual bool SetFont( const wxFont &font ); - - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - virtual void GetTextExtent(const wxString& string, - int *x, int *y, - int *descent = (int *) NULL, - int *externalLeading = (int *) NULL, - const wxFont *theFont = (const wxFont *) NULL) - const; - - virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = true ); - virtual void SetScrollPos( int orient, int pos, bool refresh = true ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; - virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = (wxRect *) NULL ); - - virtual bool ScrollLines(int lines); - virtual bool ScrollPages(int pages); - - virtual void SetLayoutDirection(wxLayoutDirection dir); - virtual wxLayoutDirection GetLayoutDirection() const; - virtual wxCoord AdjustForLayoutDirection(wxCoord x, - wxCoord width, - wxCoord widthTotal) const; - -#if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); -#endif // wxUSE_DRAG_AND_DROP - - // Accept files for dragging - virtual void DragAcceptFiles(bool accept); - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( bool GetUseCtl3D() const ); - wxDEPRECATED( bool GetTransparentBackground() const ); - wxDEPRECATED( void SetTransparent(bool t = true) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -#ifndef __WXUNIVERSAL__ - // Native resource loading (implemented in src/msw/nativdlg.cpp) - // FIXME: should they really be all virtual? - virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); - virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); - wxWindow* GetWindowChild1(wxWindowID id); - wxWindow* GetWindowChild(wxWindowID id); -#endif // __WXUNIVERSAL__ - -#if wxUSE_HOTKEY - // install and deinstall a system wide hotkey - virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); - virtual bool UnregisterHotKey(int hotkeyId); -#endif // wxUSE_HOTKEY - -#ifdef __POCKETPC__ - bool IsContextMenuEnabled() const { return m_contextMenuEnabled; } - void EnableContextMenu(bool enable = true) { m_contextMenuEnabled = enable; } -#endif - - // window handle stuff - // ------------------- - - WXHWND GetHWND() const { return m_hWnd; } - void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } - virtual WXWidget GetHandle() const { return GetHWND(); } - - void AssociateHandle(WXWidget handle); - void DissociateHandle(); - - // does this window have deferred position and/or size? - bool IsSizeDeferred() const; - - - // implementation from now on - // ========================== - - // event handlers - // -------------- - - void OnPaint(wxPaintEvent& event); - void OnEraseBackground(wxEraseEvent& event); -#ifdef __WXWINCE__ - void OnInitDialog(wxInitDialogEvent& event); -#endif - -public: - // Windows subclassing - void SubclassWin(WXHWND hWnd); - void UnsubclassWin(); - - WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } - void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } - - // return true if the window is of a standard (i.e. not wxWidgets') class - // - // to understand why does it work, look at SubclassWin() code and comments - bool IsOfStandardClass() const { return m_oldWndProc != NULL; } - - wxWindow *FindItem(long id) const; - wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; - - // MSW only: true if this control is part of the main control - virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; } - -#if wxUSE_TOOLTIPS - // MSW only: true if this window or any of its children have a tooltip - virtual bool HasToolTips() const { return GetToolTip() != NULL; } -#endif // wxUSE_TOOLTIPS - - // translate wxWidgets style flags for this control into the Windows style - // and optional extended style for the corresponding native control - // - // this is the function that should be overridden in the derived classes, - // but you will mostly use MSWGetCreateWindowFlags() below - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ; - - // get the MSW window flags corresponding to wxWidgets ones - // - // the functions returns the flags (WS_XXX) directly and puts the ext - // (WS_EX_XXX) flags into the provided pointer if not NULL - WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const - { return MSWGetStyle(GetWindowStyle(), exflags); } - - // update the real underlying window style flags to correspond to the - // current wxWindow object style (safe to call even if window isn't fully - // created yet) - void MSWUpdateStyle(long flagsOld, long exflagsOld); - -#if wxABI_VERSION >= 20805 - // Helper for getting an appropriate theme style for the application. Unnecessary in - // 2.9 and above. - wxBorder GetThemedBorderStyle() const; -#endif - - // translate wxWidgets coords into Windows ones suitable to be passed to - // ::CreateWindow() - // - // returns true if non default coords are returned, false otherwise - bool MSWGetCreateWindowCoords(const wxPoint& pos, - const wxSize& size, - int& x, int& y, - int& w, int& h) const; - - // get the HWND to be used as parent of this window with CreateWindow() - virtual WXHWND MSWGetParent() const; - - // creates the window of specified Windows class with given style, extended - // style, title and geometry (default values - // - // returns true if the window has been created, false if creation failed - bool MSWCreate(const wxChar *wclass, - const wxChar *title = NULL, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - WXDWORD style = 0, - WXDWORD exendedStyle = 0); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - -#ifndef __WXUNIVERSAL__ - // Create an appropriate wxWindow from a HWND - virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); - - // Make sure the window style reflects the HWND style (roughly) - virtual void AdoptAttributesFromHWND(); -#endif // __WXUNIVERSAL__ - - // Setup background and foreground colours correctly - virtual void SetupColours(); - - // ------------------------------------------------------------------------ - // helpers for message handlers: these perform the same function as the - // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into - // the correct parameters - // ------------------------------------------------------------------------ - - void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *id, WXHWND *hwnd, WXWORD *cmd); - void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *state, WXWORD *minimized, WXHWND *hwnd); - void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *code, WXWORD *pos, WXHWND *hwnd); - void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, - WXHDC *hdc, WXHWND *hwnd); - void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *item, WXWORD *flags, WXHMENU *hmenu); - - // ------------------------------------------------------------------------ - // internal handlers for MSW messages: all handlers return a boolean value: - // true means that the handler processed the event and false that it didn't - // ------------------------------------------------------------------------ - - // there are several cases where we have virtual functions for Windows - // message processing: this is because these messages often require to be - // processed in a different manner in the derived classes. For all other - // messages, however, we do *not* have corresponding MSWOnXXX() function - // and if the derived class wants to process them, it should override - // MSWWindowProc() directly. - - // scroll event (both horizontal and vertical) - virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, - WXWORD pos, WXHWND control); - - // child control notifications - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // owner-drawn controls need to process these messages - virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); - virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); - - // the rest are not virtual - bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); - bool HandleInitDialog(WXHWND hWndFocus); - bool HandleDestroy(); - - bool HandlePaint(); - bool HandlePrintClient(WXHDC hDC); - bool HandleEraseBkgnd(WXHDC hDC); - - bool HandleMinimize(); - bool HandleMaximize(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleSizing(wxRect& rect); - bool HandleGetMinMaxInfo(void *mmInfo); - - bool HandleShow(bool show, int status); - bool HandleActivate(int flag, bool minimized, WXHWND activate); - - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - - bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd); - - bool HandlePaletteChanged(WXHWND hWndPalChange); - bool HandleQueryNewPalette(); - bool HandleSysColorChange(); - bool HandleDisplayChange(); - bool HandleCaptureChanged(WXHWND gainedCapture); - virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); - - bool HandleQueryEndSession(long logOff, bool *mayEnd); - bool HandleEndSession(bool endSession, long logOff); - - bool HandleSetFocus(WXHWND wnd); - bool HandleKillFocus(WXHWND wnd); - - bool HandleDropFiles(WXWPARAM wParam); - - bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); - bool HandleMouseMove(int x, int y, WXUINT flags); - bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); - - bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false); - bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); - bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); -#if wxUSE_ACCEL - bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); -#endif -#ifdef __WIN32__ - int HandleMenuChar(int chAccel, WXLPARAM lParam); -#endif - // Create and process a clipboard event specified by type. - bool HandleClipboardEvent( WXUINT nMsg ); - - bool HandleQueryDragIcon(WXHICON *hIcon); - - bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); - - bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed); - - - // Window procedure - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // Calls an appropriate default window procedure - virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // message processing helpers - - // return false if the message shouldn't be translated/preprocessed but - // dispatched normally - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); - - // return true if the message was preprocessed and shouldn't be dispatched - virtual bool MSWProcessMessage(WXMSG* pMsg); - - // return true if the message was translated and shouldn't be dispatched - virtual bool MSWTranslateMessage(WXMSG* pMsg); - - // called when the window is about to be destroyed - virtual void MSWDestroyWindow(); - - - // this function should return the brush to paint the children controls - // background or 0 if this window doesn't impose any particular background - // on its children - // - // the base class version returns a solid brush if we have a non default - // background colour or 0 otherwise - virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); - - // return the background brush to use for painting the given window by - // quering the parent windows via their MSWGetBgBrushForChild() recursively - // - // hWndToPaint is normally NULL meaning this window itself, but it can also - // be a child of this window which is used by the static box and could be - // potentially useful for other transparent controls - WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL); - - // gives the parent the possibility to draw its children background, e.g. - // this is used by wxNotebook to do it using DrawThemeBackground() - // - // return true if background was drawn, false otherwise - virtual bool MSWPrintChild(WXHDC WXUNUSED(hDC), wxWindow * WXUNUSED(child)) - { - return false; - } - - // some controls (e.g. wxListBox) need to set the return value themselves - // - // return true to let parent handle it if we don't, false otherwise - virtual bool MSWShouldPropagatePrintChild() - { - return true; - } - - - // Responds to colour changes: passes event on to children. - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX) - void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); - - // check if mouse is in the window - bool IsMouseInWindow() const; - - // check if a native double-buffering applies for this window - virtual bool IsDoubleBuffered() const; - -#if wxABI_VERSION >= 20808 - void SetDoubleBuffered(bool on); -#endif - - // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false - void GenerateMouseLeave(); - - // virtual function for implementing internal idle - // behaviour - virtual void OnInternalIdle(); - -protected: - -#if wxUSE_MENUS_NATIVE - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); -#endif // wxUSE_MENUS_NATIVE - - // the window handle - WXHWND m_hWnd; - - // the old window proc (we subclass all windows) - WXFARPROC m_oldWndProc; - - // additional (MSW specific) flags - bool m_mouseInWindow:1; - bool m_lastKeydownProcessed:1; - - // the size of one page for scrolling - int m_xThumbSize; - int m_yThumbSize; - - // implement the base class pure virtuals - virtual void DoClientToScreen( int *x, int *y ) const; - virtual void DoScreenToClient( int *x, int *y ) const; - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoGetClientSize( int *width, int *height ) const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoSetClientSize(int width, int height); - - virtual void DoCaptureMouse(); - virtual void DoReleaseMouse(); - - // this simply moves/resizes the given HWND which is supposed to be our - // sibling (this is useful for controls which are composite at MSW level - // and for which DoMoveWindow() is not enough) - // - // returns true if the window move was deferred, false if it was moved - // immediately (no error return) - bool DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height); - - // move the window to the specified location and resize it: this is called - // from both DoSetSize() and DoSetClientSize() and would usually just call - // ::MoveWindow() except for composite controls which will want to arrange - // themselves inside the given rectangle - virtual void DoMoveWindow(int x, int y, int width, int height); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); - - // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in - // comctl32.dll in our code -- see the function body for more info) - bool HandleTooltipNotify(WXUINT code, - WXLPARAM lParam, - const wxString& ttip); -#endif // wxUSE_TOOLTIPS - - // the helper functions used by HandleChar/KeyXXX methods - wxKeyEvent CreateKeyEvent(wxEventType evType, int id, - WXLPARAM lParam = 0, WXWPARAM wParam = 0) const; - - - // default OnEraseBackground() implementation, return true if we did erase - // the background, false otherwise (i.e. the system should erase it) - bool DoEraseBackground(WXHDC hDC); - - // generate WM_CHANGEUISTATE if it's needed for the OS we're running under - // - // action should be one of the UIS_XXX constants - // state should be one or more of the UISF_XXX constants - // if action == UIS_INITIALIZE then it doesn't seem to matter what we use - // for state as the system will decide for us what needs to be set - void MSWUpdateUIState(int action, int state = 0); - -private: - // common part of all ctors - void Init(); - - // the (non-virtual) handlers for the events - bool HandleMove(int x, int y); - bool HandleMoving(wxRect& rect); - bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); - bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // list of disabled children before last call to our Disable() - wxWindowList *m_childrenDisabled; - - // number of calls to Freeze() minus number of calls to Thaw() - unsigned int m_frozenness; - - // current defer window position operation handle (may be NULL) - WXHANDLE m_hDWP; - -protected: - // When deferred positioning is done these hold the pending changes, and - // are used for the default values if another size/pos changes is done on - // this window before the group of deferred changes is completed. - wxPoint m_pendingPosition; - wxSize m_pendingSize; - -private: -#ifdef __POCKETPC__ - bool m_contextMenuEnabled; -#endif - - DECLARE_DYNAMIC_CLASS(wxWindowMSW) - DECLARE_NO_COPY_CLASS(wxWindowMSW) - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// inline functions -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_4 - -inline bool wxWindowMSW::GetUseCtl3D() const { return false; } -inline bool wxWindowMSW::GetTransparentBackground() const { return false; } -inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { } - -#endif // WXWIN_COMPATIBILITY_2_4 - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -// kbd code translation -WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0); -WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual = NULL); - -// window creation helper class: before creating a new HWND, instantiate an -// object of this class on stack - this allows to process the messages sent to -// the window even before CreateWindow() returns -class wxWindowCreationHook -{ -public: - wxWindowCreationHook(wxWindowMSW *winBeingCreated); - ~wxWindowCreationHook(); -}; - -// ---------------------------------------------------------------------------- -// global objects -// ---------------------------------------------------------------------------- - -// notice that this hash must be defined after wxWindow declaration as it -// needs to "see" its dtor and not just forward declaration -#include "wx/hash.h" - -// pseudo-template HWND <-> wxWindow hash table -#if WXWIN_COMPATIBILITY_2_4 -WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable); -#else -WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable); -#endif - -extern wxWinHashTable *wxWinHandleHash; - -#endif // _WX_WINDOW_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/window.h +// Purpose: wxWindowMSW class +// Author: Julian Smart +// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling, +// elimination of Default(), ... +// Created: 01/02/97 +// RCS-ID: $Id: window.h 53929 2008-06-02 18:27:16Z RD $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_4 +// they're unused by wxWidgets... +enum +{ + wxKEY_SHIFT = 1, + wxKEY_CTRL = 2 +}; +#endif + +// --------------------------------------------------------------------------- +// wxWindow declaration for MSW +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowMSW : public wxWindowBase +{ + friend class wxSpinCtrl; + friend class wxSlider; + friend class wxRadioBox; +#if defined __VISUALC__ && __VISUALC__ <= 1200 + friend class wxWindowMSW; +#endif +public: + wxWindowMSW() { Init(); } + + wxWindowMSW(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowMSW(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + // implement base class pure virtuals + virtual void SetLabel(const wxString& label); + virtual wxString GetLabel() const; + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show( bool show = true ); + virtual bool Enable( bool enable = true ); + + virtual void SetFocus(); + virtual void SetFocusFromKbd(); + + virtual bool Reparent(wxWindowBase *newParent); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ); + virtual void Update(); + virtual void Freeze(); + virtual void Thaw(); + virtual bool IsFrozen() const { return m_frozenness > 0; } + + virtual void SetWindowStyleFlag(long style); + virtual void SetExtraStyle(long exStyle); + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL) + const; + + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ); + virtual void SetScrollPos( int orient, int pos, bool refresh = true ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = (wxRect *) NULL ); + + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + + virtual void SetLayoutDirection(wxLayoutDirection dir); + virtual wxLayoutDirection GetLayoutDirection() const; + virtual wxCoord AdjustForLayoutDirection(wxCoord x, + wxCoord width, + wxCoord widthTotal) const; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool GetUseCtl3D() const ); + wxDEPRECATED( bool GetTransparentBackground() const ); + wxDEPRECATED( void SetTransparent(bool t = true) ); +#endif // WXWIN_COMPATIBILITY_2_4 + +#ifndef __WXUNIVERSAL__ + // Native resource loading (implemented in src/msw/nativdlg.cpp) + // FIXME: should they really be all virtual? + virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); + virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); + wxWindow* GetWindowChild1(wxWindowID id); + wxWindow* GetWindowChild(wxWindowID id); +#endif // __WXUNIVERSAL__ + +#if wxUSE_HOTKEY + // install and deinstall a system wide hotkey + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); + virtual bool UnregisterHotKey(int hotkeyId); +#endif // wxUSE_HOTKEY + +#ifdef __POCKETPC__ + bool IsContextMenuEnabled() const { return m_contextMenuEnabled; } + void EnableContextMenu(bool enable = true) { m_contextMenuEnabled = enable; } +#endif + + // window handle stuff + // ------------------- + + WXHWND GetHWND() const { return m_hWnd; } + void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } + virtual WXWidget GetHandle() const { return GetHWND(); } + + void AssociateHandle(WXWidget handle); + void DissociateHandle(); + + // does this window have deferred position and/or size? + bool IsSizeDeferred() const; + + + // implementation from now on + // ========================== + + // event handlers + // -------------- + + void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); +#ifdef __WXWINCE__ + void OnInitDialog(wxInitDialogEvent& event); +#endif + +public: + // Windows subclassing + void SubclassWin(WXHWND hWnd); + void UnsubclassWin(); + + WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } + void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } + + // return true if the window is of a standard (i.e. not wxWidgets') class + // + // to understand why does it work, look at SubclassWin() code and comments + bool IsOfStandardClass() const { return m_oldWndProc != NULL; } + + wxWindow *FindItem(long id) const; + wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; + + // MSW only: true if this control is part of the main control + virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; } + +#if wxUSE_TOOLTIPS + // MSW only: true if this window or any of its children have a tooltip + virtual bool HasToolTips() const { return GetToolTip() != NULL; } +#endif // wxUSE_TOOLTIPS + + // translate wxWidgets style flags for this control into the Windows style + // and optional extended style for the corresponding native control + // + // this is the function that should be overridden in the derived classes, + // but you will mostly use MSWGetCreateWindowFlags() below + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ; + + // get the MSW window flags corresponding to wxWidgets ones + // + // the functions returns the flags (WS_XXX) directly and puts the ext + // (WS_EX_XXX) flags into the provided pointer if not NULL + WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const + { return MSWGetStyle(GetWindowStyle(), exflags); } + + // update the real underlying window style flags to correspond to the + // current wxWindow object style (safe to call even if window isn't fully + // created yet) + void MSWUpdateStyle(long flagsOld, long exflagsOld); + +#if wxABI_VERSION >= 20805 + // Helper for getting an appropriate theme style for the application. Unnecessary in + // 2.9 and above. + wxBorder GetThemedBorderStyle() const; +#endif + + // translate wxWidgets coords into Windows ones suitable to be passed to + // ::CreateWindow() + // + // returns true if non default coords are returned, false otherwise + bool MSWGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const; + + // get the HWND to be used as parent of this window with CreateWindow() + virtual WXHWND MSWGetParent() const; + + // creates the window of specified Windows class with given style, extended + // style, title and geometry (default values + // + // returns true if the window has been created, false if creation failed + bool MSWCreate(const wxChar *wclass, + const wxChar *title = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + WXDWORD style = 0, + WXDWORD exendedStyle = 0); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + +#ifndef __WXUNIVERSAL__ + // Create an appropriate wxWindow from a HWND + virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); + + // Make sure the window style reflects the HWND style (roughly) + virtual void AdoptAttributesFromHWND(); +#endif // __WXUNIVERSAL__ + + // Setup background and foreground colours correctly + virtual void SetupColours(); + + // ------------------------------------------------------------------------ + // helpers for message handlers: these perform the same function as the + // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into + // the correct parameters + // ------------------------------------------------------------------------ + + void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *id, WXHWND *hwnd, WXWORD *cmd); + void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *state, WXWORD *minimized, WXHWND *hwnd); + void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *code, WXWORD *pos, WXHWND *hwnd); + void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, + WXHDC *hdc, WXHWND *hwnd); + void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *item, WXWORD *flags, WXHMENU *hmenu); + + // ------------------------------------------------------------------------ + // internal handlers for MSW messages: all handlers return a boolean value: + // true means that the handler processed the event and false that it didn't + // ------------------------------------------------------------------------ + + // there are several cases where we have virtual functions for Windows + // message processing: this is because these messages often require to be + // processed in a different manner in the derived classes. For all other + // messages, however, we do *not* have corresponding MSWOnXXX() function + // and if the derived class wants to process them, it should override + // MSWWindowProc() directly. + + // scroll event (both horizontal and vertical) + virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control); + + // child control notifications + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // owner-drawn controls need to process these messages + virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); + virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); + + // the rest are not virtual + bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); + bool HandleInitDialog(WXHWND hWndFocus); + bool HandleDestroy(); + + bool HandlePaint(); + bool HandlePrintClient(WXHDC hDC); + bool HandleEraseBkgnd(WXHDC hDC); + + bool HandleMinimize(); + bool HandleMaximize(); + bool HandleSize(int x, int y, WXUINT flag); + bool HandleSizing(wxRect& rect); + bool HandleGetMinMaxInfo(void *mmInfo); + + bool HandleShow(bool show, int status); + bool HandleActivate(int flag, bool minimized, WXHWND activate); + + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd); + + bool HandlePaletteChanged(WXHWND hWndPalChange); + bool HandleQueryNewPalette(); + bool HandleSysColorChange(); + bool HandleDisplayChange(); + bool HandleCaptureChanged(WXHWND gainedCapture); + virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); + + bool HandleQueryEndSession(long logOff, bool *mayEnd); + bool HandleEndSession(bool endSession, long logOff); + + bool HandleSetFocus(WXHWND wnd); + bool HandleKillFocus(WXHWND wnd); + + bool HandleDropFiles(WXWPARAM wParam); + + bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); + bool HandleMouseMove(int x, int y, WXUINT flags); + bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); + + bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false); + bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); + bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); +#if wxUSE_ACCEL + bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); +#endif +#ifdef __WIN32__ + int HandleMenuChar(int chAccel, WXLPARAM lParam); +#endif + // Create and process a clipboard event specified by type. + bool HandleClipboardEvent( WXUINT nMsg ); + + bool HandleQueryDragIcon(WXHICON *hIcon); + + bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); + + bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed); + + + // Window procedure + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // Calls an appropriate default window procedure + virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // message processing helpers + + // return false if the message shouldn't be translated/preprocessed but + // dispatched normally + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); + + // return true if the message was preprocessed and shouldn't be dispatched + virtual bool MSWProcessMessage(WXMSG* pMsg); + + // return true if the message was translated and shouldn't be dispatched + virtual bool MSWTranslateMessage(WXMSG* pMsg); + + // called when the window is about to be destroyed + virtual void MSWDestroyWindow(); + + + // this function should return the brush to paint the children controls + // background or 0 if this window doesn't impose any particular background + // on its children + // + // the base class version returns a solid brush if we have a non default + // background colour or 0 otherwise + virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd); + + // return the background brush to use for painting the given window by + // quering the parent windows via their MSWGetBgBrushForChild() recursively + // + // hWndToPaint is normally NULL meaning this window itself, but it can also + // be a child of this window which is used by the static box and could be + // potentially useful for other transparent controls + WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL); + + // gives the parent the possibility to draw its children background, e.g. + // this is used by wxNotebook to do it using DrawThemeBackground() + // + // return true if background was drawn, false otherwise + virtual bool MSWPrintChild(WXHDC WXUNUSED(hDC), wxWindow * WXUNUSED(child)) + { + return false; + } + + // some controls (e.g. wxListBox) need to set the return value themselves + // + // return true to let parent handle it if we don't, false otherwise + virtual bool MSWShouldPropagatePrintChild() + { + return true; + } + + + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX) + void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); + + // check if mouse is in the window + bool IsMouseInWindow() const; + + // check if a native double-buffering applies for this window + virtual bool IsDoubleBuffered() const; + +#if wxABI_VERSION >= 20808 + void SetDoubleBuffered(bool on); +#endif + + // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false + void GenerateMouseLeave(); + + // virtual function for implementing internal idle + // behaviour + virtual void OnInternalIdle(); + +protected: + +#if wxUSE_MENUS_NATIVE + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); +#endif // wxUSE_MENUS_NATIVE + + // the window handle + WXHWND m_hWnd; + + // the old window proc (we subclass all windows) + WXFARPROC m_oldWndProc; + + // additional (MSW specific) flags + bool m_mouseInWindow:1; + bool m_lastKeydownProcessed:1; + + // the size of one page for scrolling + int m_xThumbSize; + int m_yThumbSize; + + // implement the base class pure virtuals + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + + // this simply moves/resizes the given HWND which is supposed to be our + // sibling (this is useful for controls which are composite at MSW level + // and for which DoMoveWindow() is not enough) + // + // returns true if the window move was deferred, false if it was moved + // immediately (no error return) + bool DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height); + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow(int x, int y, int width, int height); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); + + // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in + // comctl32.dll in our code -- see the function body for more info) + bool HandleTooltipNotify(WXUINT code, + WXLPARAM lParam, + const wxString& ttip); +#endif // wxUSE_TOOLTIPS + + // the helper functions used by HandleChar/KeyXXX methods + wxKeyEvent CreateKeyEvent(wxEventType evType, int id, + WXLPARAM lParam = 0, WXWPARAM wParam = 0) const; + + + // default OnEraseBackground() implementation, return true if we did erase + // the background, false otherwise (i.e. the system should erase it) + bool DoEraseBackground(WXHDC hDC); + + // generate WM_CHANGEUISTATE if it's needed for the OS we're running under + // + // action should be one of the UIS_XXX constants + // state should be one or more of the UISF_XXX constants + // if action == UIS_INITIALIZE then it doesn't seem to matter what we use + // for state as the system will decide for us what needs to be set + void MSWUpdateUIState(int action, int state = 0); + +private: + // common part of all ctors + void Init(); + + // the (non-virtual) handlers for the events + bool HandleMove(int x, int y); + bool HandleMoving(wxRect& rect); + bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); + bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // list of disabled children before last call to our Disable() + wxWindowList *m_childrenDisabled; + + // number of calls to Freeze() minus number of calls to Thaw() + unsigned int m_frozenness; + + // current defer window position operation handle (may be NULL) + WXHANDLE m_hDWP; + +protected: + // When deferred positioning is done these hold the pending changes, and + // are used for the default values if another size/pos changes is done on + // this window before the group of deferred changes is completed. + wxPoint m_pendingPosition; + wxSize m_pendingSize; + +private: +#ifdef __POCKETPC__ + bool m_contextMenuEnabled; +#endif + + DECLARE_DYNAMIC_CLASS(wxWindowMSW) + DECLARE_NO_COPY_CLASS(wxWindowMSW) + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// inline functions +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_4 + +inline bool wxWindowMSW::GetUseCtl3D() const { return false; } +inline bool wxWindowMSW::GetTransparentBackground() const { return false; } +inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { } + +#endif // WXWIN_COMPATIBILITY_2_4 + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// kbd code translation +WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0); +WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual = NULL); + +// window creation helper class: before creating a new HWND, instantiate an +// object of this class on stack - this allows to process the messages sent to +// the window even before CreateWindow() returns +class wxWindowCreationHook +{ +public: + wxWindowCreationHook(wxWindowMSW *winBeingCreated); + ~wxWindowCreationHook(); +}; + +// ---------------------------------------------------------------------------- +// global objects +// ---------------------------------------------------------------------------- + +// notice that this hash must be defined after wxWindow declaration as it +// needs to "see" its dtor and not just forward declaration +#include "wx/hash.h" + +// pseudo-template HWND <-> wxWindow hash table +#if WXWIN_COMPATIBILITY_2_4 +WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable); +#else +WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable); +#endif + +extern wxWinHashTable *wxWinHandleHash; + +#endif // _WX_WINDOW_H_ diff --git a/Externals/wxWidgets/include/wx/msw/winundef.h b/Externals/wxWidgets/include/wx/msw/winundef.h index b8acb68b72..47d59e7c40 100644 --- a/Externals/wxWidgets/include/wx/msw/winundef.h +++ b/Externals/wxWidgets/include/wx/msw/winundef.h @@ -1,490 +1,490 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: winundef.h -// Purpose: undefine the common symbols #define'd by <windows.h> -// Author: Vadim Zeitlin -// Modified by: -// Created: 16.05.99 -// RCS-ID: $Id: winundef.h 36044 2005-10-31 19:35:41Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h, - * then again _AFTER_ you've included windows.h, in which case it won't work - * a 2nd time -- JACS -#ifndef _WX_WINUNDEF_H_ -#define _WX_WINUNDEF_H_ - */ - -// ---------------------------------------------------------------------------- -// windows.h #defines the following identifiers which are also used in wxWin so -// we replace these symbols with the corresponding inline functions and -// undefine the macro. -// -// This looks quite ugly here but allows us to write clear (and correct!) code -// elsewhere because the functions, unlike the macros, respect the scope. -// ---------------------------------------------------------------------------- - -// CreateDialog - -#if defined(CreateDialog) - #undef CreateDialog - - inline HWND CreateDialog(HINSTANCE hInstance, - LPCTSTR pTemplate, - HWND hwndParent, - DLGPROC pDlgProc) - { - #ifdef _UNICODE - return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc); - #else - return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc); - #endif - } -#endif - -// CreateFont - -#ifdef CreateFont - #undef CreateFont - - inline HFONT CreateFont(int height, - int width, - int escapement, - int orientation, - int weight, - DWORD italic, - DWORD underline, - DWORD strikeout, - DWORD charset, - DWORD outprecision, - DWORD clipprecision, - DWORD quality, - DWORD family, - LPCTSTR facename) - { - #ifdef _UNICODE - return CreateFontW(height, width, escapement, orientation, - weight, italic, underline, strikeout, charset, - outprecision, clipprecision, quality, - family, facename); - #else - return CreateFontA(height, width, escapement, orientation, - weight, italic, underline, strikeout, charset, - outprecision, clipprecision, quality, - family, facename); - #endif - } -#endif // CreateFont - -// CreateWindow - -#if defined(CreateWindow) - #undef CreateWindow - - inline HWND CreateWindow(LPCTSTR lpClassName, - LPCTSTR lpWndClass, - DWORD dwStyle, - int x, int y, int w, int h, - HWND hWndParent, - HMENU hMenu, - HINSTANCE hInstance, - LPVOID lpParam) - { - #ifdef _UNICODE - return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h, - hWndParent, hMenu, hInstance, lpParam); - #else - return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h, - hWndParent, hMenu, hInstance, lpParam); - #endif - } -#endif - -// LoadMenu - -#ifdef LoadMenu - #undef LoadMenu - - inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name) - { - #ifdef _UNICODE - return LoadMenuW(instance, name); - #else - return LoadMenuA(instance, name); - #endif - } -#endif - -// FindText - -#ifdef FindText - #undef FindText - - inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace) - { - #ifdef UNICODE - return FindTextW(lpfindreplace); - #else - return FindTextA(lpfindreplace); - #endif // !UNICODE - } -#endif - -// GetCharWidth - -#ifdef GetCharWidth - #undef GetCharWidth - inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer) - { - #ifdef _UNICODE - return GetCharWidthW(dc, first, last, buffer); - #else - return GetCharWidthA(dc, first, last, buffer); - #endif - } -#endif - -// FindWindow - -#ifdef FindWindow - #undef FindWindow - #ifdef _UNICODE - inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname) - { - return FindWindowW(classname, windowname); - } - #else - inline HWND FindWindow(LPCSTR classname, LPCSTR windowname) - { - return FindWindowA(classname, windowname); - } - #endif -#endif - -// PlaySound - -#ifdef PlaySound - #undef PlaySound - #ifdef _UNICODE - inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound) - { - return PlaySoundW(pszSound, hMod, fdwSound); - } - #else - inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound) - { - return PlaySoundA(pszSound, hMod, fdwSound); - } - #endif -#endif - -// GetClassName - -#ifdef GetClassName - #undef GetClassName - #ifdef _UNICODE - inline int GetClassName(HWND h, LPWSTR classname, int maxcount) - { - return GetClassNameW(h, classname, maxcount); - } - #else - inline int GetClassName(HWND h, LPSTR classname, int maxcount) - { - return GetClassNameA(h, classname, maxcount); - } - #endif -#endif - -// GetClassInfo - -#ifdef GetClassInfo - #undef GetClassInfo - #ifdef _UNICODE - inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass) - { - return GetClassInfoW(h, name, winclass); - } - #else - inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass) - { - return GetClassInfoA(h, name, winclass); - } - #endif -#endif - -// LoadAccelerators - -#ifdef LoadAccelerators - #undef LoadAccelerators - #ifdef _UNICODE - inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name) - { - return LoadAcceleratorsW(h, name); - } - #else - inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name) - { - return LoadAcceleratorsA(h, name); - } - #endif -#endif - -// DrawText - -#ifdef DrawText - #undef DrawText - #ifdef _UNICODE - inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format) - { - return DrawTextW(h, str, count, rect, format); - } - #else - inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format) - { - return DrawTextA(h, str, count, rect, format); - } - #endif -#endif - - -/* - When this file is included, sometimes the wxCHECK_W32API_VERSION macro - is undefined. With for example CodeWarrior this gives problems with - the following code: - #if 0 && wxCHECK_W32API_VERSION( 0, 5 ) - Because CodeWarrior does macro expansion before test evaluation. - We define wxCHECK_W32API_VERSION here if it's undefined. -*/ -#if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION) - #define wxCHECK_W32API_VERSION(maj, min) (0) -#endif - -// StartDoc - -#ifdef StartDoc - #undef StartDoc - #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 ) - #define DOCINFOW DOCINFO - #define DOCINFOA DOCINFO - #endif - #ifdef _UNICODE - inline int StartDoc(HDC h, CONST DOCINFOW* info) - { - return StartDocW(h, (DOCINFOW*) info); - } - #else - inline int StartDoc(HDC h, CONST DOCINFOA* info) - { - return StartDocA(h, (DOCINFOA*) info); - } - #endif -#endif - -// GetObject - -#ifdef GetObject - #undef GetObject - inline int GetObject(HGDIOBJ h, int i, LPVOID buffer) - { - #ifdef _UNICODE - return GetObjectW(h, i, buffer); - #else - return GetObjectA(h, i, buffer); - #endif - } -#endif - -// GetMessage - -#ifdef GetMessage - #undef GetMessage - inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax) - { - #ifdef _UNICODE - return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); - #else - return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); - #endif - } -#endif - -// LoadIcon -#ifdef LoadIcon - #undef LoadIcon - inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName) - { - #ifdef _UNICODE - return LoadIconW(hInstance, lpIconName); - #else // ANSI - return LoadIconA(hInstance, lpIconName); - #endif // Unicode/ANSI - } -#endif // LoadIcon - -// LoadBitmap -#ifdef LoadBitmap - #undef LoadBitmap - inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName) - { - #ifdef _UNICODE - return LoadBitmapW(hInstance, lpBitmapName); - #else // ANSI - return LoadBitmapA(hInstance, lpBitmapName); - #endif // Unicode/ANSI - } -#endif // LoadBitmap - -// LoadLibrary - -#ifdef LoadLibrary - #undef LoadLibrary - #ifdef _UNICODE - inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName) - { - return LoadLibraryW(lpLibFileName); - } - #else - inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName) - { - return LoadLibraryA(lpLibFileName); - } - #endif -#endif - -// FindResource -#ifdef FindResource - #undef FindResource - #ifdef _UNICODE - inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType) - { - return FindResourceW(hModule, lpName, lpType); - } - #else - inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType) - { - return FindResourceA(hModule, lpName, lpType); - } - #endif -#endif - -// IsMaximized - -#ifdef IsMaximized - #undef IsMaximized - inline BOOL IsMaximized(HWND WXUNUSED_IN_WINCE(hwnd)) - { -#ifdef __WXWINCE__ - return FALSE; -#else - return IsZoomed(hwnd); -#endif - } -#endif - -// GetFirstChild - -#ifdef GetFirstChild - #undef GetFirstChild - inline HWND GetFirstChild(HWND WXUNUSED_IN_WINCE(hwnd)) - { -#ifdef __WXWINCE__ - return 0; -#else - return GetTopWindow(hwnd); -#endif - } -#endif - -// GetFirstSibling - -#ifdef GetFirstSibling - #undef GetFirstSibling - inline HWND GetFirstSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDFIRST); - } -#endif - -// GetLastSibling - -#ifdef GetLastSibling - #undef GetLastSibling - inline HWND GetLastSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDLAST); - } -#endif - -// GetPrevSibling - -#ifdef GetPrevSibling - #undef GetPrevSibling - inline HWND GetPrevSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDPREV); - } -#endif - -// GetNextSibling - -#ifdef GetNextSibling - #undef GetNextSibling - inline HWND GetNextSibling(HWND hwnd) - { - return GetWindow(hwnd,GW_HWNDNEXT); - } -#endif - -// For WINE - -#if defined(GetWindowStyle) - #undef GetWindowStyle -#endif - -// For ming and cygwin - -// GetFirstChild -#ifdef GetFirstChild - #undef GetFirstChild - inline HWND GetFirstChild(HWND h) - { - return GetTopWindow(h); - } -#endif - - -// GetNextSibling -#ifdef GetNextSibling - #undef GetNextSibling - inline HWND GetNextSibling(HWND h) - { - return GetWindow(h, GW_HWNDNEXT); - } -#endif - - -#ifdef Yield - #undef Yield -#endif - - -#if defined(__WXWINCE__) && defined(DrawIcon) //#ifdef DrawIcon - #undef DrawIcon - inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hicon) - { - return DrawIconEx(hdc,x,y,hicon,0,0,0,NULL, DI_NORMAL) ; - } -#endif - - -// GetWindowProc -//ifdef GetWindowProc -// #undef GetWindowProc -//endif -//ifdef GetNextChild -// #undef GetNextChild -//endif - -// #endif // _WX_WINUNDEF_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: winundef.h +// Purpose: undefine the common symbols #define'd by <windows.h> +// Author: Vadim Zeitlin +// Modified by: +// Created: 16.05.99 +// RCS-ID: $Id: winundef.h 36044 2005-10-31 19:35:41Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h, + * then again _AFTER_ you've included windows.h, in which case it won't work + * a 2nd time -- JACS +#ifndef _WX_WINUNDEF_H_ +#define _WX_WINUNDEF_H_ + */ + +// ---------------------------------------------------------------------------- +// windows.h #defines the following identifiers which are also used in wxWin so +// we replace these symbols with the corresponding inline functions and +// undefine the macro. +// +// This looks quite ugly here but allows us to write clear (and correct!) code +// elsewhere because the functions, unlike the macros, respect the scope. +// ---------------------------------------------------------------------------- + +// CreateDialog + +#if defined(CreateDialog) + #undef CreateDialog + + inline HWND CreateDialog(HINSTANCE hInstance, + LPCTSTR pTemplate, + HWND hwndParent, + DLGPROC pDlgProc) + { + #ifdef _UNICODE + return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc); + #else + return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc); + #endif + } +#endif + +// CreateFont + +#ifdef CreateFont + #undef CreateFont + + inline HFONT CreateFont(int height, + int width, + int escapement, + int orientation, + int weight, + DWORD italic, + DWORD underline, + DWORD strikeout, + DWORD charset, + DWORD outprecision, + DWORD clipprecision, + DWORD quality, + DWORD family, + LPCTSTR facename) + { + #ifdef _UNICODE + return CreateFontW(height, width, escapement, orientation, + weight, italic, underline, strikeout, charset, + outprecision, clipprecision, quality, + family, facename); + #else + return CreateFontA(height, width, escapement, orientation, + weight, italic, underline, strikeout, charset, + outprecision, clipprecision, quality, + family, facename); + #endif + } +#endif // CreateFont + +// CreateWindow + +#if defined(CreateWindow) + #undef CreateWindow + + inline HWND CreateWindow(LPCTSTR lpClassName, + LPCTSTR lpWndClass, + DWORD dwStyle, + int x, int y, int w, int h, + HWND hWndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam) + { + #ifdef _UNICODE + return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h, + hWndParent, hMenu, hInstance, lpParam); + #else + return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h, + hWndParent, hMenu, hInstance, lpParam); + #endif + } +#endif + +// LoadMenu + +#ifdef LoadMenu + #undef LoadMenu + + inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name) + { + #ifdef _UNICODE + return LoadMenuW(instance, name); + #else + return LoadMenuA(instance, name); + #endif + } +#endif + +// FindText + +#ifdef FindText + #undef FindText + + inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace) + { + #ifdef UNICODE + return FindTextW(lpfindreplace); + #else + return FindTextA(lpfindreplace); + #endif // !UNICODE + } +#endif + +// GetCharWidth + +#ifdef GetCharWidth + #undef GetCharWidth + inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer) + { + #ifdef _UNICODE + return GetCharWidthW(dc, first, last, buffer); + #else + return GetCharWidthA(dc, first, last, buffer); + #endif + } +#endif + +// FindWindow + +#ifdef FindWindow + #undef FindWindow + #ifdef _UNICODE + inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname) + { + return FindWindowW(classname, windowname); + } + #else + inline HWND FindWindow(LPCSTR classname, LPCSTR windowname) + { + return FindWindowA(classname, windowname); + } + #endif +#endif + +// PlaySound + +#ifdef PlaySound + #undef PlaySound + #ifdef _UNICODE + inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound) + { + return PlaySoundW(pszSound, hMod, fdwSound); + } + #else + inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound) + { + return PlaySoundA(pszSound, hMod, fdwSound); + } + #endif +#endif + +// GetClassName + +#ifdef GetClassName + #undef GetClassName + #ifdef _UNICODE + inline int GetClassName(HWND h, LPWSTR classname, int maxcount) + { + return GetClassNameW(h, classname, maxcount); + } + #else + inline int GetClassName(HWND h, LPSTR classname, int maxcount) + { + return GetClassNameA(h, classname, maxcount); + } + #endif +#endif + +// GetClassInfo + +#ifdef GetClassInfo + #undef GetClassInfo + #ifdef _UNICODE + inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass) + { + return GetClassInfoW(h, name, winclass); + } + #else + inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass) + { + return GetClassInfoA(h, name, winclass); + } + #endif +#endif + +// LoadAccelerators + +#ifdef LoadAccelerators + #undef LoadAccelerators + #ifdef _UNICODE + inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name) + { + return LoadAcceleratorsW(h, name); + } + #else + inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name) + { + return LoadAcceleratorsA(h, name); + } + #endif +#endif + +// DrawText + +#ifdef DrawText + #undef DrawText + #ifdef _UNICODE + inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format) + { + return DrawTextW(h, str, count, rect, format); + } + #else + inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format) + { + return DrawTextA(h, str, count, rect, format); + } + #endif +#endif + + +/* + When this file is included, sometimes the wxCHECK_W32API_VERSION macro + is undefined. With for example CodeWarrior this gives problems with + the following code: + #if 0 && wxCHECK_W32API_VERSION( 0, 5 ) + Because CodeWarrior does macro expansion before test evaluation. + We define wxCHECK_W32API_VERSION here if it's undefined. +*/ +#if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION) + #define wxCHECK_W32API_VERSION(maj, min) (0) +#endif + +// StartDoc + +#ifdef StartDoc + #undef StartDoc + #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 ) + #define DOCINFOW DOCINFO + #define DOCINFOA DOCINFO + #endif + #ifdef _UNICODE + inline int StartDoc(HDC h, CONST DOCINFOW* info) + { + return StartDocW(h, (DOCINFOW*) info); + } + #else + inline int StartDoc(HDC h, CONST DOCINFOA* info) + { + return StartDocA(h, (DOCINFOA*) info); + } + #endif +#endif + +// GetObject + +#ifdef GetObject + #undef GetObject + inline int GetObject(HGDIOBJ h, int i, LPVOID buffer) + { + #ifdef _UNICODE + return GetObjectW(h, i, buffer); + #else + return GetObjectA(h, i, buffer); + #endif + } +#endif + +// GetMessage + +#ifdef GetMessage + #undef GetMessage + inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax) + { + #ifdef _UNICODE + return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); + #else + return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); + #endif + } +#endif + +// LoadIcon +#ifdef LoadIcon + #undef LoadIcon + inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName) + { + #ifdef _UNICODE + return LoadIconW(hInstance, lpIconName); + #else // ANSI + return LoadIconA(hInstance, lpIconName); + #endif // Unicode/ANSI + } +#endif // LoadIcon + +// LoadBitmap +#ifdef LoadBitmap + #undef LoadBitmap + inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName) + { + #ifdef _UNICODE + return LoadBitmapW(hInstance, lpBitmapName); + #else // ANSI + return LoadBitmapA(hInstance, lpBitmapName); + #endif // Unicode/ANSI + } +#endif // LoadBitmap + +// LoadLibrary + +#ifdef LoadLibrary + #undef LoadLibrary + #ifdef _UNICODE + inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName) + { + return LoadLibraryW(lpLibFileName); + } + #else + inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName) + { + return LoadLibraryA(lpLibFileName); + } + #endif +#endif + +// FindResource +#ifdef FindResource + #undef FindResource + #ifdef _UNICODE + inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType) + { + return FindResourceW(hModule, lpName, lpType); + } + #else + inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType) + { + return FindResourceA(hModule, lpName, lpType); + } + #endif +#endif + +// IsMaximized + +#ifdef IsMaximized + #undef IsMaximized + inline BOOL IsMaximized(HWND WXUNUSED_IN_WINCE(hwnd)) + { +#ifdef __WXWINCE__ + return FALSE; +#else + return IsZoomed(hwnd); +#endif + } +#endif + +// GetFirstChild + +#ifdef GetFirstChild + #undef GetFirstChild + inline HWND GetFirstChild(HWND WXUNUSED_IN_WINCE(hwnd)) + { +#ifdef __WXWINCE__ + return 0; +#else + return GetTopWindow(hwnd); +#endif + } +#endif + +// GetFirstSibling + +#ifdef GetFirstSibling + #undef GetFirstSibling + inline HWND GetFirstSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDFIRST); + } +#endif + +// GetLastSibling + +#ifdef GetLastSibling + #undef GetLastSibling + inline HWND GetLastSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDLAST); + } +#endif + +// GetPrevSibling + +#ifdef GetPrevSibling + #undef GetPrevSibling + inline HWND GetPrevSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDPREV); + } +#endif + +// GetNextSibling + +#ifdef GetNextSibling + #undef GetNextSibling + inline HWND GetNextSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDNEXT); + } +#endif + +// For WINE + +#if defined(GetWindowStyle) + #undef GetWindowStyle +#endif + +// For ming and cygwin + +// GetFirstChild +#ifdef GetFirstChild + #undef GetFirstChild + inline HWND GetFirstChild(HWND h) + { + return GetTopWindow(h); + } +#endif + + +// GetNextSibling +#ifdef GetNextSibling + #undef GetNextSibling + inline HWND GetNextSibling(HWND h) + { + return GetWindow(h, GW_HWNDNEXT); + } +#endif + + +#ifdef Yield + #undef Yield +#endif + + +#if defined(__WXWINCE__) && defined(DrawIcon) //#ifdef DrawIcon + #undef DrawIcon + inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hicon) + { + return DrawIconEx(hdc,x,y,hicon,0,0,0,NULL, DI_NORMAL) ; + } +#endif + + +// GetWindowProc +//ifdef GetWindowProc +// #undef GetWindowProc +//endif +//ifdef GetNextChild +// #undef GetNextChild +//endif + +// #endif // _WX_WINUNDEF_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/wrapcctl.h b/Externals/wxWidgets/include/wx/msw/wrapcctl.h index eaa68be044..ecd206db3d 100644 --- a/Externals/wxWidgets/include/wx/msw/wrapcctl.h +++ b/Externals/wxWidgets/include/wx/msw/wrapcctl.h @@ -1,62 +1,62 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapcctl.h -// Purpose: Wrapper for the standard <commctrl.h> header -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.08.2003 -// RCS-ID: $Id: wrapcctl.h 41054 2006-09-07 19:01:45Z ABX $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPCCTL_H_ -#define _WX_MSW_WRAPCCTL_H_ - -// define _WIN32_IE to a high value because we always check for the version -// of installed DLLs at runtime anyway (see wxApp::GetComCtl32Version()) unless -// the user really doesn't want it and had defined it to a (presumably lower) -// value -// -// just for the reference, here is the table showing what the different value -// of _WIN32_IE correspond to: -// -// 0x0200 for comctl32.dll 4.00 shipped with Win95/NT 4.0 -// 0x0300 4.70 IE 3.x -// 0x0400 4.71 IE 4.0 -// 0x0401 4.72 IE 4.01 and Win98 -// 0x0500 5.80 IE 5.x -// 0x0500 5.81 Win2k/ME -// 0x0600 6.00 WinXP - -#ifndef _WIN32_IE - // use maximal set of features by default, we check for them during - // run-time anyhow - #define _WIN32_IE 0x0600 -#endif // !defined(_WIN32_IE) - -#include "wx/msw/wrapwin.h" - -#include <commctrl.h> - -// define things which might be missing from our commctrl.h -#include "wx/msw/missing.h" - -// Set Unicode format for a common control -inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd)) -{ -#ifndef __WXWINCE__ - ::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0); -#else // !__WXWINCE__ - // here it should be already in Unicode anyhow -#endif // __WXWINCE__/!__WXWINCE__ -} - -#if wxUSE_GUI -// Return the default font for the common controls -// -// this is implemented in msw/settings.cpp -class wxFont; -extern wxFont wxGetCCDefaultFont(); -#endif - -#endif // _WX_MSW_WRAPCCTL_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapcctl.h +// Purpose: Wrapper for the standard <commctrl.h> header +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.08.2003 +// RCS-ID: $Id: wrapcctl.h 41054 2006-09-07 19:01:45Z ABX $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPCCTL_H_ +#define _WX_MSW_WRAPCCTL_H_ + +// define _WIN32_IE to a high value because we always check for the version +// of installed DLLs at runtime anyway (see wxApp::GetComCtl32Version()) unless +// the user really doesn't want it and had defined it to a (presumably lower) +// value +// +// just for the reference, here is the table showing what the different value +// of _WIN32_IE correspond to: +// +// 0x0200 for comctl32.dll 4.00 shipped with Win95/NT 4.0 +// 0x0300 4.70 IE 3.x +// 0x0400 4.71 IE 4.0 +// 0x0401 4.72 IE 4.01 and Win98 +// 0x0500 5.80 IE 5.x +// 0x0500 5.81 Win2k/ME +// 0x0600 6.00 WinXP + +#ifndef _WIN32_IE + // use maximal set of features by default, we check for them during + // run-time anyhow + #define _WIN32_IE 0x0600 +#endif // !defined(_WIN32_IE) + +#include "wx/msw/wrapwin.h" + +#include <commctrl.h> + +// define things which might be missing from our commctrl.h +#include "wx/msw/missing.h" + +// Set Unicode format for a common control +inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd)) +{ +#ifndef __WXWINCE__ + ::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0); +#else // !__WXWINCE__ + // here it should be already in Unicode anyhow +#endif // __WXWINCE__/!__WXWINCE__ +} + +#if wxUSE_GUI +// Return the default font for the common controls +// +// this is implemented in msw/settings.cpp +class wxFont; +extern wxFont wxGetCCDefaultFont(); +#endif + +#endif // _WX_MSW_WRAPCCTL_H_ diff --git a/Externals/wxWidgets/include/wx/msw/wrapcdlg.h b/Externals/wxWidgets/include/wx/msw/wrapcdlg.h index 9075152919..733e1b5f99 100644 --- a/Externals/wxWidgets/include/wx/msw/wrapcdlg.h +++ b/Externals/wxWidgets/include/wx/msw/wrapcdlg.h @@ -1,28 +1,28 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapcdlg.h -// Purpose: Wrapper for the standard <commdlg.h> header -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 22.03.2005 -// RCS-ID: $Id: wrapcdlg.h 43151 2006-11-07 09:08:33Z JS $ -// Copyright: (c) 2005 Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPCDLG_H_ -#define _WX_MSW_WRAPCDLG_H_ - -#include "wx/defs.h" - -#include "wx/msw/wrapwin.h" -#include "wx/msw/private.h" -#include "wx/msw/missing.h" - -#if wxUSE_COMMON_DIALOGS && !defined(__SMARTPHONE__) && !defined(__WXMICROWIN__) - #include <commdlg.h> -#endif - -#include "wx/msw/winundef.h" - -#endif // _WX_MSW_WRAPCDLG_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapcdlg.h +// Purpose: Wrapper for the standard <commdlg.h> header +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 22.03.2005 +// RCS-ID: $Id: wrapcdlg.h 43151 2006-11-07 09:08:33Z JS $ +// Copyright: (c) 2005 Wlodzimierz Skiba +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPCDLG_H_ +#define _WX_MSW_WRAPCDLG_H_ + +#include "wx/defs.h" + +#include "wx/msw/wrapwin.h" +#include "wx/msw/private.h" +#include "wx/msw/missing.h" + +#if wxUSE_COMMON_DIALOGS && !defined(__SMARTPHONE__) && !defined(__WXMICROWIN__) + #include <commdlg.h> +#endif + +#include "wx/msw/winundef.h" + +#endif // _WX_MSW_WRAPCDLG_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/wrapshl.h b/Externals/wxWidgets/include/wx/msw/wrapshl.h index 282a81c015..72578af613 100644 --- a/Externals/wxWidgets/include/wx/msw/wrapshl.h +++ b/Externals/wxWidgets/include/wx/msw/wrapshl.h @@ -1,90 +1,90 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wrapshl.h -// Purpose: wrapper class for stuff from shell32.dll -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-19 -// RCS-ID: $Id: wrapshl.h 40367 2006-07-29 19:19:50Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WRAPSHL_H_ -#define _WX_MSW_WRAPSHL_H_ - -#ifdef __WXWINCE__ - #include <winreg.h> - #include <objbase.h> - #include <shlguid.h> -#endif - -#include <shlobj.h> - -#include "wx/msw/winundef.h" - -// ---------------------------------------------------------------------------- -// wxItemIdList implements RAII on top of ITEMIDLIST -// ---------------------------------------------------------------------------- - -class wxItemIdList -{ -public: - // ctor takes ownership of the item and will free it - wxItemIdList(LPITEMIDLIST pidl) - { - m_pidl = pidl; - } - - static void Free(LPITEMIDLIST pidl) - { - if ( pidl ) - { - LPMALLOC pMalloc; - SHGetMalloc(&pMalloc); - if ( pMalloc ) - { - pMalloc->Free(pidl); - pMalloc->Release(); - } - else - { - wxLogLastError(wxT("SHGetMalloc")); - } - } - } - - ~wxItemIdList() - { - Free(m_pidl); - } - - // implicit conversion to LPITEMIDLIST - operator LPITEMIDLIST() const { return m_pidl; } - - // get the corresponding path, returns empty string on error - wxString GetPath() const - { - wxString path; - if ( !SHGetPathFromIDList(m_pidl, wxStringBuffer(path, MAX_PATH)) ) - { - wxLogLastError(_T("SHGetPathFromIDList")); - } - - return path; - } - -private: - LPITEMIDLIST m_pidl; - - DECLARE_NO_COPY_CLASS(wxItemIdList) -}; - -// enable autocompleting filenames in the text control with given HWND -// -// this only works on systems with shlwapi.dll 5.0 or later -// -// implemented in src/msw/utilsgui.cpp -extern bool wxEnableFileNameAutoComplete(HWND hwnd); - -#endif // _WX_MSW_WRAPSHL_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapshl.h +// Purpose: wrapper class for stuff from shell32.dll +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-19 +// RCS-ID: $Id: wrapshl.h 40367 2006-07-29 19:19:50Z VZ $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPSHL_H_ +#define _WX_MSW_WRAPSHL_H_ + +#ifdef __WXWINCE__ + #include <winreg.h> + #include <objbase.h> + #include <shlguid.h> +#endif + +#include <shlobj.h> + +#include "wx/msw/winundef.h" + +// ---------------------------------------------------------------------------- +// wxItemIdList implements RAII on top of ITEMIDLIST +// ---------------------------------------------------------------------------- + +class wxItemIdList +{ +public: + // ctor takes ownership of the item and will free it + wxItemIdList(LPITEMIDLIST pidl) + { + m_pidl = pidl; + } + + static void Free(LPITEMIDLIST pidl) + { + if ( pidl ) + { + LPMALLOC pMalloc; + SHGetMalloc(&pMalloc); + if ( pMalloc ) + { + pMalloc->Free(pidl); + pMalloc->Release(); + } + else + { + wxLogLastError(wxT("SHGetMalloc")); + } + } + } + + ~wxItemIdList() + { + Free(m_pidl); + } + + // implicit conversion to LPITEMIDLIST + operator LPITEMIDLIST() const { return m_pidl; } + + // get the corresponding path, returns empty string on error + wxString GetPath() const + { + wxString path; + if ( !SHGetPathFromIDList(m_pidl, wxStringBuffer(path, MAX_PATH)) ) + { + wxLogLastError(_T("SHGetPathFromIDList")); + } + + return path; + } + +private: + LPITEMIDLIST m_pidl; + + DECLARE_NO_COPY_CLASS(wxItemIdList) +}; + +// enable autocompleting filenames in the text control with given HWND +// +// this only works on systems with shlwapi.dll 5.0 or later +// +// implemented in src/msw/utilsgui.cpp +extern bool wxEnableFileNameAutoComplete(HWND hwnd); + +#endif // _WX_MSW_WRAPSHL_H_ + diff --git a/Externals/wxWidgets/include/wx/msw/wrapwin.h b/Externals/wxWidgets/include/wx/msw/wrapwin.h index d1e6a0a861..8c3c4cef19 100644 --- a/Externals/wxWidgets/include/wx/msw/wrapwin.h +++ b/Externals/wxWidgets/include/wx/msw/wrapwin.h @@ -1,99 +1,99 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: msw/wrapwin.h -// Purpose: Wrapper around <windows.h>, to be included instead of it -// Author: Vaclav Slavik -// Created: 2003/07/22 -// RCS-ID: $Id: wrapwin.h 53877 2008-05-31 12:43:44Z SN $ -// Copyright: (c) 2003 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WRAPWIN_H_ -#define _WX_WRAPWIN_H_ - -#include "wx/platform.h" - -// strict type checking to detect conversion from HFOO to HBAR at compile-time -#ifndef STRICT - #define STRICT 1 -#endif - -// this macro tells windows.h to not define min() and max() as macros: we need -// this as otherwise they conflict with standard C++ functions -#ifndef NOMINMAX - #define NOMINMAX -#endif // NOMINMAX - - -// before including windows.h, define version macros at (currently) maximal -// values because we do all our checks at run-time anyhow -#ifndef WINVER - // the only exception to the above is MSVC 6 which has a time bomb in its - // headers: they warn against using them with WINVER >= 0x0500 as they - // contain only part of the declarations and they're not always correct, so - // don't define WINVER for it at all as this allows everything to work as - // expected both with standard VC6 headers (which define WINVER as 0x0400 - // by default) and headers from a newer SDK (which may define it as 0x0500) - #if !defined(__VISUALC__) || (__VISUALC__ >= 1300) - #define WINVER 0x0600 - #endif -#endif - -#ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0600 -#endif - -/* Deal with clash with __WINDOWS__ include guard */ -#if defined(__WXWINCE__) && defined(__WINDOWS__) -#undef __WINDOWS__ -#endif - -#include <windows.h> - -#if defined(__WXWINCE__) && !defined(__WINDOWS__) -#define __WINDOWS__ -#endif - -// #undef the macros defined in winsows.h which conflict with code elsewhere -#include "wx/msw/winundef.h" - -// Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatability -// in the WINAPI SDK (they are an integral type that is the size of a -// pointer) on MSVC 7 and later. However, they are not available in older -// Platform SDKs, and since they are typedefs and not #defines we simply -// overwrite them if there is a chance that they're not defined -#if (!defined(_MSC_VER) || (_MSC_VER < 1300)) && !defined(__WIN64__) - #define UINT_PTR unsigned int - #define LONG_PTR long - #define ULONG_PTR unsigned long - #define DWORD_PTR unsigned long -#endif // !defined(_MSC_VER) || _MSC_VER < 1300 - -// ---------------------------------------------------------------------------- -// Fix the functions wrongly implemented in unicows.dll -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE_MSLU - -#if wxUSE_GUI - -WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, - WXLPARAM lData, WXWPARAM wData, - int x, int y, int cx, int cy, - unsigned int flags); -#define DrawStateW(dc, br, func, ld, wd, x, y, cx, cy, flags) \ - wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \ - ld, wd, x, y, cx, cy, flags) - -WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn); -#define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn) - -WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn); -#define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn) - -#endif // wxUSE_GUI - -#endif // wxUSE_UNICODE_MSLU - -#endif // _WX_WRAPWIN_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: msw/wrapwin.h +// Purpose: Wrapper around <windows.h>, to be included instead of it +// Author: Vaclav Slavik +// Created: 2003/07/22 +// RCS-ID: $Id: wrapwin.h 53877 2008-05-31 12:43:44Z SN $ +// Copyright: (c) 2003 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WRAPWIN_H_ +#define _WX_WRAPWIN_H_ + +#include "wx/platform.h" + +// strict type checking to detect conversion from HFOO to HBAR at compile-time +#ifndef STRICT + #define STRICT 1 +#endif + +// this macro tells windows.h to not define min() and max() as macros: we need +// this as otherwise they conflict with standard C++ functions +#ifndef NOMINMAX + #define NOMINMAX +#endif // NOMINMAX + + +// before including windows.h, define version macros at (currently) maximal +// values because we do all our checks at run-time anyhow +#ifndef WINVER + // the only exception to the above is MSVC 6 which has a time bomb in its + // headers: they warn against using them with WINVER >= 0x0500 as they + // contain only part of the declarations and they're not always correct, so + // don't define WINVER for it at all as this allows everything to work as + // expected both with standard VC6 headers (which define WINVER as 0x0400 + // by default) and headers from a newer SDK (which may define it as 0x0500) + #if !defined(__VISUALC__) || (__VISUALC__ >= 1300) + #define WINVER 0x0600 + #endif +#endif + +#ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0600 +#endif + +/* Deal with clash with __WINDOWS__ include guard */ +#if defined(__WXWINCE__) && defined(__WINDOWS__) +#undef __WINDOWS__ +#endif + +#include <windows.h> + +#if defined(__WXWINCE__) && !defined(__WINDOWS__) +#define __WINDOWS__ +#endif + +// #undef the macros defined in winsows.h which conflict with code elsewhere +#include "wx/msw/winundef.h" + +// Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatability +// in the WINAPI SDK (they are an integral type that is the size of a +// pointer) on MSVC 7 and later. However, they are not available in older +// Platform SDKs, and since they are typedefs and not #defines we simply +// overwrite them if there is a chance that they're not defined +#if (!defined(_MSC_VER) || (_MSC_VER < 1300)) && !defined(__WIN64__) + #define UINT_PTR unsigned int + #define LONG_PTR long + #define ULONG_PTR unsigned long + #define DWORD_PTR unsigned long +#endif // !defined(_MSC_VER) || _MSC_VER < 1300 + +// ---------------------------------------------------------------------------- +// Fix the functions wrongly implemented in unicows.dll +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE_MSLU + +#if wxUSE_GUI + +WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, + WXLPARAM lData, WXWPARAM wData, + int x, int y, int cx, int cy, + unsigned int flags); +#define DrawStateW(dc, br, func, ld, wd, x, y, cx, cy, flags) \ + wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \ + ld, wd, x, y, cx, cy, flags) + +WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn); +#define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn) + +WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn); +#define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn) + +#endif // wxUSE_GUI + +#endif // wxUSE_UNICODE_MSLU + +#endif // _WX_WRAPWIN_H_ + diff --git a/Externals/wxWidgets/include/wx/notebook.h b/Externals/wxWidgets/include/wx/notebook.h index db1dc13616..40c8ccb96a 100644 --- a/Externals/wxWidgets/include/wx/notebook.h +++ b/Externals/wxWidgets/include/wx/notebook.h @@ -1,183 +1,183 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/notebook.h -// Purpose: wxNotebook interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.02.01 -// RCS-ID: $Id: notebook.h 42152 2006-10-20 09:16:41Z VZ $ -// Copyright: (c) 1996-2000 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NOTEBOOK_H_BASE_ -#define _WX_NOTEBOOK_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_NOTEBOOK - -#include "wx/bookctrl.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them -// if wxUSE_NOTEBOOK is disabled -enum -{ - wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE, - wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON, - wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL, - wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM, - wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE -}; - -// wxNotebook flags - -// use common book wxBK_* flags for describing alignment -#define wxNB_DEFAULT wxBK_DEFAULT -#define wxNB_TOP wxBK_TOP -#define wxNB_BOTTOM wxBK_BOTTOM -#define wxNB_LEFT wxBK_LEFT -#define wxNB_RIGHT wxBK_RIGHT - -#define wxNB_FIXEDWIDTH 0x0100 -#define wxNB_MULTILINE 0x0200 -#define wxNB_NOPAGETHEME 0x0400 -#define wxNB_FLAT 0x0800 - - -typedef wxWindow wxNotebookPage; // so far, any window can be a page - -extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[]; - -#if WXWIN_COMPATIBILITY_2_4 - #define wxNOTEBOOK_NAME wxNotebookNameStr -#endif - -// ---------------------------------------------------------------------------- -// wxNotebookBase: define wxNotebook interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookBase : public wxBookCtrlBase -{ -public: - // ctors - // ----- - - wxNotebookBase() { } - - wxNotebookBase(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr) ; - - // wxNotebook-specific additions to wxBookCtrlBase interface - // --------------------------------------------------------- - - // get the number of rows for a control with wxNB_MULTILINE style (not all - // versions support it - they will always return 1 then) - virtual int GetRowCount() const { return 1; } - - // set the padding between tabs (in pixels) - virtual void SetPadding(const wxSize& padding) = 0; - - // set the size of the tabs for wxNB_FIXEDWIDTH controls - virtual void SetTabSize(const wxSize& sz) = 0; - - - - // implement some base class functions - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - // On platforms that support it, get the theme page background colour, else invalid colour - virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; } - - - // send wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING/ED events - - // returns false if the change to nPage is vetoed by the program - bool SendPageChangingEvent(int nPage); - - // sends the event about page change from old to new (or GetSelection() if - // new is -1) - void SendPageChangedEvent(int nPageOld, int nPageNew = -1); - - -protected: - DECLARE_NO_COPY_CLASS(wxNotebookBase) -}; - -// ---------------------------------------------------------------------------- -// notebook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = -1, int nOldSel = -1) - : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel) - { - } - - wxNotebookEvent(const wxNotebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxNotebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotebookEvent) -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); - -#define wxNotebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotebookEventFunction, &func) - -#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxNotebookEventHandler(fn)) - -#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxNotebookEventHandler(fn)) - -// ---------------------------------------------------------------------------- -// wxNotebook class itself -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/notebook.h" -#elif defined(__WXMSW__) - #include "wx/msw/notebook.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/notebook.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/notebook.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/notebook.h" -#elif defined(__WXMAC__) - #include "wx/mac/notebook.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/notebook.h" -#elif defined(__WXPM__) - #include "wx/os2/notebook.h" -#endif - -#endif // wxUSE_NOTEBOOK - -#endif - // _WX_NOTEBOOK_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/notebook.h +// Purpose: wxNotebook interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 01.02.01 +// RCS-ID: $Id: notebook.h 42152 2006-10-20 09:16:41Z VZ $ +// Copyright: (c) 1996-2000 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTEBOOK_H_BASE_ +#define _WX_NOTEBOOK_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_NOTEBOOK + +#include "wx/bookctrl.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them +// if wxUSE_NOTEBOOK is disabled +enum +{ + wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE, + wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON, + wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL, + wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM, + wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE +}; + +// wxNotebook flags + +// use common book wxBK_* flags for describing alignment +#define wxNB_DEFAULT wxBK_DEFAULT +#define wxNB_TOP wxBK_TOP +#define wxNB_BOTTOM wxBK_BOTTOM +#define wxNB_LEFT wxBK_LEFT +#define wxNB_RIGHT wxBK_RIGHT + +#define wxNB_FIXEDWIDTH 0x0100 +#define wxNB_MULTILINE 0x0200 +#define wxNB_NOPAGETHEME 0x0400 +#define wxNB_FLAT 0x0800 + + +typedef wxWindow wxNotebookPage; // so far, any window can be a page + +extern WXDLLEXPORT_DATA(const wxChar) wxNotebookNameStr[]; + +#if WXWIN_COMPATIBILITY_2_4 + #define wxNOTEBOOK_NAME wxNotebookNameStr +#endif + +// ---------------------------------------------------------------------------- +// wxNotebookBase: define wxNotebook interface +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNotebookBase : public wxBookCtrlBase +{ +public: + // ctors + // ----- + + wxNotebookBase() { } + + wxNotebookBase(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr) ; + + // wxNotebook-specific additions to wxBookCtrlBase interface + // --------------------------------------------------------- + + // get the number of rows for a control with wxNB_MULTILINE style (not all + // versions support it - they will always return 1 then) + virtual int GetRowCount() const { return 1; } + + // set the padding between tabs (in pixels) + virtual void SetPadding(const wxSize& padding) = 0; + + // set the size of the tabs for wxNB_FIXEDWIDTH controls + virtual void SetTabSize(const wxSize& sz) = 0; + + + + // implement some base class functions + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + // On platforms that support it, get the theme page background colour, else invalid colour + virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; } + + + // send wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING/ED events + + // returns false if the change to nPage is vetoed by the program + bool SendPageChangingEvent(int nPage); + + // sends the event about page change from old to new (or GetSelection() if + // new is -1) + void SendPageChangedEvent(int nPageOld, int nPageNew = -1); + + +protected: + DECLARE_NO_COPY_CLASS(wxNotebookBase) +}; + +// ---------------------------------------------------------------------------- +// notebook event class and related stuff +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlBaseEvent +{ +public: + wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + int nSel = -1, int nOldSel = -1) + : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel) + { + } + + wxNotebookEvent(const wxNotebookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxNotebookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotebookEvent) +}; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); + +#define wxNotebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotebookEventFunction, &func) + +#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxNotebookEventHandler(fn)) + +#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxNotebookEventHandler(fn)) + +// ---------------------------------------------------------------------------- +// wxNotebook class itself +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/notebook.h" +#elif defined(__WXMSW__) + #include "wx/msw/notebook.h" +#elif defined(__WXMOTIF__) + #include "wx/generic/notebook.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/notebook.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/notebook.h" +#elif defined(__WXMAC__) + #include "wx/mac/notebook.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/notebook.h" +#elif defined(__WXPM__) + #include "wx/os2/notebook.h" +#endif + +#endif // wxUSE_NOTEBOOK + +#endif + // _WX_NOTEBOOK_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/numdlg.h b/Externals/wxWidgets/include/wx/numdlg.h index 741bc72fa5..a3a1505fc2 100644 --- a/Externals/wxWidgets/include/wx/numdlg.h +++ b/Externals/wxWidgets/include/wx/numdlg.h @@ -1,23 +1,23 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/numdlg.h -// Purpose: wxNumberEntryDialog class -// Author: John Labenski -// Modified by: -// Created: 07.02.04 (extracted from wx/textdlg.h) -// RCS-ID: $Id: numdlg.h 37157 2006-01-26 15:33:27Z ABX $ -// Copyright: (c) John Labenski -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NUMDLGDLG_H_BASE_ -#define _WX_NUMDLGDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_NUMBERDLG - -#include "wx/generic/numdlgg.h" - -#endif // wxUSE_NUMBERDLG - -#endif // _WX_NUMDLGDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/numdlg.h +// Purpose: wxNumberEntryDialog class +// Author: John Labenski +// Modified by: +// Created: 07.02.04 (extracted from wx/textdlg.h) +// RCS-ID: $Id: numdlg.h 37157 2006-01-26 15:33:27Z ABX $ +// Copyright: (c) John Labenski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NUMDLGDLG_H_BASE_ +#define _WX_NUMDLGDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_NUMBERDLG + +#include "wx/generic/numdlgg.h" + +#endif // wxUSE_NUMBERDLG + +#endif // _WX_NUMDLGDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/object.h b/Externals/wxWidgets/include/wx/object.h index 00d305bda4..d46efcfaaf 100644 --- a/Externals/wxWidgets/include/wx/object.h +++ b/Externals/wxWidgets/include/wx/object.h @@ -1,569 +1,569 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/object.h -// Purpose: wxObject class, plus run-time type information macros -// Author: Julian Smart -// Modified by: Ron Lee -// Created: 01/02/97 -// RCS-ID: $Id: object.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1997 Julian Smart -// (c) 2001 Ron Lee <ron@debian.org> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OBJECTH__ -#define _WX_OBJECTH__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/memory.h" - -class WXDLLIMPEXP_FWD_BASE wxObject; - -#ifndef wxUSE_EXTENDED_RTTI -#define wxUSE_EXTENDED_RTTI 0 -#endif - -#if wxUSE_EXTENDED_RTTI -#include "wx/xti.h" -#else - -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxClassInfo; -class WXDLLIMPEXP_FWD_BASE wxHashTable; -class WXDLLIMPEXP_FWD_BASE wxObjectRefData; - -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -typedef wxObject *(*wxObjectConstructorFn)(void); - -class WXDLLIMPEXP_BASE wxClassInfo -{ -public: - wxClassInfo( const wxChar *className, - const wxClassInfo *baseInfo1, - const wxClassInfo *baseInfo2, - int size, - wxObjectConstructorFn ctor ) - : m_className(className) - , m_objectSize(size) - , m_objectConstructor(ctor) - , m_baseInfo1(baseInfo1) - , m_baseInfo2(baseInfo2) - , m_next(sm_first) - { - sm_first = this; - Register(); - } - - ~wxClassInfo(); - - wxObject *CreateObject() const - { return m_objectConstructor ? (*m_objectConstructor)() : 0; } - bool IsDynamic() const { return (NULL != m_objectConstructor); } - - const wxChar *GetClassName() const { return m_className; } - const wxChar *GetBaseClassName1() const - { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } - const wxChar *GetBaseClassName2() const - { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } - const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } - const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } - int GetSize() const { return m_objectSize; } - - wxObjectConstructorFn GetConstructor() const - { return m_objectConstructor; } - static const wxClassInfo *GetFirst() { return sm_first; } - const wxClassInfo *GetNext() const { return m_next; } - static wxClassInfo *FindClass(const wxChar *className); - - // Climb upwards through inheritance hierarchy. - // Dual inheritance is catered for. - - bool IsKindOf(const wxClassInfo *info) const - { - return info != 0 && - ( info == this || - ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) || - ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) ); - } - -#if WXWIN_COMPATIBILITY_2_4 - // Initializes parent pointers and hash table for fast searching. - wxDEPRECATED( static void InitializeClasses() ); - // Cleans up hash table used for fast searching. - wxDEPRECATED( static void CleanUpClasses() ); -#endif - -public: - const wxChar *m_className; - int m_objectSize; - wxObjectConstructorFn m_objectConstructor; - - // Pointers to base wxClassInfos: set in InitializeClasses - - const wxClassInfo *m_baseInfo1; - const wxClassInfo *m_baseInfo2; - - // class info object live in a linked list: - // pointers to its head and the next element in it - - static wxClassInfo *sm_first; - wxClassInfo *m_next; - - // FIXME: this should be private (currently used directly by way too - // many clients) - static wxHashTable *sm_classTable; - -private: - // InitializeClasses() helper - static wxClassInfo *GetBaseByName(const wxChar *name); - - DECLARE_NO_COPY_CLASS(wxClassInfo) - -protected: - // registers the class - void Register(); - void Unregister(); -}; - -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); - -#if WXWIN_COMPATIBILITY_2_4 -inline void wxClassInfo::InitializeClasses() {} -inline void wxClassInfo::CleanUpClasses() {} -#endif - -// ---------------------------------------------------------------------------- -// Dynamic class macros -// ---------------------------------------------------------------------------- - -#define DECLARE_ABSTRACT_CLASS(name) \ - public: \ - static wxClassInfo ms_classInfo; \ - virtual wxClassInfo *GetClassInfo() const; - -#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - DECLARE_NO_ASSIGN_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - DECLARE_NO_COPY_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS(name) \ - DECLARE_ABSTRACT_CLASS(name) \ - static wxObject* wxCreateObject(); - -#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) - - -// common part of the macros below -#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \ - wxClassInfo name::ms_classInfo(wxT(#name), \ - &basename::ms_classInfo, \ - baseclsinfo2, \ - (int) sizeof(name), \ - (wxObjectConstructorFn) func); \ - \ - wxClassInfo *name::GetClassInfo() const \ - { return &name::ms_classInfo; } - -#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) - -#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) - -// ----------------------------------- -// for concrete classes -// ----------------------------------- - - // Single inheritance with one base class -#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ - wxObject* name::wxCreateObject() \ - { return new name; } - - // Multiple inheritance with two base classes -#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ - name::wxCreateObject) \ - wxObject* name::wxCreateObject() \ - { return new name; } - -// ----------------------------------- -// for abstract classes -// ----------------------------------- - - // Single inheritance with one base class - -#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) - - // Multiple inheritance with two base classes - -#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) - -#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS -#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 - -#endif // !wxUSE_EXTENDED_RTTI - - -// ----------------------------------- -// for pluggable classes -// ----------------------------------- - - // NOTE: this should probably be the very first statement - // in the class declaration so wxPluginSentinel is - // the first member initialised and the last destroyed. - -// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel; - -#if wxUSE_NESTED_CLASSES - -#define _DECLARE_DL_SENTINEL(name, exportdecl) \ -class exportdecl name##PluginSentinel { \ -private: \ - static const wxString sm_className; \ -public: \ - name##PluginSentinel(); \ - ~name##PluginSentinel(); \ -}; \ -name##PluginSentinel m_pluginsentinel; - -#define _IMPLEMENT_DL_SENTINEL(name) \ - const wxString name::name##PluginSentinel::sm_className(#name); \ - name::name##PluginSentinel::name##PluginSentinel() { \ - wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ - if( e != 0 ) { e->RefObj(); } \ - } \ - name::name##PluginSentinel::~name##PluginSentinel() { \ - wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ - if( e != 0 ) { e->UnrefObj(); } \ - } -#else - -#define _DECLARE_DL_SENTINEL(name) -#define _IMPLEMENT_DL_SENTINEL(name) - -#endif // wxUSE_NESTED_CLASSES - -#define DECLARE_PLUGGABLE_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) -#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ - DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) - -#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ - DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) -#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ - DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) - -#define IMPLEMENT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) - -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_PLUGGABLE_CLASS(name, basename) -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) - -#define CLASSINFO(name) (&name::ms_classInfo) - -#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) - -// Just seems a bit nicer-looking (pretend it's not a macro) -#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo) - -// this cast does some more checks at compile time as it uses static_cast -// internally -// -// note that it still has different semantics from dynamic_cast<> and so can't -// be replaced by it as long as there are any compilers not supporting it -#define wxDynamicCast(obj, className) \ - ((className *) wxCheckDynamicCast( \ - wx_const_cast(wxObject *, wx_static_cast(const wxObject *, \ - wx_const_cast(className *, wx_static_cast(const className *, obj)))), \ - &className::ms_classInfo)) - -// The 'this' pointer is always true, so use this version -// to cast the this pointer and avoid compiler warnings. -#define wxDynamicCastThis(className) \ - (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) - -#ifdef __WXDEBUG__ -inline void* wxCheckCast(void *ptr) -{ - wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") ); - return ptr; -} -#define wxStaticCast(obj, className) \ - ((className *)wxCheckCast(wxDynamicCast(obj, className))) - -#else // !__WXDEBUG__ -#define wxStaticCast(obj, className) \ - wx_const_cast(className *, wx_static_cast(const className *, obj)) - -#endif // __WXDEBUG__ - -// ---------------------------------------------------------------------------- -// set up memory debugging macros -// ---------------------------------------------------------------------------- - -/* - Which new/delete operator variants do we want? - - _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) - _WX_WANT_DELETE_VOID = void operator delete (void * buf) - _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line) - _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) - _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) - _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) - _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) -*/ - -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING - -// All compilers get this one -#define _WX_WANT_NEW_SIZET_WXCHAR_INT - -// Everyone except Visage gets the next one -#ifndef __VISAGECPP__ - #define _WX_WANT_DELETE_VOID -#endif - -// Only visage gets this one under the correct circumstances -#if defined(__VISAGECPP__) && __DEBUG_ALLOC__ - #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET -#endif - -// Only VC++ 6 and CodeWarrior get overloaded delete that matches new -#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \ - (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) - #define _WX_WANT_DELETE_VOID_WXCHAR_INT -#endif - -// Now see who (if anyone) gets the array memory operators -#if wxUSE_ARRAY_MEMORY_OPERATORS - - // Everyone except Visual C++ (cause problems for VC++ - crashes) - #if !defined(__VISUALC__) - #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - #endif - - // Everyone except Visual C++ (cause problems for VC++ - crashes) - #if !defined(__VISUALC__) - #define _WX_WANT_ARRAY_DELETE_VOID - #endif - - // Only CodeWarrior 6 or higher - #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400) - #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT - #endif - -#endif // wxUSE_ARRAY_MEMORY_OPERATORS - -#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING - -// ---------------------------------------------------------------------------- -// wxObjectRefData: ref counted data meant to be stored in wxObject -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxObjectRefData -{ - friend class WXDLLIMPEXP_FWD_BASE wxObject; - -public: - wxObjectRefData() : m_count(1) { } - virtual ~wxObjectRefData() { } - - int GetRefCount() const { return m_count; } - -private: - int m_count; -}; - -// ---------------------------------------------------------------------------- -// wxObject: the root class of wxWidgets object hierarchy -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxObject -{ - DECLARE_ABSTRACT_CLASS(wxObject) - -public: - wxObject() { m_refData = NULL; } - virtual ~wxObject() { UnRef(); } - - wxObject(const wxObject& other) - { - m_refData = other.m_refData; - if (m_refData) - m_refData->m_count++; - } - - wxObject& operator=(const wxObject& other) - { - if ( this != &other ) - { - Ref(other); - } - return *this; - } - - bool IsKindOf(wxClassInfo *info) const; - - - // Turn on the correct set of new and delete operators - -#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT - void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); -#endif - -#ifdef _WX_WANT_DELETE_VOID - void operator delete ( void * buf ); -#endif - -#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET - void operator delete ( void *buf, const char *_fname, size_t _line ); -#endif - -#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT - void operator delete ( void *buf, const wxChar*, int ); -#endif - -#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID - void operator delete[] ( void *buf ); -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT - void operator delete[] (void* buf, const wxChar*, int ); -#endif - - // ref counted data handling methods - - // get/set - wxObjectRefData *GetRefData() const { return m_refData; } - void SetRefData(wxObjectRefData *data) { m_refData = data; } - - // make a 'clone' of the object - void Ref(const wxObject& clone); - - // destroy a reference - void UnRef(); - - // Make sure this object has only one reference - void UnShare() { AllocExclusive(); } - - // check if this object references the same data as the other one - bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; } - -protected: - // ensure that our data is not shared with anybody else: if we have no - // data, it is created using CreateRefData() below, if we have shared data - // it is copied using CloneRefData(), otherwise nothing is done - void AllocExclusive(); - - // both methods must be implemented if AllocExclusive() is used, not pure - // virtual only because of the backwards compatibility reasons - - // create a new m_refData - virtual wxObjectRefData *CreateRefData() const; - - // create a new m_refData initialized with the given one - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - - wxObjectRefData *m_refData; -}; - -inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) -{ - return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; -} - -#if wxUSE_EXTENDED_RTTI -class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject -{ - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; -public: - // instantiates this object with an instance of its superclass - wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; - virtual ~wxDynamicObject(); - - void SetProperty (const wxChar *propertyName, const wxxVariant &value); - wxxVariant GetProperty (const wxChar *propertyName) const ; - - // get the runtime identity of this object - wxClassInfo *GetClassInfo() const - { -#ifdef _MSC_VER - return (wxClassInfo*) m_classInfo; -#else - return wx_const_cast(wxClassInfo *, m_classInfo); -#endif - } - - wxObject* GetSuperClassInstance() const - { - return m_superClassInstance ; - } -private : - // removes an existing runtime-property - void RemoveProperty( const wxChar *propertyName ) ; - - // renames an existing runtime-property - void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; - - wxObject *m_superClassInstance ; - const wxDynamicClassInfo *m_classInfo; - struct wxDynamicObjectInternal; - wxDynamicObjectInternal *m_data; -}; -#endif - -// ---------------------------------------------------------------------------- -// more debugging macros -// ---------------------------------------------------------------------------- - -// Redefine new to be the debugging version. This doesn't work with all -// compilers, in which case you need to use WXDEBUG_NEW explicitly if you wish -// to use the debugging version. - -#ifdef __WXDEBUG__ - #define WXDEBUG_NEW new(__TFILE__,__LINE__) - - #if wxUSE_DEBUG_NEW_ALWAYS - #if wxUSE_GLOBAL_MEMORY_OPERATORS - #define new WXDEBUG_NEW - #elif defined(__VISUALC__) - // Including this file redefines new and allows leak reports to - // contain line numbers - #include "wx/msw/msvcrt.h" - #endif - #endif // wxUSE_DEBUG_NEW_ALWAYS -#else // !__WXDEBUG__ - #define WXDEBUG_NEW new -#endif // __WXDEBUG__/!__WXDEBUG__ - -#endif // _WX_OBJECTH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/object.h +// Purpose: wxObject class, plus run-time type information macros +// Author: Julian Smart +// Modified by: Ron Lee +// Created: 01/02/97 +// RCS-ID: $Id: object.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1997 Julian Smart +// (c) 2001 Ron Lee <ron@debian.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OBJECTH__ +#define _WX_OBJECTH__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/memory.h" + +class WXDLLIMPEXP_FWD_BASE wxObject; + +#ifndef wxUSE_EXTENDED_RTTI +#define wxUSE_EXTENDED_RTTI 0 +#endif + +#if wxUSE_EXTENDED_RTTI +#include "wx/xti.h" +#else + +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxClassInfo; +class WXDLLIMPEXP_FWD_BASE wxHashTable; +class WXDLLIMPEXP_FWD_BASE wxObjectRefData; + +// ---------------------------------------------------------------------------- +// wxClassInfo +// ---------------------------------------------------------------------------- + +typedef wxObject *(*wxObjectConstructorFn)(void); + +class WXDLLIMPEXP_BASE wxClassInfo +{ +public: + wxClassInfo( const wxChar *className, + const wxClassInfo *baseInfo1, + const wxClassInfo *baseInfo2, + int size, + wxObjectConstructorFn ctor ) + : m_className(className) + , m_objectSize(size) + , m_objectConstructor(ctor) + , m_baseInfo1(baseInfo1) + , m_baseInfo2(baseInfo2) + , m_next(sm_first) + { + sm_first = this; + Register(); + } + + ~wxClassInfo(); + + wxObject *CreateObject() const + { return m_objectConstructor ? (*m_objectConstructor)() : 0; } + bool IsDynamic() const { return (NULL != m_objectConstructor); } + + const wxChar *GetClassName() const { return m_className; } + const wxChar *GetBaseClassName1() const + { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } + const wxChar *GetBaseClassName2() const + { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } + const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } + const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } + int GetSize() const { return m_objectSize; } + + wxObjectConstructorFn GetConstructor() const + { return m_objectConstructor; } + static const wxClassInfo *GetFirst() { return sm_first; } + const wxClassInfo *GetNext() const { return m_next; } + static wxClassInfo *FindClass(const wxChar *className); + + // Climb upwards through inheritance hierarchy. + // Dual inheritance is catered for. + + bool IsKindOf(const wxClassInfo *info) const + { + return info != 0 && + ( info == this || + ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) || + ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) ); + } + +#if WXWIN_COMPATIBILITY_2_4 + // Initializes parent pointers and hash table for fast searching. + wxDEPRECATED( static void InitializeClasses() ); + // Cleans up hash table used for fast searching. + wxDEPRECATED( static void CleanUpClasses() ); +#endif + +public: + const wxChar *m_className; + int m_objectSize; + wxObjectConstructorFn m_objectConstructor; + + // Pointers to base wxClassInfos: set in InitializeClasses + + const wxClassInfo *m_baseInfo1; + const wxClassInfo *m_baseInfo2; + + // class info object live in a linked list: + // pointers to its head and the next element in it + + static wxClassInfo *sm_first; + wxClassInfo *m_next; + + // FIXME: this should be private (currently used directly by way too + // many clients) + static wxHashTable *sm_classTable; + +private: + // InitializeClasses() helper + static wxClassInfo *GetBaseByName(const wxChar *name); + + DECLARE_NO_COPY_CLASS(wxClassInfo) + +protected: + // registers the class + void Register(); + void Unregister(); +}; + +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); + +#if WXWIN_COMPATIBILITY_2_4 +inline void wxClassInfo::InitializeClasses() {} +inline void wxClassInfo::CleanUpClasses() {} +#endif + +// ---------------------------------------------------------------------------- +// Dynamic class macros +// ---------------------------------------------------------------------------- + +#define DECLARE_ABSTRACT_CLASS(name) \ + public: \ + static wxClassInfo ms_classInfo; \ + virtual wxClassInfo *GetClassInfo() const; + +#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + DECLARE_NO_ASSIGN_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + DECLARE_NO_COPY_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_DYNAMIC_CLASS(name) \ + DECLARE_ABSTRACT_CLASS(name) \ + static wxObject* wxCreateObject(); + +#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) + + +// common part of the macros below +#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \ + wxClassInfo name::ms_classInfo(wxT(#name), \ + &basename::ms_classInfo, \ + baseclsinfo2, \ + (int) sizeof(name), \ + (wxObjectConstructorFn) func); \ + \ + wxClassInfo *name::GetClassInfo() const \ + { return &name::ms_classInfo; } + +#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ + wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) + +#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ + wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) + +// ----------------------------------- +// for concrete classes +// ----------------------------------- + + // Single inheritance with one base class +#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \ + wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ + wxObject* name::wxCreateObject() \ + { return new name; } + + // Multiple inheritance with two base classes +#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ + name::wxCreateObject) \ + wxObject* name::wxCreateObject() \ + { return new name; } + +// ----------------------------------- +// for abstract classes +// ----------------------------------- + + // Single inheritance with one base class + +#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \ + wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) + + // Multiple inheritance with two base classes + +#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) + +#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS +#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 + +#endif // !wxUSE_EXTENDED_RTTI + + +// ----------------------------------- +// for pluggable classes +// ----------------------------------- + + // NOTE: this should probably be the very first statement + // in the class declaration so wxPluginSentinel is + // the first member initialised and the last destroyed. + +// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel; + +#if wxUSE_NESTED_CLASSES + +#define _DECLARE_DL_SENTINEL(name, exportdecl) \ +class exportdecl name##PluginSentinel { \ +private: \ + static const wxString sm_className; \ +public: \ + name##PluginSentinel(); \ + ~name##PluginSentinel(); \ +}; \ +name##PluginSentinel m_pluginsentinel; + +#define _IMPLEMENT_DL_SENTINEL(name) \ + const wxString name::name##PluginSentinel::sm_className(#name); \ + name::name##PluginSentinel::name##PluginSentinel() { \ + wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ + if( e != 0 ) { e->RefObj(); } \ + } \ + name::name##PluginSentinel::~name##PluginSentinel() { \ + wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ + if( e != 0 ) { e->UnrefObj(); } \ + } +#else + +#define _DECLARE_DL_SENTINEL(name) +#define _IMPLEMENT_DL_SENTINEL(name) + +#endif // wxUSE_NESTED_CLASSES + +#define DECLARE_PLUGGABLE_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) +#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ + DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLEXPORT) + +#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ + DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) +#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ + DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) + +#define IMPLEMENT_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) + +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_PLUGGABLE_CLASS(name, basename) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) + +#define CLASSINFO(name) (&name::ms_classInfo) + +#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) + +// Just seems a bit nicer-looking (pretend it's not a macro) +#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo) + +// this cast does some more checks at compile time as it uses static_cast +// internally +// +// note that it still has different semantics from dynamic_cast<> and so can't +// be replaced by it as long as there are any compilers not supporting it +#define wxDynamicCast(obj, className) \ + ((className *) wxCheckDynamicCast( \ + wx_const_cast(wxObject *, wx_static_cast(const wxObject *, \ + wx_const_cast(className *, wx_static_cast(const className *, obj)))), \ + &className::ms_classInfo)) + +// The 'this' pointer is always true, so use this version +// to cast the this pointer and avoid compiler warnings. +#define wxDynamicCastThis(className) \ + (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) + +#ifdef __WXDEBUG__ +inline void* wxCheckCast(void *ptr) +{ + wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") ); + return ptr; +} +#define wxStaticCast(obj, className) \ + ((className *)wxCheckCast(wxDynamicCast(obj, className))) + +#else // !__WXDEBUG__ +#define wxStaticCast(obj, className) \ + wx_const_cast(className *, wx_static_cast(const className *, obj)) + +#endif // __WXDEBUG__ + +// ---------------------------------------------------------------------------- +// set up memory debugging macros +// ---------------------------------------------------------------------------- + +/* + Which new/delete operator variants do we want? + + _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) + _WX_WANT_DELETE_VOID = void operator delete (void * buf) + _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line) + _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) + _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) + _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) + _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) +*/ + +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING + +// All compilers get this one +#define _WX_WANT_NEW_SIZET_WXCHAR_INT + +// Everyone except Visage gets the next one +#ifndef __VISAGECPP__ + #define _WX_WANT_DELETE_VOID +#endif + +// Only visage gets this one under the correct circumstances +#if defined(__VISAGECPP__) && __DEBUG_ALLOC__ + #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET +#endif + +// Only VC++ 6 and CodeWarrior get overloaded delete that matches new +#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \ + (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) + #define _WX_WANT_DELETE_VOID_WXCHAR_INT +#endif + +// Now see who (if anyone) gets the array memory operators +#if wxUSE_ARRAY_MEMORY_OPERATORS + + // Everyone except Visual C++ (cause problems for VC++ - crashes) + #if !defined(__VISUALC__) + #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT + #endif + + // Everyone except Visual C++ (cause problems for VC++ - crashes) + #if !defined(__VISUALC__) + #define _WX_WANT_ARRAY_DELETE_VOID + #endif + + // Only CodeWarrior 6 or higher + #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400) + #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT + #endif + +#endif // wxUSE_ARRAY_MEMORY_OPERATORS + +#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING + +// ---------------------------------------------------------------------------- +// wxObjectRefData: ref counted data meant to be stored in wxObject +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxObjectRefData +{ + friend class WXDLLIMPEXP_FWD_BASE wxObject; + +public: + wxObjectRefData() : m_count(1) { } + virtual ~wxObjectRefData() { } + + int GetRefCount() const { return m_count; } + +private: + int m_count; +}; + +// ---------------------------------------------------------------------------- +// wxObject: the root class of wxWidgets object hierarchy +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxObject +{ + DECLARE_ABSTRACT_CLASS(wxObject) + +public: + wxObject() { m_refData = NULL; } + virtual ~wxObject() { UnRef(); } + + wxObject(const wxObject& other) + { + m_refData = other.m_refData; + if (m_refData) + m_refData->m_count++; + } + + wxObject& operator=(const wxObject& other) + { + if ( this != &other ) + { + Ref(other); + } + return *this; + } + + bool IsKindOf(wxClassInfo *info) const; + + + // Turn on the correct set of new and delete operators + +#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT + void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); +#endif + +#ifdef _WX_WANT_DELETE_VOID + void operator delete ( void * buf ); +#endif + +#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET + void operator delete ( void *buf, const char *_fname, size_t _line ); +#endif + +#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT + void operator delete ( void *buf, const wxChar*, int ); +#endif + +#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT + void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); +#endif + +#ifdef _WX_WANT_ARRAY_DELETE_VOID + void operator delete[] ( void *buf ); +#endif + +#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT + void operator delete[] (void* buf, const wxChar*, int ); +#endif + + // ref counted data handling methods + + // get/set + wxObjectRefData *GetRefData() const { return m_refData; } + void SetRefData(wxObjectRefData *data) { m_refData = data; } + + // make a 'clone' of the object + void Ref(const wxObject& clone); + + // destroy a reference + void UnRef(); + + // Make sure this object has only one reference + void UnShare() { AllocExclusive(); } + + // check if this object references the same data as the other one + bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; } + +protected: + // ensure that our data is not shared with anybody else: if we have no + // data, it is created using CreateRefData() below, if we have shared data + // it is copied using CloneRefData(), otherwise nothing is done + void AllocExclusive(); + + // both methods must be implemented if AllocExclusive() is used, not pure + // virtual only because of the backwards compatibility reasons + + // create a new m_refData + virtual wxObjectRefData *CreateRefData() const; + + // create a new m_refData initialized with the given one + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + wxObjectRefData *m_refData; +}; + +inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) +{ + return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; +} + +#if wxUSE_EXTENDED_RTTI +class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; +public: + // instantiates this object with an instance of its superclass + wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; + virtual ~wxDynamicObject(); + + void SetProperty (const wxChar *propertyName, const wxxVariant &value); + wxxVariant GetProperty (const wxChar *propertyName) const ; + + // get the runtime identity of this object + wxClassInfo *GetClassInfo() const + { +#ifdef _MSC_VER + return (wxClassInfo*) m_classInfo; +#else + return wx_const_cast(wxClassInfo *, m_classInfo); +#endif + } + + wxObject* GetSuperClassInstance() const + { + return m_superClassInstance ; + } +private : + // removes an existing runtime-property + void RemoveProperty( const wxChar *propertyName ) ; + + // renames an existing runtime-property + void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; + + wxObject *m_superClassInstance ; + const wxDynamicClassInfo *m_classInfo; + struct wxDynamicObjectInternal; + wxDynamicObjectInternal *m_data; +}; +#endif + +// ---------------------------------------------------------------------------- +// more debugging macros +// ---------------------------------------------------------------------------- + +// Redefine new to be the debugging version. This doesn't work with all +// compilers, in which case you need to use WXDEBUG_NEW explicitly if you wish +// to use the debugging version. + +#ifdef __WXDEBUG__ + #define WXDEBUG_NEW new(__TFILE__,__LINE__) + + #if wxUSE_DEBUG_NEW_ALWAYS + #if wxUSE_GLOBAL_MEMORY_OPERATORS + #define new WXDEBUG_NEW + #elif defined(__VISUALC__) + // Including this file redefines new and allows leak reports to + // contain line numbers + #include "wx/msw/msvcrt.h" + #endif + #endif // wxUSE_DEBUG_NEW_ALWAYS +#else // !__WXDEBUG__ + #define WXDEBUG_NEW new +#endif // __WXDEBUG__/!__WXDEBUG__ + +#endif // _WX_OBJECTH__ diff --git a/Externals/wxWidgets/include/wx/odcombo.h b/Externals/wxWidgets/include/wx/odcombo.h index 14e137939c..a0f67a88e4 100644 --- a/Externals/wxWidgets/include/wx/odcombo.h +++ b/Externals/wxWidgets/include/wx/odcombo.h @@ -1,386 +1,386 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/odcombo.h -// Purpose: wxOwnerDrawnComboBox and wxVListBoxPopup -// Author: Jaakko Salli -// Modified by: -// Created: Apr-30-2006 -// RCS-ID: $Id: odcombo.h 41305 2006-09-19 17:16:50Z RR $ -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ODCOMBO_H_ -#define _WX_ODCOMBO_H_ - -#include "wx/defs.h" - -#if wxUSE_ODCOMBOBOX - -#include "wx/combo.h" -#include "wx/ctrlsub.h" -#include "wx/vlbox.h" -#include "wx/timer.h" - - -// -// New window styles for wxOwnerDrawnComboBox -// -enum -{ - // Double-clicking cycles item if wxCB_READONLY is also used. - wxODCB_DCLICK_CYCLES = wxCC_SPECIAL_DCLICK, - - // If used, control itself is not custom paint using callback. - // Even if this is not used, writable combo is never custom paint - // until SetCustomPaintWidth is called - wxODCB_STD_CONTROL_PAINT = 0x1000 -}; - - -// -// Callback flags (see wxOwnerDrawnComboBox::OnDrawItem) -// -enum -{ - // when set, we are painting the selected item in control, - // not in the popup - wxODCB_PAINTING_CONTROL = 0x0001, - - - // when set, we are painting an item which should have - // focus rectangle painted in the background. Text colour - // and clipping region are then appropriately set in - // the default OnDrawBackground implementation. - wxODCB_PAINTING_SELECTED = 0x0002 -}; - - -// ---------------------------------------------------------------------------- -// wxVListBoxComboPopup is a wxVListBox customized to act as a popup control. -// -// Notes: -// wxOwnerDrawnComboBox uses this as its popup. However, it always derives -// from native wxComboCtrl. If you need to use this popup with -// wxGenericComboControl, then remember that vast majority of item manipulation -// functionality is implemented in the wxVListBoxComboPopup class itself. -// -// ---------------------------------------------------------------------------- - - -class WXDLLIMPEXP_ADV wxVListBoxComboPopup : public wxVListBox, - public wxComboPopup -{ - friend class wxOwnerDrawnComboBox; -public: - - // init and dtor - wxVListBoxComboPopup() : wxVListBox(), wxComboPopup() { } - virtual ~wxVListBoxComboPopup(); - - // required virtuals - virtual void Init(); - virtual bool Create(wxWindow* parent); - virtual wxWindow *GetControl() { return this; } - virtual void SetStringValue( const wxString& value ); - virtual wxString GetStringValue() const; - - // more customization - virtual void OnPopup(); - virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); - virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); - virtual void OnComboKeyEvent( wxKeyEvent& event ); - virtual void OnComboDoubleClick(); - virtual bool LazyCreate(); - - // Item management - void SetSelection( int item ); - void Insert( const wxString& item, int pos ); - int Append(const wxString& item); - void Clear(); - void Delete( unsigned int item ); - void SetItemClientData(unsigned int n, void* clientData, wxClientDataType clientDataItemsType); - void *GetItemClientData(unsigned int n) const; - void SetString( int item, const wxString& str ); - wxString GetString( int item ) const; - unsigned int GetCount() const; - int FindString(const wxString& s, bool bCase = false) const; - int GetSelection() const; - - //void Populate( int n, const wxString choices[] ); - void Populate( const wxArrayString& choices ); - void ClearClientDatas(); - - // helpers - int GetItemAtPosition( const wxPoint& pos ) { return HitTest(pos); } - wxCoord GetTotalHeight() const { return EstimateTotalHeight(); } - wxCoord GetLineHeight(int line) const { return OnGetLineHeight(line); } - -protected: - - // Called by OnComboDoubleClick and OnComboKeyEvent - bool HandleKey( int keycode, bool saturate, wxChar unicode = 0 ); - - // sends combobox select event from the parent combo control - void SendComboBoxEvent( int selection ); - - // gets value, sends event and dismisses - void DismissWithEvent(); - - // OnMeasureItemWidth will be called on next GetAdjustedSize. - void ItemWidthChanged(unsigned int item) - { - m_widths[item] = -1; - m_widthsDirty = true; - } - - // Callbacks for drawing and measuring items. Override in a derived class for - // owner-drawnness. Font, background and text colour have been prepared according - // to selection, focus and such. - // - // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself - // and there is no valid selection - // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list - // NOTE: If wxVListBoxComboPopup is used with wxComboCtrl class not derived from - // wxOwnerDrawnComboBox, this method must be overridden. - virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const; - - // This is same as in wxVListBox - virtual wxCoord OnMeasureItem( size_t item ) const; - - // Return item width, or -1 for calculating from text extent (default) - virtual wxCoord OnMeasureItemWidth( size_t item ) const; - - // Draw item and combo control background. Flags are same as with OnDrawItem. - // NB: Can't use name OnDrawBackground because of virtual function hiding warnings. - virtual void OnDrawBg(wxDC& dc, const wxRect& rect, int item, int flags) const; - - // Additional wxVListBox implementation (no need to override in derived classes) - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; - void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; - - // filter mouse move events happening outside the list box - // move selection with cursor - void OnMouseMove(wxMouseEvent& event); - void OnMouseWheel(wxMouseEvent& event); - void OnKey(wxKeyEvent& event); - void OnLeftClick(wxMouseEvent& event); - - // Return the widest item width (recalculating it if necessary) - int GetWidestItemWidth() { CalcWidths(); return m_widestWidth; } - - // Return the index of the widest item (recalculating it if necessary) - int GetWidestItem() { CalcWidths(); return m_widestItem; } - - // Stop partial completion (when some other event occurs) - void StopPartialCompletion(); - - wxArrayString m_strings; - wxArrayPtrVoid m_clientDatas; - - wxFont m_useFont; - - //wxString m_stringValue; // displayed text (may be different than m_strings[m_value]) - int m_value; // selection - int m_itemHover; // on which item the cursor is - int m_itemHeight; // default item height (calculate from font size - // and used in the absence of callback) - wxClientDataType m_clientDataItemsType; - -private: - - // Cached item widths (in pixels). - wxArrayInt m_widths; - - // Width of currently widest item. - int m_widestWidth; - - // Index of currently widest item. - int m_widestItem; - - // Measure some items in next GetAdjustedSize? - bool m_widthsDirty; - - // Find widest item in next GetAdjustedSize? - bool m_findWidest; - - // has the mouse been released on this control? - bool m_clicked; - - // Recalculate widths if they are dirty - void CalcWidths(); - - // Partial completion string - wxString m_partialCompletionString; - -#if wxUSE_TIMER - // Partial completion timer - wxTimer m_partialCompletionTimer; -#endif // wxUSE_TIMER - - DECLARE_EVENT_TABLE() -}; - - -// ---------------------------------------------------------------------------- -// wxOwnerDrawnComboBox: a generic wxComboBox that allows custom paint items -// in addition to many other types of customization already allowed by -// the wxComboCtrl. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox : public wxComboCtrl, - public wxItemContainer -{ - //friend class wxComboPopupWindow; - friend class wxVListBoxComboPopup; -public: - - // ctors and such - wxOwnerDrawnComboBox() : wxComboCtrl() { Init(); } - - wxOwnerDrawnComboBox(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - int n, - const wxString choices[], - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - : wxComboCtrl() - { - Init(); - - (void)Create(parent, id, value, pos, size, n, - choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - wxOwnerDrawnComboBox(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - int n, - const wxString choices[], - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - virtual ~wxOwnerDrawnComboBox(); - - // Prevent app from using wxComboPopup - void SetPopupControl(wxVListBoxComboPopup* popup) - { - DoSetPopupControl(popup); - } - - // wxControlWithItems methods - virtual void Clear(); - virtual void Delete(unsigned int n); - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual void Select(int n); - virtual int GetSelection() const; - virtual void SetSelection(int n) { Select(n); } - - - // Prevent a method from being hidden - virtual void SetSelection(long from, long to) - { - wxComboCtrl::SetSelection(from,to); - } - - // Return the widest item width (recalculating it if necessary) - virtual int GetWidestItemWidth() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItemWidth(); } - - // Return the index of the widest item (recalculating it if necessary) - virtual int GetWidestItem() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItem(); } - - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - -protected: - - // Callback for drawing. Font, background and text colour have been - // prepared according to selection, focus and such. - // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself - // and there is no valid selection - // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list - virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const; - - // Callback for item height, or -1 for default - virtual wxCoord OnMeasureItem( size_t item ) const; - - // Callback for item width, or -1 for default/undetermined - virtual wxCoord OnMeasureItemWidth( size_t item ) const; - - // Callback for background drawing. Flags are same as with - // OnDrawItem. - virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const; - - // NULL popup can be used to indicate default interface - virtual void DoSetPopupControl(wxComboPopup* popup); - - // clears all allocated client datas - void ClearClientDatas(); - - wxVListBoxComboPopup* GetVListBoxComboPopup() const - { - return (wxVListBoxComboPopup*) m_popupInterface; - } - - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - - // temporary storage for the initial choices - //const wxString* m_baseChoices; - //int m_baseChoicesCount; - wxArrayString m_initChs; - -private: - void Init(); - - DECLARE_EVENT_TABLE() - - DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox) -}; - - -#endif // wxUSE_ODCOMBOBOX - -#endif - // _WX_ODCOMBO_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/odcombo.h +// Purpose: wxOwnerDrawnComboBox and wxVListBoxPopup +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id: odcombo.h 41305 2006-09-19 17:16:50Z RR $ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ODCOMBO_H_ +#define _WX_ODCOMBO_H_ + +#include "wx/defs.h" + +#if wxUSE_ODCOMBOBOX + +#include "wx/combo.h" +#include "wx/ctrlsub.h" +#include "wx/vlbox.h" +#include "wx/timer.h" + + +// +// New window styles for wxOwnerDrawnComboBox +// +enum +{ + // Double-clicking cycles item if wxCB_READONLY is also used. + wxODCB_DCLICK_CYCLES = wxCC_SPECIAL_DCLICK, + + // If used, control itself is not custom paint using callback. + // Even if this is not used, writable combo is never custom paint + // until SetCustomPaintWidth is called + wxODCB_STD_CONTROL_PAINT = 0x1000 +}; + + +// +// Callback flags (see wxOwnerDrawnComboBox::OnDrawItem) +// +enum +{ + // when set, we are painting the selected item in control, + // not in the popup + wxODCB_PAINTING_CONTROL = 0x0001, + + + // when set, we are painting an item which should have + // focus rectangle painted in the background. Text colour + // and clipping region are then appropriately set in + // the default OnDrawBackground implementation. + wxODCB_PAINTING_SELECTED = 0x0002 +}; + + +// ---------------------------------------------------------------------------- +// wxVListBoxComboPopup is a wxVListBox customized to act as a popup control. +// +// Notes: +// wxOwnerDrawnComboBox uses this as its popup. However, it always derives +// from native wxComboCtrl. If you need to use this popup with +// wxGenericComboControl, then remember that vast majority of item manipulation +// functionality is implemented in the wxVListBoxComboPopup class itself. +// +// ---------------------------------------------------------------------------- + + +class WXDLLIMPEXP_ADV wxVListBoxComboPopup : public wxVListBox, + public wxComboPopup +{ + friend class wxOwnerDrawnComboBox; +public: + + // init and dtor + wxVListBoxComboPopup() : wxVListBox(), wxComboPopup() { } + virtual ~wxVListBoxComboPopup(); + + // required virtuals + virtual void Init(); + virtual bool Create(wxWindow* parent); + virtual wxWindow *GetControl() { return this; } + virtual void SetStringValue( const wxString& value ); + virtual wxString GetStringValue() const; + + // more customization + virtual void OnPopup(); + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); + virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); + virtual void OnComboKeyEvent( wxKeyEvent& event ); + virtual void OnComboDoubleClick(); + virtual bool LazyCreate(); + + // Item management + void SetSelection( int item ); + void Insert( const wxString& item, int pos ); + int Append(const wxString& item); + void Clear(); + void Delete( unsigned int item ); + void SetItemClientData(unsigned int n, void* clientData, wxClientDataType clientDataItemsType); + void *GetItemClientData(unsigned int n) const; + void SetString( int item, const wxString& str ); + wxString GetString( int item ) const; + unsigned int GetCount() const; + int FindString(const wxString& s, bool bCase = false) const; + int GetSelection() const; + + //void Populate( int n, const wxString choices[] ); + void Populate( const wxArrayString& choices ); + void ClearClientDatas(); + + // helpers + int GetItemAtPosition( const wxPoint& pos ) { return HitTest(pos); } + wxCoord GetTotalHeight() const { return EstimateTotalHeight(); } + wxCoord GetLineHeight(int line) const { return OnGetLineHeight(line); } + +protected: + + // Called by OnComboDoubleClick and OnComboKeyEvent + bool HandleKey( int keycode, bool saturate, wxChar unicode = 0 ); + + // sends combobox select event from the parent combo control + void SendComboBoxEvent( int selection ); + + // gets value, sends event and dismisses + void DismissWithEvent(); + + // OnMeasureItemWidth will be called on next GetAdjustedSize. + void ItemWidthChanged(unsigned int item) + { + m_widths[item] = -1; + m_widthsDirty = true; + } + + // Callbacks for drawing and measuring items. Override in a derived class for + // owner-drawnness. Font, background and text colour have been prepared according + // to selection, focus and such. + // + // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself + // and there is no valid selection + // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list + // NOTE: If wxVListBoxComboPopup is used with wxComboCtrl class not derived from + // wxOwnerDrawnComboBox, this method must be overridden. + virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const; + + // This is same as in wxVListBox + virtual wxCoord OnMeasureItem( size_t item ) const; + + // Return item width, or -1 for calculating from text extent (default) + virtual wxCoord OnMeasureItemWidth( size_t item ) const; + + // Draw item and combo control background. Flags are same as with OnDrawItem. + // NB: Can't use name OnDrawBackground because of virtual function hiding warnings. + virtual void OnDrawBg(wxDC& dc, const wxRect& rect, int item, int flags) const; + + // Additional wxVListBox implementation (no need to override in derived classes) + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; + void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; + + // filter mouse move events happening outside the list box + // move selection with cursor + void OnMouseMove(wxMouseEvent& event); + void OnMouseWheel(wxMouseEvent& event); + void OnKey(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); + + // Return the widest item width (recalculating it if necessary) + int GetWidestItemWidth() { CalcWidths(); return m_widestWidth; } + + // Return the index of the widest item (recalculating it if necessary) + int GetWidestItem() { CalcWidths(); return m_widestItem; } + + // Stop partial completion (when some other event occurs) + void StopPartialCompletion(); + + wxArrayString m_strings; + wxArrayPtrVoid m_clientDatas; + + wxFont m_useFont; + + //wxString m_stringValue; // displayed text (may be different than m_strings[m_value]) + int m_value; // selection + int m_itemHover; // on which item the cursor is + int m_itemHeight; // default item height (calculate from font size + // and used in the absence of callback) + wxClientDataType m_clientDataItemsType; + +private: + + // Cached item widths (in pixels). + wxArrayInt m_widths; + + // Width of currently widest item. + int m_widestWidth; + + // Index of currently widest item. + int m_widestItem; + + // Measure some items in next GetAdjustedSize? + bool m_widthsDirty; + + // Find widest item in next GetAdjustedSize? + bool m_findWidest; + + // has the mouse been released on this control? + bool m_clicked; + + // Recalculate widths if they are dirty + void CalcWidths(); + + // Partial completion string + wxString m_partialCompletionString; + +#if wxUSE_TIMER + // Partial completion timer + wxTimer m_partialCompletionTimer; +#endif // wxUSE_TIMER + + DECLARE_EVENT_TABLE() +}; + + +// ---------------------------------------------------------------------------- +// wxOwnerDrawnComboBox: a generic wxComboBox that allows custom paint items +// in addition to many other types of customization already allowed by +// the wxComboCtrl. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox : public wxComboCtrl, + public wxItemContainer +{ + //friend class wxComboPopupWindow; + friend class wxVListBoxComboPopup; +public: + + // ctors and such + wxOwnerDrawnComboBox() : wxComboCtrl() { Init(); } + + wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboCtrl() + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxOwnerDrawnComboBox(); + + // Prevent app from using wxComboPopup + void SetPopupControl(wxVListBoxComboPopup* popup) + { + DoSetPopupControl(popup); + } + + // wxControlWithItems methods + virtual void Clear(); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual void Select(int n); + virtual int GetSelection() const; + virtual void SetSelection(int n) { Select(n); } + + + // Prevent a method from being hidden + virtual void SetSelection(long from, long to) + { + wxComboCtrl::SetSelection(from,to); + } + + // Return the widest item width (recalculating it if necessary) + virtual int GetWidestItemWidth() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItemWidth(); } + + // Return the index of the widest item (recalculating it if necessary) + virtual int GetWidestItem() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItem(); } + + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + +protected: + + // Callback for drawing. Font, background and text colour have been + // prepared according to selection, focus and such. + // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself + // and there is no valid selection + // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list + virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const; + + // Callback for item height, or -1 for default + virtual wxCoord OnMeasureItem( size_t item ) const; + + // Callback for item width, or -1 for default/undetermined + virtual wxCoord OnMeasureItemWidth( size_t item ) const; + + // Callback for background drawing. Flags are same as with + // OnDrawItem. + virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const; + + // NULL popup can be used to indicate default interface + virtual void DoSetPopupControl(wxComboPopup* popup); + + // clears all allocated client datas + void ClearClientDatas(); + + wxVListBoxComboPopup* GetVListBoxComboPopup() const + { + return (wxVListBoxComboPopup*) m_popupInterface; + } + + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + + // temporary storage for the initial choices + //const wxString* m_baseChoices; + //int m_baseChoicesCount; + wxArrayString m_initChs; + +private: + void Init(); + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox) +}; + + +#endif // wxUSE_ODCOMBOBOX + +#endif + // _WX_ODCOMBO_H_ diff --git a/Externals/wxWidgets/include/wx/overlay.h b/Externals/wxWidgets/include/wx/overlay.h index d0d2a11aa1..b8ae18c19b 100644 --- a/Externals/wxWidgets/include/wx/overlay.h +++ b/Externals/wxWidgets/include/wx/overlay.h @@ -1,97 +1,97 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/overlay.h -// Purpose: wxOverlay class -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OVERLAY_H_ -#define _WX_OVERLAY_H_ - -#include "wx/defs.h" - -#if defined(wxMAC_USE_CORE_GRAPHICS) && wxMAC_USE_CORE_GRAPHICS - #define wxHAS_NATIVE_OVERLAY 1 -#elif defined(__WXDFB__) - #define wxHAS_NATIVE_OVERLAY 1 -#else - // don't define wxHAS_NATIVE_OVERLAY -#endif - -// ---------------------------------------------------------------------------- -// creates an overlay over an existing window, allowing for manipulations like -// rubberbanding etc. This API is not stable yet, not to be used outside wx -// internal code -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; -class WXDLLIMPEXP_FWD_CORE wxWindowDC; - -class WXDLLEXPORT wxOverlay -{ -public: - wxOverlay(); - ~wxOverlay(); - - // clears the overlay without restoring the former state - // to be done eg when the window content has been changed and repainted - void Reset(); - - // returns (port-specific) implementation of the overlay - wxOverlayImpl *GetImpl() { return m_impl; } - -private: - friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay; - - // returns true if it has been setup - bool IsOk(); - - void Init(wxWindowDC* dc, int x , int y , int width , int height); - - void BeginDrawing(wxWindowDC* dc); - - void EndDrawing(wxWindowDC* dc); - - void Clear(wxWindowDC* dc); - - wxOverlayImpl* m_impl; - - bool m_inDrawing; - - - DECLARE_NO_COPY_CLASS(wxOverlay) -}; - - -class WXDLLEXPORT wxDCOverlay -{ -public: - // connects this overlay to the corresponding drawing dc, if the overlay is - // not initialized yet this call will do so - wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc, int x , int y , int width , int height); - - // convenience wrapper that behaves the same using the entire area of the dc - wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc); - - // removes the connection between the overlay and the dc - virtual ~wxDCOverlay(); - - // clears the layer, restoring the state at the last init - void Clear(); - -private: - void Init(wxWindowDC *dc, int x , int y , int width , int height); - - wxOverlay& m_overlay; - - wxWindowDC* m_dc; - - - DECLARE_NO_COPY_CLASS(wxDCOverlay) -}; - -#endif // _WX_OVERLAY_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/overlay.h +// Purpose: wxOverlay class +// Author: Stefan Csomor +// Modified by: +// Created: 2006-10-20 +// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OVERLAY_H_ +#define _WX_OVERLAY_H_ + +#include "wx/defs.h" + +#if defined(wxMAC_USE_CORE_GRAPHICS) && wxMAC_USE_CORE_GRAPHICS + #define wxHAS_NATIVE_OVERLAY 1 +#elif defined(__WXDFB__) + #define wxHAS_NATIVE_OVERLAY 1 +#else + // don't define wxHAS_NATIVE_OVERLAY +#endif + +// ---------------------------------------------------------------------------- +// creates an overlay over an existing window, allowing for manipulations like +// rubberbanding etc. This API is not stable yet, not to be used outside wx +// internal code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; +class WXDLLIMPEXP_FWD_CORE wxWindowDC; + +class WXDLLEXPORT wxOverlay +{ +public: + wxOverlay(); + ~wxOverlay(); + + // clears the overlay without restoring the former state + // to be done eg when the window content has been changed and repainted + void Reset(); + + // returns (port-specific) implementation of the overlay + wxOverlayImpl *GetImpl() { return m_impl; } + +private: + friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay; + + // returns true if it has been setup + bool IsOk(); + + void Init(wxWindowDC* dc, int x , int y , int width , int height); + + void BeginDrawing(wxWindowDC* dc); + + void EndDrawing(wxWindowDC* dc); + + void Clear(wxWindowDC* dc); + + wxOverlayImpl* m_impl; + + bool m_inDrawing; + + + DECLARE_NO_COPY_CLASS(wxOverlay) +}; + + +class WXDLLEXPORT wxDCOverlay +{ +public: + // connects this overlay to the corresponding drawing dc, if the overlay is + // not initialized yet this call will do so + wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc, int x , int y , int width , int height); + + // convenience wrapper that behaves the same using the entire area of the dc + wxDCOverlay(wxOverlay &overlay, wxWindowDC *dc); + + // removes the connection between the overlay and the dc + virtual ~wxDCOverlay(); + + // clears the layer, restoring the state at the last init + void Clear(); + +private: + void Init(wxWindowDC *dc, int x , int y , int width , int height); + + wxOverlay& m_overlay; + + wxWindowDC* m_dc; + + + DECLARE_NO_COPY_CLASS(wxDCOverlay) +}; + +#endif // _WX_OVERLAY_H_ diff --git a/Externals/wxWidgets/include/wx/ownerdrw.h b/Externals/wxWidgets/include/wx/ownerdrw.h index 81f6e544f8..4d64222293 100644 --- a/Externals/wxWidgets/include/wx/ownerdrw.h +++ b/Externals/wxWidgets/include/wx/ownerdrw.h @@ -1,174 +1,174 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: ownerdrw.h -// Purpose: interface for owner-drawn GUI elements -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.11.97 -// RCS-ID: $Id: ownerdrw.h 35695 2005-09-25 20:43:35Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _OWNERDRW_H -#define _OWNERDRW_H - -#include "wx/defs.h" - -#if wxUSE_OWNER_DRAWN - -#include "wx/bitmap.h" -#include "wx/colour.h" -#include "wx/font.h" - -// ---------------------------------------------------------------------------- -// wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn -// behaviour -// -// wxOwnerDrawn supports drawing of an item with non standard font, color and -// also supports 3 bitmaps: either a checked/unchecked bitmap for a checkable -// element or one unchangeable bitmap otherwise. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxOwnerDrawn -{ -public: - // ctor & dtor - wxOwnerDrawn(const wxString& str = wxEmptyString, - bool bCheckable = false, - bool bMenuItem = false); // FIXME kludge for colors - virtual ~wxOwnerDrawn(); - - // fix appearance - void SetFont(const wxFont& font) - { m_font = font; m_bOwnerDrawn = true; } - - wxFont& GetFont() const { return (wxFont &)m_font; } - - void SetTextColour(const wxColour& colText) - { m_colText = colText; m_bOwnerDrawn = true; } - - wxColour& GetTextColour() const { return (wxColour&) m_colText; } - - void SetBackgroundColour(const wxColour& colBack) - { m_colBack = colBack; m_bOwnerDrawn = true; } - - wxColour& GetBackgroundColour() const - { return (wxColour&) m_colBack ; } - - void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap) - { m_bmpChecked = bmpChecked; - m_bmpUnchecked = bmpUnchecked; - m_bOwnerDrawn = true; } - - void SetBitmap(const wxBitmap& bmpChecked) - { m_bmpChecked = bmpChecked; - m_bOwnerDrawn = true; } - - void SetDisabledBitmap( const wxBitmap& bmpDisabled ) - { m_bmpDisabled = bmpDisabled; - m_bOwnerDrawn = true; } - - const wxBitmap& GetBitmap(bool bChecked = true) const - { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } - - const wxBitmap& GetDisabledBitmap() const - { return m_bmpDisabled; } - - // the height of the menu checkmark (or bitmap) is determined by the font - // for the current item, but the width should be always the same (for the - // items to be aligned), so by default it's taken to be the same as for - // the last item (and default width for the first one). - // - // NB: default is too small for bitmaps, but ok for checkmarks. - void SetMarginWidth(int nWidth) - { - ms_nLastMarginWidth = m_nMarginWidth = (size_t) nWidth; - if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) - m_bOwnerDrawn = true; - } - - int GetMarginWidth() const { return (int) m_nMarginWidth; } - static int GetDefaultMarginWidth() { return (int) ms_nDefaultMarginWidth; } - - // accessors - void SetName(const wxString& strName) { m_strName = strName; } - const wxString& GetName() const { return m_strName; } - void SetCheckable(bool checkable) { m_bCheckable = checkable; } - bool IsCheckable() const { return m_bCheckable; } - - // this is for menu items only: accel string is drawn right aligned after the - // menu item if not empty - void SetAccelString(const wxString& strAccel) { m_strAccel = strAccel; } - - // this function might seem strange, but if it returns false it means that - // no non-standard attribute are set, so there is no need for this control - // to be owner-drawn. Moreover, you can force owner-drawn to false if you - // want to change, say, the color for the item but only if it is owner-drawn - // (see wxMenuItem::wxMenuItem for example) - bool IsOwnerDrawn() const { return m_bOwnerDrawn; } - - // switch on/off owner-drawing the item - void SetOwnerDrawn(bool ownerDrawn = true) { m_bOwnerDrawn = ownerDrawn; } - void ResetOwnerDrawn() { m_bOwnerDrawn = false; } - -public: - // constants used in OnDrawItem - // (they have the same values as corresponding Win32 constants) - enum wxODAction - { - wxODDrawAll = 0x0001, // redraw entire control - wxODSelectChanged = 0x0002, // selection changed (see Status.Select) - wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) - }; - - enum wxODStatus - { - wxODSelected = 0x0001, // control is currently selected - wxODGrayed = 0x0002, // item is to be grayed - wxODDisabled = 0x0004, // item is to be drawn as disabled - wxODChecked = 0x0008, // item is to be checked - wxODHasFocus = 0x0010, // item has the keyboard focus - wxODDefault = 0x0020, // item is the default item - wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only) - }; - - // virtual functions to implement drawing (return true if processed) - virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight); - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); - -protected: - // return true if this is a menu item - bool IsMenuItem() const; - - // get the font to use, whether m_font is set or not - wxFont GetFontToUse() const; - - - wxString m_strName, // label for a manu item - m_strAccel; // the accel string ("Ctrl-F17") if any - -private: - static size_t ms_nDefaultMarginWidth; // menu check mark width - static size_t ms_nLastMarginWidth; // handy for aligning all items - - bool m_bCheckable, // used only for menu or check listbox items - m_bOwnerDrawn, // true if something is non standard - m_isMenuItem; // true if this is a menu item - - wxFont m_font; // font to use for drawing - wxColour m_colText, // color ----"---"---"---- - m_colBack; // background color - wxBitmap m_bmpChecked, // bitmap to put near the item - m_bmpUnchecked, // (checked is used also for 'uncheckable' items) - m_bmpDisabled; - - size_t m_nHeight, // font height - m_nMinHeight, // minimum height, as determined by user's system settings - m_nMarginWidth; // space occupied by bitmap to the left of the item -}; - -#endif // wxUSE_OWNER_DRAWN - -#endif - // _OWNERDRW_H +/////////////////////////////////////////////////////////////////////////////// +// Name: ownerdrw.h +// Purpose: interface for owner-drawn GUI elements +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.11.97 +// RCS-ID: $Id: ownerdrw.h 35695 2005-09-25 20:43:35Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _OWNERDRW_H +#define _OWNERDRW_H + +#include "wx/defs.h" + +#if wxUSE_OWNER_DRAWN + +#include "wx/bitmap.h" +#include "wx/colour.h" +#include "wx/font.h" + +// ---------------------------------------------------------------------------- +// wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn +// behaviour +// +// wxOwnerDrawn supports drawing of an item with non standard font, color and +// also supports 3 bitmaps: either a checked/unchecked bitmap for a checkable +// element or one unchangeable bitmap otherwise. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxOwnerDrawn +{ +public: + // ctor & dtor + wxOwnerDrawn(const wxString& str = wxEmptyString, + bool bCheckable = false, + bool bMenuItem = false); // FIXME kludge for colors + virtual ~wxOwnerDrawn(); + + // fix appearance + void SetFont(const wxFont& font) + { m_font = font; m_bOwnerDrawn = true; } + + wxFont& GetFont() const { return (wxFont &)m_font; } + + void SetTextColour(const wxColour& colText) + { m_colText = colText; m_bOwnerDrawn = true; } + + wxColour& GetTextColour() const { return (wxColour&) m_colText; } + + void SetBackgroundColour(const wxColour& colBack) + { m_colBack = colBack; m_bOwnerDrawn = true; } + + wxColour& GetBackgroundColour() const + { return (wxColour&) m_colBack ; } + + void SetBitmaps(const wxBitmap& bmpChecked, + const wxBitmap& bmpUnchecked = wxNullBitmap) + { m_bmpChecked = bmpChecked; + m_bmpUnchecked = bmpUnchecked; + m_bOwnerDrawn = true; } + + void SetBitmap(const wxBitmap& bmpChecked) + { m_bmpChecked = bmpChecked; + m_bOwnerDrawn = true; } + + void SetDisabledBitmap( const wxBitmap& bmpDisabled ) + { m_bmpDisabled = bmpDisabled; + m_bOwnerDrawn = true; } + + const wxBitmap& GetBitmap(bool bChecked = true) const + { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } + + const wxBitmap& GetDisabledBitmap() const + { return m_bmpDisabled; } + + // the height of the menu checkmark (or bitmap) is determined by the font + // for the current item, but the width should be always the same (for the + // items to be aligned), so by default it's taken to be the same as for + // the last item (and default width for the first one). + // + // NB: default is too small for bitmaps, but ok for checkmarks. + void SetMarginWidth(int nWidth) + { + ms_nLastMarginWidth = m_nMarginWidth = (size_t) nWidth; + if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) + m_bOwnerDrawn = true; + } + + int GetMarginWidth() const { return (int) m_nMarginWidth; } + static int GetDefaultMarginWidth() { return (int) ms_nDefaultMarginWidth; } + + // accessors + void SetName(const wxString& strName) { m_strName = strName; } + const wxString& GetName() const { return m_strName; } + void SetCheckable(bool checkable) { m_bCheckable = checkable; } + bool IsCheckable() const { return m_bCheckable; } + + // this is for menu items only: accel string is drawn right aligned after the + // menu item if not empty + void SetAccelString(const wxString& strAccel) { m_strAccel = strAccel; } + + // this function might seem strange, but if it returns false it means that + // no non-standard attribute are set, so there is no need for this control + // to be owner-drawn. Moreover, you can force owner-drawn to false if you + // want to change, say, the color for the item but only if it is owner-drawn + // (see wxMenuItem::wxMenuItem for example) + bool IsOwnerDrawn() const { return m_bOwnerDrawn; } + + // switch on/off owner-drawing the item + void SetOwnerDrawn(bool ownerDrawn = true) { m_bOwnerDrawn = ownerDrawn; } + void ResetOwnerDrawn() { m_bOwnerDrawn = false; } + +public: + // constants used in OnDrawItem + // (they have the same values as corresponding Win32 constants) + enum wxODAction + { + wxODDrawAll = 0x0001, // redraw entire control + wxODSelectChanged = 0x0002, // selection changed (see Status.Select) + wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) + }; + + enum wxODStatus + { + wxODSelected = 0x0001, // control is currently selected + wxODGrayed = 0x0002, // item is to be grayed + wxODDisabled = 0x0004, // item is to be drawn as disabled + wxODChecked = 0x0008, // item is to be checked + wxODHasFocus = 0x0010, // item has the keyboard focus + wxODDefault = 0x0020, // item is the default item + wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only) + }; + + // virtual functions to implement drawing (return true if processed) + virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight); + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); + +protected: + // return true if this is a menu item + bool IsMenuItem() const; + + // get the font to use, whether m_font is set or not + wxFont GetFontToUse() const; + + + wxString m_strName, // label for a manu item + m_strAccel; // the accel string ("Ctrl-F17") if any + +private: + static size_t ms_nDefaultMarginWidth; // menu check mark width + static size_t ms_nLastMarginWidth; // handy for aligning all items + + bool m_bCheckable, // used only for menu or check listbox items + m_bOwnerDrawn, // true if something is non standard + m_isMenuItem; // true if this is a menu item + + wxFont m_font; // font to use for drawing + wxColour m_colText, // color ----"---"---"---- + m_colBack; // background color + wxBitmap m_bmpChecked, // bitmap to put near the item + m_bmpUnchecked, // (checked is used also for 'uncheckable' items) + m_bmpDisabled; + + size_t m_nHeight, // font height + m_nMinHeight, // minimum height, as determined by user's system settings + m_nMarginWidth; // space occupied by bitmap to the left of the item +}; + +#endif // wxUSE_OWNER_DRAWN + +#endif + // _OWNERDRW_H diff --git a/Externals/wxWidgets/include/wx/palette.h b/Externals/wxWidgets/include/wx/palette.h index f81135365c..9a09456ff1 100644 --- a/Externals/wxWidgets/include/wx/palette.h +++ b/Externals/wxWidgets/include/wx/palette.h @@ -1,59 +1,59 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/palette.h -// Purpose: Common header and base class for wxPalette -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: palette.h 41751 2006-10-08 21:56:55Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PALETTE_H_BASE_ -#define _WX_PALETTE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PALETTE - -#include "wx/object.h" -#include "wx/gdiobj.h" - -// wxPaletteBase -class WXDLLEXPORT wxPaletteBase: public wxGDIObject -{ -public: - virtual ~wxPaletteBase() { } - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - virtual int GetColoursCount() const { wxFAIL_MSG( _T("not implemented") ); return 0; } -}; - -#if defined(__WXPALMOS__) - #include "wx/palmos/palette.h" -#elif defined(__WXMSW__) - #include "wx/msw/palette.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/palette.h" -#elif defined(__WXGTK__) || defined(__WXCOCOA__) - #include "wx/generic/paletteg.h" -#elif defined(__WXX11__) - #include "wx/x11/palette.h" -#elif defined(__WXMGL__) - #include "wx/mgl/palette.h" -#elif defined(__WXMAC__) - #include "wx/mac/palette.h" -#elif defined(__WXPM__) - #include "wx/os2/palette.h" -#endif - -#if WXWIN_COMPATIBILITY_2_4 - #define wxColorMap wxPalette - #define wxColourMap wxPalette -#endif - -#endif // wxUSE_PALETTE - -#endif - // _WX_PALETTE_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palette.h +// Purpose: Common header and base class for wxPalette +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: palette.h 41751 2006-10-08 21:56:55Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_BASE_ +#define _WX_PALETTE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PALETTE + +#include "wx/object.h" +#include "wx/gdiobj.h" + +// wxPaletteBase +class WXDLLEXPORT wxPaletteBase: public wxGDIObject +{ +public: + virtual ~wxPaletteBase() { } + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; + virtual int GetColoursCount() const { wxFAIL_MSG( _T("not implemented") ); return 0; } +}; + +#if defined(__WXPALMOS__) + #include "wx/palmos/palette.h" +#elif defined(__WXMSW__) + #include "wx/msw/palette.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/palette.h" +#elif defined(__WXGTK__) || defined(__WXCOCOA__) + #include "wx/generic/paletteg.h" +#elif defined(__WXX11__) + #include "wx/x11/palette.h" +#elif defined(__WXMGL__) + #include "wx/mgl/palette.h" +#elif defined(__WXMAC__) + #include "wx/mac/palette.h" +#elif defined(__WXPM__) + #include "wx/os2/palette.h" +#endif + +#if WXWIN_COMPATIBILITY_2_4 + #define wxColorMap wxPalette + #define wxColourMap wxPalette +#endif + +#endif // wxUSE_PALETTE + +#endif + // _WX_PALETTE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/panel.h b/Externals/wxWidgets/include/wx/panel.h index 260e2b972b..366177d7cb 100644 --- a/Externals/wxWidgets/include/wx/panel.h +++ b/Externals/wxWidgets/include/wx/panel.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/panel.h -// Purpose: Base header for wxPanel -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: panel.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PANEL_H_BASE_ -#define _WX_PANEL_H_BASE_ - -#include "wx/generic/panelg.h" - -#endif - // _WX_PANELH_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/panel.h +// Purpose: Base header for wxPanel +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: panel.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PANEL_H_BASE_ +#define _WX_PANEL_H_BASE_ + +#include "wx/generic/panelg.h" + +#endif + // _WX_PANELH_BASE_ diff --git a/Externals/wxWidgets/include/wx/paper.h b/Externals/wxWidgets/include/wx/paper.h index fe69bd471c..eb0893dfcb 100644 --- a/Externals/wxWidgets/include/wx/paper.h +++ b/Externals/wxWidgets/include/wx/paper.h @@ -1,122 +1,122 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: paper.h -// Purpose: Paper database types and classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: paper.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PAPERH__ -#define _WX_PAPERH__ - -#include "wx/defs.h" -#include "wx/event.h" -#include "wx/cmndata.h" -#include "wx/intl.h" -#include "wx/hashmap.h" - -/* - * Paper type: see defs.h for wxPaperSize enum. - * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE, - * so you can add further paper types without needing new ids. - */ - -#ifdef __WXMSW__ -#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h) -#else -#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h) -#endif - -class WXDLLEXPORT wxPrintPaperType: public wxObject -{ -public: - wxPrintPaperType(); - - // platformId is a platform-specific id, such as in Windows, DMPAPER_... - wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); - - inline wxString GetName() const { return wxGetTranslation(m_paperName); } - inline wxPaperSize GetId() const { return m_paperId; } - inline int GetPlatformId() const { return m_platformId; } - - // Get width and height in tenths of a millimetre - inline int GetWidth() const { return m_width; } - inline int GetHeight() const { return m_height; } - - // Get size in tenths of a millimetre - inline wxSize GetSize() const { return wxSize(m_width, m_height); } - - // Get size in a millimetres - inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); } - - // Get width and height in device units (1/72th of an inch) - wxSize GetSizeDeviceUnits() const ; - -public: - wxPaperSize m_paperId; - int m_platformId; - int m_width; // In tenths of a millimetre - int m_height; // In tenths of a millimetre - wxString m_paperName; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintPaperType) -}; - -WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap); - -class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList; - -class WXDLLEXPORT wxPrintPaperDatabase -{ -public: - wxPrintPaperDatabase(); - ~wxPrintPaperDatabase(); - - void CreateDatabase(); - void ClearDatabase(); - - void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h); - void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); - - // Find by name - wxPrintPaperType *FindPaperType(const wxString& name); - - // Find by size id - wxPrintPaperType *FindPaperType(wxPaperSize id); - - // Find by platform id - wxPrintPaperType *FindPaperTypeByPlatformId(int id); - - // Find by size - wxPrintPaperType *FindPaperType(const wxSize& size); - - // Convert name to size id - wxPaperSize ConvertNameToId(const wxString& name); - - // Convert size id to name - wxString ConvertIdToName(wxPaperSize paperId); - - // Get the paper size - wxSize GetSize(wxPaperSize paperId); - - // Get the paper size - wxPaperSize GetSize(const wxSize& size); - - // - wxPrintPaperType* Item(size_t index) const; - size_t GetCount() const; -private: - wxStringToPrintPaperTypeHashMap* m_map; - wxPrintPaperTypeList* m_list; - // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase) -}; - -extern WXDLLEXPORT_DATA(wxPrintPaperDatabase*) wxThePrintPaperDatabase; - - -#endif - // _WX_PAPERH__ +///////////////////////////////////////////////////////////////////////////// +// Name: paper.h +// Purpose: Paper database types and classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: paper.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PAPERH__ +#define _WX_PAPERH__ + +#include "wx/defs.h" +#include "wx/event.h" +#include "wx/cmndata.h" +#include "wx/intl.h" +#include "wx/hashmap.h" + +/* + * Paper type: see defs.h for wxPaperSize enum. + * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE, + * so you can add further paper types without needing new ids. + */ + +#ifdef __WXMSW__ +#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h) +#else +#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h) +#endif + +class WXDLLEXPORT wxPrintPaperType: public wxObject +{ +public: + wxPrintPaperType(); + + // platformId is a platform-specific id, such as in Windows, DMPAPER_... + wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); + + inline wxString GetName() const { return wxGetTranslation(m_paperName); } + inline wxPaperSize GetId() const { return m_paperId; } + inline int GetPlatformId() const { return m_platformId; } + + // Get width and height in tenths of a millimetre + inline int GetWidth() const { return m_width; } + inline int GetHeight() const { return m_height; } + + // Get size in tenths of a millimetre + inline wxSize GetSize() const { return wxSize(m_width, m_height); } + + // Get size in a millimetres + inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); } + + // Get width and height in device units (1/72th of an inch) + wxSize GetSizeDeviceUnits() const ; + +public: + wxPaperSize m_paperId; + int m_platformId; + int m_width; // In tenths of a millimetre + int m_height; // In tenths of a millimetre + wxString m_paperName; + +private: + DECLARE_DYNAMIC_CLASS(wxPrintPaperType) +}; + +WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap); + +class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList; + +class WXDLLEXPORT wxPrintPaperDatabase +{ +public: + wxPrintPaperDatabase(); + ~wxPrintPaperDatabase(); + + void CreateDatabase(); + void ClearDatabase(); + + void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h); + void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); + + // Find by name + wxPrintPaperType *FindPaperType(const wxString& name); + + // Find by size id + wxPrintPaperType *FindPaperType(wxPaperSize id); + + // Find by platform id + wxPrintPaperType *FindPaperTypeByPlatformId(int id); + + // Find by size + wxPrintPaperType *FindPaperType(const wxSize& size); + + // Convert name to size id + wxPaperSize ConvertNameToId(const wxString& name); + + // Convert size id to name + wxString ConvertIdToName(wxPaperSize paperId); + + // Get the paper size + wxSize GetSize(wxPaperSize paperId); + + // Get the paper size + wxPaperSize GetSize(const wxSize& size); + + // + wxPrintPaperType* Item(size_t index) const; + size_t GetCount() const; +private: + wxStringToPrintPaperTypeHashMap* m_map; + wxPrintPaperTypeList* m_list; + // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase) +}; + +extern WXDLLEXPORT_DATA(wxPrintPaperDatabase*) wxThePrintPaperDatabase; + + +#endif + // _WX_PAPERH__ diff --git a/Externals/wxWidgets/include/wx/pen.h b/Externals/wxWidgets/include/wx/pen.h index cd28212f56..080d6c5c55 100644 --- a/Externals/wxWidgets/include/wx/pen.h +++ b/Externals/wxWidgets/include/wx/pen.h @@ -1,40 +1,40 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/pen.h -// Purpose: Base header for wxPen -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: pen.h 40865 2006-08-27 09:42:42Z VS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PEN_H_BASE_ -#define _WX_PEN_H_BASE_ - -#include "wx/defs.h" - -#if defined(__WXPALMOS__) -#include "wx/palmos/pen.h" -#elif defined(__WXMSW__) -#include "wx/msw/pen.h" -#elif defined(__WXMOTIF__) || defined(__WXX11__) -#include "wx/x11/pen.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/pen.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/pen.h" -#elif defined(__WXMGL__) -#include "wx/mgl/pen.h" -#elif defined(__WXDFB__) -#include "wx/dfb/pen.h" -#elif defined(__WXMAC__) -#include "wx/mac/pen.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/pen.h" -#elif defined(__WXPM__) -#include "wx/os2/pen.h" -#endif - -#endif - // _WX_PEN_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/pen.h +// Purpose: Base header for wxPen +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: pen.h 40865 2006-08-27 09:42:42Z VS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_BASE_ +#define _WX_PEN_H_BASE_ + +#include "wx/defs.h" + +#if defined(__WXPALMOS__) +#include "wx/palmos/pen.h" +#elif defined(__WXMSW__) +#include "wx/msw/pen.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) +#include "wx/x11/pen.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/pen.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/pen.h" +#elif defined(__WXMGL__) +#include "wx/mgl/pen.h" +#elif defined(__WXDFB__) +#include "wx/dfb/pen.h" +#elif defined(__WXMAC__) +#include "wx/mac/pen.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/pen.h" +#elif defined(__WXPM__) +#include "wx/os2/pen.h" +#endif + +#endif + // _WX_PEN_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/pickerbase.h b/Externals/wxWidgets/include/wx/pickerbase.h index da79f2deaf..d0f0614c6f 100644 --- a/Externals/wxWidgets/include/wx/pickerbase.h +++ b/Externals/wxWidgets/include/wx/pickerbase.h @@ -1,189 +1,189 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/pickerbase.h -// Purpose: wxPickerBase definition -// Author: Francesco Montorsi (based on Vadim Zeitlin's code) -// Modified by: -// Created: 14/4/2006 -// Copyright: (c) Vadim Zeitlin, Francesco Montorsi -// RCS-ID: $Id: pickerbase.h 49804 2007-11-10 01:09:42Z VZ $ -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PICKERBASE_H_BASE_ -#define _WX_PICKERBASE_H_BASE_ - -#include "wx/control.h" -#include "wx/sizer.h" -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxToolTip; - -extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; - -// ---------------------------------------------------------------------------- -// wxPickerBase is the base class for the picker controls which support -// a wxPB_USE_TEXTCTRL style; i.e. for those pickers which can use an auxiliary -// text control next to the 'real' picker. -// -// The wxTextPickerHelper class manages enabled/disabled state of the text control, -// its sizing and positioning. -// ---------------------------------------------------------------------------- - -#define wxPB_USE_TEXTCTRL 0x0002 - -class WXDLLIMPEXP_CORE wxPickerBase : public wxControl -{ -public: - // ctor: text is the associated text control - wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) - { m_container.SetContainerWindow(this); } - virtual ~wxPickerBase() {} - - - // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control - // The 3rd argument is the initial wxString to display in the text control - bool CreateBase(wxWindow *parent, - wxWindowID id, - const wxString& text = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - -public: // public API - - // margin between the text control and the picker - void SetInternalMargin(int newmargin) - { GetTextCtrlItem()->SetBorder(newmargin); m_sizer->Layout(); } - int GetInternalMargin() const - { return GetTextCtrlItem()->GetBorder(); } - - // proportion of the text control - void SetTextCtrlProportion(int prop) - { GetTextCtrlItem()->SetProportion(prop); m_sizer->Layout(); } - int GetTextCtrlProportion() const - { return GetTextCtrlItem()->GetProportion(); } - - // proportion of the picker control - void SetPickerCtrlProportion(int prop) - { GetPickerCtrlItem()->SetProportion(prop); m_sizer->Layout(); } - int GetPickerCtrlProportion() const - { return GetPickerCtrlItem()->GetProportion(); } - - bool IsTextCtrlGrowable() const - { return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; } - void SetTextCtrlGrowable(bool grow = true) - { - int f = GetDefaultTextCtrlFlag(); - if ( grow ) - f |= wxGROW; - else - f &= ~wxGROW; - - GetTextCtrlItem()->SetFlag(f); - } - - bool IsPickerCtrlGrowable() const - { return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; } - void SetPickerCtrlGrowable(bool grow = true) - { - int f = GetDefaultPickerCtrlFlag(); - if ( grow ) - f |= wxGROW; - else - f &= ~wxGROW; - - GetPickerCtrlItem()->SetFlag(f); - } - - bool HasTextCtrl() const - { return m_text != NULL; } - wxTextCtrl *GetTextCtrl() - { return m_text; } - wxControl *GetPickerCtrl() - { return m_picker; } - - // methods that derived class must/may override - virtual void UpdatePickerFromTextCtrl() = 0; - virtual void UpdateTextCtrlFromPicker() = 0; - -protected: - // overridden base class methods -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); -#endif // wxUSE_TOOLTIPS - - - // event handlers - void OnTextCtrlDelete(wxWindowDestroyEvent &); - void OnTextCtrlUpdate(wxCommandEvent &); - void OnTextCtrlKillFocus(wxFocusEvent &); - - void OnSize(wxSizeEvent &); - - // returns the set of styles for the attached wxTextCtrl - // from given wxPickerBase's styles - virtual long GetTextCtrlStyle(long style) const - { return (style & wxWINDOW_STYLE_MASK); } - - // returns the set of styles for the m_picker - virtual long GetPickerStyle(long style) const - { return (style & wxWINDOW_STYLE_MASK); } - - - wxSizerItem *GetPickerCtrlItem() const - { - if (this->HasTextCtrl()) - return m_sizer->GetItem((size_t)1); - return m_sizer->GetItem((size_t)0); - } - - wxSizerItem *GetTextCtrlItem() const - { - wxASSERT(this->HasTextCtrl()); - return m_sizer->GetItem((size_t)0); - } - - int GetDefaultPickerCtrlFlag() const - { - // on macintosh, without additional borders - // there's not enough space for focus rect - return wxALIGN_CENTER_VERTICAL|wxGROW -#ifdef __WXMAC__ - | wxTOP | wxRIGHT | wxBOTTOM -#endif - ; - } - - int GetDefaultTextCtrlFlag() const - { - // on macintosh, without wxALL there's not enough space for focus rect - return wxALIGN_CENTER_VERTICAL -#ifdef __WXMAC__ - | wxALL -#else - | wxRIGHT -#endif - ; - } - - void PostCreation(); - -protected: - wxTextCtrl *m_text; // can be NULL - wxControl *m_picker; - wxBoxSizer *m_sizer; - -private: - DECLARE_ABSTRACT_CLASS(wxPickerBase) - DECLARE_EVENT_TABLE() - - // This class must be something just like a panel... - WX_DECLARE_CONTROL_CONTAINER(); -}; - - -#endif - // _WX_PICKERBASE_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/pickerbase.h +// Purpose: wxPickerBase definition +// Author: Francesco Montorsi (based on Vadim Zeitlin's code) +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Vadim Zeitlin, Francesco Montorsi +// RCS-ID: $Id: pickerbase.h 49804 2007-11-10 01:09:42Z VZ $ +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PICKERBASE_H_BASE_ +#define _WX_PICKERBASE_H_BASE_ + +#include "wx/control.h" +#include "wx/sizer.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxToolTip; + +extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[]; + +// ---------------------------------------------------------------------------- +// wxPickerBase is the base class for the picker controls which support +// a wxPB_USE_TEXTCTRL style; i.e. for those pickers which can use an auxiliary +// text control next to the 'real' picker. +// +// The wxTextPickerHelper class manages enabled/disabled state of the text control, +// its sizing and positioning. +// ---------------------------------------------------------------------------- + +#define wxPB_USE_TEXTCTRL 0x0002 + +class WXDLLIMPEXP_CORE wxPickerBase : public wxControl +{ +public: + // ctor: text is the associated text control + wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) + { m_container.SetContainerWindow(this); } + virtual ~wxPickerBase() {} + + + // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control + // The 3rd argument is the initial wxString to display in the text control + bool CreateBase(wxWindow *parent, + wxWindowID id, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + +public: // public API + + // margin between the text control and the picker + void SetInternalMargin(int newmargin) + { GetTextCtrlItem()->SetBorder(newmargin); m_sizer->Layout(); } + int GetInternalMargin() const + { return GetTextCtrlItem()->GetBorder(); } + + // proportion of the text control + void SetTextCtrlProportion(int prop) + { GetTextCtrlItem()->SetProportion(prop); m_sizer->Layout(); } + int GetTextCtrlProportion() const + { return GetTextCtrlItem()->GetProportion(); } + + // proportion of the picker control + void SetPickerCtrlProportion(int prop) + { GetPickerCtrlItem()->SetProportion(prop); m_sizer->Layout(); } + int GetPickerCtrlProportion() const + { return GetPickerCtrlItem()->GetProportion(); } + + bool IsTextCtrlGrowable() const + { return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; } + void SetTextCtrlGrowable(bool grow = true) + { + int f = GetDefaultTextCtrlFlag(); + if ( grow ) + f |= wxGROW; + else + f &= ~wxGROW; + + GetTextCtrlItem()->SetFlag(f); + } + + bool IsPickerCtrlGrowable() const + { return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; } + void SetPickerCtrlGrowable(bool grow = true) + { + int f = GetDefaultPickerCtrlFlag(); + if ( grow ) + f |= wxGROW; + else + f &= ~wxGROW; + + GetPickerCtrlItem()->SetFlag(f); + } + + bool HasTextCtrl() const + { return m_text != NULL; } + wxTextCtrl *GetTextCtrl() + { return m_text; } + wxControl *GetPickerCtrl() + { return m_picker; } + + // methods that derived class must/may override + virtual void UpdatePickerFromTextCtrl() = 0; + virtual void UpdateTextCtrlFromPicker() = 0; + +protected: + // overridden base class methods +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip); +#endif // wxUSE_TOOLTIPS + + + // event handlers + void OnTextCtrlDelete(wxWindowDestroyEvent &); + void OnTextCtrlUpdate(wxCommandEvent &); + void OnTextCtrlKillFocus(wxFocusEvent &); + + void OnSize(wxSizeEvent &); + + // returns the set of styles for the attached wxTextCtrl + // from given wxPickerBase's styles + virtual long GetTextCtrlStyle(long style) const + { return (style & wxWINDOW_STYLE_MASK); } + + // returns the set of styles for the m_picker + virtual long GetPickerStyle(long style) const + { return (style & wxWINDOW_STYLE_MASK); } + + + wxSizerItem *GetPickerCtrlItem() const + { + if (this->HasTextCtrl()) + return m_sizer->GetItem((size_t)1); + return m_sizer->GetItem((size_t)0); + } + + wxSizerItem *GetTextCtrlItem() const + { + wxASSERT(this->HasTextCtrl()); + return m_sizer->GetItem((size_t)0); + } + + int GetDefaultPickerCtrlFlag() const + { + // on macintosh, without additional borders + // there's not enough space for focus rect + return wxALIGN_CENTER_VERTICAL|wxGROW +#ifdef __WXMAC__ + | wxTOP | wxRIGHT | wxBOTTOM +#endif + ; + } + + int GetDefaultTextCtrlFlag() const + { + // on macintosh, without wxALL there's not enough space for focus rect + return wxALIGN_CENTER_VERTICAL +#ifdef __WXMAC__ + | wxALL +#else + | wxRIGHT +#endif + ; + } + + void PostCreation(); + +protected: + wxTextCtrl *m_text; // can be NULL + wxControl *m_picker; + wxBoxSizer *m_sizer; + +private: + DECLARE_ABSTRACT_CLASS(wxPickerBase) + DECLARE_EVENT_TABLE() + + // This class must be something just like a panel... + WX_DECLARE_CONTROL_CONTAINER(); +}; + + +#endif + // _WX_PICKERBASE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/platform.h b/Externals/wxWidgets/include/wx/platform.h index b75cf47258..4ac085d413 100644 --- a/Externals/wxWidgets/include/wx/platform.h +++ b/Externals/wxWidgets/include/wx/platform.h @@ -1,662 +1,662 @@ -/** -* Name: wx/platform.h -* Purpose: define the OS and compiler identification macros -* Author: Vadim Zeitlin -* Modified by: -* Created: 29.10.01 (extracted from wx/defs.h) -* RCS-ID: $Id: platform.h 53877 2008-05-31 12:43:44Z SN $ -* Copyright: (c) 1997-2001 Vadim Zeitlin -* Licence: wxWindows licence -*/ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_PLATFORM_H_ -#define _WX_PLATFORM_H_ - - -/* - Codewarrior doesn't define any Windows symbols until some headers - are included -*/ -#ifdef __MWERKS__ -# include <stddef.h> -#endif - -/* - WXMAC variants - __WXMAC_CLASSIC__ means ppc non-carbon builds, __WXMAC_CARBON__ means - carbon API available (mach or cfm builds) , __WXMAC_OSX__ means mach-o - builds, running under 10.2 + only -*/ -#ifdef __WXMAC__ -# if defined(__MACH__) -# define __WXMAC_OSX__ -# define __WXMAC_CARBON__ -# include <AvailabilityMacros.h> -# ifndef MAC_OS_X_VERSION_10_4 -# define MAC_OS_X_VERSION_10_4 1040 -# endif -# ifndef MAC_OS_X_VERSION_10_5 -# define MAC_OS_X_VERSION_10_5 1050 -# endif -# ifdef __WXMAC_XCODE__ -# include <unistd.h> -# include "wx/mac/carbon/config_xcode.h" -# endif -# else -# if TARGET_CARBON -# define __WXMAC_CARBON__ -# else -# define __WXMAC_CLASSIC__ -# endif -# endif -#endif - -/* - __WXOSX__ is a common define to wxMac (Carbon) and wxCocoa ports under OS X. - */ -#if defined(__WXMAC_OSX__) || defined(__WXCOCOA__) -# define __WXOSX__ -#endif - -/* - first define Windows symbols if they're not defined on the command line: we - can autodetect everything we need if _WIN32 is defined - */ -#if defined(__CYGWIN__) && defined(__WINDOWS__) -# ifndef __WXMSW__ -# define __WXMSW__ -# endif - -# ifndef _WIN32 -# define _WIN32 -# endif - -# ifndef WIN32 -# define WIN32 -# endif -#endif - -#if defined(__PALMOS__) -# if __PALMOS__ == 0x06000000 -# define __WXPALMOS6__ -# endif -# if __PALMOS__ == 0x05000000 -# define __WXPALMOS5__ -# endif -# ifndef __WXPALMOS__ -# define __WXPALMOS__ -# endif -# ifdef __WXMSW__ -# undef __WXMSW__ -# endif -# ifdef __WINDOWS__ -# undef __WINDOWS__ -# endif -# ifdef __WIN32__ -# undef __WIN32__ -# endif -# ifdef WIN32 -# undef WIN32 -# endif -# ifdef _WIN32 -# undef _WIN32 -# endif -#endif - -#if defined(_WIN64) -# ifndef _WIN32 - /* - a lot of code (mistakenly) uses #ifdef _WIN32 to either test for - Windows or to test for !__WIN16__, so we must define _WIN32 for - Win64 as well to ensure that the existing code continues to work. - */ -# define _WIN32 -# endif /* !_WIN32 */ - -# ifndef __WIN64__ -# define __WIN64__ -# endif /* !__WIN64__ */ -#endif /* _WIN64 */ - -#if (defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)) \ - && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) -# ifndef __WXMSW__ -# define __WXMSW__ -# endif - -# ifndef __WIN32__ -# define __WIN32__ -# endif -#endif /* Win32 */ - -#if defined(__WXMSW__) || defined(__WIN32__) -# if !defined(__WINDOWS__) -# define __WINDOWS__ -# endif -#endif - -/* detect MS SmartPhone */ -#if defined( WIN32_PLATFORM_WFSP ) -# ifndef __SMARTPHONE__ -# define __SMARTPHONE__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -/* detect PocketPC */ -#if defined( WIN32_PLATFORM_PSPC ) -# ifndef __POCKETPC__ -# define __POCKETPC__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -/* detect Standard WinCE SDK */ -#if defined( WCE_PLATFORM_STANDARDSDK ) -# ifndef __WINCE_STANDARDSDK__ -# define __WINCE_STANDARDSDK__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -#if defined(_WIN32_WCE) && !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) -# if (_WIN32_WCE >= 400) -# ifndef __WINCE_NET__ -# define __WINCE_NET__ -# endif -# elif (_WIN32_WCE >= 200) -# ifndef __HANDHELDPC__ -# define __HANDHELDPC__ -# endif -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__) -# define __WXHANDHELD__ -#endif - -/* - Include wx/setup.h for the Unix platform defines generated by configure and - the library compilation options - - Note that it must be included before defining hardware symbols below as they - could be already defined by configure - */ -#include "wx/setup.h" - -/* - Hardware platform detection. - - VC++ defines _M_xxx symbols. - */ -#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__) - #ifndef __INTEL__ - #define __INTEL__ - #endif -#endif /* x86 */ - -#if defined(_M_IA64) - #ifndef __IA64__ - #define __IA64__ - #endif -#endif /* ia64 */ - -#if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__) - #ifndef __POWERPC__ - #define __POWERPC__ - #endif -#endif /* alpha */ - -#if defined(_M_ALPHA) || defined(__AXP__) - #ifndef __ALPHA__ - #define __ALPHA__ - #endif -#endif /* alpha */ - - -/* - adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1 - and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by - the system headers so bring these settings in sync - */ - -/* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */ -#if defined(_UNICODE) || defined(UNICODE) -# undef wxUSE_UNICODE -# define wxUSE_UNICODE 1 -#else /* !UNICODE */ -# ifndef wxUSE_UNICODE -# define wxUSE_UNICODE 0 -# endif -#endif /* UNICODE/!UNICODE */ - -/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */ -#if wxUSE_UNICODE -# ifndef _UNICODE -# define _UNICODE -# endif -# ifndef UNICODE -# define UNICODE -# endif -#endif /* wxUSE_UNICODE */ - -#if defined( __MWERKS__ ) && !defined(__INTEL__) -/* otherwise MSL headers bring in WIN32 dependant APIs */ -#undef UNICODE -#endif - -/* - Notice that Turbo Explorer (BCC 5.82) is available for free at - http://www.turboexplorer.com/downloads, you can get it if you have trouble - compiling wxWidgets with your current Borland compiler. -*/ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x540) -# error "wxWidgets requires a newer version of Borland, we recommend upgrading to 5.82 (Turbo Explorer). You may at your own risk remove this line and try building but be prepared to get build errors." -#endif /* __BORLANDC__ */ - -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x582) && (__BORLANDC__ > 0x559) -# ifndef _USE_OLD_RW_STL -# error "wxWidgets is incompatible with default Borland C++ 5.6 STL library, please add -D_USE_OLD_RW_STL to your bcc32.cfg to use RogueWave STL implementation." -# endif -#endif /* __BORLANDC__ */ - -/* - This macro can be used to test the Open Watcom version. -*/ -#ifndef __WATCOMC__ -# define wxWATCOM_VERSION(major,minor) 0 -# define wxCHECK_WATCOM_VERSION(major,minor) 0 -# define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0 -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# error "Only Open Watcom is supported in this release" -#else -# define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 ) -# define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) ) -# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) -#endif - -/* - check the consistency of the settings in setup.h: note that this must be - done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h - */ -#include "wx/chkconf.h" - - -/* - some compilers don't support iostream.h any longer, while some of theme - are not updated with <iostream> yet, so override the users setting here - in such case. - */ -#if defined(_MSC_VER) && (_MSC_VER >= 1310) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 0 -#elif defined(__DMC__) || defined(__WATCOMC__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 1 -#elif defined(__MINGW32__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 0 -#endif /* compilers with/without iostream.h */ - -/* - old C++ headers (like <iostream.h>) declare classes in the global namespace - while the new, standard ones (like <iostream>) do it in std:: namespace, - unless it's an old gcc version. - - using this macro allows constuctions like "wxSTD iostream" to work in - either case - */ -#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -# define wxSTD std:: -#else -# define wxSTD -#endif - -/* - OS: first of all, test for MS-DOS platform. We must do this before testing - for Unix, because DJGPP compiler defines __unix__ under MS-DOS - */ -#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__) -# ifndef __DOS__ -# define __DOS__ -# endif - /* size_t is the same as unsigned int for Watcom 11 compiler, */ - /* so define it if it hadn't been done by configure yet */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# ifdef __WATCOMC__ -# define wxSIZE_T_IS_UINT -# endif -# ifdef __DJGPP__ -# define wxSIZE_T_IS_ULONG -# endif -# endif - -/* - OS: then test for generic Unix defines, then for particular flavours and - finally for Unix-like systems - Mac OS X matches this case (__MACH__), prior Mac OS do not. - */ -#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ - defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ - defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \ - defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__) - -# define __UNIX_LIKE__ - - /* Helps SGI compilation, apparently */ -# ifdef __SGI__ -# ifdef __GNUG__ -# define __need_wchar_t -# else /* !gcc */ - /* - Note I use the term __SGI_CC__ for both cc and CC, its not a good - idea to mix gcc and cc/CC, the name mangling is different - */ -# define __SGI_CC__ -# endif /* gcc/!gcc */ - - /* system headers use this symbol and not __cplusplus in some places */ -# ifndef _LANGUAGE_C_PLUS_PLUS -# define _LANGUAGE_C_PLUS_PLUS -# endif -# endif /* SGI */ - -# if defined(sun) || defined(__SUN__) -# ifndef __GNUG__ -# ifndef __SUNCC__ -# define __SUNCC__ -# endif /* Sun CC */ -# endif -# endif /* Sun */ - -# ifdef __EMX__ -# define OS2EMX_PLAIN_CHAR -# endif - - /* define __HPUX__ for HP-UX where standard macro is __hpux */ -# if defined(__hpux) && !defined(__HPUX__) -# define __HPUX__ -# endif /* HP-UX */ - -# if defined(__CYGWIN__) || defined(__WINE__) -# if !defined(wxSIZE_T_IS_UINT) -# define wxSIZE_T_IS_UINT -# endif -# endif - - /* All of these should already be defined by including configure- - generated setup.h but we wish to support Xcode compilation without - requiring the user to define these himself. - */ -# if defined(__APPLE__) && defined(__MACH__) -# ifndef __UNIX__ -# define __UNIX__ 1 -# endif -# ifndef __BSD__ -# define __BSD__ 1 -# endif - /* __DARWIN__ is our own define to mean OS X or pure Darwin */ -# ifndef __DARWIN__ -# define __DARWIN__ 1 -# endif - /* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */ -# ifndef TARGET_CARBON -# define TARGET_CARBON 1 -# endif - /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# define wxSIZE_T_IS_ULONG -# endif -# endif - -/* - OS: Classic Mac OS - */ -#elif defined(applec) || \ - defined(THINK_C) || \ - (defined(__MWERKS__) && !defined(__INTEL__)) - /* MacOS */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# define wxSIZE_T_IS_ULONG -# endif - -/* - OS: OS/2 - */ -#elif defined(__OS2__) - - /* wxOS2 vs. non wxOS2 ports on OS2 platform */ -# if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) -# ifndef __WXPM__ -# define __WXPM__ -# endif -# endif - -# if defined(__IBMCPP__) -# define __VISAGEAVER__ __IBMCPP__ -# endif - - /* Place other OS/2 compiler environment defines here */ -# if defined(__VISAGECPP__) - /* VisualAge is the only thing that understands _Optlink */ -# define LINKAGEMODE _Optlink -# endif -# define wxSIZE_T_IS_UINT - -/* - OS: Palm OS - */ -#elif defined(__PALMOS__) -# ifdef __WIN32__ -# error "__WIN32__ should not be defined for PalmOS" -# endif -# ifdef __WINDOWS__ -# error "__WINDOWS__ should not be defined for PalmOS" -# endif -# ifdef __WXMSW__ -# error "__WXMSW__ should not be defined for PalmOS" -# endif - -/* - OS: Otherwise it must be Windows - */ -#else /* Windows */ -# ifndef __WINDOWS__ -# define __WINDOWS__ -# endif /* Windows */ - - /* to be changed for Win64! */ -# ifndef __WIN32__ -# error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported" -# endif - - /* - define another standard symbol for Microsoft Visual C++: the standard - one (_MSC_VER) is also defined by Metrowerks compiler - */ -# if defined(_MSC_VER) && !defined(__MWERKS__) -# define __VISUALC__ _MSC_VER -# elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) -# define __BORLANDC__ -# elif defined(__WATCOMC__) -# elif defined(__SC__) -# define __SYMANTECC__ -# endif /* compiler */ - - /* size_t is the same as unsigned int for all Windows compilers we know, */ - /* so define it if it hadn't been done by configure yet */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) && !defined(__WIN64__) -# define wxSIZE_T_IS_UINT -# endif -#endif /* OS */ - -/* - if we're on a Unix system but didn't use configure (so that setup.h didn't - define __UNIX__), do define __UNIX__ now - */ -#if !defined(__UNIX__) && defined(__UNIX_LIKE__) -# define __UNIX__ -#endif /* Unix */ - -#if defined(__WXMOTIF__) || defined(__WXX11__) -# define __X__ -#endif - -#ifdef __SC__ -# ifdef __DMC__ -# define __DIGITALMARS__ -# else -# define __SYMANTEC__ -# endif -#endif - -#ifdef __INTEL_COMPILER -# define __INTELC__ -#endif - -/* - We get "Large Files (ILP32) not supported in strict ANSI mode." #error - from HP-UX standard headers when compiling with g++ without this: - */ -#if defined(__HPUX__) && !defined(__STDC_EXT__) -# define __STDC_EXT__ 1 -#endif - -/* Force linking against required libraries under Windows: */ -#ifdef __WXWINCE__ -# include "wx/msw/wince/libraries.h" -#elif defined __WINDOWS__ -# include "wx/msw/libraries.h" -#endif - -/* - This macro can be used to test the gcc version and can be used like this: - -# if wxCHECK_GCC_VERSION(3, 1) - ... we have gcc 3.1 or later ... -# else - ... no gcc at all or gcc < 3.1 ... -# endif -*/ -#if defined(__GNUC__) && defined(__GNUC_MINOR__) - #define wxCHECK_GCC_VERSION( major, minor ) \ - ( ( __GNUC__ > (major) ) \ - || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) -#else - #define wxCHECK_GCC_VERSION( major, minor ) 0 -#endif - -#if defined(__BORLANDC__) || (defined(__GNUC__) && __GNUC__ < 3) -#define wxNEEDS_CHARPP -#endif - -/* - This macro can be used to check that the version of mingw32 compiler is - at least maj.min - */ -#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ - ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \ - wxCHECK_WATCOM_VERSION(1,0) ) && \ - !defined(__DOS__) && \ - !defined(__WXPM__) && \ - !defined(__WXMOTIF__) && \ - !defined(__WXGTK__) && \ - !defined(__WXX11__) && \ - !defined(__WXPALMOS__) -# include "wx/msw/gccpriv.h" -#else -# undef wxCHECK_W32API_VERSION -# define wxCHECK_W32API_VERSION(maj, min) (0) -#endif - -#if defined (__WXMSW__) -# if !defined(__WATCOMC__) -# define wxHAVE_RAW_BITMAP -# endif -#endif -#if defined(__WXGTK20__) || defined(__WXMAC__) -# define wxHAVE_RAW_BITMAP -#endif - -/* - Handle Darwin gcc universal compilation. Don't do this in an Apple- - specific case since no sane compiler should be defining either - __BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating - code that will be hosted on a machine with the appropriate endianness. - If a compiler defines neither, assume the user or configure set - WORDS_BIGENDIAN appropriately. - */ -#if defined(__BIG_ENDIAN__) -# undef WORDS_BIGENDIAN -# define WORDS_BIGENDIAN 1 -#elif defined(__LITTLE_ENDIAN__) -# undef WORDS_BIGENDIAN -#elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN) -/* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */ -# warning "Compiling wxMac with probably wrong endianness" -#endif - -#ifdef __VMS -#define XtDisplay XTDISPLAY -#ifdef __WXMOTIF__ -#define XtParent XTPARENT -#define XtScreen XTSCREEN -#define XtWindow XTWINDOW -#endif -#endif - -/* Choose which method we will use for updating menus - * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. - * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. - */ -#ifndef wxUSE_IDLEMENUUPDATES -# if (defined(__WXMSW__) || defined(__WXGTK__)) && !defined(__WXUNIVERSAL__) -# define wxUSE_IDLEMENUUPDATES 0 -# else -# define wxUSE_IDLEMENUUPDATES 1 -# endif -#endif - -/* - * Define symbols that are not yet in - * configure or possibly some setup.h files. - * They will need to be added. - */ - -#ifndef wxUSE_FILECONFIG -# if wxUSE_CONFIG -# define wxUSE_FILECONFIG 1 -# else -# define wxUSE_FILECONFIG 0 -# endif -#endif - -#ifndef wxUSE_HOTKEY -# define wxUSE_HOTKEY 0 -#endif - -#if !defined(wxUSE_WXDIB) && defined(__WXMSW__) -# define wxUSE_WXDIB 1 -#endif - -/* - We need AvailabilityMacros.h for ifdefing out things that don't exist on - OSX 10.2 and lower - FIXME: We need a better way to detect for 10.3 then including a system header -*/ -#ifdef __DARWIN__ - #include <AvailabilityMacros.h> -#endif - -#endif /* _WX_PLATFORM_H_ */ +/** +* Name: wx/platform.h +* Purpose: define the OS and compiler identification macros +* Author: Vadim Zeitlin +* Modified by: +* Created: 29.10.01 (extracted from wx/defs.h) +* RCS-ID: $Id: platform.h 53877 2008-05-31 12:43:44Z SN $ +* Copyright: (c) 1997-2001 Vadim Zeitlin +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_PLATFORM_H_ +#define _WX_PLATFORM_H_ + + +/* + Codewarrior doesn't define any Windows symbols until some headers + are included +*/ +#ifdef __MWERKS__ +# include <stddef.h> +#endif + +/* + WXMAC variants + __WXMAC_CLASSIC__ means ppc non-carbon builds, __WXMAC_CARBON__ means + carbon API available (mach or cfm builds) , __WXMAC_OSX__ means mach-o + builds, running under 10.2 + only +*/ +#ifdef __WXMAC__ +# if defined(__MACH__) +# define __WXMAC_OSX__ +# define __WXMAC_CARBON__ +# include <AvailabilityMacros.h> +# ifndef MAC_OS_X_VERSION_10_4 +# define MAC_OS_X_VERSION_10_4 1040 +# endif +# ifndef MAC_OS_X_VERSION_10_5 +# define MAC_OS_X_VERSION_10_5 1050 +# endif +# ifdef __WXMAC_XCODE__ +# include <unistd.h> +# include "wx/mac/carbon/config_xcode.h" +# endif +# else +# if TARGET_CARBON +# define __WXMAC_CARBON__ +# else +# define __WXMAC_CLASSIC__ +# endif +# endif +#endif + +/* + __WXOSX__ is a common define to wxMac (Carbon) and wxCocoa ports under OS X. + */ +#if defined(__WXMAC_OSX__) || defined(__WXCOCOA__) +# define __WXOSX__ +#endif + +/* + first define Windows symbols if they're not defined on the command line: we + can autodetect everything we need if _WIN32 is defined + */ +#if defined(__CYGWIN__) && defined(__WINDOWS__) +# ifndef __WXMSW__ +# define __WXMSW__ +# endif + +# ifndef _WIN32 +# define _WIN32 +# endif + +# ifndef WIN32 +# define WIN32 +# endif +#endif + +#if defined(__PALMOS__) +# if __PALMOS__ == 0x06000000 +# define __WXPALMOS6__ +# endif +# if __PALMOS__ == 0x05000000 +# define __WXPALMOS5__ +# endif +# ifndef __WXPALMOS__ +# define __WXPALMOS__ +# endif +# ifdef __WXMSW__ +# undef __WXMSW__ +# endif +# ifdef __WINDOWS__ +# undef __WINDOWS__ +# endif +# ifdef __WIN32__ +# undef __WIN32__ +# endif +# ifdef WIN32 +# undef WIN32 +# endif +# ifdef _WIN32 +# undef _WIN32 +# endif +#endif + +#if defined(_WIN64) +# ifndef _WIN32 + /* + a lot of code (mistakenly) uses #ifdef _WIN32 to either test for + Windows or to test for !__WIN16__, so we must define _WIN32 for + Win64 as well to ensure that the existing code continues to work. + */ +# define _WIN32 +# endif /* !_WIN32 */ + +# ifndef __WIN64__ +# define __WIN64__ +# endif /* !__WIN64__ */ +#endif /* _WIN64 */ + +#if (defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)) \ + && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) +# ifndef __WXMSW__ +# define __WXMSW__ +# endif + +# ifndef __WIN32__ +# define __WIN32__ +# endif +#endif /* Win32 */ + +#if defined(__WXMSW__) || defined(__WIN32__) +# if !defined(__WINDOWS__) +# define __WINDOWS__ +# endif +#endif + +/* detect MS SmartPhone */ +#if defined( WIN32_PLATFORM_WFSP ) +# ifndef __SMARTPHONE__ +# define __SMARTPHONE__ +# endif +# ifndef __WXWINCE__ +# define __WXWINCE__ +# endif +#endif + +/* detect PocketPC */ +#if defined( WIN32_PLATFORM_PSPC ) +# ifndef __POCKETPC__ +# define __POCKETPC__ +# endif +# ifndef __WXWINCE__ +# define __WXWINCE__ +# endif +#endif + +/* detect Standard WinCE SDK */ +#if defined( WCE_PLATFORM_STANDARDSDK ) +# ifndef __WINCE_STANDARDSDK__ +# define __WINCE_STANDARDSDK__ +# endif +# ifndef __WXWINCE__ +# define __WXWINCE__ +# endif +#endif + +#if defined(_WIN32_WCE) && !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) +# if (_WIN32_WCE >= 400) +# ifndef __WINCE_NET__ +# define __WINCE_NET__ +# endif +# elif (_WIN32_WCE >= 200) +# ifndef __HANDHELDPC__ +# define __HANDHELDPC__ +# endif +# endif +# ifndef __WXWINCE__ +# define __WXWINCE__ +# endif +#endif + +#if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__) +# define __WXHANDHELD__ +#endif + +/* + Include wx/setup.h for the Unix platform defines generated by configure and + the library compilation options + + Note that it must be included before defining hardware symbols below as they + could be already defined by configure + */ +#include "wx/setup.h" + +/* + Hardware platform detection. + + VC++ defines _M_xxx symbols. + */ +#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__) + #ifndef __INTEL__ + #define __INTEL__ + #endif +#endif /* x86 */ + +#if defined(_M_IA64) + #ifndef __IA64__ + #define __IA64__ + #endif +#endif /* ia64 */ + +#if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__) + #ifndef __POWERPC__ + #define __POWERPC__ + #endif +#endif /* alpha */ + +#if defined(_M_ALPHA) || defined(__AXP__) + #ifndef __ALPHA__ + #define __ALPHA__ + #endif +#endif /* alpha */ + + +/* + adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1 + and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by + the system headers so bring these settings in sync + */ + +/* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */ +#if defined(_UNICODE) || defined(UNICODE) +# undef wxUSE_UNICODE +# define wxUSE_UNICODE 1 +#else /* !UNICODE */ +# ifndef wxUSE_UNICODE +# define wxUSE_UNICODE 0 +# endif +#endif /* UNICODE/!UNICODE */ + +/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */ +#if wxUSE_UNICODE +# ifndef _UNICODE +# define _UNICODE +# endif +# ifndef UNICODE +# define UNICODE +# endif +#endif /* wxUSE_UNICODE */ + +#if defined( __MWERKS__ ) && !defined(__INTEL__) +/* otherwise MSL headers bring in WIN32 dependant APIs */ +#undef UNICODE +#endif + +/* + Notice that Turbo Explorer (BCC 5.82) is available for free at + http://www.turboexplorer.com/downloads, you can get it if you have trouble + compiling wxWidgets with your current Borland compiler. +*/ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x540) +# error "wxWidgets requires a newer version of Borland, we recommend upgrading to 5.82 (Turbo Explorer). You may at your own risk remove this line and try building but be prepared to get build errors." +#endif /* __BORLANDC__ */ + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x582) && (__BORLANDC__ > 0x559) +# ifndef _USE_OLD_RW_STL +# error "wxWidgets is incompatible with default Borland C++ 5.6 STL library, please add -D_USE_OLD_RW_STL to your bcc32.cfg to use RogueWave STL implementation." +# endif +#endif /* __BORLANDC__ */ + +/* + This macro can be used to test the Open Watcom version. +*/ +#ifndef __WATCOMC__ +# define wxWATCOM_VERSION(major,minor) 0 +# define wxCHECK_WATCOM_VERSION(major,minor) 0 +# define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0 +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# error "Only Open Watcom is supported in this release" +#else +# define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 ) +# define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) ) +# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) +#endif + +/* + check the consistency of the settings in setup.h: note that this must be + done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h + */ +#include "wx/chkconf.h" + + +/* + some compilers don't support iostream.h any longer, while some of theme + are not updated with <iostream> yet, so override the users setting here + in such case. + */ +#if defined(_MSC_VER) && (_MSC_VER >= 1310) +# undef wxUSE_IOSTREAMH +# define wxUSE_IOSTREAMH 0 +#elif defined(__DMC__) || defined(__WATCOMC__) +# undef wxUSE_IOSTREAMH +# define wxUSE_IOSTREAMH 1 +#elif defined(__MINGW32__) +# undef wxUSE_IOSTREAMH +# define wxUSE_IOSTREAMH 0 +#endif /* compilers with/without iostream.h */ + +/* + old C++ headers (like <iostream.h>) declare classes in the global namespace + while the new, standard ones (like <iostream>) do it in std:: namespace, + unless it's an old gcc version. + + using this macro allows constuctions like "wxSTD iostream" to work in + either case + */ +#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) +# define wxSTD std:: +#else +# define wxSTD +#endif + +/* + OS: first of all, test for MS-DOS platform. We must do this before testing + for Unix, because DJGPP compiler defines __unix__ under MS-DOS + */ +#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__) +# ifndef __DOS__ +# define __DOS__ +# endif + /* size_t is the same as unsigned int for Watcom 11 compiler, */ + /* so define it if it hadn't been done by configure yet */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) +# ifdef __WATCOMC__ +# define wxSIZE_T_IS_UINT +# endif +# ifdef __DJGPP__ +# define wxSIZE_T_IS_ULONG +# endif +# endif + +/* + OS: then test for generic Unix defines, then for particular flavours and + finally for Unix-like systems + Mac OS X matches this case (__MACH__), prior Mac OS do not. + */ +#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ + defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ + defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \ + defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__) + +# define __UNIX_LIKE__ + + /* Helps SGI compilation, apparently */ +# ifdef __SGI__ +# ifdef __GNUG__ +# define __need_wchar_t +# else /* !gcc */ + /* + Note I use the term __SGI_CC__ for both cc and CC, its not a good + idea to mix gcc and cc/CC, the name mangling is different + */ +# define __SGI_CC__ +# endif /* gcc/!gcc */ + + /* system headers use this symbol and not __cplusplus in some places */ +# ifndef _LANGUAGE_C_PLUS_PLUS +# define _LANGUAGE_C_PLUS_PLUS +# endif +# endif /* SGI */ + +# if defined(sun) || defined(__SUN__) +# ifndef __GNUG__ +# ifndef __SUNCC__ +# define __SUNCC__ +# endif /* Sun CC */ +# endif +# endif /* Sun */ + +# ifdef __EMX__ +# define OS2EMX_PLAIN_CHAR +# endif + + /* define __HPUX__ for HP-UX where standard macro is __hpux */ +# if defined(__hpux) && !defined(__HPUX__) +# define __HPUX__ +# endif /* HP-UX */ + +# if defined(__CYGWIN__) || defined(__WINE__) +# if !defined(wxSIZE_T_IS_UINT) +# define wxSIZE_T_IS_UINT +# endif +# endif + + /* All of these should already be defined by including configure- + generated setup.h but we wish to support Xcode compilation without + requiring the user to define these himself. + */ +# if defined(__APPLE__) && defined(__MACH__) +# ifndef __UNIX__ +# define __UNIX__ 1 +# endif +# ifndef __BSD__ +# define __BSD__ 1 +# endif + /* __DARWIN__ is our own define to mean OS X or pure Darwin */ +# ifndef __DARWIN__ +# define __DARWIN__ 1 +# endif + /* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */ +# ifndef TARGET_CARBON +# define TARGET_CARBON 1 +# endif + /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) +# define wxSIZE_T_IS_ULONG +# endif +# endif + +/* + OS: Classic Mac OS + */ +#elif defined(applec) || \ + defined(THINK_C) || \ + (defined(__MWERKS__) && !defined(__INTEL__)) + /* MacOS */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) +# define wxSIZE_T_IS_ULONG +# endif + +/* + OS: OS/2 + */ +#elif defined(__OS2__) + + /* wxOS2 vs. non wxOS2 ports on OS2 platform */ +# if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) +# ifndef __WXPM__ +# define __WXPM__ +# endif +# endif + +# if defined(__IBMCPP__) +# define __VISAGEAVER__ __IBMCPP__ +# endif + + /* Place other OS/2 compiler environment defines here */ +# if defined(__VISAGECPP__) + /* VisualAge is the only thing that understands _Optlink */ +# define LINKAGEMODE _Optlink +# endif +# define wxSIZE_T_IS_UINT + +/* + OS: Palm OS + */ +#elif defined(__PALMOS__) +# ifdef __WIN32__ +# error "__WIN32__ should not be defined for PalmOS" +# endif +# ifdef __WINDOWS__ +# error "__WINDOWS__ should not be defined for PalmOS" +# endif +# ifdef __WXMSW__ +# error "__WXMSW__ should not be defined for PalmOS" +# endif + +/* + OS: Otherwise it must be Windows + */ +#else /* Windows */ +# ifndef __WINDOWS__ +# define __WINDOWS__ +# endif /* Windows */ + + /* to be changed for Win64! */ +# ifndef __WIN32__ +# error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported" +# endif + + /* + define another standard symbol for Microsoft Visual C++: the standard + one (_MSC_VER) is also defined by Metrowerks compiler + */ +# if defined(_MSC_VER) && !defined(__MWERKS__) +# define __VISUALC__ _MSC_VER +# elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) +# define __BORLANDC__ +# elif defined(__WATCOMC__) +# elif defined(__SC__) +# define __SYMANTECC__ +# endif /* compiler */ + + /* size_t is the same as unsigned int for all Windows compilers we know, */ + /* so define it if it hadn't been done by configure yet */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) && !defined(__WIN64__) +# define wxSIZE_T_IS_UINT +# endif +#endif /* OS */ + +/* + if we're on a Unix system but didn't use configure (so that setup.h didn't + define __UNIX__), do define __UNIX__ now + */ +#if !defined(__UNIX__) && defined(__UNIX_LIKE__) +# define __UNIX__ +#endif /* Unix */ + +#if defined(__WXMOTIF__) || defined(__WXX11__) +# define __X__ +#endif + +#ifdef __SC__ +# ifdef __DMC__ +# define __DIGITALMARS__ +# else +# define __SYMANTEC__ +# endif +#endif + +#ifdef __INTEL_COMPILER +# define __INTELC__ +#endif + +/* + We get "Large Files (ILP32) not supported in strict ANSI mode." #error + from HP-UX standard headers when compiling with g++ without this: + */ +#if defined(__HPUX__) && !defined(__STDC_EXT__) +# define __STDC_EXT__ 1 +#endif + +/* Force linking against required libraries under Windows: */ +#ifdef __WXWINCE__ +# include "wx/msw/wince/libraries.h" +#elif defined __WINDOWS__ +# include "wx/msw/libraries.h" +#endif + +/* + This macro can be used to test the gcc version and can be used like this: + +# if wxCHECK_GCC_VERSION(3, 1) + ... we have gcc 3.1 or later ... +# else + ... no gcc at all or gcc < 3.1 ... +# endif +*/ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) + #define wxCHECK_GCC_VERSION( major, minor ) \ + ( ( __GNUC__ > (major) ) \ + || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) +#else + #define wxCHECK_GCC_VERSION( major, minor ) 0 +#endif + +#if defined(__BORLANDC__) || (defined(__GNUC__) && __GNUC__ < 3) +#define wxNEEDS_CHARPP +#endif + +/* + This macro can be used to check that the version of mingw32 compiler is + at least maj.min + */ +#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ + ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \ + wxCHECK_WATCOM_VERSION(1,0) ) && \ + !defined(__DOS__) && \ + !defined(__WXPM__) && \ + !defined(__WXMOTIF__) && \ + !defined(__WXGTK__) && \ + !defined(__WXX11__) && \ + !defined(__WXPALMOS__) +# include "wx/msw/gccpriv.h" +#else +# undef wxCHECK_W32API_VERSION +# define wxCHECK_W32API_VERSION(maj, min) (0) +#endif + +#if defined (__WXMSW__) +# if !defined(__WATCOMC__) +# define wxHAVE_RAW_BITMAP +# endif +#endif +#if defined(__WXGTK20__) || defined(__WXMAC__) +# define wxHAVE_RAW_BITMAP +#endif + +/* + Handle Darwin gcc universal compilation. Don't do this in an Apple- + specific case since no sane compiler should be defining either + __BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating + code that will be hosted on a machine with the appropriate endianness. + If a compiler defines neither, assume the user or configure set + WORDS_BIGENDIAN appropriately. + */ +#if defined(__BIG_ENDIAN__) +# undef WORDS_BIGENDIAN +# define WORDS_BIGENDIAN 1 +#elif defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +#elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN) +/* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */ +# warning "Compiling wxMac with probably wrong endianness" +#endif + +#ifdef __VMS +#define XtDisplay XTDISPLAY +#ifdef __WXMOTIF__ +#define XtParent XTPARENT +#define XtScreen XTSCREEN +#define XtWindow XTWINDOW +#endif +#endif + +/* Choose which method we will use for updating menus + * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. + * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. + */ +#ifndef wxUSE_IDLEMENUUPDATES +# if (defined(__WXMSW__) || defined(__WXGTK__)) && !defined(__WXUNIVERSAL__) +# define wxUSE_IDLEMENUUPDATES 0 +# else +# define wxUSE_IDLEMENUUPDATES 1 +# endif +#endif + +/* + * Define symbols that are not yet in + * configure or possibly some setup.h files. + * They will need to be added. + */ + +#ifndef wxUSE_FILECONFIG +# if wxUSE_CONFIG +# define wxUSE_FILECONFIG 1 +# else +# define wxUSE_FILECONFIG 0 +# endif +#endif + +#ifndef wxUSE_HOTKEY +# define wxUSE_HOTKEY 0 +#endif + +#if !defined(wxUSE_WXDIB) && defined(__WXMSW__) +# define wxUSE_WXDIB 1 +#endif + +/* + We need AvailabilityMacros.h for ifdefing out things that don't exist on + OSX 10.2 and lower + FIXME: We need a better way to detect for 10.3 then including a system header +*/ +#ifdef __DARWIN__ + #include <AvailabilityMacros.h> +#endif + +#endif /* _WX_PLATFORM_H_ */ diff --git a/Externals/wxWidgets/include/wx/platinfo.h b/Externals/wxWidgets/include/wx/platinfo.h index d9382dd2ea..7a77acb3e8 100644 --- a/Externals/wxWidgets/include/wx/platinfo.h +++ b/Externals/wxWidgets/include/wx/platinfo.h @@ -1,313 +1,313 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/platinfo.h -// Purpose: declaration of the wxPlatformInfo class -// Author: Francesco Montorsi -// Modified by: -// Created: 07.07.2006 (based on wxToolkitInfo) -// RCS-ID: $Id: platinfo.h 41807 2006-10-09 15:58:56Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// License: wxWindows license -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PLATINFO_H_ -#define _WX_PLATINFO_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxPlatformInfo -// ---------------------------------------------------------------------------- - -// VERY IMPORTANT: when changing these enum values, also change the relative -// string tables in src/common/platinfo.cpp - - -// families & sub-families of operating systems -enum wxOperatingSystemId -{ - wxOS_UNKNOWN = 0, // returned on error - - wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths - wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths - wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN, - - wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME) - wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP) - wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows - wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile) - wxOS_WINDOWS = wxOS_WINDOWS_9X | - wxOS_WINDOWS_NT | - wxOS_WINDOWS_MICRO | - wxOS_WINDOWS_CE, - - wxOS_UNIX_LINUX = 1 << 6, // Linux - wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD - wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD - wxOS_UNIX_NETBSD = 1 << 9, // NetBSD - wxOS_UNIX_SOLARIS = 1 << 10, // SunOS - wxOS_UNIX_AIX = 1 << 11, // AIX - wxOS_UNIX_HPUX = 1 << 12, // HP/UX - wxOS_UNIX = wxOS_UNIX_LINUX | - wxOS_UNIX_FREEBSD | - wxOS_UNIX_OPENBSD | - wxOS_UNIX_NETBSD | - wxOS_UNIX_SOLARIS | - wxOS_UNIX_AIX | - wxOS_UNIX_HPUX, - - // 1<<13 and 1<<14 available for other Unix flavours - - wxOS_DOS = 1 << 15, // Microsoft DOS - wxOS_OS2 = 1 << 16 // OS/2 -}; - -// list of wxWidgets ports - some of them can be used with more than -// a single toolkit. -enum wxPortId -{ - wxPORT_UNKNOWN = 0, // returned on error - - wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used - - wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API - wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif - wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo - wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal - wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal - wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager - wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager - wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API - wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API - wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API - wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API - wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal -}; - -// architecture of the operating system -// (regardless of the build environment of wxWidgets library - see -// wxIsPlatform64bit documentation for more info) -enum wxArchitecture -{ - wxARCH_INVALID = -1, // returned on error - - wxARCH_32, // 32 bit - wxARCH_64, - - wxARCH_MAX -}; - - -// endian-ness of the machine -enum wxEndianness -{ - wxENDIAN_INVALID = -1, // returned on error - - wxENDIAN_BIG, // 4321 - wxENDIAN_LITTLE, // 1234 - wxENDIAN_PDP, // 3412 - - wxENDIAN_MAX -}; - -// Information about the toolkit that the app is running under and some basic -// platform and architecture info -class WXDLLIMPEXP_BASE wxPlatformInfo -{ -public: - wxPlatformInfo(); - wxPlatformInfo(wxPortId pid, - int tkMajor = -1, int tkMinor = -1, - wxOperatingSystemId id = wxOS_UNKNOWN, - int osMajor = -1, int osMinor = -1, - wxArchitecture arch = wxARCH_INVALID, - wxEndianness endian = wxENDIAN_INVALID, - bool usingUniversal = false); - - // default copy ctor, assignment operator and dtor are ok - - bool operator==(const wxPlatformInfo &t) const; - - bool operator!=(const wxPlatformInfo &t) const - { return !(*this == t); } - - // Gets a wxPlatformInfo already initialized with the values for - // the currently running platform. - static const wxPlatformInfo& Get(); - - - - // string -> enum conversions - // --------------------------------- - - static wxOperatingSystemId GetOperatingSystemId(const wxString &name); - static wxPortId GetPortId(const wxString &portname); - - static wxArchitecture GetArch(const wxString &arch); - static wxEndianness GetEndianness(const wxString &end); - - // enum -> string conversions - // --------------------------------- - - static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os); - static wxString GetOperatingSystemIdName(wxOperatingSystemId os); - static wxString GetPortIdName(wxPortId port, bool usingUniversal); - static wxString GetPortIdShortName(wxPortId port, bool usingUniversal); - - static wxString GetArchName(wxArchitecture arch); - static wxString GetEndiannessName(wxEndianness end); - - // getters - // ----------------- - - int GetOSMajorVersion() const - { return m_osVersionMajor; } - int GetOSMinorVersion() const - { return m_osVersionMinor; } - - // return true if the OS version >= major.minor - bool CheckOSVersion(int major, int minor) const - { - return DoCheckVersion(GetOSMajorVersion(), - GetOSMinorVersion(), - major, - minor); - } - - int GetToolkitMajorVersion() const - { return m_tkVersionMajor; } - int GetToolkitMinorVersion() const - { return m_tkVersionMinor; } - - bool CheckToolkitVersion(int major, int minor) const - { - return DoCheckVersion(GetToolkitMajorVersion(), - GetToolkitMinorVersion(), - major, - minor); - } - - bool IsUsingUniversalWidgets() const - { return m_usingUniversal; } - - wxOperatingSystemId GetOperatingSystemId() const - { return m_os; } - wxPortId GetPortId() const - { return m_port; } - wxArchitecture GetArchitecture() const - { return m_arch; } - wxEndianness GetEndianness() const - { return m_endian; } - - - // string getters - // ----------------- - - wxString GetOperatingSystemFamilyName() const - { return GetOperatingSystemFamilyName(m_os); } - wxString GetOperatingSystemIdName() const - { return GetOperatingSystemIdName(m_os); } - wxString GetPortIdName() const - { return GetPortIdName(m_port, m_usingUniversal); } - wxString GetPortIdShortName() const - { return GetPortIdShortName(m_port, m_usingUniversal); } - wxString GetArchName() const - { return GetArchName(m_arch); } - wxString GetEndiannessName() const - { return GetEndiannessName(m_endian); } - - // setters - // ----------------- - - void SetOSVersion(int major, int minor) - { m_osVersionMajor=major; m_osVersionMinor=minor; } - void SetToolkitVersion(int major, int minor) - { m_tkVersionMajor=major; m_tkVersionMinor=minor; } - - void SetOperatingSystemId(wxOperatingSystemId n) - { m_os = n; } - void SetPortId(wxPortId n) - { m_port = n; } - void SetArchitecture(wxArchitecture n) - { m_arch = n; } - void SetEndianness(wxEndianness n) - { m_endian = n; } - - // miscellaneous - // ----------------- - - bool IsOk() const - { - return m_osVersionMajor != -1 && m_osVersionMinor != -1 && - m_os != wxOS_UNKNOWN && - m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && - m_port != wxPORT_UNKNOWN && - m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID; - } - - -protected: - static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor) - { - return majorCur > major || (majorCur == major && minorCur >= minor); - } - - void InitForCurrentPlatform(); - - - // OS stuff - // ----------------- - - // Version of the OS; valid if m_os != wxOS_UNKNOWN - // (-1 means not initialized yet). - int m_osVersionMajor, - m_osVersionMinor; - - // Operating system ID. - wxOperatingSystemId m_os; - - - // toolkit - // ----------------- - - // Version of the underlying toolkit - // (-1 means not initialized yet; zero means no toolkit). - int m_tkVersionMajor, m_tkVersionMinor; - - // name of the wxWidgets port - wxPortId m_port; - - // is using wxUniversal widgets? - bool m_usingUniversal; - - - // others - // ----------------- - - // architecture of the OS - wxArchitecture m_arch; - - // endianness of the machine - wxEndianness m_endian; -}; - - -#if WXWIN_COMPATIBILITY_2_6 - #define wxUNKNOWN_PLATFORM wxOS_UNKNOWN - #define wxUnix wxOS_UNIX - #define wxWin95 wxOS_WINDOWS_9X - #define wxWIN95 wxOS_WINDOWS_9X - #define wxWINDOWS_NT wxOS_WINDOWS_NT - #define wxMSW wxOS_WINDOWS - #define wxWinCE wxOS_WINDOWS_CE - #define wxWIN32S wxOS_WINDOWS_9X - - #define wxPalmOS wxPORT_PALMOS - #define wxOS2 wxPORT_OS2 - #define wxMGL wxPORT_MGL - #define wxCocoa wxPORT_MAC - #define wxMac wxPORT_MAC - #define wxMotif wxPORT_MOTIF - #define wxGTK wxPORT_GTK -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // _WX_PLATINFO_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/platinfo.h +// Purpose: declaration of the wxPlatformInfo class +// Author: Francesco Montorsi +// Modified by: +// Created: 07.07.2006 (based on wxToolkitInfo) +// RCS-ID: $Id: platinfo.h 41807 2006-10-09 15:58:56Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// License: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PLATINFO_H_ +#define _WX_PLATINFO_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxPlatformInfo +// ---------------------------------------------------------------------------- + +// VERY IMPORTANT: when changing these enum values, also change the relative +// string tables in src/common/platinfo.cpp + + +// families & sub-families of operating systems +enum wxOperatingSystemId +{ + wxOS_UNKNOWN = 0, // returned on error + + wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths + wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths + wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN, + + wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME) + wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP) + wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows + wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile) + wxOS_WINDOWS = wxOS_WINDOWS_9X | + wxOS_WINDOWS_NT | + wxOS_WINDOWS_MICRO | + wxOS_WINDOWS_CE, + + wxOS_UNIX_LINUX = 1 << 6, // Linux + wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD + wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD + wxOS_UNIX_NETBSD = 1 << 9, // NetBSD + wxOS_UNIX_SOLARIS = 1 << 10, // SunOS + wxOS_UNIX_AIX = 1 << 11, // AIX + wxOS_UNIX_HPUX = 1 << 12, // HP/UX + wxOS_UNIX = wxOS_UNIX_LINUX | + wxOS_UNIX_FREEBSD | + wxOS_UNIX_OPENBSD | + wxOS_UNIX_NETBSD | + wxOS_UNIX_SOLARIS | + wxOS_UNIX_AIX | + wxOS_UNIX_HPUX, + + // 1<<13 and 1<<14 available for other Unix flavours + + wxOS_DOS = 1 << 15, // Microsoft DOS + wxOS_OS2 = 1 << 16 // OS/2 +}; + +// list of wxWidgets ports - some of them can be used with more than +// a single toolkit. +enum wxPortId +{ + wxPORT_UNKNOWN = 0, // returned on error + + wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used + + wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API + wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif + wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo + wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal + wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal + wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager + wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager + wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API + wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API + wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API + wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API + wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal +}; + +// architecture of the operating system +// (regardless of the build environment of wxWidgets library - see +// wxIsPlatform64bit documentation for more info) +enum wxArchitecture +{ + wxARCH_INVALID = -1, // returned on error + + wxARCH_32, // 32 bit + wxARCH_64, + + wxARCH_MAX +}; + + +// endian-ness of the machine +enum wxEndianness +{ + wxENDIAN_INVALID = -1, // returned on error + + wxENDIAN_BIG, // 4321 + wxENDIAN_LITTLE, // 1234 + wxENDIAN_PDP, // 3412 + + wxENDIAN_MAX +}; + +// Information about the toolkit that the app is running under and some basic +// platform and architecture info +class WXDLLIMPEXP_BASE wxPlatformInfo +{ +public: + wxPlatformInfo(); + wxPlatformInfo(wxPortId pid, + int tkMajor = -1, int tkMinor = -1, + wxOperatingSystemId id = wxOS_UNKNOWN, + int osMajor = -1, int osMinor = -1, + wxArchitecture arch = wxARCH_INVALID, + wxEndianness endian = wxENDIAN_INVALID, + bool usingUniversal = false); + + // default copy ctor, assignment operator and dtor are ok + + bool operator==(const wxPlatformInfo &t) const; + + bool operator!=(const wxPlatformInfo &t) const + { return !(*this == t); } + + // Gets a wxPlatformInfo already initialized with the values for + // the currently running platform. + static const wxPlatformInfo& Get(); + + + + // string -> enum conversions + // --------------------------------- + + static wxOperatingSystemId GetOperatingSystemId(const wxString &name); + static wxPortId GetPortId(const wxString &portname); + + static wxArchitecture GetArch(const wxString &arch); + static wxEndianness GetEndianness(const wxString &end); + + // enum -> string conversions + // --------------------------------- + + static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os); + static wxString GetOperatingSystemIdName(wxOperatingSystemId os); + static wxString GetPortIdName(wxPortId port, bool usingUniversal); + static wxString GetPortIdShortName(wxPortId port, bool usingUniversal); + + static wxString GetArchName(wxArchitecture arch); + static wxString GetEndiannessName(wxEndianness end); + + // getters + // ----------------- + + int GetOSMajorVersion() const + { return m_osVersionMajor; } + int GetOSMinorVersion() const + { return m_osVersionMinor; } + + // return true if the OS version >= major.minor + bool CheckOSVersion(int major, int minor) const + { + return DoCheckVersion(GetOSMajorVersion(), + GetOSMinorVersion(), + major, + minor); + } + + int GetToolkitMajorVersion() const + { return m_tkVersionMajor; } + int GetToolkitMinorVersion() const + { return m_tkVersionMinor; } + + bool CheckToolkitVersion(int major, int minor) const + { + return DoCheckVersion(GetToolkitMajorVersion(), + GetToolkitMinorVersion(), + major, + minor); + } + + bool IsUsingUniversalWidgets() const + { return m_usingUniversal; } + + wxOperatingSystemId GetOperatingSystemId() const + { return m_os; } + wxPortId GetPortId() const + { return m_port; } + wxArchitecture GetArchitecture() const + { return m_arch; } + wxEndianness GetEndianness() const + { return m_endian; } + + + // string getters + // ----------------- + + wxString GetOperatingSystemFamilyName() const + { return GetOperatingSystemFamilyName(m_os); } + wxString GetOperatingSystemIdName() const + { return GetOperatingSystemIdName(m_os); } + wxString GetPortIdName() const + { return GetPortIdName(m_port, m_usingUniversal); } + wxString GetPortIdShortName() const + { return GetPortIdShortName(m_port, m_usingUniversal); } + wxString GetArchName() const + { return GetArchName(m_arch); } + wxString GetEndiannessName() const + { return GetEndiannessName(m_endian); } + + // setters + // ----------------- + + void SetOSVersion(int major, int minor) + { m_osVersionMajor=major; m_osVersionMinor=minor; } + void SetToolkitVersion(int major, int minor) + { m_tkVersionMajor=major; m_tkVersionMinor=minor; } + + void SetOperatingSystemId(wxOperatingSystemId n) + { m_os = n; } + void SetPortId(wxPortId n) + { m_port = n; } + void SetArchitecture(wxArchitecture n) + { m_arch = n; } + void SetEndianness(wxEndianness n) + { m_endian = n; } + + // miscellaneous + // ----------------- + + bool IsOk() const + { + return m_osVersionMajor != -1 && m_osVersionMinor != -1 && + m_os != wxOS_UNKNOWN && + m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && + m_port != wxPORT_UNKNOWN && + m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID; + } + + +protected: + static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor) + { + return majorCur > major || (majorCur == major && minorCur >= minor); + } + + void InitForCurrentPlatform(); + + + // OS stuff + // ----------------- + + // Version of the OS; valid if m_os != wxOS_UNKNOWN + // (-1 means not initialized yet). + int m_osVersionMajor, + m_osVersionMinor; + + // Operating system ID. + wxOperatingSystemId m_os; + + + // toolkit + // ----------------- + + // Version of the underlying toolkit + // (-1 means not initialized yet; zero means no toolkit). + int m_tkVersionMajor, m_tkVersionMinor; + + // name of the wxWidgets port + wxPortId m_port; + + // is using wxUniversal widgets? + bool m_usingUniversal; + + + // others + // ----------------- + + // architecture of the OS + wxArchitecture m_arch; + + // endianness of the machine + wxEndianness m_endian; +}; + + +#if WXWIN_COMPATIBILITY_2_6 + #define wxUNKNOWN_PLATFORM wxOS_UNKNOWN + #define wxUnix wxOS_UNIX + #define wxWin95 wxOS_WINDOWS_9X + #define wxWIN95 wxOS_WINDOWS_9X + #define wxWINDOWS_NT wxOS_WINDOWS_NT + #define wxMSW wxOS_WINDOWS + #define wxWinCE wxOS_WINDOWS_CE + #define wxWIN32S wxOS_WINDOWS_9X + + #define wxPalmOS wxPORT_PALMOS + #define wxOS2 wxPORT_OS2 + #define wxMGL wxPORT_MGL + #define wxCocoa wxPORT_MAC + #define wxMac wxPORT_MAC + #define wxMotif wxPORT_MOTIF + #define wxGTK wxPORT_GTK +#endif // WXWIN_COMPATIBILITY_2_6 + +#endif // _WX_PLATINFO_H_ diff --git a/Externals/wxWidgets/include/wx/popupwin.h b/Externals/wxWidgets/include/wx/popupwin.h index c72eafeb6d..c2f2d984d1 100644 --- a/Externals/wxWidgets/include/wx/popupwin.h +++ b/Externals/wxWidgets/include/wx/popupwin.h @@ -1,192 +1,192 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/popupwin.h -// Purpose: wxPopupWindow interface declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.01.01 -// RCS-ID: $Id: popupwin.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_POPUPWIN_H_BASE_ -#define _WX_POPUPWIN_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_POPUPWIN - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxPopupWindow: a special kind of top level window used for popup menus, -// combobox popups and such. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPopupWindowBase : public wxWindow -{ -public: - wxPopupWindowBase() { } - virtual ~wxPopupWindowBase(); - - // create the popup window - // - // style may only contain border flags - bool Create(wxWindow *parent, int style = wxBORDER_NONE); - - // move the popup window to the right position, i.e. such that it is - // entirely visible - // - // the popup is positioned at ptOrigin + size if it opens below and to the - // right (default), at ptOrigin - sizePopup if it opens above and to the - // left &c - // - // the point must be given in screen coordinates! - virtual void Position(const wxPoint& ptOrigin, - const wxSize& size); - - virtual bool IsTopLevel() const { return true; } - - DECLARE_NO_COPY_CLASS(wxPopupWindowBase) -}; - - -// include the real class declaration -#if defined(__WXMSW__) - #include "wx/msw/popupwin.h" -#elif defined(__WXPM__) - #include "wx/os2/popupwin.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/popupwin.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/popupwin.h" -#elif defined(__WXX11__) - #include "wx/x11/popupwin.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/popupwin.h" -#elif defined(__WXMGL__) - #include "wx/mgl/popupwin.h" -#elif defined(__WXMAC__) - #include "wx/mac/popupwin.h" -#else - #error "wxPopupWindow is not supported under this platform." -#endif - -// ---------------------------------------------------------------------------- -// wxPopupTransientWindow: a wxPopupWindow which disappears automatically -// when the user clicks mouse outside it or if it loses focus in any other way -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; -class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; - -class WXDLLEXPORT wxPopupTransientWindow : public wxPopupWindow -{ -public: - // ctors - wxPopupTransientWindow() { Init(); } - wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); - - virtual ~wxPopupTransientWindow(); - - // popup the window (this will show it too) and keep focus at winFocus - // (or itself if it's NULL), dismiss the popup if we lose focus - virtual void Popup(wxWindow *focus = NULL); - - // hide the window - virtual void Dismiss(); - - // can the window be dismissed now? - // - // VZ: where is this used?? - virtual bool CanDismiss() - { return true; } - - // called when a mouse is pressed while the popup is shown: return true - // from here to prevent its normal processing by the popup (which consists - // in dismissing it if the mouse is cilcked outside it) - virtual bool ProcessLeftDown(wxMouseEvent& event); - - // Overridden to grab the input on some plaforms - virtual bool Show( bool show = true ); - -protected: - // common part of all ctors - void Init(); - - // this is called when the popup is disappeared because of anything - // else but direct call to Dismiss() - virtual void OnDismiss(); - - // dismiss and notify the derived class - void DismissAndNotify(); - - // remove our event handlers - void PopHandlers(); - - // get alerted when child gets deleted from under us - void OnDestroy(wxWindowDestroyEvent& event); - -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) - // check if the mouse needs captured or released - void OnIdle(wxIdleEvent& event); -#endif - - // the child of this popup if any - wxWindow *m_child; - - // the window which has the focus while we're shown - wxWindow *m_focus; - - // these classes may call our DismissAndNotify() - friend class wxPopupWindowHandler; - friend class wxPopupFocusHandler; - - // the handlers we created, may be NULL (if not, must be deleted) - wxPopupWindowHandler *m_handlerPopup; - wxPopupFocusHandler *m_handlerFocus; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxPopupTransientWindow) - DECLARE_NO_COPY_CLASS(wxPopupTransientWindow) -}; - -#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - -// ---------------------------------------------------------------------------- -// wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxComboBox; -class WXDLLEXPORT wxComboCtrl; - -class WXDLLEXPORT wxPopupComboWindow : public wxPopupTransientWindow -{ -public: - wxPopupComboWindow() { m_combo = NULL; } - wxPopupComboWindow(wxComboCtrl *parent); - - bool Create(wxComboCtrl *parent); - - // position the window correctly relatively to the combo - void PositionNearCombo(); - -protected: - // notify the combo here - virtual void OnDismiss(); - - // forward the key presses to the combobox - void OnKeyDown(wxKeyEvent& event); - - // the parent combobox - wxComboCtrl *m_combo; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxPopupComboWindow) -}; - -#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - -#endif // wxUSE_POPUPWIN - -#endif // _WX_POPUPWIN_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/popupwin.h +// Purpose: wxPopupWindow interface declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.01.01 +// RCS-ID: $Id: popupwin.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_POPUPWIN_H_BASE_ +#define _WX_POPUPWIN_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_POPUPWIN + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxPopupWindow: a special kind of top level window used for popup menus, +// combobox popups and such. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPopupWindowBase : public wxWindow +{ +public: + wxPopupWindowBase() { } + virtual ~wxPopupWindowBase(); + + // create the popup window + // + // style may only contain border flags + bool Create(wxWindow *parent, int style = wxBORDER_NONE); + + // move the popup window to the right position, i.e. such that it is + // entirely visible + // + // the popup is positioned at ptOrigin + size if it opens below and to the + // right (default), at ptOrigin - sizePopup if it opens above and to the + // left &c + // + // the point must be given in screen coordinates! + virtual void Position(const wxPoint& ptOrigin, + const wxSize& size); + + virtual bool IsTopLevel() const { return true; } + + DECLARE_NO_COPY_CLASS(wxPopupWindowBase) +}; + + +// include the real class declaration +#if defined(__WXMSW__) + #include "wx/msw/popupwin.h" +#elif defined(__WXPM__) + #include "wx/os2/popupwin.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/popupwin.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/popupwin.h" +#elif defined(__WXX11__) + #include "wx/x11/popupwin.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/popupwin.h" +#elif defined(__WXMGL__) + #include "wx/mgl/popupwin.h" +#elif defined(__WXMAC__) + #include "wx/mac/popupwin.h" +#else + #error "wxPopupWindow is not supported under this platform." +#endif + +// ---------------------------------------------------------------------------- +// wxPopupTransientWindow: a wxPopupWindow which disappears automatically +// when the user clicks mouse outside it or if it loses focus in any other way +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; +class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; + +class WXDLLEXPORT wxPopupTransientWindow : public wxPopupWindow +{ +public: + // ctors + wxPopupTransientWindow() { Init(); } + wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); + + virtual ~wxPopupTransientWindow(); + + // popup the window (this will show it too) and keep focus at winFocus + // (or itself if it's NULL), dismiss the popup if we lose focus + virtual void Popup(wxWindow *focus = NULL); + + // hide the window + virtual void Dismiss(); + + // can the window be dismissed now? + // + // VZ: where is this used?? + virtual bool CanDismiss() + { return true; } + + // called when a mouse is pressed while the popup is shown: return true + // from here to prevent its normal processing by the popup (which consists + // in dismissing it if the mouse is cilcked outside it) + virtual bool ProcessLeftDown(wxMouseEvent& event); + + // Overridden to grab the input on some plaforms + virtual bool Show( bool show = true ); + +protected: + // common part of all ctors + void Init(); + + // this is called when the popup is disappeared because of anything + // else but direct call to Dismiss() + virtual void OnDismiss(); + + // dismiss and notify the derived class + void DismissAndNotify(); + + // remove our event handlers + void PopHandlers(); + + // get alerted when child gets deleted from under us + void OnDestroy(wxWindowDestroyEvent& event); + +#if defined( __WXMSW__ ) || defined( __WXMAC__ ) + // check if the mouse needs captured or released + void OnIdle(wxIdleEvent& event); +#endif + + // the child of this popup if any + wxWindow *m_child; + + // the window which has the focus while we're shown + wxWindow *m_focus; + + // these classes may call our DismissAndNotify() + friend class wxPopupWindowHandler; + friend class wxPopupFocusHandler; + + // the handlers we created, may be NULL (if not, must be deleted) + wxPopupWindowHandler *m_handlerPopup; + wxPopupFocusHandler *m_handlerFocus; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxPopupTransientWindow) + DECLARE_NO_COPY_CLASS(wxPopupTransientWindow) +}; + +#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) + +// ---------------------------------------------------------------------------- +// wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxComboBox; +class WXDLLEXPORT wxComboCtrl; + +class WXDLLEXPORT wxPopupComboWindow : public wxPopupTransientWindow +{ +public: + wxPopupComboWindow() { m_combo = NULL; } + wxPopupComboWindow(wxComboCtrl *parent); + + bool Create(wxComboCtrl *parent); + + // position the window correctly relatively to the combo + void PositionNearCombo(); + +protected: + // notify the combo here + virtual void OnDismiss(); + + // forward the key presses to the combobox + void OnKeyDown(wxKeyEvent& event); + + // the parent combobox + wxComboCtrl *m_combo; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxPopupComboWindow) +}; + +#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) + +#endif // wxUSE_POPUPWIN + +#endif // _WX_POPUPWIN_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/power.h b/Externals/wxWidgets/include/wx/power.h index 66492cb558..d81677e0b8 100644 --- a/Externals/wxWidgets/include/wx/power.h +++ b/Externals/wxWidgets/include/wx/power.h @@ -1,111 +1,111 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/power.h -// Purpose: functions and classes for system power management -// Author: Vadim Zeitlin -// Modified by: -// Created: 2006-05-27 -// RCS-ID: $Id: power.h 48811 2007-09-19 23:11:28Z RD $ -// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_POWER_H_ -#define _WX_POWER_H_ - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// power management constants -// ---------------------------------------------------------------------------- - -enum wxPowerType -{ - wxPOWER_SOCKET, - wxPOWER_BATTERY, - wxPOWER_UNKNOWN -}; - -enum wxBatteryState -{ - wxBATTERY_NORMAL_STATE, // system is fully usable - wxBATTERY_LOW_STATE, // start to worry - wxBATTERY_CRITICAL_STATE, // save quickly - wxBATTERY_SHUTDOWN_STATE, // too late - wxBATTERY_UNKNOWN_STATE -}; - -// ---------------------------------------------------------------------------- -// wxPowerEvent is generated when the system online status changes -// ---------------------------------------------------------------------------- - -// currently the power events are only available under Windows, to avoid -// compiling in the code for handling them which is never going to be invoked -// under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event -// is available, it should be used to guard all code using wxPowerEvent -#ifdef __WXMSW__ - -#define wxHAS_POWER_EVENTS - -class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent -{ -public: - wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) - { - m_veto = false; - } - - // Veto the operation (only makes sense with EVT_POWER_SUSPENDING) - void Veto() { m_veto = true; } - - bool IsVetoed() const { return m_veto; } - - - // default copy ctor, assignment operator and dtor are ok - - virtual wxEvent *Clone() const { return new wxPowerEvent(*this); } - -private: - bool m_veto; - -#if wxABI_VERSION >= 20806 - DECLARE_ABSTRACT_CLASS(wxPowerEvent) -#endif -}; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, 406) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, 407) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, 408) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, 444) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&); - -#define wxPowerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction) \ - wxStaticCastEvent(wxPowerEventFunction, &func) - -#define EVT_POWER_SUSPENDING(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func)) -#define EVT_POWER_SUSPENDED(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func)) -#define EVT_POWER_SUSPEND_CANCEL(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func)) -#define EVT_POWER_RESUME(func) \ - wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func)) - -#else // no support for power events - #undef wxHAS_POWER_EVENTS -#endif // support for power events/no support - -// ---------------------------------------------------------------------------- -// power management functions -// ---------------------------------------------------------------------------- - -// return the current system power state: online or offline -WXDLLIMPEXP_BASE wxPowerType wxGetPowerType(); - -// return approximate battery state -WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState(); - -#endif // _WX_POWER_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/power.h +// Purpose: functions and classes for system power management +// Author: Vadim Zeitlin +// Modified by: +// Created: 2006-05-27 +// RCS-ID: $Id: power.h 48811 2007-09-19 23:11:28Z RD $ +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_POWER_H_ +#define _WX_POWER_H_ + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// power management constants +// ---------------------------------------------------------------------------- + +enum wxPowerType +{ + wxPOWER_SOCKET, + wxPOWER_BATTERY, + wxPOWER_UNKNOWN +}; + +enum wxBatteryState +{ + wxBATTERY_NORMAL_STATE, // system is fully usable + wxBATTERY_LOW_STATE, // start to worry + wxBATTERY_CRITICAL_STATE, // save quickly + wxBATTERY_SHUTDOWN_STATE, // too late + wxBATTERY_UNKNOWN_STATE +}; + +// ---------------------------------------------------------------------------- +// wxPowerEvent is generated when the system online status changes +// ---------------------------------------------------------------------------- + +// currently the power events are only available under Windows, to avoid +// compiling in the code for handling them which is never going to be invoked +// under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event +// is available, it should be used to guard all code using wxPowerEvent +#ifdef __WXMSW__ + +#define wxHAS_POWER_EVENTS + +class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent +{ +public: + wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) + { + m_veto = false; + } + + // Veto the operation (only makes sense with EVT_POWER_SUSPENDING) + void Veto() { m_veto = true; } + + bool IsVetoed() const { return m_veto; } + + + // default copy ctor, assignment operator and dtor are ok + + virtual wxEvent *Clone() const { return new wxPowerEvent(*this); } + +private: + bool m_veto; + +#if wxABI_VERSION >= 20806 + DECLARE_ABSTRACT_CLASS(wxPowerEvent) +#endif +}; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, 406) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, 407) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, 408) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, 444) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&); + +#define wxPowerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction) \ + wxStaticCastEvent(wxPowerEventFunction, &func) + +#define EVT_POWER_SUSPENDING(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func)) +#define EVT_POWER_SUSPENDED(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func)) +#define EVT_POWER_SUSPEND_CANCEL(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func)) +#define EVT_POWER_RESUME(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func)) + +#else // no support for power events + #undef wxHAS_POWER_EVENTS +#endif // support for power events/no support + +// ---------------------------------------------------------------------------- +// power management functions +// ---------------------------------------------------------------------------- + +// return the current system power state: online or offline +WXDLLIMPEXP_BASE wxPowerType wxGetPowerType(); + +// return approximate battery state +WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState(); + +#endif // _WX_POWER_H_ diff --git a/Externals/wxWidgets/include/wx/print.h b/Externals/wxWidgets/include/wx/print.h index e4cf1e2e74..e366ee25ca 100644 --- a/Externals/wxWidgets/include/wx/print.h +++ b/Externals/wxWidgets/include/wx/print.h @@ -1,39 +1,39 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/print.h -// Purpose: Base header for printer classes -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: print.h 41240 2006-09-15 16:45:48Z PC $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINT_H_BASE_ -#define _WX_PRINT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - -#include "wx/msw/printwin.h" - -#elif defined(__WXMAC__) - -#include "wx/mac/printmac.h" - -#elif defined(__WXPM__) - -#include "wx/os2/printos2.h" - -#else - -#include "wx/generic/printps.h" - -#endif - -#endif // wxUSE_PRINTING_ARCHITECTURE -#endif - // _WX_PRINT_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/print.h +// Purpose: Base header for printer classes +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: print.h 41240 2006-09-15 16:45:48Z PC $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINT_H_BASE_ +#define _WX_PRINT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + +#include "wx/msw/printwin.h" + +#elif defined(__WXMAC__) + +#include "wx/mac/printmac.h" + +#elif defined(__WXPM__) + +#include "wx/os2/printos2.h" + +#else + +#include "wx/generic/printps.h" + +#endif + +#endif // wxUSE_PRINTING_ARCHITECTURE +#endif + // _WX_PRINT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/printdlg.h b/Externals/wxWidgets/include/wx/printdlg.h index 4c98d251de..21f57b19da 100644 --- a/Externals/wxWidgets/include/wx/printdlg.h +++ b/Externals/wxWidgets/include/wx/printdlg.h @@ -1,122 +1,122 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/printdlg.h -// Purpose: Base header and class for print dialogs -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: printdlg.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRINTDLG_H_BASE_ -#define _WX_PRINTDLG_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/event.h" -#include "wx/dialog.h" -#include "wx/intl.h" -#include "wx/cmndata.h" - - -// --------------------------------------------------------------------------- -// wxPrintDialogBase: interface for the dialog for printing -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintDialogBase : public wxDialog -{ -public: - wxPrintDialogBase() { } - wxPrintDialogBase(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = wxEmptyString, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - - virtual wxPrintDialogData& GetPrintDialogData() = 0; - virtual wxPrintData& GetPrintData() = 0; - virtual wxDC *GetPrintDC() = 0; - -private: - DECLARE_ABSTRACT_CLASS(wxPrintDialogBase) - DECLARE_NO_COPY_CLASS(wxPrintDialogBase) -}; - -// --------------------------------------------------------------------------- -// wxPrintDialog: the dialog for printing. -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintDialog : public wxObject -{ -public: - wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); - wxPrintDialog(wxWindow *parent, wxPrintData* data); - virtual ~wxPrintDialog(); - - virtual int ShowModal(); - - virtual wxPrintDialogData& GetPrintDialogData(); - virtual wxPrintData& GetPrintData(); - virtual wxDC *GetPrintDC(); - -private: - wxPrintDialogBase *m_pimpl; - -private: - DECLARE_DYNAMIC_CLASS(wxPrintDialog) - DECLARE_NO_COPY_CLASS(wxPrintDialog) -}; - -// --------------------------------------------------------------------------- -// wxPageSetupDialogBase: interface for the page setup dialog -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPageSetupDialogBase: public wxDialog -{ -public: - wxPageSetupDialogBase() { } - wxPageSetupDialogBase(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = wxEmptyString, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - - virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0; - -private: - DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase) - DECLARE_NO_COPY_CLASS(wxPageSetupDialogBase) -}; - -// --------------------------------------------------------------------------- -// wxPageSetupDialog: the page setup dialog -// --------------------------------------------------------------------------- - -class WXDLLEXPORT wxPageSetupDialog: public wxObject -{ -public: - wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); - virtual ~wxPageSetupDialog(); - - int ShowModal(); - wxPageSetupDialogData& GetPageSetupDialogData(); - // old name - wxPageSetupDialogData& GetPageSetupData(); - -private: - wxPageSetupDialogBase *m_pimpl; - -private: - DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) - DECLARE_NO_COPY_CLASS(wxPageSetupDialog) -}; - -#endif - -#endif - // _WX_PRINTDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/printdlg.h +// Purpose: Base header and class for print dialogs +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: printdlg.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_BASE_ +#define _WX_PRINTDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/event.h" +#include "wx/dialog.h" +#include "wx/intl.h" +#include "wx/cmndata.h" + + +// --------------------------------------------------------------------------- +// wxPrintDialogBase: interface for the dialog for printing +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintDialogBase : public wxDialog +{ +public: + wxPrintDialogBase() { } + wxPrintDialogBase(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString &title = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + + virtual wxPrintDialogData& GetPrintDialogData() = 0; + virtual wxPrintData& GetPrintData() = 0; + virtual wxDC *GetPrintDC() = 0; + +private: + DECLARE_ABSTRACT_CLASS(wxPrintDialogBase) + DECLARE_NO_COPY_CLASS(wxPrintDialogBase) +}; + +// --------------------------------------------------------------------------- +// wxPrintDialog: the dialog for printing. +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintDialog : public wxObject +{ +public: + wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxPrintDialog(); + + virtual int ShowModal(); + + virtual wxPrintDialogData& GetPrintDialogData(); + virtual wxPrintData& GetPrintData(); + virtual wxDC *GetPrintDC(); + +private: + wxPrintDialogBase *m_pimpl; + +private: + DECLARE_DYNAMIC_CLASS(wxPrintDialog) + DECLARE_NO_COPY_CLASS(wxPrintDialog) +}; + +// --------------------------------------------------------------------------- +// wxPageSetupDialogBase: interface for the page setup dialog +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPageSetupDialogBase: public wxDialog +{ +public: + wxPageSetupDialogBase() { } + wxPageSetupDialogBase(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString &title = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + + virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0; + +private: + DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase) + DECLARE_NO_COPY_CLASS(wxPageSetupDialogBase) +}; + +// --------------------------------------------------------------------------- +// wxPageSetupDialog: the page setup dialog +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPageSetupDialog: public wxObject +{ +public: + wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual ~wxPageSetupDialog(); + + int ShowModal(); + wxPageSetupDialogData& GetPageSetupDialogData(); + // old name + wxPageSetupDialogData& GetPageSetupData(); + +private: + wxPageSetupDialogBase *m_pimpl; + +private: + DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) + DECLARE_NO_COPY_CLASS(wxPageSetupDialog) +}; + +#endif + +#endif + // _WX_PRINTDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/private/fileback.h b/Externals/wxWidgets/include/wx/private/fileback.h index 5b2a86842f..534a0f31b1 100644 --- a/Externals/wxWidgets/include/wx/private/fileback.h +++ b/Externals/wxWidgets/include/wx/private/fileback.h @@ -1,83 +1,83 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/private/fileback.h -// Purpose: Back an input stream with memory or a file -// Author: Mike Wetherell -// RCS-ID: $Id: fileback.h 42651 2006-10-29 20:06:45Z MW $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FILEBACK_H__ -#define _WX_FILEBACK_H__ - -#include "wx/defs.h" - -#if wxUSE_FILESYSTEM - -#include "wx/stream.h" - -// ---------------------------------------------------------------------------- -// Backs an input stream with memory or a file to make it seekable. -// -// One or more wxBackedInputStreams can be used to read it's data. The data is -// reference counted, so stays alive until the last wxBackingFile or -// wxBackedInputStream using it is destroyed. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBackingFile -{ -public: - enum { DefaultBufSize = 16384 }; - - // Takes ownership of stream. If the stream is smaller than bufsize, the - // backing file is never created and the backing is done with memory. - wxBackingFile(wxInputStream *stream, - size_t bufsize = DefaultBufSize, - const wxString& prefix = _T("wxbf")); - - wxBackingFile() : m_impl(NULL) { } - ~wxBackingFile(); - - wxBackingFile(const wxBackingFile& backer); - wxBackingFile& operator=(const wxBackingFile& backer); - - operator bool() const { return m_impl != NULL; } - -private: - class wxBackingFileImpl *m_impl; - friend class wxBackedInputStream; -}; - -// ---------------------------------------------------------------------------- -// An input stream to read from a wxBackingFile. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBackedInputStream : public wxInputStream -{ -public: - wxBackedInputStream(const wxBackingFile& backer); - - // If the length of the backer's parent stream is unknown then GetLength() - // returns wxInvalidOffset until the parent has been read to the end. - wxFileOffset GetLength() const; - - // Returns the length, reading the parent stream to the end if necessary. - wxFileOffset FindLength() const; - - bool IsSeekable() const { return true; } - -protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -private: - wxBackingFile m_backer; - wxFileOffset m_pos; - - DECLARE_NO_COPY_CLASS(wxBackedInputStream) -}; - -#endif // wxUSE_FILESYSTEM - -#endif // _WX_FILEBACK_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/private/fileback.h +// Purpose: Back an input stream with memory or a file +// Author: Mike Wetherell +// RCS-ID: $Id: fileback.h 42651 2006-10-29 20:06:45Z MW $ +// Copyright: (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEBACK_H__ +#define _WX_FILEBACK_H__ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/stream.h" + +// ---------------------------------------------------------------------------- +// Backs an input stream with memory or a file to make it seekable. +// +// One or more wxBackedInputStreams can be used to read it's data. The data is +// reference counted, so stays alive until the last wxBackingFile or +// wxBackedInputStream using it is destroyed. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBackingFile +{ +public: + enum { DefaultBufSize = 16384 }; + + // Takes ownership of stream. If the stream is smaller than bufsize, the + // backing file is never created and the backing is done with memory. + wxBackingFile(wxInputStream *stream, + size_t bufsize = DefaultBufSize, + const wxString& prefix = _T("wxbf")); + + wxBackingFile() : m_impl(NULL) { } + ~wxBackingFile(); + + wxBackingFile(const wxBackingFile& backer); + wxBackingFile& operator=(const wxBackingFile& backer); + + operator bool() const { return m_impl != NULL; } + +private: + class wxBackingFileImpl *m_impl; + friend class wxBackedInputStream; +}; + +// ---------------------------------------------------------------------------- +// An input stream to read from a wxBackingFile. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBackedInputStream : public wxInputStream +{ +public: + wxBackedInputStream(const wxBackingFile& backer); + + // If the length of the backer's parent stream is unknown then GetLength() + // returns wxInvalidOffset until the parent has been read to the end. + wxFileOffset GetLength() const; + + // Returns the length, reading the parent stream to the end if necessary. + wxFileOffset FindLength() const; + + bool IsSeekable() const { return true; } + +protected: + size_t OnSysRead(void *buffer, size_t size); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + +private: + wxBackingFile m_backer; + wxFileOffset m_pos; + + DECLARE_NO_COPY_CLASS(wxBackedInputStream) +}; + +#endif // wxUSE_FILESYSTEM + +#endif // _WX_FILEBACK_H__ diff --git a/Externals/wxWidgets/include/wx/private/filename.h b/Externals/wxWidgets/include/wx/private/filename.h index f25e33c8b6..e6c754b6e5 100644 --- a/Externals/wxWidgets/include/wx/private/filename.h +++ b/Externals/wxWidgets/include/wx/private/filename.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/private/filename.h -// Purpose: Internal declarations for src/common/filename.cpp -// Author: Mike Wetherell -// Modified by: -// Created: 2006-10-22 -// RCS-ID: $Id: filename.h 42277 2006-10-23 13:10:12Z MW $ -// Copyright: (c) 2006 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_FILENAME_H_ -#define _WX_PRIVATE_FILENAME_H_ - -#include "wx/file.h" -#include "wx/ffile.h" - -// Self deleting temp files aren't supported on all platforms. Therefore -// rather than let these be in the API, they can be used internally to -// implement classes (e.g. wxTempFileStream), that will do the clean up when -// the OS doesn't support it. - -// Same usage as wxFileName::CreateTempFileName() with the extra parameter -// deleteOnClose. *deleteOnClose true on entry requests a file created with a -// delete on close flag, on exit the value of *deleteOnClose indicates whether -// available. - -#if wxUSE_FILE -wxString wxCreateTempFileName(const wxString& prefix, - wxFile *fileTemp, - bool *deleteOnClose = NULL); -#endif - -#if wxUSE_FFILE -wxString wxCreateTempFileName(const wxString& prefix, - wxFFile *fileTemp, - bool *deleteOnClose = NULL); -#endif - -// Returns an open temp file, if possible either an unlinked open file or one -// that will delete on close. Only returns the filename if neither was -// possible, so that the caller can delete the file when done. - -#if wxUSE_FILE -bool wxCreateTempFile(const wxString& prefix, - wxFile *fileTemp, - wxString *name); -#endif - -#if wxUSE_FFILE -bool wxCreateTempFile(const wxString& prefix, - wxFFile *fileTemp, - wxString *name); -#endif - -#endif // _WX_PRIVATE_FILENAME_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/private/filename.h +// Purpose: Internal declarations for src/common/filename.cpp +// Author: Mike Wetherell +// Modified by: +// Created: 2006-10-22 +// RCS-ID: $Id: filename.h 42277 2006-10-23 13:10:12Z MW $ +// Copyright: (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FILENAME_H_ +#define _WX_PRIVATE_FILENAME_H_ + +#include "wx/file.h" +#include "wx/ffile.h" + +// Self deleting temp files aren't supported on all platforms. Therefore +// rather than let these be in the API, they can be used internally to +// implement classes (e.g. wxTempFileStream), that will do the clean up when +// the OS doesn't support it. + +// Same usage as wxFileName::CreateTempFileName() with the extra parameter +// deleteOnClose. *deleteOnClose true on entry requests a file created with a +// delete on close flag, on exit the value of *deleteOnClose indicates whether +// available. + +#if wxUSE_FILE +wxString wxCreateTempFileName(const wxString& prefix, + wxFile *fileTemp, + bool *deleteOnClose = NULL); +#endif + +#if wxUSE_FFILE +wxString wxCreateTempFileName(const wxString& prefix, + wxFFile *fileTemp, + bool *deleteOnClose = NULL); +#endif + +// Returns an open temp file, if possible either an unlinked open file or one +// that will delete on close. Only returns the filename if neither was +// possible, so that the caller can delete the file when done. + +#if wxUSE_FILE +bool wxCreateTempFile(const wxString& prefix, + wxFile *fileTemp, + wxString *name); +#endif + +#if wxUSE_FFILE +bool wxCreateTempFile(const wxString& prefix, + wxFFile *fileTemp, + wxString *name); +#endif + +#endif // _WX_PRIVATE_FILENAME_H_ diff --git a/Externals/wxWidgets/include/wx/private/fontmgr.h b/Externals/wxWidgets/include/wx/private/fontmgr.h index 70a42780d6..88904a4020 100644 --- a/Externals/wxWidgets/include/wx/private/fontmgr.h +++ b/Externals/wxWidgets/include/wx/private/fontmgr.h @@ -1,255 +1,255 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/fontmgr.h -// Purpose: font management for ports that don't have their own -// Author: Vaclav Slavik -// Created: 2006-11-18 -// RCS-ID: $Id: fontmgr.h 43855 2006-12-07 08:57:44Z PC $ -// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) -// (c) 2006 REA Elektronik GmbH -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_FONTMGR_H_ -#define _WX_PRIVATE_FONTMGR_H_ - -#include "wx/list.h" -#include "wx/fontutil.h" - -class wxFontsManager; -class wxFontInstance; -class wxFontInstanceList; -class wxFontFace; -class wxFontBundle; -class wxFontBundleHash; -class wxFontMgrFontRefData; - -WX_DECLARE_LIST(wxFontBundle, wxFontBundleList); - -/** - This class represents single font face with set parameters (point size, - antialiasing). - */ -class wxFontInstanceBase -{ -protected: - wxFontInstanceBase(float ptSize, bool aa) : m_ptSize(ptSize), m_aa(aa) {} - virtual ~wxFontInstanceBase() {} - -public: - float GetPointSize() const { return m_ptSize; } - bool IsAntiAliased() const { return m_aa; } - -protected: - float m_ptSize; - bool m_aa; -}; - - -/// This class represents loaded font face (bundle+weight+italics). -class wxFontFaceBase -{ -protected: - /// Ctor. Creates object with reference count = 0, Acquire() must be - /// called after the object is created. - wxFontFaceBase(); - virtual ~wxFontFaceBase(); - -public: - /// Increases reference count of the face - virtual void Acquire(); - - /** - Decreases reference count of the face. Call this when you no longer - use the object returned by wxFontBundle. Note that this doesn't destroy - the object, but only optionally shuts it down, so it's possible to - call Acquire() and Release() more than once. - */ - virtual void Release(); - - /** - Returns instance of the font at given size. - - @param ptSize point size of the font to create; note that this is - a float and not integer, it should be wxFont's point - size multipled by wxDC's scale factor - @param aa should the font be antialiased? - */ - virtual wxFontInstance *GetFontInstance(float ptSize, bool aa); - -protected: - /// Called to create a new instance of the font by GetFontInstance() if - /// it wasn't found it cache. - virtual wxFontInstance *CreateFontInstance(float ptSize, bool aa) = 0; - -protected: - unsigned m_refCnt; - wxFontInstanceList *m_instances; -}; - -/** - This class represents font bundle. Font bundle is set of faces that have - the same name, but differ in weight and italics. - */ -class wxFontBundleBase -{ -public: - wxFontBundleBase(); - virtual ~wxFontBundleBase(); - - /// Returns name of the bundle - virtual wxString GetName() const = 0; - - /// Returns true if the font is fixe-width - virtual bool IsFixed() const = 0; - - /// Type of faces in the bundle - enum FaceType - { - // NB: values of these constants are set so that it's possible to - // make OR-combinations of them and still get valid enum element - FaceType_Regular = 0, - FaceType_Italic = 1, - FaceType_Bold = 2, - FaceType_BoldItalic = FaceType_Italic | FaceType_Bold, - - FaceType_Max - }; - - /// Returns true if the given face is available - bool HasFace(FaceType type) const { return m_faces[type] != NULL; } - - /** - Returns font face object that can be used to render font of given type. - - Note that this method can only be called if HasFace(type) returns true. - - Acquire() was called on the returned object, you must call Release() - when you stop using it. - */ - wxFontFace *GetFace(FaceType type) const; - - /** - Returns font face object that can be used to render given font. - - Acquire() was called on the returned object, you must call Release() - when you stop using it. - */ - wxFontFace *GetFaceForFont(const wxFontMgrFontRefData& font) const; - -protected: - wxFontFace *m_faces[FaceType_Max]; -}; - - -/** - Base class for wxFontsManager class, which manages the list of all - available fonts and their loaded instances. - */ -class wxFontsManagerBase -{ -protected: - wxFontsManagerBase(); - virtual ~wxFontsManagerBase(); - -public: - /// Returns the font manager singleton, creating it if it doesn't exist - static wxFontsManager *Get(); - - /// Called by wxApp to shut down the manager - static void CleanUp(); - - /// Returns list of all available font bundles - const wxFontBundleList& GetBundles() const { return *m_list; } - - /** - Returns object representing font bundle with the given name. - - The returned object is owned by wxFontsManager, you must not delete it. - */ - wxFontBundle *GetBundle(const wxString& name) const; - - /** - Returns object representing font bundle that can be used to render - given font. - - The returned object is owned by wxFontsManager, you must not delete it. - */ - wxFontBundle *GetBundleForFont(const wxFontMgrFontRefData& font) const; - - /// This method must be called by derived - void AddBundle(wxFontBundle *bundle); - - /// Returns default facename for given wxFont family - virtual wxString GetDefaultFacename(wxFontFamily family) const = 0; - -private: - wxFontBundleHash *m_hash; - wxFontBundleList *m_list; - -protected: - static wxFontsManager *ms_instance; -}; - - - -#if defined(__WXMGL__) - #include "wx/mgl/private/fontmgr.h" -#elif defined(__WXDFB__) - #include "wx/dfb/private/fontmgr.h" -#endif - - - -/// wxFontMgrFontRefData implementation using wxFontsManager classes -class wxFontMgrFontRefData : public wxObjectRefData -{ -public: - wxFontMgrFontRefData(int size = wxDEFAULT, - int family = wxDEFAULT, - int style = wxDEFAULT, - int weight = wxDEFAULT, - bool underlined = false, - const wxString& faceName = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - wxFontMgrFontRefData(const wxFontMgrFontRefData& data); - ~wxFontMgrFontRefData(); - - wxFontBundle *GetFontBundle() const; - wxFontInstance *GetFontInstance(float scale, bool antialiased) const; - - bool IsFixedWidth() const { return GetFontBundle()->IsFixed(); } - - const wxNativeFontInfo *GetNativeFontInfo() const { return &m_info; } - - int GetPointSize() const { return m_info.pointSize; } - wxString GetFaceName() const { return m_info.faceName; } - int GetFamily() const { return m_info.family; } - int GetStyle() const { return m_info.style; } - int GetWeight() const { return m_info.weight; } - bool GetUnderlined() const { return m_info.underlined; } - wxFontEncoding GetEncoding() const { return m_info.encoding; } - - void SetPointSize(int pointSize); - void SetFamily(int family); - void SetStyle(int style); - void SetWeight(int weight); - void SetFaceName(const wxString& faceName); - void SetUnderlined(bool underlined); - void SetEncoding(wxFontEncoding encoding); - - // Unofficial API, don't use - void SetNoAntiAliasing(bool no); - bool GetNoAntiAliasing() const { return m_noAA; } - -private: - void EnsureValidFont(); - - wxNativeFontInfo m_info; - bool m_noAA; - - wxFontFace *m_fontFace; - wxFontBundle *m_fontBundle; - bool m_fontValid; -}; - -#endif // _WX_PRIVATE_FONTMGR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fontmgr.h +// Purpose: font management for ports that don't have their own +// Author: Vaclav Slavik +// Created: 2006-11-18 +// RCS-ID: $Id: fontmgr.h 43855 2006-12-07 08:57:44Z PC $ +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) +// (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FONTMGR_H_ +#define _WX_PRIVATE_FONTMGR_H_ + +#include "wx/list.h" +#include "wx/fontutil.h" + +class wxFontsManager; +class wxFontInstance; +class wxFontInstanceList; +class wxFontFace; +class wxFontBundle; +class wxFontBundleHash; +class wxFontMgrFontRefData; + +WX_DECLARE_LIST(wxFontBundle, wxFontBundleList); + +/** + This class represents single font face with set parameters (point size, + antialiasing). + */ +class wxFontInstanceBase +{ +protected: + wxFontInstanceBase(float ptSize, bool aa) : m_ptSize(ptSize), m_aa(aa) {} + virtual ~wxFontInstanceBase() {} + +public: + float GetPointSize() const { return m_ptSize; } + bool IsAntiAliased() const { return m_aa; } + +protected: + float m_ptSize; + bool m_aa; +}; + + +/// This class represents loaded font face (bundle+weight+italics). +class wxFontFaceBase +{ +protected: + /// Ctor. Creates object with reference count = 0, Acquire() must be + /// called after the object is created. + wxFontFaceBase(); + virtual ~wxFontFaceBase(); + +public: + /// Increases reference count of the face + virtual void Acquire(); + + /** + Decreases reference count of the face. Call this when you no longer + use the object returned by wxFontBundle. Note that this doesn't destroy + the object, but only optionally shuts it down, so it's possible to + call Acquire() and Release() more than once. + */ + virtual void Release(); + + /** + Returns instance of the font at given size. + + @param ptSize point size of the font to create; note that this is + a float and not integer, it should be wxFont's point + size multipled by wxDC's scale factor + @param aa should the font be antialiased? + */ + virtual wxFontInstance *GetFontInstance(float ptSize, bool aa); + +protected: + /// Called to create a new instance of the font by GetFontInstance() if + /// it wasn't found it cache. + virtual wxFontInstance *CreateFontInstance(float ptSize, bool aa) = 0; + +protected: + unsigned m_refCnt; + wxFontInstanceList *m_instances; +}; + +/** + This class represents font bundle. Font bundle is set of faces that have + the same name, but differ in weight and italics. + */ +class wxFontBundleBase +{ +public: + wxFontBundleBase(); + virtual ~wxFontBundleBase(); + + /// Returns name of the bundle + virtual wxString GetName() const = 0; + + /// Returns true if the font is fixe-width + virtual bool IsFixed() const = 0; + + /// Type of faces in the bundle + enum FaceType + { + // NB: values of these constants are set so that it's possible to + // make OR-combinations of them and still get valid enum element + FaceType_Regular = 0, + FaceType_Italic = 1, + FaceType_Bold = 2, + FaceType_BoldItalic = FaceType_Italic | FaceType_Bold, + + FaceType_Max + }; + + /// Returns true if the given face is available + bool HasFace(FaceType type) const { return m_faces[type] != NULL; } + + /** + Returns font face object that can be used to render font of given type. + + Note that this method can only be called if HasFace(type) returns true. + + Acquire() was called on the returned object, you must call Release() + when you stop using it. + */ + wxFontFace *GetFace(FaceType type) const; + + /** + Returns font face object that can be used to render given font. + + Acquire() was called on the returned object, you must call Release() + when you stop using it. + */ + wxFontFace *GetFaceForFont(const wxFontMgrFontRefData& font) const; + +protected: + wxFontFace *m_faces[FaceType_Max]; +}; + + +/** + Base class for wxFontsManager class, which manages the list of all + available fonts and their loaded instances. + */ +class wxFontsManagerBase +{ +protected: + wxFontsManagerBase(); + virtual ~wxFontsManagerBase(); + +public: + /// Returns the font manager singleton, creating it if it doesn't exist + static wxFontsManager *Get(); + + /// Called by wxApp to shut down the manager + static void CleanUp(); + + /// Returns list of all available font bundles + const wxFontBundleList& GetBundles() const { return *m_list; } + + /** + Returns object representing font bundle with the given name. + + The returned object is owned by wxFontsManager, you must not delete it. + */ + wxFontBundle *GetBundle(const wxString& name) const; + + /** + Returns object representing font bundle that can be used to render + given font. + + The returned object is owned by wxFontsManager, you must not delete it. + */ + wxFontBundle *GetBundleForFont(const wxFontMgrFontRefData& font) const; + + /// This method must be called by derived + void AddBundle(wxFontBundle *bundle); + + /// Returns default facename for given wxFont family + virtual wxString GetDefaultFacename(wxFontFamily family) const = 0; + +private: + wxFontBundleHash *m_hash; + wxFontBundleList *m_list; + +protected: + static wxFontsManager *ms_instance; +}; + + + +#if defined(__WXMGL__) + #include "wx/mgl/private/fontmgr.h" +#elif defined(__WXDFB__) + #include "wx/dfb/private/fontmgr.h" +#endif + + + +/// wxFontMgrFontRefData implementation using wxFontsManager classes +class wxFontMgrFontRefData : public wxObjectRefData +{ +public: + wxFontMgrFontRefData(int size = wxDEFAULT, + int family = wxDEFAULT, + int style = wxDEFAULT, + int weight = wxDEFAULT, + bool underlined = false, + const wxString& faceName = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + wxFontMgrFontRefData(const wxFontMgrFontRefData& data); + ~wxFontMgrFontRefData(); + + wxFontBundle *GetFontBundle() const; + wxFontInstance *GetFontInstance(float scale, bool antialiased) const; + + bool IsFixedWidth() const { return GetFontBundle()->IsFixed(); } + + const wxNativeFontInfo *GetNativeFontInfo() const { return &m_info; } + + int GetPointSize() const { return m_info.pointSize; } + wxString GetFaceName() const { return m_info.faceName; } + int GetFamily() const { return m_info.family; } + int GetStyle() const { return m_info.style; } + int GetWeight() const { return m_info.weight; } + bool GetUnderlined() const { return m_info.underlined; } + wxFontEncoding GetEncoding() const { return m_info.encoding; } + + void SetPointSize(int pointSize); + void SetFamily(int family); + void SetStyle(int style); + void SetWeight(int weight); + void SetFaceName(const wxString& faceName); + void SetUnderlined(bool underlined); + void SetEncoding(wxFontEncoding encoding); + + // Unofficial API, don't use + void SetNoAntiAliasing(bool no); + bool GetNoAntiAliasing() const { return m_noAA; } + +private: + void EnsureValidFont(); + + wxNativeFontInfo m_info; + bool m_noAA; + + wxFontFace *m_fontFace; + wxFontBundle *m_fontBundle; + bool m_fontValid; +}; + +#endif // _WX_PRIVATE_FONTMGR_H_ diff --git a/Externals/wxWidgets/include/wx/private/overlay.h b/Externals/wxWidgets/include/wx/private/overlay.h index 9203503ce2..a3f95e201c 100644 --- a/Externals/wxWidgets/include/wx/private/overlay.h +++ b/Externals/wxWidgets/include/wx/private/overlay.h @@ -1,72 +1,72 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/overlay.h -// Purpose: wxOverlayImpl declaration -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_OVERLAY_H_ -#define _WX_PRIVATE_OVERLAY_H_ - -#include "wx/overlay.h" - -#ifdef wxHAS_NATIVE_OVERLAY - -#if defined(__WXMAC__) - #include "wx/mac/carbon/private/overlay.h" -#elif defined(__WXDFB__) - #include "wx/dfb/private/overlay.h" -#else - #error "unknown native wxOverlay implementation" -#endif - -#else // !wxHAS_NATIVE_OVERLAY - -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// generic implementation of wxOverlay -class wxOverlayImpl -{ -public: - wxOverlayImpl(); - ~wxOverlayImpl(); - - - // clears the overlay without restoring the former state - // to be done eg when the window content has been changed and repainted - void Reset(); - - // returns true if it has been setup - bool IsOk(); - - void Init(wxWindowDC* dc, int x , int y , int width , int height); - - void BeginDrawing(wxWindowDC* dc); - - void EndDrawing(wxWindowDC* dc); - - void Clear(wxWindowDC* dc); - -private: - wxBitmap m_bmpSaved ; - int m_x ; - int m_y ; - int m_width ; - int m_height ; -// this is to enable wxMOTIF and UNIV to compile.... -// currently (10 oct 06) we don't use m_window -// ce - how do we fix this -#if defined(__WXGTK__) || defined(__WXMSW__) - wxWindow* m_window ; -#endif -} ; - -#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY - -#endif // _WX_PRIVATE_OVERLAY_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/overlay.h +// Purpose: wxOverlayImpl declaration +// Author: Stefan Csomor +// Modified by: +// Created: 2006-10-20 +// RCS-ID: $Id: overlay.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_OVERLAY_H_ +#define _WX_PRIVATE_OVERLAY_H_ + +#include "wx/overlay.h" + +#ifdef wxHAS_NATIVE_OVERLAY + +#if defined(__WXMAC__) + #include "wx/mac/carbon/private/overlay.h" +#elif defined(__WXDFB__) + #include "wx/dfb/private/overlay.h" +#else + #error "unknown native wxOverlay implementation" +#endif + +#else // !wxHAS_NATIVE_OVERLAY + +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// generic implementation of wxOverlay +class wxOverlayImpl +{ +public: + wxOverlayImpl(); + ~wxOverlayImpl(); + + + // clears the overlay without restoring the former state + // to be done eg when the window content has been changed and repainted + void Reset(); + + // returns true if it has been setup + bool IsOk(); + + void Init(wxWindowDC* dc, int x , int y , int width , int height); + + void BeginDrawing(wxWindowDC* dc); + + void EndDrawing(wxWindowDC* dc); + + void Clear(wxWindowDC* dc); + +private: + wxBitmap m_bmpSaved ; + int m_x ; + int m_y ; + int m_width ; + int m_height ; +// this is to enable wxMOTIF and UNIV to compile.... +// currently (10 oct 06) we don't use m_window +// ce - how do we fix this +#if defined(__WXGTK__) || defined(__WXMSW__) + wxWindow* m_window ; +#endif +} ; + +#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY + +#endif // _WX_PRIVATE_OVERLAY_H_ diff --git a/Externals/wxWidgets/include/wx/private/socketevtdispatch.h b/Externals/wxWidgets/include/wx/private/socketevtdispatch.h index 8d83f120af..553c78231a 100644 --- a/Externals/wxWidgets/include/wx/private/socketevtdispatch.h +++ b/Externals/wxWidgets/include/wx/private/socketevtdispatch.h @@ -1,67 +1,67 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/private/socketevtdispatch.h -// Purpose: wxSocketEventDispatcher class -// Authors: Angel Vidal -// Modified by: -// Created: August 2006 -// Copyright: (c) Angel Vidal -// RCS-ID: $Id: socketevtdispatch.h 43976 2006-12-14 14:13:57Z VS $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_SOCKETEVTDISPATCH_H_ -#define _WX_PRIVATE_SOCKETEVTDISPATCH_H_ - -#include "wx/defs.h" - -#if wxUSE_SOCKETS - -#include "wx/hash.h" - -// forward declarations -class wxSocketEventDispatcherEntry; -class GSocket; - -enum wxSocketEventDispatcherType -{ - wxSocketEventDispatcherInput, - wxSocketEventDispatcherOutput -}; - -class WXDLLIMPEXP_CORE wxSocketEventDispatcher : public wxHashTable -{ -protected: - wxSocketEventDispatcher() : wxHashTable(wxKEY_INTEGER) {} - -public: - // returns instance of the table - static wxSocketEventDispatcher& Get(); - - virtual ~wxSocketEventDispatcher() - { - WX_CLEAR_HASH_TABLE(*this) - } - - void RegisterCallback(int fd, wxSocketEventDispatcherType socketType, - GSocket* socket); - - void UnregisterCallback(int fd, wxSocketEventDispatcherType socketType); - - void RunLoop(int timeout = 0); - -private: - void AddEvents(fd_set* readset, fd_set* writeset); - - int FillSets(fd_set* readset, fd_set* writeset); - - wxSocketEventDispatcherEntry* FindEntry(int fd); - -private: - static wxSocketEventDispatcher *ms_instance; - - friend class wxSocketEventDispatcherModule; -}; - -#endif // wxUSE_SOCKETS - -#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/socketevtdispatch.h +// Purpose: wxSocketEventDispatcher class +// Authors: Angel Vidal +// Modified by: +// Created: August 2006 +// Copyright: (c) Angel Vidal +// RCS-ID: $Id: socketevtdispatch.h 43976 2006-12-14 14:13:57Z VS $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_SOCKETEVTDISPATCH_H_ +#define _WX_PRIVATE_SOCKETEVTDISPATCH_H_ + +#include "wx/defs.h" + +#if wxUSE_SOCKETS + +#include "wx/hash.h" + +// forward declarations +class wxSocketEventDispatcherEntry; +class GSocket; + +enum wxSocketEventDispatcherType +{ + wxSocketEventDispatcherInput, + wxSocketEventDispatcherOutput +}; + +class WXDLLIMPEXP_CORE wxSocketEventDispatcher : public wxHashTable +{ +protected: + wxSocketEventDispatcher() : wxHashTable(wxKEY_INTEGER) {} + +public: + // returns instance of the table + static wxSocketEventDispatcher& Get(); + + virtual ~wxSocketEventDispatcher() + { + WX_CLEAR_HASH_TABLE(*this) + } + + void RegisterCallback(int fd, wxSocketEventDispatcherType socketType, + GSocket* socket); + + void UnregisterCallback(int fd, wxSocketEventDispatcherType socketType); + + void RunLoop(int timeout = 0); + +private: + void AddEvents(fd_set* readset, fd_set* writeset); + + int FillSets(fd_set* readset, fd_set* writeset); + + wxSocketEventDispatcherEntry* FindEntry(int fd); + +private: + static wxSocketEventDispatcher *ms_instance; + + friend class wxSocketEventDispatcherModule; +}; + +#endif // wxUSE_SOCKETS + +#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ diff --git a/Externals/wxWidgets/include/wx/prntbase.h b/Externals/wxWidgets/include/wx/prntbase.h index 9f8809e76f..b915915472 100644 --- a/Externals/wxWidgets/include/wx/prntbase.h +++ b/Externals/wxWidgets/include/wx/prntbase.h @@ -1,661 +1,661 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/prntbase.h -// Purpose: Base classes for printing framework -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: prntbase.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRNTBASEH__ -#define _WX_PRNTBASEH__ - -#include "wx/defs.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/event.h" -#include "wx/cmndata.h" -#include "wx/panel.h" -#include "wx/scrolwin.h" -#include "wx/dialog.h" -#include "wx/frame.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxChoice; -class WXDLLIMPEXP_FWD_CORE wxPrintout; -class WXDLLIMPEXP_FWD_CORE wxPrinterBase; -class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase; -class WXDLLIMPEXP_FWD_CORE wxPrintDialog; -class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase; -class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog; -class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase; -class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas; -class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar; -class WXDLLIMPEXP_FWD_CORE wxPreviewFrame; -class WXDLLIMPEXP_FWD_CORE wxPrintFactory; -class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; - -//---------------------------------------------------------------------------- -// error consts -//---------------------------------------------------------------------------- - -enum wxPrinterError -{ - wxPRINTER_NO_ERROR = 0, - wxPRINTER_CANCELLED, - wxPRINTER_ERROR -}; - -//---------------------------------------------------------------------------- -// wxPrintFactory -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintFactory -{ -public: - wxPrintFactory() {} - virtual ~wxPrintFactory() {} - - virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0; - - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ) = 0; - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout, - wxPrintData *data ) = 0; - - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ) = 0; - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintData *data ) = 0; - - virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ) = 0; - - virtual wxDC* CreatePrinterDC( const wxPrintData& data ) = 0; - - // What to do and what to show in the wxPrintDialog - // a) Use the generic print setup dialog or a native one? - virtual bool HasPrintSetupDialog() = 0; - virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0; - // b) Provide the "print to file" option ourselves or via print setup? - virtual bool HasOwnPrintToFile() = 0; - // c) Show current printer - virtual bool HasPrinterLine() = 0; - virtual wxString CreatePrinterLine() = 0; - // d) Show Status line for current printer? - virtual bool HasStatusLine() = 0; - virtual wxString CreateStatusLine() = 0; - - - virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0; - - static void SetPrintFactory( wxPrintFactory *factory ); - static wxPrintFactory *GetFactory(); -private: - static wxPrintFactory *m_factory; -}; - -class WXDLLEXPORT wxNativePrintFactory: public wxPrintFactory -{ -public: - virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); - - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ); - virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout, - wxPrintData *data ); - - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ); - virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintData *data ); - - virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ); - - virtual wxDC* CreatePrinterDC( const wxPrintData& data ); - - virtual bool HasPrintSetupDialog(); - virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); - virtual bool HasOwnPrintToFile(); - virtual bool HasPrinterLine(); - virtual wxString CreatePrinterLine(); - virtual bool HasStatusLine(); - virtual wxString CreateStatusLine(); - - virtual wxPrintNativeDataBase *CreatePrintNativeData(); -}; - -//---------------------------------------------------------------------------- -// wxPrintNativeDataBase -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintNativeDataBase: public wxObject -{ -public: - wxPrintNativeDataBase(); - virtual ~wxPrintNativeDataBase() {} - - virtual bool TransferTo( wxPrintData &data ) = 0; - virtual bool TransferFrom( const wxPrintData &data ) = 0; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const = 0; - - int m_ref; - -private: - DECLARE_CLASS(wxPrintNativeDataBase) - DECLARE_NO_COPY_CLASS(wxPrintNativeDataBase) -}; - -//---------------------------------------------------------------------------- -// wxPrinterBase -//---------------------------------------------------------------------------- - -/* - * Represents the printer: manages printing a wxPrintout object - */ - -class WXDLLEXPORT wxPrinterBase: public wxObject -{ -public: - wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL); - virtual ~wxPrinterBase(); - - virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); - virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); - - virtual wxPrintDialogData& GetPrintDialogData() const; - bool GetAbort() const { return sm_abortIt; } - - static wxPrinterError GetLastError() { return sm_lastError; } - - /////////////////////////////////////////////////////////////////////////// - // OVERRIDES - - virtual bool Setup(wxWindow *parent) = 0; - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0; - virtual wxDC* PrintDialog(wxWindow *parent) = 0; - -protected: - wxPrintDialogData m_printDialogData; - wxPrintout* m_currentPrintout; - - static wxPrinterError sm_lastError; - -public: - static wxWindow* sm_abortWindow; - static bool sm_abortIt; - -private: - DECLARE_CLASS(wxPrinterBase) - DECLARE_NO_COPY_CLASS(wxPrinterBase) -}; - -//---------------------------------------------------------------------------- -// wxPrinter -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrinter: public wxPrinterBase -{ -public: - wxPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); - virtual ~wxPrinter(); - - virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); - virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); - - virtual bool Setup(wxWindow *parent); - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); - virtual wxDC* PrintDialog(wxWindow *parent); - - virtual wxPrintDialogData& GetPrintDialogData() const; - -protected: - wxPrinterBase *m_pimpl; - -private: - DECLARE_CLASS(wxPrinter) - DECLARE_NO_COPY_CLASS(wxPrinter) -}; - -//---------------------------------------------------------------------------- -// wxPrintout -//---------------------------------------------------------------------------- - -/* - * Represents an object via which a document may be printed. - * The programmer derives from this, overrides (at least) OnPrintPage, - * and passes it to a wxPrinter object for printing, or a wxPrintPreview - * object for previewing. - */ - -class WXDLLEXPORT wxPrintout: public wxObject -{ -public: - wxPrintout(const wxString& title = wxT("Printout")); - virtual ~wxPrintout(); - - virtual bool OnBeginDocument(int startPage, int endPage); - virtual void OnEndDocument(); - virtual void OnBeginPrinting(); - virtual void OnEndPrinting(); - - // Guaranteed to be before any other functions are called - virtual void OnPreparePrinting() { } - - virtual bool HasPage(int page); - virtual bool OnPrintPage(int page) = 0; - virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); - - virtual wxString GetTitle() const { return m_printoutTitle; } - - wxDC *GetDC() const { return m_printoutDC; } - void SetDC(wxDC *dc) { m_printoutDC = dc; } - - void FitThisSizeToPaper(const wxSize& imageSize); - void FitThisSizeToPage(const wxSize& imageSize); - void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData); - void MapScreenSizeToPaper(); - void MapScreenSizeToPage(); - void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData); - void MapScreenSizeToDevice(); - - wxRect GetLogicalPaperRect() const; - wxRect GetLogicalPageRect() const; - wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const; - - void SetLogicalOrigin(wxCoord x, wxCoord y); - void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff); - - void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; } - void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; } - void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; } - void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; } - - void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; } - void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; } - void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; } - void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; } - - void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; } - wxRect GetPaperRectPixels() const { return m_paperRectPixels; } - - virtual bool IsPreview() const { return m_isPreview; } - - virtual void SetIsPreview(bool p) { m_isPreview = p; } - -private: - wxString m_printoutTitle; - wxDC* m_printoutDC; - - int m_pageWidthPixels; - int m_pageHeightPixels; - - int m_pageWidthMM; - int m_pageHeightMM; - - int m_PPIScreenX; - int m_PPIScreenY; - int m_PPIPrinterX; - int m_PPIPrinterY; - - wxRect m_paperRectPixels; - - bool m_isPreview; - -private: - DECLARE_ABSTRACT_CLASS(wxPrintout) - DECLARE_NO_COPY_CLASS(wxPrintout) -}; - -//---------------------------------------------------------------------------- -// wxPreviewCanvas -//---------------------------------------------------------------------------- - -/* - * Canvas upon which a preview is drawn. - */ - -class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow -{ -public: - wxPreviewCanvas(wxPrintPreviewBase *preview, - wxWindow *parent, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxT("canvas")); - virtual ~wxPreviewCanvas(); - - void OnPaint(wxPaintEvent& event); - void OnChar(wxKeyEvent &event); - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -private: -#if wxUSE_MOUSEWHEEL - void OnMouseWheel(wxMouseEvent& event); -#endif // wxUSE_MOUSEWHEEL - - wxPrintPreviewBase* m_printPreview; - - DECLARE_CLASS(wxPreviewCanvas) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPreviewCanvas) -}; - -//---------------------------------------------------------------------------- -// wxPreviewFrame -//---------------------------------------------------------------------------- - -/* - * Default frame for showing preview. - */ - -class WXDLLEXPORT wxPreviewFrame: public wxFrame -{ -public: - wxPreviewFrame(wxPrintPreviewBase *preview, - wxWindow *parent, - const wxString& title = wxT("Print Preview"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxT("frame")); - virtual ~wxPreviewFrame(); - - void OnCloseWindow(wxCloseEvent& event); - virtual void Initialize(); - virtual void CreateCanvas(); - virtual void CreateControlBar(); - - inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; } - -protected: - wxPreviewCanvas* m_previewCanvas; - wxPreviewControlBar* m_controlBar; - wxPrintPreviewBase* m_printPreview; - wxWindowDisabler* m_windowDisabler; - -private: - DECLARE_CLASS(wxPreviewFrame) - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPreviewFrame) -}; - -//---------------------------------------------------------------------------- -// wxPreviewControlBar -//---------------------------------------------------------------------------- - -/* - * A panel with buttons for controlling a print preview. - * The programmer may wish to use other means for controlling - * the print preview. - */ - -#define wxPREVIEW_PRINT 1 -#define wxPREVIEW_PREVIOUS 2 -#define wxPREVIEW_NEXT 4 -#define wxPREVIEW_ZOOM 8 -#define wxPREVIEW_FIRST 16 -#define wxPREVIEW_LAST 32 -#define wxPREVIEW_GOTO 64 - -#define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\ - |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST) - -// Ids for controls -#define wxID_PREVIEW_CLOSE 1 -#define wxID_PREVIEW_NEXT 2 -#define wxID_PREVIEW_PREVIOUS 3 -#define wxID_PREVIEW_PRINT 4 -#define wxID_PREVIEW_ZOOM 5 -#define wxID_PREVIEW_FIRST 6 -#define wxID_PREVIEW_LAST 7 -#define wxID_PREVIEW_GOTO 8 - -class WXDLLEXPORT wxPreviewControlBar: public wxPanel -{ - DECLARE_CLASS(wxPreviewControlBar) - -public: - wxPreviewControlBar(wxPrintPreviewBase *preview, - long buttons, - wxWindow *parent, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL, - const wxString& name = wxT("panel")); - virtual ~wxPreviewControlBar(); - - virtual void CreateButtons(); - virtual void SetZoomControl(int zoom); - virtual int GetZoomControl(); - virtual wxPrintPreviewBase *GetPrintPreview() const - { return m_printPreview; } - - void OnWindowClose(wxCommandEvent& event); - void OnNext(); - void OnPrevious(); - void OnFirst(); - void OnLast(); - void OnGoto(); - void OnPrint(); - void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); } - void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); } - void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); } - void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); } - void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); } - void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); } - void OnZoom(wxCommandEvent& event); - void OnPaint(wxPaintEvent& event); - -protected: - wxPrintPreviewBase* m_printPreview; - wxButton* m_closeButton; - wxButton* m_nextPageButton; - wxButton* m_previousPageButton; - wxButton* m_printButton; - wxChoice* m_zoomControl; - wxButton* m_firstPageButton; - wxButton* m_lastPageButton; - wxButton* m_gotoPageButton; - long m_buttonFlags; - -private: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPreviewControlBar) -}; - -//---------------------------------------------------------------------------- -// wxPrintPreviewBase -//---------------------------------------------------------------------------- - -/* - * Programmer creates an object of this class to preview a wxPrintout. - */ - -class WXDLLEXPORT wxPrintPreviewBase: public wxObject -{ -public: - wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting = (wxPrintout *) NULL, - wxPrintDialogData *data = (wxPrintDialogData *) NULL); - wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - virtual ~wxPrintPreviewBase(); - - virtual bool SetCurrentPage(int pageNum); - virtual int GetCurrentPage() const; - - virtual void SetPrintout(wxPrintout *printout); - virtual wxPrintout *GetPrintout() const; - virtual wxPrintout *GetPrintoutForPrinting() const; - - virtual void SetFrame(wxFrame *frame); - virtual void SetCanvas(wxPreviewCanvas *canvas); - - virtual wxFrame *GetFrame() const; - virtual wxPreviewCanvas *GetCanvas() const; - - // This is a helper routine, used by the next 4 routines. - - virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect); - - // The preview canvas should call this from OnPaint - virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - - // This draws a blank page onto the preview canvas - virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); - - // Adjusts the scrollbars for the current scale - virtual void AdjustScrollbars(wxPreviewCanvas *canvas); - - // This is called by wxPrintPreview to render a page into a wxMemoryDC. - virtual bool RenderPage(int pageNum); - - - virtual void SetZoom(int percent); - virtual int GetZoom() const; - - virtual wxPrintDialogData& GetPrintDialogData(); - - virtual int GetMaxPage() const; - virtual int GetMinPage() const; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - virtual void SetOk(bool ok); - - /////////////////////////////////////////////////////////////////////////// - // OVERRIDES - - // If we own a wxPrintout that can be used for printing, this - // will invoke the actual printing procedure. Called - // by the wxPreviewControlBar. - virtual bool Print(bool interactive) = 0; - - // Calculate scaling that needs to be done to get roughly - // the right scaling for the screen pretending to be - // the currently selected printer. - virtual void DetermineScaling() = 0; - -protected: - wxPrintDialogData m_printDialogData; - wxPreviewCanvas* m_previewCanvas; - wxFrame* m_previewFrame; - wxBitmap* m_previewBitmap; - wxPrintout* m_previewPrintout; - wxPrintout* m_printPrintout; - int m_currentPage; - int m_currentZoom; - float m_previewScaleX; - float m_previewScaleY; - int m_topMargin; - int m_leftMargin; - int m_pageWidth; - int m_pageHeight; - int m_minPage; - int m_maxPage; - - bool m_isOk; - bool m_printingPrepared; // Called OnPreparePrinting? - -private: - void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); - - DECLARE_NO_COPY_CLASS(wxPrintPreviewBase) - DECLARE_CLASS(wxPrintPreviewBase) -}; - -//---------------------------------------------------------------------------- -// wxPrintPreview -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase -{ -public: - wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = (wxPrintout *) NULL, - wxPrintDialogData *data = (wxPrintDialogData *) NULL); - wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting, - wxPrintData *data); - virtual ~wxPrintPreview(); - - virtual bool SetCurrentPage(int pageNum); - virtual int GetCurrentPage() const; - virtual void SetPrintout(wxPrintout *printout); - virtual wxPrintout *GetPrintout() const; - virtual wxPrintout *GetPrintoutForPrinting() const; - virtual void SetFrame(wxFrame *frame); - virtual void SetCanvas(wxPreviewCanvas *canvas); - - virtual wxFrame *GetFrame() const; - virtual wxPreviewCanvas *GetCanvas() const; - virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual void AdjustScrollbars(wxPreviewCanvas *canvas); - virtual bool RenderPage(int pageNum); - virtual void SetZoom(int percent); - virtual int GetZoom() const; - - virtual bool Print(bool interactive); - virtual void DetermineScaling(); - - virtual wxPrintDialogData& GetPrintDialogData(); - - virtual int GetMaxPage() const; - virtual int GetMinPage() const; - - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - virtual void SetOk(bool ok); - -private: - wxPrintPreviewBase *m_pimpl; - -private: - DECLARE_CLASS(wxPrintPreview) - DECLARE_NO_COPY_CLASS(wxPrintPreview) -}; - -//---------------------------------------------------------------------------- -// wxPrintAbortDialog -//---------------------------------------------------------------------------- - -class WXDLLEXPORT wxPrintAbortDialog: public wxDialog -{ -public: - wxPrintAbortDialog(wxWindow *parent, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxT("dialog")) - : wxDialog(parent, wxID_ANY, title, pos, size, style, name) - { - } - - void OnCancel(wxCommandEvent& event); - -private: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxPrintAbortDialog) -}; - -#endif // wxUSE_PRINTING_ARCHITECTURE - -#endif - // _WX_PRNTBASEH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/prntbase.h +// Purpose: Base classes for printing framework +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: prntbase.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRNTBASEH__ +#define _WX_PRNTBASEH__ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/event.h" +#include "wx/cmndata.h" +#include "wx/panel.h" +#include "wx/scrolwin.h" +#include "wx/dialog.h" +#include "wx/frame.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxChoice; +class WXDLLIMPEXP_FWD_CORE wxPrintout; +class WXDLLIMPEXP_FWD_CORE wxPrinterBase; +class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase; +class WXDLLIMPEXP_FWD_CORE wxPrintDialog; +class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase; +class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog; +class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase; +class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas; +class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar; +class WXDLLIMPEXP_FWD_CORE wxPreviewFrame; +class WXDLLIMPEXP_FWD_CORE wxPrintFactory; +class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; + +//---------------------------------------------------------------------------- +// error consts +//---------------------------------------------------------------------------- + +enum wxPrinterError +{ + wxPRINTER_NO_ERROR = 0, + wxPRINTER_CANCELLED, + wxPRINTER_ERROR +}; + +//---------------------------------------------------------------------------- +// wxPrintFactory +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintFactory +{ +public: + wxPrintFactory() {} + virtual ~wxPrintFactory() {} + + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0; + + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout = NULL, + wxPrintDialogData *data = NULL ) = 0; + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout, + wxPrintData *data ) = 0; + + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintDialogData *data = NULL ) = 0; + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintData *data ) = 0; + + virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, + wxPageSetupDialogData * data = NULL ) = 0; + + virtual wxDC* CreatePrinterDC( const wxPrintData& data ) = 0; + + // What to do and what to show in the wxPrintDialog + // a) Use the generic print setup dialog or a native one? + virtual bool HasPrintSetupDialog() = 0; + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0; + // b) Provide the "print to file" option ourselves or via print setup? + virtual bool HasOwnPrintToFile() = 0; + // c) Show current printer + virtual bool HasPrinterLine() = 0; + virtual wxString CreatePrinterLine() = 0; + // d) Show Status line for current printer? + virtual bool HasStatusLine() = 0; + virtual wxString CreateStatusLine() = 0; + + + virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0; + + static void SetPrintFactory( wxPrintFactory *factory ); + static wxPrintFactory *GetFactory(); +private: + static wxPrintFactory *m_factory; +}; + +class WXDLLEXPORT wxNativePrintFactory: public wxPrintFactory +{ +public: + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); + + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout = NULL, + wxPrintDialogData *data = NULL ); + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout, + wxPrintData *data ); + + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintDialogData *data = NULL ); + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintData *data ); + + virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, + wxPageSetupDialogData * data = NULL ); + + virtual wxDC* CreatePrinterDC( const wxPrintData& data ); + + virtual bool HasPrintSetupDialog(); + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); + virtual bool HasOwnPrintToFile(); + virtual bool HasPrinterLine(); + virtual wxString CreatePrinterLine(); + virtual bool HasStatusLine(); + virtual wxString CreateStatusLine(); + + virtual wxPrintNativeDataBase *CreatePrintNativeData(); +}; + +//---------------------------------------------------------------------------- +// wxPrintNativeDataBase +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintNativeDataBase: public wxObject +{ +public: + wxPrintNativeDataBase(); + virtual ~wxPrintNativeDataBase() {} + + virtual bool TransferTo( wxPrintData &data ) = 0; + virtual bool TransferFrom( const wxPrintData &data ) = 0; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; + + int m_ref; + +private: + DECLARE_CLASS(wxPrintNativeDataBase) + DECLARE_NO_COPY_CLASS(wxPrintNativeDataBase) +}; + +//---------------------------------------------------------------------------- +// wxPrinterBase +//---------------------------------------------------------------------------- + +/* + * Represents the printer: manages printing a wxPrintout object + */ + +class WXDLLEXPORT wxPrinterBase: public wxObject +{ +public: + wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL); + virtual ~wxPrinterBase(); + + virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); + virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); + + virtual wxPrintDialogData& GetPrintDialogData() const; + bool GetAbort() const { return sm_abortIt; } + + static wxPrinterError GetLastError() { return sm_lastError; } + + /////////////////////////////////////////////////////////////////////////// + // OVERRIDES + + virtual bool Setup(wxWindow *parent) = 0; + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0; + virtual wxDC* PrintDialog(wxWindow *parent) = 0; + +protected: + wxPrintDialogData m_printDialogData; + wxPrintout* m_currentPrintout; + + static wxPrinterError sm_lastError; + +public: + static wxWindow* sm_abortWindow; + static bool sm_abortIt; + +private: + DECLARE_CLASS(wxPrinterBase) + DECLARE_NO_COPY_CLASS(wxPrinterBase) +}; + +//---------------------------------------------------------------------------- +// wxPrinter +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrinter: public wxPrinterBase +{ +public: + wxPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); + virtual ~wxPrinter(); + + virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); + virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); + + virtual bool Setup(wxWindow *parent); + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); + virtual wxDC* PrintDialog(wxWindow *parent); + + virtual wxPrintDialogData& GetPrintDialogData() const; + +protected: + wxPrinterBase *m_pimpl; + +private: + DECLARE_CLASS(wxPrinter) + DECLARE_NO_COPY_CLASS(wxPrinter) +}; + +//---------------------------------------------------------------------------- +// wxPrintout +//---------------------------------------------------------------------------- + +/* + * Represents an object via which a document may be printed. + * The programmer derives from this, overrides (at least) OnPrintPage, + * and passes it to a wxPrinter object for printing, or a wxPrintPreview + * object for previewing. + */ + +class WXDLLEXPORT wxPrintout: public wxObject +{ +public: + wxPrintout(const wxString& title = wxT("Printout")); + virtual ~wxPrintout(); + + virtual bool OnBeginDocument(int startPage, int endPage); + virtual void OnEndDocument(); + virtual void OnBeginPrinting(); + virtual void OnEndPrinting(); + + // Guaranteed to be before any other functions are called + virtual void OnPreparePrinting() { } + + virtual bool HasPage(int page); + virtual bool OnPrintPage(int page) = 0; + virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); + + virtual wxString GetTitle() const { return m_printoutTitle; } + + wxDC *GetDC() const { return m_printoutDC; } + void SetDC(wxDC *dc) { m_printoutDC = dc; } + + void FitThisSizeToPaper(const wxSize& imageSize); + void FitThisSizeToPage(const wxSize& imageSize); + void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData); + void MapScreenSizeToPaper(); + void MapScreenSizeToPage(); + void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData); + void MapScreenSizeToDevice(); + + wxRect GetLogicalPaperRect() const; + wxRect GetLogicalPageRect() const; + wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const; + + void SetLogicalOrigin(wxCoord x, wxCoord y); + void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff); + + void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; } + void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; } + void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; } + void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; } + + void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; } + void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; } + void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; } + void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; } + + void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; } + wxRect GetPaperRectPixels() const { return m_paperRectPixels; } + + virtual bool IsPreview() const { return m_isPreview; } + + virtual void SetIsPreview(bool p) { m_isPreview = p; } + +private: + wxString m_printoutTitle; + wxDC* m_printoutDC; + + int m_pageWidthPixels; + int m_pageHeightPixels; + + int m_pageWidthMM; + int m_pageHeightMM; + + int m_PPIScreenX; + int m_PPIScreenY; + int m_PPIPrinterX; + int m_PPIPrinterY; + + wxRect m_paperRectPixels; + + bool m_isPreview; + +private: + DECLARE_ABSTRACT_CLASS(wxPrintout) + DECLARE_NO_COPY_CLASS(wxPrintout) +}; + +//---------------------------------------------------------------------------- +// wxPreviewCanvas +//---------------------------------------------------------------------------- + +/* + * Canvas upon which a preview is drawn. + */ + +class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow +{ +public: + wxPreviewCanvas(wxPrintPreviewBase *preview, + wxWindow *parent, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxT("canvas")); + virtual ~wxPreviewCanvas(); + + void OnPaint(wxPaintEvent& event); + void OnChar(wxKeyEvent &event); + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + +private: +#if wxUSE_MOUSEWHEEL + void OnMouseWheel(wxMouseEvent& event); +#endif // wxUSE_MOUSEWHEEL + + wxPrintPreviewBase* m_printPreview; + + DECLARE_CLASS(wxPreviewCanvas) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxPreviewCanvas) +}; + +//---------------------------------------------------------------------------- +// wxPreviewFrame +//---------------------------------------------------------------------------- + +/* + * Default frame for showing preview. + */ + +class WXDLLEXPORT wxPreviewFrame: public wxFrame +{ +public: + wxPreviewFrame(wxPrintPreviewBase *preview, + wxWindow *parent, + const wxString& title = wxT("Print Preview"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxT("frame")); + virtual ~wxPreviewFrame(); + + void OnCloseWindow(wxCloseEvent& event); + virtual void Initialize(); + virtual void CreateCanvas(); + virtual void CreateControlBar(); + + inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; } + +protected: + wxPreviewCanvas* m_previewCanvas; + wxPreviewControlBar* m_controlBar; + wxPrintPreviewBase* m_printPreview; + wxWindowDisabler* m_windowDisabler; + +private: + DECLARE_CLASS(wxPreviewFrame) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxPreviewFrame) +}; + +//---------------------------------------------------------------------------- +// wxPreviewControlBar +//---------------------------------------------------------------------------- + +/* + * A panel with buttons for controlling a print preview. + * The programmer may wish to use other means for controlling + * the print preview. + */ + +#define wxPREVIEW_PRINT 1 +#define wxPREVIEW_PREVIOUS 2 +#define wxPREVIEW_NEXT 4 +#define wxPREVIEW_ZOOM 8 +#define wxPREVIEW_FIRST 16 +#define wxPREVIEW_LAST 32 +#define wxPREVIEW_GOTO 64 + +#define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\ + |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST) + +// Ids for controls +#define wxID_PREVIEW_CLOSE 1 +#define wxID_PREVIEW_NEXT 2 +#define wxID_PREVIEW_PREVIOUS 3 +#define wxID_PREVIEW_PRINT 4 +#define wxID_PREVIEW_ZOOM 5 +#define wxID_PREVIEW_FIRST 6 +#define wxID_PREVIEW_LAST 7 +#define wxID_PREVIEW_GOTO 8 + +class WXDLLEXPORT wxPreviewControlBar: public wxPanel +{ + DECLARE_CLASS(wxPreviewControlBar) + +public: + wxPreviewControlBar(wxPrintPreviewBase *preview, + long buttons, + wxWindow *parent, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL, + const wxString& name = wxT("panel")); + virtual ~wxPreviewControlBar(); + + virtual void CreateButtons(); + virtual void SetZoomControl(int zoom); + virtual int GetZoomControl(); + virtual wxPrintPreviewBase *GetPrintPreview() const + { return m_printPreview; } + + void OnWindowClose(wxCommandEvent& event); + void OnNext(); + void OnPrevious(); + void OnFirst(); + void OnLast(); + void OnGoto(); + void OnPrint(); + void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); } + void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); } + void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); } + void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); } + void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); } + void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); } + void OnZoom(wxCommandEvent& event); + void OnPaint(wxPaintEvent& event); + +protected: + wxPrintPreviewBase* m_printPreview; + wxButton* m_closeButton; + wxButton* m_nextPageButton; + wxButton* m_previousPageButton; + wxButton* m_printButton; + wxChoice* m_zoomControl; + wxButton* m_firstPageButton; + wxButton* m_lastPageButton; + wxButton* m_gotoPageButton; + long m_buttonFlags; + +private: + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxPreviewControlBar) +}; + +//---------------------------------------------------------------------------- +// wxPrintPreviewBase +//---------------------------------------------------------------------------- + +/* + * Programmer creates an object of this class to preview a wxPrintout. + */ + +class WXDLLEXPORT wxPrintPreviewBase: public wxObject +{ +public: + wxPrintPreviewBase(wxPrintout *printout, + wxPrintout *printoutForPrinting = (wxPrintout *) NULL, + wxPrintDialogData *data = (wxPrintDialogData *) NULL); + wxPrintPreviewBase(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxPrintPreviewBase(); + + virtual bool SetCurrentPage(int pageNum); + virtual int GetCurrentPage() const; + + virtual void SetPrintout(wxPrintout *printout); + virtual wxPrintout *GetPrintout() const; + virtual wxPrintout *GetPrintoutForPrinting() const; + + virtual void SetFrame(wxFrame *frame); + virtual void SetCanvas(wxPreviewCanvas *canvas); + + virtual wxFrame *GetFrame() const; + virtual wxPreviewCanvas *GetCanvas() const; + + // This is a helper routine, used by the next 4 routines. + + virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect); + + // The preview canvas should call this from OnPaint + virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); + + // This draws a blank page onto the preview canvas + virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); + + // Adjusts the scrollbars for the current scale + virtual void AdjustScrollbars(wxPreviewCanvas *canvas); + + // This is called by wxPrintPreview to render a page into a wxMemoryDC. + virtual bool RenderPage(int pageNum); + + + virtual void SetZoom(int percent); + virtual int GetZoom() const; + + virtual wxPrintDialogData& GetPrintDialogData(); + + virtual int GetMaxPage() const; + virtual int GetMinPage() const; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + virtual void SetOk(bool ok); + + /////////////////////////////////////////////////////////////////////////// + // OVERRIDES + + // If we own a wxPrintout that can be used for printing, this + // will invoke the actual printing procedure. Called + // by the wxPreviewControlBar. + virtual bool Print(bool interactive) = 0; + + // Calculate scaling that needs to be done to get roughly + // the right scaling for the screen pretending to be + // the currently selected printer. + virtual void DetermineScaling() = 0; + +protected: + wxPrintDialogData m_printDialogData; + wxPreviewCanvas* m_previewCanvas; + wxFrame* m_previewFrame; + wxBitmap* m_previewBitmap; + wxPrintout* m_previewPrintout; + wxPrintout* m_printPrintout; + int m_currentPage; + int m_currentZoom; + float m_previewScaleX; + float m_previewScaleY; + int m_topMargin; + int m_leftMargin; + int m_pageWidth; + int m_pageHeight; + int m_minPage; + int m_maxPage; + + bool m_isOk; + bool m_printingPrepared; // Called OnPreparePrinting? + +private: + void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); + + DECLARE_NO_COPY_CLASS(wxPrintPreviewBase) + DECLARE_CLASS(wxPrintPreviewBase) +}; + +//---------------------------------------------------------------------------- +// wxPrintPreview +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase +{ +public: + wxPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = (wxPrintout *) NULL, + wxPrintDialogData *data = (wxPrintDialogData *) NULL); + wxPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxPrintPreview(); + + virtual bool SetCurrentPage(int pageNum); + virtual int GetCurrentPage() const; + virtual void SetPrintout(wxPrintout *printout); + virtual wxPrintout *GetPrintout() const; + virtual wxPrintout *GetPrintoutForPrinting() const; + virtual void SetFrame(wxFrame *frame); + virtual void SetCanvas(wxPreviewCanvas *canvas); + + virtual wxFrame *GetFrame() const; + virtual wxPreviewCanvas *GetCanvas() const; + virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); + virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); + virtual void AdjustScrollbars(wxPreviewCanvas *canvas); + virtual bool RenderPage(int pageNum); + virtual void SetZoom(int percent); + virtual int GetZoom() const; + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); + + virtual wxPrintDialogData& GetPrintDialogData(); + + virtual int GetMaxPage() const; + virtual int GetMinPage() const; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + virtual void SetOk(bool ok); + +private: + wxPrintPreviewBase *m_pimpl; + +private: + DECLARE_CLASS(wxPrintPreview) + DECLARE_NO_COPY_CLASS(wxPrintPreview) +}; + +//---------------------------------------------------------------------------- +// wxPrintAbortDialog +//---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintAbortDialog: public wxDialog +{ +public: + wxPrintAbortDialog(wxWindow *parent, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxT("dialog")) + : wxDialog(parent, wxID_ANY, title, pos, size, style, name) + { + } + + void OnCancel(wxCommandEvent& event); + +private: + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxPrintAbortDialog) +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_PRNTBASEH__ diff --git a/Externals/wxWidgets/include/wx/process.h b/Externals/wxWidgets/include/wx/process.h index 2c2f6185ed..aaed2703a1 100644 --- a/Externals/wxWidgets/include/wx/process.h +++ b/Externals/wxWidgets/include/wx/process.h @@ -1,172 +1,172 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/process.h -// Purpose: wxProcess class -// Author: Guilhem Lavaux -// Modified by: Vadim Zeitlin to check error codes, added Detach() method -// Created: 24/06/98 -// RCS-ID: $Id: process.h 42713 2006-10-30 11:56:12Z ABX $ -// Copyright: (c) 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROCESSH__ -#define _WX_PROCESSH__ - -#include "wx/event.h" - -#if wxUSE_STREAMS - #include "wx/stream.h" -#endif - -#include "wx/utils.h" // for wxSignal - -// the wxProcess creation flags -enum -{ - // no redirection - wxPROCESS_DEFAULT = 0, - - // redirect the IO of the child process - wxPROCESS_REDIRECT = 1 -}; - -// ---------------------------------------------------------------------------- -// A wxProcess object should be passed to wxExecute - than its OnTerminate() -// function will be called when the process terminates. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxProcess : public wxEvtHandler -{ -public: - // kill the process with the given PID - static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM, int flags = wxKILL_NOCHILDREN); - - // test if the given process exists - static bool Exists(int pid); - - // this function replaces the standard popen() one: it launches a process - // asynchronously and allows the caller to get the streams connected to its - // std{in|out|err} - // - // on error NULL is returned, in any case the process object will be - // deleted automatically when the process terminates and should *not* be - // deleted by the caller - static wxProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); - - - // ctors - wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int nId = wxID_ANY) - { Init(parent, nId, wxPROCESS_DEFAULT); } - - wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } - - virtual ~wxProcess(); - - // get the process ID of the process executed by Open() - long GetPid() const { return m_pid; } - - // may be overridden to be notified about process termination - virtual void OnTerminate(int pid, int status); - - // call this before passing the object to wxExecute() to redirect the - // launched process stdin/stdout, then use GetInputStream() and - // GetOutputStream() to get access to them - void Redirect() { m_redirect = true; } - bool IsRedirected() const { return m_redirect; } - - // detach from the parent - should be called by the parent if it's deleted - // before the process it started terminates - void Detach(); - -#if wxUSE_STREAMS - // Pipe handling - wxInputStream *GetInputStream() const { return m_inputStream; } - wxInputStream *GetErrorStream() const { return m_errorStream; } - wxOutputStream *GetOutputStream() const { return m_outputStream; } - - // close the output stream indicating that nothing more will be written - void CloseOutput() { delete m_outputStream; m_outputStream = NULL; } - - // return true if the child process stdout is not closed - bool IsInputOpened() const; - - // return true if any input is available on the child process stdout/err - bool IsInputAvailable() const; - bool IsErrorAvailable() const; - - // implementation only (for wxExecute) - // - // NB: the streams passed here should correspond to the child process - // stdout, stdin and stderr and here the normal naming convention is - // used unlike elsewhere in this class - void SetPipeStreams(wxInputStream *outStream, - wxOutputStream *inStream, - wxInputStream *errStream); -#endif // wxUSE_STREAMS - -protected: - void Init(wxEvtHandler *parent, int id, int flags); - void SetPid(long pid) { m_pid = pid; } - - int m_id; - long m_pid; - -#if wxUSE_STREAMS - // these streams are connected to stdout, stderr and stdin of the child - // process respectively (yes, m_inputStream corresponds to stdout -- very - // confusing but too late to change now) - wxInputStream *m_inputStream, - *m_errorStream; - wxOutputStream *m_outputStream; -#endif // wxUSE_STREAMS - - bool m_redirect; - - DECLARE_DYNAMIC_CLASS(wxProcess) - DECLARE_NO_COPY_CLASS(wxProcess) -}; - -// ---------------------------------------------------------------------------- -// wxProcess events -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, 440) -END_DECLARE_EVENT_TYPES() - -class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent -{ -public: - wxProcessEvent(int nId = 0, int pid = 0, int exitcode = 0) : wxEvent(nId) - { - m_eventType = wxEVT_END_PROCESS; - m_pid = pid; - m_exitcode = exitcode; - } - - // accessors - // PID of process which terminated - int GetPid() { return m_pid; } - - // the exit code - int GetExitCode() { return m_exitcode; } - - // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxProcessEvent(*this); } - -public: - int m_pid, - m_exitcode; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxProcessEvent) -}; - -typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&); - -#define wxProcessEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxProcessEventFunction, &func) - -#define EVT_END_PROCESS(id, func) \ - wx__DECLARE_EVT1(wxEVT_END_PROCESS, id, wxProcessEventHandler(func)) - -#endif // _WX_PROCESSH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/process.h +// Purpose: wxProcess class +// Author: Guilhem Lavaux +// Modified by: Vadim Zeitlin to check error codes, added Detach() method +// Created: 24/06/98 +// RCS-ID: $Id: process.h 42713 2006-10-30 11:56:12Z ABX $ +// Copyright: (c) 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROCESSH__ +#define _WX_PROCESSH__ + +#include "wx/event.h" + +#if wxUSE_STREAMS + #include "wx/stream.h" +#endif + +#include "wx/utils.h" // for wxSignal + +// the wxProcess creation flags +enum +{ + // no redirection + wxPROCESS_DEFAULT = 0, + + // redirect the IO of the child process + wxPROCESS_REDIRECT = 1 +}; + +// ---------------------------------------------------------------------------- +// A wxProcess object should be passed to wxExecute - than its OnTerminate() +// function will be called when the process terminates. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxProcess : public wxEvtHandler +{ +public: + // kill the process with the given PID + static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM, int flags = wxKILL_NOCHILDREN); + + // test if the given process exists + static bool Exists(int pid); + + // this function replaces the standard popen() one: it launches a process + // asynchronously and allows the caller to get the streams connected to its + // std{in|out|err} + // + // on error NULL is returned, in any case the process object will be + // deleted automatically when the process terminates and should *not* be + // deleted by the caller + static wxProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); + + + // ctors + wxProcess(wxEvtHandler *parent = (wxEvtHandler *) NULL, int nId = wxID_ANY) + { Init(parent, nId, wxPROCESS_DEFAULT); } + + wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } + + virtual ~wxProcess(); + + // get the process ID of the process executed by Open() + long GetPid() const { return m_pid; } + + // may be overridden to be notified about process termination + virtual void OnTerminate(int pid, int status); + + // call this before passing the object to wxExecute() to redirect the + // launched process stdin/stdout, then use GetInputStream() and + // GetOutputStream() to get access to them + void Redirect() { m_redirect = true; } + bool IsRedirected() const { return m_redirect; } + + // detach from the parent - should be called by the parent if it's deleted + // before the process it started terminates + void Detach(); + +#if wxUSE_STREAMS + // Pipe handling + wxInputStream *GetInputStream() const { return m_inputStream; } + wxInputStream *GetErrorStream() const { return m_errorStream; } + wxOutputStream *GetOutputStream() const { return m_outputStream; } + + // close the output stream indicating that nothing more will be written + void CloseOutput() { delete m_outputStream; m_outputStream = NULL; } + + // return true if the child process stdout is not closed + bool IsInputOpened() const; + + // return true if any input is available on the child process stdout/err + bool IsInputAvailable() const; + bool IsErrorAvailable() const; + + // implementation only (for wxExecute) + // + // NB: the streams passed here should correspond to the child process + // stdout, stdin and stderr and here the normal naming convention is + // used unlike elsewhere in this class + void SetPipeStreams(wxInputStream *outStream, + wxOutputStream *inStream, + wxInputStream *errStream); +#endif // wxUSE_STREAMS + +protected: + void Init(wxEvtHandler *parent, int id, int flags); + void SetPid(long pid) { m_pid = pid; } + + int m_id; + long m_pid; + +#if wxUSE_STREAMS + // these streams are connected to stdout, stderr and stdin of the child + // process respectively (yes, m_inputStream corresponds to stdout -- very + // confusing but too late to change now) + wxInputStream *m_inputStream, + *m_errorStream; + wxOutputStream *m_outputStream; +#endif // wxUSE_STREAMS + + bool m_redirect; + + DECLARE_DYNAMIC_CLASS(wxProcess) + DECLARE_NO_COPY_CLASS(wxProcess) +}; + +// ---------------------------------------------------------------------------- +// wxProcess events +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, 440) +END_DECLARE_EVENT_TYPES() + +class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent +{ +public: + wxProcessEvent(int nId = 0, int pid = 0, int exitcode = 0) : wxEvent(nId) + { + m_eventType = wxEVT_END_PROCESS; + m_pid = pid; + m_exitcode = exitcode; + } + + // accessors + // PID of process which terminated + int GetPid() { return m_pid; } + + // the exit code + int GetExitCode() { return m_exitcode; } + + // implement the base class pure virtual + virtual wxEvent *Clone() const { return new wxProcessEvent(*this); } + +public: + int m_pid, + m_exitcode; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxProcessEvent) +}; + +typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&); + +#define wxProcessEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxProcessEventFunction, &func) + +#define EVT_END_PROCESS(id, func) \ + wx__DECLARE_EVT1(wxEVT_END_PROCESS, id, wxProcessEventHandler(func)) + +#endif // _WX_PROCESSH__ diff --git a/Externals/wxWidgets/include/wx/progdlg.h b/Externals/wxWidgets/include/wx/progdlg.h index 196192bce2..f1692b1308 100644 --- a/Externals/wxWidgets/include/wx/progdlg.h +++ b/Externals/wxWidgets/include/wx/progdlg.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/progdlg.h -// Purpose: Base header for wxProgressDialog -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: progdlg.h 41089 2006-09-09 13:36:54Z RR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROGDLG_H_BASE_ -#define _WX_PROGDLG_H_BASE_ - -#include "wx/defs.h" - -/* - * wxProgressDialog flags - */ -#define wxPD_CAN_ABORT 0x0001 -#define wxPD_APP_MODAL 0x0002 -#define wxPD_AUTO_HIDE 0x0004 -#define wxPD_ELAPSED_TIME 0x0008 -#define wxPD_ESTIMATED_TIME 0x0010 -#define wxPD_SMOOTH 0x0020 -#define wxPD_REMAINING_TIME 0x0040 -#define wxPD_CAN_SKIP 0x0080 - - -#ifdef __WXPALMOS__ - #include "wx/palmos/progdlg.h" -#else - #include "wx/generic/progdlgg.h" -#endif - -#endif // _WX_PROGDLG_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/progdlg.h +// Purpose: Base header for wxProgressDialog +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: progdlg.h 41089 2006-09-09 13:36:54Z RR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROGDLG_H_BASE_ +#define _WX_PROGDLG_H_BASE_ + +#include "wx/defs.h" + +/* + * wxProgressDialog flags + */ +#define wxPD_CAN_ABORT 0x0001 +#define wxPD_APP_MODAL 0x0002 +#define wxPD_AUTO_HIDE 0x0004 +#define wxPD_ELAPSED_TIME 0x0008 +#define wxPD_ESTIMATED_TIME 0x0010 +#define wxPD_SMOOTH 0x0020 +#define wxPD_REMAINING_TIME 0x0040 +#define wxPD_CAN_SKIP 0x0080 + + +#ifdef __WXPALMOS__ + #include "wx/palmos/progdlg.h" +#else + #include "wx/generic/progdlgg.h" +#endif + +#endif // _WX_PROGDLG_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/propdlg.h b/Externals/wxWidgets/include/wx/propdlg.h index 34396e26e3..4bad68bb32 100644 --- a/Externals/wxWidgets/include/wx/propdlg.h +++ b/Externals/wxWidgets/include/wx/propdlg.h @@ -1,19 +1,19 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/propdlg.h -// Purpose: wxPropertySheetDialog base header -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: propdlg.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROPDLG_H_BASE_ -#define _WX_PROPDLG_H_BASE_ - -#include "wx/generic/propdlg.h" - -#endif - // _WX_PROPDLG_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propdlg.h +// Purpose: wxPropertySheetDialog base header +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: propdlg.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPDLG_H_BASE_ +#define _WX_PROPDLG_H_BASE_ + +#include "wx/generic/propdlg.h" + +#endif + // _WX_PROPDLG_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/protocol/file.h b/Externals/wxWidgets/include/wx/protocol/file.h index 250e03b008..e31d88fb4a 100644 --- a/Externals/wxWidgets/include/wx/protocol/file.h +++ b/Externals/wxWidgets/include/wx/protocol/file.h @@ -1,37 +1,37 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: file.h -// Purpose: File protocol -// Author: Guilhem Lavaux -// Modified by: -// Created: 1997 -// RCS-ID: $Id: file.h 43836 2006-12-06 19:20:40Z VZ $ -// Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_PROTO_FILE_H__ -#define __WX_PROTO_FILE_H__ - -#include "wx/defs.h" - -#if wxUSE_PROTOCOL_FILE - -#include "wx/protocol/protocol.h" - -class WXDLLIMPEXP_NET wxFileProto: public wxProtocol { - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFileProto) - DECLARE_PROTOCOL(wxFileProto) -protected: - wxProtocolError m_error; -public: - wxFileProto(); - virtual ~wxFileProto(); - - wxProtocolError GetError() { return m_error; } - bool Abort() { return TRUE; } - wxInputStream *GetInputStream(const wxString& path); -}; - -#endif // wxUSE_PROTOCOL_FILE - -#endif // __WX_PROTO_FILE_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: file.h +// Purpose: File protocol +// Author: Guilhem Lavaux +// Modified by: +// Created: 1997 +// RCS-ID: $Id: file.h 43836 2006-12-06 19:20:40Z VZ $ +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_PROTO_FILE_H__ +#define __WX_PROTO_FILE_H__ + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL_FILE + +#include "wx/protocol/protocol.h" + +class WXDLLIMPEXP_NET wxFileProto: public wxProtocol { + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFileProto) + DECLARE_PROTOCOL(wxFileProto) +protected: + wxProtocolError m_error; +public: + wxFileProto(); + virtual ~wxFileProto(); + + wxProtocolError GetError() { return m_error; } + bool Abort() { return TRUE; } + wxInputStream *GetInputStream(const wxString& path); +}; + +#endif // wxUSE_PROTOCOL_FILE + +#endif // __WX_PROTO_FILE_H__ diff --git a/Externals/wxWidgets/include/wx/protocol/ftp.h b/Externals/wxWidgets/include/wx/protocol/ftp.h index f3f8a3b544..b074e15ea1 100644 --- a/Externals/wxWidgets/include/wx/protocol/ftp.h +++ b/Externals/wxWidgets/include/wx/protocol/ftp.h @@ -1,182 +1,182 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ftp.h -// Purpose: FTP protocol -// Author: Vadim Zeitlin -// Modified by: Mark Johnson, wxWindows@mj10777.de -// 20000917 : RmDir, GetLastResult, GetList -// Created: 07/07/1997 -// RCS-ID: $Id: ftp.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_FTP_H__ -#define __WX_FTP_H__ - -#include "wx/defs.h" - -#if wxUSE_PROTOCOL_FTP - -#include "wx/sckaddr.h" -#include "wx/protocol/protocol.h" -#include "wx/url.h" - -class WXDLLIMPEXP_NET wxFTP : public wxProtocol -{ -public: - enum TransferMode - { - NONE, // not set by user explicitly - ASCII, - BINARY - }; - - wxFTP(); - virtual ~wxFTP(); - - // Connecting and disconnecting - void SetUser(const wxString& user) { m_user = user; } - void SetPassword(const wxString& passwd) { m_passwd = passwd; } - - bool Connect(wxSockAddress& addr, bool wait = true); - bool Connect(const wxString& host); - - // disconnect - virtual bool Close(); - - // Parameters set up - - // set transfer mode now - void SetPassive(bool pasv) { m_bPassive = pasv; } - void SetDefaultTimeout(wxUint32 Value); - bool SetBinary() { return SetTransferMode(BINARY); } - bool SetAscii() { return SetTransferMode(ASCII); } - bool SetTransferMode(TransferMode mode); - - // Generic FTP interface - - // the error code - virtual wxProtocolError GetError() { return m_lastError; } - - // the last FTP server reply - const wxString& GetLastResult() { return m_lastResult; } - - // send any FTP command (should be full FTP command line but without - // trailing "\r\n") and return its return code - char SendCommand(const wxString& command); - - // check that the command returned the given code - bool CheckCommand(const wxString& command, char expectedReturn) - { - return SendCommand(command) == expectedReturn; - } - - // Filesystem commands - bool ChDir(const wxString& dir); - bool MkDir(const wxString& dir); - bool RmDir(const wxString& dir); - wxString Pwd(); - bool Rename(const wxString& src, const wxString& dst); - bool RmFile(const wxString& path); - - // Get the size of a file in the current dir. - // this function tries its best to deliver the size in bytes using BINARY - // (the SIZE command reports different sizes depending on whether - // type is set to ASCII or BINARY) - // returns -1 if file is non-existant or size could not be found - int GetFileSize(const wxString& fileName); - - // Check to see if a file exists in the current dir - bool FileExists(const wxString& fileName); - - // Download methods - bool Abort(); - - virtual wxInputStream *GetInputStream(const wxString& path); - virtual wxOutputStream *GetOutputStream(const wxString& path); - - // Directory listing - - // get the list of full filenames, the format is fixed: one file name per - // line - bool GetFilesList(wxArrayString& files, - const wxString& wildcard = wxEmptyString) - { - return GetList(files, wildcard, false); - } - - // get a directory list in server dependent format - this can be shown - // directly to the user - bool GetDirList(wxArrayString& files, - const wxString& wildcard = wxEmptyString) - { - return GetList(files, wildcard, true); - } - - // equivalent to either GetFilesList() (default) or GetDirList() - bool GetList(wxArrayString& files, - const wxString& wildcard = wxEmptyString, - bool details = false); - -protected: - // this executes a simple ftp command with the given argument and returns - // true if it its return code starts with '2' - bool DoSimpleCommand(const wxChar *command, - const wxString& arg = wxEmptyString); - - // get the server reply, return the first character of the reply code, - // '1'..'5' for normal FTP replies, 0 (*not* '0') if an error occurred - char GetResult(); - - // check that the result is equal to expected value - bool CheckResult(char ch) { return GetResult() == ch; } - - // return the socket to be used, Passive/Active versions are used only by - // GetPort() - wxSocketBase *GetPort(); - wxSocketBase *GetPassivePort(); - wxSocketBase *GetActivePort(); - - // helper for GetPort() - wxString GetPortCmdArgument(const wxIPV4address& Local, const wxIPV4address& New); - - // accept connection from server in active mode, returns the same socket as - // passed in in passive mode - wxSocketBase *AcceptIfActive(wxSocketBase *sock); - - - wxString m_user, - m_passwd; - - wxString m_lastResult; - wxProtocolError m_lastError; - - // true if there is an FTP transfer going on - bool m_streaming; - - // although this should be set to ASCII by default according to STD9, - // we will use BINARY transfer mode by default for backwards compatibility - TransferMode m_currentTransfermode; - - friend class wxInputFTPStream; - friend class wxOutputFTPStream; - - bool m_bPassive; - wxUint32 m_uiDefaultTimeout; - - // following is true when a read or write times out, we then assume - // the connection is dead and abort. we avoid additional delays this way - bool m_bEncounteredError; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP) - DECLARE_PROTOCOL(wxFTP) -}; - -// the trace mask used by assorted wxLogTrace() in ftp code, do -// wxLog::AddTraceMask(FTP_TRACE_MASK) to see them in output -#define FTP_TRACE_MASK _T("ftp") - -#endif // wxUSE_PROTOCOL_FTP - -#endif // __WX_FTP_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: ftp.h +// Purpose: FTP protocol +// Author: Vadim Zeitlin +// Modified by: Mark Johnson, wxWindows@mj10777.de +// 20000917 : RmDir, GetLastResult, GetList +// Created: 07/07/1997 +// RCS-ID: $Id: ftp.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_FTP_H__ +#define __WX_FTP_H__ + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL_FTP + +#include "wx/sckaddr.h" +#include "wx/protocol/protocol.h" +#include "wx/url.h" + +class WXDLLIMPEXP_NET wxFTP : public wxProtocol +{ +public: + enum TransferMode + { + NONE, // not set by user explicitly + ASCII, + BINARY + }; + + wxFTP(); + virtual ~wxFTP(); + + // Connecting and disconnecting + void SetUser(const wxString& user) { m_user = user; } + void SetPassword(const wxString& passwd) { m_passwd = passwd; } + + bool Connect(wxSockAddress& addr, bool wait = true); + bool Connect(const wxString& host); + + // disconnect + virtual bool Close(); + + // Parameters set up + + // set transfer mode now + void SetPassive(bool pasv) { m_bPassive = pasv; } + void SetDefaultTimeout(wxUint32 Value); + bool SetBinary() { return SetTransferMode(BINARY); } + bool SetAscii() { return SetTransferMode(ASCII); } + bool SetTransferMode(TransferMode mode); + + // Generic FTP interface + + // the error code + virtual wxProtocolError GetError() { return m_lastError; } + + // the last FTP server reply + const wxString& GetLastResult() { return m_lastResult; } + + // send any FTP command (should be full FTP command line but without + // trailing "\r\n") and return its return code + char SendCommand(const wxString& command); + + // check that the command returned the given code + bool CheckCommand(const wxString& command, char expectedReturn) + { + return SendCommand(command) == expectedReturn; + } + + // Filesystem commands + bool ChDir(const wxString& dir); + bool MkDir(const wxString& dir); + bool RmDir(const wxString& dir); + wxString Pwd(); + bool Rename(const wxString& src, const wxString& dst); + bool RmFile(const wxString& path); + + // Get the size of a file in the current dir. + // this function tries its best to deliver the size in bytes using BINARY + // (the SIZE command reports different sizes depending on whether + // type is set to ASCII or BINARY) + // returns -1 if file is non-existant or size could not be found + int GetFileSize(const wxString& fileName); + + // Check to see if a file exists in the current dir + bool FileExists(const wxString& fileName); + + // Download methods + bool Abort(); + + virtual wxInputStream *GetInputStream(const wxString& path); + virtual wxOutputStream *GetOutputStream(const wxString& path); + + // Directory listing + + // get the list of full filenames, the format is fixed: one file name per + // line + bool GetFilesList(wxArrayString& files, + const wxString& wildcard = wxEmptyString) + { + return GetList(files, wildcard, false); + } + + // get a directory list in server dependent format - this can be shown + // directly to the user + bool GetDirList(wxArrayString& files, + const wxString& wildcard = wxEmptyString) + { + return GetList(files, wildcard, true); + } + + // equivalent to either GetFilesList() (default) or GetDirList() + bool GetList(wxArrayString& files, + const wxString& wildcard = wxEmptyString, + bool details = false); + +protected: + // this executes a simple ftp command with the given argument and returns + // true if it its return code starts with '2' + bool DoSimpleCommand(const wxChar *command, + const wxString& arg = wxEmptyString); + + // get the server reply, return the first character of the reply code, + // '1'..'5' for normal FTP replies, 0 (*not* '0') if an error occurred + char GetResult(); + + // check that the result is equal to expected value + bool CheckResult(char ch) { return GetResult() == ch; } + + // return the socket to be used, Passive/Active versions are used only by + // GetPort() + wxSocketBase *GetPort(); + wxSocketBase *GetPassivePort(); + wxSocketBase *GetActivePort(); + + // helper for GetPort() + wxString GetPortCmdArgument(const wxIPV4address& Local, const wxIPV4address& New); + + // accept connection from server in active mode, returns the same socket as + // passed in in passive mode + wxSocketBase *AcceptIfActive(wxSocketBase *sock); + + + wxString m_user, + m_passwd; + + wxString m_lastResult; + wxProtocolError m_lastError; + + // true if there is an FTP transfer going on + bool m_streaming; + + // although this should be set to ASCII by default according to STD9, + // we will use BINARY transfer mode by default for backwards compatibility + TransferMode m_currentTransfermode; + + friend class wxInputFTPStream; + friend class wxOutputFTPStream; + + bool m_bPassive; + wxUint32 m_uiDefaultTimeout; + + // following is true when a read or write times out, we then assume + // the connection is dead and abort. we avoid additional delays this way + bool m_bEncounteredError; + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP) + DECLARE_PROTOCOL(wxFTP) +}; + +// the trace mask used by assorted wxLogTrace() in ftp code, do +// wxLog::AddTraceMask(FTP_TRACE_MASK) to see them in output +#define FTP_TRACE_MASK _T("ftp") + +#endif // wxUSE_PROTOCOL_FTP + +#endif // __WX_FTP_H__ diff --git a/Externals/wxWidgets/include/wx/protocol/http.h b/Externals/wxWidgets/include/wx/protocol/http.h index 29d61dcd78..b52664d322 100644 --- a/Externals/wxWidgets/include/wx/protocol/http.h +++ b/Externals/wxWidgets/include/wx/protocol/http.h @@ -1,91 +1,91 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: http.h -// Purpose: HTTP protocol -// Author: Guilhem Lavaux -// Modified by: Simo Virokannas (authentication, Dec 2005) -// Created: August 1997 -// RCS-ID: $Id: http.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_HTTP_H -#define _WX_HTTP_H - -#include "wx/defs.h" - -#if wxUSE_PROTOCOL_HTTP - -#include "wx/hashmap.h" -#include "wx/protocol/protocol.h" - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap, - class WXDLLIMPEXP_NET ); - -class WXDLLIMPEXP_NET wxHTTP : public wxProtocol -{ -public: - wxHTTP(); - virtual ~wxHTTP(); - - virtual bool Connect(const wxString& host, unsigned short port); - virtual bool Connect(const wxString& host) { return Connect(host, 0); } - virtual bool Connect(wxSockAddress& addr, bool wait); - bool Abort(); - wxInputStream *GetInputStream(const wxString& path); - inline wxProtocolError GetError() { return m_perr; } - wxString GetContentType(); - - void SetHeader(const wxString& header, const wxString& h_data); - wxString GetHeader(const wxString& header) const; - void SetPostBuffer(const wxString& post_buf); - - void SetProxyMode(bool on); - - int GetResponse() { return m_http_response; } - - virtual void SetUser(const wxString& user) { m_username = user; } - virtual void SetPassword(const wxString& passwd ) { m_password = passwd; } - -protected: - enum wxHTTP_Req - { - wxHTTP_GET, - wxHTTP_POST, - wxHTTP_HEAD - }; - - typedef wxStringToStringHashMap::iterator wxHeaderIterator; - typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator; - - bool BuildRequest(const wxString& path, wxHTTP_Req req); - void SendHeaders(); - bool ParseHeaders(); - - wxString GenerateAuthString(const wxString& user, const wxString& pass) const; - - // find the header in m_headers - wxHeaderIterator FindHeader(const wxString& header); - wxHeaderConstIterator FindHeader(const wxString& header) const; - - // deletes the header value strings - void ClearHeaders(); - - wxProtocolError m_perr; - wxStringToStringHashMap m_headers; - bool m_read, - m_proxy_mode; - wxSockAddress *m_addr; - wxString m_post_buf; - int m_http_response; - wxString m_username; - wxString m_password; - - DECLARE_DYNAMIC_CLASS(wxHTTP) - DECLARE_PROTOCOL(wxHTTP) - DECLARE_NO_COPY_CLASS(wxHTTP) -}; - -#endif // wxUSE_PROTOCOL_HTTP - -#endif // _WX_HTTP_H - +///////////////////////////////////////////////////////////////////////////// +// Name: http.h +// Purpose: HTTP protocol +// Author: Guilhem Lavaux +// Modified by: Simo Virokannas (authentication, Dec 2005) +// Created: August 1997 +// RCS-ID: $Id: http.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_HTTP_H +#define _WX_HTTP_H + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL_HTTP + +#include "wx/hashmap.h" +#include "wx/protocol/protocol.h" + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap, + class WXDLLIMPEXP_NET ); + +class WXDLLIMPEXP_NET wxHTTP : public wxProtocol +{ +public: + wxHTTP(); + virtual ~wxHTTP(); + + virtual bool Connect(const wxString& host, unsigned short port); + virtual bool Connect(const wxString& host) { return Connect(host, 0); } + virtual bool Connect(wxSockAddress& addr, bool wait); + bool Abort(); + wxInputStream *GetInputStream(const wxString& path); + inline wxProtocolError GetError() { return m_perr; } + wxString GetContentType(); + + void SetHeader(const wxString& header, const wxString& h_data); + wxString GetHeader(const wxString& header) const; + void SetPostBuffer(const wxString& post_buf); + + void SetProxyMode(bool on); + + int GetResponse() { return m_http_response; } + + virtual void SetUser(const wxString& user) { m_username = user; } + virtual void SetPassword(const wxString& passwd ) { m_password = passwd; } + +protected: + enum wxHTTP_Req + { + wxHTTP_GET, + wxHTTP_POST, + wxHTTP_HEAD + }; + + typedef wxStringToStringHashMap::iterator wxHeaderIterator; + typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator; + + bool BuildRequest(const wxString& path, wxHTTP_Req req); + void SendHeaders(); + bool ParseHeaders(); + + wxString GenerateAuthString(const wxString& user, const wxString& pass) const; + + // find the header in m_headers + wxHeaderIterator FindHeader(const wxString& header); + wxHeaderConstIterator FindHeader(const wxString& header) const; + + // deletes the header value strings + void ClearHeaders(); + + wxProtocolError m_perr; + wxStringToStringHashMap m_headers; + bool m_read, + m_proxy_mode; + wxSockAddress *m_addr; + wxString m_post_buf; + int m_http_response; + wxString m_username; + wxString m_password; + + DECLARE_DYNAMIC_CLASS(wxHTTP) + DECLARE_PROTOCOL(wxHTTP) + DECLARE_NO_COPY_CLASS(wxHTTP) +}; + +#endif // wxUSE_PROTOCOL_HTTP + +#endif // _WX_HTTP_H + diff --git a/Externals/wxWidgets/include/wx/protocol/protocol.h b/Externals/wxWidgets/include/wx/protocol/protocol.h index 8000616683..5fd35ac0ab 100644 --- a/Externals/wxWidgets/include/wx/protocol/protocol.h +++ b/Externals/wxWidgets/include/wx/protocol/protocol.h @@ -1,131 +1,131 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/protocol/protocol.h -// Purpose: Protocol base class -// Author: Guilhem Lavaux -// Modified by: -// Created: 10/07/1997 -// RCS-ID: $Id: protocol.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PROTOCOL_PROTOCOL_H -#define _WX_PROTOCOL_PROTOCOL_H - -#include "wx/defs.h" - -#if wxUSE_PROTOCOL - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/stream.h" - -#if wxUSE_SOCKETS - #include "wx/socket.h" -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -typedef enum -{ - wxPROTO_NOERR = 0, - wxPROTO_NETERR, - wxPROTO_PROTERR, - wxPROTO_CONNERR, - wxPROTO_INVVAL, - wxPROTO_NOHNDLR, - wxPROTO_NOFILE, - wxPROTO_ABRT, - wxPROTO_RCNCT, - wxPROTO_STREAMING -} wxProtocolError; - -// ---------------------------------------------------------------------------- -// wxProtocol: abstract base class for all protocols -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_NET wxProtocol -#if wxUSE_SOCKETS - : public wxSocketClient -#else - : public wxObject -#endif -{ -public: - wxProtocol(); - -#if wxUSE_SOCKETS - bool Reconnect(); - virtual bool Connect( const wxString& WXUNUSED(host) ) { return FALSE; } - virtual bool Connect( wxSockAddress& addr, bool WXUNUSED(wait) = TRUE) { return wxSocketClient::Connect(addr); } - - // read a '\r\n' terminated line from the given socket and put it in - // result (without the terminators) - static wxProtocolError ReadLine(wxSocketBase *socket, wxString& result); - - // read a line from this socket - this one can be overridden in the - // derived classes if different line termination convention is to be used - virtual wxProtocolError ReadLine(wxString& result); -#endif // wxUSE_SOCKETS - - virtual bool Abort() = 0; - virtual wxInputStream *GetInputStream(const wxString& path) = 0; - virtual wxProtocolError GetError() = 0; - virtual wxString GetContentType() { return wxEmptyString; } - virtual void SetUser(const wxString& WXUNUSED(user)) {} - virtual void SetPassword(const wxString& WXUNUSED(passwd) ) {} - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxProtocol) -}; - -#if wxUSE_SOCKETS -wxProtocolError WXDLLIMPEXP_NET GetLine(wxSocketBase *sock, wxString& result); -#endif - -// ---------------------------------------------------------------------------- -// macros for protocol classes -// ---------------------------------------------------------------------------- - -#define DECLARE_PROTOCOL(class) \ -public: \ - static wxProtoInfo g_proto_##class; - -#define IMPLEMENT_PROTOCOL(class, name, serv, host) \ -wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class)); \ -bool wxProtocolUse##class = TRUE; - -#define USE_PROTOCOL(class) \ - extern bool wxProtocolUse##class ; \ - static struct wxProtocolUserFor##class \ - { \ - wxProtocolUserFor##class() { wxProtocolUse##class = TRUE; } \ - } wxProtocolDoUse##class; - -class WXDLLIMPEXP_NET wxProtoInfo : public wxObject -{ -public: - wxProtoInfo(const wxChar *name, - const wxChar *serv_name, - const bool need_host1, - wxClassInfo *info); - -protected: - wxProtoInfo *next; - wxString m_protoname; - wxString prefix; - wxString m_servname; - wxClassInfo *m_cinfo; - bool m_needhost; - - friend class wxURL; - - DECLARE_DYNAMIC_CLASS(wxProtoInfo) - DECLARE_NO_COPY_CLASS(wxProtoInfo) -}; - -#endif // wxUSE_PROTOCOL - -#endif // _WX_PROTOCOL_PROTOCOL_H +///////////////////////////////////////////////////////////////////////////// +// Name: wx/protocol/protocol.h +// Purpose: Protocol base class +// Author: Guilhem Lavaux +// Modified by: +// Created: 10/07/1997 +// RCS-ID: $Id: protocol.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROTOCOL_PROTOCOL_H +#define _WX_PROTOCOL_PROTOCOL_H + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/stream.h" + +#if wxUSE_SOCKETS + #include "wx/socket.h" +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +typedef enum +{ + wxPROTO_NOERR = 0, + wxPROTO_NETERR, + wxPROTO_PROTERR, + wxPROTO_CONNERR, + wxPROTO_INVVAL, + wxPROTO_NOHNDLR, + wxPROTO_NOFILE, + wxPROTO_ABRT, + wxPROTO_RCNCT, + wxPROTO_STREAMING +} wxProtocolError; + +// ---------------------------------------------------------------------------- +// wxProtocol: abstract base class for all protocols +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxProtocol +#if wxUSE_SOCKETS + : public wxSocketClient +#else + : public wxObject +#endif +{ +public: + wxProtocol(); + +#if wxUSE_SOCKETS + bool Reconnect(); + virtual bool Connect( const wxString& WXUNUSED(host) ) { return FALSE; } + virtual bool Connect( wxSockAddress& addr, bool WXUNUSED(wait) = TRUE) { return wxSocketClient::Connect(addr); } + + // read a '\r\n' terminated line from the given socket and put it in + // result (without the terminators) + static wxProtocolError ReadLine(wxSocketBase *socket, wxString& result); + + // read a line from this socket - this one can be overridden in the + // derived classes if different line termination convention is to be used + virtual wxProtocolError ReadLine(wxString& result); +#endif // wxUSE_SOCKETS + + virtual bool Abort() = 0; + virtual wxInputStream *GetInputStream(const wxString& path) = 0; + virtual wxProtocolError GetError() = 0; + virtual wxString GetContentType() { return wxEmptyString; } + virtual void SetUser(const wxString& WXUNUSED(user)) {} + virtual void SetPassword(const wxString& WXUNUSED(passwd) ) {} + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxProtocol) +}; + +#if wxUSE_SOCKETS +wxProtocolError WXDLLIMPEXP_NET GetLine(wxSocketBase *sock, wxString& result); +#endif + +// ---------------------------------------------------------------------------- +// macros for protocol classes +// ---------------------------------------------------------------------------- + +#define DECLARE_PROTOCOL(class) \ +public: \ + static wxProtoInfo g_proto_##class; + +#define IMPLEMENT_PROTOCOL(class, name, serv, host) \ +wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class)); \ +bool wxProtocolUse##class = TRUE; + +#define USE_PROTOCOL(class) \ + extern bool wxProtocolUse##class ; \ + static struct wxProtocolUserFor##class \ + { \ + wxProtocolUserFor##class() { wxProtocolUse##class = TRUE; } \ + } wxProtocolDoUse##class; + +class WXDLLIMPEXP_NET wxProtoInfo : public wxObject +{ +public: + wxProtoInfo(const wxChar *name, + const wxChar *serv_name, + const bool need_host1, + wxClassInfo *info); + +protected: + wxProtoInfo *next; + wxString m_protoname; + wxString prefix; + wxString m_servname; + wxClassInfo *m_cinfo; + bool m_needhost; + + friend class wxURL; + + DECLARE_DYNAMIC_CLASS(wxProtoInfo) + DECLARE_NO_COPY_CLASS(wxProtoInfo) +}; + +#endif // wxUSE_PROTOCOL + +#endif // _WX_PROTOCOL_PROTOCOL_H diff --git a/Externals/wxWidgets/include/wx/ptr_scpd.h b/Externals/wxWidgets/include/wx/ptr_scpd.h index 19c6588b7e..e78d53fb60 100644 --- a/Externals/wxWidgets/include/wx/ptr_scpd.h +++ b/Externals/wxWidgets/include/wx/ptr_scpd.h @@ -1,222 +1,222 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/ptr_scpd.h -// Purpose: scoped smart pointer class -// Author: Jesse Lovelace <jllovela@eos.ncsu.edu> -// Modified by: -// Created: 06/01/02 -// RCS-ID: $Id: ptr_scpd.h 35688 2005-09-25 19:59:19Z VZ $ -// Copyright: (c) Jesse Lovelace and original Boost authors (see below) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// This class closely follows the implementation of the boost -// library scoped_ptr and is an adaption for c++ macro's in -// the wxWidgets project. The original authors of the boost -// scoped_ptr are given below with their respective copyrights. - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation. -// - -#ifndef __WX_SCOPED_POINTER__ -#define __WX_SCOPED_POINTER__ - -#include "wx/defs.h" - -/* - checked deleters are used to make sure that the type being deleted is really - a complete type.: otherwise sizeof() would result in a compile-time error - - do { ... } while ( 0 ) construct is used to have an anonymous scope - (otherwise we could have name clashes between different "complete"s) but - still force a semicolon after the macro -*/ - -#ifdef __WATCOMC__ - #define wxFOR_ONCE(name) for(int name=0; name<1; name++) - #define wxPRE_NO_WARNING_SCOPE(name) wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name)) - #define wxPOST_NO_WARNING_SCOPE(name) -#else - #define wxPRE_NO_WARNING_SCOPE(name) do - #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse ) -#endif - -#define wxCHECKED_DELETE(ptr) \ - wxPRE_NO_WARNING_SCOPE(scope_var1) \ - { \ - typedef char complete[sizeof(*ptr)]; \ - delete ptr; \ - } wxPOST_NO_WARNING_SCOPE(scope_var1) - -#define wxCHECKED_DELETE_ARRAY(ptr) \ - wxPRE_NO_WARNING_SCOPE(scope_var2) \ - { \ - typedef char complete[sizeof(*ptr)]; \ - delete [] ptr; \ - } wxPOST_NO_WARNING_SCOPE(scope_var2) - -/* These scoped pointers are *not* assignable and cannot be used - within a container. Look for wxDECLARE_SHARED_PTR for this - functionality. - - In addition, the type being used *must* be complete at the time - that wxDEFINE_SCOPED_* is called or a compiler error will result. - This is because the class checks for the completeness of the type - being used. -*/ - - -#define wxDECLARE_SCOPED_PTR(T, name) \ -class name \ -{ \ -private: \ - T * m_ptr; \ - \ - name(name const &); \ - name & operator=(name const &); \ - \ -public: \ - wxEXPLICIT name(T * ptr = NULL) \ - : m_ptr(ptr) { } \ - \ - ~name(); \ - \ - void reset(T * ptr = NULL) \ - { \ - if (m_ptr != ptr) \ - { \ - delete m_ptr; \ - m_ptr = ptr; \ - } \ - } \ - \ - T *release() \ - { \ - T *ptr = m_ptr; \ - m_ptr = NULL; \ - return ptr; \ - } \ - \ - T & operator*() const \ - { \ - wxASSERT(m_ptr != NULL); \ - return *m_ptr; \ - } \ - \ - T * operator->() const \ - { \ - wxASSERT(m_ptr != NULL); \ - return m_ptr; \ - } \ - \ - T * get() const \ - { \ - return m_ptr; \ - } \ - \ - void swap(name & ot) \ - { \ - T * tmp = ot.m_ptr; \ - ot.m_ptr = m_ptr; \ - m_ptr = tmp; \ - } \ -}; - -#define wxDEFINE_SCOPED_PTR(T, name)\ -name::~name() \ -{ \ - wxCHECKED_DELETE(m_ptr); \ -} - -// this macro can be used for the most common case when you want to declare and -// define the scoped pointer at the same time and want to use the standard -// naming convention: auto pointer to Foo is called FooPtr -#define wxDEFINE_SCOPED_PTR_TYPE(T) \ - wxDECLARE_SCOPED_PTR(T, T ## Ptr) \ - wxDEFINE_SCOPED_PTR(T, T ## Ptr) - -// the same but for arrays instead of simple pointers -#define wxDECLARE_SCOPED_ARRAY(T, name)\ -class name \ -{ \ -private: \ - T * m_ptr; \ - name(name const &); \ - name & operator=(name const &); \ - \ -public: \ - wxEXPLICIT name(T * p = NULL) : m_ptr(p) \ - {} \ - \ - ~name(); \ - void reset(T * p = NULL); \ - \ - T & operator[](long int i) const\ - { \ - wxASSERT(m_ptr != NULL); \ - wxASSERT(i >= 0); \ - return m_ptr[i]; \ - } \ - \ - T * get() const \ - { \ - return m_ptr; \ - } \ - \ - void swap(name & ot) \ - { \ - T * tmp = ot.m_ptr; \ - ot.m_ptr = m_ptr; \ - m_ptr = tmp; \ - } \ -}; - -#define wxDEFINE_SCOPED_ARRAY(T, name) \ -name::~name() \ -{ \ - wxCHECKED_DELETE_ARRAY(m_ptr); \ -} \ -void name::reset(T * p){ \ - if (m_ptr != p) \ - { \ - wxCHECKED_DELETE_ARRAY(m_ptr); \ - m_ptr = p; \ - } \ -} - -// ---------------------------------------------------------------------------- -// "Tied" scoped pointer: same as normal one but also sets the value of -// some other variable to the pointer value -// ---------------------------------------------------------------------------- - -#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \ - wxDEFINE_SCOPED_PTR_TYPE(T) \ - class T ## TiedPtr : public T ## Ptr \ - { \ - public: \ - T ## TiedPtr(T **pp, T *p) \ - : T ## Ptr(p), m_pp(pp) \ - { \ - m_pOld = *pp; \ - *pp = p; \ - } \ - \ - ~ T ## TiedPtr() \ - { \ - *m_pp = m_pOld; \ - } \ - \ - private: \ - T **m_pp; \ - T *m_pOld; \ - }; - -#endif // __WX_SCOPED_POINTER__ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/ptr_scpd.h +// Purpose: scoped smart pointer class +// Author: Jesse Lovelace <jllovela@eos.ncsu.edu> +// Modified by: +// Created: 06/01/02 +// RCS-ID: $Id: ptr_scpd.h 35688 2005-09-25 19:59:19Z VZ $ +// Copyright: (c) Jesse Lovelace and original Boost authors (see below) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// This class closely follows the implementation of the boost +// library scoped_ptr and is an adaption for c++ macro's in +// the wxWidgets project. The original authors of the boost +// scoped_ptr are given below with their respective copyrights. + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation. +// + +#ifndef __WX_SCOPED_POINTER__ +#define __WX_SCOPED_POINTER__ + +#include "wx/defs.h" + +/* + checked deleters are used to make sure that the type being deleted is really + a complete type.: otherwise sizeof() would result in a compile-time error + + do { ... } while ( 0 ) construct is used to have an anonymous scope + (otherwise we could have name clashes between different "complete"s) but + still force a semicolon after the macro +*/ + +#ifdef __WATCOMC__ + #define wxFOR_ONCE(name) for(int name=0; name<1; name++) + #define wxPRE_NO_WARNING_SCOPE(name) wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name)) + #define wxPOST_NO_WARNING_SCOPE(name) +#else + #define wxPRE_NO_WARNING_SCOPE(name) do + #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse ) +#endif + +#define wxCHECKED_DELETE(ptr) \ + wxPRE_NO_WARNING_SCOPE(scope_var1) \ + { \ + typedef char complete[sizeof(*ptr)]; \ + delete ptr; \ + } wxPOST_NO_WARNING_SCOPE(scope_var1) + +#define wxCHECKED_DELETE_ARRAY(ptr) \ + wxPRE_NO_WARNING_SCOPE(scope_var2) \ + { \ + typedef char complete[sizeof(*ptr)]; \ + delete [] ptr; \ + } wxPOST_NO_WARNING_SCOPE(scope_var2) + +/* These scoped pointers are *not* assignable and cannot be used + within a container. Look for wxDECLARE_SHARED_PTR for this + functionality. + + In addition, the type being used *must* be complete at the time + that wxDEFINE_SCOPED_* is called or a compiler error will result. + This is because the class checks for the completeness of the type + being used. +*/ + + +#define wxDECLARE_SCOPED_PTR(T, name) \ +class name \ +{ \ +private: \ + T * m_ptr; \ + \ + name(name const &); \ + name & operator=(name const &); \ + \ +public: \ + wxEXPLICIT name(T * ptr = NULL) \ + : m_ptr(ptr) { } \ + \ + ~name(); \ + \ + void reset(T * ptr = NULL) \ + { \ + if (m_ptr != ptr) \ + { \ + delete m_ptr; \ + m_ptr = ptr; \ + } \ + } \ + \ + T *release() \ + { \ + T *ptr = m_ptr; \ + m_ptr = NULL; \ + return ptr; \ + } \ + \ + T & operator*() const \ + { \ + wxASSERT(m_ptr != NULL); \ + return *m_ptr; \ + } \ + \ + T * operator->() const \ + { \ + wxASSERT(m_ptr != NULL); \ + return m_ptr; \ + } \ + \ + T * get() const \ + { \ + return m_ptr; \ + } \ + \ + void swap(name & ot) \ + { \ + T * tmp = ot.m_ptr; \ + ot.m_ptr = m_ptr; \ + m_ptr = tmp; \ + } \ +}; + +#define wxDEFINE_SCOPED_PTR(T, name)\ +name::~name() \ +{ \ + wxCHECKED_DELETE(m_ptr); \ +} + +// this macro can be used for the most common case when you want to declare and +// define the scoped pointer at the same time and want to use the standard +// naming convention: auto pointer to Foo is called FooPtr +#define wxDEFINE_SCOPED_PTR_TYPE(T) \ + wxDECLARE_SCOPED_PTR(T, T ## Ptr) \ + wxDEFINE_SCOPED_PTR(T, T ## Ptr) + +// the same but for arrays instead of simple pointers +#define wxDECLARE_SCOPED_ARRAY(T, name)\ +class name \ +{ \ +private: \ + T * m_ptr; \ + name(name const &); \ + name & operator=(name const &); \ + \ +public: \ + wxEXPLICIT name(T * p = NULL) : m_ptr(p) \ + {} \ + \ + ~name(); \ + void reset(T * p = NULL); \ + \ + T & operator[](long int i) const\ + { \ + wxASSERT(m_ptr != NULL); \ + wxASSERT(i >= 0); \ + return m_ptr[i]; \ + } \ + \ + T * get() const \ + { \ + return m_ptr; \ + } \ + \ + void swap(name & ot) \ + { \ + T * tmp = ot.m_ptr; \ + ot.m_ptr = m_ptr; \ + m_ptr = tmp; \ + } \ +}; + +#define wxDEFINE_SCOPED_ARRAY(T, name) \ +name::~name() \ +{ \ + wxCHECKED_DELETE_ARRAY(m_ptr); \ +} \ +void name::reset(T * p){ \ + if (m_ptr != p) \ + { \ + wxCHECKED_DELETE_ARRAY(m_ptr); \ + m_ptr = p; \ + } \ +} + +// ---------------------------------------------------------------------------- +// "Tied" scoped pointer: same as normal one but also sets the value of +// some other variable to the pointer value +// ---------------------------------------------------------------------------- + +#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \ + wxDEFINE_SCOPED_PTR_TYPE(T) \ + class T ## TiedPtr : public T ## Ptr \ + { \ + public: \ + T ## TiedPtr(T **pp, T *p) \ + : T ## Ptr(p), m_pp(pp) \ + { \ + m_pOld = *pp; \ + *pp = p; \ + } \ + \ + ~ T ## TiedPtr() \ + { \ + *m_pp = m_pOld; \ + } \ + \ + private: \ + T **m_pp; \ + T *m_pOld; \ + }; + +#endif // __WX_SCOPED_POINTER__ + diff --git a/Externals/wxWidgets/include/wx/quantize.h b/Externals/wxWidgets/include/wx/quantize.h index dd43f7a056..159ccaf88e 100644 --- a/Externals/wxWidgets/include/wx/quantize.h +++ b/Externals/wxWidgets/include/wx/quantize.h @@ -1,76 +1,76 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/quantize.h -// Purpose: wxQuantizer class -// Author: Julian Smart -// Modified by: -// Created: 22/6/2000 -// RCS-ID: $Id: quantize.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_QUANTIZE_H_ -#define _WX_QUANTIZE_H_ - -#include "wx/object.h" - -/* - * From jquant2.c - * - * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - */ - -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxPalette; - -/* - * wxQuantize - * Based on the JPEG quantization code. Reduces the number of colours in a wxImage. - */ - -#define wxQUANTIZE_INCLUDE_WINDOWS_COLOURS 0x01 -#define wxQUANTIZE_RETURN_8BIT_DATA 0x02 -#define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04 - -class WXDLLEXPORT wxQuantize: public wxObject -{ -public: -DECLARE_DYNAMIC_CLASS(wxQuantize) - -//// Constructor - - wxQuantize() {} - virtual ~wxQuantize() {} - -//// Operations - - // Reduce the colours in the source image and put the result into the - // destination image. Both images may be the same, to overwrite the source image. - // Specify an optional palette pointer to receive the resulting palette. - // This palette may be passed to ConvertImageToBitmap, for example. - // If you pass a palette pointer, you must free the palette yourself. - - static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236, - unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); - - // This version sets a palette in the destination image so you don't - // have to manage it yourself. - - static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236, - unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); - -//// Helpers - - // Converts input bitmap(s) into 8bit representation with custom palette - - // in_rows and out_rows are arrays [0..h-1] of pointer to rows - // (in_rows contains w * 3 bytes per row, out_rows w bytes per row) - // fills out_rows with indexes into palette (which is also stored into palette variable) - static void DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours); - -}; - -#endif - // _WX_QUANTIZE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/quantize.h +// Purpose: wxQuantizer class +// Author: Julian Smart +// Modified by: +// Created: 22/6/2000 +// RCS-ID: $Id: quantize.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QUANTIZE_H_ +#define _WX_QUANTIZE_H_ + +#include "wx/object.h" + +/* + * From jquant2.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + */ + +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxPalette; + +/* + * wxQuantize + * Based on the JPEG quantization code. Reduces the number of colours in a wxImage. + */ + +#define wxQUANTIZE_INCLUDE_WINDOWS_COLOURS 0x01 +#define wxQUANTIZE_RETURN_8BIT_DATA 0x02 +#define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04 + +class WXDLLEXPORT wxQuantize: public wxObject +{ +public: +DECLARE_DYNAMIC_CLASS(wxQuantize) + +//// Constructor + + wxQuantize() {} + virtual ~wxQuantize() {} + +//// Operations + + // Reduce the colours in the source image and put the result into the + // destination image. Both images may be the same, to overwrite the source image. + // Specify an optional palette pointer to receive the resulting palette. + // This palette may be passed to ConvertImageToBitmap, for example. + // If you pass a palette pointer, you must free the palette yourself. + + static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236, + unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + + // This version sets a palette in the destination image so you don't + // have to manage it yourself. + + static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236, + unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + +//// Helpers + + // Converts input bitmap(s) into 8bit representation with custom palette + + // in_rows and out_rows are arrays [0..h-1] of pointer to rows + // (in_rows contains w * 3 bytes per row, out_rows w bytes per row) + // fills out_rows with indexes into palette (which is also stored into palette variable) + static void DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours); + +}; + +#endif + // _WX_QUANTIZE_H_ diff --git a/Externals/wxWidgets/include/wx/radiobox.h b/Externals/wxWidgets/include/wx/radiobox.h index 51b75b30e2..27887d38d1 100644 --- a/Externals/wxWidgets/include/wx/radiobox.h +++ b/Externals/wxWidgets/include/wx/radiobox.h @@ -1,180 +1,180 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/radiobox.h -// Purpose: wxRadioBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: radiobox.h 50255 2007-11-26 13:48:36Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBOX_H_BASE_ -#define _WX_RADIOBOX_H_BASE_ - -#if wxUSE_RADIOBOX - -#include "wx/ctrlsub.h" - -#if wxUSE_TOOLTIPS - -#include "wx/dynarray.h" - -class WXDLLIMPEXP_FWD_CORE wxToolTip; - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray); - -#endif // wxUSE_TOOLTIPS - -extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxRadioBoxBase is not a normal base class, but rather a mix-in because the -// real wxRadioBox derives from different classes on different platforms: for -// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable -{ -public: - virtual ~wxRadioBoxBase(); - - // change/query the individual radio button state - virtual bool Enable(unsigned int n, bool enable = true) = 0; - virtual bool Show(unsigned int n, bool show = true) = 0; - virtual bool IsItemEnabled(unsigned int n) const = 0; - virtual bool IsItemShown(unsigned int n) const = 0; - - // return number of columns/rows in this radiobox - unsigned int GetColumnCount() const { return m_numCols; } - unsigned int GetRowCount() const { return m_numRows; } - - // return the item above/below/to the left/right of the given one - int GetNextItem(int item, wxDirection dir, long style) const; - -#if wxUSE_TOOLTIPS - // set the tooltip text for a radio item, empty string unsets any tooltip - void SetItemToolTip(unsigned int item, const wxString& text); - - // get the individual items tooltip; returns NULL if none - wxToolTip *GetItemToolTip(unsigned int item) const - { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; } -#endif // wxUSE_TOOLTIPS - -#if wxUSE_HELP - // set helptext for a particular item, pass an empty string to erase it - void SetItemHelpText(unsigned int n, const wxString& helpText); - - // retrieve helptext for a particular item, empty string means no help text - wxString GetItemHelpText(unsigned int n) const; -#else // wxUSE_HELP - // just silently ignore the help text, it's better than requiring using - // conditional compilation in all code using this function - void SetItemHelpText(unsigned int WXUNUSED(n), - const wxString& WXUNUSED(helpText)) - { - } -#endif // wxUSE_HELP - - // returns the radio item at the given position or wxNOT_FOUND if none - // (currently implemented only under MSW and GTK) - virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const - { - return wxNOT_FOUND; - } - - - // deprecated functions - // -------------------- - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( int GetNumberOfRowsOrCols() const ); - wxDEPRECATED( void SetNumberOfRowsOrCols(int n) ); -#endif // WXWIN_COMPATIBILITY_2_4 - -protected: - wxRadioBoxBase() - { - m_numCols = - m_numRows = - m_majorDim = 0; - -#if wxUSE_TOOLTIPS - m_itemsTooltips = NULL; -#endif // wxUSE_TOOLTIPS - } - - // return the number of items in major direction (which depends on whether - // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style) - unsigned int GetMajorDim() const { return m_majorDim; } - - // sets m_majorDim and also updates m_numCols/Rows - // - // the style parameter should be the style of the radiobox itself - void SetMajorDim(unsigned int majorDim, long style); - -#if wxUSE_TOOLTIPS - // called from SetItemToolTip() to really set the tooltip for the specified - // item in the box (or, if tooltip is NULL, to remove any existing one). - // - // NB: this function should really be pure virtual but to avoid breaking - // the build of the ports for which it's not implemented yet we provide - // an empty stub in the base class for now - virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip); - - // returns true if we have any item tooltips - bool HasItemToolTips() const { return m_itemsTooltips != NULL; } -#endif // wxUSE_TOOLTIPS - -#if wxUSE_HELP - // Retrieve help text for an item: this is a helper for the implementation - // of wxWindow::GetHelpTextAtPoint() in the real radiobox class - wxString DoGetHelpTextAtPoint(const wxWindow *derived, - const wxPoint& pt, - wxHelpEvent::Origin origin) const; -#endif // wxUSE_HELP - -private: - // the number of elements in major dimension (i.e. number of columns if - // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also - // the number of rows/columns calculated from it - unsigned int m_majorDim, - m_numCols, - m_numRows; - -#if wxUSE_TOOLTIPS - // array of tooltips for the individual items - // - // this array is initially NULL and initialized on first use - wxToolTipArray *m_itemsTooltips; -#endif - -#if wxUSE_HELP - // help text associated with a particular item or empty string if none - wxArrayString m_itemsHelpTexts; -#endif // wxUSE_HELP -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/radiobox.h" -#elif defined(__WXMSW__) - #include "wx/msw/radiobox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/radiobox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/radiobox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/radiobox.h" -#elif defined(__WXMAC__) - #include "wx/mac/radiobox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/radiobox.h" -#elif defined(__WXPM__) - #include "wx/os2/radiobox.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/radiobox.h" -#endif - -#endif // wxUSE_RADIOBOX - -#endif // _WX_RADIOBOX_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/radiobox.h +// Purpose: wxRadioBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.09.00 +// RCS-ID: $Id: radiobox.h 50255 2007-11-26 13:48:36Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_BASE_ +#define _WX_RADIOBOX_H_BASE_ + +#if wxUSE_RADIOBOX + +#include "wx/ctrlsub.h" + +#if wxUSE_TOOLTIPS + +#include "wx/dynarray.h" + +class WXDLLIMPEXP_FWD_CORE wxToolTip; + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray); + +#endif // wxUSE_TOOLTIPS + +extern WXDLLEXPORT_DATA(const wxChar) wxRadioBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxRadioBoxBase is not a normal base class, but rather a mix-in because the +// real wxRadioBox derives from different classes on different platforms: for +// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable +{ +public: + virtual ~wxRadioBoxBase(); + + // change/query the individual radio button state + virtual bool Enable(unsigned int n, bool enable = true) = 0; + virtual bool Show(unsigned int n, bool show = true) = 0; + virtual bool IsItemEnabled(unsigned int n) const = 0; + virtual bool IsItemShown(unsigned int n) const = 0; + + // return number of columns/rows in this radiobox + unsigned int GetColumnCount() const { return m_numCols; } + unsigned int GetRowCount() const { return m_numRows; } + + // return the item above/below/to the left/right of the given one + int GetNextItem(int item, wxDirection dir, long style) const; + +#if wxUSE_TOOLTIPS + // set the tooltip text for a radio item, empty string unsets any tooltip + void SetItemToolTip(unsigned int item, const wxString& text); + + // get the individual items tooltip; returns NULL if none + wxToolTip *GetItemToolTip(unsigned int item) const + { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; } +#endif // wxUSE_TOOLTIPS + +#if wxUSE_HELP + // set helptext for a particular item, pass an empty string to erase it + void SetItemHelpText(unsigned int n, const wxString& helpText); + + // retrieve helptext for a particular item, empty string means no help text + wxString GetItemHelpText(unsigned int n) const; +#else // wxUSE_HELP + // just silently ignore the help text, it's better than requiring using + // conditional compilation in all code using this function + void SetItemHelpText(unsigned int WXUNUSED(n), + const wxString& WXUNUSED(helpText)) + { + } +#endif // wxUSE_HELP + + // returns the radio item at the given position or wxNOT_FOUND if none + // (currently implemented only under MSW and GTK) + virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const + { + return wxNOT_FOUND; + } + + + // deprecated functions + // -------------------- + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( int GetNumberOfRowsOrCols() const ); + wxDEPRECATED( void SetNumberOfRowsOrCols(int n) ); +#endif // WXWIN_COMPATIBILITY_2_4 + +protected: + wxRadioBoxBase() + { + m_numCols = + m_numRows = + m_majorDim = 0; + +#if wxUSE_TOOLTIPS + m_itemsTooltips = NULL; +#endif // wxUSE_TOOLTIPS + } + + // return the number of items in major direction (which depends on whether + // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style) + unsigned int GetMajorDim() const { return m_majorDim; } + + // sets m_majorDim and also updates m_numCols/Rows + // + // the style parameter should be the style of the radiobox itself + void SetMajorDim(unsigned int majorDim, long style); + +#if wxUSE_TOOLTIPS + // called from SetItemToolTip() to really set the tooltip for the specified + // item in the box (or, if tooltip is NULL, to remove any existing one). + // + // NB: this function should really be pure virtual but to avoid breaking + // the build of the ports for which it's not implemented yet we provide + // an empty stub in the base class for now + virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip); + + // returns true if we have any item tooltips + bool HasItemToolTips() const { return m_itemsTooltips != NULL; } +#endif // wxUSE_TOOLTIPS + +#if wxUSE_HELP + // Retrieve help text for an item: this is a helper for the implementation + // of wxWindow::GetHelpTextAtPoint() in the real radiobox class + wxString DoGetHelpTextAtPoint(const wxWindow *derived, + const wxPoint& pt, + wxHelpEvent::Origin origin) const; +#endif // wxUSE_HELP + +private: + // the number of elements in major dimension (i.e. number of columns if + // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also + // the number of rows/columns calculated from it + unsigned int m_majorDim, + m_numCols, + m_numRows; + +#if wxUSE_TOOLTIPS + // array of tooltips for the individual items + // + // this array is initially NULL and initialized on first use + wxToolTipArray *m_itemsTooltips; +#endif + +#if wxUSE_HELP + // help text associated with a particular item or empty string if none + wxArrayString m_itemsHelpTexts; +#endif // wxUSE_HELP +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/radiobox.h" +#elif defined(__WXMSW__) + #include "wx/msw/radiobox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/radiobox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/radiobox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/radiobox.h" +#elif defined(__WXMAC__) + #include "wx/mac/radiobox.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/radiobox.h" +#elif defined(__WXPM__) + #include "wx/os2/radiobox.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/radiobox.h" +#endif + +#endif // wxUSE_RADIOBOX + +#endif // _WX_RADIOBOX_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/radiobut.h b/Externals/wxWidgets/include/wx/radiobut.h index 2543ea8dc8..598c44c309 100644 --- a/Externals/wxWidgets/include/wx/radiobut.h +++ b/Externals/wxWidgets/include/wx/radiobut.h @@ -1,61 +1,61 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/radiobut.h -// Purpose: wxRadioButton declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.09.00 -// RCS-ID: $Id: radiobut.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RADIOBUT_H_BASE_ -#define _WX_RADIOBUT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_RADIOBTN - -/* - There is no wxRadioButtonBase class as wxRadioButton interface is the same - as wxCheckBox(Base), but under some platforms wxRadioButton really - derives from wxCheckBox and on the others it doesn't. - - The pseudo-declaration of wxRadioButtonBase would look like this: - - class wxRadioButtonBase : public ... - { - public: - virtual void SetValue(bool value); - virtual bool GetValue() const; - }; - */ - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxRadioButtonNameStr[]; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/radiobut.h" -#elif defined(__WXMSW__) - #include "wx/msw/radiobut.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/radiobut.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/radiobut.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/radiobut.h" -#elif defined(__WXMAC__) - #include "wx/mac/radiobut.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/radiobut.h" -#elif defined(__WXPM__) - #include "wx/os2/radiobut.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/radiobut.h" -#endif - -#endif // wxUSE_RADIOBTN - -#endif - // _WX_RADIOBUT_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/radiobut.h +// Purpose: wxRadioButton declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.09.00 +// RCS-ID: $Id: radiobut.h 37066 2006-01-23 03:27:34Z MR $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_BASE_ +#define _WX_RADIOBUT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_RADIOBTN + +/* + There is no wxRadioButtonBase class as wxRadioButton interface is the same + as wxCheckBox(Base), but under some platforms wxRadioButton really + derives from wxCheckBox and on the others it doesn't. + + The pseudo-declaration of wxRadioButtonBase would look like this: + + class wxRadioButtonBase : public ... + { + public: + virtual void SetValue(bool value); + virtual bool GetValue() const; + }; + */ + +#include "wx/control.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxRadioButtonNameStr[]; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/radiobut.h" +#elif defined(__WXMSW__) + #include "wx/msw/radiobut.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/radiobut.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/radiobut.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/radiobut.h" +#elif defined(__WXMAC__) + #include "wx/mac/radiobut.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/radiobut.h" +#elif defined(__WXPM__) + #include "wx/os2/radiobut.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/radiobut.h" +#endif + +#endif // wxUSE_RADIOBTN + +#endif + // _WX_RADIOBUT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/rawbmp.h b/Externals/wxWidgets/include/wx/rawbmp.h index c46028526f..6360a6de5a 100644 --- a/Externals/wxWidgets/include/wx/rawbmp.h +++ b/Externals/wxWidgets/include/wx/rawbmp.h @@ -1,713 +1,713 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/rawbmp.h -// Purpose: macros for fast, raw bitmap data access -// Author: Eric Kidd, Vadim Zeitlin -// Modified by: -// Created: 10.03.03 -// RCS-ID: $Id: rawbmp.h 41661 2006-10-06 16:34:45Z PC $ -// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RAWBMP_H_BASE_ -#define _WX_RAWBMP_H_BASE_ - -#include "wx/image.h" - -// ---------------------------------------------------------------------------- -// Abstract Pixel API -// -// We need to access our raw bitmap data (1) portably and (2) efficiently. -// We do this using a two-dimensional "iteration" interface. Performance -// is extremely important here: these functions will be called hundreds -// of thousands of times in a row, and even small inefficiencies will -// make applications seem slow. -// -// We can't always rely on inline functions, because not all compilers actually -// bother to inline them unless we crank the optimization levels way up. -// Therefore, we also provide macros to wring maximum speed out of compiler -// unconditionally (e.g. even in debug builds). Of course, if the performance -// isn't absolutely crucial for you you shouldn't be using them but the inline -// functions instead. -// ---------------------------------------------------------------------------- - -/* - Usage example: - - typedef wxPixelData<wxBitmap, wxNativePixelFormat> PixelData; - - wxBitmap bmp; - PixelData data(bmp); - if ( !data ) - { - ... raw access to bitmap data unavailable, do something else ... - return; - } - - if ( data.GetWidth() < 20 || data.GetHeight() < 20 ) - { - ... complain: the bitmap it too small ... - return; - } - - PixelData::Iterator p(data); - - // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b - p.Offset(data, 10, 10); - - for ( int y = 0; y < 10; ++y ) - { - PixelData::Iterator rowStart = p; - - for ( int x = 0; x < 10; ++x, ++p ) - { - p.Red() = r; - p.Green() = g; - p.Blue() = b; - } - - p = rowStart; - p.OffsetY(data, 1); - } - */ - -/* - Note: we do not use WXDLLEXPORT with classes in this file because VC++ has - problems with exporting inner class defined inside a specialization of a - template class from a DLL. Besides, as all the methods are inline it's not - really necessary to put them in DLL at all. - */ - -// ---------------------------------------------------------------------------- -// wxPixelFormat -// ---------------------------------------------------------------------------- - -/* - wxPixelFormat is a template class describing the bitmap data format. It - contains the constants describing the format of pixel data, but does not - describe how the entire bitmap is stored (i.e. top-to-bottom, - bottom-to-top, ...). It is also a "traits"-like class, i.e. it only - contains some constants and maybe static methods but nothing more, so it - can be safely used without incurring any overhead as all accesses to it are - done at compile-time. - - Current limitations: we don't support RAGABA and ARAGAB formats supported - by Mac OS X. If there is sufficient interest, these classes could be - extended to deal with them. Neither do we support alpha channel having - different representation from the RGB ones (happens under QNX/Photon I - think), but again this could be achieved with some small extra effort. - - Template parameters are: - - type of a single pixel component - - size of the single pixel in bits - - indices of red, green and blue pixel components inside the pixel - - index of the alpha component or -1 if none - - type which can contain the full pixel value (all channels) - */ - -template <class Channel, - size_t Bpp, int R, int G, int B, int A = -1, - class Pixel = wxUint32> - -struct wxPixelFormat -{ - // iterator over pixels is usually of type "ChannelType *" - typedef Channel ChannelType; - - // the type which may hold the entire pixel value - typedef Pixel PixelType; - - // NB: using static ints initialized inside the class declaration is not - // portable as it doesn't work with VC++ 6, so we must use enums - - // size of one pixel in bits - enum { BitsPerPixel = Bpp }; - - // size of one pixel in ChannelType units (usually bytes) - enum { SizePixel = Bpp / (8 * sizeof(Channel)) }; - - // the channels indices inside the pixel - enum - { - RED = R, - GREEN = G, - BLUE = B, - ALPHA = A - }; - - // true if we have an alpha channel (together with the other channels, this - // doesn't cover the case of wxImage which stores alpha separately) - enum { HasAlpha = A != -1 }; -}; - -// some "predefined" pixel formats -// ------------------------------- - -// wxImage format is common to all platforms -typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat; - -// the (most common) native bitmap format without alpha support -#if defined(__WXMSW__) - // under MSW the RGB components are reversed, they're in BGR order - typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#elif defined(__WXMAC__) - // under Mac, first component is unused but still present, hence we use - // 32bpp, not 24 - typedef wxPixelFormat<unsigned char, 32, 1, 2, 3> wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 0 -#elif defined(__WXCOCOA__) - // Cocoa is standard RGB or RGBA (normally it is RGBA) - typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#elif defined(__WXGTK__) - // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA - typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 -#endif - -// the (most common) native format for bitmaps with alpha channel -#ifdef wxPIXEL_FORMAT_ALPHA - typedef wxPixelFormat<unsigned char, 32, - wxNativePixelFormat::RED, - wxNativePixelFormat::GREEN, - wxNativePixelFormat::BLUE, - wxPIXEL_FORMAT_ALPHA> wxAlphaPixelFormat; -#endif // wxPIXEL_FORMAT_ALPHA - -// we also define the (default/best) pixel format for the given class: this is -// used as default value for the pixel format in wxPixelIterator template -template <class T> struct wxPixelFormatFor; - -#if wxUSE_IMAGE -// wxPixelFormatFor is only defined for wxImage, attempt to use it with other -// classes (wxBitmap...) will result in compile errors which is exactly what we -// want -template <> -struct wxPixelFormatFor<wxImage> -{ - typedef wxImagePixelFormat Format; -}; -#endif //wxUSE_IMAGE - -// ---------------------------------------------------------------------------- -// wxPixelData -// ---------------------------------------------------------------------------- - -/* - wxPixelDataBase is just a helper for wxPixelData: it contains things common - to both wxImage and wxBitmap specializations. - */ -class wxPixelDataBase -{ -public: - // origin of the rectangular region we represent - wxPoint GetOrigin() const { return m_ptOrigin; } - - // width and height of the region we represent - int GetWidth() const { return m_width; } - int GetHeight() const { return m_height; } - - wxSize GetSize() const { return wxSize(m_width, m_height); } - - // the distance between two rows - int GetRowStride() const { return m_stride; } - -// private: -- see comment in the beginning of the file - - // the origin of this image inside the bigger bitmap (usually (0, 0)) - wxPoint m_ptOrigin; - - // the size of the image we address, in pixels - int m_width, - m_height; - - // this parameter is the offset of the start of the (N+1)st row from the - // Nth one and can be different from m_bypp*width in some cases: - // a) the most usual one is to force 32/64 bit alignment of rows - // b) another one is for bottom-to-top images where it's negative - // c) finally, it could conceivably be 0 for the images with all - // lines being identical - int m_stride; - -protected: - // ctor is protected because this class is only meant to be used as the - // base class by wxPixelData - wxPixelDataBase() - { - m_width = - m_height = - m_stride = 0; - } -}; - -/* - wxPixelData represents the entire bitmap data, i.e. unlike - wxPixelFormat (which it uses) it also stores the global bitmap - characteristics such as its size, inter-row separation and so on. - - Because of this it can be used to move the pixel iterators (which don't - have enough information about the bitmap themselves). This may seem a bit - unnatural but must be done in this way to keep the iterator objects as - small as possible for maximum efficiency as otherwise they wouldn't be put - into the CPU registers by the compiler any more. - - Implementation note: we use the standard workaround for lack of partial - template specialization support in VC (both 6 and 7): instead of partly - specializing the class Foo<T, U> for some T we introduce FooOut<T> and - FooIn<U> nested in it, make Foo<T, U> equivalent to FooOut<T>::FooIn<U> and - fully specialize FooOut. - - Also note that this class doesn't have any default definition because we - can't really do anything without knowing the exact image class. We do - provide wxPixelDataBase to make it simpler to write new wxPixelData - specializations. - */ - -// we need to define this skeleton template to mollify VC++ -template <class Image> -struct wxPixelDataOut -{ - template <class PixelFormat> - class wxPixelDataIn - { - public: - class Iterator { }; - }; -}; - -#if wxUSE_IMAGE -// wxPixelData specialization for wxImage: this is the simplest case as we -// don't have to care about different pixel formats here -template <> -struct wxPixelDataOut<wxImage> -{ - // NB: this is a template class even though it doesn't use its template - // parameter because otherwise wxPixelData couldn't compile - template <class dummyPixelFormat> - class wxPixelDataIn : public wxPixelDataBase - { - public: - // the type of the class we're working with - typedef wxImage ImageType; - - // the iterator which should be used for working with data in this - // format - class Iterator - { - public: - // the pixel format we use - typedef wxImagePixelFormat PixelFormat; - - // the type of the pixel components - typedef typename dummyPixelFormat::ChannelType ChannelType; - - // the pixel data we're working with - typedef - wxPixelDataOut<wxImage>::wxPixelDataIn<PixelFormat> PixelData; - - // go back to (0, 0) - void Reset(const PixelData& data) - { - *this = data.GetPixels(); - } - - // creates the iterator pointing to the beginning of data - Iterator(PixelData& data) - { - Reset(data); - } - - // creates the iterator initially pointing to the image origin - Iterator(const wxImage& image) - { - m_pRGB = image.GetData(); - - if ( image.HasAlpha() ) - { - m_pAlpha = image.GetAlpha(); - } - else // alpha is not used at all - { - m_pAlpha = NULL; - } - } - - // true if the iterator is valid - bool IsOk() const { return m_pRGB != NULL; } - - - // navigation - // ---------- - - // advance the iterator to the next pixel, prefix version - Iterator& operator++() - { - m_pRGB += PixelFormat::SizePixel; - if ( m_pAlpha ) - ++m_pAlpha; - - return *this; - } - - // postfix (hence less efficient -- don't use it unless you - // absolutely must) version - Iterator operator++(int) - { - Iterator p(*this); - ++*this; - return p; - } - - // move x pixels to the right and y down - // - // note that the rows don't wrap! - void Offset(const PixelData& data, int x, int y) - { - m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; - if ( m_pAlpha ) - m_pAlpha += data.GetWidth() + x; - } - - // move x pixels to the right (again, no row wrapping) - void OffsetX(const PixelData& WXUNUSED(data), int x) - { - m_pRGB += PixelFormat::SizePixel*x; - if ( m_pAlpha ) - m_pAlpha += x; - } - - // move y rows to the bottom - void OffsetY(const PixelData& data, int y) - { - m_pRGB += data.GetRowStride()*y; - if ( m_pAlpha ) - m_pAlpha += data.GetWidth(); - } - - // go to the given position - void MoveTo(const PixelData& data, int x, int y) - { - Reset(data); - Offset(data, x, y); - } - - - // data access - // ----------- - - // access to invidividual colour components - ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } - ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } - ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } - ChannelType& Alpha() { return *m_pAlpha; } - - // private: -- see comment in the beginning of the file - - // pointer into RGB buffer - unsigned char *m_pRGB; - - // pointer into alpha buffer or NULL if alpha isn't used - unsigned char *m_pAlpha; - }; - - // initializes us with the data of the given image - wxPixelDataIn(ImageType& image) : m_image(image), m_pixels(image) - { - m_width = image.GetWidth(); - m_height = image.GetHeight(); - m_stride = Iterator::SizePixel * m_width; - } - - // initializes us with the given region of the specified image - wxPixelDataIn(ImageType& image, - const wxPoint& pt, - const wxSize& sz) : m_image(image), m_pixels(image) - { - m_stride = Iterator::SizePixel * m_width; - - InitRect(pt, sz); - } - - // initializes us with the given region of the specified image - wxPixelDataIn(ImageType& image, - const wxRect& rect) : m_image(image), m_pixels(image) - { - m_stride = Iterator::SizePixel * m_width; - - InitRect(rect.GetPosition(), rect.GetSize()); - } - - // we evaluate to true only if we could get access to bitmap data - // successfully - operator bool() const { return m_pixels.IsOk(); } - - // get the iterator pointing to the origin - Iterator GetPixels() const { return m_pixels; } - - private: - void InitRect(const wxPoint& pt, const wxSize& sz) - { - m_width = sz.x; - m_height = sz.y; - - m_ptOrigin = pt; - m_pixels.Offset(*this, pt.x, pt.y); - } - - // the image we're working with - ImageType& m_image; - - // the iterator pointing to the image origin - Iterator m_pixels; - }; -}; -#endif //wxUSE_IMAGE - -#if wxUSE_GUI -// wxPixelData specialization for wxBitmap: here things are more interesting as -// we also have to support different pixel formats -template <> -struct wxPixelDataOut<wxBitmap> -{ - template <class Format> - class wxPixelDataIn : public wxPixelDataBase - { - public: - // the type of the class we're working with - typedef wxBitmap ImageType; - - class Iterator - { - public: - // the pixel format we use - typedef Format PixelFormat; - - // the type of the pixel components - typedef typename PixelFormat::ChannelType ChannelType; - - // the pixel data we're working with - typedef wxPixelDataOut<wxBitmap>::wxPixelDataIn<Format> PixelData; - - - // go back to (0, 0) - void Reset(const PixelData& data) - { - *this = data.GetPixels(); - } - - // initializes the iterator to point to the origin of the given - // pixel data - Iterator(PixelData& data) - { - Reset(data); - } - - // initializes the iterator to point to the origin of the given - // bitmap - Iterator(wxBitmap& bmp, PixelData& data) - { - // using cast here is ugly but it should be safe as - // GetRawData() real return type should be consistent with - // BitsPerPixel (which is in turn defined by ChannelType) and - // this is the only thing we can do without making GetRawData() - // a template function which is undesirable - m_ptr = (ChannelType *) - bmp.GetRawData(data, PixelFormat::BitsPerPixel); - } - - // default constructor - Iterator() - { - m_ptr = NULL; - } - - // return true if this iterator is valid - bool IsOk() const { return m_ptr != NULL; } - - - // navigation - // ---------- - - // advance the iterator to the next pixel, prefix version - Iterator& operator++() - { - m_ptr += PixelFormat::SizePixel; - - return *this; - } - - // postfix (hence less efficient -- don't use it unless you - // absolutely must) version - Iterator operator++(int) - { - Iterator p(*this); - ++*this; - return p; - } - - // move x pixels to the right and y down - // - // note that the rows don't wrap! - void Offset(const PixelData& data, int x, int y) - { - m_ptr += data.GetRowStride()*y + PixelFormat::SizePixel*x; - } - - // move x pixels to the right (again, no row wrapping) - void OffsetX(const PixelData& WXUNUSED(data), int x) - { - m_ptr += PixelFormat::SizePixel*x; - } - - // move y rows to the bottom - void OffsetY(const PixelData& data, int y) - { - m_ptr += data.GetRowStride()*y; - } - - // go to the given position - void MoveTo(const PixelData& data, int x, int y) - { - Reset(data); - Offset(data, x, y); - } - - - // data access - // ----------- - - // access to invidividual colour components - ChannelType& Red() { return m_ptr[PixelFormat::RED]; } - ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } - ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } - ChannelType& Alpha() { return m_ptr[PixelFormat::ALPHA]; } - - // address the pixel contents directly - // - // warning: the format is platform dependent - typename PixelFormat::PixelType& Data() - { return *(typename PixelFormat::PixelType *)m_ptr; } - - // private: -- see comment in the beginning of the file - - // for efficiency reasons this class should not have any other - // fields, otherwise it won't be put into a CPU register (as it - // should inside the inner loops) by some compilers, notably gcc - ChannelType *m_ptr; - }; - - // ctor associates this pointer with a bitmap and locks the bitmap for - // raw access, it will be unlocked only by our dtor and so these - // objects should normally be only created on the stack, i.e. have - // limited life-time - wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this) - { - } - - wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) - : m_bmp(bmp), m_pixels(bmp, *this) - { - InitRect(rect.GetPosition(), rect.GetSize()); - } - - wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz) - : m_bmp(bmp), m_pixels(bmp, *this) - { - InitRect(pt, sz); - } - - // we evaluate to true only if we could get access to bitmap data - // successfully - operator bool() const { return m_pixels.IsOk(); } - - // get the iterator pointing to the origin - Iterator GetPixels() const { return m_pixels; } - - // dtor unlocks the bitmap - ~wxPixelDataIn() - { - m_bmp.UngetRawData(*this); - } - - // call this to indicate that we should use the alpha channel - void UseAlpha() { m_bmp.UseAlpha(); } - - // private: -- see comment in the beginning of the file - - // the bitmap we're associated with - wxBitmap m_bmp; - - // the iterator pointing to the image origin - Iterator m_pixels; - - private: - void InitRect(const wxPoint& pt, const wxSize& sz) - { - m_pixels.Offset(*this, pt.x, pt.y); - - m_ptOrigin = pt; - m_width = sz.x; - m_height = sz.y; - } - }; -}; -#endif //wxUSE_GUI - -template <class Image, class PixelFormat = wxPixelFormatFor<Image> > -class wxPixelData : - public wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> -{ -public: - typedef - typename wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> - Base; - - wxPixelData(Image& image) : Base(image) { } - - wxPixelData(Image& i, const wxRect& rect) : Base(i, rect) { } - - wxPixelData(Image& i, const wxPoint& pt, const wxSize& sz) - : Base(i, pt, sz) - { - } -}; - - -// some "predefined" pixel data classes -#if wxUSE_IMAGE -typedef wxPixelData<wxImage> wxImagePixelData; -#endif //wxUSE_IMAGE -#if wxUSE_GUI -typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData; -typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData; - -#endif //wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxPixelIterator -// ---------------------------------------------------------------------------- - -/* - wxPixel::Iterator represents something which points to the pixel data and - allows us to iterate over it. In the simplest case of wxBitmap it is, - indeed, just a pointer, but it can be something more complicated and, - moreover, you are free to specialize it for other image classes and bitmap - formats. - - Note that although it would have been much more intuitive to have a real - class here instead of what we have now, this class would need two template - parameters, and this can't be done because we'd need compiler support for - partial template specialization then and neither VC6 nor VC7 provide it. - */ -template < class Image, class PixelFormat = wxPixelFormatFor<Image> > -struct wxPixelIterator : public wxPixelData<Image, PixelFormat>::Iterator -{ -}; - -#endif // _WX_RAWBMP_H_BASE_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/rawbmp.h +// Purpose: macros for fast, raw bitmap data access +// Author: Eric Kidd, Vadim Zeitlin +// Modified by: +// Created: 10.03.03 +// RCS-ID: $Id: rawbmp.h 41661 2006-10-06 16:34:45Z PC $ +// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RAWBMP_H_BASE_ +#define _WX_RAWBMP_H_BASE_ + +#include "wx/image.h" + +// ---------------------------------------------------------------------------- +// Abstract Pixel API +// +// We need to access our raw bitmap data (1) portably and (2) efficiently. +// We do this using a two-dimensional "iteration" interface. Performance +// is extremely important here: these functions will be called hundreds +// of thousands of times in a row, and even small inefficiencies will +// make applications seem slow. +// +// We can't always rely on inline functions, because not all compilers actually +// bother to inline them unless we crank the optimization levels way up. +// Therefore, we also provide macros to wring maximum speed out of compiler +// unconditionally (e.g. even in debug builds). Of course, if the performance +// isn't absolutely crucial for you you shouldn't be using them but the inline +// functions instead. +// ---------------------------------------------------------------------------- + +/* + Usage example: + + typedef wxPixelData<wxBitmap, wxNativePixelFormat> PixelData; + + wxBitmap bmp; + PixelData data(bmp); + if ( !data ) + { + ... raw access to bitmap data unavailable, do something else ... + return; + } + + if ( data.GetWidth() < 20 || data.GetHeight() < 20 ) + { + ... complain: the bitmap it too small ... + return; + } + + PixelData::Iterator p(data); + + // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b + p.Offset(data, 10, 10); + + for ( int y = 0; y < 10; ++y ) + { + PixelData::Iterator rowStart = p; + + for ( int x = 0; x < 10; ++x, ++p ) + { + p.Red() = r; + p.Green() = g; + p.Blue() = b; + } + + p = rowStart; + p.OffsetY(data, 1); + } + */ + +/* + Note: we do not use WXDLLEXPORT with classes in this file because VC++ has + problems with exporting inner class defined inside a specialization of a + template class from a DLL. Besides, as all the methods are inline it's not + really necessary to put them in DLL at all. + */ + +// ---------------------------------------------------------------------------- +// wxPixelFormat +// ---------------------------------------------------------------------------- + +/* + wxPixelFormat is a template class describing the bitmap data format. It + contains the constants describing the format of pixel data, but does not + describe how the entire bitmap is stored (i.e. top-to-bottom, + bottom-to-top, ...). It is also a "traits"-like class, i.e. it only + contains some constants and maybe static methods but nothing more, so it + can be safely used without incurring any overhead as all accesses to it are + done at compile-time. + + Current limitations: we don't support RAGABA and ARAGAB formats supported + by Mac OS X. If there is sufficient interest, these classes could be + extended to deal with them. Neither do we support alpha channel having + different representation from the RGB ones (happens under QNX/Photon I + think), but again this could be achieved with some small extra effort. + + Template parameters are: + - type of a single pixel component + - size of the single pixel in bits + - indices of red, green and blue pixel components inside the pixel + - index of the alpha component or -1 if none + - type which can contain the full pixel value (all channels) + */ + +template <class Channel, + size_t Bpp, int R, int G, int B, int A = -1, + class Pixel = wxUint32> + +struct wxPixelFormat +{ + // iterator over pixels is usually of type "ChannelType *" + typedef Channel ChannelType; + + // the type which may hold the entire pixel value + typedef Pixel PixelType; + + // NB: using static ints initialized inside the class declaration is not + // portable as it doesn't work with VC++ 6, so we must use enums + + // size of one pixel in bits + enum { BitsPerPixel = Bpp }; + + // size of one pixel in ChannelType units (usually bytes) + enum { SizePixel = Bpp / (8 * sizeof(Channel)) }; + + // the channels indices inside the pixel + enum + { + RED = R, + GREEN = G, + BLUE = B, + ALPHA = A + }; + + // true if we have an alpha channel (together with the other channels, this + // doesn't cover the case of wxImage which stores alpha separately) + enum { HasAlpha = A != -1 }; +}; + +// some "predefined" pixel formats +// ------------------------------- + +// wxImage format is common to all platforms +typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat; + +// the (most common) native bitmap format without alpha support +#if defined(__WXMSW__) + // under MSW the RGB components are reversed, they're in BGR order + typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXMAC__) + // under Mac, first component is unused but still present, hence we use + // 32bpp, not 24 + typedef wxPixelFormat<unsigned char, 32, 1, 2, 3> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 0 +#elif defined(__WXCOCOA__) + // Cocoa is standard RGB or RGBA (normally it is RGBA) + typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXGTK__) + // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA + typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#endif + +// the (most common) native format for bitmaps with alpha channel +#ifdef wxPIXEL_FORMAT_ALPHA + typedef wxPixelFormat<unsigned char, 32, + wxNativePixelFormat::RED, + wxNativePixelFormat::GREEN, + wxNativePixelFormat::BLUE, + wxPIXEL_FORMAT_ALPHA> wxAlphaPixelFormat; +#endif // wxPIXEL_FORMAT_ALPHA + +// we also define the (default/best) pixel format for the given class: this is +// used as default value for the pixel format in wxPixelIterator template +template <class T> struct wxPixelFormatFor; + +#if wxUSE_IMAGE +// wxPixelFormatFor is only defined for wxImage, attempt to use it with other +// classes (wxBitmap...) will result in compile errors which is exactly what we +// want +template <> +struct wxPixelFormatFor<wxImage> +{ + typedef wxImagePixelFormat Format; +}; +#endif //wxUSE_IMAGE + +// ---------------------------------------------------------------------------- +// wxPixelData +// ---------------------------------------------------------------------------- + +/* + wxPixelDataBase is just a helper for wxPixelData: it contains things common + to both wxImage and wxBitmap specializations. + */ +class wxPixelDataBase +{ +public: + // origin of the rectangular region we represent + wxPoint GetOrigin() const { return m_ptOrigin; } + + // width and height of the region we represent + int GetWidth() const { return m_width; } + int GetHeight() const { return m_height; } + + wxSize GetSize() const { return wxSize(m_width, m_height); } + + // the distance between two rows + int GetRowStride() const { return m_stride; } + +// private: -- see comment in the beginning of the file + + // the origin of this image inside the bigger bitmap (usually (0, 0)) + wxPoint m_ptOrigin; + + // the size of the image we address, in pixels + int m_width, + m_height; + + // this parameter is the offset of the start of the (N+1)st row from the + // Nth one and can be different from m_bypp*width in some cases: + // a) the most usual one is to force 32/64 bit alignment of rows + // b) another one is for bottom-to-top images where it's negative + // c) finally, it could conceivably be 0 for the images with all + // lines being identical + int m_stride; + +protected: + // ctor is protected because this class is only meant to be used as the + // base class by wxPixelData + wxPixelDataBase() + { + m_width = + m_height = + m_stride = 0; + } +}; + +/* + wxPixelData represents the entire bitmap data, i.e. unlike + wxPixelFormat (which it uses) it also stores the global bitmap + characteristics such as its size, inter-row separation and so on. + + Because of this it can be used to move the pixel iterators (which don't + have enough information about the bitmap themselves). This may seem a bit + unnatural but must be done in this way to keep the iterator objects as + small as possible for maximum efficiency as otherwise they wouldn't be put + into the CPU registers by the compiler any more. + + Implementation note: we use the standard workaround for lack of partial + template specialization support in VC (both 6 and 7): instead of partly + specializing the class Foo<T, U> for some T we introduce FooOut<T> and + FooIn<U> nested in it, make Foo<T, U> equivalent to FooOut<T>::FooIn<U> and + fully specialize FooOut. + + Also note that this class doesn't have any default definition because we + can't really do anything without knowing the exact image class. We do + provide wxPixelDataBase to make it simpler to write new wxPixelData + specializations. + */ + +// we need to define this skeleton template to mollify VC++ +template <class Image> +struct wxPixelDataOut +{ + template <class PixelFormat> + class wxPixelDataIn + { + public: + class Iterator { }; + }; +}; + +#if wxUSE_IMAGE +// wxPixelData specialization for wxImage: this is the simplest case as we +// don't have to care about different pixel formats here +template <> +struct wxPixelDataOut<wxImage> +{ + // NB: this is a template class even though it doesn't use its template + // parameter because otherwise wxPixelData couldn't compile + template <class dummyPixelFormat> + class wxPixelDataIn : public wxPixelDataBase + { + public: + // the type of the class we're working with + typedef wxImage ImageType; + + // the iterator which should be used for working with data in this + // format + class Iterator + { + public: + // the pixel format we use + typedef wxImagePixelFormat PixelFormat; + + // the type of the pixel components + typedef typename dummyPixelFormat::ChannelType ChannelType; + + // the pixel data we're working with + typedef + wxPixelDataOut<wxImage>::wxPixelDataIn<PixelFormat> PixelData; + + // go back to (0, 0) + void Reset(const PixelData& data) + { + *this = data.GetPixels(); + } + + // creates the iterator pointing to the beginning of data + Iterator(PixelData& data) + { + Reset(data); + } + + // creates the iterator initially pointing to the image origin + Iterator(const wxImage& image) + { + m_pRGB = image.GetData(); + + if ( image.HasAlpha() ) + { + m_pAlpha = image.GetAlpha(); + } + else // alpha is not used at all + { + m_pAlpha = NULL; + } + } + + // true if the iterator is valid + bool IsOk() const { return m_pRGB != NULL; } + + + // navigation + // ---------- + + // advance the iterator to the next pixel, prefix version + Iterator& operator++() + { + m_pRGB += PixelFormat::SizePixel; + if ( m_pAlpha ) + ++m_pAlpha; + + return *this; + } + + // postfix (hence less efficient -- don't use it unless you + // absolutely must) version + Iterator operator++(int) + { + Iterator p(*this); + ++*this; + return p; + } + + // move x pixels to the right and y down + // + // note that the rows don't wrap! + void Offset(const PixelData& data, int x, int y) + { + m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; + if ( m_pAlpha ) + m_pAlpha += data.GetWidth() + x; + } + + // move x pixels to the right (again, no row wrapping) + void OffsetX(const PixelData& WXUNUSED(data), int x) + { + m_pRGB += PixelFormat::SizePixel*x; + if ( m_pAlpha ) + m_pAlpha += x; + } + + // move y rows to the bottom + void OffsetY(const PixelData& data, int y) + { + m_pRGB += data.GetRowStride()*y; + if ( m_pAlpha ) + m_pAlpha += data.GetWidth(); + } + + // go to the given position + void MoveTo(const PixelData& data, int x, int y) + { + Reset(data); + Offset(data, x, y); + } + + + // data access + // ----------- + + // access to invidividual colour components + ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } + ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } + ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } + ChannelType& Alpha() { return *m_pAlpha; } + + // private: -- see comment in the beginning of the file + + // pointer into RGB buffer + unsigned char *m_pRGB; + + // pointer into alpha buffer or NULL if alpha isn't used + unsigned char *m_pAlpha; + }; + + // initializes us with the data of the given image + wxPixelDataIn(ImageType& image) : m_image(image), m_pixels(image) + { + m_width = image.GetWidth(); + m_height = image.GetHeight(); + m_stride = Iterator::SizePixel * m_width; + } + + // initializes us with the given region of the specified image + wxPixelDataIn(ImageType& image, + const wxPoint& pt, + const wxSize& sz) : m_image(image), m_pixels(image) + { + m_stride = Iterator::SizePixel * m_width; + + InitRect(pt, sz); + } + + // initializes us with the given region of the specified image + wxPixelDataIn(ImageType& image, + const wxRect& rect) : m_image(image), m_pixels(image) + { + m_stride = Iterator::SizePixel * m_width; + + InitRect(rect.GetPosition(), rect.GetSize()); + } + + // we evaluate to true only if we could get access to bitmap data + // successfully + operator bool() const { return m_pixels.IsOk(); } + + // get the iterator pointing to the origin + Iterator GetPixels() const { return m_pixels; } + + private: + void InitRect(const wxPoint& pt, const wxSize& sz) + { + m_width = sz.x; + m_height = sz.y; + + m_ptOrigin = pt; + m_pixels.Offset(*this, pt.x, pt.y); + } + + // the image we're working with + ImageType& m_image; + + // the iterator pointing to the image origin + Iterator m_pixels; + }; +}; +#endif //wxUSE_IMAGE + +#if wxUSE_GUI +// wxPixelData specialization for wxBitmap: here things are more interesting as +// we also have to support different pixel formats +template <> +struct wxPixelDataOut<wxBitmap> +{ + template <class Format> + class wxPixelDataIn : public wxPixelDataBase + { + public: + // the type of the class we're working with + typedef wxBitmap ImageType; + + class Iterator + { + public: + // the pixel format we use + typedef Format PixelFormat; + + // the type of the pixel components + typedef typename PixelFormat::ChannelType ChannelType; + + // the pixel data we're working with + typedef wxPixelDataOut<wxBitmap>::wxPixelDataIn<Format> PixelData; + + + // go back to (0, 0) + void Reset(const PixelData& data) + { + *this = data.GetPixels(); + } + + // initializes the iterator to point to the origin of the given + // pixel data + Iterator(PixelData& data) + { + Reset(data); + } + + // initializes the iterator to point to the origin of the given + // bitmap + Iterator(wxBitmap& bmp, PixelData& data) + { + // using cast here is ugly but it should be safe as + // GetRawData() real return type should be consistent with + // BitsPerPixel (which is in turn defined by ChannelType) and + // this is the only thing we can do without making GetRawData() + // a template function which is undesirable + m_ptr = (ChannelType *) + bmp.GetRawData(data, PixelFormat::BitsPerPixel); + } + + // default constructor + Iterator() + { + m_ptr = NULL; + } + + // return true if this iterator is valid + bool IsOk() const { return m_ptr != NULL; } + + + // navigation + // ---------- + + // advance the iterator to the next pixel, prefix version + Iterator& operator++() + { + m_ptr += PixelFormat::SizePixel; + + return *this; + } + + // postfix (hence less efficient -- don't use it unless you + // absolutely must) version + Iterator operator++(int) + { + Iterator p(*this); + ++*this; + return p; + } + + // move x pixels to the right and y down + // + // note that the rows don't wrap! + void Offset(const PixelData& data, int x, int y) + { + m_ptr += data.GetRowStride()*y + PixelFormat::SizePixel*x; + } + + // move x pixels to the right (again, no row wrapping) + void OffsetX(const PixelData& WXUNUSED(data), int x) + { + m_ptr += PixelFormat::SizePixel*x; + } + + // move y rows to the bottom + void OffsetY(const PixelData& data, int y) + { + m_ptr += data.GetRowStride()*y; + } + + // go to the given position + void MoveTo(const PixelData& data, int x, int y) + { + Reset(data); + Offset(data, x, y); + } + + + // data access + // ----------- + + // access to invidividual colour components + ChannelType& Red() { return m_ptr[PixelFormat::RED]; } + ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } + ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } + ChannelType& Alpha() { return m_ptr[PixelFormat::ALPHA]; } + + // address the pixel contents directly + // + // warning: the format is platform dependent + typename PixelFormat::PixelType& Data() + { return *(typename PixelFormat::PixelType *)m_ptr; } + + // private: -- see comment in the beginning of the file + + // for efficiency reasons this class should not have any other + // fields, otherwise it won't be put into a CPU register (as it + // should inside the inner loops) by some compilers, notably gcc + ChannelType *m_ptr; + }; + + // ctor associates this pointer with a bitmap and locks the bitmap for + // raw access, it will be unlocked only by our dtor and so these + // objects should normally be only created on the stack, i.e. have + // limited life-time + wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this) + { + } + + wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) + : m_bmp(bmp), m_pixels(bmp, *this) + { + InitRect(rect.GetPosition(), rect.GetSize()); + } + + wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz) + : m_bmp(bmp), m_pixels(bmp, *this) + { + InitRect(pt, sz); + } + + // we evaluate to true only if we could get access to bitmap data + // successfully + operator bool() const { return m_pixels.IsOk(); } + + // get the iterator pointing to the origin + Iterator GetPixels() const { return m_pixels; } + + // dtor unlocks the bitmap + ~wxPixelDataIn() + { + m_bmp.UngetRawData(*this); + } + + // call this to indicate that we should use the alpha channel + void UseAlpha() { m_bmp.UseAlpha(); } + + // private: -- see comment in the beginning of the file + + // the bitmap we're associated with + wxBitmap m_bmp; + + // the iterator pointing to the image origin + Iterator m_pixels; + + private: + void InitRect(const wxPoint& pt, const wxSize& sz) + { + m_pixels.Offset(*this, pt.x, pt.y); + + m_ptOrigin = pt; + m_width = sz.x; + m_height = sz.y; + } + }; +}; +#endif //wxUSE_GUI + +template <class Image, class PixelFormat = wxPixelFormatFor<Image> > +class wxPixelData : + public wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> +{ +public: + typedef + typename wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> + Base; + + wxPixelData(Image& image) : Base(image) { } + + wxPixelData(Image& i, const wxRect& rect) : Base(i, rect) { } + + wxPixelData(Image& i, const wxPoint& pt, const wxSize& sz) + : Base(i, pt, sz) + { + } +}; + + +// some "predefined" pixel data classes +#if wxUSE_IMAGE +typedef wxPixelData<wxImage> wxImagePixelData; +#endif //wxUSE_IMAGE +#if wxUSE_GUI +typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData; +typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData; + +#endif //wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxPixelIterator +// ---------------------------------------------------------------------------- + +/* + wxPixel::Iterator represents something which points to the pixel data and + allows us to iterate over it. In the simplest case of wxBitmap it is, + indeed, just a pointer, but it can be something more complicated and, + moreover, you are free to specialize it for other image classes and bitmap + formats. + + Note that although it would have been much more intuitive to have a real + class here instead of what we have now, this class would need two template + parameters, and this can't be done because we'd need compiler support for + partial template specialization then and neither VC6 nor VC7 provide it. + */ +template < class Image, class PixelFormat = wxPixelFormatFor<Image> > +struct wxPixelIterator : public wxPixelData<Image, PixelFormat>::Iterator +{ +}; + +#endif // _WX_RAWBMP_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/recguard.h b/Externals/wxWidgets/include/wx/recguard.h index fb206b823d..f2c6ffe022 100644 --- a/Externals/wxWidgets/include/wx/recguard.h +++ b/Externals/wxWidgets/include/wx/recguard.h @@ -1,53 +1,53 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/recguard.h -// Purpose: declaration and implementation of wxRecursionGuard class -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.08.2003 -// RCS-ID: $Id: recguard.h 29243 2004-09-21 18:15:59Z ABX $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RECGUARD_H_ -#define _WX_RECGUARD_H_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxRecursionGuardFlag is used with wxRecursionGuard -// ---------------------------------------------------------------------------- - -typedef int wxRecursionGuardFlag; - -// ---------------------------------------------------------------------------- -// wxRecursionGuard is the simplest way to protect a function from reentrancy -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxRecursionGuard -{ -public: - wxRecursionGuard(wxRecursionGuardFlag& flag) - : m_flag(flag) - { - m_isInside = flag++ != 0; - } - - ~wxRecursionGuard() - { - wxASSERT_MSG( m_flag > 0, _T("unbalanced wxRecursionGuards!?") ); - - m_flag--; - } - - bool IsInside() const { return m_isInside; } - -private: - wxRecursionGuardFlag& m_flag; - - // true if the flag had been already set when we were created - bool m_isInside; -}; - -#endif // _WX_RECGUARD_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/recguard.h +// Purpose: declaration and implementation of wxRecursionGuard class +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.2003 +// RCS-ID: $Id: recguard.h 29243 2004-09-21 18:15:59Z ABX $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RECGUARD_H_ +#define _WX_RECGUARD_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxRecursionGuardFlag is used with wxRecursionGuard +// ---------------------------------------------------------------------------- + +typedef int wxRecursionGuardFlag; + +// ---------------------------------------------------------------------------- +// wxRecursionGuard is the simplest way to protect a function from reentrancy +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRecursionGuard +{ +public: + wxRecursionGuard(wxRecursionGuardFlag& flag) + : m_flag(flag) + { + m_isInside = flag++ != 0; + } + + ~wxRecursionGuard() + { + wxASSERT_MSG( m_flag > 0, _T("unbalanced wxRecursionGuards!?") ); + + m_flag--; + } + + bool IsInside() const { return m_isInside; } + +private: + wxRecursionGuardFlag& m_flag; + + // true if the flag had been already set when we were created + bool m_isInside; +}; + +#endif // _WX_RECGUARD_H_ + diff --git a/Externals/wxWidgets/include/wx/regex.h b/Externals/wxWidgets/include/wx/regex.h index 5616d12813..be6724bb87 100644 --- a/Externals/wxWidgets/include/wx/regex.h +++ b/Externals/wxWidgets/include/wx/regex.h @@ -1,166 +1,166 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/regex.h -// Purpose: regular expression matching -// Author: Karsten Ballueder -// Modified by: VZ at 13.07.01 (integrated to wxWin) -// Created: 05.02.2000 -// RCS-ID: $Id: regex.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2000 Karsten Ballueder <ballueder@gmx.net> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_REGEX_H_ -#define _WX_REGEX_H_ - -#include "wx/defs.h" - -#if wxUSE_REGEX - -class WXDLLIMPEXP_FWD_BASE wxString; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// flags for regex compilation: these can be used with Compile() -enum -{ - // use extended regex syntax - wxRE_EXTENDED = 0, - - // use advanced RE syntax (built-in regex only) -#ifdef wxHAS_REGEX_ADVANCED - wxRE_ADVANCED = 1, -#endif - - // use basic RE syntax - wxRE_BASIC = 2, - - // ignore case in match - wxRE_ICASE = 4, - - // only check match, don't set back references - wxRE_NOSUB = 8, - - // if not set, treat '\n' as an ordinary character, otherwise it is - // special: it is not matched by '.' and '^' and '$' always match - // after/before it regardless of the setting of wxRE_NOT[BE]OL - wxRE_NEWLINE = 16, - - // default flags - wxRE_DEFAULT = wxRE_EXTENDED -}; - -// flags for regex matching: these can be used with Matches() -// -// these flags are mainly useful when doing several matches in a long string, -// they can be used to prevent erroneous matches for '^' and '$' -enum -{ - // '^' doesn't match at the start of line - wxRE_NOTBOL = 32, - - // '$' doesn't match at the end of line - wxRE_NOTEOL = 64 -}; - -// ---------------------------------------------------------------------------- -// wxRegEx: a regular expression -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxRegExImpl; - -class WXDLLIMPEXP_BASE wxRegEx -{ -public: - // default ctor: use Compile() later - wxRegEx() { Init(); } - - // create and compile - wxRegEx(const wxString& expr, int flags = wxRE_DEFAULT) - { - Init(); - (void)Compile(expr, flags); - } - - // return true if this is a valid compiled regular expression - bool IsValid() const { return m_impl != NULL; } - - // compile the string into regular expression, return true if ok or false - // if string has a syntax error - bool Compile(const wxString& pattern, int flags = wxRE_DEFAULT); - - // matches the precompiled regular expression against a string, return - // true if matches and false otherwise - // - // flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL - // len may be the length of text (ignored by most system regex libs) - // - // may only be called after successful call to Compile() - bool Matches(const wxChar *text, int flags = 0) const; - bool Matches(const wxChar *text, int flags, size_t len) const; - bool Matches(const wxString& text, int flags = 0) const - { return Matches(text.c_str(), flags, text.length()); } - - // get the start index and the length of the match of the expression - // (index 0) or a bracketed subexpression (index != 0) - // - // may only be called after successful call to Matches() - // - // return false if no match or on error - bool GetMatch(size_t *start, size_t *len, size_t index = 0) const; - - // return the part of string corresponding to the match, empty string is - // returned if match failed - // - // may only be called after successful call to Matches() - wxString GetMatch(const wxString& text, size_t index = 0) const; - - // return the size of the array of matches, i.e. the number of bracketed - // subexpressions plus one for the expression itself, or 0 on error. - // - // may only be called after successful call to Compile() - size_t GetMatchCount() const; - - // replaces the current regular expression in the string pointed to by - // pattern, with the text in replacement and return number of matches - // replaced (maybe 0 if none found) or -1 on error - // - // the replacement text may contain backreferences (\number) which will be - // replaced with the value of the corresponding subexpression in the - // pattern match - // - // maxMatches may be used to limit the number of replacements made, setting - // it to 1, for example, will only replace first occurence (if any) of the - // pattern in the text while default value of 0 means replace all - int Replace(wxString *text, const wxString& replacement, - size_t maxMatches = 0) const; - - // replace the first occurence - int ReplaceFirst(wxString *text, const wxString& replacement) const - { return Replace(text, replacement, 1); } - - // replace all occurences: this is actually a synonym for Replace() - int ReplaceAll(wxString *text, const wxString& replacement) const - { return Replace(text, replacement, 0); } - - // dtor not virtual, don't derive from this class - ~wxRegEx(); - -private: - // common part of all ctors - void Init(); - - // the real guts of this class - wxRegExImpl *m_impl; - - // as long as the class wxRegExImpl is not ref-counted, - // instances of the handle wxRegEx must not be copied. - wxRegEx(const wxRegEx&); - wxRegEx &operator=(const wxRegEx&); -}; - -#endif // wxUSE_REGEX - -#endif // _WX_REGEX_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/regex.h +// Purpose: regular expression matching +// Author: Karsten Ballueder +// Modified by: VZ at 13.07.01 (integrated to wxWin) +// Created: 05.02.2000 +// RCS-ID: $Id: regex.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2000 Karsten Ballueder <ballueder@gmx.net> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGEX_H_ +#define _WX_REGEX_H_ + +#include "wx/defs.h" + +#if wxUSE_REGEX + +class WXDLLIMPEXP_FWD_BASE wxString; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// flags for regex compilation: these can be used with Compile() +enum +{ + // use extended regex syntax + wxRE_EXTENDED = 0, + + // use advanced RE syntax (built-in regex only) +#ifdef wxHAS_REGEX_ADVANCED + wxRE_ADVANCED = 1, +#endif + + // use basic RE syntax + wxRE_BASIC = 2, + + // ignore case in match + wxRE_ICASE = 4, + + // only check match, don't set back references + wxRE_NOSUB = 8, + + // if not set, treat '\n' as an ordinary character, otherwise it is + // special: it is not matched by '.' and '^' and '$' always match + // after/before it regardless of the setting of wxRE_NOT[BE]OL + wxRE_NEWLINE = 16, + + // default flags + wxRE_DEFAULT = wxRE_EXTENDED +}; + +// flags for regex matching: these can be used with Matches() +// +// these flags are mainly useful when doing several matches in a long string, +// they can be used to prevent erroneous matches for '^' and '$' +enum +{ + // '^' doesn't match at the start of line + wxRE_NOTBOL = 32, + + // '$' doesn't match at the end of line + wxRE_NOTEOL = 64 +}; + +// ---------------------------------------------------------------------------- +// wxRegEx: a regular expression +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxRegExImpl; + +class WXDLLIMPEXP_BASE wxRegEx +{ +public: + // default ctor: use Compile() later + wxRegEx() { Init(); } + + // create and compile + wxRegEx(const wxString& expr, int flags = wxRE_DEFAULT) + { + Init(); + (void)Compile(expr, flags); + } + + // return true if this is a valid compiled regular expression + bool IsValid() const { return m_impl != NULL; } + + // compile the string into regular expression, return true if ok or false + // if string has a syntax error + bool Compile(const wxString& pattern, int flags = wxRE_DEFAULT); + + // matches the precompiled regular expression against a string, return + // true if matches and false otherwise + // + // flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL + // len may be the length of text (ignored by most system regex libs) + // + // may only be called after successful call to Compile() + bool Matches(const wxChar *text, int flags = 0) const; + bool Matches(const wxChar *text, int flags, size_t len) const; + bool Matches(const wxString& text, int flags = 0) const + { return Matches(text.c_str(), flags, text.length()); } + + // get the start index and the length of the match of the expression + // (index 0) or a bracketed subexpression (index != 0) + // + // may only be called after successful call to Matches() + // + // return false if no match or on error + bool GetMatch(size_t *start, size_t *len, size_t index = 0) const; + + // return the part of string corresponding to the match, empty string is + // returned if match failed + // + // may only be called after successful call to Matches() + wxString GetMatch(const wxString& text, size_t index = 0) const; + + // return the size of the array of matches, i.e. the number of bracketed + // subexpressions plus one for the expression itself, or 0 on error. + // + // may only be called after successful call to Compile() + size_t GetMatchCount() const; + + // replaces the current regular expression in the string pointed to by + // pattern, with the text in replacement and return number of matches + // replaced (maybe 0 if none found) or -1 on error + // + // the replacement text may contain backreferences (\number) which will be + // replaced with the value of the corresponding subexpression in the + // pattern match + // + // maxMatches may be used to limit the number of replacements made, setting + // it to 1, for example, will only replace first occurence (if any) of the + // pattern in the text while default value of 0 means replace all + int Replace(wxString *text, const wxString& replacement, + size_t maxMatches = 0) const; + + // replace the first occurence + int ReplaceFirst(wxString *text, const wxString& replacement) const + { return Replace(text, replacement, 1); } + + // replace all occurences: this is actually a synonym for Replace() + int ReplaceAll(wxString *text, const wxString& replacement) const + { return Replace(text, replacement, 0); } + + // dtor not virtual, don't derive from this class + ~wxRegEx(); + +private: + // common part of all ctors + void Init(); + + // the real guts of this class + wxRegExImpl *m_impl; + + // as long as the class wxRegExImpl is not ref-counted, + // instances of the handle wxRegEx must not be copied. + wxRegEx(const wxRegEx&); + wxRegEx &operator=(const wxRegEx&); +}; + +#endif // wxUSE_REGEX + +#endif // _WX_REGEX_H_ + diff --git a/Externals/wxWidgets/include/wx/region.h b/Externals/wxWidgets/include/wx/region.h index 2bbaed5e00..32c27cce06 100644 --- a/Externals/wxWidgets/include/wx/region.h +++ b/Externals/wxWidgets/include/wx/region.h @@ -1,300 +1,300 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/region.h -// Purpose: Base header for wxRegion -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: region.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_REGION_H_BASE_ -#define _WX_REGION_H_BASE_ - -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_CORE wxRegion; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// result of wxRegion::Contains() call -enum wxRegionContain -{ - wxOutRegion = 0, - wxPartRegion = 1, - wxInRegion = 2 -}; - -// these constants are used with wxRegion::Combine() in the ports which have -// this method -enum wxRegionOp -{ - // Creates the intersection of the two combined regions. - wxRGN_AND, - - // Creates a copy of the region - wxRGN_COPY, - - // Combines the parts of first region that are not in the second one - wxRGN_DIFF, - - // Creates the union of two combined regions. - wxRGN_OR, - - // Creates the union of two regions except for any overlapping areas. - wxRGN_XOR -}; - -// ---------------------------------------------------------------------------- -// wxRegionBase defines wxRegion API -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRegionBase : public wxGDIObject -{ -public: - // ctors - // ----- - - // none are defined here but the following should be available: -#if 0 - wxRegion(); - wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRegion(const wxRect& rect); - wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE); - wxRegion(const wxBitmap& bmp); - wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); -#endif // 0 - - // operators - // --------- - - bool operator==(const wxRegion& region) const { return IsEqual(region); } - bool operator!=(const wxRegion& region) const { return !(*this == region); } - - - // accessors - // --------- - - bool Ok() const { return IsOk(); } - bool IsOk() const { return m_refData != NULL; } - - // Is region empty? - virtual bool IsEmpty() const = 0; - bool Empty() const { return IsEmpty(); } - - // Is region equal (i.e. covers the same area as another one)? - bool IsEqual(const wxRegion& region) const; - - // Get the bounding box - bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const - { return DoGetBox(x, y, w, h); } - wxRect GetBox() const - { - wxCoord x, y, w, h; - return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect(); - } - - // Test if the given point or rectangle is inside this region - wxRegionContain Contains(wxCoord x, wxCoord y) const - { return DoContainsPoint(x, y); } - wxRegionContain Contains(const wxPoint& pt) const - { return DoContainsPoint(pt.x, pt.y); } - wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const - { return DoContainsRect(wxRect(x, y, w, h)); } - wxRegionContain Contains(const wxRect& rect) const - { return DoContainsRect(rect); } - - - // operations - // ---------- - - virtual void Clear() = 0; - - // Move the region - bool Offset(wxCoord x, wxCoord y) - { return DoOffset(x, y); } - bool Offset(const wxPoint& pt) - { return DoOffset(pt.x, pt.y); } - - // Union rectangle or region with this region. - bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { return DoUnionWithRect(wxRect(x, y, w, h)); } - bool Union(const wxRect& rect) - { return DoUnionWithRect(rect); } - bool Union(const wxRegion& region) - { return DoUnionWithRegion(region); } - -#if wxUSE_IMAGE - // Use the non-transparent pixels of a wxBitmap for the region to combine - // with this region. First version takes transparency from bitmap's mask, - // second lets the user specify the colour to be treated as transparent - // along with an optional tolerance value. - // NOTE: implemented in common/rgncmn.cpp - bool Union(const wxBitmap& bmp); - bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); -#endif // wxUSE_IMAGE - - // Intersect rectangle or region with this one. - bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - bool Intersect(const wxRect& rect); - bool Intersect(const wxRegion& region) - { return DoIntersect(region); } - - // Subtract rectangle or region from this: - // Combines the parts of 'this' that are not part of the second region. - bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - bool Subtract(const wxRect& rect); - bool Subtract(const wxRegion& region) - { return DoSubtract(region); } - - // XOR: the union of two combined regions except for any overlapping areas. - bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h); - bool Xor(const wxRect& rect); - bool Xor(const wxRegion& region) - { return DoXor(region); } - - - // Convert the region to a B&W bitmap with the white pixels being inside - // the region. - wxBitmap ConvertToBitmap() const; - -protected: - virtual bool DoIsEqual(const wxRegion& region) const = 0; - virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const = 0; - virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const = 0; - virtual wxRegionContain DoContainsRect(const wxRect& rect) const = 0; - - virtual bool DoOffset(wxCoord x, wxCoord y) = 0; - - virtual bool DoUnionWithRect(const wxRect& rect) = 0; - virtual bool DoUnionWithRegion(const wxRegion& region) = 0; - - virtual bool DoIntersect(const wxRegion& region) = 0; - virtual bool DoSubtract(const wxRegion& region) = 0; - virtual bool DoXor(const wxRegion& region) = 0; -}; - -// some ports implement a generic Combine() function while others only -// implement individual wxRegion operations, factor out the common code for the -// ports with Combine() in this class -#if defined(__WXPALMOS__) || \ - defined(__WXMSW__) || \ - defined(__WXMAC__) || \ - defined(__WXPM__) - -#define wxHAS_REGION_COMBINE - -class WXDLLEXPORT wxRegionWithCombine : public wxRegionBase -{ -public: - // these methods are not part of public API as they're not implemented on - // all ports - bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op); - bool Combine(const wxRect& rect, wxRegionOp op); - bool Combine(const wxRegion& region, wxRegionOp op) - { return DoCombine(region, op); } - - -protected: - // the real Combine() method, to be defined in the derived class - virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0; - - // implement some wxRegionBase pure virtuals in terms of Combine() - virtual bool DoUnionWithRect(const wxRect& rect); - virtual bool DoUnionWithRegion(const wxRegion& region); - virtual bool DoIntersect(const wxRegion& region); - virtual bool DoSubtract(const wxRegion& region); - virtual bool DoXor(const wxRegion& region); -}; - -#endif // ports with wxRegion::Combine() - -#if defined(__WXPALMOS__) - #include "wx/palmos/region.h" -#elif defined(__WXMSW__) - #include "wx/msw/region.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/region.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/region.h" -#elif defined(__WXMOTIF__) || defined(__WXX11__) - #include "wx/x11/region.h" -#elif defined(__WXMGL__) - #include "wx/mgl/region.h" -#elif defined(__WXDFB__) - #include "wx/dfb/region.h" -#elif defined(__WXMAC__) - #include "wx/mac/region.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/region.h" -#elif defined(__WXPM__) - #include "wx/os2/region.h" -#endif - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -// NB: these functions couldn't be defined in the class declaration as they use -// wxRegion and so can be only defined after including the header declaring -// the real class - -inline bool wxRegionBase::Intersect(const wxRect& rect) -{ - return DoIntersect(wxRegion(rect)); -} - -inline bool wxRegionBase::Subtract(const wxRect& rect) -{ - return DoSubtract(wxRegion(rect)); -} - -inline bool wxRegionBase::Xor(const wxRect& rect) -{ - return DoXor(wxRegion(rect)); -} - -// ...and these functions are here because they call the ones above, and its -// not really proper to call an inline function before its defined inline. - -inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - return Intersect(wxRect(x, y, w, h)); -} - -inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - return Subtract(wxRect(x, y, w, h)); -} - -inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h) -{ - return Xor(wxRect(x, y, w, h)); -} - -#ifdef wxHAS_REGION_COMBINE - -inline bool wxRegionWithCombine::Combine(wxCoord x, - wxCoord y, - wxCoord w, - wxCoord h, - wxRegionOp op) -{ - return DoCombine(wxRegion(x, y, w, h), op); -} - -inline bool wxRegionWithCombine::Combine(const wxRect& rect, wxRegionOp op) -{ - return DoCombine(wxRegion(rect), op); -} - -#endif // wxHAS_REGION_COMBINE - -#endif // _WX_REGION_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/region.h +// Purpose: Base header for wxRegion +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: region.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGION_H_BASE_ +#define _WX_REGION_H_BASE_ + +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxRegion; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// result of wxRegion::Contains() call +enum wxRegionContain +{ + wxOutRegion = 0, + wxPartRegion = 1, + wxInRegion = 2 +}; + +// these constants are used with wxRegion::Combine() in the ports which have +// this method +enum wxRegionOp +{ + // Creates the intersection of the two combined regions. + wxRGN_AND, + + // Creates a copy of the region + wxRGN_COPY, + + // Combines the parts of first region that are not in the second one + wxRGN_DIFF, + + // Creates the union of two combined regions. + wxRGN_OR, + + // Creates the union of two regions except for any overlapping areas. + wxRGN_XOR +}; + +// ---------------------------------------------------------------------------- +// wxRegionBase defines wxRegion API +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRegionBase : public wxGDIObject +{ +public: + // ctors + // ----- + + // none are defined here but the following should be available: +#if 0 + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE); + wxRegion(const wxBitmap& bmp); + wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); +#endif // 0 + + // operators + // --------- + + bool operator==(const wxRegion& region) const { return IsEqual(region); } + bool operator!=(const wxRegion& region) const { return !(*this == region); } + + + // accessors + // --------- + + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } + + // Is region empty? + virtual bool IsEmpty() const = 0; + bool Empty() const { return IsEmpty(); } + + // Is region equal (i.e. covers the same area as another one)? + bool IsEqual(const wxRegion& region) const; + + // Get the bounding box + bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const + { return DoGetBox(x, y, w, h); } + wxRect GetBox() const + { + wxCoord x, y, w, h; + return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect(); + } + + // Test if the given point or rectangle is inside this region + wxRegionContain Contains(wxCoord x, wxCoord y) const + { return DoContainsPoint(x, y); } + wxRegionContain Contains(const wxPoint& pt) const + { return DoContainsPoint(pt.x, pt.y); } + wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const + { return DoContainsRect(wxRect(x, y, w, h)); } + wxRegionContain Contains(const wxRect& rect) const + { return DoContainsRect(rect); } + + + // operations + // ---------- + + virtual void Clear() = 0; + + // Move the region + bool Offset(wxCoord x, wxCoord y) + { return DoOffset(x, y); } + bool Offset(const wxPoint& pt) + { return DoOffset(pt.x, pt.y); } + + // Union rectangle or region with this region. + bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h) + { return DoUnionWithRect(wxRect(x, y, w, h)); } + bool Union(const wxRect& rect) + { return DoUnionWithRect(rect); } + bool Union(const wxRegion& region) + { return DoUnionWithRegion(region); } + +#if wxUSE_IMAGE + // Use the non-transparent pixels of a wxBitmap for the region to combine + // with this region. First version takes transparency from bitmap's mask, + // second lets the user specify the colour to be treated as transparent + // along with an optional tolerance value. + // NOTE: implemented in common/rgncmn.cpp + bool Union(const wxBitmap& bmp); + bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); +#endif // wxUSE_IMAGE + + // Intersect rectangle or region with this one. + bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + bool Intersect(const wxRect& rect); + bool Intersect(const wxRegion& region) + { return DoIntersect(region); } + + // Subtract rectangle or region from this: + // Combines the parts of 'this' that are not part of the second region. + bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + bool Subtract(const wxRect& rect); + bool Subtract(const wxRegion& region) + { return DoSubtract(region); } + + // XOR: the union of two combined regions except for any overlapping areas. + bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + bool Xor(const wxRect& rect); + bool Xor(const wxRegion& region) + { return DoXor(region); } + + + // Convert the region to a B&W bitmap with the white pixels being inside + // the region. + wxBitmap ConvertToBitmap() const; + +protected: + virtual bool DoIsEqual(const wxRegion& region) const = 0; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const = 0; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const = 0; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const = 0; + + virtual bool DoOffset(wxCoord x, wxCoord y) = 0; + + virtual bool DoUnionWithRect(const wxRect& rect) = 0; + virtual bool DoUnionWithRegion(const wxRegion& region) = 0; + + virtual bool DoIntersect(const wxRegion& region) = 0; + virtual bool DoSubtract(const wxRegion& region) = 0; + virtual bool DoXor(const wxRegion& region) = 0; +}; + +// some ports implement a generic Combine() function while others only +// implement individual wxRegion operations, factor out the common code for the +// ports with Combine() in this class +#if defined(__WXPALMOS__) || \ + defined(__WXMSW__) || \ + defined(__WXMAC__) || \ + defined(__WXPM__) + +#define wxHAS_REGION_COMBINE + +class WXDLLEXPORT wxRegionWithCombine : public wxRegionBase +{ +public: + // these methods are not part of public API as they're not implemented on + // all ports + bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op); + bool Combine(const wxRect& rect, wxRegionOp op); + bool Combine(const wxRegion& region, wxRegionOp op) + { return DoCombine(region, op); } + + +protected: + // the real Combine() method, to be defined in the derived class + virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0; + + // implement some wxRegionBase pure virtuals in terms of Combine() + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); +}; + +#endif // ports with wxRegion::Combine() + +#if defined(__WXPALMOS__) + #include "wx/palmos/region.h" +#elif defined(__WXMSW__) + #include "wx/msw/region.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/region.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/region.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) + #include "wx/x11/region.h" +#elif defined(__WXMGL__) + #include "wx/mgl/region.h" +#elif defined(__WXDFB__) + #include "wx/dfb/region.h" +#elif defined(__WXMAC__) + #include "wx/mac/region.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/region.h" +#elif defined(__WXPM__) + #include "wx/os2/region.h" +#endif + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +// NB: these functions couldn't be defined in the class declaration as they use +// wxRegion and so can be only defined after including the header declaring +// the real class + +inline bool wxRegionBase::Intersect(const wxRect& rect) +{ + return DoIntersect(wxRegion(rect)); +} + +inline bool wxRegionBase::Subtract(const wxRect& rect) +{ + return DoSubtract(wxRegion(rect)); +} + +inline bool wxRegionBase::Xor(const wxRect& rect) +{ + return DoXor(wxRegion(rect)); +} + +// ...and these functions are here because they call the ones above, and its +// not really proper to call an inline function before its defined inline. + +inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Intersect(wxRect(x, y, w, h)); +} + +inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Subtract(wxRect(x, y, w, h)); +} + +inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Xor(wxRect(x, y, w, h)); +} + +#ifdef wxHAS_REGION_COMBINE + +inline bool wxRegionWithCombine::Combine(wxCoord x, + wxCoord y, + wxCoord w, + wxCoord h, + wxRegionOp op) +{ + return DoCombine(wxRegion(x, y, w, h), op); +} + +inline bool wxRegionWithCombine::Combine(const wxRect& rect, wxRegionOp op) +{ + return DoCombine(wxRegion(rect), op); +} + +#endif // wxHAS_REGION_COMBINE + +#endif // _WX_REGION_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/renderer.h b/Externals/wxWidgets/include/wx/renderer.h index b28ec85312..f7eb8558e4 100644 --- a/Externals/wxWidgets/include/wx/renderer.h +++ b/Externals/wxWidgets/include/wx/renderer.h @@ -1,436 +1,436 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/renderer.h -// Purpose: wxRendererNative class declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.07.2003 -// RCS-ID: $Id: renderer.h 53667 2008-05-20 09:28:48Z VS $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - Renderers are used in wxWidgets for two similar but different things: - (a) wxUniversal uses them to draw everything, i.e. all the control - (b) all the native ports use them to draw generic controls only - - wxUniversal needs more functionality than what is included in the base class - as it needs to draw stuff like scrollbars which are never going to be - generic. So we put the bare minimum needed by the native ports here and the - full wxRenderer class is declared in wx/univ/renderer.h and is only used by - wxUniveral (although note that native ports can load wxRenderer objects from - theme DLLs and use them as wxRendererNative ones, of course). - */ - -#ifndef _WX_RENDERER_H_ -#define _WX_RENDERER_H_ - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -#include "wx/gdicmn.h" // for wxPoint -#include "wx/colour.h" -#include "wx/font.h" -#include "wx/bitmap.h" -#include "wx/string.h" - -// some platforms have their own renderers, others use the generic one -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__) - #define wxHAS_NATIVE_RENDERER -#else - #undef wxHAS_NATIVE_RENDERER -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// control state flags used in wxRenderer and wxColourScheme -enum -{ - wxCONTROL_DISABLED = 0x00000001, // control is disabled - wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus - wxCONTROL_PRESSED = 0x00000004, // (button) is pressed - wxCONTROL_SPECIAL = 0x00000008, // control-specific bit: - wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons - wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items - wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items - wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes - wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control - wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox - wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked - wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked - wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state - - wxCONTROL_FLAGS_MASK = 0x000000ff, - - // this is a pseudo flag not used directly by wxRenderer but rather by some - // controls internally - wxCONTROL_DIRTY = 0x80000000 -}; - -// ---------------------------------------------------------------------------- -// helper structs -// ---------------------------------------------------------------------------- - -// wxSplitterWindow parameters -struct WXDLLEXPORT wxSplitterRenderParams -{ - // the only way to initialize this struct is by using this ctor - wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_) - : widthSash(widthSash_), border(border_), isHotSensitive(isSens_) - { - } - - // the width of the splitter sash - const wxCoord widthSash; - - // the width of the border of the splitter window - const wxCoord border; - - // true if the splitter changes its appearance when the mouse is over it - const bool isHotSensitive; -}; - - -// extra optional parameters for DrawHeaderButton -struct WXDLLEXPORT wxHeaderButtonParams -{ - wxHeaderButtonParams() - : m_labelAlignment(wxALIGN_LEFT) - { } - - wxColour m_arrowColour; - wxColour m_selectionColour; - wxString m_labelText; - wxFont m_labelFont; - wxColour m_labelColour; - wxBitmap m_labelBitmap; - int m_labelAlignment; -}; - -enum wxHeaderSortIconType { - wxHDR_SORT_ICON_NONE, // Header button has no sort arrow - wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon - wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon -}; - - -// wxRendererNative interface version -struct WXDLLEXPORT wxRendererVersion -{ - wxRendererVersion(int version_, int age_) : version(version_), age(age_) { } - - // default copy ctor, assignment operator and dtor are ok - - // the current version and age of wxRendererNative interface: different - // versions are incompatible (in both ways) while the ages inside the same - // version are upwards compatible, i.e. the version of the renderer must - // match the version of the main program exactly while the age may be - // highergreater or equal to it - // - // NB: don't forget to increment age after adding any new virtual function! - enum - { - Current_Version = 1, - Current_Age = 5 - }; - - - // check if the given version is compatible with the current one - static bool IsCompatible(const wxRendererVersion& ver) - { - return ver.version == Current_Version && ver.age >= Current_Age; - } - - const int version; - const int age; -}; - -// ---------------------------------------------------------------------------- -// wxRendererNative: abstracts drawing methods needed by the native controls -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRendererNative -{ -public: - // drawing functions - // ----------------- - - // draw the header control button (used by wxListCtrl) Returns optimal - // width for the label contents. - virtual int DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params=NULL) = 0; - - - // Draw the contents of a header control button (label, sort arrows, etc.) - // Normally only called by DrawHeaderButton. - virtual int DrawHeaderButtonContents(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params=NULL) = 0; - - // Returns the default height of a header button, either a fixed platform - // height if available, or a generic height based on the window's font. - virtual int GetHeaderButtonHeight(wxWindow *win) = 0; - - - // draw the expanded/collapsed icon for a tree control item - virtual void DrawTreeItemButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw the border for sash window: this border must be such that the sash - // drawn by DrawSash() blends into it well - virtual void DrawSplitterBorder(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw a (vertical) sash - virtual void DrawSplitterSash(wxWindow *win, - wxDC& dc, - const wxSize& size, - wxCoord position, - wxOrientation orient, - int flags = 0) = 0; - - // draw a combobox dropdown button - // - // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT - virtual void DrawComboBoxDropButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw a dropdown arrow - // - // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT - virtual void DrawDropArrow(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw check button - // - // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT - virtual void DrawCheckBox(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw blank button - // - // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT - virtual void DrawPushButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // draw rectangle indicating that an item in e.g. a list control - // has been selected or focused - // - // flags may use - // wxCONTROL_SELECTED (item is selected, e.g. draw background) - // wxCONTROL_CURRENT (item is the current item, e.g. dotted border) - // wxCONTROL_FOCUSED (the whole control has focus, e.g. blue background vs. grey otherwise) - virtual void DrawItemSelectionRect(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; - - // geometry functions - // ------------------ - - // get the splitter parameters: the x field of the returned point is the - // sash width and the y field is the border width - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0; - - - // pseudo constructors - // ------------------- - - // return the currently used renderer - static wxRendererNative& Get(); - - // return the generic implementation of the renderer - static wxRendererNative& GetGeneric(); - - // return the default (native) implementation for this platform - static wxRendererNative& GetDefault(); - - - // changing the global renderer - // ---------------------------- - -#if wxUSE_DYNLIB_CLASS - // load the renderer from the specified DLL, the returned pointer must be - // deleted by caller if not NULL when it is not used any more - static wxRendererNative *Load(const wxString& name); -#endif // wxUSE_DYNLIB_CLASS - - // set the renderer to use, passing NULL reverts to using the default - // renderer - // - // return the previous renderer used with Set() or NULL if none - static wxRendererNative *Set(wxRendererNative *renderer); - - - // miscellaneous stuff - // ------------------- - - // this function is used for version checking: Load() refuses to load any - // DLLs implementing an older or incompatible version; it should be - // implemented simply by returning wxRendererVersion::Current_XXX values - virtual wxRendererVersion GetVersion() const = 0; - - // virtual dtor for any base class - virtual ~wxRendererNative(); -}; - -// ---------------------------------------------------------------------------- -// wxDelegateRendererNative: allows reuse of renderers code -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDelegateRendererNative : public wxRendererNative -{ -public: - wxDelegateRendererNative() - : m_rendererNative(GetGeneric()) { } - - wxDelegateRendererNative(wxRendererNative& rendererNative) - : m_rendererNative(rendererNative) { } - - - virtual int DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) - { return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); } - - virtual int DrawHeaderButtonContents(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) - { return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } - - virtual int GetHeaderButtonHeight(wxWindow *win) - { return m_rendererNative.GetHeaderButtonHeight(win); } - - virtual void DrawTreeItemButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); } - - virtual void DrawSplitterBorder(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); } - - virtual void DrawSplitterSash(wxWindow *win, - wxDC& dc, - const wxSize& size, - wxCoord position, - wxOrientation orient, - int flags = 0) - { m_rendererNative.DrawSplitterSash(win, dc, size, - position, orient, flags); } - - virtual void DrawComboBoxDropButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); } - - virtual void DrawDropArrow(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_rendererNative.DrawDropArrow(win, dc, rect, flags); } - - virtual void DrawCheckBox(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0 ) - { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } - - virtual void DrawPushButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0 ) - { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } - - virtual void DrawItemSelectionRect(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0 ) - { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); } - - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) - { return m_rendererNative.GetSplitterParams(win); } - - virtual wxRendererVersion GetVersion() const - { return m_rendererNative.GetVersion(); } - -protected: - wxRendererNative& m_rendererNative; - - DECLARE_NO_COPY_CLASS(wxDelegateRendererNative) -}; - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -#ifndef wxHAS_NATIVE_RENDERER - -// default native renderer is the generic one then -/* static */ inline -wxRendererNative& wxRendererNative::GetDefault() -{ - return GetGeneric(); -} - -#endif // !wxHAS_NATIVE_RENDERER - - -// ---------------------------------------------------------------------------- -// Other renderer functions to be merged in to wxRenderer class in 2.9, but -// they are standalone functions here to protect the ABI. -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) -#if wxABI_VERSION >= 20808 - -// Draw a native wxChoice -void WXDLLEXPORT wxRenderer_DrawChoice(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); - -// Draw a native wxComboBox -void WXDLLEXPORT wxRenderer_DrawComboBox(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); - -// Draw a native wxTextCtrl frame -void WXDLLEXPORT wxRenderer_DrawTextCtrl(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); - -// Draw a native wxRadioButton (just the graphical portion) -void WXDLLEXPORT wxRenderer_DrawRadioButton(wxWindow* win, wxDC& dc, - const wxRect& rect, int flags=0); -#endif // wxABI_VERSION -#endif // (platforms) - -#endif // _WX_RENDERER_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/renderer.h +// Purpose: wxRendererNative class declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.07.2003 +// RCS-ID: $Id: renderer.h 53667 2008-05-20 09:28:48Z VS $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + Renderers are used in wxWidgets for two similar but different things: + (a) wxUniversal uses them to draw everything, i.e. all the control + (b) all the native ports use them to draw generic controls only + + wxUniversal needs more functionality than what is included in the base class + as it needs to draw stuff like scrollbars which are never going to be + generic. So we put the bare minimum needed by the native ports here and the + full wxRenderer class is declared in wx/univ/renderer.h and is only used by + wxUniveral (although note that native ports can load wxRenderer objects from + theme DLLs and use them as wxRendererNative ones, of course). + */ + +#ifndef _WX_RENDERER_H_ +#define _WX_RENDERER_H_ + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +#include "wx/gdicmn.h" // for wxPoint +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/bitmap.h" +#include "wx/string.h" + +// some platforms have their own renderers, others use the generic one +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__) + #define wxHAS_NATIVE_RENDERER +#else + #undef wxHAS_NATIVE_RENDERER +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// control state flags used in wxRenderer and wxColourScheme +enum +{ + wxCONTROL_DISABLED = 0x00000001, // control is disabled + wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus + wxCONTROL_PRESSED = 0x00000004, // (button) is pressed + wxCONTROL_SPECIAL = 0x00000008, // control-specific bit: + wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons + wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items + wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items + wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes + wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control + wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox + wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked + wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked + wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state + + wxCONTROL_FLAGS_MASK = 0x000000ff, + + // this is a pseudo flag not used directly by wxRenderer but rather by some + // controls internally + wxCONTROL_DIRTY = 0x80000000 +}; + +// ---------------------------------------------------------------------------- +// helper structs +// ---------------------------------------------------------------------------- + +// wxSplitterWindow parameters +struct WXDLLEXPORT wxSplitterRenderParams +{ + // the only way to initialize this struct is by using this ctor + wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_) + : widthSash(widthSash_), border(border_), isHotSensitive(isSens_) + { + } + + // the width of the splitter sash + const wxCoord widthSash; + + // the width of the border of the splitter window + const wxCoord border; + + // true if the splitter changes its appearance when the mouse is over it + const bool isHotSensitive; +}; + + +// extra optional parameters for DrawHeaderButton +struct WXDLLEXPORT wxHeaderButtonParams +{ + wxHeaderButtonParams() + : m_labelAlignment(wxALIGN_LEFT) + { } + + wxColour m_arrowColour; + wxColour m_selectionColour; + wxString m_labelText; + wxFont m_labelFont; + wxColour m_labelColour; + wxBitmap m_labelBitmap; + int m_labelAlignment; +}; + +enum wxHeaderSortIconType { + wxHDR_SORT_ICON_NONE, // Header button has no sort arrow + wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon + wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon +}; + + +// wxRendererNative interface version +struct WXDLLEXPORT wxRendererVersion +{ + wxRendererVersion(int version_, int age_) : version(version_), age(age_) { } + + // default copy ctor, assignment operator and dtor are ok + + // the current version and age of wxRendererNative interface: different + // versions are incompatible (in both ways) while the ages inside the same + // version are upwards compatible, i.e. the version of the renderer must + // match the version of the main program exactly while the age may be + // highergreater or equal to it + // + // NB: don't forget to increment age after adding any new virtual function! + enum + { + Current_Version = 1, + Current_Age = 5 + }; + + + // check if the given version is compatible with the current one + static bool IsCompatible(const wxRendererVersion& ver) + { + return ver.version == Current_Version && ver.age >= Current_Age; + } + + const int version; + const int age; +}; + +// ---------------------------------------------------------------------------- +// wxRendererNative: abstracts drawing methods needed by the native controls +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRendererNative +{ +public: + // drawing functions + // ----------------- + + // draw the header control button (used by wxListCtrl) Returns optimal + // width for the label contents. + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params=NULL) = 0; + + + // Draw the contents of a header control button (label, sort arrows, etc.) + // Normally only called by DrawHeaderButton. + virtual int DrawHeaderButtonContents(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params=NULL) = 0; + + // Returns the default height of a header button, either a fixed platform + // height if available, or a generic height based on the window's font. + virtual int GetHeaderButtonHeight(wxWindow *win) = 0; + + + // draw the expanded/collapsed icon for a tree control item + virtual void DrawTreeItemButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw the border for sash window: this border must be such that the sash + // drawn by DrawSash() blends into it well + virtual void DrawSplitterBorder(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw a (vertical) sash + virtual void DrawSplitterSash(wxWindow *win, + wxDC& dc, + const wxSize& size, + wxCoord position, + wxOrientation orient, + int flags = 0) = 0; + + // draw a combobox dropdown button + // + // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT + virtual void DrawComboBoxDropButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw a dropdown arrow + // + // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT + virtual void DrawDropArrow(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw check button + // + // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT + virtual void DrawCheckBox(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw blank button + // + // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT + virtual void DrawPushButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw rectangle indicating that an item in e.g. a list control + // has been selected or focused + // + // flags may use + // wxCONTROL_SELECTED (item is selected, e.g. draw background) + // wxCONTROL_CURRENT (item is the current item, e.g. dotted border) + // wxCONTROL_FOCUSED (the whole control has focus, e.g. blue background vs. grey otherwise) + virtual void DrawItemSelectionRect(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // geometry functions + // ------------------ + + // get the splitter parameters: the x field of the returned point is the + // sash width and the y field is the border width + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0; + + + // pseudo constructors + // ------------------- + + // return the currently used renderer + static wxRendererNative& Get(); + + // return the generic implementation of the renderer + static wxRendererNative& GetGeneric(); + + // return the default (native) implementation for this platform + static wxRendererNative& GetDefault(); + + + // changing the global renderer + // ---------------------------- + +#if wxUSE_DYNLIB_CLASS + // load the renderer from the specified DLL, the returned pointer must be + // deleted by caller if not NULL when it is not used any more + static wxRendererNative *Load(const wxString& name); +#endif // wxUSE_DYNLIB_CLASS + + // set the renderer to use, passing NULL reverts to using the default + // renderer + // + // return the previous renderer used with Set() or NULL if none + static wxRendererNative *Set(wxRendererNative *renderer); + + + // miscellaneous stuff + // ------------------- + + // this function is used for version checking: Load() refuses to load any + // DLLs implementing an older or incompatible version; it should be + // implemented simply by returning wxRendererVersion::Current_XXX values + virtual wxRendererVersion GetVersion() const = 0; + + // virtual dtor for any base class + virtual ~wxRendererNative(); +}; + +// ---------------------------------------------------------------------------- +// wxDelegateRendererNative: allows reuse of renderers code +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDelegateRendererNative : public wxRendererNative +{ +public: + wxDelegateRendererNative() + : m_rendererNative(GetGeneric()) { } + + wxDelegateRendererNative(wxRendererNative& rendererNative) + : m_rendererNative(rendererNative) { } + + + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params = NULL) + { return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); } + + virtual int DrawHeaderButtonContents(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params = NULL) + { return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } + + virtual int GetHeaderButtonHeight(wxWindow *win) + { return m_rendererNative.GetHeaderButtonHeight(win); } + + virtual void DrawTreeItemButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); } + + virtual void DrawSplitterBorder(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); } + + virtual void DrawSplitterSash(wxWindow *win, + wxDC& dc, + const wxSize& size, + wxCoord position, + wxOrientation orient, + int flags = 0) + { m_rendererNative.DrawSplitterSash(win, dc, size, + position, orient, flags); } + + virtual void DrawComboBoxDropButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); } + + virtual void DrawDropArrow(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_rendererNative.DrawDropArrow(win, dc, rect, flags); } + + virtual void DrawCheckBox(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0 ) + { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } + + virtual void DrawPushButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0 ) + { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } + + virtual void DrawItemSelectionRect(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0 ) + { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); } + + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) + { return m_rendererNative.GetSplitterParams(win); } + + virtual wxRendererVersion GetVersion() const + { return m_rendererNative.GetVersion(); } + +protected: + wxRendererNative& m_rendererNative; + + DECLARE_NO_COPY_CLASS(wxDelegateRendererNative) +}; + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +#ifndef wxHAS_NATIVE_RENDERER + +// default native renderer is the generic one then +/* static */ inline +wxRendererNative& wxRendererNative::GetDefault() +{ + return GetGeneric(); +} + +#endif // !wxHAS_NATIVE_RENDERER + + +// ---------------------------------------------------------------------------- +// Other renderer functions to be merged in to wxRenderer class in 2.9, but +// they are standalone functions here to protect the ABI. +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) +#if wxABI_VERSION >= 20808 + +// Draw a native wxChoice +void WXDLLEXPORT wxRenderer_DrawChoice(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); + +// Draw a native wxComboBox +void WXDLLEXPORT wxRenderer_DrawComboBox(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); + +// Draw a native wxTextCtrl frame +void WXDLLEXPORT wxRenderer_DrawTextCtrl(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); + +// Draw a native wxRadioButton (just the graphical portion) +void WXDLLEXPORT wxRenderer_DrawRadioButton(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags=0); +#endif // wxABI_VERSION +#endif // (platforms) + +#endif // _WX_RENDERER_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextbuffer.h b/Externals/wxWidgets/include/wx/richtext/richtextbuffer.h index b7667faf0e..f52dc890d3 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextbuffer.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextbuffer.h @@ -1,2394 +1,2394 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextbuffer.h -// Purpose: Buffer for wxRichTextCtrl -// Author: Julian Smart -// Modified by: -// Created: 2005-09-30 -// RCS-ID: $Id: richtextbuffer.h 53671 2008-05-20 13:23:07Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTBUFFER_H_ -#define _WX_RICHTEXTBUFFER_H_ - -/* - - Data structures - =============== - - Data is represented by a hierarchy of objects, all derived from - wxRichTextObject. - - The top of the hierarchy is the buffer, a kind of wxRichTextParagraphLayoutBox. - These boxes will allow flexible placement of text boxes on a page, but - for now there is a single box representing the document, and this box is - a wxRichTextParagraphLayoutBox which contains further wxRichTextParagraph - objects, each of which can include text and images. - - Each object maintains a range (start and end position) measured - from the start of the main parent box. - A paragraph object knows its range, and a text fragment knows its range - too. So, a character or image in a page has a position relative to the - start of the document, and a character in an embedded text box has - a position relative to that text box. For now, we will not be dealing with - embedded objects but it's something to bear in mind for later. - - Note that internally, a range (5,5) represents a range of one character. - In the public wx[Rich]TextCtrl API, this would be passed to e.g. SetSelection - as (5,6). A paragraph with one character might have an internal range of (0, 1) - since the end of the paragraph takes up one position. - - Layout - ====== - - When Layout is called on an object, it is given a size which the object - must limit itself to, or one or more flexible directions (vertical - or horizontal). So for example a centered paragraph is given the page - width to play with (minus any margins), but can extend indefinitely - in the vertical direction. The implementation of Layout can then - cache the calculated size and position within the parent. - - */ - -/*! - * Includes - */ - -#include "wx/defs.h" - -#if wxUSE_RICHTEXT - -#include "wx/list.h" -#include "wx/textctrl.h" -#include "wx/bitmap.h" -#include "wx/image.h" -#include "wx/cmdproc.h" -#include "wx/txtstrm.h" - -#if wxUSE_DATAOBJ -#include "wx/dataobj.h" -#endif - -// Setting wxRICHTEXT_USE_OWN_CARET to 1 implements a non-flashing -// cursor reliably without using wxClientDC in case there -// are platform-specific problems with the generic caret. -#define wxRICHTEXT_USE_OWN_CARET 0 - -// Switch off for binary compatibility, on for faster drawing -#define wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING 0 - -/*! - * Special characters - */ - -extern WXDLLIMPEXP_RICHTEXT const wxChar wxRichTextLineBreakChar; - -/*! - * File types - */ - -#define wxRICHTEXT_TYPE_ANY 0 -#define wxRICHTEXT_TYPE_TEXT 1 -#define wxRICHTEXT_TYPE_XML 2 -#define wxRICHTEXT_TYPE_HTML 3 -#define wxRICHTEXT_TYPE_RTF 4 -#define wxRICHTEXT_TYPE_PDF 5 - -/*! - * Forward declarations - */ - -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet; -class WXDLLIMPEXP_FWD_RICHTEXT wxTextAttrEx; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer; - -/*! - * Flags determining the available space, passed to Layout - */ - -#define wxRICHTEXT_FIXED_WIDTH 0x01 -#define wxRICHTEXT_FIXED_HEIGHT 0x02 -#define wxRICHTEXT_VARIABLE_WIDTH 0x04 -#define wxRICHTEXT_VARIABLE_HEIGHT 0x08 - -// Only lay out the part of the buffer that lies within -// the rect passed to Layout. -#define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10 - -/*! - * Flags to pass to Draw - */ - -// Ignore paragraph cache optimization, e.g. for printing purposes -// where one line may be drawn higher (on the next page) compared -// with the previous line -#define wxRICHTEXT_DRAW_IGNORE_CACHE 0x01 - -/*! - * Flags returned from hit-testing - */ - -// The point was not on this object -#define wxRICHTEXT_HITTEST_NONE 0x01 -// The point was before the position returned from HitTest -#define wxRICHTEXT_HITTEST_BEFORE 0x02 -// The point was after the position returned from HitTest -#define wxRICHTEXT_HITTEST_AFTER 0x04 -// The point was on the position returned from HitTest -#define wxRICHTEXT_HITTEST_ON 0x08 -// The point was on space outside content -#define wxRICHTEXT_HITTEST_OUTSIDE 0x10 - -/*! - * Flags for GetRangeSize - */ - -#define wxRICHTEXT_FORMATTED 0x01 -#define wxRICHTEXT_UNFORMATTED 0x02 -#define wxRICHTEXT_CACHE_SIZE 0x04 -#define wxRICHTEXT_HEIGHT_ONLY 0x08 - -/*! - * Flags for SetStyle/SetListStyle - */ - -#define wxRICHTEXT_SETSTYLE_NONE 0x00 - -// Specifies that this operation should be undoable -#define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01 - -// Specifies that the style should not be applied if the -// combined style at this point is already the style in question. -#define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02 - -// Specifies that the style should only be applied to paragraphs, -// and not the content. This allows content styling to be -// preserved independently from that of e.g. a named paragraph style. -#define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04 - -// Specifies that the style should only be applied to characters, -// and not the paragraph. This allows content styling to be -// preserved independently from that of e.g. a named paragraph style. -#define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08 - -// For SetListStyle only: specifies starting from the given number, otherwise -// deduces number from existing attributes -#define wxRICHTEXT_SETSTYLE_RENUMBER 0x10 - -// For SetListStyle only: specifies the list level for all paragraphs, otherwise -// the current indentation will be used -#define wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL 0x20 - -// Resets the existing style before applying the new style -#define wxRICHTEXT_SETSTYLE_RESET 0x40 - -// Removes the given style instead of applying it -#define wxRICHTEXT_SETSTYLE_REMOVE 0x80 - -/*! - * Flags for text insertion - */ - -#define wxRICHTEXT_INSERT_NONE 0x00 -#define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01 -#define wxRICHTEXT_INSERT_INTERACTIVE 0x02 - -/*! - * Extra formatting flags not in wxTextAttr - */ - -#define wxTEXT_ATTR_PARA_SPACING_AFTER 0x00000800 -#define wxTEXT_ATTR_PARA_SPACING_BEFORE 0x00001000 -#define wxTEXT_ATTR_LINE_SPACING 0x00002000 -#define wxTEXT_ATTR_CHARACTER_STYLE_NAME 0x00004000 -#define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME 0x00008000 -#define wxTEXT_ATTR_LIST_STYLE_NAME 0x00010000 -#define wxTEXT_ATTR_BULLET_STYLE 0x00020000 -#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000 -#define wxTEXT_ATTR_BULLET_TEXT 0x00080000 -#define wxTEXT_ATTR_BULLET_NAME 0x00100000 -#define wxTEXT_ATTR_URL 0x00200000 -#define wxTEXT_ATTR_PAGE_BREAK 0x00400000 -#define wxTEXT_ATTR_EFFECTS 0x00800000 -#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000 - -// A special flag telling the buffer to keep the first paragraph style -// as-is, when deleting a paragraph marker. In future we might pass a -// flag to InsertFragment and DeleteRange to indicate the appropriate mode. -#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x10000000 - -/*! - * Styles for wxTextAttrEx::SetBulletStyle - */ - -#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000 -#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001 -#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002 -#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004 -#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008 -#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010 -#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020 -#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040 -#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080 -#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100 -#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200 -#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400 -#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800 - -#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000 -#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000 -#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000 - -/*! - * Styles for wxTextAttrEx::SetTextEffects - */ - -#define wxTEXT_ATTR_EFFECT_NONE 0x00000000 -#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001 -#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002 -#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004 -#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008 -#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010 -#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020 -#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040 -#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080 -#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100 -#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200 - -/*! - * Line spacing values - */ - -#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10 -#define wxTEXT_ATTR_LINE_SPACING_HALF 15 -#define wxTEXT_ATTR_LINE_SPACING_TWICE 20 - -/*! - * Character and paragraph combined styles - */ - -#define wxTEXT_ATTR_CHARACTER (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS|wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL) - -#define wxTEXT_ATTR_PARAGRAPH (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ - wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ - wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\ - wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL) - -#define wxTEXT_ATTR_ALL (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) - -/*! - * Default superscript/subscript font multiplication factor - */ - -#define wxSCRIPT_MUL_FACTOR 1.5 - -/*! - * wxRichTextRange class declaration - * This stores beginning and end positions for a range of data. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextRange -{ -public: -// Constructors - - wxRichTextRange() { m_start = 0; m_end = 0; } - wxRichTextRange(long start, long end) { m_start = start; m_end = end; } - wxRichTextRange(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; } - ~wxRichTextRange() {} - - void operator =(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; } - bool operator ==(const wxRichTextRange& range) const { return (m_start == range.m_start && m_end == range.m_end); } - bool operator !=(const wxRichTextRange& range) const { return (m_start != range.m_start && m_end != range.m_end); } - wxRichTextRange operator -(const wxRichTextRange& range) const { return wxRichTextRange(m_start - range.m_start, m_end - range.m_end); } - wxRichTextRange operator +(const wxRichTextRange& range) const { return wxRichTextRange(m_start + range.m_start, m_end + range.m_end); } - - void SetRange(long start, long end) { m_start = start; m_end = end; } - - void SetStart(long start) { m_start = start; } - long GetStart() const { return m_start; } - - void SetEnd(long end) { m_end = end; } - long GetEnd() const { return m_end; } - - /// Returns true if this range is completely outside 'range' - bool IsOutside(const wxRichTextRange& range) const { return range.m_start > m_end || range.m_end < m_start; } - - /// Returns true if this range is completely within 'range' - bool IsWithin(const wxRichTextRange& range) const { return m_start >= range.m_start && m_end <= range.m_end; } - - /// Returns true if the given position is within this range. Allow - /// for the possibility of an empty range - assume the position - /// is within this empty range. NO, I think we should not match with an empty range. - // bool Contains(long pos) const { return pos >= m_start && (pos <= m_end || GetLength() == 0); } - bool Contains(long pos) const { return pos >= m_start && pos <= m_end ; } - - /// Limit this range to be within 'range' - bool LimitTo(const wxRichTextRange& range) ; - - /// Gets the length of the range - long GetLength() const { return m_end - m_start + 1; } - - /// Swaps the start and end - void Swap() { long tmp = m_start; m_start = m_end; m_end = tmp; } - - /// Convert to internal form: (n, n) is the range of a single character. - wxRichTextRange ToInternal() const { return wxRichTextRange(m_start, m_end-1); } - - /// Convert from internal to public API form: (n, n+1) is the range of a single character. - wxRichTextRange FromInternal() const { return wxRichTextRange(m_start, m_end+1); } - -protected: - long m_start; - long m_end; -}; - -#define wxRICHTEXT_ALL wxRichTextRange(-2, -2) -#define wxRICHTEXT_NONE wxRichTextRange(-1, -1) - -/*! - * wxTextAttrEx is an extended version of wxTextAttr with more paragraph attributes. - */ - -class WXDLLIMPEXP_RICHTEXT wxTextAttrEx: public wxTextAttr -{ -public: - // ctors - wxTextAttrEx(const wxTextAttrEx& attr); - wxTextAttrEx(const wxTextAttr& attr) { Init(); (*this) = attr; } - wxTextAttrEx() { Init(); } - - // Initialise this object - void Init(); - - // Copy - void Copy(const wxTextAttrEx& attr); - - // Assignment from a wxTextAttrEx object - void operator= (const wxTextAttrEx& attr); - - // Assignment from a wxTextAttr object - void operator= (const wxTextAttr& attr); - - // Equality test - bool operator== (const wxTextAttrEx& attr) const; - - // setters - void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_CHARACTER_STYLE_NAME); } - void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_PARAGRAPH_STYLE_NAME); } - void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); } - void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_PARA_SPACING_AFTER); } - void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_PARA_SPACING_BEFORE); } - void SetLineSpacing(int spacing) { m_lineSpacing = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_LINE_SPACING); } - void SetBulletStyle(int style) { m_bulletStyle = style; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_STYLE); } - void SetBulletNumber(int n) { m_bulletNumber = n; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NUMBER); } - void SetBulletText(const wxString& text) { m_bulletText = text; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_TEXT); } - void SetBulletName(const wxString& name) { m_bulletName = name; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NAME); } - void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; } - void SetURL(const wxString& url) { m_urlTarget = url; SetFlags(GetFlags() | wxTEXT_ATTR_URL); } - void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } - void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } - void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } - void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } - - const wxString& GetCharacterStyleName() const { return m_characterStyleName; } - const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } - const wxString& GetListStyleName() const { return m_listStyleName; } - int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } - int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } - int GetLineSpacing() const { return m_lineSpacing; } - int GetBulletStyle() const { return m_bulletStyle; } - int GetBulletNumber() const { return m_bulletNumber; } - const wxString& GetBulletText() const { return m_bulletText; } - const wxString& GetBulletName() const { return m_bulletName; } - const wxString& GetBulletFont() const { return m_bulletFont; } - const wxString& GetURL() const { return m_urlTarget; } - int GetTextEffects() const { return m_textEffects; } - int GetTextEffectFlags() const { return m_textEffectFlags; } - int GetOutlineLevel() const { return m_outlineLevel; } - - bool HasFontWeight() const { return (GetFlags() & wxTEXT_ATTR_FONT_WEIGHT) != 0; } - bool HasFontSize() const { return (GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0; } - bool HasFontItalic() const { return (GetFlags() & wxTEXT_ATTR_FONT_ITALIC) != 0; } - bool HasFontUnderlined() const { return (GetFlags() & wxTEXT_ATTR_FONT_UNDERLINE) != 0; } - bool HasFontFaceName() const { return (GetFlags() & wxTEXT_ATTR_FONT_FACE) != 0; } - - bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); } - bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); } - bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); } - bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); } - bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); } - bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); } - bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); } - bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); } - bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); } - bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); } - bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); } - bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } - bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } - bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } - bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } - - // Is this a character style? - bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); } - bool IsParagraphStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_PARAGRAPH)); } - - // returns false if we have any attributes set, true otherwise - bool IsDefault() const - { - return (GetFlags() == 0); - } - - // return the attribute having the valid font and colours: it uses the - // attributes set in attr and falls back first to attrDefault and then to - // the text control font/colours for those attributes which are not set - static wxTextAttrEx CombineEx(const wxTextAttrEx& attr, - const wxTextAttrEx& attrDef, - const wxTextCtrlBase *text); - -private: - // Paragraph styles - int m_paragraphSpacingAfter; - int m_paragraphSpacingBefore; - int m_lineSpacing; - int m_bulletStyle; - int m_bulletNumber; - int m_textEffects; - int m_textEffectFlags; - int m_outlineLevel; - wxString m_bulletText; - wxString m_bulletFont; - wxString m_bulletName; - wxString m_urlTarget; - - // Character style - wxString m_characterStyleName; - - // Paragraph style - wxString m_paragraphStyleName; - - // List style - wxString m_listStyleName; -}; - -/*! - * wxRichTextAttr stores attributes without a wxFont object, so is a much more - * efficient way to query styles. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextAttr -{ -public: - // ctors - wxRichTextAttr(const wxTextAttrEx& attr); - wxRichTextAttr(const wxRichTextAttr& attr); - wxRichTextAttr() { Init(); } - wxRichTextAttr(const wxColour& colText, - const wxColour& colBack = wxNullColour, - wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); - - // Initialise this object. - void Init(); - - // Copy - void Copy(const wxRichTextAttr& attr); - - // Assignment from a wxRichTextAttr object. - void operator= (const wxRichTextAttr& attr); - - // Assignment from a wxTextAttrEx object. - void operator= (const wxTextAttrEx& attr); - - // Equality test - bool operator== (const wxRichTextAttr& attr) const; - - // Making a wxTextAttrEx object. - operator wxTextAttrEx () const ; - - // Create font from font attributes. - wxFont CreateFont() const; - - // Get attributes from font. - bool GetFontAttributes(const wxFont& font); - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } - void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } - void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } - void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } - void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } - - void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; } - void SetFontStyle(int fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } - void SetFontWeight(int fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } - void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } - void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; } - - void SetFlags(long flags) { m_flags = flags; } - - void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; } - void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; } - void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); } - void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; } - void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; } - void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; } - void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; } - void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; } - void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; } - void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; } - void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; } - void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; } - void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } - void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } - void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } - void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } - const wxArrayInt& GetTabs() const { return m_tabs; } - long GetLeftIndent() const { return m_leftIndent; } - long GetLeftSubIndent() const { return m_leftSubIndent; } - long GetRightIndent() const { return m_rightIndent; } - long GetFlags() const { return m_flags; } - - int GetFontSize() const { return m_fontSize; } - int GetFontStyle() const { return m_fontStyle; } - int GetFontWeight() const { return m_fontWeight; } - bool GetFontUnderlined() const { return m_fontUnderlined; } - const wxString& GetFontFaceName() const { return m_fontFaceName; } - - const wxString& GetCharacterStyleName() const { return m_characterStyleName; } - const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } - const wxString& GetListStyleName() const { return m_listStyleName; } - int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } - int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } - int GetLineSpacing() const { return m_lineSpacing; } - int GetBulletStyle() const { return m_bulletStyle; } - int GetBulletNumber() const { return m_bulletNumber; } - const wxString& GetBulletText() const { return m_bulletText; } - const wxString& GetBulletFont() const { return m_bulletFont; } - const wxString& GetBulletName() const { return m_bulletName; } - const wxString& GetURL() const { return m_urlTarget; } - int GetTextEffects() const { return m_textEffects; } - int GetTextEffectFlags() const { return m_textEffectFlags; } - int GetOutlineLevel() const { return m_outlineLevel; } - - // accessors - bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } - bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } - bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; } - bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; } - bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; } - bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; } - bool HasFontWeight() const { return (m_flags & wxTEXT_ATTR_FONT_WEIGHT) != 0; } - bool HasFontSize() const { return (m_flags & wxTEXT_ATTR_FONT_SIZE) != 0; } - bool HasFontItalic() const { return (m_flags & wxTEXT_ATTR_FONT_ITALIC) != 0; } - bool HasFontUnderlined() const { return (m_flags & wxTEXT_ATTR_FONT_UNDERLINE) != 0; } - bool HasFontFaceName() const { return (m_flags & wxTEXT_ATTR_FONT_FACE) != 0; } - bool HasFont() const { return (m_flags & (wxTEXT_ATTR_FONT)) != 0; } - - bool HasParagraphSpacingAfter() const { return (m_flags & wxTEXT_ATTR_PARA_SPACING_AFTER) != 0; } - bool HasParagraphSpacingBefore() const { return (m_flags & wxTEXT_ATTR_PARA_SPACING_BEFORE) != 0; } - bool HasLineSpacing() const { return (m_flags & wxTEXT_ATTR_LINE_SPACING) != 0; } - bool HasCharacterStyleName() const { return (m_flags & wxTEXT_ATTR_CHARACTER_STYLE_NAME) != 0 && !m_characterStyleName.IsEmpty(); } - bool HasParagraphStyleName() const { return (m_flags & wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) != 0 && !m_paragraphStyleName.IsEmpty(); } - bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); } - bool HasBulletStyle() const { return (m_flags & wxTEXT_ATTR_BULLET_STYLE) != 0; } - bool HasBulletNumber() const { return (m_flags & wxTEXT_ATTR_BULLET_NUMBER) != 0; } - bool HasBulletText() const { return (m_flags & wxTEXT_ATTR_BULLET_TEXT) != 0; } - bool HasBulletName() const { return (m_flags & wxTEXT_ATTR_BULLET_NAME) != 0; } - bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); } - bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } - bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } - bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } - bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } - - bool HasFlag(long flag) const { return (m_flags & flag) != 0; } - - // Is this a character style? - bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); } - bool IsParagraphStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_PARAGRAPH)); } - - // returns false if we have any attributes set, true otherwise - bool IsDefault() const - { - return GetFlags() == 0; - } - - // Merges the given attributes. Does not affect 'this'. If compareWith - // is non-NULL, then it will be used to mask out those attributes that are the same in style - // and compareWith, for situations where we don't want to explicitly set inherited attributes. - bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL); - - // Merges the given attributes and returns the result. Does not affect 'this'. If compareWith - // is non-NULL, then it will be used to mask out those attributes that are the same in style - // and compareWith, for situations where we don't want to explicitly set inherited attributes. - wxRichTextAttr Combine(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL) const; - -private: - long m_flags; - - // Paragraph styles - wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm - int m_leftIndent; // left indent in 1/10 mm - int m_leftSubIndent; // left indent for all but the first - // line in a paragraph relative to the - // first line, in 1/10 mm - int m_rightIndent; // right indent in 1/10 mm - wxTextAttrAlignment m_textAlignment; - - int m_paragraphSpacingAfter; - int m_paragraphSpacingBefore; - int m_lineSpacing; - int m_bulletStyle; - int m_bulletNumber; - int m_textEffects; - int m_textEffectFlags; - int m_outlineLevel; - wxString m_bulletText; - wxString m_bulletFont; - wxString m_bulletName; - wxString m_urlTarget; - - // Character styles - wxColour m_colText, - m_colBack; - int m_fontSize; - int m_fontStyle; - int m_fontWeight; - bool m_fontUnderlined; - wxString m_fontFaceName; - - // Character style - wxString m_characterStyleName; - - // Paragraph style - wxString m_paragraphStyleName; - - // List style - wxString m_listStyleName; -}; - -/*! - * wxRichTextObject class declaration - * This is the base for drawable objects. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextObject: public wxObject -{ - DECLARE_CLASS(wxRichTextObject) -public: -// Constructors - - wxRichTextObject(wxRichTextObject* parent = NULL); - virtual ~wxRichTextObject(); - -// Overrideables - - /// Draw the item, within the given range. Some objects may ignore the range (for - /// example paragraphs) while others must obey it (lines, to implement wrapping) - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style) = 0; - - /// Lay the item out at the specified position with the given size constraint. - /// Layout must set the cached size. - virtual bool Layout(wxDC& dc, const wxRect& rect, int style) = 0; - - /// Hit-testing: returns a flag indicating hit test details, plus - /// information about position - virtual int HitTest(wxDC& WXUNUSED(dc), const wxPoint& WXUNUSED(pt), long& WXUNUSED(textPosition)) { return false; } - - /// Finds the absolute position and row height for the given character position - virtual bool FindPosition(wxDC& WXUNUSED(dc), long WXUNUSED(index), wxPoint& WXUNUSED(pt), int* WXUNUSED(height), bool WXUNUSED(forceLineStart)) { return false; } - - /// Get the best size, i.e. the ideal starting size for this object irrespective - /// of available space. For a short text string, it will be the size that exactly encloses - /// the text. For a longer string, it might use the parent width for example. - virtual wxSize GetBestSize() const { return m_size; } - - /// Get the object size for the given range. Returns false if the range - /// is invalid for this object. - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const = 0; - - /// Do a split, returning an object containing the second part, and setting - /// the first part in 'this'. - virtual wxRichTextObject* DoSplit(long WXUNUSED(pos)) { return NULL; } - - /// Calculate range. By default, guess that the object is 1 unit long. - virtual void CalculateRange(long start, long& end) { end = start ; m_range.SetRange(start, end); } - - /// Delete range - virtual bool DeleteRange(const wxRichTextRange& WXUNUSED(range)) { return false; } - - /// Returns true if the object is empty - virtual bool IsEmpty() const { return false; } - - /// Get any text in this object for the given range - virtual wxString GetTextForRange(const wxRichTextRange& WXUNUSED(range)) const { return wxEmptyString; } - - /// Returns true if this object can merge itself with the given one. - virtual bool CanMerge(wxRichTextObject* WXUNUSED(object)) const { return false; } - - /// Returns true if this object merged itself with the given one. - /// The calling code will then delete the given object. - virtual bool Merge(wxRichTextObject* WXUNUSED(object)) { return false; } - - /// Dump to output stream for debugging - virtual void Dump(wxTextOutputStream& stream); - -// Accessors - - /// Get/set the cached object size as calculated by Layout. - virtual wxSize GetCachedSize() const { return m_size; } - virtual void SetCachedSize(const wxSize& sz) { m_size = sz; } - - /// Get/set the object position - virtual wxPoint GetPosition() const { return m_pos; } - virtual void SetPosition(const wxPoint& pos) { m_pos = pos; } - - /// Get the rectangle enclosing the object - virtual wxRect GetRect() const { return wxRect(GetPosition(), GetCachedSize()); } - - /// Set the range - void SetRange(const wxRichTextRange& range) { m_range = range; } - - /// Get the range - const wxRichTextRange& GetRange() const { return m_range; } - wxRichTextRange& GetRange() { return m_range; } - - /// Get/set dirty flag (whether the object needs Layout to be called) - virtual bool GetDirty() const { return m_dirty; } - virtual void SetDirty(bool dirty) { m_dirty = dirty; } - - /// Is this composite? - virtual bool IsComposite() const { return false; } - - /// Get/set the parent. - virtual wxRichTextObject* GetParent() const { return m_parent; } - virtual void SetParent(wxRichTextObject* parent) { m_parent = parent; } - - /// Set the margin around the object - virtual void SetMargins(int margin); - virtual void SetMargins(int leftMargin, int rightMargin, int topMargin, int bottomMargin); - virtual int GetLeftMargin() const { return m_leftMargin; } - virtual int GetRightMargin() const { return m_rightMargin; } - virtual int GetTopMargin() const { return m_topMargin; } - virtual int GetBottomMargin() const { return m_bottomMargin; } - - /// Set attributes object - void SetAttributes(const wxTextAttrEx& attr) { m_attributes = attr; } - const wxTextAttrEx& GetAttributes() const { return m_attributes; } - wxTextAttrEx& GetAttributes() { return m_attributes; } - - /// Set/get stored descent - void SetDescent(int descent) { m_descent = descent; } - int GetDescent() const { return m_descent; } - - /// Gets the containing buffer - wxRichTextBuffer* GetBuffer() const; - -// Operations - - /// Clone the object - virtual wxRichTextObject* Clone() const { return NULL; } - - /// Copy - void Copy(const wxRichTextObject& obj); - - /// Reference-counting allows us to use the same object in multiple - /// lists (not yet used) - void Reference() { m_refCount ++; } - void Dereference(); - - /// Convert units in tenths of a millimetre to device units - int ConvertTenthsMMToPixels(wxDC& dc, int units); - static int ConvertTenthsMMToPixels(int ppi, int units); - -protected: - wxSize m_size; - wxPoint m_pos; - int m_descent; // Descent for this object (if any) - bool m_dirty; - int m_refCount; - wxRichTextObject* m_parent; - - /// The range of this object (start position to end position) - wxRichTextRange m_range; - - /// Margins - int m_leftMargin; - int m_rightMargin; - int m_topMargin; - int m_bottomMargin; - - /// Attributes - wxTextAttrEx m_attributes; -}; - -WX_DECLARE_LIST_WITH_DECL( wxRichTextObject, wxRichTextObjectList, class WXDLLIMPEXP_RICHTEXT ); - -/*! - * wxRichTextCompositeObject class declaration - * Objects of this class can contain other objects. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject: public wxRichTextObject -{ - DECLARE_CLASS(wxRichTextCompositeObject) -public: -// Constructors - - wxRichTextCompositeObject(wxRichTextObject* parent = NULL); - virtual ~wxRichTextCompositeObject(); - -// Overrideables - - /// Hit-testing: returns a flag indicating hit test details, plus - /// information about position - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition); - - /// Finds the absolute position and row height for the given character position - virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); - - /// Calculate range - virtual void CalculateRange(long start, long& end); - - /// Delete range - virtual bool DeleteRange(const wxRichTextRange& range); - - /// Get any text in this object for the given range - virtual wxString GetTextForRange(const wxRichTextRange& range) const; - - /// Dump to output stream for debugging - virtual void Dump(wxTextOutputStream& stream); - -// Accessors - - /// Get the children - wxRichTextObjectList& GetChildren() { return m_children; } - const wxRichTextObjectList& GetChildren() const { return m_children; } - - /// Get the child count - size_t GetChildCount() const ; - - /// Get the nth child - wxRichTextObject* GetChild(size_t n) const ; - - /// Get/set dirty flag - virtual bool GetDirty() const { return m_dirty; } - virtual void SetDirty(bool dirty) { m_dirty = dirty; } - - /// Is this composite? - virtual bool IsComposite() const { return true; } - - /// Returns true if the buffer is empty - virtual bool IsEmpty() const { return GetChildCount() == 0; } - -// Operations - - /// Copy - void Copy(const wxRichTextCompositeObject& obj); - - /// Assignment - void operator= (const wxRichTextCompositeObject& obj) { Copy(obj); } - - /// Append a child, returning the position - size_t AppendChild(wxRichTextObject* child) ; - - /// Insert the child in front of the given object, or at the beginning - bool InsertChild(wxRichTextObject* child, wxRichTextObject* inFrontOf) ; - - /// Delete the child - bool RemoveChild(wxRichTextObject* child, bool deleteChild = false) ; - - /// Delete all children - bool DeleteChildren() ; - - /// Recursively merge all pieces that can be merged. - bool Defragment(); - -protected: - wxRichTextObjectList m_children; -}; - -/*! - * wxRichTextBox class declaration - * This defines a 2D space to lay out objects - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextBox: public wxRichTextCompositeObject -{ - DECLARE_DYNAMIC_CLASS(wxRichTextBox) -public: -// Constructors - - wxRichTextBox(wxRichTextObject* parent = NULL); - wxRichTextBox(const wxRichTextBox& obj): wxRichTextCompositeObject() { Copy(obj); } - -// Overrideables - - /// Draw the item - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); - - /// Lay the item out - virtual bool Layout(wxDC& dc, const wxRect& rect, int style); - - /// Get/set the object size for the given range. Returns false if the range - /// is invalid for this object. - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; - -// Accessors - -// Operations - - /// Clone - virtual wxRichTextObject* Clone() const { return new wxRichTextBox(*this); } - - /// Copy - void Copy(const wxRichTextBox& obj); - -protected: -}; - -/*! - * wxRichTextParagraphBox class declaration - * This box knows how to lay out paragraphs. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox: public wxRichTextBox -{ - DECLARE_DYNAMIC_CLASS(wxRichTextParagraphLayoutBox) -public: -// Constructors - - wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL); - wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextBox() { Init(); Copy(obj); } - -// Overrideables - - /// Draw the item - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); - - /// Lay the item out - virtual bool Layout(wxDC& dc, const wxRect& rect, int style); - - /// Get/set the object size for the given range. Returns false if the range - /// is invalid for this object. - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; - - /// Delete range - virtual bool DeleteRange(const wxRichTextRange& range); - - /// Get any text in this object for the given range - virtual wxString GetTextForRange(const wxRichTextRange& range) const; - -// Accessors - - /// Associate a control with the buffer, for operations that for example require refreshing the window. - void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_ctrl = ctrl; } - - /// Get the associated control. - wxRichTextCtrl* GetRichTextCtrl() const { return m_ctrl; } - - /// Get/set whether the last paragraph is partial or complete - void SetPartialParagraph(bool partialPara) { m_partialParagraph = partialPara; } - bool GetPartialParagraph() const { return m_partialParagraph; } - - /// If this is a buffer, returns the current style sheet. The base layout box - /// class doesn't have an associated style sheet. - virtual wxRichTextStyleSheet* GetStyleSheet() const { return NULL; } - -// Operations - - /// Initialize the object. - void Init(); - - /// Clear all children - virtual void Clear(); - - /// Clear and initialize with one blank paragraph - virtual void Reset(); - - /// Convenience function to add a paragraph of text - virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttrEx* paraStyle = NULL); - - /// Convenience function to add an image - virtual wxRichTextRange AddImage(const wxImage& image, wxTextAttrEx* paraStyle = NULL); - - /// Adds multiple paragraphs, based on newlines. - virtual wxRichTextRange AddParagraphs(const wxString& text, wxTextAttrEx* paraStyle = NULL); - - /// Get the line at the given position. If caretPosition is true, the position is - /// a caret position, which is normally a smaller number. - virtual wxRichTextLine* GetLineAtPosition(long pos, bool caretPosition = false) const; - - /// Get the line at the given y pixel position, or the last line. - virtual wxRichTextLine* GetLineAtYPosition(int y) const; - - /// Get the paragraph at the given character or caret position - virtual wxRichTextParagraph* GetParagraphAtPosition(long pos, bool caretPosition = false) const; - - /// Get the line size at the given position - virtual wxSize GetLineSizeAtPosition(long pos, bool caretPosition = false) const; - - /// Given a position, get the number of the visible line (potentially many to a paragraph), - /// starting from zero at the start of the buffer. We also have to pass a bool (startOfLine) - /// that indicates whether the caret is being shown at the end of the previous line or at the start - /// of the next, since the caret can be shown at 2 visible positions for the same underlying - /// position. - virtual long GetVisibleLineNumber(long pos, bool caretPosition = false, bool startOfLine = false) const; - - /// Given a line number, get the corresponding wxRichTextLine object. - virtual wxRichTextLine* GetLineForVisibleLineNumber(long lineNumber) const; - - /// Get the leaf object in a paragraph at this position. - /// Given a line number, get the corresponding wxRichTextLine object. - virtual wxRichTextObject* GetLeafObjectAtPosition(long position) const; - - /// Get the paragraph by number - virtual wxRichTextParagraph* GetParagraphAtLine(long paragraphNumber) const; - - /// Get the paragraph for a given line - virtual wxRichTextParagraph* GetParagraphForLine(wxRichTextLine* line) const; - - /// Get the length of the paragraph - virtual int GetParagraphLength(long paragraphNumber) const; - - /// Get the number of paragraphs - virtual int GetParagraphCount() const { return GetChildCount(); } - - /// Get the number of visible lines - virtual int GetLineCount() const; - - /// Get the text of the paragraph - virtual wxString GetParagraphText(long paragraphNumber) const; - - /// Convert zero-based line column and paragraph number to a position. - virtual long XYToPosition(long x, long y) const; - - /// Convert zero-based position to line column and paragraph number - virtual bool PositionToXY(long pos, long* x, long* y) const; - - /// Set text attributes: character and/or paragraph styles. - virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - - /// Get the conbined text attributes for this position. - virtual bool GetStyle(long position, wxTextAttrEx& style); - virtual bool GetStyle(long position, wxRichTextAttr& style); - - /// Get the content (uncombined) attributes for this position. - virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style); - virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); - - /// Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and - /// context attributes. - virtual bool DoGetStyle(long position, wxTextAttrEx& style, bool combineStyles = true); - - /// Get the combined style for a range - if any attribute is different within the range, - /// that attribute is not present within the flags - virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style); - - /// Combines 'style' with 'currentStyle' for the purpose of summarising the attributes of a range of - /// content. - bool CollectStyle(wxTextAttrEx& currentStyle, const wxTextAttrEx& style, long& multipleStyleAttributes, int& multipleTextEffectAttributes); - - /// Set list style - virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - - /// Clear list for given range - virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - - /// Number/renumber any list elements in the given range. - /// def/defName can be NULL/empty to indicate that the existing list style should be used. - virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - - /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1 - /// def/defName can be NULL/empty to indicate that the existing list style should be used. - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); - - /// Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously - /// def/defName can be NULL/empty to indicate that the existing list style should be used. - virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - - /// Fills in the attributes for numbering a paragraph after previousParagraph. - virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const; - - /// Test if this whole range has character attributes of the specified kind. If any - /// of the attributes are different within the range, the test fails. You - /// can use this to implement, for example, bold button updating. style must have - /// flags indicating which attributes are of interest. - virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const; - virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const; - - /// Test if this whole range has paragraph attributes of the specified kind. If any - /// of the attributes are different within the range, the test fails. You - /// can use this to implement, for example, centering button updating. style must have - /// flags indicating which attributes are of interest. - virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const; - virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const; - - /// Clone - virtual wxRichTextObject* Clone() const { return new wxRichTextParagraphLayoutBox(*this); } - - /// Insert fragment into this box at the given position. If partialParagraph is true, - /// it is assumed that the last (or only) paragraph is just a piece of data with no paragraph - /// marker. - virtual bool InsertFragment(long position, wxRichTextParagraphLayoutBox& fragment); - - /// Make a copy of the fragment corresponding to the given range, putting it in 'fragment'. - virtual bool CopyFragment(const wxRichTextRange& range, wxRichTextParagraphLayoutBox& fragment); - - /// Apply the style sheet to the buffer, for example if the styles have changed. - virtual bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet); - - /// Copy - void Copy(const wxRichTextParagraphLayoutBox& obj); - - /// Assignment - void operator= (const wxRichTextParagraphLayoutBox& obj) { Copy(obj); } - - /// Calculate ranges - virtual void UpdateRanges() { long end; CalculateRange(0, end); } - - /// Get all the text - virtual wxString GetText() const; - - /// Set default style for new content. Setting it to a default attribute - /// makes new content take on the 'basic' style. - virtual bool SetDefaultStyle(const wxTextAttrEx& style); - - /// Get default style - virtual const wxTextAttrEx& GetDefaultStyle() const { return m_defaultAttributes; } - - /// Set basic (overall) style - virtual void SetBasicStyle(const wxTextAttrEx& style) { m_attributes = style; } - virtual void SetBasicStyle(const wxRichTextAttr& style) { m_attributes = style; } - - /// Get basic (overall) style - virtual const wxTextAttrEx& GetBasicStyle() const { return m_attributes; } - - /// Invalidate the buffer. With no argument, invalidates whole buffer. - void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); - - /// Get invalid range, rounding to entire paragraphs if argument is true. - wxRichTextRange GetInvalidRange(bool wholeParagraphs = false) const; - -protected: - wxRichTextCtrl* m_ctrl; - wxTextAttrEx m_defaultAttributes; - - /// The invalidated range that will need full layout - wxRichTextRange m_invalidRange; - - // Is the last paragraph partial or complete? - bool m_partialParagraph; -}; - -/*! - * wxRichTextLine class declaration - * This object represents a line in a paragraph, and stores - * offsets from the start of the paragraph representing the - * start and end positions of the line. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextLine -{ -public: -// Constructors - - wxRichTextLine(wxRichTextParagraph* parent); - wxRichTextLine(const wxRichTextLine& obj) { Init( NULL); Copy(obj); } - virtual ~wxRichTextLine() {} - -// Overrideables - -// Accessors - - /// Set the range - void SetRange(const wxRichTextRange& range) { m_range = range; } - void SetRange(long from, long to) { m_range = wxRichTextRange(from, to); } - - /// Get the parent paragraph - wxRichTextParagraph* GetParent() { return m_parent; } - - /// Get the range - const wxRichTextRange& GetRange() const { return m_range; } - wxRichTextRange& GetRange() { return m_range; } - - /// Get the absolute range - wxRichTextRange GetAbsoluteRange() const; - - /// Get/set the line size as calculated by Layout. - virtual wxSize GetSize() const { return m_size; } - virtual void SetSize(const wxSize& sz) { m_size = sz; } - - /// Get/set the object position relative to the parent - virtual wxPoint GetPosition() const { return m_pos; } - virtual void SetPosition(const wxPoint& pos) { m_pos = pos; } - - /// Get the absolute object position - virtual wxPoint GetAbsolutePosition() const; - - /// Get the rectangle enclosing the line - virtual wxRect GetRect() const { return wxRect(GetAbsolutePosition(), GetSize()); } - - /// Set/get stored descent - void SetDescent(int descent) { m_descent = descent; } - int GetDescent() const { return m_descent; } - -#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING - wxArrayInt& GetObjectSizes() { return m_objectSizes; } - const wxArrayInt& GetObjectSizes() const { return m_objectSizes; } -#endif - -// Operations - - /// Initialisation - void Init(wxRichTextParagraph* parent); - - /// Copy - void Copy(const wxRichTextLine& obj); - - /// Clone - virtual wxRichTextLine* Clone() const { return new wxRichTextLine(*this); } - -protected: - - /// The range of the line (start position to end position) - /// This is relative to the parent paragraph. - wxRichTextRange m_range; - - /// Size and position measured relative to top of paragraph - wxPoint m_pos; - wxSize m_size; - - /// Maximum descent for this line (location of text baseline) - int m_descent; - - // The parent object - wxRichTextParagraph* m_parent; - - // Sizes of the objects within a line so we don't have to get text extents -#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING - wxArrayInt m_objectSizes; -#endif -}; - -WX_DECLARE_LIST_WITH_DECL( wxRichTextLine, wxRichTextLineList , class WXDLLIMPEXP_RICHTEXT ); - -/*! - * wxRichTextParagraph class declaration - * This object represents a single paragraph (or in a straight text editor, a line). - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph: public wxRichTextBox -{ - DECLARE_DYNAMIC_CLASS(wxRichTextParagraph) -public: -// Constructors - - wxRichTextParagraph(wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL); - wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxTextAttrEx* paraStyle = NULL, wxTextAttrEx* charStyle = NULL); - virtual ~wxRichTextParagraph(); - wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextBox() { Copy(obj); } - -// Overrideables - - /// Draw the item - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); - - /// Lay the item out - virtual bool Layout(wxDC& dc, const wxRect& rect, int style); - - /// Get/set the object size for the given range. Returns false if the range - /// is invalid for this object. - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; - - /// Finds the absolute position and row height for the given character position - virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); - - /// Hit-testing: returns a flag indicating hit test details, plus - /// information about position - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition); - - /// Calculate range - virtual void CalculateRange(long start, long& end); - -// Accessors - - /// Get the cached lines - wxRichTextLineList& GetLines() { return m_cachedLines; } - -// Operations - - /// Copy - void Copy(const wxRichTextParagraph& obj); - - /// Clone - virtual wxRichTextObject* Clone() const { return new wxRichTextParagraph(*this); } - - /// Clear the cached lines - void ClearLines(); - -// Implementation - - /// Apply paragraph styles such as centering to the wrapped lines - virtual void ApplyParagraphStyle(const wxTextAttrEx& attr, const wxRect& rect); - - /// Insert text at the given position - virtual bool InsertText(long pos, const wxString& text); - - /// Split an object at this position if necessary, and return - /// the previous object, or NULL if inserting at beginning. - virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = NULL); - - /// Move content to a list from this point - virtual void MoveToList(wxRichTextObject* obj, wxList& list); - - /// Add content back from list - virtual void MoveFromList(wxList& list); - - /// Get the plain text searching from the start or end of the range. - /// The resulting string may be shorter than the range given. - bool GetContiguousPlainText(wxString& text, const wxRichTextRange& range, bool fromStart = true); - - /// Find a suitable wrap position. wrapPosition is the last position in the line to the left - /// of the split. - bool FindWrapPosition(const wxRichTextRange& range, wxDC& dc, int availableSpace, long& wrapPosition); - - /// Find the object at the given position - wxRichTextObject* FindObjectAtPosition(long position); - - /// Get the bullet text for this paragraph. - wxString GetBulletText(); - - /// Allocate or reuse a line object - wxRichTextLine* AllocateLine(int pos); - - /// Clear remaining unused line objects, if any - bool ClearUnusedLines(int lineCount); - - /// Get combined attributes of the base style, paragraph style and character style. We use this to dynamically - /// retrieve the actual style. - wxTextAttrEx GetCombinedAttributes(const wxTextAttrEx& contentStyle) const; - - /// Get combined attributes of the base style and paragraph style. - wxTextAttrEx GetCombinedAttributes() const; - - /// Get the first position from pos that has a line break character. - long GetFirstLineBreakPosition(long pos); - - /// Create default tabstop array - static void InitDefaultTabs(); - - /// Clear default tabstop array - static void ClearDefaultTabs(); - - /// Get default tabstop array - static const wxArrayInt& GetDefaultTabs() { return sm_defaultTabs; } - -protected: - /// The lines that make up the wrapped paragraph - wxRichTextLineList m_cachedLines; - - /// Default tabstops - static wxArrayInt sm_defaultTabs; -}; - -/*! - * wxRichTextPlainText class declaration - * This object represents a single piece of text. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText: public wxRichTextObject -{ - DECLARE_DYNAMIC_CLASS(wxRichTextPlainText) -public: -// Constructors - - wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL); - wxRichTextPlainText(const wxRichTextPlainText& obj): wxRichTextObject() { Copy(obj); } - -// Overrideables - - /// Draw the item - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); - - /// Lay the item out - virtual bool Layout(wxDC& dc, const wxRect& rect, int style); - - /// Get/set the object size for the given range. Returns false if the range - /// is invalid for this object. - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position/* = wxPoint(0,0)*/) const; - - /// Get any text in this object for the given range - virtual wxString GetTextForRange(const wxRichTextRange& range) const; - - /// Do a split, returning an object containing the second part, and setting - /// the first part in 'this'. - virtual wxRichTextObject* DoSplit(long pos); - - /// Calculate range - virtual void CalculateRange(long start, long& end); - - /// Delete range - virtual bool DeleteRange(const wxRichTextRange& range); - - /// Returns true if the object is empty - virtual bool IsEmpty() const { return m_text.empty(); } - - /// Returns true if this object can merge itself with the given one. - virtual bool CanMerge(wxRichTextObject* object) const; - - /// Returns true if this object merged itself with the given one. - /// The calling code will then delete the given object. - virtual bool Merge(wxRichTextObject* object); - - /// Dump to output stream for debugging - virtual void Dump(wxTextOutputStream& stream); - - /// Get the first position from pos that has a line break character. - long GetFirstLineBreakPosition(long pos); - -// Accessors - - /// Get the text - const wxString& GetText() const { return m_text; } - - /// Set the text - void SetText(const wxString& text) { m_text = text; } - -// Operations - - /// Copy - void Copy(const wxRichTextPlainText& obj); - - /// Clone - virtual wxRichTextObject* Clone() const { return new wxRichTextPlainText(*this); } -private: - bool DrawTabbedString(wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, wxString& str, wxCoord& x, wxCoord& y, bool selected); - -protected: - wxString m_text; -}; - -/*! - * wxRichTextImageBlock stores information about an image, in binary in-memory form - */ - -class WXDLLIMPEXP_FWD_BASE wxDataInputStream; -class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; - -class WXDLLIMPEXP_RICHTEXT wxRichTextImageBlock: public wxObject -{ -public: - wxRichTextImageBlock(); - wxRichTextImageBlock(const wxRichTextImageBlock& block); - virtual ~wxRichTextImageBlock(); - - void Init(); - void Clear(); - - // Load the original image into a memory block. - // If the image is not a JPEG, we must convert it into a JPEG - // to conserve space. - // If it's not a JPEG we can make use of 'image', already scaled, so we don't have to - // load the image a 2nd time. - virtual bool MakeImageBlock(const wxString& filename, int imageType, wxImage& image, bool convertToJPEG = true); - - // Make an image block from the wxImage in the given - // format. - virtual bool MakeImageBlock(wxImage& image, int imageType, int quality = 80); - - // Write to a file - bool Write(const wxString& filename); - - // Write data in hex to a stream - bool WriteHex(wxOutputStream& stream); - - // Read data in hex from a stream - bool ReadHex(wxInputStream& stream, int length, int imageType); - - // Copy from 'block' - void Copy(const wxRichTextImageBlock& block); - - // Load a wxImage from the block - bool Load(wxImage& image); - -//// Operators - void operator=(const wxRichTextImageBlock& block); - -//// Accessors - - unsigned char* GetData() const { return m_data; } - size_t GetDataSize() const { return m_dataSize; } - int GetImageType() const { return m_imageType; } - - void SetData(unsigned char* image) { m_data = image; } - void SetDataSize(size_t size) { m_dataSize = size; } - void SetImageType(int imageType) { m_imageType = imageType; } - - bool Ok() const { return IsOk(); } - bool IsOk() const { return GetData() != NULL; } - - // Gets the extension for the block's type - wxString GetExtension() const; - -/// Implementation - - // Allocate and read from stream as a block of memory - static unsigned char* ReadBlock(wxInputStream& stream, size_t size); - static unsigned char* ReadBlock(const wxString& filename, size_t size); - - // Write memory block to stream - static bool WriteBlock(wxOutputStream& stream, unsigned char* block, size_t size); - - // Write memory block to file - static bool WriteBlock(const wxString& filename, unsigned char* block, size_t size); - -protected: - // Size in bytes of the image stored. - // This is in the raw, original form such as a JPEG file. - unsigned char* m_data; - size_t m_dataSize; - int m_imageType; // wxWin type id -}; - - -/*! - * wxRichTextImage class declaration - * This object represents an image. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextImage: public wxRichTextObject -{ - DECLARE_DYNAMIC_CLASS(wxRichTextImage) -public: -// Constructors - - wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { } - wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL); - wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL); - wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject() { Copy(obj); } - -// Overrideables - - /// Draw the item - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); - - /// Lay the item out - virtual bool Layout(wxDC& dc, const wxRect& rect, int style); - - /// Get the object size for the given range. Returns false if the range - /// is invalid for this object. - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; - - /// Returns true if the object is empty - virtual bool IsEmpty() const { return !m_image.Ok(); } - -// Accessors - - /// Get the image - const wxImage& GetImage() const { return m_image; } - - /// Set the image - void SetImage(const wxImage& image) { m_image = image; } - - /// Get the image block containing the raw data - wxRichTextImageBlock& GetImageBlock() { return m_imageBlock; } - -// Operations - - /// Copy - void Copy(const wxRichTextImage& obj); - - /// Clone - virtual wxRichTextObject* Clone() const { return new wxRichTextImage(*this); } - - /// Load wxImage from the block - virtual bool LoadFromBlock(); - - /// Make block from the wxImage - virtual bool MakeBlock(); - -protected: - // TODO: reduce the multiple representations of data - wxImage m_image; - wxBitmap m_bitmap; - wxRichTextImageBlock m_imageBlock; -}; - - -/*! - * wxRichTextBuffer class declaration - * This is a kind of box, used to represent the whole buffer - */ - -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction; - -class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer: public wxRichTextParagraphLayoutBox -{ - DECLARE_DYNAMIC_CLASS(wxRichTextBuffer) -public: -// Constructors - - wxRichTextBuffer() { Init(); } - wxRichTextBuffer(const wxRichTextBuffer& obj): wxRichTextParagraphLayoutBox() { Init(); Copy(obj); } - virtual ~wxRichTextBuffer() ; - -// Accessors - - /// Gets the command processor - wxCommandProcessor* GetCommandProcessor() const { return m_commandProcessor; } - - /// Set style sheet, if any. - void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; } - virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } - - /// Set style sheet and notify of the change - bool SetStyleSheetAndNotify(wxRichTextStyleSheet* sheet); - - /// Push style sheet to top of stack - bool PushStyleSheet(wxRichTextStyleSheet* styleSheet); - - /// Pop style sheet from top of stack - wxRichTextStyleSheet* PopStyleSheet(); - -// Operations - - /// Initialisation - void Init(); - - /// Clears the buffer, adds an empty paragraph, and clears the command processor. - virtual void ResetAndClearCommands(); - - /// Load a file - virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY); - - /// Save a file - virtual bool SaveFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY); - - /// Load from a stream - virtual bool LoadFile(wxInputStream& stream, int type = wxRICHTEXT_TYPE_ANY); - - /// Save to a stream - virtual bool SaveFile(wxOutputStream& stream, int type = wxRICHTEXT_TYPE_ANY); - - /// Set the handler flags, controlling loading and saving - void SetHandlerFlags(int flags) { m_handlerFlags = flags; } - - /// Get the handler flags, controlling loading and saving - int GetHandlerFlags() const { return m_handlerFlags; } - - /// Convenience function to add a paragraph of text - virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttrEx* paraStyle = NULL) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } - - /// Begin collapsing undo/redo commands. Note that this may not work properly - /// if combining commands that delete or insert content, changing ranges for - /// subsequent actions. - virtual bool BeginBatchUndo(const wxString& cmdName); - - /// End collapsing undo/redo commands - virtual bool EndBatchUndo(); - - /// Collapsing commands? - virtual bool BatchingUndo() const { return m_batchedCommandDepth > 0; } - - /// Submit immediately, or delay according to whether collapsing is on - virtual bool SubmitAction(wxRichTextAction* action); - - /// Get collapsed command - virtual wxRichTextCommand* GetBatchedCommand() const { return m_batchedCommand; } - - /// Begin suppressing undo/redo commands. The way undo is suppressed may be implemented - /// differently by each command. If not dealt with by a command implementation, then - /// it will be implemented automatically by not storing the command in the undo history - /// when the action is submitted to the command processor. - virtual bool BeginSuppressUndo(); - - /// End suppressing undo/redo commands. - virtual bool EndSuppressUndo(); - - /// Collapsing commands? - virtual bool SuppressingUndo() const { return m_suppressUndo > 0; } - - /// Copy the range to the clipboard - virtual bool CopyToClipboard(const wxRichTextRange& range); - - /// Paste the clipboard content to the buffer - virtual bool PasteFromClipboard(long position); - - /// Can we paste from the clipboard? - virtual bool CanPasteFromClipboard() const; - - /// Begin using a style - virtual bool BeginStyle(const wxTextAttrEx& style); - - /// End the style - virtual bool EndStyle(); - - /// End all styles - virtual bool EndAllStyles(); - - /// Clear the style stack - virtual void ClearStyleStack(); - - /// Get the size of the style stack, for example to check correct nesting - virtual size_t GetStyleStackSize() const { return m_attributeStack.GetCount(); } - - /// Begin using bold - bool BeginBold(); - - /// End using bold - bool EndBold() { return EndStyle(); } - - /// Begin using italic - bool BeginItalic(); - - /// End using italic - bool EndItalic() { return EndStyle(); } - - /// Begin using underline - bool BeginUnderline(); - - /// End using underline - bool EndUnderline() { return EndStyle(); } - - /// Begin using point size - bool BeginFontSize(int pointSize); - - /// End using point size - bool EndFontSize() { return EndStyle(); } - - /// Begin using this font - bool BeginFont(const wxFont& font); - - /// End using a font - bool EndFont() { return EndStyle(); } - - /// Begin using this colour - bool BeginTextColour(const wxColour& colour); - - /// End using a colour - bool EndTextColour() { return EndStyle(); } - - /// Begin using alignment - bool BeginAlignment(wxTextAttrAlignment alignment); - - /// End alignment - bool EndAlignment() { return EndStyle(); } - - /// Begin left indent - bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0); - - /// End left indent - bool EndLeftIndent() { return EndStyle(); } - - /// Begin right indent - bool BeginRightIndent(int rightIndent); - - /// End right indent - bool EndRightIndent() { return EndStyle(); } - - /// Begin paragraph spacing - bool BeginParagraphSpacing(int before, int after); - - /// End paragraph spacing - bool EndParagraphSpacing() { return EndStyle(); } - - /// Begin line spacing - bool BeginLineSpacing(int lineSpacing); - - /// End line spacing - bool EndLineSpacing() { return EndStyle(); } - - /// Begin numbered bullet - bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD); - - /// End numbered bullet - bool EndNumberedBullet() { return EndStyle(); } - - /// Begin symbol bullet - bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL); - - /// End symbol bullet - bool EndSymbolBullet() { return EndStyle(); } - - /// Begin standard bullet - bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD); - - /// End standard bullet - bool EndStandardBullet() { return EndStyle(); } - - /// Begin named character style - bool BeginCharacterStyle(const wxString& characterStyle); - - /// End named character style - bool EndCharacterStyle() { return EndStyle(); } - - /// Begin named paragraph style - bool BeginParagraphStyle(const wxString& paragraphStyle); - - /// End named character style - bool EndParagraphStyle() { return EndStyle(); } - - /// Begin named list style - bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1); - - /// End named character style - bool EndListStyle() { return EndStyle(); } - - /// Begin URL - bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString); - - /// End URL - bool EndURL() { return EndStyle(); } - -// Event handling - - /// Add an event handler - bool AddEventHandler(wxEvtHandler* handler); - - /// Remove an event handler - bool RemoveEventHandler(wxEvtHandler* handler, bool deleteHandler = false); - - /// Clear event handlers - void ClearEventHandlers(); - - /// Send event to event handlers. If sendToAll is true, will send to all event handlers, - /// otherwise will stop at the first successful one. - bool SendEvent(wxEvent& event, bool sendToAll = true); - -// Implementation - - /// Copy - void Copy(const wxRichTextBuffer& obj); - - /// Clone - virtual wxRichTextObject* Clone() const { return new wxRichTextBuffer(*this); } - - /// Submit command to insert paragraphs - bool InsertParagraphsWithUndo(long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int flags = 0); - - /// Submit command to insert the given text - bool InsertTextWithUndo(long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags = 0); - - /// Submit command to insert a newline - bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int flags = 0); - - /// Submit command to insert the given image - bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags = 0); - - /// Submit command to delete this range - bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl); - - /// Mark modified - void Modify(bool modify = true) { m_modified = modify; } - bool IsModified() const { return m_modified; } - - /// Get the style that is appropriate for a new paragraph at this position. - /// If the previous paragraph has a paragraph style name, look up the next-paragraph - /// style. - wxRichTextAttr GetStyleForNewParagraph(long pos, bool caretPosition = false, bool lookUpNewParaStyle=false) const; - - /// Dumps contents of buffer for debugging purposes - virtual void Dump(); - virtual void Dump(wxTextOutputStream& stream) { wxRichTextParagraphLayoutBox::Dump(stream); } - - /// Returns the file handlers - static wxList& GetHandlers() { return sm_handlers; } - - /// Adds a handler to the end - static void AddHandler(wxRichTextFileHandler *handler); - - /// Inserts a handler at the front - static void InsertHandler(wxRichTextFileHandler *handler); - - /// Removes a handler - static bool RemoveHandler(const wxString& name); - - /// Finds a handler by name - static wxRichTextFileHandler *FindHandler(const wxString& name); - - /// Finds a handler by extension and type - static wxRichTextFileHandler *FindHandler(const wxString& extension, int imageType); - - /// Finds a handler by filename or, if supplied, type - static wxRichTextFileHandler *FindHandlerFilenameOrType(const wxString& filename, int imageType); - - /// Finds a handler by type - static wxRichTextFileHandler *FindHandler(int imageType); - - /// Gets a wildcard incorporating all visible handlers. If 'types' is present, - /// will be filled with the file type corresponding to each filter. This can be - /// used to determine the type to pass to LoadFile given a selected filter. - static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = NULL); - - /// Clean up handlers - static void CleanUpHandlers(); - - /// Initialise the standard handlers - static void InitStandardHandlers(); - - /// Get renderer - static wxRichTextRenderer* GetRenderer() { return sm_renderer; } - - /// Set renderer, deleting old one - static void SetRenderer(wxRichTextRenderer* renderer); - - /// Minimum margin between bullet and paragraph in 10ths of a mm - static int GetBulletRightMargin() { return sm_bulletRightMargin; } - static void SetBulletRightMargin(int margin) { sm_bulletRightMargin = margin; } - - /// Factor to multiply by character height to get a reasonable bullet size - static float GetBulletProportion() { return sm_bulletProportion; } - static void SetBulletProportion(float prop) { sm_bulletProportion = prop; } - - /// Scale factor for calculating dimensions - double GetScale() const { return m_scale; } - void SetScale(double scale) { m_scale = scale; } - -protected: - - /// Command processor - wxCommandProcessor* m_commandProcessor; - - /// Has been modified? - bool m_modified; - - /// Collapsed command stack - int m_batchedCommandDepth; - - /// Name for collapsed command - wxString m_batchedCommandsName; - - /// Current collapsed command accumulating actions - wxRichTextCommand* m_batchedCommand; - - /// Whether to suppress undo - int m_suppressUndo; - - /// Style sheet, if any - wxRichTextStyleSheet* m_styleSheet; - - /// List of event handlers that will be notified of events - wxList m_eventHandlers; - - /// Stack of attributes for convenience functions - wxList m_attributeStack; - - /// Flags to be passed to handlers - int m_handlerFlags; - - /// File handlers - static wxList sm_handlers; - - /// Renderer - static wxRichTextRenderer* sm_renderer; - - /// Minimum margin between bullet and paragraph in 10ths of a mm - static int sm_bulletRightMargin; - - /// Factor to multiply by character height to get a reasonable bullet size - static float sm_bulletProportion; - - /// Scaling factor in use: needed to calculate correct dimensions when printing - double m_scale; -}; - -/*! - * The command identifiers - * - */ - -enum wxRichTextCommandId -{ - wxRICHTEXT_INSERT, - wxRICHTEXT_DELETE, - wxRICHTEXT_CHANGE_STYLE -}; - -/*! - * Command classes for undo/redo - * - */ - -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction; -class WXDLLIMPEXP_RICHTEXT wxRichTextCommand: public wxCommand -{ -public: - // Ctor for one action - wxRichTextCommand(const wxString& name, wxRichTextCommandId id, wxRichTextBuffer* buffer, - wxRichTextCtrl* ctrl, bool ignoreFirstTime = false); - - // Ctor for multiple actions - wxRichTextCommand(const wxString& name); - - virtual ~wxRichTextCommand(); - - bool Do(); - bool Undo(); - - void AddAction(wxRichTextAction* action); - void ClearActions(); - - wxList& GetActions() { return m_actions; } - -protected: - - wxList m_actions; -}; - -/*! - * wxRichTextAction class declaration - * There can be more than one action in a command. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextAction: public wxObject -{ -public: - wxRichTextAction(wxRichTextCommand* cmd, const wxString& name, wxRichTextCommandId id, wxRichTextBuffer* buffer, - wxRichTextCtrl* ctrl, bool ignoreFirstTime = false); - - virtual ~wxRichTextAction(); - - bool Do(); - bool Undo(); - - /// Update the control appearance - void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false, - wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL); - - /// Replace the buffer paragraphs with the given fragment. - void ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragment); - -#if wxABI_VERSION >= 20808 - // Create arrays to be used in refresh optimization - void CalculateRefreshOptimizations(wxArrayInt& optimizationLineCharPositions, wxArrayInt& optimizationLineYPositions); -#endif - - /// Get the fragments - wxRichTextParagraphLayoutBox& GetNewParagraphs() { return m_newParagraphs; } - wxRichTextParagraphLayoutBox& GetOldParagraphs() { return m_oldParagraphs; } - - /// Set/get the position used for e.g. insertion - void SetPosition(long pos) { m_position = pos; } - long GetPosition() const { return m_position; } - - /// Set/get the range for e.g. deletion - void SetRange(const wxRichTextRange& range) { m_range = range; } - const wxRichTextRange& GetRange() const { return m_range; } - - /// Get name - const wxString& GetName() const { return m_name; } - -protected: - // Action name - wxString m_name; - - // Buffer - wxRichTextBuffer* m_buffer; - - // Control - wxRichTextCtrl* m_ctrl; - - // Stores the new paragraphs - wxRichTextParagraphLayoutBox m_newParagraphs; - - // Stores the old paragraphs - wxRichTextParagraphLayoutBox m_oldParagraphs; - - // The affected range - wxRichTextRange m_range; - - // The insertion point for this command - long m_position; - - // Ignore 1st 'Do' operation because we already did it - bool m_ignoreThis; - - // The command identifier - wxRichTextCommandId m_cmdId; -}; - -/*! - * Handler flags - */ - -// Include style sheet when loading and saving -#define wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET 0x0001 - -// Save images to memory file system in HTML handler -#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY 0x0010 - -// Save images to files in HTML handler -#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES 0x0020 - -// Save images as inline base64 data in HTML handler -#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040 - -// Don't write header and footer (or BODY), so we can include the fragment -// in a larger document -#define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080 - -// Convert the more common face names to names that will work on the current platform -// in a larger document -#define wxRICHTEXT_HANDLER_CONVERT_FACENAMES 0x0100 - -/*! - * wxRichTextFileHandler - * Base class for file handlers - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler: public wxObject -{ - DECLARE_CLASS(wxRichTextFileHandler) -public: - wxRichTextFileHandler(const wxString& name = wxEmptyString, const wxString& ext = wxEmptyString, int type = 0) - : m_name(name), m_extension(ext), m_type(type), m_flags(0), m_visible(true) - { } - -#if wxUSE_STREAMS - bool LoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) - { return DoLoadFile(buffer, stream); } - bool SaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) - { return DoSaveFile(buffer, stream); } -#endif - - bool LoadFile(wxRichTextBuffer *buffer, const wxString& filename); - bool SaveFile(wxRichTextBuffer *buffer, const wxString& filename); - - /// Can we handle this filename (if using files)? By default, checks the extension. - virtual bool CanHandle(const wxString& filename) const; - - /// Can we save using this handler? - virtual bool CanSave() const { return false; } - - /// Can we load using this handler? - virtual bool CanLoad() const { return false; } - - /// Should this handler be visible to the user? - virtual bool IsVisible() const { return m_visible; } - virtual void SetVisible(bool visible) { m_visible = visible; } - - /// The name of the nandler - void SetName(const wxString& name) { m_name = name; } - wxString GetName() const { return m_name; } - - /// The default extension to recognise - void SetExtension(const wxString& ext) { m_extension = ext; } - wxString GetExtension() const { return m_extension; } - - /// The handler type - void SetType(int type) { m_type = type; } - int GetType() const { return m_type; } - - /// Flags controlling how loading and saving is done - void SetFlags(int flags) { m_flags = flags; } - int GetFlags() const { return m_flags; } - - /// Encoding to use when saving a file. If empty, a suitable encoding is chosen - void SetEncoding(const wxString& encoding) { m_encoding = encoding; } - const wxString& GetEncoding() const { return m_encoding; } - -protected: - -#if wxUSE_STREAMS - virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) = 0; - virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) = 0; -#endif - - wxString m_name; - wxString m_encoding; - wxString m_extension; - int m_type; - int m_flags; - bool m_visible; -}; - -/*! - * wxRichTextPlainTextHandler - * Plain text handler - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextPlainTextHandler: public wxRichTextFileHandler -{ - DECLARE_CLASS(wxRichTextPlainTextHandler) -public: - wxRichTextPlainTextHandler(const wxString& name = wxT("Text"), const wxString& ext = wxT("txt"), int type = wxRICHTEXT_TYPE_TEXT) - : wxRichTextFileHandler(name, ext, type) - { } - - /// Can we save using this handler? - virtual bool CanSave() const { return true; } - - /// Can we load using this handler? - virtual bool CanLoad() const { return true; } - -protected: - -#if wxUSE_STREAMS - virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); - virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); -#endif - -}; - -#if wxUSE_DATAOBJ - -/*! - * The data object for a wxRichTextBuffer - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextBufferDataObject: public wxDataObjectSimple -{ -public: - // ctor doesn't copy the pointer, so it shouldn't go away while this object - // is alive - wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = (wxRichTextBuffer*) NULL); - virtual ~wxRichTextBufferDataObject(); - - // after a call to this function, the buffer is owned by the caller and it - // is responsible for deleting it - wxRichTextBuffer* GetRichTextBuffer(); - - // Returns the id for the new data format - static const wxChar* GetRichTextBufferFormatId() { return ms_richTextBufferFormatId; } - - // base class pure virtuals - - virtual wxDataFormat GetPreferredFormat(Direction dir) const; - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *pBuf) const; - virtual bool SetData(size_t len, const void *buf); - - // prevent warnings - - virtual size_t GetDataSize(const wxDataFormat&) const { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) { return SetData(len, buf); } - -private: - wxDataFormat m_formatRichTextBuffer; // our custom format - wxRichTextBuffer* m_richTextBuffer; // our data - static const wxChar* ms_richTextBufferFormatId; // our format id -}; - -#endif - -/*! - * wxRichTextRenderer isolates common drawing functionality - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer: public wxObject -{ -public: - wxRichTextRenderer() {} - virtual ~wxRichTextRenderer() {} - - /// Draw a standard bullet, as specified by the value of GetBulletName - virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect) = 0; - - /// Draw a bullet that can be described by text, such as numbered or symbol bullets - virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, const wxString& text) = 0; - - /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName - virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect) = 0; - - /// Enumerate the standard bullet names currently supported - virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) = 0; -}; - -/*! - * wxRichTextStdRenderer: standard renderer - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextStdRenderer: public wxRichTextRenderer -{ -public: - wxRichTextStdRenderer() {} - - /// Draw a standard bullet, as specified by the value of GetBulletName - virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect); - - /// Draw a bullet that can be described by text, such as numbered or symbol bullets - virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, const wxString& text); - - /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName - virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect); - - /// Enumerate the standard bullet names currently supported - virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames); -}; - -/*! - * Utilities - * - */ - -inline bool wxRichTextHasStyle(int flags, int style) -{ - return ((flags & style) == style); -} - -/// Compare two attribute objects -WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2); -WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttr& attr1, const wxRichTextAttr& attr2); - -/// Compare two attribute objects, but take into account the flags -/// specifying attributes of interest. -WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2, int flags); -WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxRichTextAttr& attr2, int flags); - -/// Apply one style to another -WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxTextAttrEx& style); -WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxTextAttrEx& style); -WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); -WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); - -// Remove attributes -WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style); - -/// Combine two bitlists -WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB); - -/// Compare two bitlists -WXDLLIMPEXP_RICHTEXT bool wxRichTextBitlistsEqPartial(int valueA, int valueB, int flags); - -/// Split into paragraph and character styles -WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxTextAttrEx& style, wxTextAttrEx& parStyle, wxTextAttrEx& charStyle); - -/// Compare tabs -WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2); - -/// Set the font without changing the font attributes -WXDLLIMPEXP_RICHTEXT void wxSetFontPreservingStyles(wxTextAttr& attr, const wxFont& font); - -/// Convert a decimal to Roman numerals -WXDLLIMPEXP_RICHTEXT wxString wxRichTextDecimalToRoman(long n); - -WXDLLIMPEXP_RICHTEXT void wxRichTextModuleInit(); - -#endif - // wxUSE_RICHTEXT - -#endif - // _WX_RICHTEXTBUFFER_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextbuffer.h +// Purpose: Buffer for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// RCS-ID: $Id: richtextbuffer.h 53671 2008-05-20 13:23:07Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTBUFFER_H_ +#define _WX_RICHTEXTBUFFER_H_ + +/* + + Data structures + =============== + + Data is represented by a hierarchy of objects, all derived from + wxRichTextObject. + + The top of the hierarchy is the buffer, a kind of wxRichTextParagraphLayoutBox. + These boxes will allow flexible placement of text boxes on a page, but + for now there is a single box representing the document, and this box is + a wxRichTextParagraphLayoutBox which contains further wxRichTextParagraph + objects, each of which can include text and images. + + Each object maintains a range (start and end position) measured + from the start of the main parent box. + A paragraph object knows its range, and a text fragment knows its range + too. So, a character or image in a page has a position relative to the + start of the document, and a character in an embedded text box has + a position relative to that text box. For now, we will not be dealing with + embedded objects but it's something to bear in mind for later. + + Note that internally, a range (5,5) represents a range of one character. + In the public wx[Rich]TextCtrl API, this would be passed to e.g. SetSelection + as (5,6). A paragraph with one character might have an internal range of (0, 1) + since the end of the paragraph takes up one position. + + Layout + ====== + + When Layout is called on an object, it is given a size which the object + must limit itself to, or one or more flexible directions (vertical + or horizontal). So for example a centered paragraph is given the page + width to play with (minus any margins), but can extend indefinitely + in the vertical direction. The implementation of Layout can then + cache the calculated size and position within the parent. + + */ + +/*! + * Includes + */ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT + +#include "wx/list.h" +#include "wx/textctrl.h" +#include "wx/bitmap.h" +#include "wx/image.h" +#include "wx/cmdproc.h" +#include "wx/txtstrm.h" + +#if wxUSE_DATAOBJ +#include "wx/dataobj.h" +#endif + +// Setting wxRICHTEXT_USE_OWN_CARET to 1 implements a non-flashing +// cursor reliably without using wxClientDC in case there +// are platform-specific problems with the generic caret. +#define wxRICHTEXT_USE_OWN_CARET 0 + +// Switch off for binary compatibility, on for faster drawing +#define wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING 0 + +/*! + * Special characters + */ + +extern WXDLLIMPEXP_RICHTEXT const wxChar wxRichTextLineBreakChar; + +/*! + * File types + */ + +#define wxRICHTEXT_TYPE_ANY 0 +#define wxRICHTEXT_TYPE_TEXT 1 +#define wxRICHTEXT_TYPE_XML 2 +#define wxRICHTEXT_TYPE_HTML 3 +#define wxRICHTEXT_TYPE_RTF 4 +#define wxRICHTEXT_TYPE_PDF 5 + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet; +class WXDLLIMPEXP_FWD_RICHTEXT wxTextAttrEx; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer; + +/*! + * Flags determining the available space, passed to Layout + */ + +#define wxRICHTEXT_FIXED_WIDTH 0x01 +#define wxRICHTEXT_FIXED_HEIGHT 0x02 +#define wxRICHTEXT_VARIABLE_WIDTH 0x04 +#define wxRICHTEXT_VARIABLE_HEIGHT 0x08 + +// Only lay out the part of the buffer that lies within +// the rect passed to Layout. +#define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10 + +/*! + * Flags to pass to Draw + */ + +// Ignore paragraph cache optimization, e.g. for printing purposes +// where one line may be drawn higher (on the next page) compared +// with the previous line +#define wxRICHTEXT_DRAW_IGNORE_CACHE 0x01 + +/*! + * Flags returned from hit-testing + */ + +// The point was not on this object +#define wxRICHTEXT_HITTEST_NONE 0x01 +// The point was before the position returned from HitTest +#define wxRICHTEXT_HITTEST_BEFORE 0x02 +// The point was after the position returned from HitTest +#define wxRICHTEXT_HITTEST_AFTER 0x04 +// The point was on the position returned from HitTest +#define wxRICHTEXT_HITTEST_ON 0x08 +// The point was on space outside content +#define wxRICHTEXT_HITTEST_OUTSIDE 0x10 + +/*! + * Flags for GetRangeSize + */ + +#define wxRICHTEXT_FORMATTED 0x01 +#define wxRICHTEXT_UNFORMATTED 0x02 +#define wxRICHTEXT_CACHE_SIZE 0x04 +#define wxRICHTEXT_HEIGHT_ONLY 0x08 + +/*! + * Flags for SetStyle/SetListStyle + */ + +#define wxRICHTEXT_SETSTYLE_NONE 0x00 + +// Specifies that this operation should be undoable +#define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01 + +// Specifies that the style should not be applied if the +// combined style at this point is already the style in question. +#define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02 + +// Specifies that the style should only be applied to paragraphs, +// and not the content. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04 + +// Specifies that the style should only be applied to characters, +// and not the paragraph. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08 + +// For SetListStyle only: specifies starting from the given number, otherwise +// deduces number from existing attributes +#define wxRICHTEXT_SETSTYLE_RENUMBER 0x10 + +// For SetListStyle only: specifies the list level for all paragraphs, otherwise +// the current indentation will be used +#define wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL 0x20 + +// Resets the existing style before applying the new style +#define wxRICHTEXT_SETSTYLE_RESET 0x40 + +// Removes the given style instead of applying it +#define wxRICHTEXT_SETSTYLE_REMOVE 0x80 + +/*! + * Flags for text insertion + */ + +#define wxRICHTEXT_INSERT_NONE 0x00 +#define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01 +#define wxRICHTEXT_INSERT_INTERACTIVE 0x02 + +/*! + * Extra formatting flags not in wxTextAttr + */ + +#define wxTEXT_ATTR_PARA_SPACING_AFTER 0x00000800 +#define wxTEXT_ATTR_PARA_SPACING_BEFORE 0x00001000 +#define wxTEXT_ATTR_LINE_SPACING 0x00002000 +#define wxTEXT_ATTR_CHARACTER_STYLE_NAME 0x00004000 +#define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME 0x00008000 +#define wxTEXT_ATTR_LIST_STYLE_NAME 0x00010000 +#define wxTEXT_ATTR_BULLET_STYLE 0x00020000 +#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000 +#define wxTEXT_ATTR_BULLET_TEXT 0x00080000 +#define wxTEXT_ATTR_BULLET_NAME 0x00100000 +#define wxTEXT_ATTR_URL 0x00200000 +#define wxTEXT_ATTR_PAGE_BREAK 0x00400000 +#define wxTEXT_ATTR_EFFECTS 0x00800000 +#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000 + +// A special flag telling the buffer to keep the first paragraph style +// as-is, when deleting a paragraph marker. In future we might pass a +// flag to InsertFragment and DeleteRange to indicate the appropriate mode. +#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x10000000 + +/*! + * Styles for wxTextAttrEx::SetBulletStyle + */ + +#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000 +#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001 +#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002 +#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004 +#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008 +#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010 +#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020 +#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040 +#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080 +#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100 +#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200 +#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400 +#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800 + +#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000 +#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000 +#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000 + +/*! + * Styles for wxTextAttrEx::SetTextEffects + */ + +#define wxTEXT_ATTR_EFFECT_NONE 0x00000000 +#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001 +#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002 +#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004 +#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008 +#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010 +#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020 +#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040 +#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080 +#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100 +#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200 + +/*! + * Line spacing values + */ + +#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10 +#define wxTEXT_ATTR_LINE_SPACING_HALF 15 +#define wxTEXT_ATTR_LINE_SPACING_TWICE 20 + +/*! + * Character and paragraph combined styles + */ + +#define wxTEXT_ATTR_CHARACTER (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS|wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL) + +#define wxTEXT_ATTR_PARAGRAPH (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ + wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ + wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\ + wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL) + +#define wxTEXT_ATTR_ALL (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) + +/*! + * Default superscript/subscript font multiplication factor + */ + +#define wxSCRIPT_MUL_FACTOR 1.5 + +/*! + * wxRichTextRange class declaration + * This stores beginning and end positions for a range of data. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextRange +{ +public: +// Constructors + + wxRichTextRange() { m_start = 0; m_end = 0; } + wxRichTextRange(long start, long end) { m_start = start; m_end = end; } + wxRichTextRange(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; } + ~wxRichTextRange() {} + + void operator =(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; } + bool operator ==(const wxRichTextRange& range) const { return (m_start == range.m_start && m_end == range.m_end); } + bool operator !=(const wxRichTextRange& range) const { return (m_start != range.m_start && m_end != range.m_end); } + wxRichTextRange operator -(const wxRichTextRange& range) const { return wxRichTextRange(m_start - range.m_start, m_end - range.m_end); } + wxRichTextRange operator +(const wxRichTextRange& range) const { return wxRichTextRange(m_start + range.m_start, m_end + range.m_end); } + + void SetRange(long start, long end) { m_start = start; m_end = end; } + + void SetStart(long start) { m_start = start; } + long GetStart() const { return m_start; } + + void SetEnd(long end) { m_end = end; } + long GetEnd() const { return m_end; } + + /// Returns true if this range is completely outside 'range' + bool IsOutside(const wxRichTextRange& range) const { return range.m_start > m_end || range.m_end < m_start; } + + /// Returns true if this range is completely within 'range' + bool IsWithin(const wxRichTextRange& range) const { return m_start >= range.m_start && m_end <= range.m_end; } + + /// Returns true if the given position is within this range. Allow + /// for the possibility of an empty range - assume the position + /// is within this empty range. NO, I think we should not match with an empty range. + // bool Contains(long pos) const { return pos >= m_start && (pos <= m_end || GetLength() == 0); } + bool Contains(long pos) const { return pos >= m_start && pos <= m_end ; } + + /// Limit this range to be within 'range' + bool LimitTo(const wxRichTextRange& range) ; + + /// Gets the length of the range + long GetLength() const { return m_end - m_start + 1; } + + /// Swaps the start and end + void Swap() { long tmp = m_start; m_start = m_end; m_end = tmp; } + + /// Convert to internal form: (n, n) is the range of a single character. + wxRichTextRange ToInternal() const { return wxRichTextRange(m_start, m_end-1); } + + /// Convert from internal to public API form: (n, n+1) is the range of a single character. + wxRichTextRange FromInternal() const { return wxRichTextRange(m_start, m_end+1); } + +protected: + long m_start; + long m_end; +}; + +#define wxRICHTEXT_ALL wxRichTextRange(-2, -2) +#define wxRICHTEXT_NONE wxRichTextRange(-1, -1) + +/*! + * wxTextAttrEx is an extended version of wxTextAttr with more paragraph attributes. + */ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrEx: public wxTextAttr +{ +public: + // ctors + wxTextAttrEx(const wxTextAttrEx& attr); + wxTextAttrEx(const wxTextAttr& attr) { Init(); (*this) = attr; } + wxTextAttrEx() { Init(); } + + // Initialise this object + void Init(); + + // Copy + void Copy(const wxTextAttrEx& attr); + + // Assignment from a wxTextAttrEx object + void operator= (const wxTextAttrEx& attr); + + // Assignment from a wxTextAttr object + void operator= (const wxTextAttr& attr); + + // Equality test + bool operator== (const wxTextAttrEx& attr) const; + + // setters + void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_CHARACTER_STYLE_NAME); } + void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_PARAGRAPH_STYLE_NAME); } + void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); } + void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_PARA_SPACING_AFTER); } + void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_PARA_SPACING_BEFORE); } + void SetLineSpacing(int spacing) { m_lineSpacing = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_LINE_SPACING); } + void SetBulletStyle(int style) { m_bulletStyle = style; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_STYLE); } + void SetBulletNumber(int n) { m_bulletNumber = n; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NUMBER); } + void SetBulletText(const wxString& text) { m_bulletText = text; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_TEXT); } + void SetBulletName(const wxString& name) { m_bulletName = name; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NAME); } + void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; } + void SetURL(const wxString& url) { m_urlTarget = url; SetFlags(GetFlags() | wxTEXT_ATTR_URL); } + void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } + void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } + void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } + void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } + + const wxString& GetCharacterStyleName() const { return m_characterStyleName; } + const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } + const wxString& GetListStyleName() const { return m_listStyleName; } + int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } + int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } + int GetLineSpacing() const { return m_lineSpacing; } + int GetBulletStyle() const { return m_bulletStyle; } + int GetBulletNumber() const { return m_bulletNumber; } + const wxString& GetBulletText() const { return m_bulletText; } + const wxString& GetBulletName() const { return m_bulletName; } + const wxString& GetBulletFont() const { return m_bulletFont; } + const wxString& GetURL() const { return m_urlTarget; } + int GetTextEffects() const { return m_textEffects; } + int GetTextEffectFlags() const { return m_textEffectFlags; } + int GetOutlineLevel() const { return m_outlineLevel; } + + bool HasFontWeight() const { return (GetFlags() & wxTEXT_ATTR_FONT_WEIGHT) != 0; } + bool HasFontSize() const { return (GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0; } + bool HasFontItalic() const { return (GetFlags() & wxTEXT_ATTR_FONT_ITALIC) != 0; } + bool HasFontUnderlined() const { return (GetFlags() & wxTEXT_ATTR_FONT_UNDERLINE) != 0; } + bool HasFontFaceName() const { return (GetFlags() & wxTEXT_ATTR_FONT_FACE) != 0; } + + bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); } + bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); } + bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); } + bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); } + bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); } + bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); } + bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); } + bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); } + bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); } + bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); } + bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); } + bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } + bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } + bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } + bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } + + // Is this a character style? + bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); } + bool IsParagraphStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_PARAGRAPH)); } + + // returns false if we have any attributes set, true otherwise + bool IsDefault() const + { + return (GetFlags() == 0); + } + + // return the attribute having the valid font and colours: it uses the + // attributes set in attr and falls back first to attrDefault and then to + // the text control font/colours for those attributes which are not set + static wxTextAttrEx CombineEx(const wxTextAttrEx& attr, + const wxTextAttrEx& attrDef, + const wxTextCtrlBase *text); + +private: + // Paragraph styles + int m_paragraphSpacingAfter; + int m_paragraphSpacingBefore; + int m_lineSpacing; + int m_bulletStyle; + int m_bulletNumber; + int m_textEffects; + int m_textEffectFlags; + int m_outlineLevel; + wxString m_bulletText; + wxString m_bulletFont; + wxString m_bulletName; + wxString m_urlTarget; + + // Character style + wxString m_characterStyleName; + + // Paragraph style + wxString m_paragraphStyleName; + + // List style + wxString m_listStyleName; +}; + +/*! + * wxRichTextAttr stores attributes without a wxFont object, so is a much more + * efficient way to query styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextAttr +{ +public: + // ctors + wxRichTextAttr(const wxTextAttrEx& attr); + wxRichTextAttr(const wxRichTextAttr& attr); + wxRichTextAttr() { Init(); } + wxRichTextAttr(const wxColour& colText, + const wxColour& colBack = wxNullColour, + wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); + + // Initialise this object. + void Init(); + + // Copy + void Copy(const wxRichTextAttr& attr); + + // Assignment from a wxRichTextAttr object. + void operator= (const wxRichTextAttr& attr); + + // Assignment from a wxTextAttrEx object. + void operator= (const wxTextAttrEx& attr); + + // Equality test + bool operator== (const wxRichTextAttr& attr) const; + + // Making a wxTextAttrEx object. + operator wxTextAttrEx () const ; + + // Create font from font attributes. + wxFont CreateFont() const; + + // Get attributes from font. + bool GetFontAttributes(const wxFont& font); + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } + void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } + void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } + void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } + void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } + + void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; } + void SetFontStyle(int fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } + void SetFontWeight(int fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } + void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } + void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; } + + void SetFlags(long flags) { m_flags = flags; } + + void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; } + void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; } + void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); } + void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; } + void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; } + void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; } + void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; } + void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; } + void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; } + void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; } + void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; } + void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; } + void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } + void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } + void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } + void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } + const wxArrayInt& GetTabs() const { return m_tabs; } + long GetLeftIndent() const { return m_leftIndent; } + long GetLeftSubIndent() const { return m_leftSubIndent; } + long GetRightIndent() const { return m_rightIndent; } + long GetFlags() const { return m_flags; } + + int GetFontSize() const { return m_fontSize; } + int GetFontStyle() const { return m_fontStyle; } + int GetFontWeight() const { return m_fontWeight; } + bool GetFontUnderlined() const { return m_fontUnderlined; } + const wxString& GetFontFaceName() const { return m_fontFaceName; } + + const wxString& GetCharacterStyleName() const { return m_characterStyleName; } + const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } + const wxString& GetListStyleName() const { return m_listStyleName; } + int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } + int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } + int GetLineSpacing() const { return m_lineSpacing; } + int GetBulletStyle() const { return m_bulletStyle; } + int GetBulletNumber() const { return m_bulletNumber; } + const wxString& GetBulletText() const { return m_bulletText; } + const wxString& GetBulletFont() const { return m_bulletFont; } + const wxString& GetBulletName() const { return m_bulletName; } + const wxString& GetURL() const { return m_urlTarget; } + int GetTextEffects() const { return m_textEffects; } + int GetTextEffectFlags() const { return m_textEffectFlags; } + int GetOutlineLevel() const { return m_outlineLevel; } + + // accessors + bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } + bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } + bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; } + bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; } + bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; } + bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; } + bool HasFontWeight() const { return (m_flags & wxTEXT_ATTR_FONT_WEIGHT) != 0; } + bool HasFontSize() const { return (m_flags & wxTEXT_ATTR_FONT_SIZE) != 0; } + bool HasFontItalic() const { return (m_flags & wxTEXT_ATTR_FONT_ITALIC) != 0; } + bool HasFontUnderlined() const { return (m_flags & wxTEXT_ATTR_FONT_UNDERLINE) != 0; } + bool HasFontFaceName() const { return (m_flags & wxTEXT_ATTR_FONT_FACE) != 0; } + bool HasFont() const { return (m_flags & (wxTEXT_ATTR_FONT)) != 0; } + + bool HasParagraphSpacingAfter() const { return (m_flags & wxTEXT_ATTR_PARA_SPACING_AFTER) != 0; } + bool HasParagraphSpacingBefore() const { return (m_flags & wxTEXT_ATTR_PARA_SPACING_BEFORE) != 0; } + bool HasLineSpacing() const { return (m_flags & wxTEXT_ATTR_LINE_SPACING) != 0; } + bool HasCharacterStyleName() const { return (m_flags & wxTEXT_ATTR_CHARACTER_STYLE_NAME) != 0 && !m_characterStyleName.IsEmpty(); } + bool HasParagraphStyleName() const { return (m_flags & wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) != 0 && !m_paragraphStyleName.IsEmpty(); } + bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); } + bool HasBulletStyle() const { return (m_flags & wxTEXT_ATTR_BULLET_STYLE) != 0; } + bool HasBulletNumber() const { return (m_flags & wxTEXT_ATTR_BULLET_NUMBER) != 0; } + bool HasBulletText() const { return (m_flags & wxTEXT_ATTR_BULLET_TEXT) != 0; } + bool HasBulletName() const { return (m_flags & wxTEXT_ATTR_BULLET_NAME) != 0; } + bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); } + bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } + bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } + bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } + bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } + + bool HasFlag(long flag) const { return (m_flags & flag) != 0; } + + // Is this a character style? + bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); } + bool IsParagraphStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_PARAGRAPH)); } + + // returns false if we have any attributes set, true otherwise + bool IsDefault() const + { + return GetFlags() == 0; + } + + // Merges the given attributes. Does not affect 'this'. If compareWith + // is non-NULL, then it will be used to mask out those attributes that are the same in style + // and compareWith, for situations where we don't want to explicitly set inherited attributes. + bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL); + + // Merges the given attributes and returns the result. Does not affect 'this'. If compareWith + // is non-NULL, then it will be used to mask out those attributes that are the same in style + // and compareWith, for situations where we don't want to explicitly set inherited attributes. + wxRichTextAttr Combine(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL) const; + +private: + long m_flags; + + // Paragraph styles + wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm + int m_leftIndent; // left indent in 1/10 mm + int m_leftSubIndent; // left indent for all but the first + // line in a paragraph relative to the + // first line, in 1/10 mm + int m_rightIndent; // right indent in 1/10 mm + wxTextAttrAlignment m_textAlignment; + + int m_paragraphSpacingAfter; + int m_paragraphSpacingBefore; + int m_lineSpacing; + int m_bulletStyle; + int m_bulletNumber; + int m_textEffects; + int m_textEffectFlags; + int m_outlineLevel; + wxString m_bulletText; + wxString m_bulletFont; + wxString m_bulletName; + wxString m_urlTarget; + + // Character styles + wxColour m_colText, + m_colBack; + int m_fontSize; + int m_fontStyle; + int m_fontWeight; + bool m_fontUnderlined; + wxString m_fontFaceName; + + // Character style + wxString m_characterStyleName; + + // Paragraph style + wxString m_paragraphStyleName; + + // List style + wxString m_listStyleName; +}; + +/*! + * wxRichTextObject class declaration + * This is the base for drawable objects. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextObject: public wxObject +{ + DECLARE_CLASS(wxRichTextObject) +public: +// Constructors + + wxRichTextObject(wxRichTextObject* parent = NULL); + virtual ~wxRichTextObject(); + +// Overrideables + + /// Draw the item, within the given range. Some objects may ignore the range (for + /// example paragraphs) while others must obey it (lines, to implement wrapping) + virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style) = 0; + + /// Lay the item out at the specified position with the given size constraint. + /// Layout must set the cached size. + virtual bool Layout(wxDC& dc, const wxRect& rect, int style) = 0; + + /// Hit-testing: returns a flag indicating hit test details, plus + /// information about position + virtual int HitTest(wxDC& WXUNUSED(dc), const wxPoint& WXUNUSED(pt), long& WXUNUSED(textPosition)) { return false; } + + /// Finds the absolute position and row height for the given character position + virtual bool FindPosition(wxDC& WXUNUSED(dc), long WXUNUSED(index), wxPoint& WXUNUSED(pt), int* WXUNUSED(height), bool WXUNUSED(forceLineStart)) { return false; } + + /// Get the best size, i.e. the ideal starting size for this object irrespective + /// of available space. For a short text string, it will be the size that exactly encloses + /// the text. For a longer string, it might use the parent width for example. + virtual wxSize GetBestSize() const { return m_size; } + + /// Get the object size for the given range. Returns false if the range + /// is invalid for this object. + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const = 0; + + /// Do a split, returning an object containing the second part, and setting + /// the first part in 'this'. + virtual wxRichTextObject* DoSplit(long WXUNUSED(pos)) { return NULL; } + + /// Calculate range. By default, guess that the object is 1 unit long. + virtual void CalculateRange(long start, long& end) { end = start ; m_range.SetRange(start, end); } + + /// Delete range + virtual bool DeleteRange(const wxRichTextRange& WXUNUSED(range)) { return false; } + + /// Returns true if the object is empty + virtual bool IsEmpty() const { return false; } + + /// Get any text in this object for the given range + virtual wxString GetTextForRange(const wxRichTextRange& WXUNUSED(range)) const { return wxEmptyString; } + + /// Returns true if this object can merge itself with the given one. + virtual bool CanMerge(wxRichTextObject* WXUNUSED(object)) const { return false; } + + /// Returns true if this object merged itself with the given one. + /// The calling code will then delete the given object. + virtual bool Merge(wxRichTextObject* WXUNUSED(object)) { return false; } + + /// Dump to output stream for debugging + virtual void Dump(wxTextOutputStream& stream); + +// Accessors + + /// Get/set the cached object size as calculated by Layout. + virtual wxSize GetCachedSize() const { return m_size; } + virtual void SetCachedSize(const wxSize& sz) { m_size = sz; } + + /// Get/set the object position + virtual wxPoint GetPosition() const { return m_pos; } + virtual void SetPosition(const wxPoint& pos) { m_pos = pos; } + + /// Get the rectangle enclosing the object + virtual wxRect GetRect() const { return wxRect(GetPosition(), GetCachedSize()); } + + /// Set the range + void SetRange(const wxRichTextRange& range) { m_range = range; } + + /// Get the range + const wxRichTextRange& GetRange() const { return m_range; } + wxRichTextRange& GetRange() { return m_range; } + + /// Get/set dirty flag (whether the object needs Layout to be called) + virtual bool GetDirty() const { return m_dirty; } + virtual void SetDirty(bool dirty) { m_dirty = dirty; } + + /// Is this composite? + virtual bool IsComposite() const { return false; } + + /// Get/set the parent. + virtual wxRichTextObject* GetParent() const { return m_parent; } + virtual void SetParent(wxRichTextObject* parent) { m_parent = parent; } + + /// Set the margin around the object + virtual void SetMargins(int margin); + virtual void SetMargins(int leftMargin, int rightMargin, int topMargin, int bottomMargin); + virtual int GetLeftMargin() const { return m_leftMargin; } + virtual int GetRightMargin() const { return m_rightMargin; } + virtual int GetTopMargin() const { return m_topMargin; } + virtual int GetBottomMargin() const { return m_bottomMargin; } + + /// Set attributes object + void SetAttributes(const wxTextAttrEx& attr) { m_attributes = attr; } + const wxTextAttrEx& GetAttributes() const { return m_attributes; } + wxTextAttrEx& GetAttributes() { return m_attributes; } + + /// Set/get stored descent + void SetDescent(int descent) { m_descent = descent; } + int GetDescent() const { return m_descent; } + + /// Gets the containing buffer + wxRichTextBuffer* GetBuffer() const; + +// Operations + + /// Clone the object + virtual wxRichTextObject* Clone() const { return NULL; } + + /// Copy + void Copy(const wxRichTextObject& obj); + + /// Reference-counting allows us to use the same object in multiple + /// lists (not yet used) + void Reference() { m_refCount ++; } + void Dereference(); + + /// Convert units in tenths of a millimetre to device units + int ConvertTenthsMMToPixels(wxDC& dc, int units); + static int ConvertTenthsMMToPixels(int ppi, int units); + +protected: + wxSize m_size; + wxPoint m_pos; + int m_descent; // Descent for this object (if any) + bool m_dirty; + int m_refCount; + wxRichTextObject* m_parent; + + /// The range of this object (start position to end position) + wxRichTextRange m_range; + + /// Margins + int m_leftMargin; + int m_rightMargin; + int m_topMargin; + int m_bottomMargin; + + /// Attributes + wxTextAttrEx m_attributes; +}; + +WX_DECLARE_LIST_WITH_DECL( wxRichTextObject, wxRichTextObjectList, class WXDLLIMPEXP_RICHTEXT ); + +/*! + * wxRichTextCompositeObject class declaration + * Objects of this class can contain other objects. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject: public wxRichTextObject +{ + DECLARE_CLASS(wxRichTextCompositeObject) +public: +// Constructors + + wxRichTextCompositeObject(wxRichTextObject* parent = NULL); + virtual ~wxRichTextCompositeObject(); + +// Overrideables + + /// Hit-testing: returns a flag indicating hit test details, plus + /// information about position + virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition); + + /// Finds the absolute position and row height for the given character position + virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); + + /// Calculate range + virtual void CalculateRange(long start, long& end); + + /// Delete range + virtual bool DeleteRange(const wxRichTextRange& range); + + /// Get any text in this object for the given range + virtual wxString GetTextForRange(const wxRichTextRange& range) const; + + /// Dump to output stream for debugging + virtual void Dump(wxTextOutputStream& stream); + +// Accessors + + /// Get the children + wxRichTextObjectList& GetChildren() { return m_children; } + const wxRichTextObjectList& GetChildren() const { return m_children; } + + /// Get the child count + size_t GetChildCount() const ; + + /// Get the nth child + wxRichTextObject* GetChild(size_t n) const ; + + /// Get/set dirty flag + virtual bool GetDirty() const { return m_dirty; } + virtual void SetDirty(bool dirty) { m_dirty = dirty; } + + /// Is this composite? + virtual bool IsComposite() const { return true; } + + /// Returns true if the buffer is empty + virtual bool IsEmpty() const { return GetChildCount() == 0; } + +// Operations + + /// Copy + void Copy(const wxRichTextCompositeObject& obj); + + /// Assignment + void operator= (const wxRichTextCompositeObject& obj) { Copy(obj); } + + /// Append a child, returning the position + size_t AppendChild(wxRichTextObject* child) ; + + /// Insert the child in front of the given object, or at the beginning + bool InsertChild(wxRichTextObject* child, wxRichTextObject* inFrontOf) ; + + /// Delete the child + bool RemoveChild(wxRichTextObject* child, bool deleteChild = false) ; + + /// Delete all children + bool DeleteChildren() ; + + /// Recursively merge all pieces that can be merged. + bool Defragment(); + +protected: + wxRichTextObjectList m_children; +}; + +/*! + * wxRichTextBox class declaration + * This defines a 2D space to lay out objects + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBox: public wxRichTextCompositeObject +{ + DECLARE_DYNAMIC_CLASS(wxRichTextBox) +public: +// Constructors + + wxRichTextBox(wxRichTextObject* parent = NULL); + wxRichTextBox(const wxRichTextBox& obj): wxRichTextCompositeObject() { Copy(obj); } + +// Overrideables + + /// Draw the item + virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); + + /// Lay the item out + virtual bool Layout(wxDC& dc, const wxRect& rect, int style); + + /// Get/set the object size for the given range. Returns false if the range + /// is invalid for this object. + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; + +// Accessors + +// Operations + + /// Clone + virtual wxRichTextObject* Clone() const { return new wxRichTextBox(*this); } + + /// Copy + void Copy(const wxRichTextBox& obj); + +protected: +}; + +/*! + * wxRichTextParagraphBox class declaration + * This box knows how to lay out paragraphs. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox: public wxRichTextBox +{ + DECLARE_DYNAMIC_CLASS(wxRichTextParagraphLayoutBox) +public: +// Constructors + + wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL); + wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextBox() { Init(); Copy(obj); } + +// Overrideables + + /// Draw the item + virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); + + /// Lay the item out + virtual bool Layout(wxDC& dc, const wxRect& rect, int style); + + /// Get/set the object size for the given range. Returns false if the range + /// is invalid for this object. + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; + + /// Delete range + virtual bool DeleteRange(const wxRichTextRange& range); + + /// Get any text in this object for the given range + virtual wxString GetTextForRange(const wxRichTextRange& range) const; + +// Accessors + + /// Associate a control with the buffer, for operations that for example require refreshing the window. + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_ctrl = ctrl; } + + /// Get the associated control. + wxRichTextCtrl* GetRichTextCtrl() const { return m_ctrl; } + + /// Get/set whether the last paragraph is partial or complete + void SetPartialParagraph(bool partialPara) { m_partialParagraph = partialPara; } + bool GetPartialParagraph() const { return m_partialParagraph; } + + /// If this is a buffer, returns the current style sheet. The base layout box + /// class doesn't have an associated style sheet. + virtual wxRichTextStyleSheet* GetStyleSheet() const { return NULL; } + +// Operations + + /// Initialize the object. + void Init(); + + /// Clear all children + virtual void Clear(); + + /// Clear and initialize with one blank paragraph + virtual void Reset(); + + /// Convenience function to add a paragraph of text + virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttrEx* paraStyle = NULL); + + /// Convenience function to add an image + virtual wxRichTextRange AddImage(const wxImage& image, wxTextAttrEx* paraStyle = NULL); + + /// Adds multiple paragraphs, based on newlines. + virtual wxRichTextRange AddParagraphs(const wxString& text, wxTextAttrEx* paraStyle = NULL); + + /// Get the line at the given position. If caretPosition is true, the position is + /// a caret position, which is normally a smaller number. + virtual wxRichTextLine* GetLineAtPosition(long pos, bool caretPosition = false) const; + + /// Get the line at the given y pixel position, or the last line. + virtual wxRichTextLine* GetLineAtYPosition(int y) const; + + /// Get the paragraph at the given character or caret position + virtual wxRichTextParagraph* GetParagraphAtPosition(long pos, bool caretPosition = false) const; + + /// Get the line size at the given position + virtual wxSize GetLineSizeAtPosition(long pos, bool caretPosition = false) const; + + /// Given a position, get the number of the visible line (potentially many to a paragraph), + /// starting from zero at the start of the buffer. We also have to pass a bool (startOfLine) + /// that indicates whether the caret is being shown at the end of the previous line or at the start + /// of the next, since the caret can be shown at 2 visible positions for the same underlying + /// position. + virtual long GetVisibleLineNumber(long pos, bool caretPosition = false, bool startOfLine = false) const; + + /// Given a line number, get the corresponding wxRichTextLine object. + virtual wxRichTextLine* GetLineForVisibleLineNumber(long lineNumber) const; + + /// Get the leaf object in a paragraph at this position. + /// Given a line number, get the corresponding wxRichTextLine object. + virtual wxRichTextObject* GetLeafObjectAtPosition(long position) const; + + /// Get the paragraph by number + virtual wxRichTextParagraph* GetParagraphAtLine(long paragraphNumber) const; + + /// Get the paragraph for a given line + virtual wxRichTextParagraph* GetParagraphForLine(wxRichTextLine* line) const; + + /// Get the length of the paragraph + virtual int GetParagraphLength(long paragraphNumber) const; + + /// Get the number of paragraphs + virtual int GetParagraphCount() const { return GetChildCount(); } + + /// Get the number of visible lines + virtual int GetLineCount() const; + + /// Get the text of the paragraph + virtual wxString GetParagraphText(long paragraphNumber) const; + + /// Convert zero-based line column and paragraph number to a position. + virtual long XYToPosition(long x, long y) const; + + /// Convert zero-based position to line column and paragraph number + virtual bool PositionToXY(long pos, long* x, long* y) const; + + /// Set text attributes: character and/or paragraph styles. + virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /// Get the conbined text attributes for this position. + virtual bool GetStyle(long position, wxTextAttrEx& style); + virtual bool GetStyle(long position, wxRichTextAttr& style); + + /// Get the content (uncombined) attributes for this position. + virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style); + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); + + /// Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and + /// context attributes. + virtual bool DoGetStyle(long position, wxTextAttrEx& style, bool combineStyles = true); + + /// Get the combined style for a range - if any attribute is different within the range, + /// that attribute is not present within the flags + virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style); + + /// Combines 'style' with 'currentStyle' for the purpose of summarising the attributes of a range of + /// content. + bool CollectStyle(wxTextAttrEx& currentStyle, const wxTextAttrEx& style, long& multipleStyleAttributes, int& multipleTextEffectAttributes); + + /// Set list style + virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + + /// Clear list for given range + virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /// Number/renumber any list elements in the given range. + /// def/defName can be NULL/empty to indicate that the existing list style should be used. + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + + /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1 + /// def/defName can be NULL/empty to indicate that the existing list style should be used. + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + + /// Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously + /// def/defName can be NULL/empty to indicate that the existing list style should be used. + virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + + /// Fills in the attributes for numbering a paragraph after previousParagraph. + virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const; + + /// Test if this whole range has character attributes of the specified kind. If any + /// of the attributes are different within the range, the test fails. You + /// can use this to implement, for example, bold button updating. style must have + /// flags indicating which attributes are of interest. + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const; + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const; + + /// Test if this whole range has paragraph attributes of the specified kind. If any + /// of the attributes are different within the range, the test fails. You + /// can use this to implement, for example, centering button updating. style must have + /// flags indicating which attributes are of interest. + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const; + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const; + + /// Clone + virtual wxRichTextObject* Clone() const { return new wxRichTextParagraphLayoutBox(*this); } + + /// Insert fragment into this box at the given position. If partialParagraph is true, + /// it is assumed that the last (or only) paragraph is just a piece of data with no paragraph + /// marker. + virtual bool InsertFragment(long position, wxRichTextParagraphLayoutBox& fragment); + + /// Make a copy of the fragment corresponding to the given range, putting it in 'fragment'. + virtual bool CopyFragment(const wxRichTextRange& range, wxRichTextParagraphLayoutBox& fragment); + + /// Apply the style sheet to the buffer, for example if the styles have changed. + virtual bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet); + + /// Copy + void Copy(const wxRichTextParagraphLayoutBox& obj); + + /// Assignment + void operator= (const wxRichTextParagraphLayoutBox& obj) { Copy(obj); } + + /// Calculate ranges + virtual void UpdateRanges() { long end; CalculateRange(0, end); } + + /// Get all the text + virtual wxString GetText() const; + + /// Set default style for new content. Setting it to a default attribute + /// makes new content take on the 'basic' style. + virtual bool SetDefaultStyle(const wxTextAttrEx& style); + + /// Get default style + virtual const wxTextAttrEx& GetDefaultStyle() const { return m_defaultAttributes; } + + /// Set basic (overall) style + virtual void SetBasicStyle(const wxTextAttrEx& style) { m_attributes = style; } + virtual void SetBasicStyle(const wxRichTextAttr& style) { m_attributes = style; } + + /// Get basic (overall) style + virtual const wxTextAttrEx& GetBasicStyle() const { return m_attributes; } + + /// Invalidate the buffer. With no argument, invalidates whole buffer. + void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); + + /// Get invalid range, rounding to entire paragraphs if argument is true. + wxRichTextRange GetInvalidRange(bool wholeParagraphs = false) const; + +protected: + wxRichTextCtrl* m_ctrl; + wxTextAttrEx m_defaultAttributes; + + /// The invalidated range that will need full layout + wxRichTextRange m_invalidRange; + + // Is the last paragraph partial or complete? + bool m_partialParagraph; +}; + +/*! + * wxRichTextLine class declaration + * This object represents a line in a paragraph, and stores + * offsets from the start of the paragraph representing the + * start and end positions of the line. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextLine +{ +public: +// Constructors + + wxRichTextLine(wxRichTextParagraph* parent); + wxRichTextLine(const wxRichTextLine& obj) { Init( NULL); Copy(obj); } + virtual ~wxRichTextLine() {} + +// Overrideables + +// Accessors + + /// Set the range + void SetRange(const wxRichTextRange& range) { m_range = range; } + void SetRange(long from, long to) { m_range = wxRichTextRange(from, to); } + + /// Get the parent paragraph + wxRichTextParagraph* GetParent() { return m_parent; } + + /// Get the range + const wxRichTextRange& GetRange() const { return m_range; } + wxRichTextRange& GetRange() { return m_range; } + + /// Get the absolute range + wxRichTextRange GetAbsoluteRange() const; + + /// Get/set the line size as calculated by Layout. + virtual wxSize GetSize() const { return m_size; } + virtual void SetSize(const wxSize& sz) { m_size = sz; } + + /// Get/set the object position relative to the parent + virtual wxPoint GetPosition() const { return m_pos; } + virtual void SetPosition(const wxPoint& pos) { m_pos = pos; } + + /// Get the absolute object position + virtual wxPoint GetAbsolutePosition() const; + + /// Get the rectangle enclosing the line + virtual wxRect GetRect() const { return wxRect(GetAbsolutePosition(), GetSize()); } + + /// Set/get stored descent + void SetDescent(int descent) { m_descent = descent; } + int GetDescent() const { return m_descent; } + +#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING + wxArrayInt& GetObjectSizes() { return m_objectSizes; } + const wxArrayInt& GetObjectSizes() const { return m_objectSizes; } +#endif + +// Operations + + /// Initialisation + void Init(wxRichTextParagraph* parent); + + /// Copy + void Copy(const wxRichTextLine& obj); + + /// Clone + virtual wxRichTextLine* Clone() const { return new wxRichTextLine(*this); } + +protected: + + /// The range of the line (start position to end position) + /// This is relative to the parent paragraph. + wxRichTextRange m_range; + + /// Size and position measured relative to top of paragraph + wxPoint m_pos; + wxSize m_size; + + /// Maximum descent for this line (location of text baseline) + int m_descent; + + // The parent object + wxRichTextParagraph* m_parent; + + // Sizes of the objects within a line so we don't have to get text extents +#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING + wxArrayInt m_objectSizes; +#endif +}; + +WX_DECLARE_LIST_WITH_DECL( wxRichTextLine, wxRichTextLineList , class WXDLLIMPEXP_RICHTEXT ); + +/*! + * wxRichTextParagraph class declaration + * This object represents a single paragraph (or in a straight text editor, a line). + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph: public wxRichTextBox +{ + DECLARE_DYNAMIC_CLASS(wxRichTextParagraph) +public: +// Constructors + + wxRichTextParagraph(wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL); + wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxTextAttrEx* paraStyle = NULL, wxTextAttrEx* charStyle = NULL); + virtual ~wxRichTextParagraph(); + wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextBox() { Copy(obj); } + +// Overrideables + + /// Draw the item + virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); + + /// Lay the item out + virtual bool Layout(wxDC& dc, const wxRect& rect, int style); + + /// Get/set the object size for the given range. Returns false if the range + /// is invalid for this object. + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; + + /// Finds the absolute position and row height for the given character position + virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); + + /// Hit-testing: returns a flag indicating hit test details, plus + /// information about position + virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition); + + /// Calculate range + virtual void CalculateRange(long start, long& end); + +// Accessors + + /// Get the cached lines + wxRichTextLineList& GetLines() { return m_cachedLines; } + +// Operations + + /// Copy + void Copy(const wxRichTextParagraph& obj); + + /// Clone + virtual wxRichTextObject* Clone() const { return new wxRichTextParagraph(*this); } + + /// Clear the cached lines + void ClearLines(); + +// Implementation + + /// Apply paragraph styles such as centering to the wrapped lines + virtual void ApplyParagraphStyle(const wxTextAttrEx& attr, const wxRect& rect); + + /// Insert text at the given position + virtual bool InsertText(long pos, const wxString& text); + + /// Split an object at this position if necessary, and return + /// the previous object, or NULL if inserting at beginning. + virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = NULL); + + /// Move content to a list from this point + virtual void MoveToList(wxRichTextObject* obj, wxList& list); + + /// Add content back from list + virtual void MoveFromList(wxList& list); + + /// Get the plain text searching from the start or end of the range. + /// The resulting string may be shorter than the range given. + bool GetContiguousPlainText(wxString& text, const wxRichTextRange& range, bool fromStart = true); + + /// Find a suitable wrap position. wrapPosition is the last position in the line to the left + /// of the split. + bool FindWrapPosition(const wxRichTextRange& range, wxDC& dc, int availableSpace, long& wrapPosition); + + /// Find the object at the given position + wxRichTextObject* FindObjectAtPosition(long position); + + /// Get the bullet text for this paragraph. + wxString GetBulletText(); + + /// Allocate or reuse a line object + wxRichTextLine* AllocateLine(int pos); + + /// Clear remaining unused line objects, if any + bool ClearUnusedLines(int lineCount); + + /// Get combined attributes of the base style, paragraph style and character style. We use this to dynamically + /// retrieve the actual style. + wxTextAttrEx GetCombinedAttributes(const wxTextAttrEx& contentStyle) const; + + /// Get combined attributes of the base style and paragraph style. + wxTextAttrEx GetCombinedAttributes() const; + + /// Get the first position from pos that has a line break character. + long GetFirstLineBreakPosition(long pos); + + /// Create default tabstop array + static void InitDefaultTabs(); + + /// Clear default tabstop array + static void ClearDefaultTabs(); + + /// Get default tabstop array + static const wxArrayInt& GetDefaultTabs() { return sm_defaultTabs; } + +protected: + /// The lines that make up the wrapped paragraph + wxRichTextLineList m_cachedLines; + + /// Default tabstops + static wxArrayInt sm_defaultTabs; +}; + +/*! + * wxRichTextPlainText class declaration + * This object represents a single piece of text. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText: public wxRichTextObject +{ + DECLARE_DYNAMIC_CLASS(wxRichTextPlainText) +public: +// Constructors + + wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL); + wxRichTextPlainText(const wxRichTextPlainText& obj): wxRichTextObject() { Copy(obj); } + +// Overrideables + + /// Draw the item + virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); + + /// Lay the item out + virtual bool Layout(wxDC& dc, const wxRect& rect, int style); + + /// Get/set the object size for the given range. Returns false if the range + /// is invalid for this object. + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position/* = wxPoint(0,0)*/) const; + + /// Get any text in this object for the given range + virtual wxString GetTextForRange(const wxRichTextRange& range) const; + + /// Do a split, returning an object containing the second part, and setting + /// the first part in 'this'. + virtual wxRichTextObject* DoSplit(long pos); + + /// Calculate range + virtual void CalculateRange(long start, long& end); + + /// Delete range + virtual bool DeleteRange(const wxRichTextRange& range); + + /// Returns true if the object is empty + virtual bool IsEmpty() const { return m_text.empty(); } + + /// Returns true if this object can merge itself with the given one. + virtual bool CanMerge(wxRichTextObject* object) const; + + /// Returns true if this object merged itself with the given one. + /// The calling code will then delete the given object. + virtual bool Merge(wxRichTextObject* object); + + /// Dump to output stream for debugging + virtual void Dump(wxTextOutputStream& stream); + + /// Get the first position from pos that has a line break character. + long GetFirstLineBreakPosition(long pos); + +// Accessors + + /// Get the text + const wxString& GetText() const { return m_text; } + + /// Set the text + void SetText(const wxString& text) { m_text = text; } + +// Operations + + /// Copy + void Copy(const wxRichTextPlainText& obj); + + /// Clone + virtual wxRichTextObject* Clone() const { return new wxRichTextPlainText(*this); } +private: + bool DrawTabbedString(wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, wxString& str, wxCoord& x, wxCoord& y, bool selected); + +protected: + wxString m_text; +}; + +/*! + * wxRichTextImageBlock stores information about an image, in binary in-memory form + */ + +class WXDLLIMPEXP_FWD_BASE wxDataInputStream; +class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; + +class WXDLLIMPEXP_RICHTEXT wxRichTextImageBlock: public wxObject +{ +public: + wxRichTextImageBlock(); + wxRichTextImageBlock(const wxRichTextImageBlock& block); + virtual ~wxRichTextImageBlock(); + + void Init(); + void Clear(); + + // Load the original image into a memory block. + // If the image is not a JPEG, we must convert it into a JPEG + // to conserve space. + // If it's not a JPEG we can make use of 'image', already scaled, so we don't have to + // load the image a 2nd time. + virtual bool MakeImageBlock(const wxString& filename, int imageType, wxImage& image, bool convertToJPEG = true); + + // Make an image block from the wxImage in the given + // format. + virtual bool MakeImageBlock(wxImage& image, int imageType, int quality = 80); + + // Write to a file + bool Write(const wxString& filename); + + // Write data in hex to a stream + bool WriteHex(wxOutputStream& stream); + + // Read data in hex from a stream + bool ReadHex(wxInputStream& stream, int length, int imageType); + + // Copy from 'block' + void Copy(const wxRichTextImageBlock& block); + + // Load a wxImage from the block + bool Load(wxImage& image); + +//// Operators + void operator=(const wxRichTextImageBlock& block); + +//// Accessors + + unsigned char* GetData() const { return m_data; } + size_t GetDataSize() const { return m_dataSize; } + int GetImageType() const { return m_imageType; } + + void SetData(unsigned char* image) { m_data = image; } + void SetDataSize(size_t size) { m_dataSize = size; } + void SetImageType(int imageType) { m_imageType = imageType; } + + bool Ok() const { return IsOk(); } + bool IsOk() const { return GetData() != NULL; } + + // Gets the extension for the block's type + wxString GetExtension() const; + +/// Implementation + + // Allocate and read from stream as a block of memory + static unsigned char* ReadBlock(wxInputStream& stream, size_t size); + static unsigned char* ReadBlock(const wxString& filename, size_t size); + + // Write memory block to stream + static bool WriteBlock(wxOutputStream& stream, unsigned char* block, size_t size); + + // Write memory block to file + static bool WriteBlock(const wxString& filename, unsigned char* block, size_t size); + +protected: + // Size in bytes of the image stored. + // This is in the raw, original form such as a JPEG file. + unsigned char* m_data; + size_t m_dataSize; + int m_imageType; // wxWin type id +}; + + +/*! + * wxRichTextImage class declaration + * This object represents an image. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextImage: public wxRichTextObject +{ + DECLARE_DYNAMIC_CLASS(wxRichTextImage) +public: +// Constructors + + wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { } + wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL); + wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL); + wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject() { Copy(obj); } + +// Overrideables + + /// Draw the item + virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style); + + /// Lay the item out + virtual bool Layout(wxDC& dc, const wxRect& rect, int style); + + /// Get the object size for the given range. Returns false if the range + /// is invalid for this object. + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const; + + /// Returns true if the object is empty + virtual bool IsEmpty() const { return !m_image.Ok(); } + +// Accessors + + /// Get the image + const wxImage& GetImage() const { return m_image; } + + /// Set the image + void SetImage(const wxImage& image) { m_image = image; } + + /// Get the image block containing the raw data + wxRichTextImageBlock& GetImageBlock() { return m_imageBlock; } + +// Operations + + /// Copy + void Copy(const wxRichTextImage& obj); + + /// Clone + virtual wxRichTextObject* Clone() const { return new wxRichTextImage(*this); } + + /// Load wxImage from the block + virtual bool LoadFromBlock(); + + /// Make block from the wxImage + virtual bool MakeBlock(); + +protected: + // TODO: reduce the multiple representations of data + wxImage m_image; + wxBitmap m_bitmap; + wxRichTextImageBlock m_imageBlock; +}; + + +/*! + * wxRichTextBuffer class declaration + * This is a kind of box, used to represent the whole buffer + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction; + +class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer: public wxRichTextParagraphLayoutBox +{ + DECLARE_DYNAMIC_CLASS(wxRichTextBuffer) +public: +// Constructors + + wxRichTextBuffer() { Init(); } + wxRichTextBuffer(const wxRichTextBuffer& obj): wxRichTextParagraphLayoutBox() { Init(); Copy(obj); } + virtual ~wxRichTextBuffer() ; + +// Accessors + + /// Gets the command processor + wxCommandProcessor* GetCommandProcessor() const { return m_commandProcessor; } + + /// Set style sheet, if any. + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; } + virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } + + /// Set style sheet and notify of the change + bool SetStyleSheetAndNotify(wxRichTextStyleSheet* sheet); + + /// Push style sheet to top of stack + bool PushStyleSheet(wxRichTextStyleSheet* styleSheet); + + /// Pop style sheet from top of stack + wxRichTextStyleSheet* PopStyleSheet(); + +// Operations + + /// Initialisation + void Init(); + + /// Clears the buffer, adds an empty paragraph, and clears the command processor. + virtual void ResetAndClearCommands(); + + /// Load a file + virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY); + + /// Save a file + virtual bool SaveFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY); + + /// Load from a stream + virtual bool LoadFile(wxInputStream& stream, int type = wxRICHTEXT_TYPE_ANY); + + /// Save to a stream + virtual bool SaveFile(wxOutputStream& stream, int type = wxRICHTEXT_TYPE_ANY); + + /// Set the handler flags, controlling loading and saving + void SetHandlerFlags(int flags) { m_handlerFlags = flags; } + + /// Get the handler flags, controlling loading and saving + int GetHandlerFlags() const { return m_handlerFlags; } + + /// Convenience function to add a paragraph of text + virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttrEx* paraStyle = NULL) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } + + /// Begin collapsing undo/redo commands. Note that this may not work properly + /// if combining commands that delete or insert content, changing ranges for + /// subsequent actions. + virtual bool BeginBatchUndo(const wxString& cmdName); + + /// End collapsing undo/redo commands + virtual bool EndBatchUndo(); + + /// Collapsing commands? + virtual bool BatchingUndo() const { return m_batchedCommandDepth > 0; } + + /// Submit immediately, or delay according to whether collapsing is on + virtual bool SubmitAction(wxRichTextAction* action); + + /// Get collapsed command + virtual wxRichTextCommand* GetBatchedCommand() const { return m_batchedCommand; } + + /// Begin suppressing undo/redo commands. The way undo is suppressed may be implemented + /// differently by each command. If not dealt with by a command implementation, then + /// it will be implemented automatically by not storing the command in the undo history + /// when the action is submitted to the command processor. + virtual bool BeginSuppressUndo(); + + /// End suppressing undo/redo commands. + virtual bool EndSuppressUndo(); + + /// Collapsing commands? + virtual bool SuppressingUndo() const { return m_suppressUndo > 0; } + + /// Copy the range to the clipboard + virtual bool CopyToClipboard(const wxRichTextRange& range); + + /// Paste the clipboard content to the buffer + virtual bool PasteFromClipboard(long position); + + /// Can we paste from the clipboard? + virtual bool CanPasteFromClipboard() const; + + /// Begin using a style + virtual bool BeginStyle(const wxTextAttrEx& style); + + /// End the style + virtual bool EndStyle(); + + /// End all styles + virtual bool EndAllStyles(); + + /// Clear the style stack + virtual void ClearStyleStack(); + + /// Get the size of the style stack, for example to check correct nesting + virtual size_t GetStyleStackSize() const { return m_attributeStack.GetCount(); } + + /// Begin using bold + bool BeginBold(); + + /// End using bold + bool EndBold() { return EndStyle(); } + + /// Begin using italic + bool BeginItalic(); + + /// End using italic + bool EndItalic() { return EndStyle(); } + + /// Begin using underline + bool BeginUnderline(); + + /// End using underline + bool EndUnderline() { return EndStyle(); } + + /// Begin using point size + bool BeginFontSize(int pointSize); + + /// End using point size + bool EndFontSize() { return EndStyle(); } + + /// Begin using this font + bool BeginFont(const wxFont& font); + + /// End using a font + bool EndFont() { return EndStyle(); } + + /// Begin using this colour + bool BeginTextColour(const wxColour& colour); + + /// End using a colour + bool EndTextColour() { return EndStyle(); } + + /// Begin using alignment + bool BeginAlignment(wxTextAttrAlignment alignment); + + /// End alignment + bool EndAlignment() { return EndStyle(); } + + /// Begin left indent + bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0); + + /// End left indent + bool EndLeftIndent() { return EndStyle(); } + + /// Begin right indent + bool BeginRightIndent(int rightIndent); + + /// End right indent + bool EndRightIndent() { return EndStyle(); } + + /// Begin paragraph spacing + bool BeginParagraphSpacing(int before, int after); + + /// End paragraph spacing + bool EndParagraphSpacing() { return EndStyle(); } + + /// Begin line spacing + bool BeginLineSpacing(int lineSpacing); + + /// End line spacing + bool EndLineSpacing() { return EndStyle(); } + + /// Begin numbered bullet + bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD); + + /// End numbered bullet + bool EndNumberedBullet() { return EndStyle(); } + + /// Begin symbol bullet + bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL); + + /// End symbol bullet + bool EndSymbolBullet() { return EndStyle(); } + + /// Begin standard bullet + bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD); + + /// End standard bullet + bool EndStandardBullet() { return EndStyle(); } + + /// Begin named character style + bool BeginCharacterStyle(const wxString& characterStyle); + + /// End named character style + bool EndCharacterStyle() { return EndStyle(); } + + /// Begin named paragraph style + bool BeginParagraphStyle(const wxString& paragraphStyle); + + /// End named character style + bool EndParagraphStyle() { return EndStyle(); } + + /// Begin named list style + bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1); + + /// End named character style + bool EndListStyle() { return EndStyle(); } + + /// Begin URL + bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString); + + /// End URL + bool EndURL() { return EndStyle(); } + +// Event handling + + /// Add an event handler + bool AddEventHandler(wxEvtHandler* handler); + + /// Remove an event handler + bool RemoveEventHandler(wxEvtHandler* handler, bool deleteHandler = false); + + /// Clear event handlers + void ClearEventHandlers(); + + /// Send event to event handlers. If sendToAll is true, will send to all event handlers, + /// otherwise will stop at the first successful one. + bool SendEvent(wxEvent& event, bool sendToAll = true); + +// Implementation + + /// Copy + void Copy(const wxRichTextBuffer& obj); + + /// Clone + virtual wxRichTextObject* Clone() const { return new wxRichTextBuffer(*this); } + + /// Submit command to insert paragraphs + bool InsertParagraphsWithUndo(long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int flags = 0); + + /// Submit command to insert the given text + bool InsertTextWithUndo(long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags = 0); + + /// Submit command to insert a newline + bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int flags = 0); + + /// Submit command to insert the given image + bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags = 0); + + /// Submit command to delete this range + bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl); + + /// Mark modified + void Modify(bool modify = true) { m_modified = modify; } + bool IsModified() const { return m_modified; } + + /// Get the style that is appropriate for a new paragraph at this position. + /// If the previous paragraph has a paragraph style name, look up the next-paragraph + /// style. + wxRichTextAttr GetStyleForNewParagraph(long pos, bool caretPosition = false, bool lookUpNewParaStyle=false) const; + + /// Dumps contents of buffer for debugging purposes + virtual void Dump(); + virtual void Dump(wxTextOutputStream& stream) { wxRichTextParagraphLayoutBox::Dump(stream); } + + /// Returns the file handlers + static wxList& GetHandlers() { return sm_handlers; } + + /// Adds a handler to the end + static void AddHandler(wxRichTextFileHandler *handler); + + /// Inserts a handler at the front + static void InsertHandler(wxRichTextFileHandler *handler); + + /// Removes a handler + static bool RemoveHandler(const wxString& name); + + /// Finds a handler by name + static wxRichTextFileHandler *FindHandler(const wxString& name); + + /// Finds a handler by extension and type + static wxRichTextFileHandler *FindHandler(const wxString& extension, int imageType); + + /// Finds a handler by filename or, if supplied, type + static wxRichTextFileHandler *FindHandlerFilenameOrType(const wxString& filename, int imageType); + + /// Finds a handler by type + static wxRichTextFileHandler *FindHandler(int imageType); + + /// Gets a wildcard incorporating all visible handlers. If 'types' is present, + /// will be filled with the file type corresponding to each filter. This can be + /// used to determine the type to pass to LoadFile given a selected filter. + static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = NULL); + + /// Clean up handlers + static void CleanUpHandlers(); + + /// Initialise the standard handlers + static void InitStandardHandlers(); + + /// Get renderer + static wxRichTextRenderer* GetRenderer() { return sm_renderer; } + + /// Set renderer, deleting old one + static void SetRenderer(wxRichTextRenderer* renderer); + + /// Minimum margin between bullet and paragraph in 10ths of a mm + static int GetBulletRightMargin() { return sm_bulletRightMargin; } + static void SetBulletRightMargin(int margin) { sm_bulletRightMargin = margin; } + + /// Factor to multiply by character height to get a reasonable bullet size + static float GetBulletProportion() { return sm_bulletProportion; } + static void SetBulletProportion(float prop) { sm_bulletProportion = prop; } + + /// Scale factor for calculating dimensions + double GetScale() const { return m_scale; } + void SetScale(double scale) { m_scale = scale; } + +protected: + + /// Command processor + wxCommandProcessor* m_commandProcessor; + + /// Has been modified? + bool m_modified; + + /// Collapsed command stack + int m_batchedCommandDepth; + + /// Name for collapsed command + wxString m_batchedCommandsName; + + /// Current collapsed command accumulating actions + wxRichTextCommand* m_batchedCommand; + + /// Whether to suppress undo + int m_suppressUndo; + + /// Style sheet, if any + wxRichTextStyleSheet* m_styleSheet; + + /// List of event handlers that will be notified of events + wxList m_eventHandlers; + + /// Stack of attributes for convenience functions + wxList m_attributeStack; + + /// Flags to be passed to handlers + int m_handlerFlags; + + /// File handlers + static wxList sm_handlers; + + /// Renderer + static wxRichTextRenderer* sm_renderer; + + /// Minimum margin between bullet and paragraph in 10ths of a mm + static int sm_bulletRightMargin; + + /// Factor to multiply by character height to get a reasonable bullet size + static float sm_bulletProportion; + + /// Scaling factor in use: needed to calculate correct dimensions when printing + double m_scale; +}; + +/*! + * The command identifiers + * + */ + +enum wxRichTextCommandId +{ + wxRICHTEXT_INSERT, + wxRICHTEXT_DELETE, + wxRICHTEXT_CHANGE_STYLE +}; + +/*! + * Command classes for undo/redo + * + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction; +class WXDLLIMPEXP_RICHTEXT wxRichTextCommand: public wxCommand +{ +public: + // Ctor for one action + wxRichTextCommand(const wxString& name, wxRichTextCommandId id, wxRichTextBuffer* buffer, + wxRichTextCtrl* ctrl, bool ignoreFirstTime = false); + + // Ctor for multiple actions + wxRichTextCommand(const wxString& name); + + virtual ~wxRichTextCommand(); + + bool Do(); + bool Undo(); + + void AddAction(wxRichTextAction* action); + void ClearActions(); + + wxList& GetActions() { return m_actions; } + +protected: + + wxList m_actions; +}; + +/*! + * wxRichTextAction class declaration + * There can be more than one action in a command. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextAction: public wxObject +{ +public: + wxRichTextAction(wxRichTextCommand* cmd, const wxString& name, wxRichTextCommandId id, wxRichTextBuffer* buffer, + wxRichTextCtrl* ctrl, bool ignoreFirstTime = false); + + virtual ~wxRichTextAction(); + + bool Do(); + bool Undo(); + + /// Update the control appearance + void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false, + wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL); + + /// Replace the buffer paragraphs with the given fragment. + void ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragment); + +#if wxABI_VERSION >= 20808 + // Create arrays to be used in refresh optimization + void CalculateRefreshOptimizations(wxArrayInt& optimizationLineCharPositions, wxArrayInt& optimizationLineYPositions); +#endif + + /// Get the fragments + wxRichTextParagraphLayoutBox& GetNewParagraphs() { return m_newParagraphs; } + wxRichTextParagraphLayoutBox& GetOldParagraphs() { return m_oldParagraphs; } + + /// Set/get the position used for e.g. insertion + void SetPosition(long pos) { m_position = pos; } + long GetPosition() const { return m_position; } + + /// Set/get the range for e.g. deletion + void SetRange(const wxRichTextRange& range) { m_range = range; } + const wxRichTextRange& GetRange() const { return m_range; } + + /// Get name + const wxString& GetName() const { return m_name; } + +protected: + // Action name + wxString m_name; + + // Buffer + wxRichTextBuffer* m_buffer; + + // Control + wxRichTextCtrl* m_ctrl; + + // Stores the new paragraphs + wxRichTextParagraphLayoutBox m_newParagraphs; + + // Stores the old paragraphs + wxRichTextParagraphLayoutBox m_oldParagraphs; + + // The affected range + wxRichTextRange m_range; + + // The insertion point for this command + long m_position; + + // Ignore 1st 'Do' operation because we already did it + bool m_ignoreThis; + + // The command identifier + wxRichTextCommandId m_cmdId; +}; + +/*! + * Handler flags + */ + +// Include style sheet when loading and saving +#define wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET 0x0001 + +// Save images to memory file system in HTML handler +#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY 0x0010 + +// Save images to files in HTML handler +#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES 0x0020 + +// Save images as inline base64 data in HTML handler +#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040 + +// Don't write header and footer (or BODY), so we can include the fragment +// in a larger document +#define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080 + +// Convert the more common face names to names that will work on the current platform +// in a larger document +#define wxRICHTEXT_HANDLER_CONVERT_FACENAMES 0x0100 + +/*! + * wxRichTextFileHandler + * Base class for file handlers + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler: public wxObject +{ + DECLARE_CLASS(wxRichTextFileHandler) +public: + wxRichTextFileHandler(const wxString& name = wxEmptyString, const wxString& ext = wxEmptyString, int type = 0) + : m_name(name), m_extension(ext), m_type(type), m_flags(0), m_visible(true) + { } + +#if wxUSE_STREAMS + bool LoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) + { return DoLoadFile(buffer, stream); } + bool SaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) + { return DoSaveFile(buffer, stream); } +#endif + + bool LoadFile(wxRichTextBuffer *buffer, const wxString& filename); + bool SaveFile(wxRichTextBuffer *buffer, const wxString& filename); + + /// Can we handle this filename (if using files)? By default, checks the extension. + virtual bool CanHandle(const wxString& filename) const; + + /// Can we save using this handler? + virtual bool CanSave() const { return false; } + + /// Can we load using this handler? + virtual bool CanLoad() const { return false; } + + /// Should this handler be visible to the user? + virtual bool IsVisible() const { return m_visible; } + virtual void SetVisible(bool visible) { m_visible = visible; } + + /// The name of the nandler + void SetName(const wxString& name) { m_name = name; } + wxString GetName() const { return m_name; } + + /// The default extension to recognise + void SetExtension(const wxString& ext) { m_extension = ext; } + wxString GetExtension() const { return m_extension; } + + /// The handler type + void SetType(int type) { m_type = type; } + int GetType() const { return m_type; } + + /// Flags controlling how loading and saving is done + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + /// Encoding to use when saving a file. If empty, a suitable encoding is chosen + void SetEncoding(const wxString& encoding) { m_encoding = encoding; } + const wxString& GetEncoding() const { return m_encoding; } + +protected: + +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) = 0; + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) = 0; +#endif + + wxString m_name; + wxString m_encoding; + wxString m_extension; + int m_type; + int m_flags; + bool m_visible; +}; + +/*! + * wxRichTextPlainTextHandler + * Plain text handler + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPlainTextHandler: public wxRichTextFileHandler +{ + DECLARE_CLASS(wxRichTextPlainTextHandler) +public: + wxRichTextPlainTextHandler(const wxString& name = wxT("Text"), const wxString& ext = wxT("txt"), int type = wxRICHTEXT_TYPE_TEXT) + : wxRichTextFileHandler(name, ext, type) + { } + + /// Can we save using this handler? + virtual bool CanSave() const { return true; } + + /// Can we load using this handler? + virtual bool CanLoad() const { return true; } + +protected: + +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); +#endif + +}; + +#if wxUSE_DATAOBJ + +/*! + * The data object for a wxRichTextBuffer + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBufferDataObject: public wxDataObjectSimple +{ +public: + // ctor doesn't copy the pointer, so it shouldn't go away while this object + // is alive + wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = (wxRichTextBuffer*) NULL); + virtual ~wxRichTextBufferDataObject(); + + // after a call to this function, the buffer is owned by the caller and it + // is responsible for deleting it + wxRichTextBuffer* GetRichTextBuffer(); + + // Returns the id for the new data format + static const wxChar* GetRichTextBufferFormatId() { return ms_richTextBufferFormatId; } + + // base class pure virtuals + + virtual wxDataFormat GetPreferredFormat(Direction dir) const; + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *pBuf) const; + virtual bool SetData(size_t len, const void *buf); + + // prevent warnings + + virtual size_t GetDataSize(const wxDataFormat&) const { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) { return SetData(len, buf); } + +private: + wxDataFormat m_formatRichTextBuffer; // our custom format + wxRichTextBuffer* m_richTextBuffer; // our data + static const wxChar* ms_richTextBufferFormatId; // our format id +}; + +#endif + +/*! + * wxRichTextRenderer isolates common drawing functionality + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer: public wxObject +{ +public: + wxRichTextRenderer() {} + virtual ~wxRichTextRenderer() {} + + /// Draw a standard bullet, as specified by the value of GetBulletName + virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect) = 0; + + /// Draw a bullet that can be described by text, such as numbered or symbol bullets + virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, const wxString& text) = 0; + + /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName + virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect) = 0; + + /// Enumerate the standard bullet names currently supported + virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) = 0; +}; + +/*! + * wxRichTextStdRenderer: standard renderer + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStdRenderer: public wxRichTextRenderer +{ +public: + wxRichTextStdRenderer() {} + + /// Draw a standard bullet, as specified by the value of GetBulletName + virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect); + + /// Draw a bullet that can be described by text, such as numbered or symbol bullets + virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, const wxString& text); + + /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName + virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect); + + /// Enumerate the standard bullet names currently supported + virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames); +}; + +/*! + * Utilities + * + */ + +inline bool wxRichTextHasStyle(int flags, int style) +{ + return ((flags & style) == style); +} + +/// Compare two attribute objects +WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2); +WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttr& attr1, const wxRichTextAttr& attr2); + +/// Compare two attribute objects, but take into account the flags +/// specifying attributes of interest. +WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2, int flags); +WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxRichTextAttr& attr2, int flags); + +/// Apply one style to another +WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxTextAttrEx& style); +WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxTextAttrEx& style); +WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); +WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); + +// Remove attributes +WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style); + +/// Combine two bitlists +WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB); + +/// Compare two bitlists +WXDLLIMPEXP_RICHTEXT bool wxRichTextBitlistsEqPartial(int valueA, int valueB, int flags); + +/// Split into paragraph and character styles +WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxTextAttrEx& style, wxTextAttrEx& parStyle, wxTextAttrEx& charStyle); + +/// Compare tabs +WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2); + +/// Set the font without changing the font attributes +WXDLLIMPEXP_RICHTEXT void wxSetFontPreservingStyles(wxTextAttr& attr, const wxFont& font); + +/// Convert a decimal to Roman numerals +WXDLLIMPEXP_RICHTEXT wxString wxRichTextDecimalToRoman(long n); + +WXDLLIMPEXP_RICHTEXT void wxRichTextModuleInit(); + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTBUFFER_H_ + diff --git a/Externals/wxWidgets/include/wx/richtext/richtextbulletspage.h b/Externals/wxWidgets/include/wx/richtext/richtextbulletspage.h index fc69435507..0df4eb6b56 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextbulletspage.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextbulletspage.h @@ -1,217 +1,217 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextbulletspage.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/4/2006 10:32:31 AM -// RCS-ID: $Id: richtextbulletspage.h 50950 2007-12-30 16:11:12Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTBULLETSPAGE_H_ -#define _RICHTEXTBULLETSPAGE_H_ - -/*! - * Includes - */ - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxSpinCtrl; -class wxRichTextCtrl; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL -#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE _("wxRichTextBulletsPage") -#define SYMBOL_WXRICHTEXTBULLETSPAGE_IDNAME ID_RICHTEXTBULLETSPAGE -#define SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * wxRichTextBulletsPage class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxRichTextBulletsPage ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextBulletsPage( ); - wxRichTextBulletsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE ); - - /// Initialise members - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - - /// Updates the bullets preview - void UpdatePreview(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Gets the attributes associated with the main formatting dialog - wxTextAttrEx* GetAttributes(); - - /// Update for symbol-related controls - void OnSymbolUpdate( wxUpdateUIEvent& event ); - - /// Update for number-related controls - void OnNumberUpdate( wxUpdateUIEvent& event ); - - /// Update for standard bullet-related controls - void OnStandardBulletUpdate( wxUpdateUIEvent& event ); - -////@begin wxRichTextBulletsPage event handler declarations - - /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX - void OnStylelistboxSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL - void OnPeriodctrlClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL - void OnPeriodctrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL - void OnParenthesesctrlClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL - void OnParenthesesctrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL - void OnRightParenthesisCtrlClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL - void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL - void OnBulletAlignmentCtrlSelected( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC - void OnSymbolstaticUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL - void OnSymbolctrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL - void OnSymbolctrlUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL - void OnSymbolctrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL - void OnChooseSymbolClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL - void OnChooseSymbolUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL - void OnSymbolfontctrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL - void OnSymbolfontctrlUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL - void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC - void OnNamestaticUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL - void OnNamectrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL - void OnNamectrlUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL - void OnNamectrlUIUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC - void OnNumberstaticUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL - void OnNumberctrlUpdated( wxSpinEvent& event ); - - /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL - void OnNumberctrlUp( wxSpinEvent& event ); - - /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL - void OnNumberctrlDown( wxSpinEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL - void OnNumberctrlTextUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL - void OnNumberctrlUpdate( wxUpdateUIEvent& event ); - -////@end wxRichTextBulletsPage event handler declarations - -////@begin wxRichTextBulletsPage member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextBulletsPage member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin wxRichTextBulletsPage member variables - wxListBox* m_styleListBox; - wxCheckBox* m_periodCtrl; - wxCheckBox* m_parenthesesCtrl; - wxCheckBox* m_rightParenthesisCtrl; - wxComboBox* m_bulletAlignmentCtrl; - wxComboBox* m_symbolCtrl; - wxComboBox* m_symbolFontCtrl; - wxComboBox* m_bulletNameCtrl; - wxSpinCtrl* m_numberCtrl; - wxRichTextCtrl* m_previewCtrl; - /// Control identifiers - enum { - ID_RICHTEXTBULLETSPAGE = 10300, - ID_RICHTEXTBULLETSPAGE_STYLELISTBOX = 10305, - ID_RICHTEXTBULLETSPAGE_PERIODCTRL = 10313, - ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL = 10311, - ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL = 10306, - ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL = 10315, - ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC = 10301, - ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10307, - ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10308, - ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL = 10309, - ID_RICHTEXTBULLETSPAGE_NAMESTATIC = 10303, - ID_RICHTEXTBULLETSPAGE_NAMECTRL = 10304, - ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC = 10302, - ID_RICHTEXTBULLETSPAGE_NUMBERCTRL = 10310, - ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL = 10314 - }; -////@end wxRichTextBulletsPage member variables - - bool m_hasBulletStyle; - bool m_hasBulletNumber; - bool m_hasBulletSymbol; - bool m_dontUpdate; -}; - -#endif - // _RICHTEXTBULLETSPAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextbulletspage.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/4/2006 10:32:31 AM +// RCS-ID: $Id: richtextbulletspage.h 50950 2007-12-30 16:11:12Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTBULLETSPAGE_H_ +#define _RICHTEXTBULLETSPAGE_H_ + +/*! + * Includes + */ + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxSpinCtrl; +class wxRichTextCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE _("wxRichTextBulletsPage") +#define SYMBOL_WXRICHTEXTBULLETSPAGE_IDNAME ID_RICHTEXTBULLETSPAGE +#define SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextBulletsPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( wxRichTextBulletsPage ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextBulletsPage( ); + wxRichTextBulletsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Updates the bullets preview + void UpdatePreview(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Gets the attributes associated with the main formatting dialog + wxTextAttrEx* GetAttributes(); + + /// Update for symbol-related controls + void OnSymbolUpdate( wxUpdateUIEvent& event ); + + /// Update for number-related controls + void OnNumberUpdate( wxUpdateUIEvent& event ); + + /// Update for standard bullet-related controls + void OnStandardBulletUpdate( wxUpdateUIEvent& event ); + +////@begin wxRichTextBulletsPage event handler declarations + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX + void OnStylelistboxSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL + void OnPeriodctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL + void OnPeriodctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL + void OnParenthesesctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL + void OnParenthesesctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL + void OnBulletAlignmentCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC + void OnSymbolstaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL + void OnSymbolctrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL + void OnSymbolctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL + void OnSymbolctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL + void OnChooseSymbolClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL + void OnChooseSymbolUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC + void OnNamestaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL + void OnNamectrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL + void OnNamectrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL + void OnNamectrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC + void OnNumberstaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlUpdated( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlUp( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlDown( wxSpinEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlTextUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextBulletsPage event handler declarations + +////@begin wxRichTextBulletsPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextBulletsPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextBulletsPage member variables + wxListBox* m_styleListBox; + wxCheckBox* m_periodCtrl; + wxCheckBox* m_parenthesesCtrl; + wxCheckBox* m_rightParenthesisCtrl; + wxComboBox* m_bulletAlignmentCtrl; + wxComboBox* m_symbolCtrl; + wxComboBox* m_symbolFontCtrl; + wxComboBox* m_bulletNameCtrl; + wxSpinCtrl* m_numberCtrl; + wxRichTextCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTBULLETSPAGE = 10300, + ID_RICHTEXTBULLETSPAGE_STYLELISTBOX = 10305, + ID_RICHTEXTBULLETSPAGE_PERIODCTRL = 10313, + ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL = 10311, + ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL = 10306, + ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL = 10315, + ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC = 10301, + ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10307, + ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10308, + ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL = 10309, + ID_RICHTEXTBULLETSPAGE_NAMESTATIC = 10303, + ID_RICHTEXTBULLETSPAGE_NAMECTRL = 10304, + ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC = 10302, + ID_RICHTEXTBULLETSPAGE_NUMBERCTRL = 10310, + ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL = 10314 + }; +////@end wxRichTextBulletsPage member variables + + bool m_hasBulletStyle; + bool m_hasBulletNumber; + bool m_hasBulletSymbol; + bool m_dontUpdate; +}; + +#endif + // _RICHTEXTBULLETSPAGE_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextctrl.h b/Externals/wxWidgets/include/wx/richtext/richtextctrl.h index 6b4c0f6e37..2d203b9666 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextctrl.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextctrl.h @@ -1,976 +1,976 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextctrl.h -// Purpose: A rich edit control -// Author: Julian Smart -// Modified by: -// Created: 2005-09-30 -// RCS-ID: $Id: richtextctrl.h 52136 2008-02-27 08:54:40Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTCTRL_H_ -#define _WX_RICHTEXTCTRL_H_ - -#include "wx/richtext/richtextbuffer.h" - -#if wxUSE_RICHTEXT - -#include "wx/scrolwin.h" -#include "wx/caret.h" - -#include "wx/textctrl.h" - -#if !defined(__WXGTK__) && !defined(__WXMAC__) -#define wxRICHTEXT_BUFFERED_PAINTING 1 -#else -#define wxRICHTEXT_BUFFERED_PAINTING 0 -#endif - -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; - -/*! - * Styles and flags - */ - -/* Styles - */ - -#define wxRE_READONLY 0x0010 -#define wxRE_MULTILINE 0x0020 - -/* Flags - */ - -#define wxRICHTEXT_SHIFT_DOWN 0x01 -#define wxRICHTEXT_CTRL_DOWN 0x02 -#define wxRICHTEXT_ALT_DOWN 0x04 - -/* Defaults - */ - -#define wxRICHTEXT_DEFAULT_OVERALL_SIZE wxSize(-1, -1) -#define wxRICHTEXT_DEFAULT_IMAGE_SIZE wxSize(80, 80) -#define wxRICHTEXT_DEFAULT_SPACING 3 -#define wxRICHTEXT_DEFAULT_MARGIN 3 -#define wxRICHTEXT_DEFAULT_UNFOCUSSED_BACKGROUND wxColour(175, 175, 175) -#define wxRICHTEXT_DEFAULT_FOCUSSED_BACKGROUND wxColour(140, 140, 140) -#define wxRICHTEXT_DEFAULT_UNSELECTED_BACKGROUND wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) -#define wxRICHTEXT_DEFAULT_TYPE_COLOUR wxColour(0, 0, 200) -#define wxRICHTEXT_DEFAULT_FOCUS_RECT_COLOUR wxColour(100, 80, 80) -#define wxRICHTEXT_DEFAULT_CARET_WIDTH 2 -// Minimum buffer size before delayed layout kicks in -#define wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD 20000 -// Milliseconds before layout occurs after resize -#define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50 - -/*! - * Forward declarations - */ - -/*! - * wxRichTextItem class declaration - */ - -// Drawing styles/states -#define wxRICHTEXT_SELECTED 0x01 -#define wxRICHTEXT_TAGGED 0x02 -// The control is focussed -#define wxRICHTEXT_FOCUSSED 0x04 -// The item itself has the focus -#define wxRICHTEXT_IS_FOCUS 0x08 - -/*! - * wxRichTextCtrl class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxTextCtrlBase, - public wxScrollHelper -{ - DECLARE_CLASS( wxRichTextCtrl ) - DECLARE_EVENT_TABLE() - -public: -// Constructors - - wxRichTextCtrl( ); - wxRichTextCtrl( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); - - virtual ~wxRichTextCtrl( ); - -// Operations - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr ); - - /// Member initialisation - void Init(); - -///// wxTextCtrl compatibility - -// Accessors - - virtual wxString GetValue() const; - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const ; - virtual wxString GetLineText(long lineNo) const ; - virtual int GetNumberOfLines() const ; - - virtual bool IsModified() const ; - virtual bool IsEditable() const ; - - // more readable flag testing methods - bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE); } - bool IsMultiLine() const { return !IsSingleLine(); } - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const; - - virtual wxString GetStringSelection() const; - - /// Get filename - wxString GetFilename() const { return m_filename; } - - /// Set filename - void SetFilename(const wxString& filename) { m_filename = filename; } - - /// Set the threshold in character positions for doing layout optimization during sizing - void SetDelayedLayoutThreshold(long threshold) { m_delayedLayoutThreshold = threshold; } - - /// Get the threshold in character positions for doing layout optimization during sizing - long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; } - -#if wxABI_VERSION >= 20808 - /// Set text cursor - void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; } - - /// Get text cursor - wxCursor GetTextCursor() const { return m_textCursor; } - - /// Set URL cursor - void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; } - - /// Get URL cursor - wxCursor GetURLCursor() const { return m_urlCursor; } -#endif - -// Operations - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load/save the controls contents from/to the file - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file = wxEmptyString, int fileType = wxRICHTEXT_TYPE_ANY); - - /// Set the handler flags, controlling loading and saving - void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); } - - /// Get the handler flags, controlling loading and saving - int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); } - - // sets/clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - // set the max number of characters which may be entered in a single line - // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // text control under some platforms supports the text styles: these - // methods allow to apply the given text style to the given selection or to - // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool SetStyle(long start, long end, const wxTextAttrEx& style); - virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttrEx& style); - virtual bool GetStyle(long position, wxRichTextAttr& style); - - // get the common set of styles for the range - virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style); - virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style); - - // extended style setting operation with flags including: - // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY - // see richtextbuffer.h for more details. - virtual bool SetStyleEx(long start, long end, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - virtual bool SetStyleEx(const wxRichTextRange& range, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - - /// Get the content (uncombined) attributes for this position. - virtual bool GetUncombinedStyle(long position, wxTextAttr& style); - virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style); - virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); - - virtual bool SetDefaultStyle(const wxTextAttrEx& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - - // TODO: change to GetDefaultStyle if we merge wxTextAttr and wxTextAttrEx - virtual const wxTextAttrEx& GetDefaultStyleEx() const; - virtual const wxTextAttr& GetDefaultStyle() const; - - /// Set list style - virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - - /// Clear list for given range - virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); - - /// Number/renumber any list elements in the given range - /// def/defName can be NULL/empty to indicate that the existing list style should be used. - virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); - - /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1 - /// def/defName can be NULL/empty to indicate that the existing list style should be used. - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); - - /// Deletes the content in the given range - virtual bool Delete(const wxRichTextRange& range); - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - - // find the character at position given in pixels - // - // NB: pt is in device coords (not adjusted for the client area origin nor - // scrolling) - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const; - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void DeleteSelection(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - virtual bool CanDeleteSelection() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SelectAll(); - virtual void SetEditable(bool editable); - - /// Call Freeze to prevent refresh - virtual void Freeze(); - - /// Call Thaw to refresh - virtual void Thaw(); - - /// Call Thaw to refresh - virtual bool IsFrozen() const { return m_freezeCount > 0; } - - virtual bool HasSelection() const; - -///// Functionality specific to wxRichTextCtrl - - /// Write an image at the current insertion point. Supply optional type to use - /// for internal and file storage of the raw data. - virtual bool WriteImage(const wxImage& image, int bitmapType = wxBITMAP_TYPE_PNG); - - /// Write a bitmap at the current insertion point. Supply optional type to use - /// for internal and file storage of the raw data. - virtual bool WriteImage(const wxBitmap& bitmap, int bitmapType = wxBITMAP_TYPE_PNG); - - /// Load an image from file and write at the current insertion point. - virtual bool WriteImage(const wxString& filename, int bitmapType); - - /// Write an image block at the current insertion point. - virtual bool WriteImage(const wxRichTextImageBlock& imageBlock); - - /// Insert a newline (actually paragraph) at the current insertion point. - virtual bool Newline(); - - /// Insert a line break at the current insertion point. - virtual bool LineBreak(); - - /// Set basic (overall) style - virtual void SetBasicStyle(const wxTextAttrEx& style) { GetBuffer().SetBasicStyle(style); } - virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); } - - /// Get basic (overall) style - virtual const wxTextAttrEx& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); } - - /// Begin using a style - virtual bool BeginStyle(const wxTextAttrEx& style) { return GetBuffer().BeginStyle(style); } - - /// End the style - virtual bool EndStyle() { return GetBuffer().EndStyle(); } - - /// End all styles - virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); } - - /// Begin using bold - bool BeginBold() { return GetBuffer().BeginBold(); } - - /// End using bold - bool EndBold() { return GetBuffer().EndBold(); } - - /// Begin using italic - bool BeginItalic() { return GetBuffer().BeginItalic(); } - - /// End using italic - bool EndItalic() { return GetBuffer().EndItalic(); } - - /// Begin using underline - bool BeginUnderline() { return GetBuffer().BeginUnderline(); } - - /// End using underline - bool EndUnderline() { return GetBuffer().EndUnderline(); } - - /// Begin using point size - bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); } - - /// End using point size - bool EndFontSize() { return GetBuffer().EndFontSize(); } - - /// Begin using this font - bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); } - - /// End using a font - bool EndFont() { return GetBuffer().EndFont(); } - - /// Begin using this colour - bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); } - - /// End using a colour - bool EndTextColour() { return GetBuffer().EndTextColour(); } - - /// Begin using alignment - bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); } - - /// End alignment - bool EndAlignment() { return GetBuffer().EndAlignment(); } - - /// Begin left indent - bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); } - - /// End left indent - bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); } - - /// Begin right indent - bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); } - - /// End right indent - bool EndRightIndent() { return GetBuffer().EndRightIndent(); } - - /// Begin paragraph spacing - bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); } - - /// End paragraph spacing - bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); } - - /// Begin line spacing - bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); } - - /// End line spacing - bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); } - - /// Begin numbered bullet - bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD) - { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); } - - /// End numbered bullet - bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); } - - /// Begin symbol bullet - bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL) - { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); } - - /// End symbol bullet - bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); } - - /// Begin standard bullet - bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD) - { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); } - - /// End standard bullet - bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); } - - /// Begin named character style - bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); } - - /// End named character style - bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); } - - /// Begin named paragraph style - bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); } - - /// End named character style - bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); } - - /// Begin named list style - bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); } - - /// End named character style - bool EndListStyle() { return GetBuffer().EndListStyle(); } - - /// Begin URL - bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); } - - /// End URL - bool EndURL() { return GetBuffer().EndURL(); } - - /// Sets the default style to the style under the cursor - bool SetDefaultStyleToCursorStyle(); - - /// Clear the selection - virtual void SelectNone(); - - /// Select the word at the given character position - virtual bool SelectWord(long position); - - /// Get/set the selection range in character positions. -1, -1 means no selection. - /// The range is in API convention, i.e. a single character selection is denoted - /// by (n, n+1) - wxRichTextRange GetSelectionRange() const; - void SetSelectionRange(const wxRichTextRange& range); - - /// Get/set the selection range in character positions. -1, -1 means no selection. - /// The range is in internal format, i.e. a single character selection is denoted - /// by (n, n) - const wxRichTextRange& GetInternalSelectionRange() const { return m_selectionRange; } - void SetInternalSelectionRange(const wxRichTextRange& range) { m_selectionRange = range; } - - /// Add a new paragraph of text to the end of the buffer - virtual wxRichTextRange AddParagraph(const wxString& text); - - /// Add an image - virtual wxRichTextRange AddImage(const wxImage& image); - - /// Layout the buffer: which we must do before certain operations, such as - /// setting the caret position. - virtual bool LayoutContent(bool onlyVisibleRect = false); - - /// Move the caret to the given character position - virtual bool MoveCaret(long pos, bool showAtLineStart = false); - - /// Move right - virtual bool MoveRight(int noPositions = 1, int flags = 0); - - /// Move left - virtual bool MoveLeft(int noPositions = 1, int flags = 0); - - /// Move up - virtual bool MoveUp(int noLines = 1, int flags = 0); - - /// Move up - virtual bool MoveDown(int noLines = 1, int flags = 0); - - /// Move to the end of the line - virtual bool MoveToLineEnd(int flags = 0); - - /// Move to the start of the line - virtual bool MoveToLineStart(int flags = 0); - - /// Move to the end of the paragraph - virtual bool MoveToParagraphEnd(int flags = 0); - - /// Move to the start of the paragraph - virtual bool MoveToParagraphStart(int flags = 0); - - /// Move to the start of the buffer - virtual bool MoveHome(int flags = 0); - - /// Move to the end of the buffer - virtual bool MoveEnd(int flags = 0); - - /// Move n pages up - virtual bool PageUp(int noPages = 1, int flags = 0); - - /// Move n pages down - virtual bool PageDown(int noPages = 1, int flags = 0); - - /// Move n words left - virtual bool WordLeft(int noPages = 1, int flags = 0); - - /// Move n words right - virtual bool WordRight(int noPages = 1, int flags = 0); - - /// Returns the buffer associated with the control. - wxRichTextBuffer& GetBuffer() { return m_buffer; } - const wxRichTextBuffer& GetBuffer() const { return m_buffer; } - - /// Start batching undo history for commands. - virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); } - - /// End batching undo history for commands. - virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); } - - /// Are we batching undo history for commands? - virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); } - - /// Start suppressing undo history for commands. - virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); } - - /// End suppressing undo history for commands. - virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); } - - /// Are we suppressing undo history for commands? - virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); } - - /// Test if this whole range has character attributes of the specified kind. If any - /// of the attributes are different within the range, the test fails. You - /// can use this to implement, for example, bold button updating. style must have - /// flags indicating which attributes are of interest. - virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const - { - return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); - } - virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const - { - return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); - } - - /// Test if this whole range has paragraph attributes of the specified kind. If any - /// of the attributes are different within the range, the test fails. You - /// can use this to implement, for example, centering button updating. style must have - /// flags indicating which attributes are of interest. - virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const - { - return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); - } - virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const - { - return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); - } - - /// Is all of the selection bold? - virtual bool IsSelectionBold(); - - /// Is all of the selection italics? - virtual bool IsSelectionItalics(); - - /// Is all of the selection underlined? - virtual bool IsSelectionUnderlined(); - - /// Is all of the selection aligned according to the specified flag? - virtual bool IsSelectionAligned(wxTextAttrAlignment alignment); - - /// Apply bold to the selection - virtual bool ApplyBoldToSelection(); - - /// Apply italic to the selection - virtual bool ApplyItalicToSelection(); - - /// Apply underline to the selection - virtual bool ApplyUnderlineToSelection(); - - /// Apply alignment to the selection - virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment); - - /// Apply a named style to the selection - virtual bool ApplyStyle(wxRichTextStyleDefinition* def); - - /// Set style sheet, if any - void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); } - wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); } - - /// Push style sheet to top of stack - bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); } - - /// Pop style sheet from top of stack - wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); } - - /// Apply the style sheet to the buffer, for example if the styles have changed. - bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL); - -// Command handlers - - void Command(wxCommandEvent& event); - void OnDropFiles(wxDropFilesEvent& event); - void OnCaptureLost(wxMouseCaptureLostEvent& event); - - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - void OnClear(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - void OnUpdateClear(wxUpdateUIEvent& event); - - // Show a context menu for Rich Edit controls (the standard - // EDIT control has one already) - void OnContextMenu(wxContextMenuEvent& event); - -// Event handlers - - /// Painting - void OnPaint(wxPaintEvent& event); - void OnEraseBackground(wxEraseEvent& event); - - /// Left-click - void OnLeftClick(wxMouseEvent& event); - - /// Left-up - void OnLeftUp(wxMouseEvent& event); - - /// Motion - void OnMoveMouse(wxMouseEvent& event); - - /// Left-double-click - void OnLeftDClick(wxMouseEvent& event); - - /// Middle-click - void OnMiddleClick(wxMouseEvent& event); - - /// Right-click - void OnRightClick(wxMouseEvent& event); - - /// Key press - void OnChar(wxKeyEvent& event); - - /// Sizing - void OnSize(wxSizeEvent& event); - - /// Setting/losing focus - void OnSetFocus(wxFocusEvent& event); - void OnKillFocus(wxFocusEvent& event); - - /// Idle-time processing - void OnIdle(wxIdleEvent& event); - - /// Scrolling - void OnScroll(wxScrollWinEvent& event); - - /// Set font, and also default attributes - virtual bool SetFont(const wxFont& font); - - /// Set up scrollbars, e.g. after a resize - virtual void SetupScrollbars(bool atTop = false); - - /// Keyboard navigation - virtual bool KeyboardNavigate(int keyCode, int flags); - - /// Paint the background - virtual void PaintBackground(wxDC& dc); - -#if wxRICHTEXT_BUFFERED_PAINTING - /// Recreate buffer bitmap if necessary - virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize); -#endif - - /// Set the selection - virtual void DoSetSelection(long from, long to, bool scrollCaret = true); - - /// Write text - virtual void DoWriteText(const wxString& value, int flags = 0); - - /// Should we inherit colours? - virtual bool ShouldInheritColours() const { return false; } - - /// Position the caret - virtual void PositionCaret(); - - /// Extend the selection, returning true if the selection was - /// changed. Selections are in caret positions. - virtual bool ExtendSelection(long oldPosition, long newPosition, int flags); - - /// Scroll into view. This takes a _caret_ position. - virtual bool ScrollIntoView(long position, int keyCode); - - /// The caret position is the character position just before the caret. - /// A value of -1 means the caret is at the start of the buffer. - void SetCaretPosition(long position, bool showAtLineStart = false) ; - long GetCaretPosition() const { return m_caretPosition; } - - /// The adjusted caret position is the character position adjusted to take - /// into account whether we're at the start of a paragraph, in which case - /// style information should be taken from the next position, not current one. - long GetAdjustedCaretPosition(long caretPos) const; - - /// Move caret one visual step forward: this may mean setting a flag - /// and keeping the same position if we're going from the end of one line - /// to the start of the next, which may be the exact same caret position. - void MoveCaretForward(long oldPosition) ; - - /// Move caret one visual step forward: this may mean setting a flag - /// and keeping the same position if we're going from the end of one line - /// to the start of the next, which may be the exact same caret position. - void MoveCaretBack(long oldPosition) ; - - /// Get the caret height and position for the given character position - bool GetCaretPositionForIndex(long position, wxRect& rect); - - /// Gets the line for the visible caret position. If the caret is - /// shown at the very end of the line, it means the next character is actually - /// on the following line. So let's get the line we're expecting to find - /// if this is the case. - wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const; - - /// Gets the command processor - wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); } - - /// Delete content if there is a selection, e.g. when pressing a key. - /// Returns the new caret position in newPos, or leaves it if there - /// was no action. - bool DeleteSelectedContent(long* newPos= NULL); - - /// Transform logical to physical - wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const; - - /// Transform physical to logical - wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const; - - /// Finds the caret position for the next word. Direction - /// is 1 (forward) or -1 (backwards). - virtual long FindNextWordPosition(int direction = 1) const; - - /// Is the given position visible on the screen? - bool IsPositionVisible(long pos) const; - - /// Returns the first visible position in the current view - long GetFirstVisiblePosition() const; - - /// Returns the caret position since the default formatting was changed. As - /// soon as this position changes, we no longer reflect the default style - /// in the UI. A value of -2 means that we should only reflect the style of the - /// content under the caret. - long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; } - - /// Set the caret position for the default style that the user is selecting. - void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; } - - /// Should the UI reflect the default style chosen by the user, rather than the style under - /// the caret? - bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; } - - /// Convenience function that tells the control to start reflecting the default - /// style, since the user is changing it. - void SetAndShowDefaultStyle(const wxRichTextAttr& attr) - { - SetDefaultStyle(attr); - SetCaretPositionForDefaultStyle(GetCaretPosition()); - } - - /// Get the first visible point in the window - wxPoint GetFirstVisiblePoint() const; - -// Implementation - - /// Font names take a long time to retrieve, so cache them (on demand) - static const wxArrayString& GetAvailableFontNames(); - static void ClearAvailableFontNames(); - - WX_FORWARD_TO_SCROLL_HELPER() - -// Overrides -protected: - - virtual wxSize DoGetBestSize() const ; - - virtual void DoSetValue(const wxString& value, int flags = 0); - - -// Data members -private: - - /// Allows nested Freeze/Thaw - int m_freezeCount; - -#if wxRICHTEXT_BUFFERED_PAINTING - /// Buffer bitmap - wxBitmap m_bufferBitmap; -#endif - - /// Text buffer - wxRichTextBuffer m_buffer; - - wxMenu* m_contextMenu; - - /// Caret position (1 less than the character position, so -1 is the - /// first caret position). - long m_caretPosition; - - /// Caret position when the default formatting has been changed. As - /// soon as this position changes, we no longer reflect the default style - /// in the UI. - long m_caretPositionForDefaultStyle; - - /// Selection range in character positions. -2, -2 means no selection. - wxRichTextRange m_selectionRange; - - /// Anchor so we know how to extend the selection - /// It's a caret position since it's between two characters. - long m_selectionAnchor; - - /// Are we editable? - bool m_editable; - - /// Are we showing the caret position at the start of a line - /// instead of at the end of the previous one? - bool m_caretAtLineStart; - - /// Are we dragging a selection? - bool m_dragging; - - /// Start position for drag - wxPoint m_dragStart; - - /// Do we need full layout in idle? - bool m_fullLayoutRequired; - wxLongLong m_fullLayoutTime; - long m_fullLayoutSavedPosition; - - /// Threshold for doing delayed layout - long m_delayedLayoutThreshold; - - /// Cursors - wxCursor m_textCursor; - wxCursor m_urlCursor; - - static wxArrayString sm_availableFontNames; -}; - -/*! - * wxRichTextEvent - the event class for wxRichTextCtrl notifications - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent -{ -public: - wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid), - m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL), - m_char((wxChar) 0) - { } - - wxRichTextEvent(const wxRichTextEvent& event) - : wxNotifyEvent(event), - m_flags(event.m_flags), m_position(-1), - m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet), - m_char((wxChar) 0) - { } - - long GetPosition() const { return m_position; } - void SetPosition(long pos) { m_position = pos; } - - int GetFlags() const { return m_flags; } - void SetFlags(int flags) { m_flags = flags; } - - wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; } - void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; } - - wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; } - void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; } - - const wxRichTextRange& GetRange() const { return m_range; } - void SetRange(const wxRichTextRange& range) { m_range = range; } - - wxChar GetCharacter() const { return m_char; } - void SetCharacter(wxChar ch) { m_char = ch; } - - virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); } - -protected: - int m_flags; - long m_position; - wxRichTextStyleSheet* m_oldStyleSheet; - wxRichTextStyleSheet* m_newStyleSheet; - wxRichTextRange m_range; - wxChar m_char; - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent) -}; - -/*! - * wxRichTextCtrl event macros - */ - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, 2602) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, 2603) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, 2604) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, 2605) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RETURN, 2606) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CHARACTER, 2607) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_DELETE, 2608) - - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, 2609) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, 2610) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, 2611) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, 2612) - - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, 2613) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, 2614) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, 2615) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, 2616) - -#if wxABI_VERSION >= 20808 - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, 2617) -#endif -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&); - -#define wxRichTextEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxRichTextEventFunction, &func) - -#define EVT_RICHTEXT_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_RETURN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RETURN, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_CHARACTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CHARACTER, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_DELETE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_DELETE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), - -#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), - -#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), -#define EVT_RICHTEXT_BUFFER_RESET(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), - -#endif - // wxUSE_RICHTEXT - -#endif - // _WX_RICHTEXTCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextctrl.h +// Purpose: A rich edit control +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// RCS-ID: $Id: richtextctrl.h 52136 2008-02-27 08:54:40Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTCTRL_H_ +#define _WX_RICHTEXTCTRL_H_ + +#include "wx/richtext/richtextbuffer.h" + +#if wxUSE_RICHTEXT + +#include "wx/scrolwin.h" +#include "wx/caret.h" + +#include "wx/textctrl.h" + +#if !defined(__WXGTK__) && !defined(__WXMAC__) +#define wxRICHTEXT_BUFFERED_PAINTING 1 +#else +#define wxRICHTEXT_BUFFERED_PAINTING 0 +#endif + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; + +/*! + * Styles and flags + */ + +/* Styles + */ + +#define wxRE_READONLY 0x0010 +#define wxRE_MULTILINE 0x0020 + +/* Flags + */ + +#define wxRICHTEXT_SHIFT_DOWN 0x01 +#define wxRICHTEXT_CTRL_DOWN 0x02 +#define wxRICHTEXT_ALT_DOWN 0x04 + +/* Defaults + */ + +#define wxRICHTEXT_DEFAULT_OVERALL_SIZE wxSize(-1, -1) +#define wxRICHTEXT_DEFAULT_IMAGE_SIZE wxSize(80, 80) +#define wxRICHTEXT_DEFAULT_SPACING 3 +#define wxRICHTEXT_DEFAULT_MARGIN 3 +#define wxRICHTEXT_DEFAULT_UNFOCUSSED_BACKGROUND wxColour(175, 175, 175) +#define wxRICHTEXT_DEFAULT_FOCUSSED_BACKGROUND wxColour(140, 140, 140) +#define wxRICHTEXT_DEFAULT_UNSELECTED_BACKGROUND wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) +#define wxRICHTEXT_DEFAULT_TYPE_COLOUR wxColour(0, 0, 200) +#define wxRICHTEXT_DEFAULT_FOCUS_RECT_COLOUR wxColour(100, 80, 80) +#define wxRICHTEXT_DEFAULT_CARET_WIDTH 2 +// Minimum buffer size before delayed layout kicks in +#define wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD 20000 +// Milliseconds before layout occurs after resize +#define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50 + +/*! + * Forward declarations + */ + +/*! + * wxRichTextItem class declaration + */ + +// Drawing styles/states +#define wxRICHTEXT_SELECTED 0x01 +#define wxRICHTEXT_TAGGED 0x02 +// The control is focussed +#define wxRICHTEXT_FOCUSSED 0x04 +// The item itself has the focus +#define wxRICHTEXT_IS_FOCUS 0x08 + +/*! + * wxRichTextCtrl class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxTextCtrlBase, + public wxScrollHelper +{ + DECLARE_CLASS( wxRichTextCtrl ) + DECLARE_EVENT_TABLE() + +public: +// Constructors + + wxRichTextCtrl( ); + wxRichTextCtrl( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); + + virtual ~wxRichTextCtrl( ); + +// Operations + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr ); + + /// Member initialisation + void Init(); + +///// wxTextCtrl compatibility + +// Accessors + + virtual wxString GetValue() const; + + virtual wxString GetRange(long from, long to) const; + + virtual int GetLineLength(long lineNo) const ; + virtual wxString GetLineText(long lineNo) const ; + virtual int GetNumberOfLines() const ; + + virtual bool IsModified() const ; + virtual bool IsEditable() const ; + + // more readable flag testing methods + bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE); } + bool IsMultiLine() const { return !IsSingleLine(); } + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + + virtual wxString GetStringSelection() const; + + /// Get filename + wxString GetFilename() const { return m_filename; } + + /// Set filename + void SetFilename(const wxString& filename) { m_filename = filename; } + + /// Set the threshold in character positions for doing layout optimization during sizing + void SetDelayedLayoutThreshold(long threshold) { m_delayedLayoutThreshold = threshold; } + + /// Get the threshold in character positions for doing layout optimization during sizing + long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; } + +#if wxABI_VERSION >= 20808 + /// Set text cursor + void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; } + + /// Get text cursor + wxCursor GetTextCursor() const { return m_textCursor; } + + /// Set URL cursor + void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; } + + /// Get URL cursor + wxCursor GetURLCursor() const { return m_urlCursor; } +#endif + +// Operations + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load/save the controls contents from/to the file + virtual bool DoLoadFile(const wxString& file, int fileType); + virtual bool DoSaveFile(const wxString& file = wxEmptyString, int fileType = wxRICHTEXT_TYPE_ANY); + + /// Set the handler flags, controlling loading and saving + void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); } + + /// Get the handler flags, controlling loading and saving + int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); } + + // sets/clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // text control under some platforms supports the text styles: these + // methods allow to apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool SetStyle(long start, long end, const wxTextAttrEx& style); + virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style); + virtual bool GetStyle(long position, wxTextAttr& style); + virtual bool GetStyle(long position, wxTextAttrEx& style); + virtual bool GetStyle(long position, wxRichTextAttr& style); + + // get the common set of styles for the range + virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style); + virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style); + + // extended style setting operation with flags including: + // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY + // see richtextbuffer.h for more details. + virtual bool SetStyleEx(long start, long end, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + virtual bool SetStyleEx(const wxRichTextRange& range, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /// Get the content (uncombined) attributes for this position. + virtual bool GetUncombinedStyle(long position, wxTextAttr& style); + virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style); + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); + + virtual bool SetDefaultStyle(const wxTextAttrEx& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + + // TODO: change to GetDefaultStyle if we merge wxTextAttr and wxTextAttrEx + virtual const wxTextAttrEx& GetDefaultStyleEx() const; + virtual const wxTextAttr& GetDefaultStyle() const; + + /// Set list style + virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + + /// Clear list for given range + virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /// Number/renumber any list elements in the given range + /// def/defName can be NULL/empty to indicate that the existing list style should be used. + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + + /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1 + /// def/defName can be NULL/empty to indicate that the existing list style should be used. + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + + /// Deletes the content in the given range + virtual bool Delete(const wxRichTextRange& range); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + + // find the character at position given in pixels + // + // NB: pt is in device coords (not adjusted for the client area origin nor + // scrolling) + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const; + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void DeleteSelection(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + virtual bool CanDeleteSelection() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SelectAll(); + virtual void SetEditable(bool editable); + + /// Call Freeze to prevent refresh + virtual void Freeze(); + + /// Call Thaw to refresh + virtual void Thaw(); + + /// Call Thaw to refresh + virtual bool IsFrozen() const { return m_freezeCount > 0; } + + virtual bool HasSelection() const; + +///// Functionality specific to wxRichTextCtrl + + /// Write an image at the current insertion point. Supply optional type to use + /// for internal and file storage of the raw data. + virtual bool WriteImage(const wxImage& image, int bitmapType = wxBITMAP_TYPE_PNG); + + /// Write a bitmap at the current insertion point. Supply optional type to use + /// for internal and file storage of the raw data. + virtual bool WriteImage(const wxBitmap& bitmap, int bitmapType = wxBITMAP_TYPE_PNG); + + /// Load an image from file and write at the current insertion point. + virtual bool WriteImage(const wxString& filename, int bitmapType); + + /// Write an image block at the current insertion point. + virtual bool WriteImage(const wxRichTextImageBlock& imageBlock); + + /// Insert a newline (actually paragraph) at the current insertion point. + virtual bool Newline(); + + /// Insert a line break at the current insertion point. + virtual bool LineBreak(); + + /// Set basic (overall) style + virtual void SetBasicStyle(const wxTextAttrEx& style) { GetBuffer().SetBasicStyle(style); } + virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); } + + /// Get basic (overall) style + virtual const wxTextAttrEx& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); } + + /// Begin using a style + virtual bool BeginStyle(const wxTextAttrEx& style) { return GetBuffer().BeginStyle(style); } + + /// End the style + virtual bool EndStyle() { return GetBuffer().EndStyle(); } + + /// End all styles + virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); } + + /// Begin using bold + bool BeginBold() { return GetBuffer().BeginBold(); } + + /// End using bold + bool EndBold() { return GetBuffer().EndBold(); } + + /// Begin using italic + bool BeginItalic() { return GetBuffer().BeginItalic(); } + + /// End using italic + bool EndItalic() { return GetBuffer().EndItalic(); } + + /// Begin using underline + bool BeginUnderline() { return GetBuffer().BeginUnderline(); } + + /// End using underline + bool EndUnderline() { return GetBuffer().EndUnderline(); } + + /// Begin using point size + bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); } + + /// End using point size + bool EndFontSize() { return GetBuffer().EndFontSize(); } + + /// Begin using this font + bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); } + + /// End using a font + bool EndFont() { return GetBuffer().EndFont(); } + + /// Begin using this colour + bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); } + + /// End using a colour + bool EndTextColour() { return GetBuffer().EndTextColour(); } + + /// Begin using alignment + bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); } + + /// End alignment + bool EndAlignment() { return GetBuffer().EndAlignment(); } + + /// Begin left indent + bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); } + + /// End left indent + bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); } + + /// Begin right indent + bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); } + + /// End right indent + bool EndRightIndent() { return GetBuffer().EndRightIndent(); } + + /// Begin paragraph spacing + bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); } + + /// End paragraph spacing + bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); } + + /// Begin line spacing + bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); } + + /// End line spacing + bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); } + + /// Begin numbered bullet + bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD) + { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); } + + /// End numbered bullet + bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); } + + /// Begin symbol bullet + bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL) + { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); } + + /// End symbol bullet + bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); } + + /// Begin standard bullet + bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD) + { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); } + + /// End standard bullet + bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); } + + /// Begin named character style + bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); } + + /// End named character style + bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); } + + /// Begin named paragraph style + bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); } + + /// End named character style + bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); } + + /// Begin named list style + bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); } + + /// End named character style + bool EndListStyle() { return GetBuffer().EndListStyle(); } + + /// Begin URL + bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); } + + /// End URL + bool EndURL() { return GetBuffer().EndURL(); } + + /// Sets the default style to the style under the cursor + bool SetDefaultStyleToCursorStyle(); + + /// Clear the selection + virtual void SelectNone(); + + /// Select the word at the given character position + virtual bool SelectWord(long position); + + /// Get/set the selection range in character positions. -1, -1 means no selection. + /// The range is in API convention, i.e. a single character selection is denoted + /// by (n, n+1) + wxRichTextRange GetSelectionRange() const; + void SetSelectionRange(const wxRichTextRange& range); + + /// Get/set the selection range in character positions. -1, -1 means no selection. + /// The range is in internal format, i.e. a single character selection is denoted + /// by (n, n) + const wxRichTextRange& GetInternalSelectionRange() const { return m_selectionRange; } + void SetInternalSelectionRange(const wxRichTextRange& range) { m_selectionRange = range; } + + /// Add a new paragraph of text to the end of the buffer + virtual wxRichTextRange AddParagraph(const wxString& text); + + /// Add an image + virtual wxRichTextRange AddImage(const wxImage& image); + + /// Layout the buffer: which we must do before certain operations, such as + /// setting the caret position. + virtual bool LayoutContent(bool onlyVisibleRect = false); + + /// Move the caret to the given character position + virtual bool MoveCaret(long pos, bool showAtLineStart = false); + + /// Move right + virtual bool MoveRight(int noPositions = 1, int flags = 0); + + /// Move left + virtual bool MoveLeft(int noPositions = 1, int flags = 0); + + /// Move up + virtual bool MoveUp(int noLines = 1, int flags = 0); + + /// Move up + virtual bool MoveDown(int noLines = 1, int flags = 0); + + /// Move to the end of the line + virtual bool MoveToLineEnd(int flags = 0); + + /// Move to the start of the line + virtual bool MoveToLineStart(int flags = 0); + + /// Move to the end of the paragraph + virtual bool MoveToParagraphEnd(int flags = 0); + + /// Move to the start of the paragraph + virtual bool MoveToParagraphStart(int flags = 0); + + /// Move to the start of the buffer + virtual bool MoveHome(int flags = 0); + + /// Move to the end of the buffer + virtual bool MoveEnd(int flags = 0); + + /// Move n pages up + virtual bool PageUp(int noPages = 1, int flags = 0); + + /// Move n pages down + virtual bool PageDown(int noPages = 1, int flags = 0); + + /// Move n words left + virtual bool WordLeft(int noPages = 1, int flags = 0); + + /// Move n words right + virtual bool WordRight(int noPages = 1, int flags = 0); + + /// Returns the buffer associated with the control. + wxRichTextBuffer& GetBuffer() { return m_buffer; } + const wxRichTextBuffer& GetBuffer() const { return m_buffer; } + + /// Start batching undo history for commands. + virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); } + + /// End batching undo history for commands. + virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); } + + /// Are we batching undo history for commands? + virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); } + + /// Start suppressing undo history for commands. + virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); } + + /// End suppressing undo history for commands. + virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); } + + /// Are we suppressing undo history for commands? + virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); } + + /// Test if this whole range has character attributes of the specified kind. If any + /// of the attributes are different within the range, the test fails. You + /// can use this to implement, for example, bold button updating. style must have + /// flags indicating which attributes are of interest. + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const + { + return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); + } + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const + { + return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); + } + + /// Test if this whole range has paragraph attributes of the specified kind. If any + /// of the attributes are different within the range, the test fails. You + /// can use this to implement, for example, centering button updating. style must have + /// flags indicating which attributes are of interest. + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const + { + return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); + } + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const + { + return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); + } + + /// Is all of the selection bold? + virtual bool IsSelectionBold(); + + /// Is all of the selection italics? + virtual bool IsSelectionItalics(); + + /// Is all of the selection underlined? + virtual bool IsSelectionUnderlined(); + + /// Is all of the selection aligned according to the specified flag? + virtual bool IsSelectionAligned(wxTextAttrAlignment alignment); + + /// Apply bold to the selection + virtual bool ApplyBoldToSelection(); + + /// Apply italic to the selection + virtual bool ApplyItalicToSelection(); + + /// Apply underline to the selection + virtual bool ApplyUnderlineToSelection(); + + /// Apply alignment to the selection + virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment); + + /// Apply a named style to the selection + virtual bool ApplyStyle(wxRichTextStyleDefinition* def); + + /// Set style sheet, if any + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); } + wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); } + + /// Push style sheet to top of stack + bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); } + + /// Pop style sheet from top of stack + wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); } + + /// Apply the style sheet to the buffer, for example if the styles have changed. + bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL); + +// Command handlers + + void Command(wxCommandEvent& event); + void OnDropFiles(wxDropFilesEvent& event); + void OnCaptureLost(wxMouseCaptureLostEvent& event); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + void OnClear(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + void OnUpdateClear(wxUpdateUIEvent& event); + + // Show a context menu for Rich Edit controls (the standard + // EDIT control has one already) + void OnContextMenu(wxContextMenuEvent& event); + +// Event handlers + + /// Painting + void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); + + /// Left-click + void OnLeftClick(wxMouseEvent& event); + + /// Left-up + void OnLeftUp(wxMouseEvent& event); + + /// Motion + void OnMoveMouse(wxMouseEvent& event); + + /// Left-double-click + void OnLeftDClick(wxMouseEvent& event); + + /// Middle-click + void OnMiddleClick(wxMouseEvent& event); + + /// Right-click + void OnRightClick(wxMouseEvent& event); + + /// Key press + void OnChar(wxKeyEvent& event); + + /// Sizing + void OnSize(wxSizeEvent& event); + + /// Setting/losing focus + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + + /// Idle-time processing + void OnIdle(wxIdleEvent& event); + + /// Scrolling + void OnScroll(wxScrollWinEvent& event); + + /// Set font, and also default attributes + virtual bool SetFont(const wxFont& font); + + /// Set up scrollbars, e.g. after a resize + virtual void SetupScrollbars(bool atTop = false); + + /// Keyboard navigation + virtual bool KeyboardNavigate(int keyCode, int flags); + + /// Paint the background + virtual void PaintBackground(wxDC& dc); + +#if wxRICHTEXT_BUFFERED_PAINTING + /// Recreate buffer bitmap if necessary + virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize); +#endif + + /// Set the selection + virtual void DoSetSelection(long from, long to, bool scrollCaret = true); + + /// Write text + virtual void DoWriteText(const wxString& value, int flags = 0); + + /// Should we inherit colours? + virtual bool ShouldInheritColours() const { return false; } + + /// Position the caret + virtual void PositionCaret(); + + /// Extend the selection, returning true if the selection was + /// changed. Selections are in caret positions. + virtual bool ExtendSelection(long oldPosition, long newPosition, int flags); + + /// Scroll into view. This takes a _caret_ position. + virtual bool ScrollIntoView(long position, int keyCode); + + /// The caret position is the character position just before the caret. + /// A value of -1 means the caret is at the start of the buffer. + void SetCaretPosition(long position, bool showAtLineStart = false) ; + long GetCaretPosition() const { return m_caretPosition; } + + /// The adjusted caret position is the character position adjusted to take + /// into account whether we're at the start of a paragraph, in which case + /// style information should be taken from the next position, not current one. + long GetAdjustedCaretPosition(long caretPos) const; + + /// Move caret one visual step forward: this may mean setting a flag + /// and keeping the same position if we're going from the end of one line + /// to the start of the next, which may be the exact same caret position. + void MoveCaretForward(long oldPosition) ; + + /// Move caret one visual step forward: this may mean setting a flag + /// and keeping the same position if we're going from the end of one line + /// to the start of the next, which may be the exact same caret position. + void MoveCaretBack(long oldPosition) ; + + /// Get the caret height and position for the given character position + bool GetCaretPositionForIndex(long position, wxRect& rect); + + /// Gets the line for the visible caret position. If the caret is + /// shown at the very end of the line, it means the next character is actually + /// on the following line. So let's get the line we're expecting to find + /// if this is the case. + wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const; + + /// Gets the command processor + wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); } + + /// Delete content if there is a selection, e.g. when pressing a key. + /// Returns the new caret position in newPos, or leaves it if there + /// was no action. + bool DeleteSelectedContent(long* newPos= NULL); + + /// Transform logical to physical + wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const; + + /// Transform physical to logical + wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const; + + /// Finds the caret position for the next word. Direction + /// is 1 (forward) or -1 (backwards). + virtual long FindNextWordPosition(int direction = 1) const; + + /// Is the given position visible on the screen? + bool IsPositionVisible(long pos) const; + + /// Returns the first visible position in the current view + long GetFirstVisiblePosition() const; + + /// Returns the caret position since the default formatting was changed. As + /// soon as this position changes, we no longer reflect the default style + /// in the UI. A value of -2 means that we should only reflect the style of the + /// content under the caret. + long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; } + + /// Set the caret position for the default style that the user is selecting. + void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; } + + /// Should the UI reflect the default style chosen by the user, rather than the style under + /// the caret? + bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; } + + /// Convenience function that tells the control to start reflecting the default + /// style, since the user is changing it. + void SetAndShowDefaultStyle(const wxRichTextAttr& attr) + { + SetDefaultStyle(attr); + SetCaretPositionForDefaultStyle(GetCaretPosition()); + } + + /// Get the first visible point in the window + wxPoint GetFirstVisiblePoint() const; + +// Implementation + + /// Font names take a long time to retrieve, so cache them (on demand) + static const wxArrayString& GetAvailableFontNames(); + static void ClearAvailableFontNames(); + + WX_FORWARD_TO_SCROLL_HELPER() + +// Overrides +protected: + + virtual wxSize DoGetBestSize() const ; + + virtual void DoSetValue(const wxString& value, int flags = 0); + + +// Data members +private: + + /// Allows nested Freeze/Thaw + int m_freezeCount; + +#if wxRICHTEXT_BUFFERED_PAINTING + /// Buffer bitmap + wxBitmap m_bufferBitmap; +#endif + + /// Text buffer + wxRichTextBuffer m_buffer; + + wxMenu* m_contextMenu; + + /// Caret position (1 less than the character position, so -1 is the + /// first caret position). + long m_caretPosition; + + /// Caret position when the default formatting has been changed. As + /// soon as this position changes, we no longer reflect the default style + /// in the UI. + long m_caretPositionForDefaultStyle; + + /// Selection range in character positions. -2, -2 means no selection. + wxRichTextRange m_selectionRange; + + /// Anchor so we know how to extend the selection + /// It's a caret position since it's between two characters. + long m_selectionAnchor; + + /// Are we editable? + bool m_editable; + + /// Are we showing the caret position at the start of a line + /// instead of at the end of the previous one? + bool m_caretAtLineStart; + + /// Are we dragging a selection? + bool m_dragging; + + /// Start position for drag + wxPoint m_dragStart; + + /// Do we need full layout in idle? + bool m_fullLayoutRequired; + wxLongLong m_fullLayoutTime; + long m_fullLayoutSavedPosition; + + /// Threshold for doing delayed layout + long m_delayedLayoutThreshold; + + /// Cursors + wxCursor m_textCursor; + wxCursor m_urlCursor; + + static wxArrayString sm_availableFontNames; +}; + +/*! + * wxRichTextEvent - the event class for wxRichTextCtrl notifications + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent +{ +public: + wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid), + m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL), + m_char((wxChar) 0) + { } + + wxRichTextEvent(const wxRichTextEvent& event) + : wxNotifyEvent(event), + m_flags(event.m_flags), m_position(-1), + m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet), + m_char((wxChar) 0) + { } + + long GetPosition() const { return m_position; } + void SetPosition(long pos) { m_position = pos; } + + int GetFlags() const { return m_flags; } + void SetFlags(int flags) { m_flags = flags; } + + wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; } + void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; } + + wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; } + void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; } + + const wxRichTextRange& GetRange() const { return m_range; } + void SetRange(const wxRichTextRange& range) { m_range = range; } + + wxChar GetCharacter() const { return m_char; } + void SetCharacter(wxChar ch) { m_char = ch; } + + virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); } + +protected: + int m_flags; + long m_position; + wxRichTextStyleSheet* m_oldStyleSheet; + wxRichTextStyleSheet* m_newStyleSheet; + wxRichTextRange m_range; + wxChar m_char; + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent) +}; + +/*! + * wxRichTextCtrl event macros + */ + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, 2602) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, 2603) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, 2604) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, 2605) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_RETURN, 2606) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CHARACTER, 2607) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_DELETE, 2608) + + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, 2609) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, 2610) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, 2611) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, 2612) + + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, 2613) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, 2614) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, 2615) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, 2616) + +#if wxABI_VERSION >= 20808 + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, 2617) +#endif +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&); + +#define wxRichTextEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxRichTextEventFunction, &func) + +#define EVT_RICHTEXT_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_RETURN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_RETURN, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_CHARACTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CHARACTER, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_DELETE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_DELETE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), + +#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), + +#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), +#define EVT_RICHTEXT_BUFFER_RESET(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxRichTextEventFunction, & fn ), NULL ), + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextfontpage.h b/Externals/wxWidgets/include/wx/richtext/richtextfontpage.h index 1e1295fa78..6c4f7dfde1 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextfontpage.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextfontpage.h @@ -1,164 +1,164 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richeditfontpage.h -// Purpose: Font page for wxRichTextFormattingDialog -// Author: Julian Smart -// Modified by: -// Created: 2006-10-02 -// RCS-ID: $Id: richtextfontpage.h 53105 2008-04-10 14:05:25Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTFONTPAGE_H_ -#define _RICHTEXTFONTPAGE_H_ - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxRichTextFontListBox; -class wxRichTextColourSwatchCtrl; -class wxRichTextFontPreviewCtrl; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL -#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE _("wxRichTextFontPage") -#define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE -#define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * wxRichTextFontPage class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxRichTextFontPage ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextFontPage( ); - wxRichTextFontPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE ); - - /// Initialise members - void Init(); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Updates the font preview - void UpdatePreview(); - - void OnFaceListBoxSelected( wxCommandEvent& event ); - void OnColourClicked( wxCommandEvent& event ); - - /// Gets the attributes associated with the main formatting dialog - wxTextAttrEx* GetAttributes(); - -////@begin wxRichTextFontPage event handler declarations - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL - void OnFaceTextCtrlUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL - void OnSizeTextCtrlUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX - void OnSizeListBoxSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL - void OnStyleCtrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL - void OnWeightCtrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL - void OnUnderliningCtrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL - void OnStrikethroughctrlClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL - void OnCapsctrlClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT - void OnRichtextfontpageSuperscriptClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT - void OnRichtextfontpageSubscriptClick( wxCommandEvent& event ); - -////@end wxRichTextFontPage event handler declarations - -////@begin wxRichTextFontPage member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextFontPage member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin wxRichTextFontPage member variables - wxTextCtrl* m_faceTextCtrl; - wxRichTextFontListBox* m_faceListBox; - wxTextCtrl* m_sizeTextCtrl; - wxListBox* m_sizeListBox; - wxComboBox* m_styleCtrl; - wxComboBox* m_weightCtrl; - wxComboBox* m_underliningCtrl; - wxRichTextColourSwatchCtrl* m_colourCtrl; - wxCheckBox* m_strikethroughCtrl; - wxCheckBox* m_capitalsCtrl; - wxCheckBox* m_superscriptCtrl; - wxCheckBox* m_subscriptCtrl; - wxRichTextFontPreviewCtrl* m_previewCtrl; - /// Control identifiers - enum { - ID_RICHTEXTFONTPAGE = 10000, - ID_RICHTEXTFONTPAGE_FACETEXTCTRL = 10001, - ID_RICHTEXTFONTPAGE_FACELISTBOX = 10002, - ID_RICHTEXTFONTPAGE_SIZETEXTCTRL = 10005, - ID_RICHTEXTFONTPAGE_SIZELISTBOX = 10006, - ID_RICHTEXTFONTPAGE_STYLECTRL = 10007, - ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10004, - ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10008, - ID_RICHTEXTFONTPAGE_COLOURCTRL = 10009, - ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10010, - ID_RICHTEXTFONTPAGE_CAPSCTRL = 10011, - ID_RICHTEXTFONTPAGE_SUPERSCRIPT = 10012, - ID_RICHTEXTFONTPAGE_SUBSCRIPT = 10013, - ID_RICHTEXTFONTPAGE_PREVIEWCTRL = 10003 - }; -////@end wxRichTextFontPage member variables - - bool m_dontUpdate; - bool m_colourPresent; -}; - -#endif - // _RICHTEXTFONTPAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richeditfontpage.h +// Purpose: Font page for wxRichTextFormattingDialog +// Author: Julian Smart +// Modified by: +// Created: 2006-10-02 +// RCS-ID: $Id: richtextfontpage.h 53105 2008-04-10 14:05:25Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTFONTPAGE_H_ +#define _RICHTEXTFONTPAGE_H_ + +/*! + * Includes + */ + +////@begin includes +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxRichTextFontListBox; +class wxRichTextColourSwatchCtrl; +class wxRichTextFontPreviewCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE _("wxRichTextFontPage") +#define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE +#define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextFontPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( wxRichTextFontPage ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextFontPage( ); + wxRichTextFontPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Updates the font preview + void UpdatePreview(); + + void OnFaceListBoxSelected( wxCommandEvent& event ); + void OnColourClicked( wxCommandEvent& event ); + + /// Gets the attributes associated with the main formatting dialog + wxTextAttrEx* GetAttributes(); + +////@begin wxRichTextFontPage event handler declarations + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL + void OnFaceTextCtrlUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL + void OnSizeTextCtrlUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX + void OnSizeListBoxSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL + void OnStyleCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL + void OnWeightCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL + void OnUnderliningCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL + void OnStrikethroughctrlClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL + void OnCapsctrlClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT + void OnRichtextfontpageSuperscriptClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT + void OnRichtextfontpageSubscriptClick( wxCommandEvent& event ); + +////@end wxRichTextFontPage event handler declarations + +////@begin wxRichTextFontPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextFontPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextFontPage member variables + wxTextCtrl* m_faceTextCtrl; + wxRichTextFontListBox* m_faceListBox; + wxTextCtrl* m_sizeTextCtrl; + wxListBox* m_sizeListBox; + wxComboBox* m_styleCtrl; + wxComboBox* m_weightCtrl; + wxComboBox* m_underliningCtrl; + wxRichTextColourSwatchCtrl* m_colourCtrl; + wxCheckBox* m_strikethroughCtrl; + wxCheckBox* m_capitalsCtrl; + wxCheckBox* m_superscriptCtrl; + wxCheckBox* m_subscriptCtrl; + wxRichTextFontPreviewCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTFONTPAGE = 10000, + ID_RICHTEXTFONTPAGE_FACETEXTCTRL = 10001, + ID_RICHTEXTFONTPAGE_FACELISTBOX = 10002, + ID_RICHTEXTFONTPAGE_SIZETEXTCTRL = 10005, + ID_RICHTEXTFONTPAGE_SIZELISTBOX = 10006, + ID_RICHTEXTFONTPAGE_STYLECTRL = 10007, + ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10004, + ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10008, + ID_RICHTEXTFONTPAGE_COLOURCTRL = 10009, + ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10010, + ID_RICHTEXTFONTPAGE_CAPSCTRL = 10011, + ID_RICHTEXTFONTPAGE_SUPERSCRIPT = 10012, + ID_RICHTEXTFONTPAGE_SUBSCRIPT = 10013, + ID_RICHTEXTFONTPAGE_PREVIEWCTRL = 10003 + }; +////@end wxRichTextFontPage member variables + + bool m_dontUpdate; + bool m_colourPresent; +}; + +#endif + // _RICHTEXTFONTPAGE_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextformatdlg.h b/Externals/wxWidgets/include/wx/richtext/richtextformatdlg.h index 928470a40b..e3bbf61453 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextformatdlg.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextformatdlg.h @@ -1,327 +1,327 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextformatdlg.h -// Purpose: Formatting dialog for wxRichTextCtrl -// Author: Julian Smart -// Modified by: -// Created: 2006-10-01 -// RCS-ID: $Id: richtextformatdlg.h 49946 2007-11-14 14:22:56Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTFORMATDLG_H_ -#define _WX_RICHTEXTFORMATDLG_H_ - -/*! - * Includes - */ - -#include "wx/defs.h" - -#if wxUSE_RICHTEXT - -#include "wx/propdlg.h" -#include "wx/bookctrl.h" - -#if wxUSE_HTML -#include "wx/htmllbox.h" -#endif - -#include "wx/richtext/richtextbuffer.h" -#include "wx/richtext/richtextstyles.h" - -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog; -class WXDLLIMPEXP_FWD_CORE wxImageList; - -/*! - * Flags determining the pages and buttons to be created in the dialog - */ - -#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001 -#define wxRICHTEXT_FORMAT_FONT 0x0002 -#define wxRICHTEXT_FORMAT_TABS 0x0004 -#define wxRICHTEXT_FORMAT_BULLETS 0x0008 -#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010 -#define wxRICHTEXT_FORMAT_LIST_STYLE 0x0020 - -#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x0100 - -/*! - * Indices for bullet styles in list control - */ - -enum { - wxRICHTEXT_BULLETINDEX_NONE = 0, - wxRICHTEXT_BULLETINDEX_ARABIC, - wxRICHTEXT_BULLETINDEX_UPPER_CASE, - wxRICHTEXT_BULLETINDEX_LOWER_CASE, - wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN, - wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN, - wxRICHTEXT_BULLETINDEX_OUTLINE, - wxRICHTEXT_BULLETINDEX_SYMBOL, - wxRICHTEXT_BULLETINDEX_BITMAP, - wxRICHTEXT_BULLETINDEX_STANDARD -}; - -/*! - * Shorthand for common combinations of pages - */ - -#define wxRICHTEXT_FORMAT_PARAGRAPH (wxRICHTEXT_FORMAT_INDENTS_SPACING | wxRICHTEXT_FORMAT_BULLETS | wxRICHTEXT_FORMAT_TABS | wxRICHTEXT_FORMAT_FONT) -#define wxRICHTEXT_FORMAT_CHARACTER (wxRICHTEXT_FORMAT_FONT) -#define wxRICHTEXT_FORMAT_STYLE (wxRICHTEXT_FORMAT_PARAGRAPH | wxRICHTEXT_FORMAT_STYLE_EDITOR) - -/*! - * Factory for formatting dialog - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialogFactory: public wxObject -{ -public: - wxRichTextFormattingDialogFactory() {} - virtual ~wxRichTextFormattingDialogFactory() {} - -// Overrideables - - /// Create all pages, under the dialog's book control, also calling AddPage - virtual bool CreatePages(long pages, wxRichTextFormattingDialog* dialog); - - /// Create a page, given a page identifier - virtual wxPanel* CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog); - - /// Enumerate all available page identifiers - virtual int GetPageId(int i) const; - - /// Get the number of available page identifiers - virtual int GetPageIdCount() const; - - /// Get the image index for the given page identifier - virtual int GetPageImage(int WXUNUSED(id)) const { return -1; } - - /// Invoke help for the dialog - virtual bool ShowHelp(int WXUNUSED(page), wxRichTextFormattingDialog* WXUNUSED(dialog)) { return false; } - - /// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create - virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog); - - /// Create the main dialog buttons - virtual bool CreateButtons(wxRichTextFormattingDialog* dialog); -}; - -/*! - * Formatting dialog for a wxRichTextCtrl - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog -{ -DECLARE_CLASS(wxRichTextFormattingDialog) -public: - wxRichTextFormattingDialog() { Init(); } - - wxRichTextFormattingDialog(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE) - { - Init(); - Create(flags, parent, title, id, pos, sz, style); - } - - ~wxRichTextFormattingDialog(); - - void Init(); - - bool Create(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - - /// Get attributes from the given range - virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range); - - /// Set the attributes and optionally update the display - virtual bool SetStyle(const wxTextAttrEx& style, bool update = true); - - /// Set the style definition and optionally update the display - virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true); - - /// Get the style definition, if any - virtual wxRichTextStyleDefinition* GetStyleDefinition() const { return m_styleDefinition; } - - /// Get the style sheet, if any - virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } - - /// Update the display - virtual bool UpdateDisplay(); - - /// Apply attributes to the given range - virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE); - - /// Gets and sets the attributes - const wxTextAttrEx& GetAttributes() const { return m_attributes; } - wxTextAttrEx& GetAttributes() { return m_attributes; } - void SetAttributes(const wxTextAttrEx& attr) { m_attributes = attr; } - - /// Transfers the data and from to the window - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); - - /// Apply the styles when a different tab is selected, so the previews are - /// up to date - void OnTabChanged(wxBookCtrlEvent& event); - - /// Respond to help command - void OnHelp(wxCommandEvent& event); - - /// Set/get image list - void SetImageList(wxImageList* imageList) { m_imageList = imageList; } - wxImageList* GetImageList() const { return m_imageList; } - - /// Get/set formatting factory object - static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory); - static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; } - - /// Helper for pages to get the top-level dialog - static wxRichTextFormattingDialog* GetDialog(wxWindow* win); - - /// Helper for pages to get the attributes - static wxTextAttrEx* GetDialogAttributes(wxWindow* win); - - /// Helper for pages to get the style - static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win); - - /// Should we show tooltips? - static bool ShowToolTips() { return sm_showToolTips; } - - /// Determines whether tooltips will be shown - static void SetShowToolTips(bool show) { sm_showToolTips = show; } - - /// Map book control page index to our page id - void AddPageId(int id) { m_pageIds.Add(id); } - -protected: - - wxImageList* m_imageList; - wxTextAttrEx m_attributes; - wxRichTextStyleDefinition* m_styleDefinition; - wxRichTextStyleSheet* m_styleSheet; - wxArrayInt m_pageIds; // mapping of book control indexes to page ids - - static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory; - static bool sm_showToolTips; - -DECLARE_EVENT_TABLE() -}; - -//----------------------------------------------------------------------------- -// helper class - wxRichTextFontPreviewCtrl -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_RICHTEXT wxRichTextFontPreviewCtrl : public wxWindow -{ -public: - wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0) - { - if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) -#ifdef __WXMSW__ - style |= GetThemedBorderStyle(); -#else - style |= wxBORDER_SUNKEN; -#endif - wxWindow::Create(parent, id, pos, sz, style); - - SetBackgroundColour(*wxWHITE); - m_textEffects = 0; - } - - void SetTextEffects(int effects) { m_textEffects = effects; } - int GetTextEffects() const { return m_textEffects; } - -private: - int m_textEffects; - - void OnPaint(wxPaintEvent& event); - DECLARE_EVENT_TABLE() -}; - -/* - * A control for displaying a small preview of a colour or bitmap - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextColourSwatchCtrl: public wxControl -{ - DECLARE_CLASS(wxRichTextColourSwatchCtrl) -public: - wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); - ~wxRichTextColourSwatchCtrl(); - - void OnMouseEvent(wxMouseEvent& event); - - void SetColour(const wxColour& colour) { m_colour = colour; SetBackgroundColour(m_colour); } - - wxColour& GetColour() { return m_colour; } - - virtual wxSize DoGetBestSize() const { return GetSize(); } - -protected: - wxColour m_colour; - -DECLARE_EVENT_TABLE() -}; - -/*! - * wxRichTextFontListBox class declaration - * A listbox to display fonts. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextFontListBox: public wxHtmlListBox -{ - DECLARE_CLASS(wxRichTextFontListBox) - DECLARE_EVENT_TABLE() - -public: - wxRichTextFontListBox() - { - Init(); - } - wxRichTextFontListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - virtual ~wxRichTextFontListBox(); - - void Init() - { - } - - bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - - /// Creates a suitable HTML fragment for a font - wxString CreateHTML(const wxString& facename) const; - - /// Get font name for index - wxString GetFaceName(size_t i) const ; - - /// Set selection for string, returning the index. - int SetFaceNameSelection(const wxString& name); - - /// Updates the font list - void UpdateFonts(); - - /// Does this face name exist? - bool HasFaceName(const wxString& faceName) const { return m_faceNames.Index(faceName) != wxNOT_FOUND; } - - /// Returns the array of face names - const wxArrayString& GetFaceNames() const { return m_faceNames; } - -protected: - /// Returns the HTML for this item - virtual wxString OnGetItem(size_t n) const; - -private: - - wxArrayString m_faceNames; -}; - -#endif - // wxUSE_RICHTEXT - -#endif - // _WX_RICHTEXTFORMATDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextformatdlg.h +// Purpose: Formatting dialog for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2006-10-01 +// RCS-ID: $Id: richtextformatdlg.h 49946 2007-11-14 14:22:56Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTFORMATDLG_H_ +#define _WX_RICHTEXTFORMATDLG_H_ + +/*! + * Includes + */ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT + +#include "wx/propdlg.h" +#include "wx/bookctrl.h" + +#if wxUSE_HTML +#include "wx/htmllbox.h" +#endif + +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextstyles.h" + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog; +class WXDLLIMPEXP_FWD_CORE wxImageList; + +/*! + * Flags determining the pages and buttons to be created in the dialog + */ + +#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001 +#define wxRICHTEXT_FORMAT_FONT 0x0002 +#define wxRICHTEXT_FORMAT_TABS 0x0004 +#define wxRICHTEXT_FORMAT_BULLETS 0x0008 +#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010 +#define wxRICHTEXT_FORMAT_LIST_STYLE 0x0020 + +#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x0100 + +/*! + * Indices for bullet styles in list control + */ + +enum { + wxRICHTEXT_BULLETINDEX_NONE = 0, + wxRICHTEXT_BULLETINDEX_ARABIC, + wxRICHTEXT_BULLETINDEX_UPPER_CASE, + wxRICHTEXT_BULLETINDEX_LOWER_CASE, + wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN, + wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN, + wxRICHTEXT_BULLETINDEX_OUTLINE, + wxRICHTEXT_BULLETINDEX_SYMBOL, + wxRICHTEXT_BULLETINDEX_BITMAP, + wxRICHTEXT_BULLETINDEX_STANDARD +}; + +/*! + * Shorthand for common combinations of pages + */ + +#define wxRICHTEXT_FORMAT_PARAGRAPH (wxRICHTEXT_FORMAT_INDENTS_SPACING | wxRICHTEXT_FORMAT_BULLETS | wxRICHTEXT_FORMAT_TABS | wxRICHTEXT_FORMAT_FONT) +#define wxRICHTEXT_FORMAT_CHARACTER (wxRICHTEXT_FORMAT_FONT) +#define wxRICHTEXT_FORMAT_STYLE (wxRICHTEXT_FORMAT_PARAGRAPH | wxRICHTEXT_FORMAT_STYLE_EDITOR) + +/*! + * Factory for formatting dialog + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialogFactory: public wxObject +{ +public: + wxRichTextFormattingDialogFactory() {} + virtual ~wxRichTextFormattingDialogFactory() {} + +// Overrideables + + /// Create all pages, under the dialog's book control, also calling AddPage + virtual bool CreatePages(long pages, wxRichTextFormattingDialog* dialog); + + /// Create a page, given a page identifier + virtual wxPanel* CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog); + + /// Enumerate all available page identifiers + virtual int GetPageId(int i) const; + + /// Get the number of available page identifiers + virtual int GetPageIdCount() const; + + /// Get the image index for the given page identifier + virtual int GetPageImage(int WXUNUSED(id)) const { return -1; } + + /// Invoke help for the dialog + virtual bool ShowHelp(int WXUNUSED(page), wxRichTextFormattingDialog* WXUNUSED(dialog)) { return false; } + + /// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create + virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog); + + /// Create the main dialog buttons + virtual bool CreateButtons(wxRichTextFormattingDialog* dialog); +}; + +/*! + * Formatting dialog for a wxRichTextCtrl + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog +{ +DECLARE_CLASS(wxRichTextFormattingDialog) +public: + wxRichTextFormattingDialog() { Init(); } + + wxRichTextFormattingDialog(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE) + { + Init(); + Create(flags, parent, title, id, pos, sz, style); + } + + ~wxRichTextFormattingDialog(); + + void Init(); + + bool Create(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + + /// Get attributes from the given range + virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range); + + /// Set the attributes and optionally update the display + virtual bool SetStyle(const wxTextAttrEx& style, bool update = true); + + /// Set the style definition and optionally update the display + virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true); + + /// Get the style definition, if any + virtual wxRichTextStyleDefinition* GetStyleDefinition() const { return m_styleDefinition; } + + /// Get the style sheet, if any + virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } + + /// Update the display + virtual bool UpdateDisplay(); + + /// Apply attributes to the given range + virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE); + + /// Gets and sets the attributes + const wxTextAttrEx& GetAttributes() const { return m_attributes; } + wxTextAttrEx& GetAttributes() { return m_attributes; } + void SetAttributes(const wxTextAttrEx& attr) { m_attributes = attr; } + + /// Transfers the data and from to the window + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + + /// Apply the styles when a different tab is selected, so the previews are + /// up to date + void OnTabChanged(wxBookCtrlEvent& event); + + /// Respond to help command + void OnHelp(wxCommandEvent& event); + + /// Set/get image list + void SetImageList(wxImageList* imageList) { m_imageList = imageList; } + wxImageList* GetImageList() const { return m_imageList; } + + /// Get/set formatting factory object + static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory); + static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; } + + /// Helper for pages to get the top-level dialog + static wxRichTextFormattingDialog* GetDialog(wxWindow* win); + + /// Helper for pages to get the attributes + static wxTextAttrEx* GetDialogAttributes(wxWindow* win); + + /// Helper for pages to get the style + static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win); + + /// Should we show tooltips? + static bool ShowToolTips() { return sm_showToolTips; } + + /// Determines whether tooltips will be shown + static void SetShowToolTips(bool show) { sm_showToolTips = show; } + + /// Map book control page index to our page id + void AddPageId(int id) { m_pageIds.Add(id); } + +protected: + + wxImageList* m_imageList; + wxTextAttrEx m_attributes; + wxRichTextStyleDefinition* m_styleDefinition; + wxRichTextStyleSheet* m_styleSheet; + wxArrayInt m_pageIds; // mapping of book control indexes to page ids + + static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory; + static bool sm_showToolTips; + +DECLARE_EVENT_TABLE() +}; + +//----------------------------------------------------------------------------- +// helper class - wxRichTextFontPreviewCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontPreviewCtrl : public wxWindow +{ +public: + wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0) + { + if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) +#ifdef __WXMSW__ + style |= GetThemedBorderStyle(); +#else + style |= wxBORDER_SUNKEN; +#endif + wxWindow::Create(parent, id, pos, sz, style); + + SetBackgroundColour(*wxWHITE); + m_textEffects = 0; + } + + void SetTextEffects(int effects) { m_textEffects = effects; } + int GetTextEffects() const { return m_textEffects; } + +private: + int m_textEffects; + + void OnPaint(wxPaintEvent& event); + DECLARE_EVENT_TABLE() +}; + +/* + * A control for displaying a small preview of a colour or bitmap + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextColourSwatchCtrl: public wxControl +{ + DECLARE_CLASS(wxRichTextColourSwatchCtrl) +public: + wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); + ~wxRichTextColourSwatchCtrl(); + + void OnMouseEvent(wxMouseEvent& event); + + void SetColour(const wxColour& colour) { m_colour = colour; SetBackgroundColour(m_colour); } + + wxColour& GetColour() { return m_colour; } + + virtual wxSize DoGetBestSize() const { return GetSize(); } + +protected: + wxColour m_colour; + +DECLARE_EVENT_TABLE() +}; + +/*! + * wxRichTextFontListBox class declaration + * A listbox to display fonts. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontListBox: public wxHtmlListBox +{ + DECLARE_CLASS(wxRichTextFontListBox) + DECLARE_EVENT_TABLE() + +public: + wxRichTextFontListBox() + { + Init(); + } + wxRichTextFontListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + virtual ~wxRichTextFontListBox(); + + void Init() + { + } + + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Creates a suitable HTML fragment for a font + wxString CreateHTML(const wxString& facename) const; + + /// Get font name for index + wxString GetFaceName(size_t i) const ; + + /// Set selection for string, returning the index. + int SetFaceNameSelection(const wxString& name); + + /// Updates the font list + void UpdateFonts(); + + /// Does this face name exist? + bool HasFaceName(const wxString& faceName) const { return m_faceNames.Index(faceName) != wxNOT_FOUND; } + + /// Returns the array of face names + const wxArrayString& GetFaceNames() const { return m_faceNames; } + +protected: + /// Returns the HTML for this item + virtual wxString OnGetItem(size_t n) const; + +private: + + wxArrayString m_faceNames; +}; + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTFORMATDLG_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtexthtml.h b/Externals/wxWidgets/include/wx/richtext/richtexthtml.h index 7025e751aa..45412485cb 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtexthtml.h +++ b/Externals/wxWidgets/include/wx/richtext/richtexthtml.h @@ -1,145 +1,145 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtexthtml.h -// Purpose: HTML I/O for wxRichTextCtrl -// Author: Julian Smart -// Modified by: -// Created: 2005-09-30 -// RCS-ID: $Id: richtexthtml.h 43599 2006-07-25 06:50:19Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTHTML_H_ -#define _WX_RICHTEXTHTML_H_ - -/*! - * Includes - */ - -#include "wx/richtext/richtextbuffer.h" - -/*! - * wxRichTextHTMLHandler - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler -{ - DECLARE_CLASS(wxRichTextHTMLHandler) -public: - wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML); - - /// Can we save using this handler? - virtual bool CanSave() const { return true; } - - /// Can we load using this handler? - virtual bool CanLoad() const { return false; } - - /// Can we handle this filename (if using files)? By default, checks the extension. - virtual bool CanHandle(const wxString& filename) const; - -// Accessors and operations unique to this handler - - /// Set and get the list of image locations generated by the last operation - void SetTemporaryImageLocations(const wxArrayString& locations) { m_imageLocations = locations; } - const wxArrayString& GetTemporaryImageLocations() const { return m_imageLocations; } - - /// Clear the image locations generated by the last operation - void ClearTemporaryImageLocations() { m_imageLocations.Clear(); } - - /// Delete the in-memory or temporary files generated by the last operation - bool DeleteTemporaryImages(); - - /// Delete the in-memory or temporary files generated by the last operation. This is a static - /// function that can be used to delete the saved locations from an earlier operation, - /// for example after the user has viewed the HTML file. - static bool DeleteTemporaryImages(int flags, const wxArrayString& imageLocations); - - /// Reset the file counter, in case, for example, the same names are required each time - static void SetFileCounter(int counter) { sm_fileCounter = counter; } - - /// Set and get the directory for storing temporary files. If empty, the system - /// temporary directory will be used. - void SetTempDir(const wxString& tempDir) { m_tempDir = tempDir; } - const wxString& GetTempDir() const { return m_tempDir; } - - /// Set and get mapping from point size to HTML font size. There should be 7 elements, - /// one for each HTML font size, each element specifying the maximum point size for that - /// HTML font size. E.g. 8, 10, 13, 17, 22, 29, 100 - void SetFontSizeMapping(const wxArrayInt& fontSizeMapping) { m_fontSizeMapping = fontSizeMapping; } - wxArrayInt GetFontSizeMapping() const { return m_fontSizeMapping; } - -protected: - -// Implementation - -#if wxUSE_STREAMS - virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); - virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); - - /// Output character formatting - void BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxTextOutputStream& stream ); - void EndCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxTextOutputStream& stream ); - - /// Output paragraph formatting - void BeginParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxTextOutputStream& stream); - void EndParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxTextOutputStream& stream); - - /// Output font tag - void OutputFont(const wxTextAttrEx& style, wxTextOutputStream& stream); - - /// Closes lists to level (-1 means close all) - void CloseLists(int level, wxTextOutputStream& str); - - /// Writes an image to its base64 equivalent, or to the memory filesystem, or to a file - void WriteImage(wxRichTextImage* image, wxOutputStream& stream); - - /// Converts from pt to size property compatible height - long PtToSize(long size); - - /// Typical base64 encoder - wxChar* b64enc(unsigned char* input, size_t in_len); - - /// Gets the mime type of the given wxBITMAP_TYPE - const wxChar* GetMimeType(int imageType); - - /// Gets the html equivalent of the specified value - wxString GetAlignment(const wxTextAttrEx& thisStyle); - - /// Generates   array for indentations - wxString SymbolicIndent(long indent); - - /// Finds the html equivalent of the specified bullet - int TypeOfList(const wxTextAttrEx& thisStyle, wxString& tag); -#endif - -// Data members - - wxRichTextBuffer* m_buffer; - - /// Indentation values of the table tags - wxArrayInt m_indents; - - /// Stack of list types: 0 = ol, 1 = ul - wxArrayInt m_listTypes; - - /// Is there any opened font tag? - bool m_font; - - /// Are we in a table? - bool m_inTable; - - /// A list of the image files or in-memory images created by the last operation. - wxArrayString m_imageLocations; - - /// A location for the temporary files - wxString m_tempDir; - - /// A mapping from point size to HTML font size - wxArrayInt m_fontSizeMapping; - - /// A counter for generating filenames - static int sm_fileCounter; -}; - -#endif - // _WX_RICHTEXTXML_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtexthtml.h +// Purpose: HTML I/O for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// RCS-ID: $Id: richtexthtml.h 43599 2006-07-25 06:50:19Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTHTML_H_ +#define _WX_RICHTEXTHTML_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextbuffer.h" + +/*! + * wxRichTextHTMLHandler + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler +{ + DECLARE_CLASS(wxRichTextHTMLHandler) +public: + wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML); + + /// Can we save using this handler? + virtual bool CanSave() const { return true; } + + /// Can we load using this handler? + virtual bool CanLoad() const { return false; } + + /// Can we handle this filename (if using files)? By default, checks the extension. + virtual bool CanHandle(const wxString& filename) const; + +// Accessors and operations unique to this handler + + /// Set and get the list of image locations generated by the last operation + void SetTemporaryImageLocations(const wxArrayString& locations) { m_imageLocations = locations; } + const wxArrayString& GetTemporaryImageLocations() const { return m_imageLocations; } + + /// Clear the image locations generated by the last operation + void ClearTemporaryImageLocations() { m_imageLocations.Clear(); } + + /// Delete the in-memory or temporary files generated by the last operation + bool DeleteTemporaryImages(); + + /// Delete the in-memory or temporary files generated by the last operation. This is a static + /// function that can be used to delete the saved locations from an earlier operation, + /// for example after the user has viewed the HTML file. + static bool DeleteTemporaryImages(int flags, const wxArrayString& imageLocations); + + /// Reset the file counter, in case, for example, the same names are required each time + static void SetFileCounter(int counter) { sm_fileCounter = counter; } + + /// Set and get the directory for storing temporary files. If empty, the system + /// temporary directory will be used. + void SetTempDir(const wxString& tempDir) { m_tempDir = tempDir; } + const wxString& GetTempDir() const { return m_tempDir; } + + /// Set and get mapping from point size to HTML font size. There should be 7 elements, + /// one for each HTML font size, each element specifying the maximum point size for that + /// HTML font size. E.g. 8, 10, 13, 17, 22, 29, 100 + void SetFontSizeMapping(const wxArrayInt& fontSizeMapping) { m_fontSizeMapping = fontSizeMapping; } + wxArrayInt GetFontSizeMapping() const { return m_fontSizeMapping; } + +protected: + +// Implementation + +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); + + /// Output character formatting + void BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxTextOutputStream& stream ); + void EndCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxTextOutputStream& stream ); + + /// Output paragraph formatting + void BeginParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxTextOutputStream& stream); + void EndParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxTextOutputStream& stream); + + /// Output font tag + void OutputFont(const wxTextAttrEx& style, wxTextOutputStream& stream); + + /// Closes lists to level (-1 means close all) + void CloseLists(int level, wxTextOutputStream& str); + + /// Writes an image to its base64 equivalent, or to the memory filesystem, or to a file + void WriteImage(wxRichTextImage* image, wxOutputStream& stream); + + /// Converts from pt to size property compatible height + long PtToSize(long size); + + /// Typical base64 encoder + wxChar* b64enc(unsigned char* input, size_t in_len); + + /// Gets the mime type of the given wxBITMAP_TYPE + const wxChar* GetMimeType(int imageType); + + /// Gets the html equivalent of the specified value + wxString GetAlignment(const wxTextAttrEx& thisStyle); + + /// Generates   array for indentations + wxString SymbolicIndent(long indent); + + /// Finds the html equivalent of the specified bullet + int TypeOfList(const wxTextAttrEx& thisStyle, wxString& tag); +#endif + +// Data members + + wxRichTextBuffer* m_buffer; + + /// Indentation values of the table tags + wxArrayInt m_indents; + + /// Stack of list types: 0 = ol, 1 = ul + wxArrayInt m_listTypes; + + /// Is there any opened font tag? + bool m_font; + + /// Are we in a table? + bool m_inTable; + + /// A list of the image files or in-memory images created by the last operation. + wxArrayString m_imageLocations; + + /// A location for the temporary files + wxString m_tempDir; + + /// A mapping from point size to HTML font size + wxArrayInt m_fontSizeMapping; + + /// A counter for generating filenames + static int sm_fileCounter; +}; + +#endif + // _WX_RICHTEXTXML_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextindentspage.h b/Externals/wxWidgets/include/wx/richtext/richtextindentspage.h index edb95f67ce..fad8c30de3 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextindentspage.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextindentspage.h @@ -1,165 +1,165 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextindentspage.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/3/2006 2:28:21 PM -// RCS-ID: $Id: richtextindentspage.h 43277 2006-11-10 15:48:46Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTINDENTSPAGE_H_ -#define _RICHTEXTINDENTSPAGE_H_ - -/*! - * Includes - */ - -////@begin includes -#include "wx/statline.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxRichTextCtrl; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL -#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE _("wxRichTextFontPage") -#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_IDNAME ID_RICHTEXTINDENTSSPACINGPAGE -#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * wxRichTextIndentsSpacingPage class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextIndentsSpacingPage( ); - wxRichTextIndentsSpacingPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE ); - - /// Initialise members - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Updates the paragraph preview - void UpdatePreview(); - - /// Gets the attributes associated with the main formatting dialog - wxTextAttrEx* GetAttributes(); - -////@begin wxRichTextIndentsSpacingPage event handler declarations - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT - void OnAlignmentLeftSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT - void OnAlignmentRightSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED - void OnAlignmentJustifiedSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED - void OnAlignmentCentredSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE - void OnAlignmentIndeterminateSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT - void OnIndentLeftUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST - void OnIndentLeftFirstUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT - void OnIndentRightUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL - void OnRichtextOutlinelevelSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE - void OnSpacingBeforeUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER - void OnSpacingAfterUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE - void OnSpacingLineSelected( wxCommandEvent& event ); - -////@end wxRichTextIndentsSpacingPage event handler declarations - -////@begin wxRichTextIndentsSpacingPage member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextIndentsSpacingPage member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin wxRichTextIndentsSpacingPage member variables - wxRadioButton* m_alignmentLeft; - wxRadioButton* m_alignmentRight; - wxRadioButton* m_alignmentJustified; - wxRadioButton* m_alignmentCentred; - wxRadioButton* m_alignmentIndeterminate; - wxTextCtrl* m_indentLeft; - wxTextCtrl* m_indentLeftFirst; - wxTextCtrl* m_indentRight; - wxComboBox* m_outlineLevelCtrl; - wxTextCtrl* m_spacingBefore; - wxTextCtrl* m_spacingAfter; - wxComboBox* m_spacingLine; - wxRichTextCtrl* m_previewCtrl; - /// Control identifiers - enum { - ID_RICHTEXTINDENTSSPACINGPAGE = 10100, - ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT = 10102, - ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT = 10110, - ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED = 10111, - ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED = 10112, - ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE = 10101, - ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT = 10103, - ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST = 10104, - ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT = 10113, - ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL = 10105, - ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE = 10114, - ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER = 10116, - ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE = 10115, - ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL = 10109 - }; -////@end wxRichTextIndentsSpacingPage member variables - - bool m_dontUpdate; -}; - -#endif - // _RICHTEXTINDENTSPAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextindentspage.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/3/2006 2:28:21 PM +// RCS-ID: $Id: richtextindentspage.h 43277 2006-11-10 15:48:46Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTINDENTSPAGE_H_ +#define _RICHTEXTINDENTSPAGE_H_ + +/*! + * Includes + */ + +////@begin includes +#include "wx/statline.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxRichTextCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE _("wxRichTextFontPage") +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_IDNAME ID_RICHTEXTINDENTSSPACINGPAGE +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextIndentsSpacingPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextIndentsSpacingPage( ); + wxRichTextIndentsSpacingPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Updates the paragraph preview + void UpdatePreview(); + + /// Gets the attributes associated with the main formatting dialog + wxTextAttrEx* GetAttributes(); + +////@begin wxRichTextIndentsSpacingPage event handler declarations + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT + void OnAlignmentLeftSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT + void OnAlignmentRightSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED + void OnAlignmentJustifiedSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED + void OnAlignmentCentredSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE + void OnAlignmentIndeterminateSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT + void OnIndentLeftUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST + void OnIndentLeftFirstUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT + void OnIndentRightUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL + void OnRichtextOutlinelevelSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE + void OnSpacingBeforeUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER + void OnSpacingAfterUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE + void OnSpacingLineSelected( wxCommandEvent& event ); + +////@end wxRichTextIndentsSpacingPage event handler declarations + +////@begin wxRichTextIndentsSpacingPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextIndentsSpacingPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextIndentsSpacingPage member variables + wxRadioButton* m_alignmentLeft; + wxRadioButton* m_alignmentRight; + wxRadioButton* m_alignmentJustified; + wxRadioButton* m_alignmentCentred; + wxRadioButton* m_alignmentIndeterminate; + wxTextCtrl* m_indentLeft; + wxTextCtrl* m_indentLeftFirst; + wxTextCtrl* m_indentRight; + wxComboBox* m_outlineLevelCtrl; + wxTextCtrl* m_spacingBefore; + wxTextCtrl* m_spacingAfter; + wxComboBox* m_spacingLine; + wxRichTextCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTINDENTSSPACINGPAGE = 10100, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT = 10102, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT = 10110, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED = 10111, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED = 10112, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE = 10101, + ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT = 10103, + ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST = 10104, + ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT = 10113, + ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL = 10105, + ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE = 10114, + ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER = 10116, + ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE = 10115, + ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL = 10109 + }; +////@end wxRichTextIndentsSpacingPage member variables + + bool m_dontUpdate; +}; + +#endif + // _RICHTEXTINDENTSPAGE_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextliststylepage.h b/Externals/wxWidgets/include/wx/richtext/richtextliststylepage.h index 21451d0e3f..324c9fe970 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextliststylepage.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextliststylepage.h @@ -1,276 +1,276 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextliststylepage.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/18/2006 11:36:37 AM -// RCS-ID: $Id: richtextliststylepage.h 42678 2006-10-29 22:01:06Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTLISTSTYLEPAGE_H_ -#define _RICHTEXTLISTSTYLEPAGE_H_ - -/*! - * Includes - */ - -////@begin includes -#include "wx/spinctrl.h" -#include "wx/notebook.h" -#include "wx/statline.h" -////@end includes - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL -#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE _("wxRichTextListStylePage") -#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE -#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * wxRichTextListStylePage class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextListStylePage( ); - wxRichTextListStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE ); - - /// Initialises member variables - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - - /// Updates the bullets preview - void UpdatePreview(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Get attributes for selected level - wxRichTextAttr* GetAttributesForSelection(); - - /// Update for symbol-related controls - void OnSymbolUpdate( wxUpdateUIEvent& event ); - - /// Update for number-related controls - void OnNumberUpdate( wxUpdateUIEvent& event ); - - /// Update for standard bullet-related controls - void OnStandardBulletUpdate( wxUpdateUIEvent& event ); - - /// Just transfer to the window - void DoTransferDataToWindow(); - - /// Transfer from the window and preview - void TransferAndPreview(); - -////@begin wxRichTextListStylePage event handler declarations - - /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL - void OnLevelUpdated( wxSpinEvent& event ); - - /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL - void OnLevelUp( wxSpinEvent& event ); - - /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL - void OnLevelDown( wxSpinEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL - void OnLevelTextUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL - void OnLevelUIUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT - void OnChooseFontClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX - void OnStylelistboxSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL - void OnPeriodctrlClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL - void OnPeriodctrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL - void OnParenthesesctrlClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL - void OnParenthesesctrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL - void OnRightParenthesisCtrlClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL - void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL - void OnBulletAlignmentCtrlSelected( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC - void OnSymbolstaticUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL - void OnSymbolctrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL - void OnSymbolctrlUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL - void OnSymbolctrlUIUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL - void OnChooseSymbolClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL - void OnChooseSymbolUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL - void OnSymbolfontctrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL - void OnSymbolfontctrlUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL - void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC - void OnNamestaticUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL - void OnNamectrlSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL - void OnNamectrlUpdated( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL - void OnNamectrlUIUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT - void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT - void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED - void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED - void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE - void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT - void OnIndentLeftUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE - void OnIndentFirstLineUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT - void OnIndentRightUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE - void OnSpacingBeforeUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER - void OnSpacingAfterUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING - void OnLineSpacingSelected( wxCommandEvent& event ); - -////@end wxRichTextListStylePage event handler declarations - -////@begin wxRichTextListStylePage member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextListStylePage member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin wxRichTextListStylePage member variables - wxSpinCtrl* m_levelCtrl; - wxListBox* m_styleListBox; - wxCheckBox* m_periodCtrl; - wxCheckBox* m_parenthesesCtrl; - wxCheckBox* m_rightParenthesisCtrl; - wxComboBox* m_bulletAlignmentCtrl; - wxComboBox* m_symbolCtrl; - wxComboBox* m_symbolFontCtrl; - wxComboBox* m_bulletNameCtrl; - wxRadioButton* m_alignmentLeft; - wxRadioButton* m_alignmentRight; - wxRadioButton* m_alignmentJustified; - wxRadioButton* m_alignmentCentred; - wxRadioButton* m_alignmentIndeterminate; - wxTextCtrl* m_indentLeft; - wxTextCtrl* m_indentLeftFirst; - wxTextCtrl* m_indentRight; - wxTextCtrl* m_spacingBefore; - wxTextCtrl* m_spacingAfter; - wxComboBox* m_spacingLine; - wxRichTextCtrl* m_previewCtrl; - /// Control identifiers - enum { - ID_RICHTEXTLISTSTYLEPAGE = 10616, - ID_RICHTEXTLISTSTYLEPAGE_LEVEL = 10617, - ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT = 10604, - ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK = 10618, - ID_RICHTEXTLISTSTYLEPAGE_BULLETS = 10619, - ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX = 10620, - ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627, - ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626, - ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL = 10602, - ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL = 10603, - ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC = 10621, - ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL = 10622, - ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL = 10623, - ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625, - ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC = 10600, - ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL = 10601, - ID_RICHTEXTLISTSTYLEPAGE_SPACING = 10628, - ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT = 10629, - ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT = 10630, - ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED = 10631, - ID_RICHTEXTLISTSTYLEPAGE_CENTERED = 10632, - ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE = 10633, - ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT = 10634, - ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE = 10635, - ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT = 10636, - ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE = 10637, - ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER = 10638, - ID_RICHTEXTLISTSTYLEPAGE_LINESPACING = 10639, - ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL = 10640 - }; -////@end wxRichTextListStylePage member variables - - bool m_dontUpdate; - int m_currentLevel; -}; - -#endif - // _RICHTEXTLISTSTYLEPAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextliststylepage.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/18/2006 11:36:37 AM +// RCS-ID: $Id: richtextliststylepage.h 42678 2006-10-29 22:01:06Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTLISTSTYLEPAGE_H_ +#define _RICHTEXTLISTSTYLEPAGE_H_ + +/*! + * Includes + */ + +////@begin includes +#include "wx/spinctrl.h" +#include "wx/notebook.h" +#include "wx/statline.h" +////@end includes + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE _("wxRichTextListStylePage") +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextListStylePage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextListStylePage( ); + wxRichTextListStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE ); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Updates the bullets preview + void UpdatePreview(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Get attributes for selected level + wxRichTextAttr* GetAttributesForSelection(); + + /// Update for symbol-related controls + void OnSymbolUpdate( wxUpdateUIEvent& event ); + + /// Update for number-related controls + void OnNumberUpdate( wxUpdateUIEvent& event ); + + /// Update for standard bullet-related controls + void OnStandardBulletUpdate( wxUpdateUIEvent& event ); + + /// Just transfer to the window + void DoTransferDataToWindow(); + + /// Transfer from the window and preview + void TransferAndPreview(); + +////@begin wxRichTextListStylePage event handler declarations + + /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelUpdated( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelUp( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelDown( wxSpinEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelTextUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT + void OnChooseFontClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX + void OnStylelistboxSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL + void OnPeriodctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL + void OnPeriodctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL + void OnParenthesesctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL + void OnParenthesesctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL + void OnBulletAlignmentCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC + void OnSymbolstaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL + void OnSymbolctrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL + void OnSymbolctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL + void OnSymbolctrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL + void OnChooseSymbolClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL + void OnChooseSymbolUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC + void OnNamestaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL + void OnNamectrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL + void OnNamectrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL + void OnNamectrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT + void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT + void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED + void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED + void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE + void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT + void OnIndentLeftUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE + void OnIndentFirstLineUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT + void OnIndentRightUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE + void OnSpacingBeforeUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER + void OnSpacingAfterUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING + void OnLineSpacingSelected( wxCommandEvent& event ); + +////@end wxRichTextListStylePage event handler declarations + +////@begin wxRichTextListStylePage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextListStylePage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextListStylePage member variables + wxSpinCtrl* m_levelCtrl; + wxListBox* m_styleListBox; + wxCheckBox* m_periodCtrl; + wxCheckBox* m_parenthesesCtrl; + wxCheckBox* m_rightParenthesisCtrl; + wxComboBox* m_bulletAlignmentCtrl; + wxComboBox* m_symbolCtrl; + wxComboBox* m_symbolFontCtrl; + wxComboBox* m_bulletNameCtrl; + wxRadioButton* m_alignmentLeft; + wxRadioButton* m_alignmentRight; + wxRadioButton* m_alignmentJustified; + wxRadioButton* m_alignmentCentred; + wxRadioButton* m_alignmentIndeterminate; + wxTextCtrl* m_indentLeft; + wxTextCtrl* m_indentLeftFirst; + wxTextCtrl* m_indentRight; + wxTextCtrl* m_spacingBefore; + wxTextCtrl* m_spacingAfter; + wxComboBox* m_spacingLine; + wxRichTextCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTLISTSTYLEPAGE = 10616, + ID_RICHTEXTLISTSTYLEPAGE_LEVEL = 10617, + ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT = 10604, + ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK = 10618, + ID_RICHTEXTLISTSTYLEPAGE_BULLETS = 10619, + ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX = 10620, + ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627, + ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626, + ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL = 10602, + ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL = 10603, + ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC = 10621, + ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL = 10622, + ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL = 10623, + ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625, + ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC = 10600, + ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL = 10601, + ID_RICHTEXTLISTSTYLEPAGE_SPACING = 10628, + ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT = 10629, + ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT = 10630, + ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED = 10631, + ID_RICHTEXTLISTSTYLEPAGE_CENTERED = 10632, + ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE = 10633, + ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT = 10634, + ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE = 10635, + ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT = 10636, + ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE = 10637, + ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER = 10638, + ID_RICHTEXTLISTSTYLEPAGE_LINESPACING = 10639, + ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL = 10640 + }; +////@end wxRichTextListStylePage member variables + + bool m_dontUpdate; + int m_currentLevel; +}; + +#endif + // _RICHTEXTLISTSTYLEPAGE_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextprint.h b/Externals/wxWidgets/include/wx/richtext/richtextprint.h index 4cf0dbaf52..bbd7477eb3 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextprint.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextprint.h @@ -1,247 +1,247 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextprint.h -// Purpose: Rich text printing classes -// Author: Julian Smart -// Created: 2006-10-23 -// RCS-ID: $Id: richtextprint.h 43603 2006-11-22 17:11:53Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTPRINT_H_ -#define _WX_RICHTEXTPRINT_H_ - -#include "wx/defs.h" - -#if wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE - -#include "wx/richtext/richtextbuffer.h" - -#include "wx/print.h" -#include "wx/printdlg.h" - -#define wxRICHTEXT_PRINT_MAX_PAGES 99999 - -// Header/footer page identifiers -enum wxRichTextOddEvenPage { - wxRICHTEXT_PAGE_ODD, - wxRICHTEXT_PAGE_EVEN, - wxRICHTEXT_PAGE_ALL -}; - -// Header/footer text locations -enum wxRichTextPageLocation { - wxRICHTEXT_PAGE_LEFT, - wxRICHTEXT_PAGE_CENTRE, - wxRICHTEXT_PAGE_RIGHT -}; - -/*! - * Header/footer data - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextHeaderFooterData: public wxObject -{ -public: - wxRichTextHeaderFooterData() { Init(); } - wxRichTextHeaderFooterData(const wxRichTextHeaderFooterData& data): wxObject() { Copy(data); } - - /// Initialise - void Init() { m_headerMargin = 20; m_footerMargin = 20; m_showOnFirstPage = true; } - - /// Copy - void Copy(const wxRichTextHeaderFooterData& data); - - /// Assignment - void operator= (const wxRichTextHeaderFooterData& data) { Copy(data); } - - /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT - void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); - wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; - - /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT - void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); - wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; - - /// Set/get text - void SetText(const wxString& text, int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location); - wxString GetText(int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location) const; - - /// Set/get margins between text and header or footer, in tenths of a millimeter - void SetMargins(int headerMargin, int footerMargin) { m_headerMargin = headerMargin; m_footerMargin = footerMargin; } - int GetHeaderMargin() const { return m_headerMargin; } - int GetFooterMargin() const { return m_footerMargin; } - - /// Set/get whether to show header or footer on first page - void SetShowOnFirstPage(bool showOnFirstPage) { m_showOnFirstPage = showOnFirstPage; } - bool GetShowOnFirstPage() const { return m_showOnFirstPage; } - - /// Clear all text - void Clear(); - - /// Set/get font - void SetFont(const wxFont& font) { m_font = font; } - const wxFont& GetFont() const { return m_font; } - - /// Set/get colour - void SetTextColour(const wxColour& col) { m_colour = col; } - const wxColour& GetTextColour() const { return m_colour; } - - DECLARE_CLASS(wxRichTextHeaderFooterData) - -private: - - // Strings for left, centre, right, top, bottom, odd, even - wxString m_text[12]; - wxFont m_font; - wxColour m_colour; - int m_headerMargin; - int m_footerMargin; - bool m_showOnFirstPage; -}; - -/*! - * wxRichTextPrintout - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextPrintout : public wxPrintout -{ -public: - wxRichTextPrintout(const wxString& title = wxT("Printout")); - virtual ~wxRichTextPrintout(); - - /// The buffer to print - void SetRichTextBuffer(wxRichTextBuffer* buffer) { m_richTextBuffer = buffer; } - wxRichTextBuffer* GetRichTextBuffer() const { return m_richTextBuffer; } - - /// Set/get header/footer data - void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; } - const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; } - - /// Sets margins in 10ths of millimetre. Defaults to 1 inch for margins. - void SetMargins(int top = 252, int bottom = 252, int left = 252, int right = 252); - - /// Calculate scaling and rectangles, setting the device context scaling - void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& headerRect, wxRect& footerRect); - - // wxPrintout virtual functions - virtual bool OnPrintPage(int page); - virtual bool HasPage(int page); - virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); - virtual bool OnBeginDocument(int startPage, int endPage); - virtual void OnPreparePrinting(); - -private: - - /// Renders one page into dc - void RenderPage(wxDC *dc, int page); - - /// Substitute keywords - static bool SubstituteKeywords(wxString& str, const wxString& title, int pageNum, int pageCount); - -private: - - wxRichTextBuffer* m_richTextBuffer; - int m_numPages; - wxArrayInt m_pageBreaksStart; - wxArrayInt m_pageBreaksEnd; - int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom; - - wxRichTextHeaderFooterData m_headerFooterData; - - DECLARE_NO_COPY_CLASS(wxRichTextPrintout) -}; - -/* - *! wxRichTextPrinting - * A simple interface to perform wxRichTextBuffer printing. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextPrinting : public wxObject -{ -public: - wxRichTextPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); - virtual ~wxRichTextPrinting(); - - /// Preview the file or buffer - bool PreviewFile(const wxString& richTextFile); - bool PreviewBuffer(const wxRichTextBuffer& buffer); - - /// Print the file or buffer - bool PrintFile(const wxString& richTextFile); - bool PrintBuffer(const wxRichTextBuffer& buffer); - - /// Shows page setup dialog - void PageSetup(); - - /// Set/get header/footer data - void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; } - const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; } - - /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT - void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); - wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; - - /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT - void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); - wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; - - /// Show header/footer on first page, or not - void SetShowOnFirstPage(bool show) { m_headerFooterData.SetShowOnFirstPage(show); } - - /// Set the font - void SetHeaderFooterFont(const wxFont& font) { m_headerFooterData.SetFont(font); } - - /// Set the colour - void SetHeaderFooterTextColour(const wxColour& font) { m_headerFooterData.SetTextColour(font); } - - /// Get print and page setup data - wxPrintData *GetPrintData(); - wxPageSetupDialogData *GetPageSetupData() { return m_pageSetupData; } - - /// Set print and page setup data - void SetPrintData(const wxPrintData& printData); - void SetPageSetupData(const wxPageSetupData& pageSetupData); - - /// Set the rich text buffer pointer, deleting the existing object if present - void SetRichTextBufferPreview(wxRichTextBuffer* buf); - wxRichTextBuffer* GetRichTextBufferPreview() const { return m_richTextBufferPreview; } - - void SetRichTextBufferPrinting(wxRichTextBuffer* buf); - wxRichTextBuffer* GetRichTextBufferPrinting() const { return m_richTextBufferPrinting; } - - /// Set/get the parent window - void SetParentWindow(wxWindow* parent) { m_parentWindow = parent; } - wxWindow* GetParentWindow() const { return m_parentWindow; } - - /// Set/get the title - void SetTitle(const wxString& title) { m_title = title; } - const wxString& GetTitle() const { return m_title; } - - /// Set/get the preview rect - void SetPreviewRect(const wxRect& rect) { m_previewRect = rect; } - const wxRect& GetPreviewRect() const { return m_previewRect; } - -protected: - virtual wxRichTextPrintout *CreatePrintout(); - virtual bool DoPreview(wxRichTextPrintout *printout1, wxRichTextPrintout *printout2); - virtual bool DoPrint(wxRichTextPrintout *printout); - -private: - wxPrintData* m_printData; - wxPageSetupDialogData* m_pageSetupData; - - wxRichTextHeaderFooterData m_headerFooterData; - wxString m_title; - wxWindow* m_parentWindow; - wxRichTextBuffer* m_richTextBufferPreview; - wxRichTextBuffer* m_richTextBufferPrinting; - wxRect m_previewRect; - - DECLARE_NO_COPY_CLASS(wxRichTextPrinting) -}; - -#endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE - -#endif // _WX_RICHTEXTPRINT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextprint.h +// Purpose: Rich text printing classes +// Author: Julian Smart +// Created: 2006-10-23 +// RCS-ID: $Id: richtextprint.h 43603 2006-11-22 17:11:53Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTPRINT_H_ +#define _WX_RICHTEXTPRINT_H_ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE + +#include "wx/richtext/richtextbuffer.h" + +#include "wx/print.h" +#include "wx/printdlg.h" + +#define wxRICHTEXT_PRINT_MAX_PAGES 99999 + +// Header/footer page identifiers +enum wxRichTextOddEvenPage { + wxRICHTEXT_PAGE_ODD, + wxRICHTEXT_PAGE_EVEN, + wxRICHTEXT_PAGE_ALL +}; + +// Header/footer text locations +enum wxRichTextPageLocation { + wxRICHTEXT_PAGE_LEFT, + wxRICHTEXT_PAGE_CENTRE, + wxRICHTEXT_PAGE_RIGHT +}; + +/*! + * Header/footer data + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextHeaderFooterData: public wxObject +{ +public: + wxRichTextHeaderFooterData() { Init(); } + wxRichTextHeaderFooterData(const wxRichTextHeaderFooterData& data): wxObject() { Copy(data); } + + /// Initialise + void Init() { m_headerMargin = 20; m_footerMargin = 20; m_showOnFirstPage = true; } + + /// Copy + void Copy(const wxRichTextHeaderFooterData& data); + + /// Assignment + void operator= (const wxRichTextHeaderFooterData& data) { Copy(data); } + + /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Set/get text + void SetText(const wxString& text, int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location); + wxString GetText(int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location) const; + + /// Set/get margins between text and header or footer, in tenths of a millimeter + void SetMargins(int headerMargin, int footerMargin) { m_headerMargin = headerMargin; m_footerMargin = footerMargin; } + int GetHeaderMargin() const { return m_headerMargin; } + int GetFooterMargin() const { return m_footerMargin; } + + /// Set/get whether to show header or footer on first page + void SetShowOnFirstPage(bool showOnFirstPage) { m_showOnFirstPage = showOnFirstPage; } + bool GetShowOnFirstPage() const { return m_showOnFirstPage; } + + /// Clear all text + void Clear(); + + /// Set/get font + void SetFont(const wxFont& font) { m_font = font; } + const wxFont& GetFont() const { return m_font; } + + /// Set/get colour + void SetTextColour(const wxColour& col) { m_colour = col; } + const wxColour& GetTextColour() const { return m_colour; } + + DECLARE_CLASS(wxRichTextHeaderFooterData) + +private: + + // Strings for left, centre, right, top, bottom, odd, even + wxString m_text[12]; + wxFont m_font; + wxColour m_colour; + int m_headerMargin; + int m_footerMargin; + bool m_showOnFirstPage; +}; + +/*! + * wxRichTextPrintout + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPrintout : public wxPrintout +{ +public: + wxRichTextPrintout(const wxString& title = wxT("Printout")); + virtual ~wxRichTextPrintout(); + + /// The buffer to print + void SetRichTextBuffer(wxRichTextBuffer* buffer) { m_richTextBuffer = buffer; } + wxRichTextBuffer* GetRichTextBuffer() const { return m_richTextBuffer; } + + /// Set/get header/footer data + void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; } + const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; } + + /// Sets margins in 10ths of millimetre. Defaults to 1 inch for margins. + void SetMargins(int top = 252, int bottom = 252, int left = 252, int right = 252); + + /// Calculate scaling and rectangles, setting the device context scaling + void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& headerRect, wxRect& footerRect); + + // wxPrintout virtual functions + virtual bool OnPrintPage(int page); + virtual bool HasPage(int page); + virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); + virtual bool OnBeginDocument(int startPage, int endPage); + virtual void OnPreparePrinting(); + +private: + + /// Renders one page into dc + void RenderPage(wxDC *dc, int page); + + /// Substitute keywords + static bool SubstituteKeywords(wxString& str, const wxString& title, int pageNum, int pageCount); + +private: + + wxRichTextBuffer* m_richTextBuffer; + int m_numPages; + wxArrayInt m_pageBreaksStart; + wxArrayInt m_pageBreaksEnd; + int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom; + + wxRichTextHeaderFooterData m_headerFooterData; + + DECLARE_NO_COPY_CLASS(wxRichTextPrintout) +}; + +/* + *! wxRichTextPrinting + * A simple interface to perform wxRichTextBuffer printing. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPrinting : public wxObject +{ +public: + wxRichTextPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); + virtual ~wxRichTextPrinting(); + + /// Preview the file or buffer + bool PreviewFile(const wxString& richTextFile); + bool PreviewBuffer(const wxRichTextBuffer& buffer); + + /// Print the file or buffer + bool PrintFile(const wxString& richTextFile); + bool PrintBuffer(const wxRichTextBuffer& buffer); + + /// Shows page setup dialog + void PageSetup(); + + /// Set/get header/footer data + void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; } + const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; } + + /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Show header/footer on first page, or not + void SetShowOnFirstPage(bool show) { m_headerFooterData.SetShowOnFirstPage(show); } + + /// Set the font + void SetHeaderFooterFont(const wxFont& font) { m_headerFooterData.SetFont(font); } + + /// Set the colour + void SetHeaderFooterTextColour(const wxColour& font) { m_headerFooterData.SetTextColour(font); } + + /// Get print and page setup data + wxPrintData *GetPrintData(); + wxPageSetupDialogData *GetPageSetupData() { return m_pageSetupData; } + + /// Set print and page setup data + void SetPrintData(const wxPrintData& printData); + void SetPageSetupData(const wxPageSetupData& pageSetupData); + + /// Set the rich text buffer pointer, deleting the existing object if present + void SetRichTextBufferPreview(wxRichTextBuffer* buf); + wxRichTextBuffer* GetRichTextBufferPreview() const { return m_richTextBufferPreview; } + + void SetRichTextBufferPrinting(wxRichTextBuffer* buf); + wxRichTextBuffer* GetRichTextBufferPrinting() const { return m_richTextBufferPrinting; } + + /// Set/get the parent window + void SetParentWindow(wxWindow* parent) { m_parentWindow = parent; } + wxWindow* GetParentWindow() const { return m_parentWindow; } + + /// Set/get the title + void SetTitle(const wxString& title) { m_title = title; } + const wxString& GetTitle() const { return m_title; } + + /// Set/get the preview rect + void SetPreviewRect(const wxRect& rect) { m_previewRect = rect; } + const wxRect& GetPreviewRect() const { return m_previewRect; } + +protected: + virtual wxRichTextPrintout *CreatePrintout(); + virtual bool DoPreview(wxRichTextPrintout *printout1, wxRichTextPrintout *printout2); + virtual bool DoPrint(wxRichTextPrintout *printout); + +private: + wxPrintData* m_printData; + wxPageSetupDialogData* m_pageSetupData; + + wxRichTextHeaderFooterData m_headerFooterData; + wxString m_title; + wxWindow* m_parentWindow; + wxRichTextBuffer* m_richTextBufferPreview; + wxRichTextBuffer* m_richTextBufferPrinting; + wxRect m_previewRect; + + DECLARE_NO_COPY_CLASS(wxRichTextPrinting) +}; + +#endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_RICHTEXTPRINT_H_ + diff --git a/Externals/wxWidgets/include/wx/richtext/richtextstyledlg.h b/Externals/wxWidgets/include/wx/richtext/richtextstyledlg.h index fdad166ad7..5b5bcff769 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextstyledlg.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextstyledlg.h @@ -1,241 +1,241 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextstyledlg.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/5/2006 12:05:31 PM -// RCS-ID: $Id: richtextstyledlg.h 52117 2008-02-26 15:04:54Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTSTYLEDLG_H_ -#define _RICHTEXTSTYLEDLG_H_ - -/*! - * Includes - */ - -////@begin includes -////@end includes - -#include "wx/richtext/richtextbuffer.h" -#include "wx/richtext/richtextstyles.h" -#include "wx/richtext/richtextctrl.h" - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxBoxSizer; -class wxRichTextStyleListCtrl; -class wxRichTextCtrl; -////@end forward declarations - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxCheckBox; - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX -#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE _("Style Organiser") -#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG -#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * Flags for specifying permitted operations - */ - -#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001 -#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002 -#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004 -#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008 -#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010 -#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020 -#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040 - -// The permitted style types to show -#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100 -#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200 -#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400 -#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x0800 - -// Common combinations -#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES) -#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL) -#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER) - -/*! - * wxRichTextStyleOrganiserDialog class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextStyleOrganiserDialog( ); - wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); - - /// Creation - bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - - /// Initialise member variables - void Init(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Set/get style sheet - void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; } - wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; } - - /// Set/get control - void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } - wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } - - /// Set/get flags - void SetFlags(int flags) { m_flags = flags; } - int GetFlags() const { return m_flags; } - - /// Show preview for given or selected preview - void ShowPreview(int sel = -1); - - /// Clears the preview - void ClearPreview(); - - /// List selection - void OnListSelection(wxCommandEvent& event); - - /// Get/set restart numbering boolean - bool GetRestartNumbering() const { return m_restartNumbering; } - void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; } - - /// Get selected style name or definition - wxString GetSelectedStyle() const; - wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; - - /// Apply the style - bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); - - /// Should we show tooltips? - static bool ShowToolTips() { return sm_showToolTips; } - - /// Determines whether tooltips will be shown - static void SetShowToolTips(bool show) { sm_showToolTips = show; } - -////@begin wxRichTextStyleOrganiserDialog event handler declarations - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR - void OnNewCharClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR - void OnNewCharUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA - void OnNewParaClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA - void OnNewParaUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST - void OnNewListClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST - void OnNewListUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY - void OnApplyClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY - void OnApplyUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME - void OnRenameClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME - void OnRenameUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT - void OnEditClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT - void OnEditUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE - void OnDeleteClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE - void OnDeleteUpdate( wxUpdateUIEvent& event ); - -////@end wxRichTextStyleOrganiserDialog event handler declarations - -////@begin wxRichTextStyleOrganiserDialog member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextStyleOrganiserDialog member function declarations - -////@begin wxRichTextStyleOrganiserDialog member variables - wxBoxSizer* m_innerSizer; - wxBoxSizer* m_buttonSizerParent; - wxRichTextStyleListCtrl* m_stylesListBox; - wxRichTextCtrl* m_previewCtrl; - wxBoxSizer* m_buttonSizer; - wxButton* m_newCharacter; - wxButton* m_newParagraph; - wxButton* m_newList; - wxButton* m_applyStyle; - wxButton* m_renameStyle; - wxButton* m_editStyle; - wxButton* m_deleteStyle; - wxButton* m_closeButton; - wxBoxSizer* m_bottomButtonSizer; - wxCheckBox* m_restartNumberingCtrl; - wxButton* m_okButton; - wxButton* m_cancelButton; - /// Control identifiers - enum { - ID_RICHTEXTSTYLEORGANISERDIALOG = 10500, - ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501, - ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510, - ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509, - ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504, - ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505, - ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508, - ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503, - ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502, - ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506, - ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507, - ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511 - }; -////@end wxRichTextStyleOrganiserDialog member variables - -private: - - wxRichTextCtrl* m_richTextCtrl; - wxRichTextStyleSheet* m_richTextStyleSheet; - - bool m_dontUpdate; - int m_flags; - static bool sm_showToolTips; - bool m_restartNumbering; -}; - -#endif - // _RICHTEXTSTYLEDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextstyledlg.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/5/2006 12:05:31 PM +// RCS-ID: $Id: richtextstyledlg.h 52117 2008-02-26 15:04:54Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSTYLEDLG_H_ +#define _RICHTEXTSTYLEDLG_H_ + +/*! + * Includes + */ + +////@begin includes +////@end includes + +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextstyles.h" +#include "wx/richtext/richtextctrl.h" + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxBoxSizer; +class wxRichTextStyleListCtrl; +class wxRichTextCtrl; +////@end forward declarations + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE _("Style Organiser") +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * Flags for specifying permitted operations + */ + +#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001 +#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002 +#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004 +#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008 +#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010 +#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020 +#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040 + +// The permitted style types to show +#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100 +#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200 +#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400 +#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x0800 + +// Common combinations +#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES) +#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL) +#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER) + +/*! + * wxRichTextStyleOrganiserDialog class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextStyleOrganiserDialog( ); + wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); + + /// Creation + bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /// Initialise member variables + void Init(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Set/get style sheet + void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; } + wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; } + + /// Set/get control + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } + wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } + + /// Set/get flags + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + /// Show preview for given or selected preview + void ShowPreview(int sel = -1); + + /// Clears the preview + void ClearPreview(); + + /// List selection + void OnListSelection(wxCommandEvent& event); + + /// Get/set restart numbering boolean + bool GetRestartNumbering() const { return m_restartNumbering; } + void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; } + + /// Get selected style name or definition + wxString GetSelectedStyle() const; + wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; + + /// Apply the style + bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); + + /// Should we show tooltips? + static bool ShowToolTips() { return sm_showToolTips; } + + /// Determines whether tooltips will be shown + static void SetShowToolTips(bool show) { sm_showToolTips = show; } + +////@begin wxRichTextStyleOrganiserDialog event handler declarations + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR + void OnNewCharClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR + void OnNewCharUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA + void OnNewParaClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA + void OnNewParaUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST + void OnNewListClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST + void OnNewListUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY + void OnApplyClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY + void OnApplyUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME + void OnRenameClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME + void OnRenameUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT + void OnEditClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT + void OnEditUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE + void OnDeleteClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE + void OnDeleteUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextStyleOrganiserDialog event handler declarations + +////@begin wxRichTextStyleOrganiserDialog member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextStyleOrganiserDialog member function declarations + +////@begin wxRichTextStyleOrganiserDialog member variables + wxBoxSizer* m_innerSizer; + wxBoxSizer* m_buttonSizerParent; + wxRichTextStyleListCtrl* m_stylesListBox; + wxRichTextCtrl* m_previewCtrl; + wxBoxSizer* m_buttonSizer; + wxButton* m_newCharacter; + wxButton* m_newParagraph; + wxButton* m_newList; + wxButton* m_applyStyle; + wxButton* m_renameStyle; + wxButton* m_editStyle; + wxButton* m_deleteStyle; + wxButton* m_closeButton; + wxBoxSizer* m_bottomButtonSizer; + wxCheckBox* m_restartNumberingCtrl; + wxButton* m_okButton; + wxButton* m_cancelButton; + /// Control identifiers + enum { + ID_RICHTEXTSTYLEORGANISERDIALOG = 10500, + ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501, + ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510, + ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508, + ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503, + ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502, + ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506, + ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507, + ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511 + }; +////@end wxRichTextStyleOrganiserDialog member variables + +private: + + wxRichTextCtrl* m_richTextCtrl; + wxRichTextStyleSheet* m_richTextStyleSheet; + + bool m_dontUpdate; + int m_flags; + static bool sm_showToolTips; + bool m_restartNumbering; +}; + +#endif + // _RICHTEXTSTYLEDLG_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextstylepage.h b/Externals/wxWidgets/include/wx/richtext/richtextstylepage.h index 64f2d66390..73b0184990 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextstylepage.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextstylepage.h @@ -1,91 +1,91 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextstylepage.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/5/2006 11:34:55 AM -// RCS-ID: $Id: richtextstylepage.h 42678 2006-10-29 22:01:06Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTSTYLEPAGE_H_ -#define _RICHTEXTSTYLEPAGE_H_ - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL -#define SYMBOL_WXRICHTEXTSTYLEPAGE_TITLE _("wxRichTextStylePage") -#define SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME ID_RICHTEXTSTYLEPAGE -#define SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * wxRichTextStylePage class declaration - */ - -class wxRichTextStylePage: public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxRichTextStylePage ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextStylePage( ); - wxRichTextStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); - - /// Initialise members - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Gets the attributes associated with the main formatting dialog - wxTextAttrEx* GetAttributes(); - -////@begin wxRichTextStylePage event handler declarations - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEPAGE_NEXT_STYLE - void OnNextStyleUpdate( wxUpdateUIEvent& event ); - -////@end wxRichTextStylePage event handler declarations - -////@begin wxRichTextStylePage member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextStylePage member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin wxRichTextStylePage member variables - wxTextCtrl* m_styleName; - wxComboBox* m_basedOn; - wxComboBox* m_nextStyle; - /// Control identifiers - enum { - ID_RICHTEXTSTYLEPAGE = 10403, - ID_RICHTEXTSTYLEPAGE_STYLE_NAME = 10404, - ID_RICHTEXTSTYLEPAGE_BASED_ON = 10405, - ID_RICHTEXTSTYLEPAGE_NEXT_STYLE = 10406 - }; -////@end wxRichTextStylePage member variables -}; - -#endif - // _RICHTEXTSTYLEPAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextstylepage.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/5/2006 11:34:55 AM +// RCS-ID: $Id: richtextstylepage.h 42678 2006-10-29 22:01:06Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSTYLEPAGE_H_ +#define _RICHTEXTSTYLEPAGE_H_ + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTSTYLEPAGE_TITLE _("wxRichTextStylePage") +#define SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME ID_RICHTEXTSTYLEPAGE +#define SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextStylePage class declaration + */ + +class wxRichTextStylePage: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( wxRichTextStylePage ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextStylePage( ); + wxRichTextStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Gets the attributes associated with the main formatting dialog + wxTextAttrEx* GetAttributes(); + +////@begin wxRichTextStylePage event handler declarations + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEPAGE_NEXT_STYLE + void OnNextStyleUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextStylePage event handler declarations + +////@begin wxRichTextStylePage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextStylePage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextStylePage member variables + wxTextCtrl* m_styleName; + wxComboBox* m_basedOn; + wxComboBox* m_nextStyle; + /// Control identifiers + enum { + ID_RICHTEXTSTYLEPAGE = 10403, + ID_RICHTEXTSTYLEPAGE_STYLE_NAME = 10404, + ID_RICHTEXTSTYLEPAGE_BASED_ON = 10405, + ID_RICHTEXTSTYLEPAGE_NEXT_STYLE = 10406 + }; +////@end wxRichTextStylePage member variables +}; + +#endif + // _RICHTEXTSTYLEPAGE_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextstyles.h b/Externals/wxWidgets/include/wx/richtext/richtextstyles.h index 328813dc86..158e8a585b 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextstyles.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextstyles.h @@ -1,683 +1,683 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextstyles.h -// Purpose: Style management for wxRichTextCtrl -// Author: Julian Smart -// Modified by: -// Created: 2005-09-30 -// RCS-ID: $Id: richtextstyles.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTSTYLES_H_ -#define _WX_RICHTEXTSTYLES_H_ - -/*! - * Includes - */ - -#include "wx/defs.h" - -#if wxUSE_RICHTEXT - -#include "wx/richtext/richtextbuffer.h" - -#if wxUSE_HTML -#include "wx/htmllbox.h" -#endif - -#if wxUSE_COMBOCTRL -#include "wx/combo.h" -#endif - -#include "wx/choice.h" - -/*! - * Forward declarations - */ - -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; -class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer; - -/*! - * wxRichTextStyleDefinition class declaration - * A base class for paragraph and character styles. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject -{ - DECLARE_CLASS(wxRichTextStyleDefinition) -public: - - /// Copy constructors - wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def) - : wxObject() - { - Init(); - Copy(def); - } - - /// Default constructor - wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; } - - /// Destructor - virtual ~wxRichTextStyleDefinition() {} - - /// Initialises members - void Init() {} - - /// Copies from def - void Copy(const wxRichTextStyleDefinition& def); - - /// Equality test - bool Eq(const wxRichTextStyleDefinition& def) const; - - /// Assignment operator - void operator =(const wxRichTextStyleDefinition& def) { Copy(def); } - - /// Equality operator - bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); } - - /// Override to clone the object - virtual wxRichTextStyleDefinition* Clone() const = 0; - - /// Sets and gets the name of the style - void SetName(const wxString& name) { m_name = name; } - const wxString& GetName() const { return m_name; } - - /// Sets and gets the style description - void SetDescription(const wxString& descr) { m_description = descr; } - const wxString& GetDescription() const { return m_description; } - - /// Sets and gets the name of the style that this style is based on - void SetBaseStyle(const wxString& name) { m_baseStyle = name; } - const wxString& GetBaseStyle() const { return m_baseStyle; } - - /// Sets and gets the style - void SetStyle(const wxRichTextAttr& style) { m_style = style; } - const wxRichTextAttr& GetStyle() const { return m_style; } - wxRichTextAttr& GetStyle() { return m_style; } - - /// Gets the style combined with the base style - virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const; - -protected: - wxString m_name; - wxString m_baseStyle; - wxString m_description; - wxRichTextAttr m_style; -}; - -/*! - * wxRichTextCharacterStyleDefinition class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition -{ - DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition) -public: - - /// Copy constructor - wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition& def): wxRichTextStyleDefinition(def) {} - - /// Default constructor - wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString): - wxRichTextStyleDefinition(name) {} - - /// Destructor - virtual ~wxRichTextCharacterStyleDefinition() {} - - /// Clones the object - virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); } - -protected: -}; - -/*! - * wxRichTextParagraphStyleDefinition class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition -{ - DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition) -public: - - /// Copy constructor - wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; } - - /// Default constructor - wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString): - wxRichTextStyleDefinition(name) {} - - // Destructor - virtual ~wxRichTextParagraphStyleDefinition() {} - - /// Sets and gets the next style - void SetNextStyle(const wxString& name) { m_nextStyle = name; } - const wxString& GetNextStyle() const { return m_nextStyle; } - - /// Copies from def - void Copy(const wxRichTextParagraphStyleDefinition& def); - - /// Assignment operator - void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); } - - /// Equality operator - bool operator ==(const wxRichTextParagraphStyleDefinition& def) const; - - /// Clones the object - virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); } - -protected: - - /// The next style to use when adding a paragraph after this style. - wxString m_nextStyle; -}; - -/*! - * wxRichTextListStyleDefinition class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition -{ - DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition) -public: - - /// Copy constructor - wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); } - - /// Default constructor - wxRichTextListStyleDefinition(const wxString& name = wxEmptyString): - wxRichTextParagraphStyleDefinition(name) { Init(); } - - /// Destructor - virtual ~wxRichTextListStyleDefinition() {} - - /// Copies from def - void Copy(const wxRichTextListStyleDefinition& def); - - /// Assignment operator - void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); } - - /// Equality operator - bool operator ==(const wxRichTextListStyleDefinition& def) const; - - /// Clones the object - virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); } - - /// Sets/gets the attributes for the given level - void SetLevelAttributes(int i, const wxRichTextAttr& attr); - wxRichTextAttr* GetLevelAttributes(int i); - const wxRichTextAttr* GetLevelAttributes(int i) const; - - /// Convenience function for setting the major attributes for a list level specification - void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString); - - /// Finds the level corresponding to the given indentation - int FindLevelForIndent(int indent) const; - - /// Combine the base and list style with a paragraph style, using the given indent (from which - /// an appropriate level is found) - wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL); - - /// Combine the base and list style, using the given indent (from which - /// an appropriate level is found) - wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL); - - /// Combine the base and list style, using the given level from which - /// an appropriate level is found) - wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL); - - /// Gets the number of available levels - int GetLevelCount() const { return 10; } - - /// Is this a numbered list? - bool IsNumbered(int i) const; - -protected: - - /// The styles for each level (up to 10) - wxRichTextAttr m_levelStyles[10]; -}; - -/*! - * The style sheet - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject -{ - DECLARE_CLASS( wxRichTextStyleSheet ) - -public: - /// Constructors - wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet) - : wxObject() - { - Init(); - Copy(sheet); - } - wxRichTextStyleSheet() { Init(); } - virtual ~wxRichTextStyleSheet(); - - /// Initialisation - void Init(); - - /// Copy - void Copy(const wxRichTextStyleSheet& sheet); - - /// Assignment - void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); } - - /// Equality - bool operator==(const wxRichTextStyleSheet& sheet) const; - - /// Add a definition to the character style list - bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def); - - /// Add a definition to the paragraph style list - bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def); - - /// Add a definition to the list style list - bool AddListStyle(wxRichTextListStyleDefinition* def); - - /// Add a definition to the appropriate style list - bool AddStyle(wxRichTextStyleDefinition* def); - - /// Remove a character style - bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); } - - /// Remove a paragraph style - bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); } - - /// Remove a list style - bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); } - - /// Remove a style - bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false); - - /// Find a character definition by name - wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); } - - /// Find a paragraph definition by name - wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); } - - /// Find a list definition by name - wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); } - - /// Find any definition by name - wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const; - - /// Return the number of character styles - size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); } - - /// Return the number of paragraph styles - size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); } - - /// Return the number of list styles - size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); } - - /// Return the nth character style - wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); } - - /// Return the nth paragraph style - wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); } - - /// Return the nth list style - wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); } - - /// Delete all styles - void DeleteStyles(); - - /// Insert into list of style sheets - bool InsertSheet(wxRichTextStyleSheet* before); - - /// Append to list of style sheets - bool AppendSheet(wxRichTextStyleSheet* after); - - /// Unlink from the list of style sheets - void Unlink(); - - /// Get/set next sheet - wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; } - void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; } - - /// Get/set previous sheet - wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; } - void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; } - - /// Sets and gets the name of the style sheet - void SetName(const wxString& name) { m_name = name; } - const wxString& GetName() const { return m_name; } - - /// Sets and gets the style description - void SetDescription(const wxString& descr) { m_description = descr; } - const wxString& GetDescription() const { return m_description; } - -/// Implementation - - /// Add a definition to one of the style lists - bool AddStyle(wxList& list, wxRichTextStyleDefinition* def); - - /// Remove a style - bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle); - - /// Find a definition by name - wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const; - -protected: - - wxString m_description; - wxString m_name; - - wxList m_characterStyleDefinitions; - wxList m_paragraphStyleDefinitions; - wxList m_listStyleDefinitions; - - wxRichTextStyleSheet* m_previousSheet; - wxRichTextStyleSheet* m_nextSheet; -}; - -#if wxUSE_HTML -/*! - * wxRichTextStyleListBox class declaration - * A listbox to display styles. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox -{ - DECLARE_CLASS(wxRichTextStyleListBox) - DECLARE_EVENT_TABLE() - -public: - /// Which type of style definition is currently showing? - enum wxRichTextStyleType - { - wxRICHTEXT_STYLE_ALL, - wxRICHTEXT_STYLE_PARAGRAPH, - wxRICHTEXT_STYLE_CHARACTER, - wxRICHTEXT_STYLE_LIST - }; - - wxRichTextStyleListBox() - { - Init(); - } - wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - virtual ~wxRichTextStyleListBox(); - - void Init() - { - m_styleSheet = NULL; - m_richTextCtrl = NULL; - m_applyOnSelection = false; - m_styleType = wxRICHTEXT_STYLE_PARAGRAPH; - m_autoSetSelection = true; - } - - bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - - /// Creates a suitable HTML fragment for a definition - wxString CreateHTML(wxRichTextStyleDefinition* def) const; - - /// Associates the control with a style sheet - void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; } - wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } - - /// Associates the control with a wxRichTextCtrl - void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } - wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } - - /// Get style for index - wxRichTextStyleDefinition* GetStyle(size_t i) const ; - - /// Get index for style name - int GetIndexForStyle(const wxString& name) const ; - - /// Set selection for string, returning the index. - int SetStyleSelection(const wxString& name); - - /// Updates the list - void UpdateStyles(); - - /// Apply the style - void ApplyStyle(int i); - - /// Left click - void OnLeftDown(wxMouseEvent& event); - - /// Left double-click - void OnLeftDoubleClick(wxMouseEvent& event); - - /// Auto-select from style under caret in idle time - void OnIdle(wxIdleEvent& event); - - /// Convert units in tends of a millimetre to device units - int ConvertTenthsMMToPixels(wxDC& dc, int units) const; - - /// Can we set the selection based on the editor caret position? - /// Need to override this if being used in a combobox popup - virtual bool CanAutoSetSelection() { return m_autoSetSelection; } - virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; } - - /// Set whether the style should be applied as soon as the item is selected (the default) - void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; } - bool GetApplyOnSelection() const { return m_applyOnSelection; } - - /// Set the style type to display - void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); } - wxRichTextStyleType GetStyleType() const { return m_styleType; } - - /// Helper for listbox and combo control - static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType); - -protected: - /// Returns the HTML for this item - virtual wxString OnGetItem(size_t n) const; - -private: - - wxRichTextStyleSheet* m_styleSheet; - wxRichTextCtrl* m_richTextCtrl; - bool m_applyOnSelection; // if true, applies style on selection - wxRichTextStyleType m_styleType; // style type to display - bool m_autoSetSelection; - wxArrayString m_styleNames; -}; - -/*! - * wxRichTextStyleListCtrl class declaration - * This is a container for the list control plus a combobox to switch between - * style types. - */ - -#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000 - -class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl -{ - DECLARE_CLASS(wxRichTextStyleListCtrl) - DECLARE_EVENT_TABLE() - -public: - - /// Constructors - wxRichTextStyleListCtrl() - { - Init(); - } - - wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - - /// Constructors - virtual ~wxRichTextStyleListCtrl(); - - /// Member initialisation - void Init() - { - m_styleListBox = NULL; - m_styleChoice = NULL; - m_dontUpdate = false; - } - - /// Creates the windows - bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - - /// Updates the style list box - void UpdateStyles(); - - /// Associates the control with a style sheet - void SetStyleSheet(wxRichTextStyleSheet* styleSheet); - wxRichTextStyleSheet* GetStyleSheet() const; - - /// Associates the control with a wxRichTextCtrl - void SetRichTextCtrl(wxRichTextCtrl* ctrl); - wxRichTextCtrl* GetRichTextCtrl() const; - - /// Set/get the style type to display - void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType); - wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const; - - /// Get the choice index for style type - int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType); - - /// Get the style type for choice index - wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i); - - /// Get the listbox - wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; } - - /// Get the choice - wxChoice* GetStyleChoice() const { return m_styleChoice; } - - /// React to style type choice - void OnChooseType(wxCommandEvent& event); - - /// Lay out the controls - void OnSize(wxSizeEvent& event); - -private: - - wxRichTextStyleListBox* m_styleListBox; - wxChoice* m_styleChoice; - bool m_dontUpdate; -}; - -#if wxUSE_COMBOCTRL - -/*! - * Style drop-down for a wxComboCtrl - */ - -class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup -{ -public: - virtual void Init() - { - m_itemHere = -1; // hot item in list - m_value = -1; - } - - virtual bool Create( wxWindow* parent ) - { - return wxRichTextStyleListBox::Create(parent, wxID_ANY, - wxPoint(0,0), wxDefaultSize, - wxSIMPLE_BORDER); - } - - virtual wxWindow *GetControl() { return this; } - - virtual void SetStringValue( const wxString& s ); - - virtual wxString GetStringValue() const; - - /// Can we set the selection based on the editor caret position? - // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); } - virtual bool CanAutoSetSelection() { return false; } - - // - // Popup event handlers - // - - // Mouse hot-tracking - void OnMouseMove(wxMouseEvent& event); - - // On mouse left, set the value and close the popup - void OnMouseClick(wxMouseEvent& WXUNUSED(event)); - -protected: - - int m_itemHere; // hot item in popup - int m_value; - -private: - DECLARE_EVENT_TABLE() -}; - -/*! - * wxRichTextStyleComboCtrl - * A combo for applying styles. - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl -{ - DECLARE_CLASS(wxRichTextStyleComboCtrl) - DECLARE_EVENT_TABLE() - -public: - wxRichTextStyleComboCtrl() - { - Init(); - } - - wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxCB_READONLY) - { - Init(); - Create(parent, id, pos, size, style); - } - - virtual ~wxRichTextStyleComboCtrl() {} - - void Init() - { - m_stylePopup = NULL; - } - - bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - - /// Updates the list - void UpdateStyles() { m_stylePopup->UpdateStyles(); } - - /// Associates the control with a style sheet - void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); } - wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); } - - /// Associates the control with a wxRichTextCtrl - void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); } - wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); } - - /// Gets the style popup - wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; } - - /// Auto-select from style under caret in idle time - void OnIdle(wxIdleEvent& event); - -protected: - wxRichTextStyleComboPopup* m_stylePopup; -}; - -#endif - // wxUSE_COMBOCTRL - -#endif - // wxUSE_HTML - -#endif - // wxUSE_RICHTEXT - -#endif - // _WX_RICHTEXTSTYLES_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextstyles.h +// Purpose: Style management for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// RCS-ID: $Id: richtextstyles.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTSTYLES_H_ +#define _WX_RICHTEXTSTYLES_H_ + +/*! + * Includes + */ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT + +#include "wx/richtext/richtextbuffer.h" + +#if wxUSE_HTML +#include "wx/htmllbox.h" +#endif + +#if wxUSE_COMBOCTRL +#include "wx/combo.h" +#endif + +#include "wx/choice.h" + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer; + +/*! + * wxRichTextStyleDefinition class declaration + * A base class for paragraph and character styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject +{ + DECLARE_CLASS(wxRichTextStyleDefinition) +public: + + /// Copy constructors + wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def) + : wxObject() + { + Init(); + Copy(def); + } + + /// Default constructor + wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; } + + /// Destructor + virtual ~wxRichTextStyleDefinition() {} + + /// Initialises members + void Init() {} + + /// Copies from def + void Copy(const wxRichTextStyleDefinition& def); + + /// Equality test + bool Eq(const wxRichTextStyleDefinition& def) const; + + /// Assignment operator + void operator =(const wxRichTextStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); } + + /// Override to clone the object + virtual wxRichTextStyleDefinition* Clone() const = 0; + + /// Sets and gets the name of the style + void SetName(const wxString& name) { m_name = name; } + const wxString& GetName() const { return m_name; } + + /// Sets and gets the style description + void SetDescription(const wxString& descr) { m_description = descr; } + const wxString& GetDescription() const { return m_description; } + + /// Sets and gets the name of the style that this style is based on + void SetBaseStyle(const wxString& name) { m_baseStyle = name; } + const wxString& GetBaseStyle() const { return m_baseStyle; } + + /// Sets and gets the style + void SetStyle(const wxRichTextAttr& style) { m_style = style; } + const wxRichTextAttr& GetStyle() const { return m_style; } + wxRichTextAttr& GetStyle() { return m_style; } + + /// Gets the style combined with the base style + virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const; + +protected: + wxString m_name; + wxString m_baseStyle; + wxString m_description; + wxRichTextAttr m_style; +}; + +/*! + * wxRichTextCharacterStyleDefinition class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition +{ + DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition) +public: + + /// Copy constructor + wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition& def): wxRichTextStyleDefinition(def) {} + + /// Default constructor + wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextStyleDefinition(name) {} + + /// Destructor + virtual ~wxRichTextCharacterStyleDefinition() {} + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); } + +protected: +}; + +/*! + * wxRichTextParagraphStyleDefinition class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition +{ + DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition) +public: + + /// Copy constructor + wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; } + + /// Default constructor + wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextStyleDefinition(name) {} + + // Destructor + virtual ~wxRichTextParagraphStyleDefinition() {} + + /// Sets and gets the next style + void SetNextStyle(const wxString& name) { m_nextStyle = name; } + const wxString& GetNextStyle() const { return m_nextStyle; } + + /// Copies from def + void Copy(const wxRichTextParagraphStyleDefinition& def); + + /// Assignment operator + void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextParagraphStyleDefinition& def) const; + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); } + +protected: + + /// The next style to use when adding a paragraph after this style. + wxString m_nextStyle; +}; + +/*! + * wxRichTextListStyleDefinition class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition +{ + DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition) +public: + + /// Copy constructor + wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); } + + /// Default constructor + wxRichTextListStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextParagraphStyleDefinition(name) { Init(); } + + /// Destructor + virtual ~wxRichTextListStyleDefinition() {} + + /// Copies from def + void Copy(const wxRichTextListStyleDefinition& def); + + /// Assignment operator + void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextListStyleDefinition& def) const; + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); } + + /// Sets/gets the attributes for the given level + void SetLevelAttributes(int i, const wxRichTextAttr& attr); + wxRichTextAttr* GetLevelAttributes(int i); + const wxRichTextAttr* GetLevelAttributes(int i) const; + + /// Convenience function for setting the major attributes for a list level specification + void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString); + + /// Finds the level corresponding to the given indentation + int FindLevelForIndent(int indent) const; + + /// Combine the base and list style with a paragraph style, using the given indent (from which + /// an appropriate level is found) + wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL); + + /// Combine the base and list style, using the given indent (from which + /// an appropriate level is found) + wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL); + + /// Combine the base and list style, using the given level from which + /// an appropriate level is found) + wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL); + + /// Gets the number of available levels + int GetLevelCount() const { return 10; } + + /// Is this a numbered list? + bool IsNumbered(int i) const; + +protected: + + /// The styles for each level (up to 10) + wxRichTextAttr m_levelStyles[10]; +}; + +/*! + * The style sheet + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject +{ + DECLARE_CLASS( wxRichTextStyleSheet ) + +public: + /// Constructors + wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet) + : wxObject() + { + Init(); + Copy(sheet); + } + wxRichTextStyleSheet() { Init(); } + virtual ~wxRichTextStyleSheet(); + + /// Initialisation + void Init(); + + /// Copy + void Copy(const wxRichTextStyleSheet& sheet); + + /// Assignment + void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); } + + /// Equality + bool operator==(const wxRichTextStyleSheet& sheet) const; + + /// Add a definition to the character style list + bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def); + + /// Add a definition to the paragraph style list + bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def); + + /// Add a definition to the list style list + bool AddListStyle(wxRichTextListStyleDefinition* def); + + /// Add a definition to the appropriate style list + bool AddStyle(wxRichTextStyleDefinition* def); + + /// Remove a character style + bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); } + + /// Remove a paragraph style + bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); } + + /// Remove a list style + bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); } + + /// Remove a style + bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false); + + /// Find a character definition by name + wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); } + + /// Find a paragraph definition by name + wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); } + + /// Find a list definition by name + wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); } + + /// Find any definition by name + wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const; + + /// Return the number of character styles + size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); } + + /// Return the number of paragraph styles + size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); } + + /// Return the number of list styles + size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); } + + /// Return the nth character style + wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); } + + /// Return the nth paragraph style + wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); } + + /// Return the nth list style + wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); } + + /// Delete all styles + void DeleteStyles(); + + /// Insert into list of style sheets + bool InsertSheet(wxRichTextStyleSheet* before); + + /// Append to list of style sheets + bool AppendSheet(wxRichTextStyleSheet* after); + + /// Unlink from the list of style sheets + void Unlink(); + + /// Get/set next sheet + wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; } + void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; } + + /// Get/set previous sheet + wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; } + void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; } + + /// Sets and gets the name of the style sheet + void SetName(const wxString& name) { m_name = name; } + const wxString& GetName() const { return m_name; } + + /// Sets and gets the style description + void SetDescription(const wxString& descr) { m_description = descr; } + const wxString& GetDescription() const { return m_description; } + +/// Implementation + + /// Add a definition to one of the style lists + bool AddStyle(wxList& list, wxRichTextStyleDefinition* def); + + /// Remove a style + bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle); + + /// Find a definition by name + wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const; + +protected: + + wxString m_description; + wxString m_name; + + wxList m_characterStyleDefinitions; + wxList m_paragraphStyleDefinitions; + wxList m_listStyleDefinitions; + + wxRichTextStyleSheet* m_previousSheet; + wxRichTextStyleSheet* m_nextSheet; +}; + +#if wxUSE_HTML +/*! + * wxRichTextStyleListBox class declaration + * A listbox to display styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox +{ + DECLARE_CLASS(wxRichTextStyleListBox) + DECLARE_EVENT_TABLE() + +public: + /// Which type of style definition is currently showing? + enum wxRichTextStyleType + { + wxRICHTEXT_STYLE_ALL, + wxRICHTEXT_STYLE_PARAGRAPH, + wxRICHTEXT_STYLE_CHARACTER, + wxRICHTEXT_STYLE_LIST + }; + + wxRichTextStyleListBox() + { + Init(); + } + wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + virtual ~wxRichTextStyleListBox(); + + void Init() + { + m_styleSheet = NULL; + m_richTextCtrl = NULL; + m_applyOnSelection = false; + m_styleType = wxRICHTEXT_STYLE_PARAGRAPH; + m_autoSetSelection = true; + } + + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Creates a suitable HTML fragment for a definition + wxString CreateHTML(wxRichTextStyleDefinition* def) const; + + /// Associates the control with a style sheet + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; } + wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } + + /// Associates the control with a wxRichTextCtrl + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } + wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } + + /// Get style for index + wxRichTextStyleDefinition* GetStyle(size_t i) const ; + + /// Get index for style name + int GetIndexForStyle(const wxString& name) const ; + + /// Set selection for string, returning the index. + int SetStyleSelection(const wxString& name); + + /// Updates the list + void UpdateStyles(); + + /// Apply the style + void ApplyStyle(int i); + + /// Left click + void OnLeftDown(wxMouseEvent& event); + + /// Left double-click + void OnLeftDoubleClick(wxMouseEvent& event); + + /// Auto-select from style under caret in idle time + void OnIdle(wxIdleEvent& event); + + /// Convert units in tends of a millimetre to device units + int ConvertTenthsMMToPixels(wxDC& dc, int units) const; + + /// Can we set the selection based on the editor caret position? + /// Need to override this if being used in a combobox popup + virtual bool CanAutoSetSelection() { return m_autoSetSelection; } + virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; } + + /// Set whether the style should be applied as soon as the item is selected (the default) + void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; } + bool GetApplyOnSelection() const { return m_applyOnSelection; } + + /// Set the style type to display + void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); } + wxRichTextStyleType GetStyleType() const { return m_styleType; } + + /// Helper for listbox and combo control + static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType); + +protected: + /// Returns the HTML for this item + virtual wxString OnGetItem(size_t n) const; + +private: + + wxRichTextStyleSheet* m_styleSheet; + wxRichTextCtrl* m_richTextCtrl; + bool m_applyOnSelection; // if true, applies style on selection + wxRichTextStyleType m_styleType; // style type to display + bool m_autoSetSelection; + wxArrayString m_styleNames; +}; + +/*! + * wxRichTextStyleListCtrl class declaration + * This is a container for the list control plus a combobox to switch between + * style types. + */ + +#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000 + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl +{ + DECLARE_CLASS(wxRichTextStyleListCtrl) + DECLARE_EVENT_TABLE() + +public: + + /// Constructors + wxRichTextStyleListCtrl() + { + Init(); + } + + wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Constructors + virtual ~wxRichTextStyleListCtrl(); + + /// Member initialisation + void Init() + { + m_styleListBox = NULL; + m_styleChoice = NULL; + m_dontUpdate = false; + } + + /// Creates the windows + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Updates the style list box + void UpdateStyles(); + + /// Associates the control with a style sheet + void SetStyleSheet(wxRichTextStyleSheet* styleSheet); + wxRichTextStyleSheet* GetStyleSheet() const; + + /// Associates the control with a wxRichTextCtrl + void SetRichTextCtrl(wxRichTextCtrl* ctrl); + wxRichTextCtrl* GetRichTextCtrl() const; + + /// Set/get the style type to display + void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType); + wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const; + + /// Get the choice index for style type + int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType); + + /// Get the style type for choice index + wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i); + + /// Get the listbox + wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; } + + /// Get the choice + wxChoice* GetStyleChoice() const { return m_styleChoice; } + + /// React to style type choice + void OnChooseType(wxCommandEvent& event); + + /// Lay out the controls + void OnSize(wxSizeEvent& event); + +private: + + wxRichTextStyleListBox* m_styleListBox; + wxChoice* m_styleChoice; + bool m_dontUpdate; +}; + +#if wxUSE_COMBOCTRL + +/*! + * Style drop-down for a wxComboCtrl + */ + +class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup +{ +public: + virtual void Init() + { + m_itemHere = -1; // hot item in list + m_value = -1; + } + + virtual bool Create( wxWindow* parent ) + { + return wxRichTextStyleListBox::Create(parent, wxID_ANY, + wxPoint(0,0), wxDefaultSize, + wxSIMPLE_BORDER); + } + + virtual wxWindow *GetControl() { return this; } + + virtual void SetStringValue( const wxString& s ); + + virtual wxString GetStringValue() const; + + /// Can we set the selection based on the editor caret position? + // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); } + virtual bool CanAutoSetSelection() { return false; } + + // + // Popup event handlers + // + + // Mouse hot-tracking + void OnMouseMove(wxMouseEvent& event); + + // On mouse left, set the value and close the popup + void OnMouseClick(wxMouseEvent& WXUNUSED(event)); + +protected: + + int m_itemHere; // hot item in popup + int m_value; + +private: + DECLARE_EVENT_TABLE() +}; + +/*! + * wxRichTextStyleComboCtrl + * A combo for applying styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl +{ + DECLARE_CLASS(wxRichTextStyleComboCtrl) + DECLARE_EVENT_TABLE() + +public: + wxRichTextStyleComboCtrl() + { + Init(); + } + + wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxCB_READONLY) + { + Init(); + Create(parent, id, pos, size, style); + } + + virtual ~wxRichTextStyleComboCtrl() {} + + void Init() + { + m_stylePopup = NULL; + } + + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Updates the list + void UpdateStyles() { m_stylePopup->UpdateStyles(); } + + /// Associates the control with a style sheet + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); } + wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); } + + /// Associates the control with a wxRichTextCtrl + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); } + wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); } + + /// Gets the style popup + wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; } + + /// Auto-select from style under caret in idle time + void OnIdle(wxIdleEvent& event); + +protected: + wxRichTextStyleComboPopup* m_stylePopup; +}; + +#endif + // wxUSE_COMBOCTRL + +#endif + // wxUSE_HTML + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTSTYLES_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextsymboldlg.h b/Externals/wxWidgets/include/wx/richtext/richtextsymboldlg.h index f7079569ef..c955026f34 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextsymboldlg.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextsymboldlg.h @@ -1,370 +1,370 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtextsymboldlg.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/5/2006 3:11:58 PM -// RCS-ID: $Id: richtextsymboldlg.h 50950 2007-12-30 16:11:12Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTSYMBOLDLG_H_ -#define _RICHTEXTSYMBOLDLG_H_ - -/*! - * Includes - */ - -#include "wx/dialog.h" -#include "wx/vscroll.h" - -/*! - * Forward declarations - */ - -class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxComboBox; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; - -////@begin forward declarations -class wxSymbolListCtrl; -////@end forward declarations - -// __UNICODE__ is a symbol used by DialogBlocks-generated code. -#ifndef __UNICODE__ -#if wxUSE_UNICODE -#define __UNICODE__ -#endif -#endif - -/*! - * Symbols - */ - -#define SYMBOL_WXSYMBOLPICKERDIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX) -#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE _("Symbols") -#define SYMBOL_WXSYMBOLPICKERDIALOG_IDNAME ID_SYMBOLPICKERDIALOG -#define SYMBOL_WXSYMBOLPICKERDIALOG_SIZE wxSize(400, 300) -#define SYMBOL_WXSYMBOLPICKERDIALOG_POSITION wxDefaultPosition - -/*! - * wxSymbolPickerDialog class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxSymbolPickerDialog: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( wxSymbolPickerDialog ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxSymbolPickerDialog( ); - wxSymbolPickerDialog( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont, - wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE ); - - /// Creation - bool Create( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont, - wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE ); - - /// Initialises members variables - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - - /// Update the display - void UpdateSymbolDisplay(bool updateSymbolList = true, bool showAtSubset = true); - - /// Respond to symbol selection - void OnSymbolSelected( wxCommandEvent& event ); - - /// Set Unicode mode - void SetUnicodeMode(bool unicodeMode); - - /// Show at the current subset selection - void ShowAtSubset(); - - /// Get the selected symbol character - int GetSymbolChar() const; - - /// Is there a selection? - bool HasSelection() const { return !m_symbol.IsEmpty(); } - - /// Specifying normal text? - bool UseNormalFont() const { return m_fontName.IsEmpty(); } - - /// Should we show tooltips? - static bool ShowToolTips() { return sm_showToolTips; } - - /// Determines whether tooltips will be shown - static void SetShowToolTips(bool show) { sm_showToolTips = show; } - - /// Data transfer - virtual bool TransferDataToWindow(); - -////@begin wxSymbolPickerDialog event handler declarations - - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SYMBOLPICKERDIALOG_FONT - void OnFontCtrlSelected( wxCommandEvent& event ); - -#if defined(__UNICODE__) - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SYMBOLPICKERDIALOG_SUBSET - void OnSubsetSelected( wxCommandEvent& event ); - -#endif -#if defined(__UNICODE__) - /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SYMBOLPICKERDIALOG_FROM - void OnFromUnicodeSelected( wxCommandEvent& event ); - -#endif -#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__) - /// wxEVT_UPDATE_UI event handler for wxID_OK - void OnOkUpdate( wxUpdateUIEvent& event ); - -#endif -#if defined(__WXMAC__) - /// wxEVT_UPDATE_UI event handler for wxID_OK - void OnOkUpdate( wxUpdateUIEvent& event ); - -#endif -////@end wxSymbolPickerDialog event handler declarations - -////@begin wxSymbolPickerDialog member function declarations - - wxString GetFontName() const { return m_fontName ; } - void SetFontName(wxString value) { m_fontName = value ; } - - wxString GetSymbol() const { return m_symbol ; } - void SetSymbol(wxString value) { m_symbol = value ; } - - bool GetFromUnicode() const { return m_fromUnicode ; } - void SetFromUnicode(bool value) { m_fromUnicode = value ; } - - wxString GetNormalTextFontName() const { return m_normalTextFontName ; } - void SetNormalTextFontName(wxString value) { m_normalTextFontName = value ; } - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxSymbolPickerDialog member function declarations - -////@begin wxSymbolPickerDialog member variables - wxComboBox* m_fontCtrl; -#if defined(__UNICODE__) - wxComboBox* m_subsetCtrl; -#endif - wxSymbolListCtrl* m_symbolsCtrl; - wxStaticText* m_symbolStaticCtrl; - wxTextCtrl* m_characterCodeCtrl; -#if defined(__UNICODE__) - wxComboBox* m_fromUnicodeCtrl; -#endif - wxString m_fontName; - wxString m_symbol; - bool m_fromUnicode; - wxString m_normalTextFontName; - /// Control identifiers - enum { - ID_SYMBOLPICKERDIALOG = 10600, - ID_SYMBOLPICKERDIALOG_FONT = 10602, - ID_SYMBOLPICKERDIALOG_SUBSET = 10605, - ID_SYMBOLPICKERDIALOG_LISTCTRL = 10608, - ID_SYMBOLPICKERDIALOG_CHARACTERCODE = 10601, - ID_SYMBOLPICKERDIALOG_FROM = 10603 - }; -////@end wxSymbolPickerDialog member variables - - bool m_dontUpdate; - static bool sm_showToolTips; -}; - -/*! - * The scrolling symbol list. - */ - -class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl : public wxVScrolledWindow -{ -public: - // constructors and such - // --------------------- - - // default constructor, you must call Create() later - wxSymbolListCtrl() { Init(); } - - // normal constructor which calls Create() internally - wxSymbolListCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // really creates the control and sets the initial number of items in it - // (which may be changed later with SetItemCount()) - // - // returns true on success or false if the control couldn't be created - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - // dtor does some internal cleanup - virtual ~wxSymbolListCtrl(); - - - // accessors - // --------- - - // set the current font - virtual bool SetFont(const wxFont& font); - - // set Unicode/ASCII mode - void SetUnicodeMode(bool unicodeMode); - - // get the index of the currently selected item or wxNOT_FOUND if there is no selection - int GetSelection() const; - - // is this item selected? - bool IsSelected(int item) const; - - // is this item the current one? - bool IsCurrentItem(int item) const { return item == m_current; } - - // get the margins around each cell - wxPoint GetMargins() const { return m_ptMargins; } - - // get the background colour of selected cells - const wxColour& GetSelectionBackground() const { return m_colBgSel; } - - // operations - // ---------- - - // set the selection to the specified item, if it is wxNOT_FOUND the - // selection is unset - void SetSelection(int selection); - - // make this item visible - void EnsureVisible(int item); - - // set the margins: horizontal margin is the distance between the window - // border and the item contents while vertical margin is half of the - // distance between items - // - // by default both margins are 0 - void SetMargins(const wxPoint& pt); - void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } - - // set the cell size - void SetCellSize(const wxSize& sz) { m_cellSize = sz; } - const wxSize& GetCellSize() const { return m_cellSize; } - - // change the background colour of the selected cells - void SetSelectionBackground(const wxColour& col); - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // Get min/max symbol values - int GetMinSymbolValue() const { return m_minSymbolValue; } - int GetMaxSymbolValue() const { return m_maxSymbolValue; } - - // Respond to size change - void OnSize(wxSizeEvent& event); - -protected: - - // draws a line of symbols - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; - - // gets the line height - virtual wxCoord OnGetLineHeight(size_t line) const; - - // event handlers - void OnPaint(wxPaintEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnLeftDown(wxMouseEvent& event); - void OnLeftDClick(wxMouseEvent& event); - - // common part of all ctors - void Init(); - - // send the wxEVT_COMMAND_LISTBOX_SELECTED event - void SendSelectedEvent(); - - // change the current item (in single selection listbox it also implicitly - // changes the selection); current may be wxNOT_FOUND in which case there - // will be no current item any more - // - // return true if the current item changed, false otherwise - bool DoSetCurrent(int current); - - // flags for DoHandleItemClick - enum - { - ItemClick_Shift = 1, // item shift-clicked - ItemClick_Ctrl = 2, // ctrl - ItemClick_Kbd = 4 // item selected from keyboard - }; - - // common part of keyboard and mouse handling processing code - void DoHandleItemClick(int item, int flags); - - // calculate line number from symbol value - int SymbolValueToLineNumber(int item); - - // initialise control from current min/max values - void SetupCtrl(bool scrollToSelection = true); - - // hit testing - int HitTest(const wxPoint& pt); - -private: - // the current item or wxNOT_FOUND - int m_current; - - // margins - wxPoint m_ptMargins; - - // the selection bg colour - wxColour m_colBgSel; - - // double buffer - wxBitmap* m_doubleBuffer; - - // cell size - wxSize m_cellSize; - - // minimum and maximum symbol value - int m_minSymbolValue; - - // minimum and maximum symbol value - int m_maxSymbolValue; - - // number of items per line - int m_symbolsPerLine; - - // Unicode/ASCII mode - bool m_unicodeMode; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxSymbolListCtrl) - DECLARE_ABSTRACT_CLASS(wxSymbolListCtrl) -}; - -#endif - // _RICHTEXTSYMBOLDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextsymboldlg.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/5/2006 3:11:58 PM +// RCS-ID: $Id: richtextsymboldlg.h 50950 2007-12-30 16:11:12Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSYMBOLDLG_H_ +#define _RICHTEXTSYMBOLDLG_H_ + +/*! + * Includes + */ + +#include "wx/dialog.h" +#include "wx/vscroll.h" + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +////@begin forward declarations +class wxSymbolListCtrl; +////@end forward declarations + +// __UNICODE__ is a symbol used by DialogBlocks-generated code. +#ifndef __UNICODE__ +#if wxUSE_UNICODE +#define __UNICODE__ +#endif +#endif + +/*! + * Symbols + */ + +#define SYMBOL_WXSYMBOLPICKERDIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX) +#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE _("Symbols") +#define SYMBOL_WXSYMBOLPICKERDIALOG_IDNAME ID_SYMBOLPICKERDIALOG +#define SYMBOL_WXSYMBOLPICKERDIALOG_SIZE wxSize(400, 300) +#define SYMBOL_WXSYMBOLPICKERDIALOG_POSITION wxDefaultPosition + +/*! + * wxSymbolPickerDialog class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxSymbolPickerDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( wxSymbolPickerDialog ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxSymbolPickerDialog( ); + wxSymbolPickerDialog( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont, + wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE ); + + /// Creation + bool Create( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont, + wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE ); + + /// Initialises members variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Update the display + void UpdateSymbolDisplay(bool updateSymbolList = true, bool showAtSubset = true); + + /// Respond to symbol selection + void OnSymbolSelected( wxCommandEvent& event ); + + /// Set Unicode mode + void SetUnicodeMode(bool unicodeMode); + + /// Show at the current subset selection + void ShowAtSubset(); + + /// Get the selected symbol character + int GetSymbolChar() const; + + /// Is there a selection? + bool HasSelection() const { return !m_symbol.IsEmpty(); } + + /// Specifying normal text? + bool UseNormalFont() const { return m_fontName.IsEmpty(); } + + /// Should we show tooltips? + static bool ShowToolTips() { return sm_showToolTips; } + + /// Determines whether tooltips will be shown + static void SetShowToolTips(bool show) { sm_showToolTips = show; } + + /// Data transfer + virtual bool TransferDataToWindow(); + +////@begin wxSymbolPickerDialog event handler declarations + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SYMBOLPICKERDIALOG_FONT + void OnFontCtrlSelected( wxCommandEvent& event ); + +#if defined(__UNICODE__) + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SYMBOLPICKERDIALOG_SUBSET + void OnSubsetSelected( wxCommandEvent& event ); + +#endif +#if defined(__UNICODE__) + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SYMBOLPICKERDIALOG_FROM + void OnFromUnicodeSelected( wxCommandEvent& event ); + +#endif +#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__) + /// wxEVT_UPDATE_UI event handler for wxID_OK + void OnOkUpdate( wxUpdateUIEvent& event ); + +#endif +#if defined(__WXMAC__) + /// wxEVT_UPDATE_UI event handler for wxID_OK + void OnOkUpdate( wxUpdateUIEvent& event ); + +#endif +////@end wxSymbolPickerDialog event handler declarations + +////@begin wxSymbolPickerDialog member function declarations + + wxString GetFontName() const { return m_fontName ; } + void SetFontName(wxString value) { m_fontName = value ; } + + wxString GetSymbol() const { return m_symbol ; } + void SetSymbol(wxString value) { m_symbol = value ; } + + bool GetFromUnicode() const { return m_fromUnicode ; } + void SetFromUnicode(bool value) { m_fromUnicode = value ; } + + wxString GetNormalTextFontName() const { return m_normalTextFontName ; } + void SetNormalTextFontName(wxString value) { m_normalTextFontName = value ; } + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxSymbolPickerDialog member function declarations + +////@begin wxSymbolPickerDialog member variables + wxComboBox* m_fontCtrl; +#if defined(__UNICODE__) + wxComboBox* m_subsetCtrl; +#endif + wxSymbolListCtrl* m_symbolsCtrl; + wxStaticText* m_symbolStaticCtrl; + wxTextCtrl* m_characterCodeCtrl; +#if defined(__UNICODE__) + wxComboBox* m_fromUnicodeCtrl; +#endif + wxString m_fontName; + wxString m_symbol; + bool m_fromUnicode; + wxString m_normalTextFontName; + /// Control identifiers + enum { + ID_SYMBOLPICKERDIALOG = 10600, + ID_SYMBOLPICKERDIALOG_FONT = 10602, + ID_SYMBOLPICKERDIALOG_SUBSET = 10605, + ID_SYMBOLPICKERDIALOG_LISTCTRL = 10608, + ID_SYMBOLPICKERDIALOG_CHARACTERCODE = 10601, + ID_SYMBOLPICKERDIALOG_FROM = 10603 + }; +////@end wxSymbolPickerDialog member variables + + bool m_dontUpdate; + static bool sm_showToolTips; +}; + +/*! + * The scrolling symbol list. + */ + +class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl : public wxVScrolledWindow +{ +public: + // constructors and such + // --------------------- + + // default constructor, you must call Create() later + wxSymbolListCtrl() { Init(); } + + // normal constructor which calls Create() internally + wxSymbolListCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // really creates the control and sets the initial number of items in it + // (which may be changed later with SetItemCount()) + // + // returns true on success or false if the control couldn't be created + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + // dtor does some internal cleanup + virtual ~wxSymbolListCtrl(); + + + // accessors + // --------- + + // set the current font + virtual bool SetFont(const wxFont& font); + + // set Unicode/ASCII mode + void SetUnicodeMode(bool unicodeMode); + + // get the index of the currently selected item or wxNOT_FOUND if there is no selection + int GetSelection() const; + + // is this item selected? + bool IsSelected(int item) const; + + // is this item the current one? + bool IsCurrentItem(int item) const { return item == m_current; } + + // get the margins around each cell + wxPoint GetMargins() const { return m_ptMargins; } + + // get the background colour of selected cells + const wxColour& GetSelectionBackground() const { return m_colBgSel; } + + // operations + // ---------- + + // set the selection to the specified item, if it is wxNOT_FOUND the + // selection is unset + void SetSelection(int selection); + + // make this item visible + void EnsureVisible(int item); + + // set the margins: horizontal margin is the distance between the window + // border and the item contents while vertical margin is half of the + // distance between items + // + // by default both margins are 0 + void SetMargins(const wxPoint& pt); + void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } + + // set the cell size + void SetCellSize(const wxSize& sz) { m_cellSize = sz; } + const wxSize& GetCellSize() const { return m_cellSize; } + + // change the background colour of the selected cells + void SetSelectionBackground(const wxColour& col); + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // Get min/max symbol values + int GetMinSymbolValue() const { return m_minSymbolValue; } + int GetMaxSymbolValue() const { return m_maxSymbolValue; } + + // Respond to size change + void OnSize(wxSizeEvent& event); + +protected: + + // draws a line of symbols + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; + + // gets the line height + virtual wxCoord OnGetLineHeight(size_t line) const; + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnLeftDown(wxMouseEvent& event); + void OnLeftDClick(wxMouseEvent& event); + + // common part of all ctors + void Init(); + + // send the wxEVT_COMMAND_LISTBOX_SELECTED event + void SendSelectedEvent(); + + // change the current item (in single selection listbox it also implicitly + // changes the selection); current may be wxNOT_FOUND in which case there + // will be no current item any more + // + // return true if the current item changed, false otherwise + bool DoSetCurrent(int current); + + // flags for DoHandleItemClick + enum + { + ItemClick_Shift = 1, // item shift-clicked + ItemClick_Ctrl = 2, // ctrl + ItemClick_Kbd = 4 // item selected from keyboard + }; + + // common part of keyboard and mouse handling processing code + void DoHandleItemClick(int item, int flags); + + // calculate line number from symbol value + int SymbolValueToLineNumber(int item); + + // initialise control from current min/max values + void SetupCtrl(bool scrollToSelection = true); + + // hit testing + int HitTest(const wxPoint& pt); + +private: + // the current item or wxNOT_FOUND + int m_current; + + // margins + wxPoint m_ptMargins; + + // the selection bg colour + wxColour m_colBgSel; + + // double buffer + wxBitmap* m_doubleBuffer; + + // cell size + wxSize m_cellSize; + + // minimum and maximum symbol value + int m_minSymbolValue; + + // minimum and maximum symbol value + int m_maxSymbolValue; + + // number of items per line + int m_symbolsPerLine; + + // Unicode/ASCII mode + bool m_unicodeMode; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSymbolListCtrl) + DECLARE_ABSTRACT_CLASS(wxSymbolListCtrl) +}; + +#endif + // _RICHTEXTSYMBOLDLG_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtexttabspage.h b/Externals/wxWidgets/include/wx/richtext/richtexttabspage.h index abe0f9497d..f067e04c7b 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtexttabspage.h +++ b/Externals/wxWidgets/include/wx/richtext/richtexttabspage.h @@ -1,129 +1,129 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richtexttabspage.h -// Purpose: -// Author: Julian Smart -// Modified by: -// Created: 10/4/2006 8:03:20 AM -// RCS-ID: $Id: richtexttabspage.h 42678 2006-10-29 22:01:06Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _RICHTEXTTABSPAGE_H_ -#define _RICHTEXTTABSPAGE_H_ - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define SYMBOL_WXRICHTEXTTABSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL -#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE _("wxRichTextFontPage") -#define SYMBOL_WXRICHTEXTTABSPAGE_IDNAME ID_RICHTEXTTABSPAGE -#define SYMBOL_WXRICHTEXTTABSPAGE_SIZE wxSize(400, 300) -#define SYMBOL_WXRICHTEXTTABSPAGE_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * wxRichTextTabsPage class declaration - */ - -class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxRichTextTabsPage ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - wxRichTextTabsPage( ); - wxRichTextTabsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - - /// Initialise members - void Init(); - - /// Transfer data from/to window - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); - - /// Sorts the tab array - virtual void SortTabs(); - - /// Gets the attributes associated with the main formatting dialog - wxTextAttrEx* GetAttributes(); - -////@begin wxRichTextTabsPage event handler declarations - - /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTTABSPAGE_TABLIST - void OnTablistSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_NEW_TAB - void OnNewTabClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_NEW_TAB - void OnNewTabUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB - void OnDeleteTabClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB - void OnDeleteTabUpdate( wxUpdateUIEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS - void OnDeleteAllTabsClick( wxCommandEvent& event ); - - /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS - void OnDeleteAllTabsUpdate( wxUpdateUIEvent& event ); - -////@end wxRichTextTabsPage event handler declarations - -////@begin wxRichTextTabsPage member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end wxRichTextTabsPage member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin wxRichTextTabsPage member variables - wxTextCtrl* m_tabEditCtrl; - wxListBox* m_tabListCtrl; - /// Control identifiers - enum { - ID_RICHTEXTTABSPAGE = 10200, - ID_RICHTEXTTABSPAGE_TABEDIT = 10213, - ID_RICHTEXTTABSPAGE_TABLIST = 10214, - ID_RICHTEXTTABSPAGE_NEW_TAB = 10201, - ID_RICHTEXTTABSPAGE_DELETE_TAB = 10202, - ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS = 10203 - }; -////@end wxRichTextTabsPage member variables - - bool m_tabsPresent; -}; - -#endif - // _RICHTEXTTABSPAGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtexttabspage.h +// Purpose: +// Author: Julian Smart +// Modified by: +// Created: 10/4/2006 8:03:20 AM +// RCS-ID: $Id: richtexttabspage.h 42678 2006-10-29 22:01:06Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTTABSPAGE_H_ +#define _RICHTEXTTABSPAGE_H_ + +/*! + * Includes + */ + +////@begin includes +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTTABSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE _("wxRichTextFontPage") +#define SYMBOL_WXRICHTEXTTABSPAGE_IDNAME ID_RICHTEXTTABSPAGE +#define SYMBOL_WXRICHTEXTTABSPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTTABSPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextTabsPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( wxRichTextTabsPage ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + wxRichTextTabsPage( ); + wxRichTextTabsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /// Initialise members + void Init(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); + + /// Sorts the tab array + virtual void SortTabs(); + + /// Gets the attributes associated with the main formatting dialog + wxTextAttrEx* GetAttributes(); + +////@begin wxRichTextTabsPage event handler declarations + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTTABSPAGE_TABLIST + void OnTablistSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_NEW_TAB + void OnNewTabClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_NEW_TAB + void OnNewTabUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB + void OnDeleteTabClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB + void OnDeleteTabUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS + void OnDeleteAllTabsClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS + void OnDeleteAllTabsUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextTabsPage event handler declarations + +////@begin wxRichTextTabsPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextTabsPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextTabsPage member variables + wxTextCtrl* m_tabEditCtrl; + wxListBox* m_tabListCtrl; + /// Control identifiers + enum { + ID_RICHTEXTTABSPAGE = 10200, + ID_RICHTEXTTABSPAGE_TABEDIT = 10213, + ID_RICHTEXTTABSPAGE_TABLIST = 10214, + ID_RICHTEXTTABSPAGE_NEW_TAB = 10201, + ID_RICHTEXTTABSPAGE_DELETE_TAB = 10202, + ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS = 10203 + }; +////@end wxRichTextTabsPage member variables + + bool m_tabsPresent; +}; + +#endif + // _RICHTEXTTABSPAGE_H_ diff --git a/Externals/wxWidgets/include/wx/richtext/richtextxml.h b/Externals/wxWidgets/include/wx/richtext/richtextxml.h index 36d9bb8dc9..0b9ff91bc1 100644 --- a/Externals/wxWidgets/include/wx/richtext/richtextxml.h +++ b/Externals/wxWidgets/include/wx/richtext/richtextxml.h @@ -1,79 +1,79 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richeditxml.h -// Purpose: XML and HTML I/O for wxRichTextCtrl -// Author: Julian Smart -// Modified by: -// Created: 2005-09-30 -// RCS-ID: $Id: richtextxml.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RICHTEXTXML_H_ -#define _WX_RICHTEXTXML_H_ - -/*! - * Includes - */ - -#include "wx/richtext/richtextbuffer.h" -#include "wx/richtext/richtextstyles.h" - -#if wxUSE_RICHTEXT && wxUSE_XML - -/*! - * wxRichTextXMLHandler - */ - -class WXDLLIMPEXP_FWD_XML wxXmlNode; - -class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler -{ - DECLARE_CLASS(wxRichTextXMLHandler) -public: - wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML) - : wxRichTextFileHandler(name, ext, type) - { } - -#if wxUSE_STREAMS - /// Recursively export an object - bool ExportXML(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextObject& obj, int level); - bool ExportStyleDefinition(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextStyleDefinition* def, int level); - - /// Recursively import an object - bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node); - bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node); - - /// Create style parameters - wxString CreateStyle(const wxTextAttrEx& attr, bool isPara = false); - - /// Get style parameters - bool GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara = false); -#endif - - /// Can we save using this handler? - virtual bool CanSave() const { return true; } - - /// Can we load using this handler? - virtual bool CanLoad() const { return true; } - -// Implementation - - bool HasParam(wxXmlNode* node, const wxString& param); - wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param); - wxString GetNodeContent(wxXmlNode *node); - wxString GetParamValue(wxXmlNode *node, const wxString& param); - wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false); - -protected: -#if wxUSE_STREAMS - virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); - virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); -#endif -}; - -#endif - // wxUSE_RICHTEXT && wxUSE_XML - -#endif - // _WX_RICHTEXTXML_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richeditxml.h +// Purpose: XML and HTML I/O for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// RCS-ID: $Id: richtextxml.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTXML_H_ +#define _WX_RICHTEXTXML_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextstyles.h" + +#if wxUSE_RICHTEXT && wxUSE_XML + +/*! + * wxRichTextXMLHandler + */ + +class WXDLLIMPEXP_FWD_XML wxXmlNode; + +class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler +{ + DECLARE_CLASS(wxRichTextXMLHandler) +public: + wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML) + : wxRichTextFileHandler(name, ext, type) + { } + +#if wxUSE_STREAMS + /// Recursively export an object + bool ExportXML(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextObject& obj, int level); + bool ExportStyleDefinition(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextStyleDefinition* def, int level); + + /// Recursively import an object + bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node); + bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node); + + /// Create style parameters + wxString CreateStyle(const wxTextAttrEx& attr, bool isPara = false); + + /// Get style parameters + bool GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara = false); +#endif + + /// Can we save using this handler? + virtual bool CanSave() const { return true; } + + /// Can we load using this handler? + virtual bool CanLoad() const { return true; } + +// Implementation + + bool HasParam(wxXmlNode* node, const wxString& param); + wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param); + wxString GetNodeContent(wxXmlNode *node); + wxString GetParamValue(wxXmlNode *node, const wxString& param); + wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false); + +protected: +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); +#endif +}; + +#endif + // wxUSE_RICHTEXT && wxUSE_XML + +#endif + // _WX_RICHTEXTXML_H_ diff --git a/Externals/wxWidgets/include/wx/sashwin.h b/Externals/wxWidgets/include/wx/sashwin.h index 53a26a390d..c99a94b4ab 100644 --- a/Externals/wxWidgets/include/wx/sashwin.h +++ b/Externals/wxWidgets/include/wx/sashwin.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/sashwin.h -// Purpose: Base header for wxSashWindow -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: sashwin.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SASHWIN_H_BASE_ -#define _WX_SASHWIN_H_BASE_ - -#include "wx/generic/sashwin.h" - -#endif - // _WX_SASHWIN_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sashwin.h +// Purpose: Base header for wxSashWindow +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: sashwin.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SASHWIN_H_BASE_ +#define _WX_SASHWIN_H_BASE_ + +#include "wx/generic/sashwin.h" + +#endif + // _WX_SASHWIN_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/sckaddr.h b/Externals/wxWidgets/include/wx/sckaddr.h index 66b7ff20b4..696ee46999 100644 --- a/Externals/wxWidgets/include/wx/sckaddr.h +++ b/Externals/wxWidgets/include/wx/sckaddr.h @@ -1,193 +1,193 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sckaddr.h -// Purpose: Network address classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 26/04/1997 -// RCS-ID: $Id: sckaddr.h 35665 2005-09-24 21:43:15Z VZ $ -// Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_NETWORK_ADDRESS_H -#define _WX_NETWORK_ADDRESS_H - -#include "wx/defs.h" - -#if wxUSE_SOCKETS - -#include "wx/string.h" -#include "wx/gsocket.h" - - -class WXDLLIMPEXP_NET wxSockAddress : public wxObject { - DECLARE_ABSTRACT_CLASS(wxSockAddress) -public: - typedef enum { IPV4=1, IPV6=2, UNIX=3 } Addr; - - wxSockAddress(); - wxSockAddress(const wxSockAddress& other); - virtual ~wxSockAddress(); - - wxSockAddress& operator=(const wxSockAddress& other); - - virtual void Clear(); - virtual int Type() = 0; - - GAddress *GetAddress() const { return m_address; } - void SetAddress(GAddress *address); - - // we need to be able to create copies of the addresses polymorphically (i.e. - // without knowing the exact address class) - virtual wxSockAddress *Clone() const = 0; - -protected: - GAddress *m_address; - -private: - void Init(); -}; - -// Interface to an IP address (either IPV4 or IPV6) -class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress { - DECLARE_ABSTRACT_CLASS(wxIPaddress) -public: - wxIPaddress(); - wxIPaddress(const wxIPaddress& other); - virtual ~wxIPaddress(); - - virtual bool Hostname(const wxString& name) = 0; - virtual bool Service(const wxString& name) = 0; - virtual bool Service(unsigned short port) = 0; - - virtual bool LocalHost() = 0; - virtual bool IsLocalHost() const = 0; - - virtual bool AnyAddress() = 0; - - virtual wxString IPAddress() const = 0; - - virtual wxString Hostname() const = 0; - virtual unsigned short Service() const = 0; -}; - -class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress { - DECLARE_DYNAMIC_CLASS(wxIPV4address) -public: - wxIPV4address(); - wxIPV4address(const wxIPV4address& other); - virtual ~wxIPV4address(); - - // IPV4 name formats - // - // hostname - // dot format a.b.c.d - virtual bool Hostname(const wxString& name); - bool Hostname(unsigned long addr); - virtual bool Service(const wxString& name); - virtual bool Service(unsigned short port); - - // localhost (127.0.0.1) - virtual bool LocalHost(); - virtual bool IsLocalHost() const; - - // any (0.0.0.0) - virtual bool AnyAddress(); - - virtual wxString Hostname() const; - wxString OrigHostname() { return m_origHostname; } - virtual unsigned short Service() const; - - // a.b.c.d - virtual wxString IPAddress() const; - - virtual int Type() { return wxSockAddress::IPV4; } - virtual wxSockAddress *Clone() const; - - bool operator==(const wxIPV4address& addr) const; - -private: - wxString m_origHostname; -}; - - -// the IPv6 code probably doesn't work, untested -- set to 1 at your own risk -#ifndef wxUSE_IPV6 - #define wxUSE_IPV6 0 -#endif - -#if wxUSE_IPV6 - -// Experimental Only: -// -// IPV6 has not yet been implemented in socket layer -class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress { - DECLARE_DYNAMIC_CLASS(wxIPV6address) -private: - struct sockaddr_in6 *m_addr; -public: - wxIPV6address(); - wxIPV6address(const wxIPV6address& other); - virtual ~wxIPV6address(); - - // IPV6 name formats - // - // hostname - // 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 - // compact (base85) Itu&-ZQ82s>J%s99FJXT - // compressed format ::1 - // ipv4 mapped ::ffff:1.2.3.4 - virtual bool Hostname(const wxString& name); - - bool Hostname(unsigned char addr[16]); - virtual bool Service(const wxString& name); - virtual bool Service(unsigned short port); - - // localhost (0000:0000:0000:0000:0000:0000:0000:0001 (::1)) - virtual bool LocalHost(); - virtual bool IsLocalHost() const; - - // any (0000:0000:0000:0000:0000:0000:0000:0000 (::)) - virtual bool AnyAddress(); - - // 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 - virtual wxString IPAddress() const; - - virtual wxString Hostname() const; - virtual unsigned short Service() const; - - virtual int Type() { return wxSockAddress::IPV6; } - virtual wxSockAddress *Clone() const { return new wxIPV6address(*this); } -}; - -#endif // wxUSE_IPV6 - -#if defined(__UNIX__) && !defined(__WINE__) && (!defined(__WXMAC__) || defined(__DARWIN__)) && !defined(__WXMSW__) -#include <sys/socket.h> -#ifndef __VMS__ -# include <sys/un.h> -#endif - -class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress { - DECLARE_DYNAMIC_CLASS(wxUNIXaddress) -private: - struct sockaddr_un *m_addr; -public: - wxUNIXaddress(); - wxUNIXaddress(const wxUNIXaddress& other); - virtual ~wxUNIXaddress(); - - void Filename(const wxString& name); - wxString Filename(); - - virtual int Type() { return wxSockAddress::UNIX; } - virtual wxSockAddress *Clone() const { return new wxUNIXaddress(*this); } -}; -#endif - // __UNIX__ - -#endif - // wxUSE_SOCKETS - -#endif - // _WX_NETWORK_ADDRESS_H +///////////////////////////////////////////////////////////////////////////// +// Name: sckaddr.h +// Purpose: Network address classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 26/04/1997 +// RCS-ID: $Id: sckaddr.h 35665 2005-09-24 21:43:15Z VZ $ +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NETWORK_ADDRESS_H +#define _WX_NETWORK_ADDRESS_H + +#include "wx/defs.h" + +#if wxUSE_SOCKETS + +#include "wx/string.h" +#include "wx/gsocket.h" + + +class WXDLLIMPEXP_NET wxSockAddress : public wxObject { + DECLARE_ABSTRACT_CLASS(wxSockAddress) +public: + typedef enum { IPV4=1, IPV6=2, UNIX=3 } Addr; + + wxSockAddress(); + wxSockAddress(const wxSockAddress& other); + virtual ~wxSockAddress(); + + wxSockAddress& operator=(const wxSockAddress& other); + + virtual void Clear(); + virtual int Type() = 0; + + GAddress *GetAddress() const { return m_address; } + void SetAddress(GAddress *address); + + // we need to be able to create copies of the addresses polymorphically (i.e. + // without knowing the exact address class) + virtual wxSockAddress *Clone() const = 0; + +protected: + GAddress *m_address; + +private: + void Init(); +}; + +// Interface to an IP address (either IPV4 or IPV6) +class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress { + DECLARE_ABSTRACT_CLASS(wxIPaddress) +public: + wxIPaddress(); + wxIPaddress(const wxIPaddress& other); + virtual ~wxIPaddress(); + + virtual bool Hostname(const wxString& name) = 0; + virtual bool Service(const wxString& name) = 0; + virtual bool Service(unsigned short port) = 0; + + virtual bool LocalHost() = 0; + virtual bool IsLocalHost() const = 0; + + virtual bool AnyAddress() = 0; + + virtual wxString IPAddress() const = 0; + + virtual wxString Hostname() const = 0; + virtual unsigned short Service() const = 0; +}; + +class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress { + DECLARE_DYNAMIC_CLASS(wxIPV4address) +public: + wxIPV4address(); + wxIPV4address(const wxIPV4address& other); + virtual ~wxIPV4address(); + + // IPV4 name formats + // + // hostname + // dot format a.b.c.d + virtual bool Hostname(const wxString& name); + bool Hostname(unsigned long addr); + virtual bool Service(const wxString& name); + virtual bool Service(unsigned short port); + + // localhost (127.0.0.1) + virtual bool LocalHost(); + virtual bool IsLocalHost() const; + + // any (0.0.0.0) + virtual bool AnyAddress(); + + virtual wxString Hostname() const; + wxString OrigHostname() { return m_origHostname; } + virtual unsigned short Service() const; + + // a.b.c.d + virtual wxString IPAddress() const; + + virtual int Type() { return wxSockAddress::IPV4; } + virtual wxSockAddress *Clone() const; + + bool operator==(const wxIPV4address& addr) const; + +private: + wxString m_origHostname; +}; + + +// the IPv6 code probably doesn't work, untested -- set to 1 at your own risk +#ifndef wxUSE_IPV6 + #define wxUSE_IPV6 0 +#endif + +#if wxUSE_IPV6 + +// Experimental Only: +// +// IPV6 has not yet been implemented in socket layer +class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress { + DECLARE_DYNAMIC_CLASS(wxIPV6address) +private: + struct sockaddr_in6 *m_addr; +public: + wxIPV6address(); + wxIPV6address(const wxIPV6address& other); + virtual ~wxIPV6address(); + + // IPV6 name formats + // + // hostname + // 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 + // compact (base85) Itu&-ZQ82s>J%s99FJXT + // compressed format ::1 + // ipv4 mapped ::ffff:1.2.3.4 + virtual bool Hostname(const wxString& name); + + bool Hostname(unsigned char addr[16]); + virtual bool Service(const wxString& name); + virtual bool Service(unsigned short port); + + // localhost (0000:0000:0000:0000:0000:0000:0000:0001 (::1)) + virtual bool LocalHost(); + virtual bool IsLocalHost() const; + + // any (0000:0000:0000:0000:0000:0000:0000:0000 (::)) + virtual bool AnyAddress(); + + // 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 + virtual wxString IPAddress() const; + + virtual wxString Hostname() const; + virtual unsigned short Service() const; + + virtual int Type() { return wxSockAddress::IPV6; } + virtual wxSockAddress *Clone() const { return new wxIPV6address(*this); } +}; + +#endif // wxUSE_IPV6 + +#if defined(__UNIX__) && !defined(__WINE__) && (!defined(__WXMAC__) || defined(__DARWIN__)) && !defined(__WXMSW__) +#include <sys/socket.h> +#ifndef __VMS__ +# include <sys/un.h> +#endif + +class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress { + DECLARE_DYNAMIC_CLASS(wxUNIXaddress) +private: + struct sockaddr_un *m_addr; +public: + wxUNIXaddress(); + wxUNIXaddress(const wxUNIXaddress& other); + virtual ~wxUNIXaddress(); + + void Filename(const wxString& name); + wxString Filename(); + + virtual int Type() { return wxSockAddress::UNIX; } + virtual wxSockAddress *Clone() const { return new wxUNIXaddress(*this); } +}; +#endif + // __UNIX__ + +#endif + // wxUSE_SOCKETS + +#endif + // _WX_NETWORK_ADDRESS_H diff --git a/Externals/wxWidgets/include/wx/sckipc.h b/Externals/wxWidgets/include/wx/sckipc.h index ef388101f2..0a24bddbaa 100644 --- a/Externals/wxWidgets/include/wx/sckipc.h +++ b/Externals/wxWidgets/include/wx/sckipc.h @@ -1,150 +1,150 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sckipc.h -// Purpose: Interprocess communication implementation (wxSocket version) -// Author: Julian Smart -// Modified by: Guilhem Lavaux (big rewrite) May 1997, 1998 -// Guillermo Rodriguez (updated for wxSocket v2) Jan 2000 -// (callbacks deprecated) Mar 2000 -// Created: 1993 -// RCS-ID: $Id: sckipc.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Julian Smart 1993 -// (c) Guilhem Lavaux 1997, 1998 -// (c) 2000 Guillermo Rodriguez <guille@iies.es> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCKIPC_H -#define _WX_SCKIPC_H - -#include "wx/defs.h" - -#if wxUSE_SOCKETS && wxUSE_IPC - -#include "wx/ipcbase.h" -#include "wx/socket.h" -#include "wx/sckstrm.h" -#include "wx/datstrm.h" - -/* - * Mini-DDE implementation - - Most transactions involve a topic name and an item name (choose these - as befits your application). - - A client can: - - - ask the server to execute commands (data) associated with a topic - - request data from server by topic and item - - poke data into the server - - ask the server to start an advice loop on topic/item - - ask the server to stop an advice loop - - A server can: - - - respond to execute, request, poke and advice start/stop - - send advise data to client - - Note that this limits the server in the ways it can send data to the - client, i.e. it can't send unsolicited information. - * - */ - -class WXDLLIMPEXP_FWD_NET wxTCPServer; -class WXDLLIMPEXP_FWD_NET wxTCPClient; - -class WXDLLIMPEXP_NET wxTCPConnection: public wxConnectionBase -{ - DECLARE_DYNAMIC_CLASS(wxTCPConnection) - -public: - wxTCPConnection(wxChar *buffer, int size); - wxTCPConnection(); - virtual ~wxTCPConnection(); - - // Calls that CLIENT can make - virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); - virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - virtual bool StartAdvise(const wxString& item); - virtual bool StopAdvise(const wxString& item); - - // Calls that SERVER can make - virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); - - // Calls that both can make - virtual bool Disconnect(void); - - // Callbacks to BOTH - override at will - // Default behaviour is to delete connection and return true - virtual bool OnDisconnect(void) { delete this; return true; } - - // To enable the compressor (NOTE: not implemented!) - void Compress(bool on); - - // unhide the Execute overload from wxConnectionBase - virtual bool Execute(const wxString& str) - { return Execute(str, -1, wxIPC_TEXT); } - -protected: - wxSocketBase *m_sock; - wxSocketStream *m_sockstrm; - wxDataInputStream *m_codeci; - wxDataOutputStream *m_codeco; - wxString m_topic; - - friend class wxTCPServer; - friend class wxTCPClient; - friend class wxTCPEventHandler; - - DECLARE_NO_COPY_CLASS(wxTCPConnection) -}; - -class WXDLLIMPEXP_NET wxTCPServer: public wxServerBase -{ -public: - wxTCPConnection *topLevelConnection; - - wxTCPServer(); - virtual ~wxTCPServer(); - - // Returns false on error (e.g. port number is already in use) - virtual bool Create(const wxString& serverName); - - // Callbacks to SERVER - override at will - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); - -protected: - wxSocketServer *m_server; - -#ifdef __UNIX_LIKE__ - // the name of the file associated to the Unix domain socket, may be empty - wxString m_filename; -#endif // __UNIX_LIKE__ - - DECLARE_NO_COPY_CLASS(wxTCPServer) - DECLARE_DYNAMIC_CLASS(wxTCPServer) -}; - -class WXDLLIMPEXP_NET wxTCPClient: public wxClientBase -{ -public: - wxTCPClient(); - virtual ~wxTCPClient(); - - virtual bool ValidHost(const wxString& host); - - // Call this to make a connection. Returns NULL if cannot. - virtual wxConnectionBase *MakeConnection(const wxString& host, - const wxString& server, - const wxString& topic); - - // Callbacks to CLIENT - override at will - virtual wxConnectionBase *OnMakeConnection(); - -private: - DECLARE_DYNAMIC_CLASS(wxTCPClient) -}; - -#endif // wxUSE_SOCKETS && wxUSE_IPC - -#endif // _WX_SCKIPC_H +///////////////////////////////////////////////////////////////////////////// +// Name: sckipc.h +// Purpose: Interprocess communication implementation (wxSocket version) +// Author: Julian Smart +// Modified by: Guilhem Lavaux (big rewrite) May 1997, 1998 +// Guillermo Rodriguez (updated for wxSocket v2) Jan 2000 +// (callbacks deprecated) Mar 2000 +// Created: 1993 +// RCS-ID: $Id: sckipc.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Julian Smart 1993 +// (c) Guilhem Lavaux 1997, 1998 +// (c) 2000 Guillermo Rodriguez <guille@iies.es> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCKIPC_H +#define _WX_SCKIPC_H + +#include "wx/defs.h" + +#if wxUSE_SOCKETS && wxUSE_IPC + +#include "wx/ipcbase.h" +#include "wx/socket.h" +#include "wx/sckstrm.h" +#include "wx/datstrm.h" + +/* + * Mini-DDE implementation + + Most transactions involve a topic name and an item name (choose these + as befits your application). + + A client can: + + - ask the server to execute commands (data) associated with a topic + - request data from server by topic and item + - poke data into the server + - ask the server to start an advice loop on topic/item + - ask the server to stop an advice loop + + A server can: + + - respond to execute, request, poke and advice start/stop + - send advise data to client + + Note that this limits the server in the ways it can send data to the + client, i.e. it can't send unsolicited information. + * + */ + +class WXDLLIMPEXP_FWD_NET wxTCPServer; +class WXDLLIMPEXP_FWD_NET wxTCPClient; + +class WXDLLIMPEXP_NET wxTCPConnection: public wxConnectionBase +{ + DECLARE_DYNAMIC_CLASS(wxTCPConnection) + +public: + wxTCPConnection(wxChar *buffer, int size); + wxTCPConnection(); + virtual ~wxTCPConnection(); + + // Calls that CLIENT can make + virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); + virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + virtual bool StartAdvise(const wxString& item); + virtual bool StopAdvise(const wxString& item); + + // Calls that SERVER can make + virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); + + // Calls that both can make + virtual bool Disconnect(void); + + // Callbacks to BOTH - override at will + // Default behaviour is to delete connection and return true + virtual bool OnDisconnect(void) { delete this; return true; } + + // To enable the compressor (NOTE: not implemented!) + void Compress(bool on); + + // unhide the Execute overload from wxConnectionBase + virtual bool Execute(const wxString& str) + { return Execute(str, -1, wxIPC_TEXT); } + +protected: + wxSocketBase *m_sock; + wxSocketStream *m_sockstrm; + wxDataInputStream *m_codeci; + wxDataOutputStream *m_codeco; + wxString m_topic; + + friend class wxTCPServer; + friend class wxTCPClient; + friend class wxTCPEventHandler; + + DECLARE_NO_COPY_CLASS(wxTCPConnection) +}; + +class WXDLLIMPEXP_NET wxTCPServer: public wxServerBase +{ +public: + wxTCPConnection *topLevelConnection; + + wxTCPServer(); + virtual ~wxTCPServer(); + + // Returns false on error (e.g. port number is already in use) + virtual bool Create(const wxString& serverName); + + // Callbacks to SERVER - override at will + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); + +protected: + wxSocketServer *m_server; + +#ifdef __UNIX_LIKE__ + // the name of the file associated to the Unix domain socket, may be empty + wxString m_filename; +#endif // __UNIX_LIKE__ + + DECLARE_NO_COPY_CLASS(wxTCPServer) + DECLARE_DYNAMIC_CLASS(wxTCPServer) +}; + +class WXDLLIMPEXP_NET wxTCPClient: public wxClientBase +{ +public: + wxTCPClient(); + virtual ~wxTCPClient(); + + virtual bool ValidHost(const wxString& host); + + // Call this to make a connection. Returns NULL if cannot. + virtual wxConnectionBase *MakeConnection(const wxString& host, + const wxString& server, + const wxString& topic); + + // Callbacks to CLIENT - override at will + virtual wxConnectionBase *OnMakeConnection(); + +private: + DECLARE_DYNAMIC_CLASS(wxTCPClient) +}; + +#endif // wxUSE_SOCKETS && wxUSE_IPC + +#endif // _WX_SCKIPC_H diff --git a/Externals/wxWidgets/include/wx/sckstrm.h b/Externals/wxWidgets/include/wx/sckstrm.h index d85b1c1e2f..30d09604e6 100644 --- a/Externals/wxWidgets/include/wx/sckstrm.h +++ b/Externals/wxWidgets/include/wx/sckstrm.h @@ -1,72 +1,72 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sckstrm.h -// Purpose: wxSocket*Stream -// Author: Guilhem Lavaux -// Modified by: -// Created: 17/07/97 -// RCS-ID: $Id: sckstrm.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -#ifndef __SCK_STREAM_H__ -#define __SCK_STREAM_H__ - -#include "wx/stream.h" - -#if wxUSE_SOCKETS && wxUSE_STREAMS - -#include "wx/socket.h" - -class WXDLLIMPEXP_NET wxSocketOutputStream : public wxOutputStream -{ - public: - wxSocketOutputStream(wxSocketBase& s); - virtual ~wxSocketOutputStream(); - - wxFileOffset SeekO( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) - { return -1; } - wxFileOffset TellO() const - { return -1; } - - protected: - wxSocketBase *m_o_socket; - - size_t OnSysWrite(const void *buffer, size_t bufsize); - - DECLARE_NO_COPY_CLASS(wxSocketOutputStream) -}; - -class WXDLLIMPEXP_NET wxSocketInputStream : public wxInputStream -{ - public: - wxSocketInputStream(wxSocketBase& s); - virtual ~wxSocketInputStream(); - - wxFileOffset SeekI( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) - { return -1; } - wxFileOffset TellI() const - { return -1; } - - protected: - wxSocketBase *m_i_socket; - - size_t OnSysRead(void *buffer, size_t bufsize); - - DECLARE_NO_COPY_CLASS(wxSocketInputStream) -}; - -class WXDLLIMPEXP_NET wxSocketStream : public wxSocketInputStream, - public wxSocketOutputStream -{ - public: - wxSocketStream(wxSocketBase& s); - virtual ~wxSocketStream(); - - DECLARE_NO_COPY_CLASS(wxSocketStream) -}; - -#endif - // wxUSE_SOCKETS && wxUSE_STREAMS - -#endif - // __SCK_STREAM_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: sckstrm.h +// Purpose: wxSocket*Stream +// Author: Guilhem Lavaux +// Modified by: +// Created: 17/07/97 +// RCS-ID: $Id: sckstrm.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef __SCK_STREAM_H__ +#define __SCK_STREAM_H__ + +#include "wx/stream.h" + +#if wxUSE_SOCKETS && wxUSE_STREAMS + +#include "wx/socket.h" + +class WXDLLIMPEXP_NET wxSocketOutputStream : public wxOutputStream +{ + public: + wxSocketOutputStream(wxSocketBase& s); + virtual ~wxSocketOutputStream(); + + wxFileOffset SeekO( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) + { return -1; } + wxFileOffset TellO() const + { return -1; } + + protected: + wxSocketBase *m_o_socket; + + size_t OnSysWrite(const void *buffer, size_t bufsize); + + DECLARE_NO_COPY_CLASS(wxSocketOutputStream) +}; + +class WXDLLIMPEXP_NET wxSocketInputStream : public wxInputStream +{ + public: + wxSocketInputStream(wxSocketBase& s); + virtual ~wxSocketInputStream(); + + wxFileOffset SeekI( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) + { return -1; } + wxFileOffset TellI() const + { return -1; } + + protected: + wxSocketBase *m_i_socket; + + size_t OnSysRead(void *buffer, size_t bufsize); + + DECLARE_NO_COPY_CLASS(wxSocketInputStream) +}; + +class WXDLLIMPEXP_NET wxSocketStream : public wxSocketInputStream, + public wxSocketOutputStream +{ + public: + wxSocketStream(wxSocketBase& s); + virtual ~wxSocketStream(); + + DECLARE_NO_COPY_CLASS(wxSocketStream) +}; + +#endif + // wxUSE_SOCKETS && wxUSE_STREAMS + +#endif + // __SCK_STREAM_H__ diff --git a/Externals/wxWidgets/include/wx/scopeguard.h b/Externals/wxWidgets/include/wx/scopeguard.h index 2517e86e4a..155a4f5496 100644 --- a/Externals/wxWidgets/include/wx/scopeguard.h +++ b/Externals/wxWidgets/include/wx/scopeguard.h @@ -1,373 +1,373 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/scopeguard.h -// Purpose: declares wxwxScopeGuard and related macros -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.07.2003 -// RCS-ID: $Id: scopeguard.h 44111 2007-01-07 13:28:16Z SN $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - Acknowledgements: this header is heavily based on (well, almost the exact - copy of) ScopeGuard.h by Andrei Alexandrescu and Petru Marginean published - in December 2000 issue of C/C++ Users Journal. - http://www.cuj.com/documents/cujcexp1812alexandr/ - */ - -#ifndef _WX_SCOPEGUARD_H_ -#define _WX_SCOPEGUARD_H_ - -#include "wx/defs.h" - -#include "wx/except.h" - -// ---------------------------------------------------------------------------- -// helpers -// ---------------------------------------------------------------------------- - -#ifdef __WATCOMC__ - -// WATCOM-FIXME: C++ of Open Watcom 1.3 doesn't like OnScopeExit() created -// through template so it must be workarounded with dedicated inlined macro. -// For compatibility with Watcom compilers wxPrivate::OnScopeExit must be -// replaced with wxPrivateOnScopeExit but in user code (for everyone who -// doesn't care about OW compatibility) wxPrivate::OnScopeExit still works. - -#define wxPrivateOnScopeExit(guard) \ - { \ - if ( !(guard).WasDismissed() ) \ - { \ - wxTRY \ - { \ - (guard).Execute(); \ - } \ - wxCATCH_ALL(;) \ - } \ - } - -#define wxPrivateUse(n) wxUnusedVar(n) - -#else - -#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) -// namespace support was first implemented in gcc-2.95, -// so avoid using it for older versions. -namespace wxPrivate -{ -#else -#define wxPrivate -#endif - // in the original implementation this was a member template function of - // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't - // support member templates and so we must make it global - template <class ScopeGuardImpl> - void OnScopeExit(ScopeGuardImpl& guard) - { - if ( !guard.WasDismissed() ) - { - // we're called from ScopeGuardImpl dtor and so we must not throw - wxTRY - { - guard.Execute(); - } - wxCATCH_ALL(;) // do nothing, just eat the exception - } - } - - // just to avoid the warning about unused variables - template <class T> - void Use(const T& WXUNUSED(t)) - { - } -#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) -} // namespace wxPrivate -#endif - -#define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n) -#define wxPrivateUse(n) wxPrivate::Use(n) - -#endif - -// ============================================================================ -// wxScopeGuard for functions and functors -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxScopeGuardImplBase: used by wxScopeGuardImpl[0..N] below -// ---------------------------------------------------------------------------- - -class wxScopeGuardImplBase -{ -public: - wxScopeGuardImplBase() : m_wasDismissed(false) { } - - void Dismiss() const { m_wasDismissed = true; } - - // for OnScopeExit() only (we can't make it friend, unfortunately)! - bool WasDismissed() const { return m_wasDismissed; } - -protected: - ~wxScopeGuardImplBase() { } - - wxScopeGuardImplBase(const wxScopeGuardImplBase& other) - : m_wasDismissed(other.m_wasDismissed) - { - other.Dismiss(); - } - - // must be mutable for copy ctor to work - mutable bool m_wasDismissed; - -private: - wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&); -}; - -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl0: scope guard for actions without parameters -// ---------------------------------------------------------------------------- - -template <class F> -class wxScopeGuardImpl0 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl0<F> MakeGuard(F fun) - { - return wxScopeGuardImpl0<F>(fun); - } - - ~wxScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_fun(); } - -protected: - wxScopeGuardImpl0(F fun) : m_fun(fun) { } - - F m_fun; - - wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&); -}; - -template <class F> -inline wxScopeGuardImpl0<F> wxMakeGuard(F fun) -{ - return wxScopeGuardImpl0<F>::MakeGuard(fun); -} - -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl1: scope guard for actions with 1 parameter -// ---------------------------------------------------------------------------- - -template <class F, class P1> -class wxScopeGuardImpl1 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) - { - return wxScopeGuardImpl1<F, P1>(fun, p1); - } - - ~wxScopeGuardImpl1() { wxPrivateOnScopeExit(* this); } - - void Execute() { m_fun(m_p1); } - -protected: - wxScopeGuardImpl1(F fun, P1 p1) : m_fun(fun), m_p1(p1) { } - - F m_fun; - const P1 m_p1; - - wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&); -}; - -template <class F, class P1> -inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1) -{ - return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1); -} - -// ---------------------------------------------------------------------------- -// wxScopeGuardImpl2: scope guard for actions with 2 parameters -// ---------------------------------------------------------------------------- - -template <class F, class P1, class P2> -class wxScopeGuardImpl2 : public wxScopeGuardImplBase -{ -public: - static wxScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) - { - return wxScopeGuardImpl2<F, P1, P2>(fun, p1, p2); - } - - ~wxScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } - - void Execute() { m_fun(m_p1, m_p2); } - -protected: - wxScopeGuardImpl2(F fun, P1 p1, P2 p2) : m_fun(fun), m_p1(p1), m_p2(p2) { } - - F m_fun; - const P1 m_p1; - const P2 m_p2; - - wxScopeGuardImpl2& operator=(const wxScopeGuardImpl2&); -}; - -template <class F, class P1, class P2> -inline wxScopeGuardImpl2<F, P1, P2> wxMakeGuard(F fun, P1 p1, P2 p2) -{ - return wxScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2); -} - -// ============================================================================ -// wxScopeGuards for object methods -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxObjScopeGuardImpl0 -// ---------------------------------------------------------------------------- - -template <class Obj, class MemFun> -class wxObjScopeGuardImpl0 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl0<Obj, MemFun> - MakeObjGuard(Obj& obj, MemFun memFun) - { - return wxObjScopeGuardImpl0<Obj, MemFun>(obj, memFun); - } - - ~wxObjScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(); } - -protected: - wxObjScopeGuardImpl0(Obj& obj, MemFun memFun) - : m_obj(obj), m_memfun(memFun) { } - - Obj& m_obj; - MemFun m_memfun; -}; - -template <class Obj, class MemFun> -inline wxObjScopeGuardImpl0<Obj, MemFun> wxMakeObjGuard(Obj& obj, MemFun memFun) -{ - return wxObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun); -} - -template <class Obj, class MemFun, class P1> -class wxObjScopeGuardImpl1 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl1<Obj, MemFun, P1> - MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) - { - return wxObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1); - } - - ~wxObjScopeGuardImpl1() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(m_p1); } - -protected: - wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) - : m_obj(obj), m_memfun(memFun), m_p1(p1) { } - - Obj& m_obj; - MemFun m_memfun; - const P1 m_p1; -}; - -template <class Obj, class MemFun, class P1> -inline wxObjScopeGuardImpl1<Obj, MemFun, P1> -wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1) -{ - return wxObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1); -} - -template <class Obj, class MemFun, class P1, class P2> -class wxObjScopeGuardImpl2 : public wxScopeGuardImplBase -{ -public: - static wxObjScopeGuardImpl2<Obj, MemFun, P1, P2> - MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) - { - return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2); - } - - ~wxObjScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } - - void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); } - -protected: - wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) - : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { } - - Obj& m_obj; - MemFun m_memfun; - const P1 m_p1; - const P2 m_p2; -}; - -template <class Obj, class MemFun, class P1, class P2> -inline wxObjScopeGuardImpl2<Obj, MemFun, P1, P2> -wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) -{ - return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>:: - MakeObjGuard(obj, memFun, p1, p2); -} - -// ============================================================================ -// public stuff -// ============================================================================ - -// wxScopeGuard is just a reference, see the explanation in CUJ article -typedef const wxScopeGuardImplBase& wxScopeGuard; - -// when an unnamed scope guard is needed, the macros below may be used -// -// NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro -// but this results in compiler warnings about unused variables and I -// didn't find a way to work around this other than by having different -// macros with different names - -#define wxGuardName wxMAKE_UNIQUE_NAME(scopeGuard) - -#define wxON_BLOCK_EXIT0_IMPL(n, f) \ - wxScopeGuard n = wxMakeGuard(f); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT0(f) \ - wxON_BLOCK_EXIT0_IMPL(wxGuardName, f) - -#define wxON_BLOCK_EXIT_OBJ0_IMPL(n, o, m) \ - wxScopeGuard n = wxMakeObjGuard(o, m); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ0(o, m) \ - wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m) - -#define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \ - wxScopeGuard n = wxMakeGuard(f, p1); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT1(f, p1) \ - wxON_BLOCK_EXIT1_IMPL(wxGuardName, f, p1) - -#define wxON_BLOCK_EXIT_OBJ1_IMPL(n, o, m, p1) \ - wxScopeGuard n = wxMakeObjGuard(o, m, p1); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \ - wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1) - -#define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \ - wxScopeGuard n = wxMakeGuard(f, p1, p2); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT2(f, p1, p2) \ - wxON_BLOCK_EXIT2_IMPL(wxGuardName, f, p1, p2) - -#define wxON_BLOCK_EXIT_OBJ2_IMPL(n, o, m, p1, p2) \ - wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2); \ - wxPrivateUse(n) -#define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \ - wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2) - -#endif // _WX_SCOPEGUARD_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/scopeguard.h +// Purpose: declares wxwxScopeGuard and related macros +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.07.2003 +// RCS-ID: $Id: scopeguard.h 44111 2007-01-07 13:28:16Z SN $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + Acknowledgements: this header is heavily based on (well, almost the exact + copy of) ScopeGuard.h by Andrei Alexandrescu and Petru Marginean published + in December 2000 issue of C/C++ Users Journal. + http://www.cuj.com/documents/cujcexp1812alexandr/ + */ + +#ifndef _WX_SCOPEGUARD_H_ +#define _WX_SCOPEGUARD_H_ + +#include "wx/defs.h" + +#include "wx/except.h" + +// ---------------------------------------------------------------------------- +// helpers +// ---------------------------------------------------------------------------- + +#ifdef __WATCOMC__ + +// WATCOM-FIXME: C++ of Open Watcom 1.3 doesn't like OnScopeExit() created +// through template so it must be workarounded with dedicated inlined macro. +// For compatibility with Watcom compilers wxPrivate::OnScopeExit must be +// replaced with wxPrivateOnScopeExit but in user code (for everyone who +// doesn't care about OW compatibility) wxPrivate::OnScopeExit still works. + +#define wxPrivateOnScopeExit(guard) \ + { \ + if ( !(guard).WasDismissed() ) \ + { \ + wxTRY \ + { \ + (guard).Execute(); \ + } \ + wxCATCH_ALL(;) \ + } \ + } + +#define wxPrivateUse(n) wxUnusedVar(n) + +#else + +#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) +// namespace support was first implemented in gcc-2.95, +// so avoid using it for older versions. +namespace wxPrivate +{ +#else +#define wxPrivate +#endif + // in the original implementation this was a member template function of + // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't + // support member templates and so we must make it global + template <class ScopeGuardImpl> + void OnScopeExit(ScopeGuardImpl& guard) + { + if ( !guard.WasDismissed() ) + { + // we're called from ScopeGuardImpl dtor and so we must not throw + wxTRY + { + guard.Execute(); + } + wxCATCH_ALL(;) // do nothing, just eat the exception + } + } + + // just to avoid the warning about unused variables + template <class T> + void Use(const T& WXUNUSED(t)) + { + } +#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 95) +} // namespace wxPrivate +#endif + +#define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n) +#define wxPrivateUse(n) wxPrivate::Use(n) + +#endif + +// ============================================================================ +// wxScopeGuard for functions and functors +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxScopeGuardImplBase: used by wxScopeGuardImpl[0..N] below +// ---------------------------------------------------------------------------- + +class wxScopeGuardImplBase +{ +public: + wxScopeGuardImplBase() : m_wasDismissed(false) { } + + void Dismiss() const { m_wasDismissed = true; } + + // for OnScopeExit() only (we can't make it friend, unfortunately)! + bool WasDismissed() const { return m_wasDismissed; } + +protected: + ~wxScopeGuardImplBase() { } + + wxScopeGuardImplBase(const wxScopeGuardImplBase& other) + : m_wasDismissed(other.m_wasDismissed) + { + other.Dismiss(); + } + + // must be mutable for copy ctor to work + mutable bool m_wasDismissed; + +private: + wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&); +}; + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl0: scope guard for actions without parameters +// ---------------------------------------------------------------------------- + +template <class F> +class wxScopeGuardImpl0 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl0<F> MakeGuard(F fun) + { + return wxScopeGuardImpl0<F>(fun); + } + + ~wxScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_fun(); } + +protected: + wxScopeGuardImpl0(F fun) : m_fun(fun) { } + + F m_fun; + + wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&); +}; + +template <class F> +inline wxScopeGuardImpl0<F> wxMakeGuard(F fun) +{ + return wxScopeGuardImpl0<F>::MakeGuard(fun); +} + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl1: scope guard for actions with 1 parameter +// ---------------------------------------------------------------------------- + +template <class F, class P1> +class wxScopeGuardImpl1 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) + { + return wxScopeGuardImpl1<F, P1>(fun, p1); + } + + ~wxScopeGuardImpl1() { wxPrivateOnScopeExit(* this); } + + void Execute() { m_fun(m_p1); } + +protected: + wxScopeGuardImpl1(F fun, P1 p1) : m_fun(fun), m_p1(p1) { } + + F m_fun; + const P1 m_p1; + + wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&); +}; + +template <class F, class P1> +inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1) +{ + return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1); +} + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl2: scope guard for actions with 2 parameters +// ---------------------------------------------------------------------------- + +template <class F, class P1, class P2> +class wxScopeGuardImpl2 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) + { + return wxScopeGuardImpl2<F, P1, P2>(fun, p1, p2); + } + + ~wxScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_fun(m_p1, m_p2); } + +protected: + wxScopeGuardImpl2(F fun, P1 p1, P2 p2) : m_fun(fun), m_p1(p1), m_p2(p2) { } + + F m_fun; + const P1 m_p1; + const P2 m_p2; + + wxScopeGuardImpl2& operator=(const wxScopeGuardImpl2&); +}; + +template <class F, class P1, class P2> +inline wxScopeGuardImpl2<F, P1, P2> wxMakeGuard(F fun, P1 p1, P2 p2) +{ + return wxScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2); +} + +// ============================================================================ +// wxScopeGuards for object methods +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxObjScopeGuardImpl0 +// ---------------------------------------------------------------------------- + +template <class Obj, class MemFun> +class wxObjScopeGuardImpl0 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl0<Obj, MemFun> + MakeObjGuard(Obj& obj, MemFun memFun) + { + return wxObjScopeGuardImpl0<Obj, MemFun>(obj, memFun); + } + + ~wxObjScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(); } + +protected: + wxObjScopeGuardImpl0(Obj& obj, MemFun memFun) + : m_obj(obj), m_memfun(memFun) { } + + Obj& m_obj; + MemFun m_memfun; +}; + +template <class Obj, class MemFun> +inline wxObjScopeGuardImpl0<Obj, MemFun> wxMakeObjGuard(Obj& obj, MemFun memFun) +{ + return wxObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun); +} + +template <class Obj, class MemFun, class P1> +class wxObjScopeGuardImpl1 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl1<Obj, MemFun, P1> + MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) + { + return wxObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1); + } + + ~wxObjScopeGuardImpl1() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(m_p1); } + +protected: + wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) + : m_obj(obj), m_memfun(memFun), m_p1(p1) { } + + Obj& m_obj; + MemFun m_memfun; + const P1 m_p1; +}; + +template <class Obj, class MemFun, class P1> +inline wxObjScopeGuardImpl1<Obj, MemFun, P1> +wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1) +{ + return wxObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1); +} + +template <class Obj, class MemFun, class P1, class P2> +class wxObjScopeGuardImpl2 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl2<Obj, MemFun, P1, P2> + MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) + { + return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2); + } + + ~wxObjScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); } + +protected: + wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) + : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { } + + Obj& m_obj; + MemFun m_memfun; + const P1 m_p1; + const P2 m_p2; +}; + +template <class Obj, class MemFun, class P1, class P2> +inline wxObjScopeGuardImpl2<Obj, MemFun, P1, P2> +wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) +{ + return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>:: + MakeObjGuard(obj, memFun, p1, p2); +} + +// ============================================================================ +// public stuff +// ============================================================================ + +// wxScopeGuard is just a reference, see the explanation in CUJ article +typedef const wxScopeGuardImplBase& wxScopeGuard; + +// when an unnamed scope guard is needed, the macros below may be used +// +// NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro +// but this results in compiler warnings about unused variables and I +// didn't find a way to work around this other than by having different +// macros with different names + +#define wxGuardName wxMAKE_UNIQUE_NAME(scopeGuard) + +#define wxON_BLOCK_EXIT0_IMPL(n, f) \ + wxScopeGuard n = wxMakeGuard(f); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT0(f) \ + wxON_BLOCK_EXIT0_IMPL(wxGuardName, f) + +#define wxON_BLOCK_EXIT_OBJ0_IMPL(n, o, m) \ + wxScopeGuard n = wxMakeObjGuard(o, m); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ0(o, m) \ + wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m) + +#define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \ + wxScopeGuard n = wxMakeGuard(f, p1); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT1(f, p1) \ + wxON_BLOCK_EXIT1_IMPL(wxGuardName, f, p1) + +#define wxON_BLOCK_EXIT_OBJ1_IMPL(n, o, m, p1) \ + wxScopeGuard n = wxMakeObjGuard(o, m, p1); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \ + wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1) + +#define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \ + wxScopeGuard n = wxMakeGuard(f, p1, p2); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT2(f, p1, p2) \ + wxON_BLOCK_EXIT2_IMPL(wxGuardName, f, p1, p2) + +#define wxON_BLOCK_EXIT_OBJ2_IMPL(n, o, m, p1, p2) \ + wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \ + wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2) + +#endif // _WX_SCOPEGUARD_H_ diff --git a/Externals/wxWidgets/include/wx/scrolbar.h b/Externals/wxWidgets/include/wx/scrolbar.h index 97dab1af92..1a243b5e0e 100644 --- a/Externals/wxWidgets/include/wx/scrolbar.h +++ b/Externals/wxWidgets/include/wx/scrolbar.h @@ -1,80 +1,80 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: scrolbar.h -// Purpose: wxScrollBar base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: scrolbar.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCROLBAR_H_BASE_ -#define _WX_SCROLBAR_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_SCROLLBAR - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxScrollBarNameStr[]; - -// ---------------------------------------------------------------------------- -// wxScrollBar: a scroll bar control -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollBarBase : public wxControl -{ -public: - wxScrollBarBase() { } - - // scrollbar construction - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - - // accessors - virtual int GetThumbPosition() const = 0; - virtual int GetThumbSize() const = 0; - virtual int GetPageSize() const = 0; - virtual int GetRange() const = 0; - - bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; } - - // operations - virtual void SetThumbPosition(int viewStart) = 0; - virtual void SetScrollbar(int position, int thumbSize, - int range, int pageSize, - bool refresh = true) = 0; - -private: - DECLARE_NO_COPY_CLASS(wxScrollBarBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/scrolbar.h" -#elif defined(__WXMSW__) - #include "wx/msw/scrolbar.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/scrolbar.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/scrolbar.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/scrolbar.h" -#elif defined(__WXMAC__) - #include "wx/mac/scrolbar.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/scrolbar.h" -#elif defined(__WXPM__) - #include "wx/os2/scrolbar.h" -#endif - -#endif // wxUSE_SCROLLBAR - -#endif - // _WX_SCROLBAR_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: scrolbar.h +// Purpose: wxScrollBar base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: scrolbar.h 37066 2006-01-23 03:27:34Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_BASE_ +#define _WX_SCROLBAR_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SCROLLBAR + +#include "wx/control.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxScrollBarNameStr[]; + +// ---------------------------------------------------------------------------- +// wxScrollBar: a scroll bar control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrollBarBase : public wxControl +{ +public: + wxScrollBarBase() { } + + // scrollbar construction + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr); + + // accessors + virtual int GetThumbPosition() const = 0; + virtual int GetThumbSize() const = 0; + virtual int GetPageSize() const = 0; + virtual int GetRange() const = 0; + + bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; } + + // operations + virtual void SetThumbPosition(int viewStart) = 0; + virtual void SetScrollbar(int position, int thumbSize, + int range, int pageSize, + bool refresh = true) = 0; + +private: + DECLARE_NO_COPY_CLASS(wxScrollBarBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/scrolbar.h" +#elif defined(__WXMSW__) + #include "wx/msw/scrolbar.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/scrolbar.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/scrolbar.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/scrolbar.h" +#elif defined(__WXMAC__) + #include "wx/mac/scrolbar.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/scrolbar.h" +#elif defined(__WXPM__) + #include "wx/os2/scrolbar.h" +#endif + +#endif // wxUSE_SCROLLBAR + +#endif + // _WX_SCROLBAR_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/scrolwin.h b/Externals/wxWidgets/include/wx/scrolwin.h index c5d06fa1e2..95827f8c78 100644 --- a/Externals/wxWidgets/include/wx/scrolwin.h +++ b/Externals/wxWidgets/include/wx/scrolwin.h @@ -1,314 +1,314 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/scrolwin.h -// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.08.00 -// RCS-ID: $Id: scrolwin.h 50864 2007-12-20 18:36:19Z VS $ -// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SCROLWIN_H_BASE_ -#define _WX_SCROLWIN_H_BASE_ - -#include "wx/panel.h" - -class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; -class WXDLLIMPEXP_FWD_CORE wxTimer; - -// default scrolled window style: scroll in both directions -#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) - -// ---------------------------------------------------------------------------- -// The hierarchy of scrolling classes is a bit complicated because we want to -// put as much functionality as possible in a mix-in class not deriving from -// wxWindow so that other classes could derive from the same base class on all -// platforms irrespectively of whether they are native controls (and hence -// don't use our scrolling) or not. -// -// So we have -// -// wxScrollHelper -// | -// | -// \|/ -// wxWindow wxScrollHelperNative -// | \ / / -// | \ / / -// | _| |_ / -// | wxScrolledWindow / -// | / -// \|/ / -// wxControl / -// \ / -// \ / -// _| |_ -// wxScrolledControl -// -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollHelper -{ -public: - // ctor must be given the associated window - wxScrollHelper(wxWindow *winToScroll); - virtual ~wxScrollHelper(); - - // configure the scrolling - virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, - int noUnitsX, int noUnitsY, - int xPos = 0, int yPos = 0, - bool noRefresh = false ); - - // scroll to the given (in logical coords) position - virtual void Scroll(int x, int y); - - // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) - int GetScrollPageSize(int orient) const; - void SetScrollPageSize(int orient, int pageSize); - - // get the number of lines the window can scroll, - // returns 0 if no scrollbars are there. - int GetScrollLines( int orient ) const; - - // Set the x, y scrolling increments. - void SetScrollRate( int xstep, int ystep ); - - // get the size of one logical unit in physical ones - virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX, - int *pixelsPerUnitY) const; - - // Enable/disable Windows scrolling in either direction. If true, wxWidgets - // scrolls the canvas and only a bit of the canvas is invalidated; no - // Clear() is necessary. If false, the whole canvas is invalidated and a - // Clear() is necessary. Disable for when the scroll increment is used to - // actually scroll a non-constant distance - virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); - - // Get the view start - virtual void GetViewStart(int *x, int *y) const; - - // Set the scale factor, used in PrepareDC - void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } - double GetScaleX() const { return m_scaleX; } - double GetScaleY() const { return m_scaleY; } - - // translate between scrolled and unscrolled coordinates - void CalcScrolledPosition(int x, int y, int *xx, int *yy) const - { DoCalcScrolledPosition(x, y, xx, yy); } - wxPoint CalcScrolledPosition(const wxPoint& pt) const - { - wxPoint p2; - DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y); - return p2; - } - - void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const - { DoCalcUnscrolledPosition(x, y, xx, yy); } - wxPoint CalcUnscrolledPosition(const wxPoint& pt) const - { - wxPoint p2; - DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y); - return p2; - } - - virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; - virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; - - // Adjust the scrollbars - virtual void AdjustScrollbars(void); - - // Calculate scroll increment - virtual int CalcScrollInc(wxScrollWinEvent& event); - - // Normally the wxScrolledWindow will scroll itself, but in some rare - // occasions you might want it to scroll [part of] another window (e.g. a - // child of it in order to scroll only a portion the area between the - // scrollbars (spreadsheet: only cell area will move). - virtual void SetTargetWindow(wxWindow *target); - virtual wxWindow *GetTargetWindow() const; - - void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } - wxRect GetTargetRect() const { return m_rectToScroll; } - - // Override this function to draw the graphic (or just process EVT_PAINT) - virtual void OnDraw(wxDC& WXUNUSED(dc)) { } - - // change the DC origin according to the scroll position. - virtual void DoPrepareDC(wxDC& dc); - - // are we generating the autoscroll events? - bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } - - // stop generating the scroll events when mouse is held outside the window - void StopAutoScrolling(); - - // this method can be overridden in a derived class to forbid sending the - // auto scroll events - note that unlike StopAutoScrolling() it doesn't - // stop the timer, so it will be called repeatedly and will typically - // return different values depending on the current mouse position - // - // the base class version just returns true - virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; - - // the methods to be called from the window event handlers - void HandleOnScroll(wxScrollWinEvent& event); - void HandleOnSize(wxSizeEvent& event); - void HandleOnPaint(wxPaintEvent& event); - void HandleOnChar(wxKeyEvent& event); - void HandleOnMouseEnter(wxMouseEvent& event); - void HandleOnMouseLeave(wxMouseEvent& event); -#if wxUSE_MOUSEWHEEL - void HandleOnMouseWheel(wxMouseEvent& event); -#endif // wxUSE_MOUSEWHEEL - -#if wxABI_VERSION >= 20808 - void HandleOnChildFocus(wxChildFocusEvent& event); -#endif - - // FIXME: this is needed for now for wxPlot compilation, should be removed - // once it is fixed! - void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } - -protected: - // get pointer to our scroll rect if we use it or NULL - const wxRect *GetScrollRect() const - { - return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; - } - - // get the size of the target window - wxSize GetTargetSize() const - { - return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize() - : m_targetWindow->GetClientSize(); - } - - void GetTargetSize(int *w, int *h) const - { - wxSize size = GetTargetSize(); - if ( w ) - *w = size.x; - if ( h ) - *h = size.y; - } - - // implementations of various wxWindow virtual methods which should be - // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) - bool ScrollLayout(); - void ScrollDoSetVirtualSize(int x, int y); - wxSize ScrollGetBestVirtualSize() const; - wxSize ScrollGetWindowSizeForVirtualSize(const wxSize& size) const; - - // change just the target window (unlike SetWindow which changes m_win as - // well) - void DoSetTargetWindow(wxWindow *target); - - // delete the event handler we installed - void DeleteEvtHandler(); - - - double m_scaleX; - double m_scaleY; - - wxWindow *m_win, - *m_targetWindow; - - wxRect m_rectToScroll; - - wxTimer *m_timerAutoScroll; - - int m_xScrollPixelsPerLine; - int m_yScrollPixelsPerLine; - int m_xScrollPosition; - int m_yScrollPosition; - int m_xScrollLines; - int m_yScrollLines; - int m_xScrollLinesPerPage; - int m_yScrollLinesPerPage; - - bool m_xScrollingEnabled; - bool m_yScrollingEnabled; - -#if wxUSE_MOUSEWHEEL - int m_wheelRotation; -#endif // wxUSE_MOUSEWHEEL - - wxScrollHelperEvtHandler *m_handler; - - DECLARE_NO_COPY_CLASS(wxScrollHelper) -}; - -// this macro can be used in a wxScrollHelper-derived class to forward wxWindow -// methods to corresponding wxScrollHelper methods -#define WX_FORWARD_TO_SCROLL_HELPER() \ -public: \ - virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ - virtual bool Layout() { return ScrollLayout(); } \ - virtual void DoSetVirtualSize(int x, int y) \ - { ScrollDoSetVirtualSize(x, y); } \ - virtual wxSize GetBestVirtualSize() const \ - { return ScrollGetBestVirtualSize(); } \ -protected: \ - virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const \ - { return ScrollGetWindowSizeForVirtualSize(size); } - -// include the declaration of wxScrollHelperNative if needed -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk/scrolwin.h" -#elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) - #include "wx/gtk1/scrolwin.h" -#else - typedef wxScrollHelper wxScrollHelperNative; -#endif - -// ---------------------------------------------------------------------------- -// wxScrolledWindow: a wxWindow which knows how to scroll -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrolledWindow : public wxPanel, - public wxScrollHelperNative -{ -public: - wxScrolledWindow() : wxScrollHelperNative(this) { } - wxScrolledWindow(wxWindow *parent, - wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxScrolledWindowStyle, - const wxString& name = wxPanelNameStr) - : wxScrollHelperNative(this) - { - Create(parent, winid, pos, size, style, name); - } - - virtual ~wxScrolledWindow(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxScrolledWindowStyle, - const wxString& name = wxPanelNameStr); - - // we need to return a special WM_GETDLGCODE value to process just the - // arrows but let the other navigation characters through -#ifdef __WXMSW__ - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); -#endif // __WXMSW__ - - WX_FORWARD_TO_SCROLL_HELPER() - -protected: - // this is needed for wxEVT_PAINT processing hack described in - // wxScrollHelperEvtHandler::ProcessEvent() - void OnPaint(wxPaintEvent& event); - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_SCROLWIN_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/scrolwin.h +// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// RCS-ID: $Id: scrolwin.h 50864 2007-12-20 18:36:19Z VS $ +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLWIN_H_BASE_ +#define _WX_SCROLWIN_H_BASE_ + +#include "wx/panel.h" + +class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; +class WXDLLIMPEXP_FWD_CORE wxTimer; + +// default scrolled window style: scroll in both directions +#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) + +// ---------------------------------------------------------------------------- +// The hierarchy of scrolling classes is a bit complicated because we want to +// put as much functionality as possible in a mix-in class not deriving from +// wxWindow so that other classes could derive from the same base class on all +// platforms irrespectively of whether they are native controls (and hence +// don't use our scrolling) or not. +// +// So we have +// +// wxScrollHelper +// | +// | +// \|/ +// wxWindow wxScrollHelperNative +// | \ / / +// | \ / / +// | _| |_ / +// | wxScrolledWindow / +// | / +// \|/ / +// wxControl / +// \ / +// \ / +// _| |_ +// wxScrolledControl +// +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrollHelper +{ +public: + // ctor must be given the associated window + wxScrollHelper(wxWindow *winToScroll); + virtual ~wxScrollHelper(); + + // configure the scrolling + virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, + int noUnitsX, int noUnitsY, + int xPos = 0, int yPos = 0, + bool noRefresh = false ); + + // scroll to the given (in logical coords) position + virtual void Scroll(int x, int y); + + // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) + int GetScrollPageSize(int orient) const; + void SetScrollPageSize(int orient, int pageSize); + + // get the number of lines the window can scroll, + // returns 0 if no scrollbars are there. + int GetScrollLines( int orient ) const; + + // Set the x, y scrolling increments. + void SetScrollRate( int xstep, int ystep ); + + // get the size of one logical unit in physical ones + virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX, + int *pixelsPerUnitY) const; + + // Enable/disable Windows scrolling in either direction. If true, wxWidgets + // scrolls the canvas and only a bit of the canvas is invalidated; no + // Clear() is necessary. If false, the whole canvas is invalidated and a + // Clear() is necessary. Disable for when the scroll increment is used to + // actually scroll a non-constant distance + virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); + + // Get the view start + virtual void GetViewStart(int *x, int *y) const; + + // Set the scale factor, used in PrepareDC + void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } + double GetScaleX() const { return m_scaleX; } + double GetScaleY() const { return m_scaleY; } + + // translate between scrolled and unscrolled coordinates + void CalcScrolledPosition(int x, int y, int *xx, int *yy) const + { DoCalcScrolledPosition(x, y, xx, yy); } + wxPoint CalcScrolledPosition(const wxPoint& pt) const + { + wxPoint p2; + DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y); + return p2; + } + + void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const + { DoCalcUnscrolledPosition(x, y, xx, yy); } + wxPoint CalcUnscrolledPosition(const wxPoint& pt) const + { + wxPoint p2; + DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y); + return p2; + } + + virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; + virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; + + // Adjust the scrollbars + virtual void AdjustScrollbars(void); + + // Calculate scroll increment + virtual int CalcScrollInc(wxScrollWinEvent& event); + + // Normally the wxScrolledWindow will scroll itself, but in some rare + // occasions you might want it to scroll [part of] another window (e.g. a + // child of it in order to scroll only a portion the area between the + // scrollbars (spreadsheet: only cell area will move). + virtual void SetTargetWindow(wxWindow *target); + virtual wxWindow *GetTargetWindow() const; + + void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } + wxRect GetTargetRect() const { return m_rectToScroll; } + + // Override this function to draw the graphic (or just process EVT_PAINT) + virtual void OnDraw(wxDC& WXUNUSED(dc)) { } + + // change the DC origin according to the scroll position. + virtual void DoPrepareDC(wxDC& dc); + + // are we generating the autoscroll events? + bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } + + // stop generating the scroll events when mouse is held outside the window + void StopAutoScrolling(); + + // this method can be overridden in a derived class to forbid sending the + // auto scroll events - note that unlike StopAutoScrolling() it doesn't + // stop the timer, so it will be called repeatedly and will typically + // return different values depending on the current mouse position + // + // the base class version just returns true + virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; + + // the methods to be called from the window event handlers + void HandleOnScroll(wxScrollWinEvent& event); + void HandleOnSize(wxSizeEvent& event); + void HandleOnPaint(wxPaintEvent& event); + void HandleOnChar(wxKeyEvent& event); + void HandleOnMouseEnter(wxMouseEvent& event); + void HandleOnMouseLeave(wxMouseEvent& event); +#if wxUSE_MOUSEWHEEL + void HandleOnMouseWheel(wxMouseEvent& event); +#endif // wxUSE_MOUSEWHEEL + +#if wxABI_VERSION >= 20808 + void HandleOnChildFocus(wxChildFocusEvent& event); +#endif + + // FIXME: this is needed for now for wxPlot compilation, should be removed + // once it is fixed! + void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } + +protected: + // get pointer to our scroll rect if we use it or NULL + const wxRect *GetScrollRect() const + { + return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; + } + + // get the size of the target window + wxSize GetTargetSize() const + { + return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize() + : m_targetWindow->GetClientSize(); + } + + void GetTargetSize(int *w, int *h) const + { + wxSize size = GetTargetSize(); + if ( w ) + *w = size.x; + if ( h ) + *h = size.y; + } + + // implementations of various wxWindow virtual methods which should be + // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) + bool ScrollLayout(); + void ScrollDoSetVirtualSize(int x, int y); + wxSize ScrollGetBestVirtualSize() const; + wxSize ScrollGetWindowSizeForVirtualSize(const wxSize& size) const; + + // change just the target window (unlike SetWindow which changes m_win as + // well) + void DoSetTargetWindow(wxWindow *target); + + // delete the event handler we installed + void DeleteEvtHandler(); + + + double m_scaleX; + double m_scaleY; + + wxWindow *m_win, + *m_targetWindow; + + wxRect m_rectToScroll; + + wxTimer *m_timerAutoScroll; + + int m_xScrollPixelsPerLine; + int m_yScrollPixelsPerLine; + int m_xScrollPosition; + int m_yScrollPosition; + int m_xScrollLines; + int m_yScrollLines; + int m_xScrollLinesPerPage; + int m_yScrollLinesPerPage; + + bool m_xScrollingEnabled; + bool m_yScrollingEnabled; + +#if wxUSE_MOUSEWHEEL + int m_wheelRotation; +#endif // wxUSE_MOUSEWHEEL + + wxScrollHelperEvtHandler *m_handler; + + DECLARE_NO_COPY_CLASS(wxScrollHelper) +}; + +// this macro can be used in a wxScrollHelper-derived class to forward wxWindow +// methods to corresponding wxScrollHelper methods +#define WX_FORWARD_TO_SCROLL_HELPER() \ +public: \ + virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ + virtual bool Layout() { return ScrollLayout(); } \ + virtual void DoSetVirtualSize(int x, int y) \ + { ScrollDoSetVirtualSize(x, y); } \ + virtual wxSize GetBestVirtualSize() const \ + { return ScrollGetBestVirtualSize(); } \ +protected: \ + virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const \ + { return ScrollGetWindowSizeForVirtualSize(size); } + +// include the declaration of wxScrollHelperNative if needed +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/scrolwin.h" +#elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk1/scrolwin.h" +#else + typedef wxScrollHelper wxScrollHelperNative; +#endif + +// ---------------------------------------------------------------------------- +// wxScrolledWindow: a wxWindow which knows how to scroll +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrolledWindow : public wxPanel, + public wxScrollHelperNative +{ +public: + wxScrolledWindow() : wxScrollHelperNative(this) { } + wxScrolledWindow(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxPanelNameStr) + : wxScrollHelperNative(this) + { + Create(parent, winid, pos, size, style, name); + } + + virtual ~wxScrolledWindow(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxPanelNameStr); + + // we need to return a special WM_GETDLGCODE value to process just the + // arrows but let the other navigation characters through +#ifdef __WXMSW__ + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); +#endif // __WXMSW__ + + WX_FORWARD_TO_SCROLL_HELPER() + +protected: + // this is needed for wxEVT_PAINT processing hack described in + // wxScrollHelperEvtHandler::ProcessEvent() + void OnPaint(wxPaintEvent& event); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_SCROLWIN_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/selstore.h b/Externals/wxWidgets/include/wx/selstore.h index 7a7c61f99b..7df7e79864 100644 --- a/Externals/wxWidgets/include/wx/selstore.h +++ b/Externals/wxWidgets/include/wx/selstore.h @@ -1,104 +1,104 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/selstore.h -// Purpose: wxSelectionStore stores selected items in a control -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.06.03 (extracted from src/generic/listctrl.cpp) -// RCS-ID: $Id: selstore.h 29257 2004-09-22 14:38:52Z ABX $ -// Copyright: (c) 2000-2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SELSTORE_H_ -#define _WX_SELSTORE_H_ - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// wxSelectedIndices is just a sorted array of indices -// ---------------------------------------------------------------------------- - -inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) -{ - return (int)(n1 - n2); -} - -WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(size_t, - wxSizeTCmpFn, - wxSelectedIndices); - -// ---------------------------------------------------------------------------- -// wxSelectionStore is used to store the selected items in the virtual -// controls, i.e. it is well suited for storing even when the control contains -// a huge (practically infinite) number of items. -// -// Of course, internally it still has to store the selected items somehow (as -// an array currently) but the advantage is that it can handle the selection -// of all items (common operation) efficiently and that it could be made even -// smarter in the future (e.g. store the selections as an array of ranges + -// individual items) without changing its API. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSelectionStore -{ -public: - wxSelectionStore() : m_itemsSel(wxSizeTCmpFn) { Init(); } - - // set the total number of items we handle - void SetItemCount(size_t count) { m_count = count; } - - // special case of SetItemCount(0) - void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } - - // must be called when a new item is inserted/added - void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( _T("TODO") ); } - - // must be called when an item is deleted - void OnItemDelete(size_t item); - - // select one item, use SelectRange() insted if possible! - // - // returns true if the items selection really changed - bool SelectItem(size_t item, bool select = true); - - // select the range of items - // - // return true and fill the itemsChanged array with the indices of items - // which have changed state if "few" of them did, otherwise return false - // (meaning that too many items changed state to bother counting them - // individually) - bool SelectRange(size_t itemFrom, size_t itemTo, - bool select = true, - wxArrayInt *itemsChanged = NULL); - - // return true if the given item is selected - bool IsSelected(size_t item) const; - - // return the total number of selected items - size_t GetSelectedCount() const - { - return m_defaultState ? m_count - m_itemsSel.GetCount() - : m_itemsSel.GetCount(); - } - -private: - // (re)init - void Init() { m_defaultState = false; } - - // the total number of items we handle - size_t m_count; - - // the default state: normally, false (i.e. off) but maybe set to true if - // there are more selected items than non selected ones - this allows to - // handle selection of all items efficiently - bool m_defaultState; - - // the array of items whose selection state is different from default - wxSelectedIndices m_itemsSel; - - DECLARE_NO_COPY_CLASS(wxSelectionStore) -}; - - -#endif // _WX_SELSTORE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/selstore.h +// Purpose: wxSelectionStore stores selected items in a control +// Author: Vadim Zeitlin +// Modified by: +// Created: 08.06.03 (extracted from src/generic/listctrl.cpp) +// RCS-ID: $Id: selstore.h 29257 2004-09-22 14:38:52Z ABX $ +// Copyright: (c) 2000-2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SELSTORE_H_ +#define _WX_SELSTORE_H_ + +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// wxSelectedIndices is just a sorted array of indices +// ---------------------------------------------------------------------------- + +inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) +{ + return (int)(n1 - n2); +} + +WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(size_t, + wxSizeTCmpFn, + wxSelectedIndices); + +// ---------------------------------------------------------------------------- +// wxSelectionStore is used to store the selected items in the virtual +// controls, i.e. it is well suited for storing even when the control contains +// a huge (practically infinite) number of items. +// +// Of course, internally it still has to store the selected items somehow (as +// an array currently) but the advantage is that it can handle the selection +// of all items (common operation) efficiently and that it could be made even +// smarter in the future (e.g. store the selections as an array of ranges + +// individual items) without changing its API. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSelectionStore +{ +public: + wxSelectionStore() : m_itemsSel(wxSizeTCmpFn) { Init(); } + + // set the total number of items we handle + void SetItemCount(size_t count) { m_count = count; } + + // special case of SetItemCount(0) + void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } + + // must be called when a new item is inserted/added + void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( _T("TODO") ); } + + // must be called when an item is deleted + void OnItemDelete(size_t item); + + // select one item, use SelectRange() insted if possible! + // + // returns true if the items selection really changed + bool SelectItem(size_t item, bool select = true); + + // select the range of items + // + // return true and fill the itemsChanged array with the indices of items + // which have changed state if "few" of them did, otherwise return false + // (meaning that too many items changed state to bother counting them + // individually) + bool SelectRange(size_t itemFrom, size_t itemTo, + bool select = true, + wxArrayInt *itemsChanged = NULL); + + // return true if the given item is selected + bool IsSelected(size_t item) const; + + // return the total number of selected items + size_t GetSelectedCount() const + { + return m_defaultState ? m_count - m_itemsSel.GetCount() + : m_itemsSel.GetCount(); + } + +private: + // (re)init + void Init() { m_defaultState = false; } + + // the total number of items we handle + size_t m_count; + + // the default state: normally, false (i.e. off) but maybe set to true if + // there are more selected items than non selected ones - this allows to + // handle selection of all items efficiently + bool m_defaultState; + + // the array of items whose selection state is different from default + wxSelectedIndices m_itemsSel; + + DECLARE_NO_COPY_CLASS(wxSelectionStore) +}; + + +#endif // _WX_SELSTORE_H_ + diff --git a/Externals/wxWidgets/include/wx/settings.h b/Externals/wxWidgets/include/wx/settings.h index 33277ff575..ca823ba5f3 100644 --- a/Externals/wxWidgets/include/wx/settings.h +++ b/Externals/wxWidgets/include/wx/settings.h @@ -1,212 +1,212 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/settings.h -// Purpose: wxSystemSettings class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: settings.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETTINGS_H_BASE_ -#define _WX_SETTINGS_H_BASE_ - -#include "wx/colour.h" -#include "wx/font.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// possible values for wxSystemSettings::GetFont() parameter -// -// NB: wxMSW assumes that they have the same values as the parameters of -// Windows GetStockObject() API, don't change the values! -enum wxSystemFont -{ - wxSYS_OEM_FIXED_FONT = 10, - wxSYS_ANSI_FIXED_FONT, - wxSYS_ANSI_VAR_FONT, - wxSYS_SYSTEM_FONT, - wxSYS_DEVICE_DEFAULT_FONT, - wxSYS_DEFAULT_PALETTE, - wxSYS_SYSTEM_FIXED_FONT, - wxSYS_DEFAULT_GUI_FONT, - - // this was just a temporary aberration, do not use it any more - wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT -}; - -// possible values for wxSystemSettings::GetColour() parameter -// -// NB: wxMSW assumes that they have the same values as the parameters of -// Windows GetSysColor() API, don't change the values! -enum wxSystemColour -{ - wxSYS_COLOUR_SCROLLBAR, - wxSYS_COLOUR_BACKGROUND, - wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND, - wxSYS_COLOUR_ACTIVECAPTION, - wxSYS_COLOUR_INACTIVECAPTION, - wxSYS_COLOUR_MENU, - wxSYS_COLOUR_WINDOW, - wxSYS_COLOUR_WINDOWFRAME, - wxSYS_COLOUR_MENUTEXT, - wxSYS_COLOUR_WINDOWTEXT, - wxSYS_COLOUR_CAPTIONTEXT, - wxSYS_COLOUR_ACTIVEBORDER, - wxSYS_COLOUR_INACTIVEBORDER, - wxSYS_COLOUR_APPWORKSPACE, - wxSYS_COLOUR_HIGHLIGHT, - wxSYS_COLOUR_HIGHLIGHTTEXT, - wxSYS_COLOUR_BTNFACE, - wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, - wxSYS_COLOUR_BTNSHADOW, - wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, - wxSYS_COLOUR_GRAYTEXT, - wxSYS_COLOUR_BTNTEXT, - wxSYS_COLOUR_INACTIVECAPTIONTEXT, - wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, - wxSYS_COLOUR_3DDKSHADOW, - wxSYS_COLOUR_3DLIGHT, - wxSYS_COLOUR_INFOTEXT, - wxSYS_COLOUR_INFOBK, - wxSYS_COLOUR_LISTBOX, - wxSYS_COLOUR_HOTLIGHT, - wxSYS_COLOUR_GRADIENTACTIVECAPTION, - wxSYS_COLOUR_GRADIENTINACTIVECAPTION, - wxSYS_COLOUR_MENUHILIGHT, - wxSYS_COLOUR_MENUBAR, - - wxSYS_COLOUR_MAX -}; - -// possible values for wxSystemSettings::GetMetric() index parameter -// -// NB: update the conversion table in msw/settings.cpp if you change the values -// of the elements of this enum -enum wxSystemMetric -{ - wxSYS_MOUSE_BUTTONS = 1, - wxSYS_BORDER_X, - wxSYS_BORDER_Y, - wxSYS_CURSOR_X, - wxSYS_CURSOR_Y, - wxSYS_DCLICK_X, - wxSYS_DCLICK_Y, - wxSYS_DRAG_X, - wxSYS_DRAG_Y, - wxSYS_EDGE_X, - wxSYS_EDGE_Y, - wxSYS_HSCROLL_ARROW_X, - wxSYS_HSCROLL_ARROW_Y, - wxSYS_HTHUMB_X, - wxSYS_ICON_X, - wxSYS_ICON_Y, - wxSYS_ICONSPACING_X, - wxSYS_ICONSPACING_Y, - wxSYS_WINDOWMIN_X, - wxSYS_WINDOWMIN_Y, - wxSYS_SCREEN_X, - wxSYS_SCREEN_Y, - wxSYS_FRAMESIZE_X, - wxSYS_FRAMESIZE_Y, - wxSYS_SMALLICON_X, - wxSYS_SMALLICON_Y, - wxSYS_HSCROLL_Y, - wxSYS_VSCROLL_X, - wxSYS_VSCROLL_ARROW_X, - wxSYS_VSCROLL_ARROW_Y, - wxSYS_VTHUMB_Y, - wxSYS_CAPTION_Y, - wxSYS_MENU_Y, - wxSYS_NETWORK_PRESENT, - wxSYS_PENWINDOWS_PRESENT, - wxSYS_SHOW_SOUNDS, - wxSYS_SWAP_BUTTONS -}; - -// possible values for wxSystemSettings::HasFeature() parameter -enum wxSystemFeature -{ - wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1, - wxSYS_CAN_ICONIZE_FRAME, - wxSYS_TABLET_PRESENT -}; - -// values for different screen designs -enum wxSystemScreenType -{ - wxSYS_SCREEN_NONE = 0, // not yet defined - - wxSYS_SCREEN_TINY, // < - wxSYS_SCREEN_PDA, // >= 320x240 - wxSYS_SCREEN_SMALL, // >= 640x480 - wxSYS_SCREEN_DESKTOP // >= 800x600 -}; - -// ---------------------------------------------------------------------------- -// wxSystemSettingsNative: defines the API for wxSystemSettings class -// ---------------------------------------------------------------------------- - -// this is a namespace rather than a class: it has only non virtual static -// functions -// -// also note that the methods are implemented in the platform-specific source -// files (i.e. this is not a real base class as we can't override its virtual -// functions because it doesn't have any) - -class WXDLLEXPORT wxSystemSettingsNative -{ -public: - // get a standard system colour - static wxColour GetColour(wxSystemColour index); - - // get a standard system font - static wxFont GetFont(wxSystemFont index); - - // get a system-dependent metric - static int GetMetric(wxSystemMetric index, wxWindow * win = NULL); - - // return true if the port has certain feature - static bool HasFeature(wxSystemFeature index); -}; - -// ---------------------------------------------------------------------------- -// include the declaration of the real platform-dependent class -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSystemSettings : public wxSystemSettingsNative -{ -public: -#ifdef __WXUNIVERSAL__ - // in wxUniversal we want to use the theme standard colours instead of the - // system ones, otherwise wxSystemSettings is just the same as - // wxSystemSettingsNative - static wxColour GetColour(wxSystemColour index); -#endif // __WXUNIVERSAL__ - - // Get system screen design (desktop, pda, ..) used for - // laying out various dialogs. - static wxSystemScreenType GetScreenType(); - - // Override default. - static void SetScreenType( wxSystemScreenType screen ); - - // Value - static wxSystemScreenType ms_screen; - -#if WXWIN_COMPATIBILITY_2_4 - // the backwards compatible versions of wxSystemSettingsNative functions, - // don't use these methods in the new code! - wxDEPRECATED(static wxColour GetSystemColour(int index)); - wxDEPRECATED(static wxFont GetSystemFont(int index)); - wxDEPRECATED(static int GetSystemMetric(int index)); -#endif -}; - -#endif - // _WX_SETTINGS_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/settings.h +// Purpose: wxSystemSettings class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: settings.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETTINGS_H_BASE_ +#define _WX_SETTINGS_H_BASE_ + +#include "wx/colour.h" +#include "wx/font.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// possible values for wxSystemSettings::GetFont() parameter +// +// NB: wxMSW assumes that they have the same values as the parameters of +// Windows GetStockObject() API, don't change the values! +enum wxSystemFont +{ + wxSYS_OEM_FIXED_FONT = 10, + wxSYS_ANSI_FIXED_FONT, + wxSYS_ANSI_VAR_FONT, + wxSYS_SYSTEM_FONT, + wxSYS_DEVICE_DEFAULT_FONT, + wxSYS_DEFAULT_PALETTE, + wxSYS_SYSTEM_FIXED_FONT, + wxSYS_DEFAULT_GUI_FONT, + + // this was just a temporary aberration, do not use it any more + wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT +}; + +// possible values for wxSystemSettings::GetColour() parameter +// +// NB: wxMSW assumes that they have the same values as the parameters of +// Windows GetSysColor() API, don't change the values! +enum wxSystemColour +{ + wxSYS_COLOUR_SCROLLBAR, + wxSYS_COLOUR_BACKGROUND, + wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND, + wxSYS_COLOUR_ACTIVECAPTION, + wxSYS_COLOUR_INACTIVECAPTION, + wxSYS_COLOUR_MENU, + wxSYS_COLOUR_WINDOW, + wxSYS_COLOUR_WINDOWFRAME, + wxSYS_COLOUR_MENUTEXT, + wxSYS_COLOUR_WINDOWTEXT, + wxSYS_COLOUR_CAPTIONTEXT, + wxSYS_COLOUR_ACTIVEBORDER, + wxSYS_COLOUR_INACTIVEBORDER, + wxSYS_COLOUR_APPWORKSPACE, + wxSYS_COLOUR_HIGHLIGHT, + wxSYS_COLOUR_HIGHLIGHTTEXT, + wxSYS_COLOUR_BTNFACE, + wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, + wxSYS_COLOUR_BTNSHADOW, + wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, + wxSYS_COLOUR_GRAYTEXT, + wxSYS_COLOUR_BTNTEXT, + wxSYS_COLOUR_INACTIVECAPTIONTEXT, + wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DDKSHADOW, + wxSYS_COLOUR_3DLIGHT, + wxSYS_COLOUR_INFOTEXT, + wxSYS_COLOUR_INFOBK, + wxSYS_COLOUR_LISTBOX, + wxSYS_COLOUR_HOTLIGHT, + wxSYS_COLOUR_GRADIENTACTIVECAPTION, + wxSYS_COLOUR_GRADIENTINACTIVECAPTION, + wxSYS_COLOUR_MENUHILIGHT, + wxSYS_COLOUR_MENUBAR, + + wxSYS_COLOUR_MAX +}; + +// possible values for wxSystemSettings::GetMetric() index parameter +// +// NB: update the conversion table in msw/settings.cpp if you change the values +// of the elements of this enum +enum wxSystemMetric +{ + wxSYS_MOUSE_BUTTONS = 1, + wxSYS_BORDER_X, + wxSYS_BORDER_Y, + wxSYS_CURSOR_X, + wxSYS_CURSOR_Y, + wxSYS_DCLICK_X, + wxSYS_DCLICK_Y, + wxSYS_DRAG_X, + wxSYS_DRAG_Y, + wxSYS_EDGE_X, + wxSYS_EDGE_Y, + wxSYS_HSCROLL_ARROW_X, + wxSYS_HSCROLL_ARROW_Y, + wxSYS_HTHUMB_X, + wxSYS_ICON_X, + wxSYS_ICON_Y, + wxSYS_ICONSPACING_X, + wxSYS_ICONSPACING_Y, + wxSYS_WINDOWMIN_X, + wxSYS_WINDOWMIN_Y, + wxSYS_SCREEN_X, + wxSYS_SCREEN_Y, + wxSYS_FRAMESIZE_X, + wxSYS_FRAMESIZE_Y, + wxSYS_SMALLICON_X, + wxSYS_SMALLICON_Y, + wxSYS_HSCROLL_Y, + wxSYS_VSCROLL_X, + wxSYS_VSCROLL_ARROW_X, + wxSYS_VSCROLL_ARROW_Y, + wxSYS_VTHUMB_Y, + wxSYS_CAPTION_Y, + wxSYS_MENU_Y, + wxSYS_NETWORK_PRESENT, + wxSYS_PENWINDOWS_PRESENT, + wxSYS_SHOW_SOUNDS, + wxSYS_SWAP_BUTTONS +}; + +// possible values for wxSystemSettings::HasFeature() parameter +enum wxSystemFeature +{ + wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1, + wxSYS_CAN_ICONIZE_FRAME, + wxSYS_TABLET_PRESENT +}; + +// values for different screen designs +enum wxSystemScreenType +{ + wxSYS_SCREEN_NONE = 0, // not yet defined + + wxSYS_SCREEN_TINY, // < + wxSYS_SCREEN_PDA, // >= 320x240 + wxSYS_SCREEN_SMALL, // >= 640x480 + wxSYS_SCREEN_DESKTOP // >= 800x600 +}; + +// ---------------------------------------------------------------------------- +// wxSystemSettingsNative: defines the API for wxSystemSettings class +// ---------------------------------------------------------------------------- + +// this is a namespace rather than a class: it has only non virtual static +// functions +// +// also note that the methods are implemented in the platform-specific source +// files (i.e. this is not a real base class as we can't override its virtual +// functions because it doesn't have any) + +class WXDLLEXPORT wxSystemSettingsNative +{ +public: + // get a standard system colour + static wxColour GetColour(wxSystemColour index); + + // get a standard system font + static wxFont GetFont(wxSystemFont index); + + // get a system-dependent metric + static int GetMetric(wxSystemMetric index, wxWindow * win = NULL); + + // return true if the port has certain feature + static bool HasFeature(wxSystemFeature index); +}; + +// ---------------------------------------------------------------------------- +// include the declaration of the real platform-dependent class +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSystemSettings : public wxSystemSettingsNative +{ +public: +#ifdef __WXUNIVERSAL__ + // in wxUniversal we want to use the theme standard colours instead of the + // system ones, otherwise wxSystemSettings is just the same as + // wxSystemSettingsNative + static wxColour GetColour(wxSystemColour index); +#endif // __WXUNIVERSAL__ + + // Get system screen design (desktop, pda, ..) used for + // laying out various dialogs. + static wxSystemScreenType GetScreenType(); + + // Override default. + static void SetScreenType( wxSystemScreenType screen ); + + // Value + static wxSystemScreenType ms_screen; + +#if WXWIN_COMPATIBILITY_2_4 + // the backwards compatible versions of wxSystemSettingsNative functions, + // don't use these methods in the new code! + wxDEPRECATED(static wxColour GetSystemColour(int index)); + wxDEPRECATED(static wxFont GetSystemFont(int index)); + wxDEPRECATED(static int GetSystemMetric(int index)); +#endif +}; + +#endif + // _WX_SETTINGS_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/setup.h b/Externals/wxWidgets/include/wx/setup.h index 24faf0ae6b..df3b4aefe7 100644 --- a/Externals/wxWidgets/include/wx/setup.h +++ b/Externals/wxWidgets/include/wx/setup.h @@ -1,1349 +1,1349 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup0.h 43908 2006-12-11 06:19:27Z RD $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 0 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 0 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 0 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 0 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 0 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 0 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 0 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 0 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 0 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 0 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 0 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 0 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 0 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running (it is only available under Win32) -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 0 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 0 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 1 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 0 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 0 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 0 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 0 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 0 - -// Set to 1 for PNM format support -#define wxUSE_PNM 0 - -// Set to 1 for PCX format support -#define wxUSE_PCX 0 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 0 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 0 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable the use of DIB's for wxBitmap to support -// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. -#define wxUSE_DIB_FOR_BITMAP 0 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmao data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile <richedit.h> -#define wxUSE_RICHEDIT 0 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 0 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to auto-adapt to MS Windows XP themes where possible -// (notably, wxNotebook pages) -#define wxUSE_UXTHEME_AUTO 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 1 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 - -// ---------------------------------------------------------------------------- -// obsolete settings -// ---------------------------------------------------------------------------- - -// NB: all settings in this section are obsolete and should not be used/changed -// at all, they will disappear - -// Define 1 to use bitmap messages. -#define wxUSE_BITMAP_MESSAGE 1 - -#endif // _WX_SETUP_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: setup0.h 43908 2006-12-11 06:19:27Z RD $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 0 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 0 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 0 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 0 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 0 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 0 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 0 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 0 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 0 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 0 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 0 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 0 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 0 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 0 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_RESOURCES 1 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 0 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 0 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 0 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 0 + +// Set to 1 for PNM format support +#define wxUSE_PNM 0 + +// Set to 1 for PCX format support +#define wxUSE_PCX 0 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + +/* --- end common options --- */ + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode +// and want to run your programs under Windows 9x and not only NT/2000/XP. +// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note +// that you will have to modify the makefiles to include unicows.lib import +// library as the first library (see installation instructions in install.txt +// to learn how to do it when building the library or samples). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) +#ifndef wxUSE_UNICODE_MSLU + #define wxUSE_UNICODE_MSLU 0 +#endif + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 0 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 0 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmao data. +// +// Default is 1, set it to 0 only if you don't use wxImage neither +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#define wxUSE_RICHEDIT 0 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 0 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 1 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 + +#endif // _WX_SETUP_H_ + diff --git a/Externals/wxWidgets/include/wx/setup_inc.h b/Externals/wxWidgets/include/wx/setup_inc.h index aafa934070..45cc4e55d6 100644 --- a/Externals/wxWidgets/include/wx/setup_inc.h +++ b/Externals/wxWidgets/include/wx/setup_inc.h @@ -1,1198 +1,1198 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/setup_inc.h -// Purpose: setup.h settings -// Author: Vadim Zeitlin -// Modified by: -// Created: -// RCS-ID: $Id: setup_inc.h 51451 2008-01-29 23:11:55Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/setup_inc.h +// Purpose: setup.h settings +// Author: Vadim Zeitlin +// Modified by: +// Created: +// RCS-ID: $Id: setup_inc.h 51451 2008-01-29 23:11:55Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream>. Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so <iostream> will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + diff --git a/Externals/wxWidgets/include/wx/setup_redirect.h b/Externals/wxWidgets/include/wx/setup_redirect.h index 5d7be0fcbc..87a9c3d85a 100644 --- a/Externals/wxWidgets/include/wx/setup_redirect.h +++ b/Externals/wxWidgets/include/wx/setup_redirect.h @@ -1,18 +1,18 @@ -/* - * wx/setup.h - * - * This file should not normally be used, except where makefiles - * have not yet been adjusted to take into account of the new scheme - * whereby a setup.h is created under the lib directory. - * - * Copyright: (c) Vadim Zeitlin - * RCS-ID: $Id: setup_redirect.h 33948 2005-05-04 18:57:50Z JS $ - * Licence: wxWindows Licence - */ - -#ifdef __WXMSW__ -#include "wx/msw/setup.h" -#else -#error Please adjust your include path to pick up the wx/setup.h file under lib first. -#endif - +/* + * wx/setup.h + * + * This file should not normally be used, except where makefiles + * have not yet been adjusted to take into account of the new scheme + * whereby a setup.h is created under the lib directory. + * + * Copyright: (c) Vadim Zeitlin + * RCS-ID: $Id: setup_redirect.h 33948 2005-05-04 18:57:50Z JS $ + * Licence: wxWindows Licence + */ + +#ifdef __WXMSW__ +#include "wx/msw/setup.h" +#else +#error Please adjust your include path to pick up the wx/setup.h file under lib first. +#endif + diff --git a/Externals/wxWidgets/include/wx/sizer.h b/Externals/wxWidgets/include/wx/sizer.h index e95ab437e1..f1f503677d 100644 --- a/Externals/wxWidgets/include/wx/sizer.h +++ b/Externals/wxWidgets/include/wx/sizer.h @@ -1,1092 +1,1092 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/sizer.h -// Purpose: provide wxSizer class for layout -// Author: Robert Roebling and Robin Dunn -// Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) -// Created: -// RCS-ID: $Id: sizer.h 52331 2008-03-05 15:02:22Z VS $ -// Copyright: (c) Robin Dunn, Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXSIZER_H__ -#define __WXSIZER_H__ - -#include "wx/defs.h" - -#include "wx/window.h" - -//--------------------------------------------------------------------------- -// classes -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxBoxSizer; -class WXDLLIMPEXP_FWD_CORE wxSizerItem; -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxFlexGridSizer; -class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; - -#ifndef wxUSE_BORDER_BY_DEFAULT - #ifdef __SMARTPHONE__ - // no borders by default on limited size screen - #define wxUSE_BORDER_BY_DEFAULT 0 - #else - #define wxUSE_BORDER_BY_DEFAULT 1 - #endif -#endif - -// ---------------------------------------------------------------------------- -// wxSizerFlags: flags used for an item in the sizer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizerFlags -{ -public: - // construct the flags object initialized with the given proportion (0 by - // default) - wxSizerFlags(int proportion = 0) : m_proportion(proportion) - { - m_flags = 0; - m_borderInPixels = 0; - } - - // setters for all sizer flags, they all return the object itself so that - // calls to them can be chained - - wxSizerFlags& Proportion(int proportion) - { - m_proportion = proportion; - return *this; - } - - wxSizerFlags& Align(int alignment) // combination of wxAlignment values - { - m_flags &= ~wxALIGN_MASK; - m_flags |= alignment; - - return *this; - } - - wxSizerFlags& Expand() - { - m_flags |= wxEXPAND; - return *this; - } - - // some shortcuts for Align() - wxSizerFlags& Centre() { return Align(wxCENTRE); } - wxSizerFlags& Center() { return Centre(); } - wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } - wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } - -#if wxABI_VERSION >= 20802 - wxSizerFlags& Top() { return Align(wxALIGN_TOP); } - wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } -#endif // wxABI 2.8.2+ - - // default border size used by Border() below - static int GetDefaultBorder() - { -#if wxUSE_BORDER_BY_DEFAULT - // FIXME: default border size shouldn't be hardcoded and at the very - // least they should depend on the current font size - return 5; -#else - return 0; -#endif - } - - - wxSizerFlags& Border(int direction, int borderInPixels) - { - m_flags &= ~wxALL; - m_flags |= direction; - - m_borderInPixels = borderInPixels; - - return *this; - } - - wxSizerFlags& Border(int direction = wxALL) - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(direction, GetDefaultBorder()); -#else - // no borders by default on limited size screen - wxUnusedVar(direction); - - return *this; -#endif - } - - wxSizerFlags& DoubleBorder(int direction = wxALL) - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(direction, 2*GetDefaultBorder()); -#else - wxUnusedVar(direction); - - return *this; -#endif - } - - wxSizerFlags& TripleBorder(int direction = wxALL) - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(direction, 3*GetDefaultBorder()); -#else - wxUnusedVar(direction); - - return *this; -#endif - } - - wxSizerFlags& HorzBorder() - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(wxLEFT | wxRIGHT, GetDefaultBorder()); -#else - return *this; -#endif - } - - wxSizerFlags& DoubleHorzBorder() - { -#if wxUSE_BORDER_BY_DEFAULT - return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder()); -#else - return *this; -#endif - } - -#if wxABI_VERSION >= 20802 - // setters for the others flags - wxSizerFlags& Shaped() - { - m_flags |= wxSHAPED; - - return *this; - } - - wxSizerFlags& FixedMinSize() - { - m_flags |= wxFIXED_MINSIZE; - - return *this; - } -#endif // wx 2.8.2+ - -#if wxABI_VERSION >= 20808 - // makes the item ignore window's visibility status - wxSizerFlags& ReserveSpaceEvenIfHidden(); -#endif - - // accessors for wxSizer only - int GetProportion() const { return m_proportion; } - int GetFlags() const { return m_flags; } - int GetBorderInPixels() const { return m_borderInPixels; } - -private: - int m_proportion; - int m_flags; - int m_borderInPixels; -}; - - -// ---------------------------------------------------------------------------- -// wxSizerSpacer: used by wxSizerItem to represent a spacer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizerSpacer -{ -public: - wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } - - void SetSize(const wxSize& size) { m_size = size; } - const wxSize& GetSize() const { return m_size; } - - void Show(bool show) { m_isShown = show; } - bool IsShown() const { return m_isShown; } - -private: - // the size, in pixel - wxSize m_size; - - // is the spacer currently shown? - bool m_isShown; -}; - -// ---------------------------------------------------------------------------- -// wxSizerItem -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizerItem : public wxObject -{ -public: - // window - wxSizerItem( wxWindow *window, - int proportion, - int flag, - int border, - wxObject* userData ); - - // window with flags - wxSizerItem(wxWindow *window, const wxSizerFlags& flags) - { - Init(flags); - - SetWindow(window); - } - - // subsizer - wxSizerItem( wxSizer *sizer, - int proportion, - int flag, - int border, - wxObject* userData ); - - // sizer with flags - wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) - { - Init(flags); - - SetSizer(sizer); - } - - // spacer - wxSizerItem( int width, - int height, - int proportion, - int flag, - int border, - wxObject* userData); - - // spacer with flags - wxSizerItem(int width, int height, const wxSizerFlags& flags) - { - Init(flags); - - SetSpacer(width, height); - } - - wxSizerItem(); - virtual ~wxSizerItem(); - - virtual void DeleteWindows(); - - // Enable deleting the SizerItem without destroying the contained sizer. - void DetachSizer() { m_sizer = NULL; } - - virtual wxSize GetSize() const; - virtual wxSize CalcMin(); - virtual void SetDimension( const wxPoint& pos, const wxSize& size ); - - wxSize GetMinSize() const - { return m_minSize; } - wxSize GetMinSizeWithBorder() const; - - void SetMinSize(const wxSize& size) - { - if ( IsWindow() ) - m_window->SetMinSize(size); - m_minSize = size; - } - void SetMinSize( int x, int y ) - { SetMinSize(wxSize(x, y)); } - void SetInitSize( int x, int y ) - { SetMinSize(wxSize(x, y)); } - - // if either of dimensions is zero, ratio is assumed to be 1 - // to avoid "divide by zero" errors - void SetRatio(int width, int height) - { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } - void SetRatio(const wxSize& size) - { SetRatio(size.x, size.y); } - void SetRatio(float ratio) - { m_ratio = ratio; } - float GetRatio() const - { return m_ratio; } - - virtual wxRect GetRect() { return m_rect; } - - bool IsWindow() const { return m_kind == Item_Window; } - bool IsSizer() const { return m_kind == Item_Sizer; } - bool IsSpacer() const { return m_kind == Item_Spacer; } - -#if WXWIN_COMPATIBILITY_2_6 - // Deprecated in 2.6, use {G,S}etProportion instead. - wxDEPRECATED( void SetOption( int option ) ); - wxDEPRECATED( int GetOption() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - void SetProportion( int proportion ) - { m_proportion = proportion; } - int GetProportion() const - { return m_proportion; } - void SetFlag( int flag ) - { m_flag = flag; } - int GetFlag() const - { return m_flag; } - void SetBorder( int border ) - { m_border = border; } - int GetBorder() const - { return m_border; } - - wxWindow *GetWindow() const - { return m_kind == Item_Window ? m_window : NULL; } - wxSizer *GetSizer() const - { return m_kind == Item_Sizer ? m_sizer : NULL; } - wxSize GetSpacer() const; - - // this function behaves obviously for the windows and spacers but for the - // sizers it returns true if any sizer element is shown and only returns - // false if all of them are hidden - bool IsShown() const; - void Show(bool show); - - void SetUserData(wxObject* userData) - { delete m_userData; m_userData = userData; } - wxObject* GetUserData() const - { return m_userData; } - wxPoint GetPosition() const - { return m_pos; } - - - // these functions do not free old sizer/spacer - void SetWindow(wxWindow *window); - void SetSizer(wxSizer *sizer); - void SetSpacer(const wxSize& size); - void SetSpacer(int width, int height) { SetSpacer(wxSize(width, height)); } - -protected: - // common part of several ctors - void Init() { m_userData = NULL; } - - // common part of ctors taking wxSizerFlags - void Init(const wxSizerFlags& flags); - - - // discriminated union: depending on m_kind one of the fields is valid - enum - { - Item_None, - Item_Window, - Item_Sizer, - Item_Spacer, - Item_Max - } m_kind; - union - { - wxWindow *m_window; - wxSizer *m_sizer; - wxSizerSpacer *m_spacer; - }; - - wxPoint m_pos; - wxSize m_minSize; - int m_proportion; - int m_border; - int m_flag; - - // on screen rectangle of this item (not including borders) - wxRect m_rect; - - // Aspect ratio can always be calculated from m_size, - // but this would cause precision loss when the window - // is shrunk. It is safer to preserve the initial value. - float m_ratio; - - wxObject *m_userData; - -private: - // 2.8-only implementation detail for wxRESERVE_SPACE_EVEN_IF_HIDDEN - bool ShouldAccountFor() const; - - DECLARE_CLASS(wxSizerItem) - DECLARE_NO_COPY_CLASS(wxSizerItem) - - friend class wxBoxSizer; - friend class wxFlexGridSizer; - friend class wxGridBagSizer; -}; - -WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); - - -//--------------------------------------------------------------------------- -// wxSizer -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer -{ -public: - wxSizer() { m_containingWindow = NULL; } - virtual ~wxSizer(); - - // methods for adding elements to the sizer: there are Add/Insert/Prepend - // overloads for each of window/sizer/spacer/wxSizerItem - wxSizerItem* Add(wxWindow *window, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Add(wxSizer *sizer, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Add(int width, - int height, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); - wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Add( wxSizerItem *item); - - wxSizerItem* AddSpacer(int size); - wxSizerItem* AddStretchSpacer(int prop = 1); - - wxSizerItem* Insert(size_t index, - wxWindow *window, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Insert(size_t index, - wxSizer *sizer, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Insert(size_t index, - int width, - int height, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Insert(size_t index, - wxWindow *window, - const wxSizerFlags& flags); - wxSizerItem* Insert(size_t index, - wxSizer *sizer, - const wxSizerFlags& flags); - virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); - - wxSizerItem* InsertSpacer(size_t index, int size); - wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); - - wxSizerItem* Prepend(wxWindow *window, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Prepend(wxSizer *sizer, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Prepend(int width, - int height, - int proportion = 0, - int flag = 0, - int border = 0, - wxObject* userData = NULL); - wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); - wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); - wxSizerItem* Prepend(wxSizerItem *item); - - wxSizerItem* PrependSpacer(int size); - wxSizerItem* PrependStretchSpacer(int prop = 1); - - // set (or possibly unset if window is NULL) or get the window this sizer - // is used in - void SetContainingWindow(wxWindow *window); - wxWindow *GetContainingWindow() const { return m_containingWindow; } - -#if WXWIN_COMPATIBILITY_2_6 - // Deprecated in 2.6 since historically it does not delete the window, - // use Detach instead. - wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - virtual bool Remove( wxSizer *sizer ); - virtual bool Remove( int index ); - - virtual bool Detach( wxWindow *window ); - virtual bool Detach( wxSizer *sizer ); - virtual bool Detach( int index ); - - virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); - virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); - virtual bool Replace( size_t index, wxSizerItem *newitem ); - - virtual void Clear( bool delete_windows = false ); - virtual void DeleteWindows(); - - void SetMinSize( int width, int height ) - { DoSetMinSize( width, height ); } - void SetMinSize( const wxSize& size ) - { DoSetMinSize( size.x, size.y ); } - - // Searches recursively - bool SetItemMinSize( wxWindow *window, int width, int height ) - { return DoSetItemMinSize( window, width, height ); } - bool SetItemMinSize( wxWindow *window, const wxSize& size ) - { return DoSetItemMinSize( window, size.x, size.y ); } - - // Searches recursively - bool SetItemMinSize( wxSizer *sizer, int width, int height ) - { return DoSetItemMinSize( sizer, width, height ); } - bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) - { return DoSetItemMinSize( sizer, size.x, size.y ); } - - bool SetItemMinSize( size_t index, int width, int height ) - { return DoSetItemMinSize( index, width, height ); } - bool SetItemMinSize( size_t index, const wxSize& size ) - { return DoSetItemMinSize( index, size.x, size.y ); } - - wxSize GetSize() const - { return m_size; } - wxPoint GetPosition() const - { return m_position; } - - // Calculate the minimal size or return m_minSize if bigger. - wxSize GetMinSize(); - - virtual void RecalcSizes() = 0; - virtual wxSize CalcMin() = 0; - - virtual void Layout(); - -#if wxABI_VERSION >= 20808 - wxSize ComputeFittingClientSize(wxWindow *window); - wxSize ComputeFittingWindowSize(wxWindow *window); -#endif - - wxSize Fit( wxWindow *window ); - void FitInside( wxWindow *window ); - void SetSizeHints( wxWindow *window ); - void SetVirtualSizeHints( wxWindow *window ); - - wxSizerItemList& GetChildren() - { return m_children; } - - void SetDimension( int x, int y, int width, int height ); - - wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); - wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); - wxSizerItem* GetItem( size_t index ); - - // Manage whether individual scene items are considered - // in the layout calculations or not. - bool Show( wxWindow *window, bool show = true, bool recursive = false ); - bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); - bool Show( size_t index, bool show = true ); - - bool Hide( wxSizer *sizer, bool recursive = false ) - { return Show( sizer, false, recursive ); } - bool Hide( wxWindow *window, bool recursive = false ) - { return Show( window, false, recursive ); } - bool Hide( size_t index ) - { return Show( index, false ); } - - bool IsShown( wxWindow *window ) const; - bool IsShown( wxSizer *sizer ) const; - bool IsShown( size_t index ) const; - - // Recursively call wxWindow::Show () on all sizer items. - virtual void ShowItems (bool show); - - void Show(bool show) { ShowItems(show); } - -protected: - wxSize m_size; - wxSize m_minSize; - wxPoint m_position; - wxSizerItemList m_children; - - // the window this sizer is used in, can be NULL - wxWindow *m_containingWindow; - - wxSize GetMaxWindowSize( wxWindow *window ) const; - wxSize GetMinWindowSize( wxWindow *window ); - wxSize GetMaxClientSize( wxWindow *window ) const; - wxSize GetMinClientSize( wxWindow *window ); - wxSize VirtualFitSize( wxWindow *window ); - - virtual void DoSetMinSize( int width, int height ); - virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); - virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); - virtual bool DoSetItemMinSize( size_t index, int width, int height ); - -private: - DECLARE_CLASS(wxSizer) -}; - -//--------------------------------------------------------------------------- -// wxGridSizer -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxGridSizer: public wxSizer -{ -public: - wxGridSizer( int rows, int cols, int vgap, int hgap ); - wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); - - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - - void SetCols( int cols ) { m_cols = cols; } - void SetRows( int rows ) { m_rows = rows; } - void SetVGap( int gap ) { m_vgap = gap; } - void SetHGap( int gap ) { m_hgap = gap; } - int GetCols() const { return m_cols; } - int GetRows() const { return m_rows; } - int GetVGap() const { return m_vgap; } - int GetHGap() const { return m_hgap; } - -protected: - int m_rows; - int m_cols; - int m_vgap; - int m_hgap; - - // return the number of total items and the number of columns and rows - int CalcRowsCols(int& rows, int& cols) const; - - void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); - -private: - DECLARE_CLASS(wxGridSizer) -}; - -//--------------------------------------------------------------------------- -// wxFlexGridSizer -//--------------------------------------------------------------------------- - -// the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" -// direction -enum wxFlexSizerGrowMode -{ - // don't resize the cells in non-flexible direction at all - wxFLEX_GROWMODE_NONE, - - // uniformly resize only the specified ones (default) - wxFLEX_GROWMODE_SPECIFIED, - - // uniformly resize all cells - wxFLEX_GROWMODE_ALL -}; - -class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer -{ -public: - // ctors/dtor - wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); - wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); - virtual ~wxFlexGridSizer(); - - - // set the rows/columns which will grow (the others will remain of the - // constant initial size) - void AddGrowableRow( size_t idx, int proportion = 0 ); - void RemoveGrowableRow( size_t idx ); - void AddGrowableCol( size_t idx, int proportion = 0 ); - void RemoveGrowableCol( size_t idx ); - - - // the sizer cells may grow in both directions, not grow at all or only - // grow in one direction but not the other - - // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) - void SetFlexibleDirection(int direction) { m_flexDirection = direction; } - int GetFlexibleDirection() const { return m_flexDirection; } - - // note that the grow mode only applies to the direction which is not - // flexible - void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } - wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } - - // Read-only access to the row heights and col widths arrays - const wxArrayInt& GetRowHeights() const { return m_rowHeights; } - const wxArrayInt& GetColWidths() const { return m_colWidths; } - - // implementation - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - -protected: - void AdjustForFlexDirection(); - void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, - int nrows, int ncols); - - // the heights/widths of all rows/columns - wxArrayInt m_rowHeights, - m_colWidths; - - // indices of the growable columns and rows - wxArrayInt m_growableRows, - m_growableCols; - - // proportion values of the corresponding growable rows and columns - wxArrayInt m_growableRowsProportions, - m_growableColsProportions; - - // parameters describing whether the growable cells should be resized in - // both directions or only one - int m_flexDirection; - wxFlexSizerGrowMode m_growMode; - - // saves CalcMin result to optimize RecalcSizes - wxSize m_calculatedMinSize; - -private: - DECLARE_CLASS(wxFlexGridSizer) - DECLARE_NO_COPY_CLASS(wxFlexGridSizer) -}; - -//--------------------------------------------------------------------------- -// wxBoxSizer -//--------------------------------------------------------------------------- - -class WXDLLEXPORT wxBoxSizer: public wxSizer -{ -public: - wxBoxSizer( int orient ); - - void RecalcSizes(); - wxSize CalcMin(); - - int GetOrientation() const - { return m_orient; } - - void SetOrientation(int orient) - { m_orient = orient; } - -protected: - int m_orient; - int m_stretchable; - int m_minWidth; - int m_minHeight; - int m_fixedWidth; - int m_fixedHeight; - -private: - DECLARE_CLASS(wxBoxSizer) -}; - -//--------------------------------------------------------------------------- -// wxStaticBoxSizer -//--------------------------------------------------------------------------- - -#if wxUSE_STATBOX - -class WXDLLIMPEXP_FWD_CORE wxStaticBox; - -class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer -{ -public: - wxStaticBoxSizer(wxStaticBox *box, int orient); - wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); - virtual ~wxStaticBoxSizer(); - - void RecalcSizes(); - wxSize CalcMin(); - - wxStaticBox *GetStaticBox() const - { return m_staticBox; } - - // override to hide/show the static box as well - virtual void ShowItems (bool show); - - virtual bool Detach( wxWindow *window ); - virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } - virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } - -protected: - wxStaticBox *m_staticBox; - -private: - DECLARE_CLASS(wxStaticBoxSizer) - DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) -}; - -#endif // wxUSE_STATBOX - -#if wxUSE_BUTTON - -class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer -{ -public: - // Constructor just creates a new wxBoxSizer, not much else. - // Box sizer orientation is automatically determined here: - // vertical for PDAs, horizontal for everything else? - wxStdDialogButtonSizer(); - - // Checks button ID against system IDs and sets one of the pointers below - // to this button. Does not do any sizer-related things here. - void AddButton(wxButton *button); - - // Use these if no standard ID can/should be used - void SetAffirmativeButton( wxButton *button ); - void SetNegativeButton( wxButton *button ); - void SetCancelButton( wxButton *button ); - - // All platform-specific code here, checks which buttons exist and add - // them to the sizer accordingly. - // Note - one potential hack on Mac we could use here, - // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE - // is set to _("Save") and m_buttonNegative is set to _("Don't Save") - // I wouldn't add any other hacks like that into here, - // but this one I can see being useful. - void Realize(); - - wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } - wxButton *GetApplyButton() const { return m_buttonApply; } - wxButton *GetNegativeButton() const { return m_buttonNegative; } - wxButton *GetCancelButton() const { return m_buttonCancel; } - wxButton *GetHelpButton() const { return m_buttonHelp; } - -protected: - wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here - wxButton *m_buttonApply; - wxButton *m_buttonNegative; // wxID_NO - wxButton *m_buttonCancel; - wxButton *m_buttonHelp; - -private: - DECLARE_CLASS(wxStdDialogButtonSizer) - DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) -}; - -#endif // wxUSE_BUTTON - -#if WXWIN_COMPATIBILITY_2_4 -// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they -// don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. - -// ---------------------------------------------------------------------------- -// wxBookCtrlSizer -// ---------------------------------------------------------------------------- - -#if wxUSE_BOOKCTRL - -// this sizer works with wxNotebook/wxListbook/... and sizes the control to -// fit its pages -class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; - -class WXDLLEXPORT wxBookCtrlSizer : public wxSizer -{ -public: -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - wxBookCtrlBase *GetControl() const { return m_bookctrl; } - - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - -protected: - // this protected ctor lets us mark the real one above as deprecated - // and still have warning-free build of the library itself: - wxBookCtrlSizer() {} - - wxBookCtrlBase *m_bookctrl; - -private: - DECLARE_CLASS(wxBookCtrlSizer) - DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) -}; - - -#if wxUSE_NOTEBOOK - -// before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards -// compatibility -class WXDLLIMPEXP_FWD_CORE wxNotebook; - -class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer -{ -public: -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } - -private: - DECLARE_CLASS(wxNotebookSizer) - DECLARE_NO_COPY_CLASS(wxNotebookSizer) -}; - -#endif // wxUSE_NOTEBOOK - -#endif // wxUSE_BOOKCTRL - -#endif // WXWIN_COMPATIBILITY_2_4 - -// ---------------------------------------------------------------------------- -// inline functions implementation -// ---------------------------------------------------------------------------- - -inline wxSizerItem* -wxSizer::Add( wxSizerItem *item ) -{ - return Insert( m_children.GetCount(), item ); -} - -inline wxSizerItem* -wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) -{ - return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) -{ - return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) -{ - return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) -{ - return Add( new wxSizerItem(window, flags) ); -} - -inline wxSizerItem* -wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) -{ - return Add( new wxSizerItem(sizer, flags) ); -} - -inline wxSizerItem* -wxSizer::AddSpacer(int size) -{ - return Add(size, size); -} - -inline wxSizerItem* -wxSizer::AddStretchSpacer(int prop) -{ - return Add(0, 0, prop); -} - -inline wxSizerItem* -wxSizer::Prepend( wxSizerItem *item ) -{ - return Insert( 0, item ); -} - -inline wxSizerItem* -wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) -{ - return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) -{ - return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) -{ - return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::PrependSpacer(int size) -{ - return Prepend(size, size); -} - -inline wxSizerItem* -wxSizer::PrependStretchSpacer(int prop) -{ - return Prepend(0, 0, prop); -} - -inline wxSizerItem* -wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) -{ - return Prepend( new wxSizerItem(window, flags) ); -} - -inline wxSizerItem* -wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) -{ - return Prepend( new wxSizerItem(sizer, flags) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, - wxWindow *window, - int proportion, - int flag, - int border, - wxObject* userData ) -{ - return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, - wxSizer *sizer, - int proportion, - int flag, - int border, - wxObject* userData ) -{ - return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, - int width, - int height, - int proportion, - int flag, - int border, - wxObject* userData ) -{ - return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) -{ - return Insert( index, new wxSizerItem(window, flags) ); -} - -inline wxSizerItem* -wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) -{ - return Insert( index, new wxSizerItem(sizer, flags) ); -} - -inline wxSizerItem* -wxSizer::InsertSpacer(size_t index, int size) -{ - return Insert(index, size, size); -} - -inline wxSizerItem* -wxSizer::InsertStretchSpacer(size_t index, int prop) -{ - return Insert(index, 0, 0, prop); -} - - -#endif // __WXSIZER_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sizer.h +// Purpose: provide wxSizer class for layout +// Author: Robert Roebling and Robin Dunn +// Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) +// Created: +// RCS-ID: $Id: sizer.h 52331 2008-03-05 15:02:22Z VS $ +// Copyright: (c) Robin Dunn, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WXSIZER_H__ +#define __WXSIZER_H__ + +#include "wx/defs.h" + +#include "wx/window.h" + +//--------------------------------------------------------------------------- +// classes +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxBoxSizer; +class WXDLLIMPEXP_FWD_CORE wxSizerItem; +class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxFlexGridSizer; +class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; + +#ifndef wxUSE_BORDER_BY_DEFAULT + #ifdef __SMARTPHONE__ + // no borders by default on limited size screen + #define wxUSE_BORDER_BY_DEFAULT 0 + #else + #define wxUSE_BORDER_BY_DEFAULT 1 + #endif +#endif + +// ---------------------------------------------------------------------------- +// wxSizerFlags: flags used for an item in the sizer +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSizerFlags +{ +public: + // construct the flags object initialized with the given proportion (0 by + // default) + wxSizerFlags(int proportion = 0) : m_proportion(proportion) + { + m_flags = 0; + m_borderInPixels = 0; + } + + // setters for all sizer flags, they all return the object itself so that + // calls to them can be chained + + wxSizerFlags& Proportion(int proportion) + { + m_proportion = proportion; + return *this; + } + + wxSizerFlags& Align(int alignment) // combination of wxAlignment values + { + m_flags &= ~wxALIGN_MASK; + m_flags |= alignment; + + return *this; + } + + wxSizerFlags& Expand() + { + m_flags |= wxEXPAND; + return *this; + } + + // some shortcuts for Align() + wxSizerFlags& Centre() { return Align(wxCENTRE); } + wxSizerFlags& Center() { return Centre(); } + wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } + wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } + +#if wxABI_VERSION >= 20802 + wxSizerFlags& Top() { return Align(wxALIGN_TOP); } + wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } +#endif // wxABI 2.8.2+ + + // default border size used by Border() below + static int GetDefaultBorder() + { +#if wxUSE_BORDER_BY_DEFAULT + // FIXME: default border size shouldn't be hardcoded and at the very + // least they should depend on the current font size + return 5; +#else + return 0; +#endif + } + + + wxSizerFlags& Border(int direction, int borderInPixels) + { + m_flags &= ~wxALL; + m_flags |= direction; + + m_borderInPixels = borderInPixels; + + return *this; + } + + wxSizerFlags& Border(int direction = wxALL) + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(direction, GetDefaultBorder()); +#else + // no borders by default on limited size screen + wxUnusedVar(direction); + + return *this; +#endif + } + + wxSizerFlags& DoubleBorder(int direction = wxALL) + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(direction, 2*GetDefaultBorder()); +#else + wxUnusedVar(direction); + + return *this; +#endif + } + + wxSizerFlags& TripleBorder(int direction = wxALL) + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(direction, 3*GetDefaultBorder()); +#else + wxUnusedVar(direction); + + return *this; +#endif + } + + wxSizerFlags& HorzBorder() + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(wxLEFT | wxRIGHT, GetDefaultBorder()); +#else + return *this; +#endif + } + + wxSizerFlags& DoubleHorzBorder() + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder()); +#else + return *this; +#endif + } + +#if wxABI_VERSION >= 20802 + // setters for the others flags + wxSizerFlags& Shaped() + { + m_flags |= wxSHAPED; + + return *this; + } + + wxSizerFlags& FixedMinSize() + { + m_flags |= wxFIXED_MINSIZE; + + return *this; + } +#endif // wx 2.8.2+ + +#if wxABI_VERSION >= 20808 + // makes the item ignore window's visibility status + wxSizerFlags& ReserveSpaceEvenIfHidden(); +#endif + + // accessors for wxSizer only + int GetProportion() const { return m_proportion; } + int GetFlags() const { return m_flags; } + int GetBorderInPixels() const { return m_borderInPixels; } + +private: + int m_proportion; + int m_flags; + int m_borderInPixels; +}; + + +// ---------------------------------------------------------------------------- +// wxSizerSpacer: used by wxSizerItem to represent a spacer +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSizerSpacer +{ +public: + wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } + + void SetSize(const wxSize& size) { m_size = size; } + const wxSize& GetSize() const { return m_size; } + + void Show(bool show) { m_isShown = show; } + bool IsShown() const { return m_isShown; } + +private: + // the size, in pixel + wxSize m_size; + + // is the spacer currently shown? + bool m_isShown; +}; + +// ---------------------------------------------------------------------------- +// wxSizerItem +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSizerItem : public wxObject +{ +public: + // window + wxSizerItem( wxWindow *window, + int proportion, + int flag, + int border, + wxObject* userData ); + + // window with flags + wxSizerItem(wxWindow *window, const wxSizerFlags& flags) + { + Init(flags); + + SetWindow(window); + } + + // subsizer + wxSizerItem( wxSizer *sizer, + int proportion, + int flag, + int border, + wxObject* userData ); + + // sizer with flags + wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) + { + Init(flags); + + SetSizer(sizer); + } + + // spacer + wxSizerItem( int width, + int height, + int proportion, + int flag, + int border, + wxObject* userData); + + // spacer with flags + wxSizerItem(int width, int height, const wxSizerFlags& flags) + { + Init(flags); + + SetSpacer(width, height); + } + + wxSizerItem(); + virtual ~wxSizerItem(); + + virtual void DeleteWindows(); + + // Enable deleting the SizerItem without destroying the contained sizer. + void DetachSizer() { m_sizer = NULL; } + + virtual wxSize GetSize() const; + virtual wxSize CalcMin(); + virtual void SetDimension( const wxPoint& pos, const wxSize& size ); + + wxSize GetMinSize() const + { return m_minSize; } + wxSize GetMinSizeWithBorder() const; + + void SetMinSize(const wxSize& size) + { + if ( IsWindow() ) + m_window->SetMinSize(size); + m_minSize = size; + } + void SetMinSize( int x, int y ) + { SetMinSize(wxSize(x, y)); } + void SetInitSize( int x, int y ) + { SetMinSize(wxSize(x, y)); } + + // if either of dimensions is zero, ratio is assumed to be 1 + // to avoid "divide by zero" errors + void SetRatio(int width, int height) + { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } + void SetRatio(const wxSize& size) + { SetRatio(size.x, size.y); } + void SetRatio(float ratio) + { m_ratio = ratio; } + float GetRatio() const + { return m_ratio; } + + virtual wxRect GetRect() { return m_rect; } + + bool IsWindow() const { return m_kind == Item_Window; } + bool IsSizer() const { return m_kind == Item_Sizer; } + bool IsSpacer() const { return m_kind == Item_Spacer; } + +#if WXWIN_COMPATIBILITY_2_6 + // Deprecated in 2.6, use {G,S}etProportion instead. + wxDEPRECATED( void SetOption( int option ) ); + wxDEPRECATED( int GetOption() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + + void SetProportion( int proportion ) + { m_proportion = proportion; } + int GetProportion() const + { return m_proportion; } + void SetFlag( int flag ) + { m_flag = flag; } + int GetFlag() const + { return m_flag; } + void SetBorder( int border ) + { m_border = border; } + int GetBorder() const + { return m_border; } + + wxWindow *GetWindow() const + { return m_kind == Item_Window ? m_window : NULL; } + wxSizer *GetSizer() const + { return m_kind == Item_Sizer ? m_sizer : NULL; } + wxSize GetSpacer() const; + + // this function behaves obviously for the windows and spacers but for the + // sizers it returns true if any sizer element is shown and only returns + // false if all of them are hidden + bool IsShown() const; + void Show(bool show); + + void SetUserData(wxObject* userData) + { delete m_userData; m_userData = userData; } + wxObject* GetUserData() const + { return m_userData; } + wxPoint GetPosition() const + { return m_pos; } + + + // these functions do not free old sizer/spacer + void SetWindow(wxWindow *window); + void SetSizer(wxSizer *sizer); + void SetSpacer(const wxSize& size); + void SetSpacer(int width, int height) { SetSpacer(wxSize(width, height)); } + +protected: + // common part of several ctors + void Init() { m_userData = NULL; } + + // common part of ctors taking wxSizerFlags + void Init(const wxSizerFlags& flags); + + + // discriminated union: depending on m_kind one of the fields is valid + enum + { + Item_None, + Item_Window, + Item_Sizer, + Item_Spacer, + Item_Max + } m_kind; + union + { + wxWindow *m_window; + wxSizer *m_sizer; + wxSizerSpacer *m_spacer; + }; + + wxPoint m_pos; + wxSize m_minSize; + int m_proportion; + int m_border; + int m_flag; + + // on screen rectangle of this item (not including borders) + wxRect m_rect; + + // Aspect ratio can always be calculated from m_size, + // but this would cause precision loss when the window + // is shrunk. It is safer to preserve the initial value. + float m_ratio; + + wxObject *m_userData; + +private: + // 2.8-only implementation detail for wxRESERVE_SPACE_EVEN_IF_HIDDEN + bool ShouldAccountFor() const; + + DECLARE_CLASS(wxSizerItem) + DECLARE_NO_COPY_CLASS(wxSizerItem) + + friend class wxBoxSizer; + friend class wxFlexGridSizer; + friend class wxGridBagSizer; +}; + +WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); + + +//--------------------------------------------------------------------------- +// wxSizer +//--------------------------------------------------------------------------- + +class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer +{ +public: + wxSizer() { m_containingWindow = NULL; } + virtual ~wxSizer(); + + // methods for adding elements to the sizer: there are Add/Insert/Prepend + // overloads for each of window/sizer/spacer/wxSizerItem + wxSizerItem* Add(wxWindow *window, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Add(wxSizer *sizer, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Add(int width, + int height, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); + wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); + wxSizerItem* Add( wxSizerItem *item); + + wxSizerItem* AddSpacer(int size); + wxSizerItem* AddStretchSpacer(int prop = 1); + + wxSizerItem* Insert(size_t index, + wxWindow *window, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Insert(size_t index, + wxSizer *sizer, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Insert(size_t index, + int width, + int height, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Insert(size_t index, + wxWindow *window, + const wxSizerFlags& flags); + wxSizerItem* Insert(size_t index, + wxSizer *sizer, + const wxSizerFlags& flags); + virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); + + wxSizerItem* InsertSpacer(size_t index, int size); + wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); + + wxSizerItem* Prepend(wxWindow *window, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Prepend(wxSizer *sizer, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Prepend(int width, + int height, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); + wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); + wxSizerItem* Prepend(wxSizerItem *item); + + wxSizerItem* PrependSpacer(int size); + wxSizerItem* PrependStretchSpacer(int prop = 1); + + // set (or possibly unset if window is NULL) or get the window this sizer + // is used in + void SetContainingWindow(wxWindow *window); + wxWindow *GetContainingWindow() const { return m_containingWindow; } + +#if WXWIN_COMPATIBILITY_2_6 + // Deprecated in 2.6 since historically it does not delete the window, + // use Detach instead. + wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + virtual bool Remove( wxSizer *sizer ); + virtual bool Remove( int index ); + + virtual bool Detach( wxWindow *window ); + virtual bool Detach( wxSizer *sizer ); + virtual bool Detach( int index ); + + virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); + virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); + virtual bool Replace( size_t index, wxSizerItem *newitem ); + + virtual void Clear( bool delete_windows = false ); + virtual void DeleteWindows(); + + void SetMinSize( int width, int height ) + { DoSetMinSize( width, height ); } + void SetMinSize( const wxSize& size ) + { DoSetMinSize( size.x, size.y ); } + + // Searches recursively + bool SetItemMinSize( wxWindow *window, int width, int height ) + { return DoSetItemMinSize( window, width, height ); } + bool SetItemMinSize( wxWindow *window, const wxSize& size ) + { return DoSetItemMinSize( window, size.x, size.y ); } + + // Searches recursively + bool SetItemMinSize( wxSizer *sizer, int width, int height ) + { return DoSetItemMinSize( sizer, width, height ); } + bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) + { return DoSetItemMinSize( sizer, size.x, size.y ); } + + bool SetItemMinSize( size_t index, int width, int height ) + { return DoSetItemMinSize( index, width, height ); } + bool SetItemMinSize( size_t index, const wxSize& size ) + { return DoSetItemMinSize( index, size.x, size.y ); } + + wxSize GetSize() const + { return m_size; } + wxPoint GetPosition() const + { return m_position; } + + // Calculate the minimal size or return m_minSize if bigger. + wxSize GetMinSize(); + + virtual void RecalcSizes() = 0; + virtual wxSize CalcMin() = 0; + + virtual void Layout(); + +#if wxABI_VERSION >= 20808 + wxSize ComputeFittingClientSize(wxWindow *window); + wxSize ComputeFittingWindowSize(wxWindow *window); +#endif + + wxSize Fit( wxWindow *window ); + void FitInside( wxWindow *window ); + void SetSizeHints( wxWindow *window ); + void SetVirtualSizeHints( wxWindow *window ); + + wxSizerItemList& GetChildren() + { return m_children; } + + void SetDimension( int x, int y, int width, int height ); + + wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); + wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); + wxSizerItem* GetItem( size_t index ); + + // Manage whether individual scene items are considered + // in the layout calculations or not. + bool Show( wxWindow *window, bool show = true, bool recursive = false ); + bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); + bool Show( size_t index, bool show = true ); + + bool Hide( wxSizer *sizer, bool recursive = false ) + { return Show( sizer, false, recursive ); } + bool Hide( wxWindow *window, bool recursive = false ) + { return Show( window, false, recursive ); } + bool Hide( size_t index ) + { return Show( index, false ); } + + bool IsShown( wxWindow *window ) const; + bool IsShown( wxSizer *sizer ) const; + bool IsShown( size_t index ) const; + + // Recursively call wxWindow::Show () on all sizer items. + virtual void ShowItems (bool show); + + void Show(bool show) { ShowItems(show); } + +protected: + wxSize m_size; + wxSize m_minSize; + wxPoint m_position; + wxSizerItemList m_children; + + // the window this sizer is used in, can be NULL + wxWindow *m_containingWindow; + + wxSize GetMaxWindowSize( wxWindow *window ) const; + wxSize GetMinWindowSize( wxWindow *window ); + wxSize GetMaxClientSize( wxWindow *window ) const; + wxSize GetMinClientSize( wxWindow *window ); + wxSize VirtualFitSize( wxWindow *window ); + + virtual void DoSetMinSize( int width, int height ); + virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); + virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); + virtual bool DoSetItemMinSize( size_t index, int width, int height ); + +private: + DECLARE_CLASS(wxSizer) +}; + +//--------------------------------------------------------------------------- +// wxGridSizer +//--------------------------------------------------------------------------- + +class WXDLLEXPORT wxGridSizer: public wxSizer +{ +public: + wxGridSizer( int rows, int cols, int vgap, int hgap ); + wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); + + virtual void RecalcSizes(); + virtual wxSize CalcMin(); + + void SetCols( int cols ) { m_cols = cols; } + void SetRows( int rows ) { m_rows = rows; } + void SetVGap( int gap ) { m_vgap = gap; } + void SetHGap( int gap ) { m_hgap = gap; } + int GetCols() const { return m_cols; } + int GetRows() const { return m_rows; } + int GetVGap() const { return m_vgap; } + int GetHGap() const { return m_hgap; } + +protected: + int m_rows; + int m_cols; + int m_vgap; + int m_hgap; + + // return the number of total items and the number of columns and rows + int CalcRowsCols(int& rows, int& cols) const; + + void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); + +private: + DECLARE_CLASS(wxGridSizer) +}; + +//--------------------------------------------------------------------------- +// wxFlexGridSizer +//--------------------------------------------------------------------------- + +// the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" +// direction +enum wxFlexSizerGrowMode +{ + // don't resize the cells in non-flexible direction at all + wxFLEX_GROWMODE_NONE, + + // uniformly resize only the specified ones (default) + wxFLEX_GROWMODE_SPECIFIED, + + // uniformly resize all cells + wxFLEX_GROWMODE_ALL +}; + +class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer +{ +public: + // ctors/dtor + wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); + wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); + virtual ~wxFlexGridSizer(); + + + // set the rows/columns which will grow (the others will remain of the + // constant initial size) + void AddGrowableRow( size_t idx, int proportion = 0 ); + void RemoveGrowableRow( size_t idx ); + void AddGrowableCol( size_t idx, int proportion = 0 ); + void RemoveGrowableCol( size_t idx ); + + + // the sizer cells may grow in both directions, not grow at all or only + // grow in one direction but not the other + + // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) + void SetFlexibleDirection(int direction) { m_flexDirection = direction; } + int GetFlexibleDirection() const { return m_flexDirection; } + + // note that the grow mode only applies to the direction which is not + // flexible + void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } + wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } + + // Read-only access to the row heights and col widths arrays + const wxArrayInt& GetRowHeights() const { return m_rowHeights; } + const wxArrayInt& GetColWidths() const { return m_colWidths; } + + // implementation + virtual void RecalcSizes(); + virtual wxSize CalcMin(); + +protected: + void AdjustForFlexDirection(); + void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, + int nrows, int ncols); + + // the heights/widths of all rows/columns + wxArrayInt m_rowHeights, + m_colWidths; + + // indices of the growable columns and rows + wxArrayInt m_growableRows, + m_growableCols; + + // proportion values of the corresponding growable rows and columns + wxArrayInt m_growableRowsProportions, + m_growableColsProportions; + + // parameters describing whether the growable cells should be resized in + // both directions or only one + int m_flexDirection; + wxFlexSizerGrowMode m_growMode; + + // saves CalcMin result to optimize RecalcSizes + wxSize m_calculatedMinSize; + +private: + DECLARE_CLASS(wxFlexGridSizer) + DECLARE_NO_COPY_CLASS(wxFlexGridSizer) +}; + +//--------------------------------------------------------------------------- +// wxBoxSizer +//--------------------------------------------------------------------------- + +class WXDLLEXPORT wxBoxSizer: public wxSizer +{ +public: + wxBoxSizer( int orient ); + + void RecalcSizes(); + wxSize CalcMin(); + + int GetOrientation() const + { return m_orient; } + + void SetOrientation(int orient) + { m_orient = orient; } + +protected: + int m_orient; + int m_stretchable; + int m_minWidth; + int m_minHeight; + int m_fixedWidth; + int m_fixedHeight; + +private: + DECLARE_CLASS(wxBoxSizer) +}; + +//--------------------------------------------------------------------------- +// wxStaticBoxSizer +//--------------------------------------------------------------------------- + +#if wxUSE_STATBOX + +class WXDLLIMPEXP_FWD_CORE wxStaticBox; + +class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer +{ +public: + wxStaticBoxSizer(wxStaticBox *box, int orient); + wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); + virtual ~wxStaticBoxSizer(); + + void RecalcSizes(); + wxSize CalcMin(); + + wxStaticBox *GetStaticBox() const + { return m_staticBox; } + + // override to hide/show the static box as well + virtual void ShowItems (bool show); + + virtual bool Detach( wxWindow *window ); + virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } + virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } + +protected: + wxStaticBox *m_staticBox; + +private: + DECLARE_CLASS(wxStaticBoxSizer) + DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) +}; + +#endif // wxUSE_STATBOX + +#if wxUSE_BUTTON + +class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer +{ +public: + // Constructor just creates a new wxBoxSizer, not much else. + // Box sizer orientation is automatically determined here: + // vertical for PDAs, horizontal for everything else? + wxStdDialogButtonSizer(); + + // Checks button ID against system IDs and sets one of the pointers below + // to this button. Does not do any sizer-related things here. + void AddButton(wxButton *button); + + // Use these if no standard ID can/should be used + void SetAffirmativeButton( wxButton *button ); + void SetNegativeButton( wxButton *button ); + void SetCancelButton( wxButton *button ); + + // All platform-specific code here, checks which buttons exist and add + // them to the sizer accordingly. + // Note - one potential hack on Mac we could use here, + // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE + // is set to _("Save") and m_buttonNegative is set to _("Don't Save") + // I wouldn't add any other hacks like that into here, + // but this one I can see being useful. + void Realize(); + + wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } + wxButton *GetApplyButton() const { return m_buttonApply; } + wxButton *GetNegativeButton() const { return m_buttonNegative; } + wxButton *GetCancelButton() const { return m_buttonCancel; } + wxButton *GetHelpButton() const { return m_buttonHelp; } + +protected: + wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here + wxButton *m_buttonApply; + wxButton *m_buttonNegative; // wxID_NO + wxButton *m_buttonCancel; + wxButton *m_buttonHelp; + +private: + DECLARE_CLASS(wxStdDialogButtonSizer) + DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) +}; + +#endif // wxUSE_BUTTON + +#if WXWIN_COMPATIBILITY_2_4 +// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they +// don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. + +// ---------------------------------------------------------------------------- +// wxBookCtrlSizer +// ---------------------------------------------------------------------------- + +#if wxUSE_BOOKCTRL + +// this sizer works with wxNotebook/wxListbook/... and sizes the control to +// fit its pages +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; + +class WXDLLEXPORT wxBookCtrlSizer : public wxSizer +{ +public: +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + wxBookCtrlBase *GetControl() const { return m_bookctrl; } + + virtual void RecalcSizes(); + virtual wxSize CalcMin(); + +protected: + // this protected ctor lets us mark the real one above as deprecated + // and still have warning-free build of the library itself: + wxBookCtrlSizer() {} + + wxBookCtrlBase *m_bookctrl; + +private: + DECLARE_CLASS(wxBookCtrlSizer) + DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) +}; + + +#if wxUSE_NOTEBOOK + +// before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards +// compatibility +class WXDLLIMPEXP_FWD_CORE wxNotebook; + +class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer +{ +public: +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } + +private: + DECLARE_CLASS(wxNotebookSizer) + DECLARE_NO_COPY_CLASS(wxNotebookSizer) +}; + +#endif // wxUSE_NOTEBOOK + +#endif // wxUSE_BOOKCTRL + +#endif // WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +inline wxSizerItem* +wxSizer::Add( wxSizerItem *item ) +{ + return Insert( m_children.GetCount(), item ); +} + +inline wxSizerItem* +wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) +{ + return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) +{ + return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) +{ + return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) +{ + return Add( new wxSizerItem(window, flags) ); +} + +inline wxSizerItem* +wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) +{ + return Add( new wxSizerItem(sizer, flags) ); +} + +inline wxSizerItem* +wxSizer::AddSpacer(int size) +{ + return Add(size, size); +} + +inline wxSizerItem* +wxSizer::AddStretchSpacer(int prop) +{ + return Add(0, 0, prop); +} + +inline wxSizerItem* +wxSizer::Prepend( wxSizerItem *item ) +{ + return Insert( 0, item ); +} + +inline wxSizerItem* +wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) +{ + return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) +{ + return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) +{ + return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::PrependSpacer(int size) +{ + return Prepend(size, size); +} + +inline wxSizerItem* +wxSizer::PrependStretchSpacer(int prop) +{ + return Prepend(0, 0, prop); +} + +inline wxSizerItem* +wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) +{ + return Prepend( new wxSizerItem(window, flags) ); +} + +inline wxSizerItem* +wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) +{ + return Prepend( new wxSizerItem(sizer, flags) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, + wxWindow *window, + int proportion, + int flag, + int border, + wxObject* userData ) +{ + return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, + wxSizer *sizer, + int proportion, + int flag, + int border, + wxObject* userData ) +{ + return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, + int width, + int height, + int proportion, + int flag, + int border, + wxObject* userData ) +{ + return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) +{ + return Insert( index, new wxSizerItem(window, flags) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) +{ + return Insert( index, new wxSizerItem(sizer, flags) ); +} + +inline wxSizerItem* +wxSizer::InsertSpacer(size_t index, int size) +{ + return Insert(index, size, size); +} + +inline wxSizerItem* +wxSizer::InsertStretchSpacer(size_t index, int prop) +{ + return Insert(index, 0, 0, prop); +} + + +#endif // __WXSIZER_H__ diff --git a/Externals/wxWidgets/include/wx/slider.h b/Externals/wxWidgets/include/wx/slider.h index 77fcef2532..195b9f8a3a 100644 --- a/Externals/wxWidgets/include/wx/slider.h +++ b/Externals/wxWidgets/include/wx/slider.h @@ -1,151 +1,151 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/slider.h -// Purpose: wxSlider interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 09.02.01 -// RCS-ID: $Id: slider.h 38717 2006-04-14 17:01:16Z ABX $ -// Copyright: (c) 1996-2001 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SLIDER_H_BASE_ -#define _WX_SLIDER_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_SLIDER - -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// wxSlider flags -// ---------------------------------------------------------------------------- - -#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */ -#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */ - -#define wxSL_TICKS 0x0010 -#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks -#define wxSL_LABELS 0x0020 -#define wxSL_LEFT 0x0040 -#define wxSL_TOP 0x0080 -#define wxSL_RIGHT 0x0100 -#define wxSL_BOTTOM 0x0200 -#define wxSL_BOTH 0x0400 -#define wxSL_SELRANGE 0x0800 -#define wxSL_INVERSE 0x1000 - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete - #define wxSL_NOTIFY_DRAG 0x0000 -#endif // WXWIN_COMPATIBILITY_2_6 - -extern WXDLLEXPORT_DATA(const wxChar) wxSliderNameStr[]; - -// ---------------------------------------------------------------------------- -// wxSliderBase: define wxSlider interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSliderBase : public wxControl -{ -public: - /* the ctor of the derived class should have the following form: - - wxSlider(wxWindow *parent, - wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - */ - wxSliderBase() { } - - // get/set the current slider value (should be in range) - virtual int GetValue() const = 0; - virtual void SetValue(int value) = 0; - - // retrieve/change the range - virtual void SetRange(int minValue, int maxValue) = 0; - virtual int GetMin() const = 0; - virtual int GetMax() const = 0; - void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; } - void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; } - - // the line/page size is the increment by which the slider moves when - // cursor arrow key/page up or down are pressed (clicking the mouse is like - // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range - virtual void SetLineSize(int lineSize) = 0; - virtual void SetPageSize(int pageSize) = 0; - virtual int GetLineSize() const = 0; - virtual int GetPageSize() const = 0; - - // these methods get/set the length of the slider pointer in pixels - virtual void SetThumbLength(int lenPixels) = 0; - virtual int GetThumbLength() const = 0; - - // warning: most of subsequent methods are currently only implemented in - // wxMSW under Win95 and are silently ignored on other platforms - - virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { } - virtual int GetTickFreq() const { return 0; } - virtual void ClearTicks() { } - virtual void SetTick(int WXUNUSED(tickPos)) { } - - virtual void ClearSel() { } - virtual int GetSelEnd() const { return GetMin(); } - virtual int GetSelStart() const { return GetMax(); } - virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } - -protected: - - // adjust value according to wxSL_INVERSE style - virtual int ValueInvertOrNot(int value) const - { - if (HasFlag(wxSL_INVERSE)) - return (GetMax() + GetMin()) - value; - else - return value; - } - -private: - DECLARE_NO_COPY_CLASS(wxSliderBase) -}; - -// ---------------------------------------------------------------------------- -// include the real class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/slider.h" -#elif defined(__WXMSW__) - #include "wx/msw/slider95.h" - #if WXWIN_COMPATIBILITY_2_4 - #define wxSlider95 wxSlider - #endif -#elif defined(__WXMOTIF__) - #include "wx/motif/slider.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/slider.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/slider.h" -#elif defined(__WXMAC__) - #include "wx/mac/slider.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/slider.h" -#elif defined(__WXPM__) - #include "wx/os2/slider.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/slider.h" -#endif - -#endif // wxUSE_SLIDER - -#endif - // _WX_SLIDER_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/slider.h +// Purpose: wxSlider interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 09.02.01 +// RCS-ID: $Id: slider.h 38717 2006-04-14 17:01:16Z ABX $ +// Copyright: (c) 1996-2001 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER_H_BASE_ +#define _WX_SLIDER_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_SLIDER + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxSlider flags +// ---------------------------------------------------------------------------- + +#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */ +#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */ + +#define wxSL_TICKS 0x0010 +#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks +#define wxSL_LABELS 0x0020 +#define wxSL_LEFT 0x0040 +#define wxSL_TOP 0x0080 +#define wxSL_RIGHT 0x0100 +#define wxSL_BOTTOM 0x0200 +#define wxSL_BOTH 0x0400 +#define wxSL_SELRANGE 0x0800 +#define wxSL_INVERSE 0x1000 + +#if WXWIN_COMPATIBILITY_2_6 + // obsolete + #define wxSL_NOTIFY_DRAG 0x0000 +#endif // WXWIN_COMPATIBILITY_2_6 + +extern WXDLLEXPORT_DATA(const wxChar) wxSliderNameStr[]; + +// ---------------------------------------------------------------------------- +// wxSliderBase: define wxSlider interface +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSliderBase : public wxControl +{ +public: + /* the ctor of the derived class should have the following form: + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + */ + wxSliderBase() { } + + // get/set the current slider value (should be in range) + virtual int GetValue() const = 0; + virtual void SetValue(int value) = 0; + + // retrieve/change the range + virtual void SetRange(int minValue, int maxValue) = 0; + virtual int GetMin() const = 0; + virtual int GetMax() const = 0; + void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; } + void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; } + + // the line/page size is the increment by which the slider moves when + // cursor arrow key/page up or down are pressed (clicking the mouse is like + // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range + virtual void SetLineSize(int lineSize) = 0; + virtual void SetPageSize(int pageSize) = 0; + virtual int GetLineSize() const = 0; + virtual int GetPageSize() const = 0; + + // these methods get/set the length of the slider pointer in pixels + virtual void SetThumbLength(int lenPixels) = 0; + virtual int GetThumbLength() const = 0; + + // warning: most of subsequent methods are currently only implemented in + // wxMSW under Win95 and are silently ignored on other platforms + + virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { } + virtual int GetTickFreq() const { return 0; } + virtual void ClearTicks() { } + virtual void SetTick(int WXUNUSED(tickPos)) { } + + virtual void ClearSel() { } + virtual int GetSelEnd() const { return GetMin(); } + virtual int GetSelStart() const { return GetMax(); } + virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } + +protected: + + // adjust value according to wxSL_INVERSE style + virtual int ValueInvertOrNot(int value) const + { + if (HasFlag(wxSL_INVERSE)) + return (GetMax() + GetMin()) - value; + else + return value; + } + +private: + DECLARE_NO_COPY_CLASS(wxSliderBase) +}; + +// ---------------------------------------------------------------------------- +// include the real class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/slider.h" +#elif defined(__WXMSW__) + #include "wx/msw/slider95.h" + #if WXWIN_COMPATIBILITY_2_4 + #define wxSlider95 wxSlider + #endif +#elif defined(__WXMOTIF__) + #include "wx/motif/slider.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/slider.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/slider.h" +#elif defined(__WXMAC__) + #include "wx/mac/slider.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/slider.h" +#elif defined(__WXPM__) + #include "wx/os2/slider.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/slider.h" +#endif + +#endif // wxUSE_SLIDER + +#endif + // _WX_SLIDER_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/snglinst.h b/Externals/wxWidgets/include/wx/snglinst.h index 50a856332c..1755f8969a 100644 --- a/Externals/wxWidgets/include/wx/snglinst.h +++ b/Externals/wxWidgets/include/wx/snglinst.h @@ -1,65 +1,65 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/snglinst.h -// Purpose: wxSingleInstanceChecker can be used to restrict the number of -// simultaneously running copies of a program to one -// Author: Vadim Zeitlin -// Modified by: -// Created: 08.06.01 -// RCS-ID: $Id: snglinst.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SNGLINST_H_ -#define _WX_SNGLINST_H_ - -#if wxUSE_SNGLINST_CHECKER - -// ---------------------------------------------------------------------------- -// wxSingleInstanceChecker -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSingleInstanceChecker -{ -public: - // default ctor, use Create() after it - wxSingleInstanceChecker() { Init(); } - - // like Create() but no error checking (dangerous!) - wxSingleInstanceChecker(const wxString& name, - const wxString& path = wxEmptyString) - { - Init(); - Create(name, path); - } - - // name must be given and be as unique as possible, it is used as the mutex - // name under Win32 and the lock file name under Unix - - // wxTheApp->GetAppName() may be a good value for this parameter - // - // path is optional and is ignored under Win32 and used as the directory to - // create the lock file in under Unix (default is wxGetHomeDir()) - // - // returns false if initialization failed, it doesn't mean that another - // instance is running - use IsAnotherRunning() to check it - bool Create(const wxString& name, const wxString& path = wxEmptyString); - - // is another copy of this program already running? - bool IsAnotherRunning() const; - - // dtor is not virtual, this class is not meant to be used polymorphically - ~wxSingleInstanceChecker(); - -private: - // common part of all ctors - void Init() { m_impl = NULL; } - - // the implementation details (platform specific) - class WXDLLIMPEXP_FWD_BASE wxSingleInstanceCheckerImpl *m_impl; - - DECLARE_NO_COPY_CLASS(wxSingleInstanceChecker) -}; - -#endif // wxUSE_SNGLINST_CHECKER - -#endif // _WX_SNGLINST_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/snglinst.h +// Purpose: wxSingleInstanceChecker can be used to restrict the number of +// simultaneously running copies of a program to one +// Author: Vadim Zeitlin +// Modified by: +// Created: 08.06.01 +// RCS-ID: $Id: snglinst.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SNGLINST_H_ +#define _WX_SNGLINST_H_ + +#if wxUSE_SNGLINST_CHECKER + +// ---------------------------------------------------------------------------- +// wxSingleInstanceChecker +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSingleInstanceChecker +{ +public: + // default ctor, use Create() after it + wxSingleInstanceChecker() { Init(); } + + // like Create() but no error checking (dangerous!) + wxSingleInstanceChecker(const wxString& name, + const wxString& path = wxEmptyString) + { + Init(); + Create(name, path); + } + + // name must be given and be as unique as possible, it is used as the mutex + // name under Win32 and the lock file name under Unix - + // wxTheApp->GetAppName() may be a good value for this parameter + // + // path is optional and is ignored under Win32 and used as the directory to + // create the lock file in under Unix (default is wxGetHomeDir()) + // + // returns false if initialization failed, it doesn't mean that another + // instance is running - use IsAnotherRunning() to check it + bool Create(const wxString& name, const wxString& path = wxEmptyString); + + // is another copy of this program already running? + bool IsAnotherRunning() const; + + // dtor is not virtual, this class is not meant to be used polymorphically + ~wxSingleInstanceChecker(); + +private: + // common part of all ctors + void Init() { m_impl = NULL; } + + // the implementation details (platform specific) + class WXDLLIMPEXP_FWD_BASE wxSingleInstanceCheckerImpl *m_impl; + + DECLARE_NO_COPY_CLASS(wxSingleInstanceChecker) +}; + +#endif // wxUSE_SNGLINST_CHECKER + +#endif // _WX_SNGLINST_H_ diff --git a/Externals/wxWidgets/include/wx/socket.h b/Externals/wxWidgets/include/wx/socket.h index c31db2a064..07cd4cbaf0 100644 --- a/Externals/wxWidgets/include/wx/socket.h +++ b/Externals/wxWidgets/include/wx/socket.h @@ -1,335 +1,335 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: socket.h -// Purpose: Socket handling classes -// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia -// Modified by: -// Created: April 1997 -// RCS-ID: $Id: socket.h 45498 2007-04-16 13:03:05Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SOCKET_H_ -#define _WX_SOCKET_H_ - -#include "wx/defs.h" - -#if wxUSE_SOCKETS - -// --------------------------------------------------------------------------- -// wxSocket headers -// --------------------------------------------------------------------------- - -#include "wx/event.h" -#include "wx/sckaddr.h" -#include "wx/gsocket.h" -#include "wx/list.h" - -// ------------------------------------------------------------------------ -// Types and constants -// ------------------------------------------------------------------------ - -enum wxSocketNotify -{ - wxSOCKET_INPUT = GSOCK_INPUT, - wxSOCKET_OUTPUT = GSOCK_OUTPUT, - wxSOCKET_CONNECTION = GSOCK_CONNECTION, - wxSOCKET_LOST = GSOCK_LOST -}; - -enum -{ - wxSOCKET_INPUT_FLAG = GSOCK_INPUT_FLAG, - wxSOCKET_OUTPUT_FLAG = GSOCK_OUTPUT_FLAG, - wxSOCKET_CONNECTION_FLAG = GSOCK_CONNECTION_FLAG, - wxSOCKET_LOST_FLAG = GSOCK_LOST_FLAG -}; - -typedef GSocketEventFlags wxSocketEventFlags; - -enum wxSocketError -{ - // from GSocket - wxSOCKET_NOERROR = GSOCK_NOERROR, - wxSOCKET_INVOP = GSOCK_INVOP, - wxSOCKET_IOERR = GSOCK_IOERR, - wxSOCKET_INVADDR = GSOCK_INVADDR, - wxSOCKET_INVSOCK = GSOCK_INVSOCK, - wxSOCKET_NOHOST = GSOCK_NOHOST, - wxSOCKET_INVPORT = GSOCK_INVPORT, - wxSOCKET_WOULDBLOCK = GSOCK_WOULDBLOCK, - wxSOCKET_TIMEDOUT = GSOCK_TIMEDOUT, - wxSOCKET_MEMERR = GSOCK_MEMERR, - - // wxSocket-specific (not yet implemented) - wxSOCKET_DUMMY -}; - -enum -{ - wxSOCKET_NONE = 0, - wxSOCKET_NOWAIT = 1, - wxSOCKET_WAITALL = 2, - wxSOCKET_BLOCK = 4, - wxSOCKET_REUSEADDR = 8 -}; - -enum wxSocketType -{ - wxSOCKET_UNINIT, - wxSOCKET_CLIENT, - wxSOCKET_SERVER, - wxSOCKET_BASE, - wxSOCKET_DATAGRAM -}; - -typedef int wxSocketFlags; - - - -// -------------------------------------------------------------------------- -// wxSocketBase -// -------------------------------------------------------------------------- - -class WXDLLIMPEXP_NET wxSocketBase : public wxObject -{ - DECLARE_CLASS(wxSocketBase) - -public: - - // Public interface - // ---------------- - - // ctors and dtors - wxSocketBase(); - wxSocketBase(wxSocketFlags flags, wxSocketType type); - virtual ~wxSocketBase(); - void Init(); - bool Destroy(); - - // state - inline bool Ok() const { return IsOk(); } - inline bool IsOk() const { return (m_socket != NULL); } - inline bool Error() const { return m_error; } - inline bool IsConnected() const { return m_connected; } - inline bool IsData() { return WaitForRead(0, 0); } - inline bool IsDisconnected() const { return !IsConnected(); } - inline wxUint32 LastCount() const { return m_lcount; } - inline wxSocketError LastError() const { return (wxSocketError)m_socket->GetError(); } - void SaveState(); - void RestoreState(); - - // addresses - virtual bool GetLocal(wxSockAddress& addr_man) const; - virtual bool GetPeer(wxSockAddress& addr_man) const; - virtual bool SetLocal(wxIPV4address& local); - - // base IO - virtual bool Close(); - wxSocketBase& Discard(); - wxSocketBase& Peek(void* buffer, wxUint32 nbytes); - wxSocketBase& Read(void* buffer, wxUint32 nbytes); - wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes); - wxSocketBase& Unread(const void *buffer, wxUint32 nbytes); - wxSocketBase& Write(const void *buffer, wxUint32 nbytes); - wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes); - - void InterruptWait() { m_interrupt = true; } - bool Wait(long seconds = -1, long milliseconds = 0); - bool WaitForRead(long seconds = -1, long milliseconds = 0); - bool WaitForWrite(long seconds = -1, long milliseconds = 0); - bool WaitForLost(long seconds = -1, long milliseconds = 0); - - inline wxSocketFlags GetFlags() const { return m_flags; } - void SetFlags(wxSocketFlags flags); - void SetTimeout(long seconds); - - bool GetOption(int level, int optname, void *optval, int *optlen); - bool SetOption(int level, int optname, const void *optval, int optlen); - inline wxUint32 GetLastIOSize() const { return m_lcount; } - - // event handling - void *GetClientData() const { return m_clientData; } - void SetClientData(void *data) { m_clientData = data; } - void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY); - void SetNotify(wxSocketEventFlags flags); - void Notify(bool notify); - - // initialize/shutdown the sockets (usually called automatically) - static bool IsInitialized(); - static bool Initialize(); - static void Shutdown(); - - - // Implementation from now on - // -------------------------- - - // do not use, should be private (called from GSocket) - void OnRequest(wxSocketNotify notify); - - // do not use, not documented nor supported - inline bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); } - inline wxSocketType GetType() const { return m_type; } - -private: - friend class wxSocketClient; - friend class wxSocketServer; - friend class wxDatagramSocket; - - // low level IO - wxUint32 _Read(void* buffer, wxUint32 nbytes); - wxUint32 _Write(const void *buffer, wxUint32 nbytes); - bool _Wait(long seconds, long milliseconds, wxSocketEventFlags flags); - - // pushback buffer - void Pushback(const void *buffer, wxUint32 size); - wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek); - -private: - // socket - GSocket *m_socket; // GSocket - wxSocketType m_type; // wxSocket type - - // state - wxSocketFlags m_flags; // wxSocket flags - bool m_connected; // connected? - bool m_establishing; // establishing connection? - bool m_reading; // busy reading? - bool m_writing; // busy writing? - bool m_error; // did last IO call fail? - wxSocketError m_lasterror; // last error (not cleared on success) - wxUint32 m_lcount; // last IO transaction size - unsigned long m_timeout; // IO timeout value - wxList m_states; // stack of states - bool m_interrupt; // interrupt ongoing wait operations? - bool m_beingDeleted; // marked for delayed deletion? - wxIPV4address m_localAddress; // bind to local address? - - // pushback buffer - void *m_unread; // pushback buffer - wxUint32 m_unrd_size; // pushback buffer size - wxUint32 m_unrd_cur; // pushback pointer (index into buffer) - - // events - int m_id; // socket id - wxEvtHandler *m_handler; // event handler - void *m_clientData; // client data for events - bool m_notify; // notify events to users? - wxSocketEventFlags m_eventmask; // which events to notify? - - // the initialization count, GSocket is initialized if > 0 - static size_t m_countInit; - - DECLARE_NO_COPY_CLASS(wxSocketBase) -}; - - -// -------------------------------------------------------------------------- -// wxSocketServer -// -------------------------------------------------------------------------- - -class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase -{ - DECLARE_CLASS(wxSocketServer) - -public: - wxSocketServer(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); - - wxSocketBase* Accept(bool wait = true); - bool AcceptWith(wxSocketBase& socket, bool wait = true); - - bool WaitForAccept(long seconds = -1, long milliseconds = 0); - - DECLARE_NO_COPY_CLASS(wxSocketServer) -}; - - -// -------------------------------------------------------------------------- -// wxSocketClient -// -------------------------------------------------------------------------- - -class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase -{ - DECLARE_CLASS(wxSocketClient) - -public: - wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); - virtual ~wxSocketClient(); - - virtual bool Connect(wxSockAddress& addr, bool wait = true); - bool Connect(wxSockAddress& addr, wxSockAddress& local, bool wait = true); - - bool WaitOnConnect(long seconds = -1, long milliseconds = 0); - -private: - virtual bool DoConnect(wxSockAddress& addr, wxSockAddress* local, bool wait = true); - - DECLARE_NO_COPY_CLASS(wxSocketClient) -}; - - -// -------------------------------------------------------------------------- -// wxDatagramSocket -// -------------------------------------------------------------------------- - -// WARNING: still in alpha stage - -class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase -{ - DECLARE_CLASS(wxDatagramSocket) - -public: - wxDatagramSocket(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); - - wxDatagramSocket& RecvFrom( wxSockAddress& addr, - void* buf, - wxUint32 nBytes ); - wxDatagramSocket& SendTo( const wxSockAddress& addr, - const void* buf, - wxUint32 nBytes ); - -/* TODO: - bool Connect(wxSockAddress& addr); -*/ - DECLARE_NO_COPY_CLASS(wxDatagramSocket) -}; - - -// -------------------------------------------------------------------------- -// wxSocketEvent -// -------------------------------------------------------------------------- - -class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent -{ -public: - wxSocketEvent(int id = 0) - : wxEvent(id, wxEVT_SOCKET) - { - } - - wxSocketNotify GetSocketEvent() const { return m_event; } - wxSocketBase *GetSocket() const { return (wxSocketBase *) GetEventObject(); } - void *GetClientData() const { return m_clientData; } - - virtual wxEvent *Clone() const { return new wxSocketEvent(*this); } - -public: - wxSocketNotify m_event; - void *m_clientData; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent) -}; - - -typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); - -#define wxSocketEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSocketEventFunction, &func) - -#define EVT_SOCKET(id, func) \ - wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func)) - -#endif // wxUSE_SOCKETS - -#endif // _WX_SOCKET_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: socket.h +// Purpose: Socket handling classes +// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia +// Modified by: +// Created: April 1997 +// RCS-ID: $Id: socket.h 45498 2007-04-16 13:03:05Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOCKET_H_ +#define _WX_SOCKET_H_ + +#include "wx/defs.h" + +#if wxUSE_SOCKETS + +// --------------------------------------------------------------------------- +// wxSocket headers +// --------------------------------------------------------------------------- + +#include "wx/event.h" +#include "wx/sckaddr.h" +#include "wx/gsocket.h" +#include "wx/list.h" + +// ------------------------------------------------------------------------ +// Types and constants +// ------------------------------------------------------------------------ + +enum wxSocketNotify +{ + wxSOCKET_INPUT = GSOCK_INPUT, + wxSOCKET_OUTPUT = GSOCK_OUTPUT, + wxSOCKET_CONNECTION = GSOCK_CONNECTION, + wxSOCKET_LOST = GSOCK_LOST +}; + +enum +{ + wxSOCKET_INPUT_FLAG = GSOCK_INPUT_FLAG, + wxSOCKET_OUTPUT_FLAG = GSOCK_OUTPUT_FLAG, + wxSOCKET_CONNECTION_FLAG = GSOCK_CONNECTION_FLAG, + wxSOCKET_LOST_FLAG = GSOCK_LOST_FLAG +}; + +typedef GSocketEventFlags wxSocketEventFlags; + +enum wxSocketError +{ + // from GSocket + wxSOCKET_NOERROR = GSOCK_NOERROR, + wxSOCKET_INVOP = GSOCK_INVOP, + wxSOCKET_IOERR = GSOCK_IOERR, + wxSOCKET_INVADDR = GSOCK_INVADDR, + wxSOCKET_INVSOCK = GSOCK_INVSOCK, + wxSOCKET_NOHOST = GSOCK_NOHOST, + wxSOCKET_INVPORT = GSOCK_INVPORT, + wxSOCKET_WOULDBLOCK = GSOCK_WOULDBLOCK, + wxSOCKET_TIMEDOUT = GSOCK_TIMEDOUT, + wxSOCKET_MEMERR = GSOCK_MEMERR, + + // wxSocket-specific (not yet implemented) + wxSOCKET_DUMMY +}; + +enum +{ + wxSOCKET_NONE = 0, + wxSOCKET_NOWAIT = 1, + wxSOCKET_WAITALL = 2, + wxSOCKET_BLOCK = 4, + wxSOCKET_REUSEADDR = 8 +}; + +enum wxSocketType +{ + wxSOCKET_UNINIT, + wxSOCKET_CLIENT, + wxSOCKET_SERVER, + wxSOCKET_BASE, + wxSOCKET_DATAGRAM +}; + +typedef int wxSocketFlags; + + + +// -------------------------------------------------------------------------- +// wxSocketBase +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketBase : public wxObject +{ + DECLARE_CLASS(wxSocketBase) + +public: + + // Public interface + // ---------------- + + // ctors and dtors + wxSocketBase(); + wxSocketBase(wxSocketFlags flags, wxSocketType type); + virtual ~wxSocketBase(); + void Init(); + bool Destroy(); + + // state + inline bool Ok() const { return IsOk(); } + inline bool IsOk() const { return (m_socket != NULL); } + inline bool Error() const { return m_error; } + inline bool IsConnected() const { return m_connected; } + inline bool IsData() { return WaitForRead(0, 0); } + inline bool IsDisconnected() const { return !IsConnected(); } + inline wxUint32 LastCount() const { return m_lcount; } + inline wxSocketError LastError() const { return (wxSocketError)m_socket->GetError(); } + void SaveState(); + void RestoreState(); + + // addresses + virtual bool GetLocal(wxSockAddress& addr_man) const; + virtual bool GetPeer(wxSockAddress& addr_man) const; + virtual bool SetLocal(wxIPV4address& local); + + // base IO + virtual bool Close(); + wxSocketBase& Discard(); + wxSocketBase& Peek(void* buffer, wxUint32 nbytes); + wxSocketBase& Read(void* buffer, wxUint32 nbytes); + wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes); + wxSocketBase& Unread(const void *buffer, wxUint32 nbytes); + wxSocketBase& Write(const void *buffer, wxUint32 nbytes); + wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes); + + void InterruptWait() { m_interrupt = true; } + bool Wait(long seconds = -1, long milliseconds = 0); + bool WaitForRead(long seconds = -1, long milliseconds = 0); + bool WaitForWrite(long seconds = -1, long milliseconds = 0); + bool WaitForLost(long seconds = -1, long milliseconds = 0); + + inline wxSocketFlags GetFlags() const { return m_flags; } + void SetFlags(wxSocketFlags flags); + void SetTimeout(long seconds); + + bool GetOption(int level, int optname, void *optval, int *optlen); + bool SetOption(int level, int optname, const void *optval, int optlen); + inline wxUint32 GetLastIOSize() const { return m_lcount; } + + // event handling + void *GetClientData() const { return m_clientData; } + void SetClientData(void *data) { m_clientData = data; } + void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY); + void SetNotify(wxSocketEventFlags flags); + void Notify(bool notify); + + // initialize/shutdown the sockets (usually called automatically) + static bool IsInitialized(); + static bool Initialize(); + static void Shutdown(); + + + // Implementation from now on + // -------------------------- + + // do not use, should be private (called from GSocket) + void OnRequest(wxSocketNotify notify); + + // do not use, not documented nor supported + inline bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); } + inline wxSocketType GetType() const { return m_type; } + +private: + friend class wxSocketClient; + friend class wxSocketServer; + friend class wxDatagramSocket; + + // low level IO + wxUint32 _Read(void* buffer, wxUint32 nbytes); + wxUint32 _Write(const void *buffer, wxUint32 nbytes); + bool _Wait(long seconds, long milliseconds, wxSocketEventFlags flags); + + // pushback buffer + void Pushback(const void *buffer, wxUint32 size); + wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek); + +private: + // socket + GSocket *m_socket; // GSocket + wxSocketType m_type; // wxSocket type + + // state + wxSocketFlags m_flags; // wxSocket flags + bool m_connected; // connected? + bool m_establishing; // establishing connection? + bool m_reading; // busy reading? + bool m_writing; // busy writing? + bool m_error; // did last IO call fail? + wxSocketError m_lasterror; // last error (not cleared on success) + wxUint32 m_lcount; // last IO transaction size + unsigned long m_timeout; // IO timeout value + wxList m_states; // stack of states + bool m_interrupt; // interrupt ongoing wait operations? + bool m_beingDeleted; // marked for delayed deletion? + wxIPV4address m_localAddress; // bind to local address? + + // pushback buffer + void *m_unread; // pushback buffer + wxUint32 m_unrd_size; // pushback buffer size + wxUint32 m_unrd_cur; // pushback pointer (index into buffer) + + // events + int m_id; // socket id + wxEvtHandler *m_handler; // event handler + void *m_clientData; // client data for events + bool m_notify; // notify events to users? + wxSocketEventFlags m_eventmask; // which events to notify? + + // the initialization count, GSocket is initialized if > 0 + static size_t m_countInit; + + DECLARE_NO_COPY_CLASS(wxSocketBase) +}; + + +// -------------------------------------------------------------------------- +// wxSocketServer +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase +{ + DECLARE_CLASS(wxSocketServer) + +public: + wxSocketServer(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); + + wxSocketBase* Accept(bool wait = true); + bool AcceptWith(wxSocketBase& socket, bool wait = true); + + bool WaitForAccept(long seconds = -1, long milliseconds = 0); + + DECLARE_NO_COPY_CLASS(wxSocketServer) +}; + + +// -------------------------------------------------------------------------- +// wxSocketClient +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase +{ + DECLARE_CLASS(wxSocketClient) + +public: + wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); + virtual ~wxSocketClient(); + + virtual bool Connect(wxSockAddress& addr, bool wait = true); + bool Connect(wxSockAddress& addr, wxSockAddress& local, bool wait = true); + + bool WaitOnConnect(long seconds = -1, long milliseconds = 0); + +private: + virtual bool DoConnect(wxSockAddress& addr, wxSockAddress* local, bool wait = true); + + DECLARE_NO_COPY_CLASS(wxSocketClient) +}; + + +// -------------------------------------------------------------------------- +// wxDatagramSocket +// -------------------------------------------------------------------------- + +// WARNING: still in alpha stage + +class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase +{ + DECLARE_CLASS(wxDatagramSocket) + +public: + wxDatagramSocket(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); + + wxDatagramSocket& RecvFrom( wxSockAddress& addr, + void* buf, + wxUint32 nBytes ); + wxDatagramSocket& SendTo( const wxSockAddress& addr, + const void* buf, + wxUint32 nBytes ); + +/* TODO: + bool Connect(wxSockAddress& addr); +*/ + DECLARE_NO_COPY_CLASS(wxDatagramSocket) +}; + + +// -------------------------------------------------------------------------- +// wxSocketEvent +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent +{ +public: + wxSocketEvent(int id = 0) + : wxEvent(id, wxEVT_SOCKET) + { + } + + wxSocketNotify GetSocketEvent() const { return m_event; } + wxSocketBase *GetSocket() const { return (wxSocketBase *) GetEventObject(); } + void *GetClientData() const { return m_clientData; } + + virtual wxEvent *Clone() const { return new wxSocketEvent(*this); } + +public: + wxSocketNotify m_event; + void *m_clientData; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent) +}; + + +typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); + +#define wxSocketEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSocketEventFunction, &func) + +#define EVT_SOCKET(id, func) \ + wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func)) + +#endif // wxUSE_SOCKETS + +#endif // _WX_SOCKET_H_ + diff --git a/Externals/wxWidgets/include/wx/sound.h b/Externals/wxWidgets/include/wx/sound.h index 4204b633c6..765f818a7a 100644 --- a/Externals/wxWidgets/include/wx/sound.h +++ b/Externals/wxWidgets/include/wx/sound.h @@ -1,98 +1,98 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/sound.h -// Purpose: wxSoundBase class -// Author: Vaclav Slavik -// Modified by: -// Created: 2004/02/01 -// RCS-ID: $Id: sound.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2004, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SOUND_H_BASE_ -#define _WX_SOUND_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_SOUND - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// wxSoundBase: common wxSound code and interface -// ---------------------------------------------------------------------------- - -// Flags for wxSound::Play - -// NB: We can't use enum because there would be ambiguity between the -// two Play() prototypes when called without explicit parameters -// if WXWIN_COMPATIBILITY_2_4. -// We can't use enum with some compilers either, because they -// keep reporting nonexistent ambiguities between -// Play(unsigned) and static Play(const wxString&, unsigned). -#define wxSOUND_SYNC ((unsigned)0) -#define wxSOUND_ASYNC ((unsigned)1) -#define wxSOUND_LOOP ((unsigned)2) - -// Base class for wxSound implementations -class WXDLLIMPEXP_ADV wxSoundBase : public wxObject -{ -public: - // Play the sound: - bool Play(unsigned flags = wxSOUND_ASYNC) const - { - wxASSERT_MSG( (flags & wxSOUND_LOOP) == 0 || - (flags & wxSOUND_ASYNC) != 0, - _T("sound can only be looped asynchronously") ); - return DoPlay(flags); - } -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( bool Play(bool async, bool looped = false) const ); -#endif - - // Plays sound from filename: - static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC); - -protected: - virtual bool DoPlay(unsigned flags) const = 0; -}; - -// ---------------------------------------------------------------------------- -// wxSound class implementation -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/sound.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/sound.h" -#elif defined(__WXMAC__) - #include "wx/mac/sound.h" -#elif defined(__WXPM__) - #include "wx/os2/sound.h" -#elif defined(__UNIX__) - #include "wx/unix/sound.h" -#endif - -// ---------------------------------------------------------------------------- -// wxSoundBase methods -// ---------------------------------------------------------------------------- - -inline bool wxSoundBase::Play(const wxString& filename, unsigned flags) -{ - wxSound snd(filename); - return snd.IsOk() ? snd.Play(flags) : false; -} - -#if WXWIN_COMPATIBILITY_2_4 -inline bool wxSoundBase::Play(bool async, bool looped) const -{ - unsigned flags = 0; - if (async) flags |= wxSOUND_ASYNC; - if (looped) flags |= wxSOUND_LOOP | wxSOUND_ASYNC; - return DoPlay(flags); -} -#endif - -#endif // wxUSE_SOUND - -#endif // _WX_SOUND_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sound.h +// Purpose: wxSoundBase class +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/02/01 +// RCS-ID: $Id: sound.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2004, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_BASE_ +#define _WX_SOUND_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SOUND + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxSoundBase: common wxSound code and interface +// ---------------------------------------------------------------------------- + +// Flags for wxSound::Play + +// NB: We can't use enum because there would be ambiguity between the +// two Play() prototypes when called without explicit parameters +// if WXWIN_COMPATIBILITY_2_4. +// We can't use enum with some compilers either, because they +// keep reporting nonexistent ambiguities between +// Play(unsigned) and static Play(const wxString&, unsigned). +#define wxSOUND_SYNC ((unsigned)0) +#define wxSOUND_ASYNC ((unsigned)1) +#define wxSOUND_LOOP ((unsigned)2) + +// Base class for wxSound implementations +class WXDLLIMPEXP_ADV wxSoundBase : public wxObject +{ +public: + // Play the sound: + bool Play(unsigned flags = wxSOUND_ASYNC) const + { + wxASSERT_MSG( (flags & wxSOUND_LOOP) == 0 || + (flags & wxSOUND_ASYNC) != 0, + _T("sound can only be looped asynchronously") ); + return DoPlay(flags); + } +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool Play(bool async, bool looped = false) const ); +#endif + + // Plays sound from filename: + static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC); + +protected: + virtual bool DoPlay(unsigned flags) const = 0; +}; + +// ---------------------------------------------------------------------------- +// wxSound class implementation +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/sound.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/sound.h" +#elif defined(__WXMAC__) + #include "wx/mac/sound.h" +#elif defined(__WXPM__) + #include "wx/os2/sound.h" +#elif defined(__UNIX__) + #include "wx/unix/sound.h" +#endif + +// ---------------------------------------------------------------------------- +// wxSoundBase methods +// ---------------------------------------------------------------------------- + +inline bool wxSoundBase::Play(const wxString& filename, unsigned flags) +{ + wxSound snd(filename); + return snd.IsOk() ? snd.Play(flags) : false; +} + +#if WXWIN_COMPATIBILITY_2_4 +inline bool wxSoundBase::Play(bool async, bool looped) const +{ + unsigned flags = 0; + if (async) flags |= wxSOUND_ASYNC; + if (looped) flags |= wxSOUND_LOOP | wxSOUND_ASYNC; + return DoPlay(flags); +} +#endif + +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/spinbutt.h b/Externals/wxWidgets/include/wx/spinbutt.h index ad4753c359..72e250bbfd 100644 --- a/Externals/wxWidgets/include/wx/spinbutt.h +++ b/Externals/wxWidgets/include/wx/spinbutt.h @@ -1,129 +1,129 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/spinbutt.h -// Purpose: wxSpinButtonBase class -// Author: Julian Smart, Vadim Zeitlin -// Modified by: -// Created: 23.07.99 -// RCS-ID: $Id: spinbutt.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPINBUTT_H_BASE_ -#define _WX_SPINBUTT_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_SPINBTN - -#include "wx/control.h" -#include "wx/event.h" - -#define wxSPIN_BUTTON_NAME _T("wxSpinButton") - -// ---------------------------------------------------------------------------- -// The wxSpinButton is like a small scrollbar than is often placed next -// to a text control. -// -// Styles: -// wxSP_HORIZONTAL: horizontal spin button -// wxSP_VERTICAL: vertical spin button (the default) -// wxSP_ARROW_KEYS: arrow keys increment/decrement value -// wxSP_WRAP: value wraps at either end -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinButtonBase : public wxControl -{ -public: - // ctor initializes the range with the default (0..100) values - wxSpinButtonBase() { m_min = 0; m_max = 100; } - - // accessors - virtual int GetValue() const = 0; - virtual int GetMin() const { return m_min; } - virtual int GetMax() const { return m_max; } - - // operations - virtual void SetValue(int val) = 0; - virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; } - virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; } - virtual void SetRange(int minVal, int maxVal) - { - m_min = minVal; - m_max = maxVal; - } - - // is this spin button vertically oriented? - bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; } - -protected: - // the range value - int m_min; - int m_max; - - DECLARE_NO_COPY_CLASS(wxSpinButtonBase) -}; - -// ---------------------------------------------------------------------------- -// include the declaration of the real class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/spinbutt.h" -#elif defined(__WXMSW__) - #include "wx/msw/spinbutt.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/spinbutt.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/spinbutt.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/spinbutt.h" -#elif defined(__WXMAC__) - #include "wx/mac/spinbutt.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/spinbutt.h" -#elif defined(__WXPM__) - #include "wx/os2/spinbutt.h" -#endif - -// ---------------------------------------------------------------------------- -// the wxSpinButton event -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent -{ -public: - wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) - : wxNotifyEvent(commandType, winid) - { - } - - // get the current value of the control - int GetPosition() const { return m_commandInt; } - void SetPosition(int pos) { m_commandInt = pos; } - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinEvent) -}; - -typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); - -#define wxSpinEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSpinEventFunction, &func) - -// macros for handling spin events -#define EVT_SPIN_UP(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxSpinEventHandler(func)) -#define EVT_SPIN_DOWN(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxSpinEventHandler(func)) -#define EVT_SPIN(winid, func) \ - wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxSpinEventHandler(func)) - -#endif // wxUSE_SPINBTN - -#endif - // _WX_SPINBUTT_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/spinbutt.h +// Purpose: wxSpinButtonBase class +// Author: Julian Smart, Vadim Zeitlin +// Modified by: +// Created: 23.07.99 +// RCS-ID: $Id: spinbutt.h 37066 2006-01-23 03:27:34Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_BASE_ +#define _WX_SPINBUTT_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_SPINBTN + +#include "wx/control.h" +#include "wx/event.h" + +#define wxSPIN_BUTTON_NAME _T("wxSpinButton") + +// ---------------------------------------------------------------------------- +// The wxSpinButton is like a small scrollbar than is often placed next +// to a text control. +// +// Styles: +// wxSP_HORIZONTAL: horizontal spin button +// wxSP_VERTICAL: vertical spin button (the default) +// wxSP_ARROW_KEYS: arrow keys increment/decrement value +// wxSP_WRAP: value wraps at either end +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSpinButtonBase : public wxControl +{ +public: + // ctor initializes the range with the default (0..100) values + wxSpinButtonBase() { m_min = 0; m_max = 100; } + + // accessors + virtual int GetValue() const = 0; + virtual int GetMin() const { return m_min; } + virtual int GetMax() const { return m_max; } + + // operations + virtual void SetValue(int val) = 0; + virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; } + virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; } + virtual void SetRange(int minVal, int maxVal) + { + m_min = minVal; + m_max = maxVal; + } + + // is this spin button vertically oriented? + bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; } + +protected: + // the range value + int m_min; + int m_max; + + DECLARE_NO_COPY_CLASS(wxSpinButtonBase) +}; + +// ---------------------------------------------------------------------------- +// include the declaration of the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/spinbutt.h" +#elif defined(__WXMSW__) + #include "wx/msw/spinbutt.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/spinbutt.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/spinbutt.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/spinbutt.h" +#elif defined(__WXMAC__) + #include "wx/mac/spinbutt.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/spinbutt.h" +#elif defined(__WXPM__) + #include "wx/os2/spinbutt.h" +#endif + +// ---------------------------------------------------------------------------- +// the wxSpinButton event +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent +{ +public: + wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid) + { + } + + // get the current value of the control + int GetPosition() const { return m_commandInt; } + void SetPosition(int pos) { m_commandInt = pos; } + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinEvent) +}; + +typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); + +#define wxSpinEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSpinEventFunction, &func) + +// macros for handling spin events +#define EVT_SPIN_UP(winid, func) \ + wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxSpinEventHandler(func)) +#define EVT_SPIN_DOWN(winid, func) \ + wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxSpinEventHandler(func)) +#define EVT_SPIN(winid, func) \ + wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxSpinEventHandler(func)) + +#endif // wxUSE_SPINBTN + +#endif + // _WX_SPINBUTT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/spinctrl.h b/Externals/wxWidgets/include/wx/spinctrl.h index e27c1892df..24e302aa77 100644 --- a/Externals/wxWidgets/include/wx/spinctrl.h +++ b/Externals/wxWidgets/include/wx/spinctrl.h @@ -1,83 +1,83 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: spinctrl.h -// Purpose: wxSpinCtrlBase class -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.07.99 -// RCS-ID: $Id: spinctrl.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPINCTRL_H_ -#define _WX_SPINCTRL_H_ - -#include "wx/defs.h" - -#if wxUSE_SPINCTRL - -#include "wx/spinbutt.h" // should make wxSpinEvent visible to the app - -// ---------------------------------------------------------------------------- -// a spin ctrl is a text control with a spin button which is usually used to -// prompt the user for a numeric input -// ---------------------------------------------------------------------------- - -/* there is no generic base class for this control because it's imlpemented - very differently under MSW and other platforms - -class WXDLLEXPORT wxSpinCtrlBase : public wxControl -{ -public: - wxSpinCtrlBase() { Init(); } - - // accessors - virtual int GetValue() const = 0; - virtual int GetMin() const { return m_min; } - virtual int GetMax() const { return m_max; } - - // operations - virtual void SetValue(const wxString& value) = 0; - virtual void SetValue(int val) = 0; - virtual void SetRange(int minVal, int maxVal) = 0; - - // as the wxTextCtrl method - virtual void SetSelection(long from, long to) = 0; - -protected: - // initialize m_min/max with the default values - void Init() { m_min = 0; m_max = 100; } - - int m_min; - int m_max; -}; -*/ - -// ---------------------------------------------------------------------------- -// include the platform-dependent class implementation -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/spinctlg.h" -#elif defined(__WXMSW__) - #include "wx/msw/spinctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/spinctrl.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/spinctrl.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/spinctrl.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/spinctlg.h" -#elif defined(__WXMAC__) - #include "wx/mac/spinctrl.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/spinctlg.h" -#endif // platform - -#define EVT_SPINCTRL(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SPINCTRL_UPDATED, id, wxSpinEventHandler(fn)) - -#endif // wxUSE_SPINCTRL - -#endif // _WX_SPINCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: spinctrl.h +// Purpose: wxSpinCtrlBase class +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.07.99 +// RCS-ID: $Id: spinctrl.h 37066 2006-01-23 03:27:34Z MR $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINCTRL_H_ +#define _WX_SPINCTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_SPINCTRL + +#include "wx/spinbutt.h" // should make wxSpinEvent visible to the app + +// ---------------------------------------------------------------------------- +// a spin ctrl is a text control with a spin button which is usually used to +// prompt the user for a numeric input +// ---------------------------------------------------------------------------- + +/* there is no generic base class for this control because it's imlpemented + very differently under MSW and other platforms + +class WXDLLEXPORT wxSpinCtrlBase : public wxControl +{ +public: + wxSpinCtrlBase() { Init(); } + + // accessors + virtual int GetValue() const = 0; + virtual int GetMin() const { return m_min; } + virtual int GetMax() const { return m_max; } + + // operations + virtual void SetValue(const wxString& value) = 0; + virtual void SetValue(int val) = 0; + virtual void SetRange(int minVal, int maxVal) = 0; + + // as the wxTextCtrl method + virtual void SetSelection(long from, long to) = 0; + +protected: + // initialize m_min/max with the default values + void Init() { m_min = 0; m_max = 100; } + + int m_min; + int m_max; +}; +*/ + +// ---------------------------------------------------------------------------- +// include the platform-dependent class implementation +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/generic/spinctlg.h" +#elif defined(__WXMSW__) + #include "wx/msw/spinctrl.h" +#elif defined(__WXPM__) + #include "wx/os2/spinctrl.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/spinctrl.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/spinctrl.h" +#elif defined(__WXMOTIF__) + #include "wx/generic/spinctlg.h" +#elif defined(__WXMAC__) + #include "wx/mac/spinctrl.h" +#elif defined(__WXCOCOA__) + #include "wx/generic/spinctlg.h" +#endif // platform + +#define EVT_SPINCTRL(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_SPINCTRL_UPDATED, id, wxSpinEventHandler(fn)) + +#endif // wxUSE_SPINCTRL + +#endif // _WX_SPINCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/splash.h b/Externals/wxWidgets/include/wx/splash.h index d68694f957..acd87fc136 100644 --- a/Externals/wxWidgets/include/wx/splash.h +++ b/Externals/wxWidgets/include/wx/splash.h @@ -1,18 +1,18 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/splash.h -// Purpose: Base header for wxSplashScreen -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: splash.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPLASH_H_BASE_ -#define _WX_SPLASH_H_BASE_ - -#include "wx/generic/splash.h" - -#endif - // _WX_SPLASH_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/splash.h +// Purpose: Base header for wxSplashScreen +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: splash.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPLASH_H_BASE_ +#define _WX_SPLASH_H_BASE_ + +#include "wx/generic/splash.h" + +#endif + // _WX_SPLASH_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/splitter.h b/Externals/wxWidgets/include/wx/splitter.h index fb96799f1b..04405264b0 100644 --- a/Externals/wxWidgets/include/wx/splitter.h +++ b/Externals/wxWidgets/include/wx/splitter.h @@ -1,47 +1,47 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/splitter.h -// Purpose: Base header for wxSplitterWindow -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: splitter.h 38717 2006-04-14 17:01:16Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SPLITTER_H_BASE_ -#define _WX_SPLITTER_H_BASE_ - -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// wxSplitterWindow flags -// ---------------------------------------------------------------------------- - -#define wxSP_NOBORDER 0x0000 -#define wxSP_NOSASH 0x0010 -#define wxSP_PERMIT_UNSPLIT 0x0040 -#define wxSP_LIVE_UPDATE 0x0080 -#define wxSP_3DSASH 0x0100 -#define wxSP_3DBORDER 0x0200 -#define wxSP_NO_XP_THEME 0x0400 -#define wxSP_BORDER wxSP_3DBORDER -#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete styles, don't do anything - #define wxSP_SASH_AQUA 0 - #define wxSP_FULLSASH 0 -#endif // WXWIN_COMPATIBILITY_2_6 - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 850) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 851) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 852) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT, 853) -END_DECLARE_EVENT_TYPES() - -#include "wx/generic/splitter.h" - -#endif - // _WX_SPLITTER_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/splitter.h +// Purpose: Base header for wxSplitterWindow +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: splitter.h 38717 2006-04-14 17:01:16Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPLITTER_H_BASE_ +#define _WX_SPLITTER_H_BASE_ + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// wxSplitterWindow flags +// ---------------------------------------------------------------------------- + +#define wxSP_NOBORDER 0x0000 +#define wxSP_NOSASH 0x0010 +#define wxSP_PERMIT_UNSPLIT 0x0040 +#define wxSP_LIVE_UPDATE 0x0080 +#define wxSP_3DSASH 0x0100 +#define wxSP_3DBORDER 0x0200 +#define wxSP_NO_XP_THEME 0x0400 +#define wxSP_BORDER wxSP_3DBORDER +#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) + +#if WXWIN_COMPATIBILITY_2_6 + // obsolete styles, don't do anything + #define wxSP_SASH_AQUA 0 + #define wxSP_FULLSASH 0 +#endif // WXWIN_COMPATIBILITY_2_6 + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 850) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 851) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 852) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT, 853) +END_DECLARE_EVENT_TYPES() + +#include "wx/generic/splitter.h" + +#endif + // _WX_SPLITTER_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/srchctrl.h b/Externals/wxWidgets/include/wx/srchctrl.h index af831bd0b7..5a56fca912 100644 --- a/Externals/wxWidgets/include/wx/srchctrl.h +++ b/Externals/wxWidgets/include/wx/srchctrl.h @@ -1,91 +1,91 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: srchctrl.h -// Purpose: wxSearchCtrlBase class -// Author: Vince Harron -// Created: 2006-02-18 -// RCS-ID: $Id: srchctrl.h 45828 2007-05-05 14:51:51Z VZ $ -// Copyright: (c) Vince Harron -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SEARCHCTRL_H_BASE_ -#define _WX_SEARCHCTRL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_SEARCHCTRL - -#include "wx/textctrl.h" - -#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \ - && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) - // search control was introduced in Mac OS X 10.3 Panther - #define wxUSE_NATIVE_SEARCH_CONTROL 1 - - #define wxSearchCtrlBaseBaseClass wxTextCtrl -#else - // no native version, use the generic one - #define wxUSE_NATIVE_SEARCH_CONTROL 0 - - #define wxSearchCtrlBaseBaseClass wxTextCtrlBase -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[]; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, 1119) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, 1120) -END_DECLARE_EVENT_TYPES() - -// ---------------------------------------------------------------------------- -// a search ctrl is a text control with a search button and a cancel button -// it is based on the MacOSX 10.3 control HISearchFieldCreate -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass -{ -public: - wxSearchCtrlBase() { } - virtual ~wxSearchCtrlBase() { } - - // search control -#if wxUSE_MENUS - virtual void SetMenu(wxMenu *menu) = 0; - virtual wxMenu *GetMenu() = 0; -#endif // wxUSE_MENUS - - // get/set options - virtual void ShowSearchButton( bool show ) = 0; - virtual bool IsSearchButtonVisible() const = 0; - - virtual void ShowCancelButton( bool show ) = 0; - virtual bool IsCancelButtonVisible() const = 0; -}; - - -// include the platform-dependent class implementation -#if wxUSE_NATIVE_SEARCH_CONTROL - #if defined(__WXMAC__) - #include "wx/mac/srchctrl.h" - #endif -#else - #include "wx/generic/srchctlg.h" -#endif - -// ---------------------------------------------------------------------------- -// macros for handling search events -// ---------------------------------------------------------------------------- - -#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn)) - -#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn)) - -#endif // wxUSE_SEARCHCTRL - -#endif // _WX_SEARCHCTRL_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: srchctrl.h +// Purpose: wxSearchCtrlBase class +// Author: Vince Harron +// Created: 2006-02-18 +// RCS-ID: $Id: srchctrl.h 45828 2007-05-05 14:51:51Z VZ $ +// Copyright: (c) Vince Harron +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SEARCHCTRL_H_BASE_ +#define _WX_SEARCHCTRL_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SEARCHCTRL + +#include "wx/textctrl.h" + +#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \ + && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) + // search control was introduced in Mac OS X 10.3 Panther + #define wxUSE_NATIVE_SEARCH_CONTROL 1 + + #define wxSearchCtrlBaseBaseClass wxTextCtrl +#else + // no native version, use the generic one + #define wxUSE_NATIVE_SEARCH_CONTROL 0 + + #define wxSearchCtrlBaseBaseClass wxTextCtrlBase +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[]; + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, 1119) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, 1120) +END_DECLARE_EVENT_TYPES() + +// ---------------------------------------------------------------------------- +// a search ctrl is a text control with a search button and a cancel button +// it is based on the MacOSX 10.3 control HISearchFieldCreate +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass +{ +public: + wxSearchCtrlBase() { } + virtual ~wxSearchCtrlBase() { } + + // search control +#if wxUSE_MENUS + virtual void SetMenu(wxMenu *menu) = 0; + virtual wxMenu *GetMenu() = 0; +#endif // wxUSE_MENUS + + // get/set options + virtual void ShowSearchButton( bool show ) = 0; + virtual bool IsSearchButtonVisible() const = 0; + + virtual void ShowCancelButton( bool show ) = 0; + virtual bool IsCancelButtonVisible() const = 0; +}; + + +// include the platform-dependent class implementation +#if wxUSE_NATIVE_SEARCH_CONTROL + #if defined(__WXMAC__) + #include "wx/mac/srchctrl.h" + #endif +#else + #include "wx/generic/srchctlg.h" +#endif + +// ---------------------------------------------------------------------------- +// macros for handling search events +// ---------------------------------------------------------------------------- + +#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn)) + +#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn)) + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_SEARCHCTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/sstream.h b/Externals/wxWidgets/include/wx/sstream.h index febf2cf0de..7724ab44ee 100644 --- a/Externals/wxWidgets/include/wx/sstream.h +++ b/Externals/wxWidgets/include/wx/sstream.h @@ -1,103 +1,103 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/sstream.h -// Purpose: string-based streams -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-09-19 -// RCS-ID: $Id: sstream.h 45732 2007-05-01 13:52:19Z VZ $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SSTREAM_H_ -#define _WX_SSTREAM_H_ - -#include "wx/stream.h" - -#if wxUSE_STREAMS - -// ---------------------------------------------------------------------------- -// wxStringInputStream is a stream reading from the given (fixed size) string -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringInputStream : public wxInputStream -{ -public: - // ctor associates the stream with the given string which makes a copy of - // it - wxStringInputStream(const wxString& s); - virtual ~wxStringInputStream(); - - virtual wxFileOffset GetLength() const; - -protected: - virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - virtual size_t OnSysRead(void *buffer, size_t size); - -private: - // the string that was passed in the ctor - wxString m_str; - - // the buffer we're reading from - char* m_buf; - - // length of the buffer we're reading from - size_t m_len; - - // position in the stream in bytes, *not* in chars - size_t m_pos; - - DECLARE_NO_COPY_CLASS(wxStringInputStream) -}; - -// ---------------------------------------------------------------------------- -// wxStringOutputStream writes data to the given string, expanding it as needed -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream -{ -public: - // The stream will write data either to the provided string or to an - // internal string which can be retrieved using GetString() - wxStringOutputStream(wxString *pString = NULL) - { - m_str = pString ? pString : &m_strInternal; - m_pos = m_str->length() / sizeof(wxChar); - } - -#if wxABI_VERSION >= 20804 && wxUSE_UNICODE - virtual ~wxStringOutputStream(); -#endif // wx 2.8.4+ - - // get the string containing current output - const wxString& GetString() const { return *m_str; } - -protected: - virtual wxFileOffset OnSysTell() const; - virtual size_t OnSysWrite(const void *buffer, size_t size); - -private: - // internal string, not used if caller provided his own string - wxString m_strInternal; - - // pointer given by the caller or just pointer to m_strInternal - wxString *m_str; - - // position in the stream in bytes, *not* in chars - size_t m_pos; - -#if wxUSE_WCHAR_T - // string encoding converter (UTF8 is the standard) - wxMBConvUTF8 m_conv; -#else - wxMBConv m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxStringOutputStream) -}; - -#endif // wxUSE_STREAMS - -#endif // _WX_SSTREAM_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/sstream.h +// Purpose: string-based streams +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-09-19 +// RCS-ID: $Id: sstream.h 45732 2007-05-01 13:52:19Z VZ $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SSTREAM_H_ +#define _WX_SSTREAM_H_ + +#include "wx/stream.h" + +#if wxUSE_STREAMS + +// ---------------------------------------------------------------------------- +// wxStringInputStream is a stream reading from the given (fixed size) string +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringInputStream : public wxInputStream +{ +public: + // ctor associates the stream with the given string which makes a copy of + // it + wxStringInputStream(const wxString& s); + virtual ~wxStringInputStream(); + + virtual wxFileOffset GetLength() const; + +protected: + virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode); + virtual wxFileOffset OnSysTell() const; + virtual size_t OnSysRead(void *buffer, size_t size); + +private: + // the string that was passed in the ctor + wxString m_str; + + // the buffer we're reading from + char* m_buf; + + // length of the buffer we're reading from + size_t m_len; + + // position in the stream in bytes, *not* in chars + size_t m_pos; + + DECLARE_NO_COPY_CLASS(wxStringInputStream) +}; + +// ---------------------------------------------------------------------------- +// wxStringOutputStream writes data to the given string, expanding it as needed +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream +{ +public: + // The stream will write data either to the provided string or to an + // internal string which can be retrieved using GetString() + wxStringOutputStream(wxString *pString = NULL) + { + m_str = pString ? pString : &m_strInternal; + m_pos = m_str->length() / sizeof(wxChar); + } + +#if wxABI_VERSION >= 20804 && wxUSE_UNICODE + virtual ~wxStringOutputStream(); +#endif // wx 2.8.4+ + + // get the string containing current output + const wxString& GetString() const { return *m_str; } + +protected: + virtual wxFileOffset OnSysTell() const; + virtual size_t OnSysWrite(const void *buffer, size_t size); + +private: + // internal string, not used if caller provided his own string + wxString m_strInternal; + + // pointer given by the caller or just pointer to m_strInternal + wxString *m_str; + + // position in the stream in bytes, *not* in chars + size_t m_pos; + +#if wxUSE_WCHAR_T + // string encoding converter (UTF8 is the standard) + wxMBConvUTF8 m_conv; +#else + wxMBConv m_conv; +#endif + + DECLARE_NO_COPY_CLASS(wxStringOutputStream) +}; + +#endif // wxUSE_STREAMS + +#endif // _WX_SSTREAM_H_ + diff --git a/Externals/wxWidgets/include/wx/stack.h b/Externals/wxWidgets/include/wx/stack.h index e58c0675d2..2500a114c6 100644 --- a/Externals/wxWidgets/include/wx/stack.h +++ b/Externals/wxWidgets/include/wx/stack.h @@ -1,44 +1,44 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/stack.h -// Purpose: STL stack clone -// Author: Lindsay Mathieson -// Modified by: -// Created: 30.07.2001 -// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STACK_H_ -#define _WX_STACK_H_ - -#include "wx/vector.h" - -#define WX_DECLARE_STACK(obj, cls)\ -class cls : public wxVectorBase\ -{\ - WX_DECLARE_VECTORBASE(obj, cls);\ -public:\ - void push(const obj& o)\ - {\ - bool rc = Alloc(size() + 1);\ - wxASSERT(rc);\ - Append(new obj(o));\ - };\ -\ - void pop()\ - {\ - RemoveAt(size() - 1);\ - };\ -\ - obj& top()\ - {\ - return *(obj *) GetItem(size() - 1);\ - };\ - const obj& top() const\ - {\ - return *(obj *) GetItem(size() - 1);\ - };\ -} - -#endif // _WX_STACK_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stack.h +// Purpose: STL stack clone +// Author: Lindsay Mathieson +// Modified by: +// Created: 30.07.2001 +// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STACK_H_ +#define _WX_STACK_H_ + +#include "wx/vector.h" + +#define WX_DECLARE_STACK(obj, cls)\ +class cls : public wxVectorBase\ +{\ + WX_DECLARE_VECTORBASE(obj, cls);\ +public:\ + void push(const obj& o)\ + {\ + bool rc = Alloc(size() + 1);\ + wxASSERT(rc);\ + Append(new obj(o));\ + };\ +\ + void pop()\ + {\ + RemoveAt(size() - 1);\ + };\ +\ + obj& top()\ + {\ + return *(obj *) GetItem(size() - 1);\ + };\ + const obj& top() const\ + {\ + return *(obj *) GetItem(size() - 1);\ + };\ +} + +#endif // _WX_STACK_H_ + diff --git a/Externals/wxWidgets/include/wx/stackwalk.h b/Externals/wxWidgets/include/wx/stackwalk.h index e051c71f1f..e0dceae7c6 100644 --- a/Externals/wxWidgets/include/wx/stackwalk.h +++ b/Externals/wxWidgets/include/wx/stackwalk.h @@ -1,156 +1,156 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/wx/stackwalk.h -// Purpose: wxStackWalker and related classes, common part -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-07 -// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STACKWALK_H_ -#define _WX_STACKWALK_H_ - -#include "wx/defs.h" - -#if wxUSE_STACKWALKER - -class WXDLLIMPEXP_BASE wxStackFrame; - -// ---------------------------------------------------------------------------- -// wxStackFrame: a single stack level -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackFrameBase -{ -private: - // put this inline function here so that it is defined before use - wxStackFrameBase *ConstCast() const - { return wx_const_cast(wxStackFrameBase *, this); } - -public: - wxStackFrameBase(size_t level, void *address = NULL) - { - m_level = level; - - m_line = - m_offset = 0; - - m_address = address; - } - - // get the level of this frame (deepest/innermost one is 0) - size_t GetLevel() const { return m_level; } - - // return the address of this frame - void *GetAddress() const { return m_address; } - - - // return the unmangled (if possible) name of the function containing this - // frame - wxString GetName() const { ConstCast()->OnGetName(); return m_name; } - - // return the instruction pointer offset from the start of the function - size_t GetOffset() const { ConstCast()->OnGetName(); return m_offset; } - - // get the module this function belongs to (not always available) - wxString GetModule() const { ConstCast()->OnGetName(); return m_module; } - - - // return true if we have the filename and line number for this frame - bool HasSourceLocation() const { return !GetFileName().empty(); } - - // return the name of the file containing this frame, empty if - // unavailable (typically because debug info is missing) - wxString GetFileName() const - { ConstCast()->OnGetLocation(); return m_filename; } - - // return the line number of this frame, 0 if unavailable - size_t GetLine() const { ConstCast()->OnGetLocation(); return m_line; } - - - // return the number of parameters of this function (may return 0 if we - // can't retrieve the parameters info even although the function does have - // parameters) - virtual size_t GetParamCount() const { return 0; } - - // get the name, type and value (in text form) of the given parameter - // - // any pointer may be NULL - // - // return true if at least some values could be retrieved - virtual bool GetParam(size_t WXUNUSED(n), - wxString * WXUNUSED(type), - wxString * WXUNUSED(name), - wxString * WXUNUSED(value)) const - { - return false; - } - - - // although this class is not supposed to be used polymorphically, give it - // a virtual dtor to silence compiler warnings - virtual ~wxStackFrameBase() { } - -protected: - // hooks for derived classes to initialize some fields on demand - virtual void OnGetName() { } - virtual void OnGetLocation() { } - - - // fields are protected, not private, so that OnGetXXX() could modify them - // directly - size_t m_level; - - wxString m_name, - m_module, - m_filename; - - size_t m_line; - - void *m_address; - size_t m_offset; -}; - -// ---------------------------------------------------------------------------- -// wxStackWalker: class for enumerating stack frames -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackWalkerBase -{ -public: - // ctor does nothing, use Walk() to walk the stack - wxStackWalkerBase() { } - - // dtor does nothing neither but should be virtual - virtual ~wxStackWalkerBase() { } - - // enumerate stack frames from the current location, skipping the initial - // number of them (this can be useful when Walk() is called from some known - // location and you don't want to see the first few frames anyhow; also - // notice that Walk() frame itself is not included if skip >= 1) - virtual void Walk(size_t skip = 1, size_t maxDepth = 200) = 0; - - // enumerate stack frames from the location of uncaught exception - // - // this version can only be called from wxApp::OnFatalException() - virtual void WalkFromException() = 0; - -protected: - // this function must be overrided to process the given frame - virtual void OnStackFrame(const wxStackFrame& frame) = 0; -}; - -#ifdef __WXMSW__ - #include "wx/msw/stackwalk.h" -#elif defined(__UNIX__) - #include "wx/unix/stackwalk.h" -#else - #error "wxStackWalker is not supported, set wxUSE_STACKWALKER to 0" -#endif - -#endif // wxUSE_STACKWALKER - -#endif // _WX_STACKWALK_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/wx/stackwalk.h +// Purpose: wxStackWalker and related classes, common part +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-07 +// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STACKWALK_H_ +#define _WX_STACKWALK_H_ + +#include "wx/defs.h" + +#if wxUSE_STACKWALKER + +class WXDLLIMPEXP_BASE wxStackFrame; + +// ---------------------------------------------------------------------------- +// wxStackFrame: a single stack level +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackFrameBase +{ +private: + // put this inline function here so that it is defined before use + wxStackFrameBase *ConstCast() const + { return wx_const_cast(wxStackFrameBase *, this); } + +public: + wxStackFrameBase(size_t level, void *address = NULL) + { + m_level = level; + + m_line = + m_offset = 0; + + m_address = address; + } + + // get the level of this frame (deepest/innermost one is 0) + size_t GetLevel() const { return m_level; } + + // return the address of this frame + void *GetAddress() const { return m_address; } + + + // return the unmangled (if possible) name of the function containing this + // frame + wxString GetName() const { ConstCast()->OnGetName(); return m_name; } + + // return the instruction pointer offset from the start of the function + size_t GetOffset() const { ConstCast()->OnGetName(); return m_offset; } + + // get the module this function belongs to (not always available) + wxString GetModule() const { ConstCast()->OnGetName(); return m_module; } + + + // return true if we have the filename and line number for this frame + bool HasSourceLocation() const { return !GetFileName().empty(); } + + // return the name of the file containing this frame, empty if + // unavailable (typically because debug info is missing) + wxString GetFileName() const + { ConstCast()->OnGetLocation(); return m_filename; } + + // return the line number of this frame, 0 if unavailable + size_t GetLine() const { ConstCast()->OnGetLocation(); return m_line; } + + + // return the number of parameters of this function (may return 0 if we + // can't retrieve the parameters info even although the function does have + // parameters) + virtual size_t GetParamCount() const { return 0; } + + // get the name, type and value (in text form) of the given parameter + // + // any pointer may be NULL + // + // return true if at least some values could be retrieved + virtual bool GetParam(size_t WXUNUSED(n), + wxString * WXUNUSED(type), + wxString * WXUNUSED(name), + wxString * WXUNUSED(value)) const + { + return false; + } + + + // although this class is not supposed to be used polymorphically, give it + // a virtual dtor to silence compiler warnings + virtual ~wxStackFrameBase() { } + +protected: + // hooks for derived classes to initialize some fields on demand + virtual void OnGetName() { } + virtual void OnGetLocation() { } + + + // fields are protected, not private, so that OnGetXXX() could modify them + // directly + size_t m_level; + + wxString m_name, + m_module, + m_filename; + + size_t m_line; + + void *m_address; + size_t m_offset; +}; + +// ---------------------------------------------------------------------------- +// wxStackWalker: class for enumerating stack frames +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackWalkerBase +{ +public: + // ctor does nothing, use Walk() to walk the stack + wxStackWalkerBase() { } + + // dtor does nothing neither but should be virtual + virtual ~wxStackWalkerBase() { } + + // enumerate stack frames from the current location, skipping the initial + // number of them (this can be useful when Walk() is called from some known + // location and you don't want to see the first few frames anyhow; also + // notice that Walk() frame itself is not included if skip >= 1) + virtual void Walk(size_t skip = 1, size_t maxDepth = 200) = 0; + + // enumerate stack frames from the location of uncaught exception + // + // this version can only be called from wxApp::OnFatalException() + virtual void WalkFromException() = 0; + +protected: + // this function must be overrided to process the given frame + virtual void OnStackFrame(const wxStackFrame& frame) = 0; +}; + +#ifdef __WXMSW__ + #include "wx/msw/stackwalk.h" +#elif defined(__UNIX__) + #include "wx/unix/stackwalk.h" +#else + #error "wxStackWalker is not supported, set wxUSE_STACKWALKER to 0" +#endif + +#endif // wxUSE_STACKWALKER + +#endif // _WX_STACKWALK_H_ + diff --git a/Externals/wxWidgets/include/wx/statbmp.h b/Externals/wxWidgets/include/wx/statbmp.h index e32c0cca76..35a5dc50c6 100644 --- a/Externals/wxWidgets/include/wx/statbmp.h +++ b/Externals/wxWidgets/include/wx/statbmp.h @@ -1,74 +1,74 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/statbmp.h -// Purpose: wxStaticBitmap class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.08.00 -// RCS-ID: $Id: statbmp.h 37066 2006-01-23 03:27:34Z MR $ -// Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBMP_H_BASE_ -#define _WX_STATBMP_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATBMP - -#include "wx/control.h" -#include "wx/bitmap.h" -#include "wx/icon.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; - -// a control showing an icon or a bitmap -class WXDLLEXPORT wxStaticBitmapBase : public wxControl -{ -public: - wxStaticBitmapBase() { } - virtual ~wxStaticBitmapBase(); - - // our interface - virtual void SetIcon(const wxIcon& icon) = 0; - virtual void SetBitmap(const wxBitmap& bitmap) = 0; - virtual wxBitmap GetBitmap() const = 0; - virtual wxIcon GetIcon() const /* = 0 -- should be pure virtual */ - { - // stub it out here for now as not all ports implement it (but they - // should) - return wxIcon(); - } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } - -protected: - virtual wxSize DoGetBestSize() const; - - DECLARE_NO_COPY_CLASS(wxStaticBitmapBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/statbmp.h" -#elif defined(__WXMSW__) - #include "wx/msw/statbmp.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/statbmp.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/statbmp.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/statbmp.h" -#elif defined(__WXMAC__) - #include "wx/mac/statbmp.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statbmp.h" -#elif defined(__WXPM__) - #include "wx/os2/statbmp.h" -#endif - -#endif // wxUSE_STATBMP - -#endif - // _WX_STATBMP_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statbmp.h +// Purpose: wxStaticBitmap class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// RCS-ID: $Id: statbmp.h 37066 2006-01-23 03:27:34Z MR $ +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_BASE_ +#define _WX_STATBMP_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATBMP + +#include "wx/control.h" +#include "wx/bitmap.h" +#include "wx/icon.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxStaticBitmapNameStr[]; + +// a control showing an icon or a bitmap +class WXDLLEXPORT wxStaticBitmapBase : public wxControl +{ +public: + wxStaticBitmapBase() { } + virtual ~wxStaticBitmapBase(); + + // our interface + virtual void SetIcon(const wxIcon& icon) = 0; + virtual void SetBitmap(const wxBitmap& bitmap) = 0; + virtual wxBitmap GetBitmap() const = 0; + virtual wxIcon GetIcon() const /* = 0 -- should be pure virtual */ + { + // stub it out here for now as not all ports implement it (but they + // should) + return wxIcon(); + } + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return false; } + virtual bool HasTransparentBackground() { return true; } + +protected: + virtual wxSize DoGetBestSize() const; + + DECLARE_NO_COPY_CLASS(wxStaticBitmapBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/statbmp.h" +#elif defined(__WXMSW__) + #include "wx/msw/statbmp.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/statbmp.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/statbmp.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/statbmp.h" +#elif defined(__WXMAC__) + #include "wx/mac/statbmp.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/statbmp.h" +#elif defined(__WXPM__) + #include "wx/os2/statbmp.h" +#endif + +#endif // wxUSE_STATBMP + +#endif + // _WX_STATBMP_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/statbox.h b/Externals/wxWidgets/include/wx/statbox.h index 182881c936..ddeba35263 100644 --- a/Externals/wxWidgets/include/wx/statbox.h +++ b/Externals/wxWidgets/include/wx/statbox.h @@ -1,74 +1,74 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: statbox.h -// Purpose: wxStaticBox base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: statbox.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBOX_H_BASE_ -#define _WX_STATBOX_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATBOX - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxStaticBox: a grouping box with a label -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticBoxBase : public wxControl -{ -public: - wxStaticBoxBase() { } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } - - // implementation only: this is used by wxStaticBoxSizer to account for the - // need for extra space taken by the static box - // - // the top border is the margin at the top (where the title is), - // borderOther is the margin on all other sides - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const - { - const int BORDER = 5; // FIXME: hardcoded value - - *borderTop = GetLabel().empty() ? BORDER : GetCharHeight(); - *borderOther = BORDER; - } - -private: - DECLARE_NO_COPY_CLASS(wxStaticBoxBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/statbox.h" -#elif defined(__WXMSW__) - #include "wx/msw/statbox.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/statbox.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/statbox.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/statbox.h" -#elif defined(__WXMAC__) - #include "wx/mac/statbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statbox.h" -#elif defined(__WXPM__) - #include "wx/os2/statbox.h" -#endif - -#endif // wxUSE_STATBOX - -#endif - // _WX_STATBOX_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: statbox.h +// Purpose: wxStaticBox base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: statbox.h 37066 2006-01-23 03:27:34Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBOX_H_BASE_ +#define _WX_STATBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATBOX + +#include "wx/control.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxStaticBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxStaticBox: a grouping box with a label +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticBoxBase : public wxControl +{ +public: + wxStaticBoxBase() { } + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return false; } + virtual bool HasTransparentBackground() { return true; } + + // implementation only: this is used by wxStaticBoxSizer to account for the + // need for extra space taken by the static box + // + // the top border is the margin at the top (where the title is), + // borderOther is the margin on all other sides + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const + { + const int BORDER = 5; // FIXME: hardcoded value + + *borderTop = GetLabel().empty() ? BORDER : GetCharHeight(); + *borderOther = BORDER; + } + +private: + DECLARE_NO_COPY_CLASS(wxStaticBoxBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/statbox.h" +#elif defined(__WXMSW__) + #include "wx/msw/statbox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/statbox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/statbox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/statbox.h" +#elif defined(__WXMAC__) + #include "wx/mac/statbox.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/statbox.h" +#elif defined(__WXPM__) + #include "wx/os2/statbox.h" +#endif + +#endif // wxUSE_STATBOX + +#endif + // _WX_STATBOX_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/statline.h b/Externals/wxWidgets/include/wx/statline.h index eac9078f4a..2156a71b2b 100644 --- a/Externals/wxWidgets/include/wx/statline.h +++ b/Externals/wxWidgets/include/wx/statline.h @@ -1,103 +1,103 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/statline.h -// Purpose: wxStaticLine class interface -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATLINE_H_BASE_ -#define _WX_STATLINE_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// this defines wxUSE_STATLINE -#include "wx/defs.h" - -#if wxUSE_STATLINE - -// the base class declaration -#include "wx/control.h" - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -// the default name for objects of class wxStaticLine -extern WXDLLEXPORT_DATA(const wxChar) wxStaticLineNameStr[]; - -// ---------------------------------------------------------------------------- -// wxStaticLine - a line in a dialog -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticLineBase : public wxControl -{ -public: - // constructor - wxStaticLineBase() { } - - // is the line vertical? - bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; } - - // get the default size for the "lesser" dimension of the static line - static int GetDefaultSize() { return 2; } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return false; } - -protected: - // set the right size for the right dimension - wxSize AdjustSize(const wxSize& size) const - { - wxSize sizeReal(size); - if ( IsVertical() ) - { - if ( size.x == wxDefaultCoord ) - sizeReal.x = GetDefaultSize(); - } - else - { - if ( size.y == wxDefaultCoord ) - sizeReal.y = GetDefaultSize(); - } - - return sizeReal; - } - - virtual wxSize DoGetBestSize() const - { - return AdjustSize(wxDefaultSize); - } - - DECLARE_NO_COPY_CLASS(wxStaticLineBase) -}; - -// ---------------------------------------------------------------------------- -// now include the actual class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/statline.h" -#elif defined(__WXMSW__) - #include "wx/msw/statline.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/statline.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/statline.h" -#elif defined(__WXPM__) - #include "wx/os2/statline.h" -#elif defined(__WXMAC__) - #include "wx/mac/statline.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statline.h" -#else // use generic implementation for all other platforms - #include "wx/generic/statline.h" -#endif - -#endif // wxUSE_STATLINE - -#endif // _WX_STATLINE_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statline.h +// Purpose: wxStaticLine class interface +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATLINE_H_BASE_ +#define _WX_STATLINE_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// this defines wxUSE_STATLINE +#include "wx/defs.h" + +#if wxUSE_STATLINE + +// the base class declaration +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default name for objects of class wxStaticLine +extern WXDLLEXPORT_DATA(const wxChar) wxStaticLineNameStr[]; + +// ---------------------------------------------------------------------------- +// wxStaticLine - a line in a dialog +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLineBase : public wxControl +{ +public: + // constructor + wxStaticLineBase() { } + + // is the line vertical? + bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; } + + // get the default size for the "lesser" dimension of the static line + static int GetDefaultSize() { return 2; } + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return false; } + +protected: + // set the right size for the right dimension + wxSize AdjustSize(const wxSize& size) const + { + wxSize sizeReal(size); + if ( IsVertical() ) + { + if ( size.x == wxDefaultCoord ) + sizeReal.x = GetDefaultSize(); + } + else + { + if ( size.y == wxDefaultCoord ) + sizeReal.y = GetDefaultSize(); + } + + return sizeReal; + } + + virtual wxSize DoGetBestSize() const + { + return AdjustSize(wxDefaultSize); + } + + DECLARE_NO_COPY_CLASS(wxStaticLineBase) +}; + +// ---------------------------------------------------------------------------- +// now include the actual class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/statline.h" +#elif defined(__WXMSW__) + #include "wx/msw/statline.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/statline.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/statline.h" +#elif defined(__WXPM__) + #include "wx/os2/statline.h" +#elif defined(__WXMAC__) + #include "wx/mac/statline.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/statline.h" +#else // use generic implementation for all other platforms + #include "wx/generic/statline.h" +#endif + +#endif // wxUSE_STATLINE + +#endif // _WX_STATLINE_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/stattext.h b/Externals/wxWidgets/include/wx/stattext.h index 99862b22ee..f2ad354258 100644 --- a/Externals/wxWidgets/include/wx/stattext.h +++ b/Externals/wxWidgets/include/wx/stattext.h @@ -1,69 +1,69 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: stattext.h -// Purpose: wxStaticText base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: stattext.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATTEXT_H_BASE_ -#define _WX_STATTEXT_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATTEXT - -#include "wx/control.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxStaticTextNameStr[]; - -class WXDLLEXPORT wxStaticTextBase : public wxControl -{ -public: - wxStaticTextBase() { } - - // in wxGTK wxStaticText doesn't derive from wxStaticTextBase so we have to - // declare this function directly in gtk header -#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__) - // wrap the text of the control so that no line is longer than the given - // width (if possible: this function won't break words) - // - // NB: implemented in dlgcmn.cpp for now - void Wrap(int width); -#endif // ! native __WXGTK__ - - // overriden base virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } - -private: - DECLARE_NO_COPY_CLASS(wxStaticTextBase) -}; - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/stattext.h" -#elif defined(__WXMSW__) - #include "wx/msw/stattext.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/stattext.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/stattext.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/stattext.h" -#elif defined(__WXMAC__) - #include "wx/mac/stattext.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/stattext.h" -#elif defined(__WXPM__) - #include "wx/os2/stattext.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/stattext.h" -#endif - -#endif // wxUSE_STATTEXT - -#endif - // _WX_STATTEXT_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: stattext.h +// Purpose: wxStaticText base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: stattext.h 37066 2006-01-23 03:27:34Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_BASE_ +#define _WX_STATTEXT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATTEXT + +#include "wx/control.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxStaticTextNameStr[]; + +class WXDLLEXPORT wxStaticTextBase : public wxControl +{ +public: + wxStaticTextBase() { } + + // in wxGTK wxStaticText doesn't derive from wxStaticTextBase so we have to + // declare this function directly in gtk header +#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__) + // wrap the text of the control so that no line is longer than the given + // width (if possible: this function won't break words) + // + // NB: implemented in dlgcmn.cpp for now + void Wrap(int width); +#endif // ! native __WXGTK__ + + // overriden base virtuals + virtual bool AcceptsFocus() const { return false; } + virtual bool HasTransparentBackground() { return true; } + +private: + DECLARE_NO_COPY_CLASS(wxStaticTextBase) +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/stattext.h" +#elif defined(__WXMSW__) + #include "wx/msw/stattext.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/stattext.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/stattext.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/stattext.h" +#elif defined(__WXMAC__) + #include "wx/mac/stattext.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/stattext.h" +#elif defined(__WXPM__) + #include "wx/os2/stattext.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/stattext.h" +#endif + +#endif // wxUSE_STATTEXT + +#endif + // _WX_STATTEXT_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/statusbr.h b/Externals/wxWidgets/include/wx/statusbr.h index 5a19e7503e..b1ab7d10e8 100644 --- a/Externals/wxWidgets/include/wx/statusbr.h +++ b/Externals/wxWidgets/include/wx/statusbr.h @@ -1,174 +1,174 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/statusbr.h -// Purpose: wxStatusBar class interface -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.02.00 -// RCS-ID: $Id: statusbr.h 41035 2006-09-06 17:36:22Z PC $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATUSBR_H_BASE_ -#define _WX_STATUSBR_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_STATUSBAR - -#include "wx/window.h" -#include "wx/list.h" -#include "wx/dynarray.h" - -extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxStatusBarNameStr[]; - -WX_DECLARE_LIST(wxString, wxListString); - -// ---------------------------------------------------------------------------- -// wxStatusBar constants -// ---------------------------------------------------------------------------- - -// style flags for fields -#define wxSB_NORMAL 0x0000 -#define wxSB_FLAT 0x0001 -#define wxSB_RAISED 0x0002 - -// ---------------------------------------------------------------------------- -// wxStatusBar: a window near the bottom of the frame used for status info -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStatusBarBase : public wxWindow -{ -public: - wxStatusBarBase(); - - virtual ~wxStatusBarBase(); - - // field count - // ----------- - - // set the number of fields and call SetStatusWidths(widths) if widths are - // given - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - int GetFieldsCount() const { return m_nFields; } - - // field text - // ---------- - - virtual void SetStatusText(const wxString& text, int number = 0) = 0; - virtual wxString GetStatusText(int number = 0) const = 0; - - void PushStatusText(const wxString& text, int number = 0); - void PopStatusText(int number = 0); - - // fields widths - // ------------- - - // set status field widths as absolute numbers: positive widths mean that - // the field has the specified absolute width, negative widths are - // interpreted as the sizer options, i.e. the extra space (total space - // minus the sum of fixed width fields) is divided between the fields with - // negative width according to the abs value of the width (field with width - // -2 grows twice as much as one with width -1 &c) - virtual void SetStatusWidths(int n, const int widths[]); - - // field styles - // ------------ - - // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D - // border around a field, wxSB_FLAT for no border around a field, so that it - // appears flat or wxSB_POPOUT to make the field appear raised. - // Setting field styles only works on wxMSW - virtual void SetStatusStyles(int n, const int styles[]); - - // geometry - // -------- - - // Get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const = 0; - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height) = 0; - - // get the dimensions of the horizontal and vertical borders - virtual int GetBorderX() const = 0; - virtual int GetBorderY() const = 0; - - // don't want status bars to accept the focus at all - virtual bool AcceptsFocus() const { return false; } - -protected: - // set the widths array to NULL - void InitWidths(); - - // free the status widths arrays - void FreeWidths(); - - // reset the widths - void ReinitWidths() { FreeWidths(); InitWidths(); } - - // same, for field styles - void InitStyles(); - void FreeStyles(); - void ReinitStyles() { FreeStyles(); InitStyles(); } - - // same, for text stacks - void InitStacks(); - void FreeStacks(); - void ReinitStacks() { FreeStacks(); InitStacks(); } - - // calculate the real field widths for the given total available size - wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; - - // use these functions to access the stacks of field strings - wxListString *GetStatusStack(int i) const; - wxListString *GetOrCreateStatusStack(int i); - - // the current number of fields - int m_nFields; - - // the widths of the fields in pixels if !NULL, all fields have the same - // width otherwise - int *m_statusWidths; - - // the styles of the fields - int *m_statusStyles; - - // stacks of previous values for PushStatusText/PopStatusText - // this is created on demand, use GetStatusStack/GetOrCreateStatusStack - wxListString **m_statusTextStacks; - - DECLARE_NO_COPY_CLASS(wxStatusBarBase) -}; - -// ---------------------------------------------------------------------------- -// include the actual wxStatusBar class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #define wxStatusBarUniv wxStatusBar - - #include "wx/univ/statusbr.h" -#elif defined(__WXPALMOS__) - #define wxStatusBarPalm wxStatusBar - - #include "wx/palmos/statusbr.h" -#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR - #define wxStatusBar95 wxStatusBar - - #include "wx/msw/statbr95.h" -#elif defined(__WXMAC__) - #define wxStatusBarMac wxStatusBar - - #include "wx/generic/statusbr.h" - #include "wx/mac/statusbr.h" -#else - #define wxStatusBarGeneric wxStatusBar - - #include "wx/generic/statusbr.h" -#endif - -#endif // wxUSE_STATUSBAR - -#endif - // _WX_STATUSBR_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statusbr.h +// Purpose: wxStatusBar class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.02.00 +// RCS-ID: $Id: statusbr.h 41035 2006-09-06 17:36:22Z PC $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATUSBR_H_BASE_ +#define _WX_STATUSBR_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATUSBAR + +#include "wx/window.h" +#include "wx/list.h" +#include "wx/dynarray.h" + +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxStatusBarNameStr[]; + +WX_DECLARE_LIST(wxString, wxListString); + +// ---------------------------------------------------------------------------- +// wxStatusBar constants +// ---------------------------------------------------------------------------- + +// style flags for fields +#define wxSB_NORMAL 0x0000 +#define wxSB_FLAT 0x0001 +#define wxSB_RAISED 0x0002 + +// ---------------------------------------------------------------------------- +// wxStatusBar: a window near the bottom of the frame used for status info +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStatusBarBase : public wxWindow +{ +public: + wxStatusBarBase(); + + virtual ~wxStatusBarBase(); + + // field count + // ----------- + + // set the number of fields and call SetStatusWidths(widths) if widths are + // given + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + int GetFieldsCount() const { return m_nFields; } + + // field text + // ---------- + + virtual void SetStatusText(const wxString& text, int number = 0) = 0; + virtual wxString GetStatusText(int number = 0) const = 0; + + void PushStatusText(const wxString& text, int number = 0); + void PopStatusText(int number = 0); + + // fields widths + // ------------- + + // set status field widths as absolute numbers: positive widths mean that + // the field has the specified absolute width, negative widths are + // interpreted as the sizer options, i.e. the extra space (total space + // minus the sum of fixed width fields) is divided between the fields with + // negative width according to the abs value of the width (field with width + // -2 grows twice as much as one with width -1 &c) + virtual void SetStatusWidths(int n, const int widths[]); + + // field styles + // ------------ + + // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D + // border around a field, wxSB_FLAT for no border around a field, so that it + // appears flat or wxSB_POPOUT to make the field appear raised. + // Setting field styles only works on wxMSW + virtual void SetStatusStyles(int n, const int styles[]); + + // geometry + // -------- + + // Get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const = 0; + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height) = 0; + + // get the dimensions of the horizontal and vertical borders + virtual int GetBorderX() const = 0; + virtual int GetBorderY() const = 0; + + // don't want status bars to accept the focus at all + virtual bool AcceptsFocus() const { return false; } + +protected: + // set the widths array to NULL + void InitWidths(); + + // free the status widths arrays + void FreeWidths(); + + // reset the widths + void ReinitWidths() { FreeWidths(); InitWidths(); } + + // same, for field styles + void InitStyles(); + void FreeStyles(); + void ReinitStyles() { FreeStyles(); InitStyles(); } + + // same, for text stacks + void InitStacks(); + void FreeStacks(); + void ReinitStacks() { FreeStacks(); InitStacks(); } + + // calculate the real field widths for the given total available size + wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; + + // use these functions to access the stacks of field strings + wxListString *GetStatusStack(int i) const; + wxListString *GetOrCreateStatusStack(int i); + + // the current number of fields + int m_nFields; + + // the widths of the fields in pixels if !NULL, all fields have the same + // width otherwise + int *m_statusWidths; + + // the styles of the fields + int *m_statusStyles; + + // stacks of previous values for PushStatusText/PopStatusText + // this is created on demand, use GetStatusStack/GetOrCreateStatusStack + wxListString **m_statusTextStacks; + + DECLARE_NO_COPY_CLASS(wxStatusBarBase) +}; + +// ---------------------------------------------------------------------------- +// include the actual wxStatusBar class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #define wxStatusBarUniv wxStatusBar + + #include "wx/univ/statusbr.h" +#elif defined(__WXPALMOS__) + #define wxStatusBarPalm wxStatusBar + + #include "wx/palmos/statusbr.h" +#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR + #define wxStatusBar95 wxStatusBar + + #include "wx/msw/statbr95.h" +#elif defined(__WXMAC__) + #define wxStatusBarMac wxStatusBar + + #include "wx/generic/statusbr.h" + #include "wx/mac/statusbr.h" +#else + #define wxStatusBarGeneric wxStatusBar + + #include "wx/generic/statusbr.h" +#endif + +#endif // wxUSE_STATUSBAR + +#endif + // _WX_STATUSBR_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/stdpaths.h b/Externals/wxWidgets/include/wx/stdpaths.h index beb8b13b7a..b9647c8c67 100644 --- a/Externals/wxWidgets/include/wx/stdpaths.h +++ b/Externals/wxWidgets/include/wx/stdpaths.h @@ -1,179 +1,179 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/stdpaths.h -// Purpose: declaration of wxStandardPaths class -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-17 -// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STDPATHS_H_ -#define _WX_STDPATHS_H_ - -#include "wx/defs.h" - -#if wxUSE_STDPATHS - -#include "wx/string.h" -#include "wx/filefn.h" - -// ---------------------------------------------------------------------------- -// wxStandardPaths returns the standard locations in the file system -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPathsBase -{ -public: - // possible resources categorires - enum ResourceCat - { - // no special category - ResourceCat_None, - - // message catalog resources - ResourceCat_Messages, - - // end of enum marker - ResourceCat_Max - }; - - - // return the global standard paths object - static wxStandardPathsBase& Get(); - - // return the path (directory+filename) of the running executable or - // wxEmptyString if it couldn't be determined. - // The path is returned as an absolute path whenever possible. - // Default implementation only try to use wxApp->argv[0]. - virtual wxString GetExecutablePath() const; - - // return the directory with system config files: - // /etc under Unix, c:\Documents and Settings\All Users\Application Data - // under Windows, /Library/Preferences for Mac - virtual wxString GetConfigDir() const = 0; - - // return the directory for the user config files: - // $HOME under Unix, c:\Documents and Settings\username under Windows, - // ~/Library/Preferences under Mac - // - // only use this if you have a single file to put there, otherwise - // GetUserDataDir() is more appropriate - virtual wxString GetUserConfigDir() const = 0; - - // return the location of the applications global, i.e. not user-specific, - // data files - // - // prefix/share/appname under Unix, c:\Program Files\appname under Windows, - // appname.app/Contents/SharedSupport app bundle directory under Mac - virtual wxString GetDataDir() const = 0; - - // return the location for application data files which are host-specific - // - // same as GetDataDir() except under Unix where it is /etc/appname - virtual wxString GetLocalDataDir() const; - - // return the directory for the user-dependent application data files - // - // $HOME/.appname under Unix, - // c:\Documents and Settings\username\Application Data\appname under Windows - // and ~/Library/Application Support/appname under Mac - virtual wxString GetUserDataDir() const = 0; - - // return the directory for user data files which shouldn't be shared with - // the other machines - // - // same as GetUserDataDir() for all platforms except Windows where it is - // the "Local Settings\Application Data\appname" directory - virtual wxString GetUserLocalDataDir() const; - - // return the directory where the loadable modules (plugins) live - // - // prefix/lib/appname under Unix, program directory under Windows and - // Contents/Plugins app bundle subdirectory under Mac - virtual wxString GetPluginsDir() const = 0; - - // get resources directory: resources are auxiliary files used by the - // application and include things like image and sound files - // - // same as GetDataDir() for all platforms except Mac where it returns - // Contents/Resources subdirectory of the app bundle - virtual wxString GetResourcesDir() const { return GetDataDir(); } - - // get localized resources directory containing the resource files of the - // specified category for the given language - // - // in general this is just GetResourcesDir()/lang under Windows and Unix - // and GetResourcesDir()/lang.lproj under Mac but is something quite - // different under Unix for message catalog category (namely the standard - // prefix/share/locale/lang/LC_MESSAGES) - virtual wxString - GetLocalizedResourcesDir(const wxChar *lang, - ResourceCat WXUNUSED(category) - = ResourceCat_None) const - { - return GetResourcesDir() + wxFILE_SEP_PATH + lang; - } - - // return the "Documents" directory for the current user - // - // C:\Documents and Settings\username\Documents under Windows, - // $HOME under Unix and ~/Documents under Mac - virtual wxString GetDocumentsDir() const; - - // return the temporary directory for the current user - virtual wxString GetTempDir() const; - - - // virtual dtor for the base class - virtual ~wxStandardPathsBase(); - -protected: - // append "/appname" suffix if the app name is set (doesn't append the - // slash if dir already ends with a slash or dot) - static wxString AppendAppName(const wxString& dir); -}; - -#if defined(__WXMSW__) - #include "wx/msw/stdpaths.h" -// We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) -#elif defined(__WXMAC__) || defined(__DARWIN__) - #include "wx/mac/corefoundation/stdpaths.h" -#elif defined(__OS2__) - #include "wx/os2/stdpaths.h" -#elif defined(__UNIX__) - #include "wx/unix/stdpaths.h" -#elif defined(__PALMOS__) - #include "wx/palmos/stdpaths.h" -#else - -// ---------------------------------------------------------------------------- -// Minimal generic implementation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase -{ -public: - void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; } - wxString GetInstallPrefix() const { return m_prefix; } - - virtual wxString GetExecutablePath() const { return m_prefix; } - virtual wxString GetConfigDir() const { return m_prefix; } - virtual wxString GetUserConfigDir() const { return m_prefix; } - virtual wxString GetDataDir() const { return m_prefix; } - virtual wxString GetLocalDataDir() const { return m_prefix; } - virtual wxString GetUserDataDir() const { return m_prefix; } - virtual wxString GetPluginsDir() const { return m_prefix; } - virtual wxString GetDocumentsDir() const { return m_prefix; } - -private: - wxString m_prefix; -}; - -#endif - -#endif // wxUSE_STDPATHS - -#endif // _WX_STDPATHS_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stdpaths.h +// Purpose: declaration of wxStandardPaths class +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-17 +// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STDPATHS_H_ +#define _WX_STDPATHS_H_ + +#include "wx/defs.h" + +#if wxUSE_STDPATHS + +#include "wx/string.h" +#include "wx/filefn.h" + +// ---------------------------------------------------------------------------- +// wxStandardPaths returns the standard locations in the file system +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPathsBase +{ +public: + // possible resources categorires + enum ResourceCat + { + // no special category + ResourceCat_None, + + // message catalog resources + ResourceCat_Messages, + + // end of enum marker + ResourceCat_Max + }; + + + // return the global standard paths object + static wxStandardPathsBase& Get(); + + // return the path (directory+filename) of the running executable or + // wxEmptyString if it couldn't be determined. + // The path is returned as an absolute path whenever possible. + // Default implementation only try to use wxApp->argv[0]. + virtual wxString GetExecutablePath() const; + + // return the directory with system config files: + // /etc under Unix, c:\Documents and Settings\All Users\Application Data + // under Windows, /Library/Preferences for Mac + virtual wxString GetConfigDir() const = 0; + + // return the directory for the user config files: + // $HOME under Unix, c:\Documents and Settings\username under Windows, + // ~/Library/Preferences under Mac + // + // only use this if you have a single file to put there, otherwise + // GetUserDataDir() is more appropriate + virtual wxString GetUserConfigDir() const = 0; + + // return the location of the applications global, i.e. not user-specific, + // data files + // + // prefix/share/appname under Unix, c:\Program Files\appname under Windows, + // appname.app/Contents/SharedSupport app bundle directory under Mac + virtual wxString GetDataDir() const = 0; + + // return the location for application data files which are host-specific + // + // same as GetDataDir() except under Unix where it is /etc/appname + virtual wxString GetLocalDataDir() const; + + // return the directory for the user-dependent application data files + // + // $HOME/.appname under Unix, + // c:\Documents and Settings\username\Application Data\appname under Windows + // and ~/Library/Application Support/appname under Mac + virtual wxString GetUserDataDir() const = 0; + + // return the directory for user data files which shouldn't be shared with + // the other machines + // + // same as GetUserDataDir() for all platforms except Windows where it is + // the "Local Settings\Application Data\appname" directory + virtual wxString GetUserLocalDataDir() const; + + // return the directory where the loadable modules (plugins) live + // + // prefix/lib/appname under Unix, program directory under Windows and + // Contents/Plugins app bundle subdirectory under Mac + virtual wxString GetPluginsDir() const = 0; + + // get resources directory: resources are auxiliary files used by the + // application and include things like image and sound files + // + // same as GetDataDir() for all platforms except Mac where it returns + // Contents/Resources subdirectory of the app bundle + virtual wxString GetResourcesDir() const { return GetDataDir(); } + + // get localized resources directory containing the resource files of the + // specified category for the given language + // + // in general this is just GetResourcesDir()/lang under Windows and Unix + // and GetResourcesDir()/lang.lproj under Mac but is something quite + // different under Unix for message catalog category (namely the standard + // prefix/share/locale/lang/LC_MESSAGES) + virtual wxString + GetLocalizedResourcesDir(const wxChar *lang, + ResourceCat WXUNUSED(category) + = ResourceCat_None) const + { + return GetResourcesDir() + wxFILE_SEP_PATH + lang; + } + + // return the "Documents" directory for the current user + // + // C:\Documents and Settings\username\Documents under Windows, + // $HOME under Unix and ~/Documents under Mac + virtual wxString GetDocumentsDir() const; + + // return the temporary directory for the current user + virtual wxString GetTempDir() const; + + + // virtual dtor for the base class + virtual ~wxStandardPathsBase(); + +protected: + // append "/appname" suffix if the app name is set (doesn't append the + // slash if dir already ends with a slash or dot) + static wxString AppendAppName(const wxString& dir); +}; + +#if defined(__WXMSW__) + #include "wx/msw/stdpaths.h" +// We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) +#elif defined(__WXMAC__) || defined(__DARWIN__) + #include "wx/mac/corefoundation/stdpaths.h" +#elif defined(__OS2__) + #include "wx/os2/stdpaths.h" +#elif defined(__UNIX__) + #include "wx/unix/stdpaths.h" +#elif defined(__PALMOS__) + #include "wx/palmos/stdpaths.h" +#else + +// ---------------------------------------------------------------------------- +// Minimal generic implementation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; } + wxString GetInstallPrefix() const { return m_prefix; } + + virtual wxString GetExecutablePath() const { return m_prefix; } + virtual wxString GetConfigDir() const { return m_prefix; } + virtual wxString GetUserConfigDir() const { return m_prefix; } + virtual wxString GetDataDir() const { return m_prefix; } + virtual wxString GetLocalDataDir() const { return m_prefix; } + virtual wxString GetUserDataDir() const { return m_prefix; } + virtual wxString GetPluginsDir() const { return m_prefix; } + virtual wxString GetDocumentsDir() const { return m_prefix; } + +private: + wxString m_prefix; +}; + +#endif + +#endif // wxUSE_STDPATHS + +#endif // _WX_STDPATHS_H_ + diff --git a/Externals/wxWidgets/include/wx/stockitem.h b/Externals/wxWidgets/include/wx/stockitem.h index 31ac5213af..55695077d6 100644 --- a/Externals/wxWidgets/include/wx/stockitem.h +++ b/Externals/wxWidgets/include/wx/stockitem.h @@ -1,73 +1,73 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stockitem.h -// Purpose: stock items helpers (privateh header) -// Author: Vaclav Slavik -// Modified by: -// Created: 2004-08-15 -// RCS-ID: $Id: stockitem.h 42935 2006-11-02 09:51:49Z JS $ -// Copyright: (c) Vaclav Slavik, 2004 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STOCKITEM_H_ -#define _WX_STOCKITEM_H_ - -#include "wx/defs.h" -#include "wx/wxchar.h" -#include "wx/string.h" -#include "wx/accel.h" - -// ---------------------------------------------------------------------------- -// Helper functions for stock items handling: -// ---------------------------------------------------------------------------- - -// Returns true if the ID is in the list of recognized stock actions -WXDLLEXPORT bool wxIsStockID(wxWindowID id); - -// Returns true of the label is empty or label of a stock button with -// given ID -WXDLLEXPORT bool wxIsStockLabel(wxWindowID id, const wxString& label); - -enum wxStockLabelQueryFlag -{ - wxSTOCK_NOFLAGS = 0, - - wxSTOCK_WITH_MNEMONIC = 1, - wxSTOCK_WITH_ACCELERATOR = 2 -}; - -// Returns label that should be used for given stock UI element (e.g. "&OK" -// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character -// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator -// for given ID is concatenated to the label using \t as separator -WXDLLEXPORT wxString wxGetStockLabel(wxWindowID id, - long flags = wxSTOCK_WITH_MNEMONIC); - -#if wxUSE_ACCEL - - // Returns the accelerator that should be used for given stock UI element - // (e.g. "Ctrl+x" for wxSTOCK_EXIT) - WXDLLEXPORT wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); - -#endif - -// wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to -// wxGetStockHelpString() about the context where the help string is to be used -enum wxStockHelpStringClient -{ - wxSTOCK_MENU // help string to use for menu items -}; - -// Returns an help string for the given stock UI element and for the given "context". -WXDLLEXPORT wxString wxGetStockHelpString(wxWindowID id, - wxStockHelpStringClient client = wxSTOCK_MENU); - - -#ifdef __WXGTK20__ - -// Translates stock ID to GTK+'s stock item string indentifier: -WXDLLEXPORT const char *wxGetStockGtkID(wxWindowID id); - -#endif - -#endif // _WX_STOCKITEM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stockitem.h +// Purpose: stock items helpers (privateh header) +// Author: Vaclav Slavik +// Modified by: +// Created: 2004-08-15 +// RCS-ID: $Id: stockitem.h 42935 2006-11-02 09:51:49Z JS $ +// Copyright: (c) Vaclav Slavik, 2004 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STOCKITEM_H_ +#define _WX_STOCKITEM_H_ + +#include "wx/defs.h" +#include "wx/wxchar.h" +#include "wx/string.h" +#include "wx/accel.h" + +// ---------------------------------------------------------------------------- +// Helper functions for stock items handling: +// ---------------------------------------------------------------------------- + +// Returns true if the ID is in the list of recognized stock actions +WXDLLEXPORT bool wxIsStockID(wxWindowID id); + +// Returns true of the label is empty or label of a stock button with +// given ID +WXDLLEXPORT bool wxIsStockLabel(wxWindowID id, const wxString& label); + +enum wxStockLabelQueryFlag +{ + wxSTOCK_NOFLAGS = 0, + + wxSTOCK_WITH_MNEMONIC = 1, + wxSTOCK_WITH_ACCELERATOR = 2 +}; + +// Returns label that should be used for given stock UI element (e.g. "&OK" +// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character +// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator +// for given ID is concatenated to the label using \t as separator +WXDLLEXPORT wxString wxGetStockLabel(wxWindowID id, + long flags = wxSTOCK_WITH_MNEMONIC); + +#if wxUSE_ACCEL + + // Returns the accelerator that should be used for given stock UI element + // (e.g. "Ctrl+x" for wxSTOCK_EXIT) + WXDLLEXPORT wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); + +#endif + +// wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to +// wxGetStockHelpString() about the context where the help string is to be used +enum wxStockHelpStringClient +{ + wxSTOCK_MENU // help string to use for menu items +}; + +// Returns an help string for the given stock UI element and for the given "context". +WXDLLEXPORT wxString wxGetStockHelpString(wxWindowID id, + wxStockHelpStringClient client = wxSTOCK_MENU); + + +#ifdef __WXGTK20__ + +// Translates stock ID to GTK+'s stock item string indentifier: +WXDLLEXPORT const char *wxGetStockGtkID(wxWindowID id); + +#endif + +#endif // _WX_STOCKITEM_H_ diff --git a/Externals/wxWidgets/include/wx/stopwatch.h b/Externals/wxWidgets/include/wx/stopwatch.h index 13bab5d3b8..9f1d1889b0 100644 --- a/Externals/wxWidgets/include/wx/stopwatch.h +++ b/Externals/wxWidgets/include/wx/stopwatch.h @@ -1,102 +1,102 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stopwatch.h -// Purpose: wxStopWatch and global time-related functions -// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch) -// Created: 26.06.03 (extracted from wx/timer.h) -// RCS-ID: $Id: stopwatch.h 40624 2006-08-16 12:17:05Z MW $ -// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STOPWATCH_H_ -#define _WX_STOPWATCH_H_ - -#include "wx/defs.h" -#include "wx/longlong.h" - -// ---------------------------------------------------------------------------- -// wxStopWatch: measure time intervals with up to 1ms resolution -// ---------------------------------------------------------------------------- - -#if wxUSE_STOPWATCH - -class WXDLLIMPEXP_BASE wxStopWatch -{ -public: - // ctor starts the stop watch - wxStopWatch() { m_pauseCount = 0; Start(); } - - // start the stop watch at the moment t0 - void Start(long t0 = 0); - - // pause the stop watch - void Pause() - { - if ( m_pauseCount++ == 0 ) - m_pause = GetElapsedTime(); - } - - // resume it - void Resume() - { - wxASSERT_MSG( m_pauseCount > 0, - _T("Resuming stop watch which is not paused") ); - - if ( --m_pauseCount == 0 ) - Start(m_pause); - } - - // get elapsed time since the last Start() in milliseconds - long Time() const; - -protected: - // returns the elapsed time since t0 - long GetElapsedTime() const; - -private: - // the time of the last Start() - wxLongLong m_t0; - - // the time of the last Pause() (only valid if m_pauseCount > 0) - long m_pause; - - // if > 0, the stop watch is paused, otherwise it is running - int m_pauseCount; -}; - -#endif // wxUSE_STOPWATCH - -#if wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 - - // Starts a global timer - // -- DEPRECATED: use wxStopWatch instead - wxDEPRECATED( void WXDLLIMPEXP_BASE wxStartTimer() ); - - // Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime - // -- DEPRECATED: use wxStopWatch instead - wxDEPRECATED( long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = true) ); - -#endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// global time functions -// ---------------------------------------------------------------------------- - -// Get number of seconds since local time 00:00:00 Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetLocalTime(); - -// Get number of seconds since GMT 00:00:00, Jan 1st 1970. -extern long WXDLLIMPEXP_BASE wxGetUTCTime(); - -#if wxUSE_LONGLONG - typedef wxLongLong wxMilliClock_t; -#else - typedef double wxMilliClock_t; -#endif // wxUSE_LONGLONG - -// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 -extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); - -#define wxGetCurrentTime() wxGetLocalTime() - -#endif // _WX_STOPWATCH_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stopwatch.h +// Purpose: wxStopWatch and global time-related functions +// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch) +// Created: 26.06.03 (extracted from wx/timer.h) +// RCS-ID: $Id: stopwatch.h 40624 2006-08-16 12:17:05Z MW $ +// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STOPWATCH_H_ +#define _WX_STOPWATCH_H_ + +#include "wx/defs.h" +#include "wx/longlong.h" + +// ---------------------------------------------------------------------------- +// wxStopWatch: measure time intervals with up to 1ms resolution +// ---------------------------------------------------------------------------- + +#if wxUSE_STOPWATCH + +class WXDLLIMPEXP_BASE wxStopWatch +{ +public: + // ctor starts the stop watch + wxStopWatch() { m_pauseCount = 0; Start(); } + + // start the stop watch at the moment t0 + void Start(long t0 = 0); + + // pause the stop watch + void Pause() + { + if ( m_pauseCount++ == 0 ) + m_pause = GetElapsedTime(); + } + + // resume it + void Resume() + { + wxASSERT_MSG( m_pauseCount > 0, + _T("Resuming stop watch which is not paused") ); + + if ( --m_pauseCount == 0 ) + Start(m_pause); + } + + // get elapsed time since the last Start() in milliseconds + long Time() const; + +protected: + // returns the elapsed time since t0 + long GetElapsedTime() const; + +private: + // the time of the last Start() + wxLongLong m_t0; + + // the time of the last Pause() (only valid if m_pauseCount > 0) + long m_pause; + + // if > 0, the stop watch is paused, otherwise it is running + int m_pauseCount; +}; + +#endif // wxUSE_STOPWATCH + +#if wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 + + // Starts a global timer + // -- DEPRECATED: use wxStopWatch instead + wxDEPRECATED( void WXDLLIMPEXP_BASE wxStartTimer() ); + + // Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime + // -- DEPRECATED: use wxStopWatch instead + wxDEPRECATED( long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = true) ); + +#endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// global time functions +// ---------------------------------------------------------------------------- + +// Get number of seconds since local time 00:00:00 Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetLocalTime(); + +// Get number of seconds since GMT 00:00:00, Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetUTCTime(); + +#if wxUSE_LONGLONG + typedef wxLongLong wxMilliClock_t; +#else + typedef double wxMilliClock_t; +#endif // wxUSE_LONGLONG + +// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 +extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); + +#define wxGetCurrentTime() wxGetLocalTime() + +#endif // _WX_STOPWATCH_H_ diff --git a/Externals/wxWidgets/include/wx/strconv.h b/Externals/wxWidgets/include/wx/strconv.h index 7d167fab73..1a760cb65c 100644 --- a/Externals/wxWidgets/include/wx/strconv.h +++ b/Externals/wxWidgets/include/wx/strconv.h @@ -1,553 +1,553 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: strconv.h -// Purpose: conversion routines for char sets any Unicode -// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: strconv.h 45893 2007-05-08 20:05:16Z VZ $ -// Copyright: (c) 1998 Ove Kaaven, Robert Roebling -// (c) 1998-2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STRCONV_H_ -#define _WX_STRCONV_H_ - -#include "wx/defs.h" -#include "wx/wxchar.h" -#include "wx/buffer.h" - -#ifdef __DIGITALMARS__ -#include "typeinfo.h" -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -# undef __BSEXCPT__ -#endif - -#include <stdlib.h> - -#if wxUSE_WCHAR_T - -// the error value returned by wxMBConv methods -#define wxCONV_FAILED ((size_t)-1) - -// the default value for some length parameters meaning that the string is -// NUL-terminated -#define wxNO_LEN ((size_t)-1) - -// ---------------------------------------------------------------------------- -// wxMBConv (abstract base class for conversions) -// ---------------------------------------------------------------------------- - -// When deriving a new class from wxMBConv you must reimplement ToWChar() and -// FromWChar() methods which are not pure virtual only for historical reasons, -// don't let the fact that the existing classes implement MB2WC/WC2MB() instead -// confuse you. -// -// You also have to implement Clone() to allow copying the conversions -// polymorphically. -// -// And you might need to override GetMBNulLen() as well. -class WXDLLIMPEXP_BASE wxMBConv -{ -public: - // The functions doing actual conversion from/to narrow to/from wide - // character strings. - // - // On success, the return value is the length (i.e. the number of - // characters, not bytes) of the converted string including any trailing - // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if - // there is not enough space for everything, including the trailing NUL - // character(s), in the output buffer, wxCONV_FAILED is returned. - // - // In the special case when dstLen is 0 (outputBuf may be NULL then) the - // return value is the length of the needed buffer but nothing happens - // otherwise. If srcLen is wxNO_LEN, the entire string, up to and - // including the trailing NUL(s), is converted, otherwise exactly srcLen - // bytes are. - // - // Typical usage: - // - // size_t dstLen = conv.ToWChar(NULL, 0, src); - // if ( dstLen != wxCONV_FAILED ) - // ... handle error ... - // wchar_t *wbuf = new wchar_t[dstLen]; - // conv.ToWChar(wbuf, dstLen, src); - // - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - - - // Convenience functions for translating NUL-terminated strings: returns - // the buffer containing the converted string or NULL pointer if the - // conversion failed. - const wxWCharBuffer cMB2WC(const char *in) const; - const wxCharBuffer cWC2MB(const wchar_t *in) const; - - // Convenience functions for converting strings which may contain embedded - // NULs and don't have to be NUL-terminated. - // - // inLen is the length of the buffer including trailing NUL if any: if the - // last 4 bytes of the buffer are all NULs, these functions are more - // efficient as they avoid copying the string, but otherwise a copy is made - // internally which could be quite bad for (very) long strings. - // - // outLen receives, if not NULL, the length of the converted string or 0 if - // the conversion failed (returning 0 and not -1 in this case makes it - // difficult to distinguish between failed conversion and empty input but - // this is done for backwards compatibility) - const wxWCharBuffer - cMB2WC(const char *in, size_t inLen, size_t *outLen) const; - const wxCharBuffer - cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const; - - // convenience functions for converting MB or WC to/from wxWin default -#if wxUSE_UNICODE - const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } - const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); } - const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; } - const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; } -#else // ANSI - const char* cMB2WX(const char *psz) const { return psz; } - const char* cWX2MB(const char *psz) const { return psz; } - const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); } - const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); } -#endif // Unicode/ANSI - - // this function is used in the implementation of cMB2WC() to distinguish - // between the following cases: - // - // a) var width encoding with strings terminated by a single NUL - // (usual multibyte encodings): return 1 in this case - // b) fixed width encoding with 2 bytes/char and so terminated by - // 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case - // c) fixed width encoding with 4 bytes/char and so terminated by - // 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case - // - // anything else is not supported currently and -1 should be returned - virtual size_t GetMBNulLen() const { return 1; } - - // return the maximal value currently returned by GetMBNulLen() for any - // encoding - static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; } - - - // The old conversion functions. The existing classes currently mostly - // implement these ones but we're in transition to using To/FromWChar() - // instead and any new classes should implement just the new functions. - // For now, however, we provide default implementation of To/FromWChar() in - // this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all - // the conversions at once. - // - // On success, the return value is the length (i.e. the number of - // characters, not bytes) not counting the trailing NUL(s) of the converted - // string. On failure, (size_t)-1 is returned. In the special case when - // outputBuf is NULL the return value is the same one but nothing is - // written to the buffer. - // - // Note that outLen is the length of the output buffer, not the length of - // the input (which is always supposed to be terminated by one or more - // NULs, as appropriate for the encoding)! - virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const; - virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const; - - - // make a heap-allocated copy of this object - virtual wxMBConv *Clone() const = 0; - - // virtual dtor for any base class - virtual ~wxMBConv(); -}; - -// ---------------------------------------------------------------------------- -// wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for -// conversion (hence it depends on the current locale) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv -{ -public: - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - - virtual wxMBConv *Clone() const { return new wxMBConvLibc; } -}; - -#ifdef __UNIX__ - -// ---------------------------------------------------------------------------- -// wxConvBrokenFileNames is made for Unix in Unicode mode when -// files are accidentally written in an encoding which is not -// the system encoding. Typically, the system encoding will be -// UTF8 but there might be files stored in ISO8859-1 on disk. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv -{ -public: - wxConvBrokenFileNames(const wxChar *charset); - wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) - : wxMBConv(), - m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) - { - } - virtual ~wxConvBrokenFileNames() { delete m_conv; } - - virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const - { - return m_conv->MB2WC(out, in, outLen); - } - - virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const - { - return m_conv->WC2MB(out, in, outLen); - } - - virtual size_t GetMBNulLen() const - { - // cast needed to call a private function - return m_conv->GetMBNulLen(); - } - - virtual wxMBConv *Clone() const { return new wxConvBrokenFileNames(*this); } - -private: - // the conversion object we forward to - wxMBConv *m_conv; - - DECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames) -}; - -#endif // __UNIX__ - -// ---------------------------------------------------------------------------- -// wxMBConvUTF7 (for conversion using UTF7 encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv -{ -public: - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - - virtual wxMBConv *Clone() const { return new wxMBConvUTF7; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF8 (for conversion using UTF8 encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConv -{ -public: - enum - { - MAP_INVALID_UTF8_NOT = 0, - MAP_INVALID_UTF8_TO_PUA = 1, - MAP_INVALID_UTF8_TO_OCTAL = 2 - }; - - wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - - virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); } - -private: - int m_options; -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF16Base: for both LE and BE variants -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv -{ -public: - enum { BYTES_PER_CHAR = 2 }; - - virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } - -protected: - // return the length of the buffer using srcLen if it's not wxNO_LEN and - // computing the length ourselves if it is; also checks that the length is - // even if specified as we need an entire number of UTF-16 characters and - // returns wxNO_LEN which indicates error if it is odd - static size_t GetLength(const char *src, size_t srcLen); -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF16LE; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF16BE; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF32Base: base class for both LE and BE variants -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv -{ -public: - enum { BYTES_PER_CHAR = 4 }; - - virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } - -protected: - // this is similar to wxMBConvUTF16Base method with the same name except - // that, of course, it verifies that length is divisible by 4 if given and - // not by 2 - static size_t GetLength(const char *src, size_t srcLen); -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF32LE; } -}; - -// ---------------------------------------------------------------------------- -// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base -{ -public: - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF32BE; } -}; - -// ---------------------------------------------------------------------------- -// wxCSConv (for conversion based on loadable char sets) -// ---------------------------------------------------------------------------- - -#include "wx/fontenc.h" - -class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv -{ -public: - // we can be created either from charset name or from an encoding constant - // but we can't have both at once - wxCSConv(const wxChar *charset); - wxCSConv(wxFontEncoding encoding); - - wxCSConv(const wxCSConv& conv); - virtual ~wxCSConv(); - - wxCSConv& operator=(const wxCSConv& conv); - - virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; - virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; - virtual size_t GetMBNulLen() const; - - virtual wxMBConv *Clone() const { return new wxCSConv(*this); } - - void Clear(); - -#if wxABI_VERSION >= 20802 - // return true if the conversion could be initilized successfully - bool IsOk() const; -#endif // wx 2.8.2+ - -private: - // common part of all ctors - void Init(); - - // creates m_convReal if necessary - void CreateConvIfNeeded() const; - - // do create m_convReal (unconditionally) - wxMBConv *DoCreate() const; - - // set the name (may be only called when m_name == NULL), makes copy of - // charset string - void SetName(const wxChar *charset); - - - // note that we can't use wxString here because of compilation - // dependencies: we're included from wx/string.h - wxChar *m_name; - wxFontEncoding m_encoding; - - // use CreateConvIfNeeded() before accessing m_convReal! - wxMBConv *m_convReal; - bool m_deferred; -}; - - -// ---------------------------------------------------------------------------- -// declare predefined conversion objects -// ---------------------------------------------------------------------------- - -// conversion to be used with all standard functions affected by locale, e.g. -// strtol(), strftime(), ... -extern WXDLLIMPEXP_DATA_BASE(wxMBConv&) wxConvLibc; - -// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t -extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvISO8859_1; -extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7&) wxConvUTF7; -extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8&) wxConvUTF8; - -// conversion used for the file names on the systems where they're not Unicode -// (basically anything except Windows) -// -// this is used by all file functions, can be changed by the application -// -// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used -// under Windows normally) -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName; - -// backwards compatible define -#define wxConvFile (*wxConvFileName) - -// the current conversion object, may be set to any conversion, is used by -// default in a couple of places inside wx (initially same as wxConvLibc) -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; - -// the conversion corresponding to the current locale -extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvLocal; - -// the conversion corresponding to the encoding of the standard UI elements -// -// by default this is the same as wxConvLocal but may be changed if the program -// needs to use a fixed encoding -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; - -// ---------------------------------------------------------------------------- -// endianness-dependent conversions -// ---------------------------------------------------------------------------- - -#ifdef WORDS_BIGENDIAN - typedef wxMBConvUTF16BE wxMBConvUTF16; - typedef wxMBConvUTF32BE wxMBConvUTF32; -#else - typedef wxMBConvUTF16LE wxMBConvUTF16; - typedef wxMBConvUTF32LE wxMBConvUTF32; -#endif - -// ---------------------------------------------------------------------------- -// filename conversion macros -// ---------------------------------------------------------------------------- - -// filenames are multibyte on Unix and widechar on Windows -#if defined(__UNIX__) || defined(__WXMAC__) - #define wxMBFILES 1 -#else - #define wxMBFILES 0 -#endif - -#if wxMBFILES && wxUSE_UNICODE - #define wxFNCONV(name) wxConvFileName->cWX2MB(name) - #define wxFNSTRINGCAST wxMBSTRINGCAST -#else -#if defined( __WXOSX__ ) && wxMBFILES - #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) -#else - #define wxFNCONV(name) name -#endif - #define wxFNSTRINGCAST WXSTRINGCAST -#endif - -#else // !wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// stand-ins in absence of wchar_t -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxMBConv -{ -public: - const char* cMB2WX(const char *psz) const { return psz; } - const char* cWX2MB(const char *psz) const { return psz; } - wxMBConv *Clone() const { return NULL; } -}; - -#define wxConvFile wxConvLocal -#define wxConvUI wxConvCurrent - -typedef wxMBConv wxCSConv; - -extern WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc, - wxConvLocal, - wxConvISO8859_1, - wxConvUTF8; -extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; - -#define wxFNCONV(name) name -#define wxFNSTRINGCAST WXSTRINGCAST - -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T - -// ---------------------------------------------------------------------------- -// macros for the most common conversions -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE - #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s) - #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s) - -#if wxABI_VERSION >= 20802 - // these functions should be used when the conversions really, really have - // to succeed (usually because we pass their results to a standard C - // function which would crash if we passed NULL to it), so these functions - // always return a valid pointer if their argument is non-NULL - - // this function safety is achieved by trying wxConvLibc first, wxConvUTF8 - // next if it fails and, finally, wxConvISO8859_1 which always succeeds - extern WXDLLIMPEXP_BASE wxWCharBuffer wxSafeConvertMB2WX(const char *s); - - // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL) - // if it fails - extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws); -#endif // wxABI 2.8.2+ -#else // ANSI - // no conversions to do - #define wxConvertWX2MB(s) (s) - #define wxConvertMB2WX(s) (s) - #define wxSafeConvertMB2WX(s) (s) - #define wxSafeConvertWX2MB(s) (s) -#endif // Unicode/ANSI - -#endif // _WX_STRCONV_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: strconv.h +// Purpose: conversion routines for char sets any Unicode +// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: strconv.h 45893 2007-05-08 20:05:16Z VZ $ +// Copyright: (c) 1998 Ove Kaaven, Robert Roebling +// (c) 1998-2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STRCONV_H_ +#define _WX_STRCONV_H_ + +#include "wx/defs.h" +#include "wx/wxchar.h" +#include "wx/buffer.h" + +#ifdef __DIGITALMARS__ +#include "typeinfo.h" +#endif + +#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 +# undef __BSEXCPT__ +#endif + +#include <stdlib.h> + +#if wxUSE_WCHAR_T + +// the error value returned by wxMBConv methods +#define wxCONV_FAILED ((size_t)-1) + +// the default value for some length parameters meaning that the string is +// NUL-terminated +#define wxNO_LEN ((size_t)-1) + +// ---------------------------------------------------------------------------- +// wxMBConv (abstract base class for conversions) +// ---------------------------------------------------------------------------- + +// When deriving a new class from wxMBConv you must reimplement ToWChar() and +// FromWChar() methods which are not pure virtual only for historical reasons, +// don't let the fact that the existing classes implement MB2WC/WC2MB() instead +// confuse you. +// +// You also have to implement Clone() to allow copying the conversions +// polymorphically. +// +// And you might need to override GetMBNulLen() as well. +class WXDLLIMPEXP_BASE wxMBConv +{ +public: + // The functions doing actual conversion from/to narrow to/from wide + // character strings. + // + // On success, the return value is the length (i.e. the number of + // characters, not bytes) of the converted string including any trailing + // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if + // there is not enough space for everything, including the trailing NUL + // character(s), in the output buffer, wxCONV_FAILED is returned. + // + // In the special case when dstLen is 0 (outputBuf may be NULL then) the + // return value is the length of the needed buffer but nothing happens + // otherwise. If srcLen is wxNO_LEN, the entire string, up to and + // including the trailing NUL(s), is converted, otherwise exactly srcLen + // bytes are. + // + // Typical usage: + // + // size_t dstLen = conv.ToWChar(NULL, 0, src); + // if ( dstLen != wxCONV_FAILED ) + // ... handle error ... + // wchar_t *wbuf = new wchar_t[dstLen]; + // conv.ToWChar(wbuf, dstLen, src); + // + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + + + // Convenience functions for translating NUL-terminated strings: returns + // the buffer containing the converted string or NULL pointer if the + // conversion failed. + const wxWCharBuffer cMB2WC(const char *in) const; + const wxCharBuffer cWC2MB(const wchar_t *in) const; + + // Convenience functions for converting strings which may contain embedded + // NULs and don't have to be NUL-terminated. + // + // inLen is the length of the buffer including trailing NUL if any: if the + // last 4 bytes of the buffer are all NULs, these functions are more + // efficient as they avoid copying the string, but otherwise a copy is made + // internally which could be quite bad for (very) long strings. + // + // outLen receives, if not NULL, the length of the converted string or 0 if + // the conversion failed (returning 0 and not -1 in this case makes it + // difficult to distinguish between failed conversion and empty input but + // this is done for backwards compatibility) + const wxWCharBuffer + cMB2WC(const char *in, size_t inLen, size_t *outLen) const; + const wxCharBuffer + cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const; + + // convenience functions for converting MB or WC to/from wxWin default +#if wxUSE_UNICODE + const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } + const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); } + const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; } + const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; } +#else // ANSI + const char* cMB2WX(const char *psz) const { return psz; } + const char* cWX2MB(const char *psz) const { return psz; } + const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); } + const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); } +#endif // Unicode/ANSI + + // this function is used in the implementation of cMB2WC() to distinguish + // between the following cases: + // + // a) var width encoding with strings terminated by a single NUL + // (usual multibyte encodings): return 1 in this case + // b) fixed width encoding with 2 bytes/char and so terminated by + // 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case + // c) fixed width encoding with 4 bytes/char and so terminated by + // 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case + // + // anything else is not supported currently and -1 should be returned + virtual size_t GetMBNulLen() const { return 1; } + + // return the maximal value currently returned by GetMBNulLen() for any + // encoding + static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; } + + + // The old conversion functions. The existing classes currently mostly + // implement these ones but we're in transition to using To/FromWChar() + // instead and any new classes should implement just the new functions. + // For now, however, we provide default implementation of To/FromWChar() in + // this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all + // the conversions at once. + // + // On success, the return value is the length (i.e. the number of + // characters, not bytes) not counting the trailing NUL(s) of the converted + // string. On failure, (size_t)-1 is returned. In the special case when + // outputBuf is NULL the return value is the same one but nothing is + // written to the buffer. + // + // Note that outLen is the length of the output buffer, not the length of + // the input (which is always supposed to be terminated by one or more + // NULs, as appropriate for the encoding)! + virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const; + virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const; + + + // make a heap-allocated copy of this object + virtual wxMBConv *Clone() const = 0; + + // virtual dtor for any base class + virtual ~wxMBConv(); +}; + +// ---------------------------------------------------------------------------- +// wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for +// conversion (hence it depends on the current locale) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv +{ +public: + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; + + virtual wxMBConv *Clone() const { return new wxMBConvLibc; } +}; + +#ifdef __UNIX__ + +// ---------------------------------------------------------------------------- +// wxConvBrokenFileNames is made for Unix in Unicode mode when +// files are accidentally written in an encoding which is not +// the system encoding. Typically, the system encoding will be +// UTF8 but there might be files stored in ISO8859-1 on disk. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv +{ +public: + wxConvBrokenFileNames(const wxChar *charset); + wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) + : wxMBConv(), + m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) + { + } + virtual ~wxConvBrokenFileNames() { delete m_conv; } + + virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const + { + return m_conv->MB2WC(out, in, outLen); + } + + virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const + { + return m_conv->WC2MB(out, in, outLen); + } + + virtual size_t GetMBNulLen() const + { + // cast needed to call a private function + return m_conv->GetMBNulLen(); + } + + virtual wxMBConv *Clone() const { return new wxConvBrokenFileNames(*this); } + +private: + // the conversion object we forward to + wxMBConv *m_conv; + + DECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames) +}; + +#endif // __UNIX__ + +// ---------------------------------------------------------------------------- +// wxMBConvUTF7 (for conversion using UTF7 encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv +{ +public: + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; + + virtual wxMBConv *Clone() const { return new wxMBConvUTF7; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF8 (for conversion using UTF8 encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConv +{ +public: + enum + { + MAP_INVALID_UTF8_NOT = 0, + MAP_INVALID_UTF8_TO_PUA = 1, + MAP_INVALID_UTF8_TO_OCTAL = 2 + }; + + wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; + + virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); } + +private: + int m_options; +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF16Base: for both LE and BE variants +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv +{ +public: + enum { BYTES_PER_CHAR = 2 }; + + virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } + +protected: + // return the length of the buffer using srcLen if it's not wxNO_LEN and + // computing the length ourselves if it is; also checks that the length is + // even if specified as we need an entire number of UTF-16 characters and + // returns wxNO_LEN which indicates error if it is odd + static size_t GetLength(const char *src, size_t srcLen); +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual wxMBConv *Clone() const { return new wxMBConvUTF16LE; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual wxMBConv *Clone() const { return new wxMBConvUTF16BE; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF32Base: base class for both LE and BE variants +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv +{ +public: + enum { BYTES_PER_CHAR = 4 }; + + virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } + +protected: + // this is similar to wxMBConvUTF16Base method with the same name except + // that, of course, it verifies that length is divisible by 4 if given and + // not by 2 + static size_t GetLength(const char *src, size_t srcLen); +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual wxMBConv *Clone() const { return new wxMBConvUTF32LE; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual wxMBConv *Clone() const { return new wxMBConvUTF32BE; } +}; + +// ---------------------------------------------------------------------------- +// wxCSConv (for conversion based on loadable char sets) +// ---------------------------------------------------------------------------- + +#include "wx/fontenc.h" + +class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv +{ +public: + // we can be created either from charset name or from an encoding constant + // but we can't have both at once + wxCSConv(const wxChar *charset); + wxCSConv(wxFontEncoding encoding); + + wxCSConv(const wxCSConv& conv); + virtual ~wxCSConv(); + + wxCSConv& operator=(const wxCSConv& conv); + + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; + virtual size_t GetMBNulLen() const; + + virtual wxMBConv *Clone() const { return new wxCSConv(*this); } + + void Clear(); + +#if wxABI_VERSION >= 20802 + // return true if the conversion could be initilized successfully + bool IsOk() const; +#endif // wx 2.8.2+ + +private: + // common part of all ctors + void Init(); + + // creates m_convReal if necessary + void CreateConvIfNeeded() const; + + // do create m_convReal (unconditionally) + wxMBConv *DoCreate() const; + + // set the name (may be only called when m_name == NULL), makes copy of + // charset string + void SetName(const wxChar *charset); + + + // note that we can't use wxString here because of compilation + // dependencies: we're included from wx/string.h + wxChar *m_name; + wxFontEncoding m_encoding; + + // use CreateConvIfNeeded() before accessing m_convReal! + wxMBConv *m_convReal; + bool m_deferred; +}; + + +// ---------------------------------------------------------------------------- +// declare predefined conversion objects +// ---------------------------------------------------------------------------- + +// conversion to be used with all standard functions affected by locale, e.g. +// strtol(), strftime(), ... +extern WXDLLIMPEXP_DATA_BASE(wxMBConv&) wxConvLibc; + +// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t +extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvISO8859_1; +extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7&) wxConvUTF7; +extern WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8&) wxConvUTF8; + +// conversion used for the file names on the systems where they're not Unicode +// (basically anything except Windows) +// +// this is used by all file functions, can be changed by the application +// +// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used +// under Windows normally) +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName; + +// backwards compatible define +#define wxConvFile (*wxConvFileName) + +// the current conversion object, may be set to any conversion, is used by +// default in a couple of places inside wx (initially same as wxConvLibc) +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; + +// the conversion corresponding to the current locale +extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvLocal; + +// the conversion corresponding to the encoding of the standard UI elements +// +// by default this is the same as wxConvLocal but may be changed if the program +// needs to use a fixed encoding +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; + +// ---------------------------------------------------------------------------- +// endianness-dependent conversions +// ---------------------------------------------------------------------------- + +#ifdef WORDS_BIGENDIAN + typedef wxMBConvUTF16BE wxMBConvUTF16; + typedef wxMBConvUTF32BE wxMBConvUTF32; +#else + typedef wxMBConvUTF16LE wxMBConvUTF16; + typedef wxMBConvUTF32LE wxMBConvUTF32; +#endif + +// ---------------------------------------------------------------------------- +// filename conversion macros +// ---------------------------------------------------------------------------- + +// filenames are multibyte on Unix and widechar on Windows +#if defined(__UNIX__) || defined(__WXMAC__) + #define wxMBFILES 1 +#else + #define wxMBFILES 0 +#endif + +#if wxMBFILES && wxUSE_UNICODE + #define wxFNCONV(name) wxConvFileName->cWX2MB(name) + #define wxFNSTRINGCAST wxMBSTRINGCAST +#else +#if defined( __WXOSX__ ) && wxMBFILES + #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) +#else + #define wxFNCONV(name) name +#endif + #define wxFNSTRINGCAST WXSTRINGCAST +#endif + +#else // !wxUSE_WCHAR_T + +// ---------------------------------------------------------------------------- +// stand-ins in absence of wchar_t +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConv +{ +public: + const char* cMB2WX(const char *psz) const { return psz; } + const char* cWX2MB(const char *psz) const { return psz; } + wxMBConv *Clone() const { return NULL; } +}; + +#define wxConvFile wxConvLocal +#define wxConvUI wxConvCurrent + +typedef wxMBConv wxCSConv; + +extern WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc, + wxConvLocal, + wxConvISO8859_1, + wxConvUTF8; +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; + +#define wxFNCONV(name) name +#define wxFNSTRINGCAST WXSTRINGCAST + +#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T + +// ---------------------------------------------------------------------------- +// macros for the most common conversions +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE + #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s) + #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s) + +#if wxABI_VERSION >= 20802 + // these functions should be used when the conversions really, really have + // to succeed (usually because we pass their results to a standard C + // function which would crash if we passed NULL to it), so these functions + // always return a valid pointer if their argument is non-NULL + + // this function safety is achieved by trying wxConvLibc first, wxConvUTF8 + // next if it fails and, finally, wxConvISO8859_1 which always succeeds + extern WXDLLIMPEXP_BASE wxWCharBuffer wxSafeConvertMB2WX(const char *s); + + // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL) + // if it fails + extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws); +#endif // wxABI 2.8.2+ +#else // ANSI + // no conversions to do + #define wxConvertWX2MB(s) (s) + #define wxConvertMB2WX(s) (s) + #define wxSafeConvertMB2WX(s) (s) + #define wxSafeConvertWX2MB(s) (s) +#endif // Unicode/ANSI + +#endif // _WX_STRCONV_H_ + diff --git a/Externals/wxWidgets/include/wx/stream.h b/Externals/wxWidgets/include/wx/stream.h index bea273189b..e61bc70cd8 100644 --- a/Externals/wxWidgets/include/wx/stream.h +++ b/Externals/wxWidgets/include/wx/stream.h @@ -1,609 +1,609 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/stream.h -// Purpose: stream classes -// Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: stream.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXSTREAM_H__ -#define _WX_WXSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include <stdio.h> -#include "wx/object.h" -#include "wx/string.h" -#include "wx/filefn.h" // for wxFileOffset, wxInvalidOffset and wxSeekMode - -class WXDLLIMPEXP_FWD_BASE wxStreamBase; -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_BASE wxOutputStream; - -typedef wxInputStream& (*__wxInputManip)(wxInputStream&); -typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&); - -WXDLLIMPEXP_BASE wxOutputStream& wxEndL(wxOutputStream& o_stream); - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum wxStreamError -{ - wxSTREAM_NO_ERROR = 0, // stream is in good state - wxSTREAM_EOF, // EOF reached in Read() or similar - wxSTREAM_WRITE_ERROR, // generic write error - wxSTREAM_READ_ERROR // generic read error -}; - -const int wxEOF = -1; - -// ============================================================================ -// base stream classes: wxInputStream and wxOutputStream -// ============================================================================ - -// --------------------------------------------------------------------------- -// wxStreamBase: common (but non virtual!) base for all stream classes -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStreamBase -{ -public: - wxStreamBase(); - virtual ~wxStreamBase(); - - // error testing - wxStreamError GetLastError() const { return m_lasterror; } - virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; } - bool operator!() const { return !IsOk(); } - - // reset the stream state - void Reset() { m_lasterror = wxSTREAM_NO_ERROR; } - - // this doesn't make sense for all streams, always test its return value - virtual size_t GetSize() const; - virtual wxFileOffset GetLength() const { return wxInvalidOffset; } - - // returns true if the streams supports seeking to arbitrary offsets - virtual bool IsSeekable() const { return false; } - -protected: - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - size_t m_lastcount; - wxStreamError m_lasterror; - - friend class wxStreamBuffer; - - DECLARE_NO_COPY_CLASS(wxStreamBase) -}; - -// ---------------------------------------------------------------------------- -// wxInputStream: base class for the input streams -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxInputStream : public wxStreamBase -{ -public: - // ctor and dtor, nothing exciting - wxInputStream(); - virtual ~wxInputStream(); - - - // IO functions - // ------------ - - // return a character from the stream without removing it, i.e. it will - // still be returned by the next call to GetC() - // - // blocks until something appears in the stream if necessary, if nothing - // ever does (i.e. EOF) LastRead() will return 0 (and the return value is - // undefined), otherwise 1 - virtual char Peek(); - - // return one byte from the stream, blocking until it appears if - // necessary - // - // on success returns a value between 0 - 255, or wxEOF on EOF or error. - int GetC(); - - // read at most the given number of bytes from the stream - // - // there are 2 possible situations here: either there is nothing at all in - // the stream right now in which case Read() blocks until something appears - // (use CanRead() to avoid this) or there is already some data available in - // the stream and then Read() doesn't block but returns just the data it - // can read without waiting for more - // - // in any case, if there are not enough bytes in the stream right now, - // LastRead() value will be less than size but greater than 0. If it is 0, - // it means that EOF has been reached. - virtual wxInputStream& Read(void *buffer, size_t size); - - // copy the entire contents of this stream into streamOut, stopping only - // when EOF is reached or an error occurs - wxInputStream& Read(wxOutputStream& streamOut); - - - // status functions - // ---------------- - - // returns the number of bytes read by the last call to Read(), GetC() or - // Peek() - // - // this should be used to discover whether that call succeeded in reading - // all the requested data or not - virtual size_t LastRead() const { return wxStreamBase::m_lastcount; } - - // returns true if some data is available in the stream right now, so that - // calling Read() wouldn't block - virtual bool CanRead() const; - - // is the stream at EOF? - // - // note that this cannot be really implemented for all streams and - // CanRead() is more reliable than Eof() - virtual bool Eof() const; - - - // write back buffer - // ----------------- - - // put back the specified number of bytes into the stream, they will be - // fetched by the next call to the read functions - // - // returns the number of bytes really stuffed back - size_t Ungetch(const void *buffer, size_t size); - - // put back the specified character in the stream - // - // returns true if ok, false on error - bool Ungetch(char c); - - - // position functions - // ------------------ - - // move the stream pointer to the given position (if the stream supports - // it) - // - // returns wxInvalidOffset on error - virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); - - // return the current position of the stream pointer or wxInvalidOffset - virtual wxFileOffset TellI() const; - - - // stream-like operators - // --------------------- - - wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } - wxInputStream& operator>>(__wxInputManip func) { return func(*this); } - -protected: - // do read up to size bytes of data into the provided buffer - // - // this method should return 0 if EOF has been reached or an error occurred - // (m_lasterror should be set accordingly as well) or the number of bytes - // read - virtual size_t OnSysRead(void *buffer, size_t size) = 0; - - // write-back buffer support - // ------------------------- - - // return the pointer to a buffer big enough to hold sizeNeeded bytes - char *AllocSpaceWBack(size_t sizeNeeded); - - // read up to size data from the write back buffer, return the number of - // bytes read - size_t GetWBack(void *buf, size_t size); - - // write back buffer or NULL if none - char *m_wback; - - // the size of the buffer - size_t m_wbacksize; - - // the current position in the buffer - size_t m_wbackcur; - - friend class wxStreamBuffer; - - DECLARE_NO_COPY_CLASS(wxInputStream) -}; - -// ---------------------------------------------------------------------------- -// wxOutputStream: base for the output streams -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxOutputStream : public wxStreamBase -{ -public: - wxOutputStream(); - virtual ~wxOutputStream(); - - void PutC(char c); - virtual wxOutputStream& Write(const void *buffer, size_t size); - wxOutputStream& Write(wxInputStream& stream_in); - - virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); - virtual wxFileOffset TellO() const; - - virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; } - - virtual void Sync(); - virtual bool Close() { return true; } - - wxOutputStream& operator<<(wxInputStream& out) { return Write(out); } - wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } - -protected: - // to be implemented in the derived classes (it should have been pure - // virtual) - virtual size_t OnSysWrite(const void *buffer, size_t bufsize); - - friend class wxStreamBuffer; - - DECLARE_NO_COPY_CLASS(wxOutputStream) -}; - -// ============================================================================ -// helper stream classes -// ============================================================================ - -// --------------------------------------------------------------------------- -// A stream for measuring streamed output -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream -{ -public: - wxCountingOutputStream(); - - wxFileOffset GetLength() const; - bool Ok() const { return IsOk(); } - bool IsOk() const { return true; } - -protected: - virtual size_t OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - size_t m_currentPos; - - DECLARE_NO_COPY_CLASS(wxCountingOutputStream) -}; - -// --------------------------------------------------------------------------- -// "Filter" streams -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFilterInputStream : public wxInputStream -{ -public: - wxFilterInputStream(); - wxFilterInputStream(wxInputStream& stream); - wxFilterInputStream(wxInputStream *stream); - virtual ~wxFilterInputStream(); - - char Peek() { return m_parent_i_stream->Peek(); } - - wxFileOffset GetLength() const { return m_parent_i_stream->GetLength(); } - - wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; } - -protected: - wxInputStream *m_parent_i_stream; - bool m_owns; - - DECLARE_NO_COPY_CLASS(wxFilterInputStream) -}; - -class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream -{ -public: - wxFilterOutputStream(); - wxFilterOutputStream(wxOutputStream& stream); - wxFilterOutputStream(wxOutputStream *stream); - virtual ~wxFilterOutputStream(); - - wxFileOffset GetLength() const { return m_parent_o_stream->GetLength(); } - - wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; } - - bool Close(); - -protected: - wxOutputStream *m_parent_o_stream; - bool m_owns; - - DECLARE_NO_COPY_CLASS(wxFilterOutputStream) -}; - -enum wxStreamProtocolType -{ - wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one) - wxSTREAM_MIMETYPE, // MIME types the stream handles - wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles - wxSTREAM_FILEEXT // File extensions the stream handles -}; - -void WXDLLIMPEXP_BASE wxUseFilterClasses(); - -class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject -{ -public: - virtual ~wxFilterClassFactoryBase() { } - - wxString GetProtocol() const { return wxString(*GetProtocols()); } - wxString PopExtension(const wxString& location) const; - - virtual const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const = 0; - - bool CanHandle(const wxChar *protocol, - wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -protected: - wxString::size_type FindExtension(const wxChar *location) const; - - DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase) -}; - -class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase -{ -public: - virtual ~wxFilterClassFactory() { } - - virtual wxFilterInputStream *NewStream(wxInputStream& stream) const = 0; - virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0; - virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0; - virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0; - - static const wxFilterClassFactory *Find(const wxChar *protocol, - wxStreamProtocolType type - = wxSTREAM_PROTOCOL); - - static const wxFilterClassFactory *GetFirst(); - const wxFilterClassFactory *GetNext() const { return m_next; } - - void PushFront() { Remove(); m_next = sm_first; sm_first = this; } - void Remove(); - -protected: - wxFilterClassFactory() : m_next(this) { } - - wxFilterClassFactory& operator=(const wxFilterClassFactory&) - { return *this; } - -private: - static wxFilterClassFactory *sm_first; - wxFilterClassFactory *m_next; - - DECLARE_ABSTRACT_CLASS(wxFilterClassFactory) -}; - -// ============================================================================ -// buffered streams -// ============================================================================ - -// --------------------------------------------------------------------------- -// Stream buffer: this class can be derived from and passed to -// wxBufferedStreams to implement custom buffering -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStreamBuffer -{ -public: - enum BufMode - { - read, - write, - read_write - }; - - wxStreamBuffer(wxStreamBase& stream, BufMode mode); - wxStreamBuffer(const wxStreamBuffer& buf); - virtual ~wxStreamBuffer(); - - // Filtered IO - virtual size_t Read(void *buffer, size_t size); - size_t Read(wxStreamBuffer *buf); - virtual size_t Write(const void *buffer, size_t size); - size_t Write(wxStreamBuffer *buf); - - virtual char Peek(); - virtual char GetChar(); - virtual void PutChar(char c); - virtual wxFileOffset Tell() const; - virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode); - - // Buffer control - void ResetBuffer(); - - // NB: the buffer must always be allocated with malloc() if takeOwn is - // true as it will be deallocated by free() - void SetBufferIO(void *start, void *end, bool takeOwnership = false); - void SetBufferIO(void *start, size_t len, bool takeOwnership = false); - void SetBufferIO(size_t bufsize); - void *GetBufferStart() const { return m_buffer_start; } - void *GetBufferEnd() const { return m_buffer_end; } - void *GetBufferPos() const { return m_buffer_pos; } - size_t GetBufferSize() const { return m_buffer_size; } - size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; } - void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; } - size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; } - size_t GetBytesLeft() const { return m_buffer_end - m_buffer_pos; } - - void Fixed(bool fixed) { m_fixed = fixed; } - void Flushable(bool f) { m_flushable = f; } - - bool FlushBuffer(); - bool FillBuffer(); - size_t GetDataLeft(); - - // misc accessors - wxStreamBase *GetStream() const { return m_stream; } - bool HasBuffer() const { return m_buffer_size != 0; } - - bool IsFixed() const { return m_fixed; } - bool IsFlushable() const { return m_flushable; } - - // only for input/output buffers respectively, returns NULL otherwise - wxInputStream *GetInputStream() const; - wxOutputStream *GetOutputStream() const; - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBase *Stream() ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // this constructs a dummy wxStreamBuffer, used by (and exists for) - // wxMemoryStreams only, don't use! - wxStreamBuffer(BufMode mode); - -protected: - void GetFromBuffer(void *buffer, size_t size); - void PutToBuffer(const void *buffer, size_t size); - - // set the last error to the specified value if we didn't have it before - void SetError(wxStreamError err); - - // common part of several ctors - void Init(); - - // init buffer variables to be empty - void InitBuffer(); - - // free the buffer (always safe to call) - void FreeBuffer(); - - // the buffer itself: the pointers to its start and end and the current - // position in the buffer - char *m_buffer_start, - *m_buffer_end, - *m_buffer_pos; - - // the buffer size - // FIXME: isn't it the same as m_buffer_end - m_buffer_start? (VZ) - size_t m_buffer_size; - - // the stream we're associated with - wxStreamBase *m_stream; - - // its mode - BufMode m_mode; - - // flags - bool m_destroybuf, // deallocate buffer? - m_fixed, - m_flushable; - -private: -// Cannot use -// DECLARE_NO_COPY_CLASS(wxStreamBuffer) -// because copy constructor is explicitly declared above; -// but no copy assignment operator is defined, so declare -// it private to prevent the compiler from defining it: - wxStreamBuffer& operator=(const wxStreamBuffer&); -}; - -// --------------------------------------------------------------------------- -// wxBufferedInputStream -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream -{ -public: - // if a non NULL buffer is given to the stream, it will be deleted by it - wxBufferedInputStream(wxInputStream& stream, - wxStreamBuffer *buffer = NULL); - virtual ~wxBufferedInputStream(); - - char Peek(); - wxInputStream& Read(void *buffer, size_t size); - - // Position functions - wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); - wxFileOffset TellI() const; - bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } - - // the buffer given to the stream will be deleted by it - void SetInputStreamBuffer(wxStreamBuffer *buffer); - wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - virtual size_t OnSysRead(void *buffer, size_t bufsize); - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - wxStreamBuffer *m_i_streambuf; - - DECLARE_NO_COPY_CLASS(wxBufferedInputStream) -}; - -// ---------------------------------------------------------------------------- -// wxBufferedOutputStream -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream -{ -public: - // if a non NULL buffer is given to the stream, it will be deleted by it - wxBufferedOutputStream(wxOutputStream& stream, - wxStreamBuffer *buffer = NULL); - virtual ~wxBufferedOutputStream(); - - wxOutputStream& Write(const void *buffer, size_t size); - - // Position functions - wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); - wxFileOffset TellO() const; - bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } - - void Sync(); - bool Close(); - - wxFileOffset GetLength() const; - - // the buffer given to the stream will be deleted by it - void SetOutputStreamBuffer(wxStreamBuffer *buffer); - wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - virtual size_t OnSysWrite(const void *buffer, size_t bufsize); - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - - wxStreamBuffer *m_o_streambuf; - - DECLARE_NO_COPY_CLASS(wxBufferedOutputStream) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline wxStreamBase *wxStreamBuffer::Stream() { return m_stream; } - inline wxStreamBuffer *wxBufferedInputStream::InputStreamBuffer() const { return m_i_streambuf; } - inline wxStreamBuffer *wxBufferedOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } -#endif // WXWIN_COMPATIBILITY_2_6 - -#endif // wxUSE_STREAMS - -#endif // _WX_WXSTREAM_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stream.h +// Purpose: stream classes +// Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin +// Modified by: +// Created: 11/07/98 +// RCS-ID: $Id: stream.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXSTREAM_H__ +#define _WX_WXSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include <stdio.h> +#include "wx/object.h" +#include "wx/string.h" +#include "wx/filefn.h" // for wxFileOffset, wxInvalidOffset and wxSeekMode + +class WXDLLIMPEXP_FWD_BASE wxStreamBase; +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_BASE wxOutputStream; + +typedef wxInputStream& (*__wxInputManip)(wxInputStream&); +typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&); + +WXDLLIMPEXP_BASE wxOutputStream& wxEndL(wxOutputStream& o_stream); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxStreamError +{ + wxSTREAM_NO_ERROR = 0, // stream is in good state + wxSTREAM_EOF, // EOF reached in Read() or similar + wxSTREAM_WRITE_ERROR, // generic write error + wxSTREAM_READ_ERROR // generic read error +}; + +const int wxEOF = -1; + +// ============================================================================ +// base stream classes: wxInputStream and wxOutputStream +// ============================================================================ + +// --------------------------------------------------------------------------- +// wxStreamBase: common (but non virtual!) base for all stream classes +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStreamBase +{ +public: + wxStreamBase(); + virtual ~wxStreamBase(); + + // error testing + wxStreamError GetLastError() const { return m_lasterror; } + virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; } + bool operator!() const { return !IsOk(); } + + // reset the stream state + void Reset() { m_lasterror = wxSTREAM_NO_ERROR; } + + // this doesn't make sense for all streams, always test its return value + virtual size_t GetSize() const; + virtual wxFileOffset GetLength() const { return wxInvalidOffset; } + + // returns true if the streams supports seeking to arbitrary offsets + virtual bool IsSeekable() const { return false; } + +protected: + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); + virtual wxFileOffset OnSysTell() const; + + size_t m_lastcount; + wxStreamError m_lasterror; + + friend class wxStreamBuffer; + + DECLARE_NO_COPY_CLASS(wxStreamBase) +}; + +// ---------------------------------------------------------------------------- +// wxInputStream: base class for the input streams +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxInputStream : public wxStreamBase +{ +public: + // ctor and dtor, nothing exciting + wxInputStream(); + virtual ~wxInputStream(); + + + // IO functions + // ------------ + + // return a character from the stream without removing it, i.e. it will + // still be returned by the next call to GetC() + // + // blocks until something appears in the stream if necessary, if nothing + // ever does (i.e. EOF) LastRead() will return 0 (and the return value is + // undefined), otherwise 1 + virtual char Peek(); + + // return one byte from the stream, blocking until it appears if + // necessary + // + // on success returns a value between 0 - 255, or wxEOF on EOF or error. + int GetC(); + + // read at most the given number of bytes from the stream + // + // there are 2 possible situations here: either there is nothing at all in + // the stream right now in which case Read() blocks until something appears + // (use CanRead() to avoid this) or there is already some data available in + // the stream and then Read() doesn't block but returns just the data it + // can read without waiting for more + // + // in any case, if there are not enough bytes in the stream right now, + // LastRead() value will be less than size but greater than 0. If it is 0, + // it means that EOF has been reached. + virtual wxInputStream& Read(void *buffer, size_t size); + + // copy the entire contents of this stream into streamOut, stopping only + // when EOF is reached or an error occurs + wxInputStream& Read(wxOutputStream& streamOut); + + + // status functions + // ---------------- + + // returns the number of bytes read by the last call to Read(), GetC() or + // Peek() + // + // this should be used to discover whether that call succeeded in reading + // all the requested data or not + virtual size_t LastRead() const { return wxStreamBase::m_lastcount; } + + // returns true if some data is available in the stream right now, so that + // calling Read() wouldn't block + virtual bool CanRead() const; + + // is the stream at EOF? + // + // note that this cannot be really implemented for all streams and + // CanRead() is more reliable than Eof() + virtual bool Eof() const; + + + // write back buffer + // ----------------- + + // put back the specified number of bytes into the stream, they will be + // fetched by the next call to the read functions + // + // returns the number of bytes really stuffed back + size_t Ungetch(const void *buffer, size_t size); + + // put back the specified character in the stream + // + // returns true if ok, false on error + bool Ungetch(char c); + + + // position functions + // ------------------ + + // move the stream pointer to the given position (if the stream supports + // it) + // + // returns wxInvalidOffset on error + virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); + + // return the current position of the stream pointer or wxInvalidOffset + virtual wxFileOffset TellI() const; + + + // stream-like operators + // --------------------- + + wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } + wxInputStream& operator>>(__wxInputManip func) { return func(*this); } + +protected: + // do read up to size bytes of data into the provided buffer + // + // this method should return 0 if EOF has been reached or an error occurred + // (m_lasterror should be set accordingly as well) or the number of bytes + // read + virtual size_t OnSysRead(void *buffer, size_t size) = 0; + + // write-back buffer support + // ------------------------- + + // return the pointer to a buffer big enough to hold sizeNeeded bytes + char *AllocSpaceWBack(size_t sizeNeeded); + + // read up to size data from the write back buffer, return the number of + // bytes read + size_t GetWBack(void *buf, size_t size); + + // write back buffer or NULL if none + char *m_wback; + + // the size of the buffer + size_t m_wbacksize; + + // the current position in the buffer + size_t m_wbackcur; + + friend class wxStreamBuffer; + + DECLARE_NO_COPY_CLASS(wxInputStream) +}; + +// ---------------------------------------------------------------------------- +// wxOutputStream: base for the output streams +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxOutputStream : public wxStreamBase +{ +public: + wxOutputStream(); + virtual ~wxOutputStream(); + + void PutC(char c); + virtual wxOutputStream& Write(const void *buffer, size_t size); + wxOutputStream& Write(wxInputStream& stream_in); + + virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); + virtual wxFileOffset TellO() const; + + virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; } + + virtual void Sync(); + virtual bool Close() { return true; } + + wxOutputStream& operator<<(wxInputStream& out) { return Write(out); } + wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } + +protected: + // to be implemented in the derived classes (it should have been pure + // virtual) + virtual size_t OnSysWrite(const void *buffer, size_t bufsize); + + friend class wxStreamBuffer; + + DECLARE_NO_COPY_CLASS(wxOutputStream) +}; + +// ============================================================================ +// helper stream classes +// ============================================================================ + +// --------------------------------------------------------------------------- +// A stream for measuring streamed output +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream +{ +public: + wxCountingOutputStream(); + + wxFileOffset GetLength() const; + bool Ok() const { return IsOk(); } + bool IsOk() const { return true; } + +protected: + virtual size_t OnSysWrite(const void *buffer, size_t size); + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + virtual wxFileOffset OnSysTell() const; + + size_t m_currentPos; + + DECLARE_NO_COPY_CLASS(wxCountingOutputStream) +}; + +// --------------------------------------------------------------------------- +// "Filter" streams +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFilterInputStream : public wxInputStream +{ +public: + wxFilterInputStream(); + wxFilterInputStream(wxInputStream& stream); + wxFilterInputStream(wxInputStream *stream); + virtual ~wxFilterInputStream(); + + char Peek() { return m_parent_i_stream->Peek(); } + + wxFileOffset GetLength() const { return m_parent_i_stream->GetLength(); } + + wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; } + +protected: + wxInputStream *m_parent_i_stream; + bool m_owns; + + DECLARE_NO_COPY_CLASS(wxFilterInputStream) +}; + +class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream +{ +public: + wxFilterOutputStream(); + wxFilterOutputStream(wxOutputStream& stream); + wxFilterOutputStream(wxOutputStream *stream); + virtual ~wxFilterOutputStream(); + + wxFileOffset GetLength() const { return m_parent_o_stream->GetLength(); } + + wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; } + + bool Close(); + +protected: + wxOutputStream *m_parent_o_stream; + bool m_owns; + + DECLARE_NO_COPY_CLASS(wxFilterOutputStream) +}; + +enum wxStreamProtocolType +{ + wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one) + wxSTREAM_MIMETYPE, // MIME types the stream handles + wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles + wxSTREAM_FILEEXT // File extensions the stream handles +}; + +void WXDLLIMPEXP_BASE wxUseFilterClasses(); + +class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject +{ +public: + virtual ~wxFilterClassFactoryBase() { } + + wxString GetProtocol() const { return wxString(*GetProtocols()); } + wxString PopExtension(const wxString& location) const; + + virtual const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const = 0; + + bool CanHandle(const wxChar *protocol, + wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const; + +protected: + wxString::size_type FindExtension(const wxChar *location) const; + + DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase) +}; + +class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase +{ +public: + virtual ~wxFilterClassFactory() { } + + virtual wxFilterInputStream *NewStream(wxInputStream& stream) const = 0; + virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0; + virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0; + virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0; + + static const wxFilterClassFactory *Find(const wxChar *protocol, + wxStreamProtocolType type + = wxSTREAM_PROTOCOL); + + static const wxFilterClassFactory *GetFirst(); + const wxFilterClassFactory *GetNext() const { return m_next; } + + void PushFront() { Remove(); m_next = sm_first; sm_first = this; } + void Remove(); + +protected: + wxFilterClassFactory() : m_next(this) { } + + wxFilterClassFactory& operator=(const wxFilterClassFactory&) + { return *this; } + +private: + static wxFilterClassFactory *sm_first; + wxFilterClassFactory *m_next; + + DECLARE_ABSTRACT_CLASS(wxFilterClassFactory) +}; + +// ============================================================================ +// buffered streams +// ============================================================================ + +// --------------------------------------------------------------------------- +// Stream buffer: this class can be derived from and passed to +// wxBufferedStreams to implement custom buffering +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStreamBuffer +{ +public: + enum BufMode + { + read, + write, + read_write + }; + + wxStreamBuffer(wxStreamBase& stream, BufMode mode); + wxStreamBuffer(const wxStreamBuffer& buf); + virtual ~wxStreamBuffer(); + + // Filtered IO + virtual size_t Read(void *buffer, size_t size); + size_t Read(wxStreamBuffer *buf); + virtual size_t Write(const void *buffer, size_t size); + size_t Write(wxStreamBuffer *buf); + + virtual char Peek(); + virtual char GetChar(); + virtual void PutChar(char c); + virtual wxFileOffset Tell() const; + virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode); + + // Buffer control + void ResetBuffer(); + + // NB: the buffer must always be allocated with malloc() if takeOwn is + // true as it will be deallocated by free() + void SetBufferIO(void *start, void *end, bool takeOwnership = false); + void SetBufferIO(void *start, size_t len, bool takeOwnership = false); + void SetBufferIO(size_t bufsize); + void *GetBufferStart() const { return m_buffer_start; } + void *GetBufferEnd() const { return m_buffer_end; } + void *GetBufferPos() const { return m_buffer_pos; } + size_t GetBufferSize() const { return m_buffer_size; } + size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; } + void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; } + size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; } + size_t GetBytesLeft() const { return m_buffer_end - m_buffer_pos; } + + void Fixed(bool fixed) { m_fixed = fixed; } + void Flushable(bool f) { m_flushable = f; } + + bool FlushBuffer(); + bool FillBuffer(); + size_t GetDataLeft(); + + // misc accessors + wxStreamBase *GetStream() const { return m_stream; } + bool HasBuffer() const { return m_buffer_size != 0; } + + bool IsFixed() const { return m_fixed; } + bool IsFlushable() const { return m_flushable; } + + // only for input/output buffers respectively, returns NULL otherwise + wxInputStream *GetInputStream() const; + wxOutputStream *GetOutputStream() const; + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, for compatibility only + wxDEPRECATED( wxStreamBase *Stream() ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // this constructs a dummy wxStreamBuffer, used by (and exists for) + // wxMemoryStreams only, don't use! + wxStreamBuffer(BufMode mode); + +protected: + void GetFromBuffer(void *buffer, size_t size); + void PutToBuffer(const void *buffer, size_t size); + + // set the last error to the specified value if we didn't have it before + void SetError(wxStreamError err); + + // common part of several ctors + void Init(); + + // init buffer variables to be empty + void InitBuffer(); + + // free the buffer (always safe to call) + void FreeBuffer(); + + // the buffer itself: the pointers to its start and end and the current + // position in the buffer + char *m_buffer_start, + *m_buffer_end, + *m_buffer_pos; + + // the buffer size + // FIXME: isn't it the same as m_buffer_end - m_buffer_start? (VZ) + size_t m_buffer_size; + + // the stream we're associated with + wxStreamBase *m_stream; + + // its mode + BufMode m_mode; + + // flags + bool m_destroybuf, // deallocate buffer? + m_fixed, + m_flushable; + +private: +// Cannot use +// DECLARE_NO_COPY_CLASS(wxStreamBuffer) +// because copy constructor is explicitly declared above; +// but no copy assignment operator is defined, so declare +// it private to prevent the compiler from defining it: + wxStreamBuffer& operator=(const wxStreamBuffer&); +}; + +// --------------------------------------------------------------------------- +// wxBufferedInputStream +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream +{ +public: + // if a non NULL buffer is given to the stream, it will be deleted by it + wxBufferedInputStream(wxInputStream& stream, + wxStreamBuffer *buffer = NULL); + virtual ~wxBufferedInputStream(); + + char Peek(); + wxInputStream& Read(void *buffer, size_t size); + + // Position functions + wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); + wxFileOffset TellI() const; + bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } + + // the buffer given to the stream will be deleted by it + void SetInputStreamBuffer(wxStreamBuffer *buffer); + wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, for compatibility only + wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + virtual size_t OnSysRead(void *buffer, size_t bufsize); + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); + virtual wxFileOffset OnSysTell() const; + + wxStreamBuffer *m_i_streambuf; + + DECLARE_NO_COPY_CLASS(wxBufferedInputStream) +}; + +// ---------------------------------------------------------------------------- +// wxBufferedOutputStream +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream +{ +public: + // if a non NULL buffer is given to the stream, it will be deleted by it + wxBufferedOutputStream(wxOutputStream& stream, + wxStreamBuffer *buffer = NULL); + virtual ~wxBufferedOutputStream(); + + wxOutputStream& Write(const void *buffer, size_t size); + + // Position functions + wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); + wxFileOffset TellO() const; + bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } + + void Sync(); + bool Close(); + + wxFileOffset GetLength() const; + + // the buffer given to the stream will be deleted by it + void SetOutputStreamBuffer(wxStreamBuffer *buffer); + wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated, for compatibility only + wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + virtual size_t OnSysWrite(const void *buffer, size_t bufsize); + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); + virtual wxFileOffset OnSysTell() const; + + wxStreamBuffer *m_o_streambuf; + + DECLARE_NO_COPY_CLASS(wxBufferedOutputStream) +}; + +#if WXWIN_COMPATIBILITY_2_6 + inline wxStreamBase *wxStreamBuffer::Stream() { return m_stream; } + inline wxStreamBuffer *wxBufferedInputStream::InputStreamBuffer() const { return m_i_streambuf; } + inline wxStreamBuffer *wxBufferedOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } +#endif // WXWIN_COMPATIBILITY_2_6 + +#endif // wxUSE_STREAMS + +#endif // _WX_WXSTREAM_H__ diff --git a/Externals/wxWidgets/include/wx/string.h b/Externals/wxWidgets/include/wx/string.h index 8ea435ee08..7a57f24a8c 100644 --- a/Externals/wxWidgets/include/wx/string.h +++ b/Externals/wxWidgets/include/wx/string.h @@ -1,1653 +1,1653 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/string.h -// Purpose: wxString and wxArrayString classes -// Author: Vadim Zeitlin -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: string.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - Efficient string class [more or less] compatible with MFC CString, - wxWidgets version 1 wxString and std::string and some handy functions - missing from string.h. -*/ - -#ifndef _WX_WXSTRINGH__ -#define _WX_WXSTRINGH__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" // everybody should include this - -#if defined(__WXMAC__) || defined(__VISAGECPP__) - #include <ctype.h> -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 - // problem in VACPP V4 with including stdlib.h multiple times - // strconv includes it anyway -# include <stdio.h> -# include <string.h> -# include <stdarg.h> -# include <limits.h> -#else -# include <string.h> -# include <stdio.h> -# include <stdarg.h> -# include <limits.h> -# include <stdlib.h> -#endif - -#ifdef HAVE_STRCASECMP_IN_STRINGS_H - #include <strings.h> // for strcasecmp() -#endif // HAVE_STRCASECMP_IN_STRINGS_H - -#ifdef __WXPALMOS__ - #include <StringMgr.h> -#endif - -#include "wx/wxchar.h" // for wxChar -#include "wx/buffer.h" // for wxCharBuffer -#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes - -class WXDLLIMPEXP_FWD_BASE wxString; - -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -// casts [unfortunately!] needed to call some broken functions which require -// "char *" instead of "const char *" -#define WXSTRINGCAST (wxChar *)(const wxChar *) -#define wxCSTRINGCAST (wxChar *)(const wxChar *) -#define wxMBSTRINGCAST (char *)(const char *) -#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *) - -// implementation only -#define wxASSERT_VALID_INDEX(i) \ - wxASSERT_MSG( (size_t)(i) <= length(), _T("invalid index in wxString") ) - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_6 - -// deprecated in favour of wxString::npos, don't use in new code -// -// maximum possible length for a string means "take all string" everywhere -#define wxSTRING_MAXLEN wxStringBase::npos - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -// global pointer to empty string -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; - -// --------------------------------------------------------------------------- -// global functions complementing standard C string library replacements for -// strlen() and portable strcasecmp() -//--------------------------------------------------------------------------- - -// Use wxXXX() functions from wxchar.h instead! These functions are for -// backwards compatibility only. - -// checks whether the passed in pointer is NULL and if the string is empty -inline bool IsEmpty(const char *p) { return (!p || !*p); } - -// safe version of strlen() (returns 0 if passed NULL pointer) -inline size_t Strlen(const char *psz) - { return psz ? strlen(psz) : 0; } - -// portable strcasecmp/_stricmp -inline int Stricmp(const char *psz1, const char *psz2) -{ -#if defined(__VISUALC__) && defined(__WXWINCE__) - register char c1, c2; - do { - c1 = tolower(*psz1++); - c2 = tolower(*psz2++); - } while ( c1 && (c1 == c2) ); - - return c1 - c2; -#elif defined(__VISUALC__) || ( defined(__MWERKS__) && defined(__INTEL__) ) - return _stricmp(psz1, psz2); -#elif defined(__SC__) - return _stricmp(psz1, psz2); -#elif defined(__SALFORDC__) - return stricmp(psz1, psz2); -#elif defined(__BORLANDC__) - return stricmp(psz1, psz2); -#elif defined(__WATCOMC__) - return stricmp(psz1, psz2); -#elif defined(__DJGPP__) - return stricmp(psz1, psz2); -#elif defined(__EMX__) - return stricmp(psz1, psz2); -#elif defined(__WXPM__) - return stricmp(psz1, psz2); -#elif defined(__WXPALMOS__) || \ - defined(HAVE_STRCASECMP_IN_STRING_H) || \ - defined(HAVE_STRCASECMP_IN_STRINGS_H) || \ - defined(__GNUWIN32__) - return strcasecmp(psz1, psz2); -#elif defined(__MWERKS__) && !defined(__INTEL__) - register char c1, c2; - do { - c1 = tolower(*psz1++); - c2 = tolower(*psz2++); - } while ( c1 && (c1 == c2) ); - - return c1 - c2; -#else - // almost all compilers/libraries provide this function (unfortunately under - // different names), that's why we don't implement our own which will surely - // be more efficient than this code (uncomment to use): - /* - register char c1, c2; - do { - c1 = tolower(*psz1++); - c2 = tolower(*psz2++); - } while ( c1 && (c1 == c2) ); - - return c1 - c2; - */ - - #error "Please define string case-insensitive compare for your OS/compiler" -#endif // OS/compiler -} - -// ---------------------------------------------------------------------------- -// deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING -// ---------------------------------------------------------------------------- - -// in both cases we need to define wxStdString -#if wxUSE_STL || wxUSE_STD_STRING - -#include "wx/beforestd.h" -#include <string> -#include "wx/afterstd.h" - -#if wxUSE_UNICODE - #ifdef HAVE_STD_WSTRING - typedef std::wstring wxStdString; - #else - typedef std::basic_string<wxChar> wxStdString; - #endif -#else - typedef std::string wxStdString; -#endif - -#endif // need <string> - -#if wxUSE_STL - - // we don't need an extra ctor from std::string when copy ctor already does - // the work - #undef wxUSE_STD_STRING - #define wxUSE_STD_STRING 0 - - #if (defined(__GNUG__) && (__GNUG__ < 3)) || \ - (defined(_MSC_VER) && (_MSC_VER <= 1200)) - #define wxSTRING_BASE_HASNT_CLEAR - #endif - - typedef wxStdString wxStringBase; -#else // if !wxUSE_STL - -#if !defined(HAVE_STD_STRING_COMPARE) && \ - (!defined(__WX_SETUP_H__) || wxUSE_STL == 0) - #define HAVE_STD_STRING_COMPARE -#endif - -// --------------------------------------------------------------------------- -// string data prepended with some housekeeping info (used by wxString class), -// is never used directly (but had to be put here to allow inlining) -// --------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxStringData -{ - int nRefs; // reference count - size_t nDataLength, // actual string length - nAllocLength; // allocated memory size - - // mimics declaration 'wxChar data[nAllocLength]' - wxChar* data() const { return (wxChar*)(this + 1); } - - // empty string has a special ref count so it's never deleted - bool IsEmpty() const { return (nRefs == -1); } - bool IsShared() const { return (nRefs > 1); } - - // lock/unlock - void Lock() { if ( !IsEmpty() ) nRefs++; } - - // VC++ will refuse to inline Unlock but profiling shows that it is wrong -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - __forceinline -#endif - // VC++ free must take place in same DLL as allocation when using non dll - // run-time library (e.g. Multithreaded instead of Multithreaded DLL) -#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) - void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } - // we must not inline deallocation since allocation is not inlined - void Free(); -#else - void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } -#endif - - // if we had taken control over string memory (GetWriteBuf), it's - // intentionally put in invalid state - void Validate(bool b) { nRefs = (b ? 1 : 0); } - bool IsValid() const { return (nRefs != 0); } -}; - -class WXDLLIMPEXP_BASE wxStringBase -{ -#if !wxUSE_STL -friend class WXDLLIMPEXP_FWD_BASE wxArrayString; -#endif -public : - // an 'invalid' value for string index, moved to this place due to a CW bug - static const size_t npos; -protected: - // points to data preceded by wxStringData structure with ref count info - wxChar *m_pchData; - - // accessor to string data - wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; } - - // string (re)initialization functions - // initializes the string to the empty value (must be called only from - // ctors, use Reinit() otherwise) - void Init() { m_pchData = (wxChar *)wxEmptyString; } - // initializes the string with (a part of) C-string - void InitWith(const wxChar *psz, size_t nPos = 0, size_t nLen = npos); - // as Init, but also frees old data - void Reinit() { GetStringData()->Unlock(); Init(); } - - // memory allocation - // allocates memory for string of length nLen - bool AllocBuffer(size_t nLen); - // copies data to another string - bool AllocCopy(wxString&, int, int) const; - // effectively copies data to string - bool AssignCopy(size_t, const wxChar *); - - // append a (sub)string - bool ConcatSelf(size_t nLen, const wxChar *src, size_t nMaxLen); - bool ConcatSelf(size_t nLen, const wxChar *src) - { return ConcatSelf(nLen, src, nLen); } - - // functions called before writing to the string: they copy it if there - // are other references to our data (should be the only owner when writing) - bool CopyBeforeWrite(); - bool AllocBeforeWrite(size_t); - - // compatibility with wxString - bool Alloc(size_t nLen); -public: - // standard types - typedef wxChar value_type; - typedef wxChar char_type; - typedef size_t size_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type *iterator; - typedef const value_type *const_iterator; - -#define wxSTRING_REVERSE_ITERATOR(name, const_or_not) \ - class name \ - { \ - public: \ - typedef wxChar value_type; \ - typedef const_or_not value_type& reference; \ - typedef const_or_not value_type *pointer; \ - typedef const_or_not value_type *iterator_type; \ - \ - name(iterator_type i) : m_cur(i) { } \ - name(const name& ri) : m_cur(ri.m_cur) { } \ - \ - iterator_type base() const { return m_cur; } \ - \ - reference operator*() const { return *(m_cur - 1); } \ - \ - name& operator++() { --m_cur; return *this; } \ - name operator++(int) { name tmp = *this; --m_cur; return tmp; } \ - name& operator--() { ++m_cur; return *this; } \ - name operator--(int) { name tmp = *this; ++m_cur; return tmp; } \ - \ - bool operator==(name ri) const { return m_cur == ri.m_cur; } \ - bool operator!=(name ri) const { return !(*this == ri); } \ - \ - private: \ - iterator_type m_cur; \ - } - - wxSTRING_REVERSE_ITERATOR(const_reverse_iterator, const); - - #define wxSTRING_CONST - wxSTRING_REVERSE_ITERATOR(reverse_iterator, wxSTRING_CONST); - #undef wxSTRING_CONST - - #undef wxSTRING_REVERSE_ITERATOR - - - // constructors and destructor - // ctor for an empty string - wxStringBase() { Init(); } - // copy ctor - wxStringBase(const wxStringBase& stringSrc) - { - wxASSERT_MSG( stringSrc.GetStringData()->IsValid(), - _T("did you forget to call UngetWriteBuf()?") ); - - if ( stringSrc.empty() ) { - // nothing to do for an empty string - Init(); - } - else { - m_pchData = stringSrc.m_pchData; // share same data - GetStringData()->Lock(); // => one more copy - } - } - // string containing nRepeat copies of ch - wxStringBase(size_type nRepeat, wxChar ch); - // ctor takes first nLength characters from C string - // (default value of npos means take all the string) - wxStringBase(const wxChar *psz) - { InitWith(psz, 0, npos); } - wxStringBase(const wxChar *psz, size_t nLength) - { InitWith(psz, 0, nLength); } - wxStringBase(const wxChar *psz, - const wxMBConv& WXUNUSED(conv), - size_t nLength = npos) - { InitWith(psz, 0, nLength); } - // take nLen chars starting at nPos - wxStringBase(const wxStringBase& str, size_t nPos, size_t nLen) - { - wxASSERT_MSG( str.GetStringData()->IsValid(), - _T("did you forget to call UngetWriteBuf()?") ); - Init(); - size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen; - InitWith(str.c_str(), nPos, nLen); - } - // take all characters from pStart to pEnd - wxStringBase(const void *pStart, const void *pEnd); - - // dtor is not virtual, this class must not be inherited from! - ~wxStringBase() - { -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - //RN - according to the above VC++ does indeed inline this, - //even though it spits out two warnings - #pragma warning (disable:4714) -#endif - - GetStringData()->Unlock(); - } - -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) - //re-enable inlining warning - #pragma warning (default:4714) -#endif - // overloaded assignment - // from another wxString - wxStringBase& operator=(const wxStringBase& stringSrc); - // from a character - wxStringBase& operator=(wxChar ch); - // from a C string - wxStringBase& operator=(const wxChar *psz); - - // return the length of the string - size_type length() const { return GetStringData()->nDataLength; } - // return the length of the string - size_type size() const { return length(); } - // return the maximum size of the string - size_type max_size() const { return npos; } - // resize the string, filling the space with c if c != 0 - void resize(size_t nSize, wxChar ch = wxT('\0')); - // delete the contents of the string - void clear() { erase(0, npos); } - // returns true if the string is empty - bool empty() const { return length() == 0; } - // inform string about planned change in size - void reserve(size_t sz) { Alloc(sz); } - size_type capacity() const { return GetStringData()->nAllocLength; } - - // lib.string.access - // return the character at position n - value_type at(size_type n) const - { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; } - // returns the writable character at position n - reference at(size_type n) - { wxASSERT_VALID_INDEX( n ); CopyBeforeWrite(); return m_pchData[n]; } - - // lib.string.modifiers - // append elements str[pos], ..., str[pos+n] - wxStringBase& append(const wxStringBase& str, size_t pos, size_t n) - { - wxASSERT(pos <= str.length()); - ConcatSelf(n, str.c_str() + pos, str.length() - pos); - return *this; - } - // append a string - wxStringBase& append(const wxStringBase& str) - { ConcatSelf(str.length(), str.c_str()); return *this; } - // append first n (or all if n == npos) characters of sz - wxStringBase& append(const wxChar *sz) - { ConcatSelf(wxStrlen(sz), sz); return *this; } - wxStringBase& append(const wxChar *sz, size_t n) - { ConcatSelf(n, sz); return *this; } - // append n copies of ch - wxStringBase& append(size_t n, wxChar ch); - // append from first to last - wxStringBase& append(const_iterator first, const_iterator last) - { ConcatSelf(last - first, first); return *this; } - - // same as `this_string = str' - wxStringBase& assign(const wxStringBase& str) - { return *this = str; } - // same as ` = str[pos..pos + n] - wxStringBase& assign(const wxStringBase& str, size_t pos, size_t n) - { clear(); return append(str, pos, n); } - // same as `= first n (or all if n == npos) characters of sz' - wxStringBase& assign(const wxChar *sz) - { clear(); return append(sz, wxStrlen(sz)); } - wxStringBase& assign(const wxChar *sz, size_t n) - { clear(); return append(sz, n); } - // same as `= n copies of ch' - wxStringBase& assign(size_t n, wxChar ch) - { clear(); return append(n, ch); } - // assign from first to last - wxStringBase& assign(const_iterator first, const_iterator last) - { clear(); return append(first, last); } - - // first valid index position - const_iterator begin() const { return m_pchData; } - iterator begin(); - // position one after the last valid one - const_iterator end() const { return m_pchData + length(); } - iterator end(); - - // first element of the reversed string - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rbegin() { return reverse_iterator(end()); } - // one beyond the end of the reversed string - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - - // insert another string - wxStringBase& insert(size_t nPos, const wxStringBase& str) - { - wxASSERT( str.GetStringData()->IsValid() ); - return insert(nPos, str.c_str(), str.length()); - } - // insert n chars of str starting at nStart (in str) - wxStringBase& insert(size_t nPos, const wxStringBase& str, size_t nStart, size_t n) - { - wxASSERT( str.GetStringData()->IsValid() ); - wxASSERT( nStart < str.length() ); - size_t strLen = str.length() - nStart; - n = strLen < n ? strLen : n; - return insert(nPos, str.c_str() + nStart, n); - } - // insert first n (or all if n == npos) characters of sz - wxStringBase& insert(size_t nPos, const wxChar *sz, size_t n = npos); - // insert n copies of ch - wxStringBase& insert(size_t nPos, size_t n, wxChar ch) - { return insert(nPos, wxStringBase(n, ch)); } - iterator insert(iterator it, wxChar ch) - { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; } - void insert(iterator it, const_iterator first, const_iterator last) - { insert(it - begin(), first, last - first); } - void insert(iterator it, size_type n, wxChar ch) - { insert(it - begin(), n, ch); } - - // delete characters from nStart to nStart + nLen - wxStringBase& erase(size_type pos = 0, size_type n = npos); - iterator erase(iterator first, iterator last) - { - size_t idx = first - begin(); - erase(idx, last - first); - return begin() + idx; - } - iterator erase(iterator first); - - // explicit conversion to C string (use this with printf()!) - const wxChar* c_str() const { return m_pchData; } - const wxChar* data() const { return m_pchData; } - - // replaces the substring of length nLen starting at nStart - wxStringBase& replace(size_t nStart, size_t nLen, const wxChar* sz); - // replaces the substring of length nLen starting at nStart - wxStringBase& replace(size_t nStart, size_t nLen, const wxStringBase& str) - { return replace(nStart, nLen, str.c_str()); } - // replaces the substring with nCount copies of ch - wxStringBase& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch); - // replaces a substring with another substring - wxStringBase& replace(size_t nStart, size_t nLen, - const wxStringBase& str, size_t nStart2, size_t nLen2); - // replaces the substring with first nCount chars of sz - wxStringBase& replace(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount); - wxStringBase& replace(iterator first, iterator last, const_pointer s) - { return replace(first - begin(), last - first, s); } - wxStringBase& replace(iterator first, iterator last, const_pointer s, - size_type n) - { return replace(first - begin(), last - first, s, n); } - wxStringBase& replace(iterator first, iterator last, const wxStringBase& s) - { return replace(first - begin(), last - first, s); } - wxStringBase& replace(iterator first, iterator last, size_type n, wxChar c) - { return replace(first - begin(), last - first, n, c); } - wxStringBase& replace(iterator first, iterator last, - const_iterator first1, const_iterator last1) - { return replace(first - begin(), last - first, first1, last1 - first1); } - - // swap two strings - void swap(wxStringBase& str); - - // All find() functions take the nStart argument which specifies the - // position to start the search on, the default value is 0. All functions - // return npos if there were no match. - - // find a substring - size_t find(const wxStringBase& str, size_t nStart = 0) const; - - // find first n characters of sz - size_t find(const wxChar* sz, size_t nStart = 0, size_t n = npos) const; - - // find the first occurence of character ch after nStart - size_t find(wxChar ch, size_t nStart = 0) const; - - // rfind() family is exactly like find() but works right to left - - // as find, but from the end - size_t rfind(const wxStringBase& str, size_t nStart = npos) const; - - // as find, but from the end - size_t rfind(const wxChar* sz, size_t nStart = npos, - size_t n = npos) const; - // as find, but from the end - size_t rfind(wxChar ch, size_t nStart = npos) const; - - // find first/last occurence of any character in the set - - // as strpbrk() but starts at nStart, returns npos if not found - size_t find_first_of(const wxStringBase& str, size_t nStart = 0) const - { return find_first_of(str.c_str(), nStart); } - // same as above - size_t find_first_of(const wxChar* sz, size_t nStart = 0) const; - size_t find_first_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as find(char, size_t) - size_t find_first_of(wxChar c, size_t nStart = 0) const - { return find(c, nStart); } - // find the last (starting from nStart) char from str in this string - size_t find_last_of (const wxStringBase& str, size_t nStart = npos) const - { return find_last_of(str.c_str(), nStart); } - // same as above - size_t find_last_of (const wxChar* sz, size_t nStart = npos) const; - size_t find_last_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as above - size_t find_last_of(wxChar c, size_t nStart = npos) const - { return rfind(c, nStart); } - - // find first/last occurence of any character not in the set - - // as strspn() (starting from nStart), returns npos on failure - size_t find_first_not_of(const wxStringBase& str, size_t nStart = 0) const - { return find_first_not_of(str.c_str(), nStart); } - // same as above - size_t find_first_not_of(const wxChar* sz, size_t nStart = 0) const; - size_t find_first_not_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as above - size_t find_first_not_of(wxChar ch, size_t nStart = 0) const; - // as strcspn() - size_t find_last_not_of(const wxStringBase& str, size_t nStart = npos) const - { return find_last_not_of(str.c_str(), nStart); } - // same as above - size_t find_last_not_of(const wxChar* sz, size_t nStart = npos) const; - size_t find_last_not_of(const wxChar* sz, size_t nStart, size_t n) const; - // same as above - size_t find_last_not_of(wxChar ch, size_t nStart = npos) const; - - // All compare functions return -1, 0 or 1 if the [sub]string is less, - // equal or greater than the compare() argument. - - // comparison with another string - int compare(const wxStringBase& str) const; - // comparison with a substring - int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; - // comparison of 2 substrings - int compare(size_t nStart, size_t nLen, - const wxStringBase& str, size_t nStart2, size_t nLen2) const; - // comparison with a c string - int compare(const wxChar* sz) const; - // substring comparison with first nCount characters of sz - int compare(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount = npos) const; - - size_type copy(wxChar* s, size_type n, size_type pos = 0); - - // substring extraction - wxStringBase substr(size_t nStart = 0, size_t nLen = npos) const; - - // string += string - wxStringBase& operator+=(const wxStringBase& s) { return append(s); } - // string += C string - wxStringBase& operator+=(const wxChar *psz) { return append(psz); } - // string += char - wxStringBase& operator+=(wxChar ch) { return append(1, ch); } -}; - -#endif // !wxUSE_STL - -// ---------------------------------------------------------------------------- -// wxString: string class trying to be compatible with std::string, MFC -// CString and wxWindows 1.x wxString all at once -// --------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxString : public wxStringBase -{ -#if !wxUSE_STL -friend class WXDLLIMPEXP_FWD_BASE wxArrayString; -#endif - - // NB: special care was taken in arranging the member functions in such order - // that all inline functions can be effectively inlined, verify that all - // performance critical functions are still inlined if you change order! -private: - // if we hadn't made these operators private, it would be possible to - // compile "wxString s; s = 17;" without any warnings as 17 is implicitly - // converted to char in C and we do have operator=(char) - // - // NB: we don't need other versions (short/long and unsigned) as attempt - // to assign another numeric type to wxString will now result in - // ambiguity between operator=(char) and operator=(int) - wxString& operator=(int); - - // these methods are not implemented - there is _no_ conversion from int to - // string, you're doing something wrong if the compiler wants to call it! - // - // try `s << i' or `s.Printf("%d", i)' instead - wxString(int); - -public: - // constructors and destructor - // ctor for an empty string - wxString() : wxStringBase() { } - // copy ctor - wxString(const wxStringBase& stringSrc) : wxStringBase(stringSrc) { } - wxString(const wxString& stringSrc) : wxStringBase(stringSrc) { } - // string containing nRepeat copies of ch - wxString(wxChar ch, size_t nRepeat = 1) - : wxStringBase(nRepeat, ch) { } - wxString(size_t nRepeat, wxChar ch) - : wxStringBase(nRepeat, ch) { } - // ctor takes first nLength characters from C string - // (default value of npos means take all the string) - wxString(const wxChar *psz) - : wxStringBase(psz ? psz : wxT("")) { } - wxString(const wxChar *psz, size_t nLength) - : wxStringBase(psz, nLength) { } - wxString(const wxChar *psz, - const wxMBConv& WXUNUSED(conv), - size_t nLength = npos) - : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { } - - // even if we're not built with wxUSE_STL == 1 it is very convenient to allow - // implicit conversions from std::string to wxString as this allows to use - // the same strings in non-GUI and GUI code, however we don't want to - // unconditionally add this ctor as it would make wx lib dependent on - // libstdc++ on some Linux versions which is bad, so instead we ask the - // client code to define this wxUSE_STD_STRING symbol if they need it -#if wxUSE_STD_STRING - wxString(const wxStdString& s) - : wxStringBase(s.c_str()) { } -#endif // wxUSE_STD_STRING - -#if wxUSE_UNICODE - // from multibyte string - wxString(const char *psz, const wxMBConv& conv, size_t nLength = npos); - // from wxWCharBuffer (i.e. return from wxGetString) - wxString(const wxWCharBuffer& psz) : wxStringBase(psz.data()) { } -#else // ANSI - // from C string (for compilers using unsigned char) - wxString(const unsigned char* psz) - : wxStringBase((const char*)psz) { } - // from part of C string (for compilers using unsigned char) - wxString(const unsigned char* psz, size_t nLength) - : wxStringBase((const char*)psz, nLength) { } - -#if wxUSE_WCHAR_T - // from wide (Unicode) string - wxString(const wchar_t *pwz, - const wxMBConv& conv = wxConvLibc, - size_t nLength = npos); -#endif // !wxUSE_WCHAR_T - - // from wxCharBuffer - wxString(const wxCharBuffer& psz) - : wxStringBase(psz) { } -#endif // Unicode/ANSI - - // generic attributes & operations - // as standard strlen() - size_t Len() const { return length(); } - // string contains any characters? - bool IsEmpty() const { return empty(); } - // empty string is "false", so !str will return true - bool operator!() const { return empty(); } - // truncate the string to given length - wxString& Truncate(size_t uiLen); - // empty string contents - void Empty() - { - Truncate(0); - - wxASSERT_MSG( empty(), _T("string not empty after call to Empty()?") ); - } - // empty the string and free memory - void Clear() - { - wxString tmp(wxEmptyString); - swap(tmp); - } - - // contents test - // Is an ascii value - bool IsAscii() const; - // Is a number - bool IsNumber() const; - // Is a word - bool IsWord() const; - - // data access (all indexes are 0 based) - // read access - wxChar GetChar(size_t n) const - { return at(n); } - // read/write access - wxChar& GetWritableChar(size_t n) - { return at(n); } - // write access - void SetChar(size_t n, wxChar ch) - { at(n) = ch; } - - // get last character - wxChar Last() const - { - wxASSERT_MSG( !empty(), _T("wxString: index out of bounds") ); - - return at(length() - 1); - } - - // get writable last character - wxChar& Last() - { - wxASSERT_MSG( !empty(), _T("wxString: index out of bounds") ); - return at(length() - 1); - } - - /* - Note that we we must define all of the overloads below to avoid - ambiguity when using str[0]. Also note that for a conforming compiler we - don't need const version of operatorp[] at all as indexed access to - const string is provided by implicit conversion to "const wxChar *" - below and defining them would only result in ambiguities, but some other - compilers refuse to compile "str[0]" without them. - */ - -#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__MWERKS__) - wxChar operator[](int n) const - { return wxStringBase::at(n); } - wxChar operator[](size_type n) const - { return wxStringBase::at(n); } -#ifndef wxSIZE_T_IS_UINT - wxChar operator[](unsigned int n) const - { return wxStringBase::at(n); } -#endif // size_t != unsigned int -#endif // broken compiler - - - // operator versions of GetWriteableChar() - wxChar& operator[](int n) - { return wxStringBase::at(n); } - wxChar& operator[](size_type n) - { return wxStringBase::at(n); } -#ifndef wxSIZE_T_IS_UINT - wxChar& operator[](unsigned int n) - { return wxStringBase::at(n); } -#endif // size_t != unsigned int - - // implicit conversion to C string - operator const wxChar*() const { return c_str(); } - - // identical to c_str(), for wxWin 1.6x compatibility - const wxChar* wx_str() const { return c_str(); } - // identical to c_str(), for MFC compatibility - const wxChar* GetData() const { return c_str(); } - -#if wxABI_VERSION >= 20804 - // conversion to *non-const* multibyte or widestring buffer; modifying - // returned buffer won't affect the string, these methods are only useful - // for passing values to const-incorrect functions - wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const - { return mb_str(conv); } -#if wxUSE_WCHAR_T - wxWritableWCharBuffer wchar_str() const { return wc_str(wxConvLibc); } -#endif -#endif // wxABI_VERSION >= 20804 - - // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for - // converting numbers or strings which are certain not to contain special - // chars (typically system functions, X atoms, environment variables etc.) - // - // the behaviour of these functions with the strings containing anything - // else than 7 bit ASCII characters is undefined, use at your own risk. -#if wxUSE_UNICODE - static wxString FromAscii(const char *ascii); // string - static wxString FromAscii(const char ascii); // char - const wxCharBuffer ToAscii() const; -#else // ANSI - static wxString FromAscii(const char *ascii) { return wxString( ascii ); } - static wxString FromAscii(const char ascii) { return wxString( ascii ); } - const char *ToAscii() const { return c_str(); } -#endif // Unicode/!Unicode - -#if wxABI_VERSION >= 20804 - // conversion to/from UTF-8: -#if wxUSE_UNICODE - static wxString FromUTF8(const char *utf8) - { return wxString(utf8, wxConvUTF8); } - static wxString FromUTF8(const char *utf8, size_t len) - { return wxString(utf8, wxConvUTF8, len); } - const wxCharBuffer utf8_str() const { return mb_str(wxConvUTF8); } - const wxCharBuffer ToUTF8() const { return utf8_str(); } -#elif wxUSE_WCHAR_T // ANSI - static wxString FromUTF8(const char *utf8) - { return wxString(wxConvUTF8.cMB2WC(utf8)); } - static wxString FromUTF8(const char *utf8, size_t len) - { - size_t wlen; - wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); - return wxString(buf.data(), wxConvLibc, wlen); - } - const wxCharBuffer utf8_str() const - { return wxConvUTF8.cWC2MB(wc_str(wxConvLibc)); } - const wxCharBuffer ToUTF8() const { return utf8_str(); } -#endif // Unicode/ANSI -#endif // wxABI_VERSION >= 20804 - -#if wxABI_VERSION >= 20804 - // functions for storing binary data in wxString: -#if wxUSE_UNICODE - static wxString From8BitData(const char *data, size_t len) - { return wxString(data, wxConvISO8859_1, len); } - // version for NUL-terminated data: - static wxString From8BitData(const char *data) - { return wxString(data, wxConvISO8859_1); } - const wxCharBuffer To8BitData() const { return mb_str(wxConvISO8859_1); } -#else // ANSI - static wxString From8BitData(const char *data, size_t len) - { return wxString(data, len); } - // version for NUL-terminated data: - static wxString From8BitData(const char *data) - { return wxString(data); } - const char *To8BitData() const { return c_str(); } -#endif // Unicode/ANSI -#endif // wxABI_VERSION >= 20804 - - // conversions with (possible) format conversions: have to return a - // buffer with temporary data - // - // the functions defined (in either Unicode or ANSI) mode are mb_str() to - // return an ANSI (multibyte) string, wc_str() to return a wide string and - // fn_str() to return a string which should be used with the OS APIs - // accepting the file names. The return value is always the same, but the - // type differs because a function may either return pointer to the buffer - // directly or have to use intermediate buffer for translation. -#if wxUSE_UNICODE - const wxCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const; - - const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } - - const wxChar* wc_str() const { return c_str(); } - - // for compatibility with !wxUSE_UNICODE version - const wxChar* wc_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } - -#if wxMBFILES - const wxCharBuffer fn_str() const { return mb_str(wxConvFile); } -#else // !wxMBFILES - const wxChar* fn_str() const { return c_str(); } -#endif // wxMBFILES/!wxMBFILES -#else // ANSI - const wxChar* mb_str() const { return c_str(); } - - // for compatibility with wxUSE_UNICODE version - const wxChar* mb_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } - - const wxWX2MBbuf mbc_str() const { return mb_str(); } - -#if wxUSE_WCHAR_T - const wxWCharBuffer wc_str(const wxMBConv& conv) const; -#endif // wxUSE_WCHAR_T -#ifdef __WXOSX__ - const wxCharBuffer fn_str() const { return wxConvFile.cWC2WX( wc_str( wxConvLocal ) ); } -#else - const wxChar* fn_str() const { return c_str(); } -#endif -#endif // Unicode/ANSI - - // overloaded assignment - // from another wxString - wxString& operator=(const wxStringBase& stringSrc) - { return (wxString&)wxStringBase::operator=(stringSrc); } - // from a character - wxString& operator=(wxChar ch) - { return (wxString&)wxStringBase::operator=(ch); } - // from a C string - STL probably will crash on NULL, - // so we need to compensate in that case -#if wxUSE_STL - wxString& operator=(const wxChar *psz) - { if(psz) wxStringBase::operator=(psz); else Clear(); return *this; } -#else - wxString& operator=(const wxChar *psz) - { return (wxString&)wxStringBase::operator=(psz); } -#endif - -#if wxUSE_UNICODE - // from wxWCharBuffer - wxString& operator=(const wxWCharBuffer& psz) - { (void) operator=((const wchar_t *)psz); return *this; } -#else // ANSI - // from another kind of C string - wxString& operator=(const unsigned char* psz); -#if wxUSE_WCHAR_T - // from a wide string - wxString& operator=(const wchar_t *pwz); -#endif - // from wxCharBuffer - wxString& operator=(const wxCharBuffer& psz) - { (void) operator=((const char *)psz); return *this; } -#endif // Unicode/ANSI - - // string concatenation - // in place concatenation - /* - Concatenate and return the result. Note that the left to right - associativity of << allows to write things like "str << str1 << str2 - << ..." (unlike with +=) - */ - // string += string - wxString& operator<<(const wxString& s) - { -#if !wxUSE_STL - wxASSERT_MSG( s.GetStringData()->IsValid(), - _T("did you forget to call UngetWriteBuf()?") ); -#endif - - append(s); - return *this; - } - // string += C string - wxString& operator<<(const wxChar *psz) - { append(psz); return *this; } - // string += char - wxString& operator<<(wxChar ch) { append(1, ch); return *this; } - - // string += buffer (i.e. from wxGetString) -#if wxUSE_UNICODE - wxString& operator<<(const wxWCharBuffer& s) - { (void)operator<<((const wchar_t *)s); return *this; } - void operator+=(const wxWCharBuffer& s) - { (void)operator<<((const wchar_t *)s); } -#else // !wxUSE_UNICODE - wxString& operator<<(const wxCharBuffer& s) - { (void)operator<<((const char *)s); return *this; } - void operator+=(const wxCharBuffer& s) - { (void)operator<<((const char *)s); } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - - // string += C string - wxString& Append(const wxString& s) - { - // test for empty() to share the string if possible - if ( empty() ) - *this = s; - else - append(s); - return *this; - } - wxString& Append(const wxChar* psz) - { append(psz); return *this; } - // append count copies of given character - wxString& Append(wxChar ch, size_t count = 1u) - { append(count, ch); return *this; } - wxString& Append(const wxChar* psz, size_t nLen) - { append(psz, nLen); return *this; } - - // prepend a string, return the string itself - wxString& Prepend(const wxString& str) - { *this = str + *this; return *this; } - - // non-destructive concatenation - // two strings - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, - const wxString& string2); - // string with a single char - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); - // char with a string - friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); - // string with C string - friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, - const wxChar *psz); - // C string with string - friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, - const wxString& string); - - // stream-like functions - // insert an int into string - wxString& operator<<(int i) - { return (*this) << Format(_T("%d"), i); } - // insert an unsigned int into string - wxString& operator<<(unsigned int ui) - { return (*this) << Format(_T("%u"), ui); } - // insert a long into string - wxString& operator<<(long l) - { return (*this) << Format(_T("%ld"), l); } - // insert an unsigned long into string - wxString& operator<<(unsigned long ul) - { return (*this) << Format(_T("%lu"), ul); } -#if defined wxLongLong_t && !defined wxLongLongIsLong - // insert a long long if they exist and aren't longs - wxString& operator<<(wxLongLong_t ll) - { - const wxChar *fmt = _T("%") wxLongLongFmtSpec _T("d"); - return (*this) << Format(fmt, ll); - } - // insert an unsigned long long - wxString& operator<<(wxULongLong_t ull) - { - const wxChar *fmt = _T("%") wxLongLongFmtSpec _T("u"); - return (*this) << Format(fmt , ull); - } -#endif - // insert a float into string - wxString& operator<<(float f) - { return (*this) << Format(_T("%f"), f); } - // insert a double into string - wxString& operator<<(double d) - { return (*this) << Format(_T("%g"), d); } - - // string comparison - // case-sensitive comparison (returns a value < 0, = 0 or > 0) - int Cmp(const wxChar *psz) const; - int Cmp(const wxString& s) const; - // same as Cmp() but not case-sensitive - int CmpNoCase(const wxChar *psz) const; - int CmpNoCase(const wxString& s) const; - // test for the string equality, either considering case or not - // (if compareWithCase then the case matters) - bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const - { return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; } - // comparison with a single character: returns true if equal - bool IsSameAs(wxChar c, bool compareWithCase = true) const - { - return (length() == 1) && (compareWithCase ? GetChar(0u) == c - : wxToupper(GetChar(0u)) == wxToupper(c)); - } - - // simple sub-string extraction - // return substring starting at nFirst of length nCount (or till the end - // if nCount = default value) - wxString Mid(size_t nFirst, size_t nCount = npos) const; - - // operator version of Mid() - wxString operator()(size_t start, size_t len) const - { return Mid(start, len); } - - // check if the string starts with the given prefix and return the rest - // of the string in the provided pointer if it is not NULL; otherwise - // return false - bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; - // check if the string ends with the given suffix and return the - // beginning of the string before the suffix in the provided pointer if - // it is not NULL; otherwise return false - bool EndsWith(const wxChar *suffix, wxString *rest = NULL) const; - - // get first nCount characters - wxString Left(size_t nCount) const; - // get last nCount characters - wxString Right(size_t nCount) const; - // get all characters before the first occurance of ch - // (returns the whole string if ch not found) - wxString BeforeFirst(wxChar ch) const; - // get all characters before the last occurence of ch - // (returns empty string if ch not found) - wxString BeforeLast(wxChar ch) const; - // get all characters after the first occurence of ch - // (returns empty string if ch not found) - wxString AfterFirst(wxChar ch) const; - // get all characters after the last occurence of ch - // (returns the whole string if ch not found) - wxString AfterLast(wxChar ch) const; - - // for compatibility only, use more explicitly named functions above - wxString Before(wxChar ch) const { return BeforeLast(ch); } - wxString After(wxChar ch) const { return AfterFirst(ch); } - - // case conversion - // convert to upper case in place, return the string itself - wxString& MakeUpper(); - // convert to upper case, return the copy of the string - // Here's something to remember: BC++ doesn't like returns in inlines. - wxString Upper() const ; - // convert to lower case in place, return the string itself - wxString& MakeLower(); - // convert to lower case, return the copy of the string - wxString Lower() const ; - - // trimming/padding whitespace (either side) and truncating - // remove spaces from left or from right (default) side - wxString& Trim(bool bFromRight = true); - // add nCount copies chPad in the beginning or at the end (default) - wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = true); - - // searching and replacing - // searching (return starting index, or -1 if not found) - int Find(wxChar ch, bool bFromEnd = false) const; // like strchr/strrchr - // searching (return starting index, or -1 if not found) - int Find(const wxChar *pszSub) const; // like strstr - // replace first (or all of bReplaceAll) occurences of substring with - // another string, returns the number of replacements made - size_t Replace(const wxChar *szOld, - const wxChar *szNew, - bool bReplaceAll = true); - - // check if the string contents matches a mask containing '*' and '?' - bool Matches(const wxChar *szMask) const; - - // conversion to numbers: all functions return true only if the whole - // string is a number and put the value of this number into the pointer - // provided, the base is the numeric base in which the conversion should be - // done and must be comprised between 2 and 36 or be 0 in which case the - // standard C rules apply (leading '0' => octal, "0x" => hex) - // convert to a signed integer - bool ToLong(long *val, int base = 10) const; - // convert to an unsigned integer - bool ToULong(unsigned long *val, int base = 10) const; - // convert to wxLongLong -#if defined(wxLongLong_t) - bool ToLongLong(wxLongLong_t *val, int base = 10) const; - // convert to wxULongLong - bool ToULongLong(wxULongLong_t *val, int base = 10) const; -#endif // wxLongLong_t - // convert to a double - bool ToDouble(double *val) const; - - - - // formatted input/output - // as sprintf(), returns the number of characters written or < 0 on error - // (take 'this' into account in attribute parameter count) - int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; - // as vprintf(), returns the number of characters written or < 0 on error - int PrintfV(const wxChar* pszFormat, va_list argptr); - - // returns the string containing the result of Printf() to it - static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1; - // the same as above, but takes a va_list - static wxString FormatV(const wxChar *pszFormat, va_list argptr); - - // raw access to string memory - // ensure that string has space for at least nLen characters - // only works if the data of this string is not shared - bool Alloc(size_t nLen) { reserve(nLen); /*return capacity() >= nLen;*/ return true; } - // minimize the string's memory - // only works if the data of this string is not shared - bool Shrink(); -#if !wxUSE_STL - // get writable buffer of at least nLen bytes. Unget() *must* be called - // a.s.a.p. to put string back in a reasonable state! - wxChar *GetWriteBuf(size_t nLen); - // call this immediately after GetWriteBuf() has been used - void UngetWriteBuf(); - void UngetWriteBuf(size_t nLen); -#endif - - // wxWidgets version 1 compatibility functions - - // use Mid() - wxString SubString(size_t from, size_t to) const - { return Mid(from, (to - from + 1)); } - // values for second parameter of CompareTo function - enum caseCompare {exact, ignoreCase}; - // values for first parameter of Strip function - enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; - - // use Printf() - // (take 'this' into account in attribute parameter count) - int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; - - // use Cmp() - inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const - { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); } - - // use Len - size_t Length() const { return length(); } - // Count the number of characters - int Freq(wxChar ch) const; - // use MakeLower - void LowerCase() { MakeLower(); } - // use MakeUpper - void UpperCase() { MakeUpper(); } - // use Trim except that it doesn't change this string - wxString Strip(stripType w = trailing) const; - - // use Find (more general variants not yet supported) - size_t Index(const wxChar* psz) const { return Find(psz); } - size_t Index(wxChar ch) const { return Find(ch); } - // use Truncate - wxString& Remove(size_t pos) { return Truncate(pos); } - wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); } - - wxString& Remove(size_t nStart, size_t nLen) - { return (wxString&)erase( nStart, nLen ); } - - // use Find() - int First( const wxChar ch ) const { return Find(ch); } - int First( const wxChar* psz ) const { return Find(psz); } - int First( const wxString &str ) const { return Find(str); } - int Last( const wxChar ch ) const { return Find(ch, true); } - bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; } - - // use empty() - bool IsNull() const { return empty(); } - - // std::string compatibility functions - - // take nLen chars starting at nPos - wxString(const wxString& str, size_t nPos, size_t nLen) - : wxStringBase(str, nPos, nLen) { } - // take all characters from pStart to pEnd - wxString(const void *pStart, const void *pEnd) - : wxStringBase((const wxChar*)pStart, (const wxChar*)pEnd) { } -#if wxUSE_STL - wxString(const_iterator first, const_iterator last) - : wxStringBase(first, last) { } -#endif - - // lib.string.modifiers - // append elements str[pos], ..., str[pos+n] - wxString& append(const wxString& str, size_t pos, size_t n) - { return (wxString&)wxStringBase::append(str, pos, n); } - // append a string - wxString& append(const wxString& str) - { return (wxString&)wxStringBase::append(str); } - // append first n (or all if n == npos) characters of sz - wxString& append(const wxChar *sz) - { return (wxString&)wxStringBase::append(sz); } - wxString& append(const wxChar *sz, size_t n) - { return (wxString&)wxStringBase::append(sz, n); } - // append n copies of ch - wxString& append(size_t n, wxChar ch) - { return (wxString&)wxStringBase::append(n, ch); } - // append from first to last - wxString& append(const_iterator first, const_iterator last) - { return (wxString&)wxStringBase::append(first, last); } - - // same as `this_string = str' - wxString& assign(const wxString& str) - { return (wxString&)wxStringBase::assign(str); } - // same as ` = str[pos..pos + n] - wxString& assign(const wxString& str, size_t pos, size_t n) - { return (wxString&)wxStringBase::assign(str, pos, n); } - // same as `= first n (or all if n == npos) characters of sz' - wxString& assign(const wxChar *sz) - { return (wxString&)wxStringBase::assign(sz); } - wxString& assign(const wxChar *sz, size_t n) - { return (wxString&)wxStringBase::assign(sz, n); } - // same as `= n copies of ch' - wxString& assign(size_t n, wxChar ch) - { return (wxString&)wxStringBase::assign(n, ch); } - // assign from first to last - wxString& assign(const_iterator first, const_iterator last) - { return (wxString&)wxStringBase::assign(first, last); } - - // string comparison -#if !defined(HAVE_STD_STRING_COMPARE) - int compare(const wxStringBase& str) const; - // comparison with a substring - int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; - // comparison of 2 substrings - int compare(size_t nStart, size_t nLen, - const wxStringBase& str, size_t nStart2, size_t nLen2) const; - // just like strcmp() - int compare(const wxChar* sz) const; - // substring comparison with first nCount characters of sz - int compare(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount = npos) const; -#endif // !defined HAVE_STD_STRING_COMPARE - - // insert another string - wxString& insert(size_t nPos, const wxString& str) - { return (wxString&)wxStringBase::insert(nPos, str); } - // insert n chars of str starting at nStart (in str) - wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n) - { return (wxString&)wxStringBase::insert(nPos, str, nStart, n); } - // insert first n (or all if n == npos) characters of sz - wxString& insert(size_t nPos, const wxChar *sz) - { return (wxString&)wxStringBase::insert(nPos, sz); } - wxString& insert(size_t nPos, const wxChar *sz, size_t n) - { return (wxString&)wxStringBase::insert(nPos, sz, n); } - // insert n copies of ch - wxString& insert(size_t nPos, size_t n, wxChar ch) - { return (wxString&)wxStringBase::insert(nPos, n, ch); } - iterator insert(iterator it, wxChar ch) - { return wxStringBase::insert(it, ch); } - void insert(iterator it, const_iterator first, const_iterator last) - { wxStringBase::insert(it, first, last); } - void insert(iterator it, size_type n, wxChar ch) - { wxStringBase::insert(it, n, ch); } - - // delete characters from nStart to nStart + nLen - wxString& erase(size_type pos = 0, size_type n = npos) - { return (wxString&)wxStringBase::erase(pos, n); } - iterator erase(iterator first, iterator last) - { return wxStringBase::erase(first, last); } - iterator erase(iterator first) - { return wxStringBase::erase(first); } - -#ifdef wxSTRING_BASE_HASNT_CLEAR - void clear() { erase(); } -#endif - - // replaces the substring of length nLen starting at nStart - wxString& replace(size_t nStart, size_t nLen, const wxChar* sz) - { return (wxString&)wxStringBase::replace(nStart, nLen, sz); } - // replaces the substring of length nLen starting at nStart - wxString& replace(size_t nStart, size_t nLen, const wxString& str) - { return (wxString&)wxStringBase::replace(nStart, nLen, str); } - // replaces the substring with nCount copies of ch - wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch) - { return (wxString&)wxStringBase::replace(nStart, nLen, nCount, ch); } - // replaces a substring with another substring - wxString& replace(size_t nStart, size_t nLen, - const wxString& str, size_t nStart2, size_t nLen2) - { return (wxString&)wxStringBase::replace(nStart, nLen, str, - nStart2, nLen2); } - // replaces the substring with first nCount chars of sz - wxString& replace(size_t nStart, size_t nLen, - const wxChar* sz, size_t nCount) - { return (wxString&)wxStringBase::replace(nStart, nLen, sz, nCount); } - wxString& replace(iterator first, iterator last, const_pointer s) - { return (wxString&)wxStringBase::replace(first, last, s); } - wxString& replace(iterator first, iterator last, const_pointer s, - size_type n) - { return (wxString&)wxStringBase::replace(first, last, s, n); } - wxString& replace(iterator first, iterator last, const wxString& s) - { return (wxString&)wxStringBase::replace(first, last, s); } - wxString& replace(iterator first, iterator last, size_type n, wxChar c) - { return (wxString&)wxStringBase::replace(first, last, n, c); } - wxString& replace(iterator first, iterator last, - const_iterator first1, const_iterator last1) - { return (wxString&)wxStringBase::replace(first, last, first1, last1); } - - // string += string - wxString& operator+=(const wxString& s) - { return (wxString&)wxStringBase::operator+=(s); } - // string += C string - wxString& operator+=(const wxChar *psz) - { return (wxString&)wxStringBase::operator+=(psz); } - // string += char - wxString& operator+=(wxChar ch) - { return (wxString&)wxStringBase::operator+=(ch); } -}; - -// notice that even though for many compilers the friend declarations above are -// enough, from the point of view of C++ standard we must have the declarations -// here as friend ones are not injected in the enclosing namespace and without -// them the code fails to compile with conforming compilers such as xlC or g++4 -wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); -wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); -wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz); -wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); - - -// define wxArrayString, for compatibility -#if WXWIN_COMPATIBILITY_2_4 && !wxUSE_STL - #include "wx/arrstr.h" -#endif - -#if wxUSE_STL - // return an empty wxString (not very useful with wxUSE_STL == 1) - inline const wxString wxGetEmptyString() { return wxString(); } -#else // !wxUSE_STL - // return an empty wxString (more efficient than wxString() here) - inline const wxString& wxGetEmptyString() - { - return *(wxString *)&wxEmptyString; - } -#endif // wxUSE_STL/!wxUSE_STL - -// ---------------------------------------------------------------------------- -// wxStringBuffer: a tiny class allowing to get a writable pointer into string -// ---------------------------------------------------------------------------- - -#if wxUSE_STL - -class WXDLLIMPEXP_BASE wxStringBuffer -{ -public: - wxStringBuffer(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(lenWanted) - { } - - ~wxStringBuffer() { m_str.assign(m_buf.data(), wxStrlen(m_buf.data())); } - - operator wxChar*() { return m_buf.data(); } - -private: - wxString& m_str; -#if wxUSE_UNICODE - wxWCharBuffer m_buf; -#else - wxCharBuffer m_buf; -#endif - - DECLARE_NO_COPY_CLASS(wxStringBuffer) -}; - -class WXDLLIMPEXP_BASE wxStringBufferLength -{ -public: - wxStringBufferLength(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(lenWanted), m_len(0), m_lenSet(false) - { } - - ~wxStringBufferLength() - { - wxASSERT(m_lenSet); - m_str.assign(m_buf.data(), m_len); - } - - operator wxChar*() { return m_buf.data(); } - void SetLength(size_t length) { m_len = length; m_lenSet = true; } - -private: - wxString& m_str; -#if wxUSE_UNICODE - wxWCharBuffer m_buf; -#else - wxCharBuffer m_buf; -#endif - size_t m_len; - bool m_lenSet; - - DECLARE_NO_COPY_CLASS(wxStringBufferLength) -}; - -#else // if !wxUSE_STL - -class WXDLLIMPEXP_BASE wxStringBuffer -{ -public: - wxStringBuffer(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL) - { m_buf = m_str.GetWriteBuf(lenWanted); } - - ~wxStringBuffer() { m_str.UngetWriteBuf(); } - - operator wxChar*() const { return m_buf; } - -private: - wxString& m_str; - wxChar *m_buf; - - DECLARE_NO_COPY_CLASS(wxStringBuffer) -}; - -class WXDLLIMPEXP_BASE wxStringBufferLength -{ -public: - wxStringBufferLength(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) - { - m_buf = m_str.GetWriteBuf(lenWanted); - wxASSERT(m_buf != NULL); - } - - ~wxStringBufferLength() - { - wxASSERT(m_lenSet); - m_str.UngetWriteBuf(m_len); - } - - operator wxChar*() const { return m_buf; } - void SetLength(size_t length) { m_len = length; m_lenSet = true; } - -private: - wxString& m_str; - wxChar *m_buf; - size_t m_len; - bool m_lenSet; - - DECLARE_NO_COPY_CLASS(wxStringBufferLength) -}; - -#endif // !wxUSE_STL - -// --------------------------------------------------------------------------- -// wxString comparison functions: operator versions are always case sensitive -// --------------------------------------------------------------------------- - -// note that when wxUSE_STL == 1 the comparison operators taking std::string -// are used and defining them also for wxString would only result in -// compilation ambiguities when comparing std::string and wxString -#if !wxUSE_STL - -inline bool operator==(const wxString& s1, const wxString& s2) - { return (s1.Len() == s2.Len()) && (s1.Cmp(s2) == 0); } -inline bool operator==(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) == 0; } -inline bool operator==(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) == 0; } -inline bool operator!=(const wxString& s1, const wxString& s2) - { return (s1.Len() != s2.Len()) || (s1.Cmp(s2) != 0); } -inline bool operator!=(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) != 0; } -inline bool operator!=(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) != 0; } -inline bool operator< (const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) < 0; } -inline bool operator< (const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) < 0; } -inline bool operator< (const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) > 0; } -inline bool operator> (const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) > 0; } -inline bool operator> (const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) > 0; } -inline bool operator> (const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) < 0; } -inline bool operator<=(const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) <= 0; } -inline bool operator<=(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) <= 0; } -inline bool operator<=(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) >= 0; } -inline bool operator>=(const wxString& s1, const wxString& s2) - { return s1.Cmp(s2) >= 0; } -inline bool operator>=(const wxString& s1, const wxChar * s2) - { return s1.Cmp(s2) >= 0; } -inline bool operator>=(const wxChar * s1, const wxString& s2) - { return s2.Cmp(s1) <= 0; } - -#if wxUSE_UNICODE -inline bool operator==(const wxString& s1, const wxWCharBuffer& s2) - { return (s1.Cmp((const wchar_t *)s2) == 0); } -inline bool operator==(const wxWCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const wchar_t *)s1) == 0); } -inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2) - { return (s1.Cmp((const wchar_t *)s2) != 0); } -inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const wchar_t *)s1) != 0); } -#else // !wxUSE_UNICODE -inline bool operator==(const wxString& s1, const wxCharBuffer& s2) - { return (s1.Cmp((const char *)s2) == 0); } -inline bool operator==(const wxCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const char *)s1) == 0); } -inline bool operator!=(const wxString& s1, const wxCharBuffer& s2) - { return (s1.Cmp((const char *)s2) != 0); } -inline bool operator!=(const wxCharBuffer& s1, const wxString& s2) - { return (s2.Cmp((const char *)s1) != 0); } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - -#if wxUSE_UNICODE -inline wxString operator+(const wxString& string, const wxWCharBuffer& buf) - { return string + (const wchar_t *)buf; } -inline wxString operator+(const wxWCharBuffer& buf, const wxString& string) - { return (const wchar_t *)buf + string; } -#else // !wxUSE_UNICODE -inline wxString operator+(const wxString& string, const wxCharBuffer& buf) - { return string + (const char *)buf; } -inline wxString operator+(const wxCharBuffer& buf, const wxString& string) - { return (const char *)buf + string; } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - -#endif // !wxUSE_STL - -// comparison with char (those are not defined by std::[w]string and so should -// be always available) -inline bool operator==(wxChar c, const wxString& s) { return s.IsSameAs(c); } -inline bool operator==(const wxString& s, wxChar c) { return s.IsSameAs(c); } -inline bool operator!=(wxChar c, const wxString& s) { return !s.IsSameAs(c); } -inline bool operator!=(const wxString& s, wxChar c) { return !s.IsSameAs(c); } - -// --------------------------------------------------------------------------- -// Implementation only from here until the end of file -// --------------------------------------------------------------------------- - -// don't pollute the library user's name space -#undef wxASSERT_VALID_INDEX - -#if wxUSE_STD_IOSTREAM - -#include "wx/iosfwrap.h" - -WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); - -#endif // wxSTD_STRING_COMPATIBILITY - -#endif // _WX_WXSTRINGH__ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/string.h +// Purpose: wxString and wxArrayString classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: string.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + Efficient string class [more or less] compatible with MFC CString, + wxWidgets version 1 wxString and std::string and some handy functions + missing from string.h. +*/ + +#ifndef _WX_WXSTRINGH__ +#define _WX_WXSTRINGH__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" // everybody should include this + +#if defined(__WXMAC__) || defined(__VISAGECPP__) + #include <ctype.h> +#endif + +#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 + // problem in VACPP V4 with including stdlib.h multiple times + // strconv includes it anyway +# include <stdio.h> +# include <string.h> +# include <stdarg.h> +# include <limits.h> +#else +# include <string.h> +# include <stdio.h> +# include <stdarg.h> +# include <limits.h> +# include <stdlib.h> +#endif + +#ifdef HAVE_STRCASECMP_IN_STRINGS_H + #include <strings.h> // for strcasecmp() +#endif // HAVE_STRCASECMP_IN_STRINGS_H + +#ifdef __WXPALMOS__ + #include <StringMgr.h> +#endif + +#include "wx/wxchar.h" // for wxChar +#include "wx/buffer.h" // for wxCharBuffer +#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes + +class WXDLLIMPEXP_FWD_BASE wxString; + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +// casts [unfortunately!] needed to call some broken functions which require +// "char *" instead of "const char *" +#define WXSTRINGCAST (wxChar *)(const wxChar *) +#define wxCSTRINGCAST (wxChar *)(const wxChar *) +#define wxMBSTRINGCAST (char *)(const char *) +#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *) + +// implementation only +#define wxASSERT_VALID_INDEX(i) \ + wxASSERT_MSG( (size_t)(i) <= length(), _T("invalid index in wxString") ) + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_6 + +// deprecated in favour of wxString::npos, don't use in new code +// +// maximum possible length for a string means "take all string" everywhere +#define wxSTRING_MAXLEN wxStringBase::npos + +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +// global pointer to empty string +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; + +// --------------------------------------------------------------------------- +// global functions complementing standard C string library replacements for +// strlen() and portable strcasecmp() +//--------------------------------------------------------------------------- + +// Use wxXXX() functions from wxchar.h instead! These functions are for +// backwards compatibility only. + +// checks whether the passed in pointer is NULL and if the string is empty +inline bool IsEmpty(const char *p) { return (!p || !*p); } + +// safe version of strlen() (returns 0 if passed NULL pointer) +inline size_t Strlen(const char *psz) + { return psz ? strlen(psz) : 0; } + +// portable strcasecmp/_stricmp +inline int Stricmp(const char *psz1, const char *psz2) +{ +#if defined(__VISUALC__) && defined(__WXWINCE__) + register char c1, c2; + do { + c1 = tolower(*psz1++); + c2 = tolower(*psz2++); + } while ( c1 && (c1 == c2) ); + + return c1 - c2; +#elif defined(__VISUALC__) || ( defined(__MWERKS__) && defined(__INTEL__) ) + return _stricmp(psz1, psz2); +#elif defined(__SC__) + return _stricmp(psz1, psz2); +#elif defined(__SALFORDC__) + return stricmp(psz1, psz2); +#elif defined(__BORLANDC__) + return stricmp(psz1, psz2); +#elif defined(__WATCOMC__) + return stricmp(psz1, psz2); +#elif defined(__DJGPP__) + return stricmp(psz1, psz2); +#elif defined(__EMX__) + return stricmp(psz1, psz2); +#elif defined(__WXPM__) + return stricmp(psz1, psz2); +#elif defined(__WXPALMOS__) || \ + defined(HAVE_STRCASECMP_IN_STRING_H) || \ + defined(HAVE_STRCASECMP_IN_STRINGS_H) || \ + defined(__GNUWIN32__) + return strcasecmp(psz1, psz2); +#elif defined(__MWERKS__) && !defined(__INTEL__) + register char c1, c2; + do { + c1 = tolower(*psz1++); + c2 = tolower(*psz2++); + } while ( c1 && (c1 == c2) ); + + return c1 - c2; +#else + // almost all compilers/libraries provide this function (unfortunately under + // different names), that's why we don't implement our own which will surely + // be more efficient than this code (uncomment to use): + /* + register char c1, c2; + do { + c1 = tolower(*psz1++); + c2 = tolower(*psz2++); + } while ( c1 && (c1 == c2) ); + + return c1 - c2; + */ + + #error "Please define string case-insensitive compare for your OS/compiler" +#endif // OS/compiler +} + +// ---------------------------------------------------------------------------- +// deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING +// ---------------------------------------------------------------------------- + +// in both cases we need to define wxStdString +#if wxUSE_STL || wxUSE_STD_STRING + +#include "wx/beforestd.h" +#include <string> +#include "wx/afterstd.h" + +#if wxUSE_UNICODE + #ifdef HAVE_STD_WSTRING + typedef std::wstring wxStdString; + #else + typedef std::basic_string<wxChar> wxStdString; + #endif +#else + typedef std::string wxStdString; +#endif + +#endif // need <string> + +#if wxUSE_STL + + // we don't need an extra ctor from std::string when copy ctor already does + // the work + #undef wxUSE_STD_STRING + #define wxUSE_STD_STRING 0 + + #if (defined(__GNUG__) && (__GNUG__ < 3)) || \ + (defined(_MSC_VER) && (_MSC_VER <= 1200)) + #define wxSTRING_BASE_HASNT_CLEAR + #endif + + typedef wxStdString wxStringBase; +#else // if !wxUSE_STL + +#if !defined(HAVE_STD_STRING_COMPARE) && \ + (!defined(__WX_SETUP_H__) || wxUSE_STL == 0) + #define HAVE_STD_STRING_COMPARE +#endif + +// --------------------------------------------------------------------------- +// string data prepended with some housekeeping info (used by wxString class), +// is never used directly (but had to be put here to allow inlining) +// --------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxStringData +{ + int nRefs; // reference count + size_t nDataLength, // actual string length + nAllocLength; // allocated memory size + + // mimics declaration 'wxChar data[nAllocLength]' + wxChar* data() const { return (wxChar*)(this + 1); } + + // empty string has a special ref count so it's never deleted + bool IsEmpty() const { return (nRefs == -1); } + bool IsShared() const { return (nRefs > 1); } + + // lock/unlock + void Lock() { if ( !IsEmpty() ) nRefs++; } + + // VC++ will refuse to inline Unlock but profiling shows that it is wrong +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + __forceinline +#endif + // VC++ free must take place in same DLL as allocation when using non dll + // run-time library (e.g. Multithreaded instead of Multithreaded DLL) +#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } + // we must not inline deallocation since allocation is not inlined + void Free(); +#else + void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } +#endif + + // if we had taken control over string memory (GetWriteBuf), it's + // intentionally put in invalid state + void Validate(bool b) { nRefs = (b ? 1 : 0); } + bool IsValid() const { return (nRefs != 0); } +}; + +class WXDLLIMPEXP_BASE wxStringBase +{ +#if !wxUSE_STL +friend class WXDLLIMPEXP_FWD_BASE wxArrayString; +#endif +public : + // an 'invalid' value for string index, moved to this place due to a CW bug + static const size_t npos; +protected: + // points to data preceded by wxStringData structure with ref count info + wxChar *m_pchData; + + // accessor to string data + wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; } + + // string (re)initialization functions + // initializes the string to the empty value (must be called only from + // ctors, use Reinit() otherwise) + void Init() { m_pchData = (wxChar *)wxEmptyString; } + // initializes the string with (a part of) C-string + void InitWith(const wxChar *psz, size_t nPos = 0, size_t nLen = npos); + // as Init, but also frees old data + void Reinit() { GetStringData()->Unlock(); Init(); } + + // memory allocation + // allocates memory for string of length nLen + bool AllocBuffer(size_t nLen); + // copies data to another string + bool AllocCopy(wxString&, int, int) const; + // effectively copies data to string + bool AssignCopy(size_t, const wxChar *); + + // append a (sub)string + bool ConcatSelf(size_t nLen, const wxChar *src, size_t nMaxLen); + bool ConcatSelf(size_t nLen, const wxChar *src) + { return ConcatSelf(nLen, src, nLen); } + + // functions called before writing to the string: they copy it if there + // are other references to our data (should be the only owner when writing) + bool CopyBeforeWrite(); + bool AllocBeforeWrite(size_t); + + // compatibility with wxString + bool Alloc(size_t nLen); +public: + // standard types + typedef wxChar value_type; + typedef wxChar char_type; + typedef size_t size_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type *iterator; + typedef const value_type *const_iterator; + +#define wxSTRING_REVERSE_ITERATOR(name, const_or_not) \ + class name \ + { \ + public: \ + typedef wxChar value_type; \ + typedef const_or_not value_type& reference; \ + typedef const_or_not value_type *pointer; \ + typedef const_or_not value_type *iterator_type; \ + \ + name(iterator_type i) : m_cur(i) { } \ + name(const name& ri) : m_cur(ri.m_cur) { } \ + \ + iterator_type base() const { return m_cur; } \ + \ + reference operator*() const { return *(m_cur - 1); } \ + \ + name& operator++() { --m_cur; return *this; } \ + name operator++(int) { name tmp = *this; --m_cur; return tmp; } \ + name& operator--() { ++m_cur; return *this; } \ + name operator--(int) { name tmp = *this; ++m_cur; return tmp; } \ + \ + bool operator==(name ri) const { return m_cur == ri.m_cur; } \ + bool operator!=(name ri) const { return !(*this == ri); } \ + \ + private: \ + iterator_type m_cur; \ + } + + wxSTRING_REVERSE_ITERATOR(const_reverse_iterator, const); + + #define wxSTRING_CONST + wxSTRING_REVERSE_ITERATOR(reverse_iterator, wxSTRING_CONST); + #undef wxSTRING_CONST + + #undef wxSTRING_REVERSE_ITERATOR + + + // constructors and destructor + // ctor for an empty string + wxStringBase() { Init(); } + // copy ctor + wxStringBase(const wxStringBase& stringSrc) + { + wxASSERT_MSG( stringSrc.GetStringData()->IsValid(), + _T("did you forget to call UngetWriteBuf()?") ); + + if ( stringSrc.empty() ) { + // nothing to do for an empty string + Init(); + } + else { + m_pchData = stringSrc.m_pchData; // share same data + GetStringData()->Lock(); // => one more copy + } + } + // string containing nRepeat copies of ch + wxStringBase(size_type nRepeat, wxChar ch); + // ctor takes first nLength characters from C string + // (default value of npos means take all the string) + wxStringBase(const wxChar *psz) + { InitWith(psz, 0, npos); } + wxStringBase(const wxChar *psz, size_t nLength) + { InitWith(psz, 0, nLength); } + wxStringBase(const wxChar *psz, + const wxMBConv& WXUNUSED(conv), + size_t nLength = npos) + { InitWith(psz, 0, nLength); } + // take nLen chars starting at nPos + wxStringBase(const wxStringBase& str, size_t nPos, size_t nLen) + { + wxASSERT_MSG( str.GetStringData()->IsValid(), + _T("did you forget to call UngetWriteBuf()?") ); + Init(); + size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen; + InitWith(str.c_str(), nPos, nLen); + } + // take all characters from pStart to pEnd + wxStringBase(const void *pStart, const void *pEnd); + + // dtor is not virtual, this class must not be inherited from! + ~wxStringBase() + { +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + //RN - according to the above VC++ does indeed inline this, + //even though it spits out two warnings + #pragma warning (disable:4714) +#endif + + GetStringData()->Unlock(); + } + +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + //re-enable inlining warning + #pragma warning (default:4714) +#endif + // overloaded assignment + // from another wxString + wxStringBase& operator=(const wxStringBase& stringSrc); + // from a character + wxStringBase& operator=(wxChar ch); + // from a C string + wxStringBase& operator=(const wxChar *psz); + + // return the length of the string + size_type length() const { return GetStringData()->nDataLength; } + // return the length of the string + size_type size() const { return length(); } + // return the maximum size of the string + size_type max_size() const { return npos; } + // resize the string, filling the space with c if c != 0 + void resize(size_t nSize, wxChar ch = wxT('\0')); + // delete the contents of the string + void clear() { erase(0, npos); } + // returns true if the string is empty + bool empty() const { return length() == 0; } + // inform string about planned change in size + void reserve(size_t sz) { Alloc(sz); } + size_type capacity() const { return GetStringData()->nAllocLength; } + + // lib.string.access + // return the character at position n + value_type at(size_type n) const + { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; } + // returns the writable character at position n + reference at(size_type n) + { wxASSERT_VALID_INDEX( n ); CopyBeforeWrite(); return m_pchData[n]; } + + // lib.string.modifiers + // append elements str[pos], ..., str[pos+n] + wxStringBase& append(const wxStringBase& str, size_t pos, size_t n) + { + wxASSERT(pos <= str.length()); + ConcatSelf(n, str.c_str() + pos, str.length() - pos); + return *this; + } + // append a string + wxStringBase& append(const wxStringBase& str) + { ConcatSelf(str.length(), str.c_str()); return *this; } + // append first n (or all if n == npos) characters of sz + wxStringBase& append(const wxChar *sz) + { ConcatSelf(wxStrlen(sz), sz); return *this; } + wxStringBase& append(const wxChar *sz, size_t n) + { ConcatSelf(n, sz); return *this; } + // append n copies of ch + wxStringBase& append(size_t n, wxChar ch); + // append from first to last + wxStringBase& append(const_iterator first, const_iterator last) + { ConcatSelf(last - first, first); return *this; } + + // same as `this_string = str' + wxStringBase& assign(const wxStringBase& str) + { return *this = str; } + // same as ` = str[pos..pos + n] + wxStringBase& assign(const wxStringBase& str, size_t pos, size_t n) + { clear(); return append(str, pos, n); } + // same as `= first n (or all if n == npos) characters of sz' + wxStringBase& assign(const wxChar *sz) + { clear(); return append(sz, wxStrlen(sz)); } + wxStringBase& assign(const wxChar *sz, size_t n) + { clear(); return append(sz, n); } + // same as `= n copies of ch' + wxStringBase& assign(size_t n, wxChar ch) + { clear(); return append(n, ch); } + // assign from first to last + wxStringBase& assign(const_iterator first, const_iterator last) + { clear(); return append(first, last); } + + // first valid index position + const_iterator begin() const { return m_pchData; } + iterator begin(); + // position one after the last valid one + const_iterator end() const { return m_pchData + length(); } + iterator end(); + + // first element of the reversed string + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rbegin() { return reverse_iterator(end()); } + // one beyond the end of the reversed string + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + + // insert another string + wxStringBase& insert(size_t nPos, const wxStringBase& str) + { + wxASSERT( str.GetStringData()->IsValid() ); + return insert(nPos, str.c_str(), str.length()); + } + // insert n chars of str starting at nStart (in str) + wxStringBase& insert(size_t nPos, const wxStringBase& str, size_t nStart, size_t n) + { + wxASSERT( str.GetStringData()->IsValid() ); + wxASSERT( nStart < str.length() ); + size_t strLen = str.length() - nStart; + n = strLen < n ? strLen : n; + return insert(nPos, str.c_str() + nStart, n); + } + // insert first n (or all if n == npos) characters of sz + wxStringBase& insert(size_t nPos, const wxChar *sz, size_t n = npos); + // insert n copies of ch + wxStringBase& insert(size_t nPos, size_t n, wxChar ch) + { return insert(nPos, wxStringBase(n, ch)); } + iterator insert(iterator it, wxChar ch) + { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; } + void insert(iterator it, const_iterator first, const_iterator last) + { insert(it - begin(), first, last - first); } + void insert(iterator it, size_type n, wxChar ch) + { insert(it - begin(), n, ch); } + + // delete characters from nStart to nStart + nLen + wxStringBase& erase(size_type pos = 0, size_type n = npos); + iterator erase(iterator first, iterator last) + { + size_t idx = first - begin(); + erase(idx, last - first); + return begin() + idx; + } + iterator erase(iterator first); + + // explicit conversion to C string (use this with printf()!) + const wxChar* c_str() const { return m_pchData; } + const wxChar* data() const { return m_pchData; } + + // replaces the substring of length nLen starting at nStart + wxStringBase& replace(size_t nStart, size_t nLen, const wxChar* sz); + // replaces the substring of length nLen starting at nStart + wxStringBase& replace(size_t nStart, size_t nLen, const wxStringBase& str) + { return replace(nStart, nLen, str.c_str()); } + // replaces the substring with nCount copies of ch + wxStringBase& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch); + // replaces a substring with another substring + wxStringBase& replace(size_t nStart, size_t nLen, + const wxStringBase& str, size_t nStart2, size_t nLen2); + // replaces the substring with first nCount chars of sz + wxStringBase& replace(size_t nStart, size_t nLen, + const wxChar* sz, size_t nCount); + wxStringBase& replace(iterator first, iterator last, const_pointer s) + { return replace(first - begin(), last - first, s); } + wxStringBase& replace(iterator first, iterator last, const_pointer s, + size_type n) + { return replace(first - begin(), last - first, s, n); } + wxStringBase& replace(iterator first, iterator last, const wxStringBase& s) + { return replace(first - begin(), last - first, s); } + wxStringBase& replace(iterator first, iterator last, size_type n, wxChar c) + { return replace(first - begin(), last - first, n, c); } + wxStringBase& replace(iterator first, iterator last, + const_iterator first1, const_iterator last1) + { return replace(first - begin(), last - first, first1, last1 - first1); } + + // swap two strings + void swap(wxStringBase& str); + + // All find() functions take the nStart argument which specifies the + // position to start the search on, the default value is 0. All functions + // return npos if there were no match. + + // find a substring + size_t find(const wxStringBase& str, size_t nStart = 0) const; + + // find first n characters of sz + size_t find(const wxChar* sz, size_t nStart = 0, size_t n = npos) const; + + // find the first occurence of character ch after nStart + size_t find(wxChar ch, size_t nStart = 0) const; + + // rfind() family is exactly like find() but works right to left + + // as find, but from the end + size_t rfind(const wxStringBase& str, size_t nStart = npos) const; + + // as find, but from the end + size_t rfind(const wxChar* sz, size_t nStart = npos, + size_t n = npos) const; + // as find, but from the end + size_t rfind(wxChar ch, size_t nStart = npos) const; + + // find first/last occurence of any character in the set + + // as strpbrk() but starts at nStart, returns npos if not found + size_t find_first_of(const wxStringBase& str, size_t nStart = 0) const + { return find_first_of(str.c_str(), nStart); } + // same as above + size_t find_first_of(const wxChar* sz, size_t nStart = 0) const; + size_t find_first_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as find(char, size_t) + size_t find_first_of(wxChar c, size_t nStart = 0) const + { return find(c, nStart); } + // find the last (starting from nStart) char from str in this string + size_t find_last_of (const wxStringBase& str, size_t nStart = npos) const + { return find_last_of(str.c_str(), nStart); } + // same as above + size_t find_last_of (const wxChar* sz, size_t nStart = npos) const; + size_t find_last_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as above + size_t find_last_of(wxChar c, size_t nStart = npos) const + { return rfind(c, nStart); } + + // find first/last occurence of any character not in the set + + // as strspn() (starting from nStart), returns npos on failure + size_t find_first_not_of(const wxStringBase& str, size_t nStart = 0) const + { return find_first_not_of(str.c_str(), nStart); } + // same as above + size_t find_first_not_of(const wxChar* sz, size_t nStart = 0) const; + size_t find_first_not_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as above + size_t find_first_not_of(wxChar ch, size_t nStart = 0) const; + // as strcspn() + size_t find_last_not_of(const wxStringBase& str, size_t nStart = npos) const + { return find_last_not_of(str.c_str(), nStart); } + // same as above + size_t find_last_not_of(const wxChar* sz, size_t nStart = npos) const; + size_t find_last_not_of(const wxChar* sz, size_t nStart, size_t n) const; + // same as above + size_t find_last_not_of(wxChar ch, size_t nStart = npos) const; + + // All compare functions return -1, 0 or 1 if the [sub]string is less, + // equal or greater than the compare() argument. + + // comparison with another string + int compare(const wxStringBase& str) const; + // comparison with a substring + int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; + // comparison of 2 substrings + int compare(size_t nStart, size_t nLen, + const wxStringBase& str, size_t nStart2, size_t nLen2) const; + // comparison with a c string + int compare(const wxChar* sz) const; + // substring comparison with first nCount characters of sz + int compare(size_t nStart, size_t nLen, + const wxChar* sz, size_t nCount = npos) const; + + size_type copy(wxChar* s, size_type n, size_type pos = 0); + + // substring extraction + wxStringBase substr(size_t nStart = 0, size_t nLen = npos) const; + + // string += string + wxStringBase& operator+=(const wxStringBase& s) { return append(s); } + // string += C string + wxStringBase& operator+=(const wxChar *psz) { return append(psz); } + // string += char + wxStringBase& operator+=(wxChar ch) { return append(1, ch); } +}; + +#endif // !wxUSE_STL + +// ---------------------------------------------------------------------------- +// wxString: string class trying to be compatible with std::string, MFC +// CString and wxWindows 1.x wxString all at once +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxString : public wxStringBase +{ +#if !wxUSE_STL +friend class WXDLLIMPEXP_FWD_BASE wxArrayString; +#endif + + // NB: special care was taken in arranging the member functions in such order + // that all inline functions can be effectively inlined, verify that all + // performance critical functions are still inlined if you change order! +private: + // if we hadn't made these operators private, it would be possible to + // compile "wxString s; s = 17;" without any warnings as 17 is implicitly + // converted to char in C and we do have operator=(char) + // + // NB: we don't need other versions (short/long and unsigned) as attempt + // to assign another numeric type to wxString will now result in + // ambiguity between operator=(char) and operator=(int) + wxString& operator=(int); + + // these methods are not implemented - there is _no_ conversion from int to + // string, you're doing something wrong if the compiler wants to call it! + // + // try `s << i' or `s.Printf("%d", i)' instead + wxString(int); + +public: + // constructors and destructor + // ctor for an empty string + wxString() : wxStringBase() { } + // copy ctor + wxString(const wxStringBase& stringSrc) : wxStringBase(stringSrc) { } + wxString(const wxString& stringSrc) : wxStringBase(stringSrc) { } + // string containing nRepeat copies of ch + wxString(wxChar ch, size_t nRepeat = 1) + : wxStringBase(nRepeat, ch) { } + wxString(size_t nRepeat, wxChar ch) + : wxStringBase(nRepeat, ch) { } + // ctor takes first nLength characters from C string + // (default value of npos means take all the string) + wxString(const wxChar *psz) + : wxStringBase(psz ? psz : wxT("")) { } + wxString(const wxChar *psz, size_t nLength) + : wxStringBase(psz, nLength) { } + wxString(const wxChar *psz, + const wxMBConv& WXUNUSED(conv), + size_t nLength = npos) + : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { } + + // even if we're not built with wxUSE_STL == 1 it is very convenient to allow + // implicit conversions from std::string to wxString as this allows to use + // the same strings in non-GUI and GUI code, however we don't want to + // unconditionally add this ctor as it would make wx lib dependent on + // libstdc++ on some Linux versions which is bad, so instead we ask the + // client code to define this wxUSE_STD_STRING symbol if they need it +#if wxUSE_STD_STRING + wxString(const wxStdString& s) + : wxStringBase(s.c_str()) { } +#endif // wxUSE_STD_STRING + +#if wxUSE_UNICODE + // from multibyte string + wxString(const char *psz, const wxMBConv& conv, size_t nLength = npos); + // from wxWCharBuffer (i.e. return from wxGetString) + wxString(const wxWCharBuffer& psz) : wxStringBase(psz.data()) { } +#else // ANSI + // from C string (for compilers using unsigned char) + wxString(const unsigned char* psz) + : wxStringBase((const char*)psz) { } + // from part of C string (for compilers using unsigned char) + wxString(const unsigned char* psz, size_t nLength) + : wxStringBase((const char*)psz, nLength) { } + +#if wxUSE_WCHAR_T + // from wide (Unicode) string + wxString(const wchar_t *pwz, + const wxMBConv& conv = wxConvLibc, + size_t nLength = npos); +#endif // !wxUSE_WCHAR_T + + // from wxCharBuffer + wxString(const wxCharBuffer& psz) + : wxStringBase(psz) { } +#endif // Unicode/ANSI + + // generic attributes & operations + // as standard strlen() + size_t Len() const { return length(); } + // string contains any characters? + bool IsEmpty() const { return empty(); } + // empty string is "false", so !str will return true + bool operator!() const { return empty(); } + // truncate the string to given length + wxString& Truncate(size_t uiLen); + // empty string contents + void Empty() + { + Truncate(0); + + wxASSERT_MSG( empty(), _T("string not empty after call to Empty()?") ); + } + // empty the string and free memory + void Clear() + { + wxString tmp(wxEmptyString); + swap(tmp); + } + + // contents test + // Is an ascii value + bool IsAscii() const; + // Is a number + bool IsNumber() const; + // Is a word + bool IsWord() const; + + // data access (all indexes are 0 based) + // read access + wxChar GetChar(size_t n) const + { return at(n); } + // read/write access + wxChar& GetWritableChar(size_t n) + { return at(n); } + // write access + void SetChar(size_t n, wxChar ch) + { at(n) = ch; } + + // get last character + wxChar Last() const + { + wxASSERT_MSG( !empty(), _T("wxString: index out of bounds") ); + + return at(length() - 1); + } + + // get writable last character + wxChar& Last() + { + wxASSERT_MSG( !empty(), _T("wxString: index out of bounds") ); + return at(length() - 1); + } + + /* + Note that we we must define all of the overloads below to avoid + ambiguity when using str[0]. Also note that for a conforming compiler we + don't need const version of operatorp[] at all as indexed access to + const string is provided by implicit conversion to "const wxChar *" + below and defining them would only result in ambiguities, but some other + compilers refuse to compile "str[0]" without them. + */ + +#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__MWERKS__) + wxChar operator[](int n) const + { return wxStringBase::at(n); } + wxChar operator[](size_type n) const + { return wxStringBase::at(n); } +#ifndef wxSIZE_T_IS_UINT + wxChar operator[](unsigned int n) const + { return wxStringBase::at(n); } +#endif // size_t != unsigned int +#endif // broken compiler + + + // operator versions of GetWriteableChar() + wxChar& operator[](int n) + { return wxStringBase::at(n); } + wxChar& operator[](size_type n) + { return wxStringBase::at(n); } +#ifndef wxSIZE_T_IS_UINT + wxChar& operator[](unsigned int n) + { return wxStringBase::at(n); } +#endif // size_t != unsigned int + + // implicit conversion to C string + operator const wxChar*() const { return c_str(); } + + // identical to c_str(), for wxWin 1.6x compatibility + const wxChar* wx_str() const { return c_str(); } + // identical to c_str(), for MFC compatibility + const wxChar* GetData() const { return c_str(); } + +#if wxABI_VERSION >= 20804 + // conversion to *non-const* multibyte or widestring buffer; modifying + // returned buffer won't affect the string, these methods are only useful + // for passing values to const-incorrect functions + wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const + { return mb_str(conv); } +#if wxUSE_WCHAR_T + wxWritableWCharBuffer wchar_str() const { return wc_str(wxConvLibc); } +#endif +#endif // wxABI_VERSION >= 20804 + + // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for + // converting numbers or strings which are certain not to contain special + // chars (typically system functions, X atoms, environment variables etc.) + // + // the behaviour of these functions with the strings containing anything + // else than 7 bit ASCII characters is undefined, use at your own risk. +#if wxUSE_UNICODE + static wxString FromAscii(const char *ascii); // string + static wxString FromAscii(const char ascii); // char + const wxCharBuffer ToAscii() const; +#else // ANSI + static wxString FromAscii(const char *ascii) { return wxString( ascii ); } + static wxString FromAscii(const char ascii) { return wxString( ascii ); } + const char *ToAscii() const { return c_str(); } +#endif // Unicode/!Unicode + +#if wxABI_VERSION >= 20804 + // conversion to/from UTF-8: +#if wxUSE_UNICODE + static wxString FromUTF8(const char *utf8) + { return wxString(utf8, wxConvUTF8); } + static wxString FromUTF8(const char *utf8, size_t len) + { return wxString(utf8, wxConvUTF8, len); } + const wxCharBuffer utf8_str() const { return mb_str(wxConvUTF8); } + const wxCharBuffer ToUTF8() const { return utf8_str(); } +#elif wxUSE_WCHAR_T // ANSI + static wxString FromUTF8(const char *utf8) + { return wxString(wxConvUTF8.cMB2WC(utf8)); } + static wxString FromUTF8(const char *utf8, size_t len) + { + size_t wlen; + wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); + return wxString(buf.data(), wxConvLibc, wlen); + } + const wxCharBuffer utf8_str() const + { return wxConvUTF8.cWC2MB(wc_str(wxConvLibc)); } + const wxCharBuffer ToUTF8() const { return utf8_str(); } +#endif // Unicode/ANSI +#endif // wxABI_VERSION >= 20804 + +#if wxABI_VERSION >= 20804 + // functions for storing binary data in wxString: +#if wxUSE_UNICODE + static wxString From8BitData(const char *data, size_t len) + { return wxString(data, wxConvISO8859_1, len); } + // version for NUL-terminated data: + static wxString From8BitData(const char *data) + { return wxString(data, wxConvISO8859_1); } + const wxCharBuffer To8BitData() const { return mb_str(wxConvISO8859_1); } +#else // ANSI + static wxString From8BitData(const char *data, size_t len) + { return wxString(data, len); } + // version for NUL-terminated data: + static wxString From8BitData(const char *data) + { return wxString(data); } + const char *To8BitData() const { return c_str(); } +#endif // Unicode/ANSI +#endif // wxABI_VERSION >= 20804 + + // conversions with (possible) format conversions: have to return a + // buffer with temporary data + // + // the functions defined (in either Unicode or ANSI) mode are mb_str() to + // return an ANSI (multibyte) string, wc_str() to return a wide string and + // fn_str() to return a string which should be used with the OS APIs + // accepting the file names. The return value is always the same, but the + // type differs because a function may either return pointer to the buffer + // directly or have to use intermediate buffer for translation. +#if wxUSE_UNICODE + const wxCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const; + + const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } + + const wxChar* wc_str() const { return c_str(); } + + // for compatibility with !wxUSE_UNICODE version + const wxChar* wc_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } + +#if wxMBFILES + const wxCharBuffer fn_str() const { return mb_str(wxConvFile); } +#else // !wxMBFILES + const wxChar* fn_str() const { return c_str(); } +#endif // wxMBFILES/!wxMBFILES +#else // ANSI + const wxChar* mb_str() const { return c_str(); } + + // for compatibility with wxUSE_UNICODE version + const wxChar* mb_str(const wxMBConv& WXUNUSED(conv)) const { return c_str(); } + + const wxWX2MBbuf mbc_str() const { return mb_str(); } + +#if wxUSE_WCHAR_T + const wxWCharBuffer wc_str(const wxMBConv& conv) const; +#endif // wxUSE_WCHAR_T +#ifdef __WXOSX__ + const wxCharBuffer fn_str() const { return wxConvFile.cWC2WX( wc_str( wxConvLocal ) ); } +#else + const wxChar* fn_str() const { return c_str(); } +#endif +#endif // Unicode/ANSI + + // overloaded assignment + // from another wxString + wxString& operator=(const wxStringBase& stringSrc) + { return (wxString&)wxStringBase::operator=(stringSrc); } + // from a character + wxString& operator=(wxChar ch) + { return (wxString&)wxStringBase::operator=(ch); } + // from a C string - STL probably will crash on NULL, + // so we need to compensate in that case +#if wxUSE_STL + wxString& operator=(const wxChar *psz) + { if(psz) wxStringBase::operator=(psz); else Clear(); return *this; } +#else + wxString& operator=(const wxChar *psz) + { return (wxString&)wxStringBase::operator=(psz); } +#endif + +#if wxUSE_UNICODE + // from wxWCharBuffer + wxString& operator=(const wxWCharBuffer& psz) + { (void) operator=((const wchar_t *)psz); return *this; } +#else // ANSI + // from another kind of C string + wxString& operator=(const unsigned char* psz); +#if wxUSE_WCHAR_T + // from a wide string + wxString& operator=(const wchar_t *pwz); +#endif + // from wxCharBuffer + wxString& operator=(const wxCharBuffer& psz) + { (void) operator=((const char *)psz); return *this; } +#endif // Unicode/ANSI + + // string concatenation + // in place concatenation + /* + Concatenate and return the result. Note that the left to right + associativity of << allows to write things like "str << str1 << str2 + << ..." (unlike with +=) + */ + // string += string + wxString& operator<<(const wxString& s) + { +#if !wxUSE_STL + wxASSERT_MSG( s.GetStringData()->IsValid(), + _T("did you forget to call UngetWriteBuf()?") ); +#endif + + append(s); + return *this; + } + // string += C string + wxString& operator<<(const wxChar *psz) + { append(psz); return *this; } + // string += char + wxString& operator<<(wxChar ch) { append(1, ch); return *this; } + + // string += buffer (i.e. from wxGetString) +#if wxUSE_UNICODE + wxString& operator<<(const wxWCharBuffer& s) + { (void)operator<<((const wchar_t *)s); return *this; } + void operator+=(const wxWCharBuffer& s) + { (void)operator<<((const wchar_t *)s); } +#else // !wxUSE_UNICODE + wxString& operator<<(const wxCharBuffer& s) + { (void)operator<<((const char *)s); return *this; } + void operator+=(const wxCharBuffer& s) + { (void)operator<<((const char *)s); } +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + + // string += C string + wxString& Append(const wxString& s) + { + // test for empty() to share the string if possible + if ( empty() ) + *this = s; + else + append(s); + return *this; + } + wxString& Append(const wxChar* psz) + { append(psz); return *this; } + // append count copies of given character + wxString& Append(wxChar ch, size_t count = 1u) + { append(count, ch); return *this; } + wxString& Append(const wxChar* psz, size_t nLen) + { append(psz, nLen); return *this; } + + // prepend a string, return the string itself + wxString& Prepend(const wxString& str) + { *this = str + *this; return *this; } + + // non-destructive concatenation + // two strings + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, + const wxString& string2); + // string with a single char + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); + // char with a string + friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); + // string with C string + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, + const wxChar *psz); + // C string with string + friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, + const wxString& string); + + // stream-like functions + // insert an int into string + wxString& operator<<(int i) + { return (*this) << Format(_T("%d"), i); } + // insert an unsigned int into string + wxString& operator<<(unsigned int ui) + { return (*this) << Format(_T("%u"), ui); } + // insert a long into string + wxString& operator<<(long l) + { return (*this) << Format(_T("%ld"), l); } + // insert an unsigned long into string + wxString& operator<<(unsigned long ul) + { return (*this) << Format(_T("%lu"), ul); } +#if defined wxLongLong_t && !defined wxLongLongIsLong + // insert a long long if they exist and aren't longs + wxString& operator<<(wxLongLong_t ll) + { + const wxChar *fmt = _T("%") wxLongLongFmtSpec _T("d"); + return (*this) << Format(fmt, ll); + } + // insert an unsigned long long + wxString& operator<<(wxULongLong_t ull) + { + const wxChar *fmt = _T("%") wxLongLongFmtSpec _T("u"); + return (*this) << Format(fmt , ull); + } +#endif + // insert a float into string + wxString& operator<<(float f) + { return (*this) << Format(_T("%f"), f); } + // insert a double into string + wxString& operator<<(double d) + { return (*this) << Format(_T("%g"), d); } + + // string comparison + // case-sensitive comparison (returns a value < 0, = 0 or > 0) + int Cmp(const wxChar *psz) const; + int Cmp(const wxString& s) const; + // same as Cmp() but not case-sensitive + int CmpNoCase(const wxChar *psz) const; + int CmpNoCase(const wxString& s) const; + // test for the string equality, either considering case or not + // (if compareWithCase then the case matters) + bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const + { return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; } + // comparison with a single character: returns true if equal + bool IsSameAs(wxChar c, bool compareWithCase = true) const + { + return (length() == 1) && (compareWithCase ? GetChar(0u) == c + : wxToupper(GetChar(0u)) == wxToupper(c)); + } + + // simple sub-string extraction + // return substring starting at nFirst of length nCount (or till the end + // if nCount = default value) + wxString Mid(size_t nFirst, size_t nCount = npos) const; + + // operator version of Mid() + wxString operator()(size_t start, size_t len) const + { return Mid(start, len); } + + // check if the string starts with the given prefix and return the rest + // of the string in the provided pointer if it is not NULL; otherwise + // return false + bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; + // check if the string ends with the given suffix and return the + // beginning of the string before the suffix in the provided pointer if + // it is not NULL; otherwise return false + bool EndsWith(const wxChar *suffix, wxString *rest = NULL) const; + + // get first nCount characters + wxString Left(size_t nCount) const; + // get last nCount characters + wxString Right(size_t nCount) const; + // get all characters before the first occurance of ch + // (returns the whole string if ch not found) + wxString BeforeFirst(wxChar ch) const; + // get all characters before the last occurence of ch + // (returns empty string if ch not found) + wxString BeforeLast(wxChar ch) const; + // get all characters after the first occurence of ch + // (returns empty string if ch not found) + wxString AfterFirst(wxChar ch) const; + // get all characters after the last occurence of ch + // (returns the whole string if ch not found) + wxString AfterLast(wxChar ch) const; + + // for compatibility only, use more explicitly named functions above + wxString Before(wxChar ch) const { return BeforeLast(ch); } + wxString After(wxChar ch) const { return AfterFirst(ch); } + + // case conversion + // convert to upper case in place, return the string itself + wxString& MakeUpper(); + // convert to upper case, return the copy of the string + // Here's something to remember: BC++ doesn't like returns in inlines. + wxString Upper() const ; + // convert to lower case in place, return the string itself + wxString& MakeLower(); + // convert to lower case, return the copy of the string + wxString Lower() const ; + + // trimming/padding whitespace (either side) and truncating + // remove spaces from left or from right (default) side + wxString& Trim(bool bFromRight = true); + // add nCount copies chPad in the beginning or at the end (default) + wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = true); + + // searching and replacing + // searching (return starting index, or -1 if not found) + int Find(wxChar ch, bool bFromEnd = false) const; // like strchr/strrchr + // searching (return starting index, or -1 if not found) + int Find(const wxChar *pszSub) const; // like strstr + // replace first (or all of bReplaceAll) occurences of substring with + // another string, returns the number of replacements made + size_t Replace(const wxChar *szOld, + const wxChar *szNew, + bool bReplaceAll = true); + + // check if the string contents matches a mask containing '*' and '?' + bool Matches(const wxChar *szMask) const; + + // conversion to numbers: all functions return true only if the whole + // string is a number and put the value of this number into the pointer + // provided, the base is the numeric base in which the conversion should be + // done and must be comprised between 2 and 36 or be 0 in which case the + // standard C rules apply (leading '0' => octal, "0x" => hex) + // convert to a signed integer + bool ToLong(long *val, int base = 10) const; + // convert to an unsigned integer + bool ToULong(unsigned long *val, int base = 10) const; + // convert to wxLongLong +#if defined(wxLongLong_t) + bool ToLongLong(wxLongLong_t *val, int base = 10) const; + // convert to wxULongLong + bool ToULongLong(wxULongLong_t *val, int base = 10) const; +#endif // wxLongLong_t + // convert to a double + bool ToDouble(double *val) const; + + + + // formatted input/output + // as sprintf(), returns the number of characters written or < 0 on error + // (take 'this' into account in attribute parameter count) + int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; + // as vprintf(), returns the number of characters written or < 0 on error + int PrintfV(const wxChar* pszFormat, va_list argptr); + + // returns the string containing the result of Printf() to it + static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1; + // the same as above, but takes a va_list + static wxString FormatV(const wxChar *pszFormat, va_list argptr); + + // raw access to string memory + // ensure that string has space for at least nLen characters + // only works if the data of this string is not shared + bool Alloc(size_t nLen) { reserve(nLen); /*return capacity() >= nLen;*/ return true; } + // minimize the string's memory + // only works if the data of this string is not shared + bool Shrink(); +#if !wxUSE_STL + // get writable buffer of at least nLen bytes. Unget() *must* be called + // a.s.a.p. to put string back in a reasonable state! + wxChar *GetWriteBuf(size_t nLen); + // call this immediately after GetWriteBuf() has been used + void UngetWriteBuf(); + void UngetWriteBuf(size_t nLen); +#endif + + // wxWidgets version 1 compatibility functions + + // use Mid() + wxString SubString(size_t from, size_t to) const + { return Mid(from, (to - from + 1)); } + // values for second parameter of CompareTo function + enum caseCompare {exact, ignoreCase}; + // values for first parameter of Strip function + enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; + + // use Printf() + // (take 'this' into account in attribute parameter count) + int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; + + // use Cmp() + inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const + { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); } + + // use Len + size_t Length() const { return length(); } + // Count the number of characters + int Freq(wxChar ch) const; + // use MakeLower + void LowerCase() { MakeLower(); } + // use MakeUpper + void UpperCase() { MakeUpper(); } + // use Trim except that it doesn't change this string + wxString Strip(stripType w = trailing) const; + + // use Find (more general variants not yet supported) + size_t Index(const wxChar* psz) const { return Find(psz); } + size_t Index(wxChar ch) const { return Find(ch); } + // use Truncate + wxString& Remove(size_t pos) { return Truncate(pos); } + wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); } + + wxString& Remove(size_t nStart, size_t nLen) + { return (wxString&)erase( nStart, nLen ); } + + // use Find() + int First( const wxChar ch ) const { return Find(ch); } + int First( const wxChar* psz ) const { return Find(psz); } + int First( const wxString &str ) const { return Find(str); } + int Last( const wxChar ch ) const { return Find(ch, true); } + bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; } + + // use empty() + bool IsNull() const { return empty(); } + + // std::string compatibility functions + + // take nLen chars starting at nPos + wxString(const wxString& str, size_t nPos, size_t nLen) + : wxStringBase(str, nPos, nLen) { } + // take all characters from pStart to pEnd + wxString(const void *pStart, const void *pEnd) + : wxStringBase((const wxChar*)pStart, (const wxChar*)pEnd) { } +#if wxUSE_STL + wxString(const_iterator first, const_iterator last) + : wxStringBase(first, last) { } +#endif + + // lib.string.modifiers + // append elements str[pos], ..., str[pos+n] + wxString& append(const wxString& str, size_t pos, size_t n) + { return (wxString&)wxStringBase::append(str, pos, n); } + // append a string + wxString& append(const wxString& str) + { return (wxString&)wxStringBase::append(str); } + // append first n (or all if n == npos) characters of sz + wxString& append(const wxChar *sz) + { return (wxString&)wxStringBase::append(sz); } + wxString& append(const wxChar *sz, size_t n) + { return (wxString&)wxStringBase::append(sz, n); } + // append n copies of ch + wxString& append(size_t n, wxChar ch) + { return (wxString&)wxStringBase::append(n, ch); } + // append from first to last + wxString& append(const_iterator first, const_iterator last) + { return (wxString&)wxStringBase::append(first, last); } + + // same as `this_string = str' + wxString& assign(const wxString& str) + { return (wxString&)wxStringBase::assign(str); } + // same as ` = str[pos..pos + n] + wxString& assign(const wxString& str, size_t pos, size_t n) + { return (wxString&)wxStringBase::assign(str, pos, n); } + // same as `= first n (or all if n == npos) characters of sz' + wxString& assign(const wxChar *sz) + { return (wxString&)wxStringBase::assign(sz); } + wxString& assign(const wxChar *sz, size_t n) + { return (wxString&)wxStringBase::assign(sz, n); } + // same as `= n copies of ch' + wxString& assign(size_t n, wxChar ch) + { return (wxString&)wxStringBase::assign(n, ch); } + // assign from first to last + wxString& assign(const_iterator first, const_iterator last) + { return (wxString&)wxStringBase::assign(first, last); } + + // string comparison +#if !defined(HAVE_STD_STRING_COMPARE) + int compare(const wxStringBase& str) const; + // comparison with a substring + int compare(size_t nStart, size_t nLen, const wxStringBase& str) const; + // comparison of 2 substrings + int compare(size_t nStart, size_t nLen, + const wxStringBase& str, size_t nStart2, size_t nLen2) const; + // just like strcmp() + int compare(const wxChar* sz) const; + // substring comparison with first nCount characters of sz + int compare(size_t nStart, size_t nLen, + const wxChar* sz, size_t nCount = npos) const; +#endif // !defined HAVE_STD_STRING_COMPARE + + // insert another string + wxString& insert(size_t nPos, const wxString& str) + { return (wxString&)wxStringBase::insert(nPos, str); } + // insert n chars of str starting at nStart (in str) + wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n) + { return (wxString&)wxStringBase::insert(nPos, str, nStart, n); } + // insert first n (or all if n == npos) characters of sz + wxString& insert(size_t nPos, const wxChar *sz) + { return (wxString&)wxStringBase::insert(nPos, sz); } + wxString& insert(size_t nPos, const wxChar *sz, size_t n) + { return (wxString&)wxStringBase::insert(nPos, sz, n); } + // insert n copies of ch + wxString& insert(size_t nPos, size_t n, wxChar ch) + { return (wxString&)wxStringBase::insert(nPos, n, ch); } + iterator insert(iterator it, wxChar ch) + { return wxStringBase::insert(it, ch); } + void insert(iterator it, const_iterator first, const_iterator last) + { wxStringBase::insert(it, first, last); } + void insert(iterator it, size_type n, wxChar ch) + { wxStringBase::insert(it, n, ch); } + + // delete characters from nStart to nStart + nLen + wxString& erase(size_type pos = 0, size_type n = npos) + { return (wxString&)wxStringBase::erase(pos, n); } + iterator erase(iterator first, iterator last) + { return wxStringBase::erase(first, last); } + iterator erase(iterator first) + { return wxStringBase::erase(first); } + +#ifdef wxSTRING_BASE_HASNT_CLEAR + void clear() { erase(); } +#endif + + // replaces the substring of length nLen starting at nStart + wxString& replace(size_t nStart, size_t nLen, const wxChar* sz) + { return (wxString&)wxStringBase::replace(nStart, nLen, sz); } + // replaces the substring of length nLen starting at nStart + wxString& replace(size_t nStart, size_t nLen, const wxString& str) + { return (wxString&)wxStringBase::replace(nStart, nLen, str); } + // replaces the substring with nCount copies of ch + wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxChar ch) + { return (wxString&)wxStringBase::replace(nStart, nLen, nCount, ch); } + // replaces a substring with another substring + wxString& replace(size_t nStart, size_t nLen, + const wxString& str, size_t nStart2, size_t nLen2) + { return (wxString&)wxStringBase::replace(nStart, nLen, str, + nStart2, nLen2); } + // replaces the substring with first nCount chars of sz + wxString& replace(size_t nStart, size_t nLen, + const wxChar* sz, size_t nCount) + { return (wxString&)wxStringBase::replace(nStart, nLen, sz, nCount); } + wxString& replace(iterator first, iterator last, const_pointer s) + { return (wxString&)wxStringBase::replace(first, last, s); } + wxString& replace(iterator first, iterator last, const_pointer s, + size_type n) + { return (wxString&)wxStringBase::replace(first, last, s, n); } + wxString& replace(iterator first, iterator last, const wxString& s) + { return (wxString&)wxStringBase::replace(first, last, s); } + wxString& replace(iterator first, iterator last, size_type n, wxChar c) + { return (wxString&)wxStringBase::replace(first, last, n, c); } + wxString& replace(iterator first, iterator last, + const_iterator first1, const_iterator last1) + { return (wxString&)wxStringBase::replace(first, last, first1, last1); } + + // string += string + wxString& operator+=(const wxString& s) + { return (wxString&)wxStringBase::operator+=(s); } + // string += C string + wxString& operator+=(const wxChar *psz) + { return (wxString&)wxStringBase::operator+=(psz); } + // string += char + wxString& operator+=(wxChar ch) + { return (wxString&)wxStringBase::operator+=(ch); } +}; + +// notice that even though for many compilers the friend declarations above are +// enough, from the point of view of C++ standard we must have the declarations +// here as friend ones are not injected in the enclosing namespace and without +// them the code fails to compile with conforming compilers such as xlC or g++4 +wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); +wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz); +wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); + + +// define wxArrayString, for compatibility +#if WXWIN_COMPATIBILITY_2_4 && !wxUSE_STL + #include "wx/arrstr.h" +#endif + +#if wxUSE_STL + // return an empty wxString (not very useful with wxUSE_STL == 1) + inline const wxString wxGetEmptyString() { return wxString(); } +#else // !wxUSE_STL + // return an empty wxString (more efficient than wxString() here) + inline const wxString& wxGetEmptyString() + { + return *(wxString *)&wxEmptyString; + } +#endif // wxUSE_STL/!wxUSE_STL + +// ---------------------------------------------------------------------------- +// wxStringBuffer: a tiny class allowing to get a writable pointer into string +// ---------------------------------------------------------------------------- + +#if wxUSE_STL + +class WXDLLIMPEXP_BASE wxStringBuffer +{ +public: + wxStringBuffer(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(lenWanted) + { } + + ~wxStringBuffer() { m_str.assign(m_buf.data(), wxStrlen(m_buf.data())); } + + operator wxChar*() { return m_buf.data(); } + +private: + wxString& m_str; +#if wxUSE_UNICODE + wxWCharBuffer m_buf; +#else + wxCharBuffer m_buf; +#endif + + DECLARE_NO_COPY_CLASS(wxStringBuffer) +}; + +class WXDLLIMPEXP_BASE wxStringBufferLength +{ +public: + wxStringBufferLength(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(lenWanted), m_len(0), m_lenSet(false) + { } + + ~wxStringBufferLength() + { + wxASSERT(m_lenSet); + m_str.assign(m_buf.data(), m_len); + } + + operator wxChar*() { return m_buf.data(); } + void SetLength(size_t length) { m_len = length; m_lenSet = true; } + +private: + wxString& m_str; +#if wxUSE_UNICODE + wxWCharBuffer m_buf; +#else + wxCharBuffer m_buf; +#endif + size_t m_len; + bool m_lenSet; + + DECLARE_NO_COPY_CLASS(wxStringBufferLength) +}; + +#else // if !wxUSE_STL + +class WXDLLIMPEXP_BASE wxStringBuffer +{ +public: + wxStringBuffer(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(NULL) + { m_buf = m_str.GetWriteBuf(lenWanted); } + + ~wxStringBuffer() { m_str.UngetWriteBuf(); } + + operator wxChar*() const { return m_buf; } + +private: + wxString& m_str; + wxChar *m_buf; + + DECLARE_NO_COPY_CLASS(wxStringBuffer) +}; + +class WXDLLIMPEXP_BASE wxStringBufferLength +{ +public: + wxStringBufferLength(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) + { + m_buf = m_str.GetWriteBuf(lenWanted); + wxASSERT(m_buf != NULL); + } + + ~wxStringBufferLength() + { + wxASSERT(m_lenSet); + m_str.UngetWriteBuf(m_len); + } + + operator wxChar*() const { return m_buf; } + void SetLength(size_t length) { m_len = length; m_lenSet = true; } + +private: + wxString& m_str; + wxChar *m_buf; + size_t m_len; + bool m_lenSet; + + DECLARE_NO_COPY_CLASS(wxStringBufferLength) +}; + +#endif // !wxUSE_STL + +// --------------------------------------------------------------------------- +// wxString comparison functions: operator versions are always case sensitive +// --------------------------------------------------------------------------- + +// note that when wxUSE_STL == 1 the comparison operators taking std::string +// are used and defining them also for wxString would only result in +// compilation ambiguities when comparing std::string and wxString +#if !wxUSE_STL + +inline bool operator==(const wxString& s1, const wxString& s2) + { return (s1.Len() == s2.Len()) && (s1.Cmp(s2) == 0); } +inline bool operator==(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) == 0; } +inline bool operator==(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) == 0; } +inline bool operator!=(const wxString& s1, const wxString& s2) + { return (s1.Len() != s2.Len()) || (s1.Cmp(s2) != 0); } +inline bool operator!=(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) != 0; } +inline bool operator!=(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) != 0; } +inline bool operator< (const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) < 0; } +inline bool operator< (const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) < 0; } +inline bool operator< (const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) > 0; } +inline bool operator> (const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) > 0; } +inline bool operator> (const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) > 0; } +inline bool operator> (const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) < 0; } +inline bool operator<=(const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) <= 0; } +inline bool operator<=(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) <= 0; } +inline bool operator<=(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) >= 0; } +inline bool operator>=(const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) >= 0; } +inline bool operator>=(const wxString& s1, const wxChar * s2) + { return s1.Cmp(s2) >= 0; } +inline bool operator>=(const wxChar * s1, const wxString& s2) + { return s2.Cmp(s1) <= 0; } + +#if wxUSE_UNICODE +inline bool operator==(const wxString& s1, const wxWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) == 0); } +inline bool operator==(const wxWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) != 0); } +inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) != 0); } +#else // !wxUSE_UNICODE +inline bool operator==(const wxString& s1, const wxCharBuffer& s2) + { return (s1.Cmp((const char *)s2) == 0); } +inline bool operator==(const wxCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxCharBuffer& s2) + { return (s1.Cmp((const char *)s2) != 0); } +inline bool operator!=(const wxCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) != 0); } +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + +#if wxUSE_UNICODE +inline wxString operator+(const wxString& string, const wxWCharBuffer& buf) + { return string + (const wchar_t *)buf; } +inline wxString operator+(const wxWCharBuffer& buf, const wxString& string) + { return (const wchar_t *)buf + string; } +#else // !wxUSE_UNICODE +inline wxString operator+(const wxString& string, const wxCharBuffer& buf) + { return string + (const char *)buf; } +inline wxString operator+(const wxCharBuffer& buf, const wxString& string) + { return (const char *)buf + string; } +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + +#endif // !wxUSE_STL + +// comparison with char (those are not defined by std::[w]string and so should +// be always available) +inline bool operator==(wxChar c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(const wxString& s, wxChar c) { return s.IsSameAs(c); } +inline bool operator!=(wxChar c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(const wxString& s, wxChar c) { return !s.IsSameAs(c); } + +// --------------------------------------------------------------------------- +// Implementation only from here until the end of file +// --------------------------------------------------------------------------- + +// don't pollute the library user's name space +#undef wxASSERT_VALID_INDEX + +#if wxUSE_STD_IOSTREAM + +#include "wx/iosfwrap.h" + +WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); + +#endif // wxSTD_STRING_COMPATIBILITY + +#endif // _WX_WXSTRINGH__ diff --git a/Externals/wxWidgets/include/wx/sysopt.h b/Externals/wxWidgets/include/wx/sysopt.h index 5c79a5478e..cff3412fff 100644 --- a/Externals/wxWidgets/include/wx/sysopt.h +++ b/Externals/wxWidgets/include/wx/sysopt.h @@ -1,71 +1,71 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sysopt.h -// Purpose: wxSystemOptions -// Author: Julian Smart -// Modified by: -// Created: 2001-07-10 -// RCS-ID: $Id: sysopt.h 33004 2005-03-23 20:48:50Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SYSOPT_H_ -#define _WX_SYSOPT_H_ - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// Enables an application to influence the wxWidgets implementation -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSystemOptions : public wxObject -{ -public: - wxSystemOptions() { } - - // User-customizable hints to wxWidgets or associated libraries - // These could also be used to influence GetSystem... calls, indeed - // to implement SetSystemColour/Font/Metric - -#if wxUSE_SYSTEM_OPTIONS - static void SetOption(const wxString& name, const wxString& value); - static void SetOption(const wxString& name, int value); -#endif // wxUSE_SYSTEM_OPTIONS - static wxString GetOption(const wxString& name); - static int GetOptionInt(const wxString& name); - static bool HasOption(const wxString& name); - - static bool IsFalse(const wxString& name) - { - return HasOption(name) && GetOptionInt(name) == 0; - } -}; - -#if !wxUSE_SYSTEM_OPTIONS - -// define inline stubs for accessors to make it possible to use wxSystemOptions -// in the library itself without checking for wxUSE_SYSTEM_OPTIONS all the time - -/* static */ inline -wxString wxSystemOptions::GetOption(const wxString& WXUNUSED(name)) -{ - return wxEmptyString; -} - -/* static */ inline -int wxSystemOptions::GetOptionInt(const wxString& WXUNUSED(name)) -{ - return 0; -} - -/* static */ inline -bool wxSystemOptions::HasOption(const wxString& WXUNUSED(name)) -{ - return false; -} - -#endif // !wxUSE_SYSTEM_OPTIONS - -#endif - // _WX_SYSOPT_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: sysopt.h +// Purpose: wxSystemOptions +// Author: Julian Smart +// Modified by: +// Created: 2001-07-10 +// RCS-ID: $Id: sysopt.h 33004 2005-03-23 20:48:50Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SYSOPT_H_ +#define _WX_SYSOPT_H_ + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// Enables an application to influence the wxWidgets implementation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSystemOptions : public wxObject +{ +public: + wxSystemOptions() { } + + // User-customizable hints to wxWidgets or associated libraries + // These could also be used to influence GetSystem... calls, indeed + // to implement SetSystemColour/Font/Metric + +#if wxUSE_SYSTEM_OPTIONS + static void SetOption(const wxString& name, const wxString& value); + static void SetOption(const wxString& name, int value); +#endif // wxUSE_SYSTEM_OPTIONS + static wxString GetOption(const wxString& name); + static int GetOptionInt(const wxString& name); + static bool HasOption(const wxString& name); + + static bool IsFalse(const wxString& name) + { + return HasOption(name) && GetOptionInt(name) == 0; + } +}; + +#if !wxUSE_SYSTEM_OPTIONS + +// define inline stubs for accessors to make it possible to use wxSystemOptions +// in the library itself without checking for wxUSE_SYSTEM_OPTIONS all the time + +/* static */ inline +wxString wxSystemOptions::GetOption(const wxString& WXUNUSED(name)) +{ + return wxEmptyString; +} + +/* static */ inline +int wxSystemOptions::GetOptionInt(const wxString& WXUNUSED(name)) +{ + return 0; +} + +/* static */ inline +bool wxSystemOptions::HasOption(const wxString& WXUNUSED(name)) +{ + return false; +} + +#endif // !wxUSE_SYSTEM_OPTIONS + +#endif + // _WX_SYSOPT_H_ + diff --git a/Externals/wxWidgets/include/wx/tab.h b/Externals/wxWidgets/include/wx/tab.h index 630d982e81..01ff4ede4e 100644 --- a/Externals/wxWidgets/include/wx/tab.h +++ b/Externals/wxWidgets/include/wx/tab.h @@ -1,22 +1,22 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tab.h -// Purpose: Generic tab class base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: tab.h 37400 2006-02-09 00:28:34Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TAB_H_BASE_ -#define _WX_TAB_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TAB_DIALOG -#include "wx/generic/tabg.h" -#endif - -#endif - // _WX_TAB_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tab.h +// Purpose: Generic tab class base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: tab.h 37400 2006-02-09 00:28:34Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TAB_H_BASE_ +#define _WX_TAB_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TAB_DIALOG +#include "wx/generic/tabg.h" +#endif + +#endif + // _WX_TAB_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/tabctrl.h b/Externals/wxWidgets/include/wx/tabctrl.h index 56e22c22ac..bba2fdbc54 100644 --- a/Externals/wxWidgets/include/wx/tabctrl.h +++ b/Externals/wxWidgets/include/wx/tabctrl.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tabctrl.h -// Purpose: wxTabCtrl base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: tabctrl.h 38943 2006-04-28 10:14:27Z ABX $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_BASE_ -#define _WX_TABCTRL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TAB_DIALOG - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED, 800) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING, 801) -END_DECLARE_EVENT_TYPES() - -#if defined(__WXMSW__) - #include "wx/msw/tabctrl.h" -#elif defined(__WXMAC__) - #include "wx/mac/tabctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/tabctrl.h" -#endif - -#endif // wxUSE_TAB_DIALOG -#endif - // _WX_TABCTRL_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tabctrl.h +// Purpose: wxTabCtrl base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: tabctrl.h 38943 2006-04-28 10:14:27Z ABX $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TABCTRL_H_BASE_ +#define _WX_TABCTRL_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TAB_DIALOG + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED, 800) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING, 801) +END_DECLARE_EVENT_TYPES() + +#if defined(__WXMSW__) + #include "wx/msw/tabctrl.h" +#elif defined(__WXMAC__) + #include "wx/mac/tabctrl.h" +#elif defined(__WXPM__) + #include "wx/os2/tabctrl.h" +#endif + +#endif // wxUSE_TAB_DIALOG +#endif + // _WX_TABCTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/tarstrm.h b/Externals/wxWidgets/include/wx/tarstrm.h index c18400225f..eb76bc340c 100644 --- a/Externals/wxWidgets/include/wx/tarstrm.h +++ b/Externals/wxWidgets/include/wx/tarstrm.h @@ -1,352 +1,352 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tarstrm.h -// Purpose: Streams for Tar files -// Author: Mike Wetherell -// RCS-ID: $Id: tarstrm.h 43887 2006-12-09 22:28:11Z MW $ -// Copyright: (c) 2004 Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXTARSTREAM_H__ -#define _WX_WXTARSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_TARSTREAM - -#include "wx/archive.h" -#include "wx/hashmap.h" - - -///////////////////////////////////////////////////////////////////////////// -// Constants - -// TypeFlag values -enum { - wxTAR_REGTYPE = '0', // regular file - wxTAR_LNKTYPE = '1', // hard link - wxTAR_SYMTYPE = '2', // symbolic link - wxTAR_CHRTYPE = '3', // character special - wxTAR_BLKTYPE = '4', // block special - wxTAR_DIRTYPE = '5', // directory - wxTAR_FIFOTYPE = '6', // named pipe - wxTAR_CONTTYPE = '7' // contiguous file -}; - -// Archive Formats (use wxTAR_PAX, it's backward compatible) -enum wxTarFormat -{ - wxTAR_USTAR, // POSIX.1-1990 tar format - wxTAR_PAX // POSIX.1-2001 tar format -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxTarNotifier - -class WXDLLIMPEXP_BASE wxTarNotifier -{ -public: - virtual ~wxTarNotifier() { } - - virtual void OnEntryUpdated(class wxTarEntry& entry) = 0; -}; - - -///////////////////////////////////////////////////////////////////////////// -// Tar Entry - hold the meta data for a file in the tar - -class WXDLLIMPEXP_BASE wxTarEntry : public wxArchiveEntry -{ -public: - wxTarEntry(const wxString& name = wxEmptyString, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - virtual ~wxTarEntry(); - - wxTarEntry(const wxTarEntry& entry); - wxTarEntry& operator=(const wxTarEntry& entry); - - // Get accessors - wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; - wxString GetInternalName() const { return m_Name; } - wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } - int GetMode() const; - int GetUserId() const { return m_UserId; } - int GetGroupId() const { return m_GroupId; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxDateTime GetDateTime() const { return m_ModifyTime; } - wxDateTime GetAccessTime() const { return m_AccessTime; } - wxDateTime GetCreateTime() const { return m_CreateTime; } - int GetTypeFlag() const { return m_TypeFlag; } - wxString GetLinkName() const { return m_LinkName; } - wxString GetUserName() const { return m_UserName; } - wxString GetGroupName() const { return m_GroupName; } - int GetDevMajor() const { return m_DevMajor; } - int GetDevMinor() const { return m_DevMinor; } - - // is accessors - bool IsDir() const; - bool IsReadOnly() const { return !(m_Mode & 0222); } - - // set accessors - void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE); - void SetUserId(int id) { m_UserId = id; } - void SetGroupId(int id) { m_GroupId = id; } - void SetMode(int mode); - void SetSize(wxFileOffset size) { m_Size = size; } - void SetDateTime(const wxDateTime& dt) { m_ModifyTime = dt; } - void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; } - void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; } - void SetTypeFlag(int type) { m_TypeFlag = type; } - void SetLinkName(const wxString& link) { m_LinkName = link; } - void SetUserName(const wxString& user) { m_UserName = user; } - void SetGroupName(const wxString& group) { m_GroupName = group; } - void SetDevMajor(int dev) { m_DevMajor = dev; } - void SetDevMinor(int dev) { m_DevMinor = dev; } - - // set is accessors - void SetIsDir(bool isDir = true); - void SetIsReadOnly(bool isReadOnly = true); - - static wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE, - bool *pIsDir = NULL); - - wxTarEntry *Clone() const { return new wxTarEntry(*this); } - - void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { } - -private: - void SetOffset(wxFileOffset offset) { m_Offset = offset; } - - virtual wxArchiveEntry* DoClone() const { return Clone(); } - - wxString m_Name; - int m_Mode; - bool m_IsModeSet; - int m_UserId; - int m_GroupId; - wxFileOffset m_Size; - wxFileOffset m_Offset; - wxDateTime m_ModifyTime; - wxDateTime m_AccessTime; - wxDateTime m_CreateTime; - int m_TypeFlag; - wxString m_LinkName; - wxString m_UserName; - wxString m_GroupName; - int m_DevMajor; - int m_DevMinor; - - friend class wxTarInputStream; - - DECLARE_DYNAMIC_CLASS(wxTarEntry) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxTarInputStream - -WX_DECLARE_STRING_HASH_MAP(wxString, wxTarHeaderRecords); - -class WXDLLIMPEXP_BASE wxTarInputStream : public wxArchiveInputStream -{ -public: - typedef wxTarEntry entry_type; - - wxTarInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); - wxTarInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); - virtual ~wxTarInputStream(); - - bool OpenEntry(wxTarEntry& entry); - bool CloseEntry(); - - wxTarEntry *GetNextEntry(); - - wxFileOffset GetLength() const { return m_size; } - bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } - -protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - -private: - void Init(); - - wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } - bool OpenEntry(wxArchiveEntry& entry); - bool IsOpened() const { return m_pos != wxInvalidOffset; } - - wxStreamError ReadHeaders(); - bool ReadExtendedHeader(wxTarHeaderRecords*& recs); - - wxString GetExtendedHeader(const wxString& key) const; - wxString GetHeaderPath() const; - wxFileOffset GetHeaderNumber(int id) const; - wxString GetHeaderString(int id) const; - wxDateTime GetHeaderDate(const wxString& key) const; - - wxFileOffset m_pos; // position within the current entry - wxFileOffset m_offset; // offset to the start of the entry's data - wxFileOffset m_size; // size of the current entry's data - - int m_sumType; - int m_tarType; - class wxTarHeaderBlock *m_hdr; - wxTarHeaderRecords *m_HeaderRecs; - wxTarHeaderRecords *m_GlobalHeaderRecs; - - DECLARE_NO_COPY_CLASS(wxTarInputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxTarOutputStream - -class WXDLLIMPEXP_BASE wxTarOutputStream : public wxArchiveOutputStream -{ -public: - wxTarOutputStream(wxOutputStream& stream, - wxTarFormat format = wxTAR_PAX, - wxMBConv& conv = wxConvLocal); - wxTarOutputStream(wxOutputStream *stream, - wxTarFormat format = wxTAR_PAX, - wxMBConv& conv = wxConvLocal); - virtual ~wxTarOutputStream(); - - bool PutNextEntry(wxTarEntry *entry); - - bool PutNextEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - - bool PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()); - - bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream); - bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; } - - void Sync(); - bool CloseEntry(); - bool Close(); - - bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } - - void SetBlockingFactor(int factor) { m_BlockingFactor = factor; } - int GetBlockingFactor() const { return m_BlockingFactor; } - -protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - -private: - void Init(wxTarFormat format); - - bool PutNextEntry(wxArchiveEntry *entry); - bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); - bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) { return true; } - bool IsOpened() const { return m_pos != wxInvalidOffset; } - - bool WriteHeaders(wxTarEntry& entry); - bool ModifyHeader(); - wxString PaxHeaderPath(const wxString& format, const wxString& path); - - void SetExtendedHeader(const wxString& key, const wxString& value); - void SetHeaderPath(const wxString& name); - bool SetHeaderNumber(int id, wxFileOffset n); - void SetHeaderString(int id, const wxString& str); - void SetHeaderDate(const wxString& key, const wxDateTime& datetime); - - wxFileOffset m_pos; // position within the current entry - wxFileOffset m_maxpos; // max pos written - wxFileOffset m_size; // expected entry size - - wxFileOffset m_headpos; // offset within the file to the entry's header - wxFileOffset m_datapos; // offset within the file to the entry's data - - wxFileOffset m_tarstart;// offset within the file to the tar - wxFileOffset m_tarsize; // size of tar so far - - bool m_pax; - int m_BlockingFactor; - wxUint32 m_chksum; - bool m_large; - class wxTarHeaderBlock *m_hdr; - class wxTarHeaderBlock *m_hdr2; - char *m_extendedHdr; - size_t m_extendedSize; - wxString m_badfit; - - DECLARE_NO_COPY_CLASS(wxTarOutputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// Iterators - -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR -typedef wxArchiveIterator<wxTarInputStream> wxTarIter; -typedef wxArchiveIterator<wxTarInputStream, - std::pair<wxString, wxTarEntry*> > wxTarPairIter; -#endif - - -///////////////////////////////////////////////////////////////////////////// -// wxTarClassFactory - -class WXDLLIMPEXP_BASE wxTarClassFactory : public wxArchiveClassFactory -{ -public: - typedef wxTarEntry entry_type; - typedef wxTarInputStream instream_type; - typedef wxTarOutputStream outstream_type; - typedef wxTarNotifier notifier_type; -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - typedef wxTarIter iter_type; - typedef wxTarPairIter pairiter_type; -#endif - - wxTarClassFactory(); - - wxTarEntry *NewEntry() const - { return new wxTarEntry; } - wxTarInputStream *NewStream(wxInputStream& stream) const - { return new wxTarInputStream(stream, GetConv()); } - wxTarOutputStream *NewStream(wxOutputStream& stream) const - { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } - wxTarInputStream *NewStream(wxInputStream *stream) const - { return new wxTarInputStream(stream, GetConv()); } - wxTarOutputStream *NewStream(wxOutputStream *stream) const - { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } - - wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const - { return wxTarEntry::GetInternalName(name, format); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -protected: - wxArchiveEntry *DoNewEntry() const - { return NewEntry(); } - wxArchiveInputStream *DoNewStream(wxInputStream& stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const - { return NewStream(stream); } - wxArchiveInputStream *DoNewStream(wxInputStream *stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const - { return NewStream(stream); } - -private: - DECLARE_DYNAMIC_CLASS(wxTarClassFactory) -}; - - -#endif // wxUSE_TARSTREAM - -#endif // _WX_WXTARSTREAM_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tarstrm.h +// Purpose: Streams for Tar files +// Author: Mike Wetherell +// RCS-ID: $Id: tarstrm.h 43887 2006-12-09 22:28:11Z MW $ +// Copyright: (c) 2004 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXTARSTREAM_H__ +#define _WX_WXTARSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_TARSTREAM + +#include "wx/archive.h" +#include "wx/hashmap.h" + + +///////////////////////////////////////////////////////////////////////////// +// Constants + +// TypeFlag values +enum { + wxTAR_REGTYPE = '0', // regular file + wxTAR_LNKTYPE = '1', // hard link + wxTAR_SYMTYPE = '2', // symbolic link + wxTAR_CHRTYPE = '3', // character special + wxTAR_BLKTYPE = '4', // block special + wxTAR_DIRTYPE = '5', // directory + wxTAR_FIFOTYPE = '6', // named pipe + wxTAR_CONTTYPE = '7' // contiguous file +}; + +// Archive Formats (use wxTAR_PAX, it's backward compatible) +enum wxTarFormat +{ + wxTAR_USTAR, // POSIX.1-1990 tar format + wxTAR_PAX // POSIX.1-2001 tar format +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxTarNotifier + +class WXDLLIMPEXP_BASE wxTarNotifier +{ +public: + virtual ~wxTarNotifier() { } + + virtual void OnEntryUpdated(class wxTarEntry& entry) = 0; +}; + + +///////////////////////////////////////////////////////////////////////////// +// Tar Entry - hold the meta data for a file in the tar + +class WXDLLIMPEXP_BASE wxTarEntry : public wxArchiveEntry +{ +public: + wxTarEntry(const wxString& name = wxEmptyString, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset); + virtual ~wxTarEntry(); + + wxTarEntry(const wxTarEntry& entry); + wxTarEntry& operator=(const wxTarEntry& entry); + + // Get accessors + wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; + wxString GetInternalName() const { return m_Name; } + wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } + int GetMode() const; + int GetUserId() const { return m_UserId; } + int GetGroupId() const { return m_GroupId; } + wxFileOffset GetSize() const { return m_Size; } + wxFileOffset GetOffset() const { return m_Offset; } + wxDateTime GetDateTime() const { return m_ModifyTime; } + wxDateTime GetAccessTime() const { return m_AccessTime; } + wxDateTime GetCreateTime() const { return m_CreateTime; } + int GetTypeFlag() const { return m_TypeFlag; } + wxString GetLinkName() const { return m_LinkName; } + wxString GetUserName() const { return m_UserName; } + wxString GetGroupName() const { return m_GroupName; } + int GetDevMajor() const { return m_DevMajor; } + int GetDevMinor() const { return m_DevMinor; } + + // is accessors + bool IsDir() const; + bool IsReadOnly() const { return !(m_Mode & 0222); } + + // set accessors + void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE); + void SetUserId(int id) { m_UserId = id; } + void SetGroupId(int id) { m_GroupId = id; } + void SetMode(int mode); + void SetSize(wxFileOffset size) { m_Size = size; } + void SetDateTime(const wxDateTime& dt) { m_ModifyTime = dt; } + void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; } + void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; } + void SetTypeFlag(int type) { m_TypeFlag = type; } + void SetLinkName(const wxString& link) { m_LinkName = link; } + void SetUserName(const wxString& user) { m_UserName = user; } + void SetGroupName(const wxString& group) { m_GroupName = group; } + void SetDevMajor(int dev) { m_DevMajor = dev; } + void SetDevMinor(int dev) { m_DevMinor = dev; } + + // set is accessors + void SetIsDir(bool isDir = true); + void SetIsReadOnly(bool isReadOnly = true); + + static wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE, + bool *pIsDir = NULL); + + wxTarEntry *Clone() const { return new wxTarEntry(*this); } + + void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { } + +private: + void SetOffset(wxFileOffset offset) { m_Offset = offset; } + + virtual wxArchiveEntry* DoClone() const { return Clone(); } + + wxString m_Name; + int m_Mode; + bool m_IsModeSet; + int m_UserId; + int m_GroupId; + wxFileOffset m_Size; + wxFileOffset m_Offset; + wxDateTime m_ModifyTime; + wxDateTime m_AccessTime; + wxDateTime m_CreateTime; + int m_TypeFlag; + wxString m_LinkName; + wxString m_UserName; + wxString m_GroupName; + int m_DevMajor; + int m_DevMinor; + + friend class wxTarInputStream; + + DECLARE_DYNAMIC_CLASS(wxTarEntry) +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxTarInputStream + +WX_DECLARE_STRING_HASH_MAP(wxString, wxTarHeaderRecords); + +class WXDLLIMPEXP_BASE wxTarInputStream : public wxArchiveInputStream +{ +public: + typedef wxTarEntry entry_type; + + wxTarInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); + wxTarInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); + virtual ~wxTarInputStream(); + + bool OpenEntry(wxTarEntry& entry); + bool CloseEntry(); + + wxTarEntry *GetNextEntry(); + + wxFileOffset GetLength() const { return m_size; } + bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } + +protected: + size_t OnSysRead(void *buffer, size_t size); + wxFileOffset OnSysTell() const { return m_pos; } + wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); + +private: + void Init(); + + wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } + bool OpenEntry(wxArchiveEntry& entry); + bool IsOpened() const { return m_pos != wxInvalidOffset; } + + wxStreamError ReadHeaders(); + bool ReadExtendedHeader(wxTarHeaderRecords*& recs); + + wxString GetExtendedHeader(const wxString& key) const; + wxString GetHeaderPath() const; + wxFileOffset GetHeaderNumber(int id) const; + wxString GetHeaderString(int id) const; + wxDateTime GetHeaderDate(const wxString& key) const; + + wxFileOffset m_pos; // position within the current entry + wxFileOffset m_offset; // offset to the start of the entry's data + wxFileOffset m_size; // size of the current entry's data + + int m_sumType; + int m_tarType; + class wxTarHeaderBlock *m_hdr; + wxTarHeaderRecords *m_HeaderRecs; + wxTarHeaderRecords *m_GlobalHeaderRecs; + + DECLARE_NO_COPY_CLASS(wxTarInputStream) +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxTarOutputStream + +class WXDLLIMPEXP_BASE wxTarOutputStream : public wxArchiveOutputStream +{ +public: + wxTarOutputStream(wxOutputStream& stream, + wxTarFormat format = wxTAR_PAX, + wxMBConv& conv = wxConvLocal); + wxTarOutputStream(wxOutputStream *stream, + wxTarFormat format = wxTAR_PAX, + wxMBConv& conv = wxConvLocal); + virtual ~wxTarOutputStream(); + + bool PutNextEntry(wxTarEntry *entry); + + bool PutNextEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset); + + bool PutNextDirEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now()); + + bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream); + bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; } + + void Sync(); + bool CloseEntry(); + bool Close(); + + bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } + + void SetBlockingFactor(int factor) { m_BlockingFactor = factor; } + int GetBlockingFactor() const { return m_BlockingFactor; } + +protected: + size_t OnSysWrite(const void *buffer, size_t size); + wxFileOffset OnSysTell() const { return m_pos; } + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + +private: + void Init(wxTarFormat format); + + bool PutNextEntry(wxArchiveEntry *entry); + bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); + bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) { return true; } + bool IsOpened() const { return m_pos != wxInvalidOffset; } + + bool WriteHeaders(wxTarEntry& entry); + bool ModifyHeader(); + wxString PaxHeaderPath(const wxString& format, const wxString& path); + + void SetExtendedHeader(const wxString& key, const wxString& value); + void SetHeaderPath(const wxString& name); + bool SetHeaderNumber(int id, wxFileOffset n); + void SetHeaderString(int id, const wxString& str); + void SetHeaderDate(const wxString& key, const wxDateTime& datetime); + + wxFileOffset m_pos; // position within the current entry + wxFileOffset m_maxpos; // max pos written + wxFileOffset m_size; // expected entry size + + wxFileOffset m_headpos; // offset within the file to the entry's header + wxFileOffset m_datapos; // offset within the file to the entry's data + + wxFileOffset m_tarstart;// offset within the file to the tar + wxFileOffset m_tarsize; // size of tar so far + + bool m_pax; + int m_BlockingFactor; + wxUint32 m_chksum; + bool m_large; + class wxTarHeaderBlock *m_hdr; + class wxTarHeaderBlock *m_hdr2; + char *m_extendedHdr; + size_t m_extendedSize; + wxString m_badfit; + + DECLARE_NO_COPY_CLASS(wxTarOutputStream) +}; + + +///////////////////////////////////////////////////////////////////////////// +// Iterators + +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR +typedef wxArchiveIterator<wxTarInputStream> wxTarIter; +typedef wxArchiveIterator<wxTarInputStream, + std::pair<wxString, wxTarEntry*> > wxTarPairIter; +#endif + + +///////////////////////////////////////////////////////////////////////////// +// wxTarClassFactory + +class WXDLLIMPEXP_BASE wxTarClassFactory : public wxArchiveClassFactory +{ +public: + typedef wxTarEntry entry_type; + typedef wxTarInputStream instream_type; + typedef wxTarOutputStream outstream_type; + typedef wxTarNotifier notifier_type; +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + typedef wxTarIter iter_type; + typedef wxTarPairIter pairiter_type; +#endif + + wxTarClassFactory(); + + wxTarEntry *NewEntry() const + { return new wxTarEntry; } + wxTarInputStream *NewStream(wxInputStream& stream) const + { return new wxTarInputStream(stream, GetConv()); } + wxTarOutputStream *NewStream(wxOutputStream& stream) const + { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } + wxTarInputStream *NewStream(wxInputStream *stream) const + { return new wxTarInputStream(stream, GetConv()); } + wxTarOutputStream *NewStream(wxOutputStream *stream) const + { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } + + wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) const + { return wxTarEntry::GetInternalName(name, format); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const; + +protected: + wxArchiveEntry *DoNewEntry() const + { return NewEntry(); } + wxArchiveInputStream *DoNewStream(wxInputStream& stream) const + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const + { return NewStream(stream); } + wxArchiveInputStream *DoNewStream(wxInputStream *stream) const + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const + { return NewStream(stream); } + +private: + DECLARE_DYNAMIC_CLASS(wxTarClassFactory) +}; + + +#endif // wxUSE_TARSTREAM + +#endif // _WX_WXTARSTREAM_H__ diff --git a/Externals/wxWidgets/include/wx/taskbar.h b/Externals/wxWidgets/include/wx/taskbar.h index 7cdd1cc3ad..3a26e78a8f 100644 --- a/Externals/wxWidgets/include/wx/taskbar.h +++ b/Externals/wxWidgets/include/wx/taskbar.h @@ -1,124 +1,124 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/taskbar.h -// Purpose: wxTaskBarIcon base header and class -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id: taskbar.h 53135 2008-04-12 02:31:04Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TASKBAR_H_BASE_ -#define _WX_TASKBAR_H_BASE_ - -#include "wx/defs.h" - -#ifdef wxHAS_TASK_BAR_ICON - -#include "wx/event.h" - -class WXDLLIMPEXP_FWD_ADV wxTaskBarIconEvent; - -// ---------------------------------------------------------------------------- -// wxTaskBarIconBase: define wxTaskBarIcon interface -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler -{ -public: - wxTaskBarIconBase() { } - - // Operations: - virtual bool SetIcon(const wxIcon& icon, - const wxString& tooltip = wxEmptyString) = 0; - virtual bool RemoveIcon() = 0; - virtual bool PopupMenu(wxMenu *menu) = 0; - -protected: - // creates menu to be displayed when user clicks on the icon - virtual wxMenu *CreatePopupMenu() { return NULL; } - -private: - // default events handling, calls CreatePopupMenu: - void OnRightButtonDown(wxTaskBarIconEvent& event); - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTaskBarIconBase) -}; - - -// ---------------------------------------------------------------------------- -// now include the actual class declaration -// ---------------------------------------------------------------------------- - -#if defined(__WXPALMOS__) - #include "wx/palmos/taskbar.h" -#elif defined(__WXMSW__) - #include "wx/msw/taskbar.h" -#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) - #include "wx/unix/taskbarx11.h" -#elif defined (__WXMAC__) && defined(__WXMAC_OSX__) - #include "wx/mac/taskbarosx.h" -#elif defined (__WXCOCOA__) - #include "wx/cocoa/taskbar.h" -#endif - -// ---------------------------------------------------------------------------- -// wxTaskBarIcon events -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent -{ -public: - wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon) - : wxEvent(wxID_ANY, evtType) - { - SetEventObject(tbIcon); - } - - virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); } - -private: - DECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent) -}; - -typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&); - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_MOVE,1550) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DOWN,1551) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_UP,1552) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DOWN,1553) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_UP,1554) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DCLICK,1555) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DCLICK,1556) -END_DECLARE_EVENT_TYPES() - -#define wxTaskBarIconEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTaskBarIconEventFunction, &func) - -#define wx__DECLARE_TASKBAREVT(evt, fn) \ - wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn)) - -#define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn) -#define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn) -#define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn) -#define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn) -#define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn) -#define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn) -#define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn) - -// taskbar menu is shown on right button press under all platforms except MSW -// where it's shown on right button release, using this event type and macro -// allows to write code which works correctly on all platforms -#ifdef __WXMSW__ - #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP -#else - #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN -#endif -#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn) - -#endif // wxHAS_TASK_BAR_ICON - -#endif // _WX_TASKBAR_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/taskbar.h +// Purpose: wxTaskBarIcon base header and class +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// RCS-ID: $Id: taskbar.h 53135 2008-04-12 02:31:04Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TASKBAR_H_BASE_ +#define _WX_TASKBAR_H_BASE_ + +#include "wx/defs.h" + +#ifdef wxHAS_TASK_BAR_ICON + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_ADV wxTaskBarIconEvent; + +// ---------------------------------------------------------------------------- +// wxTaskBarIconBase: define wxTaskBarIcon interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler +{ +public: + wxTaskBarIconBase() { } + + // Operations: + virtual bool SetIcon(const wxIcon& icon, + const wxString& tooltip = wxEmptyString) = 0; + virtual bool RemoveIcon() = 0; + virtual bool PopupMenu(wxMenu *menu) = 0; + +protected: + // creates menu to be displayed when user clicks on the icon + virtual wxMenu *CreatePopupMenu() { return NULL; } + +private: + // default events handling, calls CreatePopupMenu: + void OnRightButtonDown(wxTaskBarIconEvent& event); + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxTaskBarIconBase) +}; + + +// ---------------------------------------------------------------------------- +// now include the actual class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXPALMOS__) + #include "wx/palmos/taskbar.h" +#elif defined(__WXMSW__) + #include "wx/msw/taskbar.h" +#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) + #include "wx/unix/taskbarx11.h" +#elif defined (__WXMAC__) && defined(__WXMAC_OSX__) + #include "wx/mac/taskbarosx.h" +#elif defined (__WXCOCOA__) + #include "wx/cocoa/taskbar.h" +#endif + +// ---------------------------------------------------------------------------- +// wxTaskBarIcon events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent +{ +public: + wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon) + : wxEvent(wxID_ANY, evtType) + { + SetEventObject(tbIcon); + } + + virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); } + +private: + DECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent) +}; + +typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&); + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_MOVE,1550) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DOWN,1551) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_UP,1552) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DOWN,1553) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_UP,1554) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DCLICK,1555) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DCLICK,1556) +END_DECLARE_EVENT_TYPES() + +#define wxTaskBarIconEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTaskBarIconEventFunction, &func) + +#define wx__DECLARE_TASKBAREVT(evt, fn) \ + wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn)) + +#define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn) +#define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn) +#define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn) +#define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn) +#define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn) +#define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn) +#define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn) + +// taskbar menu is shown on right button press under all platforms except MSW +// where it's shown on right button release, using this event type and macro +// allows to write code which works correctly on all platforms +#ifdef __WXMSW__ + #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP +#else + #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN +#endif +#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn) + +#endif // wxHAS_TASK_BAR_ICON + +#endif // _WX_TASKBAR_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/tbarbase.h b/Externals/wxWidgets/include/wx/tbarbase.h index ea6cdbf773..05188e3f0d 100644 --- a/Externals/wxWidgets/include/wx/tbarbase.h +++ b/Externals/wxWidgets/include/wx/tbarbase.h @@ -1,607 +1,607 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tbarbase.h -// Purpose: Base class for toolbar classes -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: tbarbase.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TBARBASE_H_ -#define _WX_TBARBASE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TOOLBAR - -#include "wx/bitmap.h" -#include "wx/list.h" -#include "wx/control.h" - -class WXDLLIMPEXP_FWD_CORE wxToolBarBase; -class WXDLLIMPEXP_FWD_CORE wxToolBarToolBase; -class WXDLLIMPEXP_FWD_CORE wxImage; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; -extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; -extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; - -enum wxToolBarToolStyle -{ - wxTOOL_STYLE_BUTTON = 1, - wxTOOL_STYLE_SEPARATOR = 2, - wxTOOL_STYLE_CONTROL -}; - -// ---------------------------------------------------------------------------- -// wxToolBarTool is a toolbar element. -// -// It has a unique id (except for the separators which always have id wxID_ANY), the -// style (telling whether it is a normal button, separator or a control), the -// state (toggled or not, enabled or not) and short and long help strings. The -// default implementations use the short help string for the tooltip text which -// is popped up when the mouse pointer enters the tool and the long help string -// for the applications status bar. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolBarToolBase : public wxObject -{ -public: - // ctors & dtor - // ------------ - - wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL, - int toolid = wxID_SEPARATOR, - const wxString& label = wxEmptyString, - const wxBitmap& bmpNormal = wxNullBitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = (wxObject *) NULL, - const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString) - : m_label(label), - m_shortHelpString(shortHelpString), - m_longHelpString(longHelpString) - { - m_tbar = tbar; - m_id = toolid; - if (m_id == wxID_ANY) - m_id = wxNewId(); - m_clientData = clientData; - - m_bmpNormal = bmpNormal; - m_bmpDisabled = bmpDisabled; - - m_kind = kind; - - m_enabled = true; - m_toggled = false; - - m_toolStyle = toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR - : wxTOOL_STYLE_BUTTON; - } - - wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control) - { - m_tbar = tbar; - m_control = control; - m_id = control->GetId(); - - m_kind = wxITEM_MAX; // invalid value - - m_enabled = true; - m_toggled = false; - - m_toolStyle = wxTOOL_STYLE_CONTROL; - } - - virtual ~wxToolBarToolBase(){} - - // accessors - // --------- - - // general - int GetId() const { return m_id; } - - wxControl *GetControl() const - { - wxASSERT_MSG( IsControl(), _T("this toolbar tool is not a control") ); - - return m_control; - } - - wxToolBarBase *GetToolBar() const { return m_tbar; } - - // style - bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; } - bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; } - bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; } - int GetStyle() const { return m_toolStyle; } - wxItemKind GetKind() const - { - wxASSERT_MSG( IsButton(), _T("only makes sense for buttons") ); - - return m_kind; - } - - // state - bool IsEnabled() const { return m_enabled; } - bool IsToggled() const { return m_toggled; } - bool CanBeToggled() const - { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } - - // attributes - const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; } - const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; } - - const wxBitmap& GetBitmap() const - { return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); } - - const wxString& GetLabel() const { return m_label; } - - const wxString& GetShortHelp() const { return m_shortHelpString; } - const wxString& GetLongHelp() const { return m_longHelpString; } - - wxObject *GetClientData() const - { - if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) - { - return (wxObject*)m_control->GetClientData(); - } - else - { - return m_clientData; - } - } - - // modifiers: return true if the state really changed - bool Enable(bool enable); - bool Toggle(bool toggle); - bool SetToggle(bool toggle); - bool SetShortHelp(const wxString& help); - bool SetLongHelp(const wxString& help); - - void Toggle() { Toggle(!IsToggled()); } - - void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } - void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } - - virtual void SetLabel(const wxString& label) { m_label = label; } - - void SetClientData(wxObject *clientData) - { - if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) - { - m_control->SetClientData(clientData); - } - else - { - m_clientData = clientData; - } - } - - // add tool to/remove it from a toolbar - virtual void Detach() { m_tbar = (wxToolBarBase *)NULL; } - virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; } - -protected: - wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) - - // tool parameters - int m_toolStyle; // see enum wxToolBarToolStyle - int m_id; // the tool id, wxID_SEPARATOR for separator - wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO - - // as controls have their own client data, no need to waste memory - union - { - wxObject *m_clientData; - wxControl *m_control; - }; - - // tool state - bool m_toggled; - bool m_enabled; - - // normal and disabled bitmaps for the tool, both can be invalid - wxBitmap m_bmpNormal; - wxBitmap m_bmpDisabled; - - // the button label - wxString m_label; - - // short and long help strings - wxString m_shortHelpString; - wxString m_longHelpString; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase) -}; - -// a list of toolbar tools -WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList); - -// ---------------------------------------------------------------------------- -// the base class for all toolbars -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolBarBase : public wxControl -{ -public: - wxToolBarBase(); - virtual ~wxToolBarBase(); - - // toolbar construction - // -------------------- - - // the full AddTool() function - // - // If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap - // is created and used as the disabled image. - wxToolBarToolBase *AddTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - wxItemKind kind = wxITEM_NORMAL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *data = NULL) - { - return DoAddTool(toolid, label, bitmap, bmpDisabled, kind, - shortHelp, longHelp, data); - } - - // the most common AddTool() version - wxToolBarToolBase *AddTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxString& shortHelp = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL) - { - return AddTool(toolid, label, bitmap, wxNullBitmap, kind, shortHelp); - } - - // add a check tool, i.e. a tool which can be toggled - wxToolBarToolBase *AddCheckTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *data = NULL) - { - return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, - shortHelp, longHelp, data); - } - - // add a radio tool, i.e. a tool which can be toggled and releases any - // other toggled radio tools in the same group when it happens - wxToolBarToolBase *AddRadioTool(int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *data = NULL) - { - return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO, - shortHelp, longHelp, data); - } - - - // insert the new tool at the given position, if pos == GetToolsCount(), it - // is equivalent to AddTool() - virtual wxToolBarToolBase *InsertTool - ( - size_t pos, - int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - wxItemKind kind = wxITEM_NORMAL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL - ); - - virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool); - virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool); - - // add an arbitrary control to the toolbar (notice that - // the control will be deleted by the toolbar and that it will also adjust - // its position/size) - // - // NB: the control should have toolbar as its parent - virtual wxToolBarToolBase *AddControl(wxControl *control); - virtual wxToolBarToolBase *InsertControl(size_t pos, wxControl *control); - - // get the control with the given id or return NULL - virtual wxControl *FindControl( int toolid ); - - // add a separator to the toolbar - virtual wxToolBarToolBase *AddSeparator(); - virtual wxToolBarToolBase *InsertSeparator(size_t pos); - - // remove the tool from the toolbar: the caller is responsible for actually - // deleting the pointer - virtual wxToolBarToolBase *RemoveTool(int toolid); - - // delete tool either by index or by position - virtual bool DeleteToolByPos(size_t pos); - virtual bool DeleteTool(int toolid); - - // delete all tools - virtual void ClearTools(); - - // must be called after all buttons have been created to finish toolbar - // initialisation - virtual bool Realize(); - - // tools state - // ----------- - - virtual void EnableTool(int toolid, bool enable); - virtual void ToggleTool(int toolid, bool toggle); - - // Set this to be togglable (or not) - virtual void SetToggle(int toolid, bool toggle); - - // set/get tools client data (not for controls) - virtual wxObject *GetToolClientData(int toolid) const; - virtual void SetToolClientData(int toolid, wxObject *clientData); - - // returns tool pos, or wxNOT_FOUND if tool isn't found - virtual int GetToolPos(int id) const; - - // return true if the tool is toggled - virtual bool GetToolState(int toolid) const; - - virtual bool GetToolEnabled(int toolid) const; - - virtual void SetToolShortHelp(int toolid, const wxString& helpString); - virtual wxString GetToolShortHelp(int toolid) const; - virtual void SetToolLongHelp(int toolid, const wxString& helpString); - virtual wxString GetToolLongHelp(int toolid) const; - - // margins/packing/separation - // -------------------------- - - virtual void SetMargins(int x, int y); - void SetMargins(const wxSize& size) - { SetMargins((int) size.x, (int) size.y); } - virtual void SetToolPacking(int packing) - { m_toolPacking = packing; } - virtual void SetToolSeparation(int separation) - { m_toolSeparation = separation; } - - virtual wxSize GetToolMargins() const { return wxSize(m_xMargin, m_yMargin); } - virtual int GetToolPacking() const { return m_toolPacking; } - virtual int GetToolSeparation() const { return m_toolSeparation; } - - // toolbar geometry - // ---------------- - - // set the number of toolbar rows - virtual void SetRows(int nRows); - - // the toolbar can wrap - limit the number of columns or rows it may take - void SetMaxRowsCols(int rows, int cols) - { m_maxRows = rows; m_maxCols = cols; } - int GetMaxRows() const { return m_maxRows; } - int GetMaxCols() const { return m_maxCols; } - - // get/set the size of the bitmaps used by the toolbar: should be called - // before adding any tools to the toolbar - virtual void SetToolBitmapSize(const wxSize& size) - { m_defaultWidth = size.x; m_defaultHeight = size.y; } - virtual wxSize GetToolBitmapSize() const - { return wxSize(m_defaultWidth, m_defaultHeight); } - - // the button size in some implementations is bigger than the bitmap size: - // get the total button size (by default the same as bitmap size) - virtual wxSize GetToolSize() const - { return GetToolBitmapSize(); } - - // returns a (non separator) tool containing the point (x, y) or NULL if - // there is no tool at this point (corrdinates are client) - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, - wxCoord y) const = 0; - - // find the tool by id - wxToolBarToolBase *FindById(int toolid) const; - - // return true if this is a vertical toolbar, otherwise false - bool IsVertical() const { return HasFlag(wxTB_LEFT | wxTB_RIGHT); } - - - // the old versions of the various methods kept for compatibility - // don't use in the new code! - // -------------------------------------------------------------- - - wxToolBarToolBase *AddTool(int toolid, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - bool toggle = false, - wxObject *clientData = NULL, - const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString) - { - return AddTool(toolid, wxEmptyString, - bitmap, bmpDisabled, - toggle ? wxITEM_CHECK : wxITEM_NORMAL, - shortHelpString, longHelpString, clientData); - } - - wxToolBarToolBase *AddTool(int toolid, - const wxBitmap& bitmap, - const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString) - { - return AddTool(toolid, wxEmptyString, - bitmap, wxNullBitmap, wxITEM_NORMAL, - shortHelpString, longHelpString, NULL); - } - - wxToolBarToolBase *AddTool(int toolid, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - bool toggle, - wxCoord xPos, - wxCoord yPos = wxDefaultCoord, - wxObject *clientData = NULL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString) - { - return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled, - toggle ? wxITEM_CHECK : wxITEM_NORMAL, - shortHelp, longHelp, clientData, xPos, yPos); - } - - wxToolBarToolBase *InsertTool(size_t pos, - int toolid, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - bool toggle = false, - wxObject *clientData = NULL, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString) - { - return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled, - toggle ? wxITEM_CHECK : wxITEM_NORMAL, - shortHelp, longHelp, clientData); - } - - // event handlers - // -------------- - - // NB: these functions are deprecated, use EVT_TOOL_XXX() instead! - - // Only allow toggle if returns true. Call when left button up. - virtual bool OnLeftClick(int toolid, bool toggleDown); - - // Call when right button down. - virtual void OnRightClick(int toolid, long x, long y); - - // Called when the mouse cursor enters a tool bitmap. - // Argument is wxID_ANY if mouse is exiting the toolbar. - virtual void OnMouseEnter(int toolid); - - // more deprecated functions - // ------------------------- - - // use GetToolMargins() instead - wxSize GetMargins() const { return GetToolMargins(); } - - // implementation only from now on - // ------------------------------- - - size_t GetToolsCount() const { return m_tools.GetCount(); } - - // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ; - - // don't want toolbars to accept the focus - virtual bool AcceptsFocus() const { return false; } - -protected: - // to implement in derived classes - // ------------------------------- - - // create a new toolbar tool and add it to the toolbar, this is typically - // implemented by just calling InsertTool() - virtual wxToolBarToolBase *DoAddTool - ( - int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled, - wxItemKind kind, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL, - wxCoord xPos = wxDefaultCoord, - wxCoord yPos = wxDefaultCoord - ); - - // the tool is not yet inserted into m_tools list when this function is - // called and will only be added to it if this function succeeds - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) = 0; - - // the tool is still in m_tools list when this function is called, it will - // only be deleted from it if it succeeds - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) = 0; - - // called when the tools enabled flag changes - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) = 0; - - // called when the tool is toggled - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) = 0; - - // called when the tools "can be toggled" flag changes - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0; - - // the functions to create toolbar tools - virtual wxToolBarToolBase *CreateTool(int toolid, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) = 0; - - virtual wxToolBarToolBase *CreateTool(wxControl *control) = 0; - - // helper functions - // ---------------- - - // call this from derived class ctor/Create() to ensure that we have either - // wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code - // which randomly checks either one or the other of them and gets confused - // if neither is set (and making one of them 0 is not an option neither as - // then the existing tests would break down) - void FixupStyle(); - - // un-toggle all buttons in the same radio group - void UnToggleRadioGroup(wxToolBarToolBase *tool); - - // the list of all our tools - wxToolBarToolsList m_tools; - - // the offset of the first tool - int m_xMargin; - int m_yMargin; - - // the maximum number of toolbar rows/columns - int m_maxRows; - int m_maxCols; - - // the tool packing and separation - int m_toolPacking, - m_toolSeparation; - - // the size of the toolbar bitmaps - wxCoord m_defaultWidth, m_defaultHeight; - -private: - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxToolBarBase) -}; - -// Helper function for creating the image for disabled buttons -bool wxCreateGreyedImage(const wxImage& in, wxImage& out) ; - -#endif // wxUSE_TOOLBAR - -#endif - // _WX_TBARBASE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tbarbase.h +// Purpose: Base class for toolbar classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: tbarbase.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TBARBASE_H_ +#define _WX_TBARBASE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TOOLBAR + +#include "wx/bitmap.h" +#include "wx/list.h" +#include "wx/control.h" + +class WXDLLIMPEXP_FWD_CORE wxToolBarBase; +class WXDLLIMPEXP_FWD_CORE wxToolBarToolBase; +class WXDLLIMPEXP_FWD_CORE wxImage; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[]; +extern WXDLLEXPORT_DATA(const wxSize) wxDefaultSize; +extern WXDLLEXPORT_DATA(const wxPoint) wxDefaultPosition; + +enum wxToolBarToolStyle +{ + wxTOOL_STYLE_BUTTON = 1, + wxTOOL_STYLE_SEPARATOR = 2, + wxTOOL_STYLE_CONTROL +}; + +// ---------------------------------------------------------------------------- +// wxToolBarTool is a toolbar element. +// +// It has a unique id (except for the separators which always have id wxID_ANY), the +// style (telling whether it is a normal button, separator or a control), the +// state (toggled or not, enabled or not) and short and long help strings. The +// default implementations use the short help string for the tooltip text which +// is popped up when the mouse pointer enters the tool and the long help string +// for the applications status bar. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxToolBarToolBase : public wxObject +{ +public: + // ctors & dtor + // ------------ + + wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL, + int toolid = wxID_SEPARATOR, + const wxString& label = wxEmptyString, + const wxBitmap& bmpNormal = wxNullBitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = (wxObject *) NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + : m_label(label), + m_shortHelpString(shortHelpString), + m_longHelpString(longHelpString) + { + m_tbar = tbar; + m_id = toolid; + if (m_id == wxID_ANY) + m_id = wxNewId(); + m_clientData = clientData; + + m_bmpNormal = bmpNormal; + m_bmpDisabled = bmpDisabled; + + m_kind = kind; + + m_enabled = true; + m_toggled = false; + + m_toolStyle = toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR + : wxTOOL_STYLE_BUTTON; + } + + wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control) + { + m_tbar = tbar; + m_control = control; + m_id = control->GetId(); + + m_kind = wxITEM_MAX; // invalid value + + m_enabled = true; + m_toggled = false; + + m_toolStyle = wxTOOL_STYLE_CONTROL; + } + + virtual ~wxToolBarToolBase(){} + + // accessors + // --------- + + // general + int GetId() const { return m_id; } + + wxControl *GetControl() const + { + wxASSERT_MSG( IsControl(), _T("this toolbar tool is not a control") ); + + return m_control; + } + + wxToolBarBase *GetToolBar() const { return m_tbar; } + + // style + bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; } + bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; } + bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; } + int GetStyle() const { return m_toolStyle; } + wxItemKind GetKind() const + { + wxASSERT_MSG( IsButton(), _T("only makes sense for buttons") ); + + return m_kind; + } + + // state + bool IsEnabled() const { return m_enabled; } + bool IsToggled() const { return m_toggled; } + bool CanBeToggled() const + { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } + + // attributes + const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; } + const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; } + + const wxBitmap& GetBitmap() const + { return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); } + + const wxString& GetLabel() const { return m_label; } + + const wxString& GetShortHelp() const { return m_shortHelpString; } + const wxString& GetLongHelp() const { return m_longHelpString; } + + wxObject *GetClientData() const + { + if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) + { + return (wxObject*)m_control->GetClientData(); + } + else + { + return m_clientData; + } + } + + // modifiers: return true if the state really changed + bool Enable(bool enable); + bool Toggle(bool toggle); + bool SetToggle(bool toggle); + bool SetShortHelp(const wxString& help); + bool SetLongHelp(const wxString& help); + + void Toggle() { Toggle(!IsToggled()); } + + void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } + void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } + + virtual void SetLabel(const wxString& label) { m_label = label; } + + void SetClientData(wxObject *clientData) + { + if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) + { + m_control->SetClientData(clientData); + } + else + { + m_clientData = clientData; + } + } + + // add tool to/remove it from a toolbar + virtual void Detach() { m_tbar = (wxToolBarBase *)NULL; } + virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; } + +protected: + wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) + + // tool parameters + int m_toolStyle; // see enum wxToolBarToolStyle + int m_id; // the tool id, wxID_SEPARATOR for separator + wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO + + // as controls have their own client data, no need to waste memory + union + { + wxObject *m_clientData; + wxControl *m_control; + }; + + // tool state + bool m_toggled; + bool m_enabled; + + // normal and disabled bitmaps for the tool, both can be invalid + wxBitmap m_bmpNormal; + wxBitmap m_bmpDisabled; + + // the button label + wxString m_label; + + // short and long help strings + wxString m_shortHelpString; + wxString m_longHelpString; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase) +}; + +// a list of toolbar tools +WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList); + +// ---------------------------------------------------------------------------- +// the base class for all toolbars +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxToolBarBase : public wxControl +{ +public: + wxToolBarBase(); + virtual ~wxToolBarBase(); + + // toolbar construction + // -------------------- + + // the full AddTool() function + // + // If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap + // is created and used as the disabled image. + wxToolBarToolBase *AddTool(int toolid, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled, + wxItemKind kind = wxITEM_NORMAL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *data = NULL) + { + return DoAddTool(toolid, label, bitmap, bmpDisabled, kind, + shortHelp, longHelp, data); + } + + // the most common AddTool() version + wxToolBarToolBase *AddTool(int toolid, + const wxString& label, + const wxBitmap& bitmap, + const wxString& shortHelp = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return AddTool(toolid, label, bitmap, wxNullBitmap, kind, shortHelp); + } + + // add a check tool, i.e. a tool which can be toggled + wxToolBarToolBase *AddCheckTool(int toolid, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *data = NULL) + { + return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, + shortHelp, longHelp, data); + } + + // add a radio tool, i.e. a tool which can be toggled and releases any + // other toggled radio tools in the same group when it happens + wxToolBarToolBase *AddRadioTool(int toolid, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *data = NULL) + { + return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO, + shortHelp, longHelp, data); + } + + + // insert the new tool at the given position, if pos == GetToolsCount(), it + // is equivalent to AddTool() + virtual wxToolBarToolBase *InsertTool + ( + size_t pos, + int toolid, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL + ); + + virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool); + virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool); + + // add an arbitrary control to the toolbar (notice that + // the control will be deleted by the toolbar and that it will also adjust + // its position/size) + // + // NB: the control should have toolbar as its parent + virtual wxToolBarToolBase *AddControl(wxControl *control); + virtual wxToolBarToolBase *InsertControl(size_t pos, wxControl *control); + + // get the control with the given id or return NULL + virtual wxControl *FindControl( int toolid ); + + // add a separator to the toolbar + virtual wxToolBarToolBase *AddSeparator(); + virtual wxToolBarToolBase *InsertSeparator(size_t pos); + + // remove the tool from the toolbar: the caller is responsible for actually + // deleting the pointer + virtual wxToolBarToolBase *RemoveTool(int toolid); + + // delete tool either by index or by position + virtual bool DeleteToolByPos(size_t pos); + virtual bool DeleteTool(int toolid); + + // delete all tools + virtual void ClearTools(); + + // must be called after all buttons have been created to finish toolbar + // initialisation + virtual bool Realize(); + + // tools state + // ----------- + + virtual void EnableTool(int toolid, bool enable); + virtual void ToggleTool(int toolid, bool toggle); + + // Set this to be togglable (or not) + virtual void SetToggle(int toolid, bool toggle); + + // set/get tools client data (not for controls) + virtual wxObject *GetToolClientData(int toolid) const; + virtual void SetToolClientData(int toolid, wxObject *clientData); + + // returns tool pos, or wxNOT_FOUND if tool isn't found + virtual int GetToolPos(int id) const; + + // return true if the tool is toggled + virtual bool GetToolState(int toolid) const; + + virtual bool GetToolEnabled(int toolid) const; + + virtual void SetToolShortHelp(int toolid, const wxString& helpString); + virtual wxString GetToolShortHelp(int toolid) const; + virtual void SetToolLongHelp(int toolid, const wxString& helpString); + virtual wxString GetToolLongHelp(int toolid) const; + + // margins/packing/separation + // -------------------------- + + virtual void SetMargins(int x, int y); + void SetMargins(const wxSize& size) + { SetMargins((int) size.x, (int) size.y); } + virtual void SetToolPacking(int packing) + { m_toolPacking = packing; } + virtual void SetToolSeparation(int separation) + { m_toolSeparation = separation; } + + virtual wxSize GetToolMargins() const { return wxSize(m_xMargin, m_yMargin); } + virtual int GetToolPacking() const { return m_toolPacking; } + virtual int GetToolSeparation() const { return m_toolSeparation; } + + // toolbar geometry + // ---------------- + + // set the number of toolbar rows + virtual void SetRows(int nRows); + + // the toolbar can wrap - limit the number of columns or rows it may take + void SetMaxRowsCols(int rows, int cols) + { m_maxRows = rows; m_maxCols = cols; } + int GetMaxRows() const { return m_maxRows; } + int GetMaxCols() const { return m_maxCols; } + + // get/set the size of the bitmaps used by the toolbar: should be called + // before adding any tools to the toolbar + virtual void SetToolBitmapSize(const wxSize& size) + { m_defaultWidth = size.x; m_defaultHeight = size.y; } + virtual wxSize GetToolBitmapSize() const + { return wxSize(m_defaultWidth, m_defaultHeight); } + + // the button size in some implementations is bigger than the bitmap size: + // get the total button size (by default the same as bitmap size) + virtual wxSize GetToolSize() const + { return GetToolBitmapSize(); } + + // returns a (non separator) tool containing the point (x, y) or NULL if + // there is no tool at this point (corrdinates are client) + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, + wxCoord y) const = 0; + + // find the tool by id + wxToolBarToolBase *FindById(int toolid) const; + + // return true if this is a vertical toolbar, otherwise false + bool IsVertical() const { return HasFlag(wxTB_LEFT | wxTB_RIGHT); } + + + // the old versions of the various methods kept for compatibility + // don't use in the new code! + // -------------------------------------------------------------- + + wxToolBarToolBase *AddTool(int toolid, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled, + bool toggle = false, + wxObject *clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + { + return AddTool(toolid, wxEmptyString, + bitmap, bmpDisabled, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelpString, longHelpString, clientData); + } + + wxToolBarToolBase *AddTool(int toolid, + const wxBitmap& bitmap, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + { + return AddTool(toolid, wxEmptyString, + bitmap, wxNullBitmap, wxITEM_NORMAL, + shortHelpString, longHelpString, NULL); + } + + wxToolBarToolBase *AddTool(int toolid, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled, + bool toggle, + wxCoord xPos, + wxCoord yPos = wxDefaultCoord, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) + { + return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelp, longHelp, clientData, xPos, yPos); + } + + wxToolBarToolBase *InsertTool(size_t pos, + int toolid, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + bool toggle = false, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) + { + return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelp, longHelp, clientData); + } + + // event handlers + // -------------- + + // NB: these functions are deprecated, use EVT_TOOL_XXX() instead! + + // Only allow toggle if returns true. Call when left button up. + virtual bool OnLeftClick(int toolid, bool toggleDown); + + // Call when right button down. + virtual void OnRightClick(int toolid, long x, long y); + + // Called when the mouse cursor enters a tool bitmap. + // Argument is wxID_ANY if mouse is exiting the toolbar. + virtual void OnMouseEnter(int toolid); + + // more deprecated functions + // ------------------------- + + // use GetToolMargins() instead + wxSize GetMargins() const { return GetToolMargins(); } + + // implementation only from now on + // ------------------------------- + + size_t GetToolsCount() const { return m_tools.GetCount(); } + + // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ; + + // don't want toolbars to accept the focus + virtual bool AcceptsFocus() const { return false; } + +protected: + // to implement in derived classes + // ------------------------------- + + // create a new toolbar tool and add it to the toolbar, this is typically + // implemented by just calling InsertTool() + virtual wxToolBarToolBase *DoAddTool + ( + int toolid, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled, + wxItemKind kind, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL, + wxCoord xPos = wxDefaultCoord, + wxCoord yPos = wxDefaultCoord + ); + + // the tool is not yet inserted into m_tools list when this function is + // called and will only be added to it if this function succeeds + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) = 0; + + // the tool is still in m_tools list when this function is called, it will + // only be deleted from it if it succeeds + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) = 0; + + // called when the tools enabled flag changes + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) = 0; + + // called when the tool is toggled + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) = 0; + + // called when the tools "can be toggled" flag changes + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0; + + // the functions to create toolbar tools + virtual wxToolBarToolBase *CreateTool(int toolid, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp) = 0; + + virtual wxToolBarToolBase *CreateTool(wxControl *control) = 0; + + // helper functions + // ---------------- + + // call this from derived class ctor/Create() to ensure that we have either + // wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code + // which randomly checks either one or the other of them and gets confused + // if neither is set (and making one of them 0 is not an option neither as + // then the existing tests would break down) + void FixupStyle(); + + // un-toggle all buttons in the same radio group + void UnToggleRadioGroup(wxToolBarToolBase *tool); + + // the list of all our tools + wxToolBarToolsList m_tools; + + // the offset of the first tool + int m_xMargin; + int m_yMargin; + + // the maximum number of toolbar rows/columns + int m_maxRows; + int m_maxCols; + + // the tool packing and separation + int m_toolPacking, + m_toolSeparation; + + // the size of the toolbar bitmaps + wxCoord m_defaultWidth, m_defaultHeight; + +private: + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxToolBarBase) +}; + +// Helper function for creating the image for disabled buttons +bool wxCreateGreyedImage(const wxImage& in, wxImage& out) ; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TBARBASE_H_ + diff --git a/Externals/wxWidgets/include/wx/textbuf.h b/Externals/wxWidgets/include/wx/textbuf.h index 97246b6b2e..569b1ac9e9 100644 --- a/Externals/wxWidgets/include/wx/textbuf.h +++ b/Externals/wxWidgets/include/wx/textbuf.h @@ -1,208 +1,208 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textbuf.h -// Purpose: class wxTextBuffer to work with text buffers of _small_ size -// (buffer is fully loaded in memory) and which understands CR/LF -// differences between platforms. -// Created: 14.11.01 -// Author: Morten Hanssen, Vadim Zeitlin -// Copyright: (c) 1998-2001 Morten Hanssen, Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTBUFFER_H -#define _WX_TEXTBUFFER_H - -#include "wx/defs.h" -#include "wx/arrstr.h" -#include "wx/convauto.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the line termination type (kept wxTextFileType name for compability) -enum wxTextFileType -{ - wxTextFileType_None, // incomplete (the last line of the file only) - wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n' - wxTextFileType_Dos, // 'CR' 'LF' - wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r' - wxTextFileType_Os2 // 'CR' 'LF' -}; - -#include "wx/string.h" - -#if wxUSE_TEXTBUFFER - -#include "wx/dynarray.h" - -// ---------------------------------------------------------------------------- -// wxTextBuffer -// ---------------------------------------------------------------------------- - -WX_DEFINE_USER_EXPORTED_ARRAY_INT(wxTextFileType, - wxArrayLinesType, - class WXDLLIMPEXP_BASE); - -#endif // wxUSE_TEXTBUFFER - -class WXDLLIMPEXP_BASE wxTextBuffer -{ -public: - // constants and static functions - // default type for current platform (determined at compile time) - static const wxTextFileType typeDefault; - - // this function returns a string which is identical to "text" passed in - // except that the line terminator characters are changed to correspond the - // given type. Called with the default argument, the function translates - // the string to the native format (Unix for Unix, DOS for Windows, ...). - static wxString Translate(const wxString& text, - wxTextFileType type = typeDefault); - - // get the buffer termination string - static const wxChar *GetEOL(wxTextFileType type = typeDefault); - - // the static methods of this class are compiled in even when - // !wxUSE_TEXTBUFFER because they are used by the library itself, but the - // rest can be left out -#if wxUSE_TEXTBUFFER - - // buffer operations - // ----------------- - - // buffer exists? - bool Exists() const; - - // create the buffer if it doesn't already exist - bool Create(); - - // same as Create() but with (another) buffer name - bool Create(const wxString& strBufferName); - - // Open() also loads buffer in memory on success - bool Open(const wxMBConv& conv = wxConvAuto()); - - // same as Open() but with (another) buffer name - bool Open(const wxString& strBufferName, const wxMBConv& conv = wxConvAuto()); - - // closes the buffer and frees memory, losing all changes - bool Close(); - - // is buffer currently opened? - bool IsOpened() const { return m_isOpened; } - - // accessors - // --------- - - // get the number of lines in the buffer - size_t GetLineCount() const { return m_aLines.size(); } - - // the returned line may be modified (but don't add CR/LF at the end!) - wxString& GetLine(size_t n) const { return (wxString&)m_aLines[n]; } - wxString& operator[](size_t n) const { return (wxString&)m_aLines[n]; } - - // the current line has meaning only when you're using - // GetFirstLine()/GetNextLine() functions, it doesn't get updated when - // you're using "direct access" i.e. GetLine() - size_t GetCurrentLine() const { return m_nCurLine; } - void GoToLine(size_t n) { m_nCurLine = n; } - bool Eof() const { return m_nCurLine == m_aLines.size(); } - - // these methods allow more "iterator-like" traversal of the list of - // lines, i.e. you may write something like: - // for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... } - - // NB: const is commented out because not all compilers understand - // 'mutable' keyword yet (m_nCurLine should be mutable) - wxString& GetFirstLine() /* const */ - { return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; } - wxString& GetNextLine() /* const */ - { return ++m_nCurLine == m_aLines.size() ? ms_eof - : m_aLines[m_nCurLine]; } - wxString& GetPrevLine() /* const */ - { wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; } - wxString& GetLastLine() /* const */ - { m_nCurLine = m_aLines.size() - 1; return m_aLines.Last(); } - - // get the type of the line (see also GetEOL) - wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; } - - // guess the type of buffer - wxTextFileType GuessType() const; - - // get the name of the buffer - const wxChar *GetName() const { return m_strBufferName.c_str(); } - - // add/remove lines - // ---------------- - - // add a line to the end - void AddLine(const wxString& str, wxTextFileType type = typeDefault) - { m_aLines.push_back(str); m_aTypes.push_back(type); } - // insert a line before the line number n - void InsertLine(const wxString& str, - size_t n, - wxTextFileType type = typeDefault) - { - m_aLines.insert(m_aLines.begin() + n, str); - m_aTypes.insert(m_aTypes.begin()+n, type); - } - - // delete one line - void RemoveLine(size_t n) - { - m_aLines.erase(m_aLines.begin() + n); - m_aTypes.erase(m_aTypes.begin() + n); - } - - // remove all lines - void Clear() { m_aLines.clear(); m_aTypes.clear(); m_nCurLine = 0; } - - // change the buffer (default argument means "don't change type") - // possibly in another format - bool Write(wxTextFileType typeNew = wxTextFileType_None, - const wxMBConv& conv = wxConvAuto()); - - // dtor - virtual ~wxTextBuffer(); - -protected: - // ctors - // ----- - - // default ctor, use Open(string) - wxTextBuffer() { m_nCurLine = 0; m_isOpened = false; } - - // ctor from filename - wxTextBuffer(const wxString& strBufferName); - - enum wxTextBufferOpenMode { ReadAccess, WriteAccess }; - - // Must implement these in derived classes. - virtual bool OnExists() const = 0; - virtual bool OnOpen(const wxString &strBufferName, - wxTextBufferOpenMode openmode) = 0; - virtual bool OnClose() = 0; - virtual bool OnRead(const wxMBConv& conv) = 0; - virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) = 0; - - static wxString ms_eof; // dummy string returned at EOF - wxString m_strBufferName; // name of the buffer - -private: - wxArrayLinesType m_aTypes; // type of each line - wxArrayString m_aLines; // lines of file - - size_t m_nCurLine; // number of current line in the buffer - - bool m_isOpened; // was the buffer successfully opened the last time? -#endif // wxUSE_TEXTBUFFER - - // copy ctor/assignment operator not implemented - wxTextBuffer(const wxTextBuffer&); - wxTextBuffer& operator=(const wxTextBuffer&); -}; - -#endif // _WX_TEXTBUFFER_H - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textbuf.h +// Purpose: class wxTextBuffer to work with text buffers of _small_ size +// (buffer is fully loaded in memory) and which understands CR/LF +// differences between platforms. +// Created: 14.11.01 +// Author: Morten Hanssen, Vadim Zeitlin +// Copyright: (c) 1998-2001 Morten Hanssen, Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTBUFFER_H +#define _WX_TEXTBUFFER_H + +#include "wx/defs.h" +#include "wx/arrstr.h" +#include "wx/convauto.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the line termination type (kept wxTextFileType name for compability) +enum wxTextFileType +{ + wxTextFileType_None, // incomplete (the last line of the file only) + wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n' + wxTextFileType_Dos, // 'CR' 'LF' + wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r' + wxTextFileType_Os2 // 'CR' 'LF' +}; + +#include "wx/string.h" + +#if wxUSE_TEXTBUFFER + +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// wxTextBuffer +// ---------------------------------------------------------------------------- + +WX_DEFINE_USER_EXPORTED_ARRAY_INT(wxTextFileType, + wxArrayLinesType, + class WXDLLIMPEXP_BASE); + +#endif // wxUSE_TEXTBUFFER + +class WXDLLIMPEXP_BASE wxTextBuffer +{ +public: + // constants and static functions + // default type for current platform (determined at compile time) + static const wxTextFileType typeDefault; + + // this function returns a string which is identical to "text" passed in + // except that the line terminator characters are changed to correspond the + // given type. Called with the default argument, the function translates + // the string to the native format (Unix for Unix, DOS for Windows, ...). + static wxString Translate(const wxString& text, + wxTextFileType type = typeDefault); + + // get the buffer termination string + static const wxChar *GetEOL(wxTextFileType type = typeDefault); + + // the static methods of this class are compiled in even when + // !wxUSE_TEXTBUFFER because they are used by the library itself, but the + // rest can be left out +#if wxUSE_TEXTBUFFER + + // buffer operations + // ----------------- + + // buffer exists? + bool Exists() const; + + // create the buffer if it doesn't already exist + bool Create(); + + // same as Create() but with (another) buffer name + bool Create(const wxString& strBufferName); + + // Open() also loads buffer in memory on success + bool Open(const wxMBConv& conv = wxConvAuto()); + + // same as Open() but with (another) buffer name + bool Open(const wxString& strBufferName, const wxMBConv& conv = wxConvAuto()); + + // closes the buffer and frees memory, losing all changes + bool Close(); + + // is buffer currently opened? + bool IsOpened() const { return m_isOpened; } + + // accessors + // --------- + + // get the number of lines in the buffer + size_t GetLineCount() const { return m_aLines.size(); } + + // the returned line may be modified (but don't add CR/LF at the end!) + wxString& GetLine(size_t n) const { return (wxString&)m_aLines[n]; } + wxString& operator[](size_t n) const { return (wxString&)m_aLines[n]; } + + // the current line has meaning only when you're using + // GetFirstLine()/GetNextLine() functions, it doesn't get updated when + // you're using "direct access" i.e. GetLine() + size_t GetCurrentLine() const { return m_nCurLine; } + void GoToLine(size_t n) { m_nCurLine = n; } + bool Eof() const { return m_nCurLine == m_aLines.size(); } + + // these methods allow more "iterator-like" traversal of the list of + // lines, i.e. you may write something like: + // for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... } + + // NB: const is commented out because not all compilers understand + // 'mutable' keyword yet (m_nCurLine should be mutable) + wxString& GetFirstLine() /* const */ + { return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; } + wxString& GetNextLine() /* const */ + { return ++m_nCurLine == m_aLines.size() ? ms_eof + : m_aLines[m_nCurLine]; } + wxString& GetPrevLine() /* const */ + { wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; } + wxString& GetLastLine() /* const */ + { m_nCurLine = m_aLines.size() - 1; return m_aLines.Last(); } + + // get the type of the line (see also GetEOL) + wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; } + + // guess the type of buffer + wxTextFileType GuessType() const; + + // get the name of the buffer + const wxChar *GetName() const { return m_strBufferName.c_str(); } + + // add/remove lines + // ---------------- + + // add a line to the end + void AddLine(const wxString& str, wxTextFileType type = typeDefault) + { m_aLines.push_back(str); m_aTypes.push_back(type); } + // insert a line before the line number n + void InsertLine(const wxString& str, + size_t n, + wxTextFileType type = typeDefault) + { + m_aLines.insert(m_aLines.begin() + n, str); + m_aTypes.insert(m_aTypes.begin()+n, type); + } + + // delete one line + void RemoveLine(size_t n) + { + m_aLines.erase(m_aLines.begin() + n); + m_aTypes.erase(m_aTypes.begin() + n); + } + + // remove all lines + void Clear() { m_aLines.clear(); m_aTypes.clear(); m_nCurLine = 0; } + + // change the buffer (default argument means "don't change type") + // possibly in another format + bool Write(wxTextFileType typeNew = wxTextFileType_None, + const wxMBConv& conv = wxConvAuto()); + + // dtor + virtual ~wxTextBuffer(); + +protected: + // ctors + // ----- + + // default ctor, use Open(string) + wxTextBuffer() { m_nCurLine = 0; m_isOpened = false; } + + // ctor from filename + wxTextBuffer(const wxString& strBufferName); + + enum wxTextBufferOpenMode { ReadAccess, WriteAccess }; + + // Must implement these in derived classes. + virtual bool OnExists() const = 0; + virtual bool OnOpen(const wxString &strBufferName, + wxTextBufferOpenMode openmode) = 0; + virtual bool OnClose() = 0; + virtual bool OnRead(const wxMBConv& conv) = 0; + virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) = 0; + + static wxString ms_eof; // dummy string returned at EOF + wxString m_strBufferName; // name of the buffer + +private: + wxArrayLinesType m_aTypes; // type of each line + wxArrayString m_aLines; // lines of file + + size_t m_nCurLine; // number of current line in the buffer + + bool m_isOpened; // was the buffer successfully opened the last time? +#endif // wxUSE_TEXTBUFFER + + // copy ctor/assignment operator not implemented + wxTextBuffer(const wxTextBuffer&); + wxTextBuffer& operator=(const wxTextBuffer&); +}; + +#endif // _WX_TEXTBUFFER_H + diff --git a/Externals/wxWidgets/include/wx/textctrl.h b/Externals/wxWidgets/include/wx/textctrl.h index b1b4c0a25a..c69c17274b 100644 --- a/Externals/wxWidgets/include/wx/textctrl.h +++ b/Externals/wxWidgets/include/wx/textctrl.h @@ -1,601 +1,601 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textctrl.h -// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl -// Author: Vadim Zeitlin -// Modified by: -// Created: 13.07.99 -// RCS-ID: $Id: textctrl.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCTRL_H_BASE_ -#define _WX_TEXTCTRL_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TEXTCTRL - -#include "wx/control.h" // the base class -#include "wx/dynarray.h" // wxArrayInt -#include "wx/gdicmn.h" // wxPoint - -// Open Watcom 1.3 does allow only ios::rdbuf() while -// we want something with streambuf parameter -// Also, can't use streambuf if making or using a DLL :-( - -#if defined(__WATCOMC__) || \ - defined(__MWERKS__) || \ - (defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL))) - #define wxHAS_TEXT_WINDOW_STREAM 0 -#elif wxUSE_STD_IOSTREAM - #include "wx/ioswrap.h" - #define wxHAS_TEXT_WINDOW_STREAM 1 -#else - #define wxHAS_TEXT_WINDOW_STREAM 0 -#endif - -#if WXWIN_COMPATIBILITY_2_4 && !wxHAS_TEXT_WINDOW_STREAM - // define old flag if one could use it somewhere - #define NO_TEXT_WINDOW_STREAM -#endif - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; - -// ---------------------------------------------------------------------------- -// wxTextCtrl types -// ---------------------------------------------------------------------------- - -// wxTextPos is the position in the text -typedef long wxTextPos; - -// wxTextCoord is the line or row number (which should have been unsigned but -// is long for backwards compatibility) -typedef long wxTextCoord; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(const wxChar) wxTextCtrlNameStr[]; - -// this is intentionally not enum to avoid warning fixes with -// typecasting from enum type to wxTextCoord -const wxTextCoord wxOutOfRangeTextCoord = -1; -const wxTextCoord wxInvalidTextCoord = -2; - -// ---------------------------------------------------------------------------- -// wxTextCtrl style flags -// ---------------------------------------------------------------------------- - -#define wxTE_NO_VSCROLL 0x0002 -#define wxTE_AUTO_SCROLL 0x0008 - -#define wxTE_READONLY 0x0010 -#define wxTE_MULTILINE 0x0020 -#define wxTE_PROCESS_TAB 0x0040 - -// alignment flags -#define wxTE_LEFT 0x0000 // 0x0000 -#define wxTE_CENTER wxALIGN_CENTER_HORIZONTAL // 0x0100 -#define wxTE_RIGHT wxALIGN_RIGHT // 0x0200 -#define wxTE_CENTRE wxTE_CENTER - -// this style means to use RICHEDIT control and does something only under wxMSW -// and Win32 and is silently ignored under all other platforms -#define wxTE_RICH 0x0080 - -#define wxTE_PROCESS_ENTER 0x0400 -#define wxTE_PASSWORD 0x0800 - -// automatically detect the URLs and generate the events when mouse is -// moved/clicked over an URL -// -// this is for Win32 richedit and wxGTK2 multiline controls only so far -#define wxTE_AUTO_URL 0x1000 - -// by default, the Windows text control doesn't show the selection when it -// doesn't have focus - use this style to force it to always show it -#define wxTE_NOHIDESEL 0x2000 - -// use wxHSCROLL to not wrap text at all, wxTE_CHARWRAP to wrap it at any -// position and wxTE_WORDWRAP to wrap at words boundary -// -// if no wrapping style is given at all, the control wraps at word boundary -#define wxTE_DONTWRAP wxHSCROLL -#define wxTE_CHARWRAP 0x4000 // wrap at any position -#define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries -#define wxTE_BESTWRAP 0x0000 // this is the default - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete synonym - #define wxTE_LINEWRAP wxTE_CHARWRAP -#endif // WXWIN_COMPATIBILITY_2_6 - -// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for -// wxTE_RICH controls - can be used together with or instead of wxTE_RICH -#define wxTE_RICH2 0x8000 - -// reuse wxTE_RICH2's value for CAPEDIT control on Windows CE -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -#define wxTE_CAPITALIZE wxTE_RICH2 -#else -#define wxTE_CAPITALIZE 0 -#endif - -// ---------------------------------------------------------------------------- -// wxTextCtrl file types -// ---------------------------------------------------------------------------- - -#define wxTEXT_TYPE_ANY 0 - -// ---------------------------------------------------------------------------- -// wxTextCtrl::HitTest return values -// ---------------------------------------------------------------------------- - -// the point asked is ... -enum wxTextCtrlHitTestResult -{ - wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented - wxTE_HT_BEFORE, // either to the left or upper - wxTE_HT_ON_TEXT, // directly on - wxTE_HT_BELOW, // below [the last line] - wxTE_HT_BEYOND // after [the end of line] -}; -// ... the character returned - -// ---------------------------------------------------------------------------- -// Types for wxTextAttr -// ---------------------------------------------------------------------------- - -// Alignment - -enum wxTextAttrAlignment -{ - wxTEXT_ALIGNMENT_DEFAULT, - wxTEXT_ALIGNMENT_LEFT, - wxTEXT_ALIGNMENT_CENTRE, - wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE, - wxTEXT_ALIGNMENT_RIGHT, - wxTEXT_ALIGNMENT_JUSTIFIED -}; - -// Flags to indicate which attributes are being applied - -#define wxTEXT_ATTR_TEXT_COLOUR 0x0001 -#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002 -#define wxTEXT_ATTR_FONT_FACE 0x0004 -#define wxTEXT_ATTR_FONT_SIZE 0x0008 -#define wxTEXT_ATTR_FONT_WEIGHT 0x0010 -#define wxTEXT_ATTR_FONT_ITALIC 0x0020 -#define wxTEXT_ATTR_FONT_UNDERLINE 0x0040 -#define wxTEXT_ATTR_FONT \ - ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ - wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE ) -#define wxTEXT_ATTR_ALIGNMENT 0x0080 -#define wxTEXT_ATTR_LEFT_INDENT 0x0100 -#define wxTEXT_ATTR_RIGHT_INDENT 0x0200 -#define wxTEXT_ATTR_TABS 0x0400 - -// ---------------------------------------------------------------------------- -// wxTextAttr: a structure containing the visual attributes of a text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextAttr -{ -public: - // ctors - wxTextAttr() { Init(); } - wxTextAttr(const wxColour& colText, - const wxColour& colBack = wxNullColour, - const wxFont& font = wxNullFont, - wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); - - // operations - void Init(); - - // merges the attributes of the base and the overlay objects and returns - // the result; the parameter attributes take precedence - // - // WARNING: the order of arguments is the opposite of Combine() - static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay) - { - return Combine(overlay, base, NULL); - } - - // merges the attributes of this object and overlay - void Merge(const wxTextAttr& overlay) - { - *this = Merge(*this, overlay); - } - - - // operators - void operator= (const wxTextAttr& attr); - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } - void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT) { m_font = font; m_flags |= flags; } - void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } - void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } - void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } - void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } - void SetFlags(long flags) { m_flags = flags; } - - // accessors - bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } - bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } - bool HasFont() const { return m_font.Ok() && HasFlag(wxTEXT_ATTR_FONT) ; } - bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; } - bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; } - bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; } - bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; } - bool HasFlag(long flag) const { return (m_flags & flag) != 0; } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxFont& GetFont() const { return m_font; } - wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } - const wxArrayInt& GetTabs() const { return m_tabs; } - long GetLeftIndent() const { return m_leftIndent; } - long GetLeftSubIndent() const { return m_leftSubIndent; } - long GetRightIndent() const { return m_rightIndent; } - long GetFlags() const { return m_flags; } - - // returns false if we have any attributes set, true otherwise - bool IsDefault() const - { - return !HasTextColour() && !HasBackgroundColour() && !HasFont() && !HasAlignment() && - !HasTabs() && !HasLeftIndent() && !HasRightIndent() ; - } - - // return the attribute having the valid font and colours: it uses the - // attributes set in attr and falls back first to attrDefault and then to - // the text control font/colours for those attributes which are not set - static wxTextAttr Combine(const wxTextAttr& attr, - const wxTextAttr& attrDef, - const wxTextCtrlBase *text); - -private: - long m_flags; - wxColour m_colText, - m_colBack; - wxFont m_font; - wxTextAttrAlignment m_textAlignment; - wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm - int m_leftIndent; // left indent in 1/10 mm - int m_leftSubIndent; // left indent for all but the first - // line in a paragraph relative to the - // first line, in 1/10 mm - int m_rightIndent; // right indent in 1/10 mm -}; - -// ---------------------------------------------------------------------------- -// wxTextCtrl: a single or multiple line text zone where user can enter and -// edit text -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextCtrlBase : public wxControl -#if wxHAS_TEXT_WINDOW_STREAM - , public wxSTD streambuf -#endif - -{ -public: - // creation - // -------- - - wxTextCtrlBase(){} - virtual ~wxTextCtrlBase(){} - - // accessors - // --------- - - virtual wxString GetValue() const = 0; - virtual bool IsEmpty() const { return GetValue().empty(); } - - virtual void SetValue(const wxString& value) - { DoSetValue(value, SetValue_SendEvent); } - virtual void ChangeValue(const wxString& value) - { DoSetValue(value); } - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const = 0; - virtual wxString GetLineText(long lineNo) const = 0; - virtual int GetNumberOfLines() const = 0; - - virtual bool IsModified() const = 0; - virtual bool IsEditable() const = 0; - - // more readable flag testing methods - bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); } - bool IsMultiLine() const { return !IsSingleLine(); } - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const = 0; - - virtual wxString GetStringSelection() const; - - // operations - // ---------- - - // editing - virtual void Clear() = 0; - virtual void Replace(long from, long to, const wxString& value) = 0; - virtual void Remove(long from, long to) = 0; - - // load/save the control's contents from/to a file - bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); } - bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY); - - // implementation for loading/saving - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file, int fileType); - - // sets/clears the dirty flag - virtual void MarkDirty() = 0; - virtual void DiscardEdits() = 0; - void SetModified(bool modified) - { - if ( modified ) - MarkDirty(); - else - DiscardEdits(); - } - - // set the max number of characters which may be entered in a single line - // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text) = 0; - virtual void AppendText(const wxString& text) = 0; - - // insert the character which would have resulted from this key event, - // return true if anything has been inserted - virtual bool EmulateKeyPress(const wxKeyEvent& event); - - // text control under some platforms supports the text styles: these - // methods allow to apply the given text style to the given selection or to - // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual const wxTextAttr& GetDefaultStyle() const; - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const = 0; - virtual bool PositionToXY(long pos, long *x, long *y) const = 0; - - virtual void ShowPosition(long pos) = 0; - - // find the character at position given in pixels - // - // NB: pt is in device coords (not adjusted for the client area origin nor - // scrolling) - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const; - - // Clipboard operations - virtual void Copy() = 0; - virtual void Cut() = 0; - virtual void Paste() = 0; - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo() = 0; - virtual void Redo() = 0; - - virtual bool CanUndo() const = 0; - virtual bool CanRedo() const = 0; - - // Insertion point - virtual void SetInsertionPoint(long pos) = 0; - virtual void SetInsertionPointEnd() = 0; - virtual long GetInsertionPoint() const = 0; - virtual wxTextPos GetLastPosition() const = 0; - - virtual void SetSelection(long from, long to) = 0; - virtual void SelectAll(); - virtual void SetEditable(bool editable) = 0; - - // stream-like insertion operators: these are always available, whether we - // were, or not, compiled with streambuf support - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const wxChar c); - - // generate the wxEVT_COMMAND_TEXT_UPDATED event, like SetValue() does - void SendTextUpdatedEvent(); - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); - - virtual bool ShouldInheritColours() const { return false; } - -protected: - // override streambuf method -#if wxHAS_TEXT_WINDOW_STREAM - int overflow(int i); -#endif // wxHAS_TEXT_WINDOW_STREAM - - // flags for DoSetValue(): common part of SetValue() and ChangeValue() and - // also used to implement WriteText() in wxMSW - enum - { - SetValue_SendEvent = 1, - SetValue_SelectionOnly = 2 - }; - - virtual void DoSetValue(const wxString& value, int flags = 0) = 0; - - - // the name of the last file loaded with LoadFile() which will be used by - // SaveFile() by default - wxString m_filename; - - // the text style which will be used for any new text added to the control - wxTextAttr m_defaultStyle; - - DECLARE_NO_COPY_CLASS(wxTextCtrlBase) - DECLARE_ABSTRACT_CLASS(wxTextCtrlBase) -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent class definition -// ---------------------------------------------------------------------------- - -#if defined(__WXX11__) - #include "wx/x11/textctrl.h" -#elif defined(__WXUNIVERSAL__) - #include "wx/univ/textctrl.h" -#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/textctrlce.h" -#elif defined(__WXMSW__) - #include "wx/msw/textctrl.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/textctrl.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/textctrl.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/textctrl.h" -#elif defined(__WXMAC__) - #include "wx/mac/textctrl.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/textctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/textctrl.h" -#endif - -// ---------------------------------------------------------------------------- -// wxTextCtrl events -// ---------------------------------------------------------------------------- - -#if !WXWIN_COMPATIBILITY_EVENT_TYPES - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) -END_DECLARE_EVENT_TYPES() - -#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES - -class WXDLLEXPORT wxTextUrlEvent : public wxCommandEvent -{ -public: - wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse, - long start, long end) - : wxCommandEvent(wxEVT_COMMAND_TEXT_URL, winid) - , m_evtMouse(evtMouse), m_start(start), m_end(end) - { } - - // get the mouse event which happend over the URL - const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; } - - // get the start of the URL - long GetURLStart() const { return m_start; } - - // get the end of the URL - long GetURLEnd() const { return m_end; } - -protected: - // the corresponding mouse event - wxMouseEvent m_evtMouse; - - // the start and end indices of the URL in the text control - long m_start, - m_end; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextUrlEvent) - -public: - // for wxWin RTTI only, don't use - wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { } -}; - -typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); - -#define wxTextEventHandler(func) wxCommandEventHandler(func) -#define wxTextUrlEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTextUrlEventFunction, &func) - -#define wx__DECLARE_TEXTEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextEventHandler(fn)) - -#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextUrlEventHandler(fn)) - -#define EVT_TEXT(id, fn) wx__DECLARE_TEXTEVT(UPDATED, id, fn) -#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn) -#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn) -#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn) - -#if wxHAS_TEXT_WINDOW_STREAM - -// ---------------------------------------------------------------------------- -// wxStreamToTextRedirector: this class redirects all data sent to the given -// C++ stream to the wxTextCtrl given to its ctor during its lifetime. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStreamToTextRedirector -{ -private: - void Init(wxTextCtrl *text) - { - m_sbufOld = m_ostr.rdbuf(); - m_ostr.rdbuf(text); - } - -public: - wxStreamToTextRedirector(wxTextCtrl *text) - : m_ostr(wxSTD cout) - { - Init(text); - } - - wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr) - : m_ostr(*ostr) - { - Init(text); - } - - ~wxStreamToTextRedirector() - { - m_ostr.rdbuf(m_sbufOld); - } - -private: - // the stream we're redirecting - wxSTD ostream& m_ostr; - - // the old streambuf (before we changed it) - wxSTD streambuf *m_sbufOld; -}; - -#endif // wxHAS_TEXT_WINDOW_STREAM - -#endif // wxUSE_TEXTCTRL - -#endif - // _WX_TEXTCTRL_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textctrl.h +// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.07.99 +// RCS-ID: $Id: textctrl.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_BASE_ +#define _WX_TEXTCTRL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TEXTCTRL + +#include "wx/control.h" // the base class +#include "wx/dynarray.h" // wxArrayInt +#include "wx/gdicmn.h" // wxPoint + +// Open Watcom 1.3 does allow only ios::rdbuf() while +// we want something with streambuf parameter +// Also, can't use streambuf if making or using a DLL :-( + +#if defined(__WATCOMC__) || \ + defined(__MWERKS__) || \ + (defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL))) + #define wxHAS_TEXT_WINDOW_STREAM 0 +#elif wxUSE_STD_IOSTREAM + #include "wx/ioswrap.h" + #define wxHAS_TEXT_WINDOW_STREAM 1 +#else + #define wxHAS_TEXT_WINDOW_STREAM 0 +#endif + +#if WXWIN_COMPATIBILITY_2_4 && !wxHAS_TEXT_WINDOW_STREAM + // define old flag if one could use it somewhere + #define NO_TEXT_WINDOW_STREAM +#endif + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; + +// ---------------------------------------------------------------------------- +// wxTextCtrl types +// ---------------------------------------------------------------------------- + +// wxTextPos is the position in the text +typedef long wxTextPos; + +// wxTextCoord is the line or row number (which should have been unsigned but +// is long for backwards compatibility) +typedef long wxTextCoord; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(const wxChar) wxTextCtrlNameStr[]; + +// this is intentionally not enum to avoid warning fixes with +// typecasting from enum type to wxTextCoord +const wxTextCoord wxOutOfRangeTextCoord = -1; +const wxTextCoord wxInvalidTextCoord = -2; + +// ---------------------------------------------------------------------------- +// wxTextCtrl style flags +// ---------------------------------------------------------------------------- + +#define wxTE_NO_VSCROLL 0x0002 +#define wxTE_AUTO_SCROLL 0x0008 + +#define wxTE_READONLY 0x0010 +#define wxTE_MULTILINE 0x0020 +#define wxTE_PROCESS_TAB 0x0040 + +// alignment flags +#define wxTE_LEFT 0x0000 // 0x0000 +#define wxTE_CENTER wxALIGN_CENTER_HORIZONTAL // 0x0100 +#define wxTE_RIGHT wxALIGN_RIGHT // 0x0200 +#define wxTE_CENTRE wxTE_CENTER + +// this style means to use RICHEDIT control and does something only under wxMSW +// and Win32 and is silently ignored under all other platforms +#define wxTE_RICH 0x0080 + +#define wxTE_PROCESS_ENTER 0x0400 +#define wxTE_PASSWORD 0x0800 + +// automatically detect the URLs and generate the events when mouse is +// moved/clicked over an URL +// +// this is for Win32 richedit and wxGTK2 multiline controls only so far +#define wxTE_AUTO_URL 0x1000 + +// by default, the Windows text control doesn't show the selection when it +// doesn't have focus - use this style to force it to always show it +#define wxTE_NOHIDESEL 0x2000 + +// use wxHSCROLL to not wrap text at all, wxTE_CHARWRAP to wrap it at any +// position and wxTE_WORDWRAP to wrap at words boundary +// +// if no wrapping style is given at all, the control wraps at word boundary +#define wxTE_DONTWRAP wxHSCROLL +#define wxTE_CHARWRAP 0x4000 // wrap at any position +#define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries +#define wxTE_BESTWRAP 0x0000 // this is the default + +#if WXWIN_COMPATIBILITY_2_6 + // obsolete synonym + #define wxTE_LINEWRAP wxTE_CHARWRAP +#endif // WXWIN_COMPATIBILITY_2_6 + +// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for +// wxTE_RICH controls - can be used together with or instead of wxTE_RICH +#define wxTE_RICH2 0x8000 + +// reuse wxTE_RICH2's value for CAPEDIT control on Windows CE +#if defined(__SMARTPHONE__) || defined(__POCKETPC__) +#define wxTE_CAPITALIZE wxTE_RICH2 +#else +#define wxTE_CAPITALIZE 0 +#endif + +// ---------------------------------------------------------------------------- +// wxTextCtrl file types +// ---------------------------------------------------------------------------- + +#define wxTEXT_TYPE_ANY 0 + +// ---------------------------------------------------------------------------- +// wxTextCtrl::HitTest return values +// ---------------------------------------------------------------------------- + +// the point asked is ... +enum wxTextCtrlHitTestResult +{ + wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented + wxTE_HT_BEFORE, // either to the left or upper + wxTE_HT_ON_TEXT, // directly on + wxTE_HT_BELOW, // below [the last line] + wxTE_HT_BEYOND // after [the end of line] +}; +// ... the character returned + +// ---------------------------------------------------------------------------- +// Types for wxTextAttr +// ---------------------------------------------------------------------------- + +// Alignment + +enum wxTextAttrAlignment +{ + wxTEXT_ALIGNMENT_DEFAULT, + wxTEXT_ALIGNMENT_LEFT, + wxTEXT_ALIGNMENT_CENTRE, + wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE, + wxTEXT_ALIGNMENT_RIGHT, + wxTEXT_ALIGNMENT_JUSTIFIED +}; + +// Flags to indicate which attributes are being applied + +#define wxTEXT_ATTR_TEXT_COLOUR 0x0001 +#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002 +#define wxTEXT_ATTR_FONT_FACE 0x0004 +#define wxTEXT_ATTR_FONT_SIZE 0x0008 +#define wxTEXT_ATTR_FONT_WEIGHT 0x0010 +#define wxTEXT_ATTR_FONT_ITALIC 0x0020 +#define wxTEXT_ATTR_FONT_UNDERLINE 0x0040 +#define wxTEXT_ATTR_FONT \ + ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ + wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE ) +#define wxTEXT_ATTR_ALIGNMENT 0x0080 +#define wxTEXT_ATTR_LEFT_INDENT 0x0100 +#define wxTEXT_ATTR_RIGHT_INDENT 0x0200 +#define wxTEXT_ATTR_TABS 0x0400 + +// ---------------------------------------------------------------------------- +// wxTextAttr: a structure containing the visual attributes of a text +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTextAttr +{ +public: + // ctors + wxTextAttr() { Init(); } + wxTextAttr(const wxColour& colText, + const wxColour& colBack = wxNullColour, + const wxFont& font = wxNullFont, + wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); + + // operations + void Init(); + + // merges the attributes of the base and the overlay objects and returns + // the result; the parameter attributes take precedence + // + // WARNING: the order of arguments is the opposite of Combine() + static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay) + { + return Combine(overlay, base, NULL); + } + + // merges the attributes of this object and overlay + void Merge(const wxTextAttr& overlay) + { + *this = Merge(*this, overlay); + } + + + // operators + void operator= (const wxTextAttr& attr); + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } + void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT) { m_font = font; m_flags |= flags; } + void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } + void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } + void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } + void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } + void SetFlags(long flags) { m_flags = flags; } + + // accessors + bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } + bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } + bool HasFont() const { return m_font.Ok() && HasFlag(wxTEXT_ATTR_FONT) ; } + bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; } + bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; } + bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; } + bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; } + bool HasFlag(long flag) const { return (m_flags & flag) != 0; } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + const wxFont& GetFont() const { return m_font; } + wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } + const wxArrayInt& GetTabs() const { return m_tabs; } + long GetLeftIndent() const { return m_leftIndent; } + long GetLeftSubIndent() const { return m_leftSubIndent; } + long GetRightIndent() const { return m_rightIndent; } + long GetFlags() const { return m_flags; } + + // returns false if we have any attributes set, true otherwise + bool IsDefault() const + { + return !HasTextColour() && !HasBackgroundColour() && !HasFont() && !HasAlignment() && + !HasTabs() && !HasLeftIndent() && !HasRightIndent() ; + } + + // return the attribute having the valid font and colours: it uses the + // attributes set in attr and falls back first to attrDefault and then to + // the text control font/colours for those attributes which are not set + static wxTextAttr Combine(const wxTextAttr& attr, + const wxTextAttr& attrDef, + const wxTextCtrlBase *text); + +private: + long m_flags; + wxColour m_colText, + m_colBack; + wxFont m_font; + wxTextAttrAlignment m_textAlignment; + wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm + int m_leftIndent; // left indent in 1/10 mm + int m_leftSubIndent; // left indent for all but the first + // line in a paragraph relative to the + // first line, in 1/10 mm + int m_rightIndent; // right indent in 1/10 mm +}; + +// ---------------------------------------------------------------------------- +// wxTextCtrl: a single or multiple line text zone where user can enter and +// edit text +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTextCtrlBase : public wxControl +#if wxHAS_TEXT_WINDOW_STREAM + , public wxSTD streambuf +#endif + +{ +public: + // creation + // -------- + + wxTextCtrlBase(){} + virtual ~wxTextCtrlBase(){} + + // accessors + // --------- + + virtual wxString GetValue() const = 0; + virtual bool IsEmpty() const { return GetValue().empty(); } + + virtual void SetValue(const wxString& value) + { DoSetValue(value, SetValue_SendEvent); } + virtual void ChangeValue(const wxString& value) + { DoSetValue(value); } + + virtual wxString GetRange(long from, long to) const; + + virtual int GetLineLength(long lineNo) const = 0; + virtual wxString GetLineText(long lineNo) const = 0; + virtual int GetNumberOfLines() const = 0; + + virtual bool IsModified() const = 0; + virtual bool IsEditable() const = 0; + + // more readable flag testing methods + bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); } + bool IsMultiLine() const { return !IsSingleLine(); } + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const = 0; + + virtual wxString GetStringSelection() const; + + // operations + // ---------- + + // editing + virtual void Clear() = 0; + virtual void Replace(long from, long to, const wxString& value) = 0; + virtual void Remove(long from, long to) = 0; + + // load/save the control's contents from/to a file + bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); } + bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY); + + // implementation for loading/saving + virtual bool DoLoadFile(const wxString& file, int fileType); + virtual bool DoSaveFile(const wxString& file, int fileType); + + // sets/clears the dirty flag + virtual void MarkDirty() = 0; + virtual void DiscardEdits() = 0; + void SetModified(bool modified) + { + if ( modified ) + MarkDirty(); + else + DiscardEdits(); + } + + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text) = 0; + virtual void AppendText(const wxString& text) = 0; + + // insert the character which would have resulted from this key event, + // return true if anything has been inserted + virtual bool EmulateKeyPress(const wxKeyEvent& event); + + // text control under some platforms supports the text styles: these + // methods allow to apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool GetStyle(long position, wxTextAttr& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual const wxTextAttr& GetDefaultStyle() const; + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const = 0; + virtual bool PositionToXY(long pos, long *x, long *y) const = 0; + + virtual void ShowPosition(long pos) = 0; + + // find the character at position given in pixels + // + // NB: pt is in device coords (not adjusted for the client area origin nor + // scrolling) + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const; + + // Clipboard operations + virtual void Copy() = 0; + virtual void Cut() = 0; + virtual void Paste() = 0; + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo() = 0; + virtual void Redo() = 0; + + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; + + // Insertion point + virtual void SetInsertionPoint(long pos) = 0; + virtual void SetInsertionPointEnd() = 0; + virtual long GetInsertionPoint() const = 0; + virtual wxTextPos GetLastPosition() const = 0; + + virtual void SetSelection(long from, long to) = 0; + virtual void SelectAll(); + virtual void SetEditable(bool editable) = 0; + + // stream-like insertion operators: these are always available, whether we + // were, or not, compiled with streambuf support + wxTextCtrl& operator<<(const wxString& s); + wxTextCtrl& operator<<(int i); + wxTextCtrl& operator<<(long i); + wxTextCtrl& operator<<(float f); + wxTextCtrl& operator<<(double d); + wxTextCtrl& operator<<(const wxChar c); + + // generate the wxEVT_COMMAND_TEXT_UPDATED event, like SetValue() does + void SendTextUpdatedEvent(); + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + + virtual bool ShouldInheritColours() const { return false; } + +protected: + // override streambuf method +#if wxHAS_TEXT_WINDOW_STREAM + int overflow(int i); +#endif // wxHAS_TEXT_WINDOW_STREAM + + // flags for DoSetValue(): common part of SetValue() and ChangeValue() and + // also used to implement WriteText() in wxMSW + enum + { + SetValue_SendEvent = 1, + SetValue_SelectionOnly = 2 + }; + + virtual void DoSetValue(const wxString& value, int flags = 0) = 0; + + + // the name of the last file loaded with LoadFile() which will be used by + // SaveFile() by default + wxString m_filename; + + // the text style which will be used for any new text added to the control + wxTextAttr m_defaultStyle; + + DECLARE_NO_COPY_CLASS(wxTextCtrlBase) + DECLARE_ABSTRACT_CLASS(wxTextCtrlBase) +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent class definition +// ---------------------------------------------------------------------------- + +#if defined(__WXX11__) + #include "wx/x11/textctrl.h" +#elif defined(__WXUNIVERSAL__) + #include "wx/univ/textctrl.h" +#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) + #include "wx/msw/wince/textctrlce.h" +#elif defined(__WXMSW__) + #include "wx/msw/textctrl.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/textctrl.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/textctrl.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/textctrl.h" +#elif defined(__WXMAC__) + #include "wx/mac/textctrl.h" +#elif defined(__WXCOCOA__) + #include "wx/cocoa/textctrl.h" +#elif defined(__WXPM__) + #include "wx/os2/textctrl.h" +#endif + +// ---------------------------------------------------------------------------- +// wxTextCtrl events +// ---------------------------------------------------------------------------- + +#if !WXWIN_COMPATIBILITY_EVENT_TYPES + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14) +END_DECLARE_EVENT_TYPES() + +#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES + +class WXDLLEXPORT wxTextUrlEvent : public wxCommandEvent +{ +public: + wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse, + long start, long end) + : wxCommandEvent(wxEVT_COMMAND_TEXT_URL, winid) + , m_evtMouse(evtMouse), m_start(start), m_end(end) + { } + + // get the mouse event which happend over the URL + const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; } + + // get the start of the URL + long GetURLStart() const { return m_start; } + + // get the end of the URL + long GetURLEnd() const { return m_end; } + +protected: + // the corresponding mouse event + wxMouseEvent m_evtMouse; + + // the start and end indices of the URL in the text control + long m_start, + m_end; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextUrlEvent) + +public: + // for wxWin RTTI only, don't use + wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { } +}; + +typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); + +#define wxTextEventHandler(func) wxCommandEventHandler(func) +#define wxTextUrlEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTextUrlEventFunction, &func) + +#define wx__DECLARE_TEXTEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextEventHandler(fn)) + +#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextUrlEventHandler(fn)) + +#define EVT_TEXT(id, fn) wx__DECLARE_TEXTEVT(UPDATED, id, fn) +#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn) +#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn) +#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn) + +#if wxHAS_TEXT_WINDOW_STREAM + +// ---------------------------------------------------------------------------- +// wxStreamToTextRedirector: this class redirects all data sent to the given +// C++ stream to the wxTextCtrl given to its ctor during its lifetime. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStreamToTextRedirector +{ +private: + void Init(wxTextCtrl *text) + { + m_sbufOld = m_ostr.rdbuf(); + m_ostr.rdbuf(text); + } + +public: + wxStreamToTextRedirector(wxTextCtrl *text) + : m_ostr(wxSTD cout) + { + Init(text); + } + + wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr) + : m_ostr(*ostr) + { + Init(text); + } + + ~wxStreamToTextRedirector() + { + m_ostr.rdbuf(m_sbufOld); + } + +private: + // the stream we're redirecting + wxSTD ostream& m_ostr; + + // the old streambuf (before we changed it) + wxSTD streambuf *m_sbufOld; +}; + +#endif // wxHAS_TEXT_WINDOW_STREAM + +#endif // wxUSE_TEXTCTRL + +#endif + // _WX_TEXTCTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/textdlg.h b/Externals/wxWidgets/include/wx/textdlg.h index 787233d4f0..4db4e33fba 100644 --- a/Externals/wxWidgets/include/wx/textdlg.h +++ b/Externals/wxWidgets/include/wx/textdlg.h @@ -1,23 +1,23 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: textdlg.h -// Purpose: wxTextEntryDialog class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: textdlg.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTDLG_H_BASE_ -#define _WX_TEXTDLG_H_BASE_ - -#include "wx/generic/textdlgg.h" - -#if WXWIN_COMPATIBILITY_2_4 - // for wxGetNumberFromUser() - #include "wx/numdlg.h" -#endif // WXWIN_COMPATIBILITY_2_4 - -#endif // _WX_TEXTDLG_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: textdlg.h +// Purpose: wxTextEntryDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: textdlg.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTDLG_H_BASE_ +#define _WX_TEXTDLG_H_BASE_ + +#include "wx/generic/textdlgg.h" + +#if WXWIN_COMPATIBILITY_2_4 + // for wxGetNumberFromUser() + #include "wx/numdlg.h" +#endif // WXWIN_COMPATIBILITY_2_4 + +#endif // _WX_TEXTDLG_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/textfile.h b/Externals/wxWidgets/include/wx/textfile.h index 5d9bcdb4af..bfbed0b969 100644 --- a/Externals/wxWidgets/include/wx/textfile.h +++ b/Externals/wxWidgets/include/wx/textfile.h @@ -1,62 +1,62 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/textfile.h -// Purpose: class wxTextFile to work with text files of _small_ size -// (file is fully loaded in memory) and which understands CR/LF -// differences between platforms. -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.04.98 -// RCS-ID: $Id: textfile.h 38570 2006-04-05 14:37:47Z VZ $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTFILE_H -#define _WX_TEXTFILE_H - -#include "wx/defs.h" - -#include "wx/textbuf.h" - -#if wxUSE_TEXTFILE - -#include "wx/file.h" - -// ---------------------------------------------------------------------------- -// wxTextFile -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer -{ -public: - // constructors - wxTextFile() { } - wxTextFile(const wxString& strFileName); - -protected: - // implement the base class pure virtuals - virtual bool OnExists() const; - virtual bool OnOpen(const wxString &strBufferName, - wxTextBufferOpenMode OpenMode); - virtual bool OnClose(); - virtual bool OnRead(const wxMBConv& conv); - virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv); - -private: - - wxFile m_file; - - DECLARE_NO_COPY_CLASS(wxTextFile) -}; - -#else // !wxUSE_TEXTFILE - -// old code relies on the static methods of wxTextFile being always available -// and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so -// make it possible to use them in a backwards compatible way -typedef wxTextBuffer wxTextFile; - -#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE - -#endif // _WX_TEXTFILE_H - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textfile.h +// Purpose: class wxTextFile to work with text files of _small_ size +// (file is fully loaded in memory) and which understands CR/LF +// differences between platforms. +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.04.98 +// RCS-ID: $Id: textfile.h 38570 2006-04-05 14:37:47Z VZ $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTFILE_H +#define _WX_TEXTFILE_H + +#include "wx/defs.h" + +#include "wx/textbuf.h" + +#if wxUSE_TEXTFILE + +#include "wx/file.h" + +// ---------------------------------------------------------------------------- +// wxTextFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer +{ +public: + // constructors + wxTextFile() { } + wxTextFile(const wxString& strFileName); + +protected: + // implement the base class pure virtuals + virtual bool OnExists() const; + virtual bool OnOpen(const wxString &strBufferName, + wxTextBufferOpenMode OpenMode); + virtual bool OnClose(); + virtual bool OnRead(const wxMBConv& conv); + virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv); + +private: + + wxFile m_file; + + DECLARE_NO_COPY_CLASS(wxTextFile) +}; + +#else // !wxUSE_TEXTFILE + +// old code relies on the static methods of wxTextFile being always available +// and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so +// make it possible to use them in a backwards compatible way +typedef wxTextBuffer wxTextFile; + +#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE + +#endif // _WX_TEXTFILE_H + diff --git a/Externals/wxWidgets/include/wx/tglbtn.h b/Externals/wxWidgets/include/wx/tglbtn.h index c20b9e4a00..ebc83ddcf8 100644 --- a/Externals/wxWidgets/include/wx/tglbtn.h +++ b/Externals/wxWidgets/include/wx/tglbtn.h @@ -1,51 +1,51 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tglbtn.h -// Purpose: This dummy header includes the proper header file for the -// system we're compiling under. -// Author: John Norris, minor changes by Axel Schlueter -// Modified by: -// Created: 08.02.01 -// RCS-ID: $Id: tglbtn.h 39293 2006-05-23 17:53:50Z JS $ -// Copyright: (c) 2000 Johnny C. Norris II -// License: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOGGLEBUTTON_H_BASE_ -#define _WX_TOGGLEBUTTON_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TOGGLEBTN - -#include "wx/event.h" -#include "wx/control.h" // base class - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19) -END_DECLARE_EVENT_TYPES() - -#define EVT_TOGGLEBUTTON(id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn)) - -#if defined(__WXUNIVERSAL__) - #include "wx/univ/tglbtn.h" -#elif defined(__WXMSW__) - #include "wx/msw/tglbtn.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/tglbtn.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/tglbtn.h" -# elif defined(__WXMOTIF__) - #include "wx/motif/tglbtn.h" -#elif defined(__WXMAC__) - #include "wx/mac/tglbtn.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/tglbtn.h" -#elif defined(__WXPM__) - #include "wx/os2/tglbtn.h" -#endif - -#endif // wxUSE_TOGGLEBTN - -#endif // _WX_TOGGLEBUTTON_H_BASE_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tglbtn.h +// Purpose: This dummy header includes the proper header file for the +// system we're compiling under. +// Author: John Norris, minor changes by Axel Schlueter +// Modified by: +// Created: 08.02.01 +// RCS-ID: $Id: tglbtn.h 39293 2006-05-23 17:53:50Z JS $ +// Copyright: (c) 2000 Johnny C. Norris II +// License: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_BASE_ +#define _WX_TOGGLEBUTTON_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TOGGLEBTN + +#include "wx/event.h" +#include "wx/control.h" // base class + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19) +END_DECLARE_EVENT_TYPES() + +#define EVT_TOGGLEBUTTON(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn)) + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/tglbtn.h" +#elif defined(__WXMSW__) + #include "wx/msw/tglbtn.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/tglbtn.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/tglbtn.h" +# elif defined(__WXMOTIF__) + #include "wx/motif/tglbtn.h" +#elif defined(__WXMAC__) + #include "wx/mac/tglbtn.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/tglbtn.h" +#elif defined(__WXPM__) + #include "wx/os2/tglbtn.h" +#endif + +#endif // wxUSE_TOGGLEBTN + +#endif // _WX_TOGGLEBUTTON_H_BASE_ + diff --git a/Externals/wxWidgets/include/wx/thread.h b/Externals/wxWidgets/include/wx/thread.h index bb15fa7a44..f25e522c6a 100644 --- a/Externals/wxWidgets/include/wx/thread.h +++ b/Externals/wxWidgets/include/wx/thread.h @@ -1,762 +1,762 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/thread.h -// Purpose: Thread API -// Author: Guilhem Lavaux -// Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads -// package from Olivetti & Oracle Research Laboratory) -// Created: 04/13/98 -// RCS-ID: $Id: thread.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_THREAD_H_ -#define _WX_THREAD_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// get the value of wxUSE_THREADS configuration flag -#include "wx/defs.h" - -#if wxUSE_THREADS - -// Windows headers define it -#ifdef Yield - #undef Yield -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -enum wxMutexError -{ - wxMUTEX_NO_ERROR = 0, // operation completed successfully - wxMUTEX_INVALID, // mutex hasn't been initialized - wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread - wxMUTEX_BUSY, // mutex is already locked by another thread - wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked - wxMUTEX_MISC_ERROR // any other error -}; - -enum wxCondError -{ - wxCOND_NO_ERROR = 0, - wxCOND_INVALID, - wxCOND_TIMEOUT, // WaitTimeout() has timed out - wxCOND_MISC_ERROR -}; - -enum wxSemaError -{ - wxSEMA_NO_ERROR = 0, - wxSEMA_INVALID, // semaphore hasn't been initialized successfully - wxSEMA_BUSY, // returned by TryWait() if Wait() would block - wxSEMA_TIMEOUT, // returned by WaitTimeout() - wxSEMA_OVERFLOW, // Post() would increase counter past the max - wxSEMA_MISC_ERROR -}; - -enum wxThreadError -{ - wxTHREAD_NO_ERROR = 0, // No error - wxTHREAD_NO_RESOURCE, // No resource left to create a new thread - wxTHREAD_RUNNING, // The thread is already running - wxTHREAD_NOT_RUNNING, // The thread isn't running - wxTHREAD_KILLED, // Thread we waited for had to be killed - wxTHREAD_MISC_ERROR // Some other error -}; - -enum wxThreadKind -{ - wxTHREAD_DETACHED, - wxTHREAD_JOINABLE -}; - -// defines the interval of priority -enum -{ - WXTHREAD_MIN_PRIORITY = 0u, - WXTHREAD_DEFAULT_PRIORITY = 50u, - WXTHREAD_MAX_PRIORITY = 100u -}; - -// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt -// to lock a normal mutex by a thread which already owns it results in -// undefined behaviour (it always works under Windows, it will almost always -// result in a deadlock under Unix). Locking a recursive mutex in such -// situation always succeeds and it must be unlocked as many times as it has -// been locked. -// -// However recursive mutexes have several important drawbacks: first, in the -// POSIX implementation, they're less efficient. Second, and more importantly, -// they CAN NOT BE USED WITH CONDITION VARIABLES under Unix! Using them with -// wxCondition will work under Windows and some Unices (notably Linux) but will -// deadlock under other Unix versions (e.g. Solaris). As it might be difficult -// to ensure that a recursive mutex is not used with wxCondition, it is a good -// idea to avoid using recursive mutexes at all. Also, the last problem with -// them is that some (older) Unix versions don't support this at all -- which -// results in a configure warning when building and a deadlock when using them. -enum wxMutexType -{ - // normal mutex: try to always use this one - wxMUTEX_DEFAULT, - - // recursive mutex: don't use these ones with wxCondition - wxMUTEX_RECURSIVE -}; - -// forward declarations -class WXDLLIMPEXP_FWD_BASE wxThreadHelper; -class WXDLLIMPEXP_FWD_BASE wxConditionInternal; -class WXDLLIMPEXP_FWD_BASE wxMutexInternal; -class WXDLLIMPEXP_FWD_BASE wxSemaphoreInternal; -class WXDLLIMPEXP_FWD_BASE wxThreadInternal; - -// ---------------------------------------------------------------------------- -// A mutex object is a synchronization object whose state is set to signaled -// when it is not owned by any thread, and nonsignaled when it is owned. Its -// name comes from its usefulness in coordinating mutually-exclusive access to -// a shared resource. Only one thread at a time can own a mutex object. -// ---------------------------------------------------------------------------- - -// you should consider wxMutexLocker whenever possible instead of directly -// working with wxMutex class - it is safer -class WXDLLIMPEXP_BASE wxMutex -{ -public: - // constructor & destructor - // ------------------------ - - // create either default (always safe) or recursive mutex - wxMutex(wxMutexType mutexType = wxMUTEX_DEFAULT); - - // destroys the mutex kernel object - ~wxMutex(); - - // test if the mutex has been created successfully - bool IsOk() const; - - // mutex operations - // ---------------- - - // Lock the mutex, blocking on it until it is unlocked by the other thread. - // The result of locking a mutex already locked by the current thread - // depend on the mutex type. - // - // The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR. - wxMutexError Lock(); - - // Try to lock the mutex: if it is currently locked, return immediately - // with an error. Otherwise the caller must call Unlock(). - wxMutexError TryLock(); - - // Unlock the mutex. It is an error to unlock an already unlocked mutex - wxMutexError Unlock(); - -protected: - wxMutexInternal *m_internal; - - friend class wxConditionInternal; - - DECLARE_NO_COPY_CLASS(wxMutex) -}; - -// a helper class which locks the mutex in the ctor and unlocks it in the dtor: -// this ensures that mutex is always unlocked, even if the function returns or -// throws an exception before it reaches the end -class WXDLLIMPEXP_BASE wxMutexLocker -{ -public: - // lock the mutex in the ctor - wxMutexLocker(wxMutex& mutex) - : m_isOk(false), m_mutex(mutex) - { m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); } - - // returns true if mutex was successfully locked in ctor - bool IsOk() const - { return m_isOk; } - - // unlock the mutex in dtor - ~wxMutexLocker() - { if ( IsOk() ) m_mutex.Unlock(); } - -private: - // no assignment operator nor copy ctor - wxMutexLocker(const wxMutexLocker&); - wxMutexLocker& operator=(const wxMutexLocker&); - - bool m_isOk; - wxMutex& m_mutex; -}; - -// ---------------------------------------------------------------------------- -// Critical section: this is the same as mutex but is only visible to the -// threads of the same process. For the platforms which don't have native -// support for critical sections, they're implemented entirely in terms of -// mutexes. -// -// NB: wxCriticalSection object does not allocate any memory in its ctor -// which makes it possible to have static globals of this class -// ---------------------------------------------------------------------------- - -// in order to avoid any overhead under platforms where critical sections are -// just mutexes make all wxCriticalSection class functions inline -#if !defined(__WXMSW__) && !defined(__WXMAC__) - #define wxCRITSECT_IS_MUTEX 1 - - #define wxCRITSECT_INLINE inline -#else // MSW - #define wxCRITSECT_IS_MUTEX 0 - - #define wxCRITSECT_INLINE -#endif // MSW/!MSW - -// you should consider wxCriticalSectionLocker whenever possible instead of -// directly working with wxCriticalSection class - it is safer -class WXDLLIMPEXP_BASE wxCriticalSection -{ -public: - // ctor & dtor - wxCRITSECT_INLINE wxCriticalSection(); - wxCRITSECT_INLINE ~wxCriticalSection(); - - // enter the section (the same as locking a mutex) - wxCRITSECT_INLINE void Enter(); - - // leave the critical section (same as unlocking a mutex) - wxCRITSECT_INLINE void Leave(); - -private: -#if wxCRITSECT_IS_MUTEX - wxMutex m_mutex; -#elif defined(__WXMSW__) - // we can't allocate any memory in the ctor, so use placement new - - // unfortunately, we have to hardcode the sizeof() here because we can't - // include windows.h from this public header and we also have to use the - // union to force the correct (i.e. maximal) alignment - // - // if CRITICAL_SECTION size changes in Windows, you'll get an assert from - // thread.cpp and will need to increase the buffer size - // - // finally, we need this typedef instead of declaring m_buffer directly - // because otherwise the assert mentioned above wouldn't compile with some - // compilers (notably CodeWarrior 8) -#ifdef __WIN64__ - typedef char wxCritSectBuffer[40]; -#else // __WIN32__ - typedef char wxCritSectBuffer[24]; -#endif - union - { - unsigned long m_dummy1; - void *m_dummy2; - - wxCritSectBuffer m_buffer; - }; -#elif defined(__WXMAC__) - void *m_critRegion ; -#endif // Unix&OS2/Win32 - - DECLARE_NO_COPY_CLASS(wxCriticalSection) -}; - -#if wxCRITSECT_IS_MUTEX - // implement wxCriticalSection using mutexes - inline wxCriticalSection::wxCriticalSection() { } - inline wxCriticalSection::~wxCriticalSection() { } - - inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } - inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } -#endif // wxCRITSECT_IS_MUTEX - -#undef wxCRITSECT_INLINE -#undef wxCRITSECT_IS_MUTEX - -// wxCriticalSectionLocker is the same to critical sections as wxMutexLocker is -// to mutexes -class WXDLLIMPEXP_BASE wxCriticalSectionLocker -{ -public: - wxCriticalSectionLocker(wxCriticalSection& cs) - : m_critsect(cs) - { - m_critsect.Enter(); - } - - ~wxCriticalSectionLocker() - { - m_critsect.Leave(); - } - -private: - wxCriticalSection& m_critsect; - - DECLARE_NO_COPY_CLASS(wxCriticalSectionLocker) -}; - -// ---------------------------------------------------------------------------- -// wxCondition models a POSIX condition variable which allows one (or more) -// thread(s) to wait until some condition is fulfilled -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxCondition -{ -public: - // Each wxCondition object is associated with a (single) wxMutex object. - // The mutex object MUST be locked before calling Wait() - wxCondition(wxMutex& mutex); - - // dtor is not virtual, don't use this class polymorphically - ~wxCondition(); - - // return true if the condition has been created successfully - bool IsOk() const; - - // NB: the associated mutex MUST be locked beforehand by the calling thread - // - // it atomically releases the lock on the associated mutex - // and starts waiting to be woken up by a Signal()/Broadcast() - // once its signaled, then it will wait until it can reacquire - // the lock on the associated mutex object, before returning. - wxCondError Wait(); - - // exactly as Wait() except that it may also return if the specified - // timeout elapses even if the condition hasn't been signalled: in this - // case, the return value is false, otherwise (i.e. in case of a normal - // return) it is true - // - // the timeout parameter specifies an interval that needs to be waited for - // in milliseconds - wxCondError WaitTimeout(unsigned long milliseconds); - - // NB: the associated mutex may or may not be locked by the calling thread - // - // this method unblocks one thread if any are blocking on the condition. - // if no thread is blocking in Wait(), then the signal is NOT remembered - // The thread which was blocking on Wait() will then reacquire the lock - // on the associated mutex object before returning - wxCondError Signal(); - - // NB: the associated mutex may or may not be locked by the calling thread - // - // this method unblocks all threads if any are blocking on the condition. - // if no thread is blocking in Wait(), then the signal is NOT remembered - // The threads which were blocking on Wait() will then reacquire the lock - // on the associated mutex object before returning. - wxCondError Broadcast(); - - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated version, don't use - wxDEPRECATED( bool Wait(unsigned long milliseconds) ); -#endif // WXWIN_COMPATIBILITY_2_6 - -private: - wxConditionInternal *m_internal; - - DECLARE_NO_COPY_CLASS(wxCondition) -}; - -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxCondition::Wait(unsigned long milliseconds) - { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; } -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// wxSemaphore: a counter limiting the number of threads concurrently accessing -// a shared resource -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSemaphore -{ -public: - // specifying a maxcount of 0 actually makes wxSemaphore behave as if there - // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex - wxSemaphore( int initialcount = 0, int maxcount = 0 ); - - // dtor is not virtual, don't use this class polymorphically - ~wxSemaphore(); - - // return true if the semaphore has been created successfully - bool IsOk() const; - - // wait indefinitely, until the semaphore count goes beyond 0 - // and then decrement it and return (this method might have been called - // Acquire()) - wxSemaError Wait(); - - // same as Wait(), but does not block, returns wxSEMA_NO_ERROR if - // successful and wxSEMA_BUSY if the count is currently zero - wxSemaError TryWait(); - - // same as Wait(), but as a timeout limit, returns wxSEMA_NO_ERROR if the - // semaphore was acquired and wxSEMA_TIMEOUT if the timeout has elapsed - wxSemaError WaitTimeout(unsigned long milliseconds); - - // increments the semaphore count and signals one of the waiting threads - wxSemaError Post(); - -private: - wxSemaphoreInternal *m_internal; - - DECLARE_NO_COPY_CLASS(wxSemaphore) -}; - -// ---------------------------------------------------------------------------- -// wxThread: class encapsulating a thread of execution -// ---------------------------------------------------------------------------- - -// there are two different kinds of threads: joinable and detached (default) -// ones. Only joinable threads can return a return code and only detached -// threads auto-delete themselves - the user should delete the joinable -// threads manually. - -// NB: in the function descriptions the words "this thread" mean the thread -// created by the wxThread object while "main thread" is the thread created -// during the process initialization (a.k.a. the GUI thread) - -// On VMS thread pointers are 64 bits (also needed for other systems??? -#ifdef __VMS - typedef unsigned long long wxThreadIdType; -#else - typedef unsigned long wxThreadIdType; -#endif - -class WXDLLIMPEXP_BASE wxThread -{ -public: - // the return type for the thread function - typedef void *ExitCode; - - // static functions - // Returns the wxThread object for the calling thread. NULL is returned - // if the caller is the main thread (but it's recommended to use - // IsMain() and only call This() for threads other than the main one - // because NULL is also returned on error). If the thread wasn't - // created with wxThread class, the returned value is undefined. - static wxThread *This(); - - // Returns true if current thread is the main thread. - static bool IsMain(); - - // Release the rest of our time slice letting the other threads run - static void Yield(); - - // Sleep during the specified period of time in milliseconds - // - // NB: at least under MSW worker threads can not call ::wxSleep()! - static void Sleep(unsigned long milliseconds); - - // get the number of system CPUs - useful with SetConcurrency() - // (the "best" value for it is usually number of CPUs + 1) - // - // Returns -1 if unknown, number of CPUs otherwise - static int GetCPUCount(); - - // Get the platform specific thread ID and return as a long. This - // can be used to uniquely identify threads, even if they are not - // wxThreads. This is used by wxPython. - static wxThreadIdType GetCurrentId(); - - // sets the concurrency level: this is, roughly, the number of threads - // the system tries to schedule to run in parallel. 0 means the - // default value (usually acceptable, but may not yield the best - // performance for this process) - // - // Returns true on success, false otherwise (if not implemented, for - // example) - static bool SetConcurrency(size_t level); - - // constructor only creates the C++ thread object and doesn't create (or - // start) the real thread - wxThread(wxThreadKind kind = wxTHREAD_DETACHED); - - // functions that change the thread state: all these can only be called - // from _another_ thread (typically the thread that created this one, e.g. - // the main thread), not from the thread itself - - // create a new thread and optionally set the stack size on - // platforms that support that - call Run() to start it - // (special cased for watcom which won't accept 0 default) - - wxThreadError Create(unsigned int stackSize = 0); - - // starts execution of the thread - from the moment Run() is called - // the execution of wxThread::Entry() may start at any moment, caller - // shouldn't suppose that it starts after (or before) Run() returns. - wxThreadError Run(); - - // stops the thread if it's running and deletes the wxThread object if - // this is a detached thread freeing its memory - otherwise (for - // joinable threads) you still need to delete wxThread object - // yourself. - // - // this function only works if the thread calls TestDestroy() - // periodically - the thread will only be deleted the next time it - // does it! - // - // will fill the rc pointer with the thread exit code if it's !NULL - wxThreadError Delete(ExitCode *rc = (ExitCode *)NULL); - - // waits for a joinable thread to finish and returns its exit code - // - // Returns (ExitCode)-1 on error (for example, if the thread is not - // joinable) - ExitCode Wait(); - - // kills the thread without giving it any chance to clean up - should - // not be used under normal circumstances, use Delete() instead. - // It is a dangerous function that should only be used in the most - // extreme cases! - // - // The wxThread object is deleted by Kill() if the thread is - // detachable, but you still have to delete it manually for joinable - // threads. - wxThreadError Kill(); - - // pause a running thread: as Delete(), this only works if the thread - // calls TestDestroy() regularly - wxThreadError Pause(); - - // resume a paused thread - wxThreadError Resume(); - - // priority - // Sets the priority to "prio": see WXTHREAD_XXX_PRIORITY constants - // - // NB: the priority can only be set before the thread is created - void SetPriority(unsigned int prio); - - // Get the current priority. - unsigned int GetPriority() const; - - // thread status inquiries - // Returns true if the thread is alive: i.e. running or suspended - bool IsAlive() const; - // Returns true if the thread is running (not paused, not killed). - bool IsRunning() const; - // Returns true if the thread is suspended - bool IsPaused() const; - - // is the thread of detached kind? - bool IsDetached() const { return m_isDetached; } - - // Get the thread ID - a platform dependent number which uniquely - // identifies a thread inside a process - wxThreadIdType GetId() const; - - // called when the thread exits - in the context of this thread - // - // NB: this function will not be called if the thread is Kill()ed - virtual void OnExit() { } - - // Returns true if the thread was asked to terminate: this function should - // be called by the thread from time to time, otherwise the main thread - // will be left forever in Delete()! - virtual bool TestDestroy(); - - // dtor is public, but the detached threads should never be deleted - use - // Delete() instead (or leave the thread terminate by itself) - virtual ~wxThread(); - -protected: - // exits from the current thread - can be called only from this thread - void Exit(ExitCode exitcode = 0); - - // entry point for the thread - called by Run() and executes in the context - // of this thread. - virtual void *Entry() = 0; - -private: - // no copy ctor/assignment operator - wxThread(const wxThread&); - wxThread& operator=(const wxThread&); - - friend class wxThreadInternal; - - // the (platform-dependent) thread class implementation - wxThreadInternal *m_internal; - - // protects access to any methods of wxThreadInternal object - wxCriticalSection m_critsect; - - // true if the thread is detached, false if it is joinable - bool m_isDetached; -}; - -// wxThreadHelperThread class -// -------------------------- - -class WXDLLIMPEXP_BASE wxThreadHelperThread : public wxThread -{ -public: - // constructor only creates the C++ thread object and doesn't create (or - // start) the real thread - wxThreadHelperThread(wxThreadHelper& owner) - : wxThread(wxTHREAD_JOINABLE), m_owner(owner) - { } - -protected: - // entry point for the thread -- calls Entry() in owner. - virtual void *Entry(); - -private: - // the owner of the thread - wxThreadHelper& m_owner; - - // no copy ctor/assignment operator - wxThreadHelperThread(const wxThreadHelperThread&); - wxThreadHelperThread& operator=(const wxThreadHelperThread&); -}; - -// ---------------------------------------------------------------------------- -// wxThreadHelper: this class implements the threading logic to run a -// background task in another object (such as a window). It is a mix-in: just -// derive from it to implement a threading background task in your class. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxThreadHelper -{ -private: - void KillThread() - { - if ( m_thread ) - { - m_thread->Kill(); - delete m_thread; - } - } - -public: - // constructor only initializes m_thread to NULL - wxThreadHelper() : m_thread(NULL) { } - - // destructor deletes m_thread - virtual ~wxThreadHelper() { KillThread(); } - - // create a new thread (and optionally set the stack size on platforms that - // support/need that), call Run() to start it - wxThreadError Create(unsigned int stackSize = 0) - { - KillThread(); - - m_thread = new wxThreadHelperThread(*this); - - return m_thread->Create(stackSize); - } - - // entry point for the thread - called by Run() and executes in the context - // of this thread. - virtual void *Entry() = 0; - - // returns a pointer to the thread which can be used to call Run() - wxThread *GetThread() const { return m_thread; } - -protected: - wxThread *m_thread; -}; - -// call Entry() in owner, put it down here to avoid circular declarations -inline void *wxThreadHelperThread::Entry() -{ - return m_owner.Entry(); -} - -// ---------------------------------------------------------------------------- -// Automatic initialization -// ---------------------------------------------------------------------------- - -// GUI mutex handling. -void WXDLLIMPEXP_BASE wxMutexGuiEnter(); -void WXDLLIMPEXP_BASE wxMutexGuiLeave(); - -// macros for entering/leaving critical sections which may be used without -// having to take them inside "#if wxUSE_THREADS" -#define wxENTER_CRIT_SECT(cs) (cs).Enter() -#define wxLEAVE_CRIT_SECT(cs) (cs).Leave() -#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs -#define wxCRIT_SECT_DECLARE_MEMBER(cs) wxCriticalSection cs -#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(cs) - -// function for checking if we're in the main thread which may be used whether -// wxUSE_THREADS is 0 or 1 -inline bool wxIsMainThread() { return wxThread::IsMain(); } - -#else // !wxUSE_THREADS - -// no thread support -inline void WXDLLIMPEXP_BASE wxMutexGuiEnter() { } -inline void WXDLLIMPEXP_BASE wxMutexGuiLeave() { } - -// macros for entering/leaving critical sections which may be used without -// having to take them inside "#if wxUSE_THREADS" -// (the implementation uses dummy structs to force semicolon after the macro) -#define wxENTER_CRIT_SECT(cs) do {} while (0) -#define wxLEAVE_CRIT_SECT(cs) do {} while (0) -#define wxCRIT_SECT_DECLARE(cs) struct wxDummyCS##cs -#define wxCRIT_SECT_DECLARE_MEMBER(cs) struct wxDummyCSMember##cs -#define wxCRIT_SECT_LOCKER(name, cs) struct wxDummyCSLocker##name - -// if there is only one thread, it is always the main one -inline bool wxIsMainThread() { return true; } - -#endif // wxUSE_THREADS/!wxUSE_THREADS - -// mark part of code as being a critical section: this macro declares a -// critical section with the given name and enters it immediately and leaves -// it at the end of the current scope -// -// example: -// -// int Count() -// { -// static int s_counter = 0; -// -// wxCRITICAL_SECTION(counter); -// -// return ++s_counter; -// } -// -// this function is MT-safe in presence of the threads but there is no -// overhead when the library is compiled without threads -#define wxCRITICAL_SECTION(name) \ - wxCRIT_SECT_DECLARE(s_cs##name); \ - wxCRIT_SECT_LOCKER(cs##name##Locker, s_cs##name) - -// automatically lock GUI mutex in ctor and unlock it in dtor -class WXDLLIMPEXP_BASE wxMutexGuiLocker -{ -public: - wxMutexGuiLocker() { wxMutexGuiEnter(); } - ~wxMutexGuiLocker() { wxMutexGuiLeave(); } -}; - -// ----------------------------------------------------------------------------- -// implementation only until the end of file -// ----------------------------------------------------------------------------- - -#if wxUSE_THREADS - -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__) - // unlock GUI if there are threads waiting for and lock it back when - // there are no more of them - should be called periodically by the main - // thread - extern void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter(); - - // returns true if the main thread has GUI lock - extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread(); - - // wakes up the main thread if it's sleeping inside ::GetMessage() - extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); - - // return true if the main thread is waiting for some other to terminate: - // wxApp then should block all "dangerous" messages - extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread(); -#endif // MSW, Mac, OS/2 - -#endif // wxUSE_THREADS - -#endif // _WX_THREAD_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/thread.h +// Purpose: Thread API +// Author: Guilhem Lavaux +// Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads +// package from Olivetti & Oracle Research Laboratory) +// Created: 04/13/98 +// RCS-ID: $Id: thread.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_THREAD_H_ +#define _WX_THREAD_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// get the value of wxUSE_THREADS configuration flag +#include "wx/defs.h" + +#if wxUSE_THREADS + +// Windows headers define it +#ifdef Yield + #undef Yield +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxMutexError +{ + wxMUTEX_NO_ERROR = 0, // operation completed successfully + wxMUTEX_INVALID, // mutex hasn't been initialized + wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread + wxMUTEX_BUSY, // mutex is already locked by another thread + wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked + wxMUTEX_MISC_ERROR // any other error +}; + +enum wxCondError +{ + wxCOND_NO_ERROR = 0, + wxCOND_INVALID, + wxCOND_TIMEOUT, // WaitTimeout() has timed out + wxCOND_MISC_ERROR +}; + +enum wxSemaError +{ + wxSEMA_NO_ERROR = 0, + wxSEMA_INVALID, // semaphore hasn't been initialized successfully + wxSEMA_BUSY, // returned by TryWait() if Wait() would block + wxSEMA_TIMEOUT, // returned by WaitTimeout() + wxSEMA_OVERFLOW, // Post() would increase counter past the max + wxSEMA_MISC_ERROR +}; + +enum wxThreadError +{ + wxTHREAD_NO_ERROR = 0, // No error + wxTHREAD_NO_RESOURCE, // No resource left to create a new thread + wxTHREAD_RUNNING, // The thread is already running + wxTHREAD_NOT_RUNNING, // The thread isn't running + wxTHREAD_KILLED, // Thread we waited for had to be killed + wxTHREAD_MISC_ERROR // Some other error +}; + +enum wxThreadKind +{ + wxTHREAD_DETACHED, + wxTHREAD_JOINABLE +}; + +// defines the interval of priority +enum +{ + WXTHREAD_MIN_PRIORITY = 0u, + WXTHREAD_DEFAULT_PRIORITY = 50u, + WXTHREAD_MAX_PRIORITY = 100u +}; + +// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt +// to lock a normal mutex by a thread which already owns it results in +// undefined behaviour (it always works under Windows, it will almost always +// result in a deadlock under Unix). Locking a recursive mutex in such +// situation always succeeds and it must be unlocked as many times as it has +// been locked. +// +// However recursive mutexes have several important drawbacks: first, in the +// POSIX implementation, they're less efficient. Second, and more importantly, +// they CAN NOT BE USED WITH CONDITION VARIABLES under Unix! Using them with +// wxCondition will work under Windows and some Unices (notably Linux) but will +// deadlock under other Unix versions (e.g. Solaris). As it might be difficult +// to ensure that a recursive mutex is not used with wxCondition, it is a good +// idea to avoid using recursive mutexes at all. Also, the last problem with +// them is that some (older) Unix versions don't support this at all -- which +// results in a configure warning when building and a deadlock when using them. +enum wxMutexType +{ + // normal mutex: try to always use this one + wxMUTEX_DEFAULT, + + // recursive mutex: don't use these ones with wxCondition + wxMUTEX_RECURSIVE +}; + +// forward declarations +class WXDLLIMPEXP_FWD_BASE wxThreadHelper; +class WXDLLIMPEXP_FWD_BASE wxConditionInternal; +class WXDLLIMPEXP_FWD_BASE wxMutexInternal; +class WXDLLIMPEXP_FWD_BASE wxSemaphoreInternal; +class WXDLLIMPEXP_FWD_BASE wxThreadInternal; + +// ---------------------------------------------------------------------------- +// A mutex object is a synchronization object whose state is set to signaled +// when it is not owned by any thread, and nonsignaled when it is owned. Its +// name comes from its usefulness in coordinating mutually-exclusive access to +// a shared resource. Only one thread at a time can own a mutex object. +// ---------------------------------------------------------------------------- + +// you should consider wxMutexLocker whenever possible instead of directly +// working with wxMutex class - it is safer +class WXDLLIMPEXP_BASE wxMutex +{ +public: + // constructor & destructor + // ------------------------ + + // create either default (always safe) or recursive mutex + wxMutex(wxMutexType mutexType = wxMUTEX_DEFAULT); + + // destroys the mutex kernel object + ~wxMutex(); + + // test if the mutex has been created successfully + bool IsOk() const; + + // mutex operations + // ---------------- + + // Lock the mutex, blocking on it until it is unlocked by the other thread. + // The result of locking a mutex already locked by the current thread + // depend on the mutex type. + // + // The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR. + wxMutexError Lock(); + + // Try to lock the mutex: if it is currently locked, return immediately + // with an error. Otherwise the caller must call Unlock(). + wxMutexError TryLock(); + + // Unlock the mutex. It is an error to unlock an already unlocked mutex + wxMutexError Unlock(); + +protected: + wxMutexInternal *m_internal; + + friend class wxConditionInternal; + + DECLARE_NO_COPY_CLASS(wxMutex) +}; + +// a helper class which locks the mutex in the ctor and unlocks it in the dtor: +// this ensures that mutex is always unlocked, even if the function returns or +// throws an exception before it reaches the end +class WXDLLIMPEXP_BASE wxMutexLocker +{ +public: + // lock the mutex in the ctor + wxMutexLocker(wxMutex& mutex) + : m_isOk(false), m_mutex(mutex) + { m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); } + + // returns true if mutex was successfully locked in ctor + bool IsOk() const + { return m_isOk; } + + // unlock the mutex in dtor + ~wxMutexLocker() + { if ( IsOk() ) m_mutex.Unlock(); } + +private: + // no assignment operator nor copy ctor + wxMutexLocker(const wxMutexLocker&); + wxMutexLocker& operator=(const wxMutexLocker&); + + bool m_isOk; + wxMutex& m_mutex; +}; + +// ---------------------------------------------------------------------------- +// Critical section: this is the same as mutex but is only visible to the +// threads of the same process. For the platforms which don't have native +// support for critical sections, they're implemented entirely in terms of +// mutexes. +// +// NB: wxCriticalSection object does not allocate any memory in its ctor +// which makes it possible to have static globals of this class +// ---------------------------------------------------------------------------- + +// in order to avoid any overhead under platforms where critical sections are +// just mutexes make all wxCriticalSection class functions inline +#if !defined(__WXMSW__) && !defined(__WXMAC__) + #define wxCRITSECT_IS_MUTEX 1 + + #define wxCRITSECT_INLINE inline +#else // MSW + #define wxCRITSECT_IS_MUTEX 0 + + #define wxCRITSECT_INLINE +#endif // MSW/!MSW + +// you should consider wxCriticalSectionLocker whenever possible instead of +// directly working with wxCriticalSection class - it is safer +class WXDLLIMPEXP_BASE wxCriticalSection +{ +public: + // ctor & dtor + wxCRITSECT_INLINE wxCriticalSection(); + wxCRITSECT_INLINE ~wxCriticalSection(); + + // enter the section (the same as locking a mutex) + wxCRITSECT_INLINE void Enter(); + + // leave the critical section (same as unlocking a mutex) + wxCRITSECT_INLINE void Leave(); + +private: +#if wxCRITSECT_IS_MUTEX + wxMutex m_mutex; +#elif defined(__WXMSW__) + // we can't allocate any memory in the ctor, so use placement new - + // unfortunately, we have to hardcode the sizeof() here because we can't + // include windows.h from this public header and we also have to use the + // union to force the correct (i.e. maximal) alignment + // + // if CRITICAL_SECTION size changes in Windows, you'll get an assert from + // thread.cpp and will need to increase the buffer size + // + // finally, we need this typedef instead of declaring m_buffer directly + // because otherwise the assert mentioned above wouldn't compile with some + // compilers (notably CodeWarrior 8) +#ifdef __WIN64__ + typedef char wxCritSectBuffer[40]; +#else // __WIN32__ + typedef char wxCritSectBuffer[24]; +#endif + union + { + unsigned long m_dummy1; + void *m_dummy2; + + wxCritSectBuffer m_buffer; + }; +#elif defined(__WXMAC__) + void *m_critRegion ; +#endif // Unix&OS2/Win32 + + DECLARE_NO_COPY_CLASS(wxCriticalSection) +}; + +#if wxCRITSECT_IS_MUTEX + // implement wxCriticalSection using mutexes + inline wxCriticalSection::wxCriticalSection() { } + inline wxCriticalSection::~wxCriticalSection() { } + + inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } + inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } +#endif // wxCRITSECT_IS_MUTEX + +#undef wxCRITSECT_INLINE +#undef wxCRITSECT_IS_MUTEX + +// wxCriticalSectionLocker is the same to critical sections as wxMutexLocker is +// to mutexes +class WXDLLIMPEXP_BASE wxCriticalSectionLocker +{ +public: + wxCriticalSectionLocker(wxCriticalSection& cs) + : m_critsect(cs) + { + m_critsect.Enter(); + } + + ~wxCriticalSectionLocker() + { + m_critsect.Leave(); + } + +private: + wxCriticalSection& m_critsect; + + DECLARE_NO_COPY_CLASS(wxCriticalSectionLocker) +}; + +// ---------------------------------------------------------------------------- +// wxCondition models a POSIX condition variable which allows one (or more) +// thread(s) to wait until some condition is fulfilled +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCondition +{ +public: + // Each wxCondition object is associated with a (single) wxMutex object. + // The mutex object MUST be locked before calling Wait() + wxCondition(wxMutex& mutex); + + // dtor is not virtual, don't use this class polymorphically + ~wxCondition(); + + // return true if the condition has been created successfully + bool IsOk() const; + + // NB: the associated mutex MUST be locked beforehand by the calling thread + // + // it atomically releases the lock on the associated mutex + // and starts waiting to be woken up by a Signal()/Broadcast() + // once its signaled, then it will wait until it can reacquire + // the lock on the associated mutex object, before returning. + wxCondError Wait(); + + // exactly as Wait() except that it may also return if the specified + // timeout elapses even if the condition hasn't been signalled: in this + // case, the return value is false, otherwise (i.e. in case of a normal + // return) it is true + // + // the timeout parameter specifies an interval that needs to be waited for + // in milliseconds + wxCondError WaitTimeout(unsigned long milliseconds); + + // NB: the associated mutex may or may not be locked by the calling thread + // + // this method unblocks one thread if any are blocking on the condition. + // if no thread is blocking in Wait(), then the signal is NOT remembered + // The thread which was blocking on Wait() will then reacquire the lock + // on the associated mutex object before returning + wxCondError Signal(); + + // NB: the associated mutex may or may not be locked by the calling thread + // + // this method unblocks all threads if any are blocking on the condition. + // if no thread is blocking in Wait(), then the signal is NOT remembered + // The threads which were blocking on Wait() will then reacquire the lock + // on the associated mutex object before returning. + wxCondError Broadcast(); + + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated version, don't use + wxDEPRECATED( bool Wait(unsigned long milliseconds) ); +#endif // WXWIN_COMPATIBILITY_2_6 + +private: + wxConditionInternal *m_internal; + + DECLARE_NO_COPY_CLASS(wxCondition) +}; + +#if WXWIN_COMPATIBILITY_2_6 + inline bool wxCondition::Wait(unsigned long milliseconds) + { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; } +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// wxSemaphore: a counter limiting the number of threads concurrently accessing +// a shared resource +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSemaphore +{ +public: + // specifying a maxcount of 0 actually makes wxSemaphore behave as if there + // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex + wxSemaphore( int initialcount = 0, int maxcount = 0 ); + + // dtor is not virtual, don't use this class polymorphically + ~wxSemaphore(); + + // return true if the semaphore has been created successfully + bool IsOk() const; + + // wait indefinitely, until the semaphore count goes beyond 0 + // and then decrement it and return (this method might have been called + // Acquire()) + wxSemaError Wait(); + + // same as Wait(), but does not block, returns wxSEMA_NO_ERROR if + // successful and wxSEMA_BUSY if the count is currently zero + wxSemaError TryWait(); + + // same as Wait(), but as a timeout limit, returns wxSEMA_NO_ERROR if the + // semaphore was acquired and wxSEMA_TIMEOUT if the timeout has elapsed + wxSemaError WaitTimeout(unsigned long milliseconds); + + // increments the semaphore count and signals one of the waiting threads + wxSemaError Post(); + +private: + wxSemaphoreInternal *m_internal; + + DECLARE_NO_COPY_CLASS(wxSemaphore) +}; + +// ---------------------------------------------------------------------------- +// wxThread: class encapsulating a thread of execution +// ---------------------------------------------------------------------------- + +// there are two different kinds of threads: joinable and detached (default) +// ones. Only joinable threads can return a return code and only detached +// threads auto-delete themselves - the user should delete the joinable +// threads manually. + +// NB: in the function descriptions the words "this thread" mean the thread +// created by the wxThread object while "main thread" is the thread created +// during the process initialization (a.k.a. the GUI thread) + +// On VMS thread pointers are 64 bits (also needed for other systems??? +#ifdef __VMS + typedef unsigned long long wxThreadIdType; +#else + typedef unsigned long wxThreadIdType; +#endif + +class WXDLLIMPEXP_BASE wxThread +{ +public: + // the return type for the thread function + typedef void *ExitCode; + + // static functions + // Returns the wxThread object for the calling thread. NULL is returned + // if the caller is the main thread (but it's recommended to use + // IsMain() and only call This() for threads other than the main one + // because NULL is also returned on error). If the thread wasn't + // created with wxThread class, the returned value is undefined. + static wxThread *This(); + + // Returns true if current thread is the main thread. + static bool IsMain(); + + // Release the rest of our time slice letting the other threads run + static void Yield(); + + // Sleep during the specified period of time in milliseconds + // + // NB: at least under MSW worker threads can not call ::wxSleep()! + static void Sleep(unsigned long milliseconds); + + // get the number of system CPUs - useful with SetConcurrency() + // (the "best" value for it is usually number of CPUs + 1) + // + // Returns -1 if unknown, number of CPUs otherwise + static int GetCPUCount(); + + // Get the platform specific thread ID and return as a long. This + // can be used to uniquely identify threads, even if they are not + // wxThreads. This is used by wxPython. + static wxThreadIdType GetCurrentId(); + + // sets the concurrency level: this is, roughly, the number of threads + // the system tries to schedule to run in parallel. 0 means the + // default value (usually acceptable, but may not yield the best + // performance for this process) + // + // Returns true on success, false otherwise (if not implemented, for + // example) + static bool SetConcurrency(size_t level); + + // constructor only creates the C++ thread object and doesn't create (or + // start) the real thread + wxThread(wxThreadKind kind = wxTHREAD_DETACHED); + + // functions that change the thread state: all these can only be called + // from _another_ thread (typically the thread that created this one, e.g. + // the main thread), not from the thread itself + + // create a new thread and optionally set the stack size on + // platforms that support that - call Run() to start it + // (special cased for watcom which won't accept 0 default) + + wxThreadError Create(unsigned int stackSize = 0); + + // starts execution of the thread - from the moment Run() is called + // the execution of wxThread::Entry() may start at any moment, caller + // shouldn't suppose that it starts after (or before) Run() returns. + wxThreadError Run(); + + // stops the thread if it's running and deletes the wxThread object if + // this is a detached thread freeing its memory - otherwise (for + // joinable threads) you still need to delete wxThread object + // yourself. + // + // this function only works if the thread calls TestDestroy() + // periodically - the thread will only be deleted the next time it + // does it! + // + // will fill the rc pointer with the thread exit code if it's !NULL + wxThreadError Delete(ExitCode *rc = (ExitCode *)NULL); + + // waits for a joinable thread to finish and returns its exit code + // + // Returns (ExitCode)-1 on error (for example, if the thread is not + // joinable) + ExitCode Wait(); + + // kills the thread without giving it any chance to clean up - should + // not be used under normal circumstances, use Delete() instead. + // It is a dangerous function that should only be used in the most + // extreme cases! + // + // The wxThread object is deleted by Kill() if the thread is + // detachable, but you still have to delete it manually for joinable + // threads. + wxThreadError Kill(); + + // pause a running thread: as Delete(), this only works if the thread + // calls TestDestroy() regularly + wxThreadError Pause(); + + // resume a paused thread + wxThreadError Resume(); + + // priority + // Sets the priority to "prio": see WXTHREAD_XXX_PRIORITY constants + // + // NB: the priority can only be set before the thread is created + void SetPriority(unsigned int prio); + + // Get the current priority. + unsigned int GetPriority() const; + + // thread status inquiries + // Returns true if the thread is alive: i.e. running or suspended + bool IsAlive() const; + // Returns true if the thread is running (not paused, not killed). + bool IsRunning() const; + // Returns true if the thread is suspended + bool IsPaused() const; + + // is the thread of detached kind? + bool IsDetached() const { return m_isDetached; } + + // Get the thread ID - a platform dependent number which uniquely + // identifies a thread inside a process + wxThreadIdType GetId() const; + + // called when the thread exits - in the context of this thread + // + // NB: this function will not be called if the thread is Kill()ed + virtual void OnExit() { } + + // Returns true if the thread was asked to terminate: this function should + // be called by the thread from time to time, otherwise the main thread + // will be left forever in Delete()! + virtual bool TestDestroy(); + + // dtor is public, but the detached threads should never be deleted - use + // Delete() instead (or leave the thread terminate by itself) + virtual ~wxThread(); + +protected: + // exits from the current thread - can be called only from this thread + void Exit(ExitCode exitcode = 0); + + // entry point for the thread - called by Run() and executes in the context + // of this thread. + virtual void *Entry() = 0; + +private: + // no copy ctor/assignment operator + wxThread(const wxThread&); + wxThread& operator=(const wxThread&); + + friend class wxThreadInternal; + + // the (platform-dependent) thread class implementation + wxThreadInternal *m_internal; + + // protects access to any methods of wxThreadInternal object + wxCriticalSection m_critsect; + + // true if the thread is detached, false if it is joinable + bool m_isDetached; +}; + +// wxThreadHelperThread class +// -------------------------- + +class WXDLLIMPEXP_BASE wxThreadHelperThread : public wxThread +{ +public: + // constructor only creates the C++ thread object and doesn't create (or + // start) the real thread + wxThreadHelperThread(wxThreadHelper& owner) + : wxThread(wxTHREAD_JOINABLE), m_owner(owner) + { } + +protected: + // entry point for the thread -- calls Entry() in owner. + virtual void *Entry(); + +private: + // the owner of the thread + wxThreadHelper& m_owner; + + // no copy ctor/assignment operator + wxThreadHelperThread(const wxThreadHelperThread&); + wxThreadHelperThread& operator=(const wxThreadHelperThread&); +}; + +// ---------------------------------------------------------------------------- +// wxThreadHelper: this class implements the threading logic to run a +// background task in another object (such as a window). It is a mix-in: just +// derive from it to implement a threading background task in your class. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxThreadHelper +{ +private: + void KillThread() + { + if ( m_thread ) + { + m_thread->Kill(); + delete m_thread; + } + } + +public: + // constructor only initializes m_thread to NULL + wxThreadHelper() : m_thread(NULL) { } + + // destructor deletes m_thread + virtual ~wxThreadHelper() { KillThread(); } + + // create a new thread (and optionally set the stack size on platforms that + // support/need that), call Run() to start it + wxThreadError Create(unsigned int stackSize = 0) + { + KillThread(); + + m_thread = new wxThreadHelperThread(*this); + + return m_thread->Create(stackSize); + } + + // entry point for the thread - called by Run() and executes in the context + // of this thread. + virtual void *Entry() = 0; + + // returns a pointer to the thread which can be used to call Run() + wxThread *GetThread() const { return m_thread; } + +protected: + wxThread *m_thread; +}; + +// call Entry() in owner, put it down here to avoid circular declarations +inline void *wxThreadHelperThread::Entry() +{ + return m_owner.Entry(); +} + +// ---------------------------------------------------------------------------- +// Automatic initialization +// ---------------------------------------------------------------------------- + +// GUI mutex handling. +void WXDLLIMPEXP_BASE wxMutexGuiEnter(); +void WXDLLIMPEXP_BASE wxMutexGuiLeave(); + +// macros for entering/leaving critical sections which may be used without +// having to take them inside "#if wxUSE_THREADS" +#define wxENTER_CRIT_SECT(cs) (cs).Enter() +#define wxLEAVE_CRIT_SECT(cs) (cs).Leave() +#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs +#define wxCRIT_SECT_DECLARE_MEMBER(cs) wxCriticalSection cs +#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(cs) + +// function for checking if we're in the main thread which may be used whether +// wxUSE_THREADS is 0 or 1 +inline bool wxIsMainThread() { return wxThread::IsMain(); } + +#else // !wxUSE_THREADS + +// no thread support +inline void WXDLLIMPEXP_BASE wxMutexGuiEnter() { } +inline void WXDLLIMPEXP_BASE wxMutexGuiLeave() { } + +// macros for entering/leaving critical sections which may be used without +// having to take them inside "#if wxUSE_THREADS" +// (the implementation uses dummy structs to force semicolon after the macro) +#define wxENTER_CRIT_SECT(cs) do {} while (0) +#define wxLEAVE_CRIT_SECT(cs) do {} while (0) +#define wxCRIT_SECT_DECLARE(cs) struct wxDummyCS##cs +#define wxCRIT_SECT_DECLARE_MEMBER(cs) struct wxDummyCSMember##cs +#define wxCRIT_SECT_LOCKER(name, cs) struct wxDummyCSLocker##name + +// if there is only one thread, it is always the main one +inline bool wxIsMainThread() { return true; } + +#endif // wxUSE_THREADS/!wxUSE_THREADS + +// mark part of code as being a critical section: this macro declares a +// critical section with the given name and enters it immediately and leaves +// it at the end of the current scope +// +// example: +// +// int Count() +// { +// static int s_counter = 0; +// +// wxCRITICAL_SECTION(counter); +// +// return ++s_counter; +// } +// +// this function is MT-safe in presence of the threads but there is no +// overhead when the library is compiled without threads +#define wxCRITICAL_SECTION(name) \ + wxCRIT_SECT_DECLARE(s_cs##name); \ + wxCRIT_SECT_LOCKER(cs##name##Locker, s_cs##name) + +// automatically lock GUI mutex in ctor and unlock it in dtor +class WXDLLIMPEXP_BASE wxMutexGuiLocker +{ +public: + wxMutexGuiLocker() { wxMutexGuiEnter(); } + ~wxMutexGuiLocker() { wxMutexGuiLeave(); } +}; + +// ----------------------------------------------------------------------------- +// implementation only until the end of file +// ----------------------------------------------------------------------------- + +#if wxUSE_THREADS + +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__) + // unlock GUI if there are threads waiting for and lock it back when + // there are no more of them - should be called periodically by the main + // thread + extern void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter(); + + // returns true if the main thread has GUI lock + extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread(); + + // wakes up the main thread if it's sleeping inside ::GetMessage() + extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); + + // return true if the main thread is waiting for some other to terminate: + // wxApp then should block all "dangerous" messages + extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread(); +#endif // MSW, Mac, OS/2 + +#endif // wxUSE_THREADS + +#endif // _WX_THREAD_H_ diff --git a/Externals/wxWidgets/include/wx/timer.h b/Externals/wxWidgets/include/wx/timer.h index f81cd3860b..f8b8d1e879 100644 --- a/Externals/wxWidgets/include/wx/timer.h +++ b/Externals/wxWidgets/include/wx/timer.h @@ -1,201 +1,201 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/timer.h -// Purpose: wxTimer, wxStopWatch and global time-related functions -// Author: Julian Smart -// Modified by: Vadim Zeitlin (wxTimerBase) -// Guillermo Rodriguez (global clean up) -// Created: 04/01/98 -// RCS-ID: $Id: timer.h 44244 2007-01-18 17:00:52Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIMER_H_BASE_ -#define _WX_TIMER_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_GUI && wxUSE_TIMER - -#include "wx/object.h" -#include "wx/longlong.h" -#include "wx/event.h" -#include "wx/stopwatch.h" // for backwards compatibility -#include "wx/window.h" // only for NewControlId() - - -// more readable flags for Start(): - -// generate notifications periodically until the timer is stopped (default) -#define wxTIMER_CONTINUOUS false - -// only send the notification once and then stop the timer -#define wxTIMER_ONE_SHOT true - -// the interface of wxTimer class -class WXDLLEXPORT wxTimerBase : public wxEvtHandler -{ -public: - // ctors and initializers - // ---------------------- - - // default: if you don't call SetOwner(), your only chance to get timer - // notifications is to override Notify() in the derived class - wxTimerBase() - { Init(); SetOwner(this); } - - // ctor which allows to avoid having to override Notify() in the derived - // class: the owner will get timer notifications which can be handled with - // EVT_TIMER - wxTimerBase(wxEvtHandler *owner, int timerid = wxID_ANY) - { Init(); SetOwner(owner, timerid); } - - // same as ctor above - void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY) - { - m_owner = owner; - m_idTimer = timerid == wxID_ANY ? wxWindow::NewControlId() : timerid; - } - - wxEvtHandler *GetOwner() const { return m_owner; } - - virtual ~wxTimerBase(); - - // working with the timer - // ---------------------- - - // start the timer: if milliseconds == -1, use the same value as for the - // last Start() - // - // it is now valid to call Start() multiple times: this just restarts the - // timer if it is already running - virtual bool Start(int milliseconds = -1, bool oneShot = false); - - // stop the timer - virtual void Stop() = 0; - - // override this in your wxTimer-derived class if you want to process timer - // messages in it, use non default ctor or SetOwner() otherwise - virtual void Notify(); - - // getting info - // ------------ - - // return true if the timer is running - virtual bool IsRunning() const = 0; - - // return the timer ID - int GetId() const { return m_idTimer; } - - // get the (last) timer interval in milliseconds - int GetInterval() const { return m_milli; } - - // return true if the timer is one shot - bool IsOneShot() const { return m_oneShot; } - -protected: - // common part of all ctors - void Init() - { m_owner = NULL; m_idTimer = wxID_ANY; m_milli = 0; m_oneShot = false; } - - wxEvtHandler *m_owner; - int m_idTimer; - int m_milli; // the timer interval - bool m_oneShot; // true if one shot - - DECLARE_NO_COPY_CLASS(wxTimerBase) -}; - -// ---------------------------------------------------------------------------- -// wxTimer itself -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - #include "wx/msw/timer.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/timer.h" -#elif defined(__WXGTK20__) - #include "wx/gtk/timer.h" -#elif defined(__WXGTK__) - #include "wx/gtk1/timer.h" -#elif defined(__WXX11__) || defined(__WXMGL__) || defined(__WXDFB__) - #include "wx/generic/timer.h" -#elif defined (__WXCOCOA__) - #include "wx/cocoa/timer.h" -#elif defined(__WXMAC__) - #include "wx/mac/timer.h" -#elif defined(__WXPM__) - #include "wx/os2/timer.h" -#endif - -// ---------------------------------------------------------------------------- -// wxTimerRunner: starts the timer in its ctor, stops in the dtor -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTimerRunner -{ -public: - wxTimerRunner(wxTimer& timer) : m_timer(timer) { } - wxTimerRunner(wxTimer& timer, int milli, bool oneShot = false) - : m_timer(timer) - { - m_timer.Start(milli, oneShot); - } - - void Start(int milli, bool oneShot = false) - { - m_timer.Start(milli, oneShot); - } - - ~wxTimerRunner() - { - if ( m_timer.IsRunning() ) - { - m_timer.Stop(); - } - } - -private: - wxTimer& m_timer; - - DECLARE_NO_COPY_CLASS(wxTimerRunner) -}; - -// ---------------------------------------------------------------------------- -// wxTimerEvent -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTimerEvent : public wxEvent -{ -public: - wxTimerEvent(int timerid = 0, int interval = 0) : wxEvent(timerid) - { - m_eventType = wxEVT_TIMER; - - m_interval = interval; - } - - // accessors - int GetInterval() const { return m_interval; } - - // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxTimerEvent(*this); } - -private: - int m_interval; - - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent) -}; - -typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&); - -#define wxTimerEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTimerEventFunction, &func) - -#define EVT_TIMER(timerid, func) \ - wx__DECLARE_EVT1(wxEVT_TIMER, timerid, wxTimerEventHandler(func)) - -#endif // wxUSE_GUI && wxUSE_TIMER - -#endif - // _WX_TIMER_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/timer.h +// Purpose: wxTimer, wxStopWatch and global time-related functions +// Author: Julian Smart +// Modified by: Vadim Zeitlin (wxTimerBase) +// Guillermo Rodriguez (global clean up) +// Created: 04/01/98 +// RCS-ID: $Id: timer.h 44244 2007-01-18 17:00:52Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMER_H_BASE_ +#define _WX_TIMER_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_GUI && wxUSE_TIMER + +#include "wx/object.h" +#include "wx/longlong.h" +#include "wx/event.h" +#include "wx/stopwatch.h" // for backwards compatibility +#include "wx/window.h" // only for NewControlId() + + +// more readable flags for Start(): + +// generate notifications periodically until the timer is stopped (default) +#define wxTIMER_CONTINUOUS false + +// only send the notification once and then stop the timer +#define wxTIMER_ONE_SHOT true + +// the interface of wxTimer class +class WXDLLEXPORT wxTimerBase : public wxEvtHandler +{ +public: + // ctors and initializers + // ---------------------- + + // default: if you don't call SetOwner(), your only chance to get timer + // notifications is to override Notify() in the derived class + wxTimerBase() + { Init(); SetOwner(this); } + + // ctor which allows to avoid having to override Notify() in the derived + // class: the owner will get timer notifications which can be handled with + // EVT_TIMER + wxTimerBase(wxEvtHandler *owner, int timerid = wxID_ANY) + { Init(); SetOwner(owner, timerid); } + + // same as ctor above + void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY) + { + m_owner = owner; + m_idTimer = timerid == wxID_ANY ? wxWindow::NewControlId() : timerid; + } + + wxEvtHandler *GetOwner() const { return m_owner; } + + virtual ~wxTimerBase(); + + // working with the timer + // ---------------------- + + // start the timer: if milliseconds == -1, use the same value as for the + // last Start() + // + // it is now valid to call Start() multiple times: this just restarts the + // timer if it is already running + virtual bool Start(int milliseconds = -1, bool oneShot = false); + + // stop the timer + virtual void Stop() = 0; + + // override this in your wxTimer-derived class if you want to process timer + // messages in it, use non default ctor or SetOwner() otherwise + virtual void Notify(); + + // getting info + // ------------ + + // return true if the timer is running + virtual bool IsRunning() const = 0; + + // return the timer ID + int GetId() const { return m_idTimer; } + + // get the (last) timer interval in milliseconds + int GetInterval() const { return m_milli; } + + // return true if the timer is one shot + bool IsOneShot() const { return m_oneShot; } + +protected: + // common part of all ctors + void Init() + { m_owner = NULL; m_idTimer = wxID_ANY; m_milli = 0; m_oneShot = false; } + + wxEvtHandler *m_owner; + int m_idTimer; + int m_milli; // the timer interval + bool m_oneShot; // true if one shot + + DECLARE_NO_COPY_CLASS(wxTimerBase) +}; + +// ---------------------------------------------------------------------------- +// wxTimer itself +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/timer.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/timer.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/timer.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/timer.h" +#elif defined(__WXX11__) || defined(__WXMGL__) || defined(__WXDFB__) + #include "wx/generic/timer.h" +#elif defined (__WXCOCOA__) + #include "wx/cocoa/timer.h" +#elif defined(__WXMAC__) + #include "wx/mac/timer.h" +#elif defined(__WXPM__) + #include "wx/os2/timer.h" +#endif + +// ---------------------------------------------------------------------------- +// wxTimerRunner: starts the timer in its ctor, stops in the dtor +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTimerRunner +{ +public: + wxTimerRunner(wxTimer& timer) : m_timer(timer) { } + wxTimerRunner(wxTimer& timer, int milli, bool oneShot = false) + : m_timer(timer) + { + m_timer.Start(milli, oneShot); + } + + void Start(int milli, bool oneShot = false) + { + m_timer.Start(milli, oneShot); + } + + ~wxTimerRunner() + { + if ( m_timer.IsRunning() ) + { + m_timer.Stop(); + } + } + +private: + wxTimer& m_timer; + + DECLARE_NO_COPY_CLASS(wxTimerRunner) +}; + +// ---------------------------------------------------------------------------- +// wxTimerEvent +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTimerEvent : public wxEvent +{ +public: + wxTimerEvent(int timerid = 0, int interval = 0) : wxEvent(timerid) + { + m_eventType = wxEVT_TIMER; + + m_interval = interval; + } + + // accessors + int GetInterval() const { return m_interval; } + + // implement the base class pure virtual + virtual wxEvent *Clone() const { return new wxTimerEvent(*this); } + +private: + int m_interval; + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent) +}; + +typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&); + +#define wxTimerEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTimerEventFunction, &func) + +#define EVT_TIMER(timerid, func) \ + wx__DECLARE_EVT1(wxEVT_TIMER, timerid, wxTimerEventHandler(func)) + +#endif // wxUSE_GUI && wxUSE_TIMER + +#endif + // _WX_TIMER_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/tipdlg.h b/Externals/wxWidgets/include/wx/tipdlg.h index 88f8905bd8..9a782e5be0 100644 --- a/Externals/wxWidgets/include/wx/tipdlg.h +++ b/Externals/wxWidgets/include/wx/tipdlg.h @@ -1,84 +1,84 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: tipdlg.h -// Purpose: declaration of wxTipDialog -// Author: Vadim Zeitlin -// Modified by: -// Created: 28.06.99 -// RCS-ID: $Id: tipdlg.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIPDLG_H_ -#define _WX_TIPDLG_H_ - -// ---------------------------------------------------------------------------- -// headers which we must include here -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_STARTUP_TIPS - -#include "wx/textfile.h" - -// ---------------------------------------------------------------------------- -// wxTipProvider - a class which is used by wxTipDialog to get the text of the -// tips -// ---------------------------------------------------------------------------- - -// the abstract base class: it provides the tips, i.e. implements the GetTip() -// function which returns the new tip each time it's called. To support this, -// wxTipProvider evidently needs some internal state which is the tip "index" -// and which should be saved/restored by the program to not always show one and -// the same tip (of course, you may use random starting position as well...) -class WXDLLIMPEXP_ADV wxTipProvider -{ -public: - wxTipProvider(size_t currentTip) { m_currentTip = currentTip; } - - // get the current tip and update the internal state to return the next tip - // when called for the next time - virtual wxString GetTip() = 0; - - // get the current tip "index" (or whatever allows the tip provider to know - // from where to start the next time) - size_t GetCurrentTip() const { return m_currentTip; } - - // Allows any user-derived class to optionally override this function to - // modify the tip as soon as it is read. If return wxEmptyString, then - // the tip is skipped, and the next one is read. - virtual wxString PreprocessTip(const wxString& tip) { return tip; } - - // virtual dtor for the base class - virtual ~wxTipProvider() { } - -protected: - size_t m_currentTip; -}; - -// a function which returns an implementation of wxTipProvider using the -// specified text file as the source of tips (each line is a tip). -// -// NB: the caller is responsible for deleting the pointer! -WXDLLIMPEXP_ADV wxTipProvider *wxCreateFileTipProvider(const wxString& filename, - size_t currentTip); - -// ---------------------------------------------------------------------------- -// wxTipDialog -// ---------------------------------------------------------------------------- - -// A dialog which shows a "tip" - a short and helpful messages describing to -// the user some program characteristic. Many programs show the tips at -// startup, so the dialog has "Show tips on startup" checkbox which allows to -// the user to disable this (however, it's the program which should show, or -// not, the dialog on startup depending on its value, not this class). -// -// The function returns true if this checkbox is checked, false otherwise. -WXDLLIMPEXP_ADV bool wxShowTip(wxWindow *parent, - wxTipProvider *tipProvider, - bool showAtStartup = true); - -#endif // wxUSE_STARTUP_TIPS - -#endif // _WX_TIPDLG_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: tipdlg.h +// Purpose: declaration of wxTipDialog +// Author: Vadim Zeitlin +// Modified by: +// Created: 28.06.99 +// RCS-ID: $Id: tipdlg.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIPDLG_H_ +#define _WX_TIPDLG_H_ + +// ---------------------------------------------------------------------------- +// headers which we must include here +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_STARTUP_TIPS + +#include "wx/textfile.h" + +// ---------------------------------------------------------------------------- +// wxTipProvider - a class which is used by wxTipDialog to get the text of the +// tips +// ---------------------------------------------------------------------------- + +// the abstract base class: it provides the tips, i.e. implements the GetTip() +// function which returns the new tip each time it's called. To support this, +// wxTipProvider evidently needs some internal state which is the tip "index" +// and which should be saved/restored by the program to not always show one and +// the same tip (of course, you may use random starting position as well...) +class WXDLLIMPEXP_ADV wxTipProvider +{ +public: + wxTipProvider(size_t currentTip) { m_currentTip = currentTip; } + + // get the current tip and update the internal state to return the next tip + // when called for the next time + virtual wxString GetTip() = 0; + + // get the current tip "index" (or whatever allows the tip provider to know + // from where to start the next time) + size_t GetCurrentTip() const { return m_currentTip; } + + // Allows any user-derived class to optionally override this function to + // modify the tip as soon as it is read. If return wxEmptyString, then + // the tip is skipped, and the next one is read. + virtual wxString PreprocessTip(const wxString& tip) { return tip; } + + // virtual dtor for the base class + virtual ~wxTipProvider() { } + +protected: + size_t m_currentTip; +}; + +// a function which returns an implementation of wxTipProvider using the +// specified text file as the source of tips (each line is a tip). +// +// NB: the caller is responsible for deleting the pointer! +WXDLLIMPEXP_ADV wxTipProvider *wxCreateFileTipProvider(const wxString& filename, + size_t currentTip); + +// ---------------------------------------------------------------------------- +// wxTipDialog +// ---------------------------------------------------------------------------- + +// A dialog which shows a "tip" - a short and helpful messages describing to +// the user some program characteristic. Many programs show the tips at +// startup, so the dialog has "Show tips on startup" checkbox which allows to +// the user to disable this (however, it's the program which should show, or +// not, the dialog on startup depending on its value, not this class). +// +// The function returns true if this checkbox is checked, false otherwise. +WXDLLIMPEXP_ADV bool wxShowTip(wxWindow *parent, + wxTipProvider *tipProvider, + bool showAtStartup = true); + +#endif // wxUSE_STARTUP_TIPS + +#endif // _WX_TIPDLG_H_ diff --git a/Externals/wxWidgets/include/wx/tipwin.h b/Externals/wxWidgets/include/wx/tipwin.h index b6c8d350aa..944afb8325 100644 --- a/Externals/wxWidgets/include/wx/tipwin.h +++ b/Externals/wxWidgets/include/wx/tipwin.h @@ -1,98 +1,98 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/tipwin.h -// Purpose: wxTipWindow is a window like the one typically used for -// showing the tooltips -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: tipwin.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TIPWIN_H_ -#define _WX_TIPWIN_H_ - -#if wxUSE_TIPWINDOW - -#if wxUSE_POPUPWIN - #include "wx/popupwin.h" - - #define wxTipWindowBase wxPopupTransientWindow -#else - #include "wx/frame.h" - - #define wxTipWindowBase wxFrame -#endif -#include "wx/arrstr.h" - -class WXDLLIMPEXP_FWD_CORE wxTipWindowView; - -// ---------------------------------------------------------------------------- -// wxTipWindow -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTipWindow : public wxTipWindowBase -{ -public: - // the mandatory ctor parameters are: the parent window and the text to - // show - // - // optionally you may also specify the length at which the lines are going - // to be broken in rows (100 pixels by default) - // - // windowPtr and rectBound are just passed to SetTipWindowPtr() and - // SetBoundingRect() - see below - wxTipWindow(wxWindow *parent, - const wxString& text, - wxCoord maxLength = 100, - wxTipWindow** windowPtr = NULL, - wxRect *rectBound = NULL); - - virtual ~wxTipWindow(); - - // If windowPtr is not NULL the given address will be NULLed when the - // window has closed - void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; } - - // If rectBound is not NULL, the window will disappear automatically when - // the mouse leave the specified rect: note that rectBound should be in the - // screen coordinates! - void SetBoundingRect(const wxRect& rectBound); - - // Hide and destroy the window - void Close(); - -protected: - // called by wxTipWindowView only - bool CheckMouseInBounds(const wxPoint& pos); - - // event handlers - void OnMouseClick(wxMouseEvent& event); - -#if !wxUSE_POPUPWIN - void OnActivate(wxActivateEvent& event); - void OnKillFocus(wxFocusEvent& event); -#else // wxUSE_POPUPWIN - virtual void OnDismiss(); -#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN - -private: - wxArrayString m_textLines; - wxCoord m_heightLine; - - wxTipWindowView *m_view; - - wxTipWindow** m_windowPtr; - wxRect m_rectBound; - - DECLARE_EVENT_TABLE() - - friend class wxTipWindowView; - - DECLARE_NO_COPY_CLASS(wxTipWindow) -}; - -#endif // wxUSE_TIPWINDOW - -#endif // _WX_TIPWIN_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/tipwin.h +// Purpose: wxTipWindow is a window like the one typically used for +// showing the tooltips +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.09.00 +// RCS-ID: $Id: tipwin.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIPWIN_H_ +#define _WX_TIPWIN_H_ + +#if wxUSE_TIPWINDOW + +#if wxUSE_POPUPWIN + #include "wx/popupwin.h" + + #define wxTipWindowBase wxPopupTransientWindow +#else + #include "wx/frame.h" + + #define wxTipWindowBase wxFrame +#endif +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_CORE wxTipWindowView; + +// ---------------------------------------------------------------------------- +// wxTipWindow +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTipWindow : public wxTipWindowBase +{ +public: + // the mandatory ctor parameters are: the parent window and the text to + // show + // + // optionally you may also specify the length at which the lines are going + // to be broken in rows (100 pixels by default) + // + // windowPtr and rectBound are just passed to SetTipWindowPtr() and + // SetBoundingRect() - see below + wxTipWindow(wxWindow *parent, + const wxString& text, + wxCoord maxLength = 100, + wxTipWindow** windowPtr = NULL, + wxRect *rectBound = NULL); + + virtual ~wxTipWindow(); + + // If windowPtr is not NULL the given address will be NULLed when the + // window has closed + void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; } + + // If rectBound is not NULL, the window will disappear automatically when + // the mouse leave the specified rect: note that rectBound should be in the + // screen coordinates! + void SetBoundingRect(const wxRect& rectBound); + + // Hide and destroy the window + void Close(); + +protected: + // called by wxTipWindowView only + bool CheckMouseInBounds(const wxPoint& pos); + + // event handlers + void OnMouseClick(wxMouseEvent& event); + +#if !wxUSE_POPUPWIN + void OnActivate(wxActivateEvent& event); + void OnKillFocus(wxFocusEvent& event); +#else // wxUSE_POPUPWIN + virtual void OnDismiss(); +#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN + +private: + wxArrayString m_textLines; + wxCoord m_heightLine; + + wxTipWindowView *m_view; + + wxTipWindow** m_windowPtr; + wxRect m_rectBound; + + DECLARE_EVENT_TABLE() + + friend class wxTipWindowView; + + DECLARE_NO_COPY_CLASS(wxTipWindow) +}; + +#endif // wxUSE_TIPWINDOW + +#endif // _WX_TIPWIN_H_ diff --git a/Externals/wxWidgets/include/wx/tokenzr.h b/Externals/wxWidgets/include/wx/tokenzr.h index 3b884f8a7a..8e643fd89a 100644 --- a/Externals/wxWidgets/include/wx/tokenzr.h +++ b/Externals/wxWidgets/include/wx/tokenzr.h @@ -1,135 +1,135 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tokenzr.h -// Purpose: String tokenizer - a C++ replacement for strtok(3) -// Author: Guilhem Lavaux -// Modified by: (or rather rewritten by) Vadim Zeitlin -// Created: 04/22/98 -// RCS-ID: $Id: tokenzr.h 36741 2006-01-06 21:41:54Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOKENZRH -#define _WX_TOKENZRH - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// default: delimiters are usual white space characters -#define wxDEFAULT_DELIMITERS (_T(" \t\r\n")) - -// wxStringTokenizer mode flags which determine its behaviour -enum wxStringTokenizerMode -{ - wxTOKEN_INVALID = -1, // set by def ctor until SetString() is called - wxTOKEN_DEFAULT, // strtok() for whitespace delims, RET_EMPTY else - wxTOKEN_RET_EMPTY, // return empty token in the middle of the string - wxTOKEN_RET_EMPTY_ALL, // return trailing empty tokens too - wxTOKEN_RET_DELIMS, // return the delim with token (implies RET_EMPTY) - wxTOKEN_STRTOK // behave exactly like strtok(3) -}; - -// ---------------------------------------------------------------------------- -// wxStringTokenizer: replaces infamous strtok() and has some other features -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStringTokenizer : public wxObject -{ -public: - // ctors and initializers - // default ctor, call SetString() later - wxStringTokenizer() { m_mode = wxTOKEN_INVALID; } - // ctor which gives us the string - wxStringTokenizer(const wxString& str, - const wxString& delims = wxDEFAULT_DELIMITERS, - wxStringTokenizerMode mode = wxTOKEN_DEFAULT); - - // args are same as for the non default ctor above - void SetString(const wxString& str, - const wxString& delims = wxDEFAULT_DELIMITERS, - wxStringTokenizerMode mode = wxTOKEN_DEFAULT); - - // reinitialize the tokenizer with the same delimiters/mode - void Reinit(const wxString& str); - - // tokens access - // return the number of remaining tokens - size_t CountTokens() const; - // did we reach the end of the string? - bool HasMoreTokens() const; - // get the next token, will return empty string if !HasMoreTokens() - wxString GetNextToken(); - // get the delimiter which terminated the token last retrieved by - // GetNextToken() or NUL if there had been no tokens yet or the last - // one wasn't terminated (but ran to the end of the string) - wxChar GetLastDelimiter() const { return m_lastDelim; } - - // get current tokenizer state - // returns the part of the string which remains to tokenize (*not* the - // initial string) - wxString GetString() const { return m_string.substr(m_pos); } - - // returns the current position (i.e. one index after the last - // returned token or 0 if GetNextToken() has never been called) in the - // original string - size_t GetPosition() const { return m_pos; } - - // misc - // get the current mode - can be different from the one passed to the - // ctor if it was wxTOKEN_DEFAULT - wxStringTokenizerMode GetMode() const { return m_mode; } - // do we return empty tokens? - bool AllowEmpty() const { return m_mode != wxTOKEN_STRTOK; } - - - // backwards compatibility section from now on - // ------------------------------------------- - - // for compatibility only, use GetNextToken() instead - wxString NextToken() { return GetNextToken(); } - - // compatibility only, don't use - void SetString(const wxString& to_tokenize, - const wxString& delims, - bool WXUNUSED(ret_delim)) - { - SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS); - } - - wxStringTokenizer(const wxString& to_tokenize, - const wxString& delims, - bool ret_delim) - { - SetString(to_tokenize, delims, ret_delim); - } - -protected: - bool IsOk() const { return m_mode != wxTOKEN_INVALID; } - - wxString m_string, // the string we tokenize - m_delims; // all possible delimiters - - size_t m_pos; // the current position in m_string - - wxStringTokenizerMode m_mode; // see wxTOKEN_XXX values - - wxChar m_lastDelim; // delimiter after last token or '\0' -}; - -// ---------------------------------------------------------------------------- -// convenience function which returns all tokens at once -// ---------------------------------------------------------------------------- - -// the function takes the same parameters as wxStringTokenizer ctor and returns -// the array containing all tokens -wxArrayString WXDLLIMPEXP_BASE -wxStringTokenize(const wxString& str, - const wxString& delims = wxDEFAULT_DELIMITERS, - wxStringTokenizerMode mode = wxTOKEN_DEFAULT); - -#endif // _WX_TOKENZRH +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tokenzr.h +// Purpose: String tokenizer - a C++ replacement for strtok(3) +// Author: Guilhem Lavaux +// Modified by: (or rather rewritten by) Vadim Zeitlin +// Created: 04/22/98 +// RCS-ID: $Id: tokenzr.h 36741 2006-01-06 21:41:54Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOKENZRH +#define _WX_TOKENZRH + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// default: delimiters are usual white space characters +#define wxDEFAULT_DELIMITERS (_T(" \t\r\n")) + +// wxStringTokenizer mode flags which determine its behaviour +enum wxStringTokenizerMode +{ + wxTOKEN_INVALID = -1, // set by def ctor until SetString() is called + wxTOKEN_DEFAULT, // strtok() for whitespace delims, RET_EMPTY else + wxTOKEN_RET_EMPTY, // return empty token in the middle of the string + wxTOKEN_RET_EMPTY_ALL, // return trailing empty tokens too + wxTOKEN_RET_DELIMS, // return the delim with token (implies RET_EMPTY) + wxTOKEN_STRTOK // behave exactly like strtok(3) +}; + +// ---------------------------------------------------------------------------- +// wxStringTokenizer: replaces infamous strtok() and has some other features +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringTokenizer : public wxObject +{ +public: + // ctors and initializers + // default ctor, call SetString() later + wxStringTokenizer() { m_mode = wxTOKEN_INVALID; } + // ctor which gives us the string + wxStringTokenizer(const wxString& str, + const wxString& delims = wxDEFAULT_DELIMITERS, + wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + + // args are same as for the non default ctor above + void SetString(const wxString& str, + const wxString& delims = wxDEFAULT_DELIMITERS, + wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + + // reinitialize the tokenizer with the same delimiters/mode + void Reinit(const wxString& str); + + // tokens access + // return the number of remaining tokens + size_t CountTokens() const; + // did we reach the end of the string? + bool HasMoreTokens() const; + // get the next token, will return empty string if !HasMoreTokens() + wxString GetNextToken(); + // get the delimiter which terminated the token last retrieved by + // GetNextToken() or NUL if there had been no tokens yet or the last + // one wasn't terminated (but ran to the end of the string) + wxChar GetLastDelimiter() const { return m_lastDelim; } + + // get current tokenizer state + // returns the part of the string which remains to tokenize (*not* the + // initial string) + wxString GetString() const { return m_string.substr(m_pos); } + + // returns the current position (i.e. one index after the last + // returned token or 0 if GetNextToken() has never been called) in the + // original string + size_t GetPosition() const { return m_pos; } + + // misc + // get the current mode - can be different from the one passed to the + // ctor if it was wxTOKEN_DEFAULT + wxStringTokenizerMode GetMode() const { return m_mode; } + // do we return empty tokens? + bool AllowEmpty() const { return m_mode != wxTOKEN_STRTOK; } + + + // backwards compatibility section from now on + // ------------------------------------------- + + // for compatibility only, use GetNextToken() instead + wxString NextToken() { return GetNextToken(); } + + // compatibility only, don't use + void SetString(const wxString& to_tokenize, + const wxString& delims, + bool WXUNUSED(ret_delim)) + { + SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS); + } + + wxStringTokenizer(const wxString& to_tokenize, + const wxString& delims, + bool ret_delim) + { + SetString(to_tokenize, delims, ret_delim); + } + +protected: + bool IsOk() const { return m_mode != wxTOKEN_INVALID; } + + wxString m_string, // the string we tokenize + m_delims; // all possible delimiters + + size_t m_pos; // the current position in m_string + + wxStringTokenizerMode m_mode; // see wxTOKEN_XXX values + + wxChar m_lastDelim; // delimiter after last token or '\0' +}; + +// ---------------------------------------------------------------------------- +// convenience function which returns all tokens at once +// ---------------------------------------------------------------------------- + +// the function takes the same parameters as wxStringTokenizer ctor and returns +// the array containing all tokens +wxArrayString WXDLLIMPEXP_BASE +wxStringTokenize(const wxString& str, + const wxString& delims = wxDEFAULT_DELIMITERS, + wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + +#endif // _WX_TOKENZRH diff --git a/Externals/wxWidgets/include/wx/toolbar.h b/Externals/wxWidgets/include/wx/toolbar.h index a64868e48b..f70678e7c6 100644 --- a/Externals/wxWidgets/include/wx/toolbar.h +++ b/Externals/wxWidgets/include/wx/toolbar.h @@ -1,93 +1,93 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/toolbar.h -// Purpose: wxToolBar interface declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.11.99 -// RCS-ID: $Id: toolbar.h 42645 2006-10-29 19:12:52Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOOLBAR_H_BASE_ -#define _WX_TOOLBAR_H_BASE_ - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxToolBar style flags -// ---------------------------------------------------------------------------- - -enum -{ - // lay out the toolbar horizontally - wxTB_HORIZONTAL = wxHORIZONTAL, // == 0x0004 - wxTB_TOP = wxTB_HORIZONTAL, - - // lay out the toolbar vertically - wxTB_VERTICAL = wxVERTICAL, // == 0x0008 - wxTB_LEFT = wxTB_VERTICAL, - - // show 3D buttons (wxToolBarSimple only) - wxTB_3DBUTTONS = 0x0010, - - // "flat" buttons (Win32/GTK only) - wxTB_FLAT = 0x0020, - - // dockable toolbar (GTK only) - wxTB_DOCKABLE = 0x0040, - - // don't show the icons (they're shown by default) - wxTB_NOICONS = 0x0080, - - // show the text (not shown by default) - wxTB_TEXT = 0x0100, - - // don't show the divider between toolbar and the window (Win32 only) - wxTB_NODIVIDER = 0x0200, - - // no automatic alignment (Win32 only, useless) - wxTB_NOALIGN = 0x0400, - - // show the text and the icons alongside, not vertically stacked (Win32/GTK) - wxTB_HORZ_LAYOUT = 0x0800, - wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT, - - // don't show the toolbar short help tooltips - wxTB_NO_TOOLTIPS = 0x1000, - - // lay out toolbar at the bottom of the window - wxTB_BOTTOM = 0x2000, - - // lay out toolbar at the right edge of the window - wxTB_RIGHT = 0x4000 -}; - -#if wxUSE_TOOLBAR - #include "wx/tbarbase.h" // the base class for all toolbars - - #if defined(__WXUNIVERSAL__) - #include "wx/univ/toolbar.h" - #elif defined(__WXPALMOS__) - #include "wx/palmos/toolbar.h" - #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) - #include "wx/msw/tbar95.h" - #elif defined(__WXWINCE__) - #include "wx/msw/wince/tbarwce.h" - #elif defined(__WXMOTIF__) - #include "wx/motif/toolbar.h" - #elif defined(__WXGTK20__) - #include "wx/gtk/tbargtk.h" - #elif defined(__WXGTK__) - #include "wx/gtk1/tbargtk.h" - #elif defined(__WXMAC__) - #include "wx/mac/toolbar.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/toolbar.h" - #elif defined(__WXPM__) - #include "wx/os2/toolbar.h" - #endif -#endif // wxUSE_TOOLBAR - -#endif - // _WX_TOOLBAR_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/toolbar.h +// Purpose: wxToolBar interface declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.11.99 +// RCS-ID: $Id: toolbar.h 42645 2006-10-29 19:12:52Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBAR_H_BASE_ +#define _WX_TOOLBAR_H_BASE_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxToolBar style flags +// ---------------------------------------------------------------------------- + +enum +{ + // lay out the toolbar horizontally + wxTB_HORIZONTAL = wxHORIZONTAL, // == 0x0004 + wxTB_TOP = wxTB_HORIZONTAL, + + // lay out the toolbar vertically + wxTB_VERTICAL = wxVERTICAL, // == 0x0008 + wxTB_LEFT = wxTB_VERTICAL, + + // show 3D buttons (wxToolBarSimple only) + wxTB_3DBUTTONS = 0x0010, + + // "flat" buttons (Win32/GTK only) + wxTB_FLAT = 0x0020, + + // dockable toolbar (GTK only) + wxTB_DOCKABLE = 0x0040, + + // don't show the icons (they're shown by default) + wxTB_NOICONS = 0x0080, + + // show the text (not shown by default) + wxTB_TEXT = 0x0100, + + // don't show the divider between toolbar and the window (Win32 only) + wxTB_NODIVIDER = 0x0200, + + // no automatic alignment (Win32 only, useless) + wxTB_NOALIGN = 0x0400, + + // show the text and the icons alongside, not vertically stacked (Win32/GTK) + wxTB_HORZ_LAYOUT = 0x0800, + wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT, + + // don't show the toolbar short help tooltips + wxTB_NO_TOOLTIPS = 0x1000, + + // lay out toolbar at the bottom of the window + wxTB_BOTTOM = 0x2000, + + // lay out toolbar at the right edge of the window + wxTB_RIGHT = 0x4000 +}; + +#if wxUSE_TOOLBAR + #include "wx/tbarbase.h" // the base class for all toolbars + + #if defined(__WXUNIVERSAL__) + #include "wx/univ/toolbar.h" + #elif defined(__WXPALMOS__) + #include "wx/palmos/toolbar.h" + #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) + #include "wx/msw/tbar95.h" + #elif defined(__WXWINCE__) + #include "wx/msw/wince/tbarwce.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/toolbar.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/tbargtk.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/tbargtk.h" + #elif defined(__WXMAC__) + #include "wx/mac/toolbar.h" + #elif defined(__WXCOCOA__) + #include "wx/cocoa/toolbar.h" + #elif defined(__WXPM__) + #include "wx/os2/toolbar.h" + #endif +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TOOLBAR_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/toolbook.h b/Externals/wxWidgets/include/wx/toolbook.h index 695ffa8835..752793ebf2 100644 --- a/Externals/wxWidgets/include/wx/toolbook.h +++ b/Externals/wxWidgets/include/wx/toolbook.h @@ -1,163 +1,163 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/toolbook.h -// Purpose: wxToolbook: wxToolBar and wxNotebook combination -// Author: Julian Smart -// Modified by: -// Created: 2006-01-29 -// RCS-ID: $Id: toolbook.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2006 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOOLBOOK_H_ -#define _WX_TOOLBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_TOOLBOOK - -#include "wx/bookctrl.h" - -class WXDLLIMPEXP_FWD_CORE wxToolBarBase; -class WXDLLIMPEXP_FWD_CORE wxCommandEvent; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING; - - -// Use wxButtonToolBar -#define wxBK_BUTTONBAR 0x0100 - -// ---------------------------------------------------------------------------- -// wxToolbook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolbook : public wxBookCtrlBase -{ -public: - wxToolbook() - { - Init(); - } - - wxToolbook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString); - - - // implement base class virtuals - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual bool InsertPage(size_t n, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = -1); - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual void SetImageList(wxImageList *imageList); - - virtual bool DeleteAllPages(); - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - - - // methods which are not part of base wxBookctrl API - - // get the underlying toolbar - wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; } - - // must be called in OnIdle or by application to realize the toolbar and - // select the initial page. - void Realize(); - -protected: - virtual wxWindow *DoRemovePage(size_t page); - - // get the size which the list control should have - virtual wxSize GetControllerSize() const; - - // event handlers - void OnToolSelected(wxCommandEvent& event); - void OnSize(wxSizeEvent& event); - void OnIdle(wxIdleEvent& event); - - void UpdateSelectedPage(size_t newsel); - - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - - // whether the toolbar needs to be realized - bool m_needsRealizing; - - // maximum bitmap size - wxSize m_maxBitmapSize; - -private: - // common part of all constructors - void Init(); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook) -}; - -// ---------------------------------------------------------------------------- -// listbook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolbookEvent : public wxBookCtrlBaseEvent -{ -public: - wxToolbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxToolbookEvent(const wxToolbookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxToolbookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxToolbookEvent) -}; - -typedef void (wxEvtHandler::*wxToolbookEventFunction)(wxToolbookEvent&); - -#define wxToolbookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxToolbookEventFunction, &func) - -#define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxToolbookEventHandler(fn)) - -#define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxToolbookEventHandler(fn)) - -#endif // wxUSE_TOOLBOOK - -#endif // _WX_TOOLBOOK_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/toolbook.h +// Purpose: wxToolbook: wxToolBar and wxNotebook combination +// Author: Julian Smart +// Modified by: +// Created: 2006-01-29 +// RCS-ID: $Id: toolbook.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2006 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBOOK_H_ +#define _WX_TOOLBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_TOOLBOOK + +#include "wx/bookctrl.h" + +class WXDLLIMPEXP_FWD_CORE wxToolBarBase; +class WXDLLIMPEXP_FWD_CORE wxCommandEvent; + +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING; + + +// Use wxButtonToolBar +#define wxBK_BUTTONBAR 0x0100 + +// ---------------------------------------------------------------------------- +// wxToolbook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxToolbook : public wxBookCtrlBase +{ +public: + wxToolbook() + { + Init(); + } + + wxToolbook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + // implement base class virtuals + virtual int GetSelection() const; + virtual bool SetPageText(size_t n, const wxString& strText); + virtual wxString GetPageText(size_t n) const; + virtual int GetPageImage(size_t n) const; + virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = -1); + virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } + virtual void SetImageList(wxImageList *imageList); + + virtual bool DeleteAllPages(); + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + + + // methods which are not part of base wxBookctrl API + + // get the underlying toolbar + wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; } + + // must be called in OnIdle or by application to realize the toolbar and + // select the initial page. + void Realize(); + +protected: + virtual wxWindow *DoRemovePage(size_t page); + + // get the size which the list control should have + virtual wxSize GetControllerSize() const; + + // event handlers + void OnToolSelected(wxCommandEvent& event); + void OnSize(wxSizeEvent& event); + void OnIdle(wxIdleEvent& event); + + void UpdateSelectedPage(size_t newsel); + + wxBookCtrlBaseEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlBaseEvent &event); + + // the currently selected page or wxNOT_FOUND if none + int m_selection; + + // whether the toolbar needs to be realized + bool m_needsRealizing; + + // maximum bitmap size + wxSize m_maxBitmapSize; + +private: + // common part of all constructors + void Init(); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook) +}; + +// ---------------------------------------------------------------------------- +// listbook event class and related stuff +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxToolbookEvent : public wxBookCtrlBaseEvent +{ +public: + wxToolbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + + wxToolbookEvent(const wxToolbookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxToolbookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxToolbookEvent) +}; + +typedef void (wxEvtHandler::*wxToolbookEventFunction)(wxToolbookEvent&); + +#define wxToolbookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxToolbookEventFunction, &func) + +#define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxToolbookEventHandler(fn)) + +#define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxToolbookEventHandler(fn)) + +#endif // wxUSE_TOOLBOOK + +#endif // _WX_TOOLBOOK_H_ diff --git a/Externals/wxWidgets/include/wx/tooltip.h b/Externals/wxWidgets/include/wx/tooltip.h index af29741f45..ac6219bab1 100644 --- a/Externals/wxWidgets/include/wx/tooltip.h +++ b/Externals/wxWidgets/include/wx/tooltip.h @@ -1,39 +1,39 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tooltip.h -// Purpose: wxToolTip base header -// Author: Robert Roebling -// Modified by: -// Created: -// Copyright: (c) Robert Roebling -// RCS-ID: $Id: tooltip.h 37066 2006-01-23 03:27:34Z MR $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOOLTIP_H_BASE_ -#define _WX_TOOLTIP_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TOOLTIPS - -#if defined(__WXMSW__) -#include "wx/msw/tooltip.h" -#elif defined(__WXMOTIF__) -// #include "wx/motif/tooltip.h" -#elif defined(__WXGTK20__) -#include "wx/gtk/tooltip.h" -#elif defined(__WXGTK__) -#include "wx/gtk1/tooltip.h" -#elif defined(__WXMAC__) -#include "wx/mac/tooltip.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/tooltip.h" -#elif defined(__WXPM__) -#include "wx/os2/tooltip.h" -#endif - -#endif - // wxUSE_TOOLTIPS - -#endif - // _WX_TOOLTIP_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: tooltip.h +// Purpose: wxToolTip base header +// Author: Robert Roebling +// Modified by: +// Created: +// Copyright: (c) Robert Roebling +// RCS-ID: $Id: tooltip.h 37066 2006-01-23 03:27:34Z MR $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLTIP_H_BASE_ +#define _WX_TOOLTIP_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TOOLTIPS + +#if defined(__WXMSW__) +#include "wx/msw/tooltip.h" +#elif defined(__WXMOTIF__) +// #include "wx/motif/tooltip.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/tooltip.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/tooltip.h" +#elif defined(__WXMAC__) +#include "wx/mac/tooltip.h" +#elif defined(__WXCOCOA__) +#include "wx/cocoa/tooltip.h" +#elif defined(__WXPM__) +#include "wx/os2/tooltip.h" +#endif + +#endif + // wxUSE_TOOLTIPS + +#endif + // _WX_TOOLTIP_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/toplevel.h b/Externals/wxWidgets/include/wx/toplevel.h index 2351d7cd9a..3ab0c9e709 100644 --- a/Externals/wxWidgets/include/wx/toplevel.h +++ b/Externals/wxWidgets/include/wx/toplevel.h @@ -1,375 +1,375 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/toplevel.h -// Purpose: declares wxTopLevelWindow class, the base class for all -// top level windows (such as frames and dialogs) -// Author: Vadim Zeitlin, Vaclav Slavik -// Modified by: -// Created: 06.08.01 -// RCS-ID: $Id: toplevel.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Vaclav Slavik <vaclav@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOPLEVEL_BASE_H_ -#define _WX_TOPLEVEL_BASE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/window.h" -#include "wx/iconbndl.h" - -// the default names for various classes -extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// style common to both wxFrame and wxDialog -#define wxSTAY_ON_TOP 0x8000 -#define wxICONIZE 0x4000 -#define wxMINIMIZE wxICONIZE -#define wxMAXIMIZE 0x2000 -#define wxCLOSE_BOX 0x1000 - -#define wxSYSTEM_MENU 0x0800 -#define wxMINIMIZE_BOX 0x0400 -#define wxMAXIMIZE_BOX 0x0200 -#define wxTINY_CAPTION_HORIZ 0x0100 -#define wxTINY_CAPTION_VERT 0x0080 -#define wxRESIZE_BORDER 0x0040 - -#if WXWIN_COMPATIBILITY_2_6 - - // deprecated versions defined for compatibility reasons - #define wxRESIZE_BOX wxMAXIMIZE_BOX - #define wxTHICK_FRAME wxRESIZE_BORDER - - // obsolete styles, unused any more - #define wxDIALOG_MODAL 0 - #define wxDIALOG_MODELESS 0 - #define wxNO_3D 0 - #define wxUSER_COLOURS 0 - -#endif // WXWIN_COMPATIBILITY_2_6 - -// default style -// -// under Windows CE (at least when compiling with eVC 4) we should create -// top level windows without any styles at all for them to appear -// "correctly", i.e. as full screen windows with a "hide" button (same as -// "close" but round instead of squared and just hides the applications -// instead of closing it) in the title bar -#if defined(__WXWINCE__) - #if defined(__SMARTPHONE__) - #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE) - #elif defined(__WINCE_STANDARDSDK__) - #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE|wxCLOSE_BOX) - #else - #define wxDEFAULT_FRAME_STYLE (wxNO_BORDER) - #endif -#else // !__WXWINCE__ - #define wxDEFAULT_FRAME_STYLE \ - (wxSYSTEM_MENU | \ - wxRESIZE_BORDER | \ - wxMINIMIZE_BOX | \ - wxMAXIMIZE_BOX | \ - wxCLOSE_BOX | \ - wxCAPTION | \ - wxCLIP_CHILDREN) -#endif - - -// Dialogs are created in a special way -#define wxTOPLEVEL_EX_DIALOG 0x00000008 - -// Styles for ShowFullScreen -// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and -// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow) -enum -{ - wxFULLSCREEN_NOMENUBAR = 0x0001, - wxFULLSCREEN_NOTOOLBAR = 0x0002, - wxFULLSCREEN_NOSTATUSBAR = 0x0004, - wxFULLSCREEN_NOBORDER = 0x0008, - wxFULLSCREEN_NOCAPTION = 0x0010, - - wxFULLSCREEN_ALL = wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | - wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | - wxFULLSCREEN_NOCAPTION -}; - -// Styles for RequestUserAttention -enum -{ - wxUSER_ATTENTION_INFO = 1, - wxUSER_ATTENTION_ERROR = 2 -}; - -// ---------------------------------------------------------------------------- -// wxTopLevelWindow: a top level (as opposed to child) window -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow -{ -public: - // construction - wxTopLevelWindowBase(); - virtual ~wxTopLevelWindowBase(); - - // top level wnd state - // -------------------- - - // maximize = true => maximize, otherwise - restore - virtual void Maximize(bool maximize = true) = 0; - - // undo Maximize() or Iconize() - virtual void Restore() = 0; - - // iconize = true => iconize, otherwise - restore - virtual void Iconize(bool iconize = true) = 0; - - // return true if the frame is maximized - virtual bool IsMaximized() const = 0; - - // return true if the frame is always maximized - // due to native guidelines or current policy - virtual bool IsAlwaysMaximized() const; - - // return true if the frame is iconized - virtual bool IsIconized() const = 0; - - // get the frame icon - const wxIcon& GetIcon() const { return m_icons.GetIcon( -1 ); } - - // get the frame icons - const wxIconBundle& GetIcons() const { return m_icons; } - - // set the frame icon - virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); } - - // set the frame icons - virtual void SetIcons(const wxIconBundle& icons ) { m_icons = icons; } - - // maximize the window to cover entire screen - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; - - // return true if the frame is in fullscreen mode - virtual bool IsFullScreen() const = 0; - - // the title of the top level window: the text which the - // window shows usually at the top of the frame/dialog in dedicated bar - virtual void SetTitle(const wxString& title) = 0; - virtual wxString GetTitle() const = 0; - - // enable/disable close button [x] - virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } - - // Set the shape of the window to the given region. - // Returns true if the platform supports this feature (and the - // operation is successful.) - virtual bool SetShape(const wxRegion& WXUNUSED(region)) { return false; } - - // Attracts the users attention to this window if the application is - // inactive (should be called when a background event occurs) - virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - - // Is this the active frame (highlighted in the taskbar)? - virtual bool IsActive() { return wxGetTopLevelParent(FindFocus()) == this; } - - // this function may be overridden to return false to allow closing the - // application even when this top level window is still open - // - // notice that the window is still closed prior to the application exit and - // so it can still veto it even if it returns false from here - virtual bool ShouldPreventAppExit() const { return true; } - - -#if defined(__SMARTPHONE__) - virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; - virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; -#endif // __SMARTPHONE__ - - // centre the window on screen: this is just a shortcut - void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); } - void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } - - - // default item access: we have a permanent default item which is the one - // set by the user code but we may also have a temporary default item which - // would be chosen if the user pressed "Enter" now but the default action - // reverts to the "permanent" default as soon as this temporary default - // item loses focus - - // used to reset default if pointing to removed child - virtual void RemoveChild(wxWindowBase *child); - - // get the default item, temporary or permanent - wxWindow *GetDefaultItem() const - { return m_winTmpDefault ? m_winTmpDefault : m_winDefault; } - - // set the permanent default item, return the old default - wxWindow *SetDefaultItem(wxWindow *win) - { wxWindow *old = GetDefaultItem(); m_winDefault = win; return old; } - - // return the temporary default item, can be NULL - wxWindow *GetTmpDefaultItem() const { return m_winTmpDefault; } - - // set a temporary default item, SetTmpDefaultItem(NULL) should be called - // soon after a call to SetTmpDefaultItem(window), return the old default - wxWindow *SetTmpDefaultItem(wxWindow *win) - { wxWindow *old = GetDefaultItem(); m_winTmpDefault = win; return old; } - - - // implementation only from now on - // ------------------------------- - - // override some base class virtuals - virtual bool Destroy(); - virtual bool IsTopLevel() const { return true; } - virtual bool IsVisible() const { return IsShown(); } - - // event handlers - void OnCloseWindow(wxCloseEvent& event); - void OnSize(wxSizeEvent& WXUNUSED(event)) { DoLayout(); } - - // Get rect to be used to center top-level children - virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); - - // this should go away, but for now it's called from docview.cpp, - // so should be there for all platforms - void OnActivate(wxActivateEvent &WXUNUSED(event)) { } - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; - - // a different API for SetSizeHints - virtual void SetMinSize(const wxSize& minSize); - virtual void SetMaxSize(const wxSize& maxSize); - - // set size hints for "window manager" - virtual void DoSetSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, - int incW = wxDefaultCoord, int incH = wxDefaultCoord ); - -protected: - // the frame client to screen translation should take account of the - // toolbar which may shift the origin of the client area - virtual void DoClientToScreen(int *x, int *y) const; - virtual void DoScreenToClient(int *x, int *y) const; - - // add support for wxCENTRE_ON_SCREEN - virtual void DoCentre(int dir); - - // no need to do client to screen translation to get our position in screen - // coordinates: this is already the case - virtual void DoGetScreenPosition(int *x, int *y) const - { - DoGetPosition(x, y); - } - - // test whether this window makes part of the frame - // (menubar, toolbar and statusbar are excluded from automatic layout) - virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const - { return false; } - - // check if we should exit the program after deleting this window - bool IsLastBeforeExit() const; - - // send the iconize event, return true if processed - bool SendIconizeEvent(bool iconized = true); - - // do TLW-specific layout: we resize our unique child to fill the entire - // client area - void DoLayout(); - - // Get the default size for the new window if no explicit size given. If - // there are better default sizes then these can be changed, just as long - // as they are not too small for TLWs (and not larger than screen). - static wxSize GetDefaultSize(); - static int WidthDefault(int w) { return w == wxDefaultCoord ? GetDefaultSize().x : w; } - static int HeightDefault(int h) { return h == wxDefaultCoord ? GetDefaultSize().y : h; } - - // the frame icon - wxIconBundle m_icons; - - // a default window (usually a button) or NULL - wxWindow *m_winDefault; - - // a temporary override of m_winDefault, use the latter if NULL - wxWindow *m_winTmpDefault; - - DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase) - DECLARE_EVENT_TABLE() -}; - - -// include the real class declaration -#if defined(__WXPALMOS__) - #include "wx/palmos/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowPalm -#elif defined(__WXMSW__) - #include "wx/msw/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMSW -#elif defined(__WXGTK20__) - #include "wx/gtk/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowGTK -#elif defined(__WXGTK__) - #include "wx/gtk1/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowGTK -#elif defined(__WXX11__) - #include "wx/x11/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowX11 -#elif defined(__WXMGL__) - #include "wx/mgl/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMGL -#elif defined(__WXDFB__) - #include "wx/dfb/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowDFB -#elif defined(__WXMAC__) - #include "wx/mac/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMac -#elif defined(__WXCOCOA__) - #include "wx/cocoa/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowCocoa -#elif defined(__WXPM__) - #include "wx/os2/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowOS2 -#elif defined(__WXMOTIF__) - #include "wx/motif/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowMotif -#endif - -#ifdef __WXUNIVERSAL__ - #include "wx/univ/toplevel.h" -#else // !__WXUNIVERSAL__ - #ifdef wxTopLevelWindowNative - class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative - { - public: - // construction - wxTopLevelWindow() { Init(); } - wxTopLevelWindow(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow) - }; - #endif // wxTopLevelWindowNative -#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ - - -#endif // _WX_TOPLEVEL_BASE_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/toplevel.h +// Purpose: declares wxTopLevelWindow class, the base class for all +// top level windows (such as frames and dialogs) +// Author: Vadim Zeitlin, Vaclav Slavik +// Modified by: +// Created: 06.08.01 +// RCS-ID: $Id: toplevel.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Vaclav Slavik <vaclav@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOPLEVEL_BASE_H_ +#define _WX_TOPLEVEL_BASE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/window.h" +#include "wx/iconbndl.h" + +// the default names for various classes +extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// style common to both wxFrame and wxDialog +#define wxSTAY_ON_TOP 0x8000 +#define wxICONIZE 0x4000 +#define wxMINIMIZE wxICONIZE +#define wxMAXIMIZE 0x2000 +#define wxCLOSE_BOX 0x1000 + +#define wxSYSTEM_MENU 0x0800 +#define wxMINIMIZE_BOX 0x0400 +#define wxMAXIMIZE_BOX 0x0200 +#define wxTINY_CAPTION_HORIZ 0x0100 +#define wxTINY_CAPTION_VERT 0x0080 +#define wxRESIZE_BORDER 0x0040 + +#if WXWIN_COMPATIBILITY_2_6 + + // deprecated versions defined for compatibility reasons + #define wxRESIZE_BOX wxMAXIMIZE_BOX + #define wxTHICK_FRAME wxRESIZE_BORDER + + // obsolete styles, unused any more + #define wxDIALOG_MODAL 0 + #define wxDIALOG_MODELESS 0 + #define wxNO_3D 0 + #define wxUSER_COLOURS 0 + +#endif // WXWIN_COMPATIBILITY_2_6 + +// default style +// +// under Windows CE (at least when compiling with eVC 4) we should create +// top level windows without any styles at all for them to appear +// "correctly", i.e. as full screen windows with a "hide" button (same as +// "close" but round instead of squared and just hides the applications +// instead of closing it) in the title bar +#if defined(__WXWINCE__) + #if defined(__SMARTPHONE__) + #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE) + #elif defined(__WINCE_STANDARDSDK__) + #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE|wxCLOSE_BOX) + #else + #define wxDEFAULT_FRAME_STYLE (wxNO_BORDER) + #endif +#else // !__WXWINCE__ + #define wxDEFAULT_FRAME_STYLE \ + (wxSYSTEM_MENU | \ + wxRESIZE_BORDER | \ + wxMINIMIZE_BOX | \ + wxMAXIMIZE_BOX | \ + wxCLOSE_BOX | \ + wxCAPTION | \ + wxCLIP_CHILDREN) +#endif + + +// Dialogs are created in a special way +#define wxTOPLEVEL_EX_DIALOG 0x00000008 + +// Styles for ShowFullScreen +// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and +// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow) +enum +{ + wxFULLSCREEN_NOMENUBAR = 0x0001, + wxFULLSCREEN_NOTOOLBAR = 0x0002, + wxFULLSCREEN_NOSTATUSBAR = 0x0004, + wxFULLSCREEN_NOBORDER = 0x0008, + wxFULLSCREEN_NOCAPTION = 0x0010, + + wxFULLSCREEN_ALL = wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | + wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | + wxFULLSCREEN_NOCAPTION +}; + +// Styles for RequestUserAttention +enum +{ + wxUSER_ATTENTION_INFO = 1, + wxUSER_ATTENTION_ERROR = 2 +}; + +// ---------------------------------------------------------------------------- +// wxTopLevelWindow: a top level (as opposed to child) window +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow +{ +public: + // construction + wxTopLevelWindowBase(); + virtual ~wxTopLevelWindowBase(); + + // top level wnd state + // -------------------- + + // maximize = true => maximize, otherwise - restore + virtual void Maximize(bool maximize = true) = 0; + + // undo Maximize() or Iconize() + virtual void Restore() = 0; + + // iconize = true => iconize, otherwise - restore + virtual void Iconize(bool iconize = true) = 0; + + // return true if the frame is maximized + virtual bool IsMaximized() const = 0; + + // return true if the frame is always maximized + // due to native guidelines or current policy + virtual bool IsAlwaysMaximized() const; + + // return true if the frame is iconized + virtual bool IsIconized() const = 0; + + // get the frame icon + const wxIcon& GetIcon() const { return m_icons.GetIcon( -1 ); } + + // get the frame icons + const wxIconBundle& GetIcons() const { return m_icons; } + + // set the frame icon + virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); } + + // set the frame icons + virtual void SetIcons(const wxIconBundle& icons ) { m_icons = icons; } + + // maximize the window to cover entire screen + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; + + // return true if the frame is in fullscreen mode + virtual bool IsFullScreen() const = 0; + + // the title of the top level window: the text which the + // window shows usually at the top of the frame/dialog in dedicated bar + virtual void SetTitle(const wxString& title) = 0; + virtual wxString GetTitle() const = 0; + + // enable/disable close button [x] + virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } + + // Set the shape of the window to the given region. + // Returns true if the platform supports this feature (and the + // operation is successful.) + virtual bool SetShape(const wxRegion& WXUNUSED(region)) { return false; } + + // Attracts the users attention to this window if the application is + // inactive (should be called when a background event occurs) + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + + // Is this the active frame (highlighted in the taskbar)? + virtual bool IsActive() { return wxGetTopLevelParent(FindFocus()) == this; } + + // this function may be overridden to return false to allow closing the + // application even when this top level window is still open + // + // notice that the window is still closed prior to the application exit and + // so it can still veto it even if it returns false from here + virtual bool ShouldPreventAppExit() const { return true; } + + +#if defined(__SMARTPHONE__) + virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; + virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; +#endif // __SMARTPHONE__ + + // centre the window on screen: this is just a shortcut + void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); } + void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } + + + // default item access: we have a permanent default item which is the one + // set by the user code but we may also have a temporary default item which + // would be chosen if the user pressed "Enter" now but the default action + // reverts to the "permanent" default as soon as this temporary default + // item loses focus + + // used to reset default if pointing to removed child + virtual void RemoveChild(wxWindowBase *child); + + // get the default item, temporary or permanent + wxWindow *GetDefaultItem() const + { return m_winTmpDefault ? m_winTmpDefault : m_winDefault; } + + // set the permanent default item, return the old default + wxWindow *SetDefaultItem(wxWindow *win) + { wxWindow *old = GetDefaultItem(); m_winDefault = win; return old; } + + // return the temporary default item, can be NULL + wxWindow *GetTmpDefaultItem() const { return m_winTmpDefault; } + + // set a temporary default item, SetTmpDefaultItem(NULL) should be called + // soon after a call to SetTmpDefaultItem(window), return the old default + wxWindow *SetTmpDefaultItem(wxWindow *win) + { wxWindow *old = GetDefaultItem(); m_winTmpDefault = win; return old; } + + + // implementation only from now on + // ------------------------------- + + // override some base class virtuals + virtual bool Destroy(); + virtual bool IsTopLevel() const { return true; } + virtual bool IsVisible() const { return IsShown(); } + + // event handlers + void OnCloseWindow(wxCloseEvent& event); + void OnSize(wxSizeEvent& WXUNUSED(event)) { DoLayout(); } + + // Get rect to be used to center top-level children + virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); + + // this should go away, but for now it's called from docview.cpp, + // so should be there for all platforms + void OnActivate(wxActivateEvent &WXUNUSED(event)) { } + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; + + // a different API for SetSizeHints + virtual void SetMinSize(const wxSize& minSize); + virtual void SetMaxSize(const wxSize& maxSize); + + // set size hints for "window manager" + virtual void DoSetSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, + int incW = wxDefaultCoord, int incH = wxDefaultCoord ); + +protected: + // the frame client to screen translation should take account of the + // toolbar which may shift the origin of the client area + virtual void DoClientToScreen(int *x, int *y) const; + virtual void DoScreenToClient(int *x, int *y) const; + + // add support for wxCENTRE_ON_SCREEN + virtual void DoCentre(int dir); + + // no need to do client to screen translation to get our position in screen + // coordinates: this is already the case + virtual void DoGetScreenPosition(int *x, int *y) const + { + DoGetPosition(x, y); + } + + // test whether this window makes part of the frame + // (menubar, toolbar and statusbar are excluded from automatic layout) + virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const + { return false; } + + // check if we should exit the program after deleting this window + bool IsLastBeforeExit() const; + + // send the iconize event, return true if processed + bool SendIconizeEvent(bool iconized = true); + + // do TLW-specific layout: we resize our unique child to fill the entire + // client area + void DoLayout(); + + // Get the default size for the new window if no explicit size given. If + // there are better default sizes then these can be changed, just as long + // as they are not too small for TLWs (and not larger than screen). + static wxSize GetDefaultSize(); + static int WidthDefault(int w) { return w == wxDefaultCoord ? GetDefaultSize().x : w; } + static int HeightDefault(int h) { return h == wxDefaultCoord ? GetDefaultSize().y : h; } + + // the frame icon + wxIconBundle m_icons; + + // a default window (usually a button) or NULL + wxWindow *m_winDefault; + + // a temporary override of m_winDefault, use the latter if NULL + wxWindow *m_winTmpDefault; + + DECLARE_NO_COPY_CLASS(wxTopLevelWindowBase) + DECLARE_EVENT_TABLE() +}; + + +// include the real class declaration +#if defined(__WXPALMOS__) + #include "wx/palmos/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowPalm +#elif defined(__WXMSW__) + #include "wx/msw/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMSW +#elif defined(__WXGTK20__) + #include "wx/gtk/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowGTK +#elif defined(__WXGTK__) + #include "wx/gtk1/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowGTK +#elif defined(__WXX11__) + #include "wx/x11/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowX11 +#elif defined(__WXMGL__) + #include "wx/mgl/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMGL +#elif defined(__WXDFB__) + #include "wx/dfb/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowDFB +#elif defined(__WXMAC__) + #include "wx/mac/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMac +#elif defined(__WXCOCOA__) + #include "wx/cocoa/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowCocoa +#elif defined(__WXPM__) + #include "wx/os2/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowOS2 +#elif defined(__WXMOTIF__) + #include "wx/motif/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMotif +#endif + +#ifdef __WXUNIVERSAL__ + #include "wx/univ/toplevel.h" +#else // !__WXUNIVERSAL__ + #ifdef wxTopLevelWindowNative + class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative + { + public: + // construction + wxTopLevelWindow() { Init(); } + wxTopLevelWindow(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + Create(parent, winid, title, pos, size, style, name); + } + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow) + }; + #endif // wxTopLevelWindowNative +#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ + + +#endif // _WX_TOPLEVEL_BASE_H_ diff --git a/Externals/wxWidgets/include/wx/treebase.h b/Externals/wxWidgets/include/wx/treebase.h index a89786268b..775a4492c6 100644 --- a/Externals/wxWidgets/include/wx/treebase.h +++ b/Externals/wxWidgets/include/wx/treebase.h @@ -1,426 +1,426 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/treebase.h -// Purpose: wxTreeCtrl base classes and types -// Author: Julian Smart et al -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: treebase.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1997,1998 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREEBASE_H_ -#define _WX_TREEBASE_H_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TREECTRL - -#include "wx/window.h" // for wxClientData -#include "wx/event.h" -#include "wx/dynarray.h" - -#if WXWIN_COMPATIBILITY_2_6 - -// flags for deprecated `Expand(int action)', will be removed in next versions -enum -{ - wxTREE_EXPAND_EXPAND, - wxTREE_EXPAND_COLLAPSE, - wxTREE_EXPAND_COLLAPSE_RESET, - wxTREE_EXPAND_TOGGLE -}; - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// wxTreeItemId identifies an element of the tree. In this implementation, it's -// just a trivial wrapper around Win32 HTREEITEM or a pointer to some private -// data structure in the generic version. It's opaque for the application and -// the only method which can be used by user code is IsOk(). -// ---------------------------------------------------------------------------- - -// Using this typedef removes an ambiguity when calling Remove() -typedef void *wxTreeItemIdValue; - -class WXDLLEXPORT wxTreeItemId -{ - friend bool operator==(const wxTreeItemId&, const wxTreeItemId&); -public: - // ctors - // 0 is invalid value for HTREEITEM - wxTreeItemId() { m_pItem = 0; } - - // construct wxTreeItemId from the native item id - wxTreeItemId(void *pItem) { m_pItem = pItem; } - - // default copy ctor/assignment operator are ok for us - - // accessors - // is this a valid tree item? - bool IsOk() const { return m_pItem != 0; } - // return true if this item is not valid - bool operator!() const { return !IsOk(); } - - // operations - // invalidate the item - void Unset() { m_pItem = 0; } - -#if WXWIN_COMPATIBILITY_2_4 - // deprecated: only for compatibility, don't work on 64 bit archs - wxTreeItemId(long item) { m_pItem = wxUIntToPtr(item); } - operator long() const { return (long)wxPtrToUInt(m_pItem); } -#else // !WXWIN_COMPATIBILITY_2_4 - operator bool() const { return IsOk(); } -#endif // WXWIN_COMPATIBILITY_2_4/!WXWIN_COMPATIBILITY_2_4 - - wxTreeItemIdValue m_pItem; -}; - -inline bool operator==(const wxTreeItemId& i1, const wxTreeItemId& i2) -{ - return i1.m_pItem == i2.m_pItem; -} - -inline bool operator!=(const wxTreeItemId& i1, const wxTreeItemId& i2) -{ - return i1.m_pItem != i2.m_pItem; -} - -// ---------------------------------------------------------------------------- -// wxTreeItemData is some (arbitrary) user class associated with some item. The -// main advantage of having this class (compared to old untyped interface) is -// that wxTreeItemData's are destroyed automatically by the tree and, as this -// class has virtual dtor, it means that the memory will be automatically -// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because -// the size of this class is critical: in any real application, each tree leaf -// will have wxTreeItemData associated with it and number of leaves may be -// quite big. -// -// Because the objects of this class are deleted by the tree, they should -// always be allocated on the heap! -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeItemData: public wxClientData -{ -friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; -friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; -public: - // creation/destruction - // -------------------- - // default ctor - wxTreeItemData() { } - - // default copy ctor/assignment operator are ok - - // accessor: get the item associated with us - const wxTreeItemId& GetId() const { return m_pItem; } - void SetId(const wxTreeItemId& id) { m_pItem = id; } - -protected: - wxTreeItemId m_pItem; -}; - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); - -// this is a wrapper around the array class defined above which allow to wok -// with vaue of natural wxTreeItemId type instead of using wxTreeItemIdValue -// and does it without any loss of efficiency -class WXDLLEXPORT wxArrayTreeItemIds : public wxArrayTreeItemIdsBase -{ -public: - void Add(const wxTreeItemId& id) - { wxArrayTreeItemIdsBase::Add(id.m_pItem); } - void Insert(const wxTreeItemId& id, size_t pos) - { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); } - wxTreeItemId Item(size_t i) const - { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); } - wxTreeItemId operator[](size_t i) const { return Item(i); } -}; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// enum for different images associated with a treectrl item -enum wxTreeItemIcon -{ - wxTreeItemIcon_Normal, // not selected, not expanded - wxTreeItemIcon_Selected, // selected, not expanded - wxTreeItemIcon_Expanded, // not selected, expanded - wxTreeItemIcon_SelectedExpanded, // selected, expanded - wxTreeItemIcon_Max -}; - -// ---------------------------------------------------------------------------- -// wxTreeCtrl flags -// ---------------------------------------------------------------------------- - -#define wxTR_NO_BUTTONS 0x0000 // for convenience -#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns -#define wxTR_NO_LINES 0x0004 // don't draw lines at all -#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes -#define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl - -#define wxTR_SINGLE 0x0000 // for convenience -#define wxTR_MULTIPLE 0x0020 // can select multiple items -#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection -#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says - -#define wxTR_EDIT_LABELS 0x0200 // can edit item labels -#define wxTR_ROW_LINES 0x0400 // put border around items -#define wxTR_HIDE_ROOT 0x0800 // don't display root node - -#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space - -#ifdef __WXGTK20__ -#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) -#else -#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) -#endif - -#if WXWIN_COMPATIBILITY_2_6 -// deprecated, don't use -#define wxTR_MAC_BUTTONS 0 -#define wxTR_AQUA_BUTTONS 0 -#endif // WXWIN_COMPATIBILITY_2_6 - - -// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine -// where exactly the specified point is situated: - -static const int wxTREE_HITTEST_ABOVE = 0x0001; -static const int wxTREE_HITTEST_BELOW = 0x0002; -static const int wxTREE_HITTEST_NOWHERE = 0x0004; - // on the button associated with an item. -static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008; - // on the bitmap associated with an item. -static const int wxTREE_HITTEST_ONITEMICON = 0x0010; - // on the indent associated with an item. -static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020; - // on the label (string) associated with an item. -static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040; - // on the right of the label associated with an item. -static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080; - // on the label (string) associated with an item. -static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100; - // on the left of the wxTreeCtrl. -static const int wxTREE_HITTEST_TOLEFT = 0x0200; - // on the right of the wxTreeCtrl. -static const int wxTREE_HITTEST_TORIGHT = 0x0400; - // on the upper part (first half) of the item. -static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800; - // on the lower part (second half) of the item. -static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000; - - // anywhere on the item -static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | - wxTREE_HITTEST_ONITEMLABEL; - -// tree ctrl default name -extern WXDLLEXPORT_DATA(const wxChar) wxTreeCtrlNameStr[]; - -// ---------------------------------------------------------------------------- -// wxTreeItemAttr: a structure containing the visual attributes of an item -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeItemAttr -{ -public: - // ctors - wxTreeItemAttr() { } - wxTreeItemAttr(const wxColour& colText, - const wxColour& colBack, - const wxFont& font) - : m_colText(colText), m_colBack(colBack), m_font(font) { } - - // setters - void SetTextColour(const wxColour& colText) { m_colText = colText; } - void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } - void SetFont(const wxFont& font) { m_font = font; } - - // accessors - bool HasTextColour() const { return m_colText.Ok(); } - bool HasBackgroundColour() const { return m_colBack.Ok(); } - bool HasFont() const { return m_font.Ok(); } - - const wxColour& GetTextColour() const { return m_colText; } - const wxColour& GetBackgroundColour() const { return m_colBack; } - const wxFont& GetFont() const { return m_font; } - -private: - wxColour m_colText, - m_colBack; - wxFont m_font; -}; - -// ---------------------------------------------------------------------------- -// wxTreeEvent is a special class for all events associated with tree controls -// -// NB: note that not all accessors make sense for all events, see the event -// descriptions below -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; - -class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent -{ -public: - wxTreeEvent(wxEventType commandType, - wxTreeCtrlBase *tree, - const wxTreeItemId &item = wxTreeItemId()); - wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); - wxTreeEvent(const wxTreeEvent& event); - - virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } - - // accessors - // get the item on which the operation was performed or the newly - // selected item for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events - wxTreeItemId GetItem() const { return m_item; } - void SetItem(const wxTreeItemId& item) { m_item = item; } - - // for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events, get the previously - // selected item - wxTreeItemId GetOldItem() const { return m_itemOld; } - void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; } - - // the point where the mouse was when the drag operation started (for - // wxEVT_COMMAND_TREE_BEGIN_(R)DRAG events only) or click position - wxPoint GetPoint() const { return m_pointDrag; } - void SetPoint(const wxPoint& pt) { m_pointDrag = pt; } - - // keyboard data (for wxEVT_COMMAND_TREE_KEY_DOWN only) - const wxKeyEvent& GetKeyEvent() const { return m_evtKey; } - int GetKeyCode() const { return m_evtKey.GetKeyCode(); } - void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; } - - // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) - const wxString& GetLabel() const { return m_label; } - void SetLabel(const wxString& label) { m_label = label; } - - // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) - bool IsEditCancelled() const { return m_editCancelled; } - void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } - - // Set the tooltip for the item (for EVT\_TREE\_ITEM\_GETTOOLTIP events) - void SetToolTip(const wxString& toolTip) { m_label = toolTip; } - wxString GetToolTip() { return m_label; } - -private: - // not all of the members are used (or initialized) for all events - wxKeyEvent m_evtKey; - wxTreeItemId m_item, - m_itemOld; - wxPoint m_pointDrag; - wxString m_label; - bool m_editCancelled; - - friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; - friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; - - DECLARE_DYNAMIC_CLASS(wxTreeEvent) -}; - -typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); - -// ---------------------------------------------------------------------------- -// tree control events and macros for handling them -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_DRAG, 600) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_RDRAG, 601) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 602) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_LABEL_EDIT, 603) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_DELETE_ITEM, 604) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_GET_INFO, 605) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SET_INFO, 606) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDED, 607) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 608) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 609) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 610) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGED, 611) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGING, 612) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_KEY_DOWN, 613) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 614) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 615) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 616) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 618) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 619) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU, 620) -END_DECLARE_EVENT_TYPES() - -#define wxTreeEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreeEventFunction, &func) - -#define wx__DECLARE_TREEEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn)) - -// GetItem() returns the item being dragged, GetPoint() the mouse coords -// -// if you call event.Allow(), the drag operation will start and a -// EVT_TREE_END_DRAG event will be sent when the drag is over. -#define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn) -#define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn) - -// GetItem() is the item on which the drop occurred (if any) and GetPoint() the -// current mouse coords -#define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn) - -// GetItem() returns the itme whose label is being edited, GetLabel() returns -// the current item label for BEGIN and the would be new one for END. -// -// Vetoing BEGIN event means that label editing won't happen at all, -// vetoing END means that the new value is discarded and the old one kept -#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn) -#define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn) - -// provide/update information about GetItem() item -#define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn) -#define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn) - -// GetItem() is the item being expanded/collapsed, the "ING" versions can use -#define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn) -#define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn) -#define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn) -#define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn) - -// GetOldItem() is the item which had the selection previously, GetItem() is -// the item which acquires selection -#define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn) -#define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn) - -// GetKeyCode() returns the key code -// NB: this is the only message for which GetItem() is invalid (you may get the -// item from GetSelection()) -#define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn) - -// GetItem() returns the item being deleted, the associated data (if any) will -// be deleted just after the return of this event handler (if any) -#define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn) - -// GetItem() returns the item that was activated (double click, enter, space) -#define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn) - -// GetItem() returns the item for which the context menu shall be shown -#define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn) - -// GetItem() returns the item that was clicked on -#define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn) -#define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn) - -// GetItem() returns the item whose state image was clicked on -#define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn) - -// GetItem() is the item for which the tooltip is being requested -#define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn) - -#endif // wxUSE_TREECTRL - -#endif // _WX_TREEBASE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/treebase.h +// Purpose: wxTreeCtrl base classes and types +// Author: Julian Smart et al +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: treebase.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1997,1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREEBASE_H_ +#define _WX_TREEBASE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TREECTRL + +#include "wx/window.h" // for wxClientData +#include "wx/event.h" +#include "wx/dynarray.h" + +#if WXWIN_COMPATIBILITY_2_6 + +// flags for deprecated `Expand(int action)', will be removed in next versions +enum +{ + wxTREE_EXPAND_EXPAND, + wxTREE_EXPAND_COLLAPSE, + wxTREE_EXPAND_COLLAPSE_RESET, + wxTREE_EXPAND_TOGGLE +}; + +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// wxTreeItemId identifies an element of the tree. In this implementation, it's +// just a trivial wrapper around Win32 HTREEITEM or a pointer to some private +// data structure in the generic version. It's opaque for the application and +// the only method which can be used by user code is IsOk(). +// ---------------------------------------------------------------------------- + +// Using this typedef removes an ambiguity when calling Remove() +typedef void *wxTreeItemIdValue; + +class WXDLLEXPORT wxTreeItemId +{ + friend bool operator==(const wxTreeItemId&, const wxTreeItemId&); +public: + // ctors + // 0 is invalid value for HTREEITEM + wxTreeItemId() { m_pItem = 0; } + + // construct wxTreeItemId from the native item id + wxTreeItemId(void *pItem) { m_pItem = pItem; } + + // default copy ctor/assignment operator are ok for us + + // accessors + // is this a valid tree item? + bool IsOk() const { return m_pItem != 0; } + // return true if this item is not valid + bool operator!() const { return !IsOk(); } + + // operations + // invalidate the item + void Unset() { m_pItem = 0; } + +#if WXWIN_COMPATIBILITY_2_4 + // deprecated: only for compatibility, don't work on 64 bit archs + wxTreeItemId(long item) { m_pItem = wxUIntToPtr(item); } + operator long() const { return (long)wxPtrToUInt(m_pItem); } +#else // !WXWIN_COMPATIBILITY_2_4 + operator bool() const { return IsOk(); } +#endif // WXWIN_COMPATIBILITY_2_4/!WXWIN_COMPATIBILITY_2_4 + + wxTreeItemIdValue m_pItem; +}; + +inline bool operator==(const wxTreeItemId& i1, const wxTreeItemId& i2) +{ + return i1.m_pItem == i2.m_pItem; +} + +inline bool operator!=(const wxTreeItemId& i1, const wxTreeItemId& i2) +{ + return i1.m_pItem != i2.m_pItem; +} + +// ---------------------------------------------------------------------------- +// wxTreeItemData is some (arbitrary) user class associated with some item. The +// main advantage of having this class (compared to old untyped interface) is +// that wxTreeItemData's are destroyed automatically by the tree and, as this +// class has virtual dtor, it means that the memory will be automatically +// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because +// the size of this class is critical: in any real application, each tree leaf +// will have wxTreeItemData associated with it and number of leaves may be +// quite big. +// +// Because the objects of this class are deleted by the tree, they should +// always be allocated on the heap! +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreeItemData: public wxClientData +{ +friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; +friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; +public: + // creation/destruction + // -------------------- + // default ctor + wxTreeItemData() { } + + // default copy ctor/assignment operator are ok + + // accessor: get the item associated with us + const wxTreeItemId& GetId() const { return m_pItem; } + void SetId(const wxTreeItemId& id) { m_pItem = id; } + +protected: + wxTreeItemId m_pItem; +}; + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); + +// this is a wrapper around the array class defined above which allow to wok +// with vaue of natural wxTreeItemId type instead of using wxTreeItemIdValue +// and does it without any loss of efficiency +class WXDLLEXPORT wxArrayTreeItemIds : public wxArrayTreeItemIdsBase +{ +public: + void Add(const wxTreeItemId& id) + { wxArrayTreeItemIdsBase::Add(id.m_pItem); } + void Insert(const wxTreeItemId& id, size_t pos) + { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); } + wxTreeItemId Item(size_t i) const + { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); } + wxTreeItemId operator[](size_t i) const { return Item(i); } +}; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// enum for different images associated with a treectrl item +enum wxTreeItemIcon +{ + wxTreeItemIcon_Normal, // not selected, not expanded + wxTreeItemIcon_Selected, // selected, not expanded + wxTreeItemIcon_Expanded, // not selected, expanded + wxTreeItemIcon_SelectedExpanded, // selected, expanded + wxTreeItemIcon_Max +}; + +// ---------------------------------------------------------------------------- +// wxTreeCtrl flags +// ---------------------------------------------------------------------------- + +#define wxTR_NO_BUTTONS 0x0000 // for convenience +#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns +#define wxTR_NO_LINES 0x0004 // don't draw lines at all +#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes +#define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl + +#define wxTR_SINGLE 0x0000 // for convenience +#define wxTR_MULTIPLE 0x0020 // can select multiple items +#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection +#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says + +#define wxTR_EDIT_LABELS 0x0200 // can edit item labels +#define wxTR_ROW_LINES 0x0400 // put border around items +#define wxTR_HIDE_ROOT 0x0800 // don't display root node + +#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space + +#ifdef __WXGTK20__ +#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) +#else +#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) +#endif + +#if WXWIN_COMPATIBILITY_2_6 +// deprecated, don't use +#define wxTR_MAC_BUTTONS 0 +#define wxTR_AQUA_BUTTONS 0 +#endif // WXWIN_COMPATIBILITY_2_6 + + +// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine +// where exactly the specified point is situated: + +static const int wxTREE_HITTEST_ABOVE = 0x0001; +static const int wxTREE_HITTEST_BELOW = 0x0002; +static const int wxTREE_HITTEST_NOWHERE = 0x0004; + // on the button associated with an item. +static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008; + // on the bitmap associated with an item. +static const int wxTREE_HITTEST_ONITEMICON = 0x0010; + // on the indent associated with an item. +static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020; + // on the label (string) associated with an item. +static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040; + // on the right of the label associated with an item. +static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080; + // on the label (string) associated with an item. +static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100; + // on the left of the wxTreeCtrl. +static const int wxTREE_HITTEST_TOLEFT = 0x0200; + // on the right of the wxTreeCtrl. +static const int wxTREE_HITTEST_TORIGHT = 0x0400; + // on the upper part (first half) of the item. +static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800; + // on the lower part (second half) of the item. +static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000; + + // anywhere on the item +static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | + wxTREE_HITTEST_ONITEMLABEL; + +// tree ctrl default name +extern WXDLLEXPORT_DATA(const wxChar) wxTreeCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxTreeItemAttr: a structure containing the visual attributes of an item +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreeItemAttr +{ +public: + // ctors + wxTreeItemAttr() { } + wxTreeItemAttr(const wxColour& colText, + const wxColour& colBack, + const wxFont& font) + : m_colText(colText), m_colBack(colBack), m_font(font) { } + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } + void SetFont(const wxFont& font) { m_font = font; } + + // accessors + bool HasTextColour() const { return m_colText.Ok(); } + bool HasBackgroundColour() const { return m_colBack.Ok(); } + bool HasFont() const { return m_font.Ok(); } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + const wxFont& GetFont() const { return m_font; } + +private: + wxColour m_colText, + m_colBack; + wxFont m_font; +}; + +// ---------------------------------------------------------------------------- +// wxTreeEvent is a special class for all events associated with tree controls +// +// NB: note that not all accessors make sense for all events, see the event +// descriptions below +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; + +class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent +{ +public: + wxTreeEvent(wxEventType commandType, + wxTreeCtrlBase *tree, + const wxTreeItemId &item = wxTreeItemId()); + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); + wxTreeEvent(const wxTreeEvent& event); + + virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } + + // accessors + // get the item on which the operation was performed or the newly + // selected item for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events + wxTreeItemId GetItem() const { return m_item; } + void SetItem(const wxTreeItemId& item) { m_item = item; } + + // for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events, get the previously + // selected item + wxTreeItemId GetOldItem() const { return m_itemOld; } + void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; } + + // the point where the mouse was when the drag operation started (for + // wxEVT_COMMAND_TREE_BEGIN_(R)DRAG events only) or click position + wxPoint GetPoint() const { return m_pointDrag; } + void SetPoint(const wxPoint& pt) { m_pointDrag = pt; } + + // keyboard data (for wxEVT_COMMAND_TREE_KEY_DOWN only) + const wxKeyEvent& GetKeyEvent() const { return m_evtKey; } + int GetKeyCode() const { return m_evtKey.GetKeyCode(); } + void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; } + + // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) + const wxString& GetLabel() const { return m_label; } + void SetLabel(const wxString& label) { m_label = label; } + + // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) + bool IsEditCancelled() const { return m_editCancelled; } + void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } + + // Set the tooltip for the item (for EVT\_TREE\_ITEM\_GETTOOLTIP events) + void SetToolTip(const wxString& toolTip) { m_label = toolTip; } + wxString GetToolTip() { return m_label; } + +private: + // not all of the members are used (or initialized) for all events + wxKeyEvent m_evtKey; + wxTreeItemId m_item, + m_itemOld; + wxPoint m_pointDrag; + wxString m_label; + bool m_editCancelled; + + friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; + friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; + + DECLARE_DYNAMIC_CLASS(wxTreeEvent) +}; + +typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); + +// ---------------------------------------------------------------------------- +// tree control events and macros for handling them +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_DRAG, 600) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_RDRAG, 601) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 602) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_LABEL_EDIT, 603) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_DELETE_ITEM, 604) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_GET_INFO, 605) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SET_INFO, 606) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDED, 607) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 608) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 609) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 610) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGED, 611) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_SEL_CHANGING, 612) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_KEY_DOWN, 613) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 614) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 615) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 616) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 618) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 619) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU, 620) +END_DECLARE_EVENT_TYPES() + +#define wxTreeEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreeEventFunction, &func) + +#define wx__DECLARE_TREEEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn)) + +// GetItem() returns the item being dragged, GetPoint() the mouse coords +// +// if you call event.Allow(), the drag operation will start and a +// EVT_TREE_END_DRAG event will be sent when the drag is over. +#define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn) +#define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn) + +// GetItem() is the item on which the drop occurred (if any) and GetPoint() the +// current mouse coords +#define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn) + +// GetItem() returns the itme whose label is being edited, GetLabel() returns +// the current item label for BEGIN and the would be new one for END. +// +// Vetoing BEGIN event means that label editing won't happen at all, +// vetoing END means that the new value is discarded and the old one kept +#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn) +#define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn) + +// provide/update information about GetItem() item +#define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn) +#define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn) + +// GetItem() is the item being expanded/collapsed, the "ING" versions can use +#define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn) +#define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn) +#define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn) +#define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn) + +// GetOldItem() is the item which had the selection previously, GetItem() is +// the item which acquires selection +#define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn) +#define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn) + +// GetKeyCode() returns the key code +// NB: this is the only message for which GetItem() is invalid (you may get the +// item from GetSelection()) +#define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn) + +// GetItem() returns the item being deleted, the associated data (if any) will +// be deleted just after the return of this event handler (if any) +#define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn) + +// GetItem() returns the item that was activated (double click, enter, space) +#define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn) + +// GetItem() returns the item for which the context menu shall be shown +#define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn) + +// GetItem() returns the item that was clicked on +#define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn) +#define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn) + +// GetItem() returns the item whose state image was clicked on +#define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn) + +// GetItem() is the item for which the tooltip is being requested +#define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn) + +#endif // wxUSE_TREECTRL + +#endif // _WX_TREEBASE_H_ diff --git a/Externals/wxWidgets/include/wx/treebook.h b/Externals/wxWidgets/include/wx/treebook.h index dba6363521..abc4ca7d22 100644 --- a/Externals/wxWidgets/include/wx/treebook.h +++ b/Externals/wxWidgets/include/wx/treebook.h @@ -1,283 +1,283 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/treebook.h -// Purpose: wxTreebook: wxNotebook-like control presenting pages in a tree -// Author: Evgeniy Tarassov, Vadim Zeitlin -// Modified by: -// Created: 2005-09-15 -// RCS-ID: $Id: treebook.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREEBOOK_H_ -#define _WX_TREEBOOK_H_ - -#include "wx/defs.h" - -#if wxUSE_TREEBOOK - -#include "wx/bookctrl.h" -#include "wx/treectrl.h" // for wxArrayTreeItemIds -#include "wx/containr.h" - -typedef wxWindow wxTreebookPage; - -class WXDLLIMPEXP_FWD_CORE wxTreeEvent; - -// ---------------------------------------------------------------------------- -// wxTreebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreebook : public wxBookCtrlBase -{ -public: - // Constructors and such - // --------------------- - - // Default ctor doesn't create the control, use Create() afterwards - wxTreebook() - { - Init(); - } - - // This ctor creates the tree book control - wxTreebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBK_DEFAULT, - const wxString& name = wxEmptyString) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // Really creates the control - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBK_DEFAULT, - const wxString& name = wxEmptyString); - - - // Page insertion operations - // ------------------------- - - // Notice that page pointer may be NULL in which case the next non NULL - // page (usually the first child page of a node) is shown when this page is - // selected - - // Inserts a new page just before the page indicated by page. - // The new page is placed on the same level as page. - virtual bool InsertPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Inserts a new sub-page to the end of children of the page at given pos. - virtual bool InsertSubPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Adds a new page at top level after all other pages. - virtual bool AddPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Adds a new child-page to the last top-level page inserted. - // Useful when constructing 1 level tree structure. - virtual bool AddSubPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Deletes the page and ALL its children. Could trigger page selection - // change in a case when selected page is removed. In that case its parent - // is selected (or the next page if no parent). - virtual bool DeletePage(size_t pos); - - - // Tree operations - // --------------- - - // Gets the page node state -- node is expanded or collapsed - virtual bool IsNodeExpanded(size_t pos) const; - - // Expands or collapses the page node. Returns the previous state. - // May generate page changing events (if selected page - // is under the collapsed branch, then parent is autoselected). - virtual bool ExpandNode(size_t pos, bool expand = true); - - // shortcut for ExpandNode(pos, false) - bool CollapseNode(size_t pos) { return ExpandNode(pos, false); } - - // get the parent page or wxNOT_FOUND if this is a top level page - int GetPageParent(size_t pos) const; - - // the tree control we use for showing the pages index tree - wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; } - - - // Standard operations inherited from wxBookCtrlBase - // ------------------------------------------------- - - virtual int GetSelection() const; - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - virtual void SetImageList(wxImageList *imageList); - virtual void AssignImageList(wxImageList *imageList); - virtual bool DeleteAllPages(); - -protected: - // Implementation of a page removal. See DeletPage for comments. - wxTreebookPage *DoRemovePage(size_t pos); - - // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages) - virtual bool AllowNullPage() const { return true; } - - // event handlers - void OnTreeSelectionChange(wxTreeEvent& event); - void OnTreeNodeExpandedCollapsed(wxTreeEvent& event); - - // array of page ids and page windows - wxArrayTreeItemIds m_treeIds; - - // the currently selected page or wxNOT_FOUND if none - int m_selection; - - // in the situation when m_selection page is not wxNOT_FOUND but page is - // NULL this is the first (sub)child that has a non-NULL page - int m_actualSelection; - -private: - // common part of all constructors - void Init(); - - // The real implementations of page insertion functions - // ------------------------------------------------------ - // All DoInsert/Add(Sub)Page functions add the page into : - // - the base class - // - the tree control - // - update the index/TreeItemId corespondance array - bool DoInsertPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - bool DoInsertSubPage(size_t pos, - wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - bool DoAddSubPage(wxWindow *page, - const wxString& text, - bool bSelect = false, - int imageId = wxNOT_FOUND); - - // Sets selection in the tree control and updates the page being shown. - int DoSetSelection(size_t pos, int flags = 0); - - // Returns currently shown page. In a case when selected the node - // has empty (NULL) page finds first (sub)child with not-empty page. - wxTreebookPage *DoGetCurrentPage() const; - - // Does the selection update. Called from page insertion functions - // to update selection if the selected page was pushed by the newly inserted - void DoUpdateSelection(bool bSelect, int page); - - - // Operations on the internal private members of the class - // ------------------------------------------------------- - // Returns the page TreeItemId for the page. - // Or, if the page index is incorrect, a fake one (fakePage.IsOk() == false) - wxTreeItemId DoInternalGetPage(size_t pos) const; - - // Linear search for a page with the id specified. If no page - // found wxNOT_FOUND is returned. The function is used when we catch an event - // from m_tree (wxTreeCtrl) component. - int DoInternalFindPageById(wxTreeItemId page) const; - - // Updates page and wxTreeItemId correspondance. - void DoInternalAddPage(size_t newPos, wxWindow *page, wxTreeItemId pageId); - - // Removes the page from internal structure. - void DoInternalRemovePage(size_t pos) - { DoInternalRemovePageRange(pos, 0); } - - // Removes the page and all its children designated by subCount - // from internal structures of the control. - void DoInternalRemovePageRange(size_t pos, size_t subCount); - - // Returns internal number of pages which can be different from - // GetPageCount() while performing a page insertion or removal. - size_t DoInternalGetPageCount() const { return m_treeIds.Count(); } - - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook) - WX_DECLARE_CONTROL_CONTAINER(); -}; - - -// ---------------------------------------------------------------------------- -// treebook event class and related stuff -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxTreebookEvent(const wxTreebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreebookEvent) -}; - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED; - -typedef void (wxEvtHandler::*wxTreebookEventFunction)(wxTreebookEvent&); - -#define wxTreebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreebookEventFunction, &func) - -#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxTreebookEventHandler(fn)) - -#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxTreebookEventHandler(fn)) - -#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxTreebookEventHandler(fn)) - -#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxTreebookEventHandler(fn)) - - -#endif // wxUSE_TREEBOOK - -#endif // _WX_TREEBOOK_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/treebook.h +// Purpose: wxTreebook: wxNotebook-like control presenting pages in a tree +// Author: Evgeniy Tarassov, Vadim Zeitlin +// Modified by: +// Created: 2005-09-15 +// RCS-ID: $Id: treebook.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREEBOOK_H_ +#define _WX_TREEBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_TREEBOOK + +#include "wx/bookctrl.h" +#include "wx/treectrl.h" // for wxArrayTreeItemIds +#include "wx/containr.h" + +typedef wxWindow wxTreebookPage; + +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; + +// ---------------------------------------------------------------------------- +// wxTreebook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreebook : public wxBookCtrlBase +{ +public: + // Constructors and such + // --------------------- + + // Default ctor doesn't create the control, use Create() afterwards + wxTreebook() + { + Init(); + } + + // This ctor creates the tree book control + wxTreebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBK_DEFAULT, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // Really creates the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBK_DEFAULT, + const wxString& name = wxEmptyString); + + + // Page insertion operations + // ------------------------- + + // Notice that page pointer may be NULL in which case the next non NULL + // page (usually the first child page of a node) is shown when this page is + // selected + + // Inserts a new page just before the page indicated by page. + // The new page is placed on the same level as page. + virtual bool InsertPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + + // Inserts a new sub-page to the end of children of the page at given pos. + virtual bool InsertSubPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + + // Adds a new page at top level after all other pages. + virtual bool AddPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + + // Adds a new child-page to the last top-level page inserted. + // Useful when constructing 1 level tree structure. + virtual bool AddSubPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + + // Deletes the page and ALL its children. Could trigger page selection + // change in a case when selected page is removed. In that case its parent + // is selected (or the next page if no parent). + virtual bool DeletePage(size_t pos); + + + // Tree operations + // --------------- + + // Gets the page node state -- node is expanded or collapsed + virtual bool IsNodeExpanded(size_t pos) const; + + // Expands or collapses the page node. Returns the previous state. + // May generate page changing events (if selected page + // is under the collapsed branch, then parent is autoselected). + virtual bool ExpandNode(size_t pos, bool expand = true); + + // shortcut for ExpandNode(pos, false) + bool CollapseNode(size_t pos) { return ExpandNode(pos, false); } + + // get the parent page or wxNOT_FOUND if this is a top level page + int GetPageParent(size_t pos) const; + + // the tree control we use for showing the pages index tree + wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; } + + + // Standard operations inherited from wxBookCtrlBase + // ------------------------------------------------- + + virtual int GetSelection() const; + virtual bool SetPageText(size_t n, const wxString& strText); + virtual wxString GetPageText(size_t n) const; + virtual int GetPageImage(size_t n) const; + virtual bool SetPageImage(size_t n, int imageId); + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + virtual void SetImageList(wxImageList *imageList); + virtual void AssignImageList(wxImageList *imageList); + virtual bool DeleteAllPages(); + +protected: + // Implementation of a page removal. See DeletPage for comments. + wxTreebookPage *DoRemovePage(size_t pos); + + // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages) + virtual bool AllowNullPage() const { return true; } + + // event handlers + void OnTreeSelectionChange(wxTreeEvent& event); + void OnTreeNodeExpandedCollapsed(wxTreeEvent& event); + + // array of page ids and page windows + wxArrayTreeItemIds m_treeIds; + + // the currently selected page or wxNOT_FOUND if none + int m_selection; + + // in the situation when m_selection page is not wxNOT_FOUND but page is + // NULL this is the first (sub)child that has a non-NULL page + int m_actualSelection; + +private: + // common part of all constructors + void Init(); + + // The real implementations of page insertion functions + // ------------------------------------------------------ + // All DoInsert/Add(Sub)Page functions add the page into : + // - the base class + // - the tree control + // - update the index/TreeItemId corespondance array + bool DoInsertPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + bool DoInsertSubPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + bool DoAddSubPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = wxNOT_FOUND); + + // Sets selection in the tree control and updates the page being shown. + int DoSetSelection(size_t pos, int flags = 0); + + // Returns currently shown page. In a case when selected the node + // has empty (NULL) page finds first (sub)child with not-empty page. + wxTreebookPage *DoGetCurrentPage() const; + + // Does the selection update. Called from page insertion functions + // to update selection if the selected page was pushed by the newly inserted + void DoUpdateSelection(bool bSelect, int page); + + + // Operations on the internal private members of the class + // ------------------------------------------------------- + // Returns the page TreeItemId for the page. + // Or, if the page index is incorrect, a fake one (fakePage.IsOk() == false) + wxTreeItemId DoInternalGetPage(size_t pos) const; + + // Linear search for a page with the id specified. If no page + // found wxNOT_FOUND is returned. The function is used when we catch an event + // from m_tree (wxTreeCtrl) component. + int DoInternalFindPageById(wxTreeItemId page) const; + + // Updates page and wxTreeItemId correspondance. + void DoInternalAddPage(size_t newPos, wxWindow *page, wxTreeItemId pageId); + + // Removes the page from internal structure. + void DoInternalRemovePage(size_t pos) + { DoInternalRemovePageRange(pos, 0); } + + // Removes the page and all its children designated by subCount + // from internal structures of the control. + void DoInternalRemovePageRange(size_t pos, size_t subCount); + + // Returns internal number of pages which can be different from + // GetPageCount() while performing a page insertion or removal. + size_t DoInternalGetPageCount() const { return m_treeIds.Count(); } + + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook) + WX_DECLARE_CONTROL_CONTAINER(); +}; + + +// ---------------------------------------------------------------------------- +// treebook event class and related stuff +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreebookEvent : public wxBookCtrlBaseEvent +{ +public: + wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) + { + } + + wxTreebookEvent(const wxTreebookEvent& event) + : wxBookCtrlBaseEvent(event) + { + } + + virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreebookEvent) +}; + +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED; +extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED; + +typedef void (wxEvtHandler::*wxTreebookEventFunction)(wxTreebookEvent&); + +#define wxTreebookEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreebookEventFunction, &func) + +#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxTreebookEventHandler(fn)) + +#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxTreebookEventHandler(fn)) + +#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxTreebookEventHandler(fn)) + +#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxTreebookEventHandler(fn)) + + +#endif // wxUSE_TREEBOOK + +#endif // _WX_TREEBOOK_H_ diff --git a/Externals/wxWidgets/include/wx/treectrl.h b/Externals/wxWidgets/include/wx/treectrl.h index 2b919cbd54..d45855eb43 100644 --- a/Externals/wxWidgets/include/wx/treectrl.h +++ b/Externals/wxWidgets/include/wx/treectrl.h @@ -1,459 +1,459 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/treectrl.h -// Purpose: wxTreeCtrl base header -// Author: Karsten Ballueder -// Modified by: -// Created: -// Copyright: (c) Karsten Ballueder -// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREECTRL_H_BASE_ -#define _WX_TREECTRL_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_TREECTRL - -#include "wx/control.h" -#include "wx/treebase.h" -#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through CLASSINFO macro - -class WXDLLIMPEXP_FWD_CORE wxImageList; - -// ---------------------------------------------------------------------------- -// wxTreeCtrlBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTreeCtrlBase : public wxControl -{ -public: - wxTreeCtrlBase() - { - m_imageListNormal = - m_imageListState = NULL; - m_ownsImageListNormal = - m_ownsImageListState = false; - - // arbitrary default - m_spacing = 18; - - // quick DoGetBestSize calculation - m_quickBestSize = true; - } - - virtual ~wxTreeCtrlBase(); - - // accessors - // --------- - - // get the total number of items in the control - virtual unsigned int GetCount() const = 0; - - // indent is the number of pixels the children are indented relative to - // the parents position. SetIndent() also redraws the control - // immediately. - virtual unsigned int GetIndent() const = 0; - virtual void SetIndent(unsigned int indent) = 0; - - // spacing is the number of pixels between the start and the Text - // (has no effect under wxMSW) - unsigned int GetSpacing() const { return m_spacing; } - void SetSpacing(unsigned int spacing) { m_spacing = spacing; } - - // image list: these functions allow to associate an image list with - // the control and retrieve it. Note that the control does _not_ delete - // the associated image list when it's deleted in order to allow image - // lists to be shared between different controls. - // - // The normal image list is for the icons which correspond to the - // normal tree item state (whether it is selected or not). - // Additionally, the application might choose to show a state icon - // which corresponds to an app-defined item state (for example, - // checked/unchecked) which are taken from the state image list. - wxImageList *GetImageList() const { return m_imageListNormal; } - wxImageList *GetStateImageList() const { return m_imageListState; } - - virtual void SetImageList(wxImageList *imageList) = 0; - virtual void SetStateImageList(wxImageList *imageList) = 0; - void AssignImageList(wxImageList *imageList) - { - SetImageList(imageList); - m_ownsImageListNormal = true; - } - void AssignStateImageList(wxImageList *imageList) - { - SetStateImageList(imageList); - m_ownsImageListState = true; - } - - - // Functions to work with tree ctrl items. Unfortunately, they can _not_ be - // member functions of wxTreeItem because they must know the tree the item - // belongs to for Windows implementation and storing the pointer to - // wxTreeCtrl in each wxTreeItem is just too much waste. - - // accessors - // --------- - - // retrieve items label - virtual wxString GetItemText(const wxTreeItemId& item) const = 0; - // get one of the images associated with the item (normal by default) - virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const = 0; - // get the data associated with the item - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const = 0; - - // get the item's text colour - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const = 0; - - // get the item's background colour - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const = 0; - - // get the item's font - virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0; - - // modifiers - // --------- - - // set items label - virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0; - // get one of the images associated with the item (normal by default) - virtual void SetItemImage(const wxTreeItemId& item, - int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0; - // associate some data with the item - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) = 0; - - // force appearance of [+] button near the item. This is useful to - // allow the user to expand the items which don't have any children now - // - but instead add them only when needed, thus minimizing memory - // usage and loading time. - virtual void SetItemHasChildren(const wxTreeItemId& item, - bool has = true) = 0; - - // the item will be shown in bold - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) = 0; - - // the item will be shown with a drop highlight - virtual void SetItemDropHighlight(const wxTreeItemId& item, - bool highlight = true) = 0; - - // set the items text colour - virtual void SetItemTextColour(const wxTreeItemId& item, - const wxColour& col) = 0; - - // set the items background colour - virtual void SetItemBackgroundColour(const wxTreeItemId& item, - const wxColour& col) = 0; - - // set the items font (should be of the same height for all items) - virtual void SetItemFont(const wxTreeItemId& item, - const wxFont& font) = 0; - - // item status inquiries - // --------------------- - - // is the item visible (it might be outside the view or not expanded)? - virtual bool IsVisible(const wxTreeItemId& item) const = 0; - // does the item has any children? - virtual bool ItemHasChildren(const wxTreeItemId& item) const = 0; - // same as above - bool HasChildren(const wxTreeItemId& item) const - { return ItemHasChildren(item); } - // is the item expanded (only makes sense if HasChildren())? - virtual bool IsExpanded(const wxTreeItemId& item) const = 0; - // is this item currently selected (the same as has focus)? - virtual bool IsSelected(const wxTreeItemId& item) const = 0; - // is item text in bold font? - virtual bool IsBold(const wxTreeItemId& item) const = 0; -#if wxABI_VERSION >= 20801 - // is the control empty? - bool IsEmpty() const; -#endif // wxABI 2.8.1+ - - - // number of children - // ------------------ - - // if 'recursively' is false, only immediate children count, otherwise - // the returned number is the number of all items in this branch - virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const = 0; - - // navigation - // ---------- - - // wxTreeItemId.IsOk() will return false if there is no such item - - // get the root tree item - virtual wxTreeItemId GetRootItem() const = 0; - - // get the item currently selected (may return NULL if no selection) - virtual wxTreeItemId GetSelection() const = 0; - - // get the items currently selected, return the number of such item - // - // NB: this operation is expensive and can take a long time for a - // control with a lot of items (~ O(number of items)). - virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0; - - // get the parent of this item (may return NULL if root) - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0; - - // for this enumeration function you must pass in a "cookie" parameter - // which is opaque for the application but is necessary for the library - // to make these functions reentrant (i.e. allow more than one - // enumeration on one and the same object simultaneously). Of course, - // the "cookie" passed to GetFirstChild() and GetNextChild() should be - // the same! - - // get the first child of this item - virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const = 0; - // get the next child - virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const = 0; - // get the last child of this item - this method doesn't use cookies - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const = 0; - - // get the next sibling of this item - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const = 0; - // get the previous sibling - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const = 0; - - // get first visible item - virtual wxTreeItemId GetFirstVisibleItem() const = 0; - // get the next visible item: item must be visible itself! - // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const = 0; - // get the previous visible item: item must be visible itself! - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const = 0; - - // operations - // ---------- - - // add the root node to the tree - virtual wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) = 0; - - // insert a new item in as the first child of the parent - wxTreeItemId PrependItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertItem(parent, 0u, text, image, selImage, data); - } - - // insert a new item after a given one - wxTreeItemId InsertItem(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertAfter(parent, idPrevious, text, image, selImage, data); - } - - // insert a new item before the one with the given index - wxTreeItemId InsertItem(const wxTreeItemId& parent, - size_t pos, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertItem(parent, pos, text, image, selImage, data); - } - - // insert a new item in as the last child of the parent - wxTreeItemId AppendItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) - { - return DoInsertItem(parent, (size_t)-1, text, image, selImage, data); - } - - // delete this item and associated data if any - virtual void Delete(const wxTreeItemId& item) = 0; - // delete all children (but don't delete the item itself) - // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events - virtual void DeleteChildren(const wxTreeItemId& item) = 0; - // delete all items from the tree - // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events - virtual void DeleteAllItems() = 0; - - // expand this item - virtual void Expand(const wxTreeItemId& item) = 0; - // expand the item and all its childs and thats childs - void ExpandAllChildren(const wxTreeItemId& item); - // expand all items - void ExpandAll(); - // collapse the item without removing its children - virtual void Collapse(const wxTreeItemId& item) = 0; -#if wxABI_VERSION >= 20801 - // collapse the item and all its childs and thats childs - void CollapseAllChildren(const wxTreeItemId& item); - // collapse all items - void CollapseAll(); -#endif // wxABI 2.8.1+ - // collapse the item and remove all children - virtual void CollapseAndReset(const wxTreeItemId& item) = 0; - // toggles the current state - virtual void Toggle(const wxTreeItemId& item) = 0; - - // remove the selection from currently selected item (if any) - virtual void Unselect() = 0; - // unselect all items (only makes sense for multiple selection control) - virtual void UnselectAll() = 0; - // select this item - virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0; - // unselect this item - void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); } - // toggle item selection - void ToggleItemSelection(const wxTreeItemId& item) - { - SelectItem(item, !IsSelected(item)); - } - - // make sure this item is visible (expanding the parent item and/or - // scrolling to this item if necessary) - virtual void EnsureVisible(const wxTreeItemId& item) = 0; - // scroll to this item (but don't expand its parent) - virtual void ScrollTo(const wxTreeItemId& item) = 0; - - // start editing the item label: this (temporarily) replaces the item - // with a one line edit control. The item will be selected if it hadn't - // been before. textCtrlClass parameter allows you to create an edit - // control of arbitrary user-defined class deriving from wxTextCtrl. - virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) = 0; - // returns the same pointer as StartEdit() if the item is being edited, - // NULL otherwise (it's assumed that no more than one item may be - // edited simultaneously) - virtual wxTextCtrl *GetEditControl() const = 0; - // end editing and accept or discard the changes to item label - virtual void EndEditLabel(const wxTreeItemId& item, - bool discardChanges = false) = 0; - - // sorting - // ------- - - // this function is called to compare 2 items and should return -1, 0 - // or +1 if the first item is less than, equal to or greater than the - // second one. The base class version performs alphabetic comparaison - // of item labels (GetText) - virtual int OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2) - { - return wxStrcmp(GetItemText(item1), GetItemText(item2)); - } - - // sort the children of this item using OnCompareItems - // - // NB: this function is not reentrant and not MT-safe (FIXME)! - virtual void SortChildren(const wxTreeItemId& item) = 0; - - // items geometry - // -------------- - - // determine to which item (if any) belongs the given point (the - // coordinates specified are relative to the client area of tree ctrl) - // and, in the second variant, fill the flags parameter with a bitmask - // of wxTREE_HITTEST_xxx constants. - wxTreeItemId HitTest(const wxPoint& point) const - { int dummy; return DoTreeHitTest(point, dummy); } - wxTreeItemId HitTest(const wxPoint& point, int& flags) const - { return DoTreeHitTest(point, flags); } - - // get the bounding rectangle of the item (or of its label only) - virtual bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = false) const = 0; - - - // implementation - // -------------- - - virtual bool ShouldInheritColours() const { return false; } - - // hint whether to calculate best size quickly or accurately - void SetQuickBestSize(bool q) { m_quickBestSize = q; } - bool GetQuickBestSize() const { return m_quickBestSize; } - -protected: - virtual wxSize DoGetBestSize() const; - - // common part of Append/Prepend/InsertItem() - // - // pos is the position at which to insert the item or (size_t)-1 to append - // it to the end - virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - size_t pos, - const wxString& text, - int image, int selImage, - wxTreeItemData *data) = 0; - - // and this function implements overloaded InsertItem() taking wxTreeItemId - // (it can't be called InsertItem() as we'd have virtual function hiding - // problem in derived classes then) - virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) = 0; - - // real HitTest() implementation: again, can't be called just HitTest() - // because it's overloaded and so the non-virtual overload would be hidden - // (and can't be called DoHitTest() because this is already in wxWindow) - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, - int& flags) const = 0; - - - wxImageList *m_imageListNormal, // images for tree elements - *m_imageListState; // special images for app defined states - bool m_ownsImageListNormal, - m_ownsImageListState; - - // spacing between left border and the text - unsigned int m_spacing; - - // whether full or quick calculation is done in DoGetBestSize - bool m_quickBestSize; - - - DECLARE_NO_COPY_CLASS(wxTreeCtrlBase) -}; - -// ---------------------------------------------------------------------------- -// include the platform-dependent wxTreeCtrl class -// ---------------------------------------------------------------------------- - -#if defined(__WXUNIVERSAL__) - #include "wx/generic/treectlg.h" -#elif defined(__WXPALMOS__) - #include "wx/palmos/treectrl.h" -#elif defined(__WXMSW__) - #include "wx/msw/treectrl.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/treectlg.h" -#elif defined(__WXGTK__) - #include "wx/generic/treectlg.h" -#elif defined(__WXMAC__) - #include "wx/generic/treectlg.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/treectlg.h" -#elif defined(__WXPM__) - #include "wx/generic/treectlg.h" -#endif - -#endif // wxUSE_TREECTRL - -#endif // _WX_TREECTRL_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/treectrl.h +// Purpose: wxTreeCtrl base header +// Author: Karsten Ballueder +// Modified by: +// Created: +// Copyright: (c) Karsten Ballueder +// RCS-ID: $Id: treectrl.h 49563 2007-10-31 20:46:21Z VZ $ +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREECTRL_H_BASE_ +#define _WX_TREECTRL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TREECTRL + +#include "wx/control.h" +#include "wx/treebase.h" +#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through CLASSINFO macro + +class WXDLLIMPEXP_FWD_CORE wxImageList; + +// ---------------------------------------------------------------------------- +// wxTreeCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreeCtrlBase : public wxControl +{ +public: + wxTreeCtrlBase() + { + m_imageListNormal = + m_imageListState = NULL; + m_ownsImageListNormal = + m_ownsImageListState = false; + + // arbitrary default + m_spacing = 18; + + // quick DoGetBestSize calculation + m_quickBestSize = true; + } + + virtual ~wxTreeCtrlBase(); + + // accessors + // --------- + + // get the total number of items in the control + virtual unsigned int GetCount() const = 0; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + virtual unsigned int GetIndent() const = 0; + virtual void SetIndent(unsigned int indent) = 0; + + // spacing is the number of pixels between the start and the Text + // (has no effect under wxMSW) + unsigned int GetSpacing() const { return m_spacing; } + void SetSpacing(unsigned int spacing) { m_spacing = spacing; } + + // image list: these functions allow to associate an image list with + // the control and retrieve it. Note that the control does _not_ delete + // the associated image list when it's deleted in order to allow image + // lists to be shared between different controls. + // + // The normal image list is for the icons which correspond to the + // normal tree item state (whether it is selected or not). + // Additionally, the application might choose to show a state icon + // which corresponds to an app-defined item state (for example, + // checked/unchecked) which are taken from the state image list. + wxImageList *GetImageList() const { return m_imageListNormal; } + wxImageList *GetStateImageList() const { return m_imageListState; } + + virtual void SetImageList(wxImageList *imageList) = 0; + virtual void SetStateImageList(wxImageList *imageList) = 0; + void AssignImageList(wxImageList *imageList) + { + SetImageList(imageList); + m_ownsImageListNormal = true; + } + void AssignStateImageList(wxImageList *imageList) + { + SetStateImageList(imageList); + m_ownsImageListState = true; + } + + + // Functions to work with tree ctrl items. Unfortunately, they can _not_ be + // member functions of wxTreeItem because they must know the tree the item + // belongs to for Windows implementation and storing the pointer to + // wxTreeCtrl in each wxTreeItem is just too much waste. + + // accessors + // --------- + + // retrieve items label + virtual wxString GetItemText(const wxTreeItemId& item) const = 0; + // get one of the images associated with the item (normal by default) + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const = 0; + // get the data associated with the item + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const = 0; + + // get the item's text colour + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const = 0; + + // get the item's background colour + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const = 0; + + // get the item's font + virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0; + + // modifiers + // --------- + + // set items label + virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0; + // get one of the images associated with the item (normal by default) + virtual void SetItemImage(const wxTreeItemId& item, + int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0; + // associate some data with the item + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) = 0; + + // force appearance of [+] button near the item. This is useful to + // allow the user to expand the items which don't have any children now + // - but instead add them only when needed, thus minimizing memory + // usage and loading time. + virtual void SetItemHasChildren(const wxTreeItemId& item, + bool has = true) = 0; + + // the item will be shown in bold + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) = 0; + + // the item will be shown with a drop highlight + virtual void SetItemDropHighlight(const wxTreeItemId& item, + bool highlight = true) = 0; + + // set the items text colour + virtual void SetItemTextColour(const wxTreeItemId& item, + const wxColour& col) = 0; + + // set the items background colour + virtual void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col) = 0; + + // set the items font (should be of the same height for all items) + virtual void SetItemFont(const wxTreeItemId& item, + const wxFont& font) = 0; + + // item status inquiries + // --------------------- + + // is the item visible (it might be outside the view or not expanded)? + virtual bool IsVisible(const wxTreeItemId& item) const = 0; + // does the item has any children? + virtual bool ItemHasChildren(const wxTreeItemId& item) const = 0; + // same as above + bool HasChildren(const wxTreeItemId& item) const + { return ItemHasChildren(item); } + // is the item expanded (only makes sense if HasChildren())? + virtual bool IsExpanded(const wxTreeItemId& item) const = 0; + // is this item currently selected (the same as has focus)? + virtual bool IsSelected(const wxTreeItemId& item) const = 0; + // is item text in bold font? + virtual bool IsBold(const wxTreeItemId& item) const = 0; +#if wxABI_VERSION >= 20801 + // is the control empty? + bool IsEmpty() const; +#endif // wxABI 2.8.1+ + + + // number of children + // ------------------ + + // if 'recursively' is false, only immediate children count, otherwise + // the returned number is the number of all items in this branch + virtual size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = true) const = 0; + + // navigation + // ---------- + + // wxTreeItemId.IsOk() will return false if there is no such item + + // get the root tree item + virtual wxTreeItemId GetRootItem() const = 0; + + // get the item currently selected (may return NULL if no selection) + virtual wxTreeItemId GetSelection() const = 0; + + // get the items currently selected, return the number of such item + // + // NB: this operation is expensive and can take a long time for a + // control with a lot of items (~ O(number of items)). + virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0; + + // get the parent of this item (may return NULL if root) + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0; + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the first child of this item + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const = 0; + // get the next child + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const = 0; + // get the last child of this item - this method doesn't use cookies + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const = 0; + + // get the next sibling of this item + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const = 0; + // get the previous sibling + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const = 0; + + // get first visible item + virtual wxTreeItemId GetFirstVisibleItem() const = 0; + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const = 0; + // get the previous visible item: item must be visible itself! + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const = 0; + + // operations + // ---------- + + // add the root node to the tree + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) = 0; + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertItem(parent, 0u, text, image, selImage, data); + } + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertAfter(parent, idPrevious, text, image, selImage, data); + } + + // insert a new item before the one with the given index + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertItem(parent, pos, text, image, selImage, data); + } + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertItem(parent, (size_t)-1, text, image, selImage, data); + } + + // delete this item and associated data if any + virtual void Delete(const wxTreeItemId& item) = 0; + // delete all children (but don't delete the item itself) + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + virtual void DeleteChildren(const wxTreeItemId& item) = 0; + // delete all items from the tree + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + virtual void DeleteAllItems() = 0; + + // expand this item + virtual void Expand(const wxTreeItemId& item) = 0; + // expand the item and all its childs and thats childs + void ExpandAllChildren(const wxTreeItemId& item); + // expand all items + void ExpandAll(); + // collapse the item without removing its children + virtual void Collapse(const wxTreeItemId& item) = 0; +#if wxABI_VERSION >= 20801 + // collapse the item and all its childs and thats childs + void CollapseAllChildren(const wxTreeItemId& item); + // collapse all items + void CollapseAll(); +#endif // wxABI 2.8.1+ + // collapse the item and remove all children + virtual void CollapseAndReset(const wxTreeItemId& item) = 0; + // toggles the current state + virtual void Toggle(const wxTreeItemId& item) = 0; + + // remove the selection from currently selected item (if any) + virtual void Unselect() = 0; + // unselect all items (only makes sense for multiple selection control) + virtual void UnselectAll() = 0; + // select this item + virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0; + // unselect this item + void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); } + // toggle item selection + void ToggleItemSelection(const wxTreeItemId& item) + { + SelectItem(item, !IsSelected(item)); + } + + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + virtual void EnsureVisible(const wxTreeItemId& item) = 0; + // scroll to this item (but don't expand its parent) + virtual void ScrollTo(const wxTreeItemId& item) = 0; + + // start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. textCtrlClass parameter allows you to create an edit + // control of arbitrary user-defined class deriving from wxTextCtrl. + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) = 0; + // returns the same pointer as StartEdit() if the item is being edited, + // NULL otherwise (it's assumed that no more than one item may be + // edited simultaneously) + virtual wxTextCtrl *GetEditControl() const = 0; + // end editing and accept or discard the changes to item label + virtual void EndEditLabel(const wxTreeItemId& item, + bool discardChanges = false) = 0; + + // sorting + // ------- + + // this function is called to compare 2 items and should return -1, 0 + // or +1 if the first item is less than, equal to or greater than the + // second one. The base class version performs alphabetic comparaison + // of item labels (GetText) + virtual int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) + { + return wxStrcmp(GetItemText(item1), GetItemText(item2)); + } + + // sort the children of this item using OnCompareItems + // + // NB: this function is not reentrant and not MT-safe (FIXME)! + virtual void SortChildren(const wxTreeItemId& item) = 0; + + // items geometry + // -------------- + + // determine to which item (if any) belongs the given point (the + // coordinates specified are relative to the client area of tree ctrl) + // and, in the second variant, fill the flags parameter with a bitmask + // of wxTREE_HITTEST_xxx constants. + wxTreeItemId HitTest(const wxPoint& point) const + { int dummy; return DoTreeHitTest(point, dummy); } + wxTreeItemId HitTest(const wxPoint& point, int& flags) const + { return DoTreeHitTest(point, flags); } + + // get the bounding rectangle of the item (or of its label only) + virtual bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = false) const = 0; + + + // implementation + // -------------- + + virtual bool ShouldInheritColours() const { return false; } + + // hint whether to calculate best size quickly or accurately + void SetQuickBestSize(bool q) { m_quickBestSize = q; } + bool GetQuickBestSize() const { return m_quickBestSize; } + +protected: + virtual wxSize DoGetBestSize() const; + + // common part of Append/Prepend/InsertItem() + // + // pos is the position at which to insert the item or (size_t)-1 to append + // it to the end + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) = 0; + + // and this function implements overloaded InsertItem() taking wxTreeItemId + // (it can't be called InsertItem() as we'd have virtual function hiding + // problem in derived classes then) + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) = 0; + + // real HitTest() implementation: again, can't be called just HitTest() + // because it's overloaded and so the non-virtual overload would be hidden + // (and can't be called DoHitTest() because this is already in wxWindow) + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, + int& flags) const = 0; + + + wxImageList *m_imageListNormal, // images for tree elements + *m_imageListState; // special images for app defined states + bool m_ownsImageListNormal, + m_ownsImageListState; + + // spacing between left border and the text + unsigned int m_spacing; + + // whether full or quick calculation is done in DoGetBestSize + bool m_quickBestSize; + + + DECLARE_NO_COPY_CLASS(wxTreeCtrlBase) +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent wxTreeCtrl class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/generic/treectlg.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/treectrl.h" +#elif defined(__WXMSW__) + #include "wx/msw/treectrl.h" +#elif defined(__WXMOTIF__) + #include "wx/generic/treectlg.h" +#elif defined(__WXGTK__) + #include "wx/generic/treectlg.h" +#elif defined(__WXMAC__) + #include "wx/generic/treectlg.h" +#elif defined(__WXCOCOA__) + #include "wx/generic/treectlg.h" +#elif defined(__WXPM__) + #include "wx/generic/treectlg.h" +#endif + +#endif // wxUSE_TREECTRL + +#endif // _WX_TREECTRL_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/txtstrm.h b/Externals/wxWidgets/include/wx/txtstrm.h index 0e2b0c9551..969f6ddfa4 100644 --- a/Externals/wxWidgets/include/wx/txtstrm.h +++ b/Externals/wxWidgets/include/wx/txtstrm.h @@ -1,160 +1,160 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/txtstrm.h -// Purpose: Text stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 28/06/1998 -// RCS-ID: $Id: txtstrm.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TXTSTREAM_H_ -#define _WX_TXTSTREAM_H_ - -#include "wx/stream.h" -#include "wx/convauto.h" - -#if wxUSE_STREAMS - -class WXDLLIMPEXP_FWD_BASE wxTextInputStream; -class WXDLLIMPEXP_FWD_BASE wxTextOutputStream; - -typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&); -typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&); - -WXDLLIMPEXP_BASE wxTextOutputStream &endl( wxTextOutputStream &stream ); - - -#define wxEOT wxT('\4') // the End-Of-Text control code (used only inside wxTextInputStream) - -// If you're scanning through a file using wxTextInputStream, you should check for EOF _before_ -// reading the next item (word / number), because otherwise the last item may get lost. -// You should however be prepared to receive an empty item (empty string / zero number) at the -// end of file, especially on Windows systems. This is unavoidable because most (but not all) files end -// with whitespace (i.e. usually a newline). -class WXDLLIMPEXP_BASE wxTextInputStream -{ -public: -#if wxUSE_UNICODE - wxTextInputStream(wxInputStream& s, - const wxString &sep=wxT(" \t"), - const wxMBConv& conv = wxConvAuto()); -#else - wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t")); -#endif - ~wxTextInputStream(); - - wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format) - wxUint16 Read16(int base = 10); - wxUint8 Read8(int base = 10); - wxInt32 Read32S(int base = 10); - wxInt16 Read16S(int base = 10); - wxInt8 Read8S(int base = 10); - double ReadDouble(); - wxString ReadLine(); - wxString ReadWord(); - wxChar GetChar() { wxChar c = NextChar(); return (wxChar)(c != wxEOT ? c : 0); } - - wxString GetStringSeparators() const { return m_separators; } - void SetStringSeparators(const wxString &c) { m_separators = c; } - - // Operators - wxTextInputStream& operator>>(wxString& word); - wxTextInputStream& operator>>(char& c); -#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE - wxTextInputStream& operator>>(wchar_t& wc); -#endif // wxUSE_UNICODE - wxTextInputStream& operator>>(wxInt16& i); - wxTextInputStream& operator>>(wxInt32& i); - wxTextInputStream& operator>>(wxUint16& i); - wxTextInputStream& operator>>(wxUint32& i); - wxTextInputStream& operator>>(double& i); - wxTextInputStream& operator>>(float& f); - - wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxString ReadString() ); // use ReadLine or ReadWord instead -#endif // WXWIN_COMPATIBILITY_2_6 - -protected: - wxInputStream &m_input; - wxString m_separators; - char m_lastBytes[10]; // stores the bytes that were read for the last character - -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - bool EatEOL(const wxChar &c); - void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues - // returns EOT (\4) if there is a stream error, or end of file - wxChar NextChar(); // this should be used instead of GetC() because of Unicode issues - wxChar NextNonSeparators(); - - DECLARE_NO_COPY_CLASS(wxTextInputStream) -}; - -typedef enum -{ - wxEOL_NATIVE, - wxEOL_UNIX, - wxEOL_MAC, - wxEOL_DOS -} wxEOL; - -class WXDLLIMPEXP_BASE wxTextOutputStream -{ -public: -#if wxUSE_UNICODE - wxTextOutputStream(wxOutputStream& s, - wxEOL mode = wxEOL_NATIVE, - const wxMBConv& conv = wxConvAuto()); -#else - wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE); -#endif - virtual ~wxTextOutputStream(); - - void SetMode( wxEOL mode = wxEOL_NATIVE ); - wxEOL GetMode() { return m_mode; } - - void Write32(wxUint32 i); - void Write16(wxUint16 i); - void Write8(wxUint8 i); - virtual void WriteDouble(double d); - virtual void WriteString(const wxString& string); - - wxTextOutputStream& PutChar(wxChar c); - - wxTextOutputStream& operator<<(const wxChar *string); - wxTextOutputStream& operator<<(const wxString& string); - wxTextOutputStream& operator<<(char c); -#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE - wxTextOutputStream& operator<<(wchar_t wc); -#endif // wxUSE_UNICODE - wxTextOutputStream& operator<<(wxInt16 c); - wxTextOutputStream& operator<<(wxInt32 c); - wxTextOutputStream& operator<<(wxUint16 c); - wxTextOutputStream& operator<<(wxUint32 c); - wxTextOutputStream& operator<<(double f); - wxTextOutputStream& operator<<(float f); - - wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } - -protected: - wxOutputStream &m_output; - wxEOL m_mode; - -#if wxUSE_UNICODE - wxMBConv *m_conv; -#endif - - DECLARE_NO_COPY_CLASS(wxTextOutputStream) -}; - -#endif - // wxUSE_STREAMS - -#endif - // _WX_DATSTREAM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/txtstrm.h +// Purpose: Text stream classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 28/06/1998 +// RCS-ID: $Id: txtstrm.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TXTSTREAM_H_ +#define _WX_TXTSTREAM_H_ + +#include "wx/stream.h" +#include "wx/convauto.h" + +#if wxUSE_STREAMS + +class WXDLLIMPEXP_FWD_BASE wxTextInputStream; +class WXDLLIMPEXP_FWD_BASE wxTextOutputStream; + +typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&); +typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&); + +WXDLLIMPEXP_BASE wxTextOutputStream &endl( wxTextOutputStream &stream ); + + +#define wxEOT wxT('\4') // the End-Of-Text control code (used only inside wxTextInputStream) + +// If you're scanning through a file using wxTextInputStream, you should check for EOF _before_ +// reading the next item (word / number), because otherwise the last item may get lost. +// You should however be prepared to receive an empty item (empty string / zero number) at the +// end of file, especially on Windows systems. This is unavoidable because most (but not all) files end +// with whitespace (i.e. usually a newline). +class WXDLLIMPEXP_BASE wxTextInputStream +{ +public: +#if wxUSE_UNICODE + wxTextInputStream(wxInputStream& s, + const wxString &sep=wxT(" \t"), + const wxMBConv& conv = wxConvAuto()); +#else + wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t")); +#endif + ~wxTextInputStream(); + + wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format) + wxUint16 Read16(int base = 10); + wxUint8 Read8(int base = 10); + wxInt32 Read32S(int base = 10); + wxInt16 Read16S(int base = 10); + wxInt8 Read8S(int base = 10); + double ReadDouble(); + wxString ReadLine(); + wxString ReadWord(); + wxChar GetChar() { wxChar c = NextChar(); return (wxChar)(c != wxEOT ? c : 0); } + + wxString GetStringSeparators() const { return m_separators; } + void SetStringSeparators(const wxString &c) { m_separators = c; } + + // Operators + wxTextInputStream& operator>>(wxString& word); + wxTextInputStream& operator>>(char& c); +#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE + wxTextInputStream& operator>>(wchar_t& wc); +#endif // wxUSE_UNICODE + wxTextInputStream& operator>>(wxInt16& i); + wxTextInputStream& operator>>(wxInt32& i); + wxTextInputStream& operator>>(wxUint16& i); + wxTextInputStream& operator>>(wxUint32& i); + wxTextInputStream& operator>>(double& i); + wxTextInputStream& operator>>(float& f); + + wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } + +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( wxString ReadString() ); // use ReadLine or ReadWord instead +#endif // WXWIN_COMPATIBILITY_2_6 + +protected: + wxInputStream &m_input; + wxString m_separators; + char m_lastBytes[10]; // stores the bytes that were read for the last character + +#if wxUSE_UNICODE + wxMBConv *m_conv; +#endif + + bool EatEOL(const wxChar &c); + void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues + // returns EOT (\4) if there is a stream error, or end of file + wxChar NextChar(); // this should be used instead of GetC() because of Unicode issues + wxChar NextNonSeparators(); + + DECLARE_NO_COPY_CLASS(wxTextInputStream) +}; + +typedef enum +{ + wxEOL_NATIVE, + wxEOL_UNIX, + wxEOL_MAC, + wxEOL_DOS +} wxEOL; + +class WXDLLIMPEXP_BASE wxTextOutputStream +{ +public: +#if wxUSE_UNICODE + wxTextOutputStream(wxOutputStream& s, + wxEOL mode = wxEOL_NATIVE, + const wxMBConv& conv = wxConvAuto()); +#else + wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE); +#endif + virtual ~wxTextOutputStream(); + + void SetMode( wxEOL mode = wxEOL_NATIVE ); + wxEOL GetMode() { return m_mode; } + + void Write32(wxUint32 i); + void Write16(wxUint16 i); + void Write8(wxUint8 i); + virtual void WriteDouble(double d); + virtual void WriteString(const wxString& string); + + wxTextOutputStream& PutChar(wxChar c); + + wxTextOutputStream& operator<<(const wxChar *string); + wxTextOutputStream& operator<<(const wxString& string); + wxTextOutputStream& operator<<(char c); +#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE + wxTextOutputStream& operator<<(wchar_t wc); +#endif // wxUSE_UNICODE + wxTextOutputStream& operator<<(wxInt16 c); + wxTextOutputStream& operator<<(wxInt32 c); + wxTextOutputStream& operator<<(wxUint16 c); + wxTextOutputStream& operator<<(wxUint32 c); + wxTextOutputStream& operator<<(double f); + wxTextOutputStream& operator<<(float f); + + wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } + +protected: + wxOutputStream &m_output; + wxEOL m_mode; + +#if wxUSE_UNICODE + wxMBConv *m_conv; +#endif + + DECLARE_NO_COPY_CLASS(wxTextOutputStream) +}; + +#endif + // wxUSE_STREAMS + +#endif + // _WX_DATSTREAM_H_ diff --git a/Externals/wxWidgets/include/wx/types.h b/Externals/wxWidgets/include/wx/types.h index 6876168eec..d9eafa268f 100644 --- a/Externals/wxWidgets/include/wx/types.h +++ b/Externals/wxWidgets/include/wx/types.h @@ -1,93 +1,93 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: types.h -// Purpose: Type identifiers, used by resource system -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: types.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TYPESH__ -#define _WX_TYPESH__ - -// Types of objects -#define wxTYPE_ANY 0 -#define wxTYPE_OBJECT wxTYPE_ANY -#define wxTYPE_WINDOW 1 -#define wxTYPE_DIALOG_BOX 2 -#define wxTYPE_ITEM 3 -#define wxTYPE_PANEL 4 -#define wxTYPE_CANVAS 5 -#define wxTYPE_TEXT_WINDOW 6 -#define wxTYPE_FRAME 7 - -#define wxTYPE_BUTTON 8 -#define wxTYPE_TEXT 9 -#define wxTYPE_MESSAGE 10 -#define wxTYPE_CHOICE 11 -#define wxTYPE_LIST_BOX 12 -#define wxTYPE_SLIDER 13 -#define wxTYPE_CHECK_BOX 14 -#define wxTYPE_MENU 15 -#define wxTYPE_MENU_BAR 16 -#define wxTYPE_MULTI_TEXT 17 -#define wxTYPE_RADIO_BOX 18 -#define wxTYPE_GROUP_BOX 19 -#define wxTYPE_GAUGE 20 -#define wxTYPE_SCROLL_BAR 21 -#define wxTYPE_VIRT_LIST_BOX 22 -#define wxTYPE_COMBO_BOX 23 -#define wxTYPE_RADIO_BUTTON 24 - -#define wxTYPE_EVENT 25 -#define wxTYPE_DC 26 -#define wxTYPE_DC_CANVAS 27 -#define wxTYPE_DC_POSTSCRIPT 28 -#define wxTYPE_DC_PRINTER 29 -#define wxTYPE_DC_METAFILE 30 -#define wxTYPE_DC_MEMORY 31 -#define wxTYPE_MOUSE_EVENT 32 -#define wxTYPE_KEY_EVENT 33 -#define wxTYPE_COMMAND_EVENT 34 -#define wxTYPE_DC_PANEL 35 - -#define wxTYPE_PEN 40 -#define wxTYPE_BRUSH 41 -#define wxTYPE_FONT 42 -#define wxTYPE_ICON 42 -#define wxTYPE_BITMAP 43 -#define wxTYPE_METAFILE 44 -#define wxTYPE_TIMER 45 -#define wxTYPE_COLOUR 46 -#define wxTYPE_COLOURMAP 47 -#define wxTYPE_CURSOR 48 - -#define wxTYPE_DDE_CLIENT 60 -#define wxTYPE_DDE_SERVER 61 -#define wxTYPE_DDE_CONNECTION 62 - -#define wxTYPE_HELP_INSTANCE 63 - -#define wxTYPE_LIST 70 -#define wxTYPE_STRING_LIST 71 -#define wxTYPE_HASH_TABLE 72 -#define wxTYPE_NODE 73 -#define wxTYPE_APP 74 -#define wxTYPE_DATE 75 - -#define wxTYPE_ENHANCED_DIALOG 80 -#define wxTYPE_TOOLBAR 81 -#define wxTYPE_BUTTONBAR 82 - -#define wxTYPE_DATABASE 90 -#define wxTYPE_QUERY_FIELD 91 -#define wxTYPE_QUERY_COL 92 -#define wxTYPE_RECORDSET 93 - -#define wxTYPE_USER 500 - -#endif - // _WX_TYPESH__ - +///////////////////////////////////////////////////////////////////////////// +// Name: types.h +// Purpose: Type identifiers, used by resource system +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: types.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TYPESH__ +#define _WX_TYPESH__ + +// Types of objects +#define wxTYPE_ANY 0 +#define wxTYPE_OBJECT wxTYPE_ANY +#define wxTYPE_WINDOW 1 +#define wxTYPE_DIALOG_BOX 2 +#define wxTYPE_ITEM 3 +#define wxTYPE_PANEL 4 +#define wxTYPE_CANVAS 5 +#define wxTYPE_TEXT_WINDOW 6 +#define wxTYPE_FRAME 7 + +#define wxTYPE_BUTTON 8 +#define wxTYPE_TEXT 9 +#define wxTYPE_MESSAGE 10 +#define wxTYPE_CHOICE 11 +#define wxTYPE_LIST_BOX 12 +#define wxTYPE_SLIDER 13 +#define wxTYPE_CHECK_BOX 14 +#define wxTYPE_MENU 15 +#define wxTYPE_MENU_BAR 16 +#define wxTYPE_MULTI_TEXT 17 +#define wxTYPE_RADIO_BOX 18 +#define wxTYPE_GROUP_BOX 19 +#define wxTYPE_GAUGE 20 +#define wxTYPE_SCROLL_BAR 21 +#define wxTYPE_VIRT_LIST_BOX 22 +#define wxTYPE_COMBO_BOX 23 +#define wxTYPE_RADIO_BUTTON 24 + +#define wxTYPE_EVENT 25 +#define wxTYPE_DC 26 +#define wxTYPE_DC_CANVAS 27 +#define wxTYPE_DC_POSTSCRIPT 28 +#define wxTYPE_DC_PRINTER 29 +#define wxTYPE_DC_METAFILE 30 +#define wxTYPE_DC_MEMORY 31 +#define wxTYPE_MOUSE_EVENT 32 +#define wxTYPE_KEY_EVENT 33 +#define wxTYPE_COMMAND_EVENT 34 +#define wxTYPE_DC_PANEL 35 + +#define wxTYPE_PEN 40 +#define wxTYPE_BRUSH 41 +#define wxTYPE_FONT 42 +#define wxTYPE_ICON 42 +#define wxTYPE_BITMAP 43 +#define wxTYPE_METAFILE 44 +#define wxTYPE_TIMER 45 +#define wxTYPE_COLOUR 46 +#define wxTYPE_COLOURMAP 47 +#define wxTYPE_CURSOR 48 + +#define wxTYPE_DDE_CLIENT 60 +#define wxTYPE_DDE_SERVER 61 +#define wxTYPE_DDE_CONNECTION 62 + +#define wxTYPE_HELP_INSTANCE 63 + +#define wxTYPE_LIST 70 +#define wxTYPE_STRING_LIST 71 +#define wxTYPE_HASH_TABLE 72 +#define wxTYPE_NODE 73 +#define wxTYPE_APP 74 +#define wxTYPE_DATE 75 + +#define wxTYPE_ENHANCED_DIALOG 80 +#define wxTYPE_TOOLBAR 81 +#define wxTYPE_BUTTONBAR 82 + +#define wxTYPE_DATABASE 90 +#define wxTYPE_QUERY_FIELD 91 +#define wxTYPE_QUERY_COL 92 +#define wxTYPE_RECORDSET 93 + +#define wxTYPE_USER 500 + +#endif + // _WX_TYPESH__ + diff --git a/Externals/wxWidgets/include/wx/univ/app.h b/Externals/wxWidgets/include/wx/univ/app.h index fbd3c86d6e..26f14538e3 100644 --- a/Externals/wxWidgets/include/wx/univ/app.h +++ b/Externals/wxWidgets/include/wx/univ/app.h @@ -1,21 +1,21 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/app.h -// Purpose: wxUniversalApp class extends wxApp for wxUniv port -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.00 -// RCS-ID: $Id: app.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_APP_H_ -#define _WX_UNIX_APP_H_ - -class WXDLLEXPORT wxUniversalApp : public wxApp -{ -public: -}; - -#endif // _WX_UNIX_APP_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/app.h +// Purpose: wxUniversalApp class extends wxApp for wxUniv port +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// RCS-ID: $Id: app.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_APP_H_ +#define _WX_UNIX_APP_H_ + +class WXDLLEXPORT wxUniversalApp : public wxApp +{ +public: +}; + +#endif // _WX_UNIX_APP_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/bmpbuttn.h b/Externals/wxWidgets/include/wx/univ/bmpbuttn.h index e96e9e60f0..9c380e60ac 100644 --- a/Externals/wxWidgets/include/wx/univ/bmpbuttn.h +++ b/Externals/wxWidgets/include/wx/univ/bmpbuttn.h @@ -1,72 +1,72 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/bmpbuttn.h -// Purpose: wxBitmapButton class for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.08.00 -// RCS-ID: $Id: bmpbuttn.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_BMPBUTTN_H_ -#define _WX_UNIV_BMPBUTTN_H_ - -class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase -{ -public: - wxBitmapButton() { } - - wxBitmapButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, bitmap, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - virtual void SetMargins(int x, int y) - { - SetImageMargins(x, y); - - wxBitmapButtonBase::SetMargins(x, y); - } - - virtual bool Enable(bool enable = true); - - virtual bool SetCurrent(bool doit = true); - - virtual void Press(); - virtual void Release(); - -protected: - void OnSetFocus(wxFocusEvent& event); - void OnKillFocus(wxFocusEvent& event); - - // called when one of the bitmap is changed by user - virtual void OnSetBitmap(); - - // set bitmap to the given one if it's ok or to m_bmpNormal and return - // true if the bitmap really changed - bool ChangeBitmap(const wxBitmap& bmp); - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxBitmapButton) -}; - -#endif // _WX_UNIV_BMPBUTTN_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/bmpbuttn.h +// Purpose: wxBitmapButton class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// RCS-ID: $Id: bmpbuttn.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_BMPBUTTN_H_ +#define _WX_UNIV_BMPBUTTN_H_ + +class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton() { } + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual void SetMargins(int x, int y) + { + SetImageMargins(x, y); + + wxBitmapButtonBase::SetMargins(x, y); + } + + virtual bool Enable(bool enable = true); + + virtual bool SetCurrent(bool doit = true); + + virtual void Press(); + virtual void Release(); + +protected: + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + + // called when one of the bitmap is changed by user + virtual void OnSetBitmap(); + + // set bitmap to the given one if it's ok or to m_bmpNormal and return + // true if the bitmap really changed + bool ChangeBitmap(const wxBitmap& bmp); + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxBitmapButton) +}; + +#endif // _WX_UNIV_BMPBUTTN_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/button.h b/Externals/wxWidgets/include/wx/univ/button.h index 2347364888..48d0c9edad 100644 --- a/Externals/wxWidgets/include/wx/univ/button.h +++ b/Externals/wxWidgets/include/wx/univ/button.h @@ -1,139 +1,139 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/button.h -// Purpose: wxButton for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 15.08.00 -// RCS-ID: $Id: button.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_BUTTON_H_ -#define _WX_UNIV_BUTTON_H_ - -class WXDLLEXPORT wxInputHandler; - -#include "wx/bitmap.h" - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -#define wxACTION_BUTTON_TOGGLE _T("toggle") // press/release the button -#define wxACTION_BUTTON_PRESS _T("press") // press the button -#define wxACTION_BUTTON_RELEASE _T("release") // release the button -#define wxACTION_BUTTON_CLICK _T("click") // generate button click event - -// ---------------------------------------------------------------------------- -// wxButton: a push button -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxButton : public wxButtonBase -{ -public: - wxButton() { Init(); } - wxButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Init(); - - Create(parent, id, bitmap, label, pos, size, style, validator, name); - } - - wxButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - return Create(parent, id, wxNullBitmap, label, - pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - virtual ~wxButton(); - - virtual void SetImageLabel(const wxBitmap& bitmap); - virtual void SetImageMargins(wxCoord x, wxCoord y); - virtual void SetDefault(); - - virtual bool IsPressed() const { return m_isPressed; } - virtual bool IsDefault() const { return m_isDefault; } - - // wxButton actions - virtual void Toggle(); - virtual void Press(); - virtual void Release(); - virtual void Click(); - - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1, - const wxString& strArg = wxEmptyString); - - virtual bool CanBeHighlighted() const { return true; } - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - -protected: - virtual wxSize DoGetBestClientSize() const; - - virtual bool DoDrawBackground(wxDC& dc); - virtual void DoDraw(wxControlRenderer *renderer); - - // common part of all ctors - void Init(); - - // current state - bool m_isPressed, - m_isDefault; - - // the (optional) image to show and the margins around it - wxBitmap m_bitmap; - wxCoord m_marginBmpX, - m_marginBmpY; - -private: - DECLARE_DYNAMIC_CLASS(wxButton) -}; - -#endif // _WX_UNIV_BUTTON_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/button.h +// Purpose: wxButton for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.08.00 +// RCS-ID: $Id: button.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_BUTTON_H_ +#define _WX_UNIV_BUTTON_H_ + +class WXDLLEXPORT wxInputHandler; + +#include "wx/bitmap.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +#define wxACTION_BUTTON_TOGGLE _T("toggle") // press/release the button +#define wxACTION_BUTTON_PRESS _T("press") // press the button +#define wxACTION_BUTTON_RELEASE _T("release") // release the button +#define wxACTION_BUTTON_CLICK _T("click") // generate button click event + +// ---------------------------------------------------------------------------- +// wxButton: a push button +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxButton : public wxButtonBase +{ +public: + wxButton() { Init(); } + wxButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Init(); + + Create(parent, id, bitmap, label, pos, size, style, validator, name); + } + + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + return Create(parent, id, wxNullBitmap, label, + pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual ~wxButton(); + + virtual void SetImageLabel(const wxBitmap& bitmap); + virtual void SetImageMargins(wxCoord x, wxCoord y); + virtual void SetDefault(); + + virtual bool IsPressed() const { return m_isPressed; } + virtual bool IsDefault() const { return m_isDefault; } + + // wxButton actions + virtual void Toggle(); + virtual void Press(); + virtual void Release(); + virtual void Click(); + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString); + + virtual bool CanBeHighlighted() const { return true; } + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + +protected: + virtual wxSize DoGetBestClientSize() const; + + virtual bool DoDrawBackground(wxDC& dc); + virtual void DoDraw(wxControlRenderer *renderer); + + // common part of all ctors + void Init(); + + // current state + bool m_isPressed, + m_isDefault; + + // the (optional) image to show and the margins around it + wxBitmap m_bitmap; + wxCoord m_marginBmpX, + m_marginBmpY; + +private: + DECLARE_DYNAMIC_CLASS(wxButton) +}; + +#endif // _WX_UNIV_BUTTON_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/checkbox.h b/Externals/wxWidgets/include/wx/univ/checkbox.h index 682e1968f3..cd5a529682 100644 --- a/Externals/wxWidgets/include/wx/univ/checkbox.h +++ b/Externals/wxWidgets/include/wx/univ/checkbox.h @@ -1,150 +1,150 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/checkbox.h -// Purpose: wxCheckBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 07.09.00 -// RCS-ID: $Id: checkbox.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_CHECKBOX_H_ -#define _WX_UNIV_CHECKBOX_H_ - -#include "wx/button.h" // for wxStdButtonInputHandler - -// ---------------------------------------------------------------------------- -// the actions supported by wxCheckBox -// ---------------------------------------------------------------------------- - -#define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(true) -#define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(false) -#define wxACTION_CHECKBOX_TOGGLE _T("toggle") // toggle the check state - -// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE - -// ---------------------------------------------------------------------------- -// wxCheckBox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase -{ -public: - // checkbox constants - enum State - { - State_Normal, - State_Pressed, - State_Disabled, - State_Current, - State_Max - }; - - enum Status - { - Status_Checked, - Status_Unchecked, - Status_3rdState, - Status_Max - }; - - // constructors - wxCheckBox() { Init(); } - - wxCheckBox(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - // implement the checkbox interface - virtual void SetValue(bool value); - virtual bool GetValue() const; - - // set/get the bitmaps to use for the checkbox indicator - void SetBitmap(const wxBitmap& bmp, State state, Status status); - virtual wxBitmap GetBitmap(State state, Status status) const; - - // wxCheckBox actions - void Toggle(); - virtual void Press(); - virtual void Release(); - virtual void ChangeValue(bool value); - - // overridden base class virtuals - virtual bool IsPressed() const { return m_isPressed; } - - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1, - const wxString& strArg = wxEmptyString); - - virtual bool CanBeHighlighted() const { return true; } - virtual wxInputHandler *CreateStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return CreateStdInputHandler(handlerDef); - } - -protected: - virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)); - virtual wxCheckBoxState DoGet3StateValue() const; - - virtual void DoDraw(wxControlRenderer *renderer); - virtual wxSize DoGetBestClientSize() const; - - // get the size of the bitmap using either the current one or the default - // one (query renderer then) - virtual wxSize GetBitmapSize() const; - - // common part of all ctors - void Init(); - - // send command event notifying about the checkbox state change - virtual void SendEvent(); - - // called when the checkbox becomes checked - radio button hook - virtual void OnCheck(); - - // get the state corresponding to the flags (combination of wxCONTROL_XXX) - wxCheckBox::State GetState(int flags) const; - - // directly access the bitmaps array without trying to find a valid bitmap - // to use as GetBitmap() does - wxBitmap DoGetBitmap(State state, Status status) const - { return m_bitmaps[state][status]; } - - // get the current status - Status GetStatus() const { return m_status; } - -private: - // the current check status - Status m_status; - - // the bitmaps to use for the different states - wxBitmap m_bitmaps[State_Max][Status_Max]; - - // is the checkbox currently pressed? - bool m_isPressed; - - DECLARE_DYNAMIC_CLASS(wxCheckBox) -}; - -#endif // _WX_UNIV_CHECKBOX_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/checkbox.h +// Purpose: wxCheckBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.09.00 +// RCS-ID: $Id: checkbox.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHECKBOX_H_ +#define _WX_UNIV_CHECKBOX_H_ + +#include "wx/button.h" // for wxStdButtonInputHandler + +// ---------------------------------------------------------------------------- +// the actions supported by wxCheckBox +// ---------------------------------------------------------------------------- + +#define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(true) +#define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(false) +#define wxACTION_CHECKBOX_TOGGLE _T("toggle") // toggle the check state + +// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE + +// ---------------------------------------------------------------------------- +// wxCheckBox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase +{ +public: + // checkbox constants + enum State + { + State_Normal, + State_Pressed, + State_Disabled, + State_Current, + State_Max + }; + + enum Status + { + Status_Checked, + Status_Unchecked, + Status_3rdState, + Status_Max + }; + + // constructors + wxCheckBox() { Init(); } + + wxCheckBox(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + // implement the checkbox interface + virtual void SetValue(bool value); + virtual bool GetValue() const; + + // set/get the bitmaps to use for the checkbox indicator + void SetBitmap(const wxBitmap& bmp, State state, Status status); + virtual wxBitmap GetBitmap(State state, Status status) const; + + // wxCheckBox actions + void Toggle(); + virtual void Press(); + virtual void Release(); + virtual void ChangeValue(bool value); + + // overridden base class virtuals + virtual bool IsPressed() const { return m_isPressed; } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString); + + virtual bool CanBeHighlighted() const { return true; } + virtual wxInputHandler *CreateStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return CreateStdInputHandler(handlerDef); + } + +protected: + virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)); + virtual wxCheckBoxState DoGet3StateValue() const; + + virtual void DoDraw(wxControlRenderer *renderer); + virtual wxSize DoGetBestClientSize() const; + + // get the size of the bitmap using either the current one or the default + // one (query renderer then) + virtual wxSize GetBitmapSize() const; + + // common part of all ctors + void Init(); + + // send command event notifying about the checkbox state change + virtual void SendEvent(); + + // called when the checkbox becomes checked - radio button hook + virtual void OnCheck(); + + // get the state corresponding to the flags (combination of wxCONTROL_XXX) + wxCheckBox::State GetState(int flags) const; + + // directly access the bitmaps array without trying to find a valid bitmap + // to use as GetBitmap() does + wxBitmap DoGetBitmap(State state, Status status) const + { return m_bitmaps[state][status]; } + + // get the current status + Status GetStatus() const { return m_status; } + +private: + // the current check status + Status m_status; + + // the bitmaps to use for the different states + wxBitmap m_bitmaps[State_Max][Status_Max]; + + // is the checkbox currently pressed? + bool m_isPressed; + + DECLARE_DYNAMIC_CLASS(wxCheckBox) +}; + +#endif // _WX_UNIV_CHECKBOX_H_ diff --git a/Externals/wxWidgets/include/wx/univ/checklst.h b/Externals/wxWidgets/include/wx/univ/checklst.h index 67343c8ec2..d81bdd8d7e 100644 --- a/Externals/wxWidgets/include/wx/univ/checklst.h +++ b/Externals/wxWidgets/include/wx/univ/checklst.h @@ -1,114 +1,114 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/checklst.h -// Purpose: wxCheckListBox class for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.09.00 -// RCS-ID: $Id: checklst.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_CHECKLST_H_ -#define _WX_UNIV_CHECKLST_H_ - -// ---------------------------------------------------------------------------- -// actions -// ---------------------------------------------------------------------------- - -#define wxACTION_CHECKLISTBOX_TOGGLE _T("toggle") - -// ---------------------------------------------------------------------------- -// wxCheckListBox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase -{ -public: - // ctors - wxCheckListBox() { Init(); } - - wxCheckListBox(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Init(); - - Create(parent, id, pos, size, nStrings, choices, style, validator, name); - } - wxCheckListBox(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = (const wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - // implement check list box methods - virtual bool IsChecked(unsigned int item) const; - virtual void Check(unsigned int item, bool check = true); - - // and input handling - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1l, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - // override all methods which add/delete items to update m_checks array as - // well - virtual void Delete(unsigned int n); - -protected: - virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); - virtual void DoSetItems(const wxArrayString& items, void **clientData); - virtual void DoClear(); - - // draw the check items instead of the usual ones - virtual void DoDrawRange(wxControlRenderer *renderer, - int itemFirst, int itemLast); - - // take them also into account for size calculation - virtual wxSize DoGetBestClientSize() const; - - // common part of all ctors - void Init(); - -private: - // the array containing the checked status of the items - wxArrayInt m_checks; - - DECLARE_DYNAMIC_CLASS(wxCheckListBox) -}; - -#endif // _WX_UNIV_CHECKLST_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/checklst.h +// Purpose: wxCheckListBox class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.09.00 +// RCS-ID: $Id: checklst.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHECKLST_H_ +#define _WX_UNIV_CHECKLST_H_ + +// ---------------------------------------------------------------------------- +// actions +// ---------------------------------------------------------------------------- + +#define wxACTION_CHECKLISTBOX_TOGGLE _T("toggle") + +// ---------------------------------------------------------------------------- +// wxCheckListBox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox() { Init(); } + + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Init(); + + Create(parent, id, pos, size, nStrings, choices, style, validator, name); + } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + // implement check list box methods + virtual bool IsChecked(unsigned int item) const; + virtual void Check(unsigned int item, bool check = true); + + // and input handling + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1l, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + // override all methods which add/delete items to update m_checks array as + // well + virtual void Delete(unsigned int n); + +protected: + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + virtual void DoClear(); + + // draw the check items instead of the usual ones + virtual void DoDrawRange(wxControlRenderer *renderer, + int itemFirst, int itemLast); + + // take them also into account for size calculation + virtual wxSize DoGetBestClientSize() const; + + // common part of all ctors + void Init(); + +private: + // the array containing the checked status of the items + wxArrayInt m_checks; + + DECLARE_DYNAMIC_CLASS(wxCheckListBox) +}; + +#endif // _WX_UNIV_CHECKLST_H_ diff --git a/Externals/wxWidgets/include/wx/univ/chkconf.h b/Externals/wxWidgets/include/wx/univ/chkconf.h index 6a4e2e7208..e88a2cf3ef 100644 --- a/Externals/wxWidgets/include/wx/univ/chkconf.h +++ b/Externals/wxWidgets/include/wx/univ/chkconf.h @@ -1,117 +1,117 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/chkconf.h -// Purpose: wxUniversal-specific configuration options checks -// Author: Vadim Zeitlin -// Created: 2006-09-28 (extracted from wx/chkconf.h) -// RCS-ID: $Id: chkconf.h 41494 2006-09-28 22:55:28Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_CHKCONF_H_ -#define _WX_UNIV_CHKCONF_H_ - -#if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus" -# else -# undef wxUSE_POPUPWIN -# define wxUSE_POPUPWIN 1 -# endif -#endif - -#if wxUSE_COMBOBOX -# if !wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxComboBox requires wxListBox in wxUniversal" -# else -# undef wxUSE_LISTBOX -# define wxUSE_LISTBOX 1 -# endif -# endif -#endif /* wxUSE_COMBOBOX */ - -#if wxUSE_RADIOBTN -# if !wxUSE_CHECKBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal" -# else -# undef wxUSE_CHECKBOX -# define wxUSE_CHECKBOX 1 -# endif -# endif -#endif /* wxUSE_RADIOBTN */ - -#if wxUSE_TEXTCTRL -# if !wxUSE_CARET -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTextCtrl requires wxCaret in wxUniversal" -# else -# undef wxUSE_CARET -# define wxUSE_CARET 1 -# endif -# endif /* wxUSE_CARET */ - -# if !wxUSE_SCROLLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTextCtrl requires wxScrollBar in wxUniversal" -# else -# undef wxUSE_SCROLLBAR -# define wxUSE_SCROLLBAR 1 -# endif -# endif /* wxUSE_SCROLLBAR */ -#endif /* wxUSE_TEXTCTRL */ - - -/* Themes checks */ -#ifndef wxUSE_ALL_THEMES -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_ALL_THEMES must be defined" -# else -# define wxUSE_ALL_THEMES 1 -# endif -#endif /* wxUSE_ALL_THEMES */ - -#ifndef wxUSE_THEME_GTK -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_THEME_GTK must be defined" -# else -# define wxUSE_THEME_GTK 1 -# endif -#endif /* wxUSE_THEME_GTK */ - -#ifndef wxUSE_THEME_METAL -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_THEME_METAL must be defined" -# else -# define wxUSE_THEME_METAL 1 -# endif -#endif /* wxUSE_THEME_METAL */ - -#ifndef wxUSE_THEME_MONO -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_THEME_MONO must be defined" -# else -# define wxUSE_THEME_MONO 1 -# endif -#endif /* wxUSE_THEME_MONO */ - -#ifndef wxUSE_THEME_WIN32 -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_THEME_WIN32 must be defined" -# else -# define wxUSE_THEME_WIN32 1 -# endif -#endif /* wxUSE_THEME_WIN32 */ - -#if !wxUSE_ALL_THEMES && wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 -# ifdef wxABORT_ON_CONFIG_ERROR -# error "Metal theme requires Win32 one" -# else -# undef wxUSE_THEME_WIN32 -# define wxUSE_THEME_WIN32 1 -# endif -#endif /* wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 */ - -#endif /* _WX_UNIV_CHKCONF_H_ */ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/chkconf.h +// Purpose: wxUniversal-specific configuration options checks +// Author: Vadim Zeitlin +// Created: 2006-09-28 (extracted from wx/chkconf.h) +// RCS-ID: $Id: chkconf.h 41494 2006-09-28 22:55:28Z VZ $ +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHKCONF_H_ +#define _WX_UNIV_CHKCONF_H_ + +#if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus" +# else +# undef wxUSE_POPUPWIN +# define wxUSE_POPUPWIN 1 +# endif +#endif + +#if wxUSE_COMBOBOX +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxComboBox requires wxListBox in wxUniversal" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_COMBOBOX */ + +#if wxUSE_RADIOBTN +# if !wxUSE_CHECKBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal" +# else +# undef wxUSE_CHECKBOX +# define wxUSE_CHECKBOX 1 +# endif +# endif +#endif /* wxUSE_RADIOBTN */ + +#if wxUSE_TEXTCTRL +# if !wxUSE_CARET +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTextCtrl requires wxCaret in wxUniversal" +# else +# undef wxUSE_CARET +# define wxUSE_CARET 1 +# endif +# endif /* wxUSE_CARET */ + +# if !wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTextCtrl requires wxScrollBar in wxUniversal" +# else +# undef wxUSE_SCROLLBAR +# define wxUSE_SCROLLBAR 1 +# endif +# endif /* wxUSE_SCROLLBAR */ +#endif /* wxUSE_TEXTCTRL */ + + +/* Themes checks */ +#ifndef wxUSE_ALL_THEMES +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ALL_THEMES must be defined" +# else +# define wxUSE_ALL_THEMES 1 +# endif +#endif /* wxUSE_ALL_THEMES */ + +#ifndef wxUSE_THEME_GTK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_GTK must be defined" +# else +# define wxUSE_THEME_GTK 1 +# endif +#endif /* wxUSE_THEME_GTK */ + +#ifndef wxUSE_THEME_METAL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_METAL must be defined" +# else +# define wxUSE_THEME_METAL 1 +# endif +#endif /* wxUSE_THEME_METAL */ + +#ifndef wxUSE_THEME_MONO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_MONO must be defined" +# else +# define wxUSE_THEME_MONO 1 +# endif +#endif /* wxUSE_THEME_MONO */ + +#ifndef wxUSE_THEME_WIN32 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_WIN32 must be defined" +# else +# define wxUSE_THEME_WIN32 1 +# endif +#endif /* wxUSE_THEME_WIN32 */ + +#if !wxUSE_ALL_THEMES && wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Metal theme requires Win32 one" +# else +# undef wxUSE_THEME_WIN32 +# define wxUSE_THEME_WIN32 1 +# endif +#endif /* wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 */ + +#endif /* _WX_UNIV_CHKCONF_H_ */ + diff --git a/Externals/wxWidgets/include/wx/univ/choice.h b/Externals/wxWidgets/include/wx/univ/choice.h index 86627889e2..5c254b6bab 100644 --- a/Externals/wxWidgets/include/wx/univ/choice.h +++ b/Externals/wxWidgets/include/wx/univ/choice.h @@ -1,64 +1,64 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/choice.h -// Purpose: the universal choice -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.08.00 -// RCS-ID: $Id: choice.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_CHOICE_H_ -#define _WX_UNIV_CHOICE_H_ - -#include "wx/combobox.h" - -// VS: This is only a *temporary* implementation, real wxChoice should not -// derive from wxComboBox and may have different l&f -class WXDLLEXPORT wxChoice : public wxComboBox -{ -public: - wxChoice() {} - wxChoice(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - wxChoice(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - -private: - void OnComboBox(wxCommandEvent &event); - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxChoice) -}; - - -#endif // _WX_UNIV_CHOICE_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/choice.h +// Purpose: the universal choice +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// RCS-ID: $Id: choice.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHOICE_H_ +#define _WX_UNIV_CHOICE_H_ + +#include "wx/combobox.h" + +// VS: This is only a *temporary* implementation, real wxChoice should not +// derive from wxComboBox and may have different l&f +class WXDLLEXPORT wxChoice : public wxComboBox +{ +public: + wxChoice() {} + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + +private: + void OnComboBox(wxCommandEvent &event); + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxChoice) +}; + + +#endif // _WX_UNIV_CHOICE_H_ diff --git a/Externals/wxWidgets/include/wx/univ/colschem.h b/Externals/wxWidgets/include/wx/univ/colschem.h index 2a566dcdbe..eb92d21773 100644 --- a/Externals/wxWidgets/include/wx/univ/colschem.h +++ b/Externals/wxWidgets/include/wx/univ/colschem.h @@ -1,103 +1,103 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/colschem.h -// Purpose: wxColourScheme class provides the colours to use for drawing -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.08.00 -// RCS-ID: $Id: colschem.h 44058 2006-12-24 19:06:39Z VS $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_COLSCHEM_H_ -#define _WX_UNIV_COLSCHEM_H_ - -class WXDLLEXPORT wxWindow; - -#include "wx/colour.h" -#include "wx/checkbox.h" - -// ---------------------------------------------------------------------------- -// wxColourScheme -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxColourScheme -{ -public: - // the standard colours - enum StdColour - { - // the background colour for a window - WINDOW, - - // the different background and text colours for the control - CONTROL, - CONTROL_PRESSED, - CONTROL_CURRENT, - - // the label text for the normal and the disabled state - CONTROL_TEXT, - CONTROL_TEXT_DISABLED, - CONTROL_TEXT_DISABLED_SHADOW, - - // the scrollbar background colour for the normal and pressed states - SCROLLBAR, - SCROLLBAR_PRESSED, - - // the background and text colour for the highlighted item - HIGHLIGHT, - HIGHLIGHT_TEXT, - - // these colours are used for drawing the shadows of 3D objects - SHADOW_DARK, - SHADOW_HIGHLIGHT, - SHADOW_IN, - SHADOW_OUT, - - // the titlebar background colours for the normal and focused states - TITLEBAR, - TITLEBAR_ACTIVE, - - // the titlebar text colours - TITLEBAR_TEXT, - TITLEBAR_ACTIVE_TEXT, - - // the default gauge fill colour - GAUGE, - - // desktop background colour (only used by framebuffer ports) - DESKTOP, - - // wxFrame's background colour - FRAME, - - MAX - }; - - // get a standard colour - virtual wxColour Get(StdColour col) const = 0; - - // get the background colour for the given window - virtual wxColour GetBackground(wxWindow *win) const = 0; - - // virtual dtor for any base class - virtual ~wxColourScheme(); -}; - -// some people just can't spell it correctly :-) -typedef wxColourScheme wxColorScheme; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// retrieve the default colour from the theme or the given scheme -#define wxSCHEME_COLOUR(scheme, what) scheme->Get(wxColorScheme::what) -#define wxTHEME_COLOUR(what) \ - wxSCHEME_COLOUR(wxTheme::Get()->GetColourScheme(), what) - -// get the background colour for the window in the current theme -#define wxTHEME_BG_COLOUR(win) \ - wxTheme::Get()->GetColourScheme()->GetBackground(win) - -#endif // _WX_UNIV_COLSCHEM_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/colschem.h +// Purpose: wxColourScheme class provides the colours to use for drawing +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.00 +// RCS-ID: $Id: colschem.h 44058 2006-12-24 19:06:39Z VS $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_COLSCHEM_H_ +#define _WX_UNIV_COLSCHEM_H_ + +class WXDLLEXPORT wxWindow; + +#include "wx/colour.h" +#include "wx/checkbox.h" + +// ---------------------------------------------------------------------------- +// wxColourScheme +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxColourScheme +{ +public: + // the standard colours + enum StdColour + { + // the background colour for a window + WINDOW, + + // the different background and text colours for the control + CONTROL, + CONTROL_PRESSED, + CONTROL_CURRENT, + + // the label text for the normal and the disabled state + CONTROL_TEXT, + CONTROL_TEXT_DISABLED, + CONTROL_TEXT_DISABLED_SHADOW, + + // the scrollbar background colour for the normal and pressed states + SCROLLBAR, + SCROLLBAR_PRESSED, + + // the background and text colour for the highlighted item + HIGHLIGHT, + HIGHLIGHT_TEXT, + + // these colours are used for drawing the shadows of 3D objects + SHADOW_DARK, + SHADOW_HIGHLIGHT, + SHADOW_IN, + SHADOW_OUT, + + // the titlebar background colours for the normal and focused states + TITLEBAR, + TITLEBAR_ACTIVE, + + // the titlebar text colours + TITLEBAR_TEXT, + TITLEBAR_ACTIVE_TEXT, + + // the default gauge fill colour + GAUGE, + + // desktop background colour (only used by framebuffer ports) + DESKTOP, + + // wxFrame's background colour + FRAME, + + MAX + }; + + // get a standard colour + virtual wxColour Get(StdColour col) const = 0; + + // get the background colour for the given window + virtual wxColour GetBackground(wxWindow *win) const = 0; + + // virtual dtor for any base class + virtual ~wxColourScheme(); +}; + +// some people just can't spell it correctly :-) +typedef wxColourScheme wxColorScheme; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// retrieve the default colour from the theme or the given scheme +#define wxSCHEME_COLOUR(scheme, what) scheme->Get(wxColorScheme::what) +#define wxTHEME_COLOUR(what) \ + wxSCHEME_COLOUR(wxTheme::Get()->GetColourScheme(), what) + +// get the background colour for the window in the current theme +#define wxTHEME_BG_COLOUR(win) \ + wxTheme::Get()->GetColourScheme()->GetBackground(win) + +#endif // _WX_UNIV_COLSCHEM_H_ diff --git a/Externals/wxWidgets/include/wx/univ/combobox.h b/Externals/wxWidgets/include/wx/univ/combobox.h index 97864b1805..9c3a77a853 100644 --- a/Externals/wxWidgets/include/wx/univ/combobox.h +++ b/Externals/wxWidgets/include/wx/univ/combobox.h @@ -1,167 +1,167 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/combobox.h -// Purpose: the universal combobox -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.08.00 -// RCS-ID: $Id: combobox.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - - -#ifndef _WX_UNIV_COMBOBOX_H_ -#define _WX_UNIV_COMBOBOX_H_ - -#include "wx/combo.h" - -class WXDLLEXPORT wxListBox; - -// ---------------------------------------------------------------------------- -// NB: some actions supported by this control are in wx/generic/combo.h -// ---------------------------------------------------------------------------- - -// choose the next/prev/specified (by numArg) item -#define wxACTION_COMBOBOX_SELECT_NEXT _T("next") -#define wxACTION_COMBOBOX_SELECT_PREV _T("prev") -#define wxACTION_COMBOBOX_SELECT _T("select") - - -// ---------------------------------------------------------------------------- -// wxComboBox: a combination of text control and a listbox -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxComboBox : public wxComboCtrl, public wxComboBoxBase -{ -public: - // ctors and such - wxComboBox() { Init(); } - - wxComboBox(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, - const wxString choices[] = (const wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Init(); - - (void)Create(parent, id, value, pos, size, n, choices, - style, validator, name); - } - wxComboBox(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, - const wxString choices[] = (const wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - - virtual ~wxComboBox(); - - // the wxUniversal-specific methods - // -------------------------------- - - // implement the combobox interface - - // wxTextCtrl methods - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - virtual bool IsEditable() const; - - virtual void Undo(); - virtual void Redo(); - virtual void SelectAll(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // wxControlWithItems methods - virtual void Clear(); - virtual void Delete(unsigned int n); - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual void SetSelection(int n); - virtual int GetSelection() const; - - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - - // we have our own input handler and our own actions - // (but wxComboCtrl already handled Popup/Dismiss) - /* - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0l, - const wxString& strArg = wxEmptyString); - */ - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - -protected: - virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - - // common part of all ctors - void Init(); - - // get the associated listbox - wxListBox *GetLBox() const { return m_lbox; } - -private: - // the popup listbox - wxListBox *m_lbox; - - //DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxComboBox) -}; - -#endif // _WX_UNIV_COMBOBOX_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/combobox.h +// Purpose: the universal combobox +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// RCS-ID: $Id: combobox.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_UNIV_COMBOBOX_H_ +#define _WX_UNIV_COMBOBOX_H_ + +#include "wx/combo.h" + +class WXDLLEXPORT wxListBox; + +// ---------------------------------------------------------------------------- +// NB: some actions supported by this control are in wx/generic/combo.h +// ---------------------------------------------------------------------------- + +// choose the next/prev/specified (by numArg) item +#define wxACTION_COMBOBOX_SELECT_NEXT _T("next") +#define wxACTION_COMBOBOX_SELECT_PREV _T("prev") +#define wxACTION_COMBOBOX_SELECT _T("select") + + +// ---------------------------------------------------------------------------- +// wxComboBox: a combination of text control and a listbox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxComboBox : public wxComboCtrl, public wxComboBoxBase +{ +public: + // ctors and such + wxComboBox() { Init(); } + + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Init(); + + (void)Create(parent, id, value, pos, size, n, choices, + style, validator, name); + } + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxComboBox(); + + // the wxUniversal-specific methods + // -------------------------------- + + // implement the combobox interface + + // wxTextCtrl methods + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + virtual bool IsEditable() const; + + virtual void Undo(); + virtual void Redo(); + virtual void SelectAll(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // wxControlWithItems methods + virtual void Clear(); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual void SetSelection(int n); + virtual int GetSelection() const; + + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + + // we have our own input handler and our own actions + // (but wxComboCtrl already handled Popup/Dismiss) + /* + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); + */ + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + +protected: + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + + // common part of all ctors + void Init(); + + // get the associated listbox + wxListBox *GetLBox() const { return m_lbox; } + +private: + // the popup listbox + wxListBox *m_lbox; + + //DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxComboBox) +}; + +#endif // _WX_UNIV_COMBOBOX_H_ diff --git a/Externals/wxWidgets/include/wx/univ/control.h b/Externals/wxWidgets/include/wx/univ/control.h index 9cc4c0c5ae..80ce526768 100644 --- a/Externals/wxWidgets/include/wx/univ/control.h +++ b/Externals/wxWidgets/include/wx/univ/control.h @@ -1,102 +1,102 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/control.h -// Purpose: universal wxControl: adds handling of mnemonics -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.08.00 -// RCS-ID: $Id: control.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_CONTROL_H_ -#define _WX_UNIV_CONTROL_H_ - -class WXDLLEXPORT wxControlRenderer; -class WXDLLEXPORT wxInputHandler; -class WXDLLEXPORT wxRenderer; - -// we must include it as most/all control classes derive their handlers from -// it -#include "wx/univ/inphand.h" - -#include "wx/univ/inpcons.h" - -// ---------------------------------------------------------------------------- -// wxControlAction: the action is currently just a string which identifies it, -// later it might become an atom (i.e. an opaque handler to string). -// ---------------------------------------------------------------------------- - -typedef wxString wxControlAction; - -// the list of actions which apply to all controls (other actions are defined -// in the controls headers) - -#define wxACTION_NONE _T("") // no action to perform - -// ---------------------------------------------------------------------------- -// wxControl: the base class for all GUI controls -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControl : public wxControlBase, public wxInputConsumer -{ -public: - wxControl() { Init(); } - - wxControl(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr) - { - Init(); - - Create(parent, id, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr); - - // this function will filter out '&' characters and will put the - // accelerator char (the one immediately after '&') into m_chAccel - virtual void SetLabel(const wxString &label); - virtual wxString GetLabel() const; - - // wxUniversal-specific methods - - // return the accel index in the string or -1 if none and puts the modified - // string intosecond parameter if non NULL - static int FindAccelIndex(const wxString& label, - wxString *labelOnly = NULL); - - // return the index of the accel char in the label or -1 if none - int GetAccelIndex() const { return m_indexAccel; } - - // return the accel char itself or 0 if none - wxChar GetAccelChar() const - { - return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel]; - } - - virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; } - -protected: - // common part of all ctors - void Init(); - -private: - // label and accel info - wxString m_label; - int m_indexAccel; - - DECLARE_DYNAMIC_CLASS(wxControl) - DECLARE_EVENT_TABLE() - WX_DECLARE_INPUT_CONSUMER() -}; - -#endif // _WX_UNIV_CONTROL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/control.h +// Purpose: universal wxControl: adds handling of mnemonics +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// RCS-ID: $Id: control.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CONTROL_H_ +#define _WX_UNIV_CONTROL_H_ + +class WXDLLEXPORT wxControlRenderer; +class WXDLLEXPORT wxInputHandler; +class WXDLLEXPORT wxRenderer; + +// we must include it as most/all control classes derive their handlers from +// it +#include "wx/univ/inphand.h" + +#include "wx/univ/inpcons.h" + +// ---------------------------------------------------------------------------- +// wxControlAction: the action is currently just a string which identifies it, +// later it might become an atom (i.e. an opaque handler to string). +// ---------------------------------------------------------------------------- + +typedef wxString wxControlAction; + +// the list of actions which apply to all controls (other actions are defined +// in the controls headers) + +#define wxACTION_NONE _T("") // no action to perform + +// ---------------------------------------------------------------------------- +// wxControl: the base class for all GUI controls +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControl : public wxControlBase, public wxInputConsumer +{ +public: + wxControl() { Init(); } + + wxControl(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr); + + // this function will filter out '&' characters and will put the + // accelerator char (the one immediately after '&') into m_chAccel + virtual void SetLabel(const wxString &label); + virtual wxString GetLabel() const; + + // wxUniversal-specific methods + + // return the accel index in the string or -1 if none and puts the modified + // string intosecond parameter if non NULL + static int FindAccelIndex(const wxString& label, + wxString *labelOnly = NULL); + + // return the index of the accel char in the label or -1 if none + int GetAccelIndex() const { return m_indexAccel; } + + // return the accel char itself or 0 if none + wxChar GetAccelChar() const + { + return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel]; + } + + virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; } + +protected: + // common part of all ctors + void Init(); + +private: + // label and accel info + wxString m_label; + int m_indexAccel; + + DECLARE_DYNAMIC_CLASS(wxControl) + DECLARE_EVENT_TABLE() + WX_DECLARE_INPUT_CONSUMER() +}; + +#endif // _WX_UNIV_CONTROL_H_ diff --git a/Externals/wxWidgets/include/wx/univ/dialog.h b/Externals/wxWidgets/include/wx/univ/dialog.h index e4b71b9ae8..9fbf2a7ecb 100644 --- a/Externals/wxWidgets/include/wx/univ/dialog.h +++ b/Externals/wxWidgets/include/wx/univ/dialog.h @@ -1,88 +1,88 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog.h -// Purpose: wxDialog class -// Author: Vaclav Slavik -// Created: 2001/09/16 -// RCS-ID: $Id: dialog.h 36891 2006-01-16 14:59:55Z MR $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_DIALOG_H_ -#define _WX_UNIV_DIALOG_H_ - -extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; -class WXDLLEXPORT wxWindowDisabler; -class WXDLLEXPORT wxEventLoop; - -// Dialog boxes -class WXDLLEXPORT wxDialog : public wxDialogBase -{ -public: - wxDialog() { Init(); } - - // Constructor with no modal flag - the new convention. - wxDialog(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Init(); - Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - - virtual ~wxDialog(); - - // is the dialog in modal state right now? - virtual bool IsModal() const; - - // For now, same as Show(true) but returns return code - virtual int ShowModal(); - - // may be called to terminate the dialog with the given return code - virtual void EndModal(int retCode); - - // returns true if we're in a modal loop - bool IsModalShowing() const; - - virtual bool Show(bool show = true); - - // implementation only from now on - // ------------------------------- - - // event handlers - void OnCloseWindow(wxCloseEvent& event); - void OnOK(wxCommandEvent& event); - void OnApply(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - -protected: - // common part of all ctors - void Init(); - -private: - // while we are showing a modal dialog we disable the other windows using - // this object - wxWindowDisabler *m_windowDisabler; - - // modal dialog runs its own event loop - wxEventLoop *m_eventLoop; - - // is modal right now? - bool m_isShowingModal; - - DECLARE_DYNAMIC_CLASS(wxDialog) - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_UNIV_DIALOG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: dialog.h +// Purpose: wxDialog class +// Author: Vaclav Slavik +// Created: 2001/09/16 +// RCS-ID: $Id: dialog.h 36891 2006-01-16 14:59:55Z MR $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_DIALOG_H_ +#define _WX_UNIV_DIALOG_H_ + +extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; +class WXDLLEXPORT wxWindowDisabler; +class WXDLLEXPORT wxEventLoop; + +// Dialog boxes +class WXDLLEXPORT wxDialog : public wxDialogBase +{ +public: + wxDialog() { Init(); } + + // Constructor with no modal flag - the new convention. + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + Init(); + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + + virtual ~wxDialog(); + + // is the dialog in modal state right now? + virtual bool IsModal() const; + + // For now, same as Show(true) but returns return code + virtual int ShowModal(); + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode); + + // returns true if we're in a modal loop + bool IsModalShowing() const; + + virtual bool Show(bool show = true); + + // implementation only from now on + // ------------------------------- + + // event handlers + void OnCloseWindow(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + +protected: + // common part of all ctors + void Init(); + +private: + // while we are showing a modal dialog we disable the other windows using + // this object + wxWindowDisabler *m_windowDisabler; + + // modal dialog runs its own event loop + wxEventLoop *m_eventLoop; + + // is modal right now? + bool m_isShowingModal; + + DECLARE_DYNAMIC_CLASS(wxDialog) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_UNIV_DIALOG_H_ diff --git a/Externals/wxWidgets/include/wx/univ/frame.h b/Externals/wxWidgets/include/wx/univ/frame.h index 41c226786d..463930f962 100644 --- a/Externals/wxWidgets/include/wx/univ/frame.h +++ b/Externals/wxWidgets/include/wx/univ/frame.h @@ -1,92 +1,92 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/frame.h -// Purpose: wxFrame class for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 19.05.01 -// RCS-ID: $Id: frame.h 42664 2006-10-29 20:39:31Z VZ $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_FRAME_H_ -#define _WX_UNIV_FRAME_H_ - -// ---------------------------------------------------------------------------- -// wxFrame -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFrame : public wxFrameBase -{ -public: - wxFrame() {} - wxFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual wxPoint GetClientAreaOrigin() const; - virtual bool Enable(bool enable = true); - -#if wxUSE_STATUSBAR - virtual wxStatusBar* CreateStatusBar(int number = 1, - long style = wxST_SIZEGRIP, - wxWindowID id = 0, - const wxString& name = wxStatusLineNameStr); -#endif // wxUSE_STATUSBAR - -#if wxUSE_TOOLBAR - // create main toolbar bycalling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID id = wxID_ANY, - const wxString& name = wxToolBarNameStr); -#endif // wxUSE_TOOLBAR - - virtual wxSize GetMinSize() const; - - // sends wxSizeEvent to itself (used after attaching xxxBar) - virtual void SendSizeEvent(); - -protected: - void OnSize(wxSizeEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int height); - -#if wxUSE_MENUS - // override to update menu bar position when the frame size changes - virtual void PositionMenuBar(); - virtual void DetachMenuBar(); - virtual void AttachMenuBar(wxMenuBar *menubar); -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - // override to update statusbar position when the frame size changes - virtual void PositionStatusBar(); -#endif // wxUSE_MENUS - -protected: -#if wxUSE_TOOLBAR - virtual void PositionToolBar(); -#endif // wxUSE_TOOLBAR - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxFrame) -}; - -#endif // _WX_UNIV_FRAME_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/frame.h +// Purpose: wxFrame class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.05.01 +// RCS-ID: $Id: frame.h 42664 2006-10-29 20:39:31Z VZ $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_FRAME_H_ +#define _WX_UNIV_FRAME_H_ + +// ---------------------------------------------------------------------------- +// wxFrame +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFrame : public wxFrameBase +{ +public: + wxFrame() {} + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual wxPoint GetClientAreaOrigin() const; + virtual bool Enable(bool enable = true); + +#if wxUSE_STATUSBAR + virtual wxStatusBar* CreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP, + wxWindowID id = 0, + const wxString& name = wxStatusLineNameStr); +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + // create main toolbar bycalling OnCreateToolBar() + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = wxID_ANY, + const wxString& name = wxToolBarNameStr); +#endif // wxUSE_TOOLBAR + + virtual wxSize GetMinSize() const; + + // sends wxSizeEvent to itself (used after attaching xxxBar) + virtual void SendSizeEvent(); + +protected: + void OnSize(wxSizeEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + +#if wxUSE_MENUS + // override to update menu bar position when the frame size changes + virtual void PositionMenuBar(); + virtual void DetachMenuBar(); + virtual void AttachMenuBar(wxMenuBar *menubar); +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // override to update statusbar position when the frame size changes + virtual void PositionStatusBar(); +#endif // wxUSE_MENUS + +protected: +#if wxUSE_TOOLBAR + virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxFrame) +}; + +#endif // _WX_UNIV_FRAME_H_ diff --git a/Externals/wxWidgets/include/wx/univ/gauge.h b/Externals/wxWidgets/include/wx/univ/gauge.h index 0b69e2661d..f7444ef286 100644 --- a/Externals/wxWidgets/include/wx/univ/gauge.h +++ b/Externals/wxWidgets/include/wx/univ/gauge.h @@ -1,75 +1,75 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/gauge.h -// Purpose: wxUniversal wxGauge declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.02.01 -// RCS-ID: $Id: gauge.h 35698 2005-09-25 20:49:40Z MW $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_GAUGE_H_ -#define _WX_UNIV_GAUGE_H_ - -// ---------------------------------------------------------------------------- -// wxGauge: a progress bar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGauge : public wxGaugeBase -{ -public: - wxGauge() { Init(); } - - wxGauge(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - Init(); - - (void)Create(parent, id, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - // implement base class virtuals - virtual void SetRange(int range); - virtual void SetValue(int pos); - - // wxUniv-specific methods - - // is it a smooth progress bar or a discrete one? - bool IsSmooth() const { return (GetWindowStyle() & wxGA_SMOOTH) != 0; } - - // is it a vertica; progress bar or a horizontal one? - bool IsVertical() const { return (GetWindowStyle() & wxGA_VERTICAL) != 0; } - -protected: - // common part of all ctors - void Init(); - - // return the def border for a progress bar - virtual wxBorder GetDefaultBorder() const; - - // return the default size - virtual wxSize DoGetBestClientSize() const; - - // draw the control - virtual void DoDraw(wxControlRenderer *renderer); - - DECLARE_DYNAMIC_CLASS(wxGauge) -}; - -#endif // _WX_UNIV_GAUGE_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/gauge.h +// Purpose: wxUniversal wxGauge declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.02.01 +// RCS-ID: $Id: gauge.h 35698 2005-09-25 20:49:40Z MW $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_GAUGE_H_ +#define _WX_UNIV_GAUGE_H_ + +// ---------------------------------------------------------------------------- +// wxGauge: a progress bar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGauge : public wxGaugeBase +{ +public: + wxGauge() { Init(); } + + wxGauge(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + Init(); + + (void)Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + // implement base class virtuals + virtual void SetRange(int range); + virtual void SetValue(int pos); + + // wxUniv-specific methods + + // is it a smooth progress bar or a discrete one? + bool IsSmooth() const { return (GetWindowStyle() & wxGA_SMOOTH) != 0; } + + // is it a vertica; progress bar or a horizontal one? + bool IsVertical() const { return (GetWindowStyle() & wxGA_VERTICAL) != 0; } + +protected: + // common part of all ctors + void Init(); + + // return the def border for a progress bar + virtual wxBorder GetDefaultBorder() const; + + // return the default size + virtual wxSize DoGetBestClientSize() const; + + // draw the control + virtual void DoDraw(wxControlRenderer *renderer); + + DECLARE_DYNAMIC_CLASS(wxGauge) +}; + +#endif // _WX_UNIV_GAUGE_H_ diff --git a/Externals/wxWidgets/include/wx/univ/inpcons.h b/Externals/wxWidgets/include/wx/univ/inpcons.h index 757bad5274..10df5ff337 100644 --- a/Externals/wxWidgets/include/wx/univ/inpcons.h +++ b/Externals/wxWidgets/include/wx/univ/inpcons.h @@ -1,153 +1,153 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/inpcons.h -// Purpose: wxInputConsumer: mix-in class for input handling -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.08.00 -// RCS-ID: $Id: inpcons.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_INPCONS_H_ -#define _WX_UNIV_INPCONS_H_ - -class WXDLLEXPORT wxInputHandler; -class WXDLLEXPORT wxWindow; - -#include "wx/object.h" -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// wxControlAction: the action is currently just a string which identifies it, -// later it might become an atom (i.e. an opaque handler to string). -// ---------------------------------------------------------------------------- - -typedef wxString wxControlAction; - -// the list of actions which apply to all controls (other actions are defined -// in the controls headers) - -#define wxACTION_NONE _T("") // no action to perform - -// ---------------------------------------------------------------------------- -// wxInputConsumer: mix-in class for handling wxControlActions (used by -// wxControl and wxTopLevelWindow). -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxInputConsumer -{ -public: - wxInputConsumer() { m_inputHandler = NULL; } - virtual ~wxInputConsumer() { } - - // get the input handler - wxInputHandler *GetInputHandler() const { return m_inputHandler; } - - // perform a control-dependent action: an action may have an optional - // numeric and another (also optional) string argument whose interpretation - // depends on the action - // - // NB: we might use ellipsis in PerformAction() declaration but this - // wouldn't be more efficient than always passing 2 unused parameters - // but would be more difficult. Another solution would be to have - // several overloaded versions but this will expose the problem of - // virtual function hiding we don't have here. - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1l, - const wxString& strArg = wxEmptyString); - - // get the window to work with (usually the class wxInputConsumer was mixed into) - virtual wxWindow *GetInputWindow() const = 0; - - // this function must be implemented in any classes process input (i.e. not - // static controls) to create the standard input handler for the concrete - // class deriving from this mix-in - // - // the parameter is the default input handler which should receive all - // unprocessed input (i.e. typically handlerDef is passed to - // wxStdInputHandler ctor) or it may be NULL - // - // the returned pointer will not be deleted by caller so it must either - // point to a static object or be deleted on program termination - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef); - - -protected: - // event handlers - void OnMouse(wxMouseEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnFocus(wxFocusEvent& event); - void OnActivate(wxActivateEvent& event); - - // create input handler by name, fall back to GetStdInputHandler() if - // the current theme doesn't define any specific handler of this type - void CreateInputHandler(const wxString& inphandler); - -private: - // the input processor (we never delete it) - wxInputHandler *m_inputHandler; -}; - - -// ---------------------------------------------------------------------------- -// macros which must be used by the classes derived from wxInputConsumer mix-in -// ---------------------------------------------------------------------------- - -// declare the methods to be forwarded -#define WX_DECLARE_INPUT_CONSUMER() \ -private: \ - void OnMouse(wxMouseEvent& event); \ - void OnKeyDown(wxKeyEvent& event); \ - void OnKeyUp(wxKeyEvent& event); \ - void OnFocus(wxFocusEvent& event); \ -public: /* because of docview :-( */ \ - void OnActivate(wxActivateEvent& event); \ -private: - -// implement the event table entries for wxControlContainer -#define WX_EVENT_TABLE_INPUT_CONSUMER(classname) \ - EVT_KEY_DOWN(classname::OnKeyDown) \ - EVT_KEY_UP(classname::OnKeyUp) \ - EVT_MOUSE_EVENTS(classname::OnMouse) \ - EVT_SET_FOCUS(classname::OnFocus) \ - EVT_KILL_FOCUS(classname::OnFocus) \ - EVT_ACTIVATE(classname::OnActivate) - -// Forward event handlers to wxInputConsumer -// -// (We can't use them directly, because wxIC has virtual methods, which forces -// the compiler to include (at least) two vtables into wxControl, one for the -// wxWindow-wxControlBase-wxControl branch and one for the wxIC mix-in. -// Consequently, the "this" pointer has different value when in wxControl's -// and wxIC's method, even though the instance stays same. This doesn't matter -// so far as member pointers aren't used, but that's not wxControl's case. -// When we add an event table entry (= use a member pointer) pointing to -// wxIC's OnXXX method, GCC compiles code that executes wxIC::OnXXX with the -// version of "this" that belongs to wxControl, not wxIC! In our particular -// case, the effect is that m_handler is NULL (probably same memory -// area as the_other_vtable's_this->m_refObj) and input handling doesn't work.) -#define WX_FORWARD_TO_INPUT_CONSUMER(classname) \ - void classname::OnMouse(wxMouseEvent& event) \ - { \ - wxInputConsumer::OnMouse(event); \ - } \ - void classname::OnKeyDown(wxKeyEvent& event) \ - { \ - wxInputConsumer::OnKeyDown(event); \ - } \ - void classname::OnKeyUp(wxKeyEvent& event) \ - { \ - wxInputConsumer::OnKeyUp(event); \ - } \ - void classname::OnFocus(wxFocusEvent& event) \ - { \ - wxInputConsumer::OnFocus(event); \ - } \ - void classname::OnActivate(wxActivateEvent& event) \ - { \ - wxInputConsumer::OnActivate(event); \ - } - -#endif // _WX_UNIV_INPCONS_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/inpcons.h +// Purpose: wxInputConsumer: mix-in class for input handling +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// RCS-ID: $Id: inpcons.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_INPCONS_H_ +#define _WX_UNIV_INPCONS_H_ + +class WXDLLEXPORT wxInputHandler; +class WXDLLEXPORT wxWindow; + +#include "wx/object.h" +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// wxControlAction: the action is currently just a string which identifies it, +// later it might become an atom (i.e. an opaque handler to string). +// ---------------------------------------------------------------------------- + +typedef wxString wxControlAction; + +// the list of actions which apply to all controls (other actions are defined +// in the controls headers) + +#define wxACTION_NONE _T("") // no action to perform + +// ---------------------------------------------------------------------------- +// wxInputConsumer: mix-in class for handling wxControlActions (used by +// wxControl and wxTopLevelWindow). +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxInputConsumer +{ +public: + wxInputConsumer() { m_inputHandler = NULL; } + virtual ~wxInputConsumer() { } + + // get the input handler + wxInputHandler *GetInputHandler() const { return m_inputHandler; } + + // perform a control-dependent action: an action may have an optional + // numeric and another (also optional) string argument whose interpretation + // depends on the action + // + // NB: we might use ellipsis in PerformAction() declaration but this + // wouldn't be more efficient than always passing 2 unused parameters + // but would be more difficult. Another solution would be to have + // several overloaded versions but this will expose the problem of + // virtual function hiding we don't have here. + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1l, + const wxString& strArg = wxEmptyString); + + // get the window to work with (usually the class wxInputConsumer was mixed into) + virtual wxWindow *GetInputWindow() const = 0; + + // this function must be implemented in any classes process input (i.e. not + // static controls) to create the standard input handler for the concrete + // class deriving from this mix-in + // + // the parameter is the default input handler which should receive all + // unprocessed input (i.e. typically handlerDef is passed to + // wxStdInputHandler ctor) or it may be NULL + // + // the returned pointer will not be deleted by caller so it must either + // point to a static object or be deleted on program termination + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef); + + +protected: + // event handlers + void OnMouse(wxMouseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnFocus(wxFocusEvent& event); + void OnActivate(wxActivateEvent& event); + + // create input handler by name, fall back to GetStdInputHandler() if + // the current theme doesn't define any specific handler of this type + void CreateInputHandler(const wxString& inphandler); + +private: + // the input processor (we never delete it) + wxInputHandler *m_inputHandler; +}; + + +// ---------------------------------------------------------------------------- +// macros which must be used by the classes derived from wxInputConsumer mix-in +// ---------------------------------------------------------------------------- + +// declare the methods to be forwarded +#define WX_DECLARE_INPUT_CONSUMER() \ +private: \ + void OnMouse(wxMouseEvent& event); \ + void OnKeyDown(wxKeyEvent& event); \ + void OnKeyUp(wxKeyEvent& event); \ + void OnFocus(wxFocusEvent& event); \ +public: /* because of docview :-( */ \ + void OnActivate(wxActivateEvent& event); \ +private: + +// implement the event table entries for wxControlContainer +#define WX_EVENT_TABLE_INPUT_CONSUMER(classname) \ + EVT_KEY_DOWN(classname::OnKeyDown) \ + EVT_KEY_UP(classname::OnKeyUp) \ + EVT_MOUSE_EVENTS(classname::OnMouse) \ + EVT_SET_FOCUS(classname::OnFocus) \ + EVT_KILL_FOCUS(classname::OnFocus) \ + EVT_ACTIVATE(classname::OnActivate) + +// Forward event handlers to wxInputConsumer +// +// (We can't use them directly, because wxIC has virtual methods, which forces +// the compiler to include (at least) two vtables into wxControl, one for the +// wxWindow-wxControlBase-wxControl branch and one for the wxIC mix-in. +// Consequently, the "this" pointer has different value when in wxControl's +// and wxIC's method, even though the instance stays same. This doesn't matter +// so far as member pointers aren't used, but that's not wxControl's case. +// When we add an event table entry (= use a member pointer) pointing to +// wxIC's OnXXX method, GCC compiles code that executes wxIC::OnXXX with the +// version of "this" that belongs to wxControl, not wxIC! In our particular +// case, the effect is that m_handler is NULL (probably same memory +// area as the_other_vtable's_this->m_refObj) and input handling doesn't work.) +#define WX_FORWARD_TO_INPUT_CONSUMER(classname) \ + void classname::OnMouse(wxMouseEvent& event) \ + { \ + wxInputConsumer::OnMouse(event); \ + } \ + void classname::OnKeyDown(wxKeyEvent& event) \ + { \ + wxInputConsumer::OnKeyDown(event); \ + } \ + void classname::OnKeyUp(wxKeyEvent& event) \ + { \ + wxInputConsumer::OnKeyUp(event); \ + } \ + void classname::OnFocus(wxFocusEvent& event) \ + { \ + wxInputConsumer::OnFocus(event); \ + } \ + void classname::OnActivate(wxActivateEvent& event) \ + { \ + wxInputConsumer::OnActivate(event); \ + } + +#endif // _WX_UNIV_INPCONS_H_ diff --git a/Externals/wxWidgets/include/wx/univ/inphand.h b/Externals/wxWidgets/include/wx/univ/inphand.h index 1b3eda04d6..2eb036898a 100644 --- a/Externals/wxWidgets/include/wx/univ/inphand.h +++ b/Externals/wxWidgets/include/wx/univ/inphand.h @@ -1,116 +1,116 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/inphand.h -// Purpose: wxInputHandler class maps the keyboard and mouse events to the -// actions which then are performed by the control -// Author: Vadim Zeitlin -// Modified by: -// Created: 18.08.00 -// RCS-ID: $Id: inphand.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_INPHAND_H_ -#define _WX_UNIV_INPHAND_H_ - -#include "wx/univ/inpcons.h" // for wxControlAction(s) - -// ---------------------------------------------------------------------------- -// types of the standard input handlers which can be passed to -// wxTheme::GetInputHandler() -// ---------------------------------------------------------------------------- - -#define wxINP_HANDLER_DEFAULT _T("") -#define wxINP_HANDLER_BUTTON _T("button") -#define wxINP_HANDLER_CHECKBOX _T("checkbox") -#define wxINP_HANDLER_CHECKLISTBOX _T("checklistbox") -#define wxINP_HANDLER_COMBOBOX _T("combobox") -#define wxINP_HANDLER_LISTBOX _T("listbox") -#define wxINP_HANDLER_NOTEBOOK _T("notebook") -#define wxINP_HANDLER_RADIOBTN _T("radiobtn") -#define wxINP_HANDLER_SCROLLBAR _T("scrollbar") -#define wxINP_HANDLER_SLIDER _T("slider") -#define wxINP_HANDLER_SPINBTN _T("spinbtn") -#define wxINP_HANDLER_STATUSBAR _T("statusbar") -#define wxINP_HANDLER_TEXTCTRL _T("textctrl") -#define wxINP_HANDLER_TOOLBAR _T("toolbar") -#define wxINP_HANDLER_TOPLEVEL _T("toplevel") - -// ---------------------------------------------------------------------------- -// wxInputHandler: maps the events to the actions -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxInputHandler : public wxObject -{ -public: - // map a keyboard event to one or more actions (pressed == true if the key - // was pressed, false if released), returns true if something was done - virtual bool HandleKey(wxInputConsumer *consumer, - const wxKeyEvent& event, - bool pressed) = 0; - - // map a mouse (click) event to one or more actions - virtual bool HandleMouse(wxInputConsumer *consumer, - const wxMouseEvent& event) = 0; - - // handle mouse movement (or enter/leave) event: it is separated from - // HandleMouse() for convenience as many controls don't care about mouse - // movements at all - virtual bool HandleMouseMove(wxInputConsumer *consumer, - const wxMouseEvent& event); - - // do something with focus set/kill event: this is different from - // HandleMouseMove() as the mouse maybe over the control without it having - // focus - // - // return true to refresh the control, false otherwise - virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event); - - // react to the app getting/losing activation - // - // return true to refresh the control, false otherwise - virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); - - // virtual dtor for any base class - virtual ~wxInputHandler(); -}; - -// ---------------------------------------------------------------------------- -// wxStdInputHandler is just a base class for all other "standard" handlers -// and also provides the way to chain input handlers together -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStdInputHandler : public wxInputHandler -{ -public: - wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { } - - virtual bool HandleKey(wxInputConsumer *consumer, - const wxKeyEvent& event, - bool pressed) - { - return m_handler ? m_handler->HandleKey(consumer, event, pressed) - : false; - } - - virtual bool HandleMouse(wxInputConsumer *consumer, - const wxMouseEvent& event) - { - return m_handler ? m_handler->HandleMouse(consumer, event) : false; - } - - virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) - { - return m_handler ? m_handler->HandleMouseMove(consumer, event) : false; - } - - virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) - { - return m_handler ? m_handler->HandleFocus(consumer, event) : false; - } - -private: - wxInputHandler *m_handler; -}; - -#endif // _WX_UNIV_INPHAND_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/inphand.h +// Purpose: wxInputHandler class maps the keyboard and mouse events to the +// actions which then are performed by the control +// Author: Vadim Zeitlin +// Modified by: +// Created: 18.08.00 +// RCS-ID: $Id: inphand.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_INPHAND_H_ +#define _WX_UNIV_INPHAND_H_ + +#include "wx/univ/inpcons.h" // for wxControlAction(s) + +// ---------------------------------------------------------------------------- +// types of the standard input handlers which can be passed to +// wxTheme::GetInputHandler() +// ---------------------------------------------------------------------------- + +#define wxINP_HANDLER_DEFAULT _T("") +#define wxINP_HANDLER_BUTTON _T("button") +#define wxINP_HANDLER_CHECKBOX _T("checkbox") +#define wxINP_HANDLER_CHECKLISTBOX _T("checklistbox") +#define wxINP_HANDLER_COMBOBOX _T("combobox") +#define wxINP_HANDLER_LISTBOX _T("listbox") +#define wxINP_HANDLER_NOTEBOOK _T("notebook") +#define wxINP_HANDLER_RADIOBTN _T("radiobtn") +#define wxINP_HANDLER_SCROLLBAR _T("scrollbar") +#define wxINP_HANDLER_SLIDER _T("slider") +#define wxINP_HANDLER_SPINBTN _T("spinbtn") +#define wxINP_HANDLER_STATUSBAR _T("statusbar") +#define wxINP_HANDLER_TEXTCTRL _T("textctrl") +#define wxINP_HANDLER_TOOLBAR _T("toolbar") +#define wxINP_HANDLER_TOPLEVEL _T("toplevel") + +// ---------------------------------------------------------------------------- +// wxInputHandler: maps the events to the actions +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxInputHandler : public wxObject +{ +public: + // map a keyboard event to one or more actions (pressed == true if the key + // was pressed, false if released), returns true if something was done + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) = 0; + + // map a mouse (click) event to one or more actions + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) = 0; + + // handle mouse movement (or enter/leave) event: it is separated from + // HandleMouse() for convenience as many controls don't care about mouse + // movements at all + virtual bool HandleMouseMove(wxInputConsumer *consumer, + const wxMouseEvent& event); + + // do something with focus set/kill event: this is different from + // HandleMouseMove() as the mouse maybe over the control without it having + // focus + // + // return true to refresh the control, false otherwise + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event); + + // react to the app getting/losing activation + // + // return true to refresh the control, false otherwise + virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); + + // virtual dtor for any base class + virtual ~wxInputHandler(); +}; + +// ---------------------------------------------------------------------------- +// wxStdInputHandler is just a base class for all other "standard" handlers +// and also provides the way to chain input handlers together +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStdInputHandler : public wxInputHandler +{ +public: + wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { } + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) + { + return m_handler ? m_handler->HandleKey(consumer, event, pressed) + : false; + } + + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) + { + return m_handler ? m_handler->HandleMouse(consumer, event) : false; + } + + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) + { + return m_handler ? m_handler->HandleMouseMove(consumer, event) : false; + } + + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) + { + return m_handler ? m_handler->HandleFocus(consumer, event) : false; + } + +private: + wxInputHandler *m_handler; +}; + +#endif // _WX_UNIV_INPHAND_H_ diff --git a/Externals/wxWidgets/include/wx/univ/listbox.h b/Externals/wxWidgets/include/wx/univ/listbox.h index cc7bc5890b..5800332f7f 100644 --- a/Externals/wxWidgets/include/wx/univ/listbox.h +++ b/Externals/wxWidgets/include/wx/univ/listbox.h @@ -1,300 +1,300 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/listbox.h -// Purpose: the universal listbox -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.08.00 -// RCS-ID: $Id: listbox.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_LISTBOX_H_ -#define _WX_UNIV_LISTBOX_H_ - -#include "wx/scrolwin.h" // for wxScrollHelper -#include "wx/dynarray.h" -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -// change the current item -#define wxACTION_LISTBOX_SETFOCUS _T("setfocus") // select the item -#define wxACTION_LISTBOX_MOVEDOWN _T("down") // select item below -#define wxACTION_LISTBOX_MOVEUP _T("up") // select item above -#define wxACTION_LISTBOX_PAGEDOWN _T("pagedown") // go page down -#define wxACTION_LISTBOX_PAGEUP _T("pageup") // go page up -#define wxACTION_LISTBOX_START _T("start") // go to first item -#define wxACTION_LISTBOX_END _T("end") // go to last item -#define wxACTION_LISTBOX_FIND _T("find") // find item by 1st letter - -// do something with the current item -#define wxACTION_LISTBOX_ACTIVATE _T("activate") // activate (choose) -#define wxACTION_LISTBOX_TOGGLE _T("toggle") // togglee selected state -#define wxACTION_LISTBOX_SELECT _T("select") // sel this, unsel others -#define wxACTION_LISTBOX_SELECTADD _T("selectadd") // add to selection -#define wxACTION_LISTBOX_UNSELECT _T("unselect") // unselect -#define wxACTION_LISTBOX_ANCHOR _T("selanchor") // anchor selection - -// do something with the selection globally (not for single selection ones) -#define wxACTION_LISTBOX_SELECTALL _T("selectall") // select all items -#define wxACTION_LISTBOX_UNSELECTALL _T("unselectall") // unselect all items -#define wxACTION_LISTBOX_SELTOGGLE _T("togglesel") // invert the selection -#define wxACTION_LISTBOX_EXTENDSEL _T("extend") // extend to item - -// ---------------------------------------------------------------------------- -// wxListBox: a list of selectable items -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxListBox : public wxListBoxBase, public wxScrollHelper -{ -public: - // ctors and such - wxListBox() : wxScrollHelper(this) { Init(); } - wxListBox(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr ) - : wxScrollHelper(this) - { - Init(); - - Create(parent, id, pos, size, n, choices, style, validator, name); - } - wxListBox(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr ); - - virtual ~wxListBox(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - // implement the listbox interface defined by wxListBoxBase - virtual void Clear(); - virtual void Delete(unsigned int n); - - virtual unsigned int GetCount() const - { return (unsigned int)m_strings->GetCount(); } - virtual wxString GetString(unsigned int n) const - { return m_strings->Item(n); } - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const - { return m_strings->Index(s, bCase); } - - virtual bool IsSelected(int n) const - { return m_selections.Index(n) != wxNOT_FOUND; } - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - -protected: - virtual void DoSetSelection(int n, bool select); - virtual int DoAppendOnly(const wxString& item); - virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); - virtual void DoSetItems(const wxArrayString& items, void **clientData); - - virtual void DoSetFirstItem(int n); - - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(unsigned int n) const; - -public: - // override some more base class methods - virtual bool SetFont(const wxFont& font); - - // the wxUniversal-specific methods - // -------------------------------- - - // the current item is the same as the selected one for wxLB_SINGLE - // listboxes but for the other ones it is just the focused item which may - // be selected or not - int GetCurrentItem() const { return m_current; } - void SetCurrentItem(int n); - - // select the item which is diff items below the current one - void ChangeCurrent(int diff); - - // activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified or - // current (if -1) item - void Activate(int item = -1); - - // select or unselect the specified or current (if -1) item - void DoSelect(int item = -1, bool sel = true); - - // more readable wrapper - void DoUnselect(int item) { DoSelect(item, false); } - - // select an item and send a notification about it - void SelectAndNotify(int item); - - // ensure that the given item is visible by scrolling it into view - virtual void EnsureVisible(int n); - - // find the first item [strictly] after the current one which starts with - // the given string and make it the current one, return true if the current - // item changed - bool FindItem(const wxString& prefix, bool strictlyAfter = false); - bool FindNextItem(const wxString& prefix) { return FindItem(prefix, true); } - - // extend the selection to span the range from the anchor (see below) to - // the specified or current item - void ExtendSelection(int itemTo = -1); - - // make this item the new selection anchor: extending selection with - // ExtendSelection() will work with it - void AnchorSelection(int itemFrom) { m_selAnchor = itemFrom; } - - // get, calculating it if necessary, the number of items per page, the - // height of each line and the max width of an item - int GetItemsPerPage() const; - wxCoord GetLineHeight() const; - wxCoord GetMaxWidth() const; - - // override the wxControl virtual methods - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0l, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - // idle processing - virtual void OnInternalIdle(); - -protected: - // geometry - virtual wxSize DoGetBestClientSize() const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - virtual void DoDraw(wxControlRenderer *renderer); - virtual wxBorder GetDefaultBorder() const; - - // common part of all ctors - void Init(); - - // event handlers - void OnSize(wxSizeEvent& event); - - // common part of Clear() and DoSetItems(): clears everything - virtual void DoClear(); - - // refresh the given item(s) or everything - void RefreshItems(int from, int count); - void RefreshItem(int n); - void RefreshFromItemToEnd(int n); - void RefreshAll(); - - // send an event of the given type (using m_current by default) - bool SendEvent(wxEventType type, int item = -1); - - // calculate the number of items per page using our current size - void CalcItemsPerPage(); - - // can/should we have a horz scrollbar? - bool HasHorzScrollbar() const - { return (m_windowStyle & wxLB_HSCROLL) != 0; } - - // redraw the items in the given range only: called from DoDraw() - virtual void DoDrawRange(wxControlRenderer *renderer, - int itemFirst, int itemLast); - - // update the scrollbars and then ensure that the item is visible - void DoEnsureVisible(int n); - - // mark horz scrollbar for updating - void RefreshHorzScrollbar(); - - // update (show/hide/adjust) the scrollbars - void UpdateScrollbars(); - - // refresh the items specified by m_updateCount and m_updateFrom - void UpdateItems(); - - // the array containing all items (it is sorted if the listbox has - // wxLB_SORT style) - wxArrayString* m_strings; - - // this array contains the indices of the selected items (for the single - // selection listboxes only the first element of it is used and contains - // the current selection) - wxArrayInt m_selections; - - // and this one the client data (either void or wxClientData) - wxArrayPtrVoid m_itemsClientData; - - // the current item - int m_current; - -private: - // the range of elements which must be updated: if m_updateCount is 0 no - // update is needed, if it is -1 everything must be updated, otherwise - // m_updateCount items starting from m_updateFrom have to be redrawn - int m_updateFrom, - m_updateCount; - - // the height of one line in the listbox (all lines have the same height) - wxCoord m_lineHeight; - - // the maximal width of a listbox item and the item which has it - wxCoord m_maxWidth; - int m_maxWidthItem; - - // the extents of horz and vert scrollbars - int m_scrollRangeX, - m_scrollRangeY; - - // the number of items per page - size_t m_itemsPerPage; - - // if the number of items has changed we may need to show/hide the - // scrollbar - bool m_updateScrollbarX, m_updateScrollbarY, - m_showScrollbarX, m_showScrollbarY; - - // if the current item has changed, we might need to scroll if it went out - // of the window - bool m_currentChanged; - - // the anchor from which the selection is extended for the listboxes with - // wxLB_EXTENDED style - this is set to the last item which was selected - // by not extending the selection but by choosing it directly - int m_selAnchor; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxListBox) -}; - -#endif // _WX_UNIV_LISTBOX_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/listbox.h +// Purpose: the universal listbox +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// RCS-ID: $Id: listbox.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_LISTBOX_H_ +#define _WX_UNIV_LISTBOX_H_ + +#include "wx/scrolwin.h" // for wxScrollHelper +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// change the current item +#define wxACTION_LISTBOX_SETFOCUS _T("setfocus") // select the item +#define wxACTION_LISTBOX_MOVEDOWN _T("down") // select item below +#define wxACTION_LISTBOX_MOVEUP _T("up") // select item above +#define wxACTION_LISTBOX_PAGEDOWN _T("pagedown") // go page down +#define wxACTION_LISTBOX_PAGEUP _T("pageup") // go page up +#define wxACTION_LISTBOX_START _T("start") // go to first item +#define wxACTION_LISTBOX_END _T("end") // go to last item +#define wxACTION_LISTBOX_FIND _T("find") // find item by 1st letter + +// do something with the current item +#define wxACTION_LISTBOX_ACTIVATE _T("activate") // activate (choose) +#define wxACTION_LISTBOX_TOGGLE _T("toggle") // togglee selected state +#define wxACTION_LISTBOX_SELECT _T("select") // sel this, unsel others +#define wxACTION_LISTBOX_SELECTADD _T("selectadd") // add to selection +#define wxACTION_LISTBOX_UNSELECT _T("unselect") // unselect +#define wxACTION_LISTBOX_ANCHOR _T("selanchor") // anchor selection + +// do something with the selection globally (not for single selection ones) +#define wxACTION_LISTBOX_SELECTALL _T("selectall") // select all items +#define wxACTION_LISTBOX_UNSELECTALL _T("unselectall") // unselect all items +#define wxACTION_LISTBOX_SELTOGGLE _T("togglesel") // invert the selection +#define wxACTION_LISTBOX_EXTENDSEL _T("extend") // extend to item + +// ---------------------------------------------------------------------------- +// wxListBox: a list of selectable items +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListBox : public wxListBoxBase, public wxScrollHelper +{ +public: + // ctors and such + wxListBox() : wxScrollHelper(this) { Init(); } + wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr ) + : wxScrollHelper(this) + { + Init(); + + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr ); + + virtual ~wxListBox(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + // implement the listbox interface defined by wxListBoxBase + virtual void Clear(); + virtual void Delete(unsigned int n); + + virtual unsigned int GetCount() const + { return (unsigned int)m_strings->GetCount(); } + virtual wxString GetString(unsigned int n) const + { return m_strings->Item(n); } + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const + { return m_strings->Index(s, bCase); } + + virtual bool IsSelected(int n) const + { return m_selections.Index(n) != wxNOT_FOUND; } + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + +protected: + virtual void DoSetSelection(int n, bool select); + virtual int DoAppendOnly(const wxString& item); + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + + virtual void DoSetFirstItem(int n); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + +public: + // override some more base class methods + virtual bool SetFont(const wxFont& font); + + // the wxUniversal-specific methods + // -------------------------------- + + // the current item is the same as the selected one for wxLB_SINGLE + // listboxes but for the other ones it is just the focused item which may + // be selected or not + int GetCurrentItem() const { return m_current; } + void SetCurrentItem(int n); + + // select the item which is diff items below the current one + void ChangeCurrent(int diff); + + // activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified or + // current (if -1) item + void Activate(int item = -1); + + // select or unselect the specified or current (if -1) item + void DoSelect(int item = -1, bool sel = true); + + // more readable wrapper + void DoUnselect(int item) { DoSelect(item, false); } + + // select an item and send a notification about it + void SelectAndNotify(int item); + + // ensure that the given item is visible by scrolling it into view + virtual void EnsureVisible(int n); + + // find the first item [strictly] after the current one which starts with + // the given string and make it the current one, return true if the current + // item changed + bool FindItem(const wxString& prefix, bool strictlyAfter = false); + bool FindNextItem(const wxString& prefix) { return FindItem(prefix, true); } + + // extend the selection to span the range from the anchor (see below) to + // the specified or current item + void ExtendSelection(int itemTo = -1); + + // make this item the new selection anchor: extending selection with + // ExtendSelection() will work with it + void AnchorSelection(int itemFrom) { m_selAnchor = itemFrom; } + + // get, calculating it if necessary, the number of items per page, the + // height of each line and the max width of an item + int GetItemsPerPage() const; + wxCoord GetLineHeight() const; + wxCoord GetMaxWidth() const; + + // override the wxControl virtual methods + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + // idle processing + virtual void OnInternalIdle(); + +protected: + // geometry + virtual wxSize DoGetBestClientSize() const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual void DoDraw(wxControlRenderer *renderer); + virtual wxBorder GetDefaultBorder() const; + + // common part of all ctors + void Init(); + + // event handlers + void OnSize(wxSizeEvent& event); + + // common part of Clear() and DoSetItems(): clears everything + virtual void DoClear(); + + // refresh the given item(s) or everything + void RefreshItems(int from, int count); + void RefreshItem(int n); + void RefreshFromItemToEnd(int n); + void RefreshAll(); + + // send an event of the given type (using m_current by default) + bool SendEvent(wxEventType type, int item = -1); + + // calculate the number of items per page using our current size + void CalcItemsPerPage(); + + // can/should we have a horz scrollbar? + bool HasHorzScrollbar() const + { return (m_windowStyle & wxLB_HSCROLL) != 0; } + + // redraw the items in the given range only: called from DoDraw() + virtual void DoDrawRange(wxControlRenderer *renderer, + int itemFirst, int itemLast); + + // update the scrollbars and then ensure that the item is visible + void DoEnsureVisible(int n); + + // mark horz scrollbar for updating + void RefreshHorzScrollbar(); + + // update (show/hide/adjust) the scrollbars + void UpdateScrollbars(); + + // refresh the items specified by m_updateCount and m_updateFrom + void UpdateItems(); + + // the array containing all items (it is sorted if the listbox has + // wxLB_SORT style) + wxArrayString* m_strings; + + // this array contains the indices of the selected items (for the single + // selection listboxes only the first element of it is used and contains + // the current selection) + wxArrayInt m_selections; + + // and this one the client data (either void or wxClientData) + wxArrayPtrVoid m_itemsClientData; + + // the current item + int m_current; + +private: + // the range of elements which must be updated: if m_updateCount is 0 no + // update is needed, if it is -1 everything must be updated, otherwise + // m_updateCount items starting from m_updateFrom have to be redrawn + int m_updateFrom, + m_updateCount; + + // the height of one line in the listbox (all lines have the same height) + wxCoord m_lineHeight; + + // the maximal width of a listbox item and the item which has it + wxCoord m_maxWidth; + int m_maxWidthItem; + + // the extents of horz and vert scrollbars + int m_scrollRangeX, + m_scrollRangeY; + + // the number of items per page + size_t m_itemsPerPage; + + // if the number of items has changed we may need to show/hide the + // scrollbar + bool m_updateScrollbarX, m_updateScrollbarY, + m_showScrollbarX, m_showScrollbarY; + + // if the current item has changed, we might need to scroll if it went out + // of the window + bool m_currentChanged; + + // the anchor from which the selection is extended for the listboxes with + // wxLB_EXTENDED style - this is set to the last item which was selected + // by not extending the selection but by choosing it directly + int m_selAnchor; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxListBox) +}; + +#endif // _WX_UNIV_LISTBOX_H_ diff --git a/Externals/wxWidgets/include/wx/univ/menu.h b/Externals/wxWidgets/include/wx/univ/menu.h index 440a873b22..4b18ec46ba 100644 --- a/Externals/wxWidgets/include/wx/univ/menu.h +++ b/Externals/wxWidgets/include/wx/univ/menu.h @@ -1,282 +1,282 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/menu.h -// Purpose: wxMenu and wxMenuBar classes for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.05.01 -// RCS-ID: $Id: menu.h 48053 2007-08-13 17:07:01Z JS $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_MENU_H_ -#define _WX_UNIV_MENU_H_ - -#if wxUSE_ACCEL - #include "wx/accel.h" -#endif // wxUSE_ACCEL - -#include "wx/dynarray.h" - -// fwd declarations -class WXDLLEXPORT wxMenuInfo; -WX_DECLARE_EXPORTED_OBJARRAY(wxMenuInfo, wxMenuInfoArray); - -class WXDLLEXPORT wxMenuGeometryInfo; -class WXDLLEXPORT wxPopupMenuWindow; -class WXDLLEXPORT wxRenderer; - -// ---------------------------------------------------------------------------- -// wxMenu -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenu : public wxMenuBase -{ -public: - // ctors and dtor - wxMenu(const wxString& title, long style = 0) - : wxMenuBase(title, style) { Init(); } - - wxMenu(long style = 0) : wxMenuBase(style) { Init(); } - - virtual ~wxMenu(); - - // called by wxMenuItem when an item of this menu changes - void RefreshItem(wxMenuItem *item); - - // does the menu have any items? - bool IsEmpty() const { return !GetMenuItems().GetFirst(); } - - // show this menu at the given position (in screen coords) and optionally - // select its first item - void Popup(const wxPoint& pos, const wxSize& size, - bool selectFirst = true); - - // dismiss the menu - void Dismiss(); - - // override the base class methods to connect/disconnect event handlers - virtual void Attach(wxMenuBarBase *menubar); - virtual void Detach(); - - // implementation only from here - - // do as if this item were clicked, return true if the resulting event was - // processed, false otherwise - bool ClickItem(wxMenuItem *item); - - // process the key event, return true if done - bool ProcessKeyDown(int key); - -#if wxUSE_ACCEL - // find the item for the given accel and generate an event if found - bool ProcessAccelEvent(const wxKeyEvent& event); -#endif // wxUSE_ACCEL - -protected: - // implement base class virtuals - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem* DoRemove(wxMenuItem *item); - - // common part of DoAppend and DoInsert - void OnItemAdded(wxMenuItem *item); - - // called by wxPopupMenuWindow when the window is hidden - void OnDismiss(bool dismissParent); - - // return true if the menu is currently shown on screen - bool IsShown() const; - - // get the menu geometry info - const wxMenuGeometryInfo& GetGeometryInfo() const; - - // forget old menu geometry info - void InvalidateGeometryInfo(); - - // return either the menubar or the invoking window, normally never NULL - wxWindow *GetRootWindow() const; - - // get the renderer we use for drawing: either the one of the menu bar or - // the one of the window if we're a popup menu - wxRenderer *GetRenderer() const; - -#if wxUSE_ACCEL - // add/remove accel for the given menu item - void AddAccelFor(wxMenuItem *item); - void RemoveAccelFor(wxMenuItem *item); -#endif // wxUSE_ACCEL - -private: - // common part of all ctors - void Init(); - - // terminate the current radio group, if any - void EndRadioGroup(); - - // the exact menu geometry is defined by a struct derived from this one - // which is opaque and defined by the renderer - wxMenuGeometryInfo *m_geometry; - - // the menu shown on screen or NULL if not currently shown - wxPopupMenuWindow *m_popupMenu; - -#if wxUSE_ACCEL - // the accel table for this menu - wxAcceleratorTable m_accelTable; -#endif // wxUSE_ACCEL - - // the position of the first item in the current radio group or -1 - int m_startRadioGroup; - - // it calls out OnDismiss() - friend class wxPopupMenuWindow; - DECLARE_DYNAMIC_CLASS(wxMenu) -}; - -// ---------------------------------------------------------------------------- -// wxMenuBar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuBar : public wxMenuBarBase -{ -public: - // ctors and dtor - wxMenuBar(long WXUNUSED(style) = 0) { Init(); } - wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); - virtual ~wxMenuBar(); - - // implement base class virtuals - virtual bool Append( wxMenu *menu, const wxString &title ); - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Remove(size_t pos); - - virtual void EnableTop(size_t pos, bool enable); - virtual bool IsEnabledTop(size_t pos) const; - - virtual void SetLabelTop(size_t pos, const wxString& label); - virtual wxString GetLabelTop(size_t pos) const; - - virtual void Attach(wxFrame *frame); - virtual void Detach(); - - // get the next item for the givan accel letter (used by wxFrame), return - // -1 if none - // - // if unique is not NULL, filled with true if there is only one item with - // this accel, false if two or more - int FindNextItemForAccel(int idxStart, - int keycode, - bool *unique = NULL) const; - - // called by wxFrame to set focus to or open the given menu - void SelectMenu(size_t pos); - void PopupMenu(size_t pos); - -#if wxUSE_ACCEL - // find the item for the given accel and generate an event if found - bool ProcessAccelEvent(const wxKeyEvent& event); -#endif // wxUSE_ACCEL - - // called by wxMenu when it is dismissed - void OnDismissMenu(bool dismissMenuBar = false); - -protected: - // common part of all ctors - void Init(); - - // event handlers - void OnLeftDown(wxMouseEvent& event); - void OnMouseMove(wxMouseEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKillFocus(wxFocusEvent& event); - - // process the mouse move event, return true if we did, false to continue - // processing as usual - // - // the coordinates are client coordinates of menubar, convert if necessary - bool ProcessMouseEvent(const wxPoint& pt); - - // called when the menu bar loses mouse capture - it is not hidden unlike - // menus, but it doesn't have modal status any longer - void OnDismiss(); - - // draw the menubar - virtual void DoDraw(wxControlRenderer *renderer); - - // menubar geometry - virtual wxSize DoGetBestClientSize() const; - - // has the menubar been created already? - bool IsCreated() const { return m_frameLast != NULL; } - - // "fast" version of GetMenuCount() - size_t GetCount() const { return m_menuInfos.GetCount(); } - - // get the (total) width of the specified menu - wxCoord GetItemWidth(size_t pos) const; - - // get the rect of the item - wxRect GetItemRect(size_t pos) const; - - // get the menu from the given point or -1 if none - int GetMenuFromPoint(const wxPoint& pos) const; - - // refresh the given item - void RefreshItem(size_t pos); - - // refresh all items after this one (including it) - void RefreshAllItemsAfter(size_t pos); - - // hide the currently shown menu and show this one - void DoSelectMenu(size_t pos); - - // popup the currently selected menu - void PopupCurrentMenu(bool selectFirst = true); - - // hide the currently selected menu - void DismissMenu(); - - // do we show a menu currently? - bool IsShowingMenu() const { return m_menuShown != 0; } - - // we don't want to have focus except while selecting from menu - void GiveAwayFocus(); - - // Release the mouse capture if we have it - bool ReleaseMouseCapture(); - - // the array containing extra menu info we need - wxMenuInfoArray m_menuInfos; - - // the current item (only used when menubar has focus) - int m_current; - -private: - // the last frame to which we were attached, NULL initially - wxFrame *m_frameLast; - - // the currently shown menu or NULL - wxMenu *m_menuShown; - - // should be showing the menu? this is subtly different from m_menuShown != - // NULL as the menu which should be shown may be disabled in which case we - // don't show it - but will do as soon as the focus shifts to another menu - bool m_shouldShowMenu; - - // it calls out ProcessMouseEvent() - friend class wxPopupMenuWindow; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMenuBar) - -public: - -#if wxABI_VERSION >= 20805 - // Gets the original label at the top-level of the menubar - wxString GetMenuLabel(size_t pos) const; -#endif -}; - -#endif // _WX_UNIV_MENU_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/menu.h +// Purpose: wxMenu and wxMenuBar classes for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.05.01 +// RCS-ID: $Id: menu.h 48053 2007-08-13 17:07:01Z JS $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_MENU_H_ +#define _WX_UNIV_MENU_H_ + +#if wxUSE_ACCEL + #include "wx/accel.h" +#endif // wxUSE_ACCEL + +#include "wx/dynarray.h" + +// fwd declarations +class WXDLLEXPORT wxMenuInfo; +WX_DECLARE_EXPORTED_OBJARRAY(wxMenuInfo, wxMenuInfoArray); + +class WXDLLEXPORT wxMenuGeometryInfo; +class WXDLLEXPORT wxPopupMenuWindow; +class WXDLLEXPORT wxRenderer; + +// ---------------------------------------------------------------------------- +// wxMenu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenu : public wxMenuBase +{ +public: + // ctors and dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + // called by wxMenuItem when an item of this menu changes + void RefreshItem(wxMenuItem *item); + + // does the menu have any items? + bool IsEmpty() const { return !GetMenuItems().GetFirst(); } + + // show this menu at the given position (in screen coords) and optionally + // select its first item + void Popup(const wxPoint& pos, const wxSize& size, + bool selectFirst = true); + + // dismiss the menu + void Dismiss(); + + // override the base class methods to connect/disconnect event handlers + virtual void Attach(wxMenuBarBase *menubar); + virtual void Detach(); + + // implementation only from here + + // do as if this item were clicked, return true if the resulting event was + // processed, false otherwise + bool ClickItem(wxMenuItem *item); + + // process the key event, return true if done + bool ProcessKeyDown(int key); + +#if wxUSE_ACCEL + // find the item for the given accel and generate an event if found + bool ProcessAccelEvent(const wxKeyEvent& event); +#endif // wxUSE_ACCEL + +protected: + // implement base class virtuals + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + + // common part of DoAppend and DoInsert + void OnItemAdded(wxMenuItem *item); + + // called by wxPopupMenuWindow when the window is hidden + void OnDismiss(bool dismissParent); + + // return true if the menu is currently shown on screen + bool IsShown() const; + + // get the menu geometry info + const wxMenuGeometryInfo& GetGeometryInfo() const; + + // forget old menu geometry info + void InvalidateGeometryInfo(); + + // return either the menubar or the invoking window, normally never NULL + wxWindow *GetRootWindow() const; + + // get the renderer we use for drawing: either the one of the menu bar or + // the one of the window if we're a popup menu + wxRenderer *GetRenderer() const; + +#if wxUSE_ACCEL + // add/remove accel for the given menu item + void AddAccelFor(wxMenuItem *item); + void RemoveAccelFor(wxMenuItem *item); +#endif // wxUSE_ACCEL + +private: + // common part of all ctors + void Init(); + + // terminate the current radio group, if any + void EndRadioGroup(); + + // the exact menu geometry is defined by a struct derived from this one + // which is opaque and defined by the renderer + wxMenuGeometryInfo *m_geometry; + + // the menu shown on screen or NULL if not currently shown + wxPopupMenuWindow *m_popupMenu; + +#if wxUSE_ACCEL + // the accel table for this menu + wxAcceleratorTable m_accelTable; +#endif // wxUSE_ACCEL + + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + + // it calls out OnDismiss() + friend class wxPopupMenuWindow; + DECLARE_DYNAMIC_CLASS(wxMenu) +}; + +// ---------------------------------------------------------------------------- +// wxMenuBar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuBar : public wxMenuBarBase +{ +public: + // ctors and dtor + wxMenuBar(long WXUNUSED(style) = 0) { Init(); } + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + virtual ~wxMenuBar(); + + // implement base class virtuals + virtual bool Append( wxMenu *menu, const wxString &title ); + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Remove(size_t pos); + + virtual void EnableTop(size_t pos, bool enable); + virtual bool IsEnabledTop(size_t pos) const; + + virtual void SetLabelTop(size_t pos, const wxString& label); + virtual wxString GetLabelTop(size_t pos) const; + + virtual void Attach(wxFrame *frame); + virtual void Detach(); + + // get the next item for the givan accel letter (used by wxFrame), return + // -1 if none + // + // if unique is not NULL, filled with true if there is only one item with + // this accel, false if two or more + int FindNextItemForAccel(int idxStart, + int keycode, + bool *unique = NULL) const; + + // called by wxFrame to set focus to or open the given menu + void SelectMenu(size_t pos); + void PopupMenu(size_t pos); + +#if wxUSE_ACCEL + // find the item for the given accel and generate an event if found + bool ProcessAccelEvent(const wxKeyEvent& event); +#endif // wxUSE_ACCEL + + // called by wxMenu when it is dismissed + void OnDismissMenu(bool dismissMenuBar = false); + +protected: + // common part of all ctors + void Init(); + + // event handlers + void OnLeftDown(wxMouseEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKillFocus(wxFocusEvent& event); + + // process the mouse move event, return true if we did, false to continue + // processing as usual + // + // the coordinates are client coordinates of menubar, convert if necessary + bool ProcessMouseEvent(const wxPoint& pt); + + // called when the menu bar loses mouse capture - it is not hidden unlike + // menus, but it doesn't have modal status any longer + void OnDismiss(); + + // draw the menubar + virtual void DoDraw(wxControlRenderer *renderer); + + // menubar geometry + virtual wxSize DoGetBestClientSize() const; + + // has the menubar been created already? + bool IsCreated() const { return m_frameLast != NULL; } + + // "fast" version of GetMenuCount() + size_t GetCount() const { return m_menuInfos.GetCount(); } + + // get the (total) width of the specified menu + wxCoord GetItemWidth(size_t pos) const; + + // get the rect of the item + wxRect GetItemRect(size_t pos) const; + + // get the menu from the given point or -1 if none + int GetMenuFromPoint(const wxPoint& pos) const; + + // refresh the given item + void RefreshItem(size_t pos); + + // refresh all items after this one (including it) + void RefreshAllItemsAfter(size_t pos); + + // hide the currently shown menu and show this one + void DoSelectMenu(size_t pos); + + // popup the currently selected menu + void PopupCurrentMenu(bool selectFirst = true); + + // hide the currently selected menu + void DismissMenu(); + + // do we show a menu currently? + bool IsShowingMenu() const { return m_menuShown != 0; } + + // we don't want to have focus except while selecting from menu + void GiveAwayFocus(); + + // Release the mouse capture if we have it + bool ReleaseMouseCapture(); + + // the array containing extra menu info we need + wxMenuInfoArray m_menuInfos; + + // the current item (only used when menubar has focus) + int m_current; + +private: + // the last frame to which we were attached, NULL initially + wxFrame *m_frameLast; + + // the currently shown menu or NULL + wxMenu *m_menuShown; + + // should be showing the menu? this is subtly different from m_menuShown != + // NULL as the menu which should be shown may be disabled in which case we + // don't show it - but will do as soon as the focus shifts to another menu + bool m_shouldShowMenu; + + // it calls out ProcessMouseEvent() + friend class wxPopupMenuWindow; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxMenuBar) + +public: + +#if wxABI_VERSION >= 20805 + // Gets the original label at the top-level of the menubar + wxString GetMenuLabel(size_t pos) const; +#endif +}; + +#endif // _WX_UNIV_MENU_H_ diff --git a/Externals/wxWidgets/include/wx/univ/menuitem.h b/Externals/wxWidgets/include/wx/univ/menuitem.h index c37c902e2d..c9020ec021 100644 --- a/Externals/wxWidgets/include/wx/univ/menuitem.h +++ b/Externals/wxWidgets/include/wx/univ/menuitem.h @@ -1,135 +1,135 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/menuitem.h -// Purpose: wxMenuItem class for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.05.01 -// RCS-ID: $Id: menuitem.h 48053 2007-08-13 17:07:01Z JS $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_MENUITEM_H_ -#define _WX_UNIV_MENUITEM_H_ - -// ---------------------------------------------------------------------------- -// wxMenuItem implements wxMenuItemBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxMenuItem : public wxMenuItemBase -{ -public: - // ctor & dtor - wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, - int id = wxID_SEPARATOR, - const wxString& name = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = (wxMenu *)NULL); - virtual ~wxMenuItem(); - - // override base class virtuals to update the item appearance on screen - virtual void SetText(const wxString& text); - virtual void SetCheckable(bool checkable); - - virtual void Enable(bool enable = true); - virtual void Check(bool check = true); - - // we add some extra functions which are also available under MSW from - // wxOwnerDrawn class - they will be moved to wxMenuItemBase later - // hopefully - void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap); - void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); } - const wxBitmap& GetBitmap(bool checked = true) const - { return checked ? m_bmpChecked : m_bmpUnchecked; } - - void SetDisabledBitmap( const wxBitmap& bmpDisabled ) - { m_bmpDisabled = bmpDisabled; } - const wxBitmap& GetDisabledBitmap() const - { return m_bmpDisabled; } - - // mark item as belonging to the given radio group - void SetAsRadioGroupStart(); - void SetRadioGroupStart(int start); - void SetRadioGroupEnd(int end); - - // wxUniv-specific methods for implementation only starting from here - - // get the accel index of our label or -1 if none - int GetAccelIndex() const { return m_indexAccel; } - - // get the accel string (displayed to the right of the label) - const wxString& GetAccelString() const { return m_strAccel; } - - // set/get the y coord and the height of this item: note that it must be - // set first and retrieved later, the item doesn't calculate it itself - void SetGeometry(wxCoord y, wxCoord height) - { - m_posY = y; - m_height = height; - } - - wxCoord GetPosition() const - { - wxASSERT_MSG( m_posY != wxDefaultCoord, _T("must call SetHeight first!") ); - - return m_posY; - } - - wxCoord GetHeight() const - { - wxASSERT_MSG( m_height != wxDefaultCoord, _T("must call SetHeight first!") ); - - return m_height; - } - -protected: - // notify the menu about the change in this item - inline void NotifyMenu(); - - // set the accel index and string from text - void UpdateAccelInfo(); - - // the bitmaps (may be invalid, then they're not used) - wxBitmap m_bmpChecked, - m_bmpUnchecked, - m_bmpDisabled; - - // the positions of the first and last items of the radio group this item - // belongs to or -1: start is the radio group start and is valid for all - // but first radio group items (m_isRadioGroupStart == false), end is valid - // only for the first one - union - { - int start; - int end; - } m_radioGroup; - - // does this item start a radio group? - bool m_isRadioGroupStart; - - // the position of the accelerator in our label, -1 if none - int m_indexAccel; - - // the accel string (i.e. "Ctrl-Q" or "Alt-F1") - wxString m_strAccel; - - // the position and height of the displayed item - wxCoord m_posY, - m_height; - -private: - DECLARE_DYNAMIC_CLASS(wxMenuItem) - -public: - -#if wxABI_VERSION >= 20805 - // return the item label including any mnemonics and accelerators. - // This used to be called GetText. - wxString GetItemLabel() const { return GetText(); } -#endif -}; - -#endif // _WX_UNIV_MENUITEM_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/menuitem.h +// Purpose: wxMenuItem class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.05.01 +// RCS-ID: $Id: menuitem.h 48053 2007-08-13 17:07:01Z JS $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_MENUITEM_H_ +#define _WX_UNIV_MENUITEM_H_ + +// ---------------------------------------------------------------------------- +// wxMenuItem implements wxMenuItemBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuItem : public wxMenuItemBase +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = (wxMenu *)NULL); + virtual ~wxMenuItem(); + + // override base class virtuals to update the item appearance on screen + virtual void SetText(const wxString& text); + virtual void SetCheckable(bool checkable); + + virtual void Enable(bool enable = true); + virtual void Check(bool check = true); + + // we add some extra functions which are also available under MSW from + // wxOwnerDrawn class - they will be moved to wxMenuItemBase later + // hopefully + void SetBitmaps(const wxBitmap& bmpChecked, + const wxBitmap& bmpUnchecked = wxNullBitmap); + void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); } + const wxBitmap& GetBitmap(bool checked = true) const + { return checked ? m_bmpChecked : m_bmpUnchecked; } + + void SetDisabledBitmap( const wxBitmap& bmpDisabled ) + { m_bmpDisabled = bmpDisabled; } + const wxBitmap& GetDisabledBitmap() const + { return m_bmpDisabled; } + + // mark item as belonging to the given radio group + void SetAsRadioGroupStart(); + void SetRadioGroupStart(int start); + void SetRadioGroupEnd(int end); + + // wxUniv-specific methods for implementation only starting from here + + // get the accel index of our label or -1 if none + int GetAccelIndex() const { return m_indexAccel; } + + // get the accel string (displayed to the right of the label) + const wxString& GetAccelString() const { return m_strAccel; } + + // set/get the y coord and the height of this item: note that it must be + // set first and retrieved later, the item doesn't calculate it itself + void SetGeometry(wxCoord y, wxCoord height) + { + m_posY = y; + m_height = height; + } + + wxCoord GetPosition() const + { + wxASSERT_MSG( m_posY != wxDefaultCoord, _T("must call SetHeight first!") ); + + return m_posY; + } + + wxCoord GetHeight() const + { + wxASSERT_MSG( m_height != wxDefaultCoord, _T("must call SetHeight first!") ); + + return m_height; + } + +protected: + // notify the menu about the change in this item + inline void NotifyMenu(); + + // set the accel index and string from text + void UpdateAccelInfo(); + + // the bitmaps (may be invalid, then they're not used) + wxBitmap m_bmpChecked, + m_bmpUnchecked, + m_bmpDisabled; + + // the positions of the first and last items of the radio group this item + // belongs to or -1: start is the radio group start and is valid for all + // but first radio group items (m_isRadioGroupStart == false), end is valid + // only for the first one + union + { + int start; + int end; + } m_radioGroup; + + // does this item start a radio group? + bool m_isRadioGroupStart; + + // the position of the accelerator in our label, -1 if none + int m_indexAccel; + + // the accel string (i.e. "Ctrl-Q" or "Alt-F1") + wxString m_strAccel; + + // the position and height of the displayed item + wxCoord m_posY, + m_height; + +private: + DECLARE_DYNAMIC_CLASS(wxMenuItem) + +public: + +#if wxABI_VERSION >= 20805 + // return the item label including any mnemonics and accelerators. + // This used to be called GetText. + wxString GetItemLabel() const { return GetText(); } +#endif +}; + +#endif // _WX_UNIV_MENUITEM_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/notebook.h b/Externals/wxWidgets/include/wx/univ/notebook.h index b87de872e0..f195c6cec4 100644 --- a/Externals/wxWidgets/include/wx/univ/notebook.h +++ b/Externals/wxWidgets/include/wx/univ/notebook.h @@ -1,257 +1,257 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/notebook.h -// Purpose: universal version of wxNotebook -// Author: Vadim Zeitlin -// Modified by: -// Created: 01.02.01 -// RCS-ID: $Id: notebook.h 41738 2006-10-08 17:37:23Z VZ $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_NOTEBOOK_H_ -#define _WX_UNIV_NOTEBOOK_H_ - -#include "wx/arrstr.h" - -class WXDLLEXPORT wxSpinButton; - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -// change the page: to the next/previous/given one -#define wxACTION_NOTEBOOK_NEXT _T("nexttab") -#define wxACTION_NOTEBOOK_PREV _T("prevtab") -#define wxACTION_NOTEBOOK_GOTO _T("gototab") - -// ---------------------------------------------------------------------------- -// wxNotebook -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxNotebook : public wxNotebookBase -{ -public: - // ctors and such - // -------------- - - wxNotebook() { Init(); } - - wxNotebook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // quasi ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - - // dtor - virtual ~wxNotebook(); - - // implement wxNotebookBase pure virtuals - // -------------------------------------- - - virtual int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } - virtual int GetSelection() const { return (int) m_sel; } - - // changes selected page without sending events - int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } - - virtual bool SetPageText(size_t nPage, const wxString& strText); - virtual wxString GetPageText(size_t nPage) const; - - virtual int GetPageImage(size_t nPage) const; - virtual bool SetPageImage(size_t nPage, int nImage); - - virtual void SetPageSize(const wxSize& size); - virtual void SetPadding(const wxSize& padding); - virtual void SetTabSize(const wxSize& sz); - - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - - virtual bool DeleteAllPages(); - - virtual bool InsertPage(size_t nPage, - wxNotebookPage *pPage, - const wxString& strText, - bool bSelect = false, - int imageId = -1); - - // style tests - // ----------- - - // return true if all tabs have the same width - bool FixedSizeTabs() const { return HasFlag(wxNB_FIXEDWIDTH); } - - // return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT - wxDirection GetTabOrientation() const; - - // return true if the notebook has tabs at the sidesand not at the top (or - // bottom) as usual - bool IsVertical() const; - - // hit testing - // ----------- - - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - - // input handling - // -------------- - - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0l, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - // refresh the currently selected tab - void RefreshCurrent(); - -protected: - virtual wxNotebookPage *DoRemovePage(size_t nPage); - - // drawing - virtual void DoDraw(wxControlRenderer *renderer); - void DoDrawTab(wxDC& dc, const wxRect& rect, size_t n); - - // resizing - virtual wxSize DoGetBestClientSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - int DoSetSelection(size_t nPage, int flags = 0); - - // common part of all ctors - void Init(); - - // resize the tab to fit its title (and icon if any) - void ResizeTab(int page); - - // recalculate the geometry of the notebook completely - void Relayout(); - - // is the spin button currently shown? - bool HasSpinBtn() const; - - // calculate last (fully) visible tab: updates m_lastVisible - void CalcLastVisibleTab(); - - // show or hide the spin control for tabs scrolling depending on whether it - // is needed or not - void UpdateSpinBtn(); - - // position the spin button - void PositionSpinBtn(); - - // refresh the given tab only - void RefreshTab(int page, bool forceSelected = false); - - // refresh all tabs - void RefreshAllTabs(); - - // get the tab rect (inefficient, don't use this in a loop) - wxRect GetTabRect(int page) const; - - // get the rectangle containing all tabs - wxRect GetAllTabsRect() const; - - // get the part occupied by the tabs - slightly smaller than - // GetAllTabsRect() because the tabs may be indented from it - wxRect GetTabsPart() const; - - // calculate the tab size (without padding) - wxSize CalcTabSize(int page) const; - - // get the (cached) size of a tab - void GetTabSize(int page, wxCoord *w, wxCoord *h) const; - - // get the (cached) width of the tab - wxCoord GetTabWidth(int page) const - { return FixedSizeTabs() ? m_widthMax : m_widths[page]; } - - // return true if the tab has an associated image - bool HasImage(int page) const - { return m_imageList && m_images[page] != -1; } - - // get the part of the notebook reserved for the pages (slightly larger - // than GetPageRect() as we draw a border and leave marginin between) - wxRect GetPagePart() const; - - // get the page rect in our client coords - wxRect GetPageRect() const; - - // get our client size from the page size - wxSize GetSizeForPage(const wxSize& size) const; - - // scroll the tabs so that the first page shown becomes the given one - void ScrollTo(int page); - - // scroll the tabs so that the first page shown becomes the given one - void ScrollLastTo(int page); - - // the pages titles - wxArrayString m_titles; - - // the current selection - size_t m_sel; - - // the spin button to change the pages - wxSpinButton *m_spinbtn; - - // the offset of the first page shown (may be changed with m_spinbtn) - wxCoord m_offset; - - // the first and last currently visible tabs: the name is not completely - // accurate as m_lastVisible is, in fact, the first tab which is *not* - // visible: so the visible tabs are those with indexes such that - // m_firstVisible <= n < m_lastVisible - size_t m_firstVisible, - m_lastVisible; - - // the last fully visible item, usually just m_lastVisible - 1 but may be - // different from it - size_t m_lastFullyVisible; - - // the height of tabs in a normal notebook or the width of tabs in a - // notebook with tabs on a side - wxCoord m_heightTab; - - // the biggest height (or width) of a notebook tab (used only if - // FixedSizeTabs()) or -1 if not calculated yet - wxCoord m_widthMax; - - // the cached widths (or heights) of tabs - wxArrayInt m_widths; - - // the icon indices - wxArrayInt m_images; - - // the accel indexes for labels - wxArrayInt m_accels; - - // the padding - wxSize m_sizePad; - - DECLARE_DYNAMIC_CLASS(wxNotebook) -}; - -#endif // _WX_UNIV_NOTEBOOK_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/notebook.h +// Purpose: universal version of wxNotebook +// Author: Vadim Zeitlin +// Modified by: +// Created: 01.02.01 +// RCS-ID: $Id: notebook.h 41738 2006-10-08 17:37:23Z VZ $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_NOTEBOOK_H_ +#define _WX_UNIV_NOTEBOOK_H_ + +#include "wx/arrstr.h" + +class WXDLLEXPORT wxSpinButton; + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// change the page: to the next/previous/given one +#define wxACTION_NOTEBOOK_NEXT _T("nexttab") +#define wxACTION_NOTEBOOK_PREV _T("prevtab") +#define wxACTION_NOTEBOOK_GOTO _T("gototab") + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNotebook : public wxNotebookBase +{ +public: + // ctors and such + // -------------- + + wxNotebook() { Init(); } + + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr); + + // dtor + virtual ~wxNotebook(); + + // implement wxNotebookBase pure virtuals + // -------------------------------------- + + virtual int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } + virtual int GetSelection() const { return (int) m_sel; } + + // changes selected page without sending events + int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } + + virtual bool SetPageText(size_t nPage, const wxString& strText); + virtual wxString GetPageText(size_t nPage) const; + + virtual int GetPageImage(size_t nPage) const; + virtual bool SetPageImage(size_t nPage, int nImage); + + virtual void SetPageSize(const wxSize& size); + virtual void SetPadding(const wxSize& padding); + virtual void SetTabSize(const wxSize& sz); + + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + virtual bool DeleteAllPages(); + + virtual bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = -1); + + // style tests + // ----------- + + // return true if all tabs have the same width + bool FixedSizeTabs() const { return HasFlag(wxNB_FIXEDWIDTH); } + + // return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT + wxDirection GetTabOrientation() const; + + // return true if the notebook has tabs at the sidesand not at the top (or + // bottom) as usual + bool IsVertical() const; + + // hit testing + // ----------- + + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + + // input handling + // -------------- + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + // refresh the currently selected tab + void RefreshCurrent(); + +protected: + virtual wxNotebookPage *DoRemovePage(size_t nPage); + + // drawing + virtual void DoDraw(wxControlRenderer *renderer); + void DoDrawTab(wxDC& dc, const wxRect& rect, size_t n); + + // resizing + virtual wxSize DoGetBestClientSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + int DoSetSelection(size_t nPage, int flags = 0); + + // common part of all ctors + void Init(); + + // resize the tab to fit its title (and icon if any) + void ResizeTab(int page); + + // recalculate the geometry of the notebook completely + void Relayout(); + + // is the spin button currently shown? + bool HasSpinBtn() const; + + // calculate last (fully) visible tab: updates m_lastVisible + void CalcLastVisibleTab(); + + // show or hide the spin control for tabs scrolling depending on whether it + // is needed or not + void UpdateSpinBtn(); + + // position the spin button + void PositionSpinBtn(); + + // refresh the given tab only + void RefreshTab(int page, bool forceSelected = false); + + // refresh all tabs + void RefreshAllTabs(); + + // get the tab rect (inefficient, don't use this in a loop) + wxRect GetTabRect(int page) const; + + // get the rectangle containing all tabs + wxRect GetAllTabsRect() const; + + // get the part occupied by the tabs - slightly smaller than + // GetAllTabsRect() because the tabs may be indented from it + wxRect GetTabsPart() const; + + // calculate the tab size (without padding) + wxSize CalcTabSize(int page) const; + + // get the (cached) size of a tab + void GetTabSize(int page, wxCoord *w, wxCoord *h) const; + + // get the (cached) width of the tab + wxCoord GetTabWidth(int page) const + { return FixedSizeTabs() ? m_widthMax : m_widths[page]; } + + // return true if the tab has an associated image + bool HasImage(int page) const + { return m_imageList && m_images[page] != -1; } + + // get the part of the notebook reserved for the pages (slightly larger + // than GetPageRect() as we draw a border and leave marginin between) + wxRect GetPagePart() const; + + // get the page rect in our client coords + wxRect GetPageRect() const; + + // get our client size from the page size + wxSize GetSizeForPage(const wxSize& size) const; + + // scroll the tabs so that the first page shown becomes the given one + void ScrollTo(int page); + + // scroll the tabs so that the first page shown becomes the given one + void ScrollLastTo(int page); + + // the pages titles + wxArrayString m_titles; + + // the current selection + size_t m_sel; + + // the spin button to change the pages + wxSpinButton *m_spinbtn; + + // the offset of the first page shown (may be changed with m_spinbtn) + wxCoord m_offset; + + // the first and last currently visible tabs: the name is not completely + // accurate as m_lastVisible is, in fact, the first tab which is *not* + // visible: so the visible tabs are those with indexes such that + // m_firstVisible <= n < m_lastVisible + size_t m_firstVisible, + m_lastVisible; + + // the last fully visible item, usually just m_lastVisible - 1 but may be + // different from it + size_t m_lastFullyVisible; + + // the height of tabs in a normal notebook or the width of tabs in a + // notebook with tabs on a side + wxCoord m_heightTab; + + // the biggest height (or width) of a notebook tab (used only if + // FixedSizeTabs()) or -1 if not calculated yet + wxCoord m_widthMax; + + // the cached widths (or heights) of tabs + wxArrayInt m_widths; + + // the icon indices + wxArrayInt m_images; + + // the accel indexes for labels + wxArrayInt m_accels; + + // the padding + wxSize m_sizePad; + + DECLARE_DYNAMIC_CLASS(wxNotebook) +}; + +#endif // _WX_UNIV_NOTEBOOK_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/radiobox.h b/Externals/wxWidgets/include/wx/univ/radiobox.h index b2108af322..14ecf969f1 100644 --- a/Externals/wxWidgets/include/wx/univ/radiobox.h +++ b/Externals/wxWidgets/include/wx/univ/radiobox.h @@ -1,151 +1,151 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/radiobox.h -// Purpose: wxRadioBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 11.09.00 -// RCS-ID: $Id: radiobox.h 38319 2006-03-23 22:05:23Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_RADIOBOX_H_ -#define _WX_UNIV_RADIOBOX_H_ - -class WXDLLEXPORT wxRadioButton; - -#include "wx/statbox.h" -#include "wx/dynarray.h" - -WX_DEFINE_EXPORTED_ARRAY_PTR(wxRadioButton *, wxArrayRadioButtons); - -// ---------------------------------------------------------------------------- -// wxRadioBox: a box full of radio buttons -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRadioBox : public wxStaticBox, - public wxRadioBoxBase -{ -public: - // wxRadioBox construction - wxRadioBox() { Init(); } - - wxRadioBox(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString *choices = NULL, - int majorDim = 0, - long style = wxRA_SPECIFY_COLS, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Init(); - - (void)Create(parent, id, title, pos, size, n, choices, - majorDim, style, val, name); - } - wxRadioBox(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = wxRA_SPECIFY_COLS, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString *choices = NULL, - int majorDim = 0, - long style = wxRA_SPECIFY_COLS, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = wxRA_SPECIFY_COLS, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - - virtual ~wxRadioBox(); - - // implement wxRadioBox interface - virtual void SetSelection(int n); - virtual int GetSelection() const; - - virtual unsigned int GetCount() const - { return (unsigned int)m_buttons.GetCount(); } - - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& label); - - virtual bool Enable(unsigned int n, bool enable = true); - virtual bool Show(unsigned int n, bool show = true); - - virtual bool IsItemEnabled(unsigned int n) const; - virtual bool IsItemShown(unsigned int n) const; - - // we also override the wxControl methods to avoid virtual function hiding - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - virtual wxString GetLabel() const; - virtual void SetLabel(const wxString& label); - - // we inherit a version always returning false from wxStaticBox, override - // it to behave normally - virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif // wxUSE_TOOLTIPS - - // wxUniversal-only methods - - // another Append() version - void Append(int n, const wxString *choices); - - // implementation only: called by wxRadioHookHandler - void OnRadioButton(wxEvent& event); - bool OnKeyDown(wxKeyEvent& event); - -protected: - // override the base class methods dealing with window positioning/sizing - // as we must move/size the buttons as well - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestClientSize() const; - - // generate a radiobutton click event for the current item - void SendRadioEvent(); - - // common part of all ctors - void Init(); - - // calculate the max size of all buttons - wxSize GetMaxButtonSize() const; - - // the currently selected radio button or -1 - int m_selection; - - // all radio buttons - wxArrayRadioButtons m_buttons; - - // the event handler which is used to translate radiobutton events into - // radiobox one - wxEvtHandler *m_evtRadioHook; - -private: - DECLARE_DYNAMIC_CLASS(wxRadioBox) -}; - -#endif // _WX_UNIV_RADIOBOX_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/radiobox.h +// Purpose: wxRadioBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.09.00 +// RCS-ID: $Id: radiobox.h 38319 2006-03-23 22:05:23Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_RADIOBOX_H_ +#define _WX_UNIV_RADIOBOX_H_ + +class WXDLLEXPORT wxRadioButton; + +#include "wx/statbox.h" +#include "wx/dynarray.h" + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxRadioButton *, wxArrayRadioButtons); + +// ---------------------------------------------------------------------------- +// wxRadioBox: a box full of radio buttons +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRadioBox : public wxStaticBox, + public wxRadioBoxBase +{ +public: + // wxRadioBox construction + wxRadioBox() { Init(); } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString *choices = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, n, choices, + majorDim, style, val, name); + } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString *choices = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + + virtual ~wxRadioBox(); + + // implement wxRadioBox interface + virtual void SetSelection(int n); + virtual int GetSelection() const; + + virtual unsigned int GetCount() const + { return (unsigned int)m_buttons.GetCount(); } + + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& label); + + virtual bool Enable(unsigned int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); + + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; + + // we also override the wxControl methods to avoid virtual function hiding + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + virtual wxString GetLabel() const; + virtual void SetLabel(const wxString& label); + + // we inherit a version always returning false from wxStaticBox, override + // it to behave normally + virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + + // wxUniversal-only methods + + // another Append() version + void Append(int n, const wxString *choices); + + // implementation only: called by wxRadioHookHandler + void OnRadioButton(wxEvent& event); + bool OnKeyDown(wxKeyEvent& event); + +protected: + // override the base class methods dealing with window positioning/sizing + // as we must move/size the buttons as well + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestClientSize() const; + + // generate a radiobutton click event for the current item + void SendRadioEvent(); + + // common part of all ctors + void Init(); + + // calculate the max size of all buttons + wxSize GetMaxButtonSize() const; + + // the currently selected radio button or -1 + int m_selection; + + // all radio buttons + wxArrayRadioButtons m_buttons; + + // the event handler which is used to translate radiobutton events into + // radiobox one + wxEvtHandler *m_evtRadioHook; + +private: + DECLARE_DYNAMIC_CLASS(wxRadioBox) +}; + +#endif // _WX_UNIV_RADIOBOX_H_ diff --git a/Externals/wxWidgets/include/wx/univ/radiobut.h b/Externals/wxWidgets/include/wx/univ/radiobut.h index f814986a4f..bcf4005c97 100644 --- a/Externals/wxWidgets/include/wx/univ/radiobut.h +++ b/Externals/wxWidgets/include/wx/univ/radiobut.h @@ -1,76 +1,76 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/radiobut.h -// Purpose: wxRadioButton declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: radiobut.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_RADIOBUT_H_ -#define _WX_UNIV_RADIOBUT_H_ - -#include "wx/checkbox.h" - -// ---------------------------------------------------------------------------- -// wxRadioButton -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRadioButton : public wxCheckBox -{ -public: - // constructors - wxRadioButton() { Init(); } - - wxRadioButton(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr) - { - Init(); - - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr); - - // override some base class methods - virtual void ChangeValue(bool value); - -protected: - // implement our own drawing - virtual void DoDraw(wxControlRenderer *renderer); - - // we use the radio button bitmaps for size calculation - virtual wxSize GetBitmapSize() const; - - // the radio button can only be cleared using this method, not - // ChangeValue() above - and it is protected as it can only be called by - // another radiobutton - void ClearValue(); - - // called when the radio button becomes checked: we clear all the buttons - // in the same group with us here - virtual void OnCheck(); - - // send event about radio button selection - virtual void SendEvent(); - -private: - DECLARE_DYNAMIC_CLASS(wxRadioButton) -}; - -#endif // _WX_UNIV_RADIOBUT_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/radiobut.h +// Purpose: wxRadioButton declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.09.00 +// RCS-ID: $Id: radiobut.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_RADIOBUT_H_ +#define _WX_UNIV_RADIOBUT_H_ + +#include "wx/checkbox.h" + +// ---------------------------------------------------------------------------- +// wxRadioButton +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRadioButton : public wxCheckBox +{ +public: + // constructors + wxRadioButton() { Init(); } + + wxRadioButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr); + + // override some base class methods + virtual void ChangeValue(bool value); + +protected: + // implement our own drawing + virtual void DoDraw(wxControlRenderer *renderer); + + // we use the radio button bitmaps for size calculation + virtual wxSize GetBitmapSize() const; + + // the radio button can only be cleared using this method, not + // ChangeValue() above - and it is protected as it can only be called by + // another radiobutton + void ClearValue(); + + // called when the radio button becomes checked: we clear all the buttons + // in the same group with us here + virtual void OnCheck(); + + // send event about radio button selection + virtual void SendEvent(); + +private: + DECLARE_DYNAMIC_CLASS(wxRadioButton) +}; + +#endif // _WX_UNIV_RADIOBUT_H_ diff --git a/Externals/wxWidgets/include/wx/univ/renderer.h b/Externals/wxWidgets/include/wx/univ/renderer.h index 59626bf847..ef273309cf 100644 --- a/Externals/wxWidgets/include/wx/univ/renderer.h +++ b/Externals/wxWidgets/include/wx/univ/renderer.h @@ -1,932 +1,932 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/renderer.h -// Purpose: wxRenderer class declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.00 -// RCS-ID: $Id: renderer.h 43726 2006-11-30 23:44:55Z RD $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_RENDERER_H_ -#define _WX_UNIV_RENDERER_H_ - -/* - wxRenderer class is used to draw all wxWidgets controls. This is an ABC and - the look of the application is determined by the concrete derivation of - wxRenderer used in the program. - - It also contains a few static methods which may be used by the concrete - renderers and provide the functionality which is often similar or identical - in all renderers (using inheritance here would be more restrictive as the - given concrete renderer may need an arbitrary subset of the base class - methods). - - Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and - includes the latters functionality (which it may delegate to the generic - implementation of the latter or reimplement itself). - */ - -#include "wx/renderer.h" - -class WXDLLEXPORT wxWindow; -class WXDLLEXPORT wxDC; -class WXDLLEXPORT wxCheckListBox; - -#if wxUSE_LISTBOX - class WXDLLEXPORT wxListBox; -#endif // wxUSE_LISTBOX - -#if wxUSE_MENUS - class WXDLLEXPORT wxMenu; - class WXDLLEXPORT wxMenuGeometryInfo; -#endif // wxUSE_MENUS - -class WXDLLEXPORT wxScrollBar; - -#if wxUSE_TEXTCTRL - class WXDLLEXPORT wxTextCtrl; -#endif - -#if wxUSE_GAUGE - class WXDLLEXPORT wxGauge; -#endif // wxUSE_GAUGE - -#include "wx/string.h" -#include "wx/gdicmn.h" -#include "wx/icon.h" - -// helper class used by wxMenu-related functions -class WXDLLEXPORT wxMenuGeometryInfo -{ -public: - // get the total size of the menu - virtual wxSize GetSize() const = 0; - - virtual ~wxMenuGeometryInfo(); -}; - -// ---------------------------------------------------------------------------- -// wxRenderer: abstract renderers interface -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxRenderer : public wxDelegateRendererNative -{ -public: - // drawing functions - // ----------------- - - // draw the controls background - virtual void DrawBackground(wxDC& dc, - const wxColour& col, - const wxRect& rect, - int flags, - wxWindow *window = NULL) = 0; - - // draw the button surface - virtual void DrawButtonSurface(wxDC& dc, - const wxColour& col, - const wxRect& rect, - int flags) = 0; - - - // draw the focus rectangle around the label contained in the given rect - // - // only wxCONTROL_SELECTED makes sense in flags here - virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) = 0; - - // draw the label inside the given rectangle with the specified alignment - // and optionally emphasize the character with the given index - virtual void DrawLabel(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounds = NULL) = 0; - - // same but also draw a bitmap if it is valid - virtual void DrawButtonLabel(wxDC& dc, - const wxString& label, - const wxBitmap& image, - const wxRect& rect, - int flags = 0, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounds = NULL) = 0; - - - // draw the border and optionally return the rectangle containing the - // region inside the border - virtual void DrawBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = (wxRect *)NULL) = 0; - - // draw text control border (I hate to have a separate method for this but - // it is needed to accommodate GTK+) - virtual void DrawTextBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = (wxRect *)NULL) = 0; - - // draw push button border and return the rectangle left for the label - virtual void DrawButtonBorder(wxDC& dc, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = (wxRect *)NULL) = 0; - - // draw a horizontal line - virtual void DrawHorizontalLine(wxDC& dc, - wxCoord y, wxCoord x1, wxCoord x2) = 0; - - // draw a vertical line - virtual void DrawVerticalLine(wxDC& dc, - wxCoord x, wxCoord y1, wxCoord y2) = 0; - - // draw a frame with the label (horizontal alignment can be specified) - virtual void DrawFrame(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0, - int alignment = wxALIGN_LEFT, - int indexAccel = -1) = 0; - - // draw an arrow in the given direction - virtual void DrawArrow(wxDC& dc, - wxDirection dir, - const wxRect& rect, - int flags = 0) = 0; - - // draw a scrollbar arrow (may be the same as arrow but may be not) - virtual void DrawScrollbarArrow(wxDC& dc, - wxDirection dir, - const wxRect& rect, - int flags = 0) = 0; - - // draw the scrollbar thumb - virtual void DrawScrollbarThumb(wxDC& dc, - wxOrientation orient, - const wxRect& rect, - int flags = 0) = 0; - - // draw a (part of) scrollbar shaft - virtual void DrawScrollbarShaft(wxDC& dc, - wxOrientation orient, - const wxRect& rect, - int flags = 0) = 0; - - // draw the rectangle in the corner between two scrollbars - virtual void DrawScrollCorner(wxDC& dc, - const wxRect& rect) = 0; - - // draw an item of a wxListBox - virtual void DrawItem(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0) = 0; - - // draw an item of a wxCheckListBox - virtual void DrawCheckItem(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0) = 0; - - // draw a checkbutton (bitmap may be invalid to use default one) - virtual void DrawCheckButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - wxAlignment align = wxALIGN_LEFT, - int indexAccel = -1) = 0; - - // draw a radio button - virtual void DrawRadioButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - wxAlignment align = wxALIGN_LEFT, - int indexAccel = -1) = 0; - -#if wxUSE_TOOLBAR - // draw a toolbar button (label may be empty, bitmap may be invalid, if - // both conditions are true this function draws a separator) - virtual void DrawToolBarButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - long style = 0, - int tbarStyle = 0) = 0; -#endif // wxUSE_TOOLBAR - -#if wxUSE_TEXTCTRL - // draw a (part of) line in the text control - virtual void DrawTextLine(wxDC& dc, - const wxString& text, - const wxRect& rect, - int selStart = -1, - int selEnd = -1, - int flags = 0) = 0; - - // draw a line wrap indicator - virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0; -#endif // wxUSE_TEXTCTRL - -#if wxUSE_NOTEBOOK - // draw a notebook tab - virtual void DrawTab(wxDC& dc, - const wxRect& rect, - wxDirection dir, - const wxString& label, - const wxBitmap& bitmap = wxNullBitmap, - int flags = 0, - int indexAccel = -1) = 0; -#endif // wxUSE_NOTEBOOK - -#if wxUSE_SLIDER - - // draw the slider shaft - virtual void DrawSliderShaft(wxDC& dc, - const wxRect& rect, - int lenThumb, - wxOrientation orient, - int flags = 0, - long style = 0, - wxRect *rectShaft = NULL) = 0; - - // draw the slider thumb - virtual void DrawSliderThumb(wxDC& dc, - const wxRect& rect, - wxOrientation orient, - int flags = 0, - long style = 0) = 0; - - // draw the slider ticks - virtual void DrawSliderTicks(wxDC& dc, - const wxRect& rect, - int lenThumb, - wxOrientation orient, - int start, - int end, - int step = 1, - int flags = 0, - long style = 0) = 0; -#endif // wxUSE_SLIDER - -#if wxUSE_MENUS - // draw a menu bar item - virtual void DrawMenuBarItem(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags = 0, - int indexAccel = -1) = 0; - - // draw a menu item (also used for submenus if flags has ISSUBMENU flag) - // - // the geometryInfo is calculated by GetMenuGeometry() function from below - virtual void DrawMenuItem(wxDC& dc, - wxCoord y, - const wxMenuGeometryInfo& geometryInfo, - const wxString& label, - const wxString& accel, - const wxBitmap& bitmap = wxNullBitmap, - int flags = 0, - int indexAccel = -1) = 0; - - // draw a menu bar separator - virtual void DrawMenuSeparator(wxDC& dc, - wxCoord y, - const wxMenuGeometryInfo& geomInfo) = 0; -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is - // interpreted specially and means "draw the status bar grip" here - virtual void DrawStatusField(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags = 0, int style = 0) = 0; -#endif // wxUSE_STATUSBAR - - // draw complete frame/dialog titlebar - virtual void DrawFrameTitleBar(wxDC& dc, - const wxRect& rect, - const wxString& title, - const wxIcon& icon, - int flags, - int specialButton = 0, - int specialButtonFlags = 0) = 0; - - // draw frame borders - virtual void DrawFrameBorder(wxDC& dc, - const wxRect& rect, - int flags) = 0; - - // draw frame titlebar background - virtual void DrawFrameBackground(wxDC& dc, - const wxRect& rect, - int flags) = 0; - - // draw frame title - virtual void DrawFrameTitle(wxDC& dc, - const wxRect& rect, - const wxString& title, - int flags) = 0; - - // draw frame icon - virtual void DrawFrameIcon(wxDC& dc, - const wxRect& rect, - const wxIcon& icon, - int flags) = 0; - - // draw frame buttons - virtual void DrawFrameButton(wxDC& dc, - wxCoord x, wxCoord y, - int button, - int flags = 0) = 0; - - // misc functions - // -------------- - -#if wxUSE_COMBOBOX - // return the bitmaps to use for combobox button - virtual void GetComboBitmaps(wxBitmap *bmpNormal, - wxBitmap *bmpFocus, - wxBitmap *bmpPressed, - wxBitmap *bmpDisabled) = 0; -#endif // wxUSE_COMBOBOX - - // geometry functions - // ------------------ - - // get the dimensions of the border: rect.x/y contain the width/height of - // the left/top side, width/heigh - of the right/bottom one - virtual wxRect GetBorderDimensions(wxBorder border) const = 0; - - // the scrollbars may be drawn either inside the window border or outside - // it - this function is used to decide how to draw them - virtual bool AreScrollbarsInsideBorder() const = 0; - - // adjust the size of the control of the given class: for most controls, - // this just takes into account the border, but for some (buttons, for - // example) it is more complicated - the result being, in any case, that - // the control looks "nice" if it uses the adjusted rectangle - virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0; - -#if wxUSE_SCROLLBAR - // get the size of a scrollbar arrow - virtual wxSize GetScrollbarArrowSize() const = 0; -#endif // wxUSE_SCROLLBAR - - // get the height of a listbox item from the base font height - virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0; - - // get the size of a checkbox/radio button bitmap - virtual wxSize GetCheckBitmapSize() const = 0; - virtual wxSize GetRadioBitmapSize() const = 0; - virtual wxCoord GetCheckItemMargin() const = 0; - -#if wxUSE_TOOLBAR - // get the standard size of a toolbar button and also return the size of - // a toolbar separator in the provided pointer - virtual wxSize GetToolBarButtonSize(wxCoord *separator) const = 0; - - // get the margins between/around the toolbar buttons - virtual wxSize GetToolBarMargin() const = 0; -#endif // wxUSE_TOOLBAR - -#if wxUSE_TEXTCTRL - // convert between text rectangle and client rectangle for text controls: - // the former is typicall smaller to leave margins around text - virtual wxRect GetTextTotalArea(const wxTextCtrl *text, - const wxRect& rectText) const = 0; - - // extra space is for line indicators - virtual wxRect GetTextClientArea(const wxTextCtrl *text, - const wxRect& rectTotal, - wxCoord *extraSpaceBeyond) const = 0; -#endif // wxUSE_TEXTCTRL - -#if wxUSE_NOTEBOOK - // get the overhang of a selected tab - virtual wxSize GetTabIndent() const = 0; - - // get the padding around the text in a tab - virtual wxSize GetTabPadding() const = 0; -#endif // wxUSE_NOTEBOOK - -#if wxUSE_SLIDER - // get the default size of the slider in lesser dimension (i.e. height of a - // horizontal slider or width of a vertical one) - virtual wxCoord GetSliderDim() const = 0; - - // get the length of the slider ticks displayed along side slider - virtual wxCoord GetSliderTickLen() const = 0; - - // get the slider shaft rect from the total slider rect - virtual wxRect GetSliderShaftRect(const wxRect& rect, - int lenThumb, - wxOrientation orient, - long style = 0) const = 0; - - // get the size of the slider thumb for the given total slider rect - virtual wxSize GetSliderThumbSize(const wxRect& rect, - int lenThumb, - wxOrientation orient) const = 0; -#endif // wxUSE_SLIDER - - // get the size of one progress bar step (in horz and vertical directions) - virtual wxSize GetProgressBarStep() const = 0; - -#if wxUSE_MENUS - // get the size of rectangle to use in the menubar for the given text rect - virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0; - - // get the struct storing all layout info needed to draw all menu items - // (this can't be calculated for each item separately as they should be - // aligned) - // - // the returned pointer must be deleted by the caller - virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, - const wxMenu& menu) const = 0; -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - // get the borders around the status bar fields (x and y fields of the - // return value) - virtual wxSize GetStatusBarBorders() const = 0; - - // get the border between the status bar fields - virtual wxCoord GetStatusBarBorderBetweenFields() const = 0; - - // get the mergin between a field and its border - virtual wxSize GetStatusBarFieldMargins() const = 0; -#endif // wxUSE_STATUSBAR - - // get client area rectangle of top level window (i.e. subtract - // decorations from given rectangle) - virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0; - - // get size of whole top level window, given size of its client area size - virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0; - - // get the minimal size of top level window - virtual wxSize GetFrameMinSize(int flags) const = 0; - - // get titlebar icon size - virtual wxSize GetFrameIconSize() const = 0; - - // returns one of wxHT_TOPLEVEL_XXX constants - virtual int HitTestFrame(const wxRect& rect, - const wxPoint& pt, - int flags = 0) const = 0; - - // virtual dtor for any base class - virtual ~wxRenderer(); -}; - -// ---------------------------------------------------------------------------- -// wxDelegateRenderer: it is impossible to inherit from any of standard -// renderers as their declarations are in private code, but you can use this -// class to override only some of the Draw() functions - all the other ones -// will be left to the original renderer -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDelegateRenderer : public wxRenderer -{ -public: - wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { } - - virtual void DrawBackground(wxDC& dc, - const wxColour& col, - const wxRect& rect, - int flags, - wxWindow *window = NULL ) - { m_renderer->DrawBackground(dc, col, rect, flags, window ); } - virtual void DrawButtonSurface(wxDC& dc, - const wxColour& col, - const wxRect& rect, - int flags) - { m_renderer->DrawButtonSurface(dc, col, rect, flags); } - virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) - { m_renderer->DrawFocusRect(dc, rect, flags); } - virtual void DrawLabel(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0, - int align = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounds = NULL) - { m_renderer->DrawLabel(dc, label, rect, - flags, align, indexAccel, rectBounds); } - virtual void DrawButtonLabel(wxDC& dc, - const wxString& label, - const wxBitmap& image, - const wxRect& rect, - int flags = 0, - int align = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounds = NULL) - { m_renderer->DrawButtonLabel(dc, label, image, rect, - flags, align, indexAccel, rectBounds); } - virtual void DrawBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = (wxRect *)NULL) - { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); } - virtual void DrawTextBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = (wxRect *)NULL) - { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); } - virtual void DrawButtonBorder(wxDC& dc, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = (wxRect *)NULL) - { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); } - virtual void DrawFrame(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0, - int align = wxALIGN_LEFT, - int indexAccel = -1) - { m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); } - virtual void DrawHorizontalLine(wxDC& dc, - wxCoord y, wxCoord x1, wxCoord x2) - { m_renderer->DrawHorizontalLine(dc, y, x1, x2); } - virtual void DrawVerticalLine(wxDC& dc, - wxCoord x, wxCoord y1, wxCoord y2) - { m_renderer->DrawVerticalLine(dc, x, y1, y2); } - virtual void DrawArrow(wxDC& dc, - wxDirection dir, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawArrow(dc, dir, rect, flags); } - virtual void DrawScrollbarArrow(wxDC& dc, - wxDirection dir, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); } - virtual void DrawScrollbarThumb(wxDC& dc, - wxOrientation orient, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); } - virtual void DrawScrollbarShaft(wxDC& dc, - wxOrientation orient, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); } - virtual void DrawScrollCorner(wxDC& dc, - const wxRect& rect) - { m_renderer->DrawScrollCorner(dc, rect); } - virtual void DrawItem(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawItem(dc, label, rect, flags); } - virtual void DrawCheckItem(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); } - virtual void DrawCheckButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - wxAlignment align = wxALIGN_LEFT, - int indexAccel = -1) - { m_renderer->DrawCheckButton(dc, label, bitmap, rect, - flags, align, indexAccel); } - virtual void DrawRadioButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - wxAlignment align = wxALIGN_LEFT, - int indexAccel = -1) - { m_renderer->DrawRadioButton(dc, label, bitmap, rect, - flags, align, indexAccel); } -#if wxUSE_TOOLBAR - virtual void DrawToolBarButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - long style = 0, - int tbarStyle = 0) - { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); } -#endif // wxUSE_TOOLBAR - -#if wxUSE_TEXTCTRL - virtual void DrawTextLine(wxDC& dc, - const wxString& text, - const wxRect& rect, - int selStart = -1, - int selEnd = -1, - int flags = 0) - { m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd, flags); } - virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) - { m_renderer->DrawLineWrapMark(dc, rect); } -#endif // wxUSE_TEXTCTRL - -#if wxUSE_NOTEBOOK - virtual void DrawTab(wxDC& dc, - const wxRect& rect, - wxDirection dir, - const wxString& label, - const wxBitmap& bitmap = wxNullBitmap, - int flags = 0, - int accel = -1) - { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); } -#endif // wxUSE_NOTEBOOK - -#if wxUSE_SLIDER - - virtual void DrawSliderShaft(wxDC& dc, - const wxRect& rect, - int lenThumb, - wxOrientation orient, - int flags = 0, - long style = 0, - wxRect *rectShaft = NULL) - { m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); } - virtual void DrawSliderThumb(wxDC& dc, - const wxRect& rect, - wxOrientation orient, - int flags = 0, - long style = 0) - { m_renderer->DrawSliderThumb(dc, rect, orient, flags, style); } - virtual void DrawSliderTicks(wxDC& dc, - const wxRect& rect, - int lenThumb, - wxOrientation orient, - int start, - int end, - int WXUNUSED(step) = 1, - int flags = 0, - long style = 0) - { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient, - start, end, start, flags, style); } -#endif // wxUSE_SLIDER - -#if wxUSE_MENUS - virtual void DrawMenuBarItem(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags = 0, - int indexAccel = -1) - { m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); } - virtual void DrawMenuItem(wxDC& dc, - wxCoord y, - const wxMenuGeometryInfo& gi, - const wxString& label, - const wxString& accel, - const wxBitmap& bitmap = wxNullBitmap, - int flags = 0, - int indexAccel = -1) - { m_renderer->DrawMenuItem(dc, y, gi, label, accel, - bitmap, flags, indexAccel); } - virtual void DrawMenuSeparator(wxDC& dc, - wxCoord y, - const wxMenuGeometryInfo& geomInfo) - { m_renderer->DrawMenuSeparator(dc, y, geomInfo); } -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - virtual void DrawStatusField(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags = 0, int style = 0) - { m_renderer->DrawStatusField(dc, rect, label, flags, style); } -#endif // wxUSE_STATUSBAR - - virtual void DrawFrameTitleBar(wxDC& dc, - const wxRect& rect, - const wxString& title, - const wxIcon& icon, - int flags, - int specialButton = 0, - int specialButtonFlag = 0) - { m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags, - specialButton, specialButtonFlag); } - virtual void DrawFrameBorder(wxDC& dc, - const wxRect& rect, - int flags) - { m_renderer->DrawFrameBorder(dc, rect, flags); } - virtual void DrawFrameBackground(wxDC& dc, - const wxRect& rect, - int flags) - { m_renderer->DrawFrameBackground(dc, rect, flags); } - virtual void DrawFrameTitle(wxDC& dc, - const wxRect& rect, - const wxString& title, - int flags) - { m_renderer->DrawFrameTitle(dc, rect, title, flags); } - virtual void DrawFrameIcon(wxDC& dc, - const wxRect& rect, - const wxIcon& icon, - int flags) - { m_renderer->DrawFrameIcon(dc, rect, icon, flags); } - virtual void DrawFrameButton(wxDC& dc, - wxCoord x, wxCoord y, - int button, - int flags = 0) - { m_renderer->DrawFrameButton(dc, x, y, button, flags); } - -#if wxUSE_COMBOBOX - virtual void GetComboBitmaps(wxBitmap *bmpNormal, - wxBitmap *bmpFocus, - wxBitmap *bmpPressed, - wxBitmap *bmpDisabled) - { m_renderer->GetComboBitmaps(bmpNormal, bmpFocus, - bmpPressed, bmpDisabled); } -#endif // wxUSE_COMBOBOX - - virtual void AdjustSize(wxSize *size, const wxWindow *window) - { m_renderer->AdjustSize(size, window); } - virtual wxRect GetBorderDimensions(wxBorder border) const - { return m_renderer->GetBorderDimensions(border); } - virtual bool AreScrollbarsInsideBorder() const - { return m_renderer->AreScrollbarsInsideBorder(); } - -#if wxUSE_SCROLLBAR - virtual wxSize GetScrollbarArrowSize() const - { return m_renderer->GetScrollbarArrowSize(); } -#endif // wxUSE_SCROLLBAR - - virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) - { return m_renderer->GetListboxItemHeight(fontHeight); } - virtual wxSize GetCheckBitmapSize() const - { return m_renderer->GetCheckBitmapSize(); } - virtual wxSize GetRadioBitmapSize() const - { return m_renderer->GetRadioBitmapSize(); } - virtual wxCoord GetCheckItemMargin() const - { return m_renderer->GetCheckItemMargin(); } - -#if wxUSE_TOOLBAR - virtual wxSize GetToolBarButtonSize(wxCoord *separator) const - { return m_renderer->GetToolBarButtonSize(separator); } - virtual wxSize GetToolBarMargin() const - { return m_renderer->GetToolBarMargin(); } -#endif // wxUSE_TOOLBAR - -#if wxUSE_TEXTCTRL - virtual wxRect GetTextTotalArea(const wxTextCtrl *text, - const wxRect& rect) const - { return m_renderer->GetTextTotalArea(text, rect); } - virtual wxRect GetTextClientArea(const wxTextCtrl *text, - const wxRect& rect, - wxCoord *extraSpaceBeyond) const - { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); } -#endif // wxUSE_TEXTCTRL - -#if wxUSE_NOTEBOOK - virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); } - virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); } -#endif // wxUSE_NOTEBOOK - -#if wxUSE_SLIDER - virtual wxCoord GetSliderDim() const - { return m_renderer->GetSliderDim(); } - virtual wxCoord GetSliderTickLen() const - { return m_renderer->GetSliderTickLen(); } - - virtual wxRect GetSliderShaftRect(const wxRect& rect, - int lenThumb, - wxOrientation orient, - long style = 0) const - { return m_renderer->GetSliderShaftRect(rect, lenThumb, orient, style); } - virtual wxSize GetSliderThumbSize(const wxRect& rect, - int lenThumb, - wxOrientation orient) const - { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); } -#endif // wxUSE_SLIDER - - virtual wxSize GetProgressBarStep() const - { return m_renderer->GetProgressBarStep(); } - -#if wxUSE_MENUS - virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const - { return m_renderer->GetMenuBarItemSize(sizeText); } - virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, - const wxMenu& menu) const - { return m_renderer->GetMenuGeometry(win, menu); } -#endif // wxUSE_MENUS - -#if wxUSE_STATUSBAR - virtual wxSize GetStatusBarBorders() const - { return m_renderer->GetStatusBarBorders(); } - virtual wxCoord GetStatusBarBorderBetweenFields() const - { return m_renderer->GetStatusBarBorderBetweenFields(); } - virtual wxSize GetStatusBarFieldMargins() const - { return m_renderer->GetStatusBarFieldMargins(); } -#endif // wxUSE_STATUSBAR - - virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const - { return m_renderer->GetFrameClientArea(rect, flags); } - virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const - { return m_renderer->GetFrameTotalSize(clientSize, flags); } - virtual wxSize GetFrameMinSize(int flags) const - { return m_renderer->GetFrameMinSize(flags); } - virtual wxSize GetFrameIconSize() const - { return m_renderer->GetFrameIconSize(); } - virtual int HitTestFrame(const wxRect& rect, - const wxPoint& pt, - int flags) const - { return m_renderer->HitTestFrame(rect, pt, flags); } - - virtual int DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0, - wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) - { return m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); } - virtual void DrawTreeItemButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0) - { m_renderer->DrawTreeItemButton(win, dc, rect, flags); } - -protected: - wxRenderer *m_renderer; -}; - -// ---------------------------------------------------------------------------- -// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from -// OnPaint() -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlRenderer -{ -public: - // create a renderer for this dc with this "fundamental" renderer - wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer); - - // operations - void DrawLabel(const wxBitmap& bitmap = wxNullBitmap, - wxCoord marginX = 0, wxCoord marginY = 0); -#if wxUSE_LISTBOX - void DrawItems(const wxListBox *listbox, - size_t itemFirst, size_t itemLast); -#endif // wxUSE_LISTBOX -#if wxUSE_CHECKLISTBOX - void DrawCheckItems(const wxCheckListBox *listbox, - size_t itemFirst, size_t itemLast); -#endif // wxUSE_CHECKLISTBOX - void DrawButtonBorder(); - // the line must be either horizontal or vertical - void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - void DrawFrame(); - void DrawBitmap(const wxBitmap& bitmap); - void DrawBackgroundBitmap(); - void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld); -#if wxUSE_GAUGE - void DrawProgressBar(const wxGauge *gauge); -#endif // wxUSE_GAUGE - - // accessors - wxWindow *GetWindow() const { return m_window; } - wxRenderer *GetRenderer() const { return m_renderer; } - - wxDC& GetDC() { return m_dc; } - - const wxRect& GetRect() const { return m_rect; } - wxRect& GetRect() { return m_rect; } - - // static helpers - static void DrawBitmap(wxDC &dc, - const wxBitmap& bitmap, - const wxRect& rect, - int alignment = wxALIGN_CENTRE | - wxALIGN_CENTRE_VERTICAL, - wxStretch stretch = wxSTRETCH_NOT); - -private: - -#if wxUSE_LISTBOX - // common part of DrawItems() and DrawCheckItems() - void DoDrawItems(const wxListBox *listbox, - size_t itemFirst, size_t itemLast, - bool isCheckLbox = false); -#endif // wxUSE_LISTBOX - - wxWindow *m_window; - wxRenderer *m_renderer; - wxDC& m_dc; - wxRect m_rect; -}; - -#endif // _WX_UNIV_RENDERER_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/renderer.h +// Purpose: wxRenderer class declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// RCS-ID: $Id: renderer.h 43726 2006-11-30 23:44:55Z RD $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_RENDERER_H_ +#define _WX_UNIV_RENDERER_H_ + +/* + wxRenderer class is used to draw all wxWidgets controls. This is an ABC and + the look of the application is determined by the concrete derivation of + wxRenderer used in the program. + + It also contains a few static methods which may be used by the concrete + renderers and provide the functionality which is often similar or identical + in all renderers (using inheritance here would be more restrictive as the + given concrete renderer may need an arbitrary subset of the base class + methods). + + Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and + includes the latters functionality (which it may delegate to the generic + implementation of the latter or reimplement itself). + */ + +#include "wx/renderer.h" + +class WXDLLEXPORT wxWindow; +class WXDLLEXPORT wxDC; +class WXDLLEXPORT wxCheckListBox; + +#if wxUSE_LISTBOX + class WXDLLEXPORT wxListBox; +#endif // wxUSE_LISTBOX + +#if wxUSE_MENUS + class WXDLLEXPORT wxMenu; + class WXDLLEXPORT wxMenuGeometryInfo; +#endif // wxUSE_MENUS + +class WXDLLEXPORT wxScrollBar; + +#if wxUSE_TEXTCTRL + class WXDLLEXPORT wxTextCtrl; +#endif + +#if wxUSE_GAUGE + class WXDLLEXPORT wxGauge; +#endif // wxUSE_GAUGE + +#include "wx/string.h" +#include "wx/gdicmn.h" +#include "wx/icon.h" + +// helper class used by wxMenu-related functions +class WXDLLEXPORT wxMenuGeometryInfo +{ +public: + // get the total size of the menu + virtual wxSize GetSize() const = 0; + + virtual ~wxMenuGeometryInfo(); +}; + +// ---------------------------------------------------------------------------- +// wxRenderer: abstract renderers interface +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRenderer : public wxDelegateRendererNative +{ +public: + // drawing functions + // ----------------- + + // draw the controls background + virtual void DrawBackground(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags, + wxWindow *window = NULL) = 0; + + // draw the button surface + virtual void DrawButtonSurface(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags) = 0; + + + // draw the focus rectangle around the label contained in the given rect + // + // only wxCONTROL_SELECTED makes sense in flags here + virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) = 0; + + // draw the label inside the given rectangle with the specified alignment + // and optionally emphasize the character with the given index + virtual void DrawLabel(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) = 0; + + // same but also draw a bitmap if it is valid + virtual void DrawButtonLabel(wxDC& dc, + const wxString& label, + const wxBitmap& image, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) = 0; + + + // draw the border and optionally return the rectangle containing the + // region inside the border + virtual void DrawBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = (wxRect *)NULL) = 0; + + // draw text control border (I hate to have a separate method for this but + // it is needed to accommodate GTK+) + virtual void DrawTextBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = (wxRect *)NULL) = 0; + + // draw push button border and return the rectangle left for the label + virtual void DrawButtonBorder(wxDC& dc, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = (wxRect *)NULL) = 0; + + // draw a horizontal line + virtual void DrawHorizontalLine(wxDC& dc, + wxCoord y, wxCoord x1, wxCoord x2) = 0; + + // draw a vertical line + virtual void DrawVerticalLine(wxDC& dc, + wxCoord x, wxCoord y1, wxCoord y2) = 0; + + // draw a frame with the label (horizontal alignment can be specified) + virtual void DrawFrame(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT, + int indexAccel = -1) = 0; + + // draw an arrow in the given direction + virtual void DrawArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) = 0; + + // draw a scrollbar arrow (may be the same as arrow but may be not) + virtual void DrawScrollbarArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) = 0; + + // draw the scrollbar thumb + virtual void DrawScrollbarThumb(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) = 0; + + // draw a (part of) scrollbar shaft + virtual void DrawScrollbarShaft(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) = 0; + + // draw the rectangle in the corner between two scrollbars + virtual void DrawScrollCorner(wxDC& dc, + const wxRect& rect) = 0; + + // draw an item of a wxListBox + virtual void DrawItem(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0) = 0; + + // draw an item of a wxCheckListBox + virtual void DrawCheckItem(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0) = 0; + + // draw a checkbutton (bitmap may be invalid to use default one) + virtual void DrawCheckButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) = 0; + + // draw a radio button + virtual void DrawRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) = 0; + +#if wxUSE_TOOLBAR + // draw a toolbar button (label may be empty, bitmap may be invalid, if + // both conditions are true this function draws a separator) + virtual void DrawToolBarButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + long style = 0, + int tbarStyle = 0) = 0; +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + // draw a (part of) line in the text control + virtual void DrawTextLine(wxDC& dc, + const wxString& text, + const wxRect& rect, + int selStart = -1, + int selEnd = -1, + int flags = 0) = 0; + + // draw a line wrap indicator + virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0; +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + // draw a notebook tab + virtual void DrawTab(wxDC& dc, + const wxRect& rect, + wxDirection dir, + const wxString& label, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int indexAccel = -1) = 0; +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + + // draw the slider shaft + virtual void DrawSliderShaft(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int flags = 0, + long style = 0, + wxRect *rectShaft = NULL) = 0; + + // draw the slider thumb + virtual void DrawSliderThumb(wxDC& dc, + const wxRect& rect, + wxOrientation orient, + int flags = 0, + long style = 0) = 0; + + // draw the slider ticks + virtual void DrawSliderTicks(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int start, + int end, + int step = 1, + int flags = 0, + long style = 0) = 0; +#endif // wxUSE_SLIDER + +#if wxUSE_MENUS + // draw a menu bar item + virtual void DrawMenuBarItem(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, + int indexAccel = -1) = 0; + + // draw a menu item (also used for submenus if flags has ISSUBMENU flag) + // + // the geometryInfo is calculated by GetMenuGeometry() function from below + virtual void DrawMenuItem(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geometryInfo, + const wxString& label, + const wxString& accel, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int indexAccel = -1) = 0; + + // draw a menu bar separator + virtual void DrawMenuSeparator(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geomInfo) = 0; +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is + // interpreted specially and means "draw the status bar grip" here + virtual void DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, int style = 0) = 0; +#endif // wxUSE_STATUSBAR + + // draw complete frame/dialog titlebar + virtual void DrawFrameTitleBar(wxDC& dc, + const wxRect& rect, + const wxString& title, + const wxIcon& icon, + int flags, + int specialButton = 0, + int specialButtonFlags = 0) = 0; + + // draw frame borders + virtual void DrawFrameBorder(wxDC& dc, + const wxRect& rect, + int flags) = 0; + + // draw frame titlebar background + virtual void DrawFrameBackground(wxDC& dc, + const wxRect& rect, + int flags) = 0; + + // draw frame title + virtual void DrawFrameTitle(wxDC& dc, + const wxRect& rect, + const wxString& title, + int flags) = 0; + + // draw frame icon + virtual void DrawFrameIcon(wxDC& dc, + const wxRect& rect, + const wxIcon& icon, + int flags) = 0; + + // draw frame buttons + virtual void DrawFrameButton(wxDC& dc, + wxCoord x, wxCoord y, + int button, + int flags = 0) = 0; + + // misc functions + // -------------- + +#if wxUSE_COMBOBOX + // return the bitmaps to use for combobox button + virtual void GetComboBitmaps(wxBitmap *bmpNormal, + wxBitmap *bmpFocus, + wxBitmap *bmpPressed, + wxBitmap *bmpDisabled) = 0; +#endif // wxUSE_COMBOBOX + + // geometry functions + // ------------------ + + // get the dimensions of the border: rect.x/y contain the width/height of + // the left/top side, width/heigh - of the right/bottom one + virtual wxRect GetBorderDimensions(wxBorder border) const = 0; + + // the scrollbars may be drawn either inside the window border or outside + // it - this function is used to decide how to draw them + virtual bool AreScrollbarsInsideBorder() const = 0; + + // adjust the size of the control of the given class: for most controls, + // this just takes into account the border, but for some (buttons, for + // example) it is more complicated - the result being, in any case, that + // the control looks "nice" if it uses the adjusted rectangle + virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0; + +#if wxUSE_SCROLLBAR + // get the size of a scrollbar arrow + virtual wxSize GetScrollbarArrowSize() const = 0; +#endif // wxUSE_SCROLLBAR + + // get the height of a listbox item from the base font height + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0; + + // get the size of a checkbox/radio button bitmap + virtual wxSize GetCheckBitmapSize() const = 0; + virtual wxSize GetRadioBitmapSize() const = 0; + virtual wxCoord GetCheckItemMargin() const = 0; + +#if wxUSE_TOOLBAR + // get the standard size of a toolbar button and also return the size of + // a toolbar separator in the provided pointer + virtual wxSize GetToolBarButtonSize(wxCoord *separator) const = 0; + + // get the margins between/around the toolbar buttons + virtual wxSize GetToolBarMargin() const = 0; +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + // convert between text rectangle and client rectangle for text controls: + // the former is typicall smaller to leave margins around text + virtual wxRect GetTextTotalArea(const wxTextCtrl *text, + const wxRect& rectText) const = 0; + + // extra space is for line indicators + virtual wxRect GetTextClientArea(const wxTextCtrl *text, + const wxRect& rectTotal, + wxCoord *extraSpaceBeyond) const = 0; +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + // get the overhang of a selected tab + virtual wxSize GetTabIndent() const = 0; + + // get the padding around the text in a tab + virtual wxSize GetTabPadding() const = 0; +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + // get the default size of the slider in lesser dimension (i.e. height of a + // horizontal slider or width of a vertical one) + virtual wxCoord GetSliderDim() const = 0; + + // get the length of the slider ticks displayed along side slider + virtual wxCoord GetSliderTickLen() const = 0; + + // get the slider shaft rect from the total slider rect + virtual wxRect GetSliderShaftRect(const wxRect& rect, + int lenThumb, + wxOrientation orient, + long style = 0) const = 0; + + // get the size of the slider thumb for the given total slider rect + virtual wxSize GetSliderThumbSize(const wxRect& rect, + int lenThumb, + wxOrientation orient) const = 0; +#endif // wxUSE_SLIDER + + // get the size of one progress bar step (in horz and vertical directions) + virtual wxSize GetProgressBarStep() const = 0; + +#if wxUSE_MENUS + // get the size of rectangle to use in the menubar for the given text rect + virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0; + + // get the struct storing all layout info needed to draw all menu items + // (this can't be calculated for each item separately as they should be + // aligned) + // + // the returned pointer must be deleted by the caller + virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, + const wxMenu& menu) const = 0; +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // get the borders around the status bar fields (x and y fields of the + // return value) + virtual wxSize GetStatusBarBorders() const = 0; + + // get the border between the status bar fields + virtual wxCoord GetStatusBarBorderBetweenFields() const = 0; + + // get the mergin between a field and its border + virtual wxSize GetStatusBarFieldMargins() const = 0; +#endif // wxUSE_STATUSBAR + + // get client area rectangle of top level window (i.e. subtract + // decorations from given rectangle) + virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0; + + // get size of whole top level window, given size of its client area size + virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0; + + // get the minimal size of top level window + virtual wxSize GetFrameMinSize(int flags) const = 0; + + // get titlebar icon size + virtual wxSize GetFrameIconSize() const = 0; + + // returns one of wxHT_TOPLEVEL_XXX constants + virtual int HitTestFrame(const wxRect& rect, + const wxPoint& pt, + int flags = 0) const = 0; + + // virtual dtor for any base class + virtual ~wxRenderer(); +}; + +// ---------------------------------------------------------------------------- +// wxDelegateRenderer: it is impossible to inherit from any of standard +// renderers as their declarations are in private code, but you can use this +// class to override only some of the Draw() functions - all the other ones +// will be left to the original renderer +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDelegateRenderer : public wxRenderer +{ +public: + wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { } + + virtual void DrawBackground(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags, + wxWindow *window = NULL ) + { m_renderer->DrawBackground(dc, col, rect, flags, window ); } + virtual void DrawButtonSurface(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags) + { m_renderer->DrawButtonSurface(dc, col, rect, flags); } + virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) + { m_renderer->DrawFocusRect(dc, rect, flags); } + virtual void DrawLabel(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) + { m_renderer->DrawLabel(dc, label, rect, + flags, align, indexAccel, rectBounds); } + virtual void DrawButtonLabel(wxDC& dc, + const wxString& label, + const wxBitmap& image, + const wxRect& rect, + int flags = 0, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) + { m_renderer->DrawButtonLabel(dc, label, image, rect, + flags, align, indexAccel, rectBounds); } + virtual void DrawBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = (wxRect *)NULL) + { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); } + virtual void DrawTextBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = (wxRect *)NULL) + { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); } + virtual void DrawButtonBorder(wxDC& dc, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = (wxRect *)NULL) + { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); } + virtual void DrawFrame(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int align = wxALIGN_LEFT, + int indexAccel = -1) + { m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); } + virtual void DrawHorizontalLine(wxDC& dc, + wxCoord y, wxCoord x1, wxCoord x2) + { m_renderer->DrawHorizontalLine(dc, y, x1, x2); } + virtual void DrawVerticalLine(wxDC& dc, + wxCoord x, wxCoord y1, wxCoord y2) + { m_renderer->DrawVerticalLine(dc, x, y1, y2); } + virtual void DrawArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawArrow(dc, dir, rect, flags); } + virtual void DrawScrollbarArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); } + virtual void DrawScrollbarThumb(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); } + virtual void DrawScrollbarShaft(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); } + virtual void DrawScrollCorner(wxDC& dc, + const wxRect& rect) + { m_renderer->DrawScrollCorner(dc, rect); } + virtual void DrawItem(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawItem(dc, label, rect, flags); } + virtual void DrawCheckItem(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); } + virtual void DrawCheckButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) + { m_renderer->DrawCheckButton(dc, label, bitmap, rect, + flags, align, indexAccel); } + virtual void DrawRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) + { m_renderer->DrawRadioButton(dc, label, bitmap, rect, + flags, align, indexAccel); } +#if wxUSE_TOOLBAR + virtual void DrawToolBarButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + long style = 0, + int tbarStyle = 0) + { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); } +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + virtual void DrawTextLine(wxDC& dc, + const wxString& text, + const wxRect& rect, + int selStart = -1, + int selEnd = -1, + int flags = 0) + { m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd, flags); } + virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) + { m_renderer->DrawLineWrapMark(dc, rect); } +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + virtual void DrawTab(wxDC& dc, + const wxRect& rect, + wxDirection dir, + const wxString& label, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int accel = -1) + { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); } +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + + virtual void DrawSliderShaft(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int flags = 0, + long style = 0, + wxRect *rectShaft = NULL) + { m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); } + virtual void DrawSliderThumb(wxDC& dc, + const wxRect& rect, + wxOrientation orient, + int flags = 0, + long style = 0) + { m_renderer->DrawSliderThumb(dc, rect, orient, flags, style); } + virtual void DrawSliderTicks(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int start, + int end, + int WXUNUSED(step) = 1, + int flags = 0, + long style = 0) + { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient, + start, end, start, flags, style); } +#endif // wxUSE_SLIDER + +#if wxUSE_MENUS + virtual void DrawMenuBarItem(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, + int indexAccel = -1) + { m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); } + virtual void DrawMenuItem(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& gi, + const wxString& label, + const wxString& accel, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int indexAccel = -1) + { m_renderer->DrawMenuItem(dc, y, gi, label, accel, + bitmap, flags, indexAccel); } + virtual void DrawMenuSeparator(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geomInfo) + { m_renderer->DrawMenuSeparator(dc, y, geomInfo); } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + virtual void DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, int style = 0) + { m_renderer->DrawStatusField(dc, rect, label, flags, style); } +#endif // wxUSE_STATUSBAR + + virtual void DrawFrameTitleBar(wxDC& dc, + const wxRect& rect, + const wxString& title, + const wxIcon& icon, + int flags, + int specialButton = 0, + int specialButtonFlag = 0) + { m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags, + specialButton, specialButtonFlag); } + virtual void DrawFrameBorder(wxDC& dc, + const wxRect& rect, + int flags) + { m_renderer->DrawFrameBorder(dc, rect, flags); } + virtual void DrawFrameBackground(wxDC& dc, + const wxRect& rect, + int flags) + { m_renderer->DrawFrameBackground(dc, rect, flags); } + virtual void DrawFrameTitle(wxDC& dc, + const wxRect& rect, + const wxString& title, + int flags) + { m_renderer->DrawFrameTitle(dc, rect, title, flags); } + virtual void DrawFrameIcon(wxDC& dc, + const wxRect& rect, + const wxIcon& icon, + int flags) + { m_renderer->DrawFrameIcon(dc, rect, icon, flags); } + virtual void DrawFrameButton(wxDC& dc, + wxCoord x, wxCoord y, + int button, + int flags = 0) + { m_renderer->DrawFrameButton(dc, x, y, button, flags); } + +#if wxUSE_COMBOBOX + virtual void GetComboBitmaps(wxBitmap *bmpNormal, + wxBitmap *bmpFocus, + wxBitmap *bmpPressed, + wxBitmap *bmpDisabled) + { m_renderer->GetComboBitmaps(bmpNormal, bmpFocus, + bmpPressed, bmpDisabled); } +#endif // wxUSE_COMBOBOX + + virtual void AdjustSize(wxSize *size, const wxWindow *window) + { m_renderer->AdjustSize(size, window); } + virtual wxRect GetBorderDimensions(wxBorder border) const + { return m_renderer->GetBorderDimensions(border); } + virtual bool AreScrollbarsInsideBorder() const + { return m_renderer->AreScrollbarsInsideBorder(); } + +#if wxUSE_SCROLLBAR + virtual wxSize GetScrollbarArrowSize() const + { return m_renderer->GetScrollbarArrowSize(); } +#endif // wxUSE_SCROLLBAR + + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) + { return m_renderer->GetListboxItemHeight(fontHeight); } + virtual wxSize GetCheckBitmapSize() const + { return m_renderer->GetCheckBitmapSize(); } + virtual wxSize GetRadioBitmapSize() const + { return m_renderer->GetRadioBitmapSize(); } + virtual wxCoord GetCheckItemMargin() const + { return m_renderer->GetCheckItemMargin(); } + +#if wxUSE_TOOLBAR + virtual wxSize GetToolBarButtonSize(wxCoord *separator) const + { return m_renderer->GetToolBarButtonSize(separator); } + virtual wxSize GetToolBarMargin() const + { return m_renderer->GetToolBarMargin(); } +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + virtual wxRect GetTextTotalArea(const wxTextCtrl *text, + const wxRect& rect) const + { return m_renderer->GetTextTotalArea(text, rect); } + virtual wxRect GetTextClientArea(const wxTextCtrl *text, + const wxRect& rect, + wxCoord *extraSpaceBeyond) const + { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); } +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); } + virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); } +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + virtual wxCoord GetSliderDim() const + { return m_renderer->GetSliderDim(); } + virtual wxCoord GetSliderTickLen() const + { return m_renderer->GetSliderTickLen(); } + + virtual wxRect GetSliderShaftRect(const wxRect& rect, + int lenThumb, + wxOrientation orient, + long style = 0) const + { return m_renderer->GetSliderShaftRect(rect, lenThumb, orient, style); } + virtual wxSize GetSliderThumbSize(const wxRect& rect, + int lenThumb, + wxOrientation orient) const + { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); } +#endif // wxUSE_SLIDER + + virtual wxSize GetProgressBarStep() const + { return m_renderer->GetProgressBarStep(); } + +#if wxUSE_MENUS + virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const + { return m_renderer->GetMenuBarItemSize(sizeText); } + virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, + const wxMenu& menu) const + { return m_renderer->GetMenuGeometry(win, menu); } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + virtual wxSize GetStatusBarBorders() const + { return m_renderer->GetStatusBarBorders(); } + virtual wxCoord GetStatusBarBorderBetweenFields() const + { return m_renderer->GetStatusBarBorderBetweenFields(); } + virtual wxSize GetStatusBarFieldMargins() const + { return m_renderer->GetStatusBarFieldMargins(); } +#endif // wxUSE_STATUSBAR + + virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const + { return m_renderer->GetFrameClientArea(rect, flags); } + virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const + { return m_renderer->GetFrameTotalSize(clientSize, flags); } + virtual wxSize GetFrameMinSize(int flags) const + { return m_renderer->GetFrameMinSize(flags); } + virtual wxSize GetFrameIconSize() const + { return m_renderer->GetFrameIconSize(); } + virtual int HitTestFrame(const wxRect& rect, + const wxPoint& pt, + int flags) const + { return m_renderer->HitTestFrame(rect, pt, flags); } + + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params = NULL) + { return m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); } + virtual void DrawTreeItemButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_renderer->DrawTreeItemButton(win, dc, rect, flags); } + +protected: + wxRenderer *m_renderer; +}; + +// ---------------------------------------------------------------------------- +// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from +// OnPaint() +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlRenderer +{ +public: + // create a renderer for this dc with this "fundamental" renderer + wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer); + + // operations + void DrawLabel(const wxBitmap& bitmap = wxNullBitmap, + wxCoord marginX = 0, wxCoord marginY = 0); +#if wxUSE_LISTBOX + void DrawItems(const wxListBox *listbox, + size_t itemFirst, size_t itemLast); +#endif // wxUSE_LISTBOX +#if wxUSE_CHECKLISTBOX + void DrawCheckItems(const wxCheckListBox *listbox, + size_t itemFirst, size_t itemLast); +#endif // wxUSE_CHECKLISTBOX + void DrawButtonBorder(); + // the line must be either horizontal or vertical + void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + void DrawFrame(); + void DrawBitmap(const wxBitmap& bitmap); + void DrawBackgroundBitmap(); + void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld); +#if wxUSE_GAUGE + void DrawProgressBar(const wxGauge *gauge); +#endif // wxUSE_GAUGE + + // accessors + wxWindow *GetWindow() const { return m_window; } + wxRenderer *GetRenderer() const { return m_renderer; } + + wxDC& GetDC() { return m_dc; } + + const wxRect& GetRect() const { return m_rect; } + wxRect& GetRect() { return m_rect; } + + // static helpers + static void DrawBitmap(wxDC &dc, + const wxBitmap& bitmap, + const wxRect& rect, + int alignment = wxALIGN_CENTRE | + wxALIGN_CENTRE_VERTICAL, + wxStretch stretch = wxSTRETCH_NOT); + +private: + +#if wxUSE_LISTBOX + // common part of DrawItems() and DrawCheckItems() + void DoDrawItems(const wxListBox *listbox, + size_t itemFirst, size_t itemLast, + bool isCheckLbox = false); +#endif // wxUSE_LISTBOX + + wxWindow *m_window; + wxRenderer *m_renderer; + wxDC& m_dc; + wxRect m_rect; +}; + +#endif // _WX_UNIV_RENDERER_H_ diff --git a/Externals/wxWidgets/include/wx/univ/scrarrow.h b/Externals/wxWidgets/include/wx/univ/scrarrow.h index 67e95cf560..affeeff237 100644 --- a/Externals/wxWidgets/include/wx/univ/scrarrow.h +++ b/Externals/wxWidgets/include/wx/univ/scrarrow.h @@ -1,112 +1,112 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/scrarrow.h -// Purpose: wxScrollArrows class -// Author: Vadim Zeitlin -// Modified by: -// Created: 22.01.01 -// RCS-ID: $Id: scrarrow.h 42715 2006-10-30 12:24:13Z VS $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SCRARROW_H_ -#define _WX_UNIV_SCRARROW_H_ - -// ---------------------------------------------------------------------------- -// wxScrollArrows is not a control but just a class containing the common -// functionality of scroll arrows, whether part of scrollbars, spin ctrls or -// anything else. -// -// To customize its behaviour, wxScrollArrows doesn't use any virtual methods -// but instead a callback pointer to a wxControlWithArrows object which is used -// for all control-dependent stuff. Thus, to use wxScrollArrows, you just need -// to derive from the wxControlWithArrows interface and implement its methods. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlWithArrows; -class WXDLLEXPORT wxDC; -class WXDLLEXPORT wxMouseEvent; -class WXDLLEXPORT wxRect; -class WXDLLEXPORT wxRenderer; - -// ---------------------------------------------------------------------------- -// wxScrollArrows: an abstraction of scrollbar arrow -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollArrows -{ -public: - enum Arrow - { - Arrow_None = -1, - Arrow_First, // left or top - Arrow_Second, // right or bottom - Arrow_Max - }; - - // ctor requires a back pointer to wxControlWithArrows - wxScrollArrows(wxControlWithArrows *control); - - // draws the arrow on the given DC in the given rectangle, uses - // wxControlWithArrows::GetArrowState() to get its current state - void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect, - bool scrollbarLike = false) const; - - // process a mouse move, enter or leave event, possibly calling - // wxControlWithArrows::SetArrowState() if - // wxControlWithArrows::HitTestArrow() says that the mouse has left/entered - // an arrow - bool HandleMouseMove(const wxMouseEvent& event) const; - - // process a mouse click event - bool HandleMouse(const wxMouseEvent& event) const; - - // dtor - ~wxScrollArrows(); - -private: - // set or clear the wxCONTROL_CURRENT flag for the arrow - void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const; - - // the main control - wxControlWithArrows *m_control; - - // the data for the mouse capture - struct wxScrollArrowCaptureData *m_captureData; -}; - -// ---------------------------------------------------------------------------- -// wxControlWithArrows: interface implemented by controls using wxScrollArrows -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlWithArrows -{ -public: - virtual ~wxControlWithArrows() {} - - // get the renderer to use for drawing the arrows - virtual wxRenderer *GetRenderer() const = 0; - - // get the controls window (used for mouse capturing) - virtual wxWindow *GetWindow() = 0; - - // get the orientation of the arrows (vertical or horizontal) - virtual bool IsVertical() const = 0; - - // get the state of this arrow as combination of wxCONTROL_XXX flags - virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0; - - // set or clear the specified flag in the arrow state: this function is - // responsible for refreshing the control - virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, - int flag, bool set = true) = 0; - - // hit testing: return on which arrow the point is (or Arrow_None) - virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const = 0; - - // called when the arrow is pressed, return true to continue scrolling and - // false to stop it - virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0; -}; - -#endif // _WX_UNIV_SCRARROW_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrarrow.h +// Purpose: wxScrollArrows class +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.01.01 +// RCS-ID: $Id: scrarrow.h 42715 2006-10-30 12:24:13Z VS $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCRARROW_H_ +#define _WX_UNIV_SCRARROW_H_ + +// ---------------------------------------------------------------------------- +// wxScrollArrows is not a control but just a class containing the common +// functionality of scroll arrows, whether part of scrollbars, spin ctrls or +// anything else. +// +// To customize its behaviour, wxScrollArrows doesn't use any virtual methods +// but instead a callback pointer to a wxControlWithArrows object which is used +// for all control-dependent stuff. Thus, to use wxScrollArrows, you just need +// to derive from the wxControlWithArrows interface and implement its methods. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlWithArrows; +class WXDLLEXPORT wxDC; +class WXDLLEXPORT wxMouseEvent; +class WXDLLEXPORT wxRect; +class WXDLLEXPORT wxRenderer; + +// ---------------------------------------------------------------------------- +// wxScrollArrows: an abstraction of scrollbar arrow +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrollArrows +{ +public: + enum Arrow + { + Arrow_None = -1, + Arrow_First, // left or top + Arrow_Second, // right or bottom + Arrow_Max + }; + + // ctor requires a back pointer to wxControlWithArrows + wxScrollArrows(wxControlWithArrows *control); + + // draws the arrow on the given DC in the given rectangle, uses + // wxControlWithArrows::GetArrowState() to get its current state + void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect, + bool scrollbarLike = false) const; + + // process a mouse move, enter or leave event, possibly calling + // wxControlWithArrows::SetArrowState() if + // wxControlWithArrows::HitTestArrow() says that the mouse has left/entered + // an arrow + bool HandleMouseMove(const wxMouseEvent& event) const; + + // process a mouse click event + bool HandleMouse(const wxMouseEvent& event) const; + + // dtor + ~wxScrollArrows(); + +private: + // set or clear the wxCONTROL_CURRENT flag for the arrow + void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const; + + // the main control + wxControlWithArrows *m_control; + + // the data for the mouse capture + struct wxScrollArrowCaptureData *m_captureData; +}; + +// ---------------------------------------------------------------------------- +// wxControlWithArrows: interface implemented by controls using wxScrollArrows +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlWithArrows +{ +public: + virtual ~wxControlWithArrows() {} + + // get the renderer to use for drawing the arrows + virtual wxRenderer *GetRenderer() const = 0; + + // get the controls window (used for mouse capturing) + virtual wxWindow *GetWindow() = 0; + + // get the orientation of the arrows (vertical or horizontal) + virtual bool IsVertical() const = 0; + + // get the state of this arrow as combination of wxCONTROL_XXX flags + virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0; + + // set or clear the specified flag in the arrow state: this function is + // responsible for refreshing the control + virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, + int flag, bool set = true) = 0; + + // hit testing: return on which arrow the point is (or Arrow_None) + virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const = 0; + + // called when the arrow is pressed, return true to continue scrolling and + // false to stop it + virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0; +}; + +#endif // _WX_UNIV_SCRARROW_H_ diff --git a/Externals/wxWidgets/include/wx/univ/scrolbar.h b/Externals/wxWidgets/include/wx/univ/scrolbar.h index 43b1872efa..ab3fd34c99 100644 --- a/Externals/wxWidgets/include/wx/univ/scrolbar.h +++ b/Externals/wxWidgets/include/wx/univ/scrolbar.h @@ -1,283 +1,283 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/scrolbar.h -// Purpose: wxScrollBar for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.08.00 -// RCS-ID: $Id: scrolbar.h 42716 2006-10-30 12:33:25Z VS $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SCROLBAR_H_ -#define _WX_UNIV_SCROLBAR_H_ - -class WXDLLEXPORT wxScrollTimer; - -#include "wx/univ/scrarrow.h" -#include "wx/renderer.h" - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -// scroll the bar -#define wxACTION_SCROLL_START _T("start") // to the beginning -#define wxACTION_SCROLL_END _T("end") // to the end -#define wxACTION_SCROLL_LINE_UP _T("lineup") // one line up/left -#define wxACTION_SCROLL_PAGE_UP _T("pageup") // one page up/left -#define wxACTION_SCROLL_LINE_DOWN _T("linedown") // one line down/right -#define wxACTION_SCROLL_PAGE_DOWN _T("pagedown") // one page down/right - -// the scrollbar thumb may be dragged -#define wxACTION_SCROLL_THUMB_DRAG _T("thumbdrag") -#define wxACTION_SCROLL_THUMB_MOVE _T("thumbmove") -#define wxACTION_SCROLL_THUMB_RELEASE _T("thumbrelease") - -// ---------------------------------------------------------------------------- -// wxScrollBar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollBar : public wxScrollBarBase, - public wxControlWithArrows -{ -public: - // scrollbar elements: they correspond to wxHT_SCROLLBAR_XXX constants but - // start from 0 which allows to use them as array indices - enum Element - { - Element_Arrow_Line_1, - Element_Arrow_Line_2, - Element_Arrow_Page_1, - Element_Arrow_Page_2, - Element_Thumb, - Element_Bar_1, - Element_Bar_2, - Element_Max - }; - - wxScrollBar(); - wxScrollBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - - virtual ~wxScrollBar(); - - // implement base class pure virtuals - virtual int GetThumbPosition() const; - virtual int GetThumbSize() const; - virtual int GetPageSize() const; - virtual int GetRange() const; - - virtual void SetThumbPosition(int thumbPos); - virtual void SetScrollbar(int position, int thumbSize, - int range, int pageSize, - bool refresh = true); - - // wxScrollBar actions - void ScrollToStart(); - void ScrollToEnd(); - bool ScrollLines(int nLines); - bool ScrollPages(int nPages); - - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - // scrollbars around a normal window should not receive the focus - virtual bool AcceptsFocus() const; - - // wxScrollBar sub elements state (combination of wxCONTROL_XXX) - void SetState(Element which, int flags); - int GetState(Element which) const; - - // implement wxControlWithArrows methods - virtual wxRenderer *GetRenderer() const { return m_renderer; } - virtual wxWindow *GetWindow() { return this; } - virtual bool IsVertical() const { return wxScrollBarBase::IsVertical(); } - virtual int GetArrowState(wxScrollArrows::Arrow arrow) const; - virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set); - virtual bool OnArrow(wxScrollArrows::Arrow arrow); - virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const; - - // for wxControlRenderer::DrawScrollbar() only - const wxScrollArrows& GetArrows() const { return m_arrows; } - - // returns one of wxHT_SCROLLBAR_XXX constants - wxHitTest HitTestBar(const wxPoint& pt) const; - - // idle processing - virtual void OnInternalIdle(); - -protected: - virtual wxSize DoGetBestClientSize() const; - virtual void DoDraw(wxControlRenderer *renderer); - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - // forces update of thumb's visual appearence (does nothing if m_dirty=false) - void UpdateThumb(); - - // SetThumbPosition() helper - void DoSetThumb(int thumbPos); - - // common part of all ctors - void Init(); - - // is this scrollbar attached to a window or a standalone control? - bool IsStandalone() const; - - // scrollbar geometry methods: - - // gets the bounding box for a scrollbar element for the given (by default - // - current) thumb position - wxRect GetScrollbarRect(wxScrollBar::Element elem, int thumbPos = -1) const; - - // returns the size of the scrollbar shaft excluding the arrows - wxCoord GetScrollbarSize() const; - - // translate the scrollbar position (in logical units) into physical - // coordinate (in pixels) and the other way round - wxCoord ScrollbarToPixel(int thumbPos = -1); - int PixelToScrollbar(wxCoord coord); - - // return the starting and ending positions, in pixels, of the thumb of a - // scrollbar with the given logical position, thumb size and range and the - // given physical length - static void GetScrollBarThumbSize(wxCoord length, - int thumbPos, - int thumbSize, - int range, - wxCoord *thumbStart, - wxCoord *thumbEnd); - -private: - // total range of the scrollbar in logical units - int m_range; - - // the current and previous (after last refresh - this is used for - // repainting optimisation) size of the thumb in logical units (from 0 to - // m_range) and its position (from 0 to m_range - m_thumbSize) - int m_thumbSize, - m_thumbPos, - m_thumbPosOld; - - // the page size, i.e. the number of lines by which to scroll when page - // up/down action is performed - int m_pageSize; - - // the state of the sub elements - int m_elementsState[Element_Max]; - - // the dirty flag: if set, scrollbar must be updated - bool m_dirty; - - // the object handling the arrows - wxScrollArrows m_arrows; - - friend WXDLLEXPORT class wxControlRenderer; // for geometry methods - friend class wxStdScrollBarInputHandler; // for geometry methods - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxScrollBar) -}; - -// ---------------------------------------------------------------------------- -// Standard scrollbar input handler which can be used as a base class -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStdScrollBarInputHandler : public wxStdInputHandler -{ -public: - // constructor takes a renderer (used for scrollbar hit testing) and the - // base handler to which all unhandled events are forwarded - wxStdScrollBarInputHandler(wxRenderer *renderer, - wxInputHandler *inphand); - - virtual bool HandleKey(wxInputConsumer *consumer, - const wxKeyEvent& event, - bool pressed); - virtual bool HandleMouse(wxInputConsumer *consumer, - const wxMouseEvent& event); - virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event); - - virtual ~wxStdScrollBarInputHandler(); - - // this method is called by wxScrollBarTimer only and may be overridden - // - // return true to continue scrolling, false to stop the timer - virtual bool OnScrollTimer(wxScrollBar *scrollbar, - const wxControlAction& action); - -protected: - // return true if the mouse button can be used to activate scrollbar, false - // if not (any button under GTK+ unlike left button only which is default) - virtual bool IsAllowedButton(int button) const - { return button == wxMOUSE_BTN_LEFT; } - - // set or clear the specified flag on the scrollbar element corresponding - // to m_htLast - void SetElementState(wxScrollBar *scrollbar, int flag, bool doIt); - - // [un]highlight the scrollbar element corresponding to m_htLast - virtual void Highlight(wxScrollBar *scrollbar, bool doIt) - { SetElementState(scrollbar, wxCONTROL_CURRENT, doIt); } - - // [un]press the scrollbar element corresponding to m_htLast - virtual void Press(wxScrollBar *scrollbar, bool doIt) - { SetElementState(scrollbar, wxCONTROL_PRESSED, doIt); } - - // stop scrolling because we reached the end point - void StopScrolling(wxScrollBar *scrollbar); - - // get the mouse coordinates in the scrollbar direction from the event - wxCoord GetMouseCoord(const wxScrollBar *scrollbar, - const wxMouseEvent& event) const; - - // generate a "thumb move" action for this mouse event - void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event); - - - // the window (scrollbar) which has capture or NULL and the flag telling if - // the mouse is inside the element which captured it or not - wxWindow *m_winCapture; - bool m_winHasMouse; - int m_btnCapture; // the mouse button which has captured mouse - - // the position where we started scrolling by page - wxPoint m_ptStartScrolling; - - // one of wxHT_SCROLLBAR_XXX value: where has the mouse been last time? - wxHitTest m_htLast; - - // the renderer (we use it only for hit testing) - wxRenderer *m_renderer; - - // the offset of the top/left of the scrollbar relative to the mouse to - // keep during the thumb drag - int m_ofsMouse; - - // the timer for generating scroll events when the mouse stays pressed on - // a scrollbar - wxScrollTimer *m_timerScroll; -}; - -#endif // _WX_UNIV_SCROLBAR_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrolbar.h +// Purpose: wxScrollBar for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.08.00 +// RCS-ID: $Id: scrolbar.h 42716 2006-10-30 12:33:25Z VS $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCROLBAR_H_ +#define _WX_UNIV_SCROLBAR_H_ + +class WXDLLEXPORT wxScrollTimer; + +#include "wx/univ/scrarrow.h" +#include "wx/renderer.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// scroll the bar +#define wxACTION_SCROLL_START _T("start") // to the beginning +#define wxACTION_SCROLL_END _T("end") // to the end +#define wxACTION_SCROLL_LINE_UP _T("lineup") // one line up/left +#define wxACTION_SCROLL_PAGE_UP _T("pageup") // one page up/left +#define wxACTION_SCROLL_LINE_DOWN _T("linedown") // one line down/right +#define wxACTION_SCROLL_PAGE_DOWN _T("pagedown") // one page down/right + +// the scrollbar thumb may be dragged +#define wxACTION_SCROLL_THUMB_DRAG _T("thumbdrag") +#define wxACTION_SCROLL_THUMB_MOVE _T("thumbmove") +#define wxACTION_SCROLL_THUMB_RELEASE _T("thumbrelease") + +// ---------------------------------------------------------------------------- +// wxScrollBar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrollBar : public wxScrollBarBase, + public wxControlWithArrows +{ +public: + // scrollbar elements: they correspond to wxHT_SCROLLBAR_XXX constants but + // start from 0 which allows to use them as array indices + enum Element + { + Element_Arrow_Line_1, + Element_Arrow_Line_2, + Element_Arrow_Page_1, + Element_Arrow_Page_2, + Element_Thumb, + Element_Bar_1, + Element_Bar_2, + Element_Max + }; + + wxScrollBar(); + wxScrollBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr); + + virtual ~wxScrollBar(); + + // implement base class pure virtuals + virtual int GetThumbPosition() const; + virtual int GetThumbSize() const; + virtual int GetPageSize() const; + virtual int GetRange() const; + + virtual void SetThumbPosition(int thumbPos); + virtual void SetScrollbar(int position, int thumbSize, + int range, int pageSize, + bool refresh = true); + + // wxScrollBar actions + void ScrollToStart(); + void ScrollToEnd(); + bool ScrollLines(int nLines); + bool ScrollPages(int nPages); + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + // scrollbars around a normal window should not receive the focus + virtual bool AcceptsFocus() const; + + // wxScrollBar sub elements state (combination of wxCONTROL_XXX) + void SetState(Element which, int flags); + int GetState(Element which) const; + + // implement wxControlWithArrows methods + virtual wxRenderer *GetRenderer() const { return m_renderer; } + virtual wxWindow *GetWindow() { return this; } + virtual bool IsVertical() const { return wxScrollBarBase::IsVertical(); } + virtual int GetArrowState(wxScrollArrows::Arrow arrow) const; + virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set); + virtual bool OnArrow(wxScrollArrows::Arrow arrow); + virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const; + + // for wxControlRenderer::DrawScrollbar() only + const wxScrollArrows& GetArrows() const { return m_arrows; } + + // returns one of wxHT_SCROLLBAR_XXX constants + wxHitTest HitTestBar(const wxPoint& pt) const; + + // idle processing + virtual void OnInternalIdle(); + +protected: + virtual wxSize DoGetBestClientSize() const; + virtual void DoDraw(wxControlRenderer *renderer); + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + // forces update of thumb's visual appearence (does nothing if m_dirty=false) + void UpdateThumb(); + + // SetThumbPosition() helper + void DoSetThumb(int thumbPos); + + // common part of all ctors + void Init(); + + // is this scrollbar attached to a window or a standalone control? + bool IsStandalone() const; + + // scrollbar geometry methods: + + // gets the bounding box for a scrollbar element for the given (by default + // - current) thumb position + wxRect GetScrollbarRect(wxScrollBar::Element elem, int thumbPos = -1) const; + + // returns the size of the scrollbar shaft excluding the arrows + wxCoord GetScrollbarSize() const; + + // translate the scrollbar position (in logical units) into physical + // coordinate (in pixels) and the other way round + wxCoord ScrollbarToPixel(int thumbPos = -1); + int PixelToScrollbar(wxCoord coord); + + // return the starting and ending positions, in pixels, of the thumb of a + // scrollbar with the given logical position, thumb size and range and the + // given physical length + static void GetScrollBarThumbSize(wxCoord length, + int thumbPos, + int thumbSize, + int range, + wxCoord *thumbStart, + wxCoord *thumbEnd); + +private: + // total range of the scrollbar in logical units + int m_range; + + // the current and previous (after last refresh - this is used for + // repainting optimisation) size of the thumb in logical units (from 0 to + // m_range) and its position (from 0 to m_range - m_thumbSize) + int m_thumbSize, + m_thumbPos, + m_thumbPosOld; + + // the page size, i.e. the number of lines by which to scroll when page + // up/down action is performed + int m_pageSize; + + // the state of the sub elements + int m_elementsState[Element_Max]; + + // the dirty flag: if set, scrollbar must be updated + bool m_dirty; + + // the object handling the arrows + wxScrollArrows m_arrows; + + friend WXDLLEXPORT class wxControlRenderer; // for geometry methods + friend class wxStdScrollBarInputHandler; // for geometry methods + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxScrollBar) +}; + +// ---------------------------------------------------------------------------- +// Standard scrollbar input handler which can be used as a base class +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStdScrollBarInputHandler : public wxStdInputHandler +{ +public: + // constructor takes a renderer (used for scrollbar hit testing) and the + // base handler to which all unhandled events are forwarded + wxStdScrollBarInputHandler(wxRenderer *renderer, + wxInputHandler *inphand); + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed); + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event); + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event); + + virtual ~wxStdScrollBarInputHandler(); + + // this method is called by wxScrollBarTimer only and may be overridden + // + // return true to continue scrolling, false to stop the timer + virtual bool OnScrollTimer(wxScrollBar *scrollbar, + const wxControlAction& action); + +protected: + // return true if the mouse button can be used to activate scrollbar, false + // if not (any button under GTK+ unlike left button only which is default) + virtual bool IsAllowedButton(int button) const + { return button == wxMOUSE_BTN_LEFT; } + + // set or clear the specified flag on the scrollbar element corresponding + // to m_htLast + void SetElementState(wxScrollBar *scrollbar, int flag, bool doIt); + + // [un]highlight the scrollbar element corresponding to m_htLast + virtual void Highlight(wxScrollBar *scrollbar, bool doIt) + { SetElementState(scrollbar, wxCONTROL_CURRENT, doIt); } + + // [un]press the scrollbar element corresponding to m_htLast + virtual void Press(wxScrollBar *scrollbar, bool doIt) + { SetElementState(scrollbar, wxCONTROL_PRESSED, doIt); } + + // stop scrolling because we reached the end point + void StopScrolling(wxScrollBar *scrollbar); + + // get the mouse coordinates in the scrollbar direction from the event + wxCoord GetMouseCoord(const wxScrollBar *scrollbar, + const wxMouseEvent& event) const; + + // generate a "thumb move" action for this mouse event + void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event); + + + // the window (scrollbar) which has capture or NULL and the flag telling if + // the mouse is inside the element which captured it or not + wxWindow *m_winCapture; + bool m_winHasMouse; + int m_btnCapture; // the mouse button which has captured mouse + + // the position where we started scrolling by page + wxPoint m_ptStartScrolling; + + // one of wxHT_SCROLLBAR_XXX value: where has the mouse been last time? + wxHitTest m_htLast; + + // the renderer (we use it only for hit testing) + wxRenderer *m_renderer; + + // the offset of the top/left of the scrollbar relative to the mouse to + // keep during the thumb drag + int m_ofsMouse; + + // the timer for generating scroll events when the mouse stays pressed on + // a scrollbar + wxScrollTimer *m_timerScroll; +}; + +#endif // _WX_UNIV_SCROLBAR_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/scrthumb.h b/Externals/wxWidgets/include/wx/univ/scrthumb.h index 6bb4d2627c..91d2a0c09f 100644 --- a/Externals/wxWidgets/include/wx/univ/scrthumb.h +++ b/Externals/wxWidgets/include/wx/univ/scrthumb.h @@ -1,140 +1,140 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/scrthumb.h -// Purpose: wxScrollThumb class -// Author: Vadim Zeitlin -// Modified by: -// Created: 12.02.01 -// RCS-ID: $Id: scrthumb.h 37168 2006-01-26 19:35:32Z ABX $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SCRTHUMB_H_ -#define _WX_UNIV_SCRTHUMB_H_ - -// ---------------------------------------------------------------------------- -// wxScrollThumb is not a control but just a class containing the common -// functionality of scroll thumb such as used by scrollbars, sliders and maybe -// other (user) controls -// -// This class is similar to wxScrollThumb. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlWithThumb; -class WXDLLEXPORT wxMouseEvent; -class WXDLLEXPORT wxRect; -class WXDLLEXPORT wxScrollTimer; - -#include "wx/timer.h" - -// ---------------------------------------------------------------------------- -// wxScrollThumb: an abstraction of scrollbar thumb -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollThumb -{ -public: - enum Shaft - { - Shaft_None = -1, - Shaft_Above, // or to the left of the thumb - Shaft_Below, // or to the right of the thumb - Shaft_Thumb, // on the thumb - Shaft_Max - }; - - // ctor requires a back pointer to wxControlWithThumb - wxScrollThumb(wxControlWithThumb *control); - - // process a mouse click: will capture the mouse if the button was pressed - // on either the thumb (start dragging it then) or the shaft (start - // scrolling) - bool HandleMouse(const wxMouseEvent& event) const; - - // process a mouse move - bool HandleMouseMove(const wxMouseEvent& event) const; - - // dtor - ~wxScrollThumb(); - -private: - // do we have the mouse capture? - bool HasCapture() const { return m_captureData != NULL; } - - // get the coord of this event in the direction we're interested in (y for - // vertical shaft or x for horizontal ones) - wxCoord GetMouseCoord(const wxMouseEvent& event) const; - - // get the position of the thumb corresponding to the current mouse - // position (can only be called while we're dragging the thumb!) - int GetThumbPos(const wxMouseEvent& event) const; - - // the main control - wxControlWithThumb *m_control; - - // the part of it where the mouse currently is - Shaft m_shaftPart; - - // the data for the mouse capture - struct WXDLLEXPORT wxScrollThumbCaptureData *m_captureData; -}; - -// ---------------------------------------------------------------------------- -// wxControlWithThumb: interface implemented by controls using wxScrollThumb -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxControlWithThumb -{ -public: - virtual ~wxControlWithThumb() {} - - // simple accessors - // ---------------- - - // get the controls window (used for mouse capturing) - virtual wxWindow *GetWindow() = 0; - - // get the orientation of the shaft (vertical or horizontal) - virtual bool IsVertical() const = 0; - - // geometry functions - // ------------------ - - // hit testing: return part of the shaft the point is in (or Shaft_None) - virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const = 0; - - // get the current position in pixels of the thumb - virtual wxCoord ThumbPosToPixel() const = 0; - - // transform from pixel offset to the thumb logical position - virtual int PixelToThumbPos(wxCoord x) const = 0; - - // callbacks - // --------- - - // set or clear the specified flag in the arrow state: this function is - // responsible for refreshing the control - virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart, - int flag, - bool set = true) = 0; - - // called when the user starts dragging the thumb - virtual void OnThumbDragStart(int pos) = 0; - - // called while the user drags the thumb - virtual void OnThumbDrag(int pos) = 0; - - // called when the user stops dragging the thumb - virtual void OnThumbDragEnd(int pos) = 0; - - // called before starting to call OnPageScroll() - gives the control the - // possibility to remember its current state - virtual void OnPageScrollStart() = 0; - - // called while the user keeps the mouse pressed above/below the thumb, - // return true to continue scrollign and false to stop it (e.g. because the - // scrollbar has reached the top/bottom) - virtual bool OnPageScroll(int pageInc) = 0; -}; - -#endif // _WX_UNIV_SCRTHUMB_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrthumb.h +// Purpose: wxScrollThumb class +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.02.01 +// RCS-ID: $Id: scrthumb.h 37168 2006-01-26 19:35:32Z ABX $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCRTHUMB_H_ +#define _WX_UNIV_SCRTHUMB_H_ + +// ---------------------------------------------------------------------------- +// wxScrollThumb is not a control but just a class containing the common +// functionality of scroll thumb such as used by scrollbars, sliders and maybe +// other (user) controls +// +// This class is similar to wxScrollThumb. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlWithThumb; +class WXDLLEXPORT wxMouseEvent; +class WXDLLEXPORT wxRect; +class WXDLLEXPORT wxScrollTimer; + +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxScrollThumb: an abstraction of scrollbar thumb +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrollThumb +{ +public: + enum Shaft + { + Shaft_None = -1, + Shaft_Above, // or to the left of the thumb + Shaft_Below, // or to the right of the thumb + Shaft_Thumb, // on the thumb + Shaft_Max + }; + + // ctor requires a back pointer to wxControlWithThumb + wxScrollThumb(wxControlWithThumb *control); + + // process a mouse click: will capture the mouse if the button was pressed + // on either the thumb (start dragging it then) or the shaft (start + // scrolling) + bool HandleMouse(const wxMouseEvent& event) const; + + // process a mouse move + bool HandleMouseMove(const wxMouseEvent& event) const; + + // dtor + ~wxScrollThumb(); + +private: + // do we have the mouse capture? + bool HasCapture() const { return m_captureData != NULL; } + + // get the coord of this event in the direction we're interested in (y for + // vertical shaft or x for horizontal ones) + wxCoord GetMouseCoord(const wxMouseEvent& event) const; + + // get the position of the thumb corresponding to the current mouse + // position (can only be called while we're dragging the thumb!) + int GetThumbPos(const wxMouseEvent& event) const; + + // the main control + wxControlWithThumb *m_control; + + // the part of it where the mouse currently is + Shaft m_shaftPart; + + // the data for the mouse capture + struct WXDLLEXPORT wxScrollThumbCaptureData *m_captureData; +}; + +// ---------------------------------------------------------------------------- +// wxControlWithThumb: interface implemented by controls using wxScrollThumb +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxControlWithThumb +{ +public: + virtual ~wxControlWithThumb() {} + + // simple accessors + // ---------------- + + // get the controls window (used for mouse capturing) + virtual wxWindow *GetWindow() = 0; + + // get the orientation of the shaft (vertical or horizontal) + virtual bool IsVertical() const = 0; + + // geometry functions + // ------------------ + + // hit testing: return part of the shaft the point is in (or Shaft_None) + virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const = 0; + + // get the current position in pixels of the thumb + virtual wxCoord ThumbPosToPixel() const = 0; + + // transform from pixel offset to the thumb logical position + virtual int PixelToThumbPos(wxCoord x) const = 0; + + // callbacks + // --------- + + // set or clear the specified flag in the arrow state: this function is + // responsible for refreshing the control + virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart, + int flag, + bool set = true) = 0; + + // called when the user starts dragging the thumb + virtual void OnThumbDragStart(int pos) = 0; + + // called while the user drags the thumb + virtual void OnThumbDrag(int pos) = 0; + + // called when the user stops dragging the thumb + virtual void OnThumbDragEnd(int pos) = 0; + + // called before starting to call OnPageScroll() - gives the control the + // possibility to remember its current state + virtual void OnPageScrollStart() = 0; + + // called while the user keeps the mouse pressed above/below the thumb, + // return true to continue scrollign and false to stop it (e.g. because the + // scrollbar has reached the top/bottom) + virtual bool OnPageScroll(int pageInc) = 0; +}; + +#endif // _WX_UNIV_SCRTHUMB_H_ diff --git a/Externals/wxWidgets/include/wx/univ/scrtimer.h b/Externals/wxWidgets/include/wx/univ/scrtimer.h index bb16f465b9..36799ac282 100644 --- a/Externals/wxWidgets/include/wx/univ/scrtimer.h +++ b/Externals/wxWidgets/include/wx/univ/scrtimer.h @@ -1,51 +1,51 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/scrtimer.h -// Purpose: wxScrollTimer: small helper class for wxScrollArrow/Thumb -// Author: Vadim Zeitlin -// Modified by: -// Created: 18.02.01 -// RCS-ID: $Id: scrtimer.h 39633 2006-06-08 11:25:30Z ABX $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SCRTIMER_H -#define _WX_UNIV_SCRTIMER_H - -// NB: this class is implemented in scrolbar.cpp - -#include "wx/defs.h" - -#if wxUSE_TIMER - -#include "wx/timer.h" - -// ---------------------------------------------------------------------------- -// wxScrollTimer: the timer used when the arrow or scrollbar shaft is kept -// pressed -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxScrollTimer : public wxTimer -{ -public: - // default ctor - wxScrollTimer(); - - // start generating the events - void StartAutoScroll(); - - // the base class method - virtual void Notify(); - -protected: - // to implement in derived classes: perform the scroll action and return - // true to continue scrolling or false to stop - virtual bool DoNotify() = 0; - - // should we skip the next timer event? - bool m_skipNext; -}; - -#endif // wxUSE_TIMER - -#endif // _WX_UNIV_SCRTIMER_H +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrtimer.h +// Purpose: wxScrollTimer: small helper class for wxScrollArrow/Thumb +// Author: Vadim Zeitlin +// Modified by: +// Created: 18.02.01 +// RCS-ID: $Id: scrtimer.h 39633 2006-06-08 11:25:30Z ABX $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCRTIMER_H +#define _WX_UNIV_SCRTIMER_H + +// NB: this class is implemented in scrolbar.cpp + +#include "wx/defs.h" + +#if wxUSE_TIMER + +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxScrollTimer: the timer used when the arrow or scrollbar shaft is kept +// pressed +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxScrollTimer : public wxTimer +{ +public: + // default ctor + wxScrollTimer(); + + // start generating the events + void StartAutoScroll(); + + // the base class method + virtual void Notify(); + +protected: + // to implement in derived classes: perform the scroll action and return + // true to continue scrolling or false to stop + virtual bool DoNotify() = 0; + + // should we skip the next timer event? + bool m_skipNext; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_UNIV_SCRTIMER_H diff --git a/Externals/wxWidgets/include/wx/univ/setup0.h b/Externals/wxWidgets/include/wx/univ/setup0.h index c4cd190747..39b9cba8d5 100644 --- a/Externals/wxWidgets/include/wx/univ/setup0.h +++ b/Externals/wxWidgets/include/wx/univ/setup0.h @@ -1,1328 +1,1328 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/setup.h -// Purpose: configuration settings for wxUniversal/MSW -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.08.00 -// RCS-ID: $Id: setup0.h 49997 2007-11-16 16:14:49Z CE $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SETUP_H_ -#define _WX_UNIV_SETUP_H_ - -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it -// -// Default is 0. -// -// Recommended setting: 0 (please update your code instead!) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. -// If migrating between versions, your dialogs may seem to shrink. -// -// Default is 1 -// -// Recommended setting: 0 (the new calculations are more correct!) -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#ifdef __MWERKS__ - #define wxUSE_DEBUG_CONTEXT 1 -#else - #define wxUSE_DEBUG_CONTEXT 0 -#endif - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#ifdef _MSC_VER - #define wxUSE_ON_FATAL_EXCEPTION 1 -#else - #define wxUSE_ON_FATAL_EXCEPTION 0 -#endif - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP (Windows 9x -// doesn't support it and the programs compiled in Unicode mode will not run -// under 9x). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Set wxUSE_UNICODE_MSLU to 1 if you want to compile wxWidgets in Unicode mode -// and be able to run compiled apps under Windows 9x as well as NT/2000/XP. This -// setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/Articles/mslu_announce.asp). Note that you -// will have to modify the makefiles to include unicows.lib import library as the first -// library (if you use MSVC, you can run the makefile with "nmake MSLU=1 UNICODE=1" -// command). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_UNICODE_MSLU 0 - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 for win32 else 0 -#if defined(__WIN32__) || defined(__WATCOMC__) - #define wxUSE_WCHAR_T 1 -#else - #define wxUSE_WCHAR_T 0 -#endif - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_EXTENDED_RTTI 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// This is ignored under Win16, threads are only supported under Win32. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled (1), compiles wxWidgets streams classes -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1. If 0, use wxWin streams implementation. -#ifdef __MWERKS__ - #define wxUSE_STD_IOSTREAM 1 -#else - #define wxUSE_STD_IOSTREAM 0 -#endif - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// wxUSE_TIMEDATE enables compilation of the old wxDate and wxTime classes (not -// the same as wxDateTime!). These classes are obsolete and shouldn't be used -// in new code -// -// Default is 0 -// -// Recommended setting: 0 unless you have legacy code which uses these classes -#define wxUSE_TIMEDATE 0 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 0 (universal should not use native) -#if defined(__WIN32__) - #define wxUSE_CONFIG_NATIVE 0 -#else - #define wxUSE_CONFIG_NATIVE 0 -#endif - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#if defined(__WIN32__) - #define wxUSE_DIALUP_MANAGER 1 -#else - #define wxUSE_DIALUP_MANAGER 0 -#endif - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#if defined(__WIN32__) - #define wxUSE_DYNLIB_CLASS 1 -#else - #define wxUSE_DYNLIB_CLASS 0 -#endif - -// experimental, don't use for now -#if defined(__WIN32__) - #define wxUSE_DYNAMIC_LOADER 1 -#else - #define wxUSE_DYNAMIC_LOADER 0 -#endif - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#if defined(__WIN32__) - #define wxUSE_JOYSTICK 1 -#else - #define wxUSE_JOYSTICK 1 -#endif - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use QuickTime -// -// Default is 0 -// -// Recommended setting: 1 if you have the QT SDK installed and you need it, else 0 -#define wxUSE_QUICKTIME 0 - -// Use DirectShow -// -// Default is 0 -// -// Recommended setting: 1 if the DirectX 7 SDK is installed (highly recommended), else 0 -#define wxUSE_DIRECTSHOW 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is 1 -// -// Recommended setting: 1 (required by XRC) -#if wxUSE_XRC -# define wxUSE_XML 1 -#else -# define wxUSE_XML 0 -#endif - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 0 - -// Set to 1 to auto-adapt to MS Windows XP themes where possible -// (notably, wxNotebook pages) -#define wxUSE_UXTHEME_AUTO 0 - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // wxToggleButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 0. -// -// Recommended setting: 0 -#define wxUSE_NATIVE_STATUSBAR 0 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 0 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and 0 for wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 0 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used ot logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxProperty[Value/Form/List] classes, used by Dialog Editor -#define wxUSE_PROPSHEET 1 - - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// working with them. -// -// Default is 0 because it isn't yet implemented on all platforms -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 0 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 0 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#ifdef __WIN32__ - #define wxUSE_TOOLTIPS 1 -#else - #define wxUSE_TOOLTIPS 0 -#endif - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable the use of DIB's for wxBitmap to support -// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. -#define wxUSE_DIB_FOR_BITMAP 0 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#if defined(__WIN32__) - #define wxUSE_FILEDLG 1 -#else - #define wxUSE_FILEDLG 1 -#endif - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#if defined(__WIN32__) - #define wxUSE_METAFILE 1 - #define wxUSE_ENH_METAFILE 1 - #define wxUSE_WIN_METAFILES_ALWAYS 0 -#else - #define wxUSE_METAFILE 0 - #define wxUSE_ENH_METAFILE 0 - #define wxUSE_WIN_METAFILES_ALWAYS 0 -#endif - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#if defined(__WIN32__) - #define wxUSE_GLCANVAS 1 -#else - #define wxUSE_GLCANVAS 0 -#endif - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// wxTreeLayout class -#define wxUSE_TREELAYOUT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 for WIN32 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#if defined(__WIN32__) - #define wxUSE_DRAG_AND_DROP 1 -#else - #define wxUSE_DRAG_AND_DROP 0 -#endif - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running (it is only available under Win32) -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#if defined(__WIN32__) - #define wxUSE_SNGLINST_CHECKER 1 -#else - #define wxUSE_SNGLINST_CHECKER 0 -#endif - -// Drag image -#define wxUSE_DRAGIMAGE 1 - -// Interprocess communication -#define wxUSE_IPC 1 - -// Help -#if defined(__WIN32__) - #define wxUSE_HELP 1 -#else - #define wxUSE_HELP 1 -#endif - -// MS help -#define wxUSE_MS_HTML_HELP 1 - -// Use wxHTML-based help controller -#define wxUSE_WXHTML_HELP 1 - -// Use resources -#define wxUSE_RESOURCES 0 - -// Window layout constraint system -#define wxUSE_CONSTRAINTS 1 - -// Splines -#define wxUSE_SPLINES 1 - -// Include mouse wheel support -#define wxUSE_MOUSEWHEEL 1 - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 1 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 1 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 0 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix -// them. Set to 1 for <iostream.h>, 0 for <iostream> -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#ifdef __MWERKS__ - #define wxUSE_IOSTREAMH 1 -#else - #define wxUSE_IOSTREAMH 0 -#endif - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 0 - -// Set to 1 to compile in wxPalette class - #define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- -#if defined(__WINDOWS__) - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 for WIN32 - #define wxUSE_OLE 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#if defined(__WIN32__) - #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 -#else - #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 -#endif - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile <richedit.h> -#if defined(__WIN95__) && !defined(__WINE__) && !defined(__GNUWIN32_OLD__) -// TODO: This should be ifdef'ed for any compilers that don't support -// RichEdit 2.0 but do have RichEdit 1.0... - #define wxUSE_RICHEDIT 0 // currently not supported - #define wxUSE_RICHEDIT2 0 // currently not supported - -#else - #define wxUSE_RICHEDIT 0 - #define wxUSE_RICHEDIT2 0 -#endif - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 0 - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 - -#endif - -// ---------------------------------------------------------------------------- -// unknown settings -// ---------------------------------------------------------------------------- - -// If 1, enables provision of run-time type information. -// NOW MANDATORY: don't change. -#define wxUSE_DYNAMIC_CLASSES 1 - -//?????? -#if defined(__WIN32__) - #define wxUSE_DDE_FOR_IPC 0 -#else - #define wxUSE_DDE_FOR_IPC 0 -#endif - -#endif // _WX_UNIV_SETUP_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/setup.h +// Purpose: configuration settings for wxUniversal/MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// RCS-ID: $Id: setup0.h 49997 2007-11-16 16:14:49Z CE $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SETUP_H_ +#define _WX_UNIV_SETUP_H_ + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it +// +// Default is 0. +// +// Recommended setting: 0 (please update your code instead!) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. +// If migrating between versions, your dialogs may seem to shrink. +// +// Default is 1 +// +// Recommended setting: 0 (the new calculations are more correct!) +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#ifdef __MWERKS__ + #define wxUSE_DEBUG_CONTEXT 1 +#else + #define wxUSE_DEBUG_CONTEXT 0 +#endif + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#ifdef _MSC_VER + #define wxUSE_ON_FATAL_EXCEPTION 1 +#else + #define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP (Windows 9x +// doesn't support it and the programs compiled in Unicode mode will not run +// under 9x). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Set wxUSE_UNICODE_MSLU to 1 if you want to compile wxWidgets in Unicode mode +// and be able to run compiled apps under Windows 9x as well as NT/2000/XP. This +// setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/Articles/mslu_announce.asp). Note that you +// will have to modify the makefiles to include unicows.lib import library as the first +// library (if you use MSVC, you can run the makefile with "nmake MSLU=1 UNICODE=1" +// command). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_UNICODE_MSLU 0 + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 for win32 else 0 +#if defined(__WIN32__) || defined(__WATCOMC__) + #define wxUSE_WCHAR_T 1 +#else + #define wxUSE_WCHAR_T 0 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list<Foo*> and std::vector<Foo*>, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// This is ignored under Win16, threads are only supported under Win32. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled (1), compiles wxWidgets streams classes +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1. If 0, use wxWin streams implementation. +#ifdef __MWERKS__ + #define wxUSE_STD_IOSTREAM 1 +#else + #define wxUSE_STD_IOSTREAM 0 +#endif + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// wxUSE_TIMEDATE enables compilation of the old wxDate and wxTime classes (not +// the same as wxDateTime!). These classes are obsolete and shouldn't be used +// in new code +// +// Default is 0 +// +// Recommended setting: 0 unless you have legacy code which uses these classes +#define wxUSE_TIMEDATE 0 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 0 (universal should not use native) +#if defined(__WIN32__) + #define wxUSE_CONFIG_NATIVE 0 +#else + #define wxUSE_CONFIG_NATIVE 0 +#endif + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#if defined(__WIN32__) + #define wxUSE_DIALUP_MANAGER 1 +#else + #define wxUSE_DIALUP_MANAGER 0 +#endif + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#if defined(__WIN32__) + #define wxUSE_DYNLIB_CLASS 1 +#else + #define wxUSE_DYNLIB_CLASS 0 +#endif + +// experimental, don't use for now +#if defined(__WIN32__) + #define wxUSE_DYNAMIC_LOADER 1 +#else + #define wxUSE_DYNAMIC_LOADER 0 +#endif + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#if defined(__WIN32__) + #define wxUSE_JOYSTICK 1 +#else + #define wxUSE_JOYSTICK 1 +#endif + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use QuickTime +// +// Default is 0 +// +// Recommended setting: 1 if you have the QT SDK installed and you need it, else 0 +#define wxUSE_QUICKTIME 0 + +// Use DirectShow +// +// Default is 0 +// +// Recommended setting: 1 if the DirectX 7 SDK is installed (highly recommended), else 0 +#define wxUSE_DIRECTSHOW 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#if wxUSE_XRC +# define wxUSE_XML 1 +#else +# define wxUSE_XML 0 +#endif + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 0 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 0 + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // wxToggleButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 0. +// +// Recommended setting: 0 +#define wxUSE_NATIVE_STATUSBAR 0 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 0 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and 0 for wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 0 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxProperty[Value/Form/List] classes, used by Dialog Editor +#define wxUSE_PROPSHEET 1 + + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// working with them. +// +// Default is 0 because it isn't yet implemented on all platforms +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 0 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 0 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#ifdef __WIN32__ + #define wxUSE_TOOLTIPS 1 +#else + #define wxUSE_TOOLTIPS 0 +#endif + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#if defined(__WIN32__) + #define wxUSE_FILEDLG 1 +#else + #define wxUSE_FILEDLG 1 +#endif + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#if defined(__WIN32__) + #define wxUSE_METAFILE 1 + #define wxUSE_ENH_METAFILE 1 + #define wxUSE_WIN_METAFILES_ALWAYS 0 +#else + #define wxUSE_METAFILE 0 + #define wxUSE_ENH_METAFILE 0 + #define wxUSE_WIN_METAFILES_ALWAYS 0 +#endif + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#if defined(__WIN32__) + #define wxUSE_GLCANVAS 1 +#else + #define wxUSE_GLCANVAS 0 +#endif + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// wxTreeLayout class +#define wxUSE_TREELAYOUT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 for WIN32 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#if defined(__WIN32__) + #define wxUSE_DRAG_AND_DROP 1 +#else + #define wxUSE_DRAG_AND_DROP 0 +#endif + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#if defined(__WIN32__) + #define wxUSE_SNGLINST_CHECKER 1 +#else + #define wxUSE_SNGLINST_CHECKER 0 +#endif + +// Drag image +#define wxUSE_DRAGIMAGE 1 + +// Interprocess communication +#define wxUSE_IPC 1 + +// Help +#if defined(__WIN32__) + #define wxUSE_HELP 1 +#else + #define wxUSE_HELP 1 +#endif + +// MS help +#define wxUSE_MS_HTML_HELP 1 + +// Use wxHTML-based help controller +#define wxUSE_WXHTML_HELP 1 + +// Use resources +#define wxUSE_RESOURCES 0 + +// Window layout constraint system +#define wxUSE_CONSTRAINTS 1 + +// Splines +#define wxUSE_SPLINES 1 + +// Include mouse wheel support +#define wxUSE_MOUSEWHEEL 1 + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 1 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 1 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 0 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix +// them. Set to 1 for <iostream.h>, 0 for <iostream> +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#ifdef __MWERKS__ + #define wxUSE_IOSTREAMH 1 +#else + #define wxUSE_IOSTREAMH 0 +#endif + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 0 + +// Set to 1 to compile in wxPalette class + #define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- +#if defined(__WINDOWS__) + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 for WIN32 + #define wxUSE_OLE 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#if defined(__WIN32__) + #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 +#else + #define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 +#endif + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#if defined(__WIN95__) && !defined(__WINE__) && !defined(__GNUWIN32_OLD__) +// TODO: This should be ifdef'ed for any compilers that don't support +// RichEdit 2.0 but do have RichEdit 1.0... + #define wxUSE_RICHEDIT 0 // currently not supported + #define wxUSE_RICHEDIT2 0 // currently not supported + +#else + #define wxUSE_RICHEDIT 0 + #define wxUSE_RICHEDIT2 0 +#endif + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 0 + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 + +#endif + +// ---------------------------------------------------------------------------- +// unknown settings +// ---------------------------------------------------------------------------- + +// If 1, enables provision of run-time type information. +// NOW MANDATORY: don't change. +#define wxUSE_DYNAMIC_CLASSES 1 + +//?????? +#if defined(__WIN32__) + #define wxUSE_DDE_FOR_IPC 0 +#else + #define wxUSE_DDE_FOR_IPC 0 +#endif + +#endif // _WX_UNIV_SETUP_H_ diff --git a/Externals/wxWidgets/include/wx/univ/slider.h b/Externals/wxWidgets/include/wx/univ/slider.h index b1ba9bfdde..d5d5e4f0ce 100644 --- a/Externals/wxWidgets/include/wx/univ/slider.h +++ b/Externals/wxWidgets/include/wx/univ/slider.h @@ -1,226 +1,226 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/slider.h -// Purpose: wxSlider control for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 09.02.01 -// RCS-ID: $Id: slider.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SLIDER_H_ -#define _WX_UNIV_SLIDER_H_ - -#include "wx/univ/scrthumb.h" - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -// our actions are the same as scrollbars - -#define wxACTION_SLIDER_START _T("start") // to the beginning -#define wxACTION_SLIDER_END _T("end") // to the end -#define wxACTION_SLIDER_LINE_UP _T("lineup") // one line up/left -#define wxACTION_SLIDER_PAGE_UP _T("pageup") // one page up/left -#define wxACTION_SLIDER_LINE_DOWN _T("linedown") // one line down/right -#define wxACTION_SLIDER_PAGE_DOWN _T("pagedown") // one page down/right -#define wxACTION_SLIDER_PAGE_CHANGE _T("pagechange")// change page by numArg - -#define wxACTION_SLIDER_THUMB_DRAG _T("thumbdrag") -#define wxACTION_SLIDER_THUMB_MOVE _T("thumbmove") -#define wxACTION_SLIDER_THUMB_RELEASE _T("thumbrelease") - -// ---------------------------------------------------------------------------- -// wxSlider -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxSlider : public wxSliderBase, - public wxControlWithThumb -{ -public: - // ctors and such - wxSlider(); - - wxSlider(wxWindow *parent, - wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - // implement base class pure virtuals - virtual int GetValue() const; - virtual void SetValue(int value); - - virtual void SetRange(int minValue, int maxValue); - virtual int GetMin() const; - virtual int GetMax() const; - - virtual void SetLineSize(int lineSize); - virtual void SetPageSize(int pageSize); - virtual int GetLineSize() const; - virtual int GetPageSize() const; - - virtual void SetThumbLength(int lenPixels); - virtual int GetThumbLength() const; - - virtual void SetTickFreq(int n, int WXUNUSED(dummy) = 0); - virtual int GetTickFreq() const { return m_tickFreq; } - - // wxUniv-specific methods - // ----------------------- - - // is this a vertical slider? - bool IsVert() const { return (GetWindowStyle() & wxSL_VERTICAL) != 0; } - - // get the slider orientation - wxOrientation GetOrientation() const - { return IsVert() ? wxVERTICAL : wxHORIZONTAL; } - - // do we have labels? - bool HasLabels() const - { return ((GetWindowStyle() & wxSL_LABELS) != 0) && - ((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT)) != 0); } - - // do we have ticks? - bool HasTicks() const - { return ((GetWindowStyle() & wxSL_TICKS) != 0) && - ((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT|wxSL_BOTH)) != 0); } - - // implement wxControlWithThumb interface - virtual wxWindow *GetWindow() { return this; } - virtual bool IsVertical() const { return IsVert(); } - - virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const; - virtual wxCoord ThumbPosToPixel() const; - virtual int PixelToThumbPos(wxCoord x) const; - - virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart, - int flag, - bool set = true); - - virtual void OnThumbDragStart(int pos); - virtual void OnThumbDrag(int pos); - virtual void OnThumbDragEnd(int pos); - virtual void OnPageScrollStart(); - virtual bool OnPageScroll(int pageInc); - - // for wxStdSliderInputHandler - wxScrollThumb& GetThumb() { return m_thumb; } - - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - -protected: - enum - { - INVALID_THUMB_VALUE = -0xffff - }; - - // overridden base class virtuals - virtual wxSize DoGetBestClientSize() const; - virtual void DoDraw(wxControlRenderer *renderer); - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - // event handlers - void OnSize(wxSizeEvent& event); - - // common part of all ctors - void Init(); - - // normalize the value to fit in the range - int NormalizeValue(int value) const; - - // change the value by the given increment, return true if really changed - bool ChangeValueBy(int inc); - - // change the value to the given one - bool ChangeValueTo(int value); - - // is the value inside the range? - bool IsInRange(int value) { return (value >= m_min) && (value <= m_max); } - - // format the value for printing as label - virtual wxString FormatValue(int value) const; - - // calculate max label size - wxSize CalcLabelSize() const; - - // calculate m_rectLabel/Slider - void CalcGeometry(); - - // get the thumb size - wxSize GetThumbSize() const; - - // get the shaft rect (uses m_rectSlider which is supposed to be calculated) - wxRect GetShaftRect() const; - - // calc the current thumb position using the shaft rect (if the pointer is - // NULL, we calculate it here too) - void CalcThumbRect(const wxRect *rectShaft, - wxRect *rectThumbOut, - wxRect *rectLabelOut, - int value = INVALID_THUMB_VALUE) const; - - // return the slider rect calculating it if needed - const wxRect& GetSliderRect() const; - - // refresh the current thumb position - void RefreshThumb(); - -private: - // get the default thumb size (without using m_thumbSize) - wxSize GetDefaultThumbSize() const; - - // the object which manages our thumb - wxScrollThumb m_thumb; - - // the slider range and value - int m_min, - m_max, - m_value; - - // the tick frequence (default is 1) - int m_tickFreq; - - // the line and page increments (logical units) - int m_lineSize, - m_pageSize; - - // the size of the thumb (in pixels) - int m_thumbSize; - - // the part of the client area reserved for the label, the ticks and the - // part for the slider itself - wxRect m_rectLabel, - m_rectTicks, - m_rectSlider; - - // the state of the thumb (wxCONTROL_XXX constants sum) - int m_thumbFlags; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxSlider) -}; - -#endif // _WX_UNIV_SLIDER_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/slider.h +// Purpose: wxSlider control for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 09.02.01 +// RCS-ID: $Id: slider.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SLIDER_H_ +#define _WX_UNIV_SLIDER_H_ + +#include "wx/univ/scrthumb.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// our actions are the same as scrollbars + +#define wxACTION_SLIDER_START _T("start") // to the beginning +#define wxACTION_SLIDER_END _T("end") // to the end +#define wxACTION_SLIDER_LINE_UP _T("lineup") // one line up/left +#define wxACTION_SLIDER_PAGE_UP _T("pageup") // one page up/left +#define wxACTION_SLIDER_LINE_DOWN _T("linedown") // one line down/right +#define wxACTION_SLIDER_PAGE_DOWN _T("pagedown") // one page down/right +#define wxACTION_SLIDER_PAGE_CHANGE _T("pagechange")// change page by numArg + +#define wxACTION_SLIDER_THUMB_DRAG _T("thumbdrag") +#define wxACTION_SLIDER_THUMB_MOVE _T("thumbmove") +#define wxACTION_SLIDER_THUMB_RELEASE _T("thumbrelease") + +// ---------------------------------------------------------------------------- +// wxSlider +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSlider : public wxSliderBase, + public wxControlWithThumb +{ +public: + // ctors and such + wxSlider(); + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + // implement base class pure virtuals + virtual int GetValue() const; + virtual void SetValue(int value); + + virtual void SetRange(int minValue, int maxValue); + virtual int GetMin() const; + virtual int GetMax() const; + + virtual void SetLineSize(int lineSize); + virtual void SetPageSize(int pageSize); + virtual int GetLineSize() const; + virtual int GetPageSize() const; + + virtual void SetThumbLength(int lenPixels); + virtual int GetThumbLength() const; + + virtual void SetTickFreq(int n, int WXUNUSED(dummy) = 0); + virtual int GetTickFreq() const { return m_tickFreq; } + + // wxUniv-specific methods + // ----------------------- + + // is this a vertical slider? + bool IsVert() const { return (GetWindowStyle() & wxSL_VERTICAL) != 0; } + + // get the slider orientation + wxOrientation GetOrientation() const + { return IsVert() ? wxVERTICAL : wxHORIZONTAL; } + + // do we have labels? + bool HasLabels() const + { return ((GetWindowStyle() & wxSL_LABELS) != 0) && + ((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT)) != 0); } + + // do we have ticks? + bool HasTicks() const + { return ((GetWindowStyle() & wxSL_TICKS) != 0) && + ((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT|wxSL_BOTH)) != 0); } + + // implement wxControlWithThumb interface + virtual wxWindow *GetWindow() { return this; } + virtual bool IsVertical() const { return IsVert(); } + + virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const; + virtual wxCoord ThumbPosToPixel() const; + virtual int PixelToThumbPos(wxCoord x) const; + + virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart, + int flag, + bool set = true); + + virtual void OnThumbDragStart(int pos); + virtual void OnThumbDrag(int pos); + virtual void OnThumbDragEnd(int pos); + virtual void OnPageScrollStart(); + virtual bool OnPageScroll(int pageInc); + + // for wxStdSliderInputHandler + wxScrollThumb& GetThumb() { return m_thumb; } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + +protected: + enum + { + INVALID_THUMB_VALUE = -0xffff + }; + + // overridden base class virtuals + virtual wxSize DoGetBestClientSize() const; + virtual void DoDraw(wxControlRenderer *renderer); + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + // event handlers + void OnSize(wxSizeEvent& event); + + // common part of all ctors + void Init(); + + // normalize the value to fit in the range + int NormalizeValue(int value) const; + + // change the value by the given increment, return true if really changed + bool ChangeValueBy(int inc); + + // change the value to the given one + bool ChangeValueTo(int value); + + // is the value inside the range? + bool IsInRange(int value) { return (value >= m_min) && (value <= m_max); } + + // format the value for printing as label + virtual wxString FormatValue(int value) const; + + // calculate max label size + wxSize CalcLabelSize() const; + + // calculate m_rectLabel/Slider + void CalcGeometry(); + + // get the thumb size + wxSize GetThumbSize() const; + + // get the shaft rect (uses m_rectSlider which is supposed to be calculated) + wxRect GetShaftRect() const; + + // calc the current thumb position using the shaft rect (if the pointer is + // NULL, we calculate it here too) + void CalcThumbRect(const wxRect *rectShaft, + wxRect *rectThumbOut, + wxRect *rectLabelOut, + int value = INVALID_THUMB_VALUE) const; + + // return the slider rect calculating it if needed + const wxRect& GetSliderRect() const; + + // refresh the current thumb position + void RefreshThumb(); + +private: + // get the default thumb size (without using m_thumbSize) + wxSize GetDefaultThumbSize() const; + + // the object which manages our thumb + wxScrollThumb m_thumb; + + // the slider range and value + int m_min, + m_max, + m_value; + + // the tick frequence (default is 1) + int m_tickFreq; + + // the line and page increments (logical units) + int m_lineSize, + m_pageSize; + + // the size of the thumb (in pixels) + int m_thumbSize; + + // the part of the client area reserved for the label, the ticks and the + // part for the slider itself + wxRect m_rectLabel, + m_rectTicks, + m_rectSlider; + + // the state of the thumb (wxCONTROL_XXX constants sum) + int m_thumbFlags; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxSlider) +}; + +#endif // _WX_UNIV_SLIDER_H_ diff --git a/Externals/wxWidgets/include/wx/univ/spinbutt.h b/Externals/wxWidgets/include/wx/univ/spinbutt.h index 88f76d90bf..4b483d8ee8 100644 --- a/Externals/wxWidgets/include/wx/univ/spinbutt.h +++ b/Externals/wxWidgets/include/wx/univ/spinbutt.h @@ -1,122 +1,122 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/spinbutt.h -// Purpose: universal version of wxSpinButton -// Author: Vadim Zeitlin -// Modified by: -// Created: 21.01.01 -// RCS-ID: $Id: spinbutt.h 42715 2006-10-30 12:24:13Z VS $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_SPINBUTT_H_ -#define _WX_UNIV_SPINBUTT_H_ - -#include "wx/univ/scrarrow.h" - -// ---------------------------------------------------------------------------- -// wxSpinButton -// ---------------------------------------------------------------------------- - -// actions supported by this control -#define wxACTION_SPIN_INC _T("inc") -#define wxACTION_SPIN_DEC _T("dec") - -class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase, - public wxControlWithArrows -{ -public: - wxSpinButton(); - wxSpinButton(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME); - - // implement wxSpinButtonBase methods - virtual int GetValue() const; - virtual void SetValue(int val); - virtual void SetRange(int minVal, int maxVal); - - // implement wxControlWithArrows methods - virtual wxRenderer *GetRenderer() const { return m_renderer; } - virtual wxWindow *GetWindow() { return this; } - virtual bool IsVertical() const { return wxSpinButtonBase::IsVertical(); } - virtual int GetArrowState(wxScrollArrows::Arrow arrow) const; - virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set); - virtual bool OnArrow(wxScrollArrows::Arrow arrow); - virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const; - - // for wxStdSpinButtonInputHandler - const wxScrollArrows& GetArrows() { return m_arrows; } - - virtual bool PerformAction(const wxControlAction& action, - long numArg = 0, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - -protected: - virtual wxSize DoGetBestClientSize() const; - virtual void DoDraw(wxControlRenderer *renderer); - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - - // the common part of all ctors - void Init(); - - // normalize the value to fit into min..max range - int NormalizeValue(int value) const; - - // change the value by +1/-1 and send the event, return true if value was - // changed - bool ChangeValue(int inc); - - // get the rectangles for our 2 arrows - void CalcArrowRects(wxRect *rect1, wxRect *rect2) const; - - // the current controls value - int m_value; - -private: - // the object which manages our arrows - wxScrollArrows m_arrows; - - // the state (combination of wxCONTROL_XXX flags) of the arrows - int m_arrowsState[wxScrollArrows::Arrow_Max]; - - DECLARE_DYNAMIC_CLASS(wxSpinButton) -}; - -// ---------------------------------------------------------------------------- -// wxStdSpinButtonInputHandler: manages clicks on them (use arrows like -// wxStdScrollBarInputHandler) and processes keyboard events too -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStdSpinButtonInputHandler : public wxStdInputHandler -{ -public: - wxStdSpinButtonInputHandler(wxInputHandler *inphand); - - virtual bool HandleKey(wxInputConsumer *consumer, - const wxKeyEvent& event, - bool pressed); - virtual bool HandleMouse(wxInputConsumer *consumer, - const wxMouseEvent& event); - virtual bool HandleMouseMove(wxInputConsumer *consumer, - const wxMouseEvent& event); -}; - -#endif // _WX_UNIV_SPINBUTT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/spinbutt.h +// Purpose: universal version of wxSpinButton +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.01.01 +// RCS-ID: $Id: spinbutt.h 42715 2006-10-30 12:24:13Z VS $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SPINBUTT_H_ +#define _WX_UNIV_SPINBUTT_H_ + +#include "wx/univ/scrarrow.h" + +// ---------------------------------------------------------------------------- +// wxSpinButton +// ---------------------------------------------------------------------------- + +// actions supported by this control +#define wxACTION_SPIN_INC _T("inc") +#define wxACTION_SPIN_DEC _T("dec") + +class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase, + public wxControlWithArrows +{ +public: + wxSpinButton(); + wxSpinButton(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME); + + // implement wxSpinButtonBase methods + virtual int GetValue() const; + virtual void SetValue(int val); + virtual void SetRange(int minVal, int maxVal); + + // implement wxControlWithArrows methods + virtual wxRenderer *GetRenderer() const { return m_renderer; } + virtual wxWindow *GetWindow() { return this; } + virtual bool IsVertical() const { return wxSpinButtonBase::IsVertical(); } + virtual int GetArrowState(wxScrollArrows::Arrow arrow) const; + virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set); + virtual bool OnArrow(wxScrollArrows::Arrow arrow); + virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const; + + // for wxStdSpinButtonInputHandler + const wxScrollArrows& GetArrows() { return m_arrows; } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + +protected: + virtual wxSize DoGetBestClientSize() const; + virtual void DoDraw(wxControlRenderer *renderer); + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + // the common part of all ctors + void Init(); + + // normalize the value to fit into min..max range + int NormalizeValue(int value) const; + + // change the value by +1/-1 and send the event, return true if value was + // changed + bool ChangeValue(int inc); + + // get the rectangles for our 2 arrows + void CalcArrowRects(wxRect *rect1, wxRect *rect2) const; + + // the current controls value + int m_value; + +private: + // the object which manages our arrows + wxScrollArrows m_arrows; + + // the state (combination of wxCONTROL_XXX flags) of the arrows + int m_arrowsState[wxScrollArrows::Arrow_Max]; + + DECLARE_DYNAMIC_CLASS(wxSpinButton) +}; + +// ---------------------------------------------------------------------------- +// wxStdSpinButtonInputHandler: manages clicks on them (use arrows like +// wxStdScrollBarInputHandler) and processes keyboard events too +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStdSpinButtonInputHandler : public wxStdInputHandler +{ +public: + wxStdSpinButtonInputHandler(wxInputHandler *inphand); + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed); + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event); + virtual bool HandleMouseMove(wxInputConsumer *consumer, + const wxMouseEvent& event); +}; + +#endif // _WX_UNIV_SPINBUTT_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/statbmp.h b/Externals/wxWidgets/include/wx/univ/statbmp.h index cf3e215191..05a9b2aedf 100644 --- a/Externals/wxWidgets/include/wx/univ/statbmp.h +++ b/Externals/wxWidgets/include/wx/univ/statbmp.h @@ -1,74 +1,74 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/statbmp.h -// Purpose: wxStaticBitmap class for wxUniversal -// Author: Vadim Zeitlin -// Modified by: -// Created: 25.08.00 -// RCS-ID: $Id: statbmp.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_STATBMP_H_ -#define _WX_UNIV_STATBMP_H_ - -#include "wx/bitmap.h" - -// ---------------------------------------------------------------------------- -// wxStaticBitmap -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase -{ -public: - wxStaticBitmap() - { - } - - wxStaticBitmap(wxWindow *parent, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0) - { - Create(parent, wxID_ANY, label, pos, size, style); - } - - wxStaticBitmap(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr); - - virtual void SetBitmap(const wxBitmap& bitmap); - virtual void SetIcon(const wxIcon& icon); - virtual wxBitmap GetBitmap() const { return m_bitmap; } - - wxIcon GetIcon() const; - - virtual bool HasTransparentBackground() { return true; } - -protected: - virtual void DoDraw(wxControlRenderer *renderer); - -private: - // the bitmap which we show - wxBitmap m_bitmap; - - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) -}; - -#endif // _WX_UNIV_STATBMP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statbmp.h +// Purpose: wxStaticBitmap class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// RCS-ID: $Id: statbmp.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATBMP_H_ +#define _WX_UNIV_STATBMP_H_ + +#include "wx/bitmap.h" + +// ---------------------------------------------------------------------------- +// wxStaticBitmap +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() + { + } + + wxStaticBitmap(wxWindow *parent, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0) + { + Create(parent, wxID_ANY, label, pos, size, style); + } + + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual void SetBitmap(const wxBitmap& bitmap); + virtual void SetIcon(const wxIcon& icon); + virtual wxBitmap GetBitmap() const { return m_bitmap; } + + wxIcon GetIcon() const; + + virtual bool HasTransparentBackground() { return true; } + +protected: + virtual void DoDraw(wxControlRenderer *renderer); + +private: + // the bitmap which we show + wxBitmap m_bitmap; + + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) +}; + +#endif // _WX_UNIV_STATBMP_H_ diff --git a/Externals/wxWidgets/include/wx/univ/statbox.h b/Externals/wxWidgets/include/wx/univ/statbox.h index 075519bdc3..f732dc1eb9 100644 --- a/Externals/wxWidgets/include/wx/univ/statbox.h +++ b/Externals/wxWidgets/include/wx/univ/statbox.h @@ -1,65 +1,65 @@ -////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/statbox.h -// Purpose: wxStaticBox declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 15.08.00 -// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_STATBOX_H_ -#define _WX_UNIV_STATBOX_H_ - -class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase -{ -public: - wxStaticBox() { } - - wxStaticBox(wxWindow *parent, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize) - { - Create(parent, wxID_ANY, label, pos, size); - } - - wxStaticBox(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr); - - // the origin of the static box is inside the border and under the label: - // take account of this - virtual wxPoint GetBoxAreaOrigin() const; - - // returning true from here ensures that we act as a container window for - // our children - virtual bool IsStaticBox() const { return true; } - -protected: - // draw the control - virtual void DoDraw(wxControlRenderer *renderer); - - // get the size of the border - wxRect GetBorderGeometry() const; - -private: - DECLARE_DYNAMIC_CLASS(wxStaticBox) -}; - -#endif // _WX_UNIV_STATBOX_H_ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statbox.h +// Purpose: wxStaticBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.08.00 +// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATBOX_H_ +#define _WX_UNIV_STATBOX_H_ + +class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox() { } + + wxStaticBox(wxWindow *parent, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize) + { + Create(parent, wxID_ANY, label, pos, size); + } + + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr); + + // the origin of the static box is inside the border and under the label: + // take account of this + virtual wxPoint GetBoxAreaOrigin() const; + + // returning true from here ensures that we act as a container window for + // our children + virtual bool IsStaticBox() const { return true; } + +protected: + // draw the control + virtual void DoDraw(wxControlRenderer *renderer); + + // get the size of the border + wxRect GetBorderGeometry() const; + +private: + DECLARE_DYNAMIC_CLASS(wxStaticBox) +}; + +#endif // _WX_UNIV_STATBOX_H_ diff --git a/Externals/wxWidgets/include/wx/univ/statline.h b/Externals/wxWidgets/include/wx/univ/statline.h index 063a51cdc8..bd49470174 100644 --- a/Externals/wxWidgets/include/wx/univ/statline.h +++ b/Externals/wxWidgets/include/wx/univ/statline.h @@ -1,56 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/statline.h -// Purpose: wxStaticLine class for wxUniversal -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_STATLINE_H_ -#define _WX_UNIV_STATLINE_H_ - -class WXDLLEXPORT wxStaticLine : public wxStaticLineBase -{ -public: - // constructors and pseudo-constructors - wxStaticLine() { } - - wxStaticLine(wxWindow *parent, - const wxPoint &pos, - wxCoord length, - long style = wxLI_HORIZONTAL) - { - Create(parent, wxID_ANY, pos, - style & wxLI_VERTICAL ? wxSize(wxDefaultCoord, length) - : wxSize(length, wxDefaultCoord), - style); - } - - wxStaticLine(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ) - { - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ); - -protected: - virtual void DoDraw(wxControlRenderer *renderer); - -private: - DECLARE_DYNAMIC_CLASS(wxStaticLine) -}; - -#endif // _WX_UNIV_STATLINE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statline.h +// Purpose: wxStaticLine class for wxUniversal +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATLINE_H_ +#define _WX_UNIV_STATLINE_H_ + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine(wxWindow *parent, + const wxPoint &pos, + wxCoord length, + long style = wxLI_HORIZONTAL) + { + Create(parent, wxID_ANY, pos, + style & wxLI_VERTICAL ? wxSize(wxDefaultCoord, length) + : wxSize(length, wxDefaultCoord), + style); + } + + wxStaticLine(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ); + +protected: + virtual void DoDraw(wxControlRenderer *renderer); + +private: + DECLARE_DYNAMIC_CLASS(wxStaticLine) +}; + +#endif // _WX_UNIV_STATLINE_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/stattext.h b/Externals/wxWidgets/include/wx/univ/stattext.h index ec3520ff24..d5e210d133 100644 --- a/Externals/wxWidgets/include/wx/univ/stattext.h +++ b/Externals/wxWidgets/include/wx/univ/stattext.h @@ -1,66 +1,66 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/stattext.h -// Purpose: wxStaticText -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.08.00 -// RCS-ID: $Id: stattext.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_STATTEXT_H_ -#define _WX_UNIV_STATTEXT_H_ - -class WXDLLEXPORT wxStaticText : public wxStaticTextBase -{ -public: - wxStaticText() { } - - // usual ctor - wxStaticText(wxWindow *parent, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize) - { - Create(parent, wxID_ANY, label, pos, size, 0, wxStaticTextNameStr); - } - - // full form - wxStaticText(wxWindow *parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString &name = wxStaticTextNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - // function ctor - bool Create(wxWindow *parent, - wxWindowID id, - const wxString &label, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = 0, - const wxString &name = wxStaticTextNameStr); - - // implementation only from now on - - virtual void SetLabel(const wxString& label); - - virtual bool IsFocused() const { return false; } - -protected: - // calculate the optimal size for the label - virtual wxSize DoGetBestClientSize() const; - - // draw the control - virtual void DoDraw(wxControlRenderer *renderer); - - DECLARE_ABSTRACT_CLASS(wxStaticText) -}; - -#endif // _WX_UNIV_STATTEXT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/stattext.h +// Purpose: wxStaticText +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// RCS-ID: $Id: stattext.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATTEXT_H_ +#define _WX_UNIV_STATTEXT_H_ + +class WXDLLEXPORT wxStaticText : public wxStaticTextBase +{ +public: + wxStaticText() { } + + // usual ctor + wxStaticText(wxWindow *parent, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize) + { + Create(parent, wxID_ANY, label, pos, size, 0, wxStaticTextNameStr); + } + + // full form + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString &name = wxStaticTextNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + // function ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxStaticTextNameStr); + + // implementation only from now on + + virtual void SetLabel(const wxString& label); + + virtual bool IsFocused() const { return false; } + +protected: + // calculate the optimal size for the label + virtual wxSize DoGetBestClientSize() const; + + // draw the control + virtual void DoDraw(wxControlRenderer *renderer); + + DECLARE_ABSTRACT_CLASS(wxStaticText) +}; + +#endif // _WX_UNIV_STATTEXT_H_ diff --git a/Externals/wxWidgets/include/wx/univ/statusbr.h b/Externals/wxWidgets/include/wx/univ/statusbr.h index 8c636cc54e..eb657b0e43 100644 --- a/Externals/wxWidgets/include/wx/univ/statusbr.h +++ b/Externals/wxWidgets/include/wx/univ/statusbr.h @@ -1,110 +1,110 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/statusbr.h -// Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration -// Author: Vadim Zeitlin -// Modified by: -// Created: 14.10.01 -// RCS-ID: $Id: statusbr.h 37393 2006-02-08 21:47:09Z VZ $ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_STATUSBR_H_ -#define _WX_UNIV_STATUSBR_H_ - -#include "wx/univ/inpcons.h" -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// wxStatusBar: a window near the bottom of the frame used for status info -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStatusBarUniv : public wxStatusBarBase, - public wxInputConsumer -{ -public: - wxStatusBarUniv() { Init(); } - - wxStatusBarUniv(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - - (void)Create(parent, id, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - long style = 0, - const wxString& name = wxPanelNameStr); - - // set field count/widths - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); - virtual void SetStatusWidths(int n, const int widths[]); - - // get/set the text of the given field - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; - - // Get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const; - - // sets the minimal vertical size of the status bar - virtual void SetMinHeight(int height); - - // get the dimensions of the horizontal and vertical borders - virtual int GetBorderX() const; - virtual int GetBorderY() const; - - // wxInputConsumer pure virtual - virtual wxWindow *GetInputWindow() const - { return wx_const_cast(wxStatusBar*, this); } - -protected: - // recalculate the field widths - void OnSize(wxSizeEvent& event); - - // draw the statusbar - virtual void DoDraw(wxControlRenderer *renderer); - - // tell them about our preferred height - virtual wxSize DoGetBestSize() const; - - // override DoSetSize() to prevent the status bar height from changing - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - // get the (fixed) status bar height - wxCoord GetHeight() const; - - // get the rectangle containing all the fields and the border between them - // - // also updates m_widthsAbs if necessary - wxRect GetTotalFieldRect(wxCoord *borderBetweenFields); - - // get the rect for this field without ani side effects (see code) - wxRect DoGetFieldRect(int n) const; - - // refresh the given field - void RefreshField(int i); - - // common part of all ctors - void Init(); - -private: - // the status fields strings - wxArrayString m_statusText; - - // the absolute status fields widths - wxArrayInt m_widthsAbs; - - DECLARE_DYNAMIC_CLASS(wxStatusBarUniv) - DECLARE_EVENT_TABLE() - WX_DECLARE_INPUT_CONSUMER() -}; - -#endif // _WX_UNIV_STATUSBR_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statusbr.h +// Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.10.01 +// RCS-ID: $Id: statusbr.h 37393 2006-02-08 21:47:09Z VZ $ +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATUSBR_H_ +#define _WX_UNIV_STATUSBR_H_ + +#include "wx/univ/inpcons.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// wxStatusBar: a window near the bottom of the frame used for status info +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStatusBarUniv : public wxStatusBarBase, + public wxInputConsumer +{ +public: + wxStatusBarUniv() { Init(); } + + wxStatusBarUniv(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + + (void)Create(parent, id, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = 0, + const wxString& name = wxPanelNameStr); + + // set field count/widths + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + virtual void SetStatusWidths(int n, const int widths[]); + + // get/set the text of the given field + virtual void SetStatusText(const wxString& text, int number = 0); + virtual wxString GetStatusText(int number = 0) const; + + // Get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const; + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height); + + // get the dimensions of the horizontal and vertical borders + virtual int GetBorderX() const; + virtual int GetBorderY() const; + + // wxInputConsumer pure virtual + virtual wxWindow *GetInputWindow() const + { return wx_const_cast(wxStatusBar*, this); } + +protected: + // recalculate the field widths + void OnSize(wxSizeEvent& event); + + // draw the statusbar + virtual void DoDraw(wxControlRenderer *renderer); + + // tell them about our preferred height + virtual wxSize DoGetBestSize() const; + + // override DoSetSize() to prevent the status bar height from changing + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // get the (fixed) status bar height + wxCoord GetHeight() const; + + // get the rectangle containing all the fields and the border between them + // + // also updates m_widthsAbs if necessary + wxRect GetTotalFieldRect(wxCoord *borderBetweenFields); + + // get the rect for this field without ani side effects (see code) + wxRect DoGetFieldRect(int n) const; + + // refresh the given field + void RefreshField(int i); + + // common part of all ctors + void Init(); + +private: + // the status fields strings + wxArrayString m_statusText; + + // the absolute status fields widths + wxArrayInt m_widthsAbs; + + DECLARE_DYNAMIC_CLASS(wxStatusBarUniv) + DECLARE_EVENT_TABLE() + WX_DECLARE_INPUT_CONSUMER() +}; + +#endif // _WX_UNIV_STATUSBR_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/stdrend.h b/Externals/wxWidgets/include/wx/univ/stdrend.h index 6c42a1113b..8994b37b83 100644 --- a/Externals/wxWidgets/include/wx/univ/stdrend.h +++ b/Externals/wxWidgets/include/wx/univ/stdrend.h @@ -1,352 +1,352 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/stdrend.h -// Purpose: wxStdRenderer class declaration -// Author: Vadim Zeitlin -// Created: 2006-09-18 -// RCS-ID: $Id: stdrend.h 42716 2006-10-30 12:33:25Z VS $ -// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_STDREND_H_ -#define _WX_UNIV_STDREND_H_ - -#include "wx/univ/renderer.h" -#include "wx/pen.h" - -class WXDLLEXPORT wxColourScheme; - -// ---------------------------------------------------------------------------- -// wxStdRenderer: implements as much of wxRenderer API as possible generically -// ---------------------------------------------------------------------------- - -class wxStdRenderer : public wxRenderer -{ -public: - // the renderer will use the given scheme, whose lifetime must be at least - // as long as of this object itself, to choose the colours for drawing - wxStdRenderer(const wxColourScheme *scheme); - - virtual void DrawBackground(wxDC& dc, - const wxColour& col, - const wxRect& rect, - int flags = 0, - wxWindow *window = NULL); - virtual void DrawButtonSurface(wxDC& dc, - const wxColour& col, - const wxRect& rect, - int flags); - - - virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0); - virtual void DrawLabel(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounds = NULL); - virtual void DrawButtonLabel(wxDC& dc, - const wxString& label, - const wxBitmap& image, - const wxRect& rect, - int flags = 0, - int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect *rectBounds = NULL); - - - virtual void DrawBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = NULL); - virtual void DrawTextBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = NULL); - - virtual void DrawHorizontalLine(wxDC& dc, - wxCoord y, wxCoord x1, wxCoord x2); - virtual void DrawVerticalLine(wxDC& dc, - wxCoord x, wxCoord y1, wxCoord y2); - virtual void DrawFrame(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0, - int alignment = wxALIGN_LEFT, - int indexAccel = -1); - - - virtual void DrawItem(wxDC& dc, - const wxString& label, - const wxRect& rect, - int flags = 0); - virtual void DrawCheckItem(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0); - - virtual void DrawCheckButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - wxAlignment align = wxALIGN_LEFT, - int indexAccel = -1); - virtual void DrawRadioButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags = 0, - wxAlignment align = wxALIGN_LEFT, - int indexAccel = -1); - - virtual void DrawScrollbarArrow(wxDC& dc, - wxDirection dir, - const wxRect& rect, - int flags = 0); - virtual void DrawScrollCorner(wxDC& dc, - const wxRect& rect); - -#if wxUSE_TEXTCTRL - virtual void DrawTextLine(wxDC& dc, - const wxString& text, - const wxRect& rect, - int selStart = -1, - int selEnd = -1, - int flags = 0); - - virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect); - - virtual wxRect GetTextTotalArea(const wxTextCtrl *text, - const wxRect& rect) const; - virtual wxRect GetTextClientArea(const wxTextCtrl *text, - const wxRect& rect, - wxCoord *extraSpaceBeyond) const; -#endif // wxUSE_TEXTCTRL - - virtual wxRect GetBorderDimensions(wxBorder border) const; - - virtual bool AreScrollbarsInsideBorder() const; - - virtual void AdjustSize(wxSize *size, const wxWindow *window); - - virtual wxCoord GetListboxItemHeight(wxCoord fontHeight); - -#if wxUSE_STATUSBAR - virtual void DrawStatusField(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags = 0, int style = 0); - - virtual wxSize GetStatusBarBorders() const; - - virtual wxCoord GetStatusBarBorderBetweenFields() const; - - virtual wxSize GetStatusBarFieldMargins() const; -#endif // wxUSE_STATUSBAR - - virtual wxCoord GetCheckItemMargin() const { return 0; } - - - virtual void DrawFrameTitleBar(wxDC& dc, - const wxRect& rect, - const wxString& title, - const wxIcon& icon, - int flags, - int specialButton = 0, - int specialButtonFlag = 0); - virtual void DrawFrameBorder(wxDC& dc, - const wxRect& rect, - int flags); - virtual void DrawFrameBackground(wxDC& dc, - const wxRect& rect, - int flags); - virtual void DrawFrameTitle(wxDC& dc, - const wxRect& rect, - const wxString& title, - int flags); - virtual void DrawFrameIcon(wxDC& dc, - const wxRect& rect, - const wxIcon& icon, - int flags); - virtual void DrawFrameButton(wxDC& dc, - wxCoord x, wxCoord y, - int button, - int flags = 0); - - virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const; - - virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const; - - virtual wxSize GetFrameMinSize(int flags) const; - - virtual wxSize GetFrameIconSize() const; - - virtual int HitTestFrame(const wxRect& rect, - const wxPoint& pt, - int flags = 0) const; -protected: - // various constants - enum ArrowDirection - { - Arrow_Left, - Arrow_Right, - Arrow_Up, - Arrow_Down, - Arrow_Max - }; - - enum ArrowStyle - { - Arrow_Normal, - Arrow_Disabled, - Arrow_Pressed, - Arrow_Inverted, - Arrow_InvertedDisabled, - Arrow_StateMax - }; - - enum FrameButtonType - { - FrameButton_Close, - FrameButton_Minimize, - FrameButton_Maximize, - FrameButton_Restore, - FrameButton_Help, - FrameButton_Max - }; - - enum IndicatorType - { - IndicatorType_Check, - IndicatorType_Radio, - IndicatorType_MaxCtrl, - IndicatorType_Menu = IndicatorType_MaxCtrl, - IndicatorType_Max - }; - - enum IndicatorState - { - IndicatorState_Normal, - IndicatorState_Pressed, // this one is for check/radioboxes - IndicatorState_Disabled, - IndicatorState_MaxCtrl, - - // the rest of the states are valid for menu items only - IndicatorState_Selected = IndicatorState_Pressed, - IndicatorState_SelectedDisabled = IndicatorState_MaxCtrl, - IndicatorState_MaxMenu - }; - - enum IndicatorStatus - { - IndicatorStatus_Checked, - IndicatorStatus_Unchecked, - IndicatorStatus_Undetermined, - IndicatorStatus_Max - }; - - // translate the appropriate bits in flags to the above enum elements - static void GetIndicatorsFromFlags(int flags, - IndicatorState& state, - IndicatorStatus& status); - - // translate wxDirection to ArrowDirection - static ArrowDirection GetArrowDirection(wxDirection dir); - - - // fill the rectangle with a brush of given colour (must be valid) - void DrawSolidRect(wxDC& dc, const wxColour& col, const wxRect& rect); - - - // all the functions in this section adjust the rect parameter to - // correspond to the interiour of the drawn area - - // draw complete rectangle - void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen); - - // draw the rectange using the first pen for the left and top sides - // and the second one for the bottom and right ones - void DrawShadedRect(wxDC& dc, wxRect *rect, - const wxPen& pen1, const wxPen& pen2); - - // border drawing routines, may be overridden in the derived class - virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect); - virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect); - virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect); - virtual void DrawBoxBorder(wxDC& dc, wxRect *rect); - virtual void DrawStaticBorder(wxDC& dc, wxRect *rect); - virtual void DrawExtraBorder(wxDC& dc, wxRect *rect); - - - // draw the frame with non-empty label inside the given rectText - virtual void DrawFrameWithLabel(wxDC& dc, - const wxString& label, - const wxRect& rectFrame, - const wxRect& rectText, - int flags, - int alignment, - int indexAccel); - - // draw the (static box) frame without the part corresponding to rectLabel - void DrawFrameWithoutLabel(wxDC& dc, - const wxRect& rectFrame, - const wxRect& rectLabel); - - - // draw the bitmap for a check item (which is by default the same as check - // box one but may be different) - virtual void DrawCheckItemBitmap(wxDC& dc, - const wxBitmap& bitmap, - const wxRect& rect, - int flags); - - // common routine for drawing check and radio buttons - void DrawCheckOrRadioButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags, - wxAlignment align, - int indexAccel); - - // return the check/radio bitmap for the given flags - virtual wxBitmap GetRadioBitmap(int flags) = 0; - virtual wxBitmap GetCheckBitmap(int flags) = 0; - - // return the frame icon bitmap - virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type) = 0; - - // get the width of either normal or resizeable frame border depending on - // whether flags contains wxTOPLEVEL_RESIZEABLE bit - // - // notice that these methods only make sense with standard border drawing - // code which uses the borders of the same width on all sides, this is why - // they are only present here and not in wxRenderer itself - virtual int GetFrameBorderWidth(int flags) const; - -#if wxUSE_TEXTCTRL - // return the width of the border around the text area in the text control - virtual int GetTextBorderWidth(const wxTextCtrl *text) const; -#endif // wxUSE_TEXTCTRL - - // GDI objects we often use - wxPen m_penBlack, - m_penDarkGrey, - m_penLightGrey, - m_penHighlight; - - wxFont m_titlebarFont; - - // the colours we use, they never change currently so we don't have to ever - // update m_penXXX objects above - const wxColourScheme * const m_scheme; - - DECLARE_NO_COPY_CLASS(wxStdRenderer) -}; - -#endif // _WX_UNIV_STDREND_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/stdrend.h +// Purpose: wxStdRenderer class declaration +// Author: Vadim Zeitlin +// Created: 2006-09-18 +// RCS-ID: $Id: stdrend.h 42716 2006-10-30 12:33:25Z VS $ +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STDREND_H_ +#define _WX_UNIV_STDREND_H_ + +#include "wx/univ/renderer.h" +#include "wx/pen.h" + +class WXDLLEXPORT wxColourScheme; + +// ---------------------------------------------------------------------------- +// wxStdRenderer: implements as much of wxRenderer API as possible generically +// ---------------------------------------------------------------------------- + +class wxStdRenderer : public wxRenderer +{ +public: + // the renderer will use the given scheme, whose lifetime must be at least + // as long as of this object itself, to choose the colours for drawing + wxStdRenderer(const wxColourScheme *scheme); + + virtual void DrawBackground(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags = 0, + wxWindow *window = NULL); + virtual void DrawButtonSurface(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags); + + + virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0); + virtual void DrawLabel(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL); + virtual void DrawButtonLabel(wxDC& dc, + const wxString& label, + const wxBitmap& image, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL); + + + virtual void DrawBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL); + virtual void DrawTextBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL); + + virtual void DrawHorizontalLine(wxDC& dc, + wxCoord y, wxCoord x1, wxCoord x2); + virtual void DrawVerticalLine(wxDC& dc, + wxCoord x, wxCoord y1, wxCoord y2); + virtual void DrawFrame(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT, + int indexAccel = -1); + + + virtual void DrawItem(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0); + virtual void DrawCheckItem(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0); + + virtual void DrawCheckButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1); + virtual void DrawRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1); + + virtual void DrawScrollbarArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0); + virtual void DrawScrollCorner(wxDC& dc, + const wxRect& rect); + +#if wxUSE_TEXTCTRL + virtual void DrawTextLine(wxDC& dc, + const wxString& text, + const wxRect& rect, + int selStart = -1, + int selEnd = -1, + int flags = 0); + + virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect); + + virtual wxRect GetTextTotalArea(const wxTextCtrl *text, + const wxRect& rect) const; + virtual wxRect GetTextClientArea(const wxTextCtrl *text, + const wxRect& rect, + wxCoord *extraSpaceBeyond) const; +#endif // wxUSE_TEXTCTRL + + virtual wxRect GetBorderDimensions(wxBorder border) const; + + virtual bool AreScrollbarsInsideBorder() const; + + virtual void AdjustSize(wxSize *size, const wxWindow *window); + + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight); + +#if wxUSE_STATUSBAR + virtual void DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, int style = 0); + + virtual wxSize GetStatusBarBorders() const; + + virtual wxCoord GetStatusBarBorderBetweenFields() const; + + virtual wxSize GetStatusBarFieldMargins() const; +#endif // wxUSE_STATUSBAR + + virtual wxCoord GetCheckItemMargin() const { return 0; } + + + virtual void DrawFrameTitleBar(wxDC& dc, + const wxRect& rect, + const wxString& title, + const wxIcon& icon, + int flags, + int specialButton = 0, + int specialButtonFlag = 0); + virtual void DrawFrameBorder(wxDC& dc, + const wxRect& rect, + int flags); + virtual void DrawFrameBackground(wxDC& dc, + const wxRect& rect, + int flags); + virtual void DrawFrameTitle(wxDC& dc, + const wxRect& rect, + const wxString& title, + int flags); + virtual void DrawFrameIcon(wxDC& dc, + const wxRect& rect, + const wxIcon& icon, + int flags); + virtual void DrawFrameButton(wxDC& dc, + wxCoord x, wxCoord y, + int button, + int flags = 0); + + virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const; + + virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const; + + virtual wxSize GetFrameMinSize(int flags) const; + + virtual wxSize GetFrameIconSize() const; + + virtual int HitTestFrame(const wxRect& rect, + const wxPoint& pt, + int flags = 0) const; +protected: + // various constants + enum ArrowDirection + { + Arrow_Left, + Arrow_Right, + Arrow_Up, + Arrow_Down, + Arrow_Max + }; + + enum ArrowStyle + { + Arrow_Normal, + Arrow_Disabled, + Arrow_Pressed, + Arrow_Inverted, + Arrow_InvertedDisabled, + Arrow_StateMax + }; + + enum FrameButtonType + { + FrameButton_Close, + FrameButton_Minimize, + FrameButton_Maximize, + FrameButton_Restore, + FrameButton_Help, + FrameButton_Max + }; + + enum IndicatorType + { + IndicatorType_Check, + IndicatorType_Radio, + IndicatorType_MaxCtrl, + IndicatorType_Menu = IndicatorType_MaxCtrl, + IndicatorType_Max + }; + + enum IndicatorState + { + IndicatorState_Normal, + IndicatorState_Pressed, // this one is for check/radioboxes + IndicatorState_Disabled, + IndicatorState_MaxCtrl, + + // the rest of the states are valid for menu items only + IndicatorState_Selected = IndicatorState_Pressed, + IndicatorState_SelectedDisabled = IndicatorState_MaxCtrl, + IndicatorState_MaxMenu + }; + + enum IndicatorStatus + { + IndicatorStatus_Checked, + IndicatorStatus_Unchecked, + IndicatorStatus_Undetermined, + IndicatorStatus_Max + }; + + // translate the appropriate bits in flags to the above enum elements + static void GetIndicatorsFromFlags(int flags, + IndicatorState& state, + IndicatorStatus& status); + + // translate wxDirection to ArrowDirection + static ArrowDirection GetArrowDirection(wxDirection dir); + + + // fill the rectangle with a brush of given colour (must be valid) + void DrawSolidRect(wxDC& dc, const wxColour& col, const wxRect& rect); + + + // all the functions in this section adjust the rect parameter to + // correspond to the interiour of the drawn area + + // draw complete rectangle + void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen); + + // draw the rectange using the first pen for the left and top sides + // and the second one for the bottom and right ones + void DrawShadedRect(wxDC& dc, wxRect *rect, + const wxPen& pen1, const wxPen& pen2); + + // border drawing routines, may be overridden in the derived class + virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect); + virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect); + virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect); + virtual void DrawBoxBorder(wxDC& dc, wxRect *rect); + virtual void DrawStaticBorder(wxDC& dc, wxRect *rect); + virtual void DrawExtraBorder(wxDC& dc, wxRect *rect); + + + // draw the frame with non-empty label inside the given rectText + virtual void DrawFrameWithLabel(wxDC& dc, + const wxString& label, + const wxRect& rectFrame, + const wxRect& rectText, + int flags, + int alignment, + int indexAccel); + + // draw the (static box) frame without the part corresponding to rectLabel + void DrawFrameWithoutLabel(wxDC& dc, + const wxRect& rectFrame, + const wxRect& rectLabel); + + + // draw the bitmap for a check item (which is by default the same as check + // box one but may be different) + virtual void DrawCheckItemBitmap(wxDC& dc, + const wxBitmap& bitmap, + const wxRect& rect, + int flags); + + // common routine for drawing check and radio buttons + void DrawCheckOrRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags, + wxAlignment align, + int indexAccel); + + // return the check/radio bitmap for the given flags + virtual wxBitmap GetRadioBitmap(int flags) = 0; + virtual wxBitmap GetCheckBitmap(int flags) = 0; + + // return the frame icon bitmap + virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type) = 0; + + // get the width of either normal or resizeable frame border depending on + // whether flags contains wxTOPLEVEL_RESIZEABLE bit + // + // notice that these methods only make sense with standard border drawing + // code which uses the borders of the same width on all sides, this is why + // they are only present here and not in wxRenderer itself + virtual int GetFrameBorderWidth(int flags) const; + +#if wxUSE_TEXTCTRL + // return the width of the border around the text area in the text control + virtual int GetTextBorderWidth(const wxTextCtrl *text) const; +#endif // wxUSE_TEXTCTRL + + // GDI objects we often use + wxPen m_penBlack, + m_penDarkGrey, + m_penLightGrey, + m_penHighlight; + + wxFont m_titlebarFont; + + // the colours we use, they never change currently so we don't have to ever + // update m_penXXX objects above + const wxColourScheme * const m_scheme; + + DECLARE_NO_COPY_CLASS(wxStdRenderer) +}; + +#endif // _WX_UNIV_STDREND_H_ diff --git a/Externals/wxWidgets/include/wx/univ/textctrl.h b/Externals/wxWidgets/include/wx/univ/textctrl.h index eea13b0808..5c309d81b9 100644 --- a/Externals/wxWidgets/include/wx/univ/textctrl.h +++ b/Externals/wxWidgets/include/wx/univ/textctrl.h @@ -1,534 +1,534 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/textctrl.h -// Purpose: wxTextCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 15.09.00 -// RCS-ID: $Id: textctrl.h 47170 2007-07-05 21:37:36Z VZ $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_TEXTCTRL_H_ -#define _WX_UNIV_TEXTCTRL_H_ - -class WXDLLEXPORT wxCaret; -class WXDLLEXPORT wxTextCtrlCommandProcessor; - -#include "wx/scrolwin.h" // for wxScrollHelper - -#include "wx/univ/inphand.h" - -// ---------------------------------------------------------------------------- -// wxTextCtrl actions -// ---------------------------------------------------------------------------- - -// cursor movement and also selection and delete operations -#define wxACTION_TEXT_GOTO _T("goto") // to pos in numArg -#define wxACTION_TEXT_FIRST _T("first") // go to pos 0 -#define wxACTION_TEXT_LAST _T("last") // go to last pos -#define wxACTION_TEXT_HOME _T("home") -#define wxACTION_TEXT_END _T("end") -#define wxACTION_TEXT_LEFT _T("left") -#define wxACTION_TEXT_RIGHT _T("right") -#define wxACTION_TEXT_UP _T("up") -#define wxACTION_TEXT_DOWN _T("down") -#define wxACTION_TEXT_WORD_LEFT _T("wordleft") -#define wxACTION_TEXT_WORD_RIGHT _T("wordright") -#define wxACTION_TEXT_PAGE_UP _T("pageup") -#define wxACTION_TEXT_PAGE_DOWN _T("pagedown") - -// clipboard operations -#define wxACTION_TEXT_COPY _T("copy") -#define wxACTION_TEXT_CUT _T("cut") -#define wxACTION_TEXT_PASTE _T("paste") - -// insert text at the cursor position: the text is in strArg of PerformAction -#define wxACTION_TEXT_INSERT _T("insert") - -// if the action starts with either of these prefixes and the rest of the -// string is one of the movement commands, it means to select/delete text from -// the current cursor position to the new one -#define wxACTION_TEXT_PREFIX_SEL _T("sel") -#define wxACTION_TEXT_PREFIX_DEL _T("del") - -// mouse selection -#define wxACTION_TEXT_ANCHOR_SEL _T("anchorsel") -#define wxACTION_TEXT_EXTEND_SEL _T("extendsel") -#define wxACTION_TEXT_SEL_WORD _T("wordsel") -#define wxACTION_TEXT_SEL_LINE _T("linesel") - -// undo or redo -#define wxACTION_TEXT_UNDO _T("undo") -#define wxACTION_TEXT_REDO _T("redo") - -// ---------------------------------------------------------------------------- -// wxTextCtrl -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase, - public wxScrollHelper -{ -public: - // creation - // -------- - - wxTextCtrl() : wxScrollHelper(this) { Init(); } - - wxTextCtrl(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) - : wxScrollHelper(this) - { - Init(); - - Create(parent, id, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - - virtual ~wxTextCtrl(); - - // implement base class pure virtuals - // ---------------------------------- - - virtual wxString GetValue() const; - - virtual int GetLineLength(wxTextCoord lineNo) const; - virtual wxString GetLineText(wxTextCoord lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(wxTextPos* from, wxTextPos* to) const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(wxTextPos from, wxTextPos to, const wxString& value); - virtual void Remove(wxTextPos from, wxTextPos to); - - // sets/clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent (logical, i.e. unwrapped) column and line. - virtual wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const; - virtual bool PositionToXY(wxTextPos pos, - wxTextCoord *x, wxTextCoord *y) const; - - // wxUniv-specific: find a screen position (in client coordinates) of the - // given text position or of the caret - bool PositionToLogicalXY(wxTextPos pos, wxCoord *x, wxCoord *y) const; - bool PositionToDeviceXY(wxTextPos pos, wxCoord *x, wxCoord *y) const; - wxPoint GetCaretPosition() const; - - virtual void ShowPosition(wxTextPos pos); - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(wxTextPos pos); - virtual void SetInsertionPointEnd(); - virtual wxTextPos GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(wxTextPos from, wxTextPos to); - virtual void SetEditable(bool editable); - - // wxUniv-specific methods - // ----------------------- - - // caret stuff - virtual void ShowCaret(bool show = true); - void HideCaret() { ShowCaret(false); } - void CreateCaret(); // for the current font size - - // helpers for cursor movement - wxTextPos GetWordStart() const; - wxTextPos GetWordEnd() const; - - // selection helpers - bool HasSelection() const - { return m_selStart != -1 && m_selEnd > m_selStart; } - void ClearSelection(); - void RemoveSelection(); - wxString GetSelectionText() const; - - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const; - - // find the character at this position in the given line, return value as - // for HitTest() - // - // NB: x is the logical coord (client and unscrolled) - wxTextCtrlHitTestResult HitTestLine(const wxString& line, - wxCoord x, - wxTextCoord *colOut) const; - - // bring the given position into view - void ShowHorzPosition(wxCoord pos); - - // scroll the window horizontally so that the first character shown is in - // position pos - void ScrollText(wxTextCoord col); - - // adjust the DC for horz text control scrolling too - virtual void DoPrepareDC(wxDC& dc); - - // implementation only from now on - // ------------------------------- - - // override this to take into account our scrollbar-less scrolling - virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; - virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const; - - // perform an action - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - // override these methods to handle the caret - virtual bool SetFont(const wxFont &font); - virtual bool Enable(bool enable = true); - - // more readable flag testing methods - bool IsPassword() const { return HasFlag(wxTE_PASSWORD); } - bool WrapLines() const { return m_wrapLines; } - - // only for wxStdTextCtrlInputHandler - void RefreshSelection(); - - // override wxScrollHelper method to prevent (auto)scrolling beyond the end - // of line - virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; - - // idle processing - virtual void OnInternalIdle(); - -protected: - // ensure we have correct default border - virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; } - - // override base class methods - virtual void DoDrawBorder(wxDC& dc, const wxRect& rect); - virtual void DoDraw(wxControlRenderer *renderer); - - // calc the size from the text extent - virtual wxSize DoGetBestClientSize() const; - - // implements Set/ChangeValue() - virtual void DoSetValue(const wxString& value, int flags = 0); - - // common part of all ctors - void Init(); - - // drawing - // ------- - - // draw the text in the given rectangle - void DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate); - - // draw the line wrap marks in this rect - void DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate); - - // line/row geometry calculations - // ------------------------------ - - // get the extent (width) of the text - wxCoord GetTextWidth(const wxString& text) const; - - // get the logical text width (accounting for scrolling) - wxCoord GetTotalWidth() const; - - // get total number of rows (different from number of lines if the lines - // can be wrapped) - wxTextCoord GetRowCount() const; - - // find the number of rows in this line (only if WrapLines()) - wxTextCoord GetRowsPerLine(wxTextCoord line) const; - - // get the starting row of the given line - wxTextCoord GetFirstRowOfLine(wxTextCoord line) const; - - // get the row following this line - wxTextCoord GetRowAfterLine(wxTextCoord line) const; - - // refresh functions - // ----------------- - - // the text area is the part of the window in which the text can be - // displayed, i.e. part of it inside the margins and the real text area is - // the area in which the text *is* currently displayed: for example, in the - // multiline control case the text area can have extra space at the bottom - // which is not tall enough for another line and which is then not included - // into the real text area - wxRect GetRealTextArea() const; - - // refresh the text in the given (in logical coords) rect - void RefreshTextRect(const wxRect& rect, bool textOnly = true); - - // refresh the line wrap marks for the given range of lines (inclusive) - void RefreshLineWrapMarks(wxTextCoord rowFirst, wxTextCoord rowLast); - - // refresh the text in the given range (in logical coords) of this line, if - // width is 0, refresh to the end of line - void RefreshPixelRange(wxTextCoord line, wxCoord start, wxCoord width); - - // refresh the text in the given range (in text coords) in this line - void RefreshColRange(wxTextCoord line, wxTextPos start, size_t count); - - // refresh the text from in the given line range (inclusive) - void RefreshLineRange(wxTextCoord lineFirst, wxTextCoord lineLast); - - // refresh the text in the given range which can span multiple lines - // (this method accepts arguments in any order) - void RefreshTextRange(wxTextPos start, wxTextPos end); - - // get the text to show: either the text itself or the text replaced with - // starts for wxTE_PASSWORD control - wxString GetTextToShow(const wxString& text) const; - - // find the row in this line where the given position (counted from the - // start of line) is - wxTextCoord GetRowInLine(wxTextCoord line, - wxTextCoord col, - wxTextCoord *colRowStart = NULL) const; - - // find the number of characters of a line before it wraps - // (and optionally also the real width of the line) - size_t GetPartOfWrappedLine(const wxChar* text, - wxCoord *widthReal = NULL) const; - - // get the start and end of the selection for this line: if the line is - // outside the selection, both will be -1 and false will be returned - bool GetSelectedPartOfLine(wxTextCoord line, - wxTextPos *start, wxTextPos *end) const; - - // update the text rect: the zone inside our client rect (its coords are - // client coords) which contains the text - void UpdateTextRect(); - - // calculate the last visible position - void UpdateLastVisible(); - - // move caret to the given position unconditionally - // (SetInsertionPoint() does nothing if the position didn't change) - void DoSetInsertionPoint(wxTextPos pos); - - // move caret to the new position without updating the display (for - // internal use only) - void MoveInsertionPoint(wxTextPos pos); - - // set the caret to its initial (default) position - void InitInsertionPoint(); - - // get the width of the longest line in pixels - wxCoord GetMaxWidth() const; - - // force recalculation of the max line width - void RecalcMaxWidth(); - - // update the max width after the given line was modified - void UpdateMaxWidth(wxTextCoord line); - - // hit testing - // ----------- - - // HitTest2() is more efficient than 2 consecutive HitTest()s with the same - // line (i.e. y) and it also returns the offset of the starting position in - // pixels - // - // as the last hack, this function accepts either logical or device (by - // default) coords depending on devCoords flag - wxTextCtrlHitTestResult HitTest2(wxCoord y, - wxCoord x1, - wxCoord x2, - wxTextCoord *row, - wxTextCoord *colStart, - wxTextCoord *colEnd, - wxTextCoord *colRowStart, - bool devCoords = true) const; - - // HitTest() version which takes the logical text coordinates and not the - // device ones - wxTextCtrlHitTestResult HitTestLogical(const wxPoint& pos, - wxTextCoord *col, - wxTextCoord *row) const; - - // get the line and the row in this line corresponding to the given row, - // return true if ok and false if row is out of range - // - // NB: this function can only be called for controls which wrap lines - bool GetLineAndRow(wxTextCoord row, - wxTextCoord *line, - wxTextCoord *rowInLine) const; - - // get the height of one line (the same for all lines) - wxCoord GetLineHeight() const - { - // this one should be already precalculated - wxASSERT_MSG( m_heightLine != -1, _T("should have line height") ); - - return m_heightLine; - } - - // get the average char width - wxCoord GetAverageWidth() const { return m_widthAvg; } - - // recalc the line height and char width (to call when the font changes) - void RecalcFontMetrics(); - - // vertical scrolling helpers - // -------------------------- - - // all these functions are for multi line controls only - - // get the number of visible lines - size_t GetLinesPerPage() const; - - // return the position above the cursor or INVALID_POS_VALUE - wxTextPos GetPositionAbove(); - - // return the position below the cursor or INVALID_POS_VALUE - wxTextPos GetPositionBelow(); - - // event handlers - // -------------- - void OnChar(wxKeyEvent& event); - void OnSize(wxSizeEvent& event); - - // return the struct containing control-type dependent data - struct wxTextSingleLineData& SData() { return *m_data.sdata; } - struct wxTextMultiLineData& MData() { return *m_data.mdata; } - struct wxTextWrappedData& WData() { return *m_data.wdata; } - const wxTextSingleLineData& SData() const { return *m_data.sdata; } - const wxTextMultiLineData& MData() const { return *m_data.mdata; } - const wxTextWrappedData& WData() const { return *m_data.wdata; } - - // clipboard operations (unlike the versions without Do prefix, they have a - // return code) - bool DoCut(); - bool DoPaste(); - -private: - // all these methods are for multiline text controls only - - // update the scrollbars (only called from OnIdle) - void UpdateScrollbars(); - - // get read only access to the lines of multiline control - inline const wxArrayString& GetLines() const; - inline size_t GetLineCount() const; - - // replace a line (returns true if the number of rows in thel ine changed) - bool ReplaceLine(wxTextCoord line, const wxString& text); - - // remove a line - void RemoveLine(wxTextCoord line); - - // insert a line at this position - void InsertLine(wxTextCoord line, const wxString& text); - - // calculate geometry of this line - void LayoutLine(wxTextCoord line, class wxWrappedLineData& lineData) const; - - // calculate geometry of all lines until the given one - void LayoutLines(wxTextCoord lineLast) const; - - // the initially specified control size - wxSize m_sizeInitial; - - // the global control text - wxString m_value; - - // current position - wxTextPos m_curPos; - wxTextCoord m_curCol, - m_curRow; - - // last position (only used by GetLastPosition()) - wxTextPos m_posLast; - - // selection - wxTextPos m_selAnchor, - m_selStart, - m_selEnd; - - // flags - bool m_isModified:1, - m_isEditable:1, - m_hasCaret:1, - m_wrapLines:1; // can't be changed after creation - - // the rectangle (in client coordinates) to draw text inside - wxRect m_rectText; - - // the height of one line (cached value of GetCharHeight) - wxCoord m_heightLine; - - // and the average char width (cached value of GetCharWidth) - wxCoord m_widthAvg; - - // we have some data which depends on the kind of control (single or multi - // line) - union - { - wxTextSingleLineData *sdata; - wxTextMultiLineData *mdata; - wxTextWrappedData *wdata; - void *data; - } m_data; - - // the object to which we delegate our undo/redo implementation - wxTextCtrlCommandProcessor *m_cmdProcessor; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxTextCtrl) - - friend class wxWrappedLineData; -}; - -#endif // _WX_UNIV_TEXTCTRL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/textctrl.h +// Purpose: wxTextCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.09.00 +// RCS-ID: $Id: textctrl.h 47170 2007-07-05 21:37:36Z VZ $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_TEXTCTRL_H_ +#define _WX_UNIV_TEXTCTRL_H_ + +class WXDLLEXPORT wxCaret; +class WXDLLEXPORT wxTextCtrlCommandProcessor; + +#include "wx/scrolwin.h" // for wxScrollHelper + +#include "wx/univ/inphand.h" + +// ---------------------------------------------------------------------------- +// wxTextCtrl actions +// ---------------------------------------------------------------------------- + +// cursor movement and also selection and delete operations +#define wxACTION_TEXT_GOTO _T("goto") // to pos in numArg +#define wxACTION_TEXT_FIRST _T("first") // go to pos 0 +#define wxACTION_TEXT_LAST _T("last") // go to last pos +#define wxACTION_TEXT_HOME _T("home") +#define wxACTION_TEXT_END _T("end") +#define wxACTION_TEXT_LEFT _T("left") +#define wxACTION_TEXT_RIGHT _T("right") +#define wxACTION_TEXT_UP _T("up") +#define wxACTION_TEXT_DOWN _T("down") +#define wxACTION_TEXT_WORD_LEFT _T("wordleft") +#define wxACTION_TEXT_WORD_RIGHT _T("wordright") +#define wxACTION_TEXT_PAGE_UP _T("pageup") +#define wxACTION_TEXT_PAGE_DOWN _T("pagedown") + +// clipboard operations +#define wxACTION_TEXT_COPY _T("copy") +#define wxACTION_TEXT_CUT _T("cut") +#define wxACTION_TEXT_PASTE _T("paste") + +// insert text at the cursor position: the text is in strArg of PerformAction +#define wxACTION_TEXT_INSERT _T("insert") + +// if the action starts with either of these prefixes and the rest of the +// string is one of the movement commands, it means to select/delete text from +// the current cursor position to the new one +#define wxACTION_TEXT_PREFIX_SEL _T("sel") +#define wxACTION_TEXT_PREFIX_DEL _T("del") + +// mouse selection +#define wxACTION_TEXT_ANCHOR_SEL _T("anchorsel") +#define wxACTION_TEXT_EXTEND_SEL _T("extendsel") +#define wxACTION_TEXT_SEL_WORD _T("wordsel") +#define wxACTION_TEXT_SEL_LINE _T("linesel") + +// undo or redo +#define wxACTION_TEXT_UNDO _T("undo") +#define wxACTION_TEXT_REDO _T("redo") + +// ---------------------------------------------------------------------------- +// wxTextCtrl +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase, + public wxScrollHelper +{ +public: + // creation + // -------- + + wxTextCtrl() : wxScrollHelper(this) { Init(); } + + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr) + : wxScrollHelper(this) + { + Init(); + + Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr); + + virtual ~wxTextCtrl(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual wxString GetValue() const; + + virtual int GetLineLength(wxTextCoord lineNo) const; + virtual wxString GetLineText(wxTextCoord lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(wxTextPos* from, wxTextPos* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(wxTextPos from, wxTextPos to, const wxString& value); + virtual void Remove(wxTextPos from, wxTextPos to); + + // sets/clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent (logical, i.e. unwrapped) column and line. + virtual wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const; + virtual bool PositionToXY(wxTextPos pos, + wxTextCoord *x, wxTextCoord *y) const; + + // wxUniv-specific: find a screen position (in client coordinates) of the + // given text position or of the caret + bool PositionToLogicalXY(wxTextPos pos, wxCoord *x, wxCoord *y) const; + bool PositionToDeviceXY(wxTextPos pos, wxCoord *x, wxCoord *y) const; + wxPoint GetCaretPosition() const; + + virtual void ShowPosition(wxTextPos pos); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(wxTextPos pos); + virtual void SetInsertionPointEnd(); + virtual wxTextPos GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(wxTextPos from, wxTextPos to); + virtual void SetEditable(bool editable); + + // wxUniv-specific methods + // ----------------------- + + // caret stuff + virtual void ShowCaret(bool show = true); + void HideCaret() { ShowCaret(false); } + void CreateCaret(); // for the current font size + + // helpers for cursor movement + wxTextPos GetWordStart() const; + wxTextPos GetWordEnd() const; + + // selection helpers + bool HasSelection() const + { return m_selStart != -1 && m_selEnd > m_selStart; } + void ClearSelection(); + void RemoveSelection(); + wxString GetSelectionText() const; + + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const; + + // find the character at this position in the given line, return value as + // for HitTest() + // + // NB: x is the logical coord (client and unscrolled) + wxTextCtrlHitTestResult HitTestLine(const wxString& line, + wxCoord x, + wxTextCoord *colOut) const; + + // bring the given position into view + void ShowHorzPosition(wxCoord pos); + + // scroll the window horizontally so that the first character shown is in + // position pos + void ScrollText(wxTextCoord col); + + // adjust the DC for horz text control scrolling too + virtual void DoPrepareDC(wxDC& dc); + + // implementation only from now on + // ------------------------------- + + // override this to take into account our scrollbar-less scrolling + virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; + virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const; + + // perform an action + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + // override these methods to handle the caret + virtual bool SetFont(const wxFont &font); + virtual bool Enable(bool enable = true); + + // more readable flag testing methods + bool IsPassword() const { return HasFlag(wxTE_PASSWORD); } + bool WrapLines() const { return m_wrapLines; } + + // only for wxStdTextCtrlInputHandler + void RefreshSelection(); + + // override wxScrollHelper method to prevent (auto)scrolling beyond the end + // of line + virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; + + // idle processing + virtual void OnInternalIdle(); + +protected: + // ensure we have correct default border + virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; } + + // override base class methods + virtual void DoDrawBorder(wxDC& dc, const wxRect& rect); + virtual void DoDraw(wxControlRenderer *renderer); + + // calc the size from the text extent + virtual wxSize DoGetBestClientSize() const; + + // implements Set/ChangeValue() + virtual void DoSetValue(const wxString& value, int flags = 0); + + // common part of all ctors + void Init(); + + // drawing + // ------- + + // draw the text in the given rectangle + void DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate); + + // draw the line wrap marks in this rect + void DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate); + + // line/row geometry calculations + // ------------------------------ + + // get the extent (width) of the text + wxCoord GetTextWidth(const wxString& text) const; + + // get the logical text width (accounting for scrolling) + wxCoord GetTotalWidth() const; + + // get total number of rows (different from number of lines if the lines + // can be wrapped) + wxTextCoord GetRowCount() const; + + // find the number of rows in this line (only if WrapLines()) + wxTextCoord GetRowsPerLine(wxTextCoord line) const; + + // get the starting row of the given line + wxTextCoord GetFirstRowOfLine(wxTextCoord line) const; + + // get the row following this line + wxTextCoord GetRowAfterLine(wxTextCoord line) const; + + // refresh functions + // ----------------- + + // the text area is the part of the window in which the text can be + // displayed, i.e. part of it inside the margins and the real text area is + // the area in which the text *is* currently displayed: for example, in the + // multiline control case the text area can have extra space at the bottom + // which is not tall enough for another line and which is then not included + // into the real text area + wxRect GetRealTextArea() const; + + // refresh the text in the given (in logical coords) rect + void RefreshTextRect(const wxRect& rect, bool textOnly = true); + + // refresh the line wrap marks for the given range of lines (inclusive) + void RefreshLineWrapMarks(wxTextCoord rowFirst, wxTextCoord rowLast); + + // refresh the text in the given range (in logical coords) of this line, if + // width is 0, refresh to the end of line + void RefreshPixelRange(wxTextCoord line, wxCoord start, wxCoord width); + + // refresh the text in the given range (in text coords) in this line + void RefreshColRange(wxTextCoord line, wxTextPos start, size_t count); + + // refresh the text from in the given line range (inclusive) + void RefreshLineRange(wxTextCoord lineFirst, wxTextCoord lineLast); + + // refresh the text in the given range which can span multiple lines + // (this method accepts arguments in any order) + void RefreshTextRange(wxTextPos start, wxTextPos end); + + // get the text to show: either the text itself or the text replaced with + // starts for wxTE_PASSWORD control + wxString GetTextToShow(const wxString& text) const; + + // find the row in this line where the given position (counted from the + // start of line) is + wxTextCoord GetRowInLine(wxTextCoord line, + wxTextCoord col, + wxTextCoord *colRowStart = NULL) const; + + // find the number of characters of a line before it wraps + // (and optionally also the real width of the line) + size_t GetPartOfWrappedLine(const wxChar* text, + wxCoord *widthReal = NULL) const; + + // get the start and end of the selection for this line: if the line is + // outside the selection, both will be -1 and false will be returned + bool GetSelectedPartOfLine(wxTextCoord line, + wxTextPos *start, wxTextPos *end) const; + + // update the text rect: the zone inside our client rect (its coords are + // client coords) which contains the text + void UpdateTextRect(); + + // calculate the last visible position + void UpdateLastVisible(); + + // move caret to the given position unconditionally + // (SetInsertionPoint() does nothing if the position didn't change) + void DoSetInsertionPoint(wxTextPos pos); + + // move caret to the new position without updating the display (for + // internal use only) + void MoveInsertionPoint(wxTextPos pos); + + // set the caret to its initial (default) position + void InitInsertionPoint(); + + // get the width of the longest line in pixels + wxCoord GetMaxWidth() const; + + // force recalculation of the max line width + void RecalcMaxWidth(); + + // update the max width after the given line was modified + void UpdateMaxWidth(wxTextCoord line); + + // hit testing + // ----------- + + // HitTest2() is more efficient than 2 consecutive HitTest()s with the same + // line (i.e. y) and it also returns the offset of the starting position in + // pixels + // + // as the last hack, this function accepts either logical or device (by + // default) coords depending on devCoords flag + wxTextCtrlHitTestResult HitTest2(wxCoord y, + wxCoord x1, + wxCoord x2, + wxTextCoord *row, + wxTextCoord *colStart, + wxTextCoord *colEnd, + wxTextCoord *colRowStart, + bool devCoords = true) const; + + // HitTest() version which takes the logical text coordinates and not the + // device ones + wxTextCtrlHitTestResult HitTestLogical(const wxPoint& pos, + wxTextCoord *col, + wxTextCoord *row) const; + + // get the line and the row in this line corresponding to the given row, + // return true if ok and false if row is out of range + // + // NB: this function can only be called for controls which wrap lines + bool GetLineAndRow(wxTextCoord row, + wxTextCoord *line, + wxTextCoord *rowInLine) const; + + // get the height of one line (the same for all lines) + wxCoord GetLineHeight() const + { + // this one should be already precalculated + wxASSERT_MSG( m_heightLine != -1, _T("should have line height") ); + + return m_heightLine; + } + + // get the average char width + wxCoord GetAverageWidth() const { return m_widthAvg; } + + // recalc the line height and char width (to call when the font changes) + void RecalcFontMetrics(); + + // vertical scrolling helpers + // -------------------------- + + // all these functions are for multi line controls only + + // get the number of visible lines + size_t GetLinesPerPage() const; + + // return the position above the cursor or INVALID_POS_VALUE + wxTextPos GetPositionAbove(); + + // return the position below the cursor or INVALID_POS_VALUE + wxTextPos GetPositionBelow(); + + // event handlers + // -------------- + void OnChar(wxKeyEvent& event); + void OnSize(wxSizeEvent& event); + + // return the struct containing control-type dependent data + struct wxTextSingleLineData& SData() { return *m_data.sdata; } + struct wxTextMultiLineData& MData() { return *m_data.mdata; } + struct wxTextWrappedData& WData() { return *m_data.wdata; } + const wxTextSingleLineData& SData() const { return *m_data.sdata; } + const wxTextMultiLineData& MData() const { return *m_data.mdata; } + const wxTextWrappedData& WData() const { return *m_data.wdata; } + + // clipboard operations (unlike the versions without Do prefix, they have a + // return code) + bool DoCut(); + bool DoPaste(); + +private: + // all these methods are for multiline text controls only + + // update the scrollbars (only called from OnIdle) + void UpdateScrollbars(); + + // get read only access to the lines of multiline control + inline const wxArrayString& GetLines() const; + inline size_t GetLineCount() const; + + // replace a line (returns true if the number of rows in thel ine changed) + bool ReplaceLine(wxTextCoord line, const wxString& text); + + // remove a line + void RemoveLine(wxTextCoord line); + + // insert a line at this position + void InsertLine(wxTextCoord line, const wxString& text); + + // calculate geometry of this line + void LayoutLine(wxTextCoord line, class wxWrappedLineData& lineData) const; + + // calculate geometry of all lines until the given one + void LayoutLines(wxTextCoord lineLast) const; + + // the initially specified control size + wxSize m_sizeInitial; + + // the global control text + wxString m_value; + + // current position + wxTextPos m_curPos; + wxTextCoord m_curCol, + m_curRow; + + // last position (only used by GetLastPosition()) + wxTextPos m_posLast; + + // selection + wxTextPos m_selAnchor, + m_selStart, + m_selEnd; + + // flags + bool m_isModified:1, + m_isEditable:1, + m_hasCaret:1, + m_wrapLines:1; // can't be changed after creation + + // the rectangle (in client coordinates) to draw text inside + wxRect m_rectText; + + // the height of one line (cached value of GetCharHeight) + wxCoord m_heightLine; + + // and the average char width (cached value of GetCharWidth) + wxCoord m_widthAvg; + + // we have some data which depends on the kind of control (single or multi + // line) + union + { + wxTextSingleLineData *sdata; + wxTextMultiLineData *mdata; + wxTextWrappedData *wdata; + void *data; + } m_data; + + // the object to which we delegate our undo/redo implementation + wxTextCtrlCommandProcessor *m_cmdProcessor; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxTextCtrl) + + friend class wxWrappedLineData; +}; + +#endif // _WX_UNIV_TEXTCTRL_H_ + diff --git a/Externals/wxWidgets/include/wx/univ/tglbtn.h b/Externals/wxWidgets/include/wx/univ/tglbtn.h index 447cc2e266..2024343450 100644 --- a/Externals/wxWidgets/include/wx/univ/tglbtn.h +++ b/Externals/wxWidgets/include/wx/univ/tglbtn.h @@ -1,70 +1,70 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/button.h -// Purpose: wxToggleButton for wxUniversal -// Author: Vadim Zeitlin -// Modified by: David Bjorkevik -// Created: 16.05.06 -// RCS-ID: $Id: tglbtn.h 39320 2006-05-24 17:17:27Z PC $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_TGLBTN_H_ -#define _WX_UNIV_TGLBTN_H_ - -#include "wx/button.h" - -extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; - -// ---------------------------------------------------------------------------- -// wxToggleButton: a push button -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxToggleButton: public wxButton -{ -public: - wxToggleButton(); - - wxToggleButton(wxWindow *parent, - wxWindowID id, - const wxBitmap& bitmap, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - wxToggleButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - - virtual ~wxToggleButton(); - - virtual bool IsPressed() const { return m_isPressed || m_value; } - - // wxToggleButton actions - virtual void Toggle(); - virtual void Click(); - - // Get/set the value - void SetValue(bool state); - bool GetValue() const { return m_value; } - -protected: - // the current value - bool m_value; - -private: - // common part of all ctors - void Init(); - - DECLARE_DYNAMIC_CLASS(wxToggleButton) -}; - -#endif // _WX_UNIV_TGLBTN_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/button.h +// Purpose: wxToggleButton for wxUniversal +// Author: Vadim Zeitlin +// Modified by: David Bjorkevik +// Created: 16.05.06 +// RCS-ID: $Id: tglbtn.h 39320 2006-05-24 17:17:27Z PC $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_TGLBTN_H_ +#define _WX_UNIV_TGLBTN_H_ + +#include "wx/button.h" + +extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxToggleButton: a push button +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToggleButton: public wxButton +{ +public: + wxToggleButton(); + + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual ~wxToggleButton(); + + virtual bool IsPressed() const { return m_isPressed || m_value; } + + // wxToggleButton actions + virtual void Toggle(); + virtual void Click(); + + // Get/set the value + void SetValue(bool state); + bool GetValue() const { return m_value; } + +protected: + // the current value + bool m_value; + +private: + // common part of all ctors + void Init(); + + DECLARE_DYNAMIC_CLASS(wxToggleButton) +}; + +#endif // _WX_UNIV_TGLBTN_H_ diff --git a/Externals/wxWidgets/include/wx/univ/theme.h b/Externals/wxWidgets/include/wx/univ/theme.h index 88d67b6b9f..02d74a8f4e 100644 --- a/Externals/wxWidgets/include/wx/univ/theme.h +++ b/Externals/wxWidgets/include/wx/univ/theme.h @@ -1,202 +1,202 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/theme.h -// Purpose: wxTheme class manages all configurable aspects of the -// application including the look (wxRenderer), feel -// (wxInputHandler) and the colours (wxColourScheme) -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.00 -// RCS-ID: $Id: theme.h 42455 2006-10-26 15:33:10Z VS $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_THEME_H_ -#define _WX_UNIV_THEME_H_ - -#include "wx/string.h" - -// ---------------------------------------------------------------------------- -// wxTheme -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxArtProvider; -class WXDLLEXPORT wxColourScheme; -class WXDLLEXPORT wxInputConsumer; -class WXDLLEXPORT wxInputHandler; -class WXDLLEXPORT wxRenderer; -struct WXDLLEXPORT wxThemeInfo; - -class WXDLLEXPORT wxTheme -{ -public: - // static methods - // -------------- - - // create the default theme - static bool CreateDefault(); - - // create the theme by name (will return NULL if not found) - static wxTheme *Create(const wxString& name); - - // change the current scheme - static wxTheme *Set(wxTheme *theme); - - // get the current theme (never NULL) - static wxTheme *Get() { return ms_theme; } - - // the theme methods - // ----------------- - - // get the renderer implementing all the control-drawing operations in - // this theme - virtual wxRenderer *GetRenderer() = 0; - - // get the art provider to be used together with this theme - virtual wxArtProvider *GetArtProvider() = 0; - - // get the input handler of the given type, forward to the standard one - virtual wxInputHandler *GetInputHandler(const wxString& handlerType, - wxInputConsumer *consumer) = 0; - - // get the colour scheme for the control with this name - virtual wxColourScheme *GetColourScheme() = 0; - - // implementation only from now on - // ------------------------------- - - virtual ~wxTheme(); - -private: - // the list of descriptions of all known themes - static wxThemeInfo *ms_allThemes; - - // the current theme - static wxTheme *ms_theme; - friend struct WXDLLEXPORT wxThemeInfo; -}; - -// ---------------------------------------------------------------------------- -// wxDelegateTheme: it is impossible to inherit from any of standard -// themes as their declarations are in private code, but you can use this -// class to override only some of their functions - all the other ones -// will be left to the original theme -// ---------------------------------------------------------------------------- - -class wxDelegateTheme : public wxTheme -{ -public: - wxDelegateTheme(const wxChar *theme); - virtual ~wxDelegateTheme(); - - virtual wxRenderer *GetRenderer(); - virtual wxArtProvider *GetArtProvider(); - virtual wxInputHandler *GetInputHandler(const wxString& control, - wxInputConsumer *consumer); - virtual wxColourScheme *GetColourScheme(); - -protected: - // gets or creates theme and sets m_theme to point to it, - // returns true on success - bool GetOrCreateTheme(); - - wxString m_themeName; - wxTheme *m_theme; -}; - -// ---------------------------------------------------------------------------- -// dynamic theme creation helpers -// ---------------------------------------------------------------------------- - -struct WXDLLEXPORT wxThemeInfo -{ - typedef wxTheme *(*Constructor)(); - - // theme name and (user readable) description - wxString name, desc; - - // the function to create a theme object - Constructor ctor; - - // next node in the linked list or NULL - wxThemeInfo *next; - - // constructor for the struct itself - wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc); -}; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -// to use a standard theme insert this macro into one of the application files: -// without it, an over optimizing linker may discard the object module -// containing the theme implementation entirely -#define WX_USE_THEME(themename) \ - /* this indirection makes it possible to pass macro as the argument */ \ - WX_USE_THEME_IMPL(themename) - -#define WX_USE_THEME_IMPL(themename) \ - extern WXDLLEXPORT_DATA(bool) wxThemeUse##themename; \ - static struct wxThemeUserFor##themename \ - { \ - wxThemeUserFor##themename() { wxThemeUse##themename = true; } \ - } wxThemeDoUse##themename - -// to declare a new theme, this macro must be used in the class declaration -#define WX_DECLARE_THEME(themename) \ - private: \ - static wxThemeInfo ms_info##themename; \ - public: \ - const wxThemeInfo *GetThemeInfo() const \ - { return &ms_info##themename; } - -// and this one must be inserted in the source file -#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \ - WXDLLEXPORT_DATA(bool) wxThemeUse##themename = true; \ - wxTheme *wxCtorFor##themename() { return new classname; } \ - wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \ - wxT( #themename ), themedesc) - -// ---------------------------------------------------------------------------- -// determine default theme -// ---------------------------------------------------------------------------- - -#if wxUSE_ALL_THEMES - #undef wxUSE_THEME_WIN32 - #define wxUSE_THEME_WIN32 1 - #undef wxUSE_THEME_GTK - #define wxUSE_THEME_GTK 1 - #undef wxUSE_THEME_MONO - #define wxUSE_THEME_MONO 1 - #undef wxUSE_THEME_METAL - #define wxUSE_THEME_METAL 1 -#endif // wxUSE_ALL_THEMES - -// determine the default theme to use: -#if defined(__WXGTK__) && wxUSE_THEME_GTK - #define wxUNIV_DEFAULT_THEME gtk -#elif defined(__WXDFB__) && wxUSE_THEME_MONO - // use mono theme for DirectFB port because it cannot correctly - // render neither win32 nor gtk themes yet: - #define wxUNIV_DEFAULT_THEME mono -#endif - -// if no theme was picked, get any theme compiled in (sorted by -// quality/completeness of the theme): -#ifndef wxUNIV_DEFAULT_THEME - #if wxUSE_THEME_WIN32 - #define wxUNIV_DEFAULT_THEME win32 - #elif wxUSE_THEME_GTK - #define wxUNIV_DEFAULT_THEME gtk - #elif wxUSE_THEME_MONO - #define wxUNIV_DEFAULT_THEME mono - #endif - // If nothing matches, no themes are compiled and the app must provide - // some theme itself - // (note that wxUSE_THEME_METAL depends on win32 theme, so we don't have to - // try it) - // -#endif // !wxUNIV_DEFAULT_THEME - -#endif // _WX_UNIV_THEME_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/theme.h +// Purpose: wxTheme class manages all configurable aspects of the +// application including the look (wxRenderer), feel +// (wxInputHandler) and the colours (wxColourScheme) +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// RCS-ID: $Id: theme.h 42455 2006-10-26 15:33:10Z VS $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_THEME_H_ +#define _WX_UNIV_THEME_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxTheme +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxArtProvider; +class WXDLLEXPORT wxColourScheme; +class WXDLLEXPORT wxInputConsumer; +class WXDLLEXPORT wxInputHandler; +class WXDLLEXPORT wxRenderer; +struct WXDLLEXPORT wxThemeInfo; + +class WXDLLEXPORT wxTheme +{ +public: + // static methods + // -------------- + + // create the default theme + static bool CreateDefault(); + + // create the theme by name (will return NULL if not found) + static wxTheme *Create(const wxString& name); + + // change the current scheme + static wxTheme *Set(wxTheme *theme); + + // get the current theme (never NULL) + static wxTheme *Get() { return ms_theme; } + + // the theme methods + // ----------------- + + // get the renderer implementing all the control-drawing operations in + // this theme + virtual wxRenderer *GetRenderer() = 0; + + // get the art provider to be used together with this theme + virtual wxArtProvider *GetArtProvider() = 0; + + // get the input handler of the given type, forward to the standard one + virtual wxInputHandler *GetInputHandler(const wxString& handlerType, + wxInputConsumer *consumer) = 0; + + // get the colour scheme for the control with this name + virtual wxColourScheme *GetColourScheme() = 0; + + // implementation only from now on + // ------------------------------- + + virtual ~wxTheme(); + +private: + // the list of descriptions of all known themes + static wxThemeInfo *ms_allThemes; + + // the current theme + static wxTheme *ms_theme; + friend struct WXDLLEXPORT wxThemeInfo; +}; + +// ---------------------------------------------------------------------------- +// wxDelegateTheme: it is impossible to inherit from any of standard +// themes as their declarations are in private code, but you can use this +// class to override only some of their functions - all the other ones +// will be left to the original theme +// ---------------------------------------------------------------------------- + +class wxDelegateTheme : public wxTheme +{ +public: + wxDelegateTheme(const wxChar *theme); + virtual ~wxDelegateTheme(); + + virtual wxRenderer *GetRenderer(); + virtual wxArtProvider *GetArtProvider(); + virtual wxInputHandler *GetInputHandler(const wxString& control, + wxInputConsumer *consumer); + virtual wxColourScheme *GetColourScheme(); + +protected: + // gets or creates theme and sets m_theme to point to it, + // returns true on success + bool GetOrCreateTheme(); + + wxString m_themeName; + wxTheme *m_theme; +}; + +// ---------------------------------------------------------------------------- +// dynamic theme creation helpers +// ---------------------------------------------------------------------------- + +struct WXDLLEXPORT wxThemeInfo +{ + typedef wxTheme *(*Constructor)(); + + // theme name and (user readable) description + wxString name, desc; + + // the function to create a theme object + Constructor ctor; + + // next node in the linked list or NULL + wxThemeInfo *next; + + // constructor for the struct itself + wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc); +}; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// to use a standard theme insert this macro into one of the application files: +// without it, an over optimizing linker may discard the object module +// containing the theme implementation entirely +#define WX_USE_THEME(themename) \ + /* this indirection makes it possible to pass macro as the argument */ \ + WX_USE_THEME_IMPL(themename) + +#define WX_USE_THEME_IMPL(themename) \ + extern WXDLLEXPORT_DATA(bool) wxThemeUse##themename; \ + static struct wxThemeUserFor##themename \ + { \ + wxThemeUserFor##themename() { wxThemeUse##themename = true; } \ + } wxThemeDoUse##themename + +// to declare a new theme, this macro must be used in the class declaration +#define WX_DECLARE_THEME(themename) \ + private: \ + static wxThemeInfo ms_info##themename; \ + public: \ + const wxThemeInfo *GetThemeInfo() const \ + { return &ms_info##themename; } + +// and this one must be inserted in the source file +#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \ + WXDLLEXPORT_DATA(bool) wxThemeUse##themename = true; \ + wxTheme *wxCtorFor##themename() { return new classname; } \ + wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \ + wxT( #themename ), themedesc) + +// ---------------------------------------------------------------------------- +// determine default theme +// ---------------------------------------------------------------------------- + +#if wxUSE_ALL_THEMES + #undef wxUSE_THEME_WIN32 + #define wxUSE_THEME_WIN32 1 + #undef wxUSE_THEME_GTK + #define wxUSE_THEME_GTK 1 + #undef wxUSE_THEME_MONO + #define wxUSE_THEME_MONO 1 + #undef wxUSE_THEME_METAL + #define wxUSE_THEME_METAL 1 +#endif // wxUSE_ALL_THEMES + +// determine the default theme to use: +#if defined(__WXGTK__) && wxUSE_THEME_GTK + #define wxUNIV_DEFAULT_THEME gtk +#elif defined(__WXDFB__) && wxUSE_THEME_MONO + // use mono theme for DirectFB port because it cannot correctly + // render neither win32 nor gtk themes yet: + #define wxUNIV_DEFAULT_THEME mono +#endif + +// if no theme was picked, get any theme compiled in (sorted by +// quality/completeness of the theme): +#ifndef wxUNIV_DEFAULT_THEME + #if wxUSE_THEME_WIN32 + #define wxUNIV_DEFAULT_THEME win32 + #elif wxUSE_THEME_GTK + #define wxUNIV_DEFAULT_THEME gtk + #elif wxUSE_THEME_MONO + #define wxUNIV_DEFAULT_THEME mono + #endif + // If nothing matches, no themes are compiled and the app must provide + // some theme itself + // (note that wxUSE_THEME_METAL depends on win32 theme, so we don't have to + // try it) + // +#endif // !wxUNIV_DEFAULT_THEME + +#endif // _WX_UNIV_THEME_H_ diff --git a/Externals/wxWidgets/include/wx/univ/toolbar.h b/Externals/wxWidgets/include/wx/univ/toolbar.h index 427629a654..7c3f99d4c1 100644 --- a/Externals/wxWidgets/include/wx/univ/toolbar.h +++ b/Externals/wxWidgets/include/wx/univ/toolbar.h @@ -1,138 +1,138 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/toolbar.h -// Purpose: wxToolBar declaration -// Author: Robert Roebling -// Modified by: -// Created: 10.09.00 -// RCS-ID: $Id: toolbar.h 41227 2006-09-14 19:36:47Z VZ $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_TOOLBAR_H_ -#define _WX_UNIV_TOOLBAR_H_ - -#include "wx/button.h" // for wxStdButtonInputHandler - -class WXDLLEXPORT wxToolBarTool; - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -#define wxACTION_TOOLBAR_TOGGLE wxACTION_BUTTON_TOGGLE -#define wxACTION_TOOLBAR_PRESS wxACTION_BUTTON_PRESS -#define wxACTION_TOOLBAR_RELEASE wxACTION_BUTTON_RELEASE -#define wxACTION_TOOLBAR_CLICK wxACTION_BUTTON_CLICK -#define wxACTION_TOOLBAR_ENTER _T("enter") // highlight the tool -#define wxACTION_TOOLBAR_LEAVE _T("leave") // unhighlight the tool - -// ---------------------------------------------------------------------------- -// wxToolBar -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxToolBar : public wxToolBarBase -{ -public: - // construction/destruction - wxToolBar() { Init(); } - wxToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxToolBarNameStr) - { - Init(); - - Create(parent, id, pos, size, style, name); - } - - bool Create( wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxToolBarNameStr ); - - virtual ~wxToolBar(); - - virtual bool Realize(); - - virtual void SetWindowStyleFlag( long style ); - - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - - virtual void SetToolShortHelp(int id, const wxString& helpString); - - virtual void SetMargins(int x, int y); - void SetMargins(const wxSize& size) - { SetMargins((int) size.x, (int) size.y); } - - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1, - const wxString& strArg = wxEmptyString); - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - -protected: - // common part of all ctors - void Init(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - virtual wxToolBarToolBase *CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); - - virtual wxSize DoGetBestClientSize() const; - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoDraw(wxControlRenderer *renderer); - - // get the bounding rect for the given tool - wxRect GetToolRect(wxToolBarToolBase *tool) const; - - // redraw the given tool - void RefreshTool(wxToolBarToolBase *tool); - - // (re)calculate the tool positions, should only be called if it is - // necessary to do it, i.e. m_needsLayout == true - void DoLayout(); - - // get the rect limits depending on the orientation: top/bottom for a - // vertical toolbar, left/right for a horizontal one - void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; - -private: - // have we calculated the positions of our tools? - bool m_needsLayout; - - // the width of a separator - wxCoord m_widthSeparator; - - // the total size of all toolbar elements - wxCoord m_maxWidth, - m_maxHeight; - -private: - DECLARE_DYNAMIC_CLASS(wxToolBar) -}; - -#endif // _WX_UNIV_TOOLBAR_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/toolbar.h +// Purpose: wxToolBar declaration +// Author: Robert Roebling +// Modified by: +// Created: 10.09.00 +// RCS-ID: $Id: toolbar.h 41227 2006-09-14 19:36:47Z VZ $ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_TOOLBAR_H_ +#define _WX_UNIV_TOOLBAR_H_ + +#include "wx/button.h" // for wxStdButtonInputHandler + +class WXDLLEXPORT wxToolBarTool; + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +#define wxACTION_TOOLBAR_TOGGLE wxACTION_BUTTON_TOGGLE +#define wxACTION_TOOLBAR_PRESS wxACTION_BUTTON_PRESS +#define wxACTION_TOOLBAR_RELEASE wxACTION_BUTTON_RELEASE +#define wxACTION_TOOLBAR_CLICK wxACTION_BUTTON_CLICK +#define wxACTION_TOOLBAR_ENTER _T("enter") // highlight the tool +#define wxACTION_TOOLBAR_LEAVE _T("leave") // unhighlight the tool + +// ---------------------------------------------------------------------------- +// wxToolBar +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxToolBar : public wxToolBarBase +{ +public: + // construction/destruction + wxToolBar() { Init(); } + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxToolBarNameStr) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxToolBarNameStr ); + + virtual ~wxToolBar(); + + virtual bool Realize(); + + virtual void SetWindowStyleFlag( long style ); + + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual void SetToolShortHelp(int id, const wxString& helpString); + + virtual void SetMargins(int x, int y); + void SetMargins(const wxSize& size) + { SetMargins((int) size.x, (int) size.y); } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString); + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + +protected: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + virtual wxSize DoGetBestClientSize() const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoDraw(wxControlRenderer *renderer); + + // get the bounding rect for the given tool + wxRect GetToolRect(wxToolBarToolBase *tool) const; + + // redraw the given tool + void RefreshTool(wxToolBarToolBase *tool); + + // (re)calculate the tool positions, should only be called if it is + // necessary to do it, i.e. m_needsLayout == true + void DoLayout(); + + // get the rect limits depending on the orientation: top/bottom for a + // vertical toolbar, left/right for a horizontal one + void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; + +private: + // have we calculated the positions of our tools? + bool m_needsLayout; + + // the width of a separator + wxCoord m_widthSeparator; + + // the total size of all toolbar elements + wxCoord m_maxWidth, + m_maxHeight; + +private: + DECLARE_DYNAMIC_CLASS(wxToolBar) +}; + +#endif // _WX_UNIV_TOOLBAR_H_ diff --git a/Externals/wxWidgets/include/wx/univ/toplevel.h b/Externals/wxWidgets/include/wx/univ/toplevel.h index ec86a1b968..79e9ae0328 100644 --- a/Externals/wxWidgets/include/wx/univ/toplevel.h +++ b/Externals/wxWidgets/include/wx/univ/toplevel.h @@ -1,197 +1,197 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/toplevel.h -// Purpose: Top level window, abstraction of wxFrame and wxDialog -// Author: Vaclav Slavik -// Id: $Id: toplevel.h 42664 2006-10-29 20:39:31Z VZ $ -// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef __WX_UNIV_TOPLEVEL_H__ -#define __WX_UNIV_TOPLEVEL_H__ - -#include "wx/univ/inpcons.h" -#include "wx/univ/inphand.h" -#include "wx/icon.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// frame decorations type flags used in wxRenderer and wxColourScheme -enum -{ - wxTOPLEVEL_ACTIVE = 0x00000001, - wxTOPLEVEL_MAXIMIZED = 0x00000002, - wxTOPLEVEL_TITLEBAR = 0x00000004, - wxTOPLEVEL_ICON = 0x00000008, - wxTOPLEVEL_RESIZEABLE = 0x00000010, - wxTOPLEVEL_BORDER = 0x00000020, - wxTOPLEVEL_BUTTON_CLOSE = 0x01000000, - wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000, - wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000, - wxTOPLEVEL_BUTTON_RESTORE = 0x08000000, - wxTOPLEVEL_BUTTON_HELP = 0x10000000 -}; - -// frame hit test return values: -enum -{ - wxHT_TOPLEVEL_NOWHERE = 0x00000000, - wxHT_TOPLEVEL_CLIENT_AREA = 0x00000001, - wxHT_TOPLEVEL_ICON = 0x00000002, - wxHT_TOPLEVEL_TITLEBAR = 0x00000004, - - wxHT_TOPLEVEL_BORDER_N = 0x00000010, - wxHT_TOPLEVEL_BORDER_S = 0x00000020, - wxHT_TOPLEVEL_BORDER_E = 0x00000040, - wxHT_TOPLEVEL_BORDER_W = 0x00000080, - wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E, - wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E, - wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W, - wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W, - wxHT_TOPLEVEL_ANY_BORDER = 0x000000F0, - - wxHT_TOPLEVEL_BUTTON_CLOSE = /*0x01000000*/ wxTOPLEVEL_BUTTON_CLOSE, - wxHT_TOPLEVEL_BUTTON_MAXIMIZE = /*0x02000000*/ wxTOPLEVEL_BUTTON_MAXIMIZE, - wxHT_TOPLEVEL_BUTTON_ICONIZE = /*0x04000000*/ wxTOPLEVEL_BUTTON_ICONIZE, - wxHT_TOPLEVEL_BUTTON_RESTORE = /*0x08000000*/ wxTOPLEVEL_BUTTON_RESTORE, - wxHT_TOPLEVEL_BUTTON_HELP = /*0x10000000*/ wxTOPLEVEL_BUTTON_HELP, - wxHT_TOPLEVEL_ANY_BUTTON = 0x1F000000 -}; - -// Flags for interactive frame manipulation functions (only in wxUniversal): -enum -{ - wxINTERACTIVE_MOVE = 0x00000001, - wxINTERACTIVE_RESIZE = 0x00000002, - wxINTERACTIVE_RESIZE_S = 0x00000010, - wxINTERACTIVE_RESIZE_N = 0x00000020, - wxINTERACTIVE_RESIZE_W = 0x00000040, - wxINTERACTIVE_RESIZE_E = 0x00000080, - wxINTERACTIVE_WAIT_FOR_INPUT = 0x10000000 -}; - -// ---------------------------------------------------------------------------- -// the actions supported by this control -// ---------------------------------------------------------------------------- - -#define wxACTION_TOPLEVEL_ACTIVATE _T("activate") // (de)activate the frame -#define wxACTION_TOPLEVEL_BUTTON_PRESS _T("pressbtn") // press titlebar btn -#define wxACTION_TOPLEVEL_BUTTON_RELEASE _T("releasebtn") // press titlebar btn -#define wxACTION_TOPLEVEL_BUTTON_CLICK _T("clickbtn") // press titlebar btn -#define wxACTION_TOPLEVEL_MOVE _T("move") // move the frame -#define wxACTION_TOPLEVEL_RESIZE _T("resize") // resize the frame - -//----------------------------------------------------------------------------- -// wxTopLevelWindow -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative, - public wxInputConsumer -{ -public: - // construction - wxTopLevelWindow() { Init(); } - wxTopLevelWindow(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - - Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // wxUniv-specific methods: do [not] use native decorations for this (or - // all) window(s) - // - // notice that this has no effect if the system doesn't support any native - // decorations anyhow and that by default native decorations are used - // - // if UseNativeDecorations() is used, it must be called before Create() - static void UseNativeDecorationsByDefault(bool native = true); - void UseNativeDecorations(bool native = true); - bool IsUsingNativeDecorations() const; - - - // implement base class pure virtuals - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual wxPoint GetClientAreaOrigin() const; - virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); } - virtual void SetIcons(const wxIconBundle& icons); - - // implementation from now on - // -------------------------- - - // tests for frame's part at given point - long HitTest(const wxPoint& pt) const; - - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1, - const wxString& strArg = wxEmptyString); - - static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); - virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) - { - return GetStdInputHandler(handlerDef); - } - - // move/resize the frame interactively, i.e. let the user do it - virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE); - - virtual wxSize GetMinSize() const; - - virtual wxWindow *GetInputWindow() const { return wx_const_cast(wxTopLevelWindow*, this); } - -protected: - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int height); - - // handle titlebar button click event - virtual void ClickTitleBarButton(long button); - - // return wxTOPLEVEL_xxx combination based on current state of the frame - long GetDecorationsStyle() const; - - // common part of all ctors - void Init(); - - void RefreshTitleBar(); - void OnNcPaint(wxNcPaintEvent& event); - void OnSystemMenu(wxCommandEvent& event); - - // true if wxTLW should render decorations (aka titlebar) itself - static int ms_drawDecorations; - // true if wxTLW can be iconized - static int ms_canIconize; - - // true if we're using native decorations - bool m_usingNativeDecorations; - // true for currently active frame - bool m_isActive; - // version of icon for titlebar (16x16) - wxIcon m_titlebarIcon; - // saved window style in fullscreen mdoe - long m_fsSavedStyle; - // currently pressed titlebar button - long m_pressedButton; - - DECLARE_DYNAMIC_CLASS(wxTopLevelWindow) - DECLARE_EVENT_TABLE() - WX_DECLARE_INPUT_CONSUMER() -}; - -#endif // __WX_UNIV_TOPLEVEL_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/toplevel.h +// Purpose: Top level window, abstraction of wxFrame and wxDialog +// Author: Vaclav Slavik +// Id: $Id: toplevel.h 42664 2006-10-29 20:39:31Z VZ $ +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_UNIV_TOPLEVEL_H__ +#define __WX_UNIV_TOPLEVEL_H__ + +#include "wx/univ/inpcons.h" +#include "wx/univ/inphand.h" +#include "wx/icon.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// frame decorations type flags used in wxRenderer and wxColourScheme +enum +{ + wxTOPLEVEL_ACTIVE = 0x00000001, + wxTOPLEVEL_MAXIMIZED = 0x00000002, + wxTOPLEVEL_TITLEBAR = 0x00000004, + wxTOPLEVEL_ICON = 0x00000008, + wxTOPLEVEL_RESIZEABLE = 0x00000010, + wxTOPLEVEL_BORDER = 0x00000020, + wxTOPLEVEL_BUTTON_CLOSE = 0x01000000, + wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000, + wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000, + wxTOPLEVEL_BUTTON_RESTORE = 0x08000000, + wxTOPLEVEL_BUTTON_HELP = 0x10000000 +}; + +// frame hit test return values: +enum +{ + wxHT_TOPLEVEL_NOWHERE = 0x00000000, + wxHT_TOPLEVEL_CLIENT_AREA = 0x00000001, + wxHT_TOPLEVEL_ICON = 0x00000002, + wxHT_TOPLEVEL_TITLEBAR = 0x00000004, + + wxHT_TOPLEVEL_BORDER_N = 0x00000010, + wxHT_TOPLEVEL_BORDER_S = 0x00000020, + wxHT_TOPLEVEL_BORDER_E = 0x00000040, + wxHT_TOPLEVEL_BORDER_W = 0x00000080, + wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E, + wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E, + wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W, + wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W, + wxHT_TOPLEVEL_ANY_BORDER = 0x000000F0, + + wxHT_TOPLEVEL_BUTTON_CLOSE = /*0x01000000*/ wxTOPLEVEL_BUTTON_CLOSE, + wxHT_TOPLEVEL_BUTTON_MAXIMIZE = /*0x02000000*/ wxTOPLEVEL_BUTTON_MAXIMIZE, + wxHT_TOPLEVEL_BUTTON_ICONIZE = /*0x04000000*/ wxTOPLEVEL_BUTTON_ICONIZE, + wxHT_TOPLEVEL_BUTTON_RESTORE = /*0x08000000*/ wxTOPLEVEL_BUTTON_RESTORE, + wxHT_TOPLEVEL_BUTTON_HELP = /*0x10000000*/ wxTOPLEVEL_BUTTON_HELP, + wxHT_TOPLEVEL_ANY_BUTTON = 0x1F000000 +}; + +// Flags for interactive frame manipulation functions (only in wxUniversal): +enum +{ + wxINTERACTIVE_MOVE = 0x00000001, + wxINTERACTIVE_RESIZE = 0x00000002, + wxINTERACTIVE_RESIZE_S = 0x00000010, + wxINTERACTIVE_RESIZE_N = 0x00000020, + wxINTERACTIVE_RESIZE_W = 0x00000040, + wxINTERACTIVE_RESIZE_E = 0x00000080, + wxINTERACTIVE_WAIT_FOR_INPUT = 0x10000000 +}; + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +#define wxACTION_TOPLEVEL_ACTIVATE _T("activate") // (de)activate the frame +#define wxACTION_TOPLEVEL_BUTTON_PRESS _T("pressbtn") // press titlebar btn +#define wxACTION_TOPLEVEL_BUTTON_RELEASE _T("releasebtn") // press titlebar btn +#define wxACTION_TOPLEVEL_BUTTON_CLICK _T("clickbtn") // press titlebar btn +#define wxACTION_TOPLEVEL_MOVE _T("move") // move the frame +#define wxACTION_TOPLEVEL_RESIZE _T("resize") // resize the frame + +//----------------------------------------------------------------------------- +// wxTopLevelWindow +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative, + public wxInputConsumer +{ +public: + // construction + wxTopLevelWindow() { Init(); } + wxTopLevelWindow(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // wxUniv-specific methods: do [not] use native decorations for this (or + // all) window(s) + // + // notice that this has no effect if the system doesn't support any native + // decorations anyhow and that by default native decorations are used + // + // if UseNativeDecorations() is used, it must be called before Create() + static void UseNativeDecorationsByDefault(bool native = true); + void UseNativeDecorations(bool native = true); + bool IsUsingNativeDecorations() const; + + + // implement base class pure virtuals + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual wxPoint GetClientAreaOrigin() const; + virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); } + virtual void SetIcons(const wxIconBundle& icons); + + // implementation from now on + // -------------------------- + + // tests for frame's part at given point + long HitTest(const wxPoint& pt) const; + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString); + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + + // move/resize the frame interactively, i.e. let the user do it + virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE); + + virtual wxSize GetMinSize() const; + + virtual wxWindow *GetInputWindow() const { return wx_const_cast(wxTopLevelWindow*, this); } + +protected: + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + + // handle titlebar button click event + virtual void ClickTitleBarButton(long button); + + // return wxTOPLEVEL_xxx combination based on current state of the frame + long GetDecorationsStyle() const; + + // common part of all ctors + void Init(); + + void RefreshTitleBar(); + void OnNcPaint(wxNcPaintEvent& event); + void OnSystemMenu(wxCommandEvent& event); + + // true if wxTLW should render decorations (aka titlebar) itself + static int ms_drawDecorations; + // true if wxTLW can be iconized + static int ms_canIconize; + + // true if we're using native decorations + bool m_usingNativeDecorations; + // true for currently active frame + bool m_isActive; + // version of icon for titlebar (16x16) + wxIcon m_titlebarIcon; + // saved window style in fullscreen mdoe + long m_fsSavedStyle; + // currently pressed titlebar button + long m_pressedButton; + + DECLARE_DYNAMIC_CLASS(wxTopLevelWindow) + DECLARE_EVENT_TABLE() + WX_DECLARE_INPUT_CONSUMER() +}; + +#endif // __WX_UNIV_TOPLEVEL_H__ diff --git a/Externals/wxWidgets/include/wx/univ/window.h b/Externals/wxWidgets/include/wx/univ/window.h index 95ee644be0..1485f60334 100644 --- a/Externals/wxWidgets/include/wx/univ/window.h +++ b/Externals/wxWidgets/include/wx/univ/window.h @@ -1,287 +1,287 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/univ/window.h -// Purpose: wxWindow class which is the base class for all -// wxUniv port controls, it supports the customization of the -// window drawing and input processing. -// Author: Vadim Zeitlin -// Modified by: -// Created: 06.08.00 -// RCS-ID: $Id: window.h 39633 2006-06-08 11:25:30Z ABX $ -// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIV_WINDOW_H_ -#define _WX_UNIV_WINDOW_H_ - -#include "wx/bitmap.h" // for m_bitmapBg - -class WXDLLEXPORT wxControlRenderer; -class WXDLLEXPORT wxEventLoop; - -#if wxUSE_MENUS - class WXDLLEXPORT wxMenu; - class WXDLLEXPORT wxMenuBar; -#endif // wxUSE_MENUS - -class WXDLLEXPORT wxRenderer; - -#if wxUSE_SCROLLBAR - class WXDLLEXPORT wxScrollBar; -#endif // wxUSE_SCROLLBAR - -#ifdef __WXX11__ -#define wxUSE_TWO_WINDOWS 1 -#else -#define wxUSE_TWO_WINDOWS 0 -#endif - -// ---------------------------------------------------------------------------- -// wxWindow -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) -#define wxWindowNative wxWindowMSW -#elif defined(__WXGTK__) -#define wxWindowNative wxWindowGTK -#elif defined(__WXMGL__) -#define wxWindowNative wxWindowMGL -#elif defined(__WXX11__) -#define wxWindowNative wxWindowX11 -#elif defined(__WXMAC__) -#define wxWindowNative wxWindowMac -#endif - -class WXDLLEXPORT wxWindow : public wxWindowNative -{ -public: - // ctors and create functions - // --------------------------- - - wxWindow() { Init(); } - - wxWindow(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - : wxWindowNative(parent, id, pos, size, style | wxCLIP_CHILDREN, name) - { Init(); } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - virtual ~wxWindow(); - - // background pixmap support - // ------------------------- - - virtual void SetBackground(const wxBitmap& bitmap, - int alignment = wxALIGN_CENTRE, - wxStretch stretch = wxSTRETCH_NOT); - - const wxBitmap& GetBackgroundBitmap(int *alignment = NULL, - wxStretch *stretch = NULL) const; - - // scrollbars: we (re)implement it ourselves using our own scrollbars - // instead of the native ones - // ------------------------------------------------------------------ - - virtual void SetScrollbar(int orient, - int pos, - int page, - int range, - bool refresh = true ); - virtual void SetScrollPos(int orient, int pos, bool refresh = true); - virtual int GetScrollPos(int orient) const; - virtual int GetScrollThumb(int orient) const; - virtual int GetScrollRange(int orient) const; - virtual void ScrollWindow(int dx, int dy, - const wxRect* rect = (wxRect *) NULL); - - // take into account the borders here - virtual wxPoint GetClientAreaOrigin() const; - - // popup menu support - // ------------------ - - // NB: all menu related functions are implemented in menu.cpp - -#if wxUSE_MENUS - // this is wxUniv-specific private method to be used only by wxMenu - void DismissPopupMenu(); -#endif // wxUSE_MENUS - - // miscellaneous other methods - // --------------------------- - - // get the state information - virtual bool IsFocused() const; - virtual bool IsCurrent() const; - virtual bool IsPressed() const; - virtual bool IsDefault() const; - - // return all state flags at once (combination of wxCONTROL_XXX values) - int GetStateFlags() const; - - // set the "highlighted" flag and return true if it changed - virtual bool SetCurrent(bool doit = true); - -#if wxUSE_SCROLLBAR - // get the scrollbar (may be NULL) for the given orientation - wxScrollBar *GetScrollbar(int orient) const - { - return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz; - } -#endif // wxUSE_SCROLLBAR - - // methods used by wxColourScheme to choose the colours for this window - // -------------------------------------------------------------------- - - // return true if this is a panel/canvas window which contains other - // controls only - virtual bool IsCanvasWindow() const { return false; } - - // return true if this control can be highlighted when the mouse is over - // it (the theme decides itself whether it is really highlighted or not) - virtual bool CanBeHighlighted() const { return false; } - - // return true if we should use the colours/fonts returned by the - // corresponding GetXXX() methods instead of the default ones - bool UseFgCol() const { return m_hasFgCol; } - bool UseFont() const { return m_hasFont; } - - // return true if this window serves as a container for the other windows - // only and doesn't get any input itself - virtual bool IsStaticBox() const { return false; } - - // returns the (low level) renderer to use for drawing the control by - // querying the current theme - wxRenderer *GetRenderer() const { return m_renderer; } - - // scrolling helper: like ScrollWindow() except that it doesn't refresh the - // uncovered window areas but returns the rectangle to update (don't call - // this with both dx and dy non zero) - wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = NULL); - - // after scrollbars are added or removed they must be refreshed by calling - // this function - void RefreshScrollbars(); - - // erase part of the control - virtual void EraseBackground(wxDC& dc, const wxRect& rect); - - // overridden base class methods - // ----------------------------- - - // the rect coordinates are, for us, in client coords, but if no rect is - // specified, the entire window is refreshed - virtual void Refresh(bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL); - - // we refresh the window when it is dis/enabled - virtual bool Enable(bool enable = true); - - // should we use the standard control colours or not? - virtual bool ShouldInheritColours() const { return false; } - -protected: - // common part of all ctors - void Init(); - -#if wxUSE_MENUS - virtual bool DoPopupMenu(wxMenu *menu, int x, int y); -#endif // wxUSE_MENUS - - // we deal with the scrollbars in these functions - virtual void DoSetClientSize(int width, int height); - virtual void DoGetClientSize(int *width, int *height) const; - virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; - - // event handlers - void OnSize(wxSizeEvent& event); - void OnNcPaint(wxNcPaintEvent& event); - void OnPaint(wxPaintEvent& event); - void OnErase(wxEraseEvent& event); - -#if wxUSE_ACCEL || wxUSE_MENUS - void OnKeyDown(wxKeyEvent& event); -#endif // wxUSE_ACCEL - -#if wxUSE_MENUS - void OnChar(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); -#endif // wxUSE_MENUS - - // draw the control background, return true if done - virtual bool DoDrawBackground(wxDC& dc); - - // draw the controls border - virtual void DoDrawBorder(wxDC& dc, const wxRect& rect); - - // draw the controls contents - virtual void DoDraw(wxControlRenderer *renderer); - - // calculate the best size for the client area of the window: default - // implementation of DoGetBestSize() uses this method and adds the border - // width to the result - virtual wxSize DoGetBestClientSize() const; - virtual wxSize DoGetBestSize() const; - - // adjust the size of the window to take into account its borders - wxSize AdjustSize(const wxSize& size) const; - - // put the scrollbars along the edges of the window - void PositionScrollbars(); - -#if wxUSE_MENUS - // return the menubar of the parent frame or NULL - wxMenuBar *GetParentFrameMenuBar() const; -#endif // wxUSE_MENUS - - // the renderer we use - wxRenderer *m_renderer; - - // background bitmap info - wxBitmap m_bitmapBg; - int m_alignBgBitmap; - wxStretch m_stretchBgBitmap; - - // old size - wxSize m_oldSize; - - // is the mouse currently inside the window? - bool m_isCurrent:1; - -#ifdef __WXMSW__ -public: - // override MSWWindowProc() to process WM_NCHITTEST - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); -#endif // __WXMSW__ - -private: - -#if wxUSE_SCROLLBAR - // the window scrollbars - wxScrollBar *m_scrollbarHorz, - *m_scrollbarVert; -#endif // wxUSE_SCROLLBAR - -#if wxUSE_MENUS - // the current modal event loop for the popup menu we show or NULL - static wxEventLoop *ms_evtLoopPopup; - - // the last window over which Alt was pressed (used by OnKeyUp) - static wxWindow *ms_winLastAltPress; -#endif // wxUSE_MENUS - - DECLARE_DYNAMIC_CLASS(wxWindow) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_UNIV_WINDOW_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/window.h +// Purpose: wxWindow class which is the base class for all +// wxUniv port controls, it supports the customization of the +// window drawing and input processing. +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// RCS-ID: $Id: window.h 39633 2006-06-08 11:25:30Z ABX $ +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_WINDOW_H_ +#define _WX_UNIV_WINDOW_H_ + +#include "wx/bitmap.h" // for m_bitmapBg + +class WXDLLEXPORT wxControlRenderer; +class WXDLLEXPORT wxEventLoop; + +#if wxUSE_MENUS + class WXDLLEXPORT wxMenu; + class WXDLLEXPORT wxMenuBar; +#endif // wxUSE_MENUS + +class WXDLLEXPORT wxRenderer; + +#if wxUSE_SCROLLBAR + class WXDLLEXPORT wxScrollBar; +#endif // wxUSE_SCROLLBAR + +#ifdef __WXX11__ +#define wxUSE_TWO_WINDOWS 1 +#else +#define wxUSE_TWO_WINDOWS 0 +#endif + +// ---------------------------------------------------------------------------- +// wxWindow +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) +#define wxWindowNative wxWindowMSW +#elif defined(__WXGTK__) +#define wxWindowNative wxWindowGTK +#elif defined(__WXMGL__) +#define wxWindowNative wxWindowMGL +#elif defined(__WXX11__) +#define wxWindowNative wxWindowX11 +#elif defined(__WXMAC__) +#define wxWindowNative wxWindowMac +#endif + +class WXDLLEXPORT wxWindow : public wxWindowNative +{ +public: + // ctors and create functions + // --------------------------- + + wxWindow() { Init(); } + + wxWindow(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + : wxWindowNative(parent, id, pos, size, style | wxCLIP_CHILDREN, name) + { Init(); } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + virtual ~wxWindow(); + + // background pixmap support + // ------------------------- + + virtual void SetBackground(const wxBitmap& bitmap, + int alignment = wxALIGN_CENTRE, + wxStretch stretch = wxSTRETCH_NOT); + + const wxBitmap& GetBackgroundBitmap(int *alignment = NULL, + wxStretch *stretch = NULL) const; + + // scrollbars: we (re)implement it ourselves using our own scrollbars + // instead of the native ones + // ------------------------------------------------------------------ + + virtual void SetScrollbar(int orient, + int pos, + int page, + int range, + bool refresh = true ); + virtual void SetScrollPos(int orient, int pos, bool refresh = true); + virtual int GetScrollPos(int orient) const; + virtual int GetScrollThumb(int orient) const; + virtual int GetScrollRange(int orient) const; + virtual void ScrollWindow(int dx, int dy, + const wxRect* rect = (wxRect *) NULL); + + // take into account the borders here + virtual wxPoint GetClientAreaOrigin() const; + + // popup menu support + // ------------------ + + // NB: all menu related functions are implemented in menu.cpp + +#if wxUSE_MENUS + // this is wxUniv-specific private method to be used only by wxMenu + void DismissPopupMenu(); +#endif // wxUSE_MENUS + + // miscellaneous other methods + // --------------------------- + + // get the state information + virtual bool IsFocused() const; + virtual bool IsCurrent() const; + virtual bool IsPressed() const; + virtual bool IsDefault() const; + + // return all state flags at once (combination of wxCONTROL_XXX values) + int GetStateFlags() const; + + // set the "highlighted" flag and return true if it changed + virtual bool SetCurrent(bool doit = true); + +#if wxUSE_SCROLLBAR + // get the scrollbar (may be NULL) for the given orientation + wxScrollBar *GetScrollbar(int orient) const + { + return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz; + } +#endif // wxUSE_SCROLLBAR + + // methods used by wxColourScheme to choose the colours for this window + // -------------------------------------------------------------------- + + // return true if this is a panel/canvas window which contains other + // controls only + virtual bool IsCanvasWindow() const { return false; } + + // return true if this control can be highlighted when the mouse is over + // it (the theme decides itself whether it is really highlighted or not) + virtual bool CanBeHighlighted() const { return false; } + + // return true if we should use the colours/fonts returned by the + // corresponding GetXXX() methods instead of the default ones + bool UseFgCol() const { return m_hasFgCol; } + bool UseFont() const { return m_hasFont; } + + // return true if this window serves as a container for the other windows + // only and doesn't get any input itself + virtual bool IsStaticBox() const { return false; } + + // returns the (low level) renderer to use for drawing the control by + // querying the current theme + wxRenderer *GetRenderer() const { return m_renderer; } + + // scrolling helper: like ScrollWindow() except that it doesn't refresh the + // uncovered window areas but returns the rectangle to update (don't call + // this with both dx and dy non zero) + wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = NULL); + + // after scrollbars are added or removed they must be refreshed by calling + // this function + void RefreshScrollbars(); + + // erase part of the control + virtual void EraseBackground(wxDC& dc, const wxRect& rect); + + // overridden base class methods + // ----------------------------- + + // the rect coordinates are, for us, in client coords, but if no rect is + // specified, the entire window is refreshed + virtual void Refresh(bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL); + + // we refresh the window when it is dis/enabled + virtual bool Enable(bool enable = true); + + // should we use the standard control colours or not? + virtual bool ShouldInheritColours() const { return false; } + +protected: + // common part of all ctors + void Init(); + +#if wxUSE_MENUS + virtual bool DoPopupMenu(wxMenu *menu, int x, int y); +#endif // wxUSE_MENUS + + // we deal with the scrollbars in these functions + virtual void DoSetClientSize(int width, int height); + virtual void DoGetClientSize(int *width, int *height) const; + virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; + + // event handlers + void OnSize(wxSizeEvent& event); + void OnNcPaint(wxNcPaintEvent& event); + void OnPaint(wxPaintEvent& event); + void OnErase(wxEraseEvent& event); + +#if wxUSE_ACCEL || wxUSE_MENUS + void OnKeyDown(wxKeyEvent& event); +#endif // wxUSE_ACCEL + +#if wxUSE_MENUS + void OnChar(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); +#endif // wxUSE_MENUS + + // draw the control background, return true if done + virtual bool DoDrawBackground(wxDC& dc); + + // draw the controls border + virtual void DoDrawBorder(wxDC& dc, const wxRect& rect); + + // draw the controls contents + virtual void DoDraw(wxControlRenderer *renderer); + + // calculate the best size for the client area of the window: default + // implementation of DoGetBestSize() uses this method and adds the border + // width to the result + virtual wxSize DoGetBestClientSize() const; + virtual wxSize DoGetBestSize() const; + + // adjust the size of the window to take into account its borders + wxSize AdjustSize(const wxSize& size) const; + + // put the scrollbars along the edges of the window + void PositionScrollbars(); + +#if wxUSE_MENUS + // return the menubar of the parent frame or NULL + wxMenuBar *GetParentFrameMenuBar() const; +#endif // wxUSE_MENUS + + // the renderer we use + wxRenderer *m_renderer; + + // background bitmap info + wxBitmap m_bitmapBg; + int m_alignBgBitmap; + wxStretch m_stretchBgBitmap; + + // old size + wxSize m_oldSize; + + // is the mouse currently inside the window? + bool m_isCurrent:1; + +#ifdef __WXMSW__ +public: + // override MSWWindowProc() to process WM_NCHITTEST + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); +#endif // __WXMSW__ + +private: + +#if wxUSE_SCROLLBAR + // the window scrollbars + wxScrollBar *m_scrollbarHorz, + *m_scrollbarVert; +#endif // wxUSE_SCROLLBAR + +#if wxUSE_MENUS + // the current modal event loop for the popup menu we show or NULL + static wxEventLoop *ms_evtLoopPopup; + + // the last window over which Alt was pressed (used by OnKeyUp) + static wxWindow *ms_winLastAltPress; +#endif // wxUSE_MENUS + + DECLARE_DYNAMIC_CLASS(wxWindow) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_UNIV_WINDOW_H_ diff --git a/Externals/wxWidgets/include/wx/unix/apptbase.h b/Externals/wxWidgets/include/wx/unix/apptbase.h index ad1693b26f..0fd100ea5c 100644 --- a/Externals/wxWidgets/include/wx/unix/apptbase.h +++ b/Externals/wxWidgets/include/wx/unix/apptbase.h @@ -1,54 +1,54 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/apptbase.h -// Purpose: declaration of wxAppTraits for Unix systems -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.06.2003 -// RCS-ID: $Id: apptbase.h 29409 2004-09-26 16:28:51Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_APPTBASE_H_ -#define _WX_UNIX_APPTBASE_H_ - -struct wxExecuteData; -class wxPipe; - -// ---------------------------------------------------------------------------- -// wxAppTraits: the Unix version adds extra hooks needed by Unix code -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxAppTraits : public wxAppTraitsBase -{ -public: - // wxExecute() support methods - // --------------------------- - - // called before starting the child process and creates the pipe used for - // detecting the process termination asynchronously in GUI, does nothing in - // wxBase - // - // if it returns false, we should return from wxExecute() with an error - virtual bool CreateEndProcessPipe(wxExecuteData& execData) = 0; - - // test if the given descriptor is the end of the pipe create by the - // function above - virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd) = 0; - - // ensure that the write end of the pipe is not closed by wxPipe dtor - virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData) = 0; - - // wait for the process termination, return whatever wxExecute() must - // return - virtual int WaitForChild(wxExecuteData& execData) = 0; - - - // wxThread helpers - // ---------------- - - // TODO -}; - -#endif // _WX_UNIX_APPTBASE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/apptbase.h +// Purpose: declaration of wxAppTraits for Unix systems +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.06.2003 +// RCS-ID: $Id: apptbase.h 29409 2004-09-26 16:28:51Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_APPTBASE_H_ +#define _WX_UNIX_APPTBASE_H_ + +struct wxExecuteData; +class wxPipe; + +// ---------------------------------------------------------------------------- +// wxAppTraits: the Unix version adds extra hooks needed by Unix code +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAppTraits : public wxAppTraitsBase +{ +public: + // wxExecute() support methods + // --------------------------- + + // called before starting the child process and creates the pipe used for + // detecting the process termination asynchronously in GUI, does nothing in + // wxBase + // + // if it returns false, we should return from wxExecute() with an error + virtual bool CreateEndProcessPipe(wxExecuteData& execData) = 0; + + // test if the given descriptor is the end of the pipe create by the + // function above + virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd) = 0; + + // ensure that the write end of the pipe is not closed by wxPipe dtor + virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData) = 0; + + // wait for the process termination, return whatever wxExecute() must + // return + virtual int WaitForChild(wxExecuteData& execData) = 0; + + + // wxThread helpers + // ---------------- + + // TODO +}; + +#endif // _WX_UNIX_APPTBASE_H_ + diff --git a/Externals/wxWidgets/include/wx/unix/apptrait.h b/Externals/wxWidgets/include/wx/unix/apptrait.h index e95f6dae4f..0bb0af469b 100644 --- a/Externals/wxWidgets/include/wx/unix/apptrait.h +++ b/Externals/wxWidgets/include/wx/unix/apptrait.h @@ -1,55 +1,55 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/apptrait.h -// Purpose: standard implementations of wxAppTraits for Unix -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.06.2003 -// RCS-ID: $Id: apptrait.h 43629 2006-11-24 11:33:53Z RR $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_APPTRAIT_H_ -#define _WX_UNIX_APPTRAIT_H_ - -// ---------------------------------------------------------------------------- -// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxConsoleAppTraits : public wxConsoleAppTraitsBase -{ -public: - virtual bool CreateEndProcessPipe(wxExecuteData& execData); - virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd); - virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData); - virtual int WaitForChild(wxExecuteData& execData); -}; - -#if wxUSE_GUI - -class WXDLLEXPORT wxGUIAppTraits : public wxGUIAppTraitsBase -{ -public: - virtual bool CreateEndProcessPipe(wxExecuteData& execData); - virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd); - virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData); - virtual int WaitForChild(wxExecuteData& execData); - -#if defined(__WXMAC__) || defined(__WXCOCOA__) - virtual wxStandardPathsBase& GetStandardPaths(); -#endif - virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; - -#ifdef __WXGTK__ - virtual wxString GetDesktopEnvironment() const; -#endif - -#if defined(__WXDEBUG__) && defined(__WXGTK20__) - virtual bool ShowAssertDialog(const wxString& msg); -#endif -}; - -#endif // wxUSE_GUI - -#endif // _WX_UNIX_APPTRAIT_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/apptrait.h +// Purpose: standard implementations of wxAppTraits for Unix +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.06.2003 +// RCS-ID: $Id: apptrait.h 43629 2006-11-24 11:33:53Z RR $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_APPTRAIT_H_ +#define _WX_UNIX_APPTRAIT_H_ + +// ---------------------------------------------------------------------------- +// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: + virtual bool CreateEndProcessPipe(wxExecuteData& execData); + virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd); + virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData); + virtual int WaitForChild(wxExecuteData& execData); +}; + +#if wxUSE_GUI + +class WXDLLEXPORT wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual bool CreateEndProcessPipe(wxExecuteData& execData); + virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd); + virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData); + virtual int WaitForChild(wxExecuteData& execData); + +#if defined(__WXMAC__) || defined(__WXCOCOA__) + virtual wxStandardPathsBase& GetStandardPaths(); +#endif + virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const; + +#ifdef __WXGTK__ + virtual wxString GetDesktopEnvironment() const; +#endif + +#if defined(__WXDEBUG__) && defined(__WXGTK20__) + virtual bool ShowAssertDialog(const wxString& msg); +#endif +}; + +#endif // wxUSE_GUI + +#endif // _WX_UNIX_APPTRAIT_H_ + diff --git a/Externals/wxWidgets/include/wx/unix/execute.h b/Externals/wxWidgets/include/wx/unix/execute.h index 7d333deffa..0f095e86c8 100644 --- a/Externals/wxWidgets/include/wx/unix/execute.h +++ b/Externals/wxWidgets/include/wx/unix/execute.h @@ -1,79 +1,79 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: unix/execute.h -// Purpose: private details of wxExecute() implementation -// Author: Vadim Zeitlin -// Id: $Id: execute.h 35055 2005-08-02 22:58:06Z MW $ -// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_EXECUTE_H -#define _WX_UNIX_EXECUTE_H - -#include "wx/unix/pipe.h" - -class WXDLLIMPEXP_BASE wxProcess; -class wxStreamTempInputBuffer; - -// if pid > 0, the execution is async and the data is freed in the callback -// executed when the process terminates, if pid < 0, the execution is -// synchronous and the caller (wxExecute) frees the data -struct wxEndProcessData -{ - int pid, // pid of the process - tag; // port dependent value - wxProcess *process; // if !NULL: notified on process termination - int exitcode; // the exit code -}; - -// struct in which information is passed from wxExecute() to wxAppTraits -// methods -struct wxExecuteData -{ - wxExecuteData() - { - flags = - pid = 0; - - process = NULL; - -#if wxUSE_STREAMS - bufOut = - bufErr = NULL; -#endif // wxUSE_STREAMS - } - - // wxExecute() flags - int flags; - - // the pid of the child process - int pid; - - // the associated process object or NULL - wxProcess *process; - - // pipe used for end process detection - wxPipe pipeEndProcDetect; - -#if wxUSE_STREAMS - // the input buffer bufOut is connected to stdout, this is why it is - // called bufOut and not bufIn - wxStreamTempInputBuffer *bufOut, - *bufErr; -#endif // wxUSE_STREAMS -}; - -// this function is called when the process terminates from port specific -// callback function and is common to all ports (src/unix/utilsunx.cpp) -extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data); - -// this function is called to associate the port-specific callback with the -// child process. The return valus is port-specific. -extern WXDLLIMPEXP_CORE int wxAddProcessCallback(wxEndProcessData *proc_data, int fd); - -#if defined(__DARWIN__) && (defined(__WXMAC__) || defined(__WXCOCOA__)) -// For ports (e.g. DARWIN) which can add callbacks based on the pid -extern int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid); -#endif - -#endif // _WX_UNIX_EXECUTE_H +///////////////////////////////////////////////////////////////////////////// +// Name: unix/execute.h +// Purpose: private details of wxExecute() implementation +// Author: Vadim Zeitlin +// Id: $Id: execute.h 35055 2005-08-02 22:58:06Z MW $ +// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_EXECUTE_H +#define _WX_UNIX_EXECUTE_H + +#include "wx/unix/pipe.h" + +class WXDLLIMPEXP_BASE wxProcess; +class wxStreamTempInputBuffer; + +// if pid > 0, the execution is async and the data is freed in the callback +// executed when the process terminates, if pid < 0, the execution is +// synchronous and the caller (wxExecute) frees the data +struct wxEndProcessData +{ + int pid, // pid of the process + tag; // port dependent value + wxProcess *process; // if !NULL: notified on process termination + int exitcode; // the exit code +}; + +// struct in which information is passed from wxExecute() to wxAppTraits +// methods +struct wxExecuteData +{ + wxExecuteData() + { + flags = + pid = 0; + + process = NULL; + +#if wxUSE_STREAMS + bufOut = + bufErr = NULL; +#endif // wxUSE_STREAMS + } + + // wxExecute() flags + int flags; + + // the pid of the child process + int pid; + + // the associated process object or NULL + wxProcess *process; + + // pipe used for end process detection + wxPipe pipeEndProcDetect; + +#if wxUSE_STREAMS + // the input buffer bufOut is connected to stdout, this is why it is + // called bufOut and not bufIn + wxStreamTempInputBuffer *bufOut, + *bufErr; +#endif // wxUSE_STREAMS +}; + +// this function is called when the process terminates from port specific +// callback function and is common to all ports (src/unix/utilsunx.cpp) +extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data); + +// this function is called to associate the port-specific callback with the +// child process. The return valus is port-specific. +extern WXDLLIMPEXP_CORE int wxAddProcessCallback(wxEndProcessData *proc_data, int fd); + +#if defined(__DARWIN__) && (defined(__WXMAC__) || defined(__WXCOCOA__)) +// For ports (e.g. DARWIN) which can add callbacks based on the pid +extern int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid); +#endif + +#endif // _WX_UNIX_EXECUTE_H diff --git a/Externals/wxWidgets/include/wx/unix/fontutil.h b/Externals/wxWidgets/include/wx/unix/fontutil.h index 5d7da717b3..498bed1d57 100644 --- a/Externals/wxWidgets/include/wx/unix/fontutil.h +++ b/Externals/wxWidgets/include/wx/unix/fontutil.h @@ -1,37 +1,37 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/fontutil.h -// Purpose: font-related helper functions for Unix/X11 -// Author: Vadim Zeitlin -// Modified by: -// Created: 05.11.99 -// RCS-ID: $Id: fontutil.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_FONTUTIL_H_ -#define _WX_UNIX_FONTUTIL_H_ - -#ifdef __X__ - typedef WXFontStructPtr wxNativeFont; -#elif defined(__WXGTK__) - typedef GdkFont *wxNativeFont; -#else - #error "Unsupported toolkit" -#endif - -// returns the handle of the nearest available font or 0 -extern wxNativeFont -wxLoadQueryNearestFont(int pointSize, - int family, - int style, - int weight, - bool underlined, - const wxString &facename, - wxFontEncoding encoding, - wxString* xFontName = (wxString *)NULL); - -// returns the font specified by the given XLFD -extern wxNativeFont wxLoadFont(const wxString& fontSpec); - -#endif // _WX_UNIX_FONTUTIL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/fontutil.h +// Purpose: font-related helper functions for Unix/X11 +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.11.99 +// RCS-ID: $Id: fontutil.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_FONTUTIL_H_ +#define _WX_UNIX_FONTUTIL_H_ + +#ifdef __X__ + typedef WXFontStructPtr wxNativeFont; +#elif defined(__WXGTK__) + typedef GdkFont *wxNativeFont; +#else + #error "Unsupported toolkit" +#endif + +// returns the handle of the nearest available font or 0 +extern wxNativeFont +wxLoadQueryNearestFont(int pointSize, + int family, + int style, + int weight, + bool underlined, + const wxString &facename, + wxFontEncoding encoding, + wxString* xFontName = (wxString *)NULL); + +// returns the font specified by the given XLFD +extern wxNativeFont wxLoadFont(const wxString& fontSpec); + +#endif // _WX_UNIX_FONTUTIL_H_ diff --git a/Externals/wxWidgets/include/wx/unix/gsockunx.h b/Externals/wxWidgets/include/wx/unix/gsockunx.h index abdf6f901a..4537f149bc 100644 --- a/Externals/wxWidgets/include/wx/unix/gsockunx.h +++ b/Externals/wxWidgets/include/wx/unix/gsockunx.h @@ -1,145 +1,145 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) for WX - * Name: gsockunx.h - * Copyright: (c) Guilhem Lavaux - * Licence: wxWindows Licence - * Purpose: GSocket Unix header - * CVSID: $Id: gsockunx.h 33948 2005-05-04 18:57:50Z JS $ - * ------------------------------------------------------------------------- - */ - -#ifndef __GSOCK_UNX_H -#define __GSOCK_UNX_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/setup.h" -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/gsocket.h" -#else -#include "gsocket.h" -#endif - -class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Install_Callback(GSocket *socket, GSocketEvent event); - virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - -class GSocket -{ -public: - GSocket(); - virtual ~GSocket(); - bool IsOk() { return m_ok; } - void Close(); - void Shutdown(); - GSocketError SetLocal(GAddress *address); - GSocketError SetPeer(GAddress *address); - GAddress *GetLocal(); - GAddress *GetPeer(); - GSocketError SetServer(); - GSocket *WaitConnection(); - bool SetReusable(); - GSocketError Connect(GSocketStream stream); - GSocketError SetNonOriented(); - int Read(char *buffer, int size); - int Write(const char *buffer, int size); - GSocketEventFlags Select(GSocketEventFlags flags); - void SetNonBlocking(bool non_block); - void SetTimeout(unsigned long millisec); - GSocketError WXDLLIMPEXP_NET GetError(); - void SetCallback(GSocketEventFlags flags, - GSocketCallback callback, char *cdata); - void UnsetCallback(GSocketEventFlags flags); - GSocketError GetSockOpt(int level, int optname, void *optval, int *optlen); - GSocketError SetSockOpt(int level, int optname, - const void *optval, int optlen); - virtual void Detected_Read(); - virtual void Detected_Write(); -protected: - void Enable(GSocketEvent event); - void Disable(GSocketEvent event); - GSocketError Input_Timeout(); - GSocketError Output_Timeout(); - int Recv_Stream(char *buffer, int size); - int Recv_Dgram(char *buffer, int size); - int Send_Stream(const char *buffer, int size); - int Send_Dgram(const char *buffer, int size); - bool m_ok; -public: - /* DFE: We can't protect these data member until the GUI code is updated */ - /* protected: */ - int m_fd; - GAddress *m_local; - GAddress *m_peer; - GSocketError m_error; - - bool m_non_blocking; - bool m_server; - bool m_stream; - bool m_establishing; - bool m_reusable; - unsigned long m_timeout; - - /* Callbacks */ - GSocketEventFlags m_detected; - GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; - char *m_data[GSOCK_MAX_EVENT]; - - char *m_gui_dependent; - -}; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -/* Definition of GAddress */ -struct _GAddress -{ - struct sockaddr *m_addr; - size_t m_len; - - GAddressType m_family; - int m_realfamily; - - GSocketError m_error; -}; -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/* GAddress */ - -GSocketError _GAddress_translate_from(GAddress *address, - struct sockaddr *addr, int len); -GSocketError _GAddress_translate_to (GAddress *address, - struct sockaddr **addr, int *len); -GSocketError _GAddress_Init_INET(GAddress *address); -GSocketError _GAddress_Init_UNIX(GAddress *address); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -#endif /* __GSOCK_UNX_H */ +/* ------------------------------------------------------------------------- + * Project: GSocket (Generic Socket) for WX + * Name: gsockunx.h + * Copyright: (c) Guilhem Lavaux + * Licence: wxWindows Licence + * Purpose: GSocket Unix header + * CVSID: $Id: gsockunx.h 33948 2005-05-04 18:57:50Z JS $ + * ------------------------------------------------------------------------- + */ + +#ifndef __GSOCK_UNX_H +#define __GSOCK_UNX_H + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/setup.h" +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/gsocket.h" +#else +#include "gsocket.h" +#endif + +class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable +{ +public: + virtual bool OnInit(); + virtual void OnExit(); + virtual bool CanUseEventLoop(); + virtual bool Init_Socket(GSocket *socket); + virtual void Destroy_Socket(GSocket *socket); + virtual void Install_Callback(GSocket *socket, GSocketEvent event); + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); + virtual void Enable_Events(GSocket *socket); + virtual void Disable_Events(GSocket *socket); +}; + +class GSocket +{ +public: + GSocket(); + virtual ~GSocket(); + bool IsOk() { return m_ok; } + void Close(); + void Shutdown(); + GSocketError SetLocal(GAddress *address); + GSocketError SetPeer(GAddress *address); + GAddress *GetLocal(); + GAddress *GetPeer(); + GSocketError SetServer(); + GSocket *WaitConnection(); + bool SetReusable(); + GSocketError Connect(GSocketStream stream); + GSocketError SetNonOriented(); + int Read(char *buffer, int size); + int Write(const char *buffer, int size); + GSocketEventFlags Select(GSocketEventFlags flags); + void SetNonBlocking(bool non_block); + void SetTimeout(unsigned long millisec); + GSocketError WXDLLIMPEXP_NET GetError(); + void SetCallback(GSocketEventFlags flags, + GSocketCallback callback, char *cdata); + void UnsetCallback(GSocketEventFlags flags); + GSocketError GetSockOpt(int level, int optname, void *optval, int *optlen); + GSocketError SetSockOpt(int level, int optname, + const void *optval, int optlen); + virtual void Detected_Read(); + virtual void Detected_Write(); +protected: + void Enable(GSocketEvent event); + void Disable(GSocketEvent event); + GSocketError Input_Timeout(); + GSocketError Output_Timeout(); + int Recv_Stream(char *buffer, int size); + int Recv_Dgram(char *buffer, int size); + int Send_Stream(const char *buffer, int size); + int Send_Dgram(const char *buffer, int size); + bool m_ok; +public: + /* DFE: We can't protect these data member until the GUI code is updated */ + /* protected: */ + int m_fd; + GAddress *m_local; + GAddress *m_peer; + GSocketError m_error; + + bool m_non_blocking; + bool m_server; + bool m_stream; + bool m_establishing; + bool m_reusable; + unsigned long m_timeout; + + /* Callbacks */ + GSocketEventFlags m_detected; + GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; + char *m_data[GSOCK_MAX_EVENT]; + + char *m_gui_dependent; + +}; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +/* Definition of GAddress */ +struct _GAddress +{ + struct sockaddr *m_addr; + size_t m_len; + + GAddressType m_family; + int m_realfamily; + + GSocketError m_error; +}; +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* GAddress */ + +GSocketError _GAddress_translate_from(GAddress *address, + struct sockaddr *addr, int len); +GSocketError _GAddress_translate_to (GAddress *address, + struct sockaddr **addr, int *len); +GSocketError _GAddress_Init_INET(GAddress *address); +GSocketError _GAddress_Init_UNIX(GAddress *address); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + +#endif /* __GSOCK_UNX_H */ diff --git a/Externals/wxWidgets/include/wx/unix/joystick.h b/Externals/wxWidgets/include/wx/unix/joystick.h index b76dcef45d..c01c63c928 100644 --- a/Externals/wxWidgets/include/wx/unix/joystick.h +++ b/Externals/wxWidgets/include/wx/unix/joystick.h @@ -1,95 +1,95 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/joystick.h -// Purpose: wxJoystick class -// Author: Guilhem Lavaux -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: joystick.h 42077 2006-10-17 14:44:52Z ABX $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __JOYSTICKH__ -#define __JOYSTICKH__ - -#include "wx/event.h" -#include "wx/thread.h" - -class WXDLLEXPORT wxJoystickThread; - -class WXDLLEXPORT wxJoystick: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxJoystick) - public: - /* - * Public interface - */ - - wxJoystick(int joystick = wxJOYSTICK1); - virtual ~wxJoystick(); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - wxPoint GetPosition() const; - int GetZPosition() const; - int GetButtonState() const; - int GetPOVPosition() const; - int GetPOVCTSPosition() const; - int GetRudderPosition() const; - int GetUPosition() const; - int GetVPosition() const; - int GetMovementThreshold() const; - void SetMovementThreshold(int threshold) ; - - // Capabilities - //////////////////////////////////////////////////////////////////////////// - - bool IsOk() const; // Checks that the joystick is functioning - static int GetNumberJoysticks() ; - int GetManufacturerId() const ; - int GetProductId() const ; - wxString GetProductName() const ; - int GetXMin() const; - int GetYMin() const; - int GetZMin() const; - int GetXMax() const; - int GetYMax() const; - int GetZMax() const; - int GetNumberButtons() const; - int GetNumberAxes() const; - int GetMaxButtons() const; - int GetMaxAxes() const; - int GetPollingMin() const; - int GetPollingMax() const; - int GetRudderMin() const; - int GetRudderMax() const; - int GetUMin() const; - int GetUMax() const; - int GetVMin() const; - int GetVMax() const; - - bool HasRudder() const; - bool HasZ() const; - bool HasU() const; - bool HasV() const; - bool HasPOV() const; - bool HasPOV4Dir() const; - bool HasPOVCTS() const; - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // pollingFreq = 0 means that movement events are sent when above the threshold. - // If pollingFreq > 0, events are received every this many milliseconds. - bool SetCapture(wxWindow* win, int pollingFreq = 0); - bool ReleaseCapture(); - -protected: - int m_device; - int m_joystick; - wxJoystickThread* m_thread; -}; - -#endif - // __JOYSTICKH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/joystick.h +// Purpose: wxJoystick class +// Author: Guilhem Lavaux +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: joystick.h 42077 2006-10-17 14:44:52Z ABX $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __JOYSTICKH__ +#define __JOYSTICKH__ + +#include "wx/event.h" +#include "wx/thread.h" + +class WXDLLEXPORT wxJoystickThread; + +class WXDLLEXPORT wxJoystick: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1); + virtual ~wxJoystick(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + static int GetNumberJoysticks() ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_device; + int m_joystick; + wxJoystickThread* m_thread; +}; + +#endif + // __JOYSTICKH__ diff --git a/Externals/wxWidgets/include/wx/unix/mimetype.h b/Externals/wxWidgets/include/wx/unix/mimetype.h index f37923001c..bde5ab4784 100644 --- a/Externals/wxWidgets/include/wx/unix/mimetype.h +++ b/Externals/wxWidgets/include/wx/unix/mimetype.h @@ -1,215 +1,215 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/mimetype.h -// Purpose: classes and functions to manage MIME types -// Author: Vadim Zeitlin -// Modified by: -// Created: 23.09.98 -// RCS-ID: $Id: mimetype.h 43723 2006-11-30 13:24:32Z RR $ -// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence (part of wxExtra library) -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MIMETYPE_IMPL_H -#define _MIMETYPE_IMPL_H - -#include "wx/mimetype.h" - -#if wxUSE_MIMETYPE - -class wxMimeTypeCommands; - -WX_DEFINE_ARRAY_PTR(wxMimeTypeCommands *, wxMimeCommandsArray); - -// this is the real wxMimeTypesManager for Unix -class WXDLLEXPORT wxMimeTypesManagerImpl -{ -public: - // ctor and dtor - wxMimeTypesManagerImpl(); - virtual ~wxMimeTypesManagerImpl(); - - // load all data into memory - done when it is needed for the first time - void Initialize(int mailcapStyles = wxMAILCAP_ALL, - const wxString& extraDir = wxEmptyString); - - // and delete the data here - void ClearData(); - - // implement containing class functions - wxFileType *GetFileTypeFromExtension(const wxString& ext); - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - bool ReadMailcap(const wxString& filename, bool fallback = FALSE); - bool ReadMimeTypes(const wxString& filename); - - void AddFallback(const wxFileTypeInfo& filetype); - - // add information about the given mimetype - void AddMimeTypeInfo(const wxString& mimetype, - const wxString& extensions, - const wxString& description); - void AddMailcapInfo(const wxString& strType, - const wxString& strOpenCmd, - const wxString& strPrintCmd, - const wxString& strTest, - const wxString& strDesc); - - // add a new record to the user .mailcap/.mime.types files - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - // remove association - bool Unassociate(wxFileType *ft); - - // accessors - // get the string containing space separated extensions for the given - // file type - wxString GetExtension(size_t index) { return m_aExtensions[index]; } - -protected: - void InitIfNeeded(); - - wxArrayString m_aTypes, // MIME types - m_aDescriptions, // descriptions (just some text) - m_aExtensions, // space separated list of extensions - m_aIcons; // Icon filenames - - // verb=command pairs for this file type - wxMimeCommandsArray m_aEntries; - - // are we initialized? - bool m_initialized; - - // keep track of the files we had already loaded (this is a bitwise OR of - // wxMailcapStyle values) - int m_mailcapStylesInited; - - wxString GetCommand(const wxString &verb, size_t nIndex) const; - - // read Gnome files - void LoadGnomeDataFromKeyFile(const wxString& filename, - const wxArrayString& dirs); - void LoadGnomeMimeTypesFromMimeFile(const wxString& filename); - void LoadGnomeMimeFilesFromDir(const wxString& dirbase, - const wxArrayString& dirs); - void GetGnomeMimeInfo(const wxString& sExtraDir); - - // read KDE - void LoadKDELinksForMimeSubtype(const wxString& dirbase, - const wxString& subdir, - const wxString& filename, - const wxArrayString& icondirs); - void LoadKDELinksForMimeType(const wxString& dirbase, - const wxString& subdir, - const wxArrayString& icondirs); - void LoadKDELinkFilesFromDir(const wxString& dirbase, - const wxArrayString& icondirs); - void LoadKDEApp(const wxString& filename); - void LoadKDEAppsFilesFromDir(const wxString& dirname); - void GetKDEMimeInfo(const wxString& sExtraDir); - - // write KDE - bool WriteKDEMimeFile(int index, bool delete_index); - bool CheckKDEDirsExist(const wxString & sOK, const wxString& sTest); - - //read write Netscape and MetaMail formats - void GetMimeInfo (const wxString& sExtraDir); - bool WriteToMailCap (int index, bool delete_index); - bool WriteToMimeTypes (int index, bool delete_index); - bool WriteToNSMimeTypes (int index, bool delete_index); - - // ReadMailcap() helper - bool ProcessOtherMailcapField(struct MailcapLineData& data, - const wxString& curField); - - // functions used to do associations - - virtual int AddToMimeData(const wxString& strType, - const wxString& strIcon, - wxMimeTypeCommands *entry, - const wxArrayString& strExtensions, - const wxString& strDesc, - bool replaceExisting = TRUE); - - virtual bool DoAssociation(const wxString& strType, - const wxString& strIcon, - wxMimeTypeCommands *entry, - const wxArrayString& strExtensions, - const wxString& strDesc); - - virtual bool WriteMimeInfo(int nIndex, bool delete_mime ); - - // give it access to m_aXXX variables - friend class WXDLLEXPORT wxFileTypeImpl; -}; - - - -class WXDLLEXPORT wxFileTypeImpl -{ -public: - // initialization functions - // this is used to construct a list of mimetypes which match; - // if built with GetFileTypeFromMimetype index 0 has the exact match and - // index 1 the type / * match - // if built with GetFileTypeFromExtension, index 0 has the mimetype for - // the first extension found, index 1 for the second and so on - - void Init(wxMimeTypesManagerImpl *manager, size_t index) - { m_manager = manager; m_index.Add(index); } - - // accessors - bool GetExtensions(wxArrayString& extensions); - bool GetMimeType(wxString *mimeType) const - { *mimeType = m_manager->m_aTypes[m_index[0]]; return TRUE; } - bool GetMimeTypes(wxArrayString& mimeTypes) const; - bool GetIcon(wxIconLocation *iconLoc) const; - - bool GetDescription(wxString *desc) const - { *desc = m_manager->m_aDescriptions[m_index[0]]; return TRUE; } - - bool GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) const - { - *openCmd = GetExpandedCommand(wxT("open"), params); - return (! openCmd -> IsEmpty() ); - } - - bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters& params) const - { - *printCmd = GetExpandedCommand(wxT("print"), params); - return (! printCmd -> IsEmpty() ); - } - - // return the number of commands defined for this file type, 0 if none - size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, - const wxFileType::MessageParameters& params) const; - - - // remove the record for this file type - // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead - bool Unassociate(wxFileType *ft) - { - return m_manager->Unassociate(ft); - } - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is TRUE - bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); - bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); - -private: - wxString - GetExpandedCommand(const wxString & verb, - const wxFileType::MessageParameters& params) const; - - wxMimeTypesManagerImpl *m_manager; - wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays -}; - -#endif // wxUSE_MIMETYPE - -#endif // _MIMETYPE_IMPL_H - - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// RCS-ID: $Id: mimetype.h 43723 2006-11-30 13:24:32Z RR $ +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/mimetype.h" + +#if wxUSE_MIMETYPE + +class wxMimeTypeCommands; + +WX_DEFINE_ARRAY_PTR(wxMimeTypeCommands *, wxMimeCommandsArray); + +// this is the real wxMimeTypesManager for Unix +class WXDLLEXPORT wxMimeTypesManagerImpl +{ +public: + // ctor and dtor + wxMimeTypesManagerImpl(); + virtual ~wxMimeTypesManagerImpl(); + + // load all data into memory - done when it is needed for the first time + void Initialize(int mailcapStyles = wxMAILCAP_ALL, + const wxString& extraDir = wxEmptyString); + + // and delete the data here + void ClearData(); + + // implement containing class functions + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + bool ReadMailcap(const wxString& filename, bool fallback = FALSE); + bool ReadMimeTypes(const wxString& filename); + + void AddFallback(const wxFileTypeInfo& filetype); + + // add information about the given mimetype + void AddMimeTypeInfo(const wxString& mimetype, + const wxString& extensions, + const wxString& description); + void AddMailcapInfo(const wxString& strType, + const wxString& strOpenCmd, + const wxString& strPrintCmd, + const wxString& strTest, + const wxString& strDesc); + + // add a new record to the user .mailcap/.mime.types files + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + // remove association + bool Unassociate(wxFileType *ft); + + // accessors + // get the string containing space separated extensions for the given + // file type + wxString GetExtension(size_t index) { return m_aExtensions[index]; } + +protected: + void InitIfNeeded(); + + wxArrayString m_aTypes, // MIME types + m_aDescriptions, // descriptions (just some text) + m_aExtensions, // space separated list of extensions + m_aIcons; // Icon filenames + + // verb=command pairs for this file type + wxMimeCommandsArray m_aEntries; + + // are we initialized? + bool m_initialized; + + // keep track of the files we had already loaded (this is a bitwise OR of + // wxMailcapStyle values) + int m_mailcapStylesInited; + + wxString GetCommand(const wxString &verb, size_t nIndex) const; + + // read Gnome files + void LoadGnomeDataFromKeyFile(const wxString& filename, + const wxArrayString& dirs); + void LoadGnomeMimeTypesFromMimeFile(const wxString& filename); + void LoadGnomeMimeFilesFromDir(const wxString& dirbase, + const wxArrayString& dirs); + void GetGnomeMimeInfo(const wxString& sExtraDir); + + // read KDE + void LoadKDELinksForMimeSubtype(const wxString& dirbase, + const wxString& subdir, + const wxString& filename, + const wxArrayString& icondirs); + void LoadKDELinksForMimeType(const wxString& dirbase, + const wxString& subdir, + const wxArrayString& icondirs); + void LoadKDELinkFilesFromDir(const wxString& dirbase, + const wxArrayString& icondirs); + void LoadKDEApp(const wxString& filename); + void LoadKDEAppsFilesFromDir(const wxString& dirname); + void GetKDEMimeInfo(const wxString& sExtraDir); + + // write KDE + bool WriteKDEMimeFile(int index, bool delete_index); + bool CheckKDEDirsExist(const wxString & sOK, const wxString& sTest); + + //read write Netscape and MetaMail formats + void GetMimeInfo (const wxString& sExtraDir); + bool WriteToMailCap (int index, bool delete_index); + bool WriteToMimeTypes (int index, bool delete_index); + bool WriteToNSMimeTypes (int index, bool delete_index); + + // ReadMailcap() helper + bool ProcessOtherMailcapField(struct MailcapLineData& data, + const wxString& curField); + + // functions used to do associations + + virtual int AddToMimeData(const wxString& strType, + const wxString& strIcon, + wxMimeTypeCommands *entry, + const wxArrayString& strExtensions, + const wxString& strDesc, + bool replaceExisting = TRUE); + + virtual bool DoAssociation(const wxString& strType, + const wxString& strIcon, + wxMimeTypeCommands *entry, + const wxArrayString& strExtensions, + const wxString& strDesc); + + virtual bool WriteMimeInfo(int nIndex, bool delete_mime ); + + // give it access to m_aXXX variables + friend class WXDLLEXPORT wxFileTypeImpl; +}; + + + +class WXDLLEXPORT wxFileTypeImpl +{ +public: + // initialization functions + // this is used to construct a list of mimetypes which match; + // if built with GetFileTypeFromMimetype index 0 has the exact match and + // index 1 the type / * match + // if built with GetFileTypeFromExtension, index 0 has the mimetype for + // the first extension found, index 1 for the second and so on + + void Init(wxMimeTypesManagerImpl *manager, size_t index) + { m_manager = manager; m_index.Add(index); } + + // accessors + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const + { *mimeType = m_manager->m_aTypes[m_index[0]]; return TRUE; } + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + + bool GetDescription(wxString *desc) const + { *desc = m_manager->m_aDescriptions[m_index[0]]; return TRUE; } + + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters& params) const + { + *openCmd = GetExpandedCommand(wxT("open"), params); + return (! openCmd -> IsEmpty() ); + } + + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters& params) const + { + *printCmd = GetExpandedCommand(wxT("print"), params); + return (! printCmd -> IsEmpty() ); + } + + // return the number of commands defined for this file type, 0 if none + size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, + const wxFileType::MessageParameters& params) const; + + + // remove the record for this file type + // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead + bool Unassociate(wxFileType *ft) + { + return m_manager->Unassociate(ft); + } + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is TRUE + bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); + bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); + +private: + wxString + GetExpandedCommand(const wxString & verb, + const wxFileType::MessageParameters& params) const; + + wxMimeTypesManagerImpl *m_manager; + wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays +}; + +#endif // wxUSE_MIMETYPE + +#endif // _MIMETYPE_IMPL_H + + diff --git a/Externals/wxWidgets/include/wx/unix/pipe.h b/Externals/wxWidgets/include/wx/unix/pipe.h index b693ae89f1..84310626e7 100644 --- a/Externals/wxWidgets/include/wx/unix/pipe.h +++ b/Externals/wxWidgets/include/wx/unix/pipe.h @@ -1,114 +1,114 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/pipe.h -// Purpose: wxPipe class -// Author: Vadim Zeitlin -// Modified by: -// Created: 24.06.2003 (extracted from src/unix/utilsunx.cpp) -// RCS-ID: $Id: pipe.h 40518 2006-08-08 13:06:05Z VS $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_PIPE_H_ -#define _WX_UNIX_PIPE_H_ - -#include <unistd.h> - -#include "wx/log.h" -#include "wx/intl.h" - -// ---------------------------------------------------------------------------- -// wxPipe: this class encapsulates pipe() system call -// ---------------------------------------------------------------------------- - -class wxPipe -{ -public: - // the symbolic names for the pipe ends - enum Direction - { - Read, - Write - }; - - enum - { - INVALID_FD = -1 - }; - - // default ctor doesn't do anything - wxPipe() { m_fds[Read] = m_fds[Write] = INVALID_FD; } - - // create the pipe, return TRUE if ok, FALSE on error - bool Create() - { - if ( pipe(m_fds) == -1 ) - { - wxLogSysError(_("Pipe creation failed")); - - return FALSE; - } - - return TRUE; - } - - // return TRUE if we were created successfully - bool IsOk() const { return m_fds[Read] != INVALID_FD; } - - // return the descriptor for one of the pipe ends - int operator[](Direction which) const { return m_fds[which]; } - - // detach a descriptor, meaning that the pipe dtor won't close it, and - // return it - int Detach(Direction which) - { - int fd = m_fds[which]; - m_fds[which] = INVALID_FD; - - return fd; - } - - // close the pipe descriptors - void Close() - { - for ( size_t n = 0; n < WXSIZEOF(m_fds); n++ ) - { - if ( m_fds[n] != INVALID_FD ) - { - close(m_fds[n]); - m_fds[n] = INVALID_FD; - } - } - } - - // dtor closes the pipe descriptors - ~wxPipe() { Close(); } - -private: - int m_fds[2]; -}; - -#if wxUSE_STREAMS && wxUSE_FILE - -#include "wx/wfstream.h" - -// ---------------------------------------------------------------------------- -// wxPipeInputStream: stream for reading from a pipe -// ---------------------------------------------------------------------------- - -class wxPipeInputStream : public wxFileInputStream -{ -public: - wxPipeInputStream(int fd) : wxFileInputStream(fd) { } - - // return TRUE if the pipe is still opened - bool IsOpened() const { return !Eof(); } - - // return TRUE if we have anything to read, don't block - virtual bool CanRead() const; -}; - -#endif // wxUSE_STREAMS && wxUSE_FILE - -#endif // _WX_UNIX_PIPE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/pipe.h +// Purpose: wxPipe class +// Author: Vadim Zeitlin +// Modified by: +// Created: 24.06.2003 (extracted from src/unix/utilsunx.cpp) +// RCS-ID: $Id: pipe.h 40518 2006-08-08 13:06:05Z VS $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PIPE_H_ +#define _WX_UNIX_PIPE_H_ + +#include <unistd.h> + +#include "wx/log.h" +#include "wx/intl.h" + +// ---------------------------------------------------------------------------- +// wxPipe: this class encapsulates pipe() system call +// ---------------------------------------------------------------------------- + +class wxPipe +{ +public: + // the symbolic names for the pipe ends + enum Direction + { + Read, + Write + }; + + enum + { + INVALID_FD = -1 + }; + + // default ctor doesn't do anything + wxPipe() { m_fds[Read] = m_fds[Write] = INVALID_FD; } + + // create the pipe, return TRUE if ok, FALSE on error + bool Create() + { + if ( pipe(m_fds) == -1 ) + { + wxLogSysError(_("Pipe creation failed")); + + return FALSE; + } + + return TRUE; + } + + // return TRUE if we were created successfully + bool IsOk() const { return m_fds[Read] != INVALID_FD; } + + // return the descriptor for one of the pipe ends + int operator[](Direction which) const { return m_fds[which]; } + + // detach a descriptor, meaning that the pipe dtor won't close it, and + // return it + int Detach(Direction which) + { + int fd = m_fds[which]; + m_fds[which] = INVALID_FD; + + return fd; + } + + // close the pipe descriptors + void Close() + { + for ( size_t n = 0; n < WXSIZEOF(m_fds); n++ ) + { + if ( m_fds[n] != INVALID_FD ) + { + close(m_fds[n]); + m_fds[n] = INVALID_FD; + } + } + } + + // dtor closes the pipe descriptors + ~wxPipe() { Close(); } + +private: + int m_fds[2]; +}; + +#if wxUSE_STREAMS && wxUSE_FILE + +#include "wx/wfstream.h" + +// ---------------------------------------------------------------------------- +// wxPipeInputStream: stream for reading from a pipe +// ---------------------------------------------------------------------------- + +class wxPipeInputStream : public wxFileInputStream +{ +public: + wxPipeInputStream(int fd) : wxFileInputStream(fd) { } + + // return TRUE if the pipe is still opened + bool IsOpened() const { return !Eof(); } + + // return TRUE if we have anything to read, don't block + virtual bool CanRead() const; +}; + +#endif // wxUSE_STREAMS && wxUSE_FILE + +#endif // _WX_UNIX_PIPE_H_ + diff --git a/Externals/wxWidgets/include/wx/unix/private.h b/Externals/wxWidgets/include/wx/unix/private.h index 2e4249a11a..abae99420c 100644 --- a/Externals/wxWidgets/include/wx/unix/private.h +++ b/Externals/wxWidgets/include/wx/unix/private.h @@ -1,47 +1,47 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/private.h -// Purpose: miscellaneous private things for Unix wx ports -// Author: Vadim Zeitlin -// Created: 2005-09-25 -// RCS-ID: $Id: private.h 35688 2005-09-25 19:59:19Z VZ $ -// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_PRIVATE_H_ -#define _WX_UNIX_PRIVATE_H_ - -// standard linux headers produce many warnings when used with icc -#if defined(__INTELC__) && defined(__LINUX__) - inline void wxFD_ZERO(fd_set *fds) - { - #pragma warning(push) - #pragma warning(disable:593) - FD_ZERO(fds); - #pragma warning(pop) - } - - inline void wxFD_SET(int fd, fd_set *fds) - { - #pragma warning(push, 1) - #pragma warning(disable:1469) - FD_SET(fd, fds); - #pragma warning(pop) - } - - inline bool wxFD_ISSET(int fd, fd_set *fds) - { - #pragma warning(push, 1) - #pragma warning(disable:1469) - return FD_ISSET(fd, fds); - #pragma warning(pop) - } -#else // !__INTELC__ - #define wxFD_ZERO(fds) FD_ZERO(fds) - #define wxFD_SET(fd, fds) FD_SET(fd, fds) - #define wxFD_ISSET(fd, fds) FD_ISSET(fd, fds) -#endif // __INTELC__/!__INTELC__ - - -#endif // _WX_UNIX_PRIVATE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private.h +// Purpose: miscellaneous private things for Unix wx ports +// Author: Vadim Zeitlin +// Created: 2005-09-25 +// RCS-ID: $Id: private.h 35688 2005-09-25 19:59:19Z VZ $ +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_H_ +#define _WX_UNIX_PRIVATE_H_ + +// standard linux headers produce many warnings when used with icc +#if defined(__INTELC__) && defined(__LINUX__) + inline void wxFD_ZERO(fd_set *fds) + { + #pragma warning(push) + #pragma warning(disable:593) + FD_ZERO(fds); + #pragma warning(pop) + } + + inline void wxFD_SET(int fd, fd_set *fds) + { + #pragma warning(push, 1) + #pragma warning(disable:1469) + FD_SET(fd, fds); + #pragma warning(pop) + } + + inline bool wxFD_ISSET(int fd, fd_set *fds) + { + #pragma warning(push, 1) + #pragma warning(disable:1469) + return FD_ISSET(fd, fds); + #pragma warning(pop) + } +#else // !__INTELC__ + #define wxFD_ZERO(fds) FD_ZERO(fds) + #define wxFD_SET(fd, fds) FD_SET(fd, fds) + #define wxFD_ISSET(fd, fds) FD_ISSET(fd, fds) +#endif // __INTELC__/!__INTELC__ + + +#endif // _WX_UNIX_PRIVATE_H_ + diff --git a/Externals/wxWidgets/include/wx/unix/sound.h b/Externals/wxWidgets/include/wx/unix/sound.h index 0e18584c3e..adf71381d1 100644 --- a/Externals/wxWidgets/include/wx/unix/sound.h +++ b/Externals/wxWidgets/include/wx/unix/sound.h @@ -1,161 +1,161 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/sound.h -// Purpose: wxSound class -// Author: Julian Smart, Vaclav Slavik -// Modified by: -// Created: 25/10/98 -// RCS-ID: $Id: sound.h 42115 2006-10-19 13:09:48Z VZ $ -// Copyright: (c) Julian Smart, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SOUND_H_ -#define _WX_SOUND_H_ - -#include "wx/defs.h" - -#if wxUSE_SOUND - -#include "wx/object.h" - -// ---------------------------------------------------------------------------- -// wxSound: simple audio playback class -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxSoundBackend; -class WXDLLIMPEXP_ADV wxSound; -class WXDLLIMPEXP_BASE wxDynamicLibrary; - -/// Sound data, as loaded from .wav file: -class WXDLLIMPEXP_ADV wxSoundData -{ -public: - wxSoundData() : m_refCnt(1) {} - void IncRef(); - void DecRef(); - - // .wav header information: - unsigned m_channels; // num of channels (mono:1, stereo:2) - unsigned m_samplingRate; - unsigned m_bitsPerSample; // if 8, then m_data contains unsigned 8bit - // samples (wxUint8), if 16 then signed 16bit - // (wxInt16) - unsigned m_samples; // length in samples: - - // wave data: - size_t m_dataBytes; - wxUint8 *m_data; // m_dataBytes bytes of data - -private: - ~wxSoundData(); - unsigned m_refCnt; - wxUint8 *m_dataWithHeader; // ditto, but prefixed with .wav header - friend class wxSound; -}; - - -/// Simple sound class: -class WXDLLIMPEXP_ADV wxSound : public wxSoundBase -{ -public: - wxSound(); - wxSound(const wxString& fileName, bool isResource = false); - wxSound(int size, const wxByte* data); - virtual ~wxSound(); - - // Create from resource or file - bool Create(const wxString& fileName, bool isResource = false); - // Create from data - bool Create(int size, const wxByte* data); - - bool IsOk() const { return m_data != NULL; } - - // Stop playing any sound - static void Stop(); - - // Returns true if a sound is being played - static bool IsPlaying(); - - // for internal use - static void UnloadBackend(); - -protected: - bool DoPlay(unsigned flags) const; - - static void EnsureBackend(); - void Free(); - bool LoadWAV(const wxUint8 *data, size_t length, bool copyData); - - static wxSoundBackend *ms_backend; -#if wxUSE_LIBSDL && wxUSE_PLUGINS - // FIXME - temporary, until we have plugins architecture - static wxDynamicLibrary *ms_backendSDL; -#endif - -private: - wxSoundData *m_data; -}; - - -// ---------------------------------------------------------------------------- -// wxSoundBackend: -// ---------------------------------------------------------------------------- - -// This is interface to sound playing implementation. There are multiple -// sound architectures in use on Unix platforms and wxWidgets can use several -// of them for playback, depending on their availability at runtime; hence -// the need for backends. This class is for use by wxWidgets and people writing -// additional backends only, it is _not_ for use by applications! - -// Structure that holds playback status information -struct wxSoundPlaybackStatus -{ - // playback is in progress - bool m_playing; - // main thread called wxSound::Stop() - bool m_stopRequested; -}; - -// Audio backend interface -class WXDLLIMPEXP_ADV wxSoundBackend -{ -public: - virtual ~wxSoundBackend() {} - - // Returns the name of the backend (e.g. "Open Sound System") - virtual wxString GetName() const = 0; - - // Returns priority (higher priority backends are tried first) - virtual int GetPriority() const = 0; - - // Checks if the backend's audio system is available and the backend can - // be used for playback - virtual bool IsAvailable() const = 0; - - // Returns true if the backend is capable of playing sound asynchronously. - // If false, then wxWidgets creates a playback thread and handles async - // playback, otherwise it is left up to the backend (will usually be more - // effective). - virtual bool HasNativeAsyncPlayback() const = 0; - - // Plays the sound. flags are same flags as those passed to wxSound::Play. - // The function should periodically check the value of - // status->m_stopRequested and terminate if it is set to true (it may - // be modified by another thread) - virtual bool Play(wxSoundData *data, unsigned flags, - volatile wxSoundPlaybackStatus *status) = 0; - - // Stops playback (if something is played). - virtual void Stop() = 0; - - // Returns true if the backend is playing anything at the moment. - // (This method is never called for backends that don't support async - // playback.) - virtual bool IsPlaying() const = 0; -}; - - -#endif // wxUSE_SOUND - -#endif // _WX_SOUND_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/sound.h +// Purpose: wxSound class +// Author: Julian Smart, Vaclav Slavik +// Modified by: +// Created: 25/10/98 +// RCS-ID: $Id: sound.h 42115 2006-10-19 13:09:48Z VZ $ +// Copyright: (c) Julian Smart, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#include "wx/defs.h" + +#if wxUSE_SOUND + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxSound: simple audio playback class +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxSoundBackend; +class WXDLLIMPEXP_ADV wxSound; +class WXDLLIMPEXP_BASE wxDynamicLibrary; + +/// Sound data, as loaded from .wav file: +class WXDLLIMPEXP_ADV wxSoundData +{ +public: + wxSoundData() : m_refCnt(1) {} + void IncRef(); + void DecRef(); + + // .wav header information: + unsigned m_channels; // num of channels (mono:1, stereo:2) + unsigned m_samplingRate; + unsigned m_bitsPerSample; // if 8, then m_data contains unsigned 8bit + // samples (wxUint8), if 16 then signed 16bit + // (wxInt16) + unsigned m_samples; // length in samples: + + // wave data: + size_t m_dataBytes; + wxUint8 *m_data; // m_dataBytes bytes of data + +private: + ~wxSoundData(); + unsigned m_refCnt; + wxUint8 *m_dataWithHeader; // ditto, but prefixed with .wav header + friend class wxSound; +}; + + +/// Simple sound class: +class WXDLLIMPEXP_ADV wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = false); + wxSound(int size, const wxByte* data); + virtual ~wxSound(); + + // Create from resource or file + bool Create(const wxString& fileName, bool isResource = false); + // Create from data + bool Create(int size, const wxByte* data); + + bool IsOk() const { return m_data != NULL; } + + // Stop playing any sound + static void Stop(); + + // Returns true if a sound is being played + static bool IsPlaying(); + + // for internal use + static void UnloadBackend(); + +protected: + bool DoPlay(unsigned flags) const; + + static void EnsureBackend(); + void Free(); + bool LoadWAV(const wxUint8 *data, size_t length, bool copyData); + + static wxSoundBackend *ms_backend; +#if wxUSE_LIBSDL && wxUSE_PLUGINS + // FIXME - temporary, until we have plugins architecture + static wxDynamicLibrary *ms_backendSDL; +#endif + +private: + wxSoundData *m_data; +}; + + +// ---------------------------------------------------------------------------- +// wxSoundBackend: +// ---------------------------------------------------------------------------- + +// This is interface to sound playing implementation. There are multiple +// sound architectures in use on Unix platforms and wxWidgets can use several +// of them for playback, depending on their availability at runtime; hence +// the need for backends. This class is for use by wxWidgets and people writing +// additional backends only, it is _not_ for use by applications! + +// Structure that holds playback status information +struct wxSoundPlaybackStatus +{ + // playback is in progress + bool m_playing; + // main thread called wxSound::Stop() + bool m_stopRequested; +}; + +// Audio backend interface +class WXDLLIMPEXP_ADV wxSoundBackend +{ +public: + virtual ~wxSoundBackend() {} + + // Returns the name of the backend (e.g. "Open Sound System") + virtual wxString GetName() const = 0; + + // Returns priority (higher priority backends are tried first) + virtual int GetPriority() const = 0; + + // Checks if the backend's audio system is available and the backend can + // be used for playback + virtual bool IsAvailable() const = 0; + + // Returns true if the backend is capable of playing sound asynchronously. + // If false, then wxWidgets creates a playback thread and handles async + // playback, otherwise it is left up to the backend (will usually be more + // effective). + virtual bool HasNativeAsyncPlayback() const = 0; + + // Plays the sound. flags are same flags as those passed to wxSound::Play. + // The function should periodically check the value of + // status->m_stopRequested and terminate if it is set to true (it may + // be modified by another thread) + virtual bool Play(wxSoundData *data, unsigned flags, + volatile wxSoundPlaybackStatus *status) = 0; + + // Stops playback (if something is played). + virtual void Stop() = 0; + + // Returns true if the backend is playing anything at the moment. + // (This method is never called for backends that don't support async + // playback.) + virtual bool IsPlaying() const = 0; +}; + + +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_ + diff --git a/Externals/wxWidgets/include/wx/unix/stackwalk.h b/Externals/wxWidgets/include/wx/unix/stackwalk.h index 7528fcdcf6..15629d091a 100644 --- a/Externals/wxWidgets/include/wx/unix/stackwalk.h +++ b/Externals/wxWidgets/include/wx/unix/stackwalk.h @@ -1,97 +1,97 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/stackwalk.h -// Purpose: declaration of wxStackWalker for Unix -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-01-19 -// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ -// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_STACKWALK_H_ -#define _WX_UNIX_STACKWALK_H_ - -// ---------------------------------------------------------------------------- -// wxStackFrame -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase -{ - friend class wxStackWalker; - -public: - // arguments are the stack depth of this frame, its address and the return - // value of backtrace_symbols() for it - // - // NB: we don't copy syminfo pointer so it should have lifetime at least as - // long as ours - wxStackFrame(size_t level = 0, void *address = NULL, const char *syminfo = NULL) - : wxStackFrameBase(level, address) - { - m_syminfo = syminfo; - } - -protected: - virtual void OnGetName(); - - // optimized for the 2 step initialization done by wxStackWalker - void Set(const wxString &name, const wxString &filename, const char* syminfo, - size_t level, size_t numLine, void *address) - { - m_level = level; - m_name = name; - m_filename = filename; - m_syminfo = syminfo; - - m_line = numLine; - m_address = address; - } - -private: - const char *m_syminfo; -}; - -// ---------------------------------------------------------------------------- -// wxStackWalker -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase -{ -public: - // we need the full path to the program executable to be able to use - // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp - // doesn't exist or doesn't have the correct value, the path may be given - // explicitly - wxStackWalker(const char *argv0 = NULL) - { - ms_exepath = wxString::FromAscii(argv0); - } - - ~wxStackWalker() - { - FreeStack(); - } - - virtual void Walk(size_t skip = 1, size_t maxDepth = 200); - virtual void WalkFromException() { Walk(2); } - - static const wxString& GetExePath() { return ms_exepath; } - - - // these two may be used to save the stack at some point (fast operation) - // and then process it later (slow operation) - void SaveStack(size_t maxDepth); - void ProcessFrames(size_t skip); - void FreeStack(); - -private: - int InitFrames(wxStackFrame *arr, size_t n, void **addresses, char **syminfo); - - static wxString ms_exepath; - static void *ms_addresses[]; - static char **ms_symbols; - static int m_depth; -}; - -#endif // _WX_UNIX_STACKWALK_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/stackwalk.h +// Purpose: declaration of wxStackWalker for Unix +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-19 +// RCS-ID: $Id: stackwalk.h 43346 2006-11-12 14:33:03Z RR $ +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_STACKWALK_H_ +#define _WX_UNIX_STACKWALK_H_ + +// ---------------------------------------------------------------------------- +// wxStackFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase +{ + friend class wxStackWalker; + +public: + // arguments are the stack depth of this frame, its address and the return + // value of backtrace_symbols() for it + // + // NB: we don't copy syminfo pointer so it should have lifetime at least as + // long as ours + wxStackFrame(size_t level = 0, void *address = NULL, const char *syminfo = NULL) + : wxStackFrameBase(level, address) + { + m_syminfo = syminfo; + } + +protected: + virtual void OnGetName(); + + // optimized for the 2 step initialization done by wxStackWalker + void Set(const wxString &name, const wxString &filename, const char* syminfo, + size_t level, size_t numLine, void *address) + { + m_level = level; + m_name = name; + m_filename = filename; + m_syminfo = syminfo; + + m_line = numLine; + m_address = address; + } + +private: + const char *m_syminfo; +}; + +// ---------------------------------------------------------------------------- +// wxStackWalker +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase +{ +public: + // we need the full path to the program executable to be able to use + // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp + // doesn't exist or doesn't have the correct value, the path may be given + // explicitly + wxStackWalker(const char *argv0 = NULL) + { + ms_exepath = wxString::FromAscii(argv0); + } + + ~wxStackWalker() + { + FreeStack(); + } + + virtual void Walk(size_t skip = 1, size_t maxDepth = 200); + virtual void WalkFromException() { Walk(2); } + + static const wxString& GetExePath() { return ms_exepath; } + + + // these two may be used to save the stack at some point (fast operation) + // and then process it later (slow operation) + void SaveStack(size_t maxDepth); + void ProcessFrames(size_t skip); + void FreeStack(); + +private: + int InitFrames(wxStackFrame *arr, size_t n, void **addresses, char **syminfo); + + static wxString ms_exepath; + static void *ms_addresses[]; + static char **ms_symbols; + static int m_depth; +}; + +#endif // _WX_UNIX_STACKWALK_H_ diff --git a/Externals/wxWidgets/include/wx/unix/stdpaths.h b/Externals/wxWidgets/include/wx/unix/stdpaths.h index a6b4db05ac..3e7faaf8d5 100644 --- a/Externals/wxWidgets/include/wx/unix/stdpaths.h +++ b/Externals/wxWidgets/include/wx/unix/stdpaths.h @@ -1,56 +1,56 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/stdpaths.h -// Purpose: wxStandardPaths for Unix systems -// Author: Vadim Zeitlin -// Modified by: -// Created: 2004-10-19 -// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ -// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_STDPATHS_H_ -#define _WX_UNIX_STDPATHS_H_ - -// ---------------------------------------------------------------------------- -// wxStandardPaths -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase -{ -public: - // tries to determine the installation prefix automatically (Linux only right - // now) and returns /usr/local if it failed - void DetectPrefix(); - - // set the program installation directory which is /usr/local by default - // - // under some systems (currently only Linux) the program directory can be - // determined automatically but for portable programs you should always set - // it explicitly - void SetInstallPrefix(const wxString& prefix); - - // get the program installation prefix - // - // if the prefix had been previously by SetInstallPrefix, returns that - // value, otherwise calls DetectPrefix() - wxString GetInstallPrefix() const; - - - // implement base class pure virtuals - virtual wxString GetExecutablePath() const; - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; - virtual wxString GetDataDir() const; - virtual wxString GetLocalDataDir() const; - virtual wxString GetUserDataDir() const; - virtual wxString GetPluginsDir() const; - virtual wxString GetLocalizedResourcesDir(const wxChar *lang, - ResourceCat category) const; - -private: - wxString m_prefix; -}; - -#endif // _WX_UNIX_STDPATHS_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/stdpaths.h +// Purpose: wxStandardPaths for Unix systems +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-19 +// RCS-ID: $Id: stdpaths.h 43340 2006-11-12 12:58:10Z RR $ +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_STDPATHS_H_ +#define _WX_UNIX_STDPATHS_H_ + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + // tries to determine the installation prefix automatically (Linux only right + // now) and returns /usr/local if it failed + void DetectPrefix(); + + // set the program installation directory which is /usr/local by default + // + // under some systems (currently only Linux) the program directory can be + // determined automatically but for portable programs you should always set + // it explicitly + void SetInstallPrefix(const wxString& prefix); + + // get the program installation prefix + // + // if the prefix had been previously by SetInstallPrefix, returns that + // value, otherwise calls DetectPrefix() + wxString GetInstallPrefix() const; + + + // implement base class pure virtuals + virtual wxString GetExecutablePath() const; + virtual wxString GetConfigDir() const; + virtual wxString GetUserConfigDir() const; + virtual wxString GetDataDir() const; + virtual wxString GetLocalDataDir() const; + virtual wxString GetUserDataDir() const; + virtual wxString GetPluginsDir() const; + virtual wxString GetLocalizedResourcesDir(const wxChar *lang, + ResourceCat category) const; + +private: + wxString m_prefix; +}; + +#endif // _WX_UNIX_STDPATHS_H_ + diff --git a/Externals/wxWidgets/include/wx/unix/taskbarx11.h b/Externals/wxWidgets/include/wx/unix/taskbarx11.h index 419ea1e04a..04ec3ac04d 100644 --- a/Externals/wxWidgets/include/wx/unix/taskbarx11.h +++ b/Externals/wxWidgets/include/wx/unix/taskbarx11.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////// -// File: wx/unix/taskbarx11.h -// Purpose: Defines wxTaskBarIcon class for most common X11 desktops -// Author: Vaclav Slavik -// Modified by: -// Created: 04/04/2003 -// RCS-ID: $Id: taskbarx11.h 53563 2008-05-11 22:45:36Z PC $ -// Copyright: (c) Vaclav Slavik, 2003 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////// - -#ifndef _TASKBAR_H_ -#define _TASKBAR_H_ - -class WXDLLEXPORT wxIcon; -class WXDLLEXPORT wxFrame; -class WXDLLEXPORT wxWindow; - -class WXDLLIMPEXP_ADV wxTaskBarIconArea; - -class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase -{ -public: - wxTaskBarIcon(); - virtual ~wxTaskBarIcon(); - - // Accessors: - bool IsOk() const; - bool IsIconInstalled() const; - - // Operations: - bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - bool RemoveIcon(); - bool PopupMenu(wxMenu *menu); - -protected: - wxTaskBarIconArea *m_iconWnd; - -private: - void OnDestroy(wxWindowDestroyEvent&); - - DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) -}; - -#endif - // _TASKBAR_H_ +///////////////////////////////////////////////////////////////////////// +// File: wx/unix/taskbarx11.h +// Purpose: Defines wxTaskBarIcon class for most common X11 desktops +// Author: Vaclav Slavik +// Modified by: +// Created: 04/04/2003 +// RCS-ID: $Id: taskbarx11.h 53563 2008-05-11 22:45:36Z PC $ +// Copyright: (c) Vaclav Slavik, 2003 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _TASKBAR_H_ +#define _TASKBAR_H_ + +class WXDLLEXPORT wxIcon; +class WXDLLEXPORT wxFrame; +class WXDLLEXPORT wxWindow; + +class WXDLLIMPEXP_ADV wxTaskBarIconArea; + +class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase +{ +public: + wxTaskBarIcon(); + virtual ~wxTaskBarIcon(); + + // Accessors: + bool IsOk() const; + bool IsIconInstalled() const; + + // Operations: + bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); + bool RemoveIcon(); + bool PopupMenu(wxMenu *menu); + +protected: + wxTaskBarIconArea *m_iconWnd; + +private: + void OnDestroy(wxWindowDestroyEvent&); + + DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) +}; + +#endif + // _TASKBAR_H_ diff --git a/Externals/wxWidgets/include/wx/unix/utilsx11.h b/Externals/wxWidgets/include/wx/unix/utilsx11.h index 66ec873271..cad9f67445 100644 --- a/Externals/wxWidgets/include/wx/unix/utilsx11.h +++ b/Externals/wxWidgets/include/wx/unix/utilsx11.h @@ -1,53 +1,53 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/utilsx11.h -// Purpose: Miscellaneous X11 functions -// Author: Mattia Barbon, Vaclav Slavik -// Modified by: -// Created: 25.03.02 -// RCS-ID: $Id: utilsx11.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UNIX_UTILSX11_H_ -#define _WX_UNIX_UTILSX11_H_ - -#include "wx/defs.h" -#include "wx/gdicmn.h" - -// NB: Content of this header is for wxWidgets' private use! It is not -// part of public API and may be modified or even disappear in the future! - -#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__) - -#if defined(__WXGTK__) -typedef void WXDisplay; -typedef void* WXWindow; -#endif - -class wxIconBundle; - -void wxSetIconsX11( WXDisplay* display, WXWindow window, - const wxIconBundle& ib ); - - -enum wxX11FullScreenMethod -{ - wxX11_FS_AUTODETECT = 0, - wxX11_FS_WMSPEC, - wxX11_FS_KDE, - wxX11_FS_GENERIC -}; - -wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display, - WXWindow rootWindow); - -void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow, - WXWindow window, bool show, wxRect *origSize, - wxX11FullScreenMethod method); - -#endif - // __WXMOTIF__, __WXGTK__, __WXX11__ - -#endif - // _WX_UNIX_UTILSX11_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/utilsx11.h +// Purpose: Miscellaneous X11 functions +// Author: Mattia Barbon, Vaclav Slavik +// Modified by: +// Created: 25.03.02 +// RCS-ID: $Id: utilsx11.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_UTILSX11_H_ +#define _WX_UNIX_UTILSX11_H_ + +#include "wx/defs.h" +#include "wx/gdicmn.h" + +// NB: Content of this header is for wxWidgets' private use! It is not +// part of public API and may be modified or even disappear in the future! + +#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__) + +#if defined(__WXGTK__) +typedef void WXDisplay; +typedef void* WXWindow; +#endif + +class wxIconBundle; + +void wxSetIconsX11( WXDisplay* display, WXWindow window, + const wxIconBundle& ib ); + + +enum wxX11FullScreenMethod +{ + wxX11_FS_AUTODETECT = 0, + wxX11_FS_WMSPEC, + wxX11_FS_KDE, + wxX11_FS_GENERIC +}; + +wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display, + WXWindow rootWindow); + +void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow, + WXWindow window, bool show, wxRect *origSize, + wxX11FullScreenMethod method); + +#endif + // __WXMOTIF__, __WXGTK__, __WXX11__ + +#endif + // _WX_UNIX_UTILSX11_H_ diff --git a/Externals/wxWidgets/include/wx/uri.h b/Externals/wxWidgets/include/wx/uri.h index 33d843c602..23c97e2a1d 100644 --- a/Externals/wxWidgets/include/wx/uri.h +++ b/Externals/wxWidgets/include/wx/uri.h @@ -1,151 +1,151 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: uri.h -// Purpose: wxURI - Class for parsing URIs -// Author: Ryan Norton -// Modified By: -// Created: 07/01/2004 -// RCS-ID: $Id: uri.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) Ryan Norton -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_URI_H_ -#define _WX_URI_H_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" - -// Host Type that the server component can be -enum wxURIHostType -{ - wxURI_REGNAME, // Host is a normal register name (www.mysite.com etc.) - wxURI_IPV4ADDRESS, // Host is a version 4 ip address (192.168.1.100) - wxURI_IPV6ADDRESS, // Host is a version 6 ip address [aa:aa:aa:aa::aa:aa]:5050 - wxURI_IPVFUTURE // Host is a future ip address (wxURI is unsure what kind) -}; - -// Component Flags -enum wxURIFieldType -{ - wxURI_SCHEME = 1, - wxURI_USERINFO = 2, - wxURI_SERVER = 4, - wxURI_PORT = 8, - wxURI_PATH = 16, - wxURI_QUERY = 32, - wxURI_FRAGMENT = 64 -}; - -// Miscellaneous other flags -enum wxURIFlags -{ - wxURI_STRICT = 1 -}; - - -// Generic class for parsing URIs. -// -// See RFC 3986 -class WXDLLIMPEXP_BASE wxURI : public wxObject -{ -public: - wxURI(); - wxURI(const wxString& uri); - wxURI(const wxURI& uri); - - virtual ~wxURI(); - - const wxChar* Create(const wxString& uri); - - bool HasScheme() const { return (m_fields & wxURI_SCHEME) == wxURI_SCHEME; } - bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) == wxURI_USERINFO; } - bool HasServer() const { return (m_fields & wxURI_SERVER) == wxURI_SERVER; } - bool HasPort() const { return (m_fields & wxURI_PORT) == wxURI_PORT; } - bool HasPath() const { return (m_fields & wxURI_PATH) == wxURI_PATH; } - bool HasQuery() const { return (m_fields & wxURI_QUERY) == wxURI_QUERY; } - bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) == wxURI_FRAGMENT; } - - const wxString& GetScheme() const { return m_scheme; } - const wxString& GetPath() const { return m_path; } - const wxString& GetQuery() const { return m_query; } - const wxString& GetFragment() const { return m_fragment; } - const wxString& GetPort() const { return m_port; } - const wxString& GetUserInfo() const { return m_userinfo; } - const wxString& GetServer() const { return m_server; } - const wxURIHostType& GetHostType() const { return m_hostType; } - - //Note that the following two get functions are explicitly depreciated by RFC 2396 - wxString GetUser() const; - wxString GetPassword() const; - - wxString BuildURI() const; - wxString BuildUnescapedURI() const; - - void Resolve(const wxURI& base, int flags = wxURI_STRICT); - bool IsReference() const; - - wxURI& operator = (const wxURI& uri); - wxURI& operator = (const wxString& string); - bool operator == (const wxURI& uri) const; - - static wxString Unescape (const wxString& szEscapedURI); - -protected: - wxURI& Assign(const wxURI& uri); - - void Clear(); - - const wxChar* Parse (const wxChar* uri); - const wxChar* ParseAuthority (const wxChar* uri); - const wxChar* ParseScheme (const wxChar* uri); - const wxChar* ParseUserInfo (const wxChar* uri); - const wxChar* ParseServer (const wxChar* uri); - const wxChar* ParsePort (const wxChar* uri); - const wxChar* ParsePath (const wxChar* uri, - bool bReference = false, - bool bNormalize = true); - const wxChar* ParseQuery (const wxChar* uri); - const wxChar* ParseFragment (const wxChar* uri); - - - static bool ParseH16(const wxChar*& uri); - static bool ParseIPv4address(const wxChar*& uri); - static bool ParseIPv6address(const wxChar*& uri); - static bool ParseIPvFuture(const wxChar*& uri); - - static void Normalize(wxChar* uri, bool bIgnoreLeads = false); - static void UpTree(const wxChar* uristart, const wxChar*& uri); - - static wxChar TranslateEscape(const wxChar* s); - static void Escape (wxString& s, const wxChar& c); - static bool IsEscape(const wxChar*& uri); - - static wxChar CharToHex(const wxChar& c); - - static bool IsUnreserved (const wxChar& c); - static bool IsReserved (const wxChar& c); - static bool IsGenDelim (const wxChar& c); - static bool IsSubDelim (const wxChar& c); - static bool IsHex(const wxChar& c); - static bool IsAlpha(const wxChar& c); - static bool IsDigit(const wxChar& c); - - wxString m_scheme; - wxString m_path; - wxString m_query; - wxString m_fragment; - - wxString m_userinfo; - wxString m_server; - wxString m_port; - - wxURIHostType m_hostType; - - size_t m_fields; - - DECLARE_DYNAMIC_CLASS(wxURI) -}; - -#endif // _WX_URI_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: uri.h +// Purpose: wxURI - Class for parsing URIs +// Author: Ryan Norton +// Modified By: +// Created: 07/01/2004 +// RCS-ID: $Id: uri.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) Ryan Norton +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_URI_H_ +#define _WX_URI_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" + +// Host Type that the server component can be +enum wxURIHostType +{ + wxURI_REGNAME, // Host is a normal register name (www.mysite.com etc.) + wxURI_IPV4ADDRESS, // Host is a version 4 ip address (192.168.1.100) + wxURI_IPV6ADDRESS, // Host is a version 6 ip address [aa:aa:aa:aa::aa:aa]:5050 + wxURI_IPVFUTURE // Host is a future ip address (wxURI is unsure what kind) +}; + +// Component Flags +enum wxURIFieldType +{ + wxURI_SCHEME = 1, + wxURI_USERINFO = 2, + wxURI_SERVER = 4, + wxURI_PORT = 8, + wxURI_PATH = 16, + wxURI_QUERY = 32, + wxURI_FRAGMENT = 64 +}; + +// Miscellaneous other flags +enum wxURIFlags +{ + wxURI_STRICT = 1 +}; + + +// Generic class for parsing URIs. +// +// See RFC 3986 +class WXDLLIMPEXP_BASE wxURI : public wxObject +{ +public: + wxURI(); + wxURI(const wxString& uri); + wxURI(const wxURI& uri); + + virtual ~wxURI(); + + const wxChar* Create(const wxString& uri); + + bool HasScheme() const { return (m_fields & wxURI_SCHEME) == wxURI_SCHEME; } + bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) == wxURI_USERINFO; } + bool HasServer() const { return (m_fields & wxURI_SERVER) == wxURI_SERVER; } + bool HasPort() const { return (m_fields & wxURI_PORT) == wxURI_PORT; } + bool HasPath() const { return (m_fields & wxURI_PATH) == wxURI_PATH; } + bool HasQuery() const { return (m_fields & wxURI_QUERY) == wxURI_QUERY; } + bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) == wxURI_FRAGMENT; } + + const wxString& GetScheme() const { return m_scheme; } + const wxString& GetPath() const { return m_path; } + const wxString& GetQuery() const { return m_query; } + const wxString& GetFragment() const { return m_fragment; } + const wxString& GetPort() const { return m_port; } + const wxString& GetUserInfo() const { return m_userinfo; } + const wxString& GetServer() const { return m_server; } + const wxURIHostType& GetHostType() const { return m_hostType; } + + //Note that the following two get functions are explicitly depreciated by RFC 2396 + wxString GetUser() const; + wxString GetPassword() const; + + wxString BuildURI() const; + wxString BuildUnescapedURI() const; + + void Resolve(const wxURI& base, int flags = wxURI_STRICT); + bool IsReference() const; + + wxURI& operator = (const wxURI& uri); + wxURI& operator = (const wxString& string); + bool operator == (const wxURI& uri) const; + + static wxString Unescape (const wxString& szEscapedURI); + +protected: + wxURI& Assign(const wxURI& uri); + + void Clear(); + + const wxChar* Parse (const wxChar* uri); + const wxChar* ParseAuthority (const wxChar* uri); + const wxChar* ParseScheme (const wxChar* uri); + const wxChar* ParseUserInfo (const wxChar* uri); + const wxChar* ParseServer (const wxChar* uri); + const wxChar* ParsePort (const wxChar* uri); + const wxChar* ParsePath (const wxChar* uri, + bool bReference = false, + bool bNormalize = true); + const wxChar* ParseQuery (const wxChar* uri); + const wxChar* ParseFragment (const wxChar* uri); + + + static bool ParseH16(const wxChar*& uri); + static bool ParseIPv4address(const wxChar*& uri); + static bool ParseIPv6address(const wxChar*& uri); + static bool ParseIPvFuture(const wxChar*& uri); + + static void Normalize(wxChar* uri, bool bIgnoreLeads = false); + static void UpTree(const wxChar* uristart, const wxChar*& uri); + + static wxChar TranslateEscape(const wxChar* s); + static void Escape (wxString& s, const wxChar& c); + static bool IsEscape(const wxChar*& uri); + + static wxChar CharToHex(const wxChar& c); + + static bool IsUnreserved (const wxChar& c); + static bool IsReserved (const wxChar& c); + static bool IsGenDelim (const wxChar& c); + static bool IsSubDelim (const wxChar& c); + static bool IsHex(const wxChar& c); + static bool IsAlpha(const wxChar& c); + static bool IsDigit(const wxChar& c); + + wxString m_scheme; + wxString m_path; + wxString m_query; + wxString m_fragment; + + wxString m_userinfo; + wxString m_server; + wxString m_port; + + wxURIHostType m_hostType; + + size_t m_fields; + + DECLARE_DYNAMIC_CLASS(wxURI) +}; + +#endif // _WX_URI_H_ + diff --git a/Externals/wxWidgets/include/wx/url.h b/Externals/wxWidgets/include/wx/url.h index 66062974c8..6ef54f742b 100644 --- a/Externals/wxWidgets/include/wx/url.h +++ b/Externals/wxWidgets/include/wx/url.h @@ -1,129 +1,129 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: url.h -// Purpose: URL parser -// Author: Guilhem Lavaux -// Modified by: Ryan Norton -// Created: 20/07/1997 -// RCS-ID: $Id: url.h 41263 2006-09-17 10:59:18Z RR $ -// Copyright: (c) 1997, 1998 Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_URL_H -#define _WX_URL_H - -#include "wx/defs.h" - -#if wxUSE_URL - -#include "wx/uri.h" -#include "wx/protocol/protocol.h" - -#if wxUSE_PROTOCOL_HTTP - #include "wx/protocol/http.h" -#endif - -typedef enum { - wxURL_NOERR = 0, - wxURL_SNTXERR, - wxURL_NOPROTO, - wxURL_NOHOST, - wxURL_NOPATH, - wxURL_CONNERR, - wxURL_PROTOERR -} wxURLError; - -#if wxUSE_URL_NATIVE -class WXDLLIMPEXP_NET wxURL; - -class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject -{ -public: - virtual ~wxURLNativeImp() { } - virtual wxInputStream *GetInputStream(wxURL *owner) = 0; -}; -#endif // wxUSE_URL_NATIVE - -class WXDLLIMPEXP_NET wxURL : public wxURI -{ -public: - wxURL(const wxString& sUrl = wxEmptyString); - wxURL(const wxURI& url); - virtual ~wxURL(); - - wxURL& operator = (const wxString& url); - wxURL& operator = (const wxURI& url); - - wxProtocol& GetProtocol() { return *m_protocol; } - wxURLError GetError() const { return m_error; } - wxString GetURL() const { return m_url; } - - wxURLError SetURL(const wxString &url) - { *this = url; return m_error; } - - bool IsOk() const - { return m_error == wxURL_NOERR; } - - wxInputStream *GetInputStream(); - -#if wxUSE_PROTOCOL_HTTP - static void SetDefaultProxy(const wxString& url_proxy); - void SetProxy(const wxString& url_proxy); -#endif // wxUSE_PROTOCOL_HTTP - -#if WXWIN_COMPATIBILITY_2_4 - //Use the proper wxURI accessors instead - wxDEPRECATED( wxString GetProtocolName() const ); - wxDEPRECATED( wxString GetHostName() const ); - wxDEPRECATED( wxString GetPath() const ); - - //Use wxURI instead - this does not work that well - wxDEPRECATED( static wxString ConvertToValidURI( - const wxString& uri, - const wxChar* delims = wxT(";/?:@&=+$,") - ) ); - - //Use wxURI::Unescape instead - wxDEPRECATED( static wxString ConvertFromURI(const wxString& uri) ); -#endif - -protected: - static wxProtoInfo *ms_protocols; - -#if wxUSE_PROTOCOL_HTTP - static wxHTTP *ms_proxyDefault; - static bool ms_useDefaultProxy; - wxHTTP *m_proxy; -#endif // wxUSE_PROTOCOL_HTTP - -#if wxUSE_URL_NATIVE - friend class wxURLNativeImp; - // pointer to a native URL implementation object - wxURLNativeImp *m_nativeImp; - // Creates on the heap and returns a native - // implementation object for the current platform. - static wxURLNativeImp *CreateNativeImpObject(); -#endif - wxProtoInfo *m_protoinfo; - wxProtocol *m_protocol; - - wxURLError m_error; - wxString m_url; - bool m_useProxy; - - void Init(const wxString&); - bool ParseURL(); - void CleanData(); - bool FetchProtocol(); - - friend class wxProtoInfo; - friend class wxURLModule; - -private: - DECLARE_DYNAMIC_CLASS(wxURL) -}; - -#endif // wxUSE_URL - -#endif // _WX_URL_H - +///////////////////////////////////////////////////////////////////////////// +// Name: url.h +// Purpose: URL parser +// Author: Guilhem Lavaux +// Modified by: Ryan Norton +// Created: 20/07/1997 +// RCS-ID: $Id: url.h 41263 2006-09-17 10:59:18Z RR $ +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_URL_H +#define _WX_URL_H + +#include "wx/defs.h" + +#if wxUSE_URL + +#include "wx/uri.h" +#include "wx/protocol/protocol.h" + +#if wxUSE_PROTOCOL_HTTP + #include "wx/protocol/http.h" +#endif + +typedef enum { + wxURL_NOERR = 0, + wxURL_SNTXERR, + wxURL_NOPROTO, + wxURL_NOHOST, + wxURL_NOPATH, + wxURL_CONNERR, + wxURL_PROTOERR +} wxURLError; + +#if wxUSE_URL_NATIVE +class WXDLLIMPEXP_NET wxURL; + +class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject +{ +public: + virtual ~wxURLNativeImp() { } + virtual wxInputStream *GetInputStream(wxURL *owner) = 0; +}; +#endif // wxUSE_URL_NATIVE + +class WXDLLIMPEXP_NET wxURL : public wxURI +{ +public: + wxURL(const wxString& sUrl = wxEmptyString); + wxURL(const wxURI& url); + virtual ~wxURL(); + + wxURL& operator = (const wxString& url); + wxURL& operator = (const wxURI& url); + + wxProtocol& GetProtocol() { return *m_protocol; } + wxURLError GetError() const { return m_error; } + wxString GetURL() const { return m_url; } + + wxURLError SetURL(const wxString &url) + { *this = url; return m_error; } + + bool IsOk() const + { return m_error == wxURL_NOERR; } + + wxInputStream *GetInputStream(); + +#if wxUSE_PROTOCOL_HTTP + static void SetDefaultProxy(const wxString& url_proxy); + void SetProxy(const wxString& url_proxy); +#endif // wxUSE_PROTOCOL_HTTP + +#if WXWIN_COMPATIBILITY_2_4 + //Use the proper wxURI accessors instead + wxDEPRECATED( wxString GetProtocolName() const ); + wxDEPRECATED( wxString GetHostName() const ); + wxDEPRECATED( wxString GetPath() const ); + + //Use wxURI instead - this does not work that well + wxDEPRECATED( static wxString ConvertToValidURI( + const wxString& uri, + const wxChar* delims = wxT(";/?:@&=+$,") + ) ); + + //Use wxURI::Unescape instead + wxDEPRECATED( static wxString ConvertFromURI(const wxString& uri) ); +#endif + +protected: + static wxProtoInfo *ms_protocols; + +#if wxUSE_PROTOCOL_HTTP + static wxHTTP *ms_proxyDefault; + static bool ms_useDefaultProxy; + wxHTTP *m_proxy; +#endif // wxUSE_PROTOCOL_HTTP + +#if wxUSE_URL_NATIVE + friend class wxURLNativeImp; + // pointer to a native URL implementation object + wxURLNativeImp *m_nativeImp; + // Creates on the heap and returns a native + // implementation object for the current platform. + static wxURLNativeImp *CreateNativeImpObject(); +#endif + wxProtoInfo *m_protoinfo; + wxProtocol *m_protocol; + + wxURLError m_error; + wxString m_url; + bool m_useProxy; + + void Init(const wxString&); + bool ParseURL(); + void CleanData(); + bool FetchProtocol(); + + friend class wxProtoInfo; + friend class wxURLModule; + +private: + DECLARE_DYNAMIC_CLASS(wxURL) +}; + +#endif // wxUSE_URL + +#endif // _WX_URL_H + diff --git a/Externals/wxWidgets/include/wx/utils.h b/Externals/wxWidgets/include/wx/utils.h index cf94bc0e6c..1a8d4672ef 100644 --- a/Externals/wxWidgets/include/wx/utils.h +++ b/Externals/wxWidgets/include/wx/utils.h @@ -1,741 +1,741 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/utils.h -// Purpose: Miscellaneous utilities -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: utils.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_UTILSH__ -#define _WX_UTILSH__ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/object.h" -#include "wx/list.h" -#include "wx/filefn.h" -#if wxUSE_GUI - #include "wx/gdicmn.h" -#endif - -class WXDLLIMPEXP_FWD_BASE wxArrayString; -class WXDLLIMPEXP_FWD_BASE wxArrayInt; - -// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare -// wxLongLong -#include "wx/longlong.h" - -// need for wxOperatingSystemId -#include "wx/platinfo.h" - -#ifdef __WATCOMC__ - #include <direct.h> -#elif defined(__X__) - #include <dirent.h> - #include <unistd.h> -#endif - -#include <stdio.h> - -// ---------------------------------------------------------------------------- -// Forward declaration -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_BASE wxProcess; -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowList; - -// ---------------------------------------------------------------------------- -// Macros -// ---------------------------------------------------------------------------- - -#define wxMax(a,b) (((a) > (b)) ? (a) : (b)) -#define wxMin(a,b) (((a) < (b)) ? (a) : (b)) -#define wxClip(a,b,c) (((a) < (b)) ? (b) : (((a) > (c)) ? (c) : (a))) - -// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well -// so to always use long long for its result type on all platforms which -// support it -#if wxUSE_LONGLONG - typedef wxLongLong wxMemorySize; -#else - typedef long wxMemorySize; -#endif - -// ---------------------------------------------------------------------------- -// String functions (deprecated, use wxString) -// ---------------------------------------------------------------------------- - -// Make a copy of this string using 'new' -#if WXWIN_COMPATIBILITY_2_4 -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s) ); -#endif - -// A shorter way of using strcmp -#define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0)) - -// ---------------------------------------------------------------------------- -// Miscellaneous functions -// ---------------------------------------------------------------------------- - -// Sound the bell -#if !defined __EMX__ && \ - (defined __WXMOTIF__ || defined __WXGTK__ || defined __WXX11__) -WXDLLIMPEXP_CORE void wxBell(); -#else -WXDLLIMPEXP_BASE void wxBell(); -#endif - -// Get OS description as a user-readable string -WXDLLIMPEXP_BASE wxString wxGetOsDescription(); - -// Get OS version -WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL, - int *minorVsn = (int *) NULL); - -// Get platform endianness -WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); - -// Get platform architecture -WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); - -// Return a string with the current date/time -WXDLLIMPEXP_BASE wxString wxNow(); - -// Return path where wxWidgets is installed (mostly useful in Unices) -WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix(); -// Return path to wxWin data (/usr/share/wx/%{version}) (Unices) -WXDLLIMPEXP_BASE wxString wxGetDataDir(); - -/* - * Class to make it easier to specify platform-dependent values - * - * Examples: - * long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3); - * wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other")); - * - * A custom platform symbol: - * - * #define stPDA 100 - * #ifdef __WXWINCE__ - * wxPlatform::AddPlatform(stPDA); - * #endif - * - * long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER); - * - */ - -class WXDLLIMPEXP_BASE wxPlatform -{ -public: - wxPlatform() { Init(); } - wxPlatform(const wxPlatform& platform) { Copy(platform); } - void operator = (const wxPlatform& platform) { Copy(platform); } - void Copy(const wxPlatform& platform); - - // Specify an optional default value - wxPlatform(int defValue) { Init(); m_longValue = (long)defValue; } - wxPlatform(long defValue) { Init(); m_longValue = defValue; } - wxPlatform(const wxString& defValue) { Init(); m_stringValue = defValue; } - wxPlatform(double defValue) { Init(); m_doubleValue = defValue; } - - static wxPlatform If(int platform, long value); - static wxPlatform IfNot(int platform, long value); - wxPlatform& ElseIf(int platform, long value); - wxPlatform& ElseIfNot(int platform, long value); - wxPlatform& Else(long value); - - static wxPlatform If(int platform, int value) { return If(platform, (long)value); } - static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); } - wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); } - wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); } - wxPlatform& Else(int value) { return Else((long) value); } - - static wxPlatform If(int platform, double value); - static wxPlatform IfNot(int platform, double value); - wxPlatform& ElseIf(int platform, double value); - wxPlatform& ElseIfNot(int platform, double value); - wxPlatform& Else(double value); - - static wxPlatform If(int platform, const wxString& value); - static wxPlatform IfNot(int platform, const wxString& value); - wxPlatform& ElseIf(int platform, const wxString& value); - wxPlatform& ElseIfNot(int platform, const wxString& value); - wxPlatform& Else(const wxString& value); - - long GetInteger() const { return m_longValue; } - const wxString& GetString() const { return m_stringValue; } - double GetDouble() const { return m_doubleValue; } - - operator int() const { return (int) GetInteger(); } - operator long() const { return GetInteger(); } - operator double() const { return GetDouble(); } - operator const wxString() const { return GetString(); } - operator const wxChar*() const { return (const wxChar*) GetString(); } - - static void AddPlatform(int platform); - static bool Is(int platform); - static void ClearPlatforms(); - -private: - - void Init() { m_longValue = 0; m_doubleValue = 0.0; } - - long m_longValue; - double m_doubleValue; - wxString m_stringValue; - static wxArrayInt* sm_customPlatforms; -}; - -/// Function for testing current platform -inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } - -#if wxUSE_GUI - -// Get the state of a key (true if pressed, false if not) -// This is generally most useful getting the state of -// the modifier or toggle keys. -WXDLLEXPORT bool wxGetKeyState(wxKeyCode key); - - -// Don't synthesize KeyUp events holding down a key and producing -// KeyDown events with autorepeat. On by default and always on -// in wxMSW. -WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag ); - - -// wxMouseState is used to hold information about button and modifier state -// and is what is returned from wxGetMouseState. -class WXDLLEXPORT wxMouseState -{ -public: - wxMouseState() - : m_x(0), m_y(0), - m_leftDown(false), m_middleDown(false), m_rightDown(false), - m_controlDown(false), m_shiftDown(false), m_altDown(false), - m_metaDown(false) - {} - - wxCoord GetX() { return m_x; } - wxCoord GetY() { return m_y; } - - bool LeftDown() { return m_leftDown; } - bool MiddleDown() { return m_middleDown; } - bool RightDown() { return m_rightDown; } - - bool ControlDown() { return m_controlDown; } - bool ShiftDown() { return m_shiftDown; } - bool AltDown() { return m_altDown; } - bool MetaDown() { return m_metaDown; } - bool CmdDown() - { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else - return ControlDown(); -#endif - } - - void SetX(wxCoord x) { m_x = x; } - void SetY(wxCoord y) { m_y = y; } - - void SetLeftDown(bool down) { m_leftDown = down; } - void SetMiddleDown(bool down) { m_middleDown = down; } - void SetRightDown(bool down) { m_rightDown = down; } - - void SetControlDown(bool down) { m_controlDown = down; } - void SetShiftDown(bool down) { m_shiftDown = down; } - void SetAltDown(bool down) { m_altDown = down; } - void SetMetaDown(bool down) { m_metaDown = down; } - -private: - wxCoord m_x; - wxCoord m_y; - - bool m_leftDown : 1; - bool m_middleDown : 1; - bool m_rightDown : 1; - - bool m_controlDown : 1; - bool m_shiftDown : 1; - bool m_altDown : 1; - bool m_metaDown : 1; -}; - - -// Returns the current state of the mouse position, buttons and modifers -WXDLLEXPORT wxMouseState wxGetMouseState(); - - -// ---------------------------------------------------------------------------- -// Window ID management -// ---------------------------------------------------------------------------- - -// Generate a unique ID -WXDLLEXPORT long wxNewId(); - -// Ensure subsequent IDs don't clash with this one -WXDLLEXPORT void wxRegisterId(long id); - -// Return the current ID -WXDLLEXPORT long wxGetCurrentId(); - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// Various conversions -// ---------------------------------------------------------------------------- - -// these functions are deprecated, use wxString methods instead! -#if WXWIN_COMPATIBILITY_2_4 - -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFloatToStringStr; -extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDoubleToStringStr; - -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToFloat(const wxChar *s, float *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* FloatToString(float number, const wxChar *fmt = wxFloatToStringStr) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToDouble(const wxChar *s, double *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* DoubleToString(double number, const wxChar *fmt = wxDoubleToStringStr) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToInt(const wxChar *s, int *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE void StringToLong(const wxChar *s, long *number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* IntToString(int number) ); -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* LongToString(long number) ); - -#endif // WXWIN_COMPATIBILITY_2_4 - -// Convert 2-digit hex number to decimal -WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf); - -// Convert decimal integer to 2-character hex string -WXDLLIMPEXP_BASE void wxDecToHex(int dec, wxChar *buf); -WXDLLIMPEXP_BASE wxString wxDecToHex(int dec); - -// ---------------------------------------------------------------------------- -// Process management -// ---------------------------------------------------------------------------- - -// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must* -// be 0 and 1, don't change! - -enum -{ - // execute the process asynchronously - wxEXEC_ASYNC = 0, - - // execute it synchronously, i.e. wait until it finishes - wxEXEC_SYNC = 1, - - // under Windows, don't hide the child even if it's IO is redirected (this - // is done by default) - wxEXEC_NOHIDE = 2, - - // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill - // kills all children as well as pid - wxEXEC_MAKE_GROUP_LEADER = 4, - - // by default synchronous execution disables all program windows to avoid - // that the user interacts with the program while the child process is - // running, you can use this flag to prevent this from happening - wxEXEC_NODISABLE = 8 -}; - -// Execute another program. -// -// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the -// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on -// failure and the PID of the launched process if ok. -WXDLLIMPEXP_BASE long wxExecute(wxChar **argv, int flags = wxEXEC_ASYNC, - wxProcess *process = (wxProcess *) NULL); -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, - wxProcess *process = (wxProcess *) NULL); - -// execute the command capturing its output into an array line by line, this is -// always synchronous -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, - wxArrayString& output, - int flags = 0); - -// also capture stderr (also synchronous) -WXDLLIMPEXP_BASE long wxExecute(const wxString& command, - wxArrayString& output, - wxArrayString& error, - int flags = 0); - -#if defined(__WXMSW__) && wxUSE_IPC -// ask a DDE server to execute the DDE request with given parameters -WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer, - const wxString& ddeTopic, - const wxString& ddeCommand); -#endif // __WXMSW__ && wxUSE_IPC - -enum wxSignal -{ - wxSIGNONE = 0, // verify if the process exists under Unix - wxSIGHUP, - wxSIGINT, - wxSIGQUIT, - wxSIGILL, - wxSIGTRAP, - wxSIGABRT, - wxSIGIOT = wxSIGABRT, // another name - wxSIGEMT, - wxSIGFPE, - wxSIGKILL, - wxSIGBUS, - wxSIGSEGV, - wxSIGSYS, - wxSIGPIPE, - wxSIGALRM, - wxSIGTERM - - // further signals are different in meaning between different Unix systems -}; - -enum wxKillError -{ - wxKILL_OK, // no error - wxKILL_BAD_SIGNAL, // no such signal - wxKILL_ACCESS_DENIED, // permission denied - wxKILL_NO_PROCESS, // no such process - wxKILL_ERROR // another, unspecified error -}; - -enum wxKillFlags -{ - wxKILL_NOCHILDREN = 0, // don't kill children - wxKILL_CHILDREN = 1 // kill children -}; - -enum wxShutdownFlags -{ - wxSHUTDOWN_POWEROFF, // power off the computer - wxSHUTDOWN_REBOOT // shutdown and reboot -}; - -// Shutdown or reboot the PC -WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags); - -// send the given signal to the process (only NONE and KILL are supported under -// Windows, all others mean TERM), return 0 if ok and -1 on error -// -// return detailed error in rc if not NULL -WXDLLIMPEXP_BASE int wxKill(long pid, - wxSignal sig = wxSIGTERM, - wxKillError *rc = NULL, - int flags = wxKILL_NOCHILDREN); - -// Execute a command in an interactive shell window (always synchronously) -// If no command then just the shell -WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString); - -// As wxShell(), but must give a (non interactive) command and its output will -// be returned in output array -WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output); - -// Sleep for nSecs seconds -WXDLLIMPEXP_BASE void wxSleep(int nSecs); - -// Sleep for a given amount of milliseconds -WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds); - -// Sleep for a given amount of microseconds -WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds); - -// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep -wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) ); - -// Get the process id of the current process -WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); - -// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) -WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory(); - -#if wxUSE_ON_FATAL_EXCEPTION - -// should wxApp::OnFatalException() be called? -WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); - -#endif // wxUSE_ON_FATAL_EXCEPTION - -// flags for wxLaunchDefaultBrowser -enum -{ - wxBROWSER_NEW_WINDOW = 1 -}; - -// Launch url in the user's default internet browser -WXDLLIMPEXP_BASE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); - -// ---------------------------------------------------------------------------- -// Environment variables -// ---------------------------------------------------------------------------- - -// returns true if variable exists (value may be NULL if you just want to check -// for this) -WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value); - -// set the env var name to the given value, return true on success -WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxChar *value); - -// remove the env var from environment -inline bool wxUnsetEnv(const wxString& var) { return wxSetEnv(var, NULL); } - -// ---------------------------------------------------------------------------- -// Network and username functions. -// ---------------------------------------------------------------------------- - -// NB: "char *" functions are deprecated, use wxString ones! - -// Get eMail address -WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetEmailAddress(); - -// Get hostname. -WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetHostName(); - -// Get FQDN -WXDLLIMPEXP_BASE wxString wxGetFullHostName(); -WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize); - -// Get user ID e.g. jacs (this is known as login name under Unix) -WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetUserId(); - -// Get user name e.g. Julian Smart -WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize); -WXDLLIMPEXP_BASE wxString wxGetUserName(); - -// Get current Home dir and copy to dest (returns pstr->c_str()) -WXDLLIMPEXP_BASE wxString wxGetHomeDir(); -WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr); - -// Get the user's home dir (caller must copy --- volatile) -// returns NULL is no HOME dir is known -#if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WINE__) -WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString); -#else -WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString); -#endif - -#if wxUSE_LONGLONG - typedef wxLongLong wxDiskspaceSize_t; -#else - typedef long wxDiskspaceSize_t; -#endif - -// get number of total/free bytes on the disk where path belongs -WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, - wxDiskspaceSize_t *pTotal = NULL, - wxDiskspaceSize_t *pFree = NULL); - -#if wxUSE_GUI // GUI only things from now on - -// ---------------------------------------------------------------------------- -// Menu accelerators related things -// ---------------------------------------------------------------------------- - -// flags for wxStripMenuCodes -enum -{ - // strip '&' characters - wxStrip_Mnemonics = 1, - - // strip everything after '\t' - wxStrip_Accel = 2, - - // strip everything (this is the default) - wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel -}; - -// strip mnemonics and/or accelerators from the label -WXDLLEXPORT wxString -wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); - -#if WXWIN_COMPATIBILITY_2_6 -// obsolete and deprecated version, do not use, use the above overload instead -wxDEPRECATED( - WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) -); - -#if wxUSE_ACCEL -class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; - -// use wxAcceleratorEntry::Create() or FromString() methods instead -wxDEPRECATED( - WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) -); -#endif // wxUSE_ACCEL - -#endif // WXWIN_COMPATIBILITY_2_6 - -// ---------------------------------------------------------------------------- -// Window search -// ---------------------------------------------------------------------------- - -// Returns menu item id or wxNOT_FOUND if none. -WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); - -// Find the wxWindow at the given point. wxGenericFindWindowAtPoint -// is always present but may be less reliable than a native version. -WXDLLEXPORT wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); -WXDLLEXPORT wxWindow* wxFindWindowAtPoint(const wxPoint& pt); - -// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead -// -// Find the window/widget with the given title or label. -// Pass a parent to begin the search from, or NULL to look through -// all windows. -WXDLLEXPORT wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL); - -// NB: this function is obsolete, use wxWindow::FindWindowByName() instead -// -// Find window by name, and if that fails, by label. -WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL); - -// ---------------------------------------------------------------------------- -// Message/event queue helpers -// ---------------------------------------------------------------------------- - -// Yield to other apps/messages and disable user input -WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); - -// Enable or disable input to all top level windows -WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = true); - -// Check whether this window wants to process messages, e.g. Stop button -// in long calculations. -WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd); - -// Consume all events until no more left -WXDLLEXPORT void wxFlushEvents(); - -// a class which disables all windows (except, may be, thegiven one) in its -// ctor and enables them back in its dtor -class WXDLLEXPORT wxWindowDisabler -{ -public: - wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL); - ~wxWindowDisabler(); - -private: - wxWindowList *m_winDisabled; - - DECLARE_NO_COPY_CLASS(wxWindowDisabler) -}; - -// ---------------------------------------------------------------------------- -// Cursors -// ---------------------------------------------------------------------------- - -// Set the cursor to the busy cursor for all windows -WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR); - -// Restore cursor to normal -WXDLLEXPORT void wxEndBusyCursor(); - -// true if we're between the above two calls -WXDLLEXPORT bool wxIsBusy(); - -// Convenience class so we can just create a wxBusyCursor object on the stack -class WXDLLEXPORT wxBusyCursor -{ -public: - wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR) - { wxBeginBusyCursor(cursor); } - ~wxBusyCursor() - { wxEndBusyCursor(); } - - // FIXME: These two methods are currently only implemented (and needed?) - // in wxGTK. BusyCursor handling should probably be moved to - // common code since the wxGTK and wxMSW implementations are very - // similar except for wxMSW using HCURSOR directly instead of - // wxCursor.. -- RL. - static const wxCursor &GetStoredCursor(); - static const wxCursor GetBusyCursor(); -}; - - -// ---------------------------------------------------------------------------- -// Reading and writing resources (eg WIN.INI, .Xdefaults) -// ---------------------------------------------------------------------------- - -#if wxUSE_RESOURCES -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = wxEmptyString); - -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = wxEmptyString); -WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString); -#endif // wxUSE_RESOURCES - -void WXDLLEXPORT wxGetMousePosition( int* x, int* y ); - -// MSW only: get user-defined resource from the .res file. -// Returns NULL or newly-allocated memory, so use delete[] to clean up. -#ifdef __WXMSW__ - extern WXDLLEXPORT const wxChar* wxUserResourceStr; - WXDLLEXPORT wxChar* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr); -#endif // MSW - -// ---------------------------------------------------------------------------- -// Display and colorss (X only) -// ---------------------------------------------------------------------------- - -#ifdef __WXGTK__ - void *wxGetDisplay(); -#endif - -#ifdef __X__ - WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay(); - WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name); - WXDLLIMPEXP_CORE wxString wxGetDisplayName(); -#endif // X or GTK+ - -#ifdef __X__ - -#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++ - // The resulting warnings are switched off here -#pragma message disable nosimpint -#endif -// #include <X11/Xlib.h> -#ifdef __VMS__ -#pragma message enable nosimpint -#endif - -#endif //__X__ - -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// wxYield(): these functions are obsolete, please use wxApp methods instead! -// ---------------------------------------------------------------------------- - -// avoid redeclaring this function here if it had been already declated by -// wx/app.h, this results in warnings from g++ with -Wredundant-decls -#ifndef wx_YIELD_DECLARED -#define wx_YIELD_DECLARED - -// Yield to other apps/messages -WXDLLIMPEXP_BASE bool wxYield(); - -#endif // wx_YIELD_DECLARED - -// Like wxYield, but fails silently if the yield is recursive. -WXDLLIMPEXP_BASE bool wxYieldIfNeeded(); - -// ---------------------------------------------------------------------------- -// Error message functions used by wxWidgets (deprecated, use wxLog) -// ---------------------------------------------------------------------------- - -#endif - // _WX_UTILSH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/utils.h +// Purpose: Miscellaneous utilities +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: utils.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UTILSH__ +#define _WX_UTILSH__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/object.h" +#include "wx/list.h" +#include "wx/filefn.h" +#if wxUSE_GUI + #include "wx/gdicmn.h" +#endif + +class WXDLLIMPEXP_FWD_BASE wxArrayString; +class WXDLLIMPEXP_FWD_BASE wxArrayInt; + +// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare +// wxLongLong +#include "wx/longlong.h" + +// need for wxOperatingSystemId +#include "wx/platinfo.h" + +#ifdef __WATCOMC__ + #include <direct.h> +#elif defined(__X__) + #include <dirent.h> + #include <unistd.h> +#endif + +#include <stdio.h> + +// ---------------------------------------------------------------------------- +// Forward declaration +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxProcess; +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowList; + +// ---------------------------------------------------------------------------- +// Macros +// ---------------------------------------------------------------------------- + +#define wxMax(a,b) (((a) > (b)) ? (a) : (b)) +#define wxMin(a,b) (((a) < (b)) ? (a) : (b)) +#define wxClip(a,b,c) (((a) < (b)) ? (b) : (((a) > (c)) ? (c) : (a))) + +// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well +// so to always use long long for its result type on all platforms which +// support it +#if wxUSE_LONGLONG + typedef wxLongLong wxMemorySize; +#else + typedef long wxMemorySize; +#endif + +// ---------------------------------------------------------------------------- +// String functions (deprecated, use wxString) +// ---------------------------------------------------------------------------- + +// Make a copy of this string using 'new' +#if WXWIN_COMPATIBILITY_2_4 +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s) ); +#endif + +// A shorter way of using strcmp +#define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0)) + +// ---------------------------------------------------------------------------- +// Miscellaneous functions +// ---------------------------------------------------------------------------- + +// Sound the bell +#if !defined __EMX__ && \ + (defined __WXMOTIF__ || defined __WXGTK__ || defined __WXX11__) +WXDLLIMPEXP_CORE void wxBell(); +#else +WXDLLIMPEXP_BASE void wxBell(); +#endif + +// Get OS description as a user-readable string +WXDLLIMPEXP_BASE wxString wxGetOsDescription(); + +// Get OS version +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL, + int *minorVsn = (int *) NULL); + +// Get platform endianness +WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); + +// Get platform architecture +WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); + +// Return a string with the current date/time +WXDLLIMPEXP_BASE wxString wxNow(); + +// Return path where wxWidgets is installed (mostly useful in Unices) +WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix(); +// Return path to wxWin data (/usr/share/wx/%{version}) (Unices) +WXDLLIMPEXP_BASE wxString wxGetDataDir(); + +/* + * Class to make it easier to specify platform-dependent values + * + * Examples: + * long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3); + * wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other")); + * + * A custom platform symbol: + * + * #define stPDA 100 + * #ifdef __WXWINCE__ + * wxPlatform::AddPlatform(stPDA); + * #endif + * + * long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER); + * + */ + +class WXDLLIMPEXP_BASE wxPlatform +{ +public: + wxPlatform() { Init(); } + wxPlatform(const wxPlatform& platform) { Copy(platform); } + void operator = (const wxPlatform& platform) { Copy(platform); } + void Copy(const wxPlatform& platform); + + // Specify an optional default value + wxPlatform(int defValue) { Init(); m_longValue = (long)defValue; } + wxPlatform(long defValue) { Init(); m_longValue = defValue; } + wxPlatform(const wxString& defValue) { Init(); m_stringValue = defValue; } + wxPlatform(double defValue) { Init(); m_doubleValue = defValue; } + + static wxPlatform If(int platform, long value); + static wxPlatform IfNot(int platform, long value); + wxPlatform& ElseIf(int platform, long value); + wxPlatform& ElseIfNot(int platform, long value); + wxPlatform& Else(long value); + + static wxPlatform If(int platform, int value) { return If(platform, (long)value); } + static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); } + wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); } + wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); } + wxPlatform& Else(int value) { return Else((long) value); } + + static wxPlatform If(int platform, double value); + static wxPlatform IfNot(int platform, double value); + wxPlatform& ElseIf(int platform, double value); + wxPlatform& ElseIfNot(int platform, double value); + wxPlatform& Else(double value); + + static wxPlatform If(int platform, const wxString& value); + static wxPlatform IfNot(int platform, const wxString& value); + wxPlatform& ElseIf(int platform, const wxString& value); + wxPlatform& ElseIfNot(int platform, const wxString& value); + wxPlatform& Else(const wxString& value); + + long GetInteger() const { return m_longValue; } + const wxString& GetString() const { return m_stringValue; } + double GetDouble() const { return m_doubleValue; } + + operator int() const { return (int) GetInteger(); } + operator long() const { return GetInteger(); } + operator double() const { return GetDouble(); } + operator const wxString() const { return GetString(); } + operator const wxChar*() const { return (const wxChar*) GetString(); } + + static void AddPlatform(int platform); + static bool Is(int platform); + static void ClearPlatforms(); + +private: + + void Init() { m_longValue = 0; m_doubleValue = 0.0; } + + long m_longValue; + double m_doubleValue; + wxString m_stringValue; + static wxArrayInt* sm_customPlatforms; +}; + +/// Function for testing current platform +inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } + +#if wxUSE_GUI + +// Get the state of a key (true if pressed, false if not) +// This is generally most useful getting the state of +// the modifier or toggle keys. +WXDLLEXPORT bool wxGetKeyState(wxKeyCode key); + + +// Don't synthesize KeyUp events holding down a key and producing +// KeyDown events with autorepeat. On by default and always on +// in wxMSW. +WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag ); + + +// wxMouseState is used to hold information about button and modifier state +// and is what is returned from wxGetMouseState. +class WXDLLEXPORT wxMouseState +{ +public: + wxMouseState() + : m_x(0), m_y(0), + m_leftDown(false), m_middleDown(false), m_rightDown(false), + m_controlDown(false), m_shiftDown(false), m_altDown(false), + m_metaDown(false) + {} + + wxCoord GetX() { return m_x; } + wxCoord GetY() { return m_y; } + + bool LeftDown() { return m_leftDown; } + bool MiddleDown() { return m_middleDown; } + bool RightDown() { return m_rightDown; } + + bool ControlDown() { return m_controlDown; } + bool ShiftDown() { return m_shiftDown; } + bool AltDown() { return m_altDown; } + bool MetaDown() { return m_metaDown; } + bool CmdDown() + { +#if defined(__WXMAC__) || defined(__WXCOCOA__) + return MetaDown(); +#else + return ControlDown(); +#endif + } + + void SetX(wxCoord x) { m_x = x; } + void SetY(wxCoord y) { m_y = y; } + + void SetLeftDown(bool down) { m_leftDown = down; } + void SetMiddleDown(bool down) { m_middleDown = down; } + void SetRightDown(bool down) { m_rightDown = down; } + + void SetControlDown(bool down) { m_controlDown = down; } + void SetShiftDown(bool down) { m_shiftDown = down; } + void SetAltDown(bool down) { m_altDown = down; } + void SetMetaDown(bool down) { m_metaDown = down; } + +private: + wxCoord m_x; + wxCoord m_y; + + bool m_leftDown : 1; + bool m_middleDown : 1; + bool m_rightDown : 1; + + bool m_controlDown : 1; + bool m_shiftDown : 1; + bool m_altDown : 1; + bool m_metaDown : 1; +}; + + +// Returns the current state of the mouse position, buttons and modifers +WXDLLEXPORT wxMouseState wxGetMouseState(); + + +// ---------------------------------------------------------------------------- +// Window ID management +// ---------------------------------------------------------------------------- + +// Generate a unique ID +WXDLLEXPORT long wxNewId(); + +// Ensure subsequent IDs don't clash with this one +WXDLLEXPORT void wxRegisterId(long id); + +// Return the current ID +WXDLLEXPORT long wxGetCurrentId(); + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// Various conversions +// ---------------------------------------------------------------------------- + +// these functions are deprecated, use wxString methods instead! +#if WXWIN_COMPATIBILITY_2_4 + +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFloatToStringStr; +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDoubleToStringStr; + +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToFloat(const wxChar *s, float *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* FloatToString(float number, const wxChar *fmt = wxFloatToStringStr) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToDouble(const wxChar *s, double *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* DoubleToString(double number, const wxChar *fmt = wxDoubleToStringStr) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToInt(const wxChar *s, int *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void StringToLong(const wxChar *s, long *number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* IntToString(int number) ); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* LongToString(long number) ); + +#endif // WXWIN_COMPATIBILITY_2_4 + +// Convert 2-digit hex number to decimal +WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf); + +// Convert decimal integer to 2-character hex string +WXDLLIMPEXP_BASE void wxDecToHex(int dec, wxChar *buf); +WXDLLIMPEXP_BASE wxString wxDecToHex(int dec); + +// ---------------------------------------------------------------------------- +// Process management +// ---------------------------------------------------------------------------- + +// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must* +// be 0 and 1, don't change! + +enum +{ + // execute the process asynchronously + wxEXEC_ASYNC = 0, + + // execute it synchronously, i.e. wait until it finishes + wxEXEC_SYNC = 1, + + // under Windows, don't hide the child even if it's IO is redirected (this + // is done by default) + wxEXEC_NOHIDE = 2, + + // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill + // kills all children as well as pid + wxEXEC_MAKE_GROUP_LEADER = 4, + + // by default synchronous execution disables all program windows to avoid + // that the user interacts with the program while the child process is + // running, you can use this flag to prevent this from happening + wxEXEC_NODISABLE = 8 +}; + +// Execute another program. +// +// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the +// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on +// failure and the PID of the launched process if ok. +WXDLLIMPEXP_BASE long wxExecute(wxChar **argv, int flags = wxEXEC_ASYNC, + wxProcess *process = (wxProcess *) NULL); +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, + wxProcess *process = (wxProcess *) NULL); + +// execute the command capturing its output into an array line by line, this is +// always synchronous +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, + wxArrayString& output, + int flags = 0); + +// also capture stderr (also synchronous) +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, + wxArrayString& output, + wxArrayString& error, + int flags = 0); + +#if defined(__WXMSW__) && wxUSE_IPC +// ask a DDE server to execute the DDE request with given parameters +WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer, + const wxString& ddeTopic, + const wxString& ddeCommand); +#endif // __WXMSW__ && wxUSE_IPC + +enum wxSignal +{ + wxSIGNONE = 0, // verify if the process exists under Unix + wxSIGHUP, + wxSIGINT, + wxSIGQUIT, + wxSIGILL, + wxSIGTRAP, + wxSIGABRT, + wxSIGIOT = wxSIGABRT, // another name + wxSIGEMT, + wxSIGFPE, + wxSIGKILL, + wxSIGBUS, + wxSIGSEGV, + wxSIGSYS, + wxSIGPIPE, + wxSIGALRM, + wxSIGTERM + + // further signals are different in meaning between different Unix systems +}; + +enum wxKillError +{ + wxKILL_OK, // no error + wxKILL_BAD_SIGNAL, // no such signal + wxKILL_ACCESS_DENIED, // permission denied + wxKILL_NO_PROCESS, // no such process + wxKILL_ERROR // another, unspecified error +}; + +enum wxKillFlags +{ + wxKILL_NOCHILDREN = 0, // don't kill children + wxKILL_CHILDREN = 1 // kill children +}; + +enum wxShutdownFlags +{ + wxSHUTDOWN_POWEROFF, // power off the computer + wxSHUTDOWN_REBOOT // shutdown and reboot +}; + +// Shutdown or reboot the PC +WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags); + +// send the given signal to the process (only NONE and KILL are supported under +// Windows, all others mean TERM), return 0 if ok and -1 on error +// +// return detailed error in rc if not NULL +WXDLLIMPEXP_BASE int wxKill(long pid, + wxSignal sig = wxSIGTERM, + wxKillError *rc = NULL, + int flags = wxKILL_NOCHILDREN); + +// Execute a command in an interactive shell window (always synchronously) +// If no command then just the shell +WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString); + +// As wxShell(), but must give a (non interactive) command and its output will +// be returned in output array +WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output); + +// Sleep for nSecs seconds +WXDLLIMPEXP_BASE void wxSleep(int nSecs); + +// Sleep for a given amount of milliseconds +WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds); + +// Sleep for a given amount of microseconds +WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds); + +// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep +wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) ); + +// Get the process id of the current process +WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); + +// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) +WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory(); + +#if wxUSE_ON_FATAL_EXCEPTION + +// should wxApp::OnFatalException() be called? +WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); + +#endif // wxUSE_ON_FATAL_EXCEPTION + +// flags for wxLaunchDefaultBrowser +enum +{ + wxBROWSER_NEW_WINDOW = 1 +}; + +// Launch url in the user's default internet browser +WXDLLIMPEXP_BASE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); + +// ---------------------------------------------------------------------------- +// Environment variables +// ---------------------------------------------------------------------------- + +// returns true if variable exists (value may be NULL if you just want to check +// for this) +WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value); + +// set the env var name to the given value, return true on success +WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxChar *value); + +// remove the env var from environment +inline bool wxUnsetEnv(const wxString& var) { return wxSetEnv(var, NULL); } + +// ---------------------------------------------------------------------------- +// Network and username functions. +// ---------------------------------------------------------------------------- + +// NB: "char *" functions are deprecated, use wxString ones! + +// Get eMail address +WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetEmailAddress(); + +// Get hostname. +WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetHostName(); + +// Get FQDN +WXDLLIMPEXP_BASE wxString wxGetFullHostName(); +WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize); + +// Get user ID e.g. jacs (this is known as login name under Unix) +WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetUserId(); + +// Get user name e.g. Julian Smart +WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetUserName(); + +// Get current Home dir and copy to dest (returns pstr->c_str()) +WXDLLIMPEXP_BASE wxString wxGetHomeDir(); +WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr); + +// Get the user's home dir (caller must copy --- volatile) +// returns NULL is no HOME dir is known +#if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WINE__) +WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString); +#else +WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString); +#endif + +#if wxUSE_LONGLONG + typedef wxLongLong wxDiskspaceSize_t; +#else + typedef long wxDiskspaceSize_t; +#endif + +// get number of total/free bytes on the disk where path belongs +WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, + wxDiskspaceSize_t *pTotal = NULL, + wxDiskspaceSize_t *pFree = NULL); + +#if wxUSE_GUI // GUI only things from now on + +// ---------------------------------------------------------------------------- +// Menu accelerators related things +// ---------------------------------------------------------------------------- + +// flags for wxStripMenuCodes +enum +{ + // strip '&' characters + wxStrip_Mnemonics = 1, + + // strip everything after '\t' + wxStrip_Accel = 2, + + // strip everything (this is the default) + wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel +}; + +// strip mnemonics and/or accelerators from the label +WXDLLEXPORT wxString +wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); + +#if WXWIN_COMPATIBILITY_2_6 +// obsolete and deprecated version, do not use, use the above overload instead +wxDEPRECATED( + WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) +); + +#if wxUSE_ACCEL +class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; + +// use wxAcceleratorEntry::Create() or FromString() methods instead +wxDEPRECATED( + WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) +); +#endif // wxUSE_ACCEL + +#endif // WXWIN_COMPATIBILITY_2_6 + +// ---------------------------------------------------------------------------- +// Window search +// ---------------------------------------------------------------------------- + +// Returns menu item id or wxNOT_FOUND if none. +WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); + +// Find the wxWindow at the given point. wxGenericFindWindowAtPoint +// is always present but may be less reliable than a native version. +WXDLLEXPORT wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); +WXDLLEXPORT wxWindow* wxFindWindowAtPoint(const wxPoint& pt); + +// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead +// +// Find the window/widget with the given title or label. +// Pass a parent to begin the search from, or NULL to look through +// all windows. +WXDLLEXPORT wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL); + +// NB: this function is obsolete, use wxWindow::FindWindowByName() instead +// +// Find window by name, and if that fails, by label. +WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL); + +// ---------------------------------------------------------------------------- +// Message/event queue helpers +// ---------------------------------------------------------------------------- + +// Yield to other apps/messages and disable user input +WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); + +// Enable or disable input to all top level windows +WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = true); + +// Check whether this window wants to process messages, e.g. Stop button +// in long calculations. +WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd); + +// Consume all events until no more left +WXDLLEXPORT void wxFlushEvents(); + +// a class which disables all windows (except, may be, thegiven one) in its +// ctor and enables them back in its dtor +class WXDLLEXPORT wxWindowDisabler +{ +public: + wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL); + ~wxWindowDisabler(); + +private: + wxWindowList *m_winDisabled; + + DECLARE_NO_COPY_CLASS(wxWindowDisabler) +}; + +// ---------------------------------------------------------------------------- +// Cursors +// ---------------------------------------------------------------------------- + +// Set the cursor to the busy cursor for all windows +WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR); + +// Restore cursor to normal +WXDLLEXPORT void wxEndBusyCursor(); + +// true if we're between the above two calls +WXDLLEXPORT bool wxIsBusy(); + +// Convenience class so we can just create a wxBusyCursor object on the stack +class WXDLLEXPORT wxBusyCursor +{ +public: + wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR) + { wxBeginBusyCursor(cursor); } + ~wxBusyCursor() + { wxEndBusyCursor(); } + + // FIXME: These two methods are currently only implemented (and needed?) + // in wxGTK. BusyCursor handling should probably be moved to + // common code since the wxGTK and wxMSW implementations are very + // similar except for wxMSW using HCURSOR directly instead of + // wxCursor.. -- RL. + static const wxCursor &GetStoredCursor(); + static const wxCursor GetBusyCursor(); +}; + + +// ---------------------------------------------------------------------------- +// Reading and writing resources (eg WIN.INI, .Xdefaults) +// ---------------------------------------------------------------------------- + +#if wxUSE_RESOURCES +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = wxEmptyString); + +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = wxEmptyString); +WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString); +#endif // wxUSE_RESOURCES + +void WXDLLEXPORT wxGetMousePosition( int* x, int* y ); + +// MSW only: get user-defined resource from the .res file. +// Returns NULL or newly-allocated memory, so use delete[] to clean up. +#ifdef __WXMSW__ + extern WXDLLEXPORT const wxChar* wxUserResourceStr; + WXDLLEXPORT wxChar* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr); +#endif // MSW + +// ---------------------------------------------------------------------------- +// Display and colorss (X only) +// ---------------------------------------------------------------------------- + +#ifdef __WXGTK__ + void *wxGetDisplay(); +#endif + +#ifdef __X__ + WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay(); + WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name); + WXDLLIMPEXP_CORE wxString wxGetDisplayName(); +#endif // X or GTK+ + +#ifdef __X__ + +#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++ + // The resulting warnings are switched off here +#pragma message disable nosimpint +#endif +// #include <X11/Xlib.h> +#ifdef __VMS__ +#pragma message enable nosimpint +#endif + +#endif //__X__ + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxYield(): these functions are obsolete, please use wxApp methods instead! +// ---------------------------------------------------------------------------- + +// avoid redeclaring this function here if it had been already declated by +// wx/app.h, this results in warnings from g++ with -Wredundant-decls +#ifndef wx_YIELD_DECLARED +#define wx_YIELD_DECLARED + +// Yield to other apps/messages +WXDLLIMPEXP_BASE bool wxYield(); + +#endif // wx_YIELD_DECLARED + +// Like wxYield, but fails silently if the yield is recursive. +WXDLLIMPEXP_BASE bool wxYieldIfNeeded(); + +// ---------------------------------------------------------------------------- +// Error message functions used by wxWidgets (deprecated, use wxLog) +// ---------------------------------------------------------------------------- + +#endif + // _WX_UTILSH__ diff --git a/Externals/wxWidgets/include/wx/valgen.h b/Externals/wxWidgets/include/wx/valgen.h index fd39c7e7d1..35dd44ff5f 100644 --- a/Externals/wxWidgets/include/wx/valgen.h +++ b/Externals/wxWidgets/include/wx/valgen.h @@ -1,69 +1,69 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: valgen.h -// Purpose: wxGenericValidator class -// Author: Kevin Smith -// Modified by: -// Created: Jan 22 1999 -// RCS-ID: -// Copyright: (c) 1999 Julian Smart (assigned from Kevin) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALGENH__ -#define _WX_VALGENH__ - -#include "wx/validate.h" - -#if wxUSE_VALIDATORS - -class WXDLLEXPORT wxGenericValidator: public wxValidator -{ -DECLARE_CLASS(wxGenericValidator) -public: - wxGenericValidator(bool* val); - wxGenericValidator(int* val); - wxGenericValidator(wxString* val); - wxGenericValidator(wxArrayInt* val); - wxGenericValidator(const wxGenericValidator& copyFrom); - - virtual ~wxGenericValidator(){} - - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxGenericValidator(*this); } - bool Copy(const wxGenericValidator& val); - - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } - - // Called to transfer data to the window - virtual bool TransferToWindow(); - - // Called to transfer data to the window - virtual bool TransferFromWindow(); - -protected: - void Initialize(); - - bool* m_pBool; - int* m_pInt; - wxString* m_pString; - wxArrayInt* m_pArrayInt; - -private: -// Cannot use -// DECLARE_NO_COPY_CLASS(wxGenericValidator) -// because copy constructor is explicitly declared above; -// but no copy assignment operator is defined, so declare -// it private to prevent the compiler from defining it: - wxGenericValidator& operator=(const wxGenericValidator&); -}; - -#endif - // wxUSE_VALIDATORS - -#endif - // _WX_VALGENH__ +///////////////////////////////////////////////////////////////////////////// +// Name: valgen.h +// Purpose: wxGenericValidator class +// Author: Kevin Smith +// Modified by: +// Created: Jan 22 1999 +// RCS-ID: +// Copyright: (c) 1999 Julian Smart (assigned from Kevin) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALGENH__ +#define _WX_VALGENH__ + +#include "wx/validate.h" + +#if wxUSE_VALIDATORS + +class WXDLLEXPORT wxGenericValidator: public wxValidator +{ +DECLARE_CLASS(wxGenericValidator) +public: + wxGenericValidator(bool* val); + wxGenericValidator(int* val); + wxGenericValidator(wxString* val); + wxGenericValidator(wxArrayInt* val); + wxGenericValidator(const wxGenericValidator& copyFrom); + + virtual ~wxGenericValidator(){} + + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const { return new wxGenericValidator(*this); } + bool Copy(const wxGenericValidator& val); + + // Called when the value in the window must be validated. + // This function can pop up an error message. + virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } + + // Called to transfer data to the window + virtual bool TransferToWindow(); + + // Called to transfer data to the window + virtual bool TransferFromWindow(); + +protected: + void Initialize(); + + bool* m_pBool; + int* m_pInt; + wxString* m_pString; + wxArrayInt* m_pArrayInt; + +private: +// Cannot use +// DECLARE_NO_COPY_CLASS(wxGenericValidator) +// because copy constructor is explicitly declared above; +// but no copy assignment operator is defined, so declare +// it private to prevent the compiler from defining it: + wxGenericValidator& operator=(const wxGenericValidator&); +}; + +#endif + // wxUSE_VALIDATORS + +#endif + // _WX_VALGENH__ diff --git a/Externals/wxWidgets/include/wx/validate.h b/Externals/wxWidgets/include/wx/validate.h index ea8c808979..b25649fb3a 100644 --- a/Externals/wxWidgets/include/wx/validate.h +++ b/Externals/wxWidgets/include/wx/validate.h @@ -1,98 +1,98 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/validate.h -// Purpose: wxValidator class -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: validate.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALIDATE_H_ -#define _WX_VALIDATE_H_ - -#include "wx/defs.h" - -#if wxUSE_VALIDATORS - -#include "wx/event.h" - -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; - -/* - A validator has up to three purposes: - - 1) To validate the data in the window that's associated - with the validator. - 2) To transfer data to and from the window. - 3) To filter input, using its role as a wxEvtHandler - to intercept e.g. OnChar. - - Note that wxValidator and derived classes use reference counting. -*/ - -class WXDLLEXPORT wxValidator : public wxEvtHandler -{ -public: - wxValidator(); - virtual ~wxValidator(); - - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const - { return (wxValidator *)NULL; } - bool Copy(const wxValidator& val) - { m_validatorWindow = val.m_validatorWindow; return true; } - - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow *WXUNUSED(parent)) { return false; } - - // Called to transfer data to the window - virtual bool TransferToWindow() { return false; } - - // Called to transfer data from the window - virtual bool TransferFromWindow() { return false; } - - // accessors - wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; } - void SetWindow(wxWindowBase *win) { m_validatorWindow = win; } - - // validators beep by default if invalid key is pressed, these functions - // allow to change it - static bool IsSilent() { return ms_isSilent; } - static void SetBellOnError(bool doIt = true) { ms_isSilent = doIt; } - -protected: - wxWindowBase *m_validatorWindow; - -private: - static bool ms_isSilent; - - DECLARE_DYNAMIC_CLASS(wxValidator) - DECLARE_NO_COPY_CLASS(wxValidator) -}; - -extern WXDLLEXPORT_DATA(const wxValidator) wxDefaultValidator; - -#define wxVALIDATOR_PARAM(val) val - -#else // !wxUSE_VALIDATORS - // wxWidgets is compiled without support for wxValidator, but we still - // want to be able to pass wxDefaultValidator to the functions which take - // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" - // everywhere - class WXDLLEXPORT wxValidator; - #define wxDefaultValidator (*((wxValidator *)NULL)) - - // this macro allows to avoid warnings about unused parameters when - // wxUSE_VALIDATORS == 0 - #define wxVALIDATOR_PARAM(val) -#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS - -#endif // _WX_VALIDATE_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/validate.h +// Purpose: wxValidator class +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: validate.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALIDATE_H_ +#define _WX_VALIDATE_H_ + +#include "wx/defs.h" + +#if wxUSE_VALIDATORS + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +/* + A validator has up to three purposes: + + 1) To validate the data in the window that's associated + with the validator. + 2) To transfer data to and from the window. + 3) To filter input, using its role as a wxEvtHandler + to intercept e.g. OnChar. + + Note that wxValidator and derived classes use reference counting. +*/ + +class WXDLLEXPORT wxValidator : public wxEvtHandler +{ +public: + wxValidator(); + virtual ~wxValidator(); + + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const + { return (wxValidator *)NULL; } + bool Copy(const wxValidator& val) + { m_validatorWindow = val.m_validatorWindow; return true; } + + // Called when the value in the window must be validated. + // This function can pop up an error message. + virtual bool Validate(wxWindow *WXUNUSED(parent)) { return false; } + + // Called to transfer data to the window + virtual bool TransferToWindow() { return false; } + + // Called to transfer data from the window + virtual bool TransferFromWindow() { return false; } + + // accessors + wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; } + void SetWindow(wxWindowBase *win) { m_validatorWindow = win; } + + // validators beep by default if invalid key is pressed, these functions + // allow to change it + static bool IsSilent() { return ms_isSilent; } + static void SetBellOnError(bool doIt = true) { ms_isSilent = doIt; } + +protected: + wxWindowBase *m_validatorWindow; + +private: + static bool ms_isSilent; + + DECLARE_DYNAMIC_CLASS(wxValidator) + DECLARE_NO_COPY_CLASS(wxValidator) +}; + +extern WXDLLEXPORT_DATA(const wxValidator) wxDefaultValidator; + +#define wxVALIDATOR_PARAM(val) val + +#else // !wxUSE_VALIDATORS + // wxWidgets is compiled without support for wxValidator, but we still + // want to be able to pass wxDefaultValidator to the functions which take + // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" + // everywhere + class WXDLLEXPORT wxValidator; + #define wxDefaultValidator (*((wxValidator *)NULL)) + + // this macro allows to avoid warnings about unused parameters when + // wxUSE_VALIDATORS == 0 + #define wxVALIDATOR_PARAM(val) +#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS + +#endif // _WX_VALIDATE_H_ + diff --git a/Externals/wxWidgets/include/wx/valtext.h b/Externals/wxWidgets/include/wx/valtext.h index 1d48898eda..cccec0f609 100644 --- a/Externals/wxWidgets/include/wx/valtext.h +++ b/Externals/wxWidgets/include/wx/valtext.h @@ -1,122 +1,122 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: valtext.h -// Purpose: wxTextValidator class -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// RCS-ID: $Id: valtext.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VALTEXTH__ -#define _WX_VALTEXTH__ - -#include "wx/defs.h" - -#if wxUSE_VALIDATORS && wxUSE_TEXTCTRL - -#include "wx/textctrl.h" -#include "wx/validate.h" - -#define wxFILTER_NONE 0x0000 -#define wxFILTER_ASCII 0x0001 -#define wxFILTER_ALPHA 0x0002 -#define wxFILTER_ALPHANUMERIC 0x0004 -#define wxFILTER_NUMERIC 0x0008 -#define wxFILTER_INCLUDE_LIST 0x0010 -#define wxFILTER_EXCLUDE_LIST 0x0020 -#define wxFILTER_INCLUDE_CHAR_LIST 0x0040 -#define wxFILTER_EXCLUDE_CHAR_LIST 0x0080 - -class WXDLLEXPORT wxTextValidator: public wxValidator -{ -DECLARE_DYNAMIC_CLASS(wxTextValidator) -public: - - wxTextValidator(long style = wxFILTER_NONE, wxString *val = 0); - wxTextValidator(const wxTextValidator& val); - - virtual ~wxTextValidator(){} - - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxTextValidator(*this); } - bool Copy(const wxTextValidator& val); - - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow *parent); - - // Called to transfer data to the window - virtual bool TransferToWindow(); - - // Called to transfer data from the window - virtual bool TransferFromWindow(); - - // ACCESSORS - inline long GetStyle() const { return m_validatorStyle; } - inline void SetStyle(long style) { m_validatorStyle = style; } - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( void SetIncludeList(const wxStringList& list) ); - wxDEPRECATED( wxStringList& GetIncludeList() ); - - wxDEPRECATED( void SetExcludeList(const wxStringList& list) ); - wxDEPRECATED( wxStringList& GetExcludeList() ); - - wxDEPRECATED( bool IsInCharIncludeList(const wxString& val) ); - wxDEPRECATED( bool IsNotInCharExcludeList(const wxString& val) ); -#endif - - void SetIncludes(const wxArrayString& includes) { m_includes = includes; } - inline wxArrayString& GetIncludes() { return m_includes; } - - void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; } - inline wxArrayString& GetExcludes() { return m_excludes; } - - bool IsInCharIncludes(const wxString& val); - bool IsNotInCharExcludes(const wxString& val); - - // Filter keystrokes - void OnChar(wxKeyEvent& event); - - -DECLARE_EVENT_TABLE() - -protected: - long m_validatorStyle; - wxString * m_stringValue; -#if WXWIN_COMPATIBILITY_2_4 - wxStringList m_includeList; - wxStringList m_excludeList; -#endif - wxArrayString m_includes; - wxArrayString m_excludes; - - bool CheckValidator() const - { - wxCHECK_MSG( m_validatorWindow, false, - _T("No window associated with validator") ); - wxCHECK_MSG( m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)), false, - _T("wxTextValidator is only for wxTextCtrl's") ); - - return true; - } - -private: -// Cannot use -// DECLARE_NO_COPY_CLASS(wxTextValidator) -// because copy constructor is explicitly declared above; -// but no copy assignment operator is defined, so declare -// it private to prevent the compiler from defining it: - wxTextValidator& operator=(const wxTextValidator&); -}; - -#endif - // wxUSE_VALIDATORS && wxUSE_TEXTCTRL - -#endif - // _WX_VALTEXTH__ +///////////////////////////////////////////////////////////////////////////// +// Name: valtext.h +// Purpose: wxTextValidator class +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// RCS-ID: $Id: valtext.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALTEXTH__ +#define _WX_VALTEXTH__ + +#include "wx/defs.h" + +#if wxUSE_VALIDATORS && wxUSE_TEXTCTRL + +#include "wx/textctrl.h" +#include "wx/validate.h" + +#define wxFILTER_NONE 0x0000 +#define wxFILTER_ASCII 0x0001 +#define wxFILTER_ALPHA 0x0002 +#define wxFILTER_ALPHANUMERIC 0x0004 +#define wxFILTER_NUMERIC 0x0008 +#define wxFILTER_INCLUDE_LIST 0x0010 +#define wxFILTER_EXCLUDE_LIST 0x0020 +#define wxFILTER_INCLUDE_CHAR_LIST 0x0040 +#define wxFILTER_EXCLUDE_CHAR_LIST 0x0080 + +class WXDLLEXPORT wxTextValidator: public wxValidator +{ +DECLARE_DYNAMIC_CLASS(wxTextValidator) +public: + + wxTextValidator(long style = wxFILTER_NONE, wxString *val = 0); + wxTextValidator(const wxTextValidator& val); + + virtual ~wxTextValidator(){} + + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const { return new wxTextValidator(*this); } + bool Copy(const wxTextValidator& val); + + // Called when the value in the window must be validated. + // This function can pop up an error message. + virtual bool Validate(wxWindow *parent); + + // Called to transfer data to the window + virtual bool TransferToWindow(); + + // Called to transfer data from the window + virtual bool TransferFromWindow(); + + // ACCESSORS + inline long GetStyle() const { return m_validatorStyle; } + inline void SetStyle(long style) { m_validatorStyle = style; } + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void SetIncludeList(const wxStringList& list) ); + wxDEPRECATED( wxStringList& GetIncludeList() ); + + wxDEPRECATED( void SetExcludeList(const wxStringList& list) ); + wxDEPRECATED( wxStringList& GetExcludeList() ); + + wxDEPRECATED( bool IsInCharIncludeList(const wxString& val) ); + wxDEPRECATED( bool IsNotInCharExcludeList(const wxString& val) ); +#endif + + void SetIncludes(const wxArrayString& includes) { m_includes = includes; } + inline wxArrayString& GetIncludes() { return m_includes; } + + void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; } + inline wxArrayString& GetExcludes() { return m_excludes; } + + bool IsInCharIncludes(const wxString& val); + bool IsNotInCharExcludes(const wxString& val); + + // Filter keystrokes + void OnChar(wxKeyEvent& event); + + +DECLARE_EVENT_TABLE() + +protected: + long m_validatorStyle; + wxString * m_stringValue; +#if WXWIN_COMPATIBILITY_2_4 + wxStringList m_includeList; + wxStringList m_excludeList; +#endif + wxArrayString m_includes; + wxArrayString m_excludes; + + bool CheckValidator() const + { + wxCHECK_MSG( m_validatorWindow, false, + _T("No window associated with validator") ); + wxCHECK_MSG( m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)), false, + _T("wxTextValidator is only for wxTextCtrl's") ); + + return true; + } + +private: +// Cannot use +// DECLARE_NO_COPY_CLASS(wxTextValidator) +// because copy constructor is explicitly declared above; +// but no copy assignment operator is defined, so declare +// it private to prevent the compiler from defining it: + wxTextValidator& operator=(const wxTextValidator&); +}; + +#endif + // wxUSE_VALIDATORS && wxUSE_TEXTCTRL + +#endif + // _WX_VALTEXTH__ diff --git a/Externals/wxWidgets/include/wx/variant.h b/Externals/wxWidgets/include/wx/variant.h index bccf32e88d..2429150916 100644 --- a/Externals/wxWidgets/include/wx/variant.h +++ b/Externals/wxWidgets/include/wx/variant.h @@ -1,423 +1,423 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/variant.h -// Purpose: wxVariant class, container for any type -// Author: Julian Smart -// Modified by: -// Created: 10/09/98 -// RCS-ID: $Id: variant.h 42997 2006-11-03 21:37:08Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VARIANT_H_ -#define _WX_VARIANT_H_ - -#include "wx/defs.h" - -#if wxUSE_VARIANT - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/arrstr.h" -#include "wx/list.h" -#include "wx/cpp.h" - -#if wxUSE_DATETIME - #include "wx/datetime.h" -#endif // wxUSE_DATETIME - -#if wxUSE_ODBC - #include "wx/db.h" // will #include sqltypes.h -#endif //ODBC - -#include "wx/iosfwrap.h" - -/* - * wxVariantData stores the actual data in a wxVariant object, - * to allow it to store any type of data. - * Derive from this to provide custom data handling. - * - * NB: To prevent addition of extra vtbl pointer to wxVariantData, - * we don't multiple-inherit from wxObjectRefData. Instead, - * we simply replicate the wxObject ref-counting scheme. - * - * NB: When you construct a wxVariantData, it will have refcount - * of one. Refcount will not be further increased when - * it is passed to wxVariant. This simulates old common - * scenario where wxVariant took ownership of wxVariantData - * passed to it. - * If you create wxVariantData for other reasons than passing - * it to wxVariant, technically you are not required to call - * DecRef() before deleting it. - * - * TODO: in order to replace wxPropertyValue, we would need - * to consider adding constructors that take pointers to C++ variables, - * or removing that functionality from the wxProperty library. - * Essentially wxPropertyValue takes on some of the wxValidator functionality - * by storing pointers and not just actual values, allowing update of C++ data - * to be handled automatically. Perhaps there's another way of doing this without - * overloading wxVariant with unnecessary functionality. - */ - -class WXDLLIMPEXP_BASE wxVariantData: public wxObject -{ - friend class wxVariant; -public: - wxVariantData() - : wxObject(), m_count(1) - { } - - // Override these to provide common functionality - virtual bool Eq(wxVariantData& data) const = 0; - -#if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; } -#endif - virtual bool Write(wxString& WXUNUSED(str)) const { return false; } -#if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } -#endif - virtual bool Read(wxString& WXUNUSED(str)) { return false; } - // What type is it? Return a string name. - virtual wxString GetType() const = 0; - // If it based on wxObject return the ClassInfo. - virtual wxClassInfo* GetValueClassInfo() { return NULL; } - - void IncRef() { m_count++; } - void DecRef() - { - if ( --m_count == 0 ) - delete this; - } - - int GetRefCount() const { return m_count; } - -protected: - // Protected dtor should make some incompatible code - // break more louder. That is, they should do data->DecRef() - // instead of delete data. - virtual ~wxVariantData() { } - -private: - int m_count; - -private: - DECLARE_ABSTRACT_CLASS(wxVariantData) -}; - -/* - * wxVariant can store any kind of data, but has some basic types - * built in. - */ - -class WXDLLIMPEXP_BASE wxVariant: public wxObject -{ -public: - wxVariant(); - - wxVariant(const wxVariant& variant); - wxVariant(wxVariantData* data, const wxString& name = wxEmptyString); - virtual ~wxVariant(); - - // generic assignment - void operator= (const wxVariant& variant); - - // Assignment using data, e.g. - // myVariant = new wxStringVariantData("hello"); - void operator= (wxVariantData* variantData); - - bool operator== (const wxVariant& variant) const; - bool operator!= (const wxVariant& variant) const; - - // Sets/gets name - inline void SetName(const wxString& name) { m_name = name; } - inline const wxString& GetName() const { return m_name; } - - // Tests whether there is data - bool IsNull() const; - - // For compatibility with wxWidgets <= 2.6, this doesn't increase - // reference count. - wxVariantData* GetData() const { return m_data; } - void SetData(wxVariantData* data) ; - - // make a 'clone' of the object - void Ref(const wxVariant& clone); - - // destroy a reference - void UnRef(); - - // Make NULL (i.e. delete the data) - void MakeNull(); - - // Delete data and name - void Clear(); - - // Returns a string representing the type of the variant, - // e.g. "string", "bool", "stringlist", "list", "double", "long" - wxString GetType() const; - - bool IsType(const wxString& type) const; - bool IsValueKindOf(const wxClassInfo* type) const; - - // write contents to a string (e.g. for debugging) - wxString MakeString() const; - - // double - wxVariant(double val, const wxString& name = wxEmptyString); - bool operator== (double value) const; - bool operator!= (double value) const; - void operator= (double value) ; - inline operator double () const { return GetDouble(); } - inline double GetReal() const { return GetDouble(); } - double GetDouble() const; - - // long - wxVariant(long val, const wxString& name = wxEmptyString); - wxVariant(int val, const wxString& name = wxEmptyString); - wxVariant(short val, const wxString& name = wxEmptyString); - bool operator== (long value) const; - bool operator!= (long value) const; - void operator= (long value) ; - inline operator long () const { return GetLong(); } - inline long GetInteger() const { return GetLong(); } - long GetLong() const; - - // bool -#ifdef HAVE_BOOL - wxVariant(bool val, const wxString& name = wxEmptyString); - bool operator== (bool value) const; - bool operator!= (bool value) const; - void operator= (bool value) ; - inline operator bool () const { return GetBool(); } - bool GetBool() const ; -#endif - - // wxDateTime -#if wxUSE_DATETIME - wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString); -#if wxUSE_ODBC - wxVariant(const DATE_STRUCT* valptr, const wxString& name = wxEmptyString); - wxVariant(const TIME_STRUCT* valptr, const wxString& name = wxEmptyString); - wxVariant(const TIMESTAMP_STRUCT* valptr, const wxString& name = wxEmptyString); -#endif - bool operator== (const wxDateTime& value) const; - bool operator!= (const wxDateTime& value) const; - void operator= (const wxDateTime& value) ; -#if wxUSE_ODBC - void operator= (const DATE_STRUCT* value) ; - void operator= (const TIME_STRUCT* value) ; - void operator= (const TIMESTAMP_STRUCT* value) ; -#endif - inline operator wxDateTime () const { return GetDateTime(); } - wxDateTime GetDateTime() const; -#endif - - // wxString - wxVariant(const wxString& val, const wxString& name = wxEmptyString); - wxVariant(const wxChar* val, const wxString& name = wxEmptyString); // Necessary or VC++ assumes bool! - bool operator== (const wxString& value) const; - bool operator!= (const wxString& value) const; - void operator= (const wxString& value) ; - void operator= (const wxChar* value) ; // Necessary or VC++ assumes bool! - inline operator wxString () const { return MakeString(); } - wxString GetString() const; - - // wxChar - wxVariant(wxChar val, const wxString& name = wxEmptyString); - bool operator== (wxChar value) const; - bool operator!= (wxChar value) const; - void operator= (wxChar value) ; - inline operator wxChar () const { return GetChar(); } - wxChar GetChar() const ; - - // wxArrayString - wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString); - bool operator== (const wxArrayString& value) const; - bool operator!= (const wxArrayString& value) const; - void operator= (const wxArrayString& value); - inline operator wxArrayString () const { return GetArrayString(); } - wxArrayString GetArrayString() const; - - // void* - wxVariant(void* ptr, const wxString& name = wxEmptyString); - bool operator== (void* value) const; - bool operator!= (void* value) const; - void operator= (void* value); - inline operator void* () const { return GetVoidPtr(); } - void* GetVoidPtr() const; - - // wxObject* - wxVariant(wxObject* ptr, const wxString& name = wxEmptyString); - bool operator== (wxObject* value) const; - bool operator!= (wxObject* value) const; - void operator= (wxObject* value); - wxObject* GetWxObjectPtr() const; - - -#if WXWIN_COMPATIBILITY_2_4 - wxDEPRECATED( wxVariant(const wxStringList& val, const wxString& name = wxEmptyString) ); - wxDEPRECATED( bool operator== (const wxStringList& value) const ); - wxDEPRECATED( bool operator!= (const wxStringList& value) const ); - wxDEPRECATED( void operator= (const wxStringList& value) ); - wxDEPRECATED( wxStringList& GetStringList() const ); -#endif - - // ------------------------------ - // list operations - // ------------------------------ - - wxVariant(const wxList& val, const wxString& name = wxEmptyString); // List of variants - bool operator== (const wxList& value) const; - bool operator!= (const wxList& value) const; - void operator= (const wxList& value) ; - // Treat a list variant as an array - wxVariant operator[] (size_t idx) const; - wxVariant& operator[] (size_t idx) ; - wxList& GetList() const ; - - // Return the number of elements in a list - size_t GetCount() const; - - // Make empty list - void NullList(); - - // Append to list - void Append(const wxVariant& value); - - // Insert at front of list - void Insert(const wxVariant& value); - - // Returns true if the variant is a member of the list - bool Member(const wxVariant& value) const; - - // Deletes the nth element of the list - bool Delete(size_t item); - - // Clear list - void ClearList(); - -public: - // Type conversion - bool Convert(long* value) const; - bool Convert(bool* value) const; - bool Convert(double* value) const; - bool Convert(wxString* value) const; - bool Convert(wxChar* value) const; -#if wxUSE_DATETIME - bool Convert(wxDateTime* value) const; -#endif // wxUSE_DATETIME - -// Attributes -protected: - wxVariantData* m_data; - wxString m_name; - -private: - DECLARE_DYNAMIC_CLASS(wxVariant) -}; - -#define DECLARE_VARIANT_OBJECT(classname) \ - DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) - -#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ -expdecl classname& operator << ( classname &object, const wxVariant &variant ); \ -expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); - -#define IMPLEMENT_VARIANT_OBJECT(classname) \ - IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) - -#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \ -class classname##VariantData: public wxVariantData \ -{ \ -public:\ - classname##VariantData() {} \ - classname##VariantData( const classname &value ) { m_value = value; } \ -\ - classname &GetValue() { return m_value; } \ -\ - virtual bool Eq(wxVariantData& data) const; \ -\ - virtual wxString GetType() const; \ - virtual wxClassInfo* GetValueClassInfo(); \ -\ -protected:\ - classname m_value; \ -\ -private: \ - DECLARE_CLASS(classname##VariantData) \ -};\ -\ -IMPLEMENT_CLASS(classname##VariantData, wxVariantData)\ -\ -wxString classname##VariantData::GetType() const\ -{\ - return m_value.GetClassInfo()->GetClassName();\ -}\ -\ -wxClassInfo* classname##VariantData::GetValueClassInfo()\ -{\ - return m_value.GetClassInfo();\ -}\ -\ -expdecl classname& operator << ( classname &value, const wxVariant &variant )\ -{\ - wxASSERT( wxIsKindOf( variant.GetData(), classname##VariantData ) );\ - \ - classname##VariantData *data = (classname##VariantData*) variant.GetData();\ - value = data->GetValue();\ - return value;\ -}\ -\ -expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\ -{\ - classname##VariantData *data = new classname##VariantData( value );\ - variant.SetData( data );\ - return variant;\ -} - -// implements a wxVariantData-derived class using for the Eq() method the -// operator== which must have been provided by "classname" -#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ -IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ -\ -bool classname##VariantData::Eq(wxVariantData& data) const \ -{\ - wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ -\ - classname##VariantData & otherData = (classname##VariantData &) data;\ -\ - return otherData.m_value == m_value;\ -}\ - - -// implements a wxVariantData-derived class using for the Eq() method a shallow -// comparison (through wxObject::IsSameAs function) -#define IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(classname) \ - IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname, wxEMPTY_PARAMETER_VALUE) -#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \ -IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ -\ -bool classname##VariantData::Eq(wxVariantData& data) const \ -{\ - wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ -\ - classname##VariantData & otherData = (classname##VariantData &) data;\ -\ - return (otherData.m_value.IsSameAs(m_value));\ -}\ - - -// Since we want type safety wxVariant we need to fetch and dynamic_cast -// in a seemingly safe way so the compiler can check, so we define -// a dynamic_cast /wxDynamicCast analogue. - -#define wxGetVariantCast(var,classname) \ - ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\ - var.GetWxObjectPtr() : NULL)); - -extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; - -#endif // wxUSE_VARIANT - -#endif // _WX_VARIANT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/variant.h +// Purpose: wxVariant class, container for any type +// Author: Julian Smart +// Modified by: +// Created: 10/09/98 +// RCS-ID: $Id: variant.h 42997 2006-11-03 21:37:08Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VARIANT_H_ +#define _WX_VARIANT_H_ + +#include "wx/defs.h" + +#if wxUSE_VARIANT + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/arrstr.h" +#include "wx/list.h" +#include "wx/cpp.h" + +#if wxUSE_DATETIME + #include "wx/datetime.h" +#endif // wxUSE_DATETIME + +#if wxUSE_ODBC + #include "wx/db.h" // will #include sqltypes.h +#endif //ODBC + +#include "wx/iosfwrap.h" + +/* + * wxVariantData stores the actual data in a wxVariant object, + * to allow it to store any type of data. + * Derive from this to provide custom data handling. + * + * NB: To prevent addition of extra vtbl pointer to wxVariantData, + * we don't multiple-inherit from wxObjectRefData. Instead, + * we simply replicate the wxObject ref-counting scheme. + * + * NB: When you construct a wxVariantData, it will have refcount + * of one. Refcount will not be further increased when + * it is passed to wxVariant. This simulates old common + * scenario where wxVariant took ownership of wxVariantData + * passed to it. + * If you create wxVariantData for other reasons than passing + * it to wxVariant, technically you are not required to call + * DecRef() before deleting it. + * + * TODO: in order to replace wxPropertyValue, we would need + * to consider adding constructors that take pointers to C++ variables, + * or removing that functionality from the wxProperty library. + * Essentially wxPropertyValue takes on some of the wxValidator functionality + * by storing pointers and not just actual values, allowing update of C++ data + * to be handled automatically. Perhaps there's another way of doing this without + * overloading wxVariant with unnecessary functionality. + */ + +class WXDLLIMPEXP_BASE wxVariantData: public wxObject +{ + friend class wxVariant; +public: + wxVariantData() + : wxObject(), m_count(1) + { } + + // Override these to provide common functionality + virtual bool Eq(wxVariantData& data) const = 0; + +#if wxUSE_STD_IOSTREAM + virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; } +#endif + virtual bool Write(wxString& WXUNUSED(str)) const { return false; } +#if wxUSE_STD_IOSTREAM + virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } +#endif + virtual bool Read(wxString& WXUNUSED(str)) { return false; } + // What type is it? Return a string name. + virtual wxString GetType() const = 0; + // If it based on wxObject return the ClassInfo. + virtual wxClassInfo* GetValueClassInfo() { return NULL; } + + void IncRef() { m_count++; } + void DecRef() + { + if ( --m_count == 0 ) + delete this; + } + + int GetRefCount() const { return m_count; } + +protected: + // Protected dtor should make some incompatible code + // break more louder. That is, they should do data->DecRef() + // instead of delete data. + virtual ~wxVariantData() { } + +private: + int m_count; + +private: + DECLARE_ABSTRACT_CLASS(wxVariantData) +}; + +/* + * wxVariant can store any kind of data, but has some basic types + * built in. + */ + +class WXDLLIMPEXP_BASE wxVariant: public wxObject +{ +public: + wxVariant(); + + wxVariant(const wxVariant& variant); + wxVariant(wxVariantData* data, const wxString& name = wxEmptyString); + virtual ~wxVariant(); + + // generic assignment + void operator= (const wxVariant& variant); + + // Assignment using data, e.g. + // myVariant = new wxStringVariantData("hello"); + void operator= (wxVariantData* variantData); + + bool operator== (const wxVariant& variant) const; + bool operator!= (const wxVariant& variant) const; + + // Sets/gets name + inline void SetName(const wxString& name) { m_name = name; } + inline const wxString& GetName() const { return m_name; } + + // Tests whether there is data + bool IsNull() const; + + // For compatibility with wxWidgets <= 2.6, this doesn't increase + // reference count. + wxVariantData* GetData() const { return m_data; } + void SetData(wxVariantData* data) ; + + // make a 'clone' of the object + void Ref(const wxVariant& clone); + + // destroy a reference + void UnRef(); + + // Make NULL (i.e. delete the data) + void MakeNull(); + + // Delete data and name + void Clear(); + + // Returns a string representing the type of the variant, + // e.g. "string", "bool", "stringlist", "list", "double", "long" + wxString GetType() const; + + bool IsType(const wxString& type) const; + bool IsValueKindOf(const wxClassInfo* type) const; + + // write contents to a string (e.g. for debugging) + wxString MakeString() const; + + // double + wxVariant(double val, const wxString& name = wxEmptyString); + bool operator== (double value) const; + bool operator!= (double value) const; + void operator= (double value) ; + inline operator double () const { return GetDouble(); } + inline double GetReal() const { return GetDouble(); } + double GetDouble() const; + + // long + wxVariant(long val, const wxString& name = wxEmptyString); + wxVariant(int val, const wxString& name = wxEmptyString); + wxVariant(short val, const wxString& name = wxEmptyString); + bool operator== (long value) const; + bool operator!= (long value) const; + void operator= (long value) ; + inline operator long () const { return GetLong(); } + inline long GetInteger() const { return GetLong(); } + long GetLong() const; + + // bool +#ifdef HAVE_BOOL + wxVariant(bool val, const wxString& name = wxEmptyString); + bool operator== (bool value) const; + bool operator!= (bool value) const; + void operator= (bool value) ; + inline operator bool () const { return GetBool(); } + bool GetBool() const ; +#endif + + // wxDateTime +#if wxUSE_DATETIME + wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString); +#if wxUSE_ODBC + wxVariant(const DATE_STRUCT* valptr, const wxString& name = wxEmptyString); + wxVariant(const TIME_STRUCT* valptr, const wxString& name = wxEmptyString); + wxVariant(const TIMESTAMP_STRUCT* valptr, const wxString& name = wxEmptyString); +#endif + bool operator== (const wxDateTime& value) const; + bool operator!= (const wxDateTime& value) const; + void operator= (const wxDateTime& value) ; +#if wxUSE_ODBC + void operator= (const DATE_STRUCT* value) ; + void operator= (const TIME_STRUCT* value) ; + void operator= (const TIMESTAMP_STRUCT* value) ; +#endif + inline operator wxDateTime () const { return GetDateTime(); } + wxDateTime GetDateTime() const; +#endif + + // wxString + wxVariant(const wxString& val, const wxString& name = wxEmptyString); + wxVariant(const wxChar* val, const wxString& name = wxEmptyString); // Necessary or VC++ assumes bool! + bool operator== (const wxString& value) const; + bool operator!= (const wxString& value) const; + void operator= (const wxString& value) ; + void operator= (const wxChar* value) ; // Necessary or VC++ assumes bool! + inline operator wxString () const { return MakeString(); } + wxString GetString() const; + + // wxChar + wxVariant(wxChar val, const wxString& name = wxEmptyString); + bool operator== (wxChar value) const; + bool operator!= (wxChar value) const; + void operator= (wxChar value) ; + inline operator wxChar () const { return GetChar(); } + wxChar GetChar() const ; + + // wxArrayString + wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString); + bool operator== (const wxArrayString& value) const; + bool operator!= (const wxArrayString& value) const; + void operator= (const wxArrayString& value); + inline operator wxArrayString () const { return GetArrayString(); } + wxArrayString GetArrayString() const; + + // void* + wxVariant(void* ptr, const wxString& name = wxEmptyString); + bool operator== (void* value) const; + bool operator!= (void* value) const; + void operator= (void* value); + inline operator void* () const { return GetVoidPtr(); } + void* GetVoidPtr() const; + + // wxObject* + wxVariant(wxObject* ptr, const wxString& name = wxEmptyString); + bool operator== (wxObject* value) const; + bool operator!= (wxObject* value) const; + void operator= (wxObject* value); + wxObject* GetWxObjectPtr() const; + + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( wxVariant(const wxStringList& val, const wxString& name = wxEmptyString) ); + wxDEPRECATED( bool operator== (const wxStringList& value) const ); + wxDEPRECATED( bool operator!= (const wxStringList& value) const ); + wxDEPRECATED( void operator= (const wxStringList& value) ); + wxDEPRECATED( wxStringList& GetStringList() const ); +#endif + + // ------------------------------ + // list operations + // ------------------------------ + + wxVariant(const wxList& val, const wxString& name = wxEmptyString); // List of variants + bool operator== (const wxList& value) const; + bool operator!= (const wxList& value) const; + void operator= (const wxList& value) ; + // Treat a list variant as an array + wxVariant operator[] (size_t idx) const; + wxVariant& operator[] (size_t idx) ; + wxList& GetList() const ; + + // Return the number of elements in a list + size_t GetCount() const; + + // Make empty list + void NullList(); + + // Append to list + void Append(const wxVariant& value); + + // Insert at front of list + void Insert(const wxVariant& value); + + // Returns true if the variant is a member of the list + bool Member(const wxVariant& value) const; + + // Deletes the nth element of the list + bool Delete(size_t item); + + // Clear list + void ClearList(); + +public: + // Type conversion + bool Convert(long* value) const; + bool Convert(bool* value) const; + bool Convert(double* value) const; + bool Convert(wxString* value) const; + bool Convert(wxChar* value) const; +#if wxUSE_DATETIME + bool Convert(wxDateTime* value) const; +#endif // wxUSE_DATETIME + +// Attributes +protected: + wxVariantData* m_data; + wxString m_name; + +private: + DECLARE_DYNAMIC_CLASS(wxVariant) +}; + +#define DECLARE_VARIANT_OBJECT(classname) \ + DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ +expdecl classname& operator << ( classname &object, const wxVariant &variant ); \ +expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); + +#define IMPLEMENT_VARIANT_OBJECT(classname) \ + IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \ +class classname##VariantData: public wxVariantData \ +{ \ +public:\ + classname##VariantData() {} \ + classname##VariantData( const classname &value ) { m_value = value; } \ +\ + classname &GetValue() { return m_value; } \ +\ + virtual bool Eq(wxVariantData& data) const; \ +\ + virtual wxString GetType() const; \ + virtual wxClassInfo* GetValueClassInfo(); \ +\ +protected:\ + classname m_value; \ +\ +private: \ + DECLARE_CLASS(classname##VariantData) \ +};\ +\ +IMPLEMENT_CLASS(classname##VariantData, wxVariantData)\ +\ +wxString classname##VariantData::GetType() const\ +{\ + return m_value.GetClassInfo()->GetClassName();\ +}\ +\ +wxClassInfo* classname##VariantData::GetValueClassInfo()\ +{\ + return m_value.GetClassInfo();\ +}\ +\ +expdecl classname& operator << ( classname &value, const wxVariant &variant )\ +{\ + wxASSERT( wxIsKindOf( variant.GetData(), classname##VariantData ) );\ + \ + classname##VariantData *data = (classname##VariantData*) variant.GetData();\ + value = data->GetValue();\ + return value;\ +}\ +\ +expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\ +{\ + classname##VariantData *data = new classname##VariantData( value );\ + variant.SetData( data );\ + return variant;\ +} + +// implements a wxVariantData-derived class using for the Eq() method the +// operator== which must have been provided by "classname" +#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ +IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +\ +bool classname##VariantData::Eq(wxVariantData& data) const \ +{\ + wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ +\ + classname##VariantData & otherData = (classname##VariantData &) data;\ +\ + return otherData.m_value == m_value;\ +}\ + + +// implements a wxVariantData-derived class using for the Eq() method a shallow +// comparison (through wxObject::IsSameAs function) +#define IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(classname) \ + IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname, wxEMPTY_PARAMETER_VALUE) +#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \ +IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +\ +bool classname##VariantData::Eq(wxVariantData& data) const \ +{\ + wxASSERT( wxIsKindOf((&data), classname##VariantData) );\ +\ + classname##VariantData & otherData = (classname##VariantData &) data;\ +\ + return (otherData.m_value.IsSameAs(m_value));\ +}\ + + +// Since we want type safety wxVariant we need to fetch and dynamic_cast +// in a seemingly safe way so the compiler can check, so we define +// a dynamic_cast /wxDynamicCast analogue. + +#define wxGetVariantCast(var,classname) \ + ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\ + var.GetWxObjectPtr() : NULL)); + +extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; + +#endif // wxUSE_VARIANT + +#endif // _WX_VARIANT_H_ diff --git a/Externals/wxWidgets/include/wx/vector.h b/Externals/wxWidgets/include/wx/vector.h index b0639e29f2..f8aa5625eb 100644 --- a/Externals/wxWidgets/include/wx/vector.h +++ b/Externals/wxWidgets/include/wx/vector.h @@ -1,212 +1,212 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/vector.h -// Purpose: STL vector clone -// Author: Lindsay Mathieson -// Modified by: -// Created: 30.07.2001 -// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VECTOR_H_ -#define _WX_VECTOR_H_ - -#include "wx/defs.h" - -class WXDLLIMPEXP_BASE wxVectorBase -{ -public: - typedef size_t size_type; -private: - size_type m_allocsize; - size_type m_size, - m_capacity; - void **m_objects; - -protected: - bool Alloc(size_type sz) - { - // work in multiples of m_allocsize; - sz = (sz / m_allocsize + 1) * m_allocsize; - if (sz <= m_capacity) - return true; - - // try to realloc - void *mem = realloc(m_objects, sizeof(void *) * sz); - if (! mem) - return false; // failed - // success - m_objects = (void **) mem; - m_capacity = sz; - return true; - } - - // untyped destructor of elements - must be overriden - virtual void Free(void *) = 0; - // untyped copy constructor of elements - must be overriden - virtual void *Copy(const void *) const = 0; - - const void *GetItem(size_type idx) const - { - wxASSERT(idx < m_size); - return m_objects[idx]; - } - - void Append(void *obj) - { - wxASSERT(m_size < m_capacity); - m_objects[m_size] = obj; - m_size++; - } - - void RemoveAt(size_type idx) - { - wxASSERT(idx < m_size); - Free(m_objects[idx]); - if (idx < m_size - 1) - memcpy( - m_objects + idx, - m_objects + idx + 1, - ( m_size - idx - 1 ) * sizeof(void*) ); - m_size--; - } - - bool copy(const wxVectorBase& vb) - { - clear(); - if (! Alloc(vb.size())) - return false; - - for (size_type i = 0; i < vb.size(); i++) - { - void *o = vb.Copy(vb.GetItem(i)); - if (! o) - return false; - Append(o); - } - - return true; - } - -public: - wxVectorBase() : m_allocsize(16), m_size(0), m_capacity(0), m_objects(0) {} - virtual ~wxVectorBase() {} // calm down GCC - - void clear() - { - for (size_type i = 0; i < size(); i++) - Free(m_objects[i]); - free(m_objects); - m_objects = 0; - m_size = m_capacity = 0; - } - - void reserve(size_type n) - { - if ( !Alloc(n) ) - { - wxFAIL_MSG( _T("out of memory in wxVector::reserve()") ); - } - } - - size_type size() const - { - return m_size; - } - - size_type capacity() const - { - return m_capacity; - } - - bool empty() const - { - return size() == 0; - } - - wxVectorBase& operator = (const wxVectorBase& vb) - { - wxCHECK(copy(vb), *this); - return *this; - } -}; - -#define WX_DECLARE_VECTORBASE(obj, cls)\ -protected:\ - virtual void Free(void *o)\ - {\ - delete (obj *) o;\ - }\ - virtual void *Copy(const void *o) const\ - {\ - return new obj(*(obj *) o);\ - }\ -public:\ - cls() {}\ - cls(const cls& c) : wxVectorBase()\ - {\ - wxCHECK2(copy(c), return);\ - }\ - ~cls()\ - {\ - clear();\ - } - -#define _WX_DECLARE_VECTOR(obj, cls, exp)\ -class exp cls : public wxVectorBase\ -{\ - WX_DECLARE_VECTORBASE(obj, cls)\ -public:\ - void push_back(const obj& o)\ - {\ - wxCHECK2(Alloc(size() + 1), return);\ - Append(new obj(o));\ - }\ - void pop_back()\ - {\ - RemoveAt(size() - 1);\ - }\ - const obj& at(size_type idx) const\ - {\ - return *(obj *) GetItem(idx);\ - }\ - obj& at(size_type idx)\ - {\ - return *(obj *) GetItem(idx);\ - }\ - const obj& operator[](size_type idx) const\ - {\ - return at(idx);\ - }\ - obj& operator[](size_type idx)\ - {\ - return at(idx);\ - }\ - const obj& front() const\ - {\ - return at(0);\ - }\ - obj& front()\ - {\ - return at(0);\ - }\ - const obj& back() const\ - {\ - return at(size() - 1);\ - }\ - obj& back()\ - {\ - return at(size() - 1);\ - }\ - size_type erase(size_type idx)\ - {\ - RemoveAt(idx);\ - return idx;\ - }\ -} - -#define WX_DECLARE_VECTOR(obj, cls) \ - _WX_DECLARE_VECTOR(obj, cls, WXDLLEXPORT) - -#endif // _WX_VECTOR_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/vector.h +// Purpose: STL vector clone +// Author: Lindsay Mathieson +// Modified by: +// Created: 30.07.2001 +// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VECTOR_H_ +#define _WX_VECTOR_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_BASE wxVectorBase +{ +public: + typedef size_t size_type; +private: + size_type m_allocsize; + size_type m_size, + m_capacity; + void **m_objects; + +protected: + bool Alloc(size_type sz) + { + // work in multiples of m_allocsize; + sz = (sz / m_allocsize + 1) * m_allocsize; + if (sz <= m_capacity) + return true; + + // try to realloc + void *mem = realloc(m_objects, sizeof(void *) * sz); + if (! mem) + return false; // failed + // success + m_objects = (void **) mem; + m_capacity = sz; + return true; + } + + // untyped destructor of elements - must be overriden + virtual void Free(void *) = 0; + // untyped copy constructor of elements - must be overriden + virtual void *Copy(const void *) const = 0; + + const void *GetItem(size_type idx) const + { + wxASSERT(idx < m_size); + return m_objects[idx]; + } + + void Append(void *obj) + { + wxASSERT(m_size < m_capacity); + m_objects[m_size] = obj; + m_size++; + } + + void RemoveAt(size_type idx) + { + wxASSERT(idx < m_size); + Free(m_objects[idx]); + if (idx < m_size - 1) + memcpy( + m_objects + idx, + m_objects + idx + 1, + ( m_size - idx - 1 ) * sizeof(void*) ); + m_size--; + } + + bool copy(const wxVectorBase& vb) + { + clear(); + if (! Alloc(vb.size())) + return false; + + for (size_type i = 0; i < vb.size(); i++) + { + void *o = vb.Copy(vb.GetItem(i)); + if (! o) + return false; + Append(o); + } + + return true; + } + +public: + wxVectorBase() : m_allocsize(16), m_size(0), m_capacity(0), m_objects(0) {} + virtual ~wxVectorBase() {} // calm down GCC + + void clear() + { + for (size_type i = 0; i < size(); i++) + Free(m_objects[i]); + free(m_objects); + m_objects = 0; + m_size = m_capacity = 0; + } + + void reserve(size_type n) + { + if ( !Alloc(n) ) + { + wxFAIL_MSG( _T("out of memory in wxVector::reserve()") ); + } + } + + size_type size() const + { + return m_size; + } + + size_type capacity() const + { + return m_capacity; + } + + bool empty() const + { + return size() == 0; + } + + wxVectorBase& operator = (const wxVectorBase& vb) + { + wxCHECK(copy(vb), *this); + return *this; + } +}; + +#define WX_DECLARE_VECTORBASE(obj, cls)\ +protected:\ + virtual void Free(void *o)\ + {\ + delete (obj *) o;\ + }\ + virtual void *Copy(const void *o) const\ + {\ + return new obj(*(obj *) o);\ + }\ +public:\ + cls() {}\ + cls(const cls& c) : wxVectorBase()\ + {\ + wxCHECK2(copy(c), return);\ + }\ + ~cls()\ + {\ + clear();\ + } + +#define _WX_DECLARE_VECTOR(obj, cls, exp)\ +class exp cls : public wxVectorBase\ +{\ + WX_DECLARE_VECTORBASE(obj, cls)\ +public:\ + void push_back(const obj& o)\ + {\ + wxCHECK2(Alloc(size() + 1), return);\ + Append(new obj(o));\ + }\ + void pop_back()\ + {\ + RemoveAt(size() - 1);\ + }\ + const obj& at(size_type idx) const\ + {\ + return *(obj *) GetItem(idx);\ + }\ + obj& at(size_type idx)\ + {\ + return *(obj *) GetItem(idx);\ + }\ + const obj& operator[](size_type idx) const\ + {\ + return at(idx);\ + }\ + obj& operator[](size_type idx)\ + {\ + return at(idx);\ + }\ + const obj& front() const\ + {\ + return at(0);\ + }\ + obj& front()\ + {\ + return at(0);\ + }\ + const obj& back() const\ + {\ + return at(size() - 1);\ + }\ + obj& back()\ + {\ + return at(size() - 1);\ + }\ + size_type erase(size_type idx)\ + {\ + RemoveAt(idx);\ + return idx;\ + }\ +} + +#define WX_DECLARE_VECTOR(obj, cls) \ + _WX_DECLARE_VECTOR(obj, cls, WXDLLEXPORT) + +#endif // _WX_VECTOR_H_ + diff --git a/Externals/wxWidgets/include/wx/version.h b/Externals/wxWidgets/include/wx/version.h index 3362a015c1..59cb9804fb 100644 --- a/Externals/wxWidgets/include/wx/version.h +++ b/Externals/wxWidgets/include/wx/version.h @@ -1,91 +1,91 @@ -/* - * Name: wx/version.h - * Purpose: wxWidgets version numbers - * Author: Julian Smart - * Modified by: Ryan Norton (Converted to C) - * Created: 29/01/98 - * RCS-ID: $Id: version.h 53651 2008-05-19 19:09:22Z CE $ - * Copyright: (c) 1998 Julian Smart - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_VERSION_H_ -#define _WX_VERSION_H_ - -#include "wx/cpp.h" /* for wxSTRINGIZE */ - -/* the constants below must be changed with each new version */ -/* ---------------------------------------------------------------------------- */ - -/* - Don't forget to update WX_CURRENT, WX_REVISION and WX_AGE in - build/bakefiles/version.bkl and regenerate the makefiles when you change - this! - */ - -/* NB: this file is parsed by automatic tools so don't change its format! */ -#define wxMAJOR_VERSION 2 -#define wxMINOR_VERSION 8 -#define wxRELEASE_NUMBER 8 -#define wxSUBRELEASE_NUMBER 0 -#define wxVERSION_STRING _T("wxWidgets 2.8.8") - -/* nothing to update below this line when updating the version */ -/* ---------------------------------------------------------------------------- */ - -/* Users can pre-define wxABI_VERSION to a lower value in their - * makefile/project settings to compile code that will be binary compatible - * with earlier versions of the ABI within the same minor version (between - * minor versions binary compatibility breaks anyway). The default is the - * version of wxWidgets being used. A single number with two decimal digits - * for each component, e.g. 20601 for 2.6.1 */ -#ifndef wxABI_VERSION -#define wxABI_VERSION ( wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 ) -#endif - -/* helpers for wxVERSION_NUM_XXX */ -#define wxMAKE_VERSION_STRING(x, y, z) \ - wxSTRINGIZE(x) wxSTRINGIZE(y) wxSTRINGIZE(z) -#define wxMAKE_VERSION_DOT_STRING(x, y, z) \ - wxSTRINGIZE(x) "." wxSTRINGIZE(y) "." wxSTRINGIZE(z) - -#define wxMAKE_VERSION_STRING_T(x, y, z) \ - wxSTRINGIZE_T(x) wxSTRINGIZE_T(y) wxSTRINGIZE_T(z) -#define wxMAKE_VERSION_DOT_STRING_T(x, y, z) \ - wxSTRINGIZE_T(x) _T(".") wxSTRINGIZE_T(y) _T(".") wxSTRINGIZE_T(z) - -/* these are used by src/msw/version.rc and should always be ASCII, not Unicode */ -#define wxVERSION_NUM_STRING \ - wxMAKE_VERSION_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) -#define wxVERSION_NUM_DOT_STRING \ - wxMAKE_VERSION_DOT_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) - -/* those are Unicode-friendly */ -#define wxVERSION_NUM_STRING_T \ - wxMAKE_VERSION_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) -#define wxVERSION_NUM_DOT_STRING_T \ - wxMAKE_VERSION_DOT_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) - -/* some more defines, not really sure if they're [still] useful */ -#define wxVERSION_NUMBER ( (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER ) -#define wxBETA_NUMBER 0 -#define wxVERSION_FLOAT ( wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) ) - -/* check if the current version is at least major.minor.release */ -#define wxCHECK_VERSION(major,minor,release) \ - (wxMAJOR_VERSION > (major) || \ - (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \ - (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release))) - -/* the same but check the subrelease also */ -#define wxCHECK_VERSION_FULL(major,minor,release,subrel) \ - (wxCHECK_VERSION(major, minor, release) && \ - ((major) != wxMAJOR_VERSION || \ - (minor) != wxMINOR_VERSION || \ - (release) != wxRELEASE_NUMBER || \ - (subrel) <= wxSUBRELEASE_NUMBER)) - -#endif /* _WX_VERSION_H_ */ - +/* + * Name: wx/version.h + * Purpose: wxWidgets version numbers + * Author: Julian Smart + * Modified by: Ryan Norton (Converted to C) + * Created: 29/01/98 + * RCS-ID: $Id: version.h 53651 2008-05-19 19:09:22Z CE $ + * Copyright: (c) 1998 Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_VERSION_H_ +#define _WX_VERSION_H_ + +#include "wx/cpp.h" /* for wxSTRINGIZE */ + +/* the constants below must be changed with each new version */ +/* ---------------------------------------------------------------------------- */ + +/* + Don't forget to update WX_CURRENT, WX_REVISION and WX_AGE in + build/bakefiles/version.bkl and regenerate the makefiles when you change + this! + */ + +/* NB: this file is parsed by automatic tools so don't change its format! */ +#define wxMAJOR_VERSION 2 +#define wxMINOR_VERSION 8 +#define wxRELEASE_NUMBER 8 +#define wxSUBRELEASE_NUMBER 0 +#define wxVERSION_STRING _T("wxWidgets 2.8.8") + +/* nothing to update below this line when updating the version */ +/* ---------------------------------------------------------------------------- */ + +/* Users can pre-define wxABI_VERSION to a lower value in their + * makefile/project settings to compile code that will be binary compatible + * with earlier versions of the ABI within the same minor version (between + * minor versions binary compatibility breaks anyway). The default is the + * version of wxWidgets being used. A single number with two decimal digits + * for each component, e.g. 20601 for 2.6.1 */ +#ifndef wxABI_VERSION +#define wxABI_VERSION ( wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 ) +#endif + +/* helpers for wxVERSION_NUM_XXX */ +#define wxMAKE_VERSION_STRING(x, y, z) \ + wxSTRINGIZE(x) wxSTRINGIZE(y) wxSTRINGIZE(z) +#define wxMAKE_VERSION_DOT_STRING(x, y, z) \ + wxSTRINGIZE(x) "." wxSTRINGIZE(y) "." wxSTRINGIZE(z) + +#define wxMAKE_VERSION_STRING_T(x, y, z) \ + wxSTRINGIZE_T(x) wxSTRINGIZE_T(y) wxSTRINGIZE_T(z) +#define wxMAKE_VERSION_DOT_STRING_T(x, y, z) \ + wxSTRINGIZE_T(x) _T(".") wxSTRINGIZE_T(y) _T(".") wxSTRINGIZE_T(z) + +/* these are used by src/msw/version.rc and should always be ASCII, not Unicode */ +#define wxVERSION_NUM_STRING \ + wxMAKE_VERSION_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) +#define wxVERSION_NUM_DOT_STRING \ + wxMAKE_VERSION_DOT_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) + +/* those are Unicode-friendly */ +#define wxVERSION_NUM_STRING_T \ + wxMAKE_VERSION_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) +#define wxVERSION_NUM_DOT_STRING_T \ + wxMAKE_VERSION_DOT_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) + +/* some more defines, not really sure if they're [still] useful */ +#define wxVERSION_NUMBER ( (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER ) +#define wxBETA_NUMBER 0 +#define wxVERSION_FLOAT ( wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) ) + +/* check if the current version is at least major.minor.release */ +#define wxCHECK_VERSION(major,minor,release) \ + (wxMAJOR_VERSION > (major) || \ + (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \ + (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release))) + +/* the same but check the subrelease also */ +#define wxCHECK_VERSION_FULL(major,minor,release,subrel) \ + (wxCHECK_VERSION(major, minor, release) && \ + ((major) != wxMAJOR_VERSION || \ + (minor) != wxMINOR_VERSION || \ + (release) != wxRELEASE_NUMBER || \ + (subrel) <= wxSUBRELEASE_NUMBER)) + +#endif /* _WX_VERSION_H_ */ + diff --git a/Externals/wxWidgets/include/wx/vidmode.h b/Externals/wxWidgets/include/wx/vidmode.h index 343d0de940..06e7ed4cfb 100644 --- a/Externals/wxWidgets/include/wx/vidmode.h +++ b/Externals/wxWidgets/include/wx/vidmode.h @@ -1,73 +1,73 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/vidmode.h -// Purpose: declares wxVideoMode class used by both wxDisplay and wxApp -// Author: Vadim Zeitlin -// Modified by: -// Created: 27.09.2003 (extracted from wx/display.h) -// RCS-ID: $Id: vidmode.h 27408 2004-05-23 20:53:33Z JS $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VMODE_H_ -#define _WX_VMODE_H_ - -// ---------------------------------------------------------------------------- -// wxVideoMode: a simple struct containing video mode parameters for a display -// ---------------------------------------------------------------------------- - -struct WXDLLEXPORT wxVideoMode -{ - wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) - { - w = width; - h = height; - - bpp = depth; - - refresh = freq; - } - - // default copy ctor and assignment operator are ok - - bool operator==(const wxVideoMode& m) const - { - return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh; - } - bool operator!=(const wxVideoMode& mode) const - { - return !operator==(mode); - } - - // returns true if this mode matches the other one in the sense that all - // non zero fields of the other mode have the same value in this one - // (except for refresh which is allowed to have a greater value) - bool Matches(const wxVideoMode& other) const - { - return (!other.w || w == other.w) && - (!other.h || h == other.h) && - (!other.bpp || bpp == other.bpp) && - (!other.refresh || refresh >= other.refresh); - } - - // trivial accessors - int GetWidth() const { return w; } - int GetHeight() const { return h; } - int GetDepth() const { return bpp; } - - // returns true if the object has been initialized - bool IsOk() const { return w && h; } - - - // the screen size in pixels (e.g. 640*480), 0 means unspecified - int w, h; - - // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known - int bpp; - - // refresh frequency in Hz, 0 means unspecified/unknown - int refresh; -}; - -#endif // _WX_VMODE_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/vidmode.h +// Purpose: declares wxVideoMode class used by both wxDisplay and wxApp +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.09.2003 (extracted from wx/display.h) +// RCS-ID: $Id: vidmode.h 27408 2004-05-23 20:53:33Z JS $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VMODE_H_ +#define _WX_VMODE_H_ + +// ---------------------------------------------------------------------------- +// wxVideoMode: a simple struct containing video mode parameters for a display +// ---------------------------------------------------------------------------- + +struct WXDLLEXPORT wxVideoMode +{ + wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) + { + w = width; + h = height; + + bpp = depth; + + refresh = freq; + } + + // default copy ctor and assignment operator are ok + + bool operator==(const wxVideoMode& m) const + { + return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh; + } + bool operator!=(const wxVideoMode& mode) const + { + return !operator==(mode); + } + + // returns true if this mode matches the other one in the sense that all + // non zero fields of the other mode have the same value in this one + // (except for refresh which is allowed to have a greater value) + bool Matches(const wxVideoMode& other) const + { + return (!other.w || w == other.w) && + (!other.h || h == other.h) && + (!other.bpp || bpp == other.bpp) && + (!other.refresh || refresh >= other.refresh); + } + + // trivial accessors + int GetWidth() const { return w; } + int GetHeight() const { return h; } + int GetDepth() const { return bpp; } + + // returns true if the object has been initialized + bool IsOk() const { return w && h; } + + + // the screen size in pixels (e.g. 640*480), 0 means unspecified + int w, h; + + // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known + int bpp; + + // refresh frequency in Hz, 0 means unspecified/unknown + int refresh; +}; + +#endif // _WX_VMODE_H_ + diff --git a/Externals/wxWidgets/include/wx/vlbox.h b/Externals/wxWidgets/include/wx/vlbox.h index 7767761fdd..1e0e6d9644 100644 --- a/Externals/wxWidgets/include/wx/vlbox.h +++ b/Externals/wxWidgets/include/wx/vlbox.h @@ -1,296 +1,296 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/vlbox.h -// Purpose: wxVListBox is a virtual listbox with lines of variable height -// Author: Vadim Zeitlin -// Modified by: -// Created: 31.05.03 -// RCS-ID: $Id: vlbox.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VLBOX_H_ -#define _WX_VLBOX_H_ - -#include "wx/vscroll.h" // base class -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxSelectionStore; - -#define wxVListBoxNameStr _T("wxVListBox") - -// ---------------------------------------------------------------------------- -// wxVListBox -// ---------------------------------------------------------------------------- - -/* - This class has two main differences from a regular listbox: it can have an - arbitrarily huge number of items because it doesn't store them itself but - uses OnDrawItem() callback to draw them and its items can have variable - height as determined by OnMeasureItem(). - - It emits the same events as wxListBox and the same event macros may be used - with it. - */ -class WXDLLEXPORT wxVListBox : public wxVScrolledWindow -{ -public: - // constructors and such - // --------------------- - - // default constructor, you must call Create() later - wxVListBox() { Init(); } - - // normal constructor which calls Create() internally - wxVListBox(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxVListBoxNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // really creates the control and sets the initial number of items in it - // (which may be changed later with SetItemCount()) - // - // the only special style which may be specified here is wxLB_MULTIPLE - // - // returns true on success or false if the control couldn't be created - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxVListBoxNameStr); - - // dtor does some internal cleanup (deletes m_selStore if any) - virtual ~wxVListBox(); - - - // accessors - // --------- - - // get the number of items in the control - size_t GetItemCount() const { return GetLineCount(); } - - // does this control use multiple selection? - bool HasMultipleSelection() const { return m_selStore != NULL; } - - // get the currently selected item or wxNOT_FOUND if there is no selection - // - // this method is only valid for the single selection listboxes - int GetSelection() const - { - wxASSERT_MSG( !HasMultipleSelection(), - _T("GetSelection() can't be used with wxLB_MULTIPLE") ); - - return m_current; - } - - // is this item the current one? - bool IsCurrent(size_t item) const { return item == (size_t)m_current; } - #ifdef __WXUNIVERSAL__ - bool IsCurrent() const { return wxVScrolledWindow::IsCurrent(); } - #endif - - // is this item selected? - bool IsSelected(size_t item) const; - - // get the number of the selected items (maybe 0) - // - // this method is valid for both single and multi selection listboxes - size_t GetSelectedCount() const; - - // get the first selected item, returns wxNOT_FOUND if none - // - // cookie is an opaque parameter which should be passed to - // GetNextSelected() later - // - // this method is only valid for the multi selection listboxes - int GetFirstSelected(unsigned long& cookie) const; - - // get next selection item, return wxNOT_FOUND if no more - // - // cookie must be the same parameter that was passed to GetFirstSelected() - // before - // - // this method is only valid for the multi selection listboxes - int GetNextSelected(unsigned long& cookie) const; - - // get the margins around each item - wxPoint GetMargins() const { return m_ptMargins; } - - // get the background colour of selected cells - const wxColour& GetSelectionBackground() const { return m_colBgSel; } - - - // operations - // ---------- - - // set the number of items to be shown in the control - // - // this is just a synonym for wxVScrolledWindow::SetLineCount() - virtual void SetItemCount(size_t count); - - // delete all items from the control - void Clear() { SetItemCount(0); } - - // set the selection to the specified item, if it is wxNOT_FOUND the - // selection is unset - // - // this function is only valid for the single selection listboxes - void SetSelection(int selection); - - // selects or deselects the specified item which must be valid (i.e. not - // equal to wxNOT_FOUND) - // - // return true if the items selection status has changed or false - // otherwise - // - // this function is only valid for the multiple selection listboxes - bool Select(size_t item, bool select = true); - - // selects the items in the specified range whose end points may be given - // in any order - // - // return true if any items selection status has changed, false otherwise - // - // this function is only valid for the single selection listboxes - bool SelectRange(size_t from, size_t to); - - // toggle the selection of the specified item (must be valid) - // - // this function is only valid for the multiple selection listboxes - void Toggle(size_t item) { Select(item, !IsSelected(item)); } - - // select all items in the listbox - // - // the return code indicates if any items were affected by this operation - // (true) or if nothing has changed (false) - bool SelectAll() { return DoSelectAll(true); } - - // unselect all items in the listbox - // - // the return code has the same meaning as for SelectAll() - bool DeselectAll() { return DoSelectAll(false); } - - // set the margins: horizontal margin is the distance between the window - // border and the item contents while vertical margin is half of the - // distance between items - // - // by default both margins are 0 - void SetMargins(const wxPoint& pt); - void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } - - // change the background colour of the selected cells - void SetSelectionBackground(const wxColour& col); - - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - -protected: - // the derived class must implement this function to actually draw the item - // with the given index on the provided DC - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0; - - // the derived class must implement this method to return the height of the - // specified item - virtual wxCoord OnMeasureItem(size_t n) const = 0; - - // this method may be used to draw separators between the lines; note that - // the rectangle may be modified, typically to deflate it a bit before - // passing to OnDrawItem() - // - // the base class version doesn't do anything - virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const; - - // this method is used to draw the items background and, maybe, a border - // around it - // - // the base class version implements a reasonable default behaviour which - // consists in drawing the selected item with the standard background - // colour and drawing a border around the item if it is either selected or - // current - virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; - - // we implement OnGetLineHeight() in terms of OnMeasureItem() because this - // allows us to add borders to the items easily - // - // this function is not supposed to be overridden by the derived classes - virtual wxCoord OnGetLineHeight(size_t line) const; - - - // event handlers - void OnPaint(wxPaintEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnLeftDown(wxMouseEvent& event); - void OnLeftDClick(wxMouseEvent& event); - - - // common part of all ctors - void Init(); - - // send the wxEVT_COMMAND_LISTBOX_SELECTED event - void SendSelectedEvent(); - - // common implementation of SelectAll() and DeselectAll() - bool DoSelectAll(bool select); - - // change the current item (in single selection listbox it also implicitly - // changes the selection); current may be wxNOT_FOUND in which case there - // will be no current item any more - // - // return true if the current item changed, false otherwise - bool DoSetCurrent(int current); - - // flags for DoHandleItemClick - enum - { - ItemClick_Shift = 1, // item shift-clicked - ItemClick_Ctrl = 2, // ctrl - ItemClick_Kbd = 4 // item selected from keyboard - }; - - // common part of keyboard and mouse handling processing code - void DoHandleItemClick(int item, int flags); - -private: - // the current item or wxNOT_FOUND - // - // if m_selStore == NULL this is also the selected item, otherwise the - // selections are managed by m_selStore - int m_current; - - // the anchor of the selection for the multiselection listboxes: - // shift-clicking an item extends the selection from m_anchor to the item - // clicked, for example - // - // always wxNOT_FOUND for single selection listboxes - int m_anchor; - - // the object managing our selected items if not NULL - wxSelectionStore *m_selStore; - - // margins - wxPoint m_ptMargins; - - // the selection bg colour - wxColour m_colBgSel; - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxVListBox) - DECLARE_ABSTRACT_CLASS(wxVListBox) -}; - -#endif // _WX_VLBOX_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/vlbox.h +// Purpose: wxVListBox is a virtual listbox with lines of variable height +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.05.03 +// RCS-ID: $Id: vlbox.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VLBOX_H_ +#define _WX_VLBOX_H_ + +#include "wx/vscroll.h" // base class +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxSelectionStore; + +#define wxVListBoxNameStr _T("wxVListBox") + +// ---------------------------------------------------------------------------- +// wxVListBox +// ---------------------------------------------------------------------------- + +/* + This class has two main differences from a regular listbox: it can have an + arbitrarily huge number of items because it doesn't store them itself but + uses OnDrawItem() callback to draw them and its items can have variable + height as determined by OnMeasureItem(). + + It emits the same events as wxListBox and the same event macros may be used + with it. + */ +class WXDLLEXPORT wxVListBox : public wxVScrolledWindow +{ +public: + // constructors and such + // --------------------- + + // default constructor, you must call Create() later + wxVListBox() { Init(); } + + // normal constructor which calls Create() internally + wxVListBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxVListBoxNameStr) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // really creates the control and sets the initial number of items in it + // (which may be changed later with SetItemCount()) + // + // the only special style which may be specified here is wxLB_MULTIPLE + // + // returns true on success or false if the control couldn't be created + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxVListBoxNameStr); + + // dtor does some internal cleanup (deletes m_selStore if any) + virtual ~wxVListBox(); + + + // accessors + // --------- + + // get the number of items in the control + size_t GetItemCount() const { return GetLineCount(); } + + // does this control use multiple selection? + bool HasMultipleSelection() const { return m_selStore != NULL; } + + // get the currently selected item or wxNOT_FOUND if there is no selection + // + // this method is only valid for the single selection listboxes + int GetSelection() const + { + wxASSERT_MSG( !HasMultipleSelection(), + _T("GetSelection() can't be used with wxLB_MULTIPLE") ); + + return m_current; + } + + // is this item the current one? + bool IsCurrent(size_t item) const { return item == (size_t)m_current; } + #ifdef __WXUNIVERSAL__ + bool IsCurrent() const { return wxVScrolledWindow::IsCurrent(); } + #endif + + // is this item selected? + bool IsSelected(size_t item) const; + + // get the number of the selected items (maybe 0) + // + // this method is valid for both single and multi selection listboxes + size_t GetSelectedCount() const; + + // get the first selected item, returns wxNOT_FOUND if none + // + // cookie is an opaque parameter which should be passed to + // GetNextSelected() later + // + // this method is only valid for the multi selection listboxes + int GetFirstSelected(unsigned long& cookie) const; + + // get next selection item, return wxNOT_FOUND if no more + // + // cookie must be the same parameter that was passed to GetFirstSelected() + // before + // + // this method is only valid for the multi selection listboxes + int GetNextSelected(unsigned long& cookie) const; + + // get the margins around each item + wxPoint GetMargins() const { return m_ptMargins; } + + // get the background colour of selected cells + const wxColour& GetSelectionBackground() const { return m_colBgSel; } + + + // operations + // ---------- + + // set the number of items to be shown in the control + // + // this is just a synonym for wxVScrolledWindow::SetLineCount() + virtual void SetItemCount(size_t count); + + // delete all items from the control + void Clear() { SetItemCount(0); } + + // set the selection to the specified item, if it is wxNOT_FOUND the + // selection is unset + // + // this function is only valid for the single selection listboxes + void SetSelection(int selection); + + // selects or deselects the specified item which must be valid (i.e. not + // equal to wxNOT_FOUND) + // + // return true if the items selection status has changed or false + // otherwise + // + // this function is only valid for the multiple selection listboxes + bool Select(size_t item, bool select = true); + + // selects the items in the specified range whose end points may be given + // in any order + // + // return true if any items selection status has changed, false otherwise + // + // this function is only valid for the single selection listboxes + bool SelectRange(size_t from, size_t to); + + // toggle the selection of the specified item (must be valid) + // + // this function is only valid for the multiple selection listboxes + void Toggle(size_t item) { Select(item, !IsSelected(item)); } + + // select all items in the listbox + // + // the return code indicates if any items were affected by this operation + // (true) or if nothing has changed (false) + bool SelectAll() { return DoSelectAll(true); } + + // unselect all items in the listbox + // + // the return code has the same meaning as for SelectAll() + bool DeselectAll() { return DoSelectAll(false); } + + // set the margins: horizontal margin is the distance between the window + // border and the item contents while vertical margin is half of the + // distance between items + // + // by default both margins are 0 + void SetMargins(const wxPoint& pt); + void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } + + // change the background colour of the selected cells + void SetSelectionBackground(const wxColour& col); + + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + // the derived class must implement this function to actually draw the item + // with the given index on the provided DC + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0; + + // the derived class must implement this method to return the height of the + // specified item + virtual wxCoord OnMeasureItem(size_t n) const = 0; + + // this method may be used to draw separators between the lines; note that + // the rectangle may be modified, typically to deflate it a bit before + // passing to OnDrawItem() + // + // the base class version doesn't do anything + virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const; + + // this method is used to draw the items background and, maybe, a border + // around it + // + // the base class version implements a reasonable default behaviour which + // consists in drawing the selected item with the standard background + // colour and drawing a border around the item if it is either selected or + // current + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; + + // we implement OnGetLineHeight() in terms of OnMeasureItem() because this + // allows us to add borders to the items easily + // + // this function is not supposed to be overridden by the derived classes + virtual wxCoord OnGetLineHeight(size_t line) const; + + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnLeftDown(wxMouseEvent& event); + void OnLeftDClick(wxMouseEvent& event); + + + // common part of all ctors + void Init(); + + // send the wxEVT_COMMAND_LISTBOX_SELECTED event + void SendSelectedEvent(); + + // common implementation of SelectAll() and DeselectAll() + bool DoSelectAll(bool select); + + // change the current item (in single selection listbox it also implicitly + // changes the selection); current may be wxNOT_FOUND in which case there + // will be no current item any more + // + // return true if the current item changed, false otherwise + bool DoSetCurrent(int current); + + // flags for DoHandleItemClick + enum + { + ItemClick_Shift = 1, // item shift-clicked + ItemClick_Ctrl = 2, // ctrl + ItemClick_Kbd = 4 // item selected from keyboard + }; + + // common part of keyboard and mouse handling processing code + void DoHandleItemClick(int item, int flags); + +private: + // the current item or wxNOT_FOUND + // + // if m_selStore == NULL this is also the selected item, otherwise the + // selections are managed by m_selStore + int m_current; + + // the anchor of the selection for the multiselection listboxes: + // shift-clicking an item extends the selection from m_anchor to the item + // clicked, for example + // + // always wxNOT_FOUND for single selection listboxes + int m_anchor; + + // the object managing our selected items if not NULL + wxSelectionStore *m_selStore; + + // margins + wxPoint m_ptMargins; + + // the selection bg colour + wxColour m_colBgSel; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxVListBox) + DECLARE_ABSTRACT_CLASS(wxVListBox) +}; + +#endif // _WX_VLBOX_H_ + diff --git a/Externals/wxWidgets/include/wx/vms_x_fix.h b/Externals/wxWidgets/include/wx/vms_x_fix.h index 86f3c64944..7abe930816 100644 --- a/Externals/wxWidgets/include/wx/vms_x_fix.h +++ b/Externals/wxWidgets/include/wx/vms_x_fix.h @@ -1,1213 +1,1213 @@ -/*************************************************************************** - * * - * Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) * - * * - * Last revision : 7 October 2005 * - * * - * Repair definitions of Runtime library functions when compiling with * - * /name=(as_is) on OpenVMS * - * * - ***************************************************************************/ - -#ifndef VMS_X_FIX -#define VMS_X_FIX - -#define decw$_select DECW$_SELECT -#define DtSaverGetWindows DTSAVERGETWINDOWS -#define MrmFetchWidget MRMFETCHWIDGET -#define MrmInitialize MRMINITIALIZE -#define MrmOpenHierarchy MRMOPENHIERARCHY -#define MrmRegisterNames MRMREGISTERNAMES -#define XAddExtension XADDEXTENSION -#define XAddHosts XADDHOSTS -#define XAllocClassHint XALLOCCLASSHINT -#define XAllocColor XALLOCCOLOR -#define XAllocColorCells XALLOCCOLORCELLS -#define XAllocIconSize XALLOCICONSIZE -#define XAllocNamedColor XALLOCNAMEDCOLOR -#define XAllocSizeHints XALLOCSIZEHINTS -#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP -#define XAllocWMHints XALLOCWMHINTS -#define XAllowEvents XALLOWEVENTS -#define XAutoRepeatOff XAUTOREPEATOFF -#define XAutoRepeatOn XAUTOREPEATON -#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET -#define XBell XBELL -#define XBitmapPad XBITMAPPAD -#define XBlackPixel XBLACKPIXEL -#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN -#define XCellsOfScreen XCELLSOFSCREEN -#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB -#define XChangeGC XCHANGEGC -#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL -#define XChangePointerControl XCHANGEPOINTERCONTROL -#define XChangeProperty XCHANGEPROPERTY -#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES -#define XCheckIfEvent XCHECKIFEVENT -#define XCheckMaskEvent XCHECKMASKEVENT -#define XCheckTypedEvent XCHECKTYPEDEVENT -#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT -#define XCheckWindowEvent XCHECKWINDOWEVENT -#define XClearArea XCLEARAREA -#define XClearWindow XCLEARWINDOW -#define XClipBox XCLIPBOX -#define XCloseDisplay XCLOSEDISPLAY -#define XCloseIM XCLOSEIM -#define XConfigureWindow XCONFIGUREWINDOW -#define XConvertSelection XCONVERTSELECTION -#define XCopyArea XCOPYAREA -#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE -#define XCopyGC XCOPYGC -#define XCopyPlane XCOPYPLANE -#define XCreateBitmapFromData XCREATEBITMAPFROMDATA -#define XCreateColormap XCREATECOLORMAP -#define XCreateFontCursor XCREATEFONTCURSOR -#define XCreateFontSet XCREATEFONTSET -#define XCreateGC XCREATEGC -#define XCreateGlyphCursor XCREATEGLYPHCURSOR -#define XCreateIC XCREATEIC -#define XCreateImage XCREATEIMAGE -#define XCreatePixmap XCREATEPIXMAP -#define XCreatePixmapCursor XCREATEPIXMAPCURSOR -#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA -#define XCreateRegion XCREATEREGION -#define XCreateSimpleWindow XCREATESIMPLEWINDOW -#define XCreateWindow XCREATEWINDOW -#define XDefaultColormap XDEFAULTCOLORMAP -#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN -#define XDefaultDepth XDEFAULTDEPTH -#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN -#define XDefaultGC XDEFAULTGC -#define XDefaultRootWindow XDEFAULTROOTWINDOW -#define XDefaultScreen XDEFAULTSCREEN -#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY -#define XDefaultVisual XDEFAULTVISUAL -#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN -#define XDefineCursor XDEFINECURSOR -#define XDeleteContext XDELETECONTEXT -#define XDeleteProperty XDELETEPROPERTY -#define XDestroyIC XDESTROYIC -#define XDestroyRegion XDESTROYREGION -#define XDestroySubwindows XDESTROYSUBWINDOWS -#define XDestroyWindow XDESTROYWINDOW -#define XDisableAccessControl XDISABLEACCESSCONTROL -#define XDisplayCells XDISPLAYCELLS -#define XDisplayHeight XDISPLAYHEIGHT -#define XDisplayKeycodes XDISPLAYKEYCODES -#define XDisplayName XDISPLAYNAME -#define XDisplayOfIM XDISPLAYOFIM -#define XDisplayOfScreen XDISPLAYOFSCREEN -#define XDisplayString XDISPLAYSTRING -#define XDisplayWidth XDISPLAYWIDTH -#define XDoesBackingStore XDOESBACKINGSTORE -#define XDrawArc XDRAWARC -#define XDrawArcs XDRAWARCS -#define XDrawImageString XDRAWIMAGESTRING -#define XDrawImageString16 XDRAWIMAGESTRING16 -#define XDrawLine XDRAWLINE -#define XDrawLines XDRAWLINES -#define XDrawPoint XDRAWPOINT -#define XDrawPoints XDRAWPOINTS -#define XDrawRectangle XDRAWRECTANGLE -#define XDrawRectangles XDRAWRECTANGLES -#define XDrawSegments XDRAWSEGMENTS -#define XDrawString XDRAWSTRING -#define XDrawString16 XDRAWSTRING16 -#define XDrawText XDRAWTEXT -#define XDrawText16 XDRAWTEXT16 -#define XESetCloseDisplay XESETCLOSEDISPLAY -#define XEmptyRegion XEMPTYREGION -#define XEnableAccessControl XENABLEACCESSCONTROL -#define XEqualRegion XEQUALREGION -#define XEventsQueued XEVENTSQUEUED -#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE -#define XExtentsOfFontSet XEXTENTSOFFONTSET -#define XFetchBuffer XFETCHBUFFER -#define XFetchBytes XFETCHBYTES -#define XFetchName XFETCHNAME -#define XFillArc XFILLARC -#define XFillArcs XFILLARCS -#define XFillPolygon XFILLPOLYGON -#define XFillRectangle XFILLRECTANGLE -#define XFillRectangles XFILLRECTANGLES -#define XFilterEvent XFILTEREVENT -#define XFindContext XFINDCONTEXT -#define XFlush XFLUSH -#define XFontsOfFontSet XFONTSOFFONTSET -#define XForceScreenSaver XFORCESCREENSAVER -#define XFree XFREE -#define XFreeColormap XFREECOLORMAP -#define XFreeColors XFREECOLORS -#define XFreeCursor XFREECURSOR -#define XFreeDeviceList XFREEDEVICELIST -#define XFreeDeviceState XFREEDEVICESTATE -#define XFreeFont XFREEFONT -#define XFreeFontInfo XFREEFONTINFO -#define XFreeFontNames XFREEFONTNAMES -#define XFreeFontSet XFREEFONTSET -#define XFreeGC XFREEGC -#define XFreeModifiermap XFREEMODIFIERMAP -#define XFreePixmap XFREEPIXMAP -#define XFreeStringList XFREESTRINGLIST -#define XGContextFromGC XGCONTEXTFROMGC -#define XGeometry XGEOMETRY -#define XGetAtomName XGETATOMNAME -#define XGetCommand XGETCOMMAND -#define XGetDefault XGETDEFAULT -#define XGetErrorDatabaseText XGETERRORDATABASETEXT -#define XGetErrorText XGETERRORTEXT -#define XGetExtensionVersion XGETEXTENSIONVERSION -#define XGetFontProperty XGETFONTPROPERTY -#define XGetGCValues XGETGCVALUES -#define XGetGeometry XGETGEOMETRY -#define XGetICValues XGETICVALUES -#define XGetIMValues XGETIMVALUES -#define XGetIconName XGETICONNAME -#define XGetIconSizes XGETICONSIZES -#define XGetImage XGETIMAGE -#define XGetInputFocus XGETINPUTFOCUS -#define XGetKeyboardControl XGETKEYBOARDCONTROL -#define XGetKeyboardMapping XGETKEYBOARDMAPPING -#define XGetModifierMapping XGETMODIFIERMAPPING -#define XGetMotionEvents XGETMOTIONEVENTS -#define XGetNormalHints XGETNORMALHINTS -#define XGetPointerMapping XGETPOINTERMAPPING -#define XGetRGBColormaps XGETRGBCOLORMAPS -#define XGetScreenSaver XGETSCREENSAVER -#define XGetSelectionOwner XGETSELECTIONOWNER -#define XGetStandardColormap XGETSTANDARDCOLORMAP -#define XGetSubImage XGETSUBIMAGE -#define XGetTextProperty XGETTEXTPROPERTY -#define XGetVisualInfo XGETVISUALINFO -#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS -#define XGetWMHints XGETWMHINTS -#define XGetWMIconName XGETWMICONNAME -#define XGetWMName XGETWMNAME -#define XGetWMNormalHints XGETWMNORMALHINTS -#define XGetWindowAttributes XGETWINDOWATTRIBUTES -#define XGetWindowProperty XGETWINDOWPROPERTY -#define XGrabButton XGRABBUTTON -#define XGrabKeyboard XGRABKEYBOARD -#define XGrabPointer XGRABPOINTER -#define XGrabServer XGRABSERVER -#define XHeightMMOfScreen XHEIGHTMMOFSCREEN -#define XHeightOfScreen XHEIGHTOFSCREEN -#define XIconifyWindow XICONIFYWINDOW -#define XIfEvent XIFEVENT -#define XInitExtension XINITEXTENSION -#define XInitImage XINITIMAGE -#define XInstallColormap XINSTALLCOLORMAP -#define XInternAtom XINTERNATOM -#define XInternAtoms XINTERNATOMS -#define XIntersectRegion XINTERSECTREGION -#define XKeycodeToKeysym XKEYCODETOKEYSYM -#define XKeysymToKeycode XKEYSYMTOKEYCODE -#define XKeysymToString XKEYSYMTOSTRING -#define XKillClient XKILLCLIENT -#define XListDepths XLISTDEPTHS -#define XListFonts XLISTFONTS -#define XListFontsWithInfo XLISTFONTSWITHINFO -#define XListHosts XLISTHOSTS -#define XListInputDevices XLISTINPUTDEVICES -#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS -#define XListPixmapFormats XLISTPIXMAPFORMATS -#define XListProperties XLISTPROPERTIES -#define XLoadFont XLOADFONT -#define XLoadQueryFont XLOADQUERYFONT -#define XLookupColor XLOOKUPCOLOR -#define XLookupKeysym XLOOKUPKEYSYM -#define XLookupString XLOOKUPSTRING -#define XLowerWindow XLOWERWINDOW -#define XMapRaised XMAPRAISED -#define XMapSubwindows XMAPSUBWINDOWS -#define XMapWindow XMAPWINDOW -#define XMatchVisualInfo XMATCHVISUALINFO -#define XMaxRequestSize XMAXREQUESTSIZE -#define XMissingExtension XMISSINGEXTENSION -#define XMoveResizeWindow XMOVERESIZEWINDOW -#define XMoveWindow XMOVEWINDOW -#define XNextEvent XNEXTEVENT -#define XNextRequest XNEXTREQUEST -#define XNoOp XNOOP -#define XOffsetRegion XOFFSETREGION -#define XOpenDevice XOPENDEVICE -#define XOpenDisplay XOPENDISPLAY -#define XOpenIM XOPENIM -#define XParseColor XPARSECOLOR -#define XParseGeometry XPARSEGEOMETRY -#define XPeekEvent XPEEKEVENT -#define XPeekIfEvent XPEEKIFEVENT -#define XPending XPENDING -#define XPointInRegion XPOINTINREGION -#define XPolygonRegion XPOLYGONREGION -#define XPutBackEvent XPUTBACKEVENT -#define XPutImage XPUTIMAGE -#define XQLength XQLENGTH -#define XQueryBestCursor XQUERYBESTCURSOR -#define XQueryBestStipple XQUERYBESTSTIPPLE -#define XQueryColor XQUERYCOLOR -#define XQueryColors XQUERYCOLORS -#define XQueryDeviceState XQUERYDEVICESTATE -#define XQueryExtension XQUERYEXTENSION -#define XQueryFont XQUERYFONT -#define XQueryKeymap XQUERYKEYMAP -#define XQueryPointer XQUERYPOINTER -#define XQueryTree XQUERYTREE -#define XRaiseWindow XRAISEWINDOW -#define XReadBitmapFile XREADBITMAPFILE -#define XRecolorCursor XRECOLORCURSOR -#define XReconfigureWMWindow XRECONFIGUREWMWINDOW -#define XRectInRegion XRECTINREGION -#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING -#define XRemoveHosts XREMOVEHOSTS -#define XReparentWindow XREPARENTWINDOW -#define XResetScreenSaver XRESETSCREENSAVER -#define XResizeWindow XRESIZEWINDOW -#define XResourceManagerString XRESOURCEMANAGERSTRING -#define XRestackWindows XRESTACKWINDOWS -#define XRotateBuffers XROTATEBUFFERS -#define XRootWindow XROOTWINDOW -#define XRootWindowOfScreen XROOTWINDOWOFSCREEN -#define XSaveContext XSAVECONTEXT -#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN -#define XScreenOfDisplay XSCREENOFDISPLAY -#define XSelectAsyncEvent XSELECTASYNCEVENT -#define XSelectAsyncInput XSELECTASYNCINPUT -#define XSelectExtensionEvent XSELECTEXTENSIONEVENT -#define XSelectInput XSELECTINPUT -#define XSendEvent XSENDEVENT -#define XServerVendor XSERVERVENDOR -#define XSetArcMode XSETARCMODE -#define XSetBackground XSETBACKGROUND -#define XSetClassHint XSETCLASSHINT -#define XSetClipMask XSETCLIPMASK -#define XSetClipOrigin XSETCLIPORIGIN -#define XSetClipRectangles XSETCLIPRECTANGLES -#define XSetCloseDownMode XSETCLOSEDOWNMODE -#define XSetCommand XSETCOMMAND -#define XSetDashes XSETDASHES -#define XSetErrorHandler XSETERRORHANDLER -#define XSetFillRule XSETFILLRULE -#define XSetFillStyle XSETFILLSTYLE -#define XSetFont XSETFONT -#define XSetForeground XSETFOREGROUND -#define XSetFunction XSETFUNCTION -#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES -#define XSetICFocus XSETICFOCUS -#define XSetICValues XSETICVALUES -#define XSetIOErrorHandler XSETIOERRORHANDLER -#define XSetIconName XSETICONNAME -#define XSetInputFocus XSETINPUTFOCUS -#define XSetLineAttributes XSETLINEATTRIBUTES -#define XSetLocaleModifiers XSETLOCALEMODIFIERS -#define XSetNormalHints XSETNORMALHINTS -#define XSetPlaneMask XSETPLANEMASK -#define XSetRegion XSETREGION -#define XSetRGBColormaps XSETRGBCOLORMAPS -#define XSetScreenSaver XSETSCREENSAVER -#define XSetSelectionOwner XSETSELECTIONOWNER -#define XSetStandardProperties XSETSTANDARDPROPERTIES -#define XSetState XSETSTATE -#define XSetStipple XSETSTIPPLE -#define XSetSubwindowMode XSETSUBWINDOWMODE -#define XSetTSOrigin XSETTSORIGIN -#define XSetTextProperty XSETTEXTPROPERTY -#define XSetTile XSETTILE -#define XSetTransientForHint XSETTRANSIENTFORHINT -#define XSetWMClientMachine XSETWMCLIENTMACHINE -#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS -#define XSetWMHints XSETWMHINTS -#define XSetWMIconName XSETWMICONNAME -#define XSetWMName XSETWMNAME -#define XSetWMNormalHints XSETWMNORMALHINTS -#define XSetWMProperties XSETWMPROPERTIES -#define XSetWMProtocols XSETWMPROTOCOLS -#define XSetWMSizeHints XSETWMSIZEHINTS -#define XSetWindowBackground XSETWINDOWBACKGROUND -#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP -#define XSetWindowBorder XSETWINDOWBORDER -#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP -#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH -#define XSetWindowColormap XSETWINDOWCOLORMAP -#define XShapeCombineMask XSHAPECOMBINEMASK -#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES -#define XShapeGetRectangles XSHAPEGETRECTANGLES -#define XShapeQueryExtension XSHAPEQUERYEXTENSION -#define XShmAttach XSHMATTACH -#define XShmCreateImage XSHMCREATEIMAGE -#define XShmCreatePixmap XSHMCREATEPIXMAP -#define XShmDetach XSHMDETACH -#define XShmGetEventBase XSHMGETEVENTBASE -#define XShmPutImage XSHMPUTIMAGE -#define XShmQueryExtension XSHMQUERYEXTENSION -#define XShmQueryVersion XSHMQUERYVERSION -#define XShrinkRegion XSHRINKREGION -#define XStoreBuffer XSTOREBUFFER -#define XStoreBytes XSTOREBYTES -#define XStoreColor XSTORECOLOR -#define XStoreColors XSTORECOLORS -#define XStoreName XSTORENAME -#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY -#define XStringToKeysym XSTRINGTOKEYSYM -#define XSubtractRegion XSUBTRACTREGION -#define XSupportsLocale XSUPPORTSLOCALE -#define XSync XSYNC -#define XSynchronize XSYNCHRONIZE -#define XTextExtents XTEXTEXTENTS -#define XTextExtents16 XTEXTEXTENTS16 -#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST -#define XTextWidth XTEXTWIDTH -#define XTextWidth16 XTEXTWIDTH16 -#define XTranslateCoordinates XTRANSLATECOORDINATES -#define XUndefineCursor XUNDEFINECURSOR -#define XUngrabButton XUNGRABBUTTON -#define XUngrabKeyboard XUNGRABKEYBOARD -#define XUngrabPointer XUNGRABPOINTER -#define XUngrabServer XUNGRABSERVER -#define XUninstallColormap XUNINSTALLCOLORMAP -#define XUnionRectWithRegion XUNIONRECTWITHREGION -#define XUnionRegion XUNIONREGION -#define XUniqueContext XUNIQUECONTEXT -#define XUnmapWindow XUNMAPWINDOW -#define XUnsetICFocus XUNSETICFOCUS -#define XVaCreateNestedList XVACREATENESTEDLIST -#define XVisualIDFromVisual XVISUALIDFROMVISUAL -#define XWMGeometry XWMGEOMETRY -#define XWarpPointer XWARPPOINTER -#define XWhitePixel XWHITEPIXEL -#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN -#define XWidthMMOfScreen XWIDTHMMOFSCREEN -#define XWidthOfScreen XWIDTHOFSCREEN -#define XWindowEvent XWINDOWEVENT -#define XWithdrawWindow XWITHDRAWWINDOW -#define XXorRegion XXORREGION -#define XcmsQueryColor XCMSQUERYCOLOR -#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME -#define XdbeFreeVisualInfo XDBEFREEVISUALINFO -#define XdbeGetVisualInfo XDBEGETVISUALINFO -#define XdbeQueryExtension XDBEQUERYEXTENSION -#define XdbeSwapBuffers XDBESWAPBUFFERS -#define XextAddDisplay XEXTADDDISPLAY -#define XextFindDisplay XEXTFINDDISPLAY -#define XextRemoveDisplay XEXTREMOVEDISPLAY -#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT -#define XmActivateProtocol XMACTIVATEPROTOCOL -#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK -#define XmAddProtocols XMADDPROTOCOLS -#define XmChangeColor XMCHANGECOLOR -#define XmClipboardCopy XMCLIPBOARDCOPY -#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME -#define XmClipboardEndCopy XMCLIPBOARDENDCOPY -#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE -#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT -#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT -#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH -#define XmClipboardLock XMCLIPBOARDLOCK -#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE -#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY -#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE -#define XmClipboardUnlock XMCLIPBOARDUNLOCK -#define XmCommandError XMCOMMANDERROR -#define XmCommandGetChild XMCOMMANDGETCHILD -#define XmCommandSetValue XMCOMMANDSETVALUE -#define XmCreateArrowButton XMCREATEARROWBUTTON -#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET -#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG -#define XmCreateCascadeButton XMCREATECASCADEBUTTON -#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET -#define XmCreateDialogShell XMCREATEDIALOGSHELL -#define XmCreateDragIcon XMCREATEDRAGICON -#define XmCreateDrawingArea XMCREATEDRAWINGAREA -#define XmCreateDrawnButton XMCREATEDRAWNBUTTON -#define XmCreateErrorDialog XMCREATEERRORDIALOG -#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX -#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG -#define XmCreateForm XMCREATEFORM -#define XmCreateFormDialog XMCREATEFORMDIALOG -#define XmCreateFrame XMCREATEFRAME -#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG -#define XmCreateLabel XMCREATELABEL -#define XmCreateLabelGadget XMCREATELABELGADGET -#define XmCreateList XMCREATELIST -#define XmCreateMainWindow XMCREATEMAINWINDOW -#define XmCreateMenuBar XMCREATEMENUBAR -#define XmCreateMessageBox XMCREATEMESSAGEBOX -#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG -#define XmCreateOptionMenu XMCREATEOPTIONMENU -#define XmCreatePanedWindow XMCREATEPANEDWINDOW -#define XmCreatePopupMenu XMCREATEPOPUPMENU -#define XmCreatePromptDialog XMCREATEPROMPTDIALOG -#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU -#define XmCreatePushButton XMCREATEPUSHBUTTON -#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET -#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG -#define XmCreateRadioBox XMCREATERADIOBOX -#define XmCreateRowColumn XMCREATEROWCOLUMN -#define XmCreateScale XMCREATESCALE -#define XmCreateScrollBar XMCREATESCROLLBAR -#define XmCreateScrolledList XMCREATESCROLLEDLIST -#define XmCreateScrolledText XMCREATESCROLLEDTEXT -#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW -#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG -#define XmCreateSeparator XMCREATESEPARATOR -#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET -#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG -#define XmCreateText XMCREATETEXT -#define XmCreateTextField XMCREATETEXTFIELD -#define XmCreateToggleButton XMCREATETOGGLEBUTTON -#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET -#define XmCreateWarningDialog XMCREATEWARNINGDIALOG -#define XmCvtCTToXmString XMCVTCTTOXMSTRING -#define XmDestroyPixmap XMDESTROYPIXMAP -#define XmDragStart XMDRAGSTART -#define XmDropSiteRegister XMDROPSITEREGISTER -#define XmDropSiteUnregister XMDROPSITEUNREGISTER -#define XmDropSiteUpdate XMDROPSITEUPDATE -#define XmDropTransferStart XMDROPTRANSFERSTART -#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD -#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH -#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY -#define XmFontListCopy XMFONTLISTCOPY -#define XmFontListCreate XMFONTLISTCREATE -#define XmFontListEntryCreate XMFONTLISTENTRYCREATE -#define XmFontListEntryFree XMFONTLISTENTRYFREE -#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT -#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG -#define XmFontListEntryLoad XMFONTLISTENTRYLOAD -#define XmFontListFree XMFONTLISTFREE -#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT -#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT -#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT -#define XmFontListNextEntry XMFONTLISTNEXTENTRY -#define XmGetColors XMGETCOLORS -#define XmGetColorCalculation XMGETCOLORCALCULATION -#define XmGetFocusWidget XMGETFOCUSWIDGET -#define XmGetMenuCursor XMGETMENUCURSOR -#define XmGetPixmap XMGETPIXMAP -#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH -#define XmGetTearOffControl XMGETTEAROFFCONTROL -#define XmGetXmDisplay XMGETXMDISPLAY -#define XmImMbLookupString XMIMMBLOOKUPSTRING -#define XmImRegister XMIMREGISTER -#define XmImSetFocusValues XMIMSETFOCUSVALUES -#define XmImSetValues XMIMSETVALUES -#define XmImUnregister XMIMUNREGISTER -#define XmImUnsetFocus XMIMUNSETFOCUS -#define XmInstallImage XMINSTALLIMAGE -#define XmInternAtom XMINTERNATOM -#define XmIsMotifWMRunning XMISMOTIFWMRUNNING -#define XmListAddItem XMLISTADDITEM -#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED -#define XmListAddItems XMLISTADDITEMS -#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED -#define XmListDeleteAllItems XMLISTDELETEALLITEMS -#define XmListDeleteItem XMLISTDELETEITEM -#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS -#define XmListDeletePos XMLISTDELETEPOS -#define XmListDeselectAllItems XMLISTDESELECTALLITEMS -#define XmListDeselectPos XMLISTDESELECTPOS -#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS -#define XmListGetMatchPos XMLISTGETMATCHPOS -#define XmListGetSelectedPos XMLISTGETSELECTEDPOS -#define XmListItemExists XMLISTITEMEXISTS -#define XmListItemPos XMLISTITEMPOS -#define XmListPosSelected XMLISTPOSSELECTED -#define XmListReplaceItems XMLISTREPLACEITEMS -#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS -#define XmListSelectItem XMLISTSELECTITEM -#define XmListSelectPos XMLISTSELECTPOS -#define XmListSetBottomPos XMLISTSETBOTTOMPOS -#define XmListSetItem XMLISTSETITEM -#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS -#define XmListSetPos XMLISTSETPOS -#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS -#define XmMenuPosition XMMENUPOSITION -#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD -#define XmOptionButtonGadget XMOPTIONBUTTONGADGET -#define XmOptionLabelGadget XMOPTIONLABELGADGET -#define XmProcessTraversal XMPROCESSTRAVERSAL -#define XmQmotif XMQMOTIF -#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK -#define XmRemoveProtocols XMREMOVEPROTOCOLS -#define XmRemoveTabGroup XMREMOVETABGROUP -#define XmRepTypeGetId XMREPTYPEGETID -#define XmRepTypeGetRecord XMREPTYPEGETRECORD -#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON -#define XmRepTypeRegister XMREPTYPEREGISTER -#define XmRepTypeValidValue XMREPTYPEVALIDVALUE -#define XmScrollBarGetValues XMSCROLLBARGETVALUES -#define XmScrollBarSetValues XMSCROLLBARSETVALUES -#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS -#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD -#define XmSetColorCalculation XMSETCOLORCALCULATION -#define XmStringByteCompare XMSTRINGBYTECOMPARE -#define XmStringCompare XMSTRINGCOMPARE -#define XmStringConcat XMSTRINGCONCAT -#define XmStringCopy XMSTRINGCOPY -#define XmStringCreate XMSTRINGCREATE -#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED -#define XmStringCreateLtoR XMSTRINGCREATELTOR -#define XmStringCreateSimple XMSTRINGCREATESIMPLE -#define XmStringDraw XMSTRINGDRAW -#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE -#define XmStringExtent XMSTRINGEXTENT -#define XmStringFree XMSTRINGFREE -#define XmStringFreeContext XMSTRINGFREECONTEXT -#define XmStringGetLtoR XMSTRINGGETLTOR -#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT -#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT -#define XmStringInitContext XMSTRINGINITCONTEXT -#define XmStringLength XMSTRINGLENGTH -#define XmStringLtoRCreate XMSTRINGLTORCREATE -#define XmStringNConcat XMSTRINGNCONCAT -#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE -#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE -#define XmStringWidth XMSTRINGWIDTH -#define XmTextClearSelection XMTEXTCLEARSELECTION -#define XmTextCopy XMTEXTCOPY -#define XmTextCut XMTEXTCUT -#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION -#define XmTextFieldCopy XMTEXTFIELDCOPY -#define XmTextFieldCut XMTEXTFIELDCUT -#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE -#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION -#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION -#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH -#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION -#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION -#define XmTextFieldGetString XMTEXTFIELDGETSTRING -#define XmTextFieldInsert XMTEXTFIELDINSERT -#define XmTextFieldPaste XMTEXTFIELDPASTE -#define XmTextFieldRemove XMTEXTFIELDREMOVE -#define XmTextFieldReplace XMTEXTFIELDREPLACE -#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE -#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT -#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION -#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH -#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION -#define XmTextFieldSetString XMTEXTFIELDSETSTRING -#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION -#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION -#define XmTextGetEditable XMTEXTGETEDITABLE -#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION -#define XmTextGetLastPosition XMTEXTGETLASTPOSITION -#define XmTextGetMaxLength XMTEXTGETMAXLENGTH -#define XmTextGetSelection XMTEXTGETSELECTION -#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION -#define XmTextGetString XMTEXTGETSTRING -#define XmTextInsert XMTEXTINSERT -#define XmTextPaste XMTEXTPASTE -#define XmTextPosToXY XMTEXTPOSTOXY -#define XmTextRemove XMTEXTREMOVE -#define XmTextReplace XMTEXTREPLACE -#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION -#define XmTextSetEditable XMTEXTSETEDITABLE -#define XmTextSetHighlight XMTEXTSETHIGHLIGHT -#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION -#define XmTextSetSelection XMTEXTSETSELECTION -#define XmTextSetString XMTEXTSETSTRING -#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER -#define XmTextShowPosition XMTEXTSHOWPOSITION -#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE -#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE -#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE -#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE -#define XmUninstallImage XMUNINSTALLIMAGE -#define XmUpdateDisplay XMUPDATEDISPLAY -#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX -#define XmbDrawString XMBDRAWSTRING -#define XmbLookupString XMBLOOKUPSTRING -#define XmbResetIC XMBRESETIC -#define XmbSetWMProperties XMBSETWMPROPERTIES -#define XmbTextEscapement XMBTEXTESCAPEMENT -#define XmbTextExtents XMBTEXTEXTENTS -#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY -#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST -#define XmbufCreateBuffers XMBUFCREATEBUFFERS -#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS -#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS -#define XmbufQueryExtension XMBUFQUERYEXTENSION -#define Xmemory_free XMEMORY_FREE -#define Xmemory_malloc XMEMORY_MALLOC -#define XmuClientWindow XMUCLIENTWINDOW -#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION -#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP -#define XmuInternAtom XMUINTERNATOM -#define XmuInternStrings XMUINTERNSTRINGS -#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP -#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE -#define XrmCombineDatabase XRMCOMBINEDATABASE -#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE -#define XrmDestroyDatabase XRMDESTROYDATABASE -#define XrmGetDatabase XRMGETDATABASE -#define XrmGetFileDatabase XRMGETFILEDATABASE -#define XrmGetResource XRMGETRESOURCE -#define XrmGetStringDatabase XRMGETSTRINGDATABASE -#define XrmInitialize XRMINITIALIZE -#define XrmMergeDatabases XRMMERGEDATABASES -#define XrmParseCommand XRMPARSECOMMAND -#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK -#define XrmPutFileDatabase XRMPUTFILEDATABASE -#define XrmPutLineResource XRMPUTLINERESOURCE -#define XrmPutStringResource XRMPUTSTRINGRESOURCE -#define XrmQGetResource XRMQGETRESOURCE -#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE -#define XrmQuarkToString XRMQUARKTOSTRING -#define XrmSetDatabase XRMSETDATABASE -#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST -#define XrmStringToQuark XRMSTRINGTOQUARK -#define XtAddCallback XTADDCALLBACK -#define XtAddCallbacks XTADDCALLBACKS -#define XtAddConverter XTADDCONVERTER -#define XtAddEventHandler XTADDEVENTHANDLER -#define XtAddExposureToRegion XTADDEXPOSURETOREGION -#define XtAddGrab XTADDGRAB -#define XtAddRawEventHandler XTADDRAWEVENTHANDLER -#define XtAllocateGC XTALLOCATEGC -#define XtAppAddActions XTAPPADDACTIONS -#define XtAppAddInput XTAPPADDINPUT -#define XtAppAddTimeOut XTAPPADDTIMEOUT -#define XtAppAddWorkProc XTAPPADDWORKPROC -#define XtAppCreateShell XTAPPCREATESHELL -#define XtAppError XTAPPERROR -#define XtAppErrorMsg XTAPPERRORMSG -#define XtAppInitialize XTAPPINITIALIZE -#define XtAppMainLoop XTAPPMAINLOOP -#define XtAppNextEvent XTAPPNEXTEVENT -#define XtAppPeekEvent XTAPPPEEKEVENT -#define XtAppPending XTAPPPENDING -#define XtAppProcessEvent XTAPPPROCESSEVENT -#define XtAppSetErrorHandler XTAPPSETERRORHANDLER -#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES -#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER -#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER -#define XtAppWarningMsg XTAPPWARNINGMSG -#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER -#define XtAppWarning XTAPPWARNING -#define XtAugmentTranslations XTAUGMENTTRANSLATIONS -#define XtCallActionProc XTCALLACTIONPROC -#define XtCallCallbackList XTCALLCALLBACKLIST -#define XtCallCallbacks XTCALLCALLBACKS -#define XtCallConverter XTCALLCONVERTER -#define XtCalloc XTCALLOC -#ifndef NOXTDISPLAY -#define XtClass XTCLASS -#endif -#define XtCloseDisplay XTCLOSEDISPLAY -#define XtConfigureWidget XTCONFIGUREWIDGET -#define XtConvert XTCONVERT -#define XtConvertAndStore XTCONVERTANDSTORE -#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT -#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET -#define XtCreatePopupShell XTCREATEPOPUPSHELL -#define XtCreateWidget XTCREATEWIDGET -#define XtCreateWindow XTCREATEWINDOW -#define XtCvtStringToFont XTCVTSTRINGTOFONT -#define XtDatabase XTDATABASE -#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT -#define XtDestroyWidget XTDESTROYWIDGET -#define XtDisownSelection XTDISOWNSELECTION -#define XtDispatchEvent XTDISPATCHEVENT -#ifndef NOXTDISPLAY -#define XtDisplay XTDISPLAY -#endif -#define XtDisplayOfObject XTDISPLAYOFOBJECT -#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING -#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT -#define XtError XTERROR -#define XtErrorMsg XTERRORMSG -#define XtFree XTFREE -#define XtGetActionKeysym XTGETACTIONKEYSYM -#define XtGetActionList XTGETACTIONLIST -#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS -#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES -#define XtGetClassExtension XTGETCLASSEXTENSION -#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST -#define XtGetGC XTGETGC -#define XtGetMultiClickTime XTGETMULTICLICKTIME -#define XtGetResourceList XTGETRESOURCELIST -#define XtGetSelectionValue XTGETSELECTIONVALUE -#define XtGetSelectionValues XTGETSELECTIONVALUES -#define XtGetSubresources XTGETSUBRESOURCES -#define XtGetValues XTGETVALUES -#define XtGrabButton XTGRABBUTTON -#define XtGrabKeyboard XTGRABKEYBOARD -#define XtGrabPointer XTGRABPOINTER -#define XtHasCallbacks XTHASCALLBACKS -#define XtInitialize XTINITIALIZE -#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS -#define XtInsertEventHandler XTINSERTEVENTHANDLER -#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER -#define XtInstallAccelerators XTINSTALLACCELERATORS -#define XtIsManaged XTISMANAGED -#define XtIsObject XTISOBJECT -#ifndef NOXTDISPLAY -#define XtIsRealized XTISREALIZED -#endif -#define XtIsSensitive XTISSENSITIVE -#define XtIsSubclass XTISSUBCLASS -#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED -#define XtMainLoop XTMAINLOOP -#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST -#define XtMakeResizeRequest XTMAKERESIZEREQUEST -#define XtMalloc XTMALLOC -#define XtManageChild XTMANAGECHILD -#define XtManageChildren XTMANAGECHILDREN -#define XtMergeArgLists XTMERGEARGLISTS -#define XtMoveWidget XTMOVEWIDGET -#define XtName XTNAME -#define XtNameToWidget XTNAMETOWIDGET -#define XtOpenApplication XTOPENAPPLICATION -#define XtOpenDisplay XTOPENDISPLAY -#define XtOverrideTranslations XTOVERRIDETRANSLATIONS -#define XtOwnSelection XTOWNSELECTION -#ifndef NOXTDISPLAY -#define XtParent XTPARENT -#endif -#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE -#define XtParseTranslationTable XTPARSETRANSLATIONTABLE -#define XtPopdown XTPOPDOWN -#define XtPopup XTPOPUP -#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED -#define XtQueryGeometry XTQUERYGEOMETRY -#define XtRealizeWidget XTREALIZEWIDGET -#define XtRealloc XTREALLOC -#define XtRegisterDrawable _XTREGISTERWINDOW -#define XtRegisterGrabAction XTREGISTERGRABACTION -#define XtReleaseGC XTRELEASEGC -#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS -#define XtRemoveCallback XTREMOVECALLBACK -#define XtRemoveEventHandler XTREMOVEEVENTHANDLER -#define XtRemoveGrab XTREMOVEGRAB -#define XtRemoveInput XTREMOVEINPUT -#define XtRemoveTimeOut XTREMOVETIMEOUT -#define XtRemoveWorkProc XTREMOVEWORKPROC -#define XtResizeWidget XTRESIZEWIDGET -#define XtResolvePathname XTRESOLVEPATHNAME -#ifndef NOXTDISPLAY -#define XtScreen XTSCREEN -#endif -#define XtScreenDatabase XTSCREENDATABASE -#define XtScreenOfObject XTSCREENOFOBJECT -#define XtSessionReturnToken XTSESSIONRETURNTOKEN -#define XtSetErrorHandler XTSETERRORHANDLER -#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS -#define XtSetLanguageProc XTSETLANGUAGEPROC -#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED -#define XtSetSensitive XTSETSENSITIVE -#define XtSetTypeConverter XTSETTYPECONVERTER -#define XtSetValues XTSETVALUES -#define XtShellStrings XTSHELLSTRINGS -#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING -#define XtStrings XTSTRINGS -#define XtToolkitInitialize XTTOOLKITINITIALIZE -#define XtTranslateCoords XTTRANSLATECOORDS -#define XtTranslateKeycode XTTRANSLATEKEYCODE -#define XtUngrabButton XTUNGRABBUTTON -#define XtUngrabKeyboard XTUNGRABKEYBOARD -#define XtUngrabPointer XTUNGRABPOINTER -#define XtUnmanageChild XTUNMANAGECHILD -#define XtUnmanageChildren XTUNMANAGECHILDREN -#define XtUnrealizeWidget XTUNREALIZEWIDGET -#define XtUnregisterDrawable _XTUNREGISTERWINDOW -#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET -#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL -#define XtVaCreateWidget XTVACREATEWIDGET -#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES -#define XtVaGetValues XTVAGETVALUES -#define XtVaSetValues XTVASETVALUES -#define XtWarning XTWARNING -#define XtWarningMsg XTWARNINGMSG -#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT -#ifndef NOXTDISPLAY -#define XtWindow XTWINDOW -#endif -#define XtWindowOfObject XTWINDOWOFOBJECT -#define XtWindowToWidget XTWINDOWTOWIDGET -#define XwcDrawImageString XWCDRAWIMAGESTRING -#define XwcDrawString XWCDRAWSTRING -#define XwcFreeStringList XWCFREESTRINGLIST -#define XwcTextEscapement XWCTEXTESCAPEMENT -#define XwcTextExtents XWCTEXTEXTENTS -#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY -#define XwcLookupString XWCLOOKUPSTRING -#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST -#define _XAllocTemp _XALLOCTEMP -#define _XDeqAsyncHandler _XDEQASYNCHANDLER -#define _XEatData _XEATDATA -#define _XFlush _XFLUSH -#define _XFreeTemp _XFREETEMP -#define _XGetAsyncReply _XGETASYNCREPLY -#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS -#define _XRead _XREAD -#define _XReadPad _XREADPAD -#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE -#define _XReply _XREPLY -#define _XSend _XSEND -#define _XUnregisterFilter _XUNREGISTERFILTER -#define _XVIDtoVisual _XVIDTOVISUAL -#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT -#define _XmClearBorder _XMCLEARBORDER -#define _XmConfigureObject _XMCONFIGUREOBJECT -#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK -#define _XmDrawArrow _XMDRAWARROW -#define _XmDrawShadows _XMDRAWSHADOWS -#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT -#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS -#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS -#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR -#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST -#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON -#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA -#define _XmGrabKeyboard _XMGRABKEYBOARD -#define _XmGrabPointer _XMGRABPOINTER -#define _XmInheritClass _XMINHERITCLASS -#define _XmInputForGadget _XMINPUTFORGADGET -#define _XmInputInGadget _XMINPUTINGADGET -#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST -#define _XmMenuPopDown _XMMENUPOPDOWN -#define _XmMoveObject _XMMOVEOBJECT -#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED -#define _XmOSBuildFileList _XMOSBUILDFILELIST -#define _XmOSFileCompare _XMOSFILECOMPARE -#define _XmOSFindPatternPart _XMOSFINDPATTERNPART -#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC -#define _XmPostPopupMenu _XMPOSTPOPUPMENU -#define _XmPrimitiveEnter _XMPRIMITIVEENTER -#define _XmPrimitiveLeave _XMPRIMITIVELEAVE -#define _XmRedisplayGadgets _XMREDISPLAYGADGETS -#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE -#define _XmStringDraw _XMSTRINGDRAW -#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT -#define _XmStrings _XMSTRINGS -#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS -#define _XmToVerticalPixels _XMTOVERTICALPIXELS -#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT -#define _Xm_fastPtr _XM_FASTPTR -#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG -#define _XtCopyFromArg _XTCOPYFROMARG -#define _XtCountVaList _XTCOUNTVALIST -#define _XtInherit _XTINHERIT -#define _XtInheritTranslations _XTINHERITTRANSLATIONS -#define _XtIsSubclassOf _XTISSUBCLASSOF -#define _XtVaToArgList _XTVATOARGLIST -#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS -#define cli$dcl_parse CLI$DCL_PARSE -#define cli$get_value CLI$GET_VALUE -#define cli$present CLI$PRESENT -#define compositeClassRec COMPOSITECLASSREC -#define compositeWidgetClass COMPOSITEWIDGETCLASS -#define constraintClassRec CONSTRAINTCLASSREC -#define constraintWidgetClass CONSTRAINTWIDGETCLASS -#define coreWidgetClass COREWIDGETCLASS -#define exe$getspi EXE$GETSPI -#define lbr$close LBR$CLOSE -#define lbr$get_header LBR$GET_HEADER -#define lbr$get_index LBR$GET_INDEX -#define lbr$get_record LBR$GET_RECORD -#define lbr$ini_control LBR$INI_CONTROL -#define lbr$lookup_key LBR$LOOKUP_KEY -#define lbr$open LBR$OPEN -#define lbr$output_help LBR$OUTPUT_HELP -#define lib$add_times LIB$ADD_TIMES -#define lib$addx LIB$ADDX -#define lib$create_dir LIB$CREATE_DIR -#define lib$create_vm_zone LIB$CREATE_VM_ZONE -#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME -#define lib$cvt_htb LIB$CVT_HTB -#define lib$cvt_vectim LIB$CVT_VECTIM -#define lib$day LIB$DAY -#define lib$day_of_week LIB$DAY_OF_WEEK -#define lib$delete_symbol LIB$DELETE_SYMBOL -#define lib$delete_vm_zone LIB$DELETE_VM_ZONE -#define lib$disable_ctrl LIB$DISABLE_CTRL -#define lib$ediv LIB$EDIV -#define lib$emul LIB$EMUL -#define lib$enable_ctrl LIB$ENABLE_CTRL -#define lib$find_vm_zone LIB$FIND_VM_ZONE -#define lib$format_date_time LIB$FORMAT_DATE_TIME -#define lib$free_timer LIB$FREE_TIMER -#define lib$free_vm LIB$FREE_VM -#define lib$get_ef LIB$GET_EF -#define lib$get_foreign LIB$GET_FOREIGN -#define lib$get_input LIB$GET_INPUT -#define lib$get_users_language LIB$GET_USERS_LANGUAGE -#define lib$get_vm LIB$GET_VM -#define lib$get_symbol LIB$GET_SYMBOL -#define lib$getdvi LIB$GETDVI -#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT -#define lib$init_timer LIB$INIT_TIMER -#define lib$find_file LIB$FIND_FILE -#define lib$find_file_end LIB$FIND_FILE_END -#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL -#define lib$mult_delta_time LIB$MULT_DELTA_TIME -#define lib$put_output LIB$PUT_OUTPUT -#define lib$rename_file LIB$RENAME_FILE -#define lib$reset_vm_zone LIB$RESET_VM_ZONE -#define lib$set_symbol LIB$SET_SYMBOL -#define lib$sfree1_dd LIB$SFREE1_DD -#define lib$show_vm LIB$SHOW_VM -#define lib$show_vm_zone LIB$SHOW_VM_ZONE -#define lib$spawn LIB$SPAWN -#define lib$stat_timer LIB$STAT_TIMER -#define lib$subx LIB$SUBX -#define lib$sub_times LIB$SUB_TIMES -#define lib$wait LIB$WAIT -#define mail$send_add_address MAIL$SEND_ADD_ADDRESS -#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE -#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART -#define mail$send_begin MAIL$SEND_BEGIN -#define mail$send_end MAIL$SEND_END -#define mail$send_message MAIL$SEND_MESSAGE -#define ncs$convert NCS$CONVERT -#define ncs$get_cf NCS$GET_CF -#define objectClass OBJECTCLASS -#define objectClassRec OBJECTCLASSREC -#define overrideShellClassRec OVERRIDESHELLCLASSREC -#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS -#define pthread_attr_create PTHREAD_ATTR_CREATE -#define pthread_attr_delete PTHREAD_ATTR_DELETE -#define pthread_attr_destroy PTHREAD_ATTR_DESTROY -#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP -#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP -#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED -#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO -#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED -#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM -#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY -#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE -#define pthread_attr_init PTHREAD_ATTR_INIT -#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP -#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE -#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP -#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED -#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO -#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED -#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM -#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY -#ifndef pthread_attr_setscope -# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE -#endif -#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE -#define pthread_cancel PTHREAD_CANCEL -#define pthread_cancel_e PTHREAD_CANCEL_E -#define pthread_cond_broadcast PTHREAD_COND_BROADCAST -#define pthread_cond_destroy PTHREAD_COND_DESTROY -#define pthread_cond_init PTHREAD_COND_INIT -#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP -#define pthread_cond_signal PTHREAD_COND_SIGNAL -#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP -#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT -#define pthread_cond_wait PTHREAD_COND_WAIT -#define pthread_condattr_create PTHREAD_CONDATTR_CREATE -#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE -#define pthread_condattr_init PTHREAD_CONDATTR_INIT -#define pthread_create PTHREAD_CREATE -#define pthread_delay_np PTHREAD_DELAY_NP -#define pthread_detach PTHREAD_DETACH -#define pthread_equal PTHREAD_EQUAL -#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP -#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP -#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP -#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP -#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP -#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP -#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP -#define pthread_exit PTHREAD_EXIT -#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP -#define pthread_getprio PTHREAD_GETPRIO -#define pthread_getschedparam PTHREAD_GETSCHEDPARAM -#define pthread_getscheduler PTHREAD_GETSCHEDULER -#define pthread_getspecific PTHREAD_GETSPECIFIC -#define pthread_getunique_np PTHREAD_GETUNIQUE_NP -#define pthread_join PTHREAD_JOIN -#define pthread_join32 PTHREAD_JOIN32 -#define pthread_key_create PTHREAD_KEY_CREATE -#define pthread_key_delete PTHREAD_KEY_DELETE -#define pthread_keycreate PTHREAD_KEYCREATE -#define pthread_kill PTHREAD_KILL -#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP -#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY -#define pthread_mutex_init PTHREAD_MUTEX_INIT -#define pthread_mutex_lock PTHREAD_MUTEX_LOCK -#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK -#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK -#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE -#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE -#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY -#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP -#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT -#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP -#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP -#define pthread_once PTHREAD_ONCE -#define pthread_resume_np PTHREAD_RESUME_NP -#define pthread_self PTHREAD_SELF -#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL -#define pthread_setcancel PTHREAD_SETCANCEL -#define pthread_setcancelstate PTHREAD_SETCANCELSTATE -#define pthread_setcanceltype PTHREAD_SETCANCELTYPE -#define pthread_setprio PTHREAD_SETPRIO -#define pthread_setschedparam PTHREAD_SETSCHEDPARAM -#define pthread_setscheduler PTHREAD_SETSCHEDULER -#define pthread_setspecific PTHREAD_SETSPECIFIC -#define pthread_suspend_np PTHREAD_SUSPEND_NP -#define pthread_testcancel PTHREAD_TESTCANCEL -#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP -#define pthread_yield PTHREAD_YIELD -#define pthread_yield_np PTHREAD_YIELD_NP -#define rectObjClass RECTOBJCLASS -#define rectObjClassRec RECTOBJCLASSREC -#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS -#define shellWidgetClass SHELLWIDGETCLASS -#define shmat SHMAT -#define shmctl SHMCTL -#define shmdt SHMDT -#define shmget SHMGET -#define smg$create_key_table SMG$CREATE_KEY_TABLE -#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD -#define smg$read_composed_line SMG$READ_COMPOSED_LINE -#define sys$add_ident SYS$ADD_IDENT -#define sys$asctoid SYS$ASCTOID -#define sys$assign SYS$ASSIGN -#define sys$bintim SYS$BINTIM -#define sys$cancel SYS$CANCEL -#define sys$cantim SYS$CANTIM -#define sys$check_access SYS$CHECK_ACCESS -#define sys$close SYS$CLOSE -#define sys$connect SYS$CONNECT -#define sys$create SYS$CREATE -#define sys$create_user_profile SYS$CREATE_USER_PROFILE -#define sys$crembx SYS$CREMBX -#define sys$creprc SYS$CREPRC -#define sys$crmpsc SYS$CRMPSC -#define sys$dassgn SYS$DASSGN -#define sys$dclast SYS$DCLAST -#define sys$dclexh SYS$DCLEXH -#define sys$delprc SYS$DELPRC -#define sys$deq SYS$DEQ -#define sys$dgblsc SYS$DGBLSC -#define sys$display SYS$DISPLAY -#define sys$enq SYS$ENQ -#define sys$enqw SYS$ENQW -#define sys$erase SYS$ERASE -#define sys$fao SYS$FAO -#define sys$faol SYS$FAOL -#define sys$find_held SYS$FIND_HELD -#define sys$finish_rdb SYS$FINISH_RDB -#define sys$flush SYS$FLUSH -#define sys$forcex SYS$FORCEX -#define sys$get SYS$GET -#define sys$get_security SYS$GET_SECURITY -#define sys$getdviw SYS$GETDVIW -#define sys$getjpi SYS$GETJPI -#define sys$getjpiw SYS$GETJPIW -#define sys$getlkiw SYS$GETLKIW -#define sys$getmsg SYS$GETMSG -#define sys$getsyi SYS$GETSYI -#define sys$getsyiw SYS$GETSYIW -#define sys$gettim SYS$GETTIM -#define sys$getuai SYS$GETUAI -#define sys$grantid SYS$GRANTID -#define sys$hash_password SYS$HASH_PASSWORD -#define sys$hiber SYS$HIBER -#define sys$mgblsc SYS$MGBLSC -#define sys$numtim SYS$NUMTIM -#define sys$open SYS$OPEN -#define sys$parse SYS$PARSE -#define sys$parse_acl SYS$PARSE_ACL -#define sys$parse_acl SYS$PARSE_ACL -#define sys$persona_assume SYS$PERSONA_ASSUME -#define sys$persona_create SYS$PERSONA_CREATE -#define sys$persona_delete SYS$PERSONA_DELETE -#define sys$process_scan SYS$PROCESS_SCAN -#define sys$put SYS$PUT -#define sys$qio SYS$QIO -#define sys$qiow SYS$QIOW -#define sys$read SYS$READ -#define sys$resched SYS$RESCHED -#define sys$rewind SYS$REWIND -#define sys$search SYS$SEARCH -#define sys$set_security SYS$SET_SECURITY -#define sys$setast SYS$SETAST -#define sys$setef SYS$SETEF -#define sys$setimr SYS$SETIMR -#define sys$setpri SYS$SETPRI -#define sys$setprn SYS$SETPRN -#define sys$setprv SYS$SETPRV -#define sys$setswm SYS$SETSWM -#define sys$setuai SYS$SETUAI -#define sys$sndopr SYS$SNDOPR -#define sys$synch SYS$SYNCH -#define sys$trnlnm SYS$TRNLNM -#define sys$update SYS$UPDATE -#define sys$wake SYS$WAKE -#define sys$write SYS$WRITE -#define topLevelShellClassRec TOPLEVELSHELLCLASSREC -#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS -#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS -#define vendorShellClassRec VENDORSHELLCLASSREC -#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS -#define widgetClass WIDGETCLASS -#define widgetClassRec WIDGETCLASSREC -#define wmShellClassRec WMSHELLCLASSREC -#define wmShellWidgetClass WMSHELLWIDGETCLASS -#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK -#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH -#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS -#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS -#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS -#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC -#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS -#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS -#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS -#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS -#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS -#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS -#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS -#define xmFormWidgetClass XMFORMWIDGETCLASS -#define xmFrameWidgetClass XMFRAMEWIDGETCLASS -#define xmGadgetClass XMGADGETCLASS -#define xmLabelGadgetClass XMLABELGADGETCLASS -#define xmLabelWidgetClass XMLABELWIDGETCLASS -#define xmListWidgetClass XMLISTWIDGETCLASS -#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS -#define xmManagerClassRec XMMANAGERCLASSREC -#define xmManagerWidgetClass XMMANAGERWIDGETCLASS -#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS -#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS -#define xmPrimitiveClassRec XMPRIMITIVECLASSREC -#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS -#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC -#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS -#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS -#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS -#define xmSashWidgetClass XMSASHWIDGETCLASS -#define xmScaleWidgetClass XMSCALEWIDGETCLASS -#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS -#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC -#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS -#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS -#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS -#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS -#define xmTextWidgetClass XMTEXTWIDGETCLASS -#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS -#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS - -#if (__VMS_VER < 80200000) -# define SetReqLen(req,n,badlen) \ - if ((req->length + n) > (unsigned)65535) { \ - n = badlen; \ - req->length += n; \ - } else \ - req->length += n -#endif - -#ifdef __cplusplus -extern "C" { -#endif -extern void XtFree(char*); -#ifdef __cplusplus -} -#endif - -#endif +/*************************************************************************** + * * + * Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) * + * * + * Last revision : 7 October 2005 * + * * + * Repair definitions of Runtime library functions when compiling with * + * /name=(as_is) on OpenVMS * + * * + ***************************************************************************/ + +#ifndef VMS_X_FIX +#define VMS_X_FIX + +#define decw$_select DECW$_SELECT +#define DtSaverGetWindows DTSAVERGETWINDOWS +#define MrmFetchWidget MRMFETCHWIDGET +#define MrmInitialize MRMINITIALIZE +#define MrmOpenHierarchy MRMOPENHIERARCHY +#define MrmRegisterNames MRMREGISTERNAMES +#define XAddExtension XADDEXTENSION +#define XAddHosts XADDHOSTS +#define XAllocClassHint XALLOCCLASSHINT +#define XAllocColor XALLOCCOLOR +#define XAllocColorCells XALLOCCOLORCELLS +#define XAllocIconSize XALLOCICONSIZE +#define XAllocNamedColor XALLOCNAMEDCOLOR +#define XAllocSizeHints XALLOCSIZEHINTS +#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP +#define XAllocWMHints XALLOCWMHINTS +#define XAllowEvents XALLOWEVENTS +#define XAutoRepeatOff XAUTOREPEATOFF +#define XAutoRepeatOn XAUTOREPEATON +#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET +#define XBell XBELL +#define XBitmapPad XBITMAPPAD +#define XBlackPixel XBLACKPIXEL +#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN +#define XCellsOfScreen XCELLSOFSCREEN +#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB +#define XChangeGC XCHANGEGC +#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL +#define XChangePointerControl XCHANGEPOINTERCONTROL +#define XChangeProperty XCHANGEPROPERTY +#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES +#define XCheckIfEvent XCHECKIFEVENT +#define XCheckMaskEvent XCHECKMASKEVENT +#define XCheckTypedEvent XCHECKTYPEDEVENT +#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT +#define XCheckWindowEvent XCHECKWINDOWEVENT +#define XClearArea XCLEARAREA +#define XClearWindow XCLEARWINDOW +#define XClipBox XCLIPBOX +#define XCloseDisplay XCLOSEDISPLAY +#define XCloseIM XCLOSEIM +#define XConfigureWindow XCONFIGUREWINDOW +#define XConvertSelection XCONVERTSELECTION +#define XCopyArea XCOPYAREA +#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE +#define XCopyGC XCOPYGC +#define XCopyPlane XCOPYPLANE +#define XCreateBitmapFromData XCREATEBITMAPFROMDATA +#define XCreateColormap XCREATECOLORMAP +#define XCreateFontCursor XCREATEFONTCURSOR +#define XCreateFontSet XCREATEFONTSET +#define XCreateGC XCREATEGC +#define XCreateGlyphCursor XCREATEGLYPHCURSOR +#define XCreateIC XCREATEIC +#define XCreateImage XCREATEIMAGE +#define XCreatePixmap XCREATEPIXMAP +#define XCreatePixmapCursor XCREATEPIXMAPCURSOR +#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA +#define XCreateRegion XCREATEREGION +#define XCreateSimpleWindow XCREATESIMPLEWINDOW +#define XCreateWindow XCREATEWINDOW +#define XDefaultColormap XDEFAULTCOLORMAP +#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN +#define XDefaultDepth XDEFAULTDEPTH +#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN +#define XDefaultGC XDEFAULTGC +#define XDefaultRootWindow XDEFAULTROOTWINDOW +#define XDefaultScreen XDEFAULTSCREEN +#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY +#define XDefaultVisual XDEFAULTVISUAL +#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN +#define XDefineCursor XDEFINECURSOR +#define XDeleteContext XDELETECONTEXT +#define XDeleteProperty XDELETEPROPERTY +#define XDestroyIC XDESTROYIC +#define XDestroyRegion XDESTROYREGION +#define XDestroySubwindows XDESTROYSUBWINDOWS +#define XDestroyWindow XDESTROYWINDOW +#define XDisableAccessControl XDISABLEACCESSCONTROL +#define XDisplayCells XDISPLAYCELLS +#define XDisplayHeight XDISPLAYHEIGHT +#define XDisplayKeycodes XDISPLAYKEYCODES +#define XDisplayName XDISPLAYNAME +#define XDisplayOfIM XDISPLAYOFIM +#define XDisplayOfScreen XDISPLAYOFSCREEN +#define XDisplayString XDISPLAYSTRING +#define XDisplayWidth XDISPLAYWIDTH +#define XDoesBackingStore XDOESBACKINGSTORE +#define XDrawArc XDRAWARC +#define XDrawArcs XDRAWARCS +#define XDrawImageString XDRAWIMAGESTRING +#define XDrawImageString16 XDRAWIMAGESTRING16 +#define XDrawLine XDRAWLINE +#define XDrawLines XDRAWLINES +#define XDrawPoint XDRAWPOINT +#define XDrawPoints XDRAWPOINTS +#define XDrawRectangle XDRAWRECTANGLE +#define XDrawRectangles XDRAWRECTANGLES +#define XDrawSegments XDRAWSEGMENTS +#define XDrawString XDRAWSTRING +#define XDrawString16 XDRAWSTRING16 +#define XDrawText XDRAWTEXT +#define XDrawText16 XDRAWTEXT16 +#define XESetCloseDisplay XESETCLOSEDISPLAY +#define XEmptyRegion XEMPTYREGION +#define XEnableAccessControl XENABLEACCESSCONTROL +#define XEqualRegion XEQUALREGION +#define XEventsQueued XEVENTSQUEUED +#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE +#define XExtentsOfFontSet XEXTENTSOFFONTSET +#define XFetchBuffer XFETCHBUFFER +#define XFetchBytes XFETCHBYTES +#define XFetchName XFETCHNAME +#define XFillArc XFILLARC +#define XFillArcs XFILLARCS +#define XFillPolygon XFILLPOLYGON +#define XFillRectangle XFILLRECTANGLE +#define XFillRectangles XFILLRECTANGLES +#define XFilterEvent XFILTEREVENT +#define XFindContext XFINDCONTEXT +#define XFlush XFLUSH +#define XFontsOfFontSet XFONTSOFFONTSET +#define XForceScreenSaver XFORCESCREENSAVER +#define XFree XFREE +#define XFreeColormap XFREECOLORMAP +#define XFreeColors XFREECOLORS +#define XFreeCursor XFREECURSOR +#define XFreeDeviceList XFREEDEVICELIST +#define XFreeDeviceState XFREEDEVICESTATE +#define XFreeFont XFREEFONT +#define XFreeFontInfo XFREEFONTINFO +#define XFreeFontNames XFREEFONTNAMES +#define XFreeFontSet XFREEFONTSET +#define XFreeGC XFREEGC +#define XFreeModifiermap XFREEMODIFIERMAP +#define XFreePixmap XFREEPIXMAP +#define XFreeStringList XFREESTRINGLIST +#define XGContextFromGC XGCONTEXTFROMGC +#define XGeometry XGEOMETRY +#define XGetAtomName XGETATOMNAME +#define XGetCommand XGETCOMMAND +#define XGetDefault XGETDEFAULT +#define XGetErrorDatabaseText XGETERRORDATABASETEXT +#define XGetErrorText XGETERRORTEXT +#define XGetExtensionVersion XGETEXTENSIONVERSION +#define XGetFontProperty XGETFONTPROPERTY +#define XGetGCValues XGETGCVALUES +#define XGetGeometry XGETGEOMETRY +#define XGetICValues XGETICVALUES +#define XGetIMValues XGETIMVALUES +#define XGetIconName XGETICONNAME +#define XGetIconSizes XGETICONSIZES +#define XGetImage XGETIMAGE +#define XGetInputFocus XGETINPUTFOCUS +#define XGetKeyboardControl XGETKEYBOARDCONTROL +#define XGetKeyboardMapping XGETKEYBOARDMAPPING +#define XGetModifierMapping XGETMODIFIERMAPPING +#define XGetMotionEvents XGETMOTIONEVENTS +#define XGetNormalHints XGETNORMALHINTS +#define XGetPointerMapping XGETPOINTERMAPPING +#define XGetRGBColormaps XGETRGBCOLORMAPS +#define XGetScreenSaver XGETSCREENSAVER +#define XGetSelectionOwner XGETSELECTIONOWNER +#define XGetStandardColormap XGETSTANDARDCOLORMAP +#define XGetSubImage XGETSUBIMAGE +#define XGetTextProperty XGETTEXTPROPERTY +#define XGetVisualInfo XGETVISUALINFO +#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS +#define XGetWMHints XGETWMHINTS +#define XGetWMIconName XGETWMICONNAME +#define XGetWMName XGETWMNAME +#define XGetWMNormalHints XGETWMNORMALHINTS +#define XGetWindowAttributes XGETWINDOWATTRIBUTES +#define XGetWindowProperty XGETWINDOWPROPERTY +#define XGrabButton XGRABBUTTON +#define XGrabKeyboard XGRABKEYBOARD +#define XGrabPointer XGRABPOINTER +#define XGrabServer XGRABSERVER +#define XHeightMMOfScreen XHEIGHTMMOFSCREEN +#define XHeightOfScreen XHEIGHTOFSCREEN +#define XIconifyWindow XICONIFYWINDOW +#define XIfEvent XIFEVENT +#define XInitExtension XINITEXTENSION +#define XInitImage XINITIMAGE +#define XInstallColormap XINSTALLCOLORMAP +#define XInternAtom XINTERNATOM +#define XInternAtoms XINTERNATOMS +#define XIntersectRegion XINTERSECTREGION +#define XKeycodeToKeysym XKEYCODETOKEYSYM +#define XKeysymToKeycode XKEYSYMTOKEYCODE +#define XKeysymToString XKEYSYMTOSTRING +#define XKillClient XKILLCLIENT +#define XListDepths XLISTDEPTHS +#define XListFonts XLISTFONTS +#define XListFontsWithInfo XLISTFONTSWITHINFO +#define XListHosts XLISTHOSTS +#define XListInputDevices XLISTINPUTDEVICES +#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS +#define XListPixmapFormats XLISTPIXMAPFORMATS +#define XListProperties XLISTPROPERTIES +#define XLoadFont XLOADFONT +#define XLoadQueryFont XLOADQUERYFONT +#define XLookupColor XLOOKUPCOLOR +#define XLookupKeysym XLOOKUPKEYSYM +#define XLookupString XLOOKUPSTRING +#define XLowerWindow XLOWERWINDOW +#define XMapRaised XMAPRAISED +#define XMapSubwindows XMAPSUBWINDOWS +#define XMapWindow XMAPWINDOW +#define XMatchVisualInfo XMATCHVISUALINFO +#define XMaxRequestSize XMAXREQUESTSIZE +#define XMissingExtension XMISSINGEXTENSION +#define XMoveResizeWindow XMOVERESIZEWINDOW +#define XMoveWindow XMOVEWINDOW +#define XNextEvent XNEXTEVENT +#define XNextRequest XNEXTREQUEST +#define XNoOp XNOOP +#define XOffsetRegion XOFFSETREGION +#define XOpenDevice XOPENDEVICE +#define XOpenDisplay XOPENDISPLAY +#define XOpenIM XOPENIM +#define XParseColor XPARSECOLOR +#define XParseGeometry XPARSEGEOMETRY +#define XPeekEvent XPEEKEVENT +#define XPeekIfEvent XPEEKIFEVENT +#define XPending XPENDING +#define XPointInRegion XPOINTINREGION +#define XPolygonRegion XPOLYGONREGION +#define XPutBackEvent XPUTBACKEVENT +#define XPutImage XPUTIMAGE +#define XQLength XQLENGTH +#define XQueryBestCursor XQUERYBESTCURSOR +#define XQueryBestStipple XQUERYBESTSTIPPLE +#define XQueryColor XQUERYCOLOR +#define XQueryColors XQUERYCOLORS +#define XQueryDeviceState XQUERYDEVICESTATE +#define XQueryExtension XQUERYEXTENSION +#define XQueryFont XQUERYFONT +#define XQueryKeymap XQUERYKEYMAP +#define XQueryPointer XQUERYPOINTER +#define XQueryTree XQUERYTREE +#define XRaiseWindow XRAISEWINDOW +#define XReadBitmapFile XREADBITMAPFILE +#define XRecolorCursor XRECOLORCURSOR +#define XReconfigureWMWindow XRECONFIGUREWMWINDOW +#define XRectInRegion XRECTINREGION +#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING +#define XRemoveHosts XREMOVEHOSTS +#define XReparentWindow XREPARENTWINDOW +#define XResetScreenSaver XRESETSCREENSAVER +#define XResizeWindow XRESIZEWINDOW +#define XResourceManagerString XRESOURCEMANAGERSTRING +#define XRestackWindows XRESTACKWINDOWS +#define XRotateBuffers XROTATEBUFFERS +#define XRootWindow XROOTWINDOW +#define XRootWindowOfScreen XROOTWINDOWOFSCREEN +#define XSaveContext XSAVECONTEXT +#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN +#define XScreenOfDisplay XSCREENOFDISPLAY +#define XSelectAsyncEvent XSELECTASYNCEVENT +#define XSelectAsyncInput XSELECTASYNCINPUT +#define XSelectExtensionEvent XSELECTEXTENSIONEVENT +#define XSelectInput XSELECTINPUT +#define XSendEvent XSENDEVENT +#define XServerVendor XSERVERVENDOR +#define XSetArcMode XSETARCMODE +#define XSetBackground XSETBACKGROUND +#define XSetClassHint XSETCLASSHINT +#define XSetClipMask XSETCLIPMASK +#define XSetClipOrigin XSETCLIPORIGIN +#define XSetClipRectangles XSETCLIPRECTANGLES +#define XSetCloseDownMode XSETCLOSEDOWNMODE +#define XSetCommand XSETCOMMAND +#define XSetDashes XSETDASHES +#define XSetErrorHandler XSETERRORHANDLER +#define XSetFillRule XSETFILLRULE +#define XSetFillStyle XSETFILLSTYLE +#define XSetFont XSETFONT +#define XSetForeground XSETFOREGROUND +#define XSetFunction XSETFUNCTION +#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES +#define XSetICFocus XSETICFOCUS +#define XSetICValues XSETICVALUES +#define XSetIOErrorHandler XSETIOERRORHANDLER +#define XSetIconName XSETICONNAME +#define XSetInputFocus XSETINPUTFOCUS +#define XSetLineAttributes XSETLINEATTRIBUTES +#define XSetLocaleModifiers XSETLOCALEMODIFIERS +#define XSetNormalHints XSETNORMALHINTS +#define XSetPlaneMask XSETPLANEMASK +#define XSetRegion XSETREGION +#define XSetRGBColormaps XSETRGBCOLORMAPS +#define XSetScreenSaver XSETSCREENSAVER +#define XSetSelectionOwner XSETSELECTIONOWNER +#define XSetStandardProperties XSETSTANDARDPROPERTIES +#define XSetState XSETSTATE +#define XSetStipple XSETSTIPPLE +#define XSetSubwindowMode XSETSUBWINDOWMODE +#define XSetTSOrigin XSETTSORIGIN +#define XSetTextProperty XSETTEXTPROPERTY +#define XSetTile XSETTILE +#define XSetTransientForHint XSETTRANSIENTFORHINT +#define XSetWMClientMachine XSETWMCLIENTMACHINE +#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS +#define XSetWMHints XSETWMHINTS +#define XSetWMIconName XSETWMICONNAME +#define XSetWMName XSETWMNAME +#define XSetWMNormalHints XSETWMNORMALHINTS +#define XSetWMProperties XSETWMPROPERTIES +#define XSetWMProtocols XSETWMPROTOCOLS +#define XSetWMSizeHints XSETWMSIZEHINTS +#define XSetWindowBackground XSETWINDOWBACKGROUND +#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP +#define XSetWindowBorder XSETWINDOWBORDER +#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP +#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH +#define XSetWindowColormap XSETWINDOWCOLORMAP +#define XShapeCombineMask XSHAPECOMBINEMASK +#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES +#define XShapeGetRectangles XSHAPEGETRECTANGLES +#define XShapeQueryExtension XSHAPEQUERYEXTENSION +#define XShmAttach XSHMATTACH +#define XShmCreateImage XSHMCREATEIMAGE +#define XShmCreatePixmap XSHMCREATEPIXMAP +#define XShmDetach XSHMDETACH +#define XShmGetEventBase XSHMGETEVENTBASE +#define XShmPutImage XSHMPUTIMAGE +#define XShmQueryExtension XSHMQUERYEXTENSION +#define XShmQueryVersion XSHMQUERYVERSION +#define XShrinkRegion XSHRINKREGION +#define XStoreBuffer XSTOREBUFFER +#define XStoreBytes XSTOREBYTES +#define XStoreColor XSTORECOLOR +#define XStoreColors XSTORECOLORS +#define XStoreName XSTORENAME +#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY +#define XStringToKeysym XSTRINGTOKEYSYM +#define XSubtractRegion XSUBTRACTREGION +#define XSupportsLocale XSUPPORTSLOCALE +#define XSync XSYNC +#define XSynchronize XSYNCHRONIZE +#define XTextExtents XTEXTEXTENTS +#define XTextExtents16 XTEXTEXTENTS16 +#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST +#define XTextWidth XTEXTWIDTH +#define XTextWidth16 XTEXTWIDTH16 +#define XTranslateCoordinates XTRANSLATECOORDINATES +#define XUndefineCursor XUNDEFINECURSOR +#define XUngrabButton XUNGRABBUTTON +#define XUngrabKeyboard XUNGRABKEYBOARD +#define XUngrabPointer XUNGRABPOINTER +#define XUngrabServer XUNGRABSERVER +#define XUninstallColormap XUNINSTALLCOLORMAP +#define XUnionRectWithRegion XUNIONRECTWITHREGION +#define XUnionRegion XUNIONREGION +#define XUniqueContext XUNIQUECONTEXT +#define XUnmapWindow XUNMAPWINDOW +#define XUnsetICFocus XUNSETICFOCUS +#define XVaCreateNestedList XVACREATENESTEDLIST +#define XVisualIDFromVisual XVISUALIDFROMVISUAL +#define XWMGeometry XWMGEOMETRY +#define XWarpPointer XWARPPOINTER +#define XWhitePixel XWHITEPIXEL +#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN +#define XWidthMMOfScreen XWIDTHMMOFSCREEN +#define XWidthOfScreen XWIDTHOFSCREEN +#define XWindowEvent XWINDOWEVENT +#define XWithdrawWindow XWITHDRAWWINDOW +#define XXorRegion XXORREGION +#define XcmsQueryColor XCMSQUERYCOLOR +#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME +#define XdbeFreeVisualInfo XDBEFREEVISUALINFO +#define XdbeGetVisualInfo XDBEGETVISUALINFO +#define XdbeQueryExtension XDBEQUERYEXTENSION +#define XdbeSwapBuffers XDBESWAPBUFFERS +#define XextAddDisplay XEXTADDDISPLAY +#define XextFindDisplay XEXTFINDDISPLAY +#define XextRemoveDisplay XEXTREMOVEDISPLAY +#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT +#define XmActivateProtocol XMACTIVATEPROTOCOL +#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK +#define XmAddProtocols XMADDPROTOCOLS +#define XmChangeColor XMCHANGECOLOR +#define XmClipboardCopy XMCLIPBOARDCOPY +#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME +#define XmClipboardEndCopy XMCLIPBOARDENDCOPY +#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE +#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT +#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT +#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH +#define XmClipboardLock XMCLIPBOARDLOCK +#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE +#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY +#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE +#define XmClipboardUnlock XMCLIPBOARDUNLOCK +#define XmCommandError XMCOMMANDERROR +#define XmCommandGetChild XMCOMMANDGETCHILD +#define XmCommandSetValue XMCOMMANDSETVALUE +#define XmCreateArrowButton XMCREATEARROWBUTTON +#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET +#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG +#define XmCreateCascadeButton XMCREATECASCADEBUTTON +#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET +#define XmCreateDialogShell XMCREATEDIALOGSHELL +#define XmCreateDragIcon XMCREATEDRAGICON +#define XmCreateDrawingArea XMCREATEDRAWINGAREA +#define XmCreateDrawnButton XMCREATEDRAWNBUTTON +#define XmCreateErrorDialog XMCREATEERRORDIALOG +#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX +#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG +#define XmCreateForm XMCREATEFORM +#define XmCreateFormDialog XMCREATEFORMDIALOG +#define XmCreateFrame XMCREATEFRAME +#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG +#define XmCreateLabel XMCREATELABEL +#define XmCreateLabelGadget XMCREATELABELGADGET +#define XmCreateList XMCREATELIST +#define XmCreateMainWindow XMCREATEMAINWINDOW +#define XmCreateMenuBar XMCREATEMENUBAR +#define XmCreateMessageBox XMCREATEMESSAGEBOX +#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG +#define XmCreateOptionMenu XMCREATEOPTIONMENU +#define XmCreatePanedWindow XMCREATEPANEDWINDOW +#define XmCreatePopupMenu XMCREATEPOPUPMENU +#define XmCreatePromptDialog XMCREATEPROMPTDIALOG +#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU +#define XmCreatePushButton XMCREATEPUSHBUTTON +#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET +#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG +#define XmCreateRadioBox XMCREATERADIOBOX +#define XmCreateRowColumn XMCREATEROWCOLUMN +#define XmCreateScale XMCREATESCALE +#define XmCreateScrollBar XMCREATESCROLLBAR +#define XmCreateScrolledList XMCREATESCROLLEDLIST +#define XmCreateScrolledText XMCREATESCROLLEDTEXT +#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW +#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG +#define XmCreateSeparator XMCREATESEPARATOR +#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET +#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG +#define XmCreateText XMCREATETEXT +#define XmCreateTextField XMCREATETEXTFIELD +#define XmCreateToggleButton XMCREATETOGGLEBUTTON +#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET +#define XmCreateWarningDialog XMCREATEWARNINGDIALOG +#define XmCvtCTToXmString XMCVTCTTOXMSTRING +#define XmDestroyPixmap XMDESTROYPIXMAP +#define XmDragStart XMDRAGSTART +#define XmDropSiteRegister XMDROPSITEREGISTER +#define XmDropSiteUnregister XMDROPSITEUNREGISTER +#define XmDropSiteUpdate XMDROPSITEUPDATE +#define XmDropTransferStart XMDROPTRANSFERSTART +#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD +#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH +#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY +#define XmFontListCopy XMFONTLISTCOPY +#define XmFontListCreate XMFONTLISTCREATE +#define XmFontListEntryCreate XMFONTLISTENTRYCREATE +#define XmFontListEntryFree XMFONTLISTENTRYFREE +#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT +#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG +#define XmFontListEntryLoad XMFONTLISTENTRYLOAD +#define XmFontListFree XMFONTLISTFREE +#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT +#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT +#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT +#define XmFontListNextEntry XMFONTLISTNEXTENTRY +#define XmGetColors XMGETCOLORS +#define XmGetColorCalculation XMGETCOLORCALCULATION +#define XmGetFocusWidget XMGETFOCUSWIDGET +#define XmGetMenuCursor XMGETMENUCURSOR +#define XmGetPixmap XMGETPIXMAP +#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH +#define XmGetTearOffControl XMGETTEAROFFCONTROL +#define XmGetXmDisplay XMGETXMDISPLAY +#define XmImMbLookupString XMIMMBLOOKUPSTRING +#define XmImRegister XMIMREGISTER +#define XmImSetFocusValues XMIMSETFOCUSVALUES +#define XmImSetValues XMIMSETVALUES +#define XmImUnregister XMIMUNREGISTER +#define XmImUnsetFocus XMIMUNSETFOCUS +#define XmInstallImage XMINSTALLIMAGE +#define XmInternAtom XMINTERNATOM +#define XmIsMotifWMRunning XMISMOTIFWMRUNNING +#define XmListAddItem XMLISTADDITEM +#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED +#define XmListAddItems XMLISTADDITEMS +#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED +#define XmListDeleteAllItems XMLISTDELETEALLITEMS +#define XmListDeleteItem XMLISTDELETEITEM +#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS +#define XmListDeletePos XMLISTDELETEPOS +#define XmListDeselectAllItems XMLISTDESELECTALLITEMS +#define XmListDeselectPos XMLISTDESELECTPOS +#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS +#define XmListGetMatchPos XMLISTGETMATCHPOS +#define XmListGetSelectedPos XMLISTGETSELECTEDPOS +#define XmListItemExists XMLISTITEMEXISTS +#define XmListItemPos XMLISTITEMPOS +#define XmListPosSelected XMLISTPOSSELECTED +#define XmListReplaceItems XMLISTREPLACEITEMS +#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS +#define XmListSelectItem XMLISTSELECTITEM +#define XmListSelectPos XMLISTSELECTPOS +#define XmListSetBottomPos XMLISTSETBOTTOMPOS +#define XmListSetItem XMLISTSETITEM +#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS +#define XmListSetPos XMLISTSETPOS +#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS +#define XmMenuPosition XMMENUPOSITION +#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD +#define XmOptionButtonGadget XMOPTIONBUTTONGADGET +#define XmOptionLabelGadget XMOPTIONLABELGADGET +#define XmProcessTraversal XMPROCESSTRAVERSAL +#define XmQmotif XMQMOTIF +#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK +#define XmRemoveProtocols XMREMOVEPROTOCOLS +#define XmRemoveTabGroup XMREMOVETABGROUP +#define XmRepTypeGetId XMREPTYPEGETID +#define XmRepTypeGetRecord XMREPTYPEGETRECORD +#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON +#define XmRepTypeRegister XMREPTYPEREGISTER +#define XmRepTypeValidValue XMREPTYPEVALIDVALUE +#define XmScrollBarGetValues XMSCROLLBARGETVALUES +#define XmScrollBarSetValues XMSCROLLBARSETVALUES +#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS +#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD +#define XmSetColorCalculation XMSETCOLORCALCULATION +#define XmStringByteCompare XMSTRINGBYTECOMPARE +#define XmStringCompare XMSTRINGCOMPARE +#define XmStringConcat XMSTRINGCONCAT +#define XmStringCopy XMSTRINGCOPY +#define XmStringCreate XMSTRINGCREATE +#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED +#define XmStringCreateLtoR XMSTRINGCREATELTOR +#define XmStringCreateSimple XMSTRINGCREATESIMPLE +#define XmStringDraw XMSTRINGDRAW +#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE +#define XmStringExtent XMSTRINGEXTENT +#define XmStringFree XMSTRINGFREE +#define XmStringFreeContext XMSTRINGFREECONTEXT +#define XmStringGetLtoR XMSTRINGGETLTOR +#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT +#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT +#define XmStringInitContext XMSTRINGINITCONTEXT +#define XmStringLength XMSTRINGLENGTH +#define XmStringLtoRCreate XMSTRINGLTORCREATE +#define XmStringNConcat XMSTRINGNCONCAT +#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE +#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE +#define XmStringWidth XMSTRINGWIDTH +#define XmTextClearSelection XMTEXTCLEARSELECTION +#define XmTextCopy XMTEXTCOPY +#define XmTextCut XMTEXTCUT +#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION +#define XmTextFieldCopy XMTEXTFIELDCOPY +#define XmTextFieldCut XMTEXTFIELDCUT +#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE +#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION +#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION +#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH +#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION +#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION +#define XmTextFieldGetString XMTEXTFIELDGETSTRING +#define XmTextFieldInsert XMTEXTFIELDINSERT +#define XmTextFieldPaste XMTEXTFIELDPASTE +#define XmTextFieldRemove XMTEXTFIELDREMOVE +#define XmTextFieldReplace XMTEXTFIELDREPLACE +#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE +#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT +#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION +#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH +#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION +#define XmTextFieldSetString XMTEXTFIELDSETSTRING +#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION +#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION +#define XmTextGetEditable XMTEXTGETEDITABLE +#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION +#define XmTextGetLastPosition XMTEXTGETLASTPOSITION +#define XmTextGetMaxLength XMTEXTGETMAXLENGTH +#define XmTextGetSelection XMTEXTGETSELECTION +#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION +#define XmTextGetString XMTEXTGETSTRING +#define XmTextInsert XMTEXTINSERT +#define XmTextPaste XMTEXTPASTE +#define XmTextPosToXY XMTEXTPOSTOXY +#define XmTextRemove XMTEXTREMOVE +#define XmTextReplace XMTEXTREPLACE +#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION +#define XmTextSetEditable XMTEXTSETEDITABLE +#define XmTextSetHighlight XMTEXTSETHIGHLIGHT +#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION +#define XmTextSetSelection XMTEXTSETSELECTION +#define XmTextSetString XMTEXTSETSTRING +#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER +#define XmTextShowPosition XMTEXTSHOWPOSITION +#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE +#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE +#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE +#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE +#define XmUninstallImage XMUNINSTALLIMAGE +#define XmUpdateDisplay XMUPDATEDISPLAY +#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX +#define XmbDrawString XMBDRAWSTRING +#define XmbLookupString XMBLOOKUPSTRING +#define XmbResetIC XMBRESETIC +#define XmbSetWMProperties XMBSETWMPROPERTIES +#define XmbTextEscapement XMBTEXTESCAPEMENT +#define XmbTextExtents XMBTEXTEXTENTS +#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY +#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST +#define XmbufCreateBuffers XMBUFCREATEBUFFERS +#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS +#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS +#define XmbufQueryExtension XMBUFQUERYEXTENSION +#define Xmemory_free XMEMORY_FREE +#define Xmemory_malloc XMEMORY_MALLOC +#define XmuClientWindow XMUCLIENTWINDOW +#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION +#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP +#define XmuInternAtom XMUINTERNATOM +#define XmuInternStrings XMUINTERNSTRINGS +#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP +#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE +#define XrmCombineDatabase XRMCOMBINEDATABASE +#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE +#define XrmDestroyDatabase XRMDESTROYDATABASE +#define XrmGetDatabase XRMGETDATABASE +#define XrmGetFileDatabase XRMGETFILEDATABASE +#define XrmGetResource XRMGETRESOURCE +#define XrmGetStringDatabase XRMGETSTRINGDATABASE +#define XrmInitialize XRMINITIALIZE +#define XrmMergeDatabases XRMMERGEDATABASES +#define XrmParseCommand XRMPARSECOMMAND +#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK +#define XrmPutFileDatabase XRMPUTFILEDATABASE +#define XrmPutLineResource XRMPUTLINERESOURCE +#define XrmPutStringResource XRMPUTSTRINGRESOURCE +#define XrmQGetResource XRMQGETRESOURCE +#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE +#define XrmQuarkToString XRMQUARKTOSTRING +#define XrmSetDatabase XRMSETDATABASE +#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XtAddCallback XTADDCALLBACK +#define XtAddCallbacks XTADDCALLBACKS +#define XtAddConverter XTADDCONVERTER +#define XtAddEventHandler XTADDEVENTHANDLER +#define XtAddExposureToRegion XTADDEXPOSURETOREGION +#define XtAddGrab XTADDGRAB +#define XtAddRawEventHandler XTADDRAWEVENTHANDLER +#define XtAllocateGC XTALLOCATEGC +#define XtAppAddActions XTAPPADDACTIONS +#define XtAppAddInput XTAPPADDINPUT +#define XtAppAddTimeOut XTAPPADDTIMEOUT +#define XtAppAddWorkProc XTAPPADDWORKPROC +#define XtAppCreateShell XTAPPCREATESHELL +#define XtAppError XTAPPERROR +#define XtAppErrorMsg XTAPPERRORMSG +#define XtAppInitialize XTAPPINITIALIZE +#define XtAppMainLoop XTAPPMAINLOOP +#define XtAppNextEvent XTAPPNEXTEVENT +#define XtAppPeekEvent XTAPPPEEKEVENT +#define XtAppPending XTAPPPENDING +#define XtAppProcessEvent XTAPPPROCESSEVENT +#define XtAppSetErrorHandler XTAPPSETERRORHANDLER +#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES +#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER +#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER +#define XtAppWarningMsg XTAPPWARNINGMSG +#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER +#define XtAppWarning XTAPPWARNING +#define XtAugmentTranslations XTAUGMENTTRANSLATIONS +#define XtCallActionProc XTCALLACTIONPROC +#define XtCallCallbackList XTCALLCALLBACKLIST +#define XtCallCallbacks XTCALLCALLBACKS +#define XtCallConverter XTCALLCONVERTER +#define XtCalloc XTCALLOC +#ifndef NOXTDISPLAY +#define XtClass XTCLASS +#endif +#define XtCloseDisplay XTCLOSEDISPLAY +#define XtConfigureWidget XTCONFIGUREWIDGET +#define XtConvert XTCONVERT +#define XtConvertAndStore XTCONVERTANDSTORE +#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT +#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET +#define XtCreatePopupShell XTCREATEPOPUPSHELL +#define XtCreateWidget XTCREATEWIDGET +#define XtCreateWindow XTCREATEWINDOW +#define XtCvtStringToFont XTCVTSTRINGTOFONT +#define XtDatabase XTDATABASE +#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT +#define XtDestroyWidget XTDESTROYWIDGET +#define XtDisownSelection XTDISOWNSELECTION +#define XtDispatchEvent XTDISPATCHEVENT +#ifndef NOXTDISPLAY +#define XtDisplay XTDISPLAY +#endif +#define XtDisplayOfObject XTDISPLAYOFOBJECT +#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING +#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT +#define XtError XTERROR +#define XtErrorMsg XTERRORMSG +#define XtFree XTFREE +#define XtGetActionKeysym XTGETACTIONKEYSYM +#define XtGetActionList XTGETACTIONLIST +#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS +#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES +#define XtGetClassExtension XTGETCLASSEXTENSION +#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST +#define XtGetGC XTGETGC +#define XtGetMultiClickTime XTGETMULTICLICKTIME +#define XtGetResourceList XTGETRESOURCELIST +#define XtGetSelectionValue XTGETSELECTIONVALUE +#define XtGetSelectionValues XTGETSELECTIONVALUES +#define XtGetSubresources XTGETSUBRESOURCES +#define XtGetValues XTGETVALUES +#define XtGrabButton XTGRABBUTTON +#define XtGrabKeyboard XTGRABKEYBOARD +#define XtGrabPointer XTGRABPOINTER +#define XtHasCallbacks XTHASCALLBACKS +#define XtInitialize XTINITIALIZE +#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS +#define XtInsertEventHandler XTINSERTEVENTHANDLER +#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER +#define XtInstallAccelerators XTINSTALLACCELERATORS +#define XtIsManaged XTISMANAGED +#define XtIsObject XTISOBJECT +#ifndef NOXTDISPLAY +#define XtIsRealized XTISREALIZED +#endif +#define XtIsSensitive XTISSENSITIVE +#define XtIsSubclass XTISSUBCLASS +#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED +#define XtMainLoop XTMAINLOOP +#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST +#define XtMakeResizeRequest XTMAKERESIZEREQUEST +#define XtMalloc XTMALLOC +#define XtManageChild XTMANAGECHILD +#define XtManageChildren XTMANAGECHILDREN +#define XtMergeArgLists XTMERGEARGLISTS +#define XtMoveWidget XTMOVEWIDGET +#define XtName XTNAME +#define XtNameToWidget XTNAMETOWIDGET +#define XtOpenApplication XTOPENAPPLICATION +#define XtOpenDisplay XTOPENDISPLAY +#define XtOverrideTranslations XTOVERRIDETRANSLATIONS +#define XtOwnSelection XTOWNSELECTION +#ifndef NOXTDISPLAY +#define XtParent XTPARENT +#endif +#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE +#define XtParseTranslationTable XTPARSETRANSLATIONTABLE +#define XtPopdown XTPOPDOWN +#define XtPopup XTPOPUP +#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED +#define XtQueryGeometry XTQUERYGEOMETRY +#define XtRealizeWidget XTREALIZEWIDGET +#define XtRealloc XTREALLOC +#define XtRegisterDrawable _XTREGISTERWINDOW +#define XtRegisterGrabAction XTREGISTERGRABACTION +#define XtReleaseGC XTRELEASEGC +#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS +#define XtRemoveCallback XTREMOVECALLBACK +#define XtRemoveEventHandler XTREMOVEEVENTHANDLER +#define XtRemoveGrab XTREMOVEGRAB +#define XtRemoveInput XTREMOVEINPUT +#define XtRemoveTimeOut XTREMOVETIMEOUT +#define XtRemoveWorkProc XTREMOVEWORKPROC +#define XtResizeWidget XTRESIZEWIDGET +#define XtResolvePathname XTRESOLVEPATHNAME +#ifndef NOXTDISPLAY +#define XtScreen XTSCREEN +#endif +#define XtScreenDatabase XTSCREENDATABASE +#define XtScreenOfObject XTSCREENOFOBJECT +#define XtSessionReturnToken XTSESSIONRETURNTOKEN +#define XtSetErrorHandler XTSETERRORHANDLER +#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS +#define XtSetLanguageProc XTSETLANGUAGEPROC +#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED +#define XtSetSensitive XTSETSENSITIVE +#define XtSetTypeConverter XTSETTYPECONVERTER +#define XtSetValues XTSETVALUES +#define XtShellStrings XTSHELLSTRINGS +#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING +#define XtStrings XTSTRINGS +#define XtToolkitInitialize XTTOOLKITINITIALIZE +#define XtTranslateCoords XTTRANSLATECOORDS +#define XtTranslateKeycode XTTRANSLATEKEYCODE +#define XtUngrabButton XTUNGRABBUTTON +#define XtUngrabKeyboard XTUNGRABKEYBOARD +#define XtUngrabPointer XTUNGRABPOINTER +#define XtUnmanageChild XTUNMANAGECHILD +#define XtUnmanageChildren XTUNMANAGECHILDREN +#define XtUnrealizeWidget XTUNREALIZEWIDGET +#define XtUnregisterDrawable _XTUNREGISTERWINDOW +#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET +#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL +#define XtVaCreateWidget XTVACREATEWIDGET +#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES +#define XtVaGetValues XTVAGETVALUES +#define XtVaSetValues XTVASETVALUES +#define XtWarning XTWARNING +#define XtWarningMsg XTWARNINGMSG +#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT +#ifndef NOXTDISPLAY +#define XtWindow XTWINDOW +#endif +#define XtWindowOfObject XTWINDOWOFOBJECT +#define XtWindowToWidget XTWINDOWTOWIDGET +#define XwcDrawImageString XWCDRAWIMAGESTRING +#define XwcDrawString XWCDRAWSTRING +#define XwcFreeStringList XWCFREESTRINGLIST +#define XwcTextEscapement XWCTEXTESCAPEMENT +#define XwcTextExtents XWCTEXTEXTENTS +#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY +#define XwcLookupString XWCLOOKUPSTRING +#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST +#define _XAllocTemp _XALLOCTEMP +#define _XDeqAsyncHandler _XDEQASYNCHANDLER +#define _XEatData _XEATDATA +#define _XFlush _XFLUSH +#define _XFreeTemp _XFREETEMP +#define _XGetAsyncReply _XGETASYNCREPLY +#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS +#define _XRead _XREAD +#define _XReadPad _XREADPAD +#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE +#define _XReply _XREPLY +#define _XSend _XSEND +#define _XUnregisterFilter _XUNREGISTERFILTER +#define _XVIDtoVisual _XVIDTOVISUAL +#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT +#define _XmClearBorder _XMCLEARBORDER +#define _XmConfigureObject _XMCONFIGUREOBJECT +#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK +#define _XmDrawArrow _XMDRAWARROW +#define _XmDrawShadows _XMDRAWSHADOWS +#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT +#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS +#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS +#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR +#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST +#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON +#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA +#define _XmGrabKeyboard _XMGRABKEYBOARD +#define _XmGrabPointer _XMGRABPOINTER +#define _XmInheritClass _XMINHERITCLASS +#define _XmInputForGadget _XMINPUTFORGADGET +#define _XmInputInGadget _XMINPUTINGADGET +#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST +#define _XmMenuPopDown _XMMENUPOPDOWN +#define _XmMoveObject _XMMOVEOBJECT +#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED +#define _XmOSBuildFileList _XMOSBUILDFILELIST +#define _XmOSFileCompare _XMOSFILECOMPARE +#define _XmOSFindPatternPart _XMOSFINDPATTERNPART +#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC +#define _XmPostPopupMenu _XMPOSTPOPUPMENU +#define _XmPrimitiveEnter _XMPRIMITIVEENTER +#define _XmPrimitiveLeave _XMPRIMITIVELEAVE +#define _XmRedisplayGadgets _XMREDISPLAYGADGETS +#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE +#define _XmStringDraw _XMSTRINGDRAW +#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT +#define _XmStrings _XMSTRINGS +#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS +#define _XmToVerticalPixels _XMTOVERTICALPIXELS +#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT +#define _Xm_fastPtr _XM_FASTPTR +#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG +#define _XtCopyFromArg _XTCOPYFROMARG +#define _XtCountVaList _XTCOUNTVALIST +#define _XtInherit _XTINHERIT +#define _XtInheritTranslations _XTINHERITTRANSLATIONS +#define _XtIsSubclassOf _XTISSUBCLASSOF +#define _XtVaToArgList _XTVATOARGLIST +#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS +#define cli$dcl_parse CLI$DCL_PARSE +#define cli$get_value CLI$GET_VALUE +#define cli$present CLI$PRESENT +#define compositeClassRec COMPOSITECLASSREC +#define compositeWidgetClass COMPOSITEWIDGETCLASS +#define constraintClassRec CONSTRAINTCLASSREC +#define constraintWidgetClass CONSTRAINTWIDGETCLASS +#define coreWidgetClass COREWIDGETCLASS +#define exe$getspi EXE$GETSPI +#define lbr$close LBR$CLOSE +#define lbr$get_header LBR$GET_HEADER +#define lbr$get_index LBR$GET_INDEX +#define lbr$get_record LBR$GET_RECORD +#define lbr$ini_control LBR$INI_CONTROL +#define lbr$lookup_key LBR$LOOKUP_KEY +#define lbr$open LBR$OPEN +#define lbr$output_help LBR$OUTPUT_HELP +#define lib$add_times LIB$ADD_TIMES +#define lib$addx LIB$ADDX +#define lib$create_dir LIB$CREATE_DIR +#define lib$create_vm_zone LIB$CREATE_VM_ZONE +#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME +#define lib$cvt_htb LIB$CVT_HTB +#define lib$cvt_vectim LIB$CVT_VECTIM +#define lib$day LIB$DAY +#define lib$day_of_week LIB$DAY_OF_WEEK +#define lib$delete_symbol LIB$DELETE_SYMBOL +#define lib$delete_vm_zone LIB$DELETE_VM_ZONE +#define lib$disable_ctrl LIB$DISABLE_CTRL +#define lib$ediv LIB$EDIV +#define lib$emul LIB$EMUL +#define lib$enable_ctrl LIB$ENABLE_CTRL +#define lib$find_vm_zone LIB$FIND_VM_ZONE +#define lib$format_date_time LIB$FORMAT_DATE_TIME +#define lib$free_timer LIB$FREE_TIMER +#define lib$free_vm LIB$FREE_VM +#define lib$get_ef LIB$GET_EF +#define lib$get_foreign LIB$GET_FOREIGN +#define lib$get_input LIB$GET_INPUT +#define lib$get_users_language LIB$GET_USERS_LANGUAGE +#define lib$get_vm LIB$GET_VM +#define lib$get_symbol LIB$GET_SYMBOL +#define lib$getdvi LIB$GETDVI +#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT +#define lib$init_timer LIB$INIT_TIMER +#define lib$find_file LIB$FIND_FILE +#define lib$find_file_end LIB$FIND_FILE_END +#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL +#define lib$mult_delta_time LIB$MULT_DELTA_TIME +#define lib$put_output LIB$PUT_OUTPUT +#define lib$rename_file LIB$RENAME_FILE +#define lib$reset_vm_zone LIB$RESET_VM_ZONE +#define lib$set_symbol LIB$SET_SYMBOL +#define lib$sfree1_dd LIB$SFREE1_DD +#define lib$show_vm LIB$SHOW_VM +#define lib$show_vm_zone LIB$SHOW_VM_ZONE +#define lib$spawn LIB$SPAWN +#define lib$stat_timer LIB$STAT_TIMER +#define lib$subx LIB$SUBX +#define lib$sub_times LIB$SUB_TIMES +#define lib$wait LIB$WAIT +#define mail$send_add_address MAIL$SEND_ADD_ADDRESS +#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE +#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART +#define mail$send_begin MAIL$SEND_BEGIN +#define mail$send_end MAIL$SEND_END +#define mail$send_message MAIL$SEND_MESSAGE +#define ncs$convert NCS$CONVERT +#define ncs$get_cf NCS$GET_CF +#define objectClass OBJECTCLASS +#define objectClassRec OBJECTCLASSREC +#define overrideShellClassRec OVERRIDESHELLCLASSREC +#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS +#define pthread_attr_create PTHREAD_ATTR_CREATE +#define pthread_attr_delete PTHREAD_ATTR_DELETE +#define pthread_attr_destroy PTHREAD_ATTR_DESTROY +#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP +#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP +#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED +#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO +#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED +#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM +#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY +#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE +#define pthread_attr_init PTHREAD_ATTR_INIT +#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP +#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE +#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP +#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED +#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO +#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED +#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM +#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY +#ifndef pthread_attr_setscope +# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE +#endif +#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE +#define pthread_cancel PTHREAD_CANCEL +#define pthread_cancel_e PTHREAD_CANCEL_E +#define pthread_cond_broadcast PTHREAD_COND_BROADCAST +#define pthread_cond_destroy PTHREAD_COND_DESTROY +#define pthread_cond_init PTHREAD_COND_INIT +#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP +#define pthread_cond_signal PTHREAD_COND_SIGNAL +#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP +#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT +#define pthread_cond_wait PTHREAD_COND_WAIT +#define pthread_condattr_create PTHREAD_CONDATTR_CREATE +#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE +#define pthread_condattr_init PTHREAD_CONDATTR_INIT +#define pthread_create PTHREAD_CREATE +#define pthread_delay_np PTHREAD_DELAY_NP +#define pthread_detach PTHREAD_DETACH +#define pthread_equal PTHREAD_EQUAL +#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP +#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP +#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP +#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP +#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP +#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP +#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP +#define pthread_exit PTHREAD_EXIT +#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP +#define pthread_getprio PTHREAD_GETPRIO +#define pthread_getschedparam PTHREAD_GETSCHEDPARAM +#define pthread_getscheduler PTHREAD_GETSCHEDULER +#define pthread_getspecific PTHREAD_GETSPECIFIC +#define pthread_getunique_np PTHREAD_GETUNIQUE_NP +#define pthread_join PTHREAD_JOIN +#define pthread_join32 PTHREAD_JOIN32 +#define pthread_key_create PTHREAD_KEY_CREATE +#define pthread_key_delete PTHREAD_KEY_DELETE +#define pthread_keycreate PTHREAD_KEYCREATE +#define pthread_kill PTHREAD_KILL +#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP +#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY +#define pthread_mutex_init PTHREAD_MUTEX_INIT +#define pthread_mutex_lock PTHREAD_MUTEX_LOCK +#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK +#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK +#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE +#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE +#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY +#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP +#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT +#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP +#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP +#define pthread_once PTHREAD_ONCE +#define pthread_resume_np PTHREAD_RESUME_NP +#define pthread_self PTHREAD_SELF +#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL +#define pthread_setcancel PTHREAD_SETCANCEL +#define pthread_setcancelstate PTHREAD_SETCANCELSTATE +#define pthread_setcanceltype PTHREAD_SETCANCELTYPE +#define pthread_setprio PTHREAD_SETPRIO +#define pthread_setschedparam PTHREAD_SETSCHEDPARAM +#define pthread_setscheduler PTHREAD_SETSCHEDULER +#define pthread_setspecific PTHREAD_SETSPECIFIC +#define pthread_suspend_np PTHREAD_SUSPEND_NP +#define pthread_testcancel PTHREAD_TESTCANCEL +#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP +#define pthread_yield PTHREAD_YIELD +#define pthread_yield_np PTHREAD_YIELD_NP +#define rectObjClass RECTOBJCLASS +#define rectObjClassRec RECTOBJCLASSREC +#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS +#define shellWidgetClass SHELLWIDGETCLASS +#define shmat SHMAT +#define shmctl SHMCTL +#define shmdt SHMDT +#define shmget SHMGET +#define smg$create_key_table SMG$CREATE_KEY_TABLE +#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD +#define smg$read_composed_line SMG$READ_COMPOSED_LINE +#define sys$add_ident SYS$ADD_IDENT +#define sys$asctoid SYS$ASCTOID +#define sys$assign SYS$ASSIGN +#define sys$bintim SYS$BINTIM +#define sys$cancel SYS$CANCEL +#define sys$cantim SYS$CANTIM +#define sys$check_access SYS$CHECK_ACCESS +#define sys$close SYS$CLOSE +#define sys$connect SYS$CONNECT +#define sys$create SYS$CREATE +#define sys$create_user_profile SYS$CREATE_USER_PROFILE +#define sys$crembx SYS$CREMBX +#define sys$creprc SYS$CREPRC +#define sys$crmpsc SYS$CRMPSC +#define sys$dassgn SYS$DASSGN +#define sys$dclast SYS$DCLAST +#define sys$dclexh SYS$DCLEXH +#define sys$delprc SYS$DELPRC +#define sys$deq SYS$DEQ +#define sys$dgblsc SYS$DGBLSC +#define sys$display SYS$DISPLAY +#define sys$enq SYS$ENQ +#define sys$enqw SYS$ENQW +#define sys$erase SYS$ERASE +#define sys$fao SYS$FAO +#define sys$faol SYS$FAOL +#define sys$find_held SYS$FIND_HELD +#define sys$finish_rdb SYS$FINISH_RDB +#define sys$flush SYS$FLUSH +#define sys$forcex SYS$FORCEX +#define sys$get SYS$GET +#define sys$get_security SYS$GET_SECURITY +#define sys$getdviw SYS$GETDVIW +#define sys$getjpi SYS$GETJPI +#define sys$getjpiw SYS$GETJPIW +#define sys$getlkiw SYS$GETLKIW +#define sys$getmsg SYS$GETMSG +#define sys$getsyi SYS$GETSYI +#define sys$getsyiw SYS$GETSYIW +#define sys$gettim SYS$GETTIM +#define sys$getuai SYS$GETUAI +#define sys$grantid SYS$GRANTID +#define sys$hash_password SYS$HASH_PASSWORD +#define sys$hiber SYS$HIBER +#define sys$mgblsc SYS$MGBLSC +#define sys$numtim SYS$NUMTIM +#define sys$open SYS$OPEN +#define sys$parse SYS$PARSE +#define sys$parse_acl SYS$PARSE_ACL +#define sys$parse_acl SYS$PARSE_ACL +#define sys$persona_assume SYS$PERSONA_ASSUME +#define sys$persona_create SYS$PERSONA_CREATE +#define sys$persona_delete SYS$PERSONA_DELETE +#define sys$process_scan SYS$PROCESS_SCAN +#define sys$put SYS$PUT +#define sys$qio SYS$QIO +#define sys$qiow SYS$QIOW +#define sys$read SYS$READ +#define sys$resched SYS$RESCHED +#define sys$rewind SYS$REWIND +#define sys$search SYS$SEARCH +#define sys$set_security SYS$SET_SECURITY +#define sys$setast SYS$SETAST +#define sys$setef SYS$SETEF +#define sys$setimr SYS$SETIMR +#define sys$setpri SYS$SETPRI +#define sys$setprn SYS$SETPRN +#define sys$setprv SYS$SETPRV +#define sys$setswm SYS$SETSWM +#define sys$setuai SYS$SETUAI +#define sys$sndopr SYS$SNDOPR +#define sys$synch SYS$SYNCH +#define sys$trnlnm SYS$TRNLNM +#define sys$update SYS$UPDATE +#define sys$wake SYS$WAKE +#define sys$write SYS$WRITE +#define topLevelShellClassRec TOPLEVELSHELLCLASSREC +#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS +#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS +#define vendorShellClassRec VENDORSHELLCLASSREC +#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS +#define widgetClass WIDGETCLASS +#define widgetClassRec WIDGETCLASSREC +#define wmShellClassRec WMSHELLCLASSREC +#define wmShellWidgetClass WMSHELLWIDGETCLASS +#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK +#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH +#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS +#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS +#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS +#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC +#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS +#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS +#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS +#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS +#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS +#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS +#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS +#define xmFormWidgetClass XMFORMWIDGETCLASS +#define xmFrameWidgetClass XMFRAMEWIDGETCLASS +#define xmGadgetClass XMGADGETCLASS +#define xmLabelGadgetClass XMLABELGADGETCLASS +#define xmLabelWidgetClass XMLABELWIDGETCLASS +#define xmListWidgetClass XMLISTWIDGETCLASS +#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS +#define xmManagerClassRec XMMANAGERCLASSREC +#define xmManagerWidgetClass XMMANAGERWIDGETCLASS +#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS +#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS +#define xmPrimitiveClassRec XMPRIMITIVECLASSREC +#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS +#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC +#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS +#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS +#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS +#define xmSashWidgetClass XMSASHWIDGETCLASS +#define xmScaleWidgetClass XMSCALEWIDGETCLASS +#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS +#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC +#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS +#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS +#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS +#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS +#define xmTextWidgetClass XMTEXTWIDGETCLASS +#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS +#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS + +#if (__VMS_VER < 80200000) +# define SetReqLen(req,n,badlen) \ + if ((req->length + n) > (unsigned)65535) { \ + n = badlen; \ + req->length += n; \ + } else \ + req->length += n +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void XtFree(char*); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/wxWidgets/include/wx/volume.h b/Externals/wxWidgets/include/wx/volume.h index 7a958b98ae..be44075332 100644 --- a/Externals/wxWidgets/include/wx/volume.h +++ b/Externals/wxWidgets/include/wx/volume.h @@ -1,146 +1,146 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/volume.h -// Purpose: wxFSVolume - encapsulates system volume information -// Author: George Policello -// Modified by: -// Created: 28 Jan 02 -// RCS-ID: $Id: volume.h 39399 2006-05-28 23:08:31Z ABX $ -// Copyright: (c) 2002 George Policello -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------------------------- -// wxFSVolume represents a volume/drive/mount point in a file system -// ---------------------------------------------------------------------------- - -#ifndef _WX_FSVOLUME_H_ -#define _WX_FSVOLUME_H_ - -#include "wx/defs.h" - -#if wxUSE_FSVOLUME - -#include "wx/arrstr.h" - -// the volume flags -enum -{ - // is the volume mounted? - wxFS_VOL_MOUNTED = 0x0001, - - // is the volume removable (floppy, CD, ...)? - wxFS_VOL_REMOVABLE = 0x0002, - - // read only? (otherwise read write) - wxFS_VOL_READONLY = 0x0004, - - // network resources - wxFS_VOL_REMOTE = 0x0008 -}; - -// the volume types -enum wxFSVolumeKind -{ - wxFS_VOL_FLOPPY, - wxFS_VOL_DISK, - wxFS_VOL_CDROM, - wxFS_VOL_DVDROM, - wxFS_VOL_NETWORK, - wxFS_VOL_OTHER, - wxFS_VOL_MAX -}; - -class WXDLLIMPEXP_BASE wxFSVolumeBase -{ -public: - // return the array containing the names of the volumes - // - // only the volumes with the flags such that - // (flags & flagsSet) == flagsSet && !(flags & flagsUnset) - // are returned (by default, all mounted ones) - static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED, - int flagsUnset = 0); - - // stop execution of GetVolumes() called previously (should be called from - // another thread, of course) - static void CancelSearch(); - - // create the volume object with this name (should be one of those returned - // by GetVolumes()). - wxFSVolumeBase(); - wxFSVolumeBase(const wxString& name); - bool Create(const wxString& name); - - // accessors - // --------- - - // is this a valid volume? - bool IsOk() const; - - // kind of this volume? - wxFSVolumeKind GetKind() const; - - // flags of this volume? - int GetFlags() const; - - // can we write to this volume? - bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); } - - // get the name of the volume and the name which should be displayed to the - // user - wxString GetName() const { return m_volName; } - wxString GetDisplayName() const { return m_dispName; } - - // TODO: operatios (Mount(), Unmount(), Eject(), ...)? - -protected: - // the internal volume name - wxString m_volName; - - // the volume name as it is displayed to the user - wxString m_dispName; - - // have we been initialized correctly? - bool m_isOk; -}; - -#if wxUSE_GUI - -#include "wx/icon.h" -#include "wx/iconbndl.h" // only for wxIconArray - -enum wxFSIconType -{ - wxFS_VOL_ICO_SMALL = 0, - wxFS_VOL_ICO_LARGE, - wxFS_VOL_ICO_SEL_SMALL, - wxFS_VOL_ICO_SEL_LARGE, - wxFS_VOL_ICO_MAX -}; - -// wxFSVolume adds GetIcon() to wxFSVolumeBase -class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase -{ -public: - wxFSVolume() : wxFSVolumeBase() { InitIcons(); } - wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); } - - wxIcon GetIcon(wxFSIconType type) const; - -private: - void InitIcons(); - - // the different icons for this volume (created on demand) - wxIconArray m_icons; -}; - -#else // !wxUSE_GUI - -// wxFSVolume is the same thing as wxFSVolume in wxBase -typedef wxFSVolumeBase wxFSVolume; - -#endif // wxUSE_GUI/!wxUSE_GUI - -#endif // wxUSE_FSVOLUME - -#endif // _WX_FSVOLUME_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/volume.h +// Purpose: wxFSVolume - encapsulates system volume information +// Author: George Policello +// Modified by: +// Created: 28 Jan 02 +// RCS-ID: $Id: volume.h 39399 2006-05-28 23:08:31Z ABX $ +// Copyright: (c) 2002 George Policello +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// wxFSVolume represents a volume/drive/mount point in a file system +// ---------------------------------------------------------------------------- + +#ifndef _WX_FSVOLUME_H_ +#define _WX_FSVOLUME_H_ + +#include "wx/defs.h" + +#if wxUSE_FSVOLUME + +#include "wx/arrstr.h" + +// the volume flags +enum +{ + // is the volume mounted? + wxFS_VOL_MOUNTED = 0x0001, + + // is the volume removable (floppy, CD, ...)? + wxFS_VOL_REMOVABLE = 0x0002, + + // read only? (otherwise read write) + wxFS_VOL_READONLY = 0x0004, + + // network resources + wxFS_VOL_REMOTE = 0x0008 +}; + +// the volume types +enum wxFSVolumeKind +{ + wxFS_VOL_FLOPPY, + wxFS_VOL_DISK, + wxFS_VOL_CDROM, + wxFS_VOL_DVDROM, + wxFS_VOL_NETWORK, + wxFS_VOL_OTHER, + wxFS_VOL_MAX +}; + +class WXDLLIMPEXP_BASE wxFSVolumeBase +{ +public: + // return the array containing the names of the volumes + // + // only the volumes with the flags such that + // (flags & flagsSet) == flagsSet && !(flags & flagsUnset) + // are returned (by default, all mounted ones) + static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED, + int flagsUnset = 0); + + // stop execution of GetVolumes() called previously (should be called from + // another thread, of course) + static void CancelSearch(); + + // create the volume object with this name (should be one of those returned + // by GetVolumes()). + wxFSVolumeBase(); + wxFSVolumeBase(const wxString& name); + bool Create(const wxString& name); + + // accessors + // --------- + + // is this a valid volume? + bool IsOk() const; + + // kind of this volume? + wxFSVolumeKind GetKind() const; + + // flags of this volume? + int GetFlags() const; + + // can we write to this volume? + bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); } + + // get the name of the volume and the name which should be displayed to the + // user + wxString GetName() const { return m_volName; } + wxString GetDisplayName() const { return m_dispName; } + + // TODO: operatios (Mount(), Unmount(), Eject(), ...)? + +protected: + // the internal volume name + wxString m_volName; + + // the volume name as it is displayed to the user + wxString m_dispName; + + // have we been initialized correctly? + bool m_isOk; +}; + +#if wxUSE_GUI + +#include "wx/icon.h" +#include "wx/iconbndl.h" // only for wxIconArray + +enum wxFSIconType +{ + wxFS_VOL_ICO_SMALL = 0, + wxFS_VOL_ICO_LARGE, + wxFS_VOL_ICO_SEL_SMALL, + wxFS_VOL_ICO_SEL_LARGE, + wxFS_VOL_ICO_MAX +}; + +// wxFSVolume adds GetIcon() to wxFSVolumeBase +class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase +{ +public: + wxFSVolume() : wxFSVolumeBase() { InitIcons(); } + wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); } + + wxIcon GetIcon(wxFSIconType type) const; + +private: + void InitIcons(); + + // the different icons for this volume (created on demand) + wxIconArray m_icons; +}; + +#else // !wxUSE_GUI + +// wxFSVolume is the same thing as wxFSVolume in wxBase +typedef wxFSVolumeBase wxFSVolume; + +#endif // wxUSE_GUI/!wxUSE_GUI + +#endif // wxUSE_FSVOLUME + +#endif // _WX_FSVOLUME_H_ diff --git a/Externals/wxWidgets/include/wx/vscroll.h b/Externals/wxWidgets/include/wx/vscroll.h index 9063e108b1..1d5d4e449e 100644 --- a/Externals/wxWidgets/include/wx/vscroll.h +++ b/Externals/wxWidgets/include/wx/vscroll.h @@ -1,223 +1,223 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/vscroll.h -// Purpose: wxVScrolledWindow: generalization of wxScrolledWindow -// Author: Vadim Zeitlin -// Modified by: -// Created: 30.05.03 -// RCS-ID: $Id: vscroll.h 38917 2006-04-26 00:17:52Z VZ $ -// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_VSCROLL_H_ -#define _WX_VSCROLL_H_ - -#include "wx/panel.h" // base class - -// ---------------------------------------------------------------------------- -// wxVScrolledWindow -// ---------------------------------------------------------------------------- - -/* - In the name of this class, "V" may stand for "variable" because it can be - used for scrolling lines of variable heights; "virtual" because it is not - necessary to know the heights of all lines in advance -- only those which - are shown on the screen need to be measured; or, even, "vertical" because - this class only supports scrolling in one direction currently (this could - and probably will change in the future however). - - In any case, this is a generalization of the wxScrolledWindow class which - can be only used when all lines have the same height. It lacks some other - wxScrolledWindow features however, notably it currently lacks support for - horizontal scrolling; it can't scroll another window nor only a rectangle - of the window and not its entire client area. - */ -class WXDLLEXPORT wxVScrolledWindow : public wxPanel -{ -public: - // constructors and such - // --------------------- - - // default ctor, you must call Create() later - wxVScrolledWindow() { Init(); } - - // normal ctor, no need to call Create() after this one - // - // note that wxVSCROLL is always automatically added to our style, there is - // no need to specify it explicitly - wxVScrolledWindow(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - // same as the previous ctor but returns status code: true if ok - // - // just as with the ctor above, wxVSCROLL style is always used, there is no - // need to specify it - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name); - } - - - // operations - // ---------- - - // set the number of lines the window contains: the derived class must - // provide the heights for all lines with indices up to the one given here - // in its OnGetLineHeight() - void SetLineCount(size_t count); - - // scroll to the specified line: it will become the first visible line in - // the window - // - // return true if we scrolled the window, false if nothing was done - bool ScrollToLine(size_t line); - - // scroll by the specified number of lines/pages - virtual bool ScrollLines(int lines); - virtual bool ScrollPages(int pages); - - // redraw the specified line - virtual void RefreshLine(size_t line); - - // redraw all lines in the specified range (inclusive) - virtual void RefreshLines(size_t from, size_t to); - - // return the item at the specified (in physical coordinates) position or. - - // wxNOT_FOUND if none, i.e. if it is below the last item - int HitTest(wxCoord x, wxCoord y) const; - int HitTest(const wxPoint& pt) const { return HitTest(pt.x, pt.y); } - - // recalculate all our parameters and redisplay all lines - virtual void RefreshAll(); - - - // accessors - // --------- - - // get the number of lines this window contains (previously set by - // SetLineCount()) - size_t GetLineCount() const { return m_lineMax; } - - // get the first currently visible line - size_t GetVisibleBegin() const { return m_lineFirst; } - - // get the first currently visible line - size_t GetVisibleEnd() const { return m_lineFirst + m_nVisible; } - - // is this line currently visible? - bool IsVisible(size_t line) const - { return line >= GetVisibleBegin() && line < GetVisibleEnd(); } - - - // this is the same as GetVisibleBegin(), exists to match - // GetLastVisibleLine() and for backwards compatibility only - size_t GetFirstVisibleLine() const { return m_lineFirst; } - - // get the last currently visible line - // - // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive - // number) if the control is empty, use GetVisibleEnd() instead, this one - // is kept for backwards compatibility - size_t GetLastVisibleLine() const { return GetVisibleEnd() - 1; } - - // layout the children (including the sizer if needed) - virtual bool Layout(); - -protected: - // this function must be overridden in the derived class and it should - // return the height of the given line in pixels - virtual wxCoord OnGetLineHeight(size_t n) const = 0; - - // this function doesn't have to be overridden but it may be useful to do - // it if calculating the lines heights is a relatively expensive operation - // as it gives the user code a possibility to calculate several of them at - // once - // - // OnGetLinesHint() is normally called just before OnGetLineHeight() but you - // shouldn't rely on the latter being called for all lines in the interval - // specified here. It is also possible that OnGetLineHeight() will be - // called for the lines outside of this interval, so this is really just a - // hint, not a promise. - // - // finally note that lineMin is inclusive, while lineMax is exclusive, as - // usual - virtual void OnGetLinesHint(size_t WXUNUSED(lineMin), - size_t WXUNUSED(lineMax)) const { } - - // when the number of lines changes, we try to estimate the total height - // of all lines which is a rather expensive operation in terms of lines - // access, so if the user code may estimate the average height - // better/faster than we do, it should override this function to implement - // its own logic - // - // this function should return the best guess for the total height it may - // make - virtual wxCoord EstimateTotalHeight() const; - - - // the event handlers - void OnSize(wxSizeEvent& event); - void OnScroll(wxScrollWinEvent& event); -#if wxUSE_MOUSEWHEEL - void OnMouseWheel(wxMouseEvent& event); -#endif - - // find the index of the line we need to show at the top of the window such - // that the last (fully or partially) visible line is the given one - size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = false); - - // get the total height of the lines between lineMin (inclusive) and - // lineMax (exclusive) - wxCoord GetLinesHeight(size_t lineMin, size_t lineMax) const; - - // update the thumb size shown by the scrollbar - void UpdateScrollbar(); - - // remove the scrollbar completely because we don't need it - void RemoveScrollbar(); - -private: - // common part of all ctors - void Init(); - - - // the total number of (logical) lines - size_t m_lineMax; - - // the total (estimated) height - wxCoord m_heightTotal; - - // the first currently visible line - size_t m_lineFirst; - - // the number of currently visible lines (including the last, possibly only - // partly, visible one) - size_t m_nVisible; - - // accumulated mouse wheel rotation -#if wxUSE_MOUSEWHEEL - int m_sumWheelRotation; -#endif - - DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxVScrolledWindow) - DECLARE_ABSTRACT_CLASS(wxVScrolledWindow) -}; - -#endif // _WX_VSCROLL_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/vscroll.h +// Purpose: wxVScrolledWindow: generalization of wxScrolledWindow +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.05.03 +// RCS-ID: $Id: vscroll.h 38917 2006-04-26 00:17:52Z VZ $ +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VSCROLL_H_ +#define _WX_VSCROLL_H_ + +#include "wx/panel.h" // base class + +// ---------------------------------------------------------------------------- +// wxVScrolledWindow +// ---------------------------------------------------------------------------- + +/* + In the name of this class, "V" may stand for "variable" because it can be + used for scrolling lines of variable heights; "virtual" because it is not + necessary to know the heights of all lines in advance -- only those which + are shown on the screen need to be measured; or, even, "vertical" because + this class only supports scrolling in one direction currently (this could + and probably will change in the future however). + + In any case, this is a generalization of the wxScrolledWindow class which + can be only used when all lines have the same height. It lacks some other + wxScrolledWindow features however, notably it currently lacks support for + horizontal scrolling; it can't scroll another window nor only a rectangle + of the window and not its entire client area. + */ +class WXDLLEXPORT wxVScrolledWindow : public wxPanel +{ +public: + // constructors and such + // --------------------- + + // default ctor, you must call Create() later + wxVScrolledWindow() { Init(); } + + // normal ctor, no need to call Create() after this one + // + // note that wxVSCROLL is always automatically added to our style, there is + // no need to specify it explicitly + wxVScrolledWindow(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // same as the previous ctor but returns status code: true if ok + // + // just as with the ctor above, wxVSCROLL style is always used, there is no + // need to specify it + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name); + } + + + // operations + // ---------- + + // set the number of lines the window contains: the derived class must + // provide the heights for all lines with indices up to the one given here + // in its OnGetLineHeight() + void SetLineCount(size_t count); + + // scroll to the specified line: it will become the first visible line in + // the window + // + // return true if we scrolled the window, false if nothing was done + bool ScrollToLine(size_t line); + + // scroll by the specified number of lines/pages + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + + // redraw the specified line + virtual void RefreshLine(size_t line); + + // redraw all lines in the specified range (inclusive) + virtual void RefreshLines(size_t from, size_t to); + + // return the item at the specified (in physical coordinates) position or. + + // wxNOT_FOUND if none, i.e. if it is below the last item + int HitTest(wxCoord x, wxCoord y) const; + int HitTest(const wxPoint& pt) const { return HitTest(pt.x, pt.y); } + + // recalculate all our parameters and redisplay all lines + virtual void RefreshAll(); + + + // accessors + // --------- + + // get the number of lines this window contains (previously set by + // SetLineCount()) + size_t GetLineCount() const { return m_lineMax; } + + // get the first currently visible line + size_t GetVisibleBegin() const { return m_lineFirst; } + + // get the first currently visible line + size_t GetVisibleEnd() const { return m_lineFirst + m_nVisible; } + + // is this line currently visible? + bool IsVisible(size_t line) const + { return line >= GetVisibleBegin() && line < GetVisibleEnd(); } + + + // this is the same as GetVisibleBegin(), exists to match + // GetLastVisibleLine() and for backwards compatibility only + size_t GetFirstVisibleLine() const { return m_lineFirst; } + + // get the last currently visible line + // + // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive + // number) if the control is empty, use GetVisibleEnd() instead, this one + // is kept for backwards compatibility + size_t GetLastVisibleLine() const { return GetVisibleEnd() - 1; } + + // layout the children (including the sizer if needed) + virtual bool Layout(); + +protected: + // this function must be overridden in the derived class and it should + // return the height of the given line in pixels + virtual wxCoord OnGetLineHeight(size_t n) const = 0; + + // this function doesn't have to be overridden but it may be useful to do + // it if calculating the lines heights is a relatively expensive operation + // as it gives the user code a possibility to calculate several of them at + // once + // + // OnGetLinesHint() is normally called just before OnGetLineHeight() but you + // shouldn't rely on the latter being called for all lines in the interval + // specified here. It is also possible that OnGetLineHeight() will be + // called for the lines outside of this interval, so this is really just a + // hint, not a promise. + // + // finally note that lineMin is inclusive, while lineMax is exclusive, as + // usual + virtual void OnGetLinesHint(size_t WXUNUSED(lineMin), + size_t WXUNUSED(lineMax)) const { } + + // when the number of lines changes, we try to estimate the total height + // of all lines which is a rather expensive operation in terms of lines + // access, so if the user code may estimate the average height + // better/faster than we do, it should override this function to implement + // its own logic + // + // this function should return the best guess for the total height it may + // make + virtual wxCoord EstimateTotalHeight() const; + + + // the event handlers + void OnSize(wxSizeEvent& event); + void OnScroll(wxScrollWinEvent& event); +#if wxUSE_MOUSEWHEEL + void OnMouseWheel(wxMouseEvent& event); +#endif + + // find the index of the line we need to show at the top of the window such + // that the last (fully or partially) visible line is the given one + size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = false); + + // get the total height of the lines between lineMin (inclusive) and + // lineMax (exclusive) + wxCoord GetLinesHeight(size_t lineMin, size_t lineMax) const; + + // update the thumb size shown by the scrollbar + void UpdateScrollbar(); + + // remove the scrollbar completely because we don't need it + void RemoveScrollbar(); + +private: + // common part of all ctors + void Init(); + + + // the total number of (logical) lines + size_t m_lineMax; + + // the total (estimated) height + wxCoord m_heightTotal; + + // the first currently visible line + size_t m_lineFirst; + + // the number of currently visible lines (including the last, possibly only + // partly, visible one) + size_t m_nVisible; + + // accumulated mouse wheel rotation +#if wxUSE_MOUSEWHEEL + int m_sumWheelRotation; +#endif + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxVScrolledWindow) + DECLARE_ABSTRACT_CLASS(wxVScrolledWindow) +}; + +#endif // _WX_VSCROLL_H_ + diff --git a/Externals/wxWidgets/include/wx/wave.h b/Externals/wxWidgets/include/wx/wave.h index f5970cbab0..48414af795 100644 --- a/Externals/wxWidgets/include/wx/wave.h +++ b/Externals/wxWidgets/include/wx/wave.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wave.h -// Purpose: wxSound compatibility header -// Author: Vaclav Slavik -// Modified by: -// Created: 2004/02/01 -// RCS-ID: $Id: wave.h 32852 2005-03-16 16:18:31Z ABX $ -// Copyright: (c) 2004, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WAVE_H_BASE_ -#define _WX_WAVE_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_SOUND - -#if WXWIN_COMPATIBILITY_2_4 -#if defined(__DMC__) || defined(__BORLANDC__) - #pragma message "wx/wave.h header is deprecated, use wx/sound.h and wxSound" -#elif defined(__WATCOMC__) || defined(__VISUALC__) - #pragma message ("wx/wave.h header is deprecated, use wx/sound.h and wxSound") -#else - #warning "wx/wave.h header is deprecated, use wx/sound.h and wxSound" -#endif - #include "wx/sound.h" - // wxSound used to be called wxWave before wxWidgets 2.5.1: - typedef wxSound wxWave; -#else - #error "wx/wave.h is only available in compatibility mode" -#endif - -#endif - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wave.h +// Purpose: wxSound compatibility header +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/02/01 +// RCS-ID: $Id: wave.h 32852 2005-03-16 16:18:31Z ABX $ +// Copyright: (c) 2004, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WAVE_H_BASE_ +#define _WX_WAVE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SOUND + +#if WXWIN_COMPATIBILITY_2_4 +#if defined(__DMC__) || defined(__BORLANDC__) + #pragma message "wx/wave.h header is deprecated, use wx/sound.h and wxSound" +#elif defined(__WATCOMC__) || defined(__VISUALC__) + #pragma message ("wx/wave.h header is deprecated, use wx/sound.h and wxSound") +#else + #warning "wx/wave.h header is deprecated, use wx/sound.h and wxSound" +#endif + #include "wx/sound.h" + // wxSound used to be called wxWave before wxWidgets 2.5.1: + typedef wxSound wxWave; +#else + #error "wx/wave.h is only available in compatibility mode" +#endif + +#endif + +#endif diff --git a/Externals/wxWidgets/include/wx/wfstream.h b/Externals/wxWidgets/include/wx/wfstream.h index 258e13c472..9d4a441052 100644 --- a/Externals/wxWidgets/include/wx/wfstream.h +++ b/Externals/wxWidgets/include/wx/wfstream.h @@ -1,204 +1,204 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wfstream.h -// Purpose: File stream classes -// Author: Guilhem Lavaux -// Modified by: -// Created: 11/07/98 -// RCS-ID: $Id: wfstream.h 44013 2006-12-19 13:49:26Z SC $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXFSTREAM_H__ -#define _WX_WXFSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_STREAMS - -#include "wx/object.h" -#include "wx/string.h" -#include "wx/stream.h" -#include "wx/file.h" -#include "wx/ffile.h" - -#if wxUSE_FILE - -// ---------------------------------------------------------------------------- -// wxFileStream using wxFile -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFileInputStream : public wxInputStream -{ -public: - wxFileInputStream(const wxString& ifileName); - wxFileInputStream(wxFile& file); - wxFileInputStream(int fd); - virtual ~wxFileInputStream(); - - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFileInputStream(); - - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFileInputStream) -}; - -class WXDLLIMPEXP_BASE wxFileOutputStream : public wxOutputStream -{ -public: - wxFileOutputStream(const wxString& fileName); - wxFileOutputStream(wxFile& file); - wxFileOutputStream(int fd); - virtual ~wxFileOutputStream(); - - void Sync(); - bool Close() { return m_file_destroy ? m_file->Close() : true; } - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFileOutputStream(); - - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFileOutputStream) -}; - -class WXDLLIMPEXP_BASE wxTempFileOutputStream : public wxOutputStream -{ -public: - wxTempFileOutputStream(const wxString& fileName); - virtual ~wxTempFileOutputStream(); - - bool Close() { return Commit(); } - virtual bool Commit() { return m_file->Commit(); } - virtual void Discard() { m_file->Discard(); } - - wxFileOffset GetLength() const { return m_file->Length(); } - bool IsSeekable() const { return true; } - -protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) - { return m_file->Seek(pos, mode); } - wxFileOffset OnSysTell() const { return m_file->Tell(); } - -private: - wxTempFile *m_file; - - DECLARE_NO_COPY_CLASS(wxTempFileOutputStream) -}; - -class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, - public wxFileOutputStream -{ -public: - wxFileStream(const wxString& fileName); - -private: - DECLARE_NO_COPY_CLASS(wxFileStream) -}; - -#endif //wxUSE_FILE - -#if wxUSE_FFILE - -// ---------------------------------------------------------------------------- -// wxFFileStream using wxFFile -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxFFileInputStream : public wxInputStream -{ -public: - wxFFileInputStream(const wxString& fileName, const wxChar *mode = _T("rb")); - wxFFileInputStream(wxFFile& file); - wxFFileInputStream(FILE *file); - virtual ~wxFFileInputStream(); - - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFFileInputStream(); - - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFFileInputStream) -}; - -class WXDLLIMPEXP_BASE wxFFileOutputStream : public wxOutputStream -{ -public: - wxFFileOutputStream(const wxString& fileName, const wxChar *mode = _T("w+b")); - wxFFileOutputStream(wxFFile& file); - wxFFileOutputStream(FILE *file); - virtual ~wxFFileOutputStream(); - - void Sync(); - bool Close() { return m_file_destroy ? m_file->Close() : true; } - wxFileOffset GetLength() const; - - bool Ok() const { return IsOk(); } - virtual bool IsOk() const ; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } - -protected: - wxFFileOutputStream(); - - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; - -protected: - wxFFile *m_file; - bool m_file_destroy; - - DECLARE_NO_COPY_CLASS(wxFFileOutputStream) -}; - -class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream, - public wxFFileOutputStream -{ -public: - wxFFileStream(const wxString& fileName); - -private: - DECLARE_NO_COPY_CLASS(wxFFileStream) -}; - -#endif //wxUSE_FFILE - -#endif // wxUSE_STREAMS - -#endif // _WX_WXFSTREAM_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wfstream.h +// Purpose: File stream classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 11/07/98 +// RCS-ID: $Id: wfstream.h 44013 2006-12-19 13:49:26Z SC $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXFSTREAM_H__ +#define _WX_WXFSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/stream.h" +#include "wx/file.h" +#include "wx/ffile.h" + +#if wxUSE_FILE + +// ---------------------------------------------------------------------------- +// wxFileStream using wxFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileInputStream : public wxInputStream +{ +public: + wxFileInputStream(const wxString& ifileName); + wxFileInputStream(wxFile& file); + wxFileInputStream(int fd); + virtual ~wxFileInputStream(); + + wxFileOffset GetLength() const; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + +protected: + wxFileInputStream(); + + size_t OnSysRead(void *buffer, size_t size); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + +protected: + wxFile *m_file; + bool m_file_destroy; + + DECLARE_NO_COPY_CLASS(wxFileInputStream) +}; + +class WXDLLIMPEXP_BASE wxFileOutputStream : public wxOutputStream +{ +public: + wxFileOutputStream(const wxString& fileName); + wxFileOutputStream(wxFile& file); + wxFileOutputStream(int fd); + virtual ~wxFileOutputStream(); + + void Sync(); + bool Close() { return m_file_destroy ? m_file->Close() : true; } + wxFileOffset GetLength() const; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + +protected: + wxFileOutputStream(); + + size_t OnSysWrite(const void *buffer, size_t size); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + +protected: + wxFile *m_file; + bool m_file_destroy; + + DECLARE_NO_COPY_CLASS(wxFileOutputStream) +}; + +class WXDLLIMPEXP_BASE wxTempFileOutputStream : public wxOutputStream +{ +public: + wxTempFileOutputStream(const wxString& fileName); + virtual ~wxTempFileOutputStream(); + + bool Close() { return Commit(); } + virtual bool Commit() { return m_file->Commit(); } + virtual void Discard() { m_file->Discard(); } + + wxFileOffset GetLength() const { return m_file->Length(); } + bool IsSeekable() const { return true; } + +protected: + size_t OnSysWrite(const void *buffer, size_t size); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) + { return m_file->Seek(pos, mode); } + wxFileOffset OnSysTell() const { return m_file->Tell(); } + +private: + wxTempFile *m_file; + + DECLARE_NO_COPY_CLASS(wxTempFileOutputStream) +}; + +class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, + public wxFileOutputStream +{ +public: + wxFileStream(const wxString& fileName); + +private: + DECLARE_NO_COPY_CLASS(wxFileStream) +}; + +#endif //wxUSE_FILE + +#if wxUSE_FFILE + +// ---------------------------------------------------------------------------- +// wxFFileStream using wxFFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFFileInputStream : public wxInputStream +{ +public: + wxFFileInputStream(const wxString& fileName, const wxChar *mode = _T("rb")); + wxFFileInputStream(wxFFile& file); + wxFFileInputStream(FILE *file); + virtual ~wxFFileInputStream(); + + wxFileOffset GetLength() const; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + +protected: + wxFFileInputStream(); + + size_t OnSysRead(void *buffer, size_t size); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + +protected: + wxFFile *m_file; + bool m_file_destroy; + + DECLARE_NO_COPY_CLASS(wxFFileInputStream) +}; + +class WXDLLIMPEXP_BASE wxFFileOutputStream : public wxOutputStream +{ +public: + wxFFileOutputStream(const wxString& fileName, const wxChar *mode = _T("w+b")); + wxFFileOutputStream(wxFFile& file); + wxFFileOutputStream(FILE *file); + virtual ~wxFFileOutputStream(); + + void Sync(); + bool Close() { return m_file_destroy ? m_file->Close() : true; } + wxFileOffset GetLength() const; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const ; + bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + +protected: + wxFFileOutputStream(); + + size_t OnSysWrite(const void *buffer, size_t size); + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + wxFileOffset OnSysTell() const; + +protected: + wxFFile *m_file; + bool m_file_destroy; + + DECLARE_NO_COPY_CLASS(wxFFileOutputStream) +}; + +class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream, + public wxFFileOutputStream +{ +public: + wxFFileStream(const wxString& fileName); + +private: + DECLARE_NO_COPY_CLASS(wxFFileStream) +}; + +#endif //wxUSE_FFILE + +#endif // wxUSE_STREAMS + +#endif // _WX_WXFSTREAM_H__ diff --git a/Externals/wxWidgets/include/wx/window.h b/Externals/wxWidgets/include/wx/window.h index acb4908e05..3e9e302064 100644 --- a/Externals/wxWidgets/include/wx/window.h +++ b/Externals/wxWidgets/include/wx/window.h @@ -1,1656 +1,1656 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/window.h -// Purpose: wxWindowBase class - the interface of wxWindow -// Author: Vadim Zeitlin -// Modified by: Ron Lee -// Created: 01/02/97 -// RCS-ID: $Id: window.h 52330 2008-03-05 14:19:38Z VS $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WINDOW_H_BASE_ -#define _WX_WINDOW_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers which we must include here -// ---------------------------------------------------------------------------- - -#include "wx/event.h" // the base class - -#include "wx/list.h" // defines wxWindowList - -#include "wx/cursor.h" // we have member variables of these classes -#include "wx/font.h" // so we can't do without them -#include "wx/colour.h" -#include "wx/region.h" -#include "wx/utils.h" -#include "wx/intl.h" - -#include "wx/validate.h" // for wxDefaultValidator (always include it) - -#if wxUSE_PALETTE - #include "wx/palette.h" -#endif // wxUSE_PALETTE - -#if wxUSE_ACCEL - #include "wx/accel.h" -#endif // wxUSE_ACCEL - -#if wxUSE_ACCESSIBILITY -#include "wx/access.h" -#endif - -// when building wxUniv/Foo we don't want the code for native menu use to be -// compiled in - it should only be used when building real wxFoo -#ifdef __WXUNIVERSAL__ - #define wxUSE_MENUS_NATIVE 0 -#else // !__WXUNIVERSAL__ - #define wxUSE_MENUS_NATIVE wxUSE_MENUS -#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ - -// ---------------------------------------------------------------------------- -// forward declarations -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxCaret; -class WXDLLIMPEXP_FWD_CORE wxControl; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxDropTarget; -class WXDLLIMPEXP_FWD_CORE wxItemResource; -class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; -class WXDLLIMPEXP_FWD_CORE wxResourceTable; -class WXDLLIMPEXP_FWD_CORE wxSizer; -class WXDLLIMPEXP_FWD_CORE wxToolTip; -class WXDLLIMPEXP_FWD_CORE wxWindowBase; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxScrollHelper; - -#if wxUSE_ACCESSIBILITY -class WXDLLIMPEXP_FWD_CORE wxAccessible; -#endif - -// ---------------------------------------------------------------------------- -// helper stuff used by wxWindow -// ---------------------------------------------------------------------------- - -// struct containing all the visual attributes of a control -struct WXDLLEXPORT wxVisualAttributes -{ - // the font used for control label/text inside it - wxFont font; - - // the foreground colour - wxColour colFg; - - // the background colour, may be wxNullColour if the controls background - // colour is not solid - wxColour colBg; -}; - -// different window variants, on platforms like eg mac uses different -// rendering sizes -enum wxWindowVariant -{ - wxWINDOW_VARIANT_NORMAL, // Normal size - wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal) - wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal) - wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal) - wxWINDOW_VARIANT_MAX -}; - -#if wxUSE_SYSTEM_OPTIONS - #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant") -#endif - -// ---------------------------------------------------------------------------- -// (pseudo)template list classes -// ---------------------------------------------------------------------------- - -WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT); - -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -extern WXDLLEXPORT_DATA(wxWindowList) wxTopLevelWindows; -extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; - -// ---------------------------------------------------------------------------- -// wxWindowBase is the base class for all GUI controls/widgets, this is the public -// interface of this class. -// -// Event handler: windows have themselves as their event handlers by default, -// but their event handlers could be set to another object entirely. This -// separation can reduce the amount of derivation required, and allow -// alteration of a window's functionality (e.g. by a resource editor that -// temporarily switches event handlers). -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowBase : public wxEvtHandler -{ -public: - // creating the window - // ------------------- - - // default ctor, initializes everything which can be initialized before - // Create() - wxWindowBase() ; - - // pseudo ctor (can't be virtual, called from ctor) - bool CreateBase(wxWindowBase *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPanelNameStr); - - virtual ~wxWindowBase(); - - // deleting the window - // ------------------- - - // ask the window to close itself, return true if the event handler - // honoured our request - bool Close( bool force = false ); - - // the following functions delete the C++ objects (the window itself - // or its children) as well as the GUI windows and normally should - // never be used directly - - // delete window unconditionally (dangerous!), returns true if ok - virtual bool Destroy(); - // delete all children of this window, returns true if ok - bool DestroyChildren(); - - // is the window being deleted? - bool IsBeingDeleted() const { return m_isBeingDeleted; } - - // window attributes - // ----------------- - - // label is just the same as the title (but for, e.g., buttons it - // makes more sense to speak about labels), title access - // is available from wxTLW classes only (frames, dialogs) - virtual void SetLabel(const wxString& label) = 0; - virtual wxString GetLabel() const = 0; - - // the window name is used for ressource setting in X, it is not the - // same as the window title/label - virtual void SetName( const wxString &name ) { m_windowName = name; } - virtual wxString GetName() const { return m_windowName; } - - // sets the window variant, calls internally DoSetVariant if variant - // has changed - void SetWindowVariant(wxWindowVariant variant); - wxWindowVariant GetWindowVariant() const { return m_windowVariant; } - - - // window id uniquely identifies the window among its siblings unless - // it is wxID_ANY which means "don't care" - void SetId( wxWindowID winid ) { m_windowId = winid; } - wxWindowID GetId() const { return m_windowId; } - - // get or change the layout direction (LTR or RTL) for this window, - // wxLayout_Default is returned if layout direction is not supported - virtual wxLayoutDirection GetLayoutDirection() const - { return wxLayout_Default; } - virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) - { } - - // mirror coordinates for RTL layout if this window uses it and if the - // mirroring is not done automatically like Win32 - virtual wxCoord AdjustForLayoutDirection(wxCoord x, - wxCoord width, - wxCoord widthTotal) const; - - // generate a control id for the controls which were not given one by - // user - static int NewControlId() { return --ms_lastControlId; } - // get the id of the control following the one with the given - // (autogenerated) id - static int NextControlId(int winid) { return winid - 1; } - // get the id of the control preceding the one with the given - // (autogenerated) id - static int PrevControlId(int winid) { return winid + 1; } - - // moving/resizing - // --------------- - - // set the window size and/or position - void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ) - { DoSetSize(x, y, width, height, sizeFlags); } - - void SetSize( int width, int height ) - { DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); } - - void SetSize( const wxSize& size ) - { SetSize( size.x, size.y); } - - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } - - void Move(int x, int y, int flags = wxSIZE_USE_EXISTING) - { DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); } - - void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING) - { Move(pt.x, pt.y, flags); } - - void SetPosition(const wxPoint& pt) { Move(pt); } - - // Z-order - virtual void Raise() = 0; - virtual void Lower() = 0; - - // client size is the size of area available for subwindows - void SetClientSize( int width, int height ) - { DoSetClientSize(width, height); } - - void SetClientSize( const wxSize& size ) - { DoSetClientSize(size.x, size.y); } - - void SetClientSize(const wxRect& rect) - { SetClientSize( rect.width, rect.height ); } - - // get the window position (pointers may be NULL): notice that it is in - // client coordinates for child windows and screen coordinates for the - // top level ones, use GetScreenPosition() if you need screen - // coordinates for all kinds of windows - void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); } - wxPoint GetPosition() const - { - int x, y; - DoGetPosition(&x, &y); - - return wxPoint(x, y); - } - - // get the window position in screen coordinates - void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); } - wxPoint GetScreenPosition() const - { - int x, y; - DoGetScreenPosition(&x, &y); - - return wxPoint(x, y); - } - - // get the window size (pointers may be NULL) - void GetSize( int *w, int *h ) const { DoGetSize(w, h); } - wxSize GetSize() const - { - int w, h; - DoGetSize(& w, & h); - return wxSize(w, h); - } - - void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); } - wxSize GetClientSize() const - { - int w, h; - DoGetClientSize(&w, &h); - - return wxSize(w, h); - } - - // get the position and size at once - wxRect GetRect() const - { - int x, y, w, h; - GetPosition(&x, &y); - GetSize(&w, &h); - - return wxRect(x, y, w, h); - } - - wxRect GetScreenRect() const - { - int x, y, w, h; - GetScreenPosition(&x, &y); - GetSize(&w, &h); - - return wxRect(x, y, w, h); - } - - // get the origin of the client area of the window relative to the - // window top left corner (the client area may be shifted because of - // the borders, scrollbars, other decorations...) - virtual wxPoint GetClientAreaOrigin() const; - - // get the client rectangle in window (i.e. client) coordinates - wxRect GetClientRect() const - { - return wxRect(GetClientAreaOrigin(), GetClientSize()); - } - -#if wxABI_VERSION >= 20808 - // client<->window size conversion - wxSize ClientToWindowSize(const wxSize& size) const; - wxSize WindowToClientSize(const wxSize& size) const; -#endif - - // get the size best suited for the window (in fact, minimal - // acceptable size using which it will still look "nice" in - // most situations) - wxSize GetBestSize() const - { - if (m_bestSizeCache.IsFullySpecified()) - return m_bestSizeCache; - return DoGetBestSize(); - } - void GetBestSize(int *w, int *h) const - { - wxSize s = GetBestSize(); - if ( w ) - *w = s.x; - if ( h ) - *h = s.y; - } - - void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; } - wxScrollHelper *GetScrollHelper() { return m_scrollHelper; } - - // reset the cached best size value so it will be recalculated the - // next time it is needed. - void InvalidateBestSize(); - void CacheBestSize(const wxSize& size) const - { wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; } - - - // This function will merge the window's best size into the window's - // minimum size, giving priority to the min size components, and - // returns the results. - wxSize GetEffectiveMinSize() const; - wxDEPRECATED( wxSize GetBestFittingSize() const ); // replaced by GetEffectiveMinSize - wxDEPRECATED( wxSize GetAdjustedMinSize() const ); // replaced by GetEffectiveMinSize - - // A 'Smart' SetSize that will fill in default size values with 'best' - // size. Sets the minsize to what was passed in. - void SetInitialSize(const wxSize& size=wxDefaultSize); - wxDEPRECATED( void SetBestFittingSize(const wxSize& size=wxDefaultSize) ); // replaced by SetInitialSize - - - // the generic centre function - centers the window on parent by` - // default or on screen if it doesn't have parent or - // wxCENTER_ON_SCREEN flag is given - void Centre(int dir = wxBOTH) { DoCentre(dir); } - void Center(int dir = wxBOTH) { DoCentre(dir); } - - // centre with respect to the the parent window - void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); } - void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); } - - // set window size to wrap around its children - virtual void Fit(); - - // set virtual size to satisfy children - virtual void FitInside(); - - - // SetSizeHints is actually for setting the size hints - // for the wxTLW for a Window Manager - hence the name - - // and it is therefore overridden in wxTLW to do that. - // In wxWindow(Base), it has (unfortunately) been abused - // to mean the same as SetMinSize() and SetMaxSize(). - - virtual void SetSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, - int incW = wxDefaultCoord, int incH = wxDefaultCoord ) - { DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); } - - void SetSizeHints( const wxSize& minSize, - const wxSize& maxSize=wxDefaultSize, - const wxSize& incSize=wxDefaultSize) - { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); } - - virtual void DoSetSizeHints( int minW, int minH, - int maxW, int maxH, - int incW, int incH ); - - // Methods for setting virtual size hints - // FIXME: What are virtual size hints? - - virtual void SetVirtualSizeHints( int minW, int minH, - int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ); - void SetVirtualSizeHints( const wxSize& minSize, - const wxSize& maxSize=wxDefaultSize) - { - SetVirtualSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y); - } - - - // Call these to override what GetBestSize() returns. This - // method is only virtual because it is overriden in wxTLW - // as a different API for SetSizeHints(). - virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; } - virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; } - - // Override these methods to impose restrictions on min/max size. - // The easier way is to call SetMinSize() and SetMaxSize() which - // will have the same effect. Doing both is non-sense. - virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); } - virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); } - - // Get the min and max values one by one - int GetMinWidth() const { return GetMinSize().x; } - int GetMinHeight() const { return GetMinSize().y; } - int GetMaxWidth() const { return GetMaxSize().x; } - int GetMaxHeight() const { return GetMaxSize().y; } - - - // Methods for accessing the virtual size of a window. For most - // windows this is just the client area of the window, but for - // some like scrolled windows it is more or less independent of - // the screen window size. You may override the DoXXXVirtual - // methods below for classes where that is is the case. - - void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } - void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } - - wxSize GetVirtualSize() const { return DoGetVirtualSize(); } - void GetVirtualSize( int *x, int *y ) const - { - wxSize s( DoGetVirtualSize() ); - - if( x ) - *x = s.GetWidth(); - if( y ) - *y = s.GetHeight(); - } - - // Override these methods for windows that have a virtual size - // independent of their client size. eg. the virtual area of a - // wxScrolledWindow. - - virtual void DoSetVirtualSize( int x, int y ); - virtual wxSize DoGetVirtualSize() const; - - // Return the largest of ClientSize and BestSize (as determined - // by a sizer, interior children, or other means) - - virtual wxSize GetBestVirtualSize() const - { - wxSize client( GetClientSize() ); - wxSize best( GetBestSize() ); - - return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) ); - } - - // return the size of the left/right and top/bottom borders in x and y - // components of the result respectively - virtual wxSize GetWindowBorderSize() const; - - - // window state - // ------------ - - // returns true if window was shown/hidden, false if the nothing was - // done (window was already shown/hidden) - virtual bool Show( bool show = true ); - bool Hide() { return Show(false); } - - // returns true if window was enabled/disabled, false if nothing done - virtual bool Enable( bool enable = true ); - bool Disable() { return Enable(false); } - - virtual bool IsShown() const { return m_isShown; } - virtual bool IsEnabled() const { return m_isEnabled; } - - // returns true if the window is visible, i.e. IsShown() returns true - // if called on it and all its parents up to the first TLW - virtual bool IsShownOnScreen() const; - - // get/set window style (setting style won't update the window and so - // is only useful for internal usage) - virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; } - virtual long GetWindowStyleFlag() const { return m_windowStyle; } - - // just some (somewhat shorter) synonims - void SetWindowStyle( long style ) { SetWindowStyleFlag(style); } - long GetWindowStyle() const { return GetWindowStyleFlag(); } - - // check if the flag is set - bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; } - virtual bool IsRetained() const { return HasFlag(wxRETAINED); } - - // turn the flag on if it had been turned off before and vice versa, - // return true if the flag is currently turned on - bool ToggleWindowStyle(int flag); - - // extra style: the less often used style bits which can't be set with - // SetWindowStyleFlag() - virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } - long GetExtraStyle() const { return m_exStyle; } - - // make the window modal (all other windows unresponsive) - virtual void MakeModal(bool modal = true); - - - // (primitive) theming support - // --------------------------- - - virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; } - virtual bool GetThemeEnabled() const { return m_themeEnabled; } - - - // focus and keyboard handling - // --------------------------- - - // set focus to this window - virtual void SetFocus() = 0; - - // set focus to this window as the result of a keyboard action - virtual void SetFocusFromKbd() { SetFocus(); } - - // return the window which currently has the focus or NULL - static wxWindow *FindFocus(); - - static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; - - // can this window have focus? - virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); } - - // can this window be given focus by keyboard navigation? if not, the - // only way to give it focus (provided it accepts it at all) is to - // click it - virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); } - - // navigates in the specified direction by sending a wxNavigationKeyEvent - virtual bool Navigate(int flags = wxNavigationKeyEvent::IsForward); - - // move this window just before/after the specified one in tab order - // (the other window must be our sibling!) - void MoveBeforeInTabOrder(wxWindow *win) - { DoMoveInTabOrder(win, MoveBefore); } - void MoveAfterInTabOrder(wxWindow *win) - { DoMoveInTabOrder(win, MoveAfter); } - - - // parent/children relations - // ------------------------- - - // get the list of children - const wxWindowList& GetChildren() const { return m_children; } - wxWindowList& GetChildren() { return m_children; } - - // needed just for extended runtime - const wxWindowList& GetWindowChildren() const { return GetChildren() ; } - -#if wxABI_VERSION >= 20808 - // get the window before/after this one in the parents children list, - // returns NULL if this is the first/last window - wxWindow *GetPrevSibling() const { return DoGetSibling(MoveBefore); } - wxWindow *GetNextSibling() const { return DoGetSibling(MoveAfter); } -#endif // wx 2.8.8+ - - // get the parent or the parent of the parent - wxWindow *GetParent() const { return m_parent; } - inline wxWindow *GetGrandParent() const; - - // is this window a top level one? - virtual bool IsTopLevel() const; - - // it doesn't really change parent, use Reparent() instead - void SetParent( wxWindowBase *parent ) { m_parent = (wxWindow *)parent; } - // change the real parent of this window, return true if the parent - // was changed, false otherwise (error or newParent == oldParent) - virtual bool Reparent( wxWindowBase *newParent ); - - // implementation mostly - virtual void AddChild( wxWindowBase *child ); - virtual void RemoveChild( wxWindowBase *child ); - - // looking for windows - // ------------------- - - // find window among the descendants of this one either by id or by - // name (return NULL if not found) - wxWindow *FindWindow(long winid) const; - wxWindow *FindWindow(const wxString& name) const; - - // Find a window among any window (all return NULL if not found) - static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL ); - static wxWindow *FindWindowByName( const wxString& name, - const wxWindow *parent = NULL ); - static wxWindow *FindWindowByLabel( const wxString& label, - const wxWindow *parent = NULL ); - - // event handler stuff - // ------------------- - - // get the current event handler - wxEvtHandler *GetEventHandler() const { return m_eventHandler; } - - // replace the event handler (allows to completely subclass the - // window) - void SetEventHandler( wxEvtHandler *handler ) { m_eventHandler = handler; } - - // push/pop event handler: allows to chain a custom event handler to - // alreasy existing ones - void PushEventHandler( wxEvtHandler *handler ); - wxEvtHandler *PopEventHandler( bool deleteHandler = false ); - - // find the given handler in the event handler chain and remove (but - // not delete) it from the event handler chain, return true if it was - // found and false otherwise (this also results in an assert failure so - // this function should only be called when the handler is supposed to - // be there) - bool RemoveEventHandler(wxEvtHandler *handler); - - // validators - // ---------- - -#if wxUSE_VALIDATORS - // a window may have an associated validator which is used to control - // user input - virtual void SetValidator( const wxValidator &validator ); - virtual wxValidator *GetValidator() { return m_windowValidator; } -#endif // wxUSE_VALIDATORS - - - // dialog oriented functions - // ------------------------- - - // validate the correctness of input, return true if ok - virtual bool Validate(); - - // transfer data between internal and GUI representations - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); - - virtual void InitDialog(); - -#if wxUSE_ACCEL - // accelerators - // ------------ - virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) - { m_acceleratorTable = accel; } - wxAcceleratorTable *GetAcceleratorTable() - { return &m_acceleratorTable; } - -#endif // wxUSE_ACCEL - -#if wxUSE_HOTKEY - // hot keys (system wide accelerators) - // ----------------------------------- - - virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); - virtual bool UnregisterHotKey(int hotkeyId); -#endif // wxUSE_HOTKEY - - - // dialog units translations - // ------------------------- - - wxPoint ConvertPixelsToDialog( const wxPoint& pt ); - wxPoint ConvertDialogToPixels( const wxPoint& pt ); - wxSize ConvertPixelsToDialog( const wxSize& sz ) - { - wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); - - return wxSize(pt.x, pt.y); - } - - wxSize ConvertDialogToPixels( const wxSize& sz ) - { - wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); - - return wxSize(pt.x, pt.y); - } - - // mouse functions - // --------------- - - // move the mouse to the specified position - virtual void WarpPointer(int x, int y) = 0; - - // start or end mouse capture, these functions maintain the stack of - // windows having captured the mouse and after calling ReleaseMouse() - // the mouse is not released but returns to the window which had had - // captured it previously (if any) - void CaptureMouse(); - void ReleaseMouse(); - - // get the window which currently captures the mouse or NULL - static wxWindow *GetCapture(); - - // does this window have the capture? - virtual bool HasCapture() const - { return (wxWindow *)this == GetCapture(); } - - // painting the window - // ------------------- - - // mark the specified rectangle (or the whole window) as "dirty" so it - // will be repainted - virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) = 0; - - // a less awkward wrapper for Refresh - void RefreshRect(const wxRect& rect, bool eraseBackground = true) - { - Refresh(eraseBackground, &rect); - } - - // repaint all invalid areas of the window immediately - virtual void Update() { } - - // clear the window background - virtual void ClearBackground(); - - // freeze the window: don't redraw it until it is thawed - virtual void Freeze() { } - - // thaw the window: redraw it after it had been frozen - virtual void Thaw() { } - - // return true if window had been frozen and not unthawed yet - virtual bool IsFrozen() const { return false; } - - // adjust DC for drawing on this window - virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { } - - // return true if the window contents is double buffered by the system - virtual bool IsDoubleBuffered() const { return false; } - - // the update region of the window contains the areas which must be - // repainted by the program - const wxRegion& GetUpdateRegion() const { return m_updateRegion; } - wxRegion& GetUpdateRegion() { return m_updateRegion; } - - // get the update rectangleregion bounding box in client coords - wxRect GetUpdateClientRect() const; - - // these functions verify whether the given point/rectangle belongs to - // (or at least intersects with) the update region - virtual bool DoIsExposed( int x, int y ) const; - virtual bool DoIsExposed( int x, int y, int w, int h ) const; - - bool IsExposed( int x, int y ) const - { return DoIsExposed(x, y); } - bool IsExposed( int x, int y, int w, int h ) const - { return DoIsExposed(x, y, w, h); } - bool IsExposed( const wxPoint& pt ) const - { return DoIsExposed(pt.x, pt.y); } - bool IsExposed( const wxRect& rect ) const - { return DoIsExposed(rect.x, rect.y, rect.width, rect.height); } - - // colours, fonts and cursors - // -------------------------- - - // get the default attributes for the controls of this class: we - // provide a virtual function which can be used to query the default - // attributes of an existing control and a static function which can - // be used even when no existing object of the given class is - // available, but which won't return any styles specific to this - // particular control, of course (e.g. "Ok" button might have - // different -- bold for example -- font) - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // set/retrieve the window colours (system defaults are used by - // default): SetXXX() functions return true if colour was changed, - // SetDefaultXXX() reset the "m_inheritXXX" flag after setting the - // value to prevent it from being inherited by our children - virtual bool SetBackgroundColour(const wxColour& colour); - void SetOwnBackgroundColour(const wxColour& colour) - { - if ( SetBackgroundColour(colour) ) - m_inheritBgCol = false; - } - wxColour GetBackgroundColour() const; - bool InheritsBackgroundColour() const - { - return m_inheritBgCol; - } - bool UseBgCol() const - { - return m_hasBgCol; - } - - virtual bool SetForegroundColour(const wxColour& colour); - void SetOwnForegroundColour(const wxColour& colour) - { - if ( SetForegroundColour(colour) ) - m_inheritFgCol = false; - } - wxColour GetForegroundColour() const; - - // Set/get the background style. - // Pass one of wxBG_STYLE_SYSTEM, wxBG_STYLE_COLOUR, wxBG_STYLE_CUSTOM - virtual bool SetBackgroundStyle(wxBackgroundStyle style) { m_backgroundStyle = style; return true; } - virtual wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } - - // returns true if the control has "transparent" areas such as a - // wxStaticText and wxCheckBox and the background should be adapted - // from a parent window - virtual bool HasTransparentBackground() { return false; } - - // set/retrieve the font for the window (SetFont() returns true if the - // font really changed) - virtual bool SetFont(const wxFont& font) = 0; - void SetOwnFont(const wxFont& font) - { - if ( SetFont(font) ) - m_inheritFont = false; - } - wxFont GetFont() const; - - // set/retrieve the cursor for this window (SetCursor() returns true - // if the cursor was really changed) - virtual bool SetCursor( const wxCursor &cursor ); - const wxCursor& GetCursor() const { return m_cursor; } - -#if wxUSE_CARET - // associate a caret with the window - void SetCaret(wxCaret *caret); - // get the current caret (may be NULL) - wxCaret *GetCaret() const { return m_caret; } -#endif // wxUSE_CARET - - // get the (average) character size for the current font - virtual int GetCharHeight() const = 0; - virtual int GetCharWidth() const = 0; - - // get the width/height/... of the text using current or specified - // font - virtual void GetTextExtent(const wxString& string, - int *x, int *y, - int *descent = (int *) NULL, - int *externalLeading = (int *) NULL, - const wxFont *theFont = (const wxFont *) NULL) - const = 0; - - // client <-> screen coords - // ------------------------ - - // translate to/from screen/client coordinates (pointers may be NULL) - void ClientToScreen( int *x, int *y ) const - { DoClientToScreen(x, y); } - void ScreenToClient( int *x, int *y ) const - { DoScreenToClient(x, y); } - - // wxPoint interface to do the same thing - wxPoint ClientToScreen(const wxPoint& pt) const - { - int x = pt.x, y = pt.y; - DoClientToScreen(&x, &y); - - return wxPoint(x, y); - } - - wxPoint ScreenToClient(const wxPoint& pt) const - { - int x = pt.x, y = pt.y; - DoScreenToClient(&x, &y); - - return wxPoint(x, y); - } - - // test where the given (in client coords) point lies - wxHitTest HitTest(wxCoord x, wxCoord y) const - { return DoHitTest(x, y); } - - wxHitTest HitTest(const wxPoint& pt) const - { return DoHitTest(pt.x, pt.y); } - - // misc - // ---- - - // get the window border style from the given flags: this is different from - // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to - // translate wxBORDER_DEFAULT to something reasonable - wxBorder GetBorder(long flags) const; - - // get border for the flags of this window - wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); } - - // send wxUpdateUIEvents to this window, and children if recurse is true - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); - - // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; - -#if wxUSE_MENUS - bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) - { return DoPopupMenu(menu, pos.x, pos.y); } - bool PopupMenu(wxMenu *menu, int x, int y) - { return DoPopupMenu(menu, x, y); } -#endif // wxUSE_MENUS - - // override this method to return true for controls having multiple pages - virtual bool HasMultiplePages() const { return false; } - - - // scrollbars - // ---------- - - // does the window have the scrollbar for this orientation? - bool HasScrollbar(int orient) const - { - return (m_windowStyle & - (orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0; - } - - // configure the window scrollbars - virtual void SetScrollbar( int orient, - int pos, - int thumbvisible, - int range, - bool refresh = true ) = 0; - virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0; - virtual int GetScrollPos( int orient ) const = 0; - virtual int GetScrollThumb( int orient ) const = 0; - virtual int GetScrollRange( int orient ) const = 0; - - // scroll window to the specified position - virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = (wxRect *) NULL ) = 0; - - // scrolls window by line/page: note that not all controls support this - // - // return true if the position changed, false otherwise - virtual bool ScrollLines(int WXUNUSED(lines)) { return false; } - virtual bool ScrollPages(int WXUNUSED(pages)) { return false; } - - // convenient wrappers for ScrollLines/Pages - bool LineUp() { return ScrollLines(-1); } - bool LineDown() { return ScrollLines(1); } - bool PageUp() { return ScrollPages(-1); } - bool PageDown() { return ScrollPages(1); } - - // context-sensitive help - // ---------------------- - - // these are the convenience functions wrapping wxHelpProvider methods - -#if wxUSE_HELP - // associate this help text with this window - void SetHelpText(const wxString& text); - // associate this help text with all windows with the same id as this - // one - void SetHelpTextForId(const wxString& text); - // get the help string associated with the given position in this window - // - // notice that pt may be invalid if event origin is keyboard or unknown - // and this method should return the global window help text then - virtual wxString GetHelpTextAtPoint(const wxPoint& pt, - wxHelpEvent::Origin origin) const; - // returns the position-independent help text - wxString GetHelpText() const - { - return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown); - } - -#else // !wxUSE_HELP - // silently ignore SetHelpText() calls - void SetHelpText(const wxString& WXUNUSED(text)) { } - void SetHelpTextForId(const wxString& WXUNUSED(text)) { } -#endif // wxUSE_HELP - - // tooltips - // -------- - -#if wxUSE_TOOLTIPS - // the easiest way to set a tooltip for a window is to use this method - void SetToolTip( const wxString &tip ); - // attach a tooltip to the window - void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } - // get the associated tooltip or NULL if none - wxToolTip* GetToolTip() const { return m_tooltip; } - wxString GetToolTipText() const ; -#else - // make it much easier to compile apps in an environment - // that doesn't support tooltips, such as PocketPC - inline void SetToolTip( const wxString & WXUNUSED(tip) ) {} -#endif // wxUSE_TOOLTIPS - - // drag and drop - // ------------- -#if wxUSE_DRAG_AND_DROP - // set/retrieve the drop target associated with this window (may be - // NULL; it's owned by the window and will be deleted by it) - virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; - virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } -#endif // wxUSE_DRAG_AND_DROP - - // constraints and sizers - // ---------------------- -#if wxUSE_CONSTRAINTS - // set the constraints for this window or retrieve them (may be NULL) - void SetConstraints( wxLayoutConstraints *constraints ); - wxLayoutConstraints *GetConstraints() const { return m_constraints; } - - // implementation only - void UnsetConstraints(wxLayoutConstraints *c); - wxWindowList *GetConstraintsInvolvedIn() const - { return m_constraintsInvolvedIn; } - void AddConstraintReference(wxWindowBase *otherWin); - void RemoveConstraintReference(wxWindowBase *otherWin); - void DeleteRelatedConstraints(); - void ResetConstraints(); - - // these methods may be overridden for special layout algorithms - virtual void SetConstraintSizes(bool recurse = true); - virtual bool LayoutPhase1(int *noChanges); - virtual bool LayoutPhase2(int *noChanges); - virtual bool DoPhase(int phase); - - // these methods are virtual but normally won't be overridden - virtual void SetSizeConstraint(int x, int y, int w, int h); - virtual void MoveConstraint(int x, int y); - virtual void GetSizeConstraint(int *w, int *h) const ; - virtual void GetClientSizeConstraint(int *w, int *h) const ; - virtual void GetPositionConstraint(int *x, int *y) const ; - -#endif // wxUSE_CONSTRAINTS - - // when using constraints or sizers, it makes sense to update - // children positions automatically whenever the window is resized - // - this is done if autoLayout is on - void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; } - bool GetAutoLayout() const { return m_autoLayout; } - - // lay out the window and its children - virtual bool Layout(); - - // sizers - void SetSizer(wxSizer *sizer, bool deleteOld = true ); - void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ); - - wxSizer *GetSizer() const { return m_windowSizer; } - - // Track if this window is a member of a sizer - void SetContainingSizer(wxSizer* sizer); - wxSizer *GetContainingSizer() const { return m_containingSizer; } - - // accessibility - // ---------------------- -#if wxUSE_ACCESSIBILITY - // Override to create a specific accessible object. - virtual wxAccessible* CreateAccessible(); - - // Sets the accessible object. - void SetAccessible(wxAccessible* accessible) ; - - // Returns the accessible object. - wxAccessible* GetAccessible() { return m_accessible; } - - // Returns the accessible object, creating if necessary. - wxAccessible* GetOrCreateAccessible() ; -#endif - - - // Set window transparency if the platform supports it - virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; } - virtual bool CanSetTransparent() { return false; } - - - // implementation - // -------------- - - // event handlers - void OnSysColourChanged( wxSysColourChangedEvent& event ); - void OnInitDialog( wxInitDialogEvent &event ); - void OnMiddleClick( wxMouseEvent& event ); -#if wxUSE_HELP - void OnHelp(wxHelpEvent& event); -#endif // wxUSE_HELP - - // virtual function for implementing internal idle - // behaviour - virtual void OnInternalIdle() {} - - // call internal idle recursively -// void ProcessInternalIdle() ; - - // get the handle of the window for the underlying window system: this - // is only used for wxWin itself or for user code which wants to call - // platform-specific APIs - virtual WXWidget GetHandle() const = 0; - // associate the window with a new native handle - virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { } - // dissociate the current native handle from the window - virtual void DissociateHandle() { } - -#if wxUSE_PALETTE - // Store the palette used by DCs in wxWindow so that the dcs can share - // a palette. And we can respond to palette messages. - wxPalette GetPalette() const { return m_palette; } - - // When palette is changed tell the DC to set the system palette to the - // new one. - void SetPalette(const wxPalette& pal); - - // return true if we have a specific palette - bool HasCustomPalette() const { return m_hasCustomPalette; } - - // return the first parent window with a custom palette or NULL - wxWindow *GetAncestorWithCustomPalette() const; -#endif // wxUSE_PALETTE - - // inherit the parents visual attributes if they had been explicitly set - // by the user (i.e. we don't inherit default attributes) and if we don't - // have our own explicitly set - virtual void InheritAttributes(); - - // returns false from here if this window doesn't want to inherit the - // parents colours even if InheritAttributes() would normally do it - // - // this just provides a simple way to customize InheritAttributes() - // behaviour in the most common case - virtual bool ShouldInheritColours() const { return false; } - -protected: - // event handling specific to wxWindow - virtual bool TryValidator(wxEvent& event); - virtual bool TryParent(wxEvent& event); - - enum MoveKind - { - MoveBefore, // insert before the given window - MoveAfter // insert after the given window - }; - -#if wxABI_VERSION >= 20808 - // common part of GetPrev/NextSibling() - wxWindow *DoGetSibling(MoveKind order) const; -#endif // wx 2.8.8+ - - // common part of MoveBefore/AfterInTabOrder() - virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move); - -#if wxUSE_CONSTRAINTS - // satisfy the constraints for the windows but don't set the window sizes - void SatisfyConstraints(); -#endif // wxUSE_CONSTRAINTS - - // Send the wxWindowDestroyEvent - void SendDestroyEvent(); - - // returns the main window of composite control; this is the window - // that FindFocus returns if the focus is in one of composite control's - // windows - virtual wxWindow *GetMainWindowOfCompositeControl() - { return (wxWindow*)this; } - - // the window id - a number which uniquely identifies a window among - // its siblings unless it is wxID_ANY - wxWindowID m_windowId; - - // the parent window of this window (or NULL) and the list of the children - // of this window - wxWindow *m_parent; - wxWindowList m_children; - - // the minimal allowed size for the window (no minimal size if variable(s) - // contain(s) wxDefaultCoord) - int m_minWidth, - m_minHeight, - m_maxWidth, - m_maxHeight; - - // event handler for this window: usually is just 'this' but may be - // changed with SetEventHandler() - wxEvtHandler *m_eventHandler; - -#if wxUSE_VALIDATORS - // associated validator or NULL if none - wxValidator *m_windowValidator; -#endif // wxUSE_VALIDATORS - -#if wxUSE_DRAG_AND_DROP - wxDropTarget *m_dropTarget; -#endif // wxUSE_DRAG_AND_DROP - - // visual window attributes - wxCursor m_cursor; - wxFont m_font; // see m_hasFont - wxColour m_backgroundColour, // m_hasBgCol - m_foregroundColour; // m_hasFgCol - -#if wxUSE_CARET - wxCaret *m_caret; -#endif // wxUSE_CARET - - // the region which should be repainted in response to paint event - wxRegion m_updateRegion; - -#if wxUSE_ACCEL - // the accelerator table for the window which translates key strokes into - // command events - wxAcceleratorTable m_acceleratorTable; -#endif // wxUSE_ACCEL - - // the tooltip for this window (may be NULL) -#if wxUSE_TOOLTIPS - wxToolTip *m_tooltip; -#endif // wxUSE_TOOLTIPS - - // constraints and sizers -#if wxUSE_CONSTRAINTS - // the constraints for this window or NULL - wxLayoutConstraints *m_constraints; - - // constraints this window is involved in - wxWindowList *m_constraintsInvolvedIn; -#endif // wxUSE_CONSTRAINTS - - // this window's sizer - wxSizer *m_windowSizer; - - // The sizer this window is a member of, if any - wxSizer *m_containingSizer; - - // Layout() window automatically when its size changes? - bool m_autoLayout:1; - - // window state - bool m_isShown:1; - bool m_isEnabled:1; - bool m_isBeingDeleted:1; - - // was the window colours/font explicitly changed by user? - bool m_hasBgCol:1; - bool m_hasFgCol:1; - bool m_hasFont:1; - - // and should it be inherited by children? - bool m_inheritBgCol:1; - bool m_inheritFgCol:1; - bool m_inheritFont:1; - - // window attributes - long m_windowStyle, - m_exStyle; - wxString m_windowName; - bool m_themeEnabled; - wxBackgroundStyle m_backgroundStyle; -#if wxUSE_PALETTE - wxPalette m_palette; - bool m_hasCustomPalette; -#endif // wxUSE_PALETTE - -#if wxUSE_ACCESSIBILITY - wxAccessible* m_accessible; -#endif - - // Virtual size (scrolling) - wxSize m_virtualSize; - - wxScrollHelper *m_scrollHelper; - - int m_minVirtualWidth; // VirtualSizeHints - int m_minVirtualHeight; - int m_maxVirtualWidth; - int m_maxVirtualHeight; - - wxWindowVariant m_windowVariant ; - - // override this to change the default (i.e. used when no style is - // specified) border for the window class - virtual wxBorder GetDefaultBorder() const; - - // Get the default size for the new window if no explicit size given. TLWs - // have their own default size so this is just for non top-level windows. - static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; } - static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; } - - - // Used to save the results of DoGetBestSize so it doesn't need to be - // recalculated each time the value is needed. - wxSize m_bestSizeCache; - - wxDEPRECATED( void SetBestSize(const wxSize& size) ); // use SetInitialSize - wxDEPRECATED( virtual void SetInitialBestSize(const wxSize& size) ); // use SetInitialSize - - - - // more pure virtual functions - // --------------------------- - - // NB: we must have DoSomething() function when Something() is an overloaded - // method: indeed, we can't just have "virtual Something()" in case when - // the function is overloaded because then we'd have to make virtual all - // the variants (otherwise only the virtual function may be called on a - // pointer to derived class according to C++ rules) which is, in - // general, absolutely not needed. So instead we implement all - // overloaded Something()s in terms of DoSomething() which will be the - // only one to be virtual. - - // coordinates translation - virtual void DoClientToScreen( int *x, int *y ) const = 0; - virtual void DoScreenToClient( int *x, int *y ) const = 0; - - virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; - - // capture/release the mouse, used by Capture/ReleaseMouse() - virtual void DoCaptureMouse() = 0; - virtual void DoReleaseMouse() = 0; - - // retrieve the position/size of the window - virtual void DoGetPosition(int *x, int *y) const = 0; - virtual void DoGetScreenPosition(int *x, int *y) const; - virtual void DoGetSize(int *width, int *height) const = 0; - virtual void DoGetClientSize(int *width, int *height) const = 0; - - // get the size which best suits the window: for a control, it would be - // the minimal size which doesn't truncate the control, for a panel - the - // same size as it would have after a call to Fit() - virtual wxSize DoGetBestSize() const; - - // called from DoGetBestSize() to convert best virtual size (returned by - // the window sizer) to the best size for the window itself; this is - // overridden at wxScrolledWindow level to clump down virtual size to real - virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const - { - return size; - } - - // this is the virtual function to be overriden in any derived class which - // wants to change how SetSize() or Move() works - it is called by all - // versions of these functions in the base class - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO) = 0; - - // same as DoSetSize() for the client size - virtual void DoSetClientSize(int width, int height) = 0; - - // move the window to the specified location and resize it: this is called - // from both DoSetSize() and DoSetClientSize() and would usually just - // reposition this window except for composite controls which will want to - // arrange themselves inside the given rectangle - // - // Important note: the coordinates passed to this method are in parent's - // *window* coordinates and not parent's client coordinates (as the values - // passed to DoSetSize and returned by DoGetPosition are)! - virtual void DoMoveWindow(int x, int y, int width, int height) = 0; - - // centre the window in the specified direction on parent, note that - // wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for - // TLWs - virtual void DoCentre(int dir); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif // wxUSE_TOOLTIPS - -#if wxUSE_MENUS - virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0; -#endif // wxUSE_MENUS - - // Makes an adjustment to the window position to make it relative to the - // parents client area, e.g. if the parent is a frame with a toolbar, its - // (0, 0) is just below the toolbar - virtual void AdjustForParentClientOrigin(int& x, int& y, - int sizeFlags = 0) const; - - // implements the window variants - virtual void DoSetWindowVariant( wxWindowVariant variant ) ; - - // Must be called when mouse capture is lost to send - // wxMouseCaptureLostEvent to windows on capture stack. - static void NotifyCaptureLost(); - -private: - // contains the last id generated by NewControlId - static int ms_lastControlId; - - // the stack of windows which have captured the mouse - static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext; - // the window that currently has mouse capture - static wxWindow *ms_winCaptureCurrent; - // indicates if execution is inside CaptureMouse/ReleaseMouse - static bool ms_winCaptureChanging; - - DECLARE_ABSTRACT_CLASS(wxWindowBase) - DECLARE_NO_COPY_CLASS(wxWindowBase) - DECLARE_EVENT_TABLE() -}; - - - -// Inlines for some deprecated methods -inline wxSize wxWindowBase::GetBestFittingSize() const -{ - return GetEffectiveMinSize(); -} - -inline void wxWindowBase::SetBestFittingSize(const wxSize& size) -{ - SetInitialSize(size); -} - -inline void wxWindowBase::SetBestSize(const wxSize& size) -{ - SetInitialSize(size); -} - -inline void wxWindowBase::SetInitialBestSize(const wxSize& size) -{ - SetInitialSize(size); -} - - -// ---------------------------------------------------------------------------- -// now include the declaration of wxWindow class -// ---------------------------------------------------------------------------- - -// include the declaration of the platform-specific class -#if defined(__WXPALMOS__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowPalm - #else // !wxUniv - #define wxWindowPalm wxWindow - #endif // wxUniv/!wxUniv - #include "wx/palmos/window.h" -#elif defined(__WXMSW__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowMSW - #else // !wxUniv - #define wxWindowMSW wxWindow - #endif // wxUniv/!wxUniv - #include "wx/msw/window.h" -#elif defined(__WXMOTIF__) - #include "wx/motif/window.h" -#elif defined(__WXGTK20__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowGTK - #else // !wxUniv - #define wxWindowGTK wxWindow - #endif // wxUniv - #include "wx/gtk/window.h" -#elif defined(__WXGTK__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowGTK - #else // !wxUniv - #define wxWindowGTK wxWindow - #endif // wxUniv - #include "wx/gtk1/window.h" -#elif defined(__WXX11__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowX11 - #else // !wxUniv - #define wxWindowX11 wxWindow - #endif // wxUniv - #include "wx/x11/window.h" -#elif defined(__WXMGL__) - #define wxWindowNative wxWindowMGL - #include "wx/mgl/window.h" -#elif defined(__WXDFB__) - #define wxWindowNative wxWindowDFB - #include "wx/dfb/window.h" -#elif defined(__WXMAC__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowMac - #else // !wxUniv - #define wxWindowMac wxWindow - #endif // wxUniv - #include "wx/mac/window.h" -#elif defined(__WXCOCOA__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowCocoa - #else // !wxUniv - #define wxWindowCocoa wxWindow - #endif // wxUniv - #include "wx/cocoa/window.h" -#elif defined(__WXPM__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowOS2 - #else // !wxUniv - #define wxWindowOS2 wxWindow - #endif // wxUniv/!wxUniv - #include "wx/os2/window.h" -#endif - -// for wxUniversal, we now derive the real wxWindow from wxWindow<platform>, -// for the native ports we already have defined it above -#if defined(__WXUNIVERSAL__) - #ifndef wxWindowNative - #error "wxWindowNative must be defined above!" - #endif - - #include "wx/univ/window.h" -#endif // wxUniv - -// ---------------------------------------------------------------------------- -// inline functions which couldn't be declared in the class body because of -// forward dependencies -// ---------------------------------------------------------------------------- - -inline wxWindow *wxWindowBase::GetGrandParent() const -{ - return m_parent ? m_parent->GetParent() : (wxWindow *)NULL; -} - -// ---------------------------------------------------------------------------- -// global functions -// ---------------------------------------------------------------------------- - -// Find the wxWindow at the current mouse position, also returning the mouse -// position. -extern WXDLLEXPORT wxWindow* wxFindWindowAtPointer(wxPoint& pt); - -// Get the current mouse position. -extern WXDLLEXPORT wxPoint wxGetMousePosition(); - -// get the currently active window of this application or NULL -extern WXDLLEXPORT wxWindow *wxGetActiveWindow(); - -// get the (first) top level parent window -WXDLLEXPORT wxWindow* wxGetTopLevelParent(wxWindow *win); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId() - wxDEPRECATED( int NewControlId() ); - inline int NewControlId() { return wxWindowBase::NewControlId(); } -#endif // WXWIN_COMPATIBILITY_2_6 - -#if wxUSE_ACCESSIBILITY -// ---------------------------------------------------------------------------- -// accessible object for windows -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxWindowAccessible: public wxAccessible -{ -public: - wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); } - virtual ~wxWindowAccessible() {} - -// Overridables - - // Can return either a child object, or an integer - // representing the child element, starting from 1. - virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject); - - // Returns the rectangle for this object (id = 0) or a child element (id > 0). - virtual wxAccStatus GetLocation(wxRect& rect, int elementId); - - // Navigates from fromId to toId/toObject. - virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, - int* toId, wxAccessible** toObject); - - // Gets the name of the specified object. - virtual wxAccStatus GetName(int childId, wxString* name); - - // Gets the number of children. - virtual wxAccStatus GetChildCount(int* childCount); - - // Gets the specified child (starting from 1). - // If *child is NULL and return value is wxACC_OK, - // this means that the child is a simple element and - // not an accessible object. - virtual wxAccStatus GetChild(int childId, wxAccessible** child); - - // Gets the parent, or NULL. - virtual wxAccStatus GetParent(wxAccessible** parent); - - // Performs the default action. childId is 0 (the action for this object) - // or > 0 (the action for a child). - // Return wxACC_NOT_SUPPORTED if there is no default action for this - // window (e.g. an edit control). - virtual wxAccStatus DoDefaultAction(int childId); - - // Gets the default action for this object (0) or > 0 (the action for a child). - // Return wxACC_OK even if there is no action. actionName is the action, or the empty - // string if there is no action. - // The retrieved string describes the action that is performed on an object, - // not what the object does as a result. For example, a toolbar button that prints - // a document has a default action of "Press" rather than "Prints the current document." - virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName); - - // Returns the description for this object or a child. - virtual wxAccStatus GetDescription(int childId, wxString* description); - - // Returns help text for this object or a child, similar to tooltip text. - virtual wxAccStatus GetHelpText(int childId, wxString* helpText); - - // Returns the keyboard shortcut for this object or child. - // Return e.g. ALT+K - virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut); - - // Returns a role constant. - virtual wxAccStatus GetRole(int childId, wxAccRole* role); - - // Returns a state constant. - virtual wxAccStatus GetState(int childId, long* state); - - // Returns a localized string representing the value for the object - // or child. - virtual wxAccStatus GetValue(int childId, wxString* strValue); - - // Selects the object or child. - virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags); - - // Gets the window with the keyboard focus. - // If childId is 0 and child is NULL, no object in - // this subhierarchy has the focus. - // If this object has the focus, child should be 'this'. - virtual wxAccStatus GetFocus(int* childId, wxAccessible** child); - -#if wxUSE_VARIANT - // Gets a variant representing the selected children - // of this object. - // Acceptable values: - // - a null variant (IsNull() returns true) - // - a list variant (GetType() == wxT("list") - // - an integer representing the selected child element, - // or 0 if this object is selected (GetType() == wxT("long") - // - a "void*" pointer to a wxAccessible child object - virtual wxAccStatus GetSelections(wxVariant* selections); -#endif // wxUSE_VARIANT -}; - -#endif // wxUSE_ACCESSIBILITY - - -#endif // _WX_WINDOW_H_BASE_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/window.h +// Purpose: wxWindowBase class - the interface of wxWindow +// Author: Vadim Zeitlin +// Modified by: Ron Lee +// Created: 01/02/97 +// RCS-ID: $Id: window.h 52330 2008-03-05 14:19:38Z VS $ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_BASE_ +#define _WX_WINDOW_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers which we must include here +// ---------------------------------------------------------------------------- + +#include "wx/event.h" // the base class + +#include "wx/list.h" // defines wxWindowList + +#include "wx/cursor.h" // we have member variables of these classes +#include "wx/font.h" // so we can't do without them +#include "wx/colour.h" +#include "wx/region.h" +#include "wx/utils.h" +#include "wx/intl.h" + +#include "wx/validate.h" // for wxDefaultValidator (always include it) + +#if wxUSE_PALETTE + #include "wx/palette.h" +#endif // wxUSE_PALETTE + +#if wxUSE_ACCEL + #include "wx/accel.h" +#endif // wxUSE_ACCEL + +#if wxUSE_ACCESSIBILITY +#include "wx/access.h" +#endif + +// when building wxUniv/Foo we don't want the code for native menu use to be +// compiled in - it should only be used when building real wxFoo +#ifdef __WXUNIVERSAL__ + #define wxUSE_MENUS_NATIVE 0 +#else // !__WXUNIVERSAL__ + #define wxUSE_MENUS_NATIVE wxUSE_MENUS +#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxCaret; +class WXDLLIMPEXP_FWD_CORE wxControl; +class WXDLLIMPEXP_FWD_CORE wxCursor; +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxItemResource; +class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; +class WXDLLIMPEXP_FWD_CORE wxResourceTable; +class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxToolTip; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxScrollHelper; + +#if wxUSE_ACCESSIBILITY +class WXDLLIMPEXP_FWD_CORE wxAccessible; +#endif + +// ---------------------------------------------------------------------------- +// helper stuff used by wxWindow +// ---------------------------------------------------------------------------- + +// struct containing all the visual attributes of a control +struct WXDLLEXPORT wxVisualAttributes +{ + // the font used for control label/text inside it + wxFont font; + + // the foreground colour + wxColour colFg; + + // the background colour, may be wxNullColour if the controls background + // colour is not solid + wxColour colBg; +}; + +// different window variants, on platforms like eg mac uses different +// rendering sizes +enum wxWindowVariant +{ + wxWINDOW_VARIANT_NORMAL, // Normal size + wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal) + wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal) + wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal) + wxWINDOW_VARIANT_MAX +}; + +#if wxUSE_SYSTEM_OPTIONS + #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant") +#endif + +// ---------------------------------------------------------------------------- +// (pseudo)template list classes +// ---------------------------------------------------------------------------- + +WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT); + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +extern WXDLLEXPORT_DATA(wxWindowList) wxTopLevelWindows; +extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; + +// ---------------------------------------------------------------------------- +// wxWindowBase is the base class for all GUI controls/widgets, this is the public +// interface of this class. +// +// Event handler: windows have themselves as their event handlers by default, +// but their event handlers could be set to another object entirely. This +// separation can reduce the amount of derivation required, and allow +// alteration of a window's functionality (e.g. by a resource editor that +// temporarily switches event handlers). +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowBase : public wxEvtHandler +{ +public: + // creating the window + // ------------------- + + // default ctor, initializes everything which can be initialized before + // Create() + wxWindowBase() ; + + // pseudo ctor (can't be virtual, called from ctor) + bool CreateBase(wxWindowBase *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxPanelNameStr); + + virtual ~wxWindowBase(); + + // deleting the window + // ------------------- + + // ask the window to close itself, return true if the event handler + // honoured our request + bool Close( bool force = false ); + + // the following functions delete the C++ objects (the window itself + // or its children) as well as the GUI windows and normally should + // never be used directly + + // delete window unconditionally (dangerous!), returns true if ok + virtual bool Destroy(); + // delete all children of this window, returns true if ok + bool DestroyChildren(); + + // is the window being deleted? + bool IsBeingDeleted() const { return m_isBeingDeleted; } + + // window attributes + // ----------------- + + // label is just the same as the title (but for, e.g., buttons it + // makes more sense to speak about labels), title access + // is available from wxTLW classes only (frames, dialogs) + virtual void SetLabel(const wxString& label) = 0; + virtual wxString GetLabel() const = 0; + + // the window name is used for ressource setting in X, it is not the + // same as the window title/label + virtual void SetName( const wxString &name ) { m_windowName = name; } + virtual wxString GetName() const { return m_windowName; } + + // sets the window variant, calls internally DoSetVariant if variant + // has changed + void SetWindowVariant(wxWindowVariant variant); + wxWindowVariant GetWindowVariant() const { return m_windowVariant; } + + + // window id uniquely identifies the window among its siblings unless + // it is wxID_ANY which means "don't care" + void SetId( wxWindowID winid ) { m_windowId = winid; } + wxWindowID GetId() const { return m_windowId; } + + // get or change the layout direction (LTR or RTL) for this window, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const + { return wxLayout_Default; } + virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) + { } + + // mirror coordinates for RTL layout if this window uses it and if the + // mirroring is not done automatically like Win32 + virtual wxCoord AdjustForLayoutDirection(wxCoord x, + wxCoord width, + wxCoord widthTotal) const; + + // generate a control id for the controls which were not given one by + // user + static int NewControlId() { return --ms_lastControlId; } + // get the id of the control following the one with the given + // (autogenerated) id + static int NextControlId(int winid) { return winid - 1; } + // get the id of the control preceding the one with the given + // (autogenerated) id + static int PrevControlId(int winid) { return winid + 1; } + + // moving/resizing + // --------------- + + // set the window size and/or position + void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ) + { DoSetSize(x, y, width, height, sizeFlags); } + + void SetSize( int width, int height ) + { DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); } + + void SetSize( const wxSize& size ) + { SetSize( size.x, size.y); } + + void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) + { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } + + void Move(int x, int y, int flags = wxSIZE_USE_EXISTING) + { DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); } + + void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING) + { Move(pt.x, pt.y, flags); } + + void SetPosition(const wxPoint& pt) { Move(pt); } + + // Z-order + virtual void Raise() = 0; + virtual void Lower() = 0; + + // client size is the size of area available for subwindows + void SetClientSize( int width, int height ) + { DoSetClientSize(width, height); } + + void SetClientSize( const wxSize& size ) + { DoSetClientSize(size.x, size.y); } + + void SetClientSize(const wxRect& rect) + { SetClientSize( rect.width, rect.height ); } + + // get the window position (pointers may be NULL): notice that it is in + // client coordinates for child windows and screen coordinates for the + // top level ones, use GetScreenPosition() if you need screen + // coordinates for all kinds of windows + void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); } + wxPoint GetPosition() const + { + int x, y; + DoGetPosition(&x, &y); + + return wxPoint(x, y); + } + + // get the window position in screen coordinates + void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); } + wxPoint GetScreenPosition() const + { + int x, y; + DoGetScreenPosition(&x, &y); + + return wxPoint(x, y); + } + + // get the window size (pointers may be NULL) + void GetSize( int *w, int *h ) const { DoGetSize(w, h); } + wxSize GetSize() const + { + int w, h; + DoGetSize(& w, & h); + return wxSize(w, h); + } + + void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); } + wxSize GetClientSize() const + { + int w, h; + DoGetClientSize(&w, &h); + + return wxSize(w, h); + } + + // get the position and size at once + wxRect GetRect() const + { + int x, y, w, h; + GetPosition(&x, &y); + GetSize(&w, &h); + + return wxRect(x, y, w, h); + } + + wxRect GetScreenRect() const + { + int x, y, w, h; + GetScreenPosition(&x, &y); + GetSize(&w, &h); + + return wxRect(x, y, w, h); + } + + // get the origin of the client area of the window relative to the + // window top left corner (the client area may be shifted because of + // the borders, scrollbars, other decorations...) + virtual wxPoint GetClientAreaOrigin() const; + + // get the client rectangle in window (i.e. client) coordinates + wxRect GetClientRect() const + { + return wxRect(GetClientAreaOrigin(), GetClientSize()); + } + +#if wxABI_VERSION >= 20808 + // client<->window size conversion + wxSize ClientToWindowSize(const wxSize& size) const; + wxSize WindowToClientSize(const wxSize& size) const; +#endif + + // get the size best suited for the window (in fact, minimal + // acceptable size using which it will still look "nice" in + // most situations) + wxSize GetBestSize() const + { + if (m_bestSizeCache.IsFullySpecified()) + return m_bestSizeCache; + return DoGetBestSize(); + } + void GetBestSize(int *w, int *h) const + { + wxSize s = GetBestSize(); + if ( w ) + *w = s.x; + if ( h ) + *h = s.y; + } + + void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; } + wxScrollHelper *GetScrollHelper() { return m_scrollHelper; } + + // reset the cached best size value so it will be recalculated the + // next time it is needed. + void InvalidateBestSize(); + void CacheBestSize(const wxSize& size) const + { wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; } + + + // This function will merge the window's best size into the window's + // minimum size, giving priority to the min size components, and + // returns the results. + wxSize GetEffectiveMinSize() const; + wxDEPRECATED( wxSize GetBestFittingSize() const ); // replaced by GetEffectiveMinSize + wxDEPRECATED( wxSize GetAdjustedMinSize() const ); // replaced by GetEffectiveMinSize + + // A 'Smart' SetSize that will fill in default size values with 'best' + // size. Sets the minsize to what was passed in. + void SetInitialSize(const wxSize& size=wxDefaultSize); + wxDEPRECATED( void SetBestFittingSize(const wxSize& size=wxDefaultSize) ); // replaced by SetInitialSize + + + // the generic centre function - centers the window on parent by` + // default or on screen if it doesn't have parent or + // wxCENTER_ON_SCREEN flag is given + void Centre(int dir = wxBOTH) { DoCentre(dir); } + void Center(int dir = wxBOTH) { DoCentre(dir); } + + // centre with respect to the the parent window + void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); } + void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); } + + // set window size to wrap around its children + virtual void Fit(); + + // set virtual size to satisfy children + virtual void FitInside(); + + + // SetSizeHints is actually for setting the size hints + // for the wxTLW for a Window Manager - hence the name - + // and it is therefore overridden in wxTLW to do that. + // In wxWindow(Base), it has (unfortunately) been abused + // to mean the same as SetMinSize() and SetMaxSize(). + + virtual void SetSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, + int incW = wxDefaultCoord, int incH = wxDefaultCoord ) + { DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); } + + void SetSizeHints( const wxSize& minSize, + const wxSize& maxSize=wxDefaultSize, + const wxSize& incSize=wxDefaultSize) + { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); } + + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH ); + + // Methods for setting virtual size hints + // FIXME: What are virtual size hints? + + virtual void SetVirtualSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ); + void SetVirtualSizeHints( const wxSize& minSize, + const wxSize& maxSize=wxDefaultSize) + { + SetVirtualSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y); + } + + + // Call these to override what GetBestSize() returns. This + // method is only virtual because it is overriden in wxTLW + // as a different API for SetSizeHints(). + virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; } + virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; } + + // Override these methods to impose restrictions on min/max size. + // The easier way is to call SetMinSize() and SetMaxSize() which + // will have the same effect. Doing both is non-sense. + virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); } + virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); } + + // Get the min and max values one by one + int GetMinWidth() const { return GetMinSize().x; } + int GetMinHeight() const { return GetMinSize().y; } + int GetMaxWidth() const { return GetMaxSize().x; } + int GetMaxHeight() const { return GetMaxSize().y; } + + + // Methods for accessing the virtual size of a window. For most + // windows this is just the client area of the window, but for + // some like scrolled windows it is more or less independent of + // the screen window size. You may override the DoXXXVirtual + // methods below for classes where that is is the case. + + void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } + void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } + + wxSize GetVirtualSize() const { return DoGetVirtualSize(); } + void GetVirtualSize( int *x, int *y ) const + { + wxSize s( DoGetVirtualSize() ); + + if( x ) + *x = s.GetWidth(); + if( y ) + *y = s.GetHeight(); + } + + // Override these methods for windows that have a virtual size + // independent of their client size. eg. the virtual area of a + // wxScrolledWindow. + + virtual void DoSetVirtualSize( int x, int y ); + virtual wxSize DoGetVirtualSize() const; + + // Return the largest of ClientSize and BestSize (as determined + // by a sizer, interior children, or other means) + + virtual wxSize GetBestVirtualSize() const + { + wxSize client( GetClientSize() ); + wxSize best( GetBestSize() ); + + return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) ); + } + + // return the size of the left/right and top/bottom borders in x and y + // components of the result respectively + virtual wxSize GetWindowBorderSize() const; + + + // window state + // ------------ + + // returns true if window was shown/hidden, false if the nothing was + // done (window was already shown/hidden) + virtual bool Show( bool show = true ); + bool Hide() { return Show(false); } + + // returns true if window was enabled/disabled, false if nothing done + virtual bool Enable( bool enable = true ); + bool Disable() { return Enable(false); } + + virtual bool IsShown() const { return m_isShown; } + virtual bool IsEnabled() const { return m_isEnabled; } + + // returns true if the window is visible, i.e. IsShown() returns true + // if called on it and all its parents up to the first TLW + virtual bool IsShownOnScreen() const; + + // get/set window style (setting style won't update the window and so + // is only useful for internal usage) + virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; } + virtual long GetWindowStyleFlag() const { return m_windowStyle; } + + // just some (somewhat shorter) synonims + void SetWindowStyle( long style ) { SetWindowStyleFlag(style); } + long GetWindowStyle() const { return GetWindowStyleFlag(); } + + // check if the flag is set + bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; } + virtual bool IsRetained() const { return HasFlag(wxRETAINED); } + + // turn the flag on if it had been turned off before and vice versa, + // return true if the flag is currently turned on + bool ToggleWindowStyle(int flag); + + // extra style: the less often used style bits which can't be set with + // SetWindowStyleFlag() + virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } + long GetExtraStyle() const { return m_exStyle; } + + // make the window modal (all other windows unresponsive) + virtual void MakeModal(bool modal = true); + + + // (primitive) theming support + // --------------------------- + + virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; } + virtual bool GetThemeEnabled() const { return m_themeEnabled; } + + + // focus and keyboard handling + // --------------------------- + + // set focus to this window + virtual void SetFocus() = 0; + + // set focus to this window as the result of a keyboard action + virtual void SetFocusFromKbd() { SetFocus(); } + + // return the window which currently has the focus or NULL + static wxWindow *FindFocus(); + + static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; + + // can this window have focus? + virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); } + + // can this window be given focus by keyboard navigation? if not, the + // only way to give it focus (provided it accepts it at all) is to + // click it + virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); } + + // navigates in the specified direction by sending a wxNavigationKeyEvent + virtual bool Navigate(int flags = wxNavigationKeyEvent::IsForward); + + // move this window just before/after the specified one in tab order + // (the other window must be our sibling!) + void MoveBeforeInTabOrder(wxWindow *win) + { DoMoveInTabOrder(win, MoveBefore); } + void MoveAfterInTabOrder(wxWindow *win) + { DoMoveInTabOrder(win, MoveAfter); } + + + // parent/children relations + // ------------------------- + + // get the list of children + const wxWindowList& GetChildren() const { return m_children; } + wxWindowList& GetChildren() { return m_children; } + + // needed just for extended runtime + const wxWindowList& GetWindowChildren() const { return GetChildren() ; } + +#if wxABI_VERSION >= 20808 + // get the window before/after this one in the parents children list, + // returns NULL if this is the first/last window + wxWindow *GetPrevSibling() const { return DoGetSibling(MoveBefore); } + wxWindow *GetNextSibling() const { return DoGetSibling(MoveAfter); } +#endif // wx 2.8.8+ + + // get the parent or the parent of the parent + wxWindow *GetParent() const { return m_parent; } + inline wxWindow *GetGrandParent() const; + + // is this window a top level one? + virtual bool IsTopLevel() const; + + // it doesn't really change parent, use Reparent() instead + void SetParent( wxWindowBase *parent ) { m_parent = (wxWindow *)parent; } + // change the real parent of this window, return true if the parent + // was changed, false otherwise (error or newParent == oldParent) + virtual bool Reparent( wxWindowBase *newParent ); + + // implementation mostly + virtual void AddChild( wxWindowBase *child ); + virtual void RemoveChild( wxWindowBase *child ); + + // looking for windows + // ------------------- + + // find window among the descendants of this one either by id or by + // name (return NULL if not found) + wxWindow *FindWindow(long winid) const; + wxWindow *FindWindow(const wxString& name) const; + + // Find a window among any window (all return NULL if not found) + static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL ); + static wxWindow *FindWindowByName( const wxString& name, + const wxWindow *parent = NULL ); + static wxWindow *FindWindowByLabel( const wxString& label, + const wxWindow *parent = NULL ); + + // event handler stuff + // ------------------- + + // get the current event handler + wxEvtHandler *GetEventHandler() const { return m_eventHandler; } + + // replace the event handler (allows to completely subclass the + // window) + void SetEventHandler( wxEvtHandler *handler ) { m_eventHandler = handler; } + + // push/pop event handler: allows to chain a custom event handler to + // alreasy existing ones + void PushEventHandler( wxEvtHandler *handler ); + wxEvtHandler *PopEventHandler( bool deleteHandler = false ); + + // find the given handler in the event handler chain and remove (but + // not delete) it from the event handler chain, return true if it was + // found and false otherwise (this also results in an assert failure so + // this function should only be called when the handler is supposed to + // be there) + bool RemoveEventHandler(wxEvtHandler *handler); + + // validators + // ---------- + +#if wxUSE_VALIDATORS + // a window may have an associated validator which is used to control + // user input + virtual void SetValidator( const wxValidator &validator ); + virtual wxValidator *GetValidator() { return m_windowValidator; } +#endif // wxUSE_VALIDATORS + + + // dialog oriented functions + // ------------------------- + + // validate the correctness of input, return true if ok + virtual bool Validate(); + + // transfer data between internal and GUI representations + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + + virtual void InitDialog(); + +#if wxUSE_ACCEL + // accelerators + // ------------ + virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) + { m_acceleratorTable = accel; } + wxAcceleratorTable *GetAcceleratorTable() + { return &m_acceleratorTable; } + +#endif // wxUSE_ACCEL + +#if wxUSE_HOTKEY + // hot keys (system wide accelerators) + // ----------------------------------- + + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); + virtual bool UnregisterHotKey(int hotkeyId); +#endif // wxUSE_HOTKEY + + + // dialog units translations + // ------------------------- + + wxPoint ConvertPixelsToDialog( const wxPoint& pt ); + wxPoint ConvertDialogToPixels( const wxPoint& pt ); + wxSize ConvertPixelsToDialog( const wxSize& sz ) + { + wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); + + return wxSize(pt.x, pt.y); + } + + wxSize ConvertDialogToPixels( const wxSize& sz ) + { + wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); + + return wxSize(pt.x, pt.y); + } + + // mouse functions + // --------------- + + // move the mouse to the specified position + virtual void WarpPointer(int x, int y) = 0; + + // start or end mouse capture, these functions maintain the stack of + // windows having captured the mouse and after calling ReleaseMouse() + // the mouse is not released but returns to the window which had had + // captured it previously (if any) + void CaptureMouse(); + void ReleaseMouse(); + + // get the window which currently captures the mouse or NULL + static wxWindow *GetCapture(); + + // does this window have the capture? + virtual bool HasCapture() const + { return (wxWindow *)this == GetCapture(); } + + // painting the window + // ------------------- + + // mark the specified rectangle (or the whole window) as "dirty" so it + // will be repainted + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) = 0; + + // a less awkward wrapper for Refresh + void RefreshRect(const wxRect& rect, bool eraseBackground = true) + { + Refresh(eraseBackground, &rect); + } + + // repaint all invalid areas of the window immediately + virtual void Update() { } + + // clear the window background + virtual void ClearBackground(); + + // freeze the window: don't redraw it until it is thawed + virtual void Freeze() { } + + // thaw the window: redraw it after it had been frozen + virtual void Thaw() { } + + // return true if window had been frozen and not unthawed yet + virtual bool IsFrozen() const { return false; } + + // adjust DC for drawing on this window + virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { } + + // return true if the window contents is double buffered by the system + virtual bool IsDoubleBuffered() const { return false; } + + // the update region of the window contains the areas which must be + // repainted by the program + const wxRegion& GetUpdateRegion() const { return m_updateRegion; } + wxRegion& GetUpdateRegion() { return m_updateRegion; } + + // get the update rectangleregion bounding box in client coords + wxRect GetUpdateClientRect() const; + + // these functions verify whether the given point/rectangle belongs to + // (or at least intersects with) the update region + virtual bool DoIsExposed( int x, int y ) const; + virtual bool DoIsExposed( int x, int y, int w, int h ) const; + + bool IsExposed( int x, int y ) const + { return DoIsExposed(x, y); } + bool IsExposed( int x, int y, int w, int h ) const + { return DoIsExposed(x, y, w, h); } + bool IsExposed( const wxPoint& pt ) const + { return DoIsExposed(pt.x, pt.y); } + bool IsExposed( const wxRect& rect ) const + { return DoIsExposed(rect.x, rect.y, rect.width, rect.height); } + + // colours, fonts and cursors + // -------------------------- + + // get the default attributes for the controls of this class: we + // provide a virtual function which can be used to query the default + // attributes of an existing control and a static function which can + // be used even when no existing object of the given class is + // available, but which won't return any styles specific to this + // particular control, of course (e.g. "Ok" button might have + // different -- bold for example -- font) + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // set/retrieve the window colours (system defaults are used by + // default): SetXXX() functions return true if colour was changed, + // SetDefaultXXX() reset the "m_inheritXXX" flag after setting the + // value to prevent it from being inherited by our children + virtual bool SetBackgroundColour(const wxColour& colour); + void SetOwnBackgroundColour(const wxColour& colour) + { + if ( SetBackgroundColour(colour) ) + m_inheritBgCol = false; + } + wxColour GetBackgroundColour() const; + bool InheritsBackgroundColour() const + { + return m_inheritBgCol; + } + bool UseBgCol() const + { + return m_hasBgCol; + } + + virtual bool SetForegroundColour(const wxColour& colour); + void SetOwnForegroundColour(const wxColour& colour) + { + if ( SetForegroundColour(colour) ) + m_inheritFgCol = false; + } + wxColour GetForegroundColour() const; + + // Set/get the background style. + // Pass one of wxBG_STYLE_SYSTEM, wxBG_STYLE_COLOUR, wxBG_STYLE_CUSTOM + virtual bool SetBackgroundStyle(wxBackgroundStyle style) { m_backgroundStyle = style; return true; } + virtual wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } + + // returns true if the control has "transparent" areas such as a + // wxStaticText and wxCheckBox and the background should be adapted + // from a parent window + virtual bool HasTransparentBackground() { return false; } + + // set/retrieve the font for the window (SetFont() returns true if the + // font really changed) + virtual bool SetFont(const wxFont& font) = 0; + void SetOwnFont(const wxFont& font) + { + if ( SetFont(font) ) + m_inheritFont = false; + } + wxFont GetFont() const; + + // set/retrieve the cursor for this window (SetCursor() returns true + // if the cursor was really changed) + virtual bool SetCursor( const wxCursor &cursor ); + const wxCursor& GetCursor() const { return m_cursor; } + +#if wxUSE_CARET + // associate a caret with the window + void SetCaret(wxCaret *caret); + // get the current caret (may be NULL) + wxCaret *GetCaret() const { return m_caret; } +#endif // wxUSE_CARET + + // get the (average) character size for the current font + virtual int GetCharHeight() const = 0; + virtual int GetCharWidth() const = 0; + + // get the width/height/... of the text using current or specified + // font + virtual void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL) + const = 0; + + // client <-> screen coords + // ------------------------ + + // translate to/from screen/client coordinates (pointers may be NULL) + void ClientToScreen( int *x, int *y ) const + { DoClientToScreen(x, y); } + void ScreenToClient( int *x, int *y ) const + { DoScreenToClient(x, y); } + + // wxPoint interface to do the same thing + wxPoint ClientToScreen(const wxPoint& pt) const + { + int x = pt.x, y = pt.y; + DoClientToScreen(&x, &y); + + return wxPoint(x, y); + } + + wxPoint ScreenToClient(const wxPoint& pt) const + { + int x = pt.x, y = pt.y; + DoScreenToClient(&x, &y); + + return wxPoint(x, y); + } + + // test where the given (in client coords) point lies + wxHitTest HitTest(wxCoord x, wxCoord y) const + { return DoHitTest(x, y); } + + wxHitTest HitTest(const wxPoint& pt) const + { return DoHitTest(pt.x, pt.y); } + + // misc + // ---- + + // get the window border style from the given flags: this is different from + // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to + // translate wxBORDER_DEFAULT to something reasonable + wxBorder GetBorder(long flags) const; + + // get border for the flags of this window + wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); } + + // send wxUpdateUIEvents to this window, and children if recurse is true + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; + +#if wxUSE_MENUS + bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) + { return DoPopupMenu(menu, pos.x, pos.y); } + bool PopupMenu(wxMenu *menu, int x, int y) + { return DoPopupMenu(menu, x, y); } +#endif // wxUSE_MENUS + + // override this method to return true for controls having multiple pages + virtual bool HasMultiplePages() const { return false; } + + + // scrollbars + // ---------- + + // does the window have the scrollbar for this orientation? + bool HasScrollbar(int orient) const + { + return (m_windowStyle & + (orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0; + } + + // configure the window scrollbars + virtual void SetScrollbar( int orient, + int pos, + int thumbvisible, + int range, + bool refresh = true ) = 0; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0; + virtual int GetScrollPos( int orient ) const = 0; + virtual int GetScrollThumb( int orient ) const = 0; + virtual int GetScrollRange( int orient ) const = 0; + + // scroll window to the specified position + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = (wxRect *) NULL ) = 0; + + // scrolls window by line/page: note that not all controls support this + // + // return true if the position changed, false otherwise + virtual bool ScrollLines(int WXUNUSED(lines)) { return false; } + virtual bool ScrollPages(int WXUNUSED(pages)) { return false; } + + // convenient wrappers for ScrollLines/Pages + bool LineUp() { return ScrollLines(-1); } + bool LineDown() { return ScrollLines(1); } + bool PageUp() { return ScrollPages(-1); } + bool PageDown() { return ScrollPages(1); } + + // context-sensitive help + // ---------------------- + + // these are the convenience functions wrapping wxHelpProvider methods + +#if wxUSE_HELP + // associate this help text with this window + void SetHelpText(const wxString& text); + // associate this help text with all windows with the same id as this + // one + void SetHelpTextForId(const wxString& text); + // get the help string associated with the given position in this window + // + // notice that pt may be invalid if event origin is keyboard or unknown + // and this method should return the global window help text then + virtual wxString GetHelpTextAtPoint(const wxPoint& pt, + wxHelpEvent::Origin origin) const; + // returns the position-independent help text + wxString GetHelpText() const + { + return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown); + } + +#else // !wxUSE_HELP + // silently ignore SetHelpText() calls + void SetHelpText(const wxString& WXUNUSED(text)) { } + void SetHelpTextForId(const wxString& WXUNUSED(text)) { } +#endif // wxUSE_HELP + + // tooltips + // -------- + +#if wxUSE_TOOLTIPS + // the easiest way to set a tooltip for a window is to use this method + void SetToolTip( const wxString &tip ); + // attach a tooltip to the window + void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } + // get the associated tooltip or NULL if none + wxToolTip* GetToolTip() const { return m_tooltip; } + wxString GetToolTipText() const ; +#else + // make it much easier to compile apps in an environment + // that doesn't support tooltips, such as PocketPC + inline void SetToolTip( const wxString & WXUNUSED(tip) ) {} +#endif // wxUSE_TOOLTIPS + + // drag and drop + // ------------- +#if wxUSE_DRAG_AND_DROP + // set/retrieve the drop target associated with this window (may be + // NULL; it's owned by the window and will be deleted by it) + virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; + virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } +#endif // wxUSE_DRAG_AND_DROP + + // constraints and sizers + // ---------------------- +#if wxUSE_CONSTRAINTS + // set the constraints for this window or retrieve them (may be NULL) + void SetConstraints( wxLayoutConstraints *constraints ); + wxLayoutConstraints *GetConstraints() const { return m_constraints; } + + // implementation only + void UnsetConstraints(wxLayoutConstraints *c); + wxWindowList *GetConstraintsInvolvedIn() const + { return m_constraintsInvolvedIn; } + void AddConstraintReference(wxWindowBase *otherWin); + void RemoveConstraintReference(wxWindowBase *otherWin); + void DeleteRelatedConstraints(); + void ResetConstraints(); + + // these methods may be overridden for special layout algorithms + virtual void SetConstraintSizes(bool recurse = true); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int phase); + + // these methods are virtual but normally won't be overridden + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + +#endif // wxUSE_CONSTRAINTS + + // when using constraints or sizers, it makes sense to update + // children positions automatically whenever the window is resized + // - this is done if autoLayout is on + void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; } + bool GetAutoLayout() const { return m_autoLayout; } + + // lay out the window and its children + virtual bool Layout(); + + // sizers + void SetSizer(wxSizer *sizer, bool deleteOld = true ); + void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ); + + wxSizer *GetSizer() const { return m_windowSizer; } + + // Track if this window is a member of a sizer + void SetContainingSizer(wxSizer* sizer); + wxSizer *GetContainingSizer() const { return m_containingSizer; } + + // accessibility + // ---------------------- +#if wxUSE_ACCESSIBILITY + // Override to create a specific accessible object. + virtual wxAccessible* CreateAccessible(); + + // Sets the accessible object. + void SetAccessible(wxAccessible* accessible) ; + + // Returns the accessible object. + wxAccessible* GetAccessible() { return m_accessible; } + + // Returns the accessible object, creating if necessary. + wxAccessible* GetOrCreateAccessible() ; +#endif + + + // Set window transparency if the platform supports it + virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; } + virtual bool CanSetTransparent() { return false; } + + + // implementation + // -------------- + + // event handlers + void OnSysColourChanged( wxSysColourChangedEvent& event ); + void OnInitDialog( wxInitDialogEvent &event ); + void OnMiddleClick( wxMouseEvent& event ); +#if wxUSE_HELP + void OnHelp(wxHelpEvent& event); +#endif // wxUSE_HELP + + // virtual function for implementing internal idle + // behaviour + virtual void OnInternalIdle() {} + + // call internal idle recursively +// void ProcessInternalIdle() ; + + // get the handle of the window for the underlying window system: this + // is only used for wxWin itself or for user code which wants to call + // platform-specific APIs + virtual WXWidget GetHandle() const = 0; + // associate the window with a new native handle + virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { } + // dissociate the current native handle from the window + virtual void DissociateHandle() { } + +#if wxUSE_PALETTE + // Store the palette used by DCs in wxWindow so that the dcs can share + // a palette. And we can respond to palette messages. + wxPalette GetPalette() const { return m_palette; } + + // When palette is changed tell the DC to set the system palette to the + // new one. + void SetPalette(const wxPalette& pal); + + // return true if we have a specific palette + bool HasCustomPalette() const { return m_hasCustomPalette; } + + // return the first parent window with a custom palette or NULL + wxWindow *GetAncestorWithCustomPalette() const; +#endif // wxUSE_PALETTE + + // inherit the parents visual attributes if they had been explicitly set + // by the user (i.e. we don't inherit default attributes) and if we don't + // have our own explicitly set + virtual void InheritAttributes(); + + // returns false from here if this window doesn't want to inherit the + // parents colours even if InheritAttributes() would normally do it + // + // this just provides a simple way to customize InheritAttributes() + // behaviour in the most common case + virtual bool ShouldInheritColours() const { return false; } + +protected: + // event handling specific to wxWindow + virtual bool TryValidator(wxEvent& event); + virtual bool TryParent(wxEvent& event); + + enum MoveKind + { + MoveBefore, // insert before the given window + MoveAfter // insert after the given window + }; + +#if wxABI_VERSION >= 20808 + // common part of GetPrev/NextSibling() + wxWindow *DoGetSibling(MoveKind order) const; +#endif // wx 2.8.8+ + + // common part of MoveBefore/AfterInTabOrder() + virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move); + +#if wxUSE_CONSTRAINTS + // satisfy the constraints for the windows but don't set the window sizes + void SatisfyConstraints(); +#endif // wxUSE_CONSTRAINTS + + // Send the wxWindowDestroyEvent + void SendDestroyEvent(); + + // returns the main window of composite control; this is the window + // that FindFocus returns if the focus is in one of composite control's + // windows + virtual wxWindow *GetMainWindowOfCompositeControl() + { return (wxWindow*)this; } + + // the window id - a number which uniquely identifies a window among + // its siblings unless it is wxID_ANY + wxWindowID m_windowId; + + // the parent window of this window (or NULL) and the list of the children + // of this window + wxWindow *m_parent; + wxWindowList m_children; + + // the minimal allowed size for the window (no minimal size if variable(s) + // contain(s) wxDefaultCoord) + int m_minWidth, + m_minHeight, + m_maxWidth, + m_maxHeight; + + // event handler for this window: usually is just 'this' but may be + // changed with SetEventHandler() + wxEvtHandler *m_eventHandler; + +#if wxUSE_VALIDATORS + // associated validator or NULL if none + wxValidator *m_windowValidator; +#endif // wxUSE_VALIDATORS + +#if wxUSE_DRAG_AND_DROP + wxDropTarget *m_dropTarget; +#endif // wxUSE_DRAG_AND_DROP + + // visual window attributes + wxCursor m_cursor; + wxFont m_font; // see m_hasFont + wxColour m_backgroundColour, // m_hasBgCol + m_foregroundColour; // m_hasFgCol + +#if wxUSE_CARET + wxCaret *m_caret; +#endif // wxUSE_CARET + + // the region which should be repainted in response to paint event + wxRegion m_updateRegion; + +#if wxUSE_ACCEL + // the accelerator table for the window which translates key strokes into + // command events + wxAcceleratorTable m_acceleratorTable; +#endif // wxUSE_ACCEL + + // the tooltip for this window (may be NULL) +#if wxUSE_TOOLTIPS + wxToolTip *m_tooltip; +#endif // wxUSE_TOOLTIPS + + // constraints and sizers +#if wxUSE_CONSTRAINTS + // the constraints for this window or NULL + wxLayoutConstraints *m_constraints; + + // constraints this window is involved in + wxWindowList *m_constraintsInvolvedIn; +#endif // wxUSE_CONSTRAINTS + + // this window's sizer + wxSizer *m_windowSizer; + + // The sizer this window is a member of, if any + wxSizer *m_containingSizer; + + // Layout() window automatically when its size changes? + bool m_autoLayout:1; + + // window state + bool m_isShown:1; + bool m_isEnabled:1; + bool m_isBeingDeleted:1; + + // was the window colours/font explicitly changed by user? + bool m_hasBgCol:1; + bool m_hasFgCol:1; + bool m_hasFont:1; + + // and should it be inherited by children? + bool m_inheritBgCol:1; + bool m_inheritFgCol:1; + bool m_inheritFont:1; + + // window attributes + long m_windowStyle, + m_exStyle; + wxString m_windowName; + bool m_themeEnabled; + wxBackgroundStyle m_backgroundStyle; +#if wxUSE_PALETTE + wxPalette m_palette; + bool m_hasCustomPalette; +#endif // wxUSE_PALETTE + +#if wxUSE_ACCESSIBILITY + wxAccessible* m_accessible; +#endif + + // Virtual size (scrolling) + wxSize m_virtualSize; + + wxScrollHelper *m_scrollHelper; + + int m_minVirtualWidth; // VirtualSizeHints + int m_minVirtualHeight; + int m_maxVirtualWidth; + int m_maxVirtualHeight; + + wxWindowVariant m_windowVariant ; + + // override this to change the default (i.e. used when no style is + // specified) border for the window class + virtual wxBorder GetDefaultBorder() const; + + // Get the default size for the new window if no explicit size given. TLWs + // have their own default size so this is just for non top-level windows. + static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; } + static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; } + + + // Used to save the results of DoGetBestSize so it doesn't need to be + // recalculated each time the value is needed. + wxSize m_bestSizeCache; + + wxDEPRECATED( void SetBestSize(const wxSize& size) ); // use SetInitialSize + wxDEPRECATED( virtual void SetInitialBestSize(const wxSize& size) ); // use SetInitialSize + + + + // more pure virtual functions + // --------------------------- + + // NB: we must have DoSomething() function when Something() is an overloaded + // method: indeed, we can't just have "virtual Something()" in case when + // the function is overloaded because then we'd have to make virtual all + // the variants (otherwise only the virtual function may be called on a + // pointer to derived class according to C++ rules) which is, in + // general, absolutely not needed. So instead we implement all + // overloaded Something()s in terms of DoSomething() which will be the + // only one to be virtual. + + // coordinates translation + virtual void DoClientToScreen( int *x, int *y ) const = 0; + virtual void DoScreenToClient( int *x, int *y ) const = 0; + + virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; + + // capture/release the mouse, used by Capture/ReleaseMouse() + virtual void DoCaptureMouse() = 0; + virtual void DoReleaseMouse() = 0; + + // retrieve the position/size of the window + virtual void DoGetPosition(int *x, int *y) const = 0; + virtual void DoGetScreenPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const = 0; + virtual void DoGetClientSize(int *width, int *height) const = 0; + + // get the size which best suits the window: for a control, it would be + // the minimal size which doesn't truncate the control, for a panel - the + // same size as it would have after a call to Fit() + virtual wxSize DoGetBestSize() const; + + // called from DoGetBestSize() to convert best virtual size (returned by + // the window sizer) to the best size for the window itself; this is + // overridden at wxScrolledWindow level to clump down virtual size to real + virtual wxSize GetWindowSizeForVirtualSize(const wxSize& size) const + { + return size; + } + + // this is the virtual function to be overriden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) = 0; + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height) = 0; + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just + // reposition this window except for composite controls which will want to + // arrange themselves inside the given rectangle + // + // Important note: the coordinates passed to this method are in parent's + // *window* coordinates and not parent's client coordinates (as the values + // passed to DoSetSize and returned by DoGetPosition are)! + virtual void DoMoveWindow(int x, int y, int width, int height) = 0; + + // centre the window in the specified direction on parent, note that + // wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for + // TLWs + virtual void DoCentre(int dir); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +#if wxUSE_MENUS + virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0; +#endif // wxUSE_MENUS + + // Makes an adjustment to the window position to make it relative to the + // parents client area, e.g. if the parent is a frame with a toolbar, its + // (0, 0) is just below the toolbar + virtual void AdjustForParentClientOrigin(int& x, int& y, + int sizeFlags = 0) const; + + // implements the window variants + virtual void DoSetWindowVariant( wxWindowVariant variant ) ; + + // Must be called when mouse capture is lost to send + // wxMouseCaptureLostEvent to windows on capture stack. + static void NotifyCaptureLost(); + +private: + // contains the last id generated by NewControlId + static int ms_lastControlId; + + // the stack of windows which have captured the mouse + static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext; + // the window that currently has mouse capture + static wxWindow *ms_winCaptureCurrent; + // indicates if execution is inside CaptureMouse/ReleaseMouse + static bool ms_winCaptureChanging; + + DECLARE_ABSTRACT_CLASS(wxWindowBase) + DECLARE_NO_COPY_CLASS(wxWindowBase) + DECLARE_EVENT_TABLE() +}; + + + +// Inlines for some deprecated methods +inline wxSize wxWindowBase::GetBestFittingSize() const +{ + return GetEffectiveMinSize(); +} + +inline void wxWindowBase::SetBestFittingSize(const wxSize& size) +{ + SetInitialSize(size); +} + +inline void wxWindowBase::SetBestSize(const wxSize& size) +{ + SetInitialSize(size); +} + +inline void wxWindowBase::SetInitialBestSize(const wxSize& size) +{ + SetInitialSize(size); +} + + +// ---------------------------------------------------------------------------- +// now include the declaration of wxWindow class +// ---------------------------------------------------------------------------- + +// include the declaration of the platform-specific class +#if defined(__WXPALMOS__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowPalm + #else // !wxUniv + #define wxWindowPalm wxWindow + #endif // wxUniv/!wxUniv + #include "wx/palmos/window.h" +#elif defined(__WXMSW__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowMSW + #else // !wxUniv + #define wxWindowMSW wxWindow + #endif // wxUniv/!wxUniv + #include "wx/msw/window.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/window.h" +#elif defined(__WXGTK20__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowGTK + #else // !wxUniv + #define wxWindowGTK wxWindow + #endif // wxUniv + #include "wx/gtk/window.h" +#elif defined(__WXGTK__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowGTK + #else // !wxUniv + #define wxWindowGTK wxWindow + #endif // wxUniv + #include "wx/gtk1/window.h" +#elif defined(__WXX11__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowX11 + #else // !wxUniv + #define wxWindowX11 wxWindow + #endif // wxUniv + #include "wx/x11/window.h" +#elif defined(__WXMGL__) + #define wxWindowNative wxWindowMGL + #include "wx/mgl/window.h" +#elif defined(__WXDFB__) + #define wxWindowNative wxWindowDFB + #include "wx/dfb/window.h" +#elif defined(__WXMAC__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowMac + #else // !wxUniv + #define wxWindowMac wxWindow + #endif // wxUniv + #include "wx/mac/window.h" +#elif defined(__WXCOCOA__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowCocoa + #else // !wxUniv + #define wxWindowCocoa wxWindow + #endif // wxUniv + #include "wx/cocoa/window.h" +#elif defined(__WXPM__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowOS2 + #else // !wxUniv + #define wxWindowOS2 wxWindow + #endif // wxUniv/!wxUniv + #include "wx/os2/window.h" +#endif + +// for wxUniversal, we now derive the real wxWindow from wxWindow<platform>, +// for the native ports we already have defined it above +#if defined(__WXUNIVERSAL__) + #ifndef wxWindowNative + #error "wxWindowNative must be defined above!" + #endif + + #include "wx/univ/window.h" +#endif // wxUniv + +// ---------------------------------------------------------------------------- +// inline functions which couldn't be declared in the class body because of +// forward dependencies +// ---------------------------------------------------------------------------- + +inline wxWindow *wxWindowBase::GetGrandParent() const +{ + return m_parent ? m_parent->GetParent() : (wxWindow *)NULL; +} + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// Find the wxWindow at the current mouse position, also returning the mouse +// position. +extern WXDLLEXPORT wxWindow* wxFindWindowAtPointer(wxPoint& pt); + +// Get the current mouse position. +extern WXDLLEXPORT wxPoint wxGetMousePosition(); + +// get the currently active window of this application or NULL +extern WXDLLEXPORT wxWindow *wxGetActiveWindow(); + +// get the (first) top level parent window +WXDLLEXPORT wxWindow* wxGetTopLevelParent(wxWindow *win); + +#if WXWIN_COMPATIBILITY_2_6 + // deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId() + wxDEPRECATED( int NewControlId() ); + inline int NewControlId() { return wxWindowBase::NewControlId(); } +#endif // WXWIN_COMPATIBILITY_2_6 + +#if wxUSE_ACCESSIBILITY +// ---------------------------------------------------------------------------- +// accessible object for windows +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowAccessible: public wxAccessible +{ +public: + wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); } + virtual ~wxWindowAccessible() {} + +// Overridables + + // Can return either a child object, or an integer + // representing the child element, starting from 1. + virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject); + + // Returns the rectangle for this object (id = 0) or a child element (id > 0). + virtual wxAccStatus GetLocation(wxRect& rect, int elementId); + + // Navigates from fromId to toId/toObject. + virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, + int* toId, wxAccessible** toObject); + + // Gets the name of the specified object. + virtual wxAccStatus GetName(int childId, wxString* name); + + // Gets the number of children. + virtual wxAccStatus GetChildCount(int* childCount); + + // Gets the specified child (starting from 1). + // If *child is NULL and return value is wxACC_OK, + // this means that the child is a simple element and + // not an accessible object. + virtual wxAccStatus GetChild(int childId, wxAccessible** child); + + // Gets the parent, or NULL. + virtual wxAccStatus GetParent(wxAccessible** parent); + + // Performs the default action. childId is 0 (the action for this object) + // or > 0 (the action for a child). + // Return wxACC_NOT_SUPPORTED if there is no default action for this + // window (e.g. an edit control). + virtual wxAccStatus DoDefaultAction(int childId); + + // Gets the default action for this object (0) or > 0 (the action for a child). + // Return wxACC_OK even if there is no action. actionName is the action, or the empty + // string if there is no action. + // The retrieved string describes the action that is performed on an object, + // not what the object does as a result. For example, a toolbar button that prints + // a document has a default action of "Press" rather than "Prints the current document." + virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName); + + // Returns the description for this object or a child. + virtual wxAccStatus GetDescription(int childId, wxString* description); + + // Returns help text for this object or a child, similar to tooltip text. + virtual wxAccStatus GetHelpText(int childId, wxString* helpText); + + // Returns the keyboard shortcut for this object or child. + // Return e.g. ALT+K + virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut); + + // Returns a role constant. + virtual wxAccStatus GetRole(int childId, wxAccRole* role); + + // Returns a state constant. + virtual wxAccStatus GetState(int childId, long* state); + + // Returns a localized string representing the value for the object + // or child. + virtual wxAccStatus GetValue(int childId, wxString* strValue); + + // Selects the object or child. + virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags); + + // Gets the window with the keyboard focus. + // If childId is 0 and child is NULL, no object in + // this subhierarchy has the focus. + // If this object has the focus, child should be 'this'. + virtual wxAccStatus GetFocus(int* childId, wxAccessible** child); + +#if wxUSE_VARIANT + // Gets a variant representing the selected children + // of this object. + // Acceptable values: + // - a null variant (IsNull() returns true) + // - a list variant (GetType() == wxT("list") + // - an integer representing the selected child element, + // or 0 if this object is selected (GetType() == wxT("long") + // - a "void*" pointer to a wxAccessible child object + virtual wxAccStatus GetSelections(wxVariant* selections); +#endif // wxUSE_VARIANT +}; + +#endif // wxUSE_ACCESSIBILITY + + +#endif // _WX_WINDOW_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/wizard.h b/Externals/wxWidgets/include/wx/wizard.h index dd212851d9..e0aa88b2f7 100644 --- a/Externals/wxWidgets/include/wx/wizard.h +++ b/Externals/wxWidgets/include/wx/wizard.h @@ -1,317 +1,317 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wizard.h -// Purpose: wxWizard class: a GUI control presenting the user with a -// sequence of dialogs which allows to simply perform some task -// Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B. -// Smith) -// Modified by: Robert Cavanaugh -// Added capability to use .WXR resource files in Wizard pages -// Added wxWIZARD_HELP event -// Robert Vazan (sizers) -// Created: 15.08.99 -// RCS-ID: $Id: wizard.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WIZARD_H_ -#define _WX_WIZARD_H_ - -#include "wx/defs.h" - -#if wxUSE_WIZARDDLG - -// ---------------------------------------------------------------------------- -// headers and other simple declarations -// ---------------------------------------------------------------------------- - -#include "wx/dialog.h" // the base class -#include "wx/panel.h" // ditto -#include "wx/event.h" // wxEVT_XXX constants -#include "wx/bitmap.h" - -// Extended style to specify a help button -#define wxWIZARD_EX_HELPBUTTON 0x00000010 - -// forward declarations -class WXDLLIMPEXP_FWD_ADV wxWizard; - -// ---------------------------------------------------------------------------- -// wxWizardPage is one of the wizards screen: it must know what are the -// following and preceding pages (which may be NULL for the first/last page). -// -// Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be -// used as such (i.e. controls may be placed directly on it &c). -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxWizardPage : public wxPanel -{ -public: - wxWizardPage() { Init(); } - - // ctor accepts an optional bitmap which will be used for this page instead - // of the default one for this wizard (should be of the same size). Notice - // that no other parameters are needed because the wizard will resize and - // reposition the page anyhow - wxWizardPage(wxWizard *parent, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL); - - bool Create(wxWizard *parent, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL); - - // these functions are used by the wizard to show another page when the - // user chooses "Back" or "Next" button - virtual wxWizardPage *GetPrev() const = 0; - virtual wxWizardPage *GetNext() const = 0; - - // default GetBitmap() will just return m_bitmap which is ok in 99% of - // cases - override this method if you want to create the bitmap to be used - // dynamically or to do something even more fancy. It's ok to return - // wxNullBitmap from here - the default one will be used then. - virtual wxBitmap GetBitmap() const { return m_bitmap; } - -#if wxUSE_VALIDATORS - // Override the base functions to allow a validator to be assigned to this page. - virtual bool TransferDataToWindow() - { - return GetValidator() ? GetValidator()->TransferToWindow() - : wxPanel::TransferDataToWindow(); - } - - virtual bool TransferDataFromWindow() - { - return GetValidator() ? GetValidator()->TransferFromWindow() - : wxPanel::TransferDataFromWindow(); - } - - virtual bool Validate() - { - return GetValidator() ? GetValidator()->Validate(this) - : wxPanel::Validate(); - } -#endif // wxUSE_VALIDATORS - -protected: - // common part of ctors: - void Init(); - - wxBitmap m_bitmap; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage) -}; - -// ---------------------------------------------------------------------------- -// wxWizardPageSimple just returns the pointers given to the ctor and is useful -// to create a simple wizard where the order of pages never changes. -// -// OTOH, it is also possible to dynamicly decide which page to return (i.e. -// depending on the user's choices) as the wizard sample shows - in order to do -// this, you must derive from wxWizardPage directly. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxWizardPageSimple : public wxWizardPage -{ -public: - wxWizardPageSimple() { Init(); } - - // ctor takes the previous and next pages - wxWizardPageSimple(wxWizard *parent, - wxWizardPage *prev = (wxWizardPage *)NULL, - wxWizardPage *next = (wxWizardPage *)NULL, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL) - { - Create(parent, prev, next, bitmap, resource); - } - - bool Create(wxWizard *parent = NULL, // let it be default ctor too - wxWizardPage *prev = (wxWizardPage *)NULL, - wxWizardPage *next = (wxWizardPage *)NULL, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL) - { - m_prev = prev; - m_next = next; - return wxWizardPage::Create(parent, bitmap, resource); - } - - // the pointers may be also set later - but before starting the wizard - void SetPrev(wxWizardPage *prev) { m_prev = prev; } - void SetNext(wxWizardPage *next) { m_next = next; } - - // a convenience function to make the pages follow each other - static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second) - { - wxCHECK_RET( first && second, - wxT("NULL passed to wxWizardPageSimple::Chain") ); - - first->SetNext(second); - second->SetPrev(first); - } - - // base class pure virtuals - virtual wxWizardPage *GetPrev() const; - virtual wxWizardPage *GetNext() const; - -private: - // common part of ctors: - void Init() - { - m_prev = m_next = NULL; - } - - // pointers are private, the derived classes shouldn't mess with them - - // just derive from wxWizardPage directly to implement different behaviour - wxWizardPage *m_prev, - *m_next; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple) -}; - -// ---------------------------------------------------------------------------- -// wxWizard -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxWizardBase : public wxDialog -{ -public: - /* - The derived class (i.e. the real wxWizard) has a ctor and Create() - function taking the following arguments: - - wxWizard(wxWindow *parent, - int id = wxID_ANY, - const wxString& title = wxEmptyString, - const wxBitmap& bitmap = wxNullBitmap, - const wxPoint& pos = wxDefaultPosition, - long style = wxDEFAULT_DIALOG_STYLE); - */ - wxWizardBase() { } - - // executes the wizard starting from the given page, returns true if it was - // successfully finished, false if user cancelled it - virtual bool RunWizard(wxWizardPage *firstPage) = 0; - - // get the current page (NULL if RunWizard() isn't running) - virtual wxWizardPage *GetCurrentPage() const = 0; - - // set the min size which should be available for the pages: a - // wizard will take into account the size of the bitmap (if any) - // itself and will never be less than some predefined fixed size - virtual void SetPageSize(const wxSize& size) = 0; - - // get the size available for the page - virtual wxSize GetPageSize() const = 0; - - // set the best size for the wizard, i.e. make it big enough to contain all - // of the pages starting from the given one - // - // this function may be called several times and possible with different - // pages in which case it will only increase the page size if needed (this - // may be useful if not all pages are accessible from the first one by - // default) - virtual void FitToPage(const wxWizardPage *firstPage) = 0; - - // Adding pages to page area sizer enlarges wizard - virtual wxSizer *GetPageAreaSizer() const = 0; - - // Set border around page area. Default is 0 if you add at least one - // page to GetPageAreaSizer and 5 if you don't. - virtual void SetBorder(int border) = 0; - - // the methods below may be overridden by the derived classes to provide - // custom logic for determining the pages order - - virtual bool HasNextPage(wxWizardPage *page) - { return page->GetNext() != NULL; } - - virtual bool HasPrevPage(wxWizardPage *page) - { return page->GetPrev() != NULL; } - - /// Override these functions to stop InitDialog from calling TransferDataToWindow - /// for _all_ pages when the wizard starts. Instead 'ShowPage' will call - /// TransferDataToWindow for the first page only. - bool TransferDataToWindow() { return true; } - bool TransferDataFromWindow() { return true; } - bool Validate() { return true; } - -private: - DECLARE_NO_COPY_CLASS(wxWizardBase) -}; - -// include the real class declaration -#include "wx/generic/wizard.h" - -// ---------------------------------------------------------------------------- -// wxWizardEvent class represents an event generated by the wizard: this event -// is first sent to the page itself and, if not processed there, goes up the -// window hierarchy as usual -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxWizardEvent : public wxNotifyEvent -{ -public: - wxWizardEvent(wxEventType type = wxEVT_NULL, - int id = wxID_ANY, - bool direction = true, - wxWizardPage* page = NULL); - - // for EVT_WIZARD_PAGE_CHANGING, return true if we're going forward or - // false otherwise and for EVT_WIZARD_PAGE_CHANGED return true if we came - // from the previous page and false if we returned from the next one - // (this function doesn't make sense for CANCEL events) - bool GetDirection() const { return m_direction; } - - wxWizardPage* GetPage() const { return m_page; } - -private: - bool m_direction; - wxWizardPage* m_page; - - DECLARE_DYNAMIC_CLASS(wxWizardEvent) - DECLARE_NO_COPY_CLASS(wxWizardEvent) -}; - -// ---------------------------------------------------------------------------- -// macros for handling wxWizardEvents -// ---------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_CHANGED, 900) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_CHANGING, 901) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_CANCEL, 902) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_HELP, 903) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_FINISHED, 903) -END_DECLARE_EVENT_TYPES() - -typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&); - -#define wxWizardEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWizardEventFunction, &func) - -#define wx__DECLARE_WIZARDEVT(evt, id, fn) \ - wx__DECLARE_EVT1(wxEVT_WIZARD_ ## evt, id, wxWizardEventHandler(fn)) - -// notifies that the page has just been changed (can't be vetoed) -#define EVT_WIZARD_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGED, id, fn) - -// the user pressed "<Back" or "Next>" button and the page is going to be -// changed - unless the event handler vetoes the event -#define EVT_WIZARD_PAGE_CHANGING(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGING, id, fn) - -// the user pressed "Cancel" button and the wizard is going to be dismissed - -// unless the event handler vetoes the event -#define EVT_WIZARD_CANCEL(id, fn) wx__DECLARE_WIZARDEVT(CANCEL, id, fn) - -// the user pressed "Finish" button and the wizard is going to be dismissed - -#define EVT_WIZARD_FINISHED(id, fn) wx__DECLARE_WIZARDEVT(FINISHED, id, fn) - -// the user pressed "Help" button -#define EVT_WIZARD_HELP(id, fn) wx__DECLARE_WIZARDEVT(HELP, id, fn) - -#endif // wxUSE_WIZARDDLG - -#endif // _WX_WIZARD_H_ +/////////////////////////////////////////////////////////////////////////////// +// Name: wizard.h +// Purpose: wxWizard class: a GUI control presenting the user with a +// sequence of dialogs which allows to simply perform some task +// Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B. +// Smith) +// Modified by: Robert Cavanaugh +// Added capability to use .WXR resource files in Wizard pages +// Added wxWIZARD_HELP event +// Robert Vazan (sizers) +// Created: 15.08.99 +// RCS-ID: $Id: wizard.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WIZARD_H_ +#define _WX_WIZARD_H_ + +#include "wx/defs.h" + +#if wxUSE_WIZARDDLG + +// ---------------------------------------------------------------------------- +// headers and other simple declarations +// ---------------------------------------------------------------------------- + +#include "wx/dialog.h" // the base class +#include "wx/panel.h" // ditto +#include "wx/event.h" // wxEVT_XXX constants +#include "wx/bitmap.h" + +// Extended style to specify a help button +#define wxWIZARD_EX_HELPBUTTON 0x00000010 + +// forward declarations +class WXDLLIMPEXP_FWD_ADV wxWizard; + +// ---------------------------------------------------------------------------- +// wxWizardPage is one of the wizards screen: it must know what are the +// following and preceding pages (which may be NULL for the first/last page). +// +// Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be +// used as such (i.e. controls may be placed directly on it &c). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxWizardPage : public wxPanel +{ +public: + wxWizardPage() { Init(); } + + // ctor accepts an optional bitmap which will be used for this page instead + // of the default one for this wizard (should be of the same size). Notice + // that no other parameters are needed because the wizard will resize and + // reposition the page anyhow + wxWizardPage(wxWizard *parent, + const wxBitmap& bitmap = wxNullBitmap, + const wxChar* resource = NULL); + + bool Create(wxWizard *parent, + const wxBitmap& bitmap = wxNullBitmap, + const wxChar* resource = NULL); + + // these functions are used by the wizard to show another page when the + // user chooses "Back" or "Next" button + virtual wxWizardPage *GetPrev() const = 0; + virtual wxWizardPage *GetNext() const = 0; + + // default GetBitmap() will just return m_bitmap which is ok in 99% of + // cases - override this method if you want to create the bitmap to be used + // dynamically or to do something even more fancy. It's ok to return + // wxNullBitmap from here - the default one will be used then. + virtual wxBitmap GetBitmap() const { return m_bitmap; } + +#if wxUSE_VALIDATORS + // Override the base functions to allow a validator to be assigned to this page. + virtual bool TransferDataToWindow() + { + return GetValidator() ? GetValidator()->TransferToWindow() + : wxPanel::TransferDataToWindow(); + } + + virtual bool TransferDataFromWindow() + { + return GetValidator() ? GetValidator()->TransferFromWindow() + : wxPanel::TransferDataFromWindow(); + } + + virtual bool Validate() + { + return GetValidator() ? GetValidator()->Validate(this) + : wxPanel::Validate(); + } +#endif // wxUSE_VALIDATORS + +protected: + // common part of ctors: + void Init(); + + wxBitmap m_bitmap; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage) +}; + +// ---------------------------------------------------------------------------- +// wxWizardPageSimple just returns the pointers given to the ctor and is useful +// to create a simple wizard where the order of pages never changes. +// +// OTOH, it is also possible to dynamicly decide which page to return (i.e. +// depending on the user's choices) as the wizard sample shows - in order to do +// this, you must derive from wxWizardPage directly. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxWizardPageSimple : public wxWizardPage +{ +public: + wxWizardPageSimple() { Init(); } + + // ctor takes the previous and next pages + wxWizardPageSimple(wxWizard *parent, + wxWizardPage *prev = (wxWizardPage *)NULL, + wxWizardPage *next = (wxWizardPage *)NULL, + const wxBitmap& bitmap = wxNullBitmap, + const wxChar* resource = NULL) + { + Create(parent, prev, next, bitmap, resource); + } + + bool Create(wxWizard *parent = NULL, // let it be default ctor too + wxWizardPage *prev = (wxWizardPage *)NULL, + wxWizardPage *next = (wxWizardPage *)NULL, + const wxBitmap& bitmap = wxNullBitmap, + const wxChar* resource = NULL) + { + m_prev = prev; + m_next = next; + return wxWizardPage::Create(parent, bitmap, resource); + } + + // the pointers may be also set later - but before starting the wizard + void SetPrev(wxWizardPage *prev) { m_prev = prev; } + void SetNext(wxWizardPage *next) { m_next = next; } + + // a convenience function to make the pages follow each other + static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second) + { + wxCHECK_RET( first && second, + wxT("NULL passed to wxWizardPageSimple::Chain") ); + + first->SetNext(second); + second->SetPrev(first); + } + + // base class pure virtuals + virtual wxWizardPage *GetPrev() const; + virtual wxWizardPage *GetNext() const; + +private: + // common part of ctors: + void Init() + { + m_prev = m_next = NULL; + } + + // pointers are private, the derived classes shouldn't mess with them - + // just derive from wxWizardPage directly to implement different behaviour + wxWizardPage *m_prev, + *m_next; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple) +}; + +// ---------------------------------------------------------------------------- +// wxWizard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxWizardBase : public wxDialog +{ +public: + /* + The derived class (i.e. the real wxWizard) has a ctor and Create() + function taking the following arguments: + + wxWizard(wxWindow *parent, + int id = wxID_ANY, + const wxString& title = wxEmptyString, + const wxBitmap& bitmap = wxNullBitmap, + const wxPoint& pos = wxDefaultPosition, + long style = wxDEFAULT_DIALOG_STYLE); + */ + wxWizardBase() { } + + // executes the wizard starting from the given page, returns true if it was + // successfully finished, false if user cancelled it + virtual bool RunWizard(wxWizardPage *firstPage) = 0; + + // get the current page (NULL if RunWizard() isn't running) + virtual wxWizardPage *GetCurrentPage() const = 0; + + // set the min size which should be available for the pages: a + // wizard will take into account the size of the bitmap (if any) + // itself and will never be less than some predefined fixed size + virtual void SetPageSize(const wxSize& size) = 0; + + // get the size available for the page + virtual wxSize GetPageSize() const = 0; + + // set the best size for the wizard, i.e. make it big enough to contain all + // of the pages starting from the given one + // + // this function may be called several times and possible with different + // pages in which case it will only increase the page size if needed (this + // may be useful if not all pages are accessible from the first one by + // default) + virtual void FitToPage(const wxWizardPage *firstPage) = 0; + + // Adding pages to page area sizer enlarges wizard + virtual wxSizer *GetPageAreaSizer() const = 0; + + // Set border around page area. Default is 0 if you add at least one + // page to GetPageAreaSizer and 5 if you don't. + virtual void SetBorder(int border) = 0; + + // the methods below may be overridden by the derived classes to provide + // custom logic for determining the pages order + + virtual bool HasNextPage(wxWizardPage *page) + { return page->GetNext() != NULL; } + + virtual bool HasPrevPage(wxWizardPage *page) + { return page->GetPrev() != NULL; } + + /// Override these functions to stop InitDialog from calling TransferDataToWindow + /// for _all_ pages when the wizard starts. Instead 'ShowPage' will call + /// TransferDataToWindow for the first page only. + bool TransferDataToWindow() { return true; } + bool TransferDataFromWindow() { return true; } + bool Validate() { return true; } + +private: + DECLARE_NO_COPY_CLASS(wxWizardBase) +}; + +// include the real class declaration +#include "wx/generic/wizard.h" + +// ---------------------------------------------------------------------------- +// wxWizardEvent class represents an event generated by the wizard: this event +// is first sent to the page itself and, if not processed there, goes up the +// window hierarchy as usual +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxWizardEvent : public wxNotifyEvent +{ +public: + wxWizardEvent(wxEventType type = wxEVT_NULL, + int id = wxID_ANY, + bool direction = true, + wxWizardPage* page = NULL); + + // for EVT_WIZARD_PAGE_CHANGING, return true if we're going forward or + // false otherwise and for EVT_WIZARD_PAGE_CHANGED return true if we came + // from the previous page and false if we returned from the next one + // (this function doesn't make sense for CANCEL events) + bool GetDirection() const { return m_direction; } + + wxWizardPage* GetPage() const { return m_page; } + +private: + bool m_direction; + wxWizardPage* m_page; + + DECLARE_DYNAMIC_CLASS(wxWizardEvent) + DECLARE_NO_COPY_CLASS(wxWizardEvent) +}; + +// ---------------------------------------------------------------------------- +// macros for handling wxWizardEvents +// ---------------------------------------------------------------------------- + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_CHANGED, 900) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_CHANGING, 901) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_CANCEL, 902) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_HELP, 903) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_WIZARD_FINISHED, 903) +END_DECLARE_EVENT_TYPES() + +typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&); + +#define wxWizardEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWizardEventFunction, &func) + +#define wx__DECLARE_WIZARDEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_WIZARD_ ## evt, id, wxWizardEventHandler(fn)) + +// notifies that the page has just been changed (can't be vetoed) +#define EVT_WIZARD_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGED, id, fn) + +// the user pressed "<Back" or "Next>" button and the page is going to be +// changed - unless the event handler vetoes the event +#define EVT_WIZARD_PAGE_CHANGING(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGING, id, fn) + +// the user pressed "Cancel" button and the wizard is going to be dismissed - +// unless the event handler vetoes the event +#define EVT_WIZARD_CANCEL(id, fn) wx__DECLARE_WIZARDEVT(CANCEL, id, fn) + +// the user pressed "Finish" button and the wizard is going to be dismissed - +#define EVT_WIZARD_FINISHED(id, fn) wx__DECLARE_WIZARDEVT(FINISHED, id, fn) + +// the user pressed "Help" button +#define EVT_WIZARD_HELP(id, fn) wx__DECLARE_WIZARDEVT(HELP, id, fn) + +#endif // wxUSE_WIZARDDLG + +#endif // _WX_WIZARD_H_ diff --git a/Externals/wxWidgets/include/wx/wupdlock.h b/Externals/wxWidgets/include/wx/wupdlock.h index c30ae00b17..61f6a39098 100644 --- a/Externals/wxWidgets/include/wx/wupdlock.h +++ b/Externals/wxWidgets/include/wx/wupdlock.h @@ -1,37 +1,37 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/wupdlock.h -// Purpose: wxWindowUpdateLocker prevents window redrawing -// Author: Vadim Zeitlin -// Created: 2006-03-06 -// RCS-ID: $Id: wupdlock.h 37842 2006-03-07 01:50:21Z VZ $ -// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WUPDLOCK_H_ -#define _WX_WUPDLOCK_H_ - -#include "wx/window.h" - -// ---------------------------------------------------------------------------- -// wxWindowUpdateLocker prevents updates to the window during its lifetime -// ---------------------------------------------------------------------------- - -class wxWindowUpdateLocker -{ -public: - // create an object preventing updates of the given window (which must have - // a lifetime at least as great as ours) - wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); } - - // dtor thaws the window to permit updates again - ~wxWindowUpdateLocker() { m_win->Thaw(); } - -private: - wxWindow *m_win; - - DECLARE_NO_COPY_CLASS(wxWindowUpdateLocker) -}; - -#endif // _WX_WUPDLOCK_H_ - +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/wupdlock.h +// Purpose: wxWindowUpdateLocker prevents window redrawing +// Author: Vadim Zeitlin +// Created: 2006-03-06 +// RCS-ID: $Id: wupdlock.h 37842 2006-03-07 01:50:21Z VZ $ +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WUPDLOCK_H_ +#define _WX_WUPDLOCK_H_ + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxWindowUpdateLocker prevents updates to the window during its lifetime +// ---------------------------------------------------------------------------- + +class wxWindowUpdateLocker +{ +public: + // create an object preventing updates of the given window (which must have + // a lifetime at least as great as ours) + wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); } + + // dtor thaws the window to permit updates again + ~wxWindowUpdateLocker() { m_win->Thaw(); } + +private: + wxWindow *m_win; + + DECLARE_NO_COPY_CLASS(wxWindowUpdateLocker) +}; + +#endif // _WX_WUPDLOCK_H_ + diff --git a/Externals/wxWidgets/include/wx/wx.h b/Externals/wxWidgets/include/wx/wx.h index 8c71e8ba1b..0ad9bcdce9 100644 --- a/Externals/wxWidgets/include/wx/wx.h +++ b/Externals/wxWidgets/include/wx/wx.h @@ -1,105 +1,105 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx.h -// Purpose: wxWidgets central header including the most often used ones -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: wx.h 40943 2006-08-31 19:31:43Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WX_H_ -#define _WX_WX_H_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/dynarray.h" -#include "wx/list.h" -#include "wx/hash.h" -#include "wx/string.h" -#include "wx/hashmap.h" -#include "wx/arrstr.h" -#include "wx/intl.h" -#include "wx/log.h" -#include "wx/event.h" -#include "wx/app.h" -#include "wx/utils.h" -#include "wx/stream.h" -#include "wx/memory.h" -#include "wx/math.h" -#include "wx/stopwatch.h" -#include "wx/module.h" - -#if wxUSE_GUI - -#include "wx/window.h" -#include "wx/containr.h" -#include "wx/panel.h" -#include "wx/toplevel.h" -#include "wx/frame.h" -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" -#include "wx/region.h" -#include "wx/bitmap.h" -#include "wx/image.h" -#include "wx/colour.h" -#include "wx/font.h" -#include "wx/dc.h" -#include "wx/dcclient.h" -#include "wx/dcmemory.h" -#include "wx/dcprint.h" -#include "wx/dcscreen.h" -#include "wx/button.h" -#include "wx/menuitem.h" -#include "wx/menu.h" -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/palette.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/dialog.h" -#include "wx/timer.h" -#include "wx/settings.h" -#include "wx/msgdlg.h" -#include "wx/cmndata.h" -#include "wx/dataobj.h" - -#include "wx/control.h" -#include "wx/ctrlsub.h" -#include "wx/bmpbuttn.h" -#include "wx/checkbox.h" -#include "wx/checklst.h" -#include "wx/choice.h" -#include "wx/scrolbar.h" -#include "wx/stattext.h" -#include "wx/statbmp.h" -#include "wx/statbox.h" -#include "wx/listbox.h" -#include "wx/radiobox.h" -#include "wx/radiobut.h" -#include "wx/textctrl.h" -#include "wx/slider.h" -#include "wx/gauge.h" -#include "wx/scrolwin.h" -#include "wx/dirdlg.h" -#include "wx/toolbar.h" -#include "wx/combobox.h" -#include "wx/layout.h" -#include "wx/sizer.h" -#include "wx/mdi.h" -#include "wx/statusbr.h" -#include "wx/choicdlg.h" -#include "wx/textdlg.h" -#include "wx/filedlg.h" - -// always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator -#include "wx/validate.h" - -#if wxUSE_VALIDATORS - #include "wx/valtext.h" -#endif // wxUSE_VALIDATORS - -#endif // wxUSE_GUI - -#endif // _WX_WX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wx.h +// Purpose: wxWidgets central header including the most often used ones +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: wx.h 40943 2006-08-31 19:31:43Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WX_H_ +#define _WX_WX_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/dynarray.h" +#include "wx/list.h" +#include "wx/hash.h" +#include "wx/string.h" +#include "wx/hashmap.h" +#include "wx/arrstr.h" +#include "wx/intl.h" +#include "wx/log.h" +#include "wx/event.h" +#include "wx/app.h" +#include "wx/utils.h" +#include "wx/stream.h" +#include "wx/memory.h" +#include "wx/math.h" +#include "wx/stopwatch.h" +#include "wx/module.h" + +#if wxUSE_GUI + +#include "wx/window.h" +#include "wx/containr.h" +#include "wx/panel.h" +#include "wx/toplevel.h" +#include "wx/frame.h" +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/region.h" +#include "wx/bitmap.h" +#include "wx/image.h" +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/dc.h" +#include "wx/dcclient.h" +#include "wx/dcmemory.h" +#include "wx/dcprint.h" +#include "wx/dcscreen.h" +#include "wx/button.h" +#include "wx/menuitem.h" +#include "wx/menu.h" +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/palette.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/dialog.h" +#include "wx/timer.h" +#include "wx/settings.h" +#include "wx/msgdlg.h" +#include "wx/cmndata.h" +#include "wx/dataobj.h" + +#include "wx/control.h" +#include "wx/ctrlsub.h" +#include "wx/bmpbuttn.h" +#include "wx/checkbox.h" +#include "wx/checklst.h" +#include "wx/choice.h" +#include "wx/scrolbar.h" +#include "wx/stattext.h" +#include "wx/statbmp.h" +#include "wx/statbox.h" +#include "wx/listbox.h" +#include "wx/radiobox.h" +#include "wx/radiobut.h" +#include "wx/textctrl.h" +#include "wx/slider.h" +#include "wx/gauge.h" +#include "wx/scrolwin.h" +#include "wx/dirdlg.h" +#include "wx/toolbar.h" +#include "wx/combobox.h" +#include "wx/layout.h" +#include "wx/sizer.h" +#include "wx/mdi.h" +#include "wx/statusbr.h" +#include "wx/choicdlg.h" +#include "wx/textdlg.h" +#include "wx/filedlg.h" + +// always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator +#include "wx/validate.h" + +#if wxUSE_VALIDATORS + #include "wx/valtext.h" +#endif // wxUSE_VALIDATORS + +#endif // wxUSE_GUI + +#endif // _WX_WX_H_ diff --git a/Externals/wxWidgets/include/wx/wx_cw.h b/Externals/wxWidgets/include/wx/wx_cw.h index ff1ac56311..b9b214a904 100644 --- a/Externals/wxWidgets/include/wx/wx_cw.h +++ b/Externals/wxWidgets/include/wx/wx_cw.h @@ -1,65 +1,65 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cw.h 29319 2004-09-24 14:32:35Z ABX $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include <wx_PPC++_prof.mch> - #elif __INTEL__ - #include <wx_x86++_prof.mch> - #elif __CFM68K__ - #include <wx_cfm++_prof.mch> - #else - #include <wx_68k++_prof.mch> - #endif -#else - #if __POWERPC__ - #include <wx_PPC_prof.mch> - #elif __INTEL__ - #include <wx_x86_prof.mch> - #elif __CFM68K__ - #include <wx_cfm_prof.mch> - #else - #include <wx_68k_prof.mch> - #endif -#endif -#else -#ifdef __cplusplus - #if __POWERPC__ - #include <wx_PPC++.mch> - #elif __INTEL__ - #include <wx_x86++.mch> - #elif __CFM68K__ - #include <wx_cfm++.mch> - #else - #include <wx_68k++.mch> - #endif -#else - #if __POWERPC__ - #include <wx_PPC.mch> - #elif __INTEL__ - #include <wx_x86.mch> - #elif __CFM68K__ - #include <wx_cfm.mch> - #else - #include <wx_68k.mch> - #endif -#endif -#endif -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw.h +// Purpose: wxWidgets definitions for CodeWarrior builds +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wx_cw.h 29319 2004-09-24 14:32:35Z ABX $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #if __POWERPC__ + #include <wx_PPC++_prof.mch> + #elif __INTEL__ + #include <wx_x86++_prof.mch> + #elif __CFM68K__ + #include <wx_cfm++_prof.mch> + #else + #include <wx_68k++_prof.mch> + #endif +#else + #if __POWERPC__ + #include <wx_PPC_prof.mch> + #elif __INTEL__ + #include <wx_x86_prof.mch> + #elif __CFM68K__ + #include <wx_cfm_prof.mch> + #else + #include <wx_68k_prof.mch> + #endif +#endif +#else +#ifdef __cplusplus + #if __POWERPC__ + #include <wx_PPC++.mch> + #elif __INTEL__ + #include <wx_x86++.mch> + #elif __CFM68K__ + #include <wx_cfm++.mch> + #else + #include <wx_68k++.mch> + #endif +#else + #if __POWERPC__ + #include <wx_PPC.mch> + #elif __INTEL__ + #include <wx_x86.mch> + #elif __CFM68K__ + #include <wx_cfm.mch> + #else + #include <wx_68k.mch> + #endif +#endif +#endif +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wx_cw_cm.h b/Externals/wxWidgets/include/wx/wx_cw_cm.h index 047facf15e..c6c64b9e07 100644 --- a/Externals/wxWidgets/include/wx/wx_cw_cm.h +++ b/Externals/wxWidgets/include/wx/wx_cw_cm.h @@ -1,88 +1,88 @@ -/* - Name: wx/wx_cw_cm.h - Purpose: wxWidgets definitions for CodeWarrior builds - Author: Stefan Csomor - Modified by: - Created: - RCS-ID: $Id: wx_cw_cm.h 42655 2006-10-29 20:17:29Z VZ $ - Copyright: (c) Stefan Csomor - Licence: wxWindows licence -*/ - -#define MSL_USE_PRECOMPILED_HEADERS 0 -#if __WXDEBUG__ - // mac os assert levels - #define DEBUG 1 - #define DEBUG_INTERNAL 1 -#endif -#if !defined( __MWERKS__ ) - #error "this file is only for builds with Metrowerks CodeWarrior" -#endif - -// defined if the compiler does not want the classname repeated for inlines -// within a class definition -#define WX_COMP_INLINE_NO_CLASS - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 - #pragma old_argmatch on -#endif - -#if (__MWERKS__ < 0x0900) || macintosh || __MACH__ - #define __MAC__ - #define __WXMAC__ -#elif (__MWERKS__ >= 0x0900) && __INTEL__ - #define WIN32 - #define _WINDOWS - #define __WXMSW__ - #define __WINDOWS__ - #define __WIN95__ - #define __WIN32__ - #define STRICT - #define NOMINMAX -#elif __BEOS__ - #include <ansi_prefix.be.h> - #include <Be.h> -#else - #error unknown MW compiler -#endif - -#ifdef __WXMSW__ - #include <ansi_prefix.win32.h> - #include <ansi_parms.h> - #ifdef __MWERKS__ - #if defined( __MSL__ ) && __MSL__ >= 0x5012 && __MSL__ < 0x7000 - #define fileno _fileno - #define fdopen _fdopen - #define tell _tell - #endif - #endif -#elif defined( __WXMAC__) - /* Set to 0 if you don't want to use precompiled MacHeaders */ - #define USE_PRECOMPILED_MAC_HEADERS 0 - #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 - #define OPAQUE_TOOLBOX_STRUCTS 1 - - /* CW8.3+ has mbstate_t */ - #if defined(__MACH__) && __MWERKS__ < 0x3003 - typedef int mbstate_t; - #define _MBSTATE_T - #endif - - /* CW8.3+ has ssize_t */ - #if defined(__MACH__) && __MWERKS__ >= 0x3003 - #define HAVE_SSIZE_T - #endif - - #include <mslconfig> - // for getting the correct expat includes - #define MACOS_CLASSIC - /* - #include <MacTypes.h> - #if UNIVERSAL_INTERFACES_VERSION < 0x0340 - #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" - #endif - */ -#endif - -#define USE_DEFINE - +/* + Name: wx/wx_cw_cm.h + Purpose: wxWidgets definitions for CodeWarrior builds + Author: Stefan Csomor + Modified by: + Created: + RCS-ID: $Id: wx_cw_cm.h 42655 2006-10-29 20:17:29Z VZ $ + Copyright: (c) Stefan Csomor + Licence: wxWindows licence +*/ + +#define MSL_USE_PRECOMPILED_HEADERS 0 +#if __WXDEBUG__ + // mac os assert levels + #define DEBUG 1 + #define DEBUG_INTERNAL 1 +#endif +#if !defined( __MWERKS__ ) + #error "this file is only for builds with Metrowerks CodeWarrior" +#endif + +// defined if the compiler does not want the classname repeated for inlines +// within a class definition +#define WX_COMP_INLINE_NO_CLASS + +#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 + #pragma old_argmatch on +#endif + +#if (__MWERKS__ < 0x0900) || macintosh || __MACH__ + #define __MAC__ + #define __WXMAC__ +#elif (__MWERKS__ >= 0x0900) && __INTEL__ + #define WIN32 + #define _WINDOWS + #define __WXMSW__ + #define __WINDOWS__ + #define __WIN95__ + #define __WIN32__ + #define STRICT + #define NOMINMAX +#elif __BEOS__ + #include <ansi_prefix.be.h> + #include <Be.h> +#else + #error unknown MW compiler +#endif + +#ifdef __WXMSW__ + #include <ansi_prefix.win32.h> + #include <ansi_parms.h> + #ifdef __MWERKS__ + #if defined( __MSL__ ) && __MSL__ >= 0x5012 && __MSL__ < 0x7000 + #define fileno _fileno + #define fdopen _fdopen + #define tell _tell + #endif + #endif +#elif defined( __WXMAC__) + /* Set to 0 if you don't want to use precompiled MacHeaders */ + #define USE_PRECOMPILED_MAC_HEADERS 0 + #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 + #define OPAQUE_TOOLBOX_STRUCTS 1 + + /* CW8.3+ has mbstate_t */ + #if defined(__MACH__) && __MWERKS__ < 0x3003 + typedef int mbstate_t; + #define _MBSTATE_T + #endif + + /* CW8.3+ has ssize_t */ + #if defined(__MACH__) && __MWERKS__ >= 0x3003 + #define HAVE_SSIZE_T + #endif + + #include <mslconfig> + // for getting the correct expat includes + #define MACOS_CLASSIC + /* + #include <MacTypes.h> + #if UNIVERSAL_INTERFACES_VERSION < 0x0340 + #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" + #endif + */ +#endif + +#define USE_DEFINE + diff --git a/Externals/wxWidgets/include/wx/wx_cw_d.h b/Externals/wxWidgets/include/wx/wx_cw_d.h index 802a75f329..6e127a9f6a 100644 --- a/Externals/wxWidgets/include/wx/wx_cw_d.h +++ b/Externals/wxWidgets/include/wx/wx_cw_d.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cw_d.h 29319 2004-09-24 14:32:35Z ABX $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include <wx_PPC++_d.mch> - #elif __INTEL__ - #include <wx_x86++_d.mch> - #elif __CFM68K__ - #include <wx_cfm++_d.mch> - #else - #include <wx_68k++_d.mch> - #endif -#else - #if __POWERPC__ - #include <wx_PPC_d.mch> - #elif __INTEL__ - #include <wx_x86_d.mch> - #elif __CFM68K__ - #include <wx_cfm_d.mch> - #else - #include <wx_68k_d.mch> - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wx_cw_d.h 29319 2004-09-24 14:32:35Z ABX $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #if __POWERPC__ + #include <wx_PPC++_d.mch> + #elif __INTEL__ + #include <wx_x86++_d.mch> + #elif __CFM68K__ + #include <wx_cfm++_d.mch> + #else + #include <wx_68k++_d.mch> + #endif +#else + #if __POWERPC__ + #include <wx_PPC_d.mch> + #elif __INTEL__ + #include <wx_x86_d.mch> + #elif __CFM68K__ + #include <wx_cfm_d.mch> + #else + #include <wx_68k_d.mch> + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wx_cwc.h b/Externals/wxWidgets/include/wx/wx_cwc.h index 2ffd81f13b..7c323bd76d 100644 --- a/Externals/wxWidgets/include/wx/wx_cwc.h +++ b/Externals/wxWidgets/include/wx/wx_cwc.h @@ -1,49 +1,49 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cwc.h 36967 2006-01-18 14:13:20Z JS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 - #pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #ifdef __MACH__ - #include "wx_Mach++_prof.mch" - #elif __POWERPC__ - #include "wx_Carbon++_prof.mch" - #endif -#else - #ifdef __MACH__ - #include "wx_Mach_prof.mch" - #elif __POWERPC__ - #include "wx_Carbon_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wx_Mach++.mch" - #elif __POWERPC__ - #include "wx_Carbon++.mch" - #endif -#else - #ifdef __MACH__ - #include "wx_Mach.mch" - #elif __POWERPC__ - #include "wx_Carbon.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw.h +// Purpose: wxWidgets definitions for CodeWarrior builds +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wx_cwc.h 36967 2006-01-18 14:13:20Z JS $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 + #pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #ifdef __MACH__ + #include "wx_Mach++_prof.mch" + #elif __POWERPC__ + #include "wx_Carbon++_prof.mch" + #endif +#else + #ifdef __MACH__ + #include "wx_Mach_prof.mch" + #elif __POWERPC__ + #include "wx_Carbon_prof.mch" + #endif +#endif +#else +#ifdef __cplusplus + #ifdef __MACH__ + #include "wx_Mach++.mch" + #elif __POWERPC__ + #include "wx_Carbon++.mch" + #endif +#else + #ifdef __MACH__ + #include "wx_Mach.mch" + #elif __POWERPC__ + #include "wx_Carbon.mch" + #endif +#endif +#endif +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wx_cwc_d.h b/Externals/wxWidgets/include/wx/wx_cwc_d.h index 6bc69e26c1..dd46cfeac1 100644 --- a/Externals/wxWidgets/include/wx/wx_cwc_d.h +++ b/Externals/wxWidgets/include/wx/wx_cwc_d.h @@ -1,38 +1,38 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cwc_d.h 36967 2006-01-18 14:13:20Z JS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 - #pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wx_Mach++_d.mch" - #elif __POWERPC__ - #include "wx_Carbon++_d.mch" - #endif -#else - #ifdef __MACH__ - #include "wx_Mach_d.mch" - #elif __POWERPC__ - #include "wx_Carbon_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wx_cwc_d.h 36967 2006-01-18 14:13:20Z JS $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 + #pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #ifdef __MACH__ + #include "wx_Mach++_d.mch" + #elif __POWERPC__ + #include "wx_Carbon++_d.mch" + #endif +#else + #ifdef __MACH__ + #include "wx_Mach_d.mch" + #elif __POWERPC__ + #include "wx_Carbon_d.mch" + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wx_cwcocoa.h b/Externals/wxWidgets/include/wx/wx_cwcocoa.h index 9c1d254958..920fde5409 100644 --- a/Externals/wxWidgets/include/wx/wx_cwcocoa.h +++ b/Externals/wxWidgets/include/wx/wx_cwcocoa.h @@ -1,66 +1,66 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/wx_cwcocoa.h -// Purpose: Metrowerks Prefix Header File (wxCocoa Release) -// Author: Tommy Tian (tommy.tian@webex.com) -// Modified by: David Elliott -// Created: 10/22/2004 -// RCS-ID: $Id: wx_cwcocoa.h 30235 2004-11-02 06:22:11Z DE $ -// Copyright: (c) Tommy Tian -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW_COCOA__ -#define _WX_CW_COCOA__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #ifdef __OBJC__ - #if __mwlinker__ - #include "wx_cocoaMacOSXmm_prof.mch" - #else - #include "wx_cocoaMach-Omm_prof.mch" - #endif - #else - #if __mwlinker__ - #include "wx_cocoaMacOSX++_prof.mch" - #else - #include "wx_cocoaMach-O++_prof.mch" - #endif - #endif -#else - #if __mwlinker__ - #include "wx_cocoaMacOSX_prof.mch" - #else - #include "wx_cocoaMach-O_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #ifdef __OBJC__ - #if __mwlinker__ - #include "wx_cocoaMacOSXmm.mch" - #else - #include "wx_cocoaMach-Omm.mch" - #endif - #else - #if __mwlinker__ - #include "wx_cocoaMacOSX++.mch" - #else - #include "wx_cocoaMach-O++.mch" - #endif - #endif -#else - #if __mwlinker__ - #include "wx_cocoaMacOSX.mch" - #else - #include "wx_cocoaMach-O.mch" - #endif -#endif -#endif - -#endif - // _WX_CW_COCOA__ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/wx_cwcocoa.h +// Purpose: Metrowerks Prefix Header File (wxCocoa Release) +// Author: Tommy Tian (tommy.tian@webex.com) +// Modified by: David Elliott +// Created: 10/22/2004 +// RCS-ID: $Id: wx_cwcocoa.h 30235 2004-11-02 06:22:11Z DE $ +// Copyright: (c) Tommy Tian +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW_COCOA__ +#define _WX_CW_COCOA__ + +#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 +#pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #ifdef __OBJC__ + #if __mwlinker__ + #include "wx_cocoaMacOSXmm_prof.mch" + #else + #include "wx_cocoaMach-Omm_prof.mch" + #endif + #else + #if __mwlinker__ + #include "wx_cocoaMacOSX++_prof.mch" + #else + #include "wx_cocoaMach-O++_prof.mch" + #endif + #endif +#else + #if __mwlinker__ + #include "wx_cocoaMacOSX_prof.mch" + #else + #include "wx_cocoaMach-O_prof.mch" + #endif +#endif +#else +#ifdef __cplusplus + #ifdef __OBJC__ + #if __mwlinker__ + #include "wx_cocoaMacOSXmm.mch" + #else + #include "wx_cocoaMach-Omm.mch" + #endif + #else + #if __mwlinker__ + #include "wx_cocoaMacOSX++.mch" + #else + #include "wx_cocoaMach-O++.mch" + #endif + #endif +#else + #if __mwlinker__ + #include "wx_cocoaMacOSX.mch" + #else + #include "wx_cocoaMach-O.mch" + #endif +#endif +#endif + +#endif + // _WX_CW_COCOA__ diff --git a/Externals/wxWidgets/include/wx/wx_cwcocoa_cm.h b/Externals/wxWidgets/include/wx/wx_cwcocoa_cm.h index b16c100555..fbe176d4b4 100644 --- a/Externals/wxWidgets/include/wx/wx_cwcocoa_cm.h +++ b/Externals/wxWidgets/include/wx/wx_cwcocoa_cm.h @@ -1,85 +1,85 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/wx_cwcocoa_cm.h -// Purpose: Metrowerks wxCocoa PCH common definitions -// Author: Tommy Tian (tommy.tian@webex.com) -// Modified by: -// Created: 10/04/2004 -// RCS-ID: $Id: wx_cwcocoa_cm.h 30235 2004-11-02 06:22:11Z DE $ -// Copyright: (c) Tommy Tian -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#define MSL_USE_PRECOMPILED_HEADERS 0 -#if __WXDEBUG__ - // mac os assert levels - #define DEBUG 1 - #define DEBUG_INTERNAL 1 -#endif -#if !defined( __MWERKS__ ) - #error "this file is only for builds with Metrowerks CodeWarrior" -#endif - -#define WX_COMP_INLINE_NO_CLASS // defined if the compiler does not want the classname repeated for inlines within a class definition - -#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 -#pragma old_argmatch on -#endif - -#if (__MWERKS__ < 0x0900) || macintosh || __MACH__ - #define __MAC__ - #define __WXCOCOA__ -#elif (__MWERKS__ >= 0x0900) && __INTEL__ - #define WIN32 - #define _WINDOWS - #define __WXMSW__ - #define __WINDOWS__ - #define __WIN95__ - #define __WIN32__ - #define STRICT - #define NOMINMAX -#elif __BEOS__ - #include <ansi_prefix.be.h> - #include <Be.h> -#else - #error unknown MW compiler -#endif - -#ifdef __WXMSW__ - #include <ansi_prefix.win32.h> - #include <ansi_parms.h> - #ifdef __MWERKS__ - #if defined( __MSL__ ) && __MSL__ >= 0x5012 && __MSL__ < 0x7000 - #define fileno _fileno - #define fdopen _fdopen - #define tell _tell - #endif - #endif -#elif defined( __WXMAC__) - #define USE_PRECOMPILED_MAC_HEADERS 0 /*Set to 0 if you don't want to use precompiled MacHeaders*/ - #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 - #define OPAQUE_TOOLBOX_STRUCTS 1 - #ifdef __MACH__ - #include <ansi_prefix.mach.h> - #include <msl_c_version.h> - #include <stdint.h> - #undef WCHAR_MAX - #include <machine/ansi.h> - #else - #include <ansi_prefix.mac.h> - #endif - // for getting the correct expat includes - #define MACOS_CLASSIC - /* - #include <MacTypes.h> - #if UNIVERSAL_INTERFACES_VERSION < 0x0340 - #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" - #endif - */ -#elif defined( __WXCOCOA__) //tommy - #if defined(__OBJC__) - #include "CocoaHeaders.m" - #endif //defined(__OBJC__) -#endif - -#define USE_DEFINE - +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/wx_cwcocoa_cm.h +// Purpose: Metrowerks wxCocoa PCH common definitions +// Author: Tommy Tian (tommy.tian@webex.com) +// Modified by: +// Created: 10/04/2004 +// RCS-ID: $Id: wx_cwcocoa_cm.h 30235 2004-11-02 06:22:11Z DE $ +// Copyright: (c) Tommy Tian +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#define MSL_USE_PRECOMPILED_HEADERS 0 +#if __WXDEBUG__ + // mac os assert levels + #define DEBUG 1 + #define DEBUG_INTERNAL 1 +#endif +#if !defined( __MWERKS__ ) + #error "this file is only for builds with Metrowerks CodeWarrior" +#endif + +#define WX_COMP_INLINE_NO_CLASS // defined if the compiler does not want the classname repeated for inlines within a class definition + +#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 +#pragma old_argmatch on +#endif + +#if (__MWERKS__ < 0x0900) || macintosh || __MACH__ + #define __MAC__ + #define __WXCOCOA__ +#elif (__MWERKS__ >= 0x0900) && __INTEL__ + #define WIN32 + #define _WINDOWS + #define __WXMSW__ + #define __WINDOWS__ + #define __WIN95__ + #define __WIN32__ + #define STRICT + #define NOMINMAX +#elif __BEOS__ + #include <ansi_prefix.be.h> + #include <Be.h> +#else + #error unknown MW compiler +#endif + +#ifdef __WXMSW__ + #include <ansi_prefix.win32.h> + #include <ansi_parms.h> + #ifdef __MWERKS__ + #if defined( __MSL__ ) && __MSL__ >= 0x5012 && __MSL__ < 0x7000 + #define fileno _fileno + #define fdopen _fdopen + #define tell _tell + #endif + #endif +#elif defined( __WXMAC__) + #define USE_PRECOMPILED_MAC_HEADERS 0 /*Set to 0 if you don't want to use precompiled MacHeaders*/ + #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 + #define OPAQUE_TOOLBOX_STRUCTS 1 + #ifdef __MACH__ + #include <ansi_prefix.mach.h> + #include <msl_c_version.h> + #include <stdint.h> + #undef WCHAR_MAX + #include <machine/ansi.h> + #else + #include <ansi_prefix.mac.h> + #endif + // for getting the correct expat includes + #define MACOS_CLASSIC + /* + #include <MacTypes.h> + #if UNIVERSAL_INTERFACES_VERSION < 0x0340 + #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" + #endif + */ +#elif defined( __WXCOCOA__) //tommy + #if defined(__OBJC__) + #include "CocoaHeaders.m" + #endif //defined(__OBJC__) +#endif + +#define USE_DEFINE + diff --git a/Externals/wxWidgets/include/wx/wx_cwcocoa_d.h b/Externals/wxWidgets/include/wx/wx_cwcocoa_d.h index 4ea0171681..de2b5b95be 100644 --- a/Externals/wxWidgets/include/wx/wx_cwcocoa_d.h +++ b/Externals/wxWidgets/include/wx/wx_cwcocoa_d.h @@ -1,47 +1,47 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/wx_cwcocoa_d.h -// Purpose: Metrowerks Prefix Header File (wxCocoa Debug) -// Author: Tommy Tian (tommy.tian@webex.com) -// Modified by: David Elliott -// Created: 10/04/2004 -// RCS-ID: $Id: wx_cwcocoa_d.h 30235 2004-11-02 06:22:11Z DE $ -// Copyright: (c) Tommy Tian -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef _WX_CW_COCOA__ -#define _WX_CW_COCOA__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __OBJC__ - #if __mwlinker__ - #include "wx_cocoaMacOSXmm_d.mch" - #else - #include "wx_cocoaMach-Omm_d.mch" - #endif - #else - #if __mwlinker__ - #include "wx_cocoaMacOSX++_d.mch" - #else - #include "wx_cocoaMach-O++_d.mch" - #endif - #endif -#else - #if __mwlinker__ - #include "wx_cocoaMacOSX_d.mch" - #else - #include "wx_cocoaMach-O_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW_COCOA__ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/wx_cwcocoa_d.h +// Purpose: Metrowerks Prefix Header File (wxCocoa Debug) +// Author: Tommy Tian (tommy.tian@webex.com) +// Modified by: David Elliott +// Created: 10/04/2004 +// RCS-ID: $Id: wx_cwcocoa_d.h 30235 2004-11-02 06:22:11Z DE $ +// Copyright: (c) Tommy Tian +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_CW_COCOA__ +#define _WX_CW_COCOA__ + +#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #ifdef __OBJC__ + #if __mwlinker__ + #include "wx_cocoaMacOSXmm_d.mch" + #else + #include "wx_cocoaMach-Omm_d.mch" + #endif + #else + #if __mwlinker__ + #include "wx_cocoaMacOSX++_d.mch" + #else + #include "wx_cocoaMach-O++_d.mch" + #endif + #endif +#else + #if __mwlinker__ + #include "wx_cocoaMacOSX_d.mch" + #else + #include "wx_cocoaMach-O_d.mch" + #endif +#endif +#endif + +#endif + // _WX_CW_COCOA__ diff --git a/Externals/wxWidgets/include/wx/wx_cwu_d.h b/Externals/wxWidgets/include/wx/wx_cwu_d.h index df5b7031ff..24c384a776 100644 --- a/Externals/wxWidgets/include/wx/wx_cwu_d.h +++ b/Externals/wxWidgets/include/wx/wx_cwu_d.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cwu_d.h 29319 2004-09-24 14:32:35Z ABX $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include <wx_PPCu++_d.mch> - #elif __INTEL__ - #include <wx_x86u++_d.mch> - #elif __CFM68K__ - #include <wx_cfmu++_d.mch> - #else - #include <wx_68ku++_d.mch> - #endif -#else - #if __POWERPC__ - #include <wx_PPCu_d.mch> - #elif __INTEL__ - #include <wx_x86u_d.mch> - #elif __CFM68K__ - #include <wx_cfmu_d.mch> - #else - #include <wx_68ku_d.mch> - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wx_cwu_d.h 29319 2004-09-24 14:32:35Z ABX $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #if __POWERPC__ + #include <wx_PPCu++_d.mch> + #elif __INTEL__ + #include <wx_x86u++_d.mch> + #elif __CFM68K__ + #include <wx_cfmu++_d.mch> + #else + #include <wx_68ku++_d.mch> + #endif +#else + #if __POWERPC__ + #include <wx_PPCu_d.mch> + #elif __INTEL__ + #include <wx_x86u_d.mch> + #elif __CFM68K__ + #include <wx_cfmu_d.mch> + #else + #include <wx_68ku_d.mch> + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxchar.h b/Externals/wxWidgets/include/wx/wxchar.h index 477967b7b7..bbdcab1fa9 100644 --- a/Externals/wxWidgets/include/wx/wxchar.h +++ b/Externals/wxWidgets/include/wx/wxchar.h @@ -1,1393 +1,1393 @@ -/* - * Name: wx/wxchar.h - * Purpose: Declarations common to wx char/wchar_t usage (wide chars) - * Author: Joel Farley, Ove Kåven - * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee - * Created: 1998/06/12 - * RCS-ID: $Id: wxchar.h 50987 2008-01-02 16:31:38Z VZ $ - * Copyright: (c) 1998-2006 wxWidgets dev team - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_WXCHAR_H_ -#define _WX_WXCHAR_H_ - -/* defs.h indirectly includes this file, so don't include it here */ -#include "wx/platform.h" -#include "wx/dlimpexp.h" - -#include <stdio.h> /* we use FILE below */ - -#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - char *strtok_r(char *, const char *, char **); -#endif - -/* check whether we have wchar_t and which size it is if we do */ -#if !defined(wxUSE_WCHAR_T) - #if defined(__UNIX__) - #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__) - #define wxUSE_WCHAR_T 1 - #else - #define wxUSE_WCHAR_T 0 - #endif - #elif defined(__GNUWIN32__) && !defined(__MINGW32__) - #define wxUSE_WCHAR_T 0 - #elif defined(__WATCOMC__) - #define wxUSE_WCHAR_T 0 - #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400) - #define wxUSE_WCHAR_T 0 - #else - /* add additional compiler checks if this fails */ - #define wxUSE_WCHAR_T 1 - #endif -#endif /* !defined(wxUSE_WCHAR_T) */ - -/* Unicode support requires wchar_t */ -#if wxUSE_UNICODE && !wxUSE_WCHAR_T - #error "wchar_t must be available in Unicode build" -#endif /* Unicode */ - -/* - Standard headers we need here. - - NB: don't include any wxWidgets headers here because almost all of them include - this one! - */ - -/* Required for wxPrintf() etc */ -#include <stdarg.h> - -/* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */ -/* and VC++ for Windows CE don't provide it */ -#if defined(__VISUALC__) && __VISUALC__ >= 1400 - #define wxStrdupA _strdup -#elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__) - /* use #define, not inline wrapper, as it is tested with #ifndef below */ - #define wxStrdupA strdup -#endif - -/* - non Unix compilers which do have wchar.h (but not tchar.h which is included - below and which includes wchar.h anyhow). - - Actually MinGW has tchar.h, but it does not include wchar.h - */ -#if defined(__MWERKS__) || defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__) - #ifndef HAVE_WCHAR_H - #define HAVE_WCHAR_H - #endif -#endif -#if defined(__MWERKS__) && !defined(__MACH__) - #ifndef HAVE_WCSLEN - #define HAVE_WCSLEN - #endif -#endif - -#if wxUSE_WCHAR_T - #ifdef HAVE_WCHAR_H - /* the current (as of Nov 2002) version of cygwin has a bug in its */ - /* wchar.h -- there is no extern "C" around the declarations in it and */ - /* this results in linking errors later; also, at least on some */ - /* Cygwin versions, wchar.h requires sys/types.h */ - #ifdef __CYGWIN__ - #include <sys/types.h> - #ifdef __cplusplus - extern "C" { - #endif - #endif /* Cygwin */ - - #include <wchar.h> - - #if defined(__CYGWIN__) && defined(__cplusplus) - } - #endif /* Cygwin and C++ */ - - #elif defined(HAVE_WCSTR_H) - /* old compilers have relevant declarations here */ - #include <wcstr.h> - #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__) - /* include stdlib.h for wchar_t */ - #include <stdlib.h> - #endif /* HAVE_WCHAR_H */ - - #ifdef HAVE_WIDEC_H - #include <widec.h> - #endif -#endif /* wxUSE_WCHAR_T */ - -/* ---------------------------------------------------------------------------- */ -/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */ -/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and have */ -/* the function mapping _tfoo() -> foo() or wfoo() */ -/* ---------------------------------------------------------------------------- */ - -/* VC++ and BC++ starting with 5.2 have TCHAR support */ -#ifdef __VISUALC__ - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) - #define wxHAVE_TCHAR_SUPPORT - #include <ctype.h> - #include <memory.h> -#elif defined(__WATCOMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__DMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__WXPALMOS__) - #include <stddef.h> -#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) - #define wxHAVE_TCHAR_SUPPORT - #include <stddef.h> - #include <string.h> - #include <ctype.h> -#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400) - /* VZ: the old VisualAge definitions were completely wrong and had no */ - /* chance at all to work in Unicode build anyhow so let's pretend that */ - /* VisualAge does _not_ support TCHAR for the moment (as indicated by */ - /* "0 &&" above) until someone really has time to delve into Unicode */ - /* issues under OS/2 */ - - /* VisualAge 4.0+ supports TCHAR */ - #define wxHAVE_TCHAR_SUPPORT -#endif /* compilers with (good) TCHAR support */ - -#if defined(__MWERKS__) - /* Metrowerks only has wide char support for OS X >= 10.3 */ - #if !defined(__DARWIN__) || \ - (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) - #define wxHAVE_MWERKS_UNICODE - #endif - - #ifdef wxHAVE_MWERKS_UNICODE - #define HAVE_WPRINTF 1 - #define HAVE_WCSRTOMBS 1 - #define HAVE_VSWPRINTF 1 - #endif -#endif /* __MWERKS__ */ - -#ifdef wxHAVE_TCHAR_SUPPORT - /* get TCHAR definition if we've got it */ - #include <tchar.h> - - /* we surely do have wchar_t if we have TCHAR */ - #ifndef wxUSE_WCHAR_T - #define wxUSE_WCHAR_T 1 - #endif /* !defined(wxUSE_WCHAR_T) */ - - /* and we also do have wcslen() */ - #ifndef HAVE_WCSLEN - #define HAVE_WCSLEN - #endif -#endif /* wxHAVE_TCHAR_SUPPORT */ - -/* ---------------------------------------------------------------------------- */ -/* define wxChar type */ -/* ---------------------------------------------------------------------------- */ - -/* TODO: define wxCharInt to be equal to either int or wint_t? */ - -#if !wxUSE_UNICODE - typedef char wxChar; - typedef signed char wxSChar; - typedef unsigned char wxUChar; -#else /* Unicode */ - /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */ - /* signed/unsigned version of it which (a) makes sense to me (unlike */ - /* char wchar_t is always unsigned) and (b) was how the previous */ - /* definitions worked so keep it like this */ - - /* Sun's SunPro compiler supports the wchar_t type and wide character */ - /* functions, but does not define __WCHAR_TYPE__. Define it here to */ - /* allow unicode enabled builds. */ - #if defined(__SUNPRO_CC) || defined(__SUNPRO_C) - #define __WCHAR_TYPE__ wxchar_t - #endif - - /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */ - /* comment below */ - #if !defined(__WCHAR_TYPE__) || \ - (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96)) - /* standard case */ - typedef wchar_t wxChar; - typedef wchar_t wxSChar; - typedef wchar_t wxUChar; - #else /* __WCHAR_TYPE__ and gcc < 2.96 */ - /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. However, */ - /* this doesn't work with new GCC 3.x compilers because wchar_t is */ - /* C++'s builtin type in the new standard. OTOH, old compilers (GCC */ - /* 2.x) won't accept new definition of wx{S,U}Char, therefore we */ - /* have to define wxChar conditionally depending on detected */ - /* compiler & compiler version. */ - /* with old definition of wxChar. */ - typedef __WCHAR_TYPE__ wxChar; - typedef __WCHAR_TYPE__ wxSChar; - typedef __WCHAR_TYPE__ wxUChar; - #endif /* __WCHAR_TYPE__ */ -#endif /* ASCII/Unicode */ - -/* ---------------------------------------------------------------------------- */ -/* define _T() and related macros */ -/* ---------------------------------------------------------------------------- */ - -/* BSD systems define _T() to be something different in ctype.h, override it */ -#if defined(__FreeBSD__) || defined(__DARWIN__) - #include <ctype.h> - #undef _T -#endif - -/* could already be defined by tchar.h (it's quasi standard) */ -#ifndef _T - #if !wxUSE_UNICODE - #define _T(x) x - #else /* Unicode */ - /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */ - #define _T(x) wxCONCAT_HELPER(L, x) - #endif /* ASCII/Unicode */ -#endif /* !defined(_T) */ - -/* although global macros with such names are normally bad, we want to have */ -/* another name for _T() which should be used to avoid confusion between _T() */ -/* and _() in wxWidgets sources */ -#define wxT(x) _T(x) - -/* this macro exists only for forward compatibility with wx 3.0 */ -#define wxS(x) _T(x) - -/* a helper macro allowing to make another macro Unicode-friendly, see below */ -#define wxAPPLY_T(x) _T(x) - -/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */ -#ifndef __TFILE__ - #define __TFILE__ wxAPPLY_T(__FILE__) -#endif - -#ifndef __TDATE__ - #define __TDATE__ wxAPPLY_T(__DATE__) -#endif - -#ifndef __TTIME__ - #define __TTIME__ wxAPPLY_T(__TIME__) -#endif - -/* - define wxFoo() function for each standard foo() function whose signature - (exceptionally including the return type) includes any mention of char: - wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have - the same signature but with char replaced by wxChar which allows us to use - it in Unicode build as well - */ - -#ifdef wxHAVE_TCHAR_SUPPORT - #include <ctype.h> - - #if defined(__WATCOMC__) && defined(UNICODE) - #define WXWCHAR_T_CAST(c) (wint_t)(c) - #else - #define WXWCHAR_T_CAST(c) c - #endif - - /* ctype.h functions */ - #define wxIsalnum(c) _istalnum(WXWCHAR_T_CAST(c)) - #define wxIsalpha(c) _istalpha(WXWCHAR_T_CAST(c)) - #define wxIscntrl(c) _istcntrl(WXWCHAR_T_CAST(c)) - #define wxIsdigit(c) _istdigit(WXWCHAR_T_CAST(c)) - #define wxIsgraph(c) _istgraph(WXWCHAR_T_CAST(c)) - #define wxIslower(c) _istlower(WXWCHAR_T_CAST(c)) - #define wxIsprint(c) _istprint(WXWCHAR_T_CAST(c)) - #define wxIspunct(c) _istpunct(WXWCHAR_T_CAST(c)) - #define wxIsspace(c) _istspace(WXWCHAR_T_CAST(c)) - #define wxIsupper(c) _istupper(WXWCHAR_T_CAST(c)) - #define wxIsxdigit(c) _istxdigit(WXWCHAR_T_CAST(c)) - - /* - There is a bug in VC6 C RTL: toxxx() functions dosn't do anything with - signed chars < 0, so "fix" it here. - */ - #define wxTolower(c) _totlower((wxUChar)(c)) - #define wxToupper(c) _totupper((wxUChar)(c)) - - /* locale.h functons */ - #define wxSetlocale _tsetlocale - - /* string.h functions */ - #define wxStrcat _tcscat - #define wxStrchr _tcschr - #define wxStrcmp _tcscmp - #define wxStrcoll _tcscoll - #define wxStrcpy _tcscpy - #define wxStrcspn _tcscspn - #define wxStrdupW _wcsdup /* notice the 'W'! */ - #define wxStrftime _tcsftime - #define wxStricmp _tcsicmp - #define wxStrnicmp _tcsnicmp - #define wxStrlen_ _tcslen /* used in wxStrlen inline function */ - #define wxStrncat _tcsncat - #define wxStrncmp _tcsncmp - #define wxStrncpy _tcsncpy - #define wxStrpbrk _tcspbrk - #define wxStrrchr _tcsrchr - #define wxStrspn _tcsspn - #define wxStrstr _tcsstr - #define wxStrtod _tcstod - #define wxStrtol _tcstol - #define wxStrtoul _tcstoul - #ifdef __VISUALC__ - #if __VISUALC__ >= 1300 && !defined(__WXWINCE__) - #define wxStrtoll _tcstoi64 - #define wxStrtoull _tcstoui64 - #endif /* VC++ 7+ */ - #endif - #define wxStrxfrm _tcsxfrm - - /* stdio.h functions */ - #define wxFgetc _fgettc - #define wxFgetchar _fgettchar - #define wxFgets _fgetts - #if wxUSE_UNICODE_MSLU - WXDLLIMPEXP_BASE FILE * wxMSLU__tfopen(const wxChar *name, const wxChar *mode); - - #define wxFopen wxMSLU__tfopen - #else - #define wxFopen _tfopen - #endif - #define wxFputc _fputtc - #define wxFputchar _fputtchar - #define wxFprintf _ftprintf - #define wxFputs _fputts - #define wxFreopen _tfreopen - #define wxFscanf _ftscanf - #define wxGetc _gettc - #define wxGetchar _gettchar - #define wxGets _getts - #define wxPerror _tperror - #define wxPrintf _tprintf - #define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f) - #define wxPutchar _puttchar - #define wxPuts _putts - #define wxScanf _tscanf - #if defined(__DMC__) - #if wxUSE_UNICODE - /* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */ - int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ; - #else - /* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */ - #define wxSprintf sprintf - #endif - #elif defined(__MINGW32__) && ( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) - #if wxUSE_UNICODE - /* MinGW with STLPort 5.1 adds count to swprintf (C99) so prototype conversion see wxchar.cpp */ - int wxSprintf (wchar_t*, const wchar_t*, ...); - #else - /* MinGW with STLPort 5.1 has clashing defines for _stprintf so use sprintf */ - #define wxSprintf sprintf - #endif - #else - #define wxSprintf _stprintf - #endif - - #define wxSscanf _stscanf - #define wxTmpnam _ttmpnam - #define wxUngetc _tungetc - #define wxVfprintf _vftprintf - #define wxVprintf _vtprintf - #define wxVsscanf _vstscanf - #define wxVsprintf _vstprintf - - /* special case: these functions are missing under Win9x with Unicows so we */ - /* have to implement them ourselves */ - #if wxUSE_UNICODE_MSLU - WXDLLIMPEXP_BASE int wxMSLU__trename(const wxChar *oldname, const wxChar *newname); - WXDLLIMPEXP_BASE int wxMSLU__tremove(const wxChar *name); - - #define wxRemove wxMSLU__tremove - #define wxRename wxMSLU__trename - #else - #ifdef __WXWINCE__ - /* carefully: wxRemove() must return 0 on success while DeleteFile() - returns 0 on error, so don't just define one as the other */ - int wxRemove(const wxChar *path); - #else - #define wxRemove _tremove - #define wxRename _trename - #endif - #endif - - /* stdlib.h functions */ - #define wxAtoi _ttoi - #define wxAtol _ttol - /* #define wxAtof _tttof -- notice that there is no such thing (why?) */ - /* there are no env vars at all under CE, so no _tgetenv neither */ - #ifdef __WXWINCE__ - /* can't define as inline function as this is a C file... */ - #define wxGetenv(name) ((wxChar *)NULL) - #else - #define wxGetenv _tgetenv - #endif - #define wxSystem _tsystem - - /* time.h functions */ - #define wxAsctime _tasctime - #define wxCtime _tctime - - #define wxMbstowcs mbstowcs - #define wxWcstombs wcstombs -#else /* !TCHAR-aware compilers */ - /* - There are 2 unrelated problems with these functions under Mac: - a) Metrowerks MSL CRT implements them strictly in C99 sense and - doesn't support (very common) extension of allowing to call - mbstowcs(NULL, ...) which makes it pretty useless as you can't - know the size of the needed buffer - b) OS X <= 10.2 declares and even defined these functions but - doesn't really implement them -- they always return an error - - So use our own replacements in both cases. - */ - #if defined(__MWERKS__) && defined(__MSL__) - #define wxNEED_WX_MBSTOWCS - #endif - - #ifdef __DARWIN__ - #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 - #define wxNEED_WX_MBSTOWCS - #endif - #endif - - #ifdef wxNEED_WX_MBSTOWCS - /* even though they are defined and "implemented", they are bad and just - stubs so we need our own - we need these even in ANSI builds!! */ - WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t *, const char *, size_t); - WXDLLIMPEXP_BASE size_t wxWcstombs (char *, const wchar_t *, size_t); - #else - #define wxMbstowcs mbstowcs - #define wxWcstombs wcstombs - #endif - - /* - The system C library on Mac OS X 10.2 and below does not support - unicode: in other words all wide-character functions such as towupper et - al. do simply not exist so we need to provide our own in that context, - except for the wchar_t definition/typedef itself. - - We need to do this for both project builder and CodeWarrior as - the latter uses the system C library in Mach builds for wide character - support, which as mentioned does not exist on 10.2 and below. - */ - #if wxUSE_UNICODE && \ - defined(__DARWIN__) && \ - ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 ) - /* we need everything! */ - #define wxNEED_WX_STRING_H - #define wxNEED_WX_CTYPE_H - - #define wxFgetchar(c) wxFgetc(c, stdin) - #define wxFputc wxPutc - #define wxFputchar(c) wxPutc(c, stdout) - #define wxGetc wxFgetc - #define wxGetchar(c) wxFgetc(c, stdin) - - #include <stdio.h> - - #define wxNEED_FGETC - #define wxNEED_FGETS - #define wxNEED_GETS - #define wxNEED_UNGETC - - #define wxNEED_FPUTS - #define wxNEED_PUTS - #define wxNEED_PUTC - - int wxFputs(const wxChar *ch, FILE *stream); - int wxPuts(const wxChar *ws); - int wxPutc(wxChar ch, FILE *stream); - - #ifdef __cplusplus - extern "C" { - #endif - WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s); - #ifdef __cplusplus - } - #endif - - #define wxPutchar(wch) wxPutc(wch, stdout) - - #define wxNEED_PRINTF_CONVERSION - #define wxNEED_WX_STDIO_H - #define wxNEED_WX_STDLIB_H - #define wxNEED_WX_TIME_H - - #elif wxUSE_UNICODE - #include <wctype.h> - - /* this is probably glibc-specific */ - #if defined(__WCHAR_TYPE__) && !defined(__MWERKS__) - /* ctype.h functions (wctype.h) */ - #define wxIsalnum iswalnum - #define wxIsalpha iswalpha - #define wxIscntrl iswcntrl - #define wxIsdigit iswdigit - #define wxIsgraph iswgraph - #define wxIslower iswlower - #define wxIsprint iswprint - #define wxIspunct iswpunct - #define wxIsspace iswspace - #define wxIsupper iswupper - #define wxIsxdigit iswxdigit - - #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) - /* /usr/include/wctype.h incorrectly declares translations */ - /* tables which provokes tons of compile-time warnings -- try */ - /* to correct this */ - #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower) - #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper) - #else /* !glibc 2.0 */ - #define wxTolower towlower - #define wxToupper towupper - #endif /* gcc/!gcc */ - - /* string.h functions (wchar.h) */ - #define wxStrcat wcscat - #define wxStrchr wcschr - #define wxStrcmp wcscmp - #define wxStrcoll wcscoll - #define wxStrcpy wcscpy - #define wxStrcspn wcscspn - #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ - #define wxStrncat wcsncat - #define wxStrncmp wcsncmp - #define wxStrncpy wcsncpy - #define wxStrpbrk wcspbrk - #define wxStrrchr wcsrchr - #define wxStrspn wcsspn - #define wxStrstr wcsstr - #define wxStrtod wcstod - #define wxStrtol wcstol - #define wxStrtoul wcstoul - #ifdef HAVE_WCSTOULL - /* assume that we have wcstoull(), which is also C99, too */ - #define wxStrtoll wcstoll - #define wxStrtoull wcstoull - #endif /* HAVE_WCSTOULL */ - #define wxStrxfrm wcsxfrm - - #define wxFgetc fgetwc - #define wxFgetchar fgetwchar - #define wxFgets fgetws - #define wxFputc fputwc - #define wxFputchar fputwchar - #define wxGetc getwc - #define wxGetchar getwchar - #define wxGets getws - #define wxUngetc ungetwc - - #ifdef HAVE_FPUTWS - #define wxFputs fputws - #else - #define wxNEED_FPUTS - #include <stdio.h> - int wxFputs(const wxChar *ch, FILE *stream); - #endif - - #ifdef HAVE_WPUTC - #define wxPutc wputc - #else - #define wxNEED_PUTC - #include <stdio.h> - int wxPutc(wxChar ch, FILE *stream); - #endif - - #ifdef HAVE_WPUTCHAR - #define wxPutchar wputchar - #else - #define wxPutchar(wch) wxPutc(wch, stdout) - #endif - - #ifdef HAVE_PUTWS - #define wxPuts putws - #else - #define wxNEED_PUTS - int wxPuts(const wxChar *ws); - #endif - - /* we need %s to %ls conversion for printf and scanf etc */ - #define wxNEED_PRINTF_CONVERSION - - /* glibc doesn't have wide char equivalents of the other stuff so */ - /* use our own versions */ - #define wxNEED_WX_STDIO_H - #define wxNEED_WX_STDLIB_H - #define wxNEED_WX_TIME_H - #elif defined(__MWERKS__) && ( defined(__MSL__) || defined(__MACH__) ) - /* ctype.h functions (wctype.h) */ - #define wxIsalnum iswalnum - #define wxIsalpha iswalpha - #define wxIscntrl iswcntrl - #define wxIsdigit iswdigit - #define wxIsgraph iswgraph - #define wxIslower iswlower - #define wxIsprint iswprint - #define wxIspunct iswpunct - #define wxIsspace iswspace - #define wxIsupper iswupper - #define wxIsxdigit iswxdigit - #define wxTolower towlower - #define wxToupper towupper - - /* string.h functions (wchar.h) */ - #define wxStrcat wcscat - #define wxStrchr wcschr - #define wxStrcmp wcscmp - #define wxStrcoll wcscoll - #define wxStrcpy wcscpy - #define wxStrcspn wcscspn - #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ - #define wxStrncat wcsncat - #define wxStrncmp wcsncmp - #define wxStrncpy wcsncpy - #define wxStrpbrk wcspbrk - #define wxStrrchr wcsrchr - #define wxStrspn wcsspn - #define wxStrstr wcsstr - #define wxStrtod wcstod - #define wxStrtol wcstol - #define wxStrtoul wcstoul - #define wxStrxfrm wcsxfrm - - #define wxFgetc fgetwc - #define wxFgetchar fgetwchar - #define wxFgets fgetws - #define wxFputc fputwc - #define wxFputchar fputwchar - #define wxGetc getwc - #define wxGetchar getwchar - #define wxGets getws - #define wxUngetc ungetwc - - #define wxNEED_PRINTF_CONVERSION - - #define wxPutc putwc - #define wxPutchar putwchar - #define wxFputs fputws - - /* stdio.h functions */ - - #define wxNEED_WX_STDIO_H - - /* stdlib.h functions */ - #ifdef __MACH__ - #define wxNEED_WX_STDLIB_H - #else - #define wxAtof watof - #define wxAtoi watoi - #define wxAtol watol - #define wxGetenv(a) ((wxChar*)NULL) - #define wxSystem(a) ((int)NULL) - #endif - /* time.h functions */ - #define wxAsctime wasciitime - #define wxCtime wctime - /* #define wxStrftime wcsftime */ - - #define wxNEED_WX_TIME_H - #else /* !metrowerks for apple */ - #error "Please define wide character functions for your environment" - #endif - #else /* ASCII */ - #include <ctype.h> - #include <string.h> - - /* ctype.h functions */ - #define wxIsalnum isalnum - #define wxIsalpha isalpha - #define wxIscntrl iscntrl - #define wxIsdigit isdigit - #define wxIsgraph isgraph - #define wxIslower islower - #define wxIsprint isprint - #define wxIspunct ispunct - #define wxIsspace isspace - #define wxIsupper isupper - #define wxIsxdigit isxdigit - #define wxTolower tolower - #define wxToupper toupper - - /* locale.h functons */ - #define wxSetlocale setlocale - - /* string.h functions */ - #define wxStrcat strcat - #define wxStrchr strchr - #define wxStrcmp strcmp - #define wxStrcoll strcoll - #define wxStrcpy strcpy - #define wxStrcspn strcspn - - /* wxStricmp and wxStrnicmp are defined below */ - #define wxStrlen_ strlen /* used in wxStrlen inline function */ - #define wxStrncat strncat - #define wxStrncmp strncmp - #define wxStrncpy strncpy - #define wxStrpbrk strpbrk - #define wxStrrchr strrchr - #define wxStrspn strspn - #define wxStrstr strstr - #define wxStrtod strtod - #ifdef HAVE_STRTOK_R - #define wxStrtok(str, sep, last) strtok_r(str, sep, last) - #endif - #define wxStrtol strtol - #define wxStrtoul strtoul - #ifdef HAVE_STRTOULL - /* assume that we have wcstoull(), which is also C99, too */ - #define wxStrtoll strtoll - #define wxStrtoull strtoull - #endif /* HAVE_WCSTOULL */ - #define wxStrxfrm strxfrm - - /* stdio.h functions */ - #define wxFopen fopen - #define wxFreopen freopen - #define wxRemove remove - #define wxRename rename - - #define wxPerror perror - #define wxTmpnam tmpnam - - #define wxFgetc fgetc - #define wxFgetchar fgetchar - #define wxFgets fgets - #define wxFputc fputc - #define wxFputs fputs - #define wxFputchar fputchar - #define wxFprintf fprintf - #define wxFscanf fscanf - #define wxGetc getc - #define wxGetchar getchar - #define wxGets gets - #define wxPrintf printf - #define wxPutc putc - #define wxPutchar putchar - #define wxPuts puts - #define wxScanf scanf - #define wxSprintf sprintf - #define wxSscanf sscanf - #define wxUngetc ungetc - #define wxVfprintf vfprintf - #define wxVprintf vprintf - #define wxVsscanf vsscanf - #define wxVsprintf vsprintf - - /* stdlib.h functions */ - #define wxAtof atof - #define wxAtoi atoi - #define wxAtol atol - #define wxGetenv getenv - #define wxSystem system - - /* time.h functions */ - #define wxAsctime asctime - #define wxCtime ctime - #define wxStrftime strftime - #endif /* Unicode/ASCII */ -#endif /* TCHAR-aware compilers/the others */ - -#ifdef wxStrtoll - #define wxHAS_STRTOLL -#endif - -/* - various special cases - */ - -/* define wxStricmp and wxStrnicmp for various compilers */ - -/* note that in Unicode mode we definitely are going to need our own version */ -#if !defined(wxStricmp) && !wxUSE_UNICODE - #if defined(__BORLANDC__) || defined(__WATCOMC__) || \ - defined(__SALFORDC__) || defined(__VISAGECPP__) || \ - defined(__EMX__) || defined(__DJGPP__) - #define wxStricmp stricmp - #define wxStrnicmp strnicmp - #elif defined(__WXPALMOS__) - /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This - * quick hack should do until one can be written. - */ - #define wxStricmp StrCaselessCompare - #define wxStrnicmp strnicmp - #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ - (defined(__MWERKS__) && defined(__INTEL__)) - #define wxStricmp _stricmp - #define wxStrnicmp _strnicmp - #elif defined(__UNIX__) || defined(__GNUWIN32__) - #define wxStricmp strcasecmp - #define wxStrnicmp strncasecmp - /* #else -- use wxWidgets implementation */ - #endif -#endif /* !defined(wxStricmp) */ - -/* define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as */ -/* it's used in wx/buffer.h -- and also might be used just below by wxStrlen() */ -/* when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen) */ -#if wxUSE_WCHAR_T - #ifdef HAVE_WCSLEN - #define wxWcslen wcslen - #else - WXDLLIMPEXP_BASE size_t wxWcslen(const wchar_t *s); - #endif -#endif /* wxUSE_WCHAR_T */ - -#ifdef __cplusplus -/* checks whether the passed in pointer is NULL and if the string is empty */ -inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; } - -/* safe version of strlen() (returns 0 if passed NULL pointer) */ -inline size_t wxStrlen(const wxChar *psz) { return psz ? wxStrlen_(psz) : 0; } -#endif - -/* - each of strdup() and wcsdup() may or may not be available but we need both - of them anyhow for wx/buffer.h so we define the missing one(s) in - wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW - defined -- if this is somehow not the case in some situations, please - correct that and not the lines here - */ -#if wxUSE_UNICODE - #define wxStrdup wxStrdupW -#else - #define wxStrdup wxStrdupA -#endif - -#ifdef __cplusplus -WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ -#endif - -/* printf() family saga */ - -/* - For some systems [v]snprintf() exists in the system libraries but not in the - headers, so we need to declare it ourselves to be able to use it. - */ -#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - int vsnprintf(char *str, size_t size, const char *format, va_list ap); -#endif /* !HAVE_VSNPRINTF_DECL */ - -#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL) -#ifdef __cplusplus - extern "C" -#else - extern -#endif - WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...); -#endif /* !HAVE_SNPRINTF_DECL */ - -/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the - * same isn't done for snprintf below, the builtin wxSnprintf_ is used - * instead since it's already a simple wrapper */ -#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL - inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap) - { - return vsnprintf(str, size, (char*)format, ap); - } -#endif - -/* - MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility - presumably) and normally _vsnwprintf() is used instead (but as - STLPort 5.1 defines standard vswprintf(), don't do this for it) - */ -#if defined(HAVE_VSWPRINTF) && defined(__MINGW32__) && !( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) - #undef HAVE_VSWPRINTF -#endif - -#if wxUSE_PRINTF_POS_PARAMS - /* - The systems where vsnprintf() supports positional parameters should - define the HAVE_UNIX98_PRINTF symbol. - - On systems which don't (e.g. Windows) we are forced to use - our wxVsnprintf() implementation. - */ - #if defined(HAVE_UNIX98_PRINTF) - #if wxUSE_UNICODE - #ifdef HAVE_VSWPRINTF - #define wxVsnprintf_ vswprintf - #endif - #else /* ASCII */ - #ifdef HAVE_BROKEN_VSNPRINTF_DECL - #define wxVsnprintf_ wx_fixed_vsnprintf - #else - #define wxVsnprintf_ vsnprintf - #endif - #endif - #else /* !HAVE_UNIX98_PRINTF */ - /* - The only compiler with positional parameters support under Windows - is VC++ 8.0 which provides a new xxprintf_p() functions family. - The 2003 PSDK includes a slightly earlier version of VC8 than the - main release and does not have the printf_p functions. - */ - #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__ - #if wxUSE_UNICODE - #define wxVsnprintf_ _vswprintf_p - #else - #define wxVsnprintf_ _vsprintf_p - #endif - #endif - #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */ -#else /* !wxUSE_PRINTF_POS_PARAMS */ - /* - We always want to define safe snprintf() function to be used instead of - sprintf(). Some compilers already have it (or rather vsnprintf() which - we really need...), otherwise we implement it using our own printf() - code. - - We define function with a trailing underscore here because the real one - is a wrapper around it as explained below - */ - - /* first deal with TCHAR-aware compilers which have _vsntprintf */ - #ifndef wxVsnprintf_ - #if defined(__VISUALC__) || \ - (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) - #define wxVsnprintf_ _vsntprintf - #define wxSnprintf_ _sntprintf - #endif - #endif - - /* if this didn't work, define it separately for Unicode and ANSI builds */ - #ifndef wxVsnprintf_ - #if wxUSE_UNICODE - #if defined(HAVE__VSNWPRINTF) - #define wxVsnprintf_ _vsnwprintf - #elif defined(HAVE_VSWPRINTF) - #define wxVsnprintf_ vswprintf - #elif defined(__WATCOMC__) - #define wxVsnprintf_ _vsnwprintf - #define wxSnprintf_ _snwprintf - #endif - #else /* ASCII */ - /* - All versions of CodeWarrior supported by wxWidgets apparently - have both snprintf() and vsnprintf() - */ - #if defined(HAVE_SNPRINTF) \ - || defined(__MWERKS__) || defined(__WATCOMC__) - #ifndef HAVE_BROKEN_SNPRINTF_DECL - #define wxSnprintf_ snprintf - #endif - #endif - #if defined(HAVE_VSNPRINTF) \ - || defined(__MWERKS__) || defined(__WATCOMC__) - #ifdef HAVE_BROKEN_VSNPRINTF_DECL - #define wxVsnprintf_ wx_fixed_vsnprintf - #else - #define wxVsnprintf_ vsnprintf - #endif - #endif - #endif /* Unicode/ASCII */ - #endif /* wxVsnprintf_ */ -#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */ - -#ifndef wxSnprintf_ - /* no snprintf(), cook our own */ - WXDLLIMPEXP_BASE int - wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) ATTRIBUTE_PRINTF_3; -#endif -#ifndef wxVsnprintf_ - /* no (suitable) vsnprintf(), cook our own */ - WXDLLIMPEXP_BASE int - wxVsnprintf_(wxChar *buf, size_t len, const wxChar *format, va_list argptr); - - #define wxUSE_WXVSNPRINTF 1 -#else - #define wxUSE_WXVSNPRINTF 0 -#endif - -/* - In Unicode mode we need to have all standard functions such as wprintf() and - so on but not all systems have them so use our own implementations in this - case. - */ -#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) - #define wxNEED_WPRINTF -#endif - -/* - More Unicode complications: although both ANSI C and C++ define a number of - wide character functions such as wprintf(), not all environments have them. - Worse, those which do have different behaviours: under Windows, %s format - specifier changes its meaning in Unicode build and expects a Unicode string - while under Unix/POSIX it still means an ASCII string even for wprintf() and - %ls has to be used for wide strings. - - We choose to always emulate Windows behaviour as more useful for us so even - if we have wprintf() we still must wrap it in a non trivial wxPrintf(). - -*/ - -#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF) - /* - we need to implement all wide character printf and scanf functions - either because we don't have them at all or because they don't have the - semantics we need - */ - int wxScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; - int wxSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap ); - int wxPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; - int wxSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; - int wxVfprintf( FILE *stream, const wxChar *format, va_list ap ); - int wxVprintf( const wxChar *format, va_list ap ); - int wxVsprintf( wxChar *str, const wxChar *format, va_list ap ); -#endif /* wxNEED_PRINTF_CONVERSION */ - -/* these 2 can be simply mapped to the versions with underscore at the end */ -/* if we don't have to do the conversion */ -/* - However, if we don't have any vswprintf() at all we don't need to redefine - anything as our own wxVsnprintf_() already behaves as needed. -*/ -#if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_) - int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3; - int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap ); -#else - #define wxSnprintf wxSnprintf_ - #define wxVsnprintf wxVsnprintf_ -#endif - -/* - various functions which might not be available in libc and for which we - provide our own replacements in wxchar.cpp - */ - -/* ctype.h functions */ - -/* RN: Used only under OSX <= 10.2 currently */ -#ifdef wxNEED_WX_CTYPE_H - WXDLLIMPEXP_BASE int wxIsalnum(wxChar ch); - WXDLLIMPEXP_BASE int wxIsalpha(wxChar ch); - WXDLLIMPEXP_BASE int wxIscntrl(wxChar ch); - WXDLLIMPEXP_BASE int wxIsdigit(wxChar ch); - WXDLLIMPEXP_BASE int wxIsgraph(wxChar ch); - WXDLLIMPEXP_BASE int wxIslower(wxChar ch); - WXDLLIMPEXP_BASE int wxIsprint(wxChar ch); - WXDLLIMPEXP_BASE int wxIspunct(wxChar ch); - WXDLLIMPEXP_BASE int wxIsspace(wxChar ch); - WXDLLIMPEXP_BASE int wxIsupper(wxChar ch); - WXDLLIMPEXP_BASE int wxIsxdigit(wxChar ch); - WXDLLIMPEXP_BASE int wxTolower(wxChar ch); - WXDLLIMPEXP_BASE int wxToupper(wxChar ch); -#endif /* wxNEED_WX_CTYPE_H */ - -/* under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks */ -/* the file parsing -- this may be true for 5.0 as well, update #ifdef then */ -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE - #undef wxIsspace - #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c)) -#endif /* VC++ */ - -/* - a few compilers don't have the (non standard but common) isascii function, - define it ourselves for them - */ -#ifndef isascii - #if defined(__MWERKS__) - #define wxNEED_ISASCII - #elif defined(_WIN32_WCE) - #if _WIN32_WCE <= 211 - #define wxNEED_ISASCII - #endif - #endif -#endif /* isascii */ - -#ifdef wxNEED_ISASCII - inline int isascii(int c) { return (unsigned)c < 0x80; } -#endif - -#ifdef _WIN32_WCE - #if _WIN32_WCE <= 211 - #define isspace(c) ((c) == _T(' ') || (c) == _T('\t')) - #endif -#endif /* _WIN32_WCE */ - -/* - we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the - initial versions of this header -- now it is too late to remove it so - although we fixed the function/macro name above, still provide the - backwards-compatible synonym. - */ -#define wxIsctrl wxIscntrl - -/* string.h functions */ -#ifndef strdup - #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000) - #define wxNEED_STRDUP - #elif defined(__WXWINCE__) - #if _WIN32_WCE <= 211 - #define wxNEED_STRDUP - #endif - #endif -#endif /* strdup */ - -#ifdef wxNEED_STRDUP - WXDLLIMPEXP_BASE char *strdup(const char* s); -#endif - -/* RN: Used only under OSX <= 10.2 currently - The __cplusplus ifdefs are messy, but they are required to build - the regex library, since c does not support function overloading -*/ -#ifdef wxNEED_WX_STRING_H -# ifdef __cplusplus - extern "C" { -# endif - WXDLLIMPEXP_BASE wxChar * wxStrcat(wxChar *dest, const wxChar *src); - WXDLLIMPEXP_BASE const wxChar * wxStrchr(const wxChar *s, wxChar c); - WXDLLIMPEXP_BASE int wxStrcmp(const wxChar *s1, const wxChar *s2); - WXDLLIMPEXP_BASE int wxStrcoll(const wxChar *s1, const wxChar *s2); - WXDLLIMPEXP_BASE wxChar * wxStrcpy(wxChar *dest, const wxChar *src); - WXDLLIMPEXP_BASE size_t wxStrcspn(const wxChar *s, const wxChar *reject); - WXDLLIMPEXP_BASE wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); - WXDLLIMPEXP_BASE int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); - WXDLLIMPEXP_BASE wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); - WXDLLIMPEXP_BASE const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); - WXDLLIMPEXP_BASE const wxChar * wxStrrchr(const wxChar *s, wxChar c); - WXDLLIMPEXP_BASE size_t wxStrspn(const wxChar *s, const wxChar *accept); - WXDLLIMPEXP_BASE const wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); -# ifdef __cplusplus - } -# endif - - /* These functions use C++, so we can't c extern them */ - WXDLLIMPEXP_BASE double wxStrtod(const wxChar *nptr, wxChar **endptr); - WXDLLIMPEXP_BASE long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); - WXDLLIMPEXP_BASE unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base); - WXDLLIMPEXP_BASE size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); - - /* inlined versions */ - #ifdef __cplusplus - inline wxChar * wxStrchr(wxChar *s, wxChar c) - { return (wxChar *)wxStrchr((const wxChar *)s, c); } - inline wxChar * wxStrpbrk(wxChar *s, const wxChar *accept) - { return (wxChar *)wxStrpbrk((const wxChar *)s, accept); } - inline wxChar * wxStrrchr(wxChar *s, wxChar c) - { return (wxChar *)wxStrrchr((const wxChar *)s, c); } - inline wxChar *wxStrstr(wxChar *haystack, const wxChar *needle) - { return (wxChar *)wxStrstr((const wxChar *)haystack, needle); } - #endif - -#endif /* wxNEED_WX_STRING_H */ - -#ifndef wxStrdupA -WXDLLIMPEXP_BASE char *wxStrdupA(const char *psz); -#endif - -#ifndef wxStrdupW -WXDLLIMPEXP_BASE wchar_t *wxStrdupW(const wchar_t *pwz); -#endif - -#ifndef wxStricmp -WXDLLIMPEXP_BASE int wxStricmp(const wxChar *psz1, const wxChar *psz2); -#endif - -#ifndef wxStrnicmp -WXDLLIMPEXP_BASE int wxStrnicmp(const wxChar *psz1, const wxChar *psz2, size_t len); -#endif - -#ifndef wxStrtok -WXDLLIMPEXP_BASE wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); -#endif - -#ifdef __cplusplus -#ifndef wxSetlocale -class WXDLLIMPEXP_BASE wxWCharBuffer; -WXDLLIMPEXP_BASE wxWCharBuffer wxSetlocale(int category, const wxChar *locale); -#endif -#endif - -/* stdio.h functions */ -#ifdef wxNEED_WX_STDIO_H - #include <stdio.h> - WXDLLIMPEXP_BASE FILE * wxFopen(const wxChar *path, const wxChar *mode); - WXDLLIMPEXP_BASE FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); - WXDLLIMPEXP_BASE int wxRemove(const wxChar *path); - WXDLLIMPEXP_BASE int wxRename(const wxChar *oldpath, const wxChar *newpath); - - /* *printf() family is handled separately */ -#endif /* wxNEED_WX_STDIO_H */ - - -/* stdlib.h functions */ -#ifndef wxAtof -WXDLLIMPEXP_BASE double wxAtof(const wxChar *psz); -#endif - -/* - mingw32 doesn't provide _tsystem() even though it does provide all the other - stdlib.h functions wrappers so check for it separately: - */ -#if defined(__MINGW32__) && wxUSE_UNICODE && !defined(_tsystem) - #define wxNEED_WXSYSTEM -#endif - -#ifdef wxNEED_WX_STDLIB_H -WXDLLIMPEXP_BASE int wxAtoi(const wxChar *psz); -WXDLLIMPEXP_BASE long wxAtol(const wxChar *psz); -WXDLLIMPEXP_BASE wxChar * wxGetenv(const wxChar *name); -#define wxNEED_WXSYSTEM -#endif - -#ifdef wxNEED_WXSYSTEM -WXDLLIMPEXP_BASE int wxSystem(const wxChar *psz); -#endif - - -/* time.h functions */ -#ifdef wxNEED_WX_TIME_H -#if defined(__MWERKS__) && defined(macintosh) - #include <time.h> -#endif - /*silent gabby compilers*/ - struct tm; - WXDLLIMPEXP_BASE size_t wxStrftime(wxChar *s, size_t max, - const wxChar *fmt, const struct tm *tm); -#endif /* wxNEED_WX_TIME_H */ - -#ifndef wxCtime -#include <time.h> -WXDLLIMPEXP_BASE wxChar *wxCtime(const time_t *timep); -#endif - - -/* missing functions in some WinCE versions */ -#ifdef _WIN32_WCE -#if (_WIN32_WCE < 300) -WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); -#endif -#endif /* _WIN32_WCE */ - -/* multibyte to wide char conversion functions and macros */ - -#if wxUSE_WCHAR_T - /* multibyte<->widechar conversion */ - WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); - WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); - - #if wxUSE_UNICODE - #define wxMB2WX wxMB2WC - #define wxWX2MB wxWC2MB - #define wxWC2WX wxStrncpy - #define wxWX2WC wxStrncpy - #else - #define wxMB2WX wxStrncpy - #define wxWX2MB wxStrncpy - #define wxWC2WX wxWC2MB - #define wxWX2WC wxMB2WC - #endif -#else /* !wxUSE_UNICODE */ -/* Why is this here? -#error ha */ - /* No wxUSE_WCHAR_T: we have to do something (JACS) */ - #define wxMB2WC wxStrncpy - #define wxWC2MB wxStrncpy - #define wxMB2WX wxStrncpy - #define wxWX2MB wxStrncpy - #define wxWC2WX wxWC2MB - #define wxWX2WC wxMB2WC -#endif - -/* - RN: The following are not normal versions of memcpy et al., rather - these are either char or widechar versions depending on - if unicode is used or not. -*/ - -#ifdef __cplusplus - - // - // RN: We could do the usual tricky compiler detection here, - // and use their variant (such as wmemchr, etc.). The problem - // is that these functions are quite rare, even though they are - // part of the current POSIX standard. In addition, most compilers - // (including even MSC) inline them just like we do right in their - // headers. - // - #include <string.h> - #if wxUSE_UNICODE - //implement our own wmem variants - inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) - { - for(;l && *s != c;--l, ++s) {} - - if(l) - return (wxChar*)s; - return NULL; - } - - inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) - { - for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} - - if(len) - return *sz1 < *sz2 ? -1 : *sz1 > *sz2; - else - return 0; - } - - inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) - { - return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); - } - - inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) - { - return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); - } - - inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len) - { - wxChar* szRet = szOut; - - while (len--) - *szOut++ = cIn; - - return szRet; - } - #else /* !wxUSE_UNICODE */ - #if wxABI_VERSION >= 20805 - // for compatibility with earlier versions, these functions take - // "void *" but in the next wx version they will take "char *" so - // don't use them with void pointers (use the standard memxxx() - // with them) - inline char* wxTmemchr(const void* s, int c, size_t len) - { return (char*)memchr(s, c, len); } - inline int wxTmemcmp(const void* sz1, const void* sz2, size_t len) - { return memcmp(sz1, sz2, len); } - inline char* wxTmemcpy(void* szOut, const void* szIn, size_t len) - { return (char*)memcpy(szOut, szIn, len); } - inline char* wxTmemmove(void* szOut, const void* szIn, size_t len) - { return (char*)memmove(szOut, szIn, len); } - inline char* wxTmemset(void* szOut, int c, size_t len) - { return (char*)memset(szOut, c, len); } - #else - # define wxTmemchr memchr - # define wxTmemcmp memcmp - # define wxTmemcpy memcpy - # define wxTmemmove memmove - # define wxTmemset memset - #endif - #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */ - -#endif /*__cplusplus*/ - - -#endif /* _WX_WXCHAR_H_ */ - +/* + * Name: wx/wxchar.h + * Purpose: Declarations common to wx char/wchar_t usage (wide chars) + * Author: Joel Farley, Ove Kåven + * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee + * Created: 1998/06/12 + * RCS-ID: $Id: wxchar.h 50987 2008-01-02 16:31:38Z VZ $ + * Copyright: (c) 1998-2006 wxWidgets dev team + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_WXCHAR_H_ +#define _WX_WXCHAR_H_ + +/* defs.h indirectly includes this file, so don't include it here */ +#include "wx/platform.h" +#include "wx/dlimpexp.h" + +#include <stdio.h> /* we use FILE below */ + +#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS + char *strtok_r(char *, const char *, char **); +#endif + +/* check whether we have wchar_t and which size it is if we do */ +#if !defined(wxUSE_WCHAR_T) + #if defined(__UNIX__) + #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__) + #define wxUSE_WCHAR_T 1 + #else + #define wxUSE_WCHAR_T 0 + #endif + #elif defined(__GNUWIN32__) && !defined(__MINGW32__) + #define wxUSE_WCHAR_T 0 + #elif defined(__WATCOMC__) + #define wxUSE_WCHAR_T 0 + #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400) + #define wxUSE_WCHAR_T 0 + #else + /* add additional compiler checks if this fails */ + #define wxUSE_WCHAR_T 1 + #endif +#endif /* !defined(wxUSE_WCHAR_T) */ + +/* Unicode support requires wchar_t */ +#if wxUSE_UNICODE && !wxUSE_WCHAR_T + #error "wchar_t must be available in Unicode build" +#endif /* Unicode */ + +/* + Standard headers we need here. + + NB: don't include any wxWidgets headers here because almost all of them include + this one! + */ + +/* Required for wxPrintf() etc */ +#include <stdarg.h> + +/* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */ +/* and VC++ for Windows CE don't provide it */ +#if defined(__VISUALC__) && __VISUALC__ >= 1400 + #define wxStrdupA _strdup +#elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__) + /* use #define, not inline wrapper, as it is tested with #ifndef below */ + #define wxStrdupA strdup +#endif + +/* + non Unix compilers which do have wchar.h (but not tchar.h which is included + below and which includes wchar.h anyhow). + + Actually MinGW has tchar.h, but it does not include wchar.h + */ +#if defined(__MWERKS__) || defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__) + #ifndef HAVE_WCHAR_H + #define HAVE_WCHAR_H + #endif +#endif +#if defined(__MWERKS__) && !defined(__MACH__) + #ifndef HAVE_WCSLEN + #define HAVE_WCSLEN + #endif +#endif + +#if wxUSE_WCHAR_T + #ifdef HAVE_WCHAR_H + /* the current (as of Nov 2002) version of cygwin has a bug in its */ + /* wchar.h -- there is no extern "C" around the declarations in it and */ + /* this results in linking errors later; also, at least on some */ + /* Cygwin versions, wchar.h requires sys/types.h */ + #ifdef __CYGWIN__ + #include <sys/types.h> + #ifdef __cplusplus + extern "C" { + #endif + #endif /* Cygwin */ + + #include <wchar.h> + + #if defined(__CYGWIN__) && defined(__cplusplus) + } + #endif /* Cygwin and C++ */ + + #elif defined(HAVE_WCSTR_H) + /* old compilers have relevant declarations here */ + #include <wcstr.h> + #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__) + /* include stdlib.h for wchar_t */ + #include <stdlib.h> + #endif /* HAVE_WCHAR_H */ + + #ifdef HAVE_WIDEC_H + #include <widec.h> + #endif +#endif /* wxUSE_WCHAR_T */ + +/* ---------------------------------------------------------------------------- */ +/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */ +/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and have */ +/* the function mapping _tfoo() -> foo() or wfoo() */ +/* ---------------------------------------------------------------------------- */ + +/* VC++ and BC++ starting with 5.2 have TCHAR support */ +#ifdef __VISUALC__ + #define wxHAVE_TCHAR_SUPPORT +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) + #define wxHAVE_TCHAR_SUPPORT + #include <ctype.h> + #include <memory.h> +#elif defined(__WATCOMC__) + #define wxHAVE_TCHAR_SUPPORT +#elif defined(__DMC__) + #define wxHAVE_TCHAR_SUPPORT +#elif defined(__WXPALMOS__) + #include <stddef.h> +#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) + #define wxHAVE_TCHAR_SUPPORT + #include <stddef.h> + #include <string.h> + #include <ctype.h> +#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400) + /* VZ: the old VisualAge definitions were completely wrong and had no */ + /* chance at all to work in Unicode build anyhow so let's pretend that */ + /* VisualAge does _not_ support TCHAR for the moment (as indicated by */ + /* "0 &&" above) until someone really has time to delve into Unicode */ + /* issues under OS/2 */ + + /* VisualAge 4.0+ supports TCHAR */ + #define wxHAVE_TCHAR_SUPPORT +#endif /* compilers with (good) TCHAR support */ + +#if defined(__MWERKS__) + /* Metrowerks only has wide char support for OS X >= 10.3 */ + #if !defined(__DARWIN__) || \ + (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) + #define wxHAVE_MWERKS_UNICODE + #endif + + #ifdef wxHAVE_MWERKS_UNICODE + #define HAVE_WPRINTF 1 + #define HAVE_WCSRTOMBS 1 + #define HAVE_VSWPRINTF 1 + #endif +#endif /* __MWERKS__ */ + +#ifdef wxHAVE_TCHAR_SUPPORT + /* get TCHAR definition if we've got it */ + #include <tchar.h> + + /* we surely do have wchar_t if we have TCHAR */ + #ifndef wxUSE_WCHAR_T + #define wxUSE_WCHAR_T 1 + #endif /* !defined(wxUSE_WCHAR_T) */ + + /* and we also do have wcslen() */ + #ifndef HAVE_WCSLEN + #define HAVE_WCSLEN + #endif +#endif /* wxHAVE_TCHAR_SUPPORT */ + +/* ---------------------------------------------------------------------------- */ +/* define wxChar type */ +/* ---------------------------------------------------------------------------- */ + +/* TODO: define wxCharInt to be equal to either int or wint_t? */ + +#if !wxUSE_UNICODE + typedef char wxChar; + typedef signed char wxSChar; + typedef unsigned char wxUChar; +#else /* Unicode */ + /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */ + /* signed/unsigned version of it which (a) makes sense to me (unlike */ + /* char wchar_t is always unsigned) and (b) was how the previous */ + /* definitions worked so keep it like this */ + + /* Sun's SunPro compiler supports the wchar_t type and wide character */ + /* functions, but does not define __WCHAR_TYPE__. Define it here to */ + /* allow unicode enabled builds. */ + #if defined(__SUNPRO_CC) || defined(__SUNPRO_C) + #define __WCHAR_TYPE__ wxchar_t + #endif + + /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */ + /* comment below */ + #if !defined(__WCHAR_TYPE__) || \ + (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96)) + /* standard case */ + typedef wchar_t wxChar; + typedef wchar_t wxSChar; + typedef wchar_t wxUChar; + #else /* __WCHAR_TYPE__ and gcc < 2.96 */ + /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. However, */ + /* this doesn't work with new GCC 3.x compilers because wchar_t is */ + /* C++'s builtin type in the new standard. OTOH, old compilers (GCC */ + /* 2.x) won't accept new definition of wx{S,U}Char, therefore we */ + /* have to define wxChar conditionally depending on detected */ + /* compiler & compiler version. */ + /* with old definition of wxChar. */ + typedef __WCHAR_TYPE__ wxChar; + typedef __WCHAR_TYPE__ wxSChar; + typedef __WCHAR_TYPE__ wxUChar; + #endif /* __WCHAR_TYPE__ */ +#endif /* ASCII/Unicode */ + +/* ---------------------------------------------------------------------------- */ +/* define _T() and related macros */ +/* ---------------------------------------------------------------------------- */ + +/* BSD systems define _T() to be something different in ctype.h, override it */ +#if defined(__FreeBSD__) || defined(__DARWIN__) + #include <ctype.h> + #undef _T +#endif + +/* could already be defined by tchar.h (it's quasi standard) */ +#ifndef _T + #if !wxUSE_UNICODE + #define _T(x) x + #else /* Unicode */ + /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */ + #define _T(x) wxCONCAT_HELPER(L, x) + #endif /* ASCII/Unicode */ +#endif /* !defined(_T) */ + +/* although global macros with such names are normally bad, we want to have */ +/* another name for _T() which should be used to avoid confusion between _T() */ +/* and _() in wxWidgets sources */ +#define wxT(x) _T(x) + +/* this macro exists only for forward compatibility with wx 3.0 */ +#define wxS(x) _T(x) + +/* a helper macro allowing to make another macro Unicode-friendly, see below */ +#define wxAPPLY_T(x) _T(x) + +/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */ +#ifndef __TFILE__ + #define __TFILE__ wxAPPLY_T(__FILE__) +#endif + +#ifndef __TDATE__ + #define __TDATE__ wxAPPLY_T(__DATE__) +#endif + +#ifndef __TTIME__ + #define __TTIME__ wxAPPLY_T(__TIME__) +#endif + +/* + define wxFoo() function for each standard foo() function whose signature + (exceptionally including the return type) includes any mention of char: + wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have + the same signature but with char replaced by wxChar which allows us to use + it in Unicode build as well + */ + +#ifdef wxHAVE_TCHAR_SUPPORT + #include <ctype.h> + + #if defined(__WATCOMC__) && defined(UNICODE) + #define WXWCHAR_T_CAST(c) (wint_t)(c) + #else + #define WXWCHAR_T_CAST(c) c + #endif + + /* ctype.h functions */ + #define wxIsalnum(c) _istalnum(WXWCHAR_T_CAST(c)) + #define wxIsalpha(c) _istalpha(WXWCHAR_T_CAST(c)) + #define wxIscntrl(c) _istcntrl(WXWCHAR_T_CAST(c)) + #define wxIsdigit(c) _istdigit(WXWCHAR_T_CAST(c)) + #define wxIsgraph(c) _istgraph(WXWCHAR_T_CAST(c)) + #define wxIslower(c) _istlower(WXWCHAR_T_CAST(c)) + #define wxIsprint(c) _istprint(WXWCHAR_T_CAST(c)) + #define wxIspunct(c) _istpunct(WXWCHAR_T_CAST(c)) + #define wxIsspace(c) _istspace(WXWCHAR_T_CAST(c)) + #define wxIsupper(c) _istupper(WXWCHAR_T_CAST(c)) + #define wxIsxdigit(c) _istxdigit(WXWCHAR_T_CAST(c)) + + /* + There is a bug in VC6 C RTL: toxxx() functions dosn't do anything with + signed chars < 0, so "fix" it here. + */ + #define wxTolower(c) _totlower((wxUChar)(c)) + #define wxToupper(c) _totupper((wxUChar)(c)) + + /* locale.h functons */ + #define wxSetlocale _tsetlocale + + /* string.h functions */ + #define wxStrcat _tcscat + #define wxStrchr _tcschr + #define wxStrcmp _tcscmp + #define wxStrcoll _tcscoll + #define wxStrcpy _tcscpy + #define wxStrcspn _tcscspn + #define wxStrdupW _wcsdup /* notice the 'W'! */ + #define wxStrftime _tcsftime + #define wxStricmp _tcsicmp + #define wxStrnicmp _tcsnicmp + #define wxStrlen_ _tcslen /* used in wxStrlen inline function */ + #define wxStrncat _tcsncat + #define wxStrncmp _tcsncmp + #define wxStrncpy _tcsncpy + #define wxStrpbrk _tcspbrk + #define wxStrrchr _tcsrchr + #define wxStrspn _tcsspn + #define wxStrstr _tcsstr + #define wxStrtod _tcstod + #define wxStrtol _tcstol + #define wxStrtoul _tcstoul + #ifdef __VISUALC__ + #if __VISUALC__ >= 1300 && !defined(__WXWINCE__) + #define wxStrtoll _tcstoi64 + #define wxStrtoull _tcstoui64 + #endif /* VC++ 7+ */ + #endif + #define wxStrxfrm _tcsxfrm + + /* stdio.h functions */ + #define wxFgetc _fgettc + #define wxFgetchar _fgettchar + #define wxFgets _fgetts + #if wxUSE_UNICODE_MSLU + WXDLLIMPEXP_BASE FILE * wxMSLU__tfopen(const wxChar *name, const wxChar *mode); + + #define wxFopen wxMSLU__tfopen + #else + #define wxFopen _tfopen + #endif + #define wxFputc _fputtc + #define wxFputchar _fputtchar + #define wxFprintf _ftprintf + #define wxFputs _fputts + #define wxFreopen _tfreopen + #define wxFscanf _ftscanf + #define wxGetc _gettc + #define wxGetchar _gettchar + #define wxGets _getts + #define wxPerror _tperror + #define wxPrintf _tprintf + #define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f) + #define wxPutchar _puttchar + #define wxPuts _putts + #define wxScanf _tscanf + #if defined(__DMC__) + #if wxUSE_UNICODE + /* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */ + int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ; + #else + /* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */ + #define wxSprintf sprintf + #endif + #elif defined(__MINGW32__) && ( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) + #if wxUSE_UNICODE + /* MinGW with STLPort 5.1 adds count to swprintf (C99) so prototype conversion see wxchar.cpp */ + int wxSprintf (wchar_t*, const wchar_t*, ...); + #else + /* MinGW with STLPort 5.1 has clashing defines for _stprintf so use sprintf */ + #define wxSprintf sprintf + #endif + #else + #define wxSprintf _stprintf + #endif + + #define wxSscanf _stscanf + #define wxTmpnam _ttmpnam + #define wxUngetc _tungetc + #define wxVfprintf _vftprintf + #define wxVprintf _vtprintf + #define wxVsscanf _vstscanf + #define wxVsprintf _vstprintf + + /* special case: these functions are missing under Win9x with Unicows so we */ + /* have to implement them ourselves */ + #if wxUSE_UNICODE_MSLU + WXDLLIMPEXP_BASE int wxMSLU__trename(const wxChar *oldname, const wxChar *newname); + WXDLLIMPEXP_BASE int wxMSLU__tremove(const wxChar *name); + + #define wxRemove wxMSLU__tremove + #define wxRename wxMSLU__trename + #else + #ifdef __WXWINCE__ + /* carefully: wxRemove() must return 0 on success while DeleteFile() + returns 0 on error, so don't just define one as the other */ + int wxRemove(const wxChar *path); + #else + #define wxRemove _tremove + #define wxRename _trename + #endif + #endif + + /* stdlib.h functions */ + #define wxAtoi _ttoi + #define wxAtol _ttol + /* #define wxAtof _tttof -- notice that there is no such thing (why?) */ + /* there are no env vars at all under CE, so no _tgetenv neither */ + #ifdef __WXWINCE__ + /* can't define as inline function as this is a C file... */ + #define wxGetenv(name) ((wxChar *)NULL) + #else + #define wxGetenv _tgetenv + #endif + #define wxSystem _tsystem + + /* time.h functions */ + #define wxAsctime _tasctime + #define wxCtime _tctime + + #define wxMbstowcs mbstowcs + #define wxWcstombs wcstombs +#else /* !TCHAR-aware compilers */ + /* + There are 2 unrelated problems with these functions under Mac: + a) Metrowerks MSL CRT implements them strictly in C99 sense and + doesn't support (very common) extension of allowing to call + mbstowcs(NULL, ...) which makes it pretty useless as you can't + know the size of the needed buffer + b) OS X <= 10.2 declares and even defined these functions but + doesn't really implement them -- they always return an error + + So use our own replacements in both cases. + */ + #if defined(__MWERKS__) && defined(__MSL__) + #define wxNEED_WX_MBSTOWCS + #endif + + #ifdef __DARWIN__ + #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 + #define wxNEED_WX_MBSTOWCS + #endif + #endif + + #ifdef wxNEED_WX_MBSTOWCS + /* even though they are defined and "implemented", they are bad and just + stubs so we need our own - we need these even in ANSI builds!! */ + WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t *, const char *, size_t); + WXDLLIMPEXP_BASE size_t wxWcstombs (char *, const wchar_t *, size_t); + #else + #define wxMbstowcs mbstowcs + #define wxWcstombs wcstombs + #endif + + /* + The system C library on Mac OS X 10.2 and below does not support + unicode: in other words all wide-character functions such as towupper et + al. do simply not exist so we need to provide our own in that context, + except for the wchar_t definition/typedef itself. + + We need to do this for both project builder and CodeWarrior as + the latter uses the system C library in Mach builds for wide character + support, which as mentioned does not exist on 10.2 and below. + */ + #if wxUSE_UNICODE && \ + defined(__DARWIN__) && \ + ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 ) + /* we need everything! */ + #define wxNEED_WX_STRING_H + #define wxNEED_WX_CTYPE_H + + #define wxFgetchar(c) wxFgetc(c, stdin) + #define wxFputc wxPutc + #define wxFputchar(c) wxPutc(c, stdout) + #define wxGetc wxFgetc + #define wxGetchar(c) wxFgetc(c, stdin) + + #include <stdio.h> + + #define wxNEED_FGETC + #define wxNEED_FGETS + #define wxNEED_GETS + #define wxNEED_UNGETC + + #define wxNEED_FPUTS + #define wxNEED_PUTS + #define wxNEED_PUTC + + int wxFputs(const wxChar *ch, FILE *stream); + int wxPuts(const wxChar *ws); + int wxPutc(wxChar ch, FILE *stream); + + #ifdef __cplusplus + extern "C" { + #endif + WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s); + #ifdef __cplusplus + } + #endif + + #define wxPutchar(wch) wxPutc(wch, stdout) + + #define wxNEED_PRINTF_CONVERSION + #define wxNEED_WX_STDIO_H + #define wxNEED_WX_STDLIB_H + #define wxNEED_WX_TIME_H + + #elif wxUSE_UNICODE + #include <wctype.h> + + /* this is probably glibc-specific */ + #if defined(__WCHAR_TYPE__) && !defined(__MWERKS__) + /* ctype.h functions (wctype.h) */ + #define wxIsalnum iswalnum + #define wxIsalpha iswalpha + #define wxIscntrl iswcntrl + #define wxIsdigit iswdigit + #define wxIsgraph iswgraph + #define wxIslower iswlower + #define wxIsprint iswprint + #define wxIspunct iswpunct + #define wxIsspace iswspace + #define wxIsupper iswupper + #define wxIsxdigit iswxdigit + + #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) + /* /usr/include/wctype.h incorrectly declares translations */ + /* tables which provokes tons of compile-time warnings -- try */ + /* to correct this */ + #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower) + #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper) + #else /* !glibc 2.0 */ + #define wxTolower towlower + #define wxToupper towupper + #endif /* gcc/!gcc */ + + /* string.h functions (wchar.h) */ + #define wxStrcat wcscat + #define wxStrchr wcschr + #define wxStrcmp wcscmp + #define wxStrcoll wcscoll + #define wxStrcpy wcscpy + #define wxStrcspn wcscspn + #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ + #define wxStrncat wcsncat + #define wxStrncmp wcsncmp + #define wxStrncpy wcsncpy + #define wxStrpbrk wcspbrk + #define wxStrrchr wcsrchr + #define wxStrspn wcsspn + #define wxStrstr wcsstr + #define wxStrtod wcstod + #define wxStrtol wcstol + #define wxStrtoul wcstoul + #ifdef HAVE_WCSTOULL + /* assume that we have wcstoull(), which is also C99, too */ + #define wxStrtoll wcstoll + #define wxStrtoull wcstoull + #endif /* HAVE_WCSTOULL */ + #define wxStrxfrm wcsxfrm + + #define wxFgetc fgetwc + #define wxFgetchar fgetwchar + #define wxFgets fgetws + #define wxFputc fputwc + #define wxFputchar fputwchar + #define wxGetc getwc + #define wxGetchar getwchar + #define wxGets getws + #define wxUngetc ungetwc + + #ifdef HAVE_FPUTWS + #define wxFputs fputws + #else + #define wxNEED_FPUTS + #include <stdio.h> + int wxFputs(const wxChar *ch, FILE *stream); + #endif + + #ifdef HAVE_WPUTC + #define wxPutc wputc + #else + #define wxNEED_PUTC + #include <stdio.h> + int wxPutc(wxChar ch, FILE *stream); + #endif + + #ifdef HAVE_WPUTCHAR + #define wxPutchar wputchar + #else + #define wxPutchar(wch) wxPutc(wch, stdout) + #endif + + #ifdef HAVE_PUTWS + #define wxPuts putws + #else + #define wxNEED_PUTS + int wxPuts(const wxChar *ws); + #endif + + /* we need %s to %ls conversion for printf and scanf etc */ + #define wxNEED_PRINTF_CONVERSION + + /* glibc doesn't have wide char equivalents of the other stuff so */ + /* use our own versions */ + #define wxNEED_WX_STDIO_H + #define wxNEED_WX_STDLIB_H + #define wxNEED_WX_TIME_H + #elif defined(__MWERKS__) && ( defined(__MSL__) || defined(__MACH__) ) + /* ctype.h functions (wctype.h) */ + #define wxIsalnum iswalnum + #define wxIsalpha iswalpha + #define wxIscntrl iswcntrl + #define wxIsdigit iswdigit + #define wxIsgraph iswgraph + #define wxIslower iswlower + #define wxIsprint iswprint + #define wxIspunct iswpunct + #define wxIsspace iswspace + #define wxIsupper iswupper + #define wxIsxdigit iswxdigit + #define wxTolower towlower + #define wxToupper towupper + + /* string.h functions (wchar.h) */ + #define wxStrcat wcscat + #define wxStrchr wcschr + #define wxStrcmp wcscmp + #define wxStrcoll wcscoll + #define wxStrcpy wcscpy + #define wxStrcspn wcscspn + #define wxStrlen_ wxWcslen /* wxStrlen_() is used in wxStrlen() */ + #define wxStrncat wcsncat + #define wxStrncmp wcsncmp + #define wxStrncpy wcsncpy + #define wxStrpbrk wcspbrk + #define wxStrrchr wcsrchr + #define wxStrspn wcsspn + #define wxStrstr wcsstr + #define wxStrtod wcstod + #define wxStrtol wcstol + #define wxStrtoul wcstoul + #define wxStrxfrm wcsxfrm + + #define wxFgetc fgetwc + #define wxFgetchar fgetwchar + #define wxFgets fgetws + #define wxFputc fputwc + #define wxFputchar fputwchar + #define wxGetc getwc + #define wxGetchar getwchar + #define wxGets getws + #define wxUngetc ungetwc + + #define wxNEED_PRINTF_CONVERSION + + #define wxPutc putwc + #define wxPutchar putwchar + #define wxFputs fputws + + /* stdio.h functions */ + + #define wxNEED_WX_STDIO_H + + /* stdlib.h functions */ + #ifdef __MACH__ + #define wxNEED_WX_STDLIB_H + #else + #define wxAtof watof + #define wxAtoi watoi + #define wxAtol watol + #define wxGetenv(a) ((wxChar*)NULL) + #define wxSystem(a) ((int)NULL) + #endif + /* time.h functions */ + #define wxAsctime wasciitime + #define wxCtime wctime + /* #define wxStrftime wcsftime */ + + #define wxNEED_WX_TIME_H + #else /* !metrowerks for apple */ + #error "Please define wide character functions for your environment" + #endif + #else /* ASCII */ + #include <ctype.h> + #include <string.h> + + /* ctype.h functions */ + #define wxIsalnum isalnum + #define wxIsalpha isalpha + #define wxIscntrl iscntrl + #define wxIsdigit isdigit + #define wxIsgraph isgraph + #define wxIslower islower + #define wxIsprint isprint + #define wxIspunct ispunct + #define wxIsspace isspace + #define wxIsupper isupper + #define wxIsxdigit isxdigit + #define wxTolower tolower + #define wxToupper toupper + + /* locale.h functons */ + #define wxSetlocale setlocale + + /* string.h functions */ + #define wxStrcat strcat + #define wxStrchr strchr + #define wxStrcmp strcmp + #define wxStrcoll strcoll + #define wxStrcpy strcpy + #define wxStrcspn strcspn + + /* wxStricmp and wxStrnicmp are defined below */ + #define wxStrlen_ strlen /* used in wxStrlen inline function */ + #define wxStrncat strncat + #define wxStrncmp strncmp + #define wxStrncpy strncpy + #define wxStrpbrk strpbrk + #define wxStrrchr strrchr + #define wxStrspn strspn + #define wxStrstr strstr + #define wxStrtod strtod + #ifdef HAVE_STRTOK_R + #define wxStrtok(str, sep, last) strtok_r(str, sep, last) + #endif + #define wxStrtol strtol + #define wxStrtoul strtoul + #ifdef HAVE_STRTOULL + /* assume that we have wcstoull(), which is also C99, too */ + #define wxStrtoll strtoll + #define wxStrtoull strtoull + #endif /* HAVE_WCSTOULL */ + #define wxStrxfrm strxfrm + + /* stdio.h functions */ + #define wxFopen fopen + #define wxFreopen freopen + #define wxRemove remove + #define wxRename rename + + #define wxPerror perror + #define wxTmpnam tmpnam + + #define wxFgetc fgetc + #define wxFgetchar fgetchar + #define wxFgets fgets + #define wxFputc fputc + #define wxFputs fputs + #define wxFputchar fputchar + #define wxFprintf fprintf + #define wxFscanf fscanf + #define wxGetc getc + #define wxGetchar getchar + #define wxGets gets + #define wxPrintf printf + #define wxPutc putc + #define wxPutchar putchar + #define wxPuts puts + #define wxScanf scanf + #define wxSprintf sprintf + #define wxSscanf sscanf + #define wxUngetc ungetc + #define wxVfprintf vfprintf + #define wxVprintf vprintf + #define wxVsscanf vsscanf + #define wxVsprintf vsprintf + + /* stdlib.h functions */ + #define wxAtof atof + #define wxAtoi atoi + #define wxAtol atol + #define wxGetenv getenv + #define wxSystem system + + /* time.h functions */ + #define wxAsctime asctime + #define wxCtime ctime + #define wxStrftime strftime + #endif /* Unicode/ASCII */ +#endif /* TCHAR-aware compilers/the others */ + +#ifdef wxStrtoll + #define wxHAS_STRTOLL +#endif + +/* + various special cases + */ + +/* define wxStricmp and wxStrnicmp for various compilers */ + +/* note that in Unicode mode we definitely are going to need our own version */ +#if !defined(wxStricmp) && !wxUSE_UNICODE + #if defined(__BORLANDC__) || defined(__WATCOMC__) || \ + defined(__SALFORDC__) || defined(__VISAGECPP__) || \ + defined(__EMX__) || defined(__DJGPP__) + #define wxStricmp stricmp + #define wxStrnicmp strnicmp + #elif defined(__WXPALMOS__) + /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This + * quick hack should do until one can be written. + */ + #define wxStricmp StrCaselessCompare + #define wxStrnicmp strnicmp + #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ + (defined(__MWERKS__) && defined(__INTEL__)) + #define wxStricmp _stricmp + #define wxStrnicmp _strnicmp + #elif defined(__UNIX__) || defined(__GNUWIN32__) + #define wxStricmp strcasecmp + #define wxStrnicmp strncasecmp + /* #else -- use wxWidgets implementation */ + #endif +#endif /* !defined(wxStricmp) */ + +/* define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as */ +/* it's used in wx/buffer.h -- and also might be used just below by wxStrlen() */ +/* when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen) */ +#if wxUSE_WCHAR_T + #ifdef HAVE_WCSLEN + #define wxWcslen wcslen + #else + WXDLLIMPEXP_BASE size_t wxWcslen(const wchar_t *s); + #endif +#endif /* wxUSE_WCHAR_T */ + +#ifdef __cplusplus +/* checks whether the passed in pointer is NULL and if the string is empty */ +inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; } + +/* safe version of strlen() (returns 0 if passed NULL pointer) */ +inline size_t wxStrlen(const wxChar *psz) { return psz ? wxStrlen_(psz) : 0; } +#endif + +/* + each of strdup() and wcsdup() may or may not be available but we need both + of them anyhow for wx/buffer.h so we define the missing one(s) in + wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW + defined -- if this is somehow not the case in some situations, please + correct that and not the lines here + */ +#if wxUSE_UNICODE + #define wxStrdup wxStrdupW +#else + #define wxStrdup wxStrdupA +#endif + +#ifdef __cplusplus +WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ +#endif + +/* printf() family saga */ + +/* + For some systems [v]snprintf() exists in the system libraries but not in the + headers, so we need to declare it ourselves to be able to use it. + */ +#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL) +#ifdef __cplusplus + extern "C" +#else + extern +#endif + int vsnprintf(char *str, size_t size, const char *format, va_list ap); +#endif /* !HAVE_VSNPRINTF_DECL */ + +#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL) +#ifdef __cplusplus + extern "C" +#else + extern +#endif + WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...); +#endif /* !HAVE_SNPRINTF_DECL */ + +/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the + * same isn't done for snprintf below, the builtin wxSnprintf_ is used + * instead since it's already a simple wrapper */ +#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL + inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap) + { + return vsnprintf(str, size, (char*)format, ap); + } +#endif + +/* + MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility + presumably) and normally _vsnwprintf() is used instead (but as + STLPort 5.1 defines standard vswprintf(), don't do this for it) + */ +#if defined(HAVE_VSWPRINTF) && defined(__MINGW32__) && !( defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 ) + #undef HAVE_VSWPRINTF +#endif + +#if wxUSE_PRINTF_POS_PARAMS + /* + The systems where vsnprintf() supports positional parameters should + define the HAVE_UNIX98_PRINTF symbol. + + On systems which don't (e.g. Windows) we are forced to use + our wxVsnprintf() implementation. + */ + #if defined(HAVE_UNIX98_PRINTF) + #if wxUSE_UNICODE + #ifdef HAVE_VSWPRINTF + #define wxVsnprintf_ vswprintf + #endif + #else /* ASCII */ + #ifdef HAVE_BROKEN_VSNPRINTF_DECL + #define wxVsnprintf_ wx_fixed_vsnprintf + #else + #define wxVsnprintf_ vsnprintf + #endif + #endif + #else /* !HAVE_UNIX98_PRINTF */ + /* + The only compiler with positional parameters support under Windows + is VC++ 8.0 which provides a new xxprintf_p() functions family. + The 2003 PSDK includes a slightly earlier version of VC8 than the + main release and does not have the printf_p functions. + */ + #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__ + #if wxUSE_UNICODE + #define wxVsnprintf_ _vswprintf_p + #else + #define wxVsnprintf_ _vsprintf_p + #endif + #endif + #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */ +#else /* !wxUSE_PRINTF_POS_PARAMS */ + /* + We always want to define safe snprintf() function to be used instead of + sprintf(). Some compilers already have it (or rather vsnprintf() which + we really need...), otherwise we implement it using our own printf() + code. + + We define function with a trailing underscore here because the real one + is a wrapper around it as explained below + */ + + /* first deal with TCHAR-aware compilers which have _vsntprintf */ + #ifndef wxVsnprintf_ + #if defined(__VISUALC__) || \ + (defined(__BORLANDC__) && __BORLANDC__ >= 0x540) + #define wxVsnprintf_ _vsntprintf + #define wxSnprintf_ _sntprintf + #endif + #endif + + /* if this didn't work, define it separately for Unicode and ANSI builds */ + #ifndef wxVsnprintf_ + #if wxUSE_UNICODE + #if defined(HAVE__VSNWPRINTF) + #define wxVsnprintf_ _vsnwprintf + #elif defined(HAVE_VSWPRINTF) + #define wxVsnprintf_ vswprintf + #elif defined(__WATCOMC__) + #define wxVsnprintf_ _vsnwprintf + #define wxSnprintf_ _snwprintf + #endif + #else /* ASCII */ + /* + All versions of CodeWarrior supported by wxWidgets apparently + have both snprintf() and vsnprintf() + */ + #if defined(HAVE_SNPRINTF) \ + || defined(__MWERKS__) || defined(__WATCOMC__) + #ifndef HAVE_BROKEN_SNPRINTF_DECL + #define wxSnprintf_ snprintf + #endif + #endif + #if defined(HAVE_VSNPRINTF) \ + || defined(__MWERKS__) || defined(__WATCOMC__) + #ifdef HAVE_BROKEN_VSNPRINTF_DECL + #define wxVsnprintf_ wx_fixed_vsnprintf + #else + #define wxVsnprintf_ vsnprintf + #endif + #endif + #endif /* Unicode/ASCII */ + #endif /* wxVsnprintf_ */ +#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */ + +#ifndef wxSnprintf_ + /* no snprintf(), cook our own */ + WXDLLIMPEXP_BASE int + wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) ATTRIBUTE_PRINTF_3; +#endif +#ifndef wxVsnprintf_ + /* no (suitable) vsnprintf(), cook our own */ + WXDLLIMPEXP_BASE int + wxVsnprintf_(wxChar *buf, size_t len, const wxChar *format, va_list argptr); + + #define wxUSE_WXVSNPRINTF 1 +#else + #define wxUSE_WXVSNPRINTF 0 +#endif + +/* + In Unicode mode we need to have all standard functions such as wprintf() and + so on but not all systems have them so use our own implementations in this + case. + */ +#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) + #define wxNEED_WPRINTF +#endif + +/* + More Unicode complications: although both ANSI C and C++ define a number of + wide character functions such as wprintf(), not all environments have them. + Worse, those which do have different behaviours: under Windows, %s format + specifier changes its meaning in Unicode build and expects a Unicode string + while under Unix/POSIX it still means an ASCII string even for wprintf() and + %ls has to be used for wide strings. + + We choose to always emulate Windows behaviour as more useful for us so even + if we have wprintf() we still must wrap it in a non trivial wxPrintf(). + +*/ + +#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF) + /* + we need to implement all wide character printf and scanf functions + either because we don't have them at all or because they don't have the + semantics we need + */ + int wxScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; + int wxSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap ); + int wxPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1; + int wxSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2; + int wxVfprintf( FILE *stream, const wxChar *format, va_list ap ); + int wxVprintf( const wxChar *format, va_list ap ); + int wxVsprintf( wxChar *str, const wxChar *format, va_list ap ); +#endif /* wxNEED_PRINTF_CONVERSION */ + +/* these 2 can be simply mapped to the versions with underscore at the end */ +/* if we don't have to do the conversion */ +/* + However, if we don't have any vswprintf() at all we don't need to redefine + anything as our own wxVsnprintf_() already behaves as needed. +*/ +#if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_) + int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3; + int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap ); +#else + #define wxSnprintf wxSnprintf_ + #define wxVsnprintf wxVsnprintf_ +#endif + +/* + various functions which might not be available in libc and for which we + provide our own replacements in wxchar.cpp + */ + +/* ctype.h functions */ + +/* RN: Used only under OSX <= 10.2 currently */ +#ifdef wxNEED_WX_CTYPE_H + WXDLLIMPEXP_BASE int wxIsalnum(wxChar ch); + WXDLLIMPEXP_BASE int wxIsalpha(wxChar ch); + WXDLLIMPEXP_BASE int wxIscntrl(wxChar ch); + WXDLLIMPEXP_BASE int wxIsdigit(wxChar ch); + WXDLLIMPEXP_BASE int wxIsgraph(wxChar ch); + WXDLLIMPEXP_BASE int wxIslower(wxChar ch); + WXDLLIMPEXP_BASE int wxIsprint(wxChar ch); + WXDLLIMPEXP_BASE int wxIspunct(wxChar ch); + WXDLLIMPEXP_BASE int wxIsspace(wxChar ch); + WXDLLIMPEXP_BASE int wxIsupper(wxChar ch); + WXDLLIMPEXP_BASE int wxIsxdigit(wxChar ch); + WXDLLIMPEXP_BASE int wxTolower(wxChar ch); + WXDLLIMPEXP_BASE int wxToupper(wxChar ch); +#endif /* wxNEED_WX_CTYPE_H */ + +/* under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks */ +/* the file parsing -- this may be true for 5.0 as well, update #ifdef then */ +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE + #undef wxIsspace + #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c)) +#endif /* VC++ */ + +/* + a few compilers don't have the (non standard but common) isascii function, + define it ourselves for them + */ +#ifndef isascii + #if defined(__MWERKS__) + #define wxNEED_ISASCII + #elif defined(_WIN32_WCE) + #if _WIN32_WCE <= 211 + #define wxNEED_ISASCII + #endif + #endif +#endif /* isascii */ + +#ifdef wxNEED_ISASCII + inline int isascii(int c) { return (unsigned)c < 0x80; } +#endif + +#ifdef _WIN32_WCE + #if _WIN32_WCE <= 211 + #define isspace(c) ((c) == _T(' ') || (c) == _T('\t')) + #endif +#endif /* _WIN32_WCE */ + +/* + we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the + initial versions of this header -- now it is too late to remove it so + although we fixed the function/macro name above, still provide the + backwards-compatible synonym. + */ +#define wxIsctrl wxIscntrl + +/* string.h functions */ +#ifndef strdup + #if defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000) + #define wxNEED_STRDUP + #elif defined(__WXWINCE__) + #if _WIN32_WCE <= 211 + #define wxNEED_STRDUP + #endif + #endif +#endif /* strdup */ + +#ifdef wxNEED_STRDUP + WXDLLIMPEXP_BASE char *strdup(const char* s); +#endif + +/* RN: Used only under OSX <= 10.2 currently + The __cplusplus ifdefs are messy, but they are required to build + the regex library, since c does not support function overloading +*/ +#ifdef wxNEED_WX_STRING_H +# ifdef __cplusplus + extern "C" { +# endif + WXDLLIMPEXP_BASE wxChar * wxStrcat(wxChar *dest, const wxChar *src); + WXDLLIMPEXP_BASE const wxChar * wxStrchr(const wxChar *s, wxChar c); + WXDLLIMPEXP_BASE int wxStrcmp(const wxChar *s1, const wxChar *s2); + WXDLLIMPEXP_BASE int wxStrcoll(const wxChar *s1, const wxChar *s2); + WXDLLIMPEXP_BASE wxChar * wxStrcpy(wxChar *dest, const wxChar *src); + WXDLLIMPEXP_BASE size_t wxStrcspn(const wxChar *s, const wxChar *reject); + WXDLLIMPEXP_BASE wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); + WXDLLIMPEXP_BASE int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); + WXDLLIMPEXP_BASE wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); + WXDLLIMPEXP_BASE const wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); + WXDLLIMPEXP_BASE const wxChar * wxStrrchr(const wxChar *s, wxChar c); + WXDLLIMPEXP_BASE size_t wxStrspn(const wxChar *s, const wxChar *accept); + WXDLLIMPEXP_BASE const wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); +# ifdef __cplusplus + } +# endif + + /* These functions use C++, so we can't c extern them */ + WXDLLIMPEXP_BASE double wxStrtod(const wxChar *nptr, wxChar **endptr); + WXDLLIMPEXP_BASE long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); + WXDLLIMPEXP_BASE unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base); + WXDLLIMPEXP_BASE size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); + + /* inlined versions */ + #ifdef __cplusplus + inline wxChar * wxStrchr(wxChar *s, wxChar c) + { return (wxChar *)wxStrchr((const wxChar *)s, c); } + inline wxChar * wxStrpbrk(wxChar *s, const wxChar *accept) + { return (wxChar *)wxStrpbrk((const wxChar *)s, accept); } + inline wxChar * wxStrrchr(wxChar *s, wxChar c) + { return (wxChar *)wxStrrchr((const wxChar *)s, c); } + inline wxChar *wxStrstr(wxChar *haystack, const wxChar *needle) + { return (wxChar *)wxStrstr((const wxChar *)haystack, needle); } + #endif + +#endif /* wxNEED_WX_STRING_H */ + +#ifndef wxStrdupA +WXDLLIMPEXP_BASE char *wxStrdupA(const char *psz); +#endif + +#ifndef wxStrdupW +WXDLLIMPEXP_BASE wchar_t *wxStrdupW(const wchar_t *pwz); +#endif + +#ifndef wxStricmp +WXDLLIMPEXP_BASE int wxStricmp(const wxChar *psz1, const wxChar *psz2); +#endif + +#ifndef wxStrnicmp +WXDLLIMPEXP_BASE int wxStrnicmp(const wxChar *psz1, const wxChar *psz2, size_t len); +#endif + +#ifndef wxStrtok +WXDLLIMPEXP_BASE wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); +#endif + +#ifdef __cplusplus +#ifndef wxSetlocale +class WXDLLIMPEXP_BASE wxWCharBuffer; +WXDLLIMPEXP_BASE wxWCharBuffer wxSetlocale(int category, const wxChar *locale); +#endif +#endif + +/* stdio.h functions */ +#ifdef wxNEED_WX_STDIO_H + #include <stdio.h> + WXDLLIMPEXP_BASE FILE * wxFopen(const wxChar *path, const wxChar *mode); + WXDLLIMPEXP_BASE FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); + WXDLLIMPEXP_BASE int wxRemove(const wxChar *path); + WXDLLIMPEXP_BASE int wxRename(const wxChar *oldpath, const wxChar *newpath); + + /* *printf() family is handled separately */ +#endif /* wxNEED_WX_STDIO_H */ + + +/* stdlib.h functions */ +#ifndef wxAtof +WXDLLIMPEXP_BASE double wxAtof(const wxChar *psz); +#endif + +/* + mingw32 doesn't provide _tsystem() even though it does provide all the other + stdlib.h functions wrappers so check for it separately: + */ +#if defined(__MINGW32__) && wxUSE_UNICODE && !defined(_tsystem) + #define wxNEED_WXSYSTEM +#endif + +#ifdef wxNEED_WX_STDLIB_H +WXDLLIMPEXP_BASE int wxAtoi(const wxChar *psz); +WXDLLIMPEXP_BASE long wxAtol(const wxChar *psz); +WXDLLIMPEXP_BASE wxChar * wxGetenv(const wxChar *name); +#define wxNEED_WXSYSTEM +#endif + +#ifdef wxNEED_WXSYSTEM +WXDLLIMPEXP_BASE int wxSystem(const wxChar *psz); +#endif + + +/* time.h functions */ +#ifdef wxNEED_WX_TIME_H +#if defined(__MWERKS__) && defined(macintosh) + #include <time.h> +#endif + /*silent gabby compilers*/ + struct tm; + WXDLLIMPEXP_BASE size_t wxStrftime(wxChar *s, size_t max, + const wxChar *fmt, const struct tm *tm); +#endif /* wxNEED_WX_TIME_H */ + +#ifndef wxCtime +#include <time.h> +WXDLLIMPEXP_BASE wxChar *wxCtime(const time_t *timep); +#endif + + +/* missing functions in some WinCE versions */ +#ifdef _WIN32_WCE +#if (_WIN32_WCE < 300) +WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); +#endif +#endif /* _WIN32_WCE */ + +/* multibyte to wide char conversion functions and macros */ + +#if wxUSE_WCHAR_T + /* multibyte<->widechar conversion */ + WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); + WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); + + #if wxUSE_UNICODE + #define wxMB2WX wxMB2WC + #define wxWX2MB wxWC2MB + #define wxWC2WX wxStrncpy + #define wxWX2WC wxStrncpy + #else + #define wxMB2WX wxStrncpy + #define wxWX2MB wxStrncpy + #define wxWC2WX wxWC2MB + #define wxWX2WC wxMB2WC + #endif +#else /* !wxUSE_UNICODE */ +/* Why is this here? +#error ha */ + /* No wxUSE_WCHAR_T: we have to do something (JACS) */ + #define wxMB2WC wxStrncpy + #define wxWC2MB wxStrncpy + #define wxMB2WX wxStrncpy + #define wxWX2MB wxStrncpy + #define wxWC2WX wxWC2MB + #define wxWX2WC wxMB2WC +#endif + +/* + RN: The following are not normal versions of memcpy et al., rather + these are either char or widechar versions depending on + if unicode is used or not. +*/ + +#ifdef __cplusplus + + // + // RN: We could do the usual tricky compiler detection here, + // and use their variant (such as wmemchr, etc.). The problem + // is that these functions are quite rare, even though they are + // part of the current POSIX standard. In addition, most compilers + // (including even MSC) inline them just like we do right in their + // headers. + // + #include <string.h> + #if wxUSE_UNICODE + //implement our own wmem variants + inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) + { + for(;l && *s != c;--l, ++s) {} + + if(l) + return (wxChar*)s; + return NULL; + } + + inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) + { + for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} + + if(len) + return *sz1 < *sz2 ? -1 : *sz1 > *sz2; + else + return 0; + } + + inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len) + { + wxChar* szRet = szOut; + + while (len--) + *szOut++ = cIn; + + return szRet; + } + #else /* !wxUSE_UNICODE */ + #if wxABI_VERSION >= 20805 + // for compatibility with earlier versions, these functions take + // "void *" but in the next wx version they will take "char *" so + // don't use them with void pointers (use the standard memxxx() + // with them) + inline char* wxTmemchr(const void* s, int c, size_t len) + { return (char*)memchr(s, c, len); } + inline int wxTmemcmp(const void* sz1, const void* sz2, size_t len) + { return memcmp(sz1, sz2, len); } + inline char* wxTmemcpy(void* szOut, const void* szIn, size_t len) + { return (char*)memcpy(szOut, szIn, len); } + inline char* wxTmemmove(void* szOut, const void* szIn, size_t len) + { return (char*)memmove(szOut, szIn, len); } + inline char* wxTmemset(void* szOut, int c, size_t len) + { return (char*)memset(szOut, c, len); } + #else + # define wxTmemchr memchr + # define wxTmemcmp memcmp + # define wxTmemcpy memcpy + # define wxTmemmove memmove + # define wxTmemset memset + #endif + #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */ + +#endif /*__cplusplus*/ + + +#endif /* _WX_WXCHAR_H_ */ + diff --git a/Externals/wxWidgets/include/wx/wxhtml.h b/Externals/wxWidgets/include/wx/wxhtml.h index 367b2c35a5..a401c93ee4 100644 --- a/Externals/wxWidgets/include/wx/wxhtml.h +++ b/Externals/wxWidgets/include/wx/wxhtml.h @@ -1,22 +1,22 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxhtml.h -// Purpose: wxHTML library for wxWidgets -// Author: Vaclav Slavik -// RCS-ID: $Id: wxhtml.h 35650 2005-09-23 12:56:45Z MR $ -// Copyright: (c) 1999 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HTML_H_ -#define _WX_HTML_H_ - -#include "wx/html/htmldefs.h" -#include "wx/html/htmltag.h" -#include "wx/html/htmlcell.h" -#include "wx/html/htmlpars.h" -#include "wx/html/htmlwin.h" -#include "wx/html/winpars.h" -#include "wx/filesys.h" -#include "wx/html/helpctrl.h" - -#endif // __WXHTML_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wxhtml.h +// Purpose: wxHTML library for wxWidgets +// Author: Vaclav Slavik +// RCS-ID: $Id: wxhtml.h 35650 2005-09-23 12:56:45Z MR $ +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTML_H_ +#define _WX_HTML_H_ + +#include "wx/html/htmldefs.h" +#include "wx/html/htmltag.h" +#include "wx/html/htmlcell.h" +#include "wx/html/htmlpars.h" +#include "wx/html/htmlwin.h" +#include "wx/html/winpars.h" +#include "wx/filesys.h" +#include "wx/html/helpctrl.h" + +#endif // __WXHTML_H__ diff --git a/Externals/wxWidgets/include/wx/wxprec.h b/Externals/wxWidgets/include/wx/wxprec.h index 184914e6c5..8510036655 100644 --- a/Externals/wxWidgets/include/wx/wxprec.h +++ b/Externals/wxWidgets/include/wx/wxprec.h @@ -1,70 +1,70 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxprec.h -// Purpose: Includes the appropriate files for precompiled headers -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: wxprec.h 39484 2006-05-31 12:18:02Z ABX $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// compiler detection; includes setup.h -#include "wx/defs.h" - -// check if to use precompiled headers: do it for most Windows compilers unless -// explicitly disabled by defining NOPCH -#if defined(__VISUALC__) || \ - defined(__DMC__) || \ - defined(__VISAGECPP__) || \ - defined(__MWERKS__) || \ - defined(__WATCOMC__) || \ - defined(__BORLANDC__) - - - // If user did not request NOCPH and we're not building using configure - // then assume user wants precompiled headers. - #if !defined(NOPCH) && !defined(__WX_SETUP_H__) - #define WX_PRECOMP - #endif -#endif - -// For some reason, this must be defined for common dialogs to work. -#ifdef __WATCOMC__ - #define INCLUDE_COMMDLG_H 1 -#endif - -#ifdef WX_PRECOMP - -// include "wx/wxchar.h" first to ensure that UNICODE macro is correctly set -// _before_ including <windows.h> -#include "wx/wxchar.h" - -// include standard Windows headers -#if defined(__WXMSW__) - #include "wx/msw/wrapwin.h" - #include "wx/msw/wrapcctl.h" - #include "wx/msw/wrapcdlg.h" - #include "wx/msw/private.h" - #include "wx/msw/missing.h" -#endif - -// include all PalmOS headers at once -#ifdef __WXPALMOS__ -# include <PalmOS.h> -#endif - -// include <os2.h> -#ifdef __OS2__ -# include "wx/os2/private.h" -#endif - -// include mgl headers -#ifdef __WXMGL__ -# include "wx/mgl/private.h" -#endif - -// include the most common wx headers -#include "wx/wx.h" - -#endif // WX_PRECOMP +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wxprec.h +// Purpose: Includes the appropriate files for precompiled headers +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: wxprec.h 39484 2006-05-31 12:18:02Z ABX $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// compiler detection; includes setup.h +#include "wx/defs.h" + +// check if to use precompiled headers: do it for most Windows compilers unless +// explicitly disabled by defining NOPCH +#if defined(__VISUALC__) || \ + defined(__DMC__) || \ + defined(__VISAGECPP__) || \ + defined(__MWERKS__) || \ + defined(__WATCOMC__) || \ + defined(__BORLANDC__) + + + // If user did not request NOCPH and we're not building using configure + // then assume user wants precompiled headers. + #if !defined(NOPCH) && !defined(__WX_SETUP_H__) + #define WX_PRECOMP + #endif +#endif + +// For some reason, this must be defined for common dialogs to work. +#ifdef __WATCOMC__ + #define INCLUDE_COMMDLG_H 1 +#endif + +#ifdef WX_PRECOMP + +// include "wx/wxchar.h" first to ensure that UNICODE macro is correctly set +// _before_ including <windows.h> +#include "wx/wxchar.h" + +// include standard Windows headers +#if defined(__WXMSW__) + #include "wx/msw/wrapwin.h" + #include "wx/msw/wrapcctl.h" + #include "wx/msw/wrapcdlg.h" + #include "wx/msw/private.h" + #include "wx/msw/missing.h" +#endif + +// include all PalmOS headers at once +#ifdef __WXPALMOS__ +# include <PalmOS.h> +#endif + +// include <os2.h> +#ifdef __OS2__ +# include "wx/os2/private.h" +#endif + +// include mgl headers +#ifdef __WXMGL__ +# include "wx/mgl/private.h" +#endif + +// include the most common wx headers +#include "wx/wx.h" + +#endif // WX_PRECOMP diff --git a/Externals/wxWidgets/include/wx/wxshlb_cw.h b/Externals/wxWidgets/include/wx/wxshlb_cw.h index 55987b1dfe..7c2247236e 100644 --- a/Externals/wxWidgets/include/wx/wxshlb_cw.h +++ b/Externals/wxWidgets/include/wx/wxshlb_cw.h @@ -1,65 +1,65 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cw.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_PPC++_prof.mch" - #elif __INTEL__ - #include "wxshlb_x86++_prof.mch" - #elif __CFM68K__ - #include "wxshlb_cfm++_prof.mch" - #else - #include "wxshlb_68k++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_PPC_prof.mch" - #elif __INTEL__ - #include "wxshlb_x86_prof.mch" - #elif __CFM68K__ - #include "wxshlb_cfm_prof.mch" - #else - #include "wxshlb_68k_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_PPC++.mch" - #elif __INTEL__ - #include "wxshlb_x86++.mch" - #elif __CFM68K__ - #include "wxshlb_cfm++.mch" - #else - #include "wxshlb_68k++.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_PPC.mch" - #elif __INTEL__ - #include "wxshlb_x86.mch" - #elif __CFM68K__ - #include "wxshlb_cfm.mch" - #else - #include "wxshlb_68k.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw.h +// Purpose: wxWidgets definitions for CodeWarrior builds +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlb_cw.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlb_PPC++_prof.mch" + #elif __INTEL__ + #include "wxshlb_x86++_prof.mch" + #elif __CFM68K__ + #include "wxshlb_cfm++_prof.mch" + #else + #include "wxshlb_68k++_prof.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlb_PPC_prof.mch" + #elif __INTEL__ + #include "wxshlb_x86_prof.mch" + #elif __CFM68K__ + #include "wxshlb_cfm_prof.mch" + #else + #include "wxshlb_68k_prof.mch" + #endif +#endif +#else +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlb_PPC++.mch" + #elif __INTEL__ + #include "wxshlb_x86++.mch" + #elif __CFM68K__ + #include "wxshlb_cfm++.mch" + #else + #include "wxshlb_68k++.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlb_PPC.mch" + #elif __INTEL__ + #include "wxshlb_x86.mch" + #elif __CFM68K__ + #include "wxshlb_cfm.mch" + #else + #include "wxshlb_68k.mch" + #endif +#endif +#endif +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlb_cw_d.h b/Externals/wxWidgets/include/wx/wxshlb_cw_d.h index a34abf019a..930cd0b1c3 100644 --- a/Externals/wxWidgets/include/wx/wxshlb_cw_d.h +++ b/Externals/wxWidgets/include/wx/wxshlb_cw_d.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cw_d.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_PPC++_d.mch" - #elif __INTEL__ - #include "wxshlb_x86++_d.mch" - #elif __CFM68K__ - #include "wxshlb_cfm++_d.mch" - #else - #include "wxshlb_68k++_d.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_PPC_d.mch" - #elif __INTEL__ - #include "wxshlb_x86_d.mch" - #elif __CFM68K__ - #include "wxshlb_cfm_d.mch" - #else - #include "wxshlb_68k_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlb_cw_d.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlb_PPC++_d.mch" + #elif __INTEL__ + #include "wxshlb_x86++_d.mch" + #elif __CFM68K__ + #include "wxshlb_cfm++_d.mch" + #else + #include "wxshlb_68k++_d.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlb_PPC_d.mch" + #elif __INTEL__ + #include "wxshlb_x86_d.mch" + #elif __CFM68K__ + #include "wxshlb_cfm_d.mch" + #else + #include "wxshlb_68k_d.mch" + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlb_cwc.h b/Externals/wxWidgets/include/wx/wxshlb_cwc.h index 1e3166e137..cebad6bec5 100644 --- a/Externals/wxWidgets/include/wx/wxshlb_cwc.h +++ b/Externals/wxWidgets/include/wx/wxshlb_cwc.h @@ -1,45 +1,45 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cwc.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_Carbon++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_Carbon_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #if __MACH__ - #include "wxshlb_Mach++.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon++.mch" - #endif -#else - #if __MACH__ - #include "wxshlb_Mach.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw.h +// Purpose: wxWidgets definitions for CodeWarrior builds +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlb_cwc.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlb_Carbon++_prof.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlb_Carbon_prof.mch" + #endif +#endif +#else +#ifdef __cplusplus + #if __MACH__ + #include "wxshlb_Mach++.mch" + #elif __POWERPC__ + #include "wxshlb_Carbon++.mch" + #endif +#else + #if __MACH__ + #include "wxshlb_Mach.mch" + #elif __POWERPC__ + #include "wxshlb_Carbon.mch" + #endif +#endif +#endif +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlb_cwc_d.h b/Externals/wxWidgets/include/wx/wxshlb_cwc_d.h index b0909c4588..ee1094c7b9 100644 --- a/Externals/wxWidgets/include/wx/wxshlb_cwc_d.h +++ b/Externals/wxWidgets/include/wx/wxshlb_cwc_d.h @@ -1,38 +1,38 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cwc_d.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wxshlb_Mach++_d.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon++_d.mch" - #endif -#else - #ifdef __MACH__ - #include "wxshlb_Mach_d.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlb_cwc_d.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #ifdef __MACH__ + #include "wxshlb_Mach++_d.mch" + #elif __POWERPC__ + #include "wxshlb_Carbon++_d.mch" + #endif +#else + #ifdef __MACH__ + #include "wxshlb_Mach_d.mch" + #elif __POWERPC__ + #include "wxshlb_Carbon_d.mch" + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlba_cw.h b/Externals/wxWidgets/include/wx/wxshlba_cw.h index 190492c4bc..6769d008c1 100644 --- a/Externals/wxWidgets/include/wx/wxshlba_cw.h +++ b/Externals/wxWidgets/include/wx/wxshlba_cw.h @@ -1,65 +1,65 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cw.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_PPC++_prof.mch" - #elif __INTEL__ - #include "wxshlba_x86++_prof.mch" - #elif __CFM68K__ - #include "wxshlba_cfm++_prof.mch" - #else - #include "wxshlba_68k++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_PPC_prof.mch" - #elif __INTEL__ - #include "wxshlba_x86_prof.mch" - #elif __CFM68K__ - #include "wxshlba_cfm_prof.mch" - #else - #include "wxshlba_68k_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_PPC++.mch" - #elif __INTEL__ - #include "wxshlba_x86++.mch" - #elif __CFM68K__ - #include "wxshlba_cfm++.mch" - #else - #include "wxshlba_68k++.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_PPC.mch" - #elif __INTEL__ - #include "wxshlba_x86.mch" - #elif __CFM68K__ - #include "wxshlba_cfm.mch" - #else - #include "wxshlba_68k.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw.h +// Purpose: wxWidgets definitions for CodeWarrior builds +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlba_cw.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlba_PPC++_prof.mch" + #elif __INTEL__ + #include "wxshlba_x86++_prof.mch" + #elif __CFM68K__ + #include "wxshlba_cfm++_prof.mch" + #else + #include "wxshlba_68k++_prof.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlba_PPC_prof.mch" + #elif __INTEL__ + #include "wxshlba_x86_prof.mch" + #elif __CFM68K__ + #include "wxshlba_cfm_prof.mch" + #else + #include "wxshlba_68k_prof.mch" + #endif +#endif +#else +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlba_PPC++.mch" + #elif __INTEL__ + #include "wxshlba_x86++.mch" + #elif __CFM68K__ + #include "wxshlba_cfm++.mch" + #else + #include "wxshlba_68k++.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlba_PPC.mch" + #elif __INTEL__ + #include "wxshlba_x86.mch" + #elif __CFM68K__ + #include "wxshlba_cfm.mch" + #else + #include "wxshlba_68k.mch" + #endif +#endif +#endif +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlba_cw_d.h b/Externals/wxWidgets/include/wx/wxshlba_cw_d.h index db3f5e57b7..5d789dfb9b 100644 --- a/Externals/wxWidgets/include/wx/wxshlba_cw_d.h +++ b/Externals/wxWidgets/include/wx/wxshlba_cw_d.h @@ -1,46 +1,46 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cw_d.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_PPC++_d.mch" - #elif __INTEL__ - #include "wxshlba_x86++_d.mch" - #elif __CFM68K__ - #include "wxshlba_cfm++_d.mch" - #else - #include "wxshlba_68k++_d.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_PPC_d.mch" - #elif __INTEL__ - #include "wxshlba_x86_d.mch" - #elif __CFM68K__ - #include "wxshlba_cfm_d.mch" - #else - #include "wxshlba_68k_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlba_cw_d.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlba_PPC++_d.mch" + #elif __INTEL__ + #include "wxshlba_x86++_d.mch" + #elif __CFM68K__ + #include "wxshlba_cfm++_d.mch" + #else + #include "wxshlba_68k++_d.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlba_PPC_d.mch" + #elif __INTEL__ + #include "wxshlba_x86_d.mch" + #elif __CFM68K__ + #include "wxshlba_cfm_d.mch" + #else + #include "wxshlba_68k_d.mch" + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlba_cwc.h b/Externals/wxWidgets/include/wx/wxshlba_cwc.h index 33a5c85635..766b628ba1 100644 --- a/Externals/wxWidgets/include/wx/wxshlba_cwc.h +++ b/Externals/wxWidgets/include/wx/wxshlba_cwc.h @@ -1,45 +1,45 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cwc.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_Carbon++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_Carbon_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wxshlba_Mach++.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon++.mch" - #endif -#else - #ifdef __MACH__ - #include "wxshlba_Mach.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw.h +// Purpose: wxWidgets definitions for CodeWarrior builds +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlba_cwc.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#ifdef __cplusplus + #if __POWERPC__ + #include "wxshlba_Carbon++_prof.mch" + #endif +#else + #if __POWERPC__ + #include "wxshlba_Carbon_prof.mch" + #endif +#endif +#else +#ifdef __cplusplus + #ifdef __MACH__ + #include "wxshlba_Mach++.mch" + #elif __POWERPC__ + #include "wxshlba_Carbon++.mch" + #endif +#else + #ifdef __MACH__ + #include "wxshlba_Mach.mch" + #elif __POWERPC__ + #include "wxshlba_Carbon.mch" + #endif +#endif +#endif +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/wxshlba_cwc_d.h b/Externals/wxWidgets/include/wx/wxshlba_cwc_d.h index 9cbce75abb..bd58182032 100644 --- a/Externals/wxWidgets/include/wx/wxshlba_cwc_d.h +++ b/Externals/wxWidgets/include/wx/wxshlba_cwc_d.h @@ -1,38 +1,38 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cwc_d.h 33744 2005-04-19 10:06:30Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wxshlba_Mach++_d.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon++_d.mch" - #endif -#else - #ifdef __MACH__ - #include "wxshlba_Mach_d.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx_cw_d.h +// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) +// Author: Stefan Csomor +// Modified by: +// Created: 12/10/98 +// RCS-ID: $Id: wxshlba_cwc_d.h 33744 2005-04-19 10:06:30Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CW__ +#define _WX_CW__ + +#if __MWERKS__ >= 0x2400 +#pragma old_argmatch on +#endif + +#if __option(profile) +#error "profiling is not supported in debug versions" +#else +#ifdef __cplusplus + #ifdef __MACH__ + #include "wxshlba_Mach++_d.mch" + #elif __POWERPC__ + #include "wxshlba_Carbon++_d.mch" + #endif +#else + #ifdef __MACH__ + #include "wxshlba_Mach_d.mch" + #elif __POWERPC__ + #include "wxshlba_Carbon_d.mch" + #endif +#endif +#endif + +#endif + // _WX_CW__ diff --git a/Externals/wxWidgets/include/wx/xml/xml.h b/Externals/wxWidgets/include/wx/xml/xml.h index 3845513b72..b2e808d883 100644 --- a/Externals/wxWidgets/include/wx/xml/xml.h +++ b/Externals/wxWidgets/include/wx/xml/xml.h @@ -1,252 +1,252 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: xml.h -// Purpose: wxXmlDocument - XML parser & data holder class -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xml.h 52976 2008-04-02 10:06:54Z VS $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef _WX_XML_H_ -#define _WX_XML_H_ - -#include "wx/defs.h" - -#if wxUSE_XML - -#include "wx/string.h" -#include "wx/object.h" -#include "wx/list.h" - -#ifdef WXMAKINGDLL_XML - #define WXDLLIMPEXP_XML WXEXPORT -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_XML WXIMPORT -#else // not making nor using DLL - #define WXDLLIMPEXP_XML -#endif - -class WXDLLIMPEXP_FWD_XML wxXmlNode; -class WXDLLIMPEXP_FWD_XML wxXmlProperty; -class WXDLLIMPEXP_FWD_XML wxXmlDocument; -class WXDLLIMPEXP_FWD_XML wxXmlIOHandler; -class WXDLLIMPEXP_FWD_BASE wxInputStream; -class WXDLLIMPEXP_FWD_BASE wxOutputStream; - - -// Represents XML node type. -enum wxXmlNodeType -{ - // note: values are synchronized with xmlElementType from libxml - wxXML_ELEMENT_NODE = 1, - wxXML_ATTRIBUTE_NODE = 2, - wxXML_TEXT_NODE = 3, - wxXML_CDATA_SECTION_NODE = 4, - wxXML_ENTITY_REF_NODE = 5, - wxXML_ENTITY_NODE = 6, - wxXML_PI_NODE = 7, - wxXML_COMMENT_NODE = 8, - wxXML_DOCUMENT_NODE = 9, - wxXML_DOCUMENT_TYPE_NODE = 10, - wxXML_DOCUMENT_FRAG_NODE = 11, - wxXML_NOTATION_NODE = 12, - wxXML_HTML_DOCUMENT_NODE = 13 -}; - - -// Represents node property(ies). -// Example: in <img src="hello.gif" id="3"/> "src" is property with value -// "hello.gif" and "id" is prop. with value "3". - -class WXDLLIMPEXP_XML wxXmlProperty -{ -public: - wxXmlProperty() : m_next(NULL) {} - wxXmlProperty(const wxString& name, const wxString& value, - wxXmlProperty *next = NULL) - : m_name(name), m_value(value), m_next(next) {} - virtual ~wxXmlProperty() {} - - wxString GetName() const { return m_name; } - wxString GetValue() const { return m_value; } - wxXmlProperty *GetNext() const { return m_next; } - - void SetName(const wxString& name) { m_name = name; } - void SetValue(const wxString& value) { m_value = value; } - void SetNext(wxXmlProperty *next) { m_next = next; } - -private: - wxString m_name; - wxString m_value; - wxXmlProperty *m_next; -}; - - - -// Represents node in XML document. Node has name and may have content -// and properties. Most common node types are wxXML_TEXT_NODE (name and props -// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi there is -// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE -// with content="hi"). -// -// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load -// (default is UTF-8). - -class WXDLLIMPEXP_XML wxXmlNode -{ -public: - wxXmlNode() : m_properties(NULL), m_parent(NULL), - m_children(NULL), m_next(NULL) {} - wxXmlNode(wxXmlNode *parent, wxXmlNodeType type, - const wxString& name, const wxString& content = wxEmptyString, - wxXmlProperty *props = NULL, wxXmlNode *next = NULL); - virtual ~wxXmlNode(); - - // copy ctor & operator=. Note that this does NOT copy syblings - // and parent pointer, i.e. m_parent and m_next will be NULL - // after using copy ctor and are never unmodified by operator=. - // On the other hand, it DOES copy children and properties. - wxXmlNode(const wxXmlNode& node); - wxXmlNode& operator=(const wxXmlNode& node); - - // user-friendly creation: - wxXmlNode(wxXmlNodeType type, const wxString& name, - const wxString& content = wxEmptyString); - virtual void AddChild(wxXmlNode *child); - virtual bool InsertChild(wxXmlNode *child, wxXmlNode *followingNode); -#if wxABI_VERSION >= 20808 - bool InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode); -#endif - virtual bool RemoveChild(wxXmlNode *child); - virtual void AddProperty(const wxString& name, const wxString& value); - virtual bool DeleteProperty(const wxString& name); - - // access methods: - wxXmlNodeType GetType() const { return m_type; } - wxString GetName() const { return m_name; } - wxString GetContent() const { return m_content; } - - bool IsWhitespaceOnly() const; - int GetDepth(wxXmlNode *grandparent = NULL) const; - - // Gets node content from wxXML_ENTITY_NODE - // The problem is, content is represented as - // wxXML_ENTITY_NODE name="tag", content="" - // |-- wxXML_TEXT_NODE or - // wxXML_CDATA_SECTION_NODE name="" content="content" - wxString GetNodeContent() const; - - wxXmlNode *GetParent() const { return m_parent; } - wxXmlNode *GetNext() const { return m_next; } - wxXmlNode *GetChildren() const { return m_children; } - - wxXmlProperty *GetProperties() const { return m_properties; } - bool GetPropVal(const wxString& propName, wxString *value) const; - wxString GetPropVal(const wxString& propName, - const wxString& defaultVal) const; - bool HasProp(const wxString& propName) const; - - void SetType(wxXmlNodeType type) { m_type = type; } - void SetName(const wxString& name) { m_name = name; } - void SetContent(const wxString& con) { m_content = con; } - - void SetParent(wxXmlNode *parent) { m_parent = parent; } - void SetNext(wxXmlNode *next) { m_next = next; } - void SetChildren(wxXmlNode *child) { m_children = child; } - - void SetProperties(wxXmlProperty *prop) { m_properties = prop; } - virtual void AddProperty(wxXmlProperty *prop); - -private: - wxXmlNodeType m_type; - wxString m_name; - wxString m_content; - wxXmlProperty *m_properties; - wxXmlNode *m_parent, *m_children, *m_next; - - void DoCopy(const wxXmlNode& node); -}; - - - -// special indentation value for wxXmlDocument::Save -#define wxXML_NO_INDENTATION (-1) - -// flags for wxXmlDocument::Load -enum wxXmlDocumentLoadFlag -{ - wxXMLDOC_NONE = 0, - wxXMLDOC_KEEP_WHITESPACE_NODES = 1 -}; - - -// This class holds XML data/document as parsed by XML parser. - -class WXDLLIMPEXP_XML wxXmlDocument : public wxObject -{ -public: - wxXmlDocument(); - wxXmlDocument(const wxString& filename, - const wxString& encoding = wxT("UTF-8")); - wxXmlDocument(wxInputStream& stream, - const wxString& encoding = wxT("UTF-8")); - virtual ~wxXmlDocument() { wxDELETE(m_root); } - - wxXmlDocument(const wxXmlDocument& doc); - wxXmlDocument& operator=(const wxXmlDocument& doc); - - // Parses .xml file and loads data. Returns TRUE on success, FALSE - // otherwise. - virtual bool Load(const wxString& filename, - const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE); - virtual bool Load(wxInputStream& stream, - const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE); - - // Saves document as .xml file. - virtual bool Save(const wxString& filename, int indentstep = 1) const; - virtual bool Save(wxOutputStream& stream, int indentstep = 1) const; - - bool IsOk() const { return m_root != NULL; } - - // Returns root node of the document. - wxXmlNode *GetRoot() const { return m_root; } - - // Returns version of document (may be empty). - wxString GetVersion() const { return m_version; } - // Returns encoding of document (may be empty). - // Note: this is the encoding original file was saved in, *not* the - // encoding of in-memory representation! - wxString GetFileEncoding() const { return m_fileEncoding; } - - // Write-access methods: - wxXmlNode *DetachRoot() { wxXmlNode *old=m_root; m_root=NULL; return old; } - void SetRoot(wxXmlNode *node) { wxDELETE(m_root); m_root = node; } - void SetVersion(const wxString& version) { m_version = version; } - void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; } - -#if !wxUSE_UNICODE - // Returns encoding of in-memory representation of the document - // (same as passed to Load or ctor, defaults to UTF-8). - // NB: this is meaningless in Unicode build where data are stored as wchar_t* - wxString GetEncoding() const { return m_encoding; } - void SetEncoding(const wxString& enc) { m_encoding = enc; } -#endif - -private: - wxString m_version; - wxString m_fileEncoding; -#if !wxUSE_UNICODE - wxString m_encoding; -#endif - wxXmlNode *m_root; - - void DoCopy(const wxXmlDocument& doc); - - DECLARE_CLASS(wxXmlDocument) -}; - -#endif // wxUSE_XML - -#endif // _WX_XML_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: xml.h +// Purpose: wxXmlDocument - XML parser & data holder class +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xml.h 52976 2008-04-02 10:06:54Z VS $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_XML_H_ +#define _WX_XML_H_ + +#include "wx/defs.h" + +#if wxUSE_XML + +#include "wx/string.h" +#include "wx/object.h" +#include "wx/list.h" + +#ifdef WXMAKINGDLL_XML + #define WXDLLIMPEXP_XML WXEXPORT +#elif defined(WXUSINGDLL) + #define WXDLLIMPEXP_XML WXIMPORT +#else // not making nor using DLL + #define WXDLLIMPEXP_XML +#endif + +class WXDLLIMPEXP_FWD_XML wxXmlNode; +class WXDLLIMPEXP_FWD_XML wxXmlProperty; +class WXDLLIMPEXP_FWD_XML wxXmlDocument; +class WXDLLIMPEXP_FWD_XML wxXmlIOHandler; +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_BASE wxOutputStream; + + +// Represents XML node type. +enum wxXmlNodeType +{ + // note: values are synchronized with xmlElementType from libxml + wxXML_ELEMENT_NODE = 1, + wxXML_ATTRIBUTE_NODE = 2, + wxXML_TEXT_NODE = 3, + wxXML_CDATA_SECTION_NODE = 4, + wxXML_ENTITY_REF_NODE = 5, + wxXML_ENTITY_NODE = 6, + wxXML_PI_NODE = 7, + wxXML_COMMENT_NODE = 8, + wxXML_DOCUMENT_NODE = 9, + wxXML_DOCUMENT_TYPE_NODE = 10, + wxXML_DOCUMENT_FRAG_NODE = 11, + wxXML_NOTATION_NODE = 12, + wxXML_HTML_DOCUMENT_NODE = 13 +}; + + +// Represents node property(ies). +// Example: in "src" is property with value +// "hello.gif" and "id" is prop. with value "3". + +class WXDLLIMPEXP_XML wxXmlProperty +{ +public: + wxXmlProperty() : m_next(NULL) {} + wxXmlProperty(const wxString& name, const wxString& value, + wxXmlProperty *next = NULL) + : m_name(name), m_value(value), m_next(next) {} + virtual ~wxXmlProperty() {} + + wxString GetName() const { return m_name; } + wxString GetValue() const { return m_value; } + wxXmlProperty *GetNext() const { return m_next; } + + void SetName(const wxString& name) { m_name = name; } + void SetValue(const wxString& value) { m_value = value; } + void SetNext(wxXmlProperty *next) { m_next = next; } + +private: + wxString m_name; + wxString m_value; + wxXmlProperty *m_next; +}; + + + +// Represents node in XML document. Node has name and may have content +// and properties. Most common node types are wxXML_TEXT_NODE (name and props +// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in hi there is +// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE +// with content="hi"). +// +// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load +// (default is UTF-8). + +class WXDLLIMPEXP_XML wxXmlNode +{ +public: + wxXmlNode() : m_properties(NULL), m_parent(NULL), + m_children(NULL), m_next(NULL) {} + wxXmlNode(wxXmlNode *parent, wxXmlNodeType type, + const wxString& name, const wxString& content = wxEmptyString, + wxXmlProperty *props = NULL, wxXmlNode *next = NULL); + virtual ~wxXmlNode(); + + // copy ctor & operator=. Note that this does NOT copy syblings + // and parent pointer, i.e. m_parent and m_next will be NULL + // after using copy ctor and are never unmodified by operator=. + // On the other hand, it DOES copy children and properties. + wxXmlNode(const wxXmlNode& node); + wxXmlNode& operator=(const wxXmlNode& node); + + // user-friendly creation: + wxXmlNode(wxXmlNodeType type, const wxString& name, + const wxString& content = wxEmptyString); + virtual void AddChild(wxXmlNode *child); + virtual bool InsertChild(wxXmlNode *child, wxXmlNode *followingNode); +#if wxABI_VERSION >= 20808 + bool InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode); +#endif + virtual bool RemoveChild(wxXmlNode *child); + virtual void AddProperty(const wxString& name, const wxString& value); + virtual bool DeleteProperty(const wxString& name); + + // access methods: + wxXmlNodeType GetType() const { return m_type; } + wxString GetName() const { return m_name; } + wxString GetContent() const { return m_content; } + + bool IsWhitespaceOnly() const; + int GetDepth(wxXmlNode *grandparent = NULL) const; + + // Gets node content from wxXML_ENTITY_NODE + // The problem is, content is represented as + // wxXML_ENTITY_NODE name="tag", content="" + // |-- wxXML_TEXT_NODE or + // wxXML_CDATA_SECTION_NODE name="" content="content" + wxString GetNodeContent() const; + + wxXmlNode *GetParent() const { return m_parent; } + wxXmlNode *GetNext() const { return m_next; } + wxXmlNode *GetChildren() const { return m_children; } + + wxXmlProperty *GetProperties() const { return m_properties; } + bool GetPropVal(const wxString& propName, wxString *value) const; + wxString GetPropVal(const wxString& propName, + const wxString& defaultVal) const; + bool HasProp(const wxString& propName) const; + + void SetType(wxXmlNodeType type) { m_type = type; } + void SetName(const wxString& name) { m_name = name; } + void SetContent(const wxString& con) { m_content = con; } + + void SetParent(wxXmlNode *parent) { m_parent = parent; } + void SetNext(wxXmlNode *next) { m_next = next; } + void SetChildren(wxXmlNode *child) { m_children = child; } + + void SetProperties(wxXmlProperty *prop) { m_properties = prop; } + virtual void AddProperty(wxXmlProperty *prop); + +private: + wxXmlNodeType m_type; + wxString m_name; + wxString m_content; + wxXmlProperty *m_properties; + wxXmlNode *m_parent, *m_children, *m_next; + + void DoCopy(const wxXmlNode& node); +}; + + + +// special indentation value for wxXmlDocument::Save +#define wxXML_NO_INDENTATION (-1) + +// flags for wxXmlDocument::Load +enum wxXmlDocumentLoadFlag +{ + wxXMLDOC_NONE = 0, + wxXMLDOC_KEEP_WHITESPACE_NODES = 1 +}; + + +// This class holds XML data/document as parsed by XML parser. + +class WXDLLIMPEXP_XML wxXmlDocument : public wxObject +{ +public: + wxXmlDocument(); + wxXmlDocument(const wxString& filename, + const wxString& encoding = wxT("UTF-8")); + wxXmlDocument(wxInputStream& stream, + const wxString& encoding = wxT("UTF-8")); + virtual ~wxXmlDocument() { wxDELETE(m_root); } + + wxXmlDocument(const wxXmlDocument& doc); + wxXmlDocument& operator=(const wxXmlDocument& doc); + + // Parses .xml file and loads data. Returns TRUE on success, FALSE + // otherwise. + virtual bool Load(const wxString& filename, + const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE); + virtual bool Load(wxInputStream& stream, + const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE); + + // Saves document as .xml file. + virtual bool Save(const wxString& filename, int indentstep = 1) const; + virtual bool Save(wxOutputStream& stream, int indentstep = 1) const; + + bool IsOk() const { return m_root != NULL; } + + // Returns root node of the document. + wxXmlNode *GetRoot() const { return m_root; } + + // Returns version of document (may be empty). + wxString GetVersion() const { return m_version; } + // Returns encoding of document (may be empty). + // Note: this is the encoding original file was saved in, *not* the + // encoding of in-memory representation! + wxString GetFileEncoding() const { return m_fileEncoding; } + + // Write-access methods: + wxXmlNode *DetachRoot() { wxXmlNode *old=m_root; m_root=NULL; return old; } + void SetRoot(wxXmlNode *node) { wxDELETE(m_root); m_root = node; } + void SetVersion(const wxString& version) { m_version = version; } + void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; } + +#if !wxUSE_UNICODE + // Returns encoding of in-memory representation of the document + // (same as passed to Load or ctor, defaults to UTF-8). + // NB: this is meaningless in Unicode build where data are stored as wchar_t* + wxString GetEncoding() const { return m_encoding; } + void SetEncoding(const wxString& enc) { m_encoding = enc; } +#endif + +private: + wxString m_version; + wxString m_fileEncoding; +#if !wxUSE_UNICODE + wxString m_encoding; +#endif + wxXmlNode *m_root; + + void DoCopy(const wxXmlDocument& doc); + + DECLARE_CLASS(wxXmlDocument) +}; + +#endif // wxUSE_XML + +#endif // _WX_XML_H_ diff --git a/Externals/wxWidgets/include/wx/xpmdecod.h b/Externals/wxWidgets/include/wx/xpmdecod.h index 8cb516ae38..9391043684 100644 --- a/Externals/wxWidgets/include/wx/xpmdecod.h +++ b/Externals/wxWidgets/include/wx/xpmdecod.h @@ -1,47 +1,47 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xpmdecod.h -// Purpose: wxXPMDecoder, XPM reader for wxImage and wxBitmap -// Author: Vaclav Slavik -// CVS-ID: $Id: xpmdecod.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2001 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XPMDECOD_H_ -#define _WX_XPMDECOD_H_ - -#include "wx/defs.h" - -#if wxUSE_IMAGE && wxUSE_XPM - -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_BASE wxInputStream; - -// -------------------------------------------------------------------------- -// wxXPMDecoder class -// -------------------------------------------------------------------------- - -class WXDLLEXPORT wxXPMDecoder -{ -public: - // constructor, destructor, etc. - wxXPMDecoder() {} - ~wxXPMDecoder() {} - -#if wxUSE_STREAMS - // Is the stream XPM file? - bool CanRead(wxInputStream& stream); - // Read XPM file from the stream, parse it and create image from it - wxImage ReadFile(wxInputStream& stream); -#endif - // Read directly from XPM data (as passed to wxBitmap ctor): - wxImage ReadData(const char* const* xpm_data); -#ifdef __BORLANDC__ - // needed for Borland 5.5 - wxImage ReadData(char** xpm_data) { return ReadData(wx_const_cast(const char* const*, xpm_data)); } -#endif -}; - -#endif // wxUSE_IMAGE && wxUSE_XPM - -#endif // _WX_XPM_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xpmdecod.h +// Purpose: wxXPMDecoder, XPM reader for wxImage and wxBitmap +// Author: Vaclav Slavik +// CVS-ID: $Id: xpmdecod.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2001 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XPMDECOD_H_ +#define _WX_XPMDECOD_H_ + +#include "wx/defs.h" + +#if wxUSE_IMAGE && wxUSE_XPM + +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_BASE wxInputStream; + +// -------------------------------------------------------------------------- +// wxXPMDecoder class +// -------------------------------------------------------------------------- + +class WXDLLEXPORT wxXPMDecoder +{ +public: + // constructor, destructor, etc. + wxXPMDecoder() {} + ~wxXPMDecoder() {} + +#if wxUSE_STREAMS + // Is the stream XPM file? + bool CanRead(wxInputStream& stream); + // Read XPM file from the stream, parse it and create image from it + wxImage ReadFile(wxInputStream& stream); +#endif + // Read directly from XPM data (as passed to wxBitmap ctor): + wxImage ReadData(const char* const* xpm_data); +#ifdef __BORLANDC__ + // needed for Borland 5.5 + wxImage ReadData(char** xpm_data) { return ReadData(wx_const_cast(const char* const*, xpm_data)); } +#endif +}; + +#endif // wxUSE_IMAGE && wxUSE_XPM + +#endif // _WX_XPM_H_ diff --git a/Externals/wxWidgets/include/wx/xpmhand.h b/Externals/wxWidgets/include/wx/xpmhand.h index 127c937320..4207f7da80 100644 --- a/Externals/wxWidgets/include/wx/xpmhand.h +++ b/Externals/wxWidgets/include/wx/xpmhand.h @@ -1,25 +1,25 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xpmhand.h -// Purpose: XPM handler base header -// Author: Julian Smart -// Modified by: -// Created: -// RCS-ID: $Id: xpmhand.h 33948 2005-05-04 18:57:50Z JS $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XPMHAND_H_BASE_ -#define _WX_XPMHAND_H_BASE_ - -// Only wxMSW and wxPM currently defines a separate XPM handler, since -// mostly Windows and Presentation Manager apps won't need XPMs. -#if defined(__WXMSW__) -#error xpmhand.h is no longer needed since wxImage now handles XPMs. -#endif -#if defined(__WXPM__) -#include "wx/os2/xpmhand.h" -#endif - -#endif - // _WX_XPMHAND_H_BASE_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xpmhand.h +// Purpose: XPM handler base header +// Author: Julian Smart +// Modified by: +// Created: +// RCS-ID: $Id: xpmhand.h 33948 2005-05-04 18:57:50Z JS $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XPMHAND_H_BASE_ +#define _WX_XPMHAND_H_BASE_ + +// Only wxMSW and wxPM currently defines a separate XPM handler, since +// mostly Windows and Presentation Manager apps won't need XPMs. +#if defined(__WXMSW__) +#error xpmhand.h is no longer needed since wxImage now handles XPMs. +#endif +#if defined(__WXPM__) +#include "wx/os2/xpmhand.h" +#endif + +#endif + // _WX_XPMHAND_H_BASE_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_all.h b/Externals/wxWidgets/include/wx/xrc/xh_all.h index 35e9c7e922..9132fbbcb2 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_all.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_all.h @@ -1,74 +1,74 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_all.h -// Purpose: includes all xh_*.h files -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xh_all.h 48045 2007-08-13 12:05:18Z JS $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_ALL_H_ -#define _WX_XH_ALL_H_ - - -// Existing handlers: - -#include "wx/xrc/xh_menu.h" -#include "wx/xrc/xh_panel.h" -#include "wx/xrc/xh_dlg.h" -#include "wx/xrc/xh_bttn.h" -#include "wx/xrc/xh_chckb.h" -#include "wx/xrc/xh_tglbtn.h" -#include "wx/xrc/xh_gauge.h" -#include "wx/xrc/xh_html.h" -#include "wx/xrc/xh_spin.h" -#include "wx/xrc/xh_sttxt.h" -#include "wx/xrc/xh_slidr.h" -#include "wx/xrc/xh_radbt.h" -#include "wx/xrc/xh_radbx.h" -#include "wx/xrc/xh_combo.h" -#include "wx/xrc/xh_chckl.h" -#include "wx/xrc/xh_choic.h" -#include "wx/xrc/xh_datectrl.h" -#include "wx/xrc/xh_sizer.h" -#include "wx/xrc/xh_stbmp.h" -#include "wx/xrc/xh_notbk.h" -#include "wx/xrc/xh_odcombo.h" -#include "wx/xrc/xh_listbk.h" -#include "wx/xrc/xh_choicbk.h" -#include "wx/xrc/xh_treebk.h" -#include "wx/xrc/xh_text.h" -#include "wx/xrc/xh_listb.h" -#include "wx/xrc/xh_toolb.h" -#include "wx/xrc/xh_bmpbt.h" -#include "wx/xrc/xh_stbox.h" -#include "wx/xrc/xh_scrol.h" -#include "wx/xrc/xh_tree.h" -#include "wx/xrc/xh_cald.h" -#include "wx/xrc/xh_listc.h" -#include "wx/xrc/xh_stlin.h" -#include "wx/xrc/xh_bmp.h" -#include "wx/xrc/xh_unkwn.h" -#include "wx/xrc/xh_gdctl.h" -#include "wx/xrc/xh_frame.h" -#include "wx/xrc/xh_scwin.h" -#include "wx/xrc/xh_htmllbox.h" -#include "wx/xrc/xh_split.h" -#include "wx/xrc/xh_wizrd.h" -#include "wx/xrc/xh_statbar.h" -#include "wx/xrc/xh_mdi.h" -#include "wx/xrc/xh_grid.h" -#include "wx/xrc/xh_clrpicker.h" -#include "wx/xrc/xh_filepicker.h" -#include "wx/xrc/xh_fontpicker.h" -#include "wx/xrc/xh_dirpicker.h" -#include "wx/xrc/xh_hyperlink.h" -#include "wx/xrc/xh_bmpcbox.h" -#include "wx/xrc/xh_animatctrl.h" -#include "wx/xrc/xh_collpane.h" -#if wxABI_VERSION >= 20805 -#include "wx/xrc/xh_propdlg.h" -#endif - -#endif // _WX_XH_ALL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_all.h +// Purpose: includes all xh_*.h files +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xh_all.h 48045 2007-08-13 12:05:18Z JS $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ALL_H_ +#define _WX_XH_ALL_H_ + + +// Existing handlers: + +#include "wx/xrc/xh_menu.h" +#include "wx/xrc/xh_panel.h" +#include "wx/xrc/xh_dlg.h" +#include "wx/xrc/xh_bttn.h" +#include "wx/xrc/xh_chckb.h" +#include "wx/xrc/xh_tglbtn.h" +#include "wx/xrc/xh_gauge.h" +#include "wx/xrc/xh_html.h" +#include "wx/xrc/xh_spin.h" +#include "wx/xrc/xh_sttxt.h" +#include "wx/xrc/xh_slidr.h" +#include "wx/xrc/xh_radbt.h" +#include "wx/xrc/xh_radbx.h" +#include "wx/xrc/xh_combo.h" +#include "wx/xrc/xh_chckl.h" +#include "wx/xrc/xh_choic.h" +#include "wx/xrc/xh_datectrl.h" +#include "wx/xrc/xh_sizer.h" +#include "wx/xrc/xh_stbmp.h" +#include "wx/xrc/xh_notbk.h" +#include "wx/xrc/xh_odcombo.h" +#include "wx/xrc/xh_listbk.h" +#include "wx/xrc/xh_choicbk.h" +#include "wx/xrc/xh_treebk.h" +#include "wx/xrc/xh_text.h" +#include "wx/xrc/xh_listb.h" +#include "wx/xrc/xh_toolb.h" +#include "wx/xrc/xh_bmpbt.h" +#include "wx/xrc/xh_stbox.h" +#include "wx/xrc/xh_scrol.h" +#include "wx/xrc/xh_tree.h" +#include "wx/xrc/xh_cald.h" +#include "wx/xrc/xh_listc.h" +#include "wx/xrc/xh_stlin.h" +#include "wx/xrc/xh_bmp.h" +#include "wx/xrc/xh_unkwn.h" +#include "wx/xrc/xh_gdctl.h" +#include "wx/xrc/xh_frame.h" +#include "wx/xrc/xh_scwin.h" +#include "wx/xrc/xh_htmllbox.h" +#include "wx/xrc/xh_split.h" +#include "wx/xrc/xh_wizrd.h" +#include "wx/xrc/xh_statbar.h" +#include "wx/xrc/xh_mdi.h" +#include "wx/xrc/xh_grid.h" +#include "wx/xrc/xh_clrpicker.h" +#include "wx/xrc/xh_filepicker.h" +#include "wx/xrc/xh_fontpicker.h" +#include "wx/xrc/xh_dirpicker.h" +#include "wx/xrc/xh_hyperlink.h" +#include "wx/xrc/xh_bmpcbox.h" +#include "wx/xrc/xh_animatctrl.h" +#include "wx/xrc/xh_collpane.h" +#if wxABI_VERSION >= 20805 +#include "wx/xrc/xh_propdlg.h" +#endif + +#endif // _WX_XH_ALL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_animatctrl.h b/Externals/wxWidgets/include/wx/xrc/xh_animatctrl.h index 18d606d2f4..699a0413ca 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_animatctrl.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_animatctrl.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_animatctrl.h -// Purpose: XML resource handler for wxAnimationCtrl -// Author: Francesco Montorsi -// Created: 2006-10-15 -// RCS-ID: $Id: xh_animatctrl.h 42196 2006-10-21 13:59:25Z RR $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_ANIMATIONCTRL_H_ -#define _WX_XH_ANIMATIONCTRL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_ANIMATIONCTRL - -class WXDLLIMPEXP_XRC wxAnimationCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler) - -public: - wxAnimationCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL - -#endif // _WX_XH_ANIMATIONCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_animatctrl.h +// Purpose: XML resource handler for wxAnimationCtrl +// Author: Francesco Montorsi +// Created: 2006-10-15 +// RCS-ID: $Id: xh_animatctrl.h 42196 2006-10-21 13:59:25Z RR $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ANIMATIONCTRL_H_ +#define _WX_XH_ANIMATIONCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_ANIMATIONCTRL + +class WXDLLIMPEXP_XRC wxAnimationCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler) + +public: + wxAnimationCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL + +#endif // _WX_XH_ANIMATIONCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_bmp.h b/Externals/wxWidgets/include/wx/xrc/xh_bmp.h index 93b443eb56..40698e0843 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_bmp.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_bmp.h @@ -1,40 +1,40 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_bmp.h -// Purpose: XML resource handler for wxBitmap and wxIcon -// Author: Vaclav Slavik -// Created: 2000/09/00 -// RCS-ID: $Id: xh_bmp.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_BMP_H_ -#define _WX_XH_BMP_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -class WXDLLIMPEXP_XRC wxBitmapXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxBitmapXmlHandler) - -public: - wxBitmapXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -class WXDLLIMPEXP_XRC wxIconXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxIconXmlHandler) - -public: - wxIconXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC - -#endif // _WX_XH_BMP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bmp.h +// Purpose: XML resource handler for wxBitmap and wxIcon +// Author: Vaclav Slavik +// Created: 2000/09/00 +// RCS-ID: $Id: xh_bmp.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BMP_H_ +#define _WX_XH_BMP_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxBitmapXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxBitmapXmlHandler) + +public: + wxBitmapXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +class WXDLLIMPEXP_XRC wxIconXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxIconXmlHandler) + +public: + wxIconXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_BMP_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_bmpbt.h b/Externals/wxWidgets/include/wx/xrc/xh_bmpbt.h index ecd8fe1a9b..28b763fa73 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_bmpbt.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_bmpbt.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_bmpbt.h -// Purpose: XML resource handler for bitmap buttons -// Author: Brian Gavin -// Created: 2000/03/05 -// RCS-ID: $Id: xh_bmpbt.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Brian Gavin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_BMPBT_H_ -#define _WX_XH_BMPBT_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_BMPBUTTON - -class WXDLLIMPEXP_XRC wxBitmapButtonXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxBitmapButtonXmlHandler) - -public: - wxBitmapButtonXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_BMPBUTTON - -#endif // _WX_XH_BMPBT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bmpbt.h +// Purpose: XML resource handler for bitmap buttons +// Author: Brian Gavin +// Created: 2000/03/05 +// RCS-ID: $Id: xh_bmpbt.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BMPBT_H_ +#define _WX_XH_BMPBT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BMPBUTTON + +class WXDLLIMPEXP_XRC wxBitmapButtonXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxBitmapButtonXmlHandler) + +public: + wxBitmapButtonXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_BMPBUTTON + +#endif // _WX_XH_BMPBT_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_bmpcbox.h b/Externals/wxWidgets/include/wx/xrc/xh_bmpcbox.h index 3c23bb286e..f00d98a353 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_bmpcbox.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_bmpcbox.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_bmpcbox.h -// Purpose: XML resource handler for wxBitmapComboBox -// Author: Jaakko Salli -// Created: Sep-10-2006 -// RCS-ID: $Id: xh_bmpcbox.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2006 Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_BMPCBOX_H_ -#define _WX_XH_BMPCBOX_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX - -class WXDLLIMPEXP_FWD_ADV wxBitmapComboBox; - -class WXDLLIMPEXP_XRC wxBitmapComboBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler) - -public: - wxBitmapComboBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - wxBitmapComboBox* m_combobox; - bool m_isInside; -}; - -#endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX - -#endif // _WX_XH_BMPCBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bmpcbox.h +// Purpose: XML resource handler for wxBitmapComboBox +// Author: Jaakko Salli +// Created: Sep-10-2006 +// RCS-ID: $Id: xh_bmpcbox.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2006 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BMPCBOX_H_ +#define _WX_XH_BMPCBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX + +class WXDLLIMPEXP_FWD_ADV wxBitmapComboBox; + +class WXDLLIMPEXP_XRC wxBitmapComboBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler) + +public: + wxBitmapComboBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + wxBitmapComboBox* m_combobox; + bool m_isInside; +}; + +#endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX + +#endif // _WX_XH_BMPCBOX_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_bttn.h b/Externals/wxWidgets/include/wx/xrc/xh_bttn.h index 4ed7a0eea8..aae80baad4 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_bttn.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_bttn.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_bttn.h -// Purpose: XML resource handler for buttons -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xh_bttn.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_BTTN_H_ -#define _WX_XH_BTTN_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_BUTTON - -class WXDLLIMPEXP_XRC wxButtonXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxButtonXmlHandler) - -public: - wxButtonXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_BUTTON - -#endif // _WX_XH_BTTN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bttn.h +// Purpose: XML resource handler for buttons +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xh_bttn.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BTTN_H_ +#define _WX_XH_BTTN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BUTTON + +class WXDLLIMPEXP_XRC wxButtonXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxButtonXmlHandler) + +public: + wxButtonXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_BUTTON + +#endif // _WX_XH_BTTN_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_cald.h b/Externals/wxWidgets/include/wx/xrc/xh_cald.h index a9f348a16b..8d9ad664aa 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_cald.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_cald.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_cald.h -// Purpose: XML resource handler for wxCalendarCtrl -// Author: Brian Gavin -// Created: 2000/09/09 -// RCS-ID: $Id: xh_cald.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Brian Gavin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_CALD_H_ -#define _WX_XH_CALD_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_CALENDARCTRL - -class WXDLLIMPEXP_XRC wxCalendarCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxCalendarCtrlXmlHandler) - -public: - wxCalendarCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_CALENDARCTRL - -#endif // _WX_XH_CALD_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_cald.h +// Purpose: XML resource handler for wxCalendarCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// RCS-ID: $Id: xh_cald.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CALD_H_ +#define _WX_XH_CALD_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CALENDARCTRL + +class WXDLLIMPEXP_XRC wxCalendarCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxCalendarCtrlXmlHandler) + +public: + wxCalendarCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_CALENDARCTRL + +#endif // _WX_XH_CALD_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_chckb.h b/Externals/wxWidgets/include/wx/xrc/xh_chckb.h index 7a3bd3636c..c9b8e74a80 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_chckb.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_chckb.h @@ -1,31 +1,31 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_chckb.h -// Purpose: XML resource handler for wxCheckBox -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_chckb.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_CHCKB_H_ -#define _WX_XH_CHCKB_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_CHECKBOX - -class WXDLLIMPEXP_XRC wxCheckBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxCheckBoxXmlHandler) - -public: - wxCheckBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_CHECKBOX - -#endif // _WX_XH_CHECKBOX_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_chckb.h +// Purpose: XML resource handler for wxCheckBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_chckb.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHCKB_H_ +#define _WX_XH_CHCKB_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHECKBOX + +class WXDLLIMPEXP_XRC wxCheckBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxCheckBoxXmlHandler) + +public: + wxCheckBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_CHECKBOX + +#endif // _WX_XH_CHECKBOX_H_ + diff --git a/Externals/wxWidgets/include/wx/xrc/xh_chckl.h b/Externals/wxWidgets/include/wx/xrc/xh_chckl.h index f130774116..4969356c8b 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_chckl.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_chckl.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_chckl.h -// Purpose: XML resource handler for wxCheckListBox -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_chckl.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_CHCKL_H_ -#define _WX_XH_CHCKL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_CHECKLISTBOX - -class WXDLLIMPEXP_XRC wxCheckListBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxCheckListBoxXmlHandler) - -public: - wxCheckListBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - wxArrayString strList; -}; - -#endif // wxUSE_XRC && wxUSE_CHECKLISTBOX - -#endif // _WX_XH_CHECKLIST_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_chckl.h +// Purpose: XML resource handler for wxCheckListBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_chckl.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHCKL_H_ +#define _WX_XH_CHCKL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHECKLISTBOX + +class WXDLLIMPEXP_XRC wxCheckListBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxCheckListBoxXmlHandler) + +public: + wxCheckListBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_CHECKLISTBOX + +#endif // _WX_XH_CHECKLIST_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_choic.h b/Externals/wxWidgets/include/wx/xrc/xh_choic.h index d57da00aca..770d4de126 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_choic.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_choic.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_choic.h -// Purpose: XML resource handler for wxChoice -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_choic.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_CHOIC_H_ -#define _WX_XH_CHOIC_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_CHOICE - -class WXDLLIMPEXP_XRC wxChoiceXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxChoiceXmlHandler) - -public: - wxChoiceXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - wxArrayString strList; -}; - -#endif // wxUSE_XRC && wxUSE_CHOICE - -#endif // _WX_XH_CHOIC_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_choic.h +// Purpose: XML resource handler for wxChoice +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_choic.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHOIC_H_ +#define _WX_XH_CHOIC_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHOICE + +class WXDLLIMPEXP_XRC wxChoiceXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxChoiceXmlHandler) + +public: + wxChoiceXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_CHOICE + +#endif // _WX_XH_CHOIC_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_choicbk.h b/Externals/wxWidgets/include/wx/xrc/xh_choicbk.h index 1315e453be..20c5346eb3 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_choicbk.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_choicbk.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_choicbk.h -// Purpose: XML resource handler for wxChoicebook -// Author: Vaclav Slavik -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_CHOICEBK_H_ -#define _WX_XH_CHOICEBK_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_CHOICEBOOK - -class WXDLLIMPEXP_FWD_CORE wxChoicebook; - -class WXDLLIMPEXP_XRC wxChoicebookXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxChoicebookXmlHandler) - -public: - wxChoicebookXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxChoicebook *m_choicebook; -}; - -#endif // wxUSE_XRC && wxUSE_CHOICEBOOK - -#endif // _WX_XH_CHOICEBK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_choicbk.h +// Purpose: XML resource handler for wxChoicebook +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHOICEBK_H_ +#define _WX_XH_CHOICEBK_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHOICEBOOK + +class WXDLLIMPEXP_FWD_CORE wxChoicebook; + +class WXDLLIMPEXP_XRC wxChoicebookXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxChoicebookXmlHandler) + +public: + wxChoicebookXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxChoicebook *m_choicebook; +}; + +#endif // wxUSE_XRC && wxUSE_CHOICEBOOK + +#endif // _WX_XH_CHOICEBK_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_clrpicker.h b/Externals/wxWidgets/include/wx/xrc/xh_clrpicker.h index 3ddb3b2cd4..43ff72f091 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_clrpicker.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_clrpicker.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_clrpicker.h -// Purpose: XML resource handler for wxColourPickerCtrl -// Author: Francesco Montorsi -// Created: 2006-04-17 -// RCS-ID: $Id: xh_clrpicker.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_CLRPICKERCTRL_H_ -#define _WX_XH_CLRPICKERCTRL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_COLOURPICKERCTRL - -class WXDLLIMPEXP_XRC wxColourPickerCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler) - -public: - wxColourPickerCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL - -#endif // _WX_XH_CLRPICKERCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_clrpicker.h +// Purpose: XML resource handler for wxColourPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// RCS-ID: $Id: xh_clrpicker.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CLRPICKERCTRL_H_ +#define _WX_XH_CLRPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COLOURPICKERCTRL + +class WXDLLIMPEXP_XRC wxColourPickerCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler) + +public: + wxColourPickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL + +#endif // _WX_XH_CLRPICKERCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_collpane.h b/Externals/wxWidgets/include/wx/xrc/xh_collpane.h index 1c5fc5d3b1..4b758b168b 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_collpane.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_collpane.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_collpane.h -// Purpose: XML resource handler for wxCollapsiblePane -// Author: Francesco Montorsi -// Created: 2006-10-27 -// RCS-ID: $Id: xh_collpane.h 52422 2008-03-10 13:55:07Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_COLLPANE_H_ -#define _WX_XH_COLLPANE_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_COLLPANE - -class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane; - -class WXDLLIMPEXP_XRC wxCollapsiblePaneXmlHandler : public wxXmlResourceHandler -{ -public: - wxCollapsiblePaneXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxCollapsiblePane *m_collpane; - - DECLARE_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler) -}; - -#endif // wxUSE_XRC && wxUSE_COLLPANE - -#endif // _WX_XH_COLLPANE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_collpane.h +// Purpose: XML resource handler for wxCollapsiblePane +// Author: Francesco Montorsi +// Created: 2006-10-27 +// RCS-ID: $Id: xh_collpane.h 52422 2008-03-10 13:55:07Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_COLLPANE_H_ +#define _WX_XH_COLLPANE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COLLPANE + +class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane; + +class WXDLLIMPEXP_XRC wxCollapsiblePaneXmlHandler : public wxXmlResourceHandler +{ +public: + wxCollapsiblePaneXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxCollapsiblePane *m_collpane; + + DECLARE_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler) +}; + +#endif // wxUSE_XRC && wxUSE_COLLPANE + +#endif // _WX_XH_COLLPANE_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_combo.h b/Externals/wxWidgets/include/wx/xrc/xh_combo.h index f7857e02b6..d57cc6179c 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_combo.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_combo.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_combo.h -// Purpose: XML resource handler for wxComboBox -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_combo.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_COMBO_H_ -#define _WX_XH_COMBO_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_COMBOBOX - -class WXDLLIMPEXP_XRC wxComboBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxComboBoxXmlHandler) - -public: - wxComboBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - wxArrayString strList; -}; - -#endif // wxUSE_XRC && wxUSE_COMBOBOX - -#endif // _WX_XH_COMBO_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_combo.h +// Purpose: XML resource handler for wxComboBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_combo.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_COMBO_H_ +#define _WX_XH_COMBO_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COMBOBOX + +class WXDLLIMPEXP_XRC wxComboBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxComboBoxXmlHandler) + +public: + wxComboBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_COMBOBOX + +#endif // _WX_XH_COMBO_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_datectrl.h b/Externals/wxWidgets/include/wx/xrc/xh_datectrl.h index 8ecb7c86fb..0fdb0835bd 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_datectrl.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_datectrl.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_datectrl.h -// Purpose: XML resource handler for wxDatePickerCtrl -// Author: Vaclav Slavik -// Created: 2005-02-07 -// RCS-ID: $Id: xh_datectrl.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2005 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_DATECTRL_H_ -#define _WX_XH_DATECTRL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_DATEPICKCTRL - -class WXDLLIMPEXP_XRC wxDateCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxDateCtrlXmlHandler) - -public: - wxDateCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_DATEPICKCTRL - -#endif // _WX_XH_DATECTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_datectrl.h +// Purpose: XML resource handler for wxDatePickerCtrl +// Author: Vaclav Slavik +// Created: 2005-02-07 +// RCS-ID: $Id: xh_datectrl.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2005 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DATECTRL_H_ +#define _WX_XH_DATECTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DATEPICKCTRL + +class WXDLLIMPEXP_XRC wxDateCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxDateCtrlXmlHandler) + +public: + wxDateCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_DATEPICKCTRL + +#endif // _WX_XH_DATECTRL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_dirpicker.h b/Externals/wxWidgets/include/wx/xrc/xh_dirpicker.h index 4d0c9d6b27..24b98f579a 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_dirpicker.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_dirpicker.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_dirpicker.h -// Purpose: XML resource handler for wxDirPickerCtrl -// Author: Francesco Montorsi -// Created: 2006-04-17 -// RCS-ID: $Id: xh_dirpicker.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_DIRPICKERCTRL_H_ -#define _WX_XH_DIRPICKERCTRL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_DIRPICKERCTRL - -class WXDLLIMPEXP_XRC wxDirPickerCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxDirPickerCtrlXmlHandler) - -public: - wxDirPickerCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_DIRPICKERCTRL - -#endif // _WX_XH_DIRPICKERCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_dirpicker.h +// Purpose: XML resource handler for wxDirPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// RCS-ID: $Id: xh_dirpicker.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DIRPICKERCTRL_H_ +#define _WX_XH_DIRPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DIRPICKERCTRL + +class WXDLLIMPEXP_XRC wxDirPickerCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxDirPickerCtrlXmlHandler) + +public: + wxDirPickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_DIRPICKERCTRL + +#endif // _WX_XH_DIRPICKERCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_dlg.h b/Externals/wxWidgets/include/wx/xrc/xh_dlg.h index 8c79bd4d99..e12a43956c 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_dlg.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_dlg.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_dlg.h -// Purpose: XML resource handler for dialogs -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xh_dlg.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_DLG_H_ -#define _WX_XH_DLG_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -class WXDLLIMPEXP_XRC wxDialogXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxDialogXmlHandler) - -public: - wxDialogXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC - -#endif // _WX_XH_DLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_dlg.h +// Purpose: XML resource handler for dialogs +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xh_dlg.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DLG_H_ +#define _WX_XH_DLG_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxDialogXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxDialogXmlHandler) + +public: + wxDialogXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_DLG_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_filepicker.h b/Externals/wxWidgets/include/wx/xrc/xh_filepicker.h index 36eed80210..0a64ad859f 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_filepicker.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_filepicker.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_filepicker.h -// Purpose: XML resource handler for wxFilePickerCtrl -// Author: Francesco Montorsi -// Created: 2006-04-17 -// RCS-ID: $Id: xh_filepicker.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_FILEPICKERCTRL_H_ -#define _WX_XH_FILEPICKERCTRL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_FILEPICKERCTRL - -class WXDLLIMPEXP_XRC wxFilePickerCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxFilePickerCtrlXmlHandler) - -public: - wxFilePickerCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_FILEPICKERCTRL - -#endif // _WX_XH_FILEPICKERCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_filepicker.h +// Purpose: XML resource handler for wxFilePickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// RCS-ID: $Id: xh_filepicker.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FILEPICKERCTRL_H_ +#define _WX_XH_FILEPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_FILEPICKERCTRL + +class WXDLLIMPEXP_XRC wxFilePickerCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxFilePickerCtrlXmlHandler) + +public: + wxFilePickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_FILEPICKERCTRL + +#endif // _WX_XH_FILEPICKERCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_fontpicker.h b/Externals/wxWidgets/include/wx/xrc/xh_fontpicker.h index 711b1a60c5..bbc661279a 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_fontpicker.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_fontpicker.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_fontpicker.h -// Purpose: XML resource handler for wxFontPickerCtrl -// Author: Francesco Montorsi -// Created: 2006-04-17 -// RCS-ID: $Id: xh_fontpicker.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_FONTPICKERCTRL_H_ -#define _WX_XH_FONTPICKERCTRL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_FONTPICKERCTRL - -class WXDLLIMPEXP_XRC wxFontPickerCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler) - -public: - wxFontPickerCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL - -#endif // _WX_XH_FONTPICKERCTRL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_fontpicker.h +// Purpose: XML resource handler for wxFontPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// RCS-ID: $Id: xh_fontpicker.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FONTPICKERCTRL_H_ +#define _WX_XH_FONTPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_FONTPICKERCTRL + +class WXDLLIMPEXP_XRC wxFontPickerCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler) + +public: + wxFontPickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL + +#endif // _WX_XH_FONTPICKERCTRL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_frame.h b/Externals/wxWidgets/include/wx/xrc/xh_frame.h index 40ac2b9401..3bfcbe5b00 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_frame.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_frame.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_frame.h -// Purpose: XML resource handler for wxFrame -// Author: Vaclav Slavik & Aleks. -// Created: 2000/03/05 -// RCS-ID: $Id: xh_frame.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_FRAME_H_ -#define _WX_XH_FRAME_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -class WXDLLIMPEXP_XRC wxFrameXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxFrameXmlHandler) - -public: - wxFrameXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC - -#endif // _WX_XH_FRAME_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_frame.h +// Purpose: XML resource handler for wxFrame +// Author: Vaclav Slavik & Aleks. +// Created: 2000/03/05 +// RCS-ID: $Id: xh_frame.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FRAME_H_ +#define _WX_XH_FRAME_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxFrameXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxFrameXmlHandler) + +public: + wxFrameXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_FRAME_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_gauge.h b/Externals/wxWidgets/include/wx/xrc/xh_gauge.h index 1cefce96ed..05ce865205 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_gauge.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_gauge.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_gauge.h -// Purpose: XML resource handler for wxGauge -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_gauge.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_GAUGE_H_ -#define _WX_XH_GAUGE_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_GAUGE - -class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler) - enum - { - wxGAUGE_DEFAULT_RANGE = 100 - }; - -public: - wxGaugeXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_GAUGE - -#endif // _WX_XH_GAUGE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_gauge.h +// Purpose: XML resource handler for wxGauge +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_gauge.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GAUGE_H_ +#define _WX_XH_GAUGE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_GAUGE + +class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler) + enum + { + wxGAUGE_DEFAULT_RANGE = 100 + }; + +public: + wxGaugeXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_GAUGE + +#endif // _WX_XH_GAUGE_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_gdctl.h b/Externals/wxWidgets/include/wx/xrc/xh_gdctl.h index f0bd1f5cde..f706ccfb84 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_gdctl.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_gdctl.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_gdctl.h -// Purpose: XML resource handler for wxGenericDirCtrl -// Author: Markus Greither -// Created: 2002/01/20 -// RCS-ID: $Id: xh_gdctl.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2002 Markus Greither -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_GDCTL_H_ -#define _WX_XH_GDCTL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_DIRDLG - -class WXDLLIMPEXP_XRC wxGenericDirCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxGenericDirCtrlXmlHandler) - -public: - wxGenericDirCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_DIRDLG - -#endif // _WX_XH_GDCTL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_gdctl.h +// Purpose: XML resource handler for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// RCS-ID: $Id: xh_gdctl.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GDCTL_H_ +#define _WX_XH_GDCTL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DIRDLG + +class WXDLLIMPEXP_XRC wxGenericDirCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxGenericDirCtrlXmlHandler) + +public: + wxGenericDirCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_DIRDLG + +#endif // _WX_XH_GDCTL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_grid.h b/Externals/wxWidgets/include/wx/xrc/xh_grid.h index 8e84009022..0cabb4b88e 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_grid.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_grid.h @@ -1,31 +1,31 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_grid.h -// Purpose: XML resource handler for wxGrid -// Author: Agron Selimaj -// Created: 2005/08/11 -// RCS-ID: $Id: xh_grid.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2005 Agron Selimaj, Freepour Controls Inc. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_GRD_H_ -#define _WX_XH_GRD_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_GRID - -class WXDLLIMPEXP_XRC wxGridXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxGridXmlHandler) - -public: - wxGridXmlHandler(); - - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_GRID - -#endif // _WX_XH_GRD_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_grid.h +// Purpose: XML resource handler for wxGrid +// Author: Agron Selimaj +// Created: 2005/08/11 +// RCS-ID: $Id: xh_grid.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2005 Agron Selimaj, Freepour Controls Inc. +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GRD_H_ +#define _WX_XH_GRD_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_GRID + +class WXDLLIMPEXP_XRC wxGridXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxGridXmlHandler) + +public: + wxGridXmlHandler(); + + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_GRID + +#endif // _WX_XH_GRD_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_html.h b/Externals/wxWidgets/include/wx/xrc/xh_html.h index c01b66e8fe..770ea9ad19 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_html.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_html.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_html.h -// Purpose: XML resource handler for wxHtmlWindow -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_html.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_HTML_H_ -#define _WX_XH_HTML_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_HTML - -class WXDLLIMPEXP_XRC wxHtmlWindowXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxHtmlWindowXmlHandler) - -public: - wxHtmlWindowXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_HTML - -#endif // _WX_XH_HTML_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_html.h +// Purpose: XML resource handler for wxHtmlWindow +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_html.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_HTML_H_ +#define _WX_XH_HTML_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_HTML + +class WXDLLIMPEXP_XRC wxHtmlWindowXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxHtmlWindowXmlHandler) + +public: + wxHtmlWindowXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_HTML + +#endif // _WX_XH_HTML_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_htmllbox.h b/Externals/wxWidgets/include/wx/xrc/xh_htmllbox.h index 529c8049cd..e5c5ff943a 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_htmllbox.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_htmllbox.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_htmllbox.h -// Purpose: XML resource handler for wxSimpleHtmlListBox -// Author: Francesco Montorsi -// Created: 2006/10/21 -// RCS-ID: $Id: xh_htmllbox.h 42257 2006-10-22 22:09:16Z VZ $ -// Copyright: (c) 2006 Francesco Montorsi -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SIMPLEHTMLLISTBOX_H_ -#define _WX_XH_SIMPLEHTMLLISTBOX_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_HTML - -class WXDLLIMPEXP_XRC wxSimpleHtmlListBoxXmlHandler : public wxXmlResourceHandler -{ -public: - wxSimpleHtmlListBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - wxArrayString strList; - - DECLARE_DYNAMIC_CLASS(wxSimpleHtmlListBoxXmlHandler) -}; - -#endif // wxUSE_XRC && wxUSE_HTML - -#endif // _WX_XH_SIMPLEHTMLLISTBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_htmllbox.h +// Purpose: XML resource handler for wxSimpleHtmlListBox +// Author: Francesco Montorsi +// Created: 2006/10/21 +// RCS-ID: $Id: xh_htmllbox.h 42257 2006-10-22 22:09:16Z VZ $ +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SIMPLEHTMLLISTBOX_H_ +#define _WX_XH_SIMPLEHTMLLISTBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_HTML + +class WXDLLIMPEXP_XRC wxSimpleHtmlListBoxXmlHandler : public wxXmlResourceHandler +{ +public: + wxSimpleHtmlListBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + wxArrayString strList; + + DECLARE_DYNAMIC_CLASS(wxSimpleHtmlListBoxXmlHandler) +}; + +#endif // wxUSE_XRC && wxUSE_HTML + +#endif // _WX_XH_SIMPLEHTMLLISTBOX_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_hyperlink.h b/Externals/wxWidgets/include/wx/xrc/xh_hyperlink.h index 157ef2b8ce..573359faf7 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_hyperlink.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_hyperlink.h @@ -1,37 +1,37 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_hyperlink.h -// Purpose: Hyperlink control (wxAdv) -// Author: David Norris -// Modified by: Ryan Norton, Francesco Montorsi -// Created: 04/02/2005 -// RCS-ID: $Id: xh_hyperlink.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2005 David Norris -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_HYPERLINKH__ -#define _WX_XH_HYPERLINKH__ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_HYPERLINKCTRL - -class WXDLLIMPEXP_XRC wxHyperlinkCtrlXmlHandler : public wxXmlResourceHandler -{ - // Register with wxWindows' dynamic class subsystem. - DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrlXmlHandler) - -public: - // Constructor. - wxHyperlinkCtrlXmlHandler(); - - // Creates the control and returns a pointer to it. - virtual wxObject *DoCreateResource(); - - // Returns true if we know how to create a control for the given node. - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_HYPERLINKCTRL - -#endif // _WX_XH_HYPERLINKH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_hyperlink.h +// Purpose: Hyperlink control (wxAdv) +// Author: David Norris +// Modified by: Ryan Norton, Francesco Montorsi +// Created: 04/02/2005 +// RCS-ID: $Id: xh_hyperlink.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2005 David Norris +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_HYPERLINKH__ +#define _WX_XH_HYPERLINKH__ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_HYPERLINKCTRL + +class WXDLLIMPEXP_XRC wxHyperlinkCtrlXmlHandler : public wxXmlResourceHandler +{ + // Register with wxWindows' dynamic class subsystem. + DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrlXmlHandler) + +public: + // Constructor. + wxHyperlinkCtrlXmlHandler(); + + // Creates the control and returns a pointer to it. + virtual wxObject *DoCreateResource(); + + // Returns true if we know how to create a control for the given node. + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_HYPERLINKCTRL + +#endif // _WX_XH_HYPERLINKH__ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_listb.h b/Externals/wxWidgets/include/wx/xrc/xh_listb.h index 6a6ad581fe..53c135066d 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_listb.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_listb.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_listb.h -// Purpose: XML resource handler for wxListbox -// Author: Bob Mitchell & Vaclav Slavik -// Created: 2000/07/29 -// RCS-ID: $Id: xh_listb.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell & Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_LISTB_H_ -#define _WX_XH_LISTB_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_LISTBOX - -class WXDLLIMPEXP_XRC wxListBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxListBoxXmlHandler) - -public: - wxListBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - wxArrayString strList; -}; - -#endif // wxUSE_XRC && wxUSE_LISTBOX - -#endif // _WX_XH_LISTB_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_listb.h +// Purpose: XML resource handler for wxListbox +// Author: Bob Mitchell & Vaclav Slavik +// Created: 2000/07/29 +// RCS-ID: $Id: xh_listb.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell & Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_LISTB_H_ +#define _WX_XH_LISTB_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_LISTBOX + +class WXDLLIMPEXP_XRC wxListBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxListBoxXmlHandler) + +public: + wxListBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_LISTBOX + +#endif // _WX_XH_LISTB_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_listbk.h b/Externals/wxWidgets/include/wx/xrc/xh_listbk.h index bd2ea95646..7aa2e0b2f3 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_listbk.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_listbk.h @@ -1,34 +1,34 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_listbk.h -// Purpose: XML resource handler for wxListbook -// Author: Vaclav Slavik -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_LISTBK_H_ -#define _WX_XH_LISTBK_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_LISTBOOK - -class WXDLLIMPEXP_FWD_CORE wxListbook; - -class WXDLLIMPEXP_XRC wxListbookXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxListbookXmlHandler) - -public: - wxListbookXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxListbook *m_listbook; -}; - -#endif // wxUSE_XRC && wxUSE_LISTBOOK - -#endif // _WX_XH_LISTBK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_listbk.h +// Purpose: XML resource handler for wxListbook +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_LISTBK_H_ +#define _WX_XH_LISTBK_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_LISTBOOK + +class WXDLLIMPEXP_FWD_CORE wxListbook; + +class WXDLLIMPEXP_XRC wxListbookXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxListbookXmlHandler) + +public: + wxListbookXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxListbook *m_listbook; +}; + +#endif // wxUSE_XRC && wxUSE_LISTBOOK + +#endif // _WX_XH_LISTBK_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_listc.h b/Externals/wxWidgets/include/wx/xrc/xh_listc.h index fd88cb5034..33b19d9d77 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_listc.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_listc.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_listc.h -// Purpose: XML resource handler for wxListCtrl -// Author: Brian Gavin -// Created: 2000/09/09 -// RCS-ID: $Id: xh_listc.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Brian Gavin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_LISTC_H_ -#define _WX_XH_LISTC_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_LISTCTRL - -class WXDLLIMPEXP_XRC wxListCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxListCtrlXmlHandler) - -public: - wxListCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_LISTCTRL - -#endif // _WX_XH_LISTC_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_listc.h +// Purpose: XML resource handler for wxListCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// RCS-ID: $Id: xh_listc.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_LISTC_H_ +#define _WX_XH_LISTC_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_LISTCTRL + +class WXDLLIMPEXP_XRC wxListCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxListCtrlXmlHandler) + +public: + wxListCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_LISTCTRL + +#endif // _WX_XH_LISTC_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_mdi.h b/Externals/wxWidgets/include/wx/xrc/xh_mdi.h index 0753a54d79..6cd1fc7e72 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_mdi.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_mdi.h @@ -1,35 +1,35 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_mdi.h -// Purpose: XML resource handler for wxMDI -// Author: David M. Falkinder & Vaclav Slavik -// Created: 14/02/2005 -// RCS-ID: $Id: xh_mdi.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2005 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_MDI_H_ -#define _WX_XH_MDI_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_MDI - -class WXDLLIMPEXP_FWD_CORE wxWindow; - -class WXDLLIMPEXP_XRC wxMdiXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxMdiXmlHandler) - -public: - wxMdiXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - wxWindow *CreateFrame(); -}; - -#endif // wxUSE_XRC && wxUSE_MDI - -#endif // _WX_XH_MDI_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_mdi.h +// Purpose: XML resource handler for wxMDI +// Author: David M. Falkinder & Vaclav Slavik +// Created: 14/02/2005 +// RCS-ID: $Id: xh_mdi.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2005 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_MDI_H_ +#define _WX_XH_MDI_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_MDI + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_XRC wxMdiXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxMdiXmlHandler) + +public: + wxMdiXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + wxWindow *CreateFrame(); +}; + +#endif // wxUSE_XRC && wxUSE_MDI + +#endif // _WX_XH_MDI_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_menu.h b/Externals/wxWidgets/include/wx/xrc/xh_menu.h index a1895df561..2599478acb 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_menu.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_menu.h @@ -1,43 +1,43 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_menu.h -// Purpose: XML resource handler for menus/menubars -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xh_menu.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_MENU_H_ -#define _WX_XH_MENU_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_MENUS - -class WXDLLIMPEXP_XRC wxMenuXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxMenuXmlHandler) - -public: - wxMenuXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideMenu; -}; - -class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler) - -public: - wxMenuBarXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_MENUS - -#endif // _WX_XH_MENU_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_menu.h +// Purpose: XML resource handler for menus/menubars +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xh_menu.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_MENU_H_ +#define _WX_XH_MENU_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_MENUS + +class WXDLLIMPEXP_XRC wxMenuXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxMenuXmlHandler) + +public: + wxMenuXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideMenu; +}; + +class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler) + +public: + wxMenuBarXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_MENUS + +#endif // _WX_XH_MENU_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_notbk.h b/Externals/wxWidgets/include/wx/xrc/xh_notbk.h index d21ba65c7b..2f97b4ceb5 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_notbk.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_notbk.h @@ -1,35 +1,35 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_notbk.h -// Purpose: XML resource handler for wxNotebook -// Author: Vaclav Slavik -// RCS-ID: $Id: xh_notbk.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_NOTBK_H_ -#define _WX_XH_NOTBK_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_NOTEBOOK - -class WXDLLIMPEXP_FWD_CORE wxNotebook; - -class WXDLLIMPEXP_XRC wxNotebookXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxNotebookXmlHandler) - -public: - wxNotebookXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxNotebook *m_notebook; -}; - -#endif // wxUSE_XRC && wxUSE_NOTEBOOK - -#endif // _WX_XH_NOTBK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_notbk.h +// Purpose: XML resource handler for wxNotebook +// Author: Vaclav Slavik +// RCS-ID: $Id: xh_notbk.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_NOTBK_H_ +#define _WX_XH_NOTBK_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_NOTEBOOK + +class WXDLLIMPEXP_FWD_CORE wxNotebook; + +class WXDLLIMPEXP_XRC wxNotebookXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxNotebookXmlHandler) + +public: + wxNotebookXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxNotebook *m_notebook; +}; + +#endif // wxUSE_XRC && wxUSE_NOTEBOOK + +#endif // _WX_XH_NOTBK_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_odcombo.h b/Externals/wxWidgets/include/wx/xrc/xh_odcombo.h index a9c6afd045..ffbd021124 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_odcombo.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_odcombo.h @@ -1,35 +1,35 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_odcombo.h -// Purpose: XML resource handler for wxOwnerDrawnComboBox -// Author: Alex Bligh - based on wx/xrc/xh_combo.h -// Created: 2006/06/19 -// RCS-ID: $Id: xh_odcombo.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2006 Alex Bligh -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_ODCOMBO_H_ -#define _WX_XH_ODCOMBO_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_ODCOMBOBOX - -class WXDLLIMPEXP_XRC wxOwnerDrawnComboBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler) - -public: - wxOwnerDrawnComboBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - wxArrayString strList; -}; - -#endif // wxUSE_XRC && wxUSE_ODCOMBOBOX - -#endif // _WX_XH_ODCOMBO_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_odcombo.h +// Purpose: XML resource handler for wxOwnerDrawnComboBox +// Author: Alex Bligh - based on wx/xrc/xh_combo.h +// Created: 2006/06/19 +// RCS-ID: $Id: xh_odcombo.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2006 Alex Bligh +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ODCOMBO_H_ +#define _WX_XH_ODCOMBO_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_ODCOMBOBOX + +class WXDLLIMPEXP_XRC wxOwnerDrawnComboBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler) + +public: + wxOwnerDrawnComboBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_ODCOMBOBOX + +#endif // _WX_XH_ODCOMBO_H_ + diff --git a/Externals/wxWidgets/include/wx/xrc/xh_panel.h b/Externals/wxWidgets/include/wx/xrc/xh_panel.h index 65247c9880..600ebf289f 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_panel.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_panel.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_panel.h -// Purpose: XML resource handler for wxPanel -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xh_panel.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_PANEL_H_ -#define _WX_XH_PANEL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -class WXDLLIMPEXP_XRC wxPanelXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxPanelXmlHandler) - -public: - wxPanelXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC - -#endif // _WX_XH_PANEL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_panel.h +// Purpose: XML resource handler for wxPanel +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xh_panel.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_PANEL_H_ +#define _WX_XH_PANEL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxPanelXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxPanelXmlHandler) + +public: + wxPanelXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_PANEL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_propdlg.h b/Externals/wxWidgets/include/wx/xrc/xh_propdlg.h index a54f124143..e55f1d3580 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_propdlg.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_propdlg.h @@ -1,38 +1,38 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_propdlg.h -// Purpose: XML resource handler for wxPropertySheetDialog -// Author: Sander Berents -// Created: 2007/07/12 -// RCS-ID: $Id: xh_propdlg.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2007 Sander Berents -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_PROPDLG_H_ -#define _WX_XH_PROPDLG_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -#if wxABI_VERSION >= 20805 -class WXDLLIMPEXP_FWD_ADV wxPropertySheetDialog; - -class WXDLLIMPEXP_XRC wxPropertySheetDialogXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler) - -public: - wxPropertySheetDialogXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxPropertySheetDialog *m_dialog; -}; -#endif // wxABI_VERSION >= 20805 - -#endif // wxUSE_XRC - -#endif // _WX_XH_PROPDLG_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_propdlg.h +// Purpose: XML resource handler for wxPropertySheetDialog +// Author: Sander Berents +// Created: 2007/07/12 +// RCS-ID: $Id: xh_propdlg.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2007 Sander Berents +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_PROPDLG_H_ +#define _WX_XH_PROPDLG_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +#if wxABI_VERSION >= 20805 +class WXDLLIMPEXP_FWD_ADV wxPropertySheetDialog; + +class WXDLLIMPEXP_XRC wxPropertySheetDialogXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler) + +public: + wxPropertySheetDialogXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxPropertySheetDialog *m_dialog; +}; +#endif // wxABI_VERSION >= 20805 + +#endif // wxUSE_XRC + +#endif // _WX_XH_PROPDLG_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_radbt.h b/Externals/wxWidgets/include/wx/xrc/xh_radbt.h index ec8e7cd7c6..da61711f55 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_radbt.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_radbt.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_radbt.h -// Purpose: XML resource handler for wxRadioButton -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_radbt.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_RADBT_H_ -#define _WX_XH_RADBT_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_RADIOBTN - -class WXDLLIMPEXP_XRC wxRadioButtonXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxRadioButtonXmlHandler) - -public: - wxRadioButtonXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_RADIOBOX - -#endif // _WX_XH_RADBT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_radbt.h +// Purpose: XML resource handler for wxRadioButton +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_radbt.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_RADBT_H_ +#define _WX_XH_RADBT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RADIOBTN + +class WXDLLIMPEXP_XRC wxRadioButtonXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxRadioButtonXmlHandler) + +public: + wxRadioButtonXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_RADIOBOX + +#endif // _WX_XH_RADBT_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_radbx.h b/Externals/wxWidgets/include/wx/xrc/xh_radbx.h index 424fa67496..f53e0a6eb1 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_radbx.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_radbx.h @@ -1,43 +1,43 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_radbx.h -// Purpose: XML resource handler for wxRadioBox -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_radbx.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_RADBX_H_ -#define _WX_XH_RADBX_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_RADIOBOX - -class WXDLLIMPEXP_XRC wxRadioBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxRadioBoxXmlHandler) - -public: - wxRadioBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_insideBox; - - // the items labels - wxArrayString labels; - - // the items tooltips - wxArrayString tooltips; - - // the item help text - wxArrayString helptexts; - wxArrayInt helptextSpecified; -}; - -#endif // wxUSE_XRC && wxUSE_RADIOBOX - -#endif // _WX_XH_RADBX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_radbx.h +// Purpose: XML resource handler for wxRadioBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_radbx.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_RADBX_H_ +#define _WX_XH_RADBX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RADIOBOX + +class WXDLLIMPEXP_XRC wxRadioBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxRadioBoxXmlHandler) + +public: + wxRadioBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_insideBox; + + // the items labels + wxArrayString labels; + + // the items tooltips + wxArrayString tooltips; + + // the item help text + wxArrayString helptexts; + wxArrayInt helptextSpecified; +}; + +#endif // wxUSE_XRC && wxUSE_RADIOBOX + +#endif // _WX_XH_RADBX_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_richtext.h b/Externals/wxWidgets/include/wx/xrc/xh_richtext.h index c00f423229..17772eeb99 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_richtext.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_richtext.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_text.h -// Purpose: XML resource handler for wxRichTextCtrl -// Author: Julian Smart -// Created: 2006-11-08 -// RCS-ID: $Id: xh_richtext.h 43199 2006-11-08 15:45:11Z JS $ -// Copyright: (c) 2006 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_RICHTEXT_H_ -#define _WX_XH_RICHTEXT_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_RICHTEXT - -class WXDLLIMPEXP_XRC wxRichTextCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler) - -public: - wxRichTextCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_RICHTEXT - -#endif // _WX_XH_RICHTEXT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_text.h +// Purpose: XML resource handler for wxRichTextCtrl +// Author: Julian Smart +// Created: 2006-11-08 +// RCS-ID: $Id: xh_richtext.h 43199 2006-11-08 15:45:11Z JS $ +// Copyright: (c) 2006 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_RICHTEXT_H_ +#define _WX_XH_RICHTEXT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RICHTEXT + +class WXDLLIMPEXP_XRC wxRichTextCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler) + +public: + wxRichTextCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_RICHTEXT + +#endif // _WX_XH_RICHTEXT_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_scrol.h b/Externals/wxWidgets/include/wx/xrc/xh_scrol.h index 61246b5f64..978e82bc5c 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_scrol.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_scrol.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_scrol.h -// Purpose: XML resource handler for wxScrollBar -// Author: Brian Gavin -// Created: 2000/09/09 -// RCS-ID: $Id: xh_scrol.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Brian Gavin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SCROL_H_ -#define _WX_XH_SCROL_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_SCROLLBAR - -class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler) - enum - { - wxSL_DEFAULT_VALUE = 0, - wxSL_DEFAULT_MIN = 0, - wxSL_DEFAULT_MAX = 100 - }; - -public: - wxScrollBarXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_SCROLLBAR - -#endif // _WX_XH_SCROL_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_scrol.h +// Purpose: XML resource handler for wxScrollBar +// Author: Brian Gavin +// Created: 2000/09/09 +// RCS-ID: $Id: xh_scrol.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SCROL_H_ +#define _WX_XH_SCROL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SCROLLBAR + +class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler) + enum + { + wxSL_DEFAULT_VALUE = 0, + wxSL_DEFAULT_MIN = 0, + wxSL_DEFAULT_MAX = 100 + }; + +public: + wxScrollBarXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_SCROLLBAR + +#endif // _WX_XH_SCROL_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_scwin.h b/Externals/wxWidgets/include/wx/xrc/xh_scwin.h index 8e4e18b700..9875f4e3e8 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_scwin.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_scwin.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_scwin.h -// Purpose: XML resource handler for wxScrolledWindow -// Author: Vaclav Slavik -// Created: 2002/10/18 -// RCS-ID: $Id: xh_scwin.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2002 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SCWIN_H_ -#define _WX_XH_SCWIN_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -class WXDLLIMPEXP_XRC wxScrolledWindowXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxScrolledWindowXmlHandler) - -public: - wxScrolledWindowXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC - -#endif // _WX_XH_SCWIN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_scwin.h +// Purpose: XML resource handler for wxScrolledWindow +// Author: Vaclav Slavik +// Created: 2002/10/18 +// RCS-ID: $Id: xh_scwin.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2002 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SCWIN_H_ +#define _WX_XH_SCWIN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxScrolledWindowXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxScrolledWindowXmlHandler) + +public: + wxScrolledWindowXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_SCWIN_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_sizer.h b/Externals/wxWidgets/include/wx/xrc/xh_sizer.h index abbd3b77c6..15b30ff3d3 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_sizer.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_sizer.h @@ -1,80 +1,80 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_sizer.h -// Purpose: XML resource handler for wxBoxSizer -// Author: Vaclav Slavik -// Created: 2000/04/24 -// RCS-ID: $Id: xh_sizer.h 49804 2007-11-10 01:09:42Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SIZER_H_ -#define _WX_XH_SIZER_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -#include "wx/sizer.h" -#include "wx/gbsizer.h" - -class WXDLLIMPEXP_FWD_CORE wxSizer; - -class WXDLLIMPEXP_XRC wxSizerXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxSizerXmlHandler) - -public: - wxSizerXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - bool m_isGBS; - - wxSizer *m_parentSizer; - - bool IsSizerNode(wxXmlNode *node); - - wxObject* Handle_sizeritem(); - wxObject* Handle_spacer(); - wxObject* Handle_sizer(); - wxSizer* Handle_wxBoxSizer(); -#if wxUSE_STATBOX - wxSizer* Handle_wxStaticBoxSizer(); -#endif - wxSizer* Handle_wxGridSizer(); - wxSizer* Handle_wxFlexGridSizer(); - wxSizer* Handle_wxGridBagSizer(); - - void SetGrowables(wxFlexGridSizer* fsizer, const wxChar* param, bool rows); - wxGBPosition GetGBPos(const wxString& param); - wxGBSpan GetGBSpan(const wxString& param); - wxSizerItem* MakeSizerItem(); - void SetSizerItemAttributes(wxSizerItem* sitem); - void AddSizerItem(wxSizerItem* sitem); -}; - -#if wxUSE_BUTTON - -class WXDLLIMPEXP_XRC wxStdDialogButtonSizerXmlHandler - : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxStdDialogButtonSizerXmlHandler) - -public: - wxStdDialogButtonSizerXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxStdDialogButtonSizer *m_parentSizer; -}; - -#endif // wxUSE_BUTTON - -#endif // wxUSE_XRC - -#endif // _WX_XH_SIZER_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_sizer.h +// Purpose: XML resource handler for wxBoxSizer +// Author: Vaclav Slavik +// Created: 2000/04/24 +// RCS-ID: $Id: xh_sizer.h 49804 2007-11-10 01:09:42Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SIZER_H_ +#define _WX_XH_SIZER_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +#include "wx/sizer.h" +#include "wx/gbsizer.h" + +class WXDLLIMPEXP_FWD_CORE wxSizer; + +class WXDLLIMPEXP_XRC wxSizerXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxSizerXmlHandler) + +public: + wxSizerXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + bool m_isGBS; + + wxSizer *m_parentSizer; + + bool IsSizerNode(wxXmlNode *node); + + wxObject* Handle_sizeritem(); + wxObject* Handle_spacer(); + wxObject* Handle_sizer(); + wxSizer* Handle_wxBoxSizer(); +#if wxUSE_STATBOX + wxSizer* Handle_wxStaticBoxSizer(); +#endif + wxSizer* Handle_wxGridSizer(); + wxSizer* Handle_wxFlexGridSizer(); + wxSizer* Handle_wxGridBagSizer(); + + void SetGrowables(wxFlexGridSizer* fsizer, const wxChar* param, bool rows); + wxGBPosition GetGBPos(const wxString& param); + wxGBSpan GetGBSpan(const wxString& param); + wxSizerItem* MakeSizerItem(); + void SetSizerItemAttributes(wxSizerItem* sitem); + void AddSizerItem(wxSizerItem* sitem); +}; + +#if wxUSE_BUTTON + +class WXDLLIMPEXP_XRC wxStdDialogButtonSizerXmlHandler + : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxStdDialogButtonSizerXmlHandler) + +public: + wxStdDialogButtonSizerXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxStdDialogButtonSizer *m_parentSizer; +}; + +#endif // wxUSE_BUTTON + +#endif // wxUSE_XRC + +#endif // _WX_XH_SIZER_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_slidr.h b/Externals/wxWidgets/include/wx/xrc/xh_slidr.h index 168d414c9b..8c415941a3 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_slidr.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_slidr.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_slidr.h -// Purpose: XML resource handler for wxSlider -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_slidr.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SLIDR_H_ -#define _WX_XH_SLIDR_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_SLIDER - -class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler) - enum - { - wxSL_DEFAULT_VALUE = 0, - wxSL_DEFAULT_MIN = 0, - wxSL_DEFAULT_MAX = 100 - }; - -public: - wxSliderXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_SLIDER - -#endif // _WX_XH_SLIDR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_slidr.h +// Purpose: XML resource handler for wxSlider +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_slidr.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SLIDR_H_ +#define _WX_XH_SLIDR_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SLIDER + +class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler) + enum + { + wxSL_DEFAULT_VALUE = 0, + wxSL_DEFAULT_MIN = 0, + wxSL_DEFAULT_MAX = 100 + }; + +public: + wxSliderXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_SLIDER + +#endif // _WX_XH_SLIDR_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_spin.h b/Externals/wxWidgets/include/wx/xrc/xh_spin.h index 4da1bdf5d8..d4b315186f 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_spin.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_spin.h @@ -1,61 +1,61 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_spin.h -// Purpose: XML resource handler for wxSpinButton and wxSpinCtrl -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_spin.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell and Verant Interactive -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SPIN_H_ -#define _WX_XH_SPIN_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -#if wxUSE_SPINBTN - -class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler) - enum - { - wxSP_DEFAULT_VALUE = 0, - wxSP_DEFAULT_MIN = 0, - wxSP_DEFAULT_MAX = 100 - }; - -public: - wxSpinButtonXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_SPINBTN - - -#if wxUSE_SPINCTRL - -class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler) - enum - { - wxSP_DEFAULT_VALUE = 0, - wxSP_DEFAULT_MIN = 0, - wxSP_DEFAULT_MAX = 100 - }; - -public: - wxSpinCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_SPINCTRL - -#endif // wxUSE_XRC - -#endif // _WX_XH_SPIN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_spin.h +// Purpose: XML resource handler for wxSpinButton and wxSpinCtrl +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_spin.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SPIN_H_ +#define _WX_XH_SPIN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +#if wxUSE_SPINBTN + +class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler) + enum + { + wxSP_DEFAULT_VALUE = 0, + wxSP_DEFAULT_MIN = 0, + wxSP_DEFAULT_MAX = 100 + }; + +public: + wxSpinButtonXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_SPINBTN + + +#if wxUSE_SPINCTRL + +class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler) + enum + { + wxSP_DEFAULT_VALUE = 0, + wxSP_DEFAULT_MIN = 0, + wxSP_DEFAULT_MAX = 100 + }; + +public: + wxSpinCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_SPINCTRL + +#endif // wxUSE_XRC + +#endif // _WX_XH_SPIN_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_split.h b/Externals/wxWidgets/include/wx/xrc/xh_split.h index a342225ed6..c47330e5e3 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_split.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_split.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_split.h -// Purpose: XRC resource for wxSplitterWindow -// Author: panga@freemail.hu, Vaclav Slavik -// Created: 2003/01/26 -// RCS-ID: $Id: xh_split.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_SPLIT_H_ -#define _WX_XH_SPLIT_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_SPLITTER - -class WXDLLIMPEXP_XRC wxSplitterWindowXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxSplitterWindowXmlHandler) - -public: - wxSplitterWindowXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_SPLITTER - -#endif // _WX_XH_SPLIT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_split.h +// Purpose: XRC resource for wxSplitterWindow +// Author: panga@freemail.hu, Vaclav Slavik +// Created: 2003/01/26 +// RCS-ID: $Id: xh_split.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SPLIT_H_ +#define _WX_XH_SPLIT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SPLITTER + +class WXDLLIMPEXP_XRC wxSplitterWindowXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxSplitterWindowXmlHandler) + +public: + wxSplitterWindowXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_SPLITTER + +#endif // _WX_XH_SPLIT_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_statbar.h b/Externals/wxWidgets/include/wx/xrc/xh_statbar.h index 6a1e45305b..1a2787b125 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_statbar.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_statbar.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_statbar.h -// Purpose: XML resource handler for wxStatusBar -// Author: Brian Ravnsgaard Riis -// Created: 2004/01/21 -// RCS-ID: -// Copyright: (c) 2004 Brian Ravnsgaard Riis -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_STATBAR_H_ -#define _WX_XH_STATBAR_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_STATUSBAR - -class WXDLLIMPEXP_XRC wxStatusBarXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxStatusBarXmlHandler) - -public: - wxStatusBarXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_STATUSBAR - -#endif // _WX_XH_STATBAR_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_statbar.h +// Purpose: XML resource handler for wxStatusBar +// Author: Brian Ravnsgaard Riis +// Created: 2004/01/21 +// RCS-ID: +// Copyright: (c) 2004 Brian Ravnsgaard Riis +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STATBAR_H_ +#define _WX_XH_STATBAR_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATUSBAR + +class WXDLLIMPEXP_XRC wxStatusBarXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxStatusBarXmlHandler) + +public: + wxStatusBarXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_STATUSBAR + +#endif // _WX_XH_STATBAR_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_stbmp.h b/Externals/wxWidgets/include/wx/xrc/xh_stbmp.h index d408ea4b58..0e1497fdff 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_stbmp.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_stbmp.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_stbmp.h -// Purpose: XML resource handler for wxStaticBitmap -// Author: Vaclav Slavik -// Created: 2000/04/22 -// RCS-ID: $Id: xh_stbmp.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_STBMP_H_ -#define _WX_XH_STBMP_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_STATBMP - -class WXDLLIMPEXP_XRC wxStaticBitmapXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxStaticBitmapXmlHandler) - -public: - wxStaticBitmapXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_STATBMP - -#endif // _WX_XH_STBMP_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_stbmp.h +// Purpose: XML resource handler for wxStaticBitmap +// Author: Vaclav Slavik +// Created: 2000/04/22 +// RCS-ID: $Id: xh_stbmp.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STBMP_H_ +#define _WX_XH_STBMP_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATBMP + +class WXDLLIMPEXP_XRC wxStaticBitmapXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxStaticBitmapXmlHandler) + +public: + wxStaticBitmapXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_STATBMP + +#endif // _WX_XH_STBMP_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_stbox.h b/Externals/wxWidgets/include/wx/xrc/xh_stbox.h index d859492b50..032f4d5ba1 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_stbox.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_stbox.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_stbox.h -// Purpose: XML resource handler for wxStaticBox -// Author: Brian Gavin -// Created: 2000/09/00 -// RCS-ID: $Id: xh_stbox.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Brian Gavin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_STBOX_H_ -#define _WX_XH_STBOX_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_STATBOX - -class WXDLLIMPEXP_XRC wxStaticBoxXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxStaticBoxXmlHandler) - -public: - wxStaticBoxXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_STATBOX - -#endif // _WX_XH_STBOX_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_stbox.h +// Purpose: XML resource handler for wxStaticBox +// Author: Brian Gavin +// Created: 2000/09/00 +// RCS-ID: $Id: xh_stbox.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STBOX_H_ +#define _WX_XH_STBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATBOX + +class WXDLLIMPEXP_XRC wxStaticBoxXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxStaticBoxXmlHandler) + +public: + wxStaticBoxXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_STATBOX + +#endif // _WX_XH_STBOX_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_stlin.h b/Externals/wxWidgets/include/wx/xrc/xh_stlin.h index 1951b14c5d..7eb834bde0 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_stlin.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_stlin.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_stlin.h -// Purpose: XML resource handler for wxStaticLine -// Author: Vaclav Slavik -// Created: 2000/09/00 -// RCS-ID: $Id: xh_stlin.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_STLIN_H_ -#define _WX_XH_STLIN_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_STATLINE - -class WXDLLIMPEXP_XRC wxStaticLineXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxStaticLineXmlHandler) - -public: - wxStaticLineXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_STATLINE - -#endif // _WX_XH_STLIN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_stlin.h +// Purpose: XML resource handler for wxStaticLine +// Author: Vaclav Slavik +// Created: 2000/09/00 +// RCS-ID: $Id: xh_stlin.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STLIN_H_ +#define _WX_XH_STLIN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATLINE + +class WXDLLIMPEXP_XRC wxStaticLineXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxStaticLineXmlHandler) + +public: + wxStaticLineXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_STATLINE + +#endif // _WX_XH_STLIN_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_sttxt.h b/Externals/wxWidgets/include/wx/xrc/xh_sttxt.h index a4d53f73a8..cd0247c256 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_sttxt.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_sttxt.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_sttxt.h -// Purpose: XML resource handler for wxStaticText -// Author: Bob Mitchell -// Created: 2000/03/21 -// RCS-ID: $Id: xh_sttxt.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Bob Mitchell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_STTXT_H_ -#define _WX_XH_STTXT_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_STATTEXT - -class WXDLLIMPEXP_XRC wxStaticTextXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxStaticTextXmlHandler) - -public: - wxStaticTextXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_STATTEXT - -#endif // _WX_XH_STTXT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_sttxt.h +// Purpose: XML resource handler for wxStaticText +// Author: Bob Mitchell +// Created: 2000/03/21 +// RCS-ID: $Id: xh_sttxt.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Bob Mitchell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STTXT_H_ +#define _WX_XH_STTXT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATTEXT + +class WXDLLIMPEXP_XRC wxStaticTextXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxStaticTextXmlHandler) + +public: + wxStaticTextXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_STATTEXT + +#endif // _WX_XH_STTXT_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_text.h b/Externals/wxWidgets/include/wx/xrc/xh_text.h index 4452005991..8b50a273a5 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_text.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_text.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_text.h -// Purpose: XML resource handler for wxTextCtrl -// Author: Aleksandras Gluchovas -// Created: 2000/03/21 -// RCS-ID: $Id: xh_text.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Aleksandras Gluchovas -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_TEXT_H_ -#define _WX_XH_TEXT_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_TEXTCTRL - -class WXDLLIMPEXP_XRC wxTextCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxTextCtrlXmlHandler) - -public: - wxTextCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_TEXTCTRL - -#endif // _WX_XH_TEXT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_text.h +// Purpose: XML resource handler for wxTextCtrl +// Author: Aleksandras Gluchovas +// Created: 2000/03/21 +// RCS-ID: $Id: xh_text.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Aleksandras Gluchovas +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TEXT_H_ +#define _WX_XH_TEXT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TEXTCTRL + +class WXDLLIMPEXP_XRC wxTextCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxTextCtrlXmlHandler) + +public: + wxTextCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_TEXTCTRL + +#endif // _WX_XH_TEXT_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_tglbtn.h b/Externals/wxWidgets/include/wx/xrc/xh_tglbtn.h index 71aa37fd80..844ff9b657 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_tglbtn.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_tglbtn.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_tglbtn.h -// Purpose: XML resource handler for wxToggleButton -// Author: Julian Smart -// Created: 2004-08-30 -// RCS-ID: $Id: xh_tglbtn.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2004 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_TGLBTN_H_ -#define _WX_XH_TGLBTN_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_TOGGLEBTN - -class WXDLLIMPEXP_XRC wxToggleButtonXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxToggleButtonXmlHandler) - -public: - wxToggleButtonXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_TOGGLEBTN - -#endif // _WX_XH_TGLBTN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_tglbtn.h +// Purpose: XML resource handler for wxToggleButton +// Author: Julian Smart +// Created: 2004-08-30 +// RCS-ID: $Id: xh_tglbtn.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2004 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TGLBTN_H_ +#define _WX_XH_TGLBTN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TOGGLEBTN + +class WXDLLIMPEXP_XRC wxToggleButtonXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxToggleButtonXmlHandler) + +public: + wxToggleButtonXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_TOGGLEBTN + +#endif // _WX_XH_TGLBTN_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_toolb.h b/Externals/wxWidgets/include/wx/xrc/xh_toolb.h index 4a4bd6bf88..3ef690cfad 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_toolb.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_toolb.h @@ -1,36 +1,36 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_toolb.h -// Purpose: XML resource handler for wxToolBar -// Author: Vaclav Slavik -// Created: 2000/08/11 -// RCS-ID: $Id: xh_toolb.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_TOOLB_H_ -#define _WX_XH_TOOLB_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_TOOLBAR - -class WXDLLIMPEXP_FWD_CORE wxToolBar; - -class WXDLLIMPEXP_XRC wxToolBarXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxToolBarXmlHandler) - -public: - wxToolBarXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - bool m_isInside; - wxToolBar *m_toolbar; -}; - -#endif // wxUSE_XRC && wxUSE_TOOLBAR - -#endif // _WX_XH_TOOLB_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_toolb.h +// Purpose: XML resource handler for wxToolBar +// Author: Vaclav Slavik +// Created: 2000/08/11 +// RCS-ID: $Id: xh_toolb.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TOOLB_H_ +#define _WX_XH_TOOLB_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TOOLBAR + +class WXDLLIMPEXP_FWD_CORE wxToolBar; + +class WXDLLIMPEXP_XRC wxToolBarXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxToolBarXmlHandler) + +public: + wxToolBarXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + bool m_isInside; + wxToolBar *m_toolbar; +}; + +#endif // wxUSE_XRC && wxUSE_TOOLBAR + +#endif // _WX_XH_TOOLB_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_tree.h b/Externals/wxWidgets/include/wx/xrc/xh_tree.h index f069a24457..560a5d8e43 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_tree.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_tree.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_tree.h -// Purpose: XML resource handler for wxTreeCtrl -// Author: Brian Gavin -// Created: 2000/09/09 -// RCS-ID: $Id: xh_tree.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Brian Gavin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_TREE_H_ -#define _WX_XH_TREE_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_TREECTRL - -class WXDLLIMPEXP_XRC wxTreeCtrlXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxTreeCtrlXmlHandler) - -public: - wxTreeCtrlXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC && wxUSE_TREECTRL - -#endif // _WX_XH_TREE_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_tree.h +// Purpose: XML resource handler for wxTreeCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// RCS-ID: $Id: xh_tree.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TREE_H_ +#define _WX_XH_TREE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TREECTRL + +class WXDLLIMPEXP_XRC wxTreeCtrlXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxTreeCtrlXmlHandler) + +public: + wxTreeCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC && wxUSE_TREECTRL + +#endif // _WX_XH_TREE_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_treebk.h b/Externals/wxWidgets/include/wx/xrc/xh_treebk.h index bd6078a779..56de553660 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_treebk.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_treebk.h @@ -1,83 +1,83 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_treebk.h -// Purpose: XML resource handler for wxTreebook -// Author: Evgeniy Tarassov -// Created: 2005/09/28 -// Copyright: (c) 2005 TT-Solutions -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_TREEBK_H_ -#define _WX_XH_TREEBK_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_TREEBOOK - -class WXDLLIMPEXP_FWD_CORE wxTreebook; -#include "wx/dynarray.h" - -WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes, - class WXDLLIMPEXP_XRC); - -// --------------------------------------------------------------------- -// wxTreebookXmlHandler class -// --------------------------------------------------------------------- -// Resource xml structure have to be almost the "same" as for wxNotebook -// except the additional (size_t)depth parameter for treebookpage nodes -// which indicates the depth of the page in the tree. -// There is only one logical constraint on this parameter : -// it cannot be greater than the previous page depth plus one -class WXDLLIMPEXP_XRC wxTreebookXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxTreebookXmlHandler) - -public: - wxTreebookXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - wxTreebook *m_tbk; - wxArrayTbkPageIndexes m_treeContext; - bool m_isInside; -}; - - -// Example: -// ------- -// Label -// \--First -// | \--Second -// \--Third -// -// -// ... -// -// -// -// -// 0 -// -// -// -// -// 1 -// -// -// -// -// 2 -// -// -// -// -// 1 -// -// -// ... -// - -#endif // wxUSE_XRC && wxUSE_TREEBOOK - -#endif // _WX_XH_TREEBK_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_treebk.h +// Purpose: XML resource handler for wxTreebook +// Author: Evgeniy Tarassov +// Created: 2005/09/28 +// Copyright: (c) 2005 TT-Solutions +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TREEBK_H_ +#define _WX_XH_TREEBK_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TREEBOOK + +class WXDLLIMPEXP_FWD_CORE wxTreebook; +#include "wx/dynarray.h" + +WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes, + class WXDLLIMPEXP_XRC); + +// --------------------------------------------------------------------- +// wxTreebookXmlHandler class +// --------------------------------------------------------------------- +// Resource xml structure have to be almost the "same" as for wxNotebook +// except the additional (size_t)depth parameter for treebookpage nodes +// which indicates the depth of the page in the tree. +// There is only one logical constraint on this parameter : +// it cannot be greater than the previous page depth plus one +class WXDLLIMPEXP_XRC wxTreebookXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxTreebookXmlHandler) + +public: + wxTreebookXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + wxTreebook *m_tbk; + wxArrayTbkPageIndexes m_treeContext; + bool m_isInside; +}; + + +// Example: +// ------- +// Label +// \--First +// | \--Second +// \--Third +// +// +// ... +// +// +// +// +// 0 +// +// +// +// +// 1 +// +// +// +// +// 2 +// +// +// +// +// 1 +// +// +// ... +// + +#endif // wxUSE_XRC && wxUSE_TREEBOOK + +#endif // _WX_XH_TREEBK_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_unkwn.h b/Externals/wxWidgets/include/wx/xrc/xh_unkwn.h index 5759b751d6..de75475334 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_unkwn.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_unkwn.h @@ -1,30 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_unkwn.h -// Purpose: XML resource handler for unkown widget -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xh_unkwn.h 41590 2006-10-03 14:53:40Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_UNKWN_H_ -#define _WX_XH_UNKWN_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC - -class WXDLLIMPEXP_XRC wxUnknownWidgetXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxUnknownWidgetXmlHandler) - -public: - wxUnknownWidgetXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); -}; - -#endif // wxUSE_XRC - -#endif // _WX_XH_UNKWN_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_unkwn.h +// Purpose: XML resource handler for unkown widget +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xh_unkwn.h 41590 2006-10-03 14:53:40Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_UNKWN_H_ +#define _WX_XH_UNKWN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxUnknownWidgetXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxUnknownWidgetXmlHandler) + +public: + wxUnknownWidgetXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_UNKWN_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xh_wizrd.h b/Externals/wxWidgets/include/wx/xrc/xh_wizrd.h index 784a4d9e76..d753150a81 100644 --- a/Externals/wxWidgets/include/wx/xrc/xh_wizrd.h +++ b/Externals/wxWidgets/include/wx/xrc/xh_wizrd.h @@ -1,37 +1,37 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xh_wizrd.h -// Purpose: XML resource handler for wxWizard -// Author: Vaclav Slavik -// Created: 2003/03/02 -// RCS-ID: $Id: xh_wizrd.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XH_WIZRD_H_ -#define _WX_XH_WIZRD_H_ - -#include "wx/xrc/xmlres.h" - -#if wxUSE_XRC && wxUSE_WIZARDDLG - -class WXDLLIMPEXP_FWD_ADV wxWizard; -class WXDLLIMPEXP_FWD_ADV wxWizardPageSimple; - -class WXDLLIMPEXP_XRC wxWizardXmlHandler : public wxXmlResourceHandler -{ - DECLARE_DYNAMIC_CLASS(wxWizardXmlHandler) - -public: - wxWizardXmlHandler(); - virtual wxObject *DoCreateResource(); - virtual bool CanHandle(wxXmlNode *node); - -private: - wxWizard *m_wizard; - wxWizardPageSimple *m_lastSimplePage; -}; - -#endif // wxUSE_XRC && wxUSE_WIZARDDLG - -#endif // _WX_XH_WIZRD_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_wizrd.h +// Purpose: XML resource handler for wxWizard +// Author: Vaclav Slavik +// Created: 2003/03/02 +// RCS-ID: $Id: xh_wizrd.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_WIZRD_H_ +#define _WX_XH_WIZRD_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_WIZARDDLG + +class WXDLLIMPEXP_FWD_ADV wxWizard; +class WXDLLIMPEXP_FWD_ADV wxWizardPageSimple; + +class WXDLLIMPEXP_XRC wxWizardXmlHandler : public wxXmlResourceHandler +{ + DECLARE_DYNAMIC_CLASS(wxWizardXmlHandler) + +public: + wxWizardXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); + +private: + wxWizard *m_wizard; + wxWizardPageSimple *m_lastSimplePage; +}; + +#endif // wxUSE_XRC && wxUSE_WIZARDDLG + +#endif // _WX_XH_WIZRD_H_ diff --git a/Externals/wxWidgets/include/wx/xrc/xmlres.h b/Externals/wxWidgets/include/wx/xrc/xmlres.h index 77d792719b..381a0f653c 100644 --- a/Externals/wxWidgets/include/wx/xrc/xmlres.h +++ b/Externals/wxWidgets/include/wx/xrc/xmlres.h @@ -1,530 +1,530 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xrc/xmlres.h -// Purpose: XML resources -// Author: Vaclav Slavik -// Created: 2000/03/05 -// RCS-ID: $Id: xmlres.h 49563 2007-10-31 20:46:21Z VZ $ -// Copyright: (c) 2000 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XMLRES_H_ -#define _WX_XMLRES_H_ - -#include "wx/defs.h" - -#if wxUSE_XRC - -#include "wx/string.h" -#include "wx/dynarray.h" -#include "wx/datetime.h" -#include "wx/list.h" -#include "wx/gdicmn.h" -#include "wx/filesys.h" -#include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/artprov.h" -#include "wx/colour.h" -#include "wx/animate.h" - -#include "wx/xml/xml.h" - -class WXDLLIMPEXP_FWD_CORE wxMenu; -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxDialog; -class WXDLLIMPEXP_FWD_CORE wxPanel; -class WXDLLIMPEXP_FWD_CORE wxWindow; -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxToolBar; - -class WXDLLIMPEXP_FWD_XRC wxXmlResourceHandler; -class WXDLLIMPEXP_FWD_XRC wxXmlSubclassFactory; -class WXDLLIMPEXP_FWD_XRC wxXmlSubclassFactoriesList; -class wxXmlResourceModule; - - -// These macros indicate current version of XML resources (this information is -// encoded in root node of XRC file as "version" property). -// -// Rules for increasing version number: -// - change it only if you made incompatible change to the format. Addition -// of new attribute to control handler is _not_ incompatible change, because -// older versions of the library may ignore it. -// - if you change version number, follow these steps: -// - set major, minor and release numbers to respective version numbers of -// the wxWidgets library (see wx/version.h) -// - reset revision to 0 unless the first three are same as before, -// in which case you should increase revision by one -#define WX_XMLRES_CURRENT_VERSION_MAJOR 2 -#define WX_XMLRES_CURRENT_VERSION_MINOR 5 -#define WX_XMLRES_CURRENT_VERSION_RELEASE 3 -#define WX_XMLRES_CURRENT_VERSION_REVISION 0 -#define WX_XMLRES_CURRENT_VERSION_STRING _T("2.5.3.0") - -#define WX_XMLRES_CURRENT_VERSION \ - (WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \ - WX_XMLRES_CURRENT_VERSION_MINOR * 256*256 + \ - WX_XMLRES_CURRENT_VERSION_RELEASE * 256 + \ - WX_XMLRES_CURRENT_VERSION_REVISION) - -class WXDLLIMPEXP_XRC wxXmlResourceDataRecord -{ -public: - wxXmlResourceDataRecord() : Doc(NULL) { -#if wxUSE_DATETIME - Time = wxDateTime::Now(); -#endif - } - ~wxXmlResourceDataRecord() {delete Doc;} - - wxString File; - wxXmlDocument *Doc; -#if wxUSE_DATETIME - wxDateTime Time; -#endif -}; - - -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, - wxXmlResourceDataRecords, - WXDLLIMPEXP_XRC); - -enum wxXmlResourceFlags -{ - wxXRC_USE_LOCALE = 1, - wxXRC_NO_SUBCLASSING = 2, - wxXRC_NO_RELOADING = 4 -}; - -// This class holds XML resources from one or more .xml files -// (or derived forms, either binary or zipped -- see manual for -// details). -class WXDLLIMPEXP_XRC wxXmlResource : public wxObject -{ -public: - // Constructor. - // Flags: wxXRC_USE_LOCALE - // translatable strings will be translated via _() - // using the given domain if specified - // wxXRC_NO_SUBCLASSING - // subclass property of object nodes will be ignored - // (useful for previews in XRC editors) - // wxXRC_NO_RELOADING - // don't check the modification time of the XRC files and - // reload them if they have changed on disk - wxXmlResource(int flags = wxXRC_USE_LOCALE, - const wxString& domain=wxEmptyString); - - // Constructor. - // Flags: wxXRC_USE_LOCALE - // translatable strings will be translated via _() - // using the given domain if specified - // wxXRC_NO_SUBCLASSING - // subclass property of object nodes will be ignored - // (useful for previews in XRC editors) - wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE, - const wxString& domain=wxEmptyString); - - // Destructor. - virtual ~wxXmlResource(); - - wxXmlNode *GetFirstRoot(); - - // Loads resources from XML files that match given filemask. - // This method understands VFS (see filesys.h). - bool Load(const wxString& filemask); - - // Unload resource from the given XML file (wildcards not allowed) - bool Unload(const wxString& filename); - - // Initialize handlers for all supported controls/windows. This will - // make the executable quite big because it forces linking against - // most of the wxWidgets library. - void InitAllHandlers(); - - // Initialize only a specific handler (or custom handler). Convention says - // that handler name is equal to the control's name plus 'XmlHandler', for - // example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource - // compiler (xmlres) can create include file that contains initialization - // code for all controls used within the resource. - void AddHandler(wxXmlResourceHandler *handler); - - // Add a new handler at the begining of the handler list - void InsertHandler(wxXmlResourceHandler *handler); - - // Removes all handlers - void ClearHandlers(); - - // Registers subclasses factory for use in XRC. This function is not meant - // for public use, please see the comment above wxXmlSubclassFactory - // definition. - static void AddSubclassFactory(wxXmlSubclassFactory *factory); - - // Loads menu from resource. Returns NULL on failure. - wxMenu *LoadMenu(const wxString& name); - - // Loads menubar from resource. Returns NULL on failure. - wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name); - - // Loads menubar from resource. Returns NULL on failure. - wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(NULL, name); } - -#if wxUSE_TOOLBAR - // Loads a toolbar. - wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name); -#endif - - // Loads a dialog. dlg points to parent window (if any). - wxDialog *LoadDialog(wxWindow *parent, const wxString& name); - - // Loads a dialog. dlg points to parent window (if any). This form - // is used to finish creation of already existing instance (main reason - // for this is that you may want to use derived class with new event table) - // Example (typical usage): - // MyDialog dlg; - // wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); - // dlg->ShowModal(); - bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name); - - // Loads a panel. panel points to parent window (if any). - wxPanel *LoadPanel(wxWindow *parent, const wxString& name); - - // Loads a panel. panel points to parent window (if any). This form - // is used to finish creation of already existing instance. - bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name); - - // Loads a frame. - wxFrame *LoadFrame(wxWindow* parent, const wxString& name); - bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name); - - // Load an object from the resource specifying both the resource name and - // the classname. This lets you load nonstandard container windows. - wxObject *LoadObject(wxWindow *parent, const wxString& name, - const wxString& classname); - - // Load an object from the resource specifying both the resource name and - // the classname. This form lets you finish the creation of an existing - // instance. - bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name, - const wxString& classname); - - // Loads a bitmap resource from a file. - wxBitmap LoadBitmap(const wxString& name); - - // Loads an icon resource from a file. - wxIcon LoadIcon(const wxString& name); - - // Attaches an unknown control to the given panel/window/dialog. - // Unknown controls are used in conjunction with . - bool AttachUnknownControl(const wxString& name, wxWindow *control, - wxWindow *parent = NULL); - - // Returns a numeric ID that is equivalent to the string ID used in an XML - // resource. If an unknown str_id is requested (i.e. other than wxID_XXX - // or integer), a new record is created which associates the given string - // with a number. If value_if_not_found == wxID_NONE, the number is obtained via - // wxWindow::NewControlId(). Otherwise value_if_not_found is used. - // Macro XRCID(name) is provided for convenient use in event tables. - static int GetXRCID(const wxChar *str_id, int value_if_not_found = wxID_NONE); - - // Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a). - long GetVersion() const { return m_version; } - - // Compares resources version to argument. Returns -1 if resources version - // is less than the argument, +1 if greater and 0 if they equal. - int CompareVersion(int major, int minor, int release, int revision) const - { return GetVersion() - - (major*256*256*256 + minor*256*256 + release*256 + revision); } - -//// Singleton accessors. - - // Gets the global resources object or creates one if none exists. - static wxXmlResource *Get(); - - // Sets the global resources object and returns a pointer to the previous one (may be NULL). - static wxXmlResource *Set(wxXmlResource *res); - - // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING. - int GetFlags() const { return m_flags; } - // Set flags after construction. - void SetFlags(int flags) { m_flags = flags; } - - // Get/Set the domain to be passed to the translation functions, defaults to NULL. - wxChar* GetDomain() const { return m_domain; } - void SetDomain(const wxChar* domain); - -protected: - // Scans the resources list for unloaded files and loads them. Also reloads - // files that have been modified since last loading. - bool UpdateResources(); - - // Finds a resource (calls UpdateResources) and returns a node containing it. - wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = false); - - // Helper function: finds a resource (calls UpdateResources) and returns a node containing it. - wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive); - - // Creates a resource from information in the given node - // (Uses only 'handlerToUse' if != NULL) - wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, - wxObject *instance = NULL, - wxXmlResourceHandler *handlerToUse = NULL); - - // Helper of Load() and Unload(): returns the URL corresponding to the - // given file if it's indeed a file, otherwise returns the original string - // unmodified - static wxString ConvertFileNameToURL(const wxString& filename); - - // loading resources from archives is impossible without wxFileSystem -#if wxUSE_FILESYSTEM - // Another helper: detect if the filename is a ZIP or XRS file - static bool IsArchive(const wxString& filename); -#endif // wxUSE_FILESYSTEM - -private: - long m_version; - - int m_flags; - wxList m_handlers; - wxXmlResourceDataRecords m_data; -#if wxUSE_FILESYSTEM - wxFileSystem m_curFileSystem; - wxFileSystem& GetCurFileSystem() { return m_curFileSystem; } -#endif - - // domain to pass to translation functions, if any. - wxChar* m_domain; - - friend class wxXmlResourceHandler; - friend class wxXmlResourceModule; - - static wxXmlSubclassFactoriesList *ms_subclassFactories; - - // singleton instance: - static wxXmlResource *ms_instance; -}; - - -// This macro translates string identifier (as used in XML resource, -// e.g. ...) to integer id that is needed by -// wxWidgets event tables. -// Example: -// BEGIN_EVENT_TABLE(MyFrame, wxFrame) -// EVT_MENU(XRCID("quit"), MyFrame::OnQuit) -// EVT_MENU(XRCID("about"), MyFrame::OnAbout) -// EVT_MENU(XRCID("new"), MyFrame::OnNew) -// EVT_MENU(XRCID("open"), MyFrame::OnOpen) -// END_EVENT_TABLE() - -#define XRCID(str_id) \ - wxXmlResource::GetXRCID(wxT(str_id)) - - -// This macro returns pointer to particular control in dialog -// created using XML resources. You can use it to set/get values from -// controls. -// Example: -// wxDialog dlg; -// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog"); -// XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value")); - -#define XRCCTRL(window, id, type) \ - (wxStaticCast((window).FindWindow(XRCID(id)), type)) - -// wxXmlResourceHandler is an abstract base class for resource handlers -// capable of creating a control from an XML node. - -class WXDLLIMPEXP_XRC wxXmlResourceHandler : public wxObject -{ -DECLARE_ABSTRACT_CLASS(wxXmlResourceHandler) -public: - // Constructor. - wxXmlResourceHandler(); - - // Destructor. - virtual ~wxXmlResourceHandler() {} - - // Creates an object (menu, dialog, control, ...) from an XML node. - // Should check for validity. - // parent is a higher-level object (usually window, dialog or panel) - // that is often necessary to create the resource. - // If instance is non-NULL it should not create a new instance via 'new' but - // should rather use this one, and call its Create method. - wxObject *CreateResource(wxXmlNode *node, wxObject *parent, - wxObject *instance); - - // This one is called from CreateResource after variables - // were filled. - virtual wxObject *DoCreateResource() = 0; - - // Returns true if it understands this node and can create - // a resource from it, false otherwise. - virtual bool CanHandle(wxXmlNode *node) = 0; - - // Sets the parent resource. - void SetParentResource(wxXmlResource *res) { m_resource = res; } - -protected: - wxXmlResource *m_resource; - wxArrayString m_styleNames; - wxArrayInt m_styleValues; - - // Variables (filled by CreateResource) - wxXmlNode *m_node; - wxString m_class; - wxObject *m_parent, *m_instance; - wxWindow *m_parentAsWindow; - - // --- Handy methods: - - // Returns true if the node has a property class equal to classname, - // e.g. . - bool IsOfClass(wxXmlNode *node, const wxString& classname); - - // Gets node content from wxXML_ENTITY_NODE - // The problem is, content is represented as - // wxXML_ENTITY_NODE name="tag", content="" - // |-- wxXML_TEXT_NODE or - // wxXML_CDATA_SECTION_NODE name="" content="content" - wxString GetNodeContent(wxXmlNode *node); - - // Check to see if a parameter exists. - bool HasParam(const wxString& param); - - // Finds the node or returns NULL. - wxXmlNode *GetParamNode(const wxString& param); - - // Finds the parameter value or returns the empty string. - wxString GetParamValue(const wxString& param); - - // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags - // understood by this handler. - void AddStyle(const wxString& name, int value); - - // Add styles common to all wxWindow-derived classes. - void AddWindowStyles(); - - // Gets style flags from text in form "flag | flag2| flag3 |..." - // Only understands flags added with AddStyle - int GetStyle(const wxString& param = wxT("style"), int defaults = 0); - - // Gets text from param and does some conversions: - // - replaces \n, \r, \t by respective chars (according to C syntax) - // - replaces _ by & and __ by _ (needed for _File => &File because of XML) - // - calls wxGetTranslations (unless disabled in wxXmlResource) - wxString GetText(const wxString& param, bool translate = true); - - // Returns the XRCID. - int GetID(); - - // Returns the resource name. - wxString GetName(); - - // Gets a bool flag (1, t, yes, on, true are true, everything else is false). - bool GetBool(const wxString& param, bool defaultv = false); - - // Gets an integer value from the parameter. - long GetLong(const wxString& param, long defaultv = 0); - - // Gets a float value from the parameter. - float GetFloat(const wxString& param, float defaultv = 0); - - // Gets colour in HTML syntax (#RRGGBB). - wxColour GetColour(const wxString& param, const wxColour& defaultv = wxNullColour); - - // Gets the size (may be in dialog units). - wxSize GetSize(const wxString& param = wxT("size"), - wxWindow *windowToUse = NULL); - - // Gets the position (may be in dialog units). - wxPoint GetPosition(const wxString& param = wxT("pos")); - - // Gets a dimension (may be in dialog units). - wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, - wxWindow *windowToUse = NULL); - - // Gets a bitmap. - wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), - const wxArtClient& defaultArtClient = wxART_OTHER, - wxSize size = wxDefaultSize); - - // Gets an icon. - wxIcon GetIcon(const wxString& param = wxT("icon"), - const wxArtClient& defaultArtClient = wxART_OTHER, - wxSize size = wxDefaultSize); - -#if wxUSE_ANIMATIONCTRL - // Gets an animation. - wxAnimation GetAnimation(const wxString& param = wxT("animation")); -#endif - - // Gets a font. - wxFont GetFont(const wxString& param = wxT("font")); - - // Sets common window options. - void SetupWindow(wxWindow *wnd); - - // Creates children. - void CreateChildren(wxObject *parent, bool this_hnd_only = false); - - // Helper function. - void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL); - - // Creates a resource from a node. - wxObject *CreateResFromNode(wxXmlNode *node, - wxObject *parent, wxObject *instance = NULL) - { return m_resource->CreateResFromNode(node, parent, instance); } - - // helper -#if wxUSE_FILESYSTEM - wxFileSystem& GetCurFileSystem() { return m_resource->GetCurFileSystem(); } -#endif -}; - - -// Programmer-friendly macros for writing XRC handlers: - -#define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style) - -#define XRC_MAKE_INSTANCE(variable, classname) \ - classname *variable = NULL; \ - if (m_instance) \ - variable = wxStaticCast(m_instance, classname); \ - if (!variable) \ - variable = new classname; - - -// FIXME -- remove this $%^#$%#$@# as soon as Ron checks his changes in!! -WXDLLIMPEXP_XRC void wxXmlInitResourceModule(); - - -// This class is used to create instances of XRC "object" nodes with "subclass" -// property. It is _not_ supposed to be used by XRC users, you should instead -// register your subclasses via wxWidgets' RTTI mechanism. This class is useful -// only for language bindings developer who need a way to implement subclassing -// in wxWidgets ports that don't support wxRTTI (e.g. wxPython). -class WXDLLIMPEXP_XRC wxXmlSubclassFactory -{ -public: - // Try to create instance of given class and return it, return NULL on - // failure: - virtual wxObject *Create(const wxString& className) = 0; - virtual ~wxXmlSubclassFactory() {} -}; - - -/* ------------------------------------------------------------------------- - Backward compatibility macros. Do *NOT* use, they may disappear in future - versions of the XRC library! - ------------------------------------------------------------------------- */ -#if WXWIN_COMPATIBILITY_2_4 - #define ADD_STYLE XRC_ADD_STYLE - #define wxTheXmlResource wxXmlResource::Get() - #define XMLID XRCID - #define XMLCTRL XRCCTRL - #define GetXMLID GetXRCID -#endif - -#endif // wxUSE_XRC - -#endif // _WX_XMLRES_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xmlres.h +// Purpose: XML resources +// Author: Vaclav Slavik +// Created: 2000/03/05 +// RCS-ID: $Id: xmlres.h 49563 2007-10-31 20:46:21Z VZ $ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XMLRES_H_ +#define _WX_XMLRES_H_ + +#include "wx/defs.h" + +#if wxUSE_XRC + +#include "wx/string.h" +#include "wx/dynarray.h" +#include "wx/datetime.h" +#include "wx/list.h" +#include "wx/gdicmn.h" +#include "wx/filesys.h" +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/artprov.h" +#include "wx/colour.h" +#include "wx/animate.h" + +#include "wx/xml/xml.h" + +class WXDLLIMPEXP_FWD_CORE wxMenu; +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxDialog; +class WXDLLIMPEXP_FWD_CORE wxPanel; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxToolBar; + +class WXDLLIMPEXP_FWD_XRC wxXmlResourceHandler; +class WXDLLIMPEXP_FWD_XRC wxXmlSubclassFactory; +class WXDLLIMPEXP_FWD_XRC wxXmlSubclassFactoriesList; +class wxXmlResourceModule; + + +// These macros indicate current version of XML resources (this information is +// encoded in root node of XRC file as "version" property). +// +// Rules for increasing version number: +// - change it only if you made incompatible change to the format. Addition +// of new attribute to control handler is _not_ incompatible change, because +// older versions of the library may ignore it. +// - if you change version number, follow these steps: +// - set major, minor and release numbers to respective version numbers of +// the wxWidgets library (see wx/version.h) +// - reset revision to 0 unless the first three are same as before, +// in which case you should increase revision by one +#define WX_XMLRES_CURRENT_VERSION_MAJOR 2 +#define WX_XMLRES_CURRENT_VERSION_MINOR 5 +#define WX_XMLRES_CURRENT_VERSION_RELEASE 3 +#define WX_XMLRES_CURRENT_VERSION_REVISION 0 +#define WX_XMLRES_CURRENT_VERSION_STRING _T("2.5.3.0") + +#define WX_XMLRES_CURRENT_VERSION \ + (WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \ + WX_XMLRES_CURRENT_VERSION_MINOR * 256*256 + \ + WX_XMLRES_CURRENT_VERSION_RELEASE * 256 + \ + WX_XMLRES_CURRENT_VERSION_REVISION) + +class WXDLLIMPEXP_XRC wxXmlResourceDataRecord +{ +public: + wxXmlResourceDataRecord() : Doc(NULL) { +#if wxUSE_DATETIME + Time = wxDateTime::Now(); +#endif + } + ~wxXmlResourceDataRecord() {delete Doc;} + + wxString File; + wxXmlDocument *Doc; +#if wxUSE_DATETIME + wxDateTime Time; +#endif +}; + + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, + wxXmlResourceDataRecords, + WXDLLIMPEXP_XRC); + +enum wxXmlResourceFlags +{ + wxXRC_USE_LOCALE = 1, + wxXRC_NO_SUBCLASSING = 2, + wxXRC_NO_RELOADING = 4 +}; + +// This class holds XML resources from one or more .xml files +// (or derived forms, either binary or zipped -- see manual for +// details). +class WXDLLIMPEXP_XRC wxXmlResource : public wxObject +{ +public: + // Constructor. + // Flags: wxXRC_USE_LOCALE + // translatable strings will be translated via _() + // using the given domain if specified + // wxXRC_NO_SUBCLASSING + // subclass property of object nodes will be ignored + // (useful for previews in XRC editors) + // wxXRC_NO_RELOADING + // don't check the modification time of the XRC files and + // reload them if they have changed on disk + wxXmlResource(int flags = wxXRC_USE_LOCALE, + const wxString& domain=wxEmptyString); + + // Constructor. + // Flags: wxXRC_USE_LOCALE + // translatable strings will be translated via _() + // using the given domain if specified + // wxXRC_NO_SUBCLASSING + // subclass property of object nodes will be ignored + // (useful for previews in XRC editors) + wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE, + const wxString& domain=wxEmptyString); + + // Destructor. + virtual ~wxXmlResource(); + + wxXmlNode *GetFirstRoot(); + + // Loads resources from XML files that match given filemask. + // This method understands VFS (see filesys.h). + bool Load(const wxString& filemask); + + // Unload resource from the given XML file (wildcards not allowed) + bool Unload(const wxString& filename); + + // Initialize handlers for all supported controls/windows. This will + // make the executable quite big because it forces linking against + // most of the wxWidgets library. + void InitAllHandlers(); + + // Initialize only a specific handler (or custom handler). Convention says + // that handler name is equal to the control's name plus 'XmlHandler', for + // example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource + // compiler (xmlres) can create include file that contains initialization + // code for all controls used within the resource. + void AddHandler(wxXmlResourceHandler *handler); + + // Add a new handler at the begining of the handler list + void InsertHandler(wxXmlResourceHandler *handler); + + // Removes all handlers + void ClearHandlers(); + + // Registers subclasses factory for use in XRC. This function is not meant + // for public use, please see the comment above wxXmlSubclassFactory + // definition. + static void AddSubclassFactory(wxXmlSubclassFactory *factory); + + // Loads menu from resource. Returns NULL on failure. + wxMenu *LoadMenu(const wxString& name); + + // Loads menubar from resource. Returns NULL on failure. + wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name); + + // Loads menubar from resource. Returns NULL on failure. + wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(NULL, name); } + +#if wxUSE_TOOLBAR + // Loads a toolbar. + wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name); +#endif + + // Loads a dialog. dlg points to parent window (if any). + wxDialog *LoadDialog(wxWindow *parent, const wxString& name); + + // Loads a dialog. dlg points to parent window (if any). This form + // is used to finish creation of already existing instance (main reason + // for this is that you may want to use derived class with new event table) + // Example (typical usage): + // MyDialog dlg; + // wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); + // dlg->ShowModal(); + bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name); + + // Loads a panel. panel points to parent window (if any). + wxPanel *LoadPanel(wxWindow *parent, const wxString& name); + + // Loads a panel. panel points to parent window (if any). This form + // is used to finish creation of already existing instance. + bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name); + + // Loads a frame. + wxFrame *LoadFrame(wxWindow* parent, const wxString& name); + bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name); + + // Load an object from the resource specifying both the resource name and + // the classname. This lets you load nonstandard container windows. + wxObject *LoadObject(wxWindow *parent, const wxString& name, + const wxString& classname); + + // Load an object from the resource specifying both the resource name and + // the classname. This form lets you finish the creation of an existing + // instance. + bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name, + const wxString& classname); + + // Loads a bitmap resource from a file. + wxBitmap LoadBitmap(const wxString& name); + + // Loads an icon resource from a file. + wxIcon LoadIcon(const wxString& name); + + // Attaches an unknown control to the given panel/window/dialog. + // Unknown controls are used in conjunction with . + bool AttachUnknownControl(const wxString& name, wxWindow *control, + wxWindow *parent = NULL); + + // Returns a numeric ID that is equivalent to the string ID used in an XML + // resource. If an unknown str_id is requested (i.e. other than wxID_XXX + // or integer), a new record is created which associates the given string + // with a number. If value_if_not_found == wxID_NONE, the number is obtained via + // wxWindow::NewControlId(). Otherwise value_if_not_found is used. + // Macro XRCID(name) is provided for convenient use in event tables. + static int GetXRCID(const wxChar *str_id, int value_if_not_found = wxID_NONE); + + // Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a). + long GetVersion() const { return m_version; } + + // Compares resources version to argument. Returns -1 if resources version + // is less than the argument, +1 if greater and 0 if they equal. + int CompareVersion(int major, int minor, int release, int revision) const + { return GetVersion() - + (major*256*256*256 + minor*256*256 + release*256 + revision); } + +//// Singleton accessors. + + // Gets the global resources object or creates one if none exists. + static wxXmlResource *Get(); + + // Sets the global resources object and returns a pointer to the previous one (may be NULL). + static wxXmlResource *Set(wxXmlResource *res); + + // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING. + int GetFlags() const { return m_flags; } + // Set flags after construction. + void SetFlags(int flags) { m_flags = flags; } + + // Get/Set the domain to be passed to the translation functions, defaults to NULL. + wxChar* GetDomain() const { return m_domain; } + void SetDomain(const wxChar* domain); + +protected: + // Scans the resources list for unloaded files and loads them. Also reloads + // files that have been modified since last loading. + bool UpdateResources(); + + // Finds a resource (calls UpdateResources) and returns a node containing it. + wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = false); + + // Helper function: finds a resource (calls UpdateResources) and returns a node containing it. + wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive); + + // Creates a resource from information in the given node + // (Uses only 'handlerToUse' if != NULL) + wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, + wxObject *instance = NULL, + wxXmlResourceHandler *handlerToUse = NULL); + + // Helper of Load() and Unload(): returns the URL corresponding to the + // given file if it's indeed a file, otherwise returns the original string + // unmodified + static wxString ConvertFileNameToURL(const wxString& filename); + + // loading resources from archives is impossible without wxFileSystem +#if wxUSE_FILESYSTEM + // Another helper: detect if the filename is a ZIP or XRS file + static bool IsArchive(const wxString& filename); +#endif // wxUSE_FILESYSTEM + +private: + long m_version; + + int m_flags; + wxList m_handlers; + wxXmlResourceDataRecords m_data; +#if wxUSE_FILESYSTEM + wxFileSystem m_curFileSystem; + wxFileSystem& GetCurFileSystem() { return m_curFileSystem; } +#endif + + // domain to pass to translation functions, if any. + wxChar* m_domain; + + friend class wxXmlResourceHandler; + friend class wxXmlResourceModule; + + static wxXmlSubclassFactoriesList *ms_subclassFactories; + + // singleton instance: + static wxXmlResource *ms_instance; +}; + + +// This macro translates string identifier (as used in XML resource, +// e.g. ...) to integer id that is needed by +// wxWidgets event tables. +// Example: +// BEGIN_EVENT_TABLE(MyFrame, wxFrame) +// EVT_MENU(XRCID("quit"), MyFrame::OnQuit) +// EVT_MENU(XRCID("about"), MyFrame::OnAbout) +// EVT_MENU(XRCID("new"), MyFrame::OnNew) +// EVT_MENU(XRCID("open"), MyFrame::OnOpen) +// END_EVENT_TABLE() + +#define XRCID(str_id) \ + wxXmlResource::GetXRCID(wxT(str_id)) + + +// This macro returns pointer to particular control in dialog +// created using XML resources. You can use it to set/get values from +// controls. +// Example: +// wxDialog dlg; +// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog"); +// XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value")); + +#define XRCCTRL(window, id, type) \ + (wxStaticCast((window).FindWindow(XRCID(id)), type)) + +// wxXmlResourceHandler is an abstract base class for resource handlers +// capable of creating a control from an XML node. + +class WXDLLIMPEXP_XRC wxXmlResourceHandler : public wxObject +{ +DECLARE_ABSTRACT_CLASS(wxXmlResourceHandler) +public: + // Constructor. + wxXmlResourceHandler(); + + // Destructor. + virtual ~wxXmlResourceHandler() {} + + // Creates an object (menu, dialog, control, ...) from an XML node. + // Should check for validity. + // parent is a higher-level object (usually window, dialog or panel) + // that is often necessary to create the resource. + // If instance is non-NULL it should not create a new instance via 'new' but + // should rather use this one, and call its Create method. + wxObject *CreateResource(wxXmlNode *node, wxObject *parent, + wxObject *instance); + + // This one is called from CreateResource after variables + // were filled. + virtual wxObject *DoCreateResource() = 0; + + // Returns true if it understands this node and can create + // a resource from it, false otherwise. + virtual bool CanHandle(wxXmlNode *node) = 0; + + // Sets the parent resource. + void SetParentResource(wxXmlResource *res) { m_resource = res; } + +protected: + wxXmlResource *m_resource; + wxArrayString m_styleNames; + wxArrayInt m_styleValues; + + // Variables (filled by CreateResource) + wxXmlNode *m_node; + wxString m_class; + wxObject *m_parent, *m_instance; + wxWindow *m_parentAsWindow; + + // --- Handy methods: + + // Returns true if the node has a property class equal to classname, + // e.g. . + bool IsOfClass(wxXmlNode *node, const wxString& classname); + + // Gets node content from wxXML_ENTITY_NODE + // The problem is, content is represented as + // wxXML_ENTITY_NODE name="tag", content="" + // |-- wxXML_TEXT_NODE or + // wxXML_CDATA_SECTION_NODE name="" content="content" + wxString GetNodeContent(wxXmlNode *node); + + // Check to see if a parameter exists. + bool HasParam(const wxString& param); + + // Finds the node or returns NULL. + wxXmlNode *GetParamNode(const wxString& param); + + // Finds the parameter value or returns the empty string. + wxString GetParamValue(const wxString& param); + + // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags + // understood by this handler. + void AddStyle(const wxString& name, int value); + + // Add styles common to all wxWindow-derived classes. + void AddWindowStyles(); + + // Gets style flags from text in form "flag | flag2| flag3 |..." + // Only understands flags added with AddStyle + int GetStyle(const wxString& param = wxT("style"), int defaults = 0); + + // Gets text from param and does some conversions: + // - replaces \n, \r, \t by respective chars (according to C syntax) + // - replaces _ by & and __ by _ (needed for _File => &File because of XML) + // - calls wxGetTranslations (unless disabled in wxXmlResource) + wxString GetText(const wxString& param, bool translate = true); + + // Returns the XRCID. + int GetID(); + + // Returns the resource name. + wxString GetName(); + + // Gets a bool flag (1, t, yes, on, true are true, everything else is false). + bool GetBool(const wxString& param, bool defaultv = false); + + // Gets an integer value from the parameter. + long GetLong(const wxString& param, long defaultv = 0); + + // Gets a float value from the parameter. + float GetFloat(const wxString& param, float defaultv = 0); + + // Gets colour in HTML syntax (#RRGGBB). + wxColour GetColour(const wxString& param, const wxColour& defaultv = wxNullColour); + + // Gets the size (may be in dialog units). + wxSize GetSize(const wxString& param = wxT("size"), + wxWindow *windowToUse = NULL); + + // Gets the position (may be in dialog units). + wxPoint GetPosition(const wxString& param = wxT("pos")); + + // Gets a dimension (may be in dialog units). + wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, + wxWindow *windowToUse = NULL); + + // Gets a bitmap. + wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxART_OTHER, + wxSize size = wxDefaultSize); + + // Gets an icon. + wxIcon GetIcon(const wxString& param = wxT("icon"), + const wxArtClient& defaultArtClient = wxART_OTHER, + wxSize size = wxDefaultSize); + +#if wxUSE_ANIMATIONCTRL + // Gets an animation. + wxAnimation GetAnimation(const wxString& param = wxT("animation")); +#endif + + // Gets a font. + wxFont GetFont(const wxString& param = wxT("font")); + + // Sets common window options. + void SetupWindow(wxWindow *wnd); + + // Creates children. + void CreateChildren(wxObject *parent, bool this_hnd_only = false); + + // Helper function. + void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL); + + // Creates a resource from a node. + wxObject *CreateResFromNode(wxXmlNode *node, + wxObject *parent, wxObject *instance = NULL) + { return m_resource->CreateResFromNode(node, parent, instance); } + + // helper +#if wxUSE_FILESYSTEM + wxFileSystem& GetCurFileSystem() { return m_resource->GetCurFileSystem(); } +#endif +}; + + +// Programmer-friendly macros for writing XRC handlers: + +#define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style) + +#define XRC_MAKE_INSTANCE(variable, classname) \ + classname *variable = NULL; \ + if (m_instance) \ + variable = wxStaticCast(m_instance, classname); \ + if (!variable) \ + variable = new classname; + + +// FIXME -- remove this $%^#$%#$@# as soon as Ron checks his changes in!! +WXDLLIMPEXP_XRC void wxXmlInitResourceModule(); + + +// This class is used to create instances of XRC "object" nodes with "subclass" +// property. It is _not_ supposed to be used by XRC users, you should instead +// register your subclasses via wxWidgets' RTTI mechanism. This class is useful +// only for language bindings developer who need a way to implement subclassing +// in wxWidgets ports that don't support wxRTTI (e.g. wxPython). +class WXDLLIMPEXP_XRC wxXmlSubclassFactory +{ +public: + // Try to create instance of given class and return it, return NULL on + // failure: + virtual wxObject *Create(const wxString& className) = 0; + virtual ~wxXmlSubclassFactory() {} +}; + + +/* ------------------------------------------------------------------------- + Backward compatibility macros. Do *NOT* use, they may disappear in future + versions of the XRC library! + ------------------------------------------------------------------------- */ +#if WXWIN_COMPATIBILITY_2_4 + #define ADD_STYLE XRC_ADD_STYLE + #define wxTheXmlResource wxXmlResource::Get() + #define XMLID XRCID + #define XMLCTRL XRCCTRL + #define GetXMLID GetXRCID +#endif + +#endif // wxUSE_XRC + +#endif // _WX_XMLRES_H_ diff --git a/Externals/wxWidgets/include/wx/xti.h b/Externals/wxWidgets/include/wx/xti.h index 5fd35efb48..b35d093ee3 100644 --- a/Externals/wxWidgets/include/wx/xti.h +++ b/Externals/wxWidgets/include/wx/xti.h @@ -1,2102 +1,2102 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xti.h -// Purpose: runtime metadata information (extended class info) -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: xti.h 52488 2008-03-14 14:13:05Z JS $ -// Copyright: (c) 1997 Julian Smart -// (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XTIH__ -#define _WX_XTIH__ - -// We want to support properties, event sources and events sinks through -// explicit declarations, using templates and specialization to make the -// effort as painless as possible. -// -// This means we have the following domains : -// -// - Type Information for categorizing built in types as well as custom types -// this includes information about enums, their values and names -// - Type safe value storage : a kind of wxVariant, called right now wxxVariant -// which will be merged with wxVariant -// - Property Information and Property Accessors providing access to a class' -// values and exposed event delegates -// - Information about event handlers -// - extended Class Information for accessing all these - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/memory.h" -#include "wx/flags.h" -#include "wx/string.h" -#include "wx/arrstr.h" -#include "wx/hashmap.h" -#include "wx/log.h" -#include "wx/intl.h" - -#include - -// we will move this later to defs.h - -#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3 , 4 ) -# define wxUSE_MEMBER_TEMPLATES 0 -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 -# define wxUSE_MEMBER_TEMPLATES 0 -# define wxUSE_FUNC_TEMPLATE_POINTER 0 -#endif - -#ifndef wxUSE_MEMBER_TEMPLATES -# define wxUSE_MEMBER_TEMPLATES 1 -#endif - -#ifndef wxUSE_FUNC_TEMPLATE_POINTER -# define wxUSE_FUNC_TEMPLATE_POINTER 1 -#endif - -#if wxUSE_MEMBER_TEMPLATES -# define wxTEMPLATED_MEMBER_CALL( method , type ) method() -# define wxTEMPLATED_MEMBER_FIX( type ) -#else -# define wxTEMPLATED_MEMBER_CALL( method , type ) method((type*)NULL) -# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 -# define wxTEMPLATED_FUNCTION_FIX( type ) , wxTEMPLATED_MEMBER_FIX(type) -# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type; -#else -# define wxTEMPLATED_FUNCTION_FIX( type ) -# define wxINFUNC_CLASS_TYPE_FIX( type ) -#endif - -#define EMPTY_MACROVALUE /**/ - -class WXDLLIMPEXP_BASE wxObject; -class WXDLLIMPEXP_BASE wxClassInfo; -class WXDLLIMPEXP_BASE wxDynamicClassInfo; -class WXDLLIMPEXP_BASE wxHashTable; -class WXDLLIMPEXP_BASE wxObjectRefData; -class WXDLLIMPEXP_BASE wxEvent; -class WXDLLIMPEXP_BASE wxEvtHandler; - -typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); - -#if wxUSE_FUNC_TEMPLATE_POINTER -# define wxTO_STRING(type) wxToStringConverter -# define wxTO_STRING_IMP(type) -# define wxFROM_STRING(type) wxFromStringConverter -# define wxFROM_STRING_IMP(type) -#else -# define wxTO_STRING(type) ToString##type -# define wxTO_STRING_IMP(type) inline void ToString##type( const wxxVariant& data , wxString &result ) { wxToStringConverter(data, result); } -# define wxFROM_STRING(type) FromString##type -# define wxFROM_STRING_IMP(type) inline void FromString##type( const wxString& data , wxxVariant &result ) { wxFromStringConverter(data, result); } -#endif - -// ---------------------------------------------------------------------------- -// Enum Support -// -// In the header files there would no change from pure c++ code, in the -// implementation, an enum would have -// to be enumerated eg : -// -// wxBEGIN_ENUM( wxFlavor ) -// wxENUM_MEMBER( Vanilla ) -// wxENUM_MEMBER( Chocolate ) -// wxENUM_MEMBER( Strawberry ) -// wxEND_ENUM( wxFlavor ) -// ---------------------------------------------------------------------------- - -struct WXDLLIMPEXP_BASE wxEnumMemberData -{ - const wxChar* m_name; - int m_value; -}; - -class WXDLLIMPEXP_BASE wxEnumData -{ -public : - wxEnumData( wxEnumMemberData* data ) ; - - // returns true if the member has been found and sets the int value - // pointed to accordingly (if ptr != null ) - // if not found returns false, value left unchanged - bool HasEnumMemberValue( const wxChar *name , int *value = NULL ) const ; - - // returns the value of the member, if not found in debug mode an - // assert is issued, in release 0 is returned - int GetEnumMemberValue(const wxChar *name ) const ; - - // returns the name of the enum member having the passed in value - // returns an emtpy string if not found - const wxChar *GetEnumMemberName(int value) const ; - - // returns the number of members in this enum - int GetEnumCount() const { return m_count ; } - - // returns the value of the nth member - int GetEnumMemberValueByIndex( int n ) const ; - - // returns the value of the nth member - const wxChar *GetEnumMemberNameByIndex( int n ) const ; -private : - wxEnumMemberData *m_members; - int m_count ; -}; - -#define wxBEGIN_ENUM( e ) \ - wxEnumMemberData s_enumDataMembers##e[] = { - -#define wxENUM_MEMBER( v ) { wxT(#v), v } , - -#define wxEND_ENUM( e ) { NULL , 0 } } ; \ - wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ - wxEnumData *wxGetEnumData(e) { return &s_enumData##e ; } \ - template<> void wxStringReadValue(const wxString& s , e &data ) \ -{ \ - data = (e) s_enumData##e.GetEnumMemberValue(s) ; \ -} \ - template<> void wxStringWriteValue(wxString &s , const e &data ) \ -{ \ - s = s_enumData##e.GetEnumMemberName((int)data) ; \ -} \ - void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant((e)data) ;} \ - void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e) ;} \ - wxTO_STRING_IMP( e ) \ - wxFROM_STRING_IMP( e ) \ - wxEnumTypeInfo s_typeInfo##e(wxT_ENUM , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e , typeid(e).name() ) ; - -// ---------------------------------------------------------------------------- -// Set Support -// -// in the header : -// -// enum wxFlavor -// { -// Vanilla, -// Chocolate, -// Strawberry, -// }; -// -// typedef wxBitset wxCoupe ; -// -// in the implementation file : -// -// wxBEGIN_ENUM( wxFlavor ) -// wxENUM_MEMBER( Vanilla ) -// wxENUM_MEMBER( Chocolate ) -// wxENUM_MEMBER( Strawberry ) -// wxEND_ENUM( wxFlavor ) -// -// wxIMPLEMENT_SET_STREAMING( wxCoupe , wxFlavor ) -// -// implementation note : no partial specialization for streaming, but a delegation to a -// different class -// -// ---------------------------------------------------------------------------- - -// in order to remove dependancy on string tokenizer -void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s , wxArrayString &array ) ; - -template -void wxSetFromString(const wxString &s , wxBitset &data ) -{ - wxEnumData* edata = wxGetEnumData((e) 0) ; - data.reset() ; - - wxArrayString array ; - wxSetStringToArray( s , array ) ; - wxString flag; - for ( int i = 0 ; i < array.Count() ; ++i ) - { - flag = array[i] ; - int ivalue ; - if ( edata->HasEnumMemberValue( flag , &ivalue ) ) - { - data.set( (e) ivalue ) ; - } - } -} - -template -void wxSetToString( wxString &s , const wxBitset &data ) -{ - wxEnumData* edata = wxGetEnumData((e) 0) ; - int count = edata->GetEnumCount() ; - int i ; - s.Clear() ; - for ( i = 0 ; i < count ; i++ ) - { - e value = (e) edata->GetEnumMemberValueByIndex(i) ; - if ( data.test( value ) ) - { - // this could also be done by the templated calls - if ( !s.empty() ) - s +=wxT("|") ; - s += edata->GetEnumMemberNameByIndex(i) ; - } - } -} - -#define wxIMPLEMENT_SET_STREAMING(SetName,e) \ - template<> void wxStringReadValue(const wxString &s , wxBitset &data ) \ -{ \ - wxSetFromString( s , data ) ; \ -} \ - template<> void wxStringWriteValue( wxString &s , const wxBitset &data ) \ -{ \ - wxSetToString( s , data ) ; \ -} \ - void FromLong##SetName( long data , wxxVariant& result ) { result = wxxVariant(SetName((unsigned long)data)) ;} \ - void ToLong##SetName( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , SetName).to_ulong() ;} \ - wxTO_STRING_IMP( SetName ) \ - wxFROM_STRING_IMP( SetName ) \ - wxEnumTypeInfo s_typeInfo##SetName(wxT_SET , &s_enumData##e , &wxTO_STRING( SetName ) , &wxFROM_STRING( SetName ) , &ToLong##SetName , &FromLong##SetName, typeid(SetName).name() ) ; \ -} - -template -void wxFlagsFromString(const wxString &s , e &data ) -{ - wxEnumData* edata = wxGetEnumData((e*) 0) ; - data.m_data = 0 ; - - wxArrayString array ; - wxSetStringToArray( s , array ) ; - wxString flag; - for ( size_t i = 0 ; i < array.Count() ; ++i ) - { - flag = array[i] ; - int ivalue ; - if ( edata->HasEnumMemberValue( flag , &ivalue ) ) - { - data.m_data |= ivalue ; - } - } -} - -template -void wxFlagsToString( wxString &s , const e& data ) -{ - wxEnumData* edata = wxGetEnumData((e*) 0) ; - int count = edata->GetEnumCount() ; - int i ; - s.Clear() ; - long dataValue = data.m_data ; - for ( i = 0 ; i < count ; i++ ) - { - int value = edata->GetEnumMemberValueByIndex(i) ; - // make this to allow for multi-bit constants to work - if ( value && ( dataValue & value ) == value ) - { - // clear the flags we just set - dataValue &= ~value ; - // this could also be done by the templated calls - if ( !s.empty() ) - s +=wxT("|") ; - s += edata->GetEnumMemberNameByIndex(i) ; - } - } -} - -#define wxBEGIN_FLAGS( e ) \ - wxEnumMemberData s_enumDataMembers##e[] = { - -#define wxFLAGS_MEMBER( v ) { wxT(#v), v } , - -#define wxEND_FLAGS( e ) { NULL , 0 } } ; \ - wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ - wxEnumData *wxGetEnumData(e*) { return &s_enumData##e ; } \ - template<> void wxStringReadValue(const wxString &s , e &data ) \ -{ \ - wxFlagsFromString( s , data ) ; \ -} \ - template<> void wxStringWriteValue( wxString &s , const e& data ) \ -{ \ - wxFlagsToString( s , data ) ; \ -} \ - void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant(e(data)) ;} \ - void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e).m_data ;} \ - wxTO_STRING_IMP( e ) \ - wxFROM_STRING_IMP( e ) \ - wxEnumTypeInfo s_typeInfo##e(wxT_SET , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e, typeid(e).name() ) ; -// ---------------------------------------------------------------------------- -// Type Information -// ---------------------------------------------------------------------------- -// -// -// All data exposed by the RTTI is characterized using the following classes. -// The first characterization is done by wxTypeKind. All enums up to and including -// wxT_CUSTOM represent so called simple types. These cannot be divided any further. -// They can be converted to and from wxStrings, that's all. - - -enum wxTypeKind -{ - wxT_VOID = 0, // unknown type - wxT_BOOL, - wxT_CHAR, - wxT_UCHAR, - wxT_INT, - wxT_UINT, - wxT_LONG, - wxT_ULONG, - wxT_FLOAT, - wxT_DOUBLE, - wxT_STRING, // must be wxString - wxT_SET, // must be wxBitset<> template - wxT_ENUM, - wxT_CUSTOM, // user defined type (e.g. wxPoint) - - wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM , - - wxT_OBJECT_PTR, // object reference - wxT_OBJECT , // embedded object - wxT_COLLECTION , // collection - - wxT_DELEGATE , // for connecting against an event source - - wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging -}; - -class WXDLLIMPEXP_BASE wxxVariant ; -class WXDLLIMPEXP_BASE wxTypeInfo ; - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo* , wxTypeInfoMap , class WXDLLIMPEXP_BASE ) ; - -class WXDLLIMPEXP_BASE wxTypeInfo -{ -public : - typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ; - typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ; - - wxTypeInfo(wxTypeKind kind, - converterToString_t to = NULL, converterFromString_t from = NULL, - const wxString &name = wxEmptyString): - m_toString(to), m_fromString(from), m_kind(kind), m_name(name) - { - Register(); - } -#if wxUSE_UNICODE - wxTypeInfo(wxTypeKind kind, - converterToString_t to, converterFromString_t from, - const char *name): - m_toString(to), m_fromString(from), m_kind(kind), m_name(wxString::FromAscii(name)) - { - Register(); - } -#endif - - virtual ~wxTypeInfo() - { - Unregister() ; - } - - // return the kind of this type (wxT_... constants) - wxTypeKind GetKind() const { return m_kind ; } - - // returns the unique name of this type - const wxString& GetTypeName() const { return m_name ; } - - // is this type a delegate type - bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; } - - // is this type a custom type - bool IsCustomType() const { return m_kind == wxT_CUSTOM ; } - - // is this type an object type - bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; } - - // can the content of this type be converted to and from strings ? - bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; } - - // convert a wxxVariant holding data of this type into a string - void ConvertToString( const wxxVariant& data , wxString &result ) const - - { if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } - - // convert a string into a wxxVariant holding the corresponding data in this type - void ConvertFromString( const wxString& data , wxxVariant &result ) const - { if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } - -#if wxUSE_UNICODE - static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; } -#endif - static wxTypeInfo *FindType(const wxChar *typeName); - -private : - - void Register(); - void Unregister(); - - converterToString_t m_toString ; - converterFromString_t m_fromString ; - - static wxTypeInfoMap* ms_typeTable ; - - wxTypeKind m_kind; - wxString m_name; -}; - -class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo -{ -public : - wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString ) : - wxTypeInfo( kind , to , from , name ) - { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } -#if wxUSE_UNICODE - wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to , converterFromString_t from , const char *name ) : - wxTypeInfo( kind , to , from , name ) - { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } -#endif -} ; - -class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo -{ -public : - wxCustomTypeInfo( const wxString &name , converterToString_t to , converterFromString_t from ) : - wxTypeInfo( wxT_CUSTOM , to , from , name ) - {} -#if wxUSE_UNICODE - wxCustomTypeInfo( const char *name , converterToString_t to , converterFromString_t from ) : - wxTypeInfo( wxT_CUSTOM , to , from , name ) - {} -#endif -} ; - -class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo -{ -public : - typedef void (*converterToLong_t)( const wxxVariant& data , long &result ) ; - typedef void (*converterFromLong_t)( long data , wxxVariant &result ) ; - - wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , - converterToLong_t toLong , converterFromLong_t fromLong , const wxString &name ) : - wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) - { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} - -#if wxUSE_UNICODE - wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , - converterToLong_t toLong , converterFromLong_t fromLong , const char * name ) : - wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) - { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} -#endif - const wxEnumData* GetEnumData() const { return m_enumInfo ; } - - // convert a wxxVariant holding data of this type into a long - void ConvertToLong( const wxxVariant& data , long &result ) const - - { if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ; } - - // convert a long into a wxxVariant holding the corresponding data in this type - void ConvertFromLong( long data , wxxVariant &result ) const - { if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ;} - -private : - converterToLong_t m_toLong ; - converterFromLong_t m_fromLong ; - - wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET -} ; - -class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo -{ -public : - wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString) ; -#if wxUSE_UNICODE - wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name ) ; -#endif - const wxClassInfo *GetClassInfo() const { return m_classInfo ; } -private : - wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL -} ; - -class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo -{ -public : - wxCollectionTypeInfo( const wxString &elementName , converterToString_t to , converterFromString_t from , const wxString &name) : - wxTypeInfo( wxT_COLLECTION , to , from , name ) - { m_elementTypeName = elementName ; m_elementType = NULL ;} -#if wxUSE_UNICODE - wxCollectionTypeInfo( const char *elementName , converterToString_t to , converterFromString_t from , const char *name ) : - wxTypeInfo( wxT_COLLECTION , to , from , name ) - { m_elementTypeName = wxString::FromAscii( elementName ) ; m_elementType = NULL ;} -#endif - const wxTypeInfo* GetElementType() const - { - if ( m_elementType == NULL ) - m_elementType = wxTypeInfo::FindType( m_elementTypeName ) ; - return m_elementType ; } -private : - mutable wxTypeInfo * m_elementType ; - wxString m_elementTypeName ; -} ; - -// a delegate is an exposed event source - -class WXDLLIMPEXP_BASE wxDelegateTypeInfo : public wxTypeInfo -{ -public : - wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; - wxDelegateTypeInfo( int eventType , int lastEventType, wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; - int GetEventType() const { return m_eventType ; } - int GetLastEventType() const { return m_lastEventType ; } - const wxClassInfo* GetEventClass() const { return m_eventClass ; } -private : - const wxClassInfo *m_eventClass; // (extended will merge into classinfo) - int m_eventType ; - int m_lastEventType ; -} ; - -template const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo::FindType(typeid(T).name()) ; } - -// this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type - -#if wxUSE_FUNC_TEMPLATE_POINTER -#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ - wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &toString , &fromString) ; -#else -#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ - void ToString##e( const wxxVariant& data , wxString &result ) { toString(data, result); } \ - void FromString##e( const wxString& data , wxxVariant &result ) { fromString(data, result); } \ - wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &ToString##e , &FromString##e) ; -#endif - -#define wxCOLLECTION_TYPE_INFO( element , collection ) \ - wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ; - -// sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs, currently -// we don't have to play tricks, but if we will have to according to the compiler, we will use that macro for that - -#define wxILLEGAL_TYPE_SPECIALIZATION( a ) - -// ---------------------------------------------------------------------------- -// wxxVariant as typesafe data holder -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxxVariantData -{ -public: - virtual ~wxxVariantData() {} - - // return a heap allocated duplicate - virtual wxxVariantData* Clone() const = 0 ; - - // returns the type info of the contentc - virtual const wxTypeInfo* GetTypeInfo() const = 0 ; -} ; - -template class wxxVariantDataT : public wxxVariantData -{ -public: - wxxVariantDataT(const T& d) : m_data(d) {} - virtual ~wxxVariantDataT() {} - - // get a ref to the stored data - T & Get() { return m_data; } - - // get a const ref to the stored data - const T & Get() const { return m_data; } - - // set the data - void Set(const T& d) { m_data = d; } - - // return a heap allocated duplicate - virtual wxxVariantData* Clone() const { return new wxxVariantDataT( Get() ) ; } - - // returns the type info of the contentc - virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ) ; } - -private: - T m_data; -}; - -class WXDLLIMPEXP_BASE wxxVariant -{ -public : - wxxVariant() { m_data = NULL ; } - wxxVariant( wxxVariantData* data , const wxString& name = wxEmptyString ) : m_data(data) , m_name(name) {} - wxxVariant( const wxxVariant &d ) { if ( d.m_data ) m_data = d.m_data->Clone() ; else m_data = NULL ; m_name = d.m_name ; } - - template wxxVariant( const T& data , const wxString& name = wxEmptyString ) : - m_data(new wxxVariantDataT(data) ), m_name(name) {} - - ~wxxVariant() { delete m_data ; } - - // get a ref to the stored data - template T& Get(wxTEMPLATED_MEMBER_FIX(T)) - { - wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; - wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; - return dataptr->Get() ; - } - - // get a ref to the stored data - template const T& Get(wxTEMPLATED_MEMBER_FIX(T)) const - { - const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; - wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; - return dataptr->Get() ; - } - - bool IsEmpty() const { return m_data == NULL ; } - - template bool HasData(wxTEMPLATED_MEMBER_FIX(T)) const - { - const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; - return dataptr != NULL ; - } - - // stores the data - template void Set(const T& data) const - { - delete m_data ; - m_data = new wxxVariantDataT(data) ; - } - - wxxVariant& operator=(const wxxVariant &d) - { - delete m_data; - m_data = d.m_data ? d.m_data->Clone() : NULL ; - m_name = d.m_name ; - return *this ; - } - - // gets the stored data casted to a wxObject* , returning NULL if cast is not possible - wxObject* GetAsObject() ; - - // get the typeinfo of the stored object - const wxTypeInfo* GetTypeInfo() const { return m_data->GetTypeInfo() ; } - - // returns this value as string - wxString GetAsString() const - { - wxString s ; - GetTypeInfo()->ConvertToString( *this , s ) ; - return s ; - } - const wxString& GetName() const { return m_name ; } -private : - wxxVariantData* m_data ; - wxString m_name ; -} ; - -#include "wx/dynarray.h" - -WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE); - -// templated streaming, every type must have their specialization for these methods - -template -void wxStringReadValue( const wxString &s , T &data ); - -template -void wxStringWriteValue( wxString &s , const T &data); - -template -void wxToStringConverter( const wxxVariant &v, wxString &s wxTEMPLATED_FUNCTION_FIX(T)) { wxStringWriteValue( s , v.wxTEMPLATED_MEMBER_CALL(Get , T) ) ; } - -template -void wxFromStringConverter( const wxString &s, wxxVariant &v wxTEMPLATED_FUNCTION_FIX(T)) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } - -// ---------------------------------------------------------------------------- -// Property Support -// -// wxPropertyInfo is used to inquire of the property by name. It doesn't -// provide access to the property, only information about it. If you -// want access, look at wxPropertyAccessor. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxSetter -{ -public: - wxSetter( const wxString name ) { m_name = name ; } - virtual ~wxSetter() {} - virtual void Set( wxObject *object, const wxxVariant &variantValue ) const = 0; - const wxString& GetName() const { return m_name ; } -private: - wxString m_name; -}; - -class WXDLLIMPEXP_BASE wxGetter -{ -public: - wxGetter( const wxString name ) { m_name = name ; } - virtual ~wxGetter() {} - virtual void Get( const wxObject *object , wxxVariant& result) const = 0; - const wxString& GetName() const { return m_name ; } -private: - wxString m_name; -}; - -class WXDLLIMPEXP_BASE wxCollectionGetter -{ -public : - wxCollectionGetter( const wxString name ) { m_name = name ; } - virtual ~wxCollectionGetter() {} - virtual void Get( const wxObject *object , wxxVariantArray& result) const = 0; - const wxString& GetName() const { return m_name ; } -private : - wxString m_name ; -} ; - -template void WXDLLIMPEXP_BASE wxCollectionToVariantArray( const coll_t& coll , wxxVariantArray& result ) ; - -class WXDLLIMPEXP_BASE wxAdder -{ -public : - wxAdder( const wxString name ) { m_name = name ; } - virtual ~wxAdder() {} - virtual void Add( wxObject *object, const wxxVariant &variantValue ) const= 0; - const wxString& GetName() const { return m_name ; } -private : - wxString m_name ; -} ; - - -#define wxSETTER( property, Klass, valueType, setterMethod ) \ -class wxSetter##property : public wxSetter \ -{ \ -public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxSetter##property() : wxSetter( wxT(#setterMethod) ) {} \ - virtual ~wxSetter##property() {} \ - void Set( wxObject *object, const wxxVariant &variantValue ) const \ -{ \ - Klass *obj = dynamic_cast(object) ; \ - if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ - obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ - else \ - obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ -} \ -} ; - -#define wxGETTER( property, Klass, valueType , gettermethod ) \ -class wxGetter##property : public wxGetter \ -{ \ -public : \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxGetter##property() : wxGetter( wxT(#gettermethod) ) {} \ - virtual ~wxGetter##property() {} \ - void Get( const wxObject *object , wxxVariant &result) const \ -{ \ - const Klass *obj = dynamic_cast(object) ; \ - result = wxxVariant( obj->gettermethod() ) ; \ -} \ -} ; - -#define wxADDER( property, Klass, valueType , addermethod ) \ -class wxAdder##property : public wxAdder \ -{ \ -public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxAdder##property() : wxAdder( wxT(#addermethod) ) {} \ - virtual ~wxAdder##property() {} \ - void Add( wxObject *object, const wxxVariant &variantValue ) const \ -{ \ - Klass *obj = dynamic_cast(object) ; \ - if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ - obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ - else \ - obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ -} \ -} ; - -#define wxCOLLECTION_GETTER( property, Klass, valueType , gettermethod ) \ -class wxCollectionGetter##property : public wxCollectionGetter \ -{ \ -public : \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ - wxCollectionGetter##property() : wxCollectionGetter( wxT(#gettermethod) ) {} \ - virtual ~wxCollectionGetter##property() {} \ - void Get( const wxObject *object , wxxVariantArray &result) const \ -{ \ - const Klass *obj = dynamic_cast(object) ; \ - wxCollectionToVariantArray( obj->gettermethod() , result ) ; \ -} \ -} ; - -class WXDLLIMPEXP_BASE wxPropertyAccessor -{ -public : - wxPropertyAccessor( wxSetter *setter , wxGetter *getter , wxAdder *adder , wxCollectionGetter *collectionGetter ) - { m_setter = setter ; m_getter = getter ; m_adder = adder ; m_collectionGetter = collectionGetter ;} - - virtual ~wxPropertyAccessor() {} - - // Setting a simple property (non-collection) - virtual void SetProperty(wxObject *object, const wxxVariant &value) const - { if ( m_setter ) m_setter->Set( object , value ) ; else wxLogError( _("SetProperty called w/o valid setter") ) ;} - - // Getting a simple property (non-collection) - virtual void GetProperty(const wxObject *object, wxxVariant &result) const - { if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( _("GetProperty called w/o valid getter") ) ;} - - // Adding an element to a collection property - virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const - { if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( _("AddToPropertyCollection called w/o valid adder") ) ;} - - // Getting a collection property - virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const - { if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( _("GetPropertyCollection called w/o valid collection getter") ) ;} - - virtual bool HasSetter() const { return m_setter != NULL ; } - virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; } - virtual bool HasGetter() const { return m_getter != NULL ; } - virtual bool HasAdder() const { return m_adder != NULL ; } - - virtual const wxString& GetCollectionGetterName() const - { return m_collectionGetter->GetName() ; } - virtual const wxString& GetGetterName() const - { return m_getter->GetName() ; } - virtual const wxString& GetSetterName() const - { return m_setter->GetName() ; } - virtual const wxString& GetAdderName() const - { return m_adder->GetName() ; } - -protected : - wxSetter *m_setter ; - wxAdder *m_adder ; - wxGetter *m_getter ; - wxCollectionGetter* m_collectionGetter ; -}; - -class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor -{ -public : - wxGenericPropertyAccessor( const wxString &propName ) ; - virtual ~wxGenericPropertyAccessor() ; - - void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName), - const wxString& newName ) - { - wxASSERT( oldName == m_propertyName ) ; m_propertyName = newName ; - } - virtual bool HasSetter() const { return true ; } - virtual bool HasGetter() const { return true ; } - virtual bool HasAdder() const { return false ; } - virtual bool HasCollectionGetter() const { return false ; } - - virtual const wxString& GetGetterName() const - { return m_getterName ; } - virtual const wxString& GetSetterName() const - { return m_setterName ; } - - virtual void SetProperty(wxObject *object, const wxxVariant &value) const ; - virtual void GetProperty(const wxObject *object, wxxVariant &value) const ; - - // Adding an element to a collection property - virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const - { wxLogError( _("AddToPropertyCollection called on a generic accessor") ) ;} - - // Getting a collection property - virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const - { wxLogError ( _("GetPropertyCollection called on a generic accessor") ) ;} -private : - struct wxGenericPropertyAccessorInternal ; - wxGenericPropertyAccessorInternal* m_data ; - wxString m_propertyName ; - wxString m_setterName ; - wxString m_getterName ; -} ; - -typedef long wxPropertyInfoFlags ; -enum { - // will be removed in future releases - wxPROP_DEPRECATED = 0x00000001 , - // object graph property, will be streamed with priority (after constructor properties) - wxPROP_OBJECT_GRAPH = 0x00000002 , - // this will only be streamed out and in as enum/set, the internal representation is still a long - wxPROP_ENUM_STORE_LONG = 0x00000004 , - // don't stream out this property, needed eg to avoid streaming out children that are always created by their parents - wxPROP_DONT_STREAM = 0x00000008 , -} ; - -class WXDLLIMPEXP_BASE wxPropertyInfo -{ - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; -public : - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - const wxString& typeName, - wxPropertyAccessor *accessor, - wxxVariant dv, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(typeName) , - m_collectionElementTypeInfo(NULL), - m_accessor(accessor), - m_defaultValue(dv), - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } - -#if wxUSE_UNICODE - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - const char* typeName, - wxPropertyAccessor *accessor, - wxxVariant dv, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(wxString::FromAscii(typeName)) , - m_collectionElementTypeInfo(NULL), - m_accessor(accessor), - m_defaultValue(dv), - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } -#endif - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - wxDelegateTypeInfo* type, - wxPropertyAccessor *accessor, - wxxVariant dv, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(type), - m_collectionElementTypeInfo(NULL), - m_accessor(accessor), - m_defaultValue(dv), - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } - - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, const wxString& name, - const wxString& collectionTypeName, - const wxString& elementTypeName, - wxPropertyAccessor *accessor, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(collectionTypeName) , - m_collectionElementTypeInfo(NULL), - m_collectionElementTypeName(elementTypeName), - m_accessor(accessor) , - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } - -#if wxUSE_UNICODE - wxPropertyInfo(wxPropertyInfo* &iter, - wxClassInfo* itsClass, const wxString& name, - const char* collectionTypeName, - const char* elementTypeName, - wxPropertyAccessor *accessor, - wxPropertyInfoFlags flags = 0, - const wxString& helpString = wxEmptyString, - const wxString& groupString = wxEmptyString) : - m_itsClass(itsClass), - m_name(name), - m_typeInfo(NULL), - m_typeName(wxString::FromAscii(collectionTypeName)) , - m_collectionElementTypeInfo(NULL), - m_collectionElementTypeName(wxString::FromAscii(elementTypeName)), - m_accessor(accessor) , - m_flags(flags), - m_helpString(helpString), - m_groupString(groupString) - { - Insert(iter); - } -#endif - ~wxPropertyInfo() ; - - // return the class this property is declared in - const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } - - // return the name of this property - const wxString& GetName() const { return m_name ; } - - // returns the flags of this property - wxPropertyInfoFlags GetFlags() const { return m_flags ;} - - // returns the short help string of this property - const wxString& GetHelpString() const { return m_helpString ; } - - // returns the group string of this property - const wxString& GetGroupString() const { return m_groupString ; } - - // return the element type info of this property (for collections, otherwise NULL) - const wxTypeInfo * GetCollectionElementTypeInfo() const - { - if ( m_collectionElementTypeInfo == NULL ) - m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName) ; - return m_collectionElementTypeInfo ; - } - - // return the type info of this property - const wxTypeInfo * GetTypeInfo() const - { - if ( m_typeInfo == NULL ) - m_typeInfo = wxTypeInfo::FindType(m_typeName) ; - return m_typeInfo ; - } - - // return the accessor for this property - wxPropertyAccessor* GetAccessor() const { return m_accessor ; } - - // returns NULL if this is the last property of this class - wxPropertyInfo* GetNext() const { return m_next ; } - - // returns the default value of this property, its kind may be wxT_VOID if it is not valid - wxxVariant GetDefaultValue() const { return m_defaultValue ; } -private : - void Insert(wxPropertyInfo* &iter) - { - m_next = NULL ; - if ( iter == NULL ) - iter = this ; - else - { - wxPropertyInfo* i = iter ; - while( i->m_next ) - i = i->m_next ; - - i->m_next = this ; - } - } - - wxClassInfo* m_itsClass ; - wxString m_name ; - mutable wxTypeInfo* m_typeInfo ; - wxString m_typeName ; - mutable wxTypeInfo* m_collectionElementTypeInfo ; - wxString m_collectionElementTypeName ; - wxPropertyAccessor* m_accessor ; - wxxVariant m_defaultValue; - wxPropertyInfoFlags m_flags ; - wxString m_helpString ; - wxString m_groupString ; - // string representation of the default value - // to be assigned by the designer to the property - // when the component is dropped on the container. - wxPropertyInfo* m_next ; -}; - -WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo* , wxPropertyInfoMap , class WXDLLIMPEXP_BASE ) ; - -#define wxBEGIN_PROPERTIES_TABLE(theClass) \ - wxPropertyInfo *theClass::GetPropertiesStatic() \ -{ \ - typedef theClass class_t; \ - static wxPropertyInfo* first = NULL ; - -#define wxEND_PROPERTIES_TABLE() \ - return first ; } - -#define wxHIDE_PROPERTY( pname ) \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(void).name() ,NULL , wxxVariant() , wxPROP_DONT_STREAM , wxEmptyString , wxEmptyString ) ; - -#define wxPROPERTY( pname , type , setter , getter , defaultValue , flags , help , group) \ - wxSETTER( pname , class_t , type , setter ) \ - static wxSetter##pname _setter##pname ; \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue) , flags , group , help ) ; - -#define wxPROPERTY_FLAGS( pname , flags , type , setter , getter ,defaultValue , pflags , help , group) \ - wxSETTER( pname , class_t , type , setter ) \ - static wxSetter##pname _setter##pname ; \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; - -#define wxREADONLY_PROPERTY( pname , type , getter ,defaultValue , flags , help , group) \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue), flags , help , group ) ; - -#define wxREADONLY_PROPERTY_FLAGS( pname , flags , type , getter ,defaultValue , pflags , help , group) \ - wxGETTER( pname , class_t , type , getter ) \ - static wxGetter##pname _getter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; - -#define wxPROPERTY_COLLECTION( pname , colltype , addelemtype , adder , getter , flags , help , group ) \ - wxADDER( pname , class_t , addelemtype , adder ) \ - static wxAdder##pname _adder##pname ; \ - wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ - static wxCollectionGetter##pname _collectionGetter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , NULL ,&_adder##pname , &_collectionGetter##pname ) ; \ - static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; - -#define wxREADONLY_PROPERTY_COLLECTION( pname , colltype , addelemtype , getter , flags , help , group) \ - wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ - static wxCollectionGetter##pname _collectionGetter##pname ; \ - static wxPropertyAccessor _accessor##pname( NULL , NULL , NULL , &_collectionGetter##pname ) ; \ - static wxPropertyInfo _propertyInfo##pname( first ,class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; - - -#define wxEVENT_PROPERTY( name , eventType , eventClass ) \ - static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \ - static wxPropertyInfo _propertyInfo##name( first ,class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ - -#define wxEVENT_RANGE_PROPERTY( name , eventType , lastEventType , eventClass ) \ - static wxDelegateTypeInfo _typeInfo##name( eventType , lastEventType , CLASSINFO( eventClass ) ) ; \ - static wxPropertyInfo _propertyInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ - -// ---------------------------------------------------------------------------- -// Implementation Helper for Simple Properties -// ---------------------------------------------------------------------------- - -#define wxIMPLEMENT_PROPERTY(name, type) \ -private:\ - type m_##name; \ -public: \ - void Set##name( type const & p) { m_##name = p; } \ - type const & Get##name() const { return m_##name; } - -// ---------------------------------------------------------------------------- -// Handler Info -// -// this is describing an event sink -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxHandlerInfo -{ - friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; -public : - wxHandlerInfo(wxHandlerInfo* &iter, - wxClassInfo* itsClass, - const wxString& name, - wxObjectEventFunction address, - const wxClassInfo* eventClassInfo) : - m_eventFunction(address), - m_name(name), - m_eventClassInfo(eventClassInfo) , - m_itsClass(itsClass) - { - m_next = NULL ; - if ( iter == NULL ) - iter = this ; - else - { - wxHandlerInfo* i = iter ; - while( i->m_next ) - i = i->m_next ; - - i->m_next = this ; - } - } - - ~wxHandlerInfo() ; - - // return the name of this handler - const wxString& GetName() const { return m_name ; } - - // return the class info of the event - const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo ; } - - // get the handler function pointer - wxObjectEventFunction GetEventFunction() const { return m_eventFunction ; } - - // returns NULL if this is the last handler of this class - wxHandlerInfo* GetNext() const { return m_next ; } - - // return the class this property is declared in - const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } - -private : - wxObjectEventFunction m_eventFunction ; - wxString m_name; - const wxClassInfo* m_eventClassInfo ; - wxHandlerInfo* m_next ; - wxClassInfo* m_itsClass ; -}; - -#define wxHANDLER(name,eventClassType) \ - static wxHandlerInfo _handlerInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ; - -#define wxBEGIN_HANDLERS_TABLE(theClass) \ - wxHandlerInfo *theClass::GetHandlersStatic() \ -{ \ - typedef theClass class_t; \ - static wxHandlerInfo* first = NULL ; - -#define wxEND_HANDLERS_TABLE() \ - return first ; } - -// ---------------------------------------------------------------------------- -// Constructor Bridges -// -// allow to set up constructors with params during runtime -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxConstructorBridge -{ -public : - virtual void Create(wxObject * &o, wxxVariant *args) = 0; -}; - -// a direct constructor bridge calls the operator new for this class and -// passes all params to the constructor. needed for classes that cannot be -// instantiated using alloc-create semantics -class WXDLLIMPEXP_BASE wxDirectConstructorBrigde : public wxConstructorBridge -{ -public : - virtual void Create(wxObject * &o, wxxVariant *args) = 0; -} ; - -// Creator Bridges for all Numbers of Params - -// no params - -template -struct wxConstructorBridge_0 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *) - { - Class *obj = dynamic_cast(o); - obj->Create(); - } -}; - -struct wxConstructorBridge_Dummy : public wxConstructorBridge -{ - void Create(wxObject *&, wxxVariant *) - { - } -} ; - -#define wxCONSTRUCTOR_0(klass) \ - wxConstructorBridge_0 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ - const int klass::ms_constructorPropertiesCount = 0 ; - -#define wxCONSTRUCTOR_DUMMY(klass) \ - wxConstructorBridge_Dummy constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ - const int klass::ms_constructorPropertiesCount = 0 ; - -// 1 param - -template -struct wxConstructorBridge_1 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) - ); - } -}; - -#define wxCONSTRUCTOR_1(klass,t0,v0) \ - wxConstructorBridge_1 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) } ; \ - const int klass::ms_constructorPropertiesCount = 1 ; - -// 2 params - -template -struct wxConstructorBridge_2 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) - ); - } -}; - -#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ - wxConstructorBridge_2 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ - const int klass::ms_constructorPropertiesCount = 2; - -// direct constructor version - -template -struct wxDirectConstructorBridge_2 : public wxDirectConstructorBrigde -{ - void Create(wxObject * &o, wxxVariant *args) - { - o = new Class( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) - ); - } -}; - -#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ - wxDirectConstructorBridge_2 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ - const int klass::ms_constructorPropertiesCount = 2; - - -// 3 params - -template -struct wxConstructorBridge_3 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) - ); - } -}; - -#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ - wxConstructorBridge_3 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ - const int klass::ms_constructorPropertiesCount = 3 ; - -// direct constructor version - -template -struct wxDirectConstructorBridge_3 : public wxDirectConstructorBrigde -{ - void Create(wxObject * &o, wxxVariant *args) - { - o = new Class( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) - ); - } -}; - -#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ - wxDirectConstructorBridge_3 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ - const int klass::ms_constructorPropertiesCount = 3; - -// 4 params - -template -struct wxConstructorBridge_4 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) - ); - } -}; - -#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ - wxConstructorBridge_4 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) } ; \ - const int klass::ms_constructorPropertiesCount = 4 ; - -// 5 params - -template -struct wxConstructorBridge_5 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) - ); - } -}; - -#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ - wxConstructorBridge_5 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) } ; \ - const int klass::ms_constructorPropertiesCount = 5; - -// 6 params - -template -struct wxConstructorBridge_6 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) - ); - } -}; - -#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ - wxConstructorBridge_6 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ - const int klass::ms_constructorPropertiesCount = 6; - -// direct constructor version - -template -struct wxDirectConstructorBridge_6 : public wxDirectConstructorBrigde -{ - void Create(wxObject * &o, wxxVariant *args) - { - o = new Class( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) - ); - } -}; - -#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ - wxDirectConstructorBridge_6 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ - const int klass::ms_constructorPropertiesCount = 6; - -// 7 params - -template -struct wxConstructorBridge_7 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , - args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) - ); - } -}; - -#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ - wxConstructorBridge_7 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) } ; \ - const int klass::ms_constructorPropertiesCount = 7; - -// 8 params - -template -struct wxConstructorBridge_8 : public wxConstructorBridge -{ - void Create(wxObject * &o, wxxVariant *args) - { - Class *obj = dynamic_cast(o); - obj->Create( - args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , - args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , - args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , - args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , - args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , - args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , - args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) , - args[7].wxTEMPLATED_MEMBER_CALL(Get , T7) - ); - } -}; - -#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ - wxConstructorBridge_8 constructor##klass ; \ - wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ - const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) , wxT(#v7) } ; \ - const int klass::ms_constructorPropertiesCount = 8; -// ---------------------------------------------------------------------------- -// wxClassInfo -// ---------------------------------------------------------------------------- - -typedef wxObject *(*wxObjectConstructorFn)(void); -typedef wxObject* (*wxVariantToObjectConverter)( wxxVariant &data ) ; -typedef wxxVariant (*wxObjectToVariantConverter)( wxObject* ) ; - -class WXDLLIMPEXP_BASE wxWriter; -class WXDLLIMPEXP_BASE wxPersister; - -typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxWriter * , wxPersister * , wxxVariantArray & ) ; - -class WXDLLIMPEXP_BASE wxClassInfo -{ - friend class WXDLLIMPEXP_BASE wxPropertyInfo ; - friend class WXDLLIMPEXP_BASE wxHandlerInfo ; -public: - wxClassInfo(const wxClassInfo **_Parents, - const wxChar *_UnitName, - const wxChar *_ClassName, - int size, - wxObjectConstructorFn ctor , - wxPropertyInfo *_Props , - wxHandlerInfo *_Handlers , - wxConstructorBridge* _Constructor , - const wxChar ** _ConstructorProperties , - const int _ConstructorPropertiesCount , - wxVariantToObjectConverter _PtrConverter1 , - wxVariantToObjectConverter _Converter2 , - wxObjectToVariantConverter _Converter3 , - wxObjectStreamingCallback _streamingCallback = NULL - ) : - - m_className(_ClassName), - m_objectSize(size), - m_objectConstructor(ctor), - m_next(sm_first), - m_firstProperty(_Props), - m_firstHandler(_Handlers), - m_parents(_Parents), - m_unitName(_UnitName), - m_constructor(_Constructor), - m_constructorProperties(_ConstructorProperties), - m_constructorPropertiesCount(_ConstructorPropertiesCount), - m_variantOfPtrToObjectConverter(_PtrConverter1), - m_variantToObjectConverter(_Converter2), - m_objectToVariantConverter(_Converter3), - m_streamingCallback(_streamingCallback) - { - sm_first = this; - Register() ; - } - - wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, - const wxClassInfo **_Parents) : - m_className(_ClassName), - m_objectSize(0), - m_objectConstructor(NULL), - m_next(sm_first), - m_firstProperty(NULL), - m_firstHandler(NULL), - m_parents(_Parents), - m_unitName(_UnitName), - m_constructor(NULL), - m_constructorProperties(NULL), - m_constructorPropertiesCount(0), - m_variantOfPtrToObjectConverter(NULL), - m_variantToObjectConverter(NULL), - m_objectToVariantConverter(NULL), - m_streamingCallback(NULL) - { - sm_first = this; - Register() ; - } - - virtual ~wxClassInfo() ; - - // allocates an instance of this class, this object does not have to be initialized or fully constructed - // as this call will be followed by a call to Create - virtual wxObject *AllocateObject() const { return m_objectConstructor ? (*m_objectConstructor)() : 0; } - - // 'old naming' for AllocateObject staying here for backward compatibility - wxObject *CreateObject() const { return AllocateObject() ; } - - // direct construction call for classes that cannot construct instances via alloc/create - wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const - { - if ( ParamCount != m_constructorPropertiesCount ) - { - wxLogError( _("Illegal Parameter Count for ConstructObject Method") ) ; - return NULL ; - } - wxObject *object = NULL ; - m_constructor->Create( object , Params ) ; - return object ; - } - - bool NeedsDirectConstruction() const { return dynamic_cast( m_constructor) != NULL ; } - - const wxChar *GetClassName() const { return m_className; } - const wxChar *GetBaseClassName1() const - { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } - const wxChar *GetBaseClassName2() const - { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } - const wxChar *GetIncludeName() const { return m_unitName ; } - const wxClassInfo **GetParents() const { return m_parents; } - int GetSize() const { return m_objectSize; } - bool IsDynamic() const { return (NULL != m_objectConstructor); } - - wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } - static const wxClassInfo *GetFirst() { return sm_first; } - const wxClassInfo *GetNext() const { return m_next; } - static wxClassInfo *FindClass(const wxChar *className); - - // Climb upwards through inheritance hierarchy. - // Dual inheritance is catered for. - - bool IsKindOf(const wxClassInfo *info) const - { - if ( info != 0 ) - { - if ( info == this ) - return true ; - - for ( int i = 0 ; m_parents[i] ; ++ i ) - { - if ( m_parents[i]->IsKindOf( info ) ) - return true ; - } - } - return false ; - } - - // if there is a callback registered with that class it will be called - // before this object will be written to disk, it can veto streaming out - // this object by returning false, if this class has not registered a - // callback, the search will go up the inheritance tree if no callback has - // been registered true will be returned by default - bool BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const ; - - // gets the streaming callback from this class or any superclass - wxObjectStreamingCallback GetStreamingCallback() const ; - -#if WXWIN_COMPATIBILITY_2_4 - // Initializes parent pointers and hash table for fast searching. - wxDEPRECATED( static void InitializeClasses() ); - // Cleans up hash table used for fast searching. - wxDEPRECATED( static void CleanUpClasses() ); -#endif - static void CleanUp(); - - // returns the first property - const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; } - - // returns the first handler - const wxHandlerInfo* GetFirstHandler() const { return m_firstHandler ; } - - // Call the Create upon an instance of the class, in the end the object is fully - // initialized - virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const - { - if ( ParamCount != m_constructorPropertiesCount ) - { - wxLogError( _("Illegal Parameter Count for Create Method") ) ; - return ; - } - m_constructor->Create( object , Params ) ; - } - - // get number of parameters for constructor - virtual int GetCreateParamCount() const { return m_constructorPropertiesCount; } - - // get n-th constructor parameter - virtual const wxChar* GetCreateParamName(int n) const { return m_constructorProperties[n] ; } - - // Runtime access to objects for simple properties (get/set) by property name, and variant data - virtual void SetProperty (wxObject *object, const wxChar *propertyName, const wxxVariant &value) const ; - virtual wxxVariant GetProperty (wxObject *object, const wxChar *propertyName) const; - - // Runtime access to objects for collection properties by property name - virtual wxxVariantArray GetPropertyCollection(wxObject *object, const wxChar *propertyName) const ; - virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ; - - // we must be able to cast variants to wxObject pointers, templates seem not to be suitable - wxObject* VariantToInstance( wxxVariant &data ) const - { - if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) - return m_variantToObjectConverter( data ) ; - else - return m_variantOfPtrToObjectConverter( data ) ; - } - - wxxVariant InstanceToVariant( wxObject *object ) const { return m_objectToVariantConverter( object ) ; } - - // find property by name - virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const ; - - // find handler by name - virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *PropertyName) const ; - - // find property by name - virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const ; - - // find handler by name - virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *PropertyName) const ; - - // puts all the properties of this class and its superclasses in the map, as long as there is not yet - // an entry with the same name (overriding mechanism) - void GetProperties( wxPropertyInfoMap &map ) const ; -public: - const wxChar *m_className; - int m_objectSize; - wxObjectConstructorFn m_objectConstructor; - - // class info object live in a linked list: - // pointers to its head and the next element in it - - static wxClassInfo *sm_first; - wxClassInfo *m_next; - - // FIXME: this should be private (currently used directly by way too - // many clients) - static wxHashTable *sm_classTable; - -protected : - wxPropertyInfo * m_firstProperty ; - wxHandlerInfo * m_firstHandler ; -private: - const wxClassInfo** m_parents ; - const wxChar* m_unitName; - - wxConstructorBridge* m_constructor ; - const wxChar ** m_constructorProperties ; - const int m_constructorPropertiesCount ; - wxVariantToObjectConverter m_variantOfPtrToObjectConverter ; - wxVariantToObjectConverter m_variantToObjectConverter ; - wxObjectToVariantConverter m_objectToVariantConverter ; - wxObjectStreamingCallback m_streamingCallback ; - const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const ; - - - // InitializeClasses() helper - static wxClassInfo *GetBaseByName(const wxChar *name) ; - -protected: - // registers the class - void Register(); - void Unregister(); - - DECLARE_NO_COPY_CLASS(wxClassInfo) -}; - - -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); - -// ---------------------------------------------------------------------------- -// wxDynamicObject -// ---------------------------------------------------------------------------- -// -// this object leads to having a pure runtime-instantiation - -class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo -{ - friend class WXDLLIMPEXP_BASE wxDynamicObject ; -public : - wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ; - virtual ~wxDynamicClassInfo() ; - - // constructs a wxDynamicObject with an instance - virtual wxObject *AllocateObject() const ; - - // Call the Create method for a class - virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const ; - - // get number of parameters for constructor - virtual int GetCreateParamCount() const ; - - // get i-th constructor parameter - virtual const wxChar* GetCreateParamName(int i) const ; - - // Runtime access to objects by property name, and variant data - virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value) const ; - virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName) const ; - - // adds a property to this class at runtime - void AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) ; - - // removes an existing runtime-property - void RemoveProperty( const wxChar *propertyName ) ; - - // renames an existing runtime-property - void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; - - // as a handler to this class at runtime - void AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) ; - - // removes an existing runtime-handler - void RemoveHandler( const wxChar *handlerName ) ; - - // renames an existing runtime-handler - void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ; -private : - struct wxDynamicClassInfoInternal ; - wxDynamicClassInfoInternal* m_data ; -} ; - -// ---------------------------------------------------------------------------- -// Dynamic class macros -// ---------------------------------------------------------------------------- - -#define _DECLARE_DYNAMIC_CLASS(name) \ - public: \ - static wxClassInfo ms_classInfo; \ - static const wxClassInfo* ms_classParents[] ; \ - static wxPropertyInfo* GetPropertiesStatic() ; \ - static wxHandlerInfo* GetHandlersStatic() ; \ - static wxClassInfo *GetClassInfoStatic() \ -{ return &name::ms_classInfo; } \ - virtual wxClassInfo *GetClassInfo() const \ -{ return &name::ms_classInfo; } - -/* -#define _DECLARE_DYNAMIC_CLASS(name) \ - public: \ - static wxClassInfo ms_class##name; \ - static const wxClassInfo* ms_classParents##name[] ; \ - static wxPropertyInfo* GetPropertiesStatic() ; \ - static wxHandlerInfo* GetHandlersStatic() ; \ - static wxClassInfo *GetClassInfoStatic() \ -{ return &name::ms_class##name; } \ - virtual wxClassInfo *GetClassInfo() const \ -{ return &name::ms_class##name; } -*/ -#define DECLARE_DYNAMIC_CLASS(name) \ - static wxConstructorBridge* ms_constructor ; \ - static const wxChar * ms_constructorProperties[] ; \ - static const int ms_constructorPropertiesCount ; \ - _DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - DECLARE_NO_ASSIGN_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - DECLARE_NO_COPY_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) - -#define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) -#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) - -// ----------------------------------- -// for concrete classes -// ----------------------------------- - -// Single inheritance with one base class - -#define _TYPEINFO_CLASSES(n , toString , fromString ) \ - wxClassTypeInfo s_typeInfo##n(wxT_OBJECT , &n::ms_classInfo , toString , fromString , typeid(n).name()) ; \ - wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR , &n::ms_classInfo , toString , fromString , typeid(n*).name()) ; - -#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit , callback) \ - wxObject* wxConstructorFor##name() \ -{ return new name; } \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) wxConstructorFor##name , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ - name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name , callback); - -#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ - wxObject* wxConstructorFor##name() \ -{ return new name; } \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return &data.wxTEMPLATED_MEMBER_CALL(Get , name) ; } \ - wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) wxConstructorFor##name , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties, \ - name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name, callback); - -#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , "" , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) \ - const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ - const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \ - _IMPLEMENT_DYNAMIC_CLASS( name , basename , "" , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \ - _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name , basename , unit , callback ) \ - _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , &callback ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name , basename , unit ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name , basename , unit , toString , fromString ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ - _TYPEINFO_CLASSES(name, toString , fromString) - -// this is for classes that do not derive from wxobject, there are no creators for these - -#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \ - const wxClassInfo* name::ms_classParents[] = { NULL } ; \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) 0 , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ - 0 , 0 , 0 ); \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -// this is for subclasses that still do not derive from wxobject - -#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) 0 , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ - 0 , 0 , 0 ); \ - _TYPEINFO_CLASSES(name, NULL , NULL) - - -// Multiple inheritance with two base classes - -#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ - wxObject* wxConstructorFor##name() \ -{ return new name; } \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,&basename2::ms_classInfo , NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) wxConstructorFor##name , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ - name::ms_constructorPropertiesCount , wxVariantToObjectConverter##name, wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ - -#define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ - _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \ - _TYPEINFO_CLASSES(name, NULL , NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxCONSTRUCTOR_DUMMY( name ) - -#define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \ - _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit) \ - _TYPEINFO_CLASSES(name, NULL , NULL) - - -// ----------------------------------- -// for abstract classes -// ----------------------------------- - -// Single inheritance with one base class - -#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ - wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ - wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ - (int) sizeof(name), \ - (wxObjectConstructorFn) 0 , \ - name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ - 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ - _TYPEINFO_CLASSES(name, NULL , NULL) - -#define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ - _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } - -// Multiple inheritance with two base classes - -#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \ - wxT(#basename2), (int) sizeof(name), \ - (wxObjectConstructorFn) 0); - -#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS -#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 - -#define wxBEGIN_EVENT_TABLE( a , b ) BEGIN_EVENT_TABLE( a , b ) -#define wxEND_EVENT_TABLE() END_EVENT_TABLE() - -// -------------------------------------------------------------------------- -// Collection Support -// -------------------------------------------------------------------------- - -template void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) -{ - iter current = coll.GetFirst() ; - while (current) - { - value.Add( new wxxVariant(current->GetData()) ) ; - current = current->GetNext(); - } -} - -template void wxArrayCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) -{ - for( size_t i = 0 ; i < coll.GetCount() ; i++ ) - { - value.Add( new wxxVariant(coll[i]) ) ; - } -} - - -#endif // _WX_XTIH__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xti.h +// Purpose: runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// RCS-ID: $Id: xti.h 52488 2008-03-14 14:13:05Z JS $ +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTIH__ +#define _WX_XTIH__ + +// We want to support properties, event sources and events sinks through +// explicit declarations, using templates and specialization to make the +// effort as painless as possible. +// +// This means we have the following domains : +// +// - Type Information for categorizing built in types as well as custom types +// this includes information about enums, their values and names +// - Type safe value storage : a kind of wxVariant, called right now wxxVariant +// which will be merged with wxVariant +// - Property Information and Property Accessors providing access to a class' +// values and exposed event delegates +// - Information about event handlers +// - extended Class Information for accessing all these + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/memory.h" +#include "wx/flags.h" +#include "wx/string.h" +#include "wx/arrstr.h" +#include "wx/hashmap.h" +#include "wx/log.h" +#include "wx/intl.h" + +#include + +// we will move this later to defs.h + +#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3 , 4 ) +# define wxUSE_MEMBER_TEMPLATES 0 +#endif + +#if defined(_MSC_VER) && _MSC_VER <= 1200 +# define wxUSE_MEMBER_TEMPLATES 0 +# define wxUSE_FUNC_TEMPLATE_POINTER 0 +#endif + +#ifndef wxUSE_MEMBER_TEMPLATES +# define wxUSE_MEMBER_TEMPLATES 1 +#endif + +#ifndef wxUSE_FUNC_TEMPLATE_POINTER +# define wxUSE_FUNC_TEMPLATE_POINTER 1 +#endif + +#if wxUSE_MEMBER_TEMPLATES +# define wxTEMPLATED_MEMBER_CALL( method , type ) method() +# define wxTEMPLATED_MEMBER_FIX( type ) +#else +# define wxTEMPLATED_MEMBER_CALL( method , type ) method((type*)NULL) +# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL +#endif + +#if defined(_MSC_VER) && _MSC_VER <= 1200 +# define wxTEMPLATED_FUNCTION_FIX( type ) , wxTEMPLATED_MEMBER_FIX(type) +# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type; +#else +# define wxTEMPLATED_FUNCTION_FIX( type ) +# define wxINFUNC_CLASS_TYPE_FIX( type ) +#endif + +#define EMPTY_MACROVALUE /**/ + +class WXDLLIMPEXP_BASE wxObject; +class WXDLLIMPEXP_BASE wxClassInfo; +class WXDLLIMPEXP_BASE wxDynamicClassInfo; +class WXDLLIMPEXP_BASE wxHashTable; +class WXDLLIMPEXP_BASE wxObjectRefData; +class WXDLLIMPEXP_BASE wxEvent; +class WXDLLIMPEXP_BASE wxEvtHandler; + +typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); + +#if wxUSE_FUNC_TEMPLATE_POINTER +# define wxTO_STRING(type) wxToStringConverter +# define wxTO_STRING_IMP(type) +# define wxFROM_STRING(type) wxFromStringConverter +# define wxFROM_STRING_IMP(type) +#else +# define wxTO_STRING(type) ToString##type +# define wxTO_STRING_IMP(type) inline void ToString##type( const wxxVariant& data , wxString &result ) { wxToStringConverter(data, result); } +# define wxFROM_STRING(type) FromString##type +# define wxFROM_STRING_IMP(type) inline void FromString##type( const wxString& data , wxxVariant &result ) { wxFromStringConverter(data, result); } +#endif + +// ---------------------------------------------------------------------------- +// Enum Support +// +// In the header files there would no change from pure c++ code, in the +// implementation, an enum would have +// to be enumerated eg : +// +// wxBEGIN_ENUM( wxFlavor ) +// wxENUM_MEMBER( Vanilla ) +// wxENUM_MEMBER( Chocolate ) +// wxENUM_MEMBER( Strawberry ) +// wxEND_ENUM( wxFlavor ) +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxEnumMemberData +{ + const wxChar* m_name; + int m_value; +}; + +class WXDLLIMPEXP_BASE wxEnumData +{ +public : + wxEnumData( wxEnumMemberData* data ) ; + + // returns true if the member has been found and sets the int value + // pointed to accordingly (if ptr != null ) + // if not found returns false, value left unchanged + bool HasEnumMemberValue( const wxChar *name , int *value = NULL ) const ; + + // returns the value of the member, if not found in debug mode an + // assert is issued, in release 0 is returned + int GetEnumMemberValue(const wxChar *name ) const ; + + // returns the name of the enum member having the passed in value + // returns an emtpy string if not found + const wxChar *GetEnumMemberName(int value) const ; + + // returns the number of members in this enum + int GetEnumCount() const { return m_count ; } + + // returns the value of the nth member + int GetEnumMemberValueByIndex( int n ) const ; + + // returns the value of the nth member + const wxChar *GetEnumMemberNameByIndex( int n ) const ; +private : + wxEnumMemberData *m_members; + int m_count ; +}; + +#define wxBEGIN_ENUM( e ) \ + wxEnumMemberData s_enumDataMembers##e[] = { + +#define wxENUM_MEMBER( v ) { wxT(#v), v } , + +#define wxEND_ENUM( e ) { NULL , 0 } } ; \ + wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ + wxEnumData *wxGetEnumData(e) { return &s_enumData##e ; } \ + template<> void wxStringReadValue(const wxString& s , e &data ) \ +{ \ + data = (e) s_enumData##e.GetEnumMemberValue(s) ; \ +} \ + template<> void wxStringWriteValue(wxString &s , const e &data ) \ +{ \ + s = s_enumData##e.GetEnumMemberName((int)data) ; \ +} \ + void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant((e)data) ;} \ + void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e) ;} \ + wxTO_STRING_IMP( e ) \ + wxFROM_STRING_IMP( e ) \ + wxEnumTypeInfo s_typeInfo##e(wxT_ENUM , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e , typeid(e).name() ) ; + +// ---------------------------------------------------------------------------- +// Set Support +// +// in the header : +// +// enum wxFlavor +// { +// Vanilla, +// Chocolate, +// Strawberry, +// }; +// +// typedef wxBitset wxCoupe ; +// +// in the implementation file : +// +// wxBEGIN_ENUM( wxFlavor ) +// wxENUM_MEMBER( Vanilla ) +// wxENUM_MEMBER( Chocolate ) +// wxENUM_MEMBER( Strawberry ) +// wxEND_ENUM( wxFlavor ) +// +// wxIMPLEMENT_SET_STREAMING( wxCoupe , wxFlavor ) +// +// implementation note : no partial specialization for streaming, but a delegation to a +// different class +// +// ---------------------------------------------------------------------------- + +// in order to remove dependancy on string tokenizer +void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s , wxArrayString &array ) ; + +template +void wxSetFromString(const wxString &s , wxBitset &data ) +{ + wxEnumData* edata = wxGetEnumData((e) 0) ; + data.reset() ; + + wxArrayString array ; + wxSetStringToArray( s , array ) ; + wxString flag; + for ( int i = 0 ; i < array.Count() ; ++i ) + { + flag = array[i] ; + int ivalue ; + if ( edata->HasEnumMemberValue( flag , &ivalue ) ) + { + data.set( (e) ivalue ) ; + } + } +} + +template +void wxSetToString( wxString &s , const wxBitset &data ) +{ + wxEnumData* edata = wxGetEnumData((e) 0) ; + int count = edata->GetEnumCount() ; + int i ; + s.Clear() ; + for ( i = 0 ; i < count ; i++ ) + { + e value = (e) edata->GetEnumMemberValueByIndex(i) ; + if ( data.test( value ) ) + { + // this could also be done by the templated calls + if ( !s.empty() ) + s +=wxT("|") ; + s += edata->GetEnumMemberNameByIndex(i) ; + } + } +} + +#define wxIMPLEMENT_SET_STREAMING(SetName,e) \ + template<> void wxStringReadValue(const wxString &s , wxBitset &data ) \ +{ \ + wxSetFromString( s , data ) ; \ +} \ + template<> void wxStringWriteValue( wxString &s , const wxBitset &data ) \ +{ \ + wxSetToString( s , data ) ; \ +} \ + void FromLong##SetName( long data , wxxVariant& result ) { result = wxxVariant(SetName((unsigned long)data)) ;} \ + void ToLong##SetName( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , SetName).to_ulong() ;} \ + wxTO_STRING_IMP( SetName ) \ + wxFROM_STRING_IMP( SetName ) \ + wxEnumTypeInfo s_typeInfo##SetName(wxT_SET , &s_enumData##e , &wxTO_STRING( SetName ) , &wxFROM_STRING( SetName ) , &ToLong##SetName , &FromLong##SetName, typeid(SetName).name() ) ; \ +} + +template +void wxFlagsFromString(const wxString &s , e &data ) +{ + wxEnumData* edata = wxGetEnumData((e*) 0) ; + data.m_data = 0 ; + + wxArrayString array ; + wxSetStringToArray( s , array ) ; + wxString flag; + for ( size_t i = 0 ; i < array.Count() ; ++i ) + { + flag = array[i] ; + int ivalue ; + if ( edata->HasEnumMemberValue( flag , &ivalue ) ) + { + data.m_data |= ivalue ; + } + } +} + +template +void wxFlagsToString( wxString &s , const e& data ) +{ + wxEnumData* edata = wxGetEnumData((e*) 0) ; + int count = edata->GetEnumCount() ; + int i ; + s.Clear() ; + long dataValue = data.m_data ; + for ( i = 0 ; i < count ; i++ ) + { + int value = edata->GetEnumMemberValueByIndex(i) ; + // make this to allow for multi-bit constants to work + if ( value && ( dataValue & value ) == value ) + { + // clear the flags we just set + dataValue &= ~value ; + // this could also be done by the templated calls + if ( !s.empty() ) + s +=wxT("|") ; + s += edata->GetEnumMemberNameByIndex(i) ; + } + } +} + +#define wxBEGIN_FLAGS( e ) \ + wxEnumMemberData s_enumDataMembers##e[] = { + +#define wxFLAGS_MEMBER( v ) { wxT(#v), v } , + +#define wxEND_FLAGS( e ) { NULL , 0 } } ; \ + wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ + wxEnumData *wxGetEnumData(e*) { return &s_enumData##e ; } \ + template<> void wxStringReadValue(const wxString &s , e &data ) \ +{ \ + wxFlagsFromString( s , data ) ; \ +} \ + template<> void wxStringWriteValue( wxString &s , const e& data ) \ +{ \ + wxFlagsToString( s , data ) ; \ +} \ + void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant(e(data)) ;} \ + void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get , e).m_data ;} \ + wxTO_STRING_IMP( e ) \ + wxFROM_STRING_IMP( e ) \ + wxEnumTypeInfo s_typeInfo##e(wxT_SET , &s_enumData##e , &wxTO_STRING( e ) , &wxFROM_STRING( e ) , &ToLong##e , &FromLong##e, typeid(e).name() ) ; +// ---------------------------------------------------------------------------- +// Type Information +// ---------------------------------------------------------------------------- +// +// +// All data exposed by the RTTI is characterized using the following classes. +// The first characterization is done by wxTypeKind. All enums up to and including +// wxT_CUSTOM represent so called simple types. These cannot be divided any further. +// They can be converted to and from wxStrings, that's all. + + +enum wxTypeKind +{ + wxT_VOID = 0, // unknown type + wxT_BOOL, + wxT_CHAR, + wxT_UCHAR, + wxT_INT, + wxT_UINT, + wxT_LONG, + wxT_ULONG, + wxT_FLOAT, + wxT_DOUBLE, + wxT_STRING, // must be wxString + wxT_SET, // must be wxBitset<> template + wxT_ENUM, + wxT_CUSTOM, // user defined type (e.g. wxPoint) + + wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM , + + wxT_OBJECT_PTR, // object reference + wxT_OBJECT , // embedded object + wxT_COLLECTION , // collection + + wxT_DELEGATE , // for connecting against an event source + + wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging +}; + +class WXDLLIMPEXP_BASE wxxVariant ; +class WXDLLIMPEXP_BASE wxTypeInfo ; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo* , wxTypeInfoMap , class WXDLLIMPEXP_BASE ) ; + +class WXDLLIMPEXP_BASE wxTypeInfo +{ +public : + typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ; + typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ; + + wxTypeInfo(wxTypeKind kind, + converterToString_t to = NULL, converterFromString_t from = NULL, + const wxString &name = wxEmptyString): + m_toString(to), m_fromString(from), m_kind(kind), m_name(name) + { + Register(); + } +#if wxUSE_UNICODE + wxTypeInfo(wxTypeKind kind, + converterToString_t to, converterFromString_t from, + const char *name): + m_toString(to), m_fromString(from), m_kind(kind), m_name(wxString::FromAscii(name)) + { + Register(); + } +#endif + + virtual ~wxTypeInfo() + { + Unregister() ; + } + + // return the kind of this type (wxT_... constants) + wxTypeKind GetKind() const { return m_kind ; } + + // returns the unique name of this type + const wxString& GetTypeName() const { return m_name ; } + + // is this type a delegate type + bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; } + + // is this type a custom type + bool IsCustomType() const { return m_kind == wxT_CUSTOM ; } + + // is this type an object type + bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; } + + // can the content of this type be converted to and from strings ? + bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; } + + // convert a wxxVariant holding data of this type into a string + void ConvertToString( const wxxVariant& data , wxString &result ) const + + { if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } + + // convert a string into a wxxVariant holding the corresponding data in this type + void ConvertFromString( const wxString& data , wxxVariant &result ) const + { if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } + +#if wxUSE_UNICODE + static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; } +#endif + static wxTypeInfo *FindType(const wxChar *typeName); + +private : + + void Register(); + void Unregister(); + + converterToString_t m_toString ; + converterFromString_t m_fromString ; + + static wxTypeInfoMap* ms_typeTable ; + + wxTypeKind m_kind; + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo +{ +public : + wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString ) : + wxTypeInfo( kind , to , from , name ) + { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } +#if wxUSE_UNICODE + wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to , converterFromString_t from , const char *name ) : + wxTypeInfo( kind , to , from , name ) + { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } +#endif +} ; + +class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo +{ +public : + wxCustomTypeInfo( const wxString &name , converterToString_t to , converterFromString_t from ) : + wxTypeInfo( wxT_CUSTOM , to , from , name ) + {} +#if wxUSE_UNICODE + wxCustomTypeInfo( const char *name , converterToString_t to , converterFromString_t from ) : + wxTypeInfo( wxT_CUSTOM , to , from , name ) + {} +#endif +} ; + +class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo +{ +public : + typedef void (*converterToLong_t)( const wxxVariant& data , long &result ) ; + typedef void (*converterFromLong_t)( long data , wxxVariant &result ) ; + + wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , + converterToLong_t toLong , converterFromLong_t fromLong , const wxString &name ) : + wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) + { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} + +#if wxUSE_UNICODE + wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , + converterToLong_t toLong , converterFromLong_t fromLong , const char * name ) : + wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) + { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} +#endif + const wxEnumData* GetEnumData() const { return m_enumInfo ; } + + // convert a wxxVariant holding data of this type into a long + void ConvertToLong( const wxxVariant& data , long &result ) const + + { if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ; } + + // convert a long into a wxxVariant holding the corresponding data in this type + void ConvertFromLong( long data , wxxVariant &result ) const + { if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ;} + +private : + converterToLong_t m_toLong ; + converterFromLong_t m_fromLong ; + + wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET +} ; + +class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo +{ +public : + wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString) ; +#if wxUSE_UNICODE + wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name ) ; +#endif + const wxClassInfo *GetClassInfo() const { return m_classInfo ; } +private : + wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL +} ; + +class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo +{ +public : + wxCollectionTypeInfo( const wxString &elementName , converterToString_t to , converterFromString_t from , const wxString &name) : + wxTypeInfo( wxT_COLLECTION , to , from , name ) + { m_elementTypeName = elementName ; m_elementType = NULL ;} +#if wxUSE_UNICODE + wxCollectionTypeInfo( const char *elementName , converterToString_t to , converterFromString_t from , const char *name ) : + wxTypeInfo( wxT_COLLECTION , to , from , name ) + { m_elementTypeName = wxString::FromAscii( elementName ) ; m_elementType = NULL ;} +#endif + const wxTypeInfo* GetElementType() const + { + if ( m_elementType == NULL ) + m_elementType = wxTypeInfo::FindType( m_elementTypeName ) ; + return m_elementType ; } +private : + mutable wxTypeInfo * m_elementType ; + wxString m_elementTypeName ; +} ; + +// a delegate is an exposed event source + +class WXDLLIMPEXP_BASE wxDelegateTypeInfo : public wxTypeInfo +{ +public : + wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; + wxDelegateTypeInfo( int eventType , int lastEventType, wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; + int GetEventType() const { return m_eventType ; } + int GetLastEventType() const { return m_lastEventType ; } + const wxClassInfo* GetEventClass() const { return m_eventClass ; } +private : + const wxClassInfo *m_eventClass; // (extended will merge into classinfo) + int m_eventType ; + int m_lastEventType ; +} ; + +template const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo::FindType(typeid(T).name()) ; } + +// this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type + +#if wxUSE_FUNC_TEMPLATE_POINTER +#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ + wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &toString , &fromString) ; +#else +#define wxCUSTOM_TYPE_INFO( e , toString , fromString ) \ + void ToString##e( const wxxVariant& data , wxString &result ) { toString(data, result); } \ + void FromString##e( const wxString& data , wxxVariant &result ) { fromString(data, result); } \ + wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &ToString##e , &FromString##e) ; +#endif + +#define wxCOLLECTION_TYPE_INFO( element , collection ) \ + wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ; + +// sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs, currently +// we don't have to play tricks, but if we will have to according to the compiler, we will use that macro for that + +#define wxILLEGAL_TYPE_SPECIALIZATION( a ) + +// ---------------------------------------------------------------------------- +// wxxVariant as typesafe data holder +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxxVariantData +{ +public: + virtual ~wxxVariantData() {} + + // return a heap allocated duplicate + virtual wxxVariantData* Clone() const = 0 ; + + // returns the type info of the contentc + virtual const wxTypeInfo* GetTypeInfo() const = 0 ; +} ; + +template class wxxVariantDataT : public wxxVariantData +{ +public: + wxxVariantDataT(const T& d) : m_data(d) {} + virtual ~wxxVariantDataT() {} + + // get a ref to the stored data + T & Get() { return m_data; } + + // get a const ref to the stored data + const T & Get() const { return m_data; } + + // set the data + void Set(const T& d) { m_data = d; } + + // return a heap allocated duplicate + virtual wxxVariantData* Clone() const { return new wxxVariantDataT( Get() ) ; } + + // returns the type info of the contentc + virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ) ; } + +private: + T m_data; +}; + +class WXDLLIMPEXP_BASE wxxVariant +{ +public : + wxxVariant() { m_data = NULL ; } + wxxVariant( wxxVariantData* data , const wxString& name = wxEmptyString ) : m_data(data) , m_name(name) {} + wxxVariant( const wxxVariant &d ) { if ( d.m_data ) m_data = d.m_data->Clone() ; else m_data = NULL ; m_name = d.m_name ; } + + template wxxVariant( const T& data , const wxString& name = wxEmptyString ) : + m_data(new wxxVariantDataT(data) ), m_name(name) {} + + ~wxxVariant() { delete m_data ; } + + // get a ref to the stored data + template T& Get(wxTEMPLATED_MEMBER_FIX(T)) + { + wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; + wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; + return dataptr->Get() ; + } + + // get a ref to the stored data + template const T& Get(wxTEMPLATED_MEMBER_FIX(T)) const + { + const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; + wxASSERT_MSG( dataptr , wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ) ; + return dataptr->Get() ; + } + + bool IsEmpty() const { return m_data == NULL ; } + + template bool HasData(wxTEMPLATED_MEMBER_FIX(T)) const + { + const wxxVariantDataT *dataptr = dynamic_cast*> (m_data) ; + return dataptr != NULL ; + } + + // stores the data + template void Set(const T& data) const + { + delete m_data ; + m_data = new wxxVariantDataT(data) ; + } + + wxxVariant& operator=(const wxxVariant &d) + { + delete m_data; + m_data = d.m_data ? d.m_data->Clone() : NULL ; + m_name = d.m_name ; + return *this ; + } + + // gets the stored data casted to a wxObject* , returning NULL if cast is not possible + wxObject* GetAsObject() ; + + // get the typeinfo of the stored object + const wxTypeInfo* GetTypeInfo() const { return m_data->GetTypeInfo() ; } + + // returns this value as string + wxString GetAsString() const + { + wxString s ; + GetTypeInfo()->ConvertToString( *this , s ) ; + return s ; + } + const wxString& GetName() const { return m_name ; } +private : + wxxVariantData* m_data ; + wxString m_name ; +} ; + +#include "wx/dynarray.h" + +WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE); + +// templated streaming, every type must have their specialization for these methods + +template +void wxStringReadValue( const wxString &s , T &data ); + +template +void wxStringWriteValue( wxString &s , const T &data); + +template +void wxToStringConverter( const wxxVariant &v, wxString &s wxTEMPLATED_FUNCTION_FIX(T)) { wxStringWriteValue( s , v.wxTEMPLATED_MEMBER_CALL(Get , T) ) ; } + +template +void wxFromStringConverter( const wxString &s, wxxVariant &v wxTEMPLATED_FUNCTION_FIX(T)) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } + +// ---------------------------------------------------------------------------- +// Property Support +// +// wxPropertyInfo is used to inquire of the property by name. It doesn't +// provide access to the property, only information about it. If you +// want access, look at wxPropertyAccessor. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSetter +{ +public: + wxSetter( const wxString name ) { m_name = name ; } + virtual ~wxSetter() {} + virtual void Set( wxObject *object, const wxxVariant &variantValue ) const = 0; + const wxString& GetName() const { return m_name ; } +private: + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxGetter +{ +public: + wxGetter( const wxString name ) { m_name = name ; } + virtual ~wxGetter() {} + virtual void Get( const wxObject *object , wxxVariant& result) const = 0; + const wxString& GetName() const { return m_name ; } +private: + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxCollectionGetter +{ +public : + wxCollectionGetter( const wxString name ) { m_name = name ; } + virtual ~wxCollectionGetter() {} + virtual void Get( const wxObject *object , wxxVariantArray& result) const = 0; + const wxString& GetName() const { return m_name ; } +private : + wxString m_name ; +} ; + +template void WXDLLIMPEXP_BASE wxCollectionToVariantArray( const coll_t& coll , wxxVariantArray& result ) ; + +class WXDLLIMPEXP_BASE wxAdder +{ +public : + wxAdder( const wxString name ) { m_name = name ; } + virtual ~wxAdder() {} + virtual void Add( wxObject *object, const wxxVariant &variantValue ) const= 0; + const wxString& GetName() const { return m_name ; } +private : + wxString m_name ; +} ; + + +#define wxSETTER( property, Klass, valueType, setterMethod ) \ +class wxSetter##property : public wxSetter \ +{ \ +public: \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxSetter##property() : wxSetter( wxT(#setterMethod) ) {} \ + virtual ~wxSetter##property() {} \ + void Set( wxObject *object, const wxxVariant &variantValue ) const \ +{ \ + Klass *obj = dynamic_cast(object) ; \ + if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ + obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ + else \ + obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ +} \ +} ; + +#define wxGETTER( property, Klass, valueType , gettermethod ) \ +class wxGetter##property : public wxGetter \ +{ \ +public : \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxGetter##property() : wxGetter( wxT(#gettermethod) ) {} \ + virtual ~wxGetter##property() {} \ + void Get( const wxObject *object , wxxVariant &result) const \ +{ \ + const Klass *obj = dynamic_cast(object) ; \ + result = wxxVariant( obj->gettermethod() ) ; \ +} \ +} ; + +#define wxADDER( property, Klass, valueType , addermethod ) \ +class wxAdder##property : public wxAdder \ +{ \ +public: \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxAdder##property() : wxAdder( wxT(#addermethod) ) {} \ + virtual ~wxAdder##property() {} \ + void Add( wxObject *object, const wxxVariant &variantValue ) const \ +{ \ + Klass *obj = dynamic_cast(object) ; \ + if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ + obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType)) ; \ + else \ + obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get , valueType*)) ; \ +} \ +} ; + +#define wxCOLLECTION_GETTER( property, Klass, valueType , gettermethod ) \ +class wxCollectionGetter##property : public wxCollectionGetter \ +{ \ +public : \ + wxINFUNC_CLASS_TYPE_FIX(Klass) \ + wxCollectionGetter##property() : wxCollectionGetter( wxT(#gettermethod) ) {} \ + virtual ~wxCollectionGetter##property() {} \ + void Get( const wxObject *object , wxxVariantArray &result) const \ +{ \ + const Klass *obj = dynamic_cast(object) ; \ + wxCollectionToVariantArray( obj->gettermethod() , result ) ; \ +} \ +} ; + +class WXDLLIMPEXP_BASE wxPropertyAccessor +{ +public : + wxPropertyAccessor( wxSetter *setter , wxGetter *getter , wxAdder *adder , wxCollectionGetter *collectionGetter ) + { m_setter = setter ; m_getter = getter ; m_adder = adder ; m_collectionGetter = collectionGetter ;} + + virtual ~wxPropertyAccessor() {} + + // Setting a simple property (non-collection) + virtual void SetProperty(wxObject *object, const wxxVariant &value) const + { if ( m_setter ) m_setter->Set( object , value ) ; else wxLogError( _("SetProperty called w/o valid setter") ) ;} + + // Getting a simple property (non-collection) + virtual void GetProperty(const wxObject *object, wxxVariant &result) const + { if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( _("GetProperty called w/o valid getter") ) ;} + + // Adding an element to a collection property + virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const + { if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( _("AddToPropertyCollection called w/o valid adder") ) ;} + + // Getting a collection property + virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const + { if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( _("GetPropertyCollection called w/o valid collection getter") ) ;} + + virtual bool HasSetter() const { return m_setter != NULL ; } + virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; } + virtual bool HasGetter() const { return m_getter != NULL ; } + virtual bool HasAdder() const { return m_adder != NULL ; } + + virtual const wxString& GetCollectionGetterName() const + { return m_collectionGetter->GetName() ; } + virtual const wxString& GetGetterName() const + { return m_getter->GetName() ; } + virtual const wxString& GetSetterName() const + { return m_setter->GetName() ; } + virtual const wxString& GetAdderName() const + { return m_adder->GetName() ; } + +protected : + wxSetter *m_setter ; + wxAdder *m_adder ; + wxGetter *m_getter ; + wxCollectionGetter* m_collectionGetter ; +}; + +class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor +{ +public : + wxGenericPropertyAccessor( const wxString &propName ) ; + virtual ~wxGenericPropertyAccessor() ; + + void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName), + const wxString& newName ) + { + wxASSERT( oldName == m_propertyName ) ; m_propertyName = newName ; + } + virtual bool HasSetter() const { return true ; } + virtual bool HasGetter() const { return true ; } + virtual bool HasAdder() const { return false ; } + virtual bool HasCollectionGetter() const { return false ; } + + virtual const wxString& GetGetterName() const + { return m_getterName ; } + virtual const wxString& GetSetterName() const + { return m_setterName ; } + + virtual void SetProperty(wxObject *object, const wxxVariant &value) const ; + virtual void GetProperty(const wxObject *object, wxxVariant &value) const ; + + // Adding an element to a collection property + virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const + { wxLogError( _("AddToPropertyCollection called on a generic accessor") ) ;} + + // Getting a collection property + virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const + { wxLogError ( _("GetPropertyCollection called on a generic accessor") ) ;} +private : + struct wxGenericPropertyAccessorInternal ; + wxGenericPropertyAccessorInternal* m_data ; + wxString m_propertyName ; + wxString m_setterName ; + wxString m_getterName ; +} ; + +typedef long wxPropertyInfoFlags ; +enum { + // will be removed in future releases + wxPROP_DEPRECATED = 0x00000001 , + // object graph property, will be streamed with priority (after constructor properties) + wxPROP_OBJECT_GRAPH = 0x00000002 , + // this will only be streamed out and in as enum/set, the internal representation is still a long + wxPROP_ENUM_STORE_LONG = 0x00000004 , + // don't stream out this property, needed eg to avoid streaming out children that are always created by their parents + wxPROP_DONT_STREAM = 0x00000008 , +} ; + +class WXDLLIMPEXP_BASE wxPropertyInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; +public : + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + const wxString& typeName, + wxPropertyAccessor *accessor, + wxxVariant dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(typeName) , + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + +#if wxUSE_UNICODE + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + const char* typeName, + wxPropertyAccessor *accessor, + wxxVariant dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(wxString::FromAscii(typeName)) , + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } +#endif + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + wxDelegateTypeInfo* type, + wxPropertyAccessor *accessor, + wxxVariant dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(type), + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, const wxString& name, + const wxString& collectionTypeName, + const wxString& elementTypeName, + wxPropertyAccessor *accessor, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(collectionTypeName) , + m_collectionElementTypeInfo(NULL), + m_collectionElementTypeName(elementTypeName), + m_accessor(accessor) , + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + +#if wxUSE_UNICODE + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, const wxString& name, + const char* collectionTypeName, + const char* elementTypeName, + wxPropertyAccessor *accessor, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(wxString::FromAscii(collectionTypeName)) , + m_collectionElementTypeInfo(NULL), + m_collectionElementTypeName(wxString::FromAscii(elementTypeName)), + m_accessor(accessor) , + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } +#endif + ~wxPropertyInfo() ; + + // return the class this property is declared in + const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } + + // return the name of this property + const wxString& GetName() const { return m_name ; } + + // returns the flags of this property + wxPropertyInfoFlags GetFlags() const { return m_flags ;} + + // returns the short help string of this property + const wxString& GetHelpString() const { return m_helpString ; } + + // returns the group string of this property + const wxString& GetGroupString() const { return m_groupString ; } + + // return the element type info of this property (for collections, otherwise NULL) + const wxTypeInfo * GetCollectionElementTypeInfo() const + { + if ( m_collectionElementTypeInfo == NULL ) + m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName) ; + return m_collectionElementTypeInfo ; + } + + // return the type info of this property + const wxTypeInfo * GetTypeInfo() const + { + if ( m_typeInfo == NULL ) + m_typeInfo = wxTypeInfo::FindType(m_typeName) ; + return m_typeInfo ; + } + + // return the accessor for this property + wxPropertyAccessor* GetAccessor() const { return m_accessor ; } + + // returns NULL if this is the last property of this class + wxPropertyInfo* GetNext() const { return m_next ; } + + // returns the default value of this property, its kind may be wxT_VOID if it is not valid + wxxVariant GetDefaultValue() const { return m_defaultValue ; } +private : + void Insert(wxPropertyInfo* &iter) + { + m_next = NULL ; + if ( iter == NULL ) + iter = this ; + else + { + wxPropertyInfo* i = iter ; + while( i->m_next ) + i = i->m_next ; + + i->m_next = this ; + } + } + + wxClassInfo* m_itsClass ; + wxString m_name ; + mutable wxTypeInfo* m_typeInfo ; + wxString m_typeName ; + mutable wxTypeInfo* m_collectionElementTypeInfo ; + wxString m_collectionElementTypeName ; + wxPropertyAccessor* m_accessor ; + wxxVariant m_defaultValue; + wxPropertyInfoFlags m_flags ; + wxString m_helpString ; + wxString m_groupString ; + // string representation of the default value + // to be assigned by the designer to the property + // when the component is dropped on the container. + wxPropertyInfo* m_next ; +}; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo* , wxPropertyInfoMap , class WXDLLIMPEXP_BASE ) ; + +#define wxBEGIN_PROPERTIES_TABLE(theClass) \ + wxPropertyInfo *theClass::GetPropertiesStatic() \ +{ \ + typedef theClass class_t; \ + static wxPropertyInfo* first = NULL ; + +#define wxEND_PROPERTIES_TABLE() \ + return first ; } + +#define wxHIDE_PROPERTY( pname ) \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(void).name() ,NULL , wxxVariant() , wxPROP_DONT_STREAM , wxEmptyString , wxEmptyString ) ; + +#define wxPROPERTY( pname , type , setter , getter , defaultValue , flags , help , group) \ + wxSETTER( pname , class_t , type , setter ) \ + static wxSetter##pname _setter##pname ; \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue) , flags , group , help ) ; + +#define wxPROPERTY_FLAGS( pname , flags , type , setter , getter ,defaultValue , pflags , help , group) \ + wxSETTER( pname , class_t , type , setter ) \ + static wxSetter##pname _setter##pname ; \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; + +#define wxREADONLY_PROPERTY( pname , type , getter ,defaultValue , flags , help , group) \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue), flags , help , group ) ; + +#define wxREADONLY_PROPERTY_FLAGS( pname , flags , type , getter ,defaultValue , pflags , help , group) \ + wxGETTER( pname , class_t , type , getter ) \ + static wxGetter##pname _getter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; + +#define wxPROPERTY_COLLECTION( pname , colltype , addelemtype , adder , getter , flags , help , group ) \ + wxADDER( pname , class_t , addelemtype , adder ) \ + static wxAdder##pname _adder##pname ; \ + wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ + static wxCollectionGetter##pname _collectionGetter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , NULL ,&_adder##pname , &_collectionGetter##pname ) ; \ + static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; + +#define wxREADONLY_PROPERTY_COLLECTION( pname , colltype , addelemtype , getter , flags , help , group) \ + wxCOLLECTION_GETTER( pname , class_t , colltype , getter ) \ + static wxCollectionGetter##pname _collectionGetter##pname ; \ + static wxPropertyAccessor _accessor##pname( NULL , NULL , NULL , &_collectionGetter##pname ) ; \ + static wxPropertyInfo _propertyInfo##pname( first ,class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; + + +#define wxEVENT_PROPERTY( name , eventType , eventClass ) \ + static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \ + static wxPropertyInfo _propertyInfo##name( first ,class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ + +#define wxEVENT_RANGE_PROPERTY( name , eventType , lastEventType , eventClass ) \ + static wxDelegateTypeInfo _typeInfo##name( eventType , lastEventType , CLASSINFO( eventClass ) ) ; \ + static wxPropertyInfo _propertyInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ + +// ---------------------------------------------------------------------------- +// Implementation Helper for Simple Properties +// ---------------------------------------------------------------------------- + +#define wxIMPLEMENT_PROPERTY(name, type) \ +private:\ + type m_##name; \ +public: \ + void Set##name( type const & p) { m_##name = p; } \ + type const & Get##name() const { return m_##name; } + +// ---------------------------------------------------------------------------- +// Handler Info +// +// this is describing an event sink +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxHandlerInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; +public : + wxHandlerInfo(wxHandlerInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + wxObjectEventFunction address, + const wxClassInfo* eventClassInfo) : + m_eventFunction(address), + m_name(name), + m_eventClassInfo(eventClassInfo) , + m_itsClass(itsClass) + { + m_next = NULL ; + if ( iter == NULL ) + iter = this ; + else + { + wxHandlerInfo* i = iter ; + while( i->m_next ) + i = i->m_next ; + + i->m_next = this ; + } + } + + ~wxHandlerInfo() ; + + // return the name of this handler + const wxString& GetName() const { return m_name ; } + + // return the class info of the event + const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo ; } + + // get the handler function pointer + wxObjectEventFunction GetEventFunction() const { return m_eventFunction ; } + + // returns NULL if this is the last handler of this class + wxHandlerInfo* GetNext() const { return m_next ; } + + // return the class this property is declared in + const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } + +private : + wxObjectEventFunction m_eventFunction ; + wxString m_name; + const wxClassInfo* m_eventClassInfo ; + wxHandlerInfo* m_next ; + wxClassInfo* m_itsClass ; +}; + +#define wxHANDLER(name,eventClassType) \ + static wxHandlerInfo _handlerInfo##name( first , class_t::GetClassInfoStatic() , wxT(#name) , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ; + +#define wxBEGIN_HANDLERS_TABLE(theClass) \ + wxHandlerInfo *theClass::GetHandlersStatic() \ +{ \ + typedef theClass class_t; \ + static wxHandlerInfo* first = NULL ; + +#define wxEND_HANDLERS_TABLE() \ + return first ; } + +// ---------------------------------------------------------------------------- +// Constructor Bridges +// +// allow to set up constructors with params during runtime +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConstructorBridge +{ +public : + virtual void Create(wxObject * &o, wxxVariant *args) = 0; +}; + +// a direct constructor bridge calls the operator new for this class and +// passes all params to the constructor. needed for classes that cannot be +// instantiated using alloc-create semantics +class WXDLLIMPEXP_BASE wxDirectConstructorBrigde : public wxConstructorBridge +{ +public : + virtual void Create(wxObject * &o, wxxVariant *args) = 0; +} ; + +// Creator Bridges for all Numbers of Params + +// no params + +template +struct wxConstructorBridge_0 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *) + { + Class *obj = dynamic_cast(o); + obj->Create(); + } +}; + +struct wxConstructorBridge_Dummy : public wxConstructorBridge +{ + void Create(wxObject *&, wxxVariant *) + { + } +} ; + +#define wxCONSTRUCTOR_0(klass) \ + wxConstructorBridge_0 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ + const int klass::ms_constructorPropertiesCount = 0 ; + +#define wxCONSTRUCTOR_DUMMY(klass) \ + wxConstructorBridge_Dummy constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { NULL } ; \ + const int klass::ms_constructorPropertiesCount = 0 ; + +// 1 param + +template +struct wxConstructorBridge_1 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) + ); + } +}; + +#define wxCONSTRUCTOR_1(klass,t0,v0) \ + wxConstructorBridge_1 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) } ; \ + const int klass::ms_constructorPropertiesCount = 1 ; + +// 2 params + +template +struct wxConstructorBridge_2 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) + ); + } +}; + +#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxConstructorBridge_2 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ + const int klass::ms_constructorPropertiesCount = 2; + +// direct constructor version + +template +struct wxDirectConstructorBridge_2 : public wxDirectConstructorBrigde +{ + void Create(wxObject * &o, wxxVariant *args) + { + o = new Class( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) + ); + } +}; + +#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxDirectConstructorBridge_2 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) } ; \ + const int klass::ms_constructorPropertiesCount = 2; + + +// 3 params + +template +struct wxConstructorBridge_3 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) + ); + } +}; + +#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxConstructorBridge_3 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ + const int klass::ms_constructorPropertiesCount = 3 ; + +// direct constructor version + +template +struct wxDirectConstructorBridge_3 : public wxDirectConstructorBrigde +{ + void Create(wxObject * &o, wxxVariant *args) + { + o = new Class( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) + ); + } +}; + +#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxDirectConstructorBridge_3 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ + const int klass::ms_constructorPropertiesCount = 3; + +// 4 params + +template +struct wxConstructorBridge_4 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) + ); + } +}; + +#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ + wxConstructorBridge_4 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) } ; \ + const int klass::ms_constructorPropertiesCount = 4 ; + +// 5 params + +template +struct wxConstructorBridge_5 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) + ); + } +}; + +#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ + wxConstructorBridge_5 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) } ; \ + const int klass::ms_constructorPropertiesCount = 5; + +// 6 params + +template +struct wxConstructorBridge_6 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) + ); + } +}; + +#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxConstructorBridge_6 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ + const int klass::ms_constructorPropertiesCount = 6; + +// direct constructor version + +template +struct wxDirectConstructorBridge_6 : public wxDirectConstructorBrigde +{ + void Create(wxObject * &o, wxxVariant *args) + { + o = new Class( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) + ); + } +}; + +#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxDirectConstructorBridge_6 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ + const int klass::ms_constructorPropertiesCount = 6; + +// 7 params + +template +struct wxConstructorBridge_7 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , + args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) + ); + } +}; + +#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ + wxConstructorBridge_7 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) } ; \ + const int klass::ms_constructorPropertiesCount = 7; + +// 8 params + +template +struct wxConstructorBridge_8 : public wxConstructorBridge +{ + void Create(wxObject * &o, wxxVariant *args) + { + Class *obj = dynamic_cast(o); + obj->Create( + args[0].wxTEMPLATED_MEMBER_CALL(Get , T0) , + args[1].wxTEMPLATED_MEMBER_CALL(Get , T1) , + args[2].wxTEMPLATED_MEMBER_CALL(Get , T2) , + args[3].wxTEMPLATED_MEMBER_CALL(Get , T3) , + args[4].wxTEMPLATED_MEMBER_CALL(Get , T4) , + args[5].wxTEMPLATED_MEMBER_CALL(Get , T5) , + args[6].wxTEMPLATED_MEMBER_CALL(Get , T6) , + args[7].wxTEMPLATED_MEMBER_CALL(Get , T7) + ); + } +}; + +#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ + wxConstructorBridge_8 constructor##klass ; \ + wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) , wxT(#v7) } ; \ + const int klass::ms_constructorPropertiesCount = 8; +// ---------------------------------------------------------------------------- +// wxClassInfo +// ---------------------------------------------------------------------------- + +typedef wxObject *(*wxObjectConstructorFn)(void); +typedef wxObject* (*wxVariantToObjectConverter)( wxxVariant &data ) ; +typedef wxxVariant (*wxObjectToVariantConverter)( wxObject* ) ; + +class WXDLLIMPEXP_BASE wxWriter; +class WXDLLIMPEXP_BASE wxPersister; + +typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxWriter * , wxPersister * , wxxVariantArray & ) ; + +class WXDLLIMPEXP_BASE wxClassInfo +{ + friend class WXDLLIMPEXP_BASE wxPropertyInfo ; + friend class WXDLLIMPEXP_BASE wxHandlerInfo ; +public: + wxClassInfo(const wxClassInfo **_Parents, + const wxChar *_UnitName, + const wxChar *_ClassName, + int size, + wxObjectConstructorFn ctor , + wxPropertyInfo *_Props , + wxHandlerInfo *_Handlers , + wxConstructorBridge* _Constructor , + const wxChar ** _ConstructorProperties , + const int _ConstructorPropertiesCount , + wxVariantToObjectConverter _PtrConverter1 , + wxVariantToObjectConverter _Converter2 , + wxObjectToVariantConverter _Converter3 , + wxObjectStreamingCallback _streamingCallback = NULL + ) : + + m_className(_ClassName), + m_objectSize(size), + m_objectConstructor(ctor), + m_next(sm_first), + m_firstProperty(_Props), + m_firstHandler(_Handlers), + m_parents(_Parents), + m_unitName(_UnitName), + m_constructor(_Constructor), + m_constructorProperties(_ConstructorProperties), + m_constructorPropertiesCount(_ConstructorPropertiesCount), + m_variantOfPtrToObjectConverter(_PtrConverter1), + m_variantToObjectConverter(_Converter2), + m_objectToVariantConverter(_Converter3), + m_streamingCallback(_streamingCallback) + { + sm_first = this; + Register() ; + } + + wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, + const wxClassInfo **_Parents) : + m_className(_ClassName), + m_objectSize(0), + m_objectConstructor(NULL), + m_next(sm_first), + m_firstProperty(NULL), + m_firstHandler(NULL), + m_parents(_Parents), + m_unitName(_UnitName), + m_constructor(NULL), + m_constructorProperties(NULL), + m_constructorPropertiesCount(0), + m_variantOfPtrToObjectConverter(NULL), + m_variantToObjectConverter(NULL), + m_objectToVariantConverter(NULL), + m_streamingCallback(NULL) + { + sm_first = this; + Register() ; + } + + virtual ~wxClassInfo() ; + + // allocates an instance of this class, this object does not have to be initialized or fully constructed + // as this call will be followed by a call to Create + virtual wxObject *AllocateObject() const { return m_objectConstructor ? (*m_objectConstructor)() : 0; } + + // 'old naming' for AllocateObject staying here for backward compatibility + wxObject *CreateObject() const { return AllocateObject() ; } + + // direct construction call for classes that cannot construct instances via alloc/create + wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const + { + if ( ParamCount != m_constructorPropertiesCount ) + { + wxLogError( _("Illegal Parameter Count for ConstructObject Method") ) ; + return NULL ; + } + wxObject *object = NULL ; + m_constructor->Create( object , Params ) ; + return object ; + } + + bool NeedsDirectConstruction() const { return dynamic_cast( m_constructor) != NULL ; } + + const wxChar *GetClassName() const { return m_className; } + const wxChar *GetBaseClassName1() const + { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } + const wxChar *GetBaseClassName2() const + { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } + const wxChar *GetIncludeName() const { return m_unitName ; } + const wxClassInfo **GetParents() const { return m_parents; } + int GetSize() const { return m_objectSize; } + bool IsDynamic() const { return (NULL != m_objectConstructor); } + + wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } + static const wxClassInfo *GetFirst() { return sm_first; } + const wxClassInfo *GetNext() const { return m_next; } + static wxClassInfo *FindClass(const wxChar *className); + + // Climb upwards through inheritance hierarchy. + // Dual inheritance is catered for. + + bool IsKindOf(const wxClassInfo *info) const + { + if ( info != 0 ) + { + if ( info == this ) + return true ; + + for ( int i = 0 ; m_parents[i] ; ++ i ) + { + if ( m_parents[i]->IsKindOf( info ) ) + return true ; + } + } + return false ; + } + + // if there is a callback registered with that class it will be called + // before this object will be written to disk, it can veto streaming out + // this object by returning false, if this class has not registered a + // callback, the search will go up the inheritance tree if no callback has + // been registered true will be returned by default + bool BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const ; + + // gets the streaming callback from this class or any superclass + wxObjectStreamingCallback GetStreamingCallback() const ; + +#if WXWIN_COMPATIBILITY_2_4 + // Initializes parent pointers and hash table for fast searching. + wxDEPRECATED( static void InitializeClasses() ); + // Cleans up hash table used for fast searching. + wxDEPRECATED( static void CleanUpClasses() ); +#endif + static void CleanUp(); + + // returns the first property + const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; } + + // returns the first handler + const wxHandlerInfo* GetFirstHandler() const { return m_firstHandler ; } + + // Call the Create upon an instance of the class, in the end the object is fully + // initialized + virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const + { + if ( ParamCount != m_constructorPropertiesCount ) + { + wxLogError( _("Illegal Parameter Count for Create Method") ) ; + return ; + } + m_constructor->Create( object , Params ) ; + } + + // get number of parameters for constructor + virtual int GetCreateParamCount() const { return m_constructorPropertiesCount; } + + // get n-th constructor parameter + virtual const wxChar* GetCreateParamName(int n) const { return m_constructorProperties[n] ; } + + // Runtime access to objects for simple properties (get/set) by property name, and variant data + virtual void SetProperty (wxObject *object, const wxChar *propertyName, const wxxVariant &value) const ; + virtual wxxVariant GetProperty (wxObject *object, const wxChar *propertyName) const; + + // Runtime access to objects for collection properties by property name + virtual wxxVariantArray GetPropertyCollection(wxObject *object, const wxChar *propertyName) const ; + virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ; + + // we must be able to cast variants to wxObject pointers, templates seem not to be suitable + wxObject* VariantToInstance( wxxVariant &data ) const + { + if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) + return m_variantToObjectConverter( data ) ; + else + return m_variantOfPtrToObjectConverter( data ) ; + } + + wxxVariant InstanceToVariant( wxObject *object ) const { return m_objectToVariantConverter( object ) ; } + + // find property by name + virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const ; + + // find handler by name + virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *PropertyName) const ; + + // find property by name + virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const ; + + // find handler by name + virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *PropertyName) const ; + + // puts all the properties of this class and its superclasses in the map, as long as there is not yet + // an entry with the same name (overriding mechanism) + void GetProperties( wxPropertyInfoMap &map ) const ; +public: + const wxChar *m_className; + int m_objectSize; + wxObjectConstructorFn m_objectConstructor; + + // class info object live in a linked list: + // pointers to its head and the next element in it + + static wxClassInfo *sm_first; + wxClassInfo *m_next; + + // FIXME: this should be private (currently used directly by way too + // many clients) + static wxHashTable *sm_classTable; + +protected : + wxPropertyInfo * m_firstProperty ; + wxHandlerInfo * m_firstHandler ; +private: + const wxClassInfo** m_parents ; + const wxChar* m_unitName; + + wxConstructorBridge* m_constructor ; + const wxChar ** m_constructorProperties ; + const int m_constructorPropertiesCount ; + wxVariantToObjectConverter m_variantOfPtrToObjectConverter ; + wxVariantToObjectConverter m_variantToObjectConverter ; + wxObjectToVariantConverter m_objectToVariantConverter ; + wxObjectStreamingCallback m_streamingCallback ; + const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const ; + + + // InitializeClasses() helper + static wxClassInfo *GetBaseByName(const wxChar *name) ; + +protected: + // registers the class + void Register(); + void Unregister(); + + DECLARE_NO_COPY_CLASS(wxClassInfo) +}; + + +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); + +// ---------------------------------------------------------------------------- +// wxDynamicObject +// ---------------------------------------------------------------------------- +// +// this object leads to having a pure runtime-instantiation + +class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicObject ; +public : + wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ; + virtual ~wxDynamicClassInfo() ; + + // constructs a wxDynamicObject with an instance + virtual wxObject *AllocateObject() const ; + + // Call the Create method for a class + virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const ; + + // get number of parameters for constructor + virtual int GetCreateParamCount() const ; + + // get i-th constructor parameter + virtual const wxChar* GetCreateParamName(int i) const ; + + // Runtime access to objects by property name, and variant data + virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value) const ; + virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName) const ; + + // adds a property to this class at runtime + void AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) ; + + // removes an existing runtime-property + void RemoveProperty( const wxChar *propertyName ) ; + + // renames an existing runtime-property + void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; + + // as a handler to this class at runtime + void AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) ; + + // removes an existing runtime-handler + void RemoveHandler( const wxChar *handlerName ) ; + + // renames an existing runtime-handler + void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ; +private : + struct wxDynamicClassInfoInternal ; + wxDynamicClassInfoInternal* m_data ; +} ; + +// ---------------------------------------------------------------------------- +// Dynamic class macros +// ---------------------------------------------------------------------------- + +#define _DECLARE_DYNAMIC_CLASS(name) \ + public: \ + static wxClassInfo ms_classInfo; \ + static const wxClassInfo* ms_classParents[] ; \ + static wxPropertyInfo* GetPropertiesStatic() ; \ + static wxHandlerInfo* GetHandlersStatic() ; \ + static wxClassInfo *GetClassInfoStatic() \ +{ return &name::ms_classInfo; } \ + virtual wxClassInfo *GetClassInfo() const \ +{ return &name::ms_classInfo; } + +/* +#define _DECLARE_DYNAMIC_CLASS(name) \ + public: \ + static wxClassInfo ms_class##name; \ + static const wxClassInfo* ms_classParents##name[] ; \ + static wxPropertyInfo* GetPropertiesStatic() ; \ + static wxHandlerInfo* GetHandlersStatic() ; \ + static wxClassInfo *GetClassInfoStatic() \ +{ return &name::ms_class##name; } \ + virtual wxClassInfo *GetClassInfo() const \ +{ return &name::ms_class##name; } +*/ +#define DECLARE_DYNAMIC_CLASS(name) \ + static wxConstructorBridge* ms_constructor ; \ + static const wxChar * ms_constructorProperties[] ; \ + static const int ms_constructorPropertiesCount ; \ + _DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + DECLARE_NO_ASSIGN_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + DECLARE_NO_COPY_CLASS(name) \ + DECLARE_DYNAMIC_CLASS(name) + +#define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) +#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) + +// ----------------------------------- +// for concrete classes +// ----------------------------------- + +// Single inheritance with one base class + +#define _TYPEINFO_CLASSES(n , toString , fromString ) \ + wxClassTypeInfo s_typeInfo##n(wxT_OBJECT , &n::ms_classInfo , toString , fromString , typeid(n).name()) ; \ + wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR , &n::ms_classInfo , toString , fromString , typeid(n*).name()) ; + +#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit , callback) \ + wxObject* wxConstructorFor##name() \ +{ return new name; } \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) wxConstructorFor##name , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ + name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name , callback); + +#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ + wxObject* wxConstructorFor##name() \ +{ return new name; } \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return &data.wxTEMPLATED_MEMBER_CALL(Get , name) ; } \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) wxConstructorFor##name , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties, \ + name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name, callback); + +#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , "" , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) \ + const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ + const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \ + _IMPLEMENT_DYNAMIC_CLASS( name , basename , "" , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \ + _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name , basename , unit , callback ) \ + _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , &callback ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name , basename , unit ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name , basename , unit , toString , fromString ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ + _TYPEINFO_CLASSES(name, toString , fromString) + +// this is for classes that do not derive from wxobject, there are no creators for these + +#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \ + const wxClassInfo* name::ms_classParents[] = { NULL } ; \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) 0 , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ + 0 , 0 , 0 ); \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +// this is for subclasses that still do not derive from wxobject + +#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) 0 , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ + 0 , 0 , 0 ); \ + _TYPEINFO_CLASSES(name, NULL , NULL) + + +// Multiple inheritance with two base classes + +#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ + wxObject* wxConstructorFor##name() \ +{ return new name; } \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,&basename2::ms_classInfo , NULL } ; \ + wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxT(unit) , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) wxConstructorFor##name , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor , name::ms_constructorProperties , \ + name::ms_constructorPropertiesCount , wxVariantToObjectConverter##name, wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ + +#define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ + _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \ + _TYPEINFO_CLASSES(name, NULL , NULL) \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \ + _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit) \ + _TYPEINFO_CLASSES(name, NULL , NULL) + + +// ----------------------------------- +// for abstract classes +// ----------------------------------- + +// Single inheritance with one base class + +#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \ + wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ + wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \ + (int) sizeof(name), \ + (wxObjectConstructorFn) 0 , \ + name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ + 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ + _TYPEINFO_CLASSES(name, NULL , NULL) + +#define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ + _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } + +// Multiple inheritance with two base classes + +#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ + wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \ + wxT(#basename2), (int) sizeof(name), \ + (wxObjectConstructorFn) 0); + +#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS +#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 + +#define wxBEGIN_EVENT_TABLE( a , b ) BEGIN_EVENT_TABLE( a , b ) +#define wxEND_EVENT_TABLE() END_EVENT_TABLE() + +// -------------------------------------------------------------------------- +// Collection Support +// -------------------------------------------------------------------------- + +template void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) +{ + iter current = coll.GetFirst() ; + while (current) + { + value.Add( new wxxVariant(current->GetData()) ) ; + current = current->GetNext(); + } +} + +template void wxArrayCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) +{ + for( size_t i = 0 ; i < coll.GetCount() ; i++ ) + { + value.Add( new wxxVariant(coll[i]) ) ; + } +} + + +#endif // _WX_XTIH__ diff --git a/Externals/wxWidgets/include/wx/xtistrm.h b/Externals/wxWidgets/include/wx/xtistrm.h index 9d8901a818..6bc902b4d5 100644 --- a/Externals/wxWidgets/include/wx/xtistrm.h +++ b/Externals/wxWidgets/include/wx/xtistrm.h @@ -1,429 +1,429 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xtistrm.h -// Purpose: streaming runtime metadata information (extended class info) -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: xtistrm.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XTISTRMH__ -#define _WX_XTISTRMH__ - -#include "wx/wx.h" - -#if wxUSE_EXTENDED_RTTI - -const int wxInvalidObjectID = -2 ; -const int wxNullObjectID = -3 ; - -// Filer contains the interfaces for streaming objects in and out of XML, -// rendering them either to objects in memory, or to code. Note: We -// consider the process of generating code to be one of *depersisting* the -// object from xml, *not* of persisting the object to code from an object -// in memory. This distincation can be confusing, and should be kept -// in mind when looking at the property streamers and callback interfaces -// listed below. - -/* -Main interfaces for streaming out objects. -*/ - -// ---------------------------------------------------------------------------- -// wxPersister -// -// This class will be asked during the streaming-out process about every single -// property or object instance. It can veto streaming out by returning false -// or modify the value before it is streamed-out. -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxWriter ; -class WXDLLIMPEXP_BASE wxReader ; - -class WXDLLIMPEXP_BASE wxPersister -{ -public : - // will be called before an object is written, may veto by returning false - virtual bool BeforeWriteObject( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object) , const wxClassInfo *WXUNUSED(classInfo) , wxxVariantArray &WXUNUSED(metadata)) { return true ; } - - // will be called after this object has been written, may be needed for adjusting stacks - virtual void AfterWriteObject( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object) , const wxClassInfo *WXUNUSED(classInfo) ) {} - - // will be called before a property gets written, may change the value , eg replace a concrete wxSize by wxSize( wxDefaultCoord , wxDefaultCoord ) or veto - // writing that property at all by returning false - virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariant &WXUNUSED(value) ) { return true ; } - - // will be called before a property gets written, may change the value , eg replace a concrete wxSize by wxSize( wxDefaultCoord , wxDefaultCoord ) or veto - // writing that property at all by returning false - virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariantArray &WXUNUSED(value) ) { return true ; } - - // will be called after a property has been written out, may be needed for adjusting stacks - virtual void AfterWriteProperty( wxWriter *WXUNUSED(writer) , const wxPropertyInfo *WXUNUSED(propInfo) ) {} - - // will be called before this delegate gets written - virtual bool BeforeWriteDelegate( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(propInfo) , - const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { return true ; } - - virtual void AfterWriteDelegate( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(propInfo) , - const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { } -} ; - -class WXDLLIMPEXP_BASE wxWriter : public wxObject -{ -public : - wxWriter() ; - virtual ~wxWriter() ; - - // with this call you start writing out a new top-level object - void WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , const wxString &name , wxxVariantArray &WXUNUSED(metadata)) ; - - // - // Managing the object identity table a.k.a context - // - // these methods make sure that no object gets written twice, because sometimes multiple calls to the WriteObject will be - // made without wanting to have duplicate objects written, the object identity table will be reset manually - - virtual void ClearObjectContext() ; - - // gets the object Id for a passed in object in the context - int GetObjectID(const wxObject *obj) ; - - // returns true if this object has already been written in this context - bool IsObjectKnown( const wxObject *obj ) ; - - // - // streaming callbacks - // - // these callbacks really write out the values in the stream format - - // begins writing out a new toplevel entry which has the indicated unique name - virtual void DoBeginWriteTopLevelEntry( const wxString &name ) = 0 ; - - // ends writing out a new toplevel entry which has the indicated unique name - virtual void DoEndWriteTopLevelEntry( const wxString &name ) = 0 ; - - // start of writing an object having the passed in ID - virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata ) = 0 ; - - // end of writing an toplevel object name param is used for unique identification within the container - virtual void DoEndWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID ) = 0 ; - - // writes a simple property in the stream format - virtual void DoWriteSimpleType( wxxVariant &value ) = 0 ; - - // start of writing a complex property into the stream ( - virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) = 0 ; - - // end of writing a complex property into the stream - virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) = 0; - - virtual void DoBeginWriteElement() = 0 ; - virtual void DoEndWriteElement() = 0 ; - // insert an object reference to an already written object - virtual void DoWriteRepeatedObject( int objectID ) = 0 ; - - // insert a null reference - virtual void DoWriteNullObject() = 0 ; - - // writes a delegate in the stream format - virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo , const wxPropertyInfo *propInfo , - const wxObject *eventSink , int sinkObjectID , const wxClassInfo* eventSinkClassInfo , const wxHandlerInfo* handlerIndo ) = 0; -private : - - struct wxWriterInternal ; - wxWriterInternal* m_data ; - - struct wxWriterInternalPropertiesData ; - - void WriteAllProperties( const wxObject * obj , const wxClassInfo* ci , wxPersister *persister, wxWriterInternalPropertiesData * data ) ; - void WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *data ) ; - void WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded, wxxVariantArray &metadata ) ; - void FindConnectEntry(const wxEvtHandler * evSource,const wxDelegateTypeInfo* dti, const wxObject* &sink , const wxHandlerInfo *&handler) ; -} ; - - -/* -Streaming callbacks for depersisting XML to code, or running objects -*/ - -class WXDLLIMPEXP_BASE wxDepersister ; - -/* -wxReader handles streaming in a class from a arbitrary format. While walking through -it issues calls out to interfaces to depersist the guts from the underlying storage format. -*/ - -class WXDLLIMPEXP_BASE wxReader : public wxObject -{ -public : - wxReader() ; - virtual ~wxReader() ; - - // the only thing wxReader knows about is the class info by object ID - wxClassInfo *GetObjectClassInfo(int objectID) ; - bool HasObjectClassInfo( int objectID ) ; - void SetObjectClassInfo(int objectID, wxClassInfo* classInfo); - - // Reads the component the reader is pointed at from the underlying format. - // The return value is the root object ID, which can - // then be used to ask the depersister about that object - // if there was a problem you will get back wxInvalidObjectID and the current - // error log will carry the problems encoutered - virtual int ReadObject( const wxString &name , wxDepersister *depersist ) = 0 ; - -private : - struct wxReaderInternal; - wxReaderInternal *m_data; -} ; - -// This abstract class matches the allocate-init/create model of creation of objects. -// At runtime, these will create actual instances, and manipulate them. -// When generating code, these will just create statements of C++ -// code to create the objects. - -class WXDLLIMPEXP_BASE wxDepersister -{ -public : - // allocate the new object on the heap, that object will have the passed in ID - virtual void AllocateObject(int objectID, wxClassInfo *classInfo, wxxVariantArray &metadata) = 0; - - // initialize the already allocated object having the ID objectID with the Create method - // creation parameters which are objects are having their Ids passed in objectIDValues - // having objectId <> wxInvalidObjectID - - virtual void CreateObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *VariantValues , - int *objectIDValues , - const wxClassInfo **objectClassInfos , - wxxVariantArray &metadata) = 0; - - // construct the new object on the heap, that object will have the passed in ID (for objects that - // don't support allocate-create type of creation) - // creation parameters which are objects are having their Ids passed in objectIDValues - // having objectId <> wxInvalidObjectID - - virtual void ConstructObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *VariantValues , - int *objectIDValues , - const wxClassInfo **objectClassInfos , - wxxVariantArray &metadata) = 0; - - // destroy the heap-allocated object having the ID objectID, this may be used if an object - // is embedded in another object and set via value semantics, so the intermediate - // object can be destroyed after safely - virtual void DestroyObject(int objectID, wxClassInfo *classInfo) = 0; - - // set the corresponding property - virtual void SetProperty(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &VariantValue) = 0; - - // sets the corresponding property (value is an object) - virtual void SetPropertyAsObject(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) = 0; - - // adds an element to a property collection - virtual void AddToPropertyCollection( int objectID , - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &VariantValue) = 0; - - // sets the corresponding property (value is an object) - virtual void AddToPropertyCollectionAsObject(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) = 0; - - // sets the corresponding event handler - virtual void SetConnect(int EventSourceObjectID, - const wxClassInfo *EventSourceClassInfo, - const wxPropertyInfo *delegateInfo , - const wxClassInfo *EventSinkClassInfo , - const wxHandlerInfo* handlerInfo , - int EventSinkObjectID ) = 0; -}; - -/* -wxRuntimeDepersister implements the callbacks that will depersist -an object into a running memory image, as opposed to writing -C++ initialization code to bring the object to life. -*/ - -class WXDLLIMPEXP_BASE wxRuntimeDepersister : public wxDepersister -{ - struct wxRuntimeDepersisterInternal ; - wxRuntimeDepersisterInternal * m_data ; -public : - wxRuntimeDepersister(); - virtual ~wxRuntimeDepersister(); - - // returns the object having the corresponding ID fully constructed - wxObject *GetObject(int objectID) ; - - // allocate the new object on the heap, that object will have the passed in ID - virtual void AllocateObject(int objectID, wxClassInfo *classInfo , - wxxVariantArray &metadata) ; - - // initialize the already allocated object having the ID objectID with the Create method - // creation parameters which are objects are having their Ids passed in objectIDValues - // having objectId <> wxInvalidObjectID - - virtual void CreateObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *VariantValues , - int *objectIDValues, - const wxClassInfo **objectClassInfos , - wxxVariantArray &metadata - ) ; - - // construct the new object on the heap, that object will have the passed in ID (for objects that - // don't support allocate-create type of creation) - // creation parameters which are objects are having their Ids passed in objectIDValues - // having objectId <> wxInvalidObjectID - - virtual void ConstructObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *VariantValues , - int *objectIDValues , - const wxClassInfo **objectClassInfos , - wxxVariantArray &metadata) ; - - // destroy the heap-allocated object having the ID objectID, this may be used if an object - // is embedded in another object and set via value semantics, so the intermediate - // object can be destroyed after safely - virtual void DestroyObject(int objectID, wxClassInfo *classInfo) ; - - // set the corresponding property - virtual void SetProperty(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &variantValue); - - // sets the corresponding property (value is an object) - virtual void SetPropertyAsObject(int objectId, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) ; - - // adds an element to a property collection - virtual void AddToPropertyCollection( int objectID , - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &VariantValue) ; - - // sets the corresponding property (value is an object) - virtual void AddToPropertyCollectionAsObject(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) ; - - // sets the corresponding event handler - virtual void SetConnect(int eventSourceObjectID, - const wxClassInfo *eventSourceClassInfo, - const wxPropertyInfo *delegateInfo , - const wxClassInfo *eventSinkClassInfo , - const wxHandlerInfo* handlerInfo , - int eventSinkObjectID ) ; -}; - -/* -wxDepersisterCode implements the callbacks that will depersist -an object into a C++ initialization function. this will move to -a utility lib soon -*/ - -class WXDLLIMPEXP_BASE wxTextOutputStream ; - -class WXDLLIMPEXP_BASE wxCodeDepersister : public wxDepersister -{ -private : - struct wxCodeDepersisterInternal ; - wxCodeDepersisterInternal * m_data ; - wxTextOutputStream *m_fp; - wxString ValueAsCode( const wxxVariant ¶m ) ; -public: - wxCodeDepersister(wxTextOutputStream *out); - virtual ~wxCodeDepersister(); - - // allocate the new object on the heap, that object will have the passed in ID - virtual void AllocateObject(int objectID, wxClassInfo *classInfo , - wxxVariantArray &metadata) ; - - // initialize the already allocated object having the ID objectID with the Create method - // creation parameters which are objects are having their Ids passed in objectIDValues - // having objectId <> wxInvalidObjectID - - virtual void CreateObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *variantValues , - int *objectIDValues, - const wxClassInfo **objectClassInfos , - wxxVariantArray &metadata - ) ; - - // construct the new object on the heap, that object will have the passed in ID (for objects that - // don't support allocate-create type of creation) - // creation parameters which are objects are having their Ids passed in objectIDValues - // having objectId <> wxInvalidObjectID - - virtual void ConstructObject(int objectID, - const wxClassInfo *classInfo, - int paramCount, - wxxVariant *VariantValues , - int *objectIDValues , - const wxClassInfo **objectClassInfos , - wxxVariantArray &metadata) ; - - // destroy the heap-allocated object having the ID objectID, this may be used if an object - // is embedded in another object and set via value semantics, so the intermediate - // object can be destroyed after safely - virtual void DestroyObject(int objectID, wxClassInfo *classInfo) ; - - // set the corresponding property - virtual void SetProperty(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &variantValue); - - // sets the corresponding property (value is an object) - virtual void SetPropertyAsObject(int objectId, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) ; - - // adds an element to a property collection - virtual void AddToPropertyCollection( int objectID , - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - const wxxVariant &VariantValue) ; - - // sets the corresponding property (value is an object) - virtual void AddToPropertyCollectionAsObject(int objectID, - const wxClassInfo *classInfo, - const wxPropertyInfo* propertyInfo , - int valueObjectId) ; - - // sets the corresponding event handler - virtual void SetConnect(int eventSourceObjectID, - const wxClassInfo *eventSourceClassInfo, - const wxPropertyInfo *delegateInfo , - const wxClassInfo *eventSinkClassInfo , - const wxHandlerInfo* handlerInfo , - int eventSinkObjectID ) ; -}; - -#endif // wxUSE_EXTENDED_RTTI - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtistrm.h +// Purpose: streaming runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// RCS-ID: $Id: xtistrm.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTISTRMH__ +#define _WX_XTISTRMH__ + +#include "wx/wx.h" + +#if wxUSE_EXTENDED_RTTI + +const int wxInvalidObjectID = -2 ; +const int wxNullObjectID = -3 ; + +// Filer contains the interfaces for streaming objects in and out of XML, +// rendering them either to objects in memory, or to code. Note: We +// consider the process of generating code to be one of *depersisting* the +// object from xml, *not* of persisting the object to code from an object +// in memory. This distincation can be confusing, and should be kept +// in mind when looking at the property streamers and callback interfaces +// listed below. + +/* +Main interfaces for streaming out objects. +*/ + +// ---------------------------------------------------------------------------- +// wxPersister +// +// This class will be asked during the streaming-out process about every single +// property or object instance. It can veto streaming out by returning false +// or modify the value before it is streamed-out. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxWriter ; +class WXDLLIMPEXP_BASE wxReader ; + +class WXDLLIMPEXP_BASE wxPersister +{ +public : + // will be called before an object is written, may veto by returning false + virtual bool BeforeWriteObject( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object) , const wxClassInfo *WXUNUSED(classInfo) , wxxVariantArray &WXUNUSED(metadata)) { return true ; } + + // will be called after this object has been written, may be needed for adjusting stacks + virtual void AfterWriteObject( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object) , const wxClassInfo *WXUNUSED(classInfo) ) {} + + // will be called before a property gets written, may change the value , eg replace a concrete wxSize by wxSize( wxDefaultCoord , wxDefaultCoord ) or veto + // writing that property at all by returning false + virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariant &WXUNUSED(value) ) { return true ; } + + // will be called before a property gets written, may change the value , eg replace a concrete wxSize by wxSize( wxDefaultCoord , wxDefaultCoord ) or veto + // writing that property at all by returning false + virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariantArray &WXUNUSED(value) ) { return true ; } + + // will be called after a property has been written out, may be needed for adjusting stacks + virtual void AfterWriteProperty( wxWriter *WXUNUSED(writer) , const wxPropertyInfo *WXUNUSED(propInfo) ) {} + + // will be called before this delegate gets written + virtual bool BeforeWriteDelegate( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(propInfo) , + const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { return true ; } + + virtual void AfterWriteDelegate( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(propInfo) , + const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { } +} ; + +class WXDLLIMPEXP_BASE wxWriter : public wxObject +{ +public : + wxWriter() ; + virtual ~wxWriter() ; + + // with this call you start writing out a new top-level object + void WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , const wxString &name , wxxVariantArray &WXUNUSED(metadata)) ; + + // + // Managing the object identity table a.k.a context + // + // these methods make sure that no object gets written twice, because sometimes multiple calls to the WriteObject will be + // made without wanting to have duplicate objects written, the object identity table will be reset manually + + virtual void ClearObjectContext() ; + + // gets the object Id for a passed in object in the context + int GetObjectID(const wxObject *obj) ; + + // returns true if this object has already been written in this context + bool IsObjectKnown( const wxObject *obj ) ; + + // + // streaming callbacks + // + // these callbacks really write out the values in the stream format + + // begins writing out a new toplevel entry which has the indicated unique name + virtual void DoBeginWriteTopLevelEntry( const wxString &name ) = 0 ; + + // ends writing out a new toplevel entry which has the indicated unique name + virtual void DoEndWriteTopLevelEntry( const wxString &name ) = 0 ; + + // start of writing an object having the passed in ID + virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata ) = 0 ; + + // end of writing an toplevel object name param is used for unique identification within the container + virtual void DoEndWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID ) = 0 ; + + // writes a simple property in the stream format + virtual void DoWriteSimpleType( wxxVariant &value ) = 0 ; + + // start of writing a complex property into the stream ( + virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) = 0 ; + + // end of writing a complex property into the stream + virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) = 0; + + virtual void DoBeginWriteElement() = 0 ; + virtual void DoEndWriteElement() = 0 ; + // insert an object reference to an already written object + virtual void DoWriteRepeatedObject( int objectID ) = 0 ; + + // insert a null reference + virtual void DoWriteNullObject() = 0 ; + + // writes a delegate in the stream format + virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo , const wxPropertyInfo *propInfo , + const wxObject *eventSink , int sinkObjectID , const wxClassInfo* eventSinkClassInfo , const wxHandlerInfo* handlerIndo ) = 0; +private : + + struct wxWriterInternal ; + wxWriterInternal* m_data ; + + struct wxWriterInternalPropertiesData ; + + void WriteAllProperties( const wxObject * obj , const wxClassInfo* ci , wxPersister *persister, wxWriterInternalPropertiesData * data ) ; + void WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *data ) ; + void WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded, wxxVariantArray &metadata ) ; + void FindConnectEntry(const wxEvtHandler * evSource,const wxDelegateTypeInfo* dti, const wxObject* &sink , const wxHandlerInfo *&handler) ; +} ; + + +/* +Streaming callbacks for depersisting XML to code, or running objects +*/ + +class WXDLLIMPEXP_BASE wxDepersister ; + +/* +wxReader handles streaming in a class from a arbitrary format. While walking through +it issues calls out to interfaces to depersist the guts from the underlying storage format. +*/ + +class WXDLLIMPEXP_BASE wxReader : public wxObject +{ +public : + wxReader() ; + virtual ~wxReader() ; + + // the only thing wxReader knows about is the class info by object ID + wxClassInfo *GetObjectClassInfo(int objectID) ; + bool HasObjectClassInfo( int objectID ) ; + void SetObjectClassInfo(int objectID, wxClassInfo* classInfo); + + // Reads the component the reader is pointed at from the underlying format. + // The return value is the root object ID, which can + // then be used to ask the depersister about that object + // if there was a problem you will get back wxInvalidObjectID and the current + // error log will carry the problems encoutered + virtual int ReadObject( const wxString &name , wxDepersister *depersist ) = 0 ; + +private : + struct wxReaderInternal; + wxReaderInternal *m_data; +} ; + +// This abstract class matches the allocate-init/create model of creation of objects. +// At runtime, these will create actual instances, and manipulate them. +// When generating code, these will just create statements of C++ +// code to create the objects. + +class WXDLLIMPEXP_BASE wxDepersister +{ +public : + // allocate the new object on the heap, that object will have the passed in ID + virtual void AllocateObject(int objectID, wxClassInfo *classInfo, wxxVariantArray &metadata) = 0; + + // initialize the already allocated object having the ID objectID with the Create method + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void CreateObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &metadata) = 0; + + // construct the new object on the heap, that object will have the passed in ID (for objects that + // don't support allocate-create type of creation) + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &metadata) = 0; + + // destroy the heap-allocated object having the ID objectID, this may be used if an object + // is embedded in another object and set via value semantics, so the intermediate + // object can be destroyed after safely + virtual void DestroyObject(int objectID, wxClassInfo *classInfo) = 0; + + // set the corresponding property + virtual void SetProperty(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + const wxxVariant &VariantValue) = 0; + + // sets the corresponding property (value is an object) + virtual void SetPropertyAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + int valueObjectId) = 0; + + // adds an element to a property collection + virtual void AddToPropertyCollection( int objectID , + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + const wxxVariant &VariantValue) = 0; + + // sets the corresponding property (value is an object) + virtual void AddToPropertyCollectionAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + int valueObjectId) = 0; + + // sets the corresponding event handler + virtual void SetConnect(int EventSourceObjectID, + const wxClassInfo *EventSourceClassInfo, + const wxPropertyInfo *delegateInfo , + const wxClassInfo *EventSinkClassInfo , + const wxHandlerInfo* handlerInfo , + int EventSinkObjectID ) = 0; +}; + +/* +wxRuntimeDepersister implements the callbacks that will depersist +an object into a running memory image, as opposed to writing +C++ initialization code to bring the object to life. +*/ + +class WXDLLIMPEXP_BASE wxRuntimeDepersister : public wxDepersister +{ + struct wxRuntimeDepersisterInternal ; + wxRuntimeDepersisterInternal * m_data ; +public : + wxRuntimeDepersister(); + virtual ~wxRuntimeDepersister(); + + // returns the object having the corresponding ID fully constructed + wxObject *GetObject(int objectID) ; + + // allocate the new object on the heap, that object will have the passed in ID + virtual void AllocateObject(int objectID, wxClassInfo *classInfo , + wxxVariantArray &metadata) ; + + // initialize the already allocated object having the ID objectID with the Create method + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void CreateObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues, + const wxClassInfo **objectClassInfos , + wxxVariantArray &metadata + ) ; + + // construct the new object on the heap, that object will have the passed in ID (for objects that + // don't support allocate-create type of creation) + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &metadata) ; + + // destroy the heap-allocated object having the ID objectID, this may be used if an object + // is embedded in another object and set via value semantics, so the intermediate + // object can be destroyed after safely + virtual void DestroyObject(int objectID, wxClassInfo *classInfo) ; + + // set the corresponding property + virtual void SetProperty(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + const wxxVariant &variantValue); + + // sets the corresponding property (value is an object) + virtual void SetPropertyAsObject(int objectId, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + int valueObjectId) ; + + // adds an element to a property collection + virtual void AddToPropertyCollection( int objectID , + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + const wxxVariant &VariantValue) ; + + // sets the corresponding property (value is an object) + virtual void AddToPropertyCollectionAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + int valueObjectId) ; + + // sets the corresponding event handler + virtual void SetConnect(int eventSourceObjectID, + const wxClassInfo *eventSourceClassInfo, + const wxPropertyInfo *delegateInfo , + const wxClassInfo *eventSinkClassInfo , + const wxHandlerInfo* handlerInfo , + int eventSinkObjectID ) ; +}; + +/* +wxDepersisterCode implements the callbacks that will depersist +an object into a C++ initialization function. this will move to +a utility lib soon +*/ + +class WXDLLIMPEXP_BASE wxTextOutputStream ; + +class WXDLLIMPEXP_BASE wxCodeDepersister : public wxDepersister +{ +private : + struct wxCodeDepersisterInternal ; + wxCodeDepersisterInternal * m_data ; + wxTextOutputStream *m_fp; + wxString ValueAsCode( const wxxVariant ¶m ) ; +public: + wxCodeDepersister(wxTextOutputStream *out); + virtual ~wxCodeDepersister(); + + // allocate the new object on the heap, that object will have the passed in ID + virtual void AllocateObject(int objectID, wxClassInfo *classInfo , + wxxVariantArray &metadata) ; + + // initialize the already allocated object having the ID objectID with the Create method + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void CreateObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *variantValues , + int *objectIDValues, + const wxClassInfo **objectClassInfos , + wxxVariantArray &metadata + ) ; + + // construct the new object on the heap, that object will have the passed in ID (for objects that + // don't support allocate-create type of creation) + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &metadata) ; + + // destroy the heap-allocated object having the ID objectID, this may be used if an object + // is embedded in another object and set via value semantics, so the intermediate + // object can be destroyed after safely + virtual void DestroyObject(int objectID, wxClassInfo *classInfo) ; + + // set the corresponding property + virtual void SetProperty(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + const wxxVariant &variantValue); + + // sets the corresponding property (value is an object) + virtual void SetPropertyAsObject(int objectId, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + int valueObjectId) ; + + // adds an element to a property collection + virtual void AddToPropertyCollection( int objectID , + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + const wxxVariant &VariantValue) ; + + // sets the corresponding property (value is an object) + virtual void AddToPropertyCollectionAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo , + int valueObjectId) ; + + // sets the corresponding event handler + virtual void SetConnect(int eventSourceObjectID, + const wxClassInfo *eventSourceClassInfo, + const wxPropertyInfo *delegateInfo , + const wxClassInfo *eventSinkClassInfo , + const wxHandlerInfo* handlerInfo , + int eventSinkObjectID ) ; +}; + +#endif // wxUSE_EXTENDED_RTTI + +#endif diff --git a/Externals/wxWidgets/include/wx/xtixml.h b/Externals/wxWidgets/include/wx/xtixml.h index 5f878bc851..92407dae29 100644 --- a/Externals/wxWidgets/include/wx/xtixml.h +++ b/Externals/wxWidgets/include/wx/xtixml.h @@ -1,106 +1,106 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/xtixml.h -// Purpose: xml streaming runtime metadata information (extended class info) -// Author: Stefan Csomor -// Modified by: -// Created: 27/07/03 -// RCS-ID: $Id: xtixml.h 41020 2006-09-05 20:47:48Z VZ $ -// Copyright: (c) 2003 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_XTIXMLH__ -#define _WX_XTIXMLH__ - -#include "wx/wx.h" - -#if wxUSE_EXTENDED_RTTI - -#include "wx/xtistrm.h" - -class WXDLLIMPEXP_XML wxXmlNode ; - -class WXDLLIMPEXP_XML wxXmlWriter : public wxWriter -{ -public : - - wxXmlWriter( wxXmlNode * parent ) ; - virtual ~wxXmlWriter() ; - - // - // streaming callbacks - // - // these callbacks really write out the values in the stream format - // - - // - // streaming callbacks - // - // these callbacks really write out the values in the stream format - - // begins writing out a new toplevel entry which has the indicated unique name - virtual void DoBeginWriteTopLevelEntry( const wxString &name ) ; - - // ends writing out a new toplevel entry which has the indicated unique name - virtual void DoEndWriteTopLevelEntry( const wxString &name ) ; - - // start of writing an object having the passed in ID - virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata ) ; - - // end of writing an toplevel object name param is used for unique identification within the container - virtual void DoEndWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID ) ; - - // writes a simple property in the stream format - virtual void DoWriteSimpleType( wxxVariant &value ) ; - - // start of writing a complex property into the stream ( - virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) ; - - // end of writing a complex property into the stream - virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) ; - - virtual void DoBeginWriteElement() ; - virtual void DoEndWriteElement() ; - - // insert an object reference to an already written object - virtual void DoWriteRepeatedObject( int objectID ) ; - - // insert a null reference - virtual void DoWriteNullObject() ; - - // writes a delegate in the stream format - virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo , const wxPropertyInfo *propInfo , - const wxObject *eventSink , int sinkObjectID , const wxClassInfo* eventSinkClassInfo , const wxHandlerInfo* handlerIndo ) ; -private : - struct wxXmlWriterInternal ; - wxXmlWriterInternal* m_data ; -} ; - -/* -wxXmlReader handles streaming in a class from XML -*/ - -class WXDLLIMPEXP_XML wxXmlReader : public wxReader -{ -public: - wxXmlReader(wxXmlNode *parent) { m_parent = parent ; } - virtual ~wxXmlReader() {} - - // Reads a component from XML. The return value is the root object ID, which can - // then be used to ask the depersister about that object - - virtual int ReadObject( const wxString &name , wxDepersister *depersist ) ; - -private : - int ReadComponent(wxXmlNode *parent, wxDepersister *callbacks); - - // read the content of this node (simple type) and return the corresponding value - wxxVariant ReadValue(wxXmlNode *Node, - const wxTypeInfo *type ); - - wxXmlNode * m_parent ; -}; - -#endif // wxUSE_EXTENDED_RTTI - -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtixml.h +// Purpose: xml streaming runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// RCS-ID: $Id: xtixml.h 41020 2006-09-05 20:47:48Z VZ $ +// Copyright: (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTIXMLH__ +#define _WX_XTIXMLH__ + +#include "wx/wx.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/xtistrm.h" + +class WXDLLIMPEXP_XML wxXmlNode ; + +class WXDLLIMPEXP_XML wxXmlWriter : public wxWriter +{ +public : + + wxXmlWriter( wxXmlNode * parent ) ; + virtual ~wxXmlWriter() ; + + // + // streaming callbacks + // + // these callbacks really write out the values in the stream format + // + + // + // streaming callbacks + // + // these callbacks really write out the values in the stream format + + // begins writing out a new toplevel entry which has the indicated unique name + virtual void DoBeginWriteTopLevelEntry( const wxString &name ) ; + + // ends writing out a new toplevel entry which has the indicated unique name + virtual void DoEndWriteTopLevelEntry( const wxString &name ) ; + + // start of writing an object having the passed in ID + virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata ) ; + + // end of writing an toplevel object name param is used for unique identification within the container + virtual void DoEndWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID ) ; + + // writes a simple property in the stream format + virtual void DoWriteSimpleType( wxxVariant &value ) ; + + // start of writing a complex property into the stream ( + virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) ; + + // end of writing a complex property into the stream + virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) ; + + virtual void DoBeginWriteElement() ; + virtual void DoEndWriteElement() ; + + // insert an object reference to an already written object + virtual void DoWriteRepeatedObject( int objectID ) ; + + // insert a null reference + virtual void DoWriteNullObject() ; + + // writes a delegate in the stream format + virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo , const wxPropertyInfo *propInfo , + const wxObject *eventSink , int sinkObjectID , const wxClassInfo* eventSinkClassInfo , const wxHandlerInfo* handlerIndo ) ; +private : + struct wxXmlWriterInternal ; + wxXmlWriterInternal* m_data ; +} ; + +/* +wxXmlReader handles streaming in a class from XML +*/ + +class WXDLLIMPEXP_XML wxXmlReader : public wxReader +{ +public: + wxXmlReader(wxXmlNode *parent) { m_parent = parent ; } + virtual ~wxXmlReader() {} + + // Reads a component from XML. The return value is the root object ID, which can + // then be used to ask the depersister about that object + + virtual int ReadObject( const wxString &name , wxDepersister *depersist ) ; + +private : + int ReadComponent(wxXmlNode *parent, wxDepersister *callbacks); + + // read the content of this node (simple type) and return the corresponding value + wxxVariant ReadValue(wxXmlNode *Node, + const wxTypeInfo *type ); + + wxXmlNode * m_parent ; +}; + +#endif // wxUSE_EXTENDED_RTTI + +#endif diff --git a/Externals/wxWidgets/include/wx/zipstrm.h b/Externals/wxWidgets/include/wx/zipstrm.h index 572b88a9f4..77766a9811 100644 --- a/Externals/wxWidgets/include/wx/zipstrm.h +++ b/Externals/wxWidgets/include/wx/zipstrm.h @@ -1,574 +1,574 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/zipstrm.h -// Purpose: Streams for Zip files -// Author: Mike Wetherell -// RCS-ID: $Id: zipstrm.h 53135 2008-04-12 02:31:04Z VZ $ -// Copyright: (c) Mike Wetherell -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXZIPSTREAM_H__ -#define _WX_WXZIPSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_ZIPSTREAM - -#include "wx/archive.h" -#include "wx/filename.h" - -// some methods from wxZipInputStream and wxZipOutputStream stream do not get -// exported/imported when compiled with Mingw versions before 3.4.2. So they -// are imported/exported individually as a workaround -#if (defined(__GNUWIN32__) || defined(__MINGW32__)) \ - && (!defined __GNUC__ \ - || !defined __GNUC_MINOR__ \ - || !defined __GNUC_PATCHLEVEL__ \ - || __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 30402) -#define WXZIPFIX WXDLLIMPEXP_BASE -#else -#define WXZIPFIX -#endif - -///////////////////////////////////////////////////////////////////////////// -// constants - -// Compression Method, only 0 (store) and 8 (deflate) are supported here -// -enum wxZipMethod -{ - wxZIP_METHOD_STORE, - wxZIP_METHOD_SHRINK, - wxZIP_METHOD_REDUCE1, - wxZIP_METHOD_REDUCE2, - wxZIP_METHOD_REDUCE3, - wxZIP_METHOD_REDUCE4, - wxZIP_METHOD_IMPLODE, - wxZIP_METHOD_TOKENIZE, - wxZIP_METHOD_DEFLATE, - wxZIP_METHOD_DEFLATE64, - wxZIP_METHOD_BZIP2 = 12, - wxZIP_METHOD_DEFAULT = 0xffff -}; - -// Originating File-System. -// -// These are Pkware's values. Note that Info-zip disagree on some of them, -// most notably NTFS. -// -enum wxZipSystem -{ - wxZIP_SYSTEM_MSDOS, - wxZIP_SYSTEM_AMIGA, - wxZIP_SYSTEM_OPENVMS, - wxZIP_SYSTEM_UNIX, - wxZIP_SYSTEM_VM_CMS, - wxZIP_SYSTEM_ATARI_ST, - wxZIP_SYSTEM_OS2_HPFS, - wxZIP_SYSTEM_MACINTOSH, - wxZIP_SYSTEM_Z_SYSTEM, - wxZIP_SYSTEM_CPM, - wxZIP_SYSTEM_WINDOWS_NTFS, - wxZIP_SYSTEM_MVS, - wxZIP_SYSTEM_VSE, - wxZIP_SYSTEM_ACORN_RISC, - wxZIP_SYSTEM_VFAT, - wxZIP_SYSTEM_ALTERNATE_MVS, - wxZIP_SYSTEM_BEOS, - wxZIP_SYSTEM_TANDEM, - wxZIP_SYSTEM_OS_400 -}; - -// Dos/Win file attributes -// -enum wxZipAttributes -{ - wxZIP_A_RDONLY = 0x01, - wxZIP_A_HIDDEN = 0x02, - wxZIP_A_SYSTEM = 0x04, - wxZIP_A_SUBDIR = 0x10, - wxZIP_A_ARCH = 0x20, - - wxZIP_A_MASK = 0x37 -}; - -// Values for the flags field in the zip headers -// -enum wxZipFlags -{ - wxZIP_ENCRYPTED = 0x0001, - wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression - wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression - wxZIP_DEFLATE_FAST = 0x0004, // fast compression - wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression - wxZIP_DEFLATE_MASK = 0x0006, - wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data - wxZIP_ENHANCED = 0x0010, - wxZIP_PATCH = 0x0020, - wxZIP_STRONG_ENC = 0x0040, - wxZIP_UNUSED = 0x0F80, - wxZIP_RESERVED = 0xF000 -}; - -// Forward decls -// -class WXDLLIMPEXP_FWD_BASE wxZipEntry; -class WXDLLIMPEXP_FWD_BASE wxZipInputStream; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipNotifier - -class WXDLLIMPEXP_BASE wxZipNotifier -{ -public: - virtual ~wxZipNotifier() { } - - virtual void OnEntryUpdated(wxZipEntry& entry) = 0; -}; - - -///////////////////////////////////////////////////////////////////////////// -// Zip Entry - holds the meta data for a file in the zip - -class WXDLLIMPEXP_BASE wxZipEntry : public wxArchiveEntry -{ -public: - wxZipEntry(const wxString& name = wxEmptyString, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - virtual ~wxZipEntry(); - - wxZipEntry(const wxZipEntry& entry); - wxZipEntry& operator=(const wxZipEntry& entry); - - // Get accessors - wxDateTime GetDateTime() const { return m_DateTime; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxString GetInternalName() const { return m_Name; } - int GetMethod() const { return m_Method; } - int GetFlags() const { return m_Flags; } - wxUint32 GetCrc() const { return m_Crc; } - wxFileOffset GetCompressedSize() const { return m_CompressedSize; } - int GetSystemMadeBy() const { return m_SystemMadeBy; } - wxString GetComment() const { return m_Comment; } - wxUint32 GetExternalAttributes() const { return m_ExternalAttributes; } - wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } - int GetMode() const; - const char *GetLocalExtra() const; - size_t GetLocalExtraLen() const; - const char *GetExtra() const; - size_t GetExtraLen() const; - wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; - - // is accessors - inline bool IsDir() const; - inline bool IsText() const; - inline bool IsReadOnly() const; - inline bool IsMadeByUnix() const; - - // set accessors - void SetDateTime(const wxDateTime& dt) { m_DateTime = dt; } - void SetSize(wxFileOffset size) { m_Size = size; } - void SetMethod(int method) { m_Method = (wxUint16)method; } - void SetComment(const wxString& comment) { m_Comment = comment; } - void SetExternalAttributes(wxUint32 attr ) { m_ExternalAttributes = attr; } - void SetSystemMadeBy(int system); - void SetMode(int mode); - void SetExtra(const char *extra, size_t len); - void SetLocalExtra(const char *extra, size_t len); - - inline void SetName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE); - - static wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE, - bool *pIsDir = NULL); - - // set is accessors - void SetIsDir(bool isDir = true); - inline void SetIsReadOnly(bool isReadOnly = true); - inline void SetIsText(bool isText = true); - - wxZipEntry *Clone() const { return ZipClone(); } - - void SetNotifier(wxZipNotifier& notifier); - void UnsetNotifier(); - -protected: - // Internal attributes - enum { TEXT_ATTR = 1 }; - - // protected Get accessors - int GetVersionNeeded() const { return m_VersionNeeded; } - wxFileOffset GetKey() const { return m_Key; } - int GetVersionMadeBy() const { return m_VersionMadeBy; } - int GetDiskStart() const { return m_DiskStart; } - int GetInternalAttributes() const { return m_InternalAttributes; } - - void SetVersionNeeded(int version) { m_VersionNeeded = (wxUint16)version; } - void SetOffset(wxFileOffset offset) { m_Offset = offset; } - void SetFlags(int flags) { m_Flags = (wxUint16)flags; } - void SetVersionMadeBy(int version) { m_VersionMadeBy = (wxUint8)version; } - void SetCrc(wxUint32 crc) { m_Crc = crc; } - void SetCompressedSize(wxFileOffset size) { m_CompressedSize = size; } - void SetKey(wxFileOffset offset) { m_Key = offset; } - void SetDiskStart(int start) { m_DiskStart = (wxUint16)start; } - void SetInternalAttributes(int attr) { m_InternalAttributes = (wxUint16)attr; } - - virtual wxZipEntry *ZipClone() const { return new wxZipEntry(*this); } - - void Notify(); - -private: - wxArchiveEntry* DoClone() const { return ZipClone(); } - - size_t ReadLocal(wxInputStream& stream, wxMBConv& conv); - size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const; - - size_t ReadCentral(wxInputStream& stream, wxMBConv& conv); - size_t WriteCentral(wxOutputStream& stream, wxMBConv& conv) const; - - size_t ReadDescriptor(wxInputStream& stream); - size_t WriteDescriptor(wxOutputStream& stream, wxUint32 crc, - wxFileOffset compressedSize, wxFileOffset size); - - wxUint8 m_SystemMadeBy; // one of enum wxZipSystem - wxUint8 m_VersionMadeBy; // major * 10 + minor - - wxUint16 m_VersionNeeded; // ver needed to extract (20 i.e. v2.0) - wxUint16 m_Flags; - wxUint16 m_Method; // compression method (one of wxZipMethod) - wxDateTime m_DateTime; - wxUint32 m_Crc; - wxFileOffset m_CompressedSize; - wxFileOffset m_Size; - wxString m_Name; // in internal format - wxFileOffset m_Key; // the original offset for copied entries - wxFileOffset m_Offset; // file offset of the entry - - wxString m_Comment; - wxUint16 m_DiskStart; // for multidisk archives, not unsupported - wxUint16 m_InternalAttributes; // bit 0 set for text files - wxUint32 m_ExternalAttributes; // system specific depends on SystemMadeBy - - class wxZipMemory *m_Extra; - class wxZipMemory *m_LocalExtra; - - wxZipNotifier *m_zipnotifier; - class wxZipWeakLinks *m_backlink; - - friend class wxZipInputStream; - friend class wxZipOutputStream; - - DECLARE_DYNAMIC_CLASS(wxZipEntry) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipOutputStream - -WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE); - -class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream -{ -public: - wxZipOutputStream(wxOutputStream& stream, - int level = -1, - wxMBConv& conv = wxConvLocal); - wxZipOutputStream(wxOutputStream *stream, - int level = -1, - wxMBConv& conv = wxConvLocal); - virtual WXZIPFIX ~wxZipOutputStream(); - - bool PutNextEntry(wxZipEntry *entry) { return DoCreate(entry); } - - bool WXZIPFIX PutNextEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); - - bool WXZIPFIX PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()); - - bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream); - bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream); - - void WXZIPFIX Sync(); - bool WXZIPFIX CloseEntry(); - bool WXZIPFIX Close(); - - void SetComment(const wxString& comment) { m_Comment = comment; } - - int GetLevel() const { return m_level; } - void WXZIPFIX SetLevel(int level); - -protected: - virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_entrySize; } - - // this protected interface isn't yet finalised - struct Buffer { const char *m_data; size_t m_size; }; - virtual wxOutputStream* WXZIPFIX OpenCompressor(wxOutputStream& stream, - wxZipEntry& entry, - const Buffer bufs[]); - virtual bool WXZIPFIX CloseCompressor(wxOutputStream *comp); - - bool IsParentSeekable() const - { return m_offsetAdjustment != wxInvalidOffset; } - -private: - void Init(int level); - - bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry); - bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); - bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream); - - bool IsOpened() const { return m_comp || m_pending; } - - bool DoCreate(wxZipEntry *entry, bool raw = false); - void CreatePendingEntry(const void *buffer, size_t size); - void CreatePendingEntry(); - - class wxStoredOutputStream *m_store; - class wxZlibOutputStream2 *m_deflate; - class wxZipStreamLink *m_backlink; - wxZipEntryList_ m_entries; - char *m_initialData; - size_t m_initialSize; - wxZipEntry *m_pending; - bool m_raw; - wxFileOffset m_headerOffset; - size_t m_headerSize; - wxFileOffset m_entrySize; - wxUint32 m_crcAccumulator; - wxOutputStream *m_comp; - int m_level; - wxFileOffset m_offsetAdjustment; - wxString m_Comment; - - DECLARE_NO_COPY_CLASS(wxZipOutputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipInputStream - -class WXDLLIMPEXP_BASE wxZipInputStream : public wxArchiveInputStream -{ -public: - typedef wxZipEntry entry_type; - - wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); - wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); - -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - wxZipInputStream(const wxString& archive, const wxString& file) - : wxArchiveInputStream(OpenFile(archive), wxConvLocal) { Init(file); } -#endif - - virtual WXZIPFIX ~wxZipInputStream(); - - bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); } - bool WXZIPFIX CloseEntry(); - - wxZipEntry *GetNextEntry(); - - wxString WXZIPFIX GetComment(); - int WXZIPFIX GetTotalEntries(); - - virtual wxFileOffset GetLength() const { return m_entry.GetSize(); } - -protected: - size_t WXZIPFIX OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; } - -#if WXWIN_COMPATIBILITY_2_6 - wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode); -#endif - - // this protected interface isn't yet finalised - virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream); - virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp); - -private: - void Init(); - void Init(const wxString& file); -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - static wxInputStream *OpenFile(const wxString& archive); -#endif - - wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } - - bool WXZIPFIX OpenEntry(wxArchiveEntry& entry); - - wxStreamError ReadLocal(bool readEndRec = false); - wxStreamError ReadCentral(); - - wxUint32 ReadSignature(); - bool FindEndRecord(); - bool LoadEndRecord(); - - bool AtHeader() const { return m_headerSize == 0; } - bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; } - bool IsOpened() const { return m_decomp != NULL; } - - wxZipStreamLink *MakeLink(wxZipOutputStream *out); - - bool DoOpen(wxZipEntry *entry = NULL, bool raw = false); - bool OpenDecompressor(bool raw = false); - - class wxStoredInputStream *m_store; - class wxZlibInputStream2 *m_inflate; - class wxRawInputStream *m_rawin; - wxZipEntry m_entry; - bool m_raw; - size_t m_headerSize; - wxUint32 m_crcAccumulator; - wxInputStream *m_decomp; - bool m_parentSeekable; - class wxZipWeakLinks *m_weaklinks; - class wxZipStreamLink *m_streamlink; - wxFileOffset m_offsetAdjustment; - wxFileOffset m_position; - wxUint32 m_signature; - size_t m_TotalEntries; - wxString m_Comment; - - friend bool wxZipOutputStream::CopyEntry( - wxZipEntry *entry, wxZipInputStream& inputStream); - friend bool wxZipOutputStream::CopyArchiveMetaData( - wxZipInputStream& inputStream); - -#if WXWIN_COMPATIBILITY_2_6 - bool m_allowSeeking; - friend class wxArchiveFSHandler; -#endif - - DECLARE_NO_COPY_CLASS(wxZipInputStream) -}; - - -///////////////////////////////////////////////////////////////////////////// -// Iterators - -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR -typedef wxArchiveIterator wxZipIter; -typedef wxArchiveIterator > wxZipPairIter; -#endif - - -///////////////////////////////////////////////////////////////////////////// -// wxZipClassFactory - -class WXDLLIMPEXP_BASE wxZipClassFactory : public wxArchiveClassFactory -{ -public: - typedef wxZipEntry entry_type; - typedef wxZipInputStream instream_type; - typedef wxZipOutputStream outstream_type; - typedef wxZipNotifier notifier_type; -#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR - typedef wxZipIter iter_type; - typedef wxZipPairIter pairiter_type; -#endif - - wxZipClassFactory(); - - wxZipEntry *NewEntry() const - { return new wxZipEntry; } - wxZipInputStream *NewStream(wxInputStream& stream) const - { return new wxZipInputStream(stream, GetConv()); } - wxZipOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZipOutputStream(stream, -1, GetConv()); } - wxZipInputStream *NewStream(wxInputStream *stream) const - { return new wxZipInputStream(stream, GetConv()); } - wxZipOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZipOutputStream(stream, -1, GetConv()); } - - wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const - { return wxZipEntry::GetInternalName(name, format); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -protected: - wxArchiveEntry *DoNewEntry() const - { return NewEntry(); } - wxArchiveInputStream *DoNewStream(wxInputStream& stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const - { return NewStream(stream); } - wxArchiveInputStream *DoNewStream(wxInputStream *stream) const - { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const - { return NewStream(stream); } - -private: - DECLARE_DYNAMIC_CLASS(wxZipClassFactory) -}; - - -///////////////////////////////////////////////////////////////////////////// -// wxZipEntry inlines - -inline bool wxZipEntry::IsText() const -{ - return (m_InternalAttributes & TEXT_ATTR) != 0; -} - -inline bool wxZipEntry::IsDir() const -{ - return (m_ExternalAttributes & wxZIP_A_SUBDIR) != 0; -} - -inline bool wxZipEntry::IsReadOnly() const -{ - return (m_ExternalAttributes & wxZIP_A_RDONLY) != 0; -} - -inline bool wxZipEntry::IsMadeByUnix() const -{ - const int pattern = - (1 << wxZIP_SYSTEM_OPENVMS) | - (1 << wxZIP_SYSTEM_UNIX) | - (1 << wxZIP_SYSTEM_ATARI_ST) | - (1 << wxZIP_SYSTEM_ACORN_RISC) | - (1 << wxZIP_SYSTEM_BEOS) | (1 << wxZIP_SYSTEM_TANDEM); - - // note: some unix zippers put madeby = dos - return (m_SystemMadeBy == wxZIP_SYSTEM_MSDOS - && (m_ExternalAttributes & ~0xFFFF)) - || ((pattern >> m_SystemMadeBy) & 1); -} - -inline void wxZipEntry::SetIsText(bool isText) -{ - if (isText) - m_InternalAttributes |= TEXT_ATTR; - else - m_InternalAttributes &= ~TEXT_ATTR; -} - -inline void wxZipEntry::SetIsReadOnly(bool isReadOnly) -{ - if (isReadOnly) - SetMode(GetMode() & ~0222); - else - SetMode(GetMode() | 0200); -} - -inline void wxZipEntry::SetName(const wxString& name, - wxPathFormat format /*=wxPATH_NATIVE*/) -{ - bool isDir; - m_Name = GetInternalName(name, format, &isDir); - SetIsDir(isDir); -} - - -#endif // wxUSE_ZIPSTREAM - -#endif // _WX_WXZIPSTREAM_H__ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/zipstrm.h +// Purpose: Streams for Zip files +// Author: Mike Wetherell +// RCS-ID: $Id: zipstrm.h 53135 2008-04-12 02:31:04Z VZ $ +// Copyright: (c) Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXZIPSTREAM_H__ +#define _WX_WXZIPSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_ZIPSTREAM + +#include "wx/archive.h" +#include "wx/filename.h" + +// some methods from wxZipInputStream and wxZipOutputStream stream do not get +// exported/imported when compiled with Mingw versions before 3.4.2. So they +// are imported/exported individually as a workaround +#if (defined(__GNUWIN32__) || defined(__MINGW32__)) \ + && (!defined __GNUC__ \ + || !defined __GNUC_MINOR__ \ + || !defined __GNUC_PATCHLEVEL__ \ + || __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 30402) +#define WXZIPFIX WXDLLIMPEXP_BASE +#else +#define WXZIPFIX +#endif + +///////////////////////////////////////////////////////////////////////////// +// constants + +// Compression Method, only 0 (store) and 8 (deflate) are supported here +// +enum wxZipMethod +{ + wxZIP_METHOD_STORE, + wxZIP_METHOD_SHRINK, + wxZIP_METHOD_REDUCE1, + wxZIP_METHOD_REDUCE2, + wxZIP_METHOD_REDUCE3, + wxZIP_METHOD_REDUCE4, + wxZIP_METHOD_IMPLODE, + wxZIP_METHOD_TOKENIZE, + wxZIP_METHOD_DEFLATE, + wxZIP_METHOD_DEFLATE64, + wxZIP_METHOD_BZIP2 = 12, + wxZIP_METHOD_DEFAULT = 0xffff +}; + +// Originating File-System. +// +// These are Pkware's values. Note that Info-zip disagree on some of them, +// most notably NTFS. +// +enum wxZipSystem +{ + wxZIP_SYSTEM_MSDOS, + wxZIP_SYSTEM_AMIGA, + wxZIP_SYSTEM_OPENVMS, + wxZIP_SYSTEM_UNIX, + wxZIP_SYSTEM_VM_CMS, + wxZIP_SYSTEM_ATARI_ST, + wxZIP_SYSTEM_OS2_HPFS, + wxZIP_SYSTEM_MACINTOSH, + wxZIP_SYSTEM_Z_SYSTEM, + wxZIP_SYSTEM_CPM, + wxZIP_SYSTEM_WINDOWS_NTFS, + wxZIP_SYSTEM_MVS, + wxZIP_SYSTEM_VSE, + wxZIP_SYSTEM_ACORN_RISC, + wxZIP_SYSTEM_VFAT, + wxZIP_SYSTEM_ALTERNATE_MVS, + wxZIP_SYSTEM_BEOS, + wxZIP_SYSTEM_TANDEM, + wxZIP_SYSTEM_OS_400 +}; + +// Dos/Win file attributes +// +enum wxZipAttributes +{ + wxZIP_A_RDONLY = 0x01, + wxZIP_A_HIDDEN = 0x02, + wxZIP_A_SYSTEM = 0x04, + wxZIP_A_SUBDIR = 0x10, + wxZIP_A_ARCH = 0x20, + + wxZIP_A_MASK = 0x37 +}; + +// Values for the flags field in the zip headers +// +enum wxZipFlags +{ + wxZIP_ENCRYPTED = 0x0001, + wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression + wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression + wxZIP_DEFLATE_FAST = 0x0004, // fast compression + wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression + wxZIP_DEFLATE_MASK = 0x0006, + wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data + wxZIP_ENHANCED = 0x0010, + wxZIP_PATCH = 0x0020, + wxZIP_STRONG_ENC = 0x0040, + wxZIP_UNUSED = 0x0F80, + wxZIP_RESERVED = 0xF000 +}; + +// Forward decls +// +class WXDLLIMPEXP_FWD_BASE wxZipEntry; +class WXDLLIMPEXP_FWD_BASE wxZipInputStream; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipNotifier + +class WXDLLIMPEXP_BASE wxZipNotifier +{ +public: + virtual ~wxZipNotifier() { } + + virtual void OnEntryUpdated(wxZipEntry& entry) = 0; +}; + + +///////////////////////////////////////////////////////////////////////////// +// Zip Entry - holds the meta data for a file in the zip + +class WXDLLIMPEXP_BASE wxZipEntry : public wxArchiveEntry +{ +public: + wxZipEntry(const wxString& name = wxEmptyString, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset); + virtual ~wxZipEntry(); + + wxZipEntry(const wxZipEntry& entry); + wxZipEntry& operator=(const wxZipEntry& entry); + + // Get accessors + wxDateTime GetDateTime() const { return m_DateTime; } + wxFileOffset GetSize() const { return m_Size; } + wxFileOffset GetOffset() const { return m_Offset; } + wxString GetInternalName() const { return m_Name; } + int GetMethod() const { return m_Method; } + int GetFlags() const { return m_Flags; } + wxUint32 GetCrc() const { return m_Crc; } + wxFileOffset GetCompressedSize() const { return m_CompressedSize; } + int GetSystemMadeBy() const { return m_SystemMadeBy; } + wxString GetComment() const { return m_Comment; } + wxUint32 GetExternalAttributes() const { return m_ExternalAttributes; } + wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } + int GetMode() const; + const char *GetLocalExtra() const; + size_t GetLocalExtraLen() const; + const char *GetExtra() const; + size_t GetExtraLen() const; + wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; + + // is accessors + inline bool IsDir() const; + inline bool IsText() const; + inline bool IsReadOnly() const; + inline bool IsMadeByUnix() const; + + // set accessors + void SetDateTime(const wxDateTime& dt) { m_DateTime = dt; } + void SetSize(wxFileOffset size) { m_Size = size; } + void SetMethod(int method) { m_Method = (wxUint16)method; } + void SetComment(const wxString& comment) { m_Comment = comment; } + void SetExternalAttributes(wxUint32 attr ) { m_ExternalAttributes = attr; } + void SetSystemMadeBy(int system); + void SetMode(int mode); + void SetExtra(const char *extra, size_t len); + void SetLocalExtra(const char *extra, size_t len); + + inline void SetName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE); + + static wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE, + bool *pIsDir = NULL); + + // set is accessors + void SetIsDir(bool isDir = true); + inline void SetIsReadOnly(bool isReadOnly = true); + inline void SetIsText(bool isText = true); + + wxZipEntry *Clone() const { return ZipClone(); } + + void SetNotifier(wxZipNotifier& notifier); + void UnsetNotifier(); + +protected: + // Internal attributes + enum { TEXT_ATTR = 1 }; + + // protected Get accessors + int GetVersionNeeded() const { return m_VersionNeeded; } + wxFileOffset GetKey() const { return m_Key; } + int GetVersionMadeBy() const { return m_VersionMadeBy; } + int GetDiskStart() const { return m_DiskStart; } + int GetInternalAttributes() const { return m_InternalAttributes; } + + void SetVersionNeeded(int version) { m_VersionNeeded = (wxUint16)version; } + void SetOffset(wxFileOffset offset) { m_Offset = offset; } + void SetFlags(int flags) { m_Flags = (wxUint16)flags; } + void SetVersionMadeBy(int version) { m_VersionMadeBy = (wxUint8)version; } + void SetCrc(wxUint32 crc) { m_Crc = crc; } + void SetCompressedSize(wxFileOffset size) { m_CompressedSize = size; } + void SetKey(wxFileOffset offset) { m_Key = offset; } + void SetDiskStart(int start) { m_DiskStart = (wxUint16)start; } + void SetInternalAttributes(int attr) { m_InternalAttributes = (wxUint16)attr; } + + virtual wxZipEntry *ZipClone() const { return new wxZipEntry(*this); } + + void Notify(); + +private: + wxArchiveEntry* DoClone() const { return ZipClone(); } + + size_t ReadLocal(wxInputStream& stream, wxMBConv& conv); + size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const; + + size_t ReadCentral(wxInputStream& stream, wxMBConv& conv); + size_t WriteCentral(wxOutputStream& stream, wxMBConv& conv) const; + + size_t ReadDescriptor(wxInputStream& stream); + size_t WriteDescriptor(wxOutputStream& stream, wxUint32 crc, + wxFileOffset compressedSize, wxFileOffset size); + + wxUint8 m_SystemMadeBy; // one of enum wxZipSystem + wxUint8 m_VersionMadeBy; // major * 10 + minor + + wxUint16 m_VersionNeeded; // ver needed to extract (20 i.e. v2.0) + wxUint16 m_Flags; + wxUint16 m_Method; // compression method (one of wxZipMethod) + wxDateTime m_DateTime; + wxUint32 m_Crc; + wxFileOffset m_CompressedSize; + wxFileOffset m_Size; + wxString m_Name; // in internal format + wxFileOffset m_Key; // the original offset for copied entries + wxFileOffset m_Offset; // file offset of the entry + + wxString m_Comment; + wxUint16 m_DiskStart; // for multidisk archives, not unsupported + wxUint16 m_InternalAttributes; // bit 0 set for text files + wxUint32 m_ExternalAttributes; // system specific depends on SystemMadeBy + + class wxZipMemory *m_Extra; + class wxZipMemory *m_LocalExtra; + + wxZipNotifier *m_zipnotifier; + class wxZipWeakLinks *m_backlink; + + friend class wxZipInputStream; + friend class wxZipOutputStream; + + DECLARE_DYNAMIC_CLASS(wxZipEntry) +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipOutputStream + +WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream +{ +public: + wxZipOutputStream(wxOutputStream& stream, + int level = -1, + wxMBConv& conv = wxConvLocal); + wxZipOutputStream(wxOutputStream *stream, + int level = -1, + wxMBConv& conv = wxConvLocal); + virtual WXZIPFIX ~wxZipOutputStream(); + + bool PutNextEntry(wxZipEntry *entry) { return DoCreate(entry); } + + bool WXZIPFIX PutNextEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset); + + bool WXZIPFIX PutNextDirEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now()); + + bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream); + bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream); + + void WXZIPFIX Sync(); + bool WXZIPFIX CloseEntry(); + bool WXZIPFIX Close(); + + void SetComment(const wxString& comment) { m_Comment = comment; } + + int GetLevel() const { return m_level; } + void WXZIPFIX SetLevel(int level); + +protected: + virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size); + virtual wxFileOffset OnSysTell() const { return m_entrySize; } + + // this protected interface isn't yet finalised + struct Buffer { const char *m_data; size_t m_size; }; + virtual wxOutputStream* WXZIPFIX OpenCompressor(wxOutputStream& stream, + wxZipEntry& entry, + const Buffer bufs[]); + virtual bool WXZIPFIX CloseCompressor(wxOutputStream *comp); + + bool IsParentSeekable() const + { return m_offsetAdjustment != wxInvalidOffset; } + +private: + void Init(int level); + + bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry); + bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); + bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream); + + bool IsOpened() const { return m_comp || m_pending; } + + bool DoCreate(wxZipEntry *entry, bool raw = false); + void CreatePendingEntry(const void *buffer, size_t size); + void CreatePendingEntry(); + + class wxStoredOutputStream *m_store; + class wxZlibOutputStream2 *m_deflate; + class wxZipStreamLink *m_backlink; + wxZipEntryList_ m_entries; + char *m_initialData; + size_t m_initialSize; + wxZipEntry *m_pending; + bool m_raw; + wxFileOffset m_headerOffset; + size_t m_headerSize; + wxFileOffset m_entrySize; + wxUint32 m_crcAccumulator; + wxOutputStream *m_comp; + int m_level; + wxFileOffset m_offsetAdjustment; + wxString m_Comment; + + DECLARE_NO_COPY_CLASS(wxZipOutputStream) +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipInputStream + +class WXDLLIMPEXP_BASE wxZipInputStream : public wxArchiveInputStream +{ +public: + typedef wxZipEntry entry_type; + + wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); + wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); + +#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE + wxZipInputStream(const wxString& archive, const wxString& file) + : wxArchiveInputStream(OpenFile(archive), wxConvLocal) { Init(file); } +#endif + + virtual WXZIPFIX ~wxZipInputStream(); + + bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); } + bool WXZIPFIX CloseEntry(); + + wxZipEntry *GetNextEntry(); + + wxString WXZIPFIX GetComment(); + int WXZIPFIX GetTotalEntries(); + + virtual wxFileOffset GetLength() const { return m_entry.GetSize(); } + +protected: + size_t WXZIPFIX OnSysRead(void *buffer, size_t size); + wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; } + +#if WXWIN_COMPATIBILITY_2_6 + wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode); +#endif + + // this protected interface isn't yet finalised + virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream); + virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp); + +private: + void Init(); + void Init(const wxString& file); +#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE + static wxInputStream *OpenFile(const wxString& archive); +#endif + + wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } + + bool WXZIPFIX OpenEntry(wxArchiveEntry& entry); + + wxStreamError ReadLocal(bool readEndRec = false); + wxStreamError ReadCentral(); + + wxUint32 ReadSignature(); + bool FindEndRecord(); + bool LoadEndRecord(); + + bool AtHeader() const { return m_headerSize == 0; } + bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; } + bool IsOpened() const { return m_decomp != NULL; } + + wxZipStreamLink *MakeLink(wxZipOutputStream *out); + + bool DoOpen(wxZipEntry *entry = NULL, bool raw = false); + bool OpenDecompressor(bool raw = false); + + class wxStoredInputStream *m_store; + class wxZlibInputStream2 *m_inflate; + class wxRawInputStream *m_rawin; + wxZipEntry m_entry; + bool m_raw; + size_t m_headerSize; + wxUint32 m_crcAccumulator; + wxInputStream *m_decomp; + bool m_parentSeekable; + class wxZipWeakLinks *m_weaklinks; + class wxZipStreamLink *m_streamlink; + wxFileOffset m_offsetAdjustment; + wxFileOffset m_position; + wxUint32 m_signature; + size_t m_TotalEntries; + wxString m_Comment; + + friend bool wxZipOutputStream::CopyEntry( + wxZipEntry *entry, wxZipInputStream& inputStream); + friend bool wxZipOutputStream::CopyArchiveMetaData( + wxZipInputStream& inputStream); + +#if WXWIN_COMPATIBILITY_2_6 + bool m_allowSeeking; + friend class wxArchiveFSHandler; +#endif + + DECLARE_NO_COPY_CLASS(wxZipInputStream) +}; + + +///////////////////////////////////////////////////////////////////////////// +// Iterators + +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR +typedef wxArchiveIterator wxZipIter; +typedef wxArchiveIterator > wxZipPairIter; +#endif + + +///////////////////////////////////////////////////////////////////////////// +// wxZipClassFactory + +class WXDLLIMPEXP_BASE wxZipClassFactory : public wxArchiveClassFactory +{ +public: + typedef wxZipEntry entry_type; + typedef wxZipInputStream instream_type; + typedef wxZipOutputStream outstream_type; + typedef wxZipNotifier notifier_type; +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + typedef wxZipIter iter_type; + typedef wxZipPairIter pairiter_type; +#endif + + wxZipClassFactory(); + + wxZipEntry *NewEntry() const + { return new wxZipEntry; } + wxZipInputStream *NewStream(wxInputStream& stream) const + { return new wxZipInputStream(stream, GetConv()); } + wxZipOutputStream *NewStream(wxOutputStream& stream) const + { return new wxZipOutputStream(stream, -1, GetConv()); } + wxZipInputStream *NewStream(wxInputStream *stream) const + { return new wxZipInputStream(stream, GetConv()); } + wxZipOutputStream *NewStream(wxOutputStream *stream) const + { return new wxZipOutputStream(stream, -1, GetConv()); } + + wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) const + { return wxZipEntry::GetInternalName(name, format); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const; + +protected: + wxArchiveEntry *DoNewEntry() const + { return NewEntry(); } + wxArchiveInputStream *DoNewStream(wxInputStream& stream) const + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const + { return NewStream(stream); } + wxArchiveInputStream *DoNewStream(wxInputStream *stream) const + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const + { return NewStream(stream); } + +private: + DECLARE_DYNAMIC_CLASS(wxZipClassFactory) +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipEntry inlines + +inline bool wxZipEntry::IsText() const +{ + return (m_InternalAttributes & TEXT_ATTR) != 0; +} + +inline bool wxZipEntry::IsDir() const +{ + return (m_ExternalAttributes & wxZIP_A_SUBDIR) != 0; +} + +inline bool wxZipEntry::IsReadOnly() const +{ + return (m_ExternalAttributes & wxZIP_A_RDONLY) != 0; +} + +inline bool wxZipEntry::IsMadeByUnix() const +{ + const int pattern = + (1 << wxZIP_SYSTEM_OPENVMS) | + (1 << wxZIP_SYSTEM_UNIX) | + (1 << wxZIP_SYSTEM_ATARI_ST) | + (1 << wxZIP_SYSTEM_ACORN_RISC) | + (1 << wxZIP_SYSTEM_BEOS) | (1 << wxZIP_SYSTEM_TANDEM); + + // note: some unix zippers put madeby = dos + return (m_SystemMadeBy == wxZIP_SYSTEM_MSDOS + && (m_ExternalAttributes & ~0xFFFF)) + || ((pattern >> m_SystemMadeBy) & 1); +} + +inline void wxZipEntry::SetIsText(bool isText) +{ + if (isText) + m_InternalAttributes |= TEXT_ATTR; + else + m_InternalAttributes &= ~TEXT_ATTR; +} + +inline void wxZipEntry::SetIsReadOnly(bool isReadOnly) +{ + if (isReadOnly) + SetMode(GetMode() & ~0222); + else + SetMode(GetMode() | 0200); +} + +inline void wxZipEntry::SetName(const wxString& name, + wxPathFormat format /*=wxPATH_NATIVE*/) +{ + bool isDir; + m_Name = GetInternalName(name, format, &isDir); + SetIsDir(isDir); +} + + +#endif // wxUSE_ZIPSTREAM + +#endif // _WX_WXZIPSTREAM_H__ diff --git a/Externals/wxWidgets/include/wx/zstream.h b/Externals/wxWidgets/include/wx/zstream.h index 3ba68f311a..3efc68fdb9 100644 --- a/Externals/wxWidgets/include/wx/zstream.h +++ b/Externals/wxWidgets/include/wx/zstream.h @@ -1,146 +1,146 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/zstream.h -// Purpose: Memory stream classes -// Author: Guilhem Lavaux -// Modified by: Mike Wetherell -// Created: 11/07/98 -// RCS-ID: $Id: zstream.h 42713 2006-10-30 11:56:12Z ABX $ -// Copyright: (c) Guilhem Lavaux -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_WXZSTREAM_H__ -#define _WX_WXZSTREAM_H__ - -#include "wx/defs.h" - -#if wxUSE_ZLIB && wxUSE_STREAMS - -#include "wx/stream.h" - -// Compression level -enum { - wxZ_DEFAULT_COMPRESSION = -1, - wxZ_NO_COMPRESSION = 0, - wxZ_BEST_SPEED = 1, - wxZ_BEST_COMPRESSION = 9 -}; - -// Flags -enum { -#if WXWIN_COMPATIBILITY_2_4 - wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error -#endif - wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum - wxZLIB_ZLIB = 1, // zlib header and checksum - wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ - wxZLIB_AUTO = 3 // autodetect header zlib or gzip -}; - -class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { - public: - wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO); - wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO); - virtual ~wxZlibInputStream(); - - char Peek() { return wxInputStream::Peek(); } - wxFileOffset GetLength() const { return wxInputStream::GetLength(); } - - static bool CanHandleGZip(); - - protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - - private: - void Init(int flags); - - protected: - size_t m_z_size; - unsigned char *m_z_buffer; - struct z_stream_s *m_inflate; - wxFileOffset m_pos; -#if WXWIN_COMPATIBILITY_2_4 - bool m_24compatibilty; -#endif - - DECLARE_NO_COPY_CLASS(wxZlibInputStream) -}; - -class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { - public: - wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB); - wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB); - virtual ~wxZlibOutputStream() { Close(); } - - void Sync() { DoFlush(false); } - bool Close(); - wxFileOffset GetLength() const { return m_pos; } - - static bool CanHandleGZip(); - - protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - - virtual void DoFlush(bool final); - - private: - void Init(int level, int flags); - - protected: - size_t m_z_size; - unsigned char *m_z_buffer; - struct z_stream_s *m_deflate; - wxFileOffset m_pos; - - DECLARE_NO_COPY_CLASS(wxZlibOutputStream) -}; - -class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory -{ -public: - wxZlibClassFactory(); - - wxFilterInputStream *NewStream(wxInputStream& stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZlibOutputStream(stream, -1); } - wxFilterInputStream *NewStream(wxInputStream *stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZlibOutputStream(stream, -1); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -private: - DECLARE_DYNAMIC_CLASS(wxZlibClassFactory) -}; - -class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory -{ -public: - wxGzipClassFactory(); - - wxFilterInputStream *NewStream(wxInputStream& stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream& stream) const - { return new wxZlibOutputStream(stream, -1); } - wxFilterInputStream *NewStream(wxInputStream *stream) const - { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream *stream) const - { return new wxZlibOutputStream(stream, -1); } - - const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; - -private: - DECLARE_DYNAMIC_CLASS(wxGzipClassFactory) -}; - -#endif - // wxUSE_ZLIB && wxUSE_STREAMS - -#endif - // _WX_WXZSTREAM_H__ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/zstream.h +// Purpose: Memory stream classes +// Author: Guilhem Lavaux +// Modified by: Mike Wetherell +// Created: 11/07/98 +// RCS-ID: $Id: zstream.h 42713 2006-10-30 11:56:12Z ABX $ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_WXZSTREAM_H__ +#define _WX_WXZSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_ZLIB && wxUSE_STREAMS + +#include "wx/stream.h" + +// Compression level +enum { + wxZ_DEFAULT_COMPRESSION = -1, + wxZ_NO_COMPRESSION = 0, + wxZ_BEST_SPEED = 1, + wxZ_BEST_COMPRESSION = 9 +}; + +// Flags +enum { +#if WXWIN_COMPATIBILITY_2_4 + wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error +#endif + wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum + wxZLIB_ZLIB = 1, // zlib header and checksum + wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ + wxZLIB_AUTO = 3 // autodetect header zlib or gzip +}; + +class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { + public: + wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO); + wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO); + virtual ~wxZlibInputStream(); + + char Peek() { return wxInputStream::Peek(); } + wxFileOffset GetLength() const { return wxInputStream::GetLength(); } + + static bool CanHandleGZip(); + + protected: + size_t OnSysRead(void *buffer, size_t size); + wxFileOffset OnSysTell() const { return m_pos; } + + private: + void Init(int flags); + + protected: + size_t m_z_size; + unsigned char *m_z_buffer; + struct z_stream_s *m_inflate; + wxFileOffset m_pos; +#if WXWIN_COMPATIBILITY_2_4 + bool m_24compatibilty; +#endif + + DECLARE_NO_COPY_CLASS(wxZlibInputStream) +}; + +class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { + public: + wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB); + wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB); + virtual ~wxZlibOutputStream() { Close(); } + + void Sync() { DoFlush(false); } + bool Close(); + wxFileOffset GetLength() const { return m_pos; } + + static bool CanHandleGZip(); + + protected: + size_t OnSysWrite(const void *buffer, size_t size); + wxFileOffset OnSysTell() const { return m_pos; } + + virtual void DoFlush(bool final); + + private: + void Init(int level, int flags); + + protected: + size_t m_z_size; + unsigned char *m_z_buffer; + struct z_stream_s *m_deflate; + wxFileOffset m_pos; + + DECLARE_NO_COPY_CLASS(wxZlibOutputStream) +}; + +class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory +{ +public: + wxZlibClassFactory(); + + wxFilterInputStream *NewStream(wxInputStream& stream) const + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream& stream) const + { return new wxZlibOutputStream(stream, -1); } + wxFilterInputStream *NewStream(wxInputStream *stream) const + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream *stream) const + { return new wxZlibOutputStream(stream, -1); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const; + +private: + DECLARE_DYNAMIC_CLASS(wxZlibClassFactory) +}; + +class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory +{ +public: + wxGzipClassFactory(); + + wxFilterInputStream *NewStream(wxInputStream& stream) const + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream& stream) const + { return new wxZlibOutputStream(stream, -1); } + wxFilterInputStream *NewStream(wxInputStream *stream) const + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream *stream) const + { return new wxZlibOutputStream(stream, -1); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const; + +private: + DECLARE_DYNAMIC_CLASS(wxGzipClassFactory) +}; + +#endif + // wxUSE_ZLIB && wxUSE_STREAMS + +#endif + // _WX_WXZSTREAM_H__ + diff --git a/Externals/wxWidgets/lib/vc_lib/msw/wx/msw/rcdefs.h b/Externals/wxWidgets/lib/vc_lib/msw/wx/msw/rcdefs.h index 66c9f7fccf..a5f6f30e64 100644 --- a/Externals/wxWidgets/lib/vc_lib/msw/wx/msw/rcdefs.h +++ b/Externals/wxWidgets/lib/vc_lib/msw/wx/msw/rcdefs.h @@ -1,44 +1,44 @@ - - - - - - - - - - - - -#ifndef _WX_RCDEFS_H -#define _WX_RCDEFS_H - - -#define WX_MSC_FULL_VER 150030729 - - - - - - - - - - - - - - - -#define WX_CPU_X86 - - - - - - - - - - -#endif + + + + + + + + + + + + +#ifndef _WX_RCDEFS_H +#define _WX_RCDEFS_H + + +#define WX_MSC_FULL_VER 150030729 + + + + + + + + + + + + + + + +#define WX_CPU_X86 + + + + + + + + + + +#endif diff --git a/Externals/wxWidgets/lib/vc_lib/msw/wx/setup.h b/Externals/wxWidgets/lib/vc_lib/msw/wx/setup.h index dd3112dacd..5df4a4ec17 100644 --- a/Externals/wxWidgets/lib/vc_lib/msw/wx/setup.h +++ b/Externals/wxWidgets/lib/vc_lib/msw/wx/setup.h @@ -1,1349 +1,1349 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id: setup0.h 51451 2008-01-29 23:11:55Z VZ $ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.4 API: set it to 1 to -// enable it but please consider updating your code instead. -// -// Default is 0 -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_4 0 - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug mode -// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be -// defined as wchar_t, wxString will use Unicode internally. If you set this -// to 1, you must use wxT() macro for all literal strings in the program. -// -// Unicode is currently only fully supported under Windows NT/2000/XP -// (Windows 9x doesn't support it and the programs compiled in Unicode mode -// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). -// -// Default is 0 -// -// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 0 -#endif - -// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without -// compiling the program in Unicode mode. More precisely, it will be possible -// to construct wxString from a wide (Unicode) string and convert any wxString -// to Unicode. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 0 - -// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from -// std::list and std::vector, with a compatibility interface, -// and for wxHashMap to be implemented with templates. -// -// Default is 0 -// -// Recommended setting: YMMV -#define wxUSE_STL 0 - -// Support for message/error logging. This includes wxLogXXX() functions and -// wxLog and derived classes. Don't set this to 0 unless you really know what -// you are doing. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// Use standard C++ streams if 1 instead of wx streams in some places. If -// disabled (default), wx streams are used everywhere and wxWidgets doesn't -// depend on the standard streams library. -// -// Notice that enabling this does not replace wx streams with std streams -// everywhere, in a lot of places wx streams are used no matter what. -// -// Default is 0 -// -// Recommended setting: 1 if you use the standard streams anyhow and so -// dependency on the standard streams library is not a -// problem -#define wxUSE_STD_IOSTREAM 0 - -// Enable conversion to standard C++ string if 1. -// -// Default is 1 for most compilers. -// -// Currently the Digital Mars and Watcom compilers come without standard C++ -// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have -// them (e.g. from STLPort). -// -// VC++ 5.0 does include standard C++ library header, however they produce -// many warnings that can't be turned off when compiled at warning level 4. -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_STRING 0 -#else - #define wxUSE_STD_STRING 1 -#endif - -// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. -// Note that if the system's implementation does not support positional -// parameters, setting this to 1 forces the use of the wxWidgets implementation -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// ---------------------------------------------------------------------------- -// non GUI features selection -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use GStreamer for Unix (req a lot of dependancies) -// -// Default is 0 -// -// Recommended setting: 1 (wxMediaCtrl won't work by default without it) -#define wxUSE_GSTREAMER 0 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - - -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows you will need to link with gdiplus.lib (use -// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your -// application if you want it to be runnable on pre-XP systems. -// -// Default is 0 -// -// Recommended setting: 1 -#ifndef wxUSE_GRAPHICS_CONTEXT -#define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl -#define wxUSE_BUTTON 1 // wxButton -#define wxUSE_BMPBUTTON 1 // wxBitmapButton -#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#define wxUSE_STATTEXT 1 // wxStaticText -#define wxUSE_STATBMP 1 // wxStaticBitmap -#define wxUSE_TEXTCTRL 1 // wxTextCtrl -#define wxUSE_TOGGLEBTN 1 // requires wxButton -#define wxUSE_TREECTRL 1 // wxTreeCtrl - -// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR -// below either wxStatusBar95 or a generic wxStatusBar will be used. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxSashWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1. Note that for some compilers (notably Microsoft Visual C++) you -// will need to manually add opengl32.lib and glu32.lib to the list of -// libraries linked with your program if you use OpenGL. -// -// Default is 0. -// -// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise -#define wxUSE_GLCANVAS 0 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_RESOURCES 0 - // 0 for no wxGetResource/wxWriteResource -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// ---------------------------------------------------------------------------- -// postscript support settings -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// ---------------------------------------------------------------------------- -// database classes -// ---------------------------------------------------------------------------- - -// Define 1 to use ODBC classes -#define wxUSE_ODBC 0 - -// For backward compatibility reasons, this parameter now only controls the -// default scrolling method used by cursors. This default behavior can be -// overriden by setting the second param of wxDB::wxDbGetConnection() or -// wxDb() constructor to indicate whether the connection (and any wxDbTable()s -// that use the connection) should support forward only scrolling of cursors, -// or both forward and backward support for backward scrolling cursors is -// dependent on the data source as well as the ODBC driver being used. -#define wxODBC_FWD_ONLY_CURSORS 1 - -// Default is 0. Set to 1 to use the deprecated classes, enum types, function, -// member variables. With a setting of 1, full backward compatibility with the -// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, -// as future development will be done only on the non-deprecated -// functions/classes/member variables/etc. -#define wxODBC_BACKWARD_COMPATABILITY 0 - -// ---------------------------------------------------------------------------- -// other compiler (mis)features -// ---------------------------------------------------------------------------- - -// Set this to 0 if your compiler can't cope with omission of prototype -// parameters. -// -// Default is 1. -// -// Recommended setting: 1 (should never need to set this to 0) -#define REMOVE_UNUSED_ARG 1 - -// VC++ 4.2 and above allows and but you can't mix -// them. Set to 1 for , 0 for . Note that VC++ 7.1 -// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be -// used anyhow. -// -// Default is 1. -// -// Recommended setting: whatever your compiler likes more -#define wxUSE_IOSTREAMH 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// Windows-only settings -// ---------------------------------------------------------------------------- - -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). -// -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net -// -// Default is 0 -// -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 -#endif - -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxAutomationObject class. -// -// Default is 1. -// -// Recommended setting: 1 if you need to control other applications via OLE -// Automation, can be safely set to 0 otherwise -#define wxUSE_OLE_AUTOMATION 1 - -// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE -// controls in wx. -// -// Default is 1. -// -// Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 - -// wxDC cacheing implementation -#define wxUSE_DC_CACHEING 1 - -// Set this to 1 to enable the use of DIB's for wxBitmap to support -// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. -#define wxUSE_DIB_FOR_BITMAP 0 - -// Set this to 1 to enable wxDIB class used internally for manipulating -// wxBitmao data. -// -// Default is 1, set it to 0 only if you don't use wxImage neither -// -// Recommended setting: 1 (without it conversion to/from wxImage won't work) -#define wxUSE_WXDIB 1 - -// Set to 0 to disable PostScript print/preview architecture code under Windows -// (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 - -// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH -// which allows to put more than ~32Kb of text in it even under Win9x (NT -// doesn't have such limitation). -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1, only set it to 0 if your compiler doesn't have -// or can't compile -#define wxUSE_RICHEDIT 1 - -// Set this to 1 to use extra features of richedit v2 and later controls -// -// Default is 1 for compilers which support it -// -// Recommended setting: 1 -#define wxUSE_RICHEDIT2 1 - -// Set this to 1 to enable support for the owner-drawn menu and listboxes. This -// is required by wxUSE_CHECKLISTBOX. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a small library size reduction -#define wxUSE_OWNER_DRAWN 1 - -// Set to 1 to compile MS Windows XP theme engine support -#define wxUSE_UXTHEME 1 - -// Set to 1 to auto-adapt to MS Windows XP themes where possible -// (notably, wxNotebook pages) -#define wxUSE_UXTHEME_AUTO 1 - -// Set to 1 to use InkEdit control (Tablet PC), if available -#define wxUSE_INKEDIT 0 - -// ---------------------------------------------------------------------------- -// Generic versions of native controls -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the -// native wxDatePickerCtrl -// -// Default is 0. -// -// Recommended setting: 0, this is mainly used for testing -#define wxUSE_DATEPICKCTRL_GENERIC 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 - -// ---------------------------------------------------------------------------- -// obsolete settings -// ---------------------------------------------------------------------------- - -// NB: all settings in this section are obsolete and should not be used/changed -// at all, they will disappear - -// Define 1 to use bitmap messages. -#define wxUSE_BITMAP_MESSAGE 1 - -#endif // _WX_SETUP_H_ - +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id: setup0.h 51451 2008-01-29 23:11:55Z VZ $ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.4 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 0 + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list and std::vector, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM 0 + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library header, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_STRING 0 +#else + #define wxUSE_STD_STRING 1 +#endif + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatibility with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for . Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + +/* --- end common options --- */ + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode +// and want to run your programs under Windows 9x and not only NT/2000/XP. +// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note +// that you will have to modify the makefiles to include unicows.lib import +// library as the first library (see installation instructions in install.txt +// to learn how to do it when building the library or samples). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) +#ifndef wxUSE_UNICODE_MSLU + #define wxUSE_UNICODE_MSLU 0 +#endif + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmao data. +// +// Default is 1, set it to 0 only if you don't use wxImage neither +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 1 + +#endif // _WX_SETUP_H_ + diff --git a/Externals/wxWidgets/src/png/png.h b/Externals/wxWidgets/src/png/png.h index 8f7fd8da22..b57acb4141 100644 --- a/Externals/wxWidgets/src/png/png.h +++ b/Externals/wxWidgets/src/png/png.h @@ -1,3364 +1,3364 @@ -/* png.h - header file for PNG reference library - * - * libpng version 1.2.7 - September 12, 2004 - * Copyright (c) 1998-2004 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * Authors and maintainers: - * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat - * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.7 - September 12, 2004: Glenn - * See also "Contributing Authors", below. - * - * Note about libpng version numbers: - * - * Due to various miscommunications, unforeseen code incompatibilities - * and occasional factors outside the authors' control, version numbering - * on the library has not always been consistent and straightforward. - * The following table summarizes matters since version 0.89c, which was - * the first widely used release: - * - * source png.h png.h shared-lib - * version string int version - * ------- ------ ----- ---------- - * 0.89c "1.0 beta 3" 0.89 89 1.0.89 - * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] - * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] - * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] - * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] - * 0.97c 0.97 97 2.0.97 - * 0.98 0.98 98 2.0.98 - * 0.99 0.99 98 2.0.99 - * 0.99a-m 0.99 99 2.0.99 - * 1.00 1.00 100 2.1.0 [100 should be 10000] - * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] - * 1.0.1 png.h string is 10001 2.1.0 - * 1.0.1a-e identical to the 10002 from here on, the shared library - * 1.0.2 source version) 10002 is 2.V where V is the source code - * 1.0.2a-b 10003 version, except as noted. - * 1.0.3 10003 - * 1.0.3a-d 10004 - * 1.0.4 10004 - * 1.0.4a-f 10005 - * 1.0.5 (+ 2 patches) 10005 - * 1.0.5a-d 10006 - * 1.0.5e-r 10100 (not source compatible) - * 1.0.5s-v 10006 (not binary compatible) - * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) - * 1.0.6d-f 10007 (still binary incompatible) - * 1.0.6g 10007 - * 1.0.6h 10007 10.6h (testing xy.z so-numbering) - * 1.0.6i 10007 10.6i - * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) - * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) - * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) - * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) - * 1.0.7 1 10007 (still compatible) - * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 - * 1.0.8rc1 1 10008 2.1.0.8rc1 - * 1.0.8 1 10008 2.1.0.8 - * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 - * 1.0.9rc1 1 10009 2.1.0.9rc1 - * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 - * 1.0.9rc2 1 10009 2.1.0.9rc2 - * 1.0.9 1 10009 2.1.0.9 - * 1.0.10beta1 1 10010 2.1.0.10beta1 - * 1.0.10rc1 1 10010 2.1.0.10rc1 - * 1.0.10 1 10010 2.1.0.10 - * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 - * 1.0.11rc1 1 10011 2.1.0.11rc1 - * 1.0.11 1 10011 2.1.0.11 - * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 - * 1.0.12rc1 2 10012 2.1.0.12rc1 - * 1.0.12 2 10012 2.1.0.12 - * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) - * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 - * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 - * 1.2.0rc1 3 10200 3.1.2.0rc1 - * 1.2.0 3 10200 3.1.2.0 - * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 - * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 - * 1.2.1 3 10201 3.1.2.1 - * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 - * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 - * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 - * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 - * 1.0.13 10 10013 10.so.0.1.0.13 - * 1.2.2 12 10202 12.so.0.1.2.2 - * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 - * 1.2.3 12 10203 12.so.0.1.2.3 - * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 - * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 - * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 - * 1.0.14 10 10014 10.so.0.1.0.14 - * 1.2.4 13 10204 12.so.0.1.2.4 - * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 - * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 - * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 - * 1.0.15 10 10015 10.so.0.1.0.15 - * 1.2.5 13 10205 12.so.0.1.2.5 - * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 - * 1.0.16 10 10016 10.so.0.1.0.16 - * 1.2.6 13 10206 12.so.0.1.2.6 - * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 - * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 - * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 - * 1.0.17 10 10017 12.so.0.1.0.17 - * 1.2.7 13 10207 12.so.0.1.2.7 - * - * Henceforth the source version will match the shared-library major - * and minor numbers; the shared-library major version number will be - * used for changes in backward compatibility, as it is intended. The - * PNG_LIBPNG_VER macro, which is not used within libpng but is available - * for applications, is an unsigned integer of the form xyyzz corresponding - * to the source version x.y.z (leading zeros in y and z). Beta versions - * were given the previous public release number plus a letter, until - * version 1.0.6j; from then on they were given the upcoming public - * release number plus "betaNN" or "rcN". - * - * Binary incompatibility exists only when applications make direct access - * to the info_ptr or png_ptr members through png.h, and the compiled - * application is loaded with a different version of the library. - * - * DLLNUM will change each time there are forward or backward changes - * in binary compatibility (e.g., when a new feature is added). - * - * See libpng.txt or libpng.3 for more information. The PNG specification - * is available as a W3C Recommendation and as an ISO Specification, - * defines should NOT be changed. - */ -#define PNG_INFO_gAMA 0x0001 -#define PNG_INFO_sBIT 0x0002 -#define PNG_INFO_cHRM 0x0004 -#define PNG_INFO_PLTE 0x0008 -#define PNG_INFO_tRNS 0x0010 -#define PNG_INFO_bKGD 0x0020 -#define PNG_INFO_hIST 0x0040 -#define PNG_INFO_pHYs 0x0080 -#define PNG_INFO_oFFs 0x0100 -#define PNG_INFO_tIME 0x0200 -#define PNG_INFO_pCAL 0x0400 -#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ -#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ -#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ -#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ -#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ - -/* This is used for the transformation routines, as some of them - * change these values for the row. It also should enable using - * the routines for other purposes. - */ -typedef struct png_row_info_struct -{ - png_uint_32 width; /* width of row */ - png_uint_32 rowbytes; /* number of bytes in row */ - png_byte color_type; /* color type of row */ - png_byte bit_depth; /* bit depth of row */ - png_byte channels; /* number of channels (1, 2, 3, or 4) */ - png_byte pixel_depth; /* bits per pixel (depth * channels) */ -} png_row_info; - -typedef png_row_info FAR * png_row_infop; -typedef png_row_info FAR * FAR * png_row_infopp; - -/* These are the function types for the I/O functions and for the functions - * that allow the user to override the default I/O functions with his or her - * own. The png_error_ptr type should match that of user-supplied warning - * and error functions, while the png_rw_ptr type should match that of the - * user read/write data functions. - */ -typedef struct png_struct_def png_struct; -typedef png_struct FAR * png_structp; - -typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); -typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); -typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); -typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, - int)); -typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, - int)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); -typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); -typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, - png_uint_32, int)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, - png_row_infop, png_bytep)); -#endif - -#if defined(PNG_USER_CHUNKS_SUPPORTED) -typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); -#endif -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); -#endif - -/* Transform masks for the high-level interface */ -#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ -#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ -#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ -#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ -#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ -#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ -#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ -#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ -#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ -#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ -#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ -#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ -#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ - -/* Flags for MNG supported features */ -#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 -#define PNG_FLAG_MNG_FILTER_64 0x04 -#define PNG_ALL_MNG_FEATURES 0x05 - -typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); -typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); - -/* The structure that holds the information to read and write PNG files. - * The only people who need to care about what is inside of this are the - * people who will be modifying the library for their own special needs. - * It should NOT be accessed directly by an application, except to store - * the jmp_buf. - */ - -struct png_struct_def -{ -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf jmpbuf; /* used in png_error */ -#endif - png_error_ptr error_fn; /* function for printing errors and aborting */ - png_error_ptr warning_fn; /* function for printing warnings */ - png_voidp error_ptr; /* user supplied struct for error functions */ - png_rw_ptr write_data_fn; /* function for writing output data */ - png_rw_ptr read_data_fn; /* function for reading input data */ - png_voidp io_ptr; /* ptr to application struct for I/O functions */ - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - png_user_transform_ptr read_user_transform_fn; /* user read transform */ -#endif - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - png_user_transform_ptr write_user_transform_fn; /* user write transform */ -#endif - -/* These were added in libpng-1.0.2 */ -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - png_voidp user_transform_ptr; /* user supplied struct for user transform */ - png_byte user_transform_depth; /* bit depth of user transformed pixels */ - png_byte user_transform_channels; /* channels in user transformed pixels */ -#endif -#endif - - png_uint_32 mode; /* tells us where we are in the PNG file */ - png_uint_32 flags; /* flags indicating various things to libpng */ - png_uint_32 transformations; /* which transformations to perform */ - - z_stream zstream; /* pointer to decompression structure (below) */ - png_bytep zbuf; /* buffer for zlib */ - png_size_t zbuf_size; /* size of zbuf */ - int zlib_level; /* holds zlib compression level */ - int zlib_method; /* holds zlib compression method */ - int zlib_window_bits; /* holds zlib compression window bits */ - int zlib_mem_level; /* holds zlib compression memory level */ - int zlib_strategy; /* holds zlib compression strategy */ - - png_uint_32 width; /* width of image in pixels */ - png_uint_32 height; /* height of image in pixels */ - png_uint_32 num_rows; /* number of rows in current pass */ - png_uint_32 usr_width; /* width of row at start of write */ - png_uint_32 rowbytes; /* size of row in bytes */ - png_uint_32 irowbytes; /* size of current interlaced row in bytes */ - png_uint_32 iwidth; /* width of current interlaced row in pixels */ - png_uint_32 row_number; /* current row in interlace pass */ - png_bytep prev_row; /* buffer to save previous (unfiltered) row */ - png_bytep row_buf; /* buffer to save current (unfiltered) row */ - png_bytep sub_row; /* buffer to save "sub" row when filtering */ - png_bytep up_row; /* buffer to save "up" row when filtering */ - png_bytep avg_row; /* buffer to save "avg" row when filtering */ - png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ - png_row_info row_info; /* used for transformation routines */ - - png_uint_32 idat_size; /* current IDAT size for read */ - png_uint_32 crc; /* current chunk CRC value */ - png_colorp palette; /* palette from the input file */ - png_uint_16 num_palette; /* number of color entries in palette */ - png_uint_16 num_trans; /* number of transparency values */ - png_byte chunk_name[5]; /* null-terminated name of current chunk */ - png_byte compression; /* file compression type (always 0) */ - png_byte filter; /* file filter type (always 0) */ - png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ - png_byte pass; /* current interlace pass (0 - 6) */ - png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ - png_byte color_type; /* color type of file */ - png_byte bit_depth; /* bit depth of file */ - png_byte usr_bit_depth; /* bit depth of users row */ - png_byte pixel_depth; /* number of bits per pixel */ - png_byte channels; /* number of channels in file */ - png_byte usr_channels; /* channels at start of write */ - png_byte sig_bytes; /* magic bytes read/written from start of file */ - -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) -#ifdef PNG_LEGACY_SUPPORTED - png_byte filler; /* filler byte for pixel expansion */ -#else - png_uint_16 filler; /* filler bytes for pixel expansion */ -#endif -#endif - -#if defined(PNG_bKGD_SUPPORTED) - png_byte background_gamma_type; -# ifdef PNG_FLOATING_POINT_SUPPORTED - float background_gamma; -# endif - png_color_16 background; /* background color in screen gamma space */ -#if defined(PNG_READ_GAMMA_SUPPORTED) - png_color_16 background_1; /* background normalized to gamma 1.0 */ -#endif -#endif /* PNG_bKGD_SUPPORTED */ - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) - png_flush_ptr output_flush_fn;/* Function for flushing output */ - png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ - png_uint_32 flush_rows; /* number of rows written since last flush */ -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ -#ifdef PNG_FLOATING_POINT_SUPPORTED - float gamma; /* file gamma value */ - float screen_gamma; /* screen gamma value (display_exponent) */ -#endif -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_bytep gamma_table; /* gamma table for 8-bit depth files */ - png_bytep gamma_from_1; /* converts from 1.0 to screen */ - png_bytep gamma_to_1; /* converts from file to 1.0 */ - png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ - png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ - png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) - png_color_8 sig_bit; /* significant bits in each available channel */ -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) - png_color_8 shift; /* shift for significant bit tranformation */ -#endif - -#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ - || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_bytep trans; /* transparency values for paletted files */ - png_color_16 trans_values; /* transparency values for non-paletted files */ -#endif - - png_read_status_ptr read_row_fn; /* called after each row is decoded */ - png_write_status_ptr write_row_fn; /* called after each row is encoded */ -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED - png_progressive_info_ptr info_fn; /* called after header data fully read */ - png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ - png_progressive_end_ptr end_fn; /* called after image is complete */ - png_bytep save_buffer_ptr; /* current location in save_buffer */ - png_bytep save_buffer; /* buffer for previously read data */ - png_bytep current_buffer_ptr; /* current location in current_buffer */ - png_bytep current_buffer; /* buffer for recently used data */ - png_uint_32 push_length; /* size of current input chunk */ - png_uint_32 skip_length; /* bytes to skip in input data */ - png_size_t save_buffer_size; /* amount of data now in save_buffer */ - png_size_t save_buffer_max; /* total size of save_buffer */ - png_size_t buffer_size; /* total amount of available input data */ - png_size_t current_buffer_size; /* amount of data now in current_buffer */ - int process_mode; /* what push library is currently doing */ - int cur_palette; /* current push library palette index */ - -# if defined(PNG_TEXT_SUPPORTED) - png_size_t current_text_size; /* current size of text input data */ - png_size_t current_text_left; /* how much text left to read in input */ - png_charp current_text; /* current text chunk buffer */ - png_charp current_text_ptr; /* current location in current_text */ -# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */ - -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) -/* for the Borland special 64K segment handler */ - png_bytepp offset_table_ptr; - png_bytep offset_table; - png_uint_16 offset_table_number; - png_uint_16 offset_table_count; - png_uint_16 offset_table_count_free; -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) - png_bytep palette_lookup; /* lookup table for dithering */ - png_bytep dither_index; /* index translation for palette files */ -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) - png_uint_16p hist; /* histogram */ -#endif - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - png_byte heuristic_method; /* heuristic for row filter selection */ - png_byte num_prev_filters; /* number of weights for previous rows */ - png_bytep prev_filters; /* filter type(s) of previous row(s) */ - png_uint_16p filter_weights; /* weight(s) for previous line(s) */ - png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ - png_uint_16p filter_costs; /* relative filter calculation cost */ - png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) - png_charp time_buffer; /* String to hold RFC 1123 time text */ -#endif - -/* New members added in libpng-1.0.6 */ - -#ifdef PNG_FREE_ME_SUPPORTED - png_uint_32 free_me; /* flags items libpng is responsible for freeing */ -#endif - -#if defined(PNG_USER_CHUNKS_SUPPORTED) - png_voidp user_chunk_ptr; - png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ -#endif - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - int num_chunk_list; - png_bytep chunk_list; -#endif - -/* New members added in libpng-1.0.3 */ -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - png_byte rgb_to_gray_status; - /* These were changed from png_byte in libpng-1.0.6 */ - png_uint_16 rgb_to_gray_red_coeff; - png_uint_16 rgb_to_gray_green_coeff; - png_uint_16 rgb_to_gray_blue_coeff; -#endif - -/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ -#if defined(PNG_MNG_FEATURES_SUPPORTED) || \ - defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ - defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -/* changed from png_byte to png_uint_32 at version 1.2.0 */ -#ifdef PNG_1_0_X - png_byte mng_features_permitted; -#else - png_uint_32 mng_features_permitted; -#endif /* PNG_1_0_X */ -#endif - -/* New member added in libpng-1.0.7 */ -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_fixed_point int_gamma; -#endif - -/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ -#if defined(PNG_MNG_FEATURES_SUPPORTED) - png_byte filter_type; -#endif - -#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)) -/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ - png_uint_32 row_buf_size; -#endif - -/* New members added in libpng-1.2.0 */ -#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) - png_byte mmx_bitdepth_threshold; - png_uint_32 mmx_rowbytes_threshold; - png_uint_32 asm_flags; -#endif - -/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ -#ifdef PNG_USER_MEM_SUPPORTED - png_voidp mem_ptr; /* user supplied struct for mem functions */ - png_malloc_ptr malloc_fn; /* function for allocating memory */ - png_free_ptr free_fn; /* function for freeing memory */ -#endif - -/* New member added in libpng-1.0.13 and 1.2.0 */ - png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ - -#if defined(PNG_READ_DITHER_SUPPORTED) -/* The following three members were added at version 1.0.14 and 1.2.4 */ - png_bytep dither_sort; /* working sort array */ - png_bytep index_to_palette; /* where the original index currently is */ - /* in the palette */ - png_bytep palette_to_index; /* which original index points to this */ - /* palette color */ -#endif - -/* New members added in libpng-1.0.16 and 1.2.6 */ - png_byte compression_type; - -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - png_uint_32 user_width_max; - png_uint_32 user_height_max; -#endif - -}; - - -/* This triggers a compiler error in png.c, if png.c and png.h - * do not agree upon the version number. - */ -typedef png_structp version_1_2_7; - -typedef png_struct FAR * FAR * png_structpp; - -/* Here are the function definitions most commonly used. This is not - * the place to find out how to use libpng. See libpng.txt for the - * full explanation, see example.c for the summary. This just provides - * a simple one line description of the use of each function. - */ - -/* Returns the version number of the library */ -extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); - -/* Tell lib we have already handled the first magic bytes. - * Handling more than 8 bytes from the beginning of the file is an error. - */ -extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, - int num_bytes)); - -/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a - * PNG file. Returns zero if the supplied bytes match the 8-byte PNG - * signature, and non-zero otherwise. Having num_to_check == 0 or - * start > 7 will always fail (ie return non-zero). - */ -extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, - png_size_t num_to_check)); - -/* Simple signature checking function. This is the same as calling - * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). - */ -extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); - -/* Allocate and initialize png_ptr struct for reading, and any other memory. */ -extern PNG_EXPORT(png_structp,png_create_read_struct) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn)); - -/* Allocate and initialize png_ptr struct for writing, and any other memory */ -extern PNG_EXPORT(png_structp,png_create_write_struct) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn)); - -#ifdef PNG_WRITE_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) - PNGARG((png_structp png_ptr)); -#endif - -#ifdef PNG_WRITE_SUPPORTED -extern PNG_EXPORT(void,png_set_compression_buffer_size) - PNGARG((png_structp png_ptr, png_uint_32 size)); -#endif - -/* Reset the compression stream */ -extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); - -/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ -#ifdef PNG_USER_MEM_SUPPORTED -extern PNG_EXPORT(png_structp,png_create_read_struct_2) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -extern PNG_EXPORT(png_structp,png_create_write_struct_2) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -#endif - -/* Write a PNG chunk - size, type, (optional) data, CRC. */ -extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, - png_bytep chunk_name, png_bytep data, png_size_t length)); - -/* Write the start of a PNG chunk - length and chunk name. */ -extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, - png_bytep chunk_name, png_uint_32 length)); - -/* Write the data of a PNG chunk started with png_write_chunk_start(). */ -extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, - png_bytep data, png_size_t length)); - -/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ -extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); - -/* Allocate and initialize the info structure */ -extern PNG_EXPORT(png_infop,png_create_info_struct) - PNGARG((png_structp png_ptr)); - -/* Initialize the info structure (old interface - DEPRECATED) */ -extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); -#undef png_info_init -#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\ - png_sizeof(png_info)); -extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, - png_size_t png_info_struct_size)); - -/* Writes all the PNG information before the image. */ -extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the information before the actual image data. */ -extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) -extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) - PNGARG((png_structp png_ptr, png_timep ptime)); -#endif - -#if !defined(_WIN32_WCE) -/* "time.h" functions are not supported on WindowsCE */ -#if defined(PNG_WRITE_tIME_SUPPORTED) -/* convert from a struct tm to png_time */ -extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, - struct tm FAR * ttime)); - -/* convert from time_t to png_time. Uses gmtime() */ -extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, - time_t ttime)); -#endif /* PNG_WRITE_tIME_SUPPORTED */ -#endif /* _WIN32_WCE */ - -#if defined(PNG_READ_EXPAND_SUPPORTED) -/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ -extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* Use blue, green, red order for pixels. */ -extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -/* Expand the grayscale to 24-bit RGB if necessary. */ -extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -/* Reduce RGB to grayscale. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, - int error_action, double red, double green )); -#endif -extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, - int error_action, png_fixed_point red, png_fixed_point green )); -extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp - png_ptr)); -#endif - -extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, - png_colorp palette)); - -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) -/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ -extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, - png_uint_32 filler, int flags)); -/* The values of the PNG_FILLER_ defines should NOT be changed */ -#define PNG_FILLER_BEFORE 0 -#define PNG_FILLER_AFTER 1 -/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ -#if !defined(PNG_1_0_X) -extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, - png_uint_32 filler, int flags)); -#endif -#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* Swap bytes in 16-bit depth files. */ -extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) -/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ -extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) -/* Swap packing order of pixels in bytes. */ -extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) -/* Converts files to legal bit depths. */ -extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, - png_color_8p true_bits)); -#endif - -#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ - defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* Have the code handle the interlacing. Returns the number of passes. */ -extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -/* Invert monochrome files */ -extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) -/* Handle alpha and tRNS by replacing with a background color. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, - png_color_16p background_color, int background_gamma_code, - int need_expand, double background_gamma)); -#endif -#define PNG_BACKGROUND_GAMMA_UNKNOWN 0 -#define PNG_BACKGROUND_GAMMA_SCREEN 1 -#define PNG_BACKGROUND_GAMMA_FILE 2 -#define PNG_BACKGROUND_GAMMA_UNIQUE 3 -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) -/* strip the second byte of information from a 16-bit depth file. */ -extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) -/* Turn on dithering, and reduce the palette to the number of colors available. */ -extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, - png_colorp palette, int num_palette, int maximum_colors, - png_uint_16p histogram, int full_dither)); -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) -/* Handle gamma correction. Screen_gamma=(display_exponent) */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, - double screen_gamma, double default_file_gamma)); -#endif -#endif - -#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ - defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ -/* Deprecated and will be removed. Use png_permit_mng_features() instead. */ -extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, - int empty_plte_permitted)); -#endif - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -/* Set how many lines between output flushes - 0 for no flushing */ -extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); -/* Flush the current PNG output buffer */ -extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); -#endif - -/* optional update palette with requested transformations */ -extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); - -/* optional call to update the users info structure */ -extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read one or more rows of image data. */ -extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, - png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); -#endif - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read a row of data. */ -extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, - png_bytep row, - png_bytep display_row)); -#endif - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the whole image into memory at once. */ -extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, - png_bytepp image)); -#endif - -/* write a row of image data */ -extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, - png_bytep row)); - -/* write a few rows of image data */ -extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, - png_bytepp row, png_uint_32 num_rows)); - -/* write the image data */ -extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, - png_bytepp image)); - -/* writes the end of the PNG file. */ -extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the end of the PNG file. */ -extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif - -/* free any memory associated with the png_info_struct */ -extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, - png_infopp info_ptr_ptr)); - -/* free any memory associated with the png_struct and the png_info_structs */ -extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp - png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); - -/* free all memory used by the read (old method - NOT DLL EXPORTED) */ -extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, - png_infop end_info_ptr)); - -/* free any memory associated with the png_struct and the png_info_structs */ -extern PNG_EXPORT(void,png_destroy_write_struct) - PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); - -/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ -extern void png_write_destroy PNGARG((png_structp png_ptr)); - -/* set the libpng method of handling chunk CRC errors */ -extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, - int crit_action, int ancil_action)); - -/* Values for png_set_crc_action() to say how to handle CRC errors in - * ancillary and critical chunks, and whether to use the data contained - * therein. Note that it is impossible to "discard" data in a critical - * chunk. For versions prior to 0.90, the action was always error/quit, - * whereas in version 0.90 and later, the action for CRC errors in ancillary - * chunks is warn/discard. These values should NOT be changed. - * - * value action:critical action:ancillary - */ -#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ -#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ -#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ -#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ -#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ -#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ - -/* These functions give the user control over the scan-line filtering in - * libpng and the compression methods used by zlib. These functions are - * mainly useful for testing, as the defaults should work with most users. - * Those users who are tight on memory or want faster performance at the - * expense of compression can modify them. See the compression library - * header file (zlib.h) for an explination of the compression functions. - */ - -/* set the filtering method(s) used by libpng. Currently, the only valid - * value for "method" is 0. - */ -extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, - int filters)); - -/* Flags for png_set_filter() to say which filters to use. The flags - * are chosen so that they don't conflict with real filter types - * below, in case they are supplied instead of the #defined constants. - * These values should NOT be changed. - */ -#define PNG_NO_FILTERS 0x00 -#define PNG_FILTER_NONE 0x08 -#define PNG_FILTER_SUB 0x10 -#define PNG_FILTER_UP 0x20 -#define PNG_FILTER_AVG 0x40 -#define PNG_FILTER_PAETH 0x80 -#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ - PNG_FILTER_AVG | PNG_FILTER_PAETH) - -/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. - * These defines should NOT be changed. - */ -#define PNG_FILTER_VALUE_NONE 0 -#define PNG_FILTER_VALUE_SUB 1 -#define PNG_FILTER_VALUE_UP 2 -#define PNG_FILTER_VALUE_AVG 3 -#define PNG_FILTER_VALUE_PAETH 4 -#define PNG_FILTER_VALUE_LAST 5 - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ -/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ - * defines, either the default (minimum-sum-of-absolute-differences), or - * the experimental method (weighted-minimum-sum-of-absolute-differences). - * - * Weights are factors >= 1.0, indicating how important it is to keep the - * filter type consistent between rows. Larger numbers mean the current - * filter is that many times as likely to be the same as the "num_weights" - * previous filters. This is cumulative for each previous row with a weight. - * There needs to be "num_weights" values in "filter_weights", or it can be - * NULL if the weights aren't being specified. Weights have no influence on - * the selection of the first row filter. Well chosen weights can (in theory) - * improve the compression for a given image. - * - * Costs are factors >= 1.0 indicating the relative decoding costs of a - * filter type. Higher costs indicate more decoding expense, and are - * therefore less likely to be selected over a filter with lower computational - * costs. There needs to be a value in "filter_costs" for each valid filter - * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't - * setting the costs. Costs try to improve the speed of decompression without - * unduly increasing the compressed image size. - * - * A negative weight or cost indicates the default value is to be used, and - * values in the range [0.0, 1.0) indicate the value is to remain unchanged. - * The default values for both weights and costs are currently 1.0, but may - * change if good general weighting/cost heuristics can be found. If both - * the weights and costs are set to 1.0, this degenerates the WEIGHTED method - * to the UNWEIGHTED method, but with added encoding time/computation. - */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, - int heuristic_method, int num_weights, png_doublep filter_weights, - png_doublep filter_costs)); -#endif -#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ - -/* Heuristic used for row filter selection. These defines should NOT be - * changed. - */ -#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ -#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ -#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ -#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ - -/* Set the library compression level. Currently, valid values range from - * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 - * (0 - no compression, 9 - "maximal" compression). Note that tests have - * shown that zlib compression levels 3-6 usually perform as well as level 9 - * for PNG images, and do considerably fewer caclulations. In the future, - * these values may not correspond directly to the zlib compression levels. - */ -extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, - int level)); - -extern PNG_EXPORT(void,png_set_compression_mem_level) - PNGARG((png_structp png_ptr, int mem_level)); - -extern PNG_EXPORT(void,png_set_compression_strategy) - PNGARG((png_structp png_ptr, int strategy)); - -extern PNG_EXPORT(void,png_set_compression_window_bits) - PNGARG((png_structp png_ptr, int window_bits)); - -extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, - int method)); - -/* These next functions are called for input/output, memory, and error - * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, - * and call standard C I/O routines such as fread(), fwrite(), and - * fprintf(). These functions can be made to use other I/O routines - * at run time for those applications that need to handle I/O in a - * different manner by calling png_set_???_fn(). See libpng.txt for - * more information. - */ - -#if !defined(PNG_NO_STDIO) -/* Initialize the input/output for the PNG file to the default functions. */ -extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); -#endif - -/* Replace the (error and abort), and warning functions with user - * supplied functions. If no messages are to be printed you must still - * write and use replacement functions. The replacement error_fn should - * still do a longjmp to the last setjmp location if you are using this - * method of error handling. If error_fn or warning_fn is NULL, the - * default function will be used. - */ - -extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, - png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); - -/* Return the user pointer associated with the error functions */ -extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); - -/* Replace the default data output functions with a user supplied one(s). - * If buffered output is not used, then output_flush_fn can be set to NULL. - * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time - * output_flush_fn will be ignored (and thus can be NULL). - */ -extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, - png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); - -/* Replace the default data input function with a user supplied one. */ -extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, - png_voidp io_ptr, png_rw_ptr read_data_fn)); - -/* Return the user pointer associated with the I/O functions */ -extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); - -extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, - png_read_status_ptr read_row_fn)); - -extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, - png_write_status_ptr write_row_fn)); - -#ifdef PNG_USER_MEM_SUPPORTED -/* Replace the default memory allocation functions with user supplied one(s). */ -extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, - png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -/* Return the user pointer associated with the memory functions */ -extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp - png_ptr, png_user_transform_ptr read_user_transform_fn)); -#endif - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp - png_ptr, png_user_transform_ptr write_user_transform_fn)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp - png_ptr, png_voidp user_transform_ptr, int user_transform_depth, - int user_transform_channels)); -/* Return the user pointer associated with the user transform functions */ -extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) - PNGARG((png_structp png_ptr)); -#endif - -#ifdef PNG_USER_CHUNKS_SUPPORTED -extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, - png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); -extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp - png_ptr)); -#endif - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -/* Sets the function callbacks for the push reader, and a pointer to a - * user-defined structure available to the callback functions. - */ -extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, - png_voidp progressive_ptr, - png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, - png_progressive_end_ptr end_fn)); - -/* returns the user pointer associated with the push read functions */ -extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) - PNGARG((png_structp png_ptr)); - -/* function to be called when data becomes available */ -extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); - -/* function that combines rows. Not very much different than the - * png_combine_row() call. Is this even used????? - */ -extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, - png_bytep old_row, png_bytep new_row)); -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, - png_uint_32 size)); - -#if defined(PNG_1_0_X) -# define png_malloc_warn png_malloc -#else -/* Added at libpng version 1.2.4 */ -extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, - png_uint_32 size)); -#endif - -/* frees a pointer allocated by png_malloc() */ -extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); - -#if defined(PNG_1_0_X) -/* Function to allocate memory for zlib. */ -extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, - uInt size)); - -/* Function to free memory for zlib */ -extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); -#endif - -/* Free data that was allocated internally */ -extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 free_me, int num)); -#ifdef PNG_FREE_ME_SUPPORTED -/* Reassign responsibility for freeing existing data, whether allocated - * by libpng or by the application */ -extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, - png_infop info_ptr, int freer, png_uint_32 mask)); -#endif -/* assignments for png_data_freer */ -#define PNG_DESTROY_WILL_FREE_DATA 1 -#define PNG_SET_WILL_FREE_DATA 1 -#define PNG_USER_WILL_FREE_DATA 2 -/* Flags for png_ptr->free_me and info_ptr->free_me */ -#define PNG_FREE_HIST 0x0008 -#define PNG_FREE_ICCP 0x0010 -#define PNG_FREE_SPLT 0x0020 -#define PNG_FREE_ROWS 0x0040 -#define PNG_FREE_PCAL 0x0080 -#define PNG_FREE_SCAL 0x0100 -#define PNG_FREE_UNKN 0x0200 -#define PNG_FREE_LIST 0x0400 -#define PNG_FREE_PLTE 0x1000 -#define PNG_FREE_TRNS 0x2000 -#define PNG_FREE_TEXT 0x4000 -#define PNG_FREE_ALL 0x7fff -#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ - -#ifdef PNG_USER_MEM_SUPPORTED -extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, - png_uint_32 size)); -extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, - png_voidp ptr)); -#endif - -extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, - png_voidp s1, png_voidp s2, png_uint_32 size)); - -extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, - png_voidp s1, int value, png_uint_32 size)); - -#if defined(USE_FAR_KEYWORD) /* memory model conversion function */ -extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, - int check)); -#endif /* USE_FAR_KEYWORD */ - -/* Fatal error in PNG image of libpng - can't continue */ -extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, - png_const_charp error_message)); - -/* The same, but the chunk name is prepended to the error string. */ -extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, - png_const_charp error_message)); - -/* Non-fatal error in libpng. Can continue, but may have a problem. */ -extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, - png_const_charp warning_message)); - -/* Non-fatal error in libpng, chunk name is prepended to message. */ -extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, - png_const_charp warning_message)); - -/* The png_set_ functions are for storing values in the png_info_struct. - * Similarly, the png_get_ calls are used to read values from the - * png_info_struct, either storing the parameters in the passed variables, or - * setting pointers into the png_info_struct where the data is stored. The - * png_get_ functions return a non-zero value if the data was available - * in info_ptr, or return zero and do not change any of the parameters if the - * data was not available. - * - * These functions should be used instead of directly accessing png_info - * to avoid problems with future changes in the size and internal layout of - * png_info_struct. - */ -/* Returns "flag" if chunk data is valid in info_ptr. */ -extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, -png_infop info_ptr, png_uint_32 flag)); - -/* Returns number of bytes needed to hold a transformed row. */ -extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -/* Returns row_pointers, which is an array of pointers to scanlines that was -returned from png_read_png(). */ -extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, -png_infop info_ptr)); -/* Set row_pointers, which is an array of pointers to scanlines for use -by png_write_png(). */ -extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytepp row_pointers)); -#endif - -/* Returns number of color channels in image. */ -extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#ifdef PNG_EASY_ACCESS_SUPPORTED -/* Returns image width in pixels. */ -extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image height in pixels. */ -extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image bit_depth. */ -extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image color_type. */ -extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image filter_type. */ -extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image interlace_type. */ -extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image compression_type. */ -extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image resolution in pixels per meter, from pHYs chunk data. */ -extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns pixel aspect ratio, computed from pHYs chunk data. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -#endif - -/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ -extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -#endif /* PNG_EASY_ACCESS_SUPPORTED */ - -/* Returns pointer to signature string read from PNG header */ -extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#if defined(PNG_bKGD_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_16p *background)); -#endif - -#if defined(PNG_bKGD_SUPPORTED) -extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_16p background)); -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, - png_infop info_ptr, double *white_x, double *white_y, double *red_x, - double *red_y, double *green_x, double *green_y, double *blue_x, - double *blue_y)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point - *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, - png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point - *int_blue_x, png_fixed_point *int_blue_y)); -#endif -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, - png_infop info_ptr, double white_x, double white_y, double red_x, - double red_y, double green_x, double green_y, double blue_x, double blue_y)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, - png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point - int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); -#endif -#endif - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, - png_infop info_ptr, double *file_gamma)); -#endif -extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point *int_file_gamma)); -#endif - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, - png_infop info_ptr, double file_gamma)); -#endif -extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point int_file_gamma)); -#endif - -#if defined(PNG_hIST_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_16p *hist)); -#endif - -#if defined(PNG_hIST_SUPPORTED) -extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_16p hist)); -#endif - -extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, - int *bit_depth, int *color_type, int *interlace_method, - int *compression_method, int *filter_method)); - -extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_method, int compression_method, - int filter_method)); - -#if defined(PNG_oFFs_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, - int *unit_type)); -#endif - -#if defined(PNG_oFFs_SUPPORTED) -extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, - int unit_type)); -#endif - -#if defined(PNG_pCAL_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, - int *type, int *nparams, png_charp *units, png_charpp *params)); -#endif - -#if defined(PNG_pCAL_SUPPORTED) -extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, - int type, int nparams, png_charp units, png_charpp params)); -#endif - -#if defined(PNG_pHYs_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); -#endif - -#if defined(PNG_pHYs_SUPPORTED) -extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); -#endif - -extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_colorp *palette, int *num_palette)); - -extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_colorp palette, int num_palette)); - -#if defined(PNG_sBIT_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_8p *sig_bit)); -#endif - -#if defined(PNG_sBIT_SUPPORTED) -extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_8p sig_bit)); -#endif - -#if defined(PNG_sRGB_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, - png_infop info_ptr, int *intent)); -#endif - -#if defined(PNG_sRGB_SUPPORTED) -extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, - png_infop info_ptr, int intent)); -extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, - png_infop info_ptr, int intent)); -#endif - -#if defined(PNG_iCCP_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charpp name, int *compression_type, - png_charpp profile, png_uint_32 *proflen)); - /* Note to maintainer: profile should be png_bytepp */ -#endif - -#if defined(PNG_iCCP_SUPPORTED) -extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charp name, int compression_type, - png_charp profile, png_uint_32 proflen)); - /* Note to maintainer: profile should be png_bytep */ -#endif - -#if defined(PNG_sPLT_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_sPLT_tpp entries)); -#endif - -#if defined(PNG_sPLT_SUPPORTED) -extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_sPLT_tp entries, int nentries)); -#endif - -#if defined(PNG_TEXT_SUPPORTED) -/* png_get_text also returns the number of text chunks in *num_text */ -extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp *text_ptr, int *num_text)); -#endif - -/* - * Note while png_set_text() will accept a structure whose text, - * language, and translated keywords are NULL pointers, the structure - * returned by png_get_text will always contain regular - * zero-terminated C strings. They might be empty strings but - * they will never be NULL pointers. - */ - -#if defined(PNG_TEXT_SUPPORTED) -extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp text_ptr, int num_text)); -#endif - -#if defined(PNG_tIME_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_timep *mod_time)); -#endif - -#if defined(PNG_tIME_SUPPORTED) -extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_timep mod_time)); -#endif - -#if defined(PNG_tRNS_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep *trans, int *num_trans, - png_color_16p *trans_values)); -#endif - -#if defined(PNG_tRNS_SUPPORTED) -extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep trans, int num_trans, - png_color_16p trans_values)); -#endif - -#if defined(PNG_tRNS_SUPPORTED) -#endif - -#if defined(PNG_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, int *unit, double *width, double *height)); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, - png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); -#endif -#endif -#endif /* PNG_sCAL_SUPPORTED */ - -#if defined(PNG_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, int unit, double width, double height)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, - png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); -#endif -#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -/* provide a list of chunks and how they are to be handled, if the built-in - handling or default unknown chunk handling is not desired. Any chunks not - listed will be handled in the default manner. The IHDR and IEND chunks - must not be listed. - keep = 0: follow default behavour - = 1: do not keep - = 2: keep only if safe-to-copy - = 3: keep even if unsafe-to-copy -*/ -extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp - png_ptr, int keep, png_bytep chunk_list, int num_chunks)); -extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); -extern PNG_EXPORT(void, png_set_unknown_chunk_location) - PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); -extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp - png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); -#endif -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep - chunk_name)); -#endif - -/* Png_free_data() will turn off the "valid" flag for anything it frees. - If you need to turn it off for a chunk that your application has freed, - you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ -extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, - png_infop info_ptr, int mask)); - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -/* The "params" pointer is currently not used and is for future expansion. */ -extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, - png_infop info_ptr, - int transforms, - png_voidp params)); -extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, - png_infop info_ptr, - int transforms, - png_voidp params)); -#endif - -/* Define PNG_DEBUG at compile time for debugging information. Higher - * numbers for PNG_DEBUG mean more debugging information. This has - * only been added since version 0.95 so it is not implemented throughout - * libpng yet, but more support will be added as needed. - */ -#ifdef PNG_DEBUG -#if (PNG_DEBUG > 0) -#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) -#include -#if (PNG_DEBUG > 1) -#define png_debug(l,m) _RPT0(_CRT_WARN,m) -#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) -#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) -#endif -#else /* PNG_DEBUG_FILE || !_MSC_VER */ -#ifndef PNG_DEBUG_FILE -#define PNG_DEBUG_FILE stderr -#endif /* PNG_DEBUG_FILE */ -#if (PNG_DEBUG > 1) -#define png_debug(l,m) \ -{ \ - int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ -} -#define png_debug1(l,m,p1) \ -{ \ - int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ -} -#define png_debug2(l,m,p1,p2) \ -{ \ - int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ -} -#endif /* (PNG_DEBUG > 1) */ -#endif /* _MSC_VER */ -#endif /* (PNG_DEBUG > 0) */ -#endif /* PNG_DEBUG */ -#ifndef png_debug -#define png_debug(l, m) -#endif -#ifndef png_debug1 -#define png_debug1(l, m, p1) -#endif -#ifndef png_debug2 -#define png_debug2(l, m, p1, p2) -#endif - -extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void)); - -extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); - -#ifdef PNG_MNG_FEATURES_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp - png_ptr, png_uint_32 mng_features_permitted)); -#endif - -/* For use in png_set_keep_unknown, added to version 1.2.6 */ -#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 -#define PNG_HANDLE_CHUNK_NEVER 1 -#define PNG_HANDLE_CHUNK_IF_SAFE 2 -#define PNG_HANDLE_CHUNK_ALWAYS 3 - -/* Added to version 1.2.0 */ -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) -#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ -#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ -#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 -#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 -#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 -#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 -#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 -#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 -#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ - -#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ - | PNG_ASM_FLAG_MMX_READ_INTERLACE \ - | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ - | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ - | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ - | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ) -#define PNG_MMX_WRITE_FLAGS ( 0 ) - -#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ - | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ - | PNG_MMX_READ_FLAGS \ - | PNG_MMX_WRITE_FLAGS ) - -#define PNG_SELECT_READ 1 -#define PNG_SELECT_WRITE 2 - -#if !defined(PNG_1_0_X) -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) - PNGARG((int flag_select, int *compilerID)); - -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) - PNGARG((int flag_select)); - -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_asm_flags) - PNGARG((png_structp png_ptr)); - -/* pngget.c */ -extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) - PNGARG((png_structp png_ptr)); - -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) - PNGARG((png_structp png_ptr)); - -/* pngset.c */ -extern PNG_EXPORT(void,png_set_asm_flags) - PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); - -/* pngset.c */ -extern PNG_EXPORT(void,png_set_mmx_thresholds) - PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, - png_uint_32 mmx_rowbytes_threshold)); - -#endif /* PNG_1_0_X */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ - -#if !defined(PNG_1_0_X) -/* png.c, pnggccrd.c, or pngvcrd.c */ -extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); - -/* Strip the prepended error numbers ("#nnn ") from error and warning - * messages before passing them to the error or warning handler. */ -#ifdef PNG_ERROR_NUMBERS_SUPPORTED -extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp - png_ptr, png_uint_32 strip_mode)); -#endif - -#endif /* PNG_1_0_X */ - -/* Added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp - png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); -extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp - png_ptr)); -extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp - png_ptr)); -#endif - -/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ - -#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED -/* With these routines we avoid an integer divide, which will be slower on - * most machines. However, it does take more operations than the corresponding - * divide method, so it may be slower on a few RISC systems. There are two - * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. - * - * Note that the rounding factors are NOT supposed to be the same! 128 and - * 32768 are correct for the NODIV code; 127 and 32767 are correct for the - * standard method. - * - * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] - */ - - /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ - -# define png_composite(composite, fg, alpha, bg) \ - { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ - + (png_uint_16)(bg)*(png_uint_16)(255 - \ - (png_uint_16)(alpha)) + (png_uint_16)128); \ - (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } - -# define png_composite_16(composite, fg, alpha, bg) \ - { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ - + (png_uint_32)(bg)*(png_uint_32)(65535L - \ - (png_uint_32)(alpha)) + (png_uint_32)32768L); \ - (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } - -#else /* standard method using integer division */ - -# define png_composite(composite, fg, alpha, bg) \ - (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ - (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ - (png_uint_16)127) / 255) - -# define png_composite_16(composite, fg, alpha, bg) \ - (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ - (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ - (png_uint_32)32767) / (png_uint_32)65535L) - -#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ - -/* These next functions are used internally in the code. They generally - * shouldn't be used unless you are writing code to add or replace some - * functionality in libpng. More information about most functions can - * be found in the files where the functions are located. - */ - -#if defined(PNG_INTERNAL) - -/* Various modes of operation. Note that after an init, mode is set to - * zero automatically when the structure is created. - */ -#define PNG_HAVE_IHDR 0x01 -#define PNG_HAVE_PLTE 0x02 -#define PNG_HAVE_IDAT 0x04 -#define PNG_AFTER_IDAT 0x08 -#define PNG_HAVE_IEND 0x10 -#define PNG_HAVE_gAMA 0x20 -#define PNG_HAVE_cHRM 0x40 -#define PNG_HAVE_sRGB 0x80 -#define PNG_HAVE_CHUNK_HEADER 0x100 -#define PNG_WROTE_tIME 0x200 -#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 -#define PNG_BACKGROUND_IS_GRAY 0x800 -#define PNG_HAVE_PNG_SIGNATURE 0x1000 - -/* flags for the transformations the PNG library does on the image data */ -#define PNG_BGR 0x0001 -#define PNG_INTERLACE 0x0002 -#define PNG_PACK 0x0004 -#define PNG_SHIFT 0x0008 -#define PNG_SWAP_BYTES 0x0010 -#define PNG_INVERT_MONO 0x0020 -#define PNG_DITHER 0x0040 -#define PNG_BACKGROUND 0x0080 -#define PNG_BACKGROUND_EXPAND 0x0100 - /* 0x0200 unused */ -#define PNG_16_TO_8 0x0400 -#define PNG_RGBA 0x0800 -#define PNG_EXPAND 0x1000 -#define PNG_GAMMA 0x2000 -#define PNG_GRAY_TO_RGB 0x4000 -#define PNG_FILLER 0x8000L -#define PNG_PACKSWAP 0x10000L -#define PNG_SWAP_ALPHA 0x20000L -#define PNG_STRIP_ALPHA 0x40000L -#define PNG_INVERT_ALPHA 0x80000L -#define PNG_USER_TRANSFORM 0x100000L -#define PNG_RGB_TO_GRAY_ERR 0x200000L -#define PNG_RGB_TO_GRAY_WARN 0x400000L -#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ -#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ - -/* flags for png_create_struct */ -#define PNG_STRUCT_PNG 0x0001 -#define PNG_STRUCT_INFO 0x0002 - -/* Scaling factor for filter heuristic weighting calculations */ -#define PNG_WEIGHT_SHIFT 8 -#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) -#define PNG_COST_SHIFT 3 -#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) - -/* flags for the png_ptr->flags rather than declaring a byte for each one */ -#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 -#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 -#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 -#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 -#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 -#define PNG_FLAG_ZLIB_FINISHED 0x0020 -#define PNG_FLAG_ROW_INIT 0x0040 -#define PNG_FLAG_FILLER_AFTER 0x0080 -#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 -#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 -#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 -#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 -#define PNG_FLAG_FREE_PLTE 0x1000 -#define PNG_FLAG_FREE_TRNS 0x2000 -#define PNG_FLAG_FREE_HIST 0x4000 -#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L -#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L -#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L -#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L -#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L -#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L - -#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ - PNG_FLAG_CRC_ANCILLARY_NOWARN) - -#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ - PNG_FLAG_CRC_CRITICAL_IGNORE) - -#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ - PNG_FLAG_CRC_CRITICAL_MASK) - -/* save typing and make code easier to understand */ - -#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ - abs((int)((c1).green) - (int)((c2).green)) + \ - abs((int)((c1).blue) - (int)((c2).blue))) - -/* Added to libpng-1.2.6 JB */ -#define PNG_ROWBYTES(pixel_bits, width) \ - ((pixel_bits) >= 8 ? \ - ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \ - (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) ) - -/* PNG_OUT_OF_RANGE returns true if value is outside the range - ideal-delta..ideal+delta. Each argument is evaluated twice. - "ideal" and "delta" should be constants, normally simple - integers, "value" a variable. Added to libpng-1.2.6 JB */ -#define PNG_OUT_OF_RANGE(value, ideal, delta) \ - ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) - -/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ -#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) -/* place to hold the signature string for a PNG file. */ -#ifdef PNG_USE_GLOBAL_ARRAYS - PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; -#else -#define png_sig png_sig_bytes(NULL) -#endif -#endif /* PNG_NO_EXTERN */ - -/* Constant strings for known chunk types. If you need to add a chunk, - * define the name here, and add an invocation of the macro in png.c and - * wherever it's needed. - */ -#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} -#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} -#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} -#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} -#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} -#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} -#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} -#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} -#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} -#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} -#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} -#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} -#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} -#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} -#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} -#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} -#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} -#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} -#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} -#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} -#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} - -#ifdef PNG_USE_GLOBAL_ARRAYS -PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; -#endif /* PNG_USE_GLOBAL_ARRAYS */ - - -/* Inline macros to do direct reads of bytes from the input buffer. These - * require that you are using an architecture that uses PNG byte ordering - * (MSB first) and supports unaligned data storage. I think that PowerPC - * in big-endian mode and 680x0 are the only ones that will support this. - * The x86 line of processors definitely do not. The png_get_int_32() - * routine also assumes we are using two's complement format for negative - * values, which is almost certainly true. - */ -#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) -# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) -# define png_get_int_32(buf) ( *((png_int_32p) (buf))) -# endif -# define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) -# define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) -#else -# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) -PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf)); -# endif -PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf)); -PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf)); -#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ -/* RN: This define is blatent hack to get png to (hopefully) - link on OSX 10.2 and earlier versions of 10.3 due to an - Apple linking bug introduced in 10.2 */ -#define png_get_uint_31 wxpng_get_uint_31 -PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr, - png_bytep buf)); -/* Initialize png_ptr struct for reading, and allocate any other memory. - * (old interface - DEPRECATED - use png_create_read_struct instead). - */ -extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); -#undef png_read_init -#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ - PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); -extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size)); -extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t - png_info_size)); - -/* Initialize png_ptr struct for writing, and allocate any other memory. - * (old interface - DEPRECATED - use png_create_write_struct instead). - */ -extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); -#undef png_write_init -#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ - PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); -extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size)); -extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t - png_info_size)); - -/* Allocate memory for an internal libpng struct */ -PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); - -/* Free memory from internal libpng struct */ -PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); - -PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr - malloc_fn, png_voidp mem_ptr)); -PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, - png_free_ptr free_fn, png_voidp mem_ptr)); - -/* Free any memory that info_ptr points to and reset struct. */ -PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_1_0_X -/* Function to allocate memory for zlib. */ -PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); - -/* Function to free memory for zlib */ -PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); - -#ifdef PNG_SIZE_T -/* Function to convert a sizeof an item to png_sizeof item */ - PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); -#endif - -/* Next four functions are used internally as callbacks. PNGAPI is required - * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ - -PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, - png_bytep data, png_size_t length)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t length)); -#endif - -PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, - png_bytep data, png_size_t length)); - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -#if !defined(PNG_NO_STDIO) -PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); -#endif -#endif -#else /* PNG_1_0_X */ -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t length)); -#endif -#endif /* PNG_1_0_X */ - -/* Reset the CRC variable */ -PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); - -/* Write the "data" buffer to whatever output you are using. */ -PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, - png_size_t length)); - -/* Read data from whatever input you are using into the "data" buffer */ -PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, - png_size_t length)); - -/* Read bytes into buf, and update png_ptr->crc */ -PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, - png_size_t length)); - -/* Decompress data in a chunk that uses compression */ -#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ - defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) -PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, - int comp_type, png_charp chunkdata, png_size_t chunklength, - png_size_t prefix_length, png_size_t *data_length)); -#endif - -/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ -PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); - -/* Read the CRC from the file and compare it to the libpng calculated CRC */ -PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); - -/* Calculate the CRC over a section of data. Note that we are only - * passing a maximum of 64K on systems that have this as a memory limit, - * since this is the maximum buffer size we can specify. - */ -PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, - png_size_t length)); - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); -#endif - - -/* Place a 32-bit number into a buffer in PNG byte order (big-endian). - * The only currently known PNG chunks that use signed numbers are - * the ancillary extension chunks, oFFs and pCAL. - */ -PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i)); - -#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) -PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i)); -#endif - -/* Place a 16-bit number into a buffer in PNG byte order. - * The parameter is declared unsigned int, not png_uint_16, - * just to avoid potential problems on pre-ANSI C compilers. - */ -PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i)); - -/* simple function to write the signature */ -PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); - -/* write various chunks */ - -/* Write the IHDR chunk, and update the png_struct with the necessary - * information. - */ -PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, - png_uint_32 height, - int bit_depth, int color_type, int compression_method, int filter_method, - int interlace_method)); - -PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, - png_uint_32 num_pal)); - -PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, - png_size_t length)); - -PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); - -#if defined(PNG_WRITE_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point - file_gamma)); -#endif -#endif - -#if defined(PNG_WRITE_sBIT_SUPPORTED) -PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, - int color_type)); -#endif - -#if defined(PNG_WRITE_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, - double white_x, double white_y, - double red_x, double red_y, double green_x, double green_y, - double blue_x, double blue_y)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, - png_fixed_point int_white_x, png_fixed_point int_white_y, - png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point - int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); -#endif -#endif - -#if defined(PNG_WRITE_sRGB_SUPPORTED) -PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, - int intent)); -#endif - -#if defined(PNG_WRITE_iCCP_SUPPORTED) -PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, - png_charp name, int compression_type, - png_charp profile, int proflen)); - /* Note to maintainer: profile should be png_bytep */ -#endif - -#if defined(PNG_WRITE_sPLT_SUPPORTED) -PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, - png_sPLT_tp palette)); -#endif - -#if defined(PNG_WRITE_tRNS_SUPPORTED) -PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, - png_color_16p values, int number, int color_type)); -#endif - -#if defined(PNG_WRITE_bKGD_SUPPORTED) -PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, - png_color_16p values, int color_type)); -#endif - -#if defined(PNG_WRITE_hIST_SUPPORTED) -PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, - int num_hist)); -#endif - -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ - defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) -PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, - png_charp key, png_charpp new_key)); -#endif - -#if defined(PNG_WRITE_tEXt_SUPPORTED) -PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, - png_charp text, png_size_t text_len)); -#endif - -#if defined(PNG_WRITE_zTXt_SUPPORTED) -PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, - png_charp text, png_size_t text_len, int compression)); -#endif - -#if defined(PNG_WRITE_iTXt_SUPPORTED) -PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, - int compression, png_charp key, png_charp lang, png_charp lang_key, - png_charp text)); -#endif - -#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ -PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp text_ptr, int num_text)); -#endif - -#if defined(PNG_WRITE_oFFs_SUPPORTED) -PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, - png_int_32 x_offset, png_int_32 y_offset, int unit_type)); -#endif - -#if defined(PNG_WRITE_pCAL_SUPPORTED) -PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, - png_int_32 X0, png_int_32 X1, int type, int nparams, - png_charp units, png_charpp params)); -#endif - -#if defined(PNG_WRITE_pHYs_SUPPORTED) -PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, - png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, - int unit_type)); -#endif - -#if defined(PNG_WRITE_tIME_SUPPORTED) -PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, - png_timep mod_time)); -#endif - -#if defined(PNG_WRITE_sCAL_SUPPORTED) -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) -PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, - int unit, double width, double height)); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, - int unit, png_charp width, png_charp height)); -#endif -#endif -#endif - -/* Called when finished processing a row of data */ -PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); - -/* Internal use only. Called before first row of data */ -PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); - -#if defined(PNG_READ_GAMMA_SUPPORTED) -PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); -#endif - -/* combine a row of data, dealing with alpha, etc. if requested */ -PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, - int mask)); - -#if defined(PNG_READ_INTERLACING_SUPPORTED) -/* expand an interlaced row */ -/* OLD pre-1.0.9 interface: -PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, - png_bytep row, int pass, png_uint_32 transformations)); - */ -PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); -#endif - -/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ - -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* grab pixels out of a row for an interlaced pass */ -PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, - png_bytep row, int pass)); -#endif - -/* unfilter a row */ -PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, - png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); - -/* Choose the best filter to use and filter the row data */ -PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, - png_row_infop row_info)); - -/* Write out the filtered row. */ -PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, - png_bytep filtered_row)); -/* finish a row while reading, dealing with interlacing passes, etc. */ -PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); - -/* initialize the row buffers, etc. */ -PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); -/* optional call to update the users info structure */ -PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -/* these are the functions that do the transformations */ -#if defined(PNG_READ_FILLER_SUPPORTED) -PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 filler, png_uint_32 flags)); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ - defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 flags)); -#endif - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) -PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop - row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) -PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) -PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, - png_color_8p sig_bits)); -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) -PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) -PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, - png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); - -# if defined(PNG_CORRECT_PALETTE_SUPPORTED) -PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, - png_colorp palette, int num_palette)); -# endif -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_WRITE_PACK_SUPPORTED) -PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 bit_depth)); -#endif - -#if defined(PNG_WRITE_SHIFT_SUPPORTED) -PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, - png_color_8p bit_depth)); -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) -#if defined(PNG_READ_GAMMA_SUPPORTED) -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, - png_color_16p trans_values, png_color_16p background, - png_color_16p background_1, - png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, - png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, - png_uint_16pp gamma_16_to_1, int gamma_shift)); -#else -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, - png_color_16p trans_values, png_color_16p background)); -#endif -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) -PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, - png_bytep gamma_table, png_uint_16pp gamma_16_table, - int gamma_shift)); -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) -PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, - png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); -PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, - png_bytep row, png_color_16p trans_value)); -#endif - -/* The following decodes the appropriate chunks, and does error correction, - * then calls the appropriate callback for the chunk if it is valid. - */ - -/* decode the IHDR chunk */ -PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); - -#if defined(PNG_READ_bKGD_SUPPORTED) -PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_cHRM_SUPPORTED) -PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_gAMA_SUPPORTED) -PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_hIST_SUPPORTED) -PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_iCCP_SUPPORTED) -extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif /* PNG_READ_iCCP_SUPPORTED */ - -#if defined(PNG_READ_iTXt_SUPPORTED) -PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_oFFs_SUPPORTED) -PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_pCAL_SUPPORTED) -PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_pHYs_SUPPORTED) -PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_sBIT_SUPPORTED) -PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_sCAL_SUPPORTED) -PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_sPLT_SUPPORTED) -extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif /* PNG_READ_sPLT_SUPPORTED */ - -#if defined(PNG_READ_sRGB_SUPPORTED) -PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_tEXt_SUPPORTED) -PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_tIME_SUPPORTED) -PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_tRNS_SUPPORTED) -PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_zTXt_SUPPORTED) -PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); - -PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, - png_bytep chunk_name)); - -/* handle the transformations for reading and writing */ -PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); - -PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, - png_uint_32 length)); -PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t buffer_length)); -PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t buffer_length)); -PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); -PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); -#if defined(PNG_READ_tEXt_SUPPORTED) -PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) -PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) -PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif - -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -#ifdef PNG_MNG_FEATURES_SUPPORTED -PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, - png_bytep row)); -PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) -/* png.c */ /* PRIVATE */ -PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); -#endif -/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ - -#endif /* PNG_INTERNAL */ - -#ifdef __cplusplus -} -#endif - -#endif /* PNG_VERSION_INFO_ONLY */ -/* do not put anything past this line */ -#endif /* PNG_H */ +/* png.h - header file for PNG reference library + * + * libpng version 1.2.7 - September 12, 2004 + * Copyright (c) 1998-2004 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * Authors and maintainers: + * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat + * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger + * libpng versions 0.97, January 1998, through 1.2.7 - September 12, 2004: Glenn + * See also "Contributing Authors", below. + * + * Note about libpng version numbers: + * + * Due to various miscommunications, unforeseen code incompatibilities + * and occasional factors outside the authors' control, version numbering + * on the library has not always been consistent and straightforward. + * The following table summarizes matters since version 0.89c, which was + * the first widely used release: + * + * source png.h png.h shared-lib + * version string int version + * ------- ------ ----- ---------- + * 0.89c "1.0 beta 3" 0.89 89 1.0.89 + * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] + * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] + * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] + * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] + * 0.97c 0.97 97 2.0.97 + * 0.98 0.98 98 2.0.98 + * 0.99 0.99 98 2.0.99 + * 0.99a-m 0.99 99 2.0.99 + * 1.00 1.00 100 2.1.0 [100 should be 10000] + * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] + * 1.0.1 png.h string is 10001 2.1.0 + * 1.0.1a-e identical to the 10002 from here on, the shared library + * 1.0.2 source version) 10002 is 2.V where V is the source code + * 1.0.2a-b 10003 version, except as noted. + * 1.0.3 10003 + * 1.0.3a-d 10004 + * 1.0.4 10004 + * 1.0.4a-f 10005 + * 1.0.5 (+ 2 patches) 10005 + * 1.0.5a-d 10006 + * 1.0.5e-r 10100 (not source compatible) + * 1.0.5s-v 10006 (not binary compatible) + * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) + * 1.0.6d-f 10007 (still binary incompatible) + * 1.0.6g 10007 + * 1.0.6h 10007 10.6h (testing xy.z so-numbering) + * 1.0.6i 10007 10.6i + * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) + * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) + * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) + * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) + * 1.0.7 1 10007 (still compatible) + * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 + * 1.0.8rc1 1 10008 2.1.0.8rc1 + * 1.0.8 1 10008 2.1.0.8 + * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 + * 1.0.9rc1 1 10009 2.1.0.9rc1 + * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 + * 1.0.9rc2 1 10009 2.1.0.9rc2 + * 1.0.9 1 10009 2.1.0.9 + * 1.0.10beta1 1 10010 2.1.0.10beta1 + * 1.0.10rc1 1 10010 2.1.0.10rc1 + * 1.0.10 1 10010 2.1.0.10 + * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 + * 1.0.11rc1 1 10011 2.1.0.11rc1 + * 1.0.11 1 10011 2.1.0.11 + * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 + * 1.0.12rc1 2 10012 2.1.0.12rc1 + * 1.0.12 2 10012 2.1.0.12 + * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) + * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 + * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 + * 1.2.0rc1 3 10200 3.1.2.0rc1 + * 1.2.0 3 10200 3.1.2.0 + * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 + * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 + * 1.2.1 3 10201 3.1.2.1 + * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 + * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 + * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 + * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 + * 1.0.13 10 10013 10.so.0.1.0.13 + * 1.2.2 12 10202 12.so.0.1.2.2 + * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 + * 1.2.3 12 10203 12.so.0.1.2.3 + * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 + * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 + * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 + * 1.0.14 10 10014 10.so.0.1.0.14 + * 1.2.4 13 10204 12.so.0.1.2.4 + * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 + * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 + * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 + * 1.0.15 10 10015 10.so.0.1.0.15 + * 1.2.5 13 10205 12.so.0.1.2.5 + * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 + * 1.0.16 10 10016 10.so.0.1.0.16 + * 1.2.6 13 10206 12.so.0.1.2.6 + * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 + * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 + * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 + * 1.0.17 10 10017 12.so.0.1.0.17 + * 1.2.7 13 10207 12.so.0.1.2.7 + * + * Henceforth the source version will match the shared-library major + * and minor numbers; the shared-library major version number will be + * used for changes in backward compatibility, as it is intended. The + * PNG_LIBPNG_VER macro, which is not used within libpng but is available + * for applications, is an unsigned integer of the form xyyzz corresponding + * to the source version x.y.z (leading zeros in y and z). Beta versions + * were given the previous public release number plus a letter, until + * version 1.0.6j; from then on they were given the upcoming public + * release number plus "betaNN" or "rcN". + * + * Binary incompatibility exists only when applications make direct access + * to the info_ptr or png_ptr members through png.h, and the compiled + * application is loaded with a different version of the library. + * + * DLLNUM will change each time there are forward or backward changes + * in binary compatibility (e.g., when a new feature is added). + * + * See libpng.txt or libpng.3 for more information. The PNG specification + * is available as a W3C Recommendation and as an ISO Specification, + * defines should NOT be changed. + */ +#define PNG_INFO_gAMA 0x0001 +#define PNG_INFO_sBIT 0x0002 +#define PNG_INFO_cHRM 0x0004 +#define PNG_INFO_PLTE 0x0008 +#define PNG_INFO_tRNS 0x0010 +#define PNG_INFO_bKGD 0x0020 +#define PNG_INFO_hIST 0x0040 +#define PNG_INFO_pHYs 0x0080 +#define PNG_INFO_oFFs 0x0100 +#define PNG_INFO_tIME 0x0200 +#define PNG_INFO_pCAL 0x0400 +#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ +#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ +#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ +#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ +#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ + +/* This is used for the transformation routines, as some of them + * change these values for the row. It also should enable using + * the routines for other purposes. + */ +typedef struct png_row_info_struct +{ + png_uint_32 width; /* width of row */ + png_uint_32 rowbytes; /* number of bytes in row */ + png_byte color_type; /* color type of row */ + png_byte bit_depth; /* bit depth of row */ + png_byte channels; /* number of channels (1, 2, 3, or 4) */ + png_byte pixel_depth; /* bits per pixel (depth * channels) */ +} png_row_info; + +typedef png_row_info FAR * png_row_infop; +typedef png_row_info FAR * FAR * png_row_infopp; + +/* These are the function types for the I/O functions and for the functions + * that allow the user to override the default I/O functions with his or her + * own. The png_error_ptr type should match that of user-supplied warning + * and error functions, while the png_rw_ptr type should match that of the + * user read/write data functions. + */ +typedef struct png_struct_def png_struct; +typedef png_struct FAR * png_structp; + +typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); +typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); +typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); +typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, + int)); +typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, + int)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, + png_uint_32, int)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, + png_row_infop, png_bytep)); +#endif + +#if defined(PNG_USER_CHUNKS_SUPPORTED) +typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); +#endif +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); +#endif + +/* Transform masks for the high-level interface */ +#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ +#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ +#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ +#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ +#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ +#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ +#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ +#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ +#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ +#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ +#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ +#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ +#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ + +/* Flags for MNG supported features */ +#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 +#define PNG_FLAG_MNG_FILTER_64 0x04 +#define PNG_ALL_MNG_FEATURES 0x05 + +typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); +typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); + +/* The structure that holds the information to read and write PNG files. + * The only people who need to care about what is inside of this are the + * people who will be modifying the library for their own special needs. + * It should NOT be accessed directly by an application, except to store + * the jmp_buf. + */ + +struct png_struct_def +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf jmpbuf; /* used in png_error */ +#endif + png_error_ptr error_fn; /* function for printing errors and aborting */ + png_error_ptr warning_fn; /* function for printing warnings */ + png_voidp error_ptr; /* user supplied struct for error functions */ + png_rw_ptr write_data_fn; /* function for writing output data */ + png_rw_ptr read_data_fn; /* function for reading input data */ + png_voidp io_ptr; /* ptr to application struct for I/O functions */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) + png_user_transform_ptr read_user_transform_fn; /* user read transform */ +#endif + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_user_transform_ptr write_user_transform_fn; /* user write transform */ +#endif + +/* These were added in libpng-1.0.2 */ +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_voidp user_transform_ptr; /* user supplied struct for user transform */ + png_byte user_transform_depth; /* bit depth of user transformed pixels */ + png_byte user_transform_channels; /* channels in user transformed pixels */ +#endif +#endif + + png_uint_32 mode; /* tells us where we are in the PNG file */ + png_uint_32 flags; /* flags indicating various things to libpng */ + png_uint_32 transformations; /* which transformations to perform */ + + z_stream zstream; /* pointer to decompression structure (below) */ + png_bytep zbuf; /* buffer for zlib */ + png_size_t zbuf_size; /* size of zbuf */ + int zlib_level; /* holds zlib compression level */ + int zlib_method; /* holds zlib compression method */ + int zlib_window_bits; /* holds zlib compression window bits */ + int zlib_mem_level; /* holds zlib compression memory level */ + int zlib_strategy; /* holds zlib compression strategy */ + + png_uint_32 width; /* width of image in pixels */ + png_uint_32 height; /* height of image in pixels */ + png_uint_32 num_rows; /* number of rows in current pass */ + png_uint_32 usr_width; /* width of row at start of write */ + png_uint_32 rowbytes; /* size of row in bytes */ + png_uint_32 irowbytes; /* size of current interlaced row in bytes */ + png_uint_32 iwidth; /* width of current interlaced row in pixels */ + png_uint_32 row_number; /* current row in interlace pass */ + png_bytep prev_row; /* buffer to save previous (unfiltered) row */ + png_bytep row_buf; /* buffer to save current (unfiltered) row */ + png_bytep sub_row; /* buffer to save "sub" row when filtering */ + png_bytep up_row; /* buffer to save "up" row when filtering */ + png_bytep avg_row; /* buffer to save "avg" row when filtering */ + png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ + png_row_info row_info; /* used for transformation routines */ + + png_uint_32 idat_size; /* current IDAT size for read */ + png_uint_32 crc; /* current chunk CRC value */ + png_colorp palette; /* palette from the input file */ + png_uint_16 num_palette; /* number of color entries in palette */ + png_uint_16 num_trans; /* number of transparency values */ + png_byte chunk_name[5]; /* null-terminated name of current chunk */ + png_byte compression; /* file compression type (always 0) */ + png_byte filter; /* file filter type (always 0) */ + png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ + png_byte pass; /* current interlace pass (0 - 6) */ + png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ + png_byte color_type; /* color type of file */ + png_byte bit_depth; /* bit depth of file */ + png_byte usr_bit_depth; /* bit depth of users row */ + png_byte pixel_depth; /* number of bits per pixel */ + png_byte channels; /* number of channels in file */ + png_byte usr_channels; /* channels at start of write */ + png_byte sig_bytes; /* magic bytes read/written from start of file */ + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +#ifdef PNG_LEGACY_SUPPORTED + png_byte filler; /* filler byte for pixel expansion */ +#else + png_uint_16 filler; /* filler bytes for pixel expansion */ +#endif +#endif + +#if defined(PNG_bKGD_SUPPORTED) + png_byte background_gamma_type; +# ifdef PNG_FLOATING_POINT_SUPPORTED + float background_gamma; +# endif + png_color_16 background; /* background color in screen gamma space */ +#if defined(PNG_READ_GAMMA_SUPPORTED) + png_color_16 background_1; /* background normalized to gamma 1.0 */ +#endif +#endif /* PNG_bKGD_SUPPORTED */ + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) + png_flush_ptr output_flush_fn;/* Function for flushing output */ + png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ + png_uint_32 flush_rows; /* number of rows written since last flush */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ +#ifdef PNG_FLOATING_POINT_SUPPORTED + float gamma; /* file gamma value */ + float screen_gamma; /* screen gamma value (display_exponent) */ +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep gamma_table; /* gamma table for 8-bit depth files */ + png_bytep gamma_from_1; /* converts from 1.0 to screen */ + png_bytep gamma_to_1; /* converts from file to 1.0 */ + png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ + png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ + png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) + png_color_8 sig_bit; /* significant bits in each available channel */ +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) + png_color_8 shift; /* shift for significant bit tranformation */ +#endif + +#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ + || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep trans; /* transparency values for paletted files */ + png_color_16 trans_values; /* transparency values for non-paletted files */ +#endif + + png_read_status_ptr read_row_fn; /* called after each row is decoded */ + png_write_status_ptr write_row_fn; /* called after each row is encoded */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED + png_progressive_info_ptr info_fn; /* called after header data fully read */ + png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ + png_progressive_end_ptr end_fn; /* called after image is complete */ + png_bytep save_buffer_ptr; /* current location in save_buffer */ + png_bytep save_buffer; /* buffer for previously read data */ + png_bytep current_buffer_ptr; /* current location in current_buffer */ + png_bytep current_buffer; /* buffer for recently used data */ + png_uint_32 push_length; /* size of current input chunk */ + png_uint_32 skip_length; /* bytes to skip in input data */ + png_size_t save_buffer_size; /* amount of data now in save_buffer */ + png_size_t save_buffer_max; /* total size of save_buffer */ + png_size_t buffer_size; /* total amount of available input data */ + png_size_t current_buffer_size; /* amount of data now in current_buffer */ + int process_mode; /* what push library is currently doing */ + int cur_palette; /* current push library palette index */ + +# if defined(PNG_TEXT_SUPPORTED) + png_size_t current_text_size; /* current size of text input data */ + png_size_t current_text_left; /* how much text left to read in input */ + png_charp current_text; /* current text chunk buffer */ + png_charp current_text_ptr; /* current location in current_text */ +# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */ + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) +/* for the Borland special 64K segment handler */ + png_bytepp offset_table_ptr; + png_bytep offset_table; + png_uint_16 offset_table_number; + png_uint_16 offset_table_count; + png_uint_16 offset_table_count_free; +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) + png_bytep palette_lookup; /* lookup table for dithering */ + png_bytep dither_index; /* index translation for palette files */ +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) + png_uint_16p hist; /* histogram */ +#endif + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + png_byte heuristic_method; /* heuristic for row filter selection */ + png_byte num_prev_filters; /* number of weights for previous rows */ + png_bytep prev_filters; /* filter type(s) of previous row(s) */ + png_uint_16p filter_weights; /* weight(s) for previous line(s) */ + png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ + png_uint_16p filter_costs; /* relative filter calculation cost */ + png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ +#endif + +#if defined(PNG_TIME_RFC1123_SUPPORTED) + png_charp time_buffer; /* String to hold RFC 1123 time text */ +#endif + +/* New members added in libpng-1.0.6 */ + +#ifdef PNG_FREE_ME_SUPPORTED + png_uint_32 free_me; /* flags items libpng is responsible for freeing */ +#endif + +#if defined(PNG_USER_CHUNKS_SUPPORTED) + png_voidp user_chunk_ptr; + png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ +#endif + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + int num_chunk_list; + png_bytep chunk_list; +#endif + +/* New members added in libpng-1.0.3 */ +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + png_byte rgb_to_gray_status; + /* These were changed from png_byte in libpng-1.0.6 */ + png_uint_16 rgb_to_gray_red_coeff; + png_uint_16 rgb_to_gray_green_coeff; + png_uint_16 rgb_to_gray_blue_coeff; +#endif + +/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) || \ + defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* changed from png_byte to png_uint_32 at version 1.2.0 */ +#ifdef PNG_1_0_X + png_byte mng_features_permitted; +#else + png_uint_32 mng_features_permitted; +#endif /* PNG_1_0_X */ +#endif + +/* New member added in libpng-1.0.7 */ +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_fixed_point int_gamma; +#endif + +/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) + png_byte filter_type; +#endif + +#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)) +/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ + png_uint_32 row_buf_size; +#endif + +/* New members added in libpng-1.2.0 */ +#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) + png_byte mmx_bitdepth_threshold; + png_uint_32 mmx_rowbytes_threshold; + png_uint_32 asm_flags; +#endif + +/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ +#ifdef PNG_USER_MEM_SUPPORTED + png_voidp mem_ptr; /* user supplied struct for mem functions */ + png_malloc_ptr malloc_fn; /* function for allocating memory */ + png_free_ptr free_fn; /* function for freeing memory */ +#endif + +/* New member added in libpng-1.0.13 and 1.2.0 */ + png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* The following three members were added at version 1.0.14 and 1.2.4 */ + png_bytep dither_sort; /* working sort array */ + png_bytep index_to_palette; /* where the original index currently is */ + /* in the palette */ + png_bytep palette_to_index; /* which original index points to this */ + /* palette color */ +#endif + +/* New members added in libpng-1.0.16 and 1.2.6 */ + png_byte compression_type; + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_uint_32 user_width_max; + png_uint_32 user_height_max; +#endif + +}; + + +/* This triggers a compiler error in png.c, if png.c and png.h + * do not agree upon the version number. + */ +typedef png_structp version_1_2_7; + +typedef png_struct FAR * FAR * png_structpp; + +/* Here are the function definitions most commonly used. This is not + * the place to find out how to use libpng. See libpng.txt for the + * full explanation, see example.c for the summary. This just provides + * a simple one line description of the use of each function. + */ + +/* Returns the version number of the library */ +extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); + +/* Tell lib we have already handled the first magic bytes. + * Handling more than 8 bytes from the beginning of the file is an error. + */ +extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, + int num_bytes)); + +/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a + * PNG file. Returns zero if the supplied bytes match the 8-byte PNG + * signature, and non-zero otherwise. Having num_to_check == 0 or + * start > 7 will always fail (ie return non-zero). + */ +extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, + png_size_t num_to_check)); + +/* Simple signature checking function. This is the same as calling + * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). + */ +extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); + +/* Allocate and initialize png_ptr struct for reading, and any other memory. */ +extern PNG_EXPORT(png_structp,png_create_read_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)); + +/* Allocate and initialize png_ptr struct for writing, and any other memory */ +extern PNG_EXPORT(png_structp,png_create_write_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)); + +#ifdef PNG_WRITE_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_WRITE_SUPPORTED +extern PNG_EXPORT(void,png_set_compression_buffer_size) + PNGARG((png_structp png_ptr, png_uint_32 size)); +#endif + +/* Reset the compression stream */ +extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); + +/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_structp,png_create_read_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +extern PNG_EXPORT(png_structp,png_create_write_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +#endif + +/* Write a PNG chunk - size, type, (optional) data, CRC. */ +extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_bytep data, png_size_t length)); + +/* Write the start of a PNG chunk - length and chunk name. */ +extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_uint_32 length)); + +/* Write the data of a PNG chunk started with png_write_chunk_start(). */ +extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ +extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); + +/* Allocate and initialize the info structure */ +extern PNG_EXPORT(png_infop,png_create_info_struct) + PNGARG((png_structp png_ptr)); + +/* Initialize the info structure (old interface - DEPRECATED) */ +extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); +#undef png_info_init +#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\ + png_sizeof(png_info)); +extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, + png_size_t png_info_struct_size)); + +/* Writes all the PNG information before the image. */ +extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the information before the actual image data. */ +extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#if defined(PNG_TIME_RFC1123_SUPPORTED) +extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) + PNGARG((png_structp png_ptr, png_timep ptime)); +#endif + +#if !defined(_WIN32_WCE) +/* "time.h" functions are not supported on WindowsCE */ +#if defined(PNG_WRITE_tIME_SUPPORTED) +/* convert from a struct tm to png_time */ +extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, + struct tm FAR * ttime)); + +/* convert from time_t to png_time. Uses gmtime() */ +extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, + time_t ttime)); +#endif /* PNG_WRITE_tIME_SUPPORTED */ +#endif /* _WIN32_WCE */ + +#if defined(PNG_READ_EXPAND_SUPPORTED) +/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ +extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +/* Use blue, green, red order for pixels. */ +extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +/* Expand the grayscale to 24-bit RGB if necessary. */ +extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +/* Reduce RGB to grayscale. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, + int error_action, double red, double green )); +#endif +extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, + int error_action, png_fixed_point red, png_fixed_point green )); +extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp + png_ptr)); +#endif + +extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, + png_colorp palette)); + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ +extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +/* The values of the PNG_FILLER_ defines should NOT be changed */ +#define PNG_FILLER_BEFORE 0 +#define PNG_FILLER_AFTER 1 +/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ +#if !defined(PNG_1_0_X) +extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +#endif +#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +/* Swap bytes in 16-bit depth files. */ +extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) +/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ +extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) +/* Swap packing order of pixels in bytes. */ +extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) +/* Converts files to legal bit depths. */ +extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, + png_color_8p true_bits)); +#endif + +#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ + defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* Have the code handle the interlacing. Returns the number of passes. */ +extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +/* Invert monochrome files */ +extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +/* Handle alpha and tRNS by replacing with a background color. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, + png_color_16p background_color, int background_gamma_code, + int need_expand, double background_gamma)); +#endif +#define PNG_BACKGROUND_GAMMA_UNKNOWN 0 +#define PNG_BACKGROUND_GAMMA_SCREEN 1 +#define PNG_BACKGROUND_GAMMA_FILE 2 +#define PNG_BACKGROUND_GAMMA_UNIQUE 3 +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +/* strip the second byte of information from a 16-bit depth file. */ +extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* Turn on dithering, and reduce the palette to the number of colors available. */ +extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette, int maximum_colors, + png_uint_16p histogram, int full_dither)); +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +/* Handle gamma correction. Screen_gamma=(display_exponent) */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, + double screen_gamma, double default_file_gamma)); +#endif +#endif + +#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ +/* Deprecated and will be removed. Use png_permit_mng_features() instead. */ +extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, + int empty_plte_permitted)); +#endif + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +/* Set how many lines between output flushes - 0 for no flushing */ +extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); +/* Flush the current PNG output buffer */ +extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); +#endif + +/* optional update palette with requested transformations */ +extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); + +/* optional call to update the users info structure */ +extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read one or more rows of image data. */ +extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); +#endif + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read a row of data. */ +extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, + png_bytep row, + png_bytep display_row)); +#endif + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the whole image into memory at once. */ +extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, + png_bytepp image)); +#endif + +/* write a row of image data */ +extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, + png_bytep row)); + +/* write a few rows of image data */ +extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_uint_32 num_rows)); + +/* write the image data */ +extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, + png_bytepp image)); + +/* writes the end of the PNG file. */ +extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the end of the PNG file. */ +extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +/* free any memory associated with the png_info_struct */ +extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, + png_infopp info_ptr_ptr)); + +/* free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp + png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); + +/* free all memory used by the read (old method - NOT DLL EXPORTED) */ +extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, + png_infop end_info_ptr)); + +/* free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_write_struct) + PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); + +/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ +extern void png_write_destroy PNGARG((png_structp png_ptr)); + +/* set the libpng method of handling chunk CRC errors */ +extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, + int crit_action, int ancil_action)); + +/* Values for png_set_crc_action() to say how to handle CRC errors in + * ancillary and critical chunks, and whether to use the data contained + * therein. Note that it is impossible to "discard" data in a critical + * chunk. For versions prior to 0.90, the action was always error/quit, + * whereas in version 0.90 and later, the action for CRC errors in ancillary + * chunks is warn/discard. These values should NOT be changed. + * + * value action:critical action:ancillary + */ +#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ +#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ +#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ +#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ +#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ +#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ + +/* These functions give the user control over the scan-line filtering in + * libpng and the compression methods used by zlib. These functions are + * mainly useful for testing, as the defaults should work with most users. + * Those users who are tight on memory or want faster performance at the + * expense of compression can modify them. See the compression library + * header file (zlib.h) for an explination of the compression functions. + */ + +/* set the filtering method(s) used by libpng. Currently, the only valid + * value for "method" is 0. + */ +extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, + int filters)); + +/* Flags for png_set_filter() to say which filters to use. The flags + * are chosen so that they don't conflict with real filter types + * below, in case they are supplied instead of the #defined constants. + * These values should NOT be changed. + */ +#define PNG_NO_FILTERS 0x00 +#define PNG_FILTER_NONE 0x08 +#define PNG_FILTER_SUB 0x10 +#define PNG_FILTER_UP 0x20 +#define PNG_FILTER_AVG 0x40 +#define PNG_FILTER_PAETH 0x80 +#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ + PNG_FILTER_AVG | PNG_FILTER_PAETH) + +/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. + * These defines should NOT be changed. + */ +#define PNG_FILTER_VALUE_NONE 0 +#define PNG_FILTER_VALUE_SUB 1 +#define PNG_FILTER_VALUE_UP 2 +#define PNG_FILTER_VALUE_AVG 3 +#define PNG_FILTER_VALUE_PAETH 4 +#define PNG_FILTER_VALUE_LAST 5 + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ +/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ + * defines, either the default (minimum-sum-of-absolute-differences), or + * the experimental method (weighted-minimum-sum-of-absolute-differences). + * + * Weights are factors >= 1.0, indicating how important it is to keep the + * filter type consistent between rows. Larger numbers mean the current + * filter is that many times as likely to be the same as the "num_weights" + * previous filters. This is cumulative for each previous row with a weight. + * There needs to be "num_weights" values in "filter_weights", or it can be + * NULL if the weights aren't being specified. Weights have no influence on + * the selection of the first row filter. Well chosen weights can (in theory) + * improve the compression for a given image. + * + * Costs are factors >= 1.0 indicating the relative decoding costs of a + * filter type. Higher costs indicate more decoding expense, and are + * therefore less likely to be selected over a filter with lower computational + * costs. There needs to be a value in "filter_costs" for each valid filter + * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't + * setting the costs. Costs try to improve the speed of decompression without + * unduly increasing the compressed image size. + * + * A negative weight or cost indicates the default value is to be used, and + * values in the range [0.0, 1.0) indicate the value is to remain unchanged. + * The default values for both weights and costs are currently 1.0, but may + * change if good general weighting/cost heuristics can be found. If both + * the weights and costs are set to 1.0, this degenerates the WEIGHTED method + * to the UNWEIGHTED method, but with added encoding time/computation. + */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, + int heuristic_method, int num_weights, png_doublep filter_weights, + png_doublep filter_costs)); +#endif +#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ + +/* Heuristic used for row filter selection. These defines should NOT be + * changed. + */ +#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ +#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ +#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ +#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ + +/* Set the library compression level. Currently, valid values range from + * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 + * (0 - no compression, 9 - "maximal" compression). Note that tests have + * shown that zlib compression levels 3-6 usually perform as well as level 9 + * for PNG images, and do considerably fewer caclulations. In the future, + * these values may not correspond directly to the zlib compression levels. + */ +extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, + int level)); + +extern PNG_EXPORT(void,png_set_compression_mem_level) + PNGARG((png_structp png_ptr, int mem_level)); + +extern PNG_EXPORT(void,png_set_compression_strategy) + PNGARG((png_structp png_ptr, int strategy)); + +extern PNG_EXPORT(void,png_set_compression_window_bits) + PNGARG((png_structp png_ptr, int window_bits)); + +extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, + int method)); + +/* These next functions are called for input/output, memory, and error + * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, + * and call standard C I/O routines such as fread(), fwrite(), and + * fprintf(). These functions can be made to use other I/O routines + * at run time for those applications that need to handle I/O in a + * different manner by calling png_set_???_fn(). See libpng.txt for + * more information. + */ + +#if !defined(PNG_NO_STDIO) +/* Initialize the input/output for the PNG file to the default functions. */ +extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); +#endif + +/* Replace the (error and abort), and warning functions with user + * supplied functions. If no messages are to be printed you must still + * write and use replacement functions. The replacement error_fn should + * still do a longjmp to the last setjmp location if you are using this + * method of error handling. If error_fn or warning_fn is NULL, the + * default function will be used. + */ + +extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); + +/* Return the user pointer associated with the error functions */ +extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); + +/* Replace the default data output functions with a user supplied one(s). + * If buffered output is not used, then output_flush_fn can be set to NULL. + * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time + * output_flush_fn will be ignored (and thus can be NULL). + */ +extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); + +/* Replace the default data input function with a user supplied one. */ +extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr read_data_fn)); + +/* Return the user pointer associated with the I/O functions */ +extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); + +extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, + png_read_status_ptr read_row_fn)); + +extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, + png_write_status_ptr write_row_fn)); + +#ifdef PNG_USER_MEM_SUPPORTED +/* Replace the default memory allocation functions with user supplied one(s). */ +extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, + png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +/* Return the user pointer associated with the memory functions */ +extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr read_user_transform_fn)); +#endif + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr write_user_transform_fn)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp + png_ptr, png_voidp user_transform_ptr, int user_transform_depth, + int user_transform_channels)); +/* Return the user pointer associated with the user transform functions */ +extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_USER_CHUNKS_SUPPORTED +extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, + png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); +extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp + png_ptr)); +#endif + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +/* Sets the function callbacks for the push reader, and a pointer to a + * user-defined structure available to the callback functions. + */ +extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, + png_voidp progressive_ptr, + png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, + png_progressive_end_ptr end_fn)); + +/* returns the user pointer associated with the push read functions */ +extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) + PNGARG((png_structp png_ptr)); + +/* function to be called when data becomes available */ +extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); + +/* function that combines rows. Not very much different than the + * png_combine_row() call. Is this even used????? + */ +extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, + png_bytep old_row, png_bytep new_row)); +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, + png_uint_32 size)); + +#if defined(PNG_1_0_X) +# define png_malloc_warn png_malloc +#else +/* Added at libpng version 1.2.4 */ +extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, + png_uint_32 size)); +#endif + +/* frees a pointer allocated by png_malloc() */ +extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); + +#if defined(PNG_1_0_X) +/* Function to allocate memory for zlib. */ +extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, + uInt size)); + +/* Function to free memory for zlib */ +extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); +#endif + +/* Free data that was allocated internally */ +extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 free_me, int num)); +#ifdef PNG_FREE_ME_SUPPORTED +/* Reassign responsibility for freeing existing data, whether allocated + * by libpng or by the application */ +extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, + png_infop info_ptr, int freer, png_uint_32 mask)); +#endif +/* assignments for png_data_freer */ +#define PNG_DESTROY_WILL_FREE_DATA 1 +#define PNG_SET_WILL_FREE_DATA 1 +#define PNG_USER_WILL_FREE_DATA 2 +/* Flags for png_ptr->free_me and info_ptr->free_me */ +#define PNG_FREE_HIST 0x0008 +#define PNG_FREE_ICCP 0x0010 +#define PNG_FREE_SPLT 0x0020 +#define PNG_FREE_ROWS 0x0040 +#define PNG_FREE_PCAL 0x0080 +#define PNG_FREE_SCAL 0x0100 +#define PNG_FREE_UNKN 0x0200 +#define PNG_FREE_LIST 0x0400 +#define PNG_FREE_PLTE 0x1000 +#define PNG_FREE_TRNS 0x2000 +#define PNG_FREE_TEXT 0x4000 +#define PNG_FREE_ALL 0x7fff +#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ + +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, + png_uint_32 size)); +extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, + png_voidp ptr)); +#endif + +extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, + png_voidp s1, png_voidp s2, png_uint_32 size)); + +extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, + png_voidp s1, int value, png_uint_32 size)); + +#if defined(USE_FAR_KEYWORD) /* memory model conversion function */ +extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, + int check)); +#endif /* USE_FAR_KEYWORD */ + +/* Fatal error in PNG image of libpng - can't continue */ +extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)); + +/* The same, but the chunk name is prepended to the error string. */ +extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)); + +/* Non-fatal error in libpng. Can continue, but may have a problem. */ +extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +/* Non-fatal error in libpng, chunk name is prepended to message. */ +extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +/* The png_set_ functions are for storing values in the png_info_struct. + * Similarly, the png_get_ calls are used to read values from the + * png_info_struct, either storing the parameters in the passed variables, or + * setting pointers into the png_info_struct where the data is stored. The + * png_get_ functions return a non-zero value if the data was available + * in info_ptr, or return zero and do not change any of the parameters if the + * data was not available. + * + * These functions should be used instead of directly accessing png_info + * to avoid problems with future changes in the size and internal layout of + * png_info_struct. + */ +/* Returns "flag" if chunk data is valid in info_ptr. */ +extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, +png_infop info_ptr, png_uint_32 flag)); + +/* Returns number of bytes needed to hold a transformed row. */ +extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +/* Returns row_pointers, which is an array of pointers to scanlines that was +returned from png_read_png(). */ +extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, +png_infop info_ptr)); +/* Set row_pointers, which is an array of pointers to scanlines for use +by png_write_png(). */ +extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytepp row_pointers)); +#endif + +/* Returns number of color channels in image. */ +extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_EASY_ACCESS_SUPPORTED +/* Returns image width in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image height in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image bit_depth. */ +extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image color_type. */ +extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image filter_type. */ +extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image interlace_type. */ +extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image compression_type. */ +extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image resolution in pixels per meter, from pHYs chunk data. */ +extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns pixel aspect ratio, computed from pHYs chunk data. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +#endif + +/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ +extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +#endif /* PNG_EASY_ACCESS_SUPPORTED */ + +/* Returns pointer to signature string read from PNG header */ +extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_bKGD_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p *background)); +#endif + +#if defined(PNG_bKGD_SUPPORTED) +extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p background)); +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *white_x, double *white_y, double *red_x, + double *red_y, double *green_x, double *green_y, double *blue_x, + double *blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point + *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, + png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point + *int_blue_x, png_fixed_point *int_blue_y)); +#endif +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, double white_x, double white_y, double red_x, + double red_y, double green_x, double green_y, double blue_x, double blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *file_gamma)); +#endif +extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_file_gamma)); +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double file_gamma)); +#endif +extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_file_gamma)); +#endif + +#if defined(PNG_hIST_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p *hist)); +#endif + +#if defined(PNG_hIST_SUPPORTED) +extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p hist)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, + int *bit_depth, int *color_type, int *interlace_method, + int *compression_method, int *filter_method)); + +extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_method, int compression_method, + int filter_method)); + +#if defined(PNG_oFFs_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, + int *unit_type)); +#endif + +#if defined(PNG_oFFs_SUPPORTED) +extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, + int unit_type)); +#endif + +#if defined(PNG_pCAL_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, + int *type, int *nparams, png_charp *units, png_charpp *params)); +#endif + +#if defined(PNG_pCAL_SUPPORTED) +extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, + int type, int nparams, png_charp units, png_charpp params)); +#endif + +#if defined(PNG_pHYs_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); +#endif + +#if defined(PNG_pHYs_SUPPORTED) +extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp *palette, int *num_palette)); + +extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp palette, int num_palette)); + +#if defined(PNG_sBIT_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p *sig_bit)); +#endif + +#if defined(PNG_sBIT_SUPPORTED) +extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p sig_bit)); +#endif + +#if defined(PNG_sRGB_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *intent)); +#endif + +#if defined(PNG_sRGB_SUPPORTED) +extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +#endif + +#if defined(PNG_iCCP_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charpp name, int *compression_type, + png_charpp profile, png_uint_32 *proflen)); + /* Note to maintainer: profile should be png_bytepp */ +#endif + +#if defined(PNG_iCCP_SUPPORTED) +extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp name, int compression_type, + png_charp profile, png_uint_32 proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#if defined(PNG_sPLT_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tpp entries)); +#endif + +#if defined(PNG_sPLT_SUPPORTED) +extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tp entries, int nentries)); +#endif + +#if defined(PNG_TEXT_SUPPORTED) +/* png_get_text also returns the number of text chunks in *num_text */ +extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp *text_ptr, int *num_text)); +#endif + +/* + * Note while png_set_text() will accept a structure whose text, + * language, and translated keywords are NULL pointers, the structure + * returned by png_get_text will always contain regular + * zero-terminated C strings. They might be empty strings but + * they will never be NULL pointers. + */ + +#if defined(PNG_TEXT_SUPPORTED) +extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#if defined(PNG_tIME_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep *mod_time)); +#endif + +#if defined(PNG_tIME_SUPPORTED) +extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep mod_time)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep *trans, int *num_trans, + png_color_16p *trans_values)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep trans, int num_trans, + png_color_16p trans_values)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +#endif + +#if defined(PNG_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, double *width, double *height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); +#endif +#endif +#endif /* PNG_sCAL_SUPPORTED */ + +#if defined(PNG_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, double width, double height)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); +#endif +#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +/* provide a list of chunks and how they are to be handled, if the built-in + handling or default unknown chunk handling is not desired. Any chunks not + listed will be handled in the default manner. The IHDR and IEND chunks + must not be listed. + keep = 0: follow default behavour + = 1: do not keep + = 2: keep only if safe-to-copy + = 3: keep even if unsafe-to-copy +*/ +extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp + png_ptr, int keep, png_bytep chunk_list, int num_chunks)); +extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); +extern PNG_EXPORT(void, png_set_unknown_chunk_location) + PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); +extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp + png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); +#endif +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep + chunk_name)); +#endif + +/* Png_free_data() will turn off the "valid" flag for anything it frees. + If you need to turn it off for a chunk that your application has freed, + you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ +extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, + png_infop info_ptr, int mask)); + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +/* The "params" pointer is currently not used and is for future expansion. */ +extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +#endif + +/* Define PNG_DEBUG at compile time for debugging information. Higher + * numbers for PNG_DEBUG mean more debugging information. This has + * only been added since version 0.95 so it is not implemented throughout + * libpng yet, but more support will be added as needed. + */ +#ifdef PNG_DEBUG +#if (PNG_DEBUG > 0) +#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) +#include +#if (PNG_DEBUG > 1) +#define png_debug(l,m) _RPT0(_CRT_WARN,m) +#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) +#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) +#endif +#else /* PNG_DEBUG_FILE || !_MSC_VER */ +#ifndef PNG_DEBUG_FILE +#define PNG_DEBUG_FILE stderr +#endif /* PNG_DEBUG_FILE */ +#if (PNG_DEBUG > 1) +#define png_debug(l,m) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ +} +#define png_debug1(l,m,p1) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ +} +#define png_debug2(l,m,p1,p2) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ +} +#endif /* (PNG_DEBUG > 1) */ +#endif /* _MSC_VER */ +#endif /* (PNG_DEBUG > 0) */ +#endif /* PNG_DEBUG */ +#ifndef png_debug +#define png_debug(l, m) +#endif +#ifndef png_debug1 +#define png_debug1(l, m, p1) +#endif +#ifndef png_debug2 +#define png_debug2(l, m, p1, p2) +#endif + +extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void)); + +extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); + +#ifdef PNG_MNG_FEATURES_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp + png_ptr, png_uint_32 mng_features_permitted)); +#endif + +/* For use in png_set_keep_unknown, added to version 1.2.6 */ +#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 +#define PNG_HANDLE_CHUNK_NEVER 1 +#define PNG_HANDLE_CHUNK_IF_SAFE 2 +#define PNG_HANDLE_CHUNK_ALWAYS 3 + +/* Added to version 1.2.0 */ +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ +#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ +#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 +#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 +#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 +#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 +#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 +#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 +#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ + +#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ + | PNG_ASM_FLAG_MMX_READ_INTERLACE \ + | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ + | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ + | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ + | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ) +#define PNG_MMX_WRITE_FLAGS ( 0 ) + +#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ + | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ + | PNG_MMX_READ_FLAGS \ + | PNG_MMX_WRITE_FLAGS ) + +#define PNG_SELECT_READ 1 +#define PNG_SELECT_WRITE 2 + +#if !defined(PNG_1_0_X) +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) + PNGARG((int flag_select, int *compilerID)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) + PNGARG((int flag_select)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_asm_flags) + PNGARG((png_structp png_ptr)); + +/* pngget.c */ +extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) + PNGARG((png_structp png_ptr)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) + PNGARG((png_structp png_ptr)); + +/* pngset.c */ +extern PNG_EXPORT(void,png_set_asm_flags) + PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); + +/* pngset.c */ +extern PNG_EXPORT(void,png_set_mmx_thresholds) + PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, + png_uint_32 mmx_rowbytes_threshold)); + +#endif /* PNG_1_0_X */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + +#if !defined(PNG_1_0_X) +/* png.c, pnggccrd.c, or pngvcrd.c */ +extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); + +/* Strip the prepended error numbers ("#nnn ") from error and warning + * messages before passing them to the error or warning handler. */ +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp + png_ptr, png_uint_32 strip_mode)); +#endif + +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp + png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); +extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp + png_ptr)); +extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp + png_ptr)); +#endif + +/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ + +#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED +/* With these routines we avoid an integer divide, which will be slower on + * most machines. However, it does take more operations than the corresponding + * divide method, so it may be slower on a few RISC systems. There are two + * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. + * + * Note that the rounding factors are NOT supposed to be the same! 128 and + * 32768 are correct for the NODIV code; 127 and 32767 are correct for the + * standard method. + * + * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] + */ + + /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ + +# define png_composite(composite, fg, alpha, bg) \ + { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ + + (png_uint_16)(bg)*(png_uint_16)(255 - \ + (png_uint_16)(alpha)) + (png_uint_16)128); \ + (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } + +# define png_composite_16(composite, fg, alpha, bg) \ + { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ + + (png_uint_32)(bg)*(png_uint_32)(65535L - \ + (png_uint_32)(alpha)) + (png_uint_32)32768L); \ + (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } + +#else /* standard method using integer division */ + +# define png_composite(composite, fg, alpha, bg) \ + (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ + (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ + (png_uint_16)127) / 255) + +# define png_composite_16(composite, fg, alpha, bg) \ + (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ + (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ + (png_uint_32)32767) / (png_uint_32)65535L) + +#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ + +/* These next functions are used internally in the code. They generally + * shouldn't be used unless you are writing code to add or replace some + * functionality in libpng. More information about most functions can + * be found in the files where the functions are located. + */ + +#if defined(PNG_INTERNAL) + +/* Various modes of operation. Note that after an init, mode is set to + * zero automatically when the structure is created. + */ +#define PNG_HAVE_IHDR 0x01 +#define PNG_HAVE_PLTE 0x02 +#define PNG_HAVE_IDAT 0x04 +#define PNG_AFTER_IDAT 0x08 +#define PNG_HAVE_IEND 0x10 +#define PNG_HAVE_gAMA 0x20 +#define PNG_HAVE_cHRM 0x40 +#define PNG_HAVE_sRGB 0x80 +#define PNG_HAVE_CHUNK_HEADER 0x100 +#define PNG_WROTE_tIME 0x200 +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 +#define PNG_BACKGROUND_IS_GRAY 0x800 +#define PNG_HAVE_PNG_SIGNATURE 0x1000 + +/* flags for the transformations the PNG library does on the image data */ +#define PNG_BGR 0x0001 +#define PNG_INTERLACE 0x0002 +#define PNG_PACK 0x0004 +#define PNG_SHIFT 0x0008 +#define PNG_SWAP_BYTES 0x0010 +#define PNG_INVERT_MONO 0x0020 +#define PNG_DITHER 0x0040 +#define PNG_BACKGROUND 0x0080 +#define PNG_BACKGROUND_EXPAND 0x0100 + /* 0x0200 unused */ +#define PNG_16_TO_8 0x0400 +#define PNG_RGBA 0x0800 +#define PNG_EXPAND 0x1000 +#define PNG_GAMMA 0x2000 +#define PNG_GRAY_TO_RGB 0x4000 +#define PNG_FILLER 0x8000L +#define PNG_PACKSWAP 0x10000L +#define PNG_SWAP_ALPHA 0x20000L +#define PNG_STRIP_ALPHA 0x40000L +#define PNG_INVERT_ALPHA 0x80000L +#define PNG_USER_TRANSFORM 0x100000L +#define PNG_RGB_TO_GRAY_ERR 0x200000L +#define PNG_RGB_TO_GRAY_WARN 0x400000L +#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ +#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ + +/* flags for png_create_struct */ +#define PNG_STRUCT_PNG 0x0001 +#define PNG_STRUCT_INFO 0x0002 + +/* Scaling factor for filter heuristic weighting calculations */ +#define PNG_WEIGHT_SHIFT 8 +#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) +#define PNG_COST_SHIFT 3 +#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) + +/* flags for the png_ptr->flags rather than declaring a byte for each one */ +#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 +#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 +#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 +#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 +#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 +#define PNG_FLAG_ZLIB_FINISHED 0x0020 +#define PNG_FLAG_ROW_INIT 0x0040 +#define PNG_FLAG_FILLER_AFTER 0x0080 +#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 +#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 +#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 +#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 +#define PNG_FLAG_FREE_PLTE 0x1000 +#define PNG_FLAG_FREE_TRNS 0x2000 +#define PNG_FLAG_FREE_HIST 0x4000 +#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L +#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L +#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L +#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L + +#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ + PNG_FLAG_CRC_ANCILLARY_NOWARN) + +#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ + PNG_FLAG_CRC_CRITICAL_IGNORE) + +#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ + PNG_FLAG_CRC_CRITICAL_MASK) + +/* save typing and make code easier to understand */ + +#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ + abs((int)((c1).green) - (int)((c2).green)) + \ + abs((int)((c1).blue) - (int)((c2).blue))) + +/* Added to libpng-1.2.6 JB */ +#define PNG_ROWBYTES(pixel_bits, width) \ + ((pixel_bits) >= 8 ? \ + ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \ + (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) ) + +/* PNG_OUT_OF_RANGE returns true if value is outside the range + ideal-delta..ideal+delta. Each argument is evaluated twice. + "ideal" and "delta" should be constants, normally simple + integers, "value" a variable. Added to libpng-1.2.6 JB */ +#define PNG_OUT_OF_RANGE(value, ideal, delta) \ + ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) + +/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ +#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) +/* place to hold the signature string for a PNG file. */ +#ifdef PNG_USE_GLOBAL_ARRAYS + PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; +#else +#define png_sig png_sig_bytes(NULL) +#endif +#endif /* PNG_NO_EXTERN */ + +/* Constant strings for known chunk types. If you need to add a chunk, + * define the name here, and add an invocation of the macro in png.c and + * wherever it's needed. + */ +#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} +#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} +#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} +#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} +#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} +#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} +#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} +#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} +#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} +#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} +#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} +#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} +#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} +#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} +#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} +#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} +#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} +#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} +#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} +#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} +#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} + +#ifdef PNG_USE_GLOBAL_ARRAYS +PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; +#endif /* PNG_USE_GLOBAL_ARRAYS */ + + +/* Inline macros to do direct reads of bytes from the input buffer. These + * require that you are using an architecture that uses PNG byte ordering + * (MSB first) and supports unaligned data storage. I think that PowerPC + * in big-endian mode and 680x0 are the only ones that will support this. + * The x86 line of processors definitely do not. The png_get_int_32() + * routine also assumes we are using two's complement format for negative + * values, which is almost certainly true. + */ +#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) +# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) +# define png_get_int_32(buf) ( *((png_int_32p) (buf))) +# endif +# define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) +# define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) +#else +# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) +PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf)); +# endif +PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf)); +PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf)); +#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ +/* RN: This define is blatent hack to get png to (hopefully) + link on OSX 10.2 and earlier versions of 10.3 due to an + Apple linking bug introduced in 10.2 */ +#define png_get_uint_31 wxpng_get_uint_31 +PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr, + png_bytep buf)); +/* Initialize png_ptr struct for reading, and allocate any other memory. + * (old interface - DEPRECATED - use png_create_read_struct instead). + */ +extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); +#undef png_read_init +#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); +extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); +extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t + png_info_size)); + +/* Initialize png_ptr struct for writing, and allocate any other memory. + * (old interface - DEPRECATED - use png_create_write_struct instead). + */ +extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); +#undef png_write_init +#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); +extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); +extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t + png_info_size)); + +/* Allocate memory for an internal libpng struct */ +PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); + +/* Free memory from internal libpng struct */ +PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); + +PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr + malloc_fn, png_voidp mem_ptr)); +PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, + png_free_ptr free_fn, png_voidp mem_ptr)); + +/* Free any memory that info_ptr points to and reset struct. */ +PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_1_0_X +/* Function to allocate memory for zlib. */ +PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); + +/* Function to free memory for zlib */ +PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); + +#ifdef PNG_SIZE_T +/* Function to convert a sizeof an item to png_sizeof item */ + PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); +#endif + +/* Next four functions are used internally as callbacks. PNGAPI is required + * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ + +PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif + +PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +#if !defined(PNG_NO_STDIO) +PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); +#endif +#endif +#else /* PNG_1_0_X */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif +#endif /* PNG_1_0_X */ + +/* Reset the CRC variable */ +PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); + +/* Write the "data" buffer to whatever output you are using. */ +PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read data from whatever input you are using into the "data" buffer */ +PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read bytes into buf, and update png_ptr->crc */ +PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, + png_size_t length)); + +/* Decompress data in a chunk that uses compression */ +#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ + defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) +PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, + int comp_type, png_charp chunkdata, png_size_t chunklength, + png_size_t prefix_length, png_size_t *data_length)); +#endif + +/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ +PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); + +/* Read the CRC from the file and compare it to the libpng calculated CRC */ +PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); + +/* Calculate the CRC over a section of data. Note that we are only + * passing a maximum of 64K on systems that have this as a memory limit, + * since this is the maximum buffer size we can specify. + */ +PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, + png_size_t length)); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); +#endif + + +/* Place a 32-bit number into a buffer in PNG byte order (big-endian). + * The only currently known PNG chunks that use signed numbers are + * the ancillary extension chunks, oFFs and pCAL. + */ +PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i)); + +#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) +PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i)); +#endif + +/* Place a 16-bit number into a buffer in PNG byte order. + * The parameter is declared unsigned int, not png_uint_16, + * just to avoid potential problems on pre-ANSI C compilers. + */ +PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i)); + +/* simple function to write the signature */ +PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); + +/* write various chunks */ + +/* Write the IHDR chunk, and update the png_struct with the necessary + * information. + */ +PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, + png_uint_32 height, + int bit_depth, int color_type, int compression_method, int filter_method, + int interlace_method)); + +PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, + png_uint_32 num_pal)); + +PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); + +#if defined(PNG_WRITE_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point + file_gamma)); +#endif +#endif + +#if defined(PNG_WRITE_sBIT_SUPPORTED) +PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, + int color_type)); +#endif + +#if defined(PNG_WRITE_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, + double white_x, double white_y, + double red_x, double red_y, double green_x, double green_y, + double blue_x, double blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, + png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#if defined(PNG_WRITE_sRGB_SUPPORTED) +PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, + int intent)); +#endif + +#if defined(PNG_WRITE_iCCP_SUPPORTED) +PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, + png_charp name, int compression_type, + png_charp profile, int proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#if defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, + png_sPLT_tp palette)); +#endif + +#if defined(PNG_WRITE_tRNS_SUPPORTED) +PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, + png_color_16p values, int number, int color_type)); +#endif + +#if defined(PNG_WRITE_bKGD_SUPPORTED) +PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, + png_color_16p values, int color_type)); +#endif + +#if defined(PNG_WRITE_hIST_SUPPORTED) +PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, + int num_hist)); +#endif + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ + defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, + png_charp key, png_charpp new_key)); +#endif + +#if defined(PNG_WRITE_tEXt_SUPPORTED) +PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len)); +#endif + +#if defined(PNG_WRITE_zTXt_SUPPORTED) +PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len, int compression)); +#endif + +#if defined(PNG_WRITE_iTXt_SUPPORTED) +PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, + int compression, png_charp key, png_charp lang, png_charp lang_key, + png_charp text)); +#endif + +#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ +PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#if defined(PNG_WRITE_oFFs_SUPPORTED) +PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, + png_int_32 x_offset, png_int_32 y_offset, int unit_type)); +#endif + +#if defined(PNG_WRITE_pCAL_SUPPORTED) +PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, + png_int_32 X0, png_int_32 X1, int type, int nparams, + png_charp units, png_charpp params)); +#endif + +#if defined(PNG_WRITE_pHYs_SUPPORTED) +PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, + png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, + int unit_type)); +#endif + +#if defined(PNG_WRITE_tIME_SUPPORTED) +PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, + png_timep mod_time)); +#endif + +#if defined(PNG_WRITE_sCAL_SUPPORTED) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, + int unit, double width, double height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, + int unit, png_charp width, png_charp height)); +#endif +#endif +#endif + +/* Called when finished processing a row of data */ +PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); + +/* Internal use only. Called before first row of data */ +PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); + +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); +#endif + +/* combine a row of data, dealing with alpha, etc. if requested */ +PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, + int mask)); + +#if defined(PNG_READ_INTERLACING_SUPPORTED) +/* expand an interlaced row */ +/* OLD pre-1.0.9 interface: +PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass, png_uint_32 transformations)); + */ +PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); +#endif + +/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ + +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* grab pixels out of a row for an interlaced pass */ +PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass)); +#endif + +/* unfilter a row */ +PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, + png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); + +/* Choose the best filter to use and filter the row data */ +PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, + png_row_infop row_info)); + +/* Write out the filtered row. */ +PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, + png_bytep filtered_row)); +/* finish a row while reading, dealing with interlacing passes, etc. */ +PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); + +/* initialize the row buffers, etc. */ +PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); +/* optional call to update the users info structure */ +PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +/* these are the functions that do the transformations */ +#if defined(PNG_READ_FILLER_SUPPORTED) +PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 filler, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ + defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) +PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop + row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) +PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) +PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p sig_bits)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, + png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); + +# if defined(PNG_CORRECT_PALETTE_SUPPORTED) +PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette)); +# endif +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_WRITE_PACK_SUPPORTED) +PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 bit_depth)); +#endif + +#if defined(PNG_WRITE_SHIFT_SUPPORTED) +PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p bit_depth)); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background, + png_color_16p background_1, + png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, + png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, + png_uint_16pp gamma_16_to_1, int gamma_shift)); +#else +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background)); +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, + png_bytep gamma_table, png_uint_16pp gamma_16_table, + int gamma_shift)); +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) +PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, + png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); +PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, + png_bytep row, png_color_16p trans_value)); +#endif + +/* The following decodes the appropriate chunks, and does error correction, + * then calls the appropriate callback for the chunk if it is valid. + */ + +/* decode the IHDR chunk */ +PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); + +#if defined(PNG_READ_bKGD_SUPPORTED) +PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_cHRM_SUPPORTED) +PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_gAMA_SUPPORTED) +PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_hIST_SUPPORTED) +PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_iCCP_SUPPORTED) +extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_iCCP_SUPPORTED */ + +#if defined(PNG_READ_iTXt_SUPPORTED) +PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_oFFs_SUPPORTED) +PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_pCAL_SUPPORTED) +PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_pHYs_SUPPORTED) +PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sBIT_SUPPORTED) +PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sCAL_SUPPORTED) +PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sPLT_SUPPORTED) +extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_sPLT_SUPPORTED */ + +#if defined(PNG_READ_sRGB_SUPPORTED) +PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tEXt_SUPPORTED) +PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tIME_SUPPORTED) +PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tRNS_SUPPORTED) +PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_zTXt_SUPPORTED) +PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); + +PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, + png_bytep chunk_name)); + +/* handle the transformations for reading and writing */ +PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); + +PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, + png_uint_32 length)); +PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); +PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); +#if defined(PNG_READ_tEXt_SUPPORTED) +PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) +PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) +PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#ifdef PNG_MNG_FEATURES_SUPPORTED +PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +/* png.c */ /* PRIVATE */ +PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); +#endif +/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + +#endif /* PNG_INTERNAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* PNG_VERSION_INFO_ONLY */ +/* do not put anything past this line */ +#endif /* PNG_H */ diff --git a/Externals/wxWidgets/src/png/pngasmrd.h b/Externals/wxWidgets/src/png/pngasmrd.h index c194078f11..0505258261 100644 --- a/Externals/wxWidgets/src/png/pngasmrd.h +++ b/Externals/wxWidgets/src/png/pngasmrd.h @@ -1,11 +1,11 @@ -/* pngasmrd.h - assembler version of utilities to read a PNG file - * - * libpng 1.2.6 - August 15, 2004 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 2002-2004 Glenn Randers-Pehrson - * - */ - -/* This file is obsolete in libpng-1.0.9 and later; its contents now appear - * at the end of pngconf.h. - */ +/* pngasmrd.h - assembler version of utilities to read a PNG file + * + * libpng 1.2.6 - August 15, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 2002-2004 Glenn Randers-Pehrson + * + */ + +/* This file is obsolete in libpng-1.0.9 and later; its contents now appear + * at the end of pngconf.h. + */ diff --git a/Externals/wxWidgets/src/png/pngconf.h b/Externals/wxWidgets/src/png/pngconf.h index f22ddeaf5e..867e0a8668 100644 --- a/Externals/wxWidgets/src/png/pngconf.h +++ b/Externals/wxWidgets/src/png/pngconf.h @@ -1,1394 +1,1394 @@ - -/* pngconf.h - machine configurable file for libpng - * - * libpng version 1.2.7 - September 12, 2004 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2004 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -/* Any machine specific code is near the front of this file, so if you - * are configuring libpng for a machine, you may want to read the section - * starting here down to where it starts to typedef png_color, png_text, - * and png_info. - */ - -#ifndef PNGCONF_H -#define PNGCONF_H - -#ifdef PNG_USER_CONFIG -#include "pngusr.h" -#endif - -/* This is the size of the compression buffer, and thus the size of - * an IDAT chunk. Make this whatever size you feel is best for your - * machine. One of these will be allocated per png_struct. When this - * is full, it writes the data to the disk, and does some other - * calculations. Making this an extremely small size will slow - * the library down, but you may want to experiment to determine - * where it becomes significant, if you are concerned with memory - * usage. Note that zlib allocates at least 32Kb also. For readers, - * this describes the size of the buffer available to read the data in. - * Unless this gets smaller than the size of a row (compressed), - * it should not make much difference how big this is. - */ - -#ifndef PNG_ZBUF_SIZE -# define PNG_ZBUF_SIZE 8192 -#endif - -/* Enable if you want a write-only libpng */ - -#ifndef PNG_NO_READ_SUPPORTED -# define PNG_READ_SUPPORTED -#endif - -/* Enable if you want a read-only libpng */ - -#ifndef PNG_NO_WRITE_SUPPORTED -# define PNG_WRITE_SUPPORTED -#endif - -/* Enabled by default in 1.2.0. You can disable this if you don't need to - support PNGs that are embedded in MNG datastreams */ -#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) -# ifndef PNG_MNG_FEATURES_SUPPORTED -# define PNG_MNG_FEATURES_SUPPORTED -# endif -#endif - -#ifndef PNG_NO_FLOATING_POINT_SUPPORTED -# ifndef PNG_FLOATING_POINT_SUPPORTED -# define PNG_FLOATING_POINT_SUPPORTED -# endif -#endif - -/* If you are running on a machine where you cannot allocate more - * than 64K of memory at once, uncomment this. While libpng will not - * normally need that much memory in a chunk (unless you load up a very - * large file), zlib needs to know how big of a chunk it can use, and - * libpng thus makes sure to check any memory allocation to verify it - * will fit into memory. -#define PNG_MAX_MALLOC_64K - */ -#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) -# define PNG_MAX_MALLOC_64K -#endif - -/* Special munging to support doing things the 'cygwin' way: - * 'Normal' png-on-win32 defines/defaults: - * PNG_BUILD_DLL -- building dll - * PNG_USE_DLL -- building an application, linking to dll - * (no define) -- building static library, or building an - * application and linking to the static lib - * 'Cygwin' defines/defaults: - * PNG_BUILD_DLL -- (ignored) building the dll - * (no define) -- (ignored) building an application, linking to the dll - * PNG_STATIC -- (ignored) building the static lib, or building an - * application that links to the static lib. - * ALL_STATIC -- (ignored) building various static libs, or building an - * application that links to the static libs. - * Thus, - * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and - * this bit of #ifdefs will define the 'correct' config variables based on - * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but - * unnecessary. - * - * Also, the precedence order is: - * ALL_STATIC (since we can't #undef something outside our namespace) - * PNG_BUILD_DLL - * PNG_STATIC - * (nothing) == PNG_USE_DLL - * - * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent - * of auto-import in binutils, we no longer need to worry about - * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, - * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes - * to __declspec() stuff. However, we DO need to worry about - * PNG_BUILD_DLL and PNG_STATIC because those change some defaults - * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. - */ -#if defined(__CYGWIN__) -# if defined(ALL_STATIC) -# if defined(PNG_BUILD_DLL) -# undef PNG_BUILD_DLL -# endif -# if defined(PNG_USE_DLL) -# undef PNG_USE_DLL -# endif -# if defined(PNG_DLL) -# undef PNG_DLL -# endif -# if !defined(PNG_STATIC) -# define PNG_STATIC -# endif -# else -# if defined (PNG_BUILD_DLL) -# if defined(PNG_STATIC) -# undef PNG_STATIC -# endif -# if defined(PNG_USE_DLL) -# undef PNG_USE_DLL -# endif -# if !defined(PNG_DLL) -# define PNG_DLL -# endif -# else -# if defined(PNG_STATIC) -# if defined(PNG_USE_DLL) -# undef PNG_USE_DLL -# endif -# if defined(PNG_DLL) -# undef PNG_DLL -# endif -# else -# if !defined(PNG_USE_DLL) -# define PNG_USE_DLL -# endif -# if !defined(PNG_DLL) -# define PNG_DLL -# endif -# endif -# endif -# endif -#endif - -/* This protects us against compilers that run on a windowing system - * and thus don't have or would rather us not use the stdio types: - * stdin, stdout, and stderr. The only one currently used is stderr - * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will - * prevent these from being compiled and used. #defining PNG_NO_STDIO - * will also prevent these, plus will prevent the entire set of stdio - * macros and functions (FILE *, printf, etc.) from being compiled and used, - * unless (PNG_DEBUG > 0) has been #defined. - * - * #define PNG_NO_CONSOLE_IO - * #define PNG_NO_STDIO - */ - -#if defined(_WIN32_WCE) -# include - /* Console I/O functions are not supported on WindowsCE */ -# define PNG_NO_CONSOLE_IO -# ifdef PNG_DEBUG -# undef PNG_DEBUG -# endif -#endif - -#ifdef PNG_BUILD_DLL -# ifndef PNG_CONSOLE_IO_SUPPORTED -# ifndef PNG_NO_CONSOLE_IO -# define PNG_NO_CONSOLE_IO -# endif -# endif -#endif - -# ifdef PNG_NO_STDIO -# ifndef PNG_NO_CONSOLE_IO -# define PNG_NO_CONSOLE_IO -# endif -# ifdef PNG_DEBUG -# if (PNG_DEBUG > 0) -# include -# endif -# endif -# else -# if !defined(_WIN32_WCE) -/* "stdio.h" functions are not supported on WindowsCE */ -# include -# endif -# endif - -/* This macro protects us against machines that don't have function - * prototypes (ie K&R style headers). If your compiler does not handle - * function prototypes, define this macro and use the included ansi2knr. - * I've always been able to use _NO_PROTO as the indicator, but you may - * need to drag the empty declaration out in front of here, or change the - * ifdef to suit your own needs. - */ -#ifndef PNGARG - -#ifdef OF /* zlib prototype munger */ -# define PNGARG(arglist) OF(arglist) -#else - -#ifdef _NO_PROTO -# define PNGARG(arglist) () -# ifndef PNG_TYPECAST_NULL -# define PNG_TYPECAST_NULL -# endif -#else -# define PNGARG(arglist) arglist -#endif /* _NO_PROTO */ - -#endif /* OF */ - -#endif /* PNGARG */ - -/* Try to determine if we are compiling on a Mac. Note that testing for - * just __MWERKS__ is not good enough, because the Codewarrior is now used - * on non-Mac platforms. - */ -#ifndef MACOS -# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ - defined(THINK_C) || (defined(__SC__) && !defined(__DMC__))|| defined(TARGET_OS_MAC) -# define MACOS -# endif -#endif - -/* enough people need this for various reasons to include it here */ -#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) -# include -#endif - -#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) -# define PNG_SETJMP_SUPPORTED -#endif - -#ifdef PNG_SETJMP_SUPPORTED -/* This is an attempt to force a single setjmp behaviour on Linux. If - * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. - */ - -# ifdef __linux__ -# ifdef _BSD_SOURCE -# define PNG_SAVE_BSD_SOURCE -# undef _BSD_SOURCE -# endif -# ifdef _SETJMP_H - /* If you encounter a compiler error here, see the explanation - * near the end of INSTALL. - */ - __png.h__ already includes setjmp.h; - __dont__ include it again.; -# endif -# endif /* __linux__ */ - - /* include setjmp.h for error handling */ -# include - -# ifdef __linux__ -# ifdef PNG_SAVE_BSD_SOURCE -# define _BSD_SOURCE -# undef PNG_SAVE_BSD_SOURCE -# endif -# endif /* __linux__ */ -#endif /* PNG_SETJMP_SUPPORTED */ - -#ifdef BSD -# include -#else -# include -#endif - -/* Other defines for things like memory and the like can go here. */ -#ifdef PNG_INTERNAL - -#include - -/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which - * aren't usually used outside the library (as far as I know), so it is - * debatable if they should be exported at all. In the future, when it is - * possible to have run-time registry of chunk-handling functions, some of - * these will be made available again. -#define PNG_EXTERN extern - */ -#define PNG_EXTERN - -/* Other defines specific to compilers can go here. Try to keep - * them inside an appropriate ifdef/endif pair for portability. - */ - -#if defined(PNG_FLOATING_POINT_SUPPORTED) -# if defined(MACOS) - /* We need to check that hasn't already been included earlier - * as it seems it doesn't agree with , yet we should really use - * if possible. - */ -# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) -# include -# endif -# else -# include -# endif -# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) - /* Amiga SAS/C: We must include builtin FPU functions when compiling using - * MATH=68881 - */ -# include -# endif -#endif - -/* Codewarrior on NT has linking problems without this. */ -#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) -# define PNG_ALWAYS_EXTERN -#endif - -/* This provides the non-ANSI (far) memory allocation routines. */ -#if defined(__TURBOC__) && defined(__MSDOS__) -# include -# include -#endif - -/* I have no idea why is this necessary... */ -#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ - defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) -# include -#endif - -/* This controls how fine the dithering gets. As this allocates - * a largish chunk of memory (32K), those who are not as concerned - * with dithering quality can decrease some or all of these. - */ -#ifndef PNG_DITHER_RED_BITS -# define PNG_DITHER_RED_BITS 5 -#endif -#ifndef PNG_DITHER_GREEN_BITS -# define PNG_DITHER_GREEN_BITS 5 -#endif -#ifndef PNG_DITHER_BLUE_BITS -# define PNG_DITHER_BLUE_BITS 5 -#endif - -/* This controls how fine the gamma correction becomes when you - * are only interested in 8 bits anyway. Increasing this value - * results in more memory being used, and more pow() functions - * being called to fill in the gamma tables. Don't set this value - * less then 8, and even that may not work (I haven't tested it). - */ - -#ifndef PNG_MAX_GAMMA_8 -# define PNG_MAX_GAMMA_8 11 -#endif - -/* This controls how much a difference in gamma we can tolerate before - * we actually start doing gamma conversion. - */ -#ifndef PNG_GAMMA_THRESHOLD -# define PNG_GAMMA_THRESHOLD 0.05 -#endif - -#endif /* PNG_INTERNAL */ - -/* The following uses const char * instead of char * for error - * and warning message functions, so some compilers won't complain. - * If you do not want to use const, define PNG_NO_CONST here. - */ - -#ifndef PNG_NO_CONST -# define PNG_CONST const -#else -# define PNG_CONST -#endif - -/* The following defines give you the ability to remove code from the - * library that you will not be using. I wish I could figure out how to - * automate this, but I can't do that without making it seriously hard - * on the users. So if you are not using an ability, change the #define - * to and #undef, and that part of the library will not be compiled. If - * your linker can't find a function, you may want to make sure the - * ability is defined here. Some of these depend upon some others being - * defined. I haven't figured out all the interactions here, so you may - * have to experiment awhile to get everything to compile. If you are - * creating or using a shared library, you probably shouldn't touch this, - * as it will affect the size of the structures, and this will cause bad - * things to happen if the library and/or application ever change. - */ - -/* Any features you will not be using can be undef'ed here */ - -/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user - * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS - * on the compile line, then pick and choose which ones to define without - * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED - * if you only want to have a png-compliant reader/writer but don't need - * any of the extra transformations. This saves about 80 kbytes in a - * typical installation of the library. (PNG_NO_* form added in version - * 1.0.1c, for consistency) - */ - -/* The size of the png_text structure changed in libpng-1.0.6 when - * iTXt is supported. It is turned off by default, to support old apps - * that malloc the png_text structure instead of calling png_set_text() - * and letting libpng malloc it. It will be turned on by default in - * libpng-1.3.0. - */ - -#ifndef PNG_iTXt_SUPPORTED -# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) -# define PNG_NO_READ_iTXt -# endif -# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) -# define PNG_NO_WRITE_iTXt -# endif -#endif - -/* The following support, added after version 1.0.0, can be turned off here en - * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility - * with old applications that require the length of png_struct and png_info - * to remain unchanged. - */ - -#ifdef PNG_LEGACY_SUPPORTED -# define PNG_NO_FREE_ME -# define PNG_NO_READ_UNKNOWN_CHUNKS -# define PNG_NO_WRITE_UNKNOWN_CHUNKS -# define PNG_NO_READ_USER_CHUNKS -# define PNG_NO_READ_iCCP -# define PNG_NO_WRITE_iCCP -# define PNG_NO_READ_iTXt -# define PNG_NO_WRITE_iTXt -# define PNG_NO_READ_sCAL -# define PNG_NO_WRITE_sCAL -# define PNG_NO_READ_sPLT -# define PNG_NO_WRITE_sPLT -# define PNG_NO_INFO_IMAGE -# define PNG_NO_READ_RGB_TO_GRAY -# define PNG_NO_READ_USER_TRANSFORM -# define PNG_NO_WRITE_USER_TRANSFORM -# define PNG_NO_USER_MEM -# define PNG_NO_READ_EMPTY_PLTE -# define PNG_NO_MNG_FEATURES -# define PNG_NO_FIXED_POINT_SUPPORTED -#endif - -/* Ignore attempt to turn off both floating and fixed point support */ -#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ - !defined(PNG_NO_FIXED_POINT_SUPPORTED) -# define PNG_FIXED_POINT_SUPPORTED -#endif - -#ifndef PNG_NO_FREE_ME -# define PNG_FREE_ME_SUPPORTED -#endif - -#if defined(PNG_READ_SUPPORTED) - -#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ - !defined(PNG_NO_READ_TRANSFORMS) -# define PNG_READ_TRANSFORMS_SUPPORTED -#endif - -#ifdef PNG_READ_TRANSFORMS_SUPPORTED -# ifndef PNG_NO_READ_EXPAND -# define PNG_READ_EXPAND_SUPPORTED -# endif -# ifndef PNG_NO_READ_SHIFT -# define PNG_READ_SHIFT_SUPPORTED -# endif -# ifndef PNG_NO_READ_PACK -# define PNG_READ_PACK_SUPPORTED -# endif -# ifndef PNG_NO_READ_BGR -# define PNG_READ_BGR_SUPPORTED -# endif -# ifndef PNG_NO_READ_SWAP -# define PNG_READ_SWAP_SUPPORTED -# endif -# ifndef PNG_NO_READ_PACKSWAP -# define PNG_READ_PACKSWAP_SUPPORTED -# endif -# ifndef PNG_NO_READ_INVERT -# define PNG_READ_INVERT_SUPPORTED -# endif -# ifndef PNG_NO_READ_DITHER -# define PNG_READ_DITHER_SUPPORTED -# endif -# ifndef PNG_NO_READ_BACKGROUND -# define PNG_READ_BACKGROUND_SUPPORTED -# endif -# ifndef PNG_NO_READ_16_TO_8 -# define PNG_READ_16_TO_8_SUPPORTED -# endif -# ifndef PNG_NO_READ_FILLER -# define PNG_READ_FILLER_SUPPORTED -# endif -# ifndef PNG_NO_READ_GAMMA -# define PNG_READ_GAMMA_SUPPORTED -# endif -# ifndef PNG_NO_READ_GRAY_TO_RGB -# define PNG_READ_GRAY_TO_RGB_SUPPORTED -# endif -# ifndef PNG_NO_READ_SWAP_ALPHA -# define PNG_READ_SWAP_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_READ_INVERT_ALPHA -# define PNG_READ_INVERT_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_READ_STRIP_ALPHA -# define PNG_READ_STRIP_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_READ_USER_TRANSFORM -# define PNG_READ_USER_TRANSFORM_SUPPORTED -# endif -# ifndef PNG_NO_READ_RGB_TO_GRAY -# define PNG_READ_RGB_TO_GRAY_SUPPORTED -# endif -#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ - -#if !defined(PNG_NO_PROGRESSIVE_READ) && \ - !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ -# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ -#endif /* about interlacing capability! You'll */ - /* still have interlacing unless you change the following line: */ - -#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ - -#ifndef PNG_NO_READ_COMPOSITE_NODIV -# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ -# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ -# endif -#endif - -/* Deprecated, will be removed from version 2.0.0. - Use PNG_MNG_FEATURES_SUPPORTED instead. */ -#ifndef PNG_NO_READ_EMPTY_PLTE -# define PNG_READ_EMPTY_PLTE_SUPPORTED -#endif - -#endif /* PNG_READ_SUPPORTED */ - -#if defined(PNG_WRITE_SUPPORTED) - -# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ - !defined(PNG_NO_WRITE_TRANSFORMS) -# define PNG_WRITE_TRANSFORMS_SUPPORTED -#endif - -#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED -# ifndef PNG_NO_WRITE_SHIFT -# define PNG_WRITE_SHIFT_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_PACK -# define PNG_WRITE_PACK_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_BGR -# define PNG_WRITE_BGR_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_SWAP -# define PNG_WRITE_SWAP_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_PACKSWAP -# define PNG_WRITE_PACKSWAP_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_INVERT -# define PNG_WRITE_INVERT_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_FILLER -# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ -# endif -# ifndef PNG_NO_WRITE_SWAP_ALPHA -# define PNG_WRITE_SWAP_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_INVERT_ALPHA -# define PNG_WRITE_INVERT_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_USER_TRANSFORM -# define PNG_WRITE_USER_TRANSFORM_SUPPORTED -# endif -#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ - -#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant - encoders, but can cause trouble - if left undefined */ - -#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ - defined(PNG_FLOATING_POINT_SUPPORTED) -# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED -#endif - -#ifndef PNG_NO_WRITE_FLUSH -# define PNG_WRITE_FLUSH_SUPPORTED -#endif - -/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */ -#ifndef PNG_NO_WRITE_EMPTY_PLTE -# define PNG_WRITE_EMPTY_PLTE_SUPPORTED -#endif - -#endif /* PNG_WRITE_SUPPORTED */ - -#ifndef PNG_1_0_X -# ifndef PNG_NO_ERROR_NUMBERS -# define PNG_ERROR_NUMBERS_SUPPORTED -# endif -#endif /* PNG_1_0_X */ - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -# ifndef PNG_NO_USER_TRANSFORM_PTR -# define PNG_USER_TRANSFORM_PTR_SUPPORTED -# endif -#endif - -#ifndef PNG_NO_STDIO -# define PNG_TIME_RFC1123_SUPPORTED -#endif - -/* This adds extra functions in pngget.c for accessing data from the - * info pointer (added in version 0.99) - * png_get_image_width() - * png_get_image_height() - * png_get_bit_depth() - * png_get_color_type() - * png_get_compression_type() - * png_get_filter_type() - * png_get_interlace_type() - * png_get_pixel_aspect_ratio() - * png_get_pixels_per_meter() - * png_get_x_offset_pixels() - * png_get_y_offset_pixels() - * png_get_x_offset_microns() - * png_get_y_offset_microns() - */ -#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) -# define PNG_EASY_ACCESS_SUPPORTED -#endif - -/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 - even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */ -#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) -# ifndef PNG_ASSEMBLER_CODE_SUPPORTED -# define PNG_ASSEMBLER_CODE_SUPPORTED -# endif -# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) -# define PNG_MMX_CODE_SUPPORTED -# endif -#endif - -/* If you are sure that you don't need thread safety and you are compiling - with PNG_USE_PNGCCRD for an MMX application, you can define this for - faster execution. See pnggccrd.c. -#define PNG_THREAD_UNSAFE_OK -*/ - -#if !defined(PNG_1_0_X) -#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) -# define PNG_USER_MEM_SUPPORTED -#endif -#endif /* PNG_1_0_X */ - -/* Added at libpng-1.2.6 */ -#if !defined(PNG_1_0_X) -#ifndef PNG_SET_USER_LIMITS_SUPPORTED -#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) -# define PNG_SET_USER_LIMITS_SUPPORTED -#endif -#endif -#endif /* PNG_1_0_X */ - -/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter - * how large, set these limits to 0x7fffffffL - */ -#ifndef PNG_USER_WIDTH_MAX -# define PNG_USER_WIDTH_MAX 1000000L -#endif -#ifndef PNG_USER_HEIGHT_MAX -# define PNG_USER_HEIGHT_MAX 1000000L -#endif - -/* These are currently experimental features, define them if you want */ - -/* very little testing */ -/* -#ifdef PNG_READ_SUPPORTED -# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED -# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED -# endif -#endif -*/ - -/* This is only for PowerPC big-endian and 680x0 systems */ -/* some testing */ -/* -#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED -# define PNG_READ_BIG_ENDIAN_SUPPORTED -#endif -*/ - -/* Buggy compilers (e.g., gcc 2.7.2.2) need this */ -/* -#define PNG_NO_POINTER_INDEXING -*/ - -/* These functions are turned off by default, as they will be phased out. */ -/* -#define PNG_USELESS_TESTS_SUPPORTED -#define PNG_CORRECT_PALETTE_SUPPORTED -*/ - -/* Any chunks you are not interested in, you can undef here. The - * ones that allocate memory may be expecially important (hIST, - * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info - * a bit smaller. - */ - -#if defined(PNG_READ_SUPPORTED) && \ - !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ - !defined(PNG_NO_READ_ANCILLARY_CHUNKS) -# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED -#endif - -#if defined(PNG_WRITE_SUPPORTED) && \ - !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ - !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) -# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED -#endif - -#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED - -#ifdef PNG_NO_READ_TEXT -# define PNG_NO_READ_iTXt -# define PNG_NO_READ_tEXt -# define PNG_NO_READ_zTXt -#endif -#ifndef PNG_NO_READ_bKGD -# define PNG_READ_bKGD_SUPPORTED -# define PNG_bKGD_SUPPORTED -#endif -#ifndef PNG_NO_READ_cHRM -# define PNG_READ_cHRM_SUPPORTED -# define PNG_cHRM_SUPPORTED -#endif -#ifndef PNG_NO_READ_gAMA -# define PNG_READ_gAMA_SUPPORTED -# define PNG_gAMA_SUPPORTED -#endif -#ifndef PNG_NO_READ_hIST -# define PNG_READ_hIST_SUPPORTED -# define PNG_hIST_SUPPORTED -#endif -#ifndef PNG_NO_READ_iCCP -# define PNG_READ_iCCP_SUPPORTED -# define PNG_iCCP_SUPPORTED -#endif -#ifndef PNG_NO_READ_iTXt -# ifndef PNG_READ_iTXt_SUPPORTED -# define PNG_READ_iTXt_SUPPORTED -# endif -# ifndef PNG_iTXt_SUPPORTED -# define PNG_iTXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_READ_oFFs -# define PNG_READ_oFFs_SUPPORTED -# define PNG_oFFs_SUPPORTED -#endif -#ifndef PNG_NO_READ_pCAL -# define PNG_READ_pCAL_SUPPORTED -# define PNG_pCAL_SUPPORTED -#endif -#ifndef PNG_NO_READ_sCAL -# define PNG_READ_sCAL_SUPPORTED -# define PNG_sCAL_SUPPORTED -#endif -#ifndef PNG_NO_READ_pHYs -# define PNG_READ_pHYs_SUPPORTED -# define PNG_pHYs_SUPPORTED -#endif -#ifndef PNG_NO_READ_sBIT -# define PNG_READ_sBIT_SUPPORTED -# define PNG_sBIT_SUPPORTED -#endif -#ifndef PNG_NO_READ_sPLT -# define PNG_READ_sPLT_SUPPORTED -# define PNG_sPLT_SUPPORTED -#endif -#ifndef PNG_NO_READ_sRGB -# define PNG_READ_sRGB_SUPPORTED -# define PNG_sRGB_SUPPORTED -#endif -#ifndef PNG_NO_READ_tEXt -# define PNG_READ_tEXt_SUPPORTED -# define PNG_tEXt_SUPPORTED -#endif -#ifndef PNG_NO_READ_tIME -# define PNG_READ_tIME_SUPPORTED -# define PNG_tIME_SUPPORTED -#endif -#ifndef PNG_NO_READ_tRNS -# define PNG_READ_tRNS_SUPPORTED -# define PNG_tRNS_SUPPORTED -#endif -#ifndef PNG_NO_READ_zTXt -# define PNG_READ_zTXt_SUPPORTED -# define PNG_zTXt_SUPPORTED -#endif -#ifndef PNG_NO_READ_UNKNOWN_CHUNKS -# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED -# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED -# define PNG_UNKNOWN_CHUNKS_SUPPORTED -# endif -# ifndef PNG_NO_HANDLE_AS_UNKNOWN -# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# endif -#endif -#if !defined(PNG_NO_READ_USER_CHUNKS) && \ - defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) -# define PNG_READ_USER_CHUNKS_SUPPORTED -# define PNG_USER_CHUNKS_SUPPORTED -# ifdef PNG_NO_READ_UNKNOWN_CHUNKS -# undef PNG_NO_READ_UNKNOWN_CHUNKS -# endif -# ifdef PNG_NO_HANDLE_AS_UNKNOWN -# undef PNG_NO_HANDLE_AS_UNKNOWN -# endif -#endif -#ifndef PNG_NO_READ_OPT_PLTE -# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ -#endif /* optional PLTE chunk in RGB and RGBA images */ -#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ - defined(PNG_READ_zTXt_SUPPORTED) -# define PNG_READ_TEXT_SUPPORTED -# define PNG_TEXT_SUPPORTED -#endif - -#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ - -#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED - -#ifdef PNG_NO_WRITE_TEXT -# define PNG_NO_WRITE_iTXt -# define PNG_NO_WRITE_tEXt -# define PNG_NO_WRITE_zTXt -#endif -#ifndef PNG_NO_WRITE_bKGD -# define PNG_WRITE_bKGD_SUPPORTED -# ifndef PNG_bKGD_SUPPORTED -# define PNG_bKGD_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_cHRM -# define PNG_WRITE_cHRM_SUPPORTED -# ifndef PNG_cHRM_SUPPORTED -# define PNG_cHRM_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_gAMA -# define PNG_WRITE_gAMA_SUPPORTED -# ifndef PNG_gAMA_SUPPORTED -# define PNG_gAMA_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_hIST -# define PNG_WRITE_hIST_SUPPORTED -# ifndef PNG_hIST_SUPPORTED -# define PNG_hIST_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_iCCP -# define PNG_WRITE_iCCP_SUPPORTED -# ifndef PNG_iCCP_SUPPORTED -# define PNG_iCCP_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_iTXt -# ifndef PNG_WRITE_iTXt_SUPPORTED -# define PNG_WRITE_iTXt_SUPPORTED -# endif -# ifndef PNG_iTXt_SUPPORTED -# define PNG_iTXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_oFFs -# define PNG_WRITE_oFFs_SUPPORTED -# ifndef PNG_oFFs_SUPPORTED -# define PNG_oFFs_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_pCAL -# define PNG_WRITE_pCAL_SUPPORTED -# ifndef PNG_pCAL_SUPPORTED -# define PNG_pCAL_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sCAL -# define PNG_WRITE_sCAL_SUPPORTED -# ifndef PNG_sCAL_SUPPORTED -# define PNG_sCAL_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_pHYs -# define PNG_WRITE_pHYs_SUPPORTED -# ifndef PNG_pHYs_SUPPORTED -# define PNG_pHYs_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sBIT -# define PNG_WRITE_sBIT_SUPPORTED -# ifndef PNG_sBIT_SUPPORTED -# define PNG_sBIT_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sPLT -# define PNG_WRITE_sPLT_SUPPORTED -# ifndef PNG_sPLT_SUPPORTED -# define PNG_sPLT_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sRGB -# define PNG_WRITE_sRGB_SUPPORTED -# ifndef PNG_sRGB_SUPPORTED -# define PNG_sRGB_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_tEXt -# define PNG_WRITE_tEXt_SUPPORTED -# ifndef PNG_tEXt_SUPPORTED -# define PNG_tEXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_tIME -# define PNG_WRITE_tIME_SUPPORTED -# ifndef PNG_tIME_SUPPORTED -# define PNG_tIME_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_tRNS -# define PNG_WRITE_tRNS_SUPPORTED -# ifndef PNG_tRNS_SUPPORTED -# define PNG_tRNS_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_zTXt -# define PNG_WRITE_zTXt_SUPPORTED -# ifndef PNG_zTXt_SUPPORTED -# define PNG_zTXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS -# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED -# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED -# define PNG_UNKNOWN_CHUNKS_SUPPORTED -# endif -# ifndef PNG_NO_HANDLE_AS_UNKNOWN -# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# endif -# endif -#endif -#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ - defined(PNG_WRITE_zTXt_SUPPORTED) -# define PNG_WRITE_TEXT_SUPPORTED -# ifndef PNG_TEXT_SUPPORTED -# define PNG_TEXT_SUPPORTED -# endif -#endif - -#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ - -/* Turn this off to disable png_read_png() and - * png_write_png() and leave the row_pointers member - * out of the info structure. - */ -#ifndef PNG_NO_INFO_IMAGE -# define PNG_INFO_IMAGE_SUPPORTED -#endif - -/* need the time information for reading tIME chunks */ -#if defined(PNG_tIME_SUPPORTED) -# if !defined(_WIN32_WCE) - /* "time.h" functions are not supported on WindowsCE */ -# include -# endif -#endif - -/* Some typedefs to get us started. These should be safe on most of the - * common platforms. The typedefs should be at least as large as the - * numbers suggest (a png_uint_32 must be at least 32 bits long), but they - * don't have to be exactly that size. Some compilers dislike passing - * unsigned shorts as function parameters, so you may be better off using - * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may - * want to have unsigned int for png_uint_32 instead of unsigned long. - */ - -typedef unsigned long png_uint_32; -typedef long png_int_32; -typedef unsigned short png_uint_16; -typedef short png_int_16; -typedef unsigned char png_byte; - -/* This is usually size_t. It is typedef'ed just in case you need it to - change (I'm not sure if you will or not, so I thought I'd be safe) */ -#ifdef PNG_SIZE_T - typedef PNG_SIZE_T png_size_t; -# define png_sizeof(x) png_convert_size(sizeof (x)) -#else - typedef size_t png_size_t; -# define png_sizeof(x) sizeof (x) -#endif - -/* The following is needed for medium model support. It cannot be in the - * PNG_INTERNAL section. Needs modification for other compilers besides - * MSC. Model independent support declares all arrays and pointers to be - * large using the far keyword. The zlib version used must also support - * model independent data. As of version zlib 1.0.4, the necessary changes - * have been made in zlib. The USE_FAR_KEYWORD define triggers other - * changes that are needed. (Tim Wegner) - */ - -/* Separate compiler dependencies (problem here is that zlib.h always - defines FAR. (SJT) */ -#ifdef __BORLANDC__ -# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) -# define LDATA 1 -# else -# define LDATA 0 -# endif - /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ -# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) -# define PNG_MAX_MALLOC_64K -# if (LDATA != 1) -# ifndef FAR -# define FAR __far -# endif -# define USE_FAR_KEYWORD -# endif /* LDATA != 1 */ - /* Possibly useful for moving data out of default segment. - * Uncomment it if you want. Could also define FARDATA as - * const if your compiler supports it. (SJT) -# define FARDATA FAR - */ -# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ -#endif /* __BORLANDC__ */ - - -/* Suggest testing for specific compiler first before testing for - * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, - * making reliance oncertain keywords suspect. (SJT) - */ - -/* MSC Medium model */ -#if defined(FAR) -# if defined(M_I86MM) -# define USE_FAR_KEYWORD -# define FARDATA FAR -# include -# endif -#endif - -/* SJT: default case */ -#ifndef FAR -# define FAR -#endif - -/* At this point FAR is always defined */ -#ifndef FARDATA -# define FARDATA -#endif - -/* Typedef for floating-point numbers that are converted - to fixed-point with a multiple of 100,000, e.g., int_gamma */ -typedef png_int_32 png_fixed_point; - -/* Add typedefs for pointers */ -typedef void FAR * png_voidp; -typedef png_byte FAR * png_bytep; -typedef png_uint_32 FAR * png_uint_32p; -typedef png_int_32 FAR * png_int_32p; -typedef png_uint_16 FAR * png_uint_16p; -typedef png_int_16 FAR * png_int_16p; -typedef PNG_CONST char FAR * png_const_charp; -typedef char FAR * png_charp; -typedef png_fixed_point FAR * png_fixed_point_p; - -#ifndef PNG_NO_STDIO -#if defined(_WIN32_WCE) -typedef HANDLE png_FILE_p; -#else -typedef FILE * png_FILE_p; -#endif -#endif - -#ifdef PNG_FLOATING_POINT_SUPPORTED -typedef double FAR * png_doublep; -#endif - -/* Pointers to pointers; i.e. arrays */ -typedef png_byte FAR * FAR * png_bytepp; -typedef png_uint_32 FAR * FAR * png_uint_32pp; -typedef png_int_32 FAR * FAR * png_int_32pp; -typedef png_uint_16 FAR * FAR * png_uint_16pp; -typedef png_int_16 FAR * FAR * png_int_16pp; -typedef PNG_CONST char FAR * FAR * png_const_charpp; -typedef char FAR * FAR * png_charpp; -typedef png_fixed_point FAR * FAR * png_fixed_point_pp; -#ifdef PNG_FLOATING_POINT_SUPPORTED -typedef double FAR * FAR * png_doublepp; -#endif - -/* Pointers to pointers to pointers; i.e., pointer to array */ -typedef char FAR * FAR * FAR * png_charppp; - -/* libpng typedefs for types in zlib. If zlib changes - * or another compression library is used, then change these. - * Eliminates need to change all the source files. - */ -typedef charf * png_zcharp; -typedef charf * FAR * png_zcharpp; -typedef z_stream FAR * png_zstreamp; - -/* - * Define PNG_BUILD_DLL if the module being built is a Windows - * LIBPNG DLL. - * - * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. - * It is equivalent to Microsoft predefined macro _DLL that is - * automatically defined when you compile using the share - * version of the CRT (C Run-Time library) - * - * The cygwin mods make this behavior a little different: - * Define PNG_BUILD_DLL if you are building a dll for use with cygwin - * Define PNG_STATIC if you are building a static library for use with cygwin, - * -or- if you are building an application that you want to link to the - * static library. - * PNG_USE_DLL is defined by default (no user action needed) unless one of - * the other flags is defined. - */ - -#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) -# define PNG_DLL -#endif -/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. - * When building a static lib, default to no GLOBAL ARRAYS, but allow - * command-line override - */ -#if defined(__CYGWIN__) -# if !defined(PNG_STATIC) -# if defined(PNG_USE_GLOBAL_ARRAYS) -# undef PNG_USE_GLOBAL_ARRAYS -# endif -# if !defined(PNG_USE_LOCAL_ARRAYS) -# define PNG_USE_LOCAL_ARRAYS -# endif -# else -# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) -# if defined(PNG_USE_GLOBAL_ARRAYS) -# undef PNG_USE_GLOBAL_ARRAYS -# endif -# endif -# endif -# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) -# define PNG_USE_LOCAL_ARRAYS -# endif -#endif - -/* Do not use global arrays (helps with building DLL's) - * They are no longer used in libpng itself, since version 1.0.5c, - * but might be required for some pre-1.0.5c applications. - */ -#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) -# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL)) -# define PNG_USE_LOCAL_ARRAYS -# else -# define PNG_USE_GLOBAL_ARRAYS -# endif -#endif - -#if defined(__CYGWIN__) || defined(__WINE__) -# undef PNGAPI -# if defined(__WINE__) -# define PNGAPI -# else -# define PNGAPI __cdecl -# endif -# undef PNG_IMPEXP -# define PNG_IMPEXP -#endif - -/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", - * you may get warnings regarding the linkage of png_zalloc and png_zfree. - * Don't ignore those warnings; you must also reset the default calling - * convention in your compiler to match your PNGAPI, and you must build - * zlib and your applications the same way you build libpng. - */ - -#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) -# ifndef PNG_NO_MODULEDEF -# define PNG_NO_MODULEDEF -# endif -#endif - -#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) -# define PNG_IMPEXP -#endif - -#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ - (( defined(_Windows) || defined(_WINDOWS) || \ - defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) - -# ifndef PNGAPI -# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) -# define PNGAPI __cdecl -# else -# define PNGAPI _cdecl -# endif -# endif - -# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ - 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) -# define PNG_IMPEXP -# endif - -# if !defined(PNG_IMPEXP) - -# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol -# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol - - /* Borland/Microsoft */ -# if defined(_MSC_VER) || defined(__BORLANDC__) -# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) -# define PNG_EXPORT PNG_EXPORT_TYPE1 -# else -# define PNG_EXPORT PNG_EXPORT_TYPE2 -# if defined(PNG_BUILD_DLL) -# define PNG_IMPEXP __export -# else -# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in - VC++ */ -# endif /* Exists in Borland C++ for - C++ classes (== huge) */ -# endif -# endif - -# if !defined(PNG_IMPEXP) -# if defined(PNG_BUILD_DLL) -# define PNG_IMPEXP __declspec(dllexport) -# else -# define PNG_IMPEXP __declspec(dllimport) -# endif -# endif -# endif /* PNG_IMPEXP */ -#else /* !(DLL || non-cygwin WINDOWS) */ -# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) -# ifndef PNGAPI -# define PNGAPI _System -# endif -# else -# if 0 /* ... other platforms, with other meanings */ -# endif -# endif -#endif - -#if defined(__VISAGECPP__) -/* I don't compile with this _System linkage for wxWidgets */ -# ifdef PNGAPI -# undef PNGAPI -# endif -# define PNGAPI _Optlink -# define PNG_IMPEXP -# define PNG_USE_LOCAL_ARRAYS -# ifdef PNG_USE_GLOBAL_ARRAYS -# undef PNG_USE_GLOBAL_ARRAYS -# endif -extern const char png_libpng_ver[18]; -#endif - -#ifndef PNGAPI -# define PNGAPI -#endif -#ifndef PNG_IMPEXP -# define PNG_IMPEXP -#endif - -#ifndef PNG_EXPORT -# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol -#endif - -#ifdef PNG_USE_GLOBAL_ARRAYS -# ifndef PNG_EXPORT_VAR -# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type -# endif -#endif - -/* User may want to use these so they are not in PNG_INTERNAL. Any library - * functions that are passed far data must be model independent. - */ - -#ifndef PNG_ABORT -# define PNG_ABORT() abort() -#endif - -#ifdef PNG_SETJMP_SUPPORTED -# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) -#else -# define png_jmpbuf(png_ptr) \ - (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) -#endif - -#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ -/* use this to make far-to-near assignments */ -# define CHECK 1 -# define NOCHECK 0 -# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) -# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) -# define png_strcpy _fstrcpy -# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ -# define png_strlen _fstrlen -# define png_memcmp _fmemcmp /* SJT: added */ -# define png_memcpy _fmemcpy -# define png_memset _fmemset -#else /* use the usual functions */ -# define CVT_PTR(ptr) (ptr) -# define CVT_PTR_NOCHECK(ptr) (ptr) -# define png_strcpy strcpy -# define png_strncpy strncpy /* Added to v 1.2.6 */ -# define png_strlen strlen -# define png_memcmp memcmp /* SJT: added */ -# define png_memcpy memcpy -# define png_memset memset -#endif -/* End of memory model independent support */ - -/* Just a little check that someone hasn't tried to define something - * contradictory. - */ -#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) -# undef PNG_ZBUF_SIZE -# define PNG_ZBUF_SIZE 65536L -#endif - -#ifdef PNG_READ_SUPPORTED -/* Prior to libpng-1.0.9, this block was in pngasmrd.h */ -#if defined(PNG_INTERNAL) - -/* These are the default thresholds before the MMX code kicks in; if either - * rowbytes or bitdepth is below the threshold, plain C code is used. These - * can be overridden at runtime via the png_set_mmx_thresholds() call in - * libpng 1.2.0 and later. The values below were chosen by Intel. - */ - -#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT -# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */ -#endif -#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT -# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */ -#endif - -/* Set this in the makefile for VC++ on Pentium, not here. */ -/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c . - * MMX will be detected at run time and used if present. - */ -#ifdef PNG_USE_PNGVCRD -# define PNG_HAVE_ASSEMBLER_COMBINE_ROW -# define PNG_HAVE_ASSEMBLER_READ_INTERLACE -# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW -#endif - -/* Set this in the makefile for gcc/as on Pentium, not here. */ -/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c . - * MMX will be detected at run time and used if present. - */ -#ifdef PNG_USE_PNGGCCRD -# define PNG_HAVE_ASSEMBLER_COMBINE_ROW -# define PNG_HAVE_ASSEMBLER_READ_INTERLACE -# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW -#endif -/* - see pnggccrd.c for info about what is currently enabled */ - -#endif /* PNG_INTERNAL */ -#endif /* PNG_READ_SUPPORTED */ - -#endif /* PNGCONF_H */ - + +/* pngconf.h - machine configurable file for libpng + * + * libpng version 1.2.7 - September 12, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + */ + +/* Any machine specific code is near the front of this file, so if you + * are configuring libpng for a machine, you may want to read the section + * starting here down to where it starts to typedef png_color, png_text, + * and png_info. + */ + +#ifndef PNGCONF_H +#define PNGCONF_H + +#ifdef PNG_USER_CONFIG +#include "pngusr.h" +#endif + +/* This is the size of the compression buffer, and thus the size of + * an IDAT chunk. Make this whatever size you feel is best for your + * machine. One of these will be allocated per png_struct. When this + * is full, it writes the data to the disk, and does some other + * calculations. Making this an extremely small size will slow + * the library down, but you may want to experiment to determine + * where it becomes significant, if you are concerned with memory + * usage. Note that zlib allocates at least 32Kb also. For readers, + * this describes the size of the buffer available to read the data in. + * Unless this gets smaller than the size of a row (compressed), + * it should not make much difference how big this is. + */ + +#ifndef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 8192 +#endif + +/* Enable if you want a write-only libpng */ + +#ifndef PNG_NO_READ_SUPPORTED +# define PNG_READ_SUPPORTED +#endif + +/* Enable if you want a read-only libpng */ + +#ifndef PNG_NO_WRITE_SUPPORTED +# define PNG_WRITE_SUPPORTED +#endif + +/* Enabled by default in 1.2.0. You can disable this if you don't need to + support PNGs that are embedded in MNG datastreams */ +#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) +# ifndef PNG_MNG_FEATURES_SUPPORTED +# define PNG_MNG_FEATURES_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_FLOATING_POINT_SUPPORTED +# ifndef PNG_FLOATING_POINT_SUPPORTED +# define PNG_FLOATING_POINT_SUPPORTED +# endif +#endif + +/* If you are running on a machine where you cannot allocate more + * than 64K of memory at once, uncomment this. While libpng will not + * normally need that much memory in a chunk (unless you load up a very + * large file), zlib needs to know how big of a chunk it can use, and + * libpng thus makes sure to check any memory allocation to verify it + * will fit into memory. +#define PNG_MAX_MALLOC_64K + */ +#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) +# define PNG_MAX_MALLOC_64K +#endif + +/* Special munging to support doing things the 'cygwin' way: + * 'Normal' png-on-win32 defines/defaults: + * PNG_BUILD_DLL -- building dll + * PNG_USE_DLL -- building an application, linking to dll + * (no define) -- building static library, or building an + * application and linking to the static lib + * 'Cygwin' defines/defaults: + * PNG_BUILD_DLL -- (ignored) building the dll + * (no define) -- (ignored) building an application, linking to the dll + * PNG_STATIC -- (ignored) building the static lib, or building an + * application that links to the static lib. + * ALL_STATIC -- (ignored) building various static libs, or building an + * application that links to the static libs. + * Thus, + * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and + * this bit of #ifdefs will define the 'correct' config variables based on + * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but + * unnecessary. + * + * Also, the precedence order is: + * ALL_STATIC (since we can't #undef something outside our namespace) + * PNG_BUILD_DLL + * PNG_STATIC + * (nothing) == PNG_USE_DLL + * + * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent + * of auto-import in binutils, we no longer need to worry about + * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, + * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes + * to __declspec() stuff. However, we DO need to worry about + * PNG_BUILD_DLL and PNG_STATIC because those change some defaults + * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. + */ +#if defined(__CYGWIN__) +# if defined(ALL_STATIC) +# if defined(PNG_BUILD_DLL) +# undef PNG_BUILD_DLL +# endif +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# if !defined(PNG_STATIC) +# define PNG_STATIC +# endif +# else +# if defined (PNG_BUILD_DLL) +# if defined(PNG_STATIC) +# undef PNG_STATIC +# endif +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if !defined(PNG_DLL) +# define PNG_DLL +# endif +# else +# if defined(PNG_STATIC) +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# else +# if !defined(PNG_USE_DLL) +# define PNG_USE_DLL +# endif +# if !defined(PNG_DLL) +# define PNG_DLL +# endif +# endif +# endif +# endif +#endif + +/* This protects us against compilers that run on a windowing system + * and thus don't have or would rather us not use the stdio types: + * stdin, stdout, and stderr. The only one currently used is stderr + * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will + * prevent these from being compiled and used. #defining PNG_NO_STDIO + * will also prevent these, plus will prevent the entire set of stdio + * macros and functions (FILE *, printf, etc.) from being compiled and used, + * unless (PNG_DEBUG > 0) has been #defined. + * + * #define PNG_NO_CONSOLE_IO + * #define PNG_NO_STDIO + */ + +#if defined(_WIN32_WCE) +# include + /* Console I/O functions are not supported on WindowsCE */ +# define PNG_NO_CONSOLE_IO +# ifdef PNG_DEBUG +# undef PNG_DEBUG +# endif +#endif + +#ifdef PNG_BUILD_DLL +# ifndef PNG_CONSOLE_IO_SUPPORTED +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# endif +#endif + +# ifdef PNG_NO_STDIO +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# ifdef PNG_DEBUG +# if (PNG_DEBUG > 0) +# include +# endif +# endif +# else +# if !defined(_WIN32_WCE) +/* "stdio.h" functions are not supported on WindowsCE */ +# include +# endif +# endif + +/* This macro protects us against machines that don't have function + * prototypes (ie K&R style headers). If your compiler does not handle + * function prototypes, define this macro and use the included ansi2knr. + * I've always been able to use _NO_PROTO as the indicator, but you may + * need to drag the empty declaration out in front of here, or change the + * ifdef to suit your own needs. + */ +#ifndef PNGARG + +#ifdef OF /* zlib prototype munger */ +# define PNGARG(arglist) OF(arglist) +#else + +#ifdef _NO_PROTO +# define PNGARG(arglist) () +# ifndef PNG_TYPECAST_NULL +# define PNG_TYPECAST_NULL +# endif +#else +# define PNGARG(arglist) arglist +#endif /* _NO_PROTO */ + +#endif /* OF */ + +#endif /* PNGARG */ + +/* Try to determine if we are compiling on a Mac. Note that testing for + * just __MWERKS__ is not good enough, because the Codewarrior is now used + * on non-Mac platforms. + */ +#ifndef MACOS +# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ + defined(THINK_C) || (defined(__SC__) && !defined(__DMC__))|| defined(TARGET_OS_MAC) +# define MACOS +# endif +#endif + +/* enough people need this for various reasons to include it here */ +#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) +# include +#endif + +#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) +# define PNG_SETJMP_SUPPORTED +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* This is an attempt to force a single setjmp behaviour on Linux. If + * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. + */ + +# ifdef __linux__ +# ifdef _BSD_SOURCE +# define PNG_SAVE_BSD_SOURCE +# undef _BSD_SOURCE +# endif +# ifdef _SETJMP_H + /* If you encounter a compiler error here, see the explanation + * near the end of INSTALL. + */ + __png.h__ already includes setjmp.h; + __dont__ include it again.; +# endif +# endif /* __linux__ */ + + /* include setjmp.h for error handling */ +# include + +# ifdef __linux__ +# ifdef PNG_SAVE_BSD_SOURCE +# define _BSD_SOURCE +# undef PNG_SAVE_BSD_SOURCE +# endif +# endif /* __linux__ */ +#endif /* PNG_SETJMP_SUPPORTED */ + +#ifdef BSD +# include +#else +# include +#endif + +/* Other defines for things like memory and the like can go here. */ +#ifdef PNG_INTERNAL + +#include + +/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which + * aren't usually used outside the library (as far as I know), so it is + * debatable if they should be exported at all. In the future, when it is + * possible to have run-time registry of chunk-handling functions, some of + * these will be made available again. +#define PNG_EXTERN extern + */ +#define PNG_EXTERN + +/* Other defines specific to compilers can go here. Try to keep + * them inside an appropriate ifdef/endif pair for portability. + */ + +#if defined(PNG_FLOATING_POINT_SUPPORTED) +# if defined(MACOS) + /* We need to check that hasn't already been included earlier + * as it seems it doesn't agree with , yet we should really use + * if possible. + */ +# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) +# include +# endif +# else +# include +# endif +# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) + /* Amiga SAS/C: We must include builtin FPU functions when compiling using + * MATH=68881 + */ +# include +# endif +#endif + +/* Codewarrior on NT has linking problems without this. */ +#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) +# define PNG_ALWAYS_EXTERN +#endif + +/* This provides the non-ANSI (far) memory allocation routines. */ +#if defined(__TURBOC__) && defined(__MSDOS__) +# include +# include +#endif + +/* I have no idea why is this necessary... */ +#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ + defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) +# include +#endif + +/* This controls how fine the dithering gets. As this allocates + * a largish chunk of memory (32K), those who are not as concerned + * with dithering quality can decrease some or all of these. + */ +#ifndef PNG_DITHER_RED_BITS +# define PNG_DITHER_RED_BITS 5 +#endif +#ifndef PNG_DITHER_GREEN_BITS +# define PNG_DITHER_GREEN_BITS 5 +#endif +#ifndef PNG_DITHER_BLUE_BITS +# define PNG_DITHER_BLUE_BITS 5 +#endif + +/* This controls how fine the gamma correction becomes when you + * are only interested in 8 bits anyway. Increasing this value + * results in more memory being used, and more pow() functions + * being called to fill in the gamma tables. Don't set this value + * less then 8, and even that may not work (I haven't tested it). + */ + +#ifndef PNG_MAX_GAMMA_8 +# define PNG_MAX_GAMMA_8 11 +#endif + +/* This controls how much a difference in gamma we can tolerate before + * we actually start doing gamma conversion. + */ +#ifndef PNG_GAMMA_THRESHOLD +# define PNG_GAMMA_THRESHOLD 0.05 +#endif + +#endif /* PNG_INTERNAL */ + +/* The following uses const char * instead of char * for error + * and warning message functions, so some compilers won't complain. + * If you do not want to use const, define PNG_NO_CONST here. + */ + +#ifndef PNG_NO_CONST +# define PNG_CONST const +#else +# define PNG_CONST +#endif + +/* The following defines give you the ability to remove code from the + * library that you will not be using. I wish I could figure out how to + * automate this, but I can't do that without making it seriously hard + * on the users. So if you are not using an ability, change the #define + * to and #undef, and that part of the library will not be compiled. If + * your linker can't find a function, you may want to make sure the + * ability is defined here. Some of these depend upon some others being + * defined. I haven't figured out all the interactions here, so you may + * have to experiment awhile to get everything to compile. If you are + * creating or using a shared library, you probably shouldn't touch this, + * as it will affect the size of the structures, and this will cause bad + * things to happen if the library and/or application ever change. + */ + +/* Any features you will not be using can be undef'ed here */ + +/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user + * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS + * on the compile line, then pick and choose which ones to define without + * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED + * if you only want to have a png-compliant reader/writer but don't need + * any of the extra transformations. This saves about 80 kbytes in a + * typical installation of the library. (PNG_NO_* form added in version + * 1.0.1c, for consistency) + */ + +/* The size of the png_text structure changed in libpng-1.0.6 when + * iTXt is supported. It is turned off by default, to support old apps + * that malloc the png_text structure instead of calling png_set_text() + * and letting libpng malloc it. It will be turned on by default in + * libpng-1.3.0. + */ + +#ifndef PNG_iTXt_SUPPORTED +# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) +# define PNG_NO_READ_iTXt +# endif +# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) +# define PNG_NO_WRITE_iTXt +# endif +#endif + +/* The following support, added after version 1.0.0, can be turned off here en + * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility + * with old applications that require the length of png_struct and png_info + * to remain unchanged. + */ + +#ifdef PNG_LEGACY_SUPPORTED +# define PNG_NO_FREE_ME +# define PNG_NO_READ_UNKNOWN_CHUNKS +# define PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_NO_READ_USER_CHUNKS +# define PNG_NO_READ_iCCP +# define PNG_NO_WRITE_iCCP +# define PNG_NO_READ_iTXt +# define PNG_NO_WRITE_iTXt +# define PNG_NO_READ_sCAL +# define PNG_NO_WRITE_sCAL +# define PNG_NO_READ_sPLT +# define PNG_NO_WRITE_sPLT +# define PNG_NO_INFO_IMAGE +# define PNG_NO_READ_RGB_TO_GRAY +# define PNG_NO_READ_USER_TRANSFORM +# define PNG_NO_WRITE_USER_TRANSFORM +# define PNG_NO_USER_MEM +# define PNG_NO_READ_EMPTY_PLTE +# define PNG_NO_MNG_FEATURES +# define PNG_NO_FIXED_POINT_SUPPORTED +#endif + +/* Ignore attempt to turn off both floating and fixed point support */ +#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ + !defined(PNG_NO_FIXED_POINT_SUPPORTED) +# define PNG_FIXED_POINT_SUPPORTED +#endif + +#ifndef PNG_NO_FREE_ME +# define PNG_FREE_ME_SUPPORTED +#endif + +#if defined(PNG_READ_SUPPORTED) + +#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_TRANSFORMS) +# define PNG_READ_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_READ_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_READ_EXPAND +# define PNG_READ_EXPAND_SUPPORTED +# endif +# ifndef PNG_NO_READ_SHIFT +# define PNG_READ_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACK +# define PNG_READ_PACK_SUPPORTED +# endif +# ifndef PNG_NO_READ_BGR +# define PNG_READ_BGR_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP +# define PNG_READ_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACKSWAP +# define PNG_READ_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT +# define PNG_READ_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_READ_DITHER +# define PNG_READ_DITHER_SUPPORTED +# endif +# ifndef PNG_NO_READ_BACKGROUND +# define PNG_READ_BACKGROUND_SUPPORTED +# endif +# ifndef PNG_NO_READ_16_TO_8 +# define PNG_READ_16_TO_8_SUPPORTED +# endif +# ifndef PNG_NO_READ_FILLER +# define PNG_READ_FILLER_SUPPORTED +# endif +# ifndef PNG_NO_READ_GAMMA +# define PNG_READ_GAMMA_SUPPORTED +# endif +# ifndef PNG_NO_READ_GRAY_TO_RGB +# define PNG_READ_GRAY_TO_RGB_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP_ALPHA +# define PNG_READ_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT_ALPHA +# define PNG_READ_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_STRIP_ALPHA +# define PNG_READ_STRIP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_USER_TRANSFORM +# define PNG_READ_USER_TRANSFORM_SUPPORTED +# endif +# ifndef PNG_NO_READ_RGB_TO_GRAY +# define PNG_READ_RGB_TO_GRAY_SUPPORTED +# endif +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ + +#if !defined(PNG_NO_PROGRESSIVE_READ) && \ + !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ +# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ +#endif /* about interlacing capability! You'll */ + /* still have interlacing unless you change the following line: */ + +#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ + +#ifndef PNG_NO_READ_COMPOSITE_NODIV +# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ +# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ +# endif +#endif + +/* Deprecated, will be removed from version 2.0.0. + Use PNG_MNG_FEATURES_SUPPORTED instead. */ +#ifndef PNG_NO_READ_EMPTY_PLTE +# define PNG_READ_EMPTY_PLTE_SUPPORTED +#endif + +#endif /* PNG_READ_SUPPORTED */ + +#if defined(PNG_WRITE_SUPPORTED) + +# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_TRANSFORMS) +# define PNG_WRITE_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_WRITE_SHIFT +# define PNG_WRITE_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACK +# define PNG_WRITE_PACK_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_BGR +# define PNG_WRITE_BGR_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_SWAP +# define PNG_WRITE_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACKSWAP +# define PNG_WRITE_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT +# define PNG_WRITE_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_FILLER +# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ +# endif +# ifndef PNG_NO_WRITE_SWAP_ALPHA +# define PNG_WRITE_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT_ALPHA +# define PNG_WRITE_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_USER_TRANSFORM +# define PNG_WRITE_USER_TRANSFORM_SUPPORTED +# endif +#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ + +#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant + encoders, but can cause trouble + if left undefined */ + +#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED +#endif + +#ifndef PNG_NO_WRITE_FLUSH +# define PNG_WRITE_FLUSH_SUPPORTED +#endif + +/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */ +#ifndef PNG_NO_WRITE_EMPTY_PLTE +# define PNG_WRITE_EMPTY_PLTE_SUPPORTED +#endif + +#endif /* PNG_WRITE_SUPPORTED */ + +#ifndef PNG_1_0_X +# ifndef PNG_NO_ERROR_NUMBERS +# define PNG_ERROR_NUMBERS_SUPPORTED +# endif +#endif /* PNG_1_0_X */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +# ifndef PNG_NO_USER_TRANSFORM_PTR +# define PNG_USER_TRANSFORM_PTR_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_STDIO +# define PNG_TIME_RFC1123_SUPPORTED +#endif + +/* This adds extra functions in pngget.c for accessing data from the + * info pointer (added in version 0.99) + * png_get_image_width() + * png_get_image_height() + * png_get_bit_depth() + * png_get_color_type() + * png_get_compression_type() + * png_get_filter_type() + * png_get_interlace_type() + * png_get_pixel_aspect_ratio() + * png_get_pixels_per_meter() + * png_get_x_offset_pixels() + * png_get_y_offset_pixels() + * png_get_x_offset_microns() + * png_get_y_offset_microns() + */ +#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) +# define PNG_EASY_ACCESS_SUPPORTED +#endif + +/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 + even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */ +#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) +# ifndef PNG_ASSEMBLER_CODE_SUPPORTED +# define PNG_ASSEMBLER_CODE_SUPPORTED +# endif +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_MMX_CODE_SUPPORTED +# endif +#endif + +/* If you are sure that you don't need thread safety and you are compiling + with PNG_USE_PNGCCRD for an MMX application, you can define this for + faster execution. See pnggccrd.c. +#define PNG_THREAD_UNSAFE_OK +*/ + +#if !defined(PNG_1_0_X) +#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) +# define PNG_USER_MEM_SUPPORTED +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#if !defined(PNG_1_0_X) +#ifndef PNG_SET_USER_LIMITS_SUPPORTED +#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) +# define PNG_SET_USER_LIMITS_SUPPORTED +#endif +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter + * how large, set these limits to 0x7fffffffL + */ +#ifndef PNG_USER_WIDTH_MAX +# define PNG_USER_WIDTH_MAX 1000000L +#endif +#ifndef PNG_USER_HEIGHT_MAX +# define PNG_USER_HEIGHT_MAX 1000000L +#endif + +/* These are currently experimental features, define them if you want */ + +/* very little testing */ +/* +#ifdef PNG_READ_SUPPORTED +# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# endif +#endif +*/ + +/* This is only for PowerPC big-endian and 680x0 systems */ +/* some testing */ +/* +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +# define PNG_READ_BIG_ENDIAN_SUPPORTED +#endif +*/ + +/* Buggy compilers (e.g., gcc 2.7.2.2) need this */ +/* +#define PNG_NO_POINTER_INDEXING +*/ + +/* These functions are turned off by default, as they will be phased out. */ +/* +#define PNG_USELESS_TESTS_SUPPORTED +#define PNG_CORRECT_PALETTE_SUPPORTED +*/ + +/* Any chunks you are not interested in, you can undef here. The + * ones that allocate memory may be expecially important (hIST, + * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info + * a bit smaller. + */ + +#if defined(PNG_READ_SUPPORTED) && \ + !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_ANCILLARY_CHUNKS) +# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#if defined(PNG_WRITE_SUPPORTED) && \ + !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) +# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_READ_TEXT +# define PNG_NO_READ_iTXt +# define PNG_NO_READ_tEXt +# define PNG_NO_READ_zTXt +#endif +#ifndef PNG_NO_READ_bKGD +# define PNG_READ_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +#endif +#ifndef PNG_NO_READ_cHRM +# define PNG_READ_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +#endif +#ifndef PNG_NO_READ_gAMA +# define PNG_READ_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +#endif +#ifndef PNG_NO_READ_hIST +# define PNG_READ_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +#endif +#ifndef PNG_NO_READ_iCCP +# define PNG_READ_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +#endif +#ifndef PNG_NO_READ_iTXt +# ifndef PNG_READ_iTXt_SUPPORTED +# define PNG_READ_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_oFFs +# define PNG_READ_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +#endif +#ifndef PNG_NO_READ_pCAL +# define PNG_READ_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_sCAL +# define PNG_READ_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_pHYs +# define PNG_READ_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +#endif +#ifndef PNG_NO_READ_sBIT +# define PNG_READ_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sPLT +# define PNG_READ_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sRGB +# define PNG_READ_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +#endif +#ifndef PNG_NO_READ_tEXt +# define PNG_READ_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_tIME +# define PNG_READ_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +#endif +#ifndef PNG_NO_READ_tRNS +# define PNG_READ_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +#endif +#ifndef PNG_NO_READ_zTXt +# define PNG_READ_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_UNKNOWN_CHUNKS +# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_NO_HANDLE_AS_UNKNOWN +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif +#if !defined(PNG_NO_READ_USER_CHUNKS) && \ + defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) +# define PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_USER_CHUNKS_SUPPORTED +# ifdef PNG_NO_READ_UNKNOWN_CHUNKS +# undef PNG_NO_READ_UNKNOWN_CHUNKS +# endif +# ifdef PNG_NO_HANDLE_AS_UNKNOWN +# undef PNG_NO_HANDLE_AS_UNKNOWN +# endif +#endif +#ifndef PNG_NO_READ_OPT_PLTE +# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ +#endif /* optional PLTE chunk in RGB and RGBA images */ +#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ + defined(PNG_READ_zTXt_SUPPORTED) +# define PNG_READ_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +#endif + +#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_WRITE_TEXT +# define PNG_NO_WRITE_iTXt +# define PNG_NO_WRITE_tEXt +# define PNG_NO_WRITE_zTXt +#endif +#ifndef PNG_NO_WRITE_bKGD +# define PNG_WRITE_bKGD_SUPPORTED +# ifndef PNG_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_cHRM +# define PNG_WRITE_cHRM_SUPPORTED +# ifndef PNG_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_gAMA +# define PNG_WRITE_gAMA_SUPPORTED +# ifndef PNG_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_hIST +# define PNG_WRITE_hIST_SUPPORTED +# ifndef PNG_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iCCP +# define PNG_WRITE_iCCP_SUPPORTED +# ifndef PNG_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iTXt +# ifndef PNG_WRITE_iTXt_SUPPORTED +# define PNG_WRITE_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_oFFs +# define PNG_WRITE_oFFs_SUPPORTED +# ifndef PNG_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pCAL +# define PNG_WRITE_pCAL_SUPPORTED +# ifndef PNG_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sCAL +# define PNG_WRITE_sCAL_SUPPORTED +# ifndef PNG_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pHYs +# define PNG_WRITE_pHYs_SUPPORTED +# ifndef PNG_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sBIT +# define PNG_WRITE_sBIT_SUPPORTED +# ifndef PNG_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sPLT +# define PNG_WRITE_sPLT_SUPPORTED +# ifndef PNG_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sRGB +# define PNG_WRITE_sRGB_SUPPORTED +# ifndef PNG_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tEXt +# define PNG_WRITE_tEXt_SUPPORTED +# ifndef PNG_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tIME +# define PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tRNS +# define PNG_WRITE_tRNS_SUPPORTED +# ifndef PNG_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_zTXt +# define PNG_WRITE_zTXt_SUPPORTED +# ifndef PNG_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +# endif +#endif +#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ + defined(PNG_WRITE_zTXt_SUPPORTED) +# define PNG_WRITE_TEXT_SUPPORTED +# ifndef PNG_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +# endif +#endif + +#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ + +/* Turn this off to disable png_read_png() and + * png_write_png() and leave the row_pointers member + * out of the info structure. + */ +#ifndef PNG_NO_INFO_IMAGE +# define PNG_INFO_IMAGE_SUPPORTED +#endif + +/* need the time information for reading tIME chunks */ +#if defined(PNG_tIME_SUPPORTED) +# if !defined(_WIN32_WCE) + /* "time.h" functions are not supported on WindowsCE */ +# include +# endif +#endif + +/* Some typedefs to get us started. These should be safe on most of the + * common platforms. The typedefs should be at least as large as the + * numbers suggest (a png_uint_32 must be at least 32 bits long), but they + * don't have to be exactly that size. Some compilers dislike passing + * unsigned shorts as function parameters, so you may be better off using + * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may + * want to have unsigned int for png_uint_32 instead of unsigned long. + */ + +typedef unsigned long png_uint_32; +typedef long png_int_32; +typedef unsigned short png_uint_16; +typedef short png_int_16; +typedef unsigned char png_byte; + +/* This is usually size_t. It is typedef'ed just in case you need it to + change (I'm not sure if you will or not, so I thought I'd be safe) */ +#ifdef PNG_SIZE_T + typedef PNG_SIZE_T png_size_t; +# define png_sizeof(x) png_convert_size(sizeof (x)) +#else + typedef size_t png_size_t; +# define png_sizeof(x) sizeof (x) +#endif + +/* The following is needed for medium model support. It cannot be in the + * PNG_INTERNAL section. Needs modification for other compilers besides + * MSC. Model independent support declares all arrays and pointers to be + * large using the far keyword. The zlib version used must also support + * model independent data. As of version zlib 1.0.4, the necessary changes + * have been made in zlib. The USE_FAR_KEYWORD define triggers other + * changes that are needed. (Tim Wegner) + */ + +/* Separate compiler dependencies (problem here is that zlib.h always + defines FAR. (SJT) */ +#ifdef __BORLANDC__ +# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) +# define LDATA 1 +# else +# define LDATA 0 +# endif + /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ +# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) +# define PNG_MAX_MALLOC_64K +# if (LDATA != 1) +# ifndef FAR +# define FAR __far +# endif +# define USE_FAR_KEYWORD +# endif /* LDATA != 1 */ + /* Possibly useful for moving data out of default segment. + * Uncomment it if you want. Could also define FARDATA as + * const if your compiler supports it. (SJT) +# define FARDATA FAR + */ +# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ +#endif /* __BORLANDC__ */ + + +/* Suggest testing for specific compiler first before testing for + * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, + * making reliance oncertain keywords suspect. (SJT) + */ + +/* MSC Medium model */ +#if defined(FAR) +# if defined(M_I86MM) +# define USE_FAR_KEYWORD +# define FARDATA FAR +# include +# endif +#endif + +/* SJT: default case */ +#ifndef FAR +# define FAR +#endif + +/* At this point FAR is always defined */ +#ifndef FARDATA +# define FARDATA +#endif + +/* Typedef for floating-point numbers that are converted + to fixed-point with a multiple of 100,000, e.g., int_gamma */ +typedef png_int_32 png_fixed_point; + +/* Add typedefs for pointers */ +typedef void FAR * png_voidp; +typedef png_byte FAR * png_bytep; +typedef png_uint_32 FAR * png_uint_32p; +typedef png_int_32 FAR * png_int_32p; +typedef png_uint_16 FAR * png_uint_16p; +typedef png_int_16 FAR * png_int_16p; +typedef PNG_CONST char FAR * png_const_charp; +typedef char FAR * png_charp; +typedef png_fixed_point FAR * png_fixed_point_p; + +#ifndef PNG_NO_STDIO +#if defined(_WIN32_WCE) +typedef HANDLE png_FILE_p; +#else +typedef FILE * png_FILE_p; +#endif +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * png_doublep; +#endif + +/* Pointers to pointers; i.e. arrays */ +typedef png_byte FAR * FAR * png_bytepp; +typedef png_uint_32 FAR * FAR * png_uint_32pp; +typedef png_int_32 FAR * FAR * png_int_32pp; +typedef png_uint_16 FAR * FAR * png_uint_16pp; +typedef png_int_16 FAR * FAR * png_int_16pp; +typedef PNG_CONST char FAR * FAR * png_const_charpp; +typedef char FAR * FAR * png_charpp; +typedef png_fixed_point FAR * FAR * png_fixed_point_pp; +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * FAR * png_doublepp; +#endif + +/* Pointers to pointers to pointers; i.e., pointer to array */ +typedef char FAR * FAR * FAR * png_charppp; + +/* libpng typedefs for types in zlib. If zlib changes + * or another compression library is used, then change these. + * Eliminates need to change all the source files. + */ +typedef charf * png_zcharp; +typedef charf * FAR * png_zcharpp; +typedef z_stream FAR * png_zstreamp; + +/* + * Define PNG_BUILD_DLL if the module being built is a Windows + * LIBPNG DLL. + * + * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. + * It is equivalent to Microsoft predefined macro _DLL that is + * automatically defined when you compile using the share + * version of the CRT (C Run-Time library) + * + * The cygwin mods make this behavior a little different: + * Define PNG_BUILD_DLL if you are building a dll for use with cygwin + * Define PNG_STATIC if you are building a static library for use with cygwin, + * -or- if you are building an application that you want to link to the + * static library. + * PNG_USE_DLL is defined by default (no user action needed) unless one of + * the other flags is defined. + */ + +#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) +# define PNG_DLL +#endif +/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. + * When building a static lib, default to no GLOBAL ARRAYS, but allow + * command-line override + */ +#if defined(__CYGWIN__) +# if !defined(PNG_STATIC) +# if defined(PNG_USE_GLOBAL_ARRAYS) +# undef PNG_USE_GLOBAL_ARRAYS +# endif +# if !defined(PNG_USE_LOCAL_ARRAYS) +# define PNG_USE_LOCAL_ARRAYS +# endif +# else +# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) +# if defined(PNG_USE_GLOBAL_ARRAYS) +# undef PNG_USE_GLOBAL_ARRAYS +# endif +# endif +# endif +# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) +# define PNG_USE_LOCAL_ARRAYS +# endif +#endif + +/* Do not use global arrays (helps with building DLL's) + * They are no longer used in libpng itself, since version 1.0.5c, + * but might be required for some pre-1.0.5c applications. + */ +#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) +# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL)) +# define PNG_USE_LOCAL_ARRAYS +# else +# define PNG_USE_GLOBAL_ARRAYS +# endif +#endif + +#if defined(__CYGWIN__) || defined(__WINE__) +# undef PNGAPI +# if defined(__WINE__) +# define PNGAPI +# else +# define PNGAPI __cdecl +# endif +# undef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", + * you may get warnings regarding the linkage of png_zalloc and png_zfree. + * Don't ignore those warnings; you must also reset the default calling + * convention in your compiler to match your PNGAPI, and you must build + * zlib and your applications the same way you build libpng. + */ + +#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) +# ifndef PNG_NO_MODULEDEF +# define PNG_NO_MODULEDEF +# endif +#endif + +#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) +# define PNG_IMPEXP +#endif + +#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ + (( defined(_Windows) || defined(_WINDOWS) || \ + defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) + +# ifndef PNGAPI +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# define PNGAPI __cdecl +# else +# define PNGAPI _cdecl +# endif +# endif + +# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ + 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) +# define PNG_IMPEXP +# endif + +# if !defined(PNG_IMPEXP) + +# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol +# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol + + /* Borland/Microsoft */ +# if defined(_MSC_VER) || defined(__BORLANDC__) +# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) +# define PNG_EXPORT PNG_EXPORT_TYPE1 +# else +# define PNG_EXPORT PNG_EXPORT_TYPE2 +# if defined(PNG_BUILD_DLL) +# define PNG_IMPEXP __export +# else +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in + VC++ */ +# endif /* Exists in Borland C++ for + C++ classes (== huge) */ +# endif +# endif + +# if !defined(PNG_IMPEXP) +# if defined(PNG_BUILD_DLL) +# define PNG_IMPEXP __declspec(dllexport) +# else +# define PNG_IMPEXP __declspec(dllimport) +# endif +# endif +# endif /* PNG_IMPEXP */ +#else /* !(DLL || non-cygwin WINDOWS) */ +# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) +# ifndef PNGAPI +# define PNGAPI _System +# endif +# else +# if 0 /* ... other platforms, with other meanings */ +# endif +# endif +#endif + +#if defined(__VISAGECPP__) +/* I don't compile with this _System linkage for wxWidgets */ +# ifdef PNGAPI +# undef PNGAPI +# endif +# define PNGAPI _Optlink +# define PNG_IMPEXP +# define PNG_USE_LOCAL_ARRAYS +# ifdef PNG_USE_GLOBAL_ARRAYS +# undef PNG_USE_GLOBAL_ARRAYS +# endif +extern const char png_libpng_ver[18]; +#endif + +#ifndef PNGAPI +# define PNGAPI +#endif +#ifndef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol +#endif + +#ifdef PNG_USE_GLOBAL_ARRAYS +# ifndef PNG_EXPORT_VAR +# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type +# endif +#endif + +/* User may want to use these so they are not in PNG_INTERNAL. Any library + * functions that are passed far data must be model independent. + */ + +#ifndef PNG_ABORT +# define PNG_ABORT() abort() +#endif + +#ifdef PNG_SETJMP_SUPPORTED +# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) +#else +# define png_jmpbuf(png_ptr) \ + (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) +#endif + +#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ +/* use this to make far-to-near assignments */ +# define CHECK 1 +# define NOCHECK 0 +# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) +# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) +# define png_strcpy _fstrcpy +# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ +# define png_strlen _fstrlen +# define png_memcmp _fmemcmp /* SJT: added */ +# define png_memcpy _fmemcpy +# define png_memset _fmemset +#else /* use the usual functions */ +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# define png_strcpy strcpy +# define png_strncpy strncpy /* Added to v 1.2.6 */ +# define png_strlen strlen +# define png_memcmp memcmp /* SJT: added */ +# define png_memcpy memcpy +# define png_memset memset +#endif +/* End of memory model independent support */ + +/* Just a little check that someone hasn't tried to define something + * contradictory. + */ +#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) +# undef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 65536L +#endif + +#ifdef PNG_READ_SUPPORTED +/* Prior to libpng-1.0.9, this block was in pngasmrd.h */ +#if defined(PNG_INTERNAL) + +/* These are the default thresholds before the MMX code kicks in; if either + * rowbytes or bitdepth is below the threshold, plain C code is used. These + * can be overridden at runtime via the png_set_mmx_thresholds() call in + * libpng 1.2.0 and later. The values below were chosen by Intel. + */ + +#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT +# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */ +#endif +#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT +# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */ +#endif + +/* Set this in the makefile for VC++ on Pentium, not here. */ +/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c . + * MMX will be detected at run time and used if present. + */ +#ifdef PNG_USE_PNGVCRD +# define PNG_HAVE_ASSEMBLER_COMBINE_ROW +# define PNG_HAVE_ASSEMBLER_READ_INTERLACE +# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +#endif + +/* Set this in the makefile for gcc/as on Pentium, not here. */ +/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c . + * MMX will be detected at run time and used if present. + */ +#ifdef PNG_USE_PNGGCCRD +# define PNG_HAVE_ASSEMBLER_COMBINE_ROW +# define PNG_HAVE_ASSEMBLER_READ_INTERLACE +# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +#endif +/* - see pnggccrd.c for info about what is currently enabled */ + +#endif /* PNG_INTERNAL */ +#endif /* PNG_READ_SUPPORTED */ + +#endif /* PNGCONF_H */ + diff --git a/Externals/zlib/crc32.h b/Externals/zlib/crc32.h index 5de49bc978..8053b6117c 100644 --- a/Externals/zlib/crc32.h +++ b/Externals/zlib/crc32.h @@ -1,441 +1,441 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const unsigned long FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/Externals/zlib/deflate.h b/Externals/zlib/deflate.h index 222c53e043..05a5ab3a2c 100644 --- a/Externals/zlib/deflate.h +++ b/Externals/zlib/deflate.h @@ -1,331 +1,331 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2004 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - - /* in trees.c */ -void _tr_init OF((deflate_state *s)); -int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); -void _tr_align OF((deflate_state *s)); -void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch _length_code[]; - extern uch _dist_code[]; -#else - extern const uch _length_code[]; - extern const uch _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2004 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + + /* in trees.c */ +void _tr_init OF((deflate_state *s)); +int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, + int eof)); +void _tr_align OF((deflate_state *s)); +void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, + int eof)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch _length_code[]; + extern uch _dist_code[]; +#else + extern const uch _length_code[]; + extern const uch _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/Externals/zlib/inffast.h b/Externals/zlib/inffast.h index 614fa7877d..1e88d2d97b 100644 --- a/Externals/zlib/inffast.h +++ b/Externals/zlib/inffast.h @@ -1,11 +1,11 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void inflate_fast OF((z_streamp strm, unsigned start)); +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/Externals/zlib/inffixed.h b/Externals/zlib/inffixed.h index 423d5c5b50..75ed4b5978 100644 --- a/Externals/zlib/inffixed.h +++ b/Externals/zlib/inffixed.h @@ -1,94 +1,94 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. It - is part of the implementation of the compression library and - is subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/Externals/zlib/inflate.h b/Externals/zlib/inflate.h index fbbc871432..07bd3e78a7 100644 --- a/Externals/zlib/inflate.h +++ b/Externals/zlib/inflate.h @@ -1,115 +1,115 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN, /* i: waiting for length/lit code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to the BAD or MEM mode -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME - NAME -> COMMENT -> HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - Read deflate blocks: - TYPE -> STORED or TABLE or LEN or CHECK - STORED -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN - Read deflate codes: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 7K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ -}; +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2004 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN, /* i: waiting for length/lit code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to the BAD or MEM mode -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME + NAME -> COMMENT -> HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + Read deflate blocks: + TYPE -> STORED or TABLE or LEN or CHECK + STORED -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN + Read deflate codes: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 7K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned write; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ +}; diff --git a/Externals/zlib/inftrees.h b/Externals/zlib/inftrees.h index dc0fd567ea..b1104c87e7 100644 --- a/Externals/zlib/inftrees.h +++ b/Externals/zlib/inftrees.h @@ -1,55 +1,55 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of dynamic tree. The maximum found in a long but non- - exhaustive search was 1444 code structures (852 for length/literals - and 592 for distances, the latter actually the result of an - exhaustive search). The true maximum is not known, but the value - below is more than safe. */ -#define ENOUGH 2048 -#define MAXD 592 - -/* Type of code to build for inftable() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -extern int inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of dynamic tree. The maximum found in a long but non- + exhaustive search was 1444 code structures (852 for length/literals + and 592 for distances, the latter actually the result of an + exhaustive search). The true maximum is not known, but the value + below is more than safe. */ +#define ENOUGH 2048 +#define MAXD 592 + +/* Type of code to build for inftable() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +extern int inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/Externals/zlib/trees.h b/Externals/zlib/trees.h index 1ca868b848..72facf900f 100644 --- a/Externals/zlib/trees.h +++ b/Externals/zlib/trees.h @@ -1,128 +1,128 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/Externals/zlib/zconf.h b/Externals/zlib/zconf.h index e3b0c962e3..03a9431c8b 100644 --- a/Externals/zlib/zconf.h +++ b/Externals/zlib/zconf.h @@ -1,332 +1,332 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/Externals/zlib/zconf.in.h b/Externals/zlib/zconf.in.h index e3b0c962e3..03a9431c8b 100644 --- a/Externals/zlib/zconf.in.h +++ b/Externals/zlib/zconf.in.h @@ -1,332 +1,332 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/Externals/zlib/zlib.h b/Externals/zlib/zlib.h index 62d0e4675b..022817927c 100644 --- a/Externals/zlib/zlib.h +++ b/Externals/zlib/zlib.h @@ -1,1357 +1,1357 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.3, July 18th, 2005 - - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.3" -#define ZLIB_VERNUM 0x1230 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumualte before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it gets to the next deflate block boundary. When decoding the - zlib or gzip format, this will cause inflate() to return immediately after - the header and before the first block. When doing a raw inflate, inflate() - will go ahead and process the first block, and will return when it gets to - the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. Z_FIXED prevents the - use of dynamic Huffman codes, allowing for a simpler decoder for special - applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. In addition, the - current implementation of deflate will use at most the window size minus - 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is - a crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg - is set to null if there is no error message. inflateInit2 does not perform - any decompression apart from reading the zlib header if present: this will - be done by inflate(). (So next_in and avail_in may be modified, but next_out - and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK can be used to - force inflate() to return immediately after header processing is complete - and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When - any of extra, name, or comment are not Z_NULL and the respective field is - not present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns 1 if file is being read directly without decompression, otherwise - zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); -/* - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is NULL, this function returns the required initial - value for the for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - -/* - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/Externals/zlib/zutil.h b/Externals/zlib/zutil.h index 0ba6e02087..b7d5eff81b 100644 --- a/Externals/zlib/zutil.h +++ b/Externals/zlib/zutil.h @@ -1,269 +1,269 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#define ZLIB_INTERNAL -#include "zlib.h" - -#ifdef STDC -# ifndef _WIN32_WCE -# include -# endif -# include -# include -#endif -#ifdef NO_ERRNO_H -# ifdef _WIN32_WCE - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. We rename it to - * avoid conflict with other libraries that use the same workaround. - */ -# define errno z_errno -# endif - extern int errno; -#else -# ifndef _WIN32_WCE -# include -# endif -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# ifdef M_I86 - #include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# define vsnprintf _vsnprintf -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif -#ifdef VMS -# define NO_vsnprintf -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - extern void zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int z_verbose; - extern void z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* ZUTIL_H */ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#define ZLIB_INTERNAL +#include "zlib.h" + +#ifdef STDC +# ifndef _WIN32_WCE +# include +# endif +# include +# include +#endif +#ifdef NO_ERRNO_H +# ifdef _WIN32_WCE + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. We rename it to + * avoid conflict with other libraries that use the same workaround. + */ +# define errno z_errno +# endif + extern int errno; +#else +# ifndef _WIN32_WCE +# include +# endif +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 + #include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# define vsnprintf _vsnprintf +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + extern void zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int z_verbose; + extern void z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); +void zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */